From: Cris Di Sclafani Date: Fri, 30 Oct 2020 12:09:16 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=6e568081de75acc6fd067def25e10c90335743a6;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 6b56f3c..57173fd 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T11:41:18.021Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T12:00:41.933Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9a8f033..b89f004 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T11:41:18.021Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n
\n

API Key

\n

In your request, specify the API Key in apikey query parameter

\n

Example:

\n
curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T12:00:41.933Z", "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 80128b8..7eb2a1c 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 _0x30b0=['STRING','contactManager','integration','urlForward','bot','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','action'];(function(_0x2f370a,_0x543460){var _0x49a7b9=function(_0x211782){while(--_0x211782){_0x2f370a['push'](_0x2f370a['shift']());}};_0x49a7b9(++_0x543460);}(_0x30b0,0xa2));var _0x030b=function(_0xbaee4f,_0x5bc8b4){_0xbaee4f=_0xbaee4f-0x0;var _0xa57eae=_0x30b0[_0xbaee4f];return _0xa57eae;};'use strict';var Sequelize=require(_0x030b('0x0'));module['exports']={'name':{'type':Sequelize[_0x030b('0x1')],'get':function(_0xb4a348){return this['getDataValue'](_0x030b('0x2'));}},'action':{'type':Sequelize[_0x030b('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x030b('0x4'),_0x030b('0x5'),'motionbar','jscripty',_0x030b('0x6'),'browser',_0x030b('0x7'),'script']],'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[_0x030b('0x3')](0x1000),'comment':_0x030b('0x8')},'data2':{'type':Sequelize[_0x030b('0x3')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x030b('0x3')](0x1000),'comment':_0x030b('0x9')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x030b('0x3')](0x1000)},'data6':{'type':Sequelize[_0x030b('0x3')]},'data7':{'type':Sequelize[_0x030b('0xa')]}}; \ No newline at end of file +var _0x8818=['contactManager','integration','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','VIRTUAL','getDataValue','action','STRING'];(function(_0x284190,_0x13ed15){var _0x2ee544=function(_0x4bd36a){while(--_0x4bd36a){_0x284190['push'](_0x284190['shift']());}};_0x2ee544(++_0x13ed15);}(_0x8818,0x1af));var _0x8881=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x8818[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8881('0x0')],'get':function(_0x20f4e0){return this[_0x8881('0x1')](_0x8881('0x2'));}},'action':{'type':Sequelize[_0x8881('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8881('0x4'),_0x8881('0x5'),'motionbar',_0x8881('0x6'),'urlForward',_0x8881('0x7'),_0x8881('0x8'),_0x8881('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x8881('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x8881('0xb')},'data2':{'type':Sequelize[_0x8881('0x3')](0x1000),'comment':_0x8881('0xc')},'data3':{'type':Sequelize[_0x8881('0x3')](0x1000),'comment':_0x8881('0xd')},'data4':{'type':Sequelize[_0x8881('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x8881('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index f387bf9..5ba1585 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 _0x73df=['request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','name','send','body','Action','params','catch','html-pdf','eml-format','zip-dir'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x73df,0x180));var _0xf73d=function(_0x46a4b,_0x2bdc6d){_0x46a4b=_0x46a4b-0x0;var _0x3ab7bf=_0x73df[_0x46a4b];return _0x3ab7bf;};'use strict';var pdf=require(_0xf73d('0x0'));var emlformat=require(_0xf73d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf73d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf73d('0x3'));var moment=require('moment');var BPromise=require(_0xf73d('0x4'));var Mustache=require(_0xf73d('0x5'));var util=require(_0xf73d('0x6'));var path=require('path');var sox=require(_0xf73d('0x7'));var csv=require(_0xf73d('0x8'));var ejs=require(_0xf73d('0x9'));var fs=require('fs');var _=require(_0xf73d('0xa'));var squel=require(_0xf73d('0xb'));var crypto=require(_0xf73d('0xc'));var jsforce=require(_0xf73d('0xd'));var deskjs=require(_0xf73d('0xe'));var toCsv=require(_0xf73d('0x8'));var querystring=require(_0xf73d('0xf'));var Papa=require(_0xf73d('0x10'));var Redis=require(_0xf73d('0x11'));var authService=require(_0xf73d('0x12'));var qs=require(_0xf73d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf73d('0x14'));var logger=require(_0xf73d('0x15'))('api');var utils=require(_0xf73d('0x16'));var config=require('../../config/environment');var db=require(_0xf73d('0x17'))['db'];function respondWithStatusCode(_0x34fcf6,_0x1a3064){_0x1a3064=_0x1a3064||0xcc;return function(_0x249a96){if(_0x249a96){return _0x34fcf6[_0xf73d('0x18')](_0x1a3064);}return _0x34fcf6[_0xf73d('0x19')](_0x1a3064)[_0xf73d('0x1a')]();};}function respondWithResult(_0x36221e,_0x36dc80){_0x36dc80=_0x36dc80||0xc8;return function(_0x126d11){if(_0x126d11){return _0x36221e[_0xf73d('0x19')](_0x36dc80)['json'](_0x126d11);}};}function respondWithFilteredResult(_0x3f2f43,_0x59b909){return function(_0x1be14e){if(_0x1be14e){var _0x4794f3=_0x1be14e[_0xf73d('0x1b')],_0x16f64f=_0x59b909[_0xf73d('0x1c')],_0x51497f=_0x59b909['offset']+_0x59b909[_0xf73d('0x1d')],_0x5b2d77;if(_0x51497f>=_0x4794f3){_0x51497f=_0x4794f3;_0x5b2d77=0xc8;}else{_0x5b2d77=0xce;}_0x3f2f43[_0xf73d('0x19')](_0x5b2d77);return _0x3f2f43[_0xf73d('0x1e')](_0xf73d('0x1f'),_0x16f64f+'-'+_0x51497f+'/'+_0x4794f3)[_0xf73d('0x20')](_0x1be14e);}return null;};}function patchUpdates(_0xf24002){return function(_0x3cbba3){try{jsonpatch['apply'](_0x3cbba3,_0xf24002,!![]);}catch(_0x5c4f4e){return BPromise[_0xf73d('0x21')](_0x5c4f4e);}return _0x3cbba3[_0xf73d('0x22')]();};}function saveUpdates(_0x22c486,_0x5f374a){return function(_0x129df2){if(_0x129df2){return _0x129df2[_0xf73d('0x23')](_0x22c486)[_0xf73d('0x24')](function(_0xa217e0){return _0xa217e0;});}return null;};}function removeEntity(_0x1c72a5,_0x222f47){return function(_0x518d60){if(_0x518d60){return _0x518d60['destroy']()[_0xf73d('0x24')](function(){_0x1c72a5['status'](0xcc)[_0xf73d('0x1a')]();});}};}function handleEntityNotFound(_0x207b8f,_0x581039){return function(_0x9a2dfa){if(!_0x9a2dfa){_0x207b8f['sendStatus'](0x194);}return _0x9a2dfa;};}function handleError(_0x505c27,_0x500254){_0x500254=_0x500254||0x1f4;return function(_0x4f34c2){logger['error'](_0x4f34c2['stack']);if(_0x4f34c2[_0xf73d('0x25')]){delete _0x4f34c2[_0xf73d('0x25')];}_0x505c27[_0xf73d('0x19')](_0x500254)[_0xf73d('0x26')](_0x4f34c2);};}exports[_0xf73d('0x23')]=function(_0x3b606e,_0x2cae6b){if(_0x3b606e['body']['id']){delete _0x3b606e[_0xf73d('0x27')]['id'];}return db[_0xf73d('0x28')]['find']({'where':{'id':_0x3b606e[_0xf73d('0x29')]['id']}})[_0xf73d('0x24')](handleEntityNotFound(_0x2cae6b,null))[_0xf73d('0x24')](saveUpdates(_0x3b606e[_0xf73d('0x27')],null))[_0xf73d('0x24')](respondWithResult(_0x2cae6b,null))[_0xf73d('0x2a')](handleError(_0x2cae6b,null));};exports['destroy']=function(_0xb57335,_0x7a4b0f){return db[_0xf73d('0x28')]['find']({'where':{'id':_0xb57335['params']['id']}})[_0xf73d('0x24')](handleEntityNotFound(_0x7a4b0f,null))[_0xf73d('0x24')](removeEntity(_0x7a4b0f,null))[_0xf73d('0x2a')](handleError(_0x7a4b0f,null));}; \ No newline at end of file +var _0x5e5f=['../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','destroy','then','error','stack','send','update','body','catch','Action','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5e6eac,_0x7d6b04){var _0x27afd9=function(_0x4cbdb9){while(--_0x4cbdb9){_0x5e6eac['push'](_0x5e6eac['shift']());}};_0x27afd9(++_0x7d6b04);}(_0x5e5f,0x17f));var _0xf5e5=function(_0xb4c671,_0x3fbc06){_0xb4c671=_0xb4c671-0x0;var _0x1a8c08=_0x5e5f[_0xb4c671];return _0x1a8c08;};'use strict';var pdf=require(_0xf5e5('0x0'));var emlformat=require(_0xf5e5('0x1'));var rimraf=require(_0xf5e5('0x2'));var zipdir=require(_0xf5e5('0x3'));var jsonpatch=require(_0xf5e5('0x4'));var rp=require(_0xf5e5('0x5'));var moment=require(_0xf5e5('0x6'));var BPromise=require(_0xf5e5('0x7'));var Mustache=require(_0xf5e5('0x8'));var util=require(_0xf5e5('0x9'));var path=require(_0xf5e5('0xa'));var sox=require(_0xf5e5('0xb'));var csv=require(_0xf5e5('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5e5('0xd'));var squel=require(_0xf5e5('0xe'));var crypto=require(_0xf5e5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf5e5('0x10'));var toCsv=require(_0xf5e5('0xc'));var querystring=require(_0xf5e5('0x11'));var Papa=require(_0xf5e5('0x12'));var Redis=require(_0xf5e5('0x13'));var authService=require(_0xf5e5('0x14'));var qs=require(_0xf5e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5e5('0x16'));var logger=require('../../config/logger')(_0xf5e5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf5e5('0x18'))['db'];function respondWithStatusCode(_0x5df53b,_0x1fda65){_0x1fda65=_0x1fda65||0xcc;return function(_0x3755ec){if(_0x3755ec){return _0x5df53b[_0xf5e5('0x19')](_0x1fda65);}return _0x5df53b[_0xf5e5('0x1a')](_0x1fda65)[_0xf5e5('0x1b')]();};}function respondWithResult(_0x46e2c,_0x2fc458){_0x2fc458=_0x2fc458||0xc8;return function(_0x5ed52c){if(_0x5ed52c){return _0x46e2c[_0xf5e5('0x1a')](_0x2fc458)['json'](_0x5ed52c);}};}function respondWithFilteredResult(_0x339ec5,_0x50de41){return function(_0x22cea6){if(_0x22cea6){var _0x2250bb=_0x22cea6['count'],_0x23d0f3=_0x50de41['offset'],_0x37c1b0=_0x50de41[_0xf5e5('0x1c')]+_0x50de41[_0xf5e5('0x1d')],_0x2f3007;if(_0x37c1b0>=_0x2250bb){_0x37c1b0=_0x2250bb;_0x2f3007=0xc8;}else{_0x2f3007=0xce;}_0x339ec5[_0xf5e5('0x1a')](_0x2f3007);return _0x339ec5['set'](_0xf5e5('0x1e'),_0x23d0f3+'-'+_0x37c1b0+'/'+_0x2250bb)[_0xf5e5('0x1f')](_0x22cea6);}return null;};}function patchUpdates(_0x50b78a){return function(_0x5904ca){try{jsonpatch[_0xf5e5('0x20')](_0x5904ca,_0x50b78a,!![]);}catch(_0x42266c){return BPromise[_0xf5e5('0x21')](_0x42266c);}return _0x5904ca[_0xf5e5('0x22')]();};}function saveUpdates(_0x8365d5,_0x521429){return function(_0x16489d){if(_0x16489d){return _0x16489d['update'](_0x8365d5)['then'](function(_0x387741){return _0x387741;});}return null;};}function removeEntity(_0x56b6c7,_0x326b1b){return function(_0x554a1f){if(_0x554a1f){return _0x554a1f[_0xf5e5('0x23')]()[_0xf5e5('0x24')](function(){_0x56b6c7[_0xf5e5('0x1a')](0xcc)[_0xf5e5('0x1b')]();});}};}function handleEntityNotFound(_0x9a9660,_0xe323ee){return function(_0x19ac31){if(!_0x19ac31){_0x9a9660[_0xf5e5('0x19')](0x194);}return _0x19ac31;};}function handleError(_0x50404b,_0x57de82){_0x57de82=_0x57de82||0x1f4;return function(_0x5a3180){logger[_0xf5e5('0x25')](_0x5a3180[_0xf5e5('0x26')]);if(_0x5a3180['name']){delete _0x5a3180['name'];}_0x50404b[_0xf5e5('0x1a')](_0x57de82)[_0xf5e5('0x27')](_0x5a3180);};}exports[_0xf5e5('0x28')]=function(_0x2620f6,_0x306e36){if(_0x2620f6['body']['id']){delete _0x2620f6['body']['id'];}return db['Action']['find']({'where':{'id':_0x2620f6['params']['id']}})[_0xf5e5('0x24')](handleEntityNotFound(_0x306e36,null))[_0xf5e5('0x24')](saveUpdates(_0x2620f6[_0xf5e5('0x29')],null))[_0xf5e5('0x24')](respondWithResult(_0x306e36,null))[_0xf5e5('0x2a')](handleError(_0x306e36,null));};exports[_0xf5e5('0x23')]=function(_0x3eb697,_0x37c30b){return db[_0xf5e5('0x2b')]['find']({'where':{'id':_0x3eb697[_0xf5e5('0x2c')]['id']}})['then'](handleEntityNotFound(_0x37c30b,null))[_0xf5e5('0x24')](removeEntity(_0x37c30b,null))[_0xf5e5('0x2a')](handleError(_0x37c30b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d755e56..f87ecbe 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 _0xeb81=['../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xeb81,0x1c8));var _0x1eb8=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0xeb81[_0xcd5a3d];return _0xd43207;};'use strict';var _=require(_0x1eb8('0x0'));var util=require(_0x1eb8('0x1'));var logger=require(_0x1eb8('0x2'))('api');var moment=require(_0x1eb8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1eb8('0x4'));var rimraf=require(_0x1eb8('0x5'));var config=require(_0x1eb8('0x6'));var attributes=require(_0x1eb8('0x7'));module[_0x1eb8('0x8')]=function(_0x189720,_0x344b66){return _0x189720['define'](_0x1eb8('0x9'),attributes,{'tableName':_0x1eb8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb1a=['path','rimraf','../../config/environment','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbb1a,0xf5));var _0xabb1=function(_0xac128d,_0x2277cd){_0xac128d=_0xac128d-0x0;var _0x389759=_0xbb1a[_0xac128d];return _0x389759;};'use strict';var _=require(_0xabb1('0x0'));var util=require(_0xabb1('0x1'));var logger=require(_0xabb1('0x2'))(_0xabb1('0x3'));var moment=require(_0xabb1('0x4'));var BPromise=require(_0xabb1('0x5'));var rp=require(_0xabb1('0x6'));var fs=require('fs');var path=require(_0xabb1('0x7'));var rimraf=require(_0xabb1('0x8'));var config=require(_0xabb1('0x9'));var attributes=require('./action.attributes');module['exports']=function(_0x58883f,_0x2bc2bb){return _0x58883f[_0xabb1('0xa')]('Action',attributes,{'tableName':_0xabb1('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 71b906c..20d71cd 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 _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xe84dfb,_0x4a2fe8){var _0xa389b8=function(_0x4971ef){while(--_0x4971ef){_0xe84dfb['push'](_0xe84dfb['shift']());}};_0xa389b8(++_0x4a2fe8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3951a3,_0x8ff8e5){var _0x17a38f=function(_0x17b475){while(--_0x17b475){_0x3951a3['push'](_0x3951a3['shift']());}};_0x17a38f(++_0x8ff8e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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/action/index.js b/server/api/action/index.js index d628814..9dfa9be 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 _0x2f20=['update','delete','destroy','util','path','connect-timeout','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated'];(function(_0x105855,_0x414d97){var _0x487389=function(_0x4ea0e5){while(--_0x4ea0e5){_0x105855['push'](_0x105855['shift']());}};_0x487389(++_0x414d97);}(_0x2f20,0x1dc));var _0x02f2=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x2f20[_0x599f41];return _0x2e4d58;};'use strict';var multer=require('multer');var util=require(_0x02f2('0x0'));var path=require(_0x02f2('0x1'));var timeout=require(_0x02f2('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x02f2('0x3'));var config=require(_0x02f2('0x4'));var controller=require('./action.controller');router[_0x02f2('0x5')](_0x02f2('0x6'),auth[_0x02f2('0x7')](),controller[_0x02f2('0x8')]);router[_0x02f2('0x9')](_0x02f2('0x6'),auth[_0x02f2('0x7')](),controller[_0x02f2('0xa')]);module['exports']=router; \ No newline at end of file +var _0x2bd3=['../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','update','util','path','connect-timeout','express'];(function(_0xeb80c9,_0x3fe888){var _0x259c37=function(_0x49478c){while(--_0x49478c){_0xeb80c9['push'](_0xeb80c9['shift']());}};_0x259c37(++_0x3fe888);}(_0x2bd3,0x15a));var _0x32bd=function(_0x2141ee,_0x4181e5){_0x2141ee=_0x2141ee-0x0;var _0x5bdc07=_0x2bd3[_0x2141ee];return _0x5bdc07;};'use strict';var multer=require('multer');var util=require(_0x32bd('0x0'));var path=require(_0x32bd('0x1'));var timeout=require(_0x32bd('0x2'));var express=require(_0x32bd('0x3'));var router=express['Router']();var auth=require(_0x32bd('0x4'));var interaction=require(_0x32bd('0x5'));var config=require(_0x32bd('0x6'));var controller=require('./action.controller');router['put'](_0x32bd('0x7'),auth[_0x32bd('0x8')](),controller[_0x32bd('0x9')]);router['delete'](_0x32bd('0x7'),auth['isAuthenticated'](),controller['destroy']);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 e2b174a..f68cb23 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 _0x259b=['exports','STRING','TEXT'];(function(_0x20614d,_0x435e35){var _0x29d7b2=function(_0x561995){while(--_0x561995){_0x20614d['push'](_0x20614d['shift']());}};_0x29d7b2(++_0x435e35);}(_0x259b,0x81));var _0xb259=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x259b[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require('sequelize');module[_0xb259('0x0')]={'name':{'type':Sequelize[_0xb259('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb259('0x1')]},'parent':{'type':Sequelize[_0xb259('0x1')]},'table':{'type':Sequelize[_0xb259('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb259('0x2')]}}; \ No newline at end of file +var _0xc1d8=['sequelize','STRING','TEXT'];(function(_0x819632,_0x5c4ab5){var _0x4c72b5=function(_0x40b60b){while(--_0x40b60b){_0x819632['push'](_0x819632['shift']());}};_0x4c72b5(++_0x5c4ab5);}(_0xc1d8,0x14a));var _0x8c1d=function(_0x6f9e5e,_0x146423){_0x6f9e5e=_0x6f9e5e-0x0;var _0x33aa8b=_0xc1d8[_0x6f9e5e];return _0x33aa8b;};'use strict';var Sequelize=require(_0x8c1d('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c1d('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8c1d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 81cd41c..551e938 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 _0x6822=['rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','toString','sequelize','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','getFields','AnalyticMetric','function','alias','QueryTypes','SELECT','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','runReport','IS\x20NOT\x20NULL','clone','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','length','includeAll','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL'];(function(_0x3cc6df,_0x23e15b){var _0x53a5bb=function(_0x197f96){while(--_0x197f96){_0x3cc6df['push'](_0x3cc6df['shift']());}};_0x53a5bb(++_0x23e15b);}(_0x6822,0x18c));var _0x2682=function(_0x27aad0,_0x639ce7){_0x27aad0=_0x27aad0-0x0;var _0x4d9ace=_0x6822[_0x27aad0];return _0x4d9ace;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2682('0x0'));var rimraf=require(_0x2682('0x1'));var zipdir=require(_0x2682('0x2'));var jsonpatch=require(_0x2682('0x3'));var rp=require('request-promise');var moment=require(_0x2682('0x4'));var BPromise=require(_0x2682('0x5'));var Mustache=require(_0x2682('0x6'));var util=require(_0x2682('0x7'));var path=require(_0x2682('0x8'));var sox=require(_0x2682('0x9'));var csv=require(_0x2682('0xa'));var ejs=require(_0x2682('0xb'));var fs=require('fs');var _=require(_0x2682('0xc'));var squel=require(_0x2682('0xd'));var crypto=require(_0x2682('0xe'));var jsforce=require(_0x2682('0xf'));var deskjs=require(_0x2682('0x10'));var toCsv=require(_0x2682('0xa'));var querystring=require('querystring');var Papa=require(_0x2682('0x11'));var Redis=require(_0x2682('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2682('0x13'));var logger=require(_0x2682('0x14'))('api');var utils=require(_0x2682('0x15'));var config=require(_0x2682('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2682('0x17'))[_0x2682('0x18')];function respondWithStatusCode(_0x1feca6,_0x2cd01f){_0x2cd01f=_0x2cd01f||0xcc;return function(_0x3227f9){if(_0x3227f9){return _0x1feca6[_0x2682('0x19')](_0x2cd01f);}return _0x1feca6[_0x2682('0x1a')](_0x2cd01f)[_0x2682('0x1b')]();};}function respondWithResult(_0xfb9e0c,_0x18dab9){_0x18dab9=_0x18dab9||0xc8;return function(_0x4a7e21){if(_0x4a7e21){return _0xfb9e0c[_0x2682('0x1a')](_0x18dab9)[_0x2682('0x1c')](_0x4a7e21);}};}function respondWithFilteredResult(_0x1ac17b,_0x212aaf){return function(_0x545ba8){if(_0x545ba8){var _0x52a80d=_0x545ba8['count'],_0x2ce295=_0x212aaf[_0x2682('0x1d')],_0x2b1ed2=_0x212aaf['offset']+_0x212aaf[_0x2682('0x1e')],_0x602eec;if(_0x2b1ed2>=_0x52a80d){_0x2b1ed2=_0x52a80d;_0x602eec=0xc8;}else{_0x602eec=0xce;}_0x1ac17b[_0x2682('0x1a')](_0x602eec);return _0x1ac17b[_0x2682('0x1f')](_0x2682('0x20'),_0x2ce295+'-'+_0x2b1ed2+'/'+_0x52a80d)[_0x2682('0x1c')](_0x545ba8);}return null;};}function patchUpdates(_0x34cf1d){return function(_0x554b57){try{jsonpatch[_0x2682('0x21')](_0x554b57,_0x34cf1d,!![]);}catch(_0x516525){return BPromise[_0x2682('0x22')](_0x516525);}return _0x554b57[_0x2682('0x23')]();};}function saveUpdates(_0x348924,_0x20ae5b){return function(_0x23641e){if(_0x23641e){return _0x23641e[_0x2682('0x24')](_0x348924)[_0x2682('0x25')](function(_0x49c98a){return _0x49c98a;});}return null;};}function removeEntity(_0x57ae26,_0x599726){return function(_0x3ed75d){if(_0x3ed75d){return _0x3ed75d[_0x2682('0x26')]()['then'](function(){var _0xa27b38=_0x3ed75d[_0x2682('0x27')]({'plain':!![]});var _0x2b2d81=_0x2682('0x28');return db['UserProfileResource'][_0x2682('0x26')]({'where':{'type':_0x2b2d81,'resourceId':_0xa27b38['id']}})[_0x2682('0x25')](function(){return _0x3ed75d;});})[_0x2682('0x25')](function(){_0x57ae26[_0x2682('0x1a')](0xcc)[_0x2682('0x1b')]();});}};}function handleEntityNotFound(_0x2accf0,_0x5d325b){return function(_0x4afd1d){if(!_0x4afd1d){_0x2accf0['sendStatus'](0x194);}return _0x4afd1d;};}function handleError(_0x576352,_0x273201){_0x273201=_0x273201||0x1f4;return function(_0x385c1c){logger[_0x2682('0x29')](_0x385c1c[_0x2682('0x2a')]);if(_0x385c1c[_0x2682('0x2b')]){delete _0x385c1c[_0x2682('0x2b')];}_0x576352[_0x2682('0x1a')](_0x273201)[_0x2682('0x2c')](_0x385c1c);};}exports['index']=function(_0x9384b5,_0x8b809b){var _0x545543={},_0x19bb3d={},_0x193df4={'count':0x0,'rows':[]};var _0x3b5fcd=_[_0x2682('0x2d')](db[_0x2682('0x2e')][_0x2682('0x2f')],function(_0x3a417f){return{'name':_0x3a417f[_0x2682('0x30')],'type':_0x3a417f[_0x2682('0x31')][_0x2682('0x32')]};});_0x19bb3d[_0x2682('0x33')]=_['map'](_0x3b5fcd,_0x2682('0x2b'));_0x19bb3d[_0x2682('0x34')]=_[_0x2682('0x35')](_0x9384b5[_0x2682('0x34')]);_0x19bb3d[_0x2682('0x36')]=_['intersection'](_0x19bb3d['model'],_0x19bb3d[_0x2682('0x34')]);_0x545543[_0x2682('0x37')]=_[_0x2682('0x38')](_0x19bb3d['model'],qs[_0x2682('0x39')](_0x9384b5[_0x2682('0x34')][_0x2682('0x39')]));_0x545543[_0x2682('0x37')]=_0x545543['attributes']['length']?_0x545543[_0x2682('0x37')]:_0x19bb3d['model'];if(!_0x9384b5[_0x2682('0x34')][_0x2682('0x3a')](_0x2682('0x3b'))){_0x545543[_0x2682('0x1e')]=qs[_0x2682('0x1e')](_0x9384b5[_0x2682('0x34')]['limit']);_0x545543['offset']=qs[_0x2682('0x1d')](_0x9384b5['query'][_0x2682('0x1d')]);}_0x545543[_0x2682('0x3c')]=qs[_0x2682('0x3d')](_0x9384b5[_0x2682('0x34')][_0x2682('0x3d')]);_0x545543[_0x2682('0x3e')]=qs[_0x2682('0x36')](_[_0x2682('0x3f')](_0x9384b5[_0x2682('0x34')],_0x19bb3d[_0x2682('0x36')]),_0x3b5fcd);if(_0x9384b5['query'][_0x2682('0x40')]){_0x545543['where']=_['merge'](_0x545543[_0x2682('0x3e')],{'$or':_[_0x2682('0x2d')](_0x3b5fcd,function(_0x3ea618){if(_0x3ea618[_0x2682('0x31')]!==_0x2682('0x41')){var _0x92192d={};_0x92192d[_0x3ea618['name']]={'$like':'%'+_0x9384b5[_0x2682('0x34')][_0x2682('0x40')]+'%'};return _0x92192d;}})});}_0x545543=_[_0x2682('0x42')]({},_0x545543,_0x9384b5[_0x2682('0x43')]);var _0x142ee2={'where':_0x545543['where']};return db[_0x2682('0x2e')]['count'](_0x142ee2)[_0x2682('0x25')](function(_0x4e5175){_0x193df4[_0x2682('0x44')]=_0x4e5175;if(_0x9384b5[_0x2682('0x34')]['includeAll']){_0x545543[_0x2682('0x45')]=[{'all':!![]}];}return db[_0x2682('0x2e')][_0x2682('0x46')](_0x545543);})[_0x2682('0x25')](function(_0x1c1c32){_0x193df4[_0x2682('0x47')]=_0x1c1c32;return _0x193df4;})[_0x2682('0x25')](respondWithFilteredResult(_0x8b809b,_0x545543))[_0x2682('0x48')](handleError(_0x8b809b,null));};exports[_0x2682('0x49')]=function(_0x16ba45,_0x2fec5e){var _0x1b4161={'raw':![],'where':{'id':_0x16ba45['params']['id']}},_0x579687={};_0x579687[_0x2682('0x33')]=_[_0x2682('0x35')](db[_0x2682('0x2e')][_0x2682('0x2f')]);_0x579687[_0x2682('0x34')]=_[_0x2682('0x35')](_0x16ba45[_0x2682('0x34')]);_0x579687['filters']=_['intersection'](_0x579687[_0x2682('0x33')],_0x579687[_0x2682('0x34')]);_0x1b4161[_0x2682('0x37')]=_[_0x2682('0x38')](_0x579687[_0x2682('0x33')],qs['fields'](_0x16ba45['query'][_0x2682('0x39')]));_0x1b4161[_0x2682('0x37')]=_0x1b4161[_0x2682('0x37')][_0x2682('0x4a')]?_0x1b4161[_0x2682('0x37')]:_0x579687[_0x2682('0x33')];if(_0x16ba45[_0x2682('0x34')][_0x2682('0x4b')]){_0x1b4161[_0x2682('0x45')]=[{'all':!![]}];}_0x1b4161=_['merge']({},_0x1b4161,_0x16ba45[_0x2682('0x43')]);return db['AnalyticCustomReport']['find'](_0x1b4161)[_0x2682('0x25')](handleEntityNotFound(_0x2fec5e,null))[_0x2682('0x25')](respondWithResult(_0x2fec5e,null))['catch'](handleError(_0x2fec5e,null));};exports['create']=function(_0x2836b1,_0xd525e2){return db[_0x2682('0x2e')][_0x2682('0x4c')](_0x2836b1[_0x2682('0x4d')],{})[_0x2682('0x25')](function(_0x28805b){var _0x30b9fc=_0x2836b1[_0x2682('0x4e')][_0x2682('0x27')]({'plain':!![]});if(!_0x30b9fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30b9fc[_0x2682('0x4f')]===_0x2682('0x4e')){var _0x5bcf84=_0x28805b[_0x2682('0x27')]({'plain':!![]});var _0x608a0f='Reports';return db['UserProfileSection'][_0x2682('0x50')]({'where':{'name':_0x608a0f,'userProfileId':_0x30b9fc[_0x2682('0x51')]},'raw':!![]})[_0x2682('0x25')](function(_0x4412f8){if(_0x4412f8&&_0x4412f8[_0x2682('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x5bcf84[_0x2682('0x2b')],'resourceId':_0x5bcf84['id'],'type':_0x2682('0x28'),'sectionId':_0x4412f8['id']},{})[_0x2682('0x25')](function(){return _0x28805b;});}else{return _0x28805b;}})['catch'](function(_0x7e2a88){logger['error'](_0x2682('0x53'),_0x7e2a88);throw _0x7e2a88;});}return _0x28805b;})[_0x2682('0x25')](respondWithResult(_0xd525e2,0xc9))['catch'](handleError(_0xd525e2,null));};exports[_0x2682('0x24')]=function(_0x11f5f0,_0x21874b){if(_0x11f5f0[_0x2682('0x4d')]['id']){delete _0x11f5f0[_0x2682('0x4d')]['id'];}return db[_0x2682('0x2e')]['find']({'where':{'id':_0x11f5f0['params']['id']}})[_0x2682('0x25')](handleEntityNotFound(_0x21874b,null))['then'](saveUpdates(_0x11f5f0[_0x2682('0x4d')],null))[_0x2682('0x25')](respondWithResult(_0x21874b,null))[_0x2682('0x48')](handleError(_0x21874b,null));};exports['destroy']=function(_0x22f051,_0x5758aa){return db[_0x2682('0x2e')][_0x2682('0x50')]({'where':{'id':_0x22f051[_0x2682('0x54')]['id']}})[_0x2682('0x25')](handleEntityNotFound(_0x5758aa,null))[_0x2682('0x25')](removeEntity(_0x5758aa,null))[_0x2682('0x48')](handleError(_0x5758aa,null));};exports[_0x2682('0x55')]=function(_0x4f0d54,_0x5e71b4){var _0x5a2442=0xa;var _0x524e5b=['join',_0x2682('0x56'),_0x2682('0x57'),_0x2682('0x58')];var _0x24ac62={'SUM':_0x2682('0x59'),'COUNT':_0x2682('0x5a'),'COUNT DISTINCT':_0x2682('0x5b'),'MAX':_0x2682('0x5c'),'MIN':_0x2682('0x5d'),'AVG':_0x2682('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2682('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x22c4ac={'SEC_TO_TIME':_0x2682('0x60'),'DATE':'DATE(%s)','HOUR':_0x2682('0x61'),'ROUND':_0x2682('0x62'),'UNIX_TIMESTAMP':_0x2682('0x63')};var _0x52e6ca=function(_0x479326){return!_[_0x2682('0x64')]([_0x2682('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x479326);};var _0x4f7f20=function(_0x372ada){if(!_0x372ada||!_0x372ada[_0x2682('0x66')][_0x2682('0x4a')]){return'';}for(var _0x3aa9dd='(',_0x1f2bb2=0x0;_0x1f2bb2<_0x372ada[_0x2682('0x66')][_0x2682('0x4a')];_0x1f2bb2+=0x1){_0x1f2bb2>0x0&&(_0x3aa9dd+='\x20'+_0x372ada[_0x2682('0x67')]+'\x20');_0x3aa9dd+=_0x372ada[_0x2682('0x66')][_0x1f2bb2][_0x2682('0x68')]?_0x4f7f20(_0x372ada['rules'][_0x1f2bb2][_0x2682('0x68')]):_0x372ada[_0x2682('0x66')][_0x1f2bb2][_0x2682('0x69')]+'\x20'+_0x372ada[_0x2682('0x66')][_0x1f2bb2][_0x2682('0x6a')]+(_0x52e6ca(_0x372ada[_0x2682('0x66')][_0x1f2bb2]['condition'])?'\x20'+_0x372ada[_0x2682('0x66')][_0x1f2bb2][_0x2682('0x6b')]:'');}return _0x3aa9dd+')';};var _0x44a1e3={'where':{'id':_0x4f0d54[_0x2682('0x54')]['id']}},_0x45fdd4,_0x52e3cd,_0x57c9d1,_0x572b44,_0x3fe0f2;_0x44a1e3=_[_0x2682('0x42')]({},_0x44a1e3,_0x4f0d54[_0x2682('0x43')]);return db['AnalyticCustomReport']['find'](_0x44a1e3)[_0x2682('0x25')](function(_0x555ae9){if(_0x555ae9){_0x45fdd4=_0x555ae9;return _0x555ae9['getFields']();}return null;})['then'](function(_0x31f796){if(_0x31f796){if(!_0x31f796[_0x2682('0x4a')]){throw new db[(_0x2682('0x6c'))][(_0x2682('0x6d'))](_0x2682('0x6e'),0x193);}_0x52e3cd=_0x31f796;return db['AnalyticMetric'][_0x2682('0x46')]({'raw':!![]});}return null;})[_0x2682('0x25')](function(_0x3296ed){if(_0x3296ed){_0x57c9d1=_[_0x2682('0x6f')](_0x3296ed,'id');var _0x39e730;var _0x488c33=squel[_0x2682('0x70')]();_0x488c33[_0x2682('0x71')](_0x45fdd4['table']);for(var _0x3ebabe=0x0;_0x3ebabe<_0x52e3cd[_0x2682('0x4a')];_0x3ebabe+=0x1){_0x39e730=_0x52e3cd[_0x3ebabe]['MetricId']?_0x57c9d1[_0x52e3cd[_0x3ebabe][_0x2682('0x72')]][_0x2682('0x73')]:_0x52e3cd[_0x3ebabe][_0x2682('0x69')];_0x39e730=_0x52e3cd[_0x3ebabe]['function']?_[_0x2682('0x74')](_0x24ac62[_0x52e3cd[_0x3ebabe]['function']],'%s',_0x39e730):_0x39e730;_0x39e730=_0x52e3cd[_0x3ebabe]['format']?_['replace'](_0x22c4ac[_0x52e3cd[_0x3ebabe][_0x2682('0x75')]],'%s',_0x39e730):_0x39e730;if(_0x52e3cd[_0x3ebabe][_0x2682('0x76')]){_0x488c33['group'](_0x39e730);}_0x52e3cd[_0x3ebabe]['orderBy']&&_0x488c33[_0x2682('0x3c')](_0x39e730,_0x52e3cd[_0x3ebabe][_0x2682('0x77')]===_0x2682('0x78')?![]:!![]);_0x488c33['field'](_0x39e730,_0x52e3cd[_0x3ebabe]['alias']||_0x39e730);}if(_0x45fdd4[_0x2682('0x79')]){_0x45fdd4[_0x2682('0x79')]=JSON[_0x2682('0x7a')](_0x45fdd4['joins']);for(var _0x246d2a=0x0;_0x246d2a<_0x45fdd4[_0x2682('0x79')][_0x2682('0x4a')];_0x246d2a+=0x1){if(_0x45fdd4['joins'][_0x246d2a]['type']&&_['includes'](_0x524e5b,_0x45fdd4[_0x2682('0x79')][_0x246d2a]['type'])&&_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x7b')]&&_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x7c')]&&_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x7d')]){_0x488c33[_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x31')]](_0x45fdd4['joins'][_0x246d2a][_0x2682('0x7c')],null,util[_0x2682('0x75')](_0x2682('0x7e'),_0x45fdd4[_0x2682('0x7f')],_0x45fdd4['joins'][_0x246d2a]['parentKey'],_0x45fdd4[_0x2682('0x79')][_0x246d2a][_0x2682('0x7c')],_0x45fdd4[_0x2682('0x79')][_0x246d2a]['foreignKey']));}}}if(_0x45fdd4['conditions']){_0x45fdd4[_0x2682('0x80')]=JSON['parse'](_0x45fdd4[_0x2682('0x80')]);_0x488c33[_0x2682('0x3e')](_0x4f7f20(_0x45fdd4['conditions'][_0x2682('0x68')]));}_0x3fe0f2=_0x488c33['clone']();_0x488c33[_0x2682('0x1e')](_0x5a2442);_0x488c33[_0x2682('0x1d')](0x0);logger[_0x2682('0x81')](_0x2682('0x82'),_0x488c33[_0x2682('0x83')]());return db[_0x2682('0x84')][_0x2682('0x34')](_0x488c33[_0x2682('0x83')](),{'type':db[_0x2682('0x84')]['QueryTypes']['SELECT']});}})[_0x2682('0x25')](respondWithResult(_0x5e71b4,null))[_0x2682('0x48')](handleError(_0x5e71b4,null));};function runReport(_0x1c1207,_0x3632c9,_0x421f1b){var _0x432c4c=_0x3632c9[_0x2682('0x2b')];var _0x50aad9=0xa;var _0x2598d7=[_0x2682('0x85'),'left_join',_0x2682('0x57'),_0x2682('0x58')];var _0xcf8e25={'SUM':_0x2682('0x59'),'COUNT':_0x2682('0x5a'),'COUNT DISTINCT':_0x2682('0x5b'),'MAX':_0x2682('0x5c'),'MIN':'MIN(%s)','AVG':_0x2682('0x5e'),'GROUP_CONCAT':_0x2682('0x86'),'GROUP_CONCAT ASC':_0x2682('0x5f'),'GROUP_CONCAT DESC':_0x2682('0x87')};var _0x100c0c={'SEC_TO_TIME':_0x2682('0x60'),'DATE':_0x2682('0x88'),'HOUR':'HOUR(%s)','ROUND':_0x2682('0x62'),'UNIX_TIMESTAMP':_0x2682('0x63')};var _0x25343d=function(_0x9fefff){return!_['includes']([_0x2682('0x65'),'IS\x20NOT\x20NULL',_0x2682('0x89'),_0x2682('0x8a')],_0x9fefff);};var _0x1fb763=function(_0x1c3ca7){if(!_0x1c3ca7||!_0x1c3ca7[_0x2682('0x66')][_0x2682('0x4a')]){return'';}for(var _0x487079='(',_0xd465be=0x0;_0xd465be<_0x1c3ca7[_0x2682('0x66')]['length'];_0xd465be+=0x1){_0xd465be>0x0&&(_0x487079+='\x20'+_0x1c3ca7['operator']+'\x20');_0x487079+=_0x1c3ca7['rules'][_0xd465be][_0x2682('0x68')]?_0x1fb763(_0x1c3ca7[_0x2682('0x66')][_0xd465be]['group']):_0x1c3ca7[_0x2682('0x66')][_0xd465be][_0x2682('0x69')]+'\x20'+_0x1c3ca7[_0x2682('0x66')][_0xd465be][_0x2682('0x6a')]+(_0x25343d(_0x1c3ca7[_0x2682('0x66')][_0xd465be]['condition'])?'\x20'+_0x1c3ca7[_0x2682('0x66')][_0xd465be][_0x2682('0x6b')]:'');}return _0x487079+')';};var _0x5a8e7a={'where':{'id':_0x1c1207['id']}},_0x4aaee2,_0x44bd07,_0x193e1c,_0x3e1ebd,_0x1c7120;_0x5a8e7a=_[_0x2682('0x42')]({},_0x5a8e7a,_0x421f1b);return db[_0x2682('0x2e')][_0x2682('0x50')](_0x5a8e7a)[_0x2682('0x25')](function(_0x3f194d){if(_0x3f194d){_0x4aaee2=_0x3f194d;return _0x3f194d[_0x2682('0x8b')]();}return null;})[_0x2682('0x25')](function(_0x3b13fd){if(_0x3b13fd){if(!_0x3b13fd['length']){throw new db[(_0x2682('0x6c'))][(_0x2682('0x6d'))](_0x2682('0x6e'),0x193);}_0x44bd07=_0x3b13fd;return db[_0x2682('0x8c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3b6b99){if(_0x3b6b99){_0x193e1c=_[_0x2682('0x6f')](_0x3b6b99,'id');var _0x4b1658;var _0x338d71=squel['select']();_0x338d71[_0x2682('0x71')](_0x4aaee2[_0x2682('0x7f')]);for(var _0x2842df=0x0;_0x2842df<_0x44bd07[_0x2682('0x4a')];_0x2842df+=0x1){_0x4b1658=_0x44bd07[_0x2842df]['MetricId']?_0x193e1c[_0x44bd07[_0x2842df][_0x2682('0x72')]]['metric']:_0x44bd07[_0x2842df]['field'];_0x4b1658=_0x44bd07[_0x2842df][_0x2682('0x8d')]?_[_0x2682('0x74')](_0xcf8e25[_0x44bd07[_0x2842df][_0x2682('0x8d')]],'%s',_0x4b1658):_0x4b1658;_0x4b1658=_0x44bd07[_0x2842df][_0x2682('0x75')]?_['replace'](_0x100c0c[_0x44bd07[_0x2842df][_0x2682('0x75')]],'%s',_0x4b1658):_0x4b1658;if(_0x44bd07[_0x2842df]['groupBy']){_0x338d71['group'](_0x4b1658);}_0x44bd07[_0x2842df][_0x2682('0x77')]&&_0x338d71[_0x2682('0x3c')](_0x4b1658,_0x44bd07[_0x2842df][_0x2682('0x77')]===_0x2682('0x78')?![]:!![]);_0x338d71['field'](_0x4b1658,_0x44bd07[_0x2842df][_0x2682('0x8e')]||_0x4b1658);}if(_0x4aaee2['joins']){_0x4aaee2[_0x2682('0x79')]=JSON[_0x2682('0x7a')](_0x4aaee2[_0x2682('0x79')]);for(var _0x24ca2e=0x0;_0x24ca2e<_0x4aaee2[_0x2682('0x79')][_0x2682('0x4a')];_0x24ca2e+=0x1){if(_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x31')]&&_[_0x2682('0x64')](_0x2598d7,_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x31')])&&_0x4aaee2['joins'][_0x24ca2e][_0x2682('0x7b')]&&_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7c')]&&_0x4aaee2[_0x2682('0x79')][_0x24ca2e]['foreignKey']){_0x338d71[_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x31')]](_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7c')],null,util[_0x2682('0x75')](_0x2682('0x7e'),_0x4aaee2[_0x2682('0x7f')],_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7b')],_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7c')],_0x4aaee2[_0x2682('0x79')][_0x24ca2e][_0x2682('0x7d')]));}}}if(_0x4aaee2[_0x2682('0x80')]){_0x4aaee2[_0x2682('0x80')]=JSON[_0x2682('0x7a')](_0x4aaee2['conditions']);_0x338d71['where'](_0x1fb763(_0x4aaee2[_0x2682('0x80')][_0x2682('0x68')]));}_0x1c7120=_0x338d71['clone']();_0x338d71[_0x2682('0x1e')](_0x50aad9);_0x338d71['offset'](0x0);logger[_0x2682('0x81')](_0x2682('0x82'),_0x338d71[_0x2682('0x83')]());return db['sequelize'][_0x2682('0x34')](_0x338d71[_0x2682('0x83')](),{'type':db['sequelize'][_0x2682('0x8f')][_0x2682('0x90')]});}})[_0x2682('0x25')](function(_0x1a7103){if(!_0x1a7103[_0x2682('0x4a')]){throw new db['Sequelize'][(_0x2682('0x6d'))](_0x2682('0x91'),0xcc);}if(_0x3632c9[_0x2682('0x92')]===_0x2682('0x93')){return null;}var _0x34fdca=_[_0x2682('0x42')](_0x3632c9,{'name':_0x3632c9[_0x2682('0x94')]||_0x3632c9['name']||_0x4aaee2[_0x2682('0x2b')],'basename':_0x432c4c,'savename':util[_0x2682('0x75')](_0x2682('0x95'),_0x3632c9[_0x2682('0x2b')]||_0x4aaee2[_0x2682('0x2b')],require(_0x2682('0x96'))['generate'](0x4),_0x3632c9[_0x2682('0x92')]||'csv'),'reportId':_0x4aaee2['id'],'reportType':'custom'});return db[_0x2682('0x97')][_0x2682('0x4c')](_0x34fdca,{'raw':!![]});})[_0x2682('0x25')](function(_0x406a03){if(_0x4aaee2[_0x2682('0x7f')]===_0x2682('0x98')){_0x1c7120[_0x2682('0x3e')](_0x4aaee2[_0x2682('0x7f')]+_0x2682('0x99'),_0x3632c9['startDate'],_0x3632c9[_0x2682('0x9a')]);}else{_0x1c7120[_0x2682('0x3e')](_0x4aaee2['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3632c9[_0x2682('0x9b')],_0x3632c9['endDate']);}if(_0x406a03){logger['info'](_0x2682('0x9c'),_0x1c7120[_0x2682('0x83')]());require(_0x2682('0x9d'))[_0x2682('0x9e')](path[_0x2682('0x85')](__dirname,_0x2682('0x9f'),_0x406a03[_0x2682('0x92')]),[_0x406a03['id'],_0x1c7120[_0x2682('0x83')](),path[_0x2682('0x85')](__dirname,_0x2682('0xa0'),_0x406a03[_0x2682('0xa1')]),_0x432c4c]);return _0x406a03;}else{var _0x50abbc=squel[_0x2682('0x70')]();_0x50abbc['from']('('+_0x1c7120[_0x2682('0x83')]()+')','countTable');_0x50abbc[_0x2682('0x69')](_0x2682('0xa2'),_0x2682('0x44'));_0x1c7120[_0x2682('0x1e')](_0x3632c9[_0x2682('0x1e')]||_0x50aad9);_0x1c7120[_0x2682('0x1d')](_0x3632c9[_0x2682('0x1d')]||0x0);return dbH[_0x2682('0x84')][_0x2682('0x34')](_0x50abbc['toString'](),{'type':dbH[_0x2682('0x84')]['QueryTypes']['SELECT']})['then'](function(_0x1cffc4){if(!_0x1cffc4[_0x2682('0x4a')]){_0x3e1ebd=0x0;}else{_0x3e1ebd=_0x1cffc4[0x0]['count']||0x0;}return dbH['sequelize'][_0x2682('0x34')](_0x1c7120[_0x2682('0x83')](),{'type':dbH[_0x2682('0x84')][_0x2682('0x8f')][_0x2682('0x90')]});})[_0x2682('0x25')](function(_0x899a77){return{'rows':_0x899a77||[],'count':_0x3e1ebd};});}});}exports['run']=function(_0x195247,_0x2df0c1){return runReport(_0x195247['params'],_0x195247[_0x2682('0x34')],_0x195247[_0x2682('0x43')])[_0x2682('0x25')](respondWithResult(_0x2df0c1,null))[_0x2682('0x48')](handleError(_0x2df0c1,null));};exports[_0x2682('0xa3')]=runReport;exports[_0x2682('0x34')]=function(_0x487d43,_0x497dc0){var _0x2cbd24=0xa;var _0x240697=[_0x2682('0x85'),_0x2682('0x56'),_0x2682('0x57'),_0x2682('0x58')];var _0x3e8596={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2682('0x5b'),'MAX':'MAX(%s)','MIN':_0x2682('0x5d'),'AVG':_0x2682('0x5e'),'GROUP_CONCAT':_0x2682('0x86'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2682('0x87')};var _0x3ea97d={'SEC_TO_TIME':_0x2682('0x60'),'DATE':_0x2682('0x88'),'HOUR':'HOUR(%s)','ROUND':_0x2682('0x62'),'UNIX_TIMESTAMP':_0x2682('0x63')};var _0x131ab4=function(_0xba6663){return!_[_0x2682('0x64')]([_0x2682('0x65'),_0x2682('0xa4'),'IS\x20EMPTY',_0x2682('0x8a')],_0xba6663);};var _0x2b23a9=function(_0x19a993){if(!_0x19a993||!_0x19a993[_0x2682('0x66')][_0x2682('0x4a')]){return'';}for(var _0x5da5fc='(',_0x4b84de=0x0;_0x4b84de<_0x19a993[_0x2682('0x66')][_0x2682('0x4a')];_0x4b84de+=0x1){_0x4b84de>0x0&&(_0x5da5fc+='\x20'+_0x19a993[_0x2682('0x67')]+'\x20');_0x5da5fc+=_0x19a993[_0x2682('0x66')][_0x4b84de]['group']?_0x2b23a9(_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x68')]):_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x69')]+'\x20'+_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x6a')]+(_0x131ab4(_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x6a')])?'\x20'+_0x19a993[_0x2682('0x66')][_0x4b84de][_0x2682('0x6b')]:'');}return _0x5da5fc+')';};var _0x4c8581={'where':{'id':_0x487d43[_0x2682('0x54')]['id']}},_0x5ff5f8,_0x78e9a2,_0x45cebd,_0x37d74c,_0x2d7d84;_0x4c8581=_['merge']({},_0x4c8581,_0x487d43['options']);return db[_0x2682('0x2e')][_0x2682('0x50')](_0x4c8581)[_0x2682('0x25')](function(_0x4c274a){if(_0x4c274a){_0x5ff5f8=_0x4c274a;return _0x4c274a[_0x2682('0x8b')]();}return null;})['then'](function(_0x4a3391){if(_0x4a3391){if(!_0x4a3391[_0x2682('0x4a')]){throw new db[(_0x2682('0x6c'))][(_0x2682('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x78e9a2=_0x4a3391;return db[_0x2682('0x8c')][_0x2682('0x46')]({'raw':!![]});}return null;})[_0x2682('0x25')](function(_0x2a23c0){if(_0x2a23c0){_0x45cebd=_[_0x2682('0x6f')](_0x2a23c0,'id');var _0x507b6a;var _0x49aa01=squel[_0x2682('0x70')]();_0x49aa01['from'](_0x5ff5f8['table']);for(var _0x105d3f=0x0;_0x105d3f<_0x78e9a2[_0x2682('0x4a')];_0x105d3f+=0x1){_0x507b6a=_0x78e9a2[_0x105d3f][_0x2682('0x72')]?_0x45cebd[_0x78e9a2[_0x105d3f]['MetricId']]['metric']:_0x78e9a2[_0x105d3f]['field'];_0x507b6a=_0x78e9a2[_0x105d3f][_0x2682('0x8d')]?_[_0x2682('0x74')](_0x3e8596[_0x78e9a2[_0x105d3f][_0x2682('0x8d')]],'%s',_0x507b6a):_0x507b6a;_0x507b6a=_0x78e9a2[_0x105d3f]['format']?_[_0x2682('0x74')](_0x3ea97d[_0x78e9a2[_0x105d3f][_0x2682('0x75')]],'%s',_0x507b6a):_0x507b6a;if(_0x78e9a2[_0x105d3f][_0x2682('0x76')]){_0x49aa01[_0x2682('0x68')](_0x507b6a);}_0x78e9a2[_0x105d3f]['orderBy']&&_0x49aa01[_0x2682('0x3c')](_0x507b6a,_0x78e9a2[_0x105d3f][_0x2682('0x77')]===_0x2682('0x78')?![]:!![]);_0x49aa01['field'](_0x507b6a,_0x78e9a2[_0x105d3f][_0x2682('0x8e')]||_0x507b6a);}if(_0x5ff5f8['joins']){_0x5ff5f8['joins']=JSON[_0x2682('0x7a')](_0x5ff5f8[_0x2682('0x79')]);for(var _0x31dfd7=0x0;_0x31dfd7<_0x5ff5f8['joins'][_0x2682('0x4a')];_0x31dfd7+=0x1){if(_0x5ff5f8['joins'][_0x31dfd7][_0x2682('0x31')]&&_[_0x2682('0x64')](_0x240697,_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x31')])&&_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7b')]&&_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7c')]&&_0x5ff5f8['joins'][_0x31dfd7][_0x2682('0x7d')]){_0x49aa01[_0x5ff5f8['joins'][_0x31dfd7]['type']](_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7c')],null,util['format'](_0x2682('0x7e'),_0x5ff5f8['table'],_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7b')],_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7c')],_0x5ff5f8[_0x2682('0x79')][_0x31dfd7][_0x2682('0x7d')]));}}}if(_0x5ff5f8['conditions']){_0x5ff5f8[_0x2682('0x80')]=JSON[_0x2682('0x7a')](_0x5ff5f8[_0x2682('0x80')]);_0x49aa01['where'](_0x2b23a9(_0x5ff5f8[_0x2682('0x80')][_0x2682('0x68')]));}_0x2d7d84=_0x49aa01[_0x2682('0xa5')]();_0x49aa01[_0x2682('0x1e')](_0x2cbd24);_0x49aa01[_0x2682('0x1d')](0x0);logger[_0x2682('0x81')]('Limited\x20Query:',_0x49aa01[_0x2682('0x83')]());return db[_0x2682('0x84')][_0x2682('0x34')](_0x49aa01[_0x2682('0x83')](),{'type':db[_0x2682('0x84')][_0x2682('0x8f')][_0x2682('0x90')]});}})[_0x2682('0x25')](function(){return{'sql':_0x2d7d84['toString']()};})[_0x2682('0x25')](respondWithResult(_0x497dc0,null))[_0x2682('0x48')](handleError(_0x497dc0,null));}; \ No newline at end of file +var _0x1e69=['Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticCustomReport','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','alias','%s.%s\x20=\x20%s.%s','Limited\x20Query:','No\x20available\x20data','output','web','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','runReport','left_join','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','offset','set'];(function(_0x375cef,_0x48df7a){var _0x3072c0=function(_0x5dfc39){while(--_0x5dfc39){_0x375cef['push'](_0x375cef['shift']());}};_0x3072c0(++_0x48df7a);}(_0x1e69,0x85));var _0x91e6=function(_0x4e1d47,_0x40d4c8){_0x4e1d47=_0x4e1d47-0x0;var _0x1c5b56=_0x1e69[_0x4e1d47];return _0x1c5b56;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91e6('0x0'));var rimraf=require(_0x91e6('0x1'));var zipdir=require(_0x91e6('0x2'));var jsonpatch=require(_0x91e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x91e6('0x4'));var Mustache=require(_0x91e6('0x5'));var util=require(_0x91e6('0x6'));var path=require(_0x91e6('0x7'));var sox=require(_0x91e6('0x8'));var csv=require(_0x91e6('0x9'));var ejs=require(_0x91e6('0xa'));var fs=require('fs');var _=require(_0x91e6('0xb'));var squel=require(_0x91e6('0xc'));var crypto=require(_0x91e6('0xd'));var jsforce=require(_0x91e6('0xe'));var deskjs=require(_0x91e6('0xf'));var toCsv=require(_0x91e6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91e6('0x10'));var authService=require(_0x91e6('0x11'));var qs=require(_0x91e6('0x12'));var as=require(_0x91e6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91e6('0x14'))(_0x91e6('0x15'));var utils=require(_0x91e6('0x16'));var config=require(_0x91e6('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x91e6('0x18'))[_0x91e6('0x19')];function respondWithStatusCode(_0x1cc277,_0x35d81a){_0x35d81a=_0x35d81a||0xcc;return function(_0xf665a4){if(_0xf665a4){return _0x1cc277[_0x91e6('0x1a')](_0x35d81a);}return _0x1cc277[_0x91e6('0x1b')](_0x35d81a)['end']();};}function respondWithResult(_0x2b1d0c,_0x39d567){_0x39d567=_0x39d567||0xc8;return function(_0x332a26){if(_0x332a26){return _0x2b1d0c[_0x91e6('0x1b')](_0x39d567)['json'](_0x332a26);}};}function respondWithFilteredResult(_0xdc8f22,_0x195cf9){return function(_0x521502){if(_0x521502){var _0xf214f9=_0x521502['count'],_0x4a7219=_0x195cf9[_0x91e6('0x1c')],_0x57d30d=_0x195cf9[_0x91e6('0x1c')]+_0x195cf9['limit'],_0x51973f;if(_0x57d30d>=_0xf214f9){_0x57d30d=_0xf214f9;_0x51973f=0xc8;}else{_0x51973f=0xce;}_0xdc8f22['status'](_0x51973f);return _0xdc8f22[_0x91e6('0x1d')](_0x91e6('0x1e'),_0x4a7219+'-'+_0x57d30d+'/'+_0xf214f9)[_0x91e6('0x1f')](_0x521502);}return null;};}function patchUpdates(_0x1ffaa3){return function(_0x1c78e9){try{jsonpatch[_0x91e6('0x20')](_0x1c78e9,_0x1ffaa3,!![]);}catch(_0x163e9a){return BPromise[_0x91e6('0x21')](_0x163e9a);}return _0x1c78e9[_0x91e6('0x22')]();};}function saveUpdates(_0x2d99f7,_0x52599f){return function(_0x9d7470){if(_0x9d7470){return _0x9d7470[_0x91e6('0x23')](_0x2d99f7)[_0x91e6('0x24')](function(_0x1c4bdf){return _0x1c4bdf;});}return null;};}function removeEntity(_0x29172b,_0x458e49){return function(_0x4bdfe8){if(_0x4bdfe8){return _0x4bdfe8['destroy']()[_0x91e6('0x24')](function(){var _0xc1333b=_0x4bdfe8[_0x91e6('0x25')]({'plain':!![]});var _0x32a5a1='CustomReports';return db[_0x91e6('0x26')][_0x91e6('0x27')]({'where':{'type':_0x32a5a1,'resourceId':_0xc1333b['id']}})[_0x91e6('0x24')](function(){return _0x4bdfe8;});})[_0x91e6('0x24')](function(){_0x29172b[_0x91e6('0x1b')](0xcc)[_0x91e6('0x28')]();});}};}function handleEntityNotFound(_0x296ce9,_0x21f642){return function(_0x21da27){if(!_0x21da27){_0x296ce9[_0x91e6('0x1a')](0x194);}return _0x21da27;};}function handleError(_0x117f2b,_0x597ed5){_0x597ed5=_0x597ed5||0x1f4;return function(_0x64644e){logger[_0x91e6('0x29')](_0x64644e[_0x91e6('0x2a')]);if(_0x64644e[_0x91e6('0x2b')]){delete _0x64644e[_0x91e6('0x2b')];}_0x117f2b['status'](_0x597ed5)[_0x91e6('0x2c')](_0x64644e);};}exports[_0x91e6('0x2d')]=function(_0x4ca580,_0x2fcee6){var _0x3aed5d={},_0x3cca11={},_0x4e3924={'count':0x0,'rows':[]};var _0x2a08e0=_[_0x91e6('0x2e')](db['AnalyticCustomReport'][_0x91e6('0x2f')],function(_0x3a0b3c){return{'name':_0x3a0b3c['fieldName'],'type':_0x3a0b3c[_0x91e6('0x30')]['key']};});_0x3cca11[_0x91e6('0x31')]=_[_0x91e6('0x2e')](_0x2a08e0,'name');_0x3cca11[_0x91e6('0x32')]=_['keys'](_0x4ca580[_0x91e6('0x32')]);_0x3cca11[_0x91e6('0x33')]=_[_0x91e6('0x34')](_0x3cca11[_0x91e6('0x31')],_0x3cca11[_0x91e6('0x32')]);_0x3aed5d[_0x91e6('0x35')]=_[_0x91e6('0x34')](_0x3cca11['model'],qs[_0x91e6('0x36')](_0x4ca580['query'][_0x91e6('0x36')]));_0x3aed5d[_0x91e6('0x35')]=_0x3aed5d[_0x91e6('0x35')][_0x91e6('0x37')]?_0x3aed5d[_0x91e6('0x35')]:_0x3cca11['model'];if(!_0x4ca580[_0x91e6('0x32')][_0x91e6('0x38')]('nolimit')){_0x3aed5d[_0x91e6('0x39')]=qs['limit'](_0x4ca580[_0x91e6('0x32')]['limit']);_0x3aed5d[_0x91e6('0x1c')]=qs['offset'](_0x4ca580['query']['offset']);}_0x3aed5d[_0x91e6('0x3a')]=qs[_0x91e6('0x3b')](_0x4ca580[_0x91e6('0x32')][_0x91e6('0x3b')]);_0x3aed5d[_0x91e6('0x3c')]=qs['filters'](_['pick'](_0x4ca580[_0x91e6('0x32')],_0x3cca11[_0x91e6('0x33')]),_0x2a08e0);if(_0x4ca580[_0x91e6('0x32')][_0x91e6('0x3d')]){_0x3aed5d['where']=_[_0x91e6('0x3e')](_0x3aed5d[_0x91e6('0x3c')],{'$or':_['map'](_0x2a08e0,function(_0x5d3c18){if(_0x5d3c18[_0x91e6('0x30')]!==_0x91e6('0x3f')){var _0x50ce13={};_0x50ce13[_0x5d3c18[_0x91e6('0x2b')]]={'$like':'%'+_0x4ca580[_0x91e6('0x32')][_0x91e6('0x3d')]+'%'};return _0x50ce13;}})});}_0x3aed5d=_[_0x91e6('0x3e')]({},_0x3aed5d,_0x4ca580[_0x91e6('0x40')]);var _0x14c937={'where':_0x3aed5d[_0x91e6('0x3c')]};return db[_0x91e6('0x41')][_0x91e6('0x42')](_0x14c937)[_0x91e6('0x24')](function(_0x4c4c9c){_0x4e3924[_0x91e6('0x42')]=_0x4c4c9c;if(_0x4ca580[_0x91e6('0x32')][_0x91e6('0x43')]){_0x3aed5d[_0x91e6('0x44')]=[{'all':!![]}];}return db[_0x91e6('0x41')][_0x91e6('0x45')](_0x3aed5d);})['then'](function(_0x1735e7){_0x4e3924[_0x91e6('0x46')]=_0x1735e7;return _0x4e3924;})['then'](respondWithFilteredResult(_0x2fcee6,_0x3aed5d))[_0x91e6('0x47')](handleError(_0x2fcee6,null));};exports['show']=function(_0x2d6c3c,_0x9d8be0){var _0x3f7c55={'raw':![],'where':{'id':_0x2d6c3c[_0x91e6('0x48')]['id']}},_0x1345e1={};_0x1345e1['model']=_[_0x91e6('0x49')](db['AnalyticCustomReport'][_0x91e6('0x2f')]);_0x1345e1[_0x91e6('0x32')]=_[_0x91e6('0x49')](_0x2d6c3c[_0x91e6('0x32')]);_0x1345e1[_0x91e6('0x33')]=_[_0x91e6('0x34')](_0x1345e1[_0x91e6('0x31')],_0x1345e1[_0x91e6('0x32')]);_0x3f7c55['attributes']=_[_0x91e6('0x34')](_0x1345e1[_0x91e6('0x31')],qs[_0x91e6('0x36')](_0x2d6c3c[_0x91e6('0x32')][_0x91e6('0x36')]));_0x3f7c55[_0x91e6('0x35')]=_0x3f7c55[_0x91e6('0x35')][_0x91e6('0x37')]?_0x3f7c55['attributes']:_0x1345e1[_0x91e6('0x31')];if(_0x2d6c3c[_0x91e6('0x32')][_0x91e6('0x43')]){_0x3f7c55['include']=[{'all':!![]}];}_0x3f7c55=_['merge']({},_0x3f7c55,_0x2d6c3c['options']);return db['AnalyticCustomReport'][_0x91e6('0x4a')](_0x3f7c55)[_0x91e6('0x24')](handleEntityNotFound(_0x9d8be0,null))[_0x91e6('0x24')](respondWithResult(_0x9d8be0,null))[_0x91e6('0x47')](handleError(_0x9d8be0,null));};exports[_0x91e6('0x4b')]=function(_0x34fd2e,_0x2da3a6){return db[_0x91e6('0x41')]['create'](_0x34fd2e[_0x91e6('0x4c')],{})[_0x91e6('0x24')](function(_0x103cd4){var _0x3dff69=_0x34fd2e[_0x91e6('0x4d')][_0x91e6('0x25')]({'plain':!![]});if(!_0x3dff69)throw new Error(_0x91e6('0x4e'));if(_0x3dff69[_0x91e6('0x4f')]==='user'){var _0x5522e9=_0x103cd4[_0x91e6('0x25')]({'plain':!![]});var _0x1fd8fa='Reports';return db[_0x91e6('0x50')][_0x91e6('0x4a')]({'where':{'name':_0x1fd8fa,'userProfileId':_0x3dff69['userProfileId']},'raw':!![]})[_0x91e6('0x24')](function(_0x202d44){if(_0x202d44&&_0x202d44[_0x91e6('0x51')]===0x0){return db['UserProfileResource'][_0x91e6('0x4b')]({'name':_0x5522e9['name'],'resourceId':_0x5522e9['id'],'type':_0x91e6('0x52'),'sectionId':_0x202d44['id']},{})[_0x91e6('0x24')](function(){return _0x103cd4;});}else{return _0x103cd4;}})[_0x91e6('0x47')](function(_0xf09bd5){logger[_0x91e6('0x29')](_0x91e6('0x53'),_0xf09bd5);throw _0xf09bd5;});}return _0x103cd4;})[_0x91e6('0x24')](respondWithResult(_0x2da3a6,0xc9))[_0x91e6('0x47')](handleError(_0x2da3a6,null));};exports[_0x91e6('0x23')]=function(_0x56cef1,_0x35ce3c){if(_0x56cef1['body']['id']){delete _0x56cef1[_0x91e6('0x4c')]['id'];}return db[_0x91e6('0x41')]['find']({'where':{'id':_0x56cef1['params']['id']}})[_0x91e6('0x24')](handleEntityNotFound(_0x35ce3c,null))[_0x91e6('0x24')](saveUpdates(_0x56cef1[_0x91e6('0x4c')],null))[_0x91e6('0x24')](respondWithResult(_0x35ce3c,null))[_0x91e6('0x47')](handleError(_0x35ce3c,null));};exports[_0x91e6('0x27')]=function(_0x2b08a8,_0x1de608){return db[_0x91e6('0x41')]['find']({'where':{'id':_0x2b08a8['params']['id']}})[_0x91e6('0x24')](handleEntityNotFound(_0x1de608,null))[_0x91e6('0x24')](removeEntity(_0x1de608,null))[_0x91e6('0x47')](handleError(_0x1de608,null));};exports['preview']=function(_0x299e05,_0x31fc0d){var _0x5eda67=0xa;var _0x46db0d=[_0x91e6('0x54'),'left_join',_0x91e6('0x55'),_0x91e6('0x56')];var _0x574309={'SUM':_0x91e6('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91e6('0x58'),'MAX':'MAX(%s)','MIN':_0x91e6('0x59'),'AVG':_0x91e6('0x5a'),'GROUP_CONCAT':_0x91e6('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91e6('0x5c')};var _0x145e8f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91e6('0x5d'),'HOUR':_0x91e6('0x5e'),'ROUND':_0x91e6('0x5f'),'UNIX_TIMESTAMP':_0x91e6('0x60')};var _0x202cc7=function(_0x154301){return!_[_0x91e6('0x61')]([_0x91e6('0x62'),_0x91e6('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x154301);};var _0x5ce12e=function(_0xc5bc4a){if(!_0xc5bc4a||!_0xc5bc4a[_0x91e6('0x64')][_0x91e6('0x37')]){return'';}for(var _0x404e7e='(',_0x125386=0x0;_0x125386<_0xc5bc4a[_0x91e6('0x64')][_0x91e6('0x37')];_0x125386+=0x1){_0x125386>0x0&&(_0x404e7e+='\x20'+_0xc5bc4a[_0x91e6('0x65')]+'\x20');_0x404e7e+=_0xc5bc4a[_0x91e6('0x64')][_0x125386][_0x91e6('0x66')]?_0x5ce12e(_0xc5bc4a['rules'][_0x125386][_0x91e6('0x66')]):_0xc5bc4a[_0x91e6('0x64')][_0x125386][_0x91e6('0x67')]+'\x20'+_0xc5bc4a[_0x91e6('0x64')][_0x125386][_0x91e6('0x68')]+(_0x202cc7(_0xc5bc4a['rules'][_0x125386]['condition'])?'\x20'+_0xc5bc4a[_0x91e6('0x64')][_0x125386]['value']:'');}return _0x404e7e+')';};var _0x1d7711={'where':{'id':_0x299e05[_0x91e6('0x48')]['id']}},_0x1aeb1f,_0x5301b1,_0x597bc2,_0x5d9aef,_0x3eb8fa;_0x1d7711=_[_0x91e6('0x3e')]({},_0x1d7711,_0x299e05[_0x91e6('0x40')]);return db[_0x91e6('0x41')][_0x91e6('0x4a')](_0x1d7711)[_0x91e6('0x24')](function(_0x573f52){if(_0x573f52){_0x1aeb1f=_0x573f52;return _0x573f52[_0x91e6('0x69')]();}return null;})['then'](function(_0x238861){if(_0x238861){if(!_0x238861[_0x91e6('0x37')]){throw new db[(_0x91e6('0x6a'))][(_0x91e6('0x6b'))](_0x91e6('0x6c'),0x193);}_0x5301b1=_0x238861;return db[_0x91e6('0x6d')][_0x91e6('0x45')]({'raw':!![]});}return null;})[_0x91e6('0x24')](function(_0x2ec52c){if(_0x2ec52c){_0x597bc2=_[_0x91e6('0x6e')](_0x2ec52c,'id');var _0x314b69;var _0x1d8fd0=squel[_0x91e6('0x6f')]();_0x1d8fd0[_0x91e6('0x70')](_0x1aeb1f[_0x91e6('0x71')]);for(var _0x6fd239=0x0;_0x6fd239<_0x5301b1[_0x91e6('0x37')];_0x6fd239+=0x1){_0x314b69=_0x5301b1[_0x6fd239][_0x91e6('0x72')]?_0x597bc2[_0x5301b1[_0x6fd239][_0x91e6('0x72')]][_0x91e6('0x73')]:_0x5301b1[_0x6fd239][_0x91e6('0x67')];_0x314b69=_0x5301b1[_0x6fd239][_0x91e6('0x74')]?_['replace'](_0x574309[_0x5301b1[_0x6fd239][_0x91e6('0x74')]],'%s',_0x314b69):_0x314b69;_0x314b69=_0x5301b1[_0x6fd239][_0x91e6('0x75')]?_[_0x91e6('0x76')](_0x145e8f[_0x5301b1[_0x6fd239][_0x91e6('0x75')]],'%s',_0x314b69):_0x314b69;if(_0x5301b1[_0x6fd239][_0x91e6('0x77')]){_0x1d8fd0['group'](_0x314b69);}_0x5301b1[_0x6fd239][_0x91e6('0x78')]&&_0x1d8fd0[_0x91e6('0x3a')](_0x314b69,_0x5301b1[_0x6fd239]['orderBy']===_0x91e6('0x79')?![]:!![]);_0x1d8fd0[_0x91e6('0x67')](_0x314b69,_0x5301b1[_0x6fd239]['alias']||_0x314b69);}if(_0x1aeb1f[_0x91e6('0x7a')]){_0x1aeb1f[_0x91e6('0x7a')]=JSON['parse'](_0x1aeb1f['joins']);for(var _0x13c97f=0x0;_0x13c97f<_0x1aeb1f[_0x91e6('0x7a')][_0x91e6('0x37')];_0x13c97f+=0x1){if(_0x1aeb1f['joins'][_0x13c97f][_0x91e6('0x30')]&&_[_0x91e6('0x61')](_0x46db0d,_0x1aeb1f['joins'][_0x13c97f]['type'])&&_0x1aeb1f['joins'][_0x13c97f][_0x91e6('0x7b')]&&_0x1aeb1f['joins'][_0x13c97f]['foreignTable']&&_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f]['foreignKey']){_0x1d8fd0[_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f][_0x91e6('0x30')]](_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f][_0x91e6('0x7c')],null,util[_0x91e6('0x75')]('%s.%s\x20=\x20%s.%s',_0x1aeb1f[_0x91e6('0x71')],_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f][_0x91e6('0x7b')],_0x1aeb1f['joins'][_0x13c97f][_0x91e6('0x7c')],_0x1aeb1f[_0x91e6('0x7a')][_0x13c97f][_0x91e6('0x7d')]));}}}if(_0x1aeb1f[_0x91e6('0x7e')]){_0x1aeb1f[_0x91e6('0x7e')]=JSON[_0x91e6('0x7f')](_0x1aeb1f[_0x91e6('0x7e')]);_0x1d8fd0[_0x91e6('0x3c')](_0x5ce12e(_0x1aeb1f['conditions'][_0x91e6('0x66')]));}_0x3eb8fa=_0x1d8fd0[_0x91e6('0x80')]();_0x1d8fd0[_0x91e6('0x39')](_0x5eda67);_0x1d8fd0[_0x91e6('0x1c')](0x0);logger[_0x91e6('0x81')]('Limited\x20Query:',_0x1d8fd0['toString']());return db['sequelize'][_0x91e6('0x32')](_0x1d8fd0[_0x91e6('0x82')](),{'type':db[_0x91e6('0x83')][_0x91e6('0x84')][_0x91e6('0x85')]});}})[_0x91e6('0x24')](respondWithResult(_0x31fc0d,null))[_0x91e6('0x47')](handleError(_0x31fc0d,null));};function runReport(_0x4a7041,_0x2e3ef1,_0x1ca0c4){var _0x2d1033=_0x2e3ef1[_0x91e6('0x2b')];var _0x1cee33=0xa;var _0x1a8b47=[_0x91e6('0x54'),'left_join',_0x91e6('0x55'),_0x91e6('0x56')];var _0x30e522={'SUM':'SUM(%s)','COUNT':_0x91e6('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x91e6('0x87'),'MIN':_0x91e6('0x59'),'AVG':_0x91e6('0x5a'),'GROUP_CONCAT':_0x91e6('0x5b'),'GROUP_CONCAT ASC':_0x91e6('0x88'),'GROUP_CONCAT DESC':_0x91e6('0x5c')};var _0x3b5c8f={'SEC_TO_TIME':_0x91e6('0x89'),'DATE':_0x91e6('0x5d'),'HOUR':_0x91e6('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x91e6('0x60')};var _0xed86ee=function(_0x352475){return!_[_0x91e6('0x61')]([_0x91e6('0x62'),_0x91e6('0x63'),'IS\x20EMPTY',_0x91e6('0x8a')],_0x352475);};var _0x3af565=function(_0x490063){if(!_0x490063||!_0x490063[_0x91e6('0x64')][_0x91e6('0x37')]){return'';}for(var _0x807a2c='(',_0x4a6d65=0x0;_0x4a6d65<_0x490063['rules'][_0x91e6('0x37')];_0x4a6d65+=0x1){_0x4a6d65>0x0&&(_0x807a2c+='\x20'+_0x490063['operator']+'\x20');_0x807a2c+=_0x490063[_0x91e6('0x64')][_0x4a6d65]['group']?_0x3af565(_0x490063['rules'][_0x4a6d65][_0x91e6('0x66')]):_0x490063[_0x91e6('0x64')][_0x4a6d65][_0x91e6('0x67')]+'\x20'+_0x490063[_0x91e6('0x64')][_0x4a6d65][_0x91e6('0x68')]+(_0xed86ee(_0x490063[_0x91e6('0x64')][_0x4a6d65][_0x91e6('0x68')])?'\x20'+_0x490063[_0x91e6('0x64')][_0x4a6d65][_0x91e6('0x8b')]:'');}return _0x807a2c+')';};var _0x408263={'where':{'id':_0x4a7041['id']}},_0x97bc5a,_0x4baa87,_0x9c3c69,_0x347f3a,_0x5cf043;_0x408263=_[_0x91e6('0x3e')]({},_0x408263,_0x1ca0c4);return db[_0x91e6('0x41')][_0x91e6('0x4a')](_0x408263)[_0x91e6('0x24')](function(_0xe5d841){if(_0xe5d841){_0x97bc5a=_0xe5d841;return _0xe5d841['getFields']();}return null;})[_0x91e6('0x24')](function(_0x2104c5){if(_0x2104c5){if(!_0x2104c5[_0x91e6('0x37')]){throw new db[(_0x91e6('0x6a'))][(_0x91e6('0x6b'))](_0x91e6('0x6c'),0x193);}_0x4baa87=_0x2104c5;return db[_0x91e6('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x91e6('0x24')](function(_0x103375){if(_0x103375){_0x9c3c69=_[_0x91e6('0x6e')](_0x103375,'id');var _0x23eef6;var _0x5dee74=squel[_0x91e6('0x6f')]();_0x5dee74[_0x91e6('0x70')](_0x97bc5a[_0x91e6('0x71')]);for(var _0x53ab35=0x0;_0x53ab35<_0x4baa87[_0x91e6('0x37')];_0x53ab35+=0x1){_0x23eef6=_0x4baa87[_0x53ab35]['MetricId']?_0x9c3c69[_0x4baa87[_0x53ab35][_0x91e6('0x72')]][_0x91e6('0x73')]:_0x4baa87[_0x53ab35][_0x91e6('0x67')];_0x23eef6=_0x4baa87[_0x53ab35][_0x91e6('0x74')]?_[_0x91e6('0x76')](_0x30e522[_0x4baa87[_0x53ab35][_0x91e6('0x74')]],'%s',_0x23eef6):_0x23eef6;_0x23eef6=_0x4baa87[_0x53ab35]['format']?_[_0x91e6('0x76')](_0x3b5c8f[_0x4baa87[_0x53ab35][_0x91e6('0x75')]],'%s',_0x23eef6):_0x23eef6;if(_0x4baa87[_0x53ab35]['groupBy']){_0x5dee74['group'](_0x23eef6);}_0x4baa87[_0x53ab35]['orderBy']&&_0x5dee74[_0x91e6('0x3a')](_0x23eef6,_0x4baa87[_0x53ab35][_0x91e6('0x78')]===_0x91e6('0x79')?![]:!![]);_0x5dee74[_0x91e6('0x67')](_0x23eef6,_0x4baa87[_0x53ab35][_0x91e6('0x8c')]||_0x23eef6);}if(_0x97bc5a['joins']){_0x97bc5a[_0x91e6('0x7a')]=JSON[_0x91e6('0x7f')](_0x97bc5a['joins']);for(var _0x3a8793=0x0;_0x3a8793<_0x97bc5a[_0x91e6('0x7a')][_0x91e6('0x37')];_0x3a8793+=0x1){if(_0x97bc5a[_0x91e6('0x7a')][_0x3a8793][_0x91e6('0x30')]&&_[_0x91e6('0x61')](_0x1a8b47,_0x97bc5a['joins'][_0x3a8793][_0x91e6('0x30')])&&_0x97bc5a['joins'][_0x3a8793]['parentKey']&&_0x97bc5a[_0x91e6('0x7a')][_0x3a8793]['foreignTable']&&_0x97bc5a['joins'][_0x3a8793][_0x91e6('0x7d')]){_0x5dee74[_0x97bc5a[_0x91e6('0x7a')][_0x3a8793]['type']](_0x97bc5a[_0x91e6('0x7a')][_0x3a8793]['foreignTable'],null,util[_0x91e6('0x75')](_0x91e6('0x8d'),_0x97bc5a[_0x91e6('0x71')],_0x97bc5a[_0x91e6('0x7a')][_0x3a8793]['parentKey'],_0x97bc5a[_0x91e6('0x7a')][_0x3a8793][_0x91e6('0x7c')],_0x97bc5a[_0x91e6('0x7a')][_0x3a8793][_0x91e6('0x7d')]));}}}if(_0x97bc5a['conditions']){_0x97bc5a[_0x91e6('0x7e')]=JSON[_0x91e6('0x7f')](_0x97bc5a['conditions']);_0x5dee74['where'](_0x3af565(_0x97bc5a[_0x91e6('0x7e')]['group']));}_0x5cf043=_0x5dee74['clone']();_0x5dee74[_0x91e6('0x39')](_0x1cee33);_0x5dee74['offset'](0x0);logger[_0x91e6('0x81')](_0x91e6('0x8e'),_0x5dee74[_0x91e6('0x82')]());return db[_0x91e6('0x83')][_0x91e6('0x32')](_0x5dee74[_0x91e6('0x82')](),{'type':db[_0x91e6('0x83')][_0x91e6('0x84')]['SELECT']});}})[_0x91e6('0x24')](function(_0x12c7ae){if(!_0x12c7ae[_0x91e6('0x37')]){throw new db[(_0x91e6('0x6a'))][(_0x91e6('0x6b'))](_0x91e6('0x8f'),0xcc);}if(_0x2e3ef1[_0x91e6('0x90')]===_0x91e6('0x91')){return null;}var _0x3ca6e3=_[_0x91e6('0x3e')](_0x2e3ef1,{'name':_0x2e3ef1[_0x91e6('0x92')]||_0x2e3ef1[_0x91e6('0x2b')]||_0x97bc5a[_0x91e6('0x2b')],'basename':_0x2d1033,'savename':util[_0x91e6('0x75')](_0x91e6('0x93'),_0x2e3ef1['name']||_0x97bc5a['name'],require('randomstring')['generate'](0x4),_0x2e3ef1[_0x91e6('0x90')]||_0x91e6('0x94')),'reportId':_0x97bc5a['id'],'reportType':_0x91e6('0x95')});return db[_0x91e6('0x96')][_0x91e6('0x4b')](_0x3ca6e3,{'raw':!![]});})[_0x91e6('0x24')](function(_0x140800){if(_0x97bc5a[_0x91e6('0x71')]===_0x91e6('0x97')){_0x5cf043[_0x91e6('0x3c')](_0x97bc5a[_0x91e6('0x71')]+_0x91e6('0x98'),_0x2e3ef1['startDate'],_0x2e3ef1[_0x91e6('0x99')]);}else{_0x5cf043[_0x91e6('0x3c')](_0x97bc5a[_0x91e6('0x71')]+_0x91e6('0x9a'),_0x2e3ef1['startDate'],_0x2e3ef1['endDate']);}if(_0x140800){logger['info'](_0x91e6('0x9b'),_0x5cf043[_0x91e6('0x82')]());require(_0x91e6('0x9c'))[_0x91e6('0x9d')](path['join'](__dirname,_0x91e6('0x9e'),_0x140800[_0x91e6('0x90')]),[_0x140800['id'],_0x5cf043[_0x91e6('0x82')](),path[_0x91e6('0x54')](__dirname,_0x91e6('0x9f'),_0x140800[_0x91e6('0xa0')]),_0x2d1033]);return _0x140800;}else{var _0x31d00a=squel[_0x91e6('0x6f')]();_0x31d00a['from']('('+_0x5cf043[_0x91e6('0x82')]()+')','countTable');_0x31d00a['field']('COUNT(*)','count');_0x5cf043[_0x91e6('0x39')](_0x2e3ef1[_0x91e6('0x39')]||_0x1cee33);_0x5cf043[_0x91e6('0x1c')](_0x2e3ef1[_0x91e6('0x1c')]||0x0);return dbH['sequelize']['query'](_0x31d00a['toString'](),{'type':dbH[_0x91e6('0x83')][_0x91e6('0x84')][_0x91e6('0x85')]})['then'](function(_0x19541b){if(!_0x19541b[_0x91e6('0x37')]){_0x347f3a=0x0;}else{_0x347f3a=_0x19541b[0x0][_0x91e6('0x42')]||0x0;}return dbH[_0x91e6('0x83')][_0x91e6('0x32')](_0x5cf043[_0x91e6('0x82')](),{'type':dbH['sequelize'][_0x91e6('0x84')][_0x91e6('0x85')]});})[_0x91e6('0x24')](function(_0x252606){return{'rows':_0x252606||[],'count':_0x347f3a};});}});}exports['run']=function(_0xb5d821,_0x50a3d9){return runReport(_0xb5d821[_0x91e6('0x48')],_0xb5d821['query'],_0xb5d821[_0x91e6('0x40')])['then'](respondWithResult(_0x50a3d9,null))[_0x91e6('0x47')](handleError(_0x50a3d9,null));};exports[_0x91e6('0xa1')]=runReport;exports[_0x91e6('0x32')]=function(_0x120273,_0x1bf01c){var _0xcc77b5=0xa;var _0x196046=[_0x91e6('0x54'),_0x91e6('0xa2'),'right_join',_0x91e6('0x56')];var _0x4b3fa7={'SUM':_0x91e6('0x57'),'COUNT':_0x91e6('0x86'),'COUNT DISTINCT':_0x91e6('0x58'),'MAX':_0x91e6('0x87'),'MIN':_0x91e6('0x59'),'AVG':_0x91e6('0x5a'),'GROUP_CONCAT':_0x91e6('0x5b'),'GROUP_CONCAT ASC':_0x91e6('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x273a16={'SEC_TO_TIME':_0x91e6('0x89'),'DATE':_0x91e6('0x5d'),'HOUR':_0x91e6('0x5e'),'ROUND':_0x91e6('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3273ce=function(_0x32fa50){return!_[_0x91e6('0x61')]([_0x91e6('0x62'),_0x91e6('0x63'),'IS\x20EMPTY',_0x91e6('0x8a')],_0x32fa50);};var _0x287da6=function(_0x1c6de2){if(!_0x1c6de2||!_0x1c6de2['rules'][_0x91e6('0x37')]){return'';}for(var _0x5ca4db='(',_0x524453=0x0;_0x524453<_0x1c6de2[_0x91e6('0x64')]['length'];_0x524453+=0x1){_0x524453>0x0&&(_0x5ca4db+='\x20'+_0x1c6de2[_0x91e6('0x65')]+'\x20');_0x5ca4db+=_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x66')]?_0x287da6(_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x66')]):_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x67')]+'\x20'+_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x68')]+(_0x3273ce(_0x1c6de2[_0x91e6('0x64')][_0x524453][_0x91e6('0x68')])?'\x20'+_0x1c6de2[_0x91e6('0x64')][_0x524453]['value']:'');}return _0x5ca4db+')';};var _0x3552c9={'where':{'id':_0x120273[_0x91e6('0x48')]['id']}},_0x45e7e8,_0x19b4b9,_0x19309b,_0x4ab8cb,_0x42c504;_0x3552c9=_[_0x91e6('0x3e')]({},_0x3552c9,_0x120273[_0x91e6('0x40')]);return db['AnalyticCustomReport']['find'](_0x3552c9)[_0x91e6('0x24')](function(_0x107d05){if(_0x107d05){_0x45e7e8=_0x107d05;return _0x107d05['getFields']();}return null;})[_0x91e6('0x24')](function(_0x5d43d9){if(_0x5d43d9){if(!_0x5d43d9[_0x91e6('0x37')]){throw new db[(_0x91e6('0x6a'))][(_0x91e6('0x6b'))](_0x91e6('0x6c'),0x193);}_0x19b4b9=_0x5d43d9;return db['AnalyticMetric'][_0x91e6('0x45')]({'raw':!![]});}return null;})['then'](function(_0x8e3392){if(_0x8e3392){_0x19309b=_['keyBy'](_0x8e3392,'id');var _0x55c9e7;var _0x2a0640=squel[_0x91e6('0x6f')]();_0x2a0640['from'](_0x45e7e8[_0x91e6('0x71')]);for(var _0x5a0bca=0x0;_0x5a0bca<_0x19b4b9[_0x91e6('0x37')];_0x5a0bca+=0x1){_0x55c9e7=_0x19b4b9[_0x5a0bca][_0x91e6('0x72')]?_0x19309b[_0x19b4b9[_0x5a0bca][_0x91e6('0x72')]][_0x91e6('0x73')]:_0x19b4b9[_0x5a0bca][_0x91e6('0x67')];_0x55c9e7=_0x19b4b9[_0x5a0bca]['function']?_[_0x91e6('0x76')](_0x4b3fa7[_0x19b4b9[_0x5a0bca][_0x91e6('0x74')]],'%s',_0x55c9e7):_0x55c9e7;_0x55c9e7=_0x19b4b9[_0x5a0bca][_0x91e6('0x75')]?_[_0x91e6('0x76')](_0x273a16[_0x19b4b9[_0x5a0bca][_0x91e6('0x75')]],'%s',_0x55c9e7):_0x55c9e7;if(_0x19b4b9[_0x5a0bca][_0x91e6('0x77')]){_0x2a0640[_0x91e6('0x66')](_0x55c9e7);}_0x19b4b9[_0x5a0bca][_0x91e6('0x78')]&&_0x2a0640[_0x91e6('0x3a')](_0x55c9e7,_0x19b4b9[_0x5a0bca][_0x91e6('0x78')]===_0x91e6('0x79')?![]:!![]);_0x2a0640['field'](_0x55c9e7,_0x19b4b9[_0x5a0bca][_0x91e6('0x8c')]||_0x55c9e7);}if(_0x45e7e8['joins']){_0x45e7e8[_0x91e6('0x7a')]=JSON[_0x91e6('0x7f')](_0x45e7e8[_0x91e6('0x7a')]);for(var _0x253402=0x0;_0x253402<_0x45e7e8[_0x91e6('0x7a')]['length'];_0x253402+=0x1){if(_0x45e7e8[_0x91e6('0x7a')][_0x253402][_0x91e6('0x30')]&&_[_0x91e6('0x61')](_0x196046,_0x45e7e8[_0x91e6('0x7a')][_0x253402][_0x91e6('0x30')])&&_0x45e7e8[_0x91e6('0x7a')][_0x253402][_0x91e6('0x7b')]&&_0x45e7e8['joins'][_0x253402]['foreignTable']&&_0x45e7e8[_0x91e6('0x7a')][_0x253402]['foreignKey']){_0x2a0640[_0x45e7e8['joins'][_0x253402][_0x91e6('0x30')]](_0x45e7e8[_0x91e6('0x7a')][_0x253402]['foreignTable'],null,util[_0x91e6('0x75')](_0x91e6('0x8d'),_0x45e7e8[_0x91e6('0x71')],_0x45e7e8[_0x91e6('0x7a')][_0x253402]['parentKey'],_0x45e7e8['joins'][_0x253402]['foreignTable'],_0x45e7e8[_0x91e6('0x7a')][_0x253402][_0x91e6('0x7d')]));}}}if(_0x45e7e8[_0x91e6('0x7e')]){_0x45e7e8[_0x91e6('0x7e')]=JSON[_0x91e6('0x7f')](_0x45e7e8[_0x91e6('0x7e')]);_0x2a0640[_0x91e6('0x3c')](_0x287da6(_0x45e7e8['conditions']['group']));}_0x42c504=_0x2a0640['clone']();_0x2a0640[_0x91e6('0x39')](_0xcc77b5);_0x2a0640[_0x91e6('0x1c')](0x0);logger[_0x91e6('0x81')](_0x91e6('0x8e'),_0x2a0640[_0x91e6('0x82')]());return db[_0x91e6('0x83')][_0x91e6('0x32')](_0x2a0640[_0x91e6('0x82')](),{'type':db['sequelize'][_0x91e6('0x84')][_0x91e6('0x85')]});}})[_0x91e6('0x24')](function(){return{'sql':_0x42c504[_0x91e6('0x82')]()};})['then'](respondWithResult(_0x1bf01c,null))[_0x91e6('0x47')](handleError(_0x1bf01c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8a8ff75..77ef4d9 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 _0x09f3=['api','moment','bluebird','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger'];(function(_0x3221f9,_0x3e0f4d){var _0x1ef09f=function(_0x29ef95){while(--_0x29ef95){_0x3221f9['push'](_0x3221f9['shift']());}};_0x1ef09f(++_0x3e0f4d);}(_0x09f3,0x1c5));var _0x309f=function(_0x4efe55,_0x6174ea){_0x4efe55=_0x4efe55-0x0;var _0x3a15da=_0x09f3[_0x4efe55];return _0x3a15da;};'use strict';var _=require(_0x309f('0x0'));var util=require(_0x309f('0x1'));var logger=require(_0x309f('0x2'))(_0x309f('0x3'));var moment=require(_0x309f('0x4'));var BPromise=require(_0x309f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x309f('0x6'));var rimraf=require('rimraf');var config=require(_0x309f('0x7'));var attributes=require(_0x309f('0x8'));module[_0x309f('0x9')]=function(_0xfd7e34,_0x107510){return _0xfd7e34[_0x309f('0xa')](_0x309f('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x533c=['path','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports','util','moment','bluebird','request-promise'];(function(_0x1f54ef,_0x58493d){var _0x821c0f=function(_0x5a65b8){while(--_0x5a65b8){_0x1f54ef['push'](_0x1f54ef['shift']());}};_0x821c0f(++_0x58493d);}(_0x533c,0x125));var _0xc533=function(_0x32e24e,_0x142f77){_0x32e24e=_0x32e24e-0x0;var _0x233eb0=_0x533c[_0x32e24e];return _0x233eb0;};'use strict';var _=require('lodash');var util=require(_0xc533('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc533('0x1'));var BPromise=require(_0xc533('0x2'));var rp=require(_0xc533('0x3'));var fs=require('fs');var path=require(_0xc533('0x4'));var rimraf=require('rimraf');var config=require(_0xc533('0x5'));var attributes=require(_0xc533('0x6'));module['exports']=function(_0x3be313,_0x3d1776){return _0x3be313['define'](_0xc533('0x7'),attributes,{'tableName':_0xc533('0x8'),'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 b80ac63..bd3eac0 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 _0xb7c2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x1391dc,_0x5b62f5){var _0x4787e4=function(_0x337028){while(--_0x337028){_0x1391dc['push'](_0x1391dc['shift']());}};_0x4787e4(++_0x5b62f5);}(_0xb7c2,0x16c));var _0x2b7c=function(_0x15bd6b,_0x338b15){_0x15bd6b=_0x15bd6b-0x0;var _0x3a270f=_0xb7c2[_0x15bd6b];return _0x3a270f;};'use strict';var _=require(_0x2b7c('0x0'));var util=require('util');var moment=require(_0x2b7c('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b7c('0x2'));var fs=require('fs');var Redis=require(_0x2b7c('0x3'));var db=require(_0x2b7c('0x4'))['db'];var utils=require(_0x2b7c('0x5'));var logger=require(_0x2b7c('0x6'))(_0x2b7c('0x7'));var config=require(_0x2b7c('0x8'));var jayson=require(_0x2b7c('0x9'));var client=jayson['client'][_0x2b7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa67380,_0x1485cd,_0x43dc07){return new BPromise(function(_0x4ccaea,_0x81287){return client[_0x2b7c('0xb')](_0xa67380,_0x43dc07)['then'](function(_0x546e62){logger[_0x2b7c('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1485cd,_0x2b7c('0xd'));logger[_0x2b7c('0xe')](_0x2b7c('0xf'),_0x1485cd,_0x2b7c('0xd'),JSON[_0x2b7c('0x10')](_0x546e62));if(_0x546e62[_0x2b7c('0x11')]){if(_0x546e62[_0x2b7c('0x11')][_0x2b7c('0x12')]===0x1f4){logger[_0x2b7c('0x11')](_0x2b7c('0x13'),_0x1485cd,_0x546e62['error'][_0x2b7c('0x14')]);return _0x81287(_0x546e62['error'][_0x2b7c('0x14')]);}logger[_0x2b7c('0x11')](_0x2b7c('0x13'),_0x1485cd,_0x546e62['error'][_0x2b7c('0x14')]);return _0x4ccaea(_0x546e62[_0x2b7c('0x11')]['message']);}else{logger[_0x2b7c('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1485cd,_0x2b7c('0xd'));_0x4ccaea(_0x546e62[_0x2b7c('0x15')]['message']);}})[_0x2b7c('0x16')](function(_0x33a196){logger[_0x2b7c('0x11')](_0x2b7c('0x13'),_0x1485cd,_0x33a196);_0x81287(_0x33a196);});});} \ No newline at end of file +var _0xa9d7=['request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x5033bc,_0x4e0270){var _0x4d9dac=function(_0xadb933){while(--_0xadb933){_0x5033bc['push'](_0x5033bc['shift']());}};_0x4d9dac(++_0x4e0270);}(_0xa9d7,0x1d3));var _0x7a9d=function(_0x2da840,_0xb0568d){_0x2da840=_0x2da840-0x0;var _0x4b0c96=_0xa9d7[_0x2da840];return _0x4b0c96;};'use strict';var _=require(_0x7a9d('0x0'));var util=require(_0x7a9d('0x1'));var moment=require(_0x7a9d('0x2'));var BPromise=require(_0x7a9d('0x3'));var rs=require(_0x7a9d('0x4'));var fs=require('fs');var Redis=require(_0x7a9d('0x5'));var db=require(_0x7a9d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a9d('0x7'))(_0x7a9d('0x8'));var config=require(_0x7a9d('0x9'));var jayson=require(_0x7a9d('0xa'));var client=jayson[_0x7a9d('0xb')][_0x7a9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40e23f,_0x479c7a,_0x59476f){return new BPromise(function(_0xac5141,_0x2572f8){return client[_0x7a9d('0xd')](_0x40e23f,_0x59476f)[_0x7a9d('0xe')](function(_0x23f301){logger['info'](_0x7a9d('0xf'),_0x479c7a,_0x7a9d('0x10'));logger['debug'](_0x7a9d('0x11'),_0x479c7a,_0x7a9d('0x10'),JSON['stringify'](_0x23f301));if(_0x23f301[_0x7a9d('0x12')]){if(_0x23f301[_0x7a9d('0x12')][_0x7a9d('0x13')]===0x1f4){logger[_0x7a9d('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x479c7a,_0x23f301['error'][_0x7a9d('0x14')]);return _0x2572f8(_0x23f301[_0x7a9d('0x12')][_0x7a9d('0x14')]);}logger[_0x7a9d('0x12')](_0x7a9d('0xf'),_0x479c7a,_0x23f301[_0x7a9d('0x12')][_0x7a9d('0x14')]);return _0xac5141(_0x23f301['error'][_0x7a9d('0x14')]);}else{logger[_0x7a9d('0x15')](_0x7a9d('0xf'),_0x479c7a,_0x7a9d('0x10'));_0xac5141(_0x23f301[_0x7a9d('0x16')][_0x7a9d('0x14')]);}})['catch'](function(_0x3795ec){logger['error'](_0x7a9d('0xf'),_0x479c7a,_0x3795ec);_0x2572f8(_0x3795ec);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 1645c9e..be7f0b1 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 _0xc012=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','exports','multer','path'];(function(_0x386f6e,_0x39c2a9){var _0x188b53=function(_0x4d57e8){while(--_0x4d57e8){_0x386f6e['push'](_0x386f6e['shift']());}};_0x188b53(++_0x39c2a9);}(_0xc012,0x1f2));var _0x2c01=function(_0x372b16,_0x5b8c43){_0x372b16=_0x372b16-0x0;var _0x4d261a=_0xc012[_0x372b16];return _0x4d261a;};'use strict';var multer=require(_0x2c01('0x0'));var util=require('util');var path=require(_0x2c01('0x1'));var timeout=require(_0x2c01('0x2'));var express=require(_0x2c01('0x3'));var router=express[_0x2c01('0x4')]();var auth=require(_0x2c01('0x5'));var interaction=require(_0x2c01('0x6'));var config=require(_0x2c01('0x7'));var controller=require(_0x2c01('0x8'));router[_0x2c01('0x9')]('/',auth[_0x2c01('0xa')](),controller[_0x2c01('0xb')]);router['get'](_0x2c01('0xc'),auth[_0x2c01('0xa')](),controller[_0x2c01('0xd')]);router['get']('/:id/preview',auth[_0x2c01('0xa')](),controller[_0x2c01('0xe')]);router[_0x2c01('0x9')](_0x2c01('0xf'),auth[_0x2c01('0xa')](),controller[_0x2c01('0x10')]);router['get'](_0x2c01('0x11'),auth[_0x2c01('0xa')](),controller[_0x2c01('0x12')]);router[_0x2c01('0x13')]('/',auth[_0x2c01('0xa')](),controller[_0x2c01('0x14')]);router[_0x2c01('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2c01('0x16')]);router['delete'](_0x2c01('0xc'),auth['isAuthenticated'](),controller[_0x2c01('0x17')]);module[_0x2c01('0x18')]=router; \ No newline at end of file +var _0x7384=['express','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','delete','multer','util','connect-timeout'];(function(_0x253ed4,_0x342aca){var _0x22df23=function(_0x5ebbfa){while(--_0x5ebbfa){_0x253ed4['push'](_0x253ed4['shift']());}};_0x22df23(++_0x342aca);}(_0x7384,0x105));var _0x4738=function(_0x1be0d5,_0x550fee){_0x1be0d5=_0x1be0d5-0x0;var _0x507303=_0x7384[_0x1be0d5];return _0x507303;};'use strict';var multer=require(_0x4738('0x0'));var util=require(_0x4738('0x1'));var path=require('path');var timeout=require(_0x4738('0x2'));var express=require(_0x4738('0x3'));var router=express[_0x4738('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4738('0x5'));var config=require(_0x4738('0x6'));var controller=require(_0x4738('0x7'));router[_0x4738('0x8')]('/',auth['isAuthenticated'](),controller[_0x4738('0x9')]);router[_0x4738('0x8')](_0x4738('0xa'),auth[_0x4738('0xb')](),controller['show']);router[_0x4738('0x8')](_0x4738('0xc'),auth[_0x4738('0xb')](),controller[_0x4738('0xd')]);router[_0x4738('0x8')](_0x4738('0xe'),auth[_0x4738('0xb')](),controller[_0x4738('0xf')]);router['get'](_0x4738('0x10'),auth['isAuthenticated'](),controller[_0x4738('0x11')]);router[_0x4738('0x12')]('/',auth[_0x4738('0xb')](),controller[_0x4738('0x13')]);router[_0x4738('0x14')](_0x4738('0xa'),auth[_0x4738('0xb')](),controller['update']);router[_0x4738('0x15')](_0x4738('0xa'),auth[_0x4738('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a0cd34a..d134ddb 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 _0xb8e2=['STRING','TEXT','sequelize','exports'];(function(_0x314b28,_0x162e01){var _0x5b43a5=function(_0x581367){while(--_0x581367){_0x314b28['push'](_0x314b28['shift']());}};_0x5b43a5(++_0x162e01);}(_0xb8e2,0xb6));var _0x2b8e=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xb8e2[_0x445101];return _0x3c3d04;};'use strict';var Sequelize=require(_0x2b8e('0x0'));module[_0x2b8e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2b8e('0x2')]},'parent':{'type':Sequelize[_0x2b8e('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x2b8e('0x3')]},'joins':{'type':Sequelize[_0x2b8e('0x3')]}}; \ No newline at end of file +var _0x2a1b=['sequelize','STRING','TEXT'];(function(_0x103ddb,_0x6c6cbf){var _0x748141=function(_0x52e174){while(--_0x52e174){_0x103ddb['push'](_0x103ddb['shift']());}};_0x748141(++_0x6c6cbf);}(_0x2a1b,0x1c5));var _0xb2a1=function(_0x55436e,_0x50e740){_0x55436e=_0x55436e-0x0;var _0x3daf9c=_0x2a1b[_0x55436e];return _0x3daf9c;};'use strict';var Sequelize=require(_0xb2a1('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2a1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb2a1('0x1')]},'parent':{'type':Sequelize[_0xb2a1('0x1')]},'table':{'type':Sequelize[_0xb2a1('0x1')]},'conditions':{'type':Sequelize[_0xb2a1('0x2')]},'joins':{'type':Sequelize[_0xb2a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 1fd44b2..bf30a68 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 _0x77c3=['apply','reject','save','update','then','get','DefaultReports','UserProfileResource','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','fields','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','function','replace','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','AVG(%s)','IS\x20NULL','IS\x20NOT\x20NULL','value','Sequelize','AnalyticMetric','metric','format','alias','clone','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','left_join','COUNT(DISTINCT\x20%s)','findAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','dbH','status','end','json','count','offset','Content-Range'];(function(_0x38d1f9,_0xc74aa6){var _0x1466b6=function(_0x31830f){while(--_0x31830f){_0x38d1f9['push'](_0x38d1f9['shift']());}};_0x1466b6(++_0xc74aa6);}(_0x77c3,0x1da));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x377c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x377c('0x1'));var zipdir=require(_0x377c('0x2'));var jsonpatch=require(_0x377c('0x3'));var rp=require(_0x377c('0x4'));var moment=require(_0x377c('0x5'));var BPromise=require(_0x377c('0x6'));var Mustache=require(_0x377c('0x7'));var util=require(_0x377c('0x8'));var path=require(_0x377c('0x9'));var sox=require(_0x377c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x377c('0xb'));var squel=require(_0x377c('0xc'));var crypto=require(_0x377c('0xd'));var jsforce=require(_0x377c('0xe'));var deskjs=require(_0x377c('0xf'));var toCsv=require(_0x377c('0x10'));var querystring=require(_0x377c('0x11'));var Papa=require(_0x377c('0x12'));var Redis=require(_0x377c('0x13'));var authService=require(_0x377c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x377c('0x15'));var logger=require(_0x377c('0x16'))(_0x377c('0x17'));var utils=require(_0x377c('0x18'));var config=require('../../config/environment');var db=require(_0x377c('0x19'))['db'];var dbH=require(_0x377c('0x19'))[_0x377c('0x1a')];function respondWithStatusCode(_0x19c44d,_0x426752){_0x426752=_0x426752||0xcc;return function(_0x429f30){if(_0x429f30){return _0x19c44d['sendStatus'](_0x426752);}return _0x19c44d[_0x377c('0x1b')](_0x426752)[_0x377c('0x1c')]();};}function respondWithResult(_0x5affd9,_0x1e2ed6){_0x1e2ed6=_0x1e2ed6||0xc8;return function(_0x4938c2){if(_0x4938c2){return _0x5affd9['status'](_0x1e2ed6)[_0x377c('0x1d')](_0x4938c2);}};}function respondWithFilteredResult(_0x48e936,_0x4d18d8){return function(_0x37b198){if(_0x37b198){var _0x1ee25c=_0x37b198[_0x377c('0x1e')],_0x473266=_0x4d18d8[_0x377c('0x1f')],_0x46a828=_0x4d18d8[_0x377c('0x1f')]+_0x4d18d8['limit'],_0xf77dc2;if(_0x46a828>=_0x1ee25c){_0x46a828=_0x1ee25c;_0xf77dc2=0xc8;}else{_0xf77dc2=0xce;}_0x48e936[_0x377c('0x1b')](_0xf77dc2);return _0x48e936['set'](_0x377c('0x20'),_0x473266+'-'+_0x46a828+'/'+_0x1ee25c)[_0x377c('0x1d')](_0x37b198);}return null;};}function patchUpdates(_0x535e4d){return function(_0x1206ce){try{jsonpatch[_0x377c('0x21')](_0x1206ce,_0x535e4d,!![]);}catch(_0x42331d){return BPromise[_0x377c('0x22')](_0x42331d);}return _0x1206ce[_0x377c('0x23')]();};}function saveUpdates(_0x21ca68,_0x319f84){return function(_0x17d157){if(_0x17d157){return _0x17d157[_0x377c('0x24')](_0x21ca68)[_0x377c('0x25')](function(_0x3f2f9e){return _0x3f2f9e;});}return null;};}function removeEntity(_0x1cd204,_0x530627){return function(_0x9869c8){if(_0x9869c8){return _0x9869c8['destroy']()[_0x377c('0x25')](function(){var _0x5084ad=_0x9869c8[_0x377c('0x26')]({'plain':!![]});var _0x2fbde2=_0x377c('0x27');return db[_0x377c('0x28')]['destroy']({'where':{'type':_0x2fbde2,'resourceId':_0x5084ad['id']}})['then'](function(){return _0x9869c8;});})[_0x377c('0x25')](function(){_0x1cd204['status'](0xcc)[_0x377c('0x1c')]();});}};}function handleEntityNotFound(_0x46fed9,_0x382362){return function(_0x50e072){if(!_0x50e072){_0x46fed9['sendStatus'](0x194);}return _0x50e072;};}function handleError(_0x585e80,_0x30c6ea){_0x30c6ea=_0x30c6ea||0x1f4;return function(_0xe0ffa8){logger[_0x377c('0x29')](_0xe0ffa8[_0x377c('0x2a')]);if(_0xe0ffa8[_0x377c('0x2b')]){delete _0xe0ffa8['name'];}_0x585e80[_0x377c('0x1b')](_0x30c6ea)['send'](_0xe0ffa8);};}exports[_0x377c('0x2c')]=function(_0x3d9824,_0x4742af){var _0x1825ea={},_0x3aa23b={},_0x4c02c5={'count':0x0,'rows':[]};var _0x263fe4=_[_0x377c('0x2d')](db[_0x377c('0x2e')][_0x377c('0x2f')],function(_0x2ac016){return{'name':_0x2ac016[_0x377c('0x30')],'type':_0x2ac016[_0x377c('0x31')][_0x377c('0x32')]};});_0x3aa23b[_0x377c('0x33')]=_['map'](_0x263fe4,_0x377c('0x2b'));_0x3aa23b[_0x377c('0x34')]=_[_0x377c('0x35')](_0x3d9824[_0x377c('0x34')]);_0x3aa23b[_0x377c('0x36')]=_[_0x377c('0x37')](_0x3aa23b[_0x377c('0x33')],_0x3aa23b['query']);_0x1825ea['attributes']=_[_0x377c('0x37')](_0x3aa23b[_0x377c('0x33')],qs['fields'](_0x3d9824[_0x377c('0x34')]['fields']));_0x1825ea[_0x377c('0x38')]=_0x1825ea[_0x377c('0x38')][_0x377c('0x39')]?_0x1825ea[_0x377c('0x38')]:_0x3aa23b[_0x377c('0x33')];if(!_0x3d9824[_0x377c('0x34')][_0x377c('0x3a')](_0x377c('0x3b'))){_0x1825ea[_0x377c('0x3c')]=qs['limit'](_0x3d9824[_0x377c('0x34')][_0x377c('0x3c')]);_0x1825ea[_0x377c('0x1f')]=qs[_0x377c('0x1f')](_0x3d9824[_0x377c('0x34')][_0x377c('0x1f')]);}_0x1825ea[_0x377c('0x3d')]=qs[_0x377c('0x3e')](_0x3d9824['query'][_0x377c('0x3e')]);_0x1825ea['where']=qs['filters'](_[_0x377c('0x3f')](_0x3d9824[_0x377c('0x34')],_0x3aa23b[_0x377c('0x36')]),_0x263fe4);if(_0x3d9824['query'][_0x377c('0x40')]){_0x1825ea[_0x377c('0x41')]=_[_0x377c('0x42')](_0x1825ea['where'],{'$or':_[_0x377c('0x2d')](_0x263fe4,function(_0x3ad36b){if(_0x3ad36b[_0x377c('0x31')]!==_0x377c('0x43')){var _0x133ebf={};_0x133ebf[_0x3ad36b[_0x377c('0x2b')]]={'$like':'%'+_0x3d9824[_0x377c('0x34')][_0x377c('0x40')]+'%'};return _0x133ebf;}})});}_0x1825ea=_[_0x377c('0x42')]({},_0x1825ea,_0x3d9824['options']);var _0x187388={'where':_0x1825ea[_0x377c('0x41')]};return db[_0x377c('0x2e')][_0x377c('0x1e')](_0x187388)['then'](function(_0xf2169f){_0x4c02c5[_0x377c('0x1e')]=_0xf2169f;if(_0x3d9824[_0x377c('0x34')][_0x377c('0x44')]){_0x1825ea['include']=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x1825ea);})[_0x377c('0x25')](function(_0x288066){_0x4c02c5[_0x377c('0x45')]=_0x288066;return _0x4c02c5;})[_0x377c('0x25')](respondWithFilteredResult(_0x4742af,_0x1825ea))[_0x377c('0x46')](handleError(_0x4742af,null));};exports[_0x377c('0x47')]=function(_0x36af8e,_0x467eac){var _0x3ae657={'raw':!![],'where':{'id':_0x36af8e[_0x377c('0x48')]['id']}},_0xb19096={};_0xb19096[_0x377c('0x33')]=_[_0x377c('0x35')](db[_0x377c('0x2e')][_0x377c('0x2f')]);_0xb19096[_0x377c('0x34')]=_[_0x377c('0x35')](_0x36af8e[_0x377c('0x34')]);_0xb19096['filters']=_[_0x377c('0x37')](_0xb19096[_0x377c('0x33')],_0xb19096[_0x377c('0x34')]);_0x3ae657[_0x377c('0x38')]=_[_0x377c('0x37')](_0xb19096[_0x377c('0x33')],qs['fields'](_0x36af8e['query'][_0x377c('0x49')]));_0x3ae657[_0x377c('0x38')]=_0x3ae657[_0x377c('0x38')]['length']?_0x3ae657['attributes']:_0xb19096['model'];if(_0x36af8e[_0x377c('0x34')][_0x377c('0x44')]){_0x3ae657[_0x377c('0x4a')]=[{'all':!![]}];}_0x3ae657=_[_0x377c('0x42')]({},_0x3ae657,_0x36af8e[_0x377c('0x4b')]);return db[_0x377c('0x2e')][_0x377c('0x4c')](_0x3ae657)[_0x377c('0x25')](handleEntityNotFound(_0x467eac,null))[_0x377c('0x25')](respondWithResult(_0x467eac,null))[_0x377c('0x46')](handleError(_0x467eac,null));};exports['create']=function(_0x16928c,_0x3f7b68){return db[_0x377c('0x2e')][_0x377c('0x4d')](_0x16928c[_0x377c('0x4e')],{})[_0x377c('0x25')](function(_0x2114b3){var _0x18475a=_0x16928c[_0x377c('0x4f')][_0x377c('0x26')]({'plain':!![]});if(!_0x18475a)throw new Error(_0x377c('0x50'));if(_0x18475a['role']==='user'){var _0x34296b=_0x2114b3[_0x377c('0x26')]({'plain':!![]});var _0x2824da=_0x377c('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x2824da,'userProfileId':_0x18475a[_0x377c('0x52')]},'raw':!![]})['then'](function(_0x5060fd){if(_0x5060fd&&_0x5060fd[_0x377c('0x53')]===0x0){return db[_0x377c('0x28')][_0x377c('0x4d')]({'name':_0x34296b[_0x377c('0x2b')],'resourceId':_0x34296b['id'],'type':_0x377c('0x27'),'sectionId':_0x5060fd['id']},{})['then'](function(){return _0x2114b3;});}else{return _0x2114b3;}})[_0x377c('0x46')](function(_0x15d3bd){logger[_0x377c('0x29')](_0x377c('0x54'),_0x15d3bd);throw _0x15d3bd;});}return _0x2114b3;})[_0x377c('0x25')](respondWithResult(_0x3f7b68,0xc9))['catch'](handleError(_0x3f7b68,null));};exports['update']=function(_0x19cc45,_0x56e29f){if(_0x19cc45[_0x377c('0x4e')]['id']){delete _0x19cc45[_0x377c('0x4e')]['id'];}return db[_0x377c('0x2e')]['find']({'where':{'id':_0x19cc45[_0x377c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e29f,null))[_0x377c('0x25')](saveUpdates(_0x19cc45[_0x377c('0x4e')],null))[_0x377c('0x25')](respondWithResult(_0x56e29f,null))[_0x377c('0x46')](handleError(_0x56e29f,null));};exports[_0x377c('0x55')]=function(_0x176be5,_0x334f17){return db[_0x377c('0x2e')][_0x377c('0x4c')]({'where':{'id':_0x176be5[_0x377c('0x48')]['id']}})[_0x377c('0x25')](handleEntityNotFound(_0x334f17,null))[_0x377c('0x25')](removeEntity(_0x334f17,null))['catch'](handleError(_0x334f17,null));};exports[_0x377c('0x56')]=function(_0x24c6f7,_0x2f40a3){var _0x3eab9a=0xa;var _0x155d54=[_0x377c('0x57'),'left_join',_0x377c('0x58'),_0x377c('0x59')];var _0x14a048={'SUM':_0x377c('0x5a'),'COUNT':_0x377c('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x377c('0x5c'),'MIN':_0x377c('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x377c('0x5e'),'GROUP_CONCAT ASC':_0x377c('0x5f'),'GROUP_CONCAT DESC':_0x377c('0x60')};var _0x338f9f={'SEC_TO_TIME':_0x377c('0x61'),'DATE':_0x377c('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x377c('0x63'),'UNIX_TIMESTAMP':_0x377c('0x64')};var _0x5b98a3=function(_0x197123){return!_[_0x377c('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x377c('0x66'),_0x377c('0x67')],_0x197123);};var _0x1453d4=function(_0xc49ace){if(!_0xc49ace||!_0xc49ace[_0x377c('0x68')]['length']){return'';}for(var _0x55bb57='(',_0x144626=0x0;_0x144626<_0xc49ace[_0x377c('0x68')][_0x377c('0x39')];_0x144626+=0x1){_0x144626>0x0&&(_0x55bb57+='\x20'+_0xc49ace[_0x377c('0x69')]+'\x20');_0x55bb57+=_0xc49ace['rules'][_0x144626][_0x377c('0x6a')]?_0x1453d4(_0xc49ace[_0x377c('0x68')][_0x144626][_0x377c('0x6a')]):_0xc49ace[_0x377c('0x68')][_0x144626][_0x377c('0x6b')]+'\x20'+_0xc49ace[_0x377c('0x68')][_0x144626][_0x377c('0x6c')]+(_0x5b98a3(_0xc49ace[_0x377c('0x68')][_0x144626][_0x377c('0x6c')])?'\x20'+_0xc49ace[_0x377c('0x68')][_0x144626]['value']:'');}return _0x55bb57+')';};var _0x39e43f={'where':{'id':_0x24c6f7[_0x377c('0x48')]['id']}},_0x501430,_0x41e0f9,_0x1e67d6,_0x4d8392,_0x55b69b;_0x39e43f=_[_0x377c('0x42')]({},_0x39e43f,_0x24c6f7[_0x377c('0x4b')]);return db['AnalyticDefaultReport']['find'](_0x39e43f)[_0x377c('0x25')](function(_0x85faab){if(_0x85faab){_0x501430=_0x85faab;return _0x85faab[_0x377c('0x6d')]();}return null;})['then'](function(_0x34e7d0){if(_0x34e7d0){if(!_0x34e7d0[_0x377c('0x39')]){throw new db['Sequelize'][(_0x377c('0x6e'))](_0x377c('0x6f'),0x193);}_0x41e0f9=_0x34e7d0;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x377c('0x25')](function(_0x496555){if(_0x496555){_0x1e67d6=_[_0x377c('0x70')](_0x496555,'id');var _0x37b146;var _0x37bcd1=squel[_0x377c('0x71')]();_0x37bcd1[_0x377c('0x72')](_0x501430[_0x377c('0x73')]);for(var _0x522461=0x0;_0x522461<_0x41e0f9[_0x377c('0x39')];_0x522461+=0x1){_0x37b146=_0x41e0f9[_0x522461][_0x377c('0x74')]?_0x1e67d6[_0x41e0f9[_0x522461][_0x377c('0x74')]]['metric']:_0x41e0f9[_0x522461][_0x377c('0x6b')];_0x37b146=_0x41e0f9[_0x522461][_0x377c('0x75')]?_[_0x377c('0x76')](_0x14a048[_0x41e0f9[_0x522461][_0x377c('0x75')]],'%s',_0x37b146):_0x37b146;_0x37b146=_0x41e0f9[_0x522461]['format']?_['replace'](_0x338f9f[_0x41e0f9[_0x522461]['format']],'%s',_0x37b146):_0x37b146;if(_0x41e0f9[_0x522461][_0x377c('0x77')]){_0x37bcd1[_0x377c('0x6a')](_0x37b146);}_0x41e0f9[_0x522461][_0x377c('0x78')]&&_0x37bcd1['order'](_0x37b146,_0x41e0f9[_0x522461][_0x377c('0x78')]===_0x377c('0x79')?![]:!![]);_0x37bcd1[_0x377c('0x6b')](_0x37b146,_0x41e0f9[_0x522461]['alias']||_0x37b146);}if(_0x501430[_0x377c('0x7a')]){_0x501430[_0x377c('0x7a')]=JSON[_0x377c('0x7b')](_0x501430[_0x377c('0x7a')]);for(var _0x4c8a84=0x0;_0x4c8a84<_0x501430[_0x377c('0x7a')][_0x377c('0x39')];_0x4c8a84+=0x1){if(_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x31')]&&_['includes'](_0x155d54,_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x31')])&&_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7c')]&&_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7d')]&&_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7e')]){_0x37bcd1[_0x501430['joins'][_0x4c8a84]['type']](_0x501430['joins'][_0x4c8a84][_0x377c('0x7d')],null,util['format'](_0x377c('0x7f'),_0x501430[_0x377c('0x73')],_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7c')],_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7d')],_0x501430[_0x377c('0x7a')][_0x4c8a84][_0x377c('0x7e')]));}}}if(_0x501430[_0x377c('0x80')]){_0x501430['conditions']=JSON[_0x377c('0x7b')](_0x501430[_0x377c('0x80')]);_0x37bcd1[_0x377c('0x41')](_0x1453d4(_0x501430['conditions']['group']));}_0x55b69b=_0x37bcd1['clone']();_0x37bcd1['limit'](_0x3eab9a);_0x37bcd1[_0x377c('0x1f')](0x0);logger[_0x377c('0x81')](_0x377c('0x82'),_0x37bcd1[_0x377c('0x83')]());return db[_0x377c('0x84')][_0x377c('0x34')](_0x37bcd1[_0x377c('0x83')](),{'type':db['sequelize'][_0x377c('0x85')][_0x377c('0x86')]});}})['then'](respondWithResult(_0x2f40a3,null))[_0x377c('0x46')](handleError(_0x2f40a3,null));};function runReport(_0x50ca8d,_0x826de,_0x41a9be){var _0x1f0df4=_0x826de['name'];var _0x533aa1=0xa;var _0x771006=[_0x377c('0x57'),'left_join',_0x377c('0x58'),_0x377c('0x59')];var _0x1da705={'SUM':'SUM(%s)','COUNT':_0x377c('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x377c('0x5c'),'MIN':_0x377c('0x5d'),'AVG':_0x377c('0x87'),'GROUP_CONCAT':_0x377c('0x5e'),'GROUP_CONCAT ASC':_0x377c('0x5f'),'GROUP_CONCAT DESC':_0x377c('0x60')};var _0x2ad0fd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x377c('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2439f5=function(_0x18e572){return!_[_0x377c('0x65')]([_0x377c('0x88'),_0x377c('0x89'),_0x377c('0x66'),_0x377c('0x67')],_0x18e572);};var _0x353bd4=function(_0x170f2f){if(!_0x170f2f||!_0x170f2f[_0x377c('0x68')][_0x377c('0x39')]){return'';}for(var _0x585a93='(',_0x13118f=0x0;_0x13118f<_0x170f2f[_0x377c('0x68')]['length'];_0x13118f+=0x1){_0x13118f>0x0&&(_0x585a93+='\x20'+_0x170f2f[_0x377c('0x69')]+'\x20');_0x585a93+=_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6a')]?_0x353bd4(_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6a')]):_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6b')]+'\x20'+_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6c')]+(_0x2439f5(_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x6c')])?'\x20'+_0x170f2f[_0x377c('0x68')][_0x13118f][_0x377c('0x8a')]:'');}return _0x585a93+')';};var _0x581be4={'where':{'id':_0x50ca8d['id']}},_0x34f22d,_0x4a15ce,_0x496207,_0x1b743f,_0xcf5bb6;_0x581be4=_[_0x377c('0x42')]({},_0x581be4,_0x41a9be);return db['AnalyticDefaultReport'][_0x377c('0x4c')](_0x581be4)['then'](function(_0x491aa1){if(_0x491aa1){_0x34f22d=_0x491aa1;return _0x491aa1[_0x377c('0x6d')]();}return null;})[_0x377c('0x25')](function(_0x20cca0){if(_0x20cca0){if(!_0x20cca0[_0x377c('0x39')]){throw new db[(_0x377c('0x8b'))][(_0x377c('0x6e'))](_0x377c('0x6f'),0x193);}_0x4a15ce=_0x20cca0;return db[_0x377c('0x8c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x55d2fe){if(_0x55d2fe){_0x496207=_['keyBy'](_0x55d2fe,'id');var _0x53b948;var _0x4486f6=squel[_0x377c('0x71')]();_0x4486f6['from'](_0x34f22d[_0x377c('0x73')]);for(var _0x2afe73=0x0;_0x2afe73<_0x4a15ce['length'];_0x2afe73+=0x1){_0x53b948=_0x4a15ce[_0x2afe73][_0x377c('0x74')]?_0x496207[_0x4a15ce[_0x2afe73]['MetricId']][_0x377c('0x8d')]:_0x4a15ce[_0x2afe73][_0x377c('0x6b')];_0x53b948=_0x4a15ce[_0x2afe73][_0x377c('0x75')]?_[_0x377c('0x76')](_0x1da705[_0x4a15ce[_0x2afe73]['function']],'%s',_0x53b948):_0x53b948;_0x53b948=_0x4a15ce[_0x2afe73][_0x377c('0x8e')]?_['replace'](_0x2ad0fd[_0x4a15ce[_0x2afe73][_0x377c('0x8e')]],'%s',_0x53b948):_0x53b948;if(_0x4a15ce[_0x2afe73][_0x377c('0x77')]){_0x4486f6['group'](_0x53b948);}_0x4a15ce[_0x2afe73][_0x377c('0x78')]&&_0x4486f6[_0x377c('0x3d')](_0x53b948,_0x4a15ce[_0x2afe73][_0x377c('0x78')]===_0x377c('0x79')?![]:!![]);_0x4486f6[_0x377c('0x6b')](_0x53b948,_0x4a15ce[_0x2afe73][_0x377c('0x8f')]||_0x53b948);}if(_0x34f22d[_0x377c('0x7a')]){_0x34f22d[_0x377c('0x7a')]=JSON[_0x377c('0x7b')](_0x34f22d[_0x377c('0x7a')]);for(var _0x10e8a3=0x0;_0x10e8a3<_0x34f22d['joins']['length'];_0x10e8a3+=0x1){if(_0x34f22d[_0x377c('0x7a')][_0x10e8a3]['type']&&_[_0x377c('0x65')](_0x771006,_0x34f22d[_0x377c('0x7a')][_0x10e8a3]['type'])&&_0x34f22d[_0x377c('0x7a')][_0x10e8a3][_0x377c('0x7c')]&&_0x34f22d[_0x377c('0x7a')][_0x10e8a3][_0x377c('0x7d')]&&_0x34f22d['joins'][_0x10e8a3][_0x377c('0x7e')]){_0x4486f6[_0x34f22d[_0x377c('0x7a')][_0x10e8a3][_0x377c('0x31')]](_0x34f22d[_0x377c('0x7a')][_0x10e8a3]['foreignTable'],null,util[_0x377c('0x8e')](_0x377c('0x7f'),_0x34f22d[_0x377c('0x73')],_0x34f22d[_0x377c('0x7a')][_0x10e8a3][_0x377c('0x7c')],_0x34f22d['joins'][_0x10e8a3][_0x377c('0x7d')],_0x34f22d[_0x377c('0x7a')][_0x10e8a3]['foreignKey']));}}}if(_0x34f22d['conditions']){_0x34f22d[_0x377c('0x80')]=JSON[_0x377c('0x7b')](_0x34f22d[_0x377c('0x80')]);_0x4486f6['where'](_0x353bd4(_0x34f22d[_0x377c('0x80')]['group']));}_0xcf5bb6=_0x4486f6[_0x377c('0x90')]();_0x4486f6['limit'](_0x533aa1);_0x4486f6['offset'](0x0);logger[_0x377c('0x81')](_0x377c('0x82'),_0x4486f6[_0x377c('0x83')]());return db['sequelize'][_0x377c('0x34')](_0x4486f6['toString'](),{'type':db[_0x377c('0x84')][_0x377c('0x85')][_0x377c('0x86')]});}})[_0x377c('0x25')](function(_0x6ab706){if(!_0x6ab706[_0x377c('0x39')]){throw new db['Sequelize'][(_0x377c('0x6e'))](_0x377c('0x91'),0xcc);}if(_0x826de[_0x377c('0x92')]===_0x377c('0x93')){return null;}var _0x31611b=_['merge'](_0x826de,{'name':_0x826de[_0x377c('0x94')]||_0x826de[_0x377c('0x2b')]||_0x34f22d[_0x377c('0x2b')],'basename':_0x1f0df4,'savename':util[_0x377c('0x8e')](_0x377c('0x95'),_0x826de['name']||_0x34f22d[_0x377c('0x2b')],require('randomstring')[_0x377c('0x96')](0x4),_0x826de['output']||_0x377c('0x97')),'reportId':_0x34f22d['id'],'reportType':_0x377c('0x98')});return db[_0x377c('0x99')][_0x377c('0x4d')](_0x31611b,{'raw':!![]});})[_0x377c('0x25')](function(_0xc49039){if(_0x34f22d[_0x377c('0x73')]==='cdr'){_0xcf5bb6['where'](_0x34f22d[_0x377c('0x73')]+_0x377c('0x9a'),_0x826de[_0x377c('0x9b')],_0x826de['endDate']);}else{_0xcf5bb6['where'](_0x34f22d[_0x377c('0x73')]+_0x377c('0x9c'),_0x826de[_0x377c('0x9b')],_0x826de['endDate']);}if(_0xc49039){logger[_0x377c('0x9d')]('Run\x20Query:',_0xcf5bb6['toString']());require(_0x377c('0x9e'))[_0x377c('0x9f')](path[_0x377c('0x57')](__dirname,_0x377c('0xa0'),_0xc49039['output']),[_0xc49039['id'],_0xcf5bb6[_0x377c('0x83')](),path[_0x377c('0x57')](__dirname,_0x377c('0xa1'),_0xc49039[_0x377c('0xa2')]),_0x1f0df4]);return _0xc49039;}else{var _0x398faf=squel['select']();_0x398faf[_0x377c('0x72')]('('+_0xcf5bb6['toString']()+')',_0x377c('0xa3'));_0x398faf[_0x377c('0x6b')](_0x377c('0xa4'),_0x377c('0x1e'));_0xcf5bb6['limit'](_0x826de[_0x377c('0x3c')]||_0x533aa1);_0xcf5bb6[_0x377c('0x1f')](_0x826de[_0x377c('0x1f')]||0x0);return dbH['sequelize'][_0x377c('0x34')](_0x398faf['toString'](),{'type':dbH['sequelize']['QueryTypes']['SELECT']})[_0x377c('0x25')](function(_0x1bb017){if(!_0x1bb017[_0x377c('0x39')]){_0x1b743f=0x0;}else{_0x1b743f=_0x1bb017[0x0]['count']||0x0;}return dbH[_0x377c('0x84')][_0x377c('0x34')](_0xcf5bb6[_0x377c('0x83')](),{'type':dbH[_0x377c('0x84')][_0x377c('0x85')][_0x377c('0x86')]});})['then'](function(_0x11e08e){return{'rows':_0x11e08e||[],'count':_0x1b743f};});}});}exports['run']=function(_0x118548,_0x501aed){return runReport(_0x118548['params'],_0x118548['query'],_0x118548['options'])[_0x377c('0x25')](respondWithResult(_0x501aed,null))['catch'](handleError(_0x501aed,null));};exports[_0x377c('0xa5')]=runReport;exports[_0x377c('0x34')]=function(_0x4493e0,_0x502bb8){var _0x5088a1=0xa;var _0x752f88=[_0x377c('0x57'),_0x377c('0xa6'),_0x377c('0x58'),_0x377c('0x59')];var _0x5932a1={'SUM':'SUM(%s)','COUNT':_0x377c('0x5b'),'COUNT DISTINCT':_0x377c('0xa7'),'MAX':_0x377c('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x377c('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x377c('0x60')};var _0x4351f3={'SEC_TO_TIME':_0x377c('0x61'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x377c('0x63'),'UNIX_TIMESTAMP':_0x377c('0x64')};var _0x354711=function(_0x4bbe27){return!_['includes']([_0x377c('0x88'),_0x377c('0x89'),_0x377c('0x66'),_0x377c('0x67')],_0x4bbe27);};var _0x3969b1=function(_0x4c9c00){if(!_0x4c9c00||!_0x4c9c00[_0x377c('0x68')][_0x377c('0x39')]){return'';}for(var _0x41bbdc='(',_0x288f0a=0x0;_0x288f0a<_0x4c9c00[_0x377c('0x68')][_0x377c('0x39')];_0x288f0a+=0x1){_0x288f0a>0x0&&(_0x41bbdc+='\x20'+_0x4c9c00[_0x377c('0x69')]+'\x20');_0x41bbdc+=_0x4c9c00['rules'][_0x288f0a][_0x377c('0x6a')]?_0x3969b1(_0x4c9c00[_0x377c('0x68')][_0x288f0a][_0x377c('0x6a')]):_0x4c9c00['rules'][_0x288f0a][_0x377c('0x6b')]+'\x20'+_0x4c9c00[_0x377c('0x68')][_0x288f0a][_0x377c('0x6c')]+(_0x354711(_0x4c9c00[_0x377c('0x68')][_0x288f0a][_0x377c('0x6c')])?'\x20'+_0x4c9c00[_0x377c('0x68')][_0x288f0a][_0x377c('0x8a')]:'');}return _0x41bbdc+')';};var _0x35cc94={'where':{'id':_0x4493e0[_0x377c('0x48')]['id']}},_0xa4b420,_0x5cf420,_0x475041,_0x59c785,_0x41d49e;_0x35cc94=_[_0x377c('0x42')]({},_0x35cc94,_0x4493e0[_0x377c('0x4b')]);return db[_0x377c('0x2e')][_0x377c('0x4c')](_0x35cc94)[_0x377c('0x25')](function(_0x307bc5){if(_0x307bc5){_0xa4b420=_0x307bc5;return _0x307bc5[_0x377c('0x6d')]();}return null;})[_0x377c('0x25')](function(_0x1cb7cb){if(_0x1cb7cb){if(!_0x1cb7cb[_0x377c('0x39')]){throw new db[(_0x377c('0x8b'))][(_0x377c('0x6e'))](_0x377c('0x6f'),0x193);}_0x5cf420=_0x1cb7cb;return db['AnalyticMetric'][_0x377c('0xa8')]({'raw':!![]});}return null;})[_0x377c('0x25')](function(_0x2f4df3){if(_0x2f4df3){_0x475041=_[_0x377c('0x70')](_0x2f4df3,'id');var _0x42f49a;var _0x37d9f9=squel[_0x377c('0x71')]();_0x37d9f9[_0x377c('0x72')](_0xa4b420['table']);for(var _0x3620cc=0x0;_0x3620cc<_0x5cf420[_0x377c('0x39')];_0x3620cc+=0x1){_0x42f49a=_0x5cf420[_0x3620cc][_0x377c('0x74')]?_0x475041[_0x5cf420[_0x3620cc][_0x377c('0x74')]][_0x377c('0x8d')]:_0x5cf420[_0x3620cc][_0x377c('0x6b')];_0x42f49a=_0x5cf420[_0x3620cc][_0x377c('0x75')]?_[_0x377c('0x76')](_0x5932a1[_0x5cf420[_0x3620cc]['function']],'%s',_0x42f49a):_0x42f49a;_0x42f49a=_0x5cf420[_0x3620cc][_0x377c('0x8e')]?_['replace'](_0x4351f3[_0x5cf420[_0x3620cc][_0x377c('0x8e')]],'%s',_0x42f49a):_0x42f49a;if(_0x5cf420[_0x3620cc][_0x377c('0x77')]){_0x37d9f9[_0x377c('0x6a')](_0x42f49a);}_0x5cf420[_0x3620cc][_0x377c('0x78')]&&_0x37d9f9[_0x377c('0x3d')](_0x42f49a,_0x5cf420[_0x3620cc]['orderBy']===_0x377c('0x79')?![]:!![]);_0x37d9f9[_0x377c('0x6b')](_0x42f49a,_0x5cf420[_0x3620cc][_0x377c('0x8f')]||_0x42f49a);}if(_0xa4b420['joins']){_0xa4b420[_0x377c('0x7a')]=JSON[_0x377c('0x7b')](_0xa4b420[_0x377c('0x7a')]);for(var _0x27dc39=0x0;_0x27dc39<_0xa4b420[_0x377c('0x7a')]['length'];_0x27dc39+=0x1){if(_0xa4b420[_0x377c('0x7a')][_0x27dc39]['type']&&_[_0x377c('0x65')](_0x752f88,_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x31')])&&_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7c')]&&_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7d')]&&_0xa4b420[_0x377c('0x7a')][_0x27dc39]['foreignKey']){_0x37d9f9[_0xa4b420['joins'][_0x27dc39][_0x377c('0x31')]](_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7d')],null,util[_0x377c('0x8e')]('%s.%s\x20=\x20%s.%s',_0xa4b420['table'],_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7c')],_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7d')],_0xa4b420[_0x377c('0x7a')][_0x27dc39][_0x377c('0x7e')]));}}}if(_0xa4b420['conditions']){_0xa4b420[_0x377c('0x80')]=JSON[_0x377c('0x7b')](_0xa4b420[_0x377c('0x80')]);_0x37d9f9[_0x377c('0x41')](_0x3969b1(_0xa4b420[_0x377c('0x80')]['group']));}_0x41d49e=_0x37d9f9[_0x377c('0x90')]();_0x37d9f9[_0x377c('0x3c')](_0x5088a1);_0x37d9f9[_0x377c('0x1f')](0x0);logger[_0x377c('0x81')](_0x377c('0x82'),_0x37d9f9[_0x377c('0x83')]());return db[_0x377c('0x84')]['query'](_0x37d9f9[_0x377c('0x83')](),{'type':db[_0x377c('0x84')][_0x377c('0x85')][_0x377c('0x86')]});}})['then'](function(){return{'sql':_0x41d49e[_0x377c('0x83')]()};})['then'](respondWithResult(_0x502bb8,null))[_0x377c('0x46')](handleError(_0x502bb8,null));}; \ No newline at end of file +var _0xbf8f=['../../config/utils','../../config/environment','../../mysqldb','dbH','status','json','count','offset','limit','set','apply','update','then','DefaultReports','UserProfileResource','destroy','end','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','catch','show','params','create','role','user','get','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','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','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','order','DESC','joins','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','left_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','field','getFields','AnalyticMetric','No\x20available\x20data','web','fullPath','%s-%s.%s','randomstring','output','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','alias','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','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'];(function(_0x236607,_0x37f8e9){var _0x1a4b1e=function(_0x3b24ce){while(--_0x3b24ce){_0x236607['push'](_0x236607['shift']());}};_0x1a4b1e(++_0x37f8e9);}(_0xbf8f,0x1d5));var _0xfbf8=function(_0x897491,_0x45bccd){_0x897491=_0x897491-0x0;var _0x11e409=_0xbf8f[_0x897491];return _0x11e409;};'use strict';var pdf=require(_0xfbf8('0x0'));var emlformat=require(_0xfbf8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfbf8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbf8('0x3'));var moment=require(_0xfbf8('0x4'));var BPromise=require(_0xfbf8('0x5'));var Mustache=require(_0xfbf8('0x6'));var util=require(_0xfbf8('0x7'));var path=require(_0xfbf8('0x8'));var sox=require('sox');var csv=require(_0xfbf8('0x9'));var ejs=require(_0xfbf8('0xa'));var fs=require('fs');var _=require(_0xfbf8('0xb'));var squel=require(_0xfbf8('0xc'));var crypto=require('crypto');var jsforce=require(_0xfbf8('0xd'));var deskjs=require(_0xfbf8('0xe'));var toCsv=require(_0xfbf8('0x9'));var querystring=require(_0xfbf8('0xf'));var Papa=require(_0xfbf8('0x10'));var Redis=require(_0xfbf8('0x11'));var authService=require(_0xfbf8('0x12'));var qs=require(_0xfbf8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbf8('0x14'));var logger=require(_0xfbf8('0x15'))(_0xfbf8('0x16'));var utils=require(_0xfbf8('0x17'));var config=require(_0xfbf8('0x18'));var db=require(_0xfbf8('0x19'))['db'];var dbH=require(_0xfbf8('0x19'))[_0xfbf8('0x1a')];function respondWithStatusCode(_0x85595,_0x42fe75){_0x42fe75=_0x42fe75||0xcc;return function(_0x5bdc53){if(_0x5bdc53){return _0x85595['sendStatus'](_0x42fe75);}return _0x85595[_0xfbf8('0x1b')](_0x42fe75)['end']();};}function respondWithResult(_0x64e40e,_0x218f57){_0x218f57=_0x218f57||0xc8;return function(_0x222724){if(_0x222724){return _0x64e40e[_0xfbf8('0x1b')](_0x218f57)[_0xfbf8('0x1c')](_0x222724);}};}function respondWithFilteredResult(_0x45cd6d,_0x17be8a){return function(_0x1ed407){if(_0x1ed407){var _0x21c8a2=_0x1ed407[_0xfbf8('0x1d')],_0x57fae7=_0x17be8a[_0xfbf8('0x1e')],_0x151dc0=_0x17be8a[_0xfbf8('0x1e')]+_0x17be8a[_0xfbf8('0x1f')],_0x511d4f;if(_0x151dc0>=_0x21c8a2){_0x151dc0=_0x21c8a2;_0x511d4f=0xc8;}else{_0x511d4f=0xce;}_0x45cd6d[_0xfbf8('0x1b')](_0x511d4f);return _0x45cd6d[_0xfbf8('0x20')]('Content-Range',_0x57fae7+'-'+_0x151dc0+'/'+_0x21c8a2)[_0xfbf8('0x1c')](_0x1ed407);}return null;};}function patchUpdates(_0x3c043f){return function(_0x204c75){try{jsonpatch[_0xfbf8('0x21')](_0x204c75,_0x3c043f,!![]);}catch(_0x10ac77){return BPromise['reject'](_0x10ac77);}return _0x204c75['save']();};}function saveUpdates(_0x4a16b2,_0x3c70c8){return function(_0x1ded2e){if(_0x1ded2e){return _0x1ded2e[_0xfbf8('0x22')](_0x4a16b2)['then'](function(_0x1af464){return _0x1af464;});}return null;};}function removeEntity(_0x2ef67c,_0x240beb){return function(_0x499a97){if(_0x499a97){return _0x499a97['destroy']()[_0xfbf8('0x23')](function(){var _0x787f48=_0x499a97['get']({'plain':!![]});var _0x5c7e54=_0xfbf8('0x24');return db[_0xfbf8('0x25')][_0xfbf8('0x26')]({'where':{'type':_0x5c7e54,'resourceId':_0x787f48['id']}})[_0xfbf8('0x23')](function(){return _0x499a97;});})[_0xfbf8('0x23')](function(){_0x2ef67c[_0xfbf8('0x1b')](0xcc)[_0xfbf8('0x27')]();});}};}function handleEntityNotFound(_0x53b44c,_0x3f1cb2){return function(_0x214053){if(!_0x214053){_0x53b44c[_0xfbf8('0x28')](0x194);}return _0x214053;};}function handleError(_0x314e93,_0x59045a){_0x59045a=_0x59045a||0x1f4;return function(_0xe747ca){logger[_0xfbf8('0x29')](_0xe747ca['stack']);if(_0xe747ca[_0xfbf8('0x2a')]){delete _0xe747ca[_0xfbf8('0x2a')];}_0x314e93[_0xfbf8('0x1b')](_0x59045a)[_0xfbf8('0x2b')](_0xe747ca);};}exports[_0xfbf8('0x2c')]=function(_0x5aa9ad,_0x44ef33){var _0x532f2b={},_0x3544d9={},_0x574717={'count':0x0,'rows':[]};var _0x1653d1=_[_0xfbf8('0x2d')](db[_0xfbf8('0x2e')][_0xfbf8('0x2f')],function(_0x56ac28){return{'name':_0x56ac28['fieldName'],'type':_0x56ac28['type']['key']};});_0x3544d9[_0xfbf8('0x30')]=_[_0xfbf8('0x2d')](_0x1653d1,_0xfbf8('0x2a'));_0x3544d9[_0xfbf8('0x31')]=_[_0xfbf8('0x32')](_0x5aa9ad[_0xfbf8('0x31')]);_0x3544d9[_0xfbf8('0x33')]=_[_0xfbf8('0x34')](_0x3544d9['model'],_0x3544d9['query']);_0x532f2b[_0xfbf8('0x35')]=_[_0xfbf8('0x34')](_0x3544d9[_0xfbf8('0x30')],qs[_0xfbf8('0x36')](_0x5aa9ad['query'][_0xfbf8('0x36')]));_0x532f2b[_0xfbf8('0x35')]=_0x532f2b[_0xfbf8('0x35')][_0xfbf8('0x37')]?_0x532f2b['attributes']:_0x3544d9['model'];if(!_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x38')](_0xfbf8('0x39'))){_0x532f2b['limit']=qs[_0xfbf8('0x1f')](_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x1f')]);_0x532f2b[_0xfbf8('0x1e')]=qs[_0xfbf8('0x1e')](_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x1e')]);}_0x532f2b['order']=qs[_0xfbf8('0x3a')](_0x5aa9ad[_0xfbf8('0x31')]['sort']);_0x532f2b['where']=qs['filters'](_[_0xfbf8('0x3b')](_0x5aa9ad[_0xfbf8('0x31')],_0x3544d9[_0xfbf8('0x33')]),_0x1653d1);if(_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x3c')]){_0x532f2b[_0xfbf8('0x3d')]=_['merge'](_0x532f2b[_0xfbf8('0x3d')],{'$or':_['map'](_0x1653d1,function(_0x1f4f0c){if(_0x1f4f0c[_0xfbf8('0x3e')]!=='VIRTUAL'){var _0x4d86cf={};_0x4d86cf[_0x1f4f0c[_0xfbf8('0x2a')]]={'$like':'%'+_0x5aa9ad[_0xfbf8('0x31')][_0xfbf8('0x3c')]+'%'};return _0x4d86cf;}})});}_0x532f2b=_[_0xfbf8('0x3f')]({},_0x532f2b,_0x5aa9ad[_0xfbf8('0x40')]);var _0x200dc5={'where':_0x532f2b['where']};return db['AnalyticDefaultReport'][_0xfbf8('0x1d')](_0x200dc5)['then'](function(_0xb2091a){_0x574717[_0xfbf8('0x1d')]=_0xb2091a;if(_0x5aa9ad['query'][_0xfbf8('0x41')]){_0x532f2b[_0xfbf8('0x42')]=[{'all':!![]}];}return db[_0xfbf8('0x2e')][_0xfbf8('0x43')](_0x532f2b);})[_0xfbf8('0x23')](function(_0xaea4eb){_0x574717[_0xfbf8('0x44')]=_0xaea4eb;return _0x574717;})[_0xfbf8('0x23')](respondWithFilteredResult(_0x44ef33,_0x532f2b))[_0xfbf8('0x45')](handleError(_0x44ef33,null));};exports[_0xfbf8('0x46')]=function(_0x579490,_0x368d5b){var _0x432da6={'raw':!![],'where':{'id':_0x579490[_0xfbf8('0x47')]['id']}},_0x152852={};_0x152852[_0xfbf8('0x30')]=_[_0xfbf8('0x32')](db[_0xfbf8('0x2e')][_0xfbf8('0x2f')]);_0x152852[_0xfbf8('0x31')]=_['keys'](_0x579490[_0xfbf8('0x31')]);_0x152852['filters']=_['intersection'](_0x152852[_0xfbf8('0x30')],_0x152852[_0xfbf8('0x31')]);_0x432da6[_0xfbf8('0x35')]=_['intersection'](_0x152852[_0xfbf8('0x30')],qs['fields'](_0x579490[_0xfbf8('0x31')][_0xfbf8('0x36')]));_0x432da6[_0xfbf8('0x35')]=_0x432da6[_0xfbf8('0x35')][_0xfbf8('0x37')]?_0x432da6['attributes']:_0x152852[_0xfbf8('0x30')];if(_0x579490[_0xfbf8('0x31')]['includeAll']){_0x432da6[_0xfbf8('0x42')]=[{'all':!![]}];}_0x432da6=_[_0xfbf8('0x3f')]({},_0x432da6,_0x579490[_0xfbf8('0x40')]);return db[_0xfbf8('0x2e')]['find'](_0x432da6)[_0xfbf8('0x23')](handleEntityNotFound(_0x368d5b,null))[_0xfbf8('0x23')](respondWithResult(_0x368d5b,null))['catch'](handleError(_0x368d5b,null));};exports[_0xfbf8('0x48')]=function(_0x3bf793,_0x57a930){return db[_0xfbf8('0x2e')][_0xfbf8('0x48')](_0x3bf793['body'],{})[_0xfbf8('0x23')](function(_0x3b0b97){var _0x21239b=_0x3bf793['user']['get']({'plain':!![]});if(!_0x21239b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21239b[_0xfbf8('0x49')]===_0xfbf8('0x4a')){var _0x4a4ee6=_0x3b0b97[_0xfbf8('0x4b')]({'plain':!![]});var _0x45abf3=_0xfbf8('0x4c');return db[_0xfbf8('0x4d')][_0xfbf8('0x4e')]({'where':{'name':_0x45abf3,'userProfileId':_0x21239b[_0xfbf8('0x4f')]},'raw':!![]})['then'](function(_0xfcbfe3){if(_0xfcbfe3&&_0xfcbfe3[_0xfbf8('0x50')]===0x0){return db['UserProfileResource'][_0xfbf8('0x48')]({'name':_0x4a4ee6['name'],'resourceId':_0x4a4ee6['id'],'type':_0xfbf8('0x24'),'sectionId':_0xfcbfe3['id']},{})[_0xfbf8('0x23')](function(){return _0x3b0b97;});}else{return _0x3b0b97;}})[_0xfbf8('0x45')](function(_0x57cee1){logger[_0xfbf8('0x29')](_0xfbf8('0x51'),_0x57cee1);throw _0x57cee1;});}return _0x3b0b97;})[_0xfbf8('0x23')](respondWithResult(_0x57a930,0xc9))[_0xfbf8('0x45')](handleError(_0x57a930,null));};exports[_0xfbf8('0x22')]=function(_0x56e079,_0x1e1e3e){if(_0x56e079[_0xfbf8('0x52')]['id']){delete _0x56e079['body']['id'];}return db[_0xfbf8('0x2e')]['find']({'where':{'id':_0x56e079[_0xfbf8('0x47')]['id']}})[_0xfbf8('0x23')](handleEntityNotFound(_0x1e1e3e,null))[_0xfbf8('0x23')](saveUpdates(_0x56e079['body'],null))[_0xfbf8('0x23')](respondWithResult(_0x1e1e3e,null))['catch'](handleError(_0x1e1e3e,null));};exports[_0xfbf8('0x26')]=function(_0x5bb6fb,_0x30de3a){return db[_0xfbf8('0x2e')][_0xfbf8('0x4e')]({'where':{'id':_0x5bb6fb[_0xfbf8('0x47')]['id']}})[_0xfbf8('0x23')](handleEntityNotFound(_0x30de3a,null))[_0xfbf8('0x23')](removeEntity(_0x30de3a,null))[_0xfbf8('0x45')](handleError(_0x30de3a,null));};exports[_0xfbf8('0x53')]=function(_0x5bd0c8,_0x58f2b0){var _0x1753d8=0xa;var _0x115507=[_0xfbf8('0x54'),'left_join',_0xfbf8('0x55'),'cross_join'];var _0x3ff7f5={'SUM':_0xfbf8('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xfbf8('0x57'),'MAX':_0xfbf8('0x58'),'MIN':'MIN(%s)','AVG':_0xfbf8('0x59'),'GROUP_CONCAT':_0xfbf8('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xfbf8('0x5b')};var _0x2aa333={'SEC_TO_TIME':_0xfbf8('0x5c'),'DATE':_0xfbf8('0x5d'),'HOUR':_0xfbf8('0x5e'),'ROUND':_0xfbf8('0x5f'),'UNIX_TIMESTAMP':_0xfbf8('0x60')};var _0x1236c3=function(_0x1cf83c){return!_['includes']([_0xfbf8('0x61'),_0xfbf8('0x62'),_0xfbf8('0x63'),_0xfbf8('0x64')],_0x1cf83c);};var _0x3ec0db=function(_0x4f9f55){if(!_0x4f9f55||!_0x4f9f55[_0xfbf8('0x65')][_0xfbf8('0x37')]){return'';}for(var _0x317bee='(',_0x46585b=0x0;_0x46585b<_0x4f9f55['rules'][_0xfbf8('0x37')];_0x46585b+=0x1){_0x46585b>0x0&&(_0x317bee+='\x20'+_0x4f9f55[_0xfbf8('0x66')]+'\x20');_0x317bee+=_0x4f9f55[_0xfbf8('0x65')][_0x46585b][_0xfbf8('0x67')]?_0x3ec0db(_0x4f9f55[_0xfbf8('0x65')][_0x46585b]['group']):_0x4f9f55['rules'][_0x46585b]['field']+'\x20'+_0x4f9f55[_0xfbf8('0x65')][_0x46585b][_0xfbf8('0x68')]+(_0x1236c3(_0x4f9f55[_0xfbf8('0x65')][_0x46585b][_0xfbf8('0x68')])?'\x20'+_0x4f9f55[_0xfbf8('0x65')][_0x46585b][_0xfbf8('0x69')]:'');}return _0x317bee+')';};var _0x5470ea={'where':{'id':_0x5bd0c8[_0xfbf8('0x47')]['id']}},_0x685c5b,_0x48d0fa,_0x1d57d5,_0x46fdce,_0x5aed57;_0x5470ea=_[_0xfbf8('0x3f')]({},_0x5470ea,_0x5bd0c8[_0xfbf8('0x40')]);return db[_0xfbf8('0x2e')][_0xfbf8('0x4e')](_0x5470ea)[_0xfbf8('0x23')](function(_0x215ae3){if(_0x215ae3){_0x685c5b=_0x215ae3;return _0x215ae3['getFields']();}return null;})['then'](function(_0x1334f5){if(_0x1334f5){if(!_0x1334f5[_0xfbf8('0x37')]){throw new db[(_0xfbf8('0x6a'))][(_0xfbf8('0x6b'))](_0xfbf8('0x6c'),0x193);}_0x48d0fa=_0x1334f5;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xfbf8('0x23')](function(_0x1d2d87){if(_0x1d2d87){_0x1d57d5=_[_0xfbf8('0x6d')](_0x1d2d87,'id');var _0x535b81;var _0x14fc63=squel[_0xfbf8('0x6e')]();_0x14fc63[_0xfbf8('0x6f')](_0x685c5b[_0xfbf8('0x70')]);for(var _0x1233e8=0x0;_0x1233e8<_0x48d0fa[_0xfbf8('0x37')];_0x1233e8+=0x1){_0x535b81=_0x48d0fa[_0x1233e8][_0xfbf8('0x71')]?_0x1d57d5[_0x48d0fa[_0x1233e8][_0xfbf8('0x71')]][_0xfbf8('0x72')]:_0x48d0fa[_0x1233e8]['field'];_0x535b81=_0x48d0fa[_0x1233e8]['function']?_[_0xfbf8('0x73')](_0x3ff7f5[_0x48d0fa[_0x1233e8][_0xfbf8('0x74')]],'%s',_0x535b81):_0x535b81;_0x535b81=_0x48d0fa[_0x1233e8][_0xfbf8('0x75')]?_[_0xfbf8('0x73')](_0x2aa333[_0x48d0fa[_0x1233e8][_0xfbf8('0x75')]],'%s',_0x535b81):_0x535b81;if(_0x48d0fa[_0x1233e8][_0xfbf8('0x76')]){_0x14fc63[_0xfbf8('0x67')](_0x535b81);}_0x48d0fa[_0x1233e8][_0xfbf8('0x77')]&&_0x14fc63[_0xfbf8('0x78')](_0x535b81,_0x48d0fa[_0x1233e8]['orderBy']===_0xfbf8('0x79')?![]:!![]);_0x14fc63['field'](_0x535b81,_0x48d0fa[_0x1233e8]['alias']||_0x535b81);}if(_0x685c5b[_0xfbf8('0x7a')]){_0x685c5b[_0xfbf8('0x7a')]=JSON['parse'](_0x685c5b['joins']);for(var _0x4b0bf5=0x0;_0x4b0bf5<_0x685c5b[_0xfbf8('0x7a')][_0xfbf8('0x37')];_0x4b0bf5+=0x1){if(_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x3e')]&&_[_0xfbf8('0x7b')](_0x115507,_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x3e')])&&_0x685c5b['joins'][_0x4b0bf5][_0xfbf8('0x7c')]&&_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x7d')]&&_0x685c5b['joins'][_0x4b0bf5]['foreignKey']){_0x14fc63[_0x685c5b['joins'][_0x4b0bf5]['type']](_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x7d')],null,util[_0xfbf8('0x75')](_0xfbf8('0x7e'),_0x685c5b['table'],_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x7c')],_0x685c5b['joins'][_0x4b0bf5][_0xfbf8('0x7d')],_0x685c5b[_0xfbf8('0x7a')][_0x4b0bf5][_0xfbf8('0x7f')]));}}}if(_0x685c5b['conditions']){_0x685c5b[_0xfbf8('0x80')]=JSON[_0xfbf8('0x81')](_0x685c5b[_0xfbf8('0x80')]);_0x14fc63[_0xfbf8('0x3d')](_0x3ec0db(_0x685c5b[_0xfbf8('0x80')][_0xfbf8('0x67')]));}_0x5aed57=_0x14fc63[_0xfbf8('0x82')]();_0x14fc63[_0xfbf8('0x1f')](_0x1753d8);_0x14fc63['offset'](0x0);logger[_0xfbf8('0x83')](_0xfbf8('0x84'),_0x14fc63['toString']());return db[_0xfbf8('0x85')][_0xfbf8('0x31')](_0x14fc63[_0xfbf8('0x86')](),{'type':db[_0xfbf8('0x85')][_0xfbf8('0x87')][_0xfbf8('0x88')]});}})[_0xfbf8('0x23')](respondWithResult(_0x58f2b0,null))[_0xfbf8('0x45')](handleError(_0x58f2b0,null));};function runReport(_0x5dad78,_0x284579,_0x173118){var _0x25b3d8=_0x284579[_0xfbf8('0x2a')];var _0xf3aa95=0xa;var _0x26d0d0=[_0xfbf8('0x54'),_0xfbf8('0x89'),_0xfbf8('0x55'),_0xfbf8('0x8a')];var _0x5bb72f={'SUM':'SUM(%s)','COUNT':_0xfbf8('0x8b'),'COUNT DISTINCT':_0xfbf8('0x57'),'MAX':_0xfbf8('0x58'),'MIN':_0xfbf8('0x8c'),'AVG':_0xfbf8('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xfbf8('0x8d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xc7b9b8={'SEC_TO_TIME':_0xfbf8('0x5c'),'DATE':'DATE(%s)','HOUR':_0xfbf8('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfbf8('0x60')};var _0x767563=function(_0x1a2ee2){return!_[_0xfbf8('0x7b')]([_0xfbf8('0x61'),'IS\x20NOT\x20NULL',_0xfbf8('0x63'),_0xfbf8('0x64')],_0x1a2ee2);};var _0x4c01d7=function(_0x1bc5c4){if(!_0x1bc5c4||!_0x1bc5c4[_0xfbf8('0x65')][_0xfbf8('0x37')]){return'';}for(var _0x446146='(',_0x40e7f4=0x0;_0x40e7f4<_0x1bc5c4[_0xfbf8('0x65')][_0xfbf8('0x37')];_0x40e7f4+=0x1){_0x40e7f4>0x0&&(_0x446146+='\x20'+_0x1bc5c4[_0xfbf8('0x66')]+'\x20');_0x446146+=_0x1bc5c4['rules'][_0x40e7f4][_0xfbf8('0x67')]?_0x4c01d7(_0x1bc5c4['rules'][_0x40e7f4][_0xfbf8('0x67')]):_0x1bc5c4[_0xfbf8('0x65')][_0x40e7f4][_0xfbf8('0x8e')]+'\x20'+_0x1bc5c4['rules'][_0x40e7f4]['condition']+(_0x767563(_0x1bc5c4[_0xfbf8('0x65')][_0x40e7f4][_0xfbf8('0x68')])?'\x20'+_0x1bc5c4[_0xfbf8('0x65')][_0x40e7f4][_0xfbf8('0x69')]:'');}return _0x446146+')';};var _0xca66fd={'where':{'id':_0x5dad78['id']}},_0x3486b2,_0x63a69,_0x500cc6,_0x3ee4bd,_0xad4c12;_0xca66fd=_['merge']({},_0xca66fd,_0x173118);return db[_0xfbf8('0x2e')][_0xfbf8('0x4e')](_0xca66fd)[_0xfbf8('0x23')](function(_0x3cf7a1){if(_0x3cf7a1){_0x3486b2=_0x3cf7a1;return _0x3cf7a1[_0xfbf8('0x8f')]();}return null;})[_0xfbf8('0x23')](function(_0x29fb49){if(_0x29fb49){if(!_0x29fb49['length']){throw new db[(_0xfbf8('0x6a'))][(_0xfbf8('0x6b'))](_0xfbf8('0x6c'),0x193);}_0x63a69=_0x29fb49;return db[_0xfbf8('0x90')][_0xfbf8('0x43')]({'raw':!![]});}return null;})[_0xfbf8('0x23')](function(_0x27ce98){if(_0x27ce98){_0x500cc6=_[_0xfbf8('0x6d')](_0x27ce98,'id');var _0x39b94c;var _0x3caf14=squel[_0xfbf8('0x6e')]();_0x3caf14['from'](_0x3486b2[_0xfbf8('0x70')]);for(var _0x4e363e=0x0;_0x4e363e<_0x63a69['length'];_0x4e363e+=0x1){_0x39b94c=_0x63a69[_0x4e363e]['MetricId']?_0x500cc6[_0x63a69[_0x4e363e][_0xfbf8('0x71')]]['metric']:_0x63a69[_0x4e363e][_0xfbf8('0x8e')];_0x39b94c=_0x63a69[_0x4e363e][_0xfbf8('0x74')]?_[_0xfbf8('0x73')](_0x5bb72f[_0x63a69[_0x4e363e][_0xfbf8('0x74')]],'%s',_0x39b94c):_0x39b94c;_0x39b94c=_0x63a69[_0x4e363e]['format']?_[_0xfbf8('0x73')](_0xc7b9b8[_0x63a69[_0x4e363e][_0xfbf8('0x75')]],'%s',_0x39b94c):_0x39b94c;if(_0x63a69[_0x4e363e][_0xfbf8('0x76')]){_0x3caf14['group'](_0x39b94c);}_0x63a69[_0x4e363e]['orderBy']&&_0x3caf14[_0xfbf8('0x78')](_0x39b94c,_0x63a69[_0x4e363e][_0xfbf8('0x77')]===_0xfbf8('0x79')?![]:!![]);_0x3caf14[_0xfbf8('0x8e')](_0x39b94c,_0x63a69[_0x4e363e]['alias']||_0x39b94c);}if(_0x3486b2[_0xfbf8('0x7a')]){_0x3486b2[_0xfbf8('0x7a')]=JSON[_0xfbf8('0x81')](_0x3486b2[_0xfbf8('0x7a')]);for(var _0x350e67=0x0;_0x350e67<_0x3486b2[_0xfbf8('0x7a')][_0xfbf8('0x37')];_0x350e67+=0x1){if(_0x3486b2[_0xfbf8('0x7a')][_0x350e67][_0xfbf8('0x3e')]&&_[_0xfbf8('0x7b')](_0x26d0d0,_0x3486b2[_0xfbf8('0x7a')][_0x350e67][_0xfbf8('0x3e')])&&_0x3486b2[_0xfbf8('0x7a')][_0x350e67][_0xfbf8('0x7c')]&&_0x3486b2[_0xfbf8('0x7a')][_0x350e67]['foreignTable']&&_0x3486b2[_0xfbf8('0x7a')][_0x350e67]['foreignKey']){_0x3caf14[_0x3486b2['joins'][_0x350e67][_0xfbf8('0x3e')]](_0x3486b2[_0xfbf8('0x7a')][_0x350e67]['foreignTable'],null,util[_0xfbf8('0x75')]('%s.%s\x20=\x20%s.%s',_0x3486b2[_0xfbf8('0x70')],_0x3486b2['joins'][_0x350e67][_0xfbf8('0x7c')],_0x3486b2[_0xfbf8('0x7a')][_0x350e67]['foreignTable'],_0x3486b2[_0xfbf8('0x7a')][_0x350e67][_0xfbf8('0x7f')]));}}}if(_0x3486b2[_0xfbf8('0x80')]){_0x3486b2['conditions']=JSON['parse'](_0x3486b2[_0xfbf8('0x80')]);_0x3caf14[_0xfbf8('0x3d')](_0x4c01d7(_0x3486b2[_0xfbf8('0x80')]['group']));}_0xad4c12=_0x3caf14[_0xfbf8('0x82')]();_0x3caf14[_0xfbf8('0x1f')](_0xf3aa95);_0x3caf14[_0xfbf8('0x1e')](0x0);logger[_0xfbf8('0x83')]('Limited\x20Query:',_0x3caf14[_0xfbf8('0x86')]());return db[_0xfbf8('0x85')]['query'](_0x3caf14[_0xfbf8('0x86')](),{'type':db[_0xfbf8('0x85')][_0xfbf8('0x87')]['SELECT']});}})[_0xfbf8('0x23')](function(_0x182b72){if(!_0x182b72['length']){throw new db['Sequelize'][(_0xfbf8('0x6b'))](_0xfbf8('0x91'),0xcc);}if(_0x284579['output']===_0xfbf8('0x92')){return null;}var _0xdcf7cc=_[_0xfbf8('0x3f')](_0x284579,{'name':_0x284579[_0xfbf8('0x93')]||_0x284579[_0xfbf8('0x2a')]||_0x3486b2[_0xfbf8('0x2a')],'basename':_0x25b3d8,'savename':util['format'](_0xfbf8('0x94'),_0x284579[_0xfbf8('0x2a')]||_0x3486b2['name'],require(_0xfbf8('0x95'))['generate'](0x4),_0x284579[_0xfbf8('0x96')]||'csv'),'reportId':_0x3486b2['id'],'reportType':'default'});return db[_0xfbf8('0x97')]['create'](_0xdcf7cc,{'raw':!![]});})[_0xfbf8('0x23')](function(_0x58de95){if(_0x3486b2[_0xfbf8('0x70')]==='cdr'){_0xad4c12[_0xfbf8('0x3d')](_0x3486b2['table']+_0xfbf8('0x98'),_0x284579[_0xfbf8('0x99')],_0x284579[_0xfbf8('0x9a')]);}else{_0xad4c12[_0xfbf8('0x3d')](_0x3486b2['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x284579[_0xfbf8('0x99')],_0x284579[_0xfbf8('0x9a')]);}if(_0x58de95){logger[_0xfbf8('0x9b')]('Run\x20Query:',_0xad4c12[_0xfbf8('0x86')]());require('child_process')[_0xfbf8('0x9c')](path[_0xfbf8('0x54')](__dirname,_0xfbf8('0x9d'),_0x58de95[_0xfbf8('0x96')]),[_0x58de95['id'],_0xad4c12[_0xfbf8('0x86')](),path[_0xfbf8('0x54')](__dirname,_0xfbf8('0x9e'),_0x58de95[_0xfbf8('0x9f')]),_0x25b3d8]);return _0x58de95;}else{var _0x19c8ef=squel[_0xfbf8('0x6e')]();_0x19c8ef[_0xfbf8('0x6f')]('('+_0xad4c12[_0xfbf8('0x86')]()+')',_0xfbf8('0xa0'));_0x19c8ef[_0xfbf8('0x8e')](_0xfbf8('0xa1'),_0xfbf8('0x1d'));_0xad4c12['limit'](_0x284579['limit']||_0xf3aa95);_0xad4c12[_0xfbf8('0x1e')](_0x284579[_0xfbf8('0x1e')]||0x0);return dbH[_0xfbf8('0x85')][_0xfbf8('0x31')](_0x19c8ef[_0xfbf8('0x86')](),{'type':dbH[_0xfbf8('0x85')][_0xfbf8('0x87')]['SELECT']})['then'](function(_0x2431a7){if(!_0x2431a7[_0xfbf8('0x37')]){_0x3ee4bd=0x0;}else{_0x3ee4bd=_0x2431a7[0x0][_0xfbf8('0x1d')]||0x0;}return dbH[_0xfbf8('0x85')][_0xfbf8('0x31')](_0xad4c12['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xfbf8('0x88')]});})['then'](function(_0x16f760){return{'rows':_0x16f760||[],'count':_0x3ee4bd};});}});}exports[_0xfbf8('0xa2')]=function(_0x6ec75,_0x48551d){return runReport(_0x6ec75['params'],_0x6ec75[_0xfbf8('0x31')],_0x6ec75['options'])[_0xfbf8('0x23')](respondWithResult(_0x48551d,null))[_0xfbf8('0x45')](handleError(_0x48551d,null));};exports['runReport']=runReport;exports['query']=function(_0x49a498,_0x3f8878){var _0x469dce=0xa;var _0x44e0f1=['join','left_join',_0xfbf8('0x55'),_0xfbf8('0x8a')];var _0x1b4cf3={'SUM':_0xfbf8('0x56'),'COUNT':_0xfbf8('0x8b'),'COUNT DISTINCT':_0xfbf8('0x57'),'MAX':_0xfbf8('0x58'),'MIN':_0xfbf8('0x8c'),'AVG':_0xfbf8('0x59'),'GROUP_CONCAT':_0xfbf8('0x5a'),'GROUP_CONCAT ASC':_0xfbf8('0x8d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2f8f4f={'SEC_TO_TIME':_0xfbf8('0x5c'),'DATE':_0xfbf8('0x5d'),'HOUR':_0xfbf8('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfbf8('0x60')};var _0x3066ab=function(_0x5c4a69){return!_[_0xfbf8('0x7b')]([_0xfbf8('0x61'),_0xfbf8('0x62'),_0xfbf8('0x63'),_0xfbf8('0x64')],_0x5c4a69);};var _0x3c63b4=function(_0x50d731){if(!_0x50d731||!_0x50d731[_0xfbf8('0x65')][_0xfbf8('0x37')]){return'';}for(var _0x3d19f8='(',_0x4373a7=0x0;_0x4373a7<_0x50d731[_0xfbf8('0x65')][_0xfbf8('0x37')];_0x4373a7+=0x1){_0x4373a7>0x0&&(_0x3d19f8+='\x20'+_0x50d731[_0xfbf8('0x66')]+'\x20');_0x3d19f8+=_0x50d731[_0xfbf8('0x65')][_0x4373a7][_0xfbf8('0x67')]?_0x3c63b4(_0x50d731[_0xfbf8('0x65')][_0x4373a7][_0xfbf8('0x67')]):_0x50d731['rules'][_0x4373a7][_0xfbf8('0x8e')]+'\x20'+_0x50d731[_0xfbf8('0x65')][_0x4373a7][_0xfbf8('0x68')]+(_0x3066ab(_0x50d731[_0xfbf8('0x65')][_0x4373a7]['condition'])?'\x20'+_0x50d731['rules'][_0x4373a7][_0xfbf8('0x69')]:'');}return _0x3d19f8+')';};var _0x7f472c={'where':{'id':_0x49a498[_0xfbf8('0x47')]['id']}},_0x4f5d00,_0x2b6a9b,_0x2f3eca,_0x4cc335,_0x463e0c;_0x7f472c=_[_0xfbf8('0x3f')]({},_0x7f472c,_0x49a498[_0xfbf8('0x40')]);return db[_0xfbf8('0x2e')][_0xfbf8('0x4e')](_0x7f472c)[_0xfbf8('0x23')](function(_0x55ce77){if(_0x55ce77){_0x4f5d00=_0x55ce77;return _0x55ce77[_0xfbf8('0x8f')]();}return null;})[_0xfbf8('0x23')](function(_0x1d79ba){if(_0x1d79ba){if(!_0x1d79ba['length']){throw new db['Sequelize'][(_0xfbf8('0x6b'))](_0xfbf8('0x6c'),0x193);}_0x2b6a9b=_0x1d79ba;return db['AnalyticMetric'][_0xfbf8('0x43')]({'raw':!![]});}return null;})[_0xfbf8('0x23')](function(_0x50bde8){if(_0x50bde8){_0x2f3eca=_[_0xfbf8('0x6d')](_0x50bde8,'id');var _0x250495;var _0x54c8ba=squel[_0xfbf8('0x6e')]();_0x54c8ba[_0xfbf8('0x6f')](_0x4f5d00['table']);for(var _0x1971d6=0x0;_0x1971d6<_0x2b6a9b[_0xfbf8('0x37')];_0x1971d6+=0x1){_0x250495=_0x2b6a9b[_0x1971d6]['MetricId']?_0x2f3eca[_0x2b6a9b[_0x1971d6]['MetricId']]['metric']:_0x2b6a9b[_0x1971d6][_0xfbf8('0x8e')];_0x250495=_0x2b6a9b[_0x1971d6][_0xfbf8('0x74')]?_[_0xfbf8('0x73')](_0x1b4cf3[_0x2b6a9b[_0x1971d6][_0xfbf8('0x74')]],'%s',_0x250495):_0x250495;_0x250495=_0x2b6a9b[_0x1971d6][_0xfbf8('0x75')]?_['replace'](_0x2f8f4f[_0x2b6a9b[_0x1971d6]['format']],'%s',_0x250495):_0x250495;if(_0x2b6a9b[_0x1971d6]['groupBy']){_0x54c8ba[_0xfbf8('0x67')](_0x250495);}_0x2b6a9b[_0x1971d6]['orderBy']&&_0x54c8ba[_0xfbf8('0x78')](_0x250495,_0x2b6a9b[_0x1971d6][_0xfbf8('0x77')]==='DESC'?![]:!![]);_0x54c8ba[_0xfbf8('0x8e')](_0x250495,_0x2b6a9b[_0x1971d6][_0xfbf8('0xa3')]||_0x250495);}if(_0x4f5d00['joins']){_0x4f5d00[_0xfbf8('0x7a')]=JSON[_0xfbf8('0x81')](_0x4f5d00['joins']);for(var _0x5807de=0x0;_0x5807de<_0x4f5d00[_0xfbf8('0x7a')][_0xfbf8('0x37')];_0x5807de+=0x1){if(_0x4f5d00['joins'][_0x5807de][_0xfbf8('0x3e')]&&_[_0xfbf8('0x7b')](_0x44e0f1,_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x3e')])&&_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7c')]&&_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7d')]&&_0x4f5d00['joins'][_0x5807de][_0xfbf8('0x7f')]){_0x54c8ba[_0x4f5d00['joins'][_0x5807de][_0xfbf8('0x3e')]](_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7d')],null,util[_0xfbf8('0x75')](_0xfbf8('0x7e'),_0x4f5d00['table'],_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7c')],_0x4f5d00['joins'][_0x5807de][_0xfbf8('0x7d')],_0x4f5d00[_0xfbf8('0x7a')][_0x5807de][_0xfbf8('0x7f')]));}}}if(_0x4f5d00[_0xfbf8('0x80')]){_0x4f5d00[_0xfbf8('0x80')]=JSON['parse'](_0x4f5d00[_0xfbf8('0x80')]);_0x54c8ba[_0xfbf8('0x3d')](_0x3c63b4(_0x4f5d00[_0xfbf8('0x80')]['group']));}_0x463e0c=_0x54c8ba['clone']();_0x54c8ba[_0xfbf8('0x1f')](_0x469dce);_0x54c8ba['offset'](0x0);logger[_0xfbf8('0x83')](_0xfbf8('0x84'),_0x54c8ba[_0xfbf8('0x86')]());return db[_0xfbf8('0x85')][_0xfbf8('0x31')](_0x54c8ba[_0xfbf8('0x86')](),{'type':db[_0xfbf8('0x85')][_0xfbf8('0x87')][_0xfbf8('0x88')]});}})[_0xfbf8('0x23')](function(){return{'sql':_0x463e0c[_0xfbf8('0x86')]()};})[_0xfbf8('0x23')](respondWithResult(_0x3f8878,null))[_0xfbf8('0x45')](handleError(_0x3f8878,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 6453033..ed3823f 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 _0x326f=['analytics_default_reports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x143f23,_0x121813){var _0x4feb05=function(_0xcbd567){while(--_0xcbd567){_0x143f23['push'](_0x143f23['shift']());}};_0x4feb05(++_0x121813);}(_0x326f,0xd1));var _0xf326=function(_0x3281bc,_0x503259){_0x3281bc=_0x3281bc-0x0;var _0x12d60a=_0x326f[_0x3281bc];return _0x12d60a;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./analyticDefaultReport.attributes'];(function(_0xf2a854,_0x340c05){var _0x3d3b00=function(_0x29997a){while(--_0x29997a){_0xf2a854['push'](_0xf2a854['shift']());}};_0x3d3b00(++_0x340c05);}(_0x2ef3,0xba));var _0x32ef=function(_0x92b584,_0x115b6b){_0x92b584=_0x92b584-0x0;var _0x38cdeb=_0x2ef3[_0x92b584];return _0x38cdeb;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 69a75ba..18e3861 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 _0xb240=['http','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb240,0x7e));var _0x0b24=function(_0x2f31d0,_0x24a1d7){_0x2f31d0=_0x2f31d0-0x0;var _0x35c9c3=_0xb240[_0x2f31d0];return _0x35c9c3;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var moment=require(_0x0b24('0x2'));var BPromise=require(_0x0b24('0x3'));var rs=require(_0x0b24('0x4'));var fs=require('fs');var Redis=require(_0x0b24('0x5'));var db=require(_0x0b24('0x6'))['db'];var utils=require(_0x0b24('0x7'));var logger=require(_0x0b24('0x8'))('rpc');var config=require(_0x0b24('0x9'));var jayson=require(_0x0b24('0xa'));var client=jayson[_0x0b24('0xb')][_0x0b24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x162a50,_0x53526b,_0x238a19){return new BPromise(function(_0x34be24,_0x41b7b9){return client['request'](_0x162a50,_0x238a19)['then'](function(_0x2679d5){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x53526b,_0x0b24('0xd'));logger[_0x0b24('0xe')](_0x0b24('0xf'),_0x53526b,_0x0b24('0xd'),JSON[_0x0b24('0x10')](_0x2679d5));if(_0x2679d5[_0x0b24('0x11')]){if(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x12')]===0x1f4){logger['error'](_0x0b24('0x13'),_0x53526b,_0x2679d5[_0x0b24('0x11')]['message']);return _0x41b7b9(_0x2679d5[_0x0b24('0x11')][_0x0b24('0x14')]);}logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x2679d5['error']['message']);return _0x34be24(_0x2679d5['error']['message']);}else{logger[_0x0b24('0x15')](_0x0b24('0x13'),_0x53526b,_0x0b24('0xd'));_0x34be24(_0x2679d5['result'][_0x0b24('0x14')]);}})[_0x0b24('0x16')](function(_0x1fd966){logger[_0x0b24('0x11')](_0x0b24('0x13'),_0x53526b,_0x1fd966);_0x41b7b9(_0x1fd966);});});} \ No newline at end of file +var _0xeb74=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x184aab,_0x49ae9c){var _0x1ec430=function(_0x4cf3c4){while(--_0x4cf3c4){_0x184aab['push'](_0x184aab['shift']());}};_0x1ec430(++_0x49ae9c);}(_0xeb74,0xe3));var _0x4eb7=function(_0x26b9fa,_0x4c1457){_0x26b9fa=_0x26b9fa-0x0;var _0x49717b=_0xeb74[_0x26b9fa];return _0x49717b;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e912116..fbdd8ca 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 _0x7ced=['run','query','create','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run'];(function(_0x5ccc99,_0x4c1dde){var _0x511532=function(_0x4a892a){while(--_0x4a892a){_0x5ccc99['push'](_0x5ccc99['shift']());}};_0x511532(++_0x4c1dde);}(_0x7ced,0x1a8));var _0xd7ce=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x7ced[_0x4bd950];return _0x5dc59a;};'use strict';var multer=require(_0xd7ce('0x0'));var util=require(_0xd7ce('0x1'));var path=require(_0xd7ce('0x2'));var timeout=require(_0xd7ce('0x3'));var express=require(_0xd7ce('0x4'));var router=express['Router']();var auth=require(_0xd7ce('0x5'));var interaction=require(_0xd7ce('0x6'));var config=require(_0xd7ce('0x7'));var controller=require(_0xd7ce('0x8'));router[_0xd7ce('0x9')]('/',auth[_0xd7ce('0xa')](),controller[_0xd7ce('0xb')]);router[_0xd7ce('0x9')](_0xd7ce('0xc'),auth[_0xd7ce('0xa')](),controller[_0xd7ce('0xd')]);router['get'](_0xd7ce('0xe'),auth[_0xd7ce('0xa')](),controller['preview']);router['get'](_0xd7ce('0xf'),auth['isAuthenticated'](),controller[_0xd7ce('0x10')]);router['get']('/:id/query',auth[_0xd7ce('0xa')](),controller[_0xd7ce('0x11')]);router['post']('/',auth[_0xd7ce('0xa')](),controller[_0xd7ce('0x12')]);router['put'](_0xd7ce('0xc'),auth[_0xd7ce('0xa')](),controller[_0xd7ce('0x13')]);router[_0xd7ce('0x14')]('/:id',auth[_0xd7ce('0xa')](),controller['destroy']);module[_0xd7ce('0x15')]=router; \ No newline at end of file +var _0x49d7=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','query','post','create','put','update','exports','multer','util','path','express','Router'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x49d7,0xab));var _0x749d=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x49d7[_0xe896bf];return _0x4c7a8a;};'use strict';var multer=require(_0x749d('0x0'));var util=require(_0x749d('0x1'));var path=require(_0x749d('0x2'));var timeout=require('connect-timeout');var express=require(_0x749d('0x3'));var router=express[_0x749d('0x4')]();var auth=require(_0x749d('0x5'));var interaction=require(_0x749d('0x6'));var config=require(_0x749d('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0x749d('0x8')]('/',auth[_0x749d('0x9')](),controller[_0x749d('0xa')]);router[_0x749d('0x8')](_0x749d('0xb'),auth[_0x749d('0x9')](),controller[_0x749d('0xc')]);router[_0x749d('0x8')]('/:id/preview',auth[_0x749d('0x9')](),controller[_0x749d('0xd')]);router[_0x749d('0x8')](_0x749d('0xe'),auth[_0x749d('0x9')](),controller[_0x749d('0xf')]);router[_0x749d('0x8')]('/:id/query',auth['isAuthenticated'](),controller[_0x749d('0x10')]);router[_0x749d('0x11')]('/',auth[_0x749d('0x9')](),controller[_0x749d('0x12')]);router[_0x749d('0x13')](_0x749d('0xb'),auth[_0x749d('0x9')](),controller[_0x749d('0x14')]);router['delete'](_0x749d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x749d('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e64ba59..9685c5c 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 _0xe378=['UNSIGNED','moment','exports','STRING','csv','pdf','xlsx','DATE','Loading','ENUM','manual','INTEGER'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xe378,0xa9));var _0x8e37=function(_0x3f3f75,_0x5e215f){_0x3f3f75=_0x3f3f75-0x0;var _0x322635=_0xe378[_0x3f3f75];return _0x322635;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8e37('0x0'));module[_0x8e37('0x1')]={'name':{'type':Sequelize[_0x8e37('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x8e37('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x8e37('0x3'),_0x8e37('0x4'),_0x8e37('0x5')),'allowNull':![],'defaultValue':_0x8e37('0x3')},'savename':{'type':Sequelize[_0x8e37('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x8e37('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x8e37('0x7')},'type':{'type':Sequelize[_0x8e37('0x8')](_0x8e37('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x8e37('0x9')},'reportId':{'type':Sequelize[_0x8e37('0xa')](0xb)[_0x8e37('0xb')]},'reportType':{'type':Sequelize[_0x8e37('0x2')]}}; \ No newline at end of file +var _0x423c=['moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','INTEGER','UNSIGNED'];(function(_0x3b5359,_0x53240a){var _0x3090ce=function(_0x195946){while(--_0x195946){_0x3b5359['push'](_0x3b5359['shift']());}};_0x3090ce(++_0x53240a);}(_0x423c,0xcc));var _0xc423=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x423c[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc423('0x0'));module[_0xc423('0x1')]={'name':{'type':Sequelize[_0xc423('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xc423('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xc423('0x3')](_0xc423('0x4'),_0xc423('0x5'),_0xc423('0x6')),'allowNull':![],'defaultValue':_0xc423('0x4')},'savename':{'type':Sequelize[_0xc423('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc423('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xc423('0x2')],'defaultValue':_0xc423('0x8')},'type':{'type':Sequelize['ENUM']('manual',_0xc423('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xc423('0xa')](0xb)[_0xc423('0xb')]},'reportType':{'type':Sequelize[_0xc423('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 65aa794..7f2f1f4 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 _0xcd58=['merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','output','existsSync','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','server/files/reports','format','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','get','ExtractedReports','UserProfileResource','then','error','name','send','index','map','AnalyticExtractedReport','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where'];(function(_0x5599d3,_0x144aa5){var _0x2ea771=function(_0x1843f5){while(--_0x1843f5){_0x5599d3['push'](_0x5599d3['shift']());}};_0x2ea771(++_0x144aa5);}(_0xcd58,0x7c));var _0x8cd5=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xcd58[_0x5e42a7];return _0x36d21b;};'use strict';var pdf=require(_0x8cd5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8cd5('0x1'));var zipdir=require(_0x8cd5('0x2'));var jsonpatch=require(_0x8cd5('0x3'));var rp=require('request-promise');var moment=require(_0x8cd5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8cd5('0x5'));var util=require(_0x8cd5('0x6'));var path=require('path');var sox=require(_0x8cd5('0x7'));var csv=require(_0x8cd5('0x8'));var ejs=require(_0x8cd5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8cd5('0xa'));var crypto=require(_0x8cd5('0xb'));var jsforce=require(_0x8cd5('0xc'));var deskjs=require(_0x8cd5('0xd'));var toCsv=require(_0x8cd5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8cd5('0xe'));var authService=require(_0x8cd5('0xf'));var qs=require(_0x8cd5('0x10'));var as=require(_0x8cd5('0x11'));var hardwareService=require(_0x8cd5('0x12'));var logger=require('../../config/logger')(_0x8cd5('0x13'));var utils=require(_0x8cd5('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b5fdb,_0xf843c1){_0xf843c1=_0xf843c1||0xcc;return function(_0x9a667c){if(_0x9a667c){return _0x2b5fdb[_0x8cd5('0x15')](_0xf843c1);}return _0x2b5fdb['status'](_0xf843c1)[_0x8cd5('0x16')]();};}function respondWithResult(_0x417ce9,_0x3dec88){_0x3dec88=_0x3dec88||0xc8;return function(_0x302242){if(_0x302242){return _0x417ce9['status'](_0x3dec88)[_0x8cd5('0x17')](_0x302242);}};}function respondWithFilteredResult(_0x51137a,_0x49987f){return function(_0x591bb3){if(_0x591bb3){var _0xb8c6c4=_0x591bb3[_0x8cd5('0x18')],_0x328318=_0x49987f[_0x8cd5('0x19')],_0x3e12fb=_0x49987f[_0x8cd5('0x19')]+_0x49987f[_0x8cd5('0x1a')],_0x671388;if(_0x3e12fb>=_0xb8c6c4){_0x3e12fb=_0xb8c6c4;_0x671388=0xc8;}else{_0x671388=0xce;}_0x51137a[_0x8cd5('0x1b')](_0x671388);return _0x51137a[_0x8cd5('0x1c')](_0x8cd5('0x1d'),_0x328318+'-'+_0x3e12fb+'/'+_0xb8c6c4)[_0x8cd5('0x17')](_0x591bb3);}return null;};}function patchUpdates(_0x5d1926){return function(_0x5ed6a4){try{jsonpatch[_0x8cd5('0x1e')](_0x5ed6a4,_0x5d1926,!![]);}catch(_0xee48c9){return BPromise[_0x8cd5('0x1f')](_0xee48c9);}return _0x5ed6a4[_0x8cd5('0x20')]();};}function saveUpdates(_0x4462b6,_0x111dbc){return function(_0x1e998d){if(_0x1e998d){return _0x1e998d[_0x8cd5('0x21')](_0x4462b6)['then'](function(_0x29bf40){return _0x29bf40;});}return null;};}function removeEntity(_0x5e2cbc,_0x391331){return function(_0x4ea3a3){if(_0x4ea3a3){return _0x4ea3a3[_0x8cd5('0x22')]()['then'](function(){var _0x29b56d=_0x4ea3a3[_0x8cd5('0x23')]({'plain':!![]});var _0x13d5f5=_0x8cd5('0x24');return db[_0x8cd5('0x25')][_0x8cd5('0x22')]({'where':{'type':_0x13d5f5,'resourceId':_0x29b56d['id']}})[_0x8cd5('0x26')](function(){return _0x4ea3a3;});})['then'](function(){_0x5e2cbc[_0x8cd5('0x1b')](0xcc)[_0x8cd5('0x16')]();});}};}function handleEntityNotFound(_0x138d08,_0x30efe4){return function(_0x3376db){if(!_0x3376db){_0x138d08[_0x8cd5('0x15')](0x194);}return _0x3376db;};}function handleError(_0x35b1c,_0x235427){_0x235427=_0x235427||0x1f4;return function(_0x3d27cc){logger[_0x8cd5('0x27')](_0x3d27cc['stack']);if(_0x3d27cc[_0x8cd5('0x28')]){delete _0x3d27cc['name'];}_0x35b1c['status'](_0x235427)[_0x8cd5('0x29')](_0x3d27cc);};}exports[_0x8cd5('0x2a')]=function(_0x481d1f,_0x5464cb){var _0x274b70={},_0x34fda7={},_0x109f6c={'count':0x0,'rows':[]};var _0x42b55f=_[_0x8cd5('0x2b')](db[_0x8cd5('0x2c')]['rawAttributes'],function(_0x1ea591){return{'name':_0x1ea591[_0x8cd5('0x2d')],'type':_0x1ea591['type'][_0x8cd5('0x2e')]};});_0x34fda7[_0x8cd5('0x2f')]=_['map'](_0x42b55f,_0x8cd5('0x28'));_0x34fda7['query']=_[_0x8cd5('0x30')](_0x481d1f['query']);_0x34fda7['filters']=_[_0x8cd5('0x31')](_0x34fda7[_0x8cd5('0x2f')],_0x34fda7[_0x8cd5('0x32')]);_0x274b70[_0x8cd5('0x33')]=_['intersection'](_0x34fda7[_0x8cd5('0x2f')],qs['fields'](_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x34')]));_0x274b70[_0x8cd5('0x33')]=_0x274b70['attributes'][_0x8cd5('0x35')]?_0x274b70['attributes']:_0x34fda7[_0x8cd5('0x2f')];if(!_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x36')]('nolimit')){_0x274b70[_0x8cd5('0x1a')]=qs['limit'](_0x481d1f['query']['limit']);_0x274b70[_0x8cd5('0x19')]=qs[_0x8cd5('0x19')](_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x19')]);}_0x274b70[_0x8cd5('0x37')]=qs['sort'](_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x38')]);_0x274b70['where']=qs[_0x8cd5('0x39')](_['pick'](_0x481d1f[_0x8cd5('0x32')],_0x34fda7['filters']),_0x42b55f);if(_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x3a')]){_0x274b70[_0x8cd5('0x3b')]=_[_0x8cd5('0x3c')](_0x274b70[_0x8cd5('0x3b')],{'$or':_[_0x8cd5('0x2b')](_0x42b55f,function(_0x2c31b1){if(_0x2c31b1['type']!=='VIRTUAL'){var _0xffefa5={};_0xffefa5[_0x2c31b1[_0x8cd5('0x28')]]={'$like':'%'+_0x481d1f['query']['filter']+'%'};return _0xffefa5;}})});}_0x274b70=_[_0x8cd5('0x3c')]({},_0x274b70,_0x481d1f[_0x8cd5('0x3d')]);var _0x37d122={'where':_0x274b70[_0x8cd5('0x3b')]};return db[_0x8cd5('0x2c')][_0x8cd5('0x18')](_0x37d122)['then'](function(_0x200cfd){_0x109f6c[_0x8cd5('0x18')]=_0x200cfd;if(_0x481d1f[_0x8cd5('0x32')][_0x8cd5('0x3e')]){_0x274b70[_0x8cd5('0x3f')]=[{'all':!![]}];}return db[_0x8cd5('0x2c')][_0x8cd5('0x40')](_0x274b70);})[_0x8cd5('0x26')](function(_0x4d8920){_0x109f6c[_0x8cd5('0x41')]=_0x4d8920;return _0x109f6c;})[_0x8cd5('0x26')](respondWithFilteredResult(_0x5464cb,_0x274b70))[_0x8cd5('0x42')](handleError(_0x5464cb,null));};exports[_0x8cd5('0x43')]=function(_0x2fe662,_0x3b5e0b){var _0x52bdad={'raw':!![],'where':{'id':_0x2fe662['params']['id']}},_0x45d904={};_0x45d904[_0x8cd5('0x2f')]=_[_0x8cd5('0x30')](db[_0x8cd5('0x2c')][_0x8cd5('0x44')]);_0x45d904[_0x8cd5('0x32')]=_[_0x8cd5('0x30')](_0x2fe662[_0x8cd5('0x32')]);_0x45d904[_0x8cd5('0x39')]=_[_0x8cd5('0x31')](_0x45d904[_0x8cd5('0x2f')],_0x45d904[_0x8cd5('0x32')]);_0x52bdad[_0x8cd5('0x33')]=_[_0x8cd5('0x31')](_0x45d904[_0x8cd5('0x2f')],qs['fields'](_0x2fe662['query'][_0x8cd5('0x34')]));_0x52bdad['attributes']=_0x52bdad['attributes'][_0x8cd5('0x35')]?_0x52bdad[_0x8cd5('0x33')]:_0x45d904[_0x8cd5('0x2f')];if(_0x2fe662[_0x8cd5('0x32')][_0x8cd5('0x3e')]){_0x52bdad[_0x8cd5('0x3f')]=[{'all':!![]}];}_0x52bdad=_[_0x8cd5('0x3c')]({},_0x52bdad,_0x2fe662[_0x8cd5('0x3d')]);return db[_0x8cd5('0x2c')]['find'](_0x52bdad)[_0x8cd5('0x26')](handleEntityNotFound(_0x3b5e0b,null))[_0x8cd5('0x26')](respondWithResult(_0x3b5e0b,null))[_0x8cd5('0x42')](handleError(_0x3b5e0b,null));};exports[_0x8cd5('0x45')]=function(_0x5a91d0,_0x2e37e7){return db[_0x8cd5('0x2c')][_0x8cd5('0x45')](_0x5a91d0[_0x8cd5('0x46')],{})[_0x8cd5('0x26')](function(_0x18757e){var _0x1f262a=_0x5a91d0['user']['get']({'plain':!![]});if(!_0x1f262a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f262a[_0x8cd5('0x47')]===_0x8cd5('0x48')){var _0x20e231=_0x18757e[_0x8cd5('0x23')]({'plain':!![]});var _0x18e154=_0x8cd5('0x24');return db[_0x8cd5('0x49')][_0x8cd5('0x4a')]({'where':{'name':_0x18e154,'userProfileId':_0x1f262a[_0x8cd5('0x4b')]},'raw':!![]})[_0x8cd5('0x26')](function(_0x55bdd4){if(_0x55bdd4&&_0x55bdd4[_0x8cd5('0x4c')]===0x0){return db[_0x8cd5('0x25')][_0x8cd5('0x45')]({'name':_0x20e231[_0x8cd5('0x28')],'resourceId':_0x20e231['id'],'type':_0x55bdd4['name'],'sectionId':_0x55bdd4['id']},{})[_0x8cd5('0x26')](function(){return _0x18757e;});}else{return _0x18757e;}})[_0x8cd5('0x42')](function(_0x5501aa){logger[_0x8cd5('0x27')](_0x8cd5('0x4d'),_0x5501aa);throw _0x5501aa;});}return _0x18757e;})[_0x8cd5('0x26')](respondWithResult(_0x2e37e7,0xc9))[_0x8cd5('0x42')](handleError(_0x2e37e7,null));};exports[_0x8cd5('0x21')]=function(_0x7e481e,_0x28a054){if(_0x7e481e[_0x8cd5('0x46')]['id']){delete _0x7e481e[_0x8cd5('0x46')]['id'];}return db[_0x8cd5('0x2c')]['find']({'where':{'id':_0x7e481e['params']['id']}})[_0x8cd5('0x26')](handleEntityNotFound(_0x28a054,null))['then'](saveUpdates(_0x7e481e[_0x8cd5('0x46')],null))[_0x8cd5('0x26')](respondWithResult(_0x28a054,null))[_0x8cd5('0x42')](handleError(_0x28a054,null));};exports['destroy']=function(_0x40de3b,_0x2a68d9){return db[_0x8cd5('0x2c')][_0x8cd5('0x4a')]({'where':{'id':_0x40de3b[_0x8cd5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2a68d9,null))[_0x8cd5('0x26')](removeEntity(_0x2a68d9,null))['catch'](handleError(_0x2a68d9,null));};exports['download']=function(_0x52f6ae,_0x47aa6c,_0x30ad38){return db[_0x8cd5('0x2c')][_0x8cd5('0x4a')]({'where':{'id':_0x52f6ae[_0x8cd5('0x4e')]['id']},'attributes':[_0x8cd5('0x28'),_0x8cd5('0x4f'),_0x8cd5('0x50'),_0x8cd5('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x47aa6c,null))[_0x8cd5('0x26')](function(_0x43576c){if(_0x43576c){if(!fs[_0x8cd5('0x52')](path[_0x8cd5('0x53')](config[_0x8cd5('0x54')],'server/files/reports',_0x43576c[_0x8cd5('0x50')]))){throw new db[(_0x8cd5('0x55'))]['ValidationError'](_0x8cd5('0x56'));}if(_0x52f6ae[_0x8cd5('0x32')][_0x8cd5('0x57')]){return _0x47aa6c['sendStatus'](0xc8);}return _0x47aa6c[_0x8cd5('0x58')](path[_0x8cd5('0x53')](config[_0x8cd5('0x54')],_0x8cd5('0x59'),_0x43576c['savename']),util[_0x8cd5('0x5a')]('%s.%s',_0x43576c[_0x8cd5('0x4f')]||_0x43576c[_0x8cd5('0x28')],_0x43576c['output'][_0x8cd5('0x5b')]()));}})[_0x8cd5('0x42')](handleError(_0x47aa6c,null));}; \ No newline at end of file +var _0x15a1=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','error','name','send','AnalyticExtractedReport','rawAttributes','key','map','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','sort','where','type','merge','options','findAll','catch','show','length','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','autoAssociation','body','params','destroy','download','basename','savename','existsSync','server/files/reports','Sequelize','exists','root','%s.%s','output','toLowerCase','html-pdf','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x15a1,0xf1));var _0x115a=function(_0x1d3a4e,_0x2fa74a){_0x1d3a4e=_0x1d3a4e-0x0;var _0x3dfbeb=_0x15a1[_0x1d3a4e];return _0x3dfbeb;};'use strict';var pdf=require(_0x115a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x115a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x115a('0x2'));var rp=require('request-promise');var moment=require(_0x115a('0x3'));var BPromise=require(_0x115a('0x4'));var Mustache=require('mustache');var util=require(_0x115a('0x5'));var path=require(_0x115a('0x6'));var sox=require(_0x115a('0x7'));var csv=require(_0x115a('0x8'));var ejs=require(_0x115a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x115a('0xa'));var crypto=require(_0x115a('0xb'));var jsforce=require(_0x115a('0xc'));var deskjs=require(_0x115a('0xd'));var toCsv=require(_0x115a('0x8'));var querystring=require('querystring');var Papa=require(_0x115a('0xe'));var Redis=require(_0x115a('0xf'));var authService=require(_0x115a('0x10'));var qs=require(_0x115a('0x11'));var as=require(_0x115a('0x12'));var hardwareService=require(_0x115a('0x13'));var logger=require(_0x115a('0x14'))(_0x115a('0x15'));var utils=require('../../config/utils');var config=require(_0x115a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5339d0,_0x5b7e7f){_0x5b7e7f=_0x5b7e7f||0xcc;return function(_0x275110){if(_0x275110){return _0x5339d0[_0x115a('0x17')](_0x5b7e7f);}return _0x5339d0['status'](_0x5b7e7f)[_0x115a('0x18')]();};}function respondWithResult(_0x290fce,_0x3c4fa8){_0x3c4fa8=_0x3c4fa8||0xc8;return function(_0x323d11){if(_0x323d11){return _0x290fce[_0x115a('0x19')](_0x3c4fa8)['json'](_0x323d11);}};}function respondWithFilteredResult(_0x5a9739,_0x50d3d6){return function(_0x43750d){if(_0x43750d){var _0x55a556=_0x43750d[_0x115a('0x1a')],_0x29f3bf=_0x50d3d6[_0x115a('0x1b')],_0x527316=_0x50d3d6['offset']+_0x50d3d6[_0x115a('0x1c')],_0x4cccb2;if(_0x527316>=_0x55a556){_0x527316=_0x55a556;_0x4cccb2=0xc8;}else{_0x4cccb2=0xce;}_0x5a9739[_0x115a('0x19')](_0x4cccb2);return _0x5a9739[_0x115a('0x1d')](_0x115a('0x1e'),_0x29f3bf+'-'+_0x527316+'/'+_0x55a556)[_0x115a('0x1f')](_0x43750d);}return null;};}function patchUpdates(_0xc5b377){return function(_0x3409a3){try{jsonpatch[_0x115a('0x20')](_0x3409a3,_0xc5b377,!![]);}catch(_0x5997e1){return BPromise[_0x115a('0x21')](_0x5997e1);}return _0x3409a3[_0x115a('0x22')]();};}function saveUpdates(_0x20cef1,_0x26f2b1){return function(_0x226805){if(_0x226805){return _0x226805[_0x115a('0x23')](_0x20cef1)['then'](function(_0x53ca31){return _0x53ca31;});}return null;};}function removeEntity(_0x1cd9e7,_0xb6135c){return function(_0x54ae99){if(_0x54ae99){return _0x54ae99['destroy']()[_0x115a('0x24')](function(){var _0x1ec9b0=_0x54ae99[_0x115a('0x25')]({'plain':!![]});var _0x2075b3='ExtractedReports';return db[_0x115a('0x26')]['destroy']({'where':{'type':_0x2075b3,'resourceId':_0x1ec9b0['id']}})[_0x115a('0x24')](function(){return _0x54ae99;});})[_0x115a('0x24')](function(){_0x1cd9e7[_0x115a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dae4,_0x5e9e80){return function(_0x143bd5){if(!_0x143bd5){_0x1dae4[_0x115a('0x17')](0x194);}return _0x143bd5;};}function handleError(_0x3deeab,_0x561bf5){_0x561bf5=_0x561bf5||0x1f4;return function(_0xe07a78){logger[_0x115a('0x27')](_0xe07a78['stack']);if(_0xe07a78[_0x115a('0x28')]){delete _0xe07a78[_0x115a('0x28')];}_0x3deeab[_0x115a('0x19')](_0x561bf5)[_0x115a('0x29')](_0xe07a78);};}exports['index']=function(_0xc81abd,_0x12bfb9){var _0x324100={},_0x359b91={},_0x450e77={'count':0x0,'rows':[]};var _0x175695=_['map'](db[_0x115a('0x2a')][_0x115a('0x2b')],function(_0x1ae33c){return{'name':_0x1ae33c['fieldName'],'type':_0x1ae33c['type'][_0x115a('0x2c')]};});_0x359b91['model']=_[_0x115a('0x2d')](_0x175695,'name');_0x359b91['query']=_[_0x115a('0x2e')](_0xc81abd['query']);_0x359b91[_0x115a('0x2f')]=_[_0x115a('0x30')](_0x359b91[_0x115a('0x31')],_0x359b91[_0x115a('0x32')]);_0x324100[_0x115a('0x33')]=_[_0x115a('0x30')](_0x359b91[_0x115a('0x31')],qs[_0x115a('0x34')](_0xc81abd['query'][_0x115a('0x34')]));_0x324100['attributes']=_0x324100['attributes']['length']?_0x324100[_0x115a('0x33')]:_0x359b91[_0x115a('0x31')];if(!_0xc81abd[_0x115a('0x32')][_0x115a('0x35')]('nolimit')){_0x324100['limit']=qs[_0x115a('0x1c')](_0xc81abd[_0x115a('0x32')][_0x115a('0x1c')]);_0x324100['offset']=qs[_0x115a('0x1b')](_0xc81abd[_0x115a('0x32')][_0x115a('0x1b')]);}_0x324100['order']=qs['sort'](_0xc81abd[_0x115a('0x32')][_0x115a('0x36')]);_0x324100[_0x115a('0x37')]=qs[_0x115a('0x2f')](_['pick'](_0xc81abd[_0x115a('0x32')],_0x359b91[_0x115a('0x2f')]),_0x175695);if(_0xc81abd[_0x115a('0x32')]['filter']){_0x324100['where']=_['merge'](_0x324100[_0x115a('0x37')],{'$or':_[_0x115a('0x2d')](_0x175695,function(_0x854830){if(_0x854830[_0x115a('0x38')]!=='VIRTUAL'){var _0x4af3d9={};_0x4af3d9[_0x854830[_0x115a('0x28')]]={'$like':'%'+_0xc81abd[_0x115a('0x32')]['filter']+'%'};return _0x4af3d9;}})});}_0x324100=_[_0x115a('0x39')]({},_0x324100,_0xc81abd[_0x115a('0x3a')]);var _0x2a6027={'where':_0x324100['where']};return db[_0x115a('0x2a')][_0x115a('0x1a')](_0x2a6027)[_0x115a('0x24')](function(_0x298a6a){_0x450e77[_0x115a('0x1a')]=_0x298a6a;if(_0xc81abd[_0x115a('0x32')]['includeAll']){_0x324100['include']=[{'all':!![]}];}return db[_0x115a('0x2a')][_0x115a('0x3b')](_0x324100);})['then'](function(_0x1f54bf){_0x450e77['rows']=_0x1f54bf;return _0x450e77;})[_0x115a('0x24')](respondWithFilteredResult(_0x12bfb9,_0x324100))[_0x115a('0x3c')](handleError(_0x12bfb9,null));};exports[_0x115a('0x3d')]=function(_0x8cd729,_0x4b799d){var _0x129150={'raw':!![],'where':{'id':_0x8cd729['params']['id']}},_0x1e2627={};_0x1e2627['model']=_[_0x115a('0x2e')](db[_0x115a('0x2a')]['rawAttributes']);_0x1e2627[_0x115a('0x32')]=_[_0x115a('0x2e')](_0x8cd729[_0x115a('0x32')]);_0x1e2627[_0x115a('0x2f')]=_[_0x115a('0x30')](_0x1e2627[_0x115a('0x31')],_0x1e2627[_0x115a('0x32')]);_0x129150[_0x115a('0x33')]=_[_0x115a('0x30')](_0x1e2627['model'],qs[_0x115a('0x34')](_0x8cd729['query'][_0x115a('0x34')]));_0x129150[_0x115a('0x33')]=_0x129150['attributes'][_0x115a('0x3e')]?_0x129150['attributes']:_0x1e2627[_0x115a('0x31')];if(_0x8cd729['query'][_0x115a('0x3f')]){_0x129150[_0x115a('0x40')]=[{'all':!![]}];}_0x129150=_[_0x115a('0x39')]({},_0x129150,_0x8cd729[_0x115a('0x3a')]);return db[_0x115a('0x2a')][_0x115a('0x41')](_0x129150)[_0x115a('0x24')](handleEntityNotFound(_0x4b799d,null))['then'](respondWithResult(_0x4b799d,null))[_0x115a('0x3c')](handleError(_0x4b799d,null));};exports[_0x115a('0x42')]=function(_0x95128d,_0x58c973){return db[_0x115a('0x2a')][_0x115a('0x42')](_0x95128d['body'],{})[_0x115a('0x24')](function(_0x34b982){var _0x4bece7=_0x95128d[_0x115a('0x43')]['get']({'plain':!![]});if(!_0x4bece7)throw new Error(_0x115a('0x44'));if(_0x4bece7['role']===_0x115a('0x43')){var _0x506dcc=_0x34b982[_0x115a('0x25')]({'plain':!![]});var _0x862199=_0x115a('0x45');return db['UserProfileSection'][_0x115a('0x41')]({'where':{'name':_0x862199,'userProfileId':_0x4bece7['userProfileId']},'raw':!![]})['then'](function(_0x4dd3ce){if(_0x4dd3ce&&_0x4dd3ce[_0x115a('0x46')]===0x0){return db[_0x115a('0x26')]['create']({'name':_0x506dcc[_0x115a('0x28')],'resourceId':_0x506dcc['id'],'type':_0x4dd3ce[_0x115a('0x28')],'sectionId':_0x4dd3ce['id']},{})['then'](function(){return _0x34b982;});}else{return _0x34b982;}})[_0x115a('0x3c')](function(_0x1c983a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c983a);throw _0x1c983a;});}return _0x34b982;})[_0x115a('0x24')](respondWithResult(_0x58c973,0xc9))[_0x115a('0x3c')](handleError(_0x58c973,null));};exports[_0x115a('0x23')]=function(_0x2b9b57,_0xbc11c6){if(_0x2b9b57[_0x115a('0x47')]['id']){delete _0x2b9b57[_0x115a('0x47')]['id'];}return db['AnalyticExtractedReport'][_0x115a('0x41')]({'where':{'id':_0x2b9b57[_0x115a('0x48')]['id']}})[_0x115a('0x24')](handleEntityNotFound(_0xbc11c6,null))['then'](saveUpdates(_0x2b9b57['body'],null))['then'](respondWithResult(_0xbc11c6,null))[_0x115a('0x3c')](handleError(_0xbc11c6,null));};exports[_0x115a('0x49')]=function(_0x460a38,_0x3db472){return db[_0x115a('0x2a')]['find']({'where':{'id':_0x460a38['params']['id']}})[_0x115a('0x24')](handleEntityNotFound(_0x3db472,null))[_0x115a('0x24')](removeEntity(_0x3db472,null))[_0x115a('0x3c')](handleError(_0x3db472,null));};exports[_0x115a('0x4a')]=function(_0x3be399,_0x5cb22f,_0xad2f9f){return db['AnalyticExtractedReport'][_0x115a('0x41')]({'where':{'id':_0x3be399[_0x115a('0x48')]['id']},'attributes':[_0x115a('0x28'),_0x115a('0x4b'),_0x115a('0x4c'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x5cb22f,null))[_0x115a('0x24')](function(_0x3b5fcf){if(_0x3b5fcf){if(!fs[_0x115a('0x4d')](path['join'](config['root'],_0x115a('0x4e'),_0x3b5fcf[_0x115a('0x4c')]))){throw new db[(_0x115a('0x4f'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x3be399[_0x115a('0x32')][_0x115a('0x50')]){return _0x5cb22f[_0x115a('0x17')](0xc8);}return _0x5cb22f[_0x115a('0x4a')](path['join'](config[_0x115a('0x51')],'server/files/reports',_0x3b5fcf[_0x115a('0x4c')]),util['format'](_0x115a('0x52'),_0x3b5fcf['basename']||_0x3b5fcf[_0x115a('0x28')],_0x3b5fcf[_0x115a('0x53')][_0x115a('0x54')]()));}})[_0x115a('0x3c')](handleError(_0x5cb22f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8812fde..0ba3b98 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 _0x6a8e=['moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','api'];(function(_0x5bd8c1,_0xa4ad55){var _0x378964=function(_0x50b2ae){while(--_0x50b2ae){_0x5bd8c1['push'](_0x5bd8c1['shift']());}};_0x378964(++_0xa4ad55);}(_0x6a8e,0xc4));var _0xe6a8=function(_0x49dd5a,_0x1da7e6){_0x49dd5a=_0x49dd5a-0x0;var _0x91c8da=_0x6a8e[_0x49dd5a];return _0x91c8da;};'use strict';var _=require('lodash');var util=require(_0xe6a8('0x0'));var logger=require('../../config/logger')(_0xe6a8('0x1'));var moment=require(_0xe6a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xe6a8('0x3'));var fs=require('fs');var path=require(_0xe6a8('0x4'));var rimraf=require(_0xe6a8('0x5'));var config=require(_0xe6a8('0x6'));var attributes=require(_0xe6a8('0x7'));module['exports']=function(_0x3907c3,_0x8b2615){return _0x3907c3[_0xe6a8('0x8')](_0xe6a8('0x9'),attributes,{'tableName':_0xe6a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2494=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./analyticExtractedReport.attributes','define','analytics_extracted_reports'];(function(_0x57a1ca,_0x155fca){var _0x33023b=function(_0x2534f9){while(--_0x2534f9){_0x57a1ca['push'](_0x57a1ca['shift']());}};_0x33023b(++_0x155fca);}(_0x2494,0x82));var _0x4249=function(_0x3d4898,_0x371fcd){_0x3d4898=_0x3d4898-0x0;var _0x4ddcd8=_0x2494[_0x3d4898];return _0x4ddcd8;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x4249('0x9'),'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 503b785..64cce96 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 _0x73fe=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xf06274,_0x590246){var _0x3cee7f=function(_0x1e3337){while(--_0x1e3337){_0xf06274['push'](_0xf06274['shift']());}};_0x3cee7f(++_0x590246);}(_0x73fe,0x1e4));var _0xe73f=function(_0x2bc6b6,_0xe0e9c7){_0x2bc6b6=_0x2bc6b6-0x0;var _0x51af64=_0x73fe[_0x2bc6b6];return _0x51af64;};'use strict';var _=require(_0xe73f('0x0'));var util=require(_0xe73f('0x1'));var moment=require('moment');var BPromise=require(_0xe73f('0x2'));var rs=require(_0xe73f('0x3'));var fs=require('fs');var Redis=require(_0xe73f('0x4'));var db=require(_0xe73f('0x5'))['db'];var utils=require(_0xe73f('0x6'));var logger=require(_0xe73f('0x7'))(_0xe73f('0x8'));var config=require(_0xe73f('0x9'));var jayson=require(_0xe73f('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x462deb,_0x15c3f1,_0x5851cd){return new BPromise(function(_0x38337c,_0x37b24a){return client[_0xe73f('0xb')](_0x462deb,_0x5851cd)['then'](function(_0x3c3630){logger[_0xe73f('0xc')](_0xe73f('0xd'),_0x15c3f1,_0xe73f('0xe'));logger['debug'](_0xe73f('0xf'),_0x15c3f1,'request\x20sent',JSON[_0xe73f('0x10')](_0x3c3630));if(_0x3c3630['error']){if(_0x3c3630[_0xe73f('0x11')][_0xe73f('0x12')]===0x1f4){logger[_0xe73f('0x11')](_0xe73f('0xd'),_0x15c3f1,_0x3c3630[_0xe73f('0x11')][_0xe73f('0x13')]);return _0x37b24a(_0x3c3630[_0xe73f('0x11')]['message']);}logger[_0xe73f('0x11')](_0xe73f('0xd'),_0x15c3f1,_0x3c3630[_0xe73f('0x11')][_0xe73f('0x13')]);return _0x38337c(_0x3c3630[_0xe73f('0x11')][_0xe73f('0x13')]);}else{logger[_0xe73f('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x15c3f1,'request\x20sent');_0x38337c(_0x3c3630[_0xe73f('0x14')][_0xe73f('0x13')]);}})[_0xe73f('0x15')](function(_0x5660ed){logger[_0xe73f('0x11')](_0xe73f('0xd'),_0x15c3f1,_0x5660ed);_0x37b24a(_0x5660ed);});});} \ No newline at end of file +var _0x38ec=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x22a672,_0x580495){var _0x2b590e=function(_0x4b1d7a){while(--_0x4b1d7a){_0x22a672['push'](_0x22a672['shift']());}};_0x2b590e(++_0x580495);}(_0x38ec,0x19b));var _0xc38e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x38ec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc38e('0x0'));var util=require(_0xc38e('0x1'));var moment=require('moment');var BPromise=require(_0xc38e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc38e('0x3'));var db=require(_0xc38e('0x4'))['db'];var utils=require(_0xc38e('0x5'));var logger=require(_0xc38e('0x6'))(_0xc38e('0x7'));var config=require(_0xc38e('0x8'));var jayson=require(_0xc38e('0x9'));var client=jayson[_0xc38e('0xa')][_0xc38e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392b52,_0x5d1347,_0x23e4a7){return new BPromise(function(_0x5930e1,_0x3379e2){return client[_0xc38e('0xc')](_0x392b52,_0x23e4a7)[_0xc38e('0xd')](function(_0x693e4b){logger[_0xc38e('0xe')](_0xc38e('0xf'),_0x5d1347,'request\x20sent');logger[_0xc38e('0x10')](_0xc38e('0x11'),_0x5d1347,_0xc38e('0x12'),JSON[_0xc38e('0x13')](_0x693e4b));if(_0x693e4b['error']){if(_0x693e4b['error']['code']===0x1f4){logger[_0xc38e('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5d1347,_0x693e4b[_0xc38e('0x14')][_0xc38e('0x15')]);return _0x3379e2(_0x693e4b[_0xc38e('0x14')][_0xc38e('0x15')]);}logger['error'](_0xc38e('0xf'),_0x5d1347,_0x693e4b[_0xc38e('0x14')][_0xc38e('0x15')]);return _0x5930e1(_0x693e4b[_0xc38e('0x14')]['message']);}else{logger['info'](_0xc38e('0xf'),_0x5d1347,'request\x20sent');_0x5930e1(_0x693e4b[_0xc38e('0x16')][_0xc38e('0x15')]);}})[_0xc38e('0x17')](function(_0x5ddb87){logger[_0xc38e('0x14')](_0xc38e('0xf'),_0x5d1347,_0x5ddb87);_0x3379e2(_0x5ddb87);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 11c7e27..5c6c67c 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 _0x2572=['/:id/download','download','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0xbec404,_0xcda9ae){var _0x787845=function(_0x5d1f4b){while(--_0x5d1f4b){_0xbec404['push'](_0xbec404['shift']());}};_0x787845(++_0xcda9ae);}(_0x2572,0x110));var _0x2257=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2572[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x2257('0x0'));var util=require(_0x2257('0x1'));var path=require(_0x2257('0x2'));var timeout=require(_0x2257('0x3'));var express=require(_0x2257('0x4'));var router=express[_0x2257('0x5')]();var auth=require(_0x2257('0x6'));var interaction=require(_0x2257('0x7'));var config=require(_0x2257('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x2257('0x9')]('/',auth[_0x2257('0xa')](),controller[_0x2257('0xb')]);router[_0x2257('0x9')](_0x2257('0xc'),auth[_0x2257('0xa')](),controller[_0x2257('0xd')]);router[_0x2257('0x9')](_0x2257('0xe'),auth['isAuthenticated'](),controller[_0x2257('0xf')]);router[_0x2257('0x10')]('/',auth['isAuthenticated'](),controller[_0x2257('0x11')]);router[_0x2257('0x12')](_0x2257('0xc'),auth['isAuthenticated'](),controller[_0x2257('0x13')]);router[_0x2257('0x14')](_0x2257('0xc'),auth[_0x2257('0xa')](),controller['destroy']);module[_0x2257('0x15')]=router; \ No newline at end of file +var _0x6611=['destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','show','/:id/download','download','post','isAuthenticated','create','put','update','delete'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x6611,0x1bb));var _0x1661=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6611[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x1661('0x0'));var path=require(_0x1661('0x1'));var timeout=require('connect-timeout');var express=require(_0x1661('0x2'));var router=express[_0x1661('0x3')]();var auth=require(_0x1661('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1661('0x5'));var controller=require(_0x1661('0x6'));router[_0x1661('0x7')]('/',auth['isAuthenticated'](),controller[_0x1661('0x8')]);router['get'](_0x1661('0x9'),auth['isAuthenticated'](),controller[_0x1661('0xa')]);router[_0x1661('0x7')](_0x1661('0xb'),auth['isAuthenticated'](),controller[_0x1661('0xc')]);router[_0x1661('0xd')]('/',auth[_0x1661('0xe')](),controller[_0x1661('0xf')]);router[_0x1661('0x10')](_0x1661('0x9'),auth['isAuthenticated'](),controller[_0x1661('0x11')]);router[_0x1661('0x12')](_0x1661('0x9'),auth[_0x1661('0xe')](),controller[_0x1661('0x13')]);module[_0x1661('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8d4ab1b..9a26f71 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 _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x1f697e,_0x7bb260){var _0x5da78d=function(_0x32d702){while(--_0x32d702){_0x1f697e['push'](_0x1f697e['shift']());}};_0x5da78d(++_0x7bb260);}(_0x1261,0x144));var _0x1126=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x1261[_0x1a89a1];return _0x3d5b46;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x431f56,_0x47ff4e){var _0x494a3c=function(_0xb161fa){while(--_0xb161fa){_0x431f56['push'](_0x431f56['shift']());}};_0x494a3c(++_0x47ff4e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e650971..da96621 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 _0x6f93=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','bulkCreate','update','params','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','then','destroy','error','stack','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','name'];(function(_0x2b57d8,_0x472f3d){var _0xdb7248=function(_0x1c49c3){while(--_0x1c49c3){_0x2b57d8['push'](_0x2b57d8['shift']());}};_0xdb7248(++_0x472f3d);}(_0x6f93,0xb3));var _0x36f9=function(_0x4cd014,_0x40308a){_0x4cd014=_0x4cd014-0x0;var _0x12a63d=_0x6f93[_0x4cd014];return _0x12a63d;};'use strict';var pdf=require(_0x36f9('0x0'));var emlformat=require(_0x36f9('0x1'));var rimraf=require(_0x36f9('0x2'));var zipdir=require(_0x36f9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x36f9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x36f9('0x5'));var path=require(_0x36f9('0x6'));var sox=require(_0x36f9('0x7'));var csv=require(_0x36f9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x36f9('0x9'));var crypto=require('crypto');var jsforce=require(_0x36f9('0xa'));var deskjs=require(_0x36f9('0xb'));var toCsv=require(_0x36f9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x36f9('0xc'));var authService=require(_0x36f9('0xd'));var qs=require(_0x36f9('0xe'));var as=require(_0x36f9('0xf'));var hardwareService=require(_0x36f9('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x36f9('0x11'));var db=require(_0x36f9('0x12'))['db'];function respondWithStatusCode(_0x481fad,_0x1a987b){_0x1a987b=_0x1a987b||0xcc;return function(_0x2315f5){if(_0x2315f5){return _0x481fad[_0x36f9('0x13')](_0x1a987b);}return _0x481fad[_0x36f9('0x14')](_0x1a987b)[_0x36f9('0x15')]();};}function respondWithResult(_0x37c2a4,_0x3fcce2){_0x3fcce2=_0x3fcce2||0xc8;return function(_0x1d2ac5){if(_0x1d2ac5){return _0x37c2a4[_0x36f9('0x14')](_0x3fcce2)[_0x36f9('0x16')](_0x1d2ac5);}};}function respondWithFilteredResult(_0x34c89c,_0x31522d){return function(_0x4801c9){if(_0x4801c9){var _0x461da3=_0x4801c9[_0x36f9('0x17')],_0x5d9ebe=_0x31522d[_0x36f9('0x18')],_0x1cb856=_0x31522d['offset']+_0x31522d[_0x36f9('0x19')],_0x2f17ae;if(_0x1cb856>=_0x461da3){_0x1cb856=_0x461da3;_0x2f17ae=0xc8;}else{_0x2f17ae=0xce;}_0x34c89c[_0x36f9('0x14')](_0x2f17ae);return _0x34c89c[_0x36f9('0x1a')]('Content-Range',_0x5d9ebe+'-'+_0x1cb856+'/'+_0x461da3)[_0x36f9('0x16')](_0x4801c9);}return null;};}function patchUpdates(_0x4d79fa){return function(_0x10605a){try{jsonpatch['apply'](_0x10605a,_0x4d79fa,!![]);}catch(_0x1622a4){return BPromise[_0x36f9('0x1b')](_0x1622a4);}return _0x10605a['save']();};}function saveUpdates(_0x21b52f,_0x32b510){return function(_0xee74b2){if(_0xee74b2){return _0xee74b2['update'](_0x21b52f)[_0x36f9('0x1c')](function(_0x57bea2){return _0x57bea2;});}return null;};}function removeEntity(_0x407916,_0x2af546){return function(_0x26af48){if(_0x26af48){return _0x26af48[_0x36f9('0x1d')]()[_0x36f9('0x1c')](function(){_0x407916[_0x36f9('0x14')](0xcc)[_0x36f9('0x15')]();});}};}function handleEntityNotFound(_0x4a1f40,_0x2d5df2){return function(_0xb67470){if(!_0xb67470){_0x4a1f40['sendStatus'](0x194);}return _0xb67470;};}function handleError(_0xe9a13a,_0x2cdb7e){_0x2cdb7e=_0x2cdb7e||0x1f4;return function(_0x181ec1){logger[_0x36f9('0x1e')](_0x181ec1[_0x36f9('0x1f')]);if(_0x181ec1['name']){delete _0x181ec1['name'];}_0xe9a13a['status'](_0x2cdb7e)['send'](_0x181ec1);};}exports[_0x36f9('0x20')]=function(_0x30a5f0,_0x5b7ee6){var _0x348774={},_0x4c1431={},_0x3ce89d={'count':0x0,'rows':[]};var _0x57c82d=_[_0x36f9('0x21')](db[_0x36f9('0x22')][_0x36f9('0x23')],function(_0x3977bd){return{'name':_0x3977bd[_0x36f9('0x24')],'type':_0x3977bd[_0x36f9('0x25')]['key']};});_0x4c1431[_0x36f9('0x26')]=_['map'](_0x57c82d,_0x36f9('0x27'));_0x4c1431[_0x36f9('0x28')]=_[_0x36f9('0x29')](_0x30a5f0[_0x36f9('0x28')]);_0x4c1431[_0x36f9('0x2a')]=_['intersection'](_0x4c1431[_0x36f9('0x26')],_0x4c1431['query']);_0x348774[_0x36f9('0x2b')]=_[_0x36f9('0x2c')](_0x4c1431['model'],qs[_0x36f9('0x2d')](_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x2d')]));_0x348774[_0x36f9('0x2b')]=_0x348774[_0x36f9('0x2b')][_0x36f9('0x2e')]?_0x348774[_0x36f9('0x2b')]:_0x4c1431[_0x36f9('0x26')];if(!_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x2f')](_0x36f9('0x30'))){_0x348774[_0x36f9('0x19')]=qs[_0x36f9('0x19')](_0x30a5f0['query'][_0x36f9('0x19')]);_0x348774['offset']=qs[_0x36f9('0x18')](_0x30a5f0['query'][_0x36f9('0x18')]);}_0x348774['order']=qs[_0x36f9('0x31')](_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x31')]);_0x348774[_0x36f9('0x32')]=qs[_0x36f9('0x2a')](_[_0x36f9('0x33')](_0x30a5f0[_0x36f9('0x28')],_0x4c1431[_0x36f9('0x2a')]),_0x57c82d);if(_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x34')]){_0x348774[_0x36f9('0x32')]=_[_0x36f9('0x35')](_0x348774['where'],{'$or':_['map'](_0x57c82d,function(_0x4bcc39){if(_0x4bcc39['type']!==_0x36f9('0x36')){var _0x3252e2={};_0x3252e2[_0x4bcc39[_0x36f9('0x27')]]={'$like':'%'+_0x30a5f0[_0x36f9('0x28')][_0x36f9('0x34')]+'%'};return _0x3252e2;}})});}_0x348774=_['merge']({},_0x348774,_0x30a5f0[_0x36f9('0x37')]);var _0x542354={'where':_0x348774[_0x36f9('0x32')]};return db[_0x36f9('0x22')][_0x36f9('0x17')](_0x542354)[_0x36f9('0x1c')](function(_0x50b21a){_0x3ce89d[_0x36f9('0x17')]=_0x50b21a;if(_0x30a5f0[_0x36f9('0x28')]['includeAll']){_0x348774[_0x36f9('0x38')]=[{'all':!![]}];}return db[_0x36f9('0x22')][_0x36f9('0x39')](_0x348774);})['then'](function(_0x12c6b4){_0x3ce89d[_0x36f9('0x3a')]=_0x12c6b4;return _0x3ce89d;})['then'](respondWithFilteredResult(_0x5b7ee6,_0x348774))[_0x36f9('0x3b')](handleError(_0x5b7ee6,null));};exports[_0x36f9('0x3c')]=function(_0x2dd828,_0x3b7d08){var _0x4dc379={'raw':![],'where':{'id':_0x2dd828['params']['id']}},_0x31e6cb={};_0x31e6cb['model']=_[_0x36f9('0x29')](db[_0x36f9('0x22')][_0x36f9('0x23')]);_0x31e6cb[_0x36f9('0x28')]=_[_0x36f9('0x29')](_0x2dd828[_0x36f9('0x28')]);_0x31e6cb[_0x36f9('0x2a')]=_[_0x36f9('0x2c')](_0x31e6cb['model'],_0x31e6cb['query']);_0x4dc379[_0x36f9('0x2b')]=_[_0x36f9('0x2c')](_0x31e6cb[_0x36f9('0x26')],qs['fields'](_0x2dd828[_0x36f9('0x28')][_0x36f9('0x2d')]));_0x4dc379[_0x36f9('0x2b')]=_0x4dc379[_0x36f9('0x2b')][_0x36f9('0x2e')]?_0x4dc379['attributes']:_0x31e6cb[_0x36f9('0x26')];if(_0x2dd828[_0x36f9('0x28')][_0x36f9('0x3d')]){_0x4dc379[_0x36f9('0x38')]=[{'all':!![]}];}_0x4dc379=_[_0x36f9('0x35')]({},_0x4dc379,_0x2dd828[_0x36f9('0x37')]);return db[_0x36f9('0x22')][_0x36f9('0x3e')](_0x4dc379)[_0x36f9('0x1c')](handleEntityNotFound(_0x3b7d08,null))['then'](respondWithResult(_0x3b7d08,null))[_0x36f9('0x3b')](handleError(_0x3b7d08,null));};exports['create']=function(_0x3b9393,_0x24711d){return db[_0x36f9('0x22')][_0x36f9('0x3f')](_0x3b9393[_0x36f9('0x40')],{})[_0x36f9('0x1c')](respondWithResult(_0x24711d,0xc9))[_0x36f9('0x3b')](handleError(_0x24711d,null));};exports[_0x36f9('0x41')]=function(_0x1ff93a,_0x2b86e2){return db[_0x36f9('0x22')][_0x36f9('0x41')](_0x1ff93a[_0x36f9('0x40')],{'raw':![],'individualHooks':!![]})[_0x36f9('0x1c')](respondWithResult(_0x2b86e2,0xc9))[_0x36f9('0x3b')](handleError(_0x2b86e2,null));};exports[_0x36f9('0x42')]=function(_0x22e900,_0x21a575){if(_0x22e900[_0x36f9('0x40')]['id']){delete _0x22e900[_0x36f9('0x40')]['id'];}return db[_0x36f9('0x22')][_0x36f9('0x3e')]({'where':{'id':_0x22e900[_0x36f9('0x43')]['id']}})[_0x36f9('0x1c')](handleEntityNotFound(_0x21a575,null))['then'](saveUpdates(_0x22e900[_0x36f9('0x40')],null))[_0x36f9('0x1c')](respondWithResult(_0x21a575,null))[_0x36f9('0x3b')](handleError(_0x21a575,null));};exports['destroy']=function(_0x1c0d7f,_0x26dabe){return db[_0x36f9('0x22')][_0x36f9('0x3e')]({'where':{'id':_0x1c0d7f['params']['id']}})['then'](handleEntityNotFound(_0x26dabe,null))[_0x36f9('0x1c')](removeEntity(_0x26dabe,null))[_0x36f9('0x3b')](handleError(_0x26dabe,null));};exports['bulkDestroy']=function(_0x50ac2e,_0x1187bb){return db[_0x36f9('0x22')][_0x36f9('0x1d')]({'where':{'id':_0x50ac2e[_0x36f9('0x28')][_0x36f9('0x44')]||[]},'raw':![],'individualHooks':!![]})[_0x36f9('0x1c')](respondWithResult(_0x1187bb,0xcc))['catch'](handleError(_0x1187bb,null));};exports[_0x36f9('0x45')]=function(_0xd884c3,_0x4dcfed,_0x374264){return db[_0x36f9('0x46')][_0x36f9('0x47')]({'where':{'id':_0xd884c3[_0x36f9('0x43')]['id']}})['then'](handleEntityNotFound(_0x4dcfed,null))[_0x36f9('0x1c')](function(_0x1a406f){if(_0x1a406f){return db['sequelize']['transaction'](function(_0x190719){return db[_0x36f9('0x22')][_0x36f9('0x1d')]({'where':{'CustomReportId':_0xd884c3[_0x36f9('0x43')]['id']},'transaction':_0x190719})[_0x36f9('0x1c')](function(_0x5009a3){var _0x3d691d=_[_0x36f9('0x21')](_0xd884c3[_0x36f9('0x40')],function(_0x510497){delete _0x510497['id'];_0x510497[_0x36f9('0x48')]=_0xd884c3[_0x36f9('0x43')]['id'];return _0x510497;});return db[_0x36f9('0x22')][_0x36f9('0x41')](_0x3d691d,{'transaction':_0x190719});});})[_0x36f9('0x1c')](function(){return db[_0x36f9('0x22')][_0x36f9('0x39')]({'where':{'CustomReportId':_0xd884c3[_0x36f9('0x43')]['id']}});});}})[_0x36f9('0x1c')](respondWithResult(_0x4dcfed,null))['catch'](handleError(_0x4dcfed,null));}; \ No newline at end of file +var _0x5d37=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','transaction','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3b4619,_0x40276d){var _0x53fff1=function(_0x5e4ab0){while(--_0x5e4ab0){_0x3b4619['push'](_0x3b4619['shift']());}};_0x53fff1(++_0x40276d);}(_0x5d37,0x135));var _0x75d3=function(_0x886f57,_0xcb8f9e){_0x886f57=_0x886f57-0x0;var _0x3a018c=_0x5d37[_0x886f57];return _0x3a018c;};'use strict';var pdf=require(_0x75d3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x75d3('0x1'));var zipdir=require(_0x75d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75d3('0x3'));var moment=require(_0x75d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75d3('0x5'));var util=require(_0x75d3('0x6'));var path=require(_0x75d3('0x7'));var sox=require(_0x75d3('0x8'));var csv=require(_0x75d3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x75d3('0xa'));var squel=require(_0x75d3('0xb'));var crypto=require(_0x75d3('0xc'));var jsforce=require(_0x75d3('0xd'));var deskjs=require(_0x75d3('0xe'));var toCsv=require(_0x75d3('0x9'));var querystring=require(_0x75d3('0xf'));var Papa=require(_0x75d3('0x10'));var Redis=require(_0x75d3('0x11'));var authService=require(_0x75d3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x75d3('0x13'));var hardwareService=require(_0x75d3('0x14'));var logger=require(_0x75d3('0x15'))(_0x75d3('0x16'));var utils=require('../../config/utils');var config=require(_0x75d3('0x17'));var db=require(_0x75d3('0x18'))['db'];function respondWithStatusCode(_0x1cf720,_0x559713){_0x559713=_0x559713||0xcc;return function(_0x332ac8){if(_0x332ac8){return _0x1cf720['sendStatus'](_0x559713);}return _0x1cf720[_0x75d3('0x19')](_0x559713)[_0x75d3('0x1a')]();};}function respondWithResult(_0x514d7d,_0x29a766){_0x29a766=_0x29a766||0xc8;return function(_0x50d049){if(_0x50d049){return _0x514d7d['status'](_0x29a766)['json'](_0x50d049);}};}function respondWithFilteredResult(_0x3bd5ae,_0x13c72a){return function(_0x45506f){if(_0x45506f){var _0x1b0176=_0x45506f['count'],_0x4f7b9d=_0x13c72a[_0x75d3('0x1b')],_0x472865=_0x13c72a[_0x75d3('0x1b')]+_0x13c72a[_0x75d3('0x1c')],_0xbd65b;if(_0x472865>=_0x1b0176){_0x472865=_0x1b0176;_0xbd65b=0xc8;}else{_0xbd65b=0xce;}_0x3bd5ae[_0x75d3('0x19')](_0xbd65b);return _0x3bd5ae['set'](_0x75d3('0x1d'),_0x4f7b9d+'-'+_0x472865+'/'+_0x1b0176)[_0x75d3('0x1e')](_0x45506f);}return null;};}function patchUpdates(_0x40d8da){return function(_0x2aeccc){try{jsonpatch[_0x75d3('0x1f')](_0x2aeccc,_0x40d8da,!![]);}catch(_0x45638d){return BPromise[_0x75d3('0x20')](_0x45638d);}return _0x2aeccc[_0x75d3('0x21')]();};}function saveUpdates(_0x35c9f9,_0x293544){return function(_0x194c00){if(_0x194c00){return _0x194c00[_0x75d3('0x22')](_0x35c9f9)[_0x75d3('0x23')](function(_0x599313){return _0x599313;});}return null;};}function removeEntity(_0x2c36e5,_0x24a03a){return function(_0xca37c0){if(_0xca37c0){return _0xca37c0[_0x75d3('0x24')]()[_0x75d3('0x23')](function(){_0x2c36e5[_0x75d3('0x19')](0xcc)[_0x75d3('0x1a')]();});}};}function handleEntityNotFound(_0x7e3e5b,_0x3cb9ce){return function(_0x39d40e){if(!_0x39d40e){_0x7e3e5b['sendStatus'](0x194);}return _0x39d40e;};}function handleError(_0x317e73,_0x2f798b){_0x2f798b=_0x2f798b||0x1f4;return function(_0x3ae72d){logger[_0x75d3('0x25')](_0x3ae72d[_0x75d3('0x26')]);if(_0x3ae72d[_0x75d3('0x27')]){delete _0x3ae72d[_0x75d3('0x27')];}_0x317e73[_0x75d3('0x19')](_0x2f798b)[_0x75d3('0x28')](_0x3ae72d);};}exports[_0x75d3('0x29')]=function(_0x1fbc66,_0x32ec0b){var _0xf51033={},_0x4d6a99={},_0x53e043={'count':0x0,'rows':[]};var _0x423973=_['map'](db[_0x75d3('0x2a')][_0x75d3('0x2b')],function(_0x566917){return{'name':_0x566917[_0x75d3('0x2c')],'type':_0x566917['type'][_0x75d3('0x2d')]};});_0x4d6a99[_0x75d3('0x2e')]=_['map'](_0x423973,_0x75d3('0x27'));_0x4d6a99[_0x75d3('0x2f')]=_['keys'](_0x1fbc66[_0x75d3('0x2f')]);_0x4d6a99[_0x75d3('0x30')]=_[_0x75d3('0x31')](_0x4d6a99['model'],_0x4d6a99[_0x75d3('0x2f')]);_0xf51033['attributes']=_[_0x75d3('0x31')](_0x4d6a99['model'],qs[_0x75d3('0x32')](_0x1fbc66[_0x75d3('0x2f')]['fields']));_0xf51033[_0x75d3('0x33')]=_0xf51033[_0x75d3('0x33')][_0x75d3('0x34')]?_0xf51033[_0x75d3('0x33')]:_0x4d6a99[_0x75d3('0x2e')];if(!_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x35')](_0x75d3('0x36'))){_0xf51033[_0x75d3('0x1c')]=qs[_0x75d3('0x1c')](_0x1fbc66[_0x75d3('0x2f')]['limit']);_0xf51033[_0x75d3('0x1b')]=qs[_0x75d3('0x1b')](_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x1b')]);}_0xf51033[_0x75d3('0x37')]=qs[_0x75d3('0x38')](_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x38')]);_0xf51033['where']=qs[_0x75d3('0x30')](_[_0x75d3('0x39')](_0x1fbc66['query'],_0x4d6a99['filters']),_0x423973);if(_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x3a')]){_0xf51033[_0x75d3('0x3b')]=_[_0x75d3('0x3c')](_0xf51033[_0x75d3('0x3b')],{'$or':_[_0x75d3('0x3d')](_0x423973,function(_0x3903a4){if(_0x3903a4[_0x75d3('0x3e')]!==_0x75d3('0x3f')){var _0x481c66={};_0x481c66[_0x3903a4[_0x75d3('0x27')]]={'$like':'%'+_0x1fbc66['query'][_0x75d3('0x3a')]+'%'};return _0x481c66;}})});}_0xf51033=_[_0x75d3('0x3c')]({},_0xf51033,_0x1fbc66[_0x75d3('0x40')]);var _0x2624ef={'where':_0xf51033['where']};return db['AnalyticFieldReport'][_0x75d3('0x41')](_0x2624ef)[_0x75d3('0x23')](function(_0x3c4a03){_0x53e043[_0x75d3('0x41')]=_0x3c4a03;if(_0x1fbc66[_0x75d3('0x2f')][_0x75d3('0x42')]){_0xf51033[_0x75d3('0x43')]=[{'all':!![]}];}return db[_0x75d3('0x2a')][_0x75d3('0x44')](_0xf51033);})[_0x75d3('0x23')](function(_0x374c59){_0x53e043[_0x75d3('0x45')]=_0x374c59;return _0x53e043;})[_0x75d3('0x23')](respondWithFilteredResult(_0x32ec0b,_0xf51033))[_0x75d3('0x46')](handleError(_0x32ec0b,null));};exports['show']=function(_0x31fb8e,_0x4d813c){var _0x5e9aa4={'raw':![],'where':{'id':_0x31fb8e[_0x75d3('0x47')]['id']}},_0x5813f1={};_0x5813f1['model']=_['keys'](db['AnalyticFieldReport'][_0x75d3('0x2b')]);_0x5813f1[_0x75d3('0x2f')]=_[_0x75d3('0x48')](_0x31fb8e['query']);_0x5813f1[_0x75d3('0x30')]=_[_0x75d3('0x31')](_0x5813f1[_0x75d3('0x2e')],_0x5813f1['query']);_0x5e9aa4[_0x75d3('0x33')]=_[_0x75d3('0x31')](_0x5813f1[_0x75d3('0x2e')],qs['fields'](_0x31fb8e[_0x75d3('0x2f')]['fields']));_0x5e9aa4[_0x75d3('0x33')]=_0x5e9aa4[_0x75d3('0x33')]['length']?_0x5e9aa4[_0x75d3('0x33')]:_0x5813f1[_0x75d3('0x2e')];if(_0x31fb8e[_0x75d3('0x2f')][_0x75d3('0x42')]){_0x5e9aa4[_0x75d3('0x43')]=[{'all':!![]}];}_0x5e9aa4=_[_0x75d3('0x3c')]({},_0x5e9aa4,_0x31fb8e[_0x75d3('0x40')]);return db[_0x75d3('0x2a')][_0x75d3('0x49')](_0x5e9aa4)[_0x75d3('0x23')](handleEntityNotFound(_0x4d813c,null))[_0x75d3('0x23')](respondWithResult(_0x4d813c,null))['catch'](handleError(_0x4d813c,null));};exports[_0x75d3('0x4a')]=function(_0x3b8a23,_0x275d37){return db['AnalyticFieldReport'][_0x75d3('0x4a')](_0x3b8a23[_0x75d3('0x4b')],{})[_0x75d3('0x23')](respondWithResult(_0x275d37,0xc9))[_0x75d3('0x46')](handleError(_0x275d37,null));};exports['bulkCreate']=function(_0x5ab7f7,_0x276878){return db[_0x75d3('0x2a')][_0x75d3('0x4c')](_0x5ab7f7[_0x75d3('0x4b')],{'raw':![],'individualHooks':!![]})[_0x75d3('0x23')](respondWithResult(_0x276878,0xc9))['catch'](handleError(_0x276878,null));};exports[_0x75d3('0x22')]=function(_0x14005c,_0x117289){if(_0x14005c['body']['id']){delete _0x14005c[_0x75d3('0x4b')]['id'];}return db[_0x75d3('0x2a')][_0x75d3('0x49')]({'where':{'id':_0x14005c[_0x75d3('0x47')]['id']}})[_0x75d3('0x23')](handleEntityNotFound(_0x117289,null))['then'](saveUpdates(_0x14005c[_0x75d3('0x4b')],null))['then'](respondWithResult(_0x117289,null))[_0x75d3('0x46')](handleError(_0x117289,null));};exports['destroy']=function(_0x1184ff,_0x243f95){return db['AnalyticFieldReport']['find']({'where':{'id':_0x1184ff[_0x75d3('0x47')]['id']}})[_0x75d3('0x23')](handleEntityNotFound(_0x243f95,null))[_0x75d3('0x23')](removeEntity(_0x243f95,null))['catch'](handleError(_0x243f95,null));};exports[_0x75d3('0x4d')]=function(_0x1275c1,_0x391ec0){return db[_0x75d3('0x2a')][_0x75d3('0x24')]({'where':{'id':_0x1275c1[_0x75d3('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x75d3('0x23')](respondWithResult(_0x391ec0,0xcc))['catch'](handleError(_0x391ec0,null));};exports[_0x75d3('0x4e')]=function(_0x477138,_0x2eeec1,_0x4f3a0f){return db[_0x75d3('0x4f')][_0x75d3('0x50')]({'where':{'id':_0x477138[_0x75d3('0x47')]['id']}})[_0x75d3('0x23')](handleEntityNotFound(_0x2eeec1,null))[_0x75d3('0x23')](function(_0x21ddf0){if(_0x21ddf0){return db['sequelize'][_0x75d3('0x51')](function(_0x370505){return db['AnalyticFieldReport'][_0x75d3('0x24')]({'where':{'CustomReportId':_0x477138[_0x75d3('0x47')]['id']},'transaction':_0x370505})[_0x75d3('0x23')](function(_0x2cb4e4){var _0x53712c=_[_0x75d3('0x3d')](_0x477138[_0x75d3('0x4b')],function(_0x207e6d){delete _0x207e6d['id'];_0x207e6d['CustomReportId']=_0x477138['params']['id'];return _0x207e6d;});return db[_0x75d3('0x2a')][_0x75d3('0x4c')](_0x53712c,{'transaction':_0x370505});});})[_0x75d3('0x23')](function(){return db[_0x75d3('0x2a')]['findAll']({'where':{'CustomReportId':_0x477138['params']['id']}});});}})['then'](respondWithResult(_0x2eeec1,null))['catch'](handleError(_0x2eeec1,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 34f8aca..8d05ee4 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 _0x7283=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','request-promise'];(function(_0x269ab2,_0x431eda){var _0x52ae97=function(_0x431ca1){while(--_0x431ca1){_0x269ab2['push'](_0x269ab2['shift']());}};_0x52ae97(++_0x431eda);}(_0x7283,0x18e));var _0x3728=function(_0x33ad7e,_0x135618){_0x33ad7e=_0x33ad7e-0x0;var _0x280712=_0x7283[_0x33ad7e];return _0x280712;};'use strict';var _=require(_0x3728('0x0'));var util=require(_0x3728('0x1'));var logger=require(_0x3728('0x2'))('api');var moment=require(_0x3728('0x3'));var BPromise=require('bluebird');var rp=require(_0x3728('0x4'));var fs=require('fs');var path=require(_0x3728('0x5'));var rimraf=require(_0x3728('0x6'));var config=require(_0x3728('0x7'));var attributes=require(_0x3728('0x8'));module[_0x3728('0x9')]=function(_0x14a8c7,_0x4d47e0){return _0x14a8c7[_0x3728('0xa')](_0x3728('0xb'),attributes,{'tableName':_0x3728('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4185=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','AnalyticFieldReport','util'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x4185,0x1b7));var _0x5418=function(_0x3dd338,_0x5ecec6){_0x3dd338=_0x3dd338-0x0;var _0x1572a2=_0x4185[_0x3dd338];return _0x1572a2;};'use strict';var _=require('lodash');var util=require(_0x5418('0x0'));var logger=require(_0x5418('0x1'))(_0x5418('0x2'));var moment=require(_0x5418('0x3'));var BPromise=require(_0x5418('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5418('0x5'));var rimraf=require('rimraf');var config=require(_0x5418('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x5418('0x7')]=function(_0x3e4002,_0x5077bc){return _0x3e4002[_0x5418('0x8')](_0x5418('0x9'),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 0fc3cf6..22dd61d 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 _0xadaa=['../../config/logger','client','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xadaa,0x85));var _0xaada=function(_0x27357e,_0x2a8501){_0x27357e=_0x27357e-0x0;var _0x149b3e=_0xadaa[_0x27357e];return _0x149b3e;};'use strict';var _=require(_0xaada('0x0'));var util=require('util');var moment=require(_0xaada('0x1'));var BPromise=require(_0xaada('0x2'));var rs=require(_0xaada('0x3'));var fs=require('fs');var Redis=require(_0xaada('0x4'));var db=require(_0xaada('0x5'))['db'];var utils=require(_0xaada('0x6'));var logger=require(_0xaada('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaada('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17dd9,_0x5515f9,_0x31b092){return new BPromise(function(_0x28be4d,_0x17de6c){return client['request'](_0x17dd9,_0x31b092)[_0xaada('0x9')](function(_0x3f99e7){logger[_0xaada('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5515f9,_0xaada('0xb'));logger['debug'](_0xaada('0xc'),_0x5515f9,_0xaada('0xb'),JSON[_0xaada('0xd')](_0x3f99e7));if(_0x3f99e7['error']){if(_0x3f99e7[_0xaada('0xe')][_0xaada('0xf')]===0x1f4){logger['error'](_0xaada('0x10'),_0x5515f9,_0x3f99e7[_0xaada('0xe')][_0xaada('0x11')]);return _0x17de6c(_0x3f99e7[_0xaada('0xe')]['message']);}logger[_0xaada('0xe')](_0xaada('0x10'),_0x5515f9,_0x3f99e7[_0xaada('0xe')]['message']);return _0x28be4d(_0x3f99e7['error'][_0xaada('0x11')]);}else{logger[_0xaada('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5515f9,_0xaada('0xb'));_0x28be4d(_0x3f99e7[_0xaada('0x12')][_0xaada('0x11')]);}})[_0xaada('0x13')](function(_0x5ddc61){logger[_0xaada('0xe')](_0xaada('0x10'),_0x5515f9,_0x5ddc61);_0x17de6c(_0x5ddc61);});});} \ No newline at end of file +var _0x7f2e=['message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x8f4554,_0x97e1f8){var _0x2b7465=function(_0x5d8390){while(--_0x5d8390){_0x8f4554['push'](_0x8f4554['shift']());}};_0x2b7465(++_0x97e1f8);}(_0x7f2e,0x1ce));var _0xe7f2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7f2e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe7f2('0x0'));var util=require(_0xe7f2('0x1'));var moment=require(_0xe7f2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7f2('0x4'))['db'];var utils=require(_0xe7f2('0x5'));var logger=require(_0xe7f2('0x6'))(_0xe7f2('0x7'));var config=require('../../config/environment');var jayson=require(_0xe7f2('0x8'));var client=jayson['client'][_0xe7f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2716b4,_0x15f371,_0x5652a3){return new BPromise(function(_0x1d470e,_0x22012e){return client['request'](_0x2716b4,_0x5652a3)[_0xe7f2('0xa')](function(_0x129312){logger[_0xe7f2('0xb')](_0xe7f2('0xc'),_0x15f371,_0xe7f2('0xd'));logger[_0xe7f2('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x15f371,'request\x20sent',JSON[_0xe7f2('0xf')](_0x129312));if(_0x129312[_0xe7f2('0x10')]){if(_0x129312[_0xe7f2('0x10')][_0xe7f2('0x11')]===0x1f4){logger[_0xe7f2('0x10')](_0xe7f2('0xc'),_0x15f371,_0x129312[_0xe7f2('0x10')][_0xe7f2('0x12')]);return _0x22012e(_0x129312[_0xe7f2('0x10')]['message']);}logger[_0xe7f2('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15f371,_0x129312[_0xe7f2('0x10')]['message']);return _0x1d470e(_0x129312[_0xe7f2('0x10')][_0xe7f2('0x12')]);}else{logger[_0xe7f2('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15f371,_0xe7f2('0xd'));_0x1d470e(_0x129312[_0xe7f2('0x13')][_0xe7f2('0x12')]);}})['catch'](function(_0x519d8d){logger[_0xe7f2('0x10')](_0xe7f2('0xc'),_0x15f371,_0x519d8d);_0x22012e(_0x519d8d);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index f4ad54e..2b48f55 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 _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x118749,_0x50e848){var _0x20d489=function(_0x3c80a2){while(--_0x3c80a2){_0x118749['push'](_0x118749['shift']());}};_0x20d489(++_0x50e848);}(_0xe14b,0x93));var _0xbe14=function(_0x51ab3b,_0x9f5d8d){_0x51ab3b=_0x51ab3b-0x0;var _0x30cac3=_0xe14b[_0x51ab3b];return _0x30cac3;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file +var _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x55ca,0x126));var _0xa55c=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0x55ca[_0x412b2a];return _0x5872e3;};'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('0xb')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',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/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index ed6d75a..28857b4 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 _0xa9e1=['STRING','TEXT','sequelize','exports','name'];(function(_0x9b2535,_0x30c0a7){var _0x2f2a91=function(_0x731744){while(--_0x731744){_0x9b2535['push'](_0x9b2535['shift']());}};_0x2f2a91(++_0x30c0a7);}(_0xa9e1,0x7a));var _0x1a9e=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0xa9e1[_0x37ae26];return _0x1b1902;};'use strict';var Sequelize=require(_0x1a9e('0x0'));module[_0x1a9e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1a9e('0x2')},'table':{'type':Sequelize[_0x1a9e('0x3')]},'metric':{'type':Sequelize[_0x1a9e('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2c5b=['name','sequelize','STRING'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x2c5b,0x193));var _0xb2c5=function(_0x3f938a,_0x59fff1){_0x3f938a=_0x3f938a-0x0;var _0x500d6a=_0x2c5b[_0x3f938a];return _0x500d6a;};'use strict';var Sequelize=require(_0xb2c5('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2c5('0x1')],'allowNull':![],'unique':_0xb2c5('0x2')},'table':{'type':Sequelize[_0xb2c5('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 12c573c..17e0a9d 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 _0xb574=['model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','then','destroy','Metrics','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','key'];(function(_0x4dc00b,_0x229642){var _0x38a107=function(_0x231d7f){while(--_0x231d7f){_0x4dc00b['push'](_0x4dc00b['shift']());}};_0x38a107(++_0x229642);}(_0xb574,0x106));var _0x4b57=function(_0x26dbd8,_0x345f9f){_0x26dbd8=_0x26dbd8-0x0;var _0xe4a077=_0xb574[_0x26dbd8];return _0xe4a077;};'use strict';var pdf=require(_0x4b57('0x0'));var emlformat=require(_0x4b57('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4b57('0x2'));var jsonpatch=require(_0x4b57('0x3'));var rp=require('request-promise');var moment=require(_0x4b57('0x4'));var BPromise=require(_0x4b57('0x5'));var Mustache=require(_0x4b57('0x6'));var util=require(_0x4b57('0x7'));var path=require(_0x4b57('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b57('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2701ab,_0x357c8b){_0x357c8b=_0x357c8b||0xcc;return function(_0x43d066){if(_0x43d066){return _0x2701ab[_0x4b57('0x15')](_0x357c8b);}return _0x2701ab[_0x4b57('0x16')](_0x357c8b)[_0x4b57('0x17')]();};}function respondWithResult(_0x30f685,_0xd5ee6d){_0xd5ee6d=_0xd5ee6d||0xc8;return function(_0x31cced){if(_0x31cced){return _0x30f685['status'](_0xd5ee6d)['json'](_0x31cced);}};}function respondWithFilteredResult(_0x236c95,_0x24f776){return function(_0x10b9ff){if(_0x10b9ff){var _0x58d6bd=_0x10b9ff[_0x4b57('0x18')],_0x284640=_0x24f776[_0x4b57('0x19')],_0x48bd13=_0x24f776[_0x4b57('0x19')]+_0x24f776[_0x4b57('0x1a')],_0x159ce5;if(_0x48bd13>=_0x58d6bd){_0x48bd13=_0x58d6bd;_0x159ce5=0xc8;}else{_0x159ce5=0xce;}_0x236c95[_0x4b57('0x16')](_0x159ce5);return _0x236c95['set'](_0x4b57('0x1b'),_0x284640+'-'+_0x48bd13+'/'+_0x58d6bd)[_0x4b57('0x1c')](_0x10b9ff);}return null;};}function patchUpdates(_0x53f29a){return function(_0x402bb9){try{jsonpatch['apply'](_0x402bb9,_0x53f29a,!![]);}catch(_0xb62450){return BPromise[_0x4b57('0x1d')](_0xb62450);}return _0x402bb9[_0x4b57('0x1e')]();};}function saveUpdates(_0x2682d6,_0xef1eae){return function(_0x4454c8){if(_0x4454c8){return _0x4454c8['update'](_0x2682d6)[_0x4b57('0x1f')](function(_0x131fed){return _0x131fed;});}return null;};}function removeEntity(_0x2c7c87,_0x567d8f){return function(_0x380554){if(_0x380554){return _0x380554[_0x4b57('0x20')]()[_0x4b57('0x1f')](function(){var _0x1fa78d=_0x380554['get']({'plain':!![]});var _0x271361=_0x4b57('0x21');return db['UserProfileResource'][_0x4b57('0x20')]({'where':{'type':_0x271361,'resourceId':_0x1fa78d['id']}})[_0x4b57('0x1f')](function(){return _0x380554;});})[_0x4b57('0x1f')](function(){_0x2c7c87[_0x4b57('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x156962,_0x51d0c3){return function(_0x131dab){if(!_0x131dab){_0x156962['sendStatus'](0x194);}return _0x131dab;};}function handleError(_0x36ceb1,_0x2dc9d8){_0x2dc9d8=_0x2dc9d8||0x1f4;return function(_0x4af2c8){logger[_0x4b57('0x22')](_0x4af2c8[_0x4b57('0x23')]);if(_0x4af2c8[_0x4b57('0x24')]){delete _0x4af2c8['name'];}_0x36ceb1['status'](_0x2dc9d8)[_0x4b57('0x25')](_0x4af2c8);};}exports['index']=function(_0x1ea0cb,_0x458f70){var _0x874cf7={},_0x3af22f={},_0x249461={'count':0x0,'rows':[]};var _0x2c20d2=_['map'](db[_0x4b57('0x26')][_0x4b57('0x27')],function(_0x68be27){return{'name':_0x68be27[_0x4b57('0x28')],'type':_0x68be27['type'][_0x4b57('0x29')]};});_0x3af22f[_0x4b57('0x2a')]=_['map'](_0x2c20d2,_0x4b57('0x24'));_0x3af22f[_0x4b57('0x2b')]=_[_0x4b57('0x2c')](_0x1ea0cb[_0x4b57('0x2b')]);_0x3af22f['filters']=_['intersection'](_0x3af22f['model'],_0x3af22f[_0x4b57('0x2b')]);_0x874cf7[_0x4b57('0x2d')]=_[_0x4b57('0x2e')](_0x3af22f[_0x4b57('0x2a')],qs[_0x4b57('0x2f')](_0x1ea0cb['query'][_0x4b57('0x2f')]));_0x874cf7[_0x4b57('0x2d')]=_0x874cf7[_0x4b57('0x2d')]['length']?_0x874cf7[_0x4b57('0x2d')]:_0x3af22f[_0x4b57('0x2a')];if(!_0x1ea0cb[_0x4b57('0x2b')]['hasOwnProperty'](_0x4b57('0x30'))){_0x874cf7[_0x4b57('0x1a')]=qs['limit'](_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x1a')]);_0x874cf7[_0x4b57('0x19')]=qs[_0x4b57('0x19')](_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x19')]);}_0x874cf7['order']=qs[_0x4b57('0x31')](_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x31')]);_0x874cf7[_0x4b57('0x32')]=qs[_0x4b57('0x33')](_[_0x4b57('0x34')](_0x1ea0cb[_0x4b57('0x2b')],_0x3af22f['filters']),_0x2c20d2);if(_0x1ea0cb['query'][_0x4b57('0x35')]){_0x874cf7[_0x4b57('0x32')]=_[_0x4b57('0x36')](_0x874cf7['where'],{'$or':_[_0x4b57('0x37')](_0x2c20d2,function(_0x1a3c3a){if(_0x1a3c3a[_0x4b57('0x38')]!==_0x4b57('0x39')){var _0x5487cc={};_0x5487cc[_0x1a3c3a[_0x4b57('0x24')]]={'$like':'%'+_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x35')]+'%'};return _0x5487cc;}})});}_0x874cf7=_[_0x4b57('0x36')]({},_0x874cf7,_0x1ea0cb['options']);var _0x5766a6={'where':_0x874cf7['where']};return db[_0x4b57('0x26')][_0x4b57('0x18')](_0x5766a6)[_0x4b57('0x1f')](function(_0x2e23d3){_0x249461['count']=_0x2e23d3;if(_0x1ea0cb[_0x4b57('0x2b')][_0x4b57('0x3a')]){_0x874cf7[_0x4b57('0x3b')]=[{'all':!![]}];}return db[_0x4b57('0x26')][_0x4b57('0x3c')](_0x874cf7);})[_0x4b57('0x1f')](function(_0x2d5a0c){_0x249461[_0x4b57('0x3d')]=_0x2d5a0c;return _0x249461;})[_0x4b57('0x1f')](respondWithFilteredResult(_0x458f70,_0x874cf7))['catch'](handleError(_0x458f70,null));};exports[_0x4b57('0x3e')]=function(_0x3685fd,_0x3c5095){var _0x5b2f50={'raw':!![],'where':{'id':_0x3685fd['params']['id']}},_0x44f988={};_0x44f988[_0x4b57('0x2a')]=_[_0x4b57('0x2c')](db[_0x4b57('0x26')][_0x4b57('0x27')]);_0x44f988[_0x4b57('0x2b')]=_[_0x4b57('0x2c')](_0x3685fd[_0x4b57('0x2b')]);_0x44f988[_0x4b57('0x33')]=_[_0x4b57('0x2e')](_0x44f988[_0x4b57('0x2a')],_0x44f988[_0x4b57('0x2b')]);_0x5b2f50[_0x4b57('0x2d')]=_[_0x4b57('0x2e')](_0x44f988['model'],qs['fields'](_0x3685fd[_0x4b57('0x2b')][_0x4b57('0x2f')]));_0x5b2f50[_0x4b57('0x2d')]=_0x5b2f50[_0x4b57('0x2d')]['length']?_0x5b2f50[_0x4b57('0x2d')]:_0x44f988[_0x4b57('0x2a')];if(_0x3685fd['query'][_0x4b57('0x3a')]){_0x5b2f50['include']=[{'all':!![]}];}_0x5b2f50=_[_0x4b57('0x36')]({},_0x5b2f50,_0x3685fd['options']);return db['AnalyticMetric'][_0x4b57('0x3f')](_0x5b2f50)[_0x4b57('0x1f')](handleEntityNotFound(_0x3c5095,null))['then'](respondWithResult(_0x3c5095,null))[_0x4b57('0x40')](handleError(_0x3c5095,null));};exports[_0x4b57('0x41')]=function(_0x2732ff,_0x1cf1f3){return db[_0x4b57('0x26')][_0x4b57('0x41')](_0x2732ff['body'],{})[_0x4b57('0x1f')](function(_0x2833f4){var _0x4a632c=_0x2732ff[_0x4b57('0x42')][_0x4b57('0x43')]({'plain':!![]});if(!_0x4a632c)throw new Error(_0x4b57('0x44'));if(_0x4a632c['role']===_0x4b57('0x42')){var _0x5cba5f=_0x2833f4[_0x4b57('0x43')]({'plain':!![]});var _0xfbe7ed=_0x4b57('0x21');return db[_0x4b57('0x45')][_0x4b57('0x3f')]({'where':{'name':_0xfbe7ed,'userProfileId':_0x4a632c[_0x4b57('0x46')]},'raw':!![]})[_0x4b57('0x1f')](function(_0x3ec6ba){if(_0x3ec6ba&&_0x3ec6ba['autoAssociation']===0x0){return db[_0x4b57('0x47')][_0x4b57('0x41')]({'name':_0x5cba5f[_0x4b57('0x24')],'resourceId':_0x5cba5f['id'],'type':_0x3ec6ba['name'],'sectionId':_0x3ec6ba['id']},{})[_0x4b57('0x1f')](function(){return _0x2833f4;});}else{return _0x2833f4;}})[_0x4b57('0x40')](function(_0x32985f){logger['error'](_0x4b57('0x48'),_0x32985f);throw _0x32985f;});}return _0x2833f4;})[_0x4b57('0x1f')](respondWithResult(_0x1cf1f3,0xc9))[_0x4b57('0x40')](handleError(_0x1cf1f3,null));};exports[_0x4b57('0x49')]=function(_0x44494f,_0xb7c37c){if(_0x44494f[_0x4b57('0x4a')]['id']){delete _0x44494f['body']['id'];}return db['AnalyticMetric'][_0x4b57('0x3f')]({'where':{'id':_0x44494f[_0x4b57('0x4b')]['id']}})[_0x4b57('0x1f')](handleEntityNotFound(_0xb7c37c,null))[_0x4b57('0x1f')](saveUpdates(_0x44494f['body'],null))[_0x4b57('0x1f')](respondWithResult(_0xb7c37c,null))[_0x4b57('0x40')](handleError(_0xb7c37c,null));};exports[_0x4b57('0x20')]=function(_0xee171b,_0x4857c3){return db['AnalyticMetric'][_0x4b57('0x3f')]({'where':{'id':_0xee171b[_0x4b57('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4857c3,null))['then'](removeEntity(_0x4857c3,null))[_0x4b57('0x40')](handleError(_0x4857c3,null));}; \ No newline at end of file +var _0x0120=['fields','length','hasOwnProperty','nolimit','sort','where','pick','type','filter','merge','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Metrics','end','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','key','model','query','filters','intersection','attributes'];(function(_0x594aaf,_0x4a9273){var _0x2692aa=function(_0x417e46){while(--_0x417e46){_0x594aaf['push'](_0x594aaf['shift']());}};_0x2692aa(++_0x4a9273);}(_0x0120,0x6f));var _0x0012=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0120[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x0012('0x0'));var emlformat=require(_0x0012('0x1'));var rimraf=require(_0x0012('0x2'));var zipdir=require(_0x0012('0x3'));var jsonpatch=require(_0x0012('0x4'));var rp=require(_0x0012('0x5'));var moment=require(_0x0012('0x6'));var BPromise=require(_0x0012('0x7'));var Mustache=require(_0x0012('0x8'));var util=require(_0x0012('0x9'));var path=require(_0x0012('0xa'));var sox=require(_0x0012('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0x10'));var querystring=require('querystring');var Papa=require(_0x0012('0x11'));var Redis=require(_0x0012('0x12'));var authService=require(_0x0012('0x13'));var qs=require(_0x0012('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x15'));var logger=require('../../config/logger')(_0x0012('0x16'));var utils=require(_0x0012('0x17'));var config=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];function respondWithStatusCode(_0x2451b5,_0x4d3e7a){_0x4d3e7a=_0x4d3e7a||0xcc;return function(_0x6d4a1a){if(_0x6d4a1a){return _0x2451b5['sendStatus'](_0x4d3e7a);}return _0x2451b5['status'](_0x4d3e7a)['end']();};}function respondWithResult(_0x5563fc,_0x3a7d50){_0x3a7d50=_0x3a7d50||0xc8;return function(_0x496a2b){if(_0x496a2b){return _0x5563fc[_0x0012('0x1a')](_0x3a7d50)[_0x0012('0x1b')](_0x496a2b);}};}function respondWithFilteredResult(_0x47a6ef,_0x24f4ed){return function(_0x1a0c0d){if(_0x1a0c0d){var _0x348810=_0x1a0c0d[_0x0012('0x1c')],_0x3b8dfc=_0x24f4ed[_0x0012('0x1d')],_0x522e9b=_0x24f4ed[_0x0012('0x1d')]+_0x24f4ed[_0x0012('0x1e')],_0x4e72da;if(_0x522e9b>=_0x348810){_0x522e9b=_0x348810;_0x4e72da=0xc8;}else{_0x4e72da=0xce;}_0x47a6ef[_0x0012('0x1a')](_0x4e72da);return _0x47a6ef[_0x0012('0x1f')](_0x0012('0x20'),_0x3b8dfc+'-'+_0x522e9b+'/'+_0x348810)[_0x0012('0x1b')](_0x1a0c0d);}return null;};}function patchUpdates(_0x5b236f){return function(_0x226968){try{jsonpatch[_0x0012('0x21')](_0x226968,_0x5b236f,!![]);}catch(_0x5797dd){return BPromise[_0x0012('0x22')](_0x5797dd);}return _0x226968[_0x0012('0x23')]();};}function saveUpdates(_0xa2e623,_0x2c837e){return function(_0x53ac2d){if(_0x53ac2d){return _0x53ac2d['update'](_0xa2e623)[_0x0012('0x24')](function(_0x1c6583){return _0x1c6583;});}return null;};}function removeEntity(_0x35f9ee,_0x7177bc){return function(_0x190f07){if(_0x190f07){return _0x190f07[_0x0012('0x25')]()[_0x0012('0x24')](function(){var _0x108b65=_0x190f07['get']({'plain':!![]});var _0x24674c=_0x0012('0x26');return db['UserProfileResource'][_0x0012('0x25')]({'where':{'type':_0x24674c,'resourceId':_0x108b65['id']}})[_0x0012('0x24')](function(){return _0x190f07;});})[_0x0012('0x24')](function(){_0x35f9ee[_0x0012('0x1a')](0xcc)[_0x0012('0x27')]();});}};}function handleEntityNotFound(_0x5e820b,_0x351ffd){return function(_0x18b0a7){if(!_0x18b0a7){_0x5e820b[_0x0012('0x28')](0x194);}return _0x18b0a7;};}function handleError(_0x2a0302,_0x173cb3){_0x173cb3=_0x173cb3||0x1f4;return function(_0xb37ef5){logger[_0x0012('0x29')](_0xb37ef5[_0x0012('0x2a')]);if(_0xb37ef5[_0x0012('0x2b')]){delete _0xb37ef5[_0x0012('0x2b')];}_0x2a0302[_0x0012('0x1a')](_0x173cb3)[_0x0012('0x2c')](_0xb37ef5);};}exports[_0x0012('0x2d')]=function(_0x3ce788,_0x1282bb){var _0x276389={},_0x1b676d={},_0x1f4a0a={'count':0x0,'rows':[]};var _0x1c23e0=_[_0x0012('0x2e')](db[_0x0012('0x2f')]['rawAttributes'],function(_0x283134){return{'name':_0x283134[_0x0012('0x30')],'type':_0x283134['type'][_0x0012('0x31')]};});_0x1b676d[_0x0012('0x32')]=_[_0x0012('0x2e')](_0x1c23e0,_0x0012('0x2b'));_0x1b676d[_0x0012('0x33')]=_['keys'](_0x3ce788[_0x0012('0x33')]);_0x1b676d[_0x0012('0x34')]=_[_0x0012('0x35')](_0x1b676d['model'],_0x1b676d[_0x0012('0x33')]);_0x276389[_0x0012('0x36')]=_[_0x0012('0x35')](_0x1b676d[_0x0012('0x32')],qs[_0x0012('0x37')](_0x3ce788[_0x0012('0x33')]['fields']));_0x276389[_0x0012('0x36')]=_0x276389[_0x0012('0x36')][_0x0012('0x38')]?_0x276389[_0x0012('0x36')]:_0x1b676d['model'];if(!_0x3ce788['query'][_0x0012('0x39')](_0x0012('0x3a'))){_0x276389[_0x0012('0x1e')]=qs[_0x0012('0x1e')](_0x3ce788[_0x0012('0x33')][_0x0012('0x1e')]);_0x276389[_0x0012('0x1d')]=qs['offset'](_0x3ce788[_0x0012('0x33')][_0x0012('0x1d')]);}_0x276389['order']=qs[_0x0012('0x3b')](_0x3ce788[_0x0012('0x33')][_0x0012('0x3b')]);_0x276389[_0x0012('0x3c')]=qs[_0x0012('0x34')](_[_0x0012('0x3d')](_0x3ce788[_0x0012('0x33')],_0x1b676d['filters']),_0x1c23e0);if(_0x3ce788[_0x0012('0x33')]['filter']){_0x276389[_0x0012('0x3c')]=_['merge'](_0x276389['where'],{'$or':_[_0x0012('0x2e')](_0x1c23e0,function(_0x379618){if(_0x379618[_0x0012('0x3e')]!=='VIRTUAL'){var _0x44dda2={};_0x44dda2[_0x379618[_0x0012('0x2b')]]={'$like':'%'+_0x3ce788[_0x0012('0x33')][_0x0012('0x3f')]+'%'};return _0x44dda2;}})});}_0x276389=_[_0x0012('0x40')]({},_0x276389,_0x3ce788[_0x0012('0x41')]);var _0x85a93e={'where':_0x276389[_0x0012('0x3c')]};return db['AnalyticMetric'][_0x0012('0x1c')](_0x85a93e)[_0x0012('0x24')](function(_0x559751){_0x1f4a0a[_0x0012('0x1c')]=_0x559751;if(_0x3ce788[_0x0012('0x33')][_0x0012('0x42')]){_0x276389[_0x0012('0x43')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x276389);})[_0x0012('0x24')](function(_0x574ece){_0x1f4a0a[_0x0012('0x44')]=_0x574ece;return _0x1f4a0a;})[_0x0012('0x24')](respondWithFilteredResult(_0x1282bb,_0x276389))[_0x0012('0x45')](handleError(_0x1282bb,null));};exports[_0x0012('0x46')]=function(_0x32c1f9,_0x5348a2){var _0x1bd93a={'raw':!![],'where':{'id':_0x32c1f9['params']['id']}},_0x375a6c={};_0x375a6c[_0x0012('0x32')]=_[_0x0012('0x47')](db[_0x0012('0x2f')][_0x0012('0x48')]);_0x375a6c['query']=_['keys'](_0x32c1f9[_0x0012('0x33')]);_0x375a6c['filters']=_[_0x0012('0x35')](_0x375a6c['model'],_0x375a6c[_0x0012('0x33')]);_0x1bd93a[_0x0012('0x36')]=_[_0x0012('0x35')](_0x375a6c[_0x0012('0x32')],qs['fields'](_0x32c1f9[_0x0012('0x33')]['fields']));_0x1bd93a[_0x0012('0x36')]=_0x1bd93a[_0x0012('0x36')][_0x0012('0x38')]?_0x1bd93a[_0x0012('0x36')]:_0x375a6c[_0x0012('0x32')];if(_0x32c1f9[_0x0012('0x33')][_0x0012('0x42')]){_0x1bd93a['include']=[{'all':!![]}];}_0x1bd93a=_[_0x0012('0x40')]({},_0x1bd93a,_0x32c1f9[_0x0012('0x41')]);return db[_0x0012('0x2f')][_0x0012('0x49')](_0x1bd93a)[_0x0012('0x24')](handleEntityNotFound(_0x5348a2,null))[_0x0012('0x24')](respondWithResult(_0x5348a2,null))['catch'](handleError(_0x5348a2,null));};exports['create']=function(_0x48de64,_0x5b6370){return db[_0x0012('0x2f')][_0x0012('0x4a')](_0x48de64[_0x0012('0x4b')],{})[_0x0012('0x24')](function(_0x184403){var _0x53d552=_0x48de64[_0x0012('0x4c')][_0x0012('0x4d')]({'plain':!![]});if(!_0x53d552)throw new Error(_0x0012('0x4e'));if(_0x53d552[_0x0012('0x4f')]===_0x0012('0x4c')){var _0x564bc4=_0x184403[_0x0012('0x4d')]({'plain':!![]});var _0x26fb2b=_0x0012('0x26');return db[_0x0012('0x50')][_0x0012('0x49')]({'where':{'name':_0x26fb2b,'userProfileId':_0x53d552['userProfileId']},'raw':!![]})[_0x0012('0x24')](function(_0x12cb8f){if(_0x12cb8f&&_0x12cb8f[_0x0012('0x51')]===0x0){return db['UserProfileResource'][_0x0012('0x4a')]({'name':_0x564bc4[_0x0012('0x2b')],'resourceId':_0x564bc4['id'],'type':_0x12cb8f[_0x0012('0x2b')],'sectionId':_0x12cb8f['id']},{})[_0x0012('0x24')](function(){return _0x184403;});}else{return _0x184403;}})[_0x0012('0x45')](function(_0x5f283f){logger[_0x0012('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f283f);throw _0x5f283f;});}return _0x184403;})[_0x0012('0x24')](respondWithResult(_0x5b6370,0xc9))[_0x0012('0x45')](handleError(_0x5b6370,null));};exports['update']=function(_0x13a4ee,_0x19cf31){if(_0x13a4ee[_0x0012('0x4b')]['id']){delete _0x13a4ee[_0x0012('0x4b')]['id'];}return db[_0x0012('0x2f')][_0x0012('0x49')]({'where':{'id':_0x13a4ee['params']['id']}})[_0x0012('0x24')](handleEntityNotFound(_0x19cf31,null))[_0x0012('0x24')](saveUpdates(_0x13a4ee[_0x0012('0x4b')],null))[_0x0012('0x24')](respondWithResult(_0x19cf31,null))['catch'](handleError(_0x19cf31,null));};exports[_0x0012('0x25')]=function(_0x3bed8b,_0x2e79aa){return db['AnalyticMetric'][_0x0012('0x49')]({'where':{'id':_0x3bed8b[_0x0012('0x52')]['id']}})[_0x0012('0x24')](handleEntityNotFound(_0x2e79aa,null))[_0x0012('0x24')](removeEntity(_0x2e79aa,null))[_0x0012('0x45')](handleError(_0x2e79aa,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 54deb68..421e857 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 _0x7272=['AnalyticMetric','analytics_metrics','lodash','moment','bluebird','request-promise','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x5dd16f,_0x4555eb){var _0x342571=function(_0x198581){while(--_0x198581){_0x5dd16f['push'](_0x5dd16f['shift']());}};_0x342571(++_0x4555eb);}(_0x7272,0x80));var _0x2727=function(_0x59268f,_0x34e1d3){_0x59268f=_0x59268f-0x0;var _0x59e5bb=_0x7272[_0x59268f];return _0x59e5bb;};'use strict';var _=require(_0x2727('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2727('0x1'));var BPromise=require(_0x2727('0x2'));var rp=require(_0x2727('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2727('0x4'));var attributes=require(_0x2727('0x5'));module[_0x2727('0x6')]=function(_0x33a56a,_0x40ce7f){return _0x33a56a['define'](_0x2727('0x7'),attributes,{'tableName':_0x2727('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb613=['exports','AnalyticMetric','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticMetric.attributes'];(function(_0x2bb008,_0x30ebe2){var _0x3fbacf=function(_0x51c24a){while(--_0x51c24a){_0x2bb008['push'](_0x2bb008['shift']());}};_0x3fbacf(++_0x30ebe2);}(_0xb613,0xfc));var _0x3b61=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xb613[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0x3b61('0x0'));var util=require('util');var logger=require(_0x3b61('0x1'))(_0x3b61('0x2'));var moment=require(_0x3b61('0x3'));var BPromise=require(_0x3b61('0x4'));var rp=require(_0x3b61('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b61('0x6'));var config=require('../../config/environment');var attributes=require(_0x3b61('0x7'));module[_0x3b61('0x8')]=function(_0x595bbf,_0x2d8b48){return _0x595bbf['define'](_0x3b61('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 8066179..f5506f9 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 _0x5db0=['request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x243e64,_0x174f5d){var _0x3ae1ed=function(_0x2c8afe){while(--_0x2c8afe){_0x243e64['push'](_0x243e64['shift']());}};_0x3ae1ed(++_0x174f5d);}(_0x5db0,0xde));var _0x05db=function(_0x33041d,_0x4b3ecd){_0x33041d=_0x33041d-0x0;var _0xe0753a=_0x5db0[_0x33041d];return _0xe0753a;};'use strict';var _=require(_0x05db('0x0'));var util=require('util');var moment=require(_0x05db('0x1'));var BPromise=require(_0x05db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x05db('0x3'));var logger=require(_0x05db('0x4'))(_0x05db('0x5'));var config=require('../../config/environment');var jayson=require(_0x05db('0x6'));var client=jayson[_0x05db('0x7')][_0x05db('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x127d23,_0x4fe463,_0x374917){return new BPromise(function(_0x1dc9e1,_0x327f79){return client[_0x05db('0x9')](_0x127d23,_0x374917)[_0x05db('0xa')](function(_0x458769){logger[_0x05db('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x4fe463,_0x05db('0xc'));logger[_0x05db('0xd')](_0x05db('0xe'),_0x4fe463,_0x05db('0xc'),JSON[_0x05db('0xf')](_0x458769));if(_0x458769[_0x05db('0x10')]){if(_0x458769['error'][_0x05db('0x11')]===0x1f4){logger['error'](_0x05db('0x12'),_0x4fe463,_0x458769[_0x05db('0x10')]['message']);return _0x327f79(_0x458769[_0x05db('0x10')]['message']);}logger[_0x05db('0x10')](_0x05db('0x12'),_0x4fe463,_0x458769[_0x05db('0x10')][_0x05db('0x13')]);return _0x1dc9e1(_0x458769[_0x05db('0x10')]['message']);}else{logger[_0x05db('0xb')](_0x05db('0x12'),_0x4fe463,'request\x20sent');_0x1dc9e1(_0x458769[_0x05db('0x14')][_0x05db('0x13')]);}})['catch'](function(_0x1c67ec){logger[_0x05db('0x10')](_0x05db('0x12'),_0x4fe463,_0x1c67ec);_0x327f79(_0x1c67ec);});});} \ No newline at end of file +var _0x16cb=['message','AnalyticMetric,\x20%s,\x20%s','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','debug','request\x20sent','stringify','error','code'];(function(_0x35b036,_0x4eaaf7){var _0x706824=function(_0x5e4b84){while(--_0x5e4b84){_0x35b036['push'](_0x35b036['shift']());}};_0x706824(++_0x4eaaf7);}(_0x16cb,0xae));var _0xb16c=function(_0x55a51e,_0x4eedbd){_0x55a51e=_0x55a51e-0x0;var _0x496d0e=_0x16cb[_0x55a51e];return _0x496d0e;};'use strict';var _=require(_0xb16c('0x0'));var util=require('util');var moment=require(_0xb16c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb16c('0x2'));var fs=require('fs');var Redis=require(_0xb16c('0x3'));var db=require(_0xb16c('0x4'))['db'];var utils=require(_0xb16c('0x5'));var logger=require(_0xb16c('0x6'))(_0xb16c('0x7'));var config=require(_0xb16c('0x8'));var jayson=require(_0xb16c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b3811,_0x1448a8,_0x5a8885){return new BPromise(function(_0x73384e,_0x44bd05){return client['request'](_0x4b3811,_0x5a8885)['then'](function(_0x39320e){logger[_0xb16c('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x1448a8,'request\x20sent');logger[_0xb16c('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1448a8,_0xb16c('0xc'),JSON[_0xb16c('0xd')](_0x39320e));if(_0x39320e[_0xb16c('0xe')]){if(_0x39320e[_0xb16c('0xe')][_0xb16c('0xf')]===0x1f4){logger[_0xb16c('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1448a8,_0x39320e[_0xb16c('0xe')][_0xb16c('0x10')]);return _0x44bd05(_0x39320e['error']['message']);}logger[_0xb16c('0xe')](_0xb16c('0x11'),_0x1448a8,_0x39320e[_0xb16c('0xe')][_0xb16c('0x10')]);return _0x73384e(_0x39320e[_0xb16c('0xe')][_0xb16c('0x10')]);}else{logger[_0xb16c('0xa')](_0xb16c('0x11'),_0x1448a8,_0xb16c('0xc'));_0x73384e(_0x39320e[_0xb16c('0x12')][_0xb16c('0x10')]);}})['catch'](function(_0x234565){logger[_0xb16c('0xe')](_0xb16c('0x11'),_0x1448a8,_0x234565);_0x44bd05(_0x234565);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c5cf4cf..330f76d 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 _0x0295=['delete','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','put'];(function(_0x1964b4,_0x5796f4){var _0x509a77=function(_0x247257){while(--_0x247257){_0x1964b4['push'](_0x1964b4['shift']());}};_0x509a77(++_0x5796f4);}(_0x0295,0x1f0));var _0x5029=function(_0x15c5b8,_0x3b670f){_0x15c5b8=_0x15c5b8-0x0;var _0xd45fe6=_0x0295[_0x15c5b8];return _0xd45fe6;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x5029('0x2'));var interaction=require(_0x5029('0x3'));var config=require(_0x5029('0x4'));var controller=require(_0x5029('0x5'));router[_0x5029('0x6')]('/',auth[_0x5029('0x7')](),controller[_0x5029('0x8')]);router[_0x5029('0x6')](_0x5029('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5029('0x7')](),controller['create']);router[_0x5029('0xa')]('/:id',auth[_0x5029('0x7')](),controller['update']);router[_0x5029('0xb')](_0x5029('0x9'),auth[_0x5029('0x7')](),controller['destroy']);module[_0x5029('0xc')]=router; \ No newline at end of file +var _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x53ec,0x192));var _0xc53e=function(_0x3fe90c,_0x231b20){_0x3fe90c=_0x3fe90c-0x0;var _0x12c302=_0x53ec[_0x3fe90c];return _0x12c302;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 44e37aa..9e64f19 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 _0x1aea=['exports','TEXT','sequelize'];(function(_0x374715,_0x23d5ed){var _0x34539a=function(_0x3dd77c){while(--_0x3dd77c){_0x374715['push'](_0x374715['shift']());}};_0x34539a(++_0x23d5ed);}(_0x1aea,0x116));var _0xa1ae=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x1aea[_0x5c4585];return _0x21dede;};'use strict';var Sequelize=require(_0xa1ae('0x0'));module[_0xa1ae('0x1')]={'tree':{'type':Sequelize[_0xa1ae('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc81b=['exports','TEXT'];(function(_0x526c68,_0x1b8c4a){var _0x313f6d=function(_0x378584){while(--_0x378584){_0x526c68['push'](_0x526c68['shift']());}};_0x313f6d(++_0x1b8c4a);}(_0xc81b,0x188));var _0xbc81=function(_0x5a47d6,_0x1256dd){_0x5a47d6=_0x5a47d6-0x0;var _0x210d3e=_0xc81b[_0x5a47d6];return _0x210d3e;};'use strict';var Sequelize=require('sequelize');module[_0xbc81('0x0')]={'tree':{'type':Sequelize[_0xbc81('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b386c40..667f403 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 _0x2f32=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','offset','sort','where','filters','pick','filter','merge','options','AnalyticTreeReport','count','includeAll','include','rows','catch','show','params','find','body','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','set','Content-Range','json','apply','reject','save','then','destroy','end','error'];(function(_0x5a41b8,_0xfb31e9){var _0x37069f=function(_0xdff7a3){while(--_0xdff7a3){_0x5a41b8['push'](_0x5a41b8['shift']());}};_0x37069f(++_0xfb31e9);}(_0x2f32,0xb3));var _0x22f3=function(_0x5769c5,_0x21b824){_0x5769c5=_0x5769c5-0x0;var _0x5e926f=_0x2f32[_0x5769c5];return _0x5e926f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x22f3('0x0'));var zipdir=require(_0x22f3('0x1'));var jsonpatch=require(_0x22f3('0x2'));var rp=require('request-promise');var moment=require(_0x22f3('0x3'));var BPromise=require(_0x22f3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x22f3('0x5'));var sox=require(_0x22f3('0x6'));var csv=require('to-csv');var ejs=require(_0x22f3('0x7'));var fs=require('fs');var _=require(_0x22f3('0x8'));var squel=require(_0x22f3('0x9'));var crypto=require(_0x22f3('0xa'));var jsforce=require(_0x22f3('0xb'));var deskjs=require(_0x22f3('0xc'));var toCsv=require(_0x22f3('0xd'));var querystring=require(_0x22f3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x22f3('0xf'));var as=require(_0x22f3('0x10'));var hardwareService=require(_0x22f3('0x11'));var logger=require('../../config/logger')(_0x22f3('0x12'));var utils=require(_0x22f3('0x13'));var config=require(_0x22f3('0x14'));var db=require(_0x22f3('0x15'))['db'];function respondWithStatusCode(_0xaae736,_0xe1cf8f){_0xe1cf8f=_0xe1cf8f||0xcc;return function(_0x2da013){if(_0x2da013){return _0xaae736[_0x22f3('0x16')](_0xe1cf8f);}return _0xaae736['status'](_0xe1cf8f)['end']();};}function respondWithResult(_0x3dc5cb,_0x37d53e){_0x37d53e=_0x37d53e||0xc8;return function(_0x18fb7d){if(_0x18fb7d){return _0x3dc5cb[_0x22f3('0x17')](_0x37d53e)['json'](_0x18fb7d);}};}function respondWithFilteredResult(_0x2d3044,_0x388f12){return function(_0x15a762){if(_0x15a762){var _0x41bcaf=_0x15a762['count'],_0x4d3469=_0x388f12['offset'],_0x3e28af=_0x388f12['offset']+_0x388f12['limit'],_0x1ba550;if(_0x3e28af>=_0x41bcaf){_0x3e28af=_0x41bcaf;_0x1ba550=0xc8;}else{_0x1ba550=0xce;}_0x2d3044['status'](_0x1ba550);return _0x2d3044[_0x22f3('0x18')](_0x22f3('0x19'),_0x4d3469+'-'+_0x3e28af+'/'+_0x41bcaf)[_0x22f3('0x1a')](_0x15a762);}return null;};}function patchUpdates(_0x16f9e0){return function(_0x22c3b7){try{jsonpatch[_0x22f3('0x1b')](_0x22c3b7,_0x16f9e0,!![]);}catch(_0x29988d){return BPromise[_0x22f3('0x1c')](_0x29988d);}return _0x22c3b7[_0x22f3('0x1d')]();};}function saveUpdates(_0x370744,_0x53998f){return function(_0x555dd3){if(_0x555dd3){return _0x555dd3['update'](_0x370744)[_0x22f3('0x1e')](function(_0x1cfc2d){return _0x1cfc2d;});}return null;};}function removeEntity(_0x5ea9b6,_0x4ec616){return function(_0x5b3b57){if(_0x5b3b57){return _0x5b3b57[_0x22f3('0x1f')]()[_0x22f3('0x1e')](function(){_0x5ea9b6[_0x22f3('0x17')](0xcc)[_0x22f3('0x20')]();});}};}function handleEntityNotFound(_0x169202,_0x5ee038){return function(_0x226b4c){if(!_0x226b4c){_0x169202[_0x22f3('0x16')](0x194);}return _0x226b4c;};}function handleError(_0x2d00e0,_0x442819){_0x442819=_0x442819||0x1f4;return function(_0xfad8c3){logger[_0x22f3('0x21')](_0xfad8c3[_0x22f3('0x22')]);if(_0xfad8c3['name']){delete _0xfad8c3[_0x22f3('0x23')];}_0x2d00e0['status'](_0x442819)[_0x22f3('0x24')](_0xfad8c3);};}exports[_0x22f3('0x25')]=function(_0x2bfc54,_0x3470d8){var _0x49aad0={},_0x252ad9={},_0x115348={'count':0x0,'rows':[]};var _0x4890e3=_[_0x22f3('0x26')](db['AnalyticTreeReport'][_0x22f3('0x27')],function(_0x397587){return{'name':_0x397587[_0x22f3('0x28')],'type':_0x397587[_0x22f3('0x29')][_0x22f3('0x2a')]};});_0x252ad9[_0x22f3('0x2b')]=_[_0x22f3('0x26')](_0x4890e3,'name');_0x252ad9[_0x22f3('0x2c')]=_[_0x22f3('0x2d')](_0x2bfc54[_0x22f3('0x2c')]);_0x252ad9['filters']=_[_0x22f3('0x2e')](_0x252ad9[_0x22f3('0x2b')],_0x252ad9[_0x22f3('0x2c')]);_0x49aad0[_0x22f3('0x2f')]=_['intersection'](_0x252ad9[_0x22f3('0x2b')],qs[_0x22f3('0x30')](_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x30')]));_0x49aad0[_0x22f3('0x2f')]=_0x49aad0[_0x22f3('0x2f')][_0x22f3('0x31')]?_0x49aad0['attributes']:_0x252ad9[_0x22f3('0x2b')];if(!_0x2bfc54[_0x22f3('0x2c')]['hasOwnProperty'](_0x22f3('0x32'))){_0x49aad0[_0x22f3('0x33')]=qs['limit'](_0x2bfc54['query'][_0x22f3('0x33')]);_0x49aad0['offset']=qs['offset'](_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x34')]);}_0x49aad0['order']=qs[_0x22f3('0x35')](_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x35')]);_0x49aad0[_0x22f3('0x36')]=qs[_0x22f3('0x37')](_[_0x22f3('0x38')](_0x2bfc54[_0x22f3('0x2c')],_0x252ad9[_0x22f3('0x37')]),_0x4890e3);if(_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x39')]){_0x49aad0[_0x22f3('0x36')]=_[_0x22f3('0x3a')](_0x49aad0[_0x22f3('0x36')],{'$or':_[_0x22f3('0x26')](_0x4890e3,function(_0xc086bb){if(_0xc086bb[_0x22f3('0x29')]!=='VIRTUAL'){var _0x42c68b={};_0x42c68b[_0xc086bb[_0x22f3('0x23')]]={'$like':'%'+_0x2bfc54['query'][_0x22f3('0x39')]+'%'};return _0x42c68b;}})});}_0x49aad0=_[_0x22f3('0x3a')]({},_0x49aad0,_0x2bfc54[_0x22f3('0x3b')]);var _0x1b3e60={'where':_0x49aad0['where']};return db[_0x22f3('0x3c')][_0x22f3('0x3d')](_0x1b3e60)[_0x22f3('0x1e')](function(_0x4bd7b8){_0x115348[_0x22f3('0x3d')]=_0x4bd7b8;if(_0x2bfc54[_0x22f3('0x2c')][_0x22f3('0x3e')]){_0x49aad0[_0x22f3('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x49aad0);})[_0x22f3('0x1e')](function(_0x57ba9d){_0x115348[_0x22f3('0x40')]=_0x57ba9d;return _0x115348;})[_0x22f3('0x1e')](respondWithFilteredResult(_0x3470d8,_0x49aad0))[_0x22f3('0x41')](handleError(_0x3470d8,null));};exports[_0x22f3('0x42')]=function(_0x567a54,_0xe3627b){var _0x472898={'raw':!![],'where':{'id':_0x567a54[_0x22f3('0x43')]['id']}},_0x5016d2={};_0x5016d2['model']=_[_0x22f3('0x2d')](db[_0x22f3('0x3c')][_0x22f3('0x27')]);_0x5016d2[_0x22f3('0x2c')]=_['keys'](_0x567a54[_0x22f3('0x2c')]);_0x5016d2[_0x22f3('0x37')]=_[_0x22f3('0x2e')](_0x5016d2['model'],_0x5016d2[_0x22f3('0x2c')]);_0x472898[_0x22f3('0x2f')]=_[_0x22f3('0x2e')](_0x5016d2[_0x22f3('0x2b')],qs[_0x22f3('0x30')](_0x567a54[_0x22f3('0x2c')][_0x22f3('0x30')]));_0x472898[_0x22f3('0x2f')]=_0x472898[_0x22f3('0x2f')][_0x22f3('0x31')]?_0x472898[_0x22f3('0x2f')]:_0x5016d2[_0x22f3('0x2b')];if(_0x567a54['query']['includeAll']){_0x472898[_0x22f3('0x3f')]=[{'all':!![]}];}_0x472898=_[_0x22f3('0x3a')]({},_0x472898,_0x567a54[_0x22f3('0x3b')]);return db[_0x22f3('0x3c')][_0x22f3('0x44')](_0x472898)[_0x22f3('0x1e')](handleEntityNotFound(_0xe3627b,null))['then'](respondWithResult(_0xe3627b,null))[_0x22f3('0x41')](handleError(_0xe3627b,null));};exports['create']=function(_0x5ed9b8,_0xa74089){return db[_0x22f3('0x3c')]['create'](_0x5ed9b8[_0x22f3('0x45')],{})['then'](respondWithResult(_0xa74089,0xc9))[_0x22f3('0x41')](handleError(_0xa74089,null));};exports[_0x22f3('0x46')]=function(_0x5ba6a7,_0x45c26d){if(_0x5ba6a7[_0x22f3('0x45')]['id']){delete _0x5ba6a7[_0x22f3('0x45')]['id'];}return db[_0x22f3('0x3c')][_0x22f3('0x44')]({'where':{'id':_0x5ba6a7[_0x22f3('0x43')]['id']}})[_0x22f3('0x1e')](handleEntityNotFound(_0x45c26d,null))[_0x22f3('0x1e')](saveUpdates(_0x5ba6a7[_0x22f3('0x45')],null))['then'](respondWithResult(_0x45c26d,null))[_0x22f3('0x41')](handleError(_0x45c26d,null));};exports[_0x22f3('0x1f')]=function(_0x20ce38,_0x46235f){return db[_0x22f3('0x3c')][_0x22f3('0x44')]({'where':{'id':_0x20ce38[_0x22f3('0x43')]['id']}})[_0x22f3('0x1e')](handleEntityNotFound(_0x46235f,null))[_0x22f3('0x1e')](removeEntity(_0x46235f,null))[_0x22f3('0x41')](handleError(_0x46235f,null));}; \ No newline at end of file +var _0x0571=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0xc83b68,_0x57a971){var _0x182444=function(_0x2c7f12){while(--_0x2c7f12){_0xc83b68['push'](_0xc83b68['shift']());}};_0x182444(++_0x57a971);}(_0x0571,0x1f2));var _0x1057=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x0571[_0x270a54];return _0x4d07d0;};'use strict';var pdf=require(_0x1057('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1057('0x1'));var jsonpatch=require(_0x1057('0x2'));var rp=require(_0x1057('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1057('0x4'));var util=require(_0x1057('0x5'));var path=require(_0x1057('0x6'));var sox=require(_0x1057('0x7'));var csv=require(_0x1057('0x8'));var ejs=require(_0x1057('0x9'));var fs=require('fs');var _=require(_0x1057('0xa'));var squel=require(_0x1057('0xb'));var crypto=require(_0x1057('0xc'));var jsforce=require(_0x1057('0xd'));var deskjs=require(_0x1057('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1057('0xf'));var Papa=require(_0x1057('0x10'));var Redis=require('ioredis');var authService=require(_0x1057('0x11'));var qs=require(_0x1057('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1057('0x13'));var logger=require(_0x1057('0x14'))(_0x1057('0x15'));var utils=require(_0x1057('0x16'));var config=require(_0x1057('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29aa19,_0x1a08ea){_0x1a08ea=_0x1a08ea||0xcc;return function(_0x24ec5a){if(_0x24ec5a){return _0x29aa19[_0x1057('0x18')](_0x1a08ea);}return _0x29aa19[_0x1057('0x19')](_0x1a08ea)[_0x1057('0x1a')]();};}function respondWithResult(_0x5b346c,_0x5b4d9d){_0x5b4d9d=_0x5b4d9d||0xc8;return function(_0x25d2e3){if(_0x25d2e3){return _0x5b346c[_0x1057('0x19')](_0x5b4d9d)[_0x1057('0x1b')](_0x25d2e3);}};}function respondWithFilteredResult(_0x1b172b,_0xfc5e45){return function(_0x4797eb){if(_0x4797eb){var _0x4bf29d=_0x4797eb[_0x1057('0x1c')],_0x1e5a6c=_0xfc5e45['offset'],_0x29f4f3=_0xfc5e45[_0x1057('0x1d')]+_0xfc5e45[_0x1057('0x1e')],_0x3ee78a;if(_0x29f4f3>=_0x4bf29d){_0x29f4f3=_0x4bf29d;_0x3ee78a=0xc8;}else{_0x3ee78a=0xce;}_0x1b172b['status'](_0x3ee78a);return _0x1b172b[_0x1057('0x1f')](_0x1057('0x20'),_0x1e5a6c+'-'+_0x29f4f3+'/'+_0x4bf29d)[_0x1057('0x1b')](_0x4797eb);}return null;};}function patchUpdates(_0x452332){return function(_0x10b6b3){try{jsonpatch[_0x1057('0x21')](_0x10b6b3,_0x452332,!![]);}catch(_0x5656f4){return BPromise[_0x1057('0x22')](_0x5656f4);}return _0x10b6b3['save']();};}function saveUpdates(_0x32a122,_0x54a756){return function(_0x208834){if(_0x208834){return _0x208834[_0x1057('0x23')](_0x32a122)[_0x1057('0x24')](function(_0x5d3c99){return _0x5d3c99;});}return null;};}function removeEntity(_0x238906,_0x58fdcc){return function(_0x535578){if(_0x535578){return _0x535578[_0x1057('0x25')]()[_0x1057('0x24')](function(){_0x238906[_0x1057('0x19')](0xcc)[_0x1057('0x1a')]();});}};}function handleEntityNotFound(_0x5cc7e6,_0x2a933c){return function(_0x46ab18){if(!_0x46ab18){_0x5cc7e6['sendStatus'](0x194);}return _0x46ab18;};}function handleError(_0x83595a,_0x1e955b){_0x1e955b=_0x1e955b||0x1f4;return function(_0x3212f3){logger['error'](_0x3212f3['stack']);if(_0x3212f3['name']){delete _0x3212f3[_0x1057('0x26')];}_0x83595a[_0x1057('0x19')](_0x1e955b)[_0x1057('0x27')](_0x3212f3);};}exports['index']=function(_0xbf0bea,_0x51988e){var _0x35a2b3={},_0x39573c={},_0x5b2c94={'count':0x0,'rows':[]};var _0x640c09=_[_0x1057('0x28')](db['AnalyticTreeReport'][_0x1057('0x29')],function(_0x3f8cd2){return{'name':_0x3f8cd2[_0x1057('0x2a')],'type':_0x3f8cd2[_0x1057('0x2b')][_0x1057('0x2c')]};});_0x39573c['model']=_[_0x1057('0x28')](_0x640c09,_0x1057('0x26'));_0x39573c['query']=_[_0x1057('0x2d')](_0xbf0bea[_0x1057('0x2e')]);_0x39573c[_0x1057('0x2f')]=_['intersection'](_0x39573c[_0x1057('0x30')],_0x39573c[_0x1057('0x2e')]);_0x35a2b3[_0x1057('0x31')]=_[_0x1057('0x32')](_0x39573c[_0x1057('0x30')],qs[_0x1057('0x33')](_0xbf0bea[_0x1057('0x2e')][_0x1057('0x33')]));_0x35a2b3[_0x1057('0x31')]=_0x35a2b3[_0x1057('0x31')][_0x1057('0x34')]?_0x35a2b3[_0x1057('0x31')]:_0x39573c['model'];if(!_0xbf0bea['query'][_0x1057('0x35')](_0x1057('0x36'))){_0x35a2b3[_0x1057('0x1e')]=qs[_0x1057('0x1e')](_0xbf0bea[_0x1057('0x2e')]['limit']);_0x35a2b3[_0x1057('0x1d')]=qs['offset'](_0xbf0bea['query'][_0x1057('0x1d')]);}_0x35a2b3[_0x1057('0x37')]=qs[_0x1057('0x38')](_0xbf0bea[_0x1057('0x2e')]['sort']);_0x35a2b3[_0x1057('0x39')]=qs['filters'](_[_0x1057('0x3a')](_0xbf0bea[_0x1057('0x2e')],_0x39573c['filters']),_0x640c09);if(_0xbf0bea[_0x1057('0x2e')][_0x1057('0x3b')]){_0x35a2b3[_0x1057('0x39')]=_[_0x1057('0x3c')](_0x35a2b3[_0x1057('0x39')],{'$or':_['map'](_0x640c09,function(_0x15a2b9){if(_0x15a2b9[_0x1057('0x2b')]!==_0x1057('0x3d')){var _0x14ed09={};_0x14ed09[_0x15a2b9[_0x1057('0x26')]]={'$like':'%'+_0xbf0bea[_0x1057('0x2e')][_0x1057('0x3b')]+'%'};return _0x14ed09;}})});}_0x35a2b3=_[_0x1057('0x3c')]({},_0x35a2b3,_0xbf0bea['options']);var _0x560f17={'where':_0x35a2b3['where']};return db[_0x1057('0x3e')][_0x1057('0x1c')](_0x560f17)[_0x1057('0x24')](function(_0x440e65){_0x5b2c94[_0x1057('0x1c')]=_0x440e65;if(_0xbf0bea[_0x1057('0x2e')][_0x1057('0x3f')]){_0x35a2b3[_0x1057('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x1057('0x41')](_0x35a2b3);})['then'](function(_0x566164){_0x5b2c94[_0x1057('0x42')]=_0x566164;return _0x5b2c94;})[_0x1057('0x24')](respondWithFilteredResult(_0x51988e,_0x35a2b3))[_0x1057('0x43')](handleError(_0x51988e,null));};exports[_0x1057('0x44')]=function(_0x3780e0,_0x1edeaf){var _0x5c83e3={'raw':!![],'where':{'id':_0x3780e0[_0x1057('0x45')]['id']}},_0x321429={};_0x321429[_0x1057('0x30')]=_[_0x1057('0x2d')](db[_0x1057('0x3e')][_0x1057('0x29')]);_0x321429[_0x1057('0x2e')]=_[_0x1057('0x2d')](_0x3780e0[_0x1057('0x2e')]);_0x321429['filters']=_['intersection'](_0x321429[_0x1057('0x30')],_0x321429[_0x1057('0x2e')]);_0x5c83e3[_0x1057('0x31')]=_[_0x1057('0x32')](_0x321429['model'],qs[_0x1057('0x33')](_0x3780e0['query'][_0x1057('0x33')]));_0x5c83e3[_0x1057('0x31')]=_0x5c83e3[_0x1057('0x31')]['length']?_0x5c83e3[_0x1057('0x31')]:_0x321429[_0x1057('0x30')];if(_0x3780e0[_0x1057('0x2e')][_0x1057('0x3f')]){_0x5c83e3[_0x1057('0x40')]=[{'all':!![]}];}_0x5c83e3=_[_0x1057('0x3c')]({},_0x5c83e3,_0x3780e0[_0x1057('0x46')]);return db[_0x1057('0x3e')][_0x1057('0x47')](_0x5c83e3)[_0x1057('0x24')](handleEntityNotFound(_0x1edeaf,null))[_0x1057('0x24')](respondWithResult(_0x1edeaf,null))['catch'](handleError(_0x1edeaf,null));};exports[_0x1057('0x48')]=function(_0xde1d67,_0x6464eb){return db['AnalyticTreeReport']['create'](_0xde1d67[_0x1057('0x49')],{})['then'](respondWithResult(_0x6464eb,0xc9))[_0x1057('0x43')](handleError(_0x6464eb,null));};exports[_0x1057('0x23')]=function(_0x152224,_0x94496a){if(_0x152224[_0x1057('0x49')]['id']){delete _0x152224[_0x1057('0x49')]['id'];}return db[_0x1057('0x3e')][_0x1057('0x47')]({'where':{'id':_0x152224[_0x1057('0x45')]['id']}})[_0x1057('0x24')](handleEntityNotFound(_0x94496a,null))['then'](saveUpdates(_0x152224['body'],null))[_0x1057('0x24')](respondWithResult(_0x94496a,null))['catch'](handleError(_0x94496a,null));};exports[_0x1057('0x25')]=function(_0x1f7a90,_0x358fee){return db[_0x1057('0x3e')]['find']({'where':{'id':_0x1f7a90['params']['id']}})[_0x1057('0x24')](handleEntityNotFound(_0x358fee,null))[_0x1057('0x24')](removeEntity(_0x358fee,null))[_0x1057('0x43')](handleError(_0x358fee,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 746b70b..7e79bb6 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 _0x67ba=['util','../../config/logger','api','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash'];(function(_0x5cc11b,_0x2ada19){var _0x447b46=function(_0x1c7408){while(--_0x1c7408){_0x5cc11b['push'](_0x5cc11b['shift']());}};_0x447b46(++_0x2ada19);}(_0x67ba,0xba));var _0xa67b=function(_0x451ee5,_0x1376a6){_0x451ee5=_0x451ee5-0x0;var _0x2a9b42=_0x67ba[_0x451ee5];return _0x2a9b42;};'use strict';var _=require(_0xa67b('0x0'));var util=require(_0xa67b('0x1'));var logger=require(_0xa67b('0x2'))(_0xa67b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa67b('0x4'));var fs=require('fs');var path=require(_0xa67b('0x5'));var rimraf=require(_0xa67b('0x6'));var config=require('../../config/environment');var attributes=require(_0xa67b('0x7'));module[_0xa67b('0x8')]=function(_0x10d0c5,_0x2eae36){return _0x10d0c5[_0xa67b('0x9')](_0xa67b('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a6d=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0xb704,_0x5de98c){var _0x150465=function(_0x37cc45){while(--_0x37cc45){_0xb704['push'](_0xb704['shift']());}};_0x150465(++_0x5de98c);}(_0x8a6d,0x16e));var _0xd8a6=function(_0x460a65,_0x201a15){_0x460a65=_0x460a65-0x0;var _0x28c2bb=_0x8a6d[_0x460a65];return _0x28c2bb;};'use strict';var _=require('lodash');var util=require(_0xd8a6('0x0'));var logger=require(_0xd8a6('0x1'))('api');var moment=require(_0xd8a6('0x2'));var BPromise=require('bluebird');var rp=require(_0xd8a6('0x3'));var fs=require('fs');var path=require(_0xd8a6('0x4'));var rimraf=require(_0xd8a6('0x5'));var config=require(_0xd8a6('0x6'));var attributes=require(_0xd8a6('0x7'));module[_0xd8a6('0x8')]=function(_0x183dc5,_0x554dbc){return _0x183dc5[_0xd8a6('0x9')](_0xd8a6('0xa'),attributes,{'tableName':_0xd8a6('0xb'),'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 6e932a7..ac4479d 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 _0x4560=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x33c0e0,_0x2f7dd2){var _0x1ef863=function(_0x464808){while(--_0x464808){_0x33c0e0['push'](_0x33c0e0['shift']());}};_0x1ef863(++_0x2f7dd2);}(_0x4560,0xa9));var _0x0456=function(_0x57c357,_0x598547){_0x57c357=_0x57c357-0x0;var _0x459831=_0x4560[_0x57c357];return _0x459831;};'use strict';var _=require(_0x0456('0x0'));var util=require(_0x0456('0x1'));var moment=require(_0x0456('0x2'));var BPromise=require(_0x0456('0x3'));var rs=require(_0x0456('0x4'));var fs=require('fs');var Redis=require(_0x0456('0x5'));var db=require(_0x0456('0x6'))['db'];var utils=require(_0x0456('0x7'));var logger=require(_0x0456('0x8'))(_0x0456('0x9'));var config=require(_0x0456('0xa'));var jayson=require(_0x0456('0xb'));var client=jayson[_0x0456('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41ce02,_0x490731,_0x36d744){return new BPromise(function(_0x31106d,_0x5b7e30){return client[_0x0456('0xd')](_0x41ce02,_0x36d744)[_0x0456('0xe')](function(_0x27e66d){logger['info'](_0x0456('0xf'),_0x490731,'request\x20sent');logger[_0x0456('0x10')](_0x0456('0x11'),_0x490731,_0x0456('0x12'),JSON[_0x0456('0x13')](_0x27e66d));if(_0x27e66d[_0x0456('0x14')]){if(_0x27e66d[_0x0456('0x14')]['code']===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x490731,_0x27e66d[_0x0456('0x14')][_0x0456('0x15')]);return _0x5b7e30(_0x27e66d[_0x0456('0x14')][_0x0456('0x15')]);}logger[_0x0456('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x490731,_0x27e66d[_0x0456('0x14')]['message']);return _0x31106d(_0x27e66d[_0x0456('0x14')]['message']);}else{logger[_0x0456('0x16')](_0x0456('0xf'),_0x490731,_0x0456('0x12'));_0x31106d(_0x27e66d[_0x0456('0x17')][_0x0456('0x15')]);}})['catch'](function(_0x5cb81d){logger[_0x0456('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x490731,_0x5cb81d);_0x5b7e30(_0x5cb81d);});});} \ No newline at end of file +var _0xa7d7=['error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2abffd,_0x760487){var _0xe147d4=function(_0x39fa89){while(--_0x39fa89){_0x2abffd['push'](_0x2abffd['shift']());}};_0xe147d4(++_0x760487);}(_0xa7d7,0x78));var _0x7a7d=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xa7d7[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var moment=require(_0x7a7d('0x2'));var BPromise=require(_0x7a7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a7d('0x4'));var db=require(_0x7a7d('0x5'))['db'];var utils=require(_0x7a7d('0x6'));var logger=require(_0x7a7d('0x7'))(_0x7a7d('0x8'));var config=require(_0x7a7d('0x9'));var jayson=require(_0x7a7d('0xa'));var client=jayson[_0x7a7d('0xb')][_0x7a7d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x564738,_0x128128,_0x166a31){return new BPromise(function(_0x24df44,_0x39e53e){return client['request'](_0x564738,_0x166a31)[_0x7a7d('0xd')](function(_0x325e94){logger['info'](_0x7a7d('0xe'),_0x128128,_0x7a7d('0xf'));logger['debug'](_0x7a7d('0x10'),_0x128128,_0x7a7d('0xf'),JSON[_0x7a7d('0x11')](_0x325e94));if(_0x325e94[_0x7a7d('0x12')]){if(_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x13')]===0x1f4){logger['error'](_0x7a7d('0xe'),_0x128128,_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x14')]);return _0x39e53e(_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x14')]);}logger['error'](_0x7a7d('0xe'),_0x128128,_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x14')]);return _0x24df44(_0x325e94[_0x7a7d('0x12')][_0x7a7d('0x14')]);}else{logger['info'](_0x7a7d('0xe'),_0x128128,_0x7a7d('0xf'));_0x24df44(_0x325e94[_0x7a7d('0x15')]['message']);}})[_0x7a7d('0x16')](function(_0xa678e8){logger[_0x7a7d('0x12')](_0x7a7d('0xe'),_0x128128,_0xa678e8);_0x39e53e(_0xa678e8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 232ed4a..2a42377 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 _0x7c23=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x7c23,0x14c));var _0x37c2=function(_0xddb2d1,_0x31824b){_0xddb2d1=_0xddb2d1-0x0;var _0x1e26d0=_0x7c23[_0xddb2d1];return _0x1e26d0;};'use strict';var multer=require(_0x37c2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x37c2('0x1'));var express=require(_0x37c2('0x2'));var router=express[_0x37c2('0x3')]();var auth=require(_0x37c2('0x4'));var interaction=require(_0x37c2('0x5'));var config=require(_0x37c2('0x6'));var controller=require(_0x37c2('0x7'));router[_0x37c2('0x8')]('/',auth['isAuthenticated'](),controller[_0x37c2('0x9')]);router[_0x37c2('0x8')](_0x37c2('0xa'),auth[_0x37c2('0xb')](),controller[_0x37c2('0xc')]);router['post']('/',auth[_0x37c2('0xb')](),controller[_0x37c2('0xd')]);router[_0x37c2('0xe')](_0x37c2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x37c2('0xf')](_0x37c2('0xa'),auth[_0x37c2('0xb')](),controller[_0x37c2('0x10')]);module[_0x37c2('0x11')]=router; \ No newline at end of file +var _0xa9c6=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x523212,_0x437cc3){var _0x38c3b2=function(_0x863e08){while(--_0x863e08){_0x523212['push'](_0x523212['shift']());}};_0x38c3b2(++_0x437cc3);}(_0xa9c6,0x98));var _0x6a9c=function(_0x460323,_0x351529){_0x460323=_0x460323-0x0;var _0x55a047=_0xa9c6[_0x460323];return _0x55a047;};'use strict';var multer=require(_0x6a9c('0x0'));var util=require(_0x6a9c('0x1'));var path=require(_0x6a9c('0x2'));var timeout=require(_0x6a9c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6a9c('0x4'));var interaction=require(_0x6a9c('0x5'));var config=require('../../config/environment');var controller=require(_0x6a9c('0x6'));router[_0x6a9c('0x7')]('/',auth[_0x6a9c('0x8')](),controller[_0x6a9c('0x9')]);router['get'](_0x6a9c('0xa'),auth[_0x6a9c('0x8')](),controller[_0x6a9c('0xb')]);router['post']('/',auth[_0x6a9c('0x8')](),controller[_0x6a9c('0xc')]);router[_0x6a9c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6a9c('0xe')]);router['delete'](_0x6a9c('0xa'),auth[_0x6a9c('0x8')](),controller[_0x6a9c('0xf')]);module[_0x6a9c('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 41434e5..90c31a2 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 _0x6aad=['sequelize','exports','STRING'];(function(_0x3a1ce7,_0x267399){var _0x5311ed=function(_0x270277){while(--_0x270277){_0x3a1ce7['push'](_0x3a1ce7['shift']());}};_0x5311ed(++_0x267399);}(_0x6aad,0xfc));var _0xd6aa=function(_0x2c5777,_0x484619){_0x2c5777=_0x2c5777-0x0;var _0x579244=_0x6aad[_0x2c5777];return _0x579244;};'use strict';var Sequelize=require(_0xd6aa('0x0'));module[_0xd6aa('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd6aa('0x2')]}}; \ No newline at end of file +var _0xf3a4=['STRING'];(function(_0x57062a,_0x123026){var _0xa178da=function(_0x1702d6){while(--_0x1702d6){_0x57062a['push'](_0x57062a['shift']());}};_0xa178da(++_0x123026);}(_0xf3a4,0xf4));var _0x4f3a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf3a4[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4f3a('0x0')]},'basename':{'type':Sequelize[_0x4f3a('0x0')]},'type':{'type':Sequelize[_0x4f3a('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 7796338..75ee18c 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 _0x5bcd=['zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','then','end','error','stack','send','index','map','Attachment','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','options','includeAll','include','rows','catch','show','params','keys','find','get','omit','updatedAt','body','createdAt','create','file','originalname','filename','mimetype','download','findOne','join','root','server/files/attachments/','basename','html-pdf','eml-format','rimraf'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x5bcd,0x1ab));var _0xd5bc=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x5bcd[_0x138f59];return _0x3d114d;};'use strict';var pdf=require(_0xd5bc('0x0'));var emlformat=require(_0xd5bc('0x1'));var rimraf=require(_0xd5bc('0x2'));var zipdir=require(_0xd5bc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd5bc('0x4'));var util=require(_0xd5bc('0x5'));var path=require(_0xd5bc('0x6'));var sox=require(_0xd5bc('0x7'));var csv=require(_0xd5bc('0x8'));var ejs=require(_0xd5bc('0x9'));var fs=require('fs');var _=require(_0xd5bc('0xa'));var squel=require('squel');var crypto=require(_0xd5bc('0xb'));var jsforce=require(_0xd5bc('0xc'));var deskjs=require(_0xd5bc('0xd'));var toCsv=require(_0xd5bc('0x8'));var querystring=require(_0xd5bc('0xe'));var Papa=require(_0xd5bc('0xf'));var Redis=require('ioredis');var authService=require(_0xd5bc('0x10'));var qs=require(_0xd5bc('0x11'));var as=require(_0xd5bc('0x12'));var hardwareService=require(_0xd5bc('0x13'));var logger=require(_0xd5bc('0x14'))(_0xd5bc('0x15'));var utils=require(_0xd5bc('0x16'));var config=require(_0xd5bc('0x17'));var db=require(_0xd5bc('0x18'))['db'];function respondWithStatusCode(_0x5dc810,_0x1a5aa7){_0x1a5aa7=_0x1a5aa7||0xcc;return function(_0x397927){if(_0x397927){return _0x5dc810[_0xd5bc('0x19')](_0x1a5aa7);}return _0x5dc810[_0xd5bc('0x1a')](_0x1a5aa7)['end']();};}function respondWithResult(_0x543f3f,_0x252142){_0x252142=_0x252142||0xc8;return function(_0x5ed7c0){if(_0x5ed7c0){return _0x543f3f[_0xd5bc('0x1a')](_0x252142)[_0xd5bc('0x1b')](_0x5ed7c0);}};}function respondWithFilteredResult(_0x1639c1,_0x20d930){return function(_0x36c0e1){if(_0x36c0e1){var _0x490af4=_0x36c0e1[_0xd5bc('0x1c')],_0x232cc8=_0x20d930['offset'],_0x50ff76=_0x20d930[_0xd5bc('0x1d')]+_0x20d930[_0xd5bc('0x1e')],_0x56131e;if(_0x50ff76>=_0x490af4){_0x50ff76=_0x490af4;_0x56131e=0xc8;}else{_0x56131e=0xce;}_0x1639c1[_0xd5bc('0x1a')](_0x56131e);return _0x1639c1[_0xd5bc('0x1f')]('Content-Range',_0x232cc8+'-'+_0x50ff76+'/'+_0x490af4)['json'](_0x36c0e1);}return null;};}function patchUpdates(_0x553d1b){return function(_0x354cbb){try{jsonpatch[_0xd5bc('0x20')](_0x354cbb,_0x553d1b,!![]);}catch(_0x401ad7){return BPromise[_0xd5bc('0x21')](_0x401ad7);}return _0x354cbb['save']();};}function saveUpdates(_0x5c299c,_0x4581d3){return function(_0x43c15f){if(_0x43c15f){return _0x43c15f[_0xd5bc('0x22')](_0x5c299c)['then'](function(_0x4c07d8){return _0x4c07d8;});}return null;};}function removeEntity(_0x2963c3,_0x1765df){return function(_0x2f7272){if(_0x2f7272){return _0x2f7272[_0xd5bc('0x23')]()[_0xd5bc('0x24')](function(){_0x2963c3[_0xd5bc('0x1a')](0xcc)[_0xd5bc('0x25')]();});}};}function handleEntityNotFound(_0x4ce439,_0x42ba17){return function(_0x2d5643){if(!_0x2d5643){_0x4ce439['sendStatus'](0x194);}return _0x2d5643;};}function handleError(_0x1fcd17,_0x1ebfeb){_0x1ebfeb=_0x1ebfeb||0x1f4;return function(_0x4777e4){logger[_0xd5bc('0x26')](_0x4777e4[_0xd5bc('0x27')]);if(_0x4777e4['name']){delete _0x4777e4['name'];}_0x1fcd17[_0xd5bc('0x1a')](_0x1ebfeb)[_0xd5bc('0x28')](_0x4777e4);};}exports[_0xd5bc('0x29')]=function(_0x2af257,_0xf5ea38){var _0x45ec98={},_0x275018={},_0x4c39ef={'count':0x0,'rows':[]};var _0x183137=_[_0xd5bc('0x2a')](db[_0xd5bc('0x2b')][_0xd5bc('0x2c')],function(_0x497c3f){return{'name':_0x497c3f[_0xd5bc('0x2d')],'type':_0x497c3f['type'][_0xd5bc('0x2e')]};});_0x275018[_0xd5bc('0x2f')]=_[_0xd5bc('0x2a')](_0x183137,_0xd5bc('0x30'));_0x275018[_0xd5bc('0x31')]=_['keys'](_0x2af257[_0xd5bc('0x31')]);_0x275018[_0xd5bc('0x32')]=_[_0xd5bc('0x33')](_0x275018['model'],_0x275018[_0xd5bc('0x31')]);_0x45ec98[_0xd5bc('0x34')]=_[_0xd5bc('0x33')](_0x275018[_0xd5bc('0x2f')],qs[_0xd5bc('0x35')](_0x2af257['query'][_0xd5bc('0x35')]));_0x45ec98[_0xd5bc('0x34')]=_0x45ec98[_0xd5bc('0x34')][_0xd5bc('0x36')]?_0x45ec98[_0xd5bc('0x34')]:_0x275018[_0xd5bc('0x2f')];if(!_0x2af257['query']['hasOwnProperty'](_0xd5bc('0x37'))){_0x45ec98[_0xd5bc('0x1e')]=qs[_0xd5bc('0x1e')](_0x2af257[_0xd5bc('0x31')][_0xd5bc('0x1e')]);_0x45ec98['offset']=qs['offset'](_0x2af257[_0xd5bc('0x31')][_0xd5bc('0x1d')]);}_0x45ec98[_0xd5bc('0x38')]=qs[_0xd5bc('0x39')](_0x2af257[_0xd5bc('0x31')][_0xd5bc('0x39')]);_0x45ec98[_0xd5bc('0x3a')]=qs[_0xd5bc('0x32')](_[_0xd5bc('0x3b')](_0x2af257[_0xd5bc('0x31')],_0x275018[_0xd5bc('0x32')]),_0x183137);if(_0x2af257[_0xd5bc('0x31')]['filter']){_0x45ec98[_0xd5bc('0x3a')]=_[_0xd5bc('0x3c')](_0x45ec98[_0xd5bc('0x3a')],{'$or':_[_0xd5bc('0x2a')](_0x183137,function(_0x21f2f){if(_0x21f2f['type']!=='VIRTUAL'){var _0x4052a5={};_0x4052a5[_0x21f2f[_0xd5bc('0x30')]]={'$like':'%'+_0x2af257[_0xd5bc('0x31')]['filter']+'%'};return _0x4052a5;}})});}_0x45ec98=_[_0xd5bc('0x3c')]({},_0x45ec98,_0x2af257[_0xd5bc('0x3d')]);var _0x3d1f64={'where':_0x45ec98[_0xd5bc('0x3a')]};return db[_0xd5bc('0x2b')][_0xd5bc('0x1c')](_0x3d1f64)['then'](function(_0x439a2e){_0x4c39ef[_0xd5bc('0x1c')]=_0x439a2e;if(_0x2af257[_0xd5bc('0x31')][_0xd5bc('0x3e')]){_0x45ec98[_0xd5bc('0x3f')]=[{'all':!![]}];}return db[_0xd5bc('0x2b')]['findAll'](_0x45ec98);})[_0xd5bc('0x24')](function(_0x88e385){_0x4c39ef[_0xd5bc('0x40')]=_0x88e385;return _0x4c39ef;})['then'](respondWithFilteredResult(_0xf5ea38,_0x45ec98))[_0xd5bc('0x41')](handleError(_0xf5ea38,null));};exports[_0xd5bc('0x42')]=function(_0x1f9bb8,_0x2dfc7e){var _0x46a6b5={'raw':!![],'where':{'id':_0x1f9bb8[_0xd5bc('0x43')]['id']}},_0x538fb1={};_0x538fb1['model']=_['keys'](db['Attachment'][_0xd5bc('0x2c')]);_0x538fb1[_0xd5bc('0x31')]=_[_0xd5bc('0x44')](_0x1f9bb8['query']);_0x538fb1[_0xd5bc('0x32')]=_['intersection'](_0x538fb1[_0xd5bc('0x2f')],_0x538fb1['query']);_0x46a6b5[_0xd5bc('0x34')]=_['intersection'](_0x538fb1[_0xd5bc('0x2f')],qs[_0xd5bc('0x35')](_0x1f9bb8[_0xd5bc('0x31')][_0xd5bc('0x35')]));_0x46a6b5['attributes']=_0x46a6b5[_0xd5bc('0x34')][_0xd5bc('0x36')]?_0x46a6b5[_0xd5bc('0x34')]:_0x538fb1['model'];if(_0x1f9bb8[_0xd5bc('0x31')]['includeAll']){_0x46a6b5[_0xd5bc('0x3f')]=[{'all':!![]}];}_0x46a6b5=_[_0xd5bc('0x3c')]({},_0x46a6b5,_0x1f9bb8[_0xd5bc('0x3d')]);return db[_0xd5bc('0x2b')][_0xd5bc('0x45')](_0x46a6b5)[_0xd5bc('0x24')](handleEntityNotFound(_0x2dfc7e,null))['then'](respondWithResult(_0x2dfc7e,null))[_0xd5bc('0x41')](handleError(_0x2dfc7e,null));};exports['clone']=function(_0x3e9ac5,_0x2547cb){var _0x1ea48d={'where':{'id':_0x3e9ac5[_0xd5bc('0x43')]['id']}},_0x3b3374={};_0x3b3374['model']=_['keys'](db[_0xd5bc('0x2b')]['rawAttributes']);_0x1ea48d[_0xd5bc('0x34')]=_[_0xd5bc('0x33')](_0x3b3374['model'],qs[_0xd5bc('0x35')](_0x3e9ac5['query']['fields']));_0x1ea48d['attributes']=_0x1ea48d[_0xd5bc('0x34')][_0xd5bc('0x36')]?_0x1ea48d[_0xd5bc('0x34')]:_0x3b3374[_0xd5bc('0x2f')];if(_0x3e9ac5[_0xd5bc('0x31')]['includeAll']){_0x1ea48d['include']=[{'all':!![]}];}_0x1ea48d=_['merge']({},_0x1ea48d,_0x3e9ac5[_0xd5bc('0x3d')]);return db[_0xd5bc('0x2b')][_0xd5bc('0x45')](_0x1ea48d)[_0xd5bc('0x24')](handleEntityNotFound(_0x2547cb,null))[_0xd5bc('0x24')](function(_0x328411){if(_0x328411){var _0x536537=_0x328411[_0xd5bc('0x46')]({'plain':!![]});_0x536537=qs[_0xd5bc('0x47')](_0x536537,['id','createdAt',_0xd5bc('0x48')]);_0x3e9ac5['body']=_[_0xd5bc('0x47')](_0x3e9ac5[_0xd5bc('0x49')],['id',_0xd5bc('0x4a'),_0xd5bc('0x48')]);return db[_0xd5bc('0x2b')][_0xd5bc('0x4b')](_[_0xd5bc('0x3c')](_0x536537,_0x3e9ac5[_0xd5bc('0x49')]),{'include':_0x3e9ac5[_0xd5bc('0x31')][_0xd5bc('0x3e')]?[{'all':!![]}]:undefined});}})[_0xd5bc('0x24')](respondWithResult(_0x2547cb,0xc9))[_0xd5bc('0x41')](handleError(_0x2547cb,null));};exports[_0xd5bc('0x22')]=function(_0x554e94,_0x3407d1){if(_0x554e94[_0xd5bc('0x49')]['id']){delete _0x554e94['body']['id'];}return db[_0xd5bc('0x2b')][_0xd5bc('0x45')]({'where':{'id':_0x554e94[_0xd5bc('0x43')]['id']}})[_0xd5bc('0x24')](handleEntityNotFound(_0x3407d1,null))[_0xd5bc('0x24')](saveUpdates(_0x554e94[_0xd5bc('0x49')],null))[_0xd5bc('0x24')](respondWithResult(_0x3407d1,null))[_0xd5bc('0x41')](handleError(_0x3407d1,null));};exports[_0xd5bc('0x23')]=function(_0x16dee4,_0x1c52f2){return db[_0xd5bc('0x2b')][_0xd5bc('0x45')]({'where':{'id':_0x16dee4[_0xd5bc('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c52f2,null))['then'](removeEntity(_0x1c52f2,null))[_0xd5bc('0x41')](handleError(_0x1c52f2,null));};exports[_0xd5bc('0x4b')]=function(_0x1bf3ae,_0x44b8e2,_0x4b2017){_0x1bf3ae['body'][_0xd5bc('0x30')]=_0x1bf3ae[_0xd5bc('0x4c')][_0xd5bc('0x4d')];_0x1bf3ae['body']['basename']=_0x1bf3ae[_0xd5bc('0x4c')][_0xd5bc('0x4e')];_0x1bf3ae['body']['type']=_0x1bf3ae[_0xd5bc('0x4c')][_0xd5bc('0x4f')];return db['Attachment'][_0xd5bc('0x4b')](_0x1bf3ae['body'])[_0xd5bc('0x24')](respondWithResult(_0x44b8e2,0xc9))[_0xd5bc('0x41')](handleError(_0x44b8e2,null));};exports[_0xd5bc('0x50')]=function(_0x523970,_0x2a95a7,_0x167319){return db[_0xd5bc('0x2b')][_0xd5bc('0x51')]({'where':{'id':_0x523970[_0xd5bc('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2a95a7,null))[_0xd5bc('0x24')](function(_0x343868){if(_0x343868){return _0x2a95a7['download'](path[_0xd5bc('0x52')](config[_0xd5bc('0x53')],_0xd5bc('0x54'),_0x343868[_0xd5bc('0x55')]));}})[_0xd5bc('0x41')](handleError(_0x2a95a7,null));}; \ No newline at end of file +var _0xfecf=['find','clone','params','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','download','findOne','root','eml-format','zip-dir','request-promise','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','options'];(function(_0x4c44ef,_0x4ee3cd){var _0x2666e3=function(_0x52cc4a){while(--_0x52cc4a){_0x4c44ef['push'](_0x4c44ef['shift']());}};_0x2666e3(++_0x4ee3cd);}(_0xfecf,0xff));var _0xffec=function(_0x3ea2d3,_0x57c4ef){_0x3ea2d3=_0x3ea2d3-0x0;var _0x59c01c=_0xfecf[_0x3ea2d3];return _0x59c01c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xffec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffec('0x2'));var moment=require('moment');var BPromise=require(_0xffec('0x3'));var Mustache=require(_0xffec('0x4'));var util=require('util');var path=require('path');var sox=require(_0xffec('0x5'));var csv=require(_0xffec('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xffec('0x7'));var squel=require('squel');var crypto=require(_0xffec('0x8'));var jsforce=require(_0xffec('0x9'));var deskjs=require(_0xffec('0xa'));var toCsv=require(_0xffec('0x6'));var querystring=require('querystring');var Papa=require(_0xffec('0xb'));var Redis=require(_0xffec('0xc'));var authService=require(_0xffec('0xd'));var qs=require(_0xffec('0xe'));var as=require(_0xffec('0xf'));var hardwareService=require(_0xffec('0x10'));var logger=require(_0xffec('0x11'))('api');var utils=require(_0xffec('0x12'));var config=require(_0xffec('0x13'));var db=require(_0xffec('0x14'))['db'];function respondWithStatusCode(_0x1ada6a,_0x360f44){_0x360f44=_0x360f44||0xcc;return function(_0x5cd7da){if(_0x5cd7da){return _0x1ada6a['sendStatus'](_0x360f44);}return _0x1ada6a[_0xffec('0x15')](_0x360f44)['end']();};}function respondWithResult(_0x47a4a3,_0xc6923d){_0xc6923d=_0xc6923d||0xc8;return function(_0x14bf73){if(_0x14bf73){return _0x47a4a3[_0xffec('0x15')](_0xc6923d)['json'](_0x14bf73);}};}function respondWithFilteredResult(_0x2acf0c,_0x342df1){return function(_0x529080){if(_0x529080){var _0x3de83c=_0x529080[_0xffec('0x16')],_0x13ba32=_0x342df1[_0xffec('0x17')],_0x5dd03e=_0x342df1[_0xffec('0x17')]+_0x342df1[_0xffec('0x18')],_0x32150a;if(_0x5dd03e>=_0x3de83c){_0x5dd03e=_0x3de83c;_0x32150a=0xc8;}else{_0x32150a=0xce;}_0x2acf0c[_0xffec('0x15')](_0x32150a);return _0x2acf0c[_0xffec('0x19')](_0xffec('0x1a'),_0x13ba32+'-'+_0x5dd03e+'/'+_0x3de83c)[_0xffec('0x1b')](_0x529080);}return null;};}function patchUpdates(_0x9c0dad){return function(_0x280fee){try{jsonpatch['apply'](_0x280fee,_0x9c0dad,!![]);}catch(_0x3de054){return BPromise[_0xffec('0x1c')](_0x3de054);}return _0x280fee[_0xffec('0x1d')]();};}function saveUpdates(_0x4f9665,_0x2d0de4){return function(_0x27577d){if(_0x27577d){return _0x27577d[_0xffec('0x1e')](_0x4f9665)[_0xffec('0x1f')](function(_0x3e7cfb){return _0x3e7cfb;});}return null;};}function removeEntity(_0x1b5091,_0x15c219){return function(_0x253863){if(_0x253863){return _0x253863[_0xffec('0x20')]()[_0xffec('0x1f')](function(){_0x1b5091[_0xffec('0x15')](0xcc)[_0xffec('0x21')]();});}};}function handleEntityNotFound(_0x2db289,_0xe93bbf){return function(_0x636c43){if(!_0x636c43){_0x2db289[_0xffec('0x22')](0x194);}return _0x636c43;};}function handleError(_0x54bb49,_0x349a22){_0x349a22=_0x349a22||0x1f4;return function(_0x4063b1){logger[_0xffec('0x23')](_0x4063b1[_0xffec('0x24')]);if(_0x4063b1[_0xffec('0x25')]){delete _0x4063b1['name'];}_0x54bb49[_0xffec('0x15')](_0x349a22)[_0xffec('0x26')](_0x4063b1);};}exports[_0xffec('0x27')]=function(_0x1b8ea1,_0x5063f2){var _0x264311={},_0x2f54fa={},_0x51b265={'count':0x0,'rows':[]};var _0x5c53a8=_[_0xffec('0x28')](db[_0xffec('0x29')][_0xffec('0x2a')],function(_0x564951){return{'name':_0x564951[_0xffec('0x2b')],'type':_0x564951[_0xffec('0x2c')][_0xffec('0x2d')]};});_0x2f54fa[_0xffec('0x2e')]=_['map'](_0x5c53a8,'name');_0x2f54fa['query']=_['keys'](_0x1b8ea1[_0xffec('0x2f')]);_0x2f54fa[_0xffec('0x30')]=_['intersection'](_0x2f54fa[_0xffec('0x2e')],_0x2f54fa[_0xffec('0x2f')]);_0x264311['attributes']=_[_0xffec('0x31')](_0x2f54fa[_0xffec('0x2e')],qs[_0xffec('0x32')](_0x1b8ea1[_0xffec('0x2f')][_0xffec('0x32')]));_0x264311[_0xffec('0x33')]=_0x264311[_0xffec('0x33')][_0xffec('0x34')]?_0x264311['attributes']:_0x2f54fa[_0xffec('0x2e')];if(!_0x1b8ea1[_0xffec('0x2f')]['hasOwnProperty']('nolimit')){_0x264311[_0xffec('0x18')]=qs[_0xffec('0x18')](_0x1b8ea1['query'][_0xffec('0x18')]);_0x264311[_0xffec('0x17')]=qs[_0xffec('0x17')](_0x1b8ea1[_0xffec('0x2f')]['offset']);}_0x264311['order']=qs['sort'](_0x1b8ea1[_0xffec('0x2f')]['sort']);_0x264311[_0xffec('0x35')]=qs[_0xffec('0x30')](_[_0xffec('0x36')](_0x1b8ea1[_0xffec('0x2f')],_0x2f54fa['filters']),_0x5c53a8);if(_0x1b8ea1[_0xffec('0x2f')][_0xffec('0x37')]){_0x264311[_0xffec('0x35')]=_[_0xffec('0x38')](_0x264311[_0xffec('0x35')],{'$or':_[_0xffec('0x28')](_0x5c53a8,function(_0x78108f){if(_0x78108f[_0xffec('0x2c')]!==_0xffec('0x39')){var _0xc87d31={};_0xc87d31[_0x78108f[_0xffec('0x25')]]={'$like':'%'+_0x1b8ea1['query'][_0xffec('0x37')]+'%'};return _0xc87d31;}})});}_0x264311=_[_0xffec('0x38')]({},_0x264311,_0x1b8ea1['options']);var _0x51f050={'where':_0x264311[_0xffec('0x35')]};return db['Attachment']['count'](_0x51f050)[_0xffec('0x1f')](function(_0x39f56b){_0x51b265['count']=_0x39f56b;if(_0x1b8ea1[_0xffec('0x2f')][_0xffec('0x3a')]){_0x264311[_0xffec('0x3b')]=[{'all':!![]}];}return db[_0xffec('0x29')][_0xffec('0x3c')](_0x264311);})[_0xffec('0x1f')](function(_0x4d108c){_0x51b265['rows']=_0x4d108c;return _0x51b265;})[_0xffec('0x1f')](respondWithFilteredResult(_0x5063f2,_0x264311))[_0xffec('0x3d')](handleError(_0x5063f2,null));};exports[_0xffec('0x3e')]=function(_0x44342a,_0x1d5417){var _0x5cb333={'raw':!![],'where':{'id':_0x44342a['params']['id']}},_0x166887={};_0x166887[_0xffec('0x2e')]=_[_0xffec('0x3f')](db[_0xffec('0x29')][_0xffec('0x2a')]);_0x166887[_0xffec('0x2f')]=_[_0xffec('0x3f')](_0x44342a['query']);_0x166887[_0xffec('0x30')]=_[_0xffec('0x31')](_0x166887[_0xffec('0x2e')],_0x166887[_0xffec('0x2f')]);_0x5cb333['attributes']=_[_0xffec('0x31')](_0x166887['model'],qs[_0xffec('0x32')](_0x44342a[_0xffec('0x2f')][_0xffec('0x32')]));_0x5cb333[_0xffec('0x33')]=_0x5cb333[_0xffec('0x33')][_0xffec('0x34')]?_0x5cb333[_0xffec('0x33')]:_0x166887[_0xffec('0x2e')];if(_0x44342a[_0xffec('0x2f')][_0xffec('0x3a')]){_0x5cb333[_0xffec('0x3b')]=[{'all':!![]}];}_0x5cb333=_[_0xffec('0x38')]({},_0x5cb333,_0x44342a[_0xffec('0x40')]);return db[_0xffec('0x29')][_0xffec('0x41')](_0x5cb333)['then'](handleEntityNotFound(_0x1d5417,null))[_0xffec('0x1f')](respondWithResult(_0x1d5417,null))[_0xffec('0x3d')](handleError(_0x1d5417,null));};exports[_0xffec('0x42')]=function(_0x13bfe2,_0x245bc2){var _0x587c1f={'where':{'id':_0x13bfe2[_0xffec('0x43')]['id']}},_0x363b9a={};_0x363b9a[_0xffec('0x2e')]=_['keys'](db[_0xffec('0x29')][_0xffec('0x2a')]);_0x587c1f[_0xffec('0x33')]=_[_0xffec('0x31')](_0x363b9a[_0xffec('0x2e')],qs[_0xffec('0x32')](_0x13bfe2[_0xffec('0x2f')][_0xffec('0x32')]));_0x587c1f['attributes']=_0x587c1f[_0xffec('0x33')][_0xffec('0x34')]?_0x587c1f['attributes']:_0x363b9a[_0xffec('0x2e')];if(_0x13bfe2['query']['includeAll']){_0x587c1f['include']=[{'all':!![]}];}_0x587c1f=_[_0xffec('0x38')]({},_0x587c1f,_0x13bfe2[_0xffec('0x40')]);return db[_0xffec('0x29')][_0xffec('0x41')](_0x587c1f)['then'](handleEntityNotFound(_0x245bc2,null))[_0xffec('0x1f')](function(_0x1d327d){if(_0x1d327d){var _0x1abd7c=_0x1d327d['get']({'plain':!![]});_0x1abd7c=qs[_0xffec('0x44')](_0x1abd7c,['id',_0xffec('0x45'),_0xffec('0x46')]);_0x13bfe2['body']=_[_0xffec('0x44')](_0x13bfe2[_0xffec('0x47')],['id','createdAt',_0xffec('0x46')]);return db['Attachment'][_0xffec('0x48')](_[_0xffec('0x38')](_0x1abd7c,_0x13bfe2[_0xffec('0x47')]),{'include':_0x13bfe2[_0xffec('0x2f')][_0xffec('0x3a')]?[{'all':!![]}]:undefined});}})[_0xffec('0x1f')](respondWithResult(_0x245bc2,0xc9))[_0xffec('0x3d')](handleError(_0x245bc2,null));};exports[_0xffec('0x1e')]=function(_0x22f345,_0x4ae7bf){if(_0x22f345[_0xffec('0x47')]['id']){delete _0x22f345[_0xffec('0x47')]['id'];}return db['Attachment'][_0xffec('0x41')]({'where':{'id':_0x22f345[_0xffec('0x43')]['id']}})[_0xffec('0x1f')](handleEntityNotFound(_0x4ae7bf,null))[_0xffec('0x1f')](saveUpdates(_0x22f345[_0xffec('0x47')],null))[_0xffec('0x1f')](respondWithResult(_0x4ae7bf,null))[_0xffec('0x3d')](handleError(_0x4ae7bf,null));};exports['destroy']=function(_0xea5bd4,_0x541c5f){return db[_0xffec('0x29')][_0xffec('0x41')]({'where':{'id':_0xea5bd4[_0xffec('0x43')]['id']}})['then'](handleEntityNotFound(_0x541c5f,null))[_0xffec('0x1f')](removeEntity(_0x541c5f,null))[_0xffec('0x3d')](handleError(_0x541c5f,null));};exports['create']=function(_0x502c25,_0x863192,_0x152af){_0x502c25[_0xffec('0x47')][_0xffec('0x25')]=_0x502c25[_0xffec('0x49')][_0xffec('0x4a')];_0x502c25[_0xffec('0x47')][_0xffec('0x4b')]=_0x502c25[_0xffec('0x49')]['filename'];_0x502c25[_0xffec('0x47')][_0xffec('0x2c')]=_0x502c25[_0xffec('0x49')][_0xffec('0x4c')];return db['Attachment'][_0xffec('0x48')](_0x502c25[_0xffec('0x47')])[_0xffec('0x1f')](respondWithResult(_0x863192,0xc9))[_0xffec('0x3d')](handleError(_0x863192,null));};exports[_0xffec('0x4d')]=function(_0x556067,_0x9934b1,_0x19687b){return db['Attachment'][_0xffec('0x4e')]({'where':{'id':_0x556067[_0xffec('0x43')]['id']},'raw':!![]})[_0xffec('0x1f')](handleEntityNotFound(_0x9934b1,null))[_0xffec('0x1f')](function(_0x51a551){if(_0x51a551){return _0x9934b1['download'](path['join'](config[_0xffec('0x4f')],'server/files/attachments/',_0x51a551[_0xffec('0x4b')]));}})[_0xffec('0x3d')](handleError(_0x9934b1,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 149e42d..add3f9d 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 _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash'];(function(_0x523510,_0x118cd6){var _0x1e9ce6=function(_0x30d094){while(--_0x30d094){_0x523510['push'](_0x523510['shift']());}};_0x1e9ce6(++_0x118cd6);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x668b=['attachments','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./attachment.attributes','define','Attachment'];(function(_0x14102c,_0x1cb214){var _0x13297b=function(_0x1f4372){while(--_0x1f4372){_0x14102c['push'](_0x14102c['shift']());}};_0x13297b(++_0x1cb214);}(_0x668b,0x140));var _0xb668=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0x668b[_0x58d5ac];return _0x37985c;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'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 000993d..84b02f7 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 _0x9a84=['Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','then','CreateAttachment','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x25f9f5,_0x2dbbae){var _0x40276e=function(_0xbe10a4){while(--_0xbe10a4){_0x25f9f5['push'](_0x25f9f5['shift']());}};_0x40276e(++_0x2dbbae);}(_0x9a84,0x1d0));var _0x49a8=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0x9a84[_0x30b159];return _0x23c3f9;};'use strict';var _=require(_0x49a8('0x0'));var util=require(_0x49a8('0x1'));var moment=require(_0x49a8('0x2'));var BPromise=require(_0x49a8('0x3'));var rs=require(_0x49a8('0x4'));var fs=require('fs');var Redis=require(_0x49a8('0x5'));var db=require(_0x49a8('0x6'))['db'];var utils=require(_0x49a8('0x7'));var logger=require(_0x49a8('0x8'))(_0x49a8('0x9'));var config=require(_0x49a8('0xa'));var jayson=require(_0x49a8('0xb'));var client=jayson[_0x49a8('0xc')][_0x49a8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2e0cda,_0x362c19,_0x4fa82b){return new BPromise(function(_0x2a302a,_0x56398e){return client[_0x49a8('0xe')](_0x2e0cda,_0x4fa82b)['then'](function(_0x288979){logger[_0x49a8('0xf')](_0x49a8('0x10'),_0x362c19,_0x49a8('0x11'));logger['debug'](_0x49a8('0x12'),_0x362c19,_0x49a8('0x11'),JSON[_0x49a8('0x13')](_0x288979));if(_0x288979[_0x49a8('0x14')]){if(_0x288979[_0x49a8('0x14')]['code']===0x1f4){logger[_0x49a8('0x14')]('Attachment,\x20%s,\x20%s',_0x362c19,_0x288979[_0x49a8('0x14')][_0x49a8('0x15')]);return _0x56398e(_0x288979[_0x49a8('0x14')]['message']);}logger['error']('Attachment,\x20%s,\x20%s',_0x362c19,_0x288979['error'][_0x49a8('0x15')]);return _0x2a302a(_0x288979[_0x49a8('0x14')]['message']);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x362c19,_0x49a8('0x11'));_0x2a302a(_0x288979[_0x49a8('0x16')][_0x49a8('0x15')]);}})[_0x49a8('0x17')](function(_0x3e6ae3){logger[_0x49a8('0x14')](_0x49a8('0x10'),_0x362c19,_0x3e6ae3);_0x56398e(_0x3e6ae3);});});}exports['CreateAttachment']=function(_0xa7ecc){var _0x31a9a9=this;return new Promise(function(_0x4b8649,_0x3793cd){return db['Attachment'][_0x49a8('0x18')](_0xa7ecc[_0x49a8('0x19')],{'raw':_0xa7ecc[_0x49a8('0x1a')]?_0xa7ecc[_0x49a8('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x49a8('0x1b')](function(_0x465247){logger[_0x49a8('0xf')](_0x49a8('0x1c'),_0xa7ecc);logger[_0x49a8('0x1d')](_0x49a8('0x1c'),_0xa7ecc,JSON['stringify'](_0x465247));_0x4b8649(_0x465247);})[_0x49a8('0x17')](function(_0x2aa2a3){logger[_0x49a8('0x14')]('CreateAttachment',_0x2aa2a3[_0x49a8('0x15')],_0xa7ecc);_0x3793cd(_0x31a9a9[_0x49a8('0x14')](0x1f4,_0x2aa2a3['message']));});});}; \ No newline at end of file +var _0xd4e4=['error','code','message','info','request\x20sent','result','catch','Attachment','create','body','options','raw','then','CreateAttachment','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1fc418,_0x9078b2){var _0x44860d=function(_0x42ee07){while(--_0x42ee07){_0x1fc418['push'](_0x1fc418['shift']());}};_0x44860d(++_0x9078b2);}(_0xd4e4,0x1ea));var _0x4d4e=function(_0x2d6908,_0x508240){_0x2d6908=_0x2d6908-0x0;var _0x31ac32=_0xd4e4[_0x2d6908];return _0x31ac32;};'use strict';var _=require(_0x4d4e('0x0'));var util=require(_0x4d4e('0x1'));var moment=require(_0x4d4e('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d4e('0x3'));var fs=require('fs');var Redis=require(_0x4d4e('0x4'));var db=require(_0x4d4e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4d4e('0x6'));var client=jayson[_0x4d4e('0x7')][_0x4d4e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3188bf,_0xcef695,_0x1dc6d0){return new BPromise(function(_0x27fe3f,_0x598eca){return client[_0x4d4e('0x9')](_0x3188bf,_0x1dc6d0)['then'](function(_0x24b61d){logger['info'](_0x4d4e('0xa'),_0xcef695,'request\x20sent');logger[_0x4d4e('0xb')](_0x4d4e('0xc'),_0xcef695,'request\x20sent',JSON[_0x4d4e('0xd')](_0x24b61d));if(_0x24b61d[_0x4d4e('0xe')]){if(_0x24b61d['error'][_0x4d4e('0xf')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0xcef695,_0x24b61d[_0x4d4e('0xe')][_0x4d4e('0x10')]);return _0x598eca(_0x24b61d[_0x4d4e('0xe')]['message']);}logger[_0x4d4e('0xe')](_0x4d4e('0xa'),_0xcef695,_0x24b61d[_0x4d4e('0xe')][_0x4d4e('0x10')]);return _0x27fe3f(_0x24b61d[_0x4d4e('0xe')][_0x4d4e('0x10')]);}else{logger[_0x4d4e('0x11')](_0x4d4e('0xa'),_0xcef695,_0x4d4e('0x12'));_0x27fe3f(_0x24b61d[_0x4d4e('0x13')][_0x4d4e('0x10')]);}})[_0x4d4e('0x14')](function(_0x267f8b){logger[_0x4d4e('0xe')]('Attachment,\x20%s,\x20%s',_0xcef695,_0x267f8b);_0x598eca(_0x267f8b);});});}exports['CreateAttachment']=function(_0x41d30b){var _0x437e69=this;return new Promise(function(_0x591e68,_0x4a8e82){return db[_0x4d4e('0x15')][_0x4d4e('0x16')](_0x41d30b[_0x4d4e('0x17')],{'raw':_0x41d30b[_0x4d4e('0x18')]?_0x41d30b[_0x4d4e('0x18')][_0x4d4e('0x19')]===undefined?!![]:![]:!![]})[_0x4d4e('0x1a')](function(_0x40ce5f){logger[_0x4d4e('0x11')](_0x4d4e('0x1b'),_0x41d30b);logger[_0x4d4e('0xb')](_0x4d4e('0x1b'),_0x41d30b,JSON['stringify'](_0x40ce5f));_0x591e68(_0x40ce5f);})[_0x4d4e('0x14')](function(_0x22260d){logger[_0x4d4e('0xe')](_0x4d4e('0x1b'),_0x22260d[_0x4d4e('0x10')],_0x41d30b);_0x4a8e82(_0x437e69['error'](0x1f4,_0x22260d[_0x4d4e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 35c1e0d..3d80766 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 _0x3d3b=['root','server/files/attachments/','format','%s-%s','now','single','create','put','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','/:id','isAuthenticated','show','download','post','/:id/clone','diskStorage','join'];(function(_0x33c613,_0x2ce6bb){var _0x3f36e1=function(_0x339044){while(--_0x339044){_0x33c613['push'](_0x33c613['shift']());}};_0x3f36e1(++_0x2ce6bb);}(_0x3d3b,0x1af));var _0xb3d3=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x3d3b[_0xc8a931];return _0x28bd27;};'use strict';var multer=require(_0xb3d3('0x0'));var util=require('util');var path=require(_0xb3d3('0x1'));var timeout=require(_0xb3d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb3d3('0x3'));var interaction=require(_0xb3d3('0x4'));var config=require(_0xb3d3('0x5'));var controller=require(_0xb3d3('0x6'));router[_0xb3d3('0x7')]('/',auth['isAuthenticated'](),controller[_0xb3d3('0x8')]);router[_0xb3d3('0x7')](_0xb3d3('0x9'),auth[_0xb3d3('0xa')](),controller[_0xb3d3('0xb')]);router['get']('/:id/download',auth[_0xb3d3('0xa')](),controller[_0xb3d3('0xc')]);router[_0xb3d3('0xd')](_0xb3d3('0xe'),auth[_0xb3d3('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0xb3d3('0xf')]({'destination':function(_0x35908d,_0x10bf14,_0x597196){_0x597196(null,path[_0xb3d3('0x10')](config[_0xb3d3('0x11')],_0xb3d3('0x12')));},'filename':function(_0x9e85bf,_0x327df1,_0x43434d){_0x43434d(null,util[_0xb3d3('0x13')](_0xb3d3('0x14'),Date[_0xb3d3('0x15')](),_0x327df1['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb3d3('0xd')]('/',upload[_0xb3d3('0x16')]('file'),controller[_0xb3d3('0x17')]);router[_0xb3d3('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb3d3('0x19')](_0xb3d3('0x9'),auth[_0xb3d3('0xa')](),controller[_0xb3d3('0x1a')]);module[_0xb3d3('0x1b')]=router; \ No newline at end of file +var _0xee65=['single','file','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','post'];(function(_0x3a283d,_0xb82548){var _0x10c980=function(_0x336ab0){while(--_0x336ab0){_0x3a283d['push'](_0x3a283d['shift']());}};_0x10c980(++_0xb82548);}(_0xee65,0x138));var _0x5ee6=function(_0x4c6f55,_0x12ae95){_0x4c6f55=_0x4c6f55-0x0;var _0x3418f6=_0xee65[_0x4c6f55];return _0x3418f6;};'use strict';var multer=require(_0x5ee6('0x0'));var util=require(_0x5ee6('0x1'));var path=require(_0x5ee6('0x2'));var timeout=require(_0x5ee6('0x3'));var express=require(_0x5ee6('0x4'));var router=express[_0x5ee6('0x5')]();var auth=require(_0x5ee6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5ee6('0x7'));var controller=require(_0x5ee6('0x8'));router[_0x5ee6('0x9')]('/',auth[_0x5ee6('0xa')](),controller[_0x5ee6('0xb')]);router['get'](_0x5ee6('0xc'),auth['isAuthenticated'](),controller[_0x5ee6('0xd')]);router[_0x5ee6('0x9')](_0x5ee6('0xe'),auth[_0x5ee6('0xa')](),controller[_0x5ee6('0xf')]);router['post'](_0x5ee6('0x10'),auth['isAuthenticated'](),controller[_0x5ee6('0x11')]);var upload=multer({'storage':multer[_0x5ee6('0x12')]({'destination':function(_0x88c552,_0x2e9a2d,_0x52a78d){_0x52a78d(null,path[_0x5ee6('0x13')](config[_0x5ee6('0x14')],_0x5ee6('0x15')));},'filename':function(_0xb57105,_0x45bb73,_0x4c182e){_0x4c182e(null,util[_0x5ee6('0x16')](_0x5ee6('0x17'),Date[_0x5ee6('0x18')](),_0x45bb73[_0x5ee6('0x19')][_0x5ee6('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5ee6('0x1b')]('/',upload[_0x5ee6('0x1c')](_0x5ee6('0x1d')),controller[_0x5ee6('0x1e')]);router[_0x5ee6('0x1f')](_0x5ee6('0xc'),auth[_0x5ee6('0xa')](),controller['update']);router['delete'](_0x5ee6('0xc'),auth['isAuthenticated'](),controller[_0x5ee6('0x20')]);module[_0x5ee6('0x21')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 3fc89cb..4ff72da 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 _0x52ef=['User','find','map','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','getLicense','then','catch','lodash','Strategy','../../mysqldb','../../config/environment','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use','clientID','clientSecret','secret','callbackURL','allowedLoginAttempts','blockDuration'];(function(_0x33208a,_0x4d79e8){var _0x4f7da4=function(_0x201245){while(--_0x201245){_0x33208a['push'](_0x33208a['shift']());}};_0x4f7da4(++_0x4d79e8);}(_0x52ef,0x11e));var _0xf52e=function(_0x23c31d,_0x2e8382){_0x23c31d=_0x23c31d-0x0;var _0x4c8e11=_0x52ef[_0x23c31d];return _0x4c8e11;};'use strict';var _=require(_0xf52e('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0xf52e('0x1')];var moment=require('moment');var db=require(_0xf52e('0x2'))['db'];var config=require(_0xf52e('0x3'));var signToken=require('../../components/auth/service')[_0xf52e('0x4')];var utils=require(_0xf52e('0x5'));exports[_0xf52e('0x6')]=passport[_0xf52e('0x7')](_0xf52e('0x8'),{'failureRedirect':_0xf52e('0x9'),'scope':[_0xf52e('0xa'),_0xf52e('0xb')],'session':![]});exports[_0xf52e('0xc')]=passport[_0xf52e('0x7')](_0xf52e('0x8'),{'failureRedirect':_0xf52e('0x9'),'session':![]});passport[_0xf52e('0xd')](new GoogleStrategy({'clientID':config[_0xf52e('0x8')]?config[_0xf52e('0x8')][_0xf52e('0xe')]:'id','clientSecret':config[_0xf52e('0x8')]?config['google'][_0xf52e('0xf')]:_0xf52e('0x10'),'callbackURL':config[_0xf52e('0x8')]?config['google'][_0xf52e('0x11')]:''},function(_0x32b5aa,_0x1f8cc2,_0x5025c0,_0x1fe5b1){var _0x5153ce,_0x1e8953;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xf52e('0x12'),_0xf52e('0x13')],'raw':!![]})['then'](function(_0x1b1997){_0x5153ce=_0x1b1997;return db[_0xf52e('0x14')][_0xf52e('0x15')]({'where':{'email':_[_0xf52e('0x16')](_0x5025c0[_0xf52e('0x17')],'value'),'role':{'$or':[_0xf52e('0x18'),_0xf52e('0x19'),_0xf52e('0x1a')]}}});})['then'](function(_0x22821a){_0x1e8953=_0x22821a;if(_0x1e8953){if(_0x1e8953[_0xf52e('0x1b')]){return _0x1fe5b1(_0xf52e('0x1c'));}else if(_0x5153ce[_0xf52e('0x13')]>0x0){if(_0x1e8953['blocked']){if(moment(_0x1e8953['blockedAt'])['add'](_0x5153ce[_0xf52e('0x13')],_0xf52e('0x1d'))>moment()){return _0x1fe5b1('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xf52e('0x1e')](_0x1e8953,0x0,![],null)['then'](function(){return utils[_0xf52e('0x1f')](_0x1e8953);})[_0xf52e('0x20')](function(){return _0x1fe5b1(null,_0x1e8953);});}}else{return utils['getLicense'](_0x1e8953)['then'](function(){return _0x1fe5b1(null,_0x1e8953);});}}else{return utils[_0xf52e('0x1f')](_0x1e8953)[_0xf52e('0x20')](function(){return _0x1fe5b1(null,_0x1e8953);});}}return _0x1fe5b1(_0xf52e('0x1c'));})[_0xf52e('0x21')](function(_0x5ed12e){_0x1fe5b1(_0x5ed12e);});})); \ No newline at end of file +var _0x3eeb=['../../components/auth/service','signToken','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','emails','admin','user','agent','disabled','blocked','blockedAt','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment'];(function(_0x2e8794,_0x589fc9){var _0xc2a1c1=function(_0x2687b3){while(--_0x2687b3){_0x2e8794['push'](_0x2e8794['shift']());}};_0xc2a1c1(++_0x589fc9);}(_0x3eeb,0x1f2));var _0xb3ee=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x3eeb[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xb3ee('0x0'));var passport=require(_0xb3ee('0x1'));var GoogleStrategy=require(_0xb3ee('0x2'))[_0xb3ee('0x3')];var moment=require('moment');var db=require(_0xb3ee('0x4'))['db'];var config=require(_0xb3ee('0x5'));var signToken=require(_0xb3ee('0x6'))[_0xb3ee('0x7')];var utils=require(_0xb3ee('0x8'));exports[_0xb3ee('0x9')]=passport['authenticate'](_0xb3ee('0xa'),{'failureRedirect':_0xb3ee('0xb'),'scope':[_0xb3ee('0xc'),_0xb3ee('0xd')],'session':![]});exports[_0xb3ee('0xe')]=passport[_0xb3ee('0xf')](_0xb3ee('0xa'),{'failureRedirect':_0xb3ee('0xb'),'session':![]});passport[_0xb3ee('0x10')](new GoogleStrategy({'clientID':config[_0xb3ee('0xa')]?config[_0xb3ee('0xa')][_0xb3ee('0x11')]:'id','clientSecret':config[_0xb3ee('0xa')]?config[_0xb3ee('0xa')]['clientSecret']:'secret','callbackURL':config['google']?config['google'][_0xb3ee('0x12')]:''},function(_0x683d68,_0x3c849c,_0x2f7880,_0x542624){var _0x508d4d,_0x13744e;return db['Setting'][_0xb3ee('0x13')]({'where':{'id':0x1},'attributes':[_0xb3ee('0x14'),_0xb3ee('0x15')],'raw':!![]})[_0xb3ee('0x16')](function(_0x4deb4b){_0x508d4d=_0x4deb4b;return db[_0xb3ee('0x17')][_0xb3ee('0x18')]({'where':{'email':_['map'](_0x2f7880[_0xb3ee('0x19')],'value'),'role':{'$or':[_0xb3ee('0x1a'),_0xb3ee('0x1b'),_0xb3ee('0x1c')]}}});})['then'](function(_0x353d50){_0x13744e=_0x353d50;if(_0x13744e){if(_0x13744e[_0xb3ee('0x1d')]){return _0x542624('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x508d4d['blockDuration']>0x0){if(_0x13744e[_0xb3ee('0x1e')]){if(moment(_0x13744e[_0xb3ee('0x1f')])['add'](_0x508d4d['blockDuration'],'minutes')>moment()){return _0x542624(_0xb3ee('0x20'));}else{return utils[_0xb3ee('0x21')](_0x13744e,0x0,![],null)['then'](function(){return utils[_0xb3ee('0x22')](_0x13744e);})['then'](function(){return _0x542624(null,_0x13744e);});}}else{return utils[_0xb3ee('0x22')](_0x13744e)[_0xb3ee('0x16')](function(){return _0x542624(null,_0x13744e);});}}else{return utils['getLicense'](_0x13744e)[_0xb3ee('0x16')](function(){return _0x542624(null,_0x13744e);});}}return _0x542624('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xb3ee('0x23')](function(_0x2deb7d){_0x542624(_0x2deb7d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 667932a..1e3fb7a 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 _0x25a3=['isMiddleware','express','passport','Router','../user/user.controller.js','get','login','callback'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x25a3,0x121));var _0x325a=function(_0x1a9a72,_0x3724d3){_0x1a9a72=_0x1a9a72-0x0;var _0x384c5b=_0x25a3[_0x1a9a72];return _0x384c5b;};'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 +var _0xcfac=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x35245b,_0x23788a){var _0x287707=function(_0x34fd2b){while(--_0x34fd2b){_0x35245b['push'](_0x35245b['shift']());}};_0x287707(++_0x23788a);}(_0xcfac,0x105));var _0xccfa=function(_0x4e4379,_0x4ad8e4){_0x4e4379=_0x4e4379-0x0;var _0x5a0073=_0xcfac[_0x4e4379];return _0x5a0073;};'use strict';var express=require(_0xccfa('0x0'));var passport=require(_0xccfa('0x1'));var router=express[_0xccfa('0x2')]();var controller=require(_0xccfa('0x3'));var userController=require(_0xccfa('0x4'));var authService=require(_0xccfa('0x5'));router[_0xccfa('0x6')]('/',controller[_0xccfa('0x7')]);router[_0xccfa('0x6')]('/callback',controller[_0xccfa('0x8')],authService[_0xccfa('0x9')],userController[_0xccfa('0x7')],authService[_0xccfa('0xa')]);module[_0xccfa('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 89be102..5d5445a 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 _0xfeef=['login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','Email\x20parameter\x20is\x20missing','body','trim','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','resetPasswordExpires','save','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','Smtp','host','port','secure','authentication','auth','pass','merge','format','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x48607a,_0xdd5c99){var _0x116bf0=function(_0x569d45){while(--_0x569d45){_0x48607a['push'](_0x48607a['shift']());}};_0x116bf0(++_0xdd5c99);}(_0xfeef,0xc0));var _0xffee=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xfeef[_0x4b12ae];return _0x16957b;};'use strict';var util=require(_0xffee('0x0'));var passport=require('passport');var LocalStrategy=require(_0xffee('0x1'))[_0xffee('0x2')];var jayson=require(_0xffee('0x3'));var _=require(_0xffee('0x4'));var rs=require(_0xffee('0x5'));var moment=require(_0xffee('0x6'));var db=require(_0xffee('0x7'))['db'];var authService=require(_0xffee('0x8'));var utils=require(_0xffee('0x9'));var client=jayson[_0xffee('0xa')][_0xffee('0xb')]({'port':0x232b});function localAuthenticate(_0x4b04e2,_0x37d27a,_0x3a8ec4,_0x48cdc1){var _0x501997,_0x69c388;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xffee('0xc'),_0xffee('0xd')],'raw':!![]})[_0xffee('0xe')](function(_0x2ef2d3){_0x501997=_0x2ef2d3;return _0x4b04e2[_0xffee('0xf')]({'attributes':['id',_0xffee('0x10'),_0xffee('0x11'),_0xffee('0x12'),_0xffee('0x13'),_0xffee('0x14'),'blocked',_0xffee('0x15'),_0xffee('0x16')],'where':{'name':_0x37d27a,'role':{'$or':[_0xffee('0x17'),_0xffee('0x18'),_0xffee('0x19')]}}});})[_0xffee('0xe')](function(_0x2f20c7){if(!_0x2f20c7||_0x2f20c7&&_0x2f20c7[_0xffee('0x10')]!==_0x37d27a){throw new Error(_0xffee('0x1a'));}else{_0x69c388=_0x2f20c7;return _0x69c388;}})[_0xffee('0xe')](function(){_0x69c388[_0xffee('0x1b')](_0x3a8ec4,function(_0x163b3f,_0x40079d){var _0x421496=_0x69c388[_0xffee('0x16')]+0x1;if(_0x163b3f){return _0x48cdc1(_0x163b3f);}else if(!_0x40079d){if(_0x69c388[_0xffee('0x14')]){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}else if(_0x501997['allowedLoginAttempts']>0x0){if(_0x69c388[_0xffee('0x1c')]){if(_0x501997[_0xffee('0xd')]>0x0){if(moment(_0x69c388[_0xffee('0x15')])['add'](_0x501997[_0xffee('0xd')],_0xffee('0x1d'))>moment()){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}else{return utils[_0xffee('0x1e')](_0x69c388,_0x421496,![],null)[_0xffee('0xe')](function(){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});});}}else{return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}}else{if(_0x421496>=_0x501997[_0xffee('0xc')]){return utils['clearBlockUser'](_0x69c388,0x0,!![],moment())[_0xffee('0xe')](function(){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});});}else{return utils[_0xffee('0x1e')](_0x69c388,_0x421496,![],null)[_0xffee('0xe')](function(){return _0x48cdc1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}}else{if(_0x69c388[_0xffee('0x14')]){return _0x48cdc1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x501997[_0xffee('0xc')]>0x0){if(_0x69c388[_0xffee('0x1c')]){if(_0x501997[_0xffee('0xd')]>0x0){if(moment(_0x69c388['blockedAt'])[_0xffee('0x1f')](_0x501997['blockDuration'],_0xffee('0x1d'))>moment()){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}else{return utils['clearBlockUser'](_0x69c388,0x0,![],null)['then'](function(){return utils[_0xffee('0x20')](_0x69c388);})[_0xffee('0xe')](function(){return _0x48cdc1(null,_0x69c388);});}}else{return _0x48cdc1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xffee('0x1e')](_0x69c388,0x0,![],null)['then'](function(){return utils[_0xffee('0x20')](_0x69c388);})[_0xffee('0xe')](function(){return _0x48cdc1(null,_0x69c388);})['catch'](function(_0x1d8c71){return _0x48cdc1(null,![],_0x1d8c71);});}}else{if(_0x69c388[_0xffee('0x1c')]){return _0x48cdc1(null,![],{'message':_0xffee('0x1a')});}else{return utils[_0xffee('0x20')](_0x69c388)['then'](function(){return _0x48cdc1(null,_0x69c388);});}}}});})[_0xffee('0x21')](function(_0x403ef6){return _0x48cdc1(null,![],_0x403ef6);});}function sendServiceMail(_0xe78f08){return db[_0xffee('0x22')][_0xffee('0x23')]({'where':{'service':!![]},'attributes':['id',_0xffee('0x10'),_0xffee('0x24')],'include':[{'model':db[_0xffee('0x25')],'as':'Smtp'}]})[_0xffee('0xe')](function(_0x5838d3){if(!_0x5838d3){throw new Error(_0xffee('0x26'));}var _0x26f333={'tls':{'rejectUnauthorized':![]}};if(_0x5838d3['Smtp'][_0xffee('0x27')]){_0x26f333[_0xffee('0x27')]=_0x5838d3[_0xffee('0x28')][_0xffee('0x27')];}else{_0x26f333['host']=_0x5838d3[_0xffee('0x28')][_0xffee('0x29')];_0x26f333['port']=_0x5838d3[_0xffee('0x28')][_0xffee('0x2a')];_0x26f333[_0xffee('0x2b')]=_0x5838d3[_0xffee('0x28')][_0xffee('0x2b')];}if(_0x5838d3[_0xffee('0x28')][_0xffee('0x2c')]){_0x26f333[_0xffee('0x2d')]={'user':_0x5838d3[_0xffee('0x28')][_0xffee('0x18')],'pass':_0x5838d3['Smtp'][_0xffee('0x2e')]};}var _0x277b01={'account':_0x26f333,'message':_[_0xffee('0x2f')]({'from':util[_0xffee('0x30')]('\x22%s\x22\x20<%s>',_0x5838d3[_0xffee('0x10')],_0x5838d3['email']||_0x5838d3[_0xffee('0x28')][_0xffee('0x18')])},_0xe78f08)};return client['request'](_0xffee('0x31'),_0x277b01);})[_0xffee('0xe')](function(_0x68cb8c){if(_0x68cb8c[_0xffee('0x32')]){throw new Error(util[_0xffee('0x30')](_0xffee('0x33'),_0x68cb8c[_0xffee('0x32')][_0xffee('0x34')]||JSON[_0xffee('0x35')](_0x68cb8c['error'])));}return!![];});}function handleError(_0x1d7f9c,_0x518026,_0x36cd53){return _0x1d7f9c[_0xffee('0x36')](_0x518026||0x1f4)[_0xffee('0x37')]({'message':_0x36cd53?_0x36cd53[_0xffee('0x34')]||_0x36cd53:''});}function checkPasswordPattern(_0x497a47,_0x1cda6c,_0x40856a){if(_0x40856a){var _0x22dd68=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22dd68['test'](_0x1cda6c)){return _0x497a47;}else{throw new Error(_0xffee('0x38'));}}else{return _0x497a47;}}exports[_0xffee('0x39')]=function(_0x321aec,_0x57d012,_0x5ea44f){passport[_0xffee('0x1b')](_0xffee('0x3a'),function(_0x502378,_0x593bce,_0x29971c){var _0x597e75=_0x502378||_0x29971c;if(_0x597e75){return handleError(_0x57d012,0x191,_0x597e75);}if(!_0x593bce){return handleError(_0x57d012,0x194,{'message':_0xffee('0x3b')});}else{var _0x34132c={'payload':{'id':_0x593bce['id'],'role':_0x593bce[_0xffee('0x13')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x34132c)[_0xffee('0xe')](function(_0x9eae1c){_0x57d012[_0xffee('0x3c')]({'id':_0x593bce['id'],'token':_0x9eae1c,'statusCall':'','isAlreadyLogged':_0x593bce[_0xffee('0x3d')]});});}})(_0x321aec,_0x57d012,_0x5ea44f);};exports[_0xffee('0x3e')]=function(_0x86ee30,_0x3e01b2,_0x19fbd9){if(!_0x86ee30['body']['email']){return handleError(_0x3e01b2,0x1f4,{'message':_0xffee('0x3f')});}var _0x12ab5e=rs['generate']();_0x86ee30['body'][_0xffee('0x24')]=_0x86ee30[_0xffee('0x40')][_0xffee('0x24')][_0xffee('0x41')]()['toLowerCase']();var _0x201096;return db[_0xffee('0x42')]['findOne']({'where':{'id':0x1},'attributes':[_0xffee('0xc'),_0xffee('0xd')],'raw':!![]})[_0xffee('0xe')](function(_0x3181ea){_0x201096=_0x3181ea;return db[_0xffee('0x43')]['find']({'where':{'email':_0x86ee30[_0xffee('0x40')][_0xffee('0x24')]}});})[_0xffee('0xe')](function(_0x4471ea){if(!_0x4471ea){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4471ea[_0xffee('0x14')]){throw new Error(_0xffee('0x44'));}if(_0x4471ea['blocked']){if(moment(_0x4471ea[_0xffee('0x15')])[_0xffee('0x1f')](_0x201096[_0xffee('0xd')],_0xffee('0x1d'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x4471ea['blocked']=![];_0x4471ea[_0xffee('0x15')]=null;}}_0x4471ea[_0xffee('0x45')]=_0x12ab5e;_0x4471ea['resetPasswordExpires']=Date[_0xffee('0x46')]()+0x36ee80;return _0x4471ea['save']();})[_0xffee('0xe')](function(){return sendServiceMail({'to':_0x86ee30[_0xffee('0x40')][_0xffee('0x24')],'subject':_0xffee('0x47'),'text':_0xffee('0x48')+_0xffee('0x49')+_0xffee('0x4a')+_0x86ee30['headers'][_0xffee('0x29')]+'/reset/'+_0x12ab5e+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xffee('0xe')](function(){_0x3e01b2[_0xffee('0x36')](0xc8)[_0xffee('0x37')]({'message':_0xffee('0x4b')});})[_0xffee('0x21')](function(_0x301fdb){return handleError(_0x3e01b2,0x1f4,_0x301fdb);});};exports[_0xffee('0x4c')]=function(_0x54e33b,_0x59a529,_0x33b66d){var _0xbfc129;return db['User'][_0xffee('0x23')]({'where':{'resetPasswordToken':_0x54e33b['params'][_0xffee('0x4d')],'resetPasswordExpires':{'$gt':Date[_0xffee('0x46')]()}}})[_0xffee('0xe')](function(_0x3ad67f){_0xbfc129=_0x3ad67f;if(!_0xbfc129){throw new Error(_0xffee('0x4e'));}return db[_0xffee('0x42')][_0xffee('0xf')]({'attributes':['id',_0xffee('0x4f')]});})['then'](function(_0x1a2d15){return checkPasswordPattern(_0x1a2d15,_0x54e33b['body']['password'],_0x1a2d15[_0xffee('0x4f')]);})[_0xffee('0xe')](function(){_0xbfc129[_0xffee('0x11')]=_0x54e33b[_0xffee('0x40')][_0xffee('0x11')];_0xbfc129['resetPasswordToken']=null;_0xbfc129[_0xffee('0x50')]=null;return _0xbfc129[_0xffee('0x51')]();})[_0xffee('0xe')](function(){_0x59a529[_0xffee('0x36')](0xc8)[_0xffee('0x37')]({'message':'Password\x20reset!'});})[_0xffee('0x21')](function(_0x418e04){return handleError(_0x59a529,0x1f4,_0x418e04);});};passport[_0xffee('0x52')](new LocalStrategy({'usernameField':'name','passwordField':_0xffee('0x11')},function(_0x43f85f,_0x134ce9,_0x4a3fc4){return localAuthenticate(db['User'],_0x43f85f,_0x134ce9,_0x4a3fc4);})); \ No newline at end of file +var _0xd183=['Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','use','util','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','disabled','blocked','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','blockedAt','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'];(function(_0x18c67c,_0x5af63d){var _0x2a9bad=function(_0x4377d2){while(--_0x4377d2){_0x18c67c['push'](_0x18c67c['shift']());}};_0x2a9bad(++_0x5af63d);}(_0xd183,0xb7));var _0x3d18=function(_0x1aabc7,_0x3203eb){_0x1aabc7=_0x1aabc7-0x0;var _0x3e009c=_0xd183[_0x1aabc7];return _0x3e009c;};'use strict';var util=require(_0x3d18('0x0'));var passport=require(_0x3d18('0x1'));var LocalStrategy=require(_0x3d18('0x2'))[_0x3d18('0x3')];var jayson=require('jayson/promise');var _=require(_0x3d18('0x4'));var rs=require(_0x3d18('0x5'));var moment=require(_0x3d18('0x6'));var db=require(_0x3d18('0x7'))['db'];var authService=require(_0x3d18('0x8'));var utils=require(_0x3d18('0x9'));var client=jayson['client'][_0x3d18('0xa')]({'port':0x232b});function localAuthenticate(_0x42e6de,_0x52e8b7,_0x4c95a5,_0x156650){var _0x46a159,_0x2c0658;return db[_0x3d18('0xb')][_0x3d18('0xc')]({'where':{'id':0x1},'attributes':[_0x3d18('0xd'),_0x3d18('0xe')],'raw':!![]})[_0x3d18('0xf')](function(_0x3b181b){_0x46a159=_0x3b181b;return _0x42e6de['findOne']({'attributes':['id',_0x3d18('0x10'),_0x3d18('0x11'),_0x3d18('0x12'),'role',_0x3d18('0x13'),_0x3d18('0x14'),'blockedAt','loginAttempts'],'where':{'name':_0x52e8b7,'role':{'$or':['admin',_0x3d18('0x15'),_0x3d18('0x16')]}}});})[_0x3d18('0xf')](function(_0x35e573){if(!_0x35e573||_0x35e573&&_0x35e573[_0x3d18('0x10')]!==_0x52e8b7){throw new Error(_0x3d18('0x17'));}else{_0x2c0658=_0x35e573;return _0x2c0658;}})[_0x3d18('0xf')](function(){_0x2c0658['authenticate'](_0x4c95a5,function(_0x1a319e,_0x219def){var _0x2afabd=_0x2c0658[_0x3d18('0x18')]+0x1;if(_0x1a319e){return _0x156650(_0x1a319e);}else if(!_0x219def){if(_0x2c0658[_0x3d18('0x13')]){return _0x156650(null,![],{'message':_0x3d18('0x17')});}else if(_0x46a159[_0x3d18('0xd')]>0x0){if(_0x2c0658[_0x3d18('0x14')]){if(_0x46a159[_0x3d18('0xe')]>0x0){if(moment(_0x2c0658[_0x3d18('0x19')])[_0x3d18('0x1a')](_0x46a159[_0x3d18('0xe')],'minutes')>moment()){return _0x156650(null,![],{'message':_0x3d18('0x17')});}else{return utils[_0x3d18('0x1b')](_0x2c0658,_0x2afabd,![],null)[_0x3d18('0xf')](function(){return _0x156650(null,![],{'message':_0x3d18('0x17')});});}}else{return _0x156650(null,![],{'message':_0x3d18('0x17')});}}else{if(_0x2afabd>=_0x46a159[_0x3d18('0xd')]){return utils[_0x3d18('0x1b')](_0x2c0658,0x0,!![],moment())[_0x3d18('0xf')](function(){return _0x156650(null,![],{'message':_0x3d18('0x17')});});}else{return utils[_0x3d18('0x1b')](_0x2c0658,_0x2afabd,![],null)[_0x3d18('0xf')](function(){return _0x156650(null,![],{'message':_0x3d18('0x17')});});}}}else{return _0x156650(null,![],{'message':_0x3d18('0x17')});}}else{if(_0x2c0658[_0x3d18('0x13')]){return _0x156650(null,![],{'message':_0x3d18('0x17')});}else if(_0x46a159[_0x3d18('0xd')]>0x0){if(_0x2c0658[_0x3d18('0x14')]){if(_0x46a159['blockDuration']>0x0){if(moment(_0x2c0658[_0x3d18('0x19')])[_0x3d18('0x1a')](_0x46a159['blockDuration'],_0x3d18('0x1c'))>moment()){return _0x156650(null,![],{'message':_0x3d18('0x17')});}else{return utils[_0x3d18('0x1b')](_0x2c0658,0x0,![],null)[_0x3d18('0xf')](function(){return utils[_0x3d18('0x1d')](_0x2c0658);})[_0x3d18('0xf')](function(){return _0x156650(null,_0x2c0658);});}}else{return _0x156650(null,![],{'message':_0x3d18('0x17')});}}else{return utils[_0x3d18('0x1b')](_0x2c0658,0x0,![],null)['then'](function(){return utils[_0x3d18('0x1d')](_0x2c0658);})[_0x3d18('0xf')](function(){return _0x156650(null,_0x2c0658);})['catch'](function(_0x40666e){return _0x156650(null,![],_0x40666e);});}}else{if(_0x2c0658['blocked']){return _0x156650(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3d18('0x1d')](_0x2c0658)[_0x3d18('0xf')](function(){return _0x156650(null,_0x2c0658);});}}}});})[_0x3d18('0x1e')](function(_0x25a7ab){return _0x156650(null,![],_0x25a7ab);});}function sendServiceMail(_0x210802){return db[_0x3d18('0x1f')][_0x3d18('0x20')]({'where':{'service':!![]},'attributes':['id',_0x3d18('0x10'),_0x3d18('0x21')],'include':[{'model':db[_0x3d18('0x22')],'as':_0x3d18('0x23')}]})['then'](function(_0x492f01){if(!_0x492f01){throw new Error(_0x3d18('0x24'));}var _0x4a4044={'tls':{'rejectUnauthorized':![]}};if(_0x492f01[_0x3d18('0x23')][_0x3d18('0x25')]){_0x4a4044[_0x3d18('0x25')]=_0x492f01['Smtp'][_0x3d18('0x25')];}else{_0x4a4044[_0x3d18('0x26')]=_0x492f01[_0x3d18('0x23')][_0x3d18('0x26')];_0x4a4044[_0x3d18('0x27')]=_0x492f01[_0x3d18('0x23')]['port'];_0x4a4044[_0x3d18('0x28')]=_0x492f01[_0x3d18('0x23')][_0x3d18('0x28')];}if(_0x492f01[_0x3d18('0x23')]['authentication']){_0x4a4044[_0x3d18('0x29')]={'user':_0x492f01[_0x3d18('0x23')]['user'],'pass':_0x492f01[_0x3d18('0x23')][_0x3d18('0x2a')]};}var _0x302e9c={'account':_0x4a4044,'message':_[_0x3d18('0x2b')]({'from':util['format'](_0x3d18('0x2c'),_0x492f01[_0x3d18('0x10')],_0x492f01[_0x3d18('0x21')]||_0x492f01[_0x3d18('0x23')]['user'])},_0x210802)};return client[_0x3d18('0x2d')](_0x3d18('0x2e'),_0x302e9c);})[_0x3d18('0xf')](function(_0x3ebcf9){if(_0x3ebcf9[_0x3d18('0x2f')]){throw new Error(util['format'](_0x3d18('0x30'),_0x3ebcf9['error'][_0x3d18('0x31')]||JSON['stringify'](_0x3ebcf9[_0x3d18('0x2f')])));}return!![];});}function handleError(_0x173282,_0x4d2b72,_0x280854){return _0x173282[_0x3d18('0x32')](_0x4d2b72||0x1f4)['send']({'message':_0x280854?_0x280854[_0x3d18('0x31')]||_0x280854:''});}function checkPasswordPattern(_0x44ada0,_0x4336bb,_0x1c173f){if(_0x1c173f){var _0x4c439a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c439a['test'](_0x4336bb)){return _0x44ada0;}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 _0x44ada0;}}exports[_0x3d18('0x33')]=function(_0x21bcd7,_0x2e5473,_0x6f5dec){passport[_0x3d18('0x34')](_0x3d18('0x35'),function(_0x4dd182,_0x4353f9,_0x14f175){var _0x43aede=_0x4dd182||_0x14f175;if(_0x43aede){return handleError(_0x2e5473,0x191,_0x43aede);}if(!_0x4353f9){return handleError(_0x2e5473,0x194,{'message':_0x3d18('0x36')});}else{var _0x613c7f={'payload':{'id':_0x4353f9['id'],'role':_0x4353f9[_0x3d18('0x37')]},'options':{'expiresIn':0x15180}};return authService[_0x3d18('0x38')](_0x613c7f)[_0x3d18('0xf')](function(_0x3a29c9){_0x2e5473[_0x3d18('0x39')]({'id':_0x4353f9['id'],'token':_0x3a29c9,'statusCall':'','isAlreadyLogged':_0x4353f9[_0x3d18('0x3a')]});});}})(_0x21bcd7,_0x2e5473,_0x6f5dec);};exports[_0x3d18('0x3b')]=function(_0xcbab1b,_0x2a8b18,_0x21bf7a){if(!_0xcbab1b[_0x3d18('0x3c')][_0x3d18('0x21')]){return handleError(_0x2a8b18,0x1f4,{'message':_0x3d18('0x3d')});}var _0x3e9e21=rs[_0x3d18('0x3e')]();_0xcbab1b[_0x3d18('0x3c')][_0x3d18('0x21')]=_0xcbab1b['body'][_0x3d18('0x21')]['trim']()['toLowerCase']();var _0x203889;return db[_0x3d18('0xb')][_0x3d18('0xc')]({'where':{'id':0x1},'attributes':[_0x3d18('0xd'),_0x3d18('0xe')],'raw':!![]})['then'](function(_0x3b73cd){_0x203889=_0x3b73cd;return db[_0x3d18('0x3f')][_0x3d18('0x20')]({'where':{'email':_0xcbab1b[_0x3d18('0x3c')][_0x3d18('0x21')]}});})[_0x3d18('0xf')](function(_0x892a3a){if(!_0x892a3a){throw new Error(_0x3d18('0x40'));}if(_0x892a3a[_0x3d18('0x13')]){throw new Error(_0x3d18('0x41'));}if(_0x892a3a[_0x3d18('0x14')]){if(moment(_0x892a3a[_0x3d18('0x19')])[_0x3d18('0x1a')](_0x203889[_0x3d18('0xe')],_0x3d18('0x1c'))>moment()){throw new Error(_0x3d18('0x42'));}else{_0x892a3a[_0x3d18('0x14')]=![];_0x892a3a['blockedAt']=null;}}_0x892a3a[_0x3d18('0x43')]=_0x3e9e21;_0x892a3a[_0x3d18('0x44')]=Date[_0x3d18('0x45')]()+0x36ee80;return _0x892a3a[_0x3d18('0x46')]();})[_0x3d18('0xf')](function(){return sendServiceMail({'to':_0xcbab1b[_0x3d18('0x3c')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x3d18('0x47')+_0x3d18('0x48')+_0x3d18('0x49')+_0xcbab1b[_0x3d18('0x4a')][_0x3d18('0x26')]+_0x3d18('0x4b')+_0x3e9e21+'\x0a\x0a'+_0x3d18('0x4c')});})[_0x3d18('0xf')](function(){_0x2a8b18[_0x3d18('0x32')](0xc8)[_0x3d18('0x4d')]({'message':_0x3d18('0x4e')});})[_0x3d18('0x1e')](function(_0x18981f){return handleError(_0x2a8b18,0x1f4,_0x18981f);});};exports[_0x3d18('0x4f')]=function(_0x5ef570,_0x4f77be,_0x59bec0){var _0x725c30;return db[_0x3d18('0x3f')]['find']({'where':{'resetPasswordToken':_0x5ef570[_0x3d18('0x50')][_0x3d18('0x51')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x3d18('0xf')](function(_0x1d3441){_0x725c30=_0x1d3441;if(!_0x725c30){throw new Error(_0x3d18('0x52'));}return db[_0x3d18('0xb')][_0x3d18('0xc')]({'attributes':['id',_0x3d18('0x53')]});})[_0x3d18('0xf')](function(_0x2d2ee6){return checkPasswordPattern(_0x2d2ee6,_0x5ef570[_0x3d18('0x3c')][_0x3d18('0x11')],_0x2d2ee6[_0x3d18('0x53')]);})['then'](function(){_0x725c30['password']=_0x5ef570[_0x3d18('0x3c')][_0x3d18('0x11')];_0x725c30[_0x3d18('0x43')]=null;_0x725c30['resetPasswordExpires']=null;return _0x725c30[_0x3d18('0x46')]();})[_0x3d18('0xf')](function(){_0x4f77be[_0x3d18('0x32')](0xc8)[_0x3d18('0x4d')]({'message':'Password\x20reset!'});})['catch'](function(_0xba1484){return handleError(_0x4f77be,0x1f4,_0xba1484);});};passport[_0x3d18('0x54')](new LocalStrategy({'usernameField':_0x3d18('0x10'),'passwordField':'password'},function(_0x791b5f,_0x18fcb7,_0x43874f){return localAuthenticate(db[_0x3d18('0x3f')],_0x791b5f,_0x18fcb7,_0x43874f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 26e7ac1..00f7233 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 _0x1fab=['/reset/:token','reset','express','Router','./authLocal.controller','post','/forgot','forgot'];(function(_0x3dc597,_0x388c60){var _0x1d2b37=function(_0x504ea5){while(--_0x504ea5){_0x3dc597['push'](_0x3dc597['shift']());}};_0x1d2b37(++_0x388c60);}(_0x1fab,0x152));var _0xb1fa=function(_0x60703,_0xe41c27){_0x60703=_0x60703-0x0;var _0x53fbaa=_0x1fab[_0x60703];return _0x53fbaa;};'use strict';var express=require(_0xb1fa('0x0'));var router=express[_0xb1fa('0x1')]();var controller=require(_0xb1fa('0x2'));router['post']('/',controller['login']);router[_0xb1fa('0x3')](_0xb1fa('0x4'),controller[_0xb1fa('0x5')]);router[_0xb1fa('0x3')](_0xb1fa('0x6'),controller[_0xb1fa('0x7')]);module['exports']=router; \ No newline at end of file +var _0xceb0=['forgot','/reset/:token','./authLocal.controller','post','login','/forgot'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xceb0,0x1b2));var _0x0ceb=function(_0x32fafd,_0x5a2a85){_0x32fafd=_0x32fafd-0x0;var _0x54e32e=_0xceb0[_0x32fafd];return _0x54e32e;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x0ceb('0x0'));router[_0x0ceb('0x1')]('/',controller[_0x0ceb('0x2')]);router[_0x0ceb('0x1')](_0x0ceb('0x3'),controller[_0x0ceb('0x4')]);router[_0x0ceb('0x1')](_0x0ceb('0x5'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4ab6cb7..8832732 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 _0xd7a0=['STRING','INTEGER','sequelize'];(function(_0x1bd0ea,_0x25beef){var _0x80b55c=function(_0x52b652){while(--_0x52b652){_0x1bd0ea['push'](_0x1bd0ea['shift']());}};_0x80b55c(++_0x25beef);}(_0xd7a0,0xf8));var _0x0d7a=function(_0x2d944e,_0x39d216){_0x2d944e=_0x2d944e-0x0;var _0x449783=_0xd7a0[_0x2d944e];return _0x449783;};'use strict';var Sequelize=require(_0x0d7a('0x0'));module['exports']={'name':{'type':Sequelize[_0x0d7a('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0d7a('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x5b9d=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x5b9d,0x1ba));var _0xd5b9=function(_0x5af565,_0xe531a7){_0x5af565=_0x5af565-0x0;var _0x2a311f=_0x5b9d[_0x5af565];return _0x2a311f;};'use strict';var Sequelize=require(_0xd5b9('0x0'));module[_0xd5b9('0x1')]={'name':{'type':Sequelize[_0xd5b9('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xd5b9('0x2')]},'description':{'type':Sequelize[_0xd5b9('0x2')]},'status':{'type':Sequelize[_0xd5b9('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd5b9('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 3969daa..b54bd9f 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 _0x26ec=['Condition','ids','omit','getConditions','findOne','Action','addActions','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Automation','includeAll','findAll','rows','catch','params','include','find','create','body','addConditions'];(function(_0x1ccad3,_0x5bae85){var _0x3d1654=function(_0x460d7d){while(--_0x460d7d){_0x1ccad3['push'](_0x1ccad3['shift']());}};_0x3d1654(++_0x5bae85);}(_0x26ec,0x1c0));var _0xc26e=function(_0x28564b,_0x53b2b2){_0x28564b=_0x28564b-0x0;var _0x3e302f=_0x26ec[_0x28564b];return _0x3e302f;};'use strict';var pdf=require(_0xc26e('0x0'));var emlformat=require(_0xc26e('0x1'));var rimraf=require(_0xc26e('0x2'));var zipdir=require(_0xc26e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc26e('0x4'));var moment=require(_0xc26e('0x5'));var BPromise=require(_0xc26e('0x6'));var Mustache=require(_0xc26e('0x7'));var util=require(_0xc26e('0x8'));var path=require(_0xc26e('0x9'));var sox=require(_0xc26e('0xa'));var csv=require(_0xc26e('0xb'));var ejs=require(_0xc26e('0xc'));var fs=require('fs');var _=require(_0xc26e('0xd'));var squel=require(_0xc26e('0xe'));var crypto=require(_0xc26e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc26e('0x10'));var toCsv=require(_0xc26e('0xb'));var querystring=require(_0xc26e('0x11'));var Papa=require(_0xc26e('0x12'));var Redis=require(_0xc26e('0x13'));var authService=require(_0xc26e('0x14'));var qs=require(_0xc26e('0x15'));var as=require(_0xc26e('0x16'));var hardwareService=require(_0xc26e('0x17'));var logger=require('../../config/logger')(_0xc26e('0x18'));var utils=require(_0xc26e('0x19'));var config=require(_0xc26e('0x1a'));var db=require(_0xc26e('0x1b'))['db'];function respondWithStatusCode(_0xb06d13,_0x36b162){_0x36b162=_0x36b162||0xcc;return function(_0x4a516c){if(_0x4a516c){return _0xb06d13[_0xc26e('0x1c')](_0x36b162);}return _0xb06d13[_0xc26e('0x1d')](_0x36b162)[_0xc26e('0x1e')]();};}function respondWithResult(_0x14999e,_0x472926){_0x472926=_0x472926||0xc8;return function(_0x1a32cc){if(_0x1a32cc){return _0x14999e[_0xc26e('0x1d')](_0x472926)[_0xc26e('0x1f')](_0x1a32cc);}};}function respondWithFilteredResult(_0x277585,_0x244d7b){return function(_0x23b327){if(_0x23b327){var _0x43f245=_0x23b327[_0xc26e('0x20')],_0x444bd9=_0x244d7b[_0xc26e('0x21')],_0xb81fba=_0x244d7b[_0xc26e('0x21')]+_0x244d7b[_0xc26e('0x22')],_0x3aa373;if(_0xb81fba>=_0x43f245){_0xb81fba=_0x43f245;_0x3aa373=0xc8;}else{_0x3aa373=0xce;}_0x277585['status'](_0x3aa373);return _0x277585[_0xc26e('0x23')]('Content-Range',_0x444bd9+'-'+_0xb81fba+'/'+_0x43f245)[_0xc26e('0x1f')](_0x23b327);}return null;};}function patchUpdates(_0x6f727f){return function(_0x17fc1e){try{jsonpatch[_0xc26e('0x24')](_0x17fc1e,_0x6f727f,!![]);}catch(_0x4ef50a){return BPromise[_0xc26e('0x25')](_0x4ef50a);}return _0x17fc1e[_0xc26e('0x26')]();};}function saveUpdates(_0x44923f,_0x3ce12e){return function(_0x5b1087){if(_0x5b1087){return _0x5b1087[_0xc26e('0x27')](_0x44923f)[_0xc26e('0x28')](function(_0x2e0bd0){return _0x2e0bd0;});}return null;};}function removeEntity(_0x15e9b6,_0x49d542){return function(_0x4f133a){if(_0x4f133a){return _0x4f133a[_0xc26e('0x29')]()['then'](function(){_0x15e9b6[_0xc26e('0x1d')](0xcc)[_0xc26e('0x1e')]();});}};}function handleEntityNotFound(_0x57a115,_0x12067d){return function(_0x4b252){if(!_0x4b252){_0x57a115[_0xc26e('0x1c')](0x194);}return _0x4b252;};}function handleError(_0x34d460,_0x4b8f8f){_0x4b8f8f=_0x4b8f8f||0x1f4;return function(_0x6f9cd4){logger[_0xc26e('0x2a')](_0x6f9cd4['stack']);if(_0x6f9cd4[_0xc26e('0x2b')]){delete _0x6f9cd4[_0xc26e('0x2b')];}_0x34d460[_0xc26e('0x1d')](_0x4b8f8f)[_0xc26e('0x2c')](_0x6f9cd4);};}exports[_0xc26e('0x2d')]=function(_0x173cc3,_0x2a86d5){var _0x28f094={},_0x91ca4b={},_0x261356={'count':0x0,'rows':[]};var _0x11472c=_['map'](db['Automation'][_0xc26e('0x2e')],function(_0x28163c){return{'name':_0x28163c[_0xc26e('0x2f')],'type':_0x28163c[_0xc26e('0x30')][_0xc26e('0x31')]};});_0x91ca4b[_0xc26e('0x32')]=_[_0xc26e('0x33')](_0x11472c,_0xc26e('0x2b'));_0x91ca4b['query']=_[_0xc26e('0x34')](_0x173cc3[_0xc26e('0x35')]);_0x91ca4b['filters']=_[_0xc26e('0x36')](_0x91ca4b[_0xc26e('0x32')],_0x91ca4b[_0xc26e('0x35')]);_0x28f094['attributes']=_[_0xc26e('0x36')](_0x91ca4b[_0xc26e('0x32')],qs['fields'](_0x173cc3[_0xc26e('0x35')][_0xc26e('0x37')]));_0x28f094[_0xc26e('0x38')]=_0x28f094[_0xc26e('0x38')][_0xc26e('0x39')]?_0x28f094['attributes']:_0x91ca4b[_0xc26e('0x32')];if(!_0x173cc3['query'][_0xc26e('0x3a')](_0xc26e('0x3b'))){_0x28f094['limit']=qs[_0xc26e('0x22')](_0x173cc3[_0xc26e('0x35')]['limit']);_0x28f094[_0xc26e('0x21')]=qs[_0xc26e('0x21')](_0x173cc3['query'][_0xc26e('0x21')]);}_0x28f094[_0xc26e('0x3c')]=qs[_0xc26e('0x3d')](_0x173cc3[_0xc26e('0x35')][_0xc26e('0x3d')]);_0x28f094[_0xc26e('0x3e')]=qs[_0xc26e('0x3f')](_[_0xc26e('0x40')](_0x173cc3['query'],_0x91ca4b['filters']),_0x11472c);if(_0x173cc3['query'][_0xc26e('0x41')]){_0x28f094[_0xc26e('0x3e')]=_[_0xc26e('0x42')](_0x28f094[_0xc26e('0x3e')],{'$or':_[_0xc26e('0x33')](_0x11472c,function(_0x468a44){if(_0x468a44['type']!==_0xc26e('0x43')){var _0x250b70={};_0x250b70[_0x468a44[_0xc26e('0x2b')]]={'$like':'%'+_0x173cc3[_0xc26e('0x35')][_0xc26e('0x41')]+'%'};return _0x250b70;}})});}_0x28f094=_['merge']({},_0x28f094,_0x173cc3[_0xc26e('0x44')]);var _0x2366d4={'where':_0x28f094[_0xc26e('0x3e')]};return db[_0xc26e('0x45')][_0xc26e('0x20')](_0x2366d4)[_0xc26e('0x28')](function(_0x2a03a5){_0x261356[_0xc26e('0x20')]=_0x2a03a5;if(_0x173cc3[_0xc26e('0x35')][_0xc26e('0x46')]){_0x28f094['include']=[{'all':!![]}];}return db['Automation'][_0xc26e('0x47')](_0x28f094);})[_0xc26e('0x28')](function(_0x17647f){_0x261356[_0xc26e('0x48')]=_0x17647f;return _0x261356;})['then'](respondWithFilteredResult(_0x2a86d5,_0x28f094))[_0xc26e('0x49')](handleError(_0x2a86d5,null));};exports['show']=function(_0x2eb3f0,_0x19a458){var _0x59e48c={'raw':![],'where':{'id':_0x2eb3f0[_0xc26e('0x4a')]['id']}},_0x2416dc={};_0x2416dc[_0xc26e('0x32')]=_[_0xc26e('0x34')](db[_0xc26e('0x45')]['rawAttributes']);_0x2416dc[_0xc26e('0x35')]=_[_0xc26e('0x34')](_0x2eb3f0[_0xc26e('0x35')]);_0x2416dc[_0xc26e('0x3f')]=_[_0xc26e('0x36')](_0x2416dc[_0xc26e('0x32')],_0x2416dc['query']);_0x59e48c[_0xc26e('0x38')]=_['intersection'](_0x2416dc[_0xc26e('0x32')],qs[_0xc26e('0x37')](_0x2eb3f0[_0xc26e('0x35')][_0xc26e('0x37')]));_0x59e48c[_0xc26e('0x38')]=_0x59e48c['attributes'][_0xc26e('0x39')]?_0x59e48c[_0xc26e('0x38')]:_0x2416dc[_0xc26e('0x32')];if(_0x2eb3f0[_0xc26e('0x35')][_0xc26e('0x46')]){_0x59e48c[_0xc26e('0x4b')]=[{'all':!![]}];}_0x59e48c=_[_0xc26e('0x42')]({},_0x59e48c,_0x2eb3f0[_0xc26e('0x44')]);return db[_0xc26e('0x45')][_0xc26e('0x4c')](_0x59e48c)[_0xc26e('0x28')](handleEntityNotFound(_0x19a458,null))[_0xc26e('0x28')](respondWithResult(_0x19a458,null))[_0xc26e('0x49')](handleError(_0x19a458,null));};exports[_0xc26e('0x4d')]=function(_0x32ba32,_0x5f28ba){return db[_0xc26e('0x45')][_0xc26e('0x4d')](_0x32ba32[_0xc26e('0x4e')],{})[_0xc26e('0x28')](respondWithResult(_0x5f28ba,0xc9))[_0xc26e('0x49')](handleError(_0x5f28ba,null));};exports[_0xc26e('0x27')]=function(_0x153e7e,_0x320696){if(_0x153e7e[_0xc26e('0x4e')]['id']){delete _0x153e7e[_0xc26e('0x4e')]['id'];}return db[_0xc26e('0x45')][_0xc26e('0x4c')]({'where':{'id':_0x153e7e['params']['id']}})['then'](handleEntityNotFound(_0x320696,null))[_0xc26e('0x28')](saveUpdates(_0x153e7e['body'],null))[_0xc26e('0x28')](respondWithResult(_0x320696,null))[_0xc26e('0x49')](handleError(_0x320696,null));};exports[_0xc26e('0x29')]=function(_0x4ae355,_0x2065a1){return db['Automation']['find']({'where':{'id':_0x4ae355[_0xc26e('0x4a')]['id']}})[_0xc26e('0x28')](handleEntityNotFound(_0x2065a1,null))[_0xc26e('0x28')](removeEntity(_0x2065a1,null))['catch'](handleError(_0x2065a1,null));};exports[_0xc26e('0x4f')]=function(_0x21dd70,_0x22f833,_0x256622){return db[_0xc26e('0x50')][_0xc26e('0x4c')]({'where':{'id':_0x21dd70[_0xc26e('0x4a')]['id']}})[_0xc26e('0x28')](handleEntityNotFound(_0x22f833,null))[_0xc26e('0x28')](function(_0x3474f8){if(_0x3474f8){return _0x3474f8[_0xc26e('0x4f')](_0x21dd70[_0xc26e('0x4e')][_0xc26e('0x51')],_[_0xc26e('0x52')](_0x21dd70[_0xc26e('0x4e')],[_0xc26e('0x51'),'id'])||{});}})[_0xc26e('0x28')](respondWithResult(_0x22f833,null))[_0xc26e('0x49')](handleError(_0x22f833,null));};exports[_0xc26e('0x53')]=function(_0x4e5fa3,_0x3c4290,_0x24e58b){var _0x4ab14e={};var _0x2bbea6={};var _0x5f555e;var _0x23369a;return db[_0xc26e('0x45')][_0xc26e('0x54')]({'where':{'id':_0x4e5fa3['params']['id']}})[_0xc26e('0x28')](handleEntityNotFound(_0x3c4290,null))['then'](function(_0x17cb11){if(_0x17cb11){_0x5f555e=_0x17cb11;_0x2bbea6[_0xc26e('0x32')]=_[_0xc26e('0x34')](db[_0xc26e('0x50')][_0xc26e('0x2e')]);_0x2bbea6[_0xc26e('0x35')]=_[_0xc26e('0x34')](_0x4e5fa3[_0xc26e('0x35')]);_0x2bbea6['filters']=_['intersection'](_0x2bbea6[_0xc26e('0x32')],_0x2bbea6[_0xc26e('0x35')]);_0x4ab14e['attributes']=_[_0xc26e('0x36')](_0x2bbea6[_0xc26e('0x32')],qs['fields'](_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x37')]));_0x4ab14e[_0xc26e('0x38')]=_0x4ab14e[_0xc26e('0x38')]['length']?_0x4ab14e[_0xc26e('0x38')]:_0x2bbea6[_0xc26e('0x32')];_0x4ab14e['order']=qs[_0xc26e('0x3d')](_0x4e5fa3[_0xc26e('0x35')]['sort']);_0x4ab14e[_0xc26e('0x3e')]=qs[_0xc26e('0x3f')](_['pick'](_0x4e5fa3[_0xc26e('0x35')],_0x2bbea6[_0xc26e('0x3f')]));if(_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x41')]){_0x4ab14e[_0xc26e('0x3e')]=_[_0xc26e('0x42')](_0x4ab14e['where'],{'$or':_[_0xc26e('0x33')](_0x4ab14e[_0xc26e('0x38')],function(_0x37be56){var _0x3a3425={};_0x3a3425[_0x37be56]={'$like':'%'+_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x41')]+'%'};return _0x3a3425;})});}_0x4ab14e=_[_0xc26e('0x42')]({},_0x4ab14e,_0x4e5fa3[_0xc26e('0x44')]);return _0x5f555e['getConditions'](_0x4ab14e);}})[_0xc26e('0x28')](function(_0x2dbb69){if(_0x2dbb69){_0x23369a=_0x2dbb69['length'];if(!_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x3a')](_0xc26e('0x3b'))){_0x4ab14e[_0xc26e('0x22')]=qs[_0xc26e('0x22')](_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x22')]);_0x4ab14e[_0xc26e('0x21')]=qs[_0xc26e('0x21')](_0x4e5fa3[_0xc26e('0x35')][_0xc26e('0x21')]);}return _0x5f555e[_0xc26e('0x53')](_0x4ab14e);}})['then'](function(_0x40fc89){if(_0x40fc89){return _0x40fc89?{'count':_0x23369a,'rows':_0x40fc89}:null;}})[_0xc26e('0x28')](respondWithResult(_0x3c4290,null))[_0xc26e('0x49')](handleError(_0x3c4290,null));};exports['addActions']=function(_0x4e1101,_0x24a3d1,_0x34f2f0){return db[_0xc26e('0x55')][_0xc26e('0x4c')]({'where':{'id':_0x4e1101[_0xc26e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24a3d1,null))[_0xc26e('0x28')](function(_0x460a0c){if(_0x460a0c){return _0x460a0c[_0xc26e('0x56')](_0x4e1101[_0xc26e('0x4e')]['ids'],_[_0xc26e('0x52')](_0x4e1101['body'],[_0xc26e('0x51'),'id'])||{});}})[_0xc26e('0x28')](respondWithResult(_0x24a3d1,null))[_0xc26e('0x49')](handleError(_0x24a3d1,null));};exports[_0xc26e('0x57')]=function(_0x493f40,_0x69531c,_0x12419d){var _0x5ee7ac={};var _0x2a4a79={};var _0x19c446;var _0x39e9ef;return db['Automation'][_0xc26e('0x54')]({'where':{'id':_0x493f40[_0xc26e('0x4a')]['id']}})[_0xc26e('0x28')](handleEntityNotFound(_0x69531c,null))[_0xc26e('0x28')](function(_0x572d93){if(_0x572d93){_0x19c446=_0x572d93;_0x2a4a79[_0xc26e('0x32')]=_[_0xc26e('0x34')](db[_0xc26e('0x55')][_0xc26e('0x2e')]);_0x2a4a79[_0xc26e('0x35')]=_[_0xc26e('0x34')](_0x493f40[_0xc26e('0x35')]);_0x2a4a79[_0xc26e('0x3f')]=_['intersection'](_0x2a4a79['model'],_0x2a4a79[_0xc26e('0x35')]);_0x5ee7ac[_0xc26e('0x38')]=_[_0xc26e('0x36')](_0x2a4a79['model'],qs['fields'](_0x493f40['query']['fields']));_0x5ee7ac[_0xc26e('0x38')]=_0x5ee7ac['attributes'][_0xc26e('0x39')]?_0x5ee7ac[_0xc26e('0x38')]:_0x2a4a79['model'];_0x5ee7ac[_0xc26e('0x3c')]=qs[_0xc26e('0x3d')](_0x493f40[_0xc26e('0x35')]['sort']);_0x5ee7ac[_0xc26e('0x3e')]=qs[_0xc26e('0x3f')](_['pick'](_0x493f40[_0xc26e('0x35')],_0x2a4a79[_0xc26e('0x3f')]));if(_0x493f40['query']['filter']){_0x5ee7ac[_0xc26e('0x3e')]=_['merge'](_0x5ee7ac['where'],{'$or':_[_0xc26e('0x33')](_0x5ee7ac[_0xc26e('0x38')],function(_0x4a40b9){var _0x18d8ba={};_0x18d8ba[_0x4a40b9]={'$like':'%'+_0x493f40[_0xc26e('0x35')][_0xc26e('0x41')]+'%'};return _0x18d8ba;})});}_0x5ee7ac=_[_0xc26e('0x42')]({},_0x5ee7ac,_0x493f40[_0xc26e('0x44')]);return _0x19c446[_0xc26e('0x57')](_0x5ee7ac);}})[_0xc26e('0x28')](function(_0x305cf2){if(_0x305cf2){_0x39e9ef=_0x305cf2[_0xc26e('0x39')];if(!_0x493f40[_0xc26e('0x35')][_0xc26e('0x3a')](_0xc26e('0x3b'))){_0x5ee7ac['limit']=qs[_0xc26e('0x22')](_0x493f40['query']['limit']);_0x5ee7ac['offset']=qs[_0xc26e('0x21')](_0x493f40[_0xc26e('0x35')][_0xc26e('0x21')]);}return _0x19c446['getActions'](_0x5ee7ac);}})[_0xc26e('0x28')](function(_0x353eac){if(_0x353eac){return _0x353eac?{'count':_0x39e9ef,'rows':_0x353eac}:null;}})[_0xc26e('0x28')](respondWithResult(_0x69531c,null))[_0xc26e('0x49')](handleError(_0x69531c,null));}; \ No newline at end of file +var _0xa918=['where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','keys','find','create','body','Condition','addConditions','ids','getConditions','findOne','hasOwnProperty','addActions','Action','omit','getActions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','name','send','index','map','Automation','rawAttributes','type','key','model','intersection','query','attributes','fields','length','nolimit','order','sort'];(function(_0x3928d3,_0x3c16a5){var _0x49d6c6=function(_0x51ea4f){while(--_0x51ea4f){_0x3928d3['push'](_0x3928d3['shift']());}};_0x49d6c6(++_0x3c16a5);}(_0xa918,0xbd));var _0x8a91=function(_0x3c781f,_0x30c9ac){_0x3c781f=_0x3c781f-0x0;var _0x12ada8=_0xa918[_0x3c781f];return _0x12ada8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8a91('0x0'));var rimraf=require(_0x8a91('0x1'));var zipdir=require(_0x8a91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a91('0x3'));var moment=require('moment');var BPromise=require(_0x8a91('0x4'));var Mustache=require(_0x8a91('0x5'));var util=require(_0x8a91('0x6'));var path=require(_0x8a91('0x7'));var sox=require(_0x8a91('0x8'));var csv=require(_0x8a91('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8a91('0xa'));var squel=require(_0x8a91('0xb'));var crypto=require(_0x8a91('0xc'));var jsforce=require(_0x8a91('0xd'));var deskjs=require(_0x8a91('0xe'));var toCsv=require(_0x8a91('0x9'));var querystring=require(_0x8a91('0xf'));var Papa=require(_0x8a91('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8a91('0x11'));var as=require(_0x8a91('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a91('0x13'))(_0x8a91('0x14'));var utils=require(_0x8a91('0x15'));var config=require(_0x8a91('0x16'));var db=require(_0x8a91('0x17'))['db'];function respondWithStatusCode(_0x40ac5b,_0x467d8c){_0x467d8c=_0x467d8c||0xcc;return function(_0x1fa8f8){if(_0x1fa8f8){return _0x40ac5b['sendStatus'](_0x467d8c);}return _0x40ac5b['status'](_0x467d8c)[_0x8a91('0x18')]();};}function respondWithResult(_0x41c006,_0x1e1dd2){_0x1e1dd2=_0x1e1dd2||0xc8;return function(_0x5a8f6c){if(_0x5a8f6c){return _0x41c006[_0x8a91('0x19')](_0x1e1dd2)[_0x8a91('0x1a')](_0x5a8f6c);}};}function respondWithFilteredResult(_0x176dc7,_0xd04cee){return function(_0x533661){if(_0x533661){var _0x3a2c99=_0x533661['count'],_0x37b464=_0xd04cee[_0x8a91('0x1b')],_0x5ae9b9=_0xd04cee[_0x8a91('0x1b')]+_0xd04cee[_0x8a91('0x1c')],_0x1ff304;if(_0x5ae9b9>=_0x3a2c99){_0x5ae9b9=_0x3a2c99;_0x1ff304=0xc8;}else{_0x1ff304=0xce;}_0x176dc7[_0x8a91('0x19')](_0x1ff304);return _0x176dc7[_0x8a91('0x1d')](_0x8a91('0x1e'),_0x37b464+'-'+_0x5ae9b9+'/'+_0x3a2c99)[_0x8a91('0x1a')](_0x533661);}return null;};}function patchUpdates(_0x22e024){return function(_0x51d144){try{jsonpatch[_0x8a91('0x1f')](_0x51d144,_0x22e024,!![]);}catch(_0x51ef3b){return BPromise[_0x8a91('0x20')](_0x51ef3b);}return _0x51d144['save']();};}function saveUpdates(_0x2bf079,_0xc34fbd){return function(_0x27db35){if(_0x27db35){return _0x27db35[_0x8a91('0x21')](_0x2bf079)['then'](function(_0x125d01){return _0x125d01;});}return null;};}function removeEntity(_0xbb592b,_0x138f80){return function(_0x1b2961){if(_0x1b2961){return _0x1b2961[_0x8a91('0x22')]()[_0x8a91('0x23')](function(){_0xbb592b[_0x8a91('0x19')](0xcc)[_0x8a91('0x18')]();});}};}function handleEntityNotFound(_0x4c35e1,_0x605c86){return function(_0x2a025c){if(!_0x2a025c){_0x4c35e1[_0x8a91('0x24')](0x194);}return _0x2a025c;};}function handleError(_0x462840,_0xdf19a9){_0xdf19a9=_0xdf19a9||0x1f4;return function(_0x55ce6c){logger['error'](_0x55ce6c['stack']);if(_0x55ce6c[_0x8a91('0x25')]){delete _0x55ce6c[_0x8a91('0x25')];}_0x462840[_0x8a91('0x19')](_0xdf19a9)[_0x8a91('0x26')](_0x55ce6c);};}exports[_0x8a91('0x27')]=function(_0x4bf6c0,_0x54639){var _0x3afa0b={},_0x594f81={},_0xdfac48={'count':0x0,'rows':[]};var _0x16b98b=_[_0x8a91('0x28')](db[_0x8a91('0x29')][_0x8a91('0x2a')],function(_0x404846){return{'name':_0x404846['fieldName'],'type':_0x404846[_0x8a91('0x2b')][_0x8a91('0x2c')]};});_0x594f81[_0x8a91('0x2d')]=_['map'](_0x16b98b,_0x8a91('0x25'));_0x594f81['query']=_['keys'](_0x4bf6c0['query']);_0x594f81['filters']=_[_0x8a91('0x2e')](_0x594f81[_0x8a91('0x2d')],_0x594f81[_0x8a91('0x2f')]);_0x3afa0b[_0x8a91('0x30')]=_[_0x8a91('0x2e')](_0x594f81[_0x8a91('0x2d')],qs[_0x8a91('0x31')](_0x4bf6c0['query'][_0x8a91('0x31')]));_0x3afa0b['attributes']=_0x3afa0b[_0x8a91('0x30')][_0x8a91('0x32')]?_0x3afa0b[_0x8a91('0x30')]:_0x594f81[_0x8a91('0x2d')];if(!_0x4bf6c0[_0x8a91('0x2f')]['hasOwnProperty'](_0x8a91('0x33'))){_0x3afa0b[_0x8a91('0x1c')]=qs['limit'](_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x1c')]);_0x3afa0b[_0x8a91('0x1b')]=qs[_0x8a91('0x1b')](_0x4bf6c0['query'][_0x8a91('0x1b')]);}_0x3afa0b[_0x8a91('0x34')]=qs[_0x8a91('0x35')](_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x35')]);_0x3afa0b[_0x8a91('0x36')]=qs[_0x8a91('0x37')](_[_0x8a91('0x38')](_0x4bf6c0[_0x8a91('0x2f')],_0x594f81[_0x8a91('0x37')]),_0x16b98b);if(_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x39')]){_0x3afa0b[_0x8a91('0x36')]=_[_0x8a91('0x3a')](_0x3afa0b['where'],{'$or':_[_0x8a91('0x28')](_0x16b98b,function(_0x12a5b0){if(_0x12a5b0[_0x8a91('0x2b')]!==_0x8a91('0x3b')){var _0x2f656d={};_0x2f656d[_0x12a5b0[_0x8a91('0x25')]]={'$like':'%'+_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x39')]+'%'};return _0x2f656d;}})});}_0x3afa0b=_[_0x8a91('0x3a')]({},_0x3afa0b,_0x4bf6c0[_0x8a91('0x3c')]);var _0x20b6cf={'where':_0x3afa0b[_0x8a91('0x36')]};return db[_0x8a91('0x29')][_0x8a91('0x3d')](_0x20b6cf)[_0x8a91('0x23')](function(_0x119ef7){_0xdfac48['count']=_0x119ef7;if(_0x4bf6c0[_0x8a91('0x2f')][_0x8a91('0x3e')]){_0x3afa0b['include']=[{'all':!![]}];}return db[_0x8a91('0x29')][_0x8a91('0x3f')](_0x3afa0b);})[_0x8a91('0x23')](function(_0x5c7577){_0xdfac48[_0x8a91('0x40')]=_0x5c7577;return _0xdfac48;})[_0x8a91('0x23')](respondWithFilteredResult(_0x54639,_0x3afa0b))[_0x8a91('0x41')](handleError(_0x54639,null));};exports['show']=function(_0x51dde3,_0x33fce9){var _0x22437f={'raw':![],'where':{'id':_0x51dde3[_0x8a91('0x42')]['id']}},_0x25881f={};_0x25881f['model']=_[_0x8a91('0x43')](db[_0x8a91('0x29')]['rawAttributes']);_0x25881f[_0x8a91('0x2f')]=_['keys'](_0x51dde3[_0x8a91('0x2f')]);_0x25881f[_0x8a91('0x37')]=_[_0x8a91('0x2e')](_0x25881f[_0x8a91('0x2d')],_0x25881f[_0x8a91('0x2f')]);_0x22437f['attributes']=_[_0x8a91('0x2e')](_0x25881f['model'],qs[_0x8a91('0x31')](_0x51dde3[_0x8a91('0x2f')][_0x8a91('0x31')]));_0x22437f[_0x8a91('0x30')]=_0x22437f[_0x8a91('0x30')][_0x8a91('0x32')]?_0x22437f['attributes']:_0x25881f[_0x8a91('0x2d')];if(_0x51dde3[_0x8a91('0x2f')][_0x8a91('0x3e')]){_0x22437f['include']=[{'all':!![]}];}_0x22437f=_[_0x8a91('0x3a')]({},_0x22437f,_0x51dde3[_0x8a91('0x3c')]);return db[_0x8a91('0x29')][_0x8a91('0x44')](_0x22437f)[_0x8a91('0x23')](handleEntityNotFound(_0x33fce9,null))[_0x8a91('0x23')](respondWithResult(_0x33fce9,null))[_0x8a91('0x41')](handleError(_0x33fce9,null));};exports[_0x8a91('0x45')]=function(_0x576bb6,_0x3f811a){return db[_0x8a91('0x29')][_0x8a91('0x45')](_0x576bb6[_0x8a91('0x46')],{})[_0x8a91('0x23')](respondWithResult(_0x3f811a,0xc9))[_0x8a91('0x41')](handleError(_0x3f811a,null));};exports['update']=function(_0x412d0d,_0x116a5e){if(_0x412d0d[_0x8a91('0x46')]['id']){delete _0x412d0d[_0x8a91('0x46')]['id'];}return db[_0x8a91('0x29')][_0x8a91('0x44')]({'where':{'id':_0x412d0d[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x116a5e,null))[_0x8a91('0x23')](saveUpdates(_0x412d0d[_0x8a91('0x46')],null))[_0x8a91('0x23')](respondWithResult(_0x116a5e,null))[_0x8a91('0x41')](handleError(_0x116a5e,null));};exports[_0x8a91('0x22')]=function(_0x204f19,_0x25385e){return db[_0x8a91('0x29')]['find']({'where':{'id':_0x204f19[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x25385e,null))[_0x8a91('0x23')](removeEntity(_0x25385e,null))['catch'](handleError(_0x25385e,null));};exports['addConditions']=function(_0x836b51,_0x24f38c,_0x471bf5){return db[_0x8a91('0x47')]['find']({'where':{'id':_0x836b51[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x24f38c,null))['then'](function(_0x2e7412){if(_0x2e7412){return _0x2e7412[_0x8a91('0x48')](_0x836b51['body'][_0x8a91('0x49')],_['omit'](_0x836b51[_0x8a91('0x46')],['ids','id'])||{});}})['then'](respondWithResult(_0x24f38c,null))[_0x8a91('0x41')](handleError(_0x24f38c,null));};exports[_0x8a91('0x4a')]=function(_0x431441,_0x433b26,_0x182570){var _0xda1f68={};var _0x2366f5={};var _0x17a92d;var _0x4e710f;return db[_0x8a91('0x29')][_0x8a91('0x4b')]({'where':{'id':_0x431441[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x433b26,null))[_0x8a91('0x23')](function(_0x5c9e80){if(_0x5c9e80){_0x17a92d=_0x5c9e80;_0x2366f5[_0x8a91('0x2d')]=_[_0x8a91('0x43')](db[_0x8a91('0x47')][_0x8a91('0x2a')]);_0x2366f5[_0x8a91('0x2f')]=_[_0x8a91('0x43')](_0x431441[_0x8a91('0x2f')]);_0x2366f5['filters']=_['intersection'](_0x2366f5[_0x8a91('0x2d')],_0x2366f5[_0x8a91('0x2f')]);_0xda1f68[_0x8a91('0x30')]=_[_0x8a91('0x2e')](_0x2366f5[_0x8a91('0x2d')],qs[_0x8a91('0x31')](_0x431441[_0x8a91('0x2f')][_0x8a91('0x31')]));_0xda1f68[_0x8a91('0x30')]=_0xda1f68[_0x8a91('0x30')][_0x8a91('0x32')]?_0xda1f68[_0x8a91('0x30')]:_0x2366f5[_0x8a91('0x2d')];_0xda1f68[_0x8a91('0x34')]=qs[_0x8a91('0x35')](_0x431441[_0x8a91('0x2f')][_0x8a91('0x35')]);_0xda1f68['where']=qs[_0x8a91('0x37')](_[_0x8a91('0x38')](_0x431441[_0x8a91('0x2f')],_0x2366f5[_0x8a91('0x37')]));if(_0x431441[_0x8a91('0x2f')][_0x8a91('0x39')]){_0xda1f68[_0x8a91('0x36')]=_['merge'](_0xda1f68['where'],{'$or':_[_0x8a91('0x28')](_0xda1f68[_0x8a91('0x30')],function(_0x5e2f5f){var _0xa7bd08={};_0xa7bd08[_0x5e2f5f]={'$like':'%'+_0x431441[_0x8a91('0x2f')]['filter']+'%'};return _0xa7bd08;})});}_0xda1f68=_[_0x8a91('0x3a')]({},_0xda1f68,_0x431441[_0x8a91('0x3c')]);return _0x17a92d['getConditions'](_0xda1f68);}})[_0x8a91('0x23')](function(_0x4d03c4){if(_0x4d03c4){_0x4e710f=_0x4d03c4[_0x8a91('0x32')];if(!_0x431441[_0x8a91('0x2f')][_0x8a91('0x4c')](_0x8a91('0x33'))){_0xda1f68[_0x8a91('0x1c')]=qs[_0x8a91('0x1c')](_0x431441[_0x8a91('0x2f')]['limit']);_0xda1f68[_0x8a91('0x1b')]=qs[_0x8a91('0x1b')](_0x431441['query']['offset']);}return _0x17a92d[_0x8a91('0x4a')](_0xda1f68);}})[_0x8a91('0x23')](function(_0x86182a){if(_0x86182a){return _0x86182a?{'count':_0x4e710f,'rows':_0x86182a}:null;}})['then'](respondWithResult(_0x433b26,null))[_0x8a91('0x41')](handleError(_0x433b26,null));};exports[_0x8a91('0x4d')]=function(_0x429869,_0x36595d,_0x3b4d20){return db[_0x8a91('0x4e')]['find']({'where':{'id':_0x429869[_0x8a91('0x42')]['id']}})[_0x8a91('0x23')](handleEntityNotFound(_0x36595d,null))[_0x8a91('0x23')](function(_0x623704){if(_0x623704){return _0x623704[_0x8a91('0x4d')](_0x429869[_0x8a91('0x46')]['ids'],_[_0x8a91('0x4f')](_0x429869[_0x8a91('0x46')],[_0x8a91('0x49'),'id'])||{});}})['then'](respondWithResult(_0x36595d,null))[_0x8a91('0x41')](handleError(_0x36595d,null));};exports[_0x8a91('0x50')]=function(_0x5acba4,_0x145ae5,_0x3545c8){var _0x2b8bfc={};var _0x2f5b55={};var _0x101b35;var _0x1fc005;return db[_0x8a91('0x29')][_0x8a91('0x4b')]({'where':{'id':_0x5acba4[_0x8a91('0x42')]['id']}})['then'](handleEntityNotFound(_0x145ae5,null))[_0x8a91('0x23')](function(_0x5f198f){if(_0x5f198f){_0x101b35=_0x5f198f;_0x2f5b55[_0x8a91('0x2d')]=_[_0x8a91('0x43')](db[_0x8a91('0x4e')][_0x8a91('0x2a')]);_0x2f5b55[_0x8a91('0x2f')]=_[_0x8a91('0x43')](_0x5acba4[_0x8a91('0x2f')]);_0x2f5b55[_0x8a91('0x37')]=_[_0x8a91('0x2e')](_0x2f5b55[_0x8a91('0x2d')],_0x2f5b55[_0x8a91('0x2f')]);_0x2b8bfc[_0x8a91('0x30')]=_[_0x8a91('0x2e')](_0x2f5b55[_0x8a91('0x2d')],qs[_0x8a91('0x31')](_0x5acba4[_0x8a91('0x2f')][_0x8a91('0x31')]));_0x2b8bfc[_0x8a91('0x30')]=_0x2b8bfc[_0x8a91('0x30')][_0x8a91('0x32')]?_0x2b8bfc[_0x8a91('0x30')]:_0x2f5b55[_0x8a91('0x2d')];_0x2b8bfc[_0x8a91('0x34')]=qs[_0x8a91('0x35')](_0x5acba4[_0x8a91('0x2f')]['sort']);_0x2b8bfc[_0x8a91('0x36')]=qs['filters'](_['pick'](_0x5acba4[_0x8a91('0x2f')],_0x2f5b55[_0x8a91('0x37')]));if(_0x5acba4[_0x8a91('0x2f')][_0x8a91('0x39')]){_0x2b8bfc[_0x8a91('0x36')]=_[_0x8a91('0x3a')](_0x2b8bfc['where'],{'$or':_[_0x8a91('0x28')](_0x2b8bfc[_0x8a91('0x30')],function(_0x430080){var _0x3c9052={};_0x3c9052[_0x430080]={'$like':'%'+_0x5acba4[_0x8a91('0x2f')][_0x8a91('0x39')]+'%'};return _0x3c9052;})});}_0x2b8bfc=_[_0x8a91('0x3a')]({},_0x2b8bfc,_0x5acba4['options']);return _0x101b35['getActions'](_0x2b8bfc);}})[_0x8a91('0x23')](function(_0x571a48){if(_0x571a48){_0x1fc005=_0x571a48[_0x8a91('0x32')];if(!_0x5acba4['query'][_0x8a91('0x4c')](_0x8a91('0x33'))){_0x2b8bfc[_0x8a91('0x1c')]=qs[_0x8a91('0x1c')](_0x5acba4[_0x8a91('0x2f')]['limit']);_0x2b8bfc['offset']=qs[_0x8a91('0x1b')](_0x5acba4['query'][_0x8a91('0x1b')]);}return _0x101b35[_0x8a91('0x50')](_0x2b8bfc);}})[_0x8a91('0x23')](function(_0x1a96db){if(_0x1a96db){return _0x1a96db?{'count':_0x1fc005,'rows':_0x1a96db}:null;}})[_0x8a91('0x23')](respondWithResult(_0x145ae5,null))['catch'](handleError(_0x145ae5,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index bf33df1..b87dd0d 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 _0x33c5=['Automation','tools_automations','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x33c5,0xe6));var _0x533c=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0x33c5[_0x198446];return _0x38d7b7;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('api');var moment=require(_0x533c('0x2'));var BPromise=require(_0x533c('0x3'));var rp=require(_0x533c('0x4'));var fs=require('fs');var path=require(_0x533c('0x5'));var rimraf=require(_0x533c('0x6'));var config=require('../../config/environment');var attributes=require(_0x533c('0x7'));module[_0x533c('0x8')]=function(_0x31d912,_0x151732){return _0x31d912[_0x533c('0x9')](_0x533c('0xa'),attributes,{'tableName':_0x533c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./automation.attributes','exports','define','tools_automations','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0x55ca,0x126));var _0xa55c=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0x55ca[_0x2be240];return _0x123543;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Automation',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index ba74ff9..386e842 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 _0x55a5=['request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','Automation,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55a5,0x1d0));var _0x555a=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x55a5[_0x1a89a1];return _0x3d5b46;};'use strict';var _=require('lodash');var util=require(_0x555a('0x0'));var moment=require(_0x555a('0x1'));var BPromise=require('bluebird');var rs=require(_0x555a('0x2'));var fs=require('fs');var Redis=require(_0x555a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x555a('0x4'));var logger=require('../../config/logger')(_0x555a('0x5'));var config=require(_0x555a('0x6'));var jayson=require(_0x555a('0x7'));var client=jayson[_0x555a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x461563,_0x132426,_0x19467f){return new BPromise(function(_0x4d09b6,_0x2e3cd5){return client['request'](_0x461563,_0x19467f)[_0x555a('0x9')](function(_0xaec03e){logger['info'](_0x555a('0xa'),_0x132426,_0x555a('0xb'));logger[_0x555a('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x132426,_0x555a('0xb'),JSON[_0x555a('0xd')](_0xaec03e));if(_0xaec03e[_0x555a('0xe')]){if(_0xaec03e[_0x555a('0xe')][_0x555a('0xf')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x132426,_0xaec03e[_0x555a('0xe')][_0x555a('0x10')]);return _0x2e3cd5(_0xaec03e[_0x555a('0xe')][_0x555a('0x10')]);}logger[_0x555a('0xe')](_0x555a('0xa'),_0x132426,_0xaec03e[_0x555a('0xe')]['message']);return _0x4d09b6(_0xaec03e['error']['message']);}else{logger['info'](_0x555a('0xa'),_0x132426,_0x555a('0xb'));_0x4d09b6(_0xaec03e[_0x555a('0x11')][_0x555a('0x10')]);}})[_0x555a('0x12')](function(_0xd13ba3){logger[_0x555a('0xe')]('Automation,\x20%s,\x20%s',_0x132426,_0xd13ba3);_0x2e3cd5(_0xd13ba3);});});} \ No newline at end of file +var _0x324d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xf9391f,_0x11b059){var _0x36a909=function(_0x2fde9d){while(--_0x2fde9d){_0xf9391f['push'](_0xf9391f['shift']());}};_0x36a909(++_0x11b059);}(_0x324d,0x170));var _0xd324=function(_0x132d17,_0x5e2a04){_0x132d17=_0x132d17-0x0;var _0x2b1830=_0x324d[_0x132d17];return _0x2b1830;};'use strict';var _=require(_0xd324('0x0'));var util=require(_0xd324('0x1'));var moment=require('moment');var BPromise=require(_0xd324('0x2'));var rs=require(_0xd324('0x3'));var fs=require('fs');var Redis=require(_0xd324('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd324('0x5'));var logger=require(_0xd324('0x6'))(_0xd324('0x7'));var config=require(_0xd324('0x8'));var jayson=require(_0xd324('0x9'));var client=jayson[_0xd324('0xa')][_0xd324('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c84e7,_0x23fba7,_0x39bfb4){return new BPromise(function(_0x280461,_0x5231b7){return client[_0xd324('0xc')](_0x5c84e7,_0x39bfb4)[_0xd324('0xd')](function(_0xa21a59){logger[_0xd324('0xe')](_0xd324('0xf'),_0x23fba7,_0xd324('0x10'));logger[_0xd324('0x11')](_0xd324('0x12'),_0x23fba7,_0xd324('0x10'),JSON[_0xd324('0x13')](_0xa21a59));if(_0xa21a59['error']){if(_0xa21a59[_0xd324('0x14')][_0xd324('0x15')]===0x1f4){logger['error'](_0xd324('0xf'),_0x23fba7,_0xa21a59['error'][_0xd324('0x16')]);return _0x5231b7(_0xa21a59[_0xd324('0x14')][_0xd324('0x16')]);}logger[_0xd324('0x14')]('Automation,\x20%s,\x20%s',_0x23fba7,_0xa21a59[_0xd324('0x14')][_0xd324('0x16')]);return _0x280461(_0xa21a59[_0xd324('0x14')]['message']);}else{logger['info'](_0xd324('0xf'),_0x23fba7,'request\x20sent');_0x280461(_0xa21a59[_0xd324('0x17')][_0xd324('0x16')]);}})[_0xd324('0x18')](function(_0x1065d5){logger['error'](_0xd324('0xf'),_0x23fba7,_0x1065d5);_0x5231b7(_0x1065d5);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 21d35c0..a7bbb93 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 _0x50d5=['post','create','addConditions','addActions','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','show','/:id/conditions','isAuthenticated','getConditions','/:id/actions','getActions'];(function(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_0x50d5,0x166));var _0x550d=function(_0x498f42,_0x115d92){_0x498f42=_0x498f42-0x0;var _0x3456bd=_0x50d5[_0x498f42];return _0x3456bd;};'use strict';var multer=require(_0x550d('0x0'));var util=require('util');var path=require(_0x550d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x550d('0x2')]();var auth=require(_0x550d('0x3'));var interaction=require(_0x550d('0x4'));var config=require(_0x550d('0x5'));var controller=require(_0x550d('0x6'));router[_0x550d('0x7')]('/',auth['isAuthenticated'](),controller[_0x550d('0x8')]);router[_0x550d('0x7')](_0x550d('0x9'),auth['isAuthenticated'](),controller[_0x550d('0xa')]);router[_0x550d('0x7')](_0x550d('0xb'),auth[_0x550d('0xc')](),controller[_0x550d('0xd')]);router['get'](_0x550d('0xe'),auth['isAuthenticated'](),controller[_0x550d('0xf')]);router[_0x550d('0x10')]('/',auth['isAuthenticated'](),controller[_0x550d('0x11')]);router[_0x550d('0x10')](_0x550d('0xb'),auth[_0x550d('0xc')](),controller[_0x550d('0x12')]);router[_0x550d('0x10')](_0x550d('0xe'),auth[_0x550d('0xc')](),controller[_0x550d('0x13')]);router['put']('/:id',auth[_0x550d('0xc')](),controller['update']);router[_0x550d('0x14')](_0x550d('0x9'),auth[_0x550d('0xc')](),controller[_0x550d('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2558=['/:id/conditions','addConditions','addActions','put','update','delete','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','getConditions','/:id/actions','post','create'];(function(_0x211b43,_0x3912fb){var _0x5f4576=function(_0x430838){while(--_0x430838){_0x211b43['push'](_0x211b43['shift']());}};_0x5f4576(++_0x3912fb);}(_0x2558,0x1a0));var _0x8255=function(_0x21014b,_0xb932fe){_0x21014b=_0x21014b-0x0;var _0x4da430=_0x2558[_0x21014b];return _0x4da430;};'use strict';var multer=require('multer');var util=require(_0x8255('0x0'));var path=require(_0x8255('0x1'));var timeout=require(_0x8255('0x2'));var express=require(_0x8255('0x3'));var router=express[_0x8255('0x4')]();var auth=require(_0x8255('0x5'));var interaction=require(_0x8255('0x6'));var config=require(_0x8255('0x7'));var controller=require(_0x8255('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8255('0x9')]('/:id',auth[_0x8255('0xa')](),controller[_0x8255('0xb')]);router[_0x8255('0x9')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x8255('0xc')]);router['get'](_0x8255('0xd'),auth['isAuthenticated'](),controller['getActions']);router[_0x8255('0xe')]('/',auth[_0x8255('0xa')](),controller[_0x8255('0xf')]);router[_0x8255('0xe')](_0x8255('0x10'),auth[_0x8255('0xa')](),controller[_0x8255('0x11')]);router[_0x8255('0xe')](_0x8255('0xd'),auth[_0x8255('0xa')](),controller[_0x8255('0x12')]);router[_0x8255('0x13')]('/:id',auth[_0x8255('0xa')](),controller[_0x8255('0x14')]);router[_0x8255('0x15')](_0x8255('0x16'),auth['isAuthenticated'](),controller[_0x8255('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 3e71df5..f0b195e 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 _0xe85d=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x2912d8,_0x201076){var _0x6b361c=function(_0x177d9f){while(--_0x177d9f){_0x2912d8['push'](_0x2912d8['shift']());}};_0x6b361c(++_0x201076);}(_0xe85d,0x10d));var _0xde85=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xe85d[_0x50e593];return _0x3821d0;};'use strict';var Sequelize=require(_0xde85('0x0'));module[_0xde85('0x1')]={'name':{'type':Sequelize[_0xde85('0x2')],'unique':_0xde85('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xde85('0x4')),'allowNull':![],'defaultValue':_0xde85('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xde85('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xde85('0x6')](0x4)[_0xde85('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xde85('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xde85('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xde85('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xde85('0xd')},'dialTimezone':{'type':Sequelize[_0xde85('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xde85('0x2')],'defaultValue':_0xde85('0xe')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xde85('0xf'),_0xde85('0x10'),'onlyIfOpen'),'defaultValue':_0xde85('0xf')},'dialAMDActive':{'type':Sequelize[_0xde85('0x5')],'defaultValue':0x0,'comment':_0xde85('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xde85('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xde85('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xde85('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xde85('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xde85('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xde85('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xde85('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xde85('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xde85('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xde85('0x6')](0x9)[_0xde85('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xde85('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xde85('0x19')](_0xde85('0x1a'),_0xde85('0x1b')),'defaultValue':_0xde85('0x1a')},'dialPrefix':{'type':Sequelize[_0xde85('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xde85('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xde85('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xde85('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xde85('0x6')](0x3)[_0xde85('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xde85('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xde85('0x6')](0x5)[_0xde85('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xde85('0x25')}}; \ No newline at end of file +var _0x6949=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6949,0xd4));var _0x9694=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x6949[_0xf0bc07];return _0x1c50c2;};'use strict';var Sequelize=require('sequelize');module[_0x9694('0x0')]={'name':{'type':Sequelize[_0x9694('0x1')],'unique':_0x9694('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9694('0x3')](_0x9694('0x4')),'allowNull':![],'defaultValue':_0x9694('0x4')},'description':{'type':Sequelize[_0x9694('0x1')]},'active':{'type':Sequelize[_0x9694('0x5')],'defaultValue':0x0,'comment':_0x9694('0x6')},'limitCalls':{'type':Sequelize[_0x9694('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x9694('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9694('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x9694('0x7')](0x3)[_0x9694('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9694('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)[_0x9694('0x8')],'defaultValue':0x3,'comment':_0x9694('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x9694('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9694('0x1')],'defaultValue':_0x9694('0xc')},'dialCheckDuplicateType':{'type':Sequelize[_0x9694('0x3')]('always',_0x9694('0xd'),_0x9694('0xe')),'defaultValue':_0x9694('0xf')},'dialAMDActive':{'type':Sequelize[_0x9694('0x5')],'defaultValue':0x0,'comment':_0x9694('0x10')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9694('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9694('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9694('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9694('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9694('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9694('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9694('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9694('0x7')](0x9)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9694('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9694('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9694('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9694('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9694('0x3')](_0x9694('0x19'),_0x9694('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x9694('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9694('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9694('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9694('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)[_0x9694('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)[_0x9694('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9694('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9694('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9694('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9694('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 7285165..ec5e572 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 _0xbb3b=['fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','IvrCampaigns','UserProfileResource','end','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','Campaign','include','rows','catch','show','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','hasOwnProperty','order','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper'];(function(_0x566448,_0x1d984a){var _0x182959=function(_0x22f7e8){while(--_0x22f7e8){_0x566448['push'](_0x566448['shift']());}};_0x182959(++_0x1d984a);}(_0xbb3b,0x1b6));var _0xbbb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb3b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbb3('0x0'));var rimraf=require(_0xbbb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbb3('0x2'));var rp=require('request-promise');var moment=require(_0xbbb3('0x3'));var BPromise=require(_0xbbb3('0x4'));var Mustache=require(_0xbbb3('0x5'));var util=require('util');var path=require(_0xbbb3('0x6'));var sox=require(_0xbbb3('0x7'));var csv=require(_0xbbb3('0x8'));var ejs=require(_0xbbb3('0x9'));var fs=require('fs');var _=require(_0xbbb3('0xa'));var squel=require(_0xbbb3('0xb'));var crypto=require(_0xbbb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbbb3('0xd'));var toCsv=require(_0xbbb3('0x8'));var querystring=require(_0xbbb3('0xe'));var Papa=require(_0xbbb3('0xf'));var Redis=require(_0xbbb3('0x10'));var authService=require(_0xbbb3('0x11'));var qs=require(_0xbbb3('0x12'));var as=require(_0xbbb3('0x13'));var hardwareService=require(_0xbbb3('0x14'));var logger=require(_0xbbb3('0x15'))(_0xbbb3('0x16'));var utils=require(_0xbbb3('0x17'));var config=require(_0xbbb3('0x18'));var db=require(_0xbbb3('0x19'))['db'];function respondWithStatusCode(_0x42397e,_0x2686d9){_0x2686d9=_0x2686d9||0xcc;return function(_0x320e6c){if(_0x320e6c){return _0x42397e[_0xbbb3('0x1a')](_0x2686d9);}return _0x42397e['status'](_0x2686d9)['end']();};}function respondWithResult(_0x56b566,_0x2a43aa){_0x2a43aa=_0x2a43aa||0xc8;return function(_0x43f42f){if(_0x43f42f){return _0x56b566[_0xbbb3('0x1b')](_0x2a43aa)['json'](_0x43f42f);}};}function respondWithFilteredResult(_0x32f36a,_0x59a6e6){return function(_0x186051){if(_0x186051){var _0x496ada=_0x186051[_0xbbb3('0x1c')],_0x525b94=_0x59a6e6[_0xbbb3('0x1d')],_0xe0e853=_0x59a6e6[_0xbbb3('0x1d')]+_0x59a6e6[_0xbbb3('0x1e')],_0x15eec1;if(_0xe0e853>=_0x496ada){_0xe0e853=_0x496ada;_0x15eec1=0xc8;}else{_0x15eec1=0xce;}_0x32f36a['status'](_0x15eec1);return _0x32f36a[_0xbbb3('0x1f')](_0xbbb3('0x20'),_0x525b94+'-'+_0xe0e853+'/'+_0x496ada)[_0xbbb3('0x21')](_0x186051);}return null;};}function patchUpdates(_0xed9e96){return function(_0x2adfad){try{jsonpatch[_0xbbb3('0x22')](_0x2adfad,_0xed9e96,!![]);}catch(_0x5c6561){return BPromise[_0xbbb3('0x23')](_0x5c6561);}return _0x2adfad['save']();};}function saveUpdates(_0x1c7ead,_0x5216f4){return function(_0x32477e){if(_0x32477e){return _0x32477e[_0xbbb3('0x24')](_0x1c7ead)['then'](function(_0x5597b5){return _0x5597b5;});}return null;};}function removeEntity(_0x40adb9,_0x327558){return function(_0x17a6c2){if(_0x17a6c2){return _0x17a6c2[_0xbbb3('0x25')]()[_0xbbb3('0x26')](function(){var _0x55222d=_0x17a6c2[_0xbbb3('0x27')]({'plain':!![]});var _0x2f64ee=_0xbbb3('0x28');return db[_0xbbb3('0x29')]['destroy']({'where':{'type':_0x2f64ee,'resourceId':_0x55222d['id']}})[_0xbbb3('0x26')](function(){return _0x17a6c2;});})[_0xbbb3('0x26')](function(){_0x40adb9[_0xbbb3('0x1b')](0xcc)[_0xbbb3('0x2a')]();});}};}function handleEntityNotFound(_0x4a8a72,_0x5e8388){return function(_0x42d845){if(!_0x42d845){_0x4a8a72[_0xbbb3('0x1a')](0x194);}return _0x42d845;};}function handleError(_0x4cf299,_0xabfeae){_0xabfeae=_0xabfeae||0x1f4;return function(_0x1d2e3a){logger[_0xbbb3('0x2b')](_0x1d2e3a[_0xbbb3('0x2c')]);if(_0x1d2e3a[_0xbbb3('0x2d')]){delete _0x1d2e3a[_0xbbb3('0x2d')];}_0x4cf299[_0xbbb3('0x1b')](_0xabfeae)['send'](_0x1d2e3a);};}exports[_0xbbb3('0x2e')]=function(_0x432d93,_0x1a95b0){var _0x446153={},_0x3cad1d={},_0x3e04d0={'count':0x0,'rows':[]};var _0x5e47e3=_['map'](db['Campaign'][_0xbbb3('0x2f')],function(_0x1c2375){return{'name':_0x1c2375[_0xbbb3('0x30')],'type':_0x1c2375[_0xbbb3('0x31')]['key']};});_0x3cad1d[_0xbbb3('0x32')]=_[_0xbbb3('0x33')](_0x5e47e3,_0xbbb3('0x2d'));_0x3cad1d[_0xbbb3('0x34')]=_['keys'](_0x432d93[_0xbbb3('0x34')]);_0x3cad1d[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x3cad1d[_0xbbb3('0x32')],_0x3cad1d[_0xbbb3('0x34')]);_0x446153['attributes']=_[_0xbbb3('0x36')](_0x3cad1d[_0xbbb3('0x32')],qs['fields'](_0x432d93['query'][_0xbbb3('0x37')]));_0x446153[_0xbbb3('0x38')]=_0x446153[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x446153['attributes']:_0x3cad1d[_0xbbb3('0x32')];if(!_0x432d93[_0xbbb3('0x34')]['hasOwnProperty'](_0xbbb3('0x3a'))){_0x446153[_0xbbb3('0x1e')]=qs['limit'](_0x432d93['query'][_0xbbb3('0x1e')]);_0x446153[_0xbbb3('0x1d')]=qs['offset'](_0x432d93['query']['offset']);}_0x446153['order']=qs['sort'](_0x432d93['query'][_0xbbb3('0x3b')]);_0x446153[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0x432d93[_0xbbb3('0x34')],_0x3cad1d[_0xbbb3('0x35')]),_0x5e47e3);if(_0x432d93[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x446153[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x446153[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x5e47e3,function(_0x4de361){if(_0x4de361[_0xbbb3('0x31')]!=='VIRTUAL'){var _0x197086={};_0x197086[_0x4de361[_0xbbb3('0x2d')]]={'$like':'%'+_0x432d93[_0xbbb3('0x34')][_0xbbb3('0x3e')]+'%'};return _0x197086;}})});}_0x446153=_['merge']({},_0x446153,_0x432d93['options']);var _0x3b8d6e={'where':_0x446153['where']};return db[_0xbbb3('0x40')]['count'](_0x3b8d6e)[_0xbbb3('0x26')](function(_0x166ac5){_0x3e04d0[_0xbbb3('0x1c')]=_0x166ac5;if(_0x432d93['query']['includeAll']){_0x446153[_0xbbb3('0x41')]=[{'all':!![]}];}return db[_0xbbb3('0x40')]['findAll'](_0x446153);})[_0xbbb3('0x26')](function(_0x45ca49){_0x3e04d0[_0xbbb3('0x42')]=_0x45ca49;return _0x3e04d0;})['then'](respondWithFilteredResult(_0x1a95b0,_0x446153))[_0xbbb3('0x43')](handleError(_0x1a95b0,null));};exports[_0xbbb3('0x44')]=function(_0x49f20d,_0x46d718){var _0x15176e={'raw':![],'where':{'id':_0x49f20d['params']['id']}},_0xd34788={};_0xd34788[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db[_0xbbb3('0x40')][_0xbbb3('0x2f')]);_0xd34788['query']=_[_0xbbb3('0x45')](_0x49f20d[_0xbbb3('0x34')]);_0xd34788[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0xd34788[_0xbbb3('0x32')],_0xd34788['query']);_0x15176e[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0xd34788[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0x49f20d[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x15176e[_0xbbb3('0x38')]=_0x15176e[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x15176e['attributes']:_0xd34788[_0xbbb3('0x32')];if(_0x49f20d['query'][_0xbbb3('0x46')]){_0x15176e['include']=[{'all':!![]}];}_0x15176e=_['merge']({},_0x15176e,_0x49f20d[_0xbbb3('0x47')]);return db[_0xbbb3('0x40')][_0xbbb3('0x48')](_0x15176e)[_0xbbb3('0x26')](handleEntityNotFound(_0x46d718,null))[_0xbbb3('0x26')](respondWithResult(_0x46d718,null))[_0xbbb3('0x43')](handleError(_0x46d718,null));};exports[_0xbbb3('0x49')]=function(_0x4cd64e,_0x567c24){return db[_0xbbb3('0x40')][_0xbbb3('0x49')](_0x4cd64e[_0xbbb3('0x4a')],{})[_0xbbb3('0x26')](function(_0xd5575){var _0x5221dc=_0x4cd64e[_0xbbb3('0x4b')][_0xbbb3('0x27')]({'plain':!![]});if(!_0x5221dc)throw new Error(_0xbbb3('0x4c'));if(_0x5221dc[_0xbbb3('0x4d')]===_0xbbb3('0x4b')){var _0x430f07=_0xd5575[_0xbbb3('0x27')]({'plain':!![]});var _0x48119c=_0xbbb3('0x28');return db['UserProfileSection'][_0xbbb3('0x48')]({'where':{'name':_0x48119c,'userProfileId':_0x5221dc[_0xbbb3('0x4e')]},'raw':!![]})['then'](function(_0x3f8d24){if(_0x3f8d24&&_0x3f8d24[_0xbbb3('0x4f')]===0x0){return db[_0xbbb3('0x29')][_0xbbb3('0x49')]({'name':_0x430f07[_0xbbb3('0x2d')],'resourceId':_0x430f07['id'],'type':_0x3f8d24[_0xbbb3('0x2d')],'sectionId':_0x3f8d24['id']},{})['then'](function(){return _0xd5575;});}else{return _0xd5575;}})['catch'](function(_0x45a393){logger[_0xbbb3('0x2b')](_0xbbb3('0x50'),_0x45a393);throw _0x45a393;});}return _0xd5575;})['then'](respondWithResult(_0x567c24,0xc9))['catch'](handleError(_0x567c24,null));};exports[_0xbbb3('0x51')]=function(_0x504403,_0x1a15b6){var _0x8d3b80={'where':{'id':_0x504403[_0xbbb3('0x52')]['id']}},_0x4d6007={};_0x4d6007[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db[_0xbbb3('0x40')][_0xbbb3('0x2f')]);_0x8d3b80[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x4d6007[_0xbbb3('0x32')],qs['fields'](_0x504403[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x8d3b80[_0xbbb3('0x38')]=_0x8d3b80[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x8d3b80['attributes']:_0x4d6007[_0xbbb3('0x32')];if(_0x504403[_0xbbb3('0x34')]['includeAll']){_0x8d3b80[_0xbbb3('0x41')]=[{'all':!![]}];}_0x8d3b80=_[_0xbbb3('0x3f')]({},_0x8d3b80,_0x504403[_0xbbb3('0x47')]);return db[_0xbbb3('0x40')][_0xbbb3('0x48')](_0x8d3b80)[_0xbbb3('0x26')](handleEntityNotFound(_0x1a15b6,null))[_0xbbb3('0x26')](function(_0xdb20ed){if(_0xdb20ed){var _0x3df72e=_0xdb20ed[_0xbbb3('0x27')]({'plain':!![]});_0x3df72e=qs[_0xbbb3('0x53')](_0x3df72e,['id',_0xbbb3('0x54'),_0xbbb3('0x55')]);_0x504403[_0xbbb3('0x4a')]=_[_0xbbb3('0x53')](_0x504403['body'],['id',_0xbbb3('0x54'),_0xbbb3('0x55')]);return db['Campaign'][_0xbbb3('0x49')](_['merge'](_0x3df72e,_0x504403[_0xbbb3('0x4a')]),{'include':_0x504403['query'][_0xbbb3('0x46')]?[{'all':!![]}]:undefined})[_0xbbb3('0x26')](function(_0x32583d){var _0x5b6e58=_0x504403['user'][_0xbbb3('0x27')]({'plain':!![]});if(!_0x5b6e58)throw new Error(_0xbbb3('0x4c'));if(_0x5b6e58[_0xbbb3('0x4d')]===_0xbbb3('0x4b')){var _0x495373=_0x32583d['get']({'plain':!![]});var _0xd8f9c5=_0xbbb3('0x28');return db[_0xbbb3('0x56')]['find']({'where':{'name':_0xd8f9c5,'userProfileId':_0x5b6e58['userProfileId']},'raw':!![]})[_0xbbb3('0x26')](function(_0x16bc95){if(_0x16bc95&&_0x16bc95['autoAssociation']===0x0){return db[_0xbbb3('0x29')]['create']({'name':_0x495373[_0xbbb3('0x2d')],'resourceId':_0x495373['id'],'type':_0x16bc95[_0xbbb3('0x2d')],'sectionId':_0x16bc95['id']},{})['then'](function(){return _0x32583d;});}else{return _0x32583d;}})['catch'](function(_0xbb7eab){logger[_0xbbb3('0x2b')](_0xbbb3('0x50'),_0xbb7eab);throw _0xbb7eab;});}return _0x32583d;});}})[_0xbbb3('0x26')](respondWithResult(_0x1a15b6,0xc9))[_0xbbb3('0x43')](handleError(_0x1a15b6,null));};exports['update']=function(_0x159a96,_0x40734a){if(_0x159a96[_0xbbb3('0x4a')]['id']){delete _0x159a96[_0xbbb3('0x4a')]['id'];}return db['Campaign'][_0xbbb3('0x48')]({'where':{'id':_0x159a96[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x40734a,null))[_0xbbb3('0x26')](saveUpdates(_0x159a96['body'],null))[_0xbbb3('0x26')](respondWithResult(_0x40734a,null))[_0xbbb3('0x43')](handleError(_0x40734a,null));};exports[_0xbbb3('0x25')]=function(_0x5aec00,_0x1084e9){return db[_0xbbb3('0x40')][_0xbbb3('0x48')]({'where':{'id':_0x5aec00[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x1084e9,null))[_0xbbb3('0x26')](removeEntity(_0x1084e9,null))[_0xbbb3('0x43')](handleError(_0x1084e9,null));};exports[_0xbbb3('0x57')]=function(_0x3d5c48,_0x333e80,_0x14c51f){var _0x9b078b={'raw':!![],'where':{}};var _0x27feea={};var _0x2063d9={'count':0x0,'rows':[]};return db['Campaign'][_0xbbb3('0x58')]({'where':{'id':_0x3d5c48[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x333e80,null))['then'](function(_0x298f43){if(_0x298f43){_0x27feea[_0xbbb3('0x32')]=_['keys'](db['CmHopper']['rawAttributes']);_0x27feea[_0xbbb3('0x34')]=_[_0xbbb3('0x45')](_0x3d5c48[_0xbbb3('0x34')]);_0x27feea[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x27feea[_0xbbb3('0x32')],_0x27feea[_0xbbb3('0x34')]);_0x9b078b['attributes']=_[_0xbbb3('0x36')](_0x27feea[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0x3d5c48[_0xbbb3('0x34')]['fields']));_0x9b078b[_0xbbb3('0x38')]=_0x9b078b['attributes']['length']?_0x9b078b[_0xbbb3('0x38')]:_0x27feea['model'];if(!_0x3d5c48[_0xbbb3('0x34')][_0xbbb3('0x59')]('nolimit')){_0x9b078b['limit']=qs['limit'](_0x3d5c48[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x9b078b['offset']=qs[_0xbbb3('0x1d')](_0x3d5c48[_0xbbb3('0x34')]['offset']);}_0x9b078b[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0x3d5c48['query']['sort']);_0x9b078b[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0x3d5c48[_0xbbb3('0x34')],_0x27feea[_0xbbb3('0x35')]));_0x9b078b[_0xbbb3('0x3c')][_0xbbb3('0x5b')]=_0x298f43['id'];if(_0x3d5c48['query']['filter']){_0x9b078b[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x9b078b['where'],{'$or':_[_0xbbb3('0x33')](_0x9b078b['attributes'],function(_0x5179aa){var _0x474131={};_0x474131[_0x5179aa]={'$like':'%'+_0x3d5c48[_0xbbb3('0x34')]['filter']+'%'};return _0x474131;})});}_0x9b078b=_[_0xbbb3('0x3f')]({},_0x9b078b,_0x3d5c48[_0xbbb3('0x47')]);return db[_0xbbb3('0x5c')][_0xbbb3('0x1c')]({'where':_0x9b078b[_0xbbb3('0x3c')]})[_0xbbb3('0x26')](function(_0x1c2f36){_0x2063d9[_0xbbb3('0x1c')]=_0x1c2f36;if(_0x3d5c48[_0xbbb3('0x34')][_0xbbb3('0x46')]){_0x9b078b[_0xbbb3('0x41')]=[{'all':!![]}];}return db[_0xbbb3('0x5c')][_0xbbb3('0x5d')](_0x9b078b);})[_0xbbb3('0x26')](function(_0xa36878){_0x2063d9[_0xbbb3('0x42')]=_0xa36878;return _0x2063d9;});}})['then'](respondWithFilteredResult(_0x333e80,_0x9b078b))[_0xbbb3('0x43')](handleError(_0x333e80,null));};exports[_0xbbb3('0x5e')]=function(_0x3a1329,_0x5a32e0,_0x24512e){var _0x4f2787={'raw':!![],'where':{}};var _0x2db34d={};var _0x132ef0={'count':0x0,'rows':[]};return db[_0xbbb3('0x40')]['findOne']({'where':{'id':_0x3a1329[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x5a32e0,null))[_0xbbb3('0x26')](function(_0x2428df){if(_0x2428df){_0x2db34d[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db['CmHopperHistory']['rawAttributes']);_0x2db34d['query']=_[_0xbbb3('0x45')](_0x3a1329[_0xbbb3('0x34')]);_0x2db34d[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x2db34d['model'],_0x2db34d['query']);_0x4f2787[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x2db34d[_0xbbb3('0x32')],qs['fields'](_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x4f2787[_0xbbb3('0x38')]=_0x4f2787[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x4f2787[_0xbbb3('0x38')]:_0x2db34d['model'];if(!_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x59')](_0xbbb3('0x3a'))){_0x4f2787['limit']=qs[_0xbbb3('0x1e')](_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x4f2787[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0x3a1329[_0xbbb3('0x34')]['offset']);}_0x4f2787[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x3b')]);_0x4f2787[_0xbbb3('0x3c')]=qs['filters'](_[_0xbbb3('0x3d')](_0x3a1329[_0xbbb3('0x34')],_0x2db34d['filters']));_0x4f2787[_0xbbb3('0x3c')][_0xbbb3('0x5b')]=_0x2428df['id'];if(_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x4f2787[_0xbbb3('0x3c')]=_['merge'](_0x4f2787[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x4f2787[_0xbbb3('0x38')],function(_0x27bbeb){var _0x1f120d={};_0x1f120d[_0x27bbeb]={'$like':'%'+_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x3e')]+'%'};return _0x1f120d;})});}_0x4f2787=_[_0xbbb3('0x3f')]({},_0x4f2787,_0x3a1329[_0xbbb3('0x47')]);return db['CmHopperHistory'][_0xbbb3('0x1c')]({'where':_0x4f2787['where']})[_0xbbb3('0x26')](function(_0x1e6ce3){_0x132ef0[_0xbbb3('0x1c')]=_0x1e6ce3;if(_0x3a1329[_0xbbb3('0x34')][_0xbbb3('0x46')]){_0x4f2787['include']=[{'all':!![]}];}return db[_0xbbb3('0x5f')][_0xbbb3('0x5d')](_0x4f2787);})[_0xbbb3('0x26')](function(_0x204092){_0x132ef0[_0xbbb3('0x42')]=_0x204092;return _0x132ef0;});}})[_0xbbb3('0x26')](respondWithFilteredResult(_0x5a32e0,_0x4f2787))[_0xbbb3('0x43')](handleError(_0x5a32e0,null));};exports['getHopperFinals']=function(_0x3ecafe,_0x4f18a5,_0x2128cd){var _0x3cb334={'raw':!![],'where':{}};var _0x1387ef={};var _0x399c79={'count':0x0,'rows':[]};return db[_0xbbb3('0x40')][_0xbbb3('0x58')]({'where':{'id':_0x3ecafe[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x4f18a5,null))[_0xbbb3('0x26')](function(_0x4a4e20){if(_0x4a4e20){_0x1387ef[_0xbbb3('0x32')]=_['keys'](db[_0xbbb3('0x60')][_0xbbb3('0x2f')]);_0x1387ef['query']=_['keys'](_0x3ecafe['query']);_0x1387ef[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x1387ef[_0xbbb3('0x32')],_0x1387ef['query']);_0x3cb334[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x1387ef[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0x3ecafe['query'][_0xbbb3('0x37')]));_0x3cb334[_0xbbb3('0x38')]=_0x3cb334[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x3cb334[_0xbbb3('0x38')]:_0x1387ef[_0xbbb3('0x32')];if(!_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x59')](_0xbbb3('0x3a'))){_0x3cb334[_0xbbb3('0x1e')]=qs[_0xbbb3('0x1e')](_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x3cb334[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x1d')]);}_0x3cb334[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x3b')]);_0x3cb334[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_['pick'](_0x3ecafe[_0xbbb3('0x34')],_0x1387ef['filters']));_0x3cb334[_0xbbb3('0x3c')]['CampaignId']=_0x4a4e20['id'];if(_0x3ecafe[_0xbbb3('0x34')]['filter']){_0x3cb334['where']=_[_0xbbb3('0x3f')](_0x3cb334[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x3cb334[_0xbbb3('0x38')],function(_0x279069){var _0x226409={};_0x226409[_0x279069]={'$like':'%'+_0x3ecafe[_0xbbb3('0x34')][_0xbbb3('0x3e')]+'%'};return _0x226409;})});}_0x3cb334=_[_0xbbb3('0x3f')]({},_0x3cb334,_0x3ecafe[_0xbbb3('0x47')]);return db[_0xbbb3('0x60')][_0xbbb3('0x1c')]({'where':_0x3cb334[_0xbbb3('0x3c')]})['then'](function(_0x4c6767){_0x399c79['count']=_0x4c6767;if(_0x3ecafe['query'][_0xbbb3('0x46')]){_0x3cb334[_0xbbb3('0x41')]=[{'all':!![]}];}return db[_0xbbb3('0x60')]['findAll'](_0x3cb334);})[_0xbbb3('0x26')](function(_0x22ee0c){_0x399c79[_0xbbb3('0x42')]=_0x22ee0c;return _0x399c79;});}})['then'](respondWithFilteredResult(_0x4f18a5,_0x3cb334))[_0xbbb3('0x43')](handleError(_0x4f18a5,null));};exports['getHopperBlacks']=function(_0x1f72b0,_0x55b954,_0x41c773){var _0x3216bf={'raw':!![],'where':{}};var _0x4d0932={};var _0x15a56b={'count':0x0,'rows':[]};return db[_0xbbb3('0x40')][_0xbbb3('0x58')]({'where':{'id':_0x1f72b0[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x55b954,null))['then'](function(_0x1e9ef2){if(_0x1e9ef2){_0x4d0932['model']=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x4d0932[_0xbbb3('0x34')]=_[_0xbbb3('0x45')](_0x1f72b0[_0xbbb3('0x34')]);_0x4d0932[_0xbbb3('0x35')]=_['intersection'](_0x4d0932[_0xbbb3('0x32')],_0x4d0932[_0xbbb3('0x34')]);_0x3216bf[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x4d0932['model'],qs[_0xbbb3('0x37')](_0x1f72b0[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x3216bf['attributes']=_0x3216bf[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x3216bf['attributes']:_0x4d0932[_0xbbb3('0x32')];if(!_0x1f72b0[_0xbbb3('0x34')]['hasOwnProperty'](_0xbbb3('0x3a'))){_0x3216bf[_0xbbb3('0x1e')]=qs[_0xbbb3('0x1e')](_0x1f72b0[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x3216bf[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0x1f72b0[_0xbbb3('0x34')]['offset']);}_0x3216bf['order']=qs['sort'](_0x1f72b0['query'][_0xbbb3('0x3b')]);_0x3216bf[_0xbbb3('0x3c')]=qs['filters'](_['pick'](_0x1f72b0[_0xbbb3('0x34')],_0x4d0932[_0xbbb3('0x35')]));_0x3216bf[_0xbbb3('0x3c')][_0xbbb3('0x5b')]=_0x1e9ef2['id'];if(_0x1f72b0[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x3216bf[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x3216bf['where'],{'$or':_[_0xbbb3('0x33')](_0x3216bf[_0xbbb3('0x38')],function(_0x3e82b9){var _0x13d882={};_0x13d882[_0x3e82b9]={'$like':'%'+_0x1f72b0['query']['filter']+'%'};return _0x13d882;})});}_0x3216bf=_['merge']({},_0x3216bf,_0x1f72b0[_0xbbb3('0x47')]);return db[_0xbbb3('0x61')][_0xbbb3('0x1c')]({'where':_0x3216bf[_0xbbb3('0x3c')]})['then'](function(_0x22d688){_0x15a56b['count']=_0x22d688;if(_0x1f72b0[_0xbbb3('0x34')]['includeAll']){_0x3216bf['include']=[{'all':!![]}];}return db[_0xbbb3('0x61')][_0xbbb3('0x5d')](_0x3216bf);})[_0xbbb3('0x26')](function(_0x17df42){_0x15a56b[_0xbbb3('0x42')]=_0x17df42;return _0x15a56b;});}})['then'](respondWithFilteredResult(_0x55b954,_0x3216bf))['catch'](handleError(_0x55b954,null));};exports[_0xbbb3('0x62')]=function(_0x52f2f2,_0x41fd52,_0x545837){var _0x1c27dc={};var _0x375ed1={};var _0x6a9969;var _0x2df628;return db[_0xbbb3('0x40')]['findOne']({'where':{'id':_0x52f2f2[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x41fd52,null))[_0xbbb3('0x26')](function(_0x791420){if(_0x791420){_0x6a9969=_0x791420;_0x375ed1[_0xbbb3('0x32')]=_['keys'](db['CmList'][_0xbbb3('0x2f')]);_0x375ed1[_0xbbb3('0x34')]=_[_0xbbb3('0x45')](_0x52f2f2['query']);_0x375ed1[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x375ed1['model'],_0x375ed1[_0xbbb3('0x34')]);_0x1c27dc[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x375ed1['model'],qs['fields'](_0x52f2f2[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x1c27dc[_0xbbb3('0x38')]=_0x1c27dc[_0xbbb3('0x38')]['length']?_0x1c27dc['attributes']:_0x375ed1[_0xbbb3('0x32')];_0x1c27dc[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0x52f2f2[_0xbbb3('0x34')]['sort']);_0x1c27dc['where']=qs[_0xbbb3('0x35')](_['pick'](_0x52f2f2[_0xbbb3('0x34')],_0x375ed1[_0xbbb3('0x35')]));if(_0x52f2f2[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x1c27dc[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x1c27dc[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x1c27dc[_0xbbb3('0x38')],function(_0x104905){var _0x113a80={};_0x113a80[_0x104905]={'$like':'%'+_0x52f2f2[_0xbbb3('0x34')]['filter']+'%'};return _0x113a80;})});}_0x1c27dc=_[_0xbbb3('0x3f')]({},_0x1c27dc,_0x52f2f2[_0xbbb3('0x47')]);return _0x6a9969[_0xbbb3('0x62')](_0x1c27dc);}})[_0xbbb3('0x26')](function(_0x2e1e51){if(_0x2e1e51){_0x2df628=_0x2e1e51[_0xbbb3('0x39')];if(!_0x52f2f2[_0xbbb3('0x34')][_0xbbb3('0x59')](_0xbbb3('0x3a'))){_0x1c27dc[_0xbbb3('0x1e')]=qs['limit'](_0x52f2f2[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0x1c27dc[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0x52f2f2[_0xbbb3('0x34')]['offset']);}return _0x6a9969[_0xbbb3('0x62')](_0x1c27dc);}})['then'](function(_0x1fd9e6){if(_0x1fd9e6){return _0x1fd9e6?{'count':_0x2df628,'rows':_0x1fd9e6}:null;}})[_0xbbb3('0x26')](respondWithResult(_0x41fd52,null))[_0xbbb3('0x43')](handleError(_0x41fd52,null));};exports[_0xbbb3('0x63')]=function(_0x585229,_0xe51c45,_0x474943){var _0x4abd1d,_0x2ab8f0;return db[_0xbbb3('0x40')]['find']({'where':{'id':_0x585229['params']['id']}})['then'](handleEntityNotFound(_0xe51c45,null))[_0xbbb3('0x26')](function(_0x271c30){if(_0x271c30){_0x2ab8f0=_0x271c30;return _0x271c30[_0xbbb3('0x63')](_0x585229[_0xbbb3('0x4a')][_0xbbb3('0x64')],_[_0xbbb3('0x53')](_0x585229[_0xbbb3('0x4a')],[_0xbbb3('0x64'),'id'])||{});}return null;})[_0xbbb3('0x65')](function(_0x4863ff){var _0x54ef3d;_0x4abd1d=_0x4863ff||[];var _0x59139f=[];if(_0x4863ff){for(var _0x310494=0x0;_0x310494<_0x4863ff['length'];_0x310494+=0x1){var _0x1015a9=_0x4863ff[_0x310494]['get']({'plain':!![]});_0x2ab8f0['dialCheckDuplicateType']=_0x585229[_0xbbb3('0x4a')][_0xbbb3('0x66')]?_0x585229[_0xbbb3('0x4a')][_0xbbb3('0x66')]:_0x2ab8f0[_0xbbb3('0x66')];switch(_0x2ab8f0[_0xbbb3('0x66')]){case _0xbbb3('0x67'):_0x54ef3d=squel[_0xbbb3('0x68')]()['into'](_0xbbb3('0x69'))[_0xbbb3('0x6a')]([_0xbbb3('0x6b'),_0xbbb3('0x6c'),'ContactId',_0xbbb3('0x6d'),'CampaignId',_0xbbb3('0x54'),'updatedAt'],squel[_0xbbb3('0x6e')]()['field']('phone','phone')[_0xbbb3('0x6f')](_0xbbb3('0x70'),'scheduledAt')[_0xbbb3('0x6f')]('id',_0xbbb3('0x71'))[_0xbbb3('0x6f')](_0x1015a9['CmListId'][_0xbbb3('0x72')](),_0xbbb3('0x6d'))[_0xbbb3('0x6f')](_0x585229['params']['id'][_0xbbb3('0x72')](),_0xbbb3('0x5b'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x54'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x55'))[_0xbbb3('0x73')](_0xbbb3('0x74'))['where'](_0xbbb3('0x75'))['where'](_0xbbb3('0x76'),_0x1015a9[_0xbbb3('0x77')][_0xbbb3('0x72')]())[_0xbbb3('0x3c')](_0xbbb3('0x78'))['where'](_0xbbb3('0x79'),squel[_0xbbb3('0x6e')]()[_0xbbb3('0x6f')](_0xbbb3('0x7a'))[_0xbbb3('0x73')](_0xbbb3('0x7b'))[_0xbbb3('0x3c')](_0xbbb3('0x7c'),_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')]()))['where'](_0xbbb3('0x79'),squel['select']()[_0xbbb3('0x6f')](_0xbbb3('0x7d'))['from'](_0xbbb3('0x69'))[_0xbbb3('0x3c')](_0xbbb3('0x7c'),_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')]())))['toString']();break;case _0xbbb3('0x7e'):_0x54ef3d=squel[_0xbbb3('0x68')]()[_0xbbb3('0x7f')]('cm_hopper')[_0xbbb3('0x6a')]([_0xbbb3('0x6b'),'scheduledAt','ContactId',_0xbbb3('0x6d'),_0xbbb3('0x5b'),_0xbbb3('0x54'),_0xbbb3('0x55')],squel[_0xbbb3('0x6e')]()[_0xbbb3('0x6f')](_0xbbb3('0x6b'),_0xbbb3('0x6b'))[_0xbbb3('0x6f')]('NOW()',_0xbbb3('0x6c'))['field']('id',_0xbbb3('0x71'))[_0xbbb3('0x6f')](_0x1015a9[_0xbbb3('0x77')][_0xbbb3('0x72')](),_0xbbb3('0x6d'))[_0xbbb3('0x6f')](_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')](),'CampaignId')[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x54'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x55'))[_0xbbb3('0x73')]('cm_contacts')[_0xbbb3('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0xbbb3('0x76'),_0x1015a9['CmListId'][_0xbbb3('0x72')]())[_0xbbb3('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0xbbb3('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbbb3('0x6e')]()['field'](_0xbbb3('0x7d'))[_0xbbb3('0x73')](_0xbbb3('0x69'))[_0xbbb3('0x3c')](_0xbbb3('0x7c'),_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')]())))[_0xbbb3('0x72')]();break;default:_0x54ef3d=squel[_0xbbb3('0x68')]()['into'](_0xbbb3('0x69'))[_0xbbb3('0x6a')]([_0xbbb3('0x6b'),_0xbbb3('0x6c'),'ContactId',_0xbbb3('0x6d'),'CampaignId','createdAt','updatedAt'],squel['select']()[_0xbbb3('0x6f')](_0xbbb3('0x6b'),'phone')[_0xbbb3('0x6f')]('NOW()',_0xbbb3('0x6c'))[_0xbbb3('0x6f')]('id',_0xbbb3('0x71'))[_0xbbb3('0x6f')](_0x1015a9[_0xbbb3('0x77')][_0xbbb3('0x72')](),_0xbbb3('0x6d'))['field'](_0x585229[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')](),_0xbbb3('0x5b'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x54'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),_0xbbb3('0x55'))[_0xbbb3('0x73')](_0xbbb3('0x74'))['where'](_0xbbb3('0x75'))[_0xbbb3('0x3c')](_0xbbb3('0x76'),_0x1015a9[_0xbbb3('0x77')][_0xbbb3('0x72')]())['where'](_0xbbb3('0x78')))['toString']();}_0x59139f[_0xbbb3('0x80')](db[_0xbbb3('0x81')][_0xbbb3('0x34')](_0x54ef3d));}return BPromise[_0xbbb3('0x82')](_0x59139f);}})['then'](function(){return _0x4abd1d;})[_0xbbb3('0x26')](respondWithResult(_0xe51c45,null))[_0xbbb3('0x43')](handleError(_0xe51c45,null));};exports[_0xbbb3('0x83')]=function(_0x425070,_0x156a57,_0x133380){return db[_0xbbb3('0x40')][_0xbbb3('0x48')]({'where':{'id':_0x425070[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x156a57,null))[_0xbbb3('0x26')](function(_0x42df80){if(_0x42df80){return _0x42df80[_0xbbb3('0x83')](_0x425070[_0xbbb3('0x34')]['ids']);}})[_0xbbb3('0x26')](function(_0x3a61be){if(_0x3a61be){return db['CmHopper'][_0xbbb3('0x25')]({'where':{'ListId':_0x425070[_0xbbb3('0x34')][_0xbbb3('0x64')],'CampaignId':_0x425070[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](function(){return _0x3a61be;});}})[_0xbbb3('0x26')](respondWithStatusCode(_0x156a57,null))[_0xbbb3('0x43')](handleError(_0x156a57,null));};exports[_0xbbb3('0x84')]=function(_0xa1e36c,_0x454b7f,_0x4f6e38){var _0x91a36a={'raw':!![],'where':{}};var _0x3b5854={};var _0x9a4370={'count':0x0,'rows':[]};return db[_0xbbb3('0x40')][_0xbbb3('0x58')]({'where':{'id':_0xa1e36c['params']['id']}})['then'](handleEntityNotFound(_0x454b7f,null))[_0xbbb3('0x26')](function(_0x327d3b){if(_0x327d3b){_0x3b5854[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db[_0xbbb3('0x85')][_0xbbb3('0x2f')]);_0x3b5854['query']=_[_0xbbb3('0x45')](_0xa1e36c['query']);_0x3b5854['filters']=_[_0xbbb3('0x36')](_0x3b5854['model'],_0x3b5854[_0xbbb3('0x34')]);_0x91a36a[_0xbbb3('0x38')]=_['intersection'](_0x3b5854[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0xa1e36c[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x91a36a[_0xbbb3('0x38')]=_0x91a36a['attributes']['length']?_0x91a36a[_0xbbb3('0x38')]:_0x3b5854[_0xbbb3('0x32')];if(!_0xa1e36c[_0xbbb3('0x34')][_0xbbb3('0x59')]('nolimit')){_0x91a36a[_0xbbb3('0x1e')]=qs[_0xbbb3('0x1e')](_0xa1e36c['query']['limit']);_0x91a36a[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0xa1e36c['query'][_0xbbb3('0x1d')]);}_0x91a36a[_0xbbb3('0x5a')]=qs[_0xbbb3('0x3b')](_0xa1e36c[_0xbbb3('0x34')][_0xbbb3('0x3b')]);_0x91a36a[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0xa1e36c[_0xbbb3('0x34')],_0x3b5854[_0xbbb3('0x35')]));_0x91a36a[_0xbbb3('0x3c')][_0xbbb3('0x5b')]=_0x327d3b['id'];if(_0xa1e36c[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x91a36a[_0xbbb3('0x3c')]=_['merge'](_0x91a36a[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x91a36a[_0xbbb3('0x38')],function(_0x4b34fc){var _0x37e3ac={};_0x37e3ac[_0x4b34fc]={'$like':'%'+_0xa1e36c['query'][_0xbbb3('0x3e')]+'%'};return _0x37e3ac;})});}_0x91a36a=_['merge']({},_0x91a36a,_0xa1e36c[_0xbbb3('0x47')]);return db['CmList'][_0xbbb3('0x1c')]({'where':_0x91a36a[_0xbbb3('0x3c')]})['then'](function(_0x1b6920){_0x9a4370[_0xbbb3('0x1c')]=_0x1b6920;if(_0xa1e36c[_0xbbb3('0x34')]['includeAll']){_0x91a36a[_0xbbb3('0x41')]=[{'all':!![]}];}return db[_0xbbb3('0x85')]['findAll'](_0x91a36a);})[_0xbbb3('0x26')](function(_0x14f6b5){_0x9a4370[_0xbbb3('0x42')]=_0x14f6b5;return _0x9a4370;});}})[_0xbbb3('0x26')](respondWithFilteredResult(_0x454b7f,_0x91a36a))[_0xbbb3('0x43')](handleError(_0x454b7f,null));};exports[_0xbbb3('0x86')]=function(_0x32b8db,_0x115807,_0x26b4a9){var _0x205370,_0x10c524;return db['Campaign'][_0xbbb3('0x48')]({'where':{'id':_0x32b8db['params']['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x115807,null))['then'](function(_0x5a10a5){if(_0x5a10a5){_0x10c524=_0x5a10a5;return _0x5a10a5[_0xbbb3('0x86')](_0x32b8db[_0xbbb3('0x4a')]['ids'],_[_0xbbb3('0x53')](_0x32b8db[_0xbbb3('0x4a')],['ids','id'])||{});}return null;})[_0xbbb3('0x65')](function(_0x26c0e2){var _0x2a14b8;_0x205370=_0x26c0e2||[];var _0x28be3b=[];if(_0x26c0e2){for(var _0x36e5e8=0x0;_0x36e5e8<_0x26c0e2['length'];_0x36e5e8+=0x1){var _0x6d1626=_0x26c0e2[_0x36e5e8][_0xbbb3('0x27')]({'plain':!![]});_0x2a14b8=squel[_0xbbb3('0x68')]()[_0xbbb3('0x7f')]('cm_hopper_black')[_0xbbb3('0x6a')]([_0xbbb3('0x6b'),_0xbbb3('0x71'),'ListId',_0xbbb3('0x5b'),'createdAt','updatedAt'],squel[_0xbbb3('0x6e')]()[_0xbbb3('0x6f')](_0xbbb3('0x6b'),_0xbbb3('0x6b'))[_0xbbb3('0x6f')]('id',_0xbbb3('0x71'))[_0xbbb3('0x6f')](_0x6d1626[_0xbbb3('0x77')][_0xbbb3('0x72')](),_0xbbb3('0x6d'))[_0xbbb3('0x6f')](_0x32b8db[_0xbbb3('0x52')]['id'][_0xbbb3('0x72')](),_0xbbb3('0x5b'))['field']('NOW()',_0xbbb3('0x54'))[_0xbbb3('0x6f')](_0xbbb3('0x70'),'updatedAt')[_0xbbb3('0x73')]('cm_contacts')[_0xbbb3('0x3c')](_0xbbb3('0x75'))['where'](_0xbbb3('0x76'),_0x6d1626[_0xbbb3('0x77')][_0xbbb3('0x72')]())[_0xbbb3('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0xbbb3('0x72')]();_0x28be3b[_0xbbb3('0x80')](db[_0xbbb3('0x81')][_0xbbb3('0x34')](_0x2a14b8));}return BPromise[_0xbbb3('0x82')](_0x28be3b);}})[_0xbbb3('0x26')](function(){return _0x205370;})[_0xbbb3('0x26')](respondWithResult(_0x115807,null))[_0xbbb3('0x43')](handleError(_0x115807,null));};exports['removeBlackLists']=function(_0x50f614,_0x2a6d4f,_0x33fa68){return db['Campaign'][_0xbbb3('0x48')]({'where':{'id':_0x50f614[_0xbbb3('0x52')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x2a6d4f,null))[_0xbbb3('0x26')](function(_0x31ad6b){if(_0x31ad6b){return _0x31ad6b[_0xbbb3('0x87')](_0x50f614[_0xbbb3('0x34')][_0xbbb3('0x64')]);}})[_0xbbb3('0x26')](function(_0x355dcc){if(_0x355dcc){return db[_0xbbb3('0x61')]['destroy']({'where':{'ListId':_0x50f614[_0xbbb3('0x34')][_0xbbb3('0x64')],'CampaignId':_0x50f614['params']['id']}})[_0xbbb3('0x26')](function(){return _0x355dcc;});}})[_0xbbb3('0x26')](respondWithStatusCode(_0x2a6d4f,null))[_0xbbb3('0x43')](handleError(_0x2a6d4f,null));}; \ No newline at end of file +var _0x4139=['CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','push','sequelize','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','Campaign','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','CmHopper','CampaignId','CmHopperHistory','hasOwnProperty','findAll','getHopperFinals','findOne','CmHopperFinal'];(function(_0x54783c,_0x4e00e0){var _0x261a7c=function(_0x2ab459){while(--_0x2ab459){_0x54783c['push'](_0x54783c['shift']());}};_0x261a7c(++_0x4e00e0);}(_0x4139,0x136));var _0x9413=function(_0x151b07,_0x1b08be){_0x151b07=_0x151b07-0x0;var _0x42cf52=_0x4139[_0x151b07];return _0x42cf52;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9413('0x0'));var rimraf=require(_0x9413('0x1'));var zipdir=require(_0x9413('0x2'));var jsonpatch=require(_0x9413('0x3'));var rp=require(_0x9413('0x4'));var moment=require(_0x9413('0x5'));var BPromise=require(_0x9413('0x6'));var Mustache=require(_0x9413('0x7'));var util=require(_0x9413('0x8'));var path=require(_0x9413('0x9'));var sox=require('sox');var csv=require(_0x9413('0xa'));var ejs=require(_0x9413('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9413('0xc'));var crypto=require(_0x9413('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9413('0xa'));var querystring=require(_0x9413('0xe'));var Papa=require('papaparse');var Redis=require(_0x9413('0xf'));var authService=require(_0x9413('0x10'));var qs=require(_0x9413('0x11'));var as=require(_0x9413('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9413('0x13'))(_0x9413('0x14'));var utils=require(_0x9413('0x15'));var config=require(_0x9413('0x16'));var db=require(_0x9413('0x17'))['db'];function respondWithStatusCode(_0x54bc26,_0x47e138){_0x47e138=_0x47e138||0xcc;return function(_0x5b2884){if(_0x5b2884){return _0x54bc26[_0x9413('0x18')](_0x47e138);}return _0x54bc26[_0x9413('0x19')](_0x47e138)['end']();};}function respondWithResult(_0x287007,_0x5b2f22){_0x5b2f22=_0x5b2f22||0xc8;return function(_0x46fff3){if(_0x46fff3){return _0x287007['status'](_0x5b2f22)[_0x9413('0x1a')](_0x46fff3);}};}function respondWithFilteredResult(_0x46cbec,_0xec783a){return function(_0x490d5e){if(_0x490d5e){var _0x48007b=_0x490d5e['count'],_0x553f7a=_0xec783a['offset'],_0x1846a1=_0xec783a[_0x9413('0x1b')]+_0xec783a['limit'],_0xdf6717;if(_0x1846a1>=_0x48007b){_0x1846a1=_0x48007b;_0xdf6717=0xc8;}else{_0xdf6717=0xce;}_0x46cbec['status'](_0xdf6717);return _0x46cbec[_0x9413('0x1c')](_0x9413('0x1d'),_0x553f7a+'-'+_0x1846a1+'/'+_0x48007b)[_0x9413('0x1a')](_0x490d5e);}return null;};}function patchUpdates(_0x1d8c30){return function(_0x2c8645){try{jsonpatch[_0x9413('0x1e')](_0x2c8645,_0x1d8c30,!![]);}catch(_0x5af836){return BPromise[_0x9413('0x1f')](_0x5af836);}return _0x2c8645[_0x9413('0x20')]();};}function saveUpdates(_0x220678,_0x27f96f){return function(_0x12cf0e){if(_0x12cf0e){return _0x12cf0e[_0x9413('0x21')](_0x220678)['then'](function(_0x4c0288){return _0x4c0288;});}return null;};}function removeEntity(_0x5a16d4,_0xac8643){return function(_0x606401){if(_0x606401){return _0x606401[_0x9413('0x22')]()[_0x9413('0x23')](function(){var _0xb6aa2c=_0x606401['get']({'plain':!![]});var _0x4901c7=_0x9413('0x24');return db[_0x9413('0x25')][_0x9413('0x22')]({'where':{'type':_0x4901c7,'resourceId':_0xb6aa2c['id']}})[_0x9413('0x23')](function(){return _0x606401;});})[_0x9413('0x23')](function(){_0x5a16d4['status'](0xcc)[_0x9413('0x26')]();});}};}function handleEntityNotFound(_0x2dae2b,_0x57c296){return function(_0xe468cf){if(!_0xe468cf){_0x2dae2b[_0x9413('0x18')](0x194);}return _0xe468cf;};}function handleError(_0x26a84a,_0x43759a){_0x43759a=_0x43759a||0x1f4;return function(_0x5a6b4c){logger[_0x9413('0x27')](_0x5a6b4c['stack']);if(_0x5a6b4c[_0x9413('0x28')]){delete _0x5a6b4c[_0x9413('0x28')];}_0x26a84a[_0x9413('0x19')](_0x43759a)[_0x9413('0x29')](_0x5a6b4c);};}exports[_0x9413('0x2a')]=function(_0x56659e,_0x464d5f){var _0x13a8a6={},_0x413c91={},_0x241b9b={'count':0x0,'rows':[]};var _0xbb5384=_[_0x9413('0x2b')](db['Campaign'][_0x9413('0x2c')],function(_0x18443b){return{'name':_0x18443b[_0x9413('0x2d')],'type':_0x18443b[_0x9413('0x2e')][_0x9413('0x2f')]};});_0x413c91['model']=_[_0x9413('0x2b')](_0xbb5384,_0x9413('0x28'));_0x413c91[_0x9413('0x30')]=_[_0x9413('0x31')](_0x56659e[_0x9413('0x30')]);_0x413c91[_0x9413('0x32')]=_[_0x9413('0x33')](_0x413c91[_0x9413('0x34')],_0x413c91[_0x9413('0x30')]);_0x13a8a6['attributes']=_[_0x9413('0x33')](_0x413c91[_0x9413('0x34')],qs[_0x9413('0x35')](_0x56659e[_0x9413('0x30')][_0x9413('0x35')]));_0x13a8a6[_0x9413('0x36')]=_0x13a8a6[_0x9413('0x36')][_0x9413('0x37')]?_0x13a8a6[_0x9413('0x36')]:_0x413c91[_0x9413('0x34')];if(!_0x56659e['query']['hasOwnProperty'](_0x9413('0x38'))){_0x13a8a6[_0x9413('0x39')]=qs[_0x9413('0x39')](_0x56659e[_0x9413('0x30')]['limit']);_0x13a8a6[_0x9413('0x1b')]=qs[_0x9413('0x1b')](_0x56659e[_0x9413('0x30')][_0x9413('0x1b')]);}_0x13a8a6[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x56659e[_0x9413('0x30')]['sort']);_0x13a8a6[_0x9413('0x3c')]=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x56659e[_0x9413('0x30')],_0x413c91[_0x9413('0x32')]),_0xbb5384);if(_0x56659e[_0x9413('0x30')][_0x9413('0x3e')]){_0x13a8a6[_0x9413('0x3c')]=_[_0x9413('0x3f')](_0x13a8a6[_0x9413('0x3c')],{'$or':_['map'](_0xbb5384,function(_0x31b5bd){if(_0x31b5bd[_0x9413('0x2e')]!==_0x9413('0x40')){var _0x18509d={};_0x18509d[_0x31b5bd[_0x9413('0x28')]]={'$like':'%'+_0x56659e[_0x9413('0x30')][_0x9413('0x3e')]+'%'};return _0x18509d;}})});}_0x13a8a6=_[_0x9413('0x3f')]({},_0x13a8a6,_0x56659e[_0x9413('0x41')]);var _0x556a26={'where':_0x13a8a6[_0x9413('0x3c')]};return db['Campaign'][_0x9413('0x42')](_0x556a26)[_0x9413('0x23')](function(_0x589065){_0x241b9b[_0x9413('0x42')]=_0x589065;if(_0x56659e[_0x9413('0x30')]['includeAll']){_0x13a8a6['include']=[{'all':!![]}];}return db[_0x9413('0x43')]['findAll'](_0x13a8a6);})[_0x9413('0x23')](function(_0x7a335c){_0x241b9b[_0x9413('0x44')]=_0x7a335c;return _0x241b9b;})['then'](respondWithFilteredResult(_0x464d5f,_0x13a8a6))[_0x9413('0x45')](handleError(_0x464d5f,null));};exports[_0x9413('0x46')]=function(_0x198f87,_0x410742){var _0x3bcc4b={'raw':![],'where':{'id':_0x198f87[_0x9413('0x47')]['id']}},_0x5909d3={};_0x5909d3[_0x9413('0x34')]=_['keys'](db[_0x9413('0x43')][_0x9413('0x2c')]);_0x5909d3[_0x9413('0x30')]=_[_0x9413('0x31')](_0x198f87[_0x9413('0x30')]);_0x5909d3[_0x9413('0x32')]=_[_0x9413('0x33')](_0x5909d3['model'],_0x5909d3[_0x9413('0x30')]);_0x3bcc4b[_0x9413('0x36')]=_[_0x9413('0x33')](_0x5909d3[_0x9413('0x34')],qs[_0x9413('0x35')](_0x198f87[_0x9413('0x30')][_0x9413('0x35')]));_0x3bcc4b['attributes']=_0x3bcc4b[_0x9413('0x36')][_0x9413('0x37')]?_0x3bcc4b[_0x9413('0x36')]:_0x5909d3[_0x9413('0x34')];if(_0x198f87['query'][_0x9413('0x48')]){_0x3bcc4b[_0x9413('0x49')]=[{'all':!![]}];}_0x3bcc4b=_[_0x9413('0x3f')]({},_0x3bcc4b,_0x198f87[_0x9413('0x41')]);return db[_0x9413('0x43')][_0x9413('0x4a')](_0x3bcc4b)['then'](handleEntityNotFound(_0x410742,null))[_0x9413('0x23')](respondWithResult(_0x410742,null))[_0x9413('0x45')](handleError(_0x410742,null));};exports['create']=function(_0x40cfba,_0x14ddda){return db['Campaign'][_0x9413('0x4b')](_0x40cfba[_0x9413('0x4c')],{})['then'](function(_0x1d1dcc){var _0x204a9a=_0x40cfba[_0x9413('0x4d')][_0x9413('0x4e')]({'plain':!![]});if(!_0x204a9a)throw new Error(_0x9413('0x4f'));if(_0x204a9a[_0x9413('0x50')]==='user'){var _0x4199a7=_0x1d1dcc['get']({'plain':!![]});var _0x1f8344=_0x9413('0x24');return db[_0x9413('0x51')][_0x9413('0x4a')]({'where':{'name':_0x1f8344,'userProfileId':_0x204a9a[_0x9413('0x52')]},'raw':!![]})[_0x9413('0x23')](function(_0x3a7564){if(_0x3a7564&&_0x3a7564[_0x9413('0x53')]===0x0){return db[_0x9413('0x25')][_0x9413('0x4b')]({'name':_0x4199a7[_0x9413('0x28')],'resourceId':_0x4199a7['id'],'type':_0x3a7564[_0x9413('0x28')],'sectionId':_0x3a7564['id']},{})[_0x9413('0x23')](function(){return _0x1d1dcc;});}else{return _0x1d1dcc;}})[_0x9413('0x45')](function(_0x438aec){logger['error'](_0x9413('0x54'),_0x438aec);throw _0x438aec;});}return _0x1d1dcc;})[_0x9413('0x23')](respondWithResult(_0x14ddda,0xc9))[_0x9413('0x45')](handleError(_0x14ddda,null));};exports[_0x9413('0x55')]=function(_0x316f6d,_0x2857d6){var _0x39b41f={'where':{'id':_0x316f6d[_0x9413('0x47')]['id']}},_0x3f040d={};_0x3f040d[_0x9413('0x34')]=_['keys'](db[_0x9413('0x43')][_0x9413('0x2c')]);_0x39b41f[_0x9413('0x36')]=_['intersection'](_0x3f040d[_0x9413('0x34')],qs[_0x9413('0x35')](_0x316f6d[_0x9413('0x30')][_0x9413('0x35')]));_0x39b41f[_0x9413('0x36')]=_0x39b41f['attributes']['length']?_0x39b41f[_0x9413('0x36')]:_0x3f040d['model'];if(_0x316f6d[_0x9413('0x30')][_0x9413('0x48')]){_0x39b41f[_0x9413('0x49')]=[{'all':!![]}];}_0x39b41f=_[_0x9413('0x3f')]({},_0x39b41f,_0x316f6d[_0x9413('0x41')]);return db[_0x9413('0x43')][_0x9413('0x4a')](_0x39b41f)[_0x9413('0x23')](handleEntityNotFound(_0x2857d6,null))[_0x9413('0x23')](function(_0x390643){if(_0x390643){var _0x5d4480=_0x390643[_0x9413('0x4e')]({'plain':!![]});_0x5d4480=qs[_0x9413('0x56')](_0x5d4480,['id',_0x9413('0x57'),_0x9413('0x58')]);_0x316f6d[_0x9413('0x4c')]=_[_0x9413('0x56')](_0x316f6d[_0x9413('0x4c')],['id',_0x9413('0x57'),'updatedAt']);return db['Campaign'][_0x9413('0x4b')](_[_0x9413('0x3f')](_0x5d4480,_0x316f6d[_0x9413('0x4c')]),{'include':_0x316f6d[_0x9413('0x30')][_0x9413('0x48')]?[{'all':!![]}]:undefined})[_0x9413('0x23')](function(_0x25094e){var _0x47986f=_0x316f6d[_0x9413('0x4d')][_0x9413('0x4e')]({'plain':!![]});if(!_0x47986f)throw new Error(_0x9413('0x4f'));if(_0x47986f[_0x9413('0x50')]===_0x9413('0x4d')){var _0xd4d08d=_0x25094e[_0x9413('0x4e')]({'plain':!![]});var _0x40b6d9=_0x9413('0x24');return db[_0x9413('0x51')][_0x9413('0x4a')]({'where':{'name':_0x40b6d9,'userProfileId':_0x47986f[_0x9413('0x52')]},'raw':!![]})[_0x9413('0x23')](function(_0x26a062){if(_0x26a062&&_0x26a062[_0x9413('0x53')]===0x0){return db['UserProfileResource'][_0x9413('0x4b')]({'name':_0xd4d08d[_0x9413('0x28')],'resourceId':_0xd4d08d['id'],'type':_0x26a062[_0x9413('0x28')],'sectionId':_0x26a062['id']},{})['then'](function(){return _0x25094e;});}else{return _0x25094e;}})[_0x9413('0x45')](function(_0x2acf52){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2acf52);throw _0x2acf52;});}return _0x25094e;});}})[_0x9413('0x23')](respondWithResult(_0x2857d6,0xc9))['catch'](handleError(_0x2857d6,null));};exports[_0x9413('0x21')]=function(_0x213171,_0x1aeed5){if(_0x213171['body']['id']){delete _0x213171[_0x9413('0x4c')]['id'];}return db[_0x9413('0x43')]['find']({'where':{'id':_0x213171[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x1aeed5,null))[_0x9413('0x23')](saveUpdates(_0x213171[_0x9413('0x4c')],null))[_0x9413('0x23')](respondWithResult(_0x1aeed5,null))[_0x9413('0x45')](handleError(_0x1aeed5,null));};exports['destroy']=function(_0x2f9f26,_0x3b7575){return db[_0x9413('0x43')][_0x9413('0x4a')]({'where':{'id':_0x2f9f26[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x3b7575,null))['then'](removeEntity(_0x3b7575,null))[_0x9413('0x45')](handleError(_0x3b7575,null));};exports[_0x9413('0x59')]=function(_0x45b57d,_0x30d951,_0x87a989){var _0x59c994={'raw':!![],'where':{}};var _0x17cbff={};var _0xf5a708={'count':0x0,'rows':[]};return db[_0x9413('0x43')]['findOne']({'where':{'id':_0x45b57d['params']['id']}})['then'](handleEntityNotFound(_0x30d951,null))[_0x9413('0x23')](function(_0x58e60a){if(_0x58e60a){_0x17cbff['model']=_[_0x9413('0x31')](db[_0x9413('0x5a')][_0x9413('0x2c')]);_0x17cbff['query']=_[_0x9413('0x31')](_0x45b57d[_0x9413('0x30')]);_0x17cbff[_0x9413('0x32')]=_[_0x9413('0x33')](_0x17cbff[_0x9413('0x34')],_0x17cbff[_0x9413('0x30')]);_0x59c994['attributes']=_[_0x9413('0x33')](_0x17cbff['model'],qs['fields'](_0x45b57d[_0x9413('0x30')][_0x9413('0x35')]));_0x59c994[_0x9413('0x36')]=_0x59c994[_0x9413('0x36')][_0x9413('0x37')]?_0x59c994['attributes']:_0x17cbff['model'];if(!_0x45b57d[_0x9413('0x30')]['hasOwnProperty'](_0x9413('0x38'))){_0x59c994[_0x9413('0x39')]=qs[_0x9413('0x39')](_0x45b57d['query']['limit']);_0x59c994['offset']=qs[_0x9413('0x1b')](_0x45b57d[_0x9413('0x30')][_0x9413('0x1b')]);}_0x59c994[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x45b57d[_0x9413('0x30')]['sort']);_0x59c994[_0x9413('0x3c')]=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x45b57d[_0x9413('0x30')],_0x17cbff[_0x9413('0x32')]));_0x59c994[_0x9413('0x3c')][_0x9413('0x5b')]=_0x58e60a['id'];if(_0x45b57d[_0x9413('0x30')][_0x9413('0x3e')]){_0x59c994['where']=_[_0x9413('0x3f')](_0x59c994[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x59c994[_0x9413('0x36')],function(_0x29f428){var _0x2cb975={};_0x2cb975[_0x29f428]={'$like':'%'+_0x45b57d[_0x9413('0x30')]['filter']+'%'};return _0x2cb975;})});}_0x59c994=_[_0x9413('0x3f')]({},_0x59c994,_0x45b57d['options']);return db[_0x9413('0x5a')]['count']({'where':_0x59c994['where']})[_0x9413('0x23')](function(_0x528b81){_0xf5a708[_0x9413('0x42')]=_0x528b81;if(_0x45b57d[_0x9413('0x30')][_0x9413('0x48')]){_0x59c994['include']=[{'all':!![]}];}return db[_0x9413('0x5a')]['findAll'](_0x59c994);})[_0x9413('0x23')](function(_0x2b8b17){_0xf5a708[_0x9413('0x44')]=_0x2b8b17;return _0xf5a708;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x30d951,_0x59c994))[_0x9413('0x45')](handleError(_0x30d951,null));};exports['getHopperHistories']=function(_0x50b445,_0x2838f3,_0x175094){var _0x55a660={'raw':!![],'where':{}};var _0x23223c={};var _0x519956={'count':0x0,'rows':[]};return db[_0x9413('0x43')]['findOne']({'where':{'id':_0x50b445[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x2838f3,null))[_0x9413('0x23')](function(_0x1f33ff){if(_0x1f33ff){_0x23223c[_0x9413('0x34')]=_[_0x9413('0x31')](db[_0x9413('0x5c')][_0x9413('0x2c')]);_0x23223c[_0x9413('0x30')]=_[_0x9413('0x31')](_0x50b445[_0x9413('0x30')]);_0x23223c[_0x9413('0x32')]=_[_0x9413('0x33')](_0x23223c['model'],_0x23223c[_0x9413('0x30')]);_0x55a660['attributes']=_[_0x9413('0x33')](_0x23223c[_0x9413('0x34')],qs[_0x9413('0x35')](_0x50b445[_0x9413('0x30')]['fields']));_0x55a660[_0x9413('0x36')]=_0x55a660[_0x9413('0x36')][_0x9413('0x37')]?_0x55a660[_0x9413('0x36')]:_0x23223c['model'];if(!_0x50b445['query'][_0x9413('0x5d')](_0x9413('0x38'))){_0x55a660[_0x9413('0x39')]=qs['limit'](_0x50b445['query'][_0x9413('0x39')]);_0x55a660[_0x9413('0x1b')]=qs[_0x9413('0x1b')](_0x50b445[_0x9413('0x30')][_0x9413('0x1b')]);}_0x55a660['order']=qs[_0x9413('0x3b')](_0x50b445[_0x9413('0x30')]['sort']);_0x55a660['where']=qs['filters'](_[_0x9413('0x3d')](_0x50b445[_0x9413('0x30')],_0x23223c[_0x9413('0x32')]));_0x55a660[_0x9413('0x3c')][_0x9413('0x5b')]=_0x1f33ff['id'];if(_0x50b445[_0x9413('0x30')]['filter']){_0x55a660[_0x9413('0x3c')]=_['merge'](_0x55a660[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x55a660[_0x9413('0x36')],function(_0x281e3a){var _0x323f37={};_0x323f37[_0x281e3a]={'$like':'%'+_0x50b445[_0x9413('0x30')]['filter']+'%'};return _0x323f37;})});}_0x55a660=_['merge']({},_0x55a660,_0x50b445['options']);return db[_0x9413('0x5c')][_0x9413('0x42')]({'where':_0x55a660[_0x9413('0x3c')]})[_0x9413('0x23')](function(_0x1d005f){_0x519956[_0x9413('0x42')]=_0x1d005f;if(_0x50b445[_0x9413('0x30')][_0x9413('0x48')]){_0x55a660[_0x9413('0x49')]=[{'all':!![]}];}return db[_0x9413('0x5c')][_0x9413('0x5e')](_0x55a660);})[_0x9413('0x23')](function(_0x34e532){_0x519956['rows']=_0x34e532;return _0x519956;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x2838f3,_0x55a660))[_0x9413('0x45')](handleError(_0x2838f3,null));};exports[_0x9413('0x5f')]=function(_0x25bba5,_0x580d41,_0x355a83){var _0x5cae3c={'raw':!![],'where':{}};var _0x34e69f={};var _0x291e8a={'count':0x0,'rows':[]};return db[_0x9413('0x43')][_0x9413('0x60')]({'where':{'id':_0x25bba5['params']['id']}})['then'](handleEntityNotFound(_0x580d41,null))[_0x9413('0x23')](function(_0x5e1064){if(_0x5e1064){_0x34e69f[_0x9413('0x34')]=_[_0x9413('0x31')](db[_0x9413('0x61')]['rawAttributes']);_0x34e69f['query']=_[_0x9413('0x31')](_0x25bba5[_0x9413('0x30')]);_0x34e69f[_0x9413('0x32')]=_['intersection'](_0x34e69f['model'],_0x34e69f[_0x9413('0x30')]);_0x5cae3c[_0x9413('0x36')]=_[_0x9413('0x33')](_0x34e69f[_0x9413('0x34')],qs[_0x9413('0x35')](_0x25bba5[_0x9413('0x30')]['fields']));_0x5cae3c['attributes']=_0x5cae3c[_0x9413('0x36')][_0x9413('0x37')]?_0x5cae3c[_0x9413('0x36')]:_0x34e69f[_0x9413('0x34')];if(!_0x25bba5[_0x9413('0x30')][_0x9413('0x5d')](_0x9413('0x38'))){_0x5cae3c[_0x9413('0x39')]=qs[_0x9413('0x39')](_0x25bba5[_0x9413('0x30')]['limit']);_0x5cae3c[_0x9413('0x1b')]=qs[_0x9413('0x1b')](_0x25bba5['query'][_0x9413('0x1b')]);}_0x5cae3c[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x25bba5[_0x9413('0x30')][_0x9413('0x3b')]);_0x5cae3c[_0x9413('0x3c')]=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x25bba5['query'],_0x34e69f[_0x9413('0x32')]));_0x5cae3c['where'][_0x9413('0x5b')]=_0x5e1064['id'];if(_0x25bba5[_0x9413('0x30')]['filter']){_0x5cae3c[_0x9413('0x3c')]=_[_0x9413('0x3f')](_0x5cae3c[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x5cae3c['attributes'],function(_0x5d830a){var _0x6d2f3b={};_0x6d2f3b[_0x5d830a]={'$like':'%'+_0x25bba5[_0x9413('0x30')]['filter']+'%'};return _0x6d2f3b;})});}_0x5cae3c=_[_0x9413('0x3f')]({},_0x5cae3c,_0x25bba5[_0x9413('0x41')]);return db[_0x9413('0x61')][_0x9413('0x42')]({'where':_0x5cae3c[_0x9413('0x3c')]})[_0x9413('0x23')](function(_0x5eaaf9){_0x291e8a['count']=_0x5eaaf9;if(_0x25bba5['query'][_0x9413('0x48')]){_0x5cae3c[_0x9413('0x49')]=[{'all':!![]}];}return db[_0x9413('0x61')]['findAll'](_0x5cae3c);})[_0x9413('0x23')](function(_0x278d9a){_0x291e8a[_0x9413('0x44')]=_0x278d9a;return _0x291e8a;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x580d41,_0x5cae3c))[_0x9413('0x45')](handleError(_0x580d41,null));};exports['getHopperBlacks']=function(_0x2ddfd8,_0x3ab125,_0x462bc9){var _0x11e121={'raw':!![],'where':{}};var _0x22ed09={};var _0x5500c2={'count':0x0,'rows':[]};return db['Campaign'][_0x9413('0x60')]({'where':{'id':_0x2ddfd8[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x3ab125,null))[_0x9413('0x23')](function(_0x3199b0){if(_0x3199b0){_0x22ed09[_0x9413('0x34')]=_[_0x9413('0x31')](db[_0x9413('0x62')][_0x9413('0x2c')]);_0x22ed09[_0x9413('0x30')]=_[_0x9413('0x31')](_0x2ddfd8[_0x9413('0x30')]);_0x22ed09[_0x9413('0x32')]=_[_0x9413('0x33')](_0x22ed09[_0x9413('0x34')],_0x22ed09[_0x9413('0x30')]);_0x11e121[_0x9413('0x36')]=_['intersection'](_0x22ed09[_0x9413('0x34')],qs[_0x9413('0x35')](_0x2ddfd8[_0x9413('0x30')]['fields']));_0x11e121[_0x9413('0x36')]=_0x11e121[_0x9413('0x36')][_0x9413('0x37')]?_0x11e121['attributes']:_0x22ed09[_0x9413('0x34')];if(!_0x2ddfd8[_0x9413('0x30')]['hasOwnProperty']('nolimit')){_0x11e121[_0x9413('0x39')]=qs['limit'](_0x2ddfd8[_0x9413('0x30')][_0x9413('0x39')]);_0x11e121['offset']=qs[_0x9413('0x1b')](_0x2ddfd8[_0x9413('0x30')][_0x9413('0x1b')]);}_0x11e121[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x2ddfd8['query'][_0x9413('0x3b')]);_0x11e121['where']=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x2ddfd8[_0x9413('0x30')],_0x22ed09[_0x9413('0x32')]));_0x11e121[_0x9413('0x3c')][_0x9413('0x5b')]=_0x3199b0['id'];if(_0x2ddfd8[_0x9413('0x30')][_0x9413('0x3e')]){_0x11e121['where']=_['merge'](_0x11e121[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x11e121[_0x9413('0x36')],function(_0x4fd7e6){var _0x29627e={};_0x29627e[_0x4fd7e6]={'$like':'%'+_0x2ddfd8['query'][_0x9413('0x3e')]+'%'};return _0x29627e;})});}_0x11e121=_[_0x9413('0x3f')]({},_0x11e121,_0x2ddfd8[_0x9413('0x41')]);return db[_0x9413('0x62')][_0x9413('0x42')]({'where':_0x11e121['where']})[_0x9413('0x23')](function(_0x21c68c){_0x5500c2[_0x9413('0x42')]=_0x21c68c;if(_0x2ddfd8['query']['includeAll']){_0x11e121[_0x9413('0x49')]=[{'all':!![]}];}return db[_0x9413('0x62')][_0x9413('0x5e')](_0x11e121);})[_0x9413('0x23')](function(_0x25a130){_0x5500c2['rows']=_0x25a130;return _0x5500c2;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x3ab125,_0x11e121))[_0x9413('0x45')](handleError(_0x3ab125,null));};exports[_0x9413('0x63')]=function(_0x23540f,_0x66162e,_0x4faf3b){var _0x22a02c={};var _0x393800={};var _0x2a1702;var _0x1e5463;return db['Campaign'][_0x9413('0x60')]({'where':{'id':_0x23540f[_0x9413('0x47')]['id']}})['then'](handleEntityNotFound(_0x66162e,null))['then'](function(_0xab6295){if(_0xab6295){_0x2a1702=_0xab6295;_0x393800[_0x9413('0x34')]=_[_0x9413('0x31')](db['CmList'][_0x9413('0x2c')]);_0x393800[_0x9413('0x30')]=_['keys'](_0x23540f[_0x9413('0x30')]);_0x393800['filters']=_[_0x9413('0x33')](_0x393800[_0x9413('0x34')],_0x393800[_0x9413('0x30')]);_0x22a02c[_0x9413('0x36')]=_['intersection'](_0x393800[_0x9413('0x34')],qs[_0x9413('0x35')](_0x23540f[_0x9413('0x30')][_0x9413('0x35')]));_0x22a02c[_0x9413('0x36')]=_0x22a02c[_0x9413('0x36')]['length']?_0x22a02c[_0x9413('0x36')]:_0x393800[_0x9413('0x34')];_0x22a02c[_0x9413('0x3a')]=qs[_0x9413('0x3b')](_0x23540f[_0x9413('0x30')][_0x9413('0x3b')]);_0x22a02c[_0x9413('0x3c')]=qs['filters'](_[_0x9413('0x3d')](_0x23540f[_0x9413('0x30')],_0x393800['filters']));if(_0x23540f['query'][_0x9413('0x3e')]){_0x22a02c['where']=_[_0x9413('0x3f')](_0x22a02c[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x22a02c[_0x9413('0x36')],function(_0x4d35e2){var _0x548f8c={};_0x548f8c[_0x4d35e2]={'$like':'%'+_0x23540f[_0x9413('0x30')][_0x9413('0x3e')]+'%'};return _0x548f8c;})});}_0x22a02c=_['merge']({},_0x22a02c,_0x23540f['options']);return _0x2a1702[_0x9413('0x63')](_0x22a02c);}})[_0x9413('0x23')](function(_0x594ca9){if(_0x594ca9){_0x1e5463=_0x594ca9[_0x9413('0x37')];if(!_0x23540f['query'][_0x9413('0x5d')](_0x9413('0x38'))){_0x22a02c['limit']=qs[_0x9413('0x39')](_0x23540f['query'][_0x9413('0x39')]);_0x22a02c[_0x9413('0x1b')]=qs['offset'](_0x23540f[_0x9413('0x30')][_0x9413('0x1b')]);}return _0x2a1702[_0x9413('0x63')](_0x22a02c);}})['then'](function(_0x5e6f43){if(_0x5e6f43){return _0x5e6f43?{'count':_0x1e5463,'rows':_0x5e6f43}:null;}})[_0x9413('0x23')](respondWithResult(_0x66162e,null))[_0x9413('0x45')](handleError(_0x66162e,null));};exports[_0x9413('0x64')]=function(_0x2aa33c,_0x25a442,_0x5d4b25){var _0x2ccde3,_0x21bdb4;return db[_0x9413('0x43')][_0x9413('0x4a')]({'where':{'id':_0x2aa33c['params']['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x25a442,null))[_0x9413('0x23')](function(_0x276bc8){if(_0x276bc8){_0x21bdb4=_0x276bc8;return _0x276bc8[_0x9413('0x64')](_0x2aa33c[_0x9413('0x4c')][_0x9413('0x65')],_[_0x9413('0x56')](_0x2aa33c[_0x9413('0x4c')],['ids','id'])||{});}return null;})[_0x9413('0x66')](function(_0x22c0b7){var _0x5ba131;_0x2ccde3=_0x22c0b7||[];var _0x5be357=[];if(_0x22c0b7){for(var _0x3e9772=0x0;_0x3e9772<_0x22c0b7[_0x9413('0x37')];_0x3e9772+=0x1){var _0x2d5b65=_0x22c0b7[_0x3e9772][_0x9413('0x4e')]({'plain':!![]});_0x21bdb4[_0x9413('0x67')]=_0x2aa33c[_0x9413('0x4c')][_0x9413('0x67')]?_0x2aa33c[_0x9413('0x4c')]['dialCheckDuplicateType']:_0x21bdb4[_0x9413('0x67')];switch(_0x21bdb4[_0x9413('0x67')]){case _0x9413('0x68'):_0x5ba131=squel[_0x9413('0x69')]()[_0x9413('0x6a')]('cm_hopper')[_0x9413('0x6b')]([_0x9413('0x6c'),_0x9413('0x6d'),_0x9413('0x6e'),_0x9413('0x6f'),_0x9413('0x5b'),_0x9413('0x57'),_0x9413('0x58')],squel['select']()[_0x9413('0x70')](_0x9413('0x6c'),_0x9413('0x6c'))[_0x9413('0x70')]('NOW()',_0x9413('0x6d'))[_0x9413('0x70')]('id',_0x9413('0x6e'))[_0x9413('0x70')](_0x2d5b65['CmListId']['toString'](),_0x9413('0x6f'))['field'](_0x2aa33c[_0x9413('0x47')]['id'][_0x9413('0x71')](),_0x9413('0x5b'))[_0x9413('0x70')](_0x9413('0x72'),'createdAt')[_0x9413('0x70')](_0x9413('0x72'),_0x9413('0x58'))[_0x9413('0x73')](_0x9413('0x74'))[_0x9413('0x3c')](_0x9413('0x75'))[_0x9413('0x3c')]('ListId\x20=\x20?',_0x2d5b65[_0x9413('0x76')][_0x9413('0x71')]())['where'](_0x9413('0x77'))[_0x9413('0x3c')](_0x9413('0x78'),squel[_0x9413('0x79')]()['field'](_0x9413('0x7a'))[_0x9413('0x73')](_0x9413('0x7b'))[_0x9413('0x3c')]('CampaignId\x20=\x20?',_0x2aa33c[_0x9413('0x47')]['id'][_0x9413('0x71')]()))[_0x9413('0x3c')](_0x9413('0x78'),squel[_0x9413('0x79')]()['field']('COALESCE(phone,\x27\x27)')[_0x9413('0x73')](_0x9413('0x7c'))['where'](_0x9413('0x7d'),_0x2aa33c['params']['id'][_0x9413('0x71')]())))['toString']();break;case _0x9413('0x7e'):_0x5ba131=squel[_0x9413('0x69')]()[_0x9413('0x6a')](_0x9413('0x7c'))[_0x9413('0x6b')](['phone','scheduledAt',_0x9413('0x6e'),_0x9413('0x6f'),_0x9413('0x5b'),_0x9413('0x57'),_0x9413('0x58')],squel[_0x9413('0x79')]()[_0x9413('0x70')](_0x9413('0x6c'),_0x9413('0x6c'))['field'](_0x9413('0x72'),_0x9413('0x6d'))[_0x9413('0x70')]('id',_0x9413('0x6e'))['field'](_0x2d5b65[_0x9413('0x76')]['toString'](),_0x9413('0x6f'))[_0x9413('0x70')](_0x2aa33c['params']['id'][_0x9413('0x71')](),_0x9413('0x5b'))[_0x9413('0x70')]('NOW()',_0x9413('0x57'))['field'](_0x9413('0x72'),'updatedAt')[_0x9413('0x73')]('cm_contacts')[_0x9413('0x3c')](_0x9413('0x75'))[_0x9413('0x3c')]('ListId\x20=\x20?',_0x2d5b65['CmListId'][_0x9413('0x71')]())[_0x9413('0x3c')](_0x9413('0x77'))[_0x9413('0x3c')](_0x9413('0x78'),squel[_0x9413('0x79')]()[_0x9413('0x70')](_0x9413('0x7f'))[_0x9413('0x73')](_0x9413('0x7c'))[_0x9413('0x3c')]('CampaignId\x20=\x20?',_0x2aa33c['params']['id'][_0x9413('0x71')]())))['toString']();break;default:_0x5ba131=squel[_0x9413('0x69')]()['into'](_0x9413('0x7c'))[_0x9413('0x6b')]([_0x9413('0x6c'),_0x9413('0x6d'),_0x9413('0x6e'),_0x9413('0x6f'),_0x9413('0x5b'),_0x9413('0x57'),'updatedAt'],squel[_0x9413('0x79')]()[_0x9413('0x70')](_0x9413('0x6c'),_0x9413('0x6c'))['field'](_0x9413('0x72'),'scheduledAt')[_0x9413('0x70')]('id',_0x9413('0x6e'))['field'](_0x2d5b65[_0x9413('0x76')][_0x9413('0x71')](),_0x9413('0x6f'))[_0x9413('0x70')](_0x2aa33c[_0x9413('0x47')]['id'][_0x9413('0x71')](),'CampaignId')['field']('NOW()',_0x9413('0x57'))[_0x9413('0x70')](_0x9413('0x72'),_0x9413('0x58'))['from'](_0x9413('0x74'))['where']('deletedAt\x20IS\x20NULL')[_0x9413('0x3c')](_0x9413('0x80'),_0x2d5b65[_0x9413('0x76')][_0x9413('0x71')]())[_0x9413('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x9413('0x71')]();}_0x5be357[_0x9413('0x81')](db[_0x9413('0x82')][_0x9413('0x30')](_0x5ba131));}return BPromise['all'](_0x5be357);}})[_0x9413('0x23')](function(){return _0x2ccde3;})[_0x9413('0x23')](respondWithResult(_0x25a442,null))[_0x9413('0x45')](handleError(_0x25a442,null));};exports[_0x9413('0x83')]=function(_0x16ae16,_0x4ab9cb,_0x5ab4d3){return db['Campaign'][_0x9413('0x4a')]({'where':{'id':_0x16ae16[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x4ab9cb,null))[_0x9413('0x23')](function(_0x172154){if(_0x172154){return _0x172154[_0x9413('0x83')](_0x16ae16['query'][_0x9413('0x65')]);}})[_0x9413('0x23')](function(_0x13b6bb){if(_0x13b6bb){return db[_0x9413('0x5a')][_0x9413('0x22')]({'where':{'ListId':_0x16ae16['query'][_0x9413('0x65')],'CampaignId':_0x16ae16['params']['id']}})[_0x9413('0x23')](function(){return _0x13b6bb;});}})[_0x9413('0x23')](respondWithStatusCode(_0x4ab9cb,null))['catch'](handleError(_0x4ab9cb,null));};exports[_0x9413('0x84')]=function(_0x28f6bf,_0x3252b6,_0x518f2d){var _0x372eda={'raw':!![],'where':{}};var _0x20d772={};var _0x5f4f67={'count':0x0,'rows':[]};return db[_0x9413('0x43')]['findOne']({'where':{'id':_0x28f6bf['params']['id']}})['then'](handleEntityNotFound(_0x3252b6,null))[_0x9413('0x23')](function(_0x240093){if(_0x240093){_0x20d772[_0x9413('0x34')]=_[_0x9413('0x31')](db[_0x9413('0x85')][_0x9413('0x2c')]);_0x20d772['query']=_[_0x9413('0x31')](_0x28f6bf[_0x9413('0x30')]);_0x20d772[_0x9413('0x32')]=_[_0x9413('0x33')](_0x20d772[_0x9413('0x34')],_0x20d772[_0x9413('0x30')]);_0x372eda[_0x9413('0x36')]=_[_0x9413('0x33')](_0x20d772[_0x9413('0x34')],qs[_0x9413('0x35')](_0x28f6bf[_0x9413('0x30')][_0x9413('0x35')]));_0x372eda['attributes']=_0x372eda[_0x9413('0x36')][_0x9413('0x37')]?_0x372eda[_0x9413('0x36')]:_0x20d772[_0x9413('0x34')];if(!_0x28f6bf[_0x9413('0x30')][_0x9413('0x5d')]('nolimit')){_0x372eda[_0x9413('0x39')]=qs['limit'](_0x28f6bf[_0x9413('0x30')][_0x9413('0x39')]);_0x372eda['offset']=qs[_0x9413('0x1b')](_0x28f6bf[_0x9413('0x30')][_0x9413('0x1b')]);}_0x372eda['order']=qs[_0x9413('0x3b')](_0x28f6bf[_0x9413('0x30')]['sort']);_0x372eda[_0x9413('0x3c')]=qs[_0x9413('0x32')](_[_0x9413('0x3d')](_0x28f6bf[_0x9413('0x30')],_0x20d772[_0x9413('0x32')]));_0x372eda[_0x9413('0x3c')][_0x9413('0x5b')]=_0x240093['id'];if(_0x28f6bf[_0x9413('0x30')][_0x9413('0x3e')]){_0x372eda[_0x9413('0x3c')]=_[_0x9413('0x3f')](_0x372eda[_0x9413('0x3c')],{'$or':_[_0x9413('0x2b')](_0x372eda[_0x9413('0x36')],function(_0x58ef02){var _0x581b90={};_0x581b90[_0x58ef02]={'$like':'%'+_0x28f6bf[_0x9413('0x30')][_0x9413('0x3e')]+'%'};return _0x581b90;})});}_0x372eda=_[_0x9413('0x3f')]({},_0x372eda,_0x28f6bf[_0x9413('0x41')]);return db[_0x9413('0x85')][_0x9413('0x42')]({'where':_0x372eda[_0x9413('0x3c')]})['then'](function(_0x2cddab){_0x5f4f67['count']=_0x2cddab;if(_0x28f6bf['query'][_0x9413('0x48')]){_0x372eda[_0x9413('0x49')]=[{'all':!![]}];}return db[_0x9413('0x85')]['findAll'](_0x372eda);})[_0x9413('0x23')](function(_0x3d70e5){_0x5f4f67['rows']=_0x3d70e5;return _0x5f4f67;});}})[_0x9413('0x23')](respondWithFilteredResult(_0x3252b6,_0x372eda))[_0x9413('0x45')](handleError(_0x3252b6,null));};exports['addBlackLists']=function(_0x148cb3,_0x40fa0a,_0x1d50bf){var _0x577d49,_0x1f231d;return db[_0x9413('0x43')][_0x9413('0x4a')]({'where':{'id':_0x148cb3[_0x9413('0x47')]['id']}})[_0x9413('0x23')](handleEntityNotFound(_0x40fa0a,null))[_0x9413('0x23')](function(_0xbd2218){if(_0xbd2218){_0x1f231d=_0xbd2218;return _0xbd2218[_0x9413('0x86')](_0x148cb3[_0x9413('0x4c')][_0x9413('0x65')],_[_0x9413('0x56')](_0x148cb3[_0x9413('0x4c')],[_0x9413('0x65'),'id'])||{});}return null;})['spread'](function(_0x30f67c){var _0x273c54;_0x577d49=_0x30f67c||[];var _0x6c6f10=[];if(_0x30f67c){for(var _0x314b25=0x0;_0x314b25<_0x30f67c[_0x9413('0x37')];_0x314b25+=0x1){var _0x7a5a17=_0x30f67c[_0x314b25][_0x9413('0x4e')]({'plain':!![]});_0x273c54=squel[_0x9413('0x69')]()[_0x9413('0x6a')]('cm_hopper_black')['fromQuery']([_0x9413('0x6c'),'ContactId',_0x9413('0x6f'),_0x9413('0x5b'),_0x9413('0x57'),'updatedAt'],squel[_0x9413('0x79')]()[_0x9413('0x70')](_0x9413('0x6c'),_0x9413('0x6c'))['field']('id',_0x9413('0x6e'))[_0x9413('0x70')](_0x7a5a17['CmListId'][_0x9413('0x71')](),_0x9413('0x6f'))[_0x9413('0x70')](_0x148cb3['params']['id'][_0x9413('0x71')](),_0x9413('0x5b'))['field'](_0x9413('0x72'),_0x9413('0x57'))[_0x9413('0x70')](_0x9413('0x72'),'updatedAt')[_0x9413('0x73')]('cm_contacts')[_0x9413('0x3c')](_0x9413('0x75'))[_0x9413('0x3c')](_0x9413('0x80'),_0x7a5a17[_0x9413('0x76')][_0x9413('0x71')]())[_0x9413('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x9413('0x71')]();_0x6c6f10[_0x9413('0x81')](db[_0x9413('0x82')][_0x9413('0x30')](_0x273c54));}return BPromise['all'](_0x6c6f10);}})['then'](function(){return _0x577d49;})[_0x9413('0x23')](respondWithResult(_0x40fa0a,null))[_0x9413('0x45')](handleError(_0x40fa0a,null));};exports[_0x9413('0x87')]=function(_0x3003f0,_0x43f050,_0x12e7b3){return db['Campaign'][_0x9413('0x4a')]({'where':{'id':_0x3003f0[_0x9413('0x47')]['id']}})['then'](handleEntityNotFound(_0x43f050,null))[_0x9413('0x23')](function(_0x1c73db){if(_0x1c73db){return _0x1c73db[_0x9413('0x87')](_0x3003f0[_0x9413('0x30')][_0x9413('0x65')]);}})['then'](function(_0x20336c){if(_0x20336c){return db[_0x9413('0x62')]['destroy']({'where':{'ListId':_0x3003f0['query'][_0x9413('0x65')],'CampaignId':_0x3003f0[_0x9413('0x47')]['id']}})['then'](function(){return _0x20336c;});}})[_0x9413('0x23')](respondWithStatusCode(_0x43f050,null))[_0x9413('0x45')](handleError(_0x43f050,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index bcc5109..117e1d1 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5c6c30,_0x2ec907){var _0x310c4e=function(_0x23931f){while(--_0x23931f){_0x5c6c30['push'](_0x5c6c30['shift']());}};_0x310c4e(++_0x2ec907);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x301a2e,_0x4b809e){var _0x19b03b=function(_0x757c28){while(--_0x757c28){_0x301a2e['push'](_0x301a2e['shift']());}};_0x19b03b(++_0x4b809e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 734613d..e67d274 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(_0x71435,_0x5627a7){var _0x40de4f=function(_0x383620){while(--_0x383620){_0x71435['push'](_0x71435['shift']());}};_0x40de4f(++_0x5627a7);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('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(_0x4ad762,_0x3e7464){var _0x56f931=function(_0x1a6c40){while(--_0x1a6c40){_0x4ad762['push'](_0x4ad762['shift']());}};_0x56f931(++_0x3e7464);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9de2552..eb626f5 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 _0x30d5=['getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','/:id','update','delete','destroy','removeLists','/:id/blacklists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','show'];(function(_0x3f50ea,_0x32940c){var _0x59f2f1=function(_0xfb9fa9){while(--_0xfb9fa9){_0x3f50ea['push'](_0x3f50ea['shift']());}};_0x59f2f1(++_0x32940c);}(_0x30d5,0x1ae));var _0x530d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x30d5[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x530d('0x0'));var util=require(_0x530d('0x1'));var path=require(_0x530d('0x2'));var timeout=require(_0x530d('0x3'));var express=require(_0x530d('0x4'));var router=express[_0x530d('0x5')]();var auth=require(_0x530d('0x6'));var interaction=require(_0x530d('0x7'));var config=require(_0x530d('0x8'));var controller=require(_0x530d('0x9'));router[_0x530d('0xa')]('/',auth[_0x530d('0xb')](),controller[_0x530d('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x530d('0xd')]);router['get']('/:id/hoppers',auth[_0x530d('0xb')](),controller[_0x530d('0xe')]);router[_0x530d('0xa')]('/:id/hopper_histories',auth[_0x530d('0xb')](),controller[_0x530d('0xf')]);router[_0x530d('0xa')](_0x530d('0x10'),auth[_0x530d('0xb')](),controller[_0x530d('0x11')]);router['get'](_0x530d('0x12'),auth[_0x530d('0xb')](),controller[_0x530d('0x13')]);router[_0x530d('0xa')](_0x530d('0x14'),auth[_0x530d('0xb')](),controller[_0x530d('0x15')]);router['get']('/:id/blacklists',auth[_0x530d('0xb')](),controller[_0x530d('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0x530d('0x17')]);router[_0x530d('0x18')](_0x530d('0x19'),auth[_0x530d('0xb')](),controller[_0x530d('0x1a')]);router[_0x530d('0x18')]('/:id/lists',auth[_0x530d('0xb')](),controller[_0x530d('0x1b')]);router[_0x530d('0x18')]('/:id/blacklists',auth[_0x530d('0xb')](),controller[_0x530d('0x1c')]);router['put'](_0x530d('0x1d'),auth[_0x530d('0xb')](),controller[_0x530d('0x1e')]);router[_0x530d('0x1f')](_0x530d('0x1d'),auth[_0x530d('0xb')](),controller[_0x530d('0x20')]);router[_0x530d('0x1f')](_0x530d('0x14'),auth[_0x530d('0xb')](),controller[_0x530d('0x21')]);router[_0x530d('0x1f')](_0x530d('0x22'),auth[_0x530d('0xb')](),controller[_0x530d('0x23')]);module[_0x530d('0x24')]=router; \ No newline at end of file +var _0xd97e=['show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','removeLists','delete','removeBlackLists','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id'];(function(_0x3c148f,_0x3eafcf){var _0x4d956a=function(_0x4a98b4){while(--_0x4a98b4){_0x3c148f['push'](_0x3c148f['shift']());}};_0x4d956a(++_0x3eafcf);}(_0xd97e,0x7a));var _0xed97=function(_0x3eddf9,_0x20fddd){_0x3eddf9=_0x3eddf9-0x0;var _0x21eb88=_0xd97e[_0x3eddf9];return _0x21eb88;};'use strict';var multer=require('multer');var util=require(_0xed97('0x0'));var path=require(_0xed97('0x1'));var timeout=require(_0xed97('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xed97('0x3'));var interaction=require(_0xed97('0x4'));var config=require('../../config/environment');var controller=require(_0xed97('0x5'));router[_0xed97('0x6')]('/',auth[_0xed97('0x7')](),controller[_0xed97('0x8')]);router[_0xed97('0x6')](_0xed97('0x9'),auth[_0xed97('0x7')](),controller[_0xed97('0xa')]);router[_0xed97('0x6')](_0xed97('0xb'),auth[_0xed97('0x7')](),controller['getHoppers']);router[_0xed97('0x6')](_0xed97('0xc'),auth[_0xed97('0x7')](),controller[_0xed97('0xd')]);router['get'](_0xed97('0xe'),auth['isAuthenticated'](),controller[_0xed97('0xf')]);router[_0xed97('0x6')](_0xed97('0x10'),auth[_0xed97('0x7')](),controller['getHopperBlacks']);router['get'](_0xed97('0x11'),auth[_0xed97('0x7')](),controller[_0xed97('0x12')]);router['get'](_0xed97('0x13'),auth['isAuthenticated'](),controller[_0xed97('0x14')]);router[_0xed97('0x15')]('/',auth['isAuthenticated'](),controller[_0xed97('0x16')]);router['post'](_0xed97('0x17'),auth[_0xed97('0x7')](),controller[_0xed97('0x18')]);router[_0xed97('0x15')](_0xed97('0x11'),auth[_0xed97('0x7')](),controller[_0xed97('0x19')]);router[_0xed97('0x15')]('/:id/blacklists',auth[_0xed97('0x7')](),controller[_0xed97('0x1a')]);router[_0xed97('0x1b')]('/:id',auth[_0xed97('0x7')](),controller[_0xed97('0x1c')]);router['delete'](_0xed97('0x9'),auth[_0xed97('0x7')](),controller['destroy']);router['delete'](_0xed97('0x11'),auth[_0xed97('0x7')](),controller[_0xed97('0x1d')]);router[_0xed97('0x1e')](_0xed97('0x13'),auth[_0xed97('0x7')](),controller[_0xed97('0x1f')]);module[_0xed97('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 846ec2a..6f481a2 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 _0x98cb=['TEXT','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x39ee91,_0x410a18){var _0x1cef4a=function(_0x40dd24){while(--_0x40dd24){_0x39ee91['push'](_0x39ee91['shift']());}};_0x1cef4a(++_0x410a18);}(_0x98cb,0x1a1));var _0xb98c=function(_0x27be77,_0x4af20d){_0x27be77=_0x27be77-0x0;var _0x16df46=_0x98cb[_0x27be77];return _0x16df46;};'use strict';var Sequelize=require(_0xb98c('0x0'));module[_0xb98c('0x1')]={'key':{'type':Sequelize[_0xb98c('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb98c('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xb98c('0x2')]},'name':{'type':Sequelize[_0xb98c('0x4')],'get':function(){return this[_0xb98c('0x5')](_0xb98c('0x6'));}}}; \ No newline at end of file +var _0x4d13=['VIRTUAL','key','sequelize','STRING','TEXT'];(function(_0x40ff64,_0x25b8d9){var _0x4780dd=function(_0x1a0589){while(--_0x1a0589){_0x40ff64['push'](_0x40ff64['shift']());}};_0x4780dd(++_0x25b8d9);}(_0x4d13,0x84));var _0x34d1=function(_0x21a832,_0x5cad7d){_0x21a832=_0x21a832-0x0;var _0x1b7e26=_0x4d13[_0x21a832];return _0x1b7e26;};'use strict';var Sequelize=require(_0x34d1('0x0'));module['exports']={'key':{'type':Sequelize[_0x34d1('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x34d1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x34d1('0x1')]},'name':{'type':Sequelize[_0x34d1('0x3')],'get':function(){return this['getDataValue'](_0x34d1('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c756034..cf1b5bd 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 _0x8399=['attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','filters','find','catch','update','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','intersection','fields'];(function(_0xab5594,_0x431e01){var _0x1db392=function(_0x2b9964){while(--_0x2b9964){_0xab5594['push'](_0xab5594['shift']());}};_0x1db392(++_0x431e01);}(_0x8399,0xce));var _0x9839=function(_0x268a1e,_0x544592){_0x268a1e=_0x268a1e-0x0;var _0x11d6a0=_0x8399[_0x268a1e];return _0x11d6a0;};'use strict';var pdf=require(_0x9839('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9839('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9839('0x2'));var BPromise=require(_0x9839('0x3'));var Mustache=require(_0x9839('0x4'));var util=require('util');var path=require(_0x9839('0x5'));var sox=require(_0x9839('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9839('0x7'));var squel=require(_0x9839('0x8'));var crypto=require(_0x9839('0x9'));var jsforce=require(_0x9839('0xa'));var deskjs=require(_0x9839('0xb'));var toCsv=require(_0x9839('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9839('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9839('0xe'));var as=require(_0x9839('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9839('0x10'));var utils=require(_0x9839('0x11'));var config=require(_0x9839('0x12'));var db=require(_0x9839('0x13'))['db'];function respondWithStatusCode(_0x48c7e5,_0x2f70fb){_0x2f70fb=_0x2f70fb||0xcc;return function(_0x43f33a){if(_0x43f33a){return _0x48c7e5[_0x9839('0x14')](_0x2f70fb);}return _0x48c7e5[_0x9839('0x15')](_0x2f70fb)[_0x9839('0x16')]();};}function respondWithResult(_0x134b55,_0x197bdb){_0x197bdb=_0x197bdb||0xc8;return function(_0x42f15e){if(_0x42f15e){return _0x134b55[_0x9839('0x15')](_0x197bdb)[_0x9839('0x17')](_0x42f15e);}};}function respondWithFilteredResult(_0x295bc2,_0x11a97e){return function(_0x3814dc){if(_0x3814dc){var _0x11cc58=_0x3814dc['count'],_0x3d827b=_0x11a97e[_0x9839('0x18')],_0x37af94=_0x11a97e[_0x9839('0x18')]+_0x11a97e[_0x9839('0x19')],_0x3221ca;if(_0x37af94>=_0x11cc58){_0x37af94=_0x11cc58;_0x3221ca=0xc8;}else{_0x3221ca=0xce;}_0x295bc2[_0x9839('0x15')](_0x3221ca);return _0x295bc2[_0x9839('0x1a')](_0x9839('0x1b'),_0x3d827b+'-'+_0x37af94+'/'+_0x11cc58)[_0x9839('0x17')](_0x3814dc);}return null;};}function patchUpdates(_0x3331a1){return function(_0x301ec0){try{jsonpatch[_0x9839('0x1c')](_0x301ec0,_0x3331a1,!![]);}catch(_0x203980){return BPromise['reject'](_0x203980);}return _0x301ec0[_0x9839('0x1d')]();};}function saveUpdates(_0xb8d4ba,_0x4e5a6e){return function(_0x1a3f41){if(_0x1a3f41){return _0x1a3f41['update'](_0xb8d4ba)[_0x9839('0x1e')](function(_0x1f2f62){return _0x1f2f62;});}return null;};}function removeEntity(_0x209f88,_0x14adba){return function(_0x2f0ff1){if(_0x2f0ff1){return _0x2f0ff1[_0x9839('0x1f')]()['then'](function(){var _0x425efb=_0x2f0ff1[_0x9839('0x20')]({'plain':!![]});var _0x4c2e88=_0x9839('0x21');return db[_0x9839('0x22')][_0x9839('0x1f')]({'where':{'type':_0x4c2e88,'resourceId':_0x425efb['id']}})[_0x9839('0x1e')](function(){return _0x2f0ff1;});})[_0x9839('0x1e')](function(){_0x209f88[_0x9839('0x15')](0xcc)[_0x9839('0x16')]();});}};}function handleEntityNotFound(_0x5aca80,_0x2140a8){return function(_0x1f71a3){if(!_0x1f71a3){_0x5aca80[_0x9839('0x14')](0x194);}return _0x1f71a3;};}function handleError(_0x15b2a5,_0x2fe909){_0x2fe909=_0x2fe909||0x1f4;return function(_0x48e82c){logger[_0x9839('0x23')](_0x48e82c[_0x9839('0x24')]);if(_0x48e82c[_0x9839('0x25')]){delete _0x48e82c[_0x9839('0x25')];}_0x15b2a5['status'](_0x2fe909)['send'](_0x48e82c);};}exports[_0x9839('0x26')]=function(_0x543c0c,_0x4b49ec){var _0x44d20b={},_0x36d175={},_0x54e685={'count':0x0,'rows':[]};var _0x49a835=_[_0x9839('0x27')](db[_0x9839('0x28')][_0x9839('0x29')],function(_0x570455){return{'name':_0x570455[_0x9839('0x2a')],'type':_0x570455[_0x9839('0x2b')]['key']};});_0x36d175[_0x9839('0x2c')]=_['map'](_0x49a835,'name');_0x36d175[_0x9839('0x2d')]=_[_0x9839('0x2e')](_0x543c0c['query']);_0x36d175['filters']=_['intersection'](_0x36d175[_0x9839('0x2c')],_0x36d175[_0x9839('0x2d')]);_0x44d20b['attributes']=_[_0x9839('0x2f')](_0x36d175[_0x9839('0x2c')],qs[_0x9839('0x30')](_0x543c0c[_0x9839('0x2d')][_0x9839('0x30')]));_0x44d20b[_0x9839('0x31')]=_0x44d20b[_0x9839('0x31')][_0x9839('0x32')]?_0x44d20b['attributes']:_0x36d175['model'];if(!_0x543c0c[_0x9839('0x2d')][_0x9839('0x33')](_0x9839('0x34'))){_0x44d20b[_0x9839('0x19')]=qs[_0x9839('0x19')](_0x543c0c['query'][_0x9839('0x19')]);_0x44d20b[_0x9839('0x18')]=qs['offset'](_0x543c0c[_0x9839('0x2d')]['offset']);}_0x44d20b['order']=qs[_0x9839('0x35')](_0x543c0c[_0x9839('0x2d')][_0x9839('0x35')]);_0x44d20b['where']=qs['filters'](_[_0x9839('0x36')](_0x543c0c[_0x9839('0x2d')],_0x36d175['filters']),_0x49a835);if(_0x543c0c[_0x9839('0x2d')][_0x9839('0x37')]){_0x44d20b[_0x9839('0x38')]=_['merge'](_0x44d20b[_0x9839('0x38')],{'$or':_[_0x9839('0x27')](_0x49a835,function(_0xb0e5a7){if(_0xb0e5a7[_0x9839('0x2b')]!==_0x9839('0x39')){var _0xd38f55={};_0xd38f55[_0xb0e5a7[_0x9839('0x25')]]={'$like':'%'+_0x543c0c['query'][_0x9839('0x37')]+'%'};return _0xd38f55;}})});}_0x44d20b=_[_0x9839('0x3a')]({},_0x44d20b,_0x543c0c[_0x9839('0x3b')]);var _0x613609={'where':_0x44d20b['where']};return db[_0x9839('0x28')][_0x9839('0x3c')](_0x613609)[_0x9839('0x1e')](function(_0x34be9b){_0x54e685['count']=_0x34be9b;if(_0x543c0c[_0x9839('0x2d')][_0x9839('0x3d')]){_0x44d20b[_0x9839('0x3e')]=[{'all':!![]}];}return db[_0x9839('0x28')][_0x9839('0x3f')](_0x44d20b);})[_0x9839('0x1e')](function(_0x1e322f){_0x54e685['rows']=_0x1e322f;return _0x54e685;})[_0x9839('0x1e')](respondWithFilteredResult(_0x4b49ec,_0x44d20b))['catch'](handleError(_0x4b49ec,null));};exports[_0x9839('0x40')]=function(_0x8757f8,_0x2cf032){var _0x4e09b2={'raw':!![],'where':{'id':_0x8757f8[_0x9839('0x41')]['id']}},_0x2f4245={};_0x2f4245[_0x9839('0x2c')]=_[_0x9839('0x2e')](db[_0x9839('0x28')]['rawAttributes']);_0x2f4245['query']=_[_0x9839('0x2e')](_0x8757f8[_0x9839('0x2d')]);_0x2f4245[_0x9839('0x42')]=_[_0x9839('0x2f')](_0x2f4245['model'],_0x2f4245[_0x9839('0x2d')]);_0x4e09b2['attributes']=_[_0x9839('0x2f')](_0x2f4245[_0x9839('0x2c')],qs[_0x9839('0x30')](_0x8757f8[_0x9839('0x2d')][_0x9839('0x30')]));_0x4e09b2['attributes']=_0x4e09b2[_0x9839('0x31')][_0x9839('0x32')]?_0x4e09b2[_0x9839('0x31')]:_0x2f4245['model'];if(_0x8757f8['query']['includeAll']){_0x4e09b2[_0x9839('0x3e')]=[{'all':!![]}];}_0x4e09b2=_[_0x9839('0x3a')]({},_0x4e09b2,_0x8757f8[_0x9839('0x3b')]);return db['CannedAnswer'][_0x9839('0x43')](_0x4e09b2)[_0x9839('0x1e')](handleEntityNotFound(_0x2cf032,null))[_0x9839('0x1e')](respondWithResult(_0x2cf032,null))[_0x9839('0x44')](handleError(_0x2cf032,null));};exports[_0x9839('0x45')]=function(_0x42b322,_0x2defed){if(_0x42b322[_0x9839('0x46')]['id']){delete _0x42b322[_0x9839('0x46')]['id'];}return db[_0x9839('0x28')][_0x9839('0x43')]({'where':{'id':_0x42b322[_0x9839('0x41')]['id']}})[_0x9839('0x1e')](handleEntityNotFound(_0x2defed,null))[_0x9839('0x1e')](saveUpdates(_0x42b322[_0x9839('0x46')],null))['then'](respondWithResult(_0x2defed,null))[_0x9839('0x44')](handleError(_0x2defed,null));};exports[_0x9839('0x1f')]=function(_0x306e59,_0x2207be){return db[_0x9839('0x28')][_0x9839('0x43')]({'where':{'id':_0x306e59[_0x9839('0x41')]['id']}})[_0x9839('0x1e')](handleEntityNotFound(_0x2207be,null))['then'](removeEntity(_0x2207be,null))[_0x9839('0x44')](handleError(_0x2207be,null));};exports[_0x9839('0x47')]=function(_0x38e8b2,_0x344e49){var _0x1560a3={'key':_0x38e8b2[_0x9839('0x46')][_0x9839('0x48')]};if(_0x38e8b2[_0x9839('0x46')][_0x9839('0x49')]){_0x1560a3[_0x9839('0x49')]=_0x38e8b2[_0x9839('0x46')][_0x9839('0x49')];}else if(_0x38e8b2[_0x9839('0x46')]['SmsAccountId']){_0x1560a3[_0x9839('0x4a')]=_0x38e8b2[_0x9839('0x46')][_0x9839('0x4a')];}else if(_0x38e8b2[_0x9839('0x46')][_0x9839('0x4b')]){_0x1560a3[_0x9839('0x4b')]=_0x38e8b2[_0x9839('0x46')][_0x9839('0x4b')];}else if(_0x38e8b2[_0x9839('0x46')][_0x9839('0x4c')]){_0x1560a3['ChatWebsiteId']=_0x38e8b2['body']['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x1560a3})[_0x9839('0x1e')](function(_0x2b59c7){if(_0x2b59c7){throw new db[(_0x9839('0x4d'))][(_0x9839('0x4e'))](_0x9839('0x4f'));}return db[_0x9839('0x28')][_0x9839('0x47')](_0x38e8b2[_0x9839('0x46')]);})[_0x9839('0x1e')](function(_0x32b36c){var _0x2522ab=_0x38e8b2['user'][_0x9839('0x20')]({'plain':!![]});if(!_0x2522ab)throw new Error(_0x9839('0x50'));if(_0x2522ab[_0x9839('0x51')]==='user'){var _0x1b7fcc=_0x32b36c[_0x9839('0x20')]({'plain':!![]});return db[_0x9839('0x52')]['find']({'where':{'name':_0x9839('0x21'),'userProfileId':_0x2522ab[_0x9839('0x53')]},'raw':!![]})[_0x9839('0x1e')](function(_0x515e23){if(_0x515e23&&_0x515e23['autoAssociation']===0x0){return db[_0x9839('0x22')][_0x9839('0x47')]({'name':_0x1b7fcc['name'],'resourceId':_0x1b7fcc['id'],'type':_0x515e23[_0x9839('0x25')],'sectionId':_0x515e23['id']},{})[_0x9839('0x1e')](function(){return _0x32b36c;});}else{return _0x32b36c;}})[_0x9839('0x44')](function(_0x56a77d){logger[_0x9839('0x23')](_0x9839('0x54'),_0x56a77d);throw _0x56a77d;});}return _0x32b36c;})['then'](respondWithResult(_0x344e49,0xc9))[_0x9839('0x44')](handleError(_0x344e49,null));}; \ No newline at end of file +var _0x5658=['options','includeAll','include','findAll','rows','catch','show','params','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','role','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','index','CannedAnswer','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL'];(function(_0x5cc37e,_0x7fffe1){var _0x5612c3=function(_0x19c9ff){while(--_0x19c9ff){_0x5cc37e['push'](_0x5cc37e['shift']());}};_0x5612c3(++_0x7fffe1);}(_0x5658,0x170));var _0x8565=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5658[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0x8565('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8565('0x1'));var zipdir=require(_0x8565('0x2'));var jsonpatch=require(_0x8565('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8565('0x4'));var Mustache=require('mustache');var util=require(_0x8565('0x5'));var path=require('path');var sox=require(_0x8565('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8565('0x7'));var squel=require(_0x8565('0x8'));var crypto=require(_0x8565('0x9'));var jsforce=require(_0x8565('0xa'));var deskjs=require(_0x8565('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8565('0xc'));var Papa=require(_0x8565('0xd'));var Redis=require(_0x8565('0xe'));var authService=require(_0x8565('0xf'));var qs=require(_0x8565('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8565('0x11'))('api');var utils=require(_0x8565('0x12'));var config=require(_0x8565('0x13'));var db=require(_0x8565('0x14'))['db'];function respondWithStatusCode(_0x1e0987,_0x2f0356){_0x2f0356=_0x2f0356||0xcc;return function(_0xcd5635){if(_0xcd5635){return _0x1e0987['sendStatus'](_0x2f0356);}return _0x1e0987[_0x8565('0x15')](_0x2f0356)[_0x8565('0x16')]();};}function respondWithResult(_0x29e595,_0x4aa6bb){_0x4aa6bb=_0x4aa6bb||0xc8;return function(_0x483bd3){if(_0x483bd3){return _0x29e595[_0x8565('0x15')](_0x4aa6bb)[_0x8565('0x17')](_0x483bd3);}};}function respondWithFilteredResult(_0x4f835f,_0x35cba7){return function(_0x2d0bae){if(_0x2d0bae){var _0x4eeea3=_0x2d0bae[_0x8565('0x18')],_0x586e7f=_0x35cba7[_0x8565('0x19')],_0x2c9ea6=_0x35cba7[_0x8565('0x19')]+_0x35cba7[_0x8565('0x1a')],_0x5d8861;if(_0x2c9ea6>=_0x4eeea3){_0x2c9ea6=_0x4eeea3;_0x5d8861=0xc8;}else{_0x5d8861=0xce;}_0x4f835f[_0x8565('0x15')](_0x5d8861);return _0x4f835f[_0x8565('0x1b')](_0x8565('0x1c'),_0x586e7f+'-'+_0x2c9ea6+'/'+_0x4eeea3)['json'](_0x2d0bae);}return null;};}function patchUpdates(_0x5b2fa4){return function(_0x2c3eab){try{jsonpatch[_0x8565('0x1d')](_0x2c3eab,_0x5b2fa4,!![]);}catch(_0x1fa5fd){return BPromise[_0x8565('0x1e')](_0x1fa5fd);}return _0x2c3eab['save']();};}function saveUpdates(_0x302243,_0x4919a3){return function(_0x4b2dda){if(_0x4b2dda){return _0x4b2dda[_0x8565('0x1f')](_0x302243)[_0x8565('0x20')](function(_0xa114df){return _0xa114df;});}return null;};}function removeEntity(_0x539948,_0x4aca70){return function(_0x19a909){if(_0x19a909){return _0x19a909[_0x8565('0x21')]()['then'](function(){var _0x97d292=_0x19a909[_0x8565('0x22')]({'plain':!![]});var _0x1c39f0='CannedAnswers';return db[_0x8565('0x23')][_0x8565('0x21')]({'where':{'type':_0x1c39f0,'resourceId':_0x97d292['id']}})[_0x8565('0x20')](function(){return _0x19a909;});})[_0x8565('0x20')](function(){_0x539948['status'](0xcc)[_0x8565('0x16')]();});}};}function handleEntityNotFound(_0x7ddc9d,_0x3981e6){return function(_0x152c13){if(!_0x152c13){_0x7ddc9d['sendStatus'](0x194);}return _0x152c13;};}function handleError(_0xce6690,_0x34a5cf){_0x34a5cf=_0x34a5cf||0x1f4;return function(_0x20decb){logger[_0x8565('0x24')](_0x20decb[_0x8565('0x25')]);if(_0x20decb['name']){delete _0x20decb['name'];}_0xce6690[_0x8565('0x15')](_0x34a5cf)['send'](_0x20decb);};}exports[_0x8565('0x26')]=function(_0x5aaadb,_0xf4555c){var _0x1aa011={},_0x3d8913={},_0x2b03af={'count':0x0,'rows':[]};var _0xea5e9b=_['map'](db[_0x8565('0x27')][_0x8565('0x28')],function(_0x43d2ca){return{'name':_0x43d2ca[_0x8565('0x29')],'type':_0x43d2ca[_0x8565('0x2a')][_0x8565('0x2b')]};});_0x3d8913[_0x8565('0x2c')]=_['map'](_0xea5e9b,_0x8565('0x2d'));_0x3d8913[_0x8565('0x2e')]=_[_0x8565('0x2f')](_0x5aaadb[_0x8565('0x2e')]);_0x3d8913[_0x8565('0x30')]=_[_0x8565('0x31')](_0x3d8913['model'],_0x3d8913[_0x8565('0x2e')]);_0x1aa011[_0x8565('0x32')]=_[_0x8565('0x31')](_0x3d8913[_0x8565('0x2c')],qs[_0x8565('0x33')](_0x5aaadb[_0x8565('0x2e')][_0x8565('0x33')]));_0x1aa011[_0x8565('0x32')]=_0x1aa011[_0x8565('0x32')][_0x8565('0x34')]?_0x1aa011['attributes']:_0x3d8913[_0x8565('0x2c')];if(!_0x5aaadb[_0x8565('0x2e')][_0x8565('0x35')](_0x8565('0x36'))){_0x1aa011[_0x8565('0x1a')]=qs[_0x8565('0x1a')](_0x5aaadb['query'][_0x8565('0x1a')]);_0x1aa011[_0x8565('0x19')]=qs['offset'](_0x5aaadb[_0x8565('0x2e')][_0x8565('0x19')]);}_0x1aa011['order']=qs[_0x8565('0x37')](_0x5aaadb[_0x8565('0x2e')][_0x8565('0x37')]);_0x1aa011[_0x8565('0x38')]=qs[_0x8565('0x30')](_[_0x8565('0x39')](_0x5aaadb[_0x8565('0x2e')],_0x3d8913[_0x8565('0x30')]),_0xea5e9b);if(_0x5aaadb[_0x8565('0x2e')][_0x8565('0x3a')]){_0x1aa011[_0x8565('0x38')]=_[_0x8565('0x3b')](_0x1aa011[_0x8565('0x38')],{'$or':_[_0x8565('0x3c')](_0xea5e9b,function(_0xf8341d){if(_0xf8341d[_0x8565('0x2a')]!==_0x8565('0x3d')){var _0x243adb={};_0x243adb[_0xf8341d[_0x8565('0x2d')]]={'$like':'%'+_0x5aaadb['query'][_0x8565('0x3a')]+'%'};return _0x243adb;}})});}_0x1aa011=_['merge']({},_0x1aa011,_0x5aaadb[_0x8565('0x3e')]);var _0x3d29cd={'where':_0x1aa011[_0x8565('0x38')]};return db[_0x8565('0x27')][_0x8565('0x18')](_0x3d29cd)[_0x8565('0x20')](function(_0x28bfce){_0x2b03af[_0x8565('0x18')]=_0x28bfce;if(_0x5aaadb[_0x8565('0x2e')][_0x8565('0x3f')]){_0x1aa011[_0x8565('0x40')]=[{'all':!![]}];}return db[_0x8565('0x27')][_0x8565('0x41')](_0x1aa011);})[_0x8565('0x20')](function(_0x146b70){_0x2b03af[_0x8565('0x42')]=_0x146b70;return _0x2b03af;})[_0x8565('0x20')](respondWithFilteredResult(_0xf4555c,_0x1aa011))[_0x8565('0x43')](handleError(_0xf4555c,null));};exports[_0x8565('0x44')]=function(_0xc5754c,_0xe6d487){var _0x24f48d={'raw':!![],'where':{'id':_0xc5754c[_0x8565('0x45')]['id']}},_0x27b8d1={};_0x27b8d1['model']=_['keys'](db[_0x8565('0x27')][_0x8565('0x28')]);_0x27b8d1['query']=_['keys'](_0xc5754c['query']);_0x27b8d1[_0x8565('0x30')]=_[_0x8565('0x31')](_0x27b8d1[_0x8565('0x2c')],_0x27b8d1[_0x8565('0x2e')]);_0x24f48d[_0x8565('0x32')]=_[_0x8565('0x31')](_0x27b8d1[_0x8565('0x2c')],qs[_0x8565('0x33')](_0xc5754c['query'][_0x8565('0x33')]));_0x24f48d[_0x8565('0x32')]=_0x24f48d['attributes'][_0x8565('0x34')]?_0x24f48d[_0x8565('0x32')]:_0x27b8d1['model'];if(_0xc5754c[_0x8565('0x2e')][_0x8565('0x3f')]){_0x24f48d[_0x8565('0x40')]=[{'all':!![]}];}_0x24f48d=_[_0x8565('0x3b')]({},_0x24f48d,_0xc5754c['options']);return db[_0x8565('0x27')][_0x8565('0x46')](_0x24f48d)[_0x8565('0x20')](handleEntityNotFound(_0xe6d487,null))[_0x8565('0x20')](respondWithResult(_0xe6d487,null))[_0x8565('0x43')](handleError(_0xe6d487,null));};exports[_0x8565('0x1f')]=function(_0x2de6ed,_0xaa28d8){if(_0x2de6ed[_0x8565('0x47')]['id']){delete _0x2de6ed['body']['id'];}return db[_0x8565('0x27')][_0x8565('0x46')]({'where':{'id':_0x2de6ed[_0x8565('0x45')]['id']}})[_0x8565('0x20')](handleEntityNotFound(_0xaa28d8,null))['then'](saveUpdates(_0x2de6ed[_0x8565('0x47')],null))[_0x8565('0x20')](respondWithResult(_0xaa28d8,null))[_0x8565('0x43')](handleError(_0xaa28d8,null));};exports['destroy']=function(_0x2b78be,_0x5484af){return db[_0x8565('0x27')]['find']({'where':{'id':_0x2b78be[_0x8565('0x45')]['id']}})[_0x8565('0x20')](handleEntityNotFound(_0x5484af,null))[_0x8565('0x20')](removeEntity(_0x5484af,null))[_0x8565('0x43')](handleError(_0x5484af,null));};exports['create']=function(_0x44bdcc,_0x1e4503){var _0x3577de={'key':_0x44bdcc['body'][_0x8565('0x2b')]};if(_0x44bdcc[_0x8565('0x47')]['MailAccountId']){_0x3577de[_0x8565('0x48')]=_0x44bdcc[_0x8565('0x47')][_0x8565('0x48')];}else if(_0x44bdcc[_0x8565('0x47')][_0x8565('0x49')]){_0x3577de[_0x8565('0x49')]=_0x44bdcc[_0x8565('0x47')][_0x8565('0x49')];}else if(_0x44bdcc[_0x8565('0x47')][_0x8565('0x4a')]){_0x3577de[_0x8565('0x4a')]=_0x44bdcc[_0x8565('0x47')][_0x8565('0x4a')];}else if(_0x44bdcc[_0x8565('0x47')][_0x8565('0x4b')]){_0x3577de['ChatWebsiteId']=_0x44bdcc['body'][_0x8565('0x4b')];}return db[_0x8565('0x27')][_0x8565('0x46')]({'where':_0x3577de})['then'](function(_0x34821a){if(_0x34821a){throw new db['Sequelize'][(_0x8565('0x4c'))](_0x8565('0x4d'));}return db[_0x8565('0x27')][_0x8565('0x4e')](_0x44bdcc[_0x8565('0x47')]);})[_0x8565('0x20')](function(_0xe44ea1){var _0x5e2677=_0x44bdcc[_0x8565('0x4f')][_0x8565('0x22')]({'plain':!![]});if(!_0x5e2677)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e2677[_0x8565('0x50')]==='user'){var _0xd7c457=_0xe44ea1[_0x8565('0x22')]({'plain':!![]});return db[_0x8565('0x51')][_0x8565('0x46')]({'where':{'name':_0x8565('0x52'),'userProfileId':_0x5e2677[_0x8565('0x53')]},'raw':!![]})[_0x8565('0x20')](function(_0x3f33f0){if(_0x3f33f0&&_0x3f33f0[_0x8565('0x54')]===0x0){return db[_0x8565('0x23')]['create']({'name':_0xd7c457[_0x8565('0x2d')],'resourceId':_0xd7c457['id'],'type':_0x3f33f0[_0x8565('0x2d')],'sectionId':_0x3f33f0['id']},{})[_0x8565('0x20')](function(){return _0xe44ea1;});}else{return _0xe44ea1;}})[_0x8565('0x43')](function(_0x3c2d79){logger[_0x8565('0x24')](_0x8565('0x55'),_0x3c2d79);throw _0x3c2d79;});}return _0xe44ea1;})['then'](respondWithResult(_0x1e4503,0xc9))[_0x8565('0x43')](handleError(_0x1e4503,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a09fd29..687633a 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 _0x55ca=['request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','lodash','util','bluebird'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x55ca,0x126));var _0xa55c=function(_0x44c325,_0x19c625){_0x44c325=_0x44c325-0x0;var _0x55f09e=_0x55ca[_0x44c325];return _0x55f09e;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('CannedAnswer',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa55c('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4ab0=['moment','bluebird','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x422e64,_0x4c9309){var _0x43eb46=function(_0x5cf8c2){while(--_0x5cf8c2){_0x422e64['push'](_0x422e64['shift']());}};_0x43eb46(++_0x4c9309);}(_0x4ab0,0xd5));var _0x04ab=function(_0x5da91b,_0x19efa4){_0x5da91b=_0x5da91b-0x0;var _0x2e2453=_0x4ab0[_0x5da91b];return _0x2e2453;};'use strict';var _=require('lodash');var util=require(_0x04ab('0x0'));var logger=require(_0x04ab('0x1'))(_0x04ab('0x2'));var moment=require(_0x04ab('0x3'));var BPromise=require(_0x04ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x04ab('0x5'));var config=require(_0x04ab('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x04ab('0x7')]=function(_0x2c5730,_0x4edd2e){return _0x2c5730[_0x04ab('0x8')](_0x04ab('0x9'),attributes,{'tableName':_0x04ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x04ab('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b1037a0..6640589 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 _0x27ba=['../../config/environment','jayson/promise','http','request','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x27ba,0xe7));var _0xa27b=function(_0x38ae2a,_0x487d95){_0x38ae2a=_0x38ae2a-0x0;var _0x2069dd=_0x27ba[_0x38ae2a];return _0x2069dd;};'use strict';var _=require(_0xa27b('0x0'));var util=require('util');var moment=require(_0xa27b('0x1'));var BPromise=require(_0xa27b('0x2'));var rs=require(_0xa27b('0x3'));var fs=require('fs');var Redis=require(_0xa27b('0x4'));var db=require(_0xa27b('0x5'))['db'];var utils=require(_0xa27b('0x6'));var logger=require(_0xa27b('0x7'))(_0xa27b('0x8'));var config=require(_0xa27b('0x9'));var jayson=require(_0xa27b('0xa'));var client=jayson['client'][_0xa27b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f7388,_0x56914c,_0x14bcd3){return new BPromise(function(_0x36d535,_0x565880){return client[_0xa27b('0xc')](_0x3f7388,_0x14bcd3)['then'](function(_0x281779){logger[_0xa27b('0xd')](_0xa27b('0xe'),_0x56914c,'request\x20sent');logger[_0xa27b('0xf')](_0xa27b('0x10'),_0x56914c,_0xa27b('0x11'),JSON[_0xa27b('0x12')](_0x281779));if(_0x281779[_0xa27b('0x13')]){if(_0x281779[_0xa27b('0x13')][_0xa27b('0x14')]===0x1f4){logger[_0xa27b('0x13')](_0xa27b('0xe'),_0x56914c,_0x281779[_0xa27b('0x13')][_0xa27b('0x15')]);return _0x565880(_0x281779['error'][_0xa27b('0x15')]);}logger[_0xa27b('0x13')](_0xa27b('0xe'),_0x56914c,_0x281779[_0xa27b('0x13')]['message']);return _0x36d535(_0x281779[_0xa27b('0x13')][_0xa27b('0x15')]);}else{logger[_0xa27b('0xd')](_0xa27b('0xe'),_0x56914c,_0xa27b('0x11'));_0x36d535(_0x281779[_0xa27b('0x16')]['message']);}})[_0xa27b('0x17')](function(_0xd08294){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x56914c,_0xd08294);_0x565880(_0xd08294);});});} \ No newline at end of file +var _0xe641=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CannedAnswer,\x20%s,\x20%s','catch','lodash','util','moment'];(function(_0x11ccf2,_0xe2c798){var _0x3254ac=function(_0x2921e0){while(--_0x2921e0){_0x11ccf2['push'](_0x11ccf2['shift']());}};_0x3254ac(++_0xe2c798);}(_0xe641,0x1e0));var _0x1e64=function(_0x440396,_0xf8c490){_0x440396=_0x440396-0x0;var _0x221ae4=_0xe641[_0x440396];return _0x221ae4;};'use strict';var _=require(_0x1e64('0x0'));var util=require(_0x1e64('0x1'));var moment=require(_0x1e64('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e64('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e64('0x4'));var logger=require(_0x1e64('0x5'))(_0x1e64('0x6'));var config=require(_0x1e64('0x7'));var jayson=require(_0x1e64('0x8'));var client=jayson[_0x1e64('0x9')][_0x1e64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29cc45,_0x316cfa,_0x5ac3ad){return new BPromise(function(_0x162fd4,_0x51cd27){return client[_0x1e64('0xb')](_0x29cc45,_0x5ac3ad)[_0x1e64('0xc')](function(_0x287652){logger[_0x1e64('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x316cfa,'request\x20sent');logger[_0x1e64('0xe')](_0x1e64('0xf'),_0x316cfa,_0x1e64('0x10'),JSON[_0x1e64('0x11')](_0x287652));if(_0x287652[_0x1e64('0x12')]){if(_0x287652[_0x1e64('0x12')][_0x1e64('0x13')]===0x1f4){logger[_0x1e64('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x316cfa,_0x287652[_0x1e64('0x12')]['message']);return _0x51cd27(_0x287652['error'][_0x1e64('0x14')]);}logger[_0x1e64('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x316cfa,_0x287652[_0x1e64('0x12')][_0x1e64('0x14')]);return _0x162fd4(_0x287652[_0x1e64('0x12')][_0x1e64('0x14')]);}else{logger[_0x1e64('0xd')](_0x1e64('0x15'),_0x316cfa,'request\x20sent');_0x162fd4(_0x287652['result'][_0x1e64('0x14')]);}})[_0x1e64('0x16')](function(_0x240d26){logger['error'](_0x1e64('0x15'),_0x316cfa,_0x240d26);_0x51cd27(_0x240d26);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index c762d85..145a2e1 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 _0x3663=['put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post'];(function(_0xc3aaaf,_0xaf47f3){var _0x3db515=function(_0x44dc8b){while(--_0x44dc8b){_0xc3aaaf['push'](_0xc3aaaf['shift']());}};_0x3db515(++_0xaf47f3);}(_0x3663,0x1cf));var _0x3366=function(_0x46f098,_0x5f5063){_0x46f098=_0x46f098-0x0;var _0x1eef1d=_0x3663[_0x46f098];return _0x1eef1d;};'use strict';var multer=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var path=require(_0x3366('0x2'));var timeout=require('connect-timeout');var express=require(_0x3366('0x3'));var router=express[_0x3366('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3366('0x5'));var config=require(_0x3366('0x6'));var controller=require(_0x3366('0x7'));router[_0x3366('0x8')]('/',auth[_0x3366('0x9')](),controller['index']);router[_0x3366('0x8')](_0x3366('0xa'),auth['isAuthenticated'](),controller[_0x3366('0xb')]);router[_0x3366('0xc')]('/',auth[_0x3366('0x9')](),controller['create']);router[_0x3366('0xd')](_0x3366('0xa'),auth[_0x3366('0x9')](),controller['update']);router[_0x3366('0xe')](_0x3366('0xa'),auth[_0x3366('0x9')](),controller[_0x3366('0xf')]);module[_0x3366('0x10')]=router; \ No newline at end of file +var _0xe972=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x47c229,_0x59aadf){var _0xbd3f9e=function(_0x597320){while(--_0x597320){_0x47c229['push'](_0x47c229['shift']());}};_0xbd3f9e(++_0x59aadf);}(_0xe972,0x123));var _0x2e97=function(_0x10e643,_0x3a4b46){_0x10e643=_0x10e643-0x0;var _0x1ab865=_0xe972[_0x10e643];return _0x1ab865;};'use strict';var multer=require(_0x2e97('0x0'));var util=require(_0x2e97('0x1'));var path=require(_0x2e97('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e97('0x3'));var router=express[_0x2e97('0x4')]();var auth=require(_0x2e97('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2e97('0x6'));var controller=require(_0x2e97('0x7'));router[_0x2e97('0x8')]('/',auth[_0x2e97('0x9')](),controller[_0x2e97('0xa')]);router[_0x2e97('0x8')](_0x2e97('0xb'),auth[_0x2e97('0x9')](),controller[_0x2e97('0xc')]);router['post']('/',auth[_0x2e97('0x9')](),controller[_0x2e97('0xd')]);router[_0x2e97('0xe')](_0x2e97('0xb'),auth[_0x2e97('0x9')](),controller['update']);router['delete'](_0x2e97('0xb'),auth[_0x2e97('0x9')](),controller[_0x2e97('0xf')]);module[_0x2e97('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d82f0c7..d198e19 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 _0x6695=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6695,0x143));var _0x5669=function(_0x5ee224,_0x783fe8){_0x5ee224=_0x5ee224-0x0;var _0x3c55dc=_0x6695[_0x5ee224];return _0x3c55dc;};'use strict';var Sequelize=require('sequelize');module[_0x5669('0x0')]={'calldate':{'type':Sequelize[_0x5669('0x1')],'allowNull':![],'defaultValue':_0x5669('0x2')},'clid':{'type':Sequelize[_0x5669('0x3')]},'src':{'type':Sequelize[_0x5669('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x5669('0x3')]},'channel':{'type':Sequelize[_0x5669('0x3')]},'dstchannel':{'type':Sequelize[_0x5669('0x3')]},'lastapp':{'type':Sequelize[_0x5669('0x3')]},'lastdata':{'type':Sequelize[_0x5669('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5669('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5669('0x3')]},'amaflags':{'type':Sequelize[_0x5669('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5669('0x3')]},'userfield':{'type':Sequelize[_0x5669('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x5669('0x3')]},'sequence':{'type':Sequelize[_0x5669('0x3')]},'peeraccount':{'type':Sequelize[_0x5669('0x3')]},'type':{'type':Sequelize[_0x5669('0x3')]},'tag':{'type':Sequelize[_0x5669('0x3')]}}; \ No newline at end of file +var _0x92f5=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x375fa9,_0x55eee1){var _0x2ffec4=function(_0x461ff3){while(--_0x461ff3){_0x375fa9['push'](_0x375fa9['shift']());}};_0x2ffec4(++_0x55eee1);}(_0x92f5,0x11f));var _0x592f=function(_0x23b1d5,_0x3043fa){_0x23b1d5=_0x23b1d5-0x0;var _0x3f5702=_0x92f5[_0x23b1d5];return _0x3f5702;};'use strict';var Sequelize=require(_0x592f('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x592f('0x1')},'clid':{'type':Sequelize[_0x592f('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x592f('0x2')]},'channel':{'type':Sequelize[_0x592f('0x2')]},'dstchannel':{'type':Sequelize[_0x592f('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x592f('0x2')]},'duration':{'type':Sequelize[_0x592f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x592f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x592f('0x2')]},'amaflags':{'type':Sequelize[_0x592f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x592f('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x592f('0x2')]},'linkedid':{'type':Sequelize[_0x592f('0x2')]},'sequence':{'type':Sequelize[_0x592f('0x2')]},'peeraccount':{'type':Sequelize[_0x592f('0x2')]},'type':{'type':Sequelize[_0x592f('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 729b59c..a5b0613 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 _0x9b9f=['status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Cdr','includeAll','rows','catch','params','rawAttributes','intersection','include','find','create','update','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0xa9ea28,_0x398a4f){var _0x83ed89=function(_0x571247){while(--_0x571247){_0xa9ea28['push'](_0xa9ea28['shift']());}};_0x83ed89(++_0x398a4f);}(_0x9b9f,0x144));var _0xf9b9=function(_0x5e4b85,_0x6cf965){_0x5e4b85=_0x5e4b85-0x0;var _0x5cd3cb=_0x9b9f[_0x5e4b85];return _0x5cd3cb;};'use strict';var pdf=require(_0xf9b9('0x0'));var emlformat=require(_0xf9b9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf9b9('0x2'));var jsonpatch=require(_0xf9b9('0x3'));var rp=require(_0xf9b9('0x4'));var moment=require('moment');var BPromise=require(_0xf9b9('0x5'));var Mustache=require(_0xf9b9('0x6'));var util=require('util');var path=require(_0xf9b9('0x7'));var sox=require('sox');var csv=require(_0xf9b9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf9b9('0x9'));var crypto=require('crypto');var jsforce=require(_0xf9b9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf9b9('0xb'));var Papa=require(_0xf9b9('0xc'));var Redis=require(_0xf9b9('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf9b9('0xe'));var hardwareService=require(_0xf9b9('0xf'));var logger=require(_0xf9b9('0x10'))(_0xf9b9('0x11'));var utils=require(_0xf9b9('0x12'));var config=require('../../config/environment');var db=require(_0xf9b9('0x13'))['db'];function respondWithStatusCode(_0x45591e,_0x565b9a){_0x565b9a=_0x565b9a||0xcc;return function(_0x46ef27){if(_0x46ef27){return _0x45591e[_0xf9b9('0x14')](_0x565b9a);}return _0x45591e[_0xf9b9('0x15')](_0x565b9a)[_0xf9b9('0x16')]();};}function respondWithResult(_0x4e716d,_0x4f91bc){_0x4f91bc=_0x4f91bc||0xc8;return function(_0x22552b){if(_0x22552b){return _0x4e716d[_0xf9b9('0x15')](_0x4f91bc)['json'](_0x22552b);}};}function respondWithFilteredResult(_0x5859ef,_0x43456a){return function(_0x34ba83){if(_0x34ba83){var _0x3ec77b=_0x34ba83[_0xf9b9('0x17')],_0xf6127=_0x43456a[_0xf9b9('0x18')],_0x4f6f4d=_0x43456a[_0xf9b9('0x18')]+_0x43456a[_0xf9b9('0x19')],_0x32e5d9;if(_0x4f6f4d>=_0x3ec77b){_0x4f6f4d=_0x3ec77b;_0x32e5d9=0xc8;}else{_0x32e5d9=0xce;}_0x5859ef['status'](_0x32e5d9);return _0x5859ef[_0xf9b9('0x1a')](_0xf9b9('0x1b'),_0xf6127+'-'+_0x4f6f4d+'/'+_0x3ec77b)[_0xf9b9('0x1c')](_0x34ba83);}return null;};}function patchUpdates(_0x299eab){return function(_0x162ada){try{jsonpatch['apply'](_0x162ada,_0x299eab,!![]);}catch(_0x1f16e9){return BPromise[_0xf9b9('0x1d')](_0x1f16e9);}return _0x162ada[_0xf9b9('0x1e')]();};}function saveUpdates(_0x5a6184,_0x3b00a9){return function(_0x304af7){if(_0x304af7){return _0x304af7['update'](_0x5a6184)[_0xf9b9('0x1f')](function(_0x3342ad){return _0x3342ad;});}return null;};}function removeEntity(_0x186429,_0x446d54){return function(_0x3dd78e){if(_0x3dd78e){return _0x3dd78e[_0xf9b9('0x20')]()[_0xf9b9('0x1f')](function(){_0x186429[_0xf9b9('0x15')](0xcc)[_0xf9b9('0x16')]();});}};}function handleEntityNotFound(_0x12aaf1,_0x1b1503){return function(_0x5619f7){if(!_0x5619f7){_0x12aaf1[_0xf9b9('0x14')](0x194);}return _0x5619f7;};}function handleError(_0x3887b9,_0x29856e){_0x29856e=_0x29856e||0x1f4;return function(_0xa50cf6){logger[_0xf9b9('0x21')](_0xa50cf6[_0xf9b9('0x22')]);if(_0xa50cf6[_0xf9b9('0x23')]){delete _0xa50cf6[_0xf9b9('0x23')];}_0x3887b9[_0xf9b9('0x15')](_0x29856e)[_0xf9b9('0x24')](_0xa50cf6);};}exports[_0xf9b9('0x25')]=function(_0x19b995,_0x558040){var _0x3f3347={},_0xc283e9={},_0x2bd1da={'count':0x0,'rows':[]};var _0xebda4c=_[_0xf9b9('0x26')](db['Cdr']['rawAttributes'],function(_0x16a3e8){return{'name':_0x16a3e8[_0xf9b9('0x27')],'type':_0x16a3e8[_0xf9b9('0x28')]['key']};});_0xc283e9[_0xf9b9('0x29')]=_[_0xf9b9('0x26')](_0xebda4c,_0xf9b9('0x23'));_0xc283e9[_0xf9b9('0x2a')]=_[_0xf9b9('0x2b')](_0x19b995[_0xf9b9('0x2a')]);_0xc283e9[_0xf9b9('0x2c')]=_['intersection'](_0xc283e9['model'],_0xc283e9[_0xf9b9('0x2a')]);_0x3f3347['attributes']=_['intersection'](_0xc283e9['model'],qs[_0xf9b9('0x2d')](_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x2d')]));_0x3f3347[_0xf9b9('0x2e')]=_0x3f3347[_0xf9b9('0x2e')][_0xf9b9('0x2f')]?_0x3f3347[_0xf9b9('0x2e')]:_0xc283e9[_0xf9b9('0x29')];if(!_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x30')](_0xf9b9('0x31'))){_0x3f3347['limit']=qs['limit'](_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x19')]);_0x3f3347[_0xf9b9('0x18')]=qs['offset'](_0x19b995['query'][_0xf9b9('0x18')]);}_0x3f3347['order']=qs[_0xf9b9('0x32')](_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x32')]);_0x3f3347[_0xf9b9('0x33')]=qs[_0xf9b9('0x2c')](_[_0xf9b9('0x34')](_0x19b995['query'],_0xc283e9['filters']),_0xebda4c);if(_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x35')]){_0x3f3347[_0xf9b9('0x33')]=_[_0xf9b9('0x36')](_0x3f3347['where'],{'$or':_[_0xf9b9('0x26')](_0xebda4c,function(_0x4da09b){if(_0x4da09b[_0xf9b9('0x28')]!=='VIRTUAL'){var _0x112748={};_0x112748[_0x4da09b[_0xf9b9('0x23')]]={'$like':'%'+_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x35')]+'%'};return _0x112748;}})});}_0x3f3347=_[_0xf9b9('0x36')]({},_0x3f3347,_0x19b995[_0xf9b9('0x37')]);var _0x41c1a5={'where':_0x3f3347[_0xf9b9('0x33')]};return db[_0xf9b9('0x38')][_0xf9b9('0x17')](_0x41c1a5)[_0xf9b9('0x1f')](function(_0x248f39){_0x2bd1da[_0xf9b9('0x17')]=_0x248f39;if(_0x19b995[_0xf9b9('0x2a')][_0xf9b9('0x39')]){_0x3f3347['include']=[{'all':!![]}];}return db[_0xf9b9('0x38')]['findAll'](_0x3f3347);})[_0xf9b9('0x1f')](function(_0x16564f){_0x2bd1da[_0xf9b9('0x3a')]=_0x16564f;return _0x2bd1da;})[_0xf9b9('0x1f')](respondWithFilteredResult(_0x558040,_0x3f3347))[_0xf9b9('0x3b')](handleError(_0x558040,null));};exports['show']=function(_0x3bd183,_0x30172a){var _0x35cfe4={'raw':!![],'where':{'id':_0x3bd183[_0xf9b9('0x3c')]['id']}},_0x3f23eb={};_0x3f23eb[_0xf9b9('0x29')]=_['keys'](db['Cdr'][_0xf9b9('0x3d')]);_0x3f23eb['query']=_[_0xf9b9('0x2b')](_0x3bd183[_0xf9b9('0x2a')]);_0x3f23eb[_0xf9b9('0x2c')]=_[_0xf9b9('0x3e')](_0x3f23eb[_0xf9b9('0x29')],_0x3f23eb[_0xf9b9('0x2a')]);_0x35cfe4[_0xf9b9('0x2e')]=_[_0xf9b9('0x3e')](_0x3f23eb[_0xf9b9('0x29')],qs[_0xf9b9('0x2d')](_0x3bd183[_0xf9b9('0x2a')][_0xf9b9('0x2d')]));_0x35cfe4['attributes']=_0x35cfe4[_0xf9b9('0x2e')][_0xf9b9('0x2f')]?_0x35cfe4[_0xf9b9('0x2e')]:_0x3f23eb[_0xf9b9('0x29')];if(_0x3bd183[_0xf9b9('0x2a')]['includeAll']){_0x35cfe4[_0xf9b9('0x3f')]=[{'all':!![]}];}_0x35cfe4=_['merge']({},_0x35cfe4,_0x3bd183[_0xf9b9('0x37')]);return db['Cdr'][_0xf9b9('0x40')](_0x35cfe4)[_0xf9b9('0x1f')](handleEntityNotFound(_0x30172a,null))[_0xf9b9('0x1f')](respondWithResult(_0x30172a,null))[_0xf9b9('0x3b')](handleError(_0x30172a,null));};exports['create']=function(_0x222bbb,_0x397bc8){return db['Cdr'][_0xf9b9('0x41')](_0x222bbb['body'],{})[_0xf9b9('0x1f')](respondWithResult(_0x397bc8,0xc9))[_0xf9b9('0x3b')](handleError(_0x397bc8,null));};exports[_0xf9b9('0x42')]=function(_0x5caa95,_0x42785e){if(_0x5caa95['body']['id']){delete _0x5caa95[_0xf9b9('0x43')]['id'];}return db['Cdr'][_0xf9b9('0x40')]({'where':{'id':_0x5caa95[_0xf9b9('0x3c')]['id']}})[_0xf9b9('0x1f')](handleEntityNotFound(_0x42785e,null))[_0xf9b9('0x1f')](saveUpdates(_0x5caa95[_0xf9b9('0x43')],null))[_0xf9b9('0x1f')](respondWithResult(_0x42785e,null))['catch'](handleError(_0x42785e,null));};exports[_0xf9b9('0x20')]=function(_0x50d202,_0x379e1c){return db[_0xf9b9('0x38')][_0xf9b9('0x40')]({'where':{'id':_0x50d202[_0xf9b9('0x3c')]['id']}})[_0xf9b9('0x1f')](handleEntityNotFound(_0x379e1c,null))[_0xf9b9('0x1f')](removeEntity(_0x379e1c,null))['catch'](handleError(_0x379e1c,null));};exports[_0xf9b9('0x44')]=function(_0x280df2,_0x26c5e2){return db[_0xf9b9('0x38')][_0xf9b9('0x44')]()[_0xf9b9('0x1f')](respondWithResult(_0x26c5e2,null))['catch'](handleError(_0x26c5e2,null));}; \ No newline at end of file +var _0x07ef=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3f43d6,_0x2efc89){var _0x1c693f=function(_0x3da47c){while(--_0x3da47c){_0x3f43d6['push'](_0x3f43d6['shift']());}};_0x1c693f(++_0x2efc89);}(_0x07ef,0x1af));var _0xf07e=function(_0x272202,_0x569e70){_0x272202=_0x272202-0x0;var _0xcad2a7=_0x07ef[_0x272202];return _0xcad2a7;};'use strict';var pdf=require(_0xf07e('0x0'));var emlformat=require(_0xf07e('0x1'));var rimraf=require(_0xf07e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf07e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf07e('0x4'));var util=require(_0xf07e('0x5'));var path=require('path');var sox=require(_0xf07e('0x6'));var csv=require(_0xf07e('0x7'));var ejs=require(_0xf07e('0x8'));var fs=require('fs');var _=require(_0xf07e('0x9'));var squel=require(_0xf07e('0xa'));var crypto=require(_0xf07e('0xb'));var jsforce=require(_0xf07e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf07e('0x7'));var querystring=require(_0xf07e('0xd'));var Papa=require(_0xf07e('0xe'));var Redis=require(_0xf07e('0xf'));var authService=require(_0xf07e('0x10'));var qs=require(_0xf07e('0x11'));var as=require(_0xf07e('0x12'));var hardwareService=require(_0xf07e('0x13'));var logger=require(_0xf07e('0x14'))(_0xf07e('0x15'));var utils=require(_0xf07e('0x16'));var config=require(_0xf07e('0x17'));var db=require(_0xf07e('0x18'))['db'];function respondWithStatusCode(_0x1bce24,_0x10e6f4){_0x10e6f4=_0x10e6f4||0xcc;return function(_0x78f1c8){if(_0x78f1c8){return _0x1bce24[_0xf07e('0x19')](_0x10e6f4);}return _0x1bce24['status'](_0x10e6f4)[_0xf07e('0x1a')]();};}function respondWithResult(_0x1591e4,_0x2b5dbd){_0x2b5dbd=_0x2b5dbd||0xc8;return function(_0x392c7f){if(_0x392c7f){return _0x1591e4[_0xf07e('0x1b')](_0x2b5dbd)[_0xf07e('0x1c')](_0x392c7f);}};}function respondWithFilteredResult(_0x541d62,_0x5151c7){return function(_0x43c2b9){if(_0x43c2b9){var _0x5a5e29=_0x43c2b9[_0xf07e('0x1d')],_0x4903df=_0x5151c7[_0xf07e('0x1e')],_0x33079d=_0x5151c7[_0xf07e('0x1e')]+_0x5151c7[_0xf07e('0x1f')],_0x55977c;if(_0x33079d>=_0x5a5e29){_0x33079d=_0x5a5e29;_0x55977c=0xc8;}else{_0x55977c=0xce;}_0x541d62[_0xf07e('0x1b')](_0x55977c);return _0x541d62[_0xf07e('0x20')]('Content-Range',_0x4903df+'-'+_0x33079d+'/'+_0x5a5e29)[_0xf07e('0x1c')](_0x43c2b9);}return null;};}function patchUpdates(_0x24af41){return function(_0x1fec25){try{jsonpatch[_0xf07e('0x21')](_0x1fec25,_0x24af41,!![]);}catch(_0x58c0d5){return BPromise['reject'](_0x58c0d5);}return _0x1fec25[_0xf07e('0x22')]();};}function saveUpdates(_0xf854d8,_0x161ce3){return function(_0x2628f0){if(_0x2628f0){return _0x2628f0[_0xf07e('0x23')](_0xf854d8)[_0xf07e('0x24')](function(_0x425e05){return _0x425e05;});}return null;};}function removeEntity(_0x4b106b,_0x9aac8a){return function(_0x40826d){if(_0x40826d){return _0x40826d[_0xf07e('0x25')]()[_0xf07e('0x24')](function(){_0x4b106b[_0xf07e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a951c,_0x3aa5fa){return function(_0x82549d){if(!_0x82549d){_0x7a951c['sendStatus'](0x194);}return _0x82549d;};}function handleError(_0x349aa2,_0x48eb4b){_0x48eb4b=_0x48eb4b||0x1f4;return function(_0x346cab){logger[_0xf07e('0x26')](_0x346cab[_0xf07e('0x27')]);if(_0x346cab[_0xf07e('0x28')]){delete _0x346cab[_0xf07e('0x28')];}_0x349aa2[_0xf07e('0x1b')](_0x48eb4b)[_0xf07e('0x29')](_0x346cab);};}exports[_0xf07e('0x2a')]=function(_0x38b0dd,_0x5b8082){var _0x339d02={},_0x379664={},_0x2ade37={'count':0x0,'rows':[]};var _0x4aae46=_['map'](db[_0xf07e('0x2b')][_0xf07e('0x2c')],function(_0x212115){return{'name':_0x212115['fieldName'],'type':_0x212115[_0xf07e('0x2d')][_0xf07e('0x2e')]};});_0x379664['model']=_['map'](_0x4aae46,'name');_0x379664['query']=_[_0xf07e('0x2f')](_0x38b0dd[_0xf07e('0x30')]);_0x379664[_0xf07e('0x31')]=_[_0xf07e('0x32')](_0x379664['model'],_0x379664[_0xf07e('0x30')]);_0x339d02[_0xf07e('0x33')]=_[_0xf07e('0x32')](_0x379664[_0xf07e('0x34')],qs[_0xf07e('0x35')](_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x35')]));_0x339d02[_0xf07e('0x33')]=_0x339d02['attributes']['length']?_0x339d02[_0xf07e('0x33')]:_0x379664['model'];if(!_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x36')](_0xf07e('0x37'))){_0x339d02['limit']=qs[_0xf07e('0x1f')](_0x38b0dd['query'][_0xf07e('0x1f')]);_0x339d02[_0xf07e('0x1e')]=qs[_0xf07e('0x1e')](_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x1e')]);}_0x339d02[_0xf07e('0x38')]=qs[_0xf07e('0x39')](_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x39')]);_0x339d02[_0xf07e('0x3a')]=qs[_0xf07e('0x31')](_[_0xf07e('0x3b')](_0x38b0dd[_0xf07e('0x30')],_0x379664['filters']),_0x4aae46);if(_0x38b0dd[_0xf07e('0x30')]['filter']){_0x339d02['where']=_[_0xf07e('0x3c')](_0x339d02[_0xf07e('0x3a')],{'$or':_['map'](_0x4aae46,function(_0x26d435){if(_0x26d435[_0xf07e('0x2d')]!==_0xf07e('0x3d')){var _0x41f3ca={};_0x41f3ca[_0x26d435['name']]={'$like':'%'+_0x38b0dd[_0xf07e('0x30')][_0xf07e('0x3e')]+'%'};return _0x41f3ca;}})});}_0x339d02=_['merge']({},_0x339d02,_0x38b0dd[_0xf07e('0x3f')]);var _0x22e851={'where':_0x339d02[_0xf07e('0x3a')]};return db[_0xf07e('0x2b')][_0xf07e('0x1d')](_0x22e851)[_0xf07e('0x24')](function(_0x31d72c){_0x2ade37[_0xf07e('0x1d')]=_0x31d72c;if(_0x38b0dd[_0xf07e('0x30')]['includeAll']){_0x339d02[_0xf07e('0x40')]=[{'all':!![]}];}return db[_0xf07e('0x2b')][_0xf07e('0x41')](_0x339d02);})[_0xf07e('0x24')](function(_0x4fea47){_0x2ade37[_0xf07e('0x42')]=_0x4fea47;return _0x2ade37;})[_0xf07e('0x24')](respondWithFilteredResult(_0x5b8082,_0x339d02))[_0xf07e('0x43')](handleError(_0x5b8082,null));};exports[_0xf07e('0x44')]=function(_0x3ecbb5,_0x3add47){var _0x14d47e={'raw':!![],'where':{'id':_0x3ecbb5[_0xf07e('0x45')]['id']}},_0x3f74fd={};_0x3f74fd[_0xf07e('0x34')]=_['keys'](db[_0xf07e('0x2b')]['rawAttributes']);_0x3f74fd['query']=_[_0xf07e('0x2f')](_0x3ecbb5[_0xf07e('0x30')]);_0x3f74fd[_0xf07e('0x31')]=_['intersection'](_0x3f74fd[_0xf07e('0x34')],_0x3f74fd[_0xf07e('0x30')]);_0x14d47e['attributes']=_['intersection'](_0x3f74fd[_0xf07e('0x34')],qs[_0xf07e('0x35')](_0x3ecbb5['query'][_0xf07e('0x35')]));_0x14d47e[_0xf07e('0x33')]=_0x14d47e['attributes'][_0xf07e('0x46')]?_0x14d47e[_0xf07e('0x33')]:_0x3f74fd['model'];if(_0x3ecbb5['query']['includeAll']){_0x14d47e[_0xf07e('0x40')]=[{'all':!![]}];}_0x14d47e=_['merge']({},_0x14d47e,_0x3ecbb5[_0xf07e('0x3f')]);return db[_0xf07e('0x2b')][_0xf07e('0x47')](_0x14d47e)['then'](handleEntityNotFound(_0x3add47,null))[_0xf07e('0x24')](respondWithResult(_0x3add47,null))[_0xf07e('0x43')](handleError(_0x3add47,null));};exports[_0xf07e('0x48')]=function(_0x838bdb,_0x31bbc1){return db[_0xf07e('0x2b')][_0xf07e('0x48')](_0x838bdb[_0xf07e('0x49')],{})[_0xf07e('0x24')](respondWithResult(_0x31bbc1,0xc9))['catch'](handleError(_0x31bbc1,null));};exports['update']=function(_0x56e7b2,_0x2d6fb0){if(_0x56e7b2['body']['id']){delete _0x56e7b2[_0xf07e('0x49')]['id'];}return db['Cdr'][_0xf07e('0x47')]({'where':{'id':_0x56e7b2['params']['id']}})[_0xf07e('0x24')](handleEntityNotFound(_0x2d6fb0,null))['then'](saveUpdates(_0x56e7b2[_0xf07e('0x49')],null))[_0xf07e('0x24')](respondWithResult(_0x2d6fb0,null))[_0xf07e('0x43')](handleError(_0x2d6fb0,null));};exports[_0xf07e('0x25')]=function(_0x2b988d,_0x370802){return db[_0xf07e('0x2b')][_0xf07e('0x47')]({'where':{'id':_0x2b988d[_0xf07e('0x45')]['id']}})['then'](handleEntityNotFound(_0x370802,null))['then'](removeEntity(_0x370802,null))[_0xf07e('0x43')](handleError(_0x370802,null));};exports[_0xf07e('0x4a')]=function(_0x585ccd,_0x4180cd){return db[_0xf07e('0x2b')][_0xf07e('0x4a')]()[_0xf07e('0x24')](respondWithResult(_0x4180cd,null))['catch'](handleError(_0x4180cd,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 484fb8b..04e9175 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 _0xefb3=['./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0xefb3,0x187));var _0x3efb=function(_0x1276c8,_0x475cfa){_0x1276c8=_0x1276c8-0x0;var _0x37451d=_0xefb3[_0x1276c8];return _0x37451d;};'use strict';var _=require(_0x3efb('0x0'));var util=require(_0x3efb('0x1'));var logger=require(_0x3efb('0x2'))(_0x3efb('0x3'));var moment=require(_0x3efb('0x4'));var BPromise=require(_0x3efb('0x5'));var rp=require(_0x3efb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3efb('0x7'));var attributes=require(_0x3efb('0x8'));module[_0x3efb('0x9')]=function(_0x1abb99,_0x293475){return _0x1abb99[_0x3efb('0xa')](_0x3efb('0xb'),attributes,{'tableName':_0x3efb('0xc'),'paranoid':![],'indexes':[{'name':_0x3efb('0xd'),'fields':[_0x3efb('0xd')]},{'name':_0x3efb('0xe'),'fields':[_0x3efb('0xe')]},{'name':'disposition','fields':[_0x3efb('0xf')]},{'name':'dst','fields':[_0x3efb('0x10')]},{'name':_0x3efb('0x11'),'fields':[_0x3efb('0x11')]},{'name':_0x3efb('0x12'),'fields':[_0x3efb('0x12')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3c20=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0x3c20,0x1e9));var _0x03c2=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x3c20[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x03c2('0x0'));var util=require(_0x03c2('0x1'));var logger=require(_0x03c2('0x2'))(_0x03c2('0x3'));var moment=require('moment');var BPromise=require(_0x03c2('0x4'));var rp=require(_0x03c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x03c2('0x6'));var attributes=require(_0x03c2('0x7'));module[_0x03c2('0x8')]=function(_0x37f15c,_0x36421c){return _0x37f15c[_0x03c2('0x9')](_0x03c2('0xa'),attributes,{'tableName':_0x03c2('0xb'),'paranoid':![],'indexes':[{'name':_0x03c2('0xc'),'fields':[_0x03c2('0xc')]},{'name':_0x03c2('0xd'),'fields':[_0x03c2('0xd')]},{'name':_0x03c2('0xe'),'fields':[_0x03c2('0xe')]},{'name':'dst','fields':[_0x03c2('0xf')]},{'name':_0x03c2('0x10'),'fields':['src']},{'name':_0x03c2('0x11'),'fields':[_0x03c2('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index e21c3a9..c729718 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 _0x335c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3d171b,_0x2cabed){var _0x40ffb4=function(_0xecde9f){while(--_0xecde9f){_0x3d171b['push'](_0x3d171b['shift']());}};_0x40ffb4(++_0x2cabed);}(_0x335c,0x13c));var _0xc335=function(_0x44c1f3,_0x5cf4a1){_0x44c1f3=_0x44c1f3-0x0;var _0x365dd9=_0x335c[_0x44c1f3];return _0x365dd9;};'use strict';var _=require('lodash');var util=require(_0xc335('0x0'));var moment=require('moment');var BPromise=require(_0xc335('0x1'));var rs=require(_0xc335('0x2'));var fs=require('fs');var Redis=require(_0xc335('0x3'));var db=require(_0xc335('0x4'))['db'];var utils=require(_0xc335('0x5'));var logger=require(_0xc335('0x6'))(_0xc335('0x7'));var config=require(_0xc335('0x8'));var jayson=require(_0xc335('0x9'));var client=jayson[_0xc335('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21cf6b,_0xf58068,_0x4050da){return new BPromise(function(_0x1e63f6,_0x5bd5a8){return client[_0xc335('0xb')](_0x21cf6b,_0x4050da)[_0xc335('0xc')](function(_0x280cf7){logger[_0xc335('0xd')](_0xc335('0xe'),_0xf58068,'request\x20sent');logger[_0xc335('0xf')](_0xc335('0x10'),_0xf58068,'request\x20sent',JSON[_0xc335('0x11')](_0x280cf7));if(_0x280cf7[_0xc335('0x12')]){if(_0x280cf7[_0xc335('0x12')][_0xc335('0x13')]===0x1f4){logger[_0xc335('0x12')](_0xc335('0xe'),_0xf58068,_0x280cf7[_0xc335('0x12')]['message']);return _0x5bd5a8(_0x280cf7[_0xc335('0x12')]['message']);}logger['error'](_0xc335('0xe'),_0xf58068,_0x280cf7[_0xc335('0x12')][_0xc335('0x14')]);return _0x1e63f6(_0x280cf7[_0xc335('0x12')]['message']);}else{logger[_0xc335('0xd')](_0xc335('0xe'),_0xf58068,_0xc335('0x15'));_0x1e63f6(_0x280cf7['result'][_0xc335('0x14')]);}})[_0xc335('0x16')](function(_0x55380d){logger['error'](_0xc335('0xe'),_0xf58068,_0x55380d);_0x5bd5a8(_0x55380d);});});} \ No newline at end of file +var _0xb99b=['Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x30436f,_0x4f13d2){var _0x7cca4b=function(_0x43c168){while(--_0x43c168){_0x30436f['push'](_0x30436f['shift']());}};_0x7cca4b(++_0x4f13d2);}(_0xb99b,0xc5));var _0xbb99=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb99b[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xbb99('0x0'));var moment=require(_0xbb99('0x1'));var BPromise=require(_0xbb99('0x2'));var rs=require(_0xbb99('0x3'));var fs=require('fs');var Redis=require(_0xbb99('0x4'));var db=require(_0xbb99('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb99('0x6'))(_0xbb99('0x7'));var config=require(_0xbb99('0x8'));var jayson=require(_0xbb99('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc2e01e,_0x86bc5a,_0xb307be){return new BPromise(function(_0x419d81,_0x28a712){return client[_0xbb99('0xa')](_0xc2e01e,_0xb307be)[_0xbb99('0xb')](function(_0x21d968){logger[_0xbb99('0xc')](_0xbb99('0xd'),_0x86bc5a,_0xbb99('0xe'));logger[_0xbb99('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x86bc5a,_0xbb99('0xe'),JSON[_0xbb99('0x10')](_0x21d968));if(_0x21d968[_0xbb99('0x11')]){if(_0x21d968[_0xbb99('0x11')][_0xbb99('0x12')]===0x1f4){logger[_0xbb99('0x11')](_0xbb99('0xd'),_0x86bc5a,_0x21d968[_0xbb99('0x11')][_0xbb99('0x13')]);return _0x28a712(_0x21d968['error'][_0xbb99('0x13')]);}logger[_0xbb99('0x11')](_0xbb99('0xd'),_0x86bc5a,_0x21d968['error'][_0xbb99('0x13')]);return _0x419d81(_0x21d968[_0xbb99('0x11')][_0xbb99('0x13')]);}else{logger[_0xbb99('0xc')](_0xbb99('0xd'),_0x86bc5a,_0xbb99('0xe'));_0x419d81(_0x21d968[_0xbb99('0x14')][_0xbb99('0x13')]);}})['catch'](function(_0x49147a){logger['error'](_0xbb99('0xd'),_0x86bc5a,_0x49147a);_0x28a712(_0x49147a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6529254..2fcc2e4 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 _0xad63=['post','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show'];(function(_0x4511ee,_0x29faa4){var _0x4f106d=function(_0x216790){while(--_0x216790){_0x4511ee['push'](_0x4511ee['shift']());}};_0x4f106d(++_0x29faa4);}(_0xad63,0xf0));var _0x3ad6=function(_0x8fb2a4,_0x55ba0f){_0x8fb2a4=_0x8fb2a4-0x0;var _0x43571f=_0xad63[_0x8fb2a4];return _0x43571f;};'use strict';var multer=require(_0x3ad6('0x0'));var util=require(_0x3ad6('0x1'));var path=require(_0x3ad6('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ad6('0x3'));var router=express['Router']();var auth=require(_0x3ad6('0x4'));var interaction=require(_0x3ad6('0x5'));var config=require('../../config/environment');var controller=require('./cdr.controller');router[_0x3ad6('0x6')]('/',auth[_0x3ad6('0x7')](),controller[_0x3ad6('0x8')]);router[_0x3ad6('0x6')](_0x3ad6('0x9'),auth[_0x3ad6('0x7')](),controller[_0x3ad6('0xa')]);router['get']('/:id',auth[_0x3ad6('0x7')](),controller[_0x3ad6('0xb')]);router[_0x3ad6('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3ad6('0xd'),auth['isAuthenticated'](),controller[_0x3ad6('0xe')]);router[_0x3ad6('0xf')](_0x3ad6('0xd'),auth[_0x3ad6('0x7')](),controller[_0x3ad6('0x10')]);module[_0x3ad6('0x11')]=router; \ No newline at end of file +var _0xdc60=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','isAuthenticated','/:id','post'];(function(_0xdcfa66,_0xd39d4a){var _0xa1bc04=function(_0x1069cb){while(--_0x1069cb){_0xdcfa66['push'](_0xdcfa66['shift']());}};_0xa1bc04(++_0xd39d4a);}(_0xdc60,0x9d));var _0x0dc6=function(_0x809dbd,_0xf5f241){_0x809dbd=_0x809dbd-0x0;var _0x5497bf=_0xdc60[_0x809dbd];return _0x5497bf;};'use strict';var multer=require(_0x0dc6('0x0'));var util=require(_0x0dc6('0x1'));var path=require(_0x0dc6('0x2'));var timeout=require(_0x0dc6('0x3'));var express=require(_0x0dc6('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0dc6('0x5'));var config=require(_0x0dc6('0x6'));var controller=require(_0x0dc6('0x7'));router[_0x0dc6('0x8')]('/',auth['isAuthenticated'](),controller[_0x0dc6('0x9')]);router['get'](_0x0dc6('0xa'),auth[_0x0dc6('0xb')](),controller['describe']);router[_0x0dc6('0x8')](_0x0dc6('0xc'),auth[_0x0dc6('0xb')](),controller['show']);router[_0x0dc6('0xd')]('/',auth[_0x0dc6('0xb')](),controller[_0x0dc6('0xe')]);router[_0x0dc6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0dc6('0x10')]);router['delete'](_0x0dc6('0xc'),auth[_0x0dc6('0xb')](),controller[_0x0dc6('0x11')]);module[_0x0dc6('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c161937..b37f360 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 _0xcb77=['*,*,*,*','sequelize','exports','INTEGER','noop','STRING'];(function(_0x1c638c,_0x3b3bff){var _0x2b2731=function(_0x1a46e8){while(--_0x1a46e8){_0x1c638c['push'](_0x1c638c['shift']());}};_0x2b2731(++_0x3b3bff);}(_0xcb77,0x157));var _0x7cb7=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0xcb77[_0x172133];return _0x2460e5;};'use strict';var Sequelize=require(_0x7cb7('0x0'));module[_0x7cb7('0x1')]={'priority':{'type':Sequelize[_0x7cb7('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7cb7('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7cb7('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7cb7('0x5')}}; \ No newline at end of file +var _0xb9d5=['INTEGER','TEXT','STRING','sequelize'];(function(_0x277a94,_0x3c5545){var _0x34968f=function(_0x4508ab){while(--_0x4508ab){_0x277a94['push'](_0x277a94['shift']());}};_0x34968f(++_0x3c5545);}(_0xb9d5,0xbf));var _0x5b9d=function(_0x4cc0a9,_0x2b96d9){_0x4cc0a9=_0x4cc0a9-0x0;var _0x21f6a3=_0xb9d5[_0x4cc0a9];return _0x21f6a3;};'use strict';var Sequelize=require(_0x5b9d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5b9d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5b9d('0x2')]()},'description':{'type':Sequelize[_0x5b9d('0x3')]},'interval':{'type':Sequelize[_0x5b9d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5ab1a59..35bb6ac 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 _0x6566=['sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../mysqldb','status','end','json','count','apply','update','then','sendStatus','error','stack','name','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','attributes','fields','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x1fc53f,_0x39f744){var _0x515190=function(_0x4bf27c){while(--_0x4bf27c){_0x1fc53f['push'](_0x1fc53f['shift']());}};_0x515190(++_0x39f744);}(_0x6566,0x1a8));var _0x6656=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x6566[_0x409353];return _0x4f4b59;};'use strict';var pdf=require(_0x6656('0x0'));var emlformat=require(_0x6656('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6656('0x2'));var rp=require(_0x6656('0x3'));var moment=require('moment');var BPromise=require(_0x6656('0x4'));var Mustache=require(_0x6656('0x5'));var util=require(_0x6656('0x6'));var path=require(_0x6656('0x7'));var sox=require(_0x6656('0x8'));var csv=require('to-csv');var ejs=require(_0x6656('0x9'));var fs=require('fs');var _=require(_0x6656('0xa'));var squel=require(_0x6656('0xb'));var crypto=require('crypto');var jsforce=require(_0x6656('0xc'));var deskjs=require(_0x6656('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6656('0xe'));var Papa=require(_0x6656('0xf'));var Redis=require(_0x6656('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6656('0x11'));var logger=require('../../config/logger')(_0x6656('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6656('0x13'))['db'];function respondWithStatusCode(_0x5d2749,_0x28e35c){_0x28e35c=_0x28e35c||0xcc;return function(_0x1dc8e0){if(_0x1dc8e0){return _0x5d2749['sendStatus'](_0x28e35c);}return _0x5d2749[_0x6656('0x14')](_0x28e35c)[_0x6656('0x15')]();};}function respondWithResult(_0xa13885,_0x445610){_0x445610=_0x445610||0xc8;return function(_0x462b2b){if(_0x462b2b){return _0xa13885[_0x6656('0x14')](_0x445610)[_0x6656('0x16')](_0x462b2b);}};}function respondWithFilteredResult(_0x32025d,_0x3f6633){return function(_0x34c1a6){if(_0x34c1a6){var _0x3294d2=_0x34c1a6[_0x6656('0x17')],_0x35dbdb=_0x3f6633['offset'],_0x4d7c0b=_0x3f6633['offset']+_0x3f6633['limit'],_0x23b4b1;if(_0x4d7c0b>=_0x3294d2){_0x4d7c0b=_0x3294d2;_0x23b4b1=0xc8;}else{_0x23b4b1=0xce;}_0x32025d[_0x6656('0x14')](_0x23b4b1);return _0x32025d['set']('Content-Range',_0x35dbdb+'-'+_0x4d7c0b+'/'+_0x3294d2)['json'](_0x34c1a6);}return null;};}function patchUpdates(_0x12e6c0){return function(_0x57fa51){try{jsonpatch[_0x6656('0x18')](_0x57fa51,_0x12e6c0,!![]);}catch(_0x303658){return BPromise['reject'](_0x303658);}return _0x57fa51['save']();};}function saveUpdates(_0x31001d,_0x59330e){return function(_0x3e2340){if(_0x3e2340){return _0x3e2340[_0x6656('0x19')](_0x31001d)[_0x6656('0x1a')](function(_0x5913eb){return _0x5913eb;});}return null;};}function removeEntity(_0x51bfbc,_0x3248d1){return function(_0x52748b){if(_0x52748b){return _0x52748b['destroy']()['then'](function(){_0x51bfbc[_0x6656('0x14')](0xcc)[_0x6656('0x15')]();});}};}function handleEntityNotFound(_0x10523d,_0x369acf){return function(_0x32a9e6){if(!_0x32a9e6){_0x10523d[_0x6656('0x1b')](0x194);}return _0x32a9e6;};}function handleError(_0x22fbf,_0x20254b){_0x20254b=_0x20254b||0x1f4;return function(_0xc5d516){logger[_0x6656('0x1c')](_0xc5d516[_0x6656('0x1d')]);if(_0xc5d516[_0x6656('0x1e')]){delete _0xc5d516[_0x6656('0x1e')];}_0x22fbf[_0x6656('0x14')](_0x20254b)['send'](_0xc5d516);};}exports[_0x6656('0x1f')]=function(_0x2fe12c,_0x156bb2){var _0x4386a6={'raw':!![],'where':{'id':_0x2fe12c[_0x6656('0x20')]['id']}},_0x2eec4d={};_0x2eec4d['model']=_[_0x6656('0x21')](db[_0x6656('0x22')][_0x6656('0x23')]);_0x2eec4d[_0x6656('0x24')]=_[_0x6656('0x21')](_0x2fe12c[_0x6656('0x24')]);_0x2eec4d['filters']=_[_0x6656('0x25')](_0x2eec4d[_0x6656('0x26')],_0x2eec4d[_0x6656('0x24')]);_0x4386a6[_0x6656('0x27')]=_[_0x6656('0x25')](_0x2eec4d[_0x6656('0x26')],qs['fields'](_0x2fe12c[_0x6656('0x24')][_0x6656('0x28')]));_0x4386a6['attributes']=_0x4386a6[_0x6656('0x27')]['length']?_0x4386a6[_0x6656('0x27')]:_0x2eec4d[_0x6656('0x26')];if(_0x2fe12c[_0x6656('0x24')][_0x6656('0x29')]){_0x4386a6[_0x6656('0x2a')]=[{'all':!![]}];}_0x4386a6=_[_0x6656('0x2b')]({},_0x4386a6,_0x2fe12c[_0x6656('0x2c')]);return db['ChatApplication'][_0x6656('0x2d')](_0x4386a6)['then'](handleEntityNotFound(_0x156bb2,null))[_0x6656('0x1a')](respondWithResult(_0x156bb2,null))[_0x6656('0x2e')](handleError(_0x156bb2,null));};exports[_0x6656('0x19')]=function(_0x4eab59,_0x4437a8){if(_0x4eab59['body']['id']){delete _0x4eab59[_0x6656('0x2f')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x4eab59['params']['id']}})[_0x6656('0x1a')](handleEntityNotFound(_0x4437a8,null))['then'](saveUpdates(_0x4eab59[_0x6656('0x2f')],null))[_0x6656('0x1a')](respondWithResult(_0x4437a8,null))[_0x6656('0x2e')](handleError(_0x4437a8,null));};exports['destroy']=function(_0x65343d,_0x16416d){return db[_0x6656('0x22')]['find']({'where':{'id':_0x65343d[_0x6656('0x20')]['id']}})[_0x6656('0x1a')](handleEntityNotFound(_0x16416d,null))[_0x6656('0x1a')](removeEntity(_0x16416d,null))[_0x6656('0x2e')](handleError(_0x16416d,null));}; \ No newline at end of file +var _0xd5a0=['../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','body','find','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x104ee4,_0x4da2e0){var _0x23bbed=function(_0x2ff4e7){while(--_0x2ff4e7){_0x104ee4['push'](_0x104ee4['shift']());}};_0x23bbed(++_0x4da2e0);}(_0xd5a0,0xc6));var _0x0d5a=function(_0xaffbc8,_0x12b840){_0xaffbc8=_0xaffbc8-0x0;var _0x366bb0=_0xd5a0[_0xaffbc8];return _0x366bb0;};'use strict';var pdf=require(_0x0d5a('0x0'));var emlformat=require(_0x0d5a('0x1'));var rimraf=require(_0x0d5a('0x2'));var zipdir=require(_0x0d5a('0x3'));var jsonpatch=require(_0x0d5a('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d5a('0x5'));var Mustache=require('mustache');var util=require(_0x0d5a('0x6'));var path=require('path');var sox=require(_0x0d5a('0x7'));var csv=require(_0x0d5a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d5a('0x9'));var squel=require(_0x0d5a('0xa'));var crypto=require(_0x0d5a('0xb'));var jsforce=require(_0x0d5a('0xc'));var deskjs=require(_0x0d5a('0xd'));var toCsv=require(_0x0d5a('0x8'));var querystring=require(_0x0d5a('0xe'));var Papa=require(_0x0d5a('0xf'));var Redis=require('ioredis');var authService=require(_0x0d5a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0d5a('0x11'));var hardwareService=require(_0x0d5a('0x12'));var logger=require('../../config/logger')(_0x0d5a('0x13'));var utils=require(_0x0d5a('0x14'));var config=require(_0x0d5a('0x15'));var db=require(_0x0d5a('0x16'))['db'];function respondWithStatusCode(_0x123e3f,_0x2cdc01){_0x2cdc01=_0x2cdc01||0xcc;return function(_0x51c864){if(_0x51c864){return _0x123e3f['sendStatus'](_0x2cdc01);}return _0x123e3f[_0x0d5a('0x17')](_0x2cdc01)[_0x0d5a('0x18')]();};}function respondWithResult(_0x1ad68c,_0x2cb2a7){_0x2cb2a7=_0x2cb2a7||0xc8;return function(_0x4085d7){if(_0x4085d7){return _0x1ad68c[_0x0d5a('0x17')](_0x2cb2a7)['json'](_0x4085d7);}};}function respondWithFilteredResult(_0x40f9bc,_0x2e4ec5){return function(_0x3a6c73){if(_0x3a6c73){var _0xbdc0e0=_0x3a6c73[_0x0d5a('0x19')],_0x3da52b=_0x2e4ec5[_0x0d5a('0x1a')],_0x3f6056=_0x2e4ec5[_0x0d5a('0x1a')]+_0x2e4ec5['limit'],_0x2b615b;if(_0x3f6056>=_0xbdc0e0){_0x3f6056=_0xbdc0e0;_0x2b615b=0xc8;}else{_0x2b615b=0xce;}_0x40f9bc['status'](_0x2b615b);return _0x40f9bc[_0x0d5a('0x1b')](_0x0d5a('0x1c'),_0x3da52b+'-'+_0x3f6056+'/'+_0xbdc0e0)[_0x0d5a('0x1d')](_0x3a6c73);}return null;};}function patchUpdates(_0x3f792d){return function(_0xc2868a){try{jsonpatch[_0x0d5a('0x1e')](_0xc2868a,_0x3f792d,!![]);}catch(_0x412c5a){return BPromise[_0x0d5a('0x1f')](_0x412c5a);}return _0xc2868a[_0x0d5a('0x20')]();};}function saveUpdates(_0x384a6f,_0x471569){return function(_0x2245ef){if(_0x2245ef){return _0x2245ef[_0x0d5a('0x21')](_0x384a6f)[_0x0d5a('0x22')](function(_0x1b40f3){return _0x1b40f3;});}return null;};}function removeEntity(_0x50587b,_0x3a069b){return function(_0xef3f55){if(_0xef3f55){return _0xef3f55[_0x0d5a('0x23')]()[_0x0d5a('0x22')](function(){_0x50587b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f548,_0x1ecad9){return function(_0x15d9bb){if(!_0x15d9bb){_0x13f548[_0x0d5a('0x24')](0x194);}return _0x15d9bb;};}function handleError(_0x3d1ade,_0x27df12){_0x27df12=_0x27df12||0x1f4;return function(_0x4b5cd6){logger[_0x0d5a('0x25')](_0x4b5cd6[_0x0d5a('0x26')]);if(_0x4b5cd6['name']){delete _0x4b5cd6[_0x0d5a('0x27')];}_0x3d1ade[_0x0d5a('0x17')](_0x27df12)['send'](_0x4b5cd6);};}exports['show']=function(_0x5648f2,_0x501010){var _0x191c56={'raw':!![],'where':{'id':_0x5648f2[_0x0d5a('0x28')]['id']}},_0x532cc1={};_0x532cc1[_0x0d5a('0x29')]=_[_0x0d5a('0x2a')](db[_0x0d5a('0x2b')][_0x0d5a('0x2c')]);_0x532cc1[_0x0d5a('0x2d')]=_[_0x0d5a('0x2a')](_0x5648f2[_0x0d5a('0x2d')]);_0x532cc1['filters']=_[_0x0d5a('0x2e')](_0x532cc1['model'],_0x532cc1[_0x0d5a('0x2d')]);_0x191c56[_0x0d5a('0x2f')]=_[_0x0d5a('0x2e')](_0x532cc1[_0x0d5a('0x29')],qs[_0x0d5a('0x30')](_0x5648f2[_0x0d5a('0x2d')][_0x0d5a('0x30')]));_0x191c56[_0x0d5a('0x2f')]=_0x191c56['attributes'][_0x0d5a('0x31')]?_0x191c56[_0x0d5a('0x2f')]:_0x532cc1[_0x0d5a('0x29')];if(_0x5648f2['query'][_0x0d5a('0x32')]){_0x191c56[_0x0d5a('0x33')]=[{'all':!![]}];}_0x191c56=_['merge']({},_0x191c56,_0x5648f2['options']);return db[_0x0d5a('0x2b')]['find'](_0x191c56)[_0x0d5a('0x22')](handleEntityNotFound(_0x501010,null))[_0x0d5a('0x22')](respondWithResult(_0x501010,null))['catch'](handleError(_0x501010,null));};exports[_0x0d5a('0x21')]=function(_0x2f2f99,_0x595992){if(_0x2f2f99['body']['id']){delete _0x2f2f99[_0x0d5a('0x34')]['id'];}return db[_0x0d5a('0x2b')][_0x0d5a('0x35')]({'where':{'id':_0x2f2f99[_0x0d5a('0x28')]['id']}})[_0x0d5a('0x22')](handleEntityNotFound(_0x595992,null))[_0x0d5a('0x22')](saveUpdates(_0x2f2f99[_0x0d5a('0x34')],null))[_0x0d5a('0x22')](respondWithResult(_0x595992,null))[_0x0d5a('0x36')](handleError(_0x595992,null));};exports[_0x0d5a('0x23')]=function(_0x30e52d,_0x2231b8){return db['ChatApplication']['find']({'where':{'id':_0x30e52d[_0x0d5a('0x28')]['id']}})[_0x0d5a('0x22')](handleEntityNotFound(_0x2231b8,null))[_0x0d5a('0x22')](removeEntity(_0x2231b8,null))['catch'](handleError(_0x2231b8,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ad35538..ed1d317 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 _0x67ab=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','ChatApplication','chat_applications','utf8mb4','lodash','../../config/logger'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x67ab,0x17e));var _0xb67a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x67ab[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xb67a('0x0'));var util=require('util');var logger=require(_0xb67a('0x1'))(_0xb67a('0x2'));var moment=require(_0xb67a('0x3'));var BPromise=require(_0xb67a('0x4'));var rp=require(_0xb67a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb67a('0x6'));var config=require(_0xb67a('0x7'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x50e012,_0x2a4e3e){return _0x50e012[_0xb67a('0x8')](_0xb67a('0x9'),attributes,{'tableName':_0xb67a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb67a('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf673=['rimraf','./chatApplication.attributes','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x54abc1,_0x1d053f){var _0x3343cb=function(_0x4a7632){while(--_0x4a7632){_0x54abc1['push'](_0x54abc1['shift']());}};_0x3343cb(++_0x1d053f);}(_0xf673,0x1ab));var _0x3f67=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xf673[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x3f67('0x0'));var util=require(_0x3f67('0x1'));var logger=require(_0x3f67('0x2'))(_0x3f67('0x3'));var moment=require(_0x3f67('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f67('0x5'));var fs=require('fs');var path=require(_0x3f67('0x6'));var rimraf=require(_0x3f67('0x7'));var config=require('../../config/environment');var attributes=require(_0x3f67('0x8'));module[_0x3f67('0x9')]=function(_0x1ea01e,_0x4bef99){return _0x1ea01e[_0x3f67('0xa')]('ChatApplication',attributes,{'tableName':_0x3f67('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f67('0xc'),'collate':_0x3f67('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index ea450d9..6deb624 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 _0x9657=['ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x9657,0x16d));var _0x7965=function(_0x3e5fa1,_0x245899){_0x3e5fa1=_0x3e5fa1-0x0;var _0x3f7eca=_0x9657[_0x3e5fa1];return _0x3f7eca;};'use strict';var _=require(_0x7965('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7965('0x1'));var rs=require(_0x7965('0x2'));var fs=require('fs');var Redis=require(_0x7965('0x3'));var db=require(_0x7965('0x4'))['db'];var utils=require(_0x7965('0x5'));var logger=require(_0x7965('0x6'))(_0x7965('0x7'));var config=require('../../config/environment');var jayson=require(_0x7965('0x8'));var client=jayson[_0x7965('0x9')][_0x7965('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123d9f,_0x21f9d9,_0x2ef1eb){return new BPromise(function(_0xc5c8a4,_0x211093){return client['request'](_0x123d9f,_0x2ef1eb)[_0x7965('0xb')](function(_0x1b5697){logger[_0x7965('0xc')]('ChatApplication,\x20%s,\x20%s',_0x21f9d9,_0x7965('0xd'));logger[_0x7965('0xe')](_0x7965('0xf'),_0x21f9d9,_0x7965('0xd'),JSON['stringify'](_0x1b5697));if(_0x1b5697[_0x7965('0x10')]){if(_0x1b5697['error'][_0x7965('0x11')]===0x1f4){logger[_0x7965('0x10')](_0x7965('0x12'),_0x21f9d9,_0x1b5697['error'][_0x7965('0x13')]);return _0x211093(_0x1b5697[_0x7965('0x10')]['message']);}logger[_0x7965('0x10')](_0x7965('0x12'),_0x21f9d9,_0x1b5697[_0x7965('0x10')][_0x7965('0x13')]);return _0xc5c8a4(_0x1b5697[_0x7965('0x10')][_0x7965('0x13')]);}else{logger[_0x7965('0xc')](_0x7965('0x12'),_0x21f9d9,_0x7965('0xd'));_0xc5c8a4(_0x1b5697['result']['message']);}})['catch'](function(_0x139908){logger[_0x7965('0x10')]('ChatApplication,\x20%s,\x20%s',_0x21f9d9,_0x139908);_0x211093(_0x139908);});});} \ No newline at end of file +var _0xcc5a=['http','then','info','ChatApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x42bda2,_0x4106ca){var _0x625d2d=function(_0x47b4ba){while(--_0x47b4ba){_0x42bda2['push'](_0x42bda2['shift']());}};_0x625d2d(++_0x4106ca);}(_0xcc5a,0xfc));var _0xacc5=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xcc5a[_0x65c50e];return _0x4573e7;};'use strict';var _=require('lodash');var util=require(_0xacc5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xacc5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xacc5('0x2'));var logger=require(_0xacc5('0x3'))(_0xacc5('0x4'));var config=require(_0xacc5('0x5'));var jayson=require(_0xacc5('0x6'));var client=jayson[_0xacc5('0x7')][_0xacc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31d9b0,_0x4c95d1,_0x577ef5){return new BPromise(function(_0x3ef719,_0xa7ec2){return client['request'](_0x31d9b0,_0x577ef5)[_0xacc5('0x9')](function(_0x50786f){logger[_0xacc5('0xa')](_0xacc5('0xb'),_0x4c95d1,'request\x20sent');logger[_0xacc5('0xc')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4c95d1,_0xacc5('0xd'),JSON[_0xacc5('0xe')](_0x50786f));if(_0x50786f[_0xacc5('0xf')]){if(_0x50786f[_0xacc5('0xf')][_0xacc5('0x10')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x4c95d1,_0x50786f[_0xacc5('0xf')][_0xacc5('0x11')]);return _0xa7ec2(_0x50786f['error'][_0xacc5('0x11')]);}logger[_0xacc5('0xf')](_0xacc5('0xb'),_0x4c95d1,_0x50786f['error'][_0xacc5('0x11')]);return _0x3ef719(_0x50786f[_0xacc5('0xf')][_0xacc5('0x11')]);}else{logger[_0xacc5('0xa')]('ChatApplication,\x20%s,\x20%s',_0x4c95d1,'request\x20sent');_0x3ef719(_0x50786f[_0xacc5('0x12')][_0xacc5('0x11')]);}})[_0xacc5('0x13')](function(_0x716566){logger[_0xacc5('0xf')](_0xacc5('0xb'),_0x4c95d1,_0x716566);_0xa7ec2(_0x716566);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 713425c..5f4aa5f 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 _0x50bf=['util','path','connect-timeout','express','Router','../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','put','update','delete','/:id','destroy','exports','multer'];(function(_0x2a96b8,_0x3fe8d8){var _0x477d5a=function(_0x21b454){while(--_0x21b454){_0x2a96b8['push'](_0x2a96b8['shift']());}};_0x477d5a(++_0x3fe8d8);}(_0x50bf,0x1cf));var _0xf50b=function(_0x2ad2ca,_0x1d2b0b){_0x2ad2ca=_0x2ad2ca-0x0;var _0x3007c5=_0x50bf[_0x2ad2ca];return _0x3007c5;};'use strict';var multer=require(_0xf50b('0x0'));var util=require(_0xf50b('0x1'));var path=require(_0xf50b('0x2'));var timeout=require(_0xf50b('0x3'));var express=require(_0xf50b('0x4'));var router=express[_0xf50b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf50b('0x6'));var config=require('../../config/environment');var controller=require(_0xf50b('0x7'));router[_0xf50b('0x8')]('/:id',auth[_0xf50b('0x9')](),controller['show']);router[_0xf50b('0xa')]('/:id',auth[_0xf50b('0x9')](),controller[_0xf50b('0xb')]);router[_0xf50b('0xc')](_0xf50b('0xd'),auth[_0xf50b('0x9')](),controller[_0xf50b('0xe')]);module[_0xf50b('0xf')]=router; \ No newline at end of file +var _0x7f24=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','show','isAuthenticated','update','delete','exports','multer','path'];(function(_0x55befb,_0x1b18ae){var _0x199366=function(_0x1f2435){while(--_0x1f2435){_0x55befb['push'](_0x55befb['shift']());}};_0x199366(++_0x1b18ae);}(_0x7f24,0x66));var _0x47f2=function(_0x377e11,_0x4bd449){_0x377e11=_0x377e11-0x0;var _0x270348=_0x7f24[_0x377e11];return _0x270348;};'use strict';var multer=require(_0x47f2('0x0'));var util=require('util');var path=require(_0x47f2('0x1'));var timeout=require(_0x47f2('0x2'));var express=require('express');var router=express[_0x47f2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x47f2('0x4'));var config=require(_0x47f2('0x5'));var controller=require(_0x47f2('0x6'));router['get'](_0x47f2('0x7'),auth['isAuthenticated'](),controller[_0x47f2('0x8')]);router['put']('/:id',auth[_0x47f2('0x9')](),controller[_0x47f2('0xa')]);router[_0x47f2('0xb')](_0x47f2('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x47f2('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 399ff8f..10f7b34 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 _0x397a=['STRING','exports'];(function(_0x4717b3,_0x4b70ac){var _0x531828=function(_0x3b5922){while(--_0x3b5922){_0x4717b3['push'](_0x4717b3['shift']());}};_0x531828(++_0x4b70ac);}(_0x397a,0xb1));var _0xa397=function(_0x47c492,_0x311a27){_0x47c492=_0x47c492-0x0;var _0x32105d=_0x397a[_0x47c492];return _0x32105d;};'use strict';var Sequelize=require('sequelize');module[_0xa397('0x0')]={'name':{'type':Sequelize[_0xa397('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa397('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd3b4=['sequelize','STRING'];(function(_0x3bc62b,_0x4fe051){var _0x444fd4=function(_0x43a37c){while(--_0x43a37c){_0x3bc62b['push'](_0x3bc62b['shift']());}};_0x444fd4(++_0x4fe051);}(_0xd3b4,0x120));var _0x4d3b=function(_0x12bb8e,_0x2e672a){_0x12bb8e=_0x12bb8e-0x0;var _0x4d5d1b=_0xd3b4[_0x12bb8e];return _0x4d5d1b;};'use strict';var Sequelize=require(_0x4d3b('0x0'));module['exports']={'name':{'type':Sequelize[_0x4d3b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4d3b('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 0106fe5..2db78aa 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 _0xad03=['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','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ChatGroup','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','findOne','User','rawAttributes','sort','getMembers','length','ids','addMessage','getMessages','$gte','split','format','eml-format','rimraf','moment','mustache','util','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','Sequelize'];(function(_0x31d06e,_0xc5dc49){var _0x39ee79=function(_0x1a432c){while(--_0x1a432c){_0x31d06e['push'](_0x31d06e['shift']());}};_0x39ee79(++_0xc5dc49);}(_0xad03,0x1ed));var _0x3ad0=function(_0x2e3b35,_0xde8054){_0x2e3b35=_0x2e3b35-0x0;var _0x268c9b=_0xad03[_0x2e3b35];return _0x268c9b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3ad0('0x0'));var rimraf=require(_0x3ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ad0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3ad0('0x3'));var util=require(_0x3ad0('0x4'));var path=require('path');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('crypto');var jsforce=require(_0x3ad0('0x5'));var deskjs=require(_0x3ad0('0x6'));var toCsv=require(_0x3ad0('0x7'));var querystring=require(_0x3ad0('0x8'));var Papa=require(_0x3ad0('0x9'));var Redis=require(_0x3ad0('0xa'));var authService=require(_0x3ad0('0xb'));var qs=require(_0x3ad0('0xc'));var as=require(_0x3ad0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3ad0('0xe'));var utils=require(_0x3ad0('0xf'));var config=require(_0x3ad0('0x10'));var db=require(_0x3ad0('0x11'))['db'];config[_0x3ad0('0x12')]=_[_0x3ad0('0x13')](config[_0x3ad0('0x12')],{'host':_0x3ad0('0x14'),'port':0x18eb});var socket=require(_0x3ad0('0x15'))(new Redis(config[_0x3ad0('0x12')]));require('./chatGroup.socket')['register'](socket);var jayson=require(_0x3ad0('0x16'));var client=jayson[_0x3ad0('0x17')][_0x3ad0('0x18')]({'port':0x232a});function checkPasswordPattern(_0x45df7c,_0x53e4ab,_0x107e96){if(_0x107e96){var _0x4f41e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f41e9[_0x3ad0('0x19')](_0x53e4ab)){return _0x45df7c;}else{throw new db[(_0x3ad0('0x1a'))]['ValidationError'](_0x3ad0('0x1b'));}}else{return _0x45df7c;}}function respondWithRpcPromise(_0x417224,_0x533463,_0x3a33d4,_0x2f1fce){return new BPromise(function(_0x5a430e,_0xcb54c8){var _0x1f2272=_0x2f1fce||client;return _0x1f2272[_0x3ad0('0x1c')](_0x417224,_0x3a33d4)['then'](function(_0x58efa2){logger[_0x3ad0('0x1d')](_0x3ad0('0x1e'),_0x533463,'request\x20sent');logger[_0x3ad0('0x1f')](_0x3ad0('0x20'),_0x533463,_0x3ad0('0x21'),JSON[_0x3ad0('0x22')](_0x58efa2));if(_0x58efa2[_0x3ad0('0x23')]){if(_0x58efa2[_0x3ad0('0x23')][_0x3ad0('0x24')]===0x1f4){logger['error'](_0x3ad0('0x1e'),_0x533463,_0x58efa2[_0x3ad0('0x23')][_0x3ad0('0x25')]);return _0xcb54c8(_0x58efa2['error'][_0x3ad0('0x25')]);}logger[_0x3ad0('0x23')](_0x3ad0('0x1e'),_0x533463,_0x58efa2[_0x3ad0('0x23')][_0x3ad0('0x25')]);return _0x5a430e(_0x58efa2[_0x3ad0('0x23')]['message']);}else{logger[_0x3ad0('0x1d')](_0x3ad0('0x1e'),_0x533463,'request\x20sent');_0x5a430e(_0x58efa2[_0x3ad0('0x26')][_0x3ad0('0x25')]);}})[_0x3ad0('0x27')](function(_0xf5918){logger['error'](_0x3ad0('0x1e'),_0x533463,_0xf5918);_0xcb54c8(_0xf5918);});});}function respondWithStatusCode(_0x125c24,_0x45ca52){_0x45ca52=_0x45ca52||0xcc;return function(_0x23b9da){if(_0x23b9da){return _0x125c24[_0x3ad0('0x28')](_0x45ca52);}return _0x125c24['status'](_0x45ca52)[_0x3ad0('0x29')]();};}function respondWithResult(_0x24ac64,_0x3c0a2c){_0x3c0a2c=_0x3c0a2c||0xc8;return function(_0x32b278){if(_0x32b278){return _0x24ac64['status'](_0x3c0a2c)[_0x3ad0('0x2a')](_0x32b278);}};}function respondWithFilteredResult(_0x3e639d,_0x2f5fc8){return function(_0xd233ba){if(_0xd233ba){var _0x382293=_0xd233ba[_0x3ad0('0x2b')],_0xb1d184=_0x2f5fc8[_0x3ad0('0x2c')],_0x428b50=_0x2f5fc8[_0x3ad0('0x2c')]+_0x2f5fc8[_0x3ad0('0x2d')],_0x12495a;if(_0x428b50>=_0x382293){_0x428b50=_0x382293;_0x12495a=0xc8;}else{_0x12495a=0xce;}_0x3e639d[_0x3ad0('0x2e')](_0x12495a);return _0x3e639d[_0x3ad0('0x2f')](_0x3ad0('0x30'),_0xb1d184+'-'+_0x428b50+'/'+_0x382293)[_0x3ad0('0x2a')](_0xd233ba);}return null;};}function patchUpdates(_0x42d71f){return function(_0x10a8cf){try{jsonpatch[_0x3ad0('0x31')](_0x10a8cf,_0x42d71f,!![]);}catch(_0x3d1590){return BPromise[_0x3ad0('0x32')](_0x3d1590);}return _0x10a8cf[_0x3ad0('0x33')]();};}function saveUpdates(_0x4c518c,_0x313a50){return function(_0x52e13f){if(_0x52e13f){return _0x52e13f[_0x3ad0('0x34')](_0x4c518c)[_0x3ad0('0x35')](function(_0x1343a8){return _0x1343a8;});}return null;};}function removeEntity(_0xc4a682,_0x46b74b){return function(_0x1931cc){if(_0x1931cc){return _0x1931cc[_0x3ad0('0x36')]()[_0x3ad0('0x35')](function(){_0xc4a682[_0x3ad0('0x2e')](0xcc)[_0x3ad0('0x29')]();});}};}function handleEntityNotFound(_0x587b6b,_0x2bec14){return function(_0x1a4104){if(!_0x1a4104){_0x587b6b[_0x3ad0('0x28')](0x194);}return _0x1a4104;};}function handleError(_0x577c38,_0x3b1400){_0x3b1400=_0x3b1400||0x1f4;return function(_0xb8e95e){logger[_0x3ad0('0x23')](_0xb8e95e['stack']);if(_0xb8e95e[_0x3ad0('0x37')]){delete _0xb8e95e[_0x3ad0('0x37')];}_0x577c38[_0x3ad0('0x2e')](_0x3b1400)[_0x3ad0('0x38')](_0xb8e95e);};}exports[_0x3ad0('0x39')]=function(_0x1cd15b,_0x4dea23){var _0x409bf1={},_0x75ab22={},_0x3e5b8e={'count':0x0,'rows':[]};var _0x38b4a9=_[_0x3ad0('0x3a')](db[_0x3ad0('0x3b')]['rawAttributes'],function(_0x20ab71){return{'name':_0x20ab71[_0x3ad0('0x3c')],'type':_0x20ab71[_0x3ad0('0x3d')]['key']};});_0x75ab22[_0x3ad0('0x3e')]=_[_0x3ad0('0x3a')](_0x38b4a9,_0x3ad0('0x37'));_0x75ab22[_0x3ad0('0x3f')]=_[_0x3ad0('0x40')](_0x1cd15b[_0x3ad0('0x3f')]);_0x75ab22[_0x3ad0('0x41')]=_[_0x3ad0('0x42')](_0x75ab22[_0x3ad0('0x3e')],_0x75ab22[_0x3ad0('0x3f')]);_0x409bf1[_0x3ad0('0x43')]=_[_0x3ad0('0x42')](_0x75ab22[_0x3ad0('0x3e')],qs['fields'](_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x44')]));_0x409bf1[_0x3ad0('0x43')]=_0x409bf1[_0x3ad0('0x43')]['length']?_0x409bf1[_0x3ad0('0x43')]:_0x75ab22[_0x3ad0('0x3e')];if(!_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x45')](_0x3ad0('0x46'))){_0x409bf1[_0x3ad0('0x2d')]=qs[_0x3ad0('0x2d')](_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x2d')]);_0x409bf1[_0x3ad0('0x2c')]=qs[_0x3ad0('0x2c')](_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x2c')]);}_0x409bf1[_0x3ad0('0x47')]=qs['sort'](_0x1cd15b[_0x3ad0('0x3f')]['sort']);_0x409bf1[_0x3ad0('0x48')]=qs[_0x3ad0('0x41')](_[_0x3ad0('0x49')](_0x1cd15b[_0x3ad0('0x3f')],_0x75ab22[_0x3ad0('0x41')]),_0x38b4a9);if(_0x1cd15b['query'][_0x3ad0('0x4a')]){_0x409bf1[_0x3ad0('0x48')]=_['merge'](_0x409bf1[_0x3ad0('0x48')],{'$or':_['map'](_0x38b4a9,function(_0x212f38){if(_0x212f38[_0x3ad0('0x3d')]!=='VIRTUAL'){var _0x5a0932={};_0x5a0932[_0x212f38[_0x3ad0('0x37')]]={'$like':'%'+_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x4a')]+'%'};return _0x5a0932;}})});}_0x409bf1=_[_0x3ad0('0x4b')]({},_0x409bf1,_0x1cd15b[_0x3ad0('0x4c')]);var _0x39b17a={'where':_0x409bf1[_0x3ad0('0x48')]};return db['ChatGroup']['count'](_0x39b17a)[_0x3ad0('0x35')](function(_0x2b8725){_0x3e5b8e[_0x3ad0('0x2b')]=_0x2b8725;if(_0x1cd15b[_0x3ad0('0x3f')][_0x3ad0('0x4d')]){_0x409bf1[_0x3ad0('0x4e')]=[{'all':!![]}];}return db[_0x3ad0('0x3b')][_0x3ad0('0x4f')](_0x409bf1);})[_0x3ad0('0x35')](function(_0x2dbac9){_0x3e5b8e[_0x3ad0('0x50')]=_0x2dbac9;return _0x3e5b8e;})[_0x3ad0('0x35')](respondWithFilteredResult(_0x4dea23,_0x409bf1))['catch'](handleError(_0x4dea23,null));};exports['show']=function(_0x4a194d,_0x2133f2){var _0x2a756f={'raw':!![],'where':{'id':_0x4a194d['params']['id']}},_0x65b8d3={};_0x65b8d3[_0x3ad0('0x3e')]=_[_0x3ad0('0x40')](db['ChatGroup']['rawAttributes']);_0x65b8d3[_0x3ad0('0x3f')]=_[_0x3ad0('0x40')](_0x4a194d[_0x3ad0('0x3f')]);_0x65b8d3['filters']=_['intersection'](_0x65b8d3[_0x3ad0('0x3e')],_0x65b8d3[_0x3ad0('0x3f')]);_0x2a756f[_0x3ad0('0x43')]=_[_0x3ad0('0x42')](_0x65b8d3[_0x3ad0('0x3e')],qs['fields'](_0x4a194d['query'][_0x3ad0('0x44')]));_0x2a756f['attributes']=_0x2a756f['attributes']['length']?_0x2a756f['attributes']:_0x65b8d3['model'];if(_0x4a194d[_0x3ad0('0x3f')][_0x3ad0('0x4d')]){_0x2a756f[_0x3ad0('0x4e')]=[{'all':!![]}];}_0x2a756f=_[_0x3ad0('0x4b')]({},_0x2a756f,_0x4a194d[_0x3ad0('0x4c')]);return db[_0x3ad0('0x3b')][_0x3ad0('0x51')](_0x2a756f)['then'](handleEntityNotFound(_0x2133f2,null))[_0x3ad0('0x35')](respondWithResult(_0x2133f2,null))[_0x3ad0('0x27')](handleError(_0x2133f2,null));};exports[_0x3ad0('0x52')]=function(_0x23c4c0,_0x46ce44){return db[_0x3ad0('0x3b')][_0x3ad0('0x52')](_0x23c4c0['body'],{})[_0x3ad0('0x35')](respondWithResult(_0x46ce44,0xc9))['catch'](handleError(_0x46ce44,null));};exports[_0x3ad0('0x34')]=function(_0x311c78,_0x5f2318){if(_0x311c78['body']['id']){delete _0x311c78[_0x3ad0('0x53')]['id'];}return db[_0x3ad0('0x3b')][_0x3ad0('0x51')]({'where':{'id':_0x311c78[_0x3ad0('0x54')]['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x5f2318,null))[_0x3ad0('0x35')](saveUpdates(_0x311c78[_0x3ad0('0x53')],null))[_0x3ad0('0x35')](respondWithResult(_0x5f2318,null))[_0x3ad0('0x27')](handleError(_0x5f2318,null));};exports['destroy']=function(_0x5b893b,_0x3c19be){return db[_0x3ad0('0x3b')][_0x3ad0('0x51')]({'where':{'id':_0x5b893b[_0x3ad0('0x54')]['id']}})['then'](handleEntityNotFound(_0x3c19be,null))[_0x3ad0('0x35')](removeEntity(_0x3c19be,null))['catch'](handleError(_0x3c19be,null));};exports[_0x3ad0('0x55')]=function(_0x48bb7a,_0x5aacb4){return db[_0x3ad0('0x3b')][_0x3ad0('0x55')]()['then'](respondWithResult(_0x5aacb4,null))[_0x3ad0('0x27')](handleError(_0x5aacb4,null));};exports[_0x3ad0('0x56')]=function(_0x420347,_0x14c5fc,_0x22401a){return db[_0x3ad0('0x57')]['count']({'where':{'ChatGroupId':_0x420347[_0x3ad0('0x54')]['id'],'ToId':_0x420347[_0x3ad0('0x58')]['id'],'read':![]}})[_0x3ad0('0x35')](function(_0xde8cd4){return{'id':_[_0x3ad0('0x59')](_0x420347[_0x3ad0('0x54')]['id']),'count':_0xde8cd4};})[_0x3ad0('0x35')](respondWithResult(_0x14c5fc,null))[_0x3ad0('0x27')](handleError(_0x14c5fc,null));};exports['addMembers']=function(_0x138ebd,_0x20acb4,_0x3ba751){return db[_0x3ad0('0x3b')]['find']({'where':{'id':_0x138ebd[_0x3ad0('0x54')]['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x20acb4,null))[_0x3ad0('0x35')](function(_0x2a452f){if(_0x2a452f){return _0x2a452f[_0x3ad0('0x5a')](_0x138ebd[_0x3ad0('0x53')]['ids'],_[_0x3ad0('0x5b')](_0x138ebd['body'],['ids','id'])||{});}})[_0x3ad0('0x35')](respondWithResult(_0x20acb4,null))['catch'](handleError(_0x20acb4,null));};exports['getMembers']=function(_0x26e7dd,_0x4f2e96,_0x6daa21){var _0x50c4e8={};var _0x437ddc={};var _0x4b978e;var _0x50641d;return db[_0x3ad0('0x3b')][_0x3ad0('0x5c')]({'where':{'id':_0x26e7dd[_0x3ad0('0x54')]['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x4f2e96,null))['then'](function(_0x2dc75b){if(_0x2dc75b){_0x4b978e=_0x2dc75b;_0x437ddc['model']=_[_0x3ad0('0x40')](db[_0x3ad0('0x5d')][_0x3ad0('0x5e')]);_0x437ddc[_0x3ad0('0x3f')]=_[_0x3ad0('0x40')](_0x26e7dd[_0x3ad0('0x3f')]);_0x437ddc[_0x3ad0('0x41')]=_['intersection'](_0x437ddc[_0x3ad0('0x3e')],_0x437ddc[_0x3ad0('0x3f')]);_0x50c4e8[_0x3ad0('0x43')]=_[_0x3ad0('0x42')](_0x437ddc['model'],qs[_0x3ad0('0x44')](_0x26e7dd['query'][_0x3ad0('0x44')]));_0x50c4e8[_0x3ad0('0x43')]=_0x50c4e8[_0x3ad0('0x43')]['length']?_0x50c4e8[_0x3ad0('0x43')]:_0x437ddc[_0x3ad0('0x3e')];_0x50c4e8['order']=qs[_0x3ad0('0x5f')](_0x26e7dd['query'][_0x3ad0('0x5f')]);_0x50c4e8[_0x3ad0('0x48')]=qs[_0x3ad0('0x41')](_['pick'](_0x26e7dd['query'],_0x437ddc[_0x3ad0('0x41')]));if(_0x26e7dd['query'][_0x3ad0('0x4a')]){_0x50c4e8[_0x3ad0('0x48')]=_[_0x3ad0('0x4b')](_0x50c4e8[_0x3ad0('0x48')],{'$or':_[_0x3ad0('0x3a')](_0x50c4e8[_0x3ad0('0x43')],function(_0x13be49){var _0x86892a={};_0x86892a[_0x13be49]={'$like':'%'+_0x26e7dd[_0x3ad0('0x3f')]['filter']+'%'};return _0x86892a;})});}_0x50c4e8=_[_0x3ad0('0x4b')]({},_0x50c4e8,_0x26e7dd[_0x3ad0('0x4c')]);return _0x4b978e[_0x3ad0('0x60')](_0x50c4e8);}})[_0x3ad0('0x35')](function(_0x3b8ad3){if(_0x3b8ad3){_0x50641d=_0x3b8ad3[_0x3ad0('0x61')];if(!_0x26e7dd[_0x3ad0('0x3f')][_0x3ad0('0x45')]('nolimit')){_0x50c4e8['limit']=qs[_0x3ad0('0x2d')](_0x26e7dd[_0x3ad0('0x3f')][_0x3ad0('0x2d')]);_0x50c4e8[_0x3ad0('0x2c')]=qs['offset'](_0x26e7dd[_0x3ad0('0x3f')]['offset']);}return _0x4b978e[_0x3ad0('0x60')](_0x50c4e8);}})[_0x3ad0('0x35')](function(_0x5ad692){if(_0x5ad692){return _0x5ad692?{'count':_0x50641d,'rows':_0x5ad692}:null;}})[_0x3ad0('0x35')](respondWithResult(_0x4f2e96,null))['catch'](handleError(_0x4f2e96,null));};exports['removeMembers']=function(_0x413f87,_0x28fa95,_0x48f713){return db[_0x3ad0('0x3b')][_0x3ad0('0x51')]({'where':{'id':_0x413f87[_0x3ad0('0x54')]['id']}})['then'](handleEntityNotFound(_0x28fa95,null))[_0x3ad0('0x35')](function(_0x5ce095){if(_0x5ce095){return _0x5ce095['removeMembers'](_0x413f87[_0x3ad0('0x3f')][_0x3ad0('0x62')]);}})[_0x3ad0('0x35')](respondWithStatusCode(_0x28fa95,null))[_0x3ad0('0x27')](handleError(_0x28fa95,null));};exports[_0x3ad0('0x63')]=function(_0x26ebaa,_0x31b69e,_0x106552){if(_0x26ebaa[_0x3ad0('0x53')]['id']){delete _0x26ebaa[_0x3ad0('0x53')]['id'];}return db[_0x3ad0('0x3b')]['find']({'where':{'id':_0x26ebaa['params']['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x31b69e,null))[_0x3ad0('0x35')](function(_0x5f0851){if(_0x5f0851){_0x26ebaa[_0x3ad0('0x53')]['ChatGroupId']=_0x5f0851['id'];return db['ChatInternalMessage'][_0x3ad0('0x52')](_0x26ebaa['body']);}})[_0x3ad0('0x35')](respondWithResult(_0x31b69e,null))[_0x3ad0('0x27')](handleError(_0x31b69e,null));};exports[_0x3ad0('0x64')]=function(_0x4d87d3,_0x450419,_0x467fcf){var _0x591ea7={};var _0xc70743={};var _0x58de10;var _0x1fcd95;return db[_0x3ad0('0x3b')][_0x3ad0('0x5c')]({'where':{'id':_0x4d87d3['params']['id']}})[_0x3ad0('0x35')](handleEntityNotFound(_0x450419,null))[_0x3ad0('0x35')](function(_0x5992f2){if(_0x5992f2){_0x58de10=_0x5992f2;_0xc70743[_0x3ad0('0x3e')]=_[_0x3ad0('0x40')](db[_0x3ad0('0x57')][_0x3ad0('0x5e')]);_0xc70743[_0x3ad0('0x3f')]=_['keys'](_0x4d87d3[_0x3ad0('0x3f')]);_0xc70743['filters']=_[_0x3ad0('0x42')](_0xc70743[_0x3ad0('0x3e')],_0xc70743[_0x3ad0('0x3f')]);_0x591ea7[_0x3ad0('0x43')]=_['intersection'](_0xc70743['model'],qs['fields'](_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x44')]));_0x591ea7[_0x3ad0('0x43')]=_0x591ea7['attributes'][_0x3ad0('0x61')]?_0x591ea7[_0x3ad0('0x43')]:_0xc70743[_0x3ad0('0x3e')];_0x591ea7[_0x3ad0('0x47')]=qs['sort'](_0x4d87d3['query']['sort']);_0x591ea7[_0x3ad0('0x48')]=qs[_0x3ad0('0x41')](_[_0x3ad0('0x49')](_0x4d87d3[_0x3ad0('0x3f')],_0xc70743[_0x3ad0('0x41')]));if(_0x4d87d3[_0x3ad0('0x3f')]['filter']){_0x591ea7['where']=_[_0x3ad0('0x4b')](_0x591ea7[_0x3ad0('0x48')],{'$or':_[_0x3ad0('0x3a')](_0x591ea7['attributes'],function(_0x2c8c4e){var _0x485230={};_0x485230[_0x2c8c4e]={'$like':'%'+_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x4a')]+'%'};return _0x485230;})});}if(_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x65')]){var _0x758f47=_0x4d87d3[_0x3ad0('0x3f')]['$gte'][_0x3ad0('0x66')](',');var _0xc699da={};_0xc699da[_0x758f47[0x0]]={'$gte':moment(_0x758f47[0x1])[_0x3ad0('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};_0x591ea7[_0x3ad0('0x48')]=_[_0x3ad0('0x4b')](_0x591ea7[_0x3ad0('0x48')],_0xc699da);}_0x591ea7=_[_0x3ad0('0x4b')]({},_0x591ea7,_0x4d87d3['options']);return _0x58de10[_0x3ad0('0x64')](_0x591ea7);}})[_0x3ad0('0x35')](function(_0x37a856){if(_0x37a856){_0x1fcd95=_0x37a856['length'];if(!_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x45')](_0x3ad0('0x46'))){_0x591ea7[_0x3ad0('0x2d')]=qs[_0x3ad0('0x2d')](_0x4d87d3[_0x3ad0('0x3f')][_0x3ad0('0x2d')]);_0x591ea7['offset']=qs[_0x3ad0('0x2c')](_0x4d87d3[_0x3ad0('0x3f')]['offset']);}return _0x58de10['getMessages'](_0x591ea7);}})['then'](function(_0x1ad2a2){if(_0x1ad2a2){return _0x1ad2a2?{'count':_0x1fcd95,'rows':_0x1ad2a2}:null;}})[_0x3ad0('0x35')](respondWithResult(_0x450419,null))['catch'](handleError(_0x450419,null));}; \ No newline at end of file +var _0x3932=['includeAll','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','length','sort','removeMembers','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','end','json','count','offset','set','apply','reject','save','update','destroy','status','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','where','pick','VIRTUAL','filter','merge','options','ChatGroup','include','show','params'];(function(_0x5853e3,_0x2ed107){var _0x2c09e4=function(_0x52243e){while(--_0x52243e){_0x5853e3['push'](_0x5853e3['shift']());}};_0x2c09e4(++_0x2ed107);}(_0x3932,0x7f));var _0x2393=function(_0x4c0e62,_0x378d17){_0x4c0e62=_0x4c0e62-0x0;var _0x770cbb=_0x3932[_0x4c0e62];return _0x770cbb;};'use strict';var pdf=require(_0x2393('0x0'));var emlformat=require(_0x2393('0x1'));var rimraf=require(_0x2393('0x2'));var zipdir=require(_0x2393('0x3'));var jsonpatch=require(_0x2393('0x4'));var rp=require(_0x2393('0x5'));var moment=require(_0x2393('0x6'));var BPromise=require(_0x2393('0x7'));var Mustache=require('mustache');var util=require(_0x2393('0x8'));var path=require(_0x2393('0x9'));var sox=require(_0x2393('0xa'));var csv=require(_0x2393('0xb'));var ejs=require(_0x2393('0xc'));var fs=require('fs');var _=require(_0x2393('0xd'));var squel=require(_0x2393('0xe'));var crypto=require('crypto');var jsforce=require(_0x2393('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2393('0xb'));var querystring=require(_0x2393('0x10'));var Papa=require(_0x2393('0x11'));var Redis=require(_0x2393('0x12'));var authService=require(_0x2393('0x13'));var qs=require(_0x2393('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2393('0x15'))(_0x2393('0x16'));var utils=require(_0x2393('0x17'));var config=require(_0x2393('0x18'));var db=require('../../mysqldb')['db'];config[_0x2393('0x19')]=_[_0x2393('0x1a')](config[_0x2393('0x19')],{'host':_0x2393('0x1b'),'port':0x18eb});var socket=require(_0x2393('0x1c'))(new Redis(config[_0x2393('0x19')]));require(_0x2393('0x1d'))[_0x2393('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2393('0x1f')][_0x2393('0x20')]({'port':0x232a});function checkPasswordPattern(_0x41f1c8,_0x184fc5,_0x1a957d){if(_0x1a957d){var _0x37dfc3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37dfc3['test'](_0x184fc5)){return _0x41f1c8;}else{throw new db['Sequelize'][(_0x2393('0x21'))](_0x2393('0x22'));}}else{return _0x41f1c8;}}function respondWithRpcPromise(_0x392930,_0x45101b,_0x362e13,_0x1cb1eb){return new BPromise(function(_0x112035,_0x7ffd9f){var _0x1e1ffa=_0x1cb1eb||client;return _0x1e1ffa[_0x2393('0x23')](_0x392930,_0x362e13)[_0x2393('0x24')](function(_0x511e11){logger['info'](_0x2393('0x25'),_0x45101b,_0x2393('0x26'));logger[_0x2393('0x27')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x45101b,_0x2393('0x26'),JSON['stringify'](_0x511e11));if(_0x511e11['error']){if(_0x511e11[_0x2393('0x28')][_0x2393('0x29')]===0x1f4){logger[_0x2393('0x28')]('ChatGroup,\x20%s,\x20%s',_0x45101b,_0x511e11[_0x2393('0x28')][_0x2393('0x2a')]);return _0x7ffd9f(_0x511e11[_0x2393('0x28')][_0x2393('0x2a')]);}logger[_0x2393('0x28')](_0x2393('0x25'),_0x45101b,_0x511e11['error']['message']);return _0x112035(_0x511e11[_0x2393('0x28')][_0x2393('0x2a')]);}else{logger['info'](_0x2393('0x25'),_0x45101b,_0x2393('0x26'));_0x112035(_0x511e11[_0x2393('0x2b')][_0x2393('0x2a')]);}})[_0x2393('0x2c')](function(_0x568e2a){logger[_0x2393('0x28')](_0x2393('0x25'),_0x45101b,_0x568e2a);_0x7ffd9f(_0x568e2a);});});}function respondWithStatusCode(_0x14ba00,_0x2d7f89){_0x2d7f89=_0x2d7f89||0xcc;return function(_0x30726b){if(_0x30726b){return _0x14ba00[_0x2393('0x2d')](_0x2d7f89);}return _0x14ba00['status'](_0x2d7f89)[_0x2393('0x2e')]();};}function respondWithResult(_0xfa01f5,_0x458d4e){_0x458d4e=_0x458d4e||0xc8;return function(_0x2ae9ca){if(_0x2ae9ca){return _0xfa01f5['status'](_0x458d4e)[_0x2393('0x2f')](_0x2ae9ca);}};}function respondWithFilteredResult(_0x5dbe9d,_0x4732a0){return function(_0xd48553){if(_0xd48553){var _0x462d22=_0xd48553[_0x2393('0x30')],_0x591fa8=_0x4732a0[_0x2393('0x31')],_0x8c0472=_0x4732a0['offset']+_0x4732a0['limit'],_0x2f4247;if(_0x8c0472>=_0x462d22){_0x8c0472=_0x462d22;_0x2f4247=0xc8;}else{_0x2f4247=0xce;}_0x5dbe9d['status'](_0x2f4247);return _0x5dbe9d[_0x2393('0x32')]('Content-Range',_0x591fa8+'-'+_0x8c0472+'/'+_0x462d22)[_0x2393('0x2f')](_0xd48553);}return null;};}function patchUpdates(_0x214aad){return function(_0x5a4f05){try{jsonpatch[_0x2393('0x33')](_0x5a4f05,_0x214aad,!![]);}catch(_0xd9cf2c){return BPromise[_0x2393('0x34')](_0xd9cf2c);}return _0x5a4f05[_0x2393('0x35')]();};}function saveUpdates(_0xc47f3e,_0x251f56){return function(_0x57d6e9){if(_0x57d6e9){return _0x57d6e9[_0x2393('0x36')](_0xc47f3e)['then'](function(_0x25cdf9){return _0x25cdf9;});}return null;};}function removeEntity(_0x38292e,_0x1eac16){return function(_0x226ca1){if(_0x226ca1){return _0x226ca1[_0x2393('0x37')]()[_0x2393('0x24')](function(){_0x38292e[_0x2393('0x38')](0xcc)[_0x2393('0x2e')]();});}};}function handleEntityNotFound(_0x3be209,_0x114e8f){return function(_0x542f96){if(!_0x542f96){_0x3be209['sendStatus'](0x194);}return _0x542f96;};}function handleError(_0x907cb0,_0x42f5b6){_0x42f5b6=_0x42f5b6||0x1f4;return function(_0x29337){logger[_0x2393('0x28')](_0x29337[_0x2393('0x39')]);if(_0x29337[_0x2393('0x3a')]){delete _0x29337[_0x2393('0x3a')];}_0x907cb0[_0x2393('0x38')](_0x42f5b6)[_0x2393('0x3b')](_0x29337);};}exports[_0x2393('0x3c')]=function(_0x4103d4,_0x1acc6f){var _0x150390={},_0x2d419e={},_0x2d2196={'count':0x0,'rows':[]};var _0x8b0500=_[_0x2393('0x3d')](db['ChatGroup'][_0x2393('0x3e')],function(_0x15db5a){return{'name':_0x15db5a[_0x2393('0x3f')],'type':_0x15db5a[_0x2393('0x40')][_0x2393('0x41')]};});_0x2d419e[_0x2393('0x42')]=_[_0x2393('0x3d')](_0x8b0500,'name');_0x2d419e[_0x2393('0x43')]=_[_0x2393('0x44')](_0x4103d4[_0x2393('0x43')]);_0x2d419e[_0x2393('0x45')]=_[_0x2393('0x46')](_0x2d419e[_0x2393('0x42')],_0x2d419e[_0x2393('0x43')]);_0x150390['attributes']=_[_0x2393('0x46')](_0x2d419e[_0x2393('0x42')],qs[_0x2393('0x47')](_0x4103d4[_0x2393('0x43')][_0x2393('0x47')]));_0x150390[_0x2393('0x48')]=_0x150390['attributes']['length']?_0x150390[_0x2393('0x48')]:_0x2d419e[_0x2393('0x42')];if(!_0x4103d4[_0x2393('0x43')][_0x2393('0x49')](_0x2393('0x4a'))){_0x150390[_0x2393('0x4b')]=qs[_0x2393('0x4b')](_0x4103d4['query'][_0x2393('0x4b')]);_0x150390[_0x2393('0x31')]=qs[_0x2393('0x31')](_0x4103d4[_0x2393('0x43')]['offset']);}_0x150390[_0x2393('0x4c')]=qs['sort'](_0x4103d4['query']['sort']);_0x150390[_0x2393('0x4d')]=qs[_0x2393('0x45')](_[_0x2393('0x4e')](_0x4103d4['query'],_0x2d419e[_0x2393('0x45')]),_0x8b0500);if(_0x4103d4[_0x2393('0x43')]['filter']){_0x150390[_0x2393('0x4d')]=_['merge'](_0x150390['where'],{'$or':_[_0x2393('0x3d')](_0x8b0500,function(_0xabe166){if(_0xabe166[_0x2393('0x40')]!==_0x2393('0x4f')){var _0x599226={};_0x599226[_0xabe166[_0x2393('0x3a')]]={'$like':'%'+_0x4103d4[_0x2393('0x43')][_0x2393('0x50')]+'%'};return _0x599226;}})});}_0x150390=_[_0x2393('0x51')]({},_0x150390,_0x4103d4[_0x2393('0x52')]);var _0x536a0e={'where':_0x150390[_0x2393('0x4d')]};return db[_0x2393('0x53')]['count'](_0x536a0e)[_0x2393('0x24')](function(_0x5af617){_0x2d2196['count']=_0x5af617;if(_0x4103d4[_0x2393('0x43')]['includeAll']){_0x150390[_0x2393('0x54')]=[{'all':!![]}];}return db[_0x2393('0x53')]['findAll'](_0x150390);})[_0x2393('0x24')](function(_0x53423b){_0x2d2196['rows']=_0x53423b;return _0x2d2196;})[_0x2393('0x24')](respondWithFilteredResult(_0x1acc6f,_0x150390))['catch'](handleError(_0x1acc6f,null));};exports[_0x2393('0x55')]=function(_0x2ad286,_0x23ac22){var _0x46afb0={'raw':!![],'where':{'id':_0x2ad286[_0x2393('0x56')]['id']}},_0x3fdc9c={};_0x3fdc9c['model']=_[_0x2393('0x44')](db['ChatGroup']['rawAttributes']);_0x3fdc9c[_0x2393('0x43')]=_['keys'](_0x2ad286[_0x2393('0x43')]);_0x3fdc9c[_0x2393('0x45')]=_[_0x2393('0x46')](_0x3fdc9c['model'],_0x3fdc9c[_0x2393('0x43')]);_0x46afb0[_0x2393('0x48')]=_[_0x2393('0x46')](_0x3fdc9c[_0x2393('0x42')],qs[_0x2393('0x47')](_0x2ad286[_0x2393('0x43')][_0x2393('0x47')]));_0x46afb0['attributes']=_0x46afb0[_0x2393('0x48')]['length']?_0x46afb0[_0x2393('0x48')]:_0x3fdc9c['model'];if(_0x2ad286[_0x2393('0x43')][_0x2393('0x57')]){_0x46afb0[_0x2393('0x54')]=[{'all':!![]}];}_0x46afb0=_[_0x2393('0x51')]({},_0x46afb0,_0x2ad286['options']);return db['ChatGroup']['find'](_0x46afb0)[_0x2393('0x24')](handleEntityNotFound(_0x23ac22,null))['then'](respondWithResult(_0x23ac22,null))[_0x2393('0x2c')](handleError(_0x23ac22,null));};exports[_0x2393('0x58')]=function(_0x2c635b,_0x4ca406){return db[_0x2393('0x53')][_0x2393('0x58')](_0x2c635b[_0x2393('0x59')],{})[_0x2393('0x24')](respondWithResult(_0x4ca406,0xc9))['catch'](handleError(_0x4ca406,null));};exports[_0x2393('0x36')]=function(_0x5ecedc,_0x1bb087){if(_0x5ecedc[_0x2393('0x59')]['id']){delete _0x5ecedc[_0x2393('0x59')]['id'];}return db[_0x2393('0x53')][_0x2393('0x5a')]({'where':{'id':_0x5ecedc[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x1bb087,null))[_0x2393('0x24')](saveUpdates(_0x5ecedc[_0x2393('0x59')],null))[_0x2393('0x24')](respondWithResult(_0x1bb087,null))['catch'](handleError(_0x1bb087,null));};exports['destroy']=function(_0x17f8c6,_0x18a90d){return db['ChatGroup'][_0x2393('0x5a')]({'where':{'id':_0x17f8c6[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x18a90d,null))[_0x2393('0x24')](removeEntity(_0x18a90d,null))[_0x2393('0x2c')](handleError(_0x18a90d,null));};exports[_0x2393('0x5b')]=function(_0x2d0419,_0x1957f3){return db[_0x2393('0x53')][_0x2393('0x5b')]()[_0x2393('0x24')](respondWithResult(_0x1957f3,null))[_0x2393('0x2c')](handleError(_0x1957f3,null));};exports[_0x2393('0x5c')]=function(_0x4434b6,_0x162fc5,_0x37c9d5){return db[_0x2393('0x5d')][_0x2393('0x30')]({'where':{'ChatGroupId':_0x4434b6[_0x2393('0x56')]['id'],'ToId':_0x4434b6[_0x2393('0x5e')]['id'],'read':![]}})[_0x2393('0x24')](function(_0x3d49cc){return{'id':_[_0x2393('0x5f')](_0x4434b6[_0x2393('0x56')]['id']),'count':_0x3d49cc};})[_0x2393('0x24')](respondWithResult(_0x162fc5,null))[_0x2393('0x2c')](handleError(_0x162fc5,null));};exports['addMembers']=function(_0xae328b,_0x4f1ec7,_0x1c8a3){return db['ChatGroup'][_0x2393('0x5a')]({'where':{'id':_0xae328b[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x4f1ec7,null))[_0x2393('0x24')](function(_0x586e3f){if(_0x586e3f){return _0x586e3f[_0x2393('0x60')](_0xae328b[_0x2393('0x59')][_0x2393('0x61')],_[_0x2393('0x62')](_0xae328b[_0x2393('0x59')],[_0x2393('0x61'),'id'])||{});}})[_0x2393('0x24')](respondWithResult(_0x4f1ec7,null))['catch'](handleError(_0x4f1ec7,null));};exports[_0x2393('0x63')]=function(_0x26ffad,_0x184d72,_0x3564bd){var _0x58b239={};var _0x1113d4={};var _0x2a8837;var _0x10d7b6;return db['ChatGroup']['findOne']({'where':{'id':_0x26ffad['params']['id']}})['then'](handleEntityNotFound(_0x184d72,null))['then'](function(_0x344be7){if(_0x344be7){_0x2a8837=_0x344be7;_0x1113d4[_0x2393('0x42')]=_['keys'](db['User'][_0x2393('0x3e')]);_0x1113d4[_0x2393('0x43')]=_[_0x2393('0x44')](_0x26ffad['query']);_0x1113d4[_0x2393('0x45')]=_[_0x2393('0x46')](_0x1113d4[_0x2393('0x42')],_0x1113d4[_0x2393('0x43')]);_0x58b239[_0x2393('0x48')]=_[_0x2393('0x46')](_0x1113d4[_0x2393('0x42')],qs[_0x2393('0x47')](_0x26ffad['query'][_0x2393('0x47')]));_0x58b239['attributes']=_0x58b239[_0x2393('0x48')][_0x2393('0x64')]?_0x58b239[_0x2393('0x48')]:_0x1113d4[_0x2393('0x42')];_0x58b239[_0x2393('0x4c')]=qs[_0x2393('0x65')](_0x26ffad[_0x2393('0x43')][_0x2393('0x65')]);_0x58b239[_0x2393('0x4d')]=qs[_0x2393('0x45')](_[_0x2393('0x4e')](_0x26ffad[_0x2393('0x43')],_0x1113d4[_0x2393('0x45')]));if(_0x26ffad[_0x2393('0x43')][_0x2393('0x50')]){_0x58b239['where']=_['merge'](_0x58b239[_0x2393('0x4d')],{'$or':_['map'](_0x58b239[_0x2393('0x48')],function(_0x25fc4b){var _0x395a0d={};_0x395a0d[_0x25fc4b]={'$like':'%'+_0x26ffad[_0x2393('0x43')][_0x2393('0x50')]+'%'};return _0x395a0d;})});}_0x58b239=_['merge']({},_0x58b239,_0x26ffad['options']);return _0x2a8837[_0x2393('0x63')](_0x58b239);}})[_0x2393('0x24')](function(_0x5e5210){if(_0x5e5210){_0x10d7b6=_0x5e5210[_0x2393('0x64')];if(!_0x26ffad[_0x2393('0x43')][_0x2393('0x49')](_0x2393('0x4a'))){_0x58b239[_0x2393('0x4b')]=qs[_0x2393('0x4b')](_0x26ffad[_0x2393('0x43')][_0x2393('0x4b')]);_0x58b239[_0x2393('0x31')]=qs[_0x2393('0x31')](_0x26ffad[_0x2393('0x43')]['offset']);}return _0x2a8837['getMembers'](_0x58b239);}})['then'](function(_0x742f5f){if(_0x742f5f){return _0x742f5f?{'count':_0x10d7b6,'rows':_0x742f5f}:null;}})['then'](respondWithResult(_0x184d72,null))['catch'](handleError(_0x184d72,null));};exports['removeMembers']=function(_0x37afd3,_0x216db8,_0x5cfc80){return db[_0x2393('0x53')]['find']({'where':{'id':_0x37afd3[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x216db8,null))[_0x2393('0x24')](function(_0x5dbe32){if(_0x5dbe32){return _0x5dbe32[_0x2393('0x66')](_0x37afd3[_0x2393('0x43')][_0x2393('0x61')]);}})[_0x2393('0x24')](respondWithStatusCode(_0x216db8,null))['catch'](handleError(_0x216db8,null));};exports['addMessage']=function(_0x308daf,_0x50613d,_0x1e7ceb){if(_0x308daf[_0x2393('0x59')]['id']){delete _0x308daf['body']['id'];}return db[_0x2393('0x53')][_0x2393('0x5a')]({'where':{'id':_0x308daf['params']['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x50613d,null))['then'](function(_0x1bfe1c){if(_0x1bfe1c){_0x308daf[_0x2393('0x59')]['ChatGroupId']=_0x1bfe1c['id'];return db[_0x2393('0x5d')][_0x2393('0x58')](_0x308daf['body']);}})[_0x2393('0x24')](respondWithResult(_0x50613d,null))[_0x2393('0x2c')](handleError(_0x50613d,null));};exports[_0x2393('0x67')]=function(_0xcf8651,_0x35ebde,_0x459099){var _0x43e2ab={};var _0x1f54a9={};var _0x283d72;var _0x10b83e;return db[_0x2393('0x53')]['findOne']({'where':{'id':_0xcf8651[_0x2393('0x56')]['id']}})[_0x2393('0x24')](handleEntityNotFound(_0x35ebde,null))[_0x2393('0x24')](function(_0x37acc6){if(_0x37acc6){_0x283d72=_0x37acc6;_0x1f54a9['model']=_[_0x2393('0x44')](db[_0x2393('0x5d')][_0x2393('0x3e')]);_0x1f54a9[_0x2393('0x43')]=_[_0x2393('0x44')](_0xcf8651[_0x2393('0x43')]);_0x1f54a9[_0x2393('0x45')]=_[_0x2393('0x46')](_0x1f54a9['model'],_0x1f54a9[_0x2393('0x43')]);_0x43e2ab[_0x2393('0x48')]=_['intersection'](_0x1f54a9[_0x2393('0x42')],qs[_0x2393('0x47')](_0xcf8651[_0x2393('0x43')][_0x2393('0x47')]));_0x43e2ab[_0x2393('0x48')]=_0x43e2ab['attributes'][_0x2393('0x64')]?_0x43e2ab['attributes']:_0x1f54a9['model'];_0x43e2ab['order']=qs[_0x2393('0x65')](_0xcf8651[_0x2393('0x43')][_0x2393('0x65')]);_0x43e2ab[_0x2393('0x4d')]=qs[_0x2393('0x45')](_['pick'](_0xcf8651[_0x2393('0x43')],_0x1f54a9[_0x2393('0x45')]));if(_0xcf8651[_0x2393('0x43')][_0x2393('0x50')]){_0x43e2ab[_0x2393('0x4d')]=_['merge'](_0x43e2ab['where'],{'$or':_['map'](_0x43e2ab['attributes'],function(_0x5b0b9c){var _0x20a40c={};_0x20a40c[_0x5b0b9c]={'$like':'%'+_0xcf8651[_0x2393('0x43')][_0x2393('0x50')]+'%'};return _0x20a40c;})});}if(_0xcf8651[_0x2393('0x43')][_0x2393('0x68')]){var _0x5da879=_0xcf8651[_0x2393('0x43')][_0x2393('0x68')][_0x2393('0x69')](',');var _0x5e0ee9={};_0x5e0ee9[_0x5da879[0x0]]={'$gte':moment(_0x5da879[0x1])['format'](_0x2393('0x6a'))};_0x43e2ab[_0x2393('0x4d')]=_[_0x2393('0x51')](_0x43e2ab[_0x2393('0x4d')],_0x5e0ee9);}_0x43e2ab=_[_0x2393('0x51')]({},_0x43e2ab,_0xcf8651['options']);return _0x283d72[_0x2393('0x67')](_0x43e2ab);}})['then'](function(_0x153244){if(_0x153244){_0x10b83e=_0x153244[_0x2393('0x64')];if(!_0xcf8651[_0x2393('0x43')][_0x2393('0x49')](_0x2393('0x4a'))){_0x43e2ab['limit']=qs[_0x2393('0x4b')](_0xcf8651[_0x2393('0x43')][_0x2393('0x4b')]);_0x43e2ab[_0x2393('0x31')]=qs[_0x2393('0x31')](_0xcf8651[_0x2393('0x43')][_0x2393('0x31')]);}return _0x283d72[_0x2393('0x67')](_0x43e2ab);}})[_0x2393('0x24')](function(_0x3226a8){if(_0x3226a8){return _0x3226a8?{'count':_0x10b83e,'rows':_0x3226a8}:null;}})[_0x2393('0x24')](respondWithResult(_0x35ebde,null))[_0x2393('0x2c')](handleError(_0x35ebde,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 74812fa..91fcf4b 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2032,0xd9));var _0x2203=function(_0x577c32,_0x42696e){_0x577c32=_0x577c32-0x0;var _0x387013=_0x2032[_0x577c32];return _0x387013;};'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 _0xb10b=['hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0xb066af,_0x5b9f1e){var _0x42ca5a=function(_0x5281eb){while(--_0x5281eb){_0xb066af['push'](_0xb066af['shift']());}};_0x42ca5a(++_0x5b9f1e);}(_0xb10b,0x12a));var _0xbb10=function(_0x24d22f,_0xfa6241){_0x24d22f=_0x24d22f-0x0;var _0x33b153=_0xb10b[_0x24d22f];return _0x33b153;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatGroupEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatGroupEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatGroup[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 8f48005..d7eb392 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 _0x8c46=['api','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8c46,0x171));var _0x68c4=function(_0x51e5bd,_0x3c2cf1){_0x51e5bd=_0x51e5bd-0x0;var _0x250aed=_0x8c46[_0x51e5bd];return _0x250aed;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68c4('0x2'));var fs=require('fs');var path=require(_0x68c4('0x3'));var rimraf=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var attributes=require(_0x68c4('0x6'));module[_0x68c4('0x7')]=function(_0x40ce21,_0x1516cf){return _0x40ce21[_0x68c4('0x8')](_0x68c4('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa751=['chat_groups','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','ChatGroup'];(function(_0x25a92f,_0x352bf0){var _0x1e43fe=function(_0x467615){while(--_0x467615){_0x25a92f['push'](_0x25a92f['shift']());}};_0x1e43fe(++_0x352bf0);}(_0xa751,0x175));var _0x1a75=function(_0x5c59c7,_0xa2f0f6){_0x5c59c7=_0x5c59c7-0x0;var _0x1ffa06=_0xa751[_0x5c59c7];return _0x1ffa06;};'use strict';var _=require(_0x1a75('0x0'));var util=require(_0x1a75('0x1'));var logger=require(_0x1a75('0x2'))(_0x1a75('0x3'));var moment=require('moment');var BPromise=require(_0x1a75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a75('0x5'));var rimraf=require(_0x1a75('0x6'));var config=require(_0x1a75('0x7'));var attributes=require('./chatGroup.attributes');module[_0x1a75('0x8')]=function(_0x220b14,_0x1719c1){return _0x220b14[_0x1a75('0x9')](_0x1a75('0xa'),attributes,{'tableName':_0x1a75('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 6adbfb4..cfd271f 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 _0x7932=['debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent'];(function(_0xfb1529,_0x292479){var _0x27b42c=function(_0x59338e){while(--_0x59338e){_0xfb1529['push'](_0xfb1529['shift']());}};_0x27b42c(++_0x292479);}(_0x7932,0x170));var _0x2793=function(_0x118b5c,_0x58bfef){_0x118b5c=_0x118b5c-0x0;var _0x55d084=_0x7932[_0x118b5c];return _0x55d084;};'use strict';var _=require(_0x2793('0x0'));var util=require('util');var moment=require(_0x2793('0x1'));var BPromise=require(_0x2793('0x2'));var rs=require(_0x2793('0x3'));var fs=require('fs');var Redis=require(_0x2793('0x4'));var db=require(_0x2793('0x5'))['db'];var utils=require(_0x2793('0x6'));var logger=require(_0x2793('0x7'))(_0x2793('0x8'));var config=require(_0x2793('0x9'));var jayson=require(_0x2793('0xa'));var client=jayson[_0x2793('0xb')]['http']({'port':0x232a});config[_0x2793('0xc')]=_[_0x2793('0xd')](config[_0x2793('0xc')],{'host':_0x2793('0xe'),'port':0x18eb});var socket=require(_0x2793('0xf'))(new Redis(config[_0x2793('0xc')]));require(_0x2793('0x10'))[_0x2793('0x11')](socket);function respondWithRpcPromise(_0x3ac992,_0x1c949a,_0x5b78a2){return new BPromise(function(_0xd2f07c,_0x334ce5){return client[_0x2793('0x12')](_0x3ac992,_0x5b78a2)[_0x2793('0x13')](function(_0x50fe93){logger[_0x2793('0x14')]('ChatGroup,\x20%s,\x20%s',_0x1c949a,_0x2793('0x15'));logger[_0x2793('0x16')](_0x2793('0x17'),_0x1c949a,'request\x20sent',JSON[_0x2793('0x18')](_0x50fe93));if(_0x50fe93[_0x2793('0x19')]){if(_0x50fe93[_0x2793('0x19')][_0x2793('0x1a')]===0x1f4){logger[_0x2793('0x19')](_0x2793('0x1b'),_0x1c949a,_0x50fe93[_0x2793('0x19')][_0x2793('0x1c')]);return _0x334ce5(_0x50fe93['error']['message']);}logger[_0x2793('0x19')](_0x2793('0x1b'),_0x1c949a,_0x50fe93[_0x2793('0x19')][_0x2793('0x1c')]);return _0xd2f07c(_0x50fe93['error'][_0x2793('0x1c')]);}else{logger[_0x2793('0x14')](_0x2793('0x1b'),_0x1c949a,_0x2793('0x15'));_0xd2f07c(_0x50fe93[_0x2793('0x1d')]['message']);}})['catch'](function(_0x1d6642){logger[_0x2793('0x19')]('ChatGroup,\x20%s,\x20%s',_0x1c949a,_0x1d6642);_0x334ce5(_0x1d6642);});});} \ No newline at end of file +var _0x59e0=['../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x59e0,0x130));var _0x059e=function(_0x17b29a,_0x13b0dd){_0x17b29a=_0x17b29a-0x0;var _0x2c405f=_0x59e0[_0x17b29a];return _0x2c405f;};'use strict';var _=require('lodash');var util=require(_0x059e('0x0'));var moment=require(_0x059e('0x1'));var BPromise=require(_0x059e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x059e('0x3'));var db=require(_0x059e('0x4'))['db'];var utils=require(_0x059e('0x5'));var logger=require(_0x059e('0x6'))(_0x059e('0x7'));var config=require(_0x059e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x059e('0x9')][_0x059e('0xa')]({'port':0x232a});config[_0x059e('0xb')]=_[_0x059e('0xc')](config[_0x059e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x059e('0xd'))(new Redis(config[_0x059e('0xb')]));require(_0x059e('0xe'))['register'](socket);function respondWithRpcPromise(_0x37314e,_0x40a677,_0x172b08){return new BPromise(function(_0x35d45f,_0x58a934){return client['request'](_0x37314e,_0x172b08)['then'](function(_0x352e3d){logger[_0x059e('0xf')](_0x059e('0x10'),_0x40a677,_0x059e('0x11'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x40a677,'request\x20sent',JSON[_0x059e('0x12')](_0x352e3d));if(_0x352e3d[_0x059e('0x13')]){if(_0x352e3d[_0x059e('0x13')][_0x059e('0x14')]===0x1f4){logger[_0x059e('0x13')]('ChatGroup,\x20%s,\x20%s',_0x40a677,_0x352e3d[_0x059e('0x13')][_0x059e('0x15')]);return _0x58a934(_0x352e3d[_0x059e('0x13')][_0x059e('0x15')]);}logger['error'](_0x059e('0x10'),_0x40a677,_0x352e3d[_0x059e('0x13')][_0x059e('0x15')]);return _0x35d45f(_0x352e3d[_0x059e('0x13')]['message']);}else{logger[_0x059e('0xf')](_0x059e('0x10'),_0x40a677,_0x059e('0x11'));_0x35d45f(_0x352e3d[_0x059e('0x16')][_0x059e('0x15')]);}})[_0x059e('0x17')](function(_0xe12131){logger[_0x059e('0x13')](_0x059e('0x10'),_0x40a677,_0xe12131);_0x58a934(_0xe12131);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index be40947..3fd83de 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 _0xca7c=['register','length','chatGroup:','save','emit','removeListener'];(function(_0xf3ca3f,_0x570e8d){var _0x4226cf=function(_0x208a38){while(--_0x208a38){_0xf3ca3f['push'](_0xf3ca3f['shift']());}};_0x4226cf(++_0x570e8d);}(_0xca7c,0x165));var _0xcca7=function(_0x334e26,_0x224abd){_0x334e26=_0x334e26-0x0;var _0x30518d=_0xca7c[_0x334e26];return _0x30518d;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xcca7('0x0'),'remove','update'];function createListener(_0x52c7ae,_0x49c69c){return function(_0xe49e76){_0x49c69c[_0xcca7('0x1')](_0x52c7ae,_0xe49e76);};}function removeListener(_0x22fe02,_0x4be63c){return function(){ChatGroupEvents[_0xcca7('0x2')](_0x22fe02,_0x4be63c);};}exports[_0xcca7('0x3')]=function(_0x725709){for(var _0x398ac7=0x0,_0x465836=events[_0xcca7('0x4')];_0x398ac7<_0x465836;_0x398ac7++){var _0x319bf3=events[_0x398ac7];var _0x28b237=createListener(_0xcca7('0x5')+_0x319bf3,_0x725709);ChatGroupEvents['on'](_0x319bf3,_0x28b237);}}; \ No newline at end of file +var _0xadf7=['length','./chatGroup.events','save','remove','update','emit','register'];(function(_0x58bb6b,_0x38e74f){var _0x3a0adc=function(_0x715739){while(--_0x715739){_0x58bb6b['push'](_0x58bb6b['shift']());}};_0x3a0adc(++_0x38e74f);}(_0xadf7,0x94));var _0x7adf=function(_0x46c9c1,_0x1a1949){_0x46c9c1=_0x46c9c1-0x0;var _0x3464f7=_0xadf7[_0x46c9c1];return _0x3464f7;};'use strict';var ChatGroupEvents=require(_0x7adf('0x0'));var events=[_0x7adf('0x1'),_0x7adf('0x2'),_0x7adf('0x3')];function createListener(_0x2ec2cb,_0x5dd451){return function(_0x32cdc3){_0x5dd451[_0x7adf('0x4')](_0x2ec2cb,_0x32cdc3);};}function removeListener(_0x416256,_0x1326bb){return function(){ChatGroupEvents['removeListener'](_0x416256,_0x1326bb);};}exports[_0x7adf('0x5')]=function(_0x1bc25e){for(var _0x3a2b0c=0x0,_0xef0363=events[_0x7adf('0x6')];_0x3a2b0c<_0xef0363;_0x3a2b0c++){var _0x291ddc=events[_0x3a2b0c];var _0xc5aef0=createListener('chatGroup:'+_0x291ddc,_0x1bc25e);ChatGroupEvents['on'](_0x291ddc,_0xc5aef0);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fd92354..6044b56 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 _0x7c77=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','/:id','delete','destroy','removeMembers'];(function(_0x3f5d8d,_0x540010){var _0x15e79a=function(_0x554e64){while(--_0x554e64){_0x3f5d8d['push'](_0x3f5d8d['shift']());}};_0x15e79a(++_0x540010);}(_0x7c77,0x16c));var _0x77c7=function(_0x5be7b1,_0x39fc47){_0x5be7b1=_0x5be7b1-0x0;var _0x1e8695=_0x7c77[_0x5be7b1];return _0x1e8695;};'use strict';var multer=require('multer');var util=require(_0x77c7('0x0'));var path=require(_0x77c7('0x1'));var timeout=require(_0x77c7('0x2'));var express=require(_0x77c7('0x3'));var router=express[_0x77c7('0x4')]();var auth=require(_0x77c7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x77c7('0x6'));var controller=require('./chatGroup.controller');router[_0x77c7('0x7')]('/',auth[_0x77c7('0x8')](),controller['index']);router[_0x77c7('0x7')](_0x77c7('0x9'),auth[_0x77c7('0x8')](),controller[_0x77c7('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x77c7('0xb')]);router[_0x77c7('0x7')](_0x77c7('0xc'),auth[_0x77c7('0x8')](),controller[_0x77c7('0xd')]);router[_0x77c7('0x7')](_0x77c7('0xe'),auth['isAuthenticated'](),controller[_0x77c7('0xf')]);router[_0x77c7('0x7')](_0x77c7('0x10'),auth[_0x77c7('0x8')](),controller[_0x77c7('0x11')]);router[_0x77c7('0x12')]('/',auth[_0x77c7('0x8')](),controller[_0x77c7('0x13')]);router[_0x77c7('0x12')](_0x77c7('0xe'),auth['isAuthenticated'](),controller[_0x77c7('0x14')]);router[_0x77c7('0x12')](_0x77c7('0x10'),auth[_0x77c7('0x8')](),controller[_0x77c7('0x15')]);router['put'](_0x77c7('0x16'),auth[_0x77c7('0x8')](),controller['update']);router[_0x77c7('0x17')](_0x77c7('0x16'),auth['isAuthenticated'](),controller[_0x77c7('0x18')]);router[_0x77c7('0x17')]('/:id/members',auth[_0x77c7('0x8')](),controller[_0x77c7('0x19')]);module['exports']=router; \ No newline at end of file +var _0x59e2=['isAuthenticated','describe','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','/:id','destroy','removeMembers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','index'];(function(_0xdcb54f,_0x340e93){var _0x690070=function(_0x365fe1){while(--_0x365fe1){_0xdcb54f['push'](_0xdcb54f['shift']());}};_0x690070(++_0x340e93);}(_0x59e2,0x7d));var _0x259e=function(_0x4921f1,_0x2b6a2a){_0x4921f1=_0x4921f1-0x0;var _0x5e1b24=_0x59e2[_0x4921f1];return _0x5e1b24;};'use strict';var multer=require(_0x259e('0x0'));var util=require(_0x259e('0x1'));var path=require(_0x259e('0x2'));var timeout=require(_0x259e('0x3'));var express=require('express');var router=express[_0x259e('0x4')]();var auth=require(_0x259e('0x5'));var interaction=require(_0x259e('0x6'));var config=require('../../config/environment');var controller=require(_0x259e('0x7'));router[_0x259e('0x8')]('/',auth['isAuthenticated'](),controller[_0x259e('0x9')]);router[_0x259e('0x8')]('/describe',auth[_0x259e('0xa')](),controller[_0x259e('0xb')]);router[_0x259e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x259e('0xc')]);router[_0x259e('0x8')](_0x259e('0xd'),auth[_0x259e('0xa')](),controller[_0x259e('0xe')]);router[_0x259e('0x8')](_0x259e('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x259e('0x10'),auth['isAuthenticated'](),controller[_0x259e('0x11')]);router[_0x259e('0x12')]('/',auth[_0x259e('0xa')](),controller[_0x259e('0x13')]);router[_0x259e('0x12')](_0x259e('0xf'),auth[_0x259e('0xa')](),controller[_0x259e('0x14')]);router[_0x259e('0x12')]('/:id/messages',auth[_0x259e('0xa')](),controller[_0x259e('0x15')]);router[_0x259e('0x16')](_0x259e('0x17'),auth[_0x259e('0xa')](),controller['update']);router['delete'](_0x259e('0x17'),auth[_0x259e('0xa')](),controller[_0x259e('0x18')]);router['delete'](_0x259e('0xf'),auth[_0x259e('0xa')](),controller[_0x259e('0x19')]);module[_0x259e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 4dc2287..26ed570 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 _0xfebe=['TEXT','STRING','long','DATE','exports','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x5d3030,_0x43acec){var _0x26019c=function(_0x254a3d){while(--_0x254a3d){_0x5d3030['push'](_0x5d3030['shift']());}};_0x26019c(++_0x43acec);}(_0xfebe,0x1d0));var _0xefeb=function(_0x1d9dfa,_0x30598d){_0x1d9dfa=_0x1d9dfa-0x0;var _0x252661=_0xfebe[_0x1d9dfa];return _0x252661;};'use strict';var Sequelize=require('sequelize');module[_0xefeb('0x0')]={'closed':{'type':Sequelize[_0xefeb('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xefeb('0x2')]},'ratingType':{'type':Sequelize[_0xefeb('0x3')](_0xefeb('0x4'),_0xefeb('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xefeb('0x6')]},'pathTranscript':{'type':Sequelize[_0xefeb('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xefeb('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xefeb('0x7')]},'osVersion':{'type':Sequelize[_0xefeb('0x7')]},'deviceModel':{'type':Sequelize[_0xefeb('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xefeb('0x7')]},'referer':{'type':Sequelize[_0xefeb('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xefeb('0x6')](_0xefeb('0x8'))},'read1stAt':{'type':Sequelize[_0xefeb('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xefeb('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xefeb('0x7')]},'customerPort':{'type':Sequelize[_0xefeb('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xefeb('0x6')]}}; \ No newline at end of file +var _0x0548=['thumb','TEXT','STRING','long','DATE','ENUM','out','BOOLEAN','star'];(function(_0x1a0a9c,_0x4f725f){var _0xdcc25a=function(_0x5782d5){while(--_0x5782d5){_0x1a0a9c['push'](_0x1a0a9c['shift']());}};_0xdcc25a(++_0x4f725f);}(_0x0548,0x14b));var _0x8054=function(_0x4e9988,_0x18bcd9){_0x4e9988=_0x4e9988-0x0;var _0x28c15d=_0x0548[_0x4e9988];return _0x28c15d;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x8054('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x8054('0x1'),_0x8054('0x2')),'defaultValue':_0x8054('0x1')},'ratingMessage':{'type':Sequelize[_0x8054('0x3')]},'pathTranscript':{'type':Sequelize[_0x8054('0x3')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8054('0x4')]},'note':{'type':Sequelize[_0x8054('0x4')]},'browserName':{'type':Sequelize[_0x8054('0x4')]},'browserVersion':{'type':Sequelize[_0x8054('0x4')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x8054('0x4')]},'deviceModel':{'type':Sequelize[_0x8054('0x4')]},'deviceVendor':{'type':Sequelize[_0x8054('0x4')]},'deviceType':{'type':Sequelize[_0x8054('0x4')]},'referer':{'type':Sequelize[_0x8054('0x3')]},'customerIp':{'type':Sequelize[_0x8054('0x4')]},'formData':{'type':Sequelize[_0x8054('0x3')](_0x8054('0x5'))},'read1stAt':{'type':Sequelize[_0x8054('0x6')]},'lastMsgAt':{'type':Sequelize[_0x8054('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x8054('0x7')]('in',_0x8054('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8054('0x4')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e8b778a..ef9b7d4 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 _0x4325=['concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','all','rows','show','params','includeAll','include','merge','options','create','destroy','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','closed','disposition','abandon','attachmentUpload','originalname','basename','filename','file','mimetype','Attachment','attachmentDownload','json','Unauthorized','attachId','download','join','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','%s%d','System','customer','Visitor','website_alias','alias','agent_fullname','agentAlias','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','omit','ids','sort','ChatInteractionId','findAll','getMyMessages','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','CmContact','lastName','attachments','direction','Account','Owner','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','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','osName','customerIp','customerPort','existsSync','createReadStream','createWriteStream','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','http','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','status','count','offset','limit','set','Content-Range','apply','reject','save','update','end','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','map','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','select','field','color','from','tools_tags','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','left_join','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','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','keys','some','compact','isEmpty','forEach','ChatWebsiteId','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4325,0x1da));var _0x5432=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4325[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x5432('0x0'));var emlformat=require(_0x5432('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5432('0x2'));var jsonpatch=require(_0x5432('0x3'));var rp=require(_0x5432('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5432('0x5'));var util=require(_0x5432('0x6'));var path=require(_0x5432('0x7'));var sox=require('sox');var csv=require(_0x5432('0x8'));var ejs=require(_0x5432('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0x8'));var querystring=require(_0x5432('0xd'));var Papa=require(_0x5432('0xe'));var Redis=require('ioredis');var authService=require(_0x5432('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x10'));var hardwareService=require(_0x5432('0x11'));var logger=require(_0x5432('0x12'))(_0x5432('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5432('0x14'))['db'];config[_0x5432('0x15')]=_['defaults'](config[_0x5432('0x15')],{'host':_0x5432('0x16'),'port':0x18eb});var socket=require(_0x5432('0x17'))(new Redis(config[_0x5432('0x15')]));require(_0x5432('0x18'))[_0x5432('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5432('0x1a')]({'port':0x232b});var client9004=jayson[_0x5432('0x1b')][_0x5432('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x364152,_0x9d2023,_0x11db3c){if(_0x11db3c){var _0x5e18e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e18e8[_0x5432('0x1c')](_0x9d2023)){return _0x364152;}else{throw new db['Sequelize'][(_0x5432('0x1d'))](_0x5432('0x1e'));}}else{return _0x364152;}}function respondWithRpcPromise(_0x333152,_0x32fe60,_0x4221a8,_0x5f011f){return new BPromise(function(_0x3f3873,_0x22f030){var _0x12c069=_0x5f011f||client;return _0x12c069[_0x5432('0x1f')](_0x333152,_0x4221a8)[_0x5432('0x20')](function(_0x451de4){logger[_0x5432('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x32fe60,_0x5432('0x22'));logger[_0x5432('0x23')](_0x5432('0x24'),_0x32fe60,_0x5432('0x22'),JSON[_0x5432('0x25')](_0x451de4));if(_0x451de4['error']){if(_0x451de4['error']['code']===0x1f4){logger[_0x5432('0x26')](_0x5432('0x27'),_0x32fe60,_0x451de4[_0x5432('0x26')][_0x5432('0x28')]);return _0x22f030(_0x451de4['error']['message']);}logger[_0x5432('0x26')](_0x5432('0x27'),_0x32fe60,_0x451de4['error'][_0x5432('0x28')]);return _0x3f3873(_0x451de4[_0x5432('0x26')][_0x5432('0x28')]);}else{logger['info'](_0x5432('0x27'),_0x32fe60,_0x5432('0x22'));_0x3f3873(_0x451de4[_0x5432('0x29')]['message']);}})['catch'](function(_0x1f2055){logger[_0x5432('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x32fe60,_0x1f2055);_0x22f030(_0x1f2055);});});}function respondWithStatusCode(_0x1abe73,_0x66a647){_0x66a647=_0x66a647||0xcc;return function(_0x1f2e8f){if(_0x1f2e8f){return _0x1abe73['sendStatus'](_0x66a647);}return _0x1abe73[_0x5432('0x2a')](_0x66a647)['end']();};}function respondWithResult(_0x4821be,_0x6fc7f5){_0x6fc7f5=_0x6fc7f5||0xc8;return function(_0x4a52ba){if(_0x4a52ba){return _0x4821be[_0x5432('0x2a')](_0x6fc7f5)['json'](_0x4a52ba);}};}function respondWithFilteredResult(_0x59a866,_0x465a09){return function(_0x21735e){if(_0x21735e){var _0x345b51=_0x21735e[_0x5432('0x2b')],_0x4e92d5=_0x465a09[_0x5432('0x2c')],_0x31490c=_0x465a09[_0x5432('0x2c')]+_0x465a09[_0x5432('0x2d')],_0x1d436c;if(_0x31490c>=_0x345b51){_0x31490c=_0x345b51;_0x1d436c=0xc8;}else{_0x1d436c=0xce;}_0x59a866[_0x5432('0x2a')](_0x1d436c);return _0x59a866[_0x5432('0x2e')](_0x5432('0x2f'),_0x4e92d5+'-'+_0x31490c+'/'+_0x345b51)['json'](_0x21735e);}return null;};}function patchUpdates(_0x57fd0b){return function(_0x240dec){try{jsonpatch[_0x5432('0x30')](_0x240dec,_0x57fd0b,!![]);}catch(_0x2ebffa){return BPromise[_0x5432('0x31')](_0x2ebffa);}return _0x240dec[_0x5432('0x32')]();};}function saveUpdates(_0x4ce287,_0x30a07f){return function(_0x5649b6){if(_0x5649b6){return _0x5649b6[_0x5432('0x33')](_0x4ce287)[_0x5432('0x20')](function(_0x56f560){return _0x56f560;});}return null;};}function removeEntity(_0x355d26,_0xb17e78){return function(_0x112c83){if(_0x112c83){return _0x112c83['destroy']()[_0x5432('0x20')](function(){_0x355d26[_0x5432('0x2a')](0xcc)[_0x5432('0x34')]();});}};}function handleEntityNotFound(_0xcfb6e8,_0x555b6e){return function(_0xe01f4b){if(!_0xe01f4b){_0xcfb6e8[_0x5432('0x35')](0x194);}return _0xe01f4b;};}function handleError(_0x2ebb2e,_0x2be93f){_0x2be93f=_0x2be93f||0x1f4;return function(_0x3fb586){logger[_0x5432('0x26')](_0x3fb586[_0x5432('0x36')]);if(_0x3fb586[_0x5432('0x37')]){delete _0x3fb586[_0x5432('0x37')];}_0x2ebb2e[_0x5432('0x2a')](_0x2be93f)[_0x5432('0x38')](_0x3fb586);};}function getInteractionUsers(_0x1f4679,_0x32728b){return new BPromise(function(_0x4397a7,_0x48ec3e){try{if(_0x32728b[_0x1f4679['id']]){_0x1f4679[_0x5432('0x39')]=_['map'](_0x32728b[_0x1f4679['id']],function(_0x6f5006){return{'id':_0x6f5006['id'],'fullname':_0x6f5006[_0x5432('0x3a')]};});}}catch(_0x2b8c7f){_0x48ec3e(_0x2b8c7f);}_0x4397a7(_0x1f4679);});}function getInteractionTags(_0x1a5561,_0x4dc00e){return new BPromise(function(_0x4dd813,_0x5c9fec){try{if(_0x1a5561[_0x5432('0x3b')]){_0x1a5561[_0x5432('0x3c')]=[];_0x1a5561[_0x5432('0x3b')][_0x5432('0x3d')](',')['forEach'](function(_0x2f7a3f){_0x1a5561[_0x5432('0x3c')][_0x5432('0x3e')](_0x4dc00e[_0x2f7a3f]);});}delete _0x1a5561['TagIds'];}catch(_0x219ddc){_0x5c9fec(_0x219ddc);}_0x4dd813(_0x1a5561);});}function updateChatInteraction(_0x38c951,_0x4cd86d,_0x3eb446){return new BPromise(function(_0x239f24,_0x48621b){return getInteractionUsers(_0x38c951,_0x3eb446)[_0x5432('0x20')](function(_0x53b11e){return getInteractionTags(_0x53b11e,_0x4cd86d);})[_0x5432('0x20')](function(_0x2d4cb0){_0x239f24(_0x2d4cb0);})[_0x5432('0x3f')](function(_0x11c7f2){_0x48621b(_0x11c7f2);});});}exports['index']=function(_0x9cfb8b,_0x4b93b4){var _0x3771ee={},_0x15f18d={},_0x3afbde={'count':0x0,'rows':[]};var _0x46671c=_[_0x5432('0x40')](db[_0x5432('0x41')][_0x5432('0x42')],function(_0x4ab024){return{'name':_0x4ab024[_0x5432('0x43')],'type':_0x4ab024[_0x5432('0x44')][_0x5432('0x45')]};});_0x15f18d[_0x5432('0x46')]=_[_0x5432('0x40')](_0x46671c,_0x5432('0x37'));_0x15f18d[_0x5432('0x47')]=_['keys'](_0x9cfb8b[_0x5432('0x47')]);_0x15f18d[_0x5432('0x48')]=_[_0x5432('0x49')](_0x15f18d[_0x5432('0x46')],_0x15f18d[_0x5432('0x47')]);_0x3771ee['attributes']=_[_0x5432('0x49')](_0x15f18d['model'],qs[_0x5432('0x4a')](_0x9cfb8b[_0x5432('0x47')]['fields']));_0x3771ee[_0x5432('0x4b')]=_0x3771ee['attributes'][_0x5432('0x4c')]?_0x3771ee[_0x5432('0x4b')]:_0x15f18d['model'];if(!_0x9cfb8b['query'][_0x5432('0x4d')](_0x5432('0x4e'))){_0x3771ee[_0x5432('0x2d')]=qs[_0x5432('0x2d')](_0x9cfb8b[_0x5432('0x47')][_0x5432('0x2d')]);_0x3771ee[_0x5432('0x2c')]=qs['offset'](_0x9cfb8b[_0x5432('0x47')][_0x5432('0x2c')]);}_0x3771ee[_0x5432('0x4f')]=qs['sort'](_0x9cfb8b['query']['sort']);_0x3771ee['where']=qs[_0x5432('0x48')](_[_0x5432('0x50')](_0x9cfb8b[_0x5432('0x47')],_0x15f18d[_0x5432('0x48')]),_0x46671c);var _0x1beefd=[];var _0x4bc716=squel[_0x5432('0x51')]()[_0x5432('0x52')]('id')[_0x5432('0x52')]('name')[_0x5432('0x52')](_0x5432('0x53'))[_0x5432('0x54')](_0x5432('0x55'));var _0x121dc8=squel['select']()[_0x5432('0x52')]('u.id')[_0x5432('0x52')]('u.fullname')[_0x5432('0x52')](_0x5432('0x56'))['from'](_0x5432('0x57'),'ui')['left_join'](_0x5432('0x58'),'u',_0x5432('0x59'));var _0x36cb63=squel[_0x5432('0x51')]()['from'](_0x5432('0x5a'),'i')['left_join'](_0x5432('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5432('0x5c')](_0x5432('0x58'),'o',_0x5432('0x5d'))[_0x5432('0x5c')](_0x5432('0x5e'),'a',_0x5432('0x5f'))[_0x5432('0x5c')](_0x5432('0x60'),'me',_0x5432('0x61'))[_0x5432('0x5c')]('chat_interaction_has_tags','it',_0x5432('0x62'))[_0x5432('0x5c')]('tools_tags','t',_0x5432('0x63'));var _0x3eb16e=squel[_0x5432('0x64')]();var _0x13fd25=[];var _0x863be3=squel['expr']();var _0x522805;if(_0x9cfb8b['query']['search']){_0x522805=as[_0x5432('0x65')](_0x9cfb8b[_0x5432('0x47')][_0x5432('0x66')]);var _0x5b70f9=_0x522805[_0x5432('0x67')];for(var _0x12768f=0x0;_0x12768f<_0x522805[_0x5432('0x68')][_0x5432('0x4c')];_0x12768f++){var _0x3d3d2c=_0x522805[_0x5432('0x68')][_0x12768f];var _0x328211='i';var _0x3a2d2c=_[_0x5432('0x69')](_0x46671c,[_0x5432('0x37'),_0x3d3d2c[_0x5432('0x52')]]);if(!_0x3a2d2c){switch(_0x3d3d2c['field']){case _0x5432('0x6a'):if(_0x3d3d2c[_0x5432('0x6b')]==0x1){_0x36cb63[_0x5432('0x6c')]('`'+_0x3d3d2c[_0x5432('0x52')]+_0x5432('0x6d'));}else{_0x36cb63['having']('`'+_0x3d3d2c[_0x5432('0x52')]+'`\x20>\x200');}break;case _0x5432('0x6e'):if(_0x3d3d2c[_0x5432('0x6f')]===_0x5432('0x70')){if(_0x3d3d2c[_0x5432('0x6b')][_0x5432('0x3d')]('\x20')[_0x5432('0x4c')]>0x1){_0x3eb16e[_0x5b70f9](_0x5432('0x71'),qs[_0x5432('0x72')](_0x3d3d2c[_0x5432('0x6b')]),null);}else{var _0x1a0883='%'+_0x3d3d2c[_0x5432('0x6b')]+'%';_0x3eb16e[_0x5b70f9](_0x5432('0x73'),_0x1a0883,_0x1a0883,_0x1a0883);}}else{_0x3a2d2c=_[_0x5432('0x69')](_0x46671c,[_0x5432('0x37'),_0x5432('0x74')]);_0x3d3d2c[_0x5432('0x52')]=_0x5432('0x74');_0xd20561=as[_0x5432('0x75')](_0x328211,_0x3a2d2c['type'],_0x3d3d2c);_0x3eb16e[_0x5b70f9](_0xd20561[_0x5432('0x76')],_0xd20561['value'][_0x5432('0x77')],_0xd20561[_0x5432('0x6b')]['end']);}break;case _0x5432('0x78'):var _0x33d39a=_0x3d3d2c[_0x5432('0x6b')][_0x5432('0x3d')](',')['map'](function(_0x3a78b3){return Number(_0x3a78b3);});_0x33d39a['forEach'](function(_0x187373){_0x863be3['or'](_0x5432('0x79'),'%,'+_0x187373+',%');});_0x13fd25=_[_0x5432('0x7a')](_0x13fd25,_0x33d39a);break;case _0x5432('0x7b'):if(_0x3d3d2c[_0x5432('0x6f')]===_0x5432('0x70')){_0x3eb16e[_0x5b70f9]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3d3d2c[_0x5432('0x6b')]+'%',null);}else{_0x3a2d2c=_[_0x5432('0x69')](_0x46671c,['name','UserId']);_0x3d3d2c[_0x5432('0x52')]='UserId';_0xd20561=as[_0x5432('0x75')](_0x328211,_0x3a2d2c['type'],_0x3d3d2c);_0x3eb16e[_0x5b70f9](_0xd20561[_0x5432('0x76')],_0xd20561['value'][_0x5432('0x77')],_0xd20561['value']['end']);}break;case _0x5432('0x7c'):_0xd20561=as[_0x5432('0x75')]('me',null,_0x3d3d2c);_0x3eb16e[_0x5b70f9](_0xd20561[_0x5432('0x76')],_0xd20561['value']['start'],_0xd20561['value'][_0x5432('0x34')]);break;}}else{var _0xd20561=as[_0x5432('0x75')](_0x328211,_0x3a2d2c['type'],_0x3d3d2c);_0x3eb16e[_0x5b70f9](_0xd20561['text'],_0xd20561[_0x5432('0x6b')][_0x5432('0x77')],_0xd20561[_0x5432('0x6b')][_0x5432('0x34')]);}}}else{var _0x1835af=_(_0x9cfb8b[_0x5432('0x47')])[_0x5432('0x7d')]()[_0x5432('0x40')](function(_0x4d44a9){return _[_0x5432('0x7e')](_0x46671c,['name',_0x4d44a9])?_0x4d44a9:undefined;})[_0x5432('0x7f')]()[_0x5432('0x6b')]();if(!_[_0x5432('0x80')](_0x1835af)){_0x1835af[_0x5432('0x81')](function(_0x304d81){if(_0x304d81===_0x5432('0x82')){_0x36cb63[_0x5432('0x83')]('i.ChatWebsiteId\x20IN\x20?',[][_0x5432('0x84')](_0x9cfb8b[_0x5432('0x47')][_0x304d81]));}else if(_0x304d81===_0x5432('0x85')){var _0x3ef516=JSON['parse'](_0x9cfb8b[_0x5432('0x47')][_0x304d81])[_0x5432('0x86')];var _0x133a43=JSON[_0x5432('0x87')](_0x9cfb8b[_0x5432('0x47')][_0x304d81])[_0x5432('0x88')];_0x36cb63[_0x5432('0x83')](_0x5432('0x89'),_0x3ef516,_0x133a43);}else{if(_0x9cfb8b['query'][_0x304d81]===_0x5432('0x8a')){_0x36cb63[_0x5432('0x83')]('i.'+_0x304d81+_0x5432('0x8b'));}else{_0x36cb63[_0x5432('0x83')]('i.'+_0x304d81+_0x5432('0x8c'),_0x9cfb8b[_0x5432('0x47')][_0x304d81]);}}});}if(_0x9cfb8b[_0x5432('0x47')]['read']){if(_0x9cfb8b[_0x5432('0x47')][_0x5432('0x8d')]==0x1){_0x36cb63[_0x5432('0x6c')](_0x5432('0x8e'));}else{_0x36cb63[_0x5432('0x6c')](_0x5432('0x8f'));}}if(_0x9cfb8b['query']['tag']){_0x13fd25=_['isArray'](_0x9cfb8b['query'][_0x5432('0x90')])?_0x9cfb8b['query'][_0x5432('0x90')]:new Array(_0x9cfb8b[_0x5432('0x47')]['tag']);_0x13fd25[_0x5432('0x81')](function(_0x4f7d21){_0x863be3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f7d21+',%');});}if(_0x9cfb8b[_0x5432('0x47')][_0x5432('0x91')]){var _0x5d30bf=_0x9cfb8b[_0x5432('0x47')][_0x5432('0x91')][_0x5432('0x92')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x5432('0x93'));if(qs[_0x5432('0x94')](_0x5d30bf)){_0x3eb16e['or']('i.id\x20LIKE\x20?',_0x5d30bf+'%');}else{_0x3eb16e['or'](_0x5432('0x95'),qs['getFullTextValue'](_0x5d30bf))['or'](_0x5432('0x96'),_0x5d30bf+'%');}}}_0x36cb63[_0x5432('0x83')](_0x3eb16e);_0x36cb63[_0x5432('0x97')](_0x5432('0x98'));var _0xbb1f59={'type':db[_0x5432('0x99')]['QueryTypes'][_0x5432('0x9a')],'raw':!![]};var _0x276772=_0x36cb63['clone']();_0x276772[_0x5432('0x52')](_0x5432('0x98'));_0x276772[_0x5432('0x52')](_0x5432('0x9b'),_0x5432('0x6a'));if(_0x3771ee[_0x5432('0x4f')]){_0x3771ee['order'][_0x5432('0x81')](function(_0x53f89c){_0x36cb63['order']('i.'+_0x53f89c[0x0],_0x53f89c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x5432('0x80')](_0x13fd25)){_0x36cb63['having'](_0x863be3);_0x276772['where'](_0x5432('0x9c'),_0x13fd25);}BPromise['resolve']()[_0x5432('0x20')](function(){if(!_0x522805){if(_0x9cfb8b[_0x5432('0x47')][_0x5432('0x82')]||_0x9cfb8b[_0x5432('0x47')][_0x5432('0x9d')])return;_0x276772[_0x5432('0x83')](_0x5432('0x9e'));_0x36cb63[_0x5432('0x83')](_0x5432('0x9e'));return;}return _0x9cfb8b[_0x5432('0x9f')][_0x5432('0xa0')]({'attributes':['id'],'raw':!![]})[_0x5432('0x20')](function(_0x579b58){if(_[_0x5432('0x80')](_0x579b58)){_0x276772['where'](_0x5432('0xa1'));_0x36cb63[_0x5432('0x83')](_0x5432('0xa1'));}else{_0x276772['where'](_0x5432('0xa2'),_[_0x5432('0x40')](_0x579b58,'id'));_0x36cb63[_0x5432('0x83')](_0x5432('0xa2'),_[_0x5432('0x40')](_0x579b58,'id'));}});})['then'](function(){db[_0x5432('0xa3')][_0x5432('0x47')](_0x276772[_0x5432('0xa4')](),_0xbb1f59)[_0x5432('0x20')](function(_0x33e658){_0x3afbde[_0x5432('0x2b')]=_0x33e658[_0x5432('0x4c')];if(_0x3afbde[_0x5432('0x2b')]===0x0)return[];return db[_0x5432('0xa3')][_0x5432('0x47')](_0x4bc716[_0x5432('0xa4')](),_0xbb1f59)[_0x5432('0x20')](function(_0xb9f0e6){_0x1beefd=_[_0x5432('0xa5')](_0xb9f0e6,'id');_0xbb1f59=_['merge'](_0xbb1f59,{'model':db[_0x5432('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9cfb8b['query'][_0x5432('0x4a')]){_0x3771ee['attributes'][_0x5432('0x81')](function(_0x4223cf){_0x36cb63[_0x5432('0x52')]('i.'+_0x4223cf);});}else{_0x36cb63[_0x5432('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5432('0x6a'));_0x36cb63[_0x5432('0x52')](_0x5432('0xa6'),_0x5432('0xa7'));_0x36cb63[_0x5432('0x52')](_0x5432('0xa8'),_0x5432('0xa9'));_0x36cb63[_0x5432('0x52')](_0x5432('0xaa'));_0x36cb63['field'](_0x5432('0xab'),_0x5432('0xac'));_0x36cb63[_0x5432('0x52')](_0x5432('0xad'),_0x5432('0xae'));_0x36cb63[_0x5432('0x52')](_0x5432('0xaf'),'Contact.email');_0x36cb63[_0x5432('0x52')](_0x5432('0xb0'),_0x5432('0xb1'));_0x36cb63['field'](_0x5432('0xb2'),_0x5432('0xb3'));_0x36cb63[_0x5432('0x52')](_0x5432('0xb4'),_0x5432('0xb5'));_0x36cb63[_0x5432('0x52')](_0x5432('0xb6'),_0x5432('0xb7'));_0x36cb63[_0x5432('0x52')](_0x5432('0xb8'),_0x5432('0xb9'));_0x36cb63[_0x5432('0x52')](_0x5432('0xba'),'TagIds');}if(_0x3771ee[_0x5432('0x2d')])_0x36cb63[_0x5432('0x2d')](_0x3771ee[_0x5432('0x2d')]);if(_0x3771ee['offset'])_0x36cb63[_0x5432('0x2c')](_0x3771ee['offset']);return db[_0x5432('0xa3')][_0x5432('0x47')](_0x36cb63[_0x5432('0xa4')](),_0xbb1f59);})['then'](function(_0x4a7433){_0x121dc8[_0x5432('0x83')](_0x5432('0xbb'),_[_0x5432('0x40')](_0x4a7433,'id'));return db[_0x5432('0xa3')][_0x5432('0x47')](_0x121dc8['toString'](),_0xbb1f59)['then'](function(_0x35eeee){var _0x3a02ec=_['groupBy'](_0x35eeee,'ChatInteractionId');var _0x2c5db5=[];_0x4a7433['forEach'](function(_0x4e115b){_0x2c5db5[_0x5432('0x3e')](updateChatInteraction(_0x4e115b,_0x1beefd,_0x3a02ec));});return BPromise[_0x5432('0xbc')](_0x2c5db5);});});})[_0x5432('0x20')](function(_0x1eeb50){_0x3afbde[_0x5432('0xbd')]=_0x1eeb50;return _0x3afbde;})['then'](respondWithFilteredResult(_0x4b93b4,_0x3771ee));})[_0x5432('0x3f')](handleError(_0x4b93b4,null));};exports[_0x5432('0xbe')]=function(_0x9ea224,_0x24db34){var _0x171765={'raw':![],'where':{'id':_0x9ea224[_0x5432('0xbf')]['id']}},_0x2c9bc4={};_0x2c9bc4[_0x5432('0x46')]=_[_0x5432('0x7d')](db[_0x5432('0x41')][_0x5432('0x42')]);_0x2c9bc4[_0x5432('0x47')]=_[_0x5432('0x7d')](_0x9ea224['query']);_0x2c9bc4[_0x5432('0x48')]=_['intersection'](_0x2c9bc4[_0x5432('0x46')],_0x2c9bc4[_0x5432('0x47')]);_0x171765[_0x5432('0x4b')]=_[_0x5432('0x49')](_0x2c9bc4[_0x5432('0x46')],qs[_0x5432('0x4a')](_0x9ea224[_0x5432('0x47')][_0x5432('0x4a')]));_0x171765[_0x5432('0x4b')]=_0x171765[_0x5432('0x4b')][_0x5432('0x4c')]?_0x171765[_0x5432('0x4b')]:_0x2c9bc4[_0x5432('0x46')];if(_0x9ea224['query'][_0x5432('0xc0')]){_0x171765[_0x5432('0xc1')]=[{'all':!![]}];}_0x171765=_[_0x5432('0xc2')]({},_0x171765,_0x9ea224[_0x5432('0xc3')]);return db[_0x5432('0x41')][_0x5432('0x69')](_0x171765)[_0x5432('0x20')](handleEntityNotFound(_0x24db34,null))['then'](respondWithResult(_0x24db34,null))[_0x5432('0x3f')](handleError(_0x24db34,null));};exports[_0x5432('0xc4')]=function(_0x5da672,_0x15596b){return db['ChatInteraction'][_0x5432('0xc4')](_0x5da672[_0x5432('0x7c')],{})[_0x5432('0x20')](respondWithResult(_0x15596b,0xc9))[_0x5432('0x3f')](handleError(_0x15596b,null));};exports[_0x5432('0x33')]=function(_0x47951f,_0x269867){if(_0x47951f['body']['id']){delete _0x47951f[_0x5432('0x7c')]['id'];}return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0x47951f['params']['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x269867,null))[_0x5432('0x20')](saveUpdates(_0x47951f[_0x5432('0x7c')],null))['then'](respondWithResult(_0x269867,null))[_0x5432('0x3f')](handleError(_0x269867,null));};exports[_0x5432('0xc5')]=function(_0x3fe0cb,_0x3db90b){return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0x3fe0cb[_0x5432('0xbf')]['id']}})['then'](handleEntityNotFound(_0x3db90b,null))[_0x5432('0x20')](removeEntity(_0x3db90b,null))[_0x5432('0x3f')](handleError(_0x3db90b,null));};exports[_0x5432('0xc6')]=function(_0x30a9dd,_0x5ce9b2){return db['ChatInteraction']['describe']()['then'](respondWithResult(_0x5ce9b2,null))['catch'](handleError(_0x5ce9b2,null));};exports['createVidaooSession']=function(_0x4ee5e3,_0x554b3a){var _0x4bb9c1=_0x4ee5e3[_0x5432('0xbf')]['id'];var _0x1b12c8;var _0x58c6bb;var _0xc85ae7;return db[_0x5432('0x41')][_0x5432('0xc7')]({'where':{'id':_0x4bb9c1}})[_0x5432('0x20')](function(_0x5b3282){_0x1b12c8=_0x5b3282;return db[_0x5432('0xc8')][_0x5432('0xc7')]({'where':{'id':_0x5b3282[_0x5432('0x82')]},'attributes':['id',_0x5432('0xc9'),_0x5432('0xca')],'raw':!![]});})['then'](function(_0x57be29){if(_0x57be29&&_0x57be29[_0x5432('0xc9')]&&_0x57be29['vidaooEscalation']){_0x58c6bb=_0x57be29;var _0x494b04={'rejectUnauthorized':![],'method':_0x5432('0xcb'),'uri':_0x5432('0xcc'),'headers':{'X-APIKEY':_0x57be29[_0x5432('0xc9')]},'body':{'name':'MotionCWB:'+_0x4bb9c1},'redirect':_0x5432('0xcd'),'json':!![]};return rp(_0x494b04);}else{throw new db['Sequelize'][(_0x5432('0x1d'))](_0x5432('0xce'));}})['then'](function(_0x159697){_0xc85ae7=_0x159697;if(_0xc85ae7['id']){var _0x2646f9={'body':_0xc85ae7[_0x5432('0xcf')],'ChatWebsiteId':_0x58c6bb['id'],'ChatInteractionId':_0x1b12c8['id'],'direction':_0x5432('0xd0'),'UserId':_0x4ee5e3['user']['id']};return db[_0x5432('0xd1')][_0x5432('0xc4')](_0x2646f9,{});}else{throw new db[(_0x5432('0x99'))][(_0x5432('0x1d'))](_0x5432('0xd2'));}})[_0x5432('0x20')](function(){return _0x1b12c8[_0x5432('0xd3')]({'vidaooSessionId':_0xc85ae7['id']});})[_0x5432('0x20')](respondWithResult(_0x554b3a,null))[_0x5432('0x3f')](handleError(_0x554b3a,null));};exports[_0x5432('0xd4')]=function(_0x1a6710,_0x5c40ad){if(_0x1a6710['body']['id']){delete _0x1a6710[_0x5432('0x7c')]['id'];}return db['ChatInteraction'][_0x5432('0x69')]({'where':{'id':_0x1a6710[_0x5432('0xbf')]['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x5c40ad,null))[_0x5432('0x20')](saveUpdates(_0x1a6710[_0x5432('0x7c')],null))['then'](respondWithResult(_0x5c40ad,null))['catch'](handleError(_0x5c40ad,null));};exports['abandon']=function(_0x2f23e1,_0x4048d5,_0x3666ae){if(_0x2f23e1['body']['id']){delete _0x2f23e1[_0x5432('0x7c')]['id'];}return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0x2f23e1['params']['id']}})[_0x5432('0x20')](function(_0xcdc2ad){if(!_0xcdc2ad){logger[_0x5432('0x26')](_0x5432('0xd5'),'abandon',0x194,'entity\x20not\x20found');_0x4048d5[_0x5432('0x35')](0x194);}else{if(_0xcdc2ad[_0x5432('0xd6')]){throw new db[(_0x5432('0x99'))][(_0x5432('0x1d'))]('Interaction\x20already\x20assigned');}}return _0xcdc2ad;})[_0x5432('0x20')](function(_0x3a3ed1){if(_0x3a3ed1){return _0x3a3ed1[_0x5432('0x33')]({'closed':_0x2f23e1['body'][_0x5432('0xd7')],'disposition':_0x2f23e1[_0x5432('0x7c')][_0x5432('0xd8')]})[_0x5432('0x20')](function(_0x1c29ba){return _0x1c29ba;});}})[_0x5432('0x20')](function(_0xc53eb2){return respondWithRpcPromise('AbandonInteraction',_0x5432('0xd9'),_0x2f23e1[_0x5432('0x7c')],client9004);})[_0x5432('0x20')](respondWithResult(_0x4048d5,null))[_0x5432('0x3f')](handleError(_0x4048d5,null));};exports[_0x5432('0xda')]=function(_0x4aa003,_0x234f1d,_0xcaefb6){_0x4aa003[_0x5432('0x7c')][_0x5432('0x37')]=_0x4aa003['file'][_0x5432('0xdb')];_0x4aa003[_0x5432('0x7c')][_0x5432('0xdc')]=_0x4aa003['file'][_0x5432('0xdd')];_0x4aa003[_0x5432('0x7c')][_0x5432('0x44')]=_0x4aa003[_0x5432('0xde')][_0x5432('0xdf')];return db[_0x5432('0xe0')]['create'](_0x4aa003[_0x5432('0x7c')])[_0x5432('0x20')](respondWithResult(_0x234f1d,0xc9))['catch'](handleError(_0x234f1d,null));};exports[_0x5432('0xe1')]=function(_0x25b05d,_0x4d8359,_0x1f4f0c){return db[_0x5432('0x41')][_0x5432('0xc7')]({'where':{'id':_0x25b05d[_0x5432('0xbf')]['id']},'raw':!![]})[_0x5432('0x20')](handleEntityNotFound(_0x4d8359,null))['then'](function(_0x296cab){if(_0x296cab){if(_0x296cab[_0x5432('0xd7')]){return _0x4d8359[_0x5432('0x2a')](0x193)[_0x5432('0xe2')]({'status':0x193,'message':_0x5432('0xe3')});}return db[_0x5432('0xe0')][_0x5432('0xc7')]({'where':{'id':_0x25b05d[_0x5432('0x47')][_0x5432('0xe4')]},'raw':!![]})[_0x5432('0x20')](handleEntityNotFound(_0x4d8359,null));}})[_0x5432('0x20')](function(_0x3b0449){if(_0x3b0449){return _0x4d8359[_0x5432('0xe5')](path[_0x5432('0xe6')](config['root'],'server/files/attachments/',_0x3b0449[_0x5432('0xdc')]));}})[_0x5432('0x3f')](handleError(_0x4d8359,null));};exports['close']=function(_0x448eef,_0x102ae1){var _0x14ebe4=null;var _0x4577f5=null;var _0x261069=null;var _0x439db1=null;if(_0x448eef[_0x5432('0x7c')]['id']){delete _0x448eef[_0x5432('0x7c')]['id'];}if(_0x448eef[_0x5432('0x7c')][_0x5432('0xe7')]){_0x439db1=path[_0x5432('0xe6')](config[_0x5432('0xe8')],_0x5432('0xe9'),util[_0x5432('0xea')](_0x5432('0xeb'),Date['now']()));_0x448eef[_0x5432('0x7c')][_0x5432('0xec')]=_0x439db1;}return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0x448eef[_0x5432('0xbf')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x5432('0x7b')],'as':_0x5432('0x7b')}]}]})[_0x5432('0x20')](handleEntityNotFound(_0x102ae1,null))[_0x5432('0x20')](saveUpdates(_0x448eef['body'],null))[_0x5432('0x20')](function(_0x1c7a65){if(_0x1c7a65){_0x14ebe4=_0x1c7a65;return db[_0x5432('0xc8')][_0x5432('0x69')]({'where':{'id':_0x14ebe4[_0x5432('0x82')]}});}})[_0x5432('0x20')](function(_0x3c9a6c){if(_0x3c9a6c){_0x261069=_0x3c9a6c;return db['CmContact'][_0x5432('0x69')]({'where':{'id':_0x14ebe4[_0x5432('0x74')]}});}})['then'](function(_0x5b4795){if(_0x5b4795){_0x4577f5=_0x5b4795;if(_0x439db1){var _0xd9089f=null;for(var _0x2ba2a6=0x1;_0x2ba2a6<_0x14ebe4[_0x5432('0xed')][_0x5432('0x4c')];++_0x2ba2a6){_0xd9089f=_0x14ebe4['Messages'][_0x2ba2a6];var _0x415818=_0xd9089f[_0x5432('0xd6')]?util[_0x5432('0xea')](_0x5432('0xee'),_0x261069['agentAlias'],_0xd9089f[_0x5432('0xd6')]):_0x5432('0xef');var _0x5211de=_0x448eef[_0x5432('0x7c')][_0x5432('0xf0')]||util[_0x5432('0xea')](_0x5432('0xee'),_0x5432('0xf1'),_0xd9089f[_0x5432('0x74')]);switch(_0x261069['agentIdentifier']){case _0x5432('0xf2'):_0x415818=_0xd9089f['UserId']?util[_0x5432('0xea')](_0x5432('0xee'),_0x261069['agentAlias'],_0xd9089f[_0x5432('0xd6')]):_0x5432('0xef');break;case'agent_alias':_0x415818=_0xd9089f[_0x5432('0xd6')]?_0xd9089f[_0x5432('0x7b')][_0x5432('0xf3')]||_0xd9089f['User'][_0x5432('0x3a')]:_0x5432('0xef');break;case _0x5432('0xf4'):_0x415818=_0xd9089f[_0x5432('0xd6')]?_0xd9089f[_0x5432('0x7b')][_0x5432('0x3a')]:'System';break;default:_0x415818=_0xd9089f[_0x5432('0xd6')]?util[_0x5432('0xea')](_0x5432('0xee'),_0x261069[_0x5432('0xf5')],_0xd9089f[_0x5432('0xd6')]):_0x5432('0xef');}var _0x5e0035=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0xd9089f['createdAt'])[_0x5432('0xea')]('MM/DD/YYYY\x20HH:mm:ss'),_0xd9089f['direction']==='in'?_0x5211de:_0x415818,_0xd9089f['body']);if(!_0xd9089f[_0x5432('0xf6')]){fs['appendFileSync'](_0x439db1,_0x5e0035);}}return db[_0x5432('0xf7')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x5432('0xf8')],'as':_0x5432('0xf9'),'raw':!![]}]});}}})[_0x5432('0x20')](function(_0x5c4b4f){if(_0x5c4b4f&&_0x5c4b4f[_0x5432('0xf9')]&&_0x448eef['body']){var _0x300153={'tls':{'rejectUnauthorized':![]}};if(_0x5c4b4f[_0x5432('0xf9')][_0x5432('0xfa')]){_0x300153[_0x5432('0xfa')]=_0x5c4b4f['Smtp'][_0x5432('0xfa')];}else{_0x300153[_0x5432('0xfb')]=_0x5c4b4f[_0x5432('0xf9')][_0x5432('0xfb')];_0x300153[_0x5432('0xfc')]=_0x5c4b4f[_0x5432('0xf9')][_0x5432('0xfc')];_0x300153[_0x5432('0xfd')]=_0x5c4b4f['Smtp']['secure'];}if(_0x5c4b4f[_0x5432('0xf9')]['authentication']){_0x300153[_0x5432('0xfe')]={'user':_0x5c4b4f[_0x5432('0xf9')][_0x5432('0x9f')],'pass':_0x5c4b4f['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0x5432('0xff'),{'account':_0x300153,'message':{'from':util[_0x5432('0xea')](_0x5432('0x100'),_0x5c4b4f[_0x5432('0x37')],_0x5c4b4f['email']||_0x5c4b4f[_0x5432('0xf9')][_0x5432('0x9f')]),'to':_0x448eef[_0x5432('0x7c')]['mailTranscript'],'subject':_0x5432('0x101'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x448eef[_0x5432('0x7c')][_0x5432('0xe7')]),'attachments':[{'path':_0x439db1}]}})[_0x5432('0x20')](function(){return _0x14ebe4;})[_0x5432('0x3f')](function(_0x568abd){console[_0x5432('0x26')](_0x568abd);});}else{return _0x14ebe4;}})['then'](respondWithStatusCode(_0x102ae1,0xc8))[_0x5432('0x3f')](handleError(_0x102ae1,null));};exports['addMessage']=function(_0x41eb80,_0x268511,_0x4eefd9){return db[_0x5432('0xd1')][_0x5432('0x69')]({'where':{'id':_0x41eb80[_0x5432('0xbf')]['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x268511,null))[_0x5432('0x20')](function(_0x2e70a7){if(_0x2e70a7){return _0x2e70a7[_0x5432('0x102')](_0x41eb80[_0x5432('0x7c')]['ids'],_[_0x5432('0x103')](_0x41eb80[_0x5432('0x7c')],[_0x5432('0x104'),'id'])||{});}})[_0x5432('0x20')](respondWithResult(_0x268511,null))[_0x5432('0x3f')](handleError(_0x268511,null));};exports['getMessages']=function(_0x316aa1,_0x52f5c7,_0x558a4a){var _0x46b746={'raw':![],'where':{}};var _0x361b29={};var _0x2d9c3d={'count':0x0,'rows':[]};return db[_0x5432('0x41')][_0x5432('0xc7')]({'where':{'id':_0x316aa1[_0x5432('0xbf')]['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x52f5c7,null))[_0x5432('0x20')](function(_0x5098bc){if(_0x5098bc){_0x361b29[_0x5432('0x46')]=_[_0x5432('0x7d')](db[_0x5432('0xd1')][_0x5432('0x42')]);_0x361b29['query']=_[_0x5432('0x7d')](_0x316aa1[_0x5432('0x47')]);_0x361b29[_0x5432('0x48')]=_[_0x5432('0x49')](_0x361b29['model'],_0x361b29[_0x5432('0x47')]);_0x46b746[_0x5432('0x4b')]=_[_0x5432('0x49')](_0x361b29[_0x5432('0x46')],qs[_0x5432('0x4a')](_0x316aa1[_0x5432('0x47')][_0x5432('0x4a')]));_0x46b746[_0x5432('0x4b')]=_0x46b746[_0x5432('0x4b')][_0x5432('0x4c')]?_0x46b746[_0x5432('0x4b')]:_0x361b29[_0x5432('0x46')];if(!_0x316aa1[_0x5432('0x47')][_0x5432('0x4d')](_0x5432('0x4e'))){_0x46b746[_0x5432('0x2d')]=qs['limit'](_0x316aa1[_0x5432('0x47')][_0x5432('0x2d')]);_0x46b746[_0x5432('0x2c')]=qs[_0x5432('0x2c')](_0x316aa1[_0x5432('0x47')][_0x5432('0x2c')]);}_0x46b746['order']=qs[_0x5432('0x105')](_0x316aa1[_0x5432('0x47')][_0x5432('0x105')]);_0x46b746[_0x5432('0x83')]=qs[_0x5432('0x48')](_[_0x5432('0x50')](_0x316aa1['query'],_0x361b29[_0x5432('0x48')]));_0x46b746[_0x5432('0x83')][_0x5432('0x106')]=_0x5098bc['id'];if(_0x316aa1[_0x5432('0x47')]['filter']){_0x46b746[_0x5432('0x83')]=_['merge'](_0x46b746[_0x5432('0x83')],{'$or':_[_0x5432('0x40')](_0x46b746[_0x5432('0x4b')],function(_0x431473){var _0x2f0598={};_0x2f0598[_0x431473]={'$like':'%'+_0x316aa1[_0x5432('0x47')]['filter']+'%'};return _0x2f0598;})});}if(_0x316aa1[_0x5432('0x47')][_0x5432('0x86')]){var _0x1c3fc6=_0x316aa1[_0x5432('0x47')][_0x5432('0x86')]['split'](',');var _0x3f4ba2={};_0x3f4ba2[_0x1c3fc6[0x0]]={'$gte':moment(_0x1c3fc6[0x1])[_0x5432('0xea')]('YYYY-MM-DD\x20HH:mm:ss')};_0x46b746[_0x5432('0x83')]=_[_0x5432('0xc2')](_0x46b746['where'],_0x3f4ba2);}_0x46b746=_[_0x5432('0xc2')]({},_0x46b746,_0x316aa1[_0x5432('0xc3')]);return db['ChatMessage'][_0x5432('0x2b')]({'where':_0x46b746[_0x5432('0x83')]})['then'](function(_0x1b9082){_0x2d9c3d[_0x5432('0x2b')]=_0x1b9082;if(_0x316aa1[_0x5432('0x47')][_0x5432('0xc0')]){_0x46b746[_0x5432('0xc1')]=[{'all':!![]}];}return db['ChatMessage'][_0x5432('0x107')](_0x46b746);})[_0x5432('0x20')](function(_0xa5eb40){_0x2d9c3d['rows']=_0xa5eb40;return _0x2d9c3d;});}})[_0x5432('0x20')](respondWithFilteredResult(_0x52f5c7,_0x46b746))[_0x5432('0x3f')](handleError(_0x52f5c7,null));};exports[_0x5432('0x108')]=function(_0x4b7cd7,_0x50a55f,_0x4cea33){var _0x5849d6={'where':{}},_0x33386b={},_0x855af3={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x5432('0xc7')]({'where':{'id':_0x4b7cd7[_0x5432('0xbf')]['id']}})['then'](handleEntityNotFound(_0x50a55f,null))[_0x5432('0x20')](function(_0x4ba77c){if(_0x4ba77c){_0x33386b[_0x5432('0x46')]=_[_0x5432('0x7d')](db[_0x5432('0xd1')][_0x5432('0x42')]);_0x33386b[_0x5432('0x47')]=_['keys'](_0x4b7cd7[_0x5432('0x47')]);_0x33386b[_0x5432('0x48')]=_[_0x5432('0x49')](_0x33386b['model'],_0x33386b[_0x5432('0x47')]);_0x5849d6[_0x5432('0x4b')]=_['intersection'](_0x33386b[_0x5432('0x46')],qs[_0x5432('0x4a')](_0x4b7cd7[_0x5432('0x47')]['fields']));_0x5849d6['attributes']=_0x5849d6[_0x5432('0x4b')]['length']?_0x5849d6['attributes']:_0x33386b[_0x5432('0x46')];if(!_0x4b7cd7[_0x5432('0x47')]['hasOwnProperty'](_0x5432('0x4e'))){_0x5849d6[_0x5432('0x2d')]=qs[_0x5432('0x2d')](_0x4b7cd7[_0x5432('0x47')][_0x5432('0x2d')]);_0x5849d6[_0x5432('0x2c')]=qs[_0x5432('0x2c')](_0x4b7cd7['query'][_0x5432('0x2c')]);}_0x5849d6[_0x5432('0x4f')]=qs[_0x5432('0x105')](_0x4b7cd7['query'][_0x5432('0x105')]);_0x5849d6['where']=qs[_0x5432('0x48')](_[_0x5432('0x50')](_0x4b7cd7[_0x5432('0x47')],_0x33386b[_0x5432('0x48')]));_0x5849d6[_0x5432('0x83')][_0x5432('0x106')]=_0x4ba77c['id'];if(_0x4b7cd7['query']['filter']){_0x5849d6[_0x5432('0x83')]=_[_0x5432('0xc2')](_0x5849d6['where'],{'$or':_[_0x5432('0x40')](_0x5849d6[_0x5432('0x4b')],function(_0x47b945){var _0x18da80={};_0x18da80[_0x47b945]={'$like':'%'+_0x4b7cd7[_0x5432('0x47')][_0x5432('0x91')]+'%'};return _0x18da80;})});}_0x5849d6['where'][_0x5432('0xf6')]=![];if(_0x4b7cd7[_0x5432('0x47')]['id']){_0x5849d6[_0x5432('0x83')]['id']={'$gt':_0x4b7cd7[_0x5432('0x47')]['id']};}_0x5849d6=_[_0x5432('0xc2')]({},_0x5849d6,_0x4b7cd7[_0x5432('0xc3')]);return db[_0x5432('0xd1')]['count']({'where':_0x5849d6[_0x5432('0x83')]})[_0x5432('0x20')](function(_0x55c093){_0x855af3[_0x5432('0x2b')]=_0x55c093;_0x5849d6['include']=[];if(_0x4b7cd7[_0x5432('0x47')]['includeAgent']){_0x5849d6['include'][_0x5432('0x3e')]({'model':db[_0x5432('0x7b')],'as':_0x5432('0x7b'),'attributes':['id',_0x5432('0x3a'),_0x5432('0xf3')]});}if(_0x4b7cd7[_0x5432('0x47')]['includeAll']){_0x5849d6['include']=[{'all':!![]}];}return db[_0x5432('0xd1')]['findAll'](_0x5849d6);})[_0x5432('0x20')](function(_0x1d8b6f){_0x855af3[_0x5432('0xbd')]=_0x1d8b6f;return _0x855af3;});}})[_0x5432('0x20')](respondWithFilteredResult(_0x50a55f,_0x5849d6))[_0x5432('0x3f')](handleError(_0x50a55f,null));};exports[_0x5432('0x109')]=function(_0x1119d8,_0x404ba3,_0x30463f){return db['ChatInteraction']['find']({'where':{'id':_0x1119d8[_0x5432('0xbf')]['id']}})[_0x5432('0x20')](handleEntityNotFound(_0x404ba3,null))[_0x5432('0x20')](function(_0x2e9669){if(_0x2e9669){return _0x2e9669[_0x5432('0x10a')](_0x1119d8[_0x5432('0x7c')][_0x5432('0x104')],_[_0x5432('0x103')](_0x1119d8[_0x5432('0x7c')],[_0x5432('0x104'),'id'])||{})[_0x5432('0x10b')](function(){return db[_0x5432('0x78')][_0x5432('0x107')]({'attributes':['id',_0x5432('0x37'),_0x5432('0x53')],'where':{'id':_0x1119d8[_0x5432('0x7c')]['ids']}});})[_0x5432('0x20')](function(_0x1d3bd1){socket[_0x5432('0x10c')](_0x5432('0x10d'),{'id':Number(_0x1119d8[_0x5432('0xbf')]['id']),'tags':_0x1d3bd1||[]});return{'id':Number(_0x1119d8[_0x5432('0xbf')]['id']),'tags':_0x1d3bd1||[]};});}})[_0x5432('0x20')](respondWithResult(_0x404ba3,null))[_0x5432('0x3f')](handleError(_0x404ba3,null));};exports[_0x5432('0x10e')]=function(_0xb2a132,_0x4d9757,_0x9c47c1){return db[_0x5432('0x41')][_0x5432('0x69')]({'where':{'id':_0xb2a132[_0x5432('0xbf')]['id']}})['then'](handleEntityNotFound(_0x4d9757,null))[_0x5432('0x20')](function(_0x1fccdf){if(_0x1fccdf){return _0x1fccdf[_0x5432('0x10e')](_0xb2a132[_0x5432('0x47')][_0x5432('0x104')]);}})['then'](respondWithStatusCode(_0x4d9757,null))['catch'](handleError(_0x4d9757,null));};exports[_0x5432('0xe5')]=function(_0x22ae00,_0x2a0ba9){var _0x593e9f=moment()[_0x5432('0x10f')]()[_0x5432('0xa4')]();var _0x3489a0=path['join'](config[_0x5432('0xe8')],_0x5432('0x110'),_0x5432('0x111'),_0x5432('0x112'));var _0x362a42=path[_0x5432('0xe6')](config[_0x5432('0xe8')],_0x5432('0x110'),'files','attachments');var _0x5c97b7=path['join'](_0x3489a0,_0x593e9f);var _0xfb4184=util[_0x5432('0xea')]('transcript-%d-%s.zip',_0x22ae00[_0x5432('0xbf')]['id'],_0x593e9f);var _0xb80586=path[_0x5432('0xe6')](_0x3489a0,_0xfb4184);var _0x1753c3=[];_0x1753c3['push']({'model':db[_0x5432('0x7b')],'as':_0x5432('0x7b'),'attributes':['id',_0x5432('0x3a')],'raw':!![]});_0x1753c3['push']({'model':db[_0x5432('0x113')],'as':_0x5432('0x6e'),'attributes':['id','firstName',_0x5432('0x114')],'raw':!![]});if(_0x22ae00[_0x5432('0x47')][_0x5432('0x115')]){_0x1753c3[_0x5432('0x3e')]({'model':db[_0x5432('0xe0')],'as':_0x5432('0xe0'),'raw':!![]});}var _0x4620f4=[{'model':db[_0x5432('0xd1')],'as':_0x5432('0xed'),'attributes':['id','body',_0x5432('0x85'),_0x5432('0x116'),_0x5432('0xf6'),_0x5432('0x8d')],'include':_0x1753c3}];_0x4620f4[_0x5432('0x3e')]({'model':db[_0x5432('0xc8')],'as':_0x5432('0x117'),'attributes':['id',_0x5432('0x37')]});_0x4620f4[_0x5432('0x3e')]({'model':db[_0x5432('0x7b')],'as':_0x5432('0x118'),'attributes':['id',_0x5432('0x3a')]});return db['ChatInteraction']['find']({'where':{'id':_0x22ae00[_0x5432('0xbf')]['id']},'include':_0x4620f4})[_0x5432('0x20')](handleEntityNotFound(_0x2a0ba9,null))[_0x5432('0x20')](function(_0x521ba8){if(_0x521ba8){var _0x3504d7=_0x521ba8['get']({'plain':!![]});fs[_0x5432('0x119')](_0x5c97b7);var _0x321d5f={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x5432('0x11a')}},'footer':{'height':'30px','contents':{'default':util[_0x5432('0xea')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x5432('0xea')](_0x5432('0x11b'),_0x5432('0x11c'),_0x3504d7['id']),moment()[_0x5432('0xea')](_0x5432('0x11d'))['toString']())}}};var _0x2e4b2d={'channel':'Chat','account':_0x3504d7['Account'][_0x5432('0x37')],'agent':_0x3504d7[_0x5432('0x118')]?_0x3504d7[_0x5432('0x118')]['fullname']:_0x5432('0x11e'),'createdAt':moment(_0x3504d7['createdAt'])[_0x5432('0xea')](_0x5432('0x11f'))[_0x5432('0xa4')](),'closedAt':_0x3504d7['closed']?moment(_0x3504d7[_0x5432('0x120')])[_0x5432('0xea')](_0x5432('0x11f'))[_0x5432('0xa4')]():'','disposition':_0x3504d7['disposition'],'chatInfo':{'browser':_0x3504d7['browserName'],'os':_0x3504d7[_0x5432('0x121')],'referer':_0x3504d7['referer'],'customerIp':_0x3504d7[_0x5432('0x122')],'customerPort':_0x3504d7[_0x5432('0x123')]?_0x3504d7[_0x5432('0x123')]:_0x5432('0x11e')},'messages':_(_0x3504d7[_0x5432('0xed')])['tail']()[_0x5432('0x91')]({'secret':![]})[_0x5432('0x40')](function(_0x19b279){if(_0x19b279[_0x5432('0xe0')]){var _0x332560=path[_0x5432('0xe6')](_0x362a42,_0x19b279[_0x5432('0xe0')][_0x5432('0xdc')]);if(fs[_0x5432('0x124')](_0x332560)){fs[_0x5432('0x125')](_0x332560)['pipe'](fs[_0x5432('0x126')](path['join'](_0x5c97b7,_0x19b279[_0x5432('0xe0')][_0x5432('0xdc')])));}}return{'date':moment(_0x19b279[_0x5432('0x85')])[_0x5432('0xea')](_0x5432('0x11f'))[_0x5432('0xa4')](),'sender':_0x19b279[_0x5432('0x116')]===_0x5432('0xd0')?_0x19b279[_0x5432('0x7b')]?_0x19b279['User']['fullname']:_0x5432('0xef'):_0x19b279['Contact']['firstName']+(_0x19b279[_0x5432('0x6e')][_0x5432('0x114')]?'\x20'+_0x19b279[_0x5432('0x6e')][_0x5432('0x114')]:''),'body':_0x19b279[_0x5432('0xe0')]?_0x19b279[_0x5432('0xe0')][_0x5432('0xdc')]:_0x19b279[_0x5432('0x7c')],'direction':_0x19b279[_0x5432('0x116')]===_0x5432('0xd0')?'A':'C','secret':_0x19b279[_0x5432('0xf6')],'read':_0x19b279[_0x5432('0x8d')],'attachment':_0x19b279[_0x5432('0xe0')]};})[_0x5432('0x6b')]()};return ejs[_0x5432('0x127')](path[_0x5432('0xe6')](config[_0x5432('0xe8')],'server',_0x5432('0x128'),_0x5432('0x129')),{'interaction':_0x2e4b2d})[_0x5432('0x20')](function(_0x59ad68){return new BPromise(function(_0xb3812d,_0x806b98){pdf[_0x5432('0xc4')](_0x59ad68,_0x321d5f)[_0x5432('0x12a')](path['join'](_0x5c97b7,_0x5432('0x12b')+_0x3504d7['id']+'-'+_0x593e9f+_0x5432('0x12c')),function(_0x4537e0,_0x2f13c9){if(_0x4537e0)return _0x806b98(_0x4537e0);_0xb3812d(_0x2f13c9);});});})[_0x5432('0x20')](function(){return new BPromise(function(_0x337345,_0x5945b1){zipdir(_0x5c97b7,{'saveTo':_0xb80586},function(_0x4af49d,_0x287e3f){if(_0x4af49d)return _0x5945b1(_0x4af49d);return _0x337345(_0x287e3f);});})[_0x5432('0x20')](function(){return new BPromise(function(_0x20eed8,_0x4a9db2){rimraf(_0x5c97b7,function(_0x374f00){if(_0x374f00)_0x4a9db2(_0x374f00);return _0x20eed8();});});})[_0x5432('0x20')](function(){return _0x2a0ba9[_0x5432('0xe5')](_0xb80586,_0xfb4184,function(_0x367efa){if(_0x367efa){console['log'](_0x5432('0x12d'),_0x367efa);}else{fs[_0x5432('0x12e')](_0xb80586);}});});});}else{return _0x2a0ba9['sendStatus'](0xc8);}})[_0x5432('0x3f')](handleError(_0x2a0ba9,null));}; \ No newline at end of file +var _0x66fa=['./chatInteraction.socket','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','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','Users','map','fullname','split','Tags','push','TagIds','index','ChatInteraction','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','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','type','body','buildExpression','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','params','includeAll','include','create','describe','createVidaooSession','findOne','vidaooEscalation','vidaooApiKey','POST','MotionCWB:','join_url','out','user','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','json','Unauthorized','attachId','download','join','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','CmContact','%s%d','agentAlias','Visitor','website_alias','agent_alias','alias','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','SendMail','sendMail','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','includeAgent','rows','addTags','spread','emit','chatInteractionTags:save','unix','root','server','files','attachments','transcript-%d-%s.zip','firstName','ChatWebsite','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','N.A.','closedAt','disposition','browserName','referer','customerIp','customerPort','tail','createReadStream','createWriteStream','lastName','renderFile','views','downloadInteraction.html','transcript-','log','err','unlinkSync','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'];(function(_0x5236ca,_0x491291){var _0x214b20=function(_0x55b6a5){while(--_0x55b6a5){_0x5236ca['push'](_0x5236ca['shift']());}};_0x214b20(++_0x491291);}(_0x66fa,0x117));var _0xa66f=function(_0x451c22,_0x544ec3){_0x451c22=_0x451c22-0x0;var _0x1ab46d=_0x66fa[_0x451c22];return _0x1ab46d;};'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);var jayson=require('jayson/promise');var client=jayson['client'][_0xa66f('0x19')]({'port':0x232b});var client9004=jayson[_0xa66f('0x1a')][_0xa66f('0x19')]({'port':0x232c});function checkPasswordPattern(_0x236d64,_0xd348f9,_0x567d4f){if(_0x567d4f){var _0x5510dc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5510dc[_0xa66f('0x1b')](_0xd348f9)){return _0x236d64;}else{throw new db[(_0xa66f('0x1c'))][(_0xa66f('0x1d'))](_0xa66f('0x1e'));}}else{return _0x236d64;}}function respondWithRpcPromise(_0x5c67f5,_0x1cbe64,_0x55b59d,_0x4a28d4){return new BPromise(function(_0x2f9da2,_0x413e80){var _0x342477=_0x4a28d4||client;return _0x342477[_0xa66f('0x1f')](_0x5c67f5,_0x55b59d)[_0xa66f('0x20')](function(_0x408bc7){logger[_0xa66f('0x21')](_0xa66f('0x22'),_0x1cbe64,_0xa66f('0x23'));logger[_0xa66f('0x24')](_0xa66f('0x25'),_0x1cbe64,_0xa66f('0x23'),JSON[_0xa66f('0x26')](_0x408bc7));if(_0x408bc7[_0xa66f('0x27')]){if(_0x408bc7[_0xa66f('0x27')]['code']===0x1f4){logger[_0xa66f('0x27')](_0xa66f('0x22'),_0x1cbe64,_0x408bc7[_0xa66f('0x27')][_0xa66f('0x28')]);return _0x413e80(_0x408bc7['error'][_0xa66f('0x28')]);}logger[_0xa66f('0x27')](_0xa66f('0x22'),_0x1cbe64,_0x408bc7[_0xa66f('0x27')]['message']);return _0x2f9da2(_0x408bc7['error'][_0xa66f('0x28')]);}else{logger['info'](_0xa66f('0x22'),_0x1cbe64,_0xa66f('0x23'));_0x2f9da2(_0x408bc7[_0xa66f('0x29')]['message']);}})[_0xa66f('0x2a')](function(_0x1c2903){logger[_0xa66f('0x27')](_0xa66f('0x22'),_0x1cbe64,_0x1c2903);_0x413e80(_0x1c2903);});});}function respondWithStatusCode(_0x17c103,_0x236046){_0x236046=_0x236046||0xcc;return function(_0x1eb86a){if(_0x1eb86a){return _0x17c103[_0xa66f('0x2b')](_0x236046);}return _0x17c103[_0xa66f('0x2c')](_0x236046)[_0xa66f('0x2d')]();};}function respondWithResult(_0x45f71c,_0x63650b){_0x63650b=_0x63650b||0xc8;return function(_0x42b966){if(_0x42b966){return _0x45f71c[_0xa66f('0x2c')](_0x63650b)['json'](_0x42b966);}};}function respondWithFilteredResult(_0x4c0695,_0x38daac){return function(_0x27ceae){if(_0x27ceae){var _0x55f309=_0x27ceae[_0xa66f('0x2e')],_0x44c79a=_0x38daac[_0xa66f('0x2f')],_0x2de5f3=_0x38daac[_0xa66f('0x2f')]+_0x38daac[_0xa66f('0x30')],_0x4cd7f2;if(_0x2de5f3>=_0x55f309){_0x2de5f3=_0x55f309;_0x4cd7f2=0xc8;}else{_0x4cd7f2=0xce;}_0x4c0695[_0xa66f('0x2c')](_0x4cd7f2);return _0x4c0695['set'](_0xa66f('0x31'),_0x44c79a+'-'+_0x2de5f3+'/'+_0x55f309)['json'](_0x27ceae);}return null;};}function patchUpdates(_0x306b35){return function(_0x35a0a7){try{jsonpatch[_0xa66f('0x32')](_0x35a0a7,_0x306b35,!![]);}catch(_0x486e4e){return BPromise[_0xa66f('0x33')](_0x486e4e);}return _0x35a0a7[_0xa66f('0x34')]();};}function saveUpdates(_0x4f1668,_0x1a5d4a){return function(_0x35a847){if(_0x35a847){return _0x35a847[_0xa66f('0x35')](_0x4f1668)[_0xa66f('0x20')](function(_0x10a782){return _0x10a782;});}return null;};}function removeEntity(_0x2452d2,_0x25c74c){return function(_0x41303c){if(_0x41303c){return _0x41303c[_0xa66f('0x36')]()[_0xa66f('0x20')](function(){_0x2452d2['status'](0xcc)[_0xa66f('0x2d')]();});}};}function handleEntityNotFound(_0x5bf736,_0x1c7eda){return function(_0x46f6cc){if(!_0x46f6cc){_0x5bf736[_0xa66f('0x2b')](0x194);}return _0x46f6cc;};}function handleError(_0x3b9261,_0x3722d3){_0x3722d3=_0x3722d3||0x1f4;return function(_0x201432){logger[_0xa66f('0x27')](_0x201432[_0xa66f('0x37')]);if(_0x201432['name']){delete _0x201432[_0xa66f('0x38')];}_0x3b9261['status'](_0x3722d3)[_0xa66f('0x39')](_0x201432);};}function getInteractionUsers(_0x45eeb8,_0x2ed1fb){return new BPromise(function(_0x47b21a,_0x4d60f9){try{if(_0x2ed1fb[_0x45eeb8['id']]){_0x45eeb8[_0xa66f('0x3a')]=_[_0xa66f('0x3b')](_0x2ed1fb[_0x45eeb8['id']],function(_0x20b07e){return{'id':_0x20b07e['id'],'fullname':_0x20b07e[_0xa66f('0x3c')]};});}}catch(_0x330169){_0x4d60f9(_0x330169);}_0x47b21a(_0x45eeb8);});}function getInteractionTags(_0x581dca,_0x5cb0a9){return new BPromise(function(_0x49b869,_0x30f7de){try{if(_0x581dca['TagIds']){_0x581dca['Tags']=[];_0x581dca['TagIds'][_0xa66f('0x3d')](',')['forEach'](function(_0x8965d3){_0x581dca[_0xa66f('0x3e')][_0xa66f('0x3f')](_0x5cb0a9[_0x8965d3]);});}delete _0x581dca[_0xa66f('0x40')];}catch(_0xd65c5d){_0x30f7de(_0xd65c5d);}_0x49b869(_0x581dca);});}function updateChatInteraction(_0x360e61,_0x192033,_0x261089){return new BPromise(function(_0x32ba8b,_0x2f2a98){return getInteractionUsers(_0x360e61,_0x261089)[_0xa66f('0x20')](function(_0x93f6ff){return getInteractionTags(_0x93f6ff,_0x192033);})[_0xa66f('0x20')](function(_0x13875a){_0x32ba8b(_0x13875a);})['catch'](function(_0x36037c){_0x2f2a98(_0x36037c);});});}exports[_0xa66f('0x41')]=function(_0x58c1f2,_0x248587){var _0x4b6e6b={},_0xd69aa4={},_0x27adf4={'count':0x0,'rows':[]};var _0x5f5b25=_[_0xa66f('0x3b')](db[_0xa66f('0x42')][_0xa66f('0x43')],function(_0x5276ea){return{'name':_0x5276ea[_0xa66f('0x44')],'type':_0x5276ea['type'][_0xa66f('0x45')]};});_0xd69aa4[_0xa66f('0x46')]=_[_0xa66f('0x3b')](_0x5f5b25,_0xa66f('0x38'));_0xd69aa4[_0xa66f('0x47')]=_[_0xa66f('0x48')](_0x58c1f2[_0xa66f('0x47')]);_0xd69aa4['filters']=_[_0xa66f('0x49')](_0xd69aa4[_0xa66f('0x46')],_0xd69aa4[_0xa66f('0x47')]);_0x4b6e6b[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0xd69aa4['model'],qs['fields'](_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x4b')]));_0x4b6e6b[_0xa66f('0x4a')]=_0x4b6e6b[_0xa66f('0x4a')][_0xa66f('0x4c')]?_0x4b6e6b[_0xa66f('0x4a')]:_0xd69aa4['model'];if(!_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x4d')](_0xa66f('0x4e'))){_0x4b6e6b['limit']=qs['limit'](_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x30')]);_0x4b6e6b[_0xa66f('0x2f')]=qs['offset'](_0x58c1f2['query']['offset']);}_0x4b6e6b[_0xa66f('0x4f')]=qs[_0xa66f('0x50')](_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x50')]);_0x4b6e6b[_0xa66f('0x51')]=qs[_0xa66f('0x52')](_[_0xa66f('0x53')](_0x58c1f2[_0xa66f('0x47')],_0xd69aa4['filters']),_0x5f5b25);var _0x1a299c=[];var _0x962415=squel[_0xa66f('0x54')]()[_0xa66f('0x55')]('id')[_0xa66f('0x55')](_0xa66f('0x38'))['field'](_0xa66f('0x56'))[_0xa66f('0x57')](_0xa66f('0x58'));var _0x13848d=squel[_0xa66f('0x54')]()['field'](_0xa66f('0x59'))['field'](_0xa66f('0x5a'))['field']('ui.ChatInteractionId')[_0xa66f('0x57')](_0xa66f('0x5b'),'ui')[_0xa66f('0x5c')](_0xa66f('0x5d'),'u',_0xa66f('0x5e'));var _0xe97cf4=squel['select']()[_0xa66f('0x57')](_0xa66f('0x5f'),'i')[_0xa66f('0x5c')](_0xa66f('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa66f('0x5c')]('users','o',_0xa66f('0x61'))[_0xa66f('0x5c')](_0xa66f('0x62'),'a',_0xa66f('0x63'))[_0xa66f('0x5c')](_0xa66f('0x64'),'me',_0xa66f('0x65'))['left_join'](_0xa66f('0x66'),'it',_0xa66f('0x67'))[_0xa66f('0x5c')](_0xa66f('0x58'),'t',_0xa66f('0x68'));var _0x45989a=squel[_0xa66f('0x69')]();var _0x323145=[];var _0x350fce=squel['expr']();var _0x5aed74;if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x6a')]){_0x5aed74=as[_0xa66f('0x6b')](_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x6a')]);var _0x1fd3f0=_0x5aed74[_0xa66f('0x6c')];for(var _0x4b10cf=0x0;_0x4b10cf<_0x5aed74[_0xa66f('0x6d')][_0xa66f('0x4c')];_0x4b10cf++){var _0x37b99b=_0x5aed74[_0xa66f('0x6d')][_0x4b10cf];var _0x53d22a='i';var _0x29f216=_[_0xa66f('0x6e')](_0x5f5b25,[_0xa66f('0x38'),_0x37b99b[_0xa66f('0x55')]]);if(!_0x29f216){switch(_0x37b99b[_0xa66f('0x55')]){case _0xa66f('0x6f'):if(_0x37b99b['value']==0x1){_0xe97cf4['having']('`'+_0x37b99b[_0xa66f('0x55')]+_0xa66f('0x70'));}else{_0xe97cf4[_0xa66f('0x71')]('`'+_0x37b99b['field']+_0xa66f('0x72'));}break;case _0xa66f('0x73'):if(_0x37b99b[_0xa66f('0x74')]===_0xa66f('0x75')){if(_0x37b99b[_0xa66f('0x76')][_0xa66f('0x3d')]('\x20')[_0xa66f('0x4c')]>0x1){_0x45989a[_0x1fd3f0](_0xa66f('0x77'),qs[_0xa66f('0x78')](_0x37b99b['value']),null);}else{var _0x394d20='%'+_0x37b99b[_0xa66f('0x76')]+'%';_0x45989a[_0x1fd3f0](_0xa66f('0x79'),_0x394d20,_0x394d20,_0x394d20);}}else{_0x29f216=_[_0xa66f('0x6e')](_0x5f5b25,[_0xa66f('0x38'),_0xa66f('0x7a')]);_0x37b99b[_0xa66f('0x55')]=_0xa66f('0x7a');_0xa6c576=as['buildExpression'](_0x53d22a,_0x29f216['type'],_0x37b99b);_0x45989a[_0x1fd3f0](_0xa6c576[_0xa66f('0x7b')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x7c')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x2d')]);}break;case'Tag':var _0x44525a=_0x37b99b['value'][_0xa66f('0x3d')](',')[_0xa66f('0x3b')](function(_0x450e1d){return Number(_0x450e1d);});_0x44525a[_0xa66f('0x7d')](function(_0x556fbe){_0x350fce['or'](_0xa66f('0x7e'),'%,'+_0x556fbe+',%');});_0x323145=_[_0xa66f('0x7f')](_0x323145,_0x44525a);break;case _0xa66f('0x80'):if(_0x37b99b[_0xa66f('0x74')]===_0xa66f('0x75')){_0x45989a[_0x1fd3f0](_0xa66f('0x81'),'%'+_0x37b99b[_0xa66f('0x76')]+'%',null);}else{_0x29f216=_[_0xa66f('0x6e')](_0x5f5b25,[_0xa66f('0x38'),_0xa66f('0x82')]);_0x37b99b[_0xa66f('0x55')]=_0xa66f('0x82');_0xa6c576=as['buildExpression'](_0x53d22a,_0x29f216[_0xa66f('0x83')],_0x37b99b);_0x45989a[_0x1fd3f0](_0xa6c576[_0xa66f('0x7b')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x7c')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x2d')]);}break;case _0xa66f('0x84'):_0xa6c576=as[_0xa66f('0x85')]('me',null,_0x37b99b);_0x45989a[_0x1fd3f0](_0xa6c576['text'],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x7c')],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x2d')]);break;}}else{var _0xa6c576=as[_0xa66f('0x85')](_0x53d22a,_0x29f216[_0xa66f('0x83')],_0x37b99b);_0x45989a[_0x1fd3f0](_0xa6c576[_0xa66f('0x7b')],_0xa6c576['value']['start'],_0xa6c576[_0xa66f('0x76')][_0xa66f('0x2d')]);}}}else{var _0x34a590=_(_0x58c1f2['query'])['keys']()[_0xa66f('0x3b')](function(_0x421290){return _[_0xa66f('0x86')](_0x5f5b25,[_0xa66f('0x38'),_0x421290])?_0x421290:undefined;})['compact']()[_0xa66f('0x76')]();if(!_[_0xa66f('0x87')](_0x34a590)){_0x34a590[_0xa66f('0x7d')](function(_0x391d4d){if(_0x391d4d===_0xa66f('0x88')){_0xe97cf4[_0xa66f('0x51')](_0xa66f('0x89'),[][_0xa66f('0x8a')](_0x58c1f2['query'][_0x391d4d]));}else if(_0x391d4d===_0xa66f('0x8b')){var _0xbf4084=JSON['parse'](_0x58c1f2['query'][_0x391d4d])[_0xa66f('0x8c')];var _0x1d64a8=JSON['parse'](_0x58c1f2[_0xa66f('0x47')][_0x391d4d])['$lte'];_0xe97cf4[_0xa66f('0x51')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xbf4084,_0x1d64a8);}else{if(_0x58c1f2['query'][_0x391d4d]==='null'){_0xe97cf4[_0xa66f('0x51')]('i.'+_0x391d4d+_0xa66f('0x8d'));}else{_0xe97cf4[_0xa66f('0x51')]('i.'+_0x391d4d+_0xa66f('0x8e'),_0x58c1f2[_0xa66f('0x47')][_0x391d4d]);}}});}if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x8f')]){if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x8f')]==0x1){_0xe97cf4[_0xa66f('0x71')](_0xa66f('0x90'));}else{_0xe97cf4[_0xa66f('0x71')](_0xa66f('0x91'));}}if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x92')]){_0x323145=_[_0xa66f('0x93')](_0x58c1f2['query'][_0xa66f('0x92')])?_0x58c1f2['query'][_0xa66f('0x92')]:new Array(_0x58c1f2['query'][_0xa66f('0x92')]);_0x323145[_0xa66f('0x7d')](function(_0x2bb4e5){_0x350fce['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2bb4e5+',%');});}if(_0x58c1f2['query'][_0xa66f('0x94')]){var _0x30bbee=_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x94')][_0xa66f('0x95')]('\x5c','\x5c\x5c')[_0xa66f('0x95')]('\x27\x27',_0xa66f('0x96'));if(qs['isNumeric'](_0x30bbee)){_0x45989a['or'](_0xa66f('0x97'),_0x30bbee+'%');}else{_0x45989a['or'](_0xa66f('0x98'),qs[_0xa66f('0x78')](_0x30bbee))['or'](_0xa66f('0x99'),_0x30bbee+'%');}}}_0xe97cf4[_0xa66f('0x51')](_0x45989a);_0xe97cf4[_0xa66f('0x9a')](_0xa66f('0x9b'));var _0x3cdf95={'type':db[_0xa66f('0x1c')][_0xa66f('0x9c')][_0xa66f('0x9d')],'raw':!![]};var _0x9c7e02=_0xe97cf4[_0xa66f('0x9e')]();_0x9c7e02['field'](_0xa66f('0x9b'));_0x9c7e02[_0xa66f('0x55')](_0xa66f('0x9f'),_0xa66f('0x6f'));if(_0x4b6e6b[_0xa66f('0x4f')]){_0x4b6e6b[_0xa66f('0x4f')][_0xa66f('0x7d')](function(_0xffd447){_0xe97cf4[_0xa66f('0x4f')]('i.'+_0xffd447[0x0],_0xffd447[0x1]==='DESC'?![]:!![]);});}if(!_[_0xa66f('0x87')](_0x323145)){_0xe97cf4['having'](_0x350fce);_0x9c7e02[_0xa66f('0x51')]('t.id\x20IN\x20?',_0x323145);}BPromise[_0xa66f('0xa0')]()['then'](function(){if(!_0x5aed74){if(_0x58c1f2[_0xa66f('0x47')]['ChatWebsiteId']||_0x58c1f2[_0xa66f('0x47')][_0xa66f('0xa1')])return;_0x9c7e02[_0xa66f('0x51')](_0xa66f('0xa2'));_0xe97cf4[_0xa66f('0x51')](_0xa66f('0xa2'));return;}return _0x58c1f2['user'][_0xa66f('0xa3')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x20')](function(_0x43ebd5){if(_['isEmpty'](_0x43ebd5)){_0x9c7e02[_0xa66f('0x51')](_0xa66f('0xa4'));_0xe97cf4['where'](_0xa66f('0xa4'));}else{_0x9c7e02[_0xa66f('0x51')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x43ebd5,'id'));_0xe97cf4[_0xa66f('0x51')](_0xa66f('0x89'),_[_0xa66f('0x3b')](_0x43ebd5,'id'));}});})[_0xa66f('0x20')](function(){db[_0xa66f('0xa5')]['query'](_0x9c7e02[_0xa66f('0xa6')](),_0x3cdf95)[_0xa66f('0x20')](function(_0x4ebc0f){_0x27adf4[_0xa66f('0x2e')]=_0x4ebc0f[_0xa66f('0x4c')];if(_0x27adf4['count']===0x0)return[];return db[_0xa66f('0xa5')][_0xa66f('0x47')](_0x962415[_0xa66f('0xa6')](),_0x3cdf95)[_0xa66f('0x20')](function(_0x1f28e8){_0x1a299c=_['keyBy'](_0x1f28e8,'id');_0x3cdf95=_[_0xa66f('0xa7')](_0x3cdf95,{'model':db[_0xa66f('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x58c1f2[_0xa66f('0x47')][_0xa66f('0x4b')]){_0x4b6e6b[_0xa66f('0x4a')][_0xa66f('0x7d')](function(_0x4e318d){_0xe97cf4[_0xa66f('0x55')]('i.'+_0x4e318d);});}else{_0xe97cf4[_0xa66f('0x55')](_0xa66f('0x9f'),_0xa66f('0x6f'));_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xa8'),_0xa66f('0xa9'));_0xe97cf4['field']('a.mandatoryDisposition',_0xa66f('0xaa'));_0xe97cf4['field'](_0xa66f('0xab'));_0xe97cf4[_0xa66f('0x55')]('c.firstName',_0xa66f('0xac'));_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xad'),'Contact.lastName');_0xe97cf4['field'](_0xa66f('0xae'),'Contact.email');_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xaf'),_0xa66f('0xb0'));_0xe97cf4['field'](_0xa66f('0xb1'),'Contact.mobile');_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xb2'),_0xa66f('0xb3'));_0xe97cf4[_0xa66f('0x55')]('o.fullname',_0xa66f('0xb4'));_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xb5'),_0xa66f('0xb6'));_0xe97cf4[_0xa66f('0x55')](_0xa66f('0xb7'),'TagIds');}if(_0x4b6e6b[_0xa66f('0x30')])_0xe97cf4[_0xa66f('0x30')](_0x4b6e6b[_0xa66f('0x30')]);if(_0x4b6e6b[_0xa66f('0x2f')])_0xe97cf4[_0xa66f('0x2f')](_0x4b6e6b['offset']);return db['sequelize'][_0xa66f('0x47')](_0xe97cf4[_0xa66f('0xa6')](),_0x3cdf95);})[_0xa66f('0x20')](function(_0x2895ab){_0x13848d[_0xa66f('0x51')](_0xa66f('0xb8'),_[_0xa66f('0x3b')](_0x2895ab,'id'));return db[_0xa66f('0xa5')][_0xa66f('0x47')](_0x13848d[_0xa66f('0xa6')](),_0x3cdf95)[_0xa66f('0x20')](function(_0x3fdabb){var _0x4cfdfb=_[_0xa66f('0xb9')](_0x3fdabb,_0xa66f('0xba'));var _0x55af2c=[];_0x2895ab[_0xa66f('0x7d')](function(_0x5c5445){_0x55af2c[_0xa66f('0x3f')](updateChatInteraction(_0x5c5445,_0x1a299c,_0x4cfdfb));});return BPromise['all'](_0x55af2c);});});})['then'](function(_0x1de4df){_0x27adf4['rows']=_0x1de4df;return _0x27adf4;})[_0xa66f('0x20')](respondWithFilteredResult(_0x248587,_0x4b6e6b));})[_0xa66f('0x2a')](handleError(_0x248587,null));};exports['show']=function(_0x2fa5ab,_0x651d04){var _0x57912d={'raw':![],'where':{'id':_0x2fa5ab[_0xa66f('0xbb')]['id']}},_0xa568ed={};_0xa568ed[_0xa66f('0x46')]=_[_0xa66f('0x48')](db['ChatInteraction']['rawAttributes']);_0xa568ed[_0xa66f('0x47')]=_[_0xa66f('0x48')](_0x2fa5ab[_0xa66f('0x47')]);_0xa568ed[_0xa66f('0x52')]=_[_0xa66f('0x49')](_0xa568ed[_0xa66f('0x46')],_0xa568ed[_0xa66f('0x47')]);_0x57912d[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0xa568ed[_0xa66f('0x46')],qs['fields'](_0x2fa5ab['query'][_0xa66f('0x4b')]));_0x57912d[_0xa66f('0x4a')]=_0x57912d[_0xa66f('0x4a')][_0xa66f('0x4c')]?_0x57912d[_0xa66f('0x4a')]:_0xa568ed['model'];if(_0x2fa5ab[_0xa66f('0x47')][_0xa66f('0xbc')]){_0x57912d[_0xa66f('0xbd')]=[{'all':!![]}];}_0x57912d=_['merge']({},_0x57912d,_0x2fa5ab['options']);return db['ChatInteraction'][_0xa66f('0x6e')](_0x57912d)['then'](handleEntityNotFound(_0x651d04,null))[_0xa66f('0x20')](respondWithResult(_0x651d04,null))[_0xa66f('0x2a')](handleError(_0x651d04,null));};exports[_0xa66f('0xbe')]=function(_0x90b7f1,_0x4bf3f6){return db[_0xa66f('0x42')][_0xa66f('0xbe')](_0x90b7f1['body'],{})[_0xa66f('0x20')](respondWithResult(_0x4bf3f6,0xc9))[_0xa66f('0x2a')](handleError(_0x4bf3f6,null));};exports['update']=function(_0x4fa27c,_0x2f090b){if(_0x4fa27c[_0xa66f('0x84')]['id']){delete _0x4fa27c[_0xa66f('0x84')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x4fa27c['params']['id']}})['then'](handleEntityNotFound(_0x2f090b,null))[_0xa66f('0x20')](saveUpdates(_0x4fa27c[_0xa66f('0x84')],null))[_0xa66f('0x20')](respondWithResult(_0x2f090b,null))[_0xa66f('0x2a')](handleError(_0x2f090b,null));};exports[_0xa66f('0x36')]=function(_0x46c9b2,_0x580eb7){return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0x46c9b2[_0xa66f('0xbb')]['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x580eb7,null))['then'](removeEntity(_0x580eb7,null))['catch'](handleError(_0x580eb7,null));};exports[_0xa66f('0xbf')]=function(_0xe11c2d,_0x44e159){return db[_0xa66f('0x42')][_0xa66f('0xbf')]()[_0xa66f('0x20')](respondWithResult(_0x44e159,null))[_0xa66f('0x2a')](handleError(_0x44e159,null));};exports[_0xa66f('0xc0')]=function(_0x7a57e9,_0x179eb7){var _0x5e0b36=_0x7a57e9['params']['id'];var _0x451f57;var _0x597ae3;var _0x1b93e0;return db[_0xa66f('0x42')][_0xa66f('0xc1')]({'where':{'id':_0x5e0b36}})[_0xa66f('0x20')](function(_0x216668){_0x451f57=_0x216668;return db['ChatWebsite']['findOne']({'where':{'id':_0x216668['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xa66f('0xc2')],'raw':!![]});})[_0xa66f('0x20')](function(_0x2f1806){if(_0x2f1806&&_0x2f1806[_0xa66f('0xc3')]&&_0x2f1806['vidaooEscalation']){_0x597ae3=_0x2f1806;var _0x2f3d27={'rejectUnauthorized':![],'method':_0xa66f('0xc4'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x2f1806[_0xa66f('0xc3')]},'body':{'name':_0xa66f('0xc5')+_0x5e0b36},'redirect':'follow','json':!![]};return rp(_0x2f3d27);}else{throw new db[(_0xa66f('0x1c'))][(_0xa66f('0x1d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xa66f('0x20')](function(_0x400223){_0x1b93e0=_0x400223;if(_0x1b93e0['id']){var _0x32bea5={'body':_0x1b93e0[_0xa66f('0xc6')],'ChatWebsiteId':_0x597ae3['id'],'ChatInteractionId':_0x451f57['id'],'direction':_0xa66f('0xc7'),'UserId':_0x7a57e9[_0xa66f('0xc8')]['id']};return db[_0xa66f('0xc9')][_0xa66f('0xbe')](_0x32bea5,{});}else{throw new db[(_0xa66f('0x1c'))][(_0xa66f('0x1d'))](_0xa66f('0xca'));}})['then'](function(){return _0x451f57['updateAttributes']({'vidaooSessionId':_0x1b93e0['id']});})[_0xa66f('0x20')](respondWithResult(_0x179eb7,null))[_0xa66f('0x2a')](handleError(_0x179eb7,null));};exports[_0xa66f('0xcb')]=function(_0x4e211b,_0x50f330){if(_0x4e211b[_0xa66f('0x84')]['id']){delete _0x4e211b[_0xa66f('0x84')]['id'];}return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0x4e211b[_0xa66f('0xbb')]['id']}})['then'](handleEntityNotFound(_0x50f330,null))[_0xa66f('0x20')](saveUpdates(_0x4e211b[_0xa66f('0x84')],null))[_0xa66f('0x20')](respondWithResult(_0x50f330,null))[_0xa66f('0x2a')](handleError(_0x50f330,null));};exports['abandon']=function(_0x3de2ec,_0x3ea83e,_0x5774df){if(_0x3de2ec[_0xa66f('0x84')]['id']){delete _0x3de2ec[_0xa66f('0x84')]['id'];}return db['ChatInteraction'][_0xa66f('0x6e')]({'where':{'id':_0x3de2ec[_0xa66f('0xbb')]['id']}})[_0xa66f('0x20')](function(_0x23832c){if(!_0x23832c){logger[_0xa66f('0x27')](_0xa66f('0xcc'),_0xa66f('0xcd'),0x194,'entity\x20not\x20found');_0x3ea83e['sendStatus'](0x194);}else{if(_0x23832c[_0xa66f('0x82')]){throw new db[(_0xa66f('0x1c'))][(_0xa66f('0x1d'))](_0xa66f('0xce'));}}return _0x23832c;})[_0xa66f('0x20')](function(_0x4f9117){if(_0x4f9117){return _0x4f9117[_0xa66f('0x35')]({'closed':_0x3de2ec[_0xa66f('0x84')]['closed'],'disposition':_0x3de2ec[_0xa66f('0x84')]['disposition']})[_0xa66f('0x20')](function(_0x807b56){return _0x807b56;});}})[_0xa66f('0x20')](function(_0x2f8549){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3de2ec['body'],client9004);})[_0xa66f('0x20')](respondWithResult(_0x3ea83e,null))['catch'](handleError(_0x3ea83e,null));};exports[_0xa66f('0xcf')]=function(_0x55b2c3,_0x100658,_0x1a61e0){_0x55b2c3['body'][_0xa66f('0x38')]=_0x55b2c3[_0xa66f('0xd0')][_0xa66f('0xd1')];_0x55b2c3[_0xa66f('0x84')][_0xa66f('0xd2')]=_0x55b2c3[_0xa66f('0xd0')][_0xa66f('0xd3')];_0x55b2c3['body'][_0xa66f('0x83')]=_0x55b2c3[_0xa66f('0xd0')][_0xa66f('0xd4')];return db[_0xa66f('0xd5')][_0xa66f('0xbe')](_0x55b2c3[_0xa66f('0x84')])[_0xa66f('0x20')](respondWithResult(_0x100658,0xc9))[_0xa66f('0x2a')](handleError(_0x100658,null));};exports[_0xa66f('0xd6')]=function(_0x5dcf9d,_0x1f9b43,_0x4b12b5){return db[_0xa66f('0x42')][_0xa66f('0xc1')]({'where':{'id':_0x5dcf9d[_0xa66f('0xbb')]['id']},'raw':!![]})[_0xa66f('0x20')](handleEntityNotFound(_0x1f9b43,null))[_0xa66f('0x20')](function(_0x53276b){if(_0x53276b){if(_0x53276b[_0xa66f('0xd7')]){return _0x1f9b43[_0xa66f('0x2c')](0x193)[_0xa66f('0xd8')]({'status':0x193,'message':_0xa66f('0xd9')});}return db['Attachment']['findOne']({'where':{'id':_0x5dcf9d['query'][_0xa66f('0xda')]},'raw':!![]})[_0xa66f('0x20')](handleEntityNotFound(_0x1f9b43,null));}})['then'](function(_0x58c0e0){if(_0x58c0e0){return _0x1f9b43[_0xa66f('0xdb')](path[_0xa66f('0xdc')](config['root'],_0xa66f('0xdd'),_0x58c0e0[_0xa66f('0xd2')]));}})[_0xa66f('0x2a')](handleError(_0x1f9b43,null));};exports[_0xa66f('0xde')]=function(_0x551c09,_0x4c2bf9){var _0x49dff5=null;var _0x109e8f=null;var _0x39d6b3=null;var _0x13bbe7=null;if(_0x551c09[_0xa66f('0x84')]['id']){delete _0x551c09[_0xa66f('0x84')]['id'];}if(_0x551c09[_0xa66f('0x84')][_0xa66f('0xdf')]){_0x13bbe7=path[_0xa66f('0xdc')](config['root'],_0xa66f('0xe0'),util[_0xa66f('0xe1')](_0xa66f('0xe2'),Date['now']()));_0x551c09[_0xa66f('0x84')][_0xa66f('0xe3')]=_0x13bbe7;}return db[_0xa66f('0x42')]['find']({'where':{'id':_0x551c09['params']['id']},'include':[{'model':db[_0xa66f('0xc9')],'as':_0xa66f('0xe4'),'include':[{'model':db[_0xa66f('0x80')],'as':_0xa66f('0x80')}]}]})[_0xa66f('0x20')](handleEntityNotFound(_0x4c2bf9,null))[_0xa66f('0x20')](saveUpdates(_0x551c09[_0xa66f('0x84')],null))['then'](function(_0x383ce6){if(_0x383ce6){_0x49dff5=_0x383ce6;return db['ChatWebsite'][_0xa66f('0x6e')]({'where':{'id':_0x49dff5[_0xa66f('0x88')]}});}})[_0xa66f('0x20')](function(_0x855710){if(_0x855710){_0x39d6b3=_0x855710;return db[_0xa66f('0xe5')][_0xa66f('0x6e')]({'where':{'id':_0x49dff5[_0xa66f('0x7a')]}});}})[_0xa66f('0x20')](function(_0x1deff4){if(_0x1deff4){_0x109e8f=_0x1deff4;if(_0x13bbe7){var _0xb9e891=null;for(var _0x27ea65=0x1;_0x27ea65<_0x49dff5[_0xa66f('0xe4')]['length'];++_0x27ea65){_0xb9e891=_0x49dff5['Messages'][_0x27ea65];var _0x38412c=_0xb9e891[_0xa66f('0x82')]?util[_0xa66f('0xe1')](_0xa66f('0xe6'),_0x39d6b3[_0xa66f('0xe7')],_0xb9e891[_0xa66f('0x82')]):'System';var _0x1b5f18=_0x551c09['body']['customer']||util[_0xa66f('0xe1')](_0xa66f('0xe6'),_0xa66f('0xe8'),_0xb9e891[_0xa66f('0x7a')]);switch(_0x39d6b3['agentIdentifier']){case _0xa66f('0xe9'):_0x38412c=_0xb9e891[_0xa66f('0x82')]?util[_0xa66f('0xe1')](_0xa66f('0xe6'),_0x39d6b3[_0xa66f('0xe7')],_0xb9e891['UserId']):'System';break;case _0xa66f('0xea'):_0x38412c=_0xb9e891[_0xa66f('0x82')]?_0xb9e891[_0xa66f('0x80')][_0xa66f('0xeb')]||_0xb9e891['User'][_0xa66f('0x3c')]:_0xa66f('0xec');break;case _0xa66f('0xed'):_0x38412c=_0xb9e891[_0xa66f('0x82')]?_0xb9e891[_0xa66f('0x80')][_0xa66f('0x3c')]:_0xa66f('0xec');break;default:_0x38412c=_0xb9e891[_0xa66f('0x82')]?util['format'](_0xa66f('0xe6'),_0x39d6b3[_0xa66f('0xe7')],_0xb9e891['UserId']):_0xa66f('0xec');}var _0x9a2ea4=util[_0xa66f('0xe1')](_0xa66f('0xee'),moment(_0xb9e891[_0xa66f('0x8b')])['format'](_0xa66f('0xef')),_0xb9e891[_0xa66f('0xf0')]==='in'?_0x1b5f18:_0x38412c,_0xb9e891[_0xa66f('0x84')]);if(!_0xb9e891[_0xa66f('0xf1')]){fs[_0xa66f('0xf2')](_0x13bbe7,_0x9a2ea4);}}return db['MailAccount'][_0xa66f('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0xa66f('0xf3')],'as':'Smtp','raw':!![]}]});}}})[_0xa66f('0x20')](function(_0x3f542a){if(_0x3f542a&&_0x3f542a[_0xa66f('0xf4')]&&_0x551c09[_0xa66f('0x84')]){var _0x2d3123={'tls':{'rejectUnauthorized':![]}};if(_0x3f542a['Smtp'][_0xa66f('0xf5')]){_0x2d3123[_0xa66f('0xf5')]=_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xf5')];}else{_0x2d3123['host']=_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xf6')];_0x2d3123['port']=_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xf7')];_0x2d3123[_0xa66f('0xf8')]=_0x3f542a[_0xa66f('0xf4')]['secure'];}if(_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xf9')]){_0x2d3123['auth']={'user':_0x3f542a[_0xa66f('0xf4')][_0xa66f('0xc8')],'pass':_0x3f542a[_0xa66f('0xf4')]['pass']};}return respondWithRpcPromise(_0xa66f('0xfa'),_0xa66f('0xfb'),{'account':_0x2d3123,'message':{'from':util[_0xa66f('0xe1')]('\x22%s\x22\x20<%s>',_0x3f542a[_0xa66f('0x38')],_0x3f542a[_0xa66f('0xfc')]||_0x3f542a['Smtp']['user']),'to':_0x551c09[_0xa66f('0x84')][_0xa66f('0xdf')],'subject':'Mail\x20Transcript','text':util[_0xa66f('0xe1')](_0xa66f('0xfd'),_0x551c09[_0xa66f('0x84')][_0xa66f('0xdf')]),'attachments':[{'path':_0x13bbe7}]}})[_0xa66f('0x20')](function(){return _0x49dff5;})['catch'](function(_0xfc1774){console[_0xa66f('0x27')](_0xfc1774);});}else{return _0x49dff5;}})['then'](respondWithStatusCode(_0x4c2bf9,0xc8))[_0xa66f('0x2a')](handleError(_0x4c2bf9,null));};exports['addMessage']=function(_0x506797,_0x3465fe,_0xe73ef3){return db['ChatMessage'][_0xa66f('0x6e')]({'where':{'id':_0x506797['params']['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x3465fe,null))[_0xa66f('0x20')](function(_0x49553c){if(_0x49553c){return _0x49553c['addMessage'](_0x506797['body'][_0xa66f('0xfe')],_[_0xa66f('0xff')](_0x506797[_0xa66f('0x84')],[_0xa66f('0xfe'),'id'])||{});}})[_0xa66f('0x20')](respondWithResult(_0x3465fe,null))[_0xa66f('0x2a')](handleError(_0x3465fe,null));};exports[_0xa66f('0x100')]=function(_0x5a762d,_0x4f4c60,_0xb9b79b){var _0x34422e={'raw':![],'where':{}};var _0x2efe45={};var _0x3580b5={'count':0x0,'rows':[]};return db[_0xa66f('0x42')][_0xa66f('0xc1')]({'where':{'id':_0x5a762d['params']['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x4f4c60,null))[_0xa66f('0x20')](function(_0x4e6605){if(_0x4e6605){_0x2efe45[_0xa66f('0x46')]=_['keys'](db[_0xa66f('0xc9')]['rawAttributes']);_0x2efe45['query']=_[_0xa66f('0x48')](_0x5a762d[_0xa66f('0x47')]);_0x2efe45[_0xa66f('0x52')]=_[_0xa66f('0x49')](_0x2efe45[_0xa66f('0x46')],_0x2efe45['query']);_0x34422e['attributes']=_[_0xa66f('0x49')](_0x2efe45[_0xa66f('0x46')],qs[_0xa66f('0x4b')](_0x5a762d['query']['fields']));_0x34422e['attributes']=_0x34422e[_0xa66f('0x4a')][_0xa66f('0x4c')]?_0x34422e[_0xa66f('0x4a')]:_0x2efe45[_0xa66f('0x46')];if(!_0x5a762d[_0xa66f('0x47')][_0xa66f('0x4d')]('nolimit')){_0x34422e[_0xa66f('0x30')]=qs[_0xa66f('0x30')](_0x5a762d[_0xa66f('0x47')]['limit']);_0x34422e[_0xa66f('0x2f')]=qs[_0xa66f('0x2f')](_0x5a762d['query']['offset']);}_0x34422e[_0xa66f('0x4f')]=qs[_0xa66f('0x50')](_0x5a762d[_0xa66f('0x47')][_0xa66f('0x50')]);_0x34422e['where']=qs[_0xa66f('0x52')](_[_0xa66f('0x53')](_0x5a762d[_0xa66f('0x47')],_0x2efe45[_0xa66f('0x52')]));_0x34422e[_0xa66f('0x51')]['ChatInteractionId']=_0x4e6605['id'];if(_0x5a762d[_0xa66f('0x47')][_0xa66f('0x94')]){_0x34422e[_0xa66f('0x51')]=_['merge'](_0x34422e[_0xa66f('0x51')],{'$or':_[_0xa66f('0x3b')](_0x34422e['attributes'],function(_0x5d1e51){var _0x3c3aff={};_0x3c3aff[_0x5d1e51]={'$like':'%'+_0x5a762d[_0xa66f('0x47')]['filter']+'%'};return _0x3c3aff;})});}if(_0x5a762d[_0xa66f('0x47')][_0xa66f('0x8c')]){var _0x49e22d=_0x5a762d[_0xa66f('0x47')]['$gte'][_0xa66f('0x3d')](',');var _0x43cc99={};_0x43cc99[_0x49e22d[0x0]]={'$gte':moment(_0x49e22d[0x1])['format'](_0xa66f('0x101'))};_0x34422e[_0xa66f('0x51')]=_['merge'](_0x34422e['where'],_0x43cc99);}_0x34422e=_['merge']({},_0x34422e,_0x5a762d[_0xa66f('0x102')]);return db[_0xa66f('0xc9')][_0xa66f('0x2e')]({'where':_0x34422e[_0xa66f('0x51')]})[_0xa66f('0x20')](function(_0x488253){_0x3580b5[_0xa66f('0x2e')]=_0x488253;if(_0x5a762d[_0xa66f('0x47')]['includeAll']){_0x34422e['include']=[{'all':!![]}];}return db['ChatMessage'][_0xa66f('0x103')](_0x34422e);})[_0xa66f('0x20')](function(_0x434b72){_0x3580b5['rows']=_0x434b72;return _0x3580b5;});}})[_0xa66f('0x20')](respondWithFilteredResult(_0x4f4c60,_0x34422e))[_0xa66f('0x2a')](handleError(_0x4f4c60,null));};exports[_0xa66f('0x104')]=function(_0x49fb27,_0x442b85,_0x811e6c){var _0x227999={'where':{}},_0x4f06b8={},_0x37b86c={'count':0x0,'rows':[]};return db[_0xa66f('0x42')][_0xa66f('0xc1')]({'where':{'id':_0x49fb27[_0xa66f('0xbb')]['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x442b85,null))[_0xa66f('0x20')](function(_0x20e318){if(_0x20e318){_0x4f06b8[_0xa66f('0x46')]=_['keys'](db[_0xa66f('0xc9')][_0xa66f('0x43')]);_0x4f06b8[_0xa66f('0x47')]=_[_0xa66f('0x48')](_0x49fb27[_0xa66f('0x47')]);_0x4f06b8[_0xa66f('0x52')]=_[_0xa66f('0x49')](_0x4f06b8[_0xa66f('0x46')],_0x4f06b8[_0xa66f('0x47')]);_0x227999[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0x4f06b8[_0xa66f('0x46')],qs[_0xa66f('0x4b')](_0x49fb27[_0xa66f('0x47')][_0xa66f('0x4b')]));_0x227999[_0xa66f('0x4a')]=_0x227999[_0xa66f('0x4a')]['length']?_0x227999[_0xa66f('0x4a')]:_0x4f06b8['model'];if(!_0x49fb27['query']['hasOwnProperty'](_0xa66f('0x4e'))){_0x227999[_0xa66f('0x30')]=qs[_0xa66f('0x30')](_0x49fb27[_0xa66f('0x47')][_0xa66f('0x30')]);_0x227999['offset']=qs[_0xa66f('0x2f')](_0x49fb27['query'][_0xa66f('0x2f')]);}_0x227999[_0xa66f('0x4f')]=qs['sort'](_0x49fb27['query'][_0xa66f('0x50')]);_0x227999[_0xa66f('0x51')]=qs[_0xa66f('0x52')](_[_0xa66f('0x53')](_0x49fb27[_0xa66f('0x47')],_0x4f06b8['filters']));_0x227999[_0xa66f('0x51')]['ChatInteractionId']=_0x20e318['id'];if(_0x49fb27[_0xa66f('0x47')][_0xa66f('0x94')]){_0x227999[_0xa66f('0x51')]=_[_0xa66f('0xa7')](_0x227999[_0xa66f('0x51')],{'$or':_[_0xa66f('0x3b')](_0x227999[_0xa66f('0x4a')],function(_0x21ec7f){var _0x32b1c1={};_0x32b1c1[_0x21ec7f]={'$like':'%'+_0x49fb27['query'][_0xa66f('0x94')]+'%'};return _0x32b1c1;})});}_0x227999[_0xa66f('0x51')][_0xa66f('0xf1')]=![];if(_0x49fb27['query']['id']){_0x227999['where']['id']={'$gt':_0x49fb27[_0xa66f('0x47')]['id']};}_0x227999=_[_0xa66f('0xa7')]({},_0x227999,_0x49fb27[_0xa66f('0x102')]);return db['ChatMessage'][_0xa66f('0x2e')]({'where':_0x227999[_0xa66f('0x51')]})['then'](function(_0x36d3de){_0x37b86c[_0xa66f('0x2e')]=_0x36d3de;_0x227999[_0xa66f('0xbd')]=[];if(_0x49fb27[_0xa66f('0x47')][_0xa66f('0x105')]){_0x227999[_0xa66f('0xbd')][_0xa66f('0x3f')]({'model':db[_0xa66f('0x80')],'as':_0xa66f('0x80'),'attributes':['id',_0xa66f('0x3c'),_0xa66f('0xeb')]});}if(_0x49fb27[_0xa66f('0x47')]['includeAll']){_0x227999[_0xa66f('0xbd')]=[{'all':!![]}];}return db[_0xa66f('0xc9')][_0xa66f('0x103')](_0x227999);})[_0xa66f('0x20')](function(_0x4f7bae){_0x37b86c[_0xa66f('0x106')]=_0x4f7bae;return _0x37b86c;});}})['then'](respondWithFilteredResult(_0x442b85,_0x227999))[_0xa66f('0x2a')](handleError(_0x442b85,null));};exports[_0xa66f('0x107')]=function(_0x56282c,_0x5e5f6b,_0x289054){return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0x56282c[_0xa66f('0xbb')]['id']}})[_0xa66f('0x20')](handleEntityNotFound(_0x5e5f6b,null))[_0xa66f('0x20')](function(_0x541624){if(_0x541624){return _0x541624['setTags'](_0x56282c['body'][_0xa66f('0xfe')],_[_0xa66f('0xff')](_0x56282c[_0xa66f('0x84')],[_0xa66f('0xfe'),'id'])||{})[_0xa66f('0x108')](function(){return db['Tag'][_0xa66f('0x103')]({'attributes':['id','name',_0xa66f('0x56')],'where':{'id':_0x56282c[_0xa66f('0x84')][_0xa66f('0xfe')]}});})['then'](function(_0x5cdbed){socket[_0xa66f('0x109')](_0xa66f('0x10a'),{'id':Number(_0x56282c[_0xa66f('0xbb')]['id']),'tags':_0x5cdbed||[]});return{'id':Number(_0x56282c[_0xa66f('0xbb')]['id']),'tags':_0x5cdbed||[]};});}})[_0xa66f('0x20')](respondWithResult(_0x5e5f6b,null))[_0xa66f('0x2a')](handleError(_0x5e5f6b,null));};exports['removeTags']=function(_0xf10419,_0x4a5657,_0x5834e7){return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0xf10419[_0xa66f('0xbb')]['id']}})['then'](handleEntityNotFound(_0x4a5657,null))['then'](function(_0x579c0d){if(_0x579c0d){return _0x579c0d['removeTags'](_0xf10419[_0xa66f('0x47')][_0xa66f('0xfe')]);}})[_0xa66f('0x20')](respondWithStatusCode(_0x4a5657,null))[_0xa66f('0x2a')](handleError(_0x4a5657,null));};exports[_0xa66f('0xdb')]=function(_0x6e41fd,_0x247be){var _0x31ae31=moment()[_0xa66f('0x10b')]()[_0xa66f('0xa6')]();var _0x24e6ec=path[_0xa66f('0xdc')](config[_0xa66f('0x10c')],_0xa66f('0x10d'),'files','tmp');var _0x554ba6=path[_0xa66f('0xdc')](config[_0xa66f('0x10c')],_0xa66f('0x10d'),_0xa66f('0x10e'),_0xa66f('0x10f'));var _0x44649c=path['join'](_0x24e6ec,_0x31ae31);var _0x23c1bc=util[_0xa66f('0xe1')](_0xa66f('0x110'),_0x6e41fd['params']['id'],_0x31ae31);var _0x21a5bd=path[_0xa66f('0xdc')](_0x24e6ec,_0x23c1bc);var _0x3b9bc5=[];_0x3b9bc5[_0xa66f('0x3f')]({'model':db[_0xa66f('0x80')],'as':_0xa66f('0x80'),'attributes':['id',_0xa66f('0x3c')],'raw':!![]});_0x3b9bc5[_0xa66f('0x3f')]({'model':db['CmContact'],'as':_0xa66f('0x73'),'attributes':['id',_0xa66f('0x111'),'lastName'],'raw':!![]});if(_0x6e41fd[_0xa66f('0x47')][_0xa66f('0x10f')]){_0x3b9bc5[_0xa66f('0x3f')]({'model':db['Attachment'],'as':_0xa66f('0xd5'),'raw':!![]});}var _0x1440e4=[{'model':db[_0xa66f('0xc9')],'as':'Messages','attributes':['id',_0xa66f('0x84'),_0xa66f('0x8b'),_0xa66f('0xf0'),_0xa66f('0xf1'),'read'],'include':_0x3b9bc5}];_0x1440e4[_0xa66f('0x3f')]({'model':db[_0xa66f('0x112')],'as':_0xa66f('0x113'),'attributes':['id',_0xa66f('0x38')]});_0x1440e4[_0xa66f('0x3f')]({'model':db[_0xa66f('0x80')],'as':_0xa66f('0x114'),'attributes':['id',_0xa66f('0x3c')]});return db[_0xa66f('0x42')][_0xa66f('0x6e')]({'where':{'id':_0x6e41fd['params']['id']},'include':_0x1440e4})[_0xa66f('0x20')](handleEntityNotFound(_0x247be,null))['then'](function(_0x33d9cf){if(_0x33d9cf){var _0xd7dccf=_0x33d9cf[_0xa66f('0x115')]({'plain':!![]});fs[_0xa66f('0x116')](_0x44649c);var _0x536acf={'format':'A4','border':'10px','header':{'height':_0xa66f('0x117'),'contents':{'first':_0xa66f('0x118')}},'footer':{'height':_0xa66f('0x119'),'contents':{'default':util[_0xa66f('0xe1')](_0xa66f('0x11a'),util[_0xa66f('0xe1')](_0xa66f('0x11b'),'Chat',_0xd7dccf['id']),moment()[_0xa66f('0xe1')](_0xa66f('0x11c'))['toString']())}}};var _0x2135c8={'channel':'Chat','account':_0xd7dccf['Account'][_0xa66f('0x38')],'agent':_0xd7dccf[_0xa66f('0x114')]?_0xd7dccf[_0xa66f('0x114')]['fullname']:_0xa66f('0x11d'),'createdAt':moment(_0xd7dccf['createdAt'])[_0xa66f('0xe1')](_0xa66f('0x101'))['toString'](),'closedAt':_0xd7dccf[_0xa66f('0xd7')]?moment(_0xd7dccf[_0xa66f('0x11e')])[_0xa66f('0xe1')](_0xa66f('0x101'))[_0xa66f('0xa6')]():'','disposition':_0xd7dccf[_0xa66f('0x11f')],'chatInfo':{'browser':_0xd7dccf[_0xa66f('0x120')],'os':_0xd7dccf['osName'],'referer':_0xd7dccf[_0xa66f('0x121')],'customerIp':_0xd7dccf[_0xa66f('0x122')],'customerPort':_0xd7dccf['customerPort']?_0xd7dccf[_0xa66f('0x123')]:_0xa66f('0x11d')},'messages':_(_0xd7dccf[_0xa66f('0xe4')])[_0xa66f('0x124')]()[_0xa66f('0x94')]({'secret':![]})[_0xa66f('0x3b')](function(_0x27e026){if(_0x27e026[_0xa66f('0xd5')]){var _0x1f9354=path[_0xa66f('0xdc')](_0x554ba6,_0x27e026[_0xa66f('0xd5')][_0xa66f('0xd2')]);if(fs['existsSync'](_0x1f9354)){fs[_0xa66f('0x125')](_0x1f9354)['pipe'](fs[_0xa66f('0x126')](path[_0xa66f('0xdc')](_0x44649c,_0x27e026[_0xa66f('0xd5')][_0xa66f('0xd2')])));}}return{'date':moment(_0x27e026[_0xa66f('0x8b')])[_0xa66f('0xe1')](_0xa66f('0x101'))['toString'](),'sender':_0x27e026[_0xa66f('0xf0')]==='out'?_0x27e026[_0xa66f('0x80')]?_0x27e026[_0xa66f('0x80')][_0xa66f('0x3c')]:'System':_0x27e026[_0xa66f('0x73')][_0xa66f('0x111')]+(_0x27e026['Contact']['lastName']?'\x20'+_0x27e026[_0xa66f('0x73')][_0xa66f('0x127')]:''),'body':_0x27e026[_0xa66f('0xd5')]?_0x27e026['Attachment'][_0xa66f('0xd2')]:_0x27e026[_0xa66f('0x84')],'direction':_0x27e026[_0xa66f('0xf0')]==='out'?'A':'C','secret':_0x27e026[_0xa66f('0xf1')],'read':_0x27e026[_0xa66f('0x8f')],'attachment':_0x27e026[_0xa66f('0xd5')]};})[_0xa66f('0x76')]()};return ejs[_0xa66f('0x128')](path['join'](config[_0xa66f('0x10c')],_0xa66f('0x10d'),_0xa66f('0x129'),_0xa66f('0x12a')),{'interaction':_0x2135c8})[_0xa66f('0x20')](function(_0x1d7d57){return new BPromise(function(_0x53bbd5,_0x55e0e0){pdf[_0xa66f('0xbe')](_0x1d7d57,_0x536acf)['toFile'](path[_0xa66f('0xdc')](_0x44649c,_0xa66f('0x12b')+_0xd7dccf['id']+'-'+_0x31ae31+'.pdf'),function(_0x2b54bc,_0x20cb01){if(_0x2b54bc)return _0x55e0e0(_0x2b54bc);_0x53bbd5(_0x20cb01);});});})[_0xa66f('0x20')](function(){return new BPromise(function(_0x4c015b,_0x7cfb02){zipdir(_0x44649c,{'saveTo':_0x21a5bd},function(_0x5c6555,_0x5be285){if(_0x5c6555)return _0x7cfb02(_0x5c6555);return _0x4c015b(_0x5be285);});})['then'](function(){return new BPromise(function(_0x4d3039,_0x4fdc9b){rimraf(_0x44649c,function(_0x2eae9e){if(_0x2eae9e)_0x4fdc9b(_0x2eae9e);return _0x4d3039();});});})['then'](function(){return _0x247be[_0xa66f('0xdb')](_0x21a5bd,_0x23c1bc,function(_0x32ee82){if(_0x32ee82){console[_0xa66f('0x12c')](_0xa66f('0x12d'),_0x32ee82);}else{fs[_0xa66f('0x12e')](_0x21a5bd);}});});});}else{return _0x247be[_0xa66f('0x2b')](0xc8);}})[_0xa66f('0x2a')](handleError(_0x247be,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d995cd9..facd5c8 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 _0xa9fc=['findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','save','remove','getUsers','setDataValue','Users','map'];(function(_0x4d6904,_0x584a8f){var _0x2f5169=function(_0x2d2b62){while(--_0x2d2b62){_0x4d6904['push'](_0x4d6904['shift']());}};_0x2f5169(++_0x584a8f);}(_0xa9fc,0x19f));var _0xca9f=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xa9fc[_0x2d2c16];return _0x53f2fb;};'use strict';var EventEmitter=require(_0xca9f('0x0'));var ChatInteraction=require(_0xca9f('0x1'))['db'][_0xca9f('0x2')];var ChatMessage=require(_0xca9f('0x1'))['db'][_0xca9f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca9f('0x4'),'afterUpdate':'update','afterDestroy':_0xca9f('0x5')};function emitEvent(_0x32709b){return function(_0x5d2ddf,_0x5eb9af,_0x5c7268){_0x5d2ddf[_0xca9f('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x39963d){_0x5d2ddf[_0xca9f('0x7')](_0xca9f('0x8'),_0x39963d[_0xca9f('0x9')](function(_0x244d4d){return{'id':_0x244d4d['id']};}));return ChatMessage[_0xca9f('0xa')]({'where':{'ChatInteractionId':_0x5d2ddf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xca9f('0xb')](function(_0x5ae48c){_0x5d2ddf['setDataValue'](_0xca9f('0xc'),_0x5ae48c[_0xca9f('0xd')]);ChatInteractionEvents[_0xca9f('0xe')](_0x32709b+':'+_0x5d2ddf['id'],_0x5d2ddf);ChatInteractionEvents[_0xca9f('0xe')](_0x32709b,_0x5d2ddf);_0x5c7268(null);})['catch'](_0x5c7268(null));};}for(var e in events){if(events[_0xca9f('0xf')](e)){var event=events[e];ChatInteraction[_0xca9f('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x7874=['ChatMessage','setMaxListeners','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hook','exports','ChatInteraction','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7874,0x152));var _0x4787=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x7874[_0x124298];return _0x35ac24;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x4787('0x0')];var ChatMessage=require(_0x4787('0x1'))['db'][_0x4787('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4787('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4787('0x4'),'afterDestroy':_0x4787('0x5')};function emitEvent(_0x46b8e5){return function(_0x235718,_0x3a28ae,_0x301644){_0x235718[_0x4787('0x6')]({'attributes':['id'],'raw':!![]})[_0x4787('0x7')](function(_0xcfd7cd){_0x235718['setDataValue'](_0x4787('0x8'),_0xcfd7cd[_0x4787('0x9')](function(_0x257d8d){return{'id':_0x257d8d['id']};}));return ChatMessage[_0x4787('0xa')]({'where':{'ChatInteractionId':_0x235718['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfda1c6){_0x235718[_0x4787('0xb')](_0x4787('0xc'),_0xfda1c6[_0x4787('0xd')]);ChatInteractionEvents[_0x4787('0xe')](_0x46b8e5+':'+_0x235718['id'],_0x235718);ChatInteractionEvents[_0x4787('0xe')](_0x46b8e5,_0x235718);_0x301644(null);})['catch'](_0x301644(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x4787('0xf')](e,emitEvent(event));}}module[_0x4787('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 2f196b6..6ecdc5f 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 _0xfb97=['format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfb97,0x17d));var _0x7fb9=function(_0x5d68a2,_0x4304cf){_0x5d68a2=_0x5d68a2-0x0;var _0x5b3088=_0xfb97[_0x5d68a2];return _0x5b3088;};'use strict';var _=require(_0x7fb9('0x0'));var util=require(_0x7fb9('0x1'));var logger=require(_0x7fb9('0x2'))('api');var moment=require(_0x7fb9('0x3'));var BPromise=require(_0x7fb9('0x4'));var rp=require(_0x7fb9('0x5'));var fs=require('fs');var path=require(_0x7fb9('0x6'));var rimraf=require(_0x7fb9('0x7'));var config=require(_0x7fb9('0x8'));var attributes=require(_0x7fb9('0x9'));module[_0x7fb9('0xa')]=function(_0x1b05e7,_0xbec385){return _0x1b05e7[_0x7fb9('0xb')]('ChatInteraction',attributes,{'tableName':_0x7fb9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23c80b,_0x23cc1f,_0x1372d3){if(_0x23c80b[_0x7fb9('0xd')](_0x7fb9('0xe'))){_0x23c80b['closedAt']=moment()[_0x7fb9('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1372d3(null,_0x23c80b);}},'charset':_0x7fb9('0x10'),'collate':_0x7fb9('0x11')});}; \ No newline at end of file +var _0xb24d=['../../config/environment','./chatInteraction.attributes','ChatInteraction','changed','closed','format','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19621e,_0x114012){var _0x4d051f=function(_0x49dbce){while(--_0x49dbce){_0x19621e['push'](_0x19621e['shift']());}};_0x4d051f(++_0x114012);}(_0xb24d,0x16f));var _0xdb24=function(_0x54628a,_0x50ca6b){_0x54628a=_0x54628a-0x0;var _0x19c30b=_0xb24d[_0x54628a];return _0x19c30b;};'use strict';var _=require(_0xdb24('0x0'));var util=require(_0xdb24('0x1'));var logger=require(_0xdb24('0x2'))(_0xdb24('0x3'));var moment=require(_0xdb24('0x4'));var BPromise=require(_0xdb24('0x5'));var rp=require(_0xdb24('0x6'));var fs=require('fs');var path=require(_0xdb24('0x7'));var rimraf=require('rimraf');var config=require(_0xdb24('0x8'));var attributes=require(_0xdb24('0x9'));module['exports']=function(_0x13041b,_0x1b4d30){return _0x13041b['define'](_0xdb24('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d9e51,_0x3730a7,_0x2f6ca2){if(_0x2d9e51[_0xdb24('0xb')](_0xdb24('0xc'))){_0x2d9e51['closedAt']=moment()[_0xdb24('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2f6ca2(null,_0x2d9e51);}},'charset':_0xdb24('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6e09952..61eef1b 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 _0x0401=['bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','ChatInteraction','update','body','options','where','attributes','limit','UpdateChatInteraction','stringify','find','omit','spread','AddTags','lodash','util','moment'];(function(_0x28f3c8,_0x4b8b8f){var _0x153e3e=function(_0x19efb3){while(--_0x19efb3){_0x28f3c8['push'](_0x28f3c8['shift']());}};_0x153e3e(++_0x4b8b8f);}(_0x0401,0x194));var _0x1040=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x0401[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x1040('0x0'));var util=require(_0x1040('0x1'));var moment=require(_0x1040('0x2'));var BPromise=require(_0x1040('0x3'));var rs=require(_0x1040('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1040('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1040('0x6'));var jayson=require(_0x1040('0x7'));var client=jayson[_0x1040('0x8')]['http']({'port':0x232a});config[_0x1040('0x9')]=_[_0x1040('0xa')](config['redis'],{'host':_0x1040('0xb'),'port':0x18eb});var socket=require(_0x1040('0xc'))(new Redis(config[_0x1040('0x9')]));require(_0x1040('0xd'))['register'](socket);function respondWithRpcPromise(_0x52ded2,_0x3c6e60,_0x55822a){return new BPromise(function(_0x23604d,_0xc519ec){return client[_0x1040('0xe')](_0x52ded2,_0x55822a)[_0x1040('0xf')](function(_0x194168){logger[_0x1040('0x10')](_0x1040('0x11'),_0x3c6e60,_0x1040('0x12'));logger[_0x1040('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3c6e60,_0x1040('0x12'),JSON['stringify'](_0x194168));if(_0x194168[_0x1040('0x14')]){if(_0x194168['error']['code']===0x1f4){logger['error'](_0x1040('0x11'),_0x3c6e60,_0x194168['error'][_0x1040('0x15')]);return _0xc519ec(_0x194168[_0x1040('0x14')]['message']);}logger[_0x1040('0x14')](_0x1040('0x11'),_0x3c6e60,_0x194168[_0x1040('0x14')][_0x1040('0x15')]);return _0x23604d(_0x194168['error'][_0x1040('0x15')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3c6e60,_0x1040('0x12'));_0x23604d(_0x194168[_0x1040('0x16')][_0x1040('0x15')]);}})[_0x1040('0x17')](function(_0x1960f9){logger[_0x1040('0x14')](_0x1040('0x11'),_0x3c6e60,_0x1960f9);_0xc519ec(_0x1960f9);});});}exports['UpdateChatInteraction']=function(_0x5f545b){var _0x218750=this;return new Promise(function(_0x323646,_0x34633f){return db[_0x1040('0x18')][_0x1040('0x19')](_0x5f545b[_0x1040('0x1a')],{'raw':_0x5f545b[_0x1040('0x1b')]?_0x5f545b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f545b[_0x1040('0x1b')]?_0x5f545b[_0x1040('0x1b')][_0x1040('0x1c')]||null:null,'attributes':_0x5f545b['options']?_0x5f545b[_0x1040('0x1b')][_0x1040('0x1d')]||null:null,'limit':_0x5f545b['options']?_0x5f545b['options'][_0x1040('0x1e')]||null:null})[_0x1040('0xf')](function(_0x6739aa){logger['info'](_0x1040('0x1f'),_0x5f545b);logger[_0x1040('0x13')](_0x1040('0x1f'),_0x5f545b,JSON[_0x1040('0x20')](_0x6739aa));_0x323646(_0x6739aa);})[_0x1040('0x17')](function(_0x3a3526){logger[_0x1040('0x14')]('UpdateChatInteraction',_0x3a3526[_0x1040('0x15')],_0x5f545b);_0x34633f(_0x218750[_0x1040('0x14')](0x1f4,_0x3a3526[_0x1040('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x166de2){return new Promise(function(_0x325f9a,_0x502912){return db['ChatInteraction'][_0x1040('0x21')]({'where':_0x166de2[_0x1040('0x1b')]?_0x166de2[_0x1040('0x1b')][_0x1040('0x1c')]||null:null})['then'](function(_0x41d99a){if(_0x41d99a){return _0x41d99a['addTags'](_0x166de2[_0x1040('0x1a')]['ids'],_[_0x1040('0x22')](_0x166de2[_0x1040('0x1a')],['ids','id'])||{});}})[_0x1040('0x23')](function(_0xba2fd3){logger[_0x1040('0x10')](_0x1040('0x24'),_0x166de2);logger[_0x1040('0x13')]('AddTags',_0x166de2,JSON[_0x1040('0x20')](_0xba2fd3));_0x325f9a(_0xba2fd3);})[_0x1040('0x17')](function(_0xda43cc){logger[_0x1040('0x14')]('AddTags',_0xda43cc[_0x1040('0x15')],_0x166de2);_0x502912(_this['error'](0x1f4,_0xda43cc['message']));});});}; \ No newline at end of file +var _0xc971=['AddTags','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','update','body','options','raw','where','limit','catch','AddTagsToChatInteraction','ChatInteraction','find','addTags','omit','ids','spread'];(function(_0x22c2dd,_0x33d1e7){var _0x23cc7d=function(_0x3a0e5b){while(--_0x3a0e5b){_0x22c2dd['push'](_0x22c2dd['shift']());}};_0x23cc7d(++_0x33d1e7);}(_0xc971,0x1a5));var _0x1c97=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc971[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x1c97('0x0'));var util=require(_0x1c97('0x1'));var moment=require('moment');var BPromise=require(_0x1c97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c97('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c97('0x4'));var logger=require(_0x1c97('0x5'))(_0x1c97('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c97('0x7'));var client=jayson[_0x1c97('0x8')]['http']({'port':0x232a});config['redis']=_[_0x1c97('0x9')](config[_0x1c97('0xa')],{'host':_0x1c97('0xb'),'port':0x18eb});var socket=require(_0x1c97('0xc'))(new Redis(config[_0x1c97('0xa')]));require(_0x1c97('0xd'))['register'](socket);function respondWithRpcPromise(_0x3b5ef1,_0x5b1dcd,_0x1c3e74){return new BPromise(function(_0x2357cb,_0x1312e5){return client[_0x1c97('0xe')](_0x3b5ef1,_0x1c3e74)[_0x1c97('0xf')](function(_0x18415b){logger[_0x1c97('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x5b1dcd,_0x1c97('0x11'));logger[_0x1c97('0x12')](_0x1c97('0x13'),_0x5b1dcd,_0x1c97('0x11'),JSON[_0x1c97('0x14')](_0x18415b));if(_0x18415b[_0x1c97('0x15')]){if(_0x18415b[_0x1c97('0x15')][_0x1c97('0x16')]===0x1f4){logger[_0x1c97('0x15')](_0x1c97('0x17'),_0x5b1dcd,_0x18415b['error'][_0x1c97('0x18')]);return _0x1312e5(_0x18415b[_0x1c97('0x15')][_0x1c97('0x18')]);}logger[_0x1c97('0x15')](_0x1c97('0x17'),_0x5b1dcd,_0x18415b[_0x1c97('0x15')]['message']);return _0x2357cb(_0x18415b['error'][_0x1c97('0x18')]);}else{logger[_0x1c97('0x10')](_0x1c97('0x17'),_0x5b1dcd,_0x1c97('0x11'));_0x2357cb(_0x18415b[_0x1c97('0x19')][_0x1c97('0x18')]);}})['catch'](function(_0x40b2f0){logger[_0x1c97('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5b1dcd,_0x40b2f0);_0x1312e5(_0x40b2f0);});});}exports[_0x1c97('0x1a')]=function(_0x5c64e4){var _0x30d524=this;return new Promise(function(_0x24199a,_0xebdeeb){return db['ChatInteraction'][_0x1c97('0x1b')](_0x5c64e4[_0x1c97('0x1c')],{'raw':_0x5c64e4[_0x1c97('0x1d')]?_0x5c64e4['options'][_0x1c97('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c64e4['options']?_0x5c64e4[_0x1c97('0x1d')][_0x1c97('0x1f')]||null:null,'attributes':_0x5c64e4[_0x1c97('0x1d')]?_0x5c64e4['options']['attributes']||null:null,'limit':_0x5c64e4[_0x1c97('0x1d')]?_0x5c64e4[_0x1c97('0x1d')][_0x1c97('0x20')]||null:null})[_0x1c97('0xf')](function(_0x2b21b5){logger[_0x1c97('0x10')](_0x1c97('0x1a'),_0x5c64e4);logger[_0x1c97('0x12')](_0x1c97('0x1a'),_0x5c64e4,JSON['stringify'](_0x2b21b5));_0x24199a(_0x2b21b5);})[_0x1c97('0x21')](function(_0x36a2c0){logger[_0x1c97('0x15')](_0x1c97('0x1a'),_0x36a2c0[_0x1c97('0x18')],_0x5c64e4);_0xebdeeb(_0x30d524[_0x1c97('0x15')](0x1f4,_0x36a2c0[_0x1c97('0x18')]));});});};exports[_0x1c97('0x22')]=function(_0x5a3874){return new Promise(function(_0x6903da,_0x98fa28){return db[_0x1c97('0x23')][_0x1c97('0x24')]({'where':_0x5a3874['options']?_0x5a3874[_0x1c97('0x1d')][_0x1c97('0x1f')]||null:null})[_0x1c97('0xf')](function(_0x50bf38){if(_0x50bf38){return _0x50bf38[_0x1c97('0x25')](_0x5a3874[_0x1c97('0x1c')]['ids'],_[_0x1c97('0x26')](_0x5a3874[_0x1c97('0x1c')],[_0x1c97('0x27'),'id'])||{});}})[_0x1c97('0x28')](function(_0x4ba1af){logger['info'](_0x1c97('0x29'),_0x5a3874);logger[_0x1c97('0x12')](_0x1c97('0x29'),_0x5a3874,JSON[_0x1c97('0x14')](_0x4ba1af));_0x6903da(_0x4ba1af);})['catch'](function(_0x2daa0e){logger[_0x1c97('0x15')](_0x1c97('0x29'),_0x2daa0e[_0x1c97('0x18')],_0x5a3874);_0x98fa28(_this[_0x1c97('0x15')](0x1f4,_0x2daa0e[_0x1c97('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index e6117f3..3fa1315 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 _0xefd4=['emit','removeListener','register','length','chatInteraction:','save','remove'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xefd4,0x14e));var _0x4efd=function(_0x13549a,_0x1ae1aa){_0x13549a=_0x13549a-0x0;var _0x49b032=_0xefd4[_0x13549a];return _0x49b032;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4efd('0x0'),_0x4efd('0x1'),'update'];function createListener(_0x1e7e84,_0x184bcd){return function(_0x1fc719){_0x184bcd[_0x4efd('0x2')](_0x1e7e84,_0x1fc719);};}function removeListener(_0x1995e6,_0x3790a7){return function(){ChatInteractionEvents[_0x4efd('0x3')](_0x1995e6,_0x3790a7);};}exports[_0x4efd('0x4')]=function(_0x100124){for(var _0x53be77=0x0,_0x1a267f=events[_0x4efd('0x5')];_0x53be77<_0x1a267f;_0x53be77++){var _0x106ae5=events[_0x53be77];var _0x2d6954=createListener(_0x4efd('0x6')+_0x106ae5,_0x100124);ChatInteractionEvents['on'](_0x106ae5,_0x2d6954);}}; \ No newline at end of file +var _0xca4f=['update','emit','removeListener','length','./chatInteraction.events','save'];(function(_0x2ddd52,_0x4e3b17){var _0x4bb4ec=function(_0x41905f){while(--_0x41905f){_0x2ddd52['push'](_0x2ddd52['shift']());}};_0x4bb4ec(++_0x4e3b17);}(_0xca4f,0x112));var _0xfca4=function(_0x594540,_0x11f303){_0x594540=_0x594540-0x0;var _0x11a7f7=_0xca4f[_0x594540];return _0x11a7f7;};'use strict';var ChatInteractionEvents=require(_0xfca4('0x0'));var events=[_0xfca4('0x1'),'remove',_0xfca4('0x2')];function createListener(_0x32e7c6,_0x58ecd3){return function(_0x266f67){_0x58ecd3[_0xfca4('0x3')](_0x32e7c6,_0x266f67);};}function removeListener(_0x21ea71,_0x197a93){return function(){ChatInteractionEvents[_0xfca4('0x4')](_0x21ea71,_0x197a93);};}exports['register']=function(_0x374250){for(var _0x32e15a=0x0,_0x1d5e87=events[_0xfca4('0x5')];_0x32e15a<_0x1d5e87;_0x32e15a++){var _0x1f3ab0=events[_0x32e15a];var _0x1ec5cb=createListener('chatInteraction:'+_0x1f3ab0,_0x374250);ChatInteractionEvents['on'](_0x1f3ab0,_0x1ec5cb);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 405f136..089fde8 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 _0x105b=['chat','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','create','createVidaooSession','diskStorage','root','format','%s-%s','originalname','replace','post','/:id/attachment_upload','single','attachmentUpload','addMessage','tracked'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x105b,0x1a7));var _0xb105=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x105b[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0xb105('0x0'));var util=require(_0xb105('0x1'));var path=require(_0xb105('0x2'));var timeout=require(_0xb105('0x3'));var express=require(_0xb105('0x4'));var router=express[_0xb105('0x5')]();var auth=require(_0xb105('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb105('0x7'));var controller=require(_0xb105('0x8'));router[_0xb105('0x9')]('/',auth['isAuthenticated'](),controller[_0xb105('0xa')]);router[_0xb105('0x9')](_0xb105('0xb'),auth[_0xb105('0xc')](),controller[_0xb105('0xd')]);router[_0xb105('0x9')](_0xb105('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xb105('0xf')]);router[_0xb105('0x9')]('/:id/attachment_download',auth[_0xb105('0x10')](),controller[_0xb105('0x11')]);router[_0xb105('0x9')](_0xb105('0x12'),auth[_0xb105('0xc')](),controller['getMessages']);router[_0xb105('0x9')](_0xb105('0x13'),auth['isChatInteractionAuthorized'](),controller[_0xb105('0x14')]);router[_0xb105('0x9')](_0xb105('0x15'),auth[_0xb105('0xc')](),controller['download']);router['post']('/',auth[_0xb105('0xc')](),controller[_0xb105('0x16')]);router['post']('/:id/vidaoo',auth[_0xb105('0xc')](),controller[_0xb105('0x17')]);var upload=multer({'storage':multer[_0xb105('0x18')]({'destination':function(_0x1000d8,_0x37a7b8,_0x4c17df){_0x4c17df(null,path['join'](config[_0xb105('0x19')],'server/files/attachments/'));},'filename':function(_0x519ba6,_0x47316a,_0x2f7d98){_0x2f7d98(null,util[_0xb105('0x1a')](_0xb105('0x1b'),Date['now'](),_0x47316a[_0xb105('0x1c')][_0xb105('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb105('0x1e')](_0xb105('0x1f'),upload[_0xb105('0x20')]('file'),controller[_0xb105('0x21')]);router[_0xb105('0x1e')](_0xb105('0x12'),auth[_0xb105('0x10')](),controller[_0xb105('0x22')]);router[_0xb105('0x1e')]('/:id/tags',auth[_0xb105('0xc')](),interaction[_0xb105('0x23')](_0xb105('0x24'),'chatinteraction:addtags'),controller[_0xb105('0x25')]);router[_0xb105('0x26')](_0xb105('0xe'),auth[_0xb105('0xc')](),interaction['tracked'](_0xb105('0x24'),_0xb105('0x27')),controller[_0xb105('0x28')]);router[_0xb105('0x26')](_0xb105('0x29'),controller[_0xb105('0x2a')]);router[_0xb105('0x26')]('/:id/abandon',auth[_0xb105('0x10')](),controller[_0xb105('0x2b')]);router['put'](_0xb105('0x2c'),controller[_0xb105('0x2d')]);router[_0xb105('0x2e')](_0xb105('0xe'),auth['isAuthenticated'](),interaction[_0xb105('0x23')](_0xb105('0x24'),'chatinteraction:destroy'),controller[_0xb105('0x2f')]);router[_0xb105('0x2e')](_0xb105('0x30'),auth['isAuthenticated'](),controller[_0xb105('0x31')]);module[_0xb105('0x32')]=router; \ No newline at end of file +var _0x0e21=['removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','attachmentDownload','/:id/my_messages','isChatInteractionAuthorized','/:id/download','post','/:id/vidaoo','diskStorage','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','chatinteraction:destroy','destroy'];(function(_0x38c757,_0xa4ebf4){var _0x525e49=function(_0x104bd9){while(--_0x104bd9){_0x38c757['push'](_0x38c757['shift']());}};_0x525e49(++_0xa4ebf4);}(_0x0e21,0xe8));var _0x10e2=function(_0x10dd2f,_0x4e03a8){_0x10dd2f=_0x10dd2f-0x0;var _0x4d6495=_0x0e21[_0x10dd2f];return _0x4d6495;};'use strict';var multer=require('multer');var util=require(_0x10e2('0x0'));var path=require(_0x10e2('0x1'));var timeout=require(_0x10e2('0x2'));var express=require('express');var router=express[_0x10e2('0x3')]();var auth=require(_0x10e2('0x4'));var interaction=require(_0x10e2('0x5'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x10e2('0x6')]('/',auth[_0x10e2('0x7')](),controller[_0x10e2('0x8')]);router[_0x10e2('0x6')](_0x10e2('0x9'),auth[_0x10e2('0x7')](),controller[_0x10e2('0xa')]);router[_0x10e2('0x6')](_0x10e2('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x10e2('0xc')]);router['get']('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x10e2('0xd')]);router[_0x10e2('0x6')]('/:id/messages',auth[_0x10e2('0x7')](),controller['getMessages']);router[_0x10e2('0x6')](_0x10e2('0xe'),auth[_0x10e2('0xf')](),controller['getMyMessages']);router[_0x10e2('0x6')](_0x10e2('0x10'),auth[_0x10e2('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x10e2('0x11')](_0x10e2('0x12'),auth[_0x10e2('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x10e2('0x13')]({'destination':function(_0x178cc1,_0x1d6f9d,_0x40c5bc){_0x40c5bc(null,path[_0x10e2('0x14')](config[_0x10e2('0x15')],'server/files/attachments/'));},'filename':function(_0x2fd6a7,_0x284c1b,_0x388a45){_0x388a45(null,util[_0x10e2('0x16')](_0x10e2('0x17'),Date[_0x10e2('0x18')](),_0x284c1b[_0x10e2('0x19')][_0x10e2('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x10e2('0x1b'),upload[_0x10e2('0x1c')](_0x10e2('0x1d')),controller[_0x10e2('0x1e')]);router['post']('/:id/messages',auth[_0x10e2('0xf')](),controller[_0x10e2('0x1f')]);router[_0x10e2('0x11')](_0x10e2('0x20'),auth['isAuthenticated'](),interaction['tracked'](_0x10e2('0x21'),_0x10e2('0x22')),controller[_0x10e2('0x23')]);router[_0x10e2('0x24')](_0x10e2('0xb'),auth[_0x10e2('0x7')](),interaction['tracked'](_0x10e2('0x21'),_0x10e2('0x25')),controller[_0x10e2('0x26')]);router[_0x10e2('0x24')](_0x10e2('0x27'),controller[_0x10e2('0x28')]);router['put'](_0x10e2('0x29'),auth['isChatInteractionAuthorized'](),controller['abandon']);router['put']('/:id/close',controller['close']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x10e2('0x21'),_0x10e2('0x2a')),controller[_0x10e2('0x2b')]);router['delete'](_0x10e2('0x20'),auth[_0x10e2('0x7')](),controller[_0x10e2('0x2c')]);module[_0x10e2('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 847c255..ed3a3ad 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 _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0x7a54,0x106));var _0x47a5=function(_0x3d2962,_0x5b22b2){_0x3d2962=_0x3d2962-0x0;var _0x567f30=_0x7a54[_0x3d2962];return _0x567f30;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x37308d,_0x19f8ca){var _0x1db987=function(_0x3cc89d){while(--_0x3cc89d){_0x37308d['push'](_0x37308d['shift']());}};_0x1db987(++_0x19f8ca);}(_0x57ca,0x108));var _0xa57c=function(_0x1fe092,_0x2082ef){_0x1fe092=_0x1fe092-0x0;var _0x10a587=_0x57ca[_0x1fe092];return _0x10a587;};'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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9a9e7e0..fee39b0 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 _0x51a0=['then','destroy','error','name','send','map','ChatInternalMessage','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','create','body','find','catch','describe','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','findAll','agent','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','ToId','read','-createdAt','all','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x4eba66,_0x138a2d){var _0x1e3f0d=function(_0x128474){while(--_0x128474){_0x4eba66['push'](_0x4eba66['shift']());}};_0x1e3f0d(++_0x138a2d);}(_0x51a0,0xaa));var _0x051a=function(_0x1702e1,_0x3a8949){_0x1702e1=_0x1702e1-0x0;var _0x2bdc8c=_0x51a0[_0x1702e1];return _0x2bdc8c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x051a('0x0'));var jsonpatch=require(_0x051a('0x1'));var rp=require(_0x051a('0x2'));var moment=require(_0x051a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x051a('0x4'));var util=require(_0x051a('0x5'));var path=require(_0x051a('0x6'));var sox=require(_0x051a('0x7'));var csv=require(_0x051a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x051a('0x9'));var squel=require(_0x051a('0xa'));var crypto=require(_0x051a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x051a('0xc'));var toCsv=require(_0x051a('0x8'));var querystring=require(_0x051a('0xd'));var Papa=require('papaparse');var Redis=require(_0x051a('0xe'));var authService=require(_0x051a('0xf'));var qs=require(_0x051a('0x10'));var as=require(_0x051a('0x11'));var hardwareService=require(_0x051a('0x12'));var logger=require(_0x051a('0x13'))('api');var utils=require(_0x051a('0x14'));var config=require(_0x051a('0x15'));var db=require(_0x051a('0x16'))['db'];config[_0x051a('0x17')]=_['defaults'](config['redis'],{'host':_0x051a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x051a('0x17')]));require(_0x051a('0x19'))[_0x051a('0x1a')](socket);function respondWithStatusCode(_0x51dd98,_0x506668){_0x506668=_0x506668||0xcc;return function(_0x15eb53){if(_0x15eb53){return _0x51dd98[_0x051a('0x1b')](_0x506668);}return _0x51dd98[_0x051a('0x1c')](_0x506668)[_0x051a('0x1d')]();};}function respondWithResult(_0x4b9b81,_0x157e43){_0x157e43=_0x157e43||0xc8;return function(_0x341caa){if(_0x341caa){return _0x4b9b81['status'](_0x157e43)[_0x051a('0x1e')](_0x341caa);}};}function respondWithFilteredResult(_0x433d64,_0x3e9ee7){return function(_0x229b12){if(_0x229b12){var _0x2b161b=_0x229b12[_0x051a('0x1f')],_0xca2b95=_0x3e9ee7[_0x051a('0x20')],_0x1efe1f=_0x3e9ee7[_0x051a('0x20')]+_0x3e9ee7[_0x051a('0x21')],_0x458b3a;if(_0x1efe1f>=_0x2b161b){_0x1efe1f=_0x2b161b;_0x458b3a=0xc8;}else{_0x458b3a=0xce;}_0x433d64['status'](_0x458b3a);return _0x433d64[_0x051a('0x22')](_0x051a('0x23'),_0xca2b95+'-'+_0x1efe1f+'/'+_0x2b161b)[_0x051a('0x1e')](_0x229b12);}return null;};}function patchUpdates(_0xc1f697){return function(_0x59734f){try{jsonpatch[_0x051a('0x24')](_0x59734f,_0xc1f697,!![]);}catch(_0x336a49){return BPromise[_0x051a('0x25')](_0x336a49);}return _0x59734f[_0x051a('0x26')]();};}function saveUpdates(_0x44ed27,_0x267d95){return function(_0x2282ac){if(_0x2282ac){return _0x2282ac[_0x051a('0x27')](_0x44ed27)[_0x051a('0x28')](function(_0x423c20){return _0x423c20;});}return null;};}function removeEntity(_0x55fc13,_0x13c795){return function(_0x4b0f45){if(_0x4b0f45){return _0x4b0f45[_0x051a('0x29')]()[_0x051a('0x28')](function(){_0x55fc13[_0x051a('0x1c')](0xcc)[_0x051a('0x1d')]();});}};}function handleEntityNotFound(_0x2ea039,_0x21d555){return function(_0x1dc87b){if(!_0x1dc87b){_0x2ea039[_0x051a('0x1b')](0x194);}return _0x1dc87b;};}function handleError(_0x430236,_0x5bc4d8){_0x5bc4d8=_0x5bc4d8||0x1f4;return function(_0x160946){logger[_0x051a('0x2a')](_0x160946['stack']);if(_0x160946[_0x051a('0x2b')]){delete _0x160946[_0x051a('0x2b')];}_0x430236[_0x051a('0x1c')](_0x5bc4d8)[_0x051a('0x2c')](_0x160946);};}exports['index']=function(_0x25911f,_0x28d848){var _0x4b1734={},_0x346bc1={},_0x1b2a9e={'count':0x0,'rows':[]};var _0x469ef5=_[_0x051a('0x2d')](db[_0x051a('0x2e')][_0x051a('0x2f')],function(_0x1597a0){return{'name':_0x1597a0['fieldName'],'type':_0x1597a0['type'][_0x051a('0x30')]};});_0x346bc1['model']=_[_0x051a('0x2d')](_0x469ef5,_0x051a('0x2b'));_0x346bc1[_0x051a('0x31')]=_['keys'](_0x25911f[_0x051a('0x31')]);_0x346bc1[_0x051a('0x32')]=_[_0x051a('0x33')](_0x346bc1[_0x051a('0x34')],_0x346bc1['query']);_0x4b1734[_0x051a('0x35')]=_[_0x051a('0x33')](_0x346bc1[_0x051a('0x34')],qs[_0x051a('0x36')](_0x25911f[_0x051a('0x31')][_0x051a('0x36')]));_0x4b1734[_0x051a('0x35')]=_0x4b1734['attributes'][_0x051a('0x37')]?_0x4b1734[_0x051a('0x35')]:_0x346bc1[_0x051a('0x34')];if(!_0x25911f[_0x051a('0x31')][_0x051a('0x38')](_0x051a('0x39'))){_0x4b1734[_0x051a('0x21')]=qs[_0x051a('0x21')](_0x25911f[_0x051a('0x31')][_0x051a('0x21')]);_0x4b1734[_0x051a('0x20')]=qs[_0x051a('0x20')](_0x25911f[_0x051a('0x31')]['offset']);}_0x4b1734['order']=qs[_0x051a('0x3a')](_0x25911f[_0x051a('0x31')]['sort']);_0x4b1734[_0x051a('0x3b')]=qs[_0x051a('0x32')](_[_0x051a('0x3c')](_0x25911f['query'],_0x346bc1[_0x051a('0x32')]),_0x469ef5);if(_0x25911f[_0x051a('0x31')][_0x051a('0x3d')]){_0x4b1734['where']=_[_0x051a('0x3e')](_0x4b1734['where'],{'$or':_[_0x051a('0x2d')](_0x469ef5,function(_0x533a59){if(_0x533a59[_0x051a('0x3f')]!==_0x051a('0x40')){var _0x7f96e7={};_0x7f96e7[_0x533a59['name']]={'$like':'%'+_0x25911f[_0x051a('0x31')][_0x051a('0x3d')]+'%'};return _0x7f96e7;}})});}_0x4b1734=_[_0x051a('0x3e')]({},_0x4b1734,_0x25911f[_0x051a('0x41')]);var _0x3f400a={'where':_0x4b1734[_0x051a('0x3b')]};return db[_0x051a('0x2e')]['count'](_0x3f400a)[_0x051a('0x28')](function(_0x33ccec){_0x1b2a9e['count']=_0x33ccec;if(_0x25911f[_0x051a('0x31')][_0x051a('0x42')]){_0x4b1734[_0x051a('0x43')]=[{'all':!![]}];}return db[_0x051a('0x2e')]['findAll'](_0x4b1734);})[_0x051a('0x28')](function(_0x3e4340){_0x1b2a9e[_0x051a('0x44')]=_0x3e4340;return _0x1b2a9e;})[_0x051a('0x28')](respondWithFilteredResult(_0x28d848,_0x4b1734))['catch'](handleError(_0x28d848,null));};exports[_0x051a('0x45')]=function(_0x5f53bb,_0xcc42b5){var _0x3ad69d={'raw':!![],'where':{'id':_0x5f53bb[_0x051a('0x46')]['id']}},_0x2cbcd0={};_0x2cbcd0[_0x051a('0x34')]=_[_0x051a('0x47')](db[_0x051a('0x2e')][_0x051a('0x2f')]);_0x2cbcd0[_0x051a('0x31')]=_[_0x051a('0x47')](_0x5f53bb[_0x051a('0x31')]);_0x2cbcd0['filters']=_[_0x051a('0x33')](_0x2cbcd0[_0x051a('0x34')],_0x2cbcd0[_0x051a('0x31')]);_0x3ad69d[_0x051a('0x35')]=_[_0x051a('0x33')](_0x2cbcd0[_0x051a('0x34')],qs['fields'](_0x5f53bb[_0x051a('0x31')]['fields']));_0x3ad69d[_0x051a('0x35')]=_0x3ad69d[_0x051a('0x35')][_0x051a('0x37')]?_0x3ad69d[_0x051a('0x35')]:_0x2cbcd0[_0x051a('0x34')];if(_0x5f53bb[_0x051a('0x31')][_0x051a('0x42')]){_0x3ad69d[_0x051a('0x43')]=[{'all':!![]}];}_0x3ad69d=_[_0x051a('0x3e')]({},_0x3ad69d,_0x5f53bb[_0x051a('0x41')]);return db['ChatInternalMessage']['find'](_0x3ad69d)[_0x051a('0x28')](handleEntityNotFound(_0xcc42b5,null))[_0x051a('0x28')](respondWithResult(_0xcc42b5,null))['catch'](handleError(_0xcc42b5,null));};exports[_0x051a('0x48')]=function(_0x200ad1,_0x42e427){return db[_0x051a('0x2e')][_0x051a('0x48')](_0x200ad1[_0x051a('0x49')],{})['then'](respondWithResult(_0x42e427,0xc9))['catch'](handleError(_0x42e427,null));};exports[_0x051a('0x27')]=function(_0x2b850e,_0x4a3760){if(_0x2b850e[_0x051a('0x49')]['id']){delete _0x2b850e[_0x051a('0x49')]['id'];}return db[_0x051a('0x2e')][_0x051a('0x4a')]({'where':{'id':_0x2b850e[_0x051a('0x46')]['id']}})[_0x051a('0x28')](handleEntityNotFound(_0x4a3760,null))['then'](saveUpdates(_0x2b850e['body'],null))[_0x051a('0x28')](respondWithResult(_0x4a3760,null))['catch'](handleError(_0x4a3760,null));};exports['destroy']=function(_0x1997e3,_0x4196aa){return db[_0x051a('0x2e')]['find']({'where':{'id':_0x1997e3[_0x051a('0x46')]['id']}})[_0x051a('0x28')](handleEntityNotFound(_0x4196aa,null))[_0x051a('0x28')](removeEntity(_0x4196aa,null))[_0x051a('0x4b')](handleError(_0x4196aa,null));};exports[_0x051a('0x4c')]=function(_0x47e8e0,_0x1f8d0f){return db[_0x051a('0x2e')][_0x051a('0x4c')]()[_0x051a('0x28')](respondWithResult(_0x1f8d0f,null))[_0x051a('0x4b')](handleError(_0x1f8d0f,null));};function wrapUser(_0x4f993c){return function(_0x1cfd5d){var _0x543796=_0x4f993c['get']({'plain':!![]});_0x543796['messages']=[];if(_0x1cfd5d){_0x543796[_0x051a('0x4d')]=_0x1cfd5d[_0x051a('0x4e')];_0x543796['lastMessage']=_0x1cfd5d;}else{_0x543796[_0x051a('0x4d')]=moment(0x0)[_0x051a('0x4f')](_0x051a('0x50'));_0x543796[_0x051a('0x51')]={};}return _0x543796;};}exports['getUsers']=function(_0x20479e,_0x50363b,_0x49780b){var _0x53e122=[];return db['User'][_0x051a('0x52')]({'where':{'role':[_0x051a('0x53'),'admin','user']},'attributes':['id','fullname',_0x051a('0x2b'),_0x051a('0x54'),_0x051a('0x55'),_0x051a('0x56'),_0x051a('0x57'),_0x051a('0x58'),_0x051a('0x59'),'showWebBar'],'order':qs[_0x051a('0x3a')](_0x051a('0x5a')),'include':[{'model':db['VoiceQueue'],'as':_0x051a('0x5b'),'attributes':['id',_0x051a('0x2b'),_0x051a('0x3f')],'through':{'attributes':[]}}]})[_0x051a('0x28')](function(_0x3280e9){if(_0x3280e9){var _0x46e546=_0x20479e[_0x051a('0x5c')][_0x051a('0x5d')]({'plain':!![]});if(!_0x46e546)throw new Error(_0x051a('0x5e'));if(_0x46e546['role']==='user'){return db['UserProfileSection'][_0x051a('0x4a')]({'where':{'name':'Agents','userProfileId':_0x46e546[_0x051a('0x5f')]},'raw':!![]})[_0x051a('0x28')](function(_0x1be221){if(_0x1be221){if(_0x1be221[_0x051a('0x60')]===0x0){return db[_0x051a('0x61')]['findAll']({'where':{'sectionId':_0x1be221['id']},'raw':!![]})[_0x051a('0x28')](function(_0x655420){var _0x39d976=[];if(_[_0x051a('0x62')](_0x655420)){_0x39d976=_[_0x051a('0x3d')](_0x3280e9,function(_0x4d8205){if(_0x4d8205[_0x051a('0x54')]!=='agent'){return _0x4d8205;}});return _0x39d976;}else{for(var _0x296286=0x0;_0x296286<_0x3280e9[_0x051a('0x37')];_0x296286++){var _0x1aa4c2=_0x3280e9[_0x296286];if(_0x1aa4c2[_0x051a('0x54')]===_0x051a('0x53')){var _0x23d596=_[_0x051a('0x4a')](_0x655420,function(_0x349859){return _0x349859[_0x051a('0x63')]===_0x1aa4c2['id'];});if(_0x23d596)_0x39d976[_0x051a('0x64')](_0x1aa4c2);}else{_0x39d976[_0x051a('0x64')](_0x1aa4c2);}}return _0x39d976;}});}else{return _0x3280e9;}}else{var _0x37ec08=_[_0x051a('0x3d')](_0x3280e9,function(_0x43e79b){if(_0x43e79b[_0x051a('0x54')]!==_0x051a('0x53')){return _0x43e79b;}});return _0x37ec08;}});}else{return _0x3280e9;}}})[_0x051a('0x28')](function(_0x3ddb64){var _0x325f39=[];if(_0x3ddb64){_0x53e122=_0x3ddb64;for(var _0x19df8b=0x0;_0x19df8b<_0x3ddb64['length'];_0x19df8b+=0x1){_0x53e122[_0x19df8b]['messages']=[];_0x325f39[_0x051a('0x64')](db['ChatInternalMessage'][_0x051a('0x4a')]({'where':{'FromId':[_0x20479e[_0x051a('0x5c')]['id'],_0x3ddb64[_0x19df8b]['id']],'ToId':[_0x20479e[_0x051a('0x5c')]['id'],_0x3ddb64[_0x19df8b]['id']],'ChatGroupId':null},'attributes':['id',_0x051a('0x4e'),'FromId',_0x051a('0x65'),_0x051a('0x66'),'body'],'order':qs[_0x051a('0x3a')](_0x051a('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3ddb64[_0x19df8b])));}return BPromise[_0x051a('0x68')](_0x325f39);}return[];})[_0x051a('0x28')](function(_0x259a90){return{'rows':_0x259a90,'count':_0x259a90[_0x051a('0x37')]};})['then'](respondWithResult(_0x50363b,null))[_0x051a('0x4b')](handleError(_0x50363b,null));}; \ No newline at end of file +var _0x7992=['describe','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','internal','online','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','name','send','type','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','ChatInternalMessage','create','body','find'];(function(_0x1787b4,_0x53d1a2){var _0x7a644b=function(_0x4ad664){while(--_0x4ad664){_0x1787b4['push'](_0x1787b4['shift']());}};_0x7a644b(++_0x53d1a2);}(_0x7992,0xfa));var _0x2799=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x7992[_0x72895a];return _0x5226d5;};'use strict';var pdf=require(_0x2799('0x0'));var emlformat=require(_0x2799('0x1'));var rimraf=require(_0x2799('0x2'));var zipdir=require(_0x2799('0x3'));var jsonpatch=require(_0x2799('0x4'));var rp=require(_0x2799('0x5'));var moment=require(_0x2799('0x6'));var BPromise=require(_0x2799('0x7'));var Mustache=require(_0x2799('0x8'));var util=require(_0x2799('0x9'));var path=require(_0x2799('0xa'));var sox=require(_0x2799('0xb'));var csv=require(_0x2799('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2799('0xd'));var squel=require(_0x2799('0xe'));var crypto=require(_0x2799('0xf'));var jsforce=require(_0x2799('0x10'));var deskjs=require(_0x2799('0x11'));var toCsv=require(_0x2799('0xc'));var querystring=require(_0x2799('0x12'));var Papa=require(_0x2799('0x13'));var Redis=require(_0x2799('0x14'));var authService=require(_0x2799('0x15'));var qs=require(_0x2799('0x16'));var as=require(_0x2799('0x17'));var hardwareService=require(_0x2799('0x18'));var logger=require(_0x2799('0x19'))('api');var utils=require(_0x2799('0x1a'));var config=require(_0x2799('0x1b'));var db=require(_0x2799('0x1c'))['db'];config[_0x2799('0x1d')]=_[_0x2799('0x1e')](config[_0x2799('0x1d')],{'host':_0x2799('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2799('0x1d')]));require(_0x2799('0x20'))[_0x2799('0x21')](socket);function respondWithStatusCode(_0x347e7b,_0x57bd32){_0x57bd32=_0x57bd32||0xcc;return function(_0x274a10){if(_0x274a10){return _0x347e7b[_0x2799('0x22')](_0x57bd32);}return _0x347e7b[_0x2799('0x23')](_0x57bd32)[_0x2799('0x24')]();};}function respondWithResult(_0x371bd8,_0x2428e0){_0x2428e0=_0x2428e0||0xc8;return function(_0x35a36c){if(_0x35a36c){return _0x371bd8['status'](_0x2428e0)[_0x2799('0x25')](_0x35a36c);}};}function respondWithFilteredResult(_0xae6602,_0x349c59){return function(_0x323ae6){if(_0x323ae6){var _0x13a6b5=_0x323ae6[_0x2799('0x26')],_0x126ad6=_0x349c59[_0x2799('0x27')],_0x336a55=_0x349c59[_0x2799('0x27')]+_0x349c59[_0x2799('0x28')],_0x3ccc23;if(_0x336a55>=_0x13a6b5){_0x336a55=_0x13a6b5;_0x3ccc23=0xc8;}else{_0x3ccc23=0xce;}_0xae6602[_0x2799('0x23')](_0x3ccc23);return _0xae6602[_0x2799('0x29')](_0x2799('0x2a'),_0x126ad6+'-'+_0x336a55+'/'+_0x13a6b5)[_0x2799('0x25')](_0x323ae6);}return null;};}function patchUpdates(_0x1b2820){return function(_0x24ebb8){try{jsonpatch[_0x2799('0x2b')](_0x24ebb8,_0x1b2820,!![]);}catch(_0x1bde07){return BPromise['reject'](_0x1bde07);}return _0x24ebb8['save']();};}function saveUpdates(_0x5cfcfc,_0x147512){return function(_0x51eb0e){if(_0x51eb0e){return _0x51eb0e[_0x2799('0x2c')](_0x5cfcfc)[_0x2799('0x2d')](function(_0x47aeef){return _0x47aeef;});}return null;};}function removeEntity(_0x196a2e,_0x44ff2f){return function(_0x2299ea){if(_0x2299ea){return _0x2299ea[_0x2799('0x2e')]()[_0x2799('0x2d')](function(){_0x196a2e[_0x2799('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa9eb,_0x417e47){return function(_0x3eaa6a){if(!_0x3eaa6a){_0x3fa9eb[_0x2799('0x22')](0x194);}return _0x3eaa6a;};}function handleError(_0x237395,_0x3d6891){_0x3d6891=_0x3d6891||0x1f4;return function(_0x3e7da3){logger[_0x2799('0x2f')](_0x3e7da3['stack']);if(_0x3e7da3[_0x2799('0x30')]){delete _0x3e7da3['name'];}_0x237395['status'](_0x3d6891)[_0x2799('0x31')](_0x3e7da3);};}exports['index']=function(_0x59b0dc,_0x13517f){var _0x421897={},_0x25959b={},_0xd67cd3={'count':0x0,'rows':[]};var _0x240191=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0x5cfdb9){return{'name':_0x5cfdb9['fieldName'],'type':_0x5cfdb9[_0x2799('0x32')]['key']};});_0x25959b[_0x2799('0x33')]=_[_0x2799('0x34')](_0x240191,_0x2799('0x30'));_0x25959b['query']=_[_0x2799('0x35')](_0x59b0dc[_0x2799('0x36')]);_0x25959b['filters']=_['intersection'](_0x25959b[_0x2799('0x33')],_0x25959b[_0x2799('0x36')]);_0x421897['attributes']=_[_0x2799('0x37')](_0x25959b[_0x2799('0x33')],qs[_0x2799('0x38')](_0x59b0dc['query'][_0x2799('0x38')]));_0x421897['attributes']=_0x421897[_0x2799('0x39')][_0x2799('0x3a')]?_0x421897['attributes']:_0x25959b[_0x2799('0x33')];if(!_0x59b0dc[_0x2799('0x36')][_0x2799('0x3b')](_0x2799('0x3c'))){_0x421897[_0x2799('0x28')]=qs[_0x2799('0x28')](_0x59b0dc[_0x2799('0x36')][_0x2799('0x28')]);_0x421897[_0x2799('0x27')]=qs[_0x2799('0x27')](_0x59b0dc[_0x2799('0x36')][_0x2799('0x27')]);}_0x421897['order']=qs['sort'](_0x59b0dc[_0x2799('0x36')][_0x2799('0x3d')]);_0x421897['where']=qs['filters'](_[_0x2799('0x3e')](_0x59b0dc[_0x2799('0x36')],_0x25959b[_0x2799('0x3f')]),_0x240191);if(_0x59b0dc[_0x2799('0x36')][_0x2799('0x40')]){_0x421897[_0x2799('0x41')]=_[_0x2799('0x42')](_0x421897[_0x2799('0x41')],{'$or':_['map'](_0x240191,function(_0x201396){if(_0x201396['type']!==_0x2799('0x43')){var _0x45c515={};_0x45c515[_0x201396[_0x2799('0x30')]]={'$like':'%'+_0x59b0dc['query'][_0x2799('0x40')]+'%'};return _0x45c515;}})});}_0x421897=_[_0x2799('0x42')]({},_0x421897,_0x59b0dc['options']);var _0x432aa4={'where':_0x421897[_0x2799('0x41')]};return db['ChatInternalMessage']['count'](_0x432aa4)['then'](function(_0x2d05a6){_0xd67cd3[_0x2799('0x26')]=_0x2d05a6;if(_0x59b0dc[_0x2799('0x36')][_0x2799('0x44')]){_0x421897[_0x2799('0x45')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x2799('0x46')](_0x421897);})[_0x2799('0x2d')](function(_0x51325d){_0xd67cd3[_0x2799('0x47')]=_0x51325d;return _0xd67cd3;})[_0x2799('0x2d')](respondWithFilteredResult(_0x13517f,_0x421897))[_0x2799('0x48')](handleError(_0x13517f,null));};exports[_0x2799('0x49')]=function(_0xb7e931,_0x554a4b){var _0x3d181a={'raw':!![],'where':{'id':_0xb7e931[_0x2799('0x4a')]['id']}},_0xcb075d={};_0xcb075d[_0x2799('0x33')]=_[_0x2799('0x35')](db['ChatInternalMessage'][_0x2799('0x4b')]);_0xcb075d['query']=_[_0x2799('0x35')](_0xb7e931['query']);_0xcb075d[_0x2799('0x3f')]=_[_0x2799('0x37')](_0xcb075d[_0x2799('0x33')],_0xcb075d[_0x2799('0x36')]);_0x3d181a[_0x2799('0x39')]=_[_0x2799('0x37')](_0xcb075d[_0x2799('0x33')],qs[_0x2799('0x38')](_0xb7e931[_0x2799('0x36')][_0x2799('0x38')]));_0x3d181a[_0x2799('0x39')]=_0x3d181a[_0x2799('0x39')]['length']?_0x3d181a[_0x2799('0x39')]:_0xcb075d[_0x2799('0x33')];if(_0xb7e931[_0x2799('0x36')][_0x2799('0x44')]){_0x3d181a[_0x2799('0x45')]=[{'all':!![]}];}_0x3d181a=_['merge']({},_0x3d181a,_0xb7e931['options']);return db[_0x2799('0x4c')]['find'](_0x3d181a)[_0x2799('0x2d')](handleEntityNotFound(_0x554a4b,null))[_0x2799('0x2d')](respondWithResult(_0x554a4b,null))[_0x2799('0x48')](handleError(_0x554a4b,null));};exports[_0x2799('0x4d')]=function(_0x3d2843,_0x444625){return db[_0x2799('0x4c')][_0x2799('0x4d')](_0x3d2843[_0x2799('0x4e')],{})[_0x2799('0x2d')](respondWithResult(_0x444625,0xc9))[_0x2799('0x48')](handleError(_0x444625,null));};exports['update']=function(_0x1bf256,_0x19f1bb){if(_0x1bf256['body']['id']){delete _0x1bf256[_0x2799('0x4e')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x1bf256[_0x2799('0x4a')]['id']}})[_0x2799('0x2d')](handleEntityNotFound(_0x19f1bb,null))['then'](saveUpdates(_0x1bf256[_0x2799('0x4e')],null))[_0x2799('0x2d')](respondWithResult(_0x19f1bb,null))[_0x2799('0x48')](handleError(_0x19f1bb,null));};exports[_0x2799('0x2e')]=function(_0x31177f,_0x34a5c0){return db[_0x2799('0x4c')][_0x2799('0x4f')]({'where':{'id':_0x31177f[_0x2799('0x4a')]['id']}})['then'](handleEntityNotFound(_0x34a5c0,null))[_0x2799('0x2d')](removeEntity(_0x34a5c0,null))[_0x2799('0x48')](handleError(_0x34a5c0,null));};exports[_0x2799('0x50')]=function(_0x4b5159,_0x266aa4){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x266aa4,null))[_0x2799('0x48')](handleError(_0x266aa4,null));};function wrapUser(_0x5e82c9){return function(_0x36601b){var _0x469fad=_0x5e82c9['get']({'plain':!![]});_0x469fad[_0x2799('0x51')]=[];if(_0x36601b){_0x469fad[_0x2799('0x52')]=_0x36601b[_0x2799('0x53')];_0x469fad['lastMessage']=_0x36601b;}else{_0x469fad[_0x2799('0x52')]=moment(0x0)[_0x2799('0x54')](_0x2799('0x55'));_0x469fad['lastMessage']={};}return _0x469fad;};}exports[_0x2799('0x56')]=function(_0x1524b0,_0x219b36,_0x3cbe1b){var _0x320b07=[];return db[_0x2799('0x57')][_0x2799('0x46')]({'where':{'role':[_0x2799('0x58'),_0x2799('0x59'),'user']},'attributes':['id',_0x2799('0x5a'),_0x2799('0x30'),_0x2799('0x5b'),'userpic',_0x2799('0x5c'),_0x2799('0x5d'),'lastLoginAt','allowmessenger',_0x2799('0x5e')],'order':qs['sort'](_0x2799('0x5f')),'include':[{'model':db[_0x2799('0x60')],'as':_0x2799('0x61'),'attributes':['id',_0x2799('0x30'),'type'],'through':{'attributes':[]}}]})[_0x2799('0x2d')](function(_0x431087){if(_0x431087){var _0x4dbe9c=_0x1524b0[_0x2799('0x62')][_0x2799('0x63')]({'plain':!![]});if(!_0x4dbe9c)throw new Error(_0x2799('0x64'));if(_0x4dbe9c['role']==='user'){return db[_0x2799('0x65')]['find']({'where':{'name':'Agents','userProfileId':_0x4dbe9c['userProfileId']},'raw':!![]})[_0x2799('0x2d')](function(_0x3e58ce){if(_0x3e58ce){if(_0x3e58ce['autoAssociation']===0x0){return db['UserProfileResource'][_0x2799('0x46')]({'where':{'sectionId':_0x3e58ce['id']},'raw':!![]})[_0x2799('0x2d')](function(_0x179428){var _0x4257a2=[];if(_[_0x2799('0x66')](_0x179428)){_0x4257a2=_[_0x2799('0x40')](_0x431087,function(_0x31cc14){if(_0x31cc14[_0x2799('0x5b')]!==_0x2799('0x58')){return _0x31cc14;}});return _0x4257a2;}else{for(var _0x5a55f1=0x0;_0x5a55f1<_0x431087[_0x2799('0x3a')];_0x5a55f1++){var _0x4d0932=_0x431087[_0x5a55f1];if(_0x4d0932[_0x2799('0x5b')]===_0x2799('0x58')){var _0x3f124f=_[_0x2799('0x4f')](_0x179428,function(_0x4e0db8){return _0x4e0db8[_0x2799('0x67')]===_0x4d0932['id'];});if(_0x3f124f)_0x4257a2[_0x2799('0x68')](_0x4d0932);}else{_0x4257a2[_0x2799('0x68')](_0x4d0932);}}return _0x4257a2;}});}else{return _0x431087;}}else{var _0x192995=_[_0x2799('0x40')](_0x431087,function(_0x1821c7){if(_0x1821c7['role']!==_0x2799('0x58')){return _0x1821c7;}});return _0x192995;}});}else{return _0x431087;}}})['then'](function(_0x542a84){var _0x7e7e25=[];if(_0x542a84){_0x320b07=_0x542a84;for(var _0x3754f7=0x0;_0x3754f7<_0x542a84[_0x2799('0x3a')];_0x3754f7+=0x1){_0x320b07[_0x3754f7][_0x2799('0x51')]=[];_0x7e7e25[_0x2799('0x68')](db[_0x2799('0x4c')][_0x2799('0x4f')]({'where':{'FromId':[_0x1524b0['user']['id'],_0x542a84[_0x3754f7]['id']],'ToId':[_0x1524b0[_0x2799('0x62')]['id'],_0x542a84[_0x3754f7]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x2799('0x69'),_0x2799('0x6a'),_0x2799('0x6b'),'body'],'order':qs[_0x2799('0x3d')](_0x2799('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2799('0x2d')](wrapUser(_0x542a84[_0x3754f7])));}return BPromise[_0x2799('0x6d')](_0x7e7e25);}return[];})['then'](function(_0x525b05){return{'rows':_0x525b05,'count':_0x525b05['length']};})[_0x2799('0x2d')](respondWithResult(_0x219b36,null))[_0x2799('0x48')](handleError(_0x219b36,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index fba6f67..3838d7d 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 _0xdb5c=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4f3a0e,_0x396ed2){var _0x1d5936=function(_0x1ccdb4){while(--_0x1ccdb4){_0x4f3a0e['push'](_0x4f3a0e['shift']());}};_0x1d5936(++_0x396ed2);}(_0xdb5c,0x169));var _0xcdb5=function(_0x40ba72,_0x2dfa5a){_0x40ba72=_0x40ba72-0x0;var _0x3f6948=_0xdb5c[_0x40ba72];return _0x3f6948;};'use strict';var EventEmitter=require(_0xcdb5('0x0'));var ChatInternalMessage=require(_0xcdb5('0x1'))['db'][_0xcdb5('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xcdb5('0x3')](0x0);var events={'afterCreate':_0xcdb5('0x4'),'afterUpdate':'update','afterDestroy':_0xcdb5('0x5')};function emitEvent(_0x4b0cdb){return function(_0x50678c,_0x273863,_0x2a7a47){ChatInternalMessageEvents[_0xcdb5('0x6')](_0x4b0cdb+':'+_0x50678c['id'],_0x50678c);ChatInternalMessageEvents[_0xcdb5('0x6')](_0x4b0cdb,_0x50678c);_0x2a7a47(null);};}for(var e in events){if(events[_0xcdb5('0x7')](e)){var event=events[e];ChatInternalMessage[_0xcdb5('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x5a2a=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x3fa9c1,_0x27a1b9){_0x3fa9c1=_0x3fa9c1-0x0;var _0x6e0d4=_0x5a2a[_0x3fa9c1];return _0x6e0d4;};'use strict';var EventEmitter=require(_0xa5a2('0x0'));var ChatInternalMessage=require(_0xa5a2('0x1'))['db'][_0xa5a2('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa5a2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4e464d){return function(_0x2cf196,_0x479d0a,_0x14bf26){ChatInternalMessageEvents[_0xa5a2('0x4')](_0x4e464d+':'+_0x2cf196['id'],_0x2cf196);ChatInternalMessageEvents[_0xa5a2('0x4')](_0x4e464d,_0x2cf196);_0x14bf26(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xa5a2('0x5')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f8ff3d1..bcb6f2a 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 _0x9868=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x44334a,_0x181bce){var _0x20a140=function(_0x7ee785){while(--_0x7ee785){_0x44334a['push'](_0x44334a['shift']());}};_0x20a140(++_0x181bce);}(_0x9868,0x78));var _0x8986=function(_0x43fe79,_0x4e05e7){_0x43fe79=_0x43fe79-0x0;var _0x98912d=_0x9868[_0x43fe79];return _0x98912d;};'use strict';var _=require(_0x8986('0x0'));var util=require(_0x8986('0x1'));var logger=require(_0x8986('0x2'))(_0x8986('0x3'));var moment=require(_0x8986('0x4'));var BPromise=require(_0x8986('0x5'));var rp=require(_0x8986('0x6'));var fs=require('fs');var path=require(_0x8986('0x7'));var rimraf=require(_0x8986('0x8'));var config=require(_0x8986('0x9'));var attributes=require(_0x8986('0xa'));module[_0x8986('0xb')]=function(_0x1ad9a2,_0x4e01d4){return _0x1ad9a2[_0x8986('0xc')](_0x8986('0xd'),attributes,{'tableName':_0x8986('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8986('0xf'),'collate':_0x8986('0x10')});}; \ No newline at end of file +var _0x7d5a=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','chat_internal_messages'];(function(_0x3ee0a7,_0x3c4caa){var _0x26ad58=function(_0x43e903){while(--_0x43e903){_0x3ee0a7['push'](_0x3ee0a7['shift']());}};_0x26ad58(++_0x3c4caa);}(_0x7d5a,0x1bc));var _0xa7d5=function(_0x1cabfe,_0x11df8a){_0x1cabfe=_0x1cabfe-0x0;var _0x468bad=_0x7d5a[_0x1cabfe];return _0x468bad;};'use strict';var _=require(_0xa7d5('0x0'));var util=require(_0xa7d5('0x1'));var logger=require(_0xa7d5('0x2'))(_0xa7d5('0x3'));var moment=require(_0xa7d5('0x4'));var BPromise=require(_0xa7d5('0x5'));var rp=require(_0xa7d5('0x6'));var fs=require('fs');var path=require(_0xa7d5('0x7'));var rimraf=require('rimraf');var config=require(_0xa7d5('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0xa7d5('0x9')]=function(_0x44ab87,_0x12430d){return _0x44ab87['define']('ChatInternalMessage',attributes,{'tableName':_0xa7d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa7d5('0xb'),'collate':_0xa7d5('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3b22496..a395bf0 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 _0xd61f=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x41c66d,_0x512755){var _0x4b3302=function(_0x5e6307){while(--_0x5e6307){_0x41c66d['push'](_0x41c66d['shift']());}};_0x4b3302(++_0x512755);}(_0xd61f,0x1c0));var _0xfd61=function(_0x50f735,_0x300d8d){_0x50f735=_0x50f735-0x0;var _0x18ad1c=_0xd61f[_0x50f735];return _0x18ad1c;};'use strict';var _=require(_0xfd61('0x0'));var util=require(_0xfd61('0x1'));var moment=require(_0xfd61('0x2'));var BPromise=require(_0xfd61('0x3'));var rs=require(_0xfd61('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd61('0x5'))['db'];var utils=require(_0xfd61('0x6'));var logger=require(_0xfd61('0x7'))(_0xfd61('0x8'));var config=require('../../config/environment');var jayson=require(_0xfd61('0x9'));var client=jayson[_0xfd61('0xa')][_0xfd61('0xb')]({'port':0x232a});config[_0xfd61('0xc')]=_['defaults'](config[_0xfd61('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd61('0xd'))(new Redis(config[_0xfd61('0xc')]));require('./chatInternalMessage.socket')[_0xfd61('0xe')](socket);function respondWithRpcPromise(_0x5657ab,_0x5969b1,_0x539647){return new BPromise(function(_0x579572,_0x3d7da0){return client[_0xfd61('0xf')](_0x5657ab,_0x539647)[_0xfd61('0x10')](function(_0x14ea1c){logger[_0xfd61('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x5969b1,_0xfd61('0x12'));logger[_0xfd61('0x13')](_0xfd61('0x14'),_0x5969b1,_0xfd61('0x12'),JSON[_0xfd61('0x15')](_0x14ea1c));if(_0x14ea1c['error']){if(_0x14ea1c[_0xfd61('0x16')][_0xfd61('0x17')]===0x1f4){logger[_0xfd61('0x16')](_0xfd61('0x18'),_0x5969b1,_0x14ea1c[_0xfd61('0x16')][_0xfd61('0x19')]);return _0x3d7da0(_0x14ea1c['error'][_0xfd61('0x19')]);}logger[_0xfd61('0x16')](_0xfd61('0x18'),_0x5969b1,_0x14ea1c['error'][_0xfd61('0x19')]);return _0x579572(_0x14ea1c[_0xfd61('0x16')][_0xfd61('0x19')]);}else{logger[_0xfd61('0x11')](_0xfd61('0x18'),_0x5969b1,_0xfd61('0x12'));_0x579572(_0x14ea1c[_0xfd61('0x1a')][_0xfd61('0x19')]);}})[_0xfd61('0x1b')](function(_0x12d5e6){logger[_0xfd61('0x16')](_0xfd61('0x18'),_0x5969b1,_0x12d5e6);_0x3d7da0(_0x12d5e6);});});} \ No newline at end of file +var _0x754f=['bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','util'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x754f,0x1df));var _0xf754=function(_0x4577e1,_0x40f199){_0x4577e1=_0x4577e1-0x0;var _0x578b7b=_0x754f[_0x4577e1];return _0x578b7b;};'use strict';var _=require('lodash');var util=require(_0xf754('0x0'));var moment=require('moment');var BPromise=require(_0xf754('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf754('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf754('0x3'))(_0xf754('0x4'));var config=require(_0xf754('0x5'));var jayson=require(_0xf754('0x6'));var client=jayson[_0xf754('0x7')]['http']({'port':0x232a});config[_0xf754('0x8')]=_[_0xf754('0x9')](config[_0xf754('0x8')],{'host':_0xf754('0xa'),'port':0x18eb});var socket=require(_0xf754('0xb'))(new Redis(config[_0xf754('0x8')]));require(_0xf754('0xc'))[_0xf754('0xd')](socket);function respondWithRpcPromise(_0x21f33f,_0x3dd883,_0xdcfac0){return new BPromise(function(_0x1ae6d0,_0x1b03dd){return client['request'](_0x21f33f,_0xdcfac0)[_0xf754('0xe')](function(_0x2d95dd){logger[_0xf754('0xf')](_0xf754('0x10'),_0x3dd883,_0xf754('0x11'));logger[_0xf754('0x12')](_0xf754('0x13'),_0x3dd883,_0xf754('0x11'),JSON['stringify'](_0x2d95dd));if(_0x2d95dd[_0xf754('0x14')]){if(_0x2d95dd[_0xf754('0x14')]['code']===0x1f4){logger[_0xf754('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x3dd883,_0x2d95dd['error']['message']);return _0x1b03dd(_0x2d95dd[_0xf754('0x14')]['message']);}logger[_0xf754('0x14')](_0xf754('0x10'),_0x3dd883,_0x2d95dd['error'][_0xf754('0x15')]);return _0x1ae6d0(_0x2d95dd[_0xf754('0x14')][_0xf754('0x15')]);}else{logger[_0xf754('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x3dd883,_0xf754('0x11'));_0x1ae6d0(_0x2d95dd[_0xf754('0x16')][_0xf754('0x15')]);}})[_0xf754('0x17')](function(_0x18d0c7){logger[_0xf754('0x14')](_0xf754('0x10'),_0x3dd883,_0x18d0c7);_0x1b03dd(_0x18d0c7);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c850d73..3af7ec1 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 _0xedd9=['removeListener','register','length','chatInternalMessage:','save','remove','update','emit'];(function(_0x1c14a9,_0x5481a8){var _0x215cf4=function(_0x32b1ef){while(--_0x32b1ef){_0x1c14a9['push'](_0x1c14a9['shift']());}};_0x215cf4(++_0x5481a8);}(_0xedd9,0xfc));var _0x9edd=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0xedd9[_0x1d2bbb];return _0x38082b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){ChatInternalMessageEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);ChatInternalMessageEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file +var _0x33a1=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x5cad16,_0x1d3d20){var _0x3762be=function(_0x6b3cc6){while(--_0x6b3cc6){_0x5cad16['push'](_0x5cad16['shift']());}};_0x3762be(++_0x1d3d20);}(_0x33a1,0x7c));var _0x133a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33a1[_0x20a584];return _0x4b41a8;};'use strict';var ChatInternalMessageEvents=require(_0x133a('0x0'));var events=[_0x133a('0x1'),'remove','update'];function createListener(_0x5dc419,_0x4bcb17){return function(_0x2d6f40){_0x4bcb17[_0x133a('0x2')](_0x5dc419,_0x2d6f40);};}function removeListener(_0x35db62,_0x53da00){return function(){ChatInternalMessageEvents[_0x133a('0x3')](_0x35db62,_0x53da00);};}exports[_0x133a('0x4')]=function(_0x23c48d){for(var _0x557b93=0x0,_0x13fe1d=events[_0x133a('0x5')];_0x557b93<_0x13fe1d;_0x557b93++){var _0x31409d=events[_0x557b93];var _0x5f3a8f=createListener(_0x133a('0x6')+_0x31409d,_0x23c48d);ChatInternalMessageEvents['on'](_0x31409d,_0x5f3a8f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 5b85598..9803043 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 _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(_0x57825b,_0x158953){var _0x501a07=function(_0xac55ce){while(--_0xac55ce){_0x57825b['push'](_0x57825b['shift']());}};_0x501a07(++_0x158953);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file +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(_0x5d6349,_0x3e7d3e){var _0x1efd28=function(_0x512604){while(--_0x512604){_0x5d6349['push'](_0x5d6349['shift']());}};_0x1efd28(++_0x3e7d3e);}(_0x70e0,0x17b));var _0x070e=function(_0x3c087d,_0x32b85a){_0x3c087d=_0x3c087d-0x0;var _0x2638c9=_0x70e0[_0x3c087d];return _0x2638c9;};'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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 61c22dd..d609305 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 _0x55eb=['ENUM','out','DATE','sequelize','TEXT','BOOLEAN'];(function(_0x3667a4,_0x1ff999){var _0x5c8e56=function(_0xbbbe13){while(--_0xbbbe13){_0x3667a4['push'](_0x3667a4['shift']());}};_0x5c8e56(++_0x1ff999);}(_0x55eb,0x171));var _0xb55e=function(_0x43afd6,_0x15f3ee){_0x43afd6=_0x43afd6-0x0;var _0x1f63de=_0x55eb[_0x43afd6];return _0x1f63de;};'use strict';var Sequelize=require(_0xb55e('0x0'));module['exports']={'body':{'type':Sequelize[_0xb55e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb55e('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb55e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb55e('0x3')]('in',_0xb55e('0x4')),'defaultValue':_0xb55e('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb55e('0x5')]}}; \ No newline at end of file +var _0x0abc=['BOOLEAN','ENUM','out','DATE','sequelize','exports','medium'];(function(_0x8fdd92,_0x3abb9c){var _0x2636a6=function(_0x58f214){while(--_0x58f214){_0x8fdd92['push'](_0x8fdd92['shift']());}};_0x2636a6(++_0x3abb9c);}(_0x0abc,0x1af));var _0xc0ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0abc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc0ab('0x0'));module[_0xc0ab('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc0ab('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc0ab('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc0ab('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc0ab('0x4')]('in',_0xc0ab('0x5')),'defaultValue':_0xc0ab('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc0ab('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e72b1a1..9690fea 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 _0xf417=['../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','params','length','include','find','create','body','destroy','describe','../../config/logger','chat-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','user','get','ChatInteraction','UserId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','format','SIP/%s','channel','event','EventManager','parse','formData','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x158262,_0x4e7501){var _0x5e47e5=function(_0x5f1b30){while(--_0x5f1b30){_0x158262['push'](_0x158262['shift']());}};_0x5e47e5(++_0x4e7501);}(_0xf417,0x1e3));var _0x7f41=function(_0x226879,_0x30a56b){_0x226879=_0x226879-0x0;var _0x20964c=_0xf417[_0x226879];return _0x20964c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7f41('0x0'));var rimraf=require(_0x7f41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f41('0x2'));var rp=require(_0x7f41('0x3'));var moment=require(_0x7f41('0x4'));var BPromise=require(_0x7f41('0x5'));var Mustache=require(_0x7f41('0x6'));var util=require('util');var path=require(_0x7f41('0x7'));var sox=require(_0x7f41('0x8'));var csv=require(_0x7f41('0x9'));var ejs=require(_0x7f41('0xa'));var fs=require('fs');var _=require(_0x7f41('0xb'));var squel=require(_0x7f41('0xc'));var crypto=require(_0x7f41('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f41('0xe'));var toCsv=require(_0x7f41('0x9'));var querystring=require(_0x7f41('0xf'));var Papa=require('papaparse');var Redis=require(_0x7f41('0x10'));var authService=require(_0x7f41('0x11'));var qs=require(_0x7f41('0x12'));var as=require(_0x7f41('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f41('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7f41('0x15'))['db'];config['redis']=_['defaults'](config[_0x7f41('0x16')],{'host':_0x7f41('0x17'),'port':0x18eb});var socket=require(_0x7f41('0x18'))(new Redis(config[_0x7f41('0x16')]));require(_0x7f41('0x19'))[_0x7f41('0x1a')](socket);var jayson=require(_0x7f41('0x1b'));var client=jayson[_0x7f41('0x1c')][_0x7f41('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x7f41('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xd041ec,_0x177c8e,_0xe1c17d){if(_0xe1c17d){var _0x4eba46=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4eba46[_0x7f41('0x1e')](_0x177c8e)){return _0xd041ec;}else{throw new db[(_0x7f41('0x1f'))][(_0x7f41('0x20'))](_0x7f41('0x21'));}}else{return _0xd041ec;}}function respondWithRpcPromise(_0x352d2b,_0x581b8c,_0x4a53c2,_0x3c5184){return new BPromise(function(_0x2d7e75,_0x14b1f9){var _0x5bd936=_0x3c5184||client;return _0x5bd936[_0x7f41('0x22')](_0x352d2b,_0x4a53c2)[_0x7f41('0x23')](function(_0x4c6d75){logger[_0x7f41('0x24')](_0x7f41('0x25'),_0x581b8c,_0x7f41('0x26'));logger[_0x7f41('0x27')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x581b8c,_0x7f41('0x26'),JSON[_0x7f41('0x28')](_0x4c6d75));if(_0x4c6d75[_0x7f41('0x29')]){if(_0x4c6d75[_0x7f41('0x29')][_0x7f41('0x2a')]===0x1f4){logger[_0x7f41('0x29')](_0x7f41('0x25'),_0x581b8c,_0x4c6d75[_0x7f41('0x29')][_0x7f41('0x2b')]);return _0x14b1f9(_0x4c6d75[_0x7f41('0x29')][_0x7f41('0x2b')]);}logger[_0x7f41('0x29')](_0x7f41('0x25'),_0x581b8c,_0x4c6d75['error']['message']);return _0x2d7e75(_0x4c6d75[_0x7f41('0x29')][_0x7f41('0x2b')]);}else{logger[_0x7f41('0x24')]('ChatMessage,\x20%s,\x20%s',_0x581b8c,_0x7f41('0x26'));_0x2d7e75(_0x4c6d75['result']['message']);}})[_0x7f41('0x2c')](function(_0x28d2b0){logger['error']('ChatMessage,\x20%s,\x20%s',_0x581b8c,_0x28d2b0);_0x14b1f9(_0x28d2b0);});});}function respondWithStatusCode(_0x519d56,_0x10a21c){_0x10a21c=_0x10a21c||0xcc;return function(_0x245b39){if(_0x245b39){return _0x519d56[_0x7f41('0x2d')](_0x10a21c);}return _0x519d56[_0x7f41('0x2e')](_0x10a21c)[_0x7f41('0x2f')]();};}function respondWithResult(_0x5636f6,_0x485b5e){_0x485b5e=_0x485b5e||0xc8;return function(_0x220b55){if(_0x220b55){return _0x5636f6[_0x7f41('0x2e')](_0x485b5e)[_0x7f41('0x30')](_0x220b55);}};}function respondWithFilteredResult(_0x2443f5,_0x4b7149){return function(_0x144c46){if(_0x144c46){var _0x2d3f3b=_0x144c46[_0x7f41('0x31')],_0x214cd9=_0x4b7149[_0x7f41('0x32')],_0x546792=_0x4b7149[_0x7f41('0x32')]+_0x4b7149[_0x7f41('0x33')],_0x837e99;if(_0x546792>=_0x2d3f3b){_0x546792=_0x2d3f3b;_0x837e99=0xc8;}else{_0x837e99=0xce;}_0x2443f5[_0x7f41('0x2e')](_0x837e99);return _0x2443f5[_0x7f41('0x34')](_0x7f41('0x35'),_0x214cd9+'-'+_0x546792+'/'+_0x2d3f3b)[_0x7f41('0x30')](_0x144c46);}return null;};}function patchUpdates(_0x164b05){return function(_0x34ee76){try{jsonpatch['apply'](_0x34ee76,_0x164b05,!![]);}catch(_0x505267){return BPromise[_0x7f41('0x36')](_0x505267);}return _0x34ee76[_0x7f41('0x37')]();};}function saveUpdates(_0x2c9eff,_0x805e38){return function(_0x17cb99){if(_0x17cb99){return _0x17cb99[_0x7f41('0x38')](_0x2c9eff)[_0x7f41('0x23')](function(_0x7b1341){return _0x7b1341;});}return null;};}function removeEntity(_0x25ec4d,_0x19be02){return function(_0x1127f2){if(_0x1127f2){return _0x1127f2['destroy']()['then'](function(){_0x25ec4d[_0x7f41('0x2e')](0xcc)[_0x7f41('0x2f')]();});}};}function handleEntityNotFound(_0x47697c,_0x196ba2){return function(_0x238f13){if(!_0x238f13){_0x47697c['sendStatus'](0x194);}return _0x238f13;};}function handleError(_0x22c022,_0x45c02c){_0x45c02c=_0x45c02c||0x1f4;return function(_0x4d0ca0){logger['error'](_0x4d0ca0['stack']);if(_0x4d0ca0[_0x7f41('0x39')]){delete _0x4d0ca0[_0x7f41('0x39')];}_0x22c022[_0x7f41('0x2e')](_0x45c02c)[_0x7f41('0x3a')](_0x4d0ca0);};}exports[_0x7f41('0x3b')]=function(_0x51ef89,_0xd83739){var _0xc9308f={},_0x2dfa5e={},_0x24a1d5={'count':0x0,'rows':[]};var _0x5f40ae=_[_0x7f41('0x3c')](db[_0x7f41('0x3d')][_0x7f41('0x3e')],function(_0x491149){return{'name':_0x491149[_0x7f41('0x3f')],'type':_0x491149[_0x7f41('0x40')][_0x7f41('0x41')]};});_0x2dfa5e[_0x7f41('0x42')]=_[_0x7f41('0x3c')](_0x5f40ae,_0x7f41('0x39'));_0x2dfa5e['query']=_[_0x7f41('0x43')](_0x51ef89['query']);_0x2dfa5e[_0x7f41('0x44')]=_[_0x7f41('0x45')](_0x2dfa5e[_0x7f41('0x42')],_0x2dfa5e[_0x7f41('0x46')]);_0xc9308f[_0x7f41('0x47')]=_[_0x7f41('0x45')](_0x2dfa5e[_0x7f41('0x42')],qs[_0x7f41('0x48')](_0x51ef89[_0x7f41('0x46')][_0x7f41('0x48')]));_0xc9308f[_0x7f41('0x47')]=_0xc9308f['attributes']['length']?_0xc9308f[_0x7f41('0x47')]:_0x2dfa5e[_0x7f41('0x42')];if(!_0x51ef89[_0x7f41('0x46')][_0x7f41('0x49')](_0x7f41('0x4a'))){_0xc9308f[_0x7f41('0x33')]=qs[_0x7f41('0x33')](_0x51ef89['query']['limit']);_0xc9308f['offset']=qs[_0x7f41('0x32')](_0x51ef89['query'][_0x7f41('0x32')]);}_0xc9308f[_0x7f41('0x4b')]=qs[_0x7f41('0x4c')](_0x51ef89[_0x7f41('0x46')][_0x7f41('0x4c')]);_0xc9308f[_0x7f41('0x4d')]=qs['filters'](_[_0x7f41('0x4e')](_0x51ef89[_0x7f41('0x46')],_0x2dfa5e[_0x7f41('0x44')]),_0x5f40ae);if(_0x51ef89[_0x7f41('0x46')]['filter']){_0xc9308f[_0x7f41('0x4d')]=_['merge'](_0xc9308f[_0x7f41('0x4d')],{'$or':_[_0x7f41('0x3c')](_0x5f40ae,function(_0x37afdb){if(_0x37afdb['type']!==_0x7f41('0x4f')){var _0x54e943={};_0x54e943[_0x37afdb['name']]={'$like':'%'+_0x51ef89['query'][_0x7f41('0x50')]+'%'};return _0x54e943;}})});}_0xc9308f=_[_0x7f41('0x51')]({},_0xc9308f,_0x51ef89[_0x7f41('0x52')]);var _0xdab2f2={'where':_0xc9308f[_0x7f41('0x4d')]};return db[_0x7f41('0x3d')]['count'](_0xdab2f2)[_0x7f41('0x23')](function(_0x12a713){_0x24a1d5['count']=_0x12a713;if(_0x51ef89['query'][_0x7f41('0x53')]){_0xc9308f['include']=[{'all':!![]}];}return db[_0x7f41('0x3d')][_0x7f41('0x54')](_0xc9308f);})[_0x7f41('0x23')](function(_0x54aaff){_0x24a1d5[_0x7f41('0x55')]=_0x54aaff;return _0x24a1d5;})['then'](respondWithFilteredResult(_0xd83739,_0xc9308f))['catch'](handleError(_0xd83739,null));};exports['show']=function(_0x7eb764,_0x97978b){var _0x562d82={'raw':!![],'where':{'id':_0x7eb764[_0x7f41('0x56')]['id']}},_0x3741a7={};_0x3741a7[_0x7f41('0x42')]=_[_0x7f41('0x43')](db[_0x7f41('0x3d')][_0x7f41('0x3e')]);_0x3741a7[_0x7f41('0x46')]=_[_0x7f41('0x43')](_0x7eb764[_0x7f41('0x46')]);_0x3741a7[_0x7f41('0x44')]=_['intersection'](_0x3741a7[_0x7f41('0x42')],_0x3741a7[_0x7f41('0x46')]);_0x562d82[_0x7f41('0x47')]=_['intersection'](_0x3741a7[_0x7f41('0x42')],qs[_0x7f41('0x48')](_0x7eb764[_0x7f41('0x46')][_0x7f41('0x48')]));_0x562d82['attributes']=_0x562d82[_0x7f41('0x47')][_0x7f41('0x57')]?_0x562d82['attributes']:_0x3741a7[_0x7f41('0x42')];if(_0x7eb764[_0x7f41('0x46')]['includeAll']){_0x562d82[_0x7f41('0x58')]=[{'all':!![]}];}_0x562d82=_[_0x7f41('0x51')]({},_0x562d82,_0x7eb764[_0x7f41('0x52')]);return db[_0x7f41('0x3d')][_0x7f41('0x59')](_0x562d82)[_0x7f41('0x23')](handleEntityNotFound(_0x97978b,null))[_0x7f41('0x23')](respondWithResult(_0x97978b,null))[_0x7f41('0x2c')](handleError(_0x97978b,null));};exports[_0x7f41('0x5a')]=function(_0x1ef582,_0x802fd8){return db[_0x7f41('0x3d')][_0x7f41('0x5a')](_0x1ef582['body'],{})['then'](respondWithResult(_0x802fd8,0xc9))['catch'](handleError(_0x802fd8,null));};exports['update']=function(_0x1d1e82,_0x58d9ec){if(_0x1d1e82['body']['id']){delete _0x1d1e82[_0x7f41('0x5b')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x1d1e82[_0x7f41('0x56')]['id']}})['then'](handleEntityNotFound(_0x58d9ec,null))[_0x7f41('0x23')](saveUpdates(_0x1d1e82[_0x7f41('0x5b')],null))[_0x7f41('0x23')](respondWithResult(_0x58d9ec,null))['catch'](handleError(_0x58d9ec,null));};exports[_0x7f41('0x5c')]=function(_0x1f894b,_0x280c59){return db[_0x7f41('0x3d')][_0x7f41('0x59')]({'where':{'id':_0x1f894b[_0x7f41('0x56')]['id']}})[_0x7f41('0x23')](handleEntityNotFound(_0x280c59,null))['then'](removeEntity(_0x280c59,null))[_0x7f41('0x2c')](handleError(_0x280c59,null));};exports['describe']=function(_0xd5acd5,_0x3bb4c3){return db[_0x7f41('0x3d')][_0x7f41('0x5d')]()[_0x7f41('0x23')](respondWithResult(_0x3bb4c3,null))[_0x7f41('0x2c')](handleError(_0x3bb4c3,null));};var interaction_log=require(_0x7f41('0x5e'))(_0x7f41('0x5f'));exports[_0x7f41('0x60')]=function(_0x5c6bcf,_0xe8a9da,_0x4321c6){var _0x14214e={'channel':'chat'};if(_0x5c6bcf[_0x7f41('0x5b')]['id']){delete _0x5c6bcf[_0x7f41('0x5b')]['id'];}_0x5c6bcf[_0x7f41('0x5b')]['read']=!![];_0x5c6bcf[_0x7f41('0x5b')][_0x7f41('0x61')]=moment()['format'](_0x7f41('0x62'));_0x5c6bcf['body']['UserId']=_0x5c6bcf[_0x7f41('0x5b')]['UserId']||_0x5c6bcf[_0x7f41('0x63')]['id'];return db[_0x7f41('0x3d')][_0x7f41('0x59')]({'where':{'id':_0x5c6bcf['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x7f41('0x23')](handleEntityNotFound(_0xe8a9da,null))[_0x7f41('0x23')](saveUpdates(_0x5c6bcf['body'],null))[_0x7f41('0x23')](function(_0x3b35f4){if(_0x3b35f4){_0x14214e[_0x7f41('0x2b')]=_0x3b35f4[_0x7f41('0x64')]({'plain':!![]});return db[_0x7f41('0x65')][_0x7f41('0x59')]({'where':{'id':_0x3b35f4['ChatInteractionId']}});}return null;})[_0x7f41('0x23')](handleEntityNotFound(_0xe8a9da,null))['then'](function(_0x5351eb){if(_0x5351eb){return _0x5351eb['update']({'UserId':_0x5c6bcf[_0x7f41('0x5b')][_0x7f41('0x66')],'read1stAt':_[_0x7f41('0x67')](_0x5351eb[_0x7f41('0x68')])?moment()['format'](_0x7f41('0x62')):undefined});}return null;})[_0x7f41('0x23')](function(_0x4a5c93){if(_0x4a5c93){_0x14214e[_0x7f41('0x69')]=_0x4a5c93[_0x7f41('0x64')]({'plain':!![]});interaction_log['info'](_0x7f41('0x6a'),_0x5c6bcf['user']['id'],_0x5c6bcf['user'][_0x7f41('0x39')],_0x5c6bcf[_0x7f41('0x63')]['role'],_0x14214e[_0x7f41('0x69')]['id'],_0x5c6bcf[_0x7f41('0x5b')]?JSON['stringify'](_0x5c6bcf[_0x7f41('0x5b')]):_0x7f41('0x6b'));return respondWithRpcPromise(_0x7f41('0x6c'),_0x7f41('0x6d'),_0x14214e);}return null;})[_0x7f41('0x23')](function(_0x42cbb0){if(_0x42cbb0){if(_0x5c6bcf[_0x7f41('0x5b')][_0x7f41('0x6e')]){_0x14214e['message'][_0x7f41('0x6f')]=util[_0x7f41('0x70')](_0x7f41('0x71'),_0x5c6bcf[_0x7f41('0x63')]['name']);_0x14214e['message'][_0x7f41('0x72')]=_0x14214e[_0x7f41('0x72')];_0x14214e[_0x7f41('0x2b')][_0x7f41('0x73')]=_0x7f41('0x60');return respondWithRpcPromise(_0x7f41('0x74'),_0x7f41('0x74'),{'event':'acceptmessage','message':_[_0x7f41('0x51')](_0x14214e[_0x7f41('0x2b')],JSON[_0x7f41('0x75')](_0x14214e['interaction'][_0x7f41('0x76')]))},client9002)[_0x7f41('0x23')](function(){return _0x14214e;});}return _0x14214e;}return null;})['then'](respondWithResult(_0xe8a9da,null))[_0x7f41('0x2c')](handleError(_0xe8a9da,null));};var interaction_log=require(_0x7f41('0x5e'))(_0x7f41('0x5f'));exports[_0x7f41('0x36')]=function(_0x2582c0,_0x512ff3,_0x22b1a4){var _0xe3f205={'agent':{},'channel':'chat'};if(_0x2582c0[_0x7f41('0x5b')]['id']){delete _0x2582c0[_0x7f41('0x5b')]['id'];}_0x2582c0['body'][_0x7f41('0x66')]=_0x2582c0['body'][_0x7f41('0x66')]||_0x2582c0['user']['id'];_0xe3f205[_0x7f41('0x77')]['id']=_0x2582c0[_0x7f41('0x5b')][_0x7f41('0x66')];return db[_0x7f41('0x3d')]['find']({'where':{'id':_0x2582c0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x512ff3,null))['then'](function(_0x55b3d4){if(_0x55b3d4){_0xe3f205['message']=_0x55b3d4['get']({'plain':!![]});return db[_0x7f41('0x65')][_0x7f41('0x59')]({'where':{'id':_0x55b3d4[_0x7f41('0x78')]}});}return null;})[_0x7f41('0x23')](handleEntityNotFound(_0x512ff3,null))['then'](function(_0x548acd){if(_0x548acd){_0xe3f205[_0x7f41('0x69')]=_0x548acd['get']({'plain':!![]});interaction_log['info'](_0x7f41('0x79'),_0x2582c0[_0x7f41('0x63')]['id'],_0x2582c0[_0x7f41('0x63')][_0x7f41('0x39')],_0x2582c0[_0x7f41('0x63')][_0x7f41('0x7a')],_0xe3f205[_0x7f41('0x69')]['id'],_0x2582c0[_0x7f41('0x5b')]?JSON[_0x7f41('0x28')](_0x2582c0['body']):'null');return respondWithRpcPromise(_0x7f41('0x7b'),_0x7f41('0x7c'),_0xe3f205);}return null;})[_0x7f41('0x23')](function(_0x495a4c){if(_0x495a4c){_0x495a4c[_0x7f41('0x2b')]['interface']=util['format']('SIP/%s',_0x2582c0[_0x7f41('0x63')][_0x7f41('0x39')]);_0x495a4c[_0x7f41('0x2b')][_0x7f41('0x72')]=_0xe3f205[_0x7f41('0x72')];_0x495a4c[_0x7f41('0x2b')]['event']=_0x7f41('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0x7f41('0x7d'),'message':_0x495a4c[_0x7f41('0x2b')]},client9002);return _0xe3f205;}return null;})[_0x7f41('0x23')](respondWithResult(_0x512ff3,null))['catch'](handleError(_0x512ff3,null));}; \ No newline at end of file +var _0xf703=['ChatMessage','includeAll','include','findAll','rows','show','keys','fields','length','create','body','find','params','chat-interactions','accept','chat','read','readAt','format','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options'];(function(_0x3de0af,_0x5c9af6){var _0x1203d6=function(_0x1f372a){while(--_0x1f372a){_0x3de0af['push'](_0x3de0af['shift']());}};_0x1203d6(++_0x5c9af6);}(_0xf703,0xab));var _0x3f70=function(_0x231f29,_0x1b0082){_0x231f29=_0x231f29-0x0;var _0x5d48b9=_0xf703[_0x231f29];return _0x5d48b9;};'use strict';var pdf=require(_0x3f70('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f70('0x1'));var zipdir=require(_0x3f70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f70('0x3'));var moment=require(_0x3f70('0x4'));var BPromise=require(_0x3f70('0x5'));var Mustache=require(_0x3f70('0x6'));var util=require(_0x3f70('0x7'));var path=require(_0x3f70('0x8'));var sox=require(_0x3f70('0x9'));var csv=require(_0x3f70('0xa'));var ejs=require(_0x3f70('0xb'));var fs=require('fs');var _=require(_0x3f70('0xc'));var squel=require(_0x3f70('0xd'));var crypto=require(_0x3f70('0xe'));var jsforce=require(_0x3f70('0xf'));var deskjs=require(_0x3f70('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3f70('0x11'));var Papa=require(_0x3f70('0x12'));var Redis=require(_0x3f70('0x13'));var authService=require(_0x3f70('0x14'));var qs=require(_0x3f70('0x15'));var as=require(_0x3f70('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f70('0x17'))(_0x3f70('0x18'));var utils=require(_0x3f70('0x19'));var config=require(_0x3f70('0x1a'));var db=require(_0x3f70('0x1b'))['db'];config[_0x3f70('0x1c')]=_[_0x3f70('0x1d')](config[_0x3f70('0x1c')],{'host':_0x3f70('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f70('0x1c')]));require('./chatMessage.socket')[_0x3f70('0x1f')](socket);var jayson=require(_0x3f70('0x20'));var client=jayson[_0x3f70('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x3f70('0x21')][_0x3f70('0x22')]({'port':0x232a});function checkPasswordPattern(_0x5ab880,_0x44b2ae,_0x13671c){if(_0x13671c){var _0x5c0aa4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c0aa4[_0x3f70('0x23')](_0x44b2ae)){return _0x5ab880;}else{throw new db[(_0x3f70('0x24'))][(_0x3f70('0x25'))](_0x3f70('0x26'));}}else{return _0x5ab880;}}function respondWithRpcPromise(_0x19a429,_0x3cbc75,_0x5e608b,_0x445bc0){return new BPromise(function(_0x56df39,_0x388efa){var _0x327b5b=_0x445bc0||client;return _0x327b5b[_0x3f70('0x27')](_0x19a429,_0x5e608b)[_0x3f70('0x28')](function(_0x4b2b89){logger['info']('ChatMessage,\x20%s,\x20%s',_0x3cbc75,_0x3f70('0x29'));logger[_0x3f70('0x2a')](_0x3f70('0x2b'),_0x3cbc75,_0x3f70('0x29'),JSON[_0x3f70('0x2c')](_0x4b2b89));if(_0x4b2b89[_0x3f70('0x2d')]){if(_0x4b2b89[_0x3f70('0x2d')][_0x3f70('0x2e')]===0x1f4){logger[_0x3f70('0x2d')](_0x3f70('0x2f'),_0x3cbc75,_0x4b2b89[_0x3f70('0x2d')]['message']);return _0x388efa(_0x4b2b89['error']['message']);}logger[_0x3f70('0x2d')](_0x3f70('0x2f'),_0x3cbc75,_0x4b2b89[_0x3f70('0x2d')][_0x3f70('0x30')]);return _0x56df39(_0x4b2b89[_0x3f70('0x2d')][_0x3f70('0x30')]);}else{logger['info'](_0x3f70('0x2f'),_0x3cbc75,_0x3f70('0x29'));_0x56df39(_0x4b2b89[_0x3f70('0x31')][_0x3f70('0x30')]);}})[_0x3f70('0x32')](function(_0xe1a27b){logger[_0x3f70('0x2d')](_0x3f70('0x2f'),_0x3cbc75,_0xe1a27b);_0x388efa(_0xe1a27b);});});}function respondWithStatusCode(_0x4771e2,_0x4875fc){_0x4875fc=_0x4875fc||0xcc;return function(_0x3252ab){if(_0x3252ab){return _0x4771e2['sendStatus'](_0x4875fc);}return _0x4771e2[_0x3f70('0x33')](_0x4875fc)[_0x3f70('0x34')]();};}function respondWithResult(_0x54382c,_0x2b7ef0){_0x2b7ef0=_0x2b7ef0||0xc8;return function(_0x551e21){if(_0x551e21){return _0x54382c['status'](_0x2b7ef0)[_0x3f70('0x35')](_0x551e21);}};}function respondWithFilteredResult(_0x2e96e7,_0x45e60e){return function(_0x268789){if(_0x268789){var _0x30d455=_0x268789[_0x3f70('0x36')],_0x3c73cb=_0x45e60e[_0x3f70('0x37')],_0x22a104=_0x45e60e[_0x3f70('0x37')]+_0x45e60e['limit'],_0x4ef888;if(_0x22a104>=_0x30d455){_0x22a104=_0x30d455;_0x4ef888=0xc8;}else{_0x4ef888=0xce;}_0x2e96e7[_0x3f70('0x33')](_0x4ef888);return _0x2e96e7[_0x3f70('0x38')]('Content-Range',_0x3c73cb+'-'+_0x22a104+'/'+_0x30d455)[_0x3f70('0x35')](_0x268789);}return null;};}function patchUpdates(_0x9de0af){return function(_0x11b9c8){try{jsonpatch[_0x3f70('0x39')](_0x11b9c8,_0x9de0af,!![]);}catch(_0x38ab05){return BPromise[_0x3f70('0x3a')](_0x38ab05);}return _0x11b9c8[_0x3f70('0x3b')]();};}function saveUpdates(_0xf96a5d,_0x41e3f4){return function(_0x330764){if(_0x330764){return _0x330764[_0x3f70('0x3c')](_0xf96a5d)['then'](function(_0x209c9b){return _0x209c9b;});}return null;};}function removeEntity(_0x40dfc4,_0x245d4a){return function(_0x190776){if(_0x190776){return _0x190776[_0x3f70('0x3d')]()['then'](function(){_0x40dfc4['status'](0xcc)[_0x3f70('0x34')]();});}};}function handleEntityNotFound(_0x4caccb,_0x4d4ca6){return function(_0xca9803){if(!_0xca9803){_0x4caccb['sendStatus'](0x194);}return _0xca9803;};}function handleError(_0x5c27d4,_0x4cedf5){_0x4cedf5=_0x4cedf5||0x1f4;return function(_0x4e240a){logger[_0x3f70('0x2d')](_0x4e240a[_0x3f70('0x3e')]);if(_0x4e240a[_0x3f70('0x3f')]){delete _0x4e240a[_0x3f70('0x3f')];}_0x5c27d4['status'](_0x4cedf5)[_0x3f70('0x40')](_0x4e240a);};}exports[_0x3f70('0x41')]=function(_0x15ebb9,_0x5a9034){var _0x248ffb={},_0x1f32b8={},_0x4e3eec={'count':0x0,'rows':[]};var _0x539d54=_[_0x3f70('0x42')](db['ChatMessage'][_0x3f70('0x43')],function(_0x1c1e63){return{'name':_0x1c1e63[_0x3f70('0x44')],'type':_0x1c1e63[_0x3f70('0x45')][_0x3f70('0x46')]};});_0x1f32b8['model']=_['map'](_0x539d54,'name');_0x1f32b8['query']=_['keys'](_0x15ebb9[_0x3f70('0x47')]);_0x1f32b8['filters']=_[_0x3f70('0x48')](_0x1f32b8[_0x3f70('0x49')],_0x1f32b8[_0x3f70('0x47')]);_0x248ffb['attributes']=_['intersection'](_0x1f32b8[_0x3f70('0x49')],qs['fields'](_0x15ebb9[_0x3f70('0x47')]['fields']));_0x248ffb[_0x3f70('0x4a')]=_0x248ffb[_0x3f70('0x4a')]['length']?_0x248ffb['attributes']:_0x1f32b8[_0x3f70('0x49')];if(!_0x15ebb9[_0x3f70('0x47')]['hasOwnProperty'](_0x3f70('0x4b'))){_0x248ffb['limit']=qs[_0x3f70('0x4c')](_0x15ebb9['query'][_0x3f70('0x4c')]);_0x248ffb[_0x3f70('0x37')]=qs['offset'](_0x15ebb9['query'][_0x3f70('0x37')]);}_0x248ffb[_0x3f70('0x4d')]=qs[_0x3f70('0x4e')](_0x15ebb9['query']['sort']);_0x248ffb[_0x3f70('0x4f')]=qs[_0x3f70('0x50')](_['pick'](_0x15ebb9[_0x3f70('0x47')],_0x1f32b8[_0x3f70('0x50')]),_0x539d54);if(_0x15ebb9['query'][_0x3f70('0x51')]){_0x248ffb[_0x3f70('0x4f')]=_[_0x3f70('0x52')](_0x248ffb[_0x3f70('0x4f')],{'$or':_[_0x3f70('0x42')](_0x539d54,function(_0x48a61c){if(_0x48a61c['type']!==_0x3f70('0x53')){var _0x315415={};_0x315415[_0x48a61c['name']]={'$like':'%'+_0x15ebb9[_0x3f70('0x47')][_0x3f70('0x51')]+'%'};return _0x315415;}})});}_0x248ffb=_['merge']({},_0x248ffb,_0x15ebb9[_0x3f70('0x54')]);var _0x180f56={'where':_0x248ffb[_0x3f70('0x4f')]};return db[_0x3f70('0x55')][_0x3f70('0x36')](_0x180f56)['then'](function(_0x512ce0){_0x4e3eec['count']=_0x512ce0;if(_0x15ebb9['query'][_0x3f70('0x56')]){_0x248ffb[_0x3f70('0x57')]=[{'all':!![]}];}return db['ChatMessage'][_0x3f70('0x58')](_0x248ffb);})['then'](function(_0x52948){_0x4e3eec[_0x3f70('0x59')]=_0x52948;return _0x4e3eec;})[_0x3f70('0x28')](respondWithFilteredResult(_0x5a9034,_0x248ffb))[_0x3f70('0x32')](handleError(_0x5a9034,null));};exports[_0x3f70('0x5a')]=function(_0x7a7fcc,_0x12a4d1){var _0x3b34a0={'raw':!![],'where':{'id':_0x7a7fcc['params']['id']}},_0x535649={};_0x535649['model']=_[_0x3f70('0x5b')](db[_0x3f70('0x55')][_0x3f70('0x43')]);_0x535649[_0x3f70('0x47')]=_[_0x3f70('0x5b')](_0x7a7fcc['query']);_0x535649['filters']=_[_0x3f70('0x48')](_0x535649[_0x3f70('0x49')],_0x535649[_0x3f70('0x47')]);_0x3b34a0[_0x3f70('0x4a')]=_[_0x3f70('0x48')](_0x535649[_0x3f70('0x49')],qs['fields'](_0x7a7fcc[_0x3f70('0x47')][_0x3f70('0x5c')]));_0x3b34a0[_0x3f70('0x4a')]=_0x3b34a0['attributes'][_0x3f70('0x5d')]?_0x3b34a0[_0x3f70('0x4a')]:_0x535649[_0x3f70('0x49')];if(_0x7a7fcc[_0x3f70('0x47')]['includeAll']){_0x3b34a0[_0x3f70('0x57')]=[{'all':!![]}];}_0x3b34a0=_[_0x3f70('0x52')]({},_0x3b34a0,_0x7a7fcc[_0x3f70('0x54')]);return db['ChatMessage']['find'](_0x3b34a0)[_0x3f70('0x28')](handleEntityNotFound(_0x12a4d1,null))[_0x3f70('0x28')](respondWithResult(_0x12a4d1,null))['catch'](handleError(_0x12a4d1,null));};exports['create']=function(_0x573002,_0x263ed2){return db[_0x3f70('0x55')][_0x3f70('0x5e')](_0x573002[_0x3f70('0x5f')],{})[_0x3f70('0x28')](respondWithResult(_0x263ed2,0xc9))['catch'](handleError(_0x263ed2,null));};exports[_0x3f70('0x3c')]=function(_0x5407aa,_0x19e13f){if(_0x5407aa['body']['id']){delete _0x5407aa['body']['id'];}return db['ChatMessage'][_0x3f70('0x60')]({'where':{'id':_0x5407aa[_0x3f70('0x61')]['id']}})[_0x3f70('0x28')](handleEntityNotFound(_0x19e13f,null))[_0x3f70('0x28')](saveUpdates(_0x5407aa['body'],null))[_0x3f70('0x28')](respondWithResult(_0x19e13f,null))[_0x3f70('0x32')](handleError(_0x19e13f,null));};exports['destroy']=function(_0x516d4e,_0x5d4661){return db[_0x3f70('0x55')][_0x3f70('0x60')]({'where':{'id':_0x516d4e['params']['id']}})[_0x3f70('0x28')](handleEntityNotFound(_0x5d4661,null))[_0x3f70('0x28')](removeEntity(_0x5d4661,null))[_0x3f70('0x32')](handleError(_0x5d4661,null));};exports['describe']=function(_0x277af6,_0x3df468){return db[_0x3f70('0x55')]['describe']()[_0x3f70('0x28')](respondWithResult(_0x3df468,null))['catch'](handleError(_0x3df468,null));};var interaction_log=require(_0x3f70('0x17'))(_0x3f70('0x62'));exports[_0x3f70('0x63')]=function(_0x315f36,_0xeb400b,_0x398081){var _0x987784={'channel':_0x3f70('0x64')};if(_0x315f36[_0x3f70('0x5f')]['id']){delete _0x315f36[_0x3f70('0x5f')]['id'];}_0x315f36[_0x3f70('0x5f')][_0x3f70('0x65')]=!![];_0x315f36['body'][_0x3f70('0x66')]=moment()[_0x3f70('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x315f36['body'][_0x3f70('0x68')]=_0x315f36[_0x3f70('0x5f')][_0x3f70('0x68')]||_0x315f36['user']['id'];return db[_0x3f70('0x55')][_0x3f70('0x60')]({'where':{'id':_0x315f36['params']['id'],'UserId':null},'include':[{'model':db[_0x3f70('0x69')],'as':_0x3f70('0x6a')}]})[_0x3f70('0x28')](handleEntityNotFound(_0xeb400b,null))[_0x3f70('0x28')](saveUpdates(_0x315f36[_0x3f70('0x5f')],null))[_0x3f70('0x28')](function(_0x5e09ab){if(_0x5e09ab){_0x987784[_0x3f70('0x30')]=_0x5e09ab[_0x3f70('0x6b')]({'plain':!![]});return db[_0x3f70('0x6c')][_0x3f70('0x60')]({'where':{'id':_0x5e09ab[_0x3f70('0x6d')]}});}return null;})[_0x3f70('0x28')](handleEntityNotFound(_0xeb400b,null))[_0x3f70('0x28')](function(_0x22bd9c){if(_0x22bd9c){return _0x22bd9c[_0x3f70('0x3c')]({'UserId':_0x315f36[_0x3f70('0x5f')][_0x3f70('0x68')],'read1stAt':_[_0x3f70('0x6e')](_0x22bd9c['read1stAt'])?moment()[_0x3f70('0x67')](_0x3f70('0x6f')):undefined});}return null;})[_0x3f70('0x28')](function(_0x19f3c8){if(_0x19f3c8){_0x987784[_0x3f70('0x70')]=_0x19f3c8[_0x3f70('0x6b')]({'plain':!![]});interaction_log[_0x3f70('0x71')](_0x3f70('0x72'),_0x315f36['user']['id'],_0x315f36[_0x3f70('0x73')]['name'],_0x315f36['user']['role'],_0x987784[_0x3f70('0x70')]['id'],_0x315f36['body']?JSON[_0x3f70('0x2c')](_0x315f36['body']):_0x3f70('0x74'));return respondWithRpcPromise(_0x3f70('0x75'),_0x3f70('0x76'),_0x987784);}return null;})[_0x3f70('0x28')](function(_0xd563b7){if(_0xd563b7){if(_0x315f36['body'][_0x3f70('0x77')]){_0x987784[_0x3f70('0x30')][_0x3f70('0x78')]=util['format']('SIP/%s',_0x315f36[_0x3f70('0x73')]['name']);_0x987784[_0x3f70('0x30')][_0x3f70('0x79')]=_0x987784['channel'];_0x987784[_0x3f70('0x30')][_0x3f70('0x7a')]=_0x3f70('0x63');return respondWithRpcPromise(_0x3f70('0x7b'),_0x3f70('0x7b'),{'event':_0x3f70('0x7c'),'message':_[_0x3f70('0x52')](_0x987784[_0x3f70('0x30')],JSON['parse'](_0x987784[_0x3f70('0x70')]['formData']))},client9002)['then'](function(){return _0x987784;});}return _0x987784;}return null;})['then'](respondWithResult(_0xeb400b,null))['catch'](handleError(_0xeb400b,null));};var interaction_log=require(_0x3f70('0x17'))(_0x3f70('0x62'));exports[_0x3f70('0x3a')]=function(_0x504262,_0x1db119,_0x420f89){var _0x264603={'agent':{},'channel':'chat'};if(_0x504262[_0x3f70('0x5f')]['id']){delete _0x504262[_0x3f70('0x5f')]['id'];}_0x504262[_0x3f70('0x5f')][_0x3f70('0x68')]=_0x504262[_0x3f70('0x5f')]['UserId']||_0x504262[_0x3f70('0x73')]['id'];_0x264603['agent']['id']=_0x504262[_0x3f70('0x5f')][_0x3f70('0x68')];return db['ChatMessage']['find']({'where':{'id':_0x504262[_0x3f70('0x61')]['id'],'UserId':null}})[_0x3f70('0x28')](handleEntityNotFound(_0x1db119,null))[_0x3f70('0x28')](function(_0x5a859e){if(_0x5a859e){_0x264603[_0x3f70('0x30')]=_0x5a859e[_0x3f70('0x6b')]({'plain':!![]});return db[_0x3f70('0x6c')][_0x3f70('0x60')]({'where':{'id':_0x5a859e[_0x3f70('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x1db119,null))[_0x3f70('0x28')](function(_0x16a3e3){if(_0x16a3e3){_0x264603[_0x3f70('0x70')]=_0x16a3e3['get']({'plain':!![]});interaction_log[_0x3f70('0x71')](_0x3f70('0x7d'),_0x504262['user']['id'],_0x504262[_0x3f70('0x73')][_0x3f70('0x3f')],_0x504262[_0x3f70('0x73')][_0x3f70('0x7e')],_0x264603['interaction']['id'],_0x504262['body']?JSON[_0x3f70('0x2c')](_0x504262['body']):_0x3f70('0x74'));return respondWithRpcPromise('RejectMessage',_0x3f70('0x7f'),_0x264603);}return null;})['then'](function(_0x3e40a6){if(_0x3e40a6){_0x3e40a6['message']['interface']=util['format']('SIP/%s',_0x504262[_0x3f70('0x73')][_0x3f70('0x3f')]);_0x3e40a6[_0x3f70('0x30')][_0x3f70('0x79')]=_0x264603[_0x3f70('0x79')];_0x3e40a6[_0x3f70('0x30')][_0x3f70('0x7a')]=_0x3f70('0x3a');respondWithRpcPromise('EventManager',_0x3f70('0x7b'),{'event':'rejectmessage','message':_0x3e40a6[_0x3f70('0x30')]},client9002);return _0x264603;}return null;})[_0x3f70('0x28')](respondWithResult(_0x1db119,null))['catch'](handleError(_0x1db119,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 762fc86..636eb3c 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 _0xabbe=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0x15883e,_0x1a4df6){var _0x5973ea=function(_0x3c72c3){while(--_0x3c72c3){_0x15883e['push'](_0x15883e['shift']());}};_0x5973ea(++_0x1a4df6);}(_0xabbe,0x147));var _0xeabb=function(_0x221b80,_0x288505){_0x221b80=_0x221b80-0x0;var _0x4dfa0d=_0xabbe[_0x221b80];return _0x4dfa0d;};'use strict';var EventEmitter=require(_0xeabb('0x0'));var ChatMessage=require(_0xeabb('0x1'))['db'][_0xeabb('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xeabb('0x3')](0x0);var events={'afterCreate':_0xeabb('0x4'),'afterUpdate':_0xeabb('0x5'),'afterDestroy':_0xeabb('0x6')};function emitEvent(_0x215af1){return function(_0x5b2a8a,_0x410d43,_0x454b8b){ChatMessageEvents[_0xeabb('0x7')](_0x215af1+':'+_0x5b2a8a['id'],_0x5b2a8a);ChatMessageEvents[_0xeabb('0x7')](_0x215af1,_0x5b2a8a);_0x454b8b(null);};}for(var e in events){if(events[_0xeabb('0x8')](e)){var event=events[e];ChatMessage[_0xeabb('0x9')](e,emitEvent(event));}}module[_0xeabb('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0x485b=['save','emit','hook','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x24682f,_0x30b2d0){var _0x413f07=function(_0x5d6707){while(--_0x5d6707){_0x24682f['push'](_0x24682f['shift']());}};_0x413f07(++_0x30b2d0);}(_0x485b,0xf1));var _0xb485=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x485b[_0x12d033];return _0x3b4e80;};'use strict';var EventEmitter=require(_0xb485('0x0'));var ChatMessage=require(_0xb485('0x1'))['db'][_0xb485('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb485('0x3')](0x0);var events={'afterCreate':_0xb485('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35e270){return function(_0x38e607,_0x66cc30,_0xc06621){ChatMessageEvents['emit'](_0x35e270+':'+_0x38e607['id'],_0x38e607);ChatMessageEvents[_0xb485('0x5')](_0x35e270,_0x38e607);_0xc06621(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xb485('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index cc967bb..f205be1 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 _0x893b=['out','secret','isNil','UserId','ChatInteraction','then','update','createdAt','toLowerCase','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','models','direction'];(function(_0x1de606,_0x2c7427){var _0x15b373=function(_0x497db1){while(--_0x497db1){_0x1de606['push'](_0x1de606['shift']());}};_0x15b373(++_0x2c7427);}(_0x893b,0x93));var _0xb893=function(_0x28e670,_0x5d4122){_0x28e670=_0x28e670-0x0;var _0x444402=_0x893b[_0x28e670];return _0x444402;};'use strict';var _=require('lodash');var util=require(_0xb893('0x0'));var logger=require(_0xb893('0x1'))(_0xb893('0x2'));var moment=require(_0xb893('0x3'));var BPromise=require(_0xb893('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb893('0x5'));var rimraf=require('rimraf');var config=require(_0xb893('0x6'));var attributes=require('./chatMessage.attributes');module[_0xb893('0x7')]=function(_0xd5f45b,_0x5b6955){return _0xd5f45b[_0xb893('0x8')](_0xb893('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xb893('0xa'),'fields':[_0xb893('0xb')],'type':_0xb893('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7b3e57,_0x416533,_0x697731){var _0x2b07da=_0xd5f45b[_0xb893('0xd')];var _0x5eaddd=_0x7b3e57['get']({'plain':!![]});if(_0x5eaddd[_0xb893('0xe')]['toLowerCase']()==='in'||_0x5eaddd[_0xb893('0xe')]['toLowerCase']()===_0xb893('0xf')&&!_0x5eaddd[_0xb893('0x10')]&&!_[_0xb893('0x11')](_0x5eaddd[_0xb893('0x12')])){_0x2b07da[_0xb893('0x13')]['findOne']({'where':{'id':_0x5eaddd['ChatInteractionId']}})[_0xb893('0x14')](function(_0x550a35){if(_0x550a35){_0x550a35[_0xb893('0x15')]({'lastMsgAt':_0x5eaddd[_0xb893('0x16')],'lastMsgDirection':_0x5eaddd[_0xb893('0xe')][_0xb893('0x17')]()});}})['catch'](function(_0xe38fdc){console[_0xb893('0x18')](_0xe38fdc);});}_0x697731();}},'charset':_0xb893('0x19'),'collate':_0xb893('0x1a')});}; \ No newline at end of file +var _0x9118=['UserId','ChatInteraction','ChatInteractionId','update','createdAt','catch','error','utf8mb4','util','api','moment','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x1c0250,_0x340733){var _0x2e73b5=function(_0x555394){while(--_0x555394){_0x1c0250['push'](_0x1c0250['shift']());}};_0x2e73b5(++_0x340733);}(_0x9118,0x181));var _0x8911=function(_0x11c31b,_0xdf1880){_0x11c31b=_0x11c31b-0x0;var _0xd15e8f=_0x9118[_0x11c31b];return _0xd15e8f;};'use strict';var _=require('lodash');var util=require(_0x8911('0x0'));var logger=require('../../config/logger')(_0x8911('0x1'));var moment=require(_0x8911('0x2'));var BPromise=require('bluebird');var rp=require(_0x8911('0x3'));var fs=require('fs');var path=require(_0x8911('0x4'));var rimraf=require('rimraf');var config=require(_0x8911('0x5'));var attributes=require(_0x8911('0x6'));module[_0x8911('0x7')]=function(_0x2638b1,_0x46f982){return _0x2638b1[_0x8911('0x8')](_0x8911('0x9'),attributes,{'tableName':_0x8911('0xa'),'paranoid':![],'indexes':[{'name':_0x8911('0xb'),'fields':[_0x8911('0xc')],'type':_0x8911('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x403dd4,_0x28c04c,_0x491c3c){var _0x4fe645=_0x2638b1[_0x8911('0xe')];var _0x878e=_0x403dd4[_0x8911('0xf')]({'plain':!![]});if(_0x878e['direction']['toLowerCase']()==='in'||_0x878e[_0x8911('0x10')][_0x8911('0x11')]()===_0x8911('0x12')&&!_0x878e[_0x8911('0x13')]&&!_[_0x8911('0x14')](_0x878e[_0x8911('0x15')])){_0x4fe645[_0x8911('0x16')]['findOne']({'where':{'id':_0x878e[_0x8911('0x17')]}})['then'](function(_0x530f8f){if(_0x530f8f){_0x530f8f[_0x8911('0x18')]({'lastMsgAt':_0x878e[_0x8911('0x19')],'lastMsgDirection':_0x878e[_0x8911('0x10')]['toLowerCase']()});}})[_0x8911('0x1a')](function(_0x397d10){console[_0x8911('0x1b')](_0x397d10);});}_0x491c3c();}},'charset':_0x8911('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 88ecdba..0280ad2 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 _0x73af=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x40ca0b,_0x533b66){var _0x7c139f=function(_0x2d8e56){while(--_0x2d8e56){_0x40ca0b['push'](_0x40ca0b['shift']());}};_0x7c139f(++_0x533b66);}(_0x73af,0xde));var _0xf73a=function(_0x2aeca6,_0x565154){_0x2aeca6=_0x2aeca6-0x0;var _0x48c8c9=_0x73af[_0x2aeca6];return _0x48c8c9;};'use strict';var _=require(_0xf73a('0x0'));var util=require(_0xf73a('0x1'));var moment=require(_0xf73a('0x2'));var BPromise=require(_0xf73a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf73a('0x4'))['db'];var utils=require(_0xf73a('0x5'));var logger=require(_0xf73a('0x6'))(_0xf73a('0x7'));var config=require(_0xf73a('0x8'));var jayson=require(_0xf73a('0x9'));var client=jayson[_0xf73a('0xa')]['http']({'port':0x232a});config[_0xf73a('0xb')]=_[_0xf73a('0xc')](config[_0xf73a('0xb')],{'host':_0xf73a('0xd'),'port':0x18eb});var socket=require(_0xf73a('0xe'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xf73a('0xf')](socket);function respondWithRpcPromise(_0x51ad20,_0x5761d0,_0x2918ba){return new BPromise(function(_0x2a753d,_0xa808db){return client[_0xf73a('0x10')](_0x51ad20,_0x2918ba)[_0xf73a('0x11')](function(_0x54c764){logger[_0xf73a('0x12')]('ChatMessage,\x20%s,\x20%s',_0x5761d0,_0xf73a('0x13'));logger['debug'](_0xf73a('0x14'),_0x5761d0,'request\x20sent',JSON[_0xf73a('0x15')](_0x54c764));if(_0x54c764[_0xf73a('0x16')]){if(_0x54c764[_0xf73a('0x16')][_0xf73a('0x17')]===0x1f4){logger['error'](_0xf73a('0x18'),_0x5761d0,_0x54c764[_0xf73a('0x16')][_0xf73a('0x19')]);return _0xa808db(_0x54c764['error']['message']);}logger[_0xf73a('0x16')](_0xf73a('0x18'),_0x5761d0,_0x54c764[_0xf73a('0x16')][_0xf73a('0x19')]);return _0x2a753d(_0x54c764[_0xf73a('0x16')][_0xf73a('0x19')]);}else{logger[_0xf73a('0x12')](_0xf73a('0x18'),_0x5761d0,'request\x20sent');_0x2a753d(_0x54c764[_0xf73a('0x1a')][_0xf73a('0x19')]);}})[_0xf73a('0x1b')](function(_0x2c675d){logger['error'](_0xf73a('0x18'),_0x5761d0,_0x2c675d);_0xa808db(_0x2c675d);});});}exports[_0xf73a('0x1c')]=function(_0x2c16ea){var _0x16268f=this;return new Promise(function(_0x3b8b3f,_0x58de66){return db[_0xf73a('0x1d')][_0xf73a('0x1e')](_0x2c16ea[_0xf73a('0x1f')],{'raw':_0x2c16ea['options']?_0x2c16ea[_0xf73a('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xf73a('0x11')](function(_0x2b13de){logger[_0xf73a('0x12')](_0xf73a('0x1c'),_0x2c16ea);logger['debug'](_0xf73a('0x1c'),_0x2c16ea,JSON['stringify'](_0x2b13de));_0x3b8b3f(_0x2b13de);})[_0xf73a('0x1b')](function(_0x47ada1){logger[_0xf73a('0x16')](_0xf73a('0x1c'),_0x47ada1[_0xf73a('0x19')],_0x2c16ea);_0x58de66(_0x16268f[_0xf73a('0x16')](0x1f4,_0x47ada1[_0xf73a('0x19')]));});});}; \ No newline at end of file +var _0xe674=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xe674,0x7c));var _0x4e67=function(_0x201561,_0x2a8a9a){_0x201561=_0x201561-0x0;var _0x45ed5d=_0xe674[_0x201561];return _0x45ed5d;};'use strict';var _=require(_0x4e67('0x0'));var util=require(_0x4e67('0x1'));var moment=require(_0x4e67('0x2'));var BPromise=require('bluebird');var rs=require(_0x4e67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e67('0x4'));var logger=require(_0x4e67('0x5'))(_0x4e67('0x6'));var config=require(_0x4e67('0x7'));var jayson=require(_0x4e67('0x8'));var client=jayson[_0x4e67('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4e67('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e67('0xb'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x4e67('0xc')](socket);function respondWithRpcPromise(_0x15c4b6,_0x588126,_0x517971){return new BPromise(function(_0x18d2e7,_0x178cd8){return client[_0x4e67('0xd')](_0x15c4b6,_0x517971)[_0x4e67('0xe')](function(_0x28b1ca){logger['info'](_0x4e67('0xf'),_0x588126,_0x4e67('0x10'));logger[_0x4e67('0x11')](_0x4e67('0x12'),_0x588126,_0x4e67('0x10'),JSON['stringify'](_0x28b1ca));if(_0x28b1ca[_0x4e67('0x13')]){if(_0x28b1ca[_0x4e67('0x13')][_0x4e67('0x14')]===0x1f4){logger['error'](_0x4e67('0xf'),_0x588126,_0x28b1ca[_0x4e67('0x13')][_0x4e67('0x15')]);return _0x178cd8(_0x28b1ca[_0x4e67('0x13')]['message']);}logger[_0x4e67('0x13')](_0x4e67('0xf'),_0x588126,_0x28b1ca[_0x4e67('0x13')][_0x4e67('0x15')]);return _0x18d2e7(_0x28b1ca[_0x4e67('0x13')][_0x4e67('0x15')]);}else{logger[_0x4e67('0x16')](_0x4e67('0xf'),_0x588126,'request\x20sent');_0x18d2e7(_0x28b1ca['result'][_0x4e67('0x15')]);}})[_0x4e67('0x17')](function(_0x164878){logger[_0x4e67('0x13')](_0x4e67('0xf'),_0x588126,_0x164878);_0x178cd8(_0x164878);});});}exports[_0x4e67('0x18')]=function(_0x2e3411){var _0x192911=this;return new Promise(function(_0x52406b,_0x2e819f){return db[_0x4e67('0x19')][_0x4e67('0x1a')](_0x2e3411[_0x4e67('0x1b')],{'raw':_0x2e3411[_0x4e67('0x1c')]?_0x2e3411[_0x4e67('0x1c')][_0x4e67('0x1d')]===undefined?!![]:![]:!![]})[_0x4e67('0xe')](function(_0x18e94a){logger[_0x4e67('0x16')](_0x4e67('0x18'),_0x2e3411);logger[_0x4e67('0x11')](_0x4e67('0x18'),_0x2e3411,JSON[_0x4e67('0x1e')](_0x18e94a));_0x52406b(_0x18e94a);})[_0x4e67('0x17')](function(_0x5009c8){logger[_0x4e67('0x13')](_0x4e67('0x18'),_0x5009c8['message'],_0x2e3411);_0x2e819f(_0x192911[_0x4e67('0x13')](0x1f4,_0x5009c8[_0x4e67('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index df64187..966f25a 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 _0x1a37=['remove','update','emit','register','length','./chatMessage.events','save'];(function(_0x383ea3,_0x195733){var _0xe8d22d=function(_0x71c134){while(--_0x71c134){_0x383ea3['push'](_0x383ea3['shift']());}};_0xe8d22d(++_0x195733);}(_0x1a37,0xb4));var _0x71a3=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x1a37[_0x31cb5f];return _0x586042;};'use strict';var ChatMessageEvents=require(_0x71a3('0x0'));var events=[_0x71a3('0x1'),_0x71a3('0x2'),_0x71a3('0x3')];function createListener(_0x353cf0,_0x20d8a7){return function(_0x348395){_0x20d8a7[_0x71a3('0x4')](_0x353cf0,_0x348395);};}function removeListener(_0x29c54f,_0x100181){return function(){ChatMessageEvents['removeListener'](_0x29c54f,_0x100181);};}exports[_0x71a3('0x5')]=function(_0x4f6b7a){for(var _0xd09f7=0x0,_0x45050a=events[_0x71a3('0x6')];_0xd09f7<_0x45050a;_0xd09f7++){var _0x2bb6a2=events[_0xd09f7];var _0x4a9ab2=createListener('chatMessage:'+_0x2bb6a2,_0x4f6b7a);ChatMessageEvents['on'](_0x2bb6a2,_0x4a9ab2);}}; \ No newline at end of file +var _0xeda8=['chatMessage:','./chatMessage.events','save','update','emit','removeListener','register'];(function(_0x26299e,_0x394ad1){var _0x6c4f4a=function(_0x539ae9){while(--_0x539ae9){_0x26299e['push'](_0x26299e['shift']());}};_0x6c4f4a(++_0x394ad1);}(_0xeda8,0x104));var _0x8eda=function(_0x13f5ab,_0xb755ac){_0x13f5ab=_0x13f5ab-0x0;var _0x555003=_0xeda8[_0x13f5ab];return _0x555003;};'use strict';var ChatMessageEvents=require(_0x8eda('0x0'));var events=[_0x8eda('0x1'),'remove',_0x8eda('0x2')];function createListener(_0xd8b5d5,_0x2090a2){return function(_0xc01211){_0x2090a2[_0x8eda('0x3')](_0xd8b5d5,_0xc01211);};}function removeListener(_0x94b83f,_0x25b19a){return function(){ChatMessageEvents[_0x8eda('0x4')](_0x94b83f,_0x25b19a);};}exports[_0x8eda('0x5')]=function(_0x1f3556){for(var _0x349361=0x0,_0x32abe8=events['length'];_0x349361<_0x32abe8;_0x349361++){var _0x28b721=events[_0x349361];var _0x1b6a1d=createListener(_0x8eda('0x6')+_0x28b721,_0x1f3556);ChatMessageEvents['on'](_0x28b721,_0x1b6a1d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c0434e2..12545c7 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 _0xcebc=['get','index','/describe','isAuthenticated','/:id','show','tracked','chat','chatmessage:create','update','/:id/accept','put','/:id/reject','reject','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./chatMessage.controller'];(function(_0x4509cb,_0x192103){var _0x6eb03b=function(_0x573ce2){while(--_0x573ce2){_0x4509cb['push'](_0x4509cb['shift']());}};_0x6eb03b(++_0x192103);}(_0xcebc,0x118));var _0xcceb=function(_0x475084,_0x58b88b){_0x475084=_0x475084-0x0;var _0x13bb11=_0xcebc[_0x475084];return _0x13bb11;};'use strict';var multer=require('multer');var util=require(_0xcceb('0x0'));var path=require(_0xcceb('0x1'));var timeout=require('connect-timeout');var express=require(_0xcceb('0x2'));var router=express['Router']();var auth=require(_0xcceb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcceb('0x4'));var controller=require(_0xcceb('0x5'));router[_0xcceb('0x6')]('/',auth['isAuthenticated'](),controller[_0xcceb('0x7')]);router['get'](_0xcceb('0x8'),auth[_0xcceb('0x9')](),controller['describe']);router[_0xcceb('0x6')](_0xcceb('0xa'),auth[_0xcceb('0x9')](),controller[_0xcceb('0xb')]);router['post']('/',auth[_0xcceb('0x9')](),interaction[_0xcceb('0xc')](_0xcceb('0xd'),_0xcceb('0xe')),controller['create']);router['put']('/:id',controller[_0xcceb('0xf')]);router['put'](_0xcceb('0x10'),auth[_0xcceb('0x9')](),controller['accept']);router[_0xcceb('0x11')](_0xcceb('0x12'),auth[_0xcceb('0x9')](),controller[_0xcceb('0x13')]);router[_0xcceb('0x14')](_0xcceb('0xa'),auth[_0xcceb('0x9')](),controller['destroy']);module[_0xcceb('0x15')]=router; \ No newline at end of file +var _0x089e=['create','/:id/accept','accept','put','/:id/reject','reject','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','chatmessage:create'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x089e,0x96));var _0xe089=function(_0x394142,_0x435819){_0x394142=_0x394142-0x0;var _0x1b04e0=_0x089e[_0x394142];return _0x1b04e0;};'use strict';var multer=require(_0xe089('0x0'));var util=require('util');var path=require(_0xe089('0x1'));var timeout=require('connect-timeout');var express=require(_0xe089('0x2'));var router=express[_0xe089('0x3')]();var auth=require(_0xe089('0x4'));var interaction=require(_0xe089('0x5'));var config=require(_0xe089('0x6'));var controller=require(_0xe089('0x7'));router[_0xe089('0x8')]('/',auth[_0xe089('0x9')](),controller[_0xe089('0xa')]);router['get'](_0xe089('0xb'),auth['isAuthenticated'](),controller[_0xe089('0xc')]);router[_0xe089('0x8')](_0xe089('0xd'),auth['isAuthenticated'](),controller[_0xe089('0xe')]);router[_0xe089('0xf')]('/',auth[_0xe089('0x9')](),interaction['tracked'](_0xe089('0x10'),_0xe089('0x11')),controller[_0xe089('0x12')]);router['put'](_0xe089('0xd'),controller['update']);router['put'](_0xe089('0x13'),auth[_0xe089('0x9')](),controller[_0xe089('0x14')]);router[_0xe089('0x15')](_0xe089('0x16'),auth[_0xe089('0x9')](),controller[_0xe089('0x17')]);router['delete'](_0xe089('0xd'),auth[_0xe089('0x9')](),controller['destroy']);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 4beb44c..0b6e88c 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 _0x232e=['medium','sequelize','exports'];(function(_0x2fa2d6,_0x5d7dc8){var _0x3eb8ab=function(_0x23081f){while(--_0x23081f){_0x2fa2d6['push'](_0x2fa2d6['shift']());}};_0x3eb8ab(++_0x5d7dc8);}(_0x232e,0x157));var _0xe232=function(_0xd01860,_0x25a076){_0xd01860=_0xd01860-0x0;var _0xaa69d8=_0x232e[_0xd01860];return _0xaa69d8;};'use strict';var Sequelize=require(_0xe232('0x0'));module[_0xe232('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe232('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x0203=['exports','TEXT','medium','sequelize'];(function(_0x2b0f37,_0x461185){var _0x1d1ccc=function(_0x50e4b7){while(--_0x50e4b7){_0x2b0f37['push'](_0x2b0f37['shift']());}};_0x1d1ccc(++_0x461185);}(_0x0203,0x1af));var _0x3020=function(_0x20f611,_0x8ed86f){_0x20f611=_0x20f611-0x0;var _0x559a83=_0x0203[_0x20f611];return _0x559a83;};'use strict';var Sequelize=require(_0x3020('0x0'));module[_0x3020('0x1')]={'body':{'type':Sequelize[_0x3020('0x2')](_0x3020('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 4893aeb..53e08e2 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 _0x46ed=['sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','ChatOfflineMessage','includeAll','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x17a64a,_0x56da19){var _0x3089f3=function(_0x2e8866){while(--_0x2e8866){_0x17a64a['push'](_0x17a64a['shift']());}};_0x3089f3(++_0x56da19);}(_0x46ed,0x168));var _0xd46e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x46ed[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0xd46e('0x0'));var emlformat=require(_0xd46e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd46e('0x2'));var jsonpatch=require(_0xd46e('0x3'));var rp=require(_0xd46e('0x4'));var moment=require('moment');var BPromise=require(_0xd46e('0x5'));var Mustache=require(_0xd46e('0x6'));var util=require('util');var path=require(_0xd46e('0x7'));var sox=require(_0xd46e('0x8'));var csv=require(_0xd46e('0x9'));var ejs=require(_0xd46e('0xa'));var fs=require('fs');var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x9'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24c54b,_0x5bc1da){_0x5bc1da=_0x5bc1da||0xcc;return function(_0x48550b){if(_0x48550b){return _0x24c54b[_0xd46e('0x19')](_0x5bc1da);}return _0x24c54b[_0xd46e('0x1a')](_0x5bc1da)['end']();};}function respondWithResult(_0x5a3076,_0xacd799){_0xacd799=_0xacd799||0xc8;return function(_0x4688ae){if(_0x4688ae){return _0x5a3076[_0xd46e('0x1a')](_0xacd799)[_0xd46e('0x1b')](_0x4688ae);}};}function respondWithFilteredResult(_0x50c7c3,_0x3b6d25){return function(_0x44a620){if(_0x44a620){var _0x417402=_0x44a620[_0xd46e('0x1c')],_0x3d72ce=_0x3b6d25[_0xd46e('0x1d')],_0x36a317=_0x3b6d25[_0xd46e('0x1d')]+_0x3b6d25['limit'],_0x47fa8f;if(_0x36a317>=_0x417402){_0x36a317=_0x417402;_0x47fa8f=0xc8;}else{_0x47fa8f=0xce;}_0x50c7c3['status'](_0x47fa8f);return _0x50c7c3[_0xd46e('0x1e')](_0xd46e('0x1f'),_0x3d72ce+'-'+_0x36a317+'/'+_0x417402)['json'](_0x44a620);}return null;};}function patchUpdates(_0x4fd1f2){return function(_0x2d6f2c){try{jsonpatch[_0xd46e('0x20')](_0x2d6f2c,_0x4fd1f2,!![]);}catch(_0x362885){return BPromise[_0xd46e('0x21')](_0x362885);}return _0x2d6f2c[_0xd46e('0x22')]();};}function saveUpdates(_0x312d6f,_0x3b5fa4){return function(_0x327b7e){if(_0x327b7e){return _0x327b7e[_0xd46e('0x23')](_0x312d6f)[_0xd46e('0x24')](function(_0x468aba){return _0x468aba;});}return null;};}function removeEntity(_0x5ba94d,_0x259072){return function(_0x1c83fa){if(_0x1c83fa){return _0x1c83fa[_0xd46e('0x25')]()[_0xd46e('0x24')](function(){_0x5ba94d[_0xd46e('0x1a')](0xcc)[_0xd46e('0x26')]();});}};}function handleEntityNotFound(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(!_0x62dea5){_0x33c2e0['sendStatus'](0x194);}return _0x62dea5;};}function handleError(_0x314570,_0x5424e5){_0x5424e5=_0x5424e5||0x1f4;return function(_0x4b8f6a){logger[_0xd46e('0x27')](_0x4b8f6a[_0xd46e('0x28')]);if(_0x4b8f6a[_0xd46e('0x29')]){delete _0x4b8f6a[_0xd46e('0x29')];}_0x314570[_0xd46e('0x1a')](_0x5424e5)[_0xd46e('0x2a')](_0x4b8f6a);};}exports[_0xd46e('0x2b')]=function(_0x4dab6a,_0x45d789){var _0x3c301a={},_0xddbce9={},_0x17db79={'count':0x0,'rows':[]};var _0x96f15c=_[_0xd46e('0x2c')](db['ChatOfflineMessage'][_0xd46e('0x2d')],function(_0x3a1ced){return{'name':_0x3a1ced[_0xd46e('0x2e')],'type':_0x3a1ced[_0xd46e('0x2f')][_0xd46e('0x30')]};});_0xddbce9[_0xd46e('0x31')]=_[_0xd46e('0x2c')](_0x96f15c,_0xd46e('0x29'));_0xddbce9[_0xd46e('0x32')]=_[_0xd46e('0x33')](_0x4dab6a[_0xd46e('0x32')]);_0xddbce9[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0xddbce9['model'],_0xddbce9[_0xd46e('0x32')]);_0x3c301a[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0xddbce9[_0xd46e('0x31')],qs['fields'](_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x37')]));_0x3c301a['attributes']=_0x3c301a[_0xd46e('0x36')][_0xd46e('0x38')]?_0x3c301a['attributes']:_0xddbce9[_0xd46e('0x31')];if(!_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x39')]('nolimit')){_0x3c301a['limit']=qs[_0xd46e('0x3a')](_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x3a')]);_0x3c301a[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x1d')]);}_0x3c301a[_0xd46e('0x3b')]=qs['sort'](_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x3c')]);_0x3c301a[_0xd46e('0x3d')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3e')](_0x4dab6a[_0xd46e('0x32')],_0xddbce9[_0xd46e('0x34')]),_0x96f15c);if(_0x4dab6a['query'][_0xd46e('0x3f')]){_0x3c301a[_0xd46e('0x3d')]=_['merge'](_0x3c301a[_0xd46e('0x3d')],{'$or':_[_0xd46e('0x2c')](_0x96f15c,function(_0x12ccf8){if(_0x12ccf8[_0xd46e('0x2f')]!=='VIRTUAL'){var _0x3ab607={};_0x3ab607[_0x12ccf8[_0xd46e('0x29')]]={'$like':'%'+_0x4dab6a[_0xd46e('0x32')][_0xd46e('0x3f')]+'%'};return _0x3ab607;}})});}_0x3c301a=_[_0xd46e('0x40')]({},_0x3c301a,_0x4dab6a[_0xd46e('0x41')]);var _0x220c57={'where':_0x3c301a[_0xd46e('0x3d')]};return db['ChatOfflineMessage'][_0xd46e('0x1c')](_0x220c57)[_0xd46e('0x24')](function(_0xc83ea1){_0x17db79[_0xd46e('0x1c')]=_0xc83ea1;if(_0x4dab6a[_0xd46e('0x32')]['includeAll']){_0x3c301a[_0xd46e('0x42')]=[{'all':!![]}];}return db['ChatOfflineMessage']['findAll'](_0x3c301a);})['then'](function(_0x55098d){_0x17db79[_0xd46e('0x43')]=_0x55098d;return _0x17db79;})['then'](respondWithFilteredResult(_0x45d789,_0x3c301a))[_0xd46e('0x44')](handleError(_0x45d789,null));};exports[_0xd46e('0x45')]=function(_0x57f803,_0x462477){var _0x4114e6={'raw':!![],'where':{'id':_0x57f803[_0xd46e('0x46')]['id']}},_0x3bd5e9={};_0x3bd5e9[_0xd46e('0x31')]=_[_0xd46e('0x33')](db[_0xd46e('0x47')][_0xd46e('0x2d')]);_0x3bd5e9[_0xd46e('0x32')]=_[_0xd46e('0x33')](_0x57f803[_0xd46e('0x32')]);_0x3bd5e9['filters']=_['intersection'](_0x3bd5e9['model'],_0x3bd5e9[_0xd46e('0x32')]);_0x4114e6['attributes']=_[_0xd46e('0x35')](_0x3bd5e9[_0xd46e('0x31')],qs[_0xd46e('0x37')](_0x57f803[_0xd46e('0x32')][_0xd46e('0x37')]));_0x4114e6[_0xd46e('0x36')]=_0x4114e6[_0xd46e('0x36')][_0xd46e('0x38')]?_0x4114e6['attributes']:_0x3bd5e9[_0xd46e('0x31')];if(_0x57f803['query'][_0xd46e('0x48')]){_0x4114e6[_0xd46e('0x42')]=[{'all':!![]}];}_0x4114e6=_[_0xd46e('0x40')]({},_0x4114e6,_0x57f803[_0xd46e('0x41')]);return db[_0xd46e('0x47')]['find'](_0x4114e6)[_0xd46e('0x24')](handleEntityNotFound(_0x462477,null))[_0xd46e('0x24')](respondWithResult(_0x462477,null))[_0xd46e('0x44')](handleError(_0x462477,null));};exports[_0xd46e('0x49')]=function(_0x2f1278,_0x587784){return db[_0xd46e('0x47')][_0xd46e('0x49')](_0x2f1278[_0xd46e('0x4a')],{})[_0xd46e('0x24')](respondWithResult(_0x587784,0xc9))[_0xd46e('0x44')](handleError(_0x587784,null));};exports['update']=function(_0x341d9f,_0x3ea9e6){if(_0x341d9f[_0xd46e('0x4a')]['id']){delete _0x341d9f[_0xd46e('0x4a')]['id'];}return db[_0xd46e('0x47')][_0xd46e('0x4b')]({'where':{'id':_0x341d9f[_0xd46e('0x46')]['id']}})[_0xd46e('0x24')](handleEntityNotFound(_0x3ea9e6,null))['then'](saveUpdates(_0x341d9f[_0xd46e('0x4a')],null))[_0xd46e('0x24')](respondWithResult(_0x3ea9e6,null))[_0xd46e('0x44')](handleError(_0x3ea9e6,null));};exports[_0xd46e('0x25')]=function(_0x1f1941,_0x4e84c8){return db['ChatOfflineMessage'][_0xd46e('0x4b')]({'where':{'id':_0x1f1941[_0xd46e('0x46')]['id']}})[_0xd46e('0x24')](handleEntityNotFound(_0x4e84c8,null))['then'](removeEntity(_0x4e84c8,null))['catch'](handleError(_0x4e84c8,null));};exports[_0xd46e('0x4c')]=function(_0x9d8638,_0x52354f){return db[_0xd46e('0x47')][_0xd46e('0x4c')]()[_0xd46e('0x24')](respondWithResult(_0x52354f,null))[_0xd46e('0x44')](handleError(_0x52354f,null));}; \ No newline at end of file +var _0xdc97=['map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','filters','find','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','name'];(function(_0x2cf0f9,_0x4dcc70){var _0x4e6ca3=function(_0x20ca04){while(--_0x20ca04){_0x2cf0f9['push'](_0x2cf0f9['shift']());}};_0x4e6ca3(++_0x4dcc70);}(_0xdc97,0x13b));var _0x7dc9=function(_0x40d075,_0x5394b0){_0x40d075=_0x40d075-0x0;var _0x4e2743=_0xdc97[_0x40d075];return _0x4e2743;};'use strict';var pdf=require(_0x7dc9('0x0'));var emlformat=require(_0x7dc9('0x1'));var rimraf=require(_0x7dc9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7dc9('0x3'));var rp=require('request-promise');var moment=require(_0x7dc9('0x4'));var BPromise=require(_0x7dc9('0x5'));var Mustache=require('mustache');var util=require(_0x7dc9('0x6'));var path=require(_0x7dc9('0x7'));var sox=require(_0x7dc9('0x8'));var csv=require(_0x7dc9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x9'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4be1c8,_0x599ef1){_0x599ef1=_0x599ef1||0xcc;return function(_0x94c75a){if(_0x94c75a){return _0x4be1c8[_0x7dc9('0x16')](_0x599ef1);}return _0x4be1c8['status'](_0x599ef1)[_0x7dc9('0x17')]();};}function respondWithResult(_0x2f3acd,_0xaadf2){_0xaadf2=_0xaadf2||0xc8;return function(_0xf37bc7){if(_0xf37bc7){return _0x2f3acd[_0x7dc9('0x18')](_0xaadf2)[_0x7dc9('0x19')](_0xf37bc7);}};}function respondWithFilteredResult(_0x524d09,_0x3a54f2){return function(_0x278191){if(_0x278191){var _0x1b0aa1=_0x278191[_0x7dc9('0x1a')],_0x442819=_0x3a54f2[_0x7dc9('0x1b')],_0x11606f=_0x3a54f2[_0x7dc9('0x1b')]+_0x3a54f2['limit'],_0xbe0437;if(_0x11606f>=_0x1b0aa1){_0x11606f=_0x1b0aa1;_0xbe0437=0xc8;}else{_0xbe0437=0xce;}_0x524d09[_0x7dc9('0x18')](_0xbe0437);return _0x524d09['set'](_0x7dc9('0x1c'),_0x442819+'-'+_0x11606f+'/'+_0x1b0aa1)[_0x7dc9('0x19')](_0x278191);}return null;};}function patchUpdates(_0x5d61d7){return function(_0x41f66e){try{jsonpatch[_0x7dc9('0x1d')](_0x41f66e,_0x5d61d7,!![]);}catch(_0x12f08d){return BPromise[_0x7dc9('0x1e')](_0x12f08d);}return _0x41f66e[_0x7dc9('0x1f')]();};}function saveUpdates(_0x184bfd,_0x2dad65){return function(_0x2895f5){if(_0x2895f5){return _0x2895f5[_0x7dc9('0x20')](_0x184bfd)[_0x7dc9('0x21')](function(_0x576681){return _0x576681;});}return null;};}function removeEntity(_0x593e60,_0x12954f){return function(_0x5981e2){if(_0x5981e2){return _0x5981e2['destroy']()[_0x7dc9('0x21')](function(){_0x593e60[_0x7dc9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xffc080,_0x43d31f){return function(_0x41110a){if(!_0x41110a){_0xffc080['sendStatus'](0x194);}return _0x41110a;};}function handleError(_0x424763,_0x1e3a8d){_0x1e3a8d=_0x1e3a8d||0x1f4;return function(_0xf95336){logger['error'](_0xf95336['stack']);if(_0xf95336['name']){delete _0xf95336[_0x7dc9('0x22')];}_0x424763[_0x7dc9('0x18')](_0x1e3a8d)['send'](_0xf95336);};}exports['index']=function(_0x47771b,_0x5afb7d){var _0x2d22eb={},_0x1c690b={},_0x3a74a0={'count':0x0,'rows':[]};var _0x3e4102=_[_0x7dc9('0x23')](db[_0x7dc9('0x24')][_0x7dc9('0x25')],function(_0x229f8e){return{'name':_0x229f8e[_0x7dc9('0x26')],'type':_0x229f8e[_0x7dc9('0x27')][_0x7dc9('0x28')]};});_0x1c690b[_0x7dc9('0x29')]=_['map'](_0x3e4102,'name');_0x1c690b['query']=_['keys'](_0x47771b['query']);_0x1c690b['filters']=_['intersection'](_0x1c690b['model'],_0x1c690b[_0x7dc9('0x2a')]);_0x2d22eb[_0x7dc9('0x2b')]=_[_0x7dc9('0x2c')](_0x1c690b[_0x7dc9('0x29')],qs[_0x7dc9('0x2d')](_0x47771b[_0x7dc9('0x2a')]['fields']));_0x2d22eb['attributes']=_0x2d22eb['attributes'][_0x7dc9('0x2e')]?_0x2d22eb['attributes']:_0x1c690b[_0x7dc9('0x29')];if(!_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x2f')](_0x7dc9('0x30'))){_0x2d22eb[_0x7dc9('0x31')]=qs[_0x7dc9('0x31')](_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x31')]);_0x2d22eb['offset']=qs[_0x7dc9('0x1b')](_0x47771b['query'][_0x7dc9('0x1b')]);}_0x2d22eb[_0x7dc9('0x32')]=qs[_0x7dc9('0x33')](_0x47771b[_0x7dc9('0x2a')]['sort']);_0x2d22eb[_0x7dc9('0x34')]=qs['filters'](_[_0x7dc9('0x35')](_0x47771b['query'],_0x1c690b['filters']),_0x3e4102);if(_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x36')]){_0x2d22eb[_0x7dc9('0x34')]=_[_0x7dc9('0x37')](_0x2d22eb['where'],{'$or':_[_0x7dc9('0x23')](_0x3e4102,function(_0x183d87){if(_0x183d87[_0x7dc9('0x27')]!==_0x7dc9('0x38')){var _0x4290b9={};_0x4290b9[_0x183d87[_0x7dc9('0x22')]]={'$like':'%'+_0x47771b[_0x7dc9('0x2a')][_0x7dc9('0x36')]+'%'};return _0x4290b9;}})});}_0x2d22eb=_[_0x7dc9('0x37')]({},_0x2d22eb,_0x47771b[_0x7dc9('0x39')]);var _0x452aed={'where':_0x2d22eb[_0x7dc9('0x34')]};return db['ChatOfflineMessage'][_0x7dc9('0x1a')](_0x452aed)[_0x7dc9('0x21')](function(_0x466b02){_0x3a74a0[_0x7dc9('0x1a')]=_0x466b02;if(_0x47771b['query'][_0x7dc9('0x3a')]){_0x2d22eb[_0x7dc9('0x3b')]=[{'all':!![]}];}return db[_0x7dc9('0x24')][_0x7dc9('0x3c')](_0x2d22eb);})[_0x7dc9('0x21')](function(_0x3436a6){_0x3a74a0['rows']=_0x3436a6;return _0x3a74a0;})['then'](respondWithFilteredResult(_0x5afb7d,_0x2d22eb))[_0x7dc9('0x3d')](handleError(_0x5afb7d,null));};exports[_0x7dc9('0x3e')]=function(_0x495100,_0x3a705c){var _0x4a37ec={'raw':!![],'where':{'id':_0x495100[_0x7dc9('0x3f')]['id']}},_0x315d65={};_0x315d65[_0x7dc9('0x29')]=_['keys'](db[_0x7dc9('0x24')][_0x7dc9('0x25')]);_0x315d65[_0x7dc9('0x2a')]=_[_0x7dc9('0x40')](_0x495100[_0x7dc9('0x2a')]);_0x315d65[_0x7dc9('0x41')]=_[_0x7dc9('0x2c')](_0x315d65['model'],_0x315d65[_0x7dc9('0x2a')]);_0x4a37ec['attributes']=_['intersection'](_0x315d65[_0x7dc9('0x29')],qs[_0x7dc9('0x2d')](_0x495100[_0x7dc9('0x2a')][_0x7dc9('0x2d')]));_0x4a37ec[_0x7dc9('0x2b')]=_0x4a37ec[_0x7dc9('0x2b')][_0x7dc9('0x2e')]?_0x4a37ec[_0x7dc9('0x2b')]:_0x315d65[_0x7dc9('0x29')];if(_0x495100['query'][_0x7dc9('0x3a')]){_0x4a37ec[_0x7dc9('0x3b')]=[{'all':!![]}];}_0x4a37ec=_[_0x7dc9('0x37')]({},_0x4a37ec,_0x495100[_0x7dc9('0x39')]);return db[_0x7dc9('0x24')][_0x7dc9('0x42')](_0x4a37ec)['then'](handleEntityNotFound(_0x3a705c,null))[_0x7dc9('0x21')](respondWithResult(_0x3a705c,null))[_0x7dc9('0x3d')](handleError(_0x3a705c,null));};exports['create']=function(_0x288c80,_0x1f7700){return db[_0x7dc9('0x24')]['create'](_0x288c80[_0x7dc9('0x43')],{})['then'](respondWithResult(_0x1f7700,0xc9))['catch'](handleError(_0x1f7700,null));};exports[_0x7dc9('0x20')]=function(_0x30a315,_0x36d591){if(_0x30a315['body']['id']){delete _0x30a315['body']['id'];}return db[_0x7dc9('0x24')]['find']({'where':{'id':_0x30a315[_0x7dc9('0x3f')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x36d591,null))['then'](saveUpdates(_0x30a315[_0x7dc9('0x43')],null))[_0x7dc9('0x21')](respondWithResult(_0x36d591,null))[_0x7dc9('0x3d')](handleError(_0x36d591,null));};exports[_0x7dc9('0x44')]=function(_0x414bf4,_0x113087){return db[_0x7dc9('0x24')][_0x7dc9('0x42')]({'where':{'id':_0x414bf4[_0x7dc9('0x3f')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x113087,null))[_0x7dc9('0x21')](removeEntity(_0x113087,null))[_0x7dc9('0x3d')](handleError(_0x113087,null));};exports[_0x7dc9('0x45')]=function(_0x59be9b,_0x3132b1){return db['ChatOfflineMessage']['describe']()[_0x7dc9('0x21')](respondWithResult(_0x3132b1,null))[_0x7dc9('0x3d')](handleError(_0x3132b1,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a741d59..c546683 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 _0x965d=['request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','util','api','bluebird'];(function(_0x3b40b4,_0xd89aa3){var _0x3626e2=function(_0x308de6){while(--_0x308de6){_0x3b40b4['push'](_0x3b40b4['shift']());}};_0x3626e2(++_0xd89aa3);}(_0x965d,0x176));var _0xd965=function(_0x55c1c6,_0x3edfe1){_0x55c1c6=_0x55c1c6-0x0;var _0x4730e1=_0x965d[_0x55c1c6];return _0x4730e1;};'use strict';var _=require('lodash');var util=require(_0xd965('0x0'));var logger=require('../../config/logger')(_0xd965('0x1'));var moment=require('moment');var BPromise=require(_0xd965('0x2'));var rp=require(_0xd965('0x3'));var fs=require('fs');var path=require(_0xd965('0x4'));var rimraf=require(_0xd965('0x5'));var config=require(_0xd965('0x6'));var attributes=require(_0xd965('0x7'));module[_0xd965('0x8')]=function(_0x35dea0,_0x231b42){return _0x35dea0[_0xd965('0x9')](_0xd965('0xa'),attributes,{'tableName':_0xd965('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd965('0xc')});}; \ No newline at end of file +var _0xb323=['./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb323,0xe1));var _0x3b32=function(_0x232af3,_0x42ad2c){_0x232af3=_0x232af3-0x0;var _0x3f4556=_0xb323[_0x232af3];return _0x3f4556;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3b32('0x0'));var moment=require(_0x3b32('0x1'));var BPromise=require(_0x3b32('0x2'));var rp=require(_0x3b32('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b32('0x4'));var config=require(_0x3b32('0x5'));var attributes=require(_0x3b32('0x6'));module['exports']=function(_0x50be77,_0x9af692){return _0x50be77['define'](_0x3b32('0x7'),attributes,{'tableName':_0x3b32('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b32('0x9'),'collate':_0x3b32('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0b88d84..1200e1c 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 _0x8d80=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8d80,0x1cc));var _0x08d8=function(_0x55cf7a,_0x3e6bc5){_0x55cf7a=_0x55cf7a-0x0;var _0x3b79f2=_0x8d80[_0x55cf7a];return _0x3b79f2;};'use strict';var _=require('lodash');var util=require(_0x08d8('0x0'));var moment=require('moment');var BPromise=require(_0x08d8('0x1'));var rs=require(_0x08d8('0x2'));var fs=require('fs');var Redis=require(_0x08d8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x08d8('0x4'));var logger=require(_0x08d8('0x5'))(_0x08d8('0x6'));var config=require('../../config/environment');var jayson=require(_0x08d8('0x7'));var client=jayson[_0x08d8('0x8')][_0x08d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b4933,_0x516ab2,_0x5005b4){return new BPromise(function(_0x2b7d2c,_0x4052c7){return client[_0x08d8('0xa')](_0x5b4933,_0x5005b4)['then'](function(_0x1a06de){logger[_0x08d8('0xb')](_0x08d8('0xc'),_0x516ab2,'request\x20sent');logger[_0x08d8('0xd')](_0x08d8('0xe'),_0x516ab2,_0x08d8('0xf'),JSON[_0x08d8('0x10')](_0x1a06de));if(_0x1a06de[_0x08d8('0x11')]){if(_0x1a06de[_0x08d8('0x11')][_0x08d8('0x12')]===0x1f4){logger[_0x08d8('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x516ab2,_0x1a06de[_0x08d8('0x11')][_0x08d8('0x13')]);return _0x4052c7(_0x1a06de[_0x08d8('0x11')][_0x08d8('0x13')]);}logger[_0x08d8('0x11')](_0x08d8('0xc'),_0x516ab2,_0x1a06de['error'][_0x08d8('0x13')]);return _0x2b7d2c(_0x1a06de[_0x08d8('0x11')]['message']);}else{logger[_0x08d8('0xb')](_0x08d8('0xc'),_0x516ab2,_0x08d8('0xf'));_0x2b7d2c(_0x1a06de[_0x08d8('0x14')]['message']);}})[_0x08d8('0x15')](function(_0x591142){logger['error'](_0x08d8('0xc'),_0x516ab2,_0x591142);_0x4052c7(_0x591142);});});} \ No newline at end of file +var _0x10df=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x10df,0x7f));var _0xf10d=function(_0x3733eb,_0x2d9450){_0x3733eb=_0x3733eb-0x0;var _0x4c80e3=_0x10df[_0x3733eb];return _0x4c80e3;};'use strict';var _=require(_0xf10d('0x0'));var util=require('util');var moment=require(_0xf10d('0x1'));var BPromise=require(_0xf10d('0x2'));var rs=require(_0xf10d('0x3'));var fs=require('fs');var Redis=require(_0xf10d('0x4'));var db=require(_0xf10d('0x5'))['db'];var utils=require(_0xf10d('0x6'));var logger=require(_0xf10d('0x7'))(_0xf10d('0x8'));var config=require(_0xf10d('0x9'));var jayson=require(_0xf10d('0xa'));var client=jayson['client'][_0xf10d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3175eb,_0x42a567,_0x546ee1){return new BPromise(function(_0x17f75,_0x8d05a4){return client['request'](_0x3175eb,_0x546ee1)[_0xf10d('0xc')](function(_0x234fe3){logger['info'](_0xf10d('0xd'),_0x42a567,_0xf10d('0xe'));logger[_0xf10d('0xf')](_0xf10d('0x10'),_0x42a567,'request\x20sent',JSON['stringify'](_0x234fe3));if(_0x234fe3[_0xf10d('0x11')]){if(_0x234fe3[_0xf10d('0x11')][_0xf10d('0x12')]===0x1f4){logger[_0xf10d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x42a567,_0x234fe3['error']['message']);return _0x8d05a4(_0x234fe3[_0xf10d('0x11')][_0xf10d('0x13')]);}logger[_0xf10d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x42a567,_0x234fe3[_0xf10d('0x11')][_0xf10d('0x13')]);return _0x17f75(_0x234fe3[_0xf10d('0x11')][_0xf10d('0x13')]);}else{logger['info'](_0xf10d('0xd'),_0x42a567,_0xf10d('0xe'));_0x17f75(_0x234fe3[_0xf10d('0x14')][_0xf10d('0x13')]);}})[_0xf10d('0x15')](function(_0xaeba9a){logger[_0xf10d('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x42a567,_0xaeba9a);_0x8d05a4(_0xaeba9a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index eaac0b8..4b68733 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 _0xc70d=['/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatOfflineMessage.controller','index','get'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc70d,0xd3));var _0xdc70=function(_0x2341aa,_0x313c0b){_0x2341aa=_0x2341aa-0x0;var _0x58c3f=_0xc70d[_0x2341aa];return _0x58c3f;};'use strict';var multer=require('multer');var util=require(_0xdc70('0x0'));var path=require(_0xdc70('0x1'));var timeout=require(_0xdc70('0x2'));var express=require(_0xdc70('0x3'));var router=express[_0xdc70('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdc70('0x5'));var config=require('../../config/environment');var controller=require(_0xdc70('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xdc70('0x7')]);router[_0xdc70('0x8')](_0xdc70('0x9'),auth[_0xdc70('0xa')](),controller[_0xdc70('0xb')]);router['get'](_0xdc70('0xc'),auth[_0xdc70('0xa')](),controller['show']);router[_0xdc70('0xd')]('/',auth[_0xdc70('0xa')](),controller[_0xdc70('0xe')]);router[_0xdc70('0xf')](_0xdc70('0xc'),auth[_0xdc70('0xa')](),controller[_0xdc70('0x10')]);router[_0xdc70('0x11')](_0xdc70('0xc'),auth[_0xdc70('0xa')](),controller[_0xdc70('0x12')]);module[_0xdc70('0x13')]=router; \ No newline at end of file +var _0x4a6e=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/:id','isAuthenticated','show','create','update','delete','destroy'];(function(_0x4ab062,_0x5c56b4){var _0x487434=function(_0x467019){while(--_0x467019){_0x4ab062['push'](_0x4ab062['shift']());}};_0x487434(++_0x5c56b4);}(_0x4a6e,0x88));var _0xe4a6=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x4a6e[_0x308213];return _0x2e1619;};'use strict';var multer=require(_0xe4a6('0x0'));var util=require(_0xe4a6('0x1'));var path=require(_0xe4a6('0x2'));var timeout=require('connect-timeout');var express=require(_0xe4a6('0x3'));var router=express[_0xe4a6('0x4')]();var auth=require(_0xe4a6('0x5'));var interaction=require(_0xe4a6('0x6'));var config=require(_0xe4a6('0x7'));var controller=require(_0xe4a6('0x8'));router[_0xe4a6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe4a6('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe4a6('0x9')](_0xe4a6('0xa'),auth[_0xe4a6('0xb')](),controller[_0xe4a6('0xc')]);router['post']('/',auth[_0xe4a6('0xb')](),controller[_0xe4a6('0xd')]);router['put'](_0xe4a6('0xa'),auth['isAuthenticated'](),controller[_0xe4a6('0xe')]);router[_0xe4a6('0xf')](_0xe4a6('0xa'),auth['isAuthenticated'](),controller[_0xe4a6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d39d32a..ddc7f1d 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 _0x21be=['mouseOver','timeout','STRING','INTEGER','sequelize','exports','ENUM'];(function(_0x161299,_0x4991c7){var _0x293d51=function(_0x44f04d){while(--_0x44f04d){_0x161299['push'](_0x161299['shift']());}};_0x293d51(++_0x4991c7);}(_0x21be,0x107));var _0xe21b=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x21be[_0x20cc29];return _0x28d513;};'use strict';var Sequelize=require(_0xe21b('0x0'));module[_0xe21b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe21b('0x2')](_0xe21b('0x3'),_0xe21b('0x4')),'defaultValue':_0xe21b('0x3')},'selector':{'type':Sequelize[_0xe21b('0x5')]},'timeout':{'type':Sequelize[_0xe21b('0x6')]}}; \ No newline at end of file +var _0x46c6=['mouseOver','INTEGER','sequelize'];(function(_0x28c5ff,_0x555851){var _0x3f696b=function(_0x521d84){while(--_0x521d84){_0x28c5ff['push'](_0x28c5ff['shift']());}};_0x3f696b(++_0x555851);}(_0x46c6,0x188));var _0x646c=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x46c6[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0x646c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x646c('0x1'),'timeout'),'defaultValue':_0x646c('0x1')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x646c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index aad9b0e..51be48e 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 _0xe706=['../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','ChatProactiveAction','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x20688d,_0xae370c){var _0xdddfa2=function(_0xe6a925){while(--_0xe6a925){_0x20688d['push'](_0x20688d['shift']());}};_0xdddfa2(++_0xae370c);}(_0xe706,0xa3));var _0x6e70=function(_0x5b84e5,_0x26076b){_0x5b84e5=_0x5b84e5-0x0;var _0xff9066=_0xe706[_0x5b84e5];return _0xff9066;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={'raw':!![],'where':{'id':_0x4a67ac[_0x6e70('0x2c')]['id']}},_0x3af17f={};_0x3af17f[_0x6e70('0x2d')]=_[_0x6e70('0x2e')](db['ChatProactiveAction'][_0x6e70('0x2f')]);_0x3af17f[_0x6e70('0x30')]=_[_0x6e70('0x2e')](_0x4a67ac[_0x6e70('0x30')]);_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x32')](_0x3af17f[_0x6e70('0x2d')],_0x3af17f[_0x6e70('0x30')]);_0x2c4d37[_0x6e70('0x33')]=_[_0x6e70('0x32')](_0x3af17f['model'],qs[_0x6e70('0x34')](_0x4a67ac['query'][_0x6e70('0x34')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x33')][_0x6e70('0x35')]?_0x2c4d37[_0x6e70('0x33')]:_0x3af17f['model'];if(_0x4a67ac[_0x6e70('0x30')][_0x6e70('0x36')]){_0x2c4d37['include']=[{'all':!![]}];}_0x2c4d37=_[_0x6e70('0x37')]({},_0x2c4d37,_0x4a67ac[_0x6e70('0x38')]);return db['ChatProactiveAction'][_0x6e70('0x39')](_0x2c4d37)[_0x6e70('0x27')](handleEntityNotFound(_0x54a5fe,null))[_0x6e70('0x27')](respondWithResult(_0x54a5fe,null))[_0x6e70('0x3a')](handleError(_0x54a5fe,null));};exports[_0x6e70('0x3b')]=function(_0x1e3e76,_0x44b19d){return db[_0x6e70('0x3c')][_0x6e70('0x3b')](_0x1e3e76[_0x6e70('0x3d')],{})['then'](respondWithResult(_0x44b19d,0xc9))[_0x6e70('0x3a')](handleError(_0x44b19d,null));};exports['update']=function(_0x23cd1a,_0x3222a2){if(_0x23cd1a[_0x6e70('0x3d')]['id']){delete _0x23cd1a[_0x6e70('0x3d')]['id'];}return db[_0x6e70('0x3c')][_0x6e70('0x39')]({'where':{'id':_0x23cd1a[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x3222a2,null))[_0x6e70('0x27')](saveUpdates(_0x23cd1a[_0x6e70('0x3d')],null))[_0x6e70('0x27')](respondWithResult(_0x3222a2,null))[_0x6e70('0x3a')](handleError(_0x3222a2,null));};exports[_0x6e70('0x3e')]=function(_0x501b53,_0x5446a2){return db['ChatProactiveAction'][_0x6e70('0x39')]({'where':{'id':_0x501b53[_0x6e70('0x2c')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x5446a2,null))[_0x6e70('0x27')](removeEntity(_0x5446a2,null))[_0x6e70('0x3a')](handleError(_0x5446a2,null));}; \ No newline at end of file +var _0xcb91=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0xcb91[_0x421c56];return _0x49b244;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['show']=function(_0xd6891c,_0x21effa){var _0x41a9a0={'raw':!![],'where':{'id':_0xd6891c[_0x1cb9('0x26')]['id']}},_0x1804fd={};_0x1804fd[_0x1cb9('0x27')]=_[_0x1cb9('0x28')](db[_0x1cb9('0x29')][_0x1cb9('0x2a')]);_0x1804fd[_0x1cb9('0x2b')]=_['keys'](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2c')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2d')]=_[_0x1cb9('0x2c')](_0x1804fd[_0x1cb9('0x27')],qs['fields'](_0xd6891c[_0x1cb9('0x2b')]['fields']));_0x41a9a0[_0x1cb9('0x2d')]=_0x41a9a0[_0x1cb9('0x2d')][_0x1cb9('0x2e')]?_0x41a9a0['attributes']:_0x1804fd[_0x1cb9('0x27')];if(_0xd6891c['query'][_0x1cb9('0x2f')]){_0x41a9a0['include']=[{'all':!![]}];}_0x41a9a0=_[_0x1cb9('0x30')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x31')]);return db[_0x1cb9('0x29')][_0x1cb9('0x32')](_0x41a9a0)['then'](handleEntityNotFound(_0x21effa,null))[_0x1cb9('0x1f')](respondWithResult(_0x21effa,null))[_0x1cb9('0x33')](handleError(_0x21effa,null));};exports[_0x1cb9('0x34')]=function(_0x91a1db,_0xc6784c){return db[_0x1cb9('0x29')][_0x1cb9('0x34')](_0x91a1db[_0x1cb9('0x35')],{})[_0x1cb9('0x1f')](respondWithResult(_0xc6784c,0xc9))[_0x1cb9('0x33')](handleError(_0xc6784c,null));};exports[_0x1cb9('0x36')]=function(_0x26b950,_0x29f149){if(_0x26b950['body']['id']){delete _0x26b950['body']['id'];}return db[_0x1cb9('0x29')][_0x1cb9('0x32')]({'where':{'id':_0x26b950[_0x1cb9('0x26')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x29f149,null))[_0x1cb9('0x1f')](saveUpdates(_0x26b950[_0x1cb9('0x35')],null))[_0x1cb9('0x1f')](respondWithResult(_0x29f149,null))[_0x1cb9('0x33')](handleError(_0x29f149,null));};exports['destroy']=function(_0x2aa59b,_0x1482c4){return db[_0x1cb9('0x29')]['find']({'where':{'id':_0x2aa59b[_0x1cb9('0x26')]['id']}})['then'](handleEntityNotFound(_0x1482c4,null))[_0x1cb9('0x1f')](removeEntity(_0x1482c4,null))['catch'](handleError(_0x1482c4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6e05b92..a39712a 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 _0x1780=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','../../config/logger','moment','request-promise','path'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1780,0x1c8));var _0x0178=function(_0x139f18,_0x1c8ff4){_0x139f18=_0x139f18-0x0;var _0x1dff4b=_0x1780[_0x139f18];return _0x1dff4b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0178('0x0'))('api');var moment=require(_0x0178('0x1'));var BPromise=require('bluebird');var rp=require(_0x0178('0x2'));var fs=require('fs');var path=require(_0x0178('0x3'));var rimraf=require('rimraf');var config=require(_0x0178('0x4'));var attributes=require(_0x0178('0x5'));module[_0x0178('0x6')]=function(_0x95e6d,_0x1f2843){return _0x95e6d[_0x0178('0x7')](_0x0178('0x8'),attributes,{'tableName':_0x0178('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa55c=['define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x4d9b8e,_0x556975){var _0x5480d4=function(_0x232dca){while(--_0x232dca){_0x4d9b8e['push'](_0x4d9b8e['shift']());}};_0x5480d4(++_0x556975);}(_0xa55c,0x196));var _0xca55=function(_0x24c556,_0x271443){_0x24c556=_0x24c556-0x0;var _0xaaec20=_0xa55c[_0x24c556];return _0xaaec20;};'use strict';var _=require(_0xca55('0x0'));var util=require(_0xca55('0x1'));var logger=require('../../config/logger')(_0xca55('0x2'));var moment=require(_0xca55('0x3'));var BPromise=require(_0xca55('0x4'));var rp=require(_0xca55('0x5'));var fs=require('fs');var path=require(_0xca55('0x6'));var rimraf=require('rimraf');var config=require(_0xca55('0x7'));var attributes=require(_0xca55('0x8'));module[_0xca55('0x9')]=function(_0x4a6e3c,_0x3c8e3d){return _0x4a6e3c[_0xca55('0xa')](_0xca55('0xb'),attributes,{'tableName':_0xca55('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d6717cd..0cb2add 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 _0x0e06=['request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1d6dea,_0x1f8978){var _0x1b5967=function(_0x4a95f6){while(--_0x4a95f6){_0x1d6dea['push'](_0x1d6dea['shift']());}};_0x1b5967(++_0x1f8978);}(_0x0e06,0xe8));var _0x60e0=function(_0x5eee0f,_0x75e5ad){_0x5eee0f=_0x5eee0f-0x0;var _0x191a64=_0x0e06[_0x5eee0f];return _0x191a64;};'use strict';var _=require(_0x60e0('0x0'));var util=require('util');var moment=require(_0x60e0('0x1'));var BPromise=require(_0x60e0('0x2'));var rs=require(_0x60e0('0x3'));var fs=require('fs');var Redis=require(_0x60e0('0x4'));var db=require(_0x60e0('0x5'))['db'];var utils=require(_0x60e0('0x6'));var logger=require(_0x60e0('0x7'))(_0x60e0('0x8'));var config=require('../../config/environment');var jayson=require(_0x60e0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x294c39,_0x14cce5,_0x2d62ac){return new BPromise(function(_0x3a2382,_0x32c8df){return client[_0x60e0('0xa')](_0x294c39,_0x2d62ac)[_0x60e0('0xb')](function(_0x1060ee){logger[_0x60e0('0xc')](_0x60e0('0xd'),_0x14cce5,_0x60e0('0xe'));logger[_0x60e0('0xf')](_0x60e0('0x10'),_0x14cce5,_0x60e0('0xe'),JSON[_0x60e0('0x11')](_0x1060ee));if(_0x1060ee[_0x60e0('0x12')]){if(_0x1060ee[_0x60e0('0x12')][_0x60e0('0x13')]===0x1f4){logger[_0x60e0('0x12')](_0x60e0('0xd'),_0x14cce5,_0x1060ee[_0x60e0('0x12')][_0x60e0('0x14')]);return _0x32c8df(_0x1060ee[_0x60e0('0x12')][_0x60e0('0x14')]);}logger['error'](_0x60e0('0xd'),_0x14cce5,_0x1060ee[_0x60e0('0x12')][_0x60e0('0x14')]);return _0x3a2382(_0x1060ee[_0x60e0('0x12')][_0x60e0('0x14')]);}else{logger[_0x60e0('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x14cce5,_0x60e0('0xe'));_0x3a2382(_0x1060ee[_0x60e0('0x15')][_0x60e0('0x14')]);}})['catch'](function(_0x1d471f){logger[_0x60e0('0x12')](_0x60e0('0xd'),_0x14cce5,_0x1d471f);_0x32c8df(_0x1d471f);});});} \ No newline at end of file +var _0x1235=['result','catch','util','randomstring','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message'];(function(_0x2c039a,_0x217a31){var _0x3f398f=function(_0x16e635){while(--_0x16e635){_0x2c039a['push'](_0x2c039a['shift']());}};_0x3f398f(++_0x217a31);}(_0x1235,0x92));var _0x5123=function(_0x1f657f,_0x217a10){_0x1f657f=_0x1f657f-0x0;var _0x12886e=_0x1235[_0x1f657f];return _0x12886e;};'use strict';var _=require('lodash');var util=require(_0x5123('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5123('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5123('0x2'));var config=require(_0x5123('0x3'));var jayson=require(_0x5123('0x4'));var client=jayson[_0x5123('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34855a,_0x20386f,_0x2d38ec){return new BPromise(function(_0x97ce6f,_0x47defc){return client[_0x5123('0x6')](_0x34855a,_0x2d38ec)[_0x5123('0x7')](function(_0x352395){logger[_0x5123('0x8')]('ChatProactiveAction,\x20%s,\x20%s',_0x20386f,_0x5123('0x9'));logger['debug'](_0x5123('0xa'),_0x20386f,_0x5123('0x9'),JSON[_0x5123('0xb')](_0x352395));if(_0x352395[_0x5123('0xc')]){if(_0x352395['error'][_0x5123('0xd')]===0x1f4){logger[_0x5123('0xc')](_0x5123('0xe'),_0x20386f,_0x352395[_0x5123('0xc')][_0x5123('0xf')]);return _0x47defc(_0x352395[_0x5123('0xc')][_0x5123('0xf')]);}logger[_0x5123('0xc')](_0x5123('0xe'),_0x20386f,_0x352395[_0x5123('0xc')][_0x5123('0xf')]);return _0x97ce6f(_0x352395[_0x5123('0xc')][_0x5123('0xf')]);}else{logger['info'](_0x5123('0xe'),_0x20386f,'request\x20sent');_0x97ce6f(_0x352395[_0x5123('0x10')][_0x5123('0xf')]);}})[_0x5123('0x11')](function(_0x260cac){logger[_0x5123('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x20386f,_0x260cac);_0x47defc(_0x260cac);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b6c3374..19a5526 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 _0x3124=['post','create','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x579fc8,_0x432ea0){var _0x1ac73e=function(_0x585c9a){while(--_0x585c9a){_0x579fc8['push'](_0x579fc8['shift']());}};_0x1ac73e(++_0x432ea0);}(_0x3124,0x15d));var _0x4312=function(_0x5ab016,_0x1eb213){_0x5ab016=_0x5ab016-0x0;var _0x2f5dc6=_0x3124[_0x5ab016];return _0x2f5dc6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4312('0x0'));var timeout=require(_0x4312('0x1'));var express=require(_0x4312('0x2'));var router=express[_0x4312('0x3')]();var auth=require(_0x4312('0x4'));var interaction=require(_0x4312('0x5'));var config=require(_0x4312('0x6'));var controller=require(_0x4312('0x7'));router[_0x4312('0x8')](_0x4312('0x9'),auth[_0x4312('0xa')](),controller['show']);router[_0x4312('0xb')]('/',auth[_0x4312('0xa')](),controller[_0x4312('0xc')]);router['put']('/:id',auth[_0x4312('0xa')](),controller['update']);router[_0x4312('0xd')](_0x4312('0x9'),auth[_0x4312('0xa')](),controller[_0x4312('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb5fd=['../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','create','put','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1c1057,_0x4a6f27){var _0x5389e9=function(_0xdfc8b9){while(--_0xdfc8b9){_0x1c1057['push'](_0x1c1057['shift']());}};_0x5389e9(++_0x4a6f27);}(_0xb5fd,0x71));var _0xdb5f=function(_0x33fd4e,_0x27057a){_0x33fd4e=_0x33fd4e-0x0;var _0x14de82=_0xb5fd[_0x33fd4e];return _0x14de82;};'use strict';var multer=require('multer');var util=require(_0xdb5f('0x0'));var path=require(_0xdb5f('0x1'));var timeout=require(_0xdb5f('0x2'));var express=require(_0xdb5f('0x3'));var router=express[_0xdb5f('0x4')]();var auth=require(_0xdb5f('0x5'));var interaction=require(_0xdb5f('0x6'));var config=require(_0xdb5f('0x7'));var controller=require(_0xdb5f('0x8'));router[_0xdb5f('0x9')](_0xdb5f('0xa'),auth[_0xdb5f('0xb')](),controller['show']);router['post']('/',auth[_0xdb5f('0xb')](),controller[_0xdb5f('0xc')]);router[_0xdb5f('0xd')](_0xdb5f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xdb5f('0xe')](_0xdb5f('0xa'),auth[_0xdb5f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 220baf1..7b2b789 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 _0x5571=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5571,0x196));var _0x1557=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0x5571[_0x397bfb];return _0x16c9b9;};'use strict';var Sequelize=require(_0x1557('0x0'));module[_0x1557('0x1')]={'name':{'type':Sequelize[_0x1557('0x2')],'unique':_0x1557('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1557('0x2')]},'timeout':{'type':Sequelize[_0x1557('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1557('0x5')](_0x1557('0x6'),_0x1557('0x7'),_0x1557('0x8'))}}; \ No newline at end of file +var _0xe3a9=['roundrobin','exports','name','STRING','INTEGER','rrmemory','beepall'];(function(_0x684c4e,_0x529c01){var _0x4630de=function(_0x141462){while(--_0x141462){_0x684c4e['push'](_0x684c4e['shift']());}};_0x4630de(++_0x529c01);}(_0xe3a9,0xa2));var _0x9e3a=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0xe3a9[_0x2db667];return _0x83ff9;};'use strict';var Sequelize=require('sequelize');module[_0x9e3a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e3a('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9e3a('0x2')]},'timeout':{'type':Sequelize[_0x9e3a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9e3a('0x4'),_0x9e3a('0x5'),_0x9e3a('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index cc6ffec..66eadae 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 _0x8f89=['options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','pick','ChatQueueId','User','chatPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','transaction','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','removeAgents','forEach','userChatQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','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','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','map','ChatQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show'];(function(_0x1dac5d,_0x131b84){var _0x468fc8=function(_0x1aea95){while(--_0x1aea95){_0x1dac5d['push'](_0x1dac5d['shift']());}};_0x468fc8(++_0x131b84);}(_0x8f89,0x178));var _0x98f8=function(_0x3ed545,_0x4bd536){_0x3ed545=_0x3ed545-0x0;var _0x21acce=_0x8f89[_0x3ed545];return _0x21acce;};'use strict';var pdf=require(_0x98f8('0x0'));var emlformat=require(_0x98f8('0x1'));var rimraf=require(_0x98f8('0x2'));var zipdir=require(_0x98f8('0x3'));var jsonpatch=require(_0x98f8('0x4'));var rp=require(_0x98f8('0x5'));var moment=require(_0x98f8('0x6'));var BPromise=require(_0x98f8('0x7'));var Mustache=require(_0x98f8('0x8'));var util=require('util');var path=require(_0x98f8('0x9'));var sox=require('sox');var csv=require(_0x98f8('0xa'));var ejs=require(_0x98f8('0xb'));var fs=require('fs');var _=require(_0x98f8('0xc'));var squel=require(_0x98f8('0xd'));var crypto=require(_0x98f8('0xe'));var jsforce=require(_0x98f8('0xf'));var deskjs=require(_0x98f8('0x10'));var toCsv=require('to-csv');var querystring=require(_0x98f8('0x11'));var Papa=require('papaparse');var Redis=require(_0x98f8('0x12'));var authService=require(_0x98f8('0x13'));var qs=require(_0x98f8('0x14'));var as=require(_0x98f8('0x15'));var hardwareService=require(_0x98f8('0x16'));var logger=require(_0x98f8('0x17'))('api');var utils=require(_0x98f8('0x18'));var config=require(_0x98f8('0x19'));var db=require(_0x98f8('0x1a'))['db'];config[_0x98f8('0x1b')]=_[_0x98f8('0x1c')](config[_0x98f8('0x1b')],{'host':_0x98f8('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98f8('0x1b')]));require(_0x98f8('0x1e'))['register'](socket);var jayson=require(_0x98f8('0x1f'));var client=jayson[_0x98f8('0x20')][_0x98f8('0x21')]({'port':0x232a});function checkPasswordPattern(_0x1c9a7d,_0x3a3308,_0x42f072){if(_0x42f072){var _0x76818e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x76818e[_0x98f8('0x22')](_0x3a3308)){return _0x1c9a7d;}else{throw new db[(_0x98f8('0x23'))][(_0x98f8('0x24'))](_0x98f8('0x25'));}}else{return _0x1c9a7d;}}function respondWithRpcPromise(_0x4d6dc7,_0x329157,_0x36dffa,_0x5a3ad7){return new BPromise(function(_0xc0abc2,_0x357456){var _0x1891b4=_0x5a3ad7||client;return _0x1891b4[_0x98f8('0x26')](_0x4d6dc7,_0x36dffa)['then'](function(_0x514b72){logger[_0x98f8('0x27')](_0x98f8('0x28'),_0x329157,_0x98f8('0x29'));logger['debug'](_0x98f8('0x2a'),_0x329157,'request\x20sent',JSON[_0x98f8('0x2b')](_0x514b72));if(_0x514b72[_0x98f8('0x2c')]){if(_0x514b72[_0x98f8('0x2c')][_0x98f8('0x2d')]===0x1f4){logger[_0x98f8('0x2c')](_0x98f8('0x28'),_0x329157,_0x514b72['error'][_0x98f8('0x2e')]);return _0x357456(_0x514b72[_0x98f8('0x2c')][_0x98f8('0x2e')]);}logger[_0x98f8('0x2c')](_0x98f8('0x28'),_0x329157,_0x514b72[_0x98f8('0x2c')][_0x98f8('0x2e')]);return _0xc0abc2(_0x514b72[_0x98f8('0x2c')][_0x98f8('0x2e')]);}else{logger[_0x98f8('0x27')]('ChatQueue,\x20%s,\x20%s',_0x329157,_0x98f8('0x29'));_0xc0abc2(_0x514b72[_0x98f8('0x2f')][_0x98f8('0x2e')]);}})[_0x98f8('0x30')](function(_0x439059){logger[_0x98f8('0x2c')](_0x98f8('0x28'),_0x329157,_0x439059);_0x357456(_0x439059);});});}function respondWithStatusCode(_0x1d2387,_0x1c2261){_0x1c2261=_0x1c2261||0xcc;return function(_0x377400){if(_0x377400){return _0x1d2387[_0x98f8('0x31')](_0x1c2261);}return _0x1d2387[_0x98f8('0x32')](_0x1c2261)[_0x98f8('0x33')]();};}function respondWithResult(_0x485650,_0x22f285){_0x22f285=_0x22f285||0xc8;return function(_0x3dccdb){if(_0x3dccdb){return _0x485650[_0x98f8('0x32')](_0x22f285)[_0x98f8('0x34')](_0x3dccdb);}};}function respondWithFilteredResult(_0x128858,_0x31c9ce){return function(_0x9e98c5){if(_0x9e98c5){var _0x4beaa0=_0x9e98c5[_0x98f8('0x35')],_0x3e95b2=_0x31c9ce[_0x98f8('0x36')],_0x18b439=_0x31c9ce[_0x98f8('0x36')]+_0x31c9ce[_0x98f8('0x37')],_0x282922;if(_0x18b439>=_0x4beaa0){_0x18b439=_0x4beaa0;_0x282922=0xc8;}else{_0x282922=0xce;}_0x128858[_0x98f8('0x32')](_0x282922);return _0x128858[_0x98f8('0x38')](_0x98f8('0x39'),_0x3e95b2+'-'+_0x18b439+'/'+_0x4beaa0)[_0x98f8('0x34')](_0x9e98c5);}return null;};}function patchUpdates(_0x443bfa){return function(_0x899c1e){try{jsonpatch[_0x98f8('0x3a')](_0x899c1e,_0x443bfa,!![]);}catch(_0x95a459){return BPromise[_0x98f8('0x3b')](_0x95a459);}return _0x899c1e[_0x98f8('0x3c')]();};}function saveUpdates(_0x3de331,_0x37e03e){return function(_0x26825f){if(_0x26825f){return _0x26825f[_0x98f8('0x3d')](_0x3de331)[_0x98f8('0x3e')](function(_0x387690){return _0x387690;});}return null;};}function removeEntity(_0x3d63e3,_0x3ab418){return function(_0x427b2d){if(_0x427b2d){return _0x427b2d[_0x98f8('0x3f')]()[_0x98f8('0x3e')](function(){var _0x10b64b=_0x427b2d[_0x98f8('0x40')]({'plain':!![]});var _0x314b2f='ChatQueues';return db[_0x98f8('0x41')]['destroy']({'where':{'type':_0x314b2f,'resourceId':_0x10b64b['id']}})[_0x98f8('0x3e')](function(){return _0x427b2d;});})[_0x98f8('0x3e')](function(){_0x3d63e3[_0x98f8('0x32')](0xcc)[_0x98f8('0x33')]();});}};}function handleEntityNotFound(_0x4db4ba,_0x4a06f8){return function(_0x39b496){if(!_0x39b496){_0x4db4ba[_0x98f8('0x31')](0x194);}return _0x39b496;};}function handleError(_0x464e64,_0x4b8c16){_0x4b8c16=_0x4b8c16||0x1f4;return function(_0x1aeaf6){logger[_0x98f8('0x2c')](_0x1aeaf6[_0x98f8('0x42')]);if(_0x1aeaf6[_0x98f8('0x43')]){delete _0x1aeaf6[_0x98f8('0x43')];}_0x464e64[_0x98f8('0x32')](_0x4b8c16)['send'](_0x1aeaf6);};}exports['index']=function(_0x2dda46,_0x40c7d3){var _0x42a3e1={},_0x424cad={},_0x193c8d={'count':0x0,'rows':[]};var _0x4b4039=_[_0x98f8('0x44')](db[_0x98f8('0x45')][_0x98f8('0x46')],function(_0x1c1f3d){return{'name':_0x1c1f3d['fieldName'],'type':_0x1c1f3d[_0x98f8('0x47')][_0x98f8('0x48')]};});_0x424cad[_0x98f8('0x49')]=_[_0x98f8('0x44')](_0x4b4039,_0x98f8('0x43'));_0x424cad[_0x98f8('0x4a')]=_[_0x98f8('0x4b')](_0x2dda46[_0x98f8('0x4a')]);_0x424cad[_0x98f8('0x4c')]=_[_0x98f8('0x4d')](_0x424cad['model'],_0x424cad['query']);_0x42a3e1[_0x98f8('0x4e')]=_[_0x98f8('0x4d')](_0x424cad[_0x98f8('0x49')],qs['fields'](_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x4f')]));_0x42a3e1[_0x98f8('0x4e')]=_0x42a3e1['attributes'][_0x98f8('0x50')]?_0x42a3e1[_0x98f8('0x4e')]:_0x424cad[_0x98f8('0x49')];if(!_0x2dda46[_0x98f8('0x4a')]['hasOwnProperty']('nolimit')){_0x42a3e1[_0x98f8('0x37')]=qs[_0x98f8('0x37')](_0x2dda46[_0x98f8('0x4a')]['limit']);_0x42a3e1['offset']=qs[_0x98f8('0x36')](_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x36')]);}_0x42a3e1[_0x98f8('0x51')]=qs[_0x98f8('0x52')](_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x52')]);_0x42a3e1[_0x98f8('0x53')]=qs['filters'](_['pick'](_0x2dda46[_0x98f8('0x4a')],_0x424cad['filters']),_0x4b4039);if(_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x54')]){_0x42a3e1['where']=_['merge'](_0x42a3e1[_0x98f8('0x53')],{'$or':_[_0x98f8('0x44')](_0x4b4039,function(_0x459f58){if(_0x459f58[_0x98f8('0x47')]!==_0x98f8('0x55')){var _0x5015ea={};_0x5015ea[_0x459f58[_0x98f8('0x43')]]={'$like':'%'+_0x2dda46['query'][_0x98f8('0x54')]+'%'};return _0x5015ea;}})});}_0x42a3e1=_[_0x98f8('0x56')]({},_0x42a3e1,_0x2dda46['options']);var _0x7d77cb={'where':_0x42a3e1[_0x98f8('0x53')]};return db[_0x98f8('0x45')][_0x98f8('0x35')](_0x7d77cb)[_0x98f8('0x3e')](function(_0x39e9ad){_0x193c8d['count']=_0x39e9ad;if(_0x2dda46[_0x98f8('0x4a')][_0x98f8('0x57')]){_0x42a3e1[_0x98f8('0x58')]=[{'all':!![]}];}return db['ChatQueue'][_0x98f8('0x59')](_0x42a3e1);})[_0x98f8('0x3e')](function(_0x2aa65c){_0x193c8d[_0x98f8('0x5a')]=_0x2aa65c;return _0x193c8d;})[_0x98f8('0x3e')](respondWithFilteredResult(_0x40c7d3,_0x42a3e1))['catch'](handleError(_0x40c7d3,null));};exports[_0x98f8('0x5b')]=function(_0x414c30,_0x2f5dfe){var _0x30fd05={'raw':!![],'where':{'id':_0x414c30['params']['id']}},_0x127f6a={};_0x127f6a[_0x98f8('0x49')]=_[_0x98f8('0x4b')](db[_0x98f8('0x45')][_0x98f8('0x46')]);_0x127f6a['query']=_[_0x98f8('0x4b')](_0x414c30[_0x98f8('0x4a')]);_0x127f6a[_0x98f8('0x4c')]=_[_0x98f8('0x4d')](_0x127f6a[_0x98f8('0x49')],_0x127f6a[_0x98f8('0x4a')]);_0x30fd05[_0x98f8('0x4e')]=_['intersection'](_0x127f6a['model'],qs[_0x98f8('0x4f')](_0x414c30['query']['fields']));_0x30fd05[_0x98f8('0x4e')]=_0x30fd05['attributes'][_0x98f8('0x50')]?_0x30fd05['attributes']:_0x127f6a[_0x98f8('0x49')];if(_0x414c30['query'][_0x98f8('0x57')]){_0x30fd05['include']=[{'all':!![]}];}_0x30fd05=_[_0x98f8('0x56')]({},_0x30fd05,_0x414c30[_0x98f8('0x5c')]);return db[_0x98f8('0x45')][_0x98f8('0x5d')](_0x30fd05)['then'](handleEntityNotFound(_0x2f5dfe,null))[_0x98f8('0x3e')](respondWithResult(_0x2f5dfe,null))['catch'](handleError(_0x2f5dfe,null));};exports[_0x98f8('0x5e')]=function(_0x365654,_0x44d8c7){return db[_0x98f8('0x45')]['create'](_0x365654[_0x98f8('0x5f')],{})[_0x98f8('0x3e')](function(_0x2cbca9){var _0x5c3c64=_0x365654[_0x98f8('0x60')]['get']({'plain':!![]});if(!_0x5c3c64)throw new Error(_0x98f8('0x61'));if(_0x5c3c64[_0x98f8('0x62')]===_0x98f8('0x60')){var _0x158807=_0x2cbca9[_0x98f8('0x40')]({'plain':!![]});var _0x1bdd2e=_0x98f8('0x63');return db[_0x98f8('0x64')]['find']({'where':{'name':_0x1bdd2e,'userProfileId':_0x5c3c64[_0x98f8('0x65')]},'raw':!![]})['then'](function(_0x20a1c6){if(_0x20a1c6&&_0x20a1c6['autoAssociation']===0x0){return db[_0x98f8('0x41')][_0x98f8('0x5e')]({'name':_0x158807[_0x98f8('0x43')],'resourceId':_0x158807['id'],'type':_0x20a1c6[_0x98f8('0x43')],'sectionId':_0x20a1c6['id']},{})['then'](function(){return _0x2cbca9;});}else{return _0x2cbca9;}})[_0x98f8('0x30')](function(_0x3cfc9b){logger[_0x98f8('0x2c')](_0x98f8('0x66'),_0x3cfc9b);throw _0x3cfc9b;});}return _0x2cbca9;})[_0x98f8('0x3e')](respondWithResult(_0x44d8c7,0xc9))[_0x98f8('0x30')](handleError(_0x44d8c7,null));};exports[_0x98f8('0x3d')]=function(_0x479622,_0x2c35ad){if(_0x479622[_0x98f8('0x5f')]['id']){delete _0x479622[_0x98f8('0x5f')]['id'];}return db['ChatQueue'][_0x98f8('0x5d')]({'where':{'id':_0x479622[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x2c35ad,null))[_0x98f8('0x3e')](saveUpdates(_0x479622[_0x98f8('0x5f')],null))[_0x98f8('0x3e')](respondWithResult(_0x2c35ad,null))[_0x98f8('0x30')](handleError(_0x2c35ad,null));};exports[_0x98f8('0x3f')]=function(_0x5b4dcc,_0x202797){return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0x5b4dcc[_0x98f8('0x67')]['id']}})['then'](handleEntityNotFound(_0x202797,null))[_0x98f8('0x3e')](removeEntity(_0x202797,null))[_0x98f8('0x30')](handleError(_0x202797,null));};exports[_0x98f8('0x68')]=function(_0x2f2061,_0xea228a){return db[_0x98f8('0x45')]['describe']()[_0x98f8('0x3e')](respondWithResult(_0xea228a,null))['catch'](handleError(_0xea228a,null));};exports[_0x98f8('0x69')]=function(_0x205c0a,_0x23f7c3,_0x378307){var _0x6c08f9={'raw':!![],'where':{}},_0x11112f={},_0x3ae34e;return db[_0x98f8('0x45')][_0x98f8('0x6a')]({'where':{'id':_0x205c0a[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x23f7c3,null))['then'](function(_0x5907cc){if(_0x5907cc){_0x3ae34e=_0x5907cc[_0x98f8('0x40')]({'plain':!![]});_0x11112f['model']=_[_0x98f8('0x4b')](db[_0x98f8('0x6b')]['rawAttributes']);_0x11112f[_0x98f8('0x4a')]=_[_0x98f8('0x4b')](_0x205c0a[_0x98f8('0x4a')]);_0x11112f[_0x98f8('0x4c')]=_[_0x98f8('0x4d')](_0x11112f[_0x98f8('0x49')],_0x11112f[_0x98f8('0x4a')]);_0x6c08f9[_0x98f8('0x4e')]=_[_0x98f8('0x4d')](_0x11112f[_0x98f8('0x49')],qs[_0x98f8('0x4f')](_0x205c0a[_0x98f8('0x4a')]['fields']));_0x6c08f9[_0x98f8('0x4e')]=_0x6c08f9['attributes'][_0x98f8('0x50')]?_0x6c08f9[_0x98f8('0x4e')]:_0x11112f[_0x98f8('0x49')];if(!_0x205c0a[_0x98f8('0x4a')][_0x98f8('0x6c')](_0x98f8('0x6d'))){_0x6c08f9[_0x98f8('0x37')]=qs['limit'](_0x205c0a[_0x98f8('0x4a')]['limit']);_0x6c08f9[_0x98f8('0x36')]=qs[_0x98f8('0x36')](_0x205c0a[_0x98f8('0x4a')][_0x98f8('0x36')]);}_0x6c08f9[_0x98f8('0x51')]=qs['sort'](_0x205c0a['query']['sort']);_0x6c08f9['where']=qs[_0x98f8('0x4c')](_[_0x98f8('0x6e')](_0x205c0a[_0x98f8('0x4a')],_0x11112f[_0x98f8('0x4c')]));_0x6c08f9[_0x98f8('0x53')][_0x98f8('0x6f')]=_0x5907cc['id'];if(_0x205c0a['query'][_0x98f8('0x54')]){_0x6c08f9['where']=_[_0x98f8('0x56')](_0x6c08f9['where'],{'$or':_[_0x98f8('0x44')](_0x6c08f9['attributes'],function(_0x25e6be){var _0x43b26f={};_0x43b26f[_0x25e6be]={'$like':'%'+_0x205c0a['query']['filter']+'%'};return _0x43b26f;})});}_0x6c08f9=_[_0x98f8('0x56')]({},_0x6c08f9,_0x205c0a[_0x98f8('0x5c')]);return db['UserChatQueue']['findAll'](_0x6c08f9);}})['then'](function(_0x5c8083){if(_0x5c8083){return db[_0x98f8('0x70')]['findAndCountAll']({'where':{'id':_[_0x98f8('0x44')](_0x5c8083,'UserId'),'role':'agent'},'attributes':['id',_0x98f8('0x43'),_0x98f8('0x71'),_0x98f8('0x72'),_0x98f8('0x73')]});}})[_0x98f8('0x3e')](function(_0x351daf){if(_0x351daf){return{'count':_0x351daf[_0x98f8('0x35')],'rows':_[_0x98f8('0x44')](_0x351daf[_0x98f8('0x5a')],function(_0x32fcf7){return{'membername':_0x32fcf7[_0x98f8('0x43')],'UserId':_0x32fcf7['id'],'queue_name':_0x3ae34e[_0x98f8('0x43')],'ChatQueueId':_0x3ae34e['id'],'interface':util[_0x98f8('0x74')]('%s/%s',_0x98f8('0x75'),_0x32fcf7[_0x98f8('0x43')]),'penalty':0x0,'paused':_0x32fcf7[_0x98f8('0x71')],'createdAt':_0x32fcf7[_0x98f8('0x73')],'updatedAt':_0x32fcf7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x98f8('0x3e')](respondWithFilteredResult(_0x23f7c3,_0x6c08f9))[_0x98f8('0x30')](handleError(_0x23f7c3,null));};exports['getTeams']=function(_0x3233e6,_0x2541aa,_0x3e0bc5){var _0x1f7fa0={};var _0x194e63={};var _0x3bf5ea;var _0x7c8dc7;return db['ChatQueue']['findOne']({'where':{'id':_0x3233e6[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x2541aa,null))[_0x98f8('0x3e')](function(_0xaa4a52){if(_0xaa4a52){_0x3bf5ea=_0xaa4a52;_0x194e63[_0x98f8('0x49')]=_['keys'](db['Team'][_0x98f8('0x46')]);_0x194e63['query']=_['keys'](_0x3233e6[_0x98f8('0x4a')]);_0x194e63[_0x98f8('0x4c')]=_['intersection'](_0x194e63['model'],_0x194e63['query']);_0x1f7fa0['attributes']=_[_0x98f8('0x4d')](_0x194e63[_0x98f8('0x49')],qs[_0x98f8('0x4f')](_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x4f')]));_0x1f7fa0['attributes']=_0x1f7fa0[_0x98f8('0x4e')][_0x98f8('0x50')]?_0x1f7fa0[_0x98f8('0x4e')]:_0x194e63[_0x98f8('0x49')];_0x1f7fa0[_0x98f8('0x51')]=qs[_0x98f8('0x52')](_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x52')]);_0x1f7fa0[_0x98f8('0x53')]=qs[_0x98f8('0x4c')](_['pick'](_0x3233e6[_0x98f8('0x4a')],_0x194e63[_0x98f8('0x4c')]));if(_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x54')]){_0x1f7fa0[_0x98f8('0x53')]=_[_0x98f8('0x56')](_0x1f7fa0[_0x98f8('0x53')],{'$or':_[_0x98f8('0x44')](_0x1f7fa0[_0x98f8('0x4e')],function(_0x458570){var _0x40d755={};_0x40d755[_0x458570]={'$like':'%'+_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x54')]+'%'};return _0x40d755;})});}_0x1f7fa0=_[_0x98f8('0x56')]({},_0x1f7fa0,_0x3233e6[_0x98f8('0x5c')]);return _0x3bf5ea['getTeams'](_0x1f7fa0);}})['then'](function(_0x4fa3e0){if(_0x4fa3e0){_0x7c8dc7=_0x4fa3e0[_0x98f8('0x50')];if(!_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x6c')](_0x98f8('0x6d'))){_0x1f7fa0[_0x98f8('0x37')]=qs[_0x98f8('0x37')](_0x3233e6[_0x98f8('0x4a')]['limit']);_0x1f7fa0[_0x98f8('0x36')]=qs[_0x98f8('0x36')](_0x3233e6[_0x98f8('0x4a')][_0x98f8('0x36')]);}return _0x3bf5ea[_0x98f8('0x76')](_0x1f7fa0);}})[_0x98f8('0x3e')](function(_0x10938d){if(_0x10938d){return _0x10938d?{'count':_0x7c8dc7,'rows':_0x10938d}:null;}})[_0x98f8('0x3e')](respondWithResult(_0x2541aa,null))['catch'](handleError(_0x2541aa,null));};exports[_0x98f8('0x77')]=function(_0xc49371,_0x1b637e,_0x4ee50d){var _0x51251b=_0xc49371[_0x98f8('0x5f')][_0x98f8('0x78')];return db[_0x98f8('0x79')][_0x98f8('0x59')]({'where':{'id':_0x51251b},'attributes':['id'],'include':[{'model':db[_0x98f8('0x70')],'as':_0x98f8('0x7a'),'attributes':['id',_0x98f8('0x43'),_0x98f8('0x7b'),_0x98f8('0x7c'),_0x98f8('0x7d')],'raw':!![]}]})[_0x98f8('0x3e')](function(_0x40439a){if(_0x40439a){var _0x1c3c74=_['flatMap'](_0x40439a,function(_0x4c483e){var _0x44127a=_0x4c483e[_0x98f8('0x40')]({'plain':!![]});return _0x44127a[_0x98f8('0x7a')];});return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0xc49371[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](function(_0x351e9c){return db['sequelize'][_0x98f8('0x7e')](function(_0x34a480){return _0x351e9c[_0x98f8('0x77')](_0x51251b,{'transaction':_0x34a480})[_0x98f8('0x3e')](function(){return BPromise['each'](_0x1c3c74,function(_0x4bce0d){return db[_0x98f8('0x6b')][_0x98f8('0x7f')]({'where':{'UserId':_0x4bce0d['id'],'ChatQueueId':_0xc49371[_0x98f8('0x67')]['id']},'transaction':_0x34a480});});})[_0x98f8('0x3e')](function(){_0x1c3c74['forEach'](function(_0x132a92){socket[_0x98f8('0x80')]('userChatQueue:save',{'UserId':_0x132a92['id'],'ChatQueueId':_0x351e9c['id']});});});});});}})['then'](respondWithStatusCode(_0x1b637e,null))[_0x98f8('0x30')](handleError(_0x1b637e,null));};exports[_0x98f8('0x81')]=function(_0x3ac8a1,_0x5ce81e,_0x30ff70){return db[_0x98f8('0x79')][_0x98f8('0x59')]({'where':{'id':_0x3ac8a1[_0x98f8('0x4a')][_0x98f8('0x78')]},'attributes':['id'],'include':[{'model':db[_0x98f8('0x70')],'as':_0x98f8('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x98f8('0x3e')](handleEntityNotFound(_0x5ce81e,null))[_0x98f8('0x3e')](function(_0x24d03f){var _0x2b98e8=_['map'](_0x24d03f,'id');var _0x5ea535=[];var _0x4c2cc6=[];var _0xc7475c=squel[_0x98f8('0x82')]();_0xc7475c[_0x98f8('0x83')](_0x98f8('0x84'))[_0x98f8('0x85')]('team_has_chat_queues','tq')[_0x98f8('0x86')](_0x98f8('0x87'),'ut',_0x98f8('0x88'))[_0x98f8('0x53')](_0x98f8('0x89'),_0x3ac8a1[_0x98f8('0x67')]['id']);for(var _0x5a87c8=0x0;_0x5a87c8<_0x24d03f[_0x98f8('0x50')];_0x5a87c8+=0x1){let _0x1b1f50=_0x24d03f[_0x5a87c8];for(var _0x4d3a18=0x0;_0x4d3a18<_0x1b1f50[_0x98f8('0x7a')]['length'];_0x4d3a18+=0x1){let _0x19f1fa=_0x1b1f50['Agents'][_0x4d3a18];var _0x1b533d=_0xc7475c['clone']();_0x1b533d['where'](_0x98f8('0x8a'),_0x19f1fa['id']);_0x4c2cc6[_0x98f8('0x8b')](db[_0x98f8('0x8c')]['query'](_0x1b533d['toString'](),{'type':db[_0x98f8('0x8c')][_0x98f8('0x8d')][_0x98f8('0x8e')]})['then'](function(_0x1fe448){if(_0x1fe448[_0x98f8('0x50')]===0x1){return _0x19f1fa['id'];}else{var _0x20f14c=_[_0x98f8('0x8f')](_[_0x98f8('0x44')](_0x1fe448,'TeamId'),function(_0x323c6d){return _[_0x98f8('0x90')](_0x2b98e8,_0x323c6d);});if(_0x20f14c){return _0x19f1fa['id'];}}}));}}return BPromise[_0x98f8('0x91')](_0x4c2cc6)[_0x98f8('0x3e')](function(_0x159086){_0x5ea535=_(_0x5ea535)[_0x98f8('0x92')](_0x159086)[_0x98f8('0x93')]()[_0x98f8('0x94')]();return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0x3ac8a1[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](function(_0x4a91ad){return db[_0x98f8('0x8c')][_0x98f8('0x7e')](function(_0x1c6ce5){return _0x4a91ad[_0x98f8('0x81')](_0x3ac8a1[_0x98f8('0x4a')]['ids'],{'transaction':_0x1c6ce5})[_0x98f8('0x3e')](function(){if(!_['isEmpty'](_0x5ea535)){return _0x4a91ad[_0x98f8('0x95')](_0x5ea535,{'transaction':_0x1c6ce5});}})['then'](function(){_0x5ea535[_0x98f8('0x96')](function(_0x557fd3){socket[_0x98f8('0x80')](_0x98f8('0x97'),{'UserId':_0x557fd3,'ChatQueueId':_0x4a91ad['id']});});});});});});})[_0x98f8('0x3e')](respondWithStatusCode(_0x5ce81e,null))[_0x98f8('0x30')](handleError(_0x5ce81e,null));};exports[_0x98f8('0x98')]=function(_0x5b3bd2,_0x4ee87a,_0x154245){return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0x5b3bd2[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x4ee87a,null))[_0x98f8('0x3e')](function(_0x41590a){if(_0x41590a){return _0x41590a[_0x98f8('0x98')](_0x5b3bd2['body']['ids'],_['omit'](_0x5b3bd2[_0x98f8('0x5f')],['ids','id'])||{})[_0x98f8('0x99')](function(_0x14de40){for(var _0x15d4b9=0x0;_0x15d4b9<_0x5b3bd2[_0x98f8('0x5f')]['ids'][_0x98f8('0x50')];_0x15d4b9+=0x1){socket[_0x98f8('0x80')]('userChatQueue:save',{'UserId':_0x5b3bd2[_0x98f8('0x5f')][_0x98f8('0x78')][_0x15d4b9],'ChatQueueId':_0x5b3bd2['params']['id']});}return _0x14de40;});}})[_0x98f8('0x3e')](respondWithResult(_0x4ee87a,null))[_0x98f8('0x30')](handleError(_0x4ee87a,null));};exports[_0x98f8('0x95')]=function(_0x26d2f8,_0xa4e3d9,_0x4b0b40){return db[_0x98f8('0x45')][_0x98f8('0x5d')]({'where':{'id':_0x26d2f8[_0x98f8('0x67')]['id']}})['then'](handleEntityNotFound(_0xa4e3d9,null))['then'](function(_0x5c08db){if(_0x5c08db){return _0x5c08db[_0x98f8('0x95')](_0x26d2f8[_0x98f8('0x4a')]['ids'])[_0x98f8('0x3e')](function(){if(_[_0x98f8('0x9a')](_0x26d2f8[_0x98f8('0x4a')][_0x98f8('0x78')])){for(var _0x22a43c=0x0;_0x22a43c<_0x26d2f8['query'][_0x98f8('0x78')][_0x98f8('0x50')];_0x22a43c+=0x1){socket[_0x98f8('0x80')](_0x98f8('0x97'),{'UserId':Number(_0x26d2f8['query'][_0x98f8('0x78')][_0x22a43c]),'ChatQueueId':Number(_0x26d2f8[_0x98f8('0x67')]['id'])});}}else{socket[_0x98f8('0x80')]('userChatQueue:remove',{'UserId':Number(_0x26d2f8['query'][_0x98f8('0x78')]),'ChatQueueId':Number(_0x26d2f8['params']['id'])});}});}})[_0x98f8('0x3e')](respondWithStatusCode(_0xa4e3d9,null))[_0x98f8('0x30')](handleError(_0xa4e3d9,null));};exports['getAgents']=function(_0x43c9b3,_0x20f042,_0xe0f634){var _0x264b2c={};var _0xab7af5={};var _0x4323ae;var _0x126d9e;return db['ChatQueue']['findOne']({'where':{'id':_0x43c9b3[_0x98f8('0x67')]['id']}})[_0x98f8('0x3e')](handleEntityNotFound(_0x20f042,null))[_0x98f8('0x3e')](function(_0x43d622){if(_0x43d622){_0x4323ae=_0x43d622;_0xab7af5[_0x98f8('0x49')]=_[_0x98f8('0x4b')](db['User']['rawAttributes']);_0xab7af5[_0x98f8('0x4a')]=_[_0x98f8('0x4b')](_0x43c9b3[_0x98f8('0x4a')]);_0xab7af5['filters']=_[_0x98f8('0x4d')](_0xab7af5['model'],_0xab7af5[_0x98f8('0x4a')]);_0x264b2c[_0x98f8('0x4e')]=_[_0x98f8('0x4d')](_0xab7af5[_0x98f8('0x49')],qs[_0x98f8('0x4f')](_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x4f')]));_0x264b2c[_0x98f8('0x4e')]=_0x264b2c[_0x98f8('0x4e')]['length']?_0x264b2c[_0x98f8('0x4e')]:_0xab7af5[_0x98f8('0x49')];_0x264b2c['order']=qs[_0x98f8('0x52')](_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x52')]);_0x264b2c['where']=qs[_0x98f8('0x4c')](_['pick'](_0x43c9b3[_0x98f8('0x4a')],_0xab7af5['filters']));if(_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x54')]){_0x264b2c[_0x98f8('0x53')]=_[_0x98f8('0x56')](_0x264b2c[_0x98f8('0x53')],{'$or':_[_0x98f8('0x44')](_0x264b2c[_0x98f8('0x4e')],function(_0x4a080d){var _0x3af1b3={};_0x3af1b3[_0x4a080d]={'$like':'%'+_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x54')]+'%'};return _0x3af1b3;})});}_0x264b2c=_[_0x98f8('0x56')]({},_0x264b2c,_0x43c9b3[_0x98f8('0x5c')]);return _0x4323ae[_0x98f8('0x9b')](_0x264b2c);}})[_0x98f8('0x3e')](function(_0x51b8ee){if(_0x51b8ee){_0x126d9e=_0x51b8ee[_0x98f8('0x50')];if(!_0x43c9b3[_0x98f8('0x4a')]['hasOwnProperty']('nolimit')){_0x264b2c[_0x98f8('0x37')]=qs['limit'](_0x43c9b3['query']['limit']);_0x264b2c[_0x98f8('0x36')]=qs[_0x98f8('0x36')](_0x43c9b3[_0x98f8('0x4a')][_0x98f8('0x36')]);}return _0x4323ae[_0x98f8('0x9b')](_0x264b2c);}})[_0x98f8('0x3e')](function(_0xa8e943){if(_0xa8e943){return _0xa8e943?{'count':_0x126d9e,'rows':_0xa8e943}:null;}})['then'](respondWithResult(_0x20f042,null))[_0x98f8('0x30')](handleError(_0x20f042,null));}; \ No newline at end of file +var _0x7cd6=['fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','keys','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','User','findAndCountAll','agent','chatPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','ids','Agents','online','flatMap','addTeams','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','all','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.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','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','type','model','query','filters','intersection','attributes'];(function(_0xfc11ac,_0x483039){var _0x26599b=function(_0x1c3fac){while(--_0x1c3fac){_0xfc11ac['push'](_0xfc11ac['shift']());}};_0x26599b(++_0x483039);}(_0x7cd6,0x17b));var _0x67cd=function(_0x488355,_0x31ad2e){_0x488355=_0x488355-0x0;var _0x3cc6ca=_0x7cd6[_0x488355];return _0x3cc6ca;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x67cd('0x0'));var zipdir=require(_0x67cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67cd('0x2'));var moment=require(_0x67cd('0x3'));var BPromise=require(_0x67cd('0x4'));var Mustache=require(_0x67cd('0x5'));var util=require(_0x67cd('0x6'));var path=require(_0x67cd('0x7'));var sox=require(_0x67cd('0x8'));var csv=require(_0x67cd('0x9'));var ejs=require(_0x67cd('0xa'));var fs=require('fs');var _=require(_0x67cd('0xb'));var squel=require('squel');var crypto=require(_0x67cd('0xc'));var jsforce=require(_0x67cd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x67cd('0x9'));var querystring=require('querystring');var Papa=require(_0x67cd('0xe'));var Redis=require(_0x67cd('0xf'));var authService=require(_0x67cd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x67cd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67cd('0x12'))(_0x67cd('0x13'));var utils=require(_0x67cd('0x14'));var config=require(_0x67cd('0x15'));var db=require(_0x67cd('0x16'))['db'];config[_0x67cd('0x17')]=_[_0x67cd('0x18')](config[_0x67cd('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x67cd('0x19'))(new Redis(config[_0x67cd('0x17')]));require(_0x67cd('0x1a'))[_0x67cd('0x1b')](socket);var jayson=require(_0x67cd('0x1c'));var client=jayson['client'][_0x67cd('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3cd186,_0x43d3b8,_0x1ccf19){if(_0x1ccf19){var _0x36d370=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36d370[_0x67cd('0x1e')](_0x43d3b8)){return _0x3cd186;}else{throw new db[(_0x67cd('0x1f'))][(_0x67cd('0x20'))](_0x67cd('0x21'));}}else{return _0x3cd186;}}function respondWithRpcPromise(_0x195166,_0x3332a7,_0x5f140d,_0x66097c){return new BPromise(function(_0x29e9a2,_0x595ffb){var _0x2ce3ab=_0x66097c||client;return _0x2ce3ab[_0x67cd('0x22')](_0x195166,_0x5f140d)[_0x67cd('0x23')](function(_0x66c9bc){logger['info'](_0x67cd('0x24'),_0x3332a7,_0x67cd('0x25'));logger[_0x67cd('0x26')](_0x67cd('0x27'),_0x3332a7,_0x67cd('0x25'),JSON[_0x67cd('0x28')](_0x66c9bc));if(_0x66c9bc['error']){if(_0x66c9bc[_0x67cd('0x29')][_0x67cd('0x2a')]===0x1f4){logger[_0x67cd('0x29')](_0x67cd('0x24'),_0x3332a7,_0x66c9bc[_0x67cd('0x29')]['message']);return _0x595ffb(_0x66c9bc[_0x67cd('0x29')]['message']);}logger[_0x67cd('0x29')]('ChatQueue,\x20%s,\x20%s',_0x3332a7,_0x66c9bc[_0x67cd('0x29')][_0x67cd('0x2b')]);return _0x29e9a2(_0x66c9bc[_0x67cd('0x29')][_0x67cd('0x2b')]);}else{logger[_0x67cd('0x2c')]('ChatQueue,\x20%s,\x20%s',_0x3332a7,'request\x20sent');_0x29e9a2(_0x66c9bc['result']['message']);}})[_0x67cd('0x2d')](function(_0x332988){logger[_0x67cd('0x29')](_0x67cd('0x24'),_0x3332a7,_0x332988);_0x595ffb(_0x332988);});});}function respondWithStatusCode(_0x1346b1,_0x1f8f15){_0x1f8f15=_0x1f8f15||0xcc;return function(_0x968e5e){if(_0x968e5e){return _0x1346b1[_0x67cd('0x2e')](_0x1f8f15);}return _0x1346b1['status'](_0x1f8f15)[_0x67cd('0x2f')]();};}function respondWithResult(_0x277ec6,_0x46efd1){_0x46efd1=_0x46efd1||0xc8;return function(_0x26e18b){if(_0x26e18b){return _0x277ec6[_0x67cd('0x30')](_0x46efd1)[_0x67cd('0x31')](_0x26e18b);}};}function respondWithFilteredResult(_0x47eda2,_0x1f4c1d){return function(_0x394595){if(_0x394595){var _0x15c5a8=_0x394595[_0x67cd('0x32')],_0x2cc8b3=_0x1f4c1d[_0x67cd('0x33')],_0x8587ae=_0x1f4c1d['offset']+_0x1f4c1d[_0x67cd('0x34')],_0x473964;if(_0x8587ae>=_0x15c5a8){_0x8587ae=_0x15c5a8;_0x473964=0xc8;}else{_0x473964=0xce;}_0x47eda2[_0x67cd('0x30')](_0x473964);return _0x47eda2['set'](_0x67cd('0x35'),_0x2cc8b3+'-'+_0x8587ae+'/'+_0x15c5a8)[_0x67cd('0x31')](_0x394595);}return null;};}function patchUpdates(_0x2456e2){return function(_0x49053e){try{jsonpatch['apply'](_0x49053e,_0x2456e2,!![]);}catch(_0x4a359b){return BPromise[_0x67cd('0x36')](_0x4a359b);}return _0x49053e[_0x67cd('0x37')]();};}function saveUpdates(_0x3d97ea,_0x4d63ad){return function(_0x328448){if(_0x328448){return _0x328448[_0x67cd('0x38')](_0x3d97ea)['then'](function(_0x5d144a){return _0x5d144a;});}return null;};}function removeEntity(_0x4d0a93,_0x27433c){return function(_0x25bda3){if(_0x25bda3){return _0x25bda3[_0x67cd('0x39')]()[_0x67cd('0x23')](function(){var _0x3fd973=_0x25bda3[_0x67cd('0x3a')]({'plain':!![]});var _0x455447=_0x67cd('0x3b');return db[_0x67cd('0x3c')][_0x67cd('0x39')]({'where':{'type':_0x455447,'resourceId':_0x3fd973['id']}})[_0x67cd('0x23')](function(){return _0x25bda3;});})[_0x67cd('0x23')](function(){_0x4d0a93['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13a1a6,_0xfda4b8){return function(_0x273b90){if(!_0x273b90){_0x13a1a6['sendStatus'](0x194);}return _0x273b90;};}function handleError(_0x2ef2d0,_0x17b6de){_0x17b6de=_0x17b6de||0x1f4;return function(_0x346210){logger[_0x67cd('0x29')](_0x346210[_0x67cd('0x3d')]);if(_0x346210[_0x67cd('0x3e')]){delete _0x346210[_0x67cd('0x3e')];}_0x2ef2d0[_0x67cd('0x30')](_0x17b6de)[_0x67cd('0x3f')](_0x346210);};}exports[_0x67cd('0x40')]=function(_0x5dba18,_0x1ac54d){var _0x7f5841={},_0x4b93e0={},_0x3fd77c={'count':0x0,'rows':[]};var _0x362dc5=_[_0x67cd('0x41')](db[_0x67cd('0x42')][_0x67cd('0x43')],function(_0x3f5760){return{'name':_0x3f5760['fieldName'],'type':_0x3f5760[_0x67cd('0x44')]['key']};});_0x4b93e0[_0x67cd('0x45')]=_[_0x67cd('0x41')](_0x362dc5,_0x67cd('0x3e'));_0x4b93e0[_0x67cd('0x46')]=_['keys'](_0x5dba18[_0x67cd('0x46')]);_0x4b93e0[_0x67cd('0x47')]=_[_0x67cd('0x48')](_0x4b93e0[_0x67cd('0x45')],_0x4b93e0['query']);_0x7f5841[_0x67cd('0x49')]=_[_0x67cd('0x48')](_0x4b93e0[_0x67cd('0x45')],qs[_0x67cd('0x4a')](_0x5dba18[_0x67cd('0x46')][_0x67cd('0x4a')]));_0x7f5841[_0x67cd('0x49')]=_0x7f5841[_0x67cd('0x49')][_0x67cd('0x4b')]?_0x7f5841[_0x67cd('0x49')]:_0x4b93e0[_0x67cd('0x45')];if(!_0x5dba18[_0x67cd('0x46')]['hasOwnProperty'](_0x67cd('0x4c'))){_0x7f5841[_0x67cd('0x34')]=qs[_0x67cd('0x34')](_0x5dba18[_0x67cd('0x46')]['limit']);_0x7f5841[_0x67cd('0x33')]=qs[_0x67cd('0x33')](_0x5dba18[_0x67cd('0x46')]['offset']);}_0x7f5841[_0x67cd('0x4d')]=qs[_0x67cd('0x4e')](_0x5dba18['query']['sort']);_0x7f5841[_0x67cd('0x4f')]=qs['filters'](_[_0x67cd('0x50')](_0x5dba18['query'],_0x4b93e0['filters']),_0x362dc5);if(_0x5dba18['query']['filter']){_0x7f5841[_0x67cd('0x4f')]=_['merge'](_0x7f5841[_0x67cd('0x4f')],{'$or':_[_0x67cd('0x41')](_0x362dc5,function(_0x2f1763){if(_0x2f1763[_0x67cd('0x44')]!==_0x67cd('0x51')){var _0x36d59b={};_0x36d59b[_0x2f1763[_0x67cd('0x3e')]]={'$like':'%'+_0x5dba18[_0x67cd('0x46')][_0x67cd('0x52')]+'%'};return _0x36d59b;}})});}_0x7f5841=_['merge']({},_0x7f5841,_0x5dba18[_0x67cd('0x53')]);var _0x4f3372={'where':_0x7f5841[_0x67cd('0x4f')]};return db[_0x67cd('0x42')]['count'](_0x4f3372)[_0x67cd('0x23')](function(_0x68b66f){_0x3fd77c['count']=_0x68b66f;if(_0x5dba18[_0x67cd('0x46')][_0x67cd('0x54')]){_0x7f5841[_0x67cd('0x55')]=[{'all':!![]}];}return db[_0x67cd('0x42')][_0x67cd('0x56')](_0x7f5841);})[_0x67cd('0x23')](function(_0x333908){_0x3fd77c[_0x67cd('0x57')]=_0x333908;return _0x3fd77c;})[_0x67cd('0x23')](respondWithFilteredResult(_0x1ac54d,_0x7f5841))[_0x67cd('0x2d')](handleError(_0x1ac54d,null));};exports['show']=function(_0x47acd4,_0x83d724){var _0x237868={'raw':!![],'where':{'id':_0x47acd4['params']['id']}},_0x467c81={};_0x467c81[_0x67cd('0x45')]=_[_0x67cd('0x58')](db['ChatQueue'][_0x67cd('0x43')]);_0x467c81['query']=_['keys'](_0x47acd4['query']);_0x467c81['filters']=_[_0x67cd('0x48')](_0x467c81[_0x67cd('0x45')],_0x467c81['query']);_0x237868[_0x67cd('0x49')]=_['intersection'](_0x467c81['model'],qs['fields'](_0x47acd4[_0x67cd('0x46')]['fields']));_0x237868['attributes']=_0x237868[_0x67cd('0x49')][_0x67cd('0x4b')]?_0x237868[_0x67cd('0x49')]:_0x467c81[_0x67cd('0x45')];if(_0x47acd4[_0x67cd('0x46')][_0x67cd('0x54')]){_0x237868[_0x67cd('0x55')]=[{'all':!![]}];}_0x237868=_[_0x67cd('0x59')]({},_0x237868,_0x47acd4[_0x67cd('0x53')]);return db['ChatQueue'][_0x67cd('0x5a')](_0x237868)[_0x67cd('0x23')](handleEntityNotFound(_0x83d724,null))[_0x67cd('0x23')](respondWithResult(_0x83d724,null))[_0x67cd('0x2d')](handleError(_0x83d724,null));};exports['create']=function(_0x262a1c,_0x1e9451){return db[_0x67cd('0x42')][_0x67cd('0x5b')](_0x262a1c[_0x67cd('0x5c')],{})[_0x67cd('0x23')](function(_0x19fbfb){var _0x216aaa=_0x262a1c[_0x67cd('0x5d')]['get']({'plain':!![]});if(!_0x216aaa)throw new Error(_0x67cd('0x5e'));if(_0x216aaa['role']==='user'){var _0x31b275=_0x19fbfb[_0x67cd('0x3a')]({'plain':!![]});var _0x3b5a7f=_0x67cd('0x3b');return db['UserProfileSection'][_0x67cd('0x5a')]({'where':{'name':_0x3b5a7f,'userProfileId':_0x216aaa[_0x67cd('0x5f')]},'raw':!![]})[_0x67cd('0x23')](function(_0x4061f5){if(_0x4061f5&&_0x4061f5[_0x67cd('0x60')]===0x0){return db[_0x67cd('0x3c')][_0x67cd('0x5b')]({'name':_0x31b275[_0x67cd('0x3e')],'resourceId':_0x31b275['id'],'type':_0x4061f5[_0x67cd('0x3e')],'sectionId':_0x4061f5['id']},{})[_0x67cd('0x23')](function(){return _0x19fbfb;});}else{return _0x19fbfb;}})[_0x67cd('0x2d')](function(_0x161172){logger[_0x67cd('0x29')](_0x67cd('0x61'),_0x161172);throw _0x161172;});}return _0x19fbfb;})['then'](respondWithResult(_0x1e9451,0xc9))[_0x67cd('0x2d')](handleError(_0x1e9451,null));};exports[_0x67cd('0x38')]=function(_0x200878,_0x437199){if(_0x200878[_0x67cd('0x5c')]['id']){delete _0x200878[_0x67cd('0x5c')]['id'];}return db['ChatQueue'][_0x67cd('0x5a')]({'where':{'id':_0x200878[_0x67cd('0x62')]['id']}})['then'](handleEntityNotFound(_0x437199,null))[_0x67cd('0x23')](saveUpdates(_0x200878['body'],null))[_0x67cd('0x23')](respondWithResult(_0x437199,null))[_0x67cd('0x2d')](handleError(_0x437199,null));};exports['destroy']=function(_0x910fa4,_0x5bd033){return db['ChatQueue'][_0x67cd('0x5a')]({'where':{'id':_0x910fa4['params']['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x5bd033,null))[_0x67cd('0x23')](removeEntity(_0x5bd033,null))[_0x67cd('0x2d')](handleError(_0x5bd033,null));};exports[_0x67cd('0x63')]=function(_0x52da8f,_0x145923){return db[_0x67cd('0x42')][_0x67cd('0x63')]()[_0x67cd('0x23')](respondWithResult(_0x145923,null))[_0x67cd('0x2d')](handleError(_0x145923,null));};exports[_0x67cd('0x64')]=function(_0x427a52,_0x5d927d,_0x56152e){var _0x1cba72={'raw':!![],'where':{}},_0x4949f2={},_0x312195;return db['ChatQueue'][_0x67cd('0x65')]({'where':{'id':_0x427a52[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x5d927d,null))[_0x67cd('0x23')](function(_0x117348){if(_0x117348){_0x312195=_0x117348['get']({'plain':!![]});_0x4949f2['model']=_['keys'](db[_0x67cd('0x66')][_0x67cd('0x43')]);_0x4949f2[_0x67cd('0x46')]=_[_0x67cd('0x58')](_0x427a52['query']);_0x4949f2[_0x67cd('0x47')]=_[_0x67cd('0x48')](_0x4949f2[_0x67cd('0x45')],_0x4949f2['query']);_0x1cba72[_0x67cd('0x49')]=_[_0x67cd('0x48')](_0x4949f2[_0x67cd('0x45')],qs[_0x67cd('0x4a')](_0x427a52[_0x67cd('0x46')][_0x67cd('0x4a')]));_0x1cba72[_0x67cd('0x49')]=_0x1cba72[_0x67cd('0x49')][_0x67cd('0x4b')]?_0x1cba72[_0x67cd('0x49')]:_0x4949f2[_0x67cd('0x45')];if(!_0x427a52['query'][_0x67cd('0x67')](_0x67cd('0x4c'))){_0x1cba72[_0x67cd('0x34')]=qs['limit'](_0x427a52[_0x67cd('0x46')][_0x67cd('0x34')]);_0x1cba72['offset']=qs[_0x67cd('0x33')](_0x427a52[_0x67cd('0x46')][_0x67cd('0x33')]);}_0x1cba72['order']=qs[_0x67cd('0x4e')](_0x427a52[_0x67cd('0x46')]['sort']);_0x1cba72[_0x67cd('0x4f')]=qs[_0x67cd('0x47')](_[_0x67cd('0x50')](_0x427a52[_0x67cd('0x46')],_0x4949f2[_0x67cd('0x47')]));_0x1cba72[_0x67cd('0x4f')]['ChatQueueId']=_0x117348['id'];if(_0x427a52[_0x67cd('0x46')][_0x67cd('0x52')]){_0x1cba72[_0x67cd('0x4f')]=_[_0x67cd('0x59')](_0x1cba72[_0x67cd('0x4f')],{'$or':_[_0x67cd('0x41')](_0x1cba72['attributes'],function(_0x1cb2eb){var _0x5a4c53={};_0x5a4c53[_0x1cb2eb]={'$like':'%'+_0x427a52[_0x67cd('0x46')][_0x67cd('0x52')]+'%'};return _0x5a4c53;})});}_0x1cba72=_[_0x67cd('0x59')]({},_0x1cba72,_0x427a52['options']);return db[_0x67cd('0x66')][_0x67cd('0x56')](_0x1cba72);}})[_0x67cd('0x23')](function(_0x3efac4){if(_0x3efac4){return db[_0x67cd('0x68')][_0x67cd('0x69')]({'where':{'id':_[_0x67cd('0x41')](_0x3efac4,'UserId'),'role':_0x67cd('0x6a')},'attributes':['id',_0x67cd('0x3e'),_0x67cd('0x6b'),'updatedAt',_0x67cd('0x6c')]});}})[_0x67cd('0x23')](function(_0x2507ed){if(_0x2507ed){return{'count':_0x2507ed['count'],'rows':_[_0x67cd('0x41')](_0x2507ed[_0x67cd('0x57')],function(_0x5ad0bf){return{'membername':_0x5ad0bf[_0x67cd('0x3e')],'UserId':_0x5ad0bf['id'],'queue_name':_0x312195[_0x67cd('0x3e')],'ChatQueueId':_0x312195['id'],'interface':util['format'](_0x67cd('0x6d'),_0x67cd('0x6e'),_0x5ad0bf['name']),'penalty':0x0,'paused':_0x5ad0bf[_0x67cd('0x6b')],'createdAt':_0x5ad0bf['createdAt'],'updatedAt':_0x5ad0bf[_0x67cd('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x67cd('0x23')](respondWithFilteredResult(_0x5d927d,_0x1cba72))[_0x67cd('0x2d')](handleError(_0x5d927d,null));};exports[_0x67cd('0x70')]=function(_0x5282f4,_0x530f19,_0x2ebf1f){var _0xf763d9={};var _0xcff72b={};var _0x7aab89;var _0xa0fd00;return db[_0x67cd('0x42')][_0x67cd('0x65')]({'where':{'id':_0x5282f4[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x530f19,null))['then'](function(_0x37f8b5){if(_0x37f8b5){_0x7aab89=_0x37f8b5;_0xcff72b[_0x67cd('0x45')]=_[_0x67cd('0x58')](db[_0x67cd('0x71')]['rawAttributes']);_0xcff72b[_0x67cd('0x46')]=_[_0x67cd('0x58')](_0x5282f4[_0x67cd('0x46')]);_0xcff72b['filters']=_[_0x67cd('0x48')](_0xcff72b['model'],_0xcff72b[_0x67cd('0x46')]);_0xf763d9[_0x67cd('0x49')]=_['intersection'](_0xcff72b[_0x67cd('0x45')],qs[_0x67cd('0x4a')](_0x5282f4[_0x67cd('0x46')][_0x67cd('0x4a')]));_0xf763d9[_0x67cd('0x49')]=_0xf763d9['attributes']['length']?_0xf763d9[_0x67cd('0x49')]:_0xcff72b[_0x67cd('0x45')];_0xf763d9['order']=qs[_0x67cd('0x4e')](_0x5282f4[_0x67cd('0x46')][_0x67cd('0x4e')]);_0xf763d9['where']=qs[_0x67cd('0x47')](_[_0x67cd('0x50')](_0x5282f4['query'],_0xcff72b[_0x67cd('0x47')]));if(_0x5282f4[_0x67cd('0x46')][_0x67cd('0x52')]){_0xf763d9['where']=_['merge'](_0xf763d9[_0x67cd('0x4f')],{'$or':_[_0x67cd('0x41')](_0xf763d9[_0x67cd('0x49')],function(_0x4daf2a){var _0x129ca2={};_0x129ca2[_0x4daf2a]={'$like':'%'+_0x5282f4[_0x67cd('0x46')][_0x67cd('0x52')]+'%'};return _0x129ca2;})});}_0xf763d9=_[_0x67cd('0x59')]({},_0xf763d9,_0x5282f4['options']);return _0x7aab89[_0x67cd('0x70')](_0xf763d9);}})[_0x67cd('0x23')](function(_0x13ed2c){if(_0x13ed2c){_0xa0fd00=_0x13ed2c[_0x67cd('0x4b')];if(!_0x5282f4['query']['hasOwnProperty'](_0x67cd('0x4c'))){_0xf763d9['limit']=qs[_0x67cd('0x34')](_0x5282f4[_0x67cd('0x46')][_0x67cd('0x34')]);_0xf763d9[_0x67cd('0x33')]=qs[_0x67cd('0x33')](_0x5282f4[_0x67cd('0x46')]['offset']);}return _0x7aab89[_0x67cd('0x70')](_0xf763d9);}})[_0x67cd('0x23')](function(_0x1f66ee){if(_0x1f66ee){return _0x1f66ee?{'count':_0xa0fd00,'rows':_0x1f66ee}:null;}})[_0x67cd('0x23')](respondWithResult(_0x530f19,null))[_0x67cd('0x2d')](handleError(_0x530f19,null));};exports['addTeams']=function(_0x296a5d,_0x36d848,_0x598e1a){var _0x5d584b=_0x296a5d['body'][_0x67cd('0x72')];return db[_0x67cd('0x71')][_0x67cd('0x56')]({'where':{'id':_0x5d584b},'attributes':['id'],'include':[{'model':db[_0x67cd('0x68')],'as':_0x67cd('0x73'),'attributes':['id',_0x67cd('0x3e'),_0x67cd('0x74'),'voicePause','interface'],'raw':!![]}]})[_0x67cd('0x23')](function(_0x3feda4){if(_0x3feda4){var _0x138600=_[_0x67cd('0x75')](_0x3feda4,function(_0x1e8dec){var _0x4da441=_0x1e8dec[_0x67cd('0x3a')]({'plain':!![]});return _0x4da441[_0x67cd('0x73')];});return db[_0x67cd('0x42')][_0x67cd('0x5a')]({'where':{'id':_0x296a5d[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](function(_0x1439f4){return db['sequelize']['transaction'](function(_0x493a15){return _0x1439f4[_0x67cd('0x76')](_0x5d584b,{'transaction':_0x493a15})['then'](function(){return BPromise[_0x67cd('0x77')](_0x138600,function(_0x5c5eaf){return db[_0x67cd('0x66')][_0x67cd('0x78')]({'where':{'UserId':_0x5c5eaf['id'],'ChatQueueId':_0x296a5d['params']['id']},'transaction':_0x493a15});});})['then'](function(){_0x138600[_0x67cd('0x79')](function(_0x5275af){socket[_0x67cd('0x7a')]('userChatQueue:save',{'UserId':_0x5275af['id'],'ChatQueueId':_0x1439f4['id']});});});});});}})[_0x67cd('0x23')](respondWithStatusCode(_0x36d848,null))[_0x67cd('0x2d')](handleError(_0x36d848,null));};exports['removeTeams']=function(_0x4fb69e,_0x55eac2,_0x11b88c){return db['Team'][_0x67cd('0x56')]({'where':{'id':_0x4fb69e['query'][_0x67cd('0x72')]},'attributes':['id'],'include':[{'model':db[_0x67cd('0x68')],'as':_0x67cd('0x73'),'attributes':['id'],'raw':!![]}]})[_0x67cd('0x23')](handleEntityNotFound(_0x55eac2,null))['then'](function(_0x110d41){var _0x549fb0=_[_0x67cd('0x41')](_0x110d41,'id');var _0x1d8b7b=[];var _0x129fd7=[];var _0x287879=squel[_0x67cd('0x7b')]();_0x287879[_0x67cd('0x7c')](_0x67cd('0x7d'))[_0x67cd('0x7e')](_0x67cd('0x7f'),'tq')[_0x67cd('0x80')](_0x67cd('0x81'),'ut',_0x67cd('0x82'))['where'](_0x67cd('0x83'),_0x4fb69e[_0x67cd('0x62')]['id']);for(var _0xd9fc60=0x0;_0xd9fc60<_0x110d41[_0x67cd('0x4b')];_0xd9fc60+=0x1){let _0x139e9d=_0x110d41[_0xd9fc60];for(var _0x4ed96f=0x0;_0x4ed96f<_0x139e9d['Agents'][_0x67cd('0x4b')];_0x4ed96f+=0x1){let _0x313e3d=_0x139e9d[_0x67cd('0x73')][_0x4ed96f];var _0x452290=_0x287879[_0x67cd('0x84')]();_0x452290[_0x67cd('0x4f')](_0x67cd('0x85'),_0x313e3d['id']);_0x129fd7[_0x67cd('0x86')](db[_0x67cd('0x87')]['query'](_0x452290[_0x67cd('0x88')](),{'type':db['sequelize']['QueryTypes'][_0x67cd('0x89')]})[_0x67cd('0x23')](function(_0x2b233d){if(_0x2b233d[_0x67cd('0x4b')]===0x1){return _0x313e3d['id'];}else{var _0x19a0fa=_[_0x67cd('0x8a')](_[_0x67cd('0x41')](_0x2b233d,'TeamId'),function(_0x27fdfd){return _['includes'](_0x549fb0,_0x27fdfd);});if(_0x19a0fa){return _0x313e3d['id'];}}}));}}return BPromise[_0x67cd('0x8b')](_0x129fd7)['then'](function(_0x73887f){_0x1d8b7b=_(_0x1d8b7b)['union'](_0x73887f)[_0x67cd('0x8c')]()[_0x67cd('0x8d')]();return db['ChatQueue'][_0x67cd('0x5a')]({'where':{'id':_0x4fb69e[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](function(_0x329dfb){return db[_0x67cd('0x87')][_0x67cd('0x8e')](function(_0x160f30){return _0x329dfb['removeTeams'](_0x4fb69e[_0x67cd('0x46')][_0x67cd('0x72')],{'transaction':_0x160f30})['then'](function(){if(!_[_0x67cd('0x8f')](_0x1d8b7b)){return _0x329dfb[_0x67cd('0x90')](_0x1d8b7b,{'transaction':_0x160f30});}})[_0x67cd('0x23')](function(){_0x1d8b7b[_0x67cd('0x79')](function(_0x24fba3){socket[_0x67cd('0x7a')]('userChatQueue:remove',{'UserId':_0x24fba3,'ChatQueueId':_0x329dfb['id']});});});});});});})[_0x67cd('0x23')](respondWithStatusCode(_0x55eac2,null))['catch'](handleError(_0x55eac2,null));};exports[_0x67cd('0x91')]=function(_0x5327ec,_0x5c6fcf,_0x457efd){return db[_0x67cd('0x42')][_0x67cd('0x5a')]({'where':{'id':_0x5327ec[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x5c6fcf,null))[_0x67cd('0x23')](function(_0x1dbd67){if(_0x1dbd67){return _0x1dbd67[_0x67cd('0x91')](_0x5327ec[_0x67cd('0x5c')][_0x67cd('0x72')],_[_0x67cd('0x92')](_0x5327ec['body'],[_0x67cd('0x72'),'id'])||{})[_0x67cd('0x93')](function(_0x17da88){for(var _0x58cfc9=0x0;_0x58cfc9<_0x5327ec[_0x67cd('0x5c')]['ids'][_0x67cd('0x4b')];_0x58cfc9+=0x1){socket[_0x67cd('0x7a')]('userChatQueue:save',{'UserId':_0x5327ec[_0x67cd('0x5c')][_0x67cd('0x72')][_0x58cfc9],'ChatQueueId':_0x5327ec['params']['id']});}return _0x17da88;});}})[_0x67cd('0x23')](respondWithResult(_0x5c6fcf,null))[_0x67cd('0x2d')](handleError(_0x5c6fcf,null));};exports['removeAgents']=function(_0x55a748,_0x405ff9,_0x47351c){return db[_0x67cd('0x42')][_0x67cd('0x5a')]({'where':{'id':_0x55a748[_0x67cd('0x62')]['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0x405ff9,null))['then'](function(_0x5df0e5){if(_0x5df0e5){return _0x5df0e5[_0x67cd('0x90')](_0x55a748['query'][_0x67cd('0x72')])[_0x67cd('0x23')](function(){if(_[_0x67cd('0x94')](_0x55a748[_0x67cd('0x46')][_0x67cd('0x72')])){for(var _0x20ccfa=0x0;_0x20ccfa<_0x55a748[_0x67cd('0x46')][_0x67cd('0x72')][_0x67cd('0x4b')];_0x20ccfa+=0x1){socket[_0x67cd('0x7a')](_0x67cd('0x95'),{'UserId':Number(_0x55a748[_0x67cd('0x46')]['ids'][_0x20ccfa]),'ChatQueueId':Number(_0x55a748[_0x67cd('0x62')]['id'])});}}else{socket[_0x67cd('0x7a')]('userChatQueue:remove',{'UserId':Number(_0x55a748['query']['ids']),'ChatQueueId':Number(_0x55a748[_0x67cd('0x62')]['id'])});}});}})[_0x67cd('0x23')](respondWithStatusCode(_0x405ff9,null))[_0x67cd('0x2d')](handleError(_0x405ff9,null));};exports['getAgents']=function(_0x450ea3,_0xf9906e,_0x38aeb3){var _0x193b31={};var _0x492884={};var _0x18f36f;var _0x33e4de;return db['ChatQueue'][_0x67cd('0x65')]({'where':{'id':_0x450ea3['params']['id']}})[_0x67cd('0x23')](handleEntityNotFound(_0xf9906e,null))[_0x67cd('0x23')](function(_0x5175a1){if(_0x5175a1){_0x18f36f=_0x5175a1;_0x492884['model']=_[_0x67cd('0x58')](db[_0x67cd('0x68')][_0x67cd('0x43')]);_0x492884['query']=_[_0x67cd('0x58')](_0x450ea3[_0x67cd('0x46')]);_0x492884[_0x67cd('0x47')]=_[_0x67cd('0x48')](_0x492884[_0x67cd('0x45')],_0x492884[_0x67cd('0x46')]);_0x193b31['attributes']=_[_0x67cd('0x48')](_0x492884['model'],qs[_0x67cd('0x4a')](_0x450ea3[_0x67cd('0x46')]['fields']));_0x193b31[_0x67cd('0x49')]=_0x193b31[_0x67cd('0x49')]['length']?_0x193b31['attributes']:_0x492884['model'];_0x193b31[_0x67cd('0x4d')]=qs[_0x67cd('0x4e')](_0x450ea3[_0x67cd('0x46')]['sort']);_0x193b31[_0x67cd('0x4f')]=qs[_0x67cd('0x47')](_[_0x67cd('0x50')](_0x450ea3['query'],_0x492884[_0x67cd('0x47')]));if(_0x450ea3[_0x67cd('0x46')][_0x67cd('0x52')]){_0x193b31['where']=_[_0x67cd('0x59')](_0x193b31[_0x67cd('0x4f')],{'$or':_[_0x67cd('0x41')](_0x193b31[_0x67cd('0x49')],function(_0x291c12){var _0x552374={};_0x552374[_0x291c12]={'$like':'%'+_0x450ea3[_0x67cd('0x46')][_0x67cd('0x52')]+'%'};return _0x552374;})});}_0x193b31=_['merge']({},_0x193b31,_0x450ea3[_0x67cd('0x53')]);return _0x18f36f['getAgents'](_0x193b31);}})[_0x67cd('0x23')](function(_0x55906b){if(_0x55906b){_0x33e4de=_0x55906b[_0x67cd('0x4b')];if(!_0x450ea3['query']['hasOwnProperty'](_0x67cd('0x4c'))){_0x193b31[_0x67cd('0x34')]=qs[_0x67cd('0x34')](_0x450ea3[_0x67cd('0x46')][_0x67cd('0x34')]);_0x193b31[_0x67cd('0x33')]=qs[_0x67cd('0x33')](_0x450ea3[_0x67cd('0x46')][_0x67cd('0x33')]);}return _0x18f36f[_0x67cd('0x96')](_0x193b31);}})['then'](function(_0x139930){if(_0x139930){return _0x139930?{'count':_0x33e4de,'rows':_0x139930}:null;}})['then'](respondWithResult(_0xf9906e,null))[_0x67cd('0x2d')](handleError(_0xf9906e,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 193e142..07952d7 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(_0x3431d1,_0x4c50a8){var _0x1f5f66=function(_0x2cc566){while(--_0x2cc566){_0x3431d1['push'](_0x3431d1['shift']());}};_0x1f5f66(++_0x4c50a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x248ae1,_0x3a5e3b){_0x248ae1=_0x248ae1-0x0;var _0x29f1e9=_0x5f2f[_0x248ae1];return _0x29f1e9;};'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(_0x204583,_0x1e1986){var _0x54a7c8=function(_0x1338a7){while(--_0x1338a7){_0x204583['push'](_0x204583['shift']());}};_0x54a7c8(++_0x1e1986);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c4aef,_0x116fe2){_0x2c4aef=_0x2c4aef-0x0;var _0x3deaed=_0xb10b[_0x2c4aef];return _0x3deaed;};'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 be928c6..14ea163 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 _0x1e75=['./chatQueue.attributes','exports','define','ChatQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b44db,_0x3a027d){var _0x29a68b=function(_0x1082ab){while(--_0x1082ab){_0x4b44db['push'](_0x4b44db['shift']());}};_0x29a68b(++_0x3a027d);}(_0x1e75,0x86));var _0x51e7=function(_0x1849bb,_0x1aee37){_0x1849bb=_0x1849bb-0x0;var _0x4a12a6=_0x1e75[_0x1849bb];return _0x4a12a6;};'use strict';var _=require('lodash');var util=require(_0x51e7('0x0'));var logger=require(_0x51e7('0x1'))(_0x51e7('0x2'));var moment=require(_0x51e7('0x3'));var BPromise=require(_0x51e7('0x4'));var rp=require(_0x51e7('0x5'));var fs=require('fs');var path=require(_0x51e7('0x6'));var rimraf=require(_0x51e7('0x7'));var config=require(_0x51e7('0x8'));var attributes=require(_0x51e7('0x9'));module[_0x51e7('0xa')]=function(_0xd5fbc7,_0x3b1414){return _0xd5fbc7[_0x51e7('0xb')](_0x51e7('0xc'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e88=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatQueue','chat_queues','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9e88,0x6b));var _0x89e8=function(_0xefd729,_0x3baf6a){_0xefd729=_0xefd729-0x0;var _0x51c0de=_0x9e88[_0xefd729];return _0x51c0de;};'use strict';var _=require(_0x89e8('0x0'));var util=require(_0x89e8('0x1'));var logger=require(_0x89e8('0x2'))('api');var moment=require(_0x89e8('0x3'));var BPromise=require(_0x89e8('0x4'));var rp=require(_0x89e8('0x5'));var fs=require('fs');var path=require(_0x89e8('0x6'));var rimraf=require(_0x89e8('0x7'));var config=require(_0x89e8('0x8'));var attributes=require('./chatQueue.attributes');module[_0x89e8('0x9')]=function(_0x244b28,_0x2ed6f6){return _0x244b28['define'](_0x89e8('0xa'),attributes,{'tableName':_0x89e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index b7e6bb4..e455c48 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 _0x8e3f=['rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','map','include','model','then','ShowChatQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4a62bd,_0x5a1c68){var _0x3ac21f=function(_0x1a19c2){while(--_0x1a19c2){_0x4a62bd['push'](_0x4a62bd['shift']());}};_0x3ac21f(++_0x5a1c68);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('ChatQueue,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('ChatQueue,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});}exports[_0xf8e3('0x1c')]=function(_0x24e8d6){var _0x31f55d=this;return new Promise(function(_0x3128ad,_0x11c58e){return db[_0xf8e3('0x1d')][_0xf8e3('0x1e')]({'raw':_0x24e8d6['options']?_0x24e8d6[_0xf8e3('0x1f')][_0xf8e3('0x20')]===undefined?!![]:![]:!![],'where':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6[_0xf8e3('0x1f')]['where']||null:null,'attributes':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6['options'][_0xf8e3('0x21')]||null:null,'limit':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6[_0xf8e3('0x1f')][_0xf8e3('0x22')]||null:null,'include':_0x24e8d6[_0xf8e3('0x1f')]?_0x24e8d6[_0xf8e3('0x1f')]['include']?_[_0xf8e3('0x23')](_0x24e8d6[_0xf8e3('0x1f')][_0xf8e3('0x24')],function(_0x417b42){return{'model':db[_0x417b42[_0xf8e3('0x25')]],'as':_0x417b42['as'],'attributes':_0x417b42[_0xf8e3('0x21')],'include':_0x417b42[_0xf8e3('0x24')]?_[_0xf8e3('0x23')](_0x417b42['include'],function(_0x356e0a){return{'model':db[_0x356e0a[_0xf8e3('0x25')]],'as':_0x356e0a['as'],'attributes':_0x356e0a[_0xf8e3('0x21')],'include':_0x356e0a[_0xf8e3('0x24')]?_[_0xf8e3('0x23')](_0x356e0a[_0xf8e3('0x24')],function(_0x16485e){return{'model':db[_0x16485e[_0xf8e3('0x25')]],'as':_0x16485e['as'],'attributes':_0x16485e['attributes']};}):[]};}):[]};}):[]:[]})[_0xf8e3('0x26')](function(_0x243e28){logger[_0xf8e3('0x11')](_0xf8e3('0x1c'),_0x24e8d6);logger['debug'](_0xf8e3('0x1c'),_0x24e8d6,JSON[_0xf8e3('0x16')](_0x243e28));_0x3128ad(_0x243e28);})[_0xf8e3('0x1b')](function(_0x45df49){logger[_0xf8e3('0x17')](_0xf8e3('0x1c'),_0x45df49[_0xf8e3('0x19')],_0x24e8d6);_0x11c58e(_0x31f55d[_0xf8e3('0x17')](0x1f4,_0x45df49['message']));});});};exports[_0xf8e3('0x27')]=function(_0x527337){var _0x4acd6c=this;return new Promise(function(_0x5d2dd5,_0x5cc1ed){return db[_0xf8e3('0x1d')]['find']({'raw':_0x527337[_0xf8e3('0x1f')]?_0x527337[_0xf8e3('0x1f')][_0xf8e3('0x20')]===undefined?!![]:![]:!![],'where':_0x527337[_0xf8e3('0x1f')]?_0x527337['options']['where']||null:null,'attributes':_0x527337[_0xf8e3('0x1f')]?_0x527337[_0xf8e3('0x1f')][_0xf8e3('0x21')]||null:null,'include':_0x527337[_0xf8e3('0x1f')]?_0x527337[_0xf8e3('0x1f')][_0xf8e3('0x24')]?_['map'](_0x527337[_0xf8e3('0x1f')]['include'],function(_0x56cd7b){return{'model':db[_0x56cd7b[_0xf8e3('0x25')]],'as':_0x56cd7b['as'],'attributes':_0x56cd7b[_0xf8e3('0x21')],'include':_0x56cd7b[_0xf8e3('0x24')]?_[_0xf8e3('0x23')](_0x56cd7b['include'],function(_0x5ece46){return{'model':db[_0x5ece46[_0xf8e3('0x25')]],'as':_0x5ece46['as'],'attributes':_0x5ece46[_0xf8e3('0x21')],'include':_0x5ece46['include']?_[_0xf8e3('0x23')](_0x5ece46[_0xf8e3('0x24')],function(_0x35ac8a){return{'model':db[_0x35ac8a[_0xf8e3('0x25')]],'as':_0x35ac8a['as'],'attributes':_0x35ac8a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d307e){logger[_0xf8e3('0x11')](_0xf8e3('0x27'),_0x527337);logger[_0xf8e3('0x13')](_0xf8e3('0x27'),_0x527337,JSON['stringify'](_0x5d307e));_0x5d2dd5(_0x5d307e);})[_0xf8e3('0x1b')](function(_0x4b55fb){logger[_0xf8e3('0x17')](_0xf8e3('0x27'),_0x4b55fb[_0xf8e3('0x19')],_0x527337);_0x5cc1ed(_0x4acd6c[_0xf8e3('0x17')](0x1f4,_0x4b55fb[_0xf8e3('0x19')]));});});}; \ No newline at end of file +var _0x6f59=['./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','redis'];(function(_0x106e62,_0x304267){var _0x4d8da5=function(_0x200fc1){while(--_0x200fc1){_0x106e62['push'](_0x106e62['shift']());}};_0x4d8da5(++_0x304267);}(_0x6f59,0x1be));var _0x96f5=function(_0x47d5bf,_0x3c5c17){_0x47d5bf=_0x47d5bf-0x0;var _0x268e9f=_0x6f59[_0x47d5bf];return _0x268e9f;};'use strict';var _=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var moment=require(_0x96f5('0x2'));var BPromise=require(_0x96f5('0x3'));var rs=require(_0x96f5('0x4'));var fs=require('fs');var Redis=require(_0x96f5('0x5'));var db=require(_0x96f5('0x6'))['db'];var utils=require(_0x96f5('0x7'));var logger=require(_0x96f5('0x8'))(_0x96f5('0x9'));var config=require(_0x96f5('0xa'));var jayson=require(_0x96f5('0xb'));var client=jayson['client'][_0x96f5('0xc')]({'port':0x232a});config['redis']=_[_0x96f5('0xd')](config['redis'],{'host':_0x96f5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96f5('0xf')]));require(_0x96f5('0x10'))[_0x96f5('0x11')](socket);function respondWithRpcPromise(_0x384556,_0x5a84ba,_0x324dc6){return new BPromise(function(_0x30ac02,_0x1fd2c0){return client[_0x96f5('0x12')](_0x384556,_0x324dc6)[_0x96f5('0x13')](function(_0x45e8fc){logger[_0x96f5('0x14')](_0x96f5('0x15'),_0x5a84ba,_0x96f5('0x16'));logger[_0x96f5('0x17')](_0x96f5('0x18'),_0x5a84ba,_0x96f5('0x16'),JSON[_0x96f5('0x19')](_0x45e8fc));if(_0x45e8fc['error']){if(_0x45e8fc[_0x96f5('0x1a')][_0x96f5('0x1b')]===0x1f4){logger[_0x96f5('0x1a')](_0x96f5('0x15'),_0x5a84ba,_0x45e8fc[_0x96f5('0x1a')][_0x96f5('0x1c')]);return _0x1fd2c0(_0x45e8fc['error'][_0x96f5('0x1c')]);}logger['error'](_0x96f5('0x15'),_0x5a84ba,_0x45e8fc[_0x96f5('0x1a')][_0x96f5('0x1c')]);return _0x30ac02(_0x45e8fc[_0x96f5('0x1a')][_0x96f5('0x1c')]);}else{logger['info'](_0x96f5('0x15'),_0x5a84ba,'request\x20sent');_0x30ac02(_0x45e8fc[_0x96f5('0x1d')]['message']);}})[_0x96f5('0x1e')](function(_0x33f7d7){logger['error'](_0x96f5('0x15'),_0x5a84ba,_0x33f7d7);_0x1fd2c0(_0x33f7d7);});});}exports['GetChatQueue']=function(_0xa14bca){var _0x502341=this;return new Promise(function(_0x1637a8,_0x212f41){return db['ChatQueue'][_0x96f5('0x1f')]({'raw':_0xa14bca[_0x96f5('0x20')]?_0xa14bca[_0x96f5('0x20')][_0x96f5('0x21')]===undefined?!![]:![]:!![],'where':_0xa14bca[_0x96f5('0x20')]?_0xa14bca[_0x96f5('0x20')][_0x96f5('0x22')]||null:null,'attributes':_0xa14bca[_0x96f5('0x20')]?_0xa14bca[_0x96f5('0x20')][_0x96f5('0x23')]||null:null,'limit':_0xa14bca[_0x96f5('0x20')]?_0xa14bca['options'][_0x96f5('0x24')]||null:null,'include':_0xa14bca[_0x96f5('0x20')]?_0xa14bca[_0x96f5('0x20')][_0x96f5('0x25')]?_[_0x96f5('0x26')](_0xa14bca[_0x96f5('0x20')][_0x96f5('0x25')],function(_0x59535d){return{'model':db[_0x59535d[_0x96f5('0x27')]],'as':_0x59535d['as'],'attributes':_0x59535d['attributes'],'include':_0x59535d[_0x96f5('0x25')]?_[_0x96f5('0x26')](_0x59535d[_0x96f5('0x25')],function(_0x30d226){return{'model':db[_0x30d226[_0x96f5('0x27')]],'as':_0x30d226['as'],'attributes':_0x30d226['attributes'],'include':_0x30d226[_0x96f5('0x25')]?_[_0x96f5('0x26')](_0x30d226['include'],function(_0x5a8bb8){return{'model':db[_0x5a8bb8['model']],'as':_0x5a8bb8['as'],'attributes':_0x5a8bb8['attributes']};}):[]};}):[]};}):[]:[]})[_0x96f5('0x13')](function(_0x430470){logger[_0x96f5('0x14')]('GetChatQueue',_0xa14bca);logger['debug'](_0x96f5('0x28'),_0xa14bca,JSON[_0x96f5('0x19')](_0x430470));_0x1637a8(_0x430470);})[_0x96f5('0x1e')](function(_0x2320e2){logger['error'](_0x96f5('0x28'),_0x2320e2[_0x96f5('0x1c')],_0xa14bca);_0x212f41(_0x502341['error'](0x1f4,_0x2320e2[_0x96f5('0x1c')]));});});};exports[_0x96f5('0x29')]=function(_0x11101c){var _0x5145a6=this;return new Promise(function(_0x58ee2e,_0x5f0057){return db['ChatQueue']['find']({'raw':_0x11101c[_0x96f5('0x20')]?_0x11101c[_0x96f5('0x20')][_0x96f5('0x21')]===undefined?!![]:![]:!![],'where':_0x11101c[_0x96f5('0x20')]?_0x11101c['options']['where']||null:null,'attributes':_0x11101c[_0x96f5('0x20')]?_0x11101c['options'][_0x96f5('0x23')]||null:null,'include':_0x11101c[_0x96f5('0x20')]?_0x11101c[_0x96f5('0x20')][_0x96f5('0x25')]?_['map'](_0x11101c['options'][_0x96f5('0x25')],function(_0x11fa48){return{'model':db[_0x11fa48[_0x96f5('0x27')]],'as':_0x11fa48['as'],'attributes':_0x11fa48[_0x96f5('0x23')],'include':_0x11fa48[_0x96f5('0x25')]?_[_0x96f5('0x26')](_0x11fa48[_0x96f5('0x25')],function(_0x11e5ed){return{'model':db[_0x11e5ed['model']],'as':_0x11e5ed['as'],'attributes':_0x11e5ed[_0x96f5('0x23')],'include':_0x11e5ed['include']?_[_0x96f5('0x26')](_0x11e5ed[_0x96f5('0x25')],function(_0x426342){return{'model':db[_0x426342['model']],'as':_0x426342['as'],'attributes':_0x426342[_0x96f5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x96f5('0x13')](function(_0x13631c){logger[_0x96f5('0x14')]('ShowChatQueue',_0x11101c);logger[_0x96f5('0x17')](_0x96f5('0x29'),_0x11101c,JSON['stringify'](_0x13631c));_0x58ee2e(_0x13631c);})['catch'](function(_0x2c0922){logger[_0x96f5('0x1a')](_0x96f5('0x29'),_0x2c0922[_0x96f5('0x1c')],_0x11101c);_0x5f0057(_0x5145a6[_0x96f5('0x1a')](0x1f4,_0x2c0922[_0x96f5('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 226dc02..997259a 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x20634c,_0x5534fc){var _0x5d8936=function(_0x6b45f2){while(--_0x6b45f2){_0x20634c['push'](_0x20634c['shift']());}};_0x5d8936(++_0x5534fc);}(_0xb10b,0x12a));var _0xbb10=function(_0x58b6a8,_0x307021){_0x58b6a8=_0x58b6a8-0x0;var _0xc566dc=_0xb10b[_0x58b6a8];return _0xc566dc;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x4b6507,_0x5518b5){var _0x2001ec=function(_0x330ddf){while(--_0x330ddf){_0x4b6507['push'](_0x4b6507['shift']());}};_0x2001ec(++_0x5518b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c24bc,_0x214139){_0x4c24bc=_0x4c24bc-0x0;var _0x3e8dd5=_0x5f2f[_0x4c24bc];return _0x3e8dd5;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 12eb9d8..14ea1ab 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 _0x3e7c=['post','create','/:id/teams','addTeams','addAgents','put','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','getTeams','/:id/users','getAgents'];(function(_0x3c8d5b,_0x14c921){var _0x2d77f2=function(_0x59f2dd){while(--_0x59f2dd){_0x3c8d5b['push'](_0x3c8d5b['shift']());}};_0x2d77f2(++_0x14c921);}(_0x3e7c,0xe9));var _0xc3e7=function(_0x46f8a4,_0x340601){_0x46f8a4=_0x46f8a4-0x0;var _0x2a7199=_0x3e7c[_0x46f8a4];return _0x2a7199;};'use strict';var multer=require(_0xc3e7('0x0'));var util=require(_0xc3e7('0x1'));var path=require(_0xc3e7('0x2'));var timeout=require(_0xc3e7('0x3'));var express=require(_0xc3e7('0x4'));var router=express[_0xc3e7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc3e7('0x6'));var config=require(_0xc3e7('0x7'));var controller=require('./chatQueue.controller');router[_0xc3e7('0x8')]('/',auth['isAuthenticated'](),controller[_0xc3e7('0x9')]);router['get'](_0xc3e7('0xa'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0xc')]);router['get'](_0xc3e7('0xd'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0xe')]);router[_0xc3e7('0x8')]('/:id/members',auth[_0xc3e7('0xb')](),controller[_0xc3e7('0xf')]);router['get']('/:id/teams',auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x10')]);router[_0xc3e7('0x8')](_0xc3e7('0x11'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x12')]);router[_0xc3e7('0x13')]('/',auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x14')]);router[_0xc3e7('0x13')](_0xc3e7('0x15'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x16')]);router[_0xc3e7('0x13')](_0xc3e7('0x11'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x17')]);router[_0xc3e7('0x18')]('/:id',auth[_0xc3e7('0xb')](),controller['update']);router[_0xc3e7('0x19')](_0xc3e7('0xd'),auth[_0xc3e7('0xb')](),controller['destroy']);router[_0xc3e7('0x19')](_0xc3e7('0x15'),auth[_0xc3e7('0xb')](),controller['removeTeams']);router[_0xc3e7('0x19')](_0xc3e7('0x11'),auth[_0xc3e7('0xb')](),controller[_0xc3e7('0x1a')]);module[_0xc3e7('0x1b')]=router; \ No newline at end of file +var _0x4aa0=['describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','index','get','/describe'];(function(_0x1fc27e,_0x52402c){var _0x252a06=function(_0x53fa6f){while(--_0x53fa6f){_0x1fc27e['push'](_0x1fc27e['shift']());}};_0x252a06(++_0x52402c);}(_0x4aa0,0x1a7));var _0x04aa=function(_0x52f6e8,_0x408299){_0x52f6e8=_0x52f6e8-0x0;var _0x504b05=_0x4aa0[_0x52f6e8];return _0x504b05;};'use strict';var multer=require(_0x04aa('0x0'));var util=require(_0x04aa('0x1'));var path=require('path');var timeout=require(_0x04aa('0x2'));var express=require('express');var router=express[_0x04aa('0x3')]();var auth=require(_0x04aa('0x4'));var interaction=require(_0x04aa('0x5'));var config=require(_0x04aa('0x6'));var controller=require(_0x04aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x04aa('0x8')]);router[_0x04aa('0x9')](_0x04aa('0xa'),auth['isAuthenticated'](),controller[_0x04aa('0xb')]);router['get']('/:id',auth[_0x04aa('0xc')](),controller[_0x04aa('0xd')]);router[_0x04aa('0x9')](_0x04aa('0xe'),auth[_0x04aa('0xc')](),controller[_0x04aa('0xf')]);router[_0x04aa('0x9')](_0x04aa('0x10'),auth['isAuthenticated'](),controller[_0x04aa('0x11')]);router[_0x04aa('0x9')](_0x04aa('0x12'),auth['isAuthenticated'](),controller[_0x04aa('0x13')]);router['post']('/',auth[_0x04aa('0xc')](),controller[_0x04aa('0x14')]);router['post'](_0x04aa('0x10'),auth[_0x04aa('0xc')](),controller[_0x04aa('0x15')]);router[_0x04aa('0x16')](_0x04aa('0x12'),auth[_0x04aa('0xc')](),controller[_0x04aa('0x17')]);router[_0x04aa('0x18')](_0x04aa('0x19'),auth[_0x04aa('0xc')](),controller[_0x04aa('0x1a')]);router[_0x04aa('0x1b')](_0x04aa('0x19'),auth['isAuthenticated'](),controller[_0x04aa('0x1c')]);router[_0x04aa('0x1b')](_0x04aa('0x10'),auth[_0x04aa('0xc')](),controller[_0x04aa('0x1d')]);router[_0x04aa('0x1b')](_0x04aa('0x12'),auth['isAuthenticated'](),controller[_0x04aa('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 03b58a8..75cf1aa 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 _0x43ef=['exports','STRING','DATE'];(function(_0x14b1eb,_0x32a4cd){var _0x4d65b6=function(_0x13beaf){while(--_0x13beaf){_0x14b1eb['push'](_0x14b1eb['shift']());}};_0x4d65b6(++_0x32a4cd);}(_0x43ef,0x13b));var _0xf43e=function(_0x186b8f,_0x4642e6){_0x186b8f=_0x186b8f-0x0;var _0x1044af=_0x43ef[_0x186b8f];return _0x1044af;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xf43e('0x0')]={'uniqueid':{'type':Sequelize[_0xf43e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xf43e('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf43e('0x2')]},'acceptAt':{'type':Sequelize[_0xf43e('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf43e('0x1')]}}; \ No newline at end of file +var _0xd4e4=['DATE','moment','sequelize','exports','STRING'];(function(_0x38e7af,_0x381679){var _0xb626fc=function(_0x490a3e){while(--_0x490a3e){_0x38e7af['push'](_0x38e7af['shift']());}};_0xb626fc(++_0x381679);}(_0xd4e4,0x11e));var _0x4d4e=function(_0x1e1ad2,_0x81f7a7){_0x1e1ad2=_0x1e1ad2-0x0;var _0x1fc203=_0xd4e4[_0x1e1ad2];return _0x1fc203;};'use strict';var moment=require(_0x4d4e('0x0'));var Sequelize=require(_0x4d4e('0x1'));module[_0x4d4e('0x2')]={'uniqueid':{'type':Sequelize[_0x4d4e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4d4e('0x3')]},'joinAt':{'type':Sequelize[_0x4d4e('0x4')]},'leaveAt':{'type':Sequelize[_0x4d4e('0x4')]},'acceptAt':{'type':Sequelize[_0x4d4e('0x4')]},'exitAt':{'type':Sequelize[_0x4d4e('0x4')]},'reason':{'type':Sequelize[_0x4d4e('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f8ee46e..971847d 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 _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4e3522,_0x32dc14){var _0x2368c2=function(_0x93671){while(--_0x93671){_0x4e3522['push'](_0x4e3522['shift']());}};_0x2368c2(++_0x32dc14);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['ChatQueueReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['ChatQueueReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file +var _0xbaf0=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x4cdf5e,_0x51384c){var _0x34119c=function(_0x3b8517){while(--_0x3b8517){_0x4cdf5e['push'](_0x4cdf5e['shift']());}};_0x34119c(++_0x51384c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a53e2,_0x465dd7){_0x465dd7=_0x465dd7||0xcc;return function(_0xe4378c){if(_0xe4378c){return _0x5a53e2[_0x0baf('0x1b')](_0x465dd7);}return _0x5a53e2[_0x0baf('0x1c')](_0x465dd7)['end']();};}function respondWithResult(_0x2ab33e,_0x49e44b){_0x49e44b=_0x49e44b||0xc8;return function(_0x1c76a8){if(_0x1c76a8){return _0x2ab33e[_0x0baf('0x1c')](_0x49e44b)[_0x0baf('0x1d')](_0x1c76a8);}};}function respondWithFilteredResult(_0x2bc381,_0xb8339e){return function(_0x469599){if(_0x469599){var _0x4f80a8=_0x469599[_0x0baf('0x1e')],_0x4cd79d=_0xb8339e[_0x0baf('0x1f')],_0x2312c7=_0xb8339e[_0x0baf('0x1f')]+_0xb8339e[_0x0baf('0x20')],_0x38395b;if(_0x2312c7>=_0x4f80a8){_0x2312c7=_0x4f80a8;_0x38395b=0xc8;}else{_0x38395b=0xce;}_0x2bc381['status'](_0x38395b);return _0x2bc381[_0x0baf('0x21')](_0x0baf('0x22'),_0x4cd79d+'-'+_0x2312c7+'/'+_0x4f80a8)[_0x0baf('0x1d')](_0x469599);}return null;};}function patchUpdates(_0x3e9cb4){return function(_0x47070d){try{jsonpatch[_0x0baf('0x23')](_0x47070d,_0x3e9cb4,!![]);}catch(_0x4ff793){return BPromise['reject'](_0x4ff793);}return _0x47070d[_0x0baf('0x24')]();};}function saveUpdates(_0x154f48,_0x32e839){return function(_0x1848e8){if(_0x1848e8){return _0x1848e8[_0x0baf('0x25')](_0x154f48)[_0x0baf('0x26')](function(_0x210cd8){return _0x210cd8;});}return null;};}function removeEntity(_0x636a13,_0x2c42e2){return function(_0x15a2c3){if(_0x15a2c3){return _0x15a2c3['destroy']()[_0x0baf('0x26')](function(){_0x636a13['status'](0xcc)[_0x0baf('0x27')]();});}};}function handleEntityNotFound(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(!_0x2ef0aa){_0x5dbf00['sendStatus'](0x194);}return _0x2ef0aa;};}function handleError(_0x4be1b9,_0x47c4b){_0x47c4b=_0x47c4b||0x1f4;return function(_0x27b59c){logger[_0x0baf('0x28')](_0x27b59c[_0x0baf('0x29')]);if(_0x27b59c[_0x0baf('0x2a')]){delete _0x27b59c['name'];}_0x4be1b9[_0x0baf('0x1c')](_0x47c4b)[_0x0baf('0x2b')](_0x27b59c);};}exports[_0x0baf('0x2c')]=function(_0x366e71,_0x3843b8){var _0x3b9b31={},_0x453525={},_0x549fd0={'count':0x0,'rows':[]};var _0x1590b4=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0x55c715){return{'name':_0x55c715[_0x0baf('0x30')],'type':_0x55c715[_0x0baf('0x31')]['key']};});_0x453525[_0x0baf('0x32')]=_[_0x0baf('0x2d')](_0x1590b4,_0x0baf('0x2a'));_0x453525[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x366e71[_0x0baf('0x33')]);_0x453525[_0x0baf('0x35')]=_['intersection'](_0x453525[_0x0baf('0x32')],_0x453525[_0x0baf('0x33')]);_0x3b9b31[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x453525[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x38')]));_0x3b9b31[_0x0baf('0x36')]=_0x3b9b31[_0x0baf('0x36')][_0x0baf('0x39')]?_0x3b9b31[_0x0baf('0x36')]:_0x453525[_0x0baf('0x32')];if(!_0x366e71[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3a'))){_0x3b9b31['limit']=qs[_0x0baf('0x20')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x20')]);_0x3b9b31[_0x0baf('0x1f')]=qs['offset'](_0x366e71[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x3b9b31['order']=qs[_0x0baf('0x3b')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x3b')]);_0x3b9b31[_0x0baf('0x3c')]=qs[_0x0baf('0x35')](_[_0x0baf('0x3d')](_0x366e71[_0x0baf('0x33')],_0x453525[_0x0baf('0x35')]),_0x1590b4);if(_0x366e71['query'][_0x0baf('0x3e')]){_0x3b9b31[_0x0baf('0x3c')]=_['merge'](_0x3b9b31[_0x0baf('0x3c')],{'$or':_['map'](_0x1590b4,function(_0x5c545f){if(_0x5c545f[_0x0baf('0x31')]!==_0x0baf('0x3f')){var _0x5d3ad1={};_0x5d3ad1[_0x5c545f['name']]={'$like':'%'+_0x366e71[_0x0baf('0x33')][_0x0baf('0x3e')]+'%'};return _0x5d3ad1;}})});}_0x3b9b31=_[_0x0baf('0x40')]({},_0x3b9b31,_0x366e71[_0x0baf('0x41')]);var _0x15eb5c={'where':_0x3b9b31[_0x0baf('0x3c')]};return db[_0x0baf('0x2e')][_0x0baf('0x1e')](_0x15eb5c)[_0x0baf('0x26')](function(_0x36c6d2){_0x549fd0[_0x0baf('0x1e')]=_0x36c6d2;if(_0x366e71[_0x0baf('0x33')][_0x0baf('0x42')]){_0x3b9b31[_0x0baf('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0baf('0x44')](_0x3b9b31);})[_0x0baf('0x26')](function(_0x4f1de9){_0x549fd0[_0x0baf('0x45')]=_0x4f1de9;return _0x549fd0;})[_0x0baf('0x26')](respondWithFilteredResult(_0x3843b8,_0x3b9b31))[_0x0baf('0x46')](handleError(_0x3843b8,null));};exports[_0x0baf('0x47')]=function(_0x2e20c8,_0x456d0b){var _0x57b581={'raw':!![],'where':{'id':_0x2e20c8[_0x0baf('0x48')]['id']}},_0x23ad34={};_0x23ad34['model']=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x23ad34[_0x0baf('0x33')]=_['keys'](_0x2e20c8[_0x0baf('0x33')]);_0x23ad34[_0x0baf('0x35')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],_0x23ad34[_0x0baf('0x33')]);_0x57b581[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x2e20c8[_0x0baf('0x33')]['fields']));_0x57b581[_0x0baf('0x36')]=_0x57b581[_0x0baf('0x36')][_0x0baf('0x39')]?_0x57b581[_0x0baf('0x36')]:_0x23ad34[_0x0baf('0x32')];if(_0x2e20c8['query'][_0x0baf('0x42')]){_0x57b581[_0x0baf('0x43')]=[{'all':!![]}];}_0x57b581=_[_0x0baf('0x40')]({},_0x57b581,_0x2e20c8[_0x0baf('0x41')]);return db[_0x0baf('0x2e')]['find'](_0x57b581)[_0x0baf('0x26')](handleEntityNotFound(_0x456d0b,null))[_0x0baf('0x26')](respondWithResult(_0x456d0b,null))[_0x0baf('0x46')](handleError(_0x456d0b,null));};exports[_0x0baf('0x49')]=function(_0x41599f,_0x22d10f){return db[_0x0baf('0x2e')]['create'](_0x41599f[_0x0baf('0x4a')],{})[_0x0baf('0x26')](respondWithResult(_0x22d10f,0xc9))[_0x0baf('0x46')](handleError(_0x22d10f,null));};exports['update']=function(_0x3c9de3,_0x2222b6){if(_0x3c9de3[_0x0baf('0x4a')]['id']){delete _0x3c9de3[_0x0baf('0x4a')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x3c9de3[_0x0baf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2222b6,null))[_0x0baf('0x26')](saveUpdates(_0x3c9de3[_0x0baf('0x4a')],null))[_0x0baf('0x26')](respondWithResult(_0x2222b6,null))[_0x0baf('0x46')](handleError(_0x2222b6,null));};exports[_0x0baf('0x4c')]=function(_0xc427b2,_0x40d4a6){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0xc427b2[_0x0baf('0x48')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x40d4a6,null))['then'](removeEntity(_0x40d4a6,null))['catch'](handleError(_0x40d4a6,null));};exports[_0x0baf('0x4d')]=function(_0x3d6b19,_0x1cd114){return db[_0x0baf('0x2e')][_0x0baf('0x4d')]()[_0x0baf('0x26')](respondWithResult(_0x1cd114,null))[_0x0baf('0x46')](handleError(_0x1cd114,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 1232868..9e4ac6c 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 _0x28b5=['../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','api','moment','request-promise','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x28b5,0x1da));var _0x528b=function(_0x3889f9,_0x133f81){_0x3889f9=_0x3889f9-0x0;var _0xf47939=_0x28b5[_0x3889f9];return _0xf47939;};'use strict';var _=require(_0x528b('0x0'));var util=require(_0x528b('0x1'));var logger=require('../../config/logger')(_0x528b('0x2'));var moment=require(_0x528b('0x3'));var BPromise=require('bluebird');var rp=require(_0x528b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x528b('0x5'));var config=require(_0x528b('0x6'));var attributes=require(_0x528b('0x7'));module['exports']=function(_0x42ae30,_0xd44fd3){return _0x42ae30[_0x528b('0x8')](_0x528b('0x9'),attributes,{'tableName':_0x528b('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x528b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31be=['api','moment','bluebird','request-promise','path','./chatQueueReport.attributes','define','uniqueid','../../config/logger'];(function(_0x571dda,_0x1c9ed6){var _0x304e24=function(_0x578f37){while(--_0x578f37){_0x571dda['push'](_0x571dda['shift']());}};_0x304e24(++_0x1c9ed6);}(_0x31be,0xb3));var _0xe31b=function(_0x1c5843,_0x146395){_0x1c5843=_0x1c5843-0x0;var _0x829c08=_0x31be[_0x1c5843];return _0x829c08;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe31b('0x0'))(_0xe31b('0x1'));var moment=require(_0xe31b('0x2'));var BPromise=require(_0xe31b('0x3'));var rp=require(_0xe31b('0x4'));var fs=require('fs');var path=require(_0xe31b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe31b('0x6'));module['exports']=function(_0x596a03,_0x30edb3){return _0x596a03[_0xe31b('0x7')]('ChatQueueReport',attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe31b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index a3d76a8..cd7475e 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 _0x9181=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatQueueReport','create','body','options','then','CreateChatQueueReport','catch','UpdateChatQueueReport','update','where'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x9181,0x16d));var _0x1918=function(_0x400e5e,_0x3708a7){_0x400e5e=_0x400e5e-0x0;var _0x31adfd=_0x9181[_0x400e5e];return _0x31adfd;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var moment=require(_0x1918('0x2'));var BPromise=require(_0x1918('0x3'));var rs=require(_0x1918('0x4'));var fs=require('fs');var Redis=require(_0x1918('0x5'));var db=require(_0x1918('0x6'))['db'];var utils=require(_0x1918('0x7'));var logger=require(_0x1918('0x8'))(_0x1918('0x9'));var config=require('../../config/environment');var jayson=require(_0x1918('0xa'));var client=jayson[_0x1918('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x430a08,_0x1ba80a,_0x264175){return new BPromise(function(_0xaa2b6e,_0x7143e4){return client[_0x1918('0xc')](_0x430a08,_0x264175)['then'](function(_0x55e36b){logger[_0x1918('0xd')](_0x1918('0xe'),_0x1ba80a,_0x1918('0xf'));logger[_0x1918('0x10')](_0x1918('0x11'),_0x1ba80a,_0x1918('0xf'),JSON[_0x1918('0x12')](_0x55e36b));if(_0x55e36b[_0x1918('0x13')]){if(_0x55e36b[_0x1918('0x13')]['code']===0x1f4){logger[_0x1918('0x13')](_0x1918('0xe'),_0x1ba80a,_0x55e36b[_0x1918('0x13')][_0x1918('0x14')]);return _0x7143e4(_0x55e36b[_0x1918('0x13')]['message']);}logger[_0x1918('0x13')](_0x1918('0xe'),_0x1ba80a,_0x55e36b[_0x1918('0x13')][_0x1918('0x14')]);return _0xaa2b6e(_0x55e36b['error']['message']);}else{logger[_0x1918('0xd')](_0x1918('0xe'),_0x1ba80a,'request\x20sent');_0xaa2b6e(_0x55e36b['result'][_0x1918('0x14')]);}})['catch'](function(_0x217224){logger[_0x1918('0x13')](_0x1918('0xe'),_0x1ba80a,_0x217224);_0x7143e4(_0x217224);});});}exports['CreateChatQueueReport']=function(_0x153a2a){var _0x24fc2d=this;return new Promise(function(_0x58ffcf,_0x5fe402){return db[_0x1918('0x15')][_0x1918('0x16')](_0x153a2a[_0x1918('0x17')],{'raw':_0x153a2a[_0x1918('0x18')]?_0x153a2a[_0x1918('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x1918('0x19')](function(_0x4bcd56){logger['info'](_0x1918('0x1a'),_0x153a2a);logger[_0x1918('0x10')](_0x1918('0x1a'),_0x153a2a,JSON[_0x1918('0x12')](_0x4bcd56));_0x58ffcf(_0x4bcd56);})[_0x1918('0x1b')](function(_0x55eebd){logger[_0x1918('0x13')](_0x1918('0x1a'),_0x55eebd[_0x1918('0x14')],_0x153a2a);_0x5fe402(_0x24fc2d['error'](0x1f4,_0x55eebd[_0x1918('0x14')]));});});};exports[_0x1918('0x1c')]=function(_0x682e75){var _0x819951=this;return new Promise(function(_0x1073b6,_0x21349a){return db[_0x1918('0x15')][_0x1918('0x1d')](_0x682e75[_0x1918('0x17')],{'raw':_0x682e75['options']?_0x682e75[_0x1918('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x682e75[_0x1918('0x18')]?_0x682e75['options'][_0x1918('0x1e')]||null:null,'attributes':_0x682e75[_0x1918('0x18')]?_0x682e75[_0x1918('0x18')][_0x1918('0x1f')]||null:null,'limit':_0x682e75['options']?_0x682e75[_0x1918('0x18')][_0x1918('0x20')]||null:null})['then'](function(_0x3cbe49){logger[_0x1918('0xd')](_0x1918('0x1c'),_0x682e75);logger[_0x1918('0x10')](_0x1918('0x1c'),_0x682e75,JSON['stringify'](_0x3cbe49));_0x1073b6(_0x3cbe49);})[_0x1918('0x1b')](function(_0x2b1ddc){logger[_0x1918('0x13')](_0x1918('0x1c'),_0x2b1ddc[_0x1918('0x14')],_0x682e75);_0x21349a(_0x819951['error'](0x1f4,_0x2b1ddc[_0x1918('0x14')]));});});}; \ No newline at end of file +var _0xd5f3=['update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateChatQueueReport','create','body','options','raw','UpdateChatQueueReport','ChatQueueReport'];(function(_0x852450,_0xd2456e){var _0x329404=function(_0x4d482b){while(--_0x4d482b){_0x852450['push'](_0x852450['shift']());}};_0x329404(++_0xd2456e);}(_0xd5f3,0x13f));var _0x3d5f=function(_0x5b2aa5,_0x56c22a){_0x5b2aa5=_0x5b2aa5-0x0;var _0x6e9ef1=_0xd5f3[_0x5b2aa5];return _0x6e9ef1;};'use strict';var _=require(_0x3d5f('0x0'));var util=require(_0x3d5f('0x1'));var moment=require(_0x3d5f('0x2'));var BPromise=require(_0x3d5f('0x3'));var rs=require(_0x3d5f('0x4'));var fs=require('fs');var Redis=require(_0x3d5f('0x5'));var db=require(_0x3d5f('0x6'))['db'];var utils=require(_0x3d5f('0x7'));var logger=require(_0x3d5f('0x8'))('rpc');var config=require(_0x3d5f('0x9'));var jayson=require(_0x3d5f('0xa'));var client=jayson[_0x3d5f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cd23f,_0x15dd13,_0x1eef69){return new BPromise(function(_0x2c7f49,_0x282261){return client[_0x3d5f('0xc')](_0x1cd23f,_0x1eef69)[_0x3d5f('0xd')](function(_0x46efe6){logger[_0x3d5f('0xe')](_0x3d5f('0xf'),_0x15dd13,'request\x20sent');logger[_0x3d5f('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x15dd13,'request\x20sent',JSON[_0x3d5f('0x11')](_0x46efe6));if(_0x46efe6[_0x3d5f('0x12')]){if(_0x46efe6['error'][_0x3d5f('0x13')]===0x1f4){logger[_0x3d5f('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x15dd13,_0x46efe6[_0x3d5f('0x12')][_0x3d5f('0x14')]);return _0x282261(_0x46efe6['error'][_0x3d5f('0x14')]);}logger[_0x3d5f('0x12')](_0x3d5f('0xf'),_0x15dd13,_0x46efe6[_0x3d5f('0x12')]['message']);return _0x2c7f49(_0x46efe6[_0x3d5f('0x12')][_0x3d5f('0x14')]);}else{logger[_0x3d5f('0xe')](_0x3d5f('0xf'),_0x15dd13,_0x3d5f('0x15'));_0x2c7f49(_0x46efe6[_0x3d5f('0x16')][_0x3d5f('0x14')]);}})[_0x3d5f('0x17')](function(_0x548231){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x15dd13,_0x548231);_0x282261(_0x548231);});});}exports[_0x3d5f('0x18')]=function(_0xec572f){var _0x4d540e=this;return new Promise(function(_0x1a690b,_0x345488){return db['ChatQueueReport'][_0x3d5f('0x19')](_0xec572f[_0x3d5f('0x1a')],{'raw':_0xec572f[_0x3d5f('0x1b')]?_0xec572f[_0x3d5f('0x1b')][_0x3d5f('0x1c')]===undefined?!![]:![]:!![]})[_0x3d5f('0xd')](function(_0xec3ff1){logger['info'](_0x3d5f('0x18'),_0xec572f);logger[_0x3d5f('0x10')]('CreateChatQueueReport',_0xec572f,JSON[_0x3d5f('0x11')](_0xec3ff1));_0x1a690b(_0xec3ff1);})['catch'](function(_0xe2ca7b){logger[_0x3d5f('0x12')](_0x3d5f('0x18'),_0xe2ca7b['message'],_0xec572f);_0x345488(_0x4d540e[_0x3d5f('0x12')](0x1f4,_0xe2ca7b[_0x3d5f('0x14')]));});});};exports[_0x3d5f('0x1d')]=function(_0x109eed){var _0x7ed7b8=this;return new Promise(function(_0x3f92e5,_0x358b46){return db[_0x3d5f('0x1e')][_0x3d5f('0x1f')](_0x109eed[_0x3d5f('0x1a')],{'raw':_0x109eed['options']?_0x109eed[_0x3d5f('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x109eed['options']?_0x109eed[_0x3d5f('0x1b')][_0x3d5f('0x20')]||null:null,'attributes':_0x109eed['options']?_0x109eed[_0x3d5f('0x1b')][_0x3d5f('0x21')]||null:null,'limit':_0x109eed['options']?_0x109eed['options'][_0x3d5f('0x22')]||null:null})[_0x3d5f('0xd')](function(_0x83d00a){logger[_0x3d5f('0xe')](_0x3d5f('0x1d'),_0x109eed);logger[_0x3d5f('0x10')]('UpdateChatQueueReport',_0x109eed,JSON[_0x3d5f('0x11')](_0x83d00a));_0x3f92e5(_0x83d00a);})[_0x3d5f('0x17')](function(_0x36913c){logger[_0x3d5f('0x12')]('UpdateChatQueueReport',_0x36913c[_0x3d5f('0x14')],_0x109eed);_0x358b46(_0x7ed7b8[_0x3d5f('0x12')](0x1f4,_0x36913c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ab860fd..9a30272 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 _0x8127=['isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x8127,0x122));var _0x7812=function(_0x13618c,_0x253332){_0x13618c=_0x13618c-0x0;var _0x208caf=_0x8127[_0x13618c];return _0x208caf;};'use strict';var multer=require(_0x7812('0x0'));var util=require(_0x7812('0x1'));var path=require(_0x7812('0x2'));var timeout=require(_0x7812('0x3'));var express=require(_0x7812('0x4'));var router=express[_0x7812('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7812('0x6'));var config=require(_0x7812('0x7'));var controller=require(_0x7812('0x8'));router['get']('/',auth[_0x7812('0x9')](),controller[_0x7812('0xa')]);router['get'](_0x7812('0xb'),auth[_0x7812('0x9')](),controller[_0x7812('0xc')]);router[_0x7812('0xd')](_0x7812('0xe'),auth[_0x7812('0x9')](),controller[_0x7812('0xf')]);router[_0x7812('0x10')]('/',auth[_0x7812('0x9')](),controller[_0x7812('0x11')]);router[_0x7812('0x12')](_0x7812('0xe'),auth[_0x7812('0x9')](),controller[_0x7812('0x13')]);router[_0x7812('0x14')]('/:id',auth[_0x7812('0x9')](),controller[_0x7812('0x15')]);module[_0x7812('0x16')]=router; \ No newline at end of file +var _0xc3ba=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','destroy','exports','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc3ba,0x9f));var _0xac3b=function(_0x2510ea,_0x1d4b5b){_0x2510ea=_0x2510ea-0x0;var _0x4bb231=_0xc3ba[_0x2510ea];return _0x4bb231;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xac3b('0x0'));var timeout=require('connect-timeout');var express=require(_0xac3b('0x1'));var router=express['Router']();var auth=require(_0xac3b('0x2'));var interaction=require(_0xac3b('0x3'));var config=require(_0xac3b('0x4'));var controller=require(_0xac3b('0x5'));router[_0xac3b('0x6')]('/',auth[_0xac3b('0x7')](),controller[_0xac3b('0x8')]);router[_0xac3b('0x6')](_0xac3b('0x9'),auth[_0xac3b('0x7')](),controller[_0xac3b('0xa')]);router[_0xac3b('0x6')](_0xac3b('0xb'),auth[_0xac3b('0x7')](),controller[_0xac3b('0xc')]);router['post']('/',auth[_0xac3b('0x7')](),controller['create']);router['put'](_0xac3b('0xb'),auth[_0xac3b('0x7')](),controller[_0xac3b('0xd')]);router['delete'](_0xac3b('0xb'),auth[_0xac3b('0x7')](),controller[_0xac3b('0xe')]);module[_0xac3b('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e042b8b..0217f4e 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 _0x16e8=['NOW','moment','sequelize','exports','STRING','account','agent','queue','DATE'];(function(_0xbb6084,_0x1612c1){var _0x2db4f0=function(_0x59048){while(--_0x59048){_0xbb6084['push'](_0xbb6084['shift']());}};_0x2db4f0(++_0x1612c1);}(_0x16e8,0x145));var _0x816e=function(_0x31c06d,_0x475651){_0x31c06d=_0x31c06d-0x0;var _0x20b27b=_0x16e8[_0x31c06d];return _0x20b27b;};'use strict';var moment=require(_0x816e('0x0'));var Sequelize=require(_0x816e('0x1'));module[_0x816e('0x2')]={'uniqueid':{'type':Sequelize[_0x816e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x816e('0x4'),_0x816e('0x5'),_0x816e('0x6')),'allowNull':![],'defaultValue':_0x816e('0x6')},'transferredAt':{'type':Sequelize[_0x816e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x816e('0x8')]}}; \ No newline at end of file +var _0xf2e0=['sequelize','exports','STRING','ENUM','agent','queue','DATE','moment'];(function(_0x131475,_0xf2e974){var _0x47d6b9=function(_0x38a24d){while(--_0x38a24d){_0x131475['push'](_0x131475['shift']());}};_0x47d6b9(++_0xf2e974);}(_0xf2e0,0x18f));var _0x0f2e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf2e0[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x0f2e('0x0'));var Sequelize=require(_0x0f2e('0x1'));module[_0x0f2e('0x2')]={'uniqueid':{'type':Sequelize[_0x0f2e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0f2e('0x4')]('account',_0x0f2e('0x5'),_0x0f2e('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x0f2e('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index bce24ab..6381282 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 _0x256e=['attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','VIRTUAL','filter','merge','count','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ChatTransferReport','fieldName','type','key','query','keys','intersection'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x256e,0xb5));var _0xe256=function(_0x422d5e,_0x28d38d){_0x422d5e=_0x422d5e-0x0;var _0x14295a=_0x256e[_0x422d5e];return _0x14295a;};'use strict';var pdf=require(_0xe256('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe256('0x1'));var zipdir=require(_0xe256('0x2'));var jsonpatch=require(_0xe256('0x3'));var rp=require(_0xe256('0x4'));var moment=require(_0xe256('0x5'));var BPromise=require(_0xe256('0x6'));var Mustache=require(_0xe256('0x7'));var util=require(_0xe256('0x8'));var path=require(_0xe256('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe256('0xa'));var fs=require('fs');var _=require(_0xe256('0xb'));var squel=require(_0xe256('0xc'));var crypto=require(_0xe256('0xd'));var jsforce=require(_0xe256('0xe'));var deskjs=require(_0xe256('0xf'));var toCsv=require(_0xe256('0x10'));var querystring=require(_0xe256('0x11'));var Papa=require(_0xe256('0x12'));var Redis=require('ioredis');var authService=require(_0xe256('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe256('0x14'));var logger=require(_0xe256('0x15'))('api');var utils=require(_0xe256('0x16'));var config=require(_0xe256('0x17'));var db=require(_0xe256('0x18'))['db'];function respondWithStatusCode(_0x3961cf,_0x45544b){_0x45544b=_0x45544b||0xcc;return function(_0x58e749){if(_0x58e749){return _0x3961cf[_0xe256('0x19')](_0x45544b);}return _0x3961cf[_0xe256('0x1a')](_0x45544b)[_0xe256('0x1b')]();};}function respondWithResult(_0x4a9072,_0x805cf3){_0x805cf3=_0x805cf3||0xc8;return function(_0x9914be){if(_0x9914be){return _0x4a9072['status'](_0x805cf3)[_0xe256('0x1c')](_0x9914be);}};}function respondWithFilteredResult(_0x4c534a,_0x2762d7){return function(_0x21f3a8){if(_0x21f3a8){var _0x182959=_0x21f3a8['count'],_0x325b71=_0x2762d7['offset'],_0x43ca16=_0x2762d7[_0xe256('0x1d')]+_0x2762d7['limit'],_0x13056a;if(_0x43ca16>=_0x182959){_0x43ca16=_0x182959;_0x13056a=0xc8;}else{_0x13056a=0xce;}_0x4c534a[_0xe256('0x1a')](_0x13056a);return _0x4c534a[_0xe256('0x1e')](_0xe256('0x1f'),_0x325b71+'-'+_0x43ca16+'/'+_0x182959)['json'](_0x21f3a8);}return null;};}function patchUpdates(_0x1e3dfa){return function(_0x255666){try{jsonpatch[_0xe256('0x20')](_0x255666,_0x1e3dfa,!![]);}catch(_0x1da865){return BPromise[_0xe256('0x21')](_0x1da865);}return _0x255666[_0xe256('0x22')]();};}function saveUpdates(_0x4bee92,_0x62ed87){return function(_0x59a43a){if(_0x59a43a){return _0x59a43a[_0xe256('0x23')](_0x4bee92)[_0xe256('0x24')](function(_0x20deab){return _0x20deab;});}return null;};}function removeEntity(_0x3aebe1,_0x3e0c30){return function(_0x4ceea6){if(_0x4ceea6){return _0x4ceea6[_0xe256('0x25')]()['then'](function(){_0x3aebe1[_0xe256('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb596,_0x5bcead){return function(_0x5dca69){if(!_0x5dca69){_0x3fb596[_0xe256('0x19')](0x194);}return _0x5dca69;};}function handleError(_0x47a8c6,_0x293669){_0x293669=_0x293669||0x1f4;return function(_0x158c6e){logger[_0xe256('0x26')](_0x158c6e['stack']);if(_0x158c6e['name']){delete _0x158c6e[_0xe256('0x27')];}_0x47a8c6[_0xe256('0x1a')](_0x293669)[_0xe256('0x28')](_0x158c6e);};}exports[_0xe256('0x29')]=function(_0x4d1742,_0x24b170){var _0xb36038={},_0x20503f={},_0x32d71f={'count':0x0,'rows':[]};var _0x8b1e32=_[_0xe256('0x2a')](db[_0xe256('0x2b')]['rawAttributes'],function(_0xd7a95a){return{'name':_0xd7a95a[_0xe256('0x2c')],'type':_0xd7a95a[_0xe256('0x2d')][_0xe256('0x2e')]};});_0x20503f['model']=_[_0xe256('0x2a')](_0x8b1e32,_0xe256('0x27'));_0x20503f[_0xe256('0x2f')]=_[_0xe256('0x30')](_0x4d1742['query']);_0x20503f['filters']=_[_0xe256('0x31')](_0x20503f['model'],_0x20503f['query']);_0xb36038[_0xe256('0x32')]=_[_0xe256('0x31')](_0x20503f[_0xe256('0x33')],qs['fields'](_0x4d1742[_0xe256('0x2f')][_0xe256('0x34')]));_0xb36038[_0xe256('0x32')]=_0xb36038[_0xe256('0x32')][_0xe256('0x35')]?_0xb36038[_0xe256('0x32')]:_0x20503f[_0xe256('0x33')];if(!_0x4d1742[_0xe256('0x2f')][_0xe256('0x36')](_0xe256('0x37'))){_0xb36038[_0xe256('0x38')]=qs[_0xe256('0x38')](_0x4d1742['query'][_0xe256('0x38')]);_0xb36038[_0xe256('0x1d')]=qs[_0xe256('0x1d')](_0x4d1742[_0xe256('0x2f')][_0xe256('0x1d')]);}_0xb36038[_0xe256('0x39')]=qs[_0xe256('0x3a')](_0x4d1742[_0xe256('0x2f')][_0xe256('0x3a')]);_0xb36038['where']=qs['filters'](_[_0xe256('0x3b')](_0x4d1742[_0xe256('0x2f')],_0x20503f[_0xe256('0x3c')]),_0x8b1e32);if(_0x4d1742['query']['filter']){_0xb36038[_0xe256('0x3d')]=_['merge'](_0xb36038[_0xe256('0x3d')],{'$or':_[_0xe256('0x2a')](_0x8b1e32,function(_0x5deb43){if(_0x5deb43[_0xe256('0x2d')]!==_0xe256('0x3e')){var _0x8e3b09={};_0x8e3b09[_0x5deb43[_0xe256('0x27')]]={'$like':'%'+_0x4d1742[_0xe256('0x2f')][_0xe256('0x3f')]+'%'};return _0x8e3b09;}})});}_0xb36038=_[_0xe256('0x40')]({},_0xb36038,_0x4d1742['options']);var _0x1f2678={'where':_0xb36038[_0xe256('0x3d')]};return db['ChatTransferReport'][_0xe256('0x41')](_0x1f2678)[_0xe256('0x24')](function(_0x46ff87){_0x32d71f['count']=_0x46ff87;if(_0x4d1742[_0xe256('0x2f')][_0xe256('0x42')]){_0xb36038[_0xe256('0x43')]=[{'all':!![]}];}return db[_0xe256('0x2b')]['findAll'](_0xb36038);})['then'](function(_0xf16c07){_0x32d71f[_0xe256('0x44')]=_0xf16c07;return _0x32d71f;})[_0xe256('0x24')](respondWithFilteredResult(_0x24b170,_0xb36038))[_0xe256('0x45')](handleError(_0x24b170,null));};exports[_0xe256('0x46')]=function(_0x50f07d,_0xea7928){var _0x5c1eb0={'raw':!![],'where':{'id':_0x50f07d[_0xe256('0x47')]['id']}},_0x3d4b0f={};_0x3d4b0f[_0xe256('0x33')]=_[_0xe256('0x30')](db['ChatTransferReport'][_0xe256('0x48')]);_0x3d4b0f[_0xe256('0x2f')]=_[_0xe256('0x30')](_0x50f07d['query']);_0x3d4b0f['filters']=_[_0xe256('0x31')](_0x3d4b0f['model'],_0x3d4b0f[_0xe256('0x2f')]);_0x5c1eb0[_0xe256('0x32')]=_['intersection'](_0x3d4b0f[_0xe256('0x33')],qs['fields'](_0x50f07d[_0xe256('0x2f')]['fields']));_0x5c1eb0['attributes']=_0x5c1eb0[_0xe256('0x32')]['length']?_0x5c1eb0['attributes']:_0x3d4b0f[_0xe256('0x33')];if(_0x50f07d[_0xe256('0x2f')][_0xe256('0x42')]){_0x5c1eb0[_0xe256('0x43')]=[{'all':!![]}];}_0x5c1eb0=_[_0xe256('0x40')]({},_0x5c1eb0,_0x50f07d[_0xe256('0x49')]);return db['ChatTransferReport'][_0xe256('0x4a')](_0x5c1eb0)[_0xe256('0x24')](handleEntityNotFound(_0xea7928,null))['then'](respondWithResult(_0xea7928,null))[_0xe256('0x45')](handleError(_0xea7928,null));};exports[_0xe256('0x4b')]=function(_0x4f0634,_0x4d5835){return db[_0xe256('0x2b')][_0xe256('0x4b')](_0x4f0634[_0xe256('0x4c')],{})[_0xe256('0x24')](respondWithResult(_0x4d5835,0xc9))[_0xe256('0x45')](handleError(_0x4d5835,null));};exports['update']=function(_0x2acfd8,_0xcc63e0){if(_0x2acfd8[_0xe256('0x4c')]['id']){delete _0x2acfd8['body']['id'];}return db[_0xe256('0x2b')][_0xe256('0x4a')]({'where':{'id':_0x2acfd8[_0xe256('0x47')]['id']}})[_0xe256('0x24')](handleEntityNotFound(_0xcc63e0,null))[_0xe256('0x24')](saveUpdates(_0x2acfd8[_0xe256('0x4c')],null))['then'](respondWithResult(_0xcc63e0,null))[_0xe256('0x45')](handleError(_0xcc63e0,null));};exports[_0xe256('0x25')]=function(_0x3c457b,_0x59f372){return db['ChatTransferReport'][_0xe256('0x4a')]({'where':{'id':_0x3c457b['params']['id']}})[_0xe256('0x24')](handleEntityNotFound(_0x59f372,null))[_0xe256('0x24')](removeEntity(_0x59f372,null))[_0xe256('0x45')](handleError(_0x59f372,null));};exports['describe']=function(_0x2ba504,_0x4415f0){return db[_0xe256('0x2b')]['describe']()[_0xe256('0x24')](respondWithResult(_0x4415f0,null))[_0xe256('0x45')](handleError(_0x4415f0,null));}; \ No newline at end of file +var _0x5a62=['update','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','error','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','where','pick','type','VIRTUAL','filter','merge','options','ChatTransferReport','include','findAll','rows','catch','show','rawAttributes','fields','length','includeAll','find','create','body'];(function(_0x5d6b0f,_0x4a17e5){var _0x175a5c=function(_0x244c81){while(--_0x244c81){_0x5d6b0f['push'](_0x5d6b0f['shift']());}};_0x175a5c(++_0x4a17e5);}(_0x5a62,0x136));var _0x25a6=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x5a62[_0x504df1];return _0x1063b5;};'use strict';var pdf=require(_0x25a6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x25a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25a6('0x2'));var rp=require(_0x25a6('0x3'));var moment=require(_0x25a6('0x4'));var BPromise=require(_0x25a6('0x5'));var Mustache=require(_0x25a6('0x6'));var util=require(_0x25a6('0x7'));var path=require(_0x25a6('0x8'));var sox=require('sox');var csv=require(_0x25a6('0x9'));var ejs=require(_0x25a6('0xa'));var fs=require('fs');var _=require(_0x25a6('0xb'));var squel=require(_0x25a6('0xc'));var crypto=require(_0x25a6('0xd'));var jsforce=require(_0x25a6('0xe'));var deskjs=require(_0x25a6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x25a6('0x10'));var Papa=require(_0x25a6('0x11'));var Redis=require(_0x25a6('0x12'));var authService=require(_0x25a6('0x13'));var qs=require(_0x25a6('0x14'));var as=require(_0x25a6('0x15'));var hardwareService=require(_0x25a6('0x16'));var logger=require(_0x25a6('0x17'))('api');var utils=require(_0x25a6('0x18'));var config=require(_0x25a6('0x19'));var db=require(_0x25a6('0x1a'))['db'];function respondWithStatusCode(_0x1867b1,_0x4a0221){_0x4a0221=_0x4a0221||0xcc;return function(_0x8ea9fb){if(_0x8ea9fb){return _0x1867b1[_0x25a6('0x1b')](_0x4a0221);}return _0x1867b1[_0x25a6('0x1c')](_0x4a0221)[_0x25a6('0x1d')]();};}function respondWithResult(_0xf8ca97,_0x187599){_0x187599=_0x187599||0xc8;return function(_0x28e1ac){if(_0x28e1ac){return _0xf8ca97['status'](_0x187599)[_0x25a6('0x1e')](_0x28e1ac);}};}function respondWithFilteredResult(_0x103f85,_0x5dc605){return function(_0x28ee10){if(_0x28ee10){var _0x329e0f=_0x28ee10[_0x25a6('0x1f')],_0x3b7fb=_0x5dc605['offset'],_0x4f5563=_0x5dc605[_0x25a6('0x20')]+_0x5dc605['limit'],_0x5af2e6;if(_0x4f5563>=_0x329e0f){_0x4f5563=_0x329e0f;_0x5af2e6=0xc8;}else{_0x5af2e6=0xce;}_0x103f85['status'](_0x5af2e6);return _0x103f85[_0x25a6('0x21')]('Content-Range',_0x3b7fb+'-'+_0x4f5563+'/'+_0x329e0f)[_0x25a6('0x1e')](_0x28ee10);}return null;};}function patchUpdates(_0x34f883){return function(_0x17fdc3){try{jsonpatch['apply'](_0x17fdc3,_0x34f883,!![]);}catch(_0x3bc8f7){return BPromise[_0x25a6('0x22')](_0x3bc8f7);}return _0x17fdc3[_0x25a6('0x23')]();};}function saveUpdates(_0x3a101f,_0xd0f6f2){return function(_0x23f740){if(_0x23f740){return _0x23f740['update'](_0x3a101f)[_0x25a6('0x24')](function(_0x39833f){return _0x39833f;});}return null;};}function removeEntity(_0x5cba41,_0x1bf5a2){return function(_0x333d6a){if(_0x333d6a){return _0x333d6a[_0x25a6('0x25')]()['then'](function(){_0x5cba41['status'](0xcc)[_0x25a6('0x1d')]();});}};}function handleEntityNotFound(_0x181427,_0x513cbb){return function(_0x19dff3){if(!_0x19dff3){_0x181427[_0x25a6('0x1b')](0x194);}return _0x19dff3;};}function handleError(_0x2c147a,_0x261a31){_0x261a31=_0x261a31||0x1f4;return function(_0x22c6c2){logger[_0x25a6('0x26')](_0x22c6c2['stack']);if(_0x22c6c2['name']){delete _0x22c6c2[_0x25a6('0x27')];}_0x2c147a[_0x25a6('0x1c')](_0x261a31)[_0x25a6('0x28')](_0x22c6c2);};}exports[_0x25a6('0x29')]=function(_0x52a6c5,_0x425df9){var _0x3ee2dc={},_0x34171d={},_0x2b28ba={'count':0x0,'rows':[]};var _0x319c81=_[_0x25a6('0x2a')](db['ChatTransferReport']['rawAttributes'],function(_0x314220){return{'name':_0x314220[_0x25a6('0x2b')],'type':_0x314220['type'][_0x25a6('0x2c')]};});_0x34171d[_0x25a6('0x2d')]=_['map'](_0x319c81,_0x25a6('0x27'));_0x34171d[_0x25a6('0x2e')]=_[_0x25a6('0x2f')](_0x52a6c5['query']);_0x34171d[_0x25a6('0x30')]=_[_0x25a6('0x31')](_0x34171d['model'],_0x34171d[_0x25a6('0x2e')]);_0x3ee2dc[_0x25a6('0x32')]=_['intersection'](_0x34171d[_0x25a6('0x2d')],qs['fields'](_0x52a6c5[_0x25a6('0x2e')]['fields']));_0x3ee2dc[_0x25a6('0x32')]=_0x3ee2dc['attributes']['length']?_0x3ee2dc['attributes']:_0x34171d['model'];if(!_0x52a6c5[_0x25a6('0x2e')][_0x25a6('0x33')](_0x25a6('0x34'))){_0x3ee2dc['limit']=qs['limit'](_0x52a6c5[_0x25a6('0x2e')][_0x25a6('0x35')]);_0x3ee2dc[_0x25a6('0x20')]=qs[_0x25a6('0x20')](_0x52a6c5['query'][_0x25a6('0x20')]);}_0x3ee2dc[_0x25a6('0x36')]=qs['sort'](_0x52a6c5['query']['sort']);_0x3ee2dc[_0x25a6('0x37')]=qs[_0x25a6('0x30')](_[_0x25a6('0x38')](_0x52a6c5[_0x25a6('0x2e')],_0x34171d[_0x25a6('0x30')]),_0x319c81);if(_0x52a6c5[_0x25a6('0x2e')]['filter']){_0x3ee2dc[_0x25a6('0x37')]=_['merge'](_0x3ee2dc[_0x25a6('0x37')],{'$or':_[_0x25a6('0x2a')](_0x319c81,function(_0x4f8b95){if(_0x4f8b95[_0x25a6('0x39')]!==_0x25a6('0x3a')){var _0x27615e={};_0x27615e[_0x4f8b95['name']]={'$like':'%'+_0x52a6c5['query'][_0x25a6('0x3b')]+'%'};return _0x27615e;}})});}_0x3ee2dc=_[_0x25a6('0x3c')]({},_0x3ee2dc,_0x52a6c5[_0x25a6('0x3d')]);var _0x22e3df={'where':_0x3ee2dc['where']};return db[_0x25a6('0x3e')]['count'](_0x22e3df)[_0x25a6('0x24')](function(_0x3c1513){_0x2b28ba[_0x25a6('0x1f')]=_0x3c1513;if(_0x52a6c5[_0x25a6('0x2e')]['includeAll']){_0x3ee2dc[_0x25a6('0x3f')]=[{'all':!![]}];}return db[_0x25a6('0x3e')][_0x25a6('0x40')](_0x3ee2dc);})[_0x25a6('0x24')](function(_0x8b84c0){_0x2b28ba[_0x25a6('0x41')]=_0x8b84c0;return _0x2b28ba;})[_0x25a6('0x24')](respondWithFilteredResult(_0x425df9,_0x3ee2dc))[_0x25a6('0x42')](handleError(_0x425df9,null));};exports[_0x25a6('0x43')]=function(_0x4ad3b9,_0xceb344){var _0x49343f={'raw':!![],'where':{'id':_0x4ad3b9['params']['id']}},_0x39a7e0={};_0x39a7e0[_0x25a6('0x2d')]=_[_0x25a6('0x2f')](db[_0x25a6('0x3e')][_0x25a6('0x44')]);_0x39a7e0[_0x25a6('0x2e')]=_[_0x25a6('0x2f')](_0x4ad3b9[_0x25a6('0x2e')]);_0x39a7e0[_0x25a6('0x30')]=_[_0x25a6('0x31')](_0x39a7e0[_0x25a6('0x2d')],_0x39a7e0[_0x25a6('0x2e')]);_0x49343f[_0x25a6('0x32')]=_[_0x25a6('0x31')](_0x39a7e0[_0x25a6('0x2d')],qs[_0x25a6('0x45')](_0x4ad3b9[_0x25a6('0x2e')][_0x25a6('0x45')]));_0x49343f[_0x25a6('0x32')]=_0x49343f[_0x25a6('0x32')][_0x25a6('0x46')]?_0x49343f[_0x25a6('0x32')]:_0x39a7e0['model'];if(_0x4ad3b9[_0x25a6('0x2e')][_0x25a6('0x47')]){_0x49343f['include']=[{'all':!![]}];}_0x49343f=_[_0x25a6('0x3c')]({},_0x49343f,_0x4ad3b9[_0x25a6('0x3d')]);return db[_0x25a6('0x3e')][_0x25a6('0x48')](_0x49343f)[_0x25a6('0x24')](handleEntityNotFound(_0xceb344,null))[_0x25a6('0x24')](respondWithResult(_0xceb344,null))[_0x25a6('0x42')](handleError(_0xceb344,null));};exports[_0x25a6('0x49')]=function(_0x3efa10,_0x1f0f7b){return db[_0x25a6('0x3e')][_0x25a6('0x49')](_0x3efa10[_0x25a6('0x4a')],{})[_0x25a6('0x24')](respondWithResult(_0x1f0f7b,0xc9))[_0x25a6('0x42')](handleError(_0x1f0f7b,null));};exports[_0x25a6('0x4b')]=function(_0x67340e,_0x1cb150){if(_0x67340e['body']['id']){delete _0x67340e['body']['id'];}return db[_0x25a6('0x3e')][_0x25a6('0x48')]({'where':{'id':_0x67340e['params']['id']}})[_0x25a6('0x24')](handleEntityNotFound(_0x1cb150,null))['then'](saveUpdates(_0x67340e['body'],null))[_0x25a6('0x24')](respondWithResult(_0x1cb150,null))[_0x25a6('0x42')](handleError(_0x1cb150,null));};exports[_0x25a6('0x25')]=function(_0x390e19,_0x43522e){return db[_0x25a6('0x3e')][_0x25a6('0x48')]({'where':{'id':_0x390e19['params']['id']}})[_0x25a6('0x24')](handleEntityNotFound(_0x43522e,null))[_0x25a6('0x24')](removeEntity(_0x43522e,null))['catch'](handleError(_0x43522e,null));};exports[_0x25a6('0x4c')]=function(_0x182ed2,_0x1db152){return db[_0x25a6('0x3e')][_0x25a6('0x4c')]()[_0x25a6('0x24')](respondWithResult(_0x1db152,null))[_0x25a6('0x42')](handleError(_0x1db152,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 9d307b5..6f74fb7 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 _0x6aa7=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x6aa7,0x178));var _0x76aa=function(_0x42c6fe,_0x518505){_0x42c6fe=_0x42c6fe-0x0;var _0x4fe912=_0x6aa7[_0x42c6fe];return _0x4fe912;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x76aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x483d76,_0x2c0f05){var _0x2dbecd=function(_0x4ab398){while(--_0x4ab398){_0x483d76['push'](_0x483d76['shift']());}};_0x2dbecd(++_0x2c0f05);}(_0x54ef,0x112));var _0xf54e=function(_0xf55f42,_0x415ff4){_0xf55f42=_0xf55f42-0x0;var _0x10b233=_0x54ef[_0xf55f42];return _0x10b233;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xf54e('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 0b5faf2..f3a7bd4 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 _0xdc76=['request\x20sent','stringify','error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x23a86c,_0x22f86d){var _0x28f3e1=function(_0x491994){while(--_0x491994){_0x23a86c['push'](_0x23a86c['shift']());}};_0x28f3e1(++_0x22f86d);}(_0xdc76,0xc3));var _0x6dc7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdc76[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x6dc7('0x0'));var moment=require(_0x6dc7('0x1'));var BPromise=require(_0x6dc7('0x2'));var rs=require(_0x6dc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dc7('0x4'))['db'];var utils=require(_0x6dc7('0x5'));var logger=require(_0x6dc7('0x6'))(_0x6dc7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13bde3,_0x2ea575,_0x4b1e9d){return new BPromise(function(_0x5d343c,_0x57828a){return client[_0x6dc7('0x8')](_0x13bde3,_0x4b1e9d)[_0x6dc7('0x9')](function(_0x2fea2c){logger[_0x6dc7('0xa')](_0x6dc7('0xb'),_0x2ea575,'request\x20sent');logger[_0x6dc7('0xc')](_0x6dc7('0xd'),_0x2ea575,_0x6dc7('0xe'),JSON[_0x6dc7('0xf')](_0x2fea2c));if(_0x2fea2c['error']){if(_0x2fea2c[_0x6dc7('0x10')]['code']===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2ea575,_0x2fea2c[_0x6dc7('0x10')][_0x6dc7('0x11')]);return _0x57828a(_0x2fea2c[_0x6dc7('0x10')][_0x6dc7('0x11')]);}logger[_0x6dc7('0x10')](_0x6dc7('0xb'),_0x2ea575,_0x2fea2c[_0x6dc7('0x10')][_0x6dc7('0x11')]);return _0x5d343c(_0x2fea2c[_0x6dc7('0x10')]['message']);}else{logger['info'](_0x6dc7('0xb'),_0x2ea575,_0x6dc7('0xe'));_0x5d343c(_0x2fea2c['result'][_0x6dc7('0x11')]);}})[_0x6dc7('0x12')](function(_0x1bd08a){logger[_0x6dc7('0x10')](_0x6dc7('0xb'),_0x2ea575,_0x1bd08a);_0x57828a(_0x1bd08a);});});} \ No newline at end of file +var _0x5c19=['../../config/logger','rpc','../../config/environment','http','request','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x12a349,_0x1f3c95){var _0x1d6caa=function(_0x1c286e){while(--_0x1c286e){_0x12a349['push'](_0x12a349['shift']());}};_0x1d6caa(++_0x1f3c95);}(_0x5c19,0xc7));var _0x95c1=function(_0x340fc7,_0x12a901){_0x340fc7=_0x340fc7-0x0;var _0x586c93=_0x5c19[_0x340fc7];return _0x586c93;};'use strict';var _=require(_0x95c1('0x0'));var util=require(_0x95c1('0x1'));var moment=require(_0x95c1('0x2'));var BPromise=require(_0x95c1('0x3'));var rs=require(_0x95c1('0x4'));var fs=require('fs');var Redis=require(_0x95c1('0x5'));var db=require(_0x95c1('0x6'))['db'];var utils=require(_0x95c1('0x7'));var logger=require(_0x95c1('0x8'))(_0x95c1('0x9'));var config=require(_0x95c1('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x95c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d3763,_0x102058,_0x4d6be2){return new BPromise(function(_0x397569,_0x21d7a5){return client[_0x95c1('0xc')](_0x1d3763,_0x4d6be2)['then'](function(_0x245211){logger[_0x95c1('0xd')](_0x95c1('0xe'),_0x102058,'request\x20sent');logger[_0x95c1('0xf')](_0x95c1('0x10'),_0x102058,_0x95c1('0x11'),JSON[_0x95c1('0x12')](_0x245211));if(_0x245211[_0x95c1('0x13')]){if(_0x245211[_0x95c1('0x13')][_0x95c1('0x14')]===0x1f4){logger['error'](_0x95c1('0xe'),_0x102058,_0x245211[_0x95c1('0x13')][_0x95c1('0x15')]);return _0x21d7a5(_0x245211[_0x95c1('0x13')][_0x95c1('0x15')]);}logger[_0x95c1('0x13')](_0x95c1('0xe'),_0x102058,_0x245211[_0x95c1('0x13')][_0x95c1('0x15')]);return _0x397569(_0x245211[_0x95c1('0x13')][_0x95c1('0x15')]);}else{logger[_0x95c1('0xd')](_0x95c1('0xe'),_0x102058,_0x95c1('0x11'));_0x397569(_0x245211['result'][_0x95c1('0x15')]);}})[_0x95c1('0x16')](function(_0x50e928){logger[_0x95c1('0x13')](_0x95c1('0xe'),_0x102058,_0x50e928);_0x21d7a5(_0x50e928);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 95b5764..5b37307 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 _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x757a,0xde));var _0xa757=function(_0x2fdd5c,_0x1ac150){_0x2fdd5c=_0x2fdd5c-0x0;var _0x5cc931=_0x757a[_0x2fdd5c];return _0x5cc931;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index cb54a51..03d53c5 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 _0x7f27=['setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','randomstring','STRING','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7f27,0x12e));var _0x77f2=function(_0x2af263,_0x2cdeee){_0x2af263=_0x2af263-0x0;var _0x1774cb=_0x7f27[_0x2af263];return _0x1774cb;};'use strict';var Sequelize=require(_0x77f2('0x0'));var rs=require(_0x77f2('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x3')},'mapKeyOffline':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x4')},'customerAlias':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x77f2('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![],'defaultValue':_0x77f2('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x77f2('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x77f2('0x2')]},'animation':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x77f2('0x8')](_0x77f2('0x9'),_0x77f2('0xa')),'defaultValue':_0x77f2('0x9')},'header_online':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0xd')},'download_transcript':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x77f2('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x77f2('0xf')]},'closingQuestion':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x12')},'noteTitle':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x14')},'closingMessage':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x15')},'closingMessageButton':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x16')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x17')},'conditionAgreement':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x18')},'ratingType':{'type':Sequelize[_0x77f2('0x8')](_0x77f2('0x19'),_0x77f2('0x1a')),'defaultValue':_0x77f2('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x77f2('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x77f2('0xf')],'defaultValue':function(){return JSON[_0x77f2('0x1b')]({'items':[{'type':_0x77f2('0x1c'),'variable':null,'config':{'placeholder':'name','type':_0x77f2('0x1d'),'required':!![]},'props':{'title':_0x77f2('0x1e'),'helpText':''}},{'type':_0x77f2('0x1c'),'props':{'title':_0x77f2('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x77f2('0x3'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x77f2('0x1f')](_0x77f2('0x20'))?JSON[_0x77f2('0x21')](this[_0x77f2('0x1f')](_0x77f2('0x20'))):{};},'set':function(_0x37fba4){return this[_0x77f2('0x22')](_0x77f2('0x20'),JSON['stringify'](_0x37fba4));}},'offlineForm':{'type':Sequelize[_0x77f2('0xf')],'defaultValue':function(){return JSON[_0x77f2('0x1b')]({'items':[{'type':_0x77f2('0x1c'),'props':{'title':_0x77f2('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x77f2('0x3')},'variable':null},{'type':_0x77f2('0x23'),'config':{'placeholder':_0x77f2('0x24')},'props':{'title':_0x77f2('0x24'),'helpText':_0x77f2('0x25')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON['parse'](this[_0x77f2('0x1f')]('offlineForm')):{};},'set':function(_0x325af6){return this[_0x77f2('0x22')](_0x77f2('0x26'),JSON[_0x77f2('0x1b')](_0x325af6));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x77f2('0x2')]},'forwardOffline':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x77f2('0x2')]},'waitingTitle':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x27')},'waitingMessage':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x28')},'offlineMessageBody':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x77f2('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x77f2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x77f2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x2b')},'verticalAlignment':{'type':Sequelize[_0x77f2('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x77f2('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x77f2('0x2')],'allowNull':![],'defaultValue':_0x77f2('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x77f2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x77f2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':_0x77f2('0x2d')},'systemAvatar':{'type':Sequelize[_0x77f2('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x77f2('0x6')],'comment':_0x77f2('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x518b00){if(!_0x518b00)this[_0x77f2('0x22')](_0x77f2('0x2f'),null);this[_0x77f2('0x22')]('mandatoryDisposition',_0x518b00);}},'vidaooEscalation':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x77f2('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0578=['randomstring','exports','STRING','email','#ffffff','INTEGER','squared','rounded','We\x20are\x20here!','Chat','Send','BOOLEAN','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','TEXT','stringify','input','name','text','getDataValue','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize'];(function(_0x381256,_0x5ebe30){var _0x20215f=function(_0x3f9dd0){while(--_0x3f9dd0){_0x381256['push'](_0x381256['shift']());}};_0x20215f(++_0x5ebe30);}(_0x0578,0x1b8));var _0x8057=function(_0x5bed39,_0x3d4347){_0x5bed39=_0x5bed39-0x0;var _0x523a8e=_0x0578[_0x5bed39];return _0x523a8e;};'use strict';var Sequelize=require(_0x8057('0x0'));var rs=require(_0x8057('0x1'));module[_0x8057('0x2')]={'name':{'type':Sequelize[_0x8057('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8057('0x3')]},'mapKey':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'defaultValue':_0x8057('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8057('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8057('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x8057('0x7')),'defaultValue':_0x8057('0x8')},'header_online':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x9')},'start_chat_button':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0xb')},'header_offline':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x8057('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8057('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x8057('0xc')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0xf')},'noteTitle':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x10')},'placeholderMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x11')},'closingMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x12')},'closingMessageButton':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0xb')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0x13')},'conditionAgreement':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x14')},'ratingType':{'type':Sequelize[_0x8057('0x15')](_0x8057('0x16'),_0x8057('0x17')),'defaultValue':_0x8057('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x8057('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8057('0x18')],'defaultValue':function(){return JSON[_0x8057('0x19')]({'items':[{'type':_0x8057('0x1a'),'variable':null,'config':{'placeholder':_0x8057('0x1b'),'type':_0x8057('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x8057('0x1a'),'props':{'title':_0x8057('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x8057('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8057('0x1d')]('onlineForm')?JSON[_0x8057('0x1e')](this[_0x8057('0x1d')]('onlineForm')):{};},'set':function(_0x3084b1){return this[_0x8057('0x1f')]('onlineForm',JSON[_0x8057('0x19')](_0x3084b1));}},'offlineForm':{'type':Sequelize[_0x8057('0x18')],'defaultValue':function(){return JSON[_0x8057('0x19')]({'items':[{'type':_0x8057('0x1a'),'props':{'title':_0x8057('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8057('0x4'),'type':'email'},'variable':null},{'type':_0x8057('0x20'),'config':{'placeholder':_0x8057('0x21')},'props':{'title':_0x8057('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x8057('0x1d')](_0x8057('0x22'))?JSON[_0x8057('0x1e')](this['getDataValue'](_0x8057('0x22'))):{};},'set':function(_0x497bd7){return this['setDataValue'](_0x8057('0x22'),JSON['stringify'](_0x497bd7));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8057('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8057('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8057('0x3')]},'waitingTitle':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x24')},'waitingMessage':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x8057('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x8057('0xc')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0x27')},'skipUnmanaged':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x13')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x8057('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8057('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8057('0x18')],'defaultValue':function(){return _0x8057('0x28');}},'notificationSound':{'type':Sequelize[_0x8057('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8057('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x2b')},'defaultTitle':{'type':Sequelize[_0x8057('0x3')]},'customerAvatar':{'type':Sequelize[_0x8057('0x18')]},'showCustomerAvatar':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8057('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8057('0x3')],'allowNull':![],'defaultValue':_0x8057('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8057('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8057('0x3')],'defaultValue':_0x8057('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8057('0x6')],'comment':_0x8057('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x8057('0xc')],'defaultValue':![],'comment':_0x8057('0x2f'),'set':function(_0x2d1ae9){if(!_0x2d1ae9)this['setDataValue'](_0x8057('0x30'),null);this['setDataValue']('mandatoryDisposition',_0x2d1ae9);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index f645b21..0223d1f 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 _0xa75d=['Interval','Intervals','getProactiveActions','getLicense','virtual','License','increment','some','server/files/chat/iframe.js','x-real-ip','connection','alignment','verticalAlignment','sequelize','transaction','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','online','false','offlineForm','onlineForm','items','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','get','ChatWebsites','stack','name','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','params','options','find','create','body','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','rows','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','custom','isNil','sitepic','existsSync','server/files/images/logos/','download','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','setUA','headers','getResult','chat','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','from','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','lastName','messageId','created','push','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailAccount','Smtp','service','host','port','secure','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0xa75d,0x139));var _0xda75=function(_0x3f7eda,_0x1b6503){_0x3f7eda=_0x3f7eda-0x0;var _0x366810=_0xa75d[_0x3f7eda];return _0x366810;};'use strict';var pdf=require(_0xda75('0x0'));var emlformat=require(_0xda75('0x1'));var rimraf=require(_0xda75('0x2'));var zipdir=require(_0xda75('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda75('0x4'));var moment=require(_0xda75('0x5'));var BPromise=require(_0xda75('0x6'));var Mustache=require(_0xda75('0x7'));var util=require(_0xda75('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda75('0x9'));var fs=require('fs');var _=require(_0xda75('0xa'));var squel=require(_0xda75('0xb'));var crypto=require(_0xda75('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xda75('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xda75('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xda75('0xf'));var as=require(_0xda75('0x10'));var hardwareService=require(_0xda75('0x11'));var logger=require(_0xda75('0x12'))(_0xda75('0x13'));var utils=require(_0xda75('0x14'));var config=require(_0xda75('0x15'));var db=require(_0xda75('0x16'))['db'];config[_0xda75('0x17')]=_[_0xda75('0x18')](config[_0xda75('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda75('0x17')]));require(_0xda75('0x19'))[_0xda75('0x1a')](socket);var jayson=require(_0xda75('0x1b'));var client=jayson[_0xda75('0x1c')][_0xda75('0x1d')]({'port':0x232c});var client9002=jayson[_0xda75('0x1c')]['http']({'port':0x232a});var client9003=jayson[_0xda75('0x1c')][_0xda75('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x4de9de,_0x43bd5d,_0x378c9f){if(_0x378c9f){var _0x427793=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x427793[_0xda75('0x1e')](_0x43bd5d)){return _0x4de9de;}else{throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4de9de;}}function respondWithRpcPromise(_0x1a7aa4,_0x3a310a,_0x305ddf,_0x51a1f5){return new BPromise(function(_0xc22f9f,_0x3cbac4){var _0x5272af=_0x51a1f5||client;return _0x5272af['request'](_0x1a7aa4,_0x305ddf)[_0xda75('0x21')](function(_0x3eb284){logger[_0xda75('0x22')](_0xda75('0x23'),_0x3a310a,_0xda75('0x24'));logger[_0xda75('0x25')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3a310a,_0xda75('0x24'),JSON[_0xda75('0x26')](_0x3eb284));if(_0x3eb284[_0xda75('0x27')]){if(_0x3eb284[_0xda75('0x27')]['code']===0x1f4){logger[_0xda75('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x3a310a,_0x3eb284['error'][_0xda75('0x28')]);return _0x3cbac4(_0x3eb284[_0xda75('0x27')]['message']);}logger['error'](_0xda75('0x23'),_0x3a310a,_0x3eb284[_0xda75('0x27')][_0xda75('0x28')]);return _0xc22f9f(_0x3eb284['error']['message']);}else{logger[_0xda75('0x22')](_0xda75('0x23'),_0x3a310a,'request\x20sent');_0xc22f9f(_0x3eb284[_0xda75('0x29')][_0xda75('0x28')]);}})[_0xda75('0x2a')](function(_0x5a5c0c){logger[_0xda75('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x3a310a,_0x5a5c0c);_0x3cbac4(_0x5a5c0c);});});}function respondWithStatusCode(_0xd75fcb,_0x2897f2){_0x2897f2=_0x2897f2||0xcc;return function(_0x5dfd41){if(_0x5dfd41){return _0xd75fcb[_0xda75('0x2b')](_0x2897f2);}return _0xd75fcb[_0xda75('0x2c')](_0x2897f2)[_0xda75('0x2d')]();};}function respondWithResult(_0x40a06d,_0x2d0d10){_0x2d0d10=_0x2d0d10||0xc8;return function(_0x27cd35){if(_0x27cd35){return _0x40a06d[_0xda75('0x2c')](_0x2d0d10)[_0xda75('0x2e')](_0x27cd35);}};}function respondWithFilteredResult(_0x2d40c8,_0x2c7ae8){return function(_0x18126b){if(_0x18126b){var _0x16aee8=_0x18126b[_0xda75('0x2f')],_0x5416fe=_0x2c7ae8[_0xda75('0x30')],_0x569626=_0x2c7ae8[_0xda75('0x30')]+_0x2c7ae8[_0xda75('0x31')],_0x4fe78d;if(_0x569626>=_0x16aee8){_0x569626=_0x16aee8;_0x4fe78d=0xc8;}else{_0x4fe78d=0xce;}_0x2d40c8[_0xda75('0x2c')](_0x4fe78d);return _0x2d40c8[_0xda75('0x32')](_0xda75('0x33'),_0x5416fe+'-'+_0x569626+'/'+_0x16aee8)[_0xda75('0x2e')](_0x18126b);}return null;};}function patchUpdates(_0x9affe7){return function(_0x370696){try{jsonpatch[_0xda75('0x34')](_0x370696,_0x9affe7,!![]);}catch(_0x1f4dc2){return BPromise['reject'](_0x1f4dc2);}return _0x370696[_0xda75('0x35')]();};}function saveUpdates(_0x44b56d,_0x76900e){return function(_0x1858a0){if(_0x1858a0){return _0x1858a0['update'](_0x44b56d)[_0xda75('0x21')](function(_0x5d8303){return _0x5d8303;});}return null;};}function removeEntity(_0x52f22c,_0x21009e){return function(_0x1ccfb6){if(_0x1ccfb6){return _0x1ccfb6[_0xda75('0x36')]()[_0xda75('0x21')](function(){var _0x190e56=_0x1ccfb6[_0xda75('0x37')]({'plain':!![]});var _0x4584e6=_0xda75('0x38');return db['UserProfileResource'][_0xda75('0x36')]({'where':{'type':_0x4584e6,'resourceId':_0x190e56['id']}})['then'](function(){return _0x1ccfb6;});})[_0xda75('0x21')](function(){_0x52f22c['status'](0xcc)[_0xda75('0x2d')]();});}};}function handleEntityNotFound(_0x44fa8a,_0x342f62){return function(_0x40b839){if(!_0x40b839){_0x44fa8a[_0xda75('0x2b')](0x194);}return _0x40b839;};}function handleError(_0x2ff4dd,_0x444a5a){_0x444a5a=_0x444a5a||0x1f4;return function(_0x155280){logger['error'](_0x155280[_0xda75('0x39')]);if(_0x155280[_0xda75('0x3a')]){delete _0x155280[_0xda75('0x3a')];}_0x2ff4dd['status'](_0x444a5a)['send'](_0x155280);};}exports['index']=function(_0x2fe4f2,_0x27c70f){var _0x166957={'include':[{'model':db[_0xda75('0x3b')],'as':_0xda75('0x3c')}]},_0x2598ea={},_0x4be2ae={'count':0x0,'rows':[]};var _0x2c07d1=_[_0xda75('0x3d')](db[_0xda75('0x3e')][_0xda75('0x3f')],function(_0x324196){return{'name':_0x324196[_0xda75('0x40')],'type':_0x324196[_0xda75('0x41')][_0xda75('0x42')]};});_0x2598ea[_0xda75('0x43')]=_[_0xda75('0x3d')](_0x2c07d1,_0xda75('0x3a'));_0x2598ea[_0xda75('0x44')]=_[_0xda75('0x45')](_0x2fe4f2[_0xda75('0x44')]);_0x2598ea[_0xda75('0x46')]=_[_0xda75('0x47')](_0x2598ea['model'],_0x2598ea[_0xda75('0x44')]);_0x166957[_0xda75('0x48')]=_['intersection'](_0x2598ea['model'],qs[_0xda75('0x49')](_0x2fe4f2['query'][_0xda75('0x49')]));_0x166957[_0xda75('0x48')]=_0x166957[_0xda75('0x48')][_0xda75('0x4a')]?_0x166957[_0xda75('0x48')]:_0x2598ea[_0xda75('0x43')];if(!_0x2fe4f2[_0xda75('0x44')][_0xda75('0x4b')]('nolimit')){_0x166957[_0xda75('0x31')]=qs['limit'](_0x2fe4f2[_0xda75('0x44')][_0xda75('0x31')]);_0x166957[_0xda75('0x30')]=qs[_0xda75('0x30')](_0x2fe4f2[_0xda75('0x44')]['offset']);}_0x166957[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x2fe4f2[_0xda75('0x44')][_0xda75('0x4d')]);_0x166957['where']=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x2fe4f2[_0xda75('0x44')],_0x2598ea[_0xda75('0x46')]),_0x2c07d1);if(_0x2fe4f2[_0xda75('0x44')][_0xda75('0x4f')]){_0x166957[_0xda75('0x50')]=_[_0xda75('0x51')](_0x166957[_0xda75('0x50')],{'$or':_[_0xda75('0x3d')](_0x2c07d1,function(_0x2e22e5){if(_0x2e22e5[_0xda75('0x41')]!==_0xda75('0x52')){var _0x2519cd={};_0x2519cd[_0x2e22e5['name']]={'$like':'%'+_0x2fe4f2[_0xda75('0x44')]['filter']+'%'};return _0x2519cd;}})});}_0x166957=_[_0xda75('0x51')]({},_0x166957,_0x2fe4f2['options']);var _0x3b0ef5={'where':_0x166957['where']};return db[_0xda75('0x3e')]['count'](_0x3b0ef5)[_0xda75('0x21')](function(_0x2e25bf){_0x4be2ae['count']=_0x2e25bf;if(_0x2fe4f2[_0xda75('0x44')][_0xda75('0x53')]){_0x166957[_0xda75('0x54')]=[{'all':!![]}];}return db[_0xda75('0x3e')]['findAll'](_0x166957);})['then'](function(_0x2e5b9e){_0x4be2ae['rows']=_0x2e5b9e;return _0x4be2ae;})[_0xda75('0x21')](respondWithFilteredResult(_0x27c70f,_0x166957))[_0xda75('0x2a')](handleError(_0x27c70f,null));};exports['show']=function(_0x342644,_0x1ebd08){var _0x152cd7={'raw':![],'where':{'id':_0x342644[_0xda75('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xda75('0x3c')}]},_0x49b78c={};_0x49b78c[_0xda75('0x43')]=_[_0xda75('0x45')](db[_0xda75('0x3e')][_0xda75('0x3f')]);_0x49b78c[_0xda75('0x44')]=_[_0xda75('0x45')](_0x342644['query']);_0x49b78c[_0xda75('0x46')]=_[_0xda75('0x47')](_0x49b78c['model'],_0x49b78c['query']);_0x152cd7[_0xda75('0x48')]=_[_0xda75('0x47')](_0x49b78c[_0xda75('0x43')],qs[_0xda75('0x49')](_0x342644[_0xda75('0x44')][_0xda75('0x49')]));_0x152cd7[_0xda75('0x48')]=_0x152cd7[_0xda75('0x48')]['length']?_0x152cd7[_0xda75('0x48')]:_0x49b78c[_0xda75('0x43')];if(_0x342644['query'][_0xda75('0x53')]){_0x152cd7[_0xda75('0x54')]=[{'all':!![]}];}_0x152cd7=_[_0xda75('0x51')]({},_0x152cd7,_0x342644[_0xda75('0x56')]);return db[_0xda75('0x3e')][_0xda75('0x57')](_0x152cd7)[_0xda75('0x21')](handleEntityNotFound(_0x1ebd08,null))['then'](respondWithResult(_0x1ebd08,null))[_0xda75('0x2a')](handleError(_0x1ebd08,null));};exports[_0xda75('0x58')]=function(_0x3dfc89,_0x1896ee){return db[_0xda75('0x3e')]['create'](_0x3dfc89[_0xda75('0x59')],{})[_0xda75('0x21')](function(_0x5c3387){var _0x5680a6=_0x3dfc89['user']['get']({'plain':!![]});if(!_0x5680a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5680a6[_0xda75('0x5a')]===_0xda75('0x5b')){var _0x4e88e4=_0x5c3387[_0xda75('0x37')]({'plain':!![]});var _0x3403a6='ChatWebsites';return db[_0xda75('0x5c')][_0xda75('0x57')]({'where':{'name':_0x3403a6,'userProfileId':_0x5680a6['userProfileId']},'raw':!![]})['then'](function(_0x32bb41){if(_0x32bb41&&_0x32bb41['autoAssociation']===0x0){return db[_0xda75('0x5d')][_0xda75('0x58')]({'name':_0x4e88e4[_0xda75('0x3a')],'resourceId':_0x4e88e4['id'],'type':_0x32bb41[_0xda75('0x3a')],'sectionId':_0x32bb41['id']},{})[_0xda75('0x21')](function(){return _0x5c3387;});}else{return _0x5c3387;}})['catch'](function(_0x35f3c8){logger['error'](_0xda75('0x5e'),_0x35f3c8);throw _0x35f3c8;});}return _0x5c3387;})[_0xda75('0x21')](respondWithResult(_0x1896ee,0xc9))[_0xda75('0x2a')](handleError(_0x1896ee,null));};exports[_0xda75('0x5f')]=function(_0x2340fe,_0x41d167){if(_0x2340fe['body']['id']){delete _0x2340fe['body']['id'];}return db[_0xda75('0x3e')]['find']({'where':{'id':_0x2340fe[_0xda75('0x55')]['id']},'include':[{'model':db[_0xda75('0x3b')],'as':_0xda75('0x3c')}]})['then'](handleEntityNotFound(_0x41d167,null))[_0xda75('0x21')](saveUpdates(_0x2340fe['body'],null))['then'](respondWithResult(_0x41d167,null))['catch'](handleError(_0x41d167,null));};exports[_0xda75('0x36')]=function(_0x206ef0,_0x3d6a26){return db['ChatWebsite'][_0xda75('0x57')]({'where':{'id':_0x206ef0[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x3d6a26,null))[_0xda75('0x21')](removeEntity(_0x3d6a26,null))[_0xda75('0x2a')](handleError(_0x3d6a26,null));};exports[_0xda75('0x60')]=function(_0x35383c,_0x17b2d1){return db[_0xda75('0x3e')][_0xda75('0x60')]()['then'](respondWithResult(_0x17b2d1,null))[_0xda75('0x2a')](handleError(_0x17b2d1,null));};exports[_0xda75('0x61')]=function(_0x20c3c8,_0x6ab9d4,_0x2f572c){if(_0x20c3c8[_0xda75('0x59')]['id']){delete _0x20c3c8['body']['id'];}return db[_0xda75('0x3e')]['find']({'where':{'id':_0x20c3c8[_0xda75('0x55')]['id']}})['then'](handleEntityNotFound(_0x6ab9d4,null))[_0xda75('0x21')](function(_0xbcef4c){if(_0xbcef4c){_0x20c3c8[_0xda75('0x59')][_0xda75('0x62')]=_0xbcef4c['id'];return db[_0xda75('0x63')][_0xda75('0x58')](_0x20c3c8['body']);}})[_0xda75('0x21')](respondWithResult(_0x6ab9d4,null))[_0xda75('0x2a')](handleError(_0x6ab9d4,null));};exports[_0xda75('0x64')]=function(_0x279cd7,_0x22d04f,_0x45689d){var _0x1de575={'raw':![],'where':{}};var _0x43bca9={};var _0x1ad319={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x279cd7['params']['id']}})['then'](handleEntityNotFound(_0x22d04f,null))[_0xda75('0x21')](function(_0x36091b){if(_0x36091b){_0x43bca9[_0xda75('0x43')]=_[_0xda75('0x45')](db[_0xda75('0x63')]['rawAttributes']);_0x43bca9[_0xda75('0x44')]=_[_0xda75('0x45')](_0x279cd7[_0xda75('0x44')]);_0x43bca9[_0xda75('0x46')]=_[_0xda75('0x47')](_0x43bca9[_0xda75('0x43')],_0x43bca9[_0xda75('0x44')]);_0x1de575['attributes']=_['intersection'](_0x43bca9['model'],qs[_0xda75('0x49')](_0x279cd7[_0xda75('0x44')][_0xda75('0x49')]));_0x1de575[_0xda75('0x48')]=_0x1de575['attributes']['length']?_0x1de575['attributes']:_0x43bca9['model'];if(!_0x279cd7[_0xda75('0x44')][_0xda75('0x4b')]('nolimit')){_0x1de575['limit']=qs['limit'](_0x279cd7[_0xda75('0x44')]['limit']);_0x1de575[_0xda75('0x30')]=qs[_0xda75('0x30')](_0x279cd7['query']['offset']);}_0x1de575['order']=qs[_0xda75('0x4d')](_0x279cd7[_0xda75('0x44')][_0xda75('0x4d')]);_0x1de575[_0xda75('0x50')]=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x279cd7[_0xda75('0x44')],_0x43bca9[_0xda75('0x46')]));_0x1de575[_0xda75('0x50')][_0xda75('0x62')]=_0x36091b['id'];if(_0x279cd7[_0xda75('0x44')][_0xda75('0x4f')]){_0x1de575[_0xda75('0x50')]=_['merge'](_0x1de575[_0xda75('0x50')],{'$or':_[_0xda75('0x3d')](_0x1de575[_0xda75('0x48')],function(_0x31246d){var _0x593ca7={};_0x593ca7[_0x31246d]={'$like':'%'+_0x279cd7[_0xda75('0x44')][_0xda75('0x4f')]+'%'};return _0x593ca7;})});}_0x1de575=_['merge']({},_0x1de575,_0x279cd7[_0xda75('0x56')]);return db[_0xda75('0x63')][_0xda75('0x2f')]({'where':_0x1de575[_0xda75('0x50')]})['then'](function(_0x46ecd6){_0x1ad319['count']=_0x46ecd6;if(_0x279cd7['query']['includeAll']){_0x1de575['include']=[{'all':!![]}];}return db[_0xda75('0x63')][_0xda75('0x65')](_0x1de575);})[_0xda75('0x21')](function(_0x28c5e9){_0x1ad319['rows']=_0x28c5e9;return _0x1ad319;});}})[_0xda75('0x21')](respondWithFilteredResult(_0x22d04f,_0x1de575))['catch'](handleError(_0x22d04f,null));};exports[_0xda75('0x66')]=function(_0x2fe9e9,_0x304459,_0x1dd0d2){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x2fe9e9['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x304459,null))[_0xda75('0x21')](function(_0x2df6ac){if(_0x2df6ac){return _0x2df6ac[_0xda75('0x66')](_0x2fe9e9['query'][_0xda75('0x67')]);}})[_0xda75('0x21')](respondWithStatusCode(_0x304459,null))['catch'](handleError(_0x304459,null));};exports[_0xda75('0x68')]=function(_0x55b34d,_0x3cf345,_0x24e709){if(_0x55b34d[_0xda75('0x59')]['id']){delete _0x55b34d[_0xda75('0x59')]['id'];}return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x55b34d[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x3cf345,null))[_0xda75('0x21')](function(_0x27a76d){if(_0x27a76d){_0x55b34d[_0xda75('0x59')][_0xda75('0x62')]=_0x27a76d['id'];return db[_0xda75('0x69')]['create'](_0x55b34d[_0xda75('0x59')]);}})[_0xda75('0x21')](respondWithResult(_0x3cf345,null))[_0xda75('0x2a')](handleError(_0x3cf345,null));};exports[_0xda75('0x6a')]=function(_0x5c44cd,_0x49e0d9,_0x4adc40){var _0x144e25={'raw':![],'where':{}};var _0x1c32b2={};var _0x504280={'count':0x0,'rows':[]};return db[_0xda75('0x3e')][_0xda75('0x6b')]({'where':{'id':_0x5c44cd['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x49e0d9,null))[_0xda75('0x21')](function(_0x45747b){if(_0x45747b){_0x1c32b2[_0xda75('0x43')]=_[_0xda75('0x45')](db['CannedAnswer'][_0xda75('0x3f')]);_0x1c32b2[_0xda75('0x44')]=_['keys'](_0x5c44cd[_0xda75('0x44')]);_0x1c32b2['filters']=_[_0xda75('0x47')](_0x1c32b2[_0xda75('0x43')],_0x1c32b2[_0xda75('0x44')]);_0x144e25[_0xda75('0x48')]=_['intersection'](_0x1c32b2[_0xda75('0x43')],qs['fields'](_0x5c44cd[_0xda75('0x44')][_0xda75('0x49')]));_0x144e25[_0xda75('0x48')]=_0x144e25['attributes']['length']?_0x144e25[_0xda75('0x48')]:_0x1c32b2['model'];if(!_0x5c44cd[_0xda75('0x44')]['hasOwnProperty'](_0xda75('0x6c'))){_0x144e25[_0xda75('0x31')]=qs[_0xda75('0x31')](_0x5c44cd[_0xda75('0x44')][_0xda75('0x31')]);_0x144e25[_0xda75('0x30')]=qs[_0xda75('0x30')](_0x5c44cd[_0xda75('0x44')][_0xda75('0x30')]);}_0x144e25[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x5c44cd['query'][_0xda75('0x4d')]);_0x144e25['where']=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x5c44cd['query'],_0x1c32b2[_0xda75('0x46')]));_0x144e25[_0xda75('0x50')][_0xda75('0x62')]=_0x45747b['id'];if(_0x5c44cd['query'][_0xda75('0x4f')]){_0x144e25[_0xda75('0x50')]=_[_0xda75('0x51')](_0x144e25[_0xda75('0x50')],{'$or':_[_0xda75('0x3d')](_0x144e25[_0xda75('0x48')],function(_0x2ad94e){var _0x716188={};_0x716188[_0x2ad94e]={'$like':'%'+_0x5c44cd['query'][_0xda75('0x4f')]+'%'};return _0x716188;})});}_0x144e25=_[_0xda75('0x51')]({},_0x144e25,_0x5c44cd['options']);return db[_0xda75('0x69')]['count']({'where':_0x144e25[_0xda75('0x50')]})[_0xda75('0x21')](function(_0x5d9a9a){_0x504280[_0xda75('0x2f')]=_0x5d9a9a;if(_0x5c44cd[_0xda75('0x44')]['includeAll']){_0x144e25[_0xda75('0x54')]=[{'all':!![]}];}return db[_0xda75('0x69')][_0xda75('0x65')](_0x144e25);})[_0xda75('0x21')](function(_0x1dfa0a){_0x504280[_0xda75('0x6d')]=_0x1dfa0a;return _0x504280;});}})[_0xda75('0x21')](respondWithFilteredResult(_0x49e0d9,_0x144e25))[_0xda75('0x2a')](handleError(_0x49e0d9,null));};exports[_0xda75('0x6e')]=function(_0x2e6cda,_0x13c246,_0x1770b8){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x2e6cda[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x13c246,null))[_0xda75('0x21')](function(_0x64002c){if(_0x64002c){return _0x64002c[_0xda75('0x6e')](_0x2e6cda[_0xda75('0x44')][_0xda75('0x67')]);}})[_0xda75('0x21')](respondWithStatusCode(_0x13c246,null))[_0xda75('0x2a')](handleError(_0x13c246,null));};exports[_0xda75('0x6f')]=function(_0x1cc79a,_0x480424,_0x92e65e){_0x1cc79a[_0xda75('0x59')]['sitepic']=_0x1cc79a[_0xda75('0x70')][_0xda75('0x71')];return db[_0xda75('0x3e')]['find']({'where':{'id':_0x1cc79a['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x480424,null))['then'](saveUpdates(_0x1cc79a['body'],null))['then'](respondWithResult(_0x480424,null))['catch'](handleError(_0x480424,null));};exports[_0xda75('0x72')]=function(_0x5471a3,_0x23315f,_0x6c9069){_0x5471a3[_0xda75('0x59')][_0xda75('0x73')]=_0x5471a3['file'][_0xda75('0x71')];return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x5471a3[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x23315f,null))[_0xda75('0x21')](saveUpdates(_0x5471a3[_0xda75('0x59')],null))[_0xda75('0x21')](respondWithResult(_0x23315f,null))[_0xda75('0x2a')](handleError(_0x23315f,null));};exports['addCustomerAvatar']=function(_0x3a9a77,_0x59dbe7,_0x4379d6){_0x3a9a77[_0xda75('0x59')][_0xda75('0x74')]=_0x3a9a77['file'][_0xda75('0x71')];return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x3a9a77[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x59dbe7,null))['then'](saveUpdates(_0x3a9a77[_0xda75('0x59')],null))[_0xda75('0x21')](respondWithResult(_0x59dbe7,null))['catch'](handleError(_0x59dbe7,null));};exports[_0xda75('0x75')]=function(_0x1128b6,_0x4ad9bb,_0x51a1fb){_0x1128b6[_0xda75('0x59')][_0xda75('0x76')]=_0x1128b6[_0xda75('0x70')]['filename'];return db['ChatWebsite'][_0xda75('0x57')]({'where':{'id':_0x1128b6['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x4ad9bb,null))['then'](saveUpdates(_0x1128b6[_0xda75('0x59')],null))[_0xda75('0x21')](respondWithResult(_0x4ad9bb,null))[_0xda75('0x2a')](handleError(_0x4ad9bb,null));};exports[_0xda75('0x77')]=function(_0x49d7e5,_0x293100,_0x175c51){var _0x165229=path[_0xda75('0x78')](config[_0xda75('0x79')],'server/files/images/logos/default_logo.svg');var _0x308608={'where':{'id':_0x49d7e5[_0xda75('0x55')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x73fd7e=![];return require(_0xda75('0x7a'))['getLicense']()[_0xda75('0x21')](function(_0xe95978){if(_0xe95978){_0x73fd7e=_0xe95978[_0xda75('0x7b')];}})['then'](function(){return db[_0xda75('0x3e')][_0xda75('0x57')](_0x308608);})[_0xda75('0x21')](handleEntityNotFound(_0x293100,null))[_0xda75('0x21')](function(_0x2250d5){if(_0x2250d5){if(!_[_0xda75('0x7c')](_0x2250d5[_0xda75('0x7d')])){if(fs[_0xda75('0x7e')](path['join'](config['root'],_0xda75('0x7f'),_0x2250d5['sitepic']))&&_0x73fd7e){_0x165229=path['join'](config[_0xda75('0x79')],_0xda75('0x7f'),_0x2250d5[_0xda75('0x7d')]);}}return _0x293100[_0xda75('0x80')](_0x165229);}})[_0xda75('0x2a')](handleError(_0x293100,null));};exports['getAvatar']=function(_0x3b3f0a,_0x3a7170,_0x32ff3f){var _0x495840=path['join'](config[_0xda75('0x79')],'server/files/images/avatars/default_avatar.png');var _0x8ce7be={'where':{'id':_0x3b3f0a['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xda75('0x57')](_0x8ce7be)[_0xda75('0x21')](handleEntityNotFound(_0x3a7170,null))['then'](function(_0x14aa78){if(_0x14aa78){if(!_[_0xda75('0x7c')](_0x14aa78[_0xda75('0x73')])){if(fs[_0xda75('0x7e')](path[_0xda75('0x78')](config[_0xda75('0x79')],'server/files/images/avatars/',_0x14aa78[_0xda75('0x73')]))){_0x495840=path[_0xda75('0x78')](config['root'],_0xda75('0x81'),_0x14aa78[_0xda75('0x73')]);}}return _0x3a7170['download'](_0x495840);}})[_0xda75('0x2a')](handleError(_0x3a7170,null));};exports['getCustomerAvatar']=function(_0x2514d3,_0xe9d752,_0x31cdda){var _0x1e4994=path['join'](config[_0xda75('0x79')],_0xda75('0x82'));var _0x559767={'where':{'id':_0x2514d3[_0xda75('0x55')]['id']},'attributes':['id',_0xda75('0x74'),_0xda75('0x83')],'raw':!![]};return db[_0xda75('0x3e')][_0xda75('0x57')](_0x559767)['then'](handleEntityNotFound(_0xe9d752,null))[_0xda75('0x21')](function(_0x3493f9){if(_0x3493f9){if(!_[_0xda75('0x7c')](_0x3493f9[_0xda75('0x74')])){if(fs['existsSync'](path['join'](config[_0xda75('0x79')],_0xda75('0x81'),_0x3493f9['customerAvatar']))&&_0x3493f9[_0xda75('0x83')]){_0x1e4994=path[_0xda75('0x78')](config[_0xda75('0x79')],_0xda75('0x81'),_0x3493f9[_0xda75('0x74')]);}}return _0xe9d752[_0xda75('0x80')](_0x1e4994);}})[_0xda75('0x2a')](handleError(_0xe9d752,null));};exports['getSystemAvatar']=function(_0x5c3c89,_0x5c3e34,_0x286c77){var _0xf66993=path[_0xda75('0x78')](config[_0xda75('0x79')],'server/files/images/avatars/system_avatar.png');var _0x185abd={'where':{'id':_0x5c3c89[_0xda75('0x55')]['id']},'attributes':['id',_0xda75('0x76')],'raw':!![]};return db[_0xda75('0x3e')][_0xda75('0x57')](_0x185abd)[_0xda75('0x21')](handleEntityNotFound(_0x5c3e34,null))[_0xda75('0x21')](function(_0x4dee58){if(_0x4dee58){if(!_['isNil'](_0x4dee58['systemAvatar'])){if(fs[_0xda75('0x7e')](path['join'](config['root'],_0xda75('0x81'),_0x4dee58[_0xda75('0x76')]))){_0xf66993=path[_0xda75('0x78')](config[_0xda75('0x79')],_0xda75('0x81'),_0x4dee58[_0xda75('0x76')]);}}return _0x5c3e34[_0xda75('0x80')](_0xf66993);}})['catch'](handleError(_0x5c3e34,null));};exports['notify']=function(_0x316196,_0x54936d,_0x115baf){var _0x24589c=require('user-agent-parser');var _0x54d74c=new _0x24589c();var _0x7e0802=_0x54d74c[_0xda75('0x84')](_0x316196[_0xda75('0x85')]['user-agent'])[_0xda75('0x86')]();var _0x47ee75={'body':_0x316196[_0xda75('0x59')],'channel':_0xda75('0x87')};var _0x77a8ec=[];var _0x1dcde4=[];var _0x56502b={};var _0x5dbdf0=![];return db[_0xda75('0x88')][_0xda75('0x60')]()['then'](function(_0x12e28f){if(!_0x12e28f){throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0x89'));}_0x77a8ec=_['difference'](_[_0xda75('0x45')](_0x12e28f),[_0xda75('0x8a'),_0xda75('0x8b')]);_0x1dcde4=_[_0xda75('0x8c')](_[_0xda75('0x45')](_0x12e28f),[_0xda75('0x8a'),_0xda75('0x8b'),_0xda75('0x8d'),_0xda75('0x8e')]);if(_0x316196[_0xda75('0x59')]['id']){delete _0x316196['body']['id'];}if(_[_0xda75('0x7c')](_0x316196[_0xda75('0x59')]['from'])){throw new db[(_0xda75('0x1f'))]['ValidationError'](_0xda75('0x8f'));}if(_[_0xda75('0x7c')](_0x316196['body'][_0xda75('0x59')])||_0x316196[_0xda75('0x59')][_0xda75('0x59')]===''){throw new db['Sequelize'][(_0xda75('0x20'))](_0xda75('0x90'));}if(_[_0xda75('0x7c')](_0x316196['body'][_0xda75('0x91')])){throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0x92')+_0x1dcde4);}if(!_[_0xda75('0x93')](_0x1dcde4,_0x316196['body'][_0xda75('0x91')])){throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0x94')+_0x1dcde4);}_0x56502b[_0x316196[_0xda75('0x59')][_0xda75('0x91')]]=_0x316196[_0xda75('0x59')]['from'];})[_0xda75('0x21')](function(){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x316196[_0xda75('0x55')]['id']},'include':[{'model':db[_0xda75('0x95')],'as':_0xda75('0x96'),'include':[{'model':db[_0xda75('0x88')],'as':_0xda75('0x97'),'where':_0x56502b,'limit':0x1,'order':[[_0xda75('0x8b'),_0xda75('0x98')]]}]},{'model':db[_0xda75('0x99')],'as':_0xda75('0x9a')}]});})[_0xda75('0x21')](handleEntityNotFound(_0x54936d,null))[_0xda75('0x21')](function(_0x173d33){if(_0x173d33&&_0x173d33[_0xda75('0x96')]){_0x47ee75[_0xda75('0x9b')]=_0x173d33;_0x47ee75[_0xda75('0x9c')]=_0x173d33[_0xda75('0x9a')];_0x47ee75[_0xda75('0x9d')]=_0x173d33['List'];_0x47ee75[_0xda75('0x9c')]=_[_0xda75('0x9e')](_0x47ee75['applications'],[_0xda75('0x9f')],[_0xda75('0xa0')]);if(_0x47ee75['account'][_0xda75('0x9a')]){delete _0x47ee75[_0xda75('0x9b')]['Applications'];}if(_0x47ee75['account'][_0xda75('0x96')]&&_0x47ee75[_0xda75('0x9b')][_0xda75('0x96')][_0xda75('0x97')]['length']){return _0x47ee75['account']['List'][_0xda75('0x97')][0x0];}var _0x2b1eac=_[_0xda75('0x18')](_0x316196['body'],{'firstName':_0x316196[_0xda75('0x59')]['from'],'ListId':_0x173d33[_0xda75('0x8e')]});_0x2b1eac[_0x316196[_0xda75('0x59')][_0xda75('0x91')]]=_0x316196[_0xda75('0x59')][_0xda75('0xa1')];return db[_0xda75('0x88')][_0xda75('0x58')](_0x2b1eac,{'fields':_0x77a8ec,'raw':!![]});}})[_0xda75('0x21')](handleEntityNotFound(_0x54936d,null))[_0xda75('0x21')](function(_0x39b9a0){_0x47ee75[_0xda75('0xa2')]=_0x39b9a0;var _0x2f2a1b=_0x316196['body'][_0xda75('0xa3')];if(_0x316196['headers'][_0xda75('0xa4')]){_0x2f2a1b=_0x316196[_0xda75('0x85')][_0xda75('0xa4')];}else if(_0x316196['headers']['x-forwarded-for']){_0x2f2a1b=_[_0xda75('0xa5')](_0x316196['headers'][_0xda75('0xa6')][_0xda75('0xa7')](','));}if(_0x39b9a0){var _0x5321c3={'ContactId':_0x39b9a0['id'],'ChatWebsiteId':_0x316196[_0xda75('0x55')]['id'],'from':(_0x39b9a0['firstName']||'')+'\x20'+(_0x39b9a0['lastName']||''),'customerIp':_0x2f2a1b,'customerPort':_0x316196['headers'][_0xda75('0xa8')]?_0x316196[_0xda75('0x85')]['x-real-port']:null,'referer':_0x316196[_0xda75('0x59')][_0xda75('0xa9')],'browserName':_0x7e0802[_0xda75('0xaa')][_0xda75('0x3a')]&&_0x7e0802[_0xda75('0xaa')][_0xda75('0xab')]?util[_0xda75('0xac')]('%s\x20%s',_0x7e0802['browser'][_0xda75('0x3a')],_0x7e0802[_0xda75('0xaa')][_0xda75('0xab')]):'unknown','browserVersion':_0x7e0802['browser'][_0xda75('0xab')]||_0xda75('0xad'),'osName':util['format'](_0xda75('0xae'),_0x7e0802['os'][_0xda75('0x3a')],_0x7e0802['os'][_0xda75('0xab')]),'osVersion':_0x7e0802['os'][_0xda75('0xab')],'deviceModel':_0x7e0802[_0xda75('0xaf')]['model']&&_0x7e0802[_0xda75('0xaf')]['vendor']?util[_0xda75('0xac')]('%s\x20%s\x20%s',_0x7e0802[_0xda75('0xaf')][_0xda75('0x43')],_0x7e0802[_0xda75('0xaf')][_0xda75('0xb0')],_0x7e0802[_0xda75('0xaf')][_0xda75('0x41')]):null,'deviceVendor':_0x7e0802[_0xda75('0xaf')][_0xda75('0xb0')],'deviceType':_0x7e0802[_0xda75('0xaf')][_0xda75('0x41')],'formData':JSON[_0xda75('0x26')](_0x316196[_0xda75('0x59')])};var _0x5890cd={'ChatWebsiteId':_0x316196[_0xda75('0x55')]['id'],'closed':![]};if(_0x316196[_0xda75('0x59')][_0xda75('0xb1')]){_0x5890cd[_0xda75('0xb1')]=_0x316196[_0xda75('0x59')]['threadId'];return db[_0xda75('0xb2')][_0xda75('0x57')]({'where':_0x5890cd})['then'](function(_0x98dafb){if(_0x98dafb){return[_0x98dafb,![]];}_0x5321c3['threadId']=_0x316196[_0xda75('0x59')]['threadId'];_0x5321c3[_0xda75('0xb3')]=_0x316196['body'][_0xda75('0xb3')];return db[_0xda75('0xb2')][_0xda75('0x58')](_0x5321c3)['then'](function(_0x1dd025){return[_0x1dd025,!![]];});});}_0x5890cd['ContactId']=_0x39b9a0['id'];if(_0x316196[_0xda75('0x59')][_0xda75('0xb4')]&&_0x316196[_0xda75('0x59')][_0xda75('0xb4')]['id']){_0x5890cd['id']=_0x316196[_0xda75('0x59')][_0xda75('0xb4')]['id'];return db[_0xda75('0xb2')][_0xda75('0x57')]({'where':_0x5890cd})['then'](function(_0x543fc5){if(_0x543fc5){return[_0x543fc5,![]];}return db['ChatInteraction'][_0xda75('0x58')](_0x5321c3)['then'](function(_0x11aa73){return[_0x11aa73,!![]];});});}return db[_0xda75('0xb2')][_0xda75('0x58')](_0x5321c3)[_0xda75('0x21')](function(_0x55f833){return[_0x55f833,!![]];});}})[_0xda75('0xb5')](function(_0x6d88a0,_0x259774){if(_0x6d88a0){_0x5dbdf0=_0x259774;if(!_0x259774){var _0x1fe6df={'from':(_0x47ee75['contact'][_0xda75('0xb6')]||'')+'\x20'+(_0x47ee75[_0xda75('0xa2')][_0xda75('0xb7')]||'')};if(_0x316196[_0xda75('0x59')][_0xda75('0xb1')]&&_0x316196[_0xda75('0x59')][_0xda75('0xb8')]&&_0x316196[_0xda75('0x59')][_0xda75('0xb1')]!=_0x316196[_0xda75('0x59')][_0xda75('0xb8')]){_0x1fe6df['threadId']=_0x316196['body']['messageId'];}return _0x6d88a0[_0xda75('0x5f')](_0x1fe6df);}else{return _0x6d88a0;}}})[_0xda75('0x21')](function(_0x39a560){_0x47ee75[_0xda75('0xb4')]=_0x39a560[_0xda75('0x37')]({'plain':!![]});_0x47ee75[_0xda75('0xb4')]['created']=_0x5dbdf0;if(_0x47ee75[_0xda75('0xb4')][_0xda75('0xb9')]){if(_0x47ee75[_0xda75('0x9b')]['autoclose']){_0x47ee75['applications'][_0xda75('0xba')]({'id':0x0,'priority':_0x47ee75['applications'][_0xda75('0x4a')]+0x1,'app':'close','appdata':_0xda75('0xbb'),'interval':'*,*,*,*'});}}return db[_0xda75('0xbc')][_0xda75('0x58')]({'body':_0x316196[_0xda75('0x59')][_0xda75('0x59')],'ChatWebsiteId':_0x316196[_0xda75('0x55')]['id'],'ChatInteractionId':_0x39a560['id'],'direction':'in','ContactId':_0x47ee75[_0xda75('0xa2')]['id'],'AttachmentId':_0x316196[_0xda75('0x59')][_0xda75('0xbd')]});})[_0xda75('0x21')](function(_0x564df6){_0x47ee75[_0xda75('0x28')]=_0x564df6;if(_0x47ee75[_0xda75('0xb4')][_0xda75('0xbe')]){return db[_0xda75('0xbf')][_0xda75('0x57')]({'attributes':['id',_0xda75('0x3a')],'where':{'id':_0x47ee75[_0xda75('0xb4')][_0xda75('0xbe')]}})[_0xda75('0x21')](function(_0x32eaa6){if(_0x32eaa6){_0x47ee75[_0xda75('0x9c')][_0xda75('0xc0')]({'id':0x0,'priority':0x0,'app':_0xda75('0xc1'),'appdata':_0x32eaa6['name']+','+(_0x47ee75['account'][_0xda75('0xc2')]||0xa),'interval':_0xda75('0xc3')});_0x47ee75[_0xda75('0xc4')]=!![];}return respondWithRpcPromise(_0xda75('0xc5'),_0xda75('0xc6'),_0x47ee75);});}return respondWithRpcPromise(_0xda75('0xc5'),_0xda75('0xc6'),_0x47ee75);})[_0xda75('0x21')](function(_0x3ab882){respondWithRpcPromise(_0xda75('0xc7'),_0xda75('0xc7'),{'event':_0xda75('0xc8'),'message':_0x3ab882},client9002);return _0x3ab882;})[_0xda75('0x21')](respondWithResult(_0x54936d,null))[_0xda75('0x2a')](handleError(_0x54936d,null));};exports[_0xda75('0xc9')]=function(_0x2e02a5,_0x392503,_0x35a5e8){var _0x43955e,_0x21e0c1,_0x505b54;var _0x49588e=[];var _0xbbf2c4=[];var _0x421496={};return db[_0xda75('0x88')][_0xda75('0x60')]()['then'](function(_0x266a20){if(!_0x266a20){throw new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0x89'));}_0xbbf2c4=_[_0xda75('0x8c')](_['keys'](_0x266a20),['createdAt',_0xda75('0x8b')]);_0x49588e=_[_0xda75('0x8c')](_[_0xda75('0x45')](_0x266a20),[_0xda75('0x8a'),_0xda75('0x8b'),_0xda75('0x8d'),'ListId']);if(_0x2e02a5[_0xda75('0x59')]['id']){delete _0x2e02a5[_0xda75('0x59')]['id'];}if(_['isNil'](_0x2e02a5['body'][_0xda75('0xa1')])){throw _0x392503['status'](0x1f4)[_0xda75('0xca')](new db['Sequelize'][(_0xda75('0x20'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x2e02a5[_0xda75('0x59')]['body'])||_0x2e02a5[_0xda75('0x59')][_0xda75('0x59')]===''){throw _0x392503['status'](0x1f4)['send'](new db[(_0xda75('0x1f'))][(_0xda75('0x20'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x2e02a5[_0xda75('0x59')]['mapKeyOffline'])){throw _0x392503[_0xda75('0x2c')](0x1f4)[_0xda75('0xca')](new db[(_0xda75('0x1f'))]['ValidationError'](_0xda75('0xcb')+_0x49588e));}if(!_['includes'](_0x49588e,_0x2e02a5[_0xda75('0x59')][_0xda75('0xcc')])){throw _0x392503['status'](0x1f4)[_0xda75('0xca')](new db[(_0xda75('0x1f'))][(_0xda75('0x20'))](_0xda75('0xcd')+_0x49588e));}_0x421496[_0x2e02a5[_0xda75('0x59')]['mapKeyOffline']]=_0x2e02a5['body'][_0xda75('0xa1')];})[_0xda75('0x21')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2e02a5[_0xda75('0x55')]['id']},'include':[{'model':db[_0xda75('0x95')],'as':_0xda75('0x96')}]});})[_0xda75('0x21')](handleEntityNotFound(_0x392503,null))[_0xda75('0x21')](function(_0x148902){if(_0x148902&&_0x148902['List']){_0x21e0c1=_0x148902;var _0x30ea82=_[_0xda75('0x18')](_0x2e02a5[_0xda75('0x59')],{'firstName':_0x2e02a5['body'][_0xda75('0xa1')],'phone':_0x2e02a5['body'][_0xda75('0xa1')],'ListId':_0x148902[_0xda75('0x8e')]});_0x30ea82[_0x2e02a5[_0xda75('0x59')][_0xda75('0xcc')]]=_0x2e02a5[_0xda75('0x59')][_0xda75('0xa1')];return db[_0xda75('0x88')]['findOrCreate']({'where':_0x421496,'defaults':_0x30ea82});}})[_0xda75('0xb5')](function(_0x2ed32b){if(_0x2ed32b){_0x505b54=_0x2ed32b;var _0x2f3dfc=fs[_0xda75('0xce')](path[_0xda75('0x78')](config[_0xda75('0x79')],_0xda75('0xcf')),_0xda75('0xd0'));var _0x44bcdd=ejs[_0xda75('0xd1')](_0x2f3dfc,{'body':_[_0xda75('0xd2')](_0x2e02a5[_0xda75('0x59')][_0xda75('0x59')]),'bodyTitle':_0x21e0c1['offlineMessageBody']});return db[_0xda75('0xd3')]['create']({'body':_0x44bcdd,'ContactId':_0x2ed32b['id'],'ChatWebsiteId':_0x21e0c1['id']});}})['then'](function(_0x54cfcb){if(_0x54cfcb){_0x43955e=_0x54cfcb;return db[_0xda75('0xd4')][_0xda75('0x6b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xda75('0xd5'),'raw':!![]}]});}})[_0xda75('0x21')](function(_0x37e61b){if(_0x37e61b&&_0x37e61b[_0xda75('0xd5')]&&_0x21e0c1['forwardOfflineAddress']){var _0x410a8b={'tls':{'rejectUnauthorized':![]}};if(_0x37e61b[_0xda75('0xd5')][_0xda75('0xd6')]){_0x410a8b[_0xda75('0xd6')]=_0x37e61b[_0xda75('0xd5')][_0xda75('0xd6')];}else{_0x410a8b[_0xda75('0xd7')]=_0x37e61b[_0xda75('0xd5')][_0xda75('0xd7')];_0x410a8b[_0xda75('0xd8')]=_0x37e61b['Smtp'][_0xda75('0xd8')];_0x410a8b[_0xda75('0xd9')]=_0x37e61b[_0xda75('0xd5')][_0xda75('0xd9')];}if(_0x37e61b[_0xda75('0xd5')]['authentication']){_0x410a8b[_0xda75('0xda')]={'user':_0x37e61b[_0xda75('0xd5')][_0xda75('0x5b')],'pass':_0x37e61b[_0xda75('0xd5')][_0xda75('0xdb')]};}return respondWithRpcPromise(_0xda75('0xdc'),'sendMail',{'account':_0x410a8b,'message':{'from':util[_0xda75('0xac')](_0xda75('0xdd'),_0x37e61b[_0xda75('0x3a')],_0x37e61b[_0xda75('0xde')]||_0x37e61b[_0xda75('0xd5')][_0xda75('0x5b')]),'to':_0x21e0c1[_0xda75('0xdf')],'subject':_0x21e0c1[_0xda75('0xe0')],'text':_0x43955e[_0xda75('0x59')]}},client9003)[_0xda75('0x21')](function(){return _0x43955e;})[_0xda75('0x2a')](function(_0x466926){console[_0xda75('0x27')](_0x466926);});}})['then'](function(){if(_0x43955e){return _0x43955e;}})[_0xda75('0x21')](respondWithResult(_0x392503,null))[_0xda75('0x2a')](handleError(_0x392503,null));};exports[_0xda75('0xe1')]=function(_0x2aef09,_0x1d2280,_0x3a5c0c){return db[_0xda75('0xb2')]['find']({'where':{'id':_0x2aef09['params']['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x1d2280,null))['then'](function(_0x14b7cc){if(_0x14b7cc){return _0x14b7cc['addInteraction'](_0x2aef09[_0xda75('0x59')][_0xda75('0x67')],_['omit'](_0x2aef09[_0xda75('0x59')],[_0xda75('0x67'),'id'])||{});}})[_0xda75('0x21')](respondWithResult(_0x1d2280,null))[_0xda75('0x2a')](handleError(_0x1d2280,null));};exports[_0xda75('0xe2')]=function(_0x42598d,_0x3dab25,_0x583aa9){var _0x1c1759={'raw':![],'where':{}};var _0x4224ee={};var _0x4597ef={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x42598d[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x3dab25,null))['then'](function(_0x2ffd16){if(_0x2ffd16){_0x4224ee[_0xda75('0x43')]=_['keys'](db[_0xda75('0xb2')]['rawAttributes']);_0x4224ee[_0xda75('0x44')]=_['keys'](_0x42598d['query']);_0x4224ee['filters']=_[_0xda75('0x47')](_0x4224ee[_0xda75('0x43')],_0x4224ee[_0xda75('0x44')]);_0x1c1759[_0xda75('0x48')]=_[_0xda75('0x47')](_0x4224ee[_0xda75('0x43')],qs[_0xda75('0x49')](_0x42598d[_0xda75('0x44')]['fields']));_0x1c1759[_0xda75('0x48')]=_0x1c1759[_0xda75('0x48')][_0xda75('0x4a')]?_0x1c1759[_0xda75('0x48')]:_0x4224ee['model'];if(!_0x42598d[_0xda75('0x44')][_0xda75('0x4b')](_0xda75('0x6c'))){_0x1c1759[_0xda75('0x31')]=qs['limit'](_0x42598d['query']['limit']);_0x1c1759[_0xda75('0x30')]=qs['offset'](_0x42598d['query']['offset']);}_0x1c1759['order']=qs[_0xda75('0x4d')](_0x42598d['query'][_0xda75('0x4d')]);_0x1c1759['where']=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x42598d[_0xda75('0x44')],_0x4224ee[_0xda75('0x46')]));_0x1c1759[_0xda75('0x50')]['ChatWebsiteId']=_0x2ffd16['id'];if(_0x42598d[_0xda75('0x44')][_0xda75('0x4f')]){_0x1c1759[_0xda75('0x50')]=_[_0xda75('0x51')](_0x1c1759['where'],{'$or':_['map'](_0x1c1759['attributes'],function(_0x3ad2c0){var _0x228987={};_0x228987[_0x3ad2c0]={'$like':'%'+_0x42598d[_0xda75('0x44')][_0xda75('0x4f')]+'%'};return _0x228987;})});}_0x1c1759=_[_0xda75('0x51')]({},_0x1c1759,_0x42598d['options']);return db['ChatInteraction'][_0xda75('0x2f')]({'where':_0x1c1759['where']})[_0xda75('0x21')](function(_0x5f3967){_0x4597ef[_0xda75('0x2f')]=_0x5f3967;if(_0x42598d[_0xda75('0x44')]['includeAll']){_0x1c1759['include']=[{'model':db['CmContact'],'as':_0xda75('0xe3'),'required':![]},{'model':db[_0xda75('0xbf')],'as':_0xda75('0xe4'),'attributes':[_0xda75('0x3a'),_0xda75('0xe5'),_0xda75('0xe6')],'required':![]},{'model':db['Tag'],'as':_0xda75('0xe7'),'attributes':['id',_0xda75('0x3a'),_0xda75('0xe8')],'where':_0x42598d[_0xda75('0x44')][_0xda75('0xe9')]?{'id':_0x42598d[_0xda75('0x44')][_0xda75('0xe9')]}:undefined,'required':_0x42598d['query'][_0xda75('0xe9')]?!![]:![]}];}return db[_0xda75('0xb2')]['findAll'](_0x1c1759);})[_0xda75('0x21')](function(_0x34884a){_0x4597ef['rows']=_0x34884a;return _0x4597ef;});}})[_0xda75('0x21')](respondWithFilteredResult(_0x3dab25,_0x1c1759))['catch'](handleError(_0x3dab25,null));};function iftimePromise(_0x391360,_0x25b49b){return respondWithRpcPromise('Command',_0xda75('0xea'),{'command':_0x25b49b['timezone']?util[_0xda75('0xac')](_0xda75('0xeb'),_0x391360[_0xda75('0xec')],_0x25b49b[_0xda75('0xed')]):util[_0xda75('0xac')](_0xda75('0xee'),_0x391360[_0xda75('0xec')])},client9002)[_0xda75('0x21')](function(_0x4e8ceb){var _0x20a407=_0x4e8ceb&&_0x4e8ceb[_0xda75('0xef')](_0xda75('0xf0'))>=0x0?!![]:![];logger[_0xda75('0x22')](_0xda75('0xf1'),_0x25b49b['id'],_0x391360['id'],_0x391360[_0xda75('0xec')],_0x20a407?_0xda75('0xf2'):'OFFLINE',_0x25b49b[_0xda75('0xed')]?_0x25b49b[_0xda75('0xed')]:_0xda75('0xf3'));return _0x20a407;})[_0xda75('0x2a')](function(_0x48ea89){logger[_0xda75('0x27')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x25b49b['id'],_0x391360['id'],_0x391360[_0xda75('0xec')],util[_0xda75('0xf4')](_0x48ea89,{'showHidden':![],'depth':null}),_0x25b49b['timezone']?_0x25b49b[_0xda75('0xed')]:_0xda75('0xf3'));return![];});}exports[_0xda75('0xea')]=function(_0x59c53d,_0x32a057,_0x1097d1){var _0x5cbc2c=0x0;var _0x399906=0x0;var _0x9f9b50=![];var _0x309295;var _0x412e3e;return db[_0xda75('0x3e')]['find']({'where':{'id':_0x59c53d[_0xda75('0x55')]['id']},'include':[{'model':db[_0xda75('0xf5')],'as':_0xda75('0xf5'),'include':[{'model':db[_0xda75('0xf5')],'as':_0xda75('0xf6'),'attributes':['id',_0xda75('0xec')],'raw':!![]}]}]})[_0xda75('0x21')](handleEntityNotFound(_0x32a057,null))[_0xda75('0x21')](function(_0x47f21c){if(_0x47f21c){_0x309295=_0x47f21c;return _0x47f21c[_0xda75('0xf7')]({'raw':!![]});}})['then'](function(_0x32c2c4){if(_0x309295){if(_0x32c2c4){_0x412e3e=_0x32c2c4;}}return require(_0xda75('0x7a'))[_0xda75('0xf8')]();})[_0xda75('0x21')](function(_0x4f0555){if(_0x4f0555){_0x399906=_0x4f0555[_0xda75('0xf9')];_0x9f9b50=_0x4f0555[_0xda75('0x7b')];}})[_0xda75('0x21')](function(){return db[_0xda75('0xb2')][_0xda75('0x2f')]({'where':{'closed':![]}});})[_0xda75('0x21')](function(_0x4819dd){_0x5cbc2c=_0x4819dd;if(_0x399906&&_0x4819dd>_0x399906){return db[_0xda75('0xfa')]['findOne']({'where':{'id':0x1}})['then'](function(_0x3454ee){if(_0x3454ee){_0x3454ee[_0xda75('0xfb')]('chatLicenseExceeded');}});}})[_0xda75('0x21')](function(){if(_0x309295[_0xda75('0xf5')]&&_0x309295['Interval'][_0xda75('0xf6')]){var _0x7ad3f0=[];for(var _0x299969=0x0;_0x299969<_0x309295[_0xda75('0xf5')][_0xda75('0xf6')][_0xda75('0x4a')];_0x299969++){var _0x30005d=_0x309295['Interval'][_0xda75('0xf6')][_0x299969][_0xda75('0x37')]({'plain':!![]});_0x7ad3f0['push'](iftimePromise(_0x30005d,_0x309295));}return BPromise['all'](_0x7ad3f0)['then'](function(_0x3c3c1c){return _[_0xda75('0xfc')](_0x3c3c1c);});}else{return!![];}})['then'](function(_0x6de896){var _0x223c1b=fs[_0xda75('0xce')](path[_0xda75('0x78')](config[_0xda75('0x79')],_0xda75('0xfd')),_0xda75('0xd0'));var _0x588464={'remote':_0x309295['remote'],'query':querystring[_0xda75('0x26')](_['merge'](_0x309295[_0xda75('0x37')]({'plain':!![]}),{'customerIp':_0x59c53d[_0xda75('0x85')]['x-forwarded-for']||_0x59c53d[_0xda75('0x85')][_0xda75('0xfe')]||_0x59c53d[_0xda75('0xff')]['remoteAddress']||_0x59c53d['ip'],'referer':_0x59c53d['headers'][_0xda75('0xa9')],'openedInteractions':_0x5cbc2c,'maxInteractions':_0x399906,'virtual':_0x9f9b50['virtual'],'online':_0x6de896,'custom':_0x9f9b50}))['replace'](/'/g,'\x5c\x27')};_0x32a057['send'](ejs[_0xda75('0xd1')](Mustache[_0xda75('0xd1')](_0x223c1b,_0x588464),{'proactiveActions':_0x412e3e,'alignment':_0x309295[_0xda75('0x100')],'verticalAlignment':_0x309295[_0xda75('0x101')],'div_color':_0x309295['color'],'text_color':_0x309295['textColor']}));})[_0xda75('0x2a')](handleError(_0x32a057,null));};exports['addApplications']=function(_0x4585b0,_0x591ae7,_0x1ba8e2){return db[_0xda75('0x3e')][_0xda75('0x6b')]({'where':{'id':_0x4585b0[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x591ae7,null))[_0xda75('0x21')](function(_0x16548c){if(_0x16548c){return db[_0xda75('0x102')][_0xda75('0x103')](function(_0xde2c63){return db[_0xda75('0x99')][_0xda75('0x36')]({'where':{'ChatWebsiteId':_0x4585b0[_0xda75('0x55')]['id']},'transaction':_0xde2c63})[_0xda75('0x21')](function(_0x1e60d5){var _0x29bc32=_['map'](_0x4585b0['body'],function(_0x3f2b1c){_0x3f2b1c['ChatWebsiteId']=_0x4585b0[_0xda75('0x55')]['id'];return _0x3f2b1c;});return db[_0xda75('0x99')]['bulkCreate'](_0x29bc32,{'transaction':_0xde2c63});});})[_0xda75('0x21')](function(){return db[_0xda75('0x99')][_0xda75('0x104')]({'where':{'ChatWebsiteId':_0x4585b0[_0xda75('0x55')]['id']},'order':_0xda75('0x9f')});});}})[_0xda75('0x21')](respondWithResult(_0x591ae7,null))[_0xda75('0x2a')](handleError(_0x591ae7,null));};exports['getApplications']=function(_0x4a5913,_0x399dfe,_0x2dec9a){var _0xb73ee1={};var _0x26e855={};var _0x2a96ae;var _0x1a24cb;return db['ChatWebsite']['findOne']({'where':{'id':_0x4a5913[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x399dfe,null))['then'](function(_0xc8c6f){if(_0xc8c6f){_0x2a96ae=_0xc8c6f;_0x26e855[_0xda75('0x43')]=_['keys'](db[_0xda75('0x99')][_0xda75('0x3f')]);_0x26e855[_0xda75('0x44')]=_[_0xda75('0x45')](_0x4a5913[_0xda75('0x44')]);_0x26e855['filters']=_[_0xda75('0x47')](_0x26e855[_0xda75('0x43')],_0x26e855['query']);_0xb73ee1[_0xda75('0x48')]=_[_0xda75('0x47')](_0x26e855[_0xda75('0x43')],qs['fields'](_0x4a5913[_0xda75('0x44')]['fields']));_0xb73ee1[_0xda75('0x48')]=_0xb73ee1[_0xda75('0x48')]['length']?_0xb73ee1[_0xda75('0x48')]:_0x26e855[_0xda75('0x43')];_0xb73ee1[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x4a5913[_0xda75('0x44')][_0xda75('0x4d')]);_0xb73ee1['where']=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x4a5913[_0xda75('0x44')],_0x26e855[_0xda75('0x46')]));if(_0x4a5913[_0xda75('0x44')][_0xda75('0x4f')]){_0xb73ee1['where']=_['merge'](_0xb73ee1[_0xda75('0x50')],{'$or':_['map'](_0xb73ee1[_0xda75('0x48')],function(_0x226dd4){var _0x147cd8={};_0x147cd8[_0x226dd4]={'$like':'%'+_0x4a5913['query']['filter']+'%'};return _0x147cd8;})});}_0xb73ee1=_[_0xda75('0x51')]({},_0xb73ee1,_0x4a5913[_0xda75('0x56')]);return _0x2a96ae[_0xda75('0x105')](_0xb73ee1);}})[_0xda75('0x21')](function(_0x1b0633){if(_0x1b0633){_0x1a24cb=_0x1b0633[_0xda75('0x4a')];if(!_0x4a5913[_0xda75('0x44')][_0xda75('0x4b')](_0xda75('0x6c'))){_0xb73ee1[_0xda75('0x31')]=qs[_0xda75('0x31')](_0x4a5913[_0xda75('0x44')][_0xda75('0x31')]);_0xb73ee1[_0xda75('0x30')]=qs[_0xda75('0x30')](_0x4a5913[_0xda75('0x44')]['offset']);}return _0x2a96ae[_0xda75('0x105')](_0xb73ee1);}})[_0xda75('0x21')](function(_0x57e669){if(_0x57e669){return _0x57e669?{'count':_0x1a24cb,'rows':_0x57e669}:null;}})[_0xda75('0x21')](respondWithResult(_0x399dfe,null))[_0xda75('0x2a')](handleError(_0x399dfe,null));};exports[_0xda75('0x106')]=function(_0x5291c5,_0x3cbc3f,_0x14caa0){return db[_0xda75('0x107')]['find']({'where':{'id':_0x5291c5[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x3cbc3f,null))[_0xda75('0x21')](function(_0x3a1fd1){if(_0x3a1fd1){return _0x3a1fd1['addProactiveActions'](_0x5291c5[_0xda75('0x59')][_0xda75('0x67')],_[_0xda75('0x108')](_0x5291c5[_0xda75('0x59')],[_0xda75('0x67'),'id'])||{});}})[_0xda75('0x21')](respondWithResult(_0x3cbc3f,null))[_0xda75('0x2a')](handleError(_0x3cbc3f,null));};exports[_0xda75('0xf7')]=function(_0x3ea66e,_0x527881,_0x47c703){var _0x12af7f={};var _0x2cae4d={};var _0x976df7;var _0x43c830;return db[_0xda75('0x3e')][_0xda75('0x6b')]({'where':{'id':_0x3ea66e[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x527881,null))[_0xda75('0x21')](function(_0x4543ed){if(_0x4543ed){_0x976df7=_0x4543ed;_0x2cae4d['model']=_[_0xda75('0x45')](db[_0xda75('0x109')][_0xda75('0x3f')]);_0x2cae4d[_0xda75('0x44')]=_[_0xda75('0x45')](_0x3ea66e['query']);_0x2cae4d[_0xda75('0x46')]=_[_0xda75('0x47')](_0x2cae4d[_0xda75('0x43')],_0x2cae4d['query']);_0x12af7f[_0xda75('0x48')]=_[_0xda75('0x47')](_0x2cae4d[_0xda75('0x43')],qs['fields'](_0x3ea66e[_0xda75('0x44')][_0xda75('0x49')]));_0x12af7f['attributes']=_0x12af7f[_0xda75('0x48')][_0xda75('0x4a')]?_0x12af7f['attributes']:_0x2cae4d[_0xda75('0x43')];_0x12af7f[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x3ea66e[_0xda75('0x44')]['sort']);_0x12af7f[_0xda75('0x50')]=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x3ea66e[_0xda75('0x44')],_0x2cae4d[_0xda75('0x46')]));if(_0x3ea66e[_0xda75('0x44')][_0xda75('0x4f')]){_0x12af7f['where']=_[_0xda75('0x51')](_0x12af7f[_0xda75('0x50')],{'$or':_[_0xda75('0x3d')](_0x12af7f['attributes'],function(_0x4b1c3c){var _0x278ab6={};_0x278ab6[_0x4b1c3c]={'$like':'%'+_0x3ea66e[_0xda75('0x44')][_0xda75('0x4f')]+'%'};return _0x278ab6;})});}_0x12af7f=_[_0xda75('0x51')]({},_0x12af7f,_0x3ea66e[_0xda75('0x56')]);return _0x976df7[_0xda75('0xf7')](_0x12af7f);}})[_0xda75('0x21')](function(_0x312b38){if(_0x312b38){_0x43c830=_0x312b38[_0xda75('0x4a')];if(!_0x3ea66e[_0xda75('0x44')][_0xda75('0x4b')](_0xda75('0x6c'))){_0x12af7f[_0xda75('0x31')]=qs[_0xda75('0x31')](_0x3ea66e[_0xda75('0x44')]['limit']);_0x12af7f[_0xda75('0x30')]=qs['offset'](_0x3ea66e['query'][_0xda75('0x30')]);}return _0x976df7[_0xda75('0xf7')](_0x12af7f);}})[_0xda75('0x21')](function(_0x309044){if(_0x309044){return _0x309044?{'count':_0x43c830,'rows':_0x309044}:null;}})[_0xda75('0x21')](respondWithResult(_0x527881,null))[_0xda75('0x2a')](handleError(_0x527881,null));};exports['getFields']=function(_0x5c5010,_0x170687,_0x58f992){var _0xba5824=_0x5c5010[_0xda75('0x44')][_0xda75('0x10a')]===_0xda75('0x10b')?_0xda75('0x10c'):_0xda75('0x10d');return db[_0xda75('0x3e')][_0xda75('0x57')]({'attributes':['id',_0xba5824],'where':{'id':_0x5c5010[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x170687,null))[_0xda75('0x21')](function(_0x4a2a2b){if(_0x4a2a2b){var _0x504f2e=_0x4a2a2b[_0xba5824];var _0x436370=_0x504f2e&&_0x504f2e[_0xda75('0x10e')]?_0x504f2e[_0xda75('0x10e')]:[];_0x170687['send']({'fromKey':_['isNil'](_0x504f2e['fromKey'])?undefined:_0x504f2e['fromKey'],'count':_0x436370[_0xda75('0x4a')],'rows':_0x436370});}})[_0xda75('0x2a')](handleError(_0x170687,null));};exports[_0xda75('0x10f')]=function(_0x1bf487,_0x47ff26,_0x249de1){var _0x2e555f={'raw':![],'where':{}};var _0x55d2d6={};var _0x3419dc={'count':0x0,'rows':[]};return db[_0xda75('0x3e')][_0xda75('0x6b')]({'where':{'id':_0x1bf487[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x47ff26,null))[_0xda75('0x21')](function(_0x164196){if(_0x164196){_0x55d2d6[_0xda75('0x43')]=_[_0xda75('0x45')](db[_0xda75('0xd3')]['rawAttributes']);_0x55d2d6[_0xda75('0x44')]=_['keys'](_0x1bf487['query']);_0x55d2d6[_0xda75('0x46')]=_[_0xda75('0x47')](_0x55d2d6[_0xda75('0x43')],_0x55d2d6[_0xda75('0x44')]);_0x2e555f[_0xda75('0x48')]=_[_0xda75('0x47')](_0x55d2d6['model'],qs[_0xda75('0x49')](_0x1bf487[_0xda75('0x44')][_0xda75('0x49')]));_0x2e555f[_0xda75('0x48')]=_0x2e555f[_0xda75('0x48')][_0xda75('0x4a')]?_0x2e555f[_0xda75('0x48')]:_0x55d2d6[_0xda75('0x43')];if(!_0x1bf487[_0xda75('0x44')][_0xda75('0x4b')](_0xda75('0x6c'))){_0x2e555f[_0xda75('0x31')]=qs['limit'](_0x1bf487['query'][_0xda75('0x31')]);_0x2e555f[_0xda75('0x30')]=qs['offset'](_0x1bf487[_0xda75('0x44')][_0xda75('0x30')]);}_0x2e555f[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x1bf487[_0xda75('0x44')][_0xda75('0x4d')]);_0x2e555f[_0xda75('0x50')]=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x1bf487['query'],_0x55d2d6['filters']));_0x2e555f[_0xda75('0x50')][_0xda75('0x62')]=_0x164196['id'];if(_0x1bf487['query'][_0xda75('0x4f')]){_0x2e555f['where']=_[_0xda75('0x51')](_0x2e555f['where'],{'$or':_['map'](_0x2e555f['attributes'],function(_0x5dc194){var _0xc527e7={};_0xc527e7[_0x5dc194]={'$like':'%'+_0x1bf487[_0xda75('0x44')]['filter']+'%'};return _0xc527e7;})});}_0x2e555f=_[_0xda75('0x51')]({},_0x2e555f,_0x1bf487[_0xda75('0x56')]);return db[_0xda75('0xd3')][_0xda75('0x2f')]({'where':_0x2e555f[_0xda75('0x50')]})[_0xda75('0x21')](function(_0x47a001){_0x3419dc[_0xda75('0x2f')]=_0x47a001;if(_0x1bf487[_0xda75('0x44')][_0xda75('0x53')]){_0x2e555f['include']=[{'all':!![]}];}else{_0x2e555f[_0xda75('0x54')]=[{'model':db[_0xda75('0x88')],'as':_0xda75('0xe3'),'required':![]}];}return db['ChatOfflineMessage'][_0xda75('0x65')](_0x2e555f);})['then'](function(_0x28d446){_0x3419dc[_0xda75('0x6d')]=_0x28d446;return _0x3419dc;});}})[_0xda75('0x21')](respondWithFilteredResult(_0x47ff26,_0x2e555f))['catch'](handleError(_0x47ff26,null));};exports['addAgents']=function(_0x1e3ae9,_0xacffed,_0x25924f){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x1e3ae9[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0xacffed,null))['then'](function(_0x2e4ab8){if(_0x2e4ab8){return _0x2e4ab8[_0xda75('0x110')](_0x1e3ae9['body']['ids'],_[_0xda75('0x108')](_0x1e3ae9[_0xda75('0x59')],[_0xda75('0x67'),'id'])||{})[_0xda75('0xb5')](function(_0xfc1ba8){for(var _0x2abc19=0x0;_0x2abc19<_0x1e3ae9[_0xda75('0x59')]['ids']['length'];_0x2abc19+=0x1){socket[_0xda75('0x111')](_0xda75('0x112'),{'UserId':_0x1e3ae9[_0xda75('0x59')][_0xda75('0x67')][_0x2abc19],'ChatWebsiteId':_0x1e3ae9[_0xda75('0x55')]['id']});}return _0xfc1ba8;});}})[_0xda75('0x21')](respondWithResult(_0xacffed,null))['catch'](handleError(_0xacffed,null));};exports[_0xda75('0x113')]=function(_0x225f7e,_0x8639e9,_0x4d2f0b){return db[_0xda75('0x3e')][_0xda75('0x57')]({'where':{'id':_0x225f7e[_0xda75('0x55')]['id']}})[_0xda75('0x21')](handleEntityNotFound(_0x8639e9,null))[_0xda75('0x21')](function(_0x20f594){if(_0x20f594){return _0x20f594[_0xda75('0x113')](_0x225f7e['query'][_0xda75('0x67')])['then'](function(){if(_[_0xda75('0x114')](_0x225f7e[_0xda75('0x44')][_0xda75('0x67')])){for(var _0x4b2343=0x0;_0x4b2343<_0x225f7e[_0xda75('0x44')][_0xda75('0x67')][_0xda75('0x4a')];_0x4b2343+=0x1){socket[_0xda75('0x111')](_0xda75('0x115'),{'UserId':Number(_0x225f7e[_0xda75('0x44')][_0xda75('0x67')][_0x4b2343]),'ChatWebsiteId':Number(_0x225f7e['params']['id'])});}}else{socket[_0xda75('0x111')](_0xda75('0x115'),{'UserId':Number(_0x225f7e[_0xda75('0x44')][_0xda75('0x67')]),'ChatWebsiteId':Number(_0x225f7e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x8639e9,null))[_0xda75('0x2a')](handleError(_0x8639e9,null));};exports['getAgents']=function(_0x212658,_0x3595d,_0x6d7a32){var _0x3e64f6={};var _0x20dbc1={};var _0x450e24;var _0x1ff749;return db[_0xda75('0x3e')]['findOne']({'where':{'id':_0x212658[_0xda75('0x55')]['id']}})['then'](handleEntityNotFound(_0x3595d,null))[_0xda75('0x21')](function(_0x47395f){if(_0x47395f){_0x450e24=_0x47395f;_0x20dbc1['model']=_[_0xda75('0x45')](db[_0xda75('0xbf')][_0xda75('0x3f')]);_0x20dbc1['query']=_['keys'](_0x212658['query']);_0x20dbc1['filters']=_[_0xda75('0x47')](_0x20dbc1[_0xda75('0x43')],_0x20dbc1[_0xda75('0x44')]);_0x3e64f6[_0xda75('0x48')]=_[_0xda75('0x47')](_0x20dbc1['model'],qs[_0xda75('0x49')](_0x212658[_0xda75('0x44')]['fields']));_0x3e64f6['attributes']=_0x3e64f6[_0xda75('0x48')][_0xda75('0x4a')]?_0x3e64f6[_0xda75('0x48')]:_0x20dbc1[_0xda75('0x43')];_0x3e64f6[_0xda75('0x4c')]=qs[_0xda75('0x4d')](_0x212658[_0xda75('0x44')][_0xda75('0x4d')]);_0x3e64f6[_0xda75('0x50')]=qs[_0xda75('0x46')](_[_0xda75('0x4e')](_0x212658[_0xda75('0x44')],_0x20dbc1[_0xda75('0x46')]));if(_0x212658[_0xda75('0x44')][_0xda75('0x4f')]){_0x3e64f6['where']=_[_0xda75('0x51')](_0x3e64f6['where'],{'$or':_[_0xda75('0x3d')](_0x3e64f6[_0xda75('0x48')],function(_0x3a1f0e){var _0x5e705c={};_0x5e705c[_0x3a1f0e]={'$like':'%'+_0x212658['query'][_0xda75('0x4f')]+'%'};return _0x5e705c;})});}_0x3e64f6=_['merge']({},_0x3e64f6,_0x212658[_0xda75('0x56')]);return _0x450e24['getAgents'](_0x3e64f6);}})[_0xda75('0x21')](function(_0x316f13){if(_0x316f13){_0x1ff749=_0x316f13[_0xda75('0x4a')];if(!_0x212658[_0xda75('0x44')]['hasOwnProperty'](_0xda75('0x6c'))){_0x3e64f6[_0xda75('0x31')]=qs[_0xda75('0x31')](_0x212658[_0xda75('0x44')]['limit']);_0x3e64f6['offset']=qs['offset'](_0x212658['query'][_0xda75('0x30')]);}return _0x450e24[_0xda75('0x116')](_0x3e64f6);}})['then'](function(_0x51a131){if(_0x51a131){return _0x51a131?{'count':_0x1ff749,'rows':_0x51a131}:null;}})[_0xda75('0x21')](respondWithResult(_0x3595d,null))[_0xda75('0x2a')](handleError(_0x3595d,null));}; \ No newline at end of file +var _0xe194=['findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','Owner','fullname','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','No\x20timezone','Interval','Intervals','virtual','License','increment','all','server/files/chat/iframe.js','utf8','remote','x-real-ip','connection','replace','render','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','online','false','offlineForm','items','fromKey','ChatOfflineMessage','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','destroy','get','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','name','options','where','include','findAll','show','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','customerAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','customerIp','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','format','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList'];(function(_0x24be8e,_0x45abbc){var _0x300093=function(_0x36979a){while(--_0x36979a){_0x24be8e['push'](_0x24be8e['shift']());}};_0x300093(++_0x45abbc);}(_0xe194,0x167));var _0x4e19=function(_0x1bc762,_0x523eb3){_0x1bc762=_0x1bc762-0x0;var _0x40f70c=_0xe194[_0x1bc762];return _0x40f70c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4e19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e19('0x1'));var jsonpatch=require(_0x4e19('0x2'));var rp=require('request-promise');var moment=require(_0x4e19('0x3'));var BPromise=require(_0x4e19('0x4'));var Mustache=require('mustache');var util=require(_0x4e19('0x5'));var path=require(_0x4e19('0x6'));var sox=require(_0x4e19('0x7'));var csv=require(_0x4e19('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4e19('0x9'));var squel=require('squel');var crypto=require(_0x4e19('0xa'));var jsforce=require(_0x4e19('0xb'));var deskjs=require(_0x4e19('0xc'));var toCsv=require(_0x4e19('0x8'));var querystring=require(_0x4e19('0xd'));var Papa=require(_0x4e19('0xe'));var Redis=require(_0x4e19('0xf'));var authService=require(_0x4e19('0x10'));var qs=require(_0x4e19('0x11'));var as=require(_0x4e19('0x12'));var hardwareService=require(_0x4e19('0x13'));var logger=require(_0x4e19('0x14'))(_0x4e19('0x15'));var utils=require(_0x4e19('0x16'));var config=require(_0x4e19('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4e19('0x18')](config[_0x4e19('0x19')],{'host':_0x4e19('0x1a'),'port':0x18eb});var socket=require(_0x4e19('0x1b'))(new Redis(config[_0x4e19('0x19')]));require('./chatWebsite.socket')[_0x4e19('0x1c')](socket);var jayson=require(_0x4e19('0x1d'));var client=jayson['client'][_0x4e19('0x1e')]({'port':0x232c});var client9002=jayson[_0x4e19('0x1f')][_0x4e19('0x1e')]({'port':0x232a});var client9003=jayson[_0x4e19('0x1f')][_0x4e19('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x3436ac,_0x5373a8,_0x1ed93f){if(_0x1ed93f){var _0x445d16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x445d16['test'](_0x5373a8)){return _0x3436ac;}else{throw new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0x22'));}}else{return _0x3436ac;}}function respondWithRpcPromise(_0x111037,_0x279703,_0x1f48ca,_0x50abbd){return new BPromise(function(_0x267df6,_0x5a11d5){var _0x1b1607=_0x50abbd||client;return _0x1b1607[_0x4e19('0x23')](_0x111037,_0x1f48ca)['then'](function(_0x25ddb8){logger[_0x4e19('0x24')](_0x4e19('0x25'),_0x279703,'request\x20sent');logger[_0x4e19('0x26')](_0x4e19('0x27'),_0x279703,_0x4e19('0x28'),JSON['stringify'](_0x25ddb8));if(_0x25ddb8[_0x4e19('0x29')]){if(_0x25ddb8[_0x4e19('0x29')][_0x4e19('0x2a')]===0x1f4){logger[_0x4e19('0x29')](_0x4e19('0x25'),_0x279703,_0x25ddb8[_0x4e19('0x29')]['message']);return _0x5a11d5(_0x25ddb8[_0x4e19('0x29')][_0x4e19('0x2b')]);}logger[_0x4e19('0x29')]('ChatWebsite,\x20%s,\x20%s',_0x279703,_0x25ddb8['error'][_0x4e19('0x2b')]);return _0x267df6(_0x25ddb8[_0x4e19('0x29')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x279703,'request\x20sent');_0x267df6(_0x25ddb8[_0x4e19('0x2c')][_0x4e19('0x2b')]);}})[_0x4e19('0x2d')](function(_0x1b04a9){logger[_0x4e19('0x29')](_0x4e19('0x25'),_0x279703,_0x1b04a9);_0x5a11d5(_0x1b04a9);});});}function respondWithStatusCode(_0x32aac5,_0x10bc2a){_0x10bc2a=_0x10bc2a||0xcc;return function(_0x339922){if(_0x339922){return _0x32aac5[_0x4e19('0x2e')](_0x10bc2a);}return _0x32aac5[_0x4e19('0x2f')](_0x10bc2a)[_0x4e19('0x30')]();};}function respondWithResult(_0x529e2d,_0x68da86){_0x68da86=_0x68da86||0xc8;return function(_0x503755){if(_0x503755){return _0x529e2d[_0x4e19('0x2f')](_0x68da86)['json'](_0x503755);}};}function respondWithFilteredResult(_0x243eb6,_0x3bcae5){return function(_0x5647f1){if(_0x5647f1){var _0x26d979=_0x5647f1[_0x4e19('0x31')],_0x59ce15=_0x3bcae5['offset'],_0x192157=_0x3bcae5[_0x4e19('0x32')]+_0x3bcae5[_0x4e19('0x33')],_0x3c2b1b;if(_0x192157>=_0x26d979){_0x192157=_0x26d979;_0x3c2b1b=0xc8;}else{_0x3c2b1b=0xce;}_0x243eb6['status'](_0x3c2b1b);return _0x243eb6[_0x4e19('0x34')]('Content-Range',_0x59ce15+'-'+_0x192157+'/'+_0x26d979)[_0x4e19('0x35')](_0x5647f1);}return null;};}function patchUpdates(_0x19bf81){return function(_0x16a996){try{jsonpatch[_0x4e19('0x36')](_0x16a996,_0x19bf81,!![]);}catch(_0x1ed3cf){return BPromise[_0x4e19('0x37')](_0x1ed3cf);}return _0x16a996['save']();};}function saveUpdates(_0x586929,_0xc41dc4){return function(_0x55ae48){if(_0x55ae48){return _0x55ae48[_0x4e19('0x38')](_0x586929)[_0x4e19('0x39')](function(_0x1cbf9a){return _0x1cbf9a;});}return null;};}function removeEntity(_0x545fea,_0x2c5514){return function(_0x46b448){if(_0x46b448){return _0x46b448[_0x4e19('0x3a')]()[_0x4e19('0x39')](function(){var _0x570e64=_0x46b448[_0x4e19('0x3b')]({'plain':!![]});var _0x2c227c='ChatWebsites';return db[_0x4e19('0x3c')][_0x4e19('0x3a')]({'where':{'type':_0x2c227c,'resourceId':_0x570e64['id']}})[_0x4e19('0x39')](function(){return _0x46b448;});})['then'](function(){_0x545fea['status'](0xcc)[_0x4e19('0x30')]();});}};}function handleEntityNotFound(_0xb74050,_0x50a552){return function(_0x5f13eb){if(!_0x5f13eb){_0xb74050[_0x4e19('0x2e')](0x194);}return _0x5f13eb;};}function handleError(_0x332d6c,_0x380b4e){_0x380b4e=_0x380b4e||0x1f4;return function(_0x2cd8aa){logger[_0x4e19('0x29')](_0x2cd8aa[_0x4e19('0x3d')]);if(_0x2cd8aa['name']){delete _0x2cd8aa['name'];}_0x332d6c[_0x4e19('0x2f')](_0x380b4e)[_0x4e19('0x3e')](_0x2cd8aa);};}exports['index']=function(_0x283d58,_0x30c1db){var _0x29472b={'include':[{'model':db[_0x4e19('0x3f')],'as':_0x4e19('0x40')}]},_0x3c3506={},_0x429a3f={'count':0x0,'rows':[]};var _0x2ab866=_[_0x4e19('0x41')](db[_0x4e19('0x42')][_0x4e19('0x43')],function(_0x2343ef){return{'name':_0x2343ef[_0x4e19('0x44')],'type':_0x2343ef[_0x4e19('0x45')][_0x4e19('0x46')]};});_0x3c3506[_0x4e19('0x47')]=_[_0x4e19('0x41')](_0x2ab866,'name');_0x3c3506['query']=_['keys'](_0x283d58[_0x4e19('0x48')]);_0x3c3506['filters']=_[_0x4e19('0x49')](_0x3c3506[_0x4e19('0x47')],_0x3c3506[_0x4e19('0x48')]);_0x29472b[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x3c3506['model'],qs[_0x4e19('0x4b')](_0x283d58['query'][_0x4e19('0x4b')]));_0x29472b[_0x4e19('0x4a')]=_0x29472b[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x29472b['attributes']:_0x3c3506[_0x4e19('0x47')];if(!_0x283d58[_0x4e19('0x48')]['hasOwnProperty'](_0x4e19('0x4d'))){_0x29472b['limit']=qs['limit'](_0x283d58[_0x4e19('0x48')][_0x4e19('0x33')]);_0x29472b[_0x4e19('0x32')]=qs['offset'](_0x283d58['query']['offset']);}_0x29472b['order']=qs[_0x4e19('0x4e')](_0x283d58['query'][_0x4e19('0x4e')]);_0x29472b['where']=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x283d58['query'],_0x3c3506[_0x4e19('0x4f')]),_0x2ab866);if(_0x283d58[_0x4e19('0x48')][_0x4e19('0x51')]){_0x29472b['where']=_[_0x4e19('0x52')](_0x29472b['where'],{'$or':_[_0x4e19('0x41')](_0x2ab866,function(_0x44a168){if(_0x44a168['type']!=='VIRTUAL'){var _0x523d71={};_0x523d71[_0x44a168[_0x4e19('0x53')]]={'$like':'%'+_0x283d58[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x523d71;}})});}_0x29472b=_[_0x4e19('0x52')]({},_0x29472b,_0x283d58[_0x4e19('0x54')]);var _0x228597={'where':_0x29472b[_0x4e19('0x55')]};return db[_0x4e19('0x42')]['count'](_0x228597)[_0x4e19('0x39')](function(_0x4d137a){_0x429a3f['count']=_0x4d137a;if(_0x283d58[_0x4e19('0x48')]['includeAll']){_0x29472b[_0x4e19('0x56')]=[{'all':!![]}];}return db[_0x4e19('0x42')][_0x4e19('0x57')](_0x29472b);})[_0x4e19('0x39')](function(_0x89a546){_0x429a3f['rows']=_0x89a546;return _0x429a3f;})['then'](respondWithFilteredResult(_0x30c1db,_0x29472b))[_0x4e19('0x2d')](handleError(_0x30c1db,null));};exports[_0x4e19('0x58')]=function(_0x276e0f,_0x1b8acd){var _0x17e72c={'raw':![],'where':{'id':_0x276e0f['params']['id']},'include':[{'model':db[_0x4e19('0x3f')],'as':_0x4e19('0x40')}]},_0x206925={};_0x206925['model']=_[_0x4e19('0x59')](db[_0x4e19('0x42')][_0x4e19('0x43')]);_0x206925[_0x4e19('0x48')]=_[_0x4e19('0x59')](_0x276e0f[_0x4e19('0x48')]);_0x206925[_0x4e19('0x4f')]=_['intersection'](_0x206925[_0x4e19('0x47')],_0x206925[_0x4e19('0x48')]);_0x17e72c[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x206925[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x276e0f[_0x4e19('0x48')][_0x4e19('0x4b')]));_0x17e72c[_0x4e19('0x4a')]=_0x17e72c[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x17e72c[_0x4e19('0x4a')]:_0x206925[_0x4e19('0x47')];if(_0x276e0f['query'][_0x4e19('0x5a')]){_0x17e72c['include']=[{'all':!![]}];}_0x17e72c=_[_0x4e19('0x52')]({},_0x17e72c,_0x276e0f[_0x4e19('0x54')]);return db[_0x4e19('0x42')]['find'](_0x17e72c)[_0x4e19('0x39')](handleEntityNotFound(_0x1b8acd,null))['then'](respondWithResult(_0x1b8acd,null))['catch'](handleError(_0x1b8acd,null));};exports[_0x4e19('0x5b')]=function(_0x346bd7,_0x2c3a72){return db[_0x4e19('0x42')][_0x4e19('0x5b')](_0x346bd7[_0x4e19('0x5c')],{})[_0x4e19('0x39')](function(_0x346f6d){var _0x562dc1=_0x346bd7[_0x4e19('0x5d')][_0x4e19('0x3b')]({'plain':!![]});if(!_0x562dc1)throw new Error(_0x4e19('0x5e'));if(_0x562dc1[_0x4e19('0x5f')]===_0x4e19('0x5d')){var _0x5dcc7a=_0x346f6d[_0x4e19('0x3b')]({'plain':!![]});var _0x466f55='ChatWebsites';return db['UserProfileSection'][_0x4e19('0x60')]({'where':{'name':_0x466f55,'userProfileId':_0x562dc1['userProfileId']},'raw':!![]})['then'](function(_0x171309){if(_0x171309&&_0x171309[_0x4e19('0x61')]===0x0){return db[_0x4e19('0x3c')][_0x4e19('0x5b')]({'name':_0x5dcc7a[_0x4e19('0x53')],'resourceId':_0x5dcc7a['id'],'type':_0x171309['name'],'sectionId':_0x171309['id']},{})[_0x4e19('0x39')](function(){return _0x346f6d;});}else{return _0x346f6d;}})[_0x4e19('0x2d')](function(_0x5cdc90){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cdc90);throw _0x5cdc90;});}return _0x346f6d;})[_0x4e19('0x39')](respondWithResult(_0x2c3a72,0xc9))[_0x4e19('0x2d')](handleError(_0x2c3a72,null));};exports['update']=function(_0x2648fc,_0x274198){if(_0x2648fc[_0x4e19('0x5c')]['id']){delete _0x2648fc[_0x4e19('0x5c')]['id'];}return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x2648fc['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4e19('0x39')](handleEntityNotFound(_0x274198,null))[_0x4e19('0x39')](saveUpdates(_0x2648fc['body'],null))[_0x4e19('0x39')](respondWithResult(_0x274198,null))[_0x4e19('0x2d')](handleError(_0x274198,null));};exports[_0x4e19('0x3a')]=function(_0x13a7fd,_0x507237){return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x13a7fd[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x507237,null))[_0x4e19('0x39')](removeEntity(_0x507237,null))[_0x4e19('0x2d')](handleError(_0x507237,null));};exports[_0x4e19('0x63')]=function(_0x55c002,_0xbb787d){return db['ChatWebsite'][_0x4e19('0x63')]()[_0x4e19('0x39')](respondWithResult(_0xbb787d,null))['catch'](handleError(_0xbb787d,null));};exports[_0x4e19('0x64')]=function(_0xd7f5cb,_0x12e443,_0x2b9ffc){if(_0xd7f5cb[_0x4e19('0x5c')]['id']){delete _0xd7f5cb[_0x4e19('0x5c')]['id'];}return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0xd7f5cb[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x12e443,null))[_0x4e19('0x39')](function(_0x5e63af){if(_0x5e63af){_0xd7f5cb[_0x4e19('0x5c')][_0x4e19('0x65')]=_0x5e63af['id'];return db[_0x4e19('0x66')][_0x4e19('0x5b')](_0xd7f5cb[_0x4e19('0x5c')]);}})[_0x4e19('0x39')](respondWithResult(_0x12e443,null))[_0x4e19('0x2d')](handleError(_0x12e443,null));};exports[_0x4e19('0x67')]=function(_0x4eafcb,_0x4fd1aa,_0x125ade){var _0x8d4715={'raw':![],'where':{}};var _0x1fa18e={};var _0x5d0126={'count':0x0,'rows':[]};return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x4eafcb[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x4fd1aa,null))[_0x4e19('0x39')](function(_0x8df13a){if(_0x8df13a){_0x1fa18e[_0x4e19('0x47')]=_[_0x4e19('0x59')](db['Disposition'][_0x4e19('0x43')]);_0x1fa18e['query']=_['keys'](_0x4eafcb[_0x4e19('0x48')]);_0x1fa18e[_0x4e19('0x4f')]=_[_0x4e19('0x49')](_0x1fa18e[_0x4e19('0x47')],_0x1fa18e[_0x4e19('0x48')]);_0x8d4715[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x1fa18e[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x4eafcb[_0x4e19('0x48')][_0x4e19('0x4b')]));_0x8d4715[_0x4e19('0x4a')]=_0x8d4715['attributes'][_0x4e19('0x4c')]?_0x8d4715[_0x4e19('0x4a')]:_0x1fa18e[_0x4e19('0x47')];if(!_0x4eafcb['query'][_0x4e19('0x69')]('nolimit')){_0x8d4715[_0x4e19('0x33')]=qs[_0x4e19('0x33')](_0x4eafcb['query'][_0x4e19('0x33')]);_0x8d4715[_0x4e19('0x32')]=qs[_0x4e19('0x32')](_0x4eafcb[_0x4e19('0x48')][_0x4e19('0x32')]);}_0x8d4715[_0x4e19('0x6a')]=qs[_0x4e19('0x4e')](_0x4eafcb[_0x4e19('0x48')]['sort']);_0x8d4715[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x4eafcb['query'],_0x1fa18e['filters']));_0x8d4715[_0x4e19('0x55')][_0x4e19('0x65')]=_0x8df13a['id'];if(_0x4eafcb[_0x4e19('0x48')]['filter']){_0x8d4715['where']=_[_0x4e19('0x52')](_0x8d4715[_0x4e19('0x55')],{'$or':_['map'](_0x8d4715[_0x4e19('0x4a')],function(_0x3524e5){var _0x2a8744={};_0x2a8744[_0x3524e5]={'$like':'%'+_0x4eafcb[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x2a8744;})});}_0x8d4715=_[_0x4e19('0x52')]({},_0x8d4715,_0x4eafcb['options']);return db[_0x4e19('0x66')][_0x4e19('0x31')]({'where':_0x8d4715[_0x4e19('0x55')]})[_0x4e19('0x39')](function(_0x5a2df3){_0x5d0126[_0x4e19('0x31')]=_0x5a2df3;if(_0x4eafcb['query'][_0x4e19('0x5a')]){_0x8d4715[_0x4e19('0x56')]=[{'all':!![]}];}return db[_0x4e19('0x66')][_0x4e19('0x57')](_0x8d4715);})[_0x4e19('0x39')](function(_0x210985){_0x5d0126[_0x4e19('0x6b')]=_0x210985;return _0x5d0126;});}})[_0x4e19('0x39')](respondWithFilteredResult(_0x4fd1aa,_0x8d4715))[_0x4e19('0x2d')](handleError(_0x4fd1aa,null));};exports['removeDispositions']=function(_0x120881,_0x1f7e94,_0x566aa3){return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x120881[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x1f7e94,null))[_0x4e19('0x39')](function(_0x2ebfa9){if(_0x2ebfa9){return _0x2ebfa9[_0x4e19('0x6c')](_0x120881[_0x4e19('0x48')][_0x4e19('0x6d')]);}})['then'](respondWithStatusCode(_0x1f7e94,null))[_0x4e19('0x2d')](handleError(_0x1f7e94,null));};exports[_0x4e19('0x6e')]=function(_0x3d2e9e,_0x312e70,_0x1f0339){if(_0x3d2e9e[_0x4e19('0x5c')]['id']){delete _0x3d2e9e[_0x4e19('0x5c')]['id'];}return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x3d2e9e[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x312e70,null))[_0x4e19('0x39')](function(_0x487b8e){if(_0x487b8e){_0x3d2e9e[_0x4e19('0x5c')]['ChatWebsiteId']=_0x487b8e['id'];return db[_0x4e19('0x6f')][_0x4e19('0x5b')](_0x3d2e9e['body']);}})[_0x4e19('0x39')](respondWithResult(_0x312e70,null))[_0x4e19('0x2d')](handleError(_0x312e70,null));};exports[_0x4e19('0x70')]=function(_0x27733e,_0x1a94c7,_0x4df53f){var _0x8a79ce={'raw':![],'where':{}};var _0x4f3a6d={};var _0xbeb3c9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4e19('0x68')]({'where':{'id':_0x27733e[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x1a94c7,null))[_0x4e19('0x39')](function(_0x12c726){if(_0x12c726){_0x4f3a6d[_0x4e19('0x47')]=_[_0x4e19('0x59')](db[_0x4e19('0x6f')][_0x4e19('0x43')]);_0x4f3a6d[_0x4e19('0x48')]=_[_0x4e19('0x59')](_0x27733e[_0x4e19('0x48')]);_0x4f3a6d['filters']=_['intersection'](_0x4f3a6d[_0x4e19('0x47')],_0x4f3a6d[_0x4e19('0x48')]);_0x8a79ce[_0x4e19('0x4a')]=_['intersection'](_0x4f3a6d[_0x4e19('0x47')],qs['fields'](_0x27733e[_0x4e19('0x48')]['fields']));_0x8a79ce[_0x4e19('0x4a')]=_0x8a79ce[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x8a79ce['attributes']:_0x4f3a6d[_0x4e19('0x47')];if(!_0x27733e[_0x4e19('0x48')][_0x4e19('0x69')](_0x4e19('0x4d'))){_0x8a79ce[_0x4e19('0x33')]=qs['limit'](_0x27733e[_0x4e19('0x48')][_0x4e19('0x33')]);_0x8a79ce[_0x4e19('0x32')]=qs['offset'](_0x27733e[_0x4e19('0x48')]['offset']);}_0x8a79ce[_0x4e19('0x6a')]=qs['sort'](_0x27733e[_0x4e19('0x48')]['sort']);_0x8a79ce[_0x4e19('0x55')]=qs['filters'](_[_0x4e19('0x50')](_0x27733e[_0x4e19('0x48')],_0x4f3a6d[_0x4e19('0x4f')]));_0x8a79ce[_0x4e19('0x55')][_0x4e19('0x65')]=_0x12c726['id'];if(_0x27733e[_0x4e19('0x48')][_0x4e19('0x51')]){_0x8a79ce[_0x4e19('0x55')]=_['merge'](_0x8a79ce[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x8a79ce[_0x4e19('0x4a')],function(_0x1c0df2){var _0x354c4e={};_0x354c4e[_0x1c0df2]={'$like':'%'+_0x27733e[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x354c4e;})});}_0x8a79ce=_[_0x4e19('0x52')]({},_0x8a79ce,_0x27733e['options']);return db[_0x4e19('0x6f')][_0x4e19('0x31')]({'where':_0x8a79ce[_0x4e19('0x55')]})['then'](function(_0x512f83){_0xbeb3c9[_0x4e19('0x31')]=_0x512f83;if(_0x27733e[_0x4e19('0x48')][_0x4e19('0x5a')]){_0x8a79ce[_0x4e19('0x56')]=[{'all':!![]}];}return db[_0x4e19('0x6f')][_0x4e19('0x57')](_0x8a79ce);})[_0x4e19('0x39')](function(_0x4ee406){_0xbeb3c9[_0x4e19('0x6b')]=_0x4ee406;return _0xbeb3c9;});}})[_0x4e19('0x39')](respondWithFilteredResult(_0x1a94c7,_0x8a79ce))[_0x4e19('0x2d')](handleError(_0x1a94c7,null));};exports[_0x4e19('0x71')]=function(_0x92f31f,_0x154b79,_0x27f461){return db[_0x4e19('0x42')]['find']({'where':{'id':_0x92f31f[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x154b79,null))[_0x4e19('0x39')](function(_0x34d490){if(_0x34d490){return _0x34d490[_0x4e19('0x71')](_0x92f31f[_0x4e19('0x48')][_0x4e19('0x6d')]);}})[_0x4e19('0x39')](respondWithStatusCode(_0x154b79,null))[_0x4e19('0x2d')](handleError(_0x154b79,null));};exports[_0x4e19('0x72')]=function(_0x1ac8df,_0x4f6aba,_0x5e84a2){_0x1ac8df['body'][_0x4e19('0x73')]=_0x1ac8df[_0x4e19('0x74')][_0x4e19('0x75')];return db['ChatWebsite'][_0x4e19('0x60')]({'where':{'id':_0x1ac8df[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x4f6aba,null))[_0x4e19('0x39')](saveUpdates(_0x1ac8df[_0x4e19('0x5c')],null))[_0x4e19('0x39')](respondWithResult(_0x4f6aba,null))['catch'](handleError(_0x4f6aba,null));};exports[_0x4e19('0x76')]=function(_0x1edd7a,_0x4f6f52,_0x32be7d){_0x1edd7a[_0x4e19('0x5c')]['agentAvatar']=_0x1edd7a[_0x4e19('0x74')][_0x4e19('0x75')];return db[_0x4e19('0x42')]['find']({'where':{'id':_0x1edd7a[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x4f6f52,null))['then'](saveUpdates(_0x1edd7a[_0x4e19('0x5c')],null))[_0x4e19('0x39')](respondWithResult(_0x4f6f52,null))[_0x4e19('0x2d')](handleError(_0x4f6f52,null));};exports['addCustomerAvatar']=function(_0x3e5a92,_0xe55c16,_0x2e7882){_0x3e5a92[_0x4e19('0x5c')][_0x4e19('0x77')]=_0x3e5a92[_0x4e19('0x74')][_0x4e19('0x75')];return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x3e5a92['params']['id']}})['then'](handleEntityNotFound(_0xe55c16,null))[_0x4e19('0x39')](saveUpdates(_0x3e5a92['body'],null))['then'](respondWithResult(_0xe55c16,null))[_0x4e19('0x2d')](handleError(_0xe55c16,null));};exports['addSystemAvatar']=function(_0x8ba37,_0x125118,_0x607cd1){_0x8ba37[_0x4e19('0x5c')][_0x4e19('0x78')]=_0x8ba37[_0x4e19('0x74')][_0x4e19('0x75')];return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x8ba37['params']['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x125118,null))[_0x4e19('0x39')](saveUpdates(_0x8ba37[_0x4e19('0x5c')],null))['then'](respondWithResult(_0x125118,null))[_0x4e19('0x2d')](handleError(_0x125118,null));};exports['getLogo']=function(_0x49da29,_0x345963,_0x2d39ae){var _0x136c9b=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x7b'));var _0x489649={'where':{'id':_0x49da29[_0x4e19('0x62')]['id']},'attributes':['id',_0x4e19('0x73')],'raw':!![]};var _0x43bab8=![];return require(_0x4e19('0x7c'))[_0x4e19('0x7d')]()[_0x4e19('0x39')](function(_0x2a9f7e){if(_0x2a9f7e){_0x43bab8=_0x2a9f7e[_0x4e19('0x7e')];}})[_0x4e19('0x39')](function(){return db[_0x4e19('0x42')][_0x4e19('0x60')](_0x489649);})[_0x4e19('0x39')](handleEntityNotFound(_0x345963,null))[_0x4e19('0x39')](function(_0x49d63a){if(_0x49d63a){if(!_['isNil'](_0x49d63a[_0x4e19('0x73')])){if(fs['existsSync'](path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x7f'),_0x49d63a[_0x4e19('0x73')]))&&_0x43bab8){_0x136c9b=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x7f'),_0x49d63a[_0x4e19('0x73')]);}}return _0x345963[_0x4e19('0x80')](_0x136c9b);}})[_0x4e19('0x2d')](handleError(_0x345963,null));};exports['getAvatar']=function(_0x39d7a7,_0x51aadd,_0x5004b0){var _0x7f8c9c=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x81'));var _0x39cd44={'where':{'id':_0x39d7a7['params']['id']},'attributes':['id',_0x4e19('0x82')],'raw':!![]};return db[_0x4e19('0x42')]['find'](_0x39cd44)['then'](handleEntityNotFound(_0x51aadd,null))[_0x4e19('0x39')](function(_0x3bb582){if(_0x3bb582){if(!_['isNil'](_0x3bb582[_0x4e19('0x82')])){if(fs[_0x4e19('0x83')](path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x84'),_0x3bb582[_0x4e19('0x82')]))){_0x7f8c9c=path[_0x4e19('0x79')](config['root'],_0x4e19('0x84'),_0x3bb582[_0x4e19('0x82')]);}}return _0x51aadd[_0x4e19('0x80')](_0x7f8c9c);}})[_0x4e19('0x2d')](handleError(_0x51aadd,null));};exports[_0x4e19('0x85')]=function(_0x50065d,_0x1927ef,_0x481850){var _0x173cf2=path['join'](config['root'],_0x4e19('0x86'));var _0x521661={'where':{'id':_0x50065d['params']['id']},'attributes':['id',_0x4e19('0x77'),_0x4e19('0x87')],'raw':!![]};return db[_0x4e19('0x42')][_0x4e19('0x60')](_0x521661)[_0x4e19('0x39')](handleEntityNotFound(_0x1927ef,null))['then'](function(_0x32babc){if(_0x32babc){if(!_[_0x4e19('0x88')](_0x32babc[_0x4e19('0x77')])){if(fs['existsSync'](path['join'](config[_0x4e19('0x7a')],_0x4e19('0x84'),_0x32babc[_0x4e19('0x77')]))&&_0x32babc['showCustomerAvatar']){_0x173cf2=path['join'](config['root'],_0x4e19('0x84'),_0x32babc['customerAvatar']);}}return _0x1927ef[_0x4e19('0x80')](_0x173cf2);}})['catch'](handleError(_0x1927ef,null));};exports[_0x4e19('0x89')]=function(_0x188a3a,_0x33040a,_0x21729a){var _0xb80053=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x8a'));var _0x424d7b={'where':{'id':_0x188a3a[_0x4e19('0x62')]['id']},'attributes':['id',_0x4e19('0x78')],'raw':!![]};return db['ChatWebsite']['find'](_0x424d7b)['then'](handleEntityNotFound(_0x33040a,null))[_0x4e19('0x39')](function(_0x184449){if(_0x184449){if(!_['isNil'](_0x184449['systemAvatar'])){if(fs[_0x4e19('0x83')](path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x84'),_0x184449[_0x4e19('0x78')]))){_0xb80053=path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0x84'),_0x184449[_0x4e19('0x78')]);}}return _0x33040a[_0x4e19('0x80')](_0xb80053);}})['catch'](handleError(_0x33040a,null));};exports['notify']=function(_0x3350e5,_0x6605a1,_0x17bce2){var _0x4942de=require(_0x4e19('0x8b'));var _0x1569f7=new _0x4942de();var _0x4ec1f4=_0x1569f7[_0x4e19('0x8c')](_0x3350e5[_0x4e19('0x8d')][_0x4e19('0x8e')])[_0x4e19('0x8f')]();var _0x4c6d10={'body':_0x3350e5[_0x4e19('0x5c')],'channel':_0x4e19('0x90')};var _0x2930a7=[];var _0x29713c=[];var _0x4fc4d8={};var _0x55955b=![];return db[_0x4e19('0x91')][_0x4e19('0x63')]()[_0x4e19('0x39')](function(_0x95d15c){if(!_0x95d15c){throw new db['Sequelize'][(_0x4e19('0x21'))](_0x4e19('0x92'));}_0x2930a7=_[_0x4e19('0x93')](_['keys'](_0x95d15c),['createdAt',_0x4e19('0x94')]);_0x29713c=_[_0x4e19('0x93')](_['keys'](_0x95d15c),[_0x4e19('0x95'),'updatedAt','CompanyId',_0x4e19('0x96')]);if(_0x3350e5[_0x4e19('0x5c')]['id']){delete _0x3350e5[_0x4e19('0x5c')]['id'];}if(_[_0x4e19('0x88')](_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x97')])){throw new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0x98'));}if(_['isNil'](_0x3350e5['body']['body'])||_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x5c')]===''){throw new db[(_0x4e19('0x20'))]['ValidationError'](_0x4e19('0x99'));}if(_['isNil'](_0x3350e5[_0x4e19('0x5c')]['mapKey'])){throw new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0x9a')+_0x29713c);}if(!_[_0x4e19('0x9b')](_0x29713c,_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x9c')])){throw new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0x9d')+_0x29713c);}_0x4fc4d8[_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x9c')]]=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x97')];})[_0x4e19('0x39')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x3350e5[_0x4e19('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x4e19('0x9e'),'include':[{'model':db[_0x4e19('0x91')],'as':'Contacts','where':_0x4fc4d8,'limit':0x1,'order':[[_0x4e19('0x94'),'DESC']]}]},{'model':db[_0x4e19('0x9f')],'as':_0x4e19('0xa0')}]});})[_0x4e19('0x39')](handleEntityNotFound(_0x6605a1,null))['then'](function(_0x433f11){if(_0x433f11&&_0x433f11[_0x4e19('0x9e')]){_0x4c6d10[_0x4e19('0xa1')]=_0x433f11;_0x4c6d10[_0x4e19('0xa2')]=_0x433f11['Applications'];_0x4c6d10[_0x4e19('0xa3')]=_0x433f11[_0x4e19('0x9e')];_0x4c6d10[_0x4e19('0xa2')]=_[_0x4e19('0xa4')](_0x4c6d10['applications'],[_0x4e19('0xa5')],[_0x4e19('0xa6')]);if(_0x4c6d10['account'][_0x4e19('0xa0')]){delete _0x4c6d10[_0x4e19('0xa1')][_0x4e19('0xa0')];}if(_0x4c6d10[_0x4e19('0xa1')]['List']&&_0x4c6d10[_0x4e19('0xa1')]['List'][_0x4e19('0xa7')][_0x4e19('0x4c')]){return _0x4c6d10['account'][_0x4e19('0x9e')]['Contacts'][0x0];}var _0x307317=_[_0x4e19('0x18')](_0x3350e5['body'],{'firstName':_0x3350e5['body'][_0x4e19('0x97')],'ListId':_0x433f11[_0x4e19('0x96')]});_0x307317[_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x9c')]]=_0x3350e5['body'][_0x4e19('0x97')];return db['CmContact'][_0x4e19('0x5b')](_0x307317,{'fields':_0x2930a7,'raw':!![]});}})[_0x4e19('0x39')](handleEntityNotFound(_0x6605a1,null))['then'](function(_0x35b1e4){_0x4c6d10[_0x4e19('0xa8')]=_0x35b1e4;var _0x37c19b=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xa9')];if(_0x3350e5[_0x4e19('0x8d')]['cf-connecting-ip']){_0x37c19b=_0x3350e5[_0x4e19('0x8d')]['cf-connecting-ip'];}else if(_0x3350e5[_0x4e19('0x8d')][_0x4e19('0xaa')]){_0x37c19b=_[_0x4e19('0xab')](_0x3350e5[_0x4e19('0x8d')][_0x4e19('0xaa')][_0x4e19('0xac')](','));}if(_0x35b1e4){var _0x3d77c8={'ContactId':_0x35b1e4['id'],'ChatWebsiteId':_0x3350e5[_0x4e19('0x62')]['id'],'from':(_0x35b1e4[_0x4e19('0xad')]||'')+'\x20'+(_0x35b1e4[_0x4e19('0xae')]||''),'customerIp':_0x37c19b,'customerPort':_0x3350e5[_0x4e19('0x8d')][_0x4e19('0xaf')]?_0x3350e5[_0x4e19('0x8d')][_0x4e19('0xaf')]:null,'referer':_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xb0')],'browserName':_0x4ec1f4[_0x4e19('0xb1')]['name']&&_0x4ec1f4[_0x4e19('0xb1')][_0x4e19('0xb2')]?util['format'](_0x4e19('0xb3'),_0x4ec1f4[_0x4e19('0xb1')][_0x4e19('0x53')],_0x4ec1f4[_0x4e19('0xb1')][_0x4e19('0xb2')]):_0x4e19('0xb4'),'browserVersion':_0x4ec1f4[_0x4e19('0xb1')]['version']||_0x4e19('0xb4'),'osName':util['format'](_0x4e19('0xb3'),_0x4ec1f4['os']['name'],_0x4ec1f4['os']['version']),'osVersion':_0x4ec1f4['os'][_0x4e19('0xb2')],'deviceModel':_0x4ec1f4[_0x4e19('0xb5')][_0x4e19('0x47')]&&_0x4ec1f4['device'][_0x4e19('0xb6')]?util[_0x4e19('0xb7')](_0x4e19('0xb8'),_0x4ec1f4['device'][_0x4e19('0x47')],_0x4ec1f4[_0x4e19('0xb5')][_0x4e19('0xb6')],_0x4ec1f4['device'][_0x4e19('0x45')]):null,'deviceVendor':_0x4ec1f4['device'][_0x4e19('0xb6')],'deviceType':_0x4ec1f4['device'][_0x4e19('0x45')],'formData':JSON[_0x4e19('0xb9')](_0x3350e5[_0x4e19('0x5c')])};var _0x23e1c3={'ChatWebsiteId':_0x3350e5[_0x4e19('0x62')]['id'],'closed':![]};if(_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xba')]){_0x23e1c3['threadId']=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xba')];return db[_0x4e19('0xbb')][_0x4e19('0x60')]({'where':_0x23e1c3})[_0x4e19('0x39')](function(_0x3c53cc){if(_0x3c53cc){return[_0x3c53cc,![]];}_0x3d77c8['threadId']=_0x3350e5['body'][_0x4e19('0xba')];_0x3d77c8['externalUrl']=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xbc')];return db[_0x4e19('0xbb')][_0x4e19('0x5b')](_0x3d77c8)[_0x4e19('0x39')](function(_0x431057){return[_0x431057,!![]];});});}_0x23e1c3[_0x4e19('0xbd')]=_0x35b1e4['id'];if(_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xbe')]&&_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xbe')]['id']){_0x23e1c3['id']=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xbe')]['id'];return db[_0x4e19('0xbb')]['find']({'where':_0x23e1c3})[_0x4e19('0x39')](function(_0x4fec51){if(_0x4fec51){return[_0x4fec51,![]];}return db[_0x4e19('0xbb')][_0x4e19('0x5b')](_0x3d77c8)[_0x4e19('0x39')](function(_0x524d00){return[_0x524d00,!![]];});});}return db[_0x4e19('0xbb')][_0x4e19('0x5b')](_0x3d77c8)[_0x4e19('0x39')](function(_0x1019d1){return[_0x1019d1,!![]];});}})[_0x4e19('0xbf')](function(_0x1915a6,_0x4dcf7c){if(_0x1915a6){_0x55955b=_0x4dcf7c;if(!_0x4dcf7c){var _0x4d029e={'from':(_0x4c6d10[_0x4e19('0xa8')]['firstName']||'')+'\x20'+(_0x4c6d10[_0x4e19('0xa8')]['lastName']||'')};if(_0x3350e5[_0x4e19('0x5c')]['threadId']&&_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xc0')]&&_0x3350e5['body'][_0x4e19('0xba')]!=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xc0')]){_0x4d029e[_0x4e19('0xba')]=_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xc0')];}return _0x1915a6[_0x4e19('0x38')](_0x4d029e);}else{return _0x1915a6;}}})[_0x4e19('0x39')](function(_0x5f00aa){_0x4c6d10[_0x4e19('0xbe')]=_0x5f00aa[_0x4e19('0x3b')]({'plain':!![]});_0x4c6d10[_0x4e19('0xbe')][_0x4e19('0xc1')]=_0x55955b;if(_0x4c6d10['interaction'][_0x4e19('0xc1')]){if(_0x4c6d10[_0x4e19('0xa1')][_0x4e19('0xc2')]){_0x4c6d10[_0x4e19('0xa2')][_0x4e19('0xc3')]({'id':0x0,'priority':_0x4c6d10[_0x4e19('0xa2')][_0x4e19('0x4c')]+0x1,'app':_0x4e19('0xc4'),'appdata':'unmanaged','interval':_0x4e19('0xc5')});}}return db[_0x4e19('0xc6')][_0x4e19('0x5b')]({'body':_0x3350e5[_0x4e19('0x5c')][_0x4e19('0x5c')],'ChatWebsiteId':_0x3350e5[_0x4e19('0x62')]['id'],'ChatInteractionId':_0x5f00aa['id'],'direction':'in','ContactId':_0x4c6d10[_0x4e19('0xa8')]['id'],'AttachmentId':_0x3350e5[_0x4e19('0x5c')][_0x4e19('0xc7')]});})['then'](function(_0x8d01a4){_0x4c6d10['message']=_0x8d01a4;if(_0x4c6d10[_0x4e19('0xbe')][_0x4e19('0xc8')]){return db['User'][_0x4e19('0x60')]({'attributes':['id','name'],'where':{'id':_0x4c6d10['interaction']['UserId']}})[_0x4e19('0x39')](function(_0x46a977){if(_0x46a977){_0x4c6d10[_0x4e19('0xa2')][_0x4e19('0xc9')]({'id':0x0,'priority':0x0,'app':_0x4e19('0xca'),'appdata':_0x46a977['name']+','+(_0x4c6d10['account'][_0x4e19('0xcb')]||0xa),'interval':'*,*,*,*'});_0x4c6d10[_0x4e19('0xcc')]=!![];}return respondWithRpcPromise(_0x4e19('0xcd'),'startRouting',_0x4c6d10);});}return respondWithRpcPromise('Start',_0x4e19('0xce'),_0x4c6d10);})['then'](function(_0x4808cb){respondWithRpcPromise(_0x4e19('0xcf'),_0x4e19('0xcf'),{'event':_0x4e19('0xd0'),'message':_0x4808cb},client9002);return _0x4808cb;})['then'](respondWithResult(_0x6605a1,null))[_0x4e19('0x2d')](handleError(_0x6605a1,null));};exports[_0x4e19('0xd1')]=function(_0x5ebe34,_0x584f3a,_0x5e3dbe){var _0x5eb8b5,_0x59c678,_0x3a3a1b;var _0x3000ae=[];var _0x3d383c=[];var _0x2521b7={};return db[_0x4e19('0x91')]['describe']()[_0x4e19('0x39')](function(_0x34f170){if(!_0x34f170){throw new db['Sequelize'][(_0x4e19('0x21'))]('no\x20available\x20attributes');}_0x3d383c=_[_0x4e19('0x93')](_['keys'](_0x34f170),[_0x4e19('0x95'),_0x4e19('0x94')]);_0x3000ae=_[_0x4e19('0x93')](_[_0x4e19('0x59')](_0x34f170),['createdAt','updatedAt','CompanyId',_0x4e19('0x96')]);if(_0x5ebe34[_0x4e19('0x5c')]['id']){delete _0x5ebe34[_0x4e19('0x5c')]['id'];}if(_[_0x4e19('0x88')](_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0x97')])){throw _0x584f3a[_0x4e19('0x2f')](0x1f4)[_0x4e19('0x3e')](new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))]('from\x20is\x20mandatory'));}if(_[_0x4e19('0x88')](_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0x5c')])||_0x5ebe34['body']['body']===''){throw _0x584f3a[_0x4e19('0x2f')](0x1f4)[_0x4e19('0x3e')](new db['Sequelize'][(_0x4e19('0x21'))](_0x4e19('0x99')));}if(_[_0x4e19('0x88')](_0x5ebe34[_0x4e19('0x5c')]['mapKeyOffline'])){throw _0x584f3a[_0x4e19('0x2f')](0x1f4)['send'](new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))](_0x4e19('0xd2')+_0x3000ae));}if(!_['includes'](_0x3000ae,_0x5ebe34[_0x4e19('0x5c')]['mapKeyOffline'])){throw _0x584f3a['status'](0x1f4)[_0x4e19('0x3e')](new db[(_0x4e19('0x20'))][(_0x4e19('0x21'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3000ae));}_0x2521b7[_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0xd3')]]=_0x5ebe34['body'][_0x4e19('0x97')];})[_0x4e19('0x39')](function(){return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x5ebe34[_0x4e19('0x62')]['id']},'include':[{'model':db[_0x4e19('0xd4')],'as':_0x4e19('0x9e')}]});})['then'](handleEntityNotFound(_0x584f3a,null))[_0x4e19('0x39')](function(_0x5eb54e){if(_0x5eb54e&&_0x5eb54e[_0x4e19('0x9e')]){_0x59c678=_0x5eb54e;var _0x31c4f5=_['defaults'](_0x5ebe34[_0x4e19('0x5c')],{'firstName':_0x5ebe34['body']['from'],'phone':_0x5ebe34['body'][_0x4e19('0x97')],'ListId':_0x5eb54e[_0x4e19('0x96')]});_0x31c4f5[_0x5ebe34[_0x4e19('0x5c')]['mapKeyOffline']]=_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0x97')];return db[_0x4e19('0x91')][_0x4e19('0xd5')]({'where':_0x2521b7,'defaults':_0x31c4f5});}})[_0x4e19('0xbf')](function(_0x22c17a){if(_0x22c17a){_0x3a3a1b=_0x22c17a;var _0x4fd540=fs[_0x4e19('0xd6')](path[_0x4e19('0x79')](config[_0x4e19('0x7a')],_0x4e19('0xd7')),'utf8');var _0x5ae95a=ejs['render'](_0x4fd540,{'body':_['toPairs'](_0x5ebe34[_0x4e19('0x5c')][_0x4e19('0x5c')]),'bodyTitle':_0x59c678['offlineMessageBody']});return db['ChatOfflineMessage'][_0x4e19('0x5b')]({'body':_0x5ae95a,'ContactId':_0x22c17a['id'],'ChatWebsiteId':_0x59c678['id']});}})['then'](function(_0x57f2c7){if(_0x57f2c7){_0x5eb8b5=_0x57f2c7;return db[_0x4e19('0xd8')][_0x4e19('0x68')]({'where':{'service':!![]},'include':[{'model':db[_0x4e19('0xd9')],'as':_0x4e19('0xda'),'raw':!![]}]});}})[_0x4e19('0x39')](function(_0x28a75f){if(_0x28a75f&&_0x28a75f[_0x4e19('0xda')]&&_0x59c678[_0x4e19('0xdb')]){var _0x3a304d={'tls':{'rejectUnauthorized':![]}};if(_0x28a75f[_0x4e19('0xda')][_0x4e19('0xdc')]){_0x3a304d[_0x4e19('0xdc')]=_0x28a75f['Smtp'][_0x4e19('0xdc')];}else{_0x3a304d['host']=_0x28a75f[_0x4e19('0xda')]['host'];_0x3a304d[_0x4e19('0xdd')]=_0x28a75f[_0x4e19('0xda')]['port'];_0x3a304d[_0x4e19('0xde')]=_0x28a75f[_0x4e19('0xda')][_0x4e19('0xde')];}if(_0x28a75f['Smtp']['authentication']){_0x3a304d['auth']={'user':_0x28a75f['Smtp'][_0x4e19('0x5d')],'pass':_0x28a75f[_0x4e19('0xda')]['pass']};}return respondWithRpcPromise(_0x4e19('0xdf'),_0x4e19('0xe0'),{'account':_0x3a304d,'message':{'from':util[_0x4e19('0xb7')](_0x4e19('0xe1'),_0x28a75f[_0x4e19('0x53')],_0x28a75f[_0x4e19('0xe2')]||_0x28a75f['Smtp'][_0x4e19('0x5d')]),'to':_0x59c678['forwardOfflineAddress'],'subject':_0x59c678[_0x4e19('0xe3')],'text':_0x5eb8b5[_0x4e19('0x5c')]}},client9003)[_0x4e19('0x39')](function(){return _0x5eb8b5;})[_0x4e19('0x2d')](function(_0x51a554){console['error'](_0x51a554);});}})[_0x4e19('0x39')](function(){if(_0x5eb8b5){return _0x5eb8b5;}})['then'](respondWithResult(_0x584f3a,null))['catch'](handleError(_0x584f3a,null));};exports[_0x4e19('0xe4')]=function(_0x230344,_0x87e88a,_0x2f3bd2){return db[_0x4e19('0xbb')][_0x4e19('0x60')]({'where':{'id':_0x230344[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x87e88a,null))['then'](function(_0x32fa71){if(_0x32fa71){return _0x32fa71[_0x4e19('0xe4')](_0x230344[_0x4e19('0x5c')][_0x4e19('0x6d')],_[_0x4e19('0xe5')](_0x230344['body'],[_0x4e19('0x6d'),'id'])||{});}})[_0x4e19('0x39')](respondWithResult(_0x87e88a,null))[_0x4e19('0x2d')](handleError(_0x87e88a,null));};exports['getInteractions']=function(_0x2e640c,_0x3be4e5,_0x44aa3f){var _0x2150f7={'raw':![],'where':{}};var _0x418687={};var _0x4a4d7b={'count':0x0,'rows':[]};return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x2e640c[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x3be4e5,null))['then'](function(_0x21d35f){if(_0x21d35f){_0x418687[_0x4e19('0x47')]=_['keys'](db[_0x4e19('0xbb')][_0x4e19('0x43')]);_0x418687[_0x4e19('0x48')]=_[_0x4e19('0x59')](_0x2e640c[_0x4e19('0x48')]);_0x418687[_0x4e19('0x4f')]=_[_0x4e19('0x49')](_0x418687[_0x4e19('0x47')],_0x418687[_0x4e19('0x48')]);_0x2150f7[_0x4e19('0x4a')]=_['intersection'](_0x418687[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x2e640c[_0x4e19('0x48')][_0x4e19('0x4b')]));_0x2150f7[_0x4e19('0x4a')]=_0x2150f7[_0x4e19('0x4a')]['length']?_0x2150f7[_0x4e19('0x4a')]:_0x418687[_0x4e19('0x47')];if(!_0x2e640c['query']['hasOwnProperty']('nolimit')){_0x2150f7['limit']=qs['limit'](_0x2e640c[_0x4e19('0x48')][_0x4e19('0x33')]);_0x2150f7[_0x4e19('0x32')]=qs['offset'](_0x2e640c[_0x4e19('0x48')]['offset']);}_0x2150f7[_0x4e19('0x6a')]=qs[_0x4e19('0x4e')](_0x2e640c[_0x4e19('0x48')][_0x4e19('0x4e')]);_0x2150f7[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x2e640c[_0x4e19('0x48')],_0x418687[_0x4e19('0x4f')]));_0x2150f7[_0x4e19('0x55')][_0x4e19('0x65')]=_0x21d35f['id'];if(_0x2e640c[_0x4e19('0x48')]['filter']){_0x2150f7[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x2150f7[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x2150f7[_0x4e19('0x4a')],function(_0x467f4d){var _0x5d62f2={};_0x5d62f2[_0x467f4d]={'$like':'%'+_0x2e640c[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x5d62f2;})});}_0x2150f7=_[_0x4e19('0x52')]({},_0x2150f7,_0x2e640c[_0x4e19('0x54')]);return db['ChatInteraction'][_0x4e19('0x31')]({'where':_0x2150f7[_0x4e19('0x55')]})['then'](function(_0x55e6c7){_0x4a4d7b[_0x4e19('0x31')]=_0x55e6c7;if(_0x2e640c['query'][_0x4e19('0x5a')]){_0x2150f7[_0x4e19('0x56')]=[{'model':db[_0x4e19('0x91')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x4e19('0xe6'),'attributes':[_0x4e19('0x53'),_0x4e19('0xe7'),_0x4e19('0xe8')],'required':![]},{'model':db[_0x4e19('0xe9')],'as':'Tags','attributes':['id',_0x4e19('0x53'),_0x4e19('0xea')],'where':_0x2e640c[_0x4e19('0x48')]['tag']?{'id':_0x2e640c[_0x4e19('0x48')]['tag']}:undefined,'required':_0x2e640c['query'][_0x4e19('0xeb')]?!![]:![]}];}return db[_0x4e19('0xbb')][_0x4e19('0x57')](_0x2150f7);})[_0x4e19('0x39')](function(_0x50aef0){_0x4a4d7b[_0x4e19('0x6b')]=_0x50aef0;return _0x4a4d7b;});}})[_0x4e19('0x39')](respondWithFilteredResult(_0x3be4e5,_0x2150f7))[_0x4e19('0x2d')](handleError(_0x3be4e5,null));};function iftimePromise(_0x3c3087,_0x5078de){return respondWithRpcPromise(_0x4e19('0xec'),_0x4e19('0xed'),{'command':_0x5078de[_0x4e19('0xee')]?util[_0x4e19('0xb7')](_0x4e19('0xef'),_0x3c3087['interval'],_0x5078de[_0x4e19('0xee')]):util[_0x4e19('0xb7')]('iftime\x20%s',_0x3c3087[_0x4e19('0xf0')])},client9002)[_0x4e19('0x39')](function(_0x2b192c){var _0x2575a6=_0x2b192c&&_0x2b192c[_0x4e19('0xf1')](_0x4e19('0xf2'))>=0x0?!![]:![];logger[_0x4e19('0x24')](_0x4e19('0xf3'),_0x5078de['id'],_0x3c3087['id'],_0x3c3087[_0x4e19('0xf0')],_0x2575a6?_0x4e19('0xf4'):'OFFLINE',_0x5078de['timezone']?_0x5078de[_0x4e19('0xee')]:'No\x20timezone');return _0x2575a6;})['catch'](function(_0x358bb4){logger[_0x4e19('0x29')](_0x4e19('0xf3'),_0x5078de['id'],_0x3c3087['id'],_0x3c3087[_0x4e19('0xf0')],util[_0x4e19('0xf5')](_0x358bb4,{'showHidden':![],'depth':null}),_0x5078de[_0x4e19('0xee')]?_0x5078de[_0x4e19('0xee')]:_0x4e19('0xf6'));return![];});}exports[_0x4e19('0xed')]=function(_0x51dcbc,_0x87c979,_0x41a192){var _0x1f9b8a=0x0;var _0x53806f=0x0;var _0x527014=![];var _0x2ca997;var _0x42a113;return db[_0x4e19('0x42')][_0x4e19('0x60')]({'where':{'id':_0x51dcbc[_0x4e19('0x62')]['id']},'include':[{'model':db[_0x4e19('0xf7')],'as':_0x4e19('0xf7'),'include':[{'model':db[_0x4e19('0xf7')],'as':_0x4e19('0xf8'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x4e19('0x39')](handleEntityNotFound(_0x87c979,null))[_0x4e19('0x39')](function(_0x424207){if(_0x424207){_0x2ca997=_0x424207;return _0x424207['getProactiveActions']({'raw':!![]});}})[_0x4e19('0x39')](function(_0x24ea11){if(_0x2ca997){if(_0x24ea11){_0x42a113=_0x24ea11;}}return require(_0x4e19('0x7c'))['getLicense']();})[_0x4e19('0x39')](function(_0x113b44){if(_0x113b44){_0x53806f=_0x113b44[_0x4e19('0xf9')];_0x527014=_0x113b44[_0x4e19('0x7e')];}})[_0x4e19('0x39')](function(){return db[_0x4e19('0xbb')][_0x4e19('0x31')]({'where':{'closed':![]}});})[_0x4e19('0x39')](function(_0x86cca6){_0x1f9b8a=_0x86cca6;if(_0x53806f&&_0x86cca6>_0x53806f){return db[_0x4e19('0xfa')]['findOne']({'where':{'id':0x1}})['then'](function(_0x12b4d6){if(_0x12b4d6){_0x12b4d6[_0x4e19('0xfb')]('chatLicenseExceeded');}});}})[_0x4e19('0x39')](function(){if(_0x2ca997[_0x4e19('0xf7')]&&_0x2ca997[_0x4e19('0xf7')][_0x4e19('0xf8')]){var _0x2cfe11=[];for(var _0x64db6f=0x0;_0x64db6f<_0x2ca997[_0x4e19('0xf7')]['Intervals'][_0x4e19('0x4c')];_0x64db6f++){var _0x24b539=_0x2ca997[_0x4e19('0xf7')][_0x4e19('0xf8')][_0x64db6f]['get']({'plain':!![]});_0x2cfe11['push'](iftimePromise(_0x24b539,_0x2ca997));}return BPromise[_0x4e19('0xfc')](_0x2cfe11)['then'](function(_0x555732){return _['some'](_0x555732);});}else{return!![];}})[_0x4e19('0x39')](function(_0x1a8079){var _0x105639=fs[_0x4e19('0xd6')](path[_0x4e19('0x79')](config['root'],_0x4e19('0xfd')),_0x4e19('0xfe'));var _0x4c7ac8={'remote':_0x2ca997[_0x4e19('0xff')],'query':querystring[_0x4e19('0xb9')](_[_0x4e19('0x52')](_0x2ca997[_0x4e19('0x3b')]({'plain':!![]}),{'customerIp':_0x51dcbc[_0x4e19('0x8d')]['x-forwarded-for']||_0x51dcbc[_0x4e19('0x8d')][_0x4e19('0x100')]||_0x51dcbc[_0x4e19('0x101')]['remoteAddress']||_0x51dcbc['ip'],'referer':_0x51dcbc[_0x4e19('0x8d')]['referer'],'openedInteractions':_0x1f9b8a,'maxInteractions':_0x53806f,'virtual':_0x527014[_0x4e19('0xf9')],'online':_0x1a8079,'custom':_0x527014}))[_0x4e19('0x102')](/'/g,'\x5c\x27')};_0x87c979[_0x4e19('0x3e')](ejs['render'](Mustache[_0x4e19('0x103')](_0x105639,_0x4c7ac8),{'proactiveActions':_0x42a113,'alignment':_0x2ca997['alignment'],'verticalAlignment':_0x2ca997[_0x4e19('0x104')],'div_color':_0x2ca997[_0x4e19('0xea')],'text_color':_0x2ca997[_0x4e19('0x105')]}));})[_0x4e19('0x2d')](handleError(_0x87c979,null));};exports[_0x4e19('0x106')]=function(_0x4237e5,_0x39ba85,_0x4cff3d){return db[_0x4e19('0x42')]['findOne']({'where':{'id':_0x4237e5[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x39ba85,null))[_0x4e19('0x39')](function(_0x311641){if(_0x311641){return db[_0x4e19('0x107')][_0x4e19('0x108')](function(_0x4db373){return db[_0x4e19('0x9f')]['destroy']({'where':{'ChatWebsiteId':_0x4237e5[_0x4e19('0x62')]['id']},'transaction':_0x4db373})[_0x4e19('0x39')](function(_0x249ae6){var _0x4a35f0=_[_0x4e19('0x41')](_0x4237e5[_0x4e19('0x5c')],function(_0x146bf1){_0x146bf1[_0x4e19('0x65')]=_0x4237e5[_0x4e19('0x62')]['id'];return _0x146bf1;});return db[_0x4e19('0x9f')][_0x4e19('0x109')](_0x4a35f0,{'transaction':_0x4db373});});})['then'](function(){return db[_0x4e19('0x9f')][_0x4e19('0x10a')]({'where':{'ChatWebsiteId':_0x4237e5['params']['id']},'order':_0x4e19('0xa5')});});}})['then'](respondWithResult(_0x39ba85,null))[_0x4e19('0x2d')](handleError(_0x39ba85,null));};exports['getApplications']=function(_0x58f243,_0x3c73df,_0x529585){var _0x4f3f79={};var _0x25e020={};var _0x349a3f;var _0x3456a8;return db['ChatWebsite']['findOne']({'where':{'id':_0x58f243[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x3c73df,null))[_0x4e19('0x39')](function(_0x329309){if(_0x329309){_0x349a3f=_0x329309;_0x25e020[_0x4e19('0x47')]=_[_0x4e19('0x59')](db[_0x4e19('0x9f')][_0x4e19('0x43')]);_0x25e020['query']=_[_0x4e19('0x59')](_0x58f243['query']);_0x25e020['filters']=_[_0x4e19('0x49')](_0x25e020[_0x4e19('0x47')],_0x25e020[_0x4e19('0x48')]);_0x4f3f79[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x25e020[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x58f243[_0x4e19('0x48')][_0x4e19('0x4b')]));_0x4f3f79[_0x4e19('0x4a')]=_0x4f3f79['attributes'][_0x4e19('0x4c')]?_0x4f3f79[_0x4e19('0x4a')]:_0x25e020['model'];_0x4f3f79['order']=qs[_0x4e19('0x4e')](_0x58f243[_0x4e19('0x48')][_0x4e19('0x4e')]);_0x4f3f79[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x58f243[_0x4e19('0x48')],_0x25e020[_0x4e19('0x4f')]));if(_0x58f243[_0x4e19('0x48')][_0x4e19('0x51')]){_0x4f3f79[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x4f3f79[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x4f3f79[_0x4e19('0x4a')],function(_0xf30d64){var _0x1ab25a={};_0x1ab25a[_0xf30d64]={'$like':'%'+_0x58f243['query'][_0x4e19('0x51')]+'%'};return _0x1ab25a;})});}_0x4f3f79=_['merge']({},_0x4f3f79,_0x58f243[_0x4e19('0x54')]);return _0x349a3f[_0x4e19('0x10b')](_0x4f3f79);}})['then'](function(_0x3200d5){if(_0x3200d5){_0x3456a8=_0x3200d5[_0x4e19('0x4c')];if(!_0x58f243[_0x4e19('0x48')]['hasOwnProperty'](_0x4e19('0x4d'))){_0x4f3f79[_0x4e19('0x33')]=qs[_0x4e19('0x33')](_0x58f243[_0x4e19('0x48')][_0x4e19('0x33')]);_0x4f3f79[_0x4e19('0x32')]=qs[_0x4e19('0x32')](_0x58f243[_0x4e19('0x48')][_0x4e19('0x32')]);}return _0x349a3f[_0x4e19('0x10b')](_0x4f3f79);}})['then'](function(_0x3c55eb){if(_0x3c55eb){return _0x3c55eb?{'count':_0x3456a8,'rows':_0x3c55eb}:null;}})[_0x4e19('0x39')](respondWithResult(_0x3c73df,null))['catch'](handleError(_0x3c73df,null));};exports[_0x4e19('0x10c')]=function(_0x48020a,_0x4a95dd,_0x10fc03){return db[_0x4e19('0x10d')][_0x4e19('0x60')]({'where':{'id':_0x48020a[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x4a95dd,null))[_0x4e19('0x39')](function(_0x35faa0){if(_0x35faa0){return _0x35faa0[_0x4e19('0x10c')](_0x48020a[_0x4e19('0x5c')]['ids'],_[_0x4e19('0xe5')](_0x48020a[_0x4e19('0x5c')],[_0x4e19('0x6d'),'id'])||{});}})[_0x4e19('0x39')](respondWithResult(_0x4a95dd,null))[_0x4e19('0x2d')](handleError(_0x4a95dd,null));};exports[_0x4e19('0x10e')]=function(_0x1c8f3f,_0x40a0a6,_0x40be5e){var _0x19a1a4={};var _0x3b187b={};var _0x4da893;var _0x5bd0a8;return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x1c8f3f[_0x4e19('0x62')]['id']}})[_0x4e19('0x39')](handleEntityNotFound(_0x40a0a6,null))[_0x4e19('0x39')](function(_0x504c80){if(_0x504c80){_0x4da893=_0x504c80;_0x3b187b[_0x4e19('0x47')]=_[_0x4e19('0x59')](db['ChatProactiveAction'][_0x4e19('0x43')]);_0x3b187b[_0x4e19('0x48')]=_['keys'](_0x1c8f3f['query']);_0x3b187b[_0x4e19('0x4f')]=_['intersection'](_0x3b187b[_0x4e19('0x47')],_0x3b187b[_0x4e19('0x48')]);_0x19a1a4[_0x4e19('0x4a')]=_['intersection'](_0x3b187b[_0x4e19('0x47')],qs['fields'](_0x1c8f3f['query'][_0x4e19('0x4b')]));_0x19a1a4[_0x4e19('0x4a')]=_0x19a1a4[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x19a1a4[_0x4e19('0x4a')]:_0x3b187b['model'];_0x19a1a4['order']=qs[_0x4e19('0x4e')](_0x1c8f3f['query']['sort']);_0x19a1a4[_0x4e19('0x55')]=qs['filters'](_[_0x4e19('0x50')](_0x1c8f3f[_0x4e19('0x48')],_0x3b187b[_0x4e19('0x4f')]));if(_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x51')]){_0x19a1a4[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x19a1a4[_0x4e19('0x55')],{'$or':_['map'](_0x19a1a4['attributes'],function(_0x8a2482){var _0x203e00={};_0x203e00[_0x8a2482]={'$like':'%'+_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x203e00;})});}_0x19a1a4=_[_0x4e19('0x52')]({},_0x19a1a4,_0x1c8f3f[_0x4e19('0x54')]);return _0x4da893[_0x4e19('0x10e')](_0x19a1a4);}})['then'](function(_0x44f9f4){if(_0x44f9f4){_0x5bd0a8=_0x44f9f4[_0x4e19('0x4c')];if(!_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x69')](_0x4e19('0x4d'))){_0x19a1a4[_0x4e19('0x33')]=qs[_0x4e19('0x33')](_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x33')]);_0x19a1a4['offset']=qs[_0x4e19('0x32')](_0x1c8f3f[_0x4e19('0x48')][_0x4e19('0x32')]);}return _0x4da893[_0x4e19('0x10e')](_0x19a1a4);}})[_0x4e19('0x39')](function(_0x26ee47){if(_0x26ee47){return _0x26ee47?{'count':_0x5bd0a8,'rows':_0x26ee47}:null;}})['then'](respondWithResult(_0x40a0a6,null))[_0x4e19('0x2d')](handleError(_0x40a0a6,null));};exports['getFields']=function(_0x29f56d,_0x212baf,_0x916039){var _0x5d9a6c=_0x29f56d['query'][_0x4e19('0x10f')]===_0x4e19('0x110')?_0x4e19('0x111'):'onlineForm';return db[_0x4e19('0x42')][_0x4e19('0x60')]({'attributes':['id',_0x5d9a6c],'where':{'id':_0x29f56d[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x212baf,null))['then'](function(_0xf96cc2){if(_0xf96cc2){var _0x5a9697=_0xf96cc2[_0x5d9a6c];var _0x1208a0=_0x5a9697&&_0x5a9697[_0x4e19('0x112')]?_0x5a9697[_0x4e19('0x112')]:[];_0x212baf[_0x4e19('0x3e')]({'fromKey':_[_0x4e19('0x88')](_0x5a9697['fromKey'])?undefined:_0x5a9697[_0x4e19('0x113')],'count':_0x1208a0[_0x4e19('0x4c')],'rows':_0x1208a0});}})[_0x4e19('0x2d')](handleError(_0x212baf,null));};exports['getOfflineMessages']=function(_0x4fd3ac,_0x3fa334,_0x41cd1c){var _0x151e30={'raw':![],'where':{}};var _0x1fc647={};var _0x5afaae={'count':0x0,'rows':[]};return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x4fd3ac['params']['id']}})['then'](handleEntityNotFound(_0x3fa334,null))['then'](function(_0x35a0c7){if(_0x35a0c7){_0x1fc647[_0x4e19('0x47')]=_[_0x4e19('0x59')](db[_0x4e19('0x114')]['rawAttributes']);_0x1fc647['query']=_['keys'](_0x4fd3ac['query']);_0x1fc647[_0x4e19('0x4f')]=_['intersection'](_0x1fc647[_0x4e19('0x47')],_0x1fc647[_0x4e19('0x48')]);_0x151e30['attributes']=_[_0x4e19('0x49')](_0x1fc647['model'],qs[_0x4e19('0x4b')](_0x4fd3ac['query']['fields']));_0x151e30[_0x4e19('0x4a')]=_0x151e30[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x151e30[_0x4e19('0x4a')]:_0x1fc647['model'];if(!_0x4fd3ac[_0x4e19('0x48')][_0x4e19('0x69')]('nolimit')){_0x151e30[_0x4e19('0x33')]=qs[_0x4e19('0x33')](_0x4fd3ac['query']['limit']);_0x151e30[_0x4e19('0x32')]=qs[_0x4e19('0x32')](_0x4fd3ac['query']['offset']);}_0x151e30[_0x4e19('0x6a')]=qs['sort'](_0x4fd3ac[_0x4e19('0x48')][_0x4e19('0x4e')]);_0x151e30[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x4fd3ac[_0x4e19('0x48')],_0x1fc647[_0x4e19('0x4f')]));_0x151e30[_0x4e19('0x55')]['ChatWebsiteId']=_0x35a0c7['id'];if(_0x4fd3ac[_0x4e19('0x48')][_0x4e19('0x51')]){_0x151e30[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x151e30[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x151e30[_0x4e19('0x4a')],function(_0x26be0e){var _0x319870={};_0x319870[_0x26be0e]={'$like':'%'+_0x4fd3ac[_0x4e19('0x48')][_0x4e19('0x51')]+'%'};return _0x319870;})});}_0x151e30=_[_0x4e19('0x52')]({},_0x151e30,_0x4fd3ac[_0x4e19('0x54')]);return db[_0x4e19('0x114')]['count']({'where':_0x151e30[_0x4e19('0x55')]})[_0x4e19('0x39')](function(_0x4bcdc9){_0x5afaae[_0x4e19('0x31')]=_0x4bcdc9;if(_0x4fd3ac[_0x4e19('0x48')]['includeAll']){_0x151e30[_0x4e19('0x56')]=[{'all':!![]}];}else{_0x151e30['include']=[{'model':db[_0x4e19('0x91')],'as':_0x4e19('0x115'),'required':![]}];}return db[_0x4e19('0x114')][_0x4e19('0x57')](_0x151e30);})['then'](function(_0xb78563){_0x5afaae['rows']=_0xb78563;return _0x5afaae;});}})['then'](respondWithFilteredResult(_0x3fa334,_0x151e30))[_0x4e19('0x2d')](handleError(_0x3fa334,null));};exports[_0x4e19('0x116')]=function(_0x331c16,_0x361494,_0x173b8c){return db['ChatWebsite'][_0x4e19('0x60')]({'where':{'id':_0x331c16[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x361494,null))[_0x4e19('0x39')](function(_0x5c4688){if(_0x5c4688){return _0x5c4688[_0x4e19('0x116')](_0x331c16[_0x4e19('0x5c')][_0x4e19('0x6d')],_[_0x4e19('0xe5')](_0x331c16['body'],[_0x4e19('0x6d'),'id'])||{})[_0x4e19('0xbf')](function(_0x3dc12f){for(var _0x5bfeab=0x0;_0x5bfeab<_0x331c16[_0x4e19('0x5c')][_0x4e19('0x6d')]['length'];_0x5bfeab+=0x1){socket['emit'](_0x4e19('0x117'),{'UserId':_0x331c16['body'][_0x4e19('0x6d')][_0x5bfeab],'ChatWebsiteId':_0x331c16[_0x4e19('0x62')]['id']});}return _0x3dc12f;});}})['then'](respondWithResult(_0x361494,null))[_0x4e19('0x2d')](handleError(_0x361494,null));};exports[_0x4e19('0x118')]=function(_0x441b2a,_0x145df9,_0x1931bb){return db['ChatWebsite']['find']({'where':{'id':_0x441b2a[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x145df9,null))[_0x4e19('0x39')](function(_0x13158f){if(_0x13158f){return _0x13158f[_0x4e19('0x118')](_0x441b2a[_0x4e19('0x48')]['ids'])['then'](function(){if(_[_0x4e19('0x119')](_0x441b2a['query']['ids'])){for(var _0x346a88=0x0;_0x346a88<_0x441b2a[_0x4e19('0x48')][_0x4e19('0x6d')][_0x4e19('0x4c')];_0x346a88+=0x1){socket[_0x4e19('0x11a')](_0x4e19('0x11b'),{'UserId':Number(_0x441b2a[_0x4e19('0x48')][_0x4e19('0x6d')][_0x346a88]),'ChatWebsiteId':Number(_0x441b2a[_0x4e19('0x62')]['id'])});}}else{socket['emit'](_0x4e19('0x11b'),{'UserId':Number(_0x441b2a[_0x4e19('0x48')][_0x4e19('0x6d')]),'ChatWebsiteId':Number(_0x441b2a[_0x4e19('0x62')]['id'])});}});}})[_0x4e19('0x39')](respondWithStatusCode(_0x145df9,null))['catch'](handleError(_0x145df9,null));};exports[_0x4e19('0x11c')]=function(_0x3974db,_0x485e43,_0x5d84b6){var _0x297b17={};var _0x31df06={};var _0x412840;var _0xda39d0;return db[_0x4e19('0x42')][_0x4e19('0x68')]({'where':{'id':_0x3974db[_0x4e19('0x62')]['id']}})['then'](handleEntityNotFound(_0x485e43,null))[_0x4e19('0x39')](function(_0x3423f8){if(_0x3423f8){_0x412840=_0x3423f8;_0x31df06[_0x4e19('0x47')]=_['keys'](db[_0x4e19('0x11d')]['rawAttributes']);_0x31df06[_0x4e19('0x48')]=_[_0x4e19('0x59')](_0x3974db[_0x4e19('0x48')]);_0x31df06['filters']=_[_0x4e19('0x49')](_0x31df06[_0x4e19('0x47')],_0x31df06['query']);_0x297b17[_0x4e19('0x4a')]=_[_0x4e19('0x49')](_0x31df06[_0x4e19('0x47')],qs[_0x4e19('0x4b')](_0x3974db[_0x4e19('0x48')]['fields']));_0x297b17['attributes']=_0x297b17[_0x4e19('0x4a')][_0x4e19('0x4c')]?_0x297b17['attributes']:_0x31df06['model'];_0x297b17[_0x4e19('0x6a')]=qs[_0x4e19('0x4e')](_0x3974db[_0x4e19('0x48')][_0x4e19('0x4e')]);_0x297b17[_0x4e19('0x55')]=qs[_0x4e19('0x4f')](_[_0x4e19('0x50')](_0x3974db[_0x4e19('0x48')],_0x31df06[_0x4e19('0x4f')]));if(_0x3974db['query']['filter']){_0x297b17[_0x4e19('0x55')]=_[_0x4e19('0x52')](_0x297b17[_0x4e19('0x55')],{'$or':_[_0x4e19('0x41')](_0x297b17[_0x4e19('0x4a')],function(_0x45a149){var _0x12199b={};_0x12199b[_0x45a149]={'$like':'%'+_0x3974db['query'][_0x4e19('0x51')]+'%'};return _0x12199b;})});}_0x297b17=_[_0x4e19('0x52')]({},_0x297b17,_0x3974db[_0x4e19('0x54')]);return _0x412840[_0x4e19('0x11c')](_0x297b17);}})[_0x4e19('0x39')](function(_0x210379){if(_0x210379){_0xda39d0=_0x210379[_0x4e19('0x4c')];if(!_0x3974db[_0x4e19('0x48')]['hasOwnProperty'](_0x4e19('0x4d'))){_0x297b17[_0x4e19('0x33')]=qs['limit'](_0x3974db[_0x4e19('0x48')][_0x4e19('0x33')]);_0x297b17[_0x4e19('0x32')]=qs['offset'](_0x3974db[_0x4e19('0x48')]['offset']);}return _0x412840[_0x4e19('0x11c')](_0x297b17);}})[_0x4e19('0x39')](function(_0x1c31a6){if(_0x1c31a6){return _0x1c31a6?{'count':_0xda39d0,'rows':_0x1c31a6}:null;}})[_0x4e19('0x39')](respondWithResult(_0x485e43,null))[_0x4e19('0x2d')](handleError(_0x485e43,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b5889c1..7ba2875 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 _0xcac6=['hasOwnProperty','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','emit'];(function(_0x363050,_0x96f799){var _0x1dd5c5=function(_0x3e9ffe){while(--_0x3e9ffe){_0x363050['push'](_0x363050['shift']());}};_0x1dd5c5(++_0x96f799);}(_0xcac6,0xa3));var _0x6cac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcac6[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x6cac('0x0'))['db'][_0x6cac('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6cac('0x2')](0x0);var events={'afterCreate':_0x6cac('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2c3014){return function(_0x431603,_0x2810e7,_0x123b3b){ChatWebsiteEvents[_0x6cac('0x4')](_0x2c3014+':'+_0x431603['id'],_0x431603);ChatWebsiteEvents[_0x6cac('0x4')](_0x2c3014,_0x431603);_0x123b3b(null);};}for(var e in events){if(events[_0x6cac('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x6cac('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x5859=['save','update','remove','emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x4346e0,_0x103018){var _0x20cfac=function(_0x17394c){while(--_0x17394c){_0x4346e0['push'](_0x4346e0['shift']());}};_0x20cfac(++_0x103018);}(_0x5859,0xc4));var _0x9585=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5859[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x9585('0x0'));var ChatWebsite=require(_0x9585('0x1'))['db'][_0x9585('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9585('0x3')](0x0);var events={'afterCreate':_0x9585('0x4'),'afterUpdate':_0x9585('0x5'),'afterDestroy':_0x9585('0x6')};function emitEvent(_0x231c81){return function(_0x13ecbf,_0x160051,_0x150a6b){ChatWebsiteEvents[_0x9585('0x7')](_0x231c81+':'+_0x13ecbf['id'],_0x13ecbf);ChatWebsiteEvents[_0x9585('0x7')](_0x231c81,_0x13ecbf);_0x150a6b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9585('0x8')](e,emitEvent(event));}}module[_0x9585('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index cdd9f02..22641af 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 _0x9d02=['lodash','../../config/logger','moment','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites'];(function(_0x2594d6,_0x5aaac1){var _0x4b6d6e=function(_0x2eb82a){while(--_0x2eb82a){_0x2594d6['push'](_0x2594d6['shift']());}};_0x4b6d6e(++_0x5aaac1);}(_0x9d02,0x118));var _0x29d0=function(_0x27164d,_0x7b4360){_0x27164d=_0x27164d-0x0;var _0x3de047=_0x9d02[_0x27164d];return _0x3de047;};'use strict';var _=require(_0x29d0('0x0'));var util=require('util');var logger=require(_0x29d0('0x1'))('api');var moment=require(_0x29d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x29d0('0x3'));var fs=require('fs');var path=require(_0x29d0('0x4'));var rimraf=require('rimraf');var config=require(_0x29d0('0x5'));var attributes=require(_0x29d0('0x6'));module[_0x29d0('0x7')]=function(_0x5a9824,_0x5ef279){return _0x5a9824['define'](_0x29d0('0x8'),attributes,{'tableName':_0x29d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccdc=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','moment','bluebird'];(function(_0x396467,_0x2f6d45){var _0x50e2a6=function(_0x4cf9f1){while(--_0x4cf9f1){_0x396467['push'](_0x396467['shift']());}};_0x50e2a6(++_0x2f6d45);}(_0xccdc,0x1c4));var _0xcccd=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xccdc[_0x4ae625];return _0x31accf;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 1404c3b..65bda91 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 _0x187d=['stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x41373e,_0x2bbaf6){var _0x322c12=function(_0x382d25){while(--_0x382d25){_0x41373e['push'](_0x41373e['shift']());}};_0x322c12(++_0x2bbaf6);}(_0x187d,0x93));var _0xd187=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x187d[_0x25bea7];return _0x175952;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});config[_0xd187('0xb')]=_[_0xd187('0xc')](config[_0xd187('0xb')],{'host':_0xd187('0xd'),'port':0x18eb});var socket=require(_0xd187('0xe'))(new Redis(config[_0xd187('0xb')]));require('./chatWebsite.socket')[_0xd187('0xf')](socket);function respondWithRpcPromise(_0x42848b,_0x4039f6,_0x473866){return new BPromise(function(_0x33ca45,_0x2a61a4){return client['request'](_0x42848b,_0x473866)[_0xd187('0x10')](function(_0x412ccf){logger[_0xd187('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x4039f6,_0xd187('0x12'));logger[_0xd187('0x13')](_0xd187('0x14'),_0x4039f6,'request\x20sent',JSON[_0xd187('0x15')](_0x412ccf));if(_0x412ccf[_0xd187('0x16')]){if(_0x412ccf[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger['error'](_0xd187('0x18'),_0x4039f6,_0x412ccf[_0xd187('0x16')][_0xd187('0x19')]);return _0x2a61a4(_0x412ccf[_0xd187('0x16')]['message']);}logger[_0xd187('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x4039f6,_0x412ccf['error'][_0xd187('0x19')]);return _0x33ca45(_0x412ccf['error']['message']);}else{logger[_0xd187('0x11')](_0xd187('0x18'),_0x4039f6,_0xd187('0x12'));_0x33ca45(_0x412ccf[_0xd187('0x1a')][_0xd187('0x19')]);}})[_0xd187('0x1b')](function(_0x12b388){logger[_0xd187('0x16')](_0xd187('0x18'),_0x4039f6,_0x12b388);_0x2a61a4(_0x12b388);});});} \ No newline at end of file +var _0xef0f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x481ae3,_0x504e3c){var _0x457564=function(_0x294359){while(--_0x294359){_0x481ae3['push'](_0x481ae3['shift']());}};_0x457564(++_0x504e3c);}(_0xef0f,0x168));var _0xfef0=function(_0x16d39b,_0x100769){_0x16d39b=_0x16d39b-0x0;var _0x1bf6da=_0xef0f[_0x16d39b];return _0x1bf6da;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});config[_0xfef0('0xb')]=_[_0xfef0('0xc')](config['redis'],{'host':_0xfef0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfef0('0xb')]));require(_0xfef0('0xe'))[_0xfef0('0xf')](socket);function respondWithRpcPromise(_0x2d42dc,_0x334e74,_0x402dff){return new BPromise(function(_0xc177db,_0x4bd6f2){return client[_0xfef0('0x10')](_0x2d42dc,_0x402dff)[_0xfef0('0x11')](function(_0x410234){logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,_0xfef0('0x14'));logger['debug'](_0xfef0('0x15'),_0x334e74,_0xfef0('0x14'),JSON[_0xfef0('0x16')](_0x410234));if(_0x410234[_0xfef0('0x17')]){if(_0x410234[_0xfef0('0x17')][_0xfef0('0x18')]===0x1f4){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x410234[_0xfef0('0x17')]['message']);return _0x4bd6f2(_0x410234['error']['message']);}logger[_0xfef0('0x17')](_0xfef0('0x13'),_0x334e74,_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);return _0xc177db(_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);}else{logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,'request\x20sent');_0xc177db(_0x410234[_0xfef0('0x1a')][_0xfef0('0x19')]);}})[_0xfef0('0x1b')](function(_0x39f9d3){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x39f9d3);_0x4bd6f2(_0x39f9d3);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 22eff25..56c4490 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(_0x3f271e,_0x1fc208){var _0x407ebd=function(_0x42e2a4){while(--_0x42e2a4){_0x3f271e['push'](_0x3f271e['shift']());}};_0x407ebd(++_0x1fc208);}(_0x7a54,0x106));var _0x47a5=function(_0x26057c,_0x49baa2){_0x26057c=_0x26057c-0x0;var _0x550157=_0x7a54[_0x26057c];return _0x550157;};'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(_0x4b48e5,_0xc3c425){var _0x210b17=function(_0x43ccc1){while(--_0x43ccc1){_0x4b48e5['push'](_0x4b48e5['shift']());}};_0x210b17(++_0xc3c425);}(_0x5f2f,0x73));var _0xf5f2=function(_0x389c96,_0x2eb57c){_0x389c96=_0x389c96-0x0;var _0x169844=_0x5f2f[_0x389c96];return _0x169844;};'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 42b0396..dbe1519 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 _0xc914=['getOfflineMessages','addDisposition','post','diskStorage','join','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','format','addAvatar','addCustomerAvatar','root','/:id/notify','notify','offline','/:id/interactions','addInteraction','/:id/applications','addApplications','addProactiveActions','/:id/users','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','/describe','describe','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages'];(function(_0x26a3fe,_0x3b513e){var _0x33571a=function(_0x39d677){while(--_0x39d677){_0x26a3fe['push'](_0x26a3fe['shift']());}};_0x33571a(++_0x3b513e);}(_0xc914,0x19c));var _0x4c91=function(_0x38767b,_0x21f688){_0x38767b=_0x38767b-0x0;var _0x2ba35b=_0xc914[_0x38767b];return _0x2ba35b;};'use strict';var multer=require('multer');var util=require(_0x4c91('0x0'));var path=require('path');var timeout=require(_0x4c91('0x1'));var express=require('express');var router=express[_0x4c91('0x2')]();var auth=require(_0x4c91('0x3'));var interaction=require(_0x4c91('0x4'));var config=require(_0x4c91('0x5'));var controller=require(_0x4c91('0x6'));router['get']('/',auth[_0x4c91('0x7')](),controller[_0x4c91('0x8')]);router['get'](_0x4c91('0x9'),auth[_0x4c91('0x7')](),controller[_0x4c91('0xa')]);router['get']('/:id',auth[_0x4c91('0x7')](),controller['show']);router[_0x4c91('0xb')](_0x4c91('0xc'),auth['isAuthenticated'](),controller[_0x4c91('0xd')]);router[_0x4c91('0xb')](_0x4c91('0xe'),auth[_0x4c91('0x7')](),controller[_0x4c91('0xf')]);router['get'](_0x4c91('0x10'),controller['getLogo']);router['get'](_0x4c91('0x11'),controller['getAvatar']);router[_0x4c91('0xb')](_0x4c91('0x12'),controller[_0x4c91('0x13')]);router[_0x4c91('0xb')](_0x4c91('0x14'),controller['getSystemAvatar']);router[_0x4c91('0xb')]('/:id/interactions',auth[_0x4c91('0x7')](),controller[_0x4c91('0x15')]);router[_0x4c91('0xb')](_0x4c91('0x16'),controller[_0x4c91('0x17')]);router[_0x4c91('0xb')]('/:id/applications',auth['isAuthenticated'](),controller[_0x4c91('0x18')]);router[_0x4c91('0xb')](_0x4c91('0x19'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x1a')]);router[_0x4c91('0xb')](_0x4c91('0x1b'),controller['getFields']);router['get'](_0x4c91('0x1c'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x1d')]);router[_0x4c91('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x4c91('0xc'),auth['isAuthenticated'](),controller[_0x4c91('0x1e')]);router[_0x4c91('0x1f')](_0x4c91('0xe'),auth[_0x4c91('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x4c91('0x20')]({'destination':function(_0x17a509,_0x133d9c,_0x31a852){_0x31a852(null,path[_0x4c91('0x21')](config['root'],'server/files/images/logos/'));},'filename':function(_0x34674d,_0x2036dd,_0x5a2e58){_0x5a2e58(null,util['format'](_0x4c91('0x22'),Date[_0x4c91('0x23')](),_0x2036dd[_0x4c91('0x24')]));}})});router[_0x4c91('0x1f')](_0x4c91('0x10'),upload[_0x4c91('0x25')](_0x4c91('0x26')),controller[_0x4c91('0x27')]);var upload=multer({'storage':multer[_0x4c91('0x20')]({'destination':function(_0x1bf408,_0x2b7643,_0xc7baea){_0xc7baea(null,path[_0x4c91('0x21')](config['root'],_0x4c91('0x28')));},'filename':function(_0xa7d9f3,_0x15ba8d,_0x4bfcdb){_0x4bfcdb(null,util[_0x4c91('0x29')](_0x4c91('0x22'),Date[_0x4c91('0x23')](),_0x15ba8d[_0x4c91('0x24')]));}})});router['post'](_0x4c91('0x11'),upload[_0x4c91('0x25')](_0x4c91('0x26')),controller[_0x4c91('0x2a')]);var upload=multer({'storage':multer[_0x4c91('0x20')]({'destination':function(_0x3957d0,_0x5b6361,_0x1fdfbb){_0x1fdfbb(null,path[_0x4c91('0x21')](config['root'],_0x4c91('0x28')));},'filename':function(_0xe1b85b,_0x175a42,_0x564f66){_0x564f66(null,util[_0x4c91('0x29')]('%s-%s',Date[_0x4c91('0x23')](),_0x175a42['originalname']));}})});router['post']('/:id/customer_avatar',upload[_0x4c91('0x25')]('file'),controller[_0x4c91('0x2b')]);var upload=multer({'storage':multer[_0x4c91('0x20')]({'destination':function(_0x57c3ad,_0x6b5231,_0x1eb05e){_0x1eb05e(null,path[_0x4c91('0x21')](config[_0x4c91('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x3ee50a,_0x1c0d99,_0x1f9b0e){_0x1f9b0e(null,util[_0x4c91('0x29')]('%s-%s',Date[_0x4c91('0x23')](),_0x1c0d99[_0x4c91('0x24')]));}})});router[_0x4c91('0x1f')](_0x4c91('0x14'),upload[_0x4c91('0x25')](_0x4c91('0x26')),controller['addSystemAvatar']);router[_0x4c91('0x1f')](_0x4c91('0x2d'),controller[_0x4c91('0x2e')]);router[_0x4c91('0x1f')]('/:id/offline',controller[_0x4c91('0x2f')]);router[_0x4c91('0x1f')](_0x4c91('0x30'),auth['isAuthenticated'](),controller[_0x4c91('0x31')]);router[_0x4c91('0x1f')](_0x4c91('0x32'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x33')]);router[_0x4c91('0x1f')](_0x4c91('0x19'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x34')]);router[_0x4c91('0x1f')](_0x4c91('0x35'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x36')]);router[_0x4c91('0x37')](_0x4c91('0x38'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x39')]);router['delete'](_0x4c91('0x38'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x3a')]);router[_0x4c91('0x3b')](_0x4c91('0xc'),auth['isAuthenticated'](),controller[_0x4c91('0x3c')]);router[_0x4c91('0x3b')](_0x4c91('0xe'),auth[_0x4c91('0x7')](),controller[_0x4c91('0x3d')]);router[_0x4c91('0x3b')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x4c91('0x3e')]=router; \ No newline at end of file +var _0x9fc2=['./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addAnswer','join','root','%s-%s','now','originalname','/:id/logo','file','addLogo','server/files/images/avatars/','format','single','addAvatar','addCustomerAvatar','diskStorage','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','/:id/offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x9fc2,0x1a1));var _0x29fc=function(_0xff5df6,_0x514e73){_0xff5df6=_0xff5df6-0x0;var _0x2634bb=_0x9fc2[_0xff5df6];return _0x2634bb;};'use strict';var multer=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var path=require(_0x29fc('0x2'));var timeout=require(_0x29fc('0x3'));var express=require(_0x29fc('0x4'));var router=express[_0x29fc('0x5')]();var auth=require(_0x29fc('0x6'));var interaction=require(_0x29fc('0x7'));var config=require(_0x29fc('0x8'));var controller=require(_0x29fc('0x9'));router[_0x29fc('0xa')]('/',auth[_0x29fc('0xb')](),controller[_0x29fc('0xc')]);router['get'](_0x29fc('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x29fc('0xe'),auth[_0x29fc('0xb')](),controller[_0x29fc('0xf')]);router[_0x29fc('0xa')](_0x29fc('0x10'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x11')]);router[_0x29fc('0xa')](_0x29fc('0x12'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x13')]);router[_0x29fc('0xa')]('/:id/logo',controller[_0x29fc('0x14')]);router[_0x29fc('0xa')](_0x29fc('0x15'),controller[_0x29fc('0x16')]);router[_0x29fc('0xa')](_0x29fc('0x17'),controller[_0x29fc('0x18')]);router[_0x29fc('0xa')]('/:id/system_avatar',controller[_0x29fc('0x19')]);router[_0x29fc('0xa')]('/:id/interactions',auth[_0x29fc('0xb')](),controller[_0x29fc('0x1a')]);router[_0x29fc('0xa')](_0x29fc('0x1b'),controller[_0x29fc('0x1c')]);router['get'](_0x29fc('0x1d'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x1e')]);router[_0x29fc('0xa')](_0x29fc('0x1f'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x20')]);router['get'](_0x29fc('0x21'),controller['getFields']);router['get'](_0x29fc('0x22'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x23')]);router['get'](_0x29fc('0x24'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x25')]);router['post']('/',auth[_0x29fc('0xb')](),controller['create']);router[_0x29fc('0x26')](_0x29fc('0x10'),auth[_0x29fc('0xb')](),controller['addDisposition']);router[_0x29fc('0x26')](_0x29fc('0x12'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x423073,_0x26c463,_0x16c772){_0x16c772(null,path[_0x29fc('0x28')](config[_0x29fc('0x29')],'server/files/images/logos/'));},'filename':function(_0x1663ae,_0x86a35a,_0x13a92b){_0x13a92b(null,util['format'](_0x29fc('0x2a'),Date[_0x29fc('0x2b')](),_0x86a35a[_0x29fc('0x2c')]));}})});router[_0x29fc('0x26')](_0x29fc('0x2d'),upload['single'](_0x29fc('0x2e')),controller[_0x29fc('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4cf01d,_0x24f4d5,_0x892c90){_0x892c90(null,path['join'](config[_0x29fc('0x29')],_0x29fc('0x30')));},'filename':function(_0x3ccddd,_0x17717a,_0xc9aa9c){_0xc9aa9c(null,util[_0x29fc('0x31')](_0x29fc('0x2a'),Date[_0x29fc('0x2b')](),_0x17717a[_0x29fc('0x2c')]));}})});router[_0x29fc('0x26')](_0x29fc('0x15'),upload[_0x29fc('0x32')](_0x29fc('0x2e')),controller[_0x29fc('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5588e8,_0x264d00,_0x5c33cf){_0x5c33cf(null,path[_0x29fc('0x28')](config[_0x29fc('0x29')],'server/files/images/avatars/'));},'filename':function(_0x3ff100,_0x258742,_0x1089e6){_0x1089e6(null,util[_0x29fc('0x31')](_0x29fc('0x2a'),Date[_0x29fc('0x2b')](),_0x258742[_0x29fc('0x2c')]));}})});router['post'](_0x29fc('0x17'),upload[_0x29fc('0x32')](_0x29fc('0x2e')),controller[_0x29fc('0x34')]);var upload=multer({'storage':multer[_0x29fc('0x35')]({'destination':function(_0xbcac40,_0x346d61,_0x19f670){_0x19f670(null,path[_0x29fc('0x28')](config[_0x29fc('0x29')],'server/files/images/avatars/'));},'filename':function(_0x592bfe,_0xc87645,_0xfb628a){_0xfb628a(null,util['format'](_0x29fc('0x2a'),Date[_0x29fc('0x2b')](),_0xc87645[_0x29fc('0x2c')]));}})});router['post'](_0x29fc('0x36'),upload[_0x29fc('0x32')](_0x29fc('0x2e')),controller[_0x29fc('0x37')]);router[_0x29fc('0x26')](_0x29fc('0x38'),controller[_0x29fc('0x39')]);router[_0x29fc('0x26')](_0x29fc('0x3a'),controller['offline']);router[_0x29fc('0x26')](_0x29fc('0x3b'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x3c')]);router[_0x29fc('0x26')]('/:id/applications',auth[_0x29fc('0xb')](),controller[_0x29fc('0x3d')]);router[_0x29fc('0x26')](_0x29fc('0x1f'),auth['isAuthenticated'](),controller[_0x29fc('0x3e')]);router[_0x29fc('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0x29fc('0x3f')]);router[_0x29fc('0x40')](_0x29fc('0xe'),auth['isAuthenticated'](),controller[_0x29fc('0x41')]);router['delete'](_0x29fc('0xe'),auth[_0x29fc('0xb')](),controller[_0x29fc('0x42')]);router[_0x29fc('0x43')]('/:id/dispositions',auth[_0x29fc('0xb')](),controller[_0x29fc('0x44')]);router[_0x29fc('0x43')](_0x29fc('0x12'),auth['isAuthenticated'](),controller[_0x29fc('0x45')]);router[_0x29fc('0x43')](_0x29fc('0x24'),auth[_0x29fc('0xb')](),controller['removeAgents']);module[_0x29fc('0x46')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 54d42aa..c05f2cd 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 _0x58e6=['Google','STRING','sequelize','exports'];(function(_0x557186,_0x2d9e8a){var _0x55eae2=function(_0xca7065){while(--_0xca7065){_0x557186['push'](_0x557186['shift']());}};_0x55eae2(++_0x2d9e8a);}(_0x58e6,0x1c2));var _0x658e=function(_0x2d7af6,_0x2e0c9e){_0x2d7af6=_0x2d7af6-0x0;var _0x414558=_0x58e6[_0x2d7af6];return _0x414558;};'use strict';var Sequelize=require(_0x658e('0x0'));module[_0x658e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0x658e('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x658e('0x3')]}}; \ No newline at end of file +var _0x0958=['exports','STRING','AmazonAWS','Google','sequelize'];(function(_0x4c378e,_0x286afb){var _0xf41ce7=function(_0x48d22e){while(--_0x48d22e){_0x4c378e['push'](_0x4c378e['shift']());}};_0xf41ce7(++_0x286afb);}(_0x0958,0x7c));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8095('0x0'));module[_0x8095('0x1')]={'name':{'type':Sequelize[_0x8095('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x8095('0x3'),_0x8095('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 24625eb..671f652 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 _0x182c=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','limit','status','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','CloudProvider','count','includeAll','include','params','fields','length','find','catch','create','update','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x3af250,_0x57c18c){var _0xe50e96=function(_0x2d5483){while(--_0x2d5483){_0x3af250['push'](_0x3af250['shift']());}};_0xe50e96(++_0x57c18c);}(_0x182c,0x1a9));var _0xc182=function(_0x1d219c,_0x50820a){_0x1d219c=_0x1d219c-0x0;var _0x3d9fde=_0x182c[_0x1d219c];return _0x3d9fde;};'use strict';var pdf=require(_0xc182('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc182('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc182('0x2'));var rp=require('request-promise');var moment=require(_0xc182('0x3'));var BPromise=require(_0xc182('0x4'));var Mustache=require(_0xc182('0x5'));var util=require(_0xc182('0x6'));var path=require('path');var sox=require(_0xc182('0x7'));var csv=require(_0xc182('0x8'));var ejs=require(_0xc182('0x9'));var fs=require('fs');var _=require(_0xc182('0xa'));var squel=require(_0xc182('0xb'));var crypto=require(_0xc182('0xc'));var jsforce=require(_0xc182('0xd'));var deskjs=require(_0xc182('0xe'));var toCsv=require(_0xc182('0x8'));var querystring=require(_0xc182('0xf'));var Papa=require(_0xc182('0x10'));var Redis=require(_0xc182('0x11'));var authService=require(_0xc182('0x12'));var qs=require(_0xc182('0x13'));var as=require(_0xc182('0x14'));var hardwareService=require(_0xc182('0x15'));var logger=require('../../config/logger')(_0xc182('0x16'));var utils=require('../../config/utils');var config=require(_0xc182('0x17'));var db=require(_0xc182('0x18'))['db'];function respondWithStatusCode(_0x6f68e9,_0xe8fe1f){_0xe8fe1f=_0xe8fe1f||0xcc;return function(_0x354974){if(_0x354974){return _0x6f68e9[_0xc182('0x19')](_0xe8fe1f);}return _0x6f68e9['status'](_0xe8fe1f)['end']();};}function respondWithResult(_0x4cff36,_0x48e53e){_0x48e53e=_0x48e53e||0xc8;return function(_0x4a1932){if(_0x4a1932){return _0x4cff36['status'](_0x48e53e)['json'](_0x4a1932);}};}function respondWithFilteredResult(_0x3d2fc8,_0x55ac4a){return function(_0x375a1a){if(_0x375a1a){var _0x59318a=_0x375a1a['count'],_0x36e366=_0x55ac4a['offset'],_0x449da6=_0x55ac4a['offset']+_0x55ac4a[_0xc182('0x1a')],_0x371cbc;if(_0x449da6>=_0x59318a){_0x449da6=_0x59318a;_0x371cbc=0xc8;}else{_0x371cbc=0xce;}_0x3d2fc8[_0xc182('0x1b')](_0x371cbc);return _0x3d2fc8['set'](_0xc182('0x1c'),_0x36e366+'-'+_0x449da6+'/'+_0x59318a)[_0xc182('0x1d')](_0x375a1a);}return null;};}function patchUpdates(_0x3888e7){return function(_0x20f71a){try{jsonpatch[_0xc182('0x1e')](_0x20f71a,_0x3888e7,!![]);}catch(_0x302e0d){return BPromise[_0xc182('0x1f')](_0x302e0d);}return _0x20f71a['save']();};}function saveUpdates(_0x53521b,_0xe42760){return function(_0x35a8b0){if(_0x35a8b0){return _0x35a8b0['update'](_0x53521b)[_0xc182('0x20')](function(_0x5129b5){return _0x5129b5;});}return null;};}function removeEntity(_0x106765,_0x1bc9f4){return function(_0x596318){if(_0x596318){return _0x596318[_0xc182('0x21')]()[_0xc182('0x20')](function(){_0x106765[_0xc182('0x1b')](0xcc)[_0xc182('0x22')]();});}};}function handleEntityNotFound(_0x1db916,_0x2efe28){return function(_0x3481f3){if(!_0x3481f3){_0x1db916[_0xc182('0x19')](0x194);}return _0x3481f3;};}function handleError(_0x560cb6,_0x3bb5f6){_0x3bb5f6=_0x3bb5f6||0x1f4;return function(_0x5cd563){logger[_0xc182('0x23')](_0x5cd563[_0xc182('0x24')]);if(_0x5cd563['name']){delete _0x5cd563[_0xc182('0x25')];}_0x560cb6[_0xc182('0x1b')](_0x3bb5f6)[_0xc182('0x26')](_0x5cd563);};}exports[_0xc182('0x27')]=function(_0x2b47f7,_0x30986c){var _0x4010b1={},_0x39a77e={},_0x54a5c8={'count':0x0,'rows':[]};var _0x8cec8b=_['map'](db['CloudProvider'][_0xc182('0x28')],function(_0x1de158){return{'name':_0x1de158[_0xc182('0x29')],'type':_0x1de158[_0xc182('0x2a')][_0xc182('0x2b')]};});_0x39a77e[_0xc182('0x2c')]=_[_0xc182('0x2d')](_0x8cec8b,_0xc182('0x25'));_0x39a77e[_0xc182('0x2e')]=_[_0xc182('0x2f')](_0x2b47f7[_0xc182('0x2e')]);_0x39a77e['filters']=_[_0xc182('0x30')](_0x39a77e[_0xc182('0x2c')],_0x39a77e[_0xc182('0x2e')]);_0x4010b1[_0xc182('0x31')]=_[_0xc182('0x30')](_0x39a77e['model'],qs['fields'](_0x2b47f7[_0xc182('0x2e')]['fields']));_0x4010b1[_0xc182('0x31')]=_0x4010b1['attributes']['length']?_0x4010b1[_0xc182('0x31')]:_0x39a77e['model'];if(!_0x2b47f7[_0xc182('0x2e')][_0xc182('0x32')](_0xc182('0x33'))){_0x4010b1[_0xc182('0x1a')]=qs[_0xc182('0x1a')](_0x2b47f7[_0xc182('0x2e')][_0xc182('0x1a')]);_0x4010b1[_0xc182('0x34')]=qs[_0xc182('0x34')](_0x2b47f7[_0xc182('0x2e')][_0xc182('0x34')]);}_0x4010b1[_0xc182('0x35')]=qs['sort'](_0x2b47f7[_0xc182('0x2e')][_0xc182('0x36')]);_0x4010b1[_0xc182('0x37')]=qs['filters'](_[_0xc182('0x38')](_0x2b47f7['query'],_0x39a77e[_0xc182('0x39')]),_0x8cec8b);if(_0x2b47f7['query'][_0xc182('0x3a')]){_0x4010b1[_0xc182('0x37')]=_[_0xc182('0x3b')](_0x4010b1['where'],{'$or':_['map'](_0x8cec8b,function(_0x157177){if(_0x157177[_0xc182('0x2a')]!==_0xc182('0x3c')){var _0x42ff2a={};_0x42ff2a[_0x157177[_0xc182('0x25')]]={'$like':'%'+_0x2b47f7['query'][_0xc182('0x3a')]+'%'};return _0x42ff2a;}})});}_0x4010b1=_[_0xc182('0x3b')]({},_0x4010b1,_0x2b47f7[_0xc182('0x3d')]);var _0x72f9f9={'where':_0x4010b1['where']};return db[_0xc182('0x3e')][_0xc182('0x3f')](_0x72f9f9)[_0xc182('0x20')](function(_0x222452){_0x54a5c8['count']=_0x222452;if(_0x2b47f7[_0xc182('0x2e')][_0xc182('0x40')]){_0x4010b1[_0xc182('0x41')]=[{'all':!![]}];}return db[_0xc182('0x3e')]['findAll'](_0x4010b1);})[_0xc182('0x20')](function(_0x2b68af){_0x54a5c8['rows']=_0x2b68af;return _0x54a5c8;})[_0xc182('0x20')](respondWithFilteredResult(_0x30986c,_0x4010b1))['catch'](handleError(_0x30986c,null));};exports['show']=function(_0x4c018c,_0x2159da){var _0x428473={'raw':!![],'where':{'id':_0x4c018c[_0xc182('0x42')]['id']}},_0x9127d1={};_0x9127d1[_0xc182('0x2c')]=_['keys'](db[_0xc182('0x3e')][_0xc182('0x28')]);_0x9127d1[_0xc182('0x2e')]=_[_0xc182('0x2f')](_0x4c018c['query']);_0x9127d1[_0xc182('0x39')]=_['intersection'](_0x9127d1[_0xc182('0x2c')],_0x9127d1[_0xc182('0x2e')]);_0x428473[_0xc182('0x31')]=_[_0xc182('0x30')](_0x9127d1[_0xc182('0x2c')],qs['fields'](_0x4c018c[_0xc182('0x2e')][_0xc182('0x43')]));_0x428473[_0xc182('0x31')]=_0x428473[_0xc182('0x31')][_0xc182('0x44')]?_0x428473[_0xc182('0x31')]:_0x9127d1[_0xc182('0x2c')];if(_0x4c018c['query'][_0xc182('0x40')]){_0x428473['include']=[{'all':!![]}];}_0x428473=_[_0xc182('0x3b')]({},_0x428473,_0x4c018c['options']);return db[_0xc182('0x3e')][_0xc182('0x45')](_0x428473)[_0xc182('0x20')](handleEntityNotFound(_0x2159da,null))['then'](respondWithResult(_0x2159da,null))[_0xc182('0x46')](handleError(_0x2159da,null));};exports[_0xc182('0x47')]=function(_0x2b3633,_0x461a4d){return db[_0xc182('0x3e')][_0xc182('0x47')](_0x2b3633['body'],{})['then'](respondWithResult(_0x461a4d,0xc9))[_0xc182('0x46')](handleError(_0x461a4d,null));};exports[_0xc182('0x48')]=function(_0x45bda5,_0x4553f9){if(_0x45bda5['body']['id']){delete _0x45bda5['body']['id'];}return db[_0xc182('0x3e')][_0xc182('0x45')]({'where':{'id':_0x45bda5[_0xc182('0x42')]['id']}})[_0xc182('0x20')](handleEntityNotFound(_0x4553f9,null))[_0xc182('0x20')](saveUpdates(_0x45bda5['body'],null))['then'](respondWithResult(_0x4553f9,null))[_0xc182('0x46')](handleError(_0x4553f9,null));};exports[_0xc182('0x21')]=function(_0x3ed628,_0xa4f48d){return db[_0xc182('0x3e')][_0xc182('0x45')]({'where':{'id':_0x3ed628[_0xc182('0x42')]['id']}})[_0xc182('0x20')](handleEntityNotFound(_0xa4f48d,null))[_0xc182('0x20')](removeEntity(_0xa4f48d,null))['catch'](handleError(_0xa4f48d,null));}; \ No newline at end of file +var _0x1c6e=['send','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','then','error','stack','name'];(function(_0xf2b987,_0xfa878f){var _0x4deed4=function(_0x167c15){while(--_0x167c15){_0xf2b987['push'](_0xf2b987['shift']());}};_0x4deed4(++_0xfa878f);}(_0x1c6e,0x17e));var _0xe1c6=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x1c6e[_0x4e93a9];return _0x43013c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe1c6('0x0'));var rimraf=require(_0xe1c6('0x1'));var zipdir=require(_0xe1c6('0x2'));var jsonpatch=require(_0xe1c6('0x3'));var rp=require(_0xe1c6('0x4'));var moment=require(_0xe1c6('0x5'));var BPromise=require(_0xe1c6('0x6'));var Mustache=require(_0xe1c6('0x7'));var util=require(_0xe1c6('0x8'));var path=require('path');var sox=require(_0xe1c6('0x9'));var csv=require(_0xe1c6('0xa'));var ejs=require(_0xe1c6('0xb'));var fs=require('fs');var _=require(_0xe1c6('0xc'));var squel=require('squel');var crypto=require(_0xe1c6('0xd'));var jsforce=require(_0xe1c6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe1c6('0xf'));var authService=require(_0xe1c6('0x10'));var qs=require(_0xe1c6('0x11'));var as=require(_0xe1c6('0x12'));var hardwareService=require(_0xe1c6('0x13'));var logger=require(_0xe1c6('0x14'))(_0xe1c6('0x15'));var utils=require('../../config/utils');var config=require(_0xe1c6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7a5436,_0x2f47fe){_0x2f47fe=_0x2f47fe||0xcc;return function(_0x58b862){if(_0x58b862){return _0x7a5436[_0xe1c6('0x17')](_0x2f47fe);}return _0x7a5436['status'](_0x2f47fe)[_0xe1c6('0x18')]();};}function respondWithResult(_0x46ee47,_0x5c359f){_0x5c359f=_0x5c359f||0xc8;return function(_0x4de88e){if(_0x4de88e){return _0x46ee47[_0xe1c6('0x19')](_0x5c359f)[_0xe1c6('0x1a')](_0x4de88e);}};}function respondWithFilteredResult(_0x27b21f,_0x350969){return function(_0x14456b){if(_0x14456b){var _0x421fe3=_0x14456b[_0xe1c6('0x1b')],_0x4acf23=_0x350969[_0xe1c6('0x1c')],_0x2964c1=_0x350969[_0xe1c6('0x1c')]+_0x350969['limit'],_0x18a9ed;if(_0x2964c1>=_0x421fe3){_0x2964c1=_0x421fe3;_0x18a9ed=0xc8;}else{_0x18a9ed=0xce;}_0x27b21f['status'](_0x18a9ed);return _0x27b21f[_0xe1c6('0x1d')](_0xe1c6('0x1e'),_0x4acf23+'-'+_0x2964c1+'/'+_0x421fe3)[_0xe1c6('0x1a')](_0x14456b);}return null;};}function patchUpdates(_0x35f104){return function(_0x9210f9){try{jsonpatch[_0xe1c6('0x1f')](_0x9210f9,_0x35f104,!![]);}catch(_0x567579){return BPromise['reject'](_0x567579);}return _0x9210f9[_0xe1c6('0x20')]();};}function saveUpdates(_0x31e621,_0x47c954){return function(_0x154ccc){if(_0x154ccc){return _0x154ccc[_0xe1c6('0x21')](_0x31e621)[_0xe1c6('0x22')](function(_0x565beb){return _0x565beb;});}return null;};}function removeEntity(_0x4d7e9c,_0x9d9ece){return function(_0x278b90){if(_0x278b90){return _0x278b90['destroy']()[_0xe1c6('0x22')](function(){_0x4d7e9c['status'](0xcc)[_0xe1c6('0x18')]();});}};}function handleEntityNotFound(_0x684414,_0x3af7cf){return function(_0x388358){if(!_0x388358){_0x684414[_0xe1c6('0x17')](0x194);}return _0x388358;};}function handleError(_0x45fd47,_0x3ce0ca){_0x3ce0ca=_0x3ce0ca||0x1f4;return function(_0x57b51e){logger[_0xe1c6('0x23')](_0x57b51e[_0xe1c6('0x24')]);if(_0x57b51e['name']){delete _0x57b51e[_0xe1c6('0x25')];}_0x45fd47[_0xe1c6('0x19')](_0x3ce0ca)[_0xe1c6('0x26')](_0x57b51e);};}exports['index']=function(_0x525d1c,_0x5a0d4d){var _0x637c9f={},_0x3d8d7d={},_0x5b52c9={'count':0x0,'rows':[]};var _0x3dd734=_[_0xe1c6('0x27')](db[_0xe1c6('0x28')][_0xe1c6('0x29')],function(_0x671890){return{'name':_0x671890[_0xe1c6('0x2a')],'type':_0x671890[_0xe1c6('0x2b')][_0xe1c6('0x2c')]};});_0x3d8d7d[_0xe1c6('0x2d')]=_[_0xe1c6('0x27')](_0x3dd734,_0xe1c6('0x25'));_0x3d8d7d[_0xe1c6('0x2e')]=_[_0xe1c6('0x2f')](_0x525d1c[_0xe1c6('0x2e')]);_0x3d8d7d[_0xe1c6('0x30')]=_['intersection'](_0x3d8d7d['model'],_0x3d8d7d['query']);_0x637c9f[_0xe1c6('0x31')]=_['intersection'](_0x3d8d7d[_0xe1c6('0x2d')],qs[_0xe1c6('0x32')](_0x525d1c[_0xe1c6('0x2e')]['fields']));_0x637c9f[_0xe1c6('0x31')]=_0x637c9f[_0xe1c6('0x31')]['length']?_0x637c9f[_0xe1c6('0x31')]:_0x3d8d7d[_0xe1c6('0x2d')];if(!_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x33')](_0xe1c6('0x34'))){_0x637c9f[_0xe1c6('0x35')]=qs['limit'](_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x35')]);_0x637c9f['offset']=qs[_0xe1c6('0x1c')](_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x1c')]);}_0x637c9f[_0xe1c6('0x36')]=qs[_0xe1c6('0x37')](_0x525d1c[_0xe1c6('0x2e')]['sort']);_0x637c9f[_0xe1c6('0x38')]=qs[_0xe1c6('0x30')](_['pick'](_0x525d1c[_0xe1c6('0x2e')],_0x3d8d7d['filters']),_0x3dd734);if(_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x39')]){_0x637c9f[_0xe1c6('0x38')]=_[_0xe1c6('0x3a')](_0x637c9f[_0xe1c6('0x38')],{'$or':_[_0xe1c6('0x27')](_0x3dd734,function(_0x442f61){if(_0x442f61[_0xe1c6('0x2b')]!==_0xe1c6('0x3b')){var _0x563d0e={};_0x563d0e[_0x442f61[_0xe1c6('0x25')]]={'$like':'%'+_0x525d1c['query'][_0xe1c6('0x39')]+'%'};return _0x563d0e;}})});}_0x637c9f=_['merge']({},_0x637c9f,_0x525d1c[_0xe1c6('0x3c')]);var _0x15ca6c={'where':_0x637c9f[_0xe1c6('0x38')]};return db[_0xe1c6('0x28')][_0xe1c6('0x1b')](_0x15ca6c)[_0xe1c6('0x22')](function(_0x5d51e6){_0x5b52c9[_0xe1c6('0x1b')]=_0x5d51e6;if(_0x525d1c[_0xe1c6('0x2e')][_0xe1c6('0x3d')]){_0x637c9f['include']=[{'all':!![]}];}return db[_0xe1c6('0x28')]['findAll'](_0x637c9f);})['then'](function(_0xea3724){_0x5b52c9[_0xe1c6('0x3e')]=_0xea3724;return _0x5b52c9;})[_0xe1c6('0x22')](respondWithFilteredResult(_0x5a0d4d,_0x637c9f))[_0xe1c6('0x3f')](handleError(_0x5a0d4d,null));};exports['show']=function(_0x3fb6cd,_0x2952d9){var _0x36fc96={'raw':!![],'where':{'id':_0x3fb6cd[_0xe1c6('0x40')]['id']}},_0x80f447={};_0x80f447[_0xe1c6('0x2d')]=_[_0xe1c6('0x2f')](db[_0xe1c6('0x28')][_0xe1c6('0x29')]);_0x80f447['query']=_[_0xe1c6('0x2f')](_0x3fb6cd[_0xe1c6('0x2e')]);_0x80f447[_0xe1c6('0x30')]=_[_0xe1c6('0x41')](_0x80f447[_0xe1c6('0x2d')],_0x80f447[_0xe1c6('0x2e')]);_0x36fc96[_0xe1c6('0x31')]=_[_0xe1c6('0x41')](_0x80f447[_0xe1c6('0x2d')],qs['fields'](_0x3fb6cd[_0xe1c6('0x2e')]['fields']));_0x36fc96['attributes']=_0x36fc96['attributes']['length']?_0x36fc96[_0xe1c6('0x31')]:_0x80f447[_0xe1c6('0x2d')];if(_0x3fb6cd[_0xe1c6('0x2e')][_0xe1c6('0x3d')]){_0x36fc96[_0xe1c6('0x42')]=[{'all':!![]}];}_0x36fc96=_[_0xe1c6('0x3a')]({},_0x36fc96,_0x3fb6cd[_0xe1c6('0x3c')]);return db['CloudProvider'][_0xe1c6('0x43')](_0x36fc96)[_0xe1c6('0x22')](handleEntityNotFound(_0x2952d9,null))[_0xe1c6('0x22')](respondWithResult(_0x2952d9,null))['catch'](handleError(_0x2952d9,null));};exports[_0xe1c6('0x44')]=function(_0x5a21dd,_0x35341f){return db[_0xe1c6('0x28')]['create'](_0x5a21dd['body'],{})['then'](respondWithResult(_0x35341f,0xc9))[_0xe1c6('0x3f')](handleError(_0x35341f,null));};exports[_0xe1c6('0x21')]=function(_0x2dff8e,_0x42da18){if(_0x2dff8e[_0xe1c6('0x45')]['id']){delete _0x2dff8e[_0xe1c6('0x45')]['id'];}return db[_0xe1c6('0x28')][_0xe1c6('0x43')]({'where':{'id':_0x2dff8e[_0xe1c6('0x40')]['id']}})[_0xe1c6('0x22')](handleEntityNotFound(_0x42da18,null))[_0xe1c6('0x22')](saveUpdates(_0x2dff8e[_0xe1c6('0x45')],null))[_0xe1c6('0x22')](respondWithResult(_0x42da18,null))['catch'](handleError(_0x42da18,null));};exports['destroy']=function(_0xd10675,_0x226376){return db[_0xe1c6('0x28')][_0xe1c6('0x43')]({'where':{'id':_0xd10675[_0xe1c6('0x40')]['id']}})[_0xe1c6('0x22')](handleEntityNotFound(_0x226376,null))[_0xe1c6('0x22')](removeEntity(_0x226376,null))[_0xe1c6('0x3f')](handleError(_0x226376,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3e04036..e2e8d0f 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 _0x8e85=['cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x3834bc,_0x3ed661){var _0x277827=function(_0x47e5b6){while(--_0x47e5b6){_0x3834bc['push'](_0x3834bc['shift']());}};_0x277827(++_0x3ed661);}(_0x8e85,0x12d));var _0x58e8=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x8e85[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x58e8('0x0'));var util=require(_0x58e8('0x1'));var logger=require(_0x58e8('0x2'))('api');var moment=require(_0x58e8('0x3'));var BPromise=require(_0x58e8('0x4'));var rp=require(_0x58e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58e8('0x6'));var config=require(_0x58e8('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x58e8('0x8')]=function(_0x1e8f1f,_0x231484){return _0x1e8f1f[_0x58e8('0x9')](_0x58e8('0xa'),attributes,{'tableName':_0x58e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe072=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','cloud_providers','lodash'];(function(_0x282536,_0x3ba66a){var _0x76aa80=function(_0x1625ae){while(--_0x1625ae){_0x282536['push'](_0x282536['shift']());}};_0x76aa80(++_0x3ba66a);}(_0xe072,0x8f));var _0x2e07=function(_0x4baf83,_0x5c1800){_0x4baf83=_0x4baf83-0x0;var _0xbe4144=_0xe072[_0x4baf83];return _0xbe4144;};'use strict';var _=require(_0x2e07('0x0'));var util=require('util');var logger=require(_0x2e07('0x1'))('api');var moment=require(_0x2e07('0x2'));var BPromise=require(_0x2e07('0x3'));var rp=require(_0x2e07('0x4'));var fs=require('fs');var path=require(_0x2e07('0x5'));var rimraf=require('rimraf');var config=require(_0x2e07('0x6'));var attributes=require(_0x2e07('0x7'));module['exports']=function(_0x549c12,_0x3943c1){return _0x549c12['define']('CloudProvider',attributes,{'tableName':_0x2e07('0x8'),'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 172ddaf..a8da93f 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 _0x5f59=['request','then','info','debug','request\x20sent','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x23f0dc,_0x525f0a){var _0x55cdf2=function(_0x3d5943){while(--_0x3d5943){_0x23f0dc['push'](_0x23f0dc['shift']());}};_0x55cdf2(++_0x525f0a);}(_0x5f59,0x14c));var _0x95f5=function(_0x2403e0,_0x4c5e94){_0x2403e0=_0x2403e0-0x0;var _0x49a18c=_0x5f59[_0x2403e0];return _0x49a18c;};'use strict';var _=require('lodash');var util=require(_0x95f5('0x0'));var moment=require('moment');var BPromise=require(_0x95f5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95f5('0x2'));var db=require(_0x95f5('0x3'))['db'];var utils=require(_0x95f5('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x95f5('0x5'));var client=jayson[_0x95f5('0x6')][_0x95f5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d7672,_0x1e48d7,_0x3c5ce1){return new BPromise(function(_0x607f29,_0x4dfb19){return client[_0x95f5('0x8')](_0x5d7672,_0x3c5ce1)[_0x95f5('0x9')](function(_0x151900){logger[_0x95f5('0xa')]('CloudProvider,\x20%s,\x20%s',_0x1e48d7,'request\x20sent');logger[_0x95f5('0xb')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1e48d7,_0x95f5('0xc'),JSON[_0x95f5('0xd')](_0x151900));if(_0x151900[_0x95f5('0xe')]){if(_0x151900['error'][_0x95f5('0xf')]===0x1f4){logger[_0x95f5('0xe')](_0x95f5('0x10'),_0x1e48d7,_0x151900[_0x95f5('0xe')][_0x95f5('0x11')]);return _0x4dfb19(_0x151900[_0x95f5('0xe')][_0x95f5('0x11')]);}logger[_0x95f5('0xe')](_0x95f5('0x10'),_0x1e48d7,_0x151900[_0x95f5('0xe')][_0x95f5('0x11')]);return _0x607f29(_0x151900[_0x95f5('0xe')][_0x95f5('0x11')]);}else{logger['info'](_0x95f5('0x10'),_0x1e48d7,_0x95f5('0xc'));_0x607f29(_0x151900[_0x95f5('0x12')][_0x95f5('0x11')]);}})[_0x95f5('0x13')](function(_0x12d65a){logger[_0x95f5('0xe')](_0x95f5('0x10'),_0x1e48d7,_0x12d65a);_0x4dfb19(_0x12d65a);});});} \ No newline at end of file +var _0x9417=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','error','code','CloudProvider,\x20%s,\x20%s','message','result','bluebird','ioredis','../../mysqldb'];(function(_0x39f401,_0x8d2573){var _0x403785=function(_0x51bf3f){while(--_0x51bf3f){_0x39f401['push'](_0x39f401['shift']());}};_0x403785(++_0x8d2573);}(_0x9417,0xd5));var _0x7941=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x9417[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7941('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7941('0x1'));var db=require(_0x7941('0x2'))['db'];var utils=require(_0x7941('0x3'));var logger=require(_0x7941('0x4'))(_0x7941('0x5'));var config=require(_0x7941('0x6'));var jayson=require(_0x7941('0x7'));var client=jayson[_0x7941('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd4f5db,_0xd76eec,_0x3dcefd){return new BPromise(function(_0x53b774,_0x14c25f){return client[_0x7941('0x9')](_0xd4f5db,_0x3dcefd)['then'](function(_0x4e3c06){logger[_0x7941('0xa')]('CloudProvider,\x20%s,\x20%s',_0xd76eec,_0x7941('0xb'));logger[_0x7941('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0xd76eec,_0x7941('0xb'),JSON['stringify'](_0x4e3c06));if(_0x4e3c06[_0x7941('0xd')]){if(_0x4e3c06[_0x7941('0xd')][_0x7941('0xe')]===0x1f4){logger[_0x7941('0xd')](_0x7941('0xf'),_0xd76eec,_0x4e3c06['error'][_0x7941('0x10')]);return _0x14c25f(_0x4e3c06['error'][_0x7941('0x10')]);}logger[_0x7941('0xd')](_0x7941('0xf'),_0xd76eec,_0x4e3c06[_0x7941('0xd')][_0x7941('0x10')]);return _0x53b774(_0x4e3c06[_0x7941('0xd')]['message']);}else{logger[_0x7941('0xa')](_0x7941('0xf'),_0xd76eec,_0x7941('0xb'));_0x53b774(_0x4e3c06[_0x7941('0x11')][_0x7941('0x10')]);}})['catch'](function(_0x5bf593){logger[_0x7941('0xd')](_0x7941('0xf'),_0xd76eec,_0x5bf593);_0x14c25f(_0x5bf593);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 8643c31..21edbb6 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 _0xbcf3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','util','path','connect-timeout','express'];(function(_0x12c03c,_0x6ead70){var _0xf72aa9=function(_0x1afddb){while(--_0x1afddb){_0x12c03c['push'](_0x12c03c['shift']());}};_0xf72aa9(++_0x6ead70);}(_0xbcf3,0x1c7));var _0x3bcf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbcf3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x3bcf('0x0'));var path=require(_0x3bcf('0x1'));var timeout=require(_0x3bcf('0x2'));var express=require(_0x3bcf('0x3'));var router=express['Router']();var auth=require(_0x3bcf('0x4'));var interaction=require(_0x3bcf('0x5'));var config=require(_0x3bcf('0x6'));var controller=require(_0x3bcf('0x7'));router[_0x3bcf('0x8')]('/',auth[_0x3bcf('0x9')](),controller[_0x3bcf('0xa')]);router['get'](_0x3bcf('0xb'),auth['isAuthenticated'](),controller[_0x3bcf('0xc')]);router[_0x3bcf('0xd')]('/',auth[_0x3bcf('0x9')](),controller['create']);router[_0x3bcf('0xe')](_0x3bcf('0xb'),auth['isAuthenticated'](),controller[_0x3bcf('0xf')]);router['delete']('/:id',auth[_0x3bcf('0x9')](),controller[_0x3bcf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8ca8=['../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x330ff0,_0x146528){var _0x215472=function(_0x57447b){while(--_0x57447b){_0x330ff0['push'](_0x330ff0['shift']());}};_0x215472(++_0x146528);}(_0x8ca8,0x1da));var _0x88ca=function(_0x297612,_0x1b363a){_0x297612=_0x297612-0x0;var _0x37a75f=_0x8ca8[_0x297612];return _0x37a75f;};'use strict';var multer=require(_0x88ca('0x0'));var util=require(_0x88ca('0x1'));var path=require('path');var timeout=require(_0x88ca('0x2'));var express=require(_0x88ca('0x3'));var router=express[_0x88ca('0x4')]();var auth=require(_0x88ca('0x5'));var interaction=require(_0x88ca('0x6'));var config=require(_0x88ca('0x7'));var controller=require(_0x88ca('0x8'));router[_0x88ca('0x9')]('/',auth['isAuthenticated'](),controller[_0x88ca('0xa')]);router[_0x88ca('0x9')](_0x88ca('0xb'),auth[_0x88ca('0xc')](),controller[_0x88ca('0xd')]);router[_0x88ca('0xe')]('/',auth[_0x88ca('0xc')](),controller[_0x88ca('0xf')]);router[_0x88ca('0x10')]('/:id',auth[_0x88ca('0xc')](),controller[_0x88ca('0x11')]);router[_0x88ca('0x12')](_0x88ca('0xb'),auth[_0x88ca('0xc')](),controller['destroy']);module[_0x88ca('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 942887f..03a2be8 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 _0x5924=['name','sequelize','exports','STRING'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5924,0x101));var _0x4592=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0x5924[_0x1265fa];return _0x1fe35e;};'use strict';var Sequelize=require(_0x4592('0x0'));module[_0x4592('0x1')]={'name':{'type':Sequelize[_0x4592('0x2')],'unique':_0x4592('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4592('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x4592('0x2')]},'phone':{'type':Sequelize[_0x4592('0x2')]},'fax':{'type':Sequelize[_0x4592('0x2')]},'type':{'type':Sequelize[_0x4592('0x2')]},'street':{'type':Sequelize[_0x4592('0x2')]},'postalCode':{'type':Sequelize[_0x4592('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4592('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4592('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x4592('0x2')]},'sCity':{'type':Sequelize[_0x4592('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4592('0x2')]}}; \ No newline at end of file +var _0x7feb=['STRING','name','sequelize'];(function(_0x232bd0,_0x4883d1){var _0x2cde4c=function(_0x45b939){while(--_0x45b939){_0x232bd0['push'](_0x232bd0['shift']());}};_0x2cde4c(++_0x4883d1);}(_0x7feb,0x1b5));var _0xb7fe=function(_0x508c70,_0x1223eb){_0x508c70=_0x508c70-0x0;var _0x4d1ccd=_0x7feb[_0x508c70];return _0x4d1ccd;};'use strict';var Sequelize=require(_0xb7fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xb7fe('0x1')],'unique':_0xb7fe('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb7fe('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xb7fe('0x1')]},'phone':{'type':Sequelize[_0xb7fe('0x1')]},'fax':{'type':Sequelize[_0xb7fe('0x1')]},'type':{'type':Sequelize[_0xb7fe('0x1')]},'street':{'type':Sequelize[_0xb7fe('0x1')]},'postalCode':{'type':Sequelize[_0xb7fe('0x1')]},'city':{'type':Sequelize[_0xb7fe('0x1')]},'country':{'type':Sequelize[_0xb7fe('0x1')]},'email':{'type':Sequelize[_0xb7fe('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb7fe('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xb7fe('0x1')]},'sCountry':{'type':Sequelize[_0xb7fe('0x1')]},'description':{'type':Sequelize[_0xb7fe('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f318955..659715b 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 _0x591c=['../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Companies','UserProfileSection','find','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','ids','omit','getContacts','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x4d616a,_0x1350fc){var _0x2281c8=function(_0x1019c3){while(--_0x1019c3){_0x4d616a['push'](_0x4d616a['shift']());}};_0x2281c8(++_0x1350fc);}(_0x591c,0x1ea));var _0xc591=function(_0x5ea43a,_0x160212){_0x5ea43a=_0x5ea43a-0x0;var _0x4af94a=_0x591c[_0x5ea43a];return _0x4af94a;};'use strict';var pdf=require(_0xc591('0x0'));var emlformat=require(_0xc591('0x1'));var rimraf=require(_0xc591('0x2'));var zipdir=require(_0xc591('0x3'));var jsonpatch=require(_0xc591('0x4'));var rp=require(_0xc591('0x5'));var moment=require('moment');var BPromise=require(_0xc591('0x6'));var Mustache=require(_0xc591('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc591('0x8'));var fs=require('fs');var _=require(_0xc591('0x9'));var squel=require('squel');var crypto=require(_0xc591('0xa'));var jsforce=require(_0xc591('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc591('0xc'));var querystring=require(_0xc591('0xd'));var Papa=require('papaparse');var Redis=require(_0xc591('0xe'));var authService=require(_0xc591('0xf'));var qs=require(_0xc591('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc591('0x11'));var logger=require(_0xc591('0x12'))(_0xc591('0x13'));var utils=require(_0xc591('0x14'));var config=require(_0xc591('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8e1a,_0x2ff0d4){_0x2ff0d4=_0x2ff0d4||0xcc;return function(_0x3d363a){if(_0x3d363a){return _0x2a8e1a[_0xc591('0x16')](_0x2ff0d4);}return _0x2a8e1a[_0xc591('0x17')](_0x2ff0d4)['end']();};}function respondWithResult(_0x555a08,_0x392e9c){_0x392e9c=_0x392e9c||0xc8;return function(_0x38592f){if(_0x38592f){return _0x555a08[_0xc591('0x17')](_0x392e9c)[_0xc591('0x18')](_0x38592f);}};}function respondWithFilteredResult(_0x4fef93,_0x3b034d){return function(_0x1836aa){if(_0x1836aa){var _0x5cbeeb=_0x1836aa['count'],_0x3f64a1=_0x3b034d['offset'],_0x5bc9ab=_0x3b034d[_0xc591('0x19')]+_0x3b034d[_0xc591('0x1a')],_0x5cc4a0;if(_0x5bc9ab>=_0x5cbeeb){_0x5bc9ab=_0x5cbeeb;_0x5cc4a0=0xc8;}else{_0x5cc4a0=0xce;}_0x4fef93[_0xc591('0x17')](_0x5cc4a0);return _0x4fef93[_0xc591('0x1b')](_0xc591('0x1c'),_0x3f64a1+'-'+_0x5bc9ab+'/'+_0x5cbeeb)['json'](_0x1836aa);}return null;};}function patchUpdates(_0x1b45f5){return function(_0x37ff5e){try{jsonpatch[_0xc591('0x1d')](_0x37ff5e,_0x1b45f5,!![]);}catch(_0x29f34c){return BPromise[_0xc591('0x1e')](_0x29f34c);}return _0x37ff5e[_0xc591('0x1f')]();};}function saveUpdates(_0xea60b4,_0x8d142b){return function(_0x16b89b){if(_0x16b89b){return _0x16b89b[_0xc591('0x20')](_0xea60b4)[_0xc591('0x21')](function(_0x2b94ba){return _0x2b94ba;});}return null;};}function removeEntity(_0xc81dbf,_0x5900fd){return function(_0x3e3811){if(_0x3e3811){return _0x3e3811[_0xc591('0x22')]()['then'](function(){var _0x4e0ecd=_0x3e3811['get']({'plain':!![]});var _0x4223ae='Companies';return db['UserProfileResource'][_0xc591('0x22')]({'where':{'type':_0x4223ae,'resourceId':_0x4e0ecd['id']}})[_0xc591('0x21')](function(){return _0x3e3811;});})[_0xc591('0x21')](function(){_0xc81dbf[_0xc591('0x17')](0xcc)[_0xc591('0x23')]();});}};}function handleEntityNotFound(_0x4064a5,_0x19d25d){return function(_0x14d72b){if(!_0x14d72b){_0x4064a5[_0xc591('0x16')](0x194);}return _0x14d72b;};}function handleError(_0x3d4753,_0x3e3c16){_0x3e3c16=_0x3e3c16||0x1f4;return function(_0x5c26e5){logger[_0xc591('0x24')](_0x5c26e5[_0xc591('0x25')]);if(_0x5c26e5['name']){delete _0x5c26e5['name'];}_0x3d4753[_0xc591('0x17')](_0x3e3c16)[_0xc591('0x26')](_0x5c26e5);};}exports[_0xc591('0x27')]=function(_0x4ccc57,_0x5d5c5e){var _0x113f6a={},_0x462f22={},_0x5eff2f={'count':0x0,'rows':[]};return db[_0xc591('0x28')][_0xc591('0x29')]()[_0xc591('0x21')](function(_0x2f38b6){_0x462f22[_0xc591('0x2a')]=_['keys'](_0x2f38b6);_0x462f22['query']=_[_0xc591('0x2b')](_0x4ccc57[_0xc591('0x2c')]);_0x462f22[_0xc591('0x2d')]=_[_0xc591('0x2e')](_0x462f22['model'],_0x462f22[_0xc591('0x2c')]);_0x113f6a['attributes']=_[_0xc591('0x2e')](_0x462f22[_0xc591('0x2a')],qs[_0xc591('0x2f')](_0x4ccc57[_0xc591('0x2c')][_0xc591('0x2f')]));_0x113f6a[_0xc591('0x30')]=_0x113f6a['attributes'][_0xc591('0x31')]?_0x113f6a['attributes']:_0x462f22[_0xc591('0x2a')];if(!_0x4ccc57[_0xc591('0x2c')][_0xc591('0x32')](_0xc591('0x33'))){_0x113f6a['limit']=qs['limit'](_0x4ccc57[_0xc591('0x2c')]['limit']);_0x113f6a[_0xc591('0x19')]=qs[_0xc591('0x19')](_0x4ccc57[_0xc591('0x2c')][_0xc591('0x19')]);}_0x113f6a[_0xc591('0x34')]=qs[_0xc591('0x35')](_0x4ccc57[_0xc591('0x2c')][_0xc591('0x35')]);_0x113f6a[_0xc591('0x36')]=qs[_0xc591('0x2d')](_['pick'](_0x4ccc57['query'],_0x462f22[_0xc591('0x2d')]),_0x2f38b6);if(_0x4ccc57[_0xc591('0x2c')][_0xc591('0x37')]){_0x113f6a[_0xc591('0x36')]=_[_0xc591('0x38')](_0x113f6a[_0xc591('0x36')],{'$or':_[_0xc591('0x39')](_0x113f6a['attributes'],function(_0x5655dd){var _0x54175c={};_0x54175c[_0x5655dd]={'$like':'%'+_0x4ccc57['query']['filter']+'%'};return _0x54175c;})});}_0x113f6a=_[_0xc591('0x38')]({},_0x113f6a,_0x4ccc57[_0xc591('0x3a')]);var _0x4f74f2={'where':_0x113f6a[_0xc591('0x36')]};return db[_0xc591('0x28')][_0xc591('0x3b')](_0x4f74f2)[_0xc591('0x21')](function(_0xcc5c76){_0x5eff2f[_0xc591('0x3b')]=_0xcc5c76;if(_0x4ccc57[_0xc591('0x2c')][_0xc591('0x3c')]){_0x113f6a[_0xc591('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xc591('0x3e')](_0x113f6a);})['then'](function(_0x1df439){_0x5eff2f[_0xc591('0x3f')]=_0x1df439;return _0x5eff2f;})[_0xc591('0x21')](respondWithFilteredResult(_0x5d5c5e,_0x113f6a))['catch'](handleError(_0x5d5c5e,null));})[_0xc591('0x40')](handleError(_0x5d5c5e,null));};exports[_0xc591('0x41')]=function(_0x44a18b,_0x20c9ef){var _0x3cee80={'raw':![],'where':{'id':_0x44a18b[_0xc591('0x42')]['id']}},_0x34ebb7={};_0x34ebb7[_0xc591('0x2a')]=_['keys'](db[_0xc591('0x28')][_0xc591('0x43')]);_0x34ebb7['query']=_[_0xc591('0x2b')](_0x44a18b[_0xc591('0x2c')]);_0x34ebb7[_0xc591('0x2d')]=_[_0xc591('0x2e')](_0x34ebb7[_0xc591('0x2a')],_0x34ebb7[_0xc591('0x2c')]);_0x3cee80[_0xc591('0x30')]=_[_0xc591('0x2e')](_0x34ebb7[_0xc591('0x2a')],qs[_0xc591('0x2f')](_0x44a18b['query']['fields']));_0x3cee80[_0xc591('0x30')]=_0x3cee80[_0xc591('0x30')][_0xc591('0x31')]?_0x3cee80['attributes']:_0x34ebb7[_0xc591('0x2a')];if(_0x44a18b[_0xc591('0x2c')][_0xc591('0x3c')]){_0x3cee80['include']=[{'all':!![]}];}_0x3cee80=_[_0xc591('0x38')]({},_0x3cee80,_0x44a18b[_0xc591('0x3a')]);return db[_0xc591('0x28')]['find'](_0x3cee80)[_0xc591('0x21')](handleEntityNotFound(_0x20c9ef,null))[_0xc591('0x21')](respondWithResult(_0x20c9ef,null))['catch'](handleError(_0x20c9ef,null));};exports[_0xc591('0x44')]=function(_0x19a53b,_0x4e4875){return db[_0xc591('0x28')][_0xc591('0x44')](_0x19a53b[_0xc591('0x45')],{})[_0xc591('0x21')](function(_0x41f969){var _0x159e95=_0x19a53b[_0xc591('0x46')][_0xc591('0x47')]({'plain':!![]});if(!_0x159e95)throw new Error(_0xc591('0x48'));if(_0x159e95['role']===_0xc591('0x46')){var _0x393059=_0x41f969['get']({'plain':!![]});var _0x5314fc=_0xc591('0x49');return db[_0xc591('0x4a')][_0xc591('0x4b')]({'where':{'name':_0x5314fc,'userProfileId':_0x159e95[_0xc591('0x4c')]},'raw':!![]})['then'](function(_0x52beee){if(_0x52beee&&_0x52beee[_0xc591('0x4d')]===0x0){return db['UserProfileResource'][_0xc591('0x44')]({'name':_0x393059[_0xc591('0x4e')],'resourceId':_0x393059['id'],'type':_0x52beee[_0xc591('0x4e')],'sectionId':_0x52beee['id']},{})['then'](function(){return _0x41f969;});}else{return _0x41f969;}})[_0xc591('0x40')](function(_0x54aede){logger[_0xc591('0x24')](_0xc591('0x4f'),_0x54aede);throw _0x54aede;});}return _0x41f969;})['then'](respondWithResult(_0x4e4875,0xc9))[_0xc591('0x40')](handleError(_0x4e4875,null));};exports[_0xc591('0x20')]=function(_0x20852f,_0x267d90){if(_0x20852f[_0xc591('0x45')]['id']){delete _0x20852f[_0xc591('0x45')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x20852f['params']['id']}})[_0xc591('0x21')](handleEntityNotFound(_0x267d90,null))[_0xc591('0x21')](saveUpdates(_0x20852f[_0xc591('0x45')],null))[_0xc591('0x21')](respondWithResult(_0x267d90,null))[_0xc591('0x40')](handleError(_0x267d90,null));};exports[_0xc591('0x22')]=function(_0x3063bf,_0x477399){return db[_0xc591('0x28')]['find']({'where':{'id':_0x3063bf[_0xc591('0x42')]['id']}})[_0xc591('0x21')](handleEntityNotFound(_0x477399,null))[_0xc591('0x21')](removeEntity(_0x477399,null))[_0xc591('0x40')](handleError(_0x477399,null));};exports[_0xc591('0x29')]=function(_0x57992a,_0x3696d4){return db['CmCompany'][_0xc591('0x29')]()['then'](respondWithResult(_0x3696d4,null))[_0xc591('0x40')](handleError(_0x3696d4,null));};exports['addContacts']=function(_0x276812,_0x465162,_0x1e3742){return db[_0xc591('0x50')][_0xc591('0x4b')]({'where':{'id':_0x276812['params']['id']}})['then'](handleEntityNotFound(_0x465162,null))[_0xc591('0x21')](function(_0x4367d8){if(_0x4367d8){return _0x4367d8['addContacts'](_0x276812[_0xc591('0x45')][_0xc591('0x51')],_[_0xc591('0x52')](_0x276812['body'],[_0xc591('0x51'),'id'])||{});}})[_0xc591('0x21')](respondWithResult(_0x465162,null))[_0xc591('0x40')](handleError(_0x465162,null));};exports[_0xc591('0x53')]=function(_0x1e7f06,_0x336103,_0xfa1f3c){var _0x4c6a53={};var _0x461d35={};var _0x1a0b3c;var _0x452665;return db['CmCompany'][_0xc591('0x54')]({'where':{'id':_0x1e7f06[_0xc591('0x42')]['id']}})[_0xc591('0x21')](handleEntityNotFound(_0x336103,null))[_0xc591('0x21')](function(_0x2da9dc){if(_0x2da9dc){_0x1a0b3c=_0x2da9dc;_0x461d35[_0xc591('0x2a')]=_[_0xc591('0x2b')](db[_0xc591('0x50')][_0xc591('0x43')]);_0x461d35[_0xc591('0x2c')]=_[_0xc591('0x2b')](_0x1e7f06['query']);_0x461d35[_0xc591('0x2d')]=_[_0xc591('0x2e')](_0x461d35['model'],_0x461d35[_0xc591('0x2c')]);_0x4c6a53[_0xc591('0x30')]=_[_0xc591('0x2e')](_0x461d35['model'],qs[_0xc591('0x2f')](_0x1e7f06['query'][_0xc591('0x2f')]));_0x4c6a53['attributes']=_0x4c6a53['attributes']['length']?_0x4c6a53[_0xc591('0x30')]:_0x461d35[_0xc591('0x2a')];_0x4c6a53[_0xc591('0x34')]=qs['sort'](_0x1e7f06[_0xc591('0x2c')][_0xc591('0x35')]);_0x4c6a53[_0xc591('0x36')]=qs['filters'](_['pick'](_0x1e7f06[_0xc591('0x2c')],_0x461d35[_0xc591('0x2d')]));if(_0x1e7f06['query'][_0xc591('0x37')]){_0x4c6a53['where']=_[_0xc591('0x38')](_0x4c6a53[_0xc591('0x36')],{'$or':_[_0xc591('0x39')](_0x4c6a53['attributes'],function(_0x53da1d){var _0x396df1={};_0x396df1[_0x53da1d]={'$like':'%'+_0x1e7f06[_0xc591('0x2c')][_0xc591('0x37')]+'%'};return _0x396df1;})});}_0x4c6a53=_[_0xc591('0x38')]({},_0x4c6a53,_0x1e7f06['options']);return _0x1a0b3c[_0xc591('0x53')](_0x4c6a53);}})[_0xc591('0x21')](function(_0x1fe633){if(_0x1fe633){_0x452665=_0x1fe633[_0xc591('0x31')];if(!_0x1e7f06[_0xc591('0x2c')][_0xc591('0x32')](_0xc591('0x33'))){_0x4c6a53[_0xc591('0x1a')]=qs[_0xc591('0x1a')](_0x1e7f06['query'][_0xc591('0x1a')]);_0x4c6a53[_0xc591('0x19')]=qs['offset'](_0x1e7f06[_0xc591('0x2c')][_0xc591('0x19')]);}return _0x1a0b3c['getContacts'](_0x4c6a53);}})[_0xc591('0x21')](function(_0x7a6f6f){if(_0x7a6f6f){return _0x7a6f6f?{'count':_0x452665,'rows':_0x7a6f6f}:null;}})[_0xc591('0x21')](respondWithResult(_0x336103,null))['catch'](handleError(_0x336103,null));}; \ No newline at end of file +var _0x42dd=['../../config/environment','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','then','get','UserProfileResource','destroy','error','name','send','index','CmCompany','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','count','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addContacts','CmContact','ids','getContacts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x160814,_0x57b5c6){var _0x427a69=function(_0x3f1485){while(--_0x3f1485){_0x160814['push'](_0x160814['shift']());}};_0x427a69(++_0x57b5c6);}(_0x42dd,0x1e1));var _0xd42d=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x42dd[_0x1beef3];return _0x5af964;};'use strict';var pdf=require(_0xd42d('0x0'));var emlformat=require(_0xd42d('0x1'));var rimraf=require(_0xd42d('0x2'));var zipdir=require(_0xd42d('0x3'));var jsonpatch=require(_0xd42d('0x4'));var rp=require(_0xd42d('0x5'));var moment=require(_0xd42d('0x6'));var BPromise=require(_0xd42d('0x7'));var Mustache=require(_0xd42d('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd42d('0x9'));var csv=require(_0xd42d('0xa'));var ejs=require(_0xd42d('0xb'));var fs=require('fs');var _=require(_0xd42d('0xc'));var squel=require(_0xd42d('0xd'));var crypto=require('crypto');var jsforce=require(_0xd42d('0xe'));var deskjs=require(_0xd42d('0xf'));var toCsv=require(_0xd42d('0xa'));var querystring=require(_0xd42d('0x10'));var Papa=require(_0xd42d('0x11'));var Redis=require(_0xd42d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd42d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd42d('0x14'));var logger=require(_0xd42d('0x15'))('api');var utils=require(_0xd42d('0x16'));var config=require(_0xd42d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d968a,_0x83d1b3){_0x83d1b3=_0x83d1b3||0xcc;return function(_0x3825c9){if(_0x3825c9){return _0x3d968a[_0xd42d('0x18')](_0x83d1b3);}return _0x3d968a[_0xd42d('0x19')](_0x83d1b3)[_0xd42d('0x1a')]();};}function respondWithResult(_0xc8cac2,_0x32b910){_0x32b910=_0x32b910||0xc8;return function(_0x3b9cdb){if(_0x3b9cdb){return _0xc8cac2['status'](_0x32b910)[_0xd42d('0x1b')](_0x3b9cdb);}};}function respondWithFilteredResult(_0x4ccb36,_0x267492){return function(_0xa7f9fb){if(_0xa7f9fb){var _0xb43162=_0xa7f9fb['count'],_0x3e8837=_0x267492['offset'],_0xb4a362=_0x267492[_0xd42d('0x1c')]+_0x267492[_0xd42d('0x1d')],_0x4adfa3;if(_0xb4a362>=_0xb43162){_0xb4a362=_0xb43162;_0x4adfa3=0xc8;}else{_0x4adfa3=0xce;}_0x4ccb36['status'](_0x4adfa3);return _0x4ccb36['set'](_0xd42d('0x1e'),_0x3e8837+'-'+_0xb4a362+'/'+_0xb43162)[_0xd42d('0x1b')](_0xa7f9fb);}return null;};}function patchUpdates(_0x2d918b){return function(_0x17e3b8){try{jsonpatch[_0xd42d('0x1f')](_0x17e3b8,_0x2d918b,!![]);}catch(_0x38fc05){return BPromise[_0xd42d('0x20')](_0x38fc05);}return _0x17e3b8['save']();};}function saveUpdates(_0xe4bbfc,_0x590116){return function(_0x4b1165){if(_0x4b1165){return _0x4b1165['update'](_0xe4bbfc)[_0xd42d('0x21')](function(_0x21892c){return _0x21892c;});}return null;};}function removeEntity(_0x524b79,_0x5aa59a){return function(_0x2a9de6){if(_0x2a9de6){return _0x2a9de6['destroy']()[_0xd42d('0x21')](function(){var _0x47683f=_0x2a9de6[_0xd42d('0x22')]({'plain':!![]});var _0x1308a6='Companies';return db[_0xd42d('0x23')][_0xd42d('0x24')]({'where':{'type':_0x1308a6,'resourceId':_0x47683f['id']}})[_0xd42d('0x21')](function(){return _0x2a9de6;});})[_0xd42d('0x21')](function(){_0x524b79[_0xd42d('0x19')](0xcc)[_0xd42d('0x1a')]();});}};}function handleEntityNotFound(_0xcd54cf,_0xdee76d){return function(_0x35d1dd){if(!_0x35d1dd){_0xcd54cf[_0xd42d('0x18')](0x194);}return _0x35d1dd;};}function handleError(_0x3ec93b,_0x5bee4c){_0x5bee4c=_0x5bee4c||0x1f4;return function(_0x2d03d4){logger[_0xd42d('0x25')](_0x2d03d4['stack']);if(_0x2d03d4[_0xd42d('0x26')]){delete _0x2d03d4['name'];}_0x3ec93b[_0xd42d('0x19')](_0x5bee4c)[_0xd42d('0x27')](_0x2d03d4);};}exports[_0xd42d('0x28')]=function(_0x110179,_0x1a6648){var _0x668bae={},_0x5516e5={},_0x1bd53a={'count':0x0,'rows':[]};return db[_0xd42d('0x29')]['describe']()[_0xd42d('0x21')](function(_0x27b1aa){_0x5516e5[_0xd42d('0x2a')]=_[_0xd42d('0x2b')](_0x27b1aa);_0x5516e5['query']=_['keys'](_0x110179['query']);_0x5516e5[_0xd42d('0x2c')]=_[_0xd42d('0x2d')](_0x5516e5['model'],_0x5516e5[_0xd42d('0x2e')]);_0x668bae[_0xd42d('0x2f')]=_[_0xd42d('0x2d')](_0x5516e5[_0xd42d('0x2a')],qs[_0xd42d('0x30')](_0x110179['query'][_0xd42d('0x30')]));_0x668bae[_0xd42d('0x2f')]=_0x668bae[_0xd42d('0x2f')][_0xd42d('0x31')]?_0x668bae[_0xd42d('0x2f')]:_0x5516e5['model'];if(!_0x110179[_0xd42d('0x2e')][_0xd42d('0x32')](_0xd42d('0x33'))){_0x668bae[_0xd42d('0x1d')]=qs[_0xd42d('0x1d')](_0x110179[_0xd42d('0x2e')][_0xd42d('0x1d')]);_0x668bae['offset']=qs[_0xd42d('0x1c')](_0x110179[_0xd42d('0x2e')]['offset']);}_0x668bae[_0xd42d('0x34')]=qs[_0xd42d('0x35')](_0x110179[_0xd42d('0x2e')][_0xd42d('0x35')]);_0x668bae['where']=qs[_0xd42d('0x2c')](_[_0xd42d('0x36')](_0x110179[_0xd42d('0x2e')],_0x5516e5[_0xd42d('0x2c')]),_0x27b1aa);if(_0x110179[_0xd42d('0x2e')][_0xd42d('0x37')]){_0x668bae[_0xd42d('0x38')]=_[_0xd42d('0x39')](_0x668bae[_0xd42d('0x38')],{'$or':_[_0xd42d('0x3a')](_0x668bae[_0xd42d('0x2f')],function(_0x25b05f){var _0x21108e={};_0x21108e[_0x25b05f]={'$like':'%'+_0x110179[_0xd42d('0x2e')][_0xd42d('0x37')]+'%'};return _0x21108e;})});}_0x668bae=_[_0xd42d('0x39')]({},_0x668bae,_0x110179[_0xd42d('0x3b')]);var _0x53145f={'where':_0x668bae[_0xd42d('0x38')]};return db[_0xd42d('0x29')][_0xd42d('0x3c')](_0x53145f)[_0xd42d('0x21')](function(_0x189c98){_0x1bd53a[_0xd42d('0x3c')]=_0x189c98;if(_0x110179[_0xd42d('0x2e')][_0xd42d('0x3d')]){_0x668bae['include']=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x668bae);})['then'](function(_0x287c24){_0x1bd53a[_0xd42d('0x3e')]=_0x287c24;return _0x1bd53a;})[_0xd42d('0x21')](respondWithFilteredResult(_0x1a6648,_0x668bae))[_0xd42d('0x3f')](handleError(_0x1a6648,null));})[_0xd42d('0x3f')](handleError(_0x1a6648,null));};exports[_0xd42d('0x40')]=function(_0x16db39,_0x113500){var _0x260757={'raw':![],'where':{'id':_0x16db39[_0xd42d('0x41')]['id']}},_0x194bcd={};_0x194bcd[_0xd42d('0x2a')]=_[_0xd42d('0x2b')](db['CmCompany'][_0xd42d('0x42')]);_0x194bcd[_0xd42d('0x2e')]=_[_0xd42d('0x2b')](_0x16db39['query']);_0x194bcd[_0xd42d('0x2c')]=_[_0xd42d('0x2d')](_0x194bcd[_0xd42d('0x2a')],_0x194bcd[_0xd42d('0x2e')]);_0x260757[_0xd42d('0x2f')]=_[_0xd42d('0x2d')](_0x194bcd[_0xd42d('0x2a')],qs[_0xd42d('0x30')](_0x16db39['query'][_0xd42d('0x30')]));_0x260757['attributes']=_0x260757[_0xd42d('0x2f')][_0xd42d('0x31')]?_0x260757[_0xd42d('0x2f')]:_0x194bcd[_0xd42d('0x2a')];if(_0x16db39[_0xd42d('0x2e')][_0xd42d('0x3d')]){_0x260757[_0xd42d('0x43')]=[{'all':!![]}];}_0x260757=_[_0xd42d('0x39')]({},_0x260757,_0x16db39[_0xd42d('0x3b')]);return db['CmCompany'][_0xd42d('0x44')](_0x260757)[_0xd42d('0x21')](handleEntityNotFound(_0x113500,null))['then'](respondWithResult(_0x113500,null))[_0xd42d('0x3f')](handleError(_0x113500,null));};exports[_0xd42d('0x45')]=function(_0x39e02e,_0x45169b){return db[_0xd42d('0x29')]['create'](_0x39e02e[_0xd42d('0x46')],{})[_0xd42d('0x21')](function(_0x417a63){var _0x209d01=_0x39e02e[_0xd42d('0x47')][_0xd42d('0x22')]({'plain':!![]});if(!_0x209d01)throw new Error(_0xd42d('0x48'));if(_0x209d01[_0xd42d('0x49')]==='user'){var _0x108cec=_0x417a63[_0xd42d('0x22')]({'plain':!![]});var _0x68b809=_0xd42d('0x4a');return db[_0xd42d('0x4b')][_0xd42d('0x44')]({'where':{'name':_0x68b809,'userProfileId':_0x209d01[_0xd42d('0x4c')]},'raw':!![]})[_0xd42d('0x21')](function(_0x3de4a7){if(_0x3de4a7&&_0x3de4a7['autoAssociation']===0x0){return db[_0xd42d('0x23')][_0xd42d('0x45')]({'name':_0x108cec[_0xd42d('0x26')],'resourceId':_0x108cec['id'],'type':_0x3de4a7[_0xd42d('0x26')],'sectionId':_0x3de4a7['id']},{})['then'](function(){return _0x417a63;});}else{return _0x417a63;}})[_0xd42d('0x3f')](function(_0x2269d2){logger['error'](_0xd42d('0x4d'),_0x2269d2);throw _0x2269d2;});}return _0x417a63;})[_0xd42d('0x21')](respondWithResult(_0x45169b,0xc9))['catch'](handleError(_0x45169b,null));};exports[_0xd42d('0x4e')]=function(_0x43c9df,_0x32a9ba){if(_0x43c9df[_0xd42d('0x46')]['id']){delete _0x43c9df[_0xd42d('0x46')]['id'];}return db[_0xd42d('0x29')]['find']({'where':{'id':_0x43c9df[_0xd42d('0x41')]['id']}})[_0xd42d('0x21')](handleEntityNotFound(_0x32a9ba,null))[_0xd42d('0x21')](saveUpdates(_0x43c9df[_0xd42d('0x46')],null))[_0xd42d('0x21')](respondWithResult(_0x32a9ba,null))[_0xd42d('0x3f')](handleError(_0x32a9ba,null));};exports[_0xd42d('0x24')]=function(_0x50a7c7,_0x15a3cc){return db[_0xd42d('0x29')]['find']({'where':{'id':_0x50a7c7['params']['id']}})[_0xd42d('0x21')](handleEntityNotFound(_0x15a3cc,null))[_0xd42d('0x21')](removeEntity(_0x15a3cc,null))[_0xd42d('0x3f')](handleError(_0x15a3cc,null));};exports['describe']=function(_0x474b62,_0x261863){return db[_0xd42d('0x29')][_0xd42d('0x4f')]()[_0xd42d('0x21')](respondWithResult(_0x261863,null))['catch'](handleError(_0x261863,null));};exports[_0xd42d('0x50')]=function(_0x3cb927,_0x39dd88,_0x213eca){return db[_0xd42d('0x51')]['find']({'where':{'id':_0x3cb927[_0xd42d('0x41')]['id']}})[_0xd42d('0x21')](handleEntityNotFound(_0x39dd88,null))[_0xd42d('0x21')](function(_0x16869a){if(_0x16869a){return _0x16869a[_0xd42d('0x50')](_0x3cb927[_0xd42d('0x46')]['ids'],_['omit'](_0x3cb927['body'],[_0xd42d('0x52'),'id'])||{});}})['then'](respondWithResult(_0x39dd88,null))[_0xd42d('0x3f')](handleError(_0x39dd88,null));};exports[_0xd42d('0x53')]=function(_0x16c84,_0x2e2f89,_0x3219fd){var _0x3e61eb={};var _0x54fb99={};var _0x34abcd;var _0x157089;return db[_0xd42d('0x29')]['findOne']({'where':{'id':_0x16c84[_0xd42d('0x41')]['id']}})[_0xd42d('0x21')](handleEntityNotFound(_0x2e2f89,null))[_0xd42d('0x21')](function(_0x404306){if(_0x404306){_0x34abcd=_0x404306;_0x54fb99[_0xd42d('0x2a')]=_[_0xd42d('0x2b')](db[_0xd42d('0x51')][_0xd42d('0x42')]);_0x54fb99['query']=_[_0xd42d('0x2b')](_0x16c84['query']);_0x54fb99[_0xd42d('0x2c')]=_[_0xd42d('0x2d')](_0x54fb99[_0xd42d('0x2a')],_0x54fb99[_0xd42d('0x2e')]);_0x3e61eb[_0xd42d('0x2f')]=_[_0xd42d('0x2d')](_0x54fb99[_0xd42d('0x2a')],qs[_0xd42d('0x30')](_0x16c84[_0xd42d('0x2e')]['fields']));_0x3e61eb[_0xd42d('0x2f')]=_0x3e61eb[_0xd42d('0x2f')]['length']?_0x3e61eb[_0xd42d('0x2f')]:_0x54fb99[_0xd42d('0x2a')];_0x3e61eb[_0xd42d('0x34')]=qs[_0xd42d('0x35')](_0x16c84[_0xd42d('0x2e')]['sort']);_0x3e61eb['where']=qs[_0xd42d('0x2c')](_['pick'](_0x16c84[_0xd42d('0x2e')],_0x54fb99['filters']));if(_0x16c84['query'][_0xd42d('0x37')]){_0x3e61eb[_0xd42d('0x38')]=_[_0xd42d('0x39')](_0x3e61eb[_0xd42d('0x38')],{'$or':_['map'](_0x3e61eb[_0xd42d('0x2f')],function(_0x5cb829){var _0x48a842={};_0x48a842[_0x5cb829]={'$like':'%'+_0x16c84[_0xd42d('0x2e')][_0xd42d('0x37')]+'%'};return _0x48a842;})});}_0x3e61eb=_[_0xd42d('0x39')]({},_0x3e61eb,_0x16c84[_0xd42d('0x3b')]);return _0x34abcd['getContacts'](_0x3e61eb);}})['then'](function(_0x27e220){if(_0x27e220){_0x157089=_0x27e220[_0xd42d('0x31')];if(!_0x16c84[_0xd42d('0x2e')][_0xd42d('0x32')](_0xd42d('0x33'))){_0x3e61eb[_0xd42d('0x1d')]=qs[_0xd42d('0x1d')](_0x16c84[_0xd42d('0x2e')][_0xd42d('0x1d')]);_0x3e61eb[_0xd42d('0x1c')]=qs[_0xd42d('0x1c')](_0x16c84['query'][_0xd42d('0x1c')]);}return _0x34abcd[_0xd42d('0x53')](_0x3e61eb);}})[_0xd42d('0x21')](function(_0xc39e4c){if(_0xc39e4c){return _0xc39e4c?{'count':_0x157089,'rows':_0xc39e4c}:null;}})[_0xd42d('0x21')](respondWithResult(_0x2e2f89,null))['catch'](handleError(_0x2e2f89,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 86275d7..2d9ea6e 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 _0xfe74=['request-promise','path','rimraf','../../config/environment','exports','CmCompany','cm_companies','lodash','../../config/logger'];(function(_0x2bfb87,_0xa5619d){var _0x2a1c65=function(_0xff37c7){while(--_0xff37c7){_0x2bfb87['push'](_0x2bfb87['shift']());}};_0x2a1c65(++_0xa5619d);}(_0xfe74,0xe8));var _0x4fe7=function(_0x5ef592,_0x530678){_0x5ef592=_0x5ef592-0x0;var _0x1d3c77=_0xfe74[_0x5ef592];return _0x1d3c77;};'use strict';var _=require(_0x4fe7('0x0'));var util=require('util');var logger=require(_0x4fe7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4fe7('0x2'));var fs=require('fs');var path=require(_0x4fe7('0x3'));var rimraf=require(_0x4fe7('0x4'));var config=require(_0x4fe7('0x5'));var attributes=require('./cmCompany.attributes');module[_0x4fe7('0x6')]=function(_0x3e3c96,_0x371d14){return _0x3e3c96['define'](_0x4fe7('0x7'),attributes,{'tableName':_0x4fe7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4323=['exports','define','CmCompany','cm_companies','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x54f3e8,_0x3ed493){var _0x267b37=function(_0x58247e){while(--_0x58247e){_0x54f3e8['push'](_0x54f3e8['shift']());}};_0x267b37(++_0x3ed493);}(_0x4323,0x100));var _0x3432=function(_0x59d866,_0x55657c){_0x59d866=_0x59d866-0x0;var _0x43b7cc=_0x4323[_0x59d866];return _0x43b7cc;};'use strict';var _=require(_0x3432('0x0'));var util=require('util');var logger=require(_0x3432('0x1'))(_0x3432('0x2'));var moment=require(_0x3432('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3432('0x4'));var rimraf=require(_0x3432('0x5'));var config=require(_0x3432('0x6'));var attributes=require(_0x3432('0x7'));module[_0x3432('0x8')]=function(_0x113707,_0x272b75){return _0x113707[_0x3432('0x9')](_0x3432('0xa'),attributes,{'tableName':_0x3432('0xb'),'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 8c2ee82..a80e199 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 _0x8d79=['request','then','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x8d79,0x12a));var _0x98d7=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8d79[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x98d7('0x0'));var util=require(_0x98d7('0x1'));var moment=require('moment');var BPromise=require(_0x98d7('0x2'));var rs=require(_0x98d7('0x3'));var fs=require('fs');var Redis=require(_0x98d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98d7('0x5'));var logger=require('../../config/logger')(_0x98d7('0x6'));var config=require(_0x98d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x98d7('0x8')][_0x98d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53f4a3,_0xb61a64,_0x5b5031){return new BPromise(function(_0x56f97a,_0x1b18a5){return client[_0x98d7('0xa')](_0x53f4a3,_0x5b5031)[_0x98d7('0xb')](function(_0x34cda7){logger['info']('CmCompany,\x20%s,\x20%s',_0xb61a64,_0x98d7('0xc'));logger['debug'](_0x98d7('0xd'),_0xb61a64,'request\x20sent',JSON[_0x98d7('0xe')](_0x34cda7));if(_0x34cda7[_0x98d7('0xf')]){if(_0x34cda7[_0x98d7('0xf')][_0x98d7('0x10')]===0x1f4){logger[_0x98d7('0xf')](_0x98d7('0x11'),_0xb61a64,_0x34cda7[_0x98d7('0xf')][_0x98d7('0x12')]);return _0x1b18a5(_0x34cda7['error'][_0x98d7('0x12')]);}logger['error'](_0x98d7('0x11'),_0xb61a64,_0x34cda7['error'][_0x98d7('0x12')]);return _0x56f97a(_0x34cda7['error'][_0x98d7('0x12')]);}else{logger[_0x98d7('0x13')](_0x98d7('0x11'),_0xb61a64,'request\x20sent');_0x56f97a(_0x34cda7[_0x98d7('0x14')]['message']);}})[_0x98d7('0x15')](function(_0x115156){logger['error'](_0x98d7('0x11'),_0xb61a64,_0x115156);_0x1b18a5(_0x115156);});});} \ No newline at end of file +var _0x4c6f=['info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then'];(function(_0x485c1b,_0x59432a){var _0x4f82b2=function(_0x1e3ae3){while(--_0x1e3ae3){_0x485c1b['push'](_0x485c1b['shift']());}};_0x4f82b2(++_0x59432a);}(_0x4c6f,0x106));var _0xf4c6=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x4c6f[_0x20a68a];return _0x56c5d4;};'use strict';var _=require(_0xf4c6('0x0'));var util=require(_0xf4c6('0x1'));var moment=require(_0xf4c6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4c6('0x3'));var fs=require('fs');var Redis=require(_0xf4c6('0x4'));var db=require(_0xf4c6('0x5'))['db'];var utils=require(_0xf4c6('0x6'));var logger=require('../../config/logger')(_0xf4c6('0x7'));var config=require(_0xf4c6('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31722d,_0x43c8d9,_0x407115){return new BPromise(function(_0x4dfb7f,_0x5b70e5){return client['request'](_0x31722d,_0x407115)[_0xf4c6('0x9')](function(_0x85f432){logger[_0xf4c6('0xa')](_0xf4c6('0xb'),_0x43c8d9,'request\x20sent');logger['debug'](_0xf4c6('0xc'),_0x43c8d9,_0xf4c6('0xd'),JSON[_0xf4c6('0xe')](_0x85f432));if(_0x85f432[_0xf4c6('0xf')]){if(_0x85f432[_0xf4c6('0xf')]['code']===0x1f4){logger[_0xf4c6('0xf')](_0xf4c6('0xb'),_0x43c8d9,_0x85f432[_0xf4c6('0xf')]['message']);return _0x5b70e5(_0x85f432['error'][_0xf4c6('0x10')]);}logger['error'](_0xf4c6('0xb'),_0x43c8d9,_0x85f432[_0xf4c6('0xf')]['message']);return _0x4dfb7f(_0x85f432[_0xf4c6('0xf')][_0xf4c6('0x10')]);}else{logger['info'](_0xf4c6('0xb'),_0x43c8d9,_0xf4c6('0xd'));_0x4dfb7f(_0x85f432['result']['message']);}})['catch'](function(_0x2f7581){logger[_0xf4c6('0xf')](_0xf4c6('0xb'),_0x43c8d9,_0x2f7581);_0x5b70e5(_0x2f7581);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 36c2b1a..3d474ec 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 _0x55ca=['multer','util','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','getContacts','post','create','/:id/contacts','addContacts','put','update','destroy','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x55ca,0x126));var _0xa55c=function(_0x262323,_0x4a81f1){_0x262323=_0x262323-0x0;var _0xa963c3=_0x55ca[_0x262323];return _0xa963c3;};'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',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/contacts',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xd')](_0xa55c('0xf'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router[_0xa55c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);module[_0xa55c('0x14')]=router; \ No newline at end of file +var _0x3e74=['isAuthenticated','index','describe','/:id','getContacts','post','create','/:id/contacts','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./cmCompany.controller','get'];(function(_0x165a48,_0x44bc9d){var _0x6f6735=function(_0x510ec3){while(--_0x510ec3){_0x165a48['push'](_0x165a48['shift']());}};_0x6f6735(++_0x44bc9d);}(_0x3e74,0x175));var _0x43e7=function(_0x1ca0b7,_0x278dd5){_0x1ca0b7=_0x1ca0b7-0x0;var _0x38ded1=_0x3e74[_0x1ca0b7];return _0x38ded1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['post'](_0x43e7('0xe'),auth[_0x43e7('0x7')](),controller['addContacts']);router[_0x43e7('0xf')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index cda0504..a16a8c4 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 _0x35fc=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','STRING'];(function(_0x4bdbfe,_0x37655c){var _0x384eba=function(_0x5f15bf){while(--_0x5f15bf){_0x4bdbfe['push'](_0x4bdbfe['shift']());}};_0x384eba(++_0x37655c);}(_0x35fc,0xde));var _0xc35f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x35fc[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xc35f('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0xc35f('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc35f('0x1')]},'street':{'type':Sequelize[_0xc35f('0x1')]},'postalCode':{'type':Sequelize[_0xc35f('0x1')]},'city':{'type':Sequelize[_0xc35f('0x1')]},'country':{'type':Sequelize[_0xc35f('0x1')]},'dateOfBirth':{'type':Sequelize[_0xc35f('0x1')]},'description':{'type':Sequelize[_0xc35f('0x2')]},'phone':{'type':Sequelize[_0xc35f('0x1')]},'mobile':{'type':Sequelize[_0xc35f('0x1')]},'fax':{'type':Sequelize[_0xc35f('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xc35f('0x1')]},'facebook':{'type':Sequelize[_0xc35f('0x1')]},'fb_data':{'type':Sequelize[_0xc35f('0x1')]},'twitter':{'type':Sequelize[_0xc35f('0x1')]},'skype':{'type':Sequelize[_0xc35f('0x1')]},'teams':{'type':Sequelize[_0xc35f('0x1')]},'viber':{'type':Sequelize[_0xc35f('0x1')]},'line':{'type':Sequelize[_0xc35f('0x1')]},'wechat':{'type':Sequelize[_0xc35f('0x1')]},'telegram':{'type':Sequelize[_0xc35f('0x1')]},'UserId':{'type':Sequelize[_0xc35f('0x3')]},'priority':{'type':Sequelize[_0xc35f('0x3')](0x2)[_0xc35f('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc35f('0x5')],'defaultValue':Sequelize[_0xc35f('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7894=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x5cd441,_0x33fcef){var _0x28573c=function(_0x1d10b6){while(--_0x1d10b6){_0x5cd441['push'](_0x5cd441['shift']());}};_0x28573c(++_0x33fcef);}(_0x7894,0x170));var _0x4789=function(_0x5c1a88,_0x21488c){_0x5c1a88=_0x5c1a88-0x0;var _0x32a777=_0x7894[_0x5c1a88];return _0x32a777;};'use strict';var _=require(_0x4789('0x0'));var Sequelize=require(_0x4789('0x1'));module[_0x4789('0x2')]={'firstName':{'type':Sequelize[_0x4789('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x4789('0x3')]},'street':{'type':Sequelize[_0x4789('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x4789('0x3')]},'country':{'type':Sequelize[_0x4789('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4789('0x4')]},'phone':{'type':Sequelize[_0x4789('0x3')]},'mobile':{'type':Sequelize[_0x4789('0x3')]},'fax':{'type':Sequelize[_0x4789('0x3')]},'email':{'type':Sequelize[_0x4789('0x3')]},'url':{'type':Sequelize[_0x4789('0x3')]},'facebook':{'type':Sequelize[_0x4789('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x4789('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x4789('0x3')]},'line':{'type':Sequelize[_0x4789('0x3')]},'wechat':{'type':Sequelize[_0x4789('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x4789('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4789('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4789('0x7')],'defaultValue':Sequelize[_0x4789('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 92cced1..949a4bc 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 _0xcead=['custom','values','merge','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','ListId','findOrCreate','spread','show','$and','omit','format','cf_%d','pickBy','table','toParam','phone','getTags','rawAttributes','filter','options','setTags','ids','getHoppers','nolimit','includeAll','include','getHopperHistories','CmHopperHistory','ContactId','rows','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','chmodSync','child_process','fork','CompanyId','json','File\x20uploaded\x20correctly!','send','upload','file','parse','meta','import','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./cmContact.socket','register','sendStatus','status','end','limit','Content-Range','apply','reject','save','update','then','error','stack','describe','length','keys','startsWith','cf_','push','CmCustomField','findOne','all','fieldType','type','query','intersection','model','attributes','fields','offset','order','sort','where','pick','filters','name','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','Tag','value','split','map','forEach','union','User','uc.UserId\x20=\x20?','dateOfBirth','castTo','DATE','buildExpression','text','hasOwnProperty','isNil','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','clone','DESC','having','t.id\x20IN\x20?','resolve','user','getLists','isEmpty','c.ListId\x20IS\x20NULL','sequelize','toString','count','keyBy','CmContact','c.lastName','c.mobile','c.ListId','TagIds','Tags','catch','destroy','find','params','tags','columnName','displayName','findAll','alias'];(function(_0x2e8a82,_0x14c3e6){var _0x90ccd9=function(_0x73837f){while(--_0x73837f){_0x2e8a82['push'](_0x2e8a82['shift']());}};_0x90ccd9(++_0x14c3e6);}(_0xcead,0x145));var _0xdcea=function(_0x135968,_0x25fc03){_0x135968=_0x135968-0x0;var _0x72352f=_0xcead[_0x135968];return _0x72352f;};'use strict';var pdf=require(_0xdcea('0x0'));var emlformat=require(_0xdcea('0x1'));var rimraf=require(_0xdcea('0x2'));var zipdir=require(_0xdcea('0x3'));var jsonpatch=require(_0xdcea('0x4'));var rp=require(_0xdcea('0x5'));var moment=require(_0xdcea('0x6'));var BPromise=require(_0xdcea('0x7'));var Mustache=require(_0xdcea('0x8'));var util=require(_0xdcea('0x9'));var path=require(_0xdcea('0xa'));var sox=require(_0xdcea('0xb'));var csv=require(_0xdcea('0xc'));var ejs=require(_0xdcea('0xd'));var fs=require('fs');var _=require(_0xdcea('0xe'));var squel=require(_0xdcea('0xf'));var crypto=require(_0xdcea('0x10'));var jsforce=require(_0xdcea('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xdcea('0xc'));var querystring=require(_0xdcea('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdcea('0x13'));var qs=require(_0xdcea('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdcea('0x15'));var logger=require(_0xdcea('0x16'))(_0xdcea('0x17'));var utils=require(_0xdcea('0x18'));var config=require(_0xdcea('0x19'));var db=require('../../mysqldb')['db'];config[_0xdcea('0x1a')]=_[_0xdcea('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdcea('0x1a')]));require(_0xdcea('0x1c'))[_0xdcea('0x1d')](socket);function respondWithStatusCode(_0x118cbc,_0x3515ee){_0x3515ee=_0x3515ee||0xcc;return function(_0x1febb8){if(_0x1febb8){return _0x118cbc[_0xdcea('0x1e')](_0x3515ee);}return _0x118cbc[_0xdcea('0x1f')](_0x3515ee)[_0xdcea('0x20')]();};}function respondWithResult(_0x48a926,_0x50213b){_0x50213b=_0x50213b||0xc8;return function(_0xf14ce9){if(_0xf14ce9){return _0x48a926[_0xdcea('0x1f')](_0x50213b)['json'](_0xf14ce9);}};}function respondWithFilteredResult(_0x2844ef,_0x1bd59f){return function(_0x5d8c7f){if(_0x5d8c7f){var _0x8792b5=_0x5d8c7f['count'],_0x5ed507=_0x1bd59f['offset'],_0x420866=_0x1bd59f['offset']+_0x1bd59f[_0xdcea('0x21')],_0x335a36;if(_0x420866>=_0x8792b5){_0x420866=_0x8792b5;_0x335a36=0xc8;}else{_0x335a36=0xce;}_0x2844ef['status'](_0x335a36);return _0x2844ef['set'](_0xdcea('0x22'),_0x5ed507+'-'+_0x420866+'/'+_0x8792b5)['json'](_0x5d8c7f);}return null;};}function patchUpdates(_0x4a729a){return function(_0xd40d23){try{jsonpatch[_0xdcea('0x23')](_0xd40d23,_0x4a729a,!![]);}catch(_0x20f3c4){return BPromise[_0xdcea('0x24')](_0x20f3c4);}return _0xd40d23[_0xdcea('0x25')]();};}function saveUpdates(_0x54bc1c,_0x129930){return function(_0x22ee58){if(_0x22ee58){return _0x22ee58[_0xdcea('0x26')](_0x54bc1c)['then'](function(_0x1487c3){return _0x1487c3;});}return null;};}function removeEntity(_0x2c8bb9,_0x536ece){return function(_0x52b4cb){if(_0x52b4cb){return _0x52b4cb['destroy']()[_0xdcea('0x27')](function(){_0x2c8bb9[_0xdcea('0x1f')](0xcc)[_0xdcea('0x20')]();});}};}function handleEntityNotFound(_0x463fde,_0x5002ec){return function(_0x1a7c06){if(!_0x1a7c06){_0x463fde['sendStatus'](0x194);}return _0x1a7c06;};}function handleError(_0x3ea4b3,_0x54153d){_0x54153d=_0x54153d||0x1f4;return function(_0x50bb19){logger[_0xdcea('0x28')](_0x50bb19[_0xdcea('0x29')]);if(_0x50bb19['name']){delete _0x50bb19['name'];}_0x3ea4b3[_0xdcea('0x1f')](_0x54153d)['send'](_0x50bb19);};}exports['index']=function(_0x16775e,_0x5dc6ac){var _0x4b97ba={},_0x1711f7={},_0x4aadf2={'count':0x0,'rows':[]};return db['CmContact'][_0xdcea('0x2a')]()['then'](function(_0x5b568f){var _0x2aa5dc=[];for(var _0x2cbe4f=0x0;_0x2cbe4f0x1){_0x16568e['or'](_0xdcea('0x66'),qs['getFullTextValue'](_0x45b670),null);}else{if(qs[_0xdcea('0x67')](_0x45b670)){_0x16568e['or'](_0xdcea('0x68'),_0x45b670+'%');_0x16568e['or']('c.phone\x20LIKE\x20?',_0x45b670+'%');_0x16568e['or'](_0xdcea('0x69'),_0x45b670+'%');_0x16568e['or'](_0xdcea('0x6a'),_0x45b670+'%');}else if(qs[_0xdcea('0x6b')](_0x45b670)){_0x16568e['or'](_0xdcea('0x6c'),_0x45b670+'%');}else{_0x16568e['or'](_0xdcea('0x6d'),'%'+_0x45b670+'%');_0x16568e['or'](_0xdcea('0x6e'),'%'+_0x45b670+'%');_0x16568e['or'](_0xdcea('0x6c'),'%'+_0x45b670+'%');}}}}_0x4d1d20['where'](_0x16568e);_0x4d1d20[_0xdcea('0x6f')]('c.id');var _0x43b8e8={'type':db[_0xdcea('0x70')]['QueryTypes']['SELECT'],'raw':!![]};var _0x23ab20=_0x4d1d20[_0xdcea('0x71')]()['field']('c.id');if(_0x4b97ba[_0xdcea('0x3b')]){_0x4b97ba[_0xdcea('0x3b')][_0xdcea('0x53')](function(_0x1b091c){_0x4d1d20[_0xdcea('0x3b')]('c.'+_0x1b091c[0x0],_0x1b091c[0x1]===_0xdcea('0x72')?![]:!![]);});}if(!_['isEmpty'](_0x580dba)){_0x4d1d20[_0xdcea('0x73')](_0xa3d9bd);_0x23ab20[_0xdcea('0x3d')](_0xdcea('0x74'),_0x580dba);}BPromise[_0xdcea('0x75')]()['then'](function(){if(_0x57e45f&&!_['some'](_0x57e45f['conditions'],[_0xdcea('0x41'),'User'])){return _0x16775e[_0xdcea('0x76')][_0xdcea('0x77')]({'attributes':['id'],'raw':!![]})[_0xdcea('0x27')](function(_0x212a93){if(_[_0xdcea('0x78')](_0x212a93)){_0x23ab20[_0xdcea('0x3d')](_0xdcea('0x79'));_0x4d1d20['where'](_0xdcea('0x79'));}else{_0x23ab20[_0xdcea('0x3d')](_0xdcea('0x5f'),_['map'](_0x212a93,'id'));_0x4d1d20[_0xdcea('0x3d')](_0xdcea('0x5f'),_[_0xdcea('0x52')](_0x212a93,'id'));}});}else{return;}})[_0xdcea('0x27')](function(){db[_0xdcea('0x7a')][_0xdcea('0x35')](_0x23ab20[_0xdcea('0x7b')](),_0x43b8e8)[_0xdcea('0x27')](function(_0x206a61){_0x4aadf2[_0xdcea('0x7c')]=_0x206a61['length'];if(_0x4aadf2[_0xdcea('0x7c')]===0x0)return[];return db[_0xdcea('0x7a')][_0xdcea('0x35')](_0x57f382[_0xdcea('0x7b')](),_0x43b8e8);})[_0xdcea('0x27')](function(_0x5f129b){_0x55f092=_[_0xdcea('0x7d')](_0x5f129b,'id');_0x43b8e8=_['merge'](_0x43b8e8,{'model':db[_0xdcea('0x7e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16775e[_0xdcea('0x35')][_0xdcea('0x39')]){_0x4b97ba[_0xdcea('0x38')]['forEach'](function(_0x4cd487){_0x4d1d20['field']('c.'+_0x4cd487);});}else{_0x4d1d20[_0xdcea('0x41')]('c.id');_0x4d1d20['field']('c.firstName');_0x4d1d20[_0xdcea('0x41')](_0xdcea('0x7f'));_0x4d1d20[_0xdcea('0x41')]('c.phone');_0x4d1d20[_0xdcea('0x41')](_0xdcea('0x80'));_0x4d1d20[_0xdcea('0x41')]('c.fax');_0x4d1d20[_0xdcea('0x41')]('c.email');_0x4d1d20['field'](_0xdcea('0x81'));_0x4d1d20[_0xdcea('0x41')]('c.deletedAt');_0x4d1d20[_0xdcea('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xdcea('0x82'));}if(_0x4b97ba['limit'])_0x4d1d20['limit'](_0x4b97ba[_0xdcea('0x21')]);if(_0x4b97ba[_0xdcea('0x3a')])_0x4d1d20[_0xdcea('0x3a')](_0x4b97ba[_0xdcea('0x3a')]);return db[_0xdcea('0x7a')][_0xdcea('0x35')](_0x4d1d20[_0xdcea('0x7b')](),_0x43b8e8);})[_0xdcea('0x27')](function(_0x5c8f7e){_0x5c8f7e[_0xdcea('0x53')](function(_0x31f852){if(_0x31f852['TagIds']){_0x31f852[_0xdcea('0x83')]=[];_0x31f852[_0xdcea('0x82')][_0xdcea('0x51')](',')['forEach'](function(_0x4d7d3a){_0x31f852[_0xdcea('0x83')][_0xdcea('0x2f')](_0x55f092[_0x4d7d3a]);});}delete _0x31f852[_0xdcea('0x82')];});_0x4aadf2['rows']=_0x5c8f7e;return _0x4aadf2;})[_0xdcea('0x27')](respondWithFilteredResult(_0x5dc6ac,_0x4b97ba));});})[_0xdcea('0x84')](handleError(_0x5dc6ac,null));};exports[_0xdcea('0x85')]=function(_0x4c8c2a,_0x4ad640){return db['CmContact'][_0xdcea('0x86')]({'where':{'id':_0x4c8c2a[_0xdcea('0x87')]['id']}})[_0xdcea('0x27')](handleEntityNotFound(_0x4ad640,null))[_0xdcea('0x27')](removeEntity(_0x4ad640,null))[_0xdcea('0x84')](handleError(_0x4ad640,null));};exports[_0xdcea('0x2a')]=function(_0x4306d2,_0x3b0a38){return db[_0xdcea('0x7e')][_0xdcea('0x2a')]()[_0xdcea('0x27')](function(_0x30b2fd){delete _0x30b2fd[_0xdcea('0x88')];for(var _0x24e10b=0x0;_0x24e10b=_0x387f7f){_0x51658f=_0x387f7f;_0x4f1acf=0xc8;}else{_0x4f1acf=0xce;}_0xe9664d['status'](_0x4f1acf);return _0xe9664d['set']('Content-Range',_0x31ff72+'-'+_0x51658f+'/'+_0x387f7f)[_0xf0e8('0x1b')](_0x4a4621);}return null;};}function patchUpdates(_0x4609b6){return function(_0x14e460){try{jsonpatch[_0xf0e8('0x1c')](_0x14e460,_0x4609b6,!![]);}catch(_0x299838){return BPromise[_0xf0e8('0x1d')](_0x299838);}return _0x14e460[_0xf0e8('0x1e')]();};}function saveUpdates(_0x818851,_0x3453bc){return function(_0x4ad405){if(_0x4ad405){return _0x4ad405[_0xf0e8('0x1f')](_0x818851)['then'](function(_0x164a8d){return _0x164a8d;});}return null;};}function removeEntity(_0x231a0d,_0x19604c){return function(_0x4e8f03){if(_0x4e8f03){return _0x4e8f03['destroy']()[_0xf0e8('0x20')](function(){_0x231a0d[_0xf0e8('0x17')](0xcc)[_0xf0e8('0x18')]();});}};}function handleEntityNotFound(_0x548aab,_0xa189ed){return function(_0x1ad842){if(!_0x1ad842){_0x548aab[_0xf0e8('0x16')](0x194);}return _0x1ad842;};}function handleError(_0x23dca6,_0x4d36b9){_0x4d36b9=_0x4d36b9||0x1f4;return function(_0x429400){logger[_0xf0e8('0x21')](_0x429400[_0xf0e8('0x22')]);if(_0x429400[_0xf0e8('0x23')]){delete _0x429400[_0xf0e8('0x23')];}_0x23dca6['status'](_0x4d36b9)['send'](_0x429400);};}exports[_0xf0e8('0x24')]=function(_0x59477c,_0x4d9caa){var _0x2936de={},_0x2cb715={},_0x125b74={'count':0x0,'rows':[]};return db[_0xf0e8('0x25')]['describe']()[_0xf0e8('0x20')](function(_0x3691ae){var _0x2826c8=[];for(var _0x341314=0x0;_0x3413140x1){_0x38a246['or'](_0xf0e8('0x5e'),qs[_0xf0e8('0x5f')](_0x58e5e9),null);}else{if(qs['isNumeric'](_0x58e5e9)){_0x38a246['or'](_0xf0e8('0x60'),_0x58e5e9+'%');_0x38a246['or'](_0xf0e8('0x61'),_0x58e5e9+'%');_0x38a246['or'](_0xf0e8('0x62'),_0x58e5e9+'%');_0x38a246['or'](_0xf0e8('0x63'),_0x58e5e9+'%');}else if(qs[_0xf0e8('0x64')](_0x58e5e9)){_0x38a246['or'](_0xf0e8('0x65'),_0x58e5e9+'%');}else{_0x38a246['or'](_0xf0e8('0x66'),'%'+_0x58e5e9+'%');_0x38a246['or']('c.lastName\x20LIKE\x20?','%'+_0x58e5e9+'%');_0x38a246['or']('c.email\x20LIKE\x20?','%'+_0x58e5e9+'%');}}}}_0x5df74d[_0xf0e8('0x39')](_0x38a246);_0x5df74d[_0xf0e8('0x67')](_0xf0e8('0x68'));var _0x5bd8a6={'type':db[_0xf0e8('0x69')][_0xf0e8('0x6a')][_0xf0e8('0x6b')],'raw':!![]};var _0x362779=_0x5df74d[_0xf0e8('0x6c')]()['field'](_0xf0e8('0x68'));if(_0x2936de[_0xf0e8('0x6d')]){_0x2936de[_0xf0e8('0x6d')][_0xf0e8('0x4d')](function(_0x5e2f1a){_0x5df74d[_0xf0e8('0x6d')]('c.'+_0x5e2f1a[0x0],_0x5e2f1a[0x1]===_0xf0e8('0x6e')?![]:!![]);});}if(!_[_0xf0e8('0x6f')](_0x5c41e1)){_0x5df74d[_0xf0e8('0x70')](_0x211a9b);_0x362779[_0xf0e8('0x39')](_0xf0e8('0x71'),_0x5c41e1);}BPromise[_0xf0e8('0x72')]()[_0xf0e8('0x20')](function(){if(_0x2ba63a&&!_[_0xf0e8('0x73')](_0x2ba63a[_0xf0e8('0x74')],[_0xf0e8('0x48'),'User'])){return _0x59477c[_0xf0e8('0x75')][_0xf0e8('0x76')]({'attributes':['id'],'raw':!![]})[_0xf0e8('0x20')](function(_0x21f62c){if(_[_0xf0e8('0x6f')](_0x21f62c)){_0x362779[_0xf0e8('0x39')](_0xf0e8('0x77'));_0x5df74d['where'](_0xf0e8('0x77'));}else{_0x362779[_0xf0e8('0x39')](_0xf0e8('0x56'),_[_0xf0e8('0x4c')](_0x21f62c,'id'));_0x5df74d[_0xf0e8('0x39')]('c.ListId\x20IN\x20?',_[_0xf0e8('0x4c')](_0x21f62c,'id'));}});}else{return;}})['then'](function(){db[_0xf0e8('0x78')][_0xf0e8('0x31')](_0x362779[_0xf0e8('0x79')](),_0x5bd8a6)['then'](function(_0x477276){_0x125b74['count']=_0x477276['length'];if(_0x125b74[_0xf0e8('0x19')]===0x0)return[];return db[_0xf0e8('0x78')][_0xf0e8('0x31')](_0x79c707[_0xf0e8('0x79')](),_0x5bd8a6);})['then'](function(_0x2ee8fb){_0x41cc99=_[_0xf0e8('0x7a')](_0x2ee8fb,'id');_0x5bd8a6=_[_0xf0e8('0x7b')](_0x5bd8a6,{'model':db[_0xf0e8('0x25')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x59477c[_0xf0e8('0x31')][_0xf0e8('0x33')]){_0x2936de[_0xf0e8('0x34')][_0xf0e8('0x4d')](function(_0x22bfba){_0x5df74d[_0xf0e8('0x48')]('c.'+_0x22bfba);});}else{_0x5df74d['field']('c.id');_0x5df74d[_0xf0e8('0x48')](_0xf0e8('0x7c'));_0x5df74d[_0xf0e8('0x48')](_0xf0e8('0x7d'));_0x5df74d[_0xf0e8('0x48')]('c.phone');_0x5df74d[_0xf0e8('0x48')]('c.mobile');_0x5df74d[_0xf0e8('0x48')](_0xf0e8('0x7e'));_0x5df74d[_0xf0e8('0x48')](_0xf0e8('0x7f'));_0x5df74d['field'](_0xf0e8('0x80'));_0x5df74d['field'](_0xf0e8('0x81'));_0x5df74d['field'](_0xf0e8('0x82'),_0xf0e8('0x83'));}if(_0x2936de['limit'])_0x5df74d[_0xf0e8('0x37')](_0x2936de['limit']);if(_0x2936de[_0xf0e8('0x1a')])_0x5df74d[_0xf0e8('0x1a')](_0x2936de[_0xf0e8('0x1a')]);return db[_0xf0e8('0x78')][_0xf0e8('0x31')](_0x5df74d['toString'](),_0x5bd8a6);})[_0xf0e8('0x20')](function(_0x318c85){_0x318c85[_0xf0e8('0x4d')](function(_0x108198){if(_0x108198['TagIds']){_0x108198['Tags']=[];_0x108198[_0xf0e8('0x83')][_0xf0e8('0x4b')](',')[_0xf0e8('0x4d')](function(_0x372752){_0x108198[_0xf0e8('0x84')]['push'](_0x41cc99[_0x372752]);});}delete _0x108198[_0xf0e8('0x83')];});_0x125b74[_0xf0e8('0x85')]=_0x318c85;return _0x125b74;})[_0xf0e8('0x20')](respondWithFilteredResult(_0x4d9caa,_0x2936de));});})['catch'](handleError(_0x4d9caa,null));};exports['destroy']=function(_0xfc4b0b,_0xdd3fbf){return db[_0xf0e8('0x25')][_0xf0e8('0x47')]({'where':{'id':_0xfc4b0b[_0xf0e8('0x86')]['id']}})[_0xf0e8('0x20')](handleEntityNotFound(_0xdd3fbf,null))[_0xf0e8('0x20')](removeEntity(_0xdd3fbf,null))[_0xf0e8('0x87')](handleError(_0xdd3fbf,null));};exports['describe']=function(_0x67f960,_0x594790){return db[_0xf0e8('0x25')]['describe']()['then'](function(_0x4dfc58){delete _0x4dfc58[_0xf0e8('0x88')];for(var _0x381673=0x0;_0x381673{}\s\\|]/g,'-');_0x15f7a4(null,util['format'](_0xe7fb('0x1e'),path[_0xe7fb('0x1f')](_0x51f01f[_0xe7fb('0x1c')],path['extname'](_0x51f01f[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path['extname'](_0x51f01f['originalname'])));}})});router['post'](_0xe7fb('0x21'),upload['single']('file'),controller[_0xe7fb('0x22')]);var upload=multer({'storage':multer[_0xe7fb('0x1a')]({'destination':function(_0x2996ae,_0x4f6c73,_0x6c930){_0x6c930(null,path[_0xe7fb('0x23')](config[_0xe7fb('0x1b')],_0xe7fb('0x24')));},'filename':function(_0x392d75,_0x16237a,_0x380130){_0x16237a['originalname']=_0x16237a['originalname'][_0xe7fb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x380130(null,util[_0xe7fb('0x25')](_0xe7fb('0x1e'),path['basename'](_0x16237a[_0xe7fb('0x1c')],path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])));}})});router[_0xe7fb('0x17')](_0xe7fb('0x27'),upload['single'](_0xe7fb('0x28')),controller[_0xe7fb('0x29')]);router[_0xe7fb('0x17')]('/upload/:id',auth['isAuthenticated'](),controller[_0xe7fb('0x2a')]);router['put'](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2b')]);router[_0xe7fb('0x2c')]('/:id',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2d')]);module[_0xe7fb('0x2e')]=router; \ No newline at end of file +var _0xeff8=['/upload/:id','import','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','isAuthenticated','/:id','show','getTags','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','merge','create','/create_many','/:id/tags','setTags','diskStorage','join','root','server/files/tmp','originalname','format','%s-%s%s','now','extname','single','file','replace','/upload','upload'];(function(_0x11d996,_0x27803a){var _0x39e635=function(_0x5a4b06){while(--_0x5a4b06){_0x11d996['push'](_0x11d996['shift']());}};_0x39e635(++_0x27803a);}(_0xeff8,0x186));var _0x8eff=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xeff8[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8eff('0x5'));var config=require(_0x8eff('0x6'));var controller=require(_0x8eff('0x7'));router[_0x8eff('0x8')]('/',auth['isAuthenticated'](),controller[_0x8eff('0x9')]);router[_0x8eff('0x8')](_0x8eff('0xa'),auth[_0x8eff('0xb')](),controller['describe']);router[_0x8eff('0x8')](_0x8eff('0xc'),auth[_0x8eff('0xb')](),controller[_0x8eff('0xd')]);router['get']('/:id/tags',auth[_0x8eff('0xb')](),controller[_0x8eff('0xe')]);router[_0x8eff('0x8')]('/:id/hoppers',auth[_0x8eff('0xb')](),controller[_0x8eff('0xf')]);router['get'](_0x8eff('0x10'),auth[_0x8eff('0xb')](),controller['getHopperHistories']);router['get'](_0x8eff('0x11'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x12')]);router[_0x8eff('0x8')](_0x8eff('0x13'),auth['isAuthenticated'](),controller[_0x8eff('0x14')]);router[_0x8eff('0x15')](_0x8eff('0x16'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x17')]);router[_0x8eff('0x15')]('/',auth[_0x8eff('0xb')](),controller[_0x8eff('0x18')]);router[_0x8eff('0x15')](_0x8eff('0x19'),auth[_0x8eff('0xb')](),controller['bulkCreate']);router[_0x8eff('0x15')](_0x8eff('0x1a'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x1b')]);var upload=multer({'storage':multer[_0x8eff('0x1c')]({'destination':function(_0x3c800b,_0x38f5ee,_0x399d96){_0x399d96(null,path[_0x8eff('0x1d')](config[_0x8eff('0x1e')],_0x8eff('0x1f')));},'filename':function(_0x1b65f9,_0x1e9ad0,_0x2a7337){_0x1e9ad0[_0x8eff('0x20')]=_0x1e9ad0[_0x8eff('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2a7337(null,util[_0x8eff('0x21')](_0x8eff('0x22'),path['basename'](_0x1e9ad0[_0x8eff('0x20')],path['extname'](_0x1e9ad0[_0x8eff('0x20')])),Date[_0x8eff('0x23')](),path[_0x8eff('0x24')](_0x1e9ad0[_0x8eff('0x20')])));}})});router[_0x8eff('0x15')]('/csv',upload[_0x8eff('0x25')](_0x8eff('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x8eff('0x1c')]({'destination':function(_0x5ec3d7,_0x40404b,_0x3b698b){_0x3b698b(null,path[_0x8eff('0x1d')](config[_0x8eff('0x1e')],_0x8eff('0x1f')));},'filename':function(_0x2e8067,_0x516173,_0x3e1607){_0x516173[_0x8eff('0x20')]=_0x516173[_0x8eff('0x20')][_0x8eff('0x27')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e1607(null,util[_0x8eff('0x21')](_0x8eff('0x22'),path['basename'](_0x516173['originalname'],path[_0x8eff('0x24')](_0x516173[_0x8eff('0x20')])),Date[_0x8eff('0x23')](),path['extname'](_0x516173[_0x8eff('0x20')])));}})});router[_0x8eff('0x15')](_0x8eff('0x28'),upload[_0x8eff('0x25')](_0x8eff('0x26')),controller[_0x8eff('0x29')]);router[_0x8eff('0x15')](_0x8eff('0x2a'),auth[_0x8eff('0xb')](),controller[_0x8eff('0x2b')]);router[_0x8eff('0x2c')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0x2d')]);router[_0x8eff('0x2e')](_0x8eff('0xc'),auth[_0x8eff('0xb')](),controller['destroy']);module[_0x8eff('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 0f07928..48c9dd6 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf13b=['sequelize','INTEGER','STRING','PHONE'];(function(_0x410a98,_0x3839b6){var _0x36e27d=function(_0x271e78){while(--_0x271e78){_0x410a98['push'](_0x410a98['shift']());}};_0x36e27d(++_0x3839b6);}(_0xf13b,0x1f0));var _0xbf13=function(_0x5987b8,_0x2bf595){_0x5987b8=_0x5987b8-0x0;var _0x5884ed=_0xf13b[_0x5987b8];return _0x5884ed;};'use strict';var Sequelize=require(_0xbf13('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xbf13('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xbf13('0x2')],'defaultValue':_0xbf13('0x3')},'OrderBy':{'type':Sequelize[_0xbf13('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x0689=['PHONE','exports','STRING','INTEGER'];(function(_0x1cda9f,_0x39ce5c){var _0x6cc26b=function(_0x256d61){while(--_0x256d61){_0x1cda9f['push'](_0x1cda9f['shift']());}};_0x6cc26b(++_0x39ce5c);}(_0x0689,0x161));var _0x9068=function(_0x772156,_0x5b5faa){_0x772156=_0x772156-0x0;var _0x79234b=_0x0689[_0x772156];return _0x79234b;};'use strict';var Sequelize=require('sequelize');module[_0x9068('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x9068('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x9068('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9068('0x1')],'defaultValue':_0x9068('0x3')},'OrderBy':{'type':Sequelize[_0x9068('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 41c9497..2345170 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6517=['apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','where','pick','merge','options','includeAll','include','rows','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json'];(function(_0x246753,_0x62ceb6){var _0x593cc0=function(_0x185d33){while(--_0x185d33){_0x246753['push'](_0x246753['shift']());}};_0x593cc0(++_0x62ceb6);}(_0x6517,0x195));var _0x7651=function(_0x3b376b,_0x4a5635){_0x3b376b=_0x3b376b-0x0;var _0x59fb44=_0x6517[_0x3b376b];return _0x59fb44;};'use strict';var pdf=require(_0x7651('0x0'));var emlformat=require(_0x7651('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7651('0x2'));var moment=require(_0x7651('0x3'));var BPromise=require(_0x7651('0x4'));var Mustache=require(_0x7651('0x5'));var util=require('util');var path=require(_0x7651('0x6'));var sox=require(_0x7651('0x7'));var csv=require(_0x7651('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7651('0x9'));var squel=require('squel');var crypto=require(_0x7651('0xa'));var jsforce=require(_0x7651('0xb'));var deskjs=require(_0x7651('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7651('0xd'));var Papa=require(_0x7651('0xe'));var Redis=require(_0x7651('0xf'));var authService=require(_0x7651('0x10'));var qs=require(_0x7651('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7651('0x12'));var logger=require(_0x7651('0x13'))(_0x7651('0x14'));var utils=require(_0x7651('0x15'));var config=require(_0x7651('0x16'));var db=require(_0x7651('0x17'))['db'];function respondWithStatusCode(_0xd9f706,_0x3864c8){_0x3864c8=_0x3864c8||0xcc;return function(_0x406625){if(_0x406625){return _0xd9f706[_0x7651('0x18')](_0x3864c8);}return _0xd9f706[_0x7651('0x19')](_0x3864c8)[_0x7651('0x1a')]();};}function respondWithResult(_0x319f47,_0x342f1b){_0x342f1b=_0x342f1b||0xc8;return function(_0xd76f4d){if(_0xd76f4d){return _0x319f47[_0x7651('0x19')](_0x342f1b)['json'](_0xd76f4d);}};}function respondWithFilteredResult(_0x54e2a2,_0x212b9e){return function(_0x34c229){if(_0x34c229){var _0x16aebe=_0x34c229[_0x7651('0x1b')],_0x50f84e=_0x212b9e[_0x7651('0x1c')],_0x345aef=_0x212b9e[_0x7651('0x1c')]+_0x212b9e[_0x7651('0x1d')],_0x52e508;if(_0x345aef>=_0x16aebe){_0x345aef=_0x16aebe;_0x52e508=0xc8;}else{_0x52e508=0xce;}_0x54e2a2[_0x7651('0x19')](_0x52e508);return _0x54e2a2[_0x7651('0x1e')](_0x7651('0x1f'),_0x50f84e+'-'+_0x345aef+'/'+_0x16aebe)[_0x7651('0x20')](_0x34c229);}return null;};}function patchUpdates(_0x455529){return function(_0x2566e0){try{jsonpatch[_0x7651('0x21')](_0x2566e0,_0x455529,!![]);}catch(_0x4d5230){return BPromise[_0x7651('0x22')](_0x4d5230);}return _0x2566e0[_0x7651('0x23')]();};}function saveUpdates(_0x32f0c1,_0x3d3638){return function(_0xe28e5c){if(_0xe28e5c){return _0xe28e5c[_0x7651('0x24')](_0x32f0c1)[_0x7651('0x25')](function(_0x1a590e){return _0x1a590e;});}return null;};}function removeEntity(_0x36df38,_0x4baf31){return function(_0x385bac){if(_0x385bac){return _0x385bac[_0x7651('0x26')]()[_0x7651('0x25')](function(){var _0x5d4b9c=_0x385bac[_0x7651('0x27')]({'plain':!![]});var _0x4fe838=_0x7651('0x28');return db[_0x7651('0x29')][_0x7651('0x26')]({'where':{'type':_0x4fe838,'resourceId':_0x5d4b9c['id']}})[_0x7651('0x25')](function(){return _0x385bac;});})[_0x7651('0x25')](function(){_0x36df38[_0x7651('0x19')](0xcc)[_0x7651('0x1a')]();});}};}function handleEntityNotFound(_0x33281c,_0x114d22){return function(_0x5f935a){if(!_0x5f935a){_0x33281c[_0x7651('0x18')](0x194);}return _0x5f935a;};}function handleError(_0x3078ad,_0x131238){_0x131238=_0x131238||0x1f4;return function(_0x3e251b){logger[_0x7651('0x2a')](_0x3e251b[_0x7651('0x2b')]);if(_0x3e251b[_0x7651('0x2c')]){delete _0x3e251b[_0x7651('0x2c')];}_0x3078ad['status'](_0x131238)['send'](_0x3e251b);};}exports['index']=function(_0x498093,_0x1678ae){var _0x2e688d={},_0x18edb2={},_0x27dfe8={'count':0x0,'rows':[]};var _0x411993=_[_0x7651('0x2d')](db[_0x7651('0x2e')][_0x7651('0x2f')],function(_0x4a84de){return{'name':_0x4a84de[_0x7651('0x30')],'type':_0x4a84de[_0x7651('0x31')]['key']};});_0x18edb2[_0x7651('0x32')]=_[_0x7651('0x2d')](_0x411993,_0x7651('0x2c'));_0x18edb2[_0x7651('0x33')]=_[_0x7651('0x34')](_0x498093['query']);_0x18edb2[_0x7651('0x35')]=_[_0x7651('0x36')](_0x18edb2[_0x7651('0x32')],_0x18edb2[_0x7651('0x33')]);_0x2e688d['attributes']=_[_0x7651('0x36')](_0x18edb2[_0x7651('0x32')],qs[_0x7651('0x37')](_0x498093[_0x7651('0x33')][_0x7651('0x37')]));_0x2e688d['attributes']=_0x2e688d['attributes'][_0x7651('0x38')]?_0x2e688d[_0x7651('0x39')]:_0x18edb2['model'];if(!_0x498093[_0x7651('0x33')]['hasOwnProperty']('nolimit')){_0x2e688d[_0x7651('0x1d')]=qs[_0x7651('0x1d')](_0x498093[_0x7651('0x33')]['limit']);_0x2e688d['offset']=qs[_0x7651('0x1c')](_0x498093['query']['offset']);}_0x2e688d['order']=qs['sort'](_0x498093['query']['sort']);_0x2e688d[_0x7651('0x3a')]=qs[_0x7651('0x35')](_[_0x7651('0x3b')](_0x498093['query'],_0x18edb2[_0x7651('0x35')]),_0x411993);if(_0x498093['query']['filter']){_0x2e688d['where']=_[_0x7651('0x3c')](_0x2e688d[_0x7651('0x3a')],{'$or':_[_0x7651('0x2d')](_0x411993,function(_0x50bdd6){if(_0x50bdd6['type']!=='VIRTUAL'){var _0x40ac0b={};_0x40ac0b[_0x50bdd6['name']]={'$like':'%'+_0x498093[_0x7651('0x33')]['filter']+'%'};return _0x40ac0b;}})});}_0x2e688d=_[_0x7651('0x3c')]({},_0x2e688d,_0x498093[_0x7651('0x3d')]);var _0x13b9c7={'where':_0x2e688d[_0x7651('0x3a')]};return db[_0x7651('0x2e')]['count'](_0x13b9c7)[_0x7651('0x25')](function(_0x2abc1d){_0x27dfe8['count']=_0x2abc1d;if(_0x498093['query'][_0x7651('0x3e')]){_0x2e688d[_0x7651('0x3f')]=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x2e688d);})[_0x7651('0x25')](function(_0x4d7ac9){_0x27dfe8[_0x7651('0x40')]=_0x4d7ac9;return _0x27dfe8;})[_0x7651('0x25')](respondWithFilteredResult(_0x1678ae,_0x2e688d))['catch'](handleError(_0x1678ae,null));};exports[_0x7651('0x41')]=function(_0x1ed9c8,_0x42f417){var _0x1cf6a6={'raw':!![],'where':{'id':_0x1ed9c8['params']['id']}},_0x82b64a={};_0x82b64a[_0x7651('0x32')]=_[_0x7651('0x34')](db['CmContactHasItem'][_0x7651('0x2f')]);_0x82b64a['query']=_[_0x7651('0x34')](_0x1ed9c8[_0x7651('0x33')]);_0x82b64a[_0x7651('0x35')]=_[_0x7651('0x36')](_0x82b64a[_0x7651('0x32')],_0x82b64a['query']);_0x1cf6a6['attributes']=_[_0x7651('0x36')](_0x82b64a[_0x7651('0x32')],qs[_0x7651('0x37')](_0x1ed9c8['query'][_0x7651('0x37')]));_0x1cf6a6['attributes']=_0x1cf6a6[_0x7651('0x39')][_0x7651('0x38')]?_0x1cf6a6['attributes']:_0x82b64a['model'];if(_0x1ed9c8['query'][_0x7651('0x3e')]){_0x1cf6a6[_0x7651('0x3f')]=[{'all':!![]}];}_0x1cf6a6=_[_0x7651('0x3c')]({},_0x1cf6a6,_0x1ed9c8[_0x7651('0x3d')]);return db[_0x7651('0x2e')][_0x7651('0x42')](_0x1cf6a6)['then'](handleEntityNotFound(_0x42f417,null))[_0x7651('0x25')](respondWithResult(_0x42f417,null))[_0x7651('0x43')](handleError(_0x42f417,null));};exports[_0x7651('0x44')]=function(_0x2bb20c,_0x4689c0){return db[_0x7651('0x2e')][_0x7651('0x44')](_0x2bb20c[_0x7651('0x45')],{})[_0x7651('0x25')](function(_0x42db6f){var _0x75179b=_0x2bb20c['user'][_0x7651('0x27')]({'plain':!![]});if(!_0x75179b)throw new Error(_0x7651('0x46'));if(_0x75179b['role']===_0x7651('0x47')){var _0xce46d8=_0x42db6f[_0x7651('0x27')]({'plain':!![]});var _0x3261ea=_0x7651('0x28');return db['UserProfileSection'][_0x7651('0x42')]({'where':{'name':_0x3261ea,'userProfileId':_0x75179b['userProfileId']},'raw':!![]})[_0x7651('0x25')](function(_0x52c13a){if(_0x52c13a&&_0x52c13a[_0x7651('0x48')]===0x0){return db[_0x7651('0x29')][_0x7651('0x44')]({'name':_0xce46d8[_0x7651('0x2c')],'resourceId':_0xce46d8['id'],'type':_0x52c13a[_0x7651('0x2c')],'sectionId':_0x52c13a['id']},{})[_0x7651('0x25')](function(){return _0x42db6f;});}else{return _0x42db6f;}})['catch'](function(_0x42e7dd){logger[_0x7651('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42e7dd);throw _0x42e7dd;});}return _0x42db6f;})[_0x7651('0x25')](respondWithResult(_0x4689c0,0xc9))['catch'](handleError(_0x4689c0,null));};exports[_0x7651('0x24')]=function(_0x3dad7c,_0x21bc63){if(_0x3dad7c[_0x7651('0x45')]['id']){delete _0x3dad7c[_0x7651('0x45')]['id'];}return db[_0x7651('0x2e')][_0x7651('0x42')]({'where':{'id':_0x3dad7c['params']['id']}})[_0x7651('0x25')](handleEntityNotFound(_0x21bc63,null))['then'](saveUpdates(_0x3dad7c[_0x7651('0x45')],null))['then'](respondWithResult(_0x21bc63,null))['catch'](handleError(_0x21bc63,null));};exports[_0x7651('0x26')]=function(_0xca62af,_0x55e19b){return db['CmContactHasItem'][_0x7651('0x42')]({'where':{'id':_0xca62af['params']['id']}})['then'](handleEntityNotFound(_0x55e19b,null))[_0x7651('0x25')](removeEntity(_0x55e19b,null))[_0x7651('0x43')](handleError(_0x55e19b,null));}; \ No newline at end of file +var _0xf6dd=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','CmContactHasItems','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','user','get'];(function(_0x156627,_0x27ec9a){var _0x174ce9=function(_0x12b9c2){while(--_0x12b9c2){_0x156627['push'](_0x156627['shift']());}};_0x174ce9(++_0x27ec9a);}(_0xf6dd,0xa6));var _0xdf6d=function(_0x3da2c3,_0x1e982a){_0x3da2c3=_0x3da2c3-0x0;var _0x45ec5c=_0xf6dd[_0x3da2c3];return _0x45ec5c;};'use strict';var pdf=require(_0xdf6d('0x0'));var emlformat=require(_0xdf6d('0x1'));var rimraf=require(_0xdf6d('0x2'));var zipdir=require(_0xdf6d('0x3'));var jsonpatch=require(_0xdf6d('0x4'));var rp=require(_0xdf6d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdf6d('0x6'));var path=require(_0xdf6d('0x7'));var sox=require(_0xdf6d('0x8'));var csv=require('to-csv');var ejs=require(_0xdf6d('0x9'));var fs=require('fs');var _=require(_0xdf6d('0xa'));var squel=require(_0xdf6d('0xb'));var crypto=require('crypto');var jsforce=require(_0xdf6d('0xc'));var deskjs=require(_0xdf6d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdf6d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdf6d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdf6d('0x10'));var hardwareService=require(_0xdf6d('0x11'));var logger=require('../../config/logger')(_0xdf6d('0x12'));var utils=require(_0xdf6d('0x13'));var config=require(_0xdf6d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35306f,_0x4dbb23){_0x4dbb23=_0x4dbb23||0xcc;return function(_0x1500f4){if(_0x1500f4){return _0x35306f[_0xdf6d('0x15')](_0x4dbb23);}return _0x35306f[_0xdf6d('0x16')](_0x4dbb23)[_0xdf6d('0x17')]();};}function respondWithResult(_0x33a937,_0x3f18f2){_0x3f18f2=_0x3f18f2||0xc8;return function(_0x4486cc){if(_0x4486cc){return _0x33a937[_0xdf6d('0x16')](_0x3f18f2)[_0xdf6d('0x18')](_0x4486cc);}};}function respondWithFilteredResult(_0x156fcf,_0x5b9e24){return function(_0x55cfad){if(_0x55cfad){var _0x311a2e=_0x55cfad[_0xdf6d('0x19')],_0xd9471f=_0x5b9e24[_0xdf6d('0x1a')],_0x3ec3ed=_0x5b9e24[_0xdf6d('0x1a')]+_0x5b9e24[_0xdf6d('0x1b')],_0x357a42;if(_0x3ec3ed>=_0x311a2e){_0x3ec3ed=_0x311a2e;_0x357a42=0xc8;}else{_0x357a42=0xce;}_0x156fcf[_0xdf6d('0x16')](_0x357a42);return _0x156fcf['set'](_0xdf6d('0x1c'),_0xd9471f+'-'+_0x3ec3ed+'/'+_0x311a2e)[_0xdf6d('0x18')](_0x55cfad);}return null;};}function patchUpdates(_0x181835){return function(_0x2e34){try{jsonpatch['apply'](_0x2e34,_0x181835,!![]);}catch(_0x18dedc){return BPromise[_0xdf6d('0x1d')](_0x18dedc);}return _0x2e34[_0xdf6d('0x1e')]();};}function saveUpdates(_0x5a8aa0,_0x5177fd){return function(_0x147a5c){if(_0x147a5c){return _0x147a5c[_0xdf6d('0x1f')](_0x5a8aa0)[_0xdf6d('0x20')](function(_0x1ded20){return _0x1ded20;});}return null;};}function removeEntity(_0x3c6e44,_0x4bbd12){return function(_0x3ee5a7){if(_0x3ee5a7){return _0x3ee5a7[_0xdf6d('0x21')]()[_0xdf6d('0x20')](function(){var _0x2ca56f=_0x3ee5a7['get']({'plain':!![]});var _0x42278e=_0xdf6d('0x22');return db['UserProfileResource'][_0xdf6d('0x21')]({'where':{'type':_0x42278e,'resourceId':_0x2ca56f['id']}})[_0xdf6d('0x20')](function(){return _0x3ee5a7;});})[_0xdf6d('0x20')](function(){_0x3c6e44['status'](0xcc)[_0xdf6d('0x17')]();});}};}function handleEntityNotFound(_0x3f03da,_0x2a2adb){return function(_0x5e6b92){if(!_0x5e6b92){_0x3f03da['sendStatus'](0x194);}return _0x5e6b92;};}function handleError(_0x29ccd0,_0xe6d5fb){_0xe6d5fb=_0xe6d5fb||0x1f4;return function(_0x46d925){logger[_0xdf6d('0x23')](_0x46d925['stack']);if(_0x46d925[_0xdf6d('0x24')]){delete _0x46d925['name'];}_0x29ccd0[_0xdf6d('0x16')](_0xe6d5fb)[_0xdf6d('0x25')](_0x46d925);};}exports[_0xdf6d('0x26')]=function(_0x448155,_0x2f23ca){var _0x5b6375={},_0x17146b={},_0x59d791={'count':0x0,'rows':[]};var _0x49218e=_[_0xdf6d('0x27')](db[_0xdf6d('0x28')][_0xdf6d('0x29')],function(_0x3727c0){return{'name':_0x3727c0[_0xdf6d('0x2a')],'type':_0x3727c0[_0xdf6d('0x2b')][_0xdf6d('0x2c')]};});_0x17146b[_0xdf6d('0x2d')]=_['map'](_0x49218e,_0xdf6d('0x24'));_0x17146b['query']=_[_0xdf6d('0x2e')](_0x448155[_0xdf6d('0x2f')]);_0x17146b[_0xdf6d('0x30')]=_[_0xdf6d('0x31')](_0x17146b[_0xdf6d('0x2d')],_0x17146b[_0xdf6d('0x2f')]);_0x5b6375[_0xdf6d('0x32')]=_[_0xdf6d('0x31')](_0x17146b[_0xdf6d('0x2d')],qs[_0xdf6d('0x33')](_0x448155['query'][_0xdf6d('0x33')]));_0x5b6375[_0xdf6d('0x32')]=_0x5b6375['attributes'][_0xdf6d('0x34')]?_0x5b6375['attributes']:_0x17146b['model'];if(!_0x448155['query'][_0xdf6d('0x35')](_0xdf6d('0x36'))){_0x5b6375[_0xdf6d('0x1b')]=qs[_0xdf6d('0x1b')](_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x1b')]);_0x5b6375[_0xdf6d('0x1a')]=qs[_0xdf6d('0x1a')](_0x448155['query']['offset']);}_0x5b6375[_0xdf6d('0x37')]=qs[_0xdf6d('0x38')](_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x38')]);_0x5b6375['where']=qs[_0xdf6d('0x30')](_[_0xdf6d('0x39')](_0x448155[_0xdf6d('0x2f')],_0x17146b[_0xdf6d('0x30')]),_0x49218e);if(_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x3a')]){_0x5b6375['where']=_[_0xdf6d('0x3b')](_0x5b6375[_0xdf6d('0x3c')],{'$or':_['map'](_0x49218e,function(_0x7a0bd3){if(_0x7a0bd3[_0xdf6d('0x2b')]!==_0xdf6d('0x3d')){var _0x91bce1={};_0x91bce1[_0x7a0bd3[_0xdf6d('0x24')]]={'$like':'%'+_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x3a')]+'%'};return _0x91bce1;}})});}_0x5b6375=_[_0xdf6d('0x3b')]({},_0x5b6375,_0x448155[_0xdf6d('0x3e')]);var _0x3ec35c={'where':_0x5b6375[_0xdf6d('0x3c')]};return db['CmContactHasItem']['count'](_0x3ec35c)[_0xdf6d('0x20')](function(_0x3f761d){_0x59d791[_0xdf6d('0x19')]=_0x3f761d;if(_0x448155[_0xdf6d('0x2f')][_0xdf6d('0x3f')]){_0x5b6375['include']=[{'all':!![]}];}return db[_0xdf6d('0x28')][_0xdf6d('0x40')](_0x5b6375);})[_0xdf6d('0x20')](function(_0x37e3b9){_0x59d791[_0xdf6d('0x41')]=_0x37e3b9;return _0x59d791;})[_0xdf6d('0x20')](respondWithFilteredResult(_0x2f23ca,_0x5b6375))[_0xdf6d('0x42')](handleError(_0x2f23ca,null));};exports[_0xdf6d('0x43')]=function(_0x21d5af,_0x372973){var _0x4a2a01={'raw':!![],'where':{'id':_0x21d5af[_0xdf6d('0x44')]['id']}},_0x425d92={};_0x425d92[_0xdf6d('0x2d')]=_['keys'](db['CmContactHasItem'][_0xdf6d('0x29')]);_0x425d92['query']=_['keys'](_0x21d5af[_0xdf6d('0x2f')]);_0x425d92[_0xdf6d('0x30')]=_[_0xdf6d('0x31')](_0x425d92[_0xdf6d('0x2d')],_0x425d92[_0xdf6d('0x2f')]);_0x4a2a01['attributes']=_[_0xdf6d('0x31')](_0x425d92[_0xdf6d('0x2d')],qs['fields'](_0x21d5af[_0xdf6d('0x2f')][_0xdf6d('0x33')]));_0x4a2a01[_0xdf6d('0x32')]=_0x4a2a01[_0xdf6d('0x32')][_0xdf6d('0x34')]?_0x4a2a01[_0xdf6d('0x32')]:_0x425d92['model'];if(_0x21d5af[_0xdf6d('0x2f')]['includeAll']){_0x4a2a01[_0xdf6d('0x45')]=[{'all':!![]}];}_0x4a2a01=_['merge']({},_0x4a2a01,_0x21d5af['options']);return db[_0xdf6d('0x28')][_0xdf6d('0x46')](_0x4a2a01)[_0xdf6d('0x20')](handleEntityNotFound(_0x372973,null))[_0xdf6d('0x20')](respondWithResult(_0x372973,null))[_0xdf6d('0x42')](handleError(_0x372973,null));};exports['create']=function(_0x10bcd5,_0x4f385e){return db[_0xdf6d('0x28')]['create'](_0x10bcd5[_0xdf6d('0x47')],{})[_0xdf6d('0x20')](function(_0x58a739){var _0x2c089f=_0x10bcd5[_0xdf6d('0x48')][_0xdf6d('0x49')]({'plain':!![]});if(!_0x2c089f)throw new Error(_0xdf6d('0x4a'));if(_0x2c089f['role']===_0xdf6d('0x48')){var _0x1522c1=_0x58a739['get']({'plain':!![]});var _0x2e0a5e=_0xdf6d('0x22');return db[_0xdf6d('0x4b')]['find']({'where':{'name':_0x2e0a5e,'userProfileId':_0x2c089f[_0xdf6d('0x4c')]},'raw':!![]})[_0xdf6d('0x20')](function(_0x1690f4){if(_0x1690f4&&_0x1690f4[_0xdf6d('0x4d')]===0x0){return db[_0xdf6d('0x4e')]['create']({'name':_0x1522c1[_0xdf6d('0x24')],'resourceId':_0x1522c1['id'],'type':_0x1690f4[_0xdf6d('0x24')],'sectionId':_0x1690f4['id']},{})[_0xdf6d('0x20')](function(){return _0x58a739;});}else{return _0x58a739;}})['catch'](function(_0x51074f){logger[_0xdf6d('0x23')](_0xdf6d('0x4f'),_0x51074f);throw _0x51074f;});}return _0x58a739;})[_0xdf6d('0x20')](respondWithResult(_0x4f385e,0xc9))[_0xdf6d('0x42')](handleError(_0x4f385e,null));};exports[_0xdf6d('0x1f')]=function(_0x3d3a00,_0x3d1873){if(_0x3d3a00[_0xdf6d('0x47')]['id']){delete _0x3d3a00['body']['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x3d3a00[_0xdf6d('0x44')]['id']}})[_0xdf6d('0x20')](handleEntityNotFound(_0x3d1873,null))[_0xdf6d('0x20')](saveUpdates(_0x3d3a00[_0xdf6d('0x47')],null))['then'](respondWithResult(_0x3d1873,null))['catch'](handleError(_0x3d1873,null));};exports['destroy']=function(_0x1f2207,_0x2af439){return db[_0xdf6d('0x28')][_0xdf6d('0x46')]({'where':{'id':_0x1f2207[_0xdf6d('0x44')]['id']}})[_0xdf6d('0x20')](handleEntityNotFound(_0x2af439,null))['then'](removeEntity(_0x2af439,null))['catch'](handleError(_0x2af439,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 6838894..a4dca90 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x58c2d6,_0x293bee){var _0x2dbf62=function(_0x420e89){while(--_0x420e89){_0x58c2d6['push'](_0x58c2d6['shift']());}};_0x2dbf62(++_0x293bee);}(_0xb138,0x1dd));var _0x8b13=function(_0x35854d,_0x1bf625){_0x35854d=_0x35854d-0x0;var _0xcc051=_0xb138[_0x35854d];return _0xcc051;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11e5=['path','../../config/environment','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x47c9e7,_0x44e5e8){var _0x485836=function(_0x4b1360){while(--_0x4b1360){_0x47c9e7['push'](_0x47c9e7['shift']());}};_0x485836(++_0x44e5e8);}(_0x11e5,0x8b));var _0x511e=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0x11e5[_0x542da8];return _0x533d7e;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x342539,_0x323f8c){return _0x342539[_0x511e('0x7')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index acc9cc6..a931fa9 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6658=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2d4258,_0x1eae89){var _0x244daf=function(_0x43b7e0){while(--_0x43b7e0){_0x2d4258['push'](_0x2d4258['shift']());}};_0x244daf(++_0x1eae89);}(_0x6658,0x198));var _0x8665=function(_0x422c44,_0x4cec31){_0x422c44=_0x422c44-0x0;var _0x2a11d2=_0x6658[_0x422c44];return _0x2a11d2;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var moment=require(_0x8665('0x2'));var BPromise=require(_0x8665('0x3'));var rs=require(_0x8665('0x4'));var fs=require('fs');var Redis=require(_0x8665('0x5'));var db=require(_0x8665('0x6'))['db'];var utils=require(_0x8665('0x7'));var logger=require('../../config/logger')(_0x8665('0x8'));var config=require(_0x8665('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8665('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x290df7,_0x24c89f,_0x242f58){return new BPromise(function(_0xe73687,_0x861e11){return client[_0x8665('0xb')](_0x290df7,_0x242f58)[_0x8665('0xc')](function(_0x5c25bf){logger[_0x8665('0xd')](_0x8665('0xe'),_0x24c89f,_0x8665('0xf'));logger[_0x8665('0x10')](_0x8665('0x11'),_0x24c89f,_0x8665('0xf'),JSON[_0x8665('0x12')](_0x5c25bf));if(_0x5c25bf[_0x8665('0x13')]){if(_0x5c25bf[_0x8665('0x13')][_0x8665('0x14')]===0x1f4){logger[_0x8665('0x13')](_0x8665('0xe'),_0x24c89f,_0x5c25bf[_0x8665('0x13')][_0x8665('0x15')]);return _0x861e11(_0x5c25bf['error'][_0x8665('0x15')]);}logger['error'](_0x8665('0xe'),_0x24c89f,_0x5c25bf[_0x8665('0x13')][_0x8665('0x15')]);return _0xe73687(_0x5c25bf[_0x8665('0x13')][_0x8665('0x15')]);}else{logger[_0x8665('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x24c89f,_0x8665('0xf'));_0xe73687(_0x5c25bf[_0x8665('0x16')]['message']);}})[_0x8665('0x17')](function(_0x53dcb5){logger[_0x8665('0x13')](_0x8665('0xe'),_0x24c89f,_0x53dcb5);_0x861e11(_0x53dcb5);});});} \ No newline at end of file +var _0xc1f1=['stringify','code','error','message','result','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xc1f1,0x122));var _0x1c1f=function(_0x56085e,_0x5c69e9){_0x56085e=_0x56085e-0x0;var _0x4de130=_0xc1f1[_0x56085e];return _0x4de130;};'use strict';var _=require('lodash');var util=require(_0x1c1f('0x0'));var moment=require(_0x1c1f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c1f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c1f('0x4'))('rpc');var config=require(_0x1c1f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1c1f('0x6')][_0x1c1f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d44be,_0x33ccb8,_0x2dd1e4){return new BPromise(function(_0x34b9fc,_0x4209bb){return client['request'](_0x3d44be,_0x2dd1e4)[_0x1c1f('0x8')](function(_0x5b7875){logger[_0x1c1f('0x9')](_0x1c1f('0xa'),_0x33ccb8,_0x1c1f('0xb'));logger[_0x1c1f('0xc')](_0x1c1f('0xd'),_0x33ccb8,_0x1c1f('0xb'),JSON[_0x1c1f('0xe')](_0x5b7875));if(_0x5b7875['error']){if(_0x5b7875['error'][_0x1c1f('0xf')]===0x1f4){logger[_0x1c1f('0x10')](_0x1c1f('0xa'),_0x33ccb8,_0x5b7875['error'][_0x1c1f('0x11')]);return _0x4209bb(_0x5b7875[_0x1c1f('0x10')][_0x1c1f('0x11')]);}logger[_0x1c1f('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x33ccb8,_0x5b7875['error'][_0x1c1f('0x11')]);return _0x34b9fc(_0x5b7875[_0x1c1f('0x10')][_0x1c1f('0x11')]);}else{logger[_0x1c1f('0x9')](_0x1c1f('0xa'),_0x33ccb8,_0x1c1f('0xb'));_0x34b9fc(_0x5b7875[_0x1c1f('0x12')][_0x1c1f('0x11')]);}})['catch'](function(_0x57b2ed){logger[_0x1c1f('0x10')](_0x1c1f('0xa'),_0x33ccb8,_0x57b2ed);_0x4209bb(_0x57b2ed);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index a570a46..78e543f 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5ae=['show','post','create','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id'];(function(_0x67ac46,_0x2a1823){var _0x166ce9=function(_0x428ef1){while(--_0x428ef1){_0x67ac46['push'](_0x67ac46['shift']());}};_0x166ce9(++_0x2a1823);}(_0xb5ae,0x186));var _0xeb5a=function(_0x3caf09,_0x4d9426){_0x3caf09=_0x3caf09-0x0;var _0x35a410=_0xb5ae[_0x3caf09];return _0x35a410;};'use strict';var multer=require(_0xeb5a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeb5a('0x1'));var express=require(_0xeb5a('0x2'));var router=express['Router']();var auth=require(_0xeb5a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xeb5a('0x4'));var controller=require(_0xeb5a('0x5'));router[_0xeb5a('0x6')]('/',auth[_0xeb5a('0x7')](),controller[_0xeb5a('0x8')]);router['get'](_0xeb5a('0x9'),auth[_0xeb5a('0x7')](),controller[_0xeb5a('0xa')]);router[_0xeb5a('0xb')]('/',auth[_0xeb5a('0x7')](),controller[_0xeb5a('0xc')]);router['put'](_0xeb5a('0x9'),auth[_0xeb5a('0x7')](),controller[_0xeb5a('0xd')]);router[_0xeb5a('0xe')](_0xeb5a('0x9'),auth[_0xeb5a('0x7')](),controller[_0xeb5a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd63f=['get','isAuthenticated','index','/:id','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0xd63f,0xab));var _0xfd63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd63f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfd63('0x0'));var util=require(_0xfd63('0x1'));var path=require('path');var timeout=require(_0xfd63('0x2'));var express=require(_0xfd63('0x3'));var router=express[_0xfd63('0x4')]();var auth=require(_0xfd63('0x5'));var interaction=require(_0xfd63('0x6'));var config=require(_0xfd63('0x7'));var controller=require(_0xfd63('0x8'));router[_0xfd63('0x9')]('/',auth[_0xfd63('0xa')](),controller[_0xfd63('0xb')]);router['get'](_0xfd63('0xc'),auth[_0xfd63('0xa')](),controller['show']);router[_0xfd63('0xd')]('/',auth[_0xfd63('0xa')](),controller[_0xfd63('0xe')]);router[_0xfd63('0xf')](_0xfd63('0xc'),auth['isAuthenticated'](),controller[_0xfd63('0x10')]);router['delete']('/:id',auth[_0xfd63('0xa')](),controller[_0xfd63('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index eaf0951..b514b04 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x165f=['INTEGER','STRING','sequelize','exports'];(function(_0x9acc89,_0x183869){var _0x245dfc=function(_0x3f0a6f){while(--_0x3f0a6f){_0x9acc89['push'](_0x9acc89['shift']());}};_0x245dfc(++_0x183869);}(_0x165f,0x12a));var _0xf165=function(_0x10f53b,_0x335a35){_0x10f53b=_0x10f53b-0x0;var _0x2e04d6=_0x165f[_0x10f53b];return _0x2e04d6;};'use strict';var Sequelize=require(_0xf165('0x0'));module[_0xf165('0x1')]={'CmContactId':{'type':Sequelize[_0xf165('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xf165('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x9420=['sequelize','exports'];(function(_0x1b76e6,_0x598520){var _0x333b53=function(_0x106e6a){while(--_0x106e6a){_0x1b76e6['push'](_0x1b76e6['shift']());}};_0x333b53(++_0x598520);}(_0x9420,0x186));var _0x0942=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x9420[_0x257642];return _0x3d813b;};'use strict';var Sequelize=require(_0x0942('0x0'));module[_0x0942('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index fb0d97c..b72b0c3 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d5c=['query','keys','model','attributes','intersection','fields','nolimit','order','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','findAll','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CmContactHasPhones','UserProfileResource','error','name','send','map','CmContactHasPhone','rawAttributes','type','key'];(function(_0x56072c,_0xbc1d04){var _0x487a84=function(_0x287723){while(--_0x287723){_0x56072c['push'](_0x56072c['shift']());}};_0x487a84(++_0xbc1d04);}(_0x6d5c,0x1e5));var _0xc6d5=function(_0x4b6e95,_0x1661e4){_0x4b6e95=_0x4b6e95-0x0;var _0x4db44f=_0x6d5c[_0x4b6e95];return _0x4db44f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc6d5('0x0'));var zipdir=require(_0xc6d5('0x1'));var jsonpatch=require(_0xc6d5('0x2'));var rp=require(_0xc6d5('0x3'));var moment=require(_0xc6d5('0x4'));var BPromise=require(_0xc6d5('0x5'));var Mustache=require('mustache');var util=require(_0xc6d5('0x6'));var path=require('path');var sox=require(_0xc6d5('0x7'));var csv=require(_0xc6d5('0x8'));var ejs=require(_0xc6d5('0x9'));var fs=require('fs');var _=require(_0xc6d5('0xa'));var squel=require(_0xc6d5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc6d5('0x8'));var querystring=require(_0xc6d5('0xc'));var Papa=require(_0xc6d5('0xd'));var Redis=require('ioredis');var authService=require(_0xc6d5('0xe'));var qs=require(_0xc6d5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6d5('0x10'));var logger=require(_0xc6d5('0x11'))(_0xc6d5('0x12'));var utils=require(_0xc6d5('0x13'));var config=require(_0xc6d5('0x14'));var db=require(_0xc6d5('0x15'))['db'];function respondWithStatusCode(_0x10a12a,_0x40f2a7){_0x40f2a7=_0x40f2a7||0xcc;return function(_0x24c77d){if(_0x24c77d){return _0x10a12a[_0xc6d5('0x16')](_0x40f2a7);}return _0x10a12a[_0xc6d5('0x17')](_0x40f2a7)[_0xc6d5('0x18')]();};}function respondWithResult(_0xbab59c,_0x57e81b){_0x57e81b=_0x57e81b||0xc8;return function(_0x4d9afd){if(_0x4d9afd){return _0xbab59c['status'](_0x57e81b)[_0xc6d5('0x19')](_0x4d9afd);}};}function respondWithFilteredResult(_0x42b8e4,_0x4b0301){return function(_0x3ab891){if(_0x3ab891){var _0x5339ca=_0x3ab891[_0xc6d5('0x1a')],_0x4692d2=_0x4b0301[_0xc6d5('0x1b')],_0x4538d1=_0x4b0301[_0xc6d5('0x1b')]+_0x4b0301[_0xc6d5('0x1c')],_0x34df91;if(_0x4538d1>=_0x5339ca){_0x4538d1=_0x5339ca;_0x34df91=0xc8;}else{_0x34df91=0xce;}_0x42b8e4[_0xc6d5('0x17')](_0x34df91);return _0x42b8e4[_0xc6d5('0x1d')](_0xc6d5('0x1e'),_0x4692d2+'-'+_0x4538d1+'/'+_0x5339ca)['json'](_0x3ab891);}return null;};}function patchUpdates(_0x399daa){return function(_0x302af1){try{jsonpatch['apply'](_0x302af1,_0x399daa,!![]);}catch(_0x25ff71){return BPromise[_0xc6d5('0x1f')](_0x25ff71);}return _0x302af1[_0xc6d5('0x20')]();};}function saveUpdates(_0x49f529,_0x448d15){return function(_0x57d2b6){if(_0x57d2b6){return _0x57d2b6[_0xc6d5('0x21')](_0x49f529)[_0xc6d5('0x22')](function(_0x19dc6d){return _0x19dc6d;});}return null;};}function removeEntity(_0x4bde16,_0x119545){return function(_0x55022d){if(_0x55022d){return _0x55022d[_0xc6d5('0x23')]()[_0xc6d5('0x22')](function(){var _0x1f3f42=_0x55022d[_0xc6d5('0x24')]({'plain':!![]});var _0x6fe200=_0xc6d5('0x25');return db[_0xc6d5('0x26')][_0xc6d5('0x23')]({'where':{'type':_0x6fe200,'resourceId':_0x1f3f42['id']}})['then'](function(){return _0x55022d;});})[_0xc6d5('0x22')](function(){_0x4bde16[_0xc6d5('0x17')](0xcc)[_0xc6d5('0x18')]();});}};}function handleEntityNotFound(_0x41aa44,_0x4df8ab){return function(_0xd71697){if(!_0xd71697){_0x41aa44[_0xc6d5('0x16')](0x194);}return _0xd71697;};}function handleError(_0x49894f,_0x40c3a4){_0x40c3a4=_0x40c3a4||0x1f4;return function(_0x55f93d){logger[_0xc6d5('0x27')](_0x55f93d['stack']);if(_0x55f93d[_0xc6d5('0x28')]){delete _0x55f93d['name'];}_0x49894f['status'](_0x40c3a4)[_0xc6d5('0x29')](_0x55f93d);};}exports['index']=function(_0x310bb1,_0x445a22){var _0x359bc3={},_0x39ffb3={},_0x310597={'count':0x0,'rows':[]};var _0x695289=_[_0xc6d5('0x2a')](db[_0xc6d5('0x2b')][_0xc6d5('0x2c')],function(_0x516e43){return{'name':_0x516e43['fieldName'],'type':_0x516e43[_0xc6d5('0x2d')][_0xc6d5('0x2e')]};});_0x39ffb3['model']=_['map'](_0x695289,'name');_0x39ffb3[_0xc6d5('0x2f')]=_[_0xc6d5('0x30')](_0x310bb1[_0xc6d5('0x2f')]);_0x39ffb3['filters']=_['intersection'](_0x39ffb3[_0xc6d5('0x31')],_0x39ffb3['query']);_0x359bc3[_0xc6d5('0x32')]=_[_0xc6d5('0x33')](_0x39ffb3[_0xc6d5('0x31')],qs[_0xc6d5('0x34')](_0x310bb1[_0xc6d5('0x2f')][_0xc6d5('0x34')]));_0x359bc3[_0xc6d5('0x32')]=_0x359bc3[_0xc6d5('0x32')]['length']?_0x359bc3[_0xc6d5('0x32')]:_0x39ffb3[_0xc6d5('0x31')];if(!_0x310bb1[_0xc6d5('0x2f')]['hasOwnProperty'](_0xc6d5('0x35'))){_0x359bc3['limit']=qs[_0xc6d5('0x1c')](_0x310bb1['query']['limit']);_0x359bc3[_0xc6d5('0x1b')]=qs[_0xc6d5('0x1b')](_0x310bb1[_0xc6d5('0x2f')][_0xc6d5('0x1b')]);}_0x359bc3[_0xc6d5('0x36')]=qs['sort'](_0x310bb1[_0xc6d5('0x2f')]['sort']);_0x359bc3[_0xc6d5('0x37')]=qs['filters'](_[_0xc6d5('0x38')](_0x310bb1[_0xc6d5('0x2f')],_0x39ffb3[_0xc6d5('0x39')]),_0x695289);if(_0x310bb1['query'][_0xc6d5('0x3a')]){_0x359bc3[_0xc6d5('0x37')]=_['merge'](_0x359bc3[_0xc6d5('0x37')],{'$or':_['map'](_0x695289,function(_0xfc23b1){if(_0xfc23b1[_0xc6d5('0x2d')]!==_0xc6d5('0x3b')){var _0x29b45c={};_0x29b45c[_0xfc23b1[_0xc6d5('0x28')]]={'$like':'%'+_0x310bb1[_0xc6d5('0x2f')][_0xc6d5('0x3a')]+'%'};return _0x29b45c;}})});}_0x359bc3=_[_0xc6d5('0x3c')]({},_0x359bc3,_0x310bb1['options']);var _0x100720={'where':_0x359bc3['where']};return db['CmContactHasPhone']['count'](_0x100720)[_0xc6d5('0x22')](function(_0x10454f){_0x310597['count']=_0x10454f;if(_0x310bb1['query'][_0xc6d5('0x3d')]){_0x359bc3[_0xc6d5('0x3e')]=[{'all':!![]}];}return db[_0xc6d5('0x2b')][_0xc6d5('0x3f')](_0x359bc3);})[_0xc6d5('0x22')](function(_0x7e8da9){_0x310597['rows']=_0x7e8da9;return _0x310597;})[_0xc6d5('0x22')](respondWithFilteredResult(_0x445a22,_0x359bc3))[_0xc6d5('0x40')](handleError(_0x445a22,null));};exports['show']=function(_0xeea757,_0x226d54){var _0x10694e={'raw':!![],'where':{'id':_0xeea757[_0xc6d5('0x41')]['id']}},_0x367268={};_0x367268[_0xc6d5('0x31')]=_['keys'](db[_0xc6d5('0x2b')]['rawAttributes']);_0x367268[_0xc6d5('0x2f')]=_[_0xc6d5('0x30')](_0xeea757[_0xc6d5('0x2f')]);_0x367268[_0xc6d5('0x39')]=_[_0xc6d5('0x33')](_0x367268[_0xc6d5('0x31')],_0x367268[_0xc6d5('0x2f')]);_0x10694e[_0xc6d5('0x32')]=_['intersection'](_0x367268[_0xc6d5('0x31')],qs[_0xc6d5('0x34')](_0xeea757['query']['fields']));_0x10694e['attributes']=_0x10694e['attributes'][_0xc6d5('0x42')]?_0x10694e[_0xc6d5('0x32')]:_0x367268[_0xc6d5('0x31')];if(_0xeea757[_0xc6d5('0x2f')][_0xc6d5('0x3d')]){_0x10694e[_0xc6d5('0x3e')]=[{'all':!![]}];}_0x10694e=_[_0xc6d5('0x3c')]({},_0x10694e,_0xeea757[_0xc6d5('0x43')]);return db[_0xc6d5('0x2b')][_0xc6d5('0x44')](_0x10694e)[_0xc6d5('0x22')](handleEntityNotFound(_0x226d54,null))[_0xc6d5('0x22')](respondWithResult(_0x226d54,null))['catch'](handleError(_0x226d54,null));};exports[_0xc6d5('0x45')]=function(_0x24c42c,_0x47982e){return db[_0xc6d5('0x2b')][_0xc6d5('0x45')](_0x24c42c[_0xc6d5('0x46')],{})[_0xc6d5('0x22')](function(_0x3f20fb){var _0x8bd7f6=_0x24c42c[_0xc6d5('0x47')][_0xc6d5('0x24')]({'plain':!![]});if(!_0x8bd7f6)throw new Error(_0xc6d5('0x48'));if(_0x8bd7f6[_0xc6d5('0x49')]===_0xc6d5('0x47')){var _0x45b5ae=_0x3f20fb[_0xc6d5('0x24')]({'plain':!![]});var _0x3db067=_0xc6d5('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3db067,'userProfileId':_0x8bd7f6[_0xc6d5('0x4a')]},'raw':!![]})[_0xc6d5('0x22')](function(_0x254a58){if(_0x254a58&&_0x254a58['autoAssociation']===0x0){return db[_0xc6d5('0x26')][_0xc6d5('0x45')]({'name':_0x45b5ae[_0xc6d5('0x28')],'resourceId':_0x45b5ae['id'],'type':_0x254a58['name'],'sectionId':_0x254a58['id']},{})['then'](function(){return _0x3f20fb;});}else{return _0x3f20fb;}})['catch'](function(_0x5022db){logger[_0xc6d5('0x27')](_0xc6d5('0x4b'),_0x5022db);throw _0x5022db;});}return _0x3f20fb;})[_0xc6d5('0x22')](respondWithResult(_0x47982e,0xc9))['catch'](handleError(_0x47982e,null));};exports[_0xc6d5('0x21')]=function(_0x7337ff,_0x407cb0){if(_0x7337ff[_0xc6d5('0x46')]['id']){delete _0x7337ff['body']['id'];}return db[_0xc6d5('0x2b')][_0xc6d5('0x44')]({'where':{'id':_0x7337ff[_0xc6d5('0x41')]['id']}})['then'](handleEntityNotFound(_0x407cb0,null))['then'](saveUpdates(_0x7337ff[_0xc6d5('0x46')],null))[_0xc6d5('0x22')](respondWithResult(_0x407cb0,null))[_0xc6d5('0x40')](handleError(_0x407cb0,null));};exports['destroy']=function(_0x488399,_0x4745e9){return db[_0xc6d5('0x2b')][_0xc6d5('0x44')]({'where':{'id':_0x488399[_0xc6d5('0x41')]['id']}})['then'](handleEntityNotFound(_0x4745e9,null))[_0xc6d5('0x22')](removeEntity(_0x4745e9,null))['catch'](handleError(_0x4745e9,null));}; \ No newline at end of file +var _0x328b=['moment','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','CmContactHasPhones','UserProfileResource','stack','name','map','CmContactHasPhone','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','include','catch','show','params','keys','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0xdb33e1,_0x1f19ec){var _0x3d077b=function(_0x4b758d){while(--_0x4b758d){_0xdb33e1['push'](_0xdb33e1['shift']());}};_0x3d077b(++_0x1f19ec);}(_0x328b,0x177));var _0xb328=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x328b[_0x22cc16];return _0x399b70;};'use strict';var pdf=require(_0xb328('0x0'));var emlformat=require(_0xb328('0x1'));var rimraf=require(_0xb328('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb328('0x3'));var rp=require(_0xb328('0x4'));var moment=require(_0xb328('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb328('0x6'));var util=require(_0xb328('0x7'));var path=require(_0xb328('0x8'));var sox=require(_0xb328('0x9'));var csv=require('to-csv');var ejs=require(_0xb328('0xa'));var fs=require('fs');var _=require(_0xb328('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb328('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb328('0xd'));var querystring=require(_0xb328('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb328('0xf'));var as=require(_0xb328('0x10'));var hardwareService=require(_0xb328('0x11'));var logger=require(_0xb328('0x12'))('api');var utils=require(_0xb328('0x13'));var config=require(_0xb328('0x14'));var db=require(_0xb328('0x15'))['db'];function respondWithStatusCode(_0x4f3ea0,_0x40bbc7){_0x40bbc7=_0x40bbc7||0xcc;return function(_0x561682){if(_0x561682){return _0x4f3ea0[_0xb328('0x16')](_0x40bbc7);}return _0x4f3ea0[_0xb328('0x17')](_0x40bbc7)[_0xb328('0x18')]();};}function respondWithResult(_0x36d519,_0xdf3eae){_0xdf3eae=_0xdf3eae||0xc8;return function(_0x1178f9){if(_0x1178f9){return _0x36d519[_0xb328('0x17')](_0xdf3eae)[_0xb328('0x19')](_0x1178f9);}};}function respondWithFilteredResult(_0x4ec101,_0x1f1dbe){return function(_0x4d2f2b){if(_0x4d2f2b){var _0x1bf23a=_0x4d2f2b[_0xb328('0x1a')],_0x3edd9a=_0x1f1dbe[_0xb328('0x1b')],_0x592431=_0x1f1dbe['offset']+_0x1f1dbe['limit'],_0x35d82e;if(_0x592431>=_0x1bf23a){_0x592431=_0x1bf23a;_0x35d82e=0xc8;}else{_0x35d82e=0xce;}_0x4ec101[_0xb328('0x17')](_0x35d82e);return _0x4ec101[_0xb328('0x1c')](_0xb328('0x1d'),_0x3edd9a+'-'+_0x592431+'/'+_0x1bf23a)['json'](_0x4d2f2b);}return null;};}function patchUpdates(_0x1272fb){return function(_0x3f4cea){try{jsonpatch[_0xb328('0x1e')](_0x3f4cea,_0x1272fb,!![]);}catch(_0x1a9ebc){return BPromise[_0xb328('0x1f')](_0x1a9ebc);}return _0x3f4cea[_0xb328('0x20')]();};}function saveUpdates(_0x358657,_0x25c4e7){return function(_0x28c5cd){if(_0x28c5cd){return _0x28c5cd[_0xb328('0x21')](_0x358657)['then'](function(_0x4d7d0a){return _0x4d7d0a;});}return null;};}function removeEntity(_0x2b12d1,_0x5c86bd){return function(_0x22efd7){if(_0x22efd7){return _0x22efd7[_0xb328('0x22')]()[_0xb328('0x23')](function(){var _0x5e35b0=_0x22efd7['get']({'plain':!![]});var _0x403be1=_0xb328('0x24');return db[_0xb328('0x25')][_0xb328('0x22')]({'where':{'type':_0x403be1,'resourceId':_0x5e35b0['id']}})[_0xb328('0x23')](function(){return _0x22efd7;});})[_0xb328('0x23')](function(){_0x2b12d1[_0xb328('0x17')](0xcc)[_0xb328('0x18')]();});}};}function handleEntityNotFound(_0x586655,_0x3d7e66){return function(_0x157e35){if(!_0x157e35){_0x586655[_0xb328('0x16')](0x194);}return _0x157e35;};}function handleError(_0x2c9248,_0x1060df){_0x1060df=_0x1060df||0x1f4;return function(_0x245c37){logger['error'](_0x245c37[_0xb328('0x26')]);if(_0x245c37[_0xb328('0x27')]){delete _0x245c37[_0xb328('0x27')];}_0x2c9248[_0xb328('0x17')](_0x1060df)['send'](_0x245c37);};}exports['index']=function(_0x1fcc84,_0x1bb20e){var _0x4e97e4={},_0x7f2246={},_0xa1fd84={'count':0x0,'rows':[]};var _0x27f419=_[_0xb328('0x28')](db[_0xb328('0x29')][_0xb328('0x2a')],function(_0x35f3b6){return{'name':_0x35f3b6['fieldName'],'type':_0x35f3b6[_0xb328('0x2b')]['key']};});_0x7f2246[_0xb328('0x2c')]=_[_0xb328('0x28')](_0x27f419,'name');_0x7f2246['query']=_['keys'](_0x1fcc84[_0xb328('0x2d')]);_0x7f2246[_0xb328('0x2e')]=_[_0xb328('0x2f')](_0x7f2246[_0xb328('0x2c')],_0x7f2246['query']);_0x4e97e4[_0xb328('0x30')]=_['intersection'](_0x7f2246[_0xb328('0x2c')],qs[_0xb328('0x31')](_0x1fcc84[_0xb328('0x2d')][_0xb328('0x31')]));_0x4e97e4['attributes']=_0x4e97e4['attributes'][_0xb328('0x32')]?_0x4e97e4[_0xb328('0x30')]:_0x7f2246[_0xb328('0x2c')];if(!_0x1fcc84[_0xb328('0x2d')][_0xb328('0x33')](_0xb328('0x34'))){_0x4e97e4['limit']=qs[_0xb328('0x35')](_0x1fcc84[_0xb328('0x2d')][_0xb328('0x35')]);_0x4e97e4[_0xb328('0x1b')]=qs[_0xb328('0x1b')](_0x1fcc84[_0xb328('0x2d')][_0xb328('0x1b')]);}_0x4e97e4['order']=qs['sort'](_0x1fcc84['query'][_0xb328('0x36')]);_0x4e97e4[_0xb328('0x37')]=qs[_0xb328('0x2e')](_[_0xb328('0x38')](_0x1fcc84[_0xb328('0x2d')],_0x7f2246[_0xb328('0x2e')]),_0x27f419);if(_0x1fcc84[_0xb328('0x2d')]['filter']){_0x4e97e4[_0xb328('0x37')]=_['merge'](_0x4e97e4[_0xb328('0x37')],{'$or':_[_0xb328('0x28')](_0x27f419,function(_0xf22dde){if(_0xf22dde['type']!=='VIRTUAL'){var _0x29dc3b={};_0x29dc3b[_0xf22dde[_0xb328('0x27')]]={'$like':'%'+_0x1fcc84['query']['filter']+'%'};return _0x29dc3b;}})});}_0x4e97e4=_[_0xb328('0x39')]({},_0x4e97e4,_0x1fcc84['options']);var _0x506694={'where':_0x4e97e4[_0xb328('0x37')]};return db[_0xb328('0x29')][_0xb328('0x1a')](_0x506694)[_0xb328('0x23')](function(_0x40baa8){_0xa1fd84[_0xb328('0x1a')]=_0x40baa8;if(_0x1fcc84[_0xb328('0x2d')]['includeAll']){_0x4e97e4[_0xb328('0x3a')]=[{'all':!![]}];}return db[_0xb328('0x29')]['findAll'](_0x4e97e4);})['then'](function(_0x229c08){_0xa1fd84['rows']=_0x229c08;return _0xa1fd84;})[_0xb328('0x23')](respondWithFilteredResult(_0x1bb20e,_0x4e97e4))[_0xb328('0x3b')](handleError(_0x1bb20e,null));};exports[_0xb328('0x3c')]=function(_0x418eed,_0x3af331){var _0x4fdd65={'raw':!![],'where':{'id':_0x418eed[_0xb328('0x3d')]['id']}},_0x3ba535={};_0x3ba535['model']=_[_0xb328('0x3e')](db[_0xb328('0x29')]['rawAttributes']);_0x3ba535[_0xb328('0x2d')]=_[_0xb328('0x3e')](_0x418eed[_0xb328('0x2d')]);_0x3ba535[_0xb328('0x2e')]=_['intersection'](_0x3ba535[_0xb328('0x2c')],_0x3ba535[_0xb328('0x2d')]);_0x4fdd65[_0xb328('0x30')]=_[_0xb328('0x2f')](_0x3ba535[_0xb328('0x2c')],qs[_0xb328('0x31')](_0x418eed['query'][_0xb328('0x31')]));_0x4fdd65['attributes']=_0x4fdd65[_0xb328('0x30')][_0xb328('0x32')]?_0x4fdd65[_0xb328('0x30')]:_0x3ba535[_0xb328('0x2c')];if(_0x418eed[_0xb328('0x2d')][_0xb328('0x3f')]){_0x4fdd65[_0xb328('0x3a')]=[{'all':!![]}];}_0x4fdd65=_[_0xb328('0x39')]({},_0x4fdd65,_0x418eed[_0xb328('0x40')]);return db[_0xb328('0x29')][_0xb328('0x41')](_0x4fdd65)[_0xb328('0x23')](handleEntityNotFound(_0x3af331,null))[_0xb328('0x23')](respondWithResult(_0x3af331,null))[_0xb328('0x3b')](handleError(_0x3af331,null));};exports[_0xb328('0x42')]=function(_0x4f7f0a,_0x258549){return db[_0xb328('0x29')]['create'](_0x4f7f0a[_0xb328('0x43')],{})[_0xb328('0x23')](function(_0x32d424){var _0x95075d=_0x4f7f0a[_0xb328('0x44')][_0xb328('0x45')]({'plain':!![]});if(!_0x95075d)throw new Error(_0xb328('0x46'));if(_0x95075d[_0xb328('0x47')]===_0xb328('0x44')){var _0x1fa2e0=_0x32d424[_0xb328('0x45')]({'plain':!![]});var _0x6463bb='CmContactHasPhones';return db['UserProfileSection'][_0xb328('0x41')]({'where':{'name':_0x6463bb,'userProfileId':_0x95075d[_0xb328('0x48')]},'raw':!![]})[_0xb328('0x23')](function(_0x836813){if(_0x836813&&_0x836813[_0xb328('0x49')]===0x0){return db[_0xb328('0x25')]['create']({'name':_0x1fa2e0[_0xb328('0x27')],'resourceId':_0x1fa2e0['id'],'type':_0x836813['name'],'sectionId':_0x836813['id']},{})[_0xb328('0x23')](function(){return _0x32d424;});}else{return _0x32d424;}})[_0xb328('0x3b')](function(_0x318291){logger[_0xb328('0x4a')](_0xb328('0x4b'),_0x318291);throw _0x318291;});}return _0x32d424;})[_0xb328('0x23')](respondWithResult(_0x258549,0xc9))[_0xb328('0x3b')](handleError(_0x258549,null));};exports[_0xb328('0x21')]=function(_0x3269be,_0x330017){if(_0x3269be[_0xb328('0x43')]['id']){delete _0x3269be[_0xb328('0x43')]['id'];}return db[_0xb328('0x29')][_0xb328('0x41')]({'where':{'id':_0x3269be['params']['id']}})[_0xb328('0x23')](handleEntityNotFound(_0x330017,null))[_0xb328('0x23')](saveUpdates(_0x3269be[_0xb328('0x43')],null))[_0xb328('0x23')](respondWithResult(_0x330017,null))[_0xb328('0x3b')](handleError(_0x330017,null));};exports['destroy']=function(_0x42d436,_0x2831aa){return db[_0xb328('0x29')][_0xb328('0x41')]({'where':{'id':_0x42d436[_0xb328('0x3d')]['id']}})[_0xb328('0x23')](handleEntityNotFound(_0x2831aa,null))[_0xb328('0x23')](removeEntity(_0x2831aa,null))[_0xb328('0x3b')](handleError(_0x2831aa,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 030bade..91968af 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6460=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','cm_contact_has_phones'];(function(_0x3f7b43,_0x32f087){var _0x327d40=function(_0x1fd5b8){while(--_0x1fd5b8){_0x3f7b43['push'](_0x3f7b43['shift']());}};_0x327d40(++_0x32f087);}(_0x6460,0xb4));var _0x0646=function(_0x34a62c,_0x353cbe){_0x34a62c=_0x34a62c-0x0;var _0x5c3f14=_0x6460[_0x34a62c];return _0x5c3f14;};'use strict';var _=require(_0x0646('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0646('0x1'));var BPromise=require(_0x0646('0x2'));var rp=require(_0x0646('0x3'));var fs=require('fs');var path=require(_0x0646('0x4'));var rimraf=require(_0x0646('0x5'));var config=require(_0x0646('0x6'));var attributes=require(_0x0646('0x7'));module[_0x0646('0x8')]=function(_0x577663,_0x4a0b87){return _0x577663['define']('CmContactHasPhone',attributes,{'tableName':_0x0646('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c95=['rimraf','../../config/environment','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x56ae45,_0x537cd6){var _0x1c617d=function(_0x498d59){while(--_0x498d59){_0x56ae45['push'](_0x56ae45['shift']());}};_0x1c617d(++_0x537cd6);}(_0x4c95,0x180));var _0x54c9=function(_0xfbbb2d,_0x40e739){_0xfbbb2d=_0xfbbb2d-0x0;var _0xa2c3b9=_0x4c95[_0xfbbb2d];return _0xa2c3b9;};'use strict';var _=require(_0x54c9('0x0'));var util=require(_0x54c9('0x1'));var logger=require(_0x54c9('0x2'))(_0x54c9('0x3'));var moment=require(_0x54c9('0x4'));var BPromise=require(_0x54c9('0x5'));var rp=require(_0x54c9('0x6'));var fs=require('fs');var path=require(_0x54c9('0x7'));var rimraf=require(_0x54c9('0x8'));var config=require(_0x54c9('0x9'));var attributes=require('./cmContactHasPhone.attributes');module[_0x54c9('0xa')]=function(_0x558793,_0x4fa817){return _0x558793[_0x54c9('0xb')](_0x54c9('0xc'),attributes,{'tableName':_0x54c9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index 4272366..f4e9e9d 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d55=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch'];(function(_0x32736f,_0x37e3f8){var _0x36e049=function(_0x54b013){while(--_0x54b013){_0x32736f['push'](_0x32736f['shift']());}};_0x36e049(++_0x37e3f8);}(_0x9d55,0x1b9));var _0x59d5=function(_0x51564e,_0x12ef79){_0x51564e=_0x51564e-0x0;var _0x31d941=_0x9d55[_0x51564e];return _0x31d941;};'use strict';var _=require(_0x59d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x59d5('0x1'));var rs=require(_0x59d5('0x2'));var fs=require('fs');var Redis=require(_0x59d5('0x3'));var db=require(_0x59d5('0x4'))['db'];var utils=require(_0x59d5('0x5'));var logger=require(_0x59d5('0x6'))('rpc');var config=require(_0x59d5('0x7'));var jayson=require(_0x59d5('0x8'));var client=jayson['client'][_0x59d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e507,_0x4e6eca,_0x49fe41){return new BPromise(function(_0x416c50,_0x461340){return client[_0x59d5('0xa')](_0x4e507,_0x49fe41)[_0x59d5('0xb')](function(_0x3a33a6){logger['info'](_0x59d5('0xc'),_0x4e6eca,_0x59d5('0xd'));logger['debug'](_0x59d5('0xe'),_0x4e6eca,'request\x20sent',JSON['stringify'](_0x3a33a6));if(_0x3a33a6['error']){if(_0x3a33a6['error'][_0x59d5('0xf')]===0x1f4){logger['error'](_0x59d5('0xc'),_0x4e6eca,_0x3a33a6[_0x59d5('0x10')][_0x59d5('0x11')]);return _0x461340(_0x3a33a6[_0x59d5('0x10')][_0x59d5('0x11')]);}logger['error'](_0x59d5('0xc'),_0x4e6eca,_0x3a33a6['error'][_0x59d5('0x11')]);return _0x416c50(_0x3a33a6[_0x59d5('0x10')]['message']);}else{logger[_0x59d5('0x12')](_0x59d5('0xc'),_0x4e6eca,'request\x20sent');_0x416c50(_0x3a33a6[_0x59d5('0x13')][_0x59d5('0x11')]);}})[_0x59d5('0x14')](function(_0x5d6c39){logger[_0x59d5('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x4e6eca,_0x5d6c39);_0x461340(_0x5d6c39);});});} \ No newline at end of file +var _0x32f4=['info','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4da28f,_0x164324){var _0xe49192=function(_0x29fdfc){while(--_0x29fdfc){_0x4da28f['push'](_0x4da28f['shift']());}};_0xe49192(++_0x164324);}(_0x32f4,0x154));var _0x432f=function(_0x29d484,_0x299e6d){_0x29d484=_0x29d484-0x0;var _0x19b633=_0x32f4[_0x29d484];return _0x19b633;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('CmContactHasPhone,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 66f70e4..0c8efde 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c22=['get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmContactHasPhone.controller'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4c22,0x16e));var _0x24c2=function(_0x1aae70,_0x2ae006){_0x1aae70=_0x1aae70-0x0;var _0x562a4e=_0x4c22[_0x1aae70];return _0x562a4e;};'use strict';var multer=require(_0x24c2('0x0'));var util=require(_0x24c2('0x1'));var path=require(_0x24c2('0x2'));var timeout=require(_0x24c2('0x3'));var express=require(_0x24c2('0x4'));var router=express[_0x24c2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x24c2('0x6'));var config=require('../../config/environment');var controller=require(_0x24c2('0x7'));router[_0x24c2('0x8')]('/',auth[_0x24c2('0x9')](),controller['index']);router[_0x24c2('0x8')]('/:id',auth[_0x24c2('0x9')](),controller['show']);router[_0x24c2('0xa')]('/',auth[_0x24c2('0x9')](),controller['create']);router[_0x24c2('0xb')](_0x24c2('0xc'),auth[_0x24c2('0x9')](),controller[_0x24c2('0xd')]);router[_0x24c2('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x24c2('0xf')]);module[_0x24c2('0x10')]=router; \ No newline at end of file +var _0x0019=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer'];(function(_0x54da5c,_0x58832f){var _0x3301ba=function(_0x3ca43b){while(--_0x3ca43b){_0x54da5c['push'](_0x54da5c['shift']());}};_0x3301ba(++_0x58832f);}(_0x0019,0x11f));var _0x9001=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x0019[_0xaa6a4];return _0xdc31a4;};'use strict';var multer=require(_0x9001('0x0'));var util=require(_0x9001('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9001('0x2'));var router=express[_0x9001('0x3')]();var auth=require(_0x9001('0x4'));var interaction=require(_0x9001('0x5'));var config=require(_0x9001('0x6'));var controller=require(_0x9001('0x7'));router[_0x9001('0x8')]('/',auth['isAuthenticated'](),controller[_0x9001('0x9')]);router[_0x9001('0x8')](_0x9001('0xa'),auth[_0x9001('0xb')](),controller[_0x9001('0xc')]);router[_0x9001('0xd')]('/',auth[_0x9001('0xb')](),controller[_0x9001('0xe')]);router[_0x9001('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9001('0x10')]('/:id',auth[_0x9001('0xb')](),controller['destroy']);module[_0x9001('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index e11d52f..010c058 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 _0xfe08=['getDataValue','alias','STRING','setDataValue','name','long','type','select','parse','values','isArray','BOOLEAN','sequelize','exports','VIRTUAL'];(function(_0x9e54e0,_0x560c3c){var _0x512f5b=function(_0x2f1892){while(--_0x2f1892){_0x9e54e0['push'](_0x9e54e0['shift']());}};_0x512f5b(++_0x560c3c);}(_0xfe08,0x147));var _0x8fe0=function(_0x264136,_0x22508f){_0x264136=_0x264136-0x0;var _0x414056=_0xfe08[_0x264136];return _0x414056;};'use strict';var Sequelize=require(_0x8fe0('0x0'));var _=require('lodash');module[_0x8fe0('0x1')]={'name':{'type':Sequelize[_0x8fe0('0x2')],'get':function(_0x125551){return this[_0x8fe0('0x3')](_0x8fe0('0x4'));}},'alias':{'type':Sequelize[_0x8fe0('0x5')],'allowNull':![],'set':function(_0x1c2cb4){this[_0x8fe0('0x6')](_0x8fe0('0x4'),_0x1c2cb4?_0x1c2cb4:this['getDataValue'](_0x8fe0('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x8fe0('0x8')),'get':function(){if(this[_0x8fe0('0x3')](_0x8fe0('0x9'))===_0x8fe0('0xa')){return JSON[_0x8fe0('0xb')](this['getDataValue'](_0x8fe0('0xc')));}else{return this[_0x8fe0('0x3')](_0x8fe0('0xc'));}},'set':function(_0x5968a9){if(Array[_0x8fe0('0xd')](_0x5968a9)){this['setDataValue'](_0x8fe0('0xc'),JSON['stringify'](_0x5968a9));}else{this[_0x8fe0('0x6')](_0x8fe0('0xc'),_0x5968a9);}}},'required':{'type':Sequelize[_0x8fe0('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x6245=['long','type','parse','values','isArray','BOOLEAN','sequelize','lodash','VIRTUAL','getDataValue','setDataValue','alias','STRING','TEXT'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x6245,0x19c));var _0x5624=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0x6245[_0x2dd22e];return _0x257b01;};'use strict';var Sequelize=require(_0x5624('0x0'));var _=require(_0x5624('0x1'));module['exports']={'name':{'type':Sequelize[_0x5624('0x2')],'get':function(_0x2cd82e){return this[_0x5624('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x463504){this[_0x5624('0x4')](_0x5624('0x5'),_0x463504?_0x463504:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x5624('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x5624('0x7')](_0x5624('0x8')),'get':function(){if(this[_0x5624('0x3')](_0x5624('0x9'))==='select'){return JSON[_0x5624('0xa')](this[_0x5624('0x3')](_0x5624('0xb')));}else{return this['getDataValue'](_0x5624('0xb'));}},'set':function(_0x23eeb3){if(Array[_0x5624('0xc')](_0x23eeb3)){this[_0x5624('0x4')](_0x5624('0xb'),JSON['stringify'](_0x23eeb3));}else{this[_0x5624('0x4')](_0x5624('0xb'),_0x23eeb3);}}},'required':{'type':Sequelize[_0x5624('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 3736985..b296bc1 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 _0x9891=['offset','order','sort','pick','filter','where','options','count','includeAll','include','findAll','rows','show','params','fields','length','merge','catch','body','find','destroy','sequelize','create','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','set','Content-Range','json','reject','save','update','then','error','name','index','map','CmCustomField','rawAttributes','fieldName','type','differenceBy','query','keys','filters','intersection','model','attributes','hasOwnProperty','limit'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x9891,0x73));var _0x1989=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0x9891[_0x15cae3];return _0x20596f;};'use strict';var pdf=require(_0x1989('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1989('0x1'));var zipdir=require(_0x1989('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1989('0x3'));var BPromise=require(_0x1989('0x4'));var Mustache=require('mustache');var util=require(_0x1989('0x5'));var path=require(_0x1989('0x6'));var sox=require(_0x1989('0x7'));var csv=require(_0x1989('0x8'));var ejs=require(_0x1989('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1989('0xa'));var jsforce=require(_0x1989('0xb'));var deskjs=require(_0x1989('0xc'));var toCsv=require(_0x1989('0x8'));var querystring=require(_0x1989('0xd'));var Papa=require(_0x1989('0xe'));var Redis=require('ioredis');var authService=require(_0x1989('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1989('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1989('0x11'))(_0x1989('0x12'));var utils=require('../../config/utils');var config=require(_0x1989('0x13'));var db=require(_0x1989('0x14'))['db'];function respondWithStatusCode(_0x31f947,_0x3e1302){_0x3e1302=_0x3e1302||0xcc;return function(_0x4f2d64){if(_0x4f2d64){return _0x31f947[_0x1989('0x15')](_0x3e1302);}return _0x31f947[_0x1989('0x16')](_0x3e1302)['end']();};}function respondWithResult(_0x24fd27,_0x323a1e){_0x323a1e=_0x323a1e||0xc8;return function(_0x5cb500){if(_0x5cb500){return _0x24fd27['status'](_0x323a1e)['json'](_0x5cb500);}};}function respondWithFilteredResult(_0x56b4b3,_0x203d30){return function(_0x2f4297){if(_0x2f4297){var _0x563e81=_0x2f4297['count'],_0x422d20=_0x203d30['offset'],_0x39c8cb=_0x203d30['offset']+_0x203d30['limit'],_0x364a31;if(_0x39c8cb>=_0x563e81){_0x39c8cb=_0x563e81;_0x364a31=0xc8;}else{_0x364a31=0xce;}_0x56b4b3['status'](_0x364a31);return _0x56b4b3[_0x1989('0x17')](_0x1989('0x18'),_0x422d20+'-'+_0x39c8cb+'/'+_0x563e81)[_0x1989('0x19')](_0x2f4297);}return null;};}function patchUpdates(_0xb5dc38){return function(_0x347d89){try{jsonpatch['apply'](_0x347d89,_0xb5dc38,!![]);}catch(_0x491c4c){return BPromise[_0x1989('0x1a')](_0x491c4c);}return _0x347d89[_0x1989('0x1b')]();};}function saveUpdates(_0x232400,_0x2d3ba4){return function(_0x84ee8c){if(_0x84ee8c){return _0x84ee8c[_0x1989('0x1c')](_0x232400)[_0x1989('0x1d')](function(_0x428a35){return _0x428a35;});}return null;};}function removeEntity(_0x21d60b,_0x4ff740){return function(_0x4e6123){if(_0x4e6123){return _0x4e6123['destroy']()['then'](function(){_0x21d60b[_0x1989('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6cd7f6,_0x187a7d){return function(_0x1b609c){if(!_0x1b609c){_0x6cd7f6['sendStatus'](0x194);}return _0x1b609c;};}function handleError(_0x4efa77,_0x15742b){_0x15742b=_0x15742b||0x1f4;return function(_0x159fa2){logger[_0x1989('0x1e')](_0x159fa2['stack']);if(_0x159fa2[_0x1989('0x1f')]){delete _0x159fa2[_0x1989('0x1f')];}_0x4efa77[_0x1989('0x16')](_0x15742b)['send'](_0x159fa2);};}exports[_0x1989('0x20')]=function(_0x4c7623,_0x4c84e9){var _0x179b32={},_0x281df3={},_0x5bb346={'count':0x0,'rows':[]};var _0x26b9de=_[_0x1989('0x21')](db[_0x1989('0x22')][_0x1989('0x23')],function(_0x20f1c1){return{'name':_0x20f1c1[_0x1989('0x24')],'type':_0x20f1c1[_0x1989('0x25')]['key']};});_0x281df3['model']=_[_0x1989('0x26')](_[_0x1989('0x21')](_0x26b9de,_0x1989('0x1f')),[_0x1989('0x1f')]);_0x281df3[_0x1989('0x27')]=_[_0x1989('0x28')](_0x4c7623[_0x1989('0x27')]);_0x281df3[_0x1989('0x29')]=_[_0x1989('0x2a')](_0x281df3[_0x1989('0x2b')],_0x281df3['query']);_0x179b32[_0x1989('0x2c')]=_[_0x1989('0x2a')](_0x281df3[_0x1989('0x2b')],qs['fields'](_0x4c7623['query']['fields']));_0x179b32[_0x1989('0x2c')]=_0x179b32[_0x1989('0x2c')]['length']?_0x179b32[_0x1989('0x2c')]:_0x281df3[_0x1989('0x2b')];if(!_0x4c7623['query'][_0x1989('0x2d')]('nolimit')){_0x179b32['limit']=qs[_0x1989('0x2e')](_0x4c7623[_0x1989('0x27')][_0x1989('0x2e')]);_0x179b32[_0x1989('0x2f')]=qs[_0x1989('0x2f')](_0x4c7623[_0x1989('0x27')][_0x1989('0x2f')]);}_0x179b32[_0x1989('0x30')]=qs[_0x1989('0x31')](_0x4c7623['query'][_0x1989('0x31')]);_0x179b32['where']=qs['filters'](_[_0x1989('0x32')](_0x4c7623[_0x1989('0x27')],_0x281df3[_0x1989('0x29')]),_0x26b9de);if(_0x4c7623[_0x1989('0x27')][_0x1989('0x33')]){_0x179b32[_0x1989('0x34')]=_['merge'](_0x179b32['where'],{'$or':_[_0x1989('0x21')](_0x26b9de,function(_0x106b7e){if(_0x106b7e[_0x1989('0x25')]!=='VIRTUAL'){var _0x5c945a={};_0x5c945a[_0x106b7e[_0x1989('0x1f')]]={'$like':'%'+_0x4c7623['query'][_0x1989('0x33')]+'%'};return _0x5c945a;}})});}_0x179b32=_['merge']({},_0x179b32,_0x4c7623[_0x1989('0x35')]);var _0x111344={'where':_0x179b32[_0x1989('0x34')]};return db[_0x1989('0x22')][_0x1989('0x36')](_0x111344)[_0x1989('0x1d')](function(_0x2b3ba6){_0x5bb346[_0x1989('0x36')]=_0x2b3ba6;if(_0x4c7623[_0x1989('0x27')][_0x1989('0x37')]){_0x179b32[_0x1989('0x38')]=[{'all':!![]}];}return db[_0x1989('0x22')][_0x1989('0x39')](_0x179b32);})[_0x1989('0x1d')](function(_0x1e659f){_0x5bb346[_0x1989('0x3a')]=_0x1e659f;return _0x5bb346;})[_0x1989('0x1d')](respondWithFilteredResult(_0x4c84e9,_0x179b32))['catch'](handleError(_0x4c84e9,null));};exports[_0x1989('0x3b')]=function(_0x5fd059,_0x3d9b09){var _0x242f63={'raw':!![],'where':{'id':_0x5fd059[_0x1989('0x3c')]['id']}},_0x4cd471={};_0x4cd471['model']=_[_0x1989('0x28')](db[_0x1989('0x22')][_0x1989('0x23')]);_0x4cd471[_0x1989('0x27')]=_[_0x1989('0x28')](_0x5fd059[_0x1989('0x27')]);_0x4cd471[_0x1989('0x29')]=_['intersection'](_0x4cd471['model'],_0x4cd471[_0x1989('0x27')]);_0x242f63['attributes']=_[_0x1989('0x2a')](_0x4cd471[_0x1989('0x2b')],qs[_0x1989('0x3d')](_0x5fd059[_0x1989('0x27')][_0x1989('0x3d')]));_0x242f63[_0x1989('0x2c')]=_0x242f63[_0x1989('0x2c')][_0x1989('0x3e')]?_0x242f63[_0x1989('0x2c')]:_0x4cd471[_0x1989('0x2b')];if(_0x5fd059[_0x1989('0x27')][_0x1989('0x37')]){_0x242f63[_0x1989('0x38')]=[{'all':!![]}];}_0x242f63=_[_0x1989('0x3f')]({},_0x242f63,_0x5fd059['options']);return db['CmCustomField']['find'](_0x242f63)[_0x1989('0x1d')](handleEntityNotFound(_0x3d9b09,null))['then'](respondWithResult(_0x3d9b09,null))[_0x1989('0x40')](handleError(_0x3d9b09,null));};exports[_0x1989('0x1c')]=function(_0x2c2f60,_0x2ca024){if(_0x2c2f60[_0x1989('0x41')]['id']){delete _0x2c2f60[_0x1989('0x41')]['id'];}return db[_0x1989('0x22')][_0x1989('0x42')]({'where':{'id':_0x2c2f60['params']['id']}})[_0x1989('0x1d')](handleEntityNotFound(_0x2ca024,null))[_0x1989('0x1d')](saveUpdates(_0x2c2f60[_0x1989('0x41')],null))['then'](respondWithResult(_0x2ca024,null))['catch'](handleError(_0x2ca024,null));};exports[_0x1989('0x43')]=function(_0xb4de5a,_0x18528c){return db[_0x1989('0x22')][_0x1989('0x42')]({'where':{'id':_0xb4de5a['params']['id']}})['then'](handleEntityNotFound(_0x18528c,null))[_0x1989('0x1d')](removeEntity(_0x18528c,null))[_0x1989('0x40')](handleError(_0x18528c,null));};exports['create']=function(_0x2e7f06,_0x5d5942){var _0x16b747;return db[_0x1989('0x44')]['transaction'](function(_0x5c7947){return db[_0x1989('0x22')][_0x1989('0x45')](_0x2e7f06[_0x1989('0x41')],{'transaction':_0x5c7947})[_0x1989('0x1d')](function(_0xd43099){_0x16b747=_0xd43099;var _0x5daec7={'type':db[_0x1989('0x46')][_0x1989('0x47')],'transaction':_0x5c7947};switch(_0x2e7f06[_0x1989('0x41')][_0x1989('0x25')]){case'text':_0x5daec7[_0x1989('0x25')]=db[_0x1989('0x46')]['TEXT'];break;case _0x1989('0x48'):_0x5daec7['type']=db[_0x1989('0x46')][_0x1989('0x49')];break;case _0x1989('0x4a'):_0x5daec7['type']=db[_0x1989('0x46')][_0x1989('0x4b')];_0x5daec7[_0x1989('0x4c')]=![];break;default:}return db[_0x1989('0x44')][_0x1989('0x4d')][_0x1989('0x4e')](_0x1989('0x4f'),util['format'](_0x1989('0x50'),_0x16b747['id']),_0x5daec7);})[_0x1989('0x1d')](function(){return _0x16b747;});})[_0x1989('0x1d')](respondWithResult(_0x5d5942,0xc9))[_0x1989('0x40')](handleError(_0x5d5942,null));}; \ No newline at end of file +var _0x207d=['format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','type','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmCustomField','includeAll','rows','catch','show','params','include','find','body','destroy','create','sequelize','transaction','TEXT','number','Sequelize','INTEGER','switch','queryInterface','addColumn','cm_contacts'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x207d,0xa9));var _0xd207=function(_0x621683,_0x188675){_0x621683=_0x621683-0x0;var _0x49e6a8=_0x207d[_0x621683];return _0x49e6a8;};'use strict';var pdf=require(_0xd207('0x0'));var emlformat=require(_0xd207('0x1'));var rimraf=require(_0xd207('0x2'));var zipdir=require(_0xd207('0x3'));var jsonpatch=require(_0xd207('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd207('0x5'));var Mustache=require('mustache');var util=require(_0xd207('0x6'));var path=require('path');var sox=require(_0xd207('0x7'));var csv=require(_0xd207('0x8'));var ejs=require(_0xd207('0x9'));var fs=require('fs');var _=require(_0xd207('0xa'));var squel=require(_0xd207('0xb'));var crypto=require(_0xd207('0xc'));var jsforce=require(_0xd207('0xd'));var deskjs=require(_0xd207('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd207('0xf'));var Redis=require(_0xd207('0x10'));var authService=require(_0xd207('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd207('0x12'));var hardwareService=require(_0xd207('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd207('0x14'));var config=require(_0xd207('0x15'));var db=require(_0xd207('0x16'))['db'];function respondWithStatusCode(_0x45bfa2,_0x50166c){_0x50166c=_0x50166c||0xcc;return function(_0x19b12f){if(_0x19b12f){return _0x45bfa2['sendStatus'](_0x50166c);}return _0x45bfa2[_0xd207('0x17')](_0x50166c)[_0xd207('0x18')]();};}function respondWithResult(_0x45c303,_0x4cb75e){_0x4cb75e=_0x4cb75e||0xc8;return function(_0x5d38b5){if(_0x5d38b5){return _0x45c303[_0xd207('0x17')](_0x4cb75e)['json'](_0x5d38b5);}};}function respondWithFilteredResult(_0x35dbe3,_0xee04c7){return function(_0x1b1045){if(_0x1b1045){var _0x3af924=_0x1b1045[_0xd207('0x19')],_0x1bd1af=_0xee04c7[_0xd207('0x1a')],_0x35b300=_0xee04c7[_0xd207('0x1a')]+_0xee04c7[_0xd207('0x1b')],_0x4affc6;if(_0x35b300>=_0x3af924){_0x35b300=_0x3af924;_0x4affc6=0xc8;}else{_0x4affc6=0xce;}_0x35dbe3[_0xd207('0x17')](_0x4affc6);return _0x35dbe3[_0xd207('0x1c')]('Content-Range',_0x1bd1af+'-'+_0x35b300+'/'+_0x3af924)[_0xd207('0x1d')](_0x1b1045);}return null;};}function patchUpdates(_0x300269){return function(_0x2e5543){try{jsonpatch[_0xd207('0x1e')](_0x2e5543,_0x300269,!![]);}catch(_0x5b8de6){return BPromise[_0xd207('0x1f')](_0x5b8de6);}return _0x2e5543[_0xd207('0x20')]();};}function saveUpdates(_0x185748,_0x12750e){return function(_0x12c518){if(_0x12c518){return _0x12c518[_0xd207('0x21')](_0x185748)['then'](function(_0x3160c1){return _0x3160c1;});}return null;};}function removeEntity(_0x1296ca,_0xac60ae){return function(_0x12b983){if(_0x12b983){return _0x12b983['destroy']()[_0xd207('0x22')](function(){_0x1296ca[_0xd207('0x17')](0xcc)[_0xd207('0x18')]();});}};}function handleEntityNotFound(_0x12e280,_0x181f0f){return function(_0x20cadd){if(!_0x20cadd){_0x12e280[_0xd207('0x23')](0x194);}return _0x20cadd;};}function handleError(_0xf6c632,_0xb74238){_0xb74238=_0xb74238||0x1f4;return function(_0x209013){logger[_0xd207('0x24')](_0x209013[_0xd207('0x25')]);if(_0x209013['name']){delete _0x209013[_0xd207('0x26')];}_0xf6c632['status'](_0xb74238)[_0xd207('0x27')](_0x209013);};}exports['index']=function(_0x1601e0,_0x3a197c){var _0x46937f={},_0x2d2022={},_0x9054ea={'count':0x0,'rows':[]};var _0x59f170=_['map'](db['CmCustomField'][_0xd207('0x28')],function(_0x2f5f4d){return{'name':_0x2f5f4d[_0xd207('0x29')],'type':_0x2f5f4d[_0xd207('0x2a')]['key']};});_0x2d2022[_0xd207('0x2b')]=_[_0xd207('0x2c')](_[_0xd207('0x2d')](_0x59f170,'name'),[_0xd207('0x26')]);_0x2d2022[_0xd207('0x2e')]=_[_0xd207('0x2f')](_0x1601e0[_0xd207('0x2e')]);_0x2d2022[_0xd207('0x30')]=_[_0xd207('0x31')](_0x2d2022[_0xd207('0x2b')],_0x2d2022[_0xd207('0x2e')]);_0x46937f[_0xd207('0x32')]=_[_0xd207('0x31')](_0x2d2022[_0xd207('0x2b')],qs[_0xd207('0x33')](_0x1601e0[_0xd207('0x2e')]['fields']));_0x46937f[_0xd207('0x32')]=_0x46937f['attributes'][_0xd207('0x34')]?_0x46937f[_0xd207('0x32')]:_0x2d2022[_0xd207('0x2b')];if(!_0x1601e0['query'][_0xd207('0x35')](_0xd207('0x36'))){_0x46937f['limit']=qs[_0xd207('0x1b')](_0x1601e0[_0xd207('0x2e')][_0xd207('0x1b')]);_0x46937f['offset']=qs[_0xd207('0x1a')](_0x1601e0['query'][_0xd207('0x1a')]);}_0x46937f[_0xd207('0x37')]=qs[_0xd207('0x38')](_0x1601e0[_0xd207('0x2e')]['sort']);_0x46937f[_0xd207('0x39')]=qs[_0xd207('0x30')](_['pick'](_0x1601e0['query'],_0x2d2022[_0xd207('0x30')]),_0x59f170);if(_0x1601e0['query'][_0xd207('0x3a')]){_0x46937f[_0xd207('0x39')]=_[_0xd207('0x3b')](_0x46937f['where'],{'$or':_[_0xd207('0x2d')](_0x59f170,function(_0x463f11){if(_0x463f11['type']!==_0xd207('0x3c')){var _0xeee0c9={};_0xeee0c9[_0x463f11[_0xd207('0x26')]]={'$like':'%'+_0x1601e0[_0xd207('0x2e')][_0xd207('0x3a')]+'%'};return _0xeee0c9;}})});}_0x46937f=_[_0xd207('0x3b')]({},_0x46937f,_0x1601e0[_0xd207('0x3d')]);var _0xfbae2f={'where':_0x46937f['where']};return db[_0xd207('0x3e')][_0xd207('0x19')](_0xfbae2f)[_0xd207('0x22')](function(_0x4452bb){_0x9054ea[_0xd207('0x19')]=_0x4452bb;if(_0x1601e0[_0xd207('0x2e')][_0xd207('0x3f')]){_0x46937f['include']=[{'all':!![]}];}return db[_0xd207('0x3e')]['findAll'](_0x46937f);})[_0xd207('0x22')](function(_0x400ecc){_0x9054ea[_0xd207('0x40')]=_0x400ecc;return _0x9054ea;})[_0xd207('0x22')](respondWithFilteredResult(_0x3a197c,_0x46937f))[_0xd207('0x41')](handleError(_0x3a197c,null));};exports[_0xd207('0x42')]=function(_0x32a0b2,_0x5fc348){var _0x163de6={'raw':!![],'where':{'id':_0x32a0b2[_0xd207('0x43')]['id']}},_0xfb021f={};_0xfb021f[_0xd207('0x2b')]=_['keys'](db['CmCustomField'][_0xd207('0x28')]);_0xfb021f[_0xd207('0x2e')]=_[_0xd207('0x2f')](_0x32a0b2[_0xd207('0x2e')]);_0xfb021f['filters']=_[_0xd207('0x31')](_0xfb021f[_0xd207('0x2b')],_0xfb021f[_0xd207('0x2e')]);_0x163de6['attributes']=_[_0xd207('0x31')](_0xfb021f['model'],qs[_0xd207('0x33')](_0x32a0b2[_0xd207('0x2e')][_0xd207('0x33')]));_0x163de6[_0xd207('0x32')]=_0x163de6[_0xd207('0x32')]['length']?_0x163de6[_0xd207('0x32')]:_0xfb021f['model'];if(_0x32a0b2[_0xd207('0x2e')][_0xd207('0x3f')]){_0x163de6[_0xd207('0x44')]=[{'all':!![]}];}_0x163de6=_['merge']({},_0x163de6,_0x32a0b2[_0xd207('0x3d')]);return db['CmCustomField'][_0xd207('0x45')](_0x163de6)[_0xd207('0x22')](handleEntityNotFound(_0x5fc348,null))[_0xd207('0x22')](respondWithResult(_0x5fc348,null))[_0xd207('0x41')](handleError(_0x5fc348,null));};exports[_0xd207('0x21')]=function(_0x2bf648,_0x243707){if(_0x2bf648[_0xd207('0x46')]['id']){delete _0x2bf648['body']['id'];}return db[_0xd207('0x3e')][_0xd207('0x45')]({'where':{'id':_0x2bf648['params']['id']}})[_0xd207('0x22')](handleEntityNotFound(_0x243707,null))[_0xd207('0x22')](saveUpdates(_0x2bf648[_0xd207('0x46')],null))['then'](respondWithResult(_0x243707,null))['catch'](handleError(_0x243707,null));};exports[_0xd207('0x47')]=function(_0x316349,_0x111adf){return db[_0xd207('0x3e')][_0xd207('0x45')]({'where':{'id':_0x316349[_0xd207('0x43')]['id']}})[_0xd207('0x22')](handleEntityNotFound(_0x111adf,null))['then'](removeEntity(_0x111adf,null))[_0xd207('0x41')](handleError(_0x111adf,null));};exports[_0xd207('0x48')]=function(_0x3dceec,_0x5e8531){var _0x459c09;return db[_0xd207('0x49')][_0xd207('0x4a')](function(_0x345fff){return db[_0xd207('0x3e')][_0xd207('0x48')](_0x3dceec['body'],{'transaction':_0x345fff})['then'](function(_0x2539b8){_0x459c09=_0x2539b8;var _0x2b56cb={'type':db['Sequelize'][_0xd207('0x4b')],'transaction':_0x345fff};switch(_0x3dceec[_0xd207('0x46')]['type']){case'text':_0x2b56cb[_0xd207('0x2a')]=db['Sequelize'][_0xd207('0x4b')];break;case _0xd207('0x4c'):_0x2b56cb['type']=db[_0xd207('0x4d')][_0xd207('0x4e')];break;case _0xd207('0x4f'):_0x2b56cb[_0xd207('0x2a')]=db[_0xd207('0x4d')]['BOOLEAN'];_0x2b56cb['defaultValue']=![];break;default:}return db[_0xd207('0x49')][_0xd207('0x50')][_0xd207('0x51')](_0xd207('0x52'),util[_0xd207('0x53')]('cf_%d',_0x459c09['id']),_0x2b56cb);})[_0xd207('0x22')](function(){return _0x459c09;});})[_0xd207('0x22')](respondWithResult(_0x5e8531,0xc9))['catch'](handleError(_0x5e8531,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 0bcc009..58f0d91 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 _0xb7e7=['CmCustomField','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','define'];(function(_0x535e0a,_0x40004e){var _0x55666d=function(_0x5f363a){while(--_0x5f363a){_0x535e0a['push'](_0x535e0a['shift']());}};_0x55666d(++_0x40004e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xb7e7[_0x2f3848];return _0x102668;};'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':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e21=['cm_custom_fields','util','../../config/logger','api','bluebird','request-promise','path','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x0e21,0xe8));var _0x10e2=function(_0x5319c4,_0x398df0){_0x5319c4=_0x5319c4-0x0;var _0x5c203d=_0x0e21[_0x5319c4];return _0x5c203d;};'use strict';var _=require('lodash');var util=require(_0x10e2('0x0'));var logger=require(_0x10e2('0x1'))(_0x10e2('0x2'));var moment=require('moment');var BPromise=require(_0x10e2('0x3'));var rp=require(_0x10e2('0x4'));var fs=require('fs');var path=require(_0x10e2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10e2('0x6'));module[_0x10e2('0x7')]=function(_0x2fb9e4,_0x44e30e){return _0x2fb9e4[_0x10e2('0x8')](_0x10e2('0x9'),attributes,{'tableName':_0x10e2('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 49a2a55..ee845d0 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 _0x0a9a=['CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x40e0eb,_0x51f9a5){var _0x3b11ee=function(_0x17435d){while(--_0x17435d){_0x40e0eb['push'](_0x40e0eb['shift']());}};_0x3b11ee(++_0x51f9a5);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1ba0b0,_0x45d14b){_0x1ba0b0=_0x1ba0b0-0x0;var _0x287928=_0x0a9a[_0x1ba0b0];return _0x287928;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('CmCustomField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0xcb99=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xcb99,0x8b));var _0x9cb9=function(_0xdaffc7,_0x453662){_0xdaffc7=_0xdaffc7-0x0;var _0x503d65=_0xcb99[_0xdaffc7];return _0x503d65;};'use strict';var _=require(_0x9cb9('0x0'));var util=require('util');var moment=require(_0x9cb9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cb9('0x2'));var db=require(_0x9cb9('0x3'))['db'];var utils=require(_0x9cb9('0x4'));var logger=require('../../config/logger')(_0x9cb9('0x5'));var config=require(_0x9cb9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cb9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ed26a,_0xa84493,_0x1bf9b7){return new BPromise(function(_0x1dd62f,_0x82e3e){return client[_0x9cb9('0x8')](_0x2ed26a,_0x1bf9b7)[_0x9cb9('0x9')](function(_0x3da50b){logger['info']('CmCustomField,\x20%s,\x20%s',_0xa84493,_0x9cb9('0xa'));logger[_0x9cb9('0xb')](_0x9cb9('0xc'),_0xa84493,'request\x20sent',JSON[_0x9cb9('0xd')](_0x3da50b));if(_0x3da50b[_0x9cb9('0xe')]){if(_0x3da50b['error']['code']===0x1f4){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x82e3e(_0x3da50b['error'][_0x9cb9('0x10')]);}logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);return _0x1dd62f(_0x3da50b[_0x9cb9('0xe')][_0x9cb9('0x10')]);}else{logger[_0x9cb9('0x11')](_0x9cb9('0xf'),_0xa84493,_0x9cb9('0xa'));_0x1dd62f(_0x3da50b[_0x9cb9('0x12')][_0x9cb9('0x10')]);}})[_0x9cb9('0x13')](function(_0x140910){logger[_0x9cb9('0xe')](_0x9cb9('0xf'),_0xa84493,_0x140910);_0x82e3e(_0x140910);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6e2d485..f69fa6f 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 _0x06e0=['../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x34d0ab,_0x45eccd){var _0x7ee0b0=function(_0x41f754){while(--_0x41f754){_0x34d0ab['push'](_0x34d0ab['shift']());}};_0x7ee0b0(++_0x45eccd);}(_0x06e0,0xb8));var _0x006e=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x06e0[_0x43941d];return _0x27b82a;};'use strict';var multer=require(_0x006e('0x0'));var util=require(_0x006e('0x1'));var path=require(_0x006e('0x2'));var timeout=require(_0x006e('0x3'));var express=require(_0x006e('0x4'));var router=express[_0x006e('0x5')]();var auth=require(_0x006e('0x6'));var interaction=require(_0x006e('0x7'));var config=require('../../config/environment');var controller=require(_0x006e('0x8'));router[_0x006e('0x9')]('/',auth[_0x006e('0xa')](),controller[_0x006e('0xb')]);router['get'](_0x006e('0xc'),auth[_0x006e('0xa')](),controller[_0x006e('0xd')]);router[_0x006e('0xe')]('/',auth[_0x006e('0xa')](),controller[_0x006e('0xf')]);router['put']('/:id',auth[_0x006e('0xa')](),controller[_0x006e('0x10')]);router[_0x006e('0x11')](_0x006e('0xc'),auth[_0x006e('0xa')](),controller['destroy']);module[_0x006e('0x12')]=router; \ No newline at end of file +var _0xa53d=['get','isAuthenticated','/:id','show','post','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x370c24,_0x44d426){var _0x187d27=function(_0xde5513){while(--_0xde5513){_0x370c24['push'](_0x370c24['shift']());}};_0x187d27(++_0x44d426);}(_0xa53d,0x1a1));var _0xda53=function(_0x5de4b9,_0x1644d2){_0x5de4b9=_0x5de4b9-0x0;var _0x2ec54e=_0xa53d[_0x5de4b9];return _0x2ec54e;};'use strict';var multer=require('multer');var util=require(_0xda53('0x0'));var path=require('path');var timeout=require(_0xda53('0x1'));var express=require(_0xda53('0x2'));var router=express[_0xda53('0x3')]();var auth=require(_0xda53('0x4'));var interaction=require(_0xda53('0x5'));var config=require(_0xda53('0x6'));var controller=require(_0xda53('0x7'));router[_0xda53('0x8')]('/',auth[_0xda53('0x9')](),controller['index']);router[_0xda53('0x8')](_0xda53('0xa'),auth[_0xda53('0x9')](),controller[_0xda53('0xb')]);router[_0xda53('0xc')]('/',auth[_0xda53('0x9')](),controller['create']);router[_0xda53('0xd')](_0xda53('0xa'),auth[_0xda53('0x9')](),controller[_0xda53('0xe')]);router['delete'](_0xda53('0xa'),auth[_0xda53('0x9')](),controller[_0xda53('0xf')]);module[_0xda53('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 4a16fa4..07d9402 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 _0x1261=['sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue'];(function(_0x270cff,_0x1c995c){var _0x27cc87=function(_0x4df9bd){while(--_0x4df9bd){_0x270cff['push'](_0x270cff['shift']());}};_0x27cc87(++_0x1c995c);}(_0x1261,0x144));var _0x1126=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0x1261[_0x31a37b];return _0x49ae16;};'use strict';var moment=require('moment');var Sequelize=require(_0x1126('0x0'));module[_0x1126('0x1')]={'phone':{'type':Sequelize[_0x1126('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x1126('0x4')],'defaultValue':moment()[_0x1126('0x5')](_0x1126('0x6'))},'countbusyretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1126('0x4')]},'priority':{'type':Sequelize[_0x1126('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1126('0x7')],'unique':_0x1126('0x8')},'ListId':{'type':Sequelize[_0x1126('0x7')],'unique':_0x1126('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x1126('0x7')],'unique':_0x1126('0x8')},'CampaignId':{'type':Sequelize[_0x1126('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1126('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2542=['contactListQueue','moment','sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED'];(function(_0x428045,_0x32cf89){var _0x378d99=function(_0x17b781){while(--_0x17b781){_0x428045['push'](_0x428045['shift']());}};_0x378d99(++_0x32cf89);}(_0x2542,0x169));var _0x2254=function(_0x5d52fe,_0x29b700){_0x5d52fe=_0x5d52fe-0x0;var _0x565d6c=_0x2542[_0x5d52fe];return _0x565d6c;};'use strict';var moment=require(_0x2254('0x0'));var Sequelize=require(_0x2254('0x1'));module[_0x2254('0x2')]={'phone':{'type':Sequelize[_0x2254('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2254('0x4')],'defaultValue':moment()['format'](_0x2254('0x5'))},'countbusyretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x2254('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2254('0x4')]},'priority':{'type':Sequelize[_0x2254('0x6')](0x2)[_0x2254('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x2254('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x2254('0x6')],'unique':_0x2254('0x9')},'ListId':{'type':Sequelize[_0x2254('0x6')],'unique':_0x2254('0x9')},'UserId':{'type':Sequelize[_0x2254('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x2254('0x6')],'unique':_0x2254('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2254('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 1fb8cce..5c94228 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 _0x8602=['hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','literal','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezone','timezones','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','error','stack','map','rawAttributes','fieldName','type','key','model','name','query','concat','filters','$and','$or','$lt','$lte','$eq','$not','$between','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','then','CmHopper','findAll','rows','catch','params','keys','includeAll','include','find','create','body','describe','VoiceQueue','Campaign','VoiceQueueId','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x8602,0x1d9));var _0x2860=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x8602[_0x1b3564];return _0x504069;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2860('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2860('0x1'));var jsonpatch=require(_0x2860('0x2'));var rp=require(_0x2860('0x3'));var moment=require(_0x2860('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2860('0x5'));var util=require(_0x2860('0x6'));var path=require('path');var sox=require(_0x2860('0x7'));var csv=require(_0x2860('0x8'));var ejs=require(_0x2860('0x9'));var fs=require('fs');var _=require(_0x2860('0xa'));var squel=require(_0x2860('0xb'));var crypto=require('crypto');var jsforce=require(_0x2860('0xc'));var deskjs=require(_0x2860('0xd'));var toCsv=require(_0x2860('0x8'));var querystring=require(_0x2860('0xe'));var Papa=require(_0x2860('0xf'));var Redis=require(_0x2860('0x10'));var shared=require('../../config/environment');var authService=require(_0x2860('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2860('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2860('0x13'))(_0x2860('0x14'));var utils=require(_0x2860('0x15'));var config=require(_0x2860('0x16'));var db=require(_0x2860('0x17'))['db'];function respondWithStatusCode(_0x5efb1d,_0x1a721d){_0x1a721d=_0x1a721d||0xcc;return function(_0xf4f6b6){if(_0xf4f6b6){return _0x5efb1d[_0x2860('0x18')](_0x1a721d);}return _0x5efb1d[_0x2860('0x19')](_0x1a721d)[_0x2860('0x1a')]();};}function respondWithResult(_0x336d24,_0x347607){_0x347607=_0x347607||0xc8;return function(_0x413d70){if(_0x413d70){return _0x336d24['status'](_0x347607)[_0x2860('0x1b')](_0x413d70);}};}function respondWithFilteredResult(_0x6c84ce,_0x4e0758){return function(_0x505217){if(_0x505217){var _0x5597e5=_0x505217[_0x2860('0x1c')],_0x47a466=_0x4e0758[_0x2860('0x1d')],_0x4ec4cb=_0x4e0758[_0x2860('0x1d')]+_0x4e0758[_0x2860('0x1e')],_0xbb1340;if(_0x4ec4cb>=_0x5597e5){_0x4ec4cb=_0x5597e5;_0xbb1340=0xc8;}else{_0xbb1340=0xce;}_0x6c84ce['status'](_0xbb1340);return _0x6c84ce[_0x2860('0x1f')]('Content-Range',_0x47a466+'-'+_0x4ec4cb+'/'+_0x5597e5)['json'](_0x505217);}return null;};}function patchUpdates(_0x3337b1){return function(_0x38ff53){try{jsonpatch['apply'](_0x38ff53,_0x3337b1,!![]);}catch(_0x34c002){return BPromise[_0x2860('0x20')](_0x34c002);}return _0x38ff53[_0x2860('0x21')]();};}function saveUpdates(_0x581175,_0x59b0e0){return function(_0x26474a){if(_0x26474a){return _0x26474a[_0x2860('0x22')](_0x581175)['then'](function(_0x583b8e){return _0x583b8e;});}return null;};}function removeEntity(_0x86e6d6,_0x59b6d1){return function(_0x3f7008){if(_0x3f7008){return _0x3f7008[_0x2860('0x23')]()['then'](function(){_0x86e6d6[_0x2860('0x19')](0xcc)[_0x2860('0x1a')]();});}};}function handleEntityNotFound(_0x48c50c,_0x4c26d2){return function(_0x333717){if(!_0x333717){_0x48c50c[_0x2860('0x18')](0x194);}return _0x333717;};}function handleError(_0x5b71b6,_0x2c9f9f){_0x2c9f9f=_0x2c9f9f||0x1f4;return function(_0x2b0ae5){logger[_0x2860('0x24')](_0x2b0ae5[_0x2860('0x25')]);if(_0x2b0ae5['name']){delete _0x2b0ae5['name'];}_0x5b71b6[_0x2860('0x19')](_0x2c9f9f)['send'](_0x2b0ae5);};}exports['index']=function(_0x1b1aad,_0x15a7ed){var _0x45f697={},_0x4409c9={},_0x915120={'count':0x0,'rows':[]};var _0x223b61=_[_0x2860('0x26')](db['CmHopper'][_0x2860('0x27')],function(_0x481c73){return{'name':_0x481c73[_0x2860('0x28')],'type':_0x481c73[_0x2860('0x29')][_0x2860('0x2a')]};});_0x4409c9[_0x2860('0x2b')]=_['map'](_0x223b61,_0x2860('0x2c'));_0x4409c9['query']=_['keys'](_0x1b1aad['query']);_0x4409c9['filters']=_['intersection'](_0x4409c9[_0x2860('0x2b')],_0x4409c9[_0x2860('0x2d')]);_0x4409c9['filters']=_[_0x2860('0x2e')](_0x4409c9[_0x2860('0x2f')],[_0x2860('0x30'),_0x2860('0x31'),'$gt','$gte',_0x2860('0x32'),_0x2860('0x33'),'$ne',_0x2860('0x34'),_0x2860('0x35'),_0x2860('0x36'),'$notBetween',_0x2860('0x37'),_0x2860('0x38'),'$like',_0x2860('0x39'),_0x2860('0x3a'),_0x2860('0x3b'),_0x2860('0x3c'),_0x2860('0x3d'),'$contains',_0x2860('0x3e'),_0x2860('0x3f')]);_0x45f697[_0x2860('0x40')]=_[_0x2860('0x41')](_0x4409c9[_0x2860('0x2b')],qs['fields'](_0x1b1aad[_0x2860('0x2d')][_0x2860('0x42')]));_0x45f697[_0x2860('0x40')]=_0x45f697[_0x2860('0x40')][_0x2860('0x43')]?_0x45f697[_0x2860('0x40')]:_0x4409c9['model'];if(!_0x1b1aad[_0x2860('0x2d')][_0x2860('0x44')](_0x2860('0x45'))){_0x45f697['limit']=qs[_0x2860('0x1e')](_0x1b1aad[_0x2860('0x2d')][_0x2860('0x1e')]);_0x45f697[_0x2860('0x1d')]=qs[_0x2860('0x1d')](_0x1b1aad[_0x2860('0x2d')][_0x2860('0x1d')]);}_0x45f697[_0x2860('0x46')]=qs['sort'](_0x1b1aad['query']['sort']);_0x45f697[_0x2860('0x47')]=qs[_0x2860('0x2f')](_[_0x2860('0x48')](_0x1b1aad[_0x2860('0x2d')],_0x4409c9[_0x2860('0x2f')]),_0x223b61);if(_0x1b1aad[_0x2860('0x2d')][_0x2860('0x49')]){_0x45f697[_0x2860('0x47')]=_[_0x2860('0x4a')](_0x45f697[_0x2860('0x47')],{'$or':_['map'](_0x223b61,function(_0x59f596){if(_0x59f596[_0x2860('0x29')]!==_0x2860('0x4b')){var _0x5d6f83={};_0x5d6f83[_0x59f596[_0x2860('0x2c')]]={'$like':'%'+_0x1b1aad[_0x2860('0x2d')][_0x2860('0x49')]+'%'};return _0x5d6f83;}})});}_0x45f697=_[_0x2860('0x4a')]({},_0x45f697,_0x1b1aad[_0x2860('0x4c')]);var _0x34fb1d={'where':_0x45f697[_0x2860('0x47')]};return db['CmHopper'][_0x2860('0x1c')](_0x34fb1d)[_0x2860('0x4d')](function(_0x2aced2){_0x915120[_0x2860('0x1c')]=_0x2aced2;if(_0x1b1aad['query']['includeAll']){_0x45f697['include']=[{'all':!![]}];}return db[_0x2860('0x4e')][_0x2860('0x4f')](_0x45f697);})['then'](function(_0x243f9e){_0x915120[_0x2860('0x50')]=_0x243f9e;return _0x915120;})[_0x2860('0x4d')](respondWithFilteredResult(_0x15a7ed,_0x45f697))[_0x2860('0x51')](handleError(_0x15a7ed,null));};exports['show']=function(_0x14fd7c,_0x41f5f9){var _0x4fe629={'raw':!![],'where':{'id':_0x14fd7c[_0x2860('0x52')]['id']}},_0x2c5cc1={};_0x2c5cc1[_0x2860('0x2b')]=_[_0x2860('0x53')](db[_0x2860('0x4e')]['rawAttributes']);_0x2c5cc1[_0x2860('0x2d')]=_[_0x2860('0x53')](_0x14fd7c[_0x2860('0x2d')]);_0x2c5cc1['filters']=_[_0x2860('0x41')](_0x2c5cc1[_0x2860('0x2b')],_0x2c5cc1[_0x2860('0x2d')]);_0x4fe629[_0x2860('0x40')]=_[_0x2860('0x41')](_0x2c5cc1[_0x2860('0x2b')],qs[_0x2860('0x42')](_0x14fd7c[_0x2860('0x2d')][_0x2860('0x42')]));_0x4fe629[_0x2860('0x40')]=_0x4fe629[_0x2860('0x40')]['length']?_0x4fe629['attributes']:_0x2c5cc1[_0x2860('0x2b')];if(_0x14fd7c[_0x2860('0x2d')][_0x2860('0x54')]){_0x4fe629[_0x2860('0x55')]=[{'all':!![]}];}_0x4fe629=_[_0x2860('0x4a')]({},_0x4fe629,_0x14fd7c['options']);return db[_0x2860('0x4e')][_0x2860('0x56')](_0x4fe629)[_0x2860('0x4d')](handleEntityNotFound(_0x41f5f9,null))['then'](respondWithResult(_0x41f5f9,null))['catch'](handleError(_0x41f5f9,null));};exports[_0x2860('0x57')]=function(_0x142d3d,_0x3b509e){return db[_0x2860('0x4e')][_0x2860('0x57')](_0x142d3d[_0x2860('0x58')],{})['then'](respondWithResult(_0x3b509e,0xc9))[_0x2860('0x51')](handleError(_0x3b509e,null));};exports[_0x2860('0x22')]=function(_0x679053,_0x2ce2dd){if(_0x679053[_0x2860('0x58')]['id']){delete _0x679053[_0x2860('0x58')]['id'];}return db[_0x2860('0x4e')][_0x2860('0x56')]({'where':{'id':_0x679053[_0x2860('0x52')]['id']}})['then'](handleEntityNotFound(_0x2ce2dd,null))[_0x2860('0x4d')](saveUpdates(_0x679053[_0x2860('0x58')],null))['then'](respondWithResult(_0x2ce2dd,null))[_0x2860('0x51')](handleError(_0x2ce2dd,null));};exports[_0x2860('0x59')]=function(_0x30752e,_0x375d41){return db[_0x2860('0x4e')][_0x2860('0x59')]()['then'](respondWithResult(_0x375d41,null))[_0x2860('0x51')](handleError(_0x375d41,null));};exports[_0x2860('0x23')]=function(_0x4e81b6,_0x55f635){var _0x48c382;return db[_0x2860('0x4e')]['find']({'where':{'id':_0x4e81b6[_0x2860('0x52')]['id']}})[_0x2860('0x4d')](handleEntityNotFound(_0x55f635,null))[_0x2860('0x4d')](function(_0x4bb41e){if(_0x4bb41e){return _0x4bb41e[_0x2860('0x23')]()[_0x2860('0x4d')](function(_0xf6af95){return _0xf6af95;});}})[_0x2860('0x4d')](function(_0xc0f30){_0x48c382=_0xc0f30;if(_0xc0f30){if(_0xc0f30['VoiceQueueId']||_0xc0f30['CampaignId']){return db[_0xc0f30['VoiceQueueId']?_0x2860('0x5a'):_0x2860('0x5b')][_0x2860('0x56')]({'where':{'id':_0xc0f30[_0x2860('0x5c')]?_0xc0f30[_0x2860('0x5c')]:_0xc0f30[_0x2860('0x5d')]},'attributes':['id',_0x2860('0x2c')],'raw':!![]});}}})['then'](function(_0x45fb54){var _0x30e857={};if(_0x45fb54){_[_0x2860('0x4a')](_0x30e857,_[_0x2860('0x5e')](_0x48c382[_0x2860('0x5f')],[_0x2860('0x60'),_0x2860('0x61'),'id']));_0x30e857[_0x2860('0x62')]=0x15;_0x30e857[_0x2860('0x63')]='deleted';_0x30e857[_0x2860('0x64')]=_0x45fb54[_0x2860('0x2c')];_0x30e857[_0x2860('0x65')]=_0x4e81b6[_0x2860('0x66')][_0x2860('0x2c')];_0x30e857[_0x2860('0x67')]=_0x4e81b6[_0x2860('0x66')]['id'];_0x30e857[_0x2860('0x68')]=!![];_0x30e857['deletedat']=moment()[_0x2860('0x69')](_0x2860('0x6a'));_0x30e857['calleridnum']=_0x48c382[_0x2860('0x6b')];_0x30e857[_0x2860('0x6c')]=_0x48c382['VoiceQueueId']?_0x2860('0x6d'):_0x2860('0x6e');return db[_0x2860('0x6f')][_0x2860('0x56')]({'where':{'id':_0x30e857[_0x2860('0x70')]},'attributes':[_0x2860('0x71'),_0x2860('0x72')]})[_0x2860('0x4d')](function(_0x298a34){if(!_['isNil'](_0x55f635)&&!_[_0x2860('0x73')](_0x298a34[_0x2860('0x71')])){_0x30e857[_0x2860('0x74')]=_0x298a34[_0x2860('0x71')];if(!_['isNil'](_0x298a34[_0x2860('0x72')])){_0x30e857[_0x2860('0x74')]+='\x20'+_0x298a34[_0x2860('0x72')];}}})['finally'](function(){return db[_0x2860('0x75')]['create'](_0x30e857);});}})['then'](function(){return _0x55f635['status'](0xcc)[_0x2860('0x1a')]();})[_0x2860('0x51')](handleError(_0x55f635,null));};exports[_0x2860('0x76')]=function(_0x40f3f8,_0x212d0e,_0x1a5d7b){var _0x4ac5fe=[];return db[_0x2860('0x6f')]['describe']()[_0x2860('0x4d')](function(_0x545704){_0x4ac5fe=_[_0x2860('0x53')](_0x545704);return _0x40f3f8[_0x2860('0x66')][_0x2860('0x77')]({'where':{'type':_0x2860('0x78'),'dialActive':!![],'dialMethod':_0x2860('0x79')},'attributes':['id',_0x2860('0x7a')],'raw':!![]});})[_0x2860('0x4d')](function(_0x40e831){if(_0x40e831&&_0x40e831[_0x2860('0x43')]){return db[_0x2860('0x7b')][_0x2860('0x7c')](function(_0xe9694c){var _0x4ba198={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x2860('0x26')](_0x40e831,'id')},'$or':[{'UserId':null},{'UserId':_0x40f3f8[_0x2860('0x66')]['id']}]};var _0x3272df=[];if(_0x40f3f8[_0x2860('0x58')][_0x2860('0x7d')]&&_0x40f3f8[_0x2860('0x58')][_0x2860('0x7d')]===_0x2860('0x7e')){if(!_['isEmpty'](_0x40f3f8[_0x2860('0x58')][_0x2860('0x7f')])){_0x4ba198['id']={'$in':_0x40f3f8[_0x2860('0x58')]['hopperIds']};}_0x3272df=[[_0x2860('0x80'),_0x2860('0x81')],[_0x2860('0x82'),_0x40e831[0x0][_0x2860('0x7a')]==='ASC'?_0x2860('0x83'):_0x2860('0x81')],db['sequelize']['literal'](_0x2860('0x84')),['id','DESC']];}else{if(!_[_0x2860('0x85')](_0x40f3f8[_0x2860('0x58')][_0x2860('0x7f')])){_0x4ba198['id']={'$notIn':_0x40f3f8[_0x2860('0x58')][_0x2860('0x7f')]};}_0x3272df=[['priority',_0x2860('0x83')],['scheduledAt',_0x40e831[0x0]['dialOrderByScheduledAt']],db[_0x2860('0x7b')][_0x2860('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x2860('0x81')]];}return db[_0x2860('0x4e')]['findOne']({'attributes':['id',_0x2860('0x87')],'where':_0x4ba198,'order':_0x3272df,'transaction':_0xe9694c,'lock':_0xe9694c[_0x2860('0x88')][_0x2860('0x89')],'include':[{'model':db[_0x2860('0x6f')],'as':_0x2860('0x8a'),'attributes':_0x4ac5fe,'include':[{'model':db[_0x2860('0x8b')],'as':'Company','attributes':['id',_0x2860('0x2c')]}]},{'model':db[_0x2860('0x8c')],'as':_0x2860('0x8d'),'attributes':['id',_0x2860('0x2c')]},{'model':db[_0x2860('0x5a')],'as':_0x2860('0x8e'),'attributes':['id',_0x2860('0x2c'),_0x2860('0x8f')]}]})[_0x2860('0x4d')](function(_0x1590b9){if(_0x1590b9){return _0x1590b9[_0x2860('0x22')]({'UserId':_0x40f3f8[_0x2860('0x66')]['id']},{'transaction':_0xe9694c});}});});}})[_0x2860('0x4d')](handleEntityNotFound(_0x212d0e,null))[_0x2860('0x4d')](respondWithResult(_0x212d0e,null))['catch'](handleError(_0x212d0e,null));};exports['getOpenContacts']=function(_0x49b990,_0x4e734d,_0x1aa021){return _0x49b990[_0x2860('0x66')][_0x2860('0x77')]({'where':{'type':_0x2860('0x78'),'dialActive':!![],'dialMethod':_0x2860('0x79')},'attributes':['id'],'raw':!![]})['then'](function(_0x53428c){if(_0x53428c&&_0x53428c[_0x2860('0x43')]){return db[_0x2860('0x4e')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2860('0x69')](_0x2860('0x6a'))},'VoiceQueueId':{'$in':_['map'](_0x53428c,'id')},'$or':[{'UserId':null},{'UserId':_0x49b990[_0x2860('0x66')]['id']}]}});}return 0x0;})[_0x2860('0x4d')](function(_0x3e7b4b){if(!_['isNil'](_0x3e7b4b)&&_[_0x2860('0x90')](_0x3e7b4b)){return _0x4e734d[_0x2860('0x19')](0xc8)['json']({'contacts':_0x3e7b4b});}else{logger['error'](_0x2860('0x91'),_0x2860('0x92'),0x194,_0x2860('0x93'));_0x4e734d[_0x2860('0x18')](0x194);}})[_0x2860('0x51')](handleError(_0x4e734d,null));};exports['getTimezones']=function(_0x3d065d,_0x34534e,_0x3a3d7d){var _0x3bd00a=shared['timezones'];var _0x4469c6=[];_['map'](_0x3bd00a,function(_0xfc83d2){_0x4469c6['push']({'id':_0xfc83d2[_0x2860('0x2c')],'name':_0xfc83d2[_0x2860('0x2c')],'utcOffset':_0xfc83d2['utcOffset']});});return _0x34534e[_0x2860('0x19')](0xc8)[_0x2860('0x1b')]({'tz':_0x4469c6});};exports[_0x2860('0x94')]=function(_0x4de6c6,_0x138ad8,_0x430eb1){var _0x11d3ec=shared[_0x2860('0x95')];var _0x250b82={};if(!_['isNil'](_0x11d3ec[_0x4de6c6['body']['id']]))_0x250b82=_0x11d3ec[_0x4de6c6[_0x2860('0x58')]['id']];return _0x138ad8['status'](0xc8)[_0x2860('0x1b')](_0x250b82);}; \ No newline at end of file +var _0xbb66=['hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmCompany','Company','List','dialActive','getOpenContacts','outbound','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','push','utcOffset','getTimezone','timezones','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/environment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','keys','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','update','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbb66,0x1e6));var _0x6bb6=function(_0xbb98d2,_0x152fbf){_0xbb98d2=_0xbb98d2-0x0;var _0x279874=_0xbb66[_0xbb98d2];return _0x279874;};'use strict';var pdf=require(_0x6bb6('0x0'));var emlformat=require(_0x6bb6('0x1'));var rimraf=require(_0x6bb6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6bb6('0x3'));var rp=require(_0x6bb6('0x4'));var moment=require('moment');var BPromise=require(_0x6bb6('0x5'));var Mustache=require(_0x6bb6('0x6'));var util=require(_0x6bb6('0x7'));var path=require(_0x6bb6('0x8'));var sox=require(_0x6bb6('0x9'));var csv=require(_0x6bb6('0xa'));var ejs=require(_0x6bb6('0xb'));var fs=require('fs');var _=require(_0x6bb6('0xc'));var squel=require(_0x6bb6('0xd'));var crypto=require(_0x6bb6('0xe'));var jsforce=require(_0x6bb6('0xf'));var deskjs=require(_0x6bb6('0x10'));var toCsv=require(_0x6bb6('0xa'));var querystring=require(_0x6bb6('0x11'));var Papa=require(_0x6bb6('0x12'));var Redis=require('ioredis');var shared=require(_0x6bb6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6bb6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bb6('0x15'))(_0x6bb6('0x16'));var utils=require('../../config/utils');var config=require(_0x6bb6('0x13'));var db=require(_0x6bb6('0x17'))['db'];function respondWithStatusCode(_0x2d6b08,_0x48a115){_0x48a115=_0x48a115||0xcc;return function(_0x57ecae){if(_0x57ecae){return _0x2d6b08['sendStatus'](_0x48a115);}return _0x2d6b08[_0x6bb6('0x18')](_0x48a115)[_0x6bb6('0x19')]();};}function respondWithResult(_0x44391,_0x115046){_0x115046=_0x115046||0xc8;return function(_0x587bd4){if(_0x587bd4){return _0x44391['status'](_0x115046)[_0x6bb6('0x1a')](_0x587bd4);}};}function respondWithFilteredResult(_0x59c345,_0x4e1992){return function(_0x51945a){if(_0x51945a){var _0x48ae2f=_0x51945a[_0x6bb6('0x1b')],_0x4083ad=_0x4e1992[_0x6bb6('0x1c')],_0x36e0cc=_0x4e1992[_0x6bb6('0x1c')]+_0x4e1992[_0x6bb6('0x1d')],_0x38a99d;if(_0x36e0cc>=_0x48ae2f){_0x36e0cc=_0x48ae2f;_0x38a99d=0xc8;}else{_0x38a99d=0xce;}_0x59c345[_0x6bb6('0x18')](_0x38a99d);return _0x59c345['set'](_0x6bb6('0x1e'),_0x4083ad+'-'+_0x36e0cc+'/'+_0x48ae2f)[_0x6bb6('0x1a')](_0x51945a);}return null;};}function patchUpdates(_0x3899c8){return function(_0x38570c){try{jsonpatch[_0x6bb6('0x1f')](_0x38570c,_0x3899c8,!![]);}catch(_0x1a20df){return BPromise[_0x6bb6('0x20')](_0x1a20df);}return _0x38570c[_0x6bb6('0x21')]();};}function saveUpdates(_0x3d7038,_0x2f097e){return function(_0x3c554e){if(_0x3c554e){return _0x3c554e['update'](_0x3d7038)[_0x6bb6('0x22')](function(_0xc30699){return _0xc30699;});}return null;};}function removeEntity(_0x229343,_0x5e04c3){return function(_0x107fd2){if(_0x107fd2){return _0x107fd2['destroy']()[_0x6bb6('0x22')](function(){_0x229343['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe79dae,_0x86dfda){return function(_0x39e880){if(!_0x39e880){_0xe79dae[_0x6bb6('0x23')](0x194);}return _0x39e880;};}function handleError(_0x228bcc,_0x4358c2){_0x4358c2=_0x4358c2||0x1f4;return function(_0x40e2df){logger[_0x6bb6('0x24')](_0x40e2df[_0x6bb6('0x25')]);if(_0x40e2df[_0x6bb6('0x26')]){delete _0x40e2df[_0x6bb6('0x26')];}_0x228bcc[_0x6bb6('0x18')](_0x4358c2)[_0x6bb6('0x27')](_0x40e2df);};}exports[_0x6bb6('0x28')]=function(_0x28e3ed,_0x1ae5c9){var _0x3bb269={},_0x4f7fdb={},_0x5b17e5={'count':0x0,'rows':[]};var _0xa4bb5e=_[_0x6bb6('0x29')](db[_0x6bb6('0x2a')][_0x6bb6('0x2b')],function(_0x1d192c){return{'name':_0x1d192c['fieldName'],'type':_0x1d192c[_0x6bb6('0x2c')][_0x6bb6('0x2d')]};});_0x4f7fdb[_0x6bb6('0x2e')]=_[_0x6bb6('0x29')](_0xa4bb5e,_0x6bb6('0x26'));_0x4f7fdb[_0x6bb6('0x2f')]=_[_0x6bb6('0x30')](_0x28e3ed['query']);_0x4f7fdb['filters']=_[_0x6bb6('0x31')](_0x4f7fdb[_0x6bb6('0x2e')],_0x4f7fdb['query']);_0x4f7fdb[_0x6bb6('0x32')]=_[_0x6bb6('0x33')](_0x4f7fdb[_0x6bb6('0x32')],[_0x6bb6('0x34'),_0x6bb6('0x35'),_0x6bb6('0x36'),_0x6bb6('0x37'),_0x6bb6('0x38'),_0x6bb6('0x39'),_0x6bb6('0x3a'),_0x6bb6('0x3b'),_0x6bb6('0x3c'),_0x6bb6('0x3d'),_0x6bb6('0x3e'),_0x6bb6('0x3f'),_0x6bb6('0x40'),_0x6bb6('0x41'),'$notLike','$iLike','$notILike',_0x6bb6('0x41'),'$overlap',_0x6bb6('0x42'),_0x6bb6('0x43'),_0x6bb6('0x44')]);_0x3bb269[_0x6bb6('0x45')]=_[_0x6bb6('0x31')](_0x4f7fdb[_0x6bb6('0x2e')],qs[_0x6bb6('0x46')](_0x28e3ed[_0x6bb6('0x2f')]['fields']));_0x3bb269[_0x6bb6('0x45')]=_0x3bb269[_0x6bb6('0x45')]['length']?_0x3bb269[_0x6bb6('0x45')]:_0x4f7fdb[_0x6bb6('0x2e')];if(!_0x28e3ed[_0x6bb6('0x2f')][_0x6bb6('0x47')](_0x6bb6('0x48'))){_0x3bb269[_0x6bb6('0x1d')]=qs[_0x6bb6('0x1d')](_0x28e3ed['query'][_0x6bb6('0x1d')]);_0x3bb269['offset']=qs['offset'](_0x28e3ed[_0x6bb6('0x2f')][_0x6bb6('0x1c')]);}_0x3bb269['order']=qs['sort'](_0x28e3ed[_0x6bb6('0x2f')]['sort']);_0x3bb269[_0x6bb6('0x49')]=qs['filters'](_[_0x6bb6('0x4a')](_0x28e3ed[_0x6bb6('0x2f')],_0x4f7fdb[_0x6bb6('0x32')]),_0xa4bb5e);if(_0x28e3ed['query'][_0x6bb6('0x4b')]){_0x3bb269['where']=_[_0x6bb6('0x4c')](_0x3bb269[_0x6bb6('0x49')],{'$or':_['map'](_0xa4bb5e,function(_0x27ac9f){if(_0x27ac9f[_0x6bb6('0x2c')]!==_0x6bb6('0x4d')){var _0x422e1b={};_0x422e1b[_0x27ac9f[_0x6bb6('0x26')]]={'$like':'%'+_0x28e3ed[_0x6bb6('0x2f')]['filter']+'%'};return _0x422e1b;}})});}_0x3bb269=_[_0x6bb6('0x4c')]({},_0x3bb269,_0x28e3ed[_0x6bb6('0x4e')]);var _0x445d7a={'where':_0x3bb269[_0x6bb6('0x49')]};return db['CmHopper'][_0x6bb6('0x1b')](_0x445d7a)[_0x6bb6('0x22')](function(_0x3b5162){_0x5b17e5[_0x6bb6('0x1b')]=_0x3b5162;if(_0x28e3ed[_0x6bb6('0x2f')]['includeAll']){_0x3bb269['include']=[{'all':!![]}];}return db['CmHopper'][_0x6bb6('0x4f')](_0x3bb269);})['then'](function(_0x53ba01){_0x5b17e5[_0x6bb6('0x50')]=_0x53ba01;return _0x5b17e5;})[_0x6bb6('0x22')](respondWithFilteredResult(_0x1ae5c9,_0x3bb269))[_0x6bb6('0x51')](handleError(_0x1ae5c9,null));};exports[_0x6bb6('0x52')]=function(_0x474ef1,_0x38a44e){var _0x445ce0={'raw':!![],'where':{'id':_0x474ef1[_0x6bb6('0x53')]['id']}},_0x37724a={};_0x37724a[_0x6bb6('0x2e')]=_['keys'](db[_0x6bb6('0x2a')][_0x6bb6('0x2b')]);_0x37724a[_0x6bb6('0x2f')]=_[_0x6bb6('0x30')](_0x474ef1[_0x6bb6('0x2f')]);_0x37724a[_0x6bb6('0x32')]=_['intersection'](_0x37724a[_0x6bb6('0x2e')],_0x37724a[_0x6bb6('0x2f')]);_0x445ce0[_0x6bb6('0x45')]=_[_0x6bb6('0x31')](_0x37724a[_0x6bb6('0x2e')],qs['fields'](_0x474ef1[_0x6bb6('0x2f')]['fields']));_0x445ce0[_0x6bb6('0x45')]=_0x445ce0[_0x6bb6('0x45')][_0x6bb6('0x54')]?_0x445ce0['attributes']:_0x37724a[_0x6bb6('0x2e')];if(_0x474ef1['query'][_0x6bb6('0x55')]){_0x445ce0[_0x6bb6('0x56')]=[{'all':!![]}];}_0x445ce0=_[_0x6bb6('0x4c')]({},_0x445ce0,_0x474ef1['options']);return db[_0x6bb6('0x2a')][_0x6bb6('0x57')](_0x445ce0)[_0x6bb6('0x22')](handleEntityNotFound(_0x38a44e,null))[_0x6bb6('0x22')](respondWithResult(_0x38a44e,null))[_0x6bb6('0x51')](handleError(_0x38a44e,null));};exports[_0x6bb6('0x58')]=function(_0x597b50,_0x48f027){return db[_0x6bb6('0x2a')][_0x6bb6('0x58')](_0x597b50['body'],{})[_0x6bb6('0x22')](respondWithResult(_0x48f027,0xc9))[_0x6bb6('0x51')](handleError(_0x48f027,null));};exports[_0x6bb6('0x59')]=function(_0x300dd9,_0x38e806){if(_0x300dd9[_0x6bb6('0x5a')]['id']){delete _0x300dd9[_0x6bb6('0x5a')]['id'];}return db[_0x6bb6('0x2a')][_0x6bb6('0x57')]({'where':{'id':_0x300dd9[_0x6bb6('0x53')]['id']}})[_0x6bb6('0x22')](handleEntityNotFound(_0x38e806,null))[_0x6bb6('0x22')](saveUpdates(_0x300dd9['body'],null))[_0x6bb6('0x22')](respondWithResult(_0x38e806,null))[_0x6bb6('0x51')](handleError(_0x38e806,null));};exports['describe']=function(_0x535c5a,_0x997e70){return db[_0x6bb6('0x2a')][_0x6bb6('0x5b')]()['then'](respondWithResult(_0x997e70,null))[_0x6bb6('0x51')](handleError(_0x997e70,null));};exports['destroy']=function(_0x211f64,_0x1404dc){var _0x180e46;return db[_0x6bb6('0x2a')][_0x6bb6('0x57')]({'where':{'id':_0x211f64[_0x6bb6('0x53')]['id']}})['then'](handleEntityNotFound(_0x1404dc,null))[_0x6bb6('0x22')](function(_0x5308a5){if(_0x5308a5){return _0x5308a5[_0x6bb6('0x5c')]()[_0x6bb6('0x22')](function(_0x1a1d7c){return _0x1a1d7c;});}})['then'](function(_0x5ee568){_0x180e46=_0x5ee568;if(_0x5ee568){if(_0x5ee568['VoiceQueueId']||_0x5ee568[_0x6bb6('0x5d')]){return db[_0x5ee568[_0x6bb6('0x5e')]?_0x6bb6('0x5f'):_0x6bb6('0x60')][_0x6bb6('0x57')]({'where':{'id':_0x5ee568[_0x6bb6('0x5e')]?_0x5ee568[_0x6bb6('0x5e')]:_0x5ee568[_0x6bb6('0x5d')]},'attributes':['id',_0x6bb6('0x26')],'raw':!![]});}}})[_0x6bb6('0x22')](function(_0x3fd2d3){var _0x4f9688={};if(_0x3fd2d3){_[_0x6bb6('0x4c')](_0x4f9688,_[_0x6bb6('0x61')](_0x180e46[_0x6bb6('0x62')],[_0x6bb6('0x63'),'updatedAt','id']));_0x4f9688[_0x6bb6('0x64')]=0x15;_0x4f9688[_0x6bb6('0x65')]=_0x6bb6('0x66');_0x4f9688[_0x6bb6('0x67')]=_0x3fd2d3[_0x6bb6('0x26')];_0x4f9688[_0x6bb6('0x68')]=_0x211f64[_0x6bb6('0x69')]['name'];_0x4f9688[_0x6bb6('0x6a')]=_0x211f64[_0x6bb6('0x69')]['id'];_0x4f9688[_0x6bb6('0x66')]=!![];_0x4f9688[_0x6bb6('0x6b')]=moment()[_0x6bb6('0x6c')](_0x6bb6('0x6d'));_0x4f9688[_0x6bb6('0x6e')]=_0x180e46[_0x6bb6('0x6f')];_0x4f9688[_0x6bb6('0x70')]=_0x180e46[_0x6bb6('0x5e')]?'queue':_0x6bb6('0x71');return db['CmContact']['find']({'where':{'id':_0x4f9688[_0x6bb6('0x72')]},'attributes':[_0x6bb6('0x73'),_0x6bb6('0x74')]})['then'](function(_0x3e99a0){if(!_[_0x6bb6('0x75')](_0x1404dc)&&!_[_0x6bb6('0x75')](_0x3e99a0[_0x6bb6('0x73')])){_0x4f9688[_0x6bb6('0x76')]=_0x3e99a0['firstName'];if(!_[_0x6bb6('0x75')](_0x3e99a0[_0x6bb6('0x74')])){_0x4f9688[_0x6bb6('0x76')]+='\x20'+_0x3e99a0[_0x6bb6('0x74')];}}})[_0x6bb6('0x77')](function(){return db[_0x6bb6('0x78')][_0x6bb6('0x58')](_0x4f9688);});}})['then'](function(){return _0x1404dc[_0x6bb6('0x18')](0xcc)[_0x6bb6('0x19')]();})[_0x6bb6('0x51')](handleError(_0x1404dc,null));};exports[_0x6bb6('0x79')]=function(_0x583777,_0x4a6eb2,_0x4de68a){var _0x140fd5=[];return db[_0x6bb6('0x7a')][_0x6bb6('0x5b')]()[_0x6bb6('0x22')](function(_0x275ee1){_0x140fd5=_['keys'](_0x275ee1);return _0x583777['user'][_0x6bb6('0x7b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x6bb6('0x7c')},'attributes':['id',_0x6bb6('0x7d')],'raw':!![]});})[_0x6bb6('0x22')](function(_0x5d6700){if(_0x5d6700&&_0x5d6700[_0x6bb6('0x54')]){return db[_0x6bb6('0x7e')][_0x6bb6('0x7f')](function(_0x56c04b){var _0x55293e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6bb6('0x6c')](_0x6bb6('0x6d'))},'VoiceQueueId':{'$in':_['map'](_0x5d6700,'id')},'$or':[{'UserId':null},{'UserId':_0x583777['user']['id']}]};var _0x51d7f0=[];if(_0x583777[_0x6bb6('0x5a')][_0x6bb6('0x80')]&&_0x583777['body'][_0x6bb6('0x80')]===_0x6bb6('0x81')){if(!_['isEmpty'](_0x583777['body'][_0x6bb6('0x82')])){_0x55293e['id']={'$in':_0x583777[_0x6bb6('0x5a')][_0x6bb6('0x82')]};}_0x51d7f0=[['priority',_0x6bb6('0x83')],[_0x6bb6('0x84'),_0x5d6700[0x0][_0x6bb6('0x7d')]===_0x6bb6('0x83')?_0x6bb6('0x85'):_0x6bb6('0x83')],db['sequelize'][_0x6bb6('0x86')](_0x6bb6('0x87')),['id',_0x6bb6('0x85')]];}else{if(!_[_0x6bb6('0x88')](_0x583777[_0x6bb6('0x5a')][_0x6bb6('0x82')])){_0x55293e['id']={'$notIn':_0x583777['body'][_0x6bb6('0x82')]};}_0x51d7f0=[[_0x6bb6('0x89'),_0x6bb6('0x85')],[_0x6bb6('0x84'),_0x5d6700[0x0][_0x6bb6('0x7d')]],db[_0x6bb6('0x7e')]['literal'](_0x6bb6('0x8a')),['id','ASC']];}return db['CmHopper'][_0x6bb6('0x8b')]({'attributes':['id',_0x6bb6('0x8c')],'where':_0x55293e,'order':_0x51d7f0,'transaction':_0x56c04b,'lock':_0x56c04b['LOCK'][_0x6bb6('0x8d')],'include':[{'model':db[_0x6bb6('0x7a')],'as':'Contact','attributes':_0x140fd5,'include':[{'model':db[_0x6bb6('0x8e')],'as':_0x6bb6('0x8f'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x6bb6('0x90'),'attributes':['id',_0x6bb6('0x26')]},{'model':db[_0x6bb6('0x5f')],'as':'Queue','attributes':['id',_0x6bb6('0x26'),_0x6bb6('0x91')]}]})[_0x6bb6('0x22')](function(_0x3cbaa7){if(_0x3cbaa7){return _0x3cbaa7[_0x6bb6('0x59')]({'UserId':_0x583777['user']['id']},{'transaction':_0x56c04b});}});});}})['then'](handleEntityNotFound(_0x4a6eb2,null))[_0x6bb6('0x22')](respondWithResult(_0x4a6eb2,null))[_0x6bb6('0x51')](handleError(_0x4a6eb2,null));};exports[_0x6bb6('0x92')]=function(_0x3d414f,_0x12118b,_0xdbe717){return _0x3d414f[_0x6bb6('0x69')][_0x6bb6('0x7b')]({'where':{'type':_0x6bb6('0x93'),'dialActive':!![],'dialMethod':_0x6bb6('0x7c')},'attributes':['id'],'raw':!![]})[_0x6bb6('0x22')](function(_0x115e5a){if(_0x115e5a&&_0x115e5a[_0x6bb6('0x54')]){return db[_0x6bb6('0x2a')][_0x6bb6('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6bb6('0x6c')](_0x6bb6('0x6d'))},'VoiceQueueId':{'$in':_['map'](_0x115e5a,'id')},'$or':[{'UserId':null},{'UserId':_0x3d414f[_0x6bb6('0x69')]['id']}]}});}return 0x0;})[_0x6bb6('0x22')](function(_0x709d14){if(!_[_0x6bb6('0x75')](_0x709d14)&&_['isNumber'](_0x709d14)){return _0x12118b[_0x6bb6('0x18')](0xc8)[_0x6bb6('0x1a')]({'contacts':_0x709d14});}else{logger[_0x6bb6('0x24')](_0x6bb6('0x94'),_0x6bb6('0x92'),0x194,'entity\x20not\x20found');_0x12118b['sendStatus'](0x194);}})[_0x6bb6('0x51')](handleError(_0x12118b,null));};exports[_0x6bb6('0x95')]=function(_0x4f078b,_0x99dd7b,_0x5bda40){var _0x468f2d=shared['timezones'];var _0x5705fd=[];_[_0x6bb6('0x29')](_0x468f2d,function(_0x448748){_0x5705fd[_0x6bb6('0x96')]({'id':_0x448748[_0x6bb6('0x26')],'name':_0x448748[_0x6bb6('0x26')],'utcOffset':_0x448748[_0x6bb6('0x97')]});});return _0x99dd7b[_0x6bb6('0x18')](0xc8)['json']({'tz':_0x5705fd});};exports[_0x6bb6('0x98')]=function(_0x1ebc70,_0xb71302,_0x332d9b){var _0x23c197=shared[_0x6bb6('0x99')];var _0x20048f={};if(!_[_0x6bb6('0x75')](_0x23c197[_0x1ebc70[_0x6bb6('0x5a')]['id']]))_0x20048f=_0x23c197[_0x1ebc70[_0x6bb6('0x5a')]['id']];return _0xb71302['status'](0xc8)['json'](_0x20048f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 524f056..29669a1 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 _0x88f3=['cm_hopper','scheduledat','phone','priority','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define'];(function(_0x5ee857,_0x15dcfd){var _0x1d0424=function(_0x3cd99c){while(--_0x3cd99c){_0x5ee857['push'](_0x5ee857['shift']());}};_0x1d0424(++_0x15dcfd);}(_0x88f3,0x12f));var _0x388f=function(_0x274bdf,_0x97fb8){_0x274bdf=_0x274bdf-0x0;var _0x559282=_0x88f3[_0x274bdf];return _0x559282;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x388f('0x0'));var moment=require('moment');var BPromise=require(_0x388f('0x1'));var rp=require(_0x388f('0x2'));var fs=require('fs');var path=require(_0x388f('0x3'));var rimraf=require(_0x388f('0x4'));var config=require(_0x388f('0x5'));var attributes=require(_0x388f('0x6'));module[_0x388f('0x7')]=function(_0x4a13fb,_0x128e41){return _0x4a13fb[_0x388f('0x8')]('CmHopper',attributes,{'tableName':_0x388f('0x9'),'paranoid':![],'indexes':[{'name':_0x388f('0xa'),'fields':['scheduledat']},{'name':_0x388f('0xb'),'fields':[_0x388f('0xb')]},{'name':'priority','fields':[_0x388f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ce0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','phone','priority','lodash','util','../../config/logger','api'];(function(_0x3fcf30,_0xe3a49e){var _0x2ed4b0=function(_0x306e68){while(--_0x306e68){_0x3fcf30['push'](_0x3fcf30['shift']());}};_0x2ed4b0(++_0xe3a49e);}(_0x0ce0,0xb2));var _0x00ce=function(_0x48f011,_0x4f4a87){_0x48f011=_0x48f011-0x0;var _0x47824e=_0x0ce0[_0x48f011];return _0x47824e;};'use strict';var _=require(_0x00ce('0x0'));var util=require(_0x00ce('0x1'));var logger=require(_0x00ce('0x2'))(_0x00ce('0x3'));var moment=require(_0x00ce('0x4'));var BPromise=require(_0x00ce('0x5'));var rp=require(_0x00ce('0x6'));var fs=require('fs');var path=require(_0x00ce('0x7'));var rimraf=require(_0x00ce('0x8'));var config=require(_0x00ce('0x9'));var attributes=require('./cmHopper.attributes');module[_0x00ce('0xa')]=function(_0x3a2d15,_0x5dce57){return _0x3a2d15[_0x00ce('0xb')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0x00ce('0xc'),'fields':['phone']},{'name':_0x00ce('0xd'),'fields':[_0x00ce('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 2816319..9d48266 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 _0x978b=['\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','Contact','log','req\x20value','phone\x20value','findOne','DESC','getcontactbyohone','getContactByPhone','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','model','map','debug','find','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','CmContact','sequelize','transaction','findAll','order','LOCK','UPDATE','keys','Agent','name','voicePause','length','includes','push','UserId','update','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22'];(function(_0x58c5e8,_0x4b6c59){var _0x5bae00=function(_0x505be3){while(--_0x505be3){_0x58c5e8['push'](_0x58c5e8['shift']());}};_0x5bae00(++_0x4b6c59);}(_0x978b,0x1e0));var _0xb978=function(_0xc70388,_0x2e0675){_0xc70388=_0xc70388-0x0;var _0x2956fe=_0x978b[_0xc70388];return _0x2956fe;};'use strict';var _=require('lodash');var util=require(_0xb978('0x0'));var moment=require(_0xb978('0x1'));var BPromise=require('bluebird');var rs=require(_0xb978('0x2'));var fs=require('fs');var Redis=require(_0xb978('0x3'));var db=require(_0xb978('0x4'))['db'];var utils=require(_0xb978('0x5'));var logger=require(_0xb978('0x6'))(_0xb978('0x7'));var config=require('../../config/environment');var jayson=require(_0xb978('0x8'));var client=jayson[_0xb978('0x9')][_0xb978('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24d406,_0x545103,_0x21b820){return new BPromise(function(_0x31546b,_0x36b273){return client[_0xb978('0xb')](_0x24d406,_0x21b820)[_0xb978('0xc')](function(_0x2da5fb){logger[_0xb978('0xd')]('CmHopper,\x20%s,\x20%s',_0x545103,_0xb978('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x545103,_0xb978('0xe'),JSON[_0xb978('0xf')](_0x2da5fb));if(_0x2da5fb[_0xb978('0x10')]){if(_0x2da5fb[_0xb978('0x10')][_0xb978('0x11')]===0x1f4){logger[_0xb978('0x10')](_0xb978('0x12'),_0x545103,_0x2da5fb[_0xb978('0x10')][_0xb978('0x13')]);return _0x36b273(_0x2da5fb['error'][_0xb978('0x13')]);}logger[_0xb978('0x10')](_0xb978('0x12'),_0x545103,_0x2da5fb['error'][_0xb978('0x13')]);return _0x31546b(_0x2da5fb[_0xb978('0x10')][_0xb978('0x13')]);}else{logger[_0xb978('0xd')]('CmHopper,\x20%s,\x20%s',_0x545103,_0xb978('0xe'));_0x31546b(_0x2da5fb[_0xb978('0x14')][_0xb978('0x13')]);}})[_0xb978('0x15')](function(_0x1c95b1){logger[_0xb978('0x10')](_0xb978('0x12'),_0x545103,_0x1c95b1);_0x36b273(_0x1c95b1);});});}exports[_0xb978('0x16')]=function(_0x187986){var _0xb3e8c0=this;return new Promise(function(_0x4ca3d8,_0x5683b2){return db[_0xb978('0x17')]['findAll']({'raw':_0x187986[_0xb978('0x18')]?_0x187986[_0xb978('0x18')][_0xb978('0x19')]===undefined?!![]:![]:!![],'where':_0x187986['options']?_0x187986['options'][_0xb978('0x1a')]||null:null,'attributes':_0x187986[_0xb978('0x18')]?_0x187986[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'limit':_0x187986['options']?_0x187986[_0xb978('0x18')][_0xb978('0x1c')]||null:null,'include':_0x187986[_0xb978('0x18')]?_0x187986[_0xb978('0x18')][_0xb978('0x1d')]?_['map'](_0x187986['options'][_0xb978('0x1d')],function(_0x20615a){return{'model':db[_0x20615a[_0xb978('0x1e')]],'as':_0x20615a['as'],'attributes':_0x20615a['attributes'],'include':_0x20615a[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x20615a[_0xb978('0x1d')],function(_0x191f0a){return{'model':db[_0x191f0a['model']],'as':_0x191f0a['as'],'attributes':_0x191f0a[_0xb978('0x1b')],'include':_0x191f0a[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x191f0a[_0xb978('0x1d')],function(_0x1e78a1){return{'model':db[_0x1e78a1['model']],'as':_0x1e78a1['as'],'attributes':_0x1e78a1[_0xb978('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb978('0xc')](function(_0x5c5c16){logger[_0xb978('0xd')](_0xb978('0x16'),_0x187986);logger[_0xb978('0x20')]('GetCmHopper',_0x187986,JSON[_0xb978('0xf')](_0x5c5c16));_0x4ca3d8(_0x5c5c16);})[_0xb978('0x15')](function(_0x25f228){logger['error'](_0xb978('0x16'),_0x25f228[_0xb978('0x13')],_0x187986);_0x5683b2(_0xb3e8c0[_0xb978('0x10')](0x1f4,_0x25f228['message']));});});};exports['ShowCmHopper']=function(_0x590619){var _0x35ea17=this;return new Promise(function(_0x5e5c26,_0x84bbdb){return db[_0xb978('0x17')][_0xb978('0x21')]({'raw':_0x590619[_0xb978('0x18')]?_0x590619[_0xb978('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x590619[_0xb978('0x18')]?_0x590619[_0xb978('0x18')]['where']||null:null,'attributes':_0x590619['options']?_0x590619[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'include':_0x590619['options']?_0x590619[_0xb978('0x18')][_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x590619['options'][_0xb978('0x1d')],function(_0x2a5b0b){return{'model':db[_0x2a5b0b[_0xb978('0x1e')]],'as':_0x2a5b0b['as'],'attributes':_0x2a5b0b['attributes'],'include':_0x2a5b0b['include']?_[_0xb978('0x1f')](_0x2a5b0b[_0xb978('0x1d')],function(_0x5ede16){return{'model':db[_0x5ede16[_0xb978('0x1e')]],'as':_0x5ede16['as'],'attributes':_0x5ede16[_0xb978('0x1b')],'include':_0x5ede16[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x5ede16[_0xb978('0x1d')],function(_0x16bedf){return{'model':db[_0x16bedf[_0xb978('0x1e')]],'as':_0x16bedf['as'],'attributes':_0x16bedf[_0xb978('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb978('0xc')](function(_0x571871){logger[_0xb978('0xd')]('ShowCmHopper',_0x590619);logger[_0xb978('0x20')](_0xb978('0x22'),_0x590619,JSON[_0xb978('0xf')](_0x571871));_0x5e5c26(_0x571871);})[_0xb978('0x15')](function(_0x4370cd){logger[_0xb978('0x10')]('ShowCmHopper',_0x4370cd[_0xb978('0x13')],_0x590619);_0x84bbdb(_0x35ea17[_0xb978('0x10')](0x1f4,_0x4370cd[_0xb978('0x13')]));});});};exports[_0xb978('0x23')]=function(_0x5134e2){var _0x4bfc58=this;return new Promise(function(_0x249a4c,_0x1a9edf){return db[_0xb978('0x17')][_0xb978('0x24')](_0x5134e2[_0xb978('0x25')],{'raw':_0x5134e2['options']?_0x5134e2['options']['raw']===undefined?!![]:![]:!![]})[_0xb978('0xc')](function(_0x5e60f9){logger[_0xb978('0xd')](_0xb978('0x23'),_0x5134e2);logger[_0xb978('0x20')](_0xb978('0x23'),_0x5134e2,JSON[_0xb978('0xf')](_0x5e60f9));_0x249a4c(_0x5e60f9);})[_0xb978('0x15')](function(_0x54552e){logger[_0xb978('0x10')](_0xb978('0x23'),_0x54552e['message'],_0x5134e2);_0x1a9edf(_0x4bfc58[_0xb978('0x10')](0x1f4,_0x54552e[_0xb978('0x13')]));});});};exports[_0xb978('0x26')]=function(_0x51ddea){var _0xaa0b98=this;return new Promise(function(_0x49d6df,_0x4db1f9){return db[_0xb978('0x17')]['update'](_0x51ddea[_0xb978('0x25')],{'raw':_0x51ddea['options']?_0x51ddea[_0xb978('0x18')][_0xb978('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51ddea['options']?_0x51ddea['options']['where']||null:null,'attributes':_0x51ddea[_0xb978('0x18')]?_0x51ddea[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'limit':_0x51ddea[_0xb978('0x18')]?_0x51ddea[_0xb978('0x18')][_0xb978('0x1c')]||null:null})[_0xb978('0xc')](function(_0x2d9267){logger[_0xb978('0xd')](_0xb978('0x26'),_0x51ddea);logger[_0xb978('0x20')](_0xb978('0x26'),_0x51ddea,JSON[_0xb978('0xf')](_0x2d9267));_0x49d6df(_0x2d9267);})[_0xb978('0x15')](function(_0x23e13d){logger[_0xb978('0x10')](_0xb978('0x26'),_0x23e13d[_0xb978('0x13')],_0x51ddea);_0x4db1f9(_0xaa0b98['error'](0x1f4,_0x23e13d[_0xb978('0x13')]));});});};exports[_0xb978('0x27')]=function(_0x2932a9){var _0x302278=this;return new Promise(function(_0xdd5df6,_0x44206e){return db[_0xb978('0x17')]['destroy']({'where':_0x2932a9[_0xb978('0x18')]?_0x2932a9[_0xb978('0x18')][_0xb978('0x1a')]||null:null})[_0xb978('0xc')](function(_0x4e128f){logger[_0xb978('0xd')](_0xb978('0x27'),_0x2932a9);logger['debug'](_0xb978('0x27'),_0x2932a9,JSON[_0xb978('0xf')](_0x4e128f));_0xdd5df6(_0x4e128f);})[_0xb978('0x15')](function(_0x5a396b){logger[_0xb978('0x10')]('DestroyCmHopper',_0x5a396b[_0xb978('0x13')],_0x2932a9);_0x44206e(_0x302278[_0xb978('0x10')](0x1f4,_0x5a396b[_0xb978('0x13')]));});});};exports['GetContactDialer']=function(_0x53bbea){var _0x490141=this;return new Promise(function(_0x56a2a1,_0x35c68d){return db[_0xb978('0x28')]['describe']()[_0xb978('0xc')](function(_0x547d50){return db[_0xb978('0x29')][_0xb978('0x2a')](function(_0x503ad2){return db[_0xb978('0x17')][_0xb978('0x2b')]({'where':_0x53bbea[_0xb978('0x18')]?_0x53bbea[_0xb978('0x18')][_0xb978('0x1a')]||null:null,'attributes':_0x53bbea[_0xb978('0x18')]?_0x53bbea[_0xb978('0x18')]['attributes']||null:null,'limit':_0x53bbea[_0xb978('0x18')]?_0x53bbea[_0xb978('0x18')][_0xb978('0x1c')]||null:null,'order':_0x53bbea[_0xb978('0x18')]?_0x53bbea['options'][_0xb978('0x2c')]||null:null,'transaction':_0x503ad2,'lock':_0x503ad2[_0xb978('0x2d')][_0xb978('0x2e')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0xb978('0x2f')](_0x547d50)},{'model':db['User'],'as':_0xb978('0x30'),'attributes':['id',_0xb978('0x31'),_0xb978('0x32')]}]})[_0xb978('0xc')](function(_0x3be470){var _0x1f45be=[];var _0x10fff1=[];for(var _0x382dd1=0x0;_0x382dd1<_0x3be470[_0xb978('0x33')];_0x382dd1+=0x1){if(!_0x10fff1[_0xb978('0x34')](_0x3be470[_0x382dd1]['UserId'])){_0x10fff1[_0xb978('0x35')](_0x3be470[_0x382dd1][_0xb978('0x36')]);_0x1f45be['push'](_0x3be470[_0x382dd1][_0xb978('0x37')](_0x53bbea[_0xb978('0x25')],{'transaction':_0x503ad2}));}}return BPromise['all'](_0x1f45be);});})[_0xb978('0xc')](function(_0x20b177){logger[_0xb978('0xd')](_0xb978('0x38'),_0x53bbea);logger[_0xb978('0x20')](_0xb978('0x38'),_0x53bbea,JSON[_0xb978('0xf')](_0x20b177));_0x56a2a1(_0x20b177);})[_0xb978('0x15')](function(_0x5cadb9){logger['error'](_0xb978('0x38'),_0x5cadb9[_0xb978('0x13')],_0x53bbea);_0x35c68d(_0x490141['error'](0x1f4,_0x5cadb9[_0xb978('0x13')]));});});});};exports[_0xb978('0x39')]=function(_0x36fac0){var _0x1ec426=this;return new Promise(function(_0x31fc5b,_0x1e3b81){return db['sequelize'][_0xb978('0x2a')](function(_0x2bf097){return db[_0xb978('0x3a')][_0xb978('0x24')](_0x36fac0['body'],{'raw':_0x36fac0[_0xb978('0x18')]?_0x36fac0[_0xb978('0x18')][_0xb978('0x19')]===undefined?!![]:![]:!![],'transaction':_0x2bf097})['then'](function(){return db[_0xb978('0x17')][_0xb978('0x3b')]({'where':_0x36fac0[_0xb978('0x18')]?_0x36fac0[_0xb978('0x18')][_0xb978('0x1a')]||null:null,'transaction':_0x2bf097});});})[_0xb978('0xc')](function(_0x4dd4e0){logger[_0xb978('0xd')]('MoveContactManagedDialer',_0x36fac0);logger[_0xb978('0x20')]('MoveContactManagedDialer',_0x36fac0,JSON[_0xb978('0xf')](_0x4dd4e0));_0x31fc5b(_0x4dd4e0);})['catch'](function(_0x434d3d){logger['error'](_0xb978('0x39'),_0x434d3d['message'],_0x36fac0);_0x1e3b81(_0x1ec426[_0xb978('0x10')](0x1f4,_0x434d3d['message']));});});};exports[_0xb978('0x3c')]=function(_0x46de12){var _0x493c7e=this;return new Promise(function(_0x4e6062,_0x8868c3){return db[_0xb978('0x17')][_0xb978('0x2b')]({'raw':_0x46de12[_0xb978('0x18')]?_0x46de12[_0xb978('0x18')][_0xb978('0x19')]===undefined?!![]:![]:!![],'where':_0x46de12['options']?_0x46de12[_0xb978('0x18')][_0xb978('0x1a')]||null:null,'attributes':[[db[_0xb978('0x29')]['fn'](_0xb978('0x3d'),db['sequelize']['fn']('IF',db['sequelize'][_0xb978('0x3e')](_0xb978('0x3f')+util[_0xb978('0x40')](_0xb978('0x41'),moment()[_0xb978('0x40')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xb978('0x42')))),_0xb978('0x43')]]})[_0xb978('0xc')](function(_0x3891b4){logger[_0xb978('0xd')](_0xb978('0x3c'),_0x46de12);logger['debug'](_0xb978('0x3c'),_0x46de12,JSON[_0xb978('0xf')](_0x3891b4));_0x4e6062(_0x3891b4);})[_0xb978('0x15')](function(_0x3097fe){logger[_0xb978('0x10')](_0xb978('0x3c'),_0x3097fe[_0xb978('0x13')],_0x46de12);_0x8868c3(_0x493c7e['error'](0x1f4,_0x3097fe[_0xb978('0x13')]));});});};exports[_0xb978('0x44')]=function(_0x4810b6){var _0x2b5447=this;return new Promise(function(_0x124851,_0x5c9b45){return db['CmContact']['describe']()[_0xb978('0xc')](function(_0x62f290){return db[_0xb978('0x29')][_0xb978('0x2a')](function(_0x381711){return db[_0xb978('0x17')][_0xb978('0x2b')]({'where':_0x4810b6[_0xb978('0x18')]?_0x4810b6[_0xb978('0x18')][_0xb978('0x1a')]||null:null,'attributes':_0x4810b6[_0xb978('0x18')]?_0x4810b6[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'limit':0x1,'order':_0x4810b6[_0xb978('0x18')]?_0x4810b6[_0xb978('0x18')][_0xb978('0x2c')]||null:null,'group':db['CmHopper'][_0xb978('0x36')],'transaction':_0x381711,'lock':_0x381711[_0xb978('0x2d')][_0xb978('0x2e')],'include':_0x4810b6[_0xb978('0x18')]?_0x4810b6[_0xb978('0x18')][_0xb978('0x1d')]?_['map'](_0x4810b6['options'][_0xb978('0x1d')],function(_0x182a3d){return{'model':db[_0x182a3d[_0xb978('0x1e')]],'as':_0x182a3d['as'],'attributes':_0x182a3d[_0xb978('0x1b')],'include':_0x182a3d[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x182a3d[_0xb978('0x1d')],function(_0x2e8fa1){return{'model':db[_0x2e8fa1[_0xb978('0x1e')]],'as':_0x2e8fa1['as'],'attributes':_0x2e8fa1[_0xb978('0x1b')],'include':_0x2e8fa1[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x2e8fa1['include'],function(_0x43f7b5){return{'model':db[_0x43f7b5[_0xb978('0x1e')]],'as':_0x43f7b5['as'],'attributes':_0x43f7b5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb978('0xc')](function(_0x3907bb){var _0x4f3311=[];for(var _0x6231f9=0x0;_0x6231f9<_0x3907bb[_0xb978('0x33')];_0x6231f9+=0x1){_0x4f3311[_0xb978('0x35')](_0x3907bb[_0x6231f9][_0xb978('0x37')](_0x4810b6[_0xb978('0x25')],{'transaction':_0x381711}));}return BPromise[_0xb978('0x45')](_0x4f3311);});})['then'](function(_0x58c98c){logger[_0xb978('0xd')]('GetContactRecallMe',_0x4810b6);logger[_0xb978('0x20')](_0xb978('0x44'),_0x4810b6,JSON[_0xb978('0xf')](_0x58c98c));_0x124851(_0x58c98c);})[_0xb978('0x15')](function(_0x176491){logger[_0xb978('0x10')]('GetContactRecallMe',_0x176491['message'],_0x4810b6);_0x5c9b45(_0x2b5447['error'](0x1f4,_0x176491[_0xb978('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x388a06){var _0x89e7d3=this;return new Promise(function(_0x12b2be,_0x1a3dc6){db[_0xb978('0x28')]['describe']()['then'](function(_0x208c03){return db[_0xb978('0x17')][_0xb978('0x2b')]({'raw':_0x388a06[_0xb978('0x18')]?_0x388a06[_0xb978('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x388a06['options']?_0x388a06['options'][_0xb978('0x1a')]||null:null,'attributes':_0x388a06[_0xb978('0x18')]?_0x388a06[_0xb978('0x18')][_0xb978('0x1b')]||null:null,'limit':_0x388a06[_0xb978('0x18')]?_0x388a06[_0xb978('0x18')][_0xb978('0x1c')]||null:null,'include':_0x388a06[_0xb978('0x18')]?_0x388a06[_0xb978('0x18')][_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x388a06[_0xb978('0x18')][_0xb978('0x1d')],function(_0x452d15){return{'model':db[_0x452d15[_0xb978('0x1e')]],'as':_0x452d15['as'],'attributes':_0x452d15['as']===_0xb978('0x46')?_[_0xb978('0x2f')](_0x208c03):_0x452d15['attributes'],'include':_0x452d15[_0xb978('0x1d')]?_[_0xb978('0x1f')](_0x452d15[_0xb978('0x1d')],function(_0xbd1399){return{'model':db[_0xbd1399['model']],'as':_0xbd1399['as'],'attributes':_0xbd1399[_0xb978('0x1b')],'include':_0xbd1399['include']?_['map'](_0xbd1399['include'],function(_0x2cc192){return{'model':db[_0x2cc192[_0xb978('0x1e')]],'as':_0x2cc192['as'],'attributes':_0x2cc192['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d5f69){logger['info'](_0xb978('0x16'),_0x388a06);logger['debug'](_0xb978('0x16'),_0x388a06,JSON[_0xb978('0xf')](_0x3d5f69));_0x12b2be(_0x3d5f69);})[_0xb978('0x15')](function(_0xbb04f6){logger['error']('GetCmHopper',_0xbb04f6[_0xb978('0x13')],_0x388a06);_0x1a3dc6(_0x89e7d3['error'](0x1f4,_0xbb04f6[_0xb978('0x13')]));});});});};exports['GetContactByPhone']=function(_0x5a4e79){console[_0xb978('0x47')](_0xb978('0x48'),_0x5a4e79);console['log'](_0xb978('0x49'),_0x5a4e79[_0xb978('0x18')][_0xb978('0x1a')]['phone']);return new Promise(function(_0x2f0fe8,_0x4718db){return db[_0xb978('0x28')][_0xb978('0x4a')]({'raw':!![],'where':{'phone':_0x5a4e79['options'][_0xb978('0x1a')]['phone']},'attributes':['id'],'order':[['id',_0xb978('0x4b')]]})['then'](function(_0x402004){console[_0xb978('0x47')](_0xb978('0x4c'),_0x402004);logger[_0xb978('0xd')](_0xb978('0x4d'),_0x5a4e79);logger[_0xb978('0x20')]('getContactByPhone',_0x5a4e79,JSON[_0xb978('0xf')](_0x402004));_0x2f0fe8(_0x402004);})[_0xb978('0x15')](function(_0x1e05b4){logger[_0xb978('0x10')]('getContactByPhone',_0x1e05b4[_0xb978('0x13')],_0x5a4e79);_0x4718db(_this[_0xb978('0x10')](0x1f4,_0x1e05b4[_0xb978('0x13')]));});});}; \ No newline at end of file +var _0x493c=['CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','model','attributes','include','map','debug','catch','ShowCmHopper','body','CreateCmHopper','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','limit','LOCK','UPDATE','Contact','keys','User','Agent','voicePause','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','create','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','CountReScheduled','GetContactRecallMe','log','req\x20value','phone\x20value','phone','findOne','DESC','getcontactbyohone','getContactByPhone','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2a1268,_0x4f93b8){var _0x2bf668=function(_0x50b8e5){while(--_0x50b8e5){_0x2a1268['push'](_0x2a1268['shift']());}};_0x2bf668(++_0x4f93b8);}(_0x493c,0x161));var _0xc493=function(_0x4f9ecf,_0x3004c3){_0x4f9ecf=_0x4f9ecf-0x0;var _0x10eca6=_0x493c[_0x4f9ecf];return _0x10eca6;};'use strict';var _=require('lodash');var util=require(_0xc493('0x0'));var moment=require(_0xc493('0x1'));var BPromise=require(_0xc493('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc493('0x3'));var db=require(_0xc493('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc493('0x5'));var config=require('../../config/environment');var jayson=require(_0xc493('0x6'));var client=jayson[_0xc493('0x7')][_0xc493('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41cff3,_0x40552d,_0xf5aa16){return new BPromise(function(_0x833c08,_0x1245c5){return client[_0xc493('0x9')](_0x41cff3,_0xf5aa16)[_0xc493('0xa')](function(_0x50f4a0){logger[_0xc493('0xb')](_0xc493('0xc'),_0x40552d,'request\x20sent');logger['debug'](_0xc493('0xd'),_0x40552d,_0xc493('0xe'),JSON[_0xc493('0xf')](_0x50f4a0));if(_0x50f4a0[_0xc493('0x10')]){if(_0x50f4a0['error']['code']===0x1f4){logger['error'](_0xc493('0xc'),_0x40552d,_0x50f4a0[_0xc493('0x10')][_0xc493('0x11')]);return _0x1245c5(_0x50f4a0[_0xc493('0x10')][_0xc493('0x11')]);}logger[_0xc493('0x10')](_0xc493('0xc'),_0x40552d,_0x50f4a0[_0xc493('0x10')]['message']);return _0x833c08(_0x50f4a0[_0xc493('0x10')][_0xc493('0x11')]);}else{logger[_0xc493('0xb')](_0xc493('0xc'),_0x40552d,_0xc493('0xe'));_0x833c08(_0x50f4a0[_0xc493('0x12')][_0xc493('0x11')]);}})['catch'](function(_0x4698bd){logger[_0xc493('0x10')](_0xc493('0xc'),_0x40552d,_0x4698bd);_0x1245c5(_0x4698bd);});});}exports[_0xc493('0x13')]=function(_0x26783a){var _0x388e4b=this;return new Promise(function(_0x65b13e,_0x6247e){return db[_0xc493('0x14')][_0xc493('0x15')]({'raw':_0x26783a[_0xc493('0x16')]?_0x26783a[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'where':_0x26783a['options']?_0x26783a[_0xc493('0x16')][_0xc493('0x18')]||null:null,'attributes':_0x26783a['options']?_0x26783a[_0xc493('0x16')]['attributes']||null:null,'limit':_0x26783a['options']?_0x26783a[_0xc493('0x16')]['limit']||null:null,'include':_0x26783a['options']?_0x26783a[_0xc493('0x16')]['include']?_['map'](_0x26783a['options']['include'],function(_0x31a8ca){return{'model':db[_0x31a8ca[_0xc493('0x19')]],'as':_0x31a8ca['as'],'attributes':_0x31a8ca[_0xc493('0x1a')],'include':_0x31a8ca[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x31a8ca[_0xc493('0x1b')],function(_0x4429ba){return{'model':db[_0x4429ba[_0xc493('0x19')]],'as':_0x4429ba['as'],'attributes':_0x4429ba[_0xc493('0x1a')],'include':_0x4429ba[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x4429ba[_0xc493('0x1b')],function(_0x1769de){return{'model':db[_0x1769de[_0xc493('0x19')]],'as':_0x1769de['as'],'attributes':_0x1769de[_0xc493('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xa')](function(_0x3631d1){logger[_0xc493('0xb')](_0xc493('0x13'),_0x26783a);logger[_0xc493('0x1d')](_0xc493('0x13'),_0x26783a,JSON['stringify'](_0x3631d1));_0x65b13e(_0x3631d1);})[_0xc493('0x1e')](function(_0x99df85){logger[_0xc493('0x10')](_0xc493('0x13'),_0x99df85[_0xc493('0x11')],_0x26783a);_0x6247e(_0x388e4b[_0xc493('0x10')](0x1f4,_0x99df85[_0xc493('0x11')]));});});};exports[_0xc493('0x1f')]=function(_0x3974bd){var _0x2a7a9b=this;return new Promise(function(_0x41abb1,_0x595503){return db['CmHopper']['find']({'raw':_0x3974bd['options']?_0x3974bd[_0xc493('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3974bd[_0xc493('0x16')]?_0x3974bd['options'][_0xc493('0x18')]||null:null,'attributes':_0x3974bd[_0xc493('0x16')]?_0x3974bd[_0xc493('0x16')]['attributes']||null:null,'include':_0x3974bd[_0xc493('0x16')]?_0x3974bd[_0xc493('0x16')][_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x3974bd[_0xc493('0x16')][_0xc493('0x1b')],function(_0x4e521a){return{'model':db[_0x4e521a[_0xc493('0x19')]],'as':_0x4e521a['as'],'attributes':_0x4e521a[_0xc493('0x1a')],'include':_0x4e521a[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x4e521a[_0xc493('0x1b')],function(_0x1f5f2c){return{'model':db[_0x1f5f2c[_0xc493('0x19')]],'as':_0x1f5f2c['as'],'attributes':_0x1f5f2c[_0xc493('0x1a')],'include':_0x1f5f2c[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x1f5f2c[_0xc493('0x1b')],function(_0x583341){return{'model':db[_0x583341[_0xc493('0x19')]],'as':_0x583341['as'],'attributes':_0x583341['attributes']};}):[]};}):[]};}):[]:[]})[_0xc493('0xa')](function(_0x33c1d7){logger[_0xc493('0xb')](_0xc493('0x1f'),_0x3974bd);logger[_0xc493('0x1d')](_0xc493('0x1f'),_0x3974bd,JSON[_0xc493('0xf')](_0x33c1d7));_0x41abb1(_0x33c1d7);})[_0xc493('0x1e')](function(_0x1f7e73){logger[_0xc493('0x10')](_0xc493('0x1f'),_0x1f7e73[_0xc493('0x11')],_0x3974bd);_0x595503(_0x2a7a9b[_0xc493('0x10')](0x1f4,_0x1f7e73['message']));});});};exports['CreateCmHopper']=function(_0x4acea6){var _0x58e3e6=this;return new Promise(function(_0x1b81d2,_0x14e9e4){return db[_0xc493('0x14')]['create'](_0x4acea6[_0xc493('0x20')],{'raw':_0x4acea6[_0xc493('0x16')]?_0x4acea6[_0xc493('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc493('0xa')](function(_0x3d5a5a){logger[_0xc493('0xb')](_0xc493('0x21'),_0x4acea6);logger[_0xc493('0x1d')]('CreateCmHopper',_0x4acea6,JSON[_0xc493('0xf')](_0x3d5a5a));_0x1b81d2(_0x3d5a5a);})[_0xc493('0x1e')](function(_0x16dcb1){logger[_0xc493('0x10')]('CreateCmHopper',_0x16dcb1[_0xc493('0x11')],_0x4acea6);_0x14e9e4(_0x58e3e6['error'](0x1f4,_0x16dcb1['message']));});});};exports[_0xc493('0x22')]=function(_0xb18f2d){var _0x5530e2=this;return new Promise(function(_0xa48251,_0x582312){return db[_0xc493('0x14')][_0xc493('0x23')](_0xb18f2d[_0xc493('0x20')],{'raw':_0xb18f2d[_0xc493('0x16')]?_0xb18f2d[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb18f2d[_0xc493('0x16')]?_0xb18f2d[_0xc493('0x16')][_0xc493('0x18')]||null:null,'attributes':_0xb18f2d[_0xc493('0x16')]?_0xb18f2d[_0xc493('0x16')][_0xc493('0x1a')]||null:null,'limit':_0xb18f2d[_0xc493('0x16')]?_0xb18f2d[_0xc493('0x16')]['limit']||null:null})[_0xc493('0xa')](function(_0x59c162){logger[_0xc493('0xb')]('UpdateCmHopper',_0xb18f2d);logger[_0xc493('0x1d')](_0xc493('0x22'),_0xb18f2d,JSON[_0xc493('0xf')](_0x59c162));_0xa48251(_0x59c162);})[_0xc493('0x1e')](function(_0x3adce9){logger[_0xc493('0x10')]('UpdateCmHopper',_0x3adce9['message'],_0xb18f2d);_0x582312(_0x5530e2[_0xc493('0x10')](0x1f4,_0x3adce9[_0xc493('0x11')]));});});};exports['DestroyCmHopper']=function(_0x441a3f){var _0x5ef527=this;return new Promise(function(_0x7ca62,_0x2be0f5){return db[_0xc493('0x14')][_0xc493('0x24')]({'where':_0x441a3f[_0xc493('0x16')]?_0x441a3f[_0xc493('0x16')][_0xc493('0x18')]||null:null})[_0xc493('0xa')](function(_0x4b336d){logger[_0xc493('0xb')]('DestroyCmHopper',_0x441a3f);logger['debug'](_0xc493('0x25'),_0x441a3f,JSON[_0xc493('0xf')](_0x4b336d));_0x7ca62(_0x4b336d);})['catch'](function(_0x1af985){logger['error']('DestroyCmHopper',_0x1af985[_0xc493('0x11')],_0x441a3f);_0x2be0f5(_0x5ef527[_0xc493('0x10')](0x1f4,_0x1af985[_0xc493('0x11')]));});});};exports[_0xc493('0x26')]=function(_0x56106c){var _0x126605=this;return new Promise(function(_0x7f809a,_0x367d01){return db[_0xc493('0x27')][_0xc493('0x28')]()[_0xc493('0xa')](function(_0x27f34d){return db['sequelize'][_0xc493('0x29')](function(_0x340dc5){return db[_0xc493('0x14')][_0xc493('0x15')]({'where':_0x56106c['options']?_0x56106c[_0xc493('0x16')]['where']||null:null,'attributes':_0x56106c[_0xc493('0x16')]?_0x56106c[_0xc493('0x16')][_0xc493('0x1a')]||null:null,'limit':_0x56106c[_0xc493('0x16')]?_0x56106c[_0xc493('0x16')][_0xc493('0x2a')]||null:null,'order':_0x56106c[_0xc493('0x16')]?_0x56106c[_0xc493('0x16')]['order']||null:null,'transaction':_0x340dc5,'lock':_0x340dc5[_0xc493('0x2b')][_0xc493('0x2c')],'include':[{'model':db['CmContact'],'as':_0xc493('0x2d'),'attributes':_[_0xc493('0x2e')](_0x27f34d)},{'model':db[_0xc493('0x2f')],'as':_0xc493('0x30'),'attributes':['id','name',_0xc493('0x31')]}]})[_0xc493('0xa')](function(_0x17d99f){var _0x371dbc=[];var _0x2113bb=[];for(var _0x3f279c=0x0;_0x3f279c<_0x17d99f['length'];_0x3f279c+=0x1){if(!_0x2113bb['includes'](_0x17d99f[_0x3f279c][_0xc493('0x32')])){_0x2113bb[_0xc493('0x33')](_0x17d99f[_0x3f279c]['UserId']);_0x371dbc[_0xc493('0x33')](_0x17d99f[_0x3f279c]['update'](_0x56106c[_0xc493('0x20')],{'transaction':_0x340dc5}));}}return BPromise[_0xc493('0x34')](_0x371dbc);});})['then'](function(_0x40fd3e){logger[_0xc493('0xb')](_0xc493('0x26'),_0x56106c);logger[_0xc493('0x1d')](_0xc493('0x26'),_0x56106c,JSON['stringify'](_0x40fd3e));_0x7f809a(_0x40fd3e);})[_0xc493('0x1e')](function(_0x3599a6){logger['error'](_0xc493('0x26'),_0x3599a6['message'],_0x56106c);_0x367d01(_0x126605[_0xc493('0x10')](0x1f4,_0x3599a6['message']));});});});};exports[_0xc493('0x35')]=function(_0x1b1848){var _0x45710d=this;return new Promise(function(_0x4ac5df,_0x24ce19){return db['sequelize'][_0xc493('0x29')](function(_0x1d1591){return db[_0xc493('0x36')][_0xc493('0x37')](_0x1b1848[_0xc493('0x20')],{'raw':_0x1b1848['options']?_0x1b1848[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'transaction':_0x1d1591})['then'](function(){return db[_0xc493('0x14')][_0xc493('0x24')]({'where':_0x1b1848['options']?_0x1b1848[_0xc493('0x16')][_0xc493('0x18')]||null:null,'transaction':_0x1d1591});});})['then'](function(_0x1dc94b){logger[_0xc493('0xb')](_0xc493('0x35'),_0x1b1848);logger[_0xc493('0x1d')](_0xc493('0x35'),_0x1b1848,JSON['stringify'](_0x1dc94b));_0x4ac5df(_0x1dc94b);})[_0xc493('0x1e')](function(_0x4eab4b){logger[_0xc493('0x10')]('MoveContactManagedDialer',_0x4eab4b['message'],_0x1b1848);_0x24ce19(_0x45710d[_0xc493('0x10')](0x1f4,_0x4eab4b['message']));});});};exports['CountReScheduled']=function(_0x479b7b){var _0x545746=this;return new Promise(function(_0x500e18,_0x308b31){return db[_0xc493('0x14')][_0xc493('0x15')]({'raw':_0x479b7b[_0xc493('0x16')]?_0x479b7b[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'where':_0x479b7b['options']?_0x479b7b[_0xc493('0x16')][_0xc493('0x18')]||null:null,'attributes':[[db[_0xc493('0x38')]['fn'](_0xc493('0x39'),db[_0xc493('0x38')]['fn']('IF',db[_0xc493('0x38')][_0xc493('0x3a')](_0xc493('0x3b')+util[_0xc493('0x3c')](_0xc493('0x3d'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xc493('0x3e')]]})[_0xc493('0xa')](function(_0x3df2e2){logger[_0xc493('0xb')](_0xc493('0x3f'),_0x479b7b);logger[_0xc493('0x1d')]('CountReScheduled',_0x479b7b,JSON[_0xc493('0xf')](_0x3df2e2));_0x500e18(_0x3df2e2);})[_0xc493('0x1e')](function(_0x483d9d){logger[_0xc493('0x10')](_0xc493('0x3f'),_0x483d9d['message'],_0x479b7b);_0x308b31(_0x545746[_0xc493('0x10')](0x1f4,_0x483d9d[_0xc493('0x11')]));});});};exports['GetContactRecallMe']=function(_0x3b01f3){var _0x1ca7bf=this;return new Promise(function(_0x57d66f,_0xb67e03){return db['CmContact'][_0xc493('0x28')]()['then'](function(_0x501980){return db[_0xc493('0x38')][_0xc493('0x29')](function(_0x58f21c){return db[_0xc493('0x14')][_0xc493('0x15')]({'where':_0x3b01f3[_0xc493('0x16')]?_0x3b01f3[_0xc493('0x16')]['where']||null:null,'attributes':_0x3b01f3['options']?_0x3b01f3[_0xc493('0x16')][_0xc493('0x1a')]||null:null,'limit':0x1,'order':_0x3b01f3[_0xc493('0x16')]?_0x3b01f3['options']['order']||null:null,'group':db[_0xc493('0x14')]['UserId'],'transaction':_0x58f21c,'lock':_0x58f21c['LOCK'][_0xc493('0x2c')],'include':_0x3b01f3[_0xc493('0x16')]?_0x3b01f3['options']['include']?_[_0xc493('0x1c')](_0x3b01f3[_0xc493('0x16')][_0xc493('0x1b')],function(_0x1376af){return{'model':db[_0x1376af[_0xc493('0x19')]],'as':_0x1376af['as'],'attributes':_0x1376af[_0xc493('0x1a')],'include':_0x1376af[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x1376af[_0xc493('0x1b')],function(_0x124dd5){return{'model':db[_0x124dd5['model']],'as':_0x124dd5['as'],'attributes':_0x124dd5[_0xc493('0x1a')],'include':_0x124dd5[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x124dd5[_0xc493('0x1b')],function(_0x10ab21){return{'model':db[_0x10ab21[_0xc493('0x19')]],'as':_0x10ab21['as'],'attributes':_0x10ab21[_0xc493('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xa')](function(_0x25eff1){var _0x44d0d5=[];for(var _0x104132=0x0;_0x104132<_0x25eff1['length'];_0x104132+=0x1){_0x44d0d5['push'](_0x25eff1[_0x104132][_0xc493('0x23')](_0x3b01f3[_0xc493('0x20')],{'transaction':_0x58f21c}));}return BPromise['all'](_0x44d0d5);});})[_0xc493('0xa')](function(_0x5539cb){logger['info']('GetContactRecallMe',_0x3b01f3);logger[_0xc493('0x1d')](_0xc493('0x40'),_0x3b01f3,JSON[_0xc493('0xf')](_0x5539cb));_0x57d66f(_0x5539cb);})[_0xc493('0x1e')](function(_0x38e70f){logger[_0xc493('0x10')](_0xc493('0x40'),_0x38e70f[_0xc493('0x11')],_0x3b01f3);_0xb67e03(_0x1ca7bf[_0xc493('0x10')](0x1f4,_0x38e70f[_0xc493('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x2792ca){var _0x5a721d=this;return new Promise(function(_0xe63a19,_0x469465){db[_0xc493('0x27')][_0xc493('0x28')]()[_0xc493('0xa')](function(_0x335a70){return db[_0xc493('0x14')][_0xc493('0x15')]({'raw':_0x2792ca[_0xc493('0x16')]?_0x2792ca[_0xc493('0x16')][_0xc493('0x17')]===undefined?!![]:![]:!![],'where':_0x2792ca[_0xc493('0x16')]?_0x2792ca[_0xc493('0x16')][_0xc493('0x18')]||null:null,'attributes':_0x2792ca['options']?_0x2792ca[_0xc493('0x16')]['attributes']||null:null,'limit':_0x2792ca[_0xc493('0x16')]?_0x2792ca[_0xc493('0x16')]['limit']||null:null,'include':_0x2792ca[_0xc493('0x16')]?_0x2792ca[_0xc493('0x16')]['include']?_[_0xc493('0x1c')](_0x2792ca[_0xc493('0x16')][_0xc493('0x1b')],function(_0x128a96){return{'model':db[_0x128a96['model']],'as':_0x128a96['as'],'attributes':_0x128a96['as']===_0xc493('0x2d')?_['keys'](_0x335a70):_0x128a96[_0xc493('0x1a')],'include':_0x128a96[_0xc493('0x1b')]?_['map'](_0x128a96[_0xc493('0x1b')],function(_0x6f2bc4){return{'model':db[_0x6f2bc4[_0xc493('0x19')]],'as':_0x6f2bc4['as'],'attributes':_0x6f2bc4['attributes'],'include':_0x6f2bc4[_0xc493('0x1b')]?_[_0xc493('0x1c')](_0x6f2bc4[_0xc493('0x1b')],function(_0x2f5542){return{'model':db[_0x2f5542[_0xc493('0x19')]],'as':_0x2f5542['as'],'attributes':_0x2f5542[_0xc493('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc493('0xa')](function(_0x16b406){logger[_0xc493('0xb')](_0xc493('0x13'),_0x2792ca);logger[_0xc493('0x1d')](_0xc493('0x13'),_0x2792ca,JSON[_0xc493('0xf')](_0x16b406));_0xe63a19(_0x16b406);})[_0xc493('0x1e')](function(_0xc49782){logger[_0xc493('0x10')](_0xc493('0x13'),_0xc49782[_0xc493('0x11')],_0x2792ca);_0x469465(_0x5a721d[_0xc493('0x10')](0x1f4,_0xc49782[_0xc493('0x11')]));});});});};exports['GetContactByPhone']=function(_0x5823cd){console[_0xc493('0x41')](_0xc493('0x42'),_0x5823cd);console['log'](_0xc493('0x43'),_0x5823cd['options'][_0xc493('0x18')][_0xc493('0x44')]);_this=this;return new Promise(function(_0x3ac299,_0x48fc26){return db[_0xc493('0x27')][_0xc493('0x45')]({'raw':!![],'where':{'phone':_0x5823cd[_0xc493('0x16')][_0xc493('0x18')]['phone']},'attributes':['id'],'order':[['id',_0xc493('0x46')]]})[_0xc493('0xa')](function(_0x2009ad){console[_0xc493('0x41')](_0xc493('0x47'),_0x2009ad);logger[_0xc493('0xb')](_0xc493('0x48'),_0x5823cd);logger[_0xc493('0x1d')](_0xc493('0x48'),_0x5823cd,JSON[_0xc493('0xf')](_0x2009ad));_0x3ac299(_0x2009ad);})[_0xc493('0x1e')](function(_0x41e01e){logger[_0xc493('0x10')](_0xc493('0x48'),_0x41e01e[_0xc493('0x11')],_0x5823cd);_0x48fc26(_this[_0xc493('0x10')](0x1f4,_0x41e01e['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index dece8cb..6c429fa 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 _0x31f0=['describe','/opencontacts','isAuthenticated','/timezones','getTimezones','/:id','show','create','post','/preview','getPreview','getTimezone','put','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','/describe'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x31f0,0xb7));var _0x031f=function(_0x12a31b,_0x1aec79){_0x12a31b=_0x12a31b-0x0;var _0x143629=_0x31f0[_0x12a31b];return _0x143629;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0x7')](_0x031f('0xa'),auth[_0x031f('0xb')](),controller['getOpenContacts']);router[_0x031f('0x7')](_0x031f('0xc'),auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0x7')](_0x031f('0xe'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);router['post']('/',auth[_0x031f('0xb')](),controller[_0x031f('0x10')]);router[_0x031f('0x11')](_0x031f('0x12'),auth[_0x031f('0xb')](),controller[_0x031f('0x13')]);router[_0x031f('0x11')]('/timezone',auth[_0x031f('0xb')](),controller[_0x031f('0x14')]);router[_0x031f('0x15')](_0x031f('0xe'),auth[_0x031f('0xb')](),controller['update']);router['delete'](_0x031f('0xe'),auth[_0x031f('0xb')](),controller[_0x031f('0x16')]);module[_0x031f('0x17')]=router; \ No newline at end of file +var _0x3e74=['isAuthenticated','index','describe','/opencontacts','getTimezones','post','/preview','getPreview','getTimezone','put','update','delete','/:id','multer','path','connect-timeout','express','../../components/interaction/service','./cmHopper.controller','get'];(function(_0x4cd0c9,_0x386ef4){var _0x332421=function(_0x591d3e){while(--_0x591d3e){_0x4cd0c9['push'](_0x4cd0c9['shift']());}};_0x332421(++_0x386ef4);}(_0x3e74,0x175));var _0x43e7=function(_0xd47c9b,_0x384246){_0xd47c9b=_0xd47c9b-0x0;var _0x3950bf=_0x3e74[_0xd47c9b];return _0x3950bf;};'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['getOpenContacts']);router[_0x43e7('0x6')]('/timezones',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x7')](),controller['create']);router[_0x43e7('0xc')](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller[_0x43e7('0xe')]);router['post']('/timezone',auth[_0x43e7('0x7')](),controller[_0x43e7('0xf')]);router[_0x43e7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')](_0x43e7('0x13'),auth[_0x43e7('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 52d4415..7022b9f 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ca7=['sequelize','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5b6905,_0x1341cb){var _0x210e53=function(_0x16f55a){while(--_0x16f55a){_0x5b6905['push'](_0x5b6905['shift']());}};_0x210e53(++_0x1341cb);}(_0x7ca7,0x1b1));var _0x77ca=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x7ca7[_0x20cb20];return _0x2fcf4b;};'use strict';var moment=require(_0x77ca('0x0'));var Sequelize=require(_0x77ca('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x77ca('0x2')]},'phone':{'type':Sequelize[_0x77ca('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x77ca('0x4')],'defaultValue':moment()[_0x77ca('0x5')](_0x77ca('0x6'))},'countbusyretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x77ca('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x487a=['exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0x487a,0xb4));var _0xa487=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x487a[_0x1030ce];return _0x3367fd;};'use strict';var moment=require(_0xa487('0x0'));var Sequelize=require(_0xa487('0x1'));module[_0xa487('0x2')]={'CmHopperId':{'type':Sequelize[_0xa487('0x3')]},'phone':{'type':Sequelize[_0xa487('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa487('0x5')],'defaultValue':moment()['format'](_0xa487('0x6'))},'countbusyretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa487('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index c381604..50aa52e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x941b=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','sort','where','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0xbc1eb0,_0x260c8d){var _0x1569b8=function(_0x51ce29){while(--_0x51ce29){_0xbc1eb0['push'](_0xbc1eb0['shift']());}};_0x1569b8(++_0x260c8d);}(_0x941b,0x175));var _0xb941=function(_0x3c4639,_0x89c2ff){_0x3c4639=_0x3c4639-0x0;var _0x996676=_0x941b[_0x3c4639];return _0x996676;};'use strict';var pdf=require(_0xb941('0x0'));var emlformat=require(_0xb941('0x1'));var rimraf=require(_0xb941('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb941('0x3'));var rp=require('request-promise');var moment=require(_0xb941('0x4'));var BPromise=require(_0xb941('0x5'));var Mustache=require(_0xb941('0x6'));var util=require(_0xb941('0x7'));var path=require('path');var sox=require(_0xb941('0x8'));var csv=require(_0xb941('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb941('0xa'));var squel=require(_0xb941('0xb'));var crypto=require(_0xb941('0xc'));var jsforce=require(_0xb941('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb941('0xe'));var Papa=require(_0xb941('0xf'));var Redis=require(_0xb941('0x10'));var authService=require(_0xb941('0x11'));var qs=require(_0xb941('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb941('0x13'));var logger=require(_0xb941('0x14'))(_0xb941('0x15'));var utils=require(_0xb941('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e1030,_0x3a1aea){_0x3a1aea=_0x3a1aea||0xcc;return function(_0x25e98b){if(_0x25e98b){return _0x4e1030[_0xb941('0x17')](_0x3a1aea);}return _0x4e1030['status'](_0x3a1aea)[_0xb941('0x18')]();};}function respondWithResult(_0x1c5583,_0x42deff){_0x42deff=_0x42deff||0xc8;return function(_0x2f38a1){if(_0x2f38a1){return _0x1c5583[_0xb941('0x19')](_0x42deff)[_0xb941('0x1a')](_0x2f38a1);}};}function respondWithFilteredResult(_0x150d80,_0x1ec0ac){return function(_0x163796){if(_0x163796){var _0x1c5706=_0x163796[_0xb941('0x1b')],_0x3c3c35=_0x1ec0ac[_0xb941('0x1c')],_0x1ea958=_0x1ec0ac[_0xb941('0x1c')]+_0x1ec0ac[_0xb941('0x1d')],_0x966610;if(_0x1ea958>=_0x1c5706){_0x1ea958=_0x1c5706;_0x966610=0xc8;}else{_0x966610=0xce;}_0x150d80[_0xb941('0x19')](_0x966610);return _0x150d80['set'](_0xb941('0x1e'),_0x3c3c35+'-'+_0x1ea958+'/'+_0x1c5706)[_0xb941('0x1a')](_0x163796);}return null;};}function patchUpdates(_0xf8340e){return function(_0x28294f){try{jsonpatch['apply'](_0x28294f,_0xf8340e,!![]);}catch(_0x2c9a6d){return BPromise[_0xb941('0x1f')](_0x2c9a6d);}return _0x28294f[_0xb941('0x20')]();};}function saveUpdates(_0x3870f1,_0x1c29c1){return function(_0x13ba99){if(_0x13ba99){return _0x13ba99[_0xb941('0x21')](_0x3870f1)['then'](function(_0xe0bf15){return _0xe0bf15;});}return null;};}function removeEntity(_0x40b1de,_0x4b341b){return function(_0x10363d){if(_0x10363d){return _0x10363d[_0xb941('0x22')]()[_0xb941('0x23')](function(){var _0x5db77c=_0x10363d[_0xb941('0x24')]({'plain':!![]});var _0x571273=_0xb941('0x25');return db[_0xb941('0x26')]['destroy']({'where':{'type':_0x571273,'resourceId':_0x5db77c['id']}})[_0xb941('0x23')](function(){return _0x10363d;});})[_0xb941('0x23')](function(){_0x40b1de[_0xb941('0x19')](0xcc)[_0xb941('0x18')]();});}};}function handleEntityNotFound(_0x48d861,_0x4ee536){return function(_0x30359e){if(!_0x30359e){_0x48d861[_0xb941('0x17')](0x194);}return _0x30359e;};}function handleError(_0x909665,_0x38b7fa){_0x38b7fa=_0x38b7fa||0x1f4;return function(_0x2ca5c8){logger['error'](_0x2ca5c8['stack']);if(_0x2ca5c8['name']){delete _0x2ca5c8[_0xb941('0x27')];}_0x909665[_0xb941('0x19')](_0x38b7fa)[_0xb941('0x28')](_0x2ca5c8);};}exports[_0xb941('0x29')]=function(_0x1cb012,_0x45a34a){var _0x2db6ff={},_0x462dec={},_0x4390b7={'count':0x0,'rows':[]};var _0x4d77c9=_[_0xb941('0x2a')](db[_0xb941('0x2b')][_0xb941('0x2c')],function(_0x588ed6){return{'name':_0x588ed6['fieldName'],'type':_0x588ed6[_0xb941('0x2d')][_0xb941('0x2e')]};});_0x462dec['model']=_[_0xb941('0x2a')](_0x4d77c9,_0xb941('0x27'));_0x462dec[_0xb941('0x2f')]=_[_0xb941('0x30')](_0x1cb012[_0xb941('0x2f')]);_0x462dec['filters']=_[_0xb941('0x31')](_0x462dec[_0xb941('0x32')],_0x462dec['query']);_0x2db6ff['attributes']=_[_0xb941('0x31')](_0x462dec[_0xb941('0x32')],qs[_0xb941('0x33')](_0x1cb012[_0xb941('0x2f')][_0xb941('0x33')]));_0x2db6ff[_0xb941('0x34')]=_0x2db6ff[_0xb941('0x34')][_0xb941('0x35')]?_0x2db6ff[_0xb941('0x34')]:_0x462dec[_0xb941('0x32')];if(!_0x1cb012[_0xb941('0x2f')]['hasOwnProperty'](_0xb941('0x36'))){_0x2db6ff[_0xb941('0x1d')]=qs['limit'](_0x1cb012[_0xb941('0x2f')]['limit']);_0x2db6ff['offset']=qs[_0xb941('0x1c')](_0x1cb012[_0xb941('0x2f')][_0xb941('0x1c')]);}_0x2db6ff['order']=qs[_0xb941('0x37')](_0x1cb012[_0xb941('0x2f')]['sort']);_0x2db6ff[_0xb941('0x38')]=qs['filters'](_['pick'](_0x1cb012[_0xb941('0x2f')],_0x462dec['filters']),_0x4d77c9);if(_0x1cb012[_0xb941('0x2f')][_0xb941('0x39')]){_0x2db6ff['where']=_[_0xb941('0x3a')](_0x2db6ff[_0xb941('0x38')],{'$or':_[_0xb941('0x2a')](_0x4d77c9,function(_0x2cec0d){if(_0x2cec0d['type']!=='VIRTUAL'){var _0x417e65={};_0x417e65[_0x2cec0d[_0xb941('0x27')]]={'$like':'%'+_0x1cb012[_0xb941('0x2f')][_0xb941('0x39')]+'%'};return _0x417e65;}})});}_0x2db6ff=_[_0xb941('0x3a')]({},_0x2db6ff,_0x1cb012['options']);var _0x4b8326={'where':_0x2db6ff[_0xb941('0x38')]};return db[_0xb941('0x2b')][_0xb941('0x1b')](_0x4b8326)[_0xb941('0x23')](function(_0x3fe347){_0x4390b7['count']=_0x3fe347;if(_0x1cb012['query']['includeAll']){_0x2db6ff[_0xb941('0x3b')]=[{'all':!![]}];}return db[_0xb941('0x2b')][_0xb941('0x3c')](_0x2db6ff);})[_0xb941('0x23')](function(_0x212209){_0x4390b7[_0xb941('0x3d')]=_0x212209;return _0x4390b7;})[_0xb941('0x23')](respondWithFilteredResult(_0x45a34a,_0x2db6ff))[_0xb941('0x3e')](handleError(_0x45a34a,null));};exports[_0xb941('0x3f')]=function(_0x50b7a7,_0x29d296){var _0x65f70a={'raw':!![],'where':{'id':_0x50b7a7[_0xb941('0x40')]['id']}},_0xdca4a8={};_0xdca4a8[_0xb941('0x32')]=_['keys'](db[_0xb941('0x2b')][_0xb941('0x2c')]);_0xdca4a8[_0xb941('0x2f')]=_['keys'](_0x50b7a7[_0xb941('0x2f')]);_0xdca4a8['filters']=_[_0xb941('0x31')](_0xdca4a8[_0xb941('0x32')],_0xdca4a8[_0xb941('0x2f')]);_0x65f70a[_0xb941('0x34')]=_[_0xb941('0x31')](_0xdca4a8[_0xb941('0x32')],qs[_0xb941('0x33')](_0x50b7a7[_0xb941('0x2f')]['fields']));_0x65f70a[_0xb941('0x34')]=_0x65f70a[_0xb941('0x34')][_0xb941('0x35')]?_0x65f70a[_0xb941('0x34')]:_0xdca4a8[_0xb941('0x32')];if(_0x50b7a7['query'][_0xb941('0x41')]){_0x65f70a['include']=[{'all':!![]}];}_0x65f70a=_[_0xb941('0x3a')]({},_0x65f70a,_0x50b7a7[_0xb941('0x42')]);return db[_0xb941('0x2b')][_0xb941('0x43')](_0x65f70a)[_0xb941('0x23')](handleEntityNotFound(_0x29d296,null))['then'](respondWithResult(_0x29d296,null))[_0xb941('0x3e')](handleError(_0x29d296,null));};exports[_0xb941('0x44')]=function(_0x35653e,_0x56d9f8){return db[_0xb941('0x2b')][_0xb941('0x44')](_0x35653e[_0xb941('0x45')],{})[_0xb941('0x23')](function(_0x177c91){var _0x30f052=_0x35653e[_0xb941('0x46')][_0xb941('0x24')]({'plain':!![]});if(!_0x30f052)throw new Error(_0xb941('0x47'));if(_0x30f052[_0xb941('0x48')]===_0xb941('0x46')){var _0x6dfeb9=_0x177c91[_0xb941('0x24')]({'plain':!![]});var _0x404742=_0xb941('0x25');return db['UserProfileSection'][_0xb941('0x43')]({'where':{'name':_0x404742,'userProfileId':_0x30f052[_0xb941('0x49')]},'raw':!![]})[_0xb941('0x23')](function(_0x5b92c2){if(_0x5b92c2&&_0x5b92c2[_0xb941('0x4a')]===0x0){return db['UserProfileResource'][_0xb941('0x44')]({'name':_0x6dfeb9[_0xb941('0x27')],'resourceId':_0x6dfeb9['id'],'type':_0x5b92c2[_0xb941('0x27')],'sectionId':_0x5b92c2['id']},{})[_0xb941('0x23')](function(){return _0x177c91;});}else{return _0x177c91;}})[_0xb941('0x3e')](function(_0x82d973){logger[_0xb941('0x4b')](_0xb941('0x4c'),_0x82d973);throw _0x82d973;});}return _0x177c91;})['then'](respondWithResult(_0x56d9f8,0xc9))[_0xb941('0x3e')](handleError(_0x56d9f8,null));};exports['update']=function(_0x475afb,_0x19a4ee){if(_0x475afb['body']['id']){delete _0x475afb['body']['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x475afb['params']['id']}})[_0xb941('0x23')](handleEntityNotFound(_0x19a4ee,null))[_0xb941('0x23')](saveUpdates(_0x475afb[_0xb941('0x45')],null))[_0xb941('0x23')](respondWithResult(_0x19a4ee,null))[_0xb941('0x3e')](handleError(_0x19a4ee,null));};exports[_0xb941('0x22')]=function(_0x290b33,_0x597cd9){return db[_0xb941('0x2b')][_0xb941('0x43')]({'where':{'id':_0x290b33['params']['id']}})[_0xb941('0x23')](handleEntityNotFound(_0x597cd9,null))[_0xb941('0x23')](removeEntity(_0x597cd9,null))[_0xb941('0x3e')](handleError(_0x597cd9,null));}; \ No newline at end of file +var _0xce1d=['create','body','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x59768e,_0x50b468){var _0x10e8ea=function(_0x66b965){while(--_0x66b965){_0x59768e['push'](_0x59768e['shift']());}};_0x10e8ea(++_0x50b468);}(_0xce1d,0xb0));var _0xdce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce1d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xdce1('0x0'));var emlformat=require(_0xdce1('0x1'));var rimraf=require(_0xdce1('0x2'));var zipdir=require(_0xdce1('0x3'));var jsonpatch=require(_0xdce1('0x4'));var rp=require(_0xdce1('0x5'));var moment=require(_0xdce1('0x6'));var BPromise=require(_0xdce1('0x7'));var Mustache=require(_0xdce1('0x8'));var util=require(_0xdce1('0x9'));var path=require('path');var sox=require(_0xdce1('0xa'));var csv=require(_0xdce1('0xb'));var ejs=require(_0xdce1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdce1('0xd'));var jsforce=require(_0xdce1('0xe'));var deskjs=require(_0xdce1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdce1('0x10'));var Papa=require(_0xdce1('0x11'));var Redis=require(_0xdce1('0x12'));var authService=require(_0xdce1('0x13'));var qs=require(_0xdce1('0x14'));var as=require(_0xdce1('0x15'));var hardwareService=require(_0xdce1('0x16'));var logger=require(_0xdce1('0x17'))('api');var utils=require(_0xdce1('0x18'));var config=require(_0xdce1('0x19'));var db=require(_0xdce1('0x1a'))['db'];function respondWithStatusCode(_0x47f3f6,_0x5f3c50){_0x5f3c50=_0x5f3c50||0xcc;return function(_0x221950){if(_0x221950){return _0x47f3f6[_0xdce1('0x1b')](_0x5f3c50);}return _0x47f3f6[_0xdce1('0x1c')](_0x5f3c50)[_0xdce1('0x1d')]();};}function respondWithResult(_0x4c8916,_0xb970c0){_0xb970c0=_0xb970c0||0xc8;return function(_0x174c41){if(_0x174c41){return _0x4c8916[_0xdce1('0x1c')](_0xb970c0)['json'](_0x174c41);}};}function respondWithFilteredResult(_0x291baf,_0x1f34e3){return function(_0x12bb54){if(_0x12bb54){var _0x33e679=_0x12bb54['count'],_0x556e9c=_0x1f34e3[_0xdce1('0x1e')],_0x1f379c=_0x1f34e3[_0xdce1('0x1e')]+_0x1f34e3[_0xdce1('0x1f')],_0x44813a;if(_0x1f379c>=_0x33e679){_0x1f379c=_0x33e679;_0x44813a=0xc8;}else{_0x44813a=0xce;}_0x291baf['status'](_0x44813a);return _0x291baf[_0xdce1('0x20')](_0xdce1('0x21'),_0x556e9c+'-'+_0x1f379c+'/'+_0x33e679)[_0xdce1('0x22')](_0x12bb54);}return null;};}function patchUpdates(_0x4dadeb){return function(_0x231538){try{jsonpatch[_0xdce1('0x23')](_0x231538,_0x4dadeb,!![]);}catch(_0x38b3f4){return BPromise['reject'](_0x38b3f4);}return _0x231538['save']();};}function saveUpdates(_0xab8c82,_0x4ccbec){return function(_0x3c92fd){if(_0x3c92fd){return _0x3c92fd['update'](_0xab8c82)[_0xdce1('0x24')](function(_0x44b134){return _0x44b134;});}return null;};}function removeEntity(_0x315718,_0x1d9a8f){return function(_0x596138){if(_0x596138){return _0x596138[_0xdce1('0x25')]()[_0xdce1('0x24')](function(){var _0x25c5e1=_0x596138[_0xdce1('0x26')]({'plain':!![]});var _0x5d9416=_0xdce1('0x27');return db[_0xdce1('0x28')][_0xdce1('0x25')]({'where':{'type':_0x5d9416,'resourceId':_0x25c5e1['id']}})[_0xdce1('0x24')](function(){return _0x596138;});})['then'](function(){_0x315718[_0xdce1('0x1c')](0xcc)[_0xdce1('0x1d')]();});}};}function handleEntityNotFound(_0x3f9115,_0x5e36c1){return function(_0x5b74a2){if(!_0x5b74a2){_0x3f9115[_0xdce1('0x1b')](0x194);}return _0x5b74a2;};}function handleError(_0x2705de,_0x2ade02){_0x2ade02=_0x2ade02||0x1f4;return function(_0x1e0d0a){logger['error'](_0x1e0d0a[_0xdce1('0x29')]);if(_0x1e0d0a[_0xdce1('0x2a')]){delete _0x1e0d0a[_0xdce1('0x2a')];}_0x2705de[_0xdce1('0x1c')](_0x2ade02)[_0xdce1('0x2b')](_0x1e0d0a);};}exports[_0xdce1('0x2c')]=function(_0x12245e,_0x3223df){var _0x30e30a={},_0x2d357e={},_0x502d5={'count':0x0,'rows':[]};var _0x29f790=_['map'](db[_0xdce1('0x2d')][_0xdce1('0x2e')],function(_0x1124cc){return{'name':_0x1124cc[_0xdce1('0x2f')],'type':_0x1124cc[_0xdce1('0x30')]['key']};});_0x2d357e[_0xdce1('0x31')]=_[_0xdce1('0x32')](_0x29f790,_0xdce1('0x2a'));_0x2d357e[_0xdce1('0x33')]=_[_0xdce1('0x34')](_0x12245e[_0xdce1('0x33')]);_0x2d357e[_0xdce1('0x35')]=_[_0xdce1('0x36')](_0x2d357e[_0xdce1('0x31')],_0x2d357e[_0xdce1('0x33')]);_0x30e30a['attributes']=_['intersection'](_0x2d357e[_0xdce1('0x31')],qs[_0xdce1('0x37')](_0x12245e[_0xdce1('0x33')][_0xdce1('0x37')]));_0x30e30a['attributes']=_0x30e30a[_0xdce1('0x38')][_0xdce1('0x39')]?_0x30e30a[_0xdce1('0x38')]:_0x2d357e[_0xdce1('0x31')];if(!_0x12245e[_0xdce1('0x33')][_0xdce1('0x3a')]('nolimit')){_0x30e30a['limit']=qs[_0xdce1('0x1f')](_0x12245e[_0xdce1('0x33')][_0xdce1('0x1f')]);_0x30e30a[_0xdce1('0x1e')]=qs['offset'](_0x12245e[_0xdce1('0x33')]['offset']);}_0x30e30a[_0xdce1('0x3b')]=qs['sort'](_0x12245e[_0xdce1('0x33')][_0xdce1('0x3c')]);_0x30e30a[_0xdce1('0x3d')]=qs[_0xdce1('0x35')](_[_0xdce1('0x3e')](_0x12245e[_0xdce1('0x33')],_0x2d357e[_0xdce1('0x35')]),_0x29f790);if(_0x12245e[_0xdce1('0x33')][_0xdce1('0x3f')]){_0x30e30a[_0xdce1('0x3d')]=_[_0xdce1('0x40')](_0x30e30a['where'],{'$or':_['map'](_0x29f790,function(_0x3b74cb){if(_0x3b74cb[_0xdce1('0x30')]!==_0xdce1('0x41')){var _0x4999b9={};_0x4999b9[_0x3b74cb[_0xdce1('0x2a')]]={'$like':'%'+_0x12245e[_0xdce1('0x33')]['filter']+'%'};return _0x4999b9;}})});}_0x30e30a=_[_0xdce1('0x40')]({},_0x30e30a,_0x12245e[_0xdce1('0x42')]);var _0x5b5d8f={'where':_0x30e30a[_0xdce1('0x3d')]};return db['CmHopperAdditionalPhone'][_0xdce1('0x43')](_0x5b5d8f)[_0xdce1('0x24')](function(_0x1811db){_0x502d5[_0xdce1('0x43')]=_0x1811db;if(_0x12245e[_0xdce1('0x33')][_0xdce1('0x44')]){_0x30e30a[_0xdce1('0x45')]=[{'all':!![]}];}return db[_0xdce1('0x2d')][_0xdce1('0x46')](_0x30e30a);})[_0xdce1('0x24')](function(_0x3c220a){_0x502d5[_0xdce1('0x47')]=_0x3c220a;return _0x502d5;})[_0xdce1('0x24')](respondWithFilteredResult(_0x3223df,_0x30e30a))[_0xdce1('0x48')](handleError(_0x3223df,null));};exports[_0xdce1('0x49')]=function(_0x1d775,_0x295f83){var _0x23406e={'raw':!![],'where':{'id':_0x1d775[_0xdce1('0x4a')]['id']}},_0x99c300={};_0x99c300['model']=_[_0xdce1('0x34')](db['CmHopperAdditionalPhone'][_0xdce1('0x2e')]);_0x99c300[_0xdce1('0x33')]=_[_0xdce1('0x34')](_0x1d775[_0xdce1('0x33')]);_0x99c300[_0xdce1('0x35')]=_['intersection'](_0x99c300[_0xdce1('0x31')],_0x99c300[_0xdce1('0x33')]);_0x23406e[_0xdce1('0x38')]=_[_0xdce1('0x36')](_0x99c300['model'],qs[_0xdce1('0x37')](_0x1d775[_0xdce1('0x33')]['fields']));_0x23406e[_0xdce1('0x38')]=_0x23406e[_0xdce1('0x38')]['length']?_0x23406e[_0xdce1('0x38')]:_0x99c300[_0xdce1('0x31')];if(_0x1d775[_0xdce1('0x33')][_0xdce1('0x44')]){_0x23406e[_0xdce1('0x45')]=[{'all':!![]}];}_0x23406e=_[_0xdce1('0x40')]({},_0x23406e,_0x1d775[_0xdce1('0x42')]);return db[_0xdce1('0x2d')][_0xdce1('0x4b')](_0x23406e)['then'](handleEntityNotFound(_0x295f83,null))[_0xdce1('0x24')](respondWithResult(_0x295f83,null))[_0xdce1('0x48')](handleError(_0x295f83,null));};exports[_0xdce1('0x4c')]=function(_0x2354a5,_0x168944){return db[_0xdce1('0x2d')][_0xdce1('0x4c')](_0x2354a5[_0xdce1('0x4d')],{})[_0xdce1('0x24')](function(_0x24a451){var _0x590caf=_0x2354a5[_0xdce1('0x4e')][_0xdce1('0x26')]({'plain':!![]});if(!_0x590caf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590caf['role']===_0xdce1('0x4e')){var _0x33d300=_0x24a451['get']({'plain':!![]});var _0x3c514c=_0xdce1('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x3c514c,'userProfileId':_0x590caf[_0xdce1('0x4f')]},'raw':!![]})[_0xdce1('0x24')](function(_0x1af6ed){if(_0x1af6ed&&_0x1af6ed[_0xdce1('0x50')]===0x0){return db[_0xdce1('0x28')][_0xdce1('0x4c')]({'name':_0x33d300[_0xdce1('0x2a')],'resourceId':_0x33d300['id'],'type':_0x1af6ed['name'],'sectionId':_0x1af6ed['id']},{})[_0xdce1('0x24')](function(){return _0x24a451;});}else{return _0x24a451;}})['catch'](function(_0x2722f8){logger[_0xdce1('0x51')](_0xdce1('0x52'),_0x2722f8);throw _0x2722f8;});}return _0x24a451;})[_0xdce1('0x24')](respondWithResult(_0x168944,0xc9))[_0xdce1('0x48')](handleError(_0x168944,null));};exports[_0xdce1('0x53')]=function(_0x234b9a,_0x26d83c){if(_0x234b9a[_0xdce1('0x4d')]['id']){delete _0x234b9a['body']['id'];}return db[_0xdce1('0x2d')][_0xdce1('0x4b')]({'where':{'id':_0x234b9a[_0xdce1('0x4a')]['id']}})[_0xdce1('0x24')](handleEntityNotFound(_0x26d83c,null))[_0xdce1('0x24')](saveUpdates(_0x234b9a[_0xdce1('0x4d')],null))[_0xdce1('0x24')](respondWithResult(_0x26d83c,null))[_0xdce1('0x48')](handleError(_0x26d83c,null));};exports['destroy']=function(_0xa0eb50,_0x4f385d){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0xa0eb50[_0xdce1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f385d,null))[_0xdce1('0x24')](removeEntity(_0x4f385d,null))[_0xdce1('0x48')](handleError(_0x4f385d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a0cfa45..39b43a3 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b1c=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b1c,0xd9));var _0xc6b1=function(_0x5ccc25,_0x1bac75){_0x5ccc25=_0x5ccc25-0x0;var _0x3d5901=_0x6b1c[_0x5ccc25];return _0x3d5901;};'use strict';var _=require(_0xc6b1('0x0'));var util=require(_0xc6b1('0x1'));var logger=require(_0xc6b1('0x2'))(_0xc6b1('0x3'));var moment=require(_0xc6b1('0x4'));var BPromise=require(_0xc6b1('0x5'));var rp=require(_0xc6b1('0x6'));var fs=require('fs');var path=require(_0xc6b1('0x7'));var rimraf=require(_0xc6b1('0x8'));var config=require(_0xc6b1('0x9'));var attributes=require(_0xc6b1('0xa'));module[_0xc6b1('0xb')]=function(_0x115a66,_0x27e744){return _0x115a66['define'](_0xc6b1('0xc'),attributes,{'tableName':_0xc6b1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40f1=['api','path','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x2c33e4,_0x5d7805){var _0xe096d5=function(_0x28935a){while(--_0x28935a){_0x2c33e4['push'](_0x2c33e4['shift']());}};_0xe096d5(++_0x5d7805);}(_0x40f1,0x89));var _0x140f=function(_0x4e8184,_0x106054){_0x4e8184=_0x4e8184-0x0;var _0x4ac2e8=_0x40f1[_0x4e8184];return _0x4ac2e8;};'use strict';var _=require(_0x140f('0x0'));var util=require(_0x140f('0x1'));var logger=require(_0x140f('0x2'))(_0x140f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x140f('0x4'));var rimraf=require('rimraf');var config=require(_0x140f('0x5'));var attributes=require(_0x140f('0x6'));module['exports']=function(_0x1e94c2,_0x28d0ad){return _0x1e94c2[_0x140f('0x7')](_0x140f('0x8'),attributes,{'tableName':_0x140f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 45e95d5..79a4b27 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29af=['SwapAdditionalPhones','duration','waitTime','scheduledat','minutes','add','phone','isNil','countbusyretry','countcongestionretry','createdAt','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','countagentrejectretry'];(function(_0x12c081,_0x4928a0){var _0x276263=function(_0x2386c4){while(--_0x2386c4){_0x12c081['push'](_0x12c081['shift']());}};_0x276263(++_0x4928a0);}(_0x29af,0x134));var _0xf29a=function(_0x2cf7e1,_0x25fe74){_0x2cf7e1=_0x2cf7e1-0x0;var _0x55833d=_0x29af[_0x2cf7e1];return _0x55833d;};'use strict';var _=require(_0xf29a('0x0'));var util=require(_0xf29a('0x1'));var moment=require(_0xf29a('0x2'));var BPromise=require('bluebird');var rs=require(_0xf29a('0x3'));var fs=require('fs');var Redis=require(_0xf29a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf29a('0x5'));var logger=require('../../config/logger')(_0xf29a('0x6'));var config=require(_0xf29a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf29a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c111b,_0x47749d,_0x33a308){return new BPromise(function(_0x347d76,_0x4393dc){return client['request'](_0x2c111b,_0x33a308)[_0xf29a('0x9')](function(_0x145dbb){logger[_0xf29a('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x47749d,'request\x20sent');logger[_0xf29a('0xb')](_0xf29a('0xc'),_0x47749d,_0xf29a('0xd'),JSON[_0xf29a('0xe')](_0x145dbb));if(_0x145dbb[_0xf29a('0xf')]){if(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x10')]===0x1f4){logger['error'](_0xf29a('0x11'),_0x47749d,_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);return _0x4393dc(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);}logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x145dbb['error']['message']);return _0x347d76(_0x145dbb['error'][_0xf29a('0x12')]);}else{logger[_0xf29a('0xa')](_0xf29a('0x11'),_0x47749d,_0xf29a('0xd'));_0x347d76(_0x145dbb[_0xf29a('0x13')]['message']);}})[_0xf29a('0x14')](function(_0x42567e){logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x42567e);_0x4393dc(_0x42567e);});});}exports[_0xf29a('0x15')]=function(_0xd4ca39){var _0x19e886=this;return new Promise(function(_0x296829,_0x3f9da8){return db[_0xf29a('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x18')],'ListId':_0xd4ca39['body'][_0xf29a('0x19')],'VoiceQueueId':_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x1a')]===undefined?null:_0xd4ca39['body'][_0xf29a('0x1a')],'CampaignId':_0xd4ca39['body'][_0xf29a('0x1b')]===undefined?null:_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x1b')]}})[_0xf29a('0x9')](function(_0x4d557c){if(_0x4d557c!=null){return db[_0xf29a('0x1c')][_0xf29a('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4d557c['id'],'OrderBy':{'$gt':_0x4d557c[_0xf29a('0x1e')]}},'order':[[_0xf29a('0x1e'),_0xf29a('0x1f')]]})[_0xf29a('0x9')](function(_0x2e03e7){var _0x5d5ff5=0x0;if(_0x2e03e7){if(_0x2e03e7['countbusyretry']+_0x2e03e7['countcongestionretry']+_0x2e03e7[_0xf29a('0x20')]+_0x2e03e7['countnosuchnumberretry']+_0x2e03e7[_0xf29a('0x21')]+_0x2e03e7[_0xf29a('0x22')]+_0x2e03e7[_0xf29a('0x23')]+_0x2e03e7['countagentrejectretry']<_0xd4ca39[_0xf29a('0x24')][_0xf29a('0x25')])_0x5d5ff5=0x1;_0x296829({'additional':_0x5d5ff5});}else{return db[_0xf29a('0x1c')][_0xf29a('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4d557c['id']},'order':[[_0xf29a('0x1e'),_0xf29a('0x1f')]]})['then'](function(_0x4216af){var _0x43b4ab=0x0;if(_0x4216af){if(_0x4216af['countbusyretry']+_0x4216af['countcongestionretry']+_0x4216af['countnoanswerretry']+_0x4216af[_0xf29a('0x26')]+_0x4216af[_0xf29a('0x21')]+_0x4216af[_0xf29a('0x22')]+_0x4216af[_0xf29a('0x23')]+_0x4216af[_0xf29a('0x27')]<_0xd4ca39[_0xf29a('0x24')][_0xf29a('0x25')])_0x43b4ab=0x1;_0x296829({'additional':_0x43b4ab});}else{_0x296829({'additional':0x0});}})['catch'](function(_0x2b10d1){logger[_0xf29a('0xf')](_0xf29a('0x15'),_0x2b10d1[_0xf29a('0x12')],_0xd4ca39);_0x3f9da8(_0x19e886[_0xf29a('0xf')](0x1f4,_0x2b10d1[_0xf29a('0x12')]));});}})[_0xf29a('0x14')](function(_0x4feeae){logger[_0xf29a('0xf')]('VerifyAdditionalPhones',_0x4feeae[_0xf29a('0x12')],_0xd4ca39);_0x3f9da8(_0x19e886[_0xf29a('0xf')](0x1f4,_0x4feeae[_0xf29a('0x12')]));});}else _0x296829({'additional':0x0});});});};exports[_0xf29a('0x28')]=function(_0x1ada85){var _0x4e081c=this;return new Promise(function(_0x12110d,_0x56dc44){return db[_0xf29a('0x16')][_0xf29a('0x1d')]({'raw':!![],'where':{'ContactId':_0x1ada85['body'][_0xf29a('0x18')],'ListId':_0x1ada85[_0xf29a('0x17')]['ListId'],'VoiceQueueId':_0x1ada85[_0xf29a('0x17')][_0xf29a('0x1a')]===undefined?null:_0x1ada85[_0xf29a('0x17')][_0xf29a('0x1a')],'CampaignId':_0x1ada85[_0xf29a('0x17')][_0xf29a('0x1b')]===undefined?null:_0x1ada85['body'][_0xf29a('0x1b')]}})[_0xf29a('0x9')](function(_0x10616d){if(_0x10616d!=null){return db['CmHopperAdditionalPhone'][_0xf29a('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x10616d['id'],'OrderBy':{'$gt':_0x10616d[_0xf29a('0x1e')]}},'order':[[_0xf29a('0x1e'),_0xf29a('0x1f')]]})[_0xf29a('0x9')](function(_0x3ef3c){if(_0x3ef3c)return activateAdditionalPhone(_0x10616d,_0x1ada85[_0xf29a('0x17')],_0x3ef3c,_0x1ada85[_0xf29a('0x29')],_0x1ada85[_0xf29a('0x2a')])[_0xf29a('0x9')](function(_0x243291){_0x12110d(_0x243291);});else{return db[_0xf29a('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x10616d['id']},'order':[['OrderBy',_0xf29a('0x1f')]]})[_0xf29a('0x9')](function(_0x27243d){if(_0x27243d)return activateAdditionalPhone(_0x10616d,_0x1ada85['body'],_0x27243d,_0x1ada85[_0xf29a('0x29')],_0x1ada85[_0xf29a('0x2a')])[_0xf29a('0x9')](function(_0x2801ca){_0x12110d(_0x2801ca);});else{_0x12110d({'id':_0x10616d['id'],'phone':''});}})[_0xf29a('0x14')](function(_0x44fb4c){logger[_0xf29a('0xf')](_0xf29a('0x15'),_0x44fb4c[_0xf29a('0x12')],_0x1ada85);_0x56dc44(_0x4e081c[_0xf29a('0xf')](0x1f4,_0x44fb4c[_0xf29a('0x12')]));});}})['catch'](function(_0x358c07){logger['error'](_0xf29a('0x15'),_0x358c07[_0xf29a('0x12')],_0x1ada85);_0x56dc44(_0x4e081c['error'](0x1f4,_0x358c07[_0xf29a('0x12')]));});}else _0x12110d(0x1);});});};function activateAdditionalPhone(_0x5cf180,_0x36f0f3,_0x15ce1e,_0x38c060,_0xe8375d){return new Promise(function(_0x41aa32,_0x548345){logger[_0xf29a('0xa')](_0xf29a('0x15'),_0x15ce1e);var _0x382f5b;if(moment()>moment(_0x15ce1e[_0xf29a('0x2b')])){_0x382f5b=moment()['add'](_0xe8375d||0x3,_0xf29a('0x2c'));}else{if(_0x15ce1e[_0xf29a('0x1e')]==0x0){_0x382f5b=moment(_0x15ce1e[_0xf29a('0x2b')]);}else{_0x382f5b=moment()[_0xf29a('0x2d')](_0xe8375d||0x3,_0xf29a('0x2c'));}}var _0x360779={'phone':_0x5cf180[_0xf29a('0x2e')],'active':0x0,'OrderBy':_[_0xf29a('0x2f')](_0x5cf180[_0xf29a('0x1e')])?0x0:_0x5cf180[_0xf29a('0x1e')],'scheduledat':moment()[_0xf29a('0x2d')](_0x38c060||0x1,_0xf29a('0x2c')),'countbusyretry':_0x36f0f3[_0xf29a('0x30')],'countcongestionretry':_0x36f0f3[_0xf29a('0x31')],'countnoanswerretry':_0x36f0f3[_0xf29a('0x20')],'countnosuchnumberretry':_0x36f0f3[_0xf29a('0x26')],'countdropretry':_0x36f0f3[_0xf29a('0x21')],'countabandonedretry':_0x36f0f3[_0xf29a('0x22')],'countmachineretry':_0x36f0f3[_0xf29a('0x23')],'countagentrejectretry':_0x36f0f3[_0xf29a('0x27')],'createdAt':_0x36f0f3['createdAt'],'updatedAt':_0x36f0f3['updatedAt']};var _0x90bd27={'CmHopperId':_0x5cf180['id'],'phone':_0x15ce1e[_0xf29a('0x2e')],'active':0x0,'OrderBy':_[_0xf29a('0x2f')](_0x15ce1e[_0xf29a('0x1e')])?0x0:_0x15ce1e[_0xf29a('0x1e')],'scheduledat':_0x382f5b,'countbusyretry':_0x15ce1e[_0xf29a('0x30')],'countcongestionretry':_0x15ce1e[_0xf29a('0x31')],'countnoanswerretry':_0x15ce1e[_0xf29a('0x20')],'countnosuchnumberretry':_0x36f0f3[_0xf29a('0x26')],'countdropretry':_0x36f0f3[_0xf29a('0x21')],'countabandonedretry':_0x36f0f3[_0xf29a('0x22')],'countmachineretry':_0x36f0f3[_0xf29a('0x23')],'countagentrejectretry':_0x36f0f3[_0xf29a('0x27')],'createdAt':_0x15ce1e[_0xf29a('0x32')],'updatedAt':_0x15ce1e[_0xf29a('0x33')]};logger[_0xf29a('0xa')](_0xf29a('0x34'),_0x360779);logger[_0xf29a('0xa')](_0xf29a('0x35'),_0x90bd27);return db[_0xf29a('0x36')][_0xf29a('0x37')](function(_0x2e3d62){return db['CmHopperAdditionalPhone'][_0xf29a('0x38')](_0x360779,{'where':{'id':_0x15ce1e['id']}},{'transaction':_0x2e3d62})[_0xf29a('0x9')](function(){return db[_0xf29a('0x16')][_0xf29a('0x38')](_0x90bd27,{'where':{'id':_0x5cf180['id']}},{'transaction':_0x2e3d62});});})[_0xf29a('0x9')](function(_0x56e16c){_0x41aa32({'id':_0x5cf180['id'],'phone':_0x15ce1e[_0xf29a('0x2e')]});})[_0xf29a('0x14')](function(_0x3fb4b4){logger['error']('VerifyAdditionalPhones',_0x3fb4b4['message'],req);_0x548345(_this[_0xf29a('0xf')](0x1f4,_0x3fb4b4[_0xf29a('0x12')]));});});}exports['IncrementPreviewCounters']=function(_0x5f0f1c){var _0x1a52fd=this;return new Promise(function(_0x14e2ab,_0x53c89c){return db[_0xf29a('0x16')][_0xf29a('0x38')](_0x5f0f1c['body']['field'],{'where':{'id':_0x5f0f1c['body']['id']}})[_0xf29a('0x9')](function(_0x277ac7){_0x14e2ab(_0x277ac7);})[_0xf29a('0x14')](function(_0x432935){logger[_0xf29a('0xf')](_0xf29a('0x39'),_0x432935['message'],_0x5f0f1c);_0x53c89c(_0x1a52fd[_0xf29a('0xf')](0x1f4,_0x432935[_0xf29a('0x12')]));});});}; \ No newline at end of file +var _0xf929=['SwapAdditionalPhones','CmHopper','VoiceQueueId','waitTime','duration','scheduledat','add','minutes','phone','countagentrejectretry','createdAt','updatedAt','additionalToHop','transaction','update','field','IncrementPreviewCounters','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','catch','VerifyAdditionalPhones','body','ContactId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','entity','countabandonedretry','dialGlobalMaxRetry'];(function(_0x5e5616,_0x41e6f4){var _0xe4aeb9=function(_0x854887){while(--_0x854887){_0x5e5616['push'](_0x5e5616['shift']());}};_0xe4aeb9(++_0x41e6f4);}(_0xf929,0x11a));var _0x9f92=function(_0x5d106f,_0x3036ce){_0x5d106f=_0x5d106f-0x0;var _0x20dfa7=_0xf929[_0x5d106f];return _0x20dfa7;};'use strict';var _=require('lodash');var util=require(_0x9f92('0x0'));var moment=require(_0x9f92('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f92('0x2'));var db=require(_0x9f92('0x3'))['db'];var utils=require(_0x9f92('0x4'));var logger=require(_0x9f92('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f92('0x6'));var client=jayson[_0x9f92('0x7')][_0x9f92('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69a5d2,_0x108437,_0x54dfeb){return new BPromise(function(_0x17b7f9,_0x378107){return client['request'](_0x69a5d2,_0x54dfeb)[_0x9f92('0x9')](function(_0x33c197){logger[_0x9f92('0xa')](_0x9f92('0xb'),_0x108437,_0x9f92('0xc'));logger[_0x9f92('0xd')](_0x9f92('0xe'),_0x108437,_0x9f92('0xc'),JSON['stringify'](_0x33c197));if(_0x33c197[_0x9f92('0xf')]){if(_0x33c197[_0x9f92('0xf')][_0x9f92('0x10')]===0x1f4){logger[_0x9f92('0xf')](_0x9f92('0xb'),_0x108437,_0x33c197[_0x9f92('0xf')]['message']);return _0x378107(_0x33c197[_0x9f92('0xf')][_0x9f92('0x11')]);}logger[_0x9f92('0xf')](_0x9f92('0xb'),_0x108437,_0x33c197['error'][_0x9f92('0x11')]);return _0x17b7f9(_0x33c197['error'][_0x9f92('0x11')]);}else{logger[_0x9f92('0xa')](_0x9f92('0xb'),_0x108437,_0x9f92('0xc'));_0x17b7f9(_0x33c197['result'][_0x9f92('0x11')]);}})[_0x9f92('0x12')](function(_0x3f9803){logger['error'](_0x9f92('0xb'),_0x108437,_0x3f9803);_0x378107(_0x3f9803);});});}exports[_0x9f92('0x13')]=function(_0x31746c){var _0x58be0d=this;return new Promise(function(_0x58dcbd,_0xe08620){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x31746c[_0x9f92('0x14')][_0x9f92('0x15')],'ListId':_0x31746c[_0x9f92('0x14')]['ListId'],'VoiceQueueId':_0x31746c[_0x9f92('0x14')]['VoiceQueueId']===undefined?null:_0x31746c[_0x9f92('0x14')]['VoiceQueueId'],'CampaignId':_0x31746c['body'][_0x9f92('0x16')]===undefined?null:_0x31746c[_0x9f92('0x14')]['CampaignId']}})[_0x9f92('0x9')](function(_0x368a51){if(_0x368a51!=null){return db[_0x9f92('0x17')][_0x9f92('0x18')]({'raw':!![],'where':{'CmHopperId':_0x368a51['id'],'OrderBy':{'$gt':_0x368a51[_0x9f92('0x19')]}},'order':[['OrderBy',_0x9f92('0x1a')]]})[_0x9f92('0x9')](function(_0x2fdb98){var _0x148315=0x0;if(_0x2fdb98){if(_0x2fdb98[_0x9f92('0x1b')]+_0x2fdb98[_0x9f92('0x1c')]+_0x2fdb98[_0x9f92('0x1d')]+_0x2fdb98[_0x9f92('0x1e')]+_0x2fdb98[_0x9f92('0x1f')]+_0x2fdb98['countabandonedretry']+_0x2fdb98[_0x9f92('0x20')]+_0x2fdb98['countagentrejectretry']<_0x31746c[_0x9f92('0x21')]['dialGlobalMaxRetry'])_0x148315=0x1;_0x58dcbd({'additional':_0x148315});}else{return db[_0x9f92('0x17')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x368a51['id']},'order':[[_0x9f92('0x19'),_0x9f92('0x1a')]]})[_0x9f92('0x9')](function(_0x159c4f){var _0x4e731b=0x0;if(_0x159c4f){if(_0x159c4f['countbusyretry']+_0x159c4f[_0x9f92('0x1c')]+_0x159c4f['countnoanswerretry']+_0x159c4f[_0x9f92('0x1e')]+_0x159c4f[_0x9f92('0x1f')]+_0x159c4f[_0x9f92('0x22')]+_0x159c4f[_0x9f92('0x20')]+_0x159c4f['countagentrejectretry']<_0x31746c[_0x9f92('0x21')][_0x9f92('0x23')])_0x4e731b=0x1;_0x58dcbd({'additional':_0x4e731b});}else{_0x58dcbd({'additional':0x0});}})[_0x9f92('0x12')](function(_0x5ded38){logger[_0x9f92('0xf')]('VerifyAdditionalPhones',_0x5ded38[_0x9f92('0x11')],_0x31746c);_0xe08620(_0x58be0d['error'](0x1f4,_0x5ded38[_0x9f92('0x11')]));});}})['catch'](function(_0x32fd15){logger[_0x9f92('0xf')]('VerifyAdditionalPhones',_0x32fd15[_0x9f92('0x11')],_0x31746c);_0xe08620(_0x58be0d[_0x9f92('0xf')](0x1f4,_0x32fd15[_0x9f92('0x11')]));});}else _0x58dcbd({'additional':0x0});});});};exports[_0x9f92('0x24')]=function(_0x15b5b0){var _0x2fde50=this;return new Promise(function(_0x39ca6a,_0x4e39a7){return db[_0x9f92('0x25')][_0x9f92('0x18')]({'raw':!![],'where':{'ContactId':_0x15b5b0[_0x9f92('0x14')][_0x9f92('0x15')],'ListId':_0x15b5b0['body']['ListId'],'VoiceQueueId':_0x15b5b0['body'][_0x9f92('0x26')]===undefined?null:_0x15b5b0[_0x9f92('0x14')][_0x9f92('0x26')],'CampaignId':_0x15b5b0[_0x9f92('0x14')][_0x9f92('0x16')]===undefined?null:_0x15b5b0[_0x9f92('0x14')][_0x9f92('0x16')]}})['then'](function(_0x58c7a6){if(_0x58c7a6!=null){return db[_0x9f92('0x17')][_0x9f92('0x18')]({'raw':!![],'where':{'CmHopperId':_0x58c7a6['id'],'OrderBy':{'$gt':_0x58c7a6[_0x9f92('0x19')]}},'order':[[_0x9f92('0x19'),_0x9f92('0x1a')]]})['then'](function(_0x10a8d7){if(_0x10a8d7)return activateAdditionalPhone(_0x58c7a6,_0x15b5b0['body'],_0x10a8d7,_0x15b5b0['duration'],_0x15b5b0[_0x9f92('0x27')])[_0x9f92('0x9')](function(_0x30c10f){_0x39ca6a(_0x30c10f);});else{return db[_0x9f92('0x17')][_0x9f92('0x18')]({'raw':!![],'where':{'CmHopperId':_0x58c7a6['id']},'order':[[_0x9f92('0x19'),_0x9f92('0x1a')]]})[_0x9f92('0x9')](function(_0x53b4e9){if(_0x53b4e9)return activateAdditionalPhone(_0x58c7a6,_0x15b5b0['body'],_0x53b4e9,_0x15b5b0[_0x9f92('0x28')],_0x15b5b0['waitTime'])[_0x9f92('0x9')](function(_0x9f9f9f){_0x39ca6a(_0x9f9f9f);});else{_0x39ca6a({'id':_0x58c7a6['id'],'phone':''});}})[_0x9f92('0x12')](function(_0x5f45bc){logger[_0x9f92('0xf')]('VerifyAdditionalPhones',_0x5f45bc[_0x9f92('0x11')],_0x15b5b0);_0x4e39a7(_0x2fde50[_0x9f92('0xf')](0x1f4,_0x5f45bc[_0x9f92('0x11')]));});}})['catch'](function(_0x30147a){logger['error'](_0x9f92('0x13'),_0x30147a[_0x9f92('0x11')],_0x15b5b0);_0x4e39a7(_0x2fde50[_0x9f92('0xf')](0x1f4,_0x30147a[_0x9f92('0x11')]));});}else _0x39ca6a(0x1);});});};function activateAdditionalPhone(_0x13b56a,_0x525caa,_0x370702,_0x530098,_0x3e8f00){return new Promise(function(_0x4fae98,_0x2f86a9){logger[_0x9f92('0xa')](_0x9f92('0x13'),_0x370702);var _0xe1988b;if(moment()>moment(_0x370702[_0x9f92('0x29')])){_0xe1988b=moment()[_0x9f92('0x2a')](_0x3e8f00||0x3,_0x9f92('0x2b'));}else{if(_0x370702[_0x9f92('0x19')]==0x0){_0xe1988b=moment(_0x370702[_0x9f92('0x29')]);}else{_0xe1988b=moment()['add'](_0x3e8f00||0x3,_0x9f92('0x2b'));}}var _0x214486={'phone':_0x13b56a[_0x9f92('0x2c')],'active':0x0,'OrderBy':_['isNil'](_0x13b56a[_0x9f92('0x19')])?0x0:_0x13b56a[_0x9f92('0x19')],'scheduledat':moment()[_0x9f92('0x2a')](_0x530098||0x1,_0x9f92('0x2b')),'countbusyretry':_0x525caa[_0x9f92('0x1b')],'countcongestionretry':_0x525caa['countcongestionretry'],'countnoanswerretry':_0x525caa[_0x9f92('0x1d')],'countnosuchnumberretry':_0x525caa[_0x9f92('0x1e')],'countdropretry':_0x525caa['countdropretry'],'countabandonedretry':_0x525caa['countabandonedretry'],'countmachineretry':_0x525caa['countmachineretry'],'countagentrejectretry':_0x525caa[_0x9f92('0x2d')],'createdAt':_0x525caa[_0x9f92('0x2e')],'updatedAt':_0x525caa[_0x9f92('0x2f')]};var _0x5ed171={'CmHopperId':_0x13b56a['id'],'phone':_0x370702['phone'],'active':0x0,'OrderBy':_['isNil'](_0x370702[_0x9f92('0x19')])?0x0:_0x370702[_0x9f92('0x19')],'scheduledat':_0xe1988b,'countbusyretry':_0x370702[_0x9f92('0x1b')],'countcongestionretry':_0x370702['countcongestionretry'],'countnoanswerretry':_0x370702['countnoanswerretry'],'countnosuchnumberretry':_0x525caa[_0x9f92('0x1e')],'countdropretry':_0x525caa[_0x9f92('0x1f')],'countabandonedretry':_0x525caa['countabandonedretry'],'countmachineretry':_0x525caa[_0x9f92('0x20')],'countagentrejectretry':_0x525caa['countagentrejectretry'],'createdAt':_0x370702[_0x9f92('0x2e')],'updatedAt':_0x370702[_0x9f92('0x2f')]};logger['info']('hopperToAdd',_0x214486);logger[_0x9f92('0xa')](_0x9f92('0x30'),_0x5ed171);return db['sequelize'][_0x9f92('0x31')](function(_0x4bfab1){return db['CmHopperAdditionalPhone'][_0x9f92('0x32')](_0x214486,{'where':{'id':_0x370702['id']}},{'transaction':_0x4bfab1})[_0x9f92('0x9')](function(){return db[_0x9f92('0x25')]['update'](_0x5ed171,{'where':{'id':_0x13b56a['id']}},{'transaction':_0x4bfab1});});})[_0x9f92('0x9')](function(_0x4bb600){_0x4fae98({'id':_0x13b56a['id'],'phone':_0x370702['phone']});})[_0x9f92('0x12')](function(_0x240ef9){logger[_0x9f92('0xf')](_0x9f92('0x13'),_0x240ef9['message'],req);_0x2f86a9(_this[_0x9f92('0xf')](0x1f4,_0x240ef9['message']));});});}exports['IncrementPreviewCounters']=function(_0x3228f7){var _0x49a9fd=this;return new Promise(function(_0x6b3652,_0x55ad71){return db[_0x9f92('0x25')]['update'](_0x3228f7['body'][_0x9f92('0x33')],{'where':{'id':_0x3228f7['body']['id']}})[_0x9f92('0x9')](function(_0x28d0fa){_0x6b3652(_0x28d0fa);})[_0x9f92('0x12')](function(_0x34566d){logger['error'](_0x9f92('0x34'),_0x34566d[_0x9f92('0x11')],_0x3228f7);_0x55ad71(_0x49a9fd[_0x9f92('0xf')](0x1f4,_0x34566d[_0x9f92('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 926a5a6..c098662 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56fe=['./cmHopperAdditionalPhone.controller','get','index','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x323ff6,_0x275552){var _0x57d776=function(_0x1dbaca){while(--_0x1dbaca){_0x323ff6['push'](_0x323ff6['shift']());}};_0x57d776(++_0x275552);}(_0x56fe,0xe4));var _0xe56f=function(_0x5f33ba,_0x3286ca){_0x5f33ba=_0x5f33ba-0x0;var _0x319e2d=_0x56fe[_0x5f33ba];return _0x319e2d;};'use strict';var multer=require(_0xe56f('0x0'));var util=require(_0xe56f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe56f('0x2'));var router=express[_0xe56f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe56f('0x4'));var config=require(_0xe56f('0x5'));var controller=require(_0xe56f('0x6'));router[_0xe56f('0x7')]('/',auth['isAuthenticated'](),controller[_0xe56f('0x8')]);router[_0xe56f('0x7')](_0xe56f('0x9'),auth['isAuthenticated'](),controller[_0xe56f('0xa')]);router[_0xe56f('0xb')]('/',auth[_0xe56f('0xc')](),controller[_0xe56f('0xd')]);router['put'](_0xe56f('0x9'),auth[_0xe56f('0xc')](),controller[_0xe56f('0xe')]);router[_0xe56f('0xf')]('/:id',auth[_0xe56f('0xc')](),controller[_0xe56f('0x10')]);module[_0xe56f('0x11')]=router; \ No newline at end of file +var _0x266a=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x1108b2,_0x12737a){var _0x3d9ac6=function(_0xc1deb2){while(--_0xc1deb2){_0x1108b2['push'](_0x1108b2['shift']());}};_0x3d9ac6(++_0x12737a);}(_0x266a,0x75));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa266('0x0'));var util=require(_0xa266('0x1'));var path=require('path');var timeout=require(_0xa266('0x2'));var express=require(_0xa266('0x3'));var router=express[_0xa266('0x4')]();var auth=require(_0xa266('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa266('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xa266('0x7')]('/',auth[_0xa266('0x8')](),controller[_0xa266('0x9')]);router['get']('/:id',auth[_0xa266('0x8')](),controller[_0xa266('0xa')]);router[_0xa266('0xb')]('/',auth['isAuthenticated'](),controller[_0xa266('0xc')]);router[_0xa266('0xd')](_0xa266('0xe'),auth['isAuthenticated'](),controller[_0xa266('0xf')]);router[_0xa266('0x10')]('/:id',auth[_0xa266('0x8')](),controller[_0xa266('0x11')]);module[_0xa266('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 65a442c..c3731d2 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 _0x61b7=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x4b6563,_0x3f3519){var _0x19222f=function(_0x30af7e){while(--_0x30af7e){_0x4b6563['push'](_0x4b6563['shift']());}};_0x19222f(++_0x3f3519);}(_0x61b7,0x9a));var _0x761b=function(_0x32677b,_0x132286){_0x32677b=_0x32677b-0x0;var _0x211f26=_0x61b7[_0x32677b];return _0x211f26;};'use strict';var moment=require(_0x761b('0x0'));var Sequelize=require('sequelize');module[_0x761b('0x1')]={'phone':{'type':Sequelize[_0x761b('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x761b('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x761b('0x4')},'VoiceQueueId':{'type':Sequelize[_0x761b('0x3')],'unique':_0x761b('0x4')}}; \ No newline at end of file +var _0xbd59=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xbd59,0x10b));var _0x9bd5=function(_0x44a924,_0x1d5cf6){_0x44a924=_0x44a924-0x0;var _0x19dc4c=_0xbd59[_0x44a924];return _0x19dc4c;};'use strict';var moment=require('moment');var Sequelize=require(_0x9bd5('0x0'));module[_0x9bd5('0x1')]={'phone':{'type':Sequelize[_0x9bd5('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9bd5('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x9bd5('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x9bd5('0x3')],'unique':_0x9bd5('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9a4add3..db486b0 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x13349f,_0xd7dafc){var _0x298242=function(_0x4df4ca){while(--_0x4df4ca){_0x13349f['push'](_0x13349f['shift']());}};_0x298242(++_0xd7dafc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5a00ae,_0x307d2d){var _0x460727=function(_0x471109){while(--_0x471109){_0x5a00ae['push'](_0x5a00ae['shift']());}};_0x460727(++_0x307d2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 90c6561..1ee3be7 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','util'];(function(_0x459b7d,_0x2026a3){var _0x1a5c28=function(_0xf76242){while(--_0xf76242){_0x459b7d['push'](_0x459b7d['shift']());}};_0x1a5c28(++_0x2026a3);}(_0xedd9,0xfc));var _0x9edd=function(_0x56db5b,_0x35549a){_0x56db5b=_0x56db5b-0x0;var _0x4430e5=_0xedd9[_0x56db5b];return _0x4430e5;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','util'];(function(_0x1e73fb,_0xff79eb){var _0x1e8ca7=function(_0x2a59a9){while(--_0x2a59a9){_0x1e73fb['push'](_0x1e73fb['shift']());}};_0x1e8ca7(++_0xff79eb);}(_0xedd9,0xfc));var _0x9edd=function(_0x501651,_0x41a93c){_0x501651=_0x501651-0x0;var _0x3012a0=_0xedd9[_0x501651];return _0x3012a0;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'cm_hopper_black','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 8799389..fd3bd9c 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 _0x3395=['result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','UpdateCmHopperBlack','update','where','then','info','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x273f6b,_0x5c49df){var _0x16a4da=function(_0xd31fa2){while(--_0xd31fa2){_0x273f6b['push'](_0x273f6b['shift']());}};_0x16a4da(++_0x5c49df);}(_0x3395,0x8b));var _0x5339=function(_0x474cfa,_0x497bc8){_0x474cfa=_0x474cfa-0x0;var _0x50894a=_0x3395[_0x474cfa];return _0x50894a;};'use strict';var _=require(_0x5339('0x0'));var util=require(_0x5339('0x1'));var moment=require(_0x5339('0x2'));var BPromise=require(_0x5339('0x3'));var rs=require(_0x5339('0x4'));var fs=require('fs');var Redis=require(_0x5339('0x5'));var db=require(_0x5339('0x6'))['db'];var utils=require(_0x5339('0x7'));var logger=require('../../config/logger')(_0x5339('0x8'));var config=require(_0x5339('0x9'));var jayson=require(_0x5339('0xa'));var client=jayson[_0x5339('0xb')][_0x5339('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54a444,_0x10dbb8,_0x5f13ca){return new BPromise(function(_0x51e50c,_0x1718f6){return client[_0x5339('0xd')](_0x54a444,_0x5f13ca)['then'](function(_0x2dd1bf){logger['info'](_0x5339('0xe'),_0x10dbb8,_0x5339('0xf'));logger[_0x5339('0x10')](_0x5339('0x11'),_0x10dbb8,_0x5339('0xf'),JSON[_0x5339('0x12')](_0x2dd1bf));if(_0x2dd1bf['error']){if(_0x2dd1bf[_0x5339('0x13')]['code']===0x1f4){logger[_0x5339('0x13')](_0x5339('0xe'),_0x10dbb8,_0x2dd1bf['error'][_0x5339('0x14')]);return _0x1718f6(_0x2dd1bf[_0x5339('0x13')][_0x5339('0x14')]);}logger[_0x5339('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x10dbb8,_0x2dd1bf[_0x5339('0x13')][_0x5339('0x14')]);return _0x51e50c(_0x2dd1bf[_0x5339('0x13')][_0x5339('0x14')]);}else{logger['info'](_0x5339('0xe'),_0x10dbb8,'request\x20sent');_0x51e50c(_0x2dd1bf[_0x5339('0x15')][_0x5339('0x14')]);}})[_0x5339('0x16')](function(_0x425181){logger[_0x5339('0x13')](_0x5339('0xe'),_0x10dbb8,_0x425181);_0x1718f6(_0x425181);});});}exports[_0x5339('0x17')]=function(_0x40b554){var _0x5ad27f=this;return new Promise(function(_0x5b67eb,_0x584f7a){return db[_0x5339('0x18')][_0x5339('0x19')]({'raw':_0x40b554['options']?_0x40b554[_0x5339('0x1a')][_0x5339('0x1b')]===undefined?!![]:![]:!![],'where':_0x40b554[_0x5339('0x1a')]?_0x40b554[_0x5339('0x1a')]['where']||null:null,'attributes':_0x40b554[_0x5339('0x1a')]?_0x40b554[_0x5339('0x1a')][_0x5339('0x1c')]||null:null,'limit':_0x40b554[_0x5339('0x1a')]?_0x40b554['options'][_0x5339('0x1d')]||null:null,'include':_0x40b554[_0x5339('0x1a')]?_0x40b554['options'][_0x5339('0x1e')]?_[_0x5339('0x1f')](_0x40b554[_0x5339('0x1a')][_0x5339('0x1e')],function(_0x189ddb){return{'model':db[_0x189ddb['model']],'as':_0x189ddb['as'],'attributes':_0x189ddb['attributes'],'include':_0x189ddb[_0x5339('0x1e')]?_[_0x5339('0x1f')](_0x189ddb['include'],function(_0x2795d8){return{'model':db[_0x2795d8[_0x5339('0x20')]],'as':_0x2795d8['as'],'attributes':_0x2795d8[_0x5339('0x1c')],'include':_0x2795d8[_0x5339('0x1e')]?_['map'](_0x2795d8['include'],function(_0x17a13d){return{'model':db[_0x17a13d[_0x5339('0x20')]],'as':_0x17a13d['as'],'attributes':_0x17a13d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b5f2e){logger['info'](_0x5339('0x17'),_0x40b554);logger[_0x5339('0x10')](_0x5339('0x17'),_0x40b554,JSON['stringify'](_0x4b5f2e));_0x5b67eb(_0x4b5f2e);})[_0x5339('0x16')](function(_0xe0fe16){logger[_0x5339('0x13')](_0x5339('0x17'),_0xe0fe16[_0x5339('0x14')],_0x40b554);_0x584f7a(_0x5ad27f[_0x5339('0x13')](0x1f4,_0xe0fe16[_0x5339('0x14')]));});});};exports[_0x5339('0x21')]=function(_0x4f91d5){var _0x5d1602=this;return new Promise(function(_0x2f4386,_0x5c36bf){return db['CmHopperBlack'][_0x5339('0x22')](_0x4f91d5['body'],{'raw':_0x4f91d5[_0x5339('0x1a')]?_0x4f91d5[_0x5339('0x1a')][_0x5339('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f91d5[_0x5339('0x1a')]?_0x4f91d5[_0x5339('0x1a')][_0x5339('0x23')]||null:null,'attributes':_0x4f91d5[_0x5339('0x1a')]?_0x4f91d5[_0x5339('0x1a')][_0x5339('0x1c')]||null:null,'limit':_0x4f91d5[_0x5339('0x1a')]?_0x4f91d5[_0x5339('0x1a')][_0x5339('0x1d')]||null:null})[_0x5339('0x24')](function(_0x536494){logger[_0x5339('0x25')](_0x5339('0x21'),_0x4f91d5);logger[_0x5339('0x10')](_0x5339('0x21'),_0x4f91d5,JSON[_0x5339('0x12')](_0x536494));_0x2f4386(_0x536494);})[_0x5339('0x16')](function(_0x280619){logger['error'](_0x5339('0x21'),_0x280619[_0x5339('0x14')],_0x4f91d5);_0x5c36bf(_0x5d1602[_0x5339('0x13')](0x1f4,_0x280619[_0x5339('0x14')]));});});};exports[_0x5339('0x26')]=function(_0x1b8f5d){var _0x33fadc=this;return new Promise(function(_0x551b06,_0xf68c1d){return db['CmHopperBlack'][_0x5339('0x27')]({'where':_0x1b8f5d[_0x5339('0x1a')]?_0x1b8f5d[_0x5339('0x1a')][_0x5339('0x23')]||null:null})[_0x5339('0x24')](function(_0x234543){logger[_0x5339('0x25')](_0x5339('0x26'),_0x1b8f5d);logger['debug'](_0x5339('0x26'),_0x1b8f5d,JSON[_0x5339('0x12')](_0x234543));_0x551b06(_0x234543);})[_0x5339('0x16')](function(_0x3138ee){logger[_0x5339('0x13')](_0x5339('0x26'),_0x3138ee['message'],_0x1b8f5d);_0xf68c1d(_0x33fadc[_0x5339('0x13')](0x1f4,_0x3138ee[_0x5339('0x14')]));});});}; \ No newline at end of file +var _0xd619=['rpc','../../config/environment','http','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','model','map','info','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x406e9b,_0x5b317f){var _0x2b869d=function(_0x854507){while(--_0x854507){_0x406e9b['push'](_0x406e9b['shift']());}};_0x2b869d(++_0x5b317f);}(_0xd619,0x82));var _0x9d61=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xd619[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x9d61('0x0'));var util=require('util');var moment=require(_0x9d61('0x1'));var BPromise=require(_0x9d61('0x2'));var rs=require(_0x9d61('0x3'));var fs=require('fs');var Redis=require(_0x9d61('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d61('0x5'));var logger=require('../../config/logger')(_0x9d61('0x6'));var config=require(_0x9d61('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9d61('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27d5c1,_0x167dcb,_0x4818d3){return new BPromise(function(_0x581d90,_0x1d44de){return client['request'](_0x27d5c1,_0x4818d3)[_0x9d61('0x9')](function(_0x48a3d3){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x167dcb,_0x9d61('0xa'));logger[_0x9d61('0xb')](_0x9d61('0xc'),_0x167dcb,_0x9d61('0xa'),JSON[_0x9d61('0xd')](_0x48a3d3));if(_0x48a3d3['error']){if(_0x48a3d3[_0x9d61('0xe')]['code']===0x1f4){logger[_0x9d61('0xe')](_0x9d61('0xf'),_0x167dcb,_0x48a3d3[_0x9d61('0xe')][_0x9d61('0x10')]);return _0x1d44de(_0x48a3d3[_0x9d61('0xe')]['message']);}logger[_0x9d61('0xe')](_0x9d61('0xf'),_0x167dcb,_0x48a3d3[_0x9d61('0xe')][_0x9d61('0x10')]);return _0x581d90(_0x48a3d3[_0x9d61('0xe')]['message']);}else{logger['info'](_0x9d61('0xf'),_0x167dcb,_0x9d61('0xa'));_0x581d90(_0x48a3d3[_0x9d61('0x11')][_0x9d61('0x10')]);}})[_0x9d61('0x12')](function(_0x3802e6){logger[_0x9d61('0xe')](_0x9d61('0xf'),_0x167dcb,_0x3802e6);_0x1d44de(_0x3802e6);});});}exports[_0x9d61('0x13')]=function(_0x482fee){var _0x11c1c1=this;return new Promise(function(_0x5c9b0f,_0x139796){return db[_0x9d61('0x14')][_0x9d61('0x15')]({'raw':_0x482fee[_0x9d61('0x16')]?_0x482fee[_0x9d61('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x482fee['options']?_0x482fee[_0x9d61('0x16')][_0x9d61('0x17')]||null:null,'attributes':_0x482fee[_0x9d61('0x16')]?_0x482fee[_0x9d61('0x16')][_0x9d61('0x18')]||null:null,'limit':_0x482fee[_0x9d61('0x16')]?_0x482fee[_0x9d61('0x16')][_0x9d61('0x19')]||null:null,'include':_0x482fee[_0x9d61('0x16')]?_0x482fee[_0x9d61('0x16')][_0x9d61('0x1a')]?_['map'](_0x482fee['options'][_0x9d61('0x1a')],function(_0x2ffb8d){return{'model':db[_0x2ffb8d[_0x9d61('0x1b')]],'as':_0x2ffb8d['as'],'attributes':_0x2ffb8d[_0x9d61('0x18')],'include':_0x2ffb8d[_0x9d61('0x1a')]?_[_0x9d61('0x1c')](_0x2ffb8d[_0x9d61('0x1a')],function(_0x342ffb){return{'model':db[_0x342ffb['model']],'as':_0x342ffb['as'],'attributes':_0x342ffb[_0x9d61('0x18')],'include':_0x342ffb[_0x9d61('0x1a')]?_[_0x9d61('0x1c')](_0x342ffb[_0x9d61('0x1a')],function(_0x95b77b){return{'model':db[_0x95b77b[_0x9d61('0x1b')]],'as':_0x95b77b['as'],'attributes':_0x95b77b[_0x9d61('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ef7ad){logger[_0x9d61('0x1d')]('GetCmHopperBlack',_0x482fee);logger[_0x9d61('0xb')](_0x9d61('0x13'),_0x482fee,JSON['stringify'](_0x1ef7ad));_0x5c9b0f(_0x1ef7ad);})[_0x9d61('0x12')](function(_0x587a13){logger[_0x9d61('0xe')](_0x9d61('0x13'),_0x587a13[_0x9d61('0x10')],_0x482fee);_0x139796(_0x11c1c1[_0x9d61('0xe')](0x1f4,_0x587a13[_0x9d61('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x28bda6){var _0x53779f=this;return new Promise(function(_0x5f21f4,_0x4518e3){return db['CmHopperBlack']['update'](_0x28bda6['body'],{'raw':_0x28bda6['options']?_0x28bda6[_0x9d61('0x16')][_0x9d61('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28bda6[_0x9d61('0x16')]?_0x28bda6['options'][_0x9d61('0x17')]||null:null,'attributes':_0x28bda6[_0x9d61('0x16')]?_0x28bda6[_0x9d61('0x16')][_0x9d61('0x18')]||null:null,'limit':_0x28bda6[_0x9d61('0x16')]?_0x28bda6[_0x9d61('0x16')][_0x9d61('0x19')]||null:null})[_0x9d61('0x9')](function(_0x14d5a4){logger[_0x9d61('0x1d')](_0x9d61('0x1f'),_0x28bda6);logger[_0x9d61('0xb')](_0x9d61('0x1f'),_0x28bda6,JSON['stringify'](_0x14d5a4));_0x5f21f4(_0x14d5a4);})[_0x9d61('0x12')](function(_0xd03247){logger['error'](_0x9d61('0x1f'),_0xd03247[_0x9d61('0x10')],_0x28bda6);_0x4518e3(_0x53779f['error'](0x1f4,_0xd03247[_0x9d61('0x10')]));});});};exports[_0x9d61('0x20')]=function(_0x56cf28){var _0x489b65=this;return new Promise(function(_0x3b6698,_0x3f6a7b){return db['CmHopperBlack'][_0x9d61('0x21')]({'where':_0x56cf28[_0x9d61('0x16')]?_0x56cf28[_0x9d61('0x16')][_0x9d61('0x17')]||null:null})[_0x9d61('0x9')](function(_0x22ac35){logger['info']('DestroyCmHopperBlack',_0x56cf28);logger[_0x9d61('0xb')]('DestroyCmHopperBlack',_0x56cf28,JSON[_0x9d61('0xd')](_0x22ac35));_0x3b6698(_0x22ac35);})[_0x9d61('0x12')](function(_0x3436f7){logger[_0x9d61('0xe')](_0x9d61('0x20'),_0x3436f7['message'],_0x56cf28);_0x3f6a7b(_0x489b65[_0x9d61('0xe')](0x1f4,_0x3436f7[_0x9d61('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index feb9c16..e49dffa 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 _0x24ca=['describe','/:id','show','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x1b8134,_0x57d4fa){var _0x57b230=function(_0x24d97c){while(--_0x24d97c){_0x1b8134['push'](_0x1b8134['shift']());}};_0x57b230(++_0x57d4fa);}(_0x24ca,0x1bc));var _0xa24c=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x24ca[_0x37c07d];return _0x10dadc;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['put'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x11')]);module[_0xa24c('0x12')]=router; \ No newline at end of file +var _0xac9d=['../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3c8f26,_0x453699){var _0x5a4dd7=function(_0xd5c4b9){while(--_0xd5c4b9){_0x3c8f26['push'](_0x3c8f26['shift']());}};_0x5a4dd7(++_0x453699);}(_0xac9d,0x14d));var _0xdac9=function(_0x49d7ca,_0x514fc4){_0x49d7ca=_0x49d7ca-0x0;var _0x12422f=_0xac9d[_0x49d7ca];return _0x12422f;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var auth=require(_0xdac9('0x6'));var interaction=require(_0xdac9('0x7'));var config=require('../../config/environment');var controller=require(_0xdac9('0x8'));router['get']('/',auth[_0xdac9('0x9')](),controller[_0xdac9('0xa')]);router[_0xdac9('0xb')](_0xdac9('0xc'),auth[_0xdac9('0x9')](),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0x10')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x11')]);router[_0xdac9('0x12')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index aa8276e..c08042d 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 _0xb1d7=['INTEGER','DATE','STRING','getDataValue','endtime','followuptime','diff','seconds','setDataValue','BOOLEAN','sequelize','moment','exports'];(function(_0x233b2e,_0x3d6545){var _0x1ebf69=function(_0x5817e2){while(--_0x5817e2){_0x233b2e['push'](_0x233b2e['shift']());}};_0x1ebf69(++_0x3d6545);}(_0xb1d7,0x14f));var _0x7b1d=function(_0x8bca6f,_0x552d7d){_0x8bca6f=_0x8bca6f-0x0;var _0x11640d=_0xb1d7[_0x8bca6f];return _0x11640d;};'use strict';var Sequelize=require(_0x7b1d('0x0'));var moment=require(_0x7b1d('0x1'));module[_0x7b1d('0x2')]={'state':{'type':Sequelize[_0x7b1d('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x7b1d('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7b1d('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x7b1d('0x5')]},'calleridnum':{'type':Sequelize[_0x7b1d('0x5')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7b1d('0x4')]},'responsetime':{'type':Sequelize[_0x7b1d('0x4')]},'answertime':{'type':Sequelize[_0x7b1d('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7b1d('0x4')]},'ringtime':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x7b1d('0x5')]},'campaigntype':{'type':Sequelize[_0x7b1d('0x5')]},'membername':{'type':Sequelize[_0x7b1d('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x7b1d('0x5')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5461e3){var _0x4e7890=this[_0x7b1d('0x6')](_0x7b1d('0x7'));if(_0x4e7890&&_0x5461e3){this['setDataValue'](_0x7b1d('0x8'),moment(_0x5461e3)[_0x7b1d('0x9')](moment(_0x4e7890),_0x7b1d('0xa')));}return this[_0x7b1d('0xb')]('dispositionat',_0x5461e3);}},'amd':{'type':Sequelize[_0x7b1d('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7b1d('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7b1d('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7b1d('0x4')]},'callback':{'type':Sequelize[_0x7b1d('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7b1d('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7b1d('0x4')]},'deleted':{'type':Sequelize[_0x7b1d('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7b1d('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7b1d('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7b1d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9f05=['diff','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime'];(function(_0x2ac8b0,_0x3d6ffd){var _0x43d4b4=function(_0x798e3f){while(--_0x798e3f){_0x2ac8b0['push'](_0x2ac8b0['shift']());}};_0x43d4b4(++_0x3d6ffd);}(_0x9f05,0x1f0));var _0x59f0=function(_0x57cb95,_0x2d5854){_0x57cb95=_0x57cb95-0x0;var _0x5a10bb=_0x9f05[_0x57cb95];return _0x5a10bb;};'use strict';var Sequelize=require(_0x59f0('0x0'));var moment=require(_0x59f0('0x1'));module['exports']={'state':{'type':Sequelize[_0x59f0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x59f0('0x3')]},'scheduledat':{'type':Sequelize[_0x59f0('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x59f0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x59f0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x59f0('0x3')]},'calleridnum':{'type':Sequelize[_0x59f0('0x3')]},'calleridname':{'type':Sequelize[_0x59f0('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x59f0('0x4')]},'answertime':{'type':Sequelize[_0x59f0('0x4')]},'droptime':{'type':Sequelize[_0x59f0('0x4')]},'endtime':{'type':Sequelize[_0x59f0('0x4')]},'ringtime':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x59f0('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x59f0('0x3')]},'membername':{'type':Sequelize[_0x59f0('0x3')]},'reason':{'type':Sequelize[_0x59f0('0x3')]},'disposition':{'type':Sequelize[_0x59f0('0x3')]},'dispositionat':{'type':Sequelize[_0x59f0('0x4')],'set':function(_0x4c70a6){var _0x3b1244=this[_0x59f0('0x5')]('endtime');if(_0x3b1244&&_0x4c70a6){this[_0x59f0('0x6')](_0x59f0('0x7'),moment(_0x4c70a6)[_0x59f0('0x8')](moment(_0x3b1244),_0x59f0('0x9')));}return this[_0x59f0('0x6')](_0x59f0('0xa'),_0x4c70a6);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x59f0('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x59f0('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x59f0('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x59f0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59f0('0x4')]},'deleted':{'type':Sequelize[_0x59f0('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x59f0('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x59f0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index d1b438e..63d85d4 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7880=['CampaignId\x20=\x20?','state','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','status','error','stack','send','map','CmHopperFinal','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','order','sort','filter','merge','where','VIRTUAL','count','include','findAll','catch','show','params','describe','body','uniqueid','find','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','literal','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId'];(function(_0x439e2e,_0x53839f){var _0x16f28d=function(_0x29a7e5){while(--_0x29a7e5){_0x439e2e['push'](_0x439e2e['shift']());}};_0x16f28d(++_0x53839f);}(_0x7880,0x1f4));var _0x0788=function(_0x5d4db8,_0x4ad01b){_0x5d4db8=_0x5d4db8-0x0;var _0x415548=_0x7880[_0x5d4db8];return _0x415548;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0788('0x0'));var rimraf=require(_0x0788('0x1'));var zipdir=require(_0x0788('0x2'));var jsonpatch=require(_0x0788('0x3'));var rp=require(_0x0788('0x4'));var moment=require(_0x0788('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0788('0x6'));var util=require(_0x0788('0x7'));var path=require(_0x0788('0x8'));var sox=require(_0x0788('0x9'));var csv=require(_0x0788('0xa'));var ejs=require(_0x0788('0xb'));var fs=require('fs');var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0xa'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var db=require(_0x0788('0x18'))['db'];function respondWithStatusCode(_0x2d8568,_0x311729){_0x311729=_0x311729||0xcc;return function(_0xce4342){if(_0xce4342){return _0x2d8568[_0x0788('0x19')](_0x311729);}return _0x2d8568['status'](_0x311729)[_0x0788('0x1a')]();};}function respondWithResult(_0x7e3407,_0x3bdcdf){_0x3bdcdf=_0x3bdcdf||0xc8;return function(_0x13cf07){if(_0x13cf07){return _0x7e3407['status'](_0x3bdcdf)[_0x0788('0x1b')](_0x13cf07);}};}function respondWithFilteredResult(_0x4ed024,_0x195f14){return function(_0x170d56){if(_0x170d56){var _0x3fd1e4=_0x170d56['count'],_0xb406fb=_0x195f14['offset'],_0x2ddd1a=_0x195f14[_0x0788('0x1c')]+_0x195f14[_0x0788('0x1d')],_0x430e34;if(_0x2ddd1a>=_0x3fd1e4){_0x2ddd1a=_0x3fd1e4;_0x430e34=0xc8;}else{_0x430e34=0xce;}_0x4ed024['status'](_0x430e34);return _0x4ed024[_0x0788('0x1e')](_0x0788('0x1f'),_0xb406fb+'-'+_0x2ddd1a+'/'+_0x3fd1e4)[_0x0788('0x1b')](_0x170d56);}return null;};}function patchUpdates(_0x52c339){return function(_0x42fe14){try{jsonpatch[_0x0788('0x20')](_0x42fe14,_0x52c339,!![]);}catch(_0x492c2c){return BPromise[_0x0788('0x21')](_0x492c2c);}return _0x42fe14['save']();};}function saveUpdates(_0x7d0869,_0x48bc5f){return function(_0x17cca3){if(_0x17cca3){return _0x17cca3[_0x0788('0x22')](_0x7d0869)[_0x0788('0x23')](function(_0x3cd197){return _0x3cd197;});}return null;};}function removeEntity(_0x3aa142,_0x4f0005){return function(_0x48ec43){if(_0x48ec43){return _0x48ec43[_0x0788('0x24')]()[_0x0788('0x23')](function(){_0x3aa142[_0x0788('0x25')](0xcc)[_0x0788('0x1a')]();});}};}function handleEntityNotFound(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(!_0x79204e){_0x5ba1da[_0x0788('0x19')](0x194);}return _0x79204e;};}function handleError(_0x40309d,_0x50b65c){_0x50b65c=_0x50b65c||0x1f4;return function(_0x4b2693){logger[_0x0788('0x26')](_0x4b2693[_0x0788('0x27')]);if(_0x4b2693['name']){delete _0x4b2693['name'];}_0x40309d[_0x0788('0x25')](_0x50b65c)[_0x0788('0x28')](_0x4b2693);};}exports['index']=function(_0x286730,_0x40e7a6){var _0x467d52={},_0x18fc0e={},_0xf9ba32={'count':0x0,'rows':[]};var _0xb2f4a5=_[_0x0788('0x29')](db[_0x0788('0x2a')]['rawAttributes'],function(_0x5a5178){return{'name':_0x5a5178[_0x0788('0x2b')],'type':_0x5a5178[_0x0788('0x2c')]['key']};});_0x18fc0e['model']=_[_0x0788('0x29')](_0xb2f4a5,_0x0788('0x2d'));_0x18fc0e[_0x0788('0x2e')]=_[_0x0788('0x2f')](_0x286730[_0x0788('0x2e')]);_0x18fc0e[_0x0788('0x30')]=_[_0x0788('0x31')](_0x18fc0e[_0x0788('0x32')],_0x18fc0e[_0x0788('0x2e')]);_0x467d52[_0x0788('0x33')]=_['intersection'](_0x18fc0e[_0x0788('0x32')],qs[_0x0788('0x34')](_0x286730[_0x0788('0x2e')][_0x0788('0x34')]));_0x467d52[_0x0788('0x33')]=_0x467d52[_0x0788('0x33')][_0x0788('0x35')]?_0x467d52[_0x0788('0x33')]:_0x18fc0e[_0x0788('0x32')];if(!_0x286730[_0x0788('0x2e')]['hasOwnProperty']('nolimit')){_0x467d52['limit']=qs['limit'](_0x286730['query']['limit']);_0x467d52[_0x0788('0x1c')]=qs[_0x0788('0x1c')](_0x286730[_0x0788('0x2e')]['offset']);}_0x467d52[_0x0788('0x36')]=qs[_0x0788('0x37')](_0x286730[_0x0788('0x2e')][_0x0788('0x37')]);_0x467d52['where']=qs[_0x0788('0x30')](_['pick'](_0x286730[_0x0788('0x2e')],_0x18fc0e['filters']),_0xb2f4a5);if(_0x286730[_0x0788('0x2e')][_0x0788('0x38')]){_0x467d52['where']=_[_0x0788('0x39')](_0x467d52[_0x0788('0x3a')],{'$or':_['map'](_0xb2f4a5,function(_0x17240e){if(_0x17240e['type']!==_0x0788('0x3b')){var _0x5576c4={};_0x5576c4[_0x17240e[_0x0788('0x2d')]]={'$like':'%'+_0x286730['query'][_0x0788('0x38')]+'%'};return _0x5576c4;}})});}_0x467d52=_['merge']({},_0x467d52,_0x286730['options']);var _0x3e31f8={'where':_0x467d52[_0x0788('0x3a')]};return db[_0x0788('0x2a')][_0x0788('0x3c')](_0x3e31f8)[_0x0788('0x23')](function(_0x53da74){_0xf9ba32['count']=_0x53da74;if(_0x286730['query']['includeAll']){_0x467d52[_0x0788('0x3d')]=[{'all':!![]}];}return db[_0x0788('0x2a')][_0x0788('0x3e')](_0x467d52);})[_0x0788('0x23')](function(_0x362c49){_0xf9ba32['rows']=_0x362c49;return _0xf9ba32;})['then'](respondWithFilteredResult(_0x40e7a6,_0x467d52))[_0x0788('0x3f')](handleError(_0x40e7a6,null));};exports[_0x0788('0x40')]=function(_0x330421,_0x29e09a){var _0x236b63={'raw':!![],'where':{'id':_0x330421[_0x0788('0x41')]['id']}},_0x4316aa={};_0x4316aa[_0x0788('0x32')]=_[_0x0788('0x2f')](db['CmHopperFinal']['rawAttributes']);_0x4316aa[_0x0788('0x2e')]=_[_0x0788('0x2f')](_0x330421[_0x0788('0x2e')]);_0x4316aa['filters']=_['intersection'](_0x4316aa['model'],_0x4316aa[_0x0788('0x2e')]);_0x236b63[_0x0788('0x33')]=_[_0x0788('0x31')](_0x4316aa[_0x0788('0x32')],qs[_0x0788('0x34')](_0x330421[_0x0788('0x2e')][_0x0788('0x34')]));_0x236b63[_0x0788('0x33')]=_0x236b63['attributes'][_0x0788('0x35')]?_0x236b63[_0x0788('0x33')]:_0x4316aa[_0x0788('0x32')];if(_0x330421[_0x0788('0x2e')]['includeAll']){_0x236b63[_0x0788('0x3d')]=[{'all':!![]}];}_0x236b63=_[_0x0788('0x39')]({},_0x236b63,_0x330421['options']);return db['CmHopperFinal']['find'](_0x236b63)[_0x0788('0x23')](handleEntityNotFound(_0x29e09a,null))['then'](respondWithResult(_0x29e09a,null))[_0x0788('0x3f')](handleError(_0x29e09a,null));};exports[_0x0788('0x42')]=function(_0x127ab4,_0x329508){return db[_0x0788('0x2a')][_0x0788('0x42')]()[_0x0788('0x23')](respondWithResult(_0x329508,null))[_0x0788('0x3f')](handleError(_0x329508,null));};exports['update']=function(_0x4c6366,_0x39c3cc){if(_0x4c6366[_0x0788('0x43')][_0x0788('0x44')]){delete _0x4c6366['body'][_0x0788('0x44')];}return db[_0x0788('0x2a')][_0x0788('0x45')]({'where':{'uniqueid':_0x4c6366[_0x0788('0x41')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x39c3cc,null))['then'](saveUpdates(_0x4c6366['body'],null))[_0x0788('0x23')](respondWithResult(_0x39c3cc,null))[_0x0788('0x3f')](handleError(_0x39c3cc,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x2b1479,_0x4a6cde,_0x2103aa){return db[_0x0788('0x2a')][_0x0788('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x2b1479[_0x0788('0x41')]['id']},'attributes':[[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x48')))),_0x0788('0x49')],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x4a')))),_0x0788('0x4b')],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x0788('0x4c')],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x4e')))),_0x0788('0x4f')],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x50')))),_0x0788('0x51')],[db['sequelize']['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x52')))),_0x0788('0x53')],[db['sequelize']['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x0788('0x23')](handleEntityNotFound(_0x4a6cde,null))['then'](respondWithResult(_0x4a6cde,null))[_0x0788('0x3f')](handleError(_0x4a6cde,null));};exports[_0x0788('0x56')]=function(_0x223767,_0x13a021,_0x101e8b){return db[_0x0788('0x2a')][_0x0788('0x3e')]({'raw':![],'where':{'CampaignId':_0x223767[_0x0788('0x41')]['id']},'attributes':[[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db['sequelize']['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x48')))),_0x0788('0x49')],[db['sequelize']['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x4a')))),'noAnswerContacts'],[db[_0x0788('0x46')]['fn']('COUNT',db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x57')))),_0x0788('0x4c')],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal'](_0x0788('0x4e')))),_0x0788('0x4f')],[db[_0x0788('0x46')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x50')))),'dropContacts'],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db['sequelize']['literal'](_0x0788('0x54')))),'reCallContacts'],[db[_0x0788('0x46')]['fn'](_0x0788('0x47'),db[_0x0788('0x46')]['fn']('IF',db[_0x0788('0x46')][_0x0788('0x4d')](_0x0788('0x58')))),_0x0788('0x59')]]})[_0x0788('0x23')](handleEntityNotFound(_0x13a021,null))[_0x0788('0x23')](respondWithResult(_0x13a021,null))[_0x0788('0x3f')](handleError(_0x13a021,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x240210,_0x30248c,_0x52926f){return db['VoiceQueue'][_0x0788('0x45')]({'where':{'id':_0x240210[_0x0788('0x41')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0x30248c,null))[_0x0788('0x23')](function(_0x3628d6){var _0x192798;if(_0x3628d6){_0x192798=squel['insert']()[_0x0788('0x5a')](_0x0788('0x5b'))[_0x0788('0x5c')]([_0x0788('0x5d'),'scheduledAt',_0x0788('0x5e'),_0x0788('0x5f'),_0x0788('0x60'),_0x0788('0x61'),'updatedAt'],squel['select']()[_0x0788('0x62')](_0x0788('0x63'),_0x0788('0x5d'))[_0x0788('0x62')](_0x0788('0x64'),_0x0788('0x65'))[_0x0788('0x62')](_0x0788('0x66'),_0x0788('0x5e'))['field'](_0x0788('0x67'),_0x0788('0x5f'))[_0x0788('0x62')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x0788('0x62')]('NOW()',_0x0788('0x61'))[_0x0788('0x62')](_0x0788('0x64'),_0x0788('0x68'))[_0x0788('0x69')](_0x0788('0x6a'))[_0x0788('0x3a')](_0x0788('0x6b'),_0x240210[_0x0788('0x41')]['id']['toString']())[_0x0788('0x3a')](_0x0788('0x6c'),_0x240210[_0x0788('0x43')]['state'][_0x0788('0x6d')]())[_0x0788('0x3a')](_0x0788('0x6e'))['where'](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x5d'))[_0x0788('0x69')](_0x0788('0x5b'))[_0x0788('0x3a')](_0x0788('0x6b'),_0x240210[_0x0788('0x41')]['id']['toString']()))[_0x0788('0x3a')](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x71'))['from'](_0x0788('0x6a'))[_0x0788('0x3a')](_0x0788('0x6b'),_0x240210['params']['id'][_0x0788('0x6d')]())[_0x0788('0x3a')](_0x0788('0x72')))[_0x0788('0x73')](_0x0788('0x5e')))['toString']();return db[_0x0788('0x46')][_0x0788('0x2e')](_0x192798);}return[];})['then'](respondWithResult(_0x30248c,null))[_0x0788('0x3f')](handleError(_0x30248c,null));};exports[_0x0788('0x74')]=function(_0x537a69,_0xc597d7,_0xe14a8e){return db[_0x0788('0x75')]['find']({'where':{'id':_0x537a69[_0x0788('0x41')]['id']}})[_0x0788('0x23')](handleEntityNotFound(_0xc597d7,null))[_0x0788('0x23')](function(_0x53730a){var _0xddfb97;if(_0x53730a){_0xddfb97=squel[_0x0788('0x76')]()[_0x0788('0x5a')](_0x0788('0x5b'))[_0x0788('0x5c')]([_0x0788('0x5d'),_0x0788('0x65'),_0x0788('0x5e'),'ListId',_0x0788('0x77'),_0x0788('0x61'),_0x0788('0x68')],squel[_0x0788('0x70')]()['field']('ANY_VALUE(calleridnum)',_0x0788('0x5d'))[_0x0788('0x62')]('NOW()',_0x0788('0x65'))[_0x0788('0x62')](_0x0788('0x66'),'ContactId')['field'](_0x0788('0x67'),_0x0788('0x5f'))['field']('ANY_VALUE(CampaignId)','CampaignId')[_0x0788('0x62')](_0x0788('0x64'),'createdAt')[_0x0788('0x62')](_0x0788('0x64'),_0x0788('0x68'))[_0x0788('0x69')](_0x0788('0x6a'))['where'](_0x0788('0x78'),_0x537a69['params']['id'][_0x0788('0x6d')]())['where'](_0x0788('0x6c'),_0x537a69[_0x0788('0x43')][_0x0788('0x79')][_0x0788('0x6d')]())[_0x0788('0x3a')](_0x0788('0x6e'))[_0x0788('0x3a')](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x5d'))[_0x0788('0x69')](_0x0788('0x5b'))['where']('CampaignId\x20=\x20?',_0x537a69['params']['id'][_0x0788('0x6d')]()))[_0x0788('0x3a')](_0x0788('0x6f'),squel[_0x0788('0x70')]()[_0x0788('0x62')](_0x0788('0x71'))[_0x0788('0x69')](_0x0788('0x6a'))[_0x0788('0x3a')](_0x0788('0x78'),_0x537a69[_0x0788('0x41')]['id']['toString']())['where'](_0x0788('0x72')))[_0x0788('0x73')](_0x0788('0x5e')))[_0x0788('0x6d')]();return db[_0x0788('0x46')][_0x0788('0x2e')](_0xddfb97);}return[];})[_0x0788('0x23')](respondWithResult(_0xc597d7,null))[_0x0788('0x3f')](handleError(_0xc597d7,null));};exports['checkContactHopper']=function(_0x48b82c,_0x3b5c80,_0x22e770){return db[_0x0788('0x7a')][_0x0788('0x7b')]({'where':{'VoiceQueueId':_0x48b82c[_0x0788('0x43')][_0x0788('0x60')],'CampaignId':_0x48b82c['body'][_0x0788('0x77')],'ContactId':_0x48b82c[_0x0788('0x43')][_0x0788('0x5e')]}})[_0x0788('0x23')](handleEntityNotFound(_0x3b5c80,null))[_0x0788('0x23')](function(_0x1191e7){if(_0x1191e7){return _0x1191e7;}return null;})[_0x0788('0x23')](respondWithResult(_0x3b5c80,null))[_0x0788('0x3f')](handleError(_0x3b5c80,null));}; \ No newline at end of file +var _0xd2f5=['describe','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','findAll','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','group','checkContactHopper','CmHopper','findOne','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','CmHopperFinal','count','includeAll','rows','catch','show','include','options'];(function(_0x4a042b,_0x25a4c9){var _0x33a04a=function(_0x5abeff){while(--_0x5abeff){_0x4a042b['push'](_0x4a042b['shift']());}};_0x33a04a(++_0x25a4c9);}(_0xd2f5,0x144));var _0x5d2f=function(_0x2c2c5a,_0x57cac7){_0x2c2c5a=_0x2c2c5a-0x0;var _0x126933=_0xd2f5[_0x2c2c5a];return _0x126933;};'use strict';var pdf=require(_0x5d2f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5d2f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d2f('0x2'));var rp=require('request-promise');var moment=require(_0x5d2f('0x3'));var BPromise=require(_0x5d2f('0x4'));var Mustache=require(_0x5d2f('0x5'));var util=require(_0x5d2f('0x6'));var path=require(_0x5d2f('0x7'));var sox=require(_0x5d2f('0x8'));var csv=require(_0x5d2f('0x9'));var ejs=require(_0x5d2f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5d2f('0xb'));var crypto=require(_0x5d2f('0xc'));var jsforce=require(_0x5d2f('0xd'));var deskjs=require(_0x5d2f('0xe'));var toCsv=require(_0x5d2f('0x9'));var querystring=require(_0x5d2f('0xf'));var Papa=require('papaparse');var Redis=require(_0x5d2f('0x10'));var authService=require(_0x5d2f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5d2f('0x12'));var hardwareService=require(_0x5d2f('0x13'));var logger=require(_0x5d2f('0x14'))('api');var utils=require(_0x5d2f('0x15'));var config=require(_0x5d2f('0x16'));var db=require(_0x5d2f('0x17'))['db'];function respondWithStatusCode(_0x5d07f4,_0x510eb5){_0x510eb5=_0x510eb5||0xcc;return function(_0x15530f){if(_0x15530f){return _0x5d07f4['sendStatus'](_0x510eb5);}return _0x5d07f4[_0x5d2f('0x18')](_0x510eb5)[_0x5d2f('0x19')]();};}function respondWithResult(_0x5e6a95,_0x663b11){_0x663b11=_0x663b11||0xc8;return function(_0x4b0bf6){if(_0x4b0bf6){return _0x5e6a95[_0x5d2f('0x18')](_0x663b11)[_0x5d2f('0x1a')](_0x4b0bf6);}};}function respondWithFilteredResult(_0x309985,_0x4df9b1){return function(_0x6d7c6c){if(_0x6d7c6c){var _0x39a7d5=_0x6d7c6c['count'],_0x1ca388=_0x4df9b1[_0x5d2f('0x1b')],_0x2876fb=_0x4df9b1[_0x5d2f('0x1b')]+_0x4df9b1[_0x5d2f('0x1c')],_0x1536ee;if(_0x2876fb>=_0x39a7d5){_0x2876fb=_0x39a7d5;_0x1536ee=0xc8;}else{_0x1536ee=0xce;}_0x309985[_0x5d2f('0x18')](_0x1536ee);return _0x309985['set'](_0x5d2f('0x1d'),_0x1ca388+'-'+_0x2876fb+'/'+_0x39a7d5)[_0x5d2f('0x1a')](_0x6d7c6c);}return null;};}function patchUpdates(_0x36ddf1){return function(_0x3d5ad9){try{jsonpatch[_0x5d2f('0x1e')](_0x3d5ad9,_0x36ddf1,!![]);}catch(_0x32ec09){return BPromise[_0x5d2f('0x1f')](_0x32ec09);}return _0x3d5ad9['save']();};}function saveUpdates(_0x47fe97,_0x4d3959){return function(_0x3814b1){if(_0x3814b1){return _0x3814b1[_0x5d2f('0x20')](_0x47fe97)[_0x5d2f('0x21')](function(_0x41967d){return _0x41967d;});}return null;};}function removeEntity(_0x215f0c,_0x5c6dae){return function(_0x5cc8d6){if(_0x5cc8d6){return _0x5cc8d6[_0x5d2f('0x22')]()['then'](function(){_0x215f0c[_0x5d2f('0x18')](0xcc)[_0x5d2f('0x19')]();});}};}function handleEntityNotFound(_0x102304,_0x6d8859){return function(_0x6d4ad2){if(!_0x6d4ad2){_0x102304[_0x5d2f('0x23')](0x194);}return _0x6d4ad2;};}function handleError(_0x25e953,_0x20439c){_0x20439c=_0x20439c||0x1f4;return function(_0x543cc4){logger[_0x5d2f('0x24')](_0x543cc4[_0x5d2f('0x25')]);if(_0x543cc4[_0x5d2f('0x26')]){delete _0x543cc4[_0x5d2f('0x26')];}_0x25e953[_0x5d2f('0x18')](_0x20439c)[_0x5d2f('0x27')](_0x543cc4);};}exports[_0x5d2f('0x28')]=function(_0x273223,_0x51ca6a){var _0x10351a={},_0xa95a71={},_0x3d1b95={'count':0x0,'rows':[]};var _0x3446a0=_[_0x5d2f('0x29')](db['CmHopperFinal'][_0x5d2f('0x2a')],function(_0x35e94f){return{'name':_0x35e94f[_0x5d2f('0x2b')],'type':_0x35e94f[_0x5d2f('0x2c')]['key']};});_0xa95a71[_0x5d2f('0x2d')]=_[_0x5d2f('0x29')](_0x3446a0,'name');_0xa95a71[_0x5d2f('0x2e')]=_[_0x5d2f('0x2f')](_0x273223[_0x5d2f('0x2e')]);_0xa95a71['filters']=_[_0x5d2f('0x30')](_0xa95a71[_0x5d2f('0x2d')],_0xa95a71[_0x5d2f('0x2e')]);_0x10351a[_0x5d2f('0x31')]=_[_0x5d2f('0x30')](_0xa95a71[_0x5d2f('0x2d')],qs['fields'](_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x32')]));_0x10351a[_0x5d2f('0x31')]=_0x10351a['attributes']['length']?_0x10351a[_0x5d2f('0x31')]:_0xa95a71[_0x5d2f('0x2d')];if(!_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x33')](_0x5d2f('0x34'))){_0x10351a[_0x5d2f('0x1c')]=qs[_0x5d2f('0x1c')](_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x1c')]);_0x10351a[_0x5d2f('0x1b')]=qs[_0x5d2f('0x1b')](_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x1b')]);}_0x10351a[_0x5d2f('0x35')]=qs[_0x5d2f('0x36')](_0x273223['query'][_0x5d2f('0x36')]);_0x10351a[_0x5d2f('0x37')]=qs[_0x5d2f('0x38')](_[_0x5d2f('0x39')](_0x273223[_0x5d2f('0x2e')],_0xa95a71[_0x5d2f('0x38')]),_0x3446a0);if(_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x3a')]){_0x10351a[_0x5d2f('0x37')]=_['merge'](_0x10351a[_0x5d2f('0x37')],{'$or':_[_0x5d2f('0x29')](_0x3446a0,function(_0x216c35){if(_0x216c35[_0x5d2f('0x2c')]!==_0x5d2f('0x3b')){var _0x372359={};_0x372359[_0x216c35[_0x5d2f('0x26')]]={'$like':'%'+_0x273223[_0x5d2f('0x2e')]['filter']+'%'};return _0x372359;}})});}_0x10351a=_[_0x5d2f('0x3c')]({},_0x10351a,_0x273223['options']);var _0x2c5ba8={'where':_0x10351a[_0x5d2f('0x37')]};return db[_0x5d2f('0x3d')][_0x5d2f('0x3e')](_0x2c5ba8)[_0x5d2f('0x21')](function(_0x117d5d){_0x3d1b95[_0x5d2f('0x3e')]=_0x117d5d;if(_0x273223[_0x5d2f('0x2e')][_0x5d2f('0x3f')]){_0x10351a['include']=[{'all':!![]}];}return db[_0x5d2f('0x3d')]['findAll'](_0x10351a);})['then'](function(_0x168c9d){_0x3d1b95[_0x5d2f('0x40')]=_0x168c9d;return _0x3d1b95;})[_0x5d2f('0x21')](respondWithFilteredResult(_0x51ca6a,_0x10351a))[_0x5d2f('0x41')](handleError(_0x51ca6a,null));};exports[_0x5d2f('0x42')]=function(_0x2553dd,_0x195721){var _0x49c3fe={'raw':!![],'where':{'id':_0x2553dd['params']['id']}},_0x508fba={};_0x508fba[_0x5d2f('0x2d')]=_[_0x5d2f('0x2f')](db[_0x5d2f('0x3d')][_0x5d2f('0x2a')]);_0x508fba[_0x5d2f('0x2e')]=_['keys'](_0x2553dd[_0x5d2f('0x2e')]);_0x508fba[_0x5d2f('0x38')]=_[_0x5d2f('0x30')](_0x508fba['model'],_0x508fba[_0x5d2f('0x2e')]);_0x49c3fe[_0x5d2f('0x31')]=_[_0x5d2f('0x30')](_0x508fba[_0x5d2f('0x2d')],qs[_0x5d2f('0x32')](_0x2553dd[_0x5d2f('0x2e')]['fields']));_0x49c3fe[_0x5d2f('0x31')]=_0x49c3fe['attributes']['length']?_0x49c3fe[_0x5d2f('0x31')]:_0x508fba[_0x5d2f('0x2d')];if(_0x2553dd[_0x5d2f('0x2e')]['includeAll']){_0x49c3fe[_0x5d2f('0x43')]=[{'all':!![]}];}_0x49c3fe=_[_0x5d2f('0x3c')]({},_0x49c3fe,_0x2553dd[_0x5d2f('0x44')]);return db[_0x5d2f('0x3d')]['find'](_0x49c3fe)[_0x5d2f('0x21')](handleEntityNotFound(_0x195721,null))[_0x5d2f('0x21')](respondWithResult(_0x195721,null))[_0x5d2f('0x41')](handleError(_0x195721,null));};exports[_0x5d2f('0x45')]=function(_0x2db009,_0x22b252){return db[_0x5d2f('0x3d')][_0x5d2f('0x45')]()[_0x5d2f('0x21')](respondWithResult(_0x22b252,null))[_0x5d2f('0x41')](handleError(_0x22b252,null));};exports['update']=function(_0x577e8a,_0x55a4a0){if(_0x577e8a[_0x5d2f('0x46')]['uniqueid']){delete _0x577e8a[_0x5d2f('0x46')][_0x5d2f('0x47')];}return db[_0x5d2f('0x3d')][_0x5d2f('0x48')]({'where':{'uniqueid':_0x577e8a[_0x5d2f('0x49')]['id']}})[_0x5d2f('0x21')](handleEntityNotFound(_0x55a4a0,null))['then'](saveUpdates(_0x577e8a['body'],null))[_0x5d2f('0x21')](respondWithResult(_0x55a4a0,null))[_0x5d2f('0x41')](handleError(_0x55a4a0,null));};exports[_0x5d2f('0x4a')]=function(_0x1a51fa,_0x539f73,_0x3baabe){return db[_0x5d2f('0x3d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x1a51fa[_0x5d2f('0x49')]['id']},'attributes':[[db[_0x5d2f('0x4b')]['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x4d')))),'noSuchContacts'],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x4f')))),_0x5d2f('0x50')],[db['sequelize']['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x5d2f('0x51')],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x52')))),_0x5d2f('0x53')],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db['sequelize']['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x54')))),'abandonedContacts'],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')]['literal'](_0x5d2f('0x55')))),_0x5d2f('0x56')],[db['sequelize']['fn'](_0x5d2f('0x4e'),db['sequelize']['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x57')))),_0x5d2f('0x58')]]})['then'](handleEntityNotFound(_0x539f73,null))[_0x5d2f('0x21')](respondWithResult(_0x539f73,null))[_0x5d2f('0x41')](handleError(_0x539f73,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x393d67,_0x1eb949,_0x5a306b){return db[_0x5d2f('0x3d')][_0x5d2f('0x59')]({'raw':![],'where':{'CampaignId':_0x393d67['params']['id']},'attributes':[[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db['sequelize']['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x4d')))),_0x5d2f('0x5a')],[db['sequelize']['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x5d2f('0x4f')))),_0x5d2f('0x50')],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db[_0x5d2f('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x5d2f('0x5b')))),_0x5d2f('0x51')],[db['sequelize']['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x5d2f('0x4b')]['fn'](_0x5d2f('0x4e'),db['sequelize']['fn']('IF',db[_0x5d2f('0x4b')]['literal'](_0x5d2f('0x5c')))),_0x5d2f('0x5d')],[db[_0x5d2f('0x4b')]['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')][_0x5d2f('0x4c')](_0x5d2f('0x54')))),'abandonedContacts'],[db[_0x5d2f('0x4b')]['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')]['literal'](_0x5d2f('0x55')))),_0x5d2f('0x56')],[db['sequelize']['fn']('COUNT',db[_0x5d2f('0x4b')]['fn']('IF',db[_0x5d2f('0x4b')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x5d2f('0x58')]]})[_0x5d2f('0x21')](handleEntityNotFound(_0x1eb949,null))['then'](respondWithResult(_0x1eb949,null))[_0x5d2f('0x41')](handleError(_0x1eb949,null));};exports[_0x5d2f('0x5e')]=function(_0x1bd125,_0x35c992,_0x2e67f1){return db['VoiceQueue'][_0x5d2f('0x48')]({'where':{'id':_0x1bd125[_0x5d2f('0x49')]['id']}})[_0x5d2f('0x21')](handleEntityNotFound(_0x35c992,null))[_0x5d2f('0x21')](function(_0x274672){var _0x37b4a6;if(_0x274672){_0x37b4a6=squel[_0x5d2f('0x5f')]()[_0x5d2f('0x60')]('cm_hopper')[_0x5d2f('0x61')]([_0x5d2f('0x62'),_0x5d2f('0x63'),_0x5d2f('0x64'),'ListId',_0x5d2f('0x65'),_0x5d2f('0x66'),_0x5d2f('0x67')],squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')](_0x5d2f('0x6a'),'phone')['field'](_0x5d2f('0x6b'),_0x5d2f('0x63'))[_0x5d2f('0x69')](_0x5d2f('0x6c'),'ContactId')[_0x5d2f('0x69')](_0x5d2f('0x6d'),'ListId')[_0x5d2f('0x69')](_0x5d2f('0x6e'),_0x5d2f('0x65'))[_0x5d2f('0x69')](_0x5d2f('0x6b'),_0x5d2f('0x66'))['field'](_0x5d2f('0x6b'),_0x5d2f('0x67'))[_0x5d2f('0x6f')](_0x5d2f('0x70'))['where']('VoiceQueueId\x20=\x20?',_0x1bd125[_0x5d2f('0x49')]['id']['toString']())[_0x5d2f('0x37')]('state\x20=\x20?',_0x1bd125[_0x5d2f('0x46')][_0x5d2f('0x71')][_0x5d2f('0x72')]())[_0x5d2f('0x37')](_0x5d2f('0x73'))['where'](_0x5d2f('0x74'),squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')]('phone')[_0x5d2f('0x6f')](_0x5d2f('0x75'))['where'](_0x5d2f('0x76'),_0x1bd125[_0x5d2f('0x49')]['id'][_0x5d2f('0x72')]()))[_0x5d2f('0x37')](_0x5d2f('0x74'),squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')](_0x5d2f('0x77'))[_0x5d2f('0x6f')](_0x5d2f('0x70'))[_0x5d2f('0x37')](_0x5d2f('0x76'),_0x1bd125[_0x5d2f('0x49')]['id'][_0x5d2f('0x72')]())['where'](_0x5d2f('0x78')))['group']('ContactId'))[_0x5d2f('0x72')]();return db[_0x5d2f('0x4b')]['query'](_0x37b4a6);}return[];})[_0x5d2f('0x21')](respondWithResult(_0x35c992,null))[_0x5d2f('0x41')](handleError(_0x35c992,null));};exports[_0x5d2f('0x79')]=function(_0x216a78,_0x3e6f5a,_0x7a217f){return db[_0x5d2f('0x7a')][_0x5d2f('0x48')]({'where':{'id':_0x216a78[_0x5d2f('0x49')]['id']}})[_0x5d2f('0x21')](handleEntityNotFound(_0x3e6f5a,null))[_0x5d2f('0x21')](function(_0x2e0d42){var _0x3c7782;if(_0x2e0d42){_0x3c7782=squel[_0x5d2f('0x5f')]()[_0x5d2f('0x60')]('cm_hopper')[_0x5d2f('0x61')](['phone','scheduledAt',_0x5d2f('0x64'),_0x5d2f('0x7b'),_0x5d2f('0x7c'),_0x5d2f('0x66'),'updatedAt'],squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')](_0x5d2f('0x6a'),_0x5d2f('0x62'))[_0x5d2f('0x69')]('NOW()',_0x5d2f('0x63'))[_0x5d2f('0x69')](_0x5d2f('0x6c'),_0x5d2f('0x64'))[_0x5d2f('0x69')]('ANY_VALUE(ListId)',_0x5d2f('0x7b'))[_0x5d2f('0x69')]('ANY_VALUE(CampaignId)',_0x5d2f('0x7c'))[_0x5d2f('0x69')]('NOW()',_0x5d2f('0x66'))[_0x5d2f('0x69')](_0x5d2f('0x6b'),_0x5d2f('0x67'))[_0x5d2f('0x6f')](_0x5d2f('0x70'))[_0x5d2f('0x37')](_0x5d2f('0x7d'),_0x216a78['params']['id'][_0x5d2f('0x72')]())[_0x5d2f('0x37')](_0x5d2f('0x7e'),_0x216a78[_0x5d2f('0x46')]['state'][_0x5d2f('0x72')]())[_0x5d2f('0x37')](_0x5d2f('0x73'))[_0x5d2f('0x37')](_0x5d2f('0x74'),squel['select']()[_0x5d2f('0x69')](_0x5d2f('0x62'))['from'](_0x5d2f('0x75'))[_0x5d2f('0x37')](_0x5d2f('0x7d'),_0x216a78[_0x5d2f('0x49')]['id'][_0x5d2f('0x72')]()))[_0x5d2f('0x37')](_0x5d2f('0x74'),squel[_0x5d2f('0x68')]()[_0x5d2f('0x69')]('calleridnum')['from'](_0x5d2f('0x70'))[_0x5d2f('0x37')](_0x5d2f('0x7d'),_0x216a78[_0x5d2f('0x49')]['id'][_0x5d2f('0x72')]())[_0x5d2f('0x37')](_0x5d2f('0x78')))[_0x5d2f('0x7f')](_0x5d2f('0x64')))[_0x5d2f('0x72')]();return db['sequelize'][_0x5d2f('0x2e')](_0x3c7782);}return[];})[_0x5d2f('0x21')](respondWithResult(_0x3e6f5a,null))['catch'](handleError(_0x3e6f5a,null));};exports[_0x5d2f('0x80')]=function(_0x5772a6,_0x5ba863,_0x47ab3a){return db[_0x5d2f('0x81')][_0x5d2f('0x82')]({'where':{'VoiceQueueId':_0x5772a6[_0x5d2f('0x46')][_0x5d2f('0x65')],'CampaignId':_0x5772a6[_0x5d2f('0x46')][_0x5d2f('0x7c')],'ContactId':_0x5772a6[_0x5d2f('0x46')][_0x5d2f('0x64')]}})[_0x5d2f('0x21')](handleEntityNotFound(_0x5ba863,null))[_0x5d2f('0x21')](function(_0x48fc53){if(_0x48fc53){return _0x48fc53;}return null;})[_0x5d2f('0x21')](respondWithResult(_0x5ba863,null))[_0x5d2f('0x41')](handleError(_0x5ba863,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ddaa5de..dbb2adb 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 _0xea70=['request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x565aa3,_0xff8fa){var _0x5351a3=function(_0x5a1420){while(--_0x5a1420){_0x565aa3['push'](_0x565aa3['shift']());}};_0x5351a3(++_0xff8fa);}(_0xea70,0x175));var _0x0ea7=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xea70[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var logger=require(_0x0ea7('0x2'))('api');var moment=require(_0x0ea7('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ea7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ea7('0x5'));var config=require(_0x0ea7('0x6'));var attributes=require(_0x0ea7('0x7'));module[_0x0ea7('0x8')]=function(_0x168372,_0x489be9){return _0x168372[_0x0ea7('0x9')](_0x0ea7('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x0ea7('0xb'),'fields':[_0x0ea7('0xb')]},{'name':'uniqueid','fields':[_0x0ea7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['uniqueid','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x4a75a7,_0x46953d){var _0x20e748=function(_0x3b2f5f){while(--_0x3b2f5f){_0x4a75a7['push'](_0x4a75a7['shift']());}};_0x20e748(++_0x46953d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x7e034f,_0x52e8eb){_0x7e034f=_0x7e034f-0x0;var _0x1b5bf8=_0x9bde[_0x7e034f];return _0x1b5bf8;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[{'name':_0xe9bd('0xc'),'fields':[_0xe9bd('0xc')]},{'name':_0xe9bd('0xd'),'fields':[_0xe9bd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 6699e24..f6cf53c 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 _0x145f=['client','request','info','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperFinal,\x20%s,\x20%s','result','catch','create','body','options','raw','then','CreateCmHopperFinal','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x145f,0xec));var _0xf145=function(_0x4d98a7,_0x3b2c60){_0x4d98a7=_0x4d98a7-0x0;var _0x4be531=_0x145f[_0x4d98a7];return _0x4be531;};'use strict';var _=require(_0xf145('0x0'));var util=require(_0xf145('0x1'));var moment=require(_0xf145('0x2'));var BPromise=require(_0xf145('0x3'));var rs=require(_0xf145('0x4'));var fs=require('fs');var Redis=require(_0xf145('0x5'));var db=require(_0xf145('0x6'))['db'];var utils=require(_0xf145('0x7'));var logger=require(_0xf145('0x8'))(_0xf145('0x9'));var config=require(_0xf145('0xa'));var jayson=require(_0xf145('0xb'));var client=jayson[_0xf145('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17109b,_0x235d61,_0x2eb7c6){return new BPromise(function(_0x166a4e,_0xdf3bdc){return client[_0xf145('0xd')](_0x17109b,_0x2eb7c6)['then'](function(_0x2d4ff2){logger[_0xf145('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x235d61,_0xf145('0xf'));logger[_0xf145('0x10')](_0xf145('0x11'),_0x235d61,'request\x20sent',JSON[_0xf145('0x12')](_0x2d4ff2));if(_0x2d4ff2[_0xf145('0x13')]){if(_0x2d4ff2[_0xf145('0x13')][_0xf145('0x14')]===0x1f4){logger[_0xf145('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x235d61,_0x2d4ff2['error'][_0xf145('0x15')]);return _0xdf3bdc(_0x2d4ff2[_0xf145('0x13')]['message']);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x235d61,_0x2d4ff2[_0xf145('0x13')]['message']);return _0x166a4e(_0x2d4ff2['error'][_0xf145('0x15')]);}else{logger[_0xf145('0xe')](_0xf145('0x16'),_0x235d61,_0xf145('0xf'));_0x166a4e(_0x2d4ff2[_0xf145('0x17')][_0xf145('0x15')]);}})[_0xf145('0x18')](function(_0x915fa){logger[_0xf145('0x13')](_0xf145('0x16'),_0x235d61,_0x915fa);_0xdf3bdc(_0x915fa);});});}exports['CreateCmHopperFinal']=function(_0x4eac55){var _0x12982a=this;return new Promise(function(_0x52b195,_0x6671ae){return db['CmHopperFinal'][_0xf145('0x19')](_0x4eac55[_0xf145('0x1a')],{'raw':_0x4eac55[_0xf145('0x1b')]?_0x4eac55[_0xf145('0x1b')][_0xf145('0x1c')]===undefined?!![]:![]:!![]})[_0xf145('0x1d')](function(_0x41abc0){logger[_0xf145('0xe')](_0xf145('0x1e'),_0x4eac55);logger[_0xf145('0x10')]('CreateCmHopperFinal',_0x4eac55,JSON['stringify'](_0x41abc0));_0x52b195(_0x41abc0);})[_0xf145('0x18')](function(_0xc67b39){logger[_0xf145('0x13')](_0xf145('0x1e'),_0xc67b39[_0xf145('0x15')],_0x4eac55);_0x6671ae(_0x12982a[_0xf145('0x13')](0x1f4,_0xc67b39[_0xf145('0x15')]));});});}; \ No newline at end of file +var _0x032b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperFinal','body','options','raw','then','CreateCmHopperFinal','stringify','util','randomstring','../../mysqldb'];(function(_0x1a7486,_0x51abe8){var _0x533784=function(_0x1621fc){while(--_0x1621fc){_0x1a7486['push'](_0x1a7486['shift']());}};_0x533784(++_0x51abe8);}(_0x032b,0x183));var _0xb032=function(_0x4b6887,_0x96c4b7){_0x4b6887=_0x4b6887-0x0;var _0x2bf120=_0x032b[_0x4b6887];return _0x2bf120;};'use strict';var _=require('lodash');var util=require(_0xb032('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb032('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb032('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb032('0x3'))(_0xb032('0x4'));var config=require(_0xb032('0x5'));var jayson=require(_0xb032('0x6'));var client=jayson[_0xb032('0x7')][_0xb032('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ee374,_0x19d67a,_0x46fd62){return new BPromise(function(_0x345d4f,_0x3c41bf){return client['request'](_0x5ee374,_0x46fd62)['then'](function(_0x46593f){logger[_0xb032('0x9')](_0xb032('0xa'),_0x19d67a,_0xb032('0xb'));logger[_0xb032('0xc')](_0xb032('0xd'),_0x19d67a,_0xb032('0xb'),JSON['stringify'](_0x46593f));if(_0x46593f['error']){if(_0x46593f[_0xb032('0xe')][_0xb032('0xf')]===0x1f4){logger[_0xb032('0xe')](_0xb032('0xa'),_0x19d67a,_0x46593f[_0xb032('0xe')]['message']);return _0x3c41bf(_0x46593f['error'][_0xb032('0x10')]);}logger[_0xb032('0xe')](_0xb032('0xa'),_0x19d67a,_0x46593f['error'][_0xb032('0x10')]);return _0x345d4f(_0x46593f[_0xb032('0xe')][_0xb032('0x10')]);}else{logger[_0xb032('0x9')](_0xb032('0xa'),_0x19d67a,_0xb032('0xb'));_0x345d4f(_0x46593f[_0xb032('0x11')][_0xb032('0x10')]);}})[_0xb032('0x12')](function(_0x394238){logger[_0xb032('0xe')](_0xb032('0xa'),_0x19d67a,_0x394238);_0x3c41bf(_0x394238);});});}exports['CreateCmHopperFinal']=function(_0x456cec){var _0x1a31e7=this;return new Promise(function(_0x5eaa19,_0x45685c){return db[_0xb032('0x13')]['create'](_0x456cec[_0xb032('0x14')],{'raw':_0x456cec[_0xb032('0x15')]?_0x456cec[_0xb032('0x15')][_0xb032('0x16')]===undefined?!![]:![]:!![]})[_0xb032('0x17')](function(_0xfcb15a){logger[_0xb032('0x9')](_0xb032('0x18'),_0x456cec);logger['debug'](_0xb032('0x18'),_0x456cec,JSON[_0xb032('0x19')](_0xfcb15a));_0x5eaa19(_0xfcb15a);})[_0xb032('0x12')](function(_0x32be95){logger[_0xb032('0xe')]('CreateCmHopperFinal',_0x32be95['message'],_0x456cec);_0x45685c(_0x1a31e7[_0xb032('0xe')](0x1f4,_0x32be95['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c1dc976..c09b2b7 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 _0x91cd=['/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x2c507b,_0x343d21){var _0x346f0d=function(_0x26c941){while(--_0x26c941){_0x2c507b['push'](_0x2c507b['shift']());}};_0x346f0d(++_0x343d21);}(_0x91cd,0x118));var _0xd91c=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x91cd[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0xd91c('0x0'));var util=require(_0xd91c('0x1'));var path=require(_0xd91c('0x2'));var timeout=require(_0xd91c('0x3'));var express=require(_0xd91c('0x4'));var router=express[_0xd91c('0x5')]();var auth=require(_0xd91c('0x6'));var interaction=require(_0xd91c('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xd91c('0x8')]('/',auth['isAuthenticated'](),controller[_0xd91c('0x9')]);router[_0xd91c('0x8')](_0xd91c('0xa'),auth[_0xd91c('0xb')](),controller[_0xd91c('0xc')]);router['get']('/:id',auth[_0xd91c('0xb')](),controller[_0xd91c('0xd')]);router['get'](_0xd91c('0xe'),auth['isAuthenticated'](),controller[_0xd91c('0xf')]);router[_0xd91c('0x8')]('/campaign/countAttributes/:id',auth[_0xd91c('0xb')](),controller[_0xd91c('0x10')]);router[_0xd91c('0x11')](_0xd91c('0x12'),auth[_0xd91c('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd91c('0x11')]('/voice/campaign/moveContacts/:id',auth[_0xd91c('0xb')](),controller[_0xd91c('0x13')]);router['post'](_0xd91c('0x14'),auth[_0xd91c('0xb')](),controller[_0xd91c('0x15')]);router[_0xd91c('0x16')]('/:id',auth[_0xd91c('0xb')](),controller[_0xd91c('0x17')]);module[_0xd91c('0x18')]=router; \ No newline at end of file +var _0x6f75=['../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x57d27c,_0x19ecb6){var _0xd09f9a=function(_0x2e2d94){while(--_0x2e2d94){_0x57d27c['push'](_0x57d27c['shift']());}};_0xd09f9a(++_0x19ecb6);}(_0x6f75,0x180));var _0x56f7=function(_0xcb0a94,_0x2af520){_0xcb0a94=_0xcb0a94-0x0;var _0x47a1f7=_0x6f75[_0xcb0a94];return _0x47a1f7;};'use strict';var multer=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var path=require(_0x56f7('0x2'));var timeout=require(_0x56f7('0x3'));var express=require(_0x56f7('0x4'));var router=express['Router']();var auth=require(_0x56f7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x56f7('0x6'));var controller=require(_0x56f7('0x7'));router[_0x56f7('0x8')]('/',auth[_0x56f7('0x9')](),controller[_0x56f7('0xa')]);router[_0x56f7('0x8')](_0x56f7('0xb'),auth[_0x56f7('0x9')](),controller['describe']);router[_0x56f7('0x8')](_0x56f7('0xc'),auth[_0x56f7('0x9')](),controller['show']);router['get'](_0x56f7('0xd'),auth['isAuthenticated'](),controller[_0x56f7('0xe')]);router[_0x56f7('0x8')](_0x56f7('0xf'),auth[_0x56f7('0x9')](),controller[_0x56f7('0x10')]);router[_0x56f7('0x11')](_0x56f7('0x12'),auth[_0x56f7('0x9')](),controller[_0x56f7('0x13')]);router['post'](_0x56f7('0x14'),auth['isAuthenticated'](),controller[_0x56f7('0x15')]);router[_0x56f7('0x11')](_0x56f7('0x16'),auth[_0x56f7('0x9')](),controller[_0x56f7('0x17')]);router[_0x56f7('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x56f7('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6a5c108..053a9ec 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 _0x6f27=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1649ed,_0x49d93e){var _0xdb17fe=function(_0x1cb3c6){while(--_0x1cb3c6){_0x1649ed['push'](_0x1649ed['shift']());}};_0xdb17fe(++_0x49d93e);}(_0x6f27,0x166));var _0x76f2=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x6f27[_0x43444b];return _0x392fe5;};'use strict';var Sequelize=require(_0x76f2('0x0'));module[_0x76f2('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x76f2('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x76f2('0x3')]},'originatecalleridname':{'type':Sequelize[_0x76f2('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f2('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x76f2('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76f2('0x4')]},'ringtime':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x76f2('0x3')]},'campaign':{'type':Sequelize[_0x76f2('0x3')]},'campaigntype':{'type':Sequelize[_0x76f2('0x3')]},'membername':{'type':Sequelize[_0x76f2('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x76f2('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x76f2('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x76f2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x76f2('0x4')]},'recallme':{'type':Sequelize[_0x76f2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x76f2('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x76f2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x76f2('0x3')]}}; \ No newline at end of file +var _0xe2bc=['INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x1648a6,_0x38e0f3){var _0x161a07=function(_0x44f7ac){while(--_0x44f7ac){_0x1648a6['push'](_0x1648a6['shift']());}};_0x161a07(++_0x38e0f3);}(_0xe2bc,0xf9));var _0xce2b=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xe2bc[_0xe73080];return _0x12cbc4;};'use strict';var Sequelize=require(_0xce2b('0x0'));module['exports']={'state':{'type':Sequelize[_0xce2b('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xce2b('0x2')]},'countbusyretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xce2b('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xce2b('0x3')]},'calleridname':{'type':Sequelize[_0xce2b('0x3')]},'starttime':{'type':Sequelize[_0xce2b('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xce2b('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xce2b('0x2')]},'ringtime':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xce2b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xce2b('0x3')]},'reason':{'type':Sequelize[_0xce2b('0x3')]},'amd':{'type':Sequelize[_0xce2b('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xce2b('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xce2b('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xce2b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xce2b('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xce2b('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xce2b('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xce2b('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 6f34324..792983f 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 _0x01c6=['map','CmHopperHistory','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','count','includeAll','include','findAll','catch','params','length','find','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','offset','set','Content-Range','apply','reject','update','then','stack','send','index'];(function(_0x13993e,_0x3edd98){var _0x39879a=function(_0x47b730){while(--_0x47b730){_0x13993e['push'](_0x13993e['shift']());}};_0x39879a(++_0x3edd98);}(_0x01c6,0x191));var _0x601c=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x01c6[_0x15bc81];return _0x59440e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x601c('0x0'));var rimraf=require(_0x601c('0x1'));var zipdir=require(_0x601c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x601c('0x3'));var moment=require(_0x601c('0x4'));var BPromise=require(_0x601c('0x5'));var Mustache=require(_0x601c('0x6'));var util=require(_0x601c('0x7'));var path=require('path');var sox=require(_0x601c('0x8'));var csv=require(_0x601c('0x9'));var ejs=require(_0x601c('0xa'));var fs=require('fs');var _=require(_0x601c('0xb'));var squel=require('squel');var crypto=require(_0x601c('0xc'));var jsforce=require(_0x601c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x601c('0x9'));var querystring=require(_0x601c('0xe'));var Papa=require(_0x601c('0xf'));var Redis=require(_0x601c('0x10'));var authService=require(_0x601c('0x11'));var qs=require(_0x601c('0x12'));var as=require(_0x601c('0x13'));var hardwareService=require(_0x601c('0x14'));var logger=require(_0x601c('0x15'))(_0x601c('0x16'));var utils=require('../../config/utils');var config=require(_0x601c('0x17'));var db=require(_0x601c('0x18'))['db'];function respondWithStatusCode(_0x2c11b8,_0x56652f){_0x56652f=_0x56652f||0xcc;return function(_0x3a0468){if(_0x3a0468){return _0x2c11b8[_0x601c('0x19')](_0x56652f);}return _0x2c11b8[_0x601c('0x1a')](_0x56652f)['end']();};}function respondWithResult(_0x441927,_0x502dc5){_0x502dc5=_0x502dc5||0xc8;return function(_0x5c5919){if(_0x5c5919){return _0x441927['status'](_0x502dc5)['json'](_0x5c5919);}};}function respondWithFilteredResult(_0x5242aa,_0x9690b3){return function(_0x429327){if(_0x429327){var _0x122ceb=_0x429327['count'],_0x5e2eef=_0x9690b3[_0x601c('0x1b')],_0x2ac54a=_0x9690b3[_0x601c('0x1b')]+_0x9690b3['limit'],_0x1b6b8f;if(_0x2ac54a>=_0x122ceb){_0x2ac54a=_0x122ceb;_0x1b6b8f=0xc8;}else{_0x1b6b8f=0xce;}_0x5242aa['status'](_0x1b6b8f);return _0x5242aa[_0x601c('0x1c')](_0x601c('0x1d'),_0x5e2eef+'-'+_0x2ac54a+'/'+_0x122ceb)['json'](_0x429327);}return null;};}function patchUpdates(_0x2b03ce){return function(_0x17bbdd){try{jsonpatch[_0x601c('0x1e')](_0x17bbdd,_0x2b03ce,!![]);}catch(_0x2ebeb3){return BPromise[_0x601c('0x1f')](_0x2ebeb3);}return _0x17bbdd['save']();};}function saveUpdates(_0x5e9197,_0x50036c){return function(_0x4d4d88){if(_0x4d4d88){return _0x4d4d88[_0x601c('0x20')](_0x5e9197)[_0x601c('0x21')](function(_0x455029){return _0x455029;});}return null;};}function removeEntity(_0x224d9d,_0x5c52f5){return function(_0x19d49d){if(_0x19d49d){return _0x19d49d['destroy']()[_0x601c('0x21')](function(){_0x224d9d[_0x601c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x555eb3,_0x3a1571){return function(_0x5d1341){if(!_0x5d1341){_0x555eb3['sendStatus'](0x194);}return _0x5d1341;};}function handleError(_0x57aa42,_0x31636e){_0x31636e=_0x31636e||0x1f4;return function(_0x46bd67){logger['error'](_0x46bd67[_0x601c('0x22')]);if(_0x46bd67['name']){delete _0x46bd67['name'];}_0x57aa42[_0x601c('0x1a')](_0x31636e)[_0x601c('0x23')](_0x46bd67);};}exports[_0x601c('0x24')]=function(_0x3924ad,_0x4118ae){var _0x14104e={},_0x1b0339={},_0x2f9ba1={'count':0x0,'rows':[]};var _0x4a0cea=_[_0x601c('0x25')](db[_0x601c('0x26')][_0x601c('0x27')],function(_0x4d472c){return{'name':_0x4d472c[_0x601c('0x28')],'type':_0x4d472c[_0x601c('0x29')]['key']};});_0x1b0339[_0x601c('0x2a')]=_['map'](_0x4a0cea,'name');_0x1b0339['query']=_[_0x601c('0x2b')](_0x3924ad[_0x601c('0x2c')]);_0x1b0339[_0x601c('0x2d')]=_[_0x601c('0x2e')](_0x1b0339[_0x601c('0x2a')],_0x1b0339[_0x601c('0x2c')]);_0x14104e[_0x601c('0x2f')]=_[_0x601c('0x2e')](_0x1b0339[_0x601c('0x2a')],qs['fields'](_0x3924ad[_0x601c('0x2c')][_0x601c('0x30')]));_0x14104e[_0x601c('0x2f')]=_0x14104e[_0x601c('0x2f')]['length']?_0x14104e[_0x601c('0x2f')]:_0x1b0339[_0x601c('0x2a')];if(!_0x3924ad['query'][_0x601c('0x31')](_0x601c('0x32'))){_0x14104e[_0x601c('0x33')]=qs[_0x601c('0x33')](_0x3924ad[_0x601c('0x2c')]['limit']);_0x14104e[_0x601c('0x1b')]=qs[_0x601c('0x1b')](_0x3924ad[_0x601c('0x2c')][_0x601c('0x1b')]);}_0x14104e[_0x601c('0x34')]=qs[_0x601c('0x35')](_0x3924ad[_0x601c('0x2c')][_0x601c('0x35')]);_0x14104e[_0x601c('0x36')]=qs[_0x601c('0x2d')](_[_0x601c('0x37')](_0x3924ad[_0x601c('0x2c')],_0x1b0339[_0x601c('0x2d')]),_0x4a0cea);if(_0x3924ad['query']['filter']){_0x14104e[_0x601c('0x36')]=_[_0x601c('0x38')](_0x14104e[_0x601c('0x36')],{'$or':_['map'](_0x4a0cea,function(_0x19f866){if(_0x19f866[_0x601c('0x29')]!==_0x601c('0x39')){var _0x39c650={};_0x39c650[_0x19f866[_0x601c('0x3a')]]={'$like':'%'+_0x3924ad[_0x601c('0x2c')][_0x601c('0x3b')]+'%'};return _0x39c650;}})});}_0x14104e=_[_0x601c('0x38')]({},_0x14104e,_0x3924ad[_0x601c('0x3c')]);var _0x3d36a2={'where':_0x14104e[_0x601c('0x36')]};return db[_0x601c('0x26')][_0x601c('0x3d')](_0x3d36a2)[_0x601c('0x21')](function(_0x1395d6){_0x2f9ba1[_0x601c('0x3d')]=_0x1395d6;if(_0x3924ad[_0x601c('0x2c')][_0x601c('0x3e')]){_0x14104e[_0x601c('0x3f')]=[{'all':!![]}];}return db[_0x601c('0x26')][_0x601c('0x40')](_0x14104e);})[_0x601c('0x21')](function(_0x249f6a){_0x2f9ba1['rows']=_0x249f6a;return _0x2f9ba1;})[_0x601c('0x21')](respondWithFilteredResult(_0x4118ae,_0x14104e))[_0x601c('0x41')](handleError(_0x4118ae,null));};exports['show']=function(_0x5030d3,_0xf2f991){var _0x593612={'raw':!![],'where':{'id':_0x5030d3[_0x601c('0x42')]['id']}},_0x3bddef={};_0x3bddef[_0x601c('0x2a')]=_['keys'](db[_0x601c('0x26')][_0x601c('0x27')]);_0x3bddef['query']=_['keys'](_0x5030d3[_0x601c('0x2c')]);_0x3bddef[_0x601c('0x2d')]=_['intersection'](_0x3bddef[_0x601c('0x2a')],_0x3bddef['query']);_0x593612['attributes']=_[_0x601c('0x2e')](_0x3bddef[_0x601c('0x2a')],qs[_0x601c('0x30')](_0x5030d3[_0x601c('0x2c')]['fields']));_0x593612[_0x601c('0x2f')]=_0x593612[_0x601c('0x2f')][_0x601c('0x43')]?_0x593612['attributes']:_0x3bddef['model'];if(_0x5030d3[_0x601c('0x2c')][_0x601c('0x3e')]){_0x593612[_0x601c('0x3f')]=[{'all':!![]}];}_0x593612=_['merge']({},_0x593612,_0x5030d3['options']);return db['CmHopperHistory'][_0x601c('0x44')](_0x593612)[_0x601c('0x21')](handleEntityNotFound(_0xf2f991,null))[_0x601c('0x21')](respondWithResult(_0xf2f991,null))[_0x601c('0x41')](handleError(_0xf2f991,null));};exports[_0x601c('0x45')]=function(_0x18e47f,_0x2a348b){return db[_0x601c('0x26')][_0x601c('0x45')](_0x18e47f['body'],{})[_0x601c('0x21')](respondWithResult(_0x2a348b,0xc9))[_0x601c('0x41')](handleError(_0x2a348b,null));};exports['describe']=function(_0x2bc9bf,_0x18e3c7){return db[_0x601c('0x26')][_0x601c('0x46')]()[_0x601c('0x21')](respondWithResult(_0x18e3c7,null))[_0x601c('0x41')](handleError(_0x18e3c7,null));};exports['update']=function(_0x4028d2,_0x50779e){if(_0x4028d2[_0x601c('0x47')][_0x601c('0x48')]){delete _0x4028d2['body'][_0x601c('0x48')];}return db['CmHopperHistory'][_0x601c('0x44')]({'where':{'uniqueid':_0x4028d2[_0x601c('0x42')]['id']}})['then'](handleEntityNotFound(_0x50779e,null))[_0x601c('0x21')](saveUpdates(_0x4028d2[_0x601c('0x47')],null))[_0x601c('0x21')](respondWithResult(_0x50779e,null))[_0x601c('0x41')](handleError(_0x50779e,null));}; \ No newline at end of file +var _0x2f87=['includeAll','rows','catch','show','params','include','find','create','body','describe','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','options'];(function(_0x245dbe,_0x3e0831){var _0x597415=function(_0x50dfdd){while(--_0x50dfdd){_0x245dbe['push'](_0x245dbe['shift']());}};_0x597415(++_0x3e0831);}(_0x2f87,0xf5));var _0x72f8=function(_0x419fe3,_0x3fec64){_0x419fe3=_0x419fe3-0x0;var _0x49b3c8=_0x2f87[_0x419fe3];return _0x49b3c8;};'use strict';var pdf=require(_0x72f8('0x0'));var emlformat=require(_0x72f8('0x1'));var rimraf=require(_0x72f8('0x2'));var zipdir=require(_0x72f8('0x3'));var jsonpatch=require(_0x72f8('0x4'));var rp=require(_0x72f8('0x5'));var moment=require(_0x72f8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x72f8('0x7'));var util=require('util');var path=require(_0x72f8('0x8'));var sox=require(_0x72f8('0x9'));var csv=require(_0x72f8('0xa'));var ejs=require(_0x72f8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x72f8('0xc'));var crypto=require(_0x72f8('0xd'));var jsforce=require(_0x72f8('0xe'));var deskjs=require(_0x72f8('0xf'));var toCsv=require(_0x72f8('0xa'));var querystring=require(_0x72f8('0x10'));var Papa=require(_0x72f8('0x11'));var Redis=require(_0x72f8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x72f8('0x13'));var as=require(_0x72f8('0x14'));var hardwareService=require(_0x72f8('0x15'));var logger=require(_0x72f8('0x16'))(_0x72f8('0x17'));var utils=require(_0x72f8('0x18'));var config=require(_0x72f8('0x19'));var db=require(_0x72f8('0x1a'))['db'];function respondWithStatusCode(_0xfa9d1a,_0x37265f){_0x37265f=_0x37265f||0xcc;return function(_0x370b32){if(_0x370b32){return _0xfa9d1a[_0x72f8('0x1b')](_0x37265f);}return _0xfa9d1a[_0x72f8('0x1c')](_0x37265f)['end']();};}function respondWithResult(_0x138ecd,_0x5ea1a4){_0x5ea1a4=_0x5ea1a4||0xc8;return function(_0x102410){if(_0x102410){return _0x138ecd[_0x72f8('0x1c')](_0x5ea1a4)[_0x72f8('0x1d')](_0x102410);}};}function respondWithFilteredResult(_0x43d2e0,_0x279d57){return function(_0x8c4ad9){if(_0x8c4ad9){var _0xd0f601=_0x8c4ad9[_0x72f8('0x1e')],_0x43daaf=_0x279d57['offset'],_0x1f824f=_0x279d57[_0x72f8('0x1f')]+_0x279d57[_0x72f8('0x20')],_0x4ef15a;if(_0x1f824f>=_0xd0f601){_0x1f824f=_0xd0f601;_0x4ef15a=0xc8;}else{_0x4ef15a=0xce;}_0x43d2e0[_0x72f8('0x1c')](_0x4ef15a);return _0x43d2e0['set'](_0x72f8('0x21'),_0x43daaf+'-'+_0x1f824f+'/'+_0xd0f601)[_0x72f8('0x1d')](_0x8c4ad9);}return null;};}function patchUpdates(_0x196d79){return function(_0x419f18){try{jsonpatch[_0x72f8('0x22')](_0x419f18,_0x196d79,!![]);}catch(_0x50b92e){return BPromise[_0x72f8('0x23')](_0x50b92e);}return _0x419f18[_0x72f8('0x24')]();};}function saveUpdates(_0x56656a,_0x13b224){return function(_0x43ac0d){if(_0x43ac0d){return _0x43ac0d[_0x72f8('0x25')](_0x56656a)[_0x72f8('0x26')](function(_0x5687aa){return _0x5687aa;});}return null;};}function removeEntity(_0x18a9c1,_0x1f9014){return function(_0xba8213){if(_0xba8213){return _0xba8213[_0x72f8('0x27')]()[_0x72f8('0x26')](function(){_0x18a9c1[_0x72f8('0x1c')](0xcc)[_0x72f8('0x28')]();});}};}function handleEntityNotFound(_0x332419,_0xb9b3a5){return function(_0x33e69a){if(!_0x33e69a){_0x332419[_0x72f8('0x1b')](0x194);}return _0x33e69a;};}function handleError(_0x345dd5,_0x4c0aa6){_0x4c0aa6=_0x4c0aa6||0x1f4;return function(_0x4a86a9){logger[_0x72f8('0x29')](_0x4a86a9[_0x72f8('0x2a')]);if(_0x4a86a9[_0x72f8('0x2b')]){delete _0x4a86a9[_0x72f8('0x2b')];}_0x345dd5[_0x72f8('0x1c')](_0x4c0aa6)[_0x72f8('0x2c')](_0x4a86a9);};}exports[_0x72f8('0x2d')]=function(_0x1a9224,_0xee4f2b){var _0x347312={},_0xa1856b={},_0x49b174={'count':0x0,'rows':[]};var _0x2e0d60=_[_0x72f8('0x2e')](db[_0x72f8('0x2f')][_0x72f8('0x30')],function(_0x6f6043){return{'name':_0x6f6043[_0x72f8('0x31')],'type':_0x6f6043[_0x72f8('0x32')][_0x72f8('0x33')]};});_0xa1856b[_0x72f8('0x34')]=_[_0x72f8('0x2e')](_0x2e0d60,_0x72f8('0x2b'));_0xa1856b[_0x72f8('0x35')]=_[_0x72f8('0x36')](_0x1a9224[_0x72f8('0x35')]);_0xa1856b[_0x72f8('0x37')]=_['intersection'](_0xa1856b[_0x72f8('0x34')],_0xa1856b[_0x72f8('0x35')]);_0x347312[_0x72f8('0x38')]=_[_0x72f8('0x39')](_0xa1856b[_0x72f8('0x34')],qs[_0x72f8('0x3a')](_0x1a9224[_0x72f8('0x35')][_0x72f8('0x3a')]));_0x347312['attributes']=_0x347312[_0x72f8('0x38')][_0x72f8('0x3b')]?_0x347312[_0x72f8('0x38')]:_0xa1856b['model'];if(!_0x1a9224['query']['hasOwnProperty'](_0x72f8('0x3c'))){_0x347312['limit']=qs[_0x72f8('0x20')](_0x1a9224[_0x72f8('0x35')][_0x72f8('0x20')]);_0x347312['offset']=qs[_0x72f8('0x1f')](_0x1a9224[_0x72f8('0x35')]['offset']);}_0x347312[_0x72f8('0x3d')]=qs[_0x72f8('0x3e')](_0x1a9224['query'][_0x72f8('0x3e')]);_0x347312[_0x72f8('0x3f')]=qs['filters'](_['pick'](_0x1a9224['query'],_0xa1856b['filters']),_0x2e0d60);if(_0x1a9224['query'][_0x72f8('0x40')]){_0x347312[_0x72f8('0x3f')]=_[_0x72f8('0x41')](_0x347312[_0x72f8('0x3f')],{'$or':_[_0x72f8('0x2e')](_0x2e0d60,function(_0x24f0a8){if(_0x24f0a8[_0x72f8('0x32')]!=='VIRTUAL'){var _0x30a34a={};_0x30a34a[_0x24f0a8['name']]={'$like':'%'+_0x1a9224[_0x72f8('0x35')][_0x72f8('0x40')]+'%'};return _0x30a34a;}})});}_0x347312=_['merge']({},_0x347312,_0x1a9224[_0x72f8('0x42')]);var _0x288419={'where':_0x347312[_0x72f8('0x3f')]};return db[_0x72f8('0x2f')][_0x72f8('0x1e')](_0x288419)[_0x72f8('0x26')](function(_0x45d0d7){_0x49b174['count']=_0x45d0d7;if(_0x1a9224[_0x72f8('0x35')][_0x72f8('0x43')]){_0x347312['include']=[{'all':!![]}];}return db[_0x72f8('0x2f')]['findAll'](_0x347312);})[_0x72f8('0x26')](function(_0x5c0989){_0x49b174[_0x72f8('0x44')]=_0x5c0989;return _0x49b174;})['then'](respondWithFilteredResult(_0xee4f2b,_0x347312))[_0x72f8('0x45')](handleError(_0xee4f2b,null));};exports[_0x72f8('0x46')]=function(_0x57980b,_0x55ecdb){var _0x221b77={'raw':!![],'where':{'id':_0x57980b[_0x72f8('0x47')]['id']}},_0x3ca8d9={};_0x3ca8d9['model']=_[_0x72f8('0x36')](db[_0x72f8('0x2f')][_0x72f8('0x30')]);_0x3ca8d9[_0x72f8('0x35')]=_[_0x72f8('0x36')](_0x57980b[_0x72f8('0x35')]);_0x3ca8d9[_0x72f8('0x37')]=_['intersection'](_0x3ca8d9['model'],_0x3ca8d9[_0x72f8('0x35')]);_0x221b77[_0x72f8('0x38')]=_[_0x72f8('0x39')](_0x3ca8d9[_0x72f8('0x34')],qs[_0x72f8('0x3a')](_0x57980b[_0x72f8('0x35')][_0x72f8('0x3a')]));_0x221b77[_0x72f8('0x38')]=_0x221b77['attributes'][_0x72f8('0x3b')]?_0x221b77['attributes']:_0x3ca8d9[_0x72f8('0x34')];if(_0x57980b['query'][_0x72f8('0x43')]){_0x221b77[_0x72f8('0x48')]=[{'all':!![]}];}_0x221b77=_[_0x72f8('0x41')]({},_0x221b77,_0x57980b['options']);return db[_0x72f8('0x2f')][_0x72f8('0x49')](_0x221b77)[_0x72f8('0x26')](handleEntityNotFound(_0x55ecdb,null))[_0x72f8('0x26')](respondWithResult(_0x55ecdb,null))[_0x72f8('0x45')](handleError(_0x55ecdb,null));};exports[_0x72f8('0x4a')]=function(_0xdacb94,_0x1533f4){return db[_0x72f8('0x2f')][_0x72f8('0x4a')](_0xdacb94[_0x72f8('0x4b')],{})['then'](respondWithResult(_0x1533f4,0xc9))[_0x72f8('0x45')](handleError(_0x1533f4,null));};exports[_0x72f8('0x4c')]=function(_0x4f9bea,_0x409879){return db['CmHopperHistory'][_0x72f8('0x4c')]()['then'](respondWithResult(_0x409879,null))[_0x72f8('0x45')](handleError(_0x409879,null));};exports['update']=function(_0x4a9730,_0x552476){if(_0x4a9730[_0x72f8('0x4b')]['uniqueid']){delete _0x4a9730['body'][_0x72f8('0x4d')];}return db[_0x72f8('0x2f')]['find']({'where':{'uniqueid':_0x4a9730[_0x72f8('0x47')]['id']}})[_0x72f8('0x26')](handleEntityNotFound(_0x552476,null))[_0x72f8('0x26')](saveUpdates(_0x4a9730[_0x72f8('0x4b')],null))[_0x72f8('0x26')](respondWithResult(_0x552476,null))['catch'](handleError(_0x552476,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 8ea6999..5275353 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 _0xe643=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0xe822b4,_0x4208f1){var _0x209043=function(_0x350d9b){while(--_0x350d9b){_0xe822b4['push'](_0xe822b4['shift']());}};_0x209043(++_0x4208f1);}(_0xe643,0x1ce));var _0x3e64=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe643[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x3e64('0x0'));var util=require(_0x3e64('0x1'));var logger=require(_0x3e64('0x2'))('api');var moment=require(_0x3e64('0x3'));var BPromise=require(_0x3e64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e64('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e64('0x6'));module[_0x3e64('0x7')]=function(_0x1572d7,_0x99833){return _0x1572d7[_0x3e64('0x8')](_0x3e64('0x9'),attributes,{'tableName':_0x3e64('0xa'),'paranoid':![],'indexes':[{'name':_0x3e64('0xb'),'fields':[_0x3e64('0xb')]},{'name':_0x3e64('0xc'),'fields':[_0x3e64('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x607f=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','endtime','uniqueid'];(function(_0x3b912a,_0x210f61){var _0x13113b=function(_0x5a6c86){while(--_0x5a6c86){_0x3b912a['push'](_0x3b912a['shift']());}};_0x13113b(++_0x210f61);}(_0x607f,0x1e1));var _0xf607=function(_0x228b7b,_0x22258e){_0x228b7b=_0x228b7b-0x0;var _0x140f5a=_0x607f[_0x228b7b];return _0x140f5a;};'use strict';var _=require(_0xf607('0x0'));var util=require(_0xf607('0x1'));var logger=require(_0xf607('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf607('0x3'));var rp=require(_0xf607('0x4'));var fs=require('fs');var path=require(_0xf607('0x5'));var rimraf=require(_0xf607('0x6'));var config=require(_0xf607('0x7'));var attributes=require(_0xf607('0x8'));module[_0xf607('0x9')]=function(_0x1e07c2,_0x1ed23e){return _0x1e07c2[_0xf607('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xf607('0xb'),'fields':[_0xf607('0xb')]},{'name':_0xf607('0xc'),'fields':[_0xf607('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index a9c208e..af9a3b1 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 _0xbdb7=['`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','`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','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0xbdb7[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['create'](_0x5723f4[_0x7bdb('0x17')],{'raw':_0x5723f4[_0x7bdb('0x18')]?_0x5723f4[_0x7bdb('0x18')][_0x7bdb('0x19')]===undefined?!![]:![]:!![]})[_0x7bdb('0x1a')](function(_0x5bfc35){logger['info'](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')]('CreateCmHopperHistory',_0x5723f4,JSON[_0x7bdb('0x10')](_0x5bfc35));_0x4ffd4b(_0x5bfc35);})[_0x7bdb('0x14')](function(_0x346c72){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0x346c72['message'],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0x346c72[_0x7bdb('0x12')]));});});};exports[_0x7bdb('0x1b')]=function(_0x3a456f){var _0x481f4b=this;return new Promise(function(_0x4d6e44,_0x3c423f){return db['CmHopperHistory']['findAll']({'raw':_0x3a456f['options']?_0x3a456f[_0x7bdb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3a456f[_0x7bdb('0x18')]?_0x3a456f[_0x7bdb('0x18')][_0x7bdb('0x1c')]||null:null,'attributes':[[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize'][_0x7bdb('0x1f')]('id')),_0x7bdb('0x20')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x22')))),_0x7bdb('0x23')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x24')))),_0x7bdb('0x25')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x26')))),_0x7bdb('0x27')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x29'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x7bdb('0x1a')](function(_0x5611f5){logger[_0x7bdb('0xb')]('AvgHandleTime',_0x3a456f);logger['debug'](_0x7bdb('0x1b'),_0x3a456f,JSON[_0x7bdb('0x10')](_0x5611f5));_0x4d6e44(_0x5611f5);})[_0x7bdb('0x14')](function(_0x62e562){logger[_0x7bdb('0x11')](_0x7bdb('0x1b'),_0x62e562['message'],_0x3a456f);_0x3c423f(_0x481f4b[_0x7bdb('0x11')](0x1f4,_0x62e562[_0x7bdb('0x12')]));});});};exports[_0x7bdb('0x2a')]=function(_0x3d1537){var _0x26de16=this;return new Promise(function(_0x14c522,_0x228340){return db[_0x7bdb('0x16')][_0x7bdb('0x2b')]({'raw':_0x3d1537['options']?_0x3d1537['options'][_0x7bdb('0x19')]===undefined?!![]:![]:!![],'where':_0x3d1537[_0x7bdb('0x18')]?_0x3d1537[_0x7bdb('0x18')][_0x7bdb('0x1c')]||null:null,'attributes':[[_0x7bdb('0x2c'),'name'],[db['sequelize']['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x2d')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x2e')))),_0x7bdb('0x2f')],[db[_0x7bdb('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x22')))),_0x7bdb('0x30')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x31')))),_0x7bdb('0x32')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x33')))),_0x7bdb('0x34')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x35')))),_0x7bdb('0x36')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7bdb('0x37')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')]['literal'](_0x7bdb('0x38')))),_0x7bdb('0x39')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x3a')))),_0x7bdb('0x3b')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x3c')))),_0x7bdb('0x3d')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x3e')))),'outboundRejectCallsDay'],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x3f')))),_0x7bdb('0x40')],[db[_0x7bdb('0x1d')]['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db[_0x7bdb('0x1d')][_0x7bdb('0x21')](_0x7bdb('0x41')))),_0x7bdb('0x42')],[db[_0x7bdb('0x1d')]['fn']('COUNT',db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize'][_0x7bdb('0x21')](_0x7bdb('0x43')))),_0x7bdb('0x44')]],'group':[_0x7bdb('0x2c')]})['then'](function(_0x258f29){logger['info']('GetVoiceQueueHopperHistory',_0x3d1537);logger[_0x7bdb('0xe')](_0x7bdb('0x2a'),_0x3d1537,JSON['stringify'](_0x258f29));_0x14c522(_0x258f29);})['catch'](function(_0x49bb3f){logger[_0x7bdb('0x11')]('GetVoiceQueueHopperHistory',_0x49bb3f['message'],_0x3d1537);_0x228340(_0x26de16[_0x7bdb('0x11')](0x1f4,_0x49bb3f[_0x7bdb('0x12')]));});});};exports[_0x7bdb('0x45')]=function(_0x148280){var _0x49c313=this;return new Promise(function(_0x1d444c,_0x4c5c8c){return db[_0x7bdb('0x16')][_0x7bdb('0x2b')]({'raw':_0x148280[_0x7bdb('0x18')]?_0x148280[_0x7bdb('0x18')][_0x7bdb('0x19')]===undefined?!![]:![]:!![],'where':_0x148280[_0x7bdb('0x18')]?_0x148280['options'][_0x7bdb('0x1c')]||null:null,'attributes':[[_0x7bdb('0x2c'),_0x7bdb('0x46')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['col']('id')),_0x7bdb('0x47')],[db['sequelize']['fn'](_0x7bdb('0x1e'),db[_0x7bdb('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x7bdb('0x22')))),_0x7bdb('0x48')]],'group':['campaign']})[_0x7bdb('0x1a')](function(_0x567993){logger[_0x7bdb('0xb')]('GetCampaignHopperHistory',_0x148280);logger['debug'](_0x7bdb('0x45'),_0x148280,JSON[_0x7bdb('0x10')](_0x567993));_0x1d444c(_0x567993);})[_0x7bdb('0x14')](function(_0x26f1f5){logger[_0x7bdb('0x11')](_0x7bdb('0x45'),_0x26f1f5[_0x7bdb('0x12')],_0x148280);_0x4c5c8c(_0x49c313[_0x7bdb('0x11')](0x1f4,_0x26f1f5[_0x7bdb('0x12')]));});});}; \ No newline at end of file +var _0xe5b5=['outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','findAll','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','AvgHandleTime','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null'];(function(_0x7954c7,_0x3ce522){var _0x22b1c4=function(_0x27d76b){while(--_0x27d76b){_0x7954c7['push'](_0x7954c7['shift']());}};_0x22b1c4(++_0x3ce522);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0xe5b5[_0x3df223];return _0x562d11;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});}exports[_0x5e5b('0x19')]=function(_0x45a091){var _0x4c5f9a=this;return new Promise(function(_0xe5aa6b,_0x1560e1){return db[_0x5e5b('0x1a')]['create'](_0x45a091[_0x5e5b('0x1b')],{'raw':_0x45a091[_0x5e5b('0x1c')]?_0x45a091['options'][_0x5e5b('0x1d')]===undefined?!![]:![]:!![]})[_0x5e5b('0xf')](function(_0x3c488e){logger[_0x5e5b('0x10')](_0x5e5b('0x19'),_0x45a091);logger[_0x5e5b('0x1e')](_0x5e5b('0x19'),_0x45a091,JSON[_0x5e5b('0x13')](_0x3c488e));_0xe5aa6b(_0x3c488e);})['catch'](function(_0x512e46){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x512e46[_0x5e5b('0x16')],_0x45a091);_0x1560e1(_0x4c5f9a[_0x5e5b('0x14')](0x1f4,_0x512e46[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x1f')]=function(_0x135c6c){var _0x18903e=this;return new Promise(function(_0x161599,_0x26bc02){return db[_0x5e5b('0x1a')]['findAll']({'raw':_0x135c6c[_0x5e5b('0x1c')]?_0x135c6c[_0x5e5b('0x1c')][_0x5e5b('0x1d')]===undefined?!![]:![]:!![],'where':_0x135c6c['options']?_0x135c6c[_0x5e5b('0x1c')][_0x5e5b('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')][_0x5e5b('0x23')]('id')),_0x5e5b('0x24')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x26')))),_0x5e5b('0x27')],[db[_0x5e5b('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x28')))),_0x5e5b('0x29')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db['sequelize'][_0x5e5b('0x25')](_0x5e5b('0x2a')))),_0x5e5b('0x2b')],[db[_0x5e5b('0x22')]['fn']('AVG',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x2c')))),_0x5e5b('0x2d')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x2e'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x2f')))),'predictiveIntervalAvgTalktime']]})[_0x5e5b('0xf')](function(_0x37b5be){logger[_0x5e5b('0x10')](_0x5e5b('0x1f'),_0x135c6c);logger[_0x5e5b('0x1e')](_0x5e5b('0x1f'),_0x135c6c,JSON['stringify'](_0x37b5be));_0x161599(_0x37b5be);})['catch'](function(_0x1d6686){logger[_0x5e5b('0x14')](_0x5e5b('0x1f'),_0x1d6686['message'],_0x135c6c);_0x26bc02(_0x18903e[_0x5e5b('0x14')](0x1f4,_0x1d6686[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x30')]=function(_0x470b45){var _0x54320f=this;return new Promise(function(_0x5b3e0d,_0x44c6d2){return db['CmHopperHistory']['findAll']({'raw':_0x470b45[_0x5e5b('0x1c')]?_0x470b45[_0x5e5b('0x1c')][_0x5e5b('0x1d')]===undefined?!![]:![]:!![],'where':_0x470b45['options']?_0x470b45[_0x5e5b('0x1c')]['where']||null:null,'attributes':[['campaign',_0x5e5b('0x31')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x32')))),_0x5e5b('0x33')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x34')))),'outboundNoAnswerCallsDay'],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x26')))),_0x5e5b('0x35')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x36')))),_0x5e5b('0x37')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x38')))),_0x5e5b('0x39')],[db['sequelize']['fn'](_0x5e5b('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5e5b('0x3a')))),'outboundDropCallsDayTimeout'],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x3b')))),_0x5e5b('0x3c')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x5e5b('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x5e5b('0x21'),db['sequelize']['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x3d')))),_0x5e5b('0x3e')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db['sequelize']['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x5e5b('0x3f')],[db['sequelize']['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')]('`state`\x20=\x2018,\x201,\x20null'))),_0x5e5b('0x40')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')](_0x5e5b('0x41')))),_0x5e5b('0x42')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')]['literal'](_0x5e5b('0x43')))),_0x5e5b('0x40')],[db[_0x5e5b('0x22')]['fn']('COUNT',db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x5e5b('0x44')]],'group':[_0x5e5b('0x45')]})[_0x5e5b('0xf')](function(_0x4a4e0f){logger['info'](_0x5e5b('0x30'),_0x470b45);logger['debug']('GetVoiceQueueHopperHistory',_0x470b45,JSON[_0x5e5b('0x13')](_0x4a4e0f));_0x5b3e0d(_0x4a4e0f);})[_0x5e5b('0x18')](function(_0x4774ee){logger['error'](_0x5e5b('0x30'),_0x4774ee[_0x5e5b('0x16')],_0x470b45);_0x44c6d2(_0x54320f[_0x5e5b('0x14')](0x1f4,_0x4774ee[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x46')]=function(_0x15f7bb){var _0x51db8b=this;return new Promise(function(_0x5d25b4,_0x3c830d){return db[_0x5e5b('0x1a')][_0x5e5b('0x47')]({'raw':_0x15f7bb[_0x5e5b('0x1c')]?_0x15f7bb['options'][_0x5e5b('0x1d')]===undefined?!![]:![]:!![],'where':_0x15f7bb['options']?_0x15f7bb[_0x5e5b('0x1c')][_0x5e5b('0x20')]||null:null,'attributes':[[_0x5e5b('0x45'),_0x5e5b('0x31')],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')][_0x5e5b('0x23')]('id')),'ivrTotalCallsDays'],[db[_0x5e5b('0x22')]['fn'](_0x5e5b('0x21'),db[_0x5e5b('0x22')]['fn']('IF',db[_0x5e5b('0x22')][_0x5e5b('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x5e5b('0x48')]],'group':[_0x5e5b('0x45')]})[_0x5e5b('0xf')](function(_0x3fc9b5){logger[_0x5e5b('0x10')]('GetCampaignHopperHistory',_0x15f7bb);logger[_0x5e5b('0x1e')]('GetCampaignHopperHistory',_0x15f7bb,JSON[_0x5e5b('0x13')](_0x3fc9b5));_0x5d25b4(_0x3fc9b5);})['catch'](function(_0x3f4750){logger[_0x5e5b('0x14')](_0x5e5b('0x46'),_0x3f4750[_0x5e5b('0x16')],_0x15f7bb);_0x3c830d(_0x51db8b[_0x5e5b('0x14')](0x1f4,_0x3f4750[_0x5e5b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index d3d169a..0f14ac0 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 _0x4487=['isAuthenticated','/describe','show','post','create','put','/:id','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x4487,0xf2));var _0x7448=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x4487[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x7448('0x0'));var util=require('util');var path=require(_0x7448('0x1'));var timeout=require(_0x7448('0x2'));var express=require(_0x7448('0x3'));var router=express[_0x7448('0x4')]();var auth=require(_0x7448('0x5'));var interaction=require(_0x7448('0x6'));var config=require(_0x7448('0x7'));var controller=require(_0x7448('0x8'));router[_0x7448('0x9')]('/',auth[_0x7448('0xa')](),controller['index']);router[_0x7448('0x9')](_0x7448('0xb'),auth[_0x7448('0xa')](),controller['describe']);router[_0x7448('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7448('0xc')]);router[_0x7448('0xd')]('/',auth['isAuthenticated'](),controller[_0x7448('0xe')]);router[_0x7448('0xf')](_0x7448('0x10'),auth[_0x7448('0xa')](),controller['update']);module[_0x7448('0x11')]=router; \ No newline at end of file +var _0xd914=['get','index','/describe','isAuthenticated','describe','/:id','post','create','put','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x36a515,_0x53c8e9){var _0x265eaf=function(_0x95be61){while(--_0x95be61){_0x36a515['push'](_0x36a515['shift']());}};_0x265eaf(++_0x53c8e9);}(_0xd914,0x17f));var _0x4d91=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0xd914[_0x4d2993];return _0x427374;};'use strict';var multer=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var path=require('path');var timeout=require(_0x4d91('0x2'));var express=require(_0x4d91('0x3'));var router=express[_0x4d91('0x4')]();var auth=require(_0x4d91('0x5'));var interaction=require(_0x4d91('0x6'));var config=require(_0x4d91('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x4d91('0x8')]('/',auth['isAuthenticated'](),controller[_0x4d91('0x9')]);router[_0x4d91('0x8')](_0x4d91('0xa'),auth[_0x4d91('0xb')](),controller[_0x4d91('0xc')]);router[_0x4d91('0x8')](_0x4d91('0xd'),auth[_0x4d91('0xb')](),controller['show']);router[_0x4d91('0xe')]('/',auth[_0x4d91('0xb')](),controller[_0x4d91('0xf')]);router[_0x4d91('0x10')](_0x4d91('0xd'),auth[_0x4d91('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b222690..bddcb8a 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 _0x3176=['STRING','name','sequelize'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x3176,0xce));var _0x6317=function(_0x4390de,_0x57bbbc){_0x4390de=_0x4390de-0x0;var _0x3bdcea=_0x3176[_0x4390de];return _0x3bdcea;};'use strict';var Sequelize=require(_0x6317('0x0'));module['exports']={'name':{'type':Sequelize[_0x6317('0x1')],'unique':_0x6317('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6317('0x1')]},'dialPrefix':{'type':Sequelize[_0x6317('0x1')]}}; \ No newline at end of file +var _0x57fd=['STRING','name','exports'];(function(_0x47da69,_0x17bdd8){var _0x47218a=function(_0x9aa332){while(--_0x9aa332){_0x47da69['push'](_0x47da69['shift']());}};_0x47218a(++_0x17bdd8);}(_0x57fd,0x173));var _0xd57f=function(_0x1484df,_0x16cc4c){_0x1484df=_0x1484df-0x0;var _0x5d8a74=_0x57fd[_0x1484df];return _0x5d8a74;};'use strict';var Sequelize=require('sequelize');module[_0xd57f('0x0')]={'name':{'type':Sequelize[_0xd57f('0x1')],'unique':_0xd57f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd57f('0x1')]},'dialPrefix':{'type':Sequelize[_0xd57f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index e69c4b5..be18326 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 _0x9b28=['userCmList:remove','User','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','Lists','error','stack','send','map','CmList','rawAttributes','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','order','ListId','removeDispositions','ids','addContacts','tags','isArray','join','CmContact','omit','push','errors','message','Malformed\x20request\x20syntax','concat','CustomFields','format','hasOwnProperty','getContactsCsv','CmCustomField','cf_%d','getContacts','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents'];(function(_0x4cb7b9,_0x4f838f){var _0x2d1ceb=function(_0x4cc29e){while(--_0x4cc29e){_0x4cb7b9['push'](_0x4cb7b9['shift']());}};_0x2d1ceb(++_0x4f838f);}(_0x9b28,0x125));var _0x89b2=function(_0x225eb9,_0x3ee6d8){_0x225eb9=_0x225eb9-0x0;var _0x18a5b6=_0x9b28[_0x225eb9];return _0x18a5b6;};'use strict';var pdf=require(_0x89b2('0x0'));var emlformat=require(_0x89b2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x89b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89b2('0x3'));var moment=require(_0x89b2('0x4'));var BPromise=require(_0x89b2('0x5'));var Mustache=require(_0x89b2('0x6'));var util=require(_0x89b2('0x7'));var path=require(_0x89b2('0x8'));var sox=require(_0x89b2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x89b2('0xa'));var jsforce=require(_0x89b2('0xb'));var deskjs=require(_0x89b2('0xc'));var toCsv=require(_0x89b2('0xd'));var querystring=require(_0x89b2('0xe'));var Papa=require(_0x89b2('0xf'));var Redis=require(_0x89b2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x89b2('0x11'));var hardwareService=require(_0x89b2('0x12'));var logger=require(_0x89b2('0x13'))(_0x89b2('0x14'));var utils=require(_0x89b2('0x15'));var config=require(_0x89b2('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x89b2('0x17')](config[_0x89b2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x89b2('0x19'))(new Redis(config[_0x89b2('0x18')]));require(_0x89b2('0x1a'))[_0x89b2('0x1b')](socket);function respondWithStatusCode(_0x149dc2,_0x56e67c){_0x56e67c=_0x56e67c||0xcc;return function(_0x5ee500){if(_0x5ee500){return _0x149dc2[_0x89b2('0x1c')](_0x56e67c);}return _0x149dc2[_0x89b2('0x1d')](_0x56e67c)[_0x89b2('0x1e')]();};}function respondWithResult(_0x43c60f,_0xb8abc9){_0xb8abc9=_0xb8abc9||0xc8;return function(_0x400414){if(_0x400414){return _0x43c60f[_0x89b2('0x1d')](_0xb8abc9)[_0x89b2('0x1f')](_0x400414);}};}function respondWithFilteredResult(_0x18a4d9,_0x55f380){return function(_0x1bdf83){if(_0x1bdf83){var _0x5dac0f=_0x1bdf83[_0x89b2('0x20')],_0x47fc7f=_0x55f380[_0x89b2('0x21')],_0x528391=_0x55f380[_0x89b2('0x21')]+_0x55f380[_0x89b2('0x22')],_0xefa1f2;if(_0x528391>=_0x5dac0f){_0x528391=_0x5dac0f;_0xefa1f2=0xc8;}else{_0xefa1f2=0xce;}_0x18a4d9['status'](_0xefa1f2);return _0x18a4d9['set'](_0x89b2('0x23'),_0x47fc7f+'-'+_0x528391+'/'+_0x5dac0f)['json'](_0x1bdf83);}return null;};}function patchUpdates(_0x3be6a7){return function(_0x172cba){try{jsonpatch[_0x89b2('0x24')](_0x172cba,_0x3be6a7,!![]);}catch(_0x92f5ad){return BPromise[_0x89b2('0x25')](_0x92f5ad);}return _0x172cba[_0x89b2('0x26')]();};}function saveUpdates(_0x4f0565,_0x332403){return function(_0x18fb49){if(_0x18fb49){return _0x18fb49[_0x89b2('0x27')](_0x4f0565)[_0x89b2('0x28')](function(_0x225786){return _0x225786;});}return null;};}function removeEntity(_0x255902,_0x56c34e){return function(_0x26867b){if(_0x26867b){return _0x26867b[_0x89b2('0x29')]()[_0x89b2('0x28')](function(){var _0x2adf54=_0x26867b['get']({'plain':!![]});var _0x1c5517=_0x89b2('0x2a');return db['UserProfileResource'][_0x89b2('0x29')]({'where':{'type':_0x1c5517,'resourceId':_0x2adf54['id']}})[_0x89b2('0x28')](function(){return _0x26867b;});})[_0x89b2('0x28')](function(){_0x255902[_0x89b2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cdda0,_0x18e32e){return function(_0xafc63){if(!_0xafc63){_0x3cdda0['sendStatus'](0x194);}return _0xafc63;};}function handleError(_0x46f571,_0x4895d0){_0x4895d0=_0x4895d0||0x1f4;return function(_0x52d53f){logger[_0x89b2('0x2b')](_0x52d53f[_0x89b2('0x2c')]);if(_0x52d53f['name']){delete _0x52d53f['name'];}_0x46f571[_0x89b2('0x1d')](_0x4895d0)[_0x89b2('0x2d')](_0x52d53f);};}exports['index']=function(_0x592217,_0x42ea48){var _0x4624a1={},_0x4a7d59={},_0xdba074={'count':0x0,'rows':[]};var _0xa9d19d=_[_0x89b2('0x2e')](db[_0x89b2('0x2f')][_0x89b2('0x30')],function(_0x314be5){return{'name':_0x314be5['fieldName'],'type':_0x314be5[_0x89b2('0x31')][_0x89b2('0x32')]};});_0x4a7d59[_0x89b2('0x33')]=_[_0x89b2('0x2e')](_0xa9d19d,_0x89b2('0x34'));_0x4a7d59['query']=_[_0x89b2('0x35')](_0x592217[_0x89b2('0x36')]);_0x4a7d59[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x4a7d59['model'],_0x4a7d59[_0x89b2('0x36')]);_0x4624a1['attributes']=_['intersection'](_0x4a7d59[_0x89b2('0x33')],qs['fields'](_0x592217['query'][_0x89b2('0x39')]));_0x4624a1[_0x89b2('0x3a')]=_0x4624a1[_0x89b2('0x3a')][_0x89b2('0x3b')]?_0x4624a1[_0x89b2('0x3a')]:_0x4a7d59['model'];if(!_0x592217[_0x89b2('0x36')]['hasOwnProperty'](_0x89b2('0x3c'))){_0x4624a1[_0x89b2('0x22')]=qs['limit'](_0x592217[_0x89b2('0x36')]['limit']);_0x4624a1[_0x89b2('0x21')]=qs[_0x89b2('0x21')](_0x592217[_0x89b2('0x36')]['offset']);}_0x4624a1['order']=qs[_0x89b2('0x3d')](_0x592217[_0x89b2('0x36')][_0x89b2('0x3d')]);_0x4624a1[_0x89b2('0x3e')]=qs[_0x89b2('0x37')](_[_0x89b2('0x3f')](_0x592217['query'],_0x4a7d59[_0x89b2('0x37')]),_0xa9d19d);if(_0x592217[_0x89b2('0x36')][_0x89b2('0x40')]){_0x4624a1['where']=_[_0x89b2('0x41')](_0x4624a1[_0x89b2('0x3e')],{'$or':_[_0x89b2('0x2e')](_0xa9d19d,function(_0x21b32d){if(_0x21b32d[_0x89b2('0x31')]!==_0x89b2('0x42')){var _0x2fdb23={};_0x2fdb23[_0x21b32d[_0x89b2('0x34')]]={'$like':'%'+_0x592217[_0x89b2('0x36')][_0x89b2('0x40')]+'%'};return _0x2fdb23;}})});}_0x4624a1=_[_0x89b2('0x41')]({},_0x4624a1,_0x592217[_0x89b2('0x43')]);var _0x616f50={'where':_0x4624a1[_0x89b2('0x3e')]};return db[_0x89b2('0x2f')]['count'](_0x616f50)[_0x89b2('0x28')](function(_0x207611){_0xdba074[_0x89b2('0x20')]=_0x207611;if(_0x592217[_0x89b2('0x36')][_0x89b2('0x44')]){_0x4624a1[_0x89b2('0x45')]=[{'all':!![]}];}return db[_0x89b2('0x2f')][_0x89b2('0x46')](_0x4624a1);})['then'](function(_0x466bdf){_0xdba074[_0x89b2('0x47')]=_0x466bdf;return _0xdba074;})[_0x89b2('0x28')](respondWithFilteredResult(_0x42ea48,_0x4624a1))['catch'](handleError(_0x42ea48,null));};exports[_0x89b2('0x48')]=function(_0x56a862,_0x1b8928){var _0x53bc73={'raw':![],'where':{'id':_0x56a862['params']['id']}},_0x49dcb3={};_0x49dcb3[_0x89b2('0x33')]=_['keys'](db[_0x89b2('0x2f')][_0x89b2('0x30')]);_0x49dcb3[_0x89b2('0x36')]=_['keys'](_0x56a862['query']);_0x49dcb3[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x49dcb3[_0x89b2('0x33')],_0x49dcb3[_0x89b2('0x36')]);_0x53bc73[_0x89b2('0x3a')]=_['intersection'](_0x49dcb3[_0x89b2('0x33')],qs[_0x89b2('0x39')](_0x56a862[_0x89b2('0x36')][_0x89b2('0x39')]));_0x53bc73[_0x89b2('0x3a')]=_0x53bc73[_0x89b2('0x3a')][_0x89b2('0x3b')]?_0x53bc73[_0x89b2('0x3a')]:_0x49dcb3[_0x89b2('0x33')];if(_0x56a862[_0x89b2('0x36')][_0x89b2('0x44')]){_0x53bc73['include']=[{'all':!![]}];}_0x53bc73=_[_0x89b2('0x41')]({},_0x53bc73,_0x56a862[_0x89b2('0x43')]);return db['CmList']['find'](_0x53bc73)[_0x89b2('0x28')](handleEntityNotFound(_0x1b8928,null))[_0x89b2('0x28')](respondWithResult(_0x1b8928,null))[_0x89b2('0x49')](handleError(_0x1b8928,null));};exports[_0x89b2('0x4a')]=function(_0x2851f2,_0x473caa){return db['CmList'][_0x89b2('0x4a')](_0x2851f2[_0x89b2('0x4b')],{})['then'](function(_0x53bb05){var _0x254108=_0x2851f2['user'][_0x89b2('0x4c')]({'plain':!![]});if(!_0x254108)throw new Error(_0x89b2('0x4d'));if(_0x254108[_0x89b2('0x4e')]===_0x89b2('0x4f')){var _0xba7d06=_0x53bb05[_0x89b2('0x4c')]({'plain':!![]});var _0xe6b520=_0x89b2('0x2a');return db['UserProfileSection'][_0x89b2('0x50')]({'where':{'name':_0xe6b520,'userProfileId':_0x254108[_0x89b2('0x51')]},'raw':!![]})[_0x89b2('0x28')](function(_0x2058f6){if(_0x2058f6&&_0x2058f6[_0x89b2('0x52')]===0x0){return db[_0x89b2('0x53')][_0x89b2('0x4a')]({'name':_0xba7d06['name'],'resourceId':_0xba7d06['id'],'type':_0x2058f6[_0x89b2('0x34')],'sectionId':_0x2058f6['id']},{})[_0x89b2('0x28')](function(){return _0x53bb05;});}else{return _0x53bb05;}})[_0x89b2('0x49')](function(_0x27638a){logger[_0x89b2('0x2b')](_0x89b2('0x54'),_0x27638a);throw _0x27638a;});}return _0x53bb05;})[_0x89b2('0x28')](respondWithResult(_0x473caa,0xc9))[_0x89b2('0x49')](handleError(_0x473caa,null));};exports[_0x89b2('0x27')]=function(_0x5851f2,_0x5bd3fe){if(_0x5851f2['body']['id']){delete _0x5851f2[_0x89b2('0x4b')]['id'];}return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x5851f2[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x5bd3fe,null))[_0x89b2('0x28')](saveUpdates(_0x5851f2['body'],null))[_0x89b2('0x28')](respondWithResult(_0x5bd3fe,null))[_0x89b2('0x49')](handleError(_0x5bd3fe,null));};exports[_0x89b2('0x29')]=function(_0x5e51de,_0x3d266e){return db[_0x89b2('0x2f')]['find']({'where':{'id':_0x5e51de[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x3d266e,null))['then'](removeEntity(_0x3d266e,null))[_0x89b2('0x49')](handleError(_0x3d266e,null));};exports[_0x89b2('0x56')]=function(_0x30ca68,_0x5b2599){return db[_0x89b2('0x2f')][_0x89b2('0x56')]()[_0x89b2('0x28')](respondWithResult(_0x5b2599,null))['catch'](handleError(_0x5b2599,null));};exports[_0x89b2('0x57')]=function(_0x6111e8,_0x42a96c,_0x528efd){if(_0x6111e8[_0x89b2('0x4b')]['id']){delete _0x6111e8['body']['id'];}return db[_0x89b2('0x2f')]['find']({'where':{'id':_0x6111e8[_0x89b2('0x55')]['id']}})['then'](handleEntityNotFound(_0x42a96c,null))[_0x89b2('0x28')](function(_0x34078b){if(_0x34078b){_0x6111e8['body']['ListId']=_0x34078b['id'];return db[_0x89b2('0x58')][_0x89b2('0x4a')](_0x6111e8[_0x89b2('0x4b')]);}})[_0x89b2('0x28')](respondWithResult(_0x42a96c,null))[_0x89b2('0x49')](handleError(_0x42a96c,null));};exports[_0x89b2('0x59')]=function(_0x54d19e,_0x5b67cf,_0x3a10e9){var _0xafa889={'raw':![],'where':{}};var _0x5113bd={};var _0x5f2315={'count':0x0,'rows':[]};return db[_0x89b2('0x2f')][_0x89b2('0x5a')]({'where':{'id':_0x54d19e['params']['id']}})['then'](handleEntityNotFound(_0x5b67cf,null))[_0x89b2('0x28')](function(_0x19824c){if(_0x19824c){_0x5113bd[_0x89b2('0x33')]=_[_0x89b2('0x35')](db[_0x89b2('0x58')][_0x89b2('0x30')]);_0x5113bd[_0x89b2('0x36')]=_[_0x89b2('0x35')](_0x54d19e[_0x89b2('0x36')]);_0x5113bd[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x5113bd['model'],_0x5113bd[_0x89b2('0x36')]);_0xafa889['attributes']=_[_0x89b2('0x38')](_0x5113bd['model'],qs[_0x89b2('0x39')](_0x54d19e[_0x89b2('0x36')]['fields']));_0xafa889[_0x89b2('0x3a')]=_0xafa889[_0x89b2('0x3a')]['length']?_0xafa889['attributes']:_0x5113bd[_0x89b2('0x33')];if(!_0x54d19e['query']['hasOwnProperty']('nolimit')){_0xafa889['limit']=qs[_0x89b2('0x22')](_0x54d19e[_0x89b2('0x36')][_0x89b2('0x22')]);_0xafa889[_0x89b2('0x21')]=qs[_0x89b2('0x21')](_0x54d19e[_0x89b2('0x36')][_0x89b2('0x21')]);}_0xafa889[_0x89b2('0x5b')]=qs[_0x89b2('0x3d')](_0x54d19e[_0x89b2('0x36')][_0x89b2('0x3d')]);_0xafa889[_0x89b2('0x3e')]=qs[_0x89b2('0x37')](_[_0x89b2('0x3f')](_0x54d19e['query'],_0x5113bd[_0x89b2('0x37')]));_0xafa889[_0x89b2('0x3e')][_0x89b2('0x5c')]=_0x19824c['id'];if(_0x54d19e[_0x89b2('0x36')][_0x89b2('0x40')]){_0xafa889['where']=_[_0x89b2('0x41')](_0xafa889[_0x89b2('0x3e')],{'$or':_[_0x89b2('0x2e')](_0xafa889['attributes'],function(_0x7c2d6){var _0x2d1866={};_0x2d1866[_0x7c2d6]={'$like':'%'+_0x54d19e[_0x89b2('0x36')][_0x89b2('0x40')]+'%'};return _0x2d1866;})});}_0xafa889=_[_0x89b2('0x41')]({},_0xafa889,_0x54d19e[_0x89b2('0x43')]);return db['Disposition']['count']({'where':_0xafa889[_0x89b2('0x3e')]})[_0x89b2('0x28')](function(_0x1cd181){_0x5f2315[_0x89b2('0x20')]=_0x1cd181;if(_0x54d19e[_0x89b2('0x36')][_0x89b2('0x44')]){_0xafa889['include']=[{'all':!![]}];}return db[_0x89b2('0x58')]['findAll'](_0xafa889);})[_0x89b2('0x28')](function(_0x4d1c44){_0x5f2315[_0x89b2('0x47')]=_0x4d1c44;return _0x5f2315;});}})[_0x89b2('0x28')](respondWithFilteredResult(_0x5b67cf,_0xafa889))[_0x89b2('0x49')](handleError(_0x5b67cf,null));};exports[_0x89b2('0x5d')]=function(_0x2d31f8,_0x59e503,_0x361e45){return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x2d31f8['params']['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x59e503,null))['then'](function(_0x49b322){if(_0x49b322){return _0x49b322[_0x89b2('0x5d')](_0x2d31f8['query'][_0x89b2('0x5e')]);}})[_0x89b2('0x28')](respondWithStatusCode(_0x59e503,null))['catch'](handleError(_0x59e503,null));};exports[_0x89b2('0x5f')]=function(_0x29764f,_0x352288,_0x1e3d2c){return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x29764f['params']['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x352288,null))[_0x89b2('0x28')](function(_0x1ce813){if(_0x1ce813){var _0x409058=[];var _0x2a4d51={'success':[],'errors':[]};return db['CmContact'][_0x89b2('0x56')]()[_0x89b2('0x28')](function(_0x137494){if(_0x29764f['body'][_0x89b2('0x60')]&&_[_0x89b2('0x61')](_0x29764f[_0x89b2('0x4b')][_0x89b2('0x60')])){if(_0x29764f['body'][_0x89b2('0x60')][_0x89b2('0x3b')]){_0x29764f[_0x89b2('0x4b')]['tags']=_0x29764f[_0x89b2('0x4b')][_0x89b2('0x60')][_0x89b2('0x62')](';')+';';}else{_0x29764f[_0x89b2('0x4b')][_0x89b2('0x60')]=null;}}else{_0x29764f[_0x89b2('0x4b')][_0x89b2('0x60')]=null;}if(_0x29764f[_0x89b2('0x4b')]&&_[_0x89b2('0x61')](_0x29764f[_0x89b2('0x4b')])){for(var _0x201f62=0x0;_0x201f62<_0x29764f[_0x89b2('0x4b')]['length'];_0x201f62+=0x1){_0x29764f[_0x89b2('0x4b')][_0x201f62][_0x89b2('0x5c')]=_0x29764f[_0x89b2('0x55')]['id'];_0x409058['push'](_0x29764f[_0x89b2('0x4b')][_0x201f62]);}return BPromise['each'](_0x409058,function(_0x200c17){return db[_0x89b2('0x63')][_0x89b2('0x4a')](_[_0x89b2('0x64')](_0x200c17,[_0x89b2('0x5e'),'id'])||{},{'fields':_[_0x89b2('0x35')](_0x137494),'raw':!![]})[_0x89b2('0x28')](function(_0x406190){_0x2a4d51['success'][_0x89b2('0x65')](_0x406190['dataValues']);})[_0x89b2('0x49')](function(_0x3610e1){_0x2a4d51[_0x89b2('0x66')][_0x89b2('0x65')]({'data':_0x200c17,'error':_0x3610e1[_0x89b2('0x67')]});});})[_0x89b2('0x28')](function(_0x5b6b67){return _0x2a4d51;})[_0x89b2('0x49')](function(_0x19f8a8){return _0x19f8a8;});}else{_0x352288['status'](0x190)[_0x89b2('0x1f')]({'message':_0x89b2('0x68')});}});}})['then'](respondWithResult(_0x352288,null))[_0x89b2('0x49')](handleError(_0x352288,null));};exports['getContacts']=function(_0x38dac,_0x22a509,_0x3ba476){var _0x457661;return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x38dac[_0x89b2('0x55')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x89b2('0x28')](handleEntityNotFound(_0x22a509,null))[_0x89b2('0x28')](function(_0x4872bf){if(_0x4872bf){_0x457661=_0x4872bf;return db[_0x89b2('0x63')][_0x89b2('0x30')];}})['then'](function(_0x20fd81){if(_0x20fd81){var _0x398fb6={};var _0x490413={};_0x490413[_0x89b2('0x33')]=_[_0x89b2('0x69')](_['keys'](_0x20fd81),_[_0x89b2('0x2e')](_0x457661[_0x89b2('0x6a')],function(_0x67097c){return util[_0x89b2('0x6b')]('cf_%d',_0x67097c['id']);}));_0x490413['query']=_['keys'](_0x38dac[_0x89b2('0x36')]);_0x490413['filters']=_[_0x89b2('0x38')](_0x490413[_0x89b2('0x33')],_0x490413[_0x89b2('0x36')]);_0x398fb6[_0x89b2('0x3a')]=_[_0x89b2('0x38')](_0x490413[_0x89b2('0x33')],qs[_0x89b2('0x39')](_0x38dac[_0x89b2('0x36')][_0x89b2('0x39')]));_0x398fb6[_0x89b2('0x3a')]=_0x398fb6['attributes'][_0x89b2('0x3b')]?_0x398fb6[_0x89b2('0x3a')]:_0x490413['model'];if(!_0x38dac[_0x89b2('0x36')][_0x89b2('0x6c')](_0x89b2('0x3c'))){_0x398fb6[_0x89b2('0x22')]=qs[_0x89b2('0x22')](_0x38dac[_0x89b2('0x36')]['limit']);_0x398fb6[_0x89b2('0x21')]=qs[_0x89b2('0x21')](_0x38dac[_0x89b2('0x36')]['offset']);}_0x398fb6['order']=qs[_0x89b2('0x3d')](_0x38dac[_0x89b2('0x36')][_0x89b2('0x3d')]);_0x398fb6[_0x89b2('0x3e')]=qs[_0x89b2('0x37')](_[_0x89b2('0x3f')](_0x38dac[_0x89b2('0x36')],_0x490413[_0x89b2('0x37')]));_0x398fb6['raw']=!![];if(_0x38dac[_0x89b2('0x36')][_0x89b2('0x40')]){_0x398fb6[_0x89b2('0x3e')]=_['merge'](_0x398fb6[_0x89b2('0x3e')],{'$or':_['map'](_0x398fb6[_0x89b2('0x3a')],function(_0x18863f){var _0x5cef3a={};_0x5cef3a[_0x18863f]={'$like':'%'+_0x38dac[_0x89b2('0x36')]['filter']+'%'};return _0x5cef3a;})});}_0x398fb6=_[_0x89b2('0x41')]({},_0x398fb6,_0x38dac[_0x89b2('0x43')]);return _0x457661['getContacts'](_0x398fb6);}})['then'](respondWithResult(_0x22a509,null))[_0x89b2('0x49')](handleError(_0x22a509,null));};exports[_0x89b2('0x6d')]=function(_0x2b201e,_0x5a5a7b,_0xb56a3f){var _0x5c4692;return db[_0x89b2('0x2f')]['find']({'where':{'id':_0x2b201e[_0x89b2('0x55')]['id']},'include':[{'model':db[_0x89b2('0x6e')],'as':_0x89b2('0x6a')}]})['then'](handleEntityNotFound(_0x5a5a7b,null))[_0x89b2('0x28')](function(_0x44dc65){if(_0x44dc65){_0x5c4692=_0x44dc65;return db['CmContact'][_0x89b2('0x30')];}})[_0x89b2('0x28')](function(_0x20d15d){if(_0x20d15d){var _0x2c83db={};var _0x9e9b10={};_0x9e9b10[_0x89b2('0x33')]=_[_0x89b2('0x69')](_[_0x89b2('0x35')](_0x20d15d),_[_0x89b2('0x2e')](_0x5c4692[_0x89b2('0x6a')],function(_0x5f56ff){return util[_0x89b2('0x6b')](_0x89b2('0x6f'),_0x5f56ff['id']);}));_0x9e9b10[_0x89b2('0x36')]=_[_0x89b2('0x35')](_0x2b201e[_0x89b2('0x36')]);_0x9e9b10[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x9e9b10[_0x89b2('0x33')],_0x9e9b10[_0x89b2('0x36')]);_0x2c83db['attributes']=_['intersection'](_0x9e9b10['model'],qs['fields'](_0x2b201e[_0x89b2('0x36')][_0x89b2('0x39')]));_0x2c83db['attributes']=_0x2c83db[_0x89b2('0x3a')]['length']?_0x2c83db[_0x89b2('0x3a')]:_0x9e9b10['model'];if(!_0x2b201e[_0x89b2('0x36')][_0x89b2('0x6c')](_0x89b2('0x3c'))){_0x2c83db[_0x89b2('0x22')]=qs['limit'](_0x2b201e[_0x89b2('0x36')][_0x89b2('0x22')]);_0x2c83db[_0x89b2('0x21')]=qs[_0x89b2('0x21')](_0x2b201e[_0x89b2('0x36')][_0x89b2('0x21')]);}_0x2c83db[_0x89b2('0x5b')]=qs[_0x89b2('0x3d')](_0x2b201e[_0x89b2('0x36')][_0x89b2('0x3d')]);_0x2c83db[_0x89b2('0x3e')]=qs['filters'](_['pick'](_0x2b201e['query'],_0x9e9b10[_0x89b2('0x37')]));_0x2c83db['raw']=!![];if(_0x2b201e[_0x89b2('0x36')][_0x89b2('0x40')]){_0x2c83db[_0x89b2('0x3e')]=_[_0x89b2('0x41')](_0x2c83db[_0x89b2('0x3e')],{'$or':_[_0x89b2('0x2e')](_0x2c83db['attributes'],function(_0x4c5330){var _0x27c947={};_0x27c947[_0x4c5330]={'$like':'%'+_0x2b201e[_0x89b2('0x36')][_0x89b2('0x40')]+'%'};return _0x27c947;})});}_0x2c83db=_[_0x89b2('0x41')]({},_0x2c83db,_0x2b201e['options']);return _0x5c4692[_0x89b2('0x70')](_0x2c83db);}})[_0x89b2('0x28')](function(_0x1d00e8){if(!_[_0x89b2('0x71')](_0x1d00e8)){var _0x443926=toCsv(_0x1d00e8);var _0x44c811=Date[_0x89b2('0x72')]();fs[_0x89b2('0x73')](util[_0x89b2('0x6b')](_0x89b2('0x74'),_0x5c4692['id'],_0x44c811),_0x443926);_0x5a5a7b[_0x89b2('0x75')]('Content-disposition','attachment;\x20filename='+util[_0x89b2('0x6b')](_0x89b2('0x76'),_0x5c4692['id'],_0x44c811));_0x5a5a7b[_0x89b2('0x75')](_0x89b2('0x77'),_0x89b2('0x78'));return _0x5a5a7b[_0x89b2('0x79')](util[_0x89b2('0x6b')](_0x89b2('0x74'),_0x5c4692['id'],_0x44c811));}else{return _0x5a5a7b[_0x89b2('0x1c')](0xcc);}})[_0x89b2('0x49')](handleError(_0x5a5a7b,null));};exports[_0x89b2('0x7a')]=function(_0x47e6e0,_0x4662b7,_0x4338b1){var _0x420638;delete _0x47e6e0['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x47e6e0[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x4662b7,null))['then'](function(_0x3867fd){if(_0x3867fd){return db[_0x89b2('0x7b')][_0x89b2('0x7c')](function(_0x16f154){return db[_0x89b2('0x6e')][_0x89b2('0x4a')](_0x47e6e0[_0x89b2('0x4b')],{'transaction':_0x16f154})['then'](function(_0xf70b2f){_0x420638=_0xf70b2f;return _0x3867fd[_0x89b2('0x7d')](_0xf70b2f,{'transaction':_0x16f154});})['then'](function(){var _0x517e9a={'type':db[_0x89b2('0x7e')][_0x89b2('0x7f')],'transaction':_0x16f154};switch(_0x47e6e0[_0x89b2('0x4b')][_0x89b2('0x31')]){case _0x89b2('0x80'):_0x517e9a[_0x89b2('0x31')]=db[_0x89b2('0x7e')][_0x89b2('0x7f')];break;case _0x89b2('0x81'):_0x517e9a['type']=db[_0x89b2('0x7e')][_0x89b2('0x82')];break;case _0x89b2('0x83'):_0x517e9a[_0x89b2('0x31')]=db[_0x89b2('0x7e')]['BOOLEAN'];_0x517e9a[_0x89b2('0x84')]=![];break;default:}return db[_0x89b2('0x7b')][_0x89b2('0x85')][_0x89b2('0x86')]('cm_contacts',util[_0x89b2('0x6b')](_0x89b2('0x87'),_0x420638['id']),_0x517e9a);})['then'](function(){return _0x420638;});});}})[_0x89b2('0x28')](respondWithResult(_0x4662b7,null))[_0x89b2('0x49')](handleError(_0x4662b7,null));};exports['getCustomFields']=function(_0x5cc665,_0x49488e,_0x45386d){var _0x2fbbd2={};var _0xfc087={};var _0x5cb3ae;var _0x543460;return db[_0x89b2('0x2f')][_0x89b2('0x5a')]({'where':{'id':_0x5cc665['params']['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x49488e,null))[_0x89b2('0x28')](function(_0x45283a){if(_0x45283a){_0x5cb3ae=_0x45283a;_0xfc087[_0x89b2('0x33')]=_[_0x89b2('0x35')](db['CmCustomField'][_0x89b2('0x30')]);_0xfc087[_0x89b2('0x36')]=_[_0x89b2('0x35')](_0x5cc665[_0x89b2('0x36')]);_0xfc087[_0x89b2('0x37')]=_['intersection'](_0xfc087[_0x89b2('0x33')],_0xfc087[_0x89b2('0x36')]);_0x2fbbd2[_0x89b2('0x3a')]=_[_0x89b2('0x38')](_0xfc087[_0x89b2('0x33')],qs[_0x89b2('0x39')](_0x5cc665[_0x89b2('0x36')]['fields']));_0x2fbbd2['attributes']=_0x2fbbd2[_0x89b2('0x3a')]['length']?_0x2fbbd2['attributes']:_0xfc087[_0x89b2('0x33')];_0x2fbbd2[_0x89b2('0x5b')]=qs['sort'](_0x5cc665['query'][_0x89b2('0x3d')]);_0x2fbbd2[_0x89b2('0x3e')]=qs['filters'](_[_0x89b2('0x3f')](_0x5cc665[_0x89b2('0x36')],_0xfc087['filters']));_0x2fbbd2[_0x89b2('0x3e')]=_['merge'](_0x2fbbd2[_0x89b2('0x3e')],{'$or':[{'ListId':_0x45283a['id']},{'ListId':null}]});if(_0x5cc665[_0x89b2('0x36')][_0x89b2('0x40')]){_0x2fbbd2['where']=_[_0x89b2('0x41')](_0x2fbbd2[_0x89b2('0x3e')],{'$or':_[_0x89b2('0x2e')](_0x2fbbd2['attributes'],function(_0x14b810){var _0x12673={};_0x12673[_0x14b810]={'$like':'%'+_0x5cc665[_0x89b2('0x36')]['filter']+'%'};return _0x12673;})});}_0x2fbbd2=_['merge']({},_0x2fbbd2,_0x5cc665[_0x89b2('0x43')]);return db[_0x89b2('0x6e')][_0x89b2('0x88')](_0x2fbbd2);}})['then'](respondWithResult(_0x49488e,null))[_0x89b2('0x49')](handleError(_0x49488e,null));};exports[_0x89b2('0x89')]=function(_0x16d40a,_0x139bb7,_0x589988){return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x16d40a['params']['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x139bb7,null))[_0x89b2('0x28')](function(_0x39c2f1){if(_0x39c2f1){return _0x39c2f1[_0x89b2('0x89')](_0x16d40a[_0x89b2('0x4b')][_0x89b2('0x5e')],_['omit'](_0x16d40a[_0x89b2('0x4b')],[_0x89b2('0x5e'),'id'])||{})[_0x89b2('0x8a')](function(_0x5bb3b5){for(var _0x536ffd=0x0;_0x536ffd<_0x16d40a[_0x89b2('0x4b')][_0x89b2('0x5e')][_0x89b2('0x3b')];_0x536ffd+=0x1){socket[_0x89b2('0x8b')](_0x89b2('0x8c'),{'UserId':_0x16d40a['body'][_0x89b2('0x5e')][_0x536ffd],'CmListId':_0x16d40a['params']['id']});}return _0x5bb3b5;});}})[_0x89b2('0x28')](respondWithResult(_0x139bb7,null))[_0x89b2('0x49')](handleError(_0x139bb7,null));};exports['removeAgents']=function(_0x27d02c,_0x4329fd,_0x58e340){return db[_0x89b2('0x2f')][_0x89b2('0x50')]({'where':{'id':_0x27d02c[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x4329fd,null))[_0x89b2('0x28')](function(_0x309420){if(_0x309420){return _0x309420[_0x89b2('0x8d')](_0x27d02c['query'][_0x89b2('0x5e')])[_0x89b2('0x28')](function(){if(_[_0x89b2('0x61')](_0x27d02c[_0x89b2('0x36')][_0x89b2('0x5e')])){for(var _0x2086f0=0x0;_0x2086f0<_0x27d02c[_0x89b2('0x36')][_0x89b2('0x5e')][_0x89b2('0x3b')];_0x2086f0+=0x1){socket[_0x89b2('0x8b')](_0x89b2('0x8e'),{'UserId':Number(_0x27d02c[_0x89b2('0x36')][_0x89b2('0x5e')][_0x2086f0]),'CmListId':Number(_0x27d02c[_0x89b2('0x55')]['id'])});}}else{socket['emit'](_0x89b2('0x8e'),{'UserId':Number(_0x27d02c[_0x89b2('0x36')][_0x89b2('0x5e')]),'CmListId':Number(_0x27d02c['params']['id'])});}});}})[_0x89b2('0x28')](respondWithStatusCode(_0x4329fd,null))[_0x89b2('0x49')](handleError(_0x4329fd,null));};exports['getAgents']=function(_0x5c0c97,_0x276247,_0x15acd9){var _0x532ce0={};var _0x417c4b={};var _0xc33764;var _0x234a15;return db[_0x89b2('0x2f')][_0x89b2('0x5a')]({'where':{'id':_0x5c0c97[_0x89b2('0x55')]['id']}})[_0x89b2('0x28')](handleEntityNotFound(_0x276247,null))['then'](function(_0x58ecf3){if(_0x58ecf3){_0xc33764=_0x58ecf3;_0x417c4b[_0x89b2('0x33')]=_[_0x89b2('0x35')](db[_0x89b2('0x8f')][_0x89b2('0x30')]);_0x417c4b[_0x89b2('0x36')]=_['keys'](_0x5c0c97[_0x89b2('0x36')]);_0x417c4b[_0x89b2('0x37')]=_[_0x89b2('0x38')](_0x417c4b['model'],_0x417c4b['query']);_0x532ce0['attributes']=_[_0x89b2('0x38')](_0x417c4b[_0x89b2('0x33')],qs[_0x89b2('0x39')](_0x5c0c97[_0x89b2('0x36')]['fields']));_0x532ce0[_0x89b2('0x3a')]=_0x532ce0[_0x89b2('0x3a')][_0x89b2('0x3b')]?_0x532ce0['attributes']:_0x417c4b['model'];_0x532ce0[_0x89b2('0x5b')]=qs[_0x89b2('0x3d')](_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x3d')]);_0x532ce0[_0x89b2('0x3e')]=qs['filters'](_['pick'](_0x5c0c97['query'],_0x417c4b[_0x89b2('0x37')]));if(_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x40')]){_0x532ce0['where']=_[_0x89b2('0x41')](_0x532ce0[_0x89b2('0x3e')],{'$or':_['map'](_0x532ce0[_0x89b2('0x3a')],function(_0x3c9308){var _0x2f98a3={};_0x2f98a3[_0x3c9308]={'$like':'%'+_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x40')]+'%'};return _0x2f98a3;})});}_0x532ce0=_[_0x89b2('0x41')]({},_0x532ce0,_0x5c0c97[_0x89b2('0x43')]);return _0xc33764[_0x89b2('0x90')](_0x532ce0);}})[_0x89b2('0x28')](function(_0x1b4102){if(_0x1b4102){_0x234a15=_0x1b4102[_0x89b2('0x3b')];if(!_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x6c')](_0x89b2('0x3c'))){_0x532ce0[_0x89b2('0x22')]=qs[_0x89b2('0x22')](_0x5c0c97[_0x89b2('0x36')][_0x89b2('0x22')]);_0x532ce0['offset']=qs['offset'](_0x5c0c97['query'][_0x89b2('0x21')]);}return _0xc33764[_0x89b2('0x90')](_0x532ce0);}})[_0x89b2('0x28')](function(_0x488c1f){if(_0x488c1f){return _0x488c1f?{'count':_0x234a15,'rows':_0x488c1f}:null;}})[_0x89b2('0x28')](respondWithResult(_0x276247,null))['catch'](handleError(_0x276247,null));}; \ No newline at end of file +var _0xbb63=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','Disposition','getDispositions','findAll','rows','removeDispositions','addContacts','CmContact','tags','isArray','join','ListId','each','omit','ids','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','getContacts','getContactsCsv','raw','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','findOne','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','end','status','json','count','limit','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','name','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','catch','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId'];(function(_0x33c8b3,_0x27dc52){var _0x25089b=function(_0x392058){while(--_0x392058){_0x33c8b3['push'](_0x33c8b3['shift']());}};_0x25089b(++_0x27dc52);}(_0xbb63,0x1e3));var _0x3bb6=function(_0x4cd11c,_0x11925c){_0x4cd11c=_0x4cd11c-0x0;var _0x2bf15f=_0xbb63[_0x4cd11c];return _0x2bf15f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3bb6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3bb6('0x1'));var rp=require(_0x3bb6('0x2'));var moment=require(_0x3bb6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3bb6('0x4'));var util=require('util');var path=require(_0x3bb6('0x5'));var sox=require(_0x3bb6('0x6'));var csv=require(_0x3bb6('0x7'));var ejs=require(_0x3bb6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3bb6('0x9'));var jsforce=require(_0x3bb6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3bb6('0x7'));var querystring=require(_0x3bb6('0xb'));var Papa=require('papaparse');var Redis=require(_0x3bb6('0xc'));var authService=require(_0x3bb6('0xd'));var qs=require(_0x3bb6('0xe'));var as=require(_0x3bb6('0xf'));var hardwareService=require(_0x3bb6('0x10'));var logger=require('../../config/logger')(_0x3bb6('0x11'));var utils=require(_0x3bb6('0x12'));var config=require('../../config/environment');var db=require(_0x3bb6('0x13'))['db'];config[_0x3bb6('0x14')]=_['defaults'](config[_0x3bb6('0x14')],{'host':_0x3bb6('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3bb6('0x14')]));require(_0x3bb6('0x16'))[_0x3bb6('0x17')](socket);function respondWithStatusCode(_0xa1fb88,_0x15036d){_0x15036d=_0x15036d||0xcc;return function(_0x2f3e54){if(_0x2f3e54){return _0xa1fb88[_0x3bb6('0x18')](_0x15036d);}return _0xa1fb88['status'](_0x15036d)[_0x3bb6('0x19')]();};}function respondWithResult(_0x372004,_0x45530d){_0x45530d=_0x45530d||0xc8;return function(_0x4617ac){if(_0x4617ac){return _0x372004[_0x3bb6('0x1a')](_0x45530d)[_0x3bb6('0x1b')](_0x4617ac);}};}function respondWithFilteredResult(_0x14e257,_0x2c9781){return function(_0x282be5){if(_0x282be5){var _0x2376fe=_0x282be5[_0x3bb6('0x1c')],_0x470087=_0x2c9781['offset'],_0xfaa93d=_0x2c9781['offset']+_0x2c9781[_0x3bb6('0x1d')],_0x16f390;if(_0xfaa93d>=_0x2376fe){_0xfaa93d=_0x2376fe;_0x16f390=0xc8;}else{_0x16f390=0xce;}_0x14e257[_0x3bb6('0x1a')](_0x16f390);return _0x14e257['set']('Content-Range',_0x470087+'-'+_0xfaa93d+'/'+_0x2376fe)[_0x3bb6('0x1b')](_0x282be5);}return null;};}function patchUpdates(_0x5b287e){return function(_0x33548f){try{jsonpatch[_0x3bb6('0x1e')](_0x33548f,_0x5b287e,!![]);}catch(_0x520d9f){return BPromise[_0x3bb6('0x1f')](_0x520d9f);}return _0x33548f[_0x3bb6('0x20')]();};}function saveUpdates(_0x44ec5c,_0x4a8b36){return function(_0x495d20){if(_0x495d20){return _0x495d20[_0x3bb6('0x21')](_0x44ec5c)['then'](function(_0x354907){return _0x354907;});}return null;};}function removeEntity(_0x1b0d7c,_0x3bbe6d){return function(_0xb1902b){if(_0xb1902b){return _0xb1902b[_0x3bb6('0x22')]()[_0x3bb6('0x23')](function(){var _0x297093=_0xb1902b[_0x3bb6('0x24')]({'plain':!![]});var _0xd794dd=_0x3bb6('0x25');return db[_0x3bb6('0x26')][_0x3bb6('0x22')]({'where':{'type':_0xd794dd,'resourceId':_0x297093['id']}})[_0x3bb6('0x23')](function(){return _0xb1902b;});})[_0x3bb6('0x23')](function(){_0x1b0d7c[_0x3bb6('0x1a')](0xcc)[_0x3bb6('0x19')]();});}};}function handleEntityNotFound(_0x58186d,_0x4a4fe9){return function(_0x54a686){if(!_0x54a686){_0x58186d[_0x3bb6('0x18')](0x194);}return _0x54a686;};}function handleError(_0x488fb0,_0xfa4042){_0xfa4042=_0xfa4042||0x1f4;return function(_0x34d5eb){logger[_0x3bb6('0x27')](_0x34d5eb['stack']);if(_0x34d5eb[_0x3bb6('0x28')]){delete _0x34d5eb[_0x3bb6('0x28')];}_0x488fb0['status'](_0xfa4042)['send'](_0x34d5eb);};}exports['index']=function(_0x349f23,_0x4580d6){var _0x105b3b={},_0x16dd89={},_0x1f238e={'count':0x0,'rows':[]};var _0xf0c651=_[_0x3bb6('0x29')](db[_0x3bb6('0x2a')]['rawAttributes'],function(_0x4a5806){return{'name':_0x4a5806[_0x3bb6('0x2b')],'type':_0x4a5806[_0x3bb6('0x2c')][_0x3bb6('0x2d')]};});_0x16dd89[_0x3bb6('0x2e')]=_[_0x3bb6('0x29')](_0xf0c651,_0x3bb6('0x28'));_0x16dd89[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x349f23[_0x3bb6('0x2f')]);_0x16dd89[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0x16dd89['model'],_0x16dd89[_0x3bb6('0x2f')]);_0x105b3b[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0x16dd89[_0x3bb6('0x2e')],qs[_0x3bb6('0x34')](_0x349f23['query'][_0x3bb6('0x34')]));_0x105b3b[_0x3bb6('0x33')]=_0x105b3b[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x105b3b['attributes']:_0x16dd89['model'];if(!_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x36')](_0x3bb6('0x37'))){_0x105b3b[_0x3bb6('0x1d')]=qs[_0x3bb6('0x1d')](_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x1d')]);_0x105b3b[_0x3bb6('0x38')]=qs['offset'](_0x349f23['query'][_0x3bb6('0x38')]);}_0x105b3b[_0x3bb6('0x39')]=qs[_0x3bb6('0x3a')](_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x3a')]);_0x105b3b['where']=qs['filters'](_[_0x3bb6('0x3b')](_0x349f23['query'],_0x16dd89[_0x3bb6('0x31')]),_0xf0c651);if(_0x349f23['query'][_0x3bb6('0x3c')]){_0x105b3b[_0x3bb6('0x3d')]=_['merge'](_0x105b3b[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0xf0c651,function(_0x2ed737){if(_0x2ed737[_0x3bb6('0x2c')]!==_0x3bb6('0x3e')){var _0x3a9749={};_0x3a9749[_0x2ed737['name']]={'$like':'%'+_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x3c')]+'%'};return _0x3a9749;}})});}_0x105b3b=_[_0x3bb6('0x3f')]({},_0x105b3b,_0x349f23[_0x3bb6('0x40')]);var _0x12b176={'where':_0x105b3b[_0x3bb6('0x3d')]};return db[_0x3bb6('0x2a')][_0x3bb6('0x1c')](_0x12b176)[_0x3bb6('0x23')](function(_0x4316a3){_0x1f238e[_0x3bb6('0x1c')]=_0x4316a3;if(_0x349f23[_0x3bb6('0x2f')][_0x3bb6('0x41')]){_0x105b3b[_0x3bb6('0x42')]=[{'all':!![]}];}return db[_0x3bb6('0x2a')]['findAll'](_0x105b3b);})[_0x3bb6('0x23')](function(_0x3f39f6){_0x1f238e['rows']=_0x3f39f6;return _0x1f238e;})['then'](respondWithFilteredResult(_0x4580d6,_0x105b3b))[_0x3bb6('0x43')](handleError(_0x4580d6,null));};exports[_0x3bb6('0x44')]=function(_0x1e2d37,_0xf89cc4){var _0x263eaa={'raw':![],'where':{'id':_0x1e2d37[_0x3bb6('0x45')]['id']}},_0xb4f974={};_0xb4f974['model']=_['keys'](db['CmList'][_0x3bb6('0x46')]);_0xb4f974[_0x3bb6('0x2f')]=_['keys'](_0x1e2d37['query']);_0xb4f974[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0xb4f974[_0x3bb6('0x2e')],_0xb4f974[_0x3bb6('0x2f')]);_0x263eaa[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0xb4f974[_0x3bb6('0x2e')],qs[_0x3bb6('0x34')](_0x1e2d37['query'][_0x3bb6('0x34')]));_0x263eaa[_0x3bb6('0x33')]=_0x263eaa[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x263eaa[_0x3bb6('0x33')]:_0xb4f974[_0x3bb6('0x2e')];if(_0x1e2d37['query'][_0x3bb6('0x41')]){_0x263eaa[_0x3bb6('0x42')]=[{'all':!![]}];}_0x263eaa=_[_0x3bb6('0x3f')]({},_0x263eaa,_0x1e2d37['options']);return db[_0x3bb6('0x2a')]['find'](_0x263eaa)[_0x3bb6('0x23')](handleEntityNotFound(_0xf89cc4,null))['then'](respondWithResult(_0xf89cc4,null))[_0x3bb6('0x43')](handleError(_0xf89cc4,null));};exports[_0x3bb6('0x47')]=function(_0x1fd317,_0x2ab6d8){return db[_0x3bb6('0x2a')][_0x3bb6('0x47')](_0x1fd317[_0x3bb6('0x48')],{})[_0x3bb6('0x23')](function(_0x4d7079){var _0x5512c7=_0x1fd317['user'][_0x3bb6('0x24')]({'plain':!![]});if(!_0x5512c7)throw new Error(_0x3bb6('0x49'));if(_0x5512c7['role']===_0x3bb6('0x4a')){var _0x3a3fe4=_0x4d7079[_0x3bb6('0x24')]({'plain':!![]});var _0x5c3920=_0x3bb6('0x25');return db[_0x3bb6('0x4b')]['find']({'where':{'name':_0x5c3920,'userProfileId':_0x5512c7[_0x3bb6('0x4c')]},'raw':!![]})[_0x3bb6('0x23')](function(_0x417fd2){if(_0x417fd2&&_0x417fd2[_0x3bb6('0x4d')]===0x0){return db[_0x3bb6('0x26')][_0x3bb6('0x47')]({'name':_0x3a3fe4[_0x3bb6('0x28')],'resourceId':_0x3a3fe4['id'],'type':_0x417fd2[_0x3bb6('0x28')],'sectionId':_0x417fd2['id']},{})[_0x3bb6('0x23')](function(){return _0x4d7079;});}else{return _0x4d7079;}})[_0x3bb6('0x43')](function(_0x400d2d){logger[_0x3bb6('0x27')](_0x3bb6('0x4e'),_0x400d2d);throw _0x400d2d;});}return _0x4d7079;})[_0x3bb6('0x23')](respondWithResult(_0x2ab6d8,0xc9))[_0x3bb6('0x43')](handleError(_0x2ab6d8,null));};exports[_0x3bb6('0x21')]=function(_0x245160,_0x431a11){if(_0x245160['body']['id']){delete _0x245160[_0x3bb6('0x48')]['id'];}return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0x245160[_0x3bb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x431a11,null))[_0x3bb6('0x23')](saveUpdates(_0x245160[_0x3bb6('0x48')],null))[_0x3bb6('0x23')](respondWithResult(_0x431a11,null))[_0x3bb6('0x43')](handleError(_0x431a11,null));};exports[_0x3bb6('0x22')]=function(_0x17a7d8,_0x3b0332){return db[_0x3bb6('0x2a')]['find']({'where':{'id':_0x17a7d8[_0x3bb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b0332,null))['then'](removeEntity(_0x3b0332,null))[_0x3bb6('0x43')](handleError(_0x3b0332,null));};exports[_0x3bb6('0x50')]=function(_0x3cd954,_0xa5f3f7){return db['CmList'][_0x3bb6('0x50')]()[_0x3bb6('0x23')](respondWithResult(_0xa5f3f7,null))['catch'](handleError(_0xa5f3f7,null));};exports[_0x3bb6('0x51')]=function(_0x34a845,_0xd4af44,_0xc0f283){if(_0x34a845[_0x3bb6('0x48')]['id']){delete _0x34a845[_0x3bb6('0x48')]['id'];}return db['CmList'][_0x3bb6('0x4f')]({'where':{'id':_0x34a845['params']['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0xd4af44,null))[_0x3bb6('0x23')](function(_0x24b4ce){if(_0x24b4ce){_0x34a845['body']['ListId']=_0x24b4ce['id'];return db[_0x3bb6('0x52')]['create'](_0x34a845[_0x3bb6('0x48')]);}})[_0x3bb6('0x23')](respondWithResult(_0xd4af44,null))['catch'](handleError(_0xd4af44,null));};exports[_0x3bb6('0x53')]=function(_0x27efd7,_0xd9e5e5,_0x13d163){var _0x4b358d={'raw':![],'where':{}};var _0x1ba8cc={};var _0x1e1250={'count':0x0,'rows':[]};return db[_0x3bb6('0x2a')]['findOne']({'where':{'id':_0x27efd7[_0x3bb6('0x45')]['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0xd9e5e5,null))[_0x3bb6('0x23')](function(_0x4a948e){if(_0x4a948e){_0x1ba8cc[_0x3bb6('0x2e')]=_[_0x3bb6('0x30')](db[_0x3bb6('0x52')][_0x3bb6('0x46')]);_0x1ba8cc[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x27efd7[_0x3bb6('0x2f')]);_0x1ba8cc[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0x1ba8cc[_0x3bb6('0x2e')],_0x1ba8cc[_0x3bb6('0x2f')]);_0x4b358d[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0x1ba8cc[_0x3bb6('0x2e')],qs['fields'](_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x4b358d[_0x3bb6('0x33')]=_0x4b358d['attributes'][_0x3bb6('0x35')]?_0x4b358d['attributes']:_0x1ba8cc[_0x3bb6('0x2e')];if(!_0x27efd7['query'][_0x3bb6('0x36')](_0x3bb6('0x37'))){_0x4b358d[_0x3bb6('0x1d')]=qs[_0x3bb6('0x1d')](_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x1d')]);_0x4b358d[_0x3bb6('0x38')]=qs[_0x3bb6('0x38')](_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x38')]);}_0x4b358d['order']=qs[_0x3bb6('0x3a')](_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x3a')]);_0x4b358d[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_[_0x3bb6('0x3b')](_0x27efd7[_0x3bb6('0x2f')],_0x1ba8cc[_0x3bb6('0x31')]));_0x4b358d[_0x3bb6('0x3d')]['ListId']=_0x4a948e['id'];if(_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x3c')]){_0x4b358d[_0x3bb6('0x3d')]=_['merge'](_0x4b358d[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0x4b358d['attributes'],function(_0x9ab4c4){var _0x490bb8={};_0x490bb8[_0x9ab4c4]={'$like':'%'+_0x27efd7[_0x3bb6('0x2f')][_0x3bb6('0x3c')]+'%'};return _0x490bb8;})});}_0x4b358d=_[_0x3bb6('0x3f')]({},_0x4b358d,_0x27efd7[_0x3bb6('0x40')]);return db['Disposition'][_0x3bb6('0x1c')]({'where':_0x4b358d['where']})['then'](function(_0x19e0f9){_0x1e1250['count']=_0x19e0f9;if(_0x27efd7[_0x3bb6('0x2f')]['includeAll']){_0x4b358d[_0x3bb6('0x42')]=[{'all':!![]}];}return db['Disposition'][_0x3bb6('0x54')](_0x4b358d);})[_0x3bb6('0x23')](function(_0x2a010c){_0x1e1250[_0x3bb6('0x55')]=_0x2a010c;return _0x1e1250;});}})[_0x3bb6('0x23')](respondWithFilteredResult(_0xd9e5e5,_0x4b358d))[_0x3bb6('0x43')](handleError(_0xd9e5e5,null));};exports[_0x3bb6('0x56')]=function(_0xbce05a,_0x1a46d0,_0x1e1ebd){return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0xbce05a[_0x3bb6('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a46d0,null))[_0x3bb6('0x23')](function(_0x348254){if(_0x348254){return _0x348254['removeDispositions'](_0xbce05a[_0x3bb6('0x2f')]['ids']);}})['then'](respondWithStatusCode(_0x1a46d0,null))[_0x3bb6('0x43')](handleError(_0x1a46d0,null));};exports[_0x3bb6('0x57')]=function(_0x425009,_0x490238,_0x231fc7){return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0x425009['params']['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0x490238,null))[_0x3bb6('0x23')](function(_0x5dc906){if(_0x5dc906){var _0x4cc5be=[];var _0xf9b3cf={'success':[],'errors':[]};return db[_0x3bb6('0x58')][_0x3bb6('0x50')]()['then'](function(_0x2c62fe){if(_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]&&_[_0x3bb6('0x5a')](_0x425009['body']['tags'])){if(_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]['length']){_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]=_0x425009[_0x3bb6('0x48')]['tags'][_0x3bb6('0x5b')](';')+';';}else{_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]=null;}}else{_0x425009[_0x3bb6('0x48')][_0x3bb6('0x59')]=null;}if(_0x425009[_0x3bb6('0x48')]&&_[_0x3bb6('0x5a')](_0x425009[_0x3bb6('0x48')])){for(var _0x3634b3=0x0;_0x3634b3<_0x425009[_0x3bb6('0x48')]['length'];_0x3634b3+=0x1){_0x425009[_0x3bb6('0x48')][_0x3634b3][_0x3bb6('0x5c')]=_0x425009[_0x3bb6('0x45')]['id'];_0x4cc5be['push'](_0x425009['body'][_0x3634b3]);}return BPromise[_0x3bb6('0x5d')](_0x4cc5be,function(_0x10d27f){return db[_0x3bb6('0x58')][_0x3bb6('0x47')](_[_0x3bb6('0x5e')](_0x10d27f,[_0x3bb6('0x5f'),'id'])||{},{'fields':_[_0x3bb6('0x30')](_0x2c62fe),'raw':!![]})[_0x3bb6('0x23')](function(_0x294646){_0xf9b3cf[_0x3bb6('0x60')]['push'](_0x294646[_0x3bb6('0x61')]);})[_0x3bb6('0x43')](function(_0x150ceb){_0xf9b3cf['errors']['push']({'data':_0x10d27f,'error':_0x150ceb[_0x3bb6('0x62')]});});})[_0x3bb6('0x23')](function(_0x5624b4){return _0xf9b3cf;})['catch'](function(_0x47162d){return _0x47162d;});}else{_0x490238[_0x3bb6('0x1a')](0x190)[_0x3bb6('0x1b')]({'message':_0x3bb6('0x63')});}});}})[_0x3bb6('0x23')](respondWithResult(_0x490238,null))[_0x3bb6('0x43')](handleError(_0x490238,null));};exports['getContacts']=function(_0x598666,_0x197211,_0x5bdb87){var _0x10be7f;return db['CmList'][_0x3bb6('0x4f')]({'where':{'id':_0x598666['params']['id']},'include':[{'model':db[_0x3bb6('0x64')],'as':_0x3bb6('0x65')}]})['then'](handleEntityNotFound(_0x197211,null))[_0x3bb6('0x23')](function(_0x30184a){if(_0x30184a){_0x10be7f=_0x30184a;return db[_0x3bb6('0x58')][_0x3bb6('0x46')];}})[_0x3bb6('0x23')](function(_0x463790){if(_0x463790){var _0x1061c4={};var _0x5d6f96={};_0x5d6f96[_0x3bb6('0x2e')]=_[_0x3bb6('0x66')](_['keys'](_0x463790),_[_0x3bb6('0x29')](_0x10be7f[_0x3bb6('0x65')],function(_0x5c34be){return util[_0x3bb6('0x67')](_0x3bb6('0x68'),_0x5c34be['id']);}));_0x5d6f96[_0x3bb6('0x2f')]=_['keys'](_0x598666[_0x3bb6('0x2f')]);_0x5d6f96[_0x3bb6('0x31')]=_['intersection'](_0x5d6f96[_0x3bb6('0x2e')],_0x5d6f96[_0x3bb6('0x2f')]);_0x1061c4[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0x5d6f96['model'],qs['fields'](_0x598666[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x1061c4[_0x3bb6('0x33')]=_0x1061c4[_0x3bb6('0x33')]['length']?_0x1061c4[_0x3bb6('0x33')]:_0x5d6f96[_0x3bb6('0x2e')];if(!_0x598666[_0x3bb6('0x2f')]['hasOwnProperty'](_0x3bb6('0x37'))){_0x1061c4[_0x3bb6('0x1d')]=qs[_0x3bb6('0x1d')](_0x598666[_0x3bb6('0x2f')]['limit']);_0x1061c4[_0x3bb6('0x38')]=qs['offset'](_0x598666[_0x3bb6('0x2f')][_0x3bb6('0x38')]);}_0x1061c4[_0x3bb6('0x39')]=qs[_0x3bb6('0x3a')](_0x598666[_0x3bb6('0x2f')][_0x3bb6('0x3a')]);_0x1061c4[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_['pick'](_0x598666[_0x3bb6('0x2f')],_0x5d6f96[_0x3bb6('0x31')]));_0x1061c4['raw']=!![];if(_0x598666[_0x3bb6('0x2f')]['filter']){_0x1061c4[_0x3bb6('0x3d')]=_[_0x3bb6('0x3f')](_0x1061c4[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0x1061c4['attributes'],function(_0x1b66be){var _0x313236={};_0x313236[_0x1b66be]={'$like':'%'+_0x598666[_0x3bb6('0x2f')][_0x3bb6('0x3c')]+'%'};return _0x313236;})});}_0x1061c4=_[_0x3bb6('0x3f')]({},_0x1061c4,_0x598666['options']);return _0x10be7f[_0x3bb6('0x69')](_0x1061c4);}})['then'](respondWithResult(_0x197211,null))['catch'](handleError(_0x197211,null));};exports[_0x3bb6('0x6a')]=function(_0x334b2d,_0x4a37cf,_0x1bce92){var _0x2ac268;return db[_0x3bb6('0x2a')]['find']({'where':{'id':_0x334b2d[_0x3bb6('0x45')]['id']},'include':[{'model':db[_0x3bb6('0x64')],'as':_0x3bb6('0x65')}]})[_0x3bb6('0x23')](handleEntityNotFound(_0x4a37cf,null))[_0x3bb6('0x23')](function(_0x199ec2){if(_0x199ec2){_0x2ac268=_0x199ec2;return db[_0x3bb6('0x58')][_0x3bb6('0x46')];}})[_0x3bb6('0x23')](function(_0x38295d){if(_0x38295d){var _0x7fd428={};var _0x8ccceb={};_0x8ccceb[_0x3bb6('0x2e')]=_[_0x3bb6('0x66')](_[_0x3bb6('0x30')](_0x38295d),_['map'](_0x2ac268[_0x3bb6('0x65')],function(_0x16a3a7){return util['format'](_0x3bb6('0x68'),_0x16a3a7['id']);}));_0x8ccceb[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x334b2d[_0x3bb6('0x2f')]);_0x8ccceb[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0x8ccceb['model'],_0x8ccceb[_0x3bb6('0x2f')]);_0x7fd428[_0x3bb6('0x33')]=_['intersection'](_0x8ccceb[_0x3bb6('0x2e')],qs[_0x3bb6('0x34')](_0x334b2d[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x7fd428[_0x3bb6('0x33')]=_0x7fd428[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x7fd428[_0x3bb6('0x33')]:_0x8ccceb[_0x3bb6('0x2e')];if(!_0x334b2d[_0x3bb6('0x2f')][_0x3bb6('0x36')](_0x3bb6('0x37'))){_0x7fd428['limit']=qs['limit'](_0x334b2d[_0x3bb6('0x2f')][_0x3bb6('0x1d')]);_0x7fd428[_0x3bb6('0x38')]=qs['offset'](_0x334b2d['query'][_0x3bb6('0x38')]);}_0x7fd428['order']=qs[_0x3bb6('0x3a')](_0x334b2d['query']['sort']);_0x7fd428[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_[_0x3bb6('0x3b')](_0x334b2d[_0x3bb6('0x2f')],_0x8ccceb[_0x3bb6('0x31')]));_0x7fd428[_0x3bb6('0x6b')]=!![];if(_0x334b2d[_0x3bb6('0x2f')][_0x3bb6('0x3c')]){_0x7fd428[_0x3bb6('0x3d')]=_['merge'](_0x7fd428[_0x3bb6('0x3d')],{'$or':_['map'](_0x7fd428[_0x3bb6('0x33')],function(_0x391f68){var _0xa65dc9={};_0xa65dc9[_0x391f68]={'$like':'%'+_0x334b2d['query']['filter']+'%'};return _0xa65dc9;})});}_0x7fd428=_[_0x3bb6('0x3f')]({},_0x7fd428,_0x334b2d[_0x3bb6('0x40')]);return _0x2ac268['getContacts'](_0x7fd428);}})['then'](function(_0x43e807){if(!_[_0x3bb6('0x6c')](_0x43e807)){var _0x5bfe3d=toCsv(_0x43e807);var _0x498257=Date['now']();fs[_0x3bb6('0x6d')](util[_0x3bb6('0x67')](_0x3bb6('0x6e'),_0x2ac268['id'],_0x498257),_0x5bfe3d);_0x4a37cf['setHeader'](_0x3bb6('0x6f'),'attachment;\x20filename='+util['format'](_0x3bb6('0x70'),_0x2ac268['id'],_0x498257));_0x4a37cf[_0x3bb6('0x71')](_0x3bb6('0x72'),_0x3bb6('0x73'));return _0x4a37cf[_0x3bb6('0x74')](util['format'](_0x3bb6('0x6e'),_0x2ac268['id'],_0x498257));}else{return _0x4a37cf[_0x3bb6('0x18')](0xcc);}})[_0x3bb6('0x43')](handleError(_0x4a37cf,null));};exports[_0x3bb6('0x75')]=function(_0x285d34,_0xf556e0,_0x14c447){var _0x4bfd29;delete _0x285d34['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x285d34[_0x3bb6('0x45')]['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0xf556e0,null))[_0x3bb6('0x23')](function(_0x3b7911){if(_0x3b7911){return db['sequelize'][_0x3bb6('0x76')](function(_0x290a05){return db[_0x3bb6('0x64')][_0x3bb6('0x47')](_0x285d34['body'],{'transaction':_0x290a05})[_0x3bb6('0x23')](function(_0x2a11df){_0x4bfd29=_0x2a11df;return _0x3b7911[_0x3bb6('0x77')](_0x2a11df,{'transaction':_0x290a05});})[_0x3bb6('0x23')](function(){var _0x202716={'type':db[_0x3bb6('0x78')][_0x3bb6('0x79')],'transaction':_0x290a05};switch(_0x285d34[_0x3bb6('0x48')][_0x3bb6('0x2c')]){case'text':_0x202716['type']=db[_0x3bb6('0x78')][_0x3bb6('0x79')];break;case'number':_0x202716[_0x3bb6('0x2c')]=db['Sequelize'][_0x3bb6('0x7a')];break;case _0x3bb6('0x7b'):_0x202716[_0x3bb6('0x2c')]=db[_0x3bb6('0x78')][_0x3bb6('0x7c')];_0x202716[_0x3bb6('0x7d')]=![];break;default:}return db[_0x3bb6('0x7e')][_0x3bb6('0x7f')][_0x3bb6('0x80')](_0x3bb6('0x81'),util[_0x3bb6('0x67')](_0x3bb6('0x82'),_0x4bfd29['id']),_0x202716);})[_0x3bb6('0x23')](function(){return _0x4bfd29;});});}})[_0x3bb6('0x23')](respondWithResult(_0xf556e0,null))[_0x3bb6('0x43')](handleError(_0xf556e0,null));};exports['getCustomFields']=function(_0x49c082,_0x3621b7,_0x15860b){var _0x498701={};var _0x58b787={};var _0x3df710;var _0x5e1f42;return db[_0x3bb6('0x2a')][_0x3bb6('0x83')]({'where':{'id':_0x49c082[_0x3bb6('0x45')]['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0x3621b7,null))[_0x3bb6('0x23')](function(_0x261633){if(_0x261633){_0x3df710=_0x261633;_0x58b787[_0x3bb6('0x2e')]=_[_0x3bb6('0x30')](db[_0x3bb6('0x64')][_0x3bb6('0x46')]);_0x58b787[_0x3bb6('0x2f')]=_['keys'](_0x49c082[_0x3bb6('0x2f')]);_0x58b787['filters']=_[_0x3bb6('0x32')](_0x58b787[_0x3bb6('0x2e')],_0x58b787[_0x3bb6('0x2f')]);_0x498701[_0x3bb6('0x33')]=_[_0x3bb6('0x32')](_0x58b787[_0x3bb6('0x2e')],qs[_0x3bb6('0x34')](_0x49c082[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x498701['attributes']=_0x498701[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x498701[_0x3bb6('0x33')]:_0x58b787[_0x3bb6('0x2e')];_0x498701[_0x3bb6('0x39')]=qs[_0x3bb6('0x3a')](_0x49c082[_0x3bb6('0x2f')][_0x3bb6('0x3a')]);_0x498701[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_[_0x3bb6('0x3b')](_0x49c082['query'],_0x58b787[_0x3bb6('0x31')]));_0x498701['where']=_['merge'](_0x498701[_0x3bb6('0x3d')],{'$or':[{'ListId':_0x261633['id']},{'ListId':null}]});if(_0x49c082['query'][_0x3bb6('0x3c')]){_0x498701[_0x3bb6('0x3d')]=_[_0x3bb6('0x3f')](_0x498701[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0x498701[_0x3bb6('0x33')],function(_0x32f5d4){var _0x26e096={};_0x26e096[_0x32f5d4]={'$like':'%'+_0x49c082[_0x3bb6('0x2f')][_0x3bb6('0x3c')]+'%'};return _0x26e096;})});}_0x498701=_[_0x3bb6('0x3f')]({},_0x498701,_0x49c082[_0x3bb6('0x40')]);return db[_0x3bb6('0x64')]['findAndCountAll'](_0x498701);}})[_0x3bb6('0x23')](respondWithResult(_0x3621b7,null))[_0x3bb6('0x43')](handleError(_0x3621b7,null));};exports[_0x3bb6('0x84')]=function(_0x39a57c,_0x4d2ad7,_0x58facc){return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0x39a57c['params']['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0x4d2ad7,null))['then'](function(_0x4835c9){if(_0x4835c9){return _0x4835c9[_0x3bb6('0x84')](_0x39a57c[_0x3bb6('0x48')][_0x3bb6('0x5f')],_['omit'](_0x39a57c[_0x3bb6('0x48')],[_0x3bb6('0x5f'),'id'])||{})[_0x3bb6('0x85')](function(_0x195dc2){for(var _0x24fb0a=0x0;_0x24fb0a<_0x39a57c[_0x3bb6('0x48')]['ids'][_0x3bb6('0x35')];_0x24fb0a+=0x1){socket[_0x3bb6('0x86')](_0x3bb6('0x87'),{'UserId':_0x39a57c[_0x3bb6('0x48')]['ids'][_0x24fb0a],'CmListId':_0x39a57c['params']['id']});}return _0x195dc2;});}})['then'](respondWithResult(_0x4d2ad7,null))[_0x3bb6('0x43')](handleError(_0x4d2ad7,null));};exports[_0x3bb6('0x88')]=function(_0x55ab71,_0xf6d2e7,_0xb88bf3){return db[_0x3bb6('0x2a')][_0x3bb6('0x4f')]({'where':{'id':_0x55ab71['params']['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0xf6d2e7,null))[_0x3bb6('0x23')](function(_0x46da74){if(_0x46da74){return _0x46da74[_0x3bb6('0x88')](_0x55ab71[_0x3bb6('0x2f')][_0x3bb6('0x5f')])[_0x3bb6('0x23')](function(){if(_['isArray'](_0x55ab71[_0x3bb6('0x2f')][_0x3bb6('0x5f')])){for(var _0x3af00b=0x0;_0x3af00b<_0x55ab71['query'][_0x3bb6('0x5f')][_0x3bb6('0x35')];_0x3af00b+=0x1){socket['emit'](_0x3bb6('0x89'),{'UserId':Number(_0x55ab71[_0x3bb6('0x2f')][_0x3bb6('0x5f')][_0x3af00b]),'CmListId':Number(_0x55ab71[_0x3bb6('0x45')]['id'])});}}else{socket['emit'](_0x3bb6('0x89'),{'UserId':Number(_0x55ab71[_0x3bb6('0x2f')][_0x3bb6('0x5f')]),'CmListId':Number(_0x55ab71[_0x3bb6('0x45')]['id'])});}});}})[_0x3bb6('0x23')](respondWithStatusCode(_0xf6d2e7,null))['catch'](handleError(_0xf6d2e7,null));};exports[_0x3bb6('0x8a')]=function(_0x757dc4,_0x287371,_0x2f5c35){var _0x1660ef={};var _0x393882={};var _0x4b8508;var _0x215f18;return db[_0x3bb6('0x2a')][_0x3bb6('0x83')]({'where':{'id':_0x757dc4[_0x3bb6('0x45')]['id']}})[_0x3bb6('0x23')](handleEntityNotFound(_0x287371,null))['then'](function(_0x1d4378){if(_0x1d4378){_0x4b8508=_0x1d4378;_0x393882['model']=_[_0x3bb6('0x30')](db[_0x3bb6('0x8b')][_0x3bb6('0x46')]);_0x393882[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x757dc4['query']);_0x393882[_0x3bb6('0x31')]=_[_0x3bb6('0x32')](_0x393882[_0x3bb6('0x2e')],_0x393882[_0x3bb6('0x2f')]);_0x1660ef['attributes']=_[_0x3bb6('0x32')](_0x393882[_0x3bb6('0x2e')],qs['fields'](_0x757dc4[_0x3bb6('0x2f')][_0x3bb6('0x34')]));_0x1660ef[_0x3bb6('0x33')]=_0x1660ef[_0x3bb6('0x33')][_0x3bb6('0x35')]?_0x1660ef[_0x3bb6('0x33')]:_0x393882['model'];_0x1660ef['order']=qs[_0x3bb6('0x3a')](_0x757dc4[_0x3bb6('0x2f')]['sort']);_0x1660ef[_0x3bb6('0x3d')]=qs[_0x3bb6('0x31')](_['pick'](_0x757dc4[_0x3bb6('0x2f')],_0x393882[_0x3bb6('0x31')]));if(_0x757dc4['query']['filter']){_0x1660ef[_0x3bb6('0x3d')]=_[_0x3bb6('0x3f')](_0x1660ef[_0x3bb6('0x3d')],{'$or':_[_0x3bb6('0x29')](_0x1660ef['attributes'],function(_0x1a9ee8){var _0x15eb13={};_0x15eb13[_0x1a9ee8]={'$like':'%'+_0x757dc4['query'][_0x3bb6('0x3c')]+'%'};return _0x15eb13;})});}_0x1660ef=_[_0x3bb6('0x3f')]({},_0x1660ef,_0x757dc4['options']);return _0x4b8508[_0x3bb6('0x8a')](_0x1660ef);}})[_0x3bb6('0x23')](function(_0xdf1f99){if(_0xdf1f99){_0x215f18=_0xdf1f99['length'];if(!_0x757dc4[_0x3bb6('0x2f')][_0x3bb6('0x36')]('nolimit')){_0x1660ef[_0x3bb6('0x1d')]=qs[_0x3bb6('0x1d')](_0x757dc4[_0x3bb6('0x2f')][_0x3bb6('0x1d')]);_0x1660ef[_0x3bb6('0x38')]=qs[_0x3bb6('0x38')](_0x757dc4[_0x3bb6('0x2f')][_0x3bb6('0x38')]);}return _0x4b8508[_0x3bb6('0x8a')](_0x1660ef);}})[_0x3bb6('0x23')](function(_0x2f091c){if(_0x2f091c){return _0x2f091c?{'count':_0x215f18,'rows':_0x2f091c}:null;}})[_0x3bb6('0x23')](respondWithResult(_0x287371,null))[_0x3bb6('0x43')](handleError(_0x287371,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4972690..513f62a 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 _0xb1d0=['update','emit','hasOwnProperty','hook','events','../../mysqldb','save'];(function(_0x2e9d1e,_0x40d95a){var _0xfe5c52=function(_0x2cac93){while(--_0x2cac93){_0x2e9d1e['push'](_0x2e9d1e['shift']());}};_0xfe5c52(++_0x40d95a);}(_0xb1d0,0x154));var _0x0b1d=function(_0x33d581,_0x2da6d0){_0x33d581=_0x33d581-0x0;var _0x3320da=_0xb1d0[_0x33d581];return _0x3320da;};'use strict';var EventEmitter=require(_0x0b1d('0x0'));var CmList=require(_0x0b1d('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0b1d('0x2'),'afterUpdate':_0x0b1d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1eb3ae){return function(_0x56b5d1,_0x3240b0,_0x41f50f){CmListEvents['emit'](_0x1eb3ae+':'+_0x56b5d1['id'],_0x56b5d1);CmListEvents[_0x0b1d('0x4')](_0x1eb3ae,_0x56b5d1);_0x41f50f(null);};}for(var e in events){if(events[_0x0b1d('0x5')](e)){var event=events[e];CmList[_0x0b1d('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0xbd07=['update','remove','emit','hasOwnProperty','hook','exports','CmList','setMaxListeners'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbd07,0xe6));var _0x7bd0=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xbd07[_0x231e16];return _0x570a7c;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db'][_0x7bd0('0x0')];var CmListEvents=new EventEmitter();CmListEvents[_0x7bd0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7bd0('0x2'),'afterDestroy':_0x7bd0('0x3')};function emitEvent(_0x568766){return function(_0x2896b0,_0x334122,_0x1826c4){CmListEvents[_0x7bd0('0x4')](_0x568766+':'+_0x2896b0['id'],_0x2896b0);CmListEvents[_0x7bd0('0x4')](_0x568766,_0x2896b0);_0x1826c4(null);};}for(var e in events){if(events[_0x7bd0('0x5')](e)){var event=events[e];CmList[_0x7bd0('0x6')](e,emitEvent(event));}}module[_0x7bd0('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 9208fbd..fe868ca 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 _0x8e77=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','define','CmList','cm_lists','lodash','../../config/logger','api'];(function(_0x2b0da5,_0x5bc04c){var _0x29b500=function(_0x29d7f2){while(--_0x29d7f2){_0x2b0da5['push'](_0x2b0da5['shift']());}};_0x29b500(++_0x5bc04c);}(_0x8e77,0x101));var _0x78e7=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0x8e77[_0x1b4c04];return _0x374f5d;};'use strict';var _=require(_0x78e7('0x0'));var util=require('util');var logger=require(_0x78e7('0x1'))(_0x78e7('0x2'));var moment=require(_0x78e7('0x3'));var BPromise=require(_0x78e7('0x4'));var rp=require(_0x78e7('0x5'));var fs=require('fs');var path=require(_0x78e7('0x6'));var rimraf=require(_0x78e7('0x7'));var config=require(_0x78e7('0x8'));var attributes=require(_0x78e7('0x9'));module['exports']=function(_0x598067,_0x1f738a){return _0x598067[_0x78e7('0xa')](_0x78e7('0xb'),attributes,{'tableName':_0x78e7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x184a=['exports','define','cm_lists','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x184a,0x16b));var _0xa184=function(_0x4ae133,_0x99a429){_0x4ae133=_0x4ae133-0x0;var _0x1931c0=_0x184a[_0x4ae133];return _0x1931c0;};'use strict';var _=require(_0xa184('0x0'));var util=require('util');var logger=require(_0xa184('0x1'))(_0xa184('0x2'));var moment=require(_0xa184('0x3'));var BPromise=require('bluebird');var rp=require(_0xa184('0x4'));var fs=require('fs');var path=require(_0xa184('0x5'));var rimraf=require(_0xa184('0x6'));var config=require(_0xa184('0x7'));var attributes=require(_0xa184('0x8'));module[_0xa184('0x9')]=function(_0xfed0d5,_0x5631eb){return _0xfed0d5[_0xa184('0xa')]('CmList',attributes,{'tableName':_0xa184('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 3a5c696..58cf153 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 _0x5a02=['defaults','localhost','./cmList.socket','register','request','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5a02,0x1e1));var _0x25a0=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x5a02[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require(_0x25a0('0x0'));var util=require(_0x25a0('0x1'));var moment=require(_0x25a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x25a0('0x3'));var fs=require('fs');var Redis=require(_0x25a0('0x4'));var db=require(_0x25a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x25a0('0x6'))(_0x25a0('0x7'));var config=require(_0x25a0('0x8'));var jayson=require(_0x25a0('0x9'));var client=jayson[_0x25a0('0xa')][_0x25a0('0xb')]({'port':0x232a});config[_0x25a0('0xc')]=_[_0x25a0('0xd')](config[_0x25a0('0xc')],{'host':_0x25a0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x25a0('0xf'))[_0x25a0('0x10')](socket);function respondWithRpcPromise(_0x4d3407,_0x24b430,_0x255851){return new BPromise(function(_0xa61b2e,_0x5ea58d){return client[_0x25a0('0x11')](_0x4d3407,_0x255851)['then'](function(_0x53137b){logger[_0x25a0('0x12')]('CmList,\x20%s,\x20%s',_0x24b430,_0x25a0('0x13'));logger['debug'](_0x25a0('0x14'),_0x24b430,_0x25a0('0x13'),JSON['stringify'](_0x53137b));if(_0x53137b[_0x25a0('0x15')]){if(_0x53137b[_0x25a0('0x15')][_0x25a0('0x16')]===0x1f4){logger[_0x25a0('0x15')](_0x25a0('0x17'),_0x24b430,_0x53137b['error'][_0x25a0('0x18')]);return _0x5ea58d(_0x53137b[_0x25a0('0x15')][_0x25a0('0x18')]);}logger['error'](_0x25a0('0x17'),_0x24b430,_0x53137b[_0x25a0('0x15')][_0x25a0('0x18')]);return _0xa61b2e(_0x53137b[_0x25a0('0x15')][_0x25a0('0x18')]);}else{logger[_0x25a0('0x12')](_0x25a0('0x17'),_0x24b430,_0x25a0('0x13'));_0xa61b2e(_0x53137b['result'][_0x25a0('0x18')]);}})[_0x25a0('0x19')](function(_0x285ab5){logger[_0x25a0('0x15')](_0x25a0('0x17'),_0x24b430,_0x285ab5);_0x5ea58d(_0x285ab5);});});} \ No newline at end of file +var _0x3610=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x115e90,_0x12b067){var _0x4c03c7=function(_0x1802b8){while(--_0x1802b8){_0x115e90['push'](_0x115e90['shift']());}};_0x4c03c7(++_0x12b067);}(_0x3610,0x156));var _0x0361=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x3610[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0x0361('0x0'));var moment=require(_0x0361('0x1'));var BPromise=require(_0x0361('0x2'));var rs=require(_0x0361('0x3'));var fs=require('fs');var Redis=require(_0x0361('0x4'));var db=require(_0x0361('0x5'))['db'];var utils=require(_0x0361('0x6'));var logger=require(_0x0361('0x7'))(_0x0361('0x8'));var config=require(_0x0361('0x9'));var jayson=require(_0x0361('0xa'));var client=jayson[_0x0361('0xb')]['http']({'port':0x232a});config[_0x0361('0xc')]=_[_0x0361('0xd')](config['redis'],{'host':_0x0361('0xe'),'port':0x18eb});var socket=require(_0x0361('0xf'))(new Redis(config[_0x0361('0xc')]));require(_0x0361('0x10'))[_0x0361('0x11')](socket);function respondWithRpcPromise(_0x2c2086,_0x30e62b,_0x332091){return new BPromise(function(_0x5edf47,_0x5d3deb){return client['request'](_0x2c2086,_0x332091)['then'](function(_0x45adc9){logger[_0x0361('0x12')](_0x0361('0x13'),_0x30e62b,_0x0361('0x14'));logger[_0x0361('0x15')](_0x0361('0x16'),_0x30e62b,_0x0361('0x14'),JSON['stringify'](_0x45adc9));if(_0x45adc9[_0x0361('0x17')]){if(_0x45adc9['error'][_0x0361('0x18')]===0x1f4){logger[_0x0361('0x17')](_0x0361('0x13'),_0x30e62b,_0x45adc9[_0x0361('0x17')][_0x0361('0x19')]);return _0x5d3deb(_0x45adc9['error'][_0x0361('0x19')]);}logger[_0x0361('0x17')](_0x0361('0x13'),_0x30e62b,_0x45adc9[_0x0361('0x17')]['message']);return _0x5edf47(_0x45adc9['error'][_0x0361('0x19')]);}else{logger[_0x0361('0x12')](_0x0361('0x13'),_0x30e62b,_0x0361('0x14'));_0x5edf47(_0x45adc9['result']['message']);}})[_0x0361('0x1a')](function(_0x5f3ad0){logger[_0x0361('0x17')](_0x0361('0x13'),_0x30e62b,_0x5f3ad0);_0x5d3deb(_0x5f3ad0);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index b5d2622..c5500fc 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 _0x5e11=['register','length','cmList:','./cmList.events','remove','update','emit'];(function(_0x49f32f,_0x5e8968){var _0x3b274d=function(_0x32d562){while(--_0x32d562){_0x49f32f['push'](_0x49f32f['shift']());}};_0x3b274d(++_0x5e8968);}(_0x5e11,0x1c3));var _0x15e1=function(_0x5f08a6,_0x400121){_0x5f08a6=_0x5f08a6-0x0;var _0x5d0641=_0x5e11[_0x5f08a6];return _0x5d0641;};'use strict';var CmListEvents=require(_0x15e1('0x0'));var events=['save',_0x15e1('0x1'),_0x15e1('0x2')];function createListener(_0x197058,_0xd2c9d9){return function(_0x82943a){_0xd2c9d9[_0x15e1('0x3')](_0x197058,_0x82943a);};}function removeListener(_0x598eda,_0x2409d8){return function(){CmListEvents['removeListener'](_0x598eda,_0x2409d8);};}exports[_0x15e1('0x4')]=function(_0x41b56c){for(var _0xa0d783=0x0,_0xfabd74=events[_0x15e1('0x5')];_0xa0d783<_0xfabd74;_0xa0d783++){var _0x50b131=events[_0xa0d783];var _0xe0b339=createListener(_0x15e1('0x6')+_0x50b131,_0x41b56c);CmListEvents['on'](_0x50b131,_0xe0b339);}}; \ No newline at end of file +var _0x0fcd=['removeListener','register','cmList:','save','remove','update'];(function(_0xd048a8,_0x47fbae){var _0x5f5013=function(_0xbf381f){while(--_0xbf381f){_0xd048a8['push'](_0xd048a8['shift']());}};_0x5f5013(++_0x47fbae);}(_0x0fcd,0x129));var _0xd0fc=function(_0x149182,_0x417bc2){_0x149182=_0x149182-0x0;var _0x100223=_0x0fcd[_0x149182];return _0x100223;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xd0fc('0x0'),_0xd0fc('0x1'),_0xd0fc('0x2')];function createListener(_0x7d13c6,_0x3e8013){return function(_0x1a3aa8){_0x3e8013['emit'](_0x7d13c6,_0x1a3aa8);};}function removeListener(_0x46c92d,_0x3552fc){return function(){CmListEvents[_0xd0fc('0x3')](_0x46c92d,_0x3552fc);};}exports[_0xd0fc('0x4')]=function(_0x5507ff){for(var _0x32b1c5=0x0,_0x5d93cc=events['length'];_0x32b1c5<_0x5d93cc;_0x32b1c5++){var _0x5ad581=events[_0x32b1c5];var _0x5e42a1=createListener(_0xd0fc('0x5')+_0x5ad581,_0x5507ff);CmListEvents['on'](_0x5ad581,_0x5e42a1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index bead5c1..4d118dc 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 _0x91f0=['/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','multer','util','express','Router','../../components/auth/service','./cmList.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x91f0,0x11a));var _0x091f=function(_0x2f1777,_0x320c52){_0x2f1777=_0x2f1777-0x0;var _0x197f42=_0x91f0[_0x2f1777];return _0x197f42;};'use strict';var multer=require(_0x091f('0x0'));var util=require(_0x091f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x091f('0x2'));var router=express[_0x091f('0x3')]();var auth=require(_0x091f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x091f('0x5'));router['get']('/',auth[_0x091f('0x6')](),controller[_0x091f('0x7')]);router[_0x091f('0x8')](_0x091f('0x9'),auth[_0x091f('0x6')](),controller['describe']);router[_0x091f('0x8')](_0x091f('0xa'),auth[_0x091f('0x6')](),controller[_0x091f('0xb')]);router[_0x091f('0x8')](_0x091f('0xc'),auth[_0x091f('0x6')](),controller[_0x091f('0xd')]);router[_0x091f('0x8')](_0x091f('0xe'),auth[_0x091f('0x6')](),controller['getContacts']);router[_0x091f('0x8')](_0x091f('0xf'),auth['isAuthenticated'](),controller[_0x091f('0x10')]);router[_0x091f('0x8')]('/:id/fields',auth[_0x091f('0x6')](),controller[_0x091f('0x11')]);router[_0x091f('0x8')](_0x091f('0x12'),auth[_0x091f('0x6')](),controller[_0x091f('0x13')]);router[_0x091f('0x14')]('/',auth[_0x091f('0x6')](),controller[_0x091f('0x15')]);router[_0x091f('0x14')](_0x091f('0xc'),auth[_0x091f('0x6')](),controller[_0x091f('0x16')]);router[_0x091f('0x14')](_0x091f('0xe'),auth[_0x091f('0x6')](),controller[_0x091f('0x17')]);router['post'](_0x091f('0x18'),auth[_0x091f('0x6')](),controller[_0x091f('0x19')]);router['post'](_0x091f('0x12'),auth[_0x091f('0x6')](),controller[_0x091f('0x1a')]);router[_0x091f('0x1b')]('/:id',auth[_0x091f('0x6')](),controller[_0x091f('0x1c')]);router['delete'](_0x091f('0xa'),auth[_0x091f('0x6')](),controller[_0x091f('0x1d')]);router[_0x091f('0x1e')]('/:id/dispositions',auth[_0x091f('0x6')](),controller[_0x091f('0x1f')]);router[_0x091f('0x1e')]('/:id/users',auth['isAuthenticated'](),controller[_0x091f('0x20')]);module['exports']=router; \ No newline at end of file +var _0x8ae8=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','create','addDisposition','post','/:id/fields','addCustomField','put','delete'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x8ae8,0xda));var _0x88ae=function(_0x165189,_0x19a741){_0x165189=_0x165189-0x0;var _0x44826b=_0x8ae8[_0x165189];return _0x44826b;};'use strict';var multer=require(_0x88ae('0x0'));var util=require(_0x88ae('0x1'));var path=require(_0x88ae('0x2'));var timeout=require(_0x88ae('0x3'));var express=require(_0x88ae('0x4'));var router=express[_0x88ae('0x5')]();var auth=require(_0x88ae('0x6'));var interaction=require(_0x88ae('0x7'));var config=require(_0x88ae('0x8'));var controller=require(_0x88ae('0x9'));router[_0x88ae('0xa')]('/',auth['isAuthenticated'](),controller[_0x88ae('0xb')]);router[_0x88ae('0xa')](_0x88ae('0xc'),auth['isAuthenticated'](),controller[_0x88ae('0xd')]);router[_0x88ae('0xa')](_0x88ae('0xe'),auth[_0x88ae('0xf')](),controller['show']);router[_0x88ae('0xa')](_0x88ae('0x10'),auth[_0x88ae('0xf')](),controller['getDispositions']);router[_0x88ae('0xa')](_0x88ae('0x11'),auth[_0x88ae('0xf')](),controller['getContacts']);router[_0x88ae('0xa')](_0x88ae('0x12'),auth[_0x88ae('0xf')](),controller[_0x88ae('0x13')]);router['get']('/:id/fields',auth[_0x88ae('0xf')](),controller[_0x88ae('0x14')]);router[_0x88ae('0xa')](_0x88ae('0x15'),auth['isAuthenticated'](),controller[_0x88ae('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0x88ae('0x17')]);router['post'](_0x88ae('0x10'),auth[_0x88ae('0xf')](),controller[_0x88ae('0x18')]);router[_0x88ae('0x19')]('/:id/contacts',auth[_0x88ae('0xf')](),controller['addContacts']);router['post'](_0x88ae('0x1a'),auth[_0x88ae('0xf')](),controller[_0x88ae('0x1b')]);router['post']('/:id/users',auth[_0x88ae('0xf')](),controller['addAgents']);router[_0x88ae('0x1c')](_0x88ae('0xe'),auth[_0x88ae('0xf')](),controller['update']);router[_0x88ae('0x1d')](_0x88ae('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x88ae('0x10'),auth[_0x88ae('0xf')](),controller['removeDispositions']);router[_0x88ae('0x1d')](_0x88ae('0x15'),auth[_0x88ae('0xf')](),controller['removeAgents']);module[_0x88ae('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c404451..3fca69a 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x551a48,_0x2ac130){var _0x56536d=function(_0x189fa4){while(--_0x189fa4){_0x551a48['push'](_0x551a48['shift']());}};_0x56536d(++_0x2ac130);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x283066,_0x3afd94){var _0x5001ef=function(_0x45b1e5){while(--_0x45b1e5){_0x283066['push'](_0x283066['shift']());}};_0x5001ef(++_0x3afd94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 2fe78ef..a46eb8d 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 _0xa8e2=['send','body','find','params','destroy','Condition','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','set','apply','reject','update','then','end','stack','name'];(function(_0x40c318,_0x15aea7){var _0x3f032c=function(_0x517032){while(--_0x517032){_0x40c318['push'](_0x40c318['shift']());}};_0x3f032c(++_0x15aea7);}(_0xa8e2,0x14e));var _0x2a8e=function(_0x1e7fee,_0x3dce9d){_0x1e7fee=_0x1e7fee-0x0;var _0x43e55b=_0xa8e2[_0x1e7fee];return _0x43e55b;};'use strict';var pdf=require(_0x2a8e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2a8e('0x1'));var zipdir=require(_0x2a8e('0x2'));var jsonpatch=require(_0x2a8e('0x3'));var rp=require(_0x2a8e('0x4'));var moment=require(_0x2a8e('0x5'));var BPromise=require(_0x2a8e('0x6'));var Mustache=require('mustache');var util=require(_0x2a8e('0x7'));var path=require(_0x2a8e('0x8'));var sox=require(_0x2a8e('0x9'));var csv=require(_0x2a8e('0xa'));var ejs=require(_0x2a8e('0xb'));var fs=require('fs');var _=require(_0x2a8e('0xc'));var squel=require(_0x2a8e('0xd'));var crypto=require(_0x2a8e('0xe'));var jsforce=require(_0x2a8e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2a8e('0xa'));var querystring=require('querystring');var Papa=require(_0x2a8e('0x10'));var Redis=require(_0x2a8e('0x11'));var authService=require(_0x2a8e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2a8e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a8e('0x14'))('api');var utils=require(_0x2a8e('0x15'));var config=require(_0x2a8e('0x16'));var db=require(_0x2a8e('0x17'))['db'];function respondWithStatusCode(_0x886e95,_0x5cfa00){_0x5cfa00=_0x5cfa00||0xcc;return function(_0x50186e){if(_0x50186e){return _0x886e95['sendStatus'](_0x5cfa00);}return _0x886e95[_0x2a8e('0x18')](_0x5cfa00)['end']();};}function respondWithResult(_0x18c844,_0x3ae693){_0x3ae693=_0x3ae693||0xc8;return function(_0x511481){if(_0x511481){return _0x18c844[_0x2a8e('0x18')](_0x3ae693)[_0x2a8e('0x19')](_0x511481);}};}function respondWithFilteredResult(_0x40dc6c,_0x4112e6){return function(_0x210784){if(_0x210784){var _0x5bda2a=_0x210784['count'],_0x4b99ec=_0x4112e6[_0x2a8e('0x1a')],_0x62cec1=_0x4112e6['offset']+_0x4112e6['limit'],_0x37da38;if(_0x62cec1>=_0x5bda2a){_0x62cec1=_0x5bda2a;_0x37da38=0xc8;}else{_0x37da38=0xce;}_0x40dc6c[_0x2a8e('0x18')](_0x37da38);return _0x40dc6c[_0x2a8e('0x1b')]('Content-Range',_0x4b99ec+'-'+_0x62cec1+'/'+_0x5bda2a)[_0x2a8e('0x19')](_0x210784);}return null;};}function patchUpdates(_0x326331){return function(_0x108028){try{jsonpatch[_0x2a8e('0x1c')](_0x108028,_0x326331,!![]);}catch(_0x4b560d){return BPromise[_0x2a8e('0x1d')](_0x4b560d);}return _0x108028['save']();};}function saveUpdates(_0x5524f9,_0x4891ce){return function(_0x420e60){if(_0x420e60){return _0x420e60[_0x2a8e('0x1e')](_0x5524f9)['then'](function(_0xec3a5d){return _0xec3a5d;});}return null;};}function removeEntity(_0x54bdb5,_0x5a2d2d){return function(_0x203b89){if(_0x203b89){return _0x203b89['destroy']()[_0x2a8e('0x1f')](function(){_0x54bdb5[_0x2a8e('0x18')](0xcc)[_0x2a8e('0x20')]();});}};}function handleEntityNotFound(_0x5360a9,_0x72f454){return function(_0x2b2fd9){if(!_0x2b2fd9){_0x5360a9['sendStatus'](0x194);}return _0x2b2fd9;};}function handleError(_0x3f6b22,_0x30206d){_0x30206d=_0x30206d||0x1f4;return function(_0xefa590){logger['error'](_0xefa590[_0x2a8e('0x21')]);if(_0xefa590[_0x2a8e('0x22')]){delete _0xefa590[_0x2a8e('0x22')];}_0x3f6b22[_0x2a8e('0x18')](_0x30206d)[_0x2a8e('0x23')](_0xefa590);};}exports[_0x2a8e('0x1e')]=function(_0x5a58fd,_0x4841ab){if(_0x5a58fd[_0x2a8e('0x24')]['id']){delete _0x5a58fd['body']['id'];}return db['Condition'][_0x2a8e('0x25')]({'where':{'id':_0x5a58fd[_0x2a8e('0x26')]['id']}})[_0x2a8e('0x1f')](handleEntityNotFound(_0x4841ab,null))[_0x2a8e('0x1f')](saveUpdates(_0x5a58fd[_0x2a8e('0x24')],null))[_0x2a8e('0x1f')](respondWithResult(_0x4841ab,null))['catch'](handleError(_0x4841ab,null));};exports[_0x2a8e('0x27')]=function(_0x4e834f,_0x2a41fb){return db[_0x2a8e('0x28')][_0x2a8e('0x25')]({'where':{'id':_0x4e834f[_0x2a8e('0x26')]['id']}})[_0x2a8e('0x1f')](handleEntityNotFound(_0x2a41fb,null))[_0x2a8e('0x1f')](removeEntity(_0x2a41fb,null))['catch'](handleError(_0x2a41fb,null));}; \ No newline at end of file +var _0x0499=['name','send','body','Condition','params','catch','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0xdd3e46,_0x4ddaed){var _0x191b08=function(_0x46c876){while(--_0x46c876){_0xdd3e46['push'](_0xdd3e46['shift']());}};_0x191b08(++_0x4ddaed);}(_0x0499,0x91));var _0x9049=function(_0x40bb16,_0x2476f3){_0x40bb16=_0x40bb16-0x0;var _0x2d7f94=_0x0499[_0x40bb16];return _0x2d7f94;};'use strict';var pdf=require(_0x9049('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9049('0x1'));var zipdir=require(_0x9049('0x2'));var jsonpatch=require(_0x9049('0x3'));var rp=require(_0x9049('0x4'));var moment=require(_0x9049('0x5'));var BPromise=require(_0x9049('0x6'));var Mustache=require(_0x9049('0x7'));var util=require(_0x9049('0x8'));var path=require(_0x9049('0x9'));var sox=require(_0x9049('0xa'));var csv=require(_0x9049('0xb'));var ejs=require(_0x9049('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9049('0xd'));var jsforce=require(_0x9049('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9049('0xb'));var querystring=require(_0x9049('0xf'));var Papa=require(_0x9049('0x10'));var Redis=require(_0x9049('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9049('0x12'));var hardwareService=require(_0x9049('0x13'));var logger=require(_0x9049('0x14'))('api');var utils=require(_0x9049('0x15'));var config=require(_0x9049('0x16'));var db=require(_0x9049('0x17'))['db'];function respondWithStatusCode(_0x527f54,_0x48b13b){_0x48b13b=_0x48b13b||0xcc;return function(_0x515ed5){if(_0x515ed5){return _0x527f54[_0x9049('0x18')](_0x48b13b);}return _0x527f54[_0x9049('0x19')](_0x48b13b)[_0x9049('0x1a')]();};}function respondWithResult(_0x5aa82e,_0x557cda){_0x557cda=_0x557cda||0xc8;return function(_0x216651){if(_0x216651){return _0x5aa82e['status'](_0x557cda)[_0x9049('0x1b')](_0x216651);}};}function respondWithFilteredResult(_0x2e1629,_0x69d96c){return function(_0x54b4d3){if(_0x54b4d3){var _0x2f0382=_0x54b4d3['count'],_0xf86cd0=_0x69d96c[_0x9049('0x1c')],_0x2063b7=_0x69d96c[_0x9049('0x1c')]+_0x69d96c['limit'],_0x1466bb;if(_0x2063b7>=_0x2f0382){_0x2063b7=_0x2f0382;_0x1466bb=0xc8;}else{_0x1466bb=0xce;}_0x2e1629[_0x9049('0x19')](_0x1466bb);return _0x2e1629[_0x9049('0x1d')](_0x9049('0x1e'),_0xf86cd0+'-'+_0x2063b7+'/'+_0x2f0382)['json'](_0x54b4d3);}return null;};}function patchUpdates(_0x48f0a1){return function(_0x4b8298){try{jsonpatch[_0x9049('0x1f')](_0x4b8298,_0x48f0a1,!![]);}catch(_0x21c596){return BPromise[_0x9049('0x20')](_0x21c596);}return _0x4b8298[_0x9049('0x21')]();};}function saveUpdates(_0x1e7253,_0x5e7a0b){return function(_0x193d16){if(_0x193d16){return _0x193d16[_0x9049('0x22')](_0x1e7253)[_0x9049('0x23')](function(_0x4862d6){return _0x4862d6;});}return null;};}function removeEntity(_0x59e3b5,_0x1eccf2){return function(_0xb9b75f){if(_0xb9b75f){return _0xb9b75f[_0x9049('0x24')]()[_0x9049('0x23')](function(){_0x59e3b5['status'](0xcc)[_0x9049('0x1a')]();});}};}function handleEntityNotFound(_0x480108,_0xe87674){return function(_0x500aad){if(!_0x500aad){_0x480108[_0x9049('0x18')](0x194);}return _0x500aad;};}function handleError(_0x44d783,_0x29a2e0){_0x29a2e0=_0x29a2e0||0x1f4;return function(_0x4031cb){logger[_0x9049('0x25')](_0x4031cb[_0x9049('0x26')]);if(_0x4031cb[_0x9049('0x27')]){delete _0x4031cb['name'];}_0x44d783['status'](_0x29a2e0)[_0x9049('0x28')](_0x4031cb);};}exports[_0x9049('0x22')]=function(_0xfbf969,_0x2be220){if(_0xfbf969[_0x9049('0x29')]['id']){delete _0xfbf969[_0x9049('0x29')]['id'];}return db[_0x9049('0x2a')]['find']({'where':{'id':_0xfbf969[_0x9049('0x2b')]['id']}})[_0x9049('0x23')](handleEntityNotFound(_0x2be220,null))[_0x9049('0x23')](saveUpdates(_0xfbf969[_0x9049('0x29')],null))[_0x9049('0x23')](respondWithResult(_0x2be220,null))[_0x9049('0x2c')](handleError(_0x2be220,null));};exports['destroy']=function(_0x1091df,_0x2c622b){return db[_0x9049('0x2a')][_0x9049('0x2d')]({'where':{'id':_0x1091df[_0x9049('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2c622b,null))['then'](removeEntity(_0x2c622b,null))[_0x9049('0x2c')](handleError(_0x2c622b,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 9f32d95..a63e277 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 _0x5396=['Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','./condition.attributes','exports','define'];(function(_0x4e1b70,_0x148221){var _0x365ac7=function(_0x514b48){while(--_0x514b48){_0x4e1b70['push'](_0x4e1b70['shift']());}};_0x365ac7(++_0x148221);}(_0x5396,0x14c));var _0x6539=function(_0x1d4f6e,_0x25459c){_0x1d4f6e=_0x1d4f6e-0x0;var _0x56fa40=_0x5396[_0x1d4f6e];return _0x56fa40;};'use strict';var _=require(_0x6539('0x0'));var util=require(_0x6539('0x1'));var logger=require(_0x6539('0x2'))(_0x6539('0x3'));var moment=require(_0x6539('0x4'));var BPromise=require(_0x6539('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6539('0x6'));module[_0x6539('0x7')]=function(_0x15f32e,_0x23fc7e){return _0x15f32e[_0x6539('0x8')](_0x6539('0x9'),attributes,{'tableName':_0x6539('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde3a=['bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','tools_conditions','lodash','../../config/logger','api','moment'];(function(_0x2183c8,_0x31c322){var _0x7c4c31=function(_0x2418af){while(--_0x2418af){_0x2183c8['push'](_0x2183c8['shift']());}};_0x7c4c31(++_0x31c322);}(_0xde3a,0x125));var _0xade3=function(_0x3e9bab,_0x33fb58){_0x3e9bab=_0x3e9bab-0x0;var _0x13e263=_0xde3a[_0x3e9bab];return _0x13e263;};'use strict';var _=require(_0xade3('0x0'));var util=require('util');var logger=require(_0xade3('0x1'))(_0xade3('0x2'));var moment=require(_0xade3('0x3'));var BPromise=require(_0xade3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xade3('0x5'));var rimraf=require(_0xade3('0x6'));var config=require(_0xade3('0x7'));var attributes=require(_0xade3('0x8'));module[_0xade3('0x9')]=function(_0xd07f26,_0x31d49c){return _0xd07f26['define']('Condition',attributes,{'tableName':_0xade3('0xa'),'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 986d65b..a8aa68e 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 _0x978d=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','randomstring','ioredis'];(function(_0x4e3bd3,_0x4f9cc4){var _0x1fb687=function(_0x5e26d6){while(--_0x5e26d6){_0x4e3bd3['push'](_0x4e3bd3['shift']());}};_0x1fb687(++_0x4f9cc4);}(_0x978d,0x6b));var _0xd978=function(_0x5f1b23,_0x148527){_0x5f1b23=_0x5f1b23-0x0;var _0x54019b=_0x978d[_0x5f1b23];return _0x54019b;};'use strict';var _=require('lodash');var util=require(_0xd978('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd978('0x1'));var fs=require('fs');var Redis=require(_0xd978('0x2'));var db=require(_0xd978('0x3'))['db'];var utils=require(_0xd978('0x4'));var logger=require(_0xd978('0x5'))(_0xd978('0x6'));var config=require('../../config/environment');var jayson=require(_0xd978('0x7'));var client=jayson[_0xd978('0x8')][_0xd978('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50e03f,_0x2f2f83,_0xe9236e){return new BPromise(function(_0x46d2dd,_0x3c7050){return client[_0xd978('0xa')](_0x50e03f,_0xe9236e)[_0xd978('0xb')](function(_0x4668b5){logger['info'](_0xd978('0xc'),_0x2f2f83,_0xd978('0xd'));logger[_0xd978('0xe')](_0xd978('0xf'),_0x2f2f83,_0xd978('0xd'),JSON[_0xd978('0x10')](_0x4668b5));if(_0x4668b5[_0xd978('0x11')]){if(_0x4668b5[_0xd978('0x11')][_0xd978('0x12')]===0x1f4){logger['error'](_0xd978('0xc'),_0x2f2f83,_0x4668b5[_0xd978('0x11')][_0xd978('0x13')]);return _0x3c7050(_0x4668b5[_0xd978('0x11')]['message']);}logger[_0xd978('0x11')]('Condition,\x20%s,\x20%s',_0x2f2f83,_0x4668b5['error']['message']);return _0x46d2dd(_0x4668b5[_0xd978('0x11')][_0xd978('0x13')]);}else{logger[_0xd978('0x14')](_0xd978('0xc'),_0x2f2f83,_0xd978('0xd'));_0x46d2dd(_0x4668b5['result'][_0xd978('0x13')]);}})[_0xd978('0x15')](function(_0x2981ef){logger[_0xd978('0x11')](_0xd978('0xc'),_0x2f2f83,_0x2981ef);_0x3c7050(_0x2981ef);});});} \ No newline at end of file +var _0x82f6=['info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1c5731,_0x408a49){var _0x18f330=function(_0x1f9c40){while(--_0x1f9c40){_0x1c5731['push'](_0x1c5731['shift']());}};_0x18f330(++_0x408a49);}(_0x82f6,0xec));var _0x682f=function(_0x1a7685,_0x47e17a){_0x1a7685=_0x1a7685-0x0;var _0x255b8a=_0x82f6[_0x1a7685];return _0x255b8a;};'use strict';var _=require(_0x682f('0x0'));var util=require(_0x682f('0x1'));var moment=require('moment');var BPromise=require(_0x682f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x682f('0x3'));var db=require(_0x682f('0x4'))['db'];var utils=require(_0x682f('0x5'));var logger=require(_0x682f('0x6'))(_0x682f('0x7'));var config=require(_0x682f('0x8'));var jayson=require(_0x682f('0x9'));var client=jayson[_0x682f('0xa')][_0x682f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c7d1b,_0x1c4808,_0x27db53){return new BPromise(function(_0x317479,_0x17162a){return client[_0x682f('0xc')](_0x1c7d1b,_0x27db53)[_0x682f('0xd')](function(_0x516116){logger[_0x682f('0xe')](_0x682f('0xf'),_0x1c4808,_0x682f('0x10'));logger[_0x682f('0x11')](_0x682f('0x12'),_0x1c4808,_0x682f('0x10'),JSON[_0x682f('0x13')](_0x516116));if(_0x516116['error']){if(_0x516116[_0x682f('0x14')][_0x682f('0x15')]===0x1f4){logger['error'](_0x682f('0xf'),_0x1c4808,_0x516116[_0x682f('0x14')]['message']);return _0x17162a(_0x516116[_0x682f('0x14')][_0x682f('0x16')]);}logger[_0x682f('0x14')](_0x682f('0xf'),_0x1c4808,_0x516116[_0x682f('0x14')][_0x682f('0x16')]);return _0x317479(_0x516116[_0x682f('0x14')][_0x682f('0x16')]);}else{logger['info'](_0x682f('0xf'),_0x1c4808,'request\x20sent');_0x317479(_0x516116[_0x682f('0x17')][_0x682f('0x16')]);}})[_0x682f('0x18')](function(_0x3675a6){logger[_0x682f('0x14')](_0x682f('0xf'),_0x1c4808,_0x3675a6);_0x17162a(_0x3675a6);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0208163..1e0fc53 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 _0xc035=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','exports'];(function(_0x2dbe8d,_0x3c517d){var _0x2402c2=function(_0x297b84){while(--_0x297b84){_0x2dbe8d['push'](_0x2dbe8d['shift']());}};_0x2402c2(++_0x3c517d);}(_0xc035,0x134));var _0x5c03=function(_0x428d0a,_0x5ba1fb){_0x428d0a=_0x428d0a-0x0;var _0x266802=_0xc035[_0x428d0a];return _0x266802;};'use strict';var multer=require(_0x5c03('0x0'));var util=require(_0x5c03('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c03('0x2'));var router=express[_0x5c03('0x3')]();var auth=require(_0x5c03('0x4'));var interaction=require(_0x5c03('0x5'));var config=require(_0x5c03('0x6'));var controller=require(_0x5c03('0x7'));router[_0x5c03('0x8')](_0x5c03('0x9'),auth['isAuthenticated'](),controller[_0x5c03('0xa')]);router[_0x5c03('0xb')]('/:id',auth[_0x5c03('0xc')](),controller['destroy']);module[_0x5c03('0xd')]=router; \ No newline at end of file +var _0xb9eb=['../../components/auth/service','./condition.controller','put','/:id','isAuthenticated','update','multer','path','connect-timeout','express','Router'];(function(_0x4bde34,_0xaa7b76){var _0x57ef23=function(_0x371c99){while(--_0x371c99){_0x4bde34['push'](_0x4bde34['shift']());}};_0x57ef23(++_0xaa7b76);}(_0xb9eb,0x1d4));var _0xbb9e=function(_0x2b4807,_0x5f05ac){_0x2b4807=_0x2b4807-0x0;var _0x45d472=_0xb9eb[_0x2b4807];return _0x45d472;};'use strict';var multer=require(_0xbb9e('0x0'));var util=require('util');var path=require(_0xbb9e('0x1'));var timeout=require(_0xbb9e('0x2'));var express=require(_0xbb9e('0x3'));var router=express[_0xbb9e('0x4')]();var auth=require(_0xbb9e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb9e('0x6'));router[_0xbb9e('0x7')](_0xbb9e('0x8'),auth[_0xbb9e('0x9')](),controller[_0xbb9e('0xa')]);router['delete']('/:id',auth[_0xbb9e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 183e57c..0d56ee1 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32c0=['exports','name','INTEGER','sequelize'];(function(_0x31880d,_0x4f0ff3){var _0x423823=function(_0x57cc92){while(--_0x57cc92){_0x31880d['push'](_0x31880d['shift']());}};_0x423823(++_0x4f0ff3);}(_0x32c0,0x1f3));var _0x032c=function(_0x2f209c,_0x3bc148){_0x2f209c=_0x2f209c-0x0;var _0x400f2d=_0x32c0[_0x2f209c];return _0x400f2d;};'use strict';var Sequelize=require(_0x032c('0x0'));module[_0x032c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x032c('0x2')},'OrderBy':{'type':Sequelize[_0x032c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x7ae7=['INTEGER','STRING','sequelize','exports','name'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x7ae7,0xd9));var _0x77ae=function(_0x4915be,_0x3fbdd3){_0x4915be=_0x4915be-0x0;var _0x115aba=_0x7ae7[_0x4915be];return _0x115aba;};'use strict';var Sequelize=require(_0x77ae('0x0'));module[_0x77ae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x77ae('0x2')},'OrderBy':{'type':Sequelize[_0x77ae('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x77ae('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 510e4bb..fe0b9a9 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['rows','catch','params','create','body','user','get','ContactItemTypes','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','sendStatus','count','offset','status','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','options','includeAll','include','findAll'];(function(_0x32f632,_0x30dc81){var _0x40f3e5=function(_0x39c849){while(--_0x39c849){_0x32f632['push'](_0x32f632['shift']());}};_0x40f3e5(++_0x30dc81);}(_0x3e74,0x175));var _0x43e7=function(_0x342927,_0x3aa36b){_0x342927=_0x342927-0x0;var _0x5964d2=_0x3e74[_0x342927];return _0x5964d2;};'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'];function respondWithStatusCode(_0x3eb206,_0xc960ea){_0xc960ea=_0xc960ea||0xcc;return function(_0x2718d3){if(_0x2718d3){return _0x3eb206[_0x43e7('0x14')](_0xc960ea);}return _0x3eb206['status'](_0xc960ea)['end']();};}function respondWithResult(_0x2fcb36,_0x21fdd3){_0x21fdd3=_0x21fdd3||0xc8;return function(_0x44b0bd){if(_0x44b0bd){return _0x2fcb36['status'](_0x21fdd3)['json'](_0x44b0bd);}};}function respondWithFilteredResult(_0x16849c,_0x14c146){return function(_0x203378){if(_0x203378){var _0x328445=_0x203378[_0x43e7('0x15')],_0x4de324=_0x14c146[_0x43e7('0x16')],_0x5c4eaa=_0x14c146['offset']+_0x14c146['limit'],_0xdf16c;if(_0x5c4eaa>=_0x328445){_0x5c4eaa=_0x328445;_0xdf16c=0xc8;}else{_0xdf16c=0xce;}_0x16849c[_0x43e7('0x17')](_0xdf16c);return _0x16849c[_0x43e7('0x18')](_0x43e7('0x19'),_0x4de324+'-'+_0x5c4eaa+'/'+_0x328445)[_0x43e7('0x1a')](_0x203378);}return null;};}function patchUpdates(_0x3776f5){return function(_0x1f24fb){try{jsonpatch[_0x43e7('0x1b')](_0x1f24fb,_0x3776f5,!![]);}catch(_0x1441ef){return BPromise[_0x43e7('0x1c')](_0x1441ef);}return _0x1f24fb[_0x43e7('0x1d')]();};}function saveUpdates(_0x191dd5,_0x177ee1){return function(_0x4b5d64){if(_0x4b5d64){return _0x4b5d64[_0x43e7('0x1e')](_0x191dd5)[_0x43e7('0x1f')](function(_0x4b386b){return _0x4b386b;});}return null;};}function removeEntity(_0x2898b5,_0x3e281e){return function(_0x3945bb){if(_0x3945bb){return _0x3945bb[_0x43e7('0x20')]()[_0x43e7('0x1f')](function(){var _0x2f4cb4=_0x3945bb['get']({'plain':!![]});var _0x454359='ContactItemTypes';return db['UserProfileResource'][_0x43e7('0x20')]({'where':{'type':_0x454359,'resourceId':_0x2f4cb4['id']}})[_0x43e7('0x1f')](function(){return _0x3945bb;});})['then'](function(){_0x2898b5[_0x43e7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x326dab,_0x5c5e67){return function(_0x1af208){if(!_0x1af208){_0x326dab[_0x43e7('0x14')](0x194);}return _0x1af208;};}function handleError(_0x20888b,_0x405f85){_0x405f85=_0x405f85||0x1f4;return function(_0x51f4d7){logger['error'](_0x51f4d7[_0x43e7('0x21')]);if(_0x51f4d7['name']){delete _0x51f4d7[_0x43e7('0x22')];}_0x20888b[_0x43e7('0x17')](_0x405f85)[_0x43e7('0x23')](_0x51f4d7);};}exports[_0x43e7('0x24')]=function(_0x5087d7,_0x33a1a5){var _0x4690a6={},_0x45b675={},_0x50f9f5={'count':0x0,'rows':[]};var _0x442c3b=_[_0x43e7('0x25')](db[_0x43e7('0x26')][_0x43e7('0x27')],function(_0x3bf475){return{'name':_0x3bf475[_0x43e7('0x28')],'type':_0x3bf475[_0x43e7('0x29')][_0x43e7('0x2a')]};});_0x45b675[_0x43e7('0x2b')]=_[_0x43e7('0x25')](_0x442c3b,'name');_0x45b675[_0x43e7('0x2c')]=_[_0x43e7('0x2d')](_0x5087d7[_0x43e7('0x2c')]);_0x45b675[_0x43e7('0x2e')]=_[_0x43e7('0x2f')](_0x45b675['model'],_0x45b675[_0x43e7('0x2c')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x2f')](_0x45b675[_0x43e7('0x2b')],qs['fields'](_0x5087d7['query']['fields']));_0x4690a6[_0x43e7('0x30')]=_0x4690a6[_0x43e7('0x30')][_0x43e7('0x31')]?_0x4690a6[_0x43e7('0x30')]:_0x45b675[_0x43e7('0x2b')];if(!_0x5087d7[_0x43e7('0x2c')]['hasOwnProperty']('nolimit')){_0x4690a6['limit']=qs['limit'](_0x5087d7['query']['limit']);_0x4690a6['offset']=qs[_0x43e7('0x16')](_0x5087d7['query'][_0x43e7('0x16')]);}_0x4690a6[_0x43e7('0x32')]=qs[_0x43e7('0x33')](_0x5087d7[_0x43e7('0x2c')][_0x43e7('0x33')]);_0x4690a6[_0x43e7('0x34')]=qs[_0x43e7('0x2e')](_['pick'](_0x5087d7['query'],_0x45b675['filters']),_0x442c3b);if(_0x5087d7[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x4690a6[_0x43e7('0x34')]=_[_0x43e7('0x36')](_0x4690a6[_0x43e7('0x34')],{'$or':_[_0x43e7('0x25')](_0x442c3b,function(_0x1d4589){if(_0x1d4589[_0x43e7('0x29')]!=='VIRTUAL'){var _0x61ed8e={};_0x61ed8e[_0x1d4589[_0x43e7('0x22')]]={'$like':'%'+_0x5087d7['query'][_0x43e7('0x35')]+'%'};return _0x61ed8e;}})});}_0x4690a6=_['merge']({},_0x4690a6,_0x5087d7[_0x43e7('0x37')]);var _0x2ad008={'where':_0x4690a6[_0x43e7('0x34')]};return db[_0x43e7('0x26')][_0x43e7('0x15')](_0x2ad008)[_0x43e7('0x1f')](function(_0x5e731b){_0x50f9f5['count']=_0x5e731b;if(_0x5087d7[_0x43e7('0x2c')][_0x43e7('0x38')]){_0x4690a6[_0x43e7('0x39')]=[{'all':!![]}];}return db[_0x43e7('0x26')][_0x43e7('0x3a')](_0x4690a6);})['then'](function(_0x32a451){_0x50f9f5[_0x43e7('0x3b')]=_0x32a451;return _0x50f9f5;})['then'](respondWithFilteredResult(_0x33a1a5,_0x4690a6))[_0x43e7('0x3c')](handleError(_0x33a1a5,null));};exports['show']=function(_0x2ad8ef,_0x504101){var _0x3d81ae={'raw':!![],'where':{'id':_0x2ad8ef[_0x43e7('0x3d')]['id']}},_0x3b4235={};_0x3b4235[_0x43e7('0x2b')]=_['keys'](db['ContactItemType'][_0x43e7('0x27')]);_0x3b4235[_0x43e7('0x2c')]=_[_0x43e7('0x2d')](_0x2ad8ef[_0x43e7('0x2c')]);_0x3b4235['filters']=_['intersection'](_0x3b4235['model'],_0x3b4235[_0x43e7('0x2c')]);_0x3d81ae['attributes']=_[_0x43e7('0x2f')](_0x3b4235['model'],qs['fields'](_0x2ad8ef[_0x43e7('0x2c')]['fields']));_0x3d81ae[_0x43e7('0x30')]=_0x3d81ae[_0x43e7('0x30')][_0x43e7('0x31')]?_0x3d81ae[_0x43e7('0x30')]:_0x3b4235['model'];if(_0x2ad8ef[_0x43e7('0x2c')][_0x43e7('0x38')]){_0x3d81ae[_0x43e7('0x39')]=[{'all':!![]}];}_0x3d81ae=_[_0x43e7('0x36')]({},_0x3d81ae,_0x2ad8ef[_0x43e7('0x37')]);return db[_0x43e7('0x26')]['find'](_0x3d81ae)['then'](handleEntityNotFound(_0x504101,null))[_0x43e7('0x1f')](respondWithResult(_0x504101,null))[_0x43e7('0x3c')](handleError(_0x504101,null));};exports[_0x43e7('0x3e')]=function(_0x4c00a8,_0x5c1c18){return db['ContactItemType'][_0x43e7('0x3e')](_0x4c00a8[_0x43e7('0x3f')],{})['then'](function(_0x351ca2){var _0x47686e=_0x4c00a8[_0x43e7('0x40')]['get']({'plain':!![]});if(!_0x47686e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47686e['role']==='user'){var _0x214e7e=_0x351ca2[_0x43e7('0x41')]({'plain':!![]});var _0x52fea5=_0x43e7('0x42');return db[_0x43e7('0x43')][_0x43e7('0x44')]({'where':{'name':_0x52fea5,'userProfileId':_0x47686e[_0x43e7('0x45')]},'raw':!![]})['then'](function(_0x2718d5){if(_0x2718d5&&_0x2718d5['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x3e')]({'name':_0x214e7e[_0x43e7('0x22')],'resourceId':_0x214e7e['id'],'type':_0x2718d5[_0x43e7('0x22')],'sectionId':_0x2718d5['id']},{})[_0x43e7('0x1f')](function(){return _0x351ca2;});}else{return _0x351ca2;}})[_0x43e7('0x3c')](function(_0x2351cf){logger[_0x43e7('0x46')](_0x43e7('0x47'),_0x2351cf);throw _0x2351cf;});}return _0x351ca2;})[_0x43e7('0x1f')](respondWithResult(_0x5c1c18,0xc9))[_0x43e7('0x3c')](handleError(_0x5c1c18,null));};exports['update']=function(_0x119d34,_0x46c910){if(_0x119d34['body']['id']){delete _0x119d34[_0x43e7('0x3f')]['id'];}return db['ContactItemType'][_0x43e7('0x44')]({'where':{'id':_0x119d34[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x46c910,null))[_0x43e7('0x1f')](saveUpdates(_0x119d34[_0x43e7('0x3f')],null))['then'](respondWithResult(_0x46c910,null))['catch'](handleError(_0x46c910,null));};exports[_0x43e7('0x20')]=function(_0x2ab7ee,_0x399942){return db[_0x43e7('0x26')][_0x43e7('0x44')]({'where':{'id':_0x2ab7ee[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x399942,null))[_0x43e7('0x1f')](removeEntity(_0x399942,null))[_0x43e7('0x3c')](handleError(_0x399942,null));}; \ No newline at end of file +var _0x9c44=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','error','name','send','map','ContactItemType','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','order','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation'];(function(_0x2fa540,_0x35a2e6){var _0x3323c3=function(_0x5cfb2e){while(--_0x5cfb2e){_0x2fa540['push'](_0x2fa540['shift']());}};_0x3323c3(++_0x35a2e6);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){var _0x4f0b62=_0x527126['get']({'plain':!![]});var _0x2263ae=_0x49c4('0x21');return db[_0x49c4('0x22')][_0x49c4('0x23')]({'where':{'type':_0x2263ae,'resourceId':_0x4f0b62['id']}})['then'](function(){return _0x527126;});})['then'](function(){_0x2197d2[_0x49c4('0x16')](0xcc)[_0x49c4('0x15')]();});}};}function handleEntityNotFound(_0x565423,_0x207358){return function(_0x43e014){if(!_0x43e014){_0x565423[_0x49c4('0x14')](0x194);}return _0x43e014;};}function handleError(_0xa7a826,_0x531d92){_0x531d92=_0x531d92||0x1f4;return function(_0x543ea2){logger[_0x49c4('0x24')](_0x543ea2['stack']);if(_0x543ea2[_0x49c4('0x25')]){delete _0x543ea2[_0x49c4('0x25')];}_0xa7a826[_0x49c4('0x16')](_0x531d92)[_0x49c4('0x26')](_0x543ea2);};}exports['index']=function(_0x889909,_0x2b2793){var _0x46e04d={},_0x4f28a2={},_0x6329b3={'count':0x0,'rows':[]};var _0x29f835=_[_0x49c4('0x27')](db[_0x49c4('0x28')][_0x49c4('0x29')],function(_0x2cbd88){return{'name':_0x2cbd88[_0x49c4('0x2a')],'type':_0x2cbd88['type']['key']};});_0x4f28a2['model']=_[_0x49c4('0x27')](_0x29f835,_0x49c4('0x25'));_0x4f28a2[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x889909[_0x49c4('0x2b')]);_0x4f28a2['filters']=_[_0x49c4('0x2d')](_0x4f28a2[_0x49c4('0x2e')],_0x4f28a2[_0x49c4('0x2b')]);_0x46e04d[_0x49c4('0x2f')]=_['intersection'](_0x4f28a2['model'],qs[_0x49c4('0x30')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x46e04d[_0x49c4('0x2f')]=_0x46e04d[_0x49c4('0x2f')]['length']?_0x46e04d[_0x49c4('0x2f')]:_0x4f28a2[_0x49c4('0x2e')];if(!_0x889909[_0x49c4('0x2b')]['hasOwnProperty']('nolimit')){_0x46e04d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x1a')]);_0x46e04d[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x46e04d[_0x49c4('0x31')]=qs['sort'](_0x889909[_0x49c4('0x2b')]['sort']);_0x46e04d[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x889909[_0x49c4('0x2b')],_0x4f28a2['filters']),_0x29f835);if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x46e04d[_0x49c4('0x32')]=_['merge'](_0x46e04d[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x29f835,function(_0x178987){if(_0x178987[_0x49c4('0x36')]!==_0x49c4('0x37')){var _0x24c177={};_0x24c177[_0x178987[_0x49c4('0x25')]]={'$like':'%'+_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x24c177;}})});}_0x46e04d=_[_0x49c4('0x38')]({},_0x46e04d,_0x889909[_0x49c4('0x39')]);var _0x4e0663={'where':_0x46e04d[_0x49c4('0x32')]};return db[_0x49c4('0x28')][_0x49c4('0x18')](_0x4e0663)[_0x49c4('0x20')](function(_0x41ad28){_0x6329b3[_0x49c4('0x18')]=_0x41ad28;if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x46e04d[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x28')][_0x49c4('0x3c')](_0x46e04d);})[_0x49c4('0x20')](function(_0x326142){_0x6329b3['rows']=_0x326142;return _0x6329b3;})[_0x49c4('0x20')](respondWithFilteredResult(_0x2b2793,_0x46e04d))['catch'](handleError(_0x2b2793,null));};exports[_0x49c4('0x3d')]=function(_0x4915bc,_0x28d4fb){var _0x1480da={'raw':!![],'where':{'id':_0x4915bc[_0x49c4('0x3e')]['id']}},_0x239327={};_0x239327['model']=_['keys'](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x239327[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x4915bc['query']);_0x239327[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],_0x239327[_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x4915bc[_0x49c4('0x2b')]['fields']));_0x1480da[_0x49c4('0x2f')]=_0x1480da['attributes'][_0x49c4('0x3f')]?_0x1480da[_0x49c4('0x2f')]:_0x239327[_0x49c4('0x2e')];if(_0x4915bc[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x1480da['include']=[{'all':!![]}];}_0x1480da=_[_0x49c4('0x38')]({},_0x1480da,_0x4915bc[_0x49c4('0x39')]);return db[_0x49c4('0x28')][_0x49c4('0x40')](_0x1480da)[_0x49c4('0x20')](handleEntityNotFound(_0x28d4fb,null))[_0x49c4('0x20')](respondWithResult(_0x28d4fb,null))[_0x49c4('0x41')](handleError(_0x28d4fb,null));};exports['create']=function(_0x3bac1b,_0x5cfff9){return db[_0x49c4('0x28')][_0x49c4('0x42')](_0x3bac1b[_0x49c4('0x43')],{})[_0x49c4('0x20')](function(_0x2d8087){var _0x30bea5=_0x3bac1b[_0x49c4('0x44')]['get']({'plain':!![]});if(!_0x30bea5)throw new Error(_0x49c4('0x45'));if(_0x30bea5[_0x49c4('0x46')]==='user'){var _0x1e1ac4=_0x2d8087[_0x49c4('0x47')]({'plain':!![]});var _0xfbe179=_0x49c4('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xfbe179,'userProfileId':_0x30bea5[_0x49c4('0x48')]},'raw':!![]})['then'](function(_0x4597c3){if(_0x4597c3&&_0x4597c3[_0x49c4('0x49')]===0x0){return db[_0x49c4('0x22')][_0x49c4('0x42')]({'name':_0x1e1ac4[_0x49c4('0x25')],'resourceId':_0x1e1ac4['id'],'type':_0x4597c3[_0x49c4('0x25')],'sectionId':_0x4597c3['id']},{})[_0x49c4('0x20')](function(){return _0x2d8087;});}else{return _0x2d8087;}})['catch'](function(_0x1f26c2){logger[_0x49c4('0x24')](_0x49c4('0x4a'),_0x1f26c2);throw _0x1f26c2;});}return _0x2d8087;})[_0x49c4('0x20')](respondWithResult(_0x5cfff9,0xc9))[_0x49c4('0x41')](handleError(_0x5cfff9,null));};exports[_0x49c4('0x1f')]=function(_0x156748,_0x25d174){if(_0x156748[_0x49c4('0x43')]['id']){delete _0x156748[_0x49c4('0x43')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x156748[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x25d174,null))['then'](saveUpdates(_0x156748['body'],null))[_0x49c4('0x20')](respondWithResult(_0x25d174,null))['catch'](handleError(_0x25d174,null));};exports['destroy']=function(_0x3208c2,_0x4081a5){return db[_0x49c4('0x28')][_0x49c4('0x40')]({'where':{'id':_0x3208c2[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x4081a5,null))[_0x49c4('0x20')](removeEntity(_0x4081a5,null))['catch'](handleError(_0x4081a5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index d768b71..e2c3291 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb76d=['path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3d34f0,_0x4a5dc0){var _0x135ecd=function(_0x9a81d5){while(--_0x9a81d5){_0x3d34f0['push'](_0x3d34f0['shift']());}};_0x135ecd(++_0x4a5dc0);}(_0xb76d,0x119));var _0xdb76=function(_0x4476ac,_0x3088a3){_0x4476ac=_0x4476ac-0x0;var _0x5a4663=_0xb76d[_0x4476ac];return _0x5a4663;};'use strict';var _=require(_0xdb76('0x0'));var util=require('util');var logger=require(_0xdb76('0x1'))(_0xdb76('0x2'));var moment=require(_0xdb76('0x3'));var BPromise=require('bluebird');var rp=require(_0xdb76('0x4'));var fs=require('fs');var path=require(_0xdb76('0x5'));var rimraf=require(_0xdb76('0x6'));var config=require(_0xdb76('0x7'));var attributes=require(_0xdb76('0x8'));module[_0xdb76('0x9')]=function(_0x5d80df,_0xf1a18d){return _0x5d80df[_0xdb76('0xa')](_0xdb76('0xb'),attributes,{'tableName':_0xdb76('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6e9=['define','tools_contact_item_types','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','exports'];(function(_0x121195,_0x2cd8b8){var _0x363aea=function(_0xa148f9){while(--_0xa148f9){_0x121195['push'](_0x121195['shift']());}};_0x363aea(++_0x2cd8b8);}(_0xe6e9,0x182));var _0x9e6e=function(_0x7d2c9f,_0xba0aca){_0x7d2c9f=_0x7d2c9f-0x0;var _0x2cc7ef=_0xe6e9[_0x7d2c9f];return _0x2cc7ef;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var logger=require(_0x9e6e('0x2'))('api');var moment=require(_0x9e6e('0x3'));var BPromise=require(_0x9e6e('0x4'));var rp=require(_0x9e6e('0x5'));var fs=require('fs');var path=require(_0x9e6e('0x6'));var rimraf=require(_0x9e6e('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e6e('0x8'));module[_0x9e6e('0x9')]=function(_0x206572,_0x1e8e5e){return _0x206572[_0x9e6e('0xa')]('ContactItemType',attributes,{'tableName':_0x9e6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 08dfed0..9227af2 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x24c38a,_0x3ee208){var _0xd55eb7=function(_0x4a7ec1){while(--_0x4a7ec1){_0x24c38a['push'](_0x24c38a['shift']());}};_0xd55eb7(++_0x3ee208);}(_0xb821,0xa7));var _0x1b82=function(_0x4b12fb,_0x20d036){_0x4b12fb=_0x4b12fb-0x0;var _0x451dfa=_0xb821[_0x4b12fb];return _0x451dfa;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file +var _0x2bdb=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s'];(function(_0x5d2131,_0x2c3c20){var _0x4d5914=function(_0x4b8e65){while(--_0x4b8e65){_0x5d2131['push'](_0x5d2131['shift']());}};_0x4d5914(++_0x2c3c20);}(_0x2bdb,0x105));var _0xb2bd=function(_0x3d6689,_0x482c10){_0x3d6689=_0x3d6689-0x0;var _0x33be64=_0x2bdb[_0x3d6689];return _0x33be64;};'use strict';var _=require(_0xb2bd('0x0'));var util=require('util');var moment=require(_0xb2bd('0x1'));var BPromise=require('bluebird');var rs=require(_0xb2bd('0x2'));var fs=require('fs');var Redis=require(_0xb2bd('0x3'));var db=require(_0xb2bd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2bd('0x5'))(_0xb2bd('0x6'));var config=require(_0xb2bd('0x7'));var jayson=require(_0xb2bd('0x8'));var client=jayson[_0xb2bd('0x9')][_0xb2bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bff5b,_0x5bae78,_0x21462b){return new BPromise(function(_0x4d9d3f,_0x181f5a){return client[_0xb2bd('0xb')](_0x3bff5b,_0x21462b)[_0xb2bd('0xc')](function(_0xeaa2b7){logger[_0xb2bd('0xd')](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));logger[_0xb2bd('0x10')](_0xb2bd('0x11'),_0x5bae78,'request\x20sent',JSON[_0xb2bd('0x12')](_0xeaa2b7));if(_0xeaa2b7[_0xb2bd('0x13')]){if(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x14')]===0x1f4){logger[_0xb2bd('0x13')](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x181f5a(_0xeaa2b7['error'][_0xb2bd('0x15')]);}logger['error'](_0xb2bd('0xe'),_0x5bae78,_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);return _0x4d9d3f(_0xeaa2b7[_0xb2bd('0x13')][_0xb2bd('0x15')]);}else{logger['info'](_0xb2bd('0xe'),_0x5bae78,_0xb2bd('0xf'));_0x4d9d3f(_0xeaa2b7[_0xb2bd('0x16')][_0xb2bd('0x15')]);}})['catch'](function(_0x14950f){logger[_0xb2bd('0x13')]('ContactItemType,\x20%s,\x20%s',_0x5bae78,_0x14950f);_0x181f5a(_0x14950f);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 7b07965..665b32c 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8747=['get','isAuthenticated','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x4185e3,_0xdcab5f){var _0x4892df=function(_0x3debbc){while(--_0x3debbc){_0x4185e3['push'](_0x4185e3['shift']());}};_0x4892df(++_0xdcab5f);}(_0x8747,0xf2));var _0x7874=function(_0x1352f0,_0x4cd565){_0x1352f0=_0x1352f0-0x0;var _0x1c2a82=_0x8747[_0x1352f0];return _0x1c2a82;};'use strict';var multer=require(_0x7874('0x0'));var util=require(_0x7874('0x1'));var path=require(_0x7874('0x2'));var timeout=require(_0x7874('0x3'));var express=require(_0x7874('0x4'));var router=express[_0x7874('0x5')]();var auth=require(_0x7874('0x6'));var interaction=require(_0x7874('0x7'));var config=require(_0x7874('0x8'));var controller=require(_0x7874('0x9'));router[_0x7874('0xa')]('/',auth[_0x7874('0xb')](),controller['index']);router[_0x7874('0xa')](_0x7874('0xc'),auth[_0x7874('0xb')](),controller[_0x7874('0xd')]);router['post']('/',auth[_0x7874('0xb')](),controller[_0x7874('0xe')]);router['put']('/:id',auth[_0x7874('0xb')](),controller[_0x7874('0xf')]);router['delete'](_0x7874('0xc'),auth[_0x7874('0xb')](),controller[_0x7874('0x10')]);module[_0x7874('0x11')]=router; \ No newline at end of file +var _0x0dd8=['post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show'];(function(_0x10f3cc,_0x44b3bf){var _0x464ba1=function(_0x182f63){while(--_0x182f63){_0x10f3cc['push'](_0x10f3cc['shift']());}};_0x464ba1(++_0x44b3bf);}(_0x0dd8,0x6b));var _0x80dd=function(_0xee35d6,_0x318eec){_0xee35d6=_0xee35d6-0x0;var _0x1b4e24=_0x0dd8[_0xee35d6];return _0x1b4e24;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x80dd('0x0'));var timeout=require(_0x80dd('0x1'));var express=require(_0x80dd('0x2'));var router=express[_0x80dd('0x3')]();var auth=require(_0x80dd('0x4'));var interaction=require(_0x80dd('0x5'));var config=require(_0x80dd('0x6'));var controller=require(_0x80dd('0x7'));router[_0x80dd('0x8')]('/',auth[_0x80dd('0x9')](),controller[_0x80dd('0xa')]);router[_0x80dd('0x8')](_0x80dd('0xb'),auth[_0x80dd('0x9')](),controller[_0x80dd('0xc')]);router[_0x80dd('0xd')]('/',auth['isAuthenticated'](),controller[_0x80dd('0xe')]);router[_0x80dd('0xf')]('/:id',auth[_0x80dd('0x9')](),controller[_0x80dd('0x10')]);router[_0x80dd('0x11')](_0x80dd('0xb'),auth[_0x80dd('0x9')](),controller[_0x80dd('0x12')]);module[_0x80dd('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f6aa971..27377fe 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 _0x8c97=['sequelize','exports','STRING','name'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8c97,0x194));var _0x78c9=function(_0x564e1d,_0x2d3976){_0x564e1d=_0x564e1d-0x0;var _0x144d76=_0x8c97[_0x564e1d];return _0x144d76;};'use strict';var Sequelize=require(_0x78c9('0x0'));module[_0x78c9('0x1')]={'name':{'type':Sequelize[_0x78c9('0x2')],'allowNull':![],'unique':_0x78c9('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c2a=['exports','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x22cfb7,_0x1558f8){_0x22cfb7=_0x22cfb7-0x0;var _0x282433=_0x3c2a[_0x22cfb7];return _0x282433;};'use strict';var Sequelize=require(_0xa3c2('0x0'));module[_0xa3c2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa3c2('0x2')},'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 8ea2157..3ba8056 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 _0xe1b2=['findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','addItem','DashboardId','findOne','DashboardItem','order','pick','getItems','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x37ed1b,_0x484103){var _0xeeba01=function(_0x162c6e){while(--_0x162c6e){_0x37ed1b['push'](_0x37ed1b['shift']());}};_0xeeba01(++_0x484103);}(_0xe1b2,0x18d));var _0x2e1b=function(_0x3acece,_0xaa613e){_0x3acece=_0x3acece-0x0;var _0x2b7255=_0xe1b2[_0x3acece];return _0x2b7255;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2e1b('0x0'));var rimraf=require(_0x2e1b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2e1b('0x2'));var BPromise=require(_0x2e1b('0x3'));var Mustache=require(_0x2e1b('0x4'));var util=require('util');var path=require(_0x2e1b('0x5'));var sox=require(_0x2e1b('0x6'));var csv=require(_0x2e1b('0x7'));var ejs=require(_0x2e1b('0x8'));var fs=require('fs');var _=require(_0x2e1b('0x9'));var squel=require('squel');var crypto=require(_0x2e1b('0xa'));var jsforce=require(_0x2e1b('0xb'));var deskjs=require(_0x2e1b('0xc'));var toCsv=require(_0x2e1b('0x7'));var querystring=require(_0x2e1b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2e1b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e1b('0xf'));var logger=require(_0x2e1b('0x10'))('api');var utils=require(_0x2e1b('0x11'));var config=require(_0x2e1b('0x12'));var db=require(_0x2e1b('0x13'))['db'];config['redis']=_[_0x2e1b('0x14')](config[_0x2e1b('0x15')],{'host':_0x2e1b('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e1b('0x15')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x48ac40,_0x47eed8){_0x47eed8=_0x47eed8||0xcc;return function(_0x36a91e){if(_0x36a91e){return _0x48ac40[_0x2e1b('0x17')](_0x47eed8);}return _0x48ac40[_0x2e1b('0x18')](_0x47eed8)[_0x2e1b('0x19')]();};}function respondWithResult(_0x93dd75,_0x472563){_0x472563=_0x472563||0xc8;return function(_0x3aa210){if(_0x3aa210){return _0x93dd75[_0x2e1b('0x18')](_0x472563)[_0x2e1b('0x1a')](_0x3aa210);}};}function respondWithFilteredResult(_0x24a8e2,_0x233991){return function(_0x41ffb4){if(_0x41ffb4){var _0xf4c5d6=_0x41ffb4[_0x2e1b('0x1b')],_0x367377=_0x233991[_0x2e1b('0x1c')],_0x55a55c=_0x233991['offset']+_0x233991['limit'],_0x30008c;if(_0x55a55c>=_0xf4c5d6){_0x55a55c=_0xf4c5d6;_0x30008c=0xc8;}else{_0x30008c=0xce;}_0x24a8e2[_0x2e1b('0x18')](_0x30008c);return _0x24a8e2[_0x2e1b('0x1d')](_0x2e1b('0x1e'),_0x367377+'-'+_0x55a55c+'/'+_0xf4c5d6)[_0x2e1b('0x1a')](_0x41ffb4);}return null;};}function patchUpdates(_0x523e97){return function(_0x25f7d6){try{jsonpatch['apply'](_0x25f7d6,_0x523e97,!![]);}catch(_0x3691d7){return BPromise[_0x2e1b('0x1f')](_0x3691d7);}return _0x25f7d6[_0x2e1b('0x20')]();};}function saveUpdates(_0x86c386,_0x386041){return function(_0x3676f1){if(_0x3676f1){return _0x3676f1[_0x2e1b('0x21')](_0x86c386)['then'](function(_0x21c6b7){return _0x21c6b7;});}return null;};}function removeEntity(_0x2b109e,_0x5e9820){return function(_0x39cd61){if(_0x39cd61){return _0x39cd61[_0x2e1b('0x22')]()[_0x2e1b('0x23')](function(){var _0x33eeb9=_0x39cd61[_0x2e1b('0x24')]({'plain':!![]});var _0x534d3d=_0x2e1b('0x25');return db[_0x2e1b('0x26')]['destroy']({'where':{'type':_0x534d3d,'resourceId':_0x33eeb9['id']}})['then'](function(){return _0x39cd61;});})[_0x2e1b('0x23')](function(){_0x2b109e['status'](0xcc)[_0x2e1b('0x19')]();});}};}function handleEntityNotFound(_0x422ab6,_0x11ea89){return function(_0x3f9038){if(!_0x3f9038){_0x422ab6[_0x2e1b('0x17')](0x194);}return _0x3f9038;};}function handleError(_0xc17155,_0xc55a55){_0xc55a55=_0xc55a55||0x1f4;return function(_0x255017){logger[_0x2e1b('0x27')](_0x255017['stack']);if(_0x255017['name']){delete _0x255017[_0x2e1b('0x28')];}_0xc17155[_0x2e1b('0x18')](_0xc55a55)[_0x2e1b('0x29')](_0x255017);};}exports[_0x2e1b('0x2a')]=function(_0x478f2c,_0x4b019a){var _0x1559a4={},_0x51291d={},_0x557fba={'count':0x0,'rows':[]};var _0x544821=_[_0x2e1b('0x2b')](db[_0x2e1b('0x2c')][_0x2e1b('0x2d')],function(_0x331053){return{'name':_0x331053[_0x2e1b('0x2e')],'type':_0x331053[_0x2e1b('0x2f')][_0x2e1b('0x30')]};});_0x51291d[_0x2e1b('0x31')]=_[_0x2e1b('0x2b')](_0x544821,_0x2e1b('0x28'));_0x51291d[_0x2e1b('0x32')]=_['keys'](_0x478f2c[_0x2e1b('0x32')]);_0x51291d[_0x2e1b('0x33')]=_[_0x2e1b('0x34')](_0x51291d[_0x2e1b('0x31')],_0x51291d['query']);_0x1559a4[_0x2e1b('0x35')]=_[_0x2e1b('0x34')](_0x51291d[_0x2e1b('0x31')],qs[_0x2e1b('0x36')](_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x36')]));_0x1559a4[_0x2e1b('0x35')]=_0x1559a4[_0x2e1b('0x35')][_0x2e1b('0x37')]?_0x1559a4[_0x2e1b('0x35')]:_0x51291d[_0x2e1b('0x31')];if(!_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x38')](_0x2e1b('0x39'))){_0x1559a4[_0x2e1b('0x3a')]=qs[_0x2e1b('0x3a')](_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x3a')]);_0x1559a4[_0x2e1b('0x1c')]=qs['offset'](_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x1c')]);}_0x1559a4['order']=qs[_0x2e1b('0x3b')](_0x478f2c[_0x2e1b('0x32')]['sort']);_0x1559a4[_0x2e1b('0x3c')]=qs[_0x2e1b('0x33')](_['pick'](_0x478f2c['query'],_0x51291d[_0x2e1b('0x33')]),_0x544821);if(_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x3d')]){_0x1559a4[_0x2e1b('0x3c')]=_[_0x2e1b('0x3e')](_0x1559a4[_0x2e1b('0x3c')],{'$or':_[_0x2e1b('0x2b')](_0x544821,function(_0x41d251){if(_0x41d251['type']!==_0x2e1b('0x3f')){var _0x4b6a24={};_0x4b6a24[_0x41d251[_0x2e1b('0x28')]]={'$like':'%'+_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x3d')]+'%'};return _0x4b6a24;}})});}_0x1559a4=_[_0x2e1b('0x3e')]({},_0x1559a4,_0x478f2c[_0x2e1b('0x40')]);var _0x4732ae={'where':_0x1559a4['where']};return db['Dashboard']['count'](_0x4732ae)[_0x2e1b('0x23')](function(_0x50bbf3){_0x557fba[_0x2e1b('0x1b')]=_0x50bbf3;if(_0x478f2c[_0x2e1b('0x32')][_0x2e1b('0x41')]){_0x1559a4[_0x2e1b('0x42')]=[{'all':!![]}];}return db['Dashboard'][_0x2e1b('0x43')](_0x1559a4);})['then'](function(_0x1b0fb8){_0x557fba['rows']=_0x1b0fb8;return _0x557fba;})['then'](respondWithFilteredResult(_0x4b019a,_0x1559a4))[_0x2e1b('0x44')](handleError(_0x4b019a,null));};exports[_0x2e1b('0x45')]=function(_0x33479c,_0x43d597){var _0x23a163={'raw':![],'where':{'id':_0x33479c[_0x2e1b('0x46')]['id']}},_0x5d7960={};_0x5d7960['model']=_[_0x2e1b('0x47')](db[_0x2e1b('0x2c')]['rawAttributes']);_0x5d7960[_0x2e1b('0x32')]=_[_0x2e1b('0x47')](_0x33479c['query']);_0x5d7960[_0x2e1b('0x33')]=_[_0x2e1b('0x34')](_0x5d7960[_0x2e1b('0x31')],_0x5d7960[_0x2e1b('0x32')]);_0x23a163[_0x2e1b('0x35')]=_['intersection'](_0x5d7960['model'],qs[_0x2e1b('0x36')](_0x33479c[_0x2e1b('0x32')][_0x2e1b('0x36')]));_0x23a163[_0x2e1b('0x35')]=_0x23a163[_0x2e1b('0x35')][_0x2e1b('0x37')]?_0x23a163[_0x2e1b('0x35')]:_0x5d7960[_0x2e1b('0x31')];if(_0x33479c[_0x2e1b('0x32')][_0x2e1b('0x41')]){_0x23a163['include']=[{'all':!![]}];}_0x23a163=_['merge']({},_0x23a163,_0x33479c[_0x2e1b('0x40')]);return db[_0x2e1b('0x2c')][_0x2e1b('0x48')](_0x23a163)['then'](handleEntityNotFound(_0x43d597,null))[_0x2e1b('0x23')](respondWithResult(_0x43d597,null))['catch'](handleError(_0x43d597,null));};exports[_0x2e1b('0x49')]=function(_0x1bc5ef,_0x4b067f){return db['Dashboard']['create'](_0x1bc5ef[_0x2e1b('0x4a')],{})['then'](function(_0x4f88a8){var _0x3c052e=_0x1bc5ef[_0x2e1b('0x4b')][_0x2e1b('0x24')]({'plain':!![]});if(!_0x3c052e)throw new Error(_0x2e1b('0x4c'));if(_0x3c052e[_0x2e1b('0x4d')]===_0x2e1b('0x4b')){var _0x5ea10f=_0x4f88a8[_0x2e1b('0x24')]({'plain':!![]});var _0x50b56c=_0x2e1b('0x25');return db['UserProfileSection'][_0x2e1b('0x48')]({'where':{'name':_0x50b56c,'userProfileId':_0x3c052e['userProfileId']},'raw':!![]})[_0x2e1b('0x23')](function(_0x11dfbb){if(_0x11dfbb&&_0x11dfbb[_0x2e1b('0x4e')]===0x0){return db[_0x2e1b('0x26')][_0x2e1b('0x49')]({'name':_0x5ea10f[_0x2e1b('0x28')],'resourceId':_0x5ea10f['id'],'type':_0x11dfbb['name'],'sectionId':_0x11dfbb['id']},{})[_0x2e1b('0x23')](function(){return _0x4f88a8;});}else{return _0x4f88a8;}})[_0x2e1b('0x44')](function(_0x405952){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x405952);throw _0x405952;});}return _0x4f88a8;})['then'](respondWithResult(_0x4b067f,0xc9))['catch'](handleError(_0x4b067f,null));};exports['clone']=function(_0x5a36b6,_0x306af4){var _0x754ce7={'where':{'id':_0x5a36b6[_0x2e1b('0x46')]['id']}},_0x4f833c={};_0x4f833c['model']=_[_0x2e1b('0x47')](db[_0x2e1b('0x2c')][_0x2e1b('0x2d')]);_0x754ce7['attributes']=_['intersection'](_0x4f833c[_0x2e1b('0x31')],qs[_0x2e1b('0x36')](_0x5a36b6['query'][_0x2e1b('0x36')]));_0x754ce7[_0x2e1b('0x35')]=_0x754ce7[_0x2e1b('0x35')][_0x2e1b('0x37')]?_0x754ce7[_0x2e1b('0x35')]:_0x4f833c[_0x2e1b('0x31')];if(_0x5a36b6[_0x2e1b('0x32')][_0x2e1b('0x41')]){_0x754ce7['include']=[{'all':!![]}];}_0x754ce7=_[_0x2e1b('0x3e')]({},_0x754ce7,_0x5a36b6[_0x2e1b('0x40')]);return db[_0x2e1b('0x2c')][_0x2e1b('0x48')](_0x754ce7)[_0x2e1b('0x23')](handleEntityNotFound(_0x306af4,null))[_0x2e1b('0x23')](function(_0x3b6c6f){if(_0x3b6c6f){var _0xd2a440=_0x3b6c6f[_0x2e1b('0x24')]({'plain':!![]});_0xd2a440=qs[_0x2e1b('0x4f')](_0xd2a440,['id',_0x2e1b('0x50'),_0x2e1b('0x51')]);_0x5a36b6[_0x2e1b('0x4a')]=_[_0x2e1b('0x4f')](_0x5a36b6['body'],['id',_0x2e1b('0x50'),_0x2e1b('0x51')]);return db['Dashboard'][_0x2e1b('0x49')](_[_0x2e1b('0x3e')](_0xd2a440,_0x5a36b6['body']),{'include':_0x5a36b6[_0x2e1b('0x32')][_0x2e1b('0x41')]?[{'all':!![]}]:undefined})[_0x2e1b('0x23')](function(_0x5cc143){var _0x485d52=_0x5a36b6[_0x2e1b('0x4b')]['get']({'plain':!![]});if(!_0x485d52)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x485d52['role']==='user'){var _0x5f3771=_0x5cc143['get']({'plain':!![]});var _0x516aac=_0x2e1b('0x25');return db['UserProfileSection'][_0x2e1b('0x48')]({'where':{'name':_0x516aac,'userProfileId':_0x485d52[_0x2e1b('0x52')]},'raw':!![]})['then'](function(_0x4eb5fb){if(_0x4eb5fb&&_0x4eb5fb[_0x2e1b('0x4e')]===0x0){return db['UserProfileResource'][_0x2e1b('0x49')]({'name':_0x5f3771[_0x2e1b('0x28')],'resourceId':_0x5f3771['id'],'type':_0x4eb5fb[_0x2e1b('0x28')],'sectionId':_0x4eb5fb['id']},{})[_0x2e1b('0x23')](function(){return _0x5cc143;});}else{return _0x5cc143;}})[_0x2e1b('0x44')](function(_0x15d88f){logger[_0x2e1b('0x27')](_0x2e1b('0x53'),_0x15d88f);throw _0x15d88f;});}return _0x5cc143;});}})['then'](respondWithResult(_0x306af4,0xc9))['catch'](handleError(_0x306af4,null));};exports['update']=function(_0x43dd34,_0x2090ba){if(_0x43dd34[_0x2e1b('0x4a')]['id']){delete _0x43dd34['body']['id'];}return db[_0x2e1b('0x2c')][_0x2e1b('0x48')]({'where':{'id':_0x43dd34[_0x2e1b('0x46')]['id']}})[_0x2e1b('0x23')](handleEntityNotFound(_0x2090ba,null))[_0x2e1b('0x23')](saveUpdates(_0x43dd34['body'],null))['then'](respondWithResult(_0x2090ba,null))['catch'](handleError(_0x2090ba,null));};exports[_0x2e1b('0x22')]=function(_0x2b90fa,_0xe61cd9){return db[_0x2e1b('0x2c')]['find']({'where':{'id':_0x2b90fa[_0x2e1b('0x46')]['id']}})[_0x2e1b('0x23')](handleEntityNotFound(_0xe61cd9,null))[_0x2e1b('0x23')](removeEntity(_0xe61cd9,null))['catch'](handleError(_0xe61cd9,null));};function widgetAttributes(_0x1aadc8){try{switch(_0x1aadc8['type']){case _0x2e1b('0x54'):return[{'name':_0x2e1b('0x55'),'value':_0x1aadc8['attrUrl']||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||_0x2e1b('0x58')}];case _0x2e1b('0x59'):return[{'name':_0x2e1b('0x5a'),'value':_0x1aadc8[_0x2e1b('0x5a')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||''}];case _0x2e1b('0x5b'):return[{'name':_0x2e1b('0x5c'),'value':_0x1aadc8[_0x2e1b('0x5c')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||_0x2e1b('0x5d')},{'name':_0x2e1b('0x5e'),'value':_0x1aadc8[_0x2e1b('0x5e')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x1]?_0x1aadc8[_0x2e1b('0x56')][0x1]['value']:undefined)||'0.00'},{'name':_0x2e1b('0x5f'),'value':_0x1aadc8['attrFontSize']||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8['attrs'][0x2]?_0x1aadc8['attrs'][0x2][_0x2e1b('0x57')]:undefined)||0xc}];case _0x2e1b('0x60'):return[{'name':_0x2e1b('0x61'),'value':_0x1aadc8[_0x2e1b('0x61')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||_0x2e1b('0x62')},{'name':_0x2e1b('0x63'),'value':_0x1aadc8[_0x2e1b('0x63')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x1]?_0x1aadc8[_0x2e1b('0x56')][0x1][_0x2e1b('0x57')]:undefined)||[]},{'name':_0x2e1b('0x5f'),'value':_0x1aadc8[_0x2e1b('0x5f')]||(_0x1aadc8['attrs']&&_0x1aadc8[_0x2e1b('0x56')][0x2]?_0x1aadc8[_0x2e1b('0x56')][0x2][_0x2e1b('0x57')]:undefined)||0x14}];case'multibar-chart':case _0x2e1b('0x64'):return[{'name':_0x2e1b('0x65'),'value':_0x1aadc8[_0x2e1b('0x65')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||_0x2e1b('0x62')},{'name':_0x2e1b('0x66'),'value':_0x1aadc8[_0x2e1b('0x66')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x1]?_0x1aadc8['attrs'][0x1][_0x2e1b('0x57')]:undefined)||null},{'name':'attrSerie3','value':_0x1aadc8[_0x2e1b('0x67')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8['attrs'][0x2]?_0x1aadc8[_0x2e1b('0x56')][0x2][_0x2e1b('0x57')]:undefined)||null},{'name':_0x2e1b('0x63'),'value':_0x1aadc8[_0x2e1b('0x63')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x3]?_0x1aadc8[_0x2e1b('0x56')][0x3][_0x2e1b('0x57')]:undefined)||[]}];case _0x2e1b('0x68'):return[{'name':'attrReport','type':_0x1aadc8[_0x2e1b('0x69')]||(_0x1aadc8['attrs']&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8['attrs'][0x0][_0x2e1b('0x2f')]:undefined)||null,'value':_0x1aadc8[_0x2e1b('0x6a')]||(_0x1aadc8[_0x2e1b('0x56')]&&_0x1aadc8[_0x2e1b('0x56')][0x0]?_0x1aadc8[_0x2e1b('0x56')][0x0][_0x2e1b('0x57')]:undefined)||null},{'name':'attrRefresh','value':_0x1aadc8[_0x2e1b('0x6b')]||(_0x1aadc8['attrs']&&_0x1aadc8[_0x2e1b('0x56')][0x1]?_0x1aadc8[_0x2e1b('0x56')][0x1][_0x2e1b('0x57')]:undefined)||0x0}];default:return[];}}catch(_0x5c5772){logger[_0x2e1b('0x27')]('widgetAttributes:\x20%s',JSON[_0x2e1b('0x6c')](_0x5c5772));return[];}}exports[_0x2e1b('0x6d')]=function(_0x2c8bdf,_0x5acc4d,_0x43599c){if(_0x2c8bdf[_0x2e1b('0x4a')]['id']){delete _0x2c8bdf[_0x2e1b('0x4a')]['id'];}return db[_0x2e1b('0x2c')][_0x2e1b('0x48')]({'where':{'id':_0x2c8bdf['params']['id']}})['then'](handleEntityNotFound(_0x5acc4d,null))[_0x2e1b('0x23')](function(_0x34027d){if(_0x34027d){_0x2c8bdf['body'][_0x2e1b('0x6e')]=_0x34027d['id'];_0x2c8bdf[_0x2e1b('0x4a')][_0x2e1b('0x56')]=widgetAttributes(_0x2c8bdf['body']);return db['DashboardItem']['create'](_0x2c8bdf[_0x2e1b('0x4a')]);}})[_0x2e1b('0x23')](respondWithResult(_0x5acc4d,null))[_0x2e1b('0x44')](handleError(_0x5acc4d,null));};exports['getItems']=function(_0x25ee79,_0x721098,_0x19e304){var _0x1828fe={};var _0x12cb34={};var _0x15a810;var _0x1c1e89;return db[_0x2e1b('0x2c')][_0x2e1b('0x6f')]({'where':{'id':_0x25ee79[_0x2e1b('0x46')]['id']}})[_0x2e1b('0x23')](handleEntityNotFound(_0x721098,null))[_0x2e1b('0x23')](function(_0x25c6c6){if(_0x25c6c6){_0x15a810=_0x25c6c6;_0x12cb34[_0x2e1b('0x31')]=_[_0x2e1b('0x47')](db[_0x2e1b('0x70')][_0x2e1b('0x2d')]);_0x12cb34[_0x2e1b('0x32')]=_[_0x2e1b('0x47')](_0x25ee79['query']);_0x12cb34[_0x2e1b('0x33')]=_[_0x2e1b('0x34')](_0x12cb34[_0x2e1b('0x31')],_0x12cb34[_0x2e1b('0x32')]);_0x1828fe['attributes']=_[_0x2e1b('0x34')](_0x12cb34[_0x2e1b('0x31')],qs[_0x2e1b('0x36')](_0x25ee79[_0x2e1b('0x32')]['fields']));_0x1828fe['attributes']=_0x1828fe['attributes'][_0x2e1b('0x37')]?_0x1828fe['attributes']:_0x12cb34[_0x2e1b('0x31')];_0x1828fe[_0x2e1b('0x71')]=qs[_0x2e1b('0x3b')](_0x25ee79[_0x2e1b('0x32')]['sort']);_0x1828fe[_0x2e1b('0x3c')]=qs[_0x2e1b('0x33')](_[_0x2e1b('0x72')](_0x25ee79[_0x2e1b('0x32')],_0x12cb34[_0x2e1b('0x33')]));if(_0x25ee79[_0x2e1b('0x32')][_0x2e1b('0x3d')]){_0x1828fe[_0x2e1b('0x3c')]=_[_0x2e1b('0x3e')](_0x1828fe[_0x2e1b('0x3c')],{'$or':_[_0x2e1b('0x2b')](_0x1828fe[_0x2e1b('0x35')],function(_0x555f83){var _0x321372={};_0x321372[_0x555f83]={'$like':'%'+_0x25ee79[_0x2e1b('0x32')][_0x2e1b('0x3d')]+'%'};return _0x321372;})});}_0x1828fe=_[_0x2e1b('0x3e')]({},_0x1828fe,_0x25ee79[_0x2e1b('0x40')]);return _0x15a810['getItems'](_0x1828fe);}})[_0x2e1b('0x23')](function(_0x1a444c){if(_0x1a444c){_0x1c1e89=_0x1a444c[_0x2e1b('0x37')];if(!_0x25ee79[_0x2e1b('0x32')][_0x2e1b('0x38')](_0x2e1b('0x39'))){_0x1828fe['limit']=qs[_0x2e1b('0x3a')](_0x25ee79['query']['limit']);_0x1828fe['offset']=qs[_0x2e1b('0x1c')](_0x25ee79['query'][_0x2e1b('0x1c')]);}return _0x15a810[_0x2e1b('0x73')](_0x1828fe);}})['then'](function(_0xff0efc){if(_0xff0efc){return _0xff0efc?{'count':_0x1c1e89,'rows':_0xff0efc}:null;}})[_0x2e1b('0x23')](respondWithResult(_0x721098,null))[_0x2e1b('0x44')](handleError(_0x721098,null));}; \ No newline at end of file +var _0xae72=['multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','findOne','nolimit','getItems','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','includeAll','rows','catch','show','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','role','UserProfileSection','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae72,0x184));var _0x2ae7=function(_0x581b73,_0x4fa43c){_0x581b73=_0x581b73-0x0;var _0x3ea0ec=_0xae72[_0x581b73];return _0x3ea0ec;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2ae7('0x0'));var zipdir=require(_0x2ae7('0x1'));var jsonpatch=require(_0x2ae7('0x2'));var rp=require(_0x2ae7('0x3'));var moment=require(_0x2ae7('0x4'));var BPromise=require(_0x2ae7('0x5'));var Mustache=require(_0x2ae7('0x6'));var util=require(_0x2ae7('0x7'));var path=require(_0x2ae7('0x8'));var sox=require(_0x2ae7('0x9'));var csv=require(_0x2ae7('0xa'));var ejs=require(_0x2ae7('0xb'));var fs=require('fs');var _=require(_0x2ae7('0xc'));var squel=require(_0x2ae7('0xd'));var crypto=require(_0x2ae7('0xe'));var jsforce=require(_0x2ae7('0xf'));var deskjs=require(_0x2ae7('0x10'));var toCsv=require(_0x2ae7('0xa'));var querystring=require('querystring');var Papa=require(_0x2ae7('0x11'));var Redis=require(_0x2ae7('0x12'));var authService=require(_0x2ae7('0x13'));var qs=require(_0x2ae7('0x14'));var as=require(_0x2ae7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ae7('0x16'))(_0x2ae7('0x17'));var utils=require('../../config/utils');var config=require(_0x2ae7('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2ae7('0x19')](config[_0x2ae7('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ae7('0x1b'))(new Redis(config[_0x2ae7('0x1a')]));require(_0x2ae7('0x1c'))[_0x2ae7('0x1d')](socket);function respondWithStatusCode(_0x2aa0cc,_0x2e8eda){_0x2e8eda=_0x2e8eda||0xcc;return function(_0x3b03d3){if(_0x3b03d3){return _0x2aa0cc[_0x2ae7('0x1e')](_0x2e8eda);}return _0x2aa0cc['status'](_0x2e8eda)['end']();};}function respondWithResult(_0x9dd63a,_0x1e0bb2){_0x1e0bb2=_0x1e0bb2||0xc8;return function(_0x10a30e){if(_0x10a30e){return _0x9dd63a[_0x2ae7('0x1f')](_0x1e0bb2)[_0x2ae7('0x20')](_0x10a30e);}};}function respondWithFilteredResult(_0x54d03c,_0x243067){return function(_0x4b740f){if(_0x4b740f){var _0x32a17e=_0x4b740f[_0x2ae7('0x21')],_0x5c4907=_0x243067[_0x2ae7('0x22')],_0x10a37e=_0x243067[_0x2ae7('0x22')]+_0x243067[_0x2ae7('0x23')],_0x346ca2;if(_0x10a37e>=_0x32a17e){_0x10a37e=_0x32a17e;_0x346ca2=0xc8;}else{_0x346ca2=0xce;}_0x54d03c[_0x2ae7('0x1f')](_0x346ca2);return _0x54d03c[_0x2ae7('0x24')](_0x2ae7('0x25'),_0x5c4907+'-'+_0x10a37e+'/'+_0x32a17e)[_0x2ae7('0x20')](_0x4b740f);}return null;};}function patchUpdates(_0x231ff3){return function(_0x46b2fa){try{jsonpatch[_0x2ae7('0x26')](_0x46b2fa,_0x231ff3,!![]);}catch(_0x529365){return BPromise[_0x2ae7('0x27')](_0x529365);}return _0x46b2fa[_0x2ae7('0x28')]();};}function saveUpdates(_0xbeacfa,_0x378396){return function(_0x33d9f0){if(_0x33d9f0){return _0x33d9f0[_0x2ae7('0x29')](_0xbeacfa)[_0x2ae7('0x2a')](function(_0x3f1576){return _0x3f1576;});}return null;};}function removeEntity(_0xad1f00,_0x5c659a){return function(_0x214150){if(_0x214150){return _0x214150[_0x2ae7('0x2b')]()[_0x2ae7('0x2a')](function(){var _0x9114ca=_0x214150[_0x2ae7('0x2c')]({'plain':!![]});var _0x597694='CustomDashboards';return db['UserProfileResource'][_0x2ae7('0x2b')]({'where':{'type':_0x597694,'resourceId':_0x9114ca['id']}})[_0x2ae7('0x2a')](function(){return _0x214150;});})[_0x2ae7('0x2a')](function(){_0xad1f00[_0x2ae7('0x1f')](0xcc)[_0x2ae7('0x2d')]();});}};}function handleEntityNotFound(_0x2b30ee,_0x528ec1){return function(_0xca0c7f){if(!_0xca0c7f){_0x2b30ee[_0x2ae7('0x1e')](0x194);}return _0xca0c7f;};}function handleError(_0x491524,_0x3c862e){_0x3c862e=_0x3c862e||0x1f4;return function(_0x3a3c7f){logger[_0x2ae7('0x2e')](_0x3a3c7f[_0x2ae7('0x2f')]);if(_0x3a3c7f[_0x2ae7('0x30')]){delete _0x3a3c7f['name'];}_0x491524[_0x2ae7('0x1f')](_0x3c862e)[_0x2ae7('0x31')](_0x3a3c7f);};}exports[_0x2ae7('0x32')]=function(_0x94df44,_0x2791ba){var _0x4b5dd0={},_0x1ac97c={},_0x50ca72={'count':0x0,'rows':[]};var _0x5f35fc=_[_0x2ae7('0x33')](db['Dashboard'][_0x2ae7('0x34')],function(_0x2fe1e9){return{'name':_0x2fe1e9[_0x2ae7('0x35')],'type':_0x2fe1e9[_0x2ae7('0x36')][_0x2ae7('0x37')]};});_0x1ac97c[_0x2ae7('0x38')]=_[_0x2ae7('0x33')](_0x5f35fc,_0x2ae7('0x30'));_0x1ac97c['query']=_[_0x2ae7('0x39')](_0x94df44[_0x2ae7('0x3a')]);_0x1ac97c[_0x2ae7('0x3b')]=_[_0x2ae7('0x3c')](_0x1ac97c['model'],_0x1ac97c[_0x2ae7('0x3a')]);_0x4b5dd0[_0x2ae7('0x3d')]=_[_0x2ae7('0x3c')](_0x1ac97c['model'],qs[_0x2ae7('0x3e')](_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x3e')]));_0x4b5dd0[_0x2ae7('0x3d')]=_0x4b5dd0['attributes'][_0x2ae7('0x3f')]?_0x4b5dd0['attributes']:_0x1ac97c[_0x2ae7('0x38')];if(!_0x94df44[_0x2ae7('0x3a')]['hasOwnProperty']('nolimit')){_0x4b5dd0[_0x2ae7('0x23')]=qs[_0x2ae7('0x23')](_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x23')]);_0x4b5dd0['offset']=qs[_0x2ae7('0x22')](_0x94df44[_0x2ae7('0x3a')]['offset']);}_0x4b5dd0[_0x2ae7('0x40')]=qs[_0x2ae7('0x41')](_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x41')]);_0x4b5dd0[_0x2ae7('0x42')]=qs[_0x2ae7('0x3b')](_[_0x2ae7('0x43')](_0x94df44[_0x2ae7('0x3a')],_0x1ac97c[_0x2ae7('0x3b')]),_0x5f35fc);if(_0x94df44['query'][_0x2ae7('0x44')]){_0x4b5dd0[_0x2ae7('0x42')]=_[_0x2ae7('0x45')](_0x4b5dd0[_0x2ae7('0x42')],{'$or':_[_0x2ae7('0x33')](_0x5f35fc,function(_0x4d2c6e){if(_0x4d2c6e[_0x2ae7('0x36')]!==_0x2ae7('0x46')){var _0x3ba4ef={};_0x3ba4ef[_0x4d2c6e[_0x2ae7('0x30')]]={'$like':'%'+_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x44')]+'%'};return _0x3ba4ef;}})});}_0x4b5dd0=_[_0x2ae7('0x45')]({},_0x4b5dd0,_0x94df44[_0x2ae7('0x47')]);var _0x11ed0b={'where':_0x4b5dd0[_0x2ae7('0x42')]};return db[_0x2ae7('0x48')][_0x2ae7('0x21')](_0x11ed0b)[_0x2ae7('0x2a')](function(_0x11e21b){_0x50ca72[_0x2ae7('0x21')]=_0x11e21b;if(_0x94df44[_0x2ae7('0x3a')][_0x2ae7('0x49')]){_0x4b5dd0['include']=[{'all':!![]}];}return db[_0x2ae7('0x48')]['findAll'](_0x4b5dd0);})[_0x2ae7('0x2a')](function(_0x5006ae){_0x50ca72[_0x2ae7('0x4a')]=_0x5006ae;return _0x50ca72;})[_0x2ae7('0x2a')](respondWithFilteredResult(_0x2791ba,_0x4b5dd0))[_0x2ae7('0x4b')](handleError(_0x2791ba,null));};exports[_0x2ae7('0x4c')]=function(_0x48e97e,_0x4ac0ca){var _0x37eb10={'raw':![],'where':{'id':_0x48e97e['params']['id']}},_0x16e717={};_0x16e717[_0x2ae7('0x38')]=_[_0x2ae7('0x39')](db[_0x2ae7('0x48')][_0x2ae7('0x34')]);_0x16e717[_0x2ae7('0x3a')]=_['keys'](_0x48e97e[_0x2ae7('0x3a')]);_0x16e717[_0x2ae7('0x3b')]=_[_0x2ae7('0x3c')](_0x16e717['model'],_0x16e717[_0x2ae7('0x3a')]);_0x37eb10['attributes']=_[_0x2ae7('0x3c')](_0x16e717['model'],qs[_0x2ae7('0x3e')](_0x48e97e[_0x2ae7('0x3a')][_0x2ae7('0x3e')]));_0x37eb10[_0x2ae7('0x3d')]=_0x37eb10['attributes'][_0x2ae7('0x3f')]?_0x37eb10['attributes']:_0x16e717[_0x2ae7('0x38')];if(_0x48e97e[_0x2ae7('0x3a')]['includeAll']){_0x37eb10[_0x2ae7('0x4d')]=[{'all':!![]}];}_0x37eb10=_['merge']({},_0x37eb10,_0x48e97e['options']);return db[_0x2ae7('0x48')]['find'](_0x37eb10)[_0x2ae7('0x2a')](handleEntityNotFound(_0x4ac0ca,null))[_0x2ae7('0x2a')](respondWithResult(_0x4ac0ca,null))['catch'](handleError(_0x4ac0ca,null));};exports[_0x2ae7('0x4e')]=function(_0x3d1d2d,_0xbee4d3){return db[_0x2ae7('0x48')][_0x2ae7('0x4e')](_0x3d1d2d[_0x2ae7('0x4f')],{})[_0x2ae7('0x2a')](function(_0x45377a){var _0x10fb17=_0x3d1d2d[_0x2ae7('0x50')][_0x2ae7('0x2c')]({'plain':!![]});if(!_0x10fb17)throw new Error(_0x2ae7('0x51'));if(_0x10fb17['role']===_0x2ae7('0x50')){var _0xaf6cad=_0x45377a['get']({'plain':!![]});var _0x516d3c=_0x2ae7('0x52');return db['UserProfileSection'][_0x2ae7('0x53')]({'where':{'name':_0x516d3c,'userProfileId':_0x10fb17[_0x2ae7('0x54')]},'raw':!![]})[_0x2ae7('0x2a')](function(_0x2af8b0){if(_0x2af8b0&&_0x2af8b0[_0x2ae7('0x55')]===0x0){return db[_0x2ae7('0x56')][_0x2ae7('0x4e')]({'name':_0xaf6cad[_0x2ae7('0x30')],'resourceId':_0xaf6cad['id'],'type':_0x2af8b0[_0x2ae7('0x30')],'sectionId':_0x2af8b0['id']},{})['then'](function(){return _0x45377a;});}else{return _0x45377a;}})[_0x2ae7('0x4b')](function(_0x2f3538){logger[_0x2ae7('0x2e')](_0x2ae7('0x57'),_0x2f3538);throw _0x2f3538;});}return _0x45377a;})[_0x2ae7('0x2a')](respondWithResult(_0xbee4d3,0xc9))[_0x2ae7('0x4b')](handleError(_0xbee4d3,null));};exports[_0x2ae7('0x58')]=function(_0x4113b5,_0x9e87e2){var _0x361c8c={'where':{'id':_0x4113b5[_0x2ae7('0x59')]['id']}},_0x4dc3b8={};_0x4dc3b8[_0x2ae7('0x38')]=_[_0x2ae7('0x39')](db['Dashboard'][_0x2ae7('0x34')]);_0x361c8c['attributes']=_[_0x2ae7('0x3c')](_0x4dc3b8['model'],qs[_0x2ae7('0x3e')](_0x4113b5[_0x2ae7('0x3a')][_0x2ae7('0x3e')]));_0x361c8c[_0x2ae7('0x3d')]=_0x361c8c[_0x2ae7('0x3d')][_0x2ae7('0x3f')]?_0x361c8c[_0x2ae7('0x3d')]:_0x4dc3b8[_0x2ae7('0x38')];if(_0x4113b5[_0x2ae7('0x3a')][_0x2ae7('0x49')]){_0x361c8c[_0x2ae7('0x4d')]=[{'all':!![]}];}_0x361c8c=_[_0x2ae7('0x45')]({},_0x361c8c,_0x4113b5['options']);return db['Dashboard']['find'](_0x361c8c)[_0x2ae7('0x2a')](handleEntityNotFound(_0x9e87e2,null))[_0x2ae7('0x2a')](function(_0xcfe1fe){if(_0xcfe1fe){var _0x145cd1=_0xcfe1fe[_0x2ae7('0x2c')]({'plain':!![]});_0x145cd1=qs[_0x2ae7('0x5a')](_0x145cd1,['id','createdAt',_0x2ae7('0x5b')]);_0x4113b5[_0x2ae7('0x4f')]=_['omit'](_0x4113b5['body'],['id','createdAt','updatedAt']);return db[_0x2ae7('0x48')][_0x2ae7('0x4e')](_[_0x2ae7('0x45')](_0x145cd1,_0x4113b5[_0x2ae7('0x4f')]),{'include':_0x4113b5[_0x2ae7('0x3a')][_0x2ae7('0x49')]?[{'all':!![]}]:undefined})[_0x2ae7('0x2a')](function(_0x5d67b8){var _0x35d5b7=_0x4113b5[_0x2ae7('0x50')][_0x2ae7('0x2c')]({'plain':!![]});if(!_0x35d5b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35d5b7[_0x2ae7('0x5c')]===_0x2ae7('0x50')){var _0x3b963b=_0x5d67b8[_0x2ae7('0x2c')]({'plain':!![]});var _0x1d3de7='CustomDashboards';return db[_0x2ae7('0x5d')]['find']({'where':{'name':_0x1d3de7,'userProfileId':_0x35d5b7[_0x2ae7('0x54')]},'raw':!![]})[_0x2ae7('0x2a')](function(_0x5d3ff2){if(_0x5d3ff2&&_0x5d3ff2[_0x2ae7('0x55')]===0x0){return db[_0x2ae7('0x56')][_0x2ae7('0x4e')]({'name':_0x3b963b[_0x2ae7('0x30')],'resourceId':_0x3b963b['id'],'type':_0x5d3ff2['name'],'sectionId':_0x5d3ff2['id']},{})[_0x2ae7('0x2a')](function(){return _0x5d67b8;});}else{return _0x5d67b8;}})[_0x2ae7('0x4b')](function(_0x2cfc18){logger[_0x2ae7('0x2e')](_0x2ae7('0x57'),_0x2cfc18);throw _0x2cfc18;});}return _0x5d67b8;});}})[_0x2ae7('0x2a')](respondWithResult(_0x9e87e2,0xc9))[_0x2ae7('0x4b')](handleError(_0x9e87e2,null));};exports[_0x2ae7('0x29')]=function(_0x1c0034,_0x4b5ce0){if(_0x1c0034[_0x2ae7('0x4f')]['id']){delete _0x1c0034[_0x2ae7('0x4f')]['id'];}return db[_0x2ae7('0x48')][_0x2ae7('0x53')]({'where':{'id':_0x1c0034[_0x2ae7('0x59')]['id']}})[_0x2ae7('0x2a')](handleEntityNotFound(_0x4b5ce0,null))['then'](saveUpdates(_0x1c0034[_0x2ae7('0x4f')],null))['then'](respondWithResult(_0x4b5ce0,null))[_0x2ae7('0x4b')](handleError(_0x4b5ce0,null));};exports[_0x2ae7('0x2b')]=function(_0x4cebad,_0x310897){return db[_0x2ae7('0x48')]['find']({'where':{'id':_0x4cebad['params']['id']}})[_0x2ae7('0x2a')](handleEntityNotFound(_0x310897,null))[_0x2ae7('0x2a')](removeEntity(_0x310897,null))['catch'](handleError(_0x310897,null));};function widgetAttributes(_0xa0aa2){try{switch(_0xa0aa2['type']){case _0x2ae7('0x5e'):return[{'name':_0x2ae7('0x5f'),'value':_0xa0aa2[_0x2ae7('0x5f')]||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x0]?_0xa0aa2[_0x2ae7('0x60')][0x0][_0x2ae7('0x61')]:undefined)||'https://'}];case _0x2ae7('0x62'):return[{'name':_0x2ae7('0x63'),'value':_0xa0aa2[_0x2ae7('0x63')]||(_0xa0aa2['attrs']&&_0xa0aa2['attrs'][0x0]?_0xa0aa2[_0x2ae7('0x60')][0x0][_0x2ae7('0x61')]:undefined)||''}];case _0x2ae7('0x64'):return[{'name':_0x2ae7('0x65'),'value':_0xa0aa2['attrHourFormat']||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x0]?_0xa0aa2['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x2ae7('0x66'),'value':_0xa0aa2['attrTimezone']||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2['attrs'][0x1]?_0xa0aa2[_0x2ae7('0x60')][0x1]['value']:undefined)||_0x2ae7('0x67')},{'name':_0x2ae7('0x68'),'value':_0xa0aa2[_0x2ae7('0x68')]||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x2]?_0xa0aa2[_0x2ae7('0x60')][0x2][_0x2ae7('0x61')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0xa0aa2[_0x2ae7('0x69')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2['attrs'][0x0]?_0xa0aa2['attrs'][0x0]['value']:undefined)||_0x2ae7('0x6a')},{'name':_0x2ae7('0x6b'),'value':_0xa0aa2[_0x2ae7('0x6b')]||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x1]?_0xa0aa2['attrs'][0x1][_0x2ae7('0x61')]:undefined)||[]},{'name':_0x2ae7('0x68'),'value':_0xa0aa2[_0x2ae7('0x68')]||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x2]?_0xa0aa2[_0x2ae7('0x60')][0x2][_0x2ae7('0x61')]:undefined)||0x14}];case _0x2ae7('0x6c'):case _0x2ae7('0x6d'):return[{'name':_0x2ae7('0x6e'),'value':_0xa0aa2[_0x2ae7('0x6e')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x0]?_0xa0aa2['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x2ae7('0x6f'),'value':_0xa0aa2[_0x2ae7('0x6f')]||(_0xa0aa2['attrs']&&_0xa0aa2['attrs'][0x1]?_0xa0aa2[_0x2ae7('0x60')][0x1][_0x2ae7('0x61')]:undefined)||null},{'name':_0x2ae7('0x70'),'value':_0xa0aa2['attrSerie3']||(_0xa0aa2['attrs']&&_0xa0aa2[_0x2ae7('0x60')][0x2]?_0xa0aa2['attrs'][0x2][_0x2ae7('0x61')]:undefined)||null},{'name':_0x2ae7('0x6b'),'value':_0xa0aa2[_0x2ae7('0x6b')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x3]?_0xa0aa2[_0x2ae7('0x60')][0x3][_0x2ae7('0x61')]:undefined)||[]}];case _0x2ae7('0x71'):return[{'name':_0x2ae7('0x72'),'type':_0xa0aa2[_0x2ae7('0x73')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x0]?_0xa0aa2['attrs'][0x0][_0x2ae7('0x36')]:undefined)||null,'value':_0xa0aa2[_0x2ae7('0x72')]||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2['attrs'][0x0]?_0xa0aa2['attrs'][0x0][_0x2ae7('0x61')]:undefined)||null},{'name':_0x2ae7('0x74'),'value':_0xa0aa2['attrRefresh']||(_0xa0aa2[_0x2ae7('0x60')]&&_0xa0aa2[_0x2ae7('0x60')][0x1]?_0xa0aa2[_0x2ae7('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5429e2){logger[_0x2ae7('0x2e')](_0x2ae7('0x75'),JSON[_0x2ae7('0x76')](_0x5429e2));return[];}}exports['addItem']=function(_0x5665cf,_0x41f4bd,_0x5e81bc){if(_0x5665cf[_0x2ae7('0x4f')]['id']){delete _0x5665cf[_0x2ae7('0x4f')]['id'];}return db['Dashboard'][_0x2ae7('0x53')]({'where':{'id':_0x5665cf[_0x2ae7('0x59')]['id']}})[_0x2ae7('0x2a')](handleEntityNotFound(_0x41f4bd,null))[_0x2ae7('0x2a')](function(_0x45d5e5){if(_0x45d5e5){_0x5665cf[_0x2ae7('0x4f')][_0x2ae7('0x77')]=_0x45d5e5['id'];_0x5665cf['body'][_0x2ae7('0x60')]=widgetAttributes(_0x5665cf['body']);return db[_0x2ae7('0x78')][_0x2ae7('0x4e')](_0x5665cf[_0x2ae7('0x4f')]);}})[_0x2ae7('0x2a')](respondWithResult(_0x41f4bd,null))['catch'](handleError(_0x41f4bd,null));};exports['getItems']=function(_0x1a3bec,_0x3b079a,_0x216d17){var _0x419583={};var _0xafc800={};var _0xaf7bf6;var _0x1e36bd;return db[_0x2ae7('0x48')][_0x2ae7('0x79')]({'where':{'id':_0x1a3bec[_0x2ae7('0x59')]['id']}})[_0x2ae7('0x2a')](handleEntityNotFound(_0x3b079a,null))[_0x2ae7('0x2a')](function(_0x2533f5){if(_0x2533f5){_0xaf7bf6=_0x2533f5;_0xafc800[_0x2ae7('0x38')]=_[_0x2ae7('0x39')](db[_0x2ae7('0x78')][_0x2ae7('0x34')]);_0xafc800[_0x2ae7('0x3a')]=_['keys'](_0x1a3bec[_0x2ae7('0x3a')]);_0xafc800['filters']=_[_0x2ae7('0x3c')](_0xafc800[_0x2ae7('0x38')],_0xafc800[_0x2ae7('0x3a')]);_0x419583['attributes']=_[_0x2ae7('0x3c')](_0xafc800['model'],qs['fields'](_0x1a3bec[_0x2ae7('0x3a')]['fields']));_0x419583[_0x2ae7('0x3d')]=_0x419583[_0x2ae7('0x3d')][_0x2ae7('0x3f')]?_0x419583[_0x2ae7('0x3d')]:_0xafc800['model'];_0x419583['order']=qs['sort'](_0x1a3bec[_0x2ae7('0x3a')][_0x2ae7('0x41')]);_0x419583[_0x2ae7('0x42')]=qs[_0x2ae7('0x3b')](_[_0x2ae7('0x43')](_0x1a3bec[_0x2ae7('0x3a')],_0xafc800[_0x2ae7('0x3b')]));if(_0x1a3bec['query'][_0x2ae7('0x44')]){_0x419583[_0x2ae7('0x42')]=_[_0x2ae7('0x45')](_0x419583[_0x2ae7('0x42')],{'$or':_['map'](_0x419583['attributes'],function(_0x49e255){var _0x44cb51={};_0x44cb51[_0x49e255]={'$like':'%'+_0x1a3bec['query'][_0x2ae7('0x44')]+'%'};return _0x44cb51;})});}_0x419583=_[_0x2ae7('0x45')]({},_0x419583,_0x1a3bec['options']);return _0xaf7bf6['getItems'](_0x419583);}})[_0x2ae7('0x2a')](function(_0xc93576){if(_0xc93576){_0x1e36bd=_0xc93576[_0x2ae7('0x3f')];if(!_0x1a3bec[_0x2ae7('0x3a')]['hasOwnProperty'](_0x2ae7('0x7a'))){_0x419583[_0x2ae7('0x23')]=qs[_0x2ae7('0x23')](_0x1a3bec['query'][_0x2ae7('0x23')]);_0x419583[_0x2ae7('0x22')]=qs[_0x2ae7('0x22')](_0x1a3bec['query'][_0x2ae7('0x22')]);}return _0xaf7bf6[_0x2ae7('0x7b')](_0x419583);}})[_0x2ae7('0x2a')](function(_0x53d022){if(_0x53d022){return _0x53d022?{'count':_0x1e36bd,'rows':_0x53d022}:null;}})[_0x2ae7('0x2a')](respondWithResult(_0x3b079a,null))[_0x2ae7('0x4b')](handleError(_0x3b079a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 5bfccd3..a8f364b 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 _0x76a1=['events','Dashboard','setMaxListeners','save','update','emit','exports'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x76a1,0xa1));var _0x176a=function(_0x46523f,_0x1f0fe5){_0x46523f=_0x46523f-0x0;var _0x13c5c8=_0x76a1[_0x46523f];return _0x13c5c8;};'use strict';var EventEmitter=require(_0x176a('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x176a('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x176a('0x2')](0x0);var events={'afterCreate':_0x176a('0x3'),'afterUpdate':_0x176a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2d0eab){return function(_0x272e35,_0xf65b07,_0x2bb894){DashboardEvents[_0x176a('0x5')](_0x2d0eab+':'+_0x272e35['id'],_0x272e35);DashboardEvents['emit'](_0x2d0eab,_0x272e35);_0x2bb894(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x176a('0x6')]=DashboardEvents; \ No newline at end of file +var _0xbc45=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xbc45,0x122));var _0x5bc4=function(_0x451290,_0x1078a9){_0x451290=_0x451290-0x0;var _0x9d01b9=_0xbc45[_0x451290];return _0x9d01b9;};'use strict';var EventEmitter=require(_0x5bc4('0x0'));var Dashboard=require(_0x5bc4('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5bc4('0x2')](0x0);var events={'afterCreate':_0x5bc4('0x3'),'afterUpdate':_0x5bc4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c125c){return function(_0xcd9a14,_0xdf188a,_0x46f7e1){DashboardEvents['emit'](_0x5c125c+':'+_0xcd9a14['id'],_0xcd9a14);DashboardEvents[_0x5bc4('0x5')](_0x5c125c,_0xcd9a14);_0x46f7e1(null);};}for(var e in events){if(events[_0x5bc4('0x6')](e)){var event=events[e];Dashboard[_0x5bc4('0x7')](e,emitEvent(event));}}module[_0x5bc4('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 f21edf3..acf00ea 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 _0xea38=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util'];(function(_0x3bacf8,_0x315aaa){var _0x53d999=function(_0xd57078){while(--_0xd57078){_0x3bacf8['push'](_0x3bacf8['shift']());}};_0x53d999(++_0x315aaa);}(_0xea38,0x143));var _0x8ea3=function(_0x1a6363,_0x205f25){_0x1a6363=_0x1a6363-0x0;var _0xd22157=_0xea38[_0x1a6363];return _0xd22157;};'use strict';var _=require(_0x8ea3('0x0'));var util=require(_0x8ea3('0x1'));var logger=require(_0x8ea3('0x2'))('api');var moment=require(_0x8ea3('0x3'));var BPromise=require(_0x8ea3('0x4'));var rp=require(_0x8ea3('0x5'));var fs=require('fs');var path=require(_0x8ea3('0x6'));var rimraf=require(_0x8ea3('0x7'));var config=require(_0x8ea3('0x8'));var attributes=require(_0x8ea3('0x9'));module[_0x8ea3('0xa')]=function(_0x5d29de,_0x1d1103){return _0x5d29de[_0x8ea3('0xb')](_0x8ea3('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x151f=['api','moment','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x342da2,_0x27ab1f){var _0x44c55e=function(_0x297892){while(--_0x297892){_0x342da2['push'](_0x342da2['shift']());}};_0x44c55e(++_0x27ab1f);}(_0x151f,0xfc));var _0xf151=function(_0x4e5ee9,_0x1f3bb9){_0x4e5ee9=_0x4e5ee9-0x0;var _0x1488ce=_0x151f[_0x4e5ee9];return _0x1488ce;};'use strict';var _=require(_0xf151('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf151('0x1'));var moment=require(_0xf151('0x2'));var BPromise=require('bluebird');var rp=require(_0xf151('0x3'));var fs=require('fs');var path=require(_0xf151('0x4'));var rimraf=require(_0xf151('0x5'));var config=require('../../config/environment');var attributes=require(_0xf151('0x6'));module[_0xf151('0x7')]=function(_0x1614cd,_0x1ef6cc){return _0x1614cd[_0xf151('0x8')](_0xf151('0x9'),attributes,{'tableName':_0xf151('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 6051d77..2bf47e6 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 _0xd245=['./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd245,0x14d));var _0x5d24=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xd245[_0x4b5813];return _0x423465;};'use strict';var _=require('lodash');var util=require(_0x5d24('0x0'));var moment=require(_0x5d24('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d24('0x2'));var fs=require('fs');var Redis=require(_0x5d24('0x3'));var db=require(_0x5d24('0x4'))['db'];var utils=require(_0x5d24('0x5'));var logger=require(_0x5d24('0x6'))(_0x5d24('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d24('0x8'));var client=jayson[_0x5d24('0x9')][_0x5d24('0xa')]({'port':0x232a});config[_0x5d24('0xb')]=_[_0x5d24('0xc')](config[_0x5d24('0xb')],{'host':_0x5d24('0xd'),'port':0x18eb});var socket=require(_0x5d24('0xe'))(new Redis(config['redis']));require(_0x5d24('0xf'))['register'](socket);function respondWithRpcPromise(_0x613959,_0xdf32b7,_0x228bd5){return new BPromise(function(_0x5aaf3f,_0x33f17b){return client[_0x5d24('0x10')](_0x613959,_0x228bd5)[_0x5d24('0x11')](function(_0x3788ad){logger[_0x5d24('0x12')](_0x5d24('0x13'),_0xdf32b7,_0x5d24('0x14'));logger[_0x5d24('0x15')](_0x5d24('0x16'),_0xdf32b7,_0x5d24('0x14'),JSON[_0x5d24('0x17')](_0x3788ad));if(_0x3788ad['error']){if(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x19')]===0x1f4){logger[_0x5d24('0x18')](_0x5d24('0x13'),_0xdf32b7,_0x3788ad['error'][_0x5d24('0x1a')]);return _0x33f17b(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);}logger['error'](_0x5d24('0x13'),_0xdf32b7,_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);return _0x5aaf3f(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);}else{logger['info'](_0x5d24('0x13'),_0xdf32b7,_0x5d24('0x14'));_0x5aaf3f(_0x3788ad[_0x5d24('0x1b')]['message']);}})[_0x5d24('0x1c')](function(_0x1f2f2f){logger[_0x5d24('0x18')](_0x5d24('0x13'),_0xdf32b7,_0x1f2f2f);_0x33f17b(_0x1f2f2f);});});} \ No newline at end of file +var _0x9f1a=['./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis'];(function(_0x24052e,_0x40fc04){var _0x1a52b4=function(_0x1fff6e){while(--_0x1fff6e){_0x24052e['push'](_0x24052e['shift']());}};_0x1a52b4(++_0x40fc04);}(_0x9f1a,0x122));var _0xa9f1=function(_0x42a96a,_0x117eed){_0x42a96a=_0x42a96a-0x0;var _0x55742e=_0x9f1a[_0x42a96a];return _0x55742e;};'use strict';var _=require(_0xa9f1('0x0'));var util=require('util');var moment=require(_0xa9f1('0x1'));var BPromise=require('bluebird');var rs=require(_0xa9f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9f1('0x3'))['db'];var utils=require(_0xa9f1('0x4'));var logger=require(_0xa9f1('0x5'))(_0xa9f1('0x6'));var config=require(_0xa9f1('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xa9f1('0x8')]=_['defaults'](config[_0xa9f1('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9f1('0x8')]));require(_0xa9f1('0x9'))[_0xa9f1('0xa')](socket);function respondWithRpcPromise(_0x287db,_0x5f5173,_0x519804){return new BPromise(function(_0x302baa,_0xb47170){return client[_0xa9f1('0xb')](_0x287db,_0x519804)['then'](function(_0xec1a6d){logger['info'](_0xa9f1('0xc'),_0x5f5173,_0xa9f1('0xd'));logger[_0xa9f1('0xe')](_0xa9f1('0xf'),_0x5f5173,_0xa9f1('0xd'),JSON[_0xa9f1('0x10')](_0xec1a6d));if(_0xec1a6d[_0xa9f1('0x11')]){if(_0xec1a6d[_0xa9f1('0x11')][_0xa9f1('0x12')]===0x1f4){logger['error'](_0xa9f1('0xc'),_0x5f5173,_0xec1a6d[_0xa9f1('0x11')][_0xa9f1('0x13')]);return _0xb47170(_0xec1a6d['error']['message']);}logger[_0xa9f1('0x11')](_0xa9f1('0xc'),_0x5f5173,_0xec1a6d[_0xa9f1('0x11')][_0xa9f1('0x13')]);return _0x302baa(_0xec1a6d['error'][_0xa9f1('0x13')]);}else{logger[_0xa9f1('0x14')]('Dashboard,\x20%s,\x20%s',_0x5f5173,_0xa9f1('0xd'));_0x302baa(_0xec1a6d[_0xa9f1('0x15')]['message']);}})[_0xa9f1('0x16')](function(_0x1111ee){logger[_0xa9f1('0x11')]('Dashboard,\x20%s,\x20%s',_0x5f5173,_0x1111ee);_0xb47170(_0x1111ee);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3440d28..121bc7a 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 _0x6720=['dashboard:','./dashboard.events','emit','removeListener','register','length'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0x6720,0x163));var _0x0672=function(_0x2975ad,_0x3e930c){_0x2975ad=_0x2975ad-0x0;var _0x1cd96b=_0x6720[_0x2975ad];return _0x1cd96b;};'use strict';var DashboardEvents=require(_0x0672('0x0'));var events=['save','remove','update'];function createListener(_0x187578,_0x37dc6d){return function(_0x249c82){_0x37dc6d[_0x0672('0x1')](_0x187578,_0x249c82);};}function removeListener(_0x373ecf,_0x347da2){return function(){DashboardEvents[_0x0672('0x2')](_0x373ecf,_0x347da2);};}exports[_0x0672('0x3')]=function(_0x5850a7){for(var _0x582f04=0x0,_0x1c68a5=events[_0x0672('0x4')];_0x582f04<_0x1c68a5;_0x582f04++){var _0x357eeb=events[_0x582f04];var _0x2f5886=createListener(_0x0672('0x5')+_0x357eeb,_0x5850a7);DashboardEvents['on'](_0x357eeb,_0x2f5886);}}; \ No newline at end of file +var _0x08d7=['update','emit','removeListener','register','length','dashboard:','./dashboard.events','remove'];(function(_0x55bd46,_0x5aa382){var _0x45ec3e=function(_0x4210a0){while(--_0x4210a0){_0x55bd46['push'](_0x55bd46['shift']());}};_0x45ec3e(++_0x5aa382);}(_0x08d7,0xe6));var _0x708d=function(_0x78800,_0x5c6ed5){_0x78800=_0x78800-0x0;var _0x3f873a=_0x08d7[_0x78800];return _0x3f873a;};'use strict';var DashboardEvents=require(_0x708d('0x0'));var events=['save',_0x708d('0x1'),_0x708d('0x2')];function createListener(_0x3f56d5,_0x2cdbe2){return function(_0x7e61eb){_0x2cdbe2[_0x708d('0x3')](_0x3f56d5,_0x7e61eb);};}function removeListener(_0x6a8e0b,_0x1006ef){return function(){DashboardEvents[_0x708d('0x4')](_0x6a8e0b,_0x1006ef);};}exports[_0x708d('0x5')]=function(_0xaf336b){for(var _0x1b9311=0x0,_0x20261f=events[_0x708d('0x6')];_0x1b9311<_0x20261f;_0x1b9311++){var _0x468468=events[_0x1b9311];var _0x4fc303=createListener(_0x708d('0x7')+_0x468468,_0xaf336b);DashboardEvents['on'](_0x468468,_0x4fc303);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6fdcf34..5db2191 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x19026b,_0xd536a0){var _0x42d065=function(_0xa0ac64){while(--_0xa0ac64){_0x19026b['push'](_0x19026b['shift']());}};_0x42d065(++_0xd536a0);}(_0x70e0,0x17b));var _0x070e=function(_0x22ef48,_0x5a7130){_0x22ef48=_0x22ef48-0x0;var _0x4488c5=_0x70e0[_0x22ef48];return _0x4488c5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _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(_0x4894c8,_0x26bc8c){var _0x35ef8e=function(_0x1490c3){while(--_0x1490c3){_0x4894c8['push'](_0x4894c8['shift']());}};_0x35ef8e(++_0x26bc8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 2f8fdfe..519b6d4 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 _0x4943=['TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize','lodash','exports','STRING'];(function(_0x26de1c,_0x27b24b){var _0x11a31a=function(_0x55b300){while(--_0x55b300){_0x26de1c['push'](_0x26de1c['shift']());}};_0x11a31a(++_0x27b24b);}(_0x4943,0x170));var _0x3494=function(_0x58fa9f,_0x5a4566){_0x58fa9f=_0x58fa9f-0x0;var _0x239fc5=_0x4943[_0x58fa9f];return _0x239fc5;};'use strict';var Sequelize=require(_0x3494('0x0'));var squel=require('squel');var _=require(_0x3494('0x1'));module[_0x3494('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3494('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3494('0x4')](_0x3494('0x5')),'get':function(){try{return JSON[_0x3494('0x6')](this['getDataValue'](_0x3494('0x7')));}catch(_0xf2e160){return[];}},'set':function(_0x1dc168){try{this[_0x3494('0x8')]('attrs',JSON['stringify'](_0x1dc168));}catch(_0x5c5b03){this['setDataValue'](_0x3494('0x7'),JSON[_0x3494('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3494('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3494('0xa')]},'col':{'type':Sequelize[_0x3494('0xa')]},'background':{'type':Sequelize[_0x3494('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3494('0x3')],'allowNull':![],'defaultValue':_0x3494('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3494('0x3')]}}; \ No newline at end of file +var _0x0c09=['STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0x0c09,0x128));var _0x90c0=function(_0x4e2c9a,_0x7a2d99){_0x4e2c9a=_0x4e2c9a-0x0;var _0x503c38=_0x0c09[_0x4e2c9a];return _0x503c38;};'use strict';var Sequelize=require(_0x90c0('0x0'));var squel=require(_0x90c0('0x1'));var _=require(_0x90c0('0x2'));module[_0x90c0('0x3')]={'title':{'type':Sequelize[_0x90c0('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x90c0('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x90c0('0x5')](_0x90c0('0x6')),'get':function(){try{return JSON[_0x90c0('0x7')](this[_0x90c0('0x8')](_0x90c0('0x9')));}catch(_0x321197){return[];}},'set':function(_0xed82d5){try{this[_0x90c0('0xa')](_0x90c0('0x9'),JSON[_0x90c0('0xb')](_0xed82d5));}catch(_0x3e69e4){this['setDataValue']('attrs',JSON[_0x90c0('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x90c0('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x90c0('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x90c0('0xc')]},'col':{'type':Sequelize[_0x90c0('0xc')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x90c0('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x90c0('0x4')],'allowNull':![],'defaultValue':_0x90c0('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x90c0('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 78637ba..fcc3ee8 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 _0xcba8=['fields','attributes','include','merge','options','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','offset','set','Content-Range','apply','destroy','then','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xcba8,0xdb));var _0x8cba=function(_0x1a6265,_0x290045){_0x1a6265=_0x1a6265-0x0;var _0x12b732=_0xcba8[_0x1a6265];return _0x12b732;};'use strict';var pdf=require(_0x8cba('0x0'));var emlformat=require(_0x8cba('0x1'));var rimraf=require(_0x8cba('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cba('0x3'));var rp=require(_0x8cba('0x4'));var moment=require(_0x8cba('0x5'));var BPromise=require(_0x8cba('0x6'));var Mustache=require(_0x8cba('0x7'));var util=require('util');var path=require(_0x8cba('0x8'));var sox=require(_0x8cba('0x9'));var csv=require('to-csv');var ejs=require(_0x8cba('0xa'));var fs=require('fs');var _=require(_0x8cba('0xb'));var squel=require(_0x8cba('0xc'));var crypto=require('crypto');var jsforce=require(_0x8cba('0xd'));var deskjs=require(_0x8cba('0xe'));var toCsv=require(_0x8cba('0xf'));var querystring=require(_0x8cba('0x10'));var Papa=require(_0x8cba('0x11'));var Redis=require(_0x8cba('0x12'));var authService=require(_0x8cba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8cba('0x14'));var hardwareService=require(_0x8cba('0x15'));var logger=require(_0x8cba('0x16'))(_0x8cba('0x17'));var utils=require(_0x8cba('0x18'));var config=require(_0x8cba('0x19'));var db=require(_0x8cba('0x1a'))['db'];config[_0x8cba('0x1b')]=_[_0x8cba('0x1c')](config[_0x8cba('0x1b')],{'host':_0x8cba('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cba('0x1b')]));require(_0x8cba('0x1e'))['register'](socket);function respondWithStatusCode(_0x251b62,_0x40baa7){_0x40baa7=_0x40baa7||0xcc;return function(_0x21f717){if(_0x21f717){return _0x251b62[_0x8cba('0x1f')](_0x40baa7);}return _0x251b62[_0x8cba('0x20')](_0x40baa7)[_0x8cba('0x21')]();};}function respondWithResult(_0x1bc429,_0x1dc0ed){_0x1dc0ed=_0x1dc0ed||0xc8;return function(_0x34ea26){if(_0x34ea26){return _0x1bc429['status'](_0x1dc0ed)[_0x8cba('0x22')](_0x34ea26);}};}function respondWithFilteredResult(_0x932154,_0x3cc150){return function(_0xf9d908){if(_0xf9d908){var _0x5706f0=_0xf9d908['count'],_0x4b0542=_0x3cc150[_0x8cba('0x23')],_0x4ab58c=_0x3cc150[_0x8cba('0x23')]+_0x3cc150['limit'],_0xc8c5c3;if(_0x4ab58c>=_0x5706f0){_0x4ab58c=_0x5706f0;_0xc8c5c3=0xc8;}else{_0xc8c5c3=0xce;}_0x932154[_0x8cba('0x20')](_0xc8c5c3);return _0x932154[_0x8cba('0x24')](_0x8cba('0x25'),_0x4b0542+'-'+_0x4ab58c+'/'+_0x5706f0)['json'](_0xf9d908);}return null;};}function patchUpdates(_0x32ead0){return function(_0x249539){try{jsonpatch[_0x8cba('0x26')](_0x249539,_0x32ead0,!![]);}catch(_0x5d97b3){return BPromise['reject'](_0x5d97b3);}return _0x249539['save']();};}function saveUpdates(_0x34f651,_0x13fb63){return function(_0xc8bbdb){if(_0xc8bbdb){return _0xc8bbdb['update'](_0x34f651)['then'](function(_0x1f7886){return _0x1f7886;});}return null;};}function removeEntity(_0x19bd1f,_0x496b95){return function(_0x567f22){if(_0x567f22){return _0x567f22[_0x8cba('0x27')]()[_0x8cba('0x28')](function(){_0x19bd1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ca8b,_0x191670){return function(_0x205f03){if(!_0x205f03){_0x25ca8b[_0x8cba('0x1f')](0x194);}return _0x205f03;};}function handleError(_0x2410dc,_0x284aa3){_0x284aa3=_0x284aa3||0x1f4;return function(_0x70e5c3){logger[_0x8cba('0x29')](_0x70e5c3[_0x8cba('0x2a')]);if(_0x70e5c3[_0x8cba('0x2b')]){delete _0x70e5c3[_0x8cba('0x2b')];}_0x2410dc[_0x8cba('0x20')](_0x284aa3)[_0x8cba('0x2c')](_0x70e5c3);};}exports[_0x8cba('0x2d')]=function(_0x23f8ee,_0x4270a4){var _0x65d310={'raw':![],'where':{'id':_0x23f8ee[_0x8cba('0x2e')]['id']}},_0x5d8d7a={};_0x5d8d7a[_0x8cba('0x2f')]=_['keys'](db[_0x8cba('0x30')][_0x8cba('0x31')]);_0x5d8d7a[_0x8cba('0x32')]=_[_0x8cba('0x33')](_0x23f8ee[_0x8cba('0x32')]);_0x5d8d7a[_0x8cba('0x34')]=_[_0x8cba('0x35')](_0x5d8d7a['model'],_0x5d8d7a['query']);_0x65d310['attributes']=_['intersection'](_0x5d8d7a['model'],qs[_0x8cba('0x36')](_0x23f8ee[_0x8cba('0x32')][_0x8cba('0x36')]));_0x65d310[_0x8cba('0x37')]=_0x65d310[_0x8cba('0x37')]['length']?_0x65d310[_0x8cba('0x37')]:_0x5d8d7a[_0x8cba('0x2f')];if(_0x23f8ee[_0x8cba('0x32')]['includeAll']){_0x65d310[_0x8cba('0x38')]=[{'all':!![]}];}_0x65d310=_[_0x8cba('0x39')]({},_0x65d310,_0x23f8ee[_0x8cba('0x3a')]);return db[_0x8cba('0x30')]['find'](_0x65d310)[_0x8cba('0x28')](handleEntityNotFound(_0x4270a4,null))['then'](respondWithResult(_0x4270a4,null))[_0x8cba('0x3b')](handleError(_0x4270a4,null));};exports[_0x8cba('0x27')]=function(_0x33f2e8,_0xff521d){return db[_0x8cba('0x30')][_0x8cba('0x3c')]({'where':{'id':_0x33f2e8[_0x8cba('0x2e')]['id']}})[_0x8cba('0x28')](handleEntityNotFound(_0xff521d,null))['then'](removeEntity(_0xff521d,null))['catch'](handleError(_0xff521d,null));};function widgetAttributes(_0x15aa16){try{switch(_0x15aa16[_0x8cba('0x3d')]){case _0x8cba('0x3e'):return[{'name':_0x8cba('0x3f'),'value':_0x15aa16[_0x8cba('0x3f')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x41')]:undefined)||_0x8cba('0x42')}];case _0x8cba('0x43'):return[{'name':_0x8cba('0x44'),'value':_0x15aa16[_0x8cba('0x44')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16['attrs'][0x0][_0x8cba('0x41')]:undefined)||''}];case _0x8cba('0x45'):return[{'name':_0x8cba('0x46'),'value':_0x15aa16['attrHourFormat']||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x41')]:undefined)||_0x8cba('0x47')},{'name':_0x8cba('0x48'),'value':_0x15aa16[_0x8cba('0x48')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x1]?_0x15aa16[_0x8cba('0x40')][0x1][_0x8cba('0x41')]:undefined)||_0x8cba('0x49')},{'name':'attrFontSize','value':_0x15aa16[_0x8cba('0x4a')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x2]?_0x15aa16['attrs'][0x2][_0x8cba('0x41')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x15aa16[_0x8cba('0x4b')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16['attrs'][0x0][_0x8cba('0x41')]:undefined)||_0x8cba('0x4c')},{'name':_0x8cba('0x4d'),'value':_0x15aa16[_0x8cba('0x4d')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x1]?_0x15aa16[_0x8cba('0x40')][0x1]['value']:undefined)||[]},{'name':_0x8cba('0x4a'),'value':_0x15aa16['attrFontSize']||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16['attrs'][0x2]?_0x15aa16[_0x8cba('0x40')][0x2][_0x8cba('0x41')]:undefined)||0x14}];case _0x8cba('0x4e'):case _0x8cba('0x4f'):return[{'name':'attrSerie1','value':_0x15aa16[_0x8cba('0x50')]||(_0x15aa16['attrs']&&_0x15aa16[_0x8cba('0x40')][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x41')]:undefined)||_0x8cba('0x4c')},{'name':_0x8cba('0x51'),'value':_0x15aa16[_0x8cba('0x51')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x1]?_0x15aa16[_0x8cba('0x40')][0x1]['value']:undefined)||null},{'name':_0x8cba('0x52'),'value':_0x15aa16['attrSerie3']||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x2]?_0x15aa16[_0x8cba('0x40')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x15aa16[_0x8cba('0x4d')]||(_0x15aa16['attrs']&&_0x15aa16['attrs'][0x3]?_0x15aa16[_0x8cba('0x40')][0x3][_0x8cba('0x41')]:undefined)||[]}];case _0x8cba('0x53'):return[{'name':_0x8cba('0x54'),'type':_0x15aa16['reportType']||(_0x15aa16['attrs']&&_0x15aa16['attrs'][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x3d')]:undefined)||null,'value':_0x15aa16[_0x8cba('0x54')]||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16['attrs'][0x0]?_0x15aa16[_0x8cba('0x40')][0x0][_0x8cba('0x41')]:undefined)||null},{'name':_0x8cba('0x55'),'value':_0x15aa16['attrRefresh']||(_0x15aa16[_0x8cba('0x40')]&&_0x15aa16[_0x8cba('0x40')][0x1]?_0x15aa16[_0x8cba('0x40')][0x1][_0x8cba('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x56f2da){logger[_0x8cba('0x29')](_0x8cba('0x56'),JSON[_0x8cba('0x57')](_0x56f2da));return[];}}exports[_0x8cba('0x58')]=function(_0x4b1ab1,_0x44a109){if(_0x4b1ab1[_0x8cba('0x59')]){_0x4b1ab1['body'][_0x8cba('0x40')]=widgetAttributes(_0x4b1ab1[_0x8cba('0x59')]);}return db[_0x8cba('0x30')][_0x8cba('0x58')](_0x4b1ab1[_0x8cba('0x59')],{})[_0x8cba('0x28')](respondWithResult(_0x44a109,0xc9))[_0x8cba('0x3b')](handleError(_0x44a109,null));};exports[_0x8cba('0x5a')]=function(_0x571fe0,_0x4e5665){if(_0x571fe0['body']['id']){delete _0x571fe0[_0x8cba('0x59')]['id'];}_0x571fe0[_0x8cba('0x59')][_0x8cba('0x40')]=widgetAttributes(_0x571fe0[_0x8cba('0x59')]);return db[_0x8cba('0x30')][_0x8cba('0x3c')]({'where':{'id':_0x571fe0['params']['id']}})['then'](handleEntityNotFound(_0x4e5665,null))['then'](saveUpdates(_0x571fe0['body'],null))[_0x8cba('0x28')](respondWithResult(_0x4e5665,null))[_0x8cba('0x3b')](handleError(_0x4e5665,null));}; \ No newline at end of file +var _0x484c=['options','DashboardItem','find','catch','type','attrUrl','attrs','value','https://','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','offset','limit','set','json','apply','reject','save','destroy','then','error','stack','name','send','params','keys','rawAttributes','query','filters','intersection','attributes','model','fields','length','includeAll','include','merge'];(function(_0x17324d,_0x46fd09){var _0x47c171=function(_0x410a36){while(--_0x410a36){_0x17324d['push'](_0x17324d['shift']());}};_0x47c171(++_0x46fd09);}(_0x484c,0x1db));var _0xc484=function(_0x28c526,_0x2d2a43){_0x28c526=_0x28c526-0x0;var _0x4bfe02=_0x484c[_0x28c526];return _0x4bfe02;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc484('0x0'));var rimraf=require(_0xc484('0x1'));var zipdir=require(_0xc484('0x2'));var jsonpatch=require(_0xc484('0x3'));var rp=require(_0xc484('0x4'));var moment=require(_0xc484('0x5'));var BPromise=require(_0xc484('0x6'));var Mustache=require(_0xc484('0x7'));var util=require(_0xc484('0x8'));var path=require(_0xc484('0x9'));var sox=require(_0xc484('0xa'));var csv=require(_0xc484('0xb'));var ejs=require(_0xc484('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc484('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc484('0xe'));var toCsv=require(_0xc484('0xb'));var querystring=require(_0xc484('0xf'));var Papa=require(_0xc484('0x10'));var Redis=require(_0xc484('0x11'));var authService=require(_0xc484('0x12'));var qs=require(_0xc484('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc484('0x14'));var logger=require(_0xc484('0x15'))('api');var utils=require(_0xc484('0x16'));var config=require(_0xc484('0x17'));var db=require('../../mysqldb')['db'];config[_0xc484('0x18')]=_[_0xc484('0x19')](config['redis'],{'host':_0xc484('0x1a'),'port':0x18eb});var socket=require(_0xc484('0x1b'))(new Redis(config[_0xc484('0x18')]));require(_0xc484('0x1c'))[_0xc484('0x1d')](socket);function respondWithStatusCode(_0x270ed4,_0x5be99f){_0x5be99f=_0x5be99f||0xcc;return function(_0x4478fc){if(_0x4478fc){return _0x270ed4[_0xc484('0x1e')](_0x5be99f);}return _0x270ed4[_0xc484('0x1f')](_0x5be99f)[_0xc484('0x20')]();};}function respondWithResult(_0x4f54f2,_0x464581){_0x464581=_0x464581||0xc8;return function(_0x506b3b){if(_0x506b3b){return _0x4f54f2[_0xc484('0x1f')](_0x464581)['json'](_0x506b3b);}};}function respondWithFilteredResult(_0x5e3851,_0x5a4db2){return function(_0x4a351a){if(_0x4a351a){var _0x205ecd=_0x4a351a['count'],_0x59293f=_0x5a4db2[_0xc484('0x21')],_0x1b962c=_0x5a4db2[_0xc484('0x21')]+_0x5a4db2[_0xc484('0x22')],_0x204e45;if(_0x1b962c>=_0x205ecd){_0x1b962c=_0x205ecd;_0x204e45=0xc8;}else{_0x204e45=0xce;}_0x5e3851[_0xc484('0x1f')](_0x204e45);return _0x5e3851[_0xc484('0x23')]('Content-Range',_0x59293f+'-'+_0x1b962c+'/'+_0x205ecd)[_0xc484('0x24')](_0x4a351a);}return null;};}function patchUpdates(_0x78b1bf){return function(_0x86601f){try{jsonpatch[_0xc484('0x25')](_0x86601f,_0x78b1bf,!![]);}catch(_0x3e256a){return BPromise[_0xc484('0x26')](_0x3e256a);}return _0x86601f[_0xc484('0x27')]();};}function saveUpdates(_0x5b4ba2,_0x2060e6){return function(_0x1ec155){if(_0x1ec155){return _0x1ec155['update'](_0x5b4ba2)['then'](function(_0x1a7490){return _0x1a7490;});}return null;};}function removeEntity(_0x30819b,_0x394c8e){return function(_0x5adb90){if(_0x5adb90){return _0x5adb90[_0xc484('0x28')]()[_0xc484('0x29')](function(){_0x30819b[_0xc484('0x1f')](0xcc)[_0xc484('0x20')]();});}};}function handleEntityNotFound(_0x155874,_0x5ae22e){return function(_0x514114){if(!_0x514114){_0x155874[_0xc484('0x1e')](0x194);}return _0x514114;};}function handleError(_0x17b0ce,_0x4e246d){_0x4e246d=_0x4e246d||0x1f4;return function(_0x54e1af){logger[_0xc484('0x2a')](_0x54e1af[_0xc484('0x2b')]);if(_0x54e1af['name']){delete _0x54e1af[_0xc484('0x2c')];}_0x17b0ce['status'](_0x4e246d)[_0xc484('0x2d')](_0x54e1af);};}exports['show']=function(_0x2634c0,_0x14c6ed){var _0x13b767={'raw':![],'where':{'id':_0x2634c0[_0xc484('0x2e')]['id']}},_0x4fec31={};_0x4fec31['model']=_[_0xc484('0x2f')](db['DashboardItem'][_0xc484('0x30')]);_0x4fec31[_0xc484('0x31')]=_[_0xc484('0x2f')](_0x2634c0['query']);_0x4fec31[_0xc484('0x32')]=_[_0xc484('0x33')](_0x4fec31['model'],_0x4fec31[_0xc484('0x31')]);_0x13b767[_0xc484('0x34')]=_[_0xc484('0x33')](_0x4fec31[_0xc484('0x35')],qs[_0xc484('0x36')](_0x2634c0[_0xc484('0x31')]['fields']));_0x13b767['attributes']=_0x13b767['attributes'][_0xc484('0x37')]?_0x13b767[_0xc484('0x34')]:_0x4fec31[_0xc484('0x35')];if(_0x2634c0[_0xc484('0x31')][_0xc484('0x38')]){_0x13b767[_0xc484('0x39')]=[{'all':!![]}];}_0x13b767=_[_0xc484('0x3a')]({},_0x13b767,_0x2634c0[_0xc484('0x3b')]);return db[_0xc484('0x3c')][_0xc484('0x3d')](_0x13b767)[_0xc484('0x29')](handleEntityNotFound(_0x14c6ed,null))[_0xc484('0x29')](respondWithResult(_0x14c6ed,null))[_0xc484('0x3e')](handleError(_0x14c6ed,null));};exports[_0xc484('0x28')]=function(_0x29730b,_0x4bf888){return db[_0xc484('0x3c')]['find']({'where':{'id':_0x29730b[_0xc484('0x2e')]['id']}})[_0xc484('0x29')](handleEntityNotFound(_0x4bf888,null))[_0xc484('0x29')](removeEntity(_0x4bf888,null))[_0xc484('0x3e')](handleError(_0x4bf888,null));};function widgetAttributes(_0x1f764e){try{switch(_0x1f764e[_0xc484('0x3f')]){case'iframe':return[{'name':_0xc484('0x40'),'value':_0x1f764e[_0xc484('0x40')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e['attrs'][0x0][_0xc484('0x42')]:undefined)||_0xc484('0x43')}];case'custom':return[{'name':_0xc484('0x44'),'value':_0x1f764e['attrPath']||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x42')]:undefined)||''}];case _0xc484('0x45'):return[{'name':'attrHourFormat','value':_0x1f764e['attrHourFormat']||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x42')]:undefined)||_0xc484('0x46')},{'name':_0xc484('0x47'),'value':_0x1f764e['attrTimezone']||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x1]?_0x1f764e[_0xc484('0x41')][0x1][_0xc484('0x42')]:undefined)||_0xc484('0x48')},{'name':'attrFontSize','value':_0x1f764e[_0xc484('0x49')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e['attrs'][0x2]?_0x1f764e[_0xc484('0x41')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xc484('0x4a'),'value':_0x1f764e[_0xc484('0x4a')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x42')]:undefined)||_0xc484('0x4b')},{'name':_0xc484('0x4c'),'value':_0x1f764e[_0xc484('0x4c')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e['attrs'][0x1]?_0x1f764e[_0xc484('0x41')][0x1][_0xc484('0x42')]:undefined)||[]},{'name':_0xc484('0x49'),'value':_0x1f764e[_0xc484('0x49')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x2]?_0x1f764e[_0xc484('0x41')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xc484('0x4d'):return[{'name':_0xc484('0x4e'),'value':_0x1f764e[_0xc484('0x4e')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x42')]:undefined)||_0xc484('0x4b')},{'name':_0xc484('0x4f'),'value':_0x1f764e[_0xc484('0x4f')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x1]?_0x1f764e[_0xc484('0x41')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x1f764e[_0xc484('0x50')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e['attrs'][0x2]?_0x1f764e[_0xc484('0x41')][0x2][_0xc484('0x42')]:undefined)||null},{'name':_0xc484('0x4c'),'value':_0x1f764e[_0xc484('0x4c')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x3]?_0x1f764e['attrs'][0x3][_0xc484('0x42')]:undefined)||[]}];case _0xc484('0x51'):return[{'name':_0xc484('0x52'),'type':_0x1f764e['reportType']||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0][_0xc484('0x3f')]:undefined)||null,'value':_0x1f764e[_0xc484('0x52')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x0]?_0x1f764e[_0xc484('0x41')][0x0]['value']:undefined)||null},{'name':_0xc484('0x53'),'value':_0x1f764e[_0xc484('0x53')]||(_0x1f764e[_0xc484('0x41')]&&_0x1f764e[_0xc484('0x41')][0x1]?_0x1f764e[_0xc484('0x41')][0x1][_0xc484('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x551bcd){logger[_0xc484('0x2a')](_0xc484('0x54'),JSON[_0xc484('0x55')](_0x551bcd));return[];}}exports[_0xc484('0x56')]=function(_0x1cc159,_0x426a6a){if(_0x1cc159[_0xc484('0x57')]){_0x1cc159['body']['attrs']=widgetAttributes(_0x1cc159[_0xc484('0x57')]);}return db[_0xc484('0x3c')][_0xc484('0x56')](_0x1cc159[_0xc484('0x57')],{})[_0xc484('0x29')](respondWithResult(_0x426a6a,0xc9))[_0xc484('0x3e')](handleError(_0x426a6a,null));};exports[_0xc484('0x58')]=function(_0x1e8329,_0x18a5c4){if(_0x1e8329[_0xc484('0x57')]['id']){delete _0x1e8329[_0xc484('0x57')]['id'];}_0x1e8329['body']['attrs']=widgetAttributes(_0x1e8329[_0xc484('0x57')]);return db['DashboardItem'][_0xc484('0x3d')]({'where':{'id':_0x1e8329[_0xc484('0x2e')]['id']}})[_0xc484('0x29')](handleEntityNotFound(_0x18a5c4,null))[_0xc484('0x29')](saveUpdates(_0x1e8329['body'],null))[_0xc484('0x29')](respondWithResult(_0x18a5c4,null))[_0xc484('0x3e')](handleError(_0x18a5c4,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0e66daa..02573a9 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 _0x4f96=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x13f2ec,_0x407206){var _0x389ca9=function(_0x43d7d6){while(--_0x43d7d6){_0x13f2ec['push'](_0x13f2ec['shift']());}};_0x389ca9(++_0x407206);}(_0x4f96,0xb9));var _0x64f9=function(_0x1847fd,_0x48bb28){_0x1847fd=_0x1847fd-0x0;var _0x426713=_0x4f96[_0x1847fd];return _0x426713;};'use strict';var EventEmitter=require(_0x64f9('0x0'));var DashboardItem=require(_0x64f9('0x1'))['db'][_0x64f9('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x64f9('0x3')](0x0);var events={'afterCreate':_0x64f9('0x4'),'afterUpdate':_0x64f9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x27075e){return function(_0x4c95fa,_0x5c4300,_0x1b44fd){DashboardItemEvents['emit'](_0x27075e+':'+_0x4c95fa['id'],_0x4c95fa);DashboardItemEvents[_0x64f9('0x6')](_0x27075e,_0x4c95fa);_0x1b44fd(null);};}for(var e in events){if(events[_0x64f9('0x7')](e)){var event=events[e];DashboardItem[_0x64f9('0x8')](e,emitEvent(event));}}module[_0x64f9('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x6cb7=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0xdd7cf6,_0x1e33d7){var _0x20f160=function(_0x554a61){while(--_0x554a61){_0xdd7cf6['push'](_0xdd7cf6['shift']());}};_0x20f160(++_0x1e33d7);}(_0x6cb7,0x114));var _0x76cb=function(_0x1cee90,_0x39c08d){_0x1cee90=_0x1cee90-0x0;var _0x1d0b7e=_0x6cb7[_0x1cee90];return _0x1d0b7e;};'use strict';var EventEmitter=require(_0x76cb('0x0'));var DashboardItem=require(_0x76cb('0x1'))['db'][_0x76cb('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x76cb('0x3')](0x0);var events={'afterCreate':_0x76cb('0x4'),'afterUpdate':_0x76cb('0x5'),'afterDestroy':_0x76cb('0x6')};function emitEvent(_0x256eb4){return function(_0x39f22a,_0x43db23,_0x1abaf3){DashboardItemEvents['emit'](_0x256eb4+':'+_0x39f22a['id'],_0x39f22a);DashboardItemEvents[_0x76cb('0x7')](_0x256eb4,_0x39f22a);_0x1abaf3(null);};}for(var e in events){if(events[_0x76cb('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x76cb('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 0d3eccf..fbb6400 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 _0x1858=['api','moment','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x25933a,_0x16f7d5){var _0x1cd93e=function(_0x23fa8c){while(--_0x23fa8c){_0x25933a['push'](_0x25933a['shift']());}};_0x1cd93e(++_0x16f7d5);}(_0x1858,0xbd));var _0x8185=function(_0x102a67,_0x405808){_0x102a67=_0x102a67-0x0;var _0x10ed48=_0x1858[_0x102a67];return _0x10ed48;};'use strict';var _=require(_0x8185('0x0'));var util=require(_0x8185('0x1'));var logger=require(_0x8185('0x2'))(_0x8185('0x3'));var moment=require(_0x8185('0x4'));var BPromise=require('bluebird');var rp=require(_0x8185('0x5'));var fs=require('fs');var path=require(_0x8185('0x6'));var rimraf=require('rimraf');var config=require(_0x8185('0x7'));var attributes=require(_0x8185('0x8'));module[_0x8185('0x9')]=function(_0x43908e,_0xbf3188){return _0x43908e['define'](_0x8185('0xa'),attributes,{'tableName':_0x8185('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbac=['rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2fb214,_0x568201){var _0xabc9cf=function(_0x321894){while(--_0x321894){_0x2fb214['push'](_0x2fb214['shift']());}};_0xabc9cf(++_0x568201);}(_0xcbac,0x1b4));var _0xccba=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xcbac[_0x2f3848];return _0x102668;};'use strict';var _=require(_0xccba('0x0'));var util=require(_0xccba('0x1'));var logger=require('../../config/logger')(_0xccba('0x2'));var moment=require(_0xccba('0x3'));var BPromise=require(_0xccba('0x4'));var rp=require(_0xccba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccba('0x6'));var config=require(_0xccba('0x7'));var attributes=require(_0xccba('0x8'));module[_0xccba('0x9')]=function(_0x4bbc8c,_0x593647){return _0x4bbc8c[_0xccba('0xa')](_0xccba('0xb'),attributes,{'tableName':_0xccba('0xc'),'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 4a29833..f13ed7b 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 _0x05c4=['rpc','redis','defaults','socket.io-emitter','then','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x54a7fc,_0x249f09){var _0x98a4f7=function(_0x1e8e1d){while(--_0x1e8e1d){_0x54a7fc['push'](_0x54a7fc['shift']());}};_0x98a4f7(++_0x249f09);}(_0x05c4,0x189));var _0x405c=function(_0x229c8c,_0x546d4a){_0x229c8c=_0x229c8c-0x0;var _0x5a1898=_0x05c4[_0x229c8c];return _0x5a1898;};'use strict';var _=require('lodash');var util=require(_0x405c('0x0'));var moment=require(_0x405c('0x1'));var BPromise=require(_0x405c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x405c('0x3'));var db=require(_0x405c('0x4'))['db'];var utils=require(_0x405c('0x5'));var logger=require(_0x405c('0x6'))(_0x405c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x405c('0x8')]=_[_0x405c('0x9')](config[_0x405c('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x405c('0xa'))(new Redis(config[_0x405c('0x8')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x57cd4e,_0x56e133,_0x380dc7){return new BPromise(function(_0x5e7cf9,_0x21b84e){return client['request'](_0x57cd4e,_0x380dc7)[_0x405c('0xb')](function(_0xc63fff){logger['info'](_0x405c('0xc'),_0x56e133,'request\x20sent');logger['debug'](_0x405c('0xd'),_0x56e133,_0x405c('0xe'),JSON['stringify'](_0xc63fff));if(_0xc63fff[_0x405c('0xf')]){if(_0xc63fff['error'][_0x405c('0x10')]===0x1f4){logger[_0x405c('0xf')]('DashboardItem,\x20%s,\x20%s',_0x56e133,_0xc63fff[_0x405c('0xf')]['message']);return _0x21b84e(_0xc63fff[_0x405c('0xf')][_0x405c('0x11')]);}logger[_0x405c('0xf')](_0x405c('0xc'),_0x56e133,_0xc63fff[_0x405c('0xf')][_0x405c('0x11')]);return _0x5e7cf9(_0xc63fff['error'][_0x405c('0x11')]);}else{logger['info'](_0x405c('0xc'),_0x56e133,_0x405c('0xe'));_0x5e7cf9(_0xc63fff[_0x405c('0x12')]['message']);}})[_0x405c('0x13')](function(_0x589282){logger['error'](_0x405c('0xc'),_0x56e133,_0x589282);_0x21b84e(_0x589282);});});} \ No newline at end of file +var _0x8c5b=['then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','message','DashboardItem,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8c5b,0x199));var _0xb8c5=function(_0x5a8795,_0x462f13){_0x5a8795=_0x5a8795-0x0;var _0x140a4e=_0x8c5b[_0x5a8795];return _0x140a4e;};'use strict';var _=require('lodash');var util=require(_0xb8c5('0x0'));var moment=require(_0xb8c5('0x1'));var BPromise=require(_0xb8c5('0x2'));var rs=require(_0xb8c5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8c5('0x4'))['db'];var utils=require(_0xb8c5('0x5'));var logger=require('../../config/logger')(_0xb8c5('0x6'));var config=require(_0xb8c5('0x7'));var jayson=require(_0xb8c5('0x8'));var client=jayson[_0xb8c5('0x9')][_0xb8c5('0xa')]({'port':0x232a});config[_0xb8c5('0xb')]=_[_0xb8c5('0xc')](config[_0xb8c5('0xb')],{'host':_0xb8c5('0xd'),'port':0x18eb});var socket=require(_0xb8c5('0xe'))(new Redis(config[_0xb8c5('0xb')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x2c6d5f,_0x6ec057,_0xb08f2b){return new BPromise(function(_0xc84084,_0x5500d7){return client[_0xb8c5('0xf')](_0x2c6d5f,_0xb08f2b)[_0xb8c5('0x10')](function(_0x44a756){logger[_0xb8c5('0x11')]('DashboardItem,\x20%s,\x20%s',_0x6ec057,_0xb8c5('0x12'));logger[_0xb8c5('0x13')](_0xb8c5('0x14'),_0x6ec057,'request\x20sent',JSON['stringify'](_0x44a756));if(_0x44a756[_0xb8c5('0x15')]){if(_0x44a756[_0xb8c5('0x15')]['code']===0x1f4){logger[_0xb8c5('0x15')]('DashboardItem,\x20%s,\x20%s',_0x6ec057,_0x44a756[_0xb8c5('0x15')][_0xb8c5('0x16')]);return _0x5500d7(_0x44a756['error'][_0xb8c5('0x16')]);}logger[_0xb8c5('0x15')]('DashboardItem,\x20%s,\x20%s',_0x6ec057,_0x44a756[_0xb8c5('0x15')][_0xb8c5('0x16')]);return _0xc84084(_0x44a756['error'][_0xb8c5('0x16')]);}else{logger['info'](_0xb8c5('0x17'),_0x6ec057,_0xb8c5('0x12'));_0xc84084(_0x44a756[_0xb8c5('0x18')][_0xb8c5('0x16')]);}})['catch'](function(_0x4aab4a){logger[_0xb8c5('0x15')](_0xb8c5('0x17'),_0x6ec057,_0x4aab4a);_0x5500d7(_0x4aab4a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 01c3acf..93e7d2c 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 _0xb2ce=['removeListener','length','dashboardItem:','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb2ce,0x1b6));var _0xeb2c=function(_0xfb790d,_0x1793fe){_0xfb790d=_0xfb790d-0x0;var _0x23a1b9=_0xb2ce[_0xfb790d];return _0x23a1b9;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xeb2c('0x0'),_0xeb2c('0x1'),'update'];function createListener(_0x17bc64,_0x270e3f){return function(_0x30c148){_0x270e3f['emit'](_0x17bc64,_0x30c148);};}function removeListener(_0x672cf8,_0x1b0ed5){return function(){DashboardItemEvents[_0xeb2c('0x2')](_0x672cf8,_0x1b0ed5);};}exports['register']=function(_0x40bd15){for(var _0x4baa40=0x0,_0x89a4c7=events[_0xeb2c('0x3')];_0x4baa40<_0x89a4c7;_0x4baa40++){var _0x490dbf=events[_0x4baa40];var _0x5e9561=createListener(_0xeb2c('0x4')+_0x490dbf,_0x40bd15);DashboardItemEvents['on'](_0x490dbf,_0x5e9561);}}; \ No newline at end of file +var _0x2bc1=['dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener','register'];(function(_0x1cffe2,_0x5383e8){var _0x57030e=function(_0xe9c73f){while(--_0xe9c73f){_0x1cffe2['push'](_0x1cffe2['shift']());}};_0x57030e(++_0x5383e8);}(_0x2bc1,0x9b));var _0x12bc=function(_0x42867b,_0x26bdfa){_0x42867b=_0x42867b-0x0;var _0x1a748f=_0x2bc1[_0x42867b];return _0x1a748f;};'use strict';var DashboardItemEvents=require(_0x12bc('0x0'));var events=[_0x12bc('0x1'),_0x12bc('0x2'),'update'];function createListener(_0x912d09,_0x367570){return function(_0x7b4dbb){_0x367570[_0x12bc('0x3')](_0x912d09,_0x7b4dbb);};}function removeListener(_0x29f50e,_0x26cf8b){return function(){DashboardItemEvents[_0x12bc('0x4')](_0x29f50e,_0x26cf8b);};}exports[_0x12bc('0x5')]=function(_0x4f3bcd){for(var _0x27ffea=0x0,_0x3b9c5f=events['length'];_0x27ffea<_0x3b9c5f;_0x27ffea++){var _0x414cc9=events[_0x27ffea];var _0xc839f0=createListener(_0x12bc('0x6')+_0x414cc9,_0x4f3bcd);DashboardItemEvents['on'](_0x414cc9,_0xc839f0);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a4668ff..6d869b6 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 _0xe2fe=['put','update','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post'];(function(_0x243e2,_0x6cec7b){var _0x2d377c=function(_0x241881){while(--_0x241881){_0x243e2['push'](_0x243e2['shift']());}};_0x2d377c(++_0x6cec7b);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get'](_0xee2f('0x7'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x9')]('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0xa')]('/:id',auth[_0xee2f('0x8')](),controller[_0xee2f('0xb')]);router['delete'](_0xee2f('0x7'),auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x187d=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x187d,0x93));var _0xd187=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x187d[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/:id',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller['update']);router[_0xd187('0xf')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller[_0xd187('0x10')]);module[_0xd187('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 8eaccc8..7605ecc 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 _0xae5e=['STRING','exports'];(function(_0x3b7c44,_0x41a0e4){var _0x65690c=function(_0xb72319){while(--_0xb72319){_0x3b7c44['push'](_0x3b7c44['shift']());}};_0x65690c(++_0x41a0e4);}(_0xae5e,0x103));var _0xeae5=function(_0x3484d8,_0x2e0def){_0x3484d8=_0x3484d8-0x0;var _0x1ebb5f=_0xae5e[_0x3484d8];return _0x1ebb5f;};'use strict';var Sequelize=require('sequelize');module[_0xeae5('0x0')]={'name':{'type':Sequelize[_0xeae5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xeb74=['STRING','sequelize','exports'];(function(_0x37dbb8,_0x3669e1){var _0x587a3c=function(_0x9045ce){while(--_0x9045ce){_0x37dbb8['push'](_0x37dbb8['shift']());}};_0x587a3c(++_0x3669e1);}(_0xeb74,0xa3));var _0x4eb7=function(_0x55fcaa,_0x1231f8){_0x55fcaa=_0x55fcaa-0x0;var _0xf595d8=_0xeb74[_0x55fcaa];return _0xf595d8;};'use strict';var Sequelize=require(_0x4eb7('0x0'));module[_0x4eb7('0x1')]={'name':{'type':Sequelize[_0x4eb7('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 ab31a58..fe3441e 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 _0xbce5=['bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','json','apply','reject','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','map','Disposition','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','html-pdf','eml-format','request-promise','moment'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0xbce5,0xe9));var _0x5bce=function(_0x50b750,_0xe5817b){_0x50b750=_0x50b750-0x0;var _0x1b60a8=_0xbce5[_0x50b750];return _0x1b60a8;};'use strict';var pdf=require(_0x5bce('0x0'));var emlformat=require(_0x5bce('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5bce('0x2'));var moment=require(_0x5bce('0x3'));var BPromise=require(_0x5bce('0x4'));var Mustache=require(_0x5bce('0x5'));var util=require('util');var path=require(_0x5bce('0x6'));var sox=require(_0x5bce('0x7'));var csv=require('to-csv');var ejs=require(_0x5bce('0x8'));var fs=require('fs');var _=require(_0x5bce('0x9'));var squel=require('squel');var crypto=require(_0x5bce('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5bce('0xb'));var toCsv=require(_0x5bce('0xc'));var querystring=require(_0x5bce('0xd'));var Papa=require(_0x5bce('0xe'));var Redis=require(_0x5bce('0xf'));var authService=require(_0x5bce('0x10'));var qs=require(_0x5bce('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bce('0x12'));var logger=require('../../config/logger')(_0x5bce('0x13'));var utils=require(_0x5bce('0x14'));var config=require(_0x5bce('0x15'));var db=require(_0x5bce('0x16'))['db'];function respondWithStatusCode(_0x53a5dc,_0x5e9d61){_0x5e9d61=_0x5e9d61||0xcc;return function(_0x47042d){if(_0x47042d){return _0x53a5dc[_0x5bce('0x17')](_0x5e9d61);}return _0x53a5dc['status'](_0x5e9d61)[_0x5bce('0x18')]();};}function respondWithResult(_0x36bcff,_0x3aa571){_0x3aa571=_0x3aa571||0xc8;return function(_0x52ddb5){if(_0x52ddb5){return _0x36bcff[_0x5bce('0x19')](_0x3aa571)['json'](_0x52ddb5);}};}function respondWithFilteredResult(_0x23de50,_0x363c35){return function(_0x10d12b){if(_0x10d12b){var _0x40193f=_0x10d12b['count'],_0x5600f1=_0x363c35['offset'],_0x3b53e5=_0x363c35[_0x5bce('0x1a')]+_0x363c35[_0x5bce('0x1b')],_0x2411e1;if(_0x3b53e5>=_0x40193f){_0x3b53e5=_0x40193f;_0x2411e1=0xc8;}else{_0x2411e1=0xce;}_0x23de50['status'](_0x2411e1);return _0x23de50[_0x5bce('0x1c')]('Content-Range',_0x5600f1+'-'+_0x3b53e5+'/'+_0x40193f)[_0x5bce('0x1d')](_0x10d12b);}return null;};}function patchUpdates(_0x1ddb6d){return function(_0x21664b){try{jsonpatch[_0x5bce('0x1e')](_0x21664b,_0x1ddb6d,!![]);}catch(_0x1e8503){return BPromise[_0x5bce('0x1f')](_0x1e8503);}return _0x21664b['save']();};}function saveUpdates(_0x571d24,_0xb7cd3){return function(_0xc5e327){if(_0xc5e327){return _0xc5e327[_0x5bce('0x20')](_0x571d24)[_0x5bce('0x21')](function(_0x3edcf5){return _0x3edcf5;});}return null;};}function removeEntity(_0x396347,_0x2af9a0){return function(_0x303cd7){if(_0x303cd7){return _0x303cd7[_0x5bce('0x22')]()[_0x5bce('0x21')](function(){var _0x4b829c=_0x303cd7[_0x5bce('0x23')]({'plain':!![]});var _0x5a5759=_0x5bce('0x24');return db[_0x5bce('0x25')]['destroy']({'where':{'type':_0x5a5759,'resourceId':_0x4b829c['id']}})[_0x5bce('0x21')](function(){return _0x303cd7;});})[_0x5bce('0x21')](function(){_0x396347[_0x5bce('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb389,_0x52c6b0){return function(_0x1458af){if(!_0x1458af){_0x1eb389[_0x5bce('0x17')](0x194);}return _0x1458af;};}function handleError(_0x6c23df,_0x2981c5){_0x2981c5=_0x2981c5||0x1f4;return function(_0xb3876f){logger[_0x5bce('0x26')](_0xb3876f['stack']);if(_0xb3876f[_0x5bce('0x27')]){delete _0xb3876f[_0x5bce('0x27')];}_0x6c23df[_0x5bce('0x19')](_0x2981c5)[_0x5bce('0x28')](_0xb3876f);};}exports['index']=function(_0xeaff84,_0x1e365b){var _0x48ca72={},_0x3f1e31={},_0x3964df={'count':0x0,'rows':[]};var _0x20b4ae=_[_0x5bce('0x29')](db[_0x5bce('0x2a')]['rawAttributes'],function(_0x471b8b){return{'name':_0x471b8b[_0x5bce('0x2b')],'type':_0x471b8b[_0x5bce('0x2c')][_0x5bce('0x2d')]};});_0x3f1e31[_0x5bce('0x2e')]=_[_0x5bce('0x29')](_0x20b4ae,'name');_0x3f1e31['query']=_['keys'](_0xeaff84[_0x5bce('0x2f')]);_0x3f1e31[_0x5bce('0x30')]=_[_0x5bce('0x31')](_0x3f1e31[_0x5bce('0x2e')],_0x3f1e31[_0x5bce('0x2f')]);_0x48ca72[_0x5bce('0x32')]=_[_0x5bce('0x31')](_0x3f1e31[_0x5bce('0x2e')],qs['fields'](_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x33')]));_0x48ca72[_0x5bce('0x32')]=_0x48ca72['attributes'][_0x5bce('0x34')]?_0x48ca72[_0x5bce('0x32')]:_0x3f1e31[_0x5bce('0x2e')];if(!_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x35')]('nolimit')){_0x48ca72[_0x5bce('0x1b')]=qs['limit'](_0xeaff84[_0x5bce('0x2f')]['limit']);_0x48ca72[_0x5bce('0x1a')]=qs[_0x5bce('0x1a')](_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x1a')]);}_0x48ca72[_0x5bce('0x36')]=qs[_0x5bce('0x37')](_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x37')]);_0x48ca72[_0x5bce('0x38')]=qs['filters'](_[_0x5bce('0x39')](_0xeaff84[_0x5bce('0x2f')],_0x3f1e31['filters']),_0x20b4ae);if(_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x3a')]){_0x48ca72[_0x5bce('0x38')]=_[_0x5bce('0x3b')](_0x48ca72[_0x5bce('0x38')],{'$or':_[_0x5bce('0x29')](_0x20b4ae,function(_0x12b92a){if(_0x12b92a[_0x5bce('0x2c')]!==_0x5bce('0x3c')){var _0x16f3e9={};_0x16f3e9[_0x12b92a[_0x5bce('0x27')]]={'$like':'%'+_0xeaff84['query'][_0x5bce('0x3a')]+'%'};return _0x16f3e9;}})});}_0x48ca72=_['merge']({},_0x48ca72,_0xeaff84[_0x5bce('0x3d')]);var _0x4fa14d={'where':_0x48ca72[_0x5bce('0x38')]};return db[_0x5bce('0x2a')][_0x5bce('0x3e')](_0x4fa14d)[_0x5bce('0x21')](function(_0xd1fd3){_0x3964df[_0x5bce('0x3e')]=_0xd1fd3;if(_0xeaff84[_0x5bce('0x2f')][_0x5bce('0x3f')]){_0x48ca72[_0x5bce('0x40')]=[{'all':!![]}];}return db[_0x5bce('0x2a')]['findAll'](_0x48ca72);})[_0x5bce('0x21')](function(_0xd7e880){_0x3964df[_0x5bce('0x41')]=_0xd7e880;return _0x3964df;})[_0x5bce('0x21')](respondWithFilteredResult(_0x1e365b,_0x48ca72))[_0x5bce('0x42')](handleError(_0x1e365b,null));};exports[_0x5bce('0x43')]=function(_0x20ebaf,_0x1157ac){var _0x142303={'raw':!![],'where':{'id':_0x20ebaf[_0x5bce('0x44')]['id']}},_0xac309e={};_0xac309e[_0x5bce('0x2e')]=_[_0x5bce('0x45')](db[_0x5bce('0x2a')][_0x5bce('0x46')]);_0xac309e['query']=_[_0x5bce('0x45')](_0x20ebaf['query']);_0xac309e[_0x5bce('0x30')]=_[_0x5bce('0x31')](_0xac309e[_0x5bce('0x2e')],_0xac309e[_0x5bce('0x2f')]);_0x142303[_0x5bce('0x32')]=_[_0x5bce('0x31')](_0xac309e[_0x5bce('0x2e')],qs['fields'](_0x20ebaf[_0x5bce('0x2f')][_0x5bce('0x33')]));_0x142303[_0x5bce('0x32')]=_0x142303[_0x5bce('0x32')][_0x5bce('0x34')]?_0x142303[_0x5bce('0x32')]:_0xac309e[_0x5bce('0x2e')];if(_0x20ebaf[_0x5bce('0x2f')][_0x5bce('0x3f')]){_0x142303[_0x5bce('0x40')]=[{'all':!![]}];}_0x142303=_[_0x5bce('0x3b')]({},_0x142303,_0x20ebaf[_0x5bce('0x3d')]);return db[_0x5bce('0x2a')][_0x5bce('0x47')](_0x142303)['then'](handleEntityNotFound(_0x1157ac,null))['then'](respondWithResult(_0x1157ac,null))[_0x5bce('0x42')](handleError(_0x1157ac,null));};exports[_0x5bce('0x48')]=function(_0x12b7b7,_0x16b5bb){return db[_0x5bce('0x2a')][_0x5bce('0x48')](_0x12b7b7[_0x5bce('0x49')],{})[_0x5bce('0x21')](function(_0x443561){var _0x9ab6c6=_0x12b7b7[_0x5bce('0x4a')]['get']({'plain':!![]});if(!_0x9ab6c6)throw new Error(_0x5bce('0x4b'));if(_0x9ab6c6[_0x5bce('0x4c')]===_0x5bce('0x4a')){var _0x35bc17=_0x443561[_0x5bce('0x23')]({'plain':!![]});var _0x316efa=_0x5bce('0x24');return db[_0x5bce('0x4d')][_0x5bce('0x47')]({'where':{'name':_0x316efa,'userProfileId':_0x9ab6c6['userProfileId']},'raw':!![]})[_0x5bce('0x21')](function(_0x338083){if(_0x338083&&_0x338083[_0x5bce('0x4e')]===0x0){return db[_0x5bce('0x25')]['create']({'name':_0x35bc17[_0x5bce('0x27')],'resourceId':_0x35bc17['id'],'type':_0x338083[_0x5bce('0x27')],'sectionId':_0x338083['id']},{})[_0x5bce('0x21')](function(){return _0x443561;});}else{return _0x443561;}})['catch'](function(_0x3d95cd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d95cd);throw _0x3d95cd;});}return _0x443561;})[_0x5bce('0x21')](respondWithResult(_0x16b5bb,0xc9))['catch'](handleError(_0x16b5bb,null));};exports[_0x5bce('0x20')]=function(_0x356378,_0x2182c3){if(_0x356378['body']['id']){delete _0x356378[_0x5bce('0x49')]['id'];}return db[_0x5bce('0x2a')][_0x5bce('0x47')]({'where':{'id':_0x356378[_0x5bce('0x44')]['id']}})['then'](handleEntityNotFound(_0x2182c3,null))['then'](saveUpdates(_0x356378[_0x5bce('0x49')],null))[_0x5bce('0x21')](respondWithResult(_0x2182c3,null))['catch'](handleError(_0x2182c3,null));};exports[_0x5bce('0x22')]=function(_0x381e35,_0x43bca0){return db['Disposition'][_0x5bce('0x47')]({'where':{'id':_0x381e35[_0x5bce('0x44')]['id']}})[_0x5bce('0x21')](handleEntityNotFound(_0x43bca0,null))[_0x5bce('0x21')](removeEntity(_0x43bca0,null))[_0x5bce('0x42')](handleError(_0x43bca0,null));}; \ No newline at end of file +var _0x5e06=['merge','VIRTUAL','options','include','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','get','Dispositions','error','stack','name','index','map','Disposition','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where'];(function(_0x337ce4,_0xbb56a){var _0x5958c3=function(_0x3664d9){while(--_0x3664d9){_0x337ce4['push'](_0x337ce4['shift']());}};_0x5958c3(++_0xbb56a);}(_0x5e06,0x1a3));var _0x65e0=function(_0x4dc8fd,_0x16a480){_0x4dc8fd=_0x4dc8fd-0x0;var _0x290c6a=_0x5e06[_0x4dc8fd];return _0x290c6a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65e0('0x0'));var rimraf=require(_0x65e0('0x1'));var zipdir=require(_0x65e0('0x2'));var jsonpatch=require(_0x65e0('0x3'));var rp=require(_0x65e0('0x4'));var moment=require(_0x65e0('0x5'));var BPromise=require(_0x65e0('0x6'));var Mustache=require('mustache');var util=require(_0x65e0('0x7'));var path=require('path');var sox=require(_0x65e0('0x8'));var csv=require('to-csv');var ejs=require(_0x65e0('0x9'));var fs=require('fs');var _=require(_0x65e0('0xa'));var squel=require('squel');var crypto=require(_0x65e0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x65e0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x65e0('0xd'));var Papa=require(_0x65e0('0xe'));var Redis=require(_0x65e0('0xf'));var authService=require(_0x65e0('0x10'));var qs=require(_0x65e0('0x11'));var as=require(_0x65e0('0x12'));var hardwareService=require(_0x65e0('0x13'));var logger=require(_0x65e0('0x14'))(_0x65e0('0x15'));var utils=require('../../config/utils');var config=require(_0x65e0('0x16'));var db=require(_0x65e0('0x17'))['db'];function respondWithStatusCode(_0x17614f,_0xdc0ef7){_0xdc0ef7=_0xdc0ef7||0xcc;return function(_0x6e57b6){if(_0x6e57b6){return _0x17614f[_0x65e0('0x18')](_0xdc0ef7);}return _0x17614f[_0x65e0('0x19')](_0xdc0ef7)[_0x65e0('0x1a')]();};}function respondWithResult(_0x13ccc3,_0xa3db3c){_0xa3db3c=_0xa3db3c||0xc8;return function(_0x2c7715){if(_0x2c7715){return _0x13ccc3[_0x65e0('0x19')](_0xa3db3c)[_0x65e0('0x1b')](_0x2c7715);}};}function respondWithFilteredResult(_0xf018b9,_0x12fc36){return function(_0x5ab90c){if(_0x5ab90c){var _0xe962a9=_0x5ab90c[_0x65e0('0x1c')],_0x26b52f=_0x12fc36[_0x65e0('0x1d')],_0x1aba2b=_0x12fc36[_0x65e0('0x1d')]+_0x12fc36[_0x65e0('0x1e')],_0x313250;if(_0x1aba2b>=_0xe962a9){_0x1aba2b=_0xe962a9;_0x313250=0xc8;}else{_0x313250=0xce;}_0xf018b9[_0x65e0('0x19')](_0x313250);return _0xf018b9[_0x65e0('0x1f')](_0x65e0('0x20'),_0x26b52f+'-'+_0x1aba2b+'/'+_0xe962a9)[_0x65e0('0x1b')](_0x5ab90c);}return null;};}function patchUpdates(_0x1711b4){return function(_0x2bc5bc){try{jsonpatch['apply'](_0x2bc5bc,_0x1711b4,!![]);}catch(_0x2a91ed){return BPromise[_0x65e0('0x21')](_0x2a91ed);}return _0x2bc5bc['save']();};}function saveUpdates(_0x1082dd,_0x15efe6){return function(_0x221e38){if(_0x221e38){return _0x221e38[_0x65e0('0x22')](_0x1082dd)['then'](function(_0x2362c8){return _0x2362c8;});}return null;};}function removeEntity(_0x1efd76,_0x2cc998){return function(_0x1af3bb){if(_0x1af3bb){return _0x1af3bb[_0x65e0('0x23')]()[_0x65e0('0x24')](function(){var _0x2c7bc6=_0x1af3bb[_0x65e0('0x25')]({'plain':!![]});var _0x518019=_0x65e0('0x26');return db['UserProfileResource'][_0x65e0('0x23')]({'where':{'type':_0x518019,'resourceId':_0x2c7bc6['id']}})[_0x65e0('0x24')](function(){return _0x1af3bb;});})['then'](function(){_0x1efd76[_0x65e0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20049f,_0x4e29d8){return function(_0x5342d3){if(!_0x5342d3){_0x20049f[_0x65e0('0x18')](0x194);}return _0x5342d3;};}function handleError(_0x383e6d,_0x1bec9a){_0x1bec9a=_0x1bec9a||0x1f4;return function(_0x2025b8){logger[_0x65e0('0x27')](_0x2025b8[_0x65e0('0x28')]);if(_0x2025b8['name']){delete _0x2025b8[_0x65e0('0x29')];}_0x383e6d['status'](_0x1bec9a)['send'](_0x2025b8);};}exports[_0x65e0('0x2a')]=function(_0x4da9f0,_0x5a0aa3){var _0xa148e7={},_0x4eec01={},_0x2b50af={'count':0x0,'rows':[]};var _0x551dae=_[_0x65e0('0x2b')](db[_0x65e0('0x2c')]['rawAttributes'],function(_0x2139a8){return{'name':_0x2139a8[_0x65e0('0x2d')],'type':_0x2139a8[_0x65e0('0x2e')][_0x65e0('0x2f')]};});_0x4eec01[_0x65e0('0x30')]=_['map'](_0x551dae,_0x65e0('0x29'));_0x4eec01[_0x65e0('0x31')]=_[_0x65e0('0x32')](_0x4da9f0[_0x65e0('0x31')]);_0x4eec01[_0x65e0('0x33')]=_[_0x65e0('0x34')](_0x4eec01[_0x65e0('0x30')],_0x4eec01['query']);_0xa148e7[_0x65e0('0x35')]=_['intersection'](_0x4eec01[_0x65e0('0x30')],qs[_0x65e0('0x36')](_0x4da9f0[_0x65e0('0x31')]['fields']));_0xa148e7[_0x65e0('0x35')]=_0xa148e7[_0x65e0('0x35')][_0x65e0('0x37')]?_0xa148e7['attributes']:_0x4eec01['model'];if(!_0x4da9f0[_0x65e0('0x31')][_0x65e0('0x38')]('nolimit')){_0xa148e7['limit']=qs[_0x65e0('0x1e')](_0x4da9f0[_0x65e0('0x31')][_0x65e0('0x1e')]);_0xa148e7['offset']=qs[_0x65e0('0x1d')](_0x4da9f0[_0x65e0('0x31')][_0x65e0('0x1d')]);}_0xa148e7[_0x65e0('0x39')]=qs[_0x65e0('0x3a')](_0x4da9f0[_0x65e0('0x31')][_0x65e0('0x3a')]);_0xa148e7['where']=qs[_0x65e0('0x33')](_[_0x65e0('0x3b')](_0x4da9f0[_0x65e0('0x31')],_0x4eec01[_0x65e0('0x33')]),_0x551dae);if(_0x4da9f0['query']['filter']){_0xa148e7[_0x65e0('0x3c')]=_[_0x65e0('0x3d')](_0xa148e7[_0x65e0('0x3c')],{'$or':_[_0x65e0('0x2b')](_0x551dae,function(_0x26ee56){if(_0x26ee56[_0x65e0('0x2e')]!==_0x65e0('0x3e')){var _0x496f11={};_0x496f11[_0x26ee56['name']]={'$like':'%'+_0x4da9f0['query']['filter']+'%'};return _0x496f11;}})});}_0xa148e7=_[_0x65e0('0x3d')]({},_0xa148e7,_0x4da9f0[_0x65e0('0x3f')]);var _0x4c782f={'where':_0xa148e7['where']};return db[_0x65e0('0x2c')][_0x65e0('0x1c')](_0x4c782f)[_0x65e0('0x24')](function(_0x90d904){_0x2b50af['count']=_0x90d904;if(_0x4da9f0[_0x65e0('0x31')]['includeAll']){_0xa148e7[_0x65e0('0x40')]=[{'all':!![]}];}return db[_0x65e0('0x2c')][_0x65e0('0x41')](_0xa148e7);})[_0x65e0('0x24')](function(_0x526db2){_0x2b50af[_0x65e0('0x42')]=_0x526db2;return _0x2b50af;})[_0x65e0('0x24')](respondWithFilteredResult(_0x5a0aa3,_0xa148e7))['catch'](handleError(_0x5a0aa3,null));};exports[_0x65e0('0x43')]=function(_0x4f0d2f,_0x3e16f8){var _0x4194f9={'raw':!![],'where':{'id':_0x4f0d2f['params']['id']}},_0x2d5a55={};_0x2d5a55[_0x65e0('0x30')]=_[_0x65e0('0x32')](db[_0x65e0('0x2c')][_0x65e0('0x44')]);_0x2d5a55[_0x65e0('0x31')]=_[_0x65e0('0x32')](_0x4f0d2f[_0x65e0('0x31')]);_0x2d5a55[_0x65e0('0x33')]=_['intersection'](_0x2d5a55[_0x65e0('0x30')],_0x2d5a55['query']);_0x4194f9[_0x65e0('0x35')]=_['intersection'](_0x2d5a55['model'],qs['fields'](_0x4f0d2f['query'][_0x65e0('0x36')]));_0x4194f9[_0x65e0('0x35')]=_0x4194f9[_0x65e0('0x35')]['length']?_0x4194f9[_0x65e0('0x35')]:_0x2d5a55[_0x65e0('0x30')];if(_0x4f0d2f['query'][_0x65e0('0x45')]){_0x4194f9['include']=[{'all':!![]}];}_0x4194f9=_['merge']({},_0x4194f9,_0x4f0d2f[_0x65e0('0x3f')]);return db[_0x65e0('0x2c')][_0x65e0('0x46')](_0x4194f9)['then'](handleEntityNotFound(_0x3e16f8,null))[_0x65e0('0x24')](respondWithResult(_0x3e16f8,null))[_0x65e0('0x47')](handleError(_0x3e16f8,null));};exports[_0x65e0('0x48')]=function(_0x5a0ee6,_0x5d52cb){return db[_0x65e0('0x2c')]['create'](_0x5a0ee6[_0x65e0('0x49')],{})['then'](function(_0x3299b3){var _0x109046=_0x5a0ee6['user']['get']({'plain':!![]});if(!_0x109046)throw new Error(_0x65e0('0x4a'));if(_0x109046[_0x65e0('0x4b')]===_0x65e0('0x4c')){var _0x188afa=_0x3299b3['get']({'plain':!![]});var _0x231da8=_0x65e0('0x26');return db[_0x65e0('0x4d')][_0x65e0('0x46')]({'where':{'name':_0x231da8,'userProfileId':_0x109046['userProfileId']},'raw':!![]})['then'](function(_0xadd640){if(_0xadd640&&_0xadd640[_0x65e0('0x4e')]===0x0){return db['UserProfileResource'][_0x65e0('0x48')]({'name':_0x188afa['name'],'resourceId':_0x188afa['id'],'type':_0xadd640[_0x65e0('0x29')],'sectionId':_0xadd640['id']},{})[_0x65e0('0x24')](function(){return _0x3299b3;});}else{return _0x3299b3;}})[_0x65e0('0x47')](function(_0x5cbbc0){logger[_0x65e0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cbbc0);throw _0x5cbbc0;});}return _0x3299b3;})['then'](respondWithResult(_0x5d52cb,0xc9))[_0x65e0('0x47')](handleError(_0x5d52cb,null));};exports[_0x65e0('0x22')]=function(_0x1e5665,_0x1907c4){if(_0x1e5665[_0x65e0('0x49')]['id']){delete _0x1e5665[_0x65e0('0x49')]['id'];}return db[_0x65e0('0x2c')][_0x65e0('0x46')]({'where':{'id':_0x1e5665[_0x65e0('0x4f')]['id']}})[_0x65e0('0x24')](handleEntityNotFound(_0x1907c4,null))[_0x65e0('0x24')](saveUpdates(_0x1e5665[_0x65e0('0x49')],null))[_0x65e0('0x24')](respondWithResult(_0x1907c4,null))[_0x65e0('0x47')](handleError(_0x1907c4,null));};exports[_0x65e0('0x23')]=function(_0x19b0ae,_0x2eeb0f){return db[_0x65e0('0x2c')][_0x65e0('0x46')]({'where':{'id':_0x19b0ae[_0x65e0('0x4f')]['id']}})[_0x65e0('0x24')](handleEntityNotFound(_0x2eeb0f,null))['then'](removeEntity(_0x2eeb0f,null))['catch'](handleError(_0x2eeb0f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2796ad1..5a66b22 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 _0xd3f3=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax'];(function(_0x3e9fc6,_0x3a4bd1){var _0x3cb830=function(_0x4eac96){while(--_0x4eac96){_0x3e9fc6['push'](_0x3e9fc6['shift']());}};_0x3cb830(++_0x3a4bd1);}(_0xd3f3,0xac));var _0x3d3f=function(_0x336adb,_0x1c3608){_0x336adb=_0x336adb-0x0;var _0x5be7f5=_0xd3f3[_0x336adb];return _0x5be7f5;};'use strict';var _=require(_0x3d3f('0x0'));var util=require(_0x3d3f('0x1'));var logger=require(_0x3d3f('0x2'))('api');var moment=require(_0x3d3f('0x3'));var BPromise=require(_0x3d3f('0x4'));var rp=require(_0x3d3f('0x5'));var fs=require('fs');var path=require(_0x3d3f('0x6'));var rimraf=require(_0x3d3f('0x7'));var config=require(_0x3d3f('0x8'));var attributes=require(_0x3d3f('0x9'));module[_0x3d3f('0xa')]=function(_0x1b4575,_0xc8796a){return _0x1b4575[_0x3d3f('0xb')](_0x3d3f('0xc'),attributes,{'tableName':_0x3d3f('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3d3f('0xe'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x10')]},{'unique':!![],'name':_0x3d3f('0x11'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x12')]},{'unique':!![],'name':_0x3d3f('0x13'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x14')]},{'unique':!![],'name':_0x3d3f('0x15'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x16')]},{'unique':!![],'name':_0x3d3f('0x17'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x3d3f('0x18'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x19')]},{'unique':!![],'name':_0x3d3f('0x1a'),'fields':[_0x3d3f('0xf'),_0x3d3f('0x1b')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1323=['Disposition','tools_dispositions','name','ListId','name_chat','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','WhatsappAccountId','lodash','util','api','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x1323,0x14e));var _0x3132=function(_0x580f6a,_0x1d638e){_0x580f6a=_0x580f6a-0x0;var _0x43bfd3=_0x1323[_0x580f6a];return _0x43bfd3;};'use strict';var _=require(_0x3132('0x0'));var util=require(_0x3132('0x1'));var logger=require('../../config/logger')(_0x3132('0x2'));var moment=require('moment');var BPromise=require(_0x3132('0x3'));var rp=require(_0x3132('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3132('0x5'));var attributes=require('./disposition.attributes');module[_0x3132('0x6')]=function(_0x534e53,_0x39ae44){return _0x534e53[_0x3132('0x7')](_0x3132('0x8'),attributes,{'tableName':_0x3132('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x3132('0xa'),_0x3132('0xb')]},{'unique':!![],'name':_0x3132('0xc'),'fields':[_0x3132('0xa'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x3132('0xa'),_0x3132('0xd')]},{'unique':!![],'name':'name_sms','fields':['name',_0x3132('0xe')]},{'unique':!![],'name':_0x3132('0xf'),'fields':[_0x3132('0xa'),_0x3132('0x10')]},{'unique':!![],'name':_0x3132('0x11'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x3132('0xa'),_0x3132('0x12')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index b68f6cb..d03a942 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 _0x2c76=['jayson/promise','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x47c2f9,_0x4d8900){var _0x35096f=function(_0x3e51a8){while(--_0x3e51a8){_0x47c2f9['push'](_0x47c2f9['shift']());}};_0x35096f(++_0x4d8900);}(_0x2c76,0x97));var _0x62c7=function(_0x41fcb8,_0x12c1e9){_0x41fcb8=_0x41fcb8-0x0;var _0x3c7d62=_0x2c76[_0x41fcb8];return _0x3c7d62;};'use strict';var _=require(_0x62c7('0x0'));var util=require(_0x62c7('0x1'));var moment=require(_0x62c7('0x2'));var BPromise=require(_0x62c7('0x3'));var rs=require(_0x62c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62c7('0x5'))['db'];var utils=require(_0x62c7('0x6'));var logger=require(_0x62c7('0x7'))(_0x62c7('0x8'));var config=require(_0x62c7('0x9'));var jayson=require(_0x62c7('0xa'));var client=jayson['client'][_0x62c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fd1ff,_0x390ea3,_0x28f308){return new BPromise(function(_0x5741fd,_0x24521d){return client[_0x62c7('0xc')](_0x2fd1ff,_0x28f308)[_0x62c7('0xd')](function(_0x14910e){logger['info'](_0x62c7('0xe'),_0x390ea3,_0x62c7('0xf'));logger['debug'](_0x62c7('0x10'),_0x390ea3,'request\x20sent',JSON[_0x62c7('0x11')](_0x14910e));if(_0x14910e[_0x62c7('0x12')]){if(_0x14910e['error']['code']===0x1f4){logger[_0x62c7('0x12')]('Disposition,\x20%s,\x20%s',_0x390ea3,_0x14910e['error'][_0x62c7('0x13')]);return _0x24521d(_0x14910e[_0x62c7('0x12')][_0x62c7('0x13')]);}logger[_0x62c7('0x12')](_0x62c7('0xe'),_0x390ea3,_0x14910e[_0x62c7('0x12')][_0x62c7('0x13')]);return _0x5741fd(_0x14910e[_0x62c7('0x12')][_0x62c7('0x13')]);}else{logger[_0x62c7('0x14')](_0x62c7('0xe'),_0x390ea3,_0x62c7('0xf'));_0x5741fd(_0x14910e[_0x62c7('0x15')][_0x62c7('0x13')]);}})[_0x62c7('0x16')](function(_0x1ca81f){logger[_0x62c7('0x12')](_0x62c7('0xe'),_0x390ea3,_0x1ca81f);_0x24521d(_0x1ca81f);});});} \ No newline at end of file +var _0x41c4=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x41c4,0x198));var _0x441c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x41c4[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x441c('0x0'));var util=require(_0x441c('0x1'));var moment=require(_0x441c('0x2'));var BPromise=require(_0x441c('0x3'));var rs=require(_0x441c('0x4'));var fs=require('fs');var Redis=require(_0x441c('0x5'));var db=require(_0x441c('0x6'))['db'];var utils=require(_0x441c('0x7'));var logger=require(_0x441c('0x8'))(_0x441c('0x9'));var config=require(_0x441c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x441c('0xb')][_0x441c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1af75f,_0x1746a0,_0x12c79f){return new BPromise(function(_0x4d3a05,_0x115b6f){return client[_0x441c('0xd')](_0x1af75f,_0x12c79f)[_0x441c('0xe')](function(_0x61763a){logger[_0x441c('0xf')](_0x441c('0x10'),_0x1746a0,_0x441c('0x11'));logger[_0x441c('0x12')](_0x441c('0x13'),_0x1746a0,_0x441c('0x11'),JSON[_0x441c('0x14')](_0x61763a));if(_0x61763a[_0x441c('0x15')]){if(_0x61763a[_0x441c('0x15')][_0x441c('0x16')]===0x1f4){logger[_0x441c('0x15')](_0x441c('0x10'),_0x1746a0,_0x61763a[_0x441c('0x15')][_0x441c('0x17')]);return _0x115b6f(_0x61763a[_0x441c('0x15')]['message']);}logger['error'](_0x441c('0x10'),_0x1746a0,_0x61763a['error'][_0x441c('0x17')]);return _0x4d3a05(_0x61763a['error'][_0x441c('0x17')]);}else{logger[_0x441c('0xf')](_0x441c('0x10'),_0x1746a0,_0x441c('0x11'));_0x4d3a05(_0x61763a[_0x441c('0x18')][_0x441c('0x17')]);}})[_0x441c('0x19')](function(_0x54dbd9){logger[_0x441c('0x15')](_0x441c('0x10'),_0x1746a0,_0x54dbd9);_0x115b6f(_0x54dbd9);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 2e977f2..3f10a9d 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 _0x6f18=['update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0x6f18,0x1b4));var _0x86f1=function(_0x2a7f48,_0x2ac3dd){_0x2a7f48=_0x2a7f48-0x0;var _0x2d472f=_0x6f18[_0x2a7f48];return _0x2d472f;};'use strict';var multer=require(_0x86f1('0x0'));var util=require('util');var path=require(_0x86f1('0x1'));var timeout=require('connect-timeout');var express=require(_0x86f1('0x2'));var router=express[_0x86f1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x86f1('0x4'));var config=require(_0x86f1('0x5'));var controller=require('./disposition.controller');router[_0x86f1('0x6')]('/',auth[_0x86f1('0x7')](),controller[_0x86f1('0x8')]);router[_0x86f1('0x6')](_0x86f1('0x9'),auth['isAuthenticated'](),controller[_0x86f1('0xa')]);router[_0x86f1('0xb')]('/',auth[_0x86f1('0x7')](),controller[_0x86f1('0xc')]);router[_0x86f1('0xd')]('/:id',auth[_0x86f1('0x7')](),controller[_0x86f1('0xe')]);router[_0x86f1('0xf')](_0x86f1('0x9'),auth[_0x86f1('0x7')](),controller[_0x86f1('0x10')]);module[_0x86f1('0x11')]=router; \ No newline at end of file +var _0xdf5d=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1cbc6c,_0x488147){var _0x24998b=function(_0x1fe822){while(--_0x1fe822){_0x1cbc6c['push'](_0x1cbc6c['shift']());}};_0x24998b(++_0x488147);}(_0xdf5d,0x126));var _0xddf5=function(_0x2df5e0,_0x8e0b0e){_0x2df5e0=_0x2df5e0-0x0;var _0x4694f0=_0xdf5d[_0x2df5e0];return _0x4694f0;};'use strict';var multer=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var path=require(_0xddf5('0x2'));var timeout=require(_0xddf5('0x3'));var express=require(_0xddf5('0x4'));var router=express[_0xddf5('0x5')]();var auth=require(_0xddf5('0x6'));var interaction=require(_0xddf5('0x7'));var config=require('../../config/environment');var controller=require(_0xddf5('0x8'));router[_0xddf5('0x9')]('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0xb')]);router[_0xddf5('0x9')](_0xddf5('0xc'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xd')]);router[_0xddf5('0xe')]('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0xf')]);router[_0xddf5('0x10')](_0xddf5('0xc'),auth[_0xddf5('0xa')](),controller[_0xddf5('0x11')]);router[_0xddf5('0x12')]('/:id',auth[_0xddf5('0xa')](),controller[_0xddf5('0x13')]);module[_0xddf5('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index aae8210..abba70a 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 _0xdf57=['14400','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','12000'];(function(_0x5b3c72,_0x3d855b){var _0x71d2cd=function(_0x4c7100){while(--_0x4c7100){_0x5b3c72['push'](_0x5b3c72['shift']());}};_0x71d2cd(++_0x3d855b);}(_0xdf57,0x12c));var _0x7df5=function(_0x49ff3f,_0x531e8f){_0x49ff3f=_0x49ff3f-0x0;var _0x4f9703=_0xdf57[_0x49ff3f];return _0x4f9703;};'use strict';var Sequelize=require(_0x7df5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7df5('0x1')]},'ecm':{'type':Sequelize[_0x7df5('0x2')](_0x7df5('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x7df5('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x7df5('0x2')](_0x7df5('0x5'),_0x7df5('0x6'),'7200','9600',_0x7df5('0x7'),_0x7df5('0x8')),'defaultValue':_0x7df5('0x6')},'maxrate':{'type':Sequelize[_0x7df5('0x2')]('2400',_0x7df5('0x6'),'7200',_0x7df5('0x9'),_0x7df5('0x7'),_0x7df5('0x8')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x7df5('0x1')],'defaultValue':_0x7df5('0xa')},'gateway':{'type':Sequelize[_0x7df5('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[_0x7df5('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x7df5('0xc'),_0x7df5('0xd'),_0x7df5('0xe'),'KHOMP'),'defaultValue':_0x7df5('0xc')},'key':{'type':Sequelize[_0x7df5('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7df5('0xf')],'defaultValue':function(){return _0x7df5('0x10');}},'notificationSound':{'type':Sequelize[_0x7df5('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7df5('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7df5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7df5('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7df5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7df5('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7df5('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x7df5('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2d6eda){if(!_0x2d6eda)this['setDataValue'](_0x7df5('0x13'),null);this[_0x7df5('0x14')](_0x7df5('0x15'),_0x2d6eda);}}}; \ No newline at end of file +var _0x3123=['9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','12000','14400','7200'];(function(_0x4179b3,_0x2eaff2){var _0x5b5c7e=function(_0x568341){while(--_0x568341){_0x4179b3['push'](_0x4179b3['shift']());}};_0x5b5c7e(++_0x2eaff2);}(_0x3123,0x16c));var _0x3312=function(_0x5578d6,_0xb7ffe9){_0x5578d6=_0x5578d6-0x0;var _0x42ab6a=_0x3123[_0x5578d6];return _0x42ab6a;};'use strict';var Sequelize=require(_0x3312('0x0'));module[_0x3312('0x1')]={'name':{'type':Sequelize[_0x3312('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3312('0x2')]},'ecm':{'type':Sequelize[_0x3312('0x3')](_0x3312('0x4'),'no'),'defaultValue':_0x3312('0x4')},'headerinfo':{'type':Sequelize[_0x3312('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x3312('0x2')],'unique':_0x3312('0x5')},'minrate':{'type':Sequelize[_0x3312('0x3')](_0x3312('0x6'),_0x3312('0x7'),'7200','9600',_0x3312('0x8'),_0x3312('0x9')),'defaultValue':_0x3312('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x3312('0x6'),_0x3312('0x7'),_0x3312('0xa'),_0x3312('0xb'),'12000','14400'),'defaultValue':_0x3312('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x3312('0xc')},'gateway':{'type':Sequelize[_0x3312('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3312('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x3312('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3312('0x3')](_0x3312('0xe'),_0x3312('0xf'),_0x3312('0x10'),_0x3312('0x11')),'defaultValue':_0x3312('0xe')},'key':{'type':Sequelize[_0x3312('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3312('0x12')],'defaultValue':function(){return _0x3312('0x13');}},'notificationSound':{'type':Sequelize[_0x3312('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3312('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3312('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3312('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3312('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3312('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4df2b9){if(!_0x4df2b9)this[_0x3312('0x16')](_0x3312('0x17'),null);this[_0x3312('0x16')](_0x3312('0x18'),_0x4df2b9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 3e162c7..047020b 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 _0xdf6c=['TrunkId','ListId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','FaxAccounts','UserProfileResource','end','stack','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','mandatoryDispositionPause','destroy','describe','FaxAccountId','getDispositions','findOne','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','Answer','ecm','gateway','faxdetect','headerinfo','modem','push','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','createdAt','updatedAt'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xdf6c,0x1ab));var _0xcdf6=function(_0x31cf4e,_0x1673ec){_0x31cf4e=_0x31cf4e-0x0;var _0x3dcd76=_0xdf6c[_0x31cf4e];return _0x3dcd76;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcdf6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdf6('0x1'));var rp=require('request-promise');var moment=require(_0xcdf6('0x2'));var BPromise=require(_0xcdf6('0x3'));var Mustache=require(_0xcdf6('0x4'));var util=require('util');var path=require(_0xcdf6('0x5'));var sox=require(_0xcdf6('0x6'));var csv=require(_0xcdf6('0x7'));var ejs=require(_0xcdf6('0x8'));var fs=require('fs');var _=require(_0xcdf6('0x9'));var squel=require(_0xcdf6('0xa'));var crypto=require(_0xcdf6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcdf6('0xc'));var toCsv=require(_0xcdf6('0x7'));var querystring=require('querystring');var Papa=require(_0xcdf6('0xd'));var Redis=require(_0xcdf6('0xe'));var authService=require(_0xcdf6('0xf'));var qs=require(_0xcdf6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdf6('0x11'))('api');var utils=require(_0xcdf6('0x12'));var config=require(_0xcdf6('0x13'));var db=require(_0xcdf6('0x14'))['db'];config[_0xcdf6('0x15')]=_[_0xcdf6('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcdf6('0x17'))(new Redis(config[_0xcdf6('0x15')]));require('./faxAccount.socket')[_0xcdf6('0x18')](socket);var jayson=require(_0xcdf6('0x19'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x5e2cc7,_0x395dc0,_0xd9dff8){if(_0xd9dff8){var _0x313136=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x313136[_0xcdf6('0x1a')](_0x395dc0)){return _0x5e2cc7;}else{throw new db[(_0xcdf6('0x1b'))][(_0xcdf6('0x1c'))](_0xcdf6('0x1d'));}}else{return _0x5e2cc7;}}function respondWithRpcPromise(_0x2b6d60,_0x3eef3f,_0x280f2d,_0x21af93){return new BPromise(function(_0x1beea9,_0x2c8285){var _0x3b76e4=_0x21af93||client;return _0x3b76e4[_0xcdf6('0x1e')](_0x2b6d60,_0x280f2d)['then'](function(_0x3831b9){logger[_0xcdf6('0x1f')](_0xcdf6('0x20'),_0x3eef3f,_0xcdf6('0x21'));logger[_0xcdf6('0x22')](_0xcdf6('0x23'),_0x3eef3f,_0xcdf6('0x21'),JSON[_0xcdf6('0x24')](_0x3831b9));if(_0x3831b9[_0xcdf6('0x25')]){if(_0x3831b9['error']['code']===0x1f4){logger[_0xcdf6('0x25')](_0xcdf6('0x20'),_0x3eef3f,_0x3831b9[_0xcdf6('0x25')]['message']);return _0x2c8285(_0x3831b9[_0xcdf6('0x25')][_0xcdf6('0x26')]);}logger[_0xcdf6('0x25')]('FaxAccount,\x20%s,\x20%s',_0x3eef3f,_0x3831b9[_0xcdf6('0x25')][_0xcdf6('0x26')]);return _0x1beea9(_0x3831b9['error'][_0xcdf6('0x26')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x3eef3f,_0xcdf6('0x21'));_0x1beea9(_0x3831b9[_0xcdf6('0x27')][_0xcdf6('0x26')]);}})[_0xcdf6('0x28')](function(_0x88e2e2){logger['error'](_0xcdf6('0x20'),_0x3eef3f,_0x88e2e2);_0x2c8285(_0x88e2e2);});});}function respondWithStatusCode(_0xdcbd65,_0x522b62){_0x522b62=_0x522b62||0xcc;return function(_0x619ec6){if(_0x619ec6){return _0xdcbd65[_0xcdf6('0x29')](_0x522b62);}return _0xdcbd65['status'](_0x522b62)['end']();};}function respondWithResult(_0x24e3bf,_0x3b0aea){_0x3b0aea=_0x3b0aea||0xc8;return function(_0x2c122e){if(_0x2c122e){return _0x24e3bf[_0xcdf6('0x2a')](_0x3b0aea)[_0xcdf6('0x2b')](_0x2c122e);}};}function respondWithFilteredResult(_0x1cc504,_0xc8b3a5){return function(_0x10df6a){if(_0x10df6a){var _0x5647cb=_0x10df6a[_0xcdf6('0x2c')],_0x9a21f2=_0xc8b3a5[_0xcdf6('0x2d')],_0x1bfcb3=_0xc8b3a5[_0xcdf6('0x2d')]+_0xc8b3a5[_0xcdf6('0x2e')],_0x159226;if(_0x1bfcb3>=_0x5647cb){_0x1bfcb3=_0x5647cb;_0x159226=0xc8;}else{_0x159226=0xce;}_0x1cc504['status'](_0x159226);return _0x1cc504[_0xcdf6('0x2f')](_0xcdf6('0x30'),_0x9a21f2+'-'+_0x1bfcb3+'/'+_0x5647cb)['json'](_0x10df6a);}return null;};}function patchUpdates(_0x332efa){return function(_0x1a0734){try{jsonpatch['apply'](_0x1a0734,_0x332efa,!![]);}catch(_0x234d8f){return BPromise[_0xcdf6('0x31')](_0x234d8f);}return _0x1a0734[_0xcdf6('0x32')]();};}function saveUpdates(_0x525304,_0x4ef8c5){return function(_0x1eb077){if(_0x1eb077){return _0x1eb077[_0xcdf6('0x33')](_0x525304)[_0xcdf6('0x34')](function(_0x4da477){return _0x4da477;});}return null;};}function removeEntity(_0x9d833f,_0x2a9a54){return function(_0x51c7f7){if(_0x51c7f7){return _0x51c7f7['destroy']()[_0xcdf6('0x34')](function(){var _0x523dea=_0x51c7f7[_0xcdf6('0x35')]({'plain':!![]});var _0x46cb5a=_0xcdf6('0x36');return db[_0xcdf6('0x37')]['destroy']({'where':{'type':_0x46cb5a,'resourceId':_0x523dea['id']}})['then'](function(){return _0x51c7f7;});})[_0xcdf6('0x34')](function(){_0x9d833f[_0xcdf6('0x2a')](0xcc)[_0xcdf6('0x38')]();});}};}function handleEntityNotFound(_0x22bbf6,_0xc27c0b){return function(_0x7f9706){if(!_0x7f9706){_0x22bbf6['sendStatus'](0x194);}return _0x7f9706;};}function handleError(_0x44186e,_0x16abf6){_0x16abf6=_0x16abf6||0x1f4;return function(_0x44aa14){logger['error'](_0x44aa14[_0xcdf6('0x39')]);if(_0x44aa14[_0xcdf6('0x3a')]){delete _0x44aa14[_0xcdf6('0x3a')];}_0x44186e[_0xcdf6('0x2a')](_0x16abf6)[_0xcdf6('0x3b')](_0x44aa14);};}exports[_0xcdf6('0x3c')]=function(_0x4a59bc,_0x5491e4){var _0x2237cf={'include':[{'model':db[_0xcdf6('0x3d')],'as':'mandatoryDispositionPause'}]},_0x58d762={},_0x48c3d3={'count':0x0,'rows':[]};var _0x1f3dd0=_[_0xcdf6('0x3e')](db[_0xcdf6('0x3f')][_0xcdf6('0x40')],function(_0x56f548){return{'name':_0x56f548[_0xcdf6('0x41')],'type':_0x56f548[_0xcdf6('0x42')][_0xcdf6('0x43')]};});_0x58d762[_0xcdf6('0x44')]=_[_0xcdf6('0x3e')](_0x1f3dd0,'name');_0x58d762[_0xcdf6('0x45')]=_['keys'](_0x4a59bc['query']);_0x58d762[_0xcdf6('0x46')]=_[_0xcdf6('0x47')](_0x58d762[_0xcdf6('0x44')],_0x58d762[_0xcdf6('0x45')]);_0x2237cf[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x58d762[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x49')]));_0x2237cf[_0xcdf6('0x48')]=_0x2237cf[_0xcdf6('0x48')][_0xcdf6('0x4a')]?_0x2237cf[_0xcdf6('0x48')]:_0x58d762[_0xcdf6('0x44')];if(!_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x2237cf['limit']=qs[_0xcdf6('0x2e')](_0x4a59bc['query'][_0xcdf6('0x2e')]);_0x2237cf[_0xcdf6('0x2d')]=qs[_0xcdf6('0x2d')](_0x4a59bc['query'][_0xcdf6('0x2d')]);}_0x2237cf[_0xcdf6('0x4d')]=qs['sort'](_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x2237cf[_0xcdf6('0x4f')]=qs[_0xcdf6('0x46')](_['pick'](_0x4a59bc['query'],_0x58d762[_0xcdf6('0x46')]),_0x1f3dd0);if(_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x2237cf[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x2237cf[_0xcdf6('0x4f')],{'$or':_[_0xcdf6('0x3e')](_0x1f3dd0,function(_0x5c37c8){if(_0x5c37c8[_0xcdf6('0x42')]!==_0xcdf6('0x52')){var _0x3b808c={};_0x3b808c[_0x5c37c8[_0xcdf6('0x3a')]]={'$like':'%'+_0x4a59bc[_0xcdf6('0x45')][_0xcdf6('0x50')]+'%'};return _0x3b808c;}})});}_0x2237cf=_[_0xcdf6('0x51')]({},_0x2237cf,_0x4a59bc['options']);var _0x4fb0d9={'where':_0x2237cf[_0xcdf6('0x4f')]};return db['FaxAccount'][_0xcdf6('0x2c')](_0x4fb0d9)[_0xcdf6('0x34')](function(_0x35e8ac){_0x48c3d3['count']=_0x35e8ac;if(_0x4a59bc['query'][_0xcdf6('0x53')]){_0x2237cf[_0xcdf6('0x54')]=[{'all':!![]}];}return db[_0xcdf6('0x3f')][_0xcdf6('0x55')](_0x2237cf);})[_0xcdf6('0x34')](function(_0x50d2d0){_0x48c3d3[_0xcdf6('0x56')]=_0x50d2d0;return _0x48c3d3;})['then'](respondWithFilteredResult(_0x5491e4,_0x2237cf))['catch'](handleError(_0x5491e4,null));};exports[_0xcdf6('0x57')]=function(_0x2392a8,_0x5d255c){var _0x493e19={'raw':![],'where':{'id':_0x2392a8['params']['id']},'include':[{'model':db[_0xcdf6('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1f7101={};_0x1f7101['model']=_['keys'](db[_0xcdf6('0x3f')]['rawAttributes']);_0x1f7101[_0xcdf6('0x45')]=_[_0xcdf6('0x58')](_0x2392a8[_0xcdf6('0x45')]);_0x1f7101['filters']=_['intersection'](_0x1f7101[_0xcdf6('0x44')],_0x1f7101[_0xcdf6('0x45')]);_0x493e19[_0xcdf6('0x48')]=_['intersection'](_0x1f7101[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x2392a8[_0xcdf6('0x45')]['fields']));_0x493e19['attributes']=_0x493e19['attributes'][_0xcdf6('0x4a')]?_0x493e19['attributes']:_0x1f7101[_0xcdf6('0x44')];if(_0x2392a8[_0xcdf6('0x45')][_0xcdf6('0x53')]){_0x493e19[_0xcdf6('0x54')]=[{'all':!![]}];}_0x493e19=_[_0xcdf6('0x51')]({},_0x493e19,_0x2392a8[_0xcdf6('0x59')]);return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')](_0x493e19)['then'](handleEntityNotFound(_0x5d255c,null))['then'](respondWithResult(_0x5d255c,null))[_0xcdf6('0x28')](handleError(_0x5d255c,null));};exports[_0xcdf6('0x5b')]=function(_0x295182,_0x41aa4e){return db[_0xcdf6('0x3f')][_0xcdf6('0x5b')](_0x295182[_0xcdf6('0x5c')],{})[_0xcdf6('0x34')](function(_0x1c551b){var _0x5371f6=_0x295182[_0xcdf6('0x5d')][_0xcdf6('0x35')]({'plain':!![]});if(!_0x5371f6)throw new Error(_0xcdf6('0x5e'));if(_0x5371f6[_0xcdf6('0x5f')]===_0xcdf6('0x5d')){var _0x395d88=_0x1c551b[_0xcdf6('0x35')]({'plain':!![]});var _0x4d0e60='FaxAccounts';return db[_0xcdf6('0x60')][_0xcdf6('0x5a')]({'where':{'name':_0x4d0e60,'userProfileId':_0x5371f6['userProfileId']},'raw':!![]})[_0xcdf6('0x34')](function(_0x25ed76){if(_0x25ed76&&_0x25ed76[_0xcdf6('0x61')]===0x0){return db[_0xcdf6('0x37')][_0xcdf6('0x5b')]({'name':_0x395d88[_0xcdf6('0x3a')],'resourceId':_0x395d88['id'],'type':_0x25ed76[_0xcdf6('0x3a')],'sectionId':_0x25ed76['id']},{})['then'](function(){return _0x1c551b;});}else{return _0x1c551b;}})['catch'](function(_0x3f26ed){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f26ed);throw _0x3f26ed;});}return _0x1c551b;})[_0xcdf6('0x34')](respondWithResult(_0x41aa4e,0xc9))[_0xcdf6('0x28')](handleError(_0x41aa4e,null));};exports[_0xcdf6('0x33')]=function(_0x4c0cbe,_0x334096){if(_0x4c0cbe['body']['id']){delete _0x4c0cbe[_0xcdf6('0x5c')]['id'];}return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x4c0cbe[_0xcdf6('0x62')]['id']},'include':[{'model':db[_0xcdf6('0x3d')],'as':_0xcdf6('0x63')}]})[_0xcdf6('0x34')](handleEntityNotFound(_0x334096,null))[_0xcdf6('0x34')](saveUpdates(_0x4c0cbe[_0xcdf6('0x5c')],null))[_0xcdf6('0x34')](respondWithResult(_0x334096,null))[_0xcdf6('0x28')](handleError(_0x334096,null));};exports[_0xcdf6('0x64')]=function(_0x20a989,_0x1bbb10){return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x20a989['params']['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x1bbb10,null))[_0xcdf6('0x34')](removeEntity(_0x1bbb10,null))['catch'](handleError(_0x1bbb10,null));};exports[_0xcdf6('0x65')]=function(_0x5da927,_0x3426fd){return db['FaxAccount'][_0xcdf6('0x65')]()[_0xcdf6('0x34')](respondWithResult(_0x3426fd,null))[_0xcdf6('0x28')](handleError(_0x3426fd,null));};exports['addDisposition']=function(_0x2dd6fa,_0x207444,_0x415aa5){if(_0x2dd6fa[_0xcdf6('0x5c')]['id']){delete _0x2dd6fa['body']['id'];}return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x2dd6fa['params']['id']}})['then'](handleEntityNotFound(_0x207444,null))[_0xcdf6('0x34')](function(_0x20f81b){if(_0x20f81b){_0x2dd6fa[_0xcdf6('0x5c')][_0xcdf6('0x66')]=_0x20f81b['id'];return db['Disposition'][_0xcdf6('0x5b')](_0x2dd6fa['body']);}})['then'](respondWithResult(_0x207444,null))[_0xcdf6('0x28')](handleError(_0x207444,null));};exports[_0xcdf6('0x67')]=function(_0x4b2405,_0x5da3fb,_0x567804){var _0x81a65c={'raw':![],'where':{}};var _0x516025={};var _0x19ef1a={'count':0x0,'rows':[]};return db[_0xcdf6('0x3f')][_0xcdf6('0x68')]({'where':{'id':_0x4b2405[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x5da3fb,null))[_0xcdf6('0x34')](function(_0x10300a){if(_0x10300a){_0x516025['model']=_[_0xcdf6('0x58')](db['Disposition'][_0xcdf6('0x40')]);_0x516025['query']=_[_0xcdf6('0x58')](_0x4b2405[_0xcdf6('0x45')]);_0x516025[_0xcdf6('0x46')]=_[_0xcdf6('0x47')](_0x516025[_0xcdf6('0x44')],_0x516025[_0xcdf6('0x45')]);_0x81a65c[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x516025[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x4b2405[_0xcdf6('0x45')][_0xcdf6('0x49')]));_0x81a65c[_0xcdf6('0x48')]=_0x81a65c['attributes'][_0xcdf6('0x4a')]?_0x81a65c[_0xcdf6('0x48')]:_0x516025[_0xcdf6('0x44')];if(!_0x4b2405[_0xcdf6('0x45')]['hasOwnProperty'](_0xcdf6('0x4c'))){_0x81a65c[_0xcdf6('0x2e')]=qs[_0xcdf6('0x2e')](_0x4b2405['query'][_0xcdf6('0x2e')]);_0x81a65c[_0xcdf6('0x2d')]=qs['offset'](_0x4b2405[_0xcdf6('0x45')]['offset']);}_0x81a65c[_0xcdf6('0x4d')]=qs['sort'](_0x4b2405[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x81a65c[_0xcdf6('0x4f')]=qs['filters'](_[_0xcdf6('0x69')](_0x4b2405['query'],_0x516025[_0xcdf6('0x46')]));_0x81a65c[_0xcdf6('0x4f')]['FaxAccountId']=_0x10300a['id'];if(_0x4b2405[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x81a65c[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x81a65c['where'],{'$or':_[_0xcdf6('0x3e')](_0x81a65c[_0xcdf6('0x48')],function(_0x4ab991){var _0x859ead={};_0x859ead[_0x4ab991]={'$like':'%'+_0x4b2405[_0xcdf6('0x45')][_0xcdf6('0x50')]+'%'};return _0x859ead;})});}_0x81a65c=_[_0xcdf6('0x51')]({},_0x81a65c,_0x4b2405[_0xcdf6('0x59')]);return db[_0xcdf6('0x6a')][_0xcdf6('0x2c')]({'where':_0x81a65c[_0xcdf6('0x4f')]})['then'](function(_0x312558){_0x19ef1a[_0xcdf6('0x2c')]=_0x312558;if(_0x4b2405['query']['includeAll']){_0x81a65c['include']=[{'all':!![]}];}return db[_0xcdf6('0x6a')][_0xcdf6('0x55')](_0x81a65c);})[_0xcdf6('0x34')](function(_0x4314ac){_0x19ef1a[_0xcdf6('0x56')]=_0x4314ac;return _0x19ef1a;});}})['then'](respondWithFilteredResult(_0x5da3fb,_0x81a65c))[_0xcdf6('0x28')](handleError(_0x5da3fb,null));};exports[_0xcdf6('0x6b')]=function(_0x4a34fa,_0x286ef2,_0x71b14a){return db['FaxAccount'][_0xcdf6('0x5a')]({'where':{'id':_0x4a34fa['params']['id']}})['then'](handleEntityNotFound(_0x286ef2,null))['then'](function(_0xb88a3b){if(_0xb88a3b){return _0xb88a3b[_0xcdf6('0x6b')](_0x4a34fa[_0xcdf6('0x45')][_0xcdf6('0x6c')]);}})['then'](respondWithStatusCode(_0x286ef2,null))['catch'](handleError(_0x286ef2,null));};exports[_0xcdf6('0x6d')]=function(_0x19ec46,_0x43a916,_0x3777e9){if(_0x19ec46['body']['id']){delete _0x19ec46[_0xcdf6('0x5c')]['id'];}return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x19ec46[_0xcdf6('0x62')]['id']}})['then'](handleEntityNotFound(_0x43a916,null))['then'](function(_0x5adb0f){if(_0x5adb0f){_0x19ec46[_0xcdf6('0x5c')][_0xcdf6('0x66')]=_0x5adb0f['id'];return db[_0xcdf6('0x6e')][_0xcdf6('0x5b')](_0x19ec46[_0xcdf6('0x5c')]);}})['then'](respondWithResult(_0x43a916,null))[_0xcdf6('0x28')](handleError(_0x43a916,null));};exports[_0xcdf6('0x6f')]=function(_0x4674f5,_0x4fad88,_0x25aa18){var _0x1aaff4={'raw':![],'where':{}};var _0x315e17={};var _0x450ce3={'count':0x0,'rows':[]};return db[_0xcdf6('0x3f')]['findOne']({'where':{'id':_0x4674f5[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x4fad88,null))[_0xcdf6('0x34')](function(_0x38e396){if(_0x38e396){_0x315e17[_0xcdf6('0x44')]=_[_0xcdf6('0x58')](db[_0xcdf6('0x6e')][_0xcdf6('0x40')]);_0x315e17[_0xcdf6('0x45')]=_[_0xcdf6('0x58')](_0x4674f5[_0xcdf6('0x45')]);_0x315e17[_0xcdf6('0x46')]=_[_0xcdf6('0x47')](_0x315e17[_0xcdf6('0x44')],_0x315e17['query']);_0x1aaff4[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x315e17[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x4674f5[_0xcdf6('0x45')]['fields']));_0x1aaff4['attributes']=_0x1aaff4[_0xcdf6('0x48')][_0xcdf6('0x4a')]?_0x1aaff4[_0xcdf6('0x48')]:_0x315e17[_0xcdf6('0x44')];if(!_0x4674f5[_0xcdf6('0x45')][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x1aaff4['limit']=qs[_0xcdf6('0x2e')](_0x4674f5[_0xcdf6('0x45')][_0xcdf6('0x2e')]);_0x1aaff4[_0xcdf6('0x2d')]=qs[_0xcdf6('0x2d')](_0x4674f5['query']['offset']);}_0x1aaff4[_0xcdf6('0x4d')]=qs[_0xcdf6('0x4e')](_0x4674f5[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x1aaff4[_0xcdf6('0x4f')]=qs[_0xcdf6('0x46')](_[_0xcdf6('0x69')](_0x4674f5[_0xcdf6('0x45')],_0x315e17[_0xcdf6('0x46')]));_0x1aaff4['where'][_0xcdf6('0x66')]=_0x38e396['id'];if(_0x4674f5[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x1aaff4[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x1aaff4['where'],{'$or':_[_0xcdf6('0x3e')](_0x1aaff4[_0xcdf6('0x48')],function(_0x1059c9){var _0x4b580d={};_0x4b580d[_0x1059c9]={'$like':'%'+_0x4674f5['query'][_0xcdf6('0x50')]+'%'};return _0x4b580d;})});}_0x1aaff4=_[_0xcdf6('0x51')]({},_0x1aaff4,_0x4674f5[_0xcdf6('0x59')]);return db['CannedAnswer'][_0xcdf6('0x2c')]({'where':_0x1aaff4[_0xcdf6('0x4f')]})[_0xcdf6('0x34')](function(_0x52781a){_0x450ce3[_0xcdf6('0x2c')]=_0x52781a;if(_0x4674f5['query'][_0xcdf6('0x53')]){_0x1aaff4[_0xcdf6('0x54')]=[{'all':!![]}];}return db[_0xcdf6('0x6e')]['findAll'](_0x1aaff4);})[_0xcdf6('0x34')](function(_0x5c2899){_0x450ce3[_0xcdf6('0x56')]=_0x5c2899;return _0x450ce3;});}})[_0xcdf6('0x34')](respondWithFilteredResult(_0x4fad88,_0x1aaff4))[_0xcdf6('0x28')](handleError(_0x4fad88,null));};exports[_0xcdf6('0x70')]=function(_0x1a7ade,_0x10df53,_0x388fcc){return db['FaxAccount'][_0xcdf6('0x5a')]({'where':{'id':_0x1a7ade[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x10df53,null))['then'](function(_0x12bb0a){if(_0x12bb0a){return _0x12bb0a[_0xcdf6('0x70')](_0x1a7ade[_0xcdf6('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x10df53,null))[_0xcdf6('0x28')](handleError(_0x10df53,null));};exports[_0xcdf6('0x71')]=function(_0x4ce368,_0x15c5f1,_0x2d1bc1){return db['FaxInteraction'][_0xcdf6('0x5a')]({'where':{'id':_0x4ce368[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x15c5f1,null))[_0xcdf6('0x34')](function(_0x1180e4){if(_0x1180e4){return _0x1180e4[_0xcdf6('0x71')](_0x4ce368[_0xcdf6('0x5c')][_0xcdf6('0x6c')],_[_0xcdf6('0x72')](_0x4ce368[_0xcdf6('0x5c')],[_0xcdf6('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x15c5f1,null))['catch'](handleError(_0x15c5f1,null));};exports[_0xcdf6('0x73')]=function(_0xbb10d3,_0x3c1a32,_0x19a59f){var _0x2dba65={'raw':![],'where':{}};var _0x3ba199={};var _0x563306={'count':0x0,'rows':[]};return db[_0xcdf6('0x3f')][_0xcdf6('0x68')]({'where':{'id':_0xbb10d3[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x3c1a32,null))[_0xcdf6('0x34')](function(_0xd3b325){if(_0xd3b325){_0x3ba199[_0xcdf6('0x44')]=_[_0xcdf6('0x58')](db[_0xcdf6('0x74')][_0xcdf6('0x40')]);_0x3ba199[_0xcdf6('0x45')]=_[_0xcdf6('0x58')](_0xbb10d3['query']);_0x3ba199[_0xcdf6('0x46')]=_['intersection'](_0x3ba199[_0xcdf6('0x44')],_0x3ba199[_0xcdf6('0x45')]);_0x2dba65['attributes']=_[_0xcdf6('0x47')](_0x3ba199['model'],qs[_0xcdf6('0x49')](_0xbb10d3[_0xcdf6('0x45')]['fields']));_0x2dba65[_0xcdf6('0x48')]=_0x2dba65[_0xcdf6('0x48')][_0xcdf6('0x4a')]?_0x2dba65['attributes']:_0x3ba199[_0xcdf6('0x44')];if(!_0xbb10d3['query'][_0xcdf6('0x4b')]('nolimit')){_0x2dba65[_0xcdf6('0x2e')]=qs['limit'](_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x2e')]);_0x2dba65['offset']=qs[_0xcdf6('0x2d')](_0xbb10d3['query'][_0xcdf6('0x2d')]);}_0x2dba65[_0xcdf6('0x4d')]=qs['sort'](_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x2dba65['where']=qs[_0xcdf6('0x46')](_[_0xcdf6('0x69')](_0xbb10d3[_0xcdf6('0x45')],_0x3ba199[_0xcdf6('0x46')]));_0x2dba65[_0xcdf6('0x4f')]['FaxAccountId']=_0xd3b325['id'];if(_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x2dba65[_0xcdf6('0x4f')]=_['merge'](_0x2dba65[_0xcdf6('0x4f')],{'$or':_[_0xcdf6('0x3e')](_0x2dba65[_0xcdf6('0x48')],function(_0x150abe){var _0x34b9db={};_0x34b9db[_0x150abe]={'$like':'%'+_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x50')]+'%'};return _0x34b9db;})});}_0x2dba65=_[_0xcdf6('0x51')]({},_0x2dba65,_0xbb10d3[_0xcdf6('0x59')]);return db['FaxInteraction'][_0xcdf6('0x2c')]({'where':_0x2dba65[_0xcdf6('0x4f')]})[_0xcdf6('0x34')](function(_0x27e62e){_0x563306[_0xcdf6('0x2c')]=_0x27e62e;if(_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x53')]){_0x2dba65[_0xcdf6('0x54')]=[{'model':db[_0xcdf6('0x75')],'as':_0xcdf6('0x76'),'required':![]},{'model':db[_0xcdf6('0x77')],'as':_0xcdf6('0x78'),'attributes':['name',_0xcdf6('0x79'),_0xcdf6('0x7a')],'required':![]},{'model':db[_0xcdf6('0x7b')],'as':_0xcdf6('0x7c'),'attributes':['id',_0xcdf6('0x3a'),_0xcdf6('0x7d')],'where':_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x7e')]?{'id':_0xbb10d3[_0xcdf6('0x45')]['tag']}:undefined,'required':_0xbb10d3[_0xcdf6('0x45')][_0xcdf6('0x7e')]?!![]:![]}];}return db[_0xcdf6('0x74')][_0xcdf6('0x55')](_0x2dba65);})[_0xcdf6('0x34')](function(_0x3c8475){_0x563306[_0xcdf6('0x56')]=_0x3c8475;return _0x563306;});}})[_0xcdf6('0x34')](respondWithFilteredResult(_0x3c1a32,_0x2dba65))[_0xcdf6('0x28')](handleError(_0x3c1a32,null));};exports[_0xcdf6('0x7f')]=function(_0x7cadee,_0x21a21f,_0x288f74){return db[_0xcdf6('0x3f')][_0xcdf6('0x68')]({'where':{'id':_0x7cadee[_0xcdf6('0x62')]['id']}})['then'](handleEntityNotFound(_0x21a21f,null))['then'](function(_0xb1e1d4){if(_0xb1e1d4){return db[_0xcdf6('0x80')][_0xcdf6('0x81')](function(_0x4d5a43){return db[_0xcdf6('0x82')][_0xcdf6('0x64')]({'where':{'FaxAccountId':_0x7cadee['params']['id']},'transaction':_0x4d5a43})[_0xcdf6('0x34')](function(_0x55e154){var _0x52478d=_['map'](_0x7cadee['body'],function(_0x3dc8dc){_0x3dc8dc['FaxAccountId']=_0x7cadee[_0xcdf6('0x62')]['id'];return _0x3dc8dc;});return db[_0xcdf6('0x82')][_0xcdf6('0x83')](_0x52478d,{'transaction':_0x4d5a43});});})[_0xcdf6('0x34')](function(){return db[_0xcdf6('0x82')][_0xcdf6('0x84')]({'where':{'FaxAccountId':_0x7cadee[_0xcdf6('0x62')]['id']},'order':_0xcdf6('0x85')});});}})['then'](respondWithResult(_0x21a21f,null))[_0xcdf6('0x28')](handleError(_0x21a21f,null));};exports['getApplications']=function(_0x2780aa,_0x3d2462,_0x40df52){var _0x2ce7fc={};var _0x1cca2d={};var _0x513266;var _0x26f7e0;return db[_0xcdf6('0x3f')]['findOne']({'where':{'id':_0x2780aa['params']['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x3d2462,null))['then'](function(_0x6fe587){if(_0x6fe587){_0x513266=_0x6fe587;_0x1cca2d[_0xcdf6('0x44')]=_[_0xcdf6('0x58')](db[_0xcdf6('0x82')][_0xcdf6('0x40')]);_0x1cca2d['query']=_[_0xcdf6('0x58')](_0x2780aa[_0xcdf6('0x45')]);_0x1cca2d[_0xcdf6('0x46')]=_[_0xcdf6('0x47')](_0x1cca2d[_0xcdf6('0x44')],_0x1cca2d[_0xcdf6('0x45')]);_0x2ce7fc['attributes']=_[_0xcdf6('0x47')](_0x1cca2d['model'],qs['fields'](_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x49')]));_0x2ce7fc[_0xcdf6('0x48')]=_0x2ce7fc[_0xcdf6('0x48')]['length']?_0x2ce7fc[_0xcdf6('0x48')]:_0x1cca2d[_0xcdf6('0x44')];_0x2ce7fc['order']=qs[_0xcdf6('0x4e')](_0x2780aa['query'][_0xcdf6('0x4e')]);_0x2ce7fc[_0xcdf6('0x4f')]=qs['filters'](_['pick'](_0x2780aa[_0xcdf6('0x45')],_0x1cca2d[_0xcdf6('0x46')]));if(_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x2ce7fc[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x2ce7fc[_0xcdf6('0x4f')],{'$or':_[_0xcdf6('0x3e')](_0x2ce7fc['attributes'],function(_0x296023){var _0x4e89f3={};_0x4e89f3[_0x296023]={'$like':'%'+_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x50')]+'%'};return _0x4e89f3;})});}_0x2ce7fc=_[_0xcdf6('0x51')]({},_0x2ce7fc,_0x2780aa[_0xcdf6('0x59')]);return _0x513266[_0xcdf6('0x86')](_0x2ce7fc);}})[_0xcdf6('0x34')](function(_0x3b2255){if(_0x3b2255){_0x26f7e0=_0x3b2255[_0xcdf6('0x4a')];if(!_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x2ce7fc[_0xcdf6('0x2e')]=qs[_0xcdf6('0x2e')](_0x2780aa['query'][_0xcdf6('0x2e')]);_0x2ce7fc[_0xcdf6('0x2d')]=qs[_0xcdf6('0x2d')](_0x2780aa[_0xcdf6('0x45')][_0xcdf6('0x2d')]);}return _0x513266[_0xcdf6('0x86')](_0x2ce7fc);}})[_0xcdf6('0x34')](function(_0x1af77f){if(_0x1af77f){return _0x1af77f?{'count':_0x26f7e0,'rows':_0x1af77f}:null;}})[_0xcdf6('0x34')](respondWithResult(_0x3d2462,null))[_0xcdf6('0x28')](handleError(_0x3d2462,null));};function Extension(_0x211519,_0x1922f5,_0x4d50f4,_0x414f3f){this[_0xcdf6('0x87')]=_0xcdf6('0x88');this[_0xcdf6('0x89')]=_0x211519[_0xcdf6('0x8a')];this['app']=_0x414f3f;this[_0xcdf6('0x42')]='system';this[_0xcdf6('0x8b')]=_0xcdf6('0x8c');this[_0xcdf6('0x66')]=_0x211519['id'];this[_0xcdf6('0x85')]=_0x1922f5;this[_0xcdf6('0x8d')]=_0x4d50f4;}function createExtensionsReciveFax(_0x52156d){var _0x1cdb64=0x1;var _0x179a0a=[];_0x179a0a['push'](new Extension(_0x52156d,_0x1cdb64,'',_0xcdf6('0x8e')));_0x1cdb64+=0x1;_0x179a0a['push'](new Extension(_0x52156d,_0x1cdb64,'CDR(type)=inbound-fax','Set'));_0x1cdb64+=0x1;for(var _0x57f169 in _0x52156d){if(_0x52156d[_0xcdf6('0x4b')](_0x57f169)&&(_0x57f169===_0xcdf6('0x8f')||_0x57f169===_0xcdf6('0x8a')||_0x57f169===_0xcdf6('0x90')||_0x57f169===_0xcdf6('0x91')||_0x57f169===_0xcdf6('0x92')||_0x57f169==='maxrate'||_0x57f169==='minrate'||_0x57f169===_0xcdf6('0x93')||_0x57f169==='t38timeout')){_0x179a0a[_0xcdf6('0x94')](new Extension(_0x52156d,_0x1cdb64,_0xcdf6('0x95')+_0x57f169+')='+_0x52156d[_0x57f169],_0xcdf6('0x96')));_0x1cdb64+=0x1;}}_0x179a0a[_0xcdf6('0x94')](new Extension(_0x52156d,_0x1cdb64,'6',_0xcdf6('0x97')));_0x1cdb64+=0x1;_0x179a0a[_0xcdf6('0x94')](new Extension(_0x52156d,_0x1cdb64,_0xcdf6('0x98'),'ReceiveFax'));_0x1cdb64=0x0;return _0x179a0a;}exports[_0xcdf6('0x99')]=function(_0x8944d,_0x395eeb,_0x345ecd){var _0x316578;return db[_0xcdf6('0x80')]['transaction'](function(_0x34b67c){return db[_0xcdf6('0x3f')][_0xcdf6('0x5b')](_0x8944d['body'],{'transaction':_0x34b67c})[_0xcdf6('0x34')](function(_0x2509fe){_0x316578=_0x2509fe['get']({'plain':!![]});return db[_0xcdf6('0x9a')][_0xcdf6('0x83')](createExtensionsReciveFax(_0x316578),{'transaction':_0x34b67c});});})['then'](function(){return _0x316578;})['then'](respondWithResult(_0x395eeb,null))['catch'](handleError(_0x395eeb,null));};exports[_0xcdf6('0x9b')]=function(_0x927fb,_0x591fe9,_0x156275){var _0x58d434;return db[_0xcdf6('0x80')][_0xcdf6('0x81')](function(_0x1ed2f2){return db[_0xcdf6('0x3f')][_0xcdf6('0x33')](_0x927fb['body'],{'where':{'id':_0x927fb[_0xcdf6('0x5c')]['id']},'transaction':_0x1ed2f2})[_0xcdf6('0x34')](function(_0x5d2e7e){return db[_0xcdf6('0x9a')][_0xcdf6('0x64')]({'where':{'FaxAccountId':_0x927fb[_0xcdf6('0x5c')]['id']},'transaction':_0x1ed2f2})['then'](function(_0x2e24c1){return db[_0xcdf6('0x9a')][_0xcdf6('0x83')](createExtensionsReciveFax(_[_0xcdf6('0x72')](_0x927fb['body'],['tech',_0xcdf6('0x43'),_0xcdf6('0x9c'),_0xcdf6('0x9d'),_0xcdf6('0x9e'),_0xcdf6('0x9f')])),{'transaction':_0x1ed2f2});});});})[_0xcdf6('0x34')](function(){return db[_0xcdf6('0x3f')][_0xcdf6('0xa0')](_0x927fb[_0xcdf6('0x5c')]['id']);})[_0xcdf6('0x34')](respondWithResult(_0x591fe9,null))['catch'](handleError(_0x591fe9,null));};exports[_0xcdf6('0xa1')]=function(_0x4b04fe,_0x17240b,_0x4e70b3){var _0x2b34bf={'raw':!![],'where':{}};var _0x3d3898={};var _0x33e1cb={'count':0x0,'rows':[]};return db[_0xcdf6('0x3f')]['findOne']({'where':{'id':_0x4b04fe['params']['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x17240b,null))[_0xcdf6('0x34')](function(_0x5edad7){if(_0x5edad7){_0x3d3898['model']=_[_0xcdf6('0x58')](db[_0xcdf6('0xa2')][_0xcdf6('0x40')]);_0x3d3898[_0xcdf6('0x45')]=_['keys'](_0x4b04fe[_0xcdf6('0x45')]);_0x3d3898['filters']=_[_0xcdf6('0x47')](_0x3d3898[_0xcdf6('0x44')],_0x3d3898[_0xcdf6('0x45')]);_0x2b34bf[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x3d3898[_0xcdf6('0x44')],qs[_0xcdf6('0x49')](_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x49')]));_0x2b34bf[_0xcdf6('0x48')]=_0x2b34bf[_0xcdf6('0x48')][_0xcdf6('0x4a')]?_0x2b34bf[_0xcdf6('0x48')]:_0x3d3898[_0xcdf6('0x44')];if(!_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x2b34bf[_0xcdf6('0x2e')]=qs[_0xcdf6('0x2e')](_0x4b04fe[_0xcdf6('0x45')]['limit']);_0x2b34bf[_0xcdf6('0x2d')]=qs['offset'](_0x4b04fe['query'][_0xcdf6('0x2d')]);}_0x2b34bf['order']=qs[_0xcdf6('0x4e')](_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x2b34bf[_0xcdf6('0x4f')]=qs[_0xcdf6('0x46')](_['pick'](_0x4b04fe['query'],_0x3d3898[_0xcdf6('0x46')]));_0x2b34bf[_0xcdf6('0x4f')][_0xcdf6('0x66')]=_0x5edad7['id'];if(_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x2b34bf[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x2b34bf['where'],{'$or':_[_0xcdf6('0x3e')](_0x2b34bf[_0xcdf6('0x48')],function(_0x36ee14){var _0x5d2685={};_0x5d2685[_0x36ee14]={'$like':'%'+_0x4b04fe[_0xcdf6('0x45')]['filter']+'%'};return _0x5d2685;})});}if(_0x4b04fe[_0xcdf6('0x45')]['$gte']){var _0x556bfd=_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0xa3')]['split'](',');var _0x39d7f8={};_0x39d7f8[_0x556bfd[0x0]]={'$gte':moment(_0x556bfd[0x1])['format'](_0xcdf6('0xa4'))};_0x2b34bf[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x2b34bf[_0xcdf6('0x4f')],_0x39d7f8);}_0x2b34bf=_[_0xcdf6('0x51')]({},_0x2b34bf,_0x4b04fe['options']);return db['FaxMessage'][_0xcdf6('0x2c')]({'where':_0x2b34bf[_0xcdf6('0x4f')]})[_0xcdf6('0x34')](function(_0x3c9aad){_0x33e1cb[_0xcdf6('0x2c')]=_0x3c9aad;if(_0x4b04fe[_0xcdf6('0x45')][_0xcdf6('0x53')]){_0x2b34bf['include']=[{'all':!![]}];}return db[_0xcdf6('0xa2')][_0xcdf6('0x55')](_0x2b34bf);})[_0xcdf6('0x34')](function(_0x118292){_0x33e1cb[_0xcdf6('0x56')]=_0x118292;return _0x33e1cb;});}})['then'](respondWithFilteredResult(_0x17240b,_0x2b34bf))['catch'](handleError(_0x17240b,null));};exports[_0xcdf6('0x3b')]=function(_0x289407,_0x5034ec,_0x2ac481){var _0x5e928d,_0x2bcf68={},_0x293c05;if(_0x289407[_0xcdf6('0x5c')]['to']){_0x293c05=_0x289407[_0xcdf6('0x5c')]['to'][0x0];}return db['FaxAccount'][_0xcdf6('0x5a')]({'where':{'id':_0x289407['params']['id']},'include':[{'model':db[_0xcdf6('0xa5')],'as':_0xcdf6('0xa6'),'include':[{'model':db[_0xcdf6('0x75')],'as':_0xcdf6('0xa7'),'where':{'fax':_0x293c05},'limit':0x1,'order':[[_0xcdf6('0x9d'),_0xcdf6('0xa8')]]}]}]})[_0xcdf6('0x34')](handleEntityNotFound(_0x5034ec,null))[_0xcdf6('0x34')](function(_0x154e91){_0x5e928d=_0x154e91;if(_0x289407['body'][_0xcdf6('0xa9')]&&_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][_0xcdf6('0x4a')]){for(var _0x440184=0x0;_0x440184<_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')]['length'];_0x440184+=0x1){_0x289407['body'][_0xcdf6('0xa9')][_0x440184]={'filename':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][_0x440184][_0xcdf6('0x3a')],'id':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][_0x440184]['id'],'path':path[_0xcdf6('0xaa')](config[_0xcdf6('0xab')],_0xcdf6('0xac'),_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][_0x440184][_0xcdf6('0xad')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xcdf6('0xae')](_0x289407['params']['id'])?undefined:_0x289407[_0xcdf6('0x62')]['id'],'path':_['isNil'](_0x289407['body']['attachments'][0x0][_0xcdf6('0x5')])?undefined:_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['path'],'fax':_['isNil'](_0x289407[_0xcdf6('0x5c')]['to'][0x0])?undefined:_0x289407[_0xcdf6('0x5c')]['to'][0x0]},client9002);})[_0xcdf6('0x34')](function(){if(_0x5e928d){if(_[_0xcdf6('0xae')](_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xaf')])){_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xaf')]=util[_0xcdf6('0xb0')](_0xcdf6('0xb1'),_0x5e928d[_0xcdf6('0x3a')],_0x5e928d[_0xcdf6('0xb2')]);}if(_0x5e928d[_0xcdf6('0xa6')]){if(_0x5e928d[_0xcdf6('0xa6')][_0xcdf6('0xa7')]['length']){return _0x5e928d[_0xcdf6('0xa6')][_0xcdf6('0xa7')][0x0];}else{return db[_0xcdf6('0x75')][_0xcdf6('0x5b')](_['defaults'](_0x289407[_0xcdf6('0x5c')],{'firstName':_0x289407[_0xcdf6('0x5c')]['to'][0x0],'phone':_0x289407['body']['to'][0x0],'fax':_0x289407[_0xcdf6('0x5c')]['to'][0x0],'ListId':_0x5e928d[_0xcdf6('0x9f')]}));}}else{throw new Error(_0xcdf6('0xb3'));}}else{throw new Error(_0xcdf6('0xb4'));}})['then'](function(_0x451f15){if(_0x451f15){return db['FaxInteraction']['find']({'where':{'ContactId':_0x451f15['id'],'closed':![],'FaxAccountId':_0x5e928d['id']}})[_0xcdf6('0x34')](function(_0x2926ae){if(_0x2926ae){return[_0x2926ae,![]];}return db[_0xcdf6('0x74')][_0xcdf6('0x5b')]({'UserId':_0x289407['user']['id'],'ContactId':_0x451f15['id'],'FaxAccountId':_0x5e928d['id'],'fax':_0x289407[_0xcdf6('0x5c')]['to'][0x0],'firstMsgDirection':_0xcdf6('0xb5'),'Messages':[_[_0xcdf6('0x51')](_0x289407['body'],{'read':![],'body':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0][_0xcdf6('0xb6')],'FaxAccountId':_0x5e928d['id'],'UserId':_0x289407[_0xcdf6('0x5d')]['id'],'ContactId':_0x451f15['id'],'AttachmentId':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0xcdf6('0x34')](function(_0x373ea1){return[_0x373ea1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x180d2a,_0x2ba15e){if(_0x2ba15e){return _0x180d2a;}return db[_0xcdf6('0xa2')]['create']({'direction':_0xcdf6('0xb5'),'read':![],'body':_0x289407[_0xcdf6('0x5c')]['attachments'][0x0][_0xcdf6('0xb6')],'FaxAccountId':_0x5e928d['id'],'FaxInteractionId':_0x180d2a['id'],'UserId':_0x289407[_0xcdf6('0x5d')]['id'],'ContactId':_0x180d2a[_0xcdf6('0xb7')],'AttachmentId':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['id']})[_0xcdf6('0x34')](function(_0x185d52){_0x180d2a[_0xcdf6('0xb8')]['Messages']=[];_0x180d2a[_0xcdf6('0xb8')][_0xcdf6('0xb9')][_0xcdf6('0x94')](_0x185d52['dataValues']);return _0x180d2a;});})[_0xcdf6('0x34')](function(_0x35aab1){respondWithRpcPromise(_0xcdf6('0xba'),_0xcdf6('0xba'),{'FaxAccountId':_[_0xcdf6('0xae')](_0x289407[_0xcdf6('0x62')]['id'])?undefined:_0x289407[_0xcdf6('0x62')]['id'],'path':_[_0xcdf6('0xae')](_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['path'])?undefined:_0x289407['body']['attachments'][0x0]['path'],'fax':_[_0xcdf6('0xae')](_0x289407[_0xcdf6('0x5c')]['to'][0x0])?undefined:_0x289407['body']['to'][0x0],'AttachmentId':_0x289407[_0xcdf6('0x5c')][_0xcdf6('0xa9')][0x0]['id']},client9002)[_0xcdf6('0x34')](function(_0x42c351){logger[_0xcdf6('0x1f')](_0xcdf6('0xbb'),_0x42c351);})['catch'](function(_0x37adbf){logger[_0xcdf6('0x1f')]('SendFaxRpc,\x20%s',_0x37adbf);});return _0x35aab1;})['then'](respondWithResult(_0x5034ec,null))[_0xcdf6('0x28')](handleError(_0x5034ec,null));};exports[_0xcdf6('0xbc')]=function(_0x3ffb3f,_0x5c2ec1,_0x114751){return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x3ffb3f[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x5c2ec1,null))[_0xcdf6('0x34')](function(_0x196a9e){if(_0x196a9e){return _0x196a9e['addAgents'](_0x3ffb3f[_0xcdf6('0x5c')][_0xcdf6('0x6c')],_[_0xcdf6('0x72')](_0x3ffb3f[_0xcdf6('0x5c')],[_0xcdf6('0x6c'),'id'])||{})['spread'](function(_0xf4016c){for(var _0x4b00b1=0x0;_0x4b00b1<_0x3ffb3f[_0xcdf6('0x5c')][_0xcdf6('0x6c')][_0xcdf6('0x4a')];_0x4b00b1+=0x1){socket[_0xcdf6('0xbd')](_0xcdf6('0xbe'),{'UserId':_0x3ffb3f[_0xcdf6('0x5c')]['ids'][_0x4b00b1],'FaxAccountId':_0x3ffb3f[_0xcdf6('0x62')]['id']});}return _0xf4016c;});}})[_0xcdf6('0x34')](respondWithResult(_0x5c2ec1,null))[_0xcdf6('0x28')](handleError(_0x5c2ec1,null));};exports[_0xcdf6('0xbf')]=function(_0x454e90,_0x44ab63,_0x59fef1){return db[_0xcdf6('0x3f')][_0xcdf6('0x5a')]({'where':{'id':_0x454e90[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x44ab63,null))['then'](function(_0x2a2c98){if(_0x2a2c98){return _0x2a2c98[_0xcdf6('0xbf')](_0x454e90['query'][_0xcdf6('0x6c')])[_0xcdf6('0x34')](function(){if(_[_0xcdf6('0xc0')](_0x454e90['query'][_0xcdf6('0x6c')])){for(var _0x558e12=0x0;_0x558e12<_0x454e90[_0xcdf6('0x45')][_0xcdf6('0x6c')][_0xcdf6('0x4a')];_0x558e12+=0x1){socket[_0xcdf6('0xbd')](_0xcdf6('0xc1'),{'UserId':Number(_0x454e90[_0xcdf6('0x45')][_0xcdf6('0x6c')][_0x558e12]),'FaxAccountId':Number(_0x454e90['params']['id'])});}}else{socket[_0xcdf6('0xbd')](_0xcdf6('0xc1'),{'UserId':Number(_0x454e90[_0xcdf6('0x45')][_0xcdf6('0x6c')]),'FaxAccountId':Number(_0x454e90[_0xcdf6('0x62')]['id'])});}});}})[_0xcdf6('0x34')](respondWithStatusCode(_0x44ab63,null))[_0xcdf6('0x28')](handleError(_0x44ab63,null));};exports['getAgents']=function(_0x11b0c9,_0x5635b6,_0x5a4f07){var _0x5e489b={};var _0x40439c={};var _0x5dbef6;var _0x4910f8;return db[_0xcdf6('0x3f')]['findOne']({'where':{'id':_0x11b0c9[_0xcdf6('0x62')]['id']}})[_0xcdf6('0x34')](handleEntityNotFound(_0x5635b6,null))['then'](function(_0x34f23c){if(_0x34f23c){_0x5dbef6=_0x34f23c;_0x40439c[_0xcdf6('0x44')]=_[_0xcdf6('0x58')](db[_0xcdf6('0x77')][_0xcdf6('0x40')]);_0x40439c[_0xcdf6('0x45')]=_[_0xcdf6('0x58')](_0x11b0c9[_0xcdf6('0x45')]);_0x40439c[_0xcdf6('0x46')]=_['intersection'](_0x40439c['model'],_0x40439c[_0xcdf6('0x45')]);_0x5e489b[_0xcdf6('0x48')]=_[_0xcdf6('0x47')](_0x40439c['model'],qs[_0xcdf6('0x49')](_0x11b0c9['query'][_0xcdf6('0x49')]));_0x5e489b[_0xcdf6('0x48')]=_0x5e489b[_0xcdf6('0x48')]['length']?_0x5e489b[_0xcdf6('0x48')]:_0x40439c['model'];_0x5e489b[_0xcdf6('0x4d')]=qs['sort'](_0x11b0c9[_0xcdf6('0x45')][_0xcdf6('0x4e')]);_0x5e489b[_0xcdf6('0x4f')]=qs['filters'](_[_0xcdf6('0x69')](_0x11b0c9[_0xcdf6('0x45')],_0x40439c[_0xcdf6('0x46')]));if(_0x11b0c9[_0xcdf6('0x45')][_0xcdf6('0x50')]){_0x5e489b[_0xcdf6('0x4f')]=_[_0xcdf6('0x51')](_0x5e489b[_0xcdf6('0x4f')],{'$or':_[_0xcdf6('0x3e')](_0x5e489b[_0xcdf6('0x48')],function(_0x1f12df){var _0x1aeae2={};_0x1aeae2[_0x1f12df]={'$like':'%'+_0x11b0c9[_0xcdf6('0x45')]['filter']+'%'};return _0x1aeae2;})});}_0x5e489b=_[_0xcdf6('0x51')]({},_0x5e489b,_0x11b0c9[_0xcdf6('0x59')]);return _0x5dbef6['getAgents'](_0x5e489b);}})[_0xcdf6('0x34')](function(_0x162318){if(_0x162318){_0x4910f8=_0x162318[_0xcdf6('0x4a')];if(!_0x11b0c9['query'][_0xcdf6('0x4b')](_0xcdf6('0x4c'))){_0x5e489b['limit']=qs['limit'](_0x11b0c9['query'][_0xcdf6('0x2e')]);_0x5e489b[_0xcdf6('0x2d')]=qs[_0xcdf6('0x2d')](_0x11b0c9[_0xcdf6('0x45')][_0xcdf6('0x2d')]);}return _0x5dbef6[_0xcdf6('0xc2')](_0x5e489b);}})['then'](function(_0x4e61ec){if(_0x4e61ec){return _0x4e61ec?{'count':_0x4910f8,'rows':_0x4e61ec}:null;}})['then'](respondWithResult(_0x5635b6,null))[_0xcdf6('0x28')](handleError(_0x5635b6,null));}; \ No newline at end of file +var _0xc6b0=['exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./faxAccount.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~!@#$%^&-_=+[{]}.','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','count','offset','status','set','json','apply','reject','then','destroy','get','end','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','filter','options','includeAll','findAll','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','FaxAccountId','getDispositions','findOne','Disposition','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications'];(function(_0x5f4a14,_0x3fb334){var _0x56260e=function(_0x583232){while(--_0x583232){_0x5f4a14['push'](_0x5f4a14['shift']());}};_0x56260e(++_0x3fb334);}(_0xc6b0,0x1cd));var _0x0c6b=function(_0x46b1d0,_0x39fff6){_0x46b1d0=_0x46b1d0-0x0;var _0x1b0552=_0xc6b0[_0x46b1d0];return _0x1b0552;};'use strict';var pdf=require(_0x0c6b('0x0'));var emlformat=require(_0x0c6b('0x1'));var rimraf=require(_0x0c6b('0x2'));var zipdir=require(_0x0c6b('0x3'));var jsonpatch=require(_0x0c6b('0x4'));var rp=require(_0x0c6b('0x5'));var moment=require(_0x0c6b('0x6'));var BPromise=require(_0x0c6b('0x7'));var Mustache=require('mustache');var util=require(_0x0c6b('0x8'));var path=require(_0x0c6b('0x9'));var sox=require(_0x0c6b('0xa'));var csv=require(_0x0c6b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0c6b('0xc'));var squel=require(_0x0c6b('0xd'));var crypto=require(_0x0c6b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c6b('0xb'));var querystring=require(_0x0c6b('0xf'));var Papa=require(_0x0c6b('0x10'));var Redis=require(_0x0c6b('0x11'));var authService=require(_0x0c6b('0x12'));var qs=require(_0x0c6b('0x13'));var as=require(_0x0c6b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c6b('0x15'))(_0x0c6b('0x16'));var utils=require(_0x0c6b('0x17'));var config=require('../../config/environment');var db=require(_0x0c6b('0x18'))['db'];config[_0x0c6b('0x19')]=_['defaults'](config[_0x0c6b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x0c6b('0x1a'))(new Redis(config[_0x0c6b('0x19')]));require(_0x0c6b('0x1b'))[_0x0c6b('0x1c')](socket);var jayson=require(_0x0c6b('0x1d'));var client=jayson[_0x0c6b('0x1e')][_0x0c6b('0x1f')]({'port':0x232c});var client9002=jayson[_0x0c6b('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x33094a,_0x4d699e,_0x2d7714){if(_0x2d7714){var _0x1b5b38=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b5b38[_0x0c6b('0x20')](_0x4d699e)){return _0x33094a;}else{throw new db[(_0x0c6b('0x21'))]['ValidationError'](_0x0c6b('0x22'));}}else{return _0x33094a;}}function respondWithRpcPromise(_0x132788,_0x411d9f,_0x12c607,_0x54eb05){return new BPromise(function(_0x342cf0,_0x5ac679){var _0x1b606b=_0x54eb05||client;return _0x1b606b['request'](_0x132788,_0x12c607)['then'](function(_0x567895){logger[_0x0c6b('0x23')]('FaxAccount,\x20%s,\x20%s',_0x411d9f,_0x0c6b('0x24'));logger['debug'](_0x0c6b('0x25'),_0x411d9f,_0x0c6b('0x24'),JSON[_0x0c6b('0x26')](_0x567895));if(_0x567895[_0x0c6b('0x27')]){if(_0x567895[_0x0c6b('0x27')][_0x0c6b('0x28')]===0x1f4){logger[_0x0c6b('0x27')](_0x0c6b('0x29'),_0x411d9f,_0x567895['error']['message']);return _0x5ac679(_0x567895[_0x0c6b('0x27')][_0x0c6b('0x2a')]);}logger[_0x0c6b('0x27')](_0x0c6b('0x29'),_0x411d9f,_0x567895[_0x0c6b('0x27')][_0x0c6b('0x2a')]);return _0x342cf0(_0x567895['error'][_0x0c6b('0x2a')]);}else{logger[_0x0c6b('0x23')](_0x0c6b('0x29'),_0x411d9f,_0x0c6b('0x24'));_0x342cf0(_0x567895[_0x0c6b('0x2b')][_0x0c6b('0x2a')]);}})[_0x0c6b('0x2c')](function(_0x2d3512){logger['error'](_0x0c6b('0x29'),_0x411d9f,_0x2d3512);_0x5ac679(_0x2d3512);});});}function respondWithStatusCode(_0x52f609,_0xd1ee9d){_0xd1ee9d=_0xd1ee9d||0xcc;return function(_0x4dd0a7){if(_0x4dd0a7){return _0x52f609[_0x0c6b('0x2d')](_0xd1ee9d);}return _0x52f609['status'](_0xd1ee9d)['end']();};}function respondWithResult(_0x193579,_0x366705){_0x366705=_0x366705||0xc8;return function(_0x1c3f8f){if(_0x1c3f8f){return _0x193579['status'](_0x366705)['json'](_0x1c3f8f);}};}function respondWithFilteredResult(_0x12a847,_0x3b523c){return function(_0x4cc308){if(_0x4cc308){var _0x20439=_0x4cc308[_0x0c6b('0x2e')],_0x126fc8=_0x3b523c[_0x0c6b('0x2f')],_0x5105c8=_0x3b523c['offset']+_0x3b523c['limit'],_0x58304e;if(_0x5105c8>=_0x20439){_0x5105c8=_0x20439;_0x58304e=0xc8;}else{_0x58304e=0xce;}_0x12a847[_0x0c6b('0x30')](_0x58304e);return _0x12a847[_0x0c6b('0x31')]('Content-Range',_0x126fc8+'-'+_0x5105c8+'/'+_0x20439)[_0x0c6b('0x32')](_0x4cc308);}return null;};}function patchUpdates(_0x144e51){return function(_0x41a8c6){try{jsonpatch[_0x0c6b('0x33')](_0x41a8c6,_0x144e51,!![]);}catch(_0x1de1c0){return BPromise[_0x0c6b('0x34')](_0x1de1c0);}return _0x41a8c6['save']();};}function saveUpdates(_0x1b55b4,_0x5692fd){return function(_0x30f145){if(_0x30f145){return _0x30f145['update'](_0x1b55b4)[_0x0c6b('0x35')](function(_0xef78f2){return _0xef78f2;});}return null;};}function removeEntity(_0x15db19,_0x26aeae){return function(_0x413236){if(_0x413236){return _0x413236[_0x0c6b('0x36')]()[_0x0c6b('0x35')](function(){var _0x24418d=_0x413236[_0x0c6b('0x37')]({'plain':!![]});var _0x4c4a4d='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x4c4a4d,'resourceId':_0x24418d['id']}})[_0x0c6b('0x35')](function(){return _0x413236;});})[_0x0c6b('0x35')](function(){_0x15db19[_0x0c6b('0x30')](0xcc)[_0x0c6b('0x38')]();});}};}function handleEntityNotFound(_0x523165,_0x41f89a){return function(_0x398b77){if(!_0x398b77){_0x523165[_0x0c6b('0x2d')](0x194);}return _0x398b77;};}function handleError(_0xee6757,_0x4ddc52){_0x4ddc52=_0x4ddc52||0x1f4;return function(_0x3c7eb5){logger[_0x0c6b('0x27')](_0x3c7eb5[_0x0c6b('0x39')]);if(_0x3c7eb5[_0x0c6b('0x3a')]){delete _0x3c7eb5[_0x0c6b('0x3a')];}_0xee6757['status'](_0x4ddc52)[_0x0c6b('0x3b')](_0x3c7eb5);};}exports['index']=function(_0x3cee37,_0x5898ef){var _0x52ed1a={'include':[{'model':db[_0x0c6b('0x3c')],'as':_0x0c6b('0x3d')}]},_0x30e3d1={},_0x52fa3b={'count':0x0,'rows':[]};var _0x4879ab=_[_0x0c6b('0x3e')](db[_0x0c6b('0x3f')][_0x0c6b('0x40')],function(_0xa1819c){return{'name':_0xa1819c[_0x0c6b('0x41')],'type':_0xa1819c[_0x0c6b('0x42')][_0x0c6b('0x43')]};});_0x30e3d1[_0x0c6b('0x44')]=_[_0x0c6b('0x3e')](_0x4879ab,'name');_0x30e3d1[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x3cee37['query']);_0x30e3d1[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x30e3d1[_0x0c6b('0x44')],_0x30e3d1[_0x0c6b('0x45')]);_0x52ed1a[_0x0c6b('0x49')]=_[_0x0c6b('0x48')](_0x30e3d1[_0x0c6b('0x44')],qs[_0x0c6b('0x4a')](_0x3cee37[_0x0c6b('0x45')]['fields']));_0x52ed1a['attributes']=_0x52ed1a[_0x0c6b('0x49')][_0x0c6b('0x4b')]?_0x52ed1a[_0x0c6b('0x49')]:_0x30e3d1[_0x0c6b('0x44')];if(!_0x3cee37[_0x0c6b('0x45')][_0x0c6b('0x4c')]('nolimit')){_0x52ed1a[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x3cee37[_0x0c6b('0x45')]['limit']);_0x52ed1a[_0x0c6b('0x2f')]=qs['offset'](_0x3cee37[_0x0c6b('0x45')]['offset']);}_0x52ed1a[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x3cee37[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x52ed1a[_0x0c6b('0x50')]=qs[_0x0c6b('0x47')](_[_0x0c6b('0x51')](_0x3cee37[_0x0c6b('0x45')],_0x30e3d1[_0x0c6b('0x47')]),_0x4879ab);if(_0x3cee37[_0x0c6b('0x45')]['filter']){_0x52ed1a[_0x0c6b('0x50')]=_[_0x0c6b('0x52')](_0x52ed1a[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x4879ab,function(_0x545d89){if(_0x545d89[_0x0c6b('0x42')]!=='VIRTUAL'){var _0x240dd3={};_0x240dd3[_0x545d89[_0x0c6b('0x3a')]]={'$like':'%'+_0x3cee37['query'][_0x0c6b('0x53')]+'%'};return _0x240dd3;}})});}_0x52ed1a=_[_0x0c6b('0x52')]({},_0x52ed1a,_0x3cee37[_0x0c6b('0x54')]);var _0x5e3f7a={'where':_0x52ed1a[_0x0c6b('0x50')]};return db[_0x0c6b('0x3f')][_0x0c6b('0x2e')](_0x5e3f7a)[_0x0c6b('0x35')](function(_0xeea92b){_0x52fa3b[_0x0c6b('0x2e')]=_0xeea92b;if(_0x3cee37['query'][_0x0c6b('0x55')]){_0x52ed1a['include']=[{'all':!![]}];}return db['FaxAccount'][_0x0c6b('0x56')](_0x52ed1a);})['then'](function(_0xbd854b){_0x52fa3b['rows']=_0xbd854b;return _0x52fa3b;})[_0x0c6b('0x35')](respondWithFilteredResult(_0x5898ef,_0x52ed1a))[_0x0c6b('0x2c')](handleError(_0x5898ef,null));};exports['show']=function(_0x272999,_0x49a32b){var _0x1e1db2={'raw':![],'where':{'id':_0x272999[_0x0c6b('0x57')]['id']},'include':[{'model':db[_0x0c6b('0x3c')],'as':_0x0c6b('0x3d')}]},_0xc24ee7={};_0xc24ee7[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['FaxAccount'][_0x0c6b('0x40')]);_0xc24ee7[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x272999[_0x0c6b('0x45')]);_0xc24ee7['filters']=_[_0x0c6b('0x48')](_0xc24ee7[_0x0c6b('0x44')],_0xc24ee7['query']);_0x1e1db2['attributes']=_[_0x0c6b('0x48')](_0xc24ee7[_0x0c6b('0x44')],qs[_0x0c6b('0x4a')](_0x272999[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x1e1db2[_0x0c6b('0x49')]=_0x1e1db2[_0x0c6b('0x49')][_0x0c6b('0x4b')]?_0x1e1db2[_0x0c6b('0x49')]:_0xc24ee7[_0x0c6b('0x44')];if(_0x272999[_0x0c6b('0x45')][_0x0c6b('0x55')]){_0x1e1db2[_0x0c6b('0x58')]=[{'all':!![]}];}_0x1e1db2=_['merge']({},_0x1e1db2,_0x272999['options']);return db[_0x0c6b('0x3f')]['find'](_0x1e1db2)['then'](handleEntityNotFound(_0x49a32b,null))[_0x0c6b('0x35')](respondWithResult(_0x49a32b,null))[_0x0c6b('0x2c')](handleError(_0x49a32b,null));};exports[_0x0c6b('0x59')]=function(_0x2fd8b2,_0x2626b3){return db[_0x0c6b('0x3f')][_0x0c6b('0x59')](_0x2fd8b2['body'],{})['then'](function(_0x4d29ec){var _0x5b901=_0x2fd8b2[_0x0c6b('0x5a')][_0x0c6b('0x37')]({'plain':!![]});if(!_0x5b901)throw new Error(_0x0c6b('0x5b'));if(_0x5b901[_0x0c6b('0x5c')]===_0x0c6b('0x5a')){var _0x16f56f=_0x4d29ec[_0x0c6b('0x37')]({'plain':!![]});var _0xb549c3=_0x0c6b('0x5d');return db[_0x0c6b('0x5e')][_0x0c6b('0x5f')]({'where':{'name':_0xb549c3,'userProfileId':_0x5b901[_0x0c6b('0x60')]},'raw':!![]})[_0x0c6b('0x35')](function(_0x3a521f){if(_0x3a521f&&_0x3a521f[_0x0c6b('0x61')]===0x0){return db[_0x0c6b('0x62')]['create']({'name':_0x16f56f[_0x0c6b('0x3a')],'resourceId':_0x16f56f['id'],'type':_0x3a521f[_0x0c6b('0x3a')],'sectionId':_0x3a521f['id']},{})[_0x0c6b('0x35')](function(){return _0x4d29ec;});}else{return _0x4d29ec;}})[_0x0c6b('0x2c')](function(_0x1c3ab3){logger[_0x0c6b('0x27')](_0x0c6b('0x63'),_0x1c3ab3);throw _0x1c3ab3;});}return _0x4d29ec;})['then'](respondWithResult(_0x2626b3,0xc9))[_0x0c6b('0x2c')](handleError(_0x2626b3,null));};exports[_0x0c6b('0x64')]=function(_0x57657b,_0x512c08){if(_0x57657b['body']['id']){delete _0x57657b[_0x0c6b('0x65')]['id'];}return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x57657b[_0x0c6b('0x57')]['id']},'include':[{'model':db[_0x0c6b('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x0c6b('0x35')](handleEntityNotFound(_0x512c08,null))[_0x0c6b('0x35')](saveUpdates(_0x57657b['body'],null))[_0x0c6b('0x35')](respondWithResult(_0x512c08,null))[_0x0c6b('0x2c')](handleError(_0x512c08,null));};exports['destroy']=function(_0x93a61b,_0x2faa62){return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x93a61b[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x2faa62,null))[_0x0c6b('0x35')](removeEntity(_0x2faa62,null))['catch'](handleError(_0x2faa62,null));};exports[_0x0c6b('0x66')]=function(_0xd2ac3b,_0x4bb71d){return db['FaxAccount'][_0x0c6b('0x66')]()['then'](respondWithResult(_0x4bb71d,null))[_0x0c6b('0x2c')](handleError(_0x4bb71d,null));};exports['addDisposition']=function(_0x2f6015,_0x420d4a,_0x580b1c){if(_0x2f6015[_0x0c6b('0x65')]['id']){delete _0x2f6015[_0x0c6b('0x65')]['id'];}return db[_0x0c6b('0x3f')]['find']({'where':{'id':_0x2f6015[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x420d4a,null))[_0x0c6b('0x35')](function(_0x36ee56){if(_0x36ee56){_0x2f6015['body'][_0x0c6b('0x67')]=_0x36ee56['id'];return db['Disposition'][_0x0c6b('0x59')](_0x2f6015[_0x0c6b('0x65')]);}})[_0x0c6b('0x35')](respondWithResult(_0x420d4a,null))[_0x0c6b('0x2c')](handleError(_0x420d4a,null));};exports[_0x0c6b('0x68')]=function(_0x251316,_0xcabcb9,_0x24f9b2){var _0x2f7721={'raw':![],'where':{}};var _0x30afa8={};var _0x570328={'count':0x0,'rows':[]};return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0x251316[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0xcabcb9,null))['then'](function(_0x15a2ef){if(_0x15a2ef){_0x30afa8[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db[_0x0c6b('0x6a')][_0x0c6b('0x40')]);_0x30afa8['query']=_[_0x0c6b('0x46')](_0x251316[_0x0c6b('0x45')]);_0x30afa8['filters']=_['intersection'](_0x30afa8[_0x0c6b('0x44')],_0x30afa8[_0x0c6b('0x45')]);_0x2f7721['attributes']=_[_0x0c6b('0x48')](_0x30afa8[_0x0c6b('0x44')],qs['fields'](_0x251316[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x2f7721[_0x0c6b('0x49')]=_0x2f7721[_0x0c6b('0x49')]['length']?_0x2f7721['attributes']:_0x30afa8[_0x0c6b('0x44')];if(!_0x251316[_0x0c6b('0x45')][_0x0c6b('0x4c')](_0x0c6b('0x6b'))){_0x2f7721[_0x0c6b('0x4d')]=qs['limit'](_0x251316[_0x0c6b('0x45')][_0x0c6b('0x4d')]);_0x2f7721['offset']=qs['offset'](_0x251316[_0x0c6b('0x45')][_0x0c6b('0x2f')]);}_0x2f7721[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x251316[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x2f7721[_0x0c6b('0x50')]=qs['filters'](_[_0x0c6b('0x51')](_0x251316['query'],_0x30afa8['filters']));_0x2f7721[_0x0c6b('0x50')][_0x0c6b('0x67')]=_0x15a2ef['id'];if(_0x251316['query'][_0x0c6b('0x53')]){_0x2f7721['where']=_[_0x0c6b('0x52')](_0x2f7721['where'],{'$or':_[_0x0c6b('0x3e')](_0x2f7721[_0x0c6b('0x49')],function(_0x5e3d9f){var _0x526237={};_0x526237[_0x5e3d9f]={'$like':'%'+_0x251316[_0x0c6b('0x45')][_0x0c6b('0x53')]+'%'};return _0x526237;})});}_0x2f7721=_[_0x0c6b('0x52')]({},_0x2f7721,_0x251316['options']);return db[_0x0c6b('0x6a')]['count']({'where':_0x2f7721[_0x0c6b('0x50')]})[_0x0c6b('0x35')](function(_0x405f3f){_0x570328[_0x0c6b('0x2e')]=_0x405f3f;if(_0x251316[_0x0c6b('0x45')]['includeAll']){_0x2f7721[_0x0c6b('0x58')]=[{'all':!![]}];}return db[_0x0c6b('0x6a')]['findAll'](_0x2f7721);})['then'](function(_0xbd854d){_0x570328[_0x0c6b('0x6c')]=_0xbd854d;return _0x570328;});}})[_0x0c6b('0x35')](respondWithFilteredResult(_0xcabcb9,_0x2f7721))[_0x0c6b('0x2c')](handleError(_0xcabcb9,null));};exports[_0x0c6b('0x6d')]=function(_0x1b7d08,_0x5c31b8,_0x5dd332){return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x1b7d08['params']['id']}})['then'](handleEntityNotFound(_0x5c31b8,null))[_0x0c6b('0x35')](function(_0x2cbc7e){if(_0x2cbc7e){return _0x2cbc7e[_0x0c6b('0x6d')](_0x1b7d08[_0x0c6b('0x45')][_0x0c6b('0x6e')]);}})['then'](respondWithStatusCode(_0x5c31b8,null))[_0x0c6b('0x2c')](handleError(_0x5c31b8,null));};exports[_0x0c6b('0x6f')]=function(_0x1dd0ed,_0x3135bb,_0x578d27){if(_0x1dd0ed[_0x0c6b('0x65')]['id']){delete _0x1dd0ed[_0x0c6b('0x65')]['id'];}return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x1dd0ed[_0x0c6b('0x57')]['id']}})['then'](handleEntityNotFound(_0x3135bb,null))['then'](function(_0x44946c){if(_0x44946c){_0x1dd0ed['body'][_0x0c6b('0x67')]=_0x44946c['id'];return db[_0x0c6b('0x70')][_0x0c6b('0x59')](_0x1dd0ed['body']);}})['then'](respondWithResult(_0x3135bb,null))[_0x0c6b('0x2c')](handleError(_0x3135bb,null));};exports[_0x0c6b('0x71')]=function(_0x534f26,_0x5e8b28,_0x5de4ad){var _0x29b2c5={'raw':![],'where':{}};var _0x4d3c42={};var _0x2f612d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x534f26['params']['id']}})['then'](handleEntityNotFound(_0x5e8b28,null))[_0x0c6b('0x35')](function(_0x52c313){if(_0x52c313){_0x4d3c42[_0x0c6b('0x44')]=_['keys'](db[_0x0c6b('0x70')][_0x0c6b('0x40')]);_0x4d3c42[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x534f26[_0x0c6b('0x45')]);_0x4d3c42[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x4d3c42[_0x0c6b('0x44')],_0x4d3c42[_0x0c6b('0x45')]);_0x29b2c5['attributes']=_[_0x0c6b('0x48')](_0x4d3c42[_0x0c6b('0x44')],qs[_0x0c6b('0x4a')](_0x534f26['query']['fields']));_0x29b2c5[_0x0c6b('0x49')]=_0x29b2c5[_0x0c6b('0x49')]['length']?_0x29b2c5['attributes']:_0x4d3c42[_0x0c6b('0x44')];if(!_0x534f26[_0x0c6b('0x45')][_0x0c6b('0x4c')](_0x0c6b('0x6b'))){_0x29b2c5[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x534f26[_0x0c6b('0x45')][_0x0c6b('0x4d')]);_0x29b2c5['offset']=qs['offset'](_0x534f26[_0x0c6b('0x45')]['offset']);}_0x29b2c5[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x534f26[_0x0c6b('0x45')]['sort']);_0x29b2c5[_0x0c6b('0x50')]=qs[_0x0c6b('0x47')](_[_0x0c6b('0x51')](_0x534f26[_0x0c6b('0x45')],_0x4d3c42[_0x0c6b('0x47')]));_0x29b2c5[_0x0c6b('0x50')][_0x0c6b('0x67')]=_0x52c313['id'];if(_0x534f26[_0x0c6b('0x45')]['filter']){_0x29b2c5[_0x0c6b('0x50')]=_[_0x0c6b('0x52')](_0x29b2c5[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x29b2c5['attributes'],function(_0x2e4496){var _0x179f8a={};_0x179f8a[_0x2e4496]={'$like':'%'+_0x534f26[_0x0c6b('0x45')][_0x0c6b('0x53')]+'%'};return _0x179f8a;})});}_0x29b2c5=_['merge']({},_0x29b2c5,_0x534f26[_0x0c6b('0x54')]);return db['CannedAnswer'][_0x0c6b('0x2e')]({'where':_0x29b2c5[_0x0c6b('0x50')]})['then'](function(_0x169144){_0x2f612d[_0x0c6b('0x2e')]=_0x169144;if(_0x534f26['query'][_0x0c6b('0x55')]){_0x29b2c5[_0x0c6b('0x58')]=[{'all':!![]}];}return db[_0x0c6b('0x70')][_0x0c6b('0x56')](_0x29b2c5);})[_0x0c6b('0x35')](function(_0x401938){_0x2f612d['rows']=_0x401938;return _0x2f612d;});}})[_0x0c6b('0x35')](respondWithFilteredResult(_0x5e8b28,_0x29b2c5))[_0x0c6b('0x2c')](handleError(_0x5e8b28,null));};exports[_0x0c6b('0x72')]=function(_0x50ebc0,_0x42f3b5,_0x4e8cdd){return db['FaxAccount'][_0x0c6b('0x5f')]({'where':{'id':_0x50ebc0[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x42f3b5,null))['then'](function(_0x3a6ffc){if(_0x3a6ffc){return _0x3a6ffc[_0x0c6b('0x72')](_0x50ebc0['query']['ids']);}})['then'](respondWithStatusCode(_0x42f3b5,null))[_0x0c6b('0x2c')](handleError(_0x42f3b5,null));};exports[_0x0c6b('0x73')]=function(_0x28bd18,_0x27cffd,_0x65f495){return db[_0x0c6b('0x74')]['find']({'where':{'id':_0x28bd18['params']['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x27cffd,null))[_0x0c6b('0x35')](function(_0x34c8df){if(_0x34c8df){return _0x34c8df[_0x0c6b('0x73')](_0x28bd18[_0x0c6b('0x65')][_0x0c6b('0x6e')],_['omit'](_0x28bd18[_0x0c6b('0x65')],['ids','id'])||{});}})[_0x0c6b('0x35')](respondWithResult(_0x27cffd,null))[_0x0c6b('0x2c')](handleError(_0x27cffd,null));};exports[_0x0c6b('0x75')]=function(_0x18052b,_0x20589e,_0x1efc90){var _0x523720={'raw':![],'where':{}};var _0x8b36da={};var _0x4f31b7={'count':0x0,'rows':[]};return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0x18052b['params']['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x20589e,null))[_0x0c6b('0x35')](function(_0xdba1b8){if(_0xdba1b8){_0x8b36da[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['FaxInteraction'][_0x0c6b('0x40')]);_0x8b36da[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x18052b[_0x0c6b('0x45')]);_0x8b36da[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x8b36da[_0x0c6b('0x44')],_0x8b36da[_0x0c6b('0x45')]);_0x523720[_0x0c6b('0x49')]=_[_0x0c6b('0x48')](_0x8b36da['model'],qs[_0x0c6b('0x4a')](_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x523720[_0x0c6b('0x49')]=_0x523720[_0x0c6b('0x49')][_0x0c6b('0x4b')]?_0x523720[_0x0c6b('0x49')]:_0x8b36da['model'];if(!_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x4c')](_0x0c6b('0x6b'))){_0x523720['limit']=qs[_0x0c6b('0x4d')](_0x18052b['query'][_0x0c6b('0x4d')]);_0x523720[_0x0c6b('0x2f')]=qs[_0x0c6b('0x2f')](_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x2f')]);}_0x523720[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x523720[_0x0c6b('0x50')]=qs[_0x0c6b('0x47')](_[_0x0c6b('0x51')](_0x18052b[_0x0c6b('0x45')],_0x8b36da[_0x0c6b('0x47')]));_0x523720[_0x0c6b('0x50')][_0x0c6b('0x67')]=_0xdba1b8['id'];if(_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x53')]){_0x523720[_0x0c6b('0x50')]=_[_0x0c6b('0x52')](_0x523720[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x523720[_0x0c6b('0x49')],function(_0x4ef406){var _0x560d9e={};_0x560d9e[_0x4ef406]={'$like':'%'+_0x18052b[_0x0c6b('0x45')]['filter']+'%'};return _0x560d9e;})});}_0x523720=_[_0x0c6b('0x52')]({},_0x523720,_0x18052b['options']);return db[_0x0c6b('0x74')][_0x0c6b('0x2e')]({'where':_0x523720['where']})[_0x0c6b('0x35')](function(_0x54a121){_0x4f31b7['count']=_0x54a121;if(_0x18052b[_0x0c6b('0x45')]['includeAll']){_0x523720[_0x0c6b('0x58')]=[{'model':db[_0x0c6b('0x76')],'as':_0x0c6b('0x77'),'required':![]},{'model':db[_0x0c6b('0x78')],'as':_0x0c6b('0x79'),'attributes':[_0x0c6b('0x3a'),_0x0c6b('0x7a'),_0x0c6b('0x7b')],'required':![]},{'model':db[_0x0c6b('0x7c')],'as':_0x0c6b('0x7d'),'attributes':['id',_0x0c6b('0x3a'),_0x0c6b('0x7e')],'where':_0x18052b[_0x0c6b('0x45')][_0x0c6b('0x7f')]?{'id':_0x18052b['query'][_0x0c6b('0x7f')]}:undefined,'required':_0x18052b[_0x0c6b('0x45')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x0c6b('0x56')](_0x523720);})['then'](function(_0x4a2a18){_0x4f31b7[_0x0c6b('0x6c')]=_0x4a2a18;return _0x4f31b7;});}})[_0x0c6b('0x35')](respondWithFilteredResult(_0x20589e,_0x523720))[_0x0c6b('0x2c')](handleError(_0x20589e,null));};exports[_0x0c6b('0x80')]=function(_0xae1593,_0x54a789,_0x35265c){return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0xae1593[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x54a789,null))[_0x0c6b('0x35')](function(_0x4422c9){if(_0x4422c9){return db[_0x0c6b('0x81')][_0x0c6b('0x82')](function(_0x516b22){return db[_0x0c6b('0x83')][_0x0c6b('0x36')]({'where':{'FaxAccountId':_0xae1593[_0x0c6b('0x57')]['id']},'transaction':_0x516b22})[_0x0c6b('0x35')](function(_0x18b60c){var _0x337030=_[_0x0c6b('0x3e')](_0xae1593[_0x0c6b('0x65')],function(_0x4791c1){_0x4791c1[_0x0c6b('0x67')]=_0xae1593[_0x0c6b('0x57')]['id'];return _0x4791c1;});return db['FaxApplication'][_0x0c6b('0x84')](_0x337030,{'transaction':_0x516b22});});})[_0x0c6b('0x35')](function(){return db['FaxApplication'][_0x0c6b('0x85')]({'where':{'FaxAccountId':_0xae1593[_0x0c6b('0x57')]['id']},'order':_0x0c6b('0x86')});});}})['then'](respondWithResult(_0x54a789,null))[_0x0c6b('0x2c')](handleError(_0x54a789,null));};exports[_0x0c6b('0x87')]=function(_0x1bf2bf,_0x16378e,_0x9016c9){var _0x23e35e={};var _0x2b4a5c={};var _0x2cb46d;var _0x30d203;return db['FaxAccount'][_0x0c6b('0x69')]({'where':{'id':_0x1bf2bf[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x16378e,null))['then'](function(_0x57b36b){if(_0x57b36b){_0x2cb46d=_0x57b36b;_0x2b4a5c[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['FaxApplication']['rawAttributes']);_0x2b4a5c['query']=_[_0x0c6b('0x46')](_0x1bf2bf[_0x0c6b('0x45')]);_0x2b4a5c[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x2b4a5c[_0x0c6b('0x44')],_0x2b4a5c[_0x0c6b('0x45')]);_0x23e35e[_0x0c6b('0x49')]=_[_0x0c6b('0x48')](_0x2b4a5c['model'],qs[_0x0c6b('0x4a')](_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x23e35e[_0x0c6b('0x49')]=_0x23e35e[_0x0c6b('0x49')][_0x0c6b('0x4b')]?_0x23e35e['attributes']:_0x2b4a5c[_0x0c6b('0x44')];_0x23e35e[_0x0c6b('0x4e')]=qs['sort'](_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x23e35e[_0x0c6b('0x50')]=qs[_0x0c6b('0x47')](_[_0x0c6b('0x51')](_0x1bf2bf[_0x0c6b('0x45')],_0x2b4a5c[_0x0c6b('0x47')]));if(_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x53')]){_0x23e35e[_0x0c6b('0x50')]=_[_0x0c6b('0x52')](_0x23e35e[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x23e35e[_0x0c6b('0x49')],function(_0x3a6658){var _0x289e6a={};_0x289e6a[_0x3a6658]={'$like':'%'+_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x53')]+'%'};return _0x289e6a;})});}_0x23e35e=_[_0x0c6b('0x52')]({},_0x23e35e,_0x1bf2bf['options']);return _0x2cb46d[_0x0c6b('0x87')](_0x23e35e);}})[_0x0c6b('0x35')](function(_0x395a2c){if(_0x395a2c){_0x30d203=_0x395a2c[_0x0c6b('0x4b')];if(!_0x1bf2bf[_0x0c6b('0x45')][_0x0c6b('0x4c')]('nolimit')){_0x23e35e[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x1bf2bf[_0x0c6b('0x45')]['limit']);_0x23e35e[_0x0c6b('0x2f')]=qs[_0x0c6b('0x2f')](_0x1bf2bf['query'][_0x0c6b('0x2f')]);}return _0x2cb46d[_0x0c6b('0x87')](_0x23e35e);}})[_0x0c6b('0x35')](function(_0x318fdb){if(_0x318fdb){return _0x318fdb?{'count':_0x30d203,'rows':_0x318fdb}:null;}})[_0x0c6b('0x35')](respondWithResult(_0x16378e,null))[_0x0c6b('0x2c')](handleError(_0x16378e,null));};function Extension(_0x3f779d,_0x18d420,_0x149ece,_0x27316a){this['context']='from-voip-provider';this[_0x0c6b('0x88')]=_0x3f779d[_0x0c6b('0x89')];this['app']=_0x27316a;this[_0x0c6b('0x42')]=_0x0c6b('0x8a');this[_0x0c6b('0x8b')]=_0x0c6b('0x8c');this[_0x0c6b('0x67')]=_0x3f779d['id'];this[_0x0c6b('0x86')]=_0x18d420;this[_0x0c6b('0x8d')]=_0x149ece;}function createExtensionsReciveFax(_0xfae9e3){var _0x3fb054=0x1;var _0x4247b0=[];_0x4247b0[_0x0c6b('0x8e')](new Extension(_0xfae9e3,_0x3fb054,'',_0x0c6b('0x8f')));_0x3fb054+=0x1;_0x4247b0[_0x0c6b('0x8e')](new Extension(_0xfae9e3,_0x3fb054,_0x0c6b('0x90'),'Set'));_0x3fb054+=0x1;for(var _0x34ea9d in _0xfae9e3){if(_0xfae9e3['hasOwnProperty'](_0x34ea9d)&&(_0x34ea9d===_0x0c6b('0x91')||_0x34ea9d===_0x0c6b('0x89')||_0x34ea9d===_0x0c6b('0x92')||_0x34ea9d===_0x0c6b('0x93')||_0x34ea9d===_0x0c6b('0x94')||_0x34ea9d===_0x0c6b('0x95')||_0x34ea9d===_0x0c6b('0x96')||_0x34ea9d===_0x0c6b('0x97')||_0x34ea9d===_0x0c6b('0x98'))){_0x4247b0[_0x0c6b('0x8e')](new Extension(_0xfae9e3,_0x3fb054,_0x0c6b('0x99')+_0x34ea9d+')='+_0xfae9e3[_0x34ea9d],_0x0c6b('0x9a')));_0x3fb054+=0x1;}}_0x4247b0['push'](new Extension(_0xfae9e3,_0x3fb054,'6',_0x0c6b('0x9b')));_0x3fb054+=0x1;_0x4247b0[_0x0c6b('0x8e')](new Extension(_0xfae9e3,_0x3fb054,_0x0c6b('0x9c'),'ReceiveFax'));_0x3fb054=0x0;return _0x4247b0;}exports['addAccountApplications']=function(_0xe98119,_0x265f79,_0x28f714){var _0x1920fa;return db['sequelize'][_0x0c6b('0x82')](function(_0x4cd995){return db[_0x0c6b('0x3f')]['create'](_0xe98119['body'],{'transaction':_0x4cd995})[_0x0c6b('0x35')](function(_0x21b6ac){_0x1920fa=_0x21b6ac[_0x0c6b('0x37')]({'plain':!![]});return db[_0x0c6b('0x9d')][_0x0c6b('0x84')](createExtensionsReciveFax(_0x1920fa),{'transaction':_0x4cd995});});})[_0x0c6b('0x35')](function(){return _0x1920fa;})['then'](respondWithResult(_0x265f79,null))[_0x0c6b('0x2c')](handleError(_0x265f79,null));};exports[_0x0c6b('0x9e')]=function(_0x42b6c6,_0x595023,_0x48e4ba){var _0x3090ce;return db['sequelize'][_0x0c6b('0x82')](function(_0x3b71f2){return db[_0x0c6b('0x3f')][_0x0c6b('0x64')](_0x42b6c6[_0x0c6b('0x65')],{'where':{'id':_0x42b6c6[_0x0c6b('0x65')]['id']},'transaction':_0x3b71f2})[_0x0c6b('0x35')](function(_0x52f985){return db[_0x0c6b('0x9d')]['destroy']({'where':{'FaxAccountId':_0x42b6c6['body']['id']},'transaction':_0x3b71f2})[_0x0c6b('0x35')](function(_0x1519ac){return db[_0x0c6b('0x9d')][_0x0c6b('0x84')](createExtensionsReciveFax(_[_0x0c6b('0x9f')](_0x42b6c6[_0x0c6b('0x65')],[_0x0c6b('0xa0'),_0x0c6b('0x43'),_0x0c6b('0xa1'),_0x0c6b('0xa2'),_0x0c6b('0xa3'),'ListId'])),{'transaction':_0x3b71f2});});});})[_0x0c6b('0x35')](function(){return db[_0x0c6b('0x3f')]['findById'](_0x42b6c6[_0x0c6b('0x65')]['id']);})['then'](respondWithResult(_0x595023,null))[_0x0c6b('0x2c')](handleError(_0x595023,null));};exports[_0x0c6b('0xa4')]=function(_0x203941,_0x33cd67,_0x4a4e1b){var _0x16ab4d={'raw':!![],'where':{}};var _0x4483ce={};var _0x2c93db={'count':0x0,'rows':[]};return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0x203941[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x33cd67,null))[_0x0c6b('0x35')](function(_0x987570){if(_0x987570){_0x4483ce[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['FaxMessage']['rawAttributes']);_0x4483ce['query']=_[_0x0c6b('0x46')](_0x203941[_0x0c6b('0x45')]);_0x4483ce[_0x0c6b('0x47')]=_['intersection'](_0x4483ce[_0x0c6b('0x44')],_0x4483ce[_0x0c6b('0x45')]);_0x16ab4d[_0x0c6b('0x49')]=_[_0x0c6b('0x48')](_0x4483ce[_0x0c6b('0x44')],qs[_0x0c6b('0x4a')](_0x203941[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x16ab4d['attributes']=_0x16ab4d['attributes'][_0x0c6b('0x4b')]?_0x16ab4d['attributes']:_0x4483ce[_0x0c6b('0x44')];if(!_0x203941[_0x0c6b('0x45')][_0x0c6b('0x4c')]('nolimit')){_0x16ab4d[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x203941['query']['limit']);_0x16ab4d['offset']=qs[_0x0c6b('0x2f')](_0x203941[_0x0c6b('0x45')][_0x0c6b('0x2f')]);}_0x16ab4d[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x203941[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x16ab4d['where']=qs['filters'](_['pick'](_0x203941[_0x0c6b('0x45')],_0x4483ce[_0x0c6b('0x47')]));_0x16ab4d[_0x0c6b('0x50')][_0x0c6b('0x67')]=_0x987570['id'];if(_0x203941[_0x0c6b('0x45')][_0x0c6b('0x53')]){_0x16ab4d['where']=_['merge'](_0x16ab4d[_0x0c6b('0x50')],{'$or':_[_0x0c6b('0x3e')](_0x16ab4d[_0x0c6b('0x49')],function(_0x5d5f78){var _0x56ba93={};_0x56ba93[_0x5d5f78]={'$like':'%'+_0x203941['query'][_0x0c6b('0x53')]+'%'};return _0x56ba93;})});}if(_0x203941[_0x0c6b('0x45')][_0x0c6b('0xa5')]){var _0x73abe=_0x203941['query']['$gte'][_0x0c6b('0xa6')](',');var _0x1158b4={};_0x1158b4[_0x73abe[0x0]]={'$gte':moment(_0x73abe[0x1])['format'](_0x0c6b('0xa7'))};_0x16ab4d['where']=_['merge'](_0x16ab4d[_0x0c6b('0x50')],_0x1158b4);}_0x16ab4d=_['merge']({},_0x16ab4d,_0x203941['options']);return db['FaxMessage'][_0x0c6b('0x2e')]({'where':_0x16ab4d[_0x0c6b('0x50')]})[_0x0c6b('0x35')](function(_0xb6e660){_0x2c93db['count']=_0xb6e660;if(_0x203941[_0x0c6b('0x45')][_0x0c6b('0x55')]){_0x16ab4d['include']=[{'all':!![]}];}return db[_0x0c6b('0xa8')][_0x0c6b('0x56')](_0x16ab4d);})[_0x0c6b('0x35')](function(_0x53121a){_0x2c93db['rows']=_0x53121a;return _0x2c93db;});}})[_0x0c6b('0x35')](respondWithFilteredResult(_0x33cd67,_0x16ab4d))['catch'](handleError(_0x33cd67,null));};exports['send']=function(_0x35ff5a,_0x448810,_0x8ad955){var _0x5c15b8,_0x577453={},_0x50946c;if(_0x35ff5a[_0x0c6b('0x65')]['to']){_0x50946c=_0x35ff5a[_0x0c6b('0x65')]['to'][0x0];}return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x35ff5a[_0x0c6b('0x57')]['id']},'include':[{'model':db[_0x0c6b('0xa9')],'as':_0x0c6b('0xaa'),'include':[{'model':db['CmContact'],'as':_0x0c6b('0xab'),'where':{'fax':_0x50946c},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x0c6b('0x35')](handleEntityNotFound(_0x448810,null))[_0x0c6b('0x35')](function(_0x4e9150){_0x5c15b8=_0x4e9150;if(_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')]&&_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][_0x0c6b('0x4b')]){for(var _0x4002e7=0x0;_0x4002e7<_0x35ff5a['body'][_0x0c6b('0xac')][_0x0c6b('0x4b')];_0x4002e7+=0x1){_0x35ff5a['body'][_0x0c6b('0xac')][_0x4002e7]={'filename':_0x35ff5a['body'][_0x0c6b('0xac')][_0x4002e7]['name'],'id':_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][_0x4002e7]['id'],'path':path[_0x0c6b('0xad')](config[_0x0c6b('0xae')],_0x0c6b('0xaf'),_0x35ff5a['body'][_0x0c6b('0xac')][_0x4002e7][_0x0c6b('0xb0')])};}}return respondWithRpcPromise(_0x0c6b('0xb1'),_0x0c6b('0xb1'),{'FaxAccountId':_[_0x0c6b('0xb2')](_0x35ff5a[_0x0c6b('0x57')]['id'])?undefined:_0x35ff5a[_0x0c6b('0x57')]['id'],'path':_[_0x0c6b('0xb2')](_0x35ff5a['body']['attachments'][0x0][_0x0c6b('0x9')])?undefined:_0x35ff5a[_0x0c6b('0x65')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x35ff5a[_0x0c6b('0x65')]['to'][0x0])?undefined:_0x35ff5a[_0x0c6b('0x65')]['to'][0x0]},client9002);})[_0x0c6b('0x35')](function(){if(_0x5c15b8){if(_['isNil'](_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xb3')])){_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xb3')]=util['format'](_0x0c6b('0xb4'),_0x5c15b8[_0x0c6b('0x3a')],_0x5c15b8['fax']);}if(_0x5c15b8[_0x0c6b('0xaa')]){if(_0x5c15b8[_0x0c6b('0xaa')]['Contacts'][_0x0c6b('0x4b')]){return _0x5c15b8[_0x0c6b('0xaa')][_0x0c6b('0xab')][0x0];}else{return db[_0x0c6b('0x76')][_0x0c6b('0x59')](_[_0x0c6b('0xb5')](_0x35ff5a[_0x0c6b('0x65')],{'firstName':_0x35ff5a[_0x0c6b('0x65')]['to'][0x0],'phone':_0x35ff5a[_0x0c6b('0x65')]['to'][0x0],'fax':_0x35ff5a[_0x0c6b('0x65')]['to'][0x0],'ListId':_0x5c15b8[_0x0c6b('0xb6')]}));}}else{throw new Error(_0x0c6b('0xb7'));}}else{throw new Error(_0x0c6b('0xb8'));}})[_0x0c6b('0x35')](function(_0x227887){if(_0x227887){return db[_0x0c6b('0x74')]['find']({'where':{'ContactId':_0x227887['id'],'closed':![],'FaxAccountId':_0x5c15b8['id']}})['then'](function(_0x3c924b){if(_0x3c924b){return[_0x3c924b,![]];}return db[_0x0c6b('0x74')]['create']({'UserId':_0x35ff5a[_0x0c6b('0x5a')]['id'],'ContactId':_0x227887['id'],'FaxAccountId':_0x5c15b8['id'],'fax':_0x35ff5a[_0x0c6b('0x65')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x0c6b('0x52')](_0x35ff5a[_0x0c6b('0x65')],{'read':![],'body':_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][0x0]['filename'],'FaxAccountId':_0x5c15b8['id'],'UserId':_0x35ff5a[_0x0c6b('0x5a')]['id'],'ContactId':_0x227887['id'],'AttachmentId':_0x35ff5a['body'][_0x0c6b('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x0c6b('0xb9')}]})[_0x0c6b('0x35')](function(_0x47b5a9){return[_0x47b5a9,!![]];});});}else{throw new Error(_0x0c6b('0xba'));}})[_0x0c6b('0xbb')](function(_0x1cf6bb,_0x3de5f7){if(_0x3de5f7){return _0x1cf6bb;}return db[_0x0c6b('0xa8')][_0x0c6b('0x59')]({'direction':_0x0c6b('0xbc'),'read':![],'body':_0x35ff5a[_0x0c6b('0x65')]['attachments'][0x0][_0x0c6b('0xbd')],'FaxAccountId':_0x5c15b8['id'],'FaxInteractionId':_0x1cf6bb['id'],'UserId':_0x35ff5a[_0x0c6b('0x5a')]['id'],'ContactId':_0x1cf6bb[_0x0c6b('0xbe')],'AttachmentId':_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][0x0]['id']})[_0x0c6b('0x35')](function(_0x4ef759){_0x1cf6bb[_0x0c6b('0xbf')][_0x0c6b('0xb9')]=[];_0x1cf6bb[_0x0c6b('0xbf')]['Messages'][_0x0c6b('0x8e')](_0x4ef759[_0x0c6b('0xbf')]);return _0x1cf6bb;});})[_0x0c6b('0x35')](function(_0x1f08bb){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x0c6b('0xb2')](_0x35ff5a[_0x0c6b('0x57')]['id'])?undefined:_0x35ff5a['params']['id'],'path':_[_0x0c6b('0xb2')](_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][0x0][_0x0c6b('0x9')])?undefined:_0x35ff5a[_0x0c6b('0x65')][_0x0c6b('0xac')][0x0][_0x0c6b('0x9')],'fax':_[_0x0c6b('0xb2')](_0x35ff5a['body']['to'][0x0])?undefined:_0x35ff5a['body']['to'][0x0],'AttachmentId':_0x35ff5a[_0x0c6b('0x65')]['attachments'][0x0]['id']},client9002)[_0x0c6b('0x35')](function(_0x9c322c){logger[_0x0c6b('0x23')](_0x0c6b('0xc0'),_0x9c322c);})['catch'](function(_0x55f3bb){logger[_0x0c6b('0x23')]('SendFaxRpc,\x20%s',_0x55f3bb);});return _0x1f08bb;})[_0x0c6b('0x35')](respondWithResult(_0x448810,null))[_0x0c6b('0x2c')](handleError(_0x448810,null));};exports['addAgents']=function(_0x1c06d4,_0x2bf552,_0x11b835){return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x1c06d4[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x2bf552,null))['then'](function(_0x4aa6f8){if(_0x4aa6f8){return _0x4aa6f8[_0x0c6b('0xc1')](_0x1c06d4[_0x0c6b('0x65')][_0x0c6b('0x6e')],_['omit'](_0x1c06d4[_0x0c6b('0x65')],[_0x0c6b('0x6e'),'id'])||{})['spread'](function(_0x52e224){for(var _0x401e1b=0x0;_0x401e1b<_0x1c06d4[_0x0c6b('0x65')][_0x0c6b('0x6e')][_0x0c6b('0x4b')];_0x401e1b+=0x1){socket[_0x0c6b('0xc2')](_0x0c6b('0xc3'),{'UserId':_0x1c06d4[_0x0c6b('0x65')][_0x0c6b('0x6e')][_0x401e1b],'FaxAccountId':_0x1c06d4[_0x0c6b('0x57')]['id']});}return _0x52e224;});}})[_0x0c6b('0x35')](respondWithResult(_0x2bf552,null))[_0x0c6b('0x2c')](handleError(_0x2bf552,null));};exports[_0x0c6b('0xc4')]=function(_0x589317,_0x106097,_0x350443){return db[_0x0c6b('0x3f')][_0x0c6b('0x5f')]({'where':{'id':_0x589317[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x106097,null))[_0x0c6b('0x35')](function(_0x274215){if(_0x274215){return _0x274215[_0x0c6b('0xc4')](_0x589317[_0x0c6b('0x45')]['ids'])['then'](function(){if(_['isArray'](_0x589317[_0x0c6b('0x45')][_0x0c6b('0x6e')])){for(var _0x1138d2=0x0;_0x1138d2<_0x589317['query'][_0x0c6b('0x6e')]['length'];_0x1138d2+=0x1){socket[_0x0c6b('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x589317[_0x0c6b('0x45')][_0x0c6b('0x6e')][_0x1138d2]),'FaxAccountId':Number(_0x589317[_0x0c6b('0x57')]['id'])});}}else{socket[_0x0c6b('0xc2')](_0x0c6b('0xc5'),{'UserId':Number(_0x589317[_0x0c6b('0x45')][_0x0c6b('0x6e')]),'FaxAccountId':Number(_0x589317['params']['id'])});}});}})[_0x0c6b('0x35')](respondWithStatusCode(_0x106097,null))[_0x0c6b('0x2c')](handleError(_0x106097,null));};exports[_0x0c6b('0xc6')]=function(_0x3c6a76,_0x4e2bf1,_0x41fbe6){var _0x119ad2={};var _0x3fb1f6={};var _0x5026be;var _0x543075;return db[_0x0c6b('0x3f')][_0x0c6b('0x69')]({'where':{'id':_0x3c6a76[_0x0c6b('0x57')]['id']}})[_0x0c6b('0x35')](handleEntityNotFound(_0x4e2bf1,null))[_0x0c6b('0x35')](function(_0x270c66){if(_0x270c66){_0x5026be=_0x270c66;_0x3fb1f6[_0x0c6b('0x44')]=_[_0x0c6b('0x46')](db['User']['rawAttributes']);_0x3fb1f6[_0x0c6b('0x45')]=_[_0x0c6b('0x46')](_0x3c6a76['query']);_0x3fb1f6[_0x0c6b('0x47')]=_[_0x0c6b('0x48')](_0x3fb1f6[_0x0c6b('0x44')],_0x3fb1f6[_0x0c6b('0x45')]);_0x119ad2['attributes']=_[_0x0c6b('0x48')](_0x3fb1f6[_0x0c6b('0x44')],qs['fields'](_0x3c6a76[_0x0c6b('0x45')][_0x0c6b('0x4a')]));_0x119ad2[_0x0c6b('0x49')]=_0x119ad2[_0x0c6b('0x49')]['length']?_0x119ad2[_0x0c6b('0x49')]:_0x3fb1f6[_0x0c6b('0x44')];_0x119ad2[_0x0c6b('0x4e')]=qs[_0x0c6b('0x4f')](_0x3c6a76[_0x0c6b('0x45')][_0x0c6b('0x4f')]);_0x119ad2[_0x0c6b('0x50')]=qs['filters'](_['pick'](_0x3c6a76['query'],_0x3fb1f6['filters']));if(_0x3c6a76[_0x0c6b('0x45')][_0x0c6b('0x53')]){_0x119ad2['where']=_[_0x0c6b('0x52')](_0x119ad2[_0x0c6b('0x50')],{'$or':_['map'](_0x119ad2[_0x0c6b('0x49')],function(_0x13cb88){var _0x27c8c1={};_0x27c8c1[_0x13cb88]={'$like':'%'+_0x3c6a76['query'][_0x0c6b('0x53')]+'%'};return _0x27c8c1;})});}_0x119ad2=_[_0x0c6b('0x52')]({},_0x119ad2,_0x3c6a76[_0x0c6b('0x54')]);return _0x5026be[_0x0c6b('0xc6')](_0x119ad2);}})[_0x0c6b('0x35')](function(_0x269772){if(_0x269772){_0x543075=_0x269772[_0x0c6b('0x4b')];if(!_0x3c6a76[_0x0c6b('0x45')]['hasOwnProperty'](_0x0c6b('0x6b'))){_0x119ad2[_0x0c6b('0x4d')]=qs[_0x0c6b('0x4d')](_0x3c6a76[_0x0c6b('0x45')][_0x0c6b('0x4d')]);_0x119ad2['offset']=qs[_0x0c6b('0x2f')](_0x3c6a76[_0x0c6b('0x45')]['offset']);}return _0x5026be[_0x0c6b('0xc6')](_0x119ad2);}})[_0x0c6b('0x35')](function(_0x5526d7){if(_0x5526d7){return _0x5526d7?{'count':_0x543075,'rows':_0x5526d7}:null;}})['then'](respondWithResult(_0x4e2bf1,null))[_0x0c6b('0x2c')](handleError(_0x4e2bf1,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 80d72dd..39840e9 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 _0x95cd=['events','FaxAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x469665,_0x394876){var _0x291ab5=function(_0x55c1c7){while(--_0x55c1c7){_0x469665['push'](_0x469665['shift']());}};_0x291ab5(++_0x394876);}(_0x95cd,0x87));var _0xd95c=function(_0xb5247b,_0xfdc8ad){_0xb5247b=_0xb5247b-0x0;var _0x4561f9=_0x95cd[_0xb5247b];return _0x4561f9;};'use strict';var EventEmitter=require(_0xd95c('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xd95c('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd95c('0x2')](0x0);var events={'afterCreate':_0xd95c('0x3'),'afterUpdate':'update','afterDestroy':_0xd95c('0x4')};function emitEvent(_0x4acc0a){return function(_0x30b8c4,_0x4f98b4,_0x6aad0b){FaxAccountEvents[_0xd95c('0x5')](_0x4acc0a+':'+_0x30b8c4['id'],_0x30b8c4);FaxAccountEvents[_0xd95c('0x5')](_0x4acc0a,_0x30b8c4);_0x6aad0b(null);};}for(var e in events){if(events[_0xd95c('0x6')](e)){var event=events[e];FaxAccount[_0xd95c('0x7')](e,emitEvent(event));}}module[_0xd95c('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xacc1=['remove','emit','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xacc1,0x194));var _0x1acc=function(_0x322e55,_0x5dd59b){_0x322e55=_0x322e55-0x0;var _0x1dbc5c=_0xacc1[_0x322e55];return _0x1dbc5c;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x1acc('0x0'))['db'][_0x1acc('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1acc('0x2')](0x0);var events={'afterCreate':_0x1acc('0x3'),'afterUpdate':'update','afterDestroy':_0x1acc('0x4')};function emitEvent(_0x288503){return function(_0x4b6877,_0x30e356,_0x14a5e3){FaxAccountEvents[_0x1acc('0x5')](_0x288503+':'+_0x4b6877['id'],_0x4b6877);FaxAccountEvents[_0x1acc('0x5')](_0x288503,_0x4b6877);_0x14a5e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x1acc('0x6')](e,emitEvent(event));}}module[_0x1acc('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0a2e495..0132361 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 _0xfc7a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3fec7d,_0x24bc43){var _0x483c1a=function(_0x17d2c3){while(--_0x17d2c3){_0x3fec7d['push'](_0x3fec7d['shift']());}};_0x483c1a(++_0x24bc43);}(_0xfc7a,0x12d));var _0xafc7=function(_0x1cf7e8,_0x3cea71){_0x1cf7e8=_0x1cf7e8-0x0;var _0x3a9a74=_0xfc7a[_0x1cf7e8];return _0x3a9a74;};'use strict';var _=require(_0xafc7('0x0'));var util=require(_0xafc7('0x1'));var logger=require(_0xafc7('0x2'))(_0xafc7('0x3'));var moment=require(_0xafc7('0x4'));var BPromise=require(_0xafc7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xafc7('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module['exports']=function(_0xf0ce55,_0x4b8377){return _0xf0ce55['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ff2=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x47e036,_0x2cd6da){var _0xfc6cf1=function(_0x514612){while(--_0x514612){_0x47e036['push'](_0x47e036['shift']());}};_0xfc6cf1(++_0x2cd6da);}(_0x9ff2,0x73));var _0x29ff=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x9ff2[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x29ff('0x0'));var util=require('util');var logger=require(_0x29ff('0x1'))(_0x29ff('0x2'));var moment=require(_0x29ff('0x3'));var BPromise=require(_0x29ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29ff('0x5'));var rimraf=require(_0x29ff('0x6'));var config=require(_0x29ff('0x7'));var attributes=require(_0x29ff('0x8'));module[_0x29ff('0x9')]=function(_0x383822,_0x525d32){return _0x383822[_0x29ff('0xa')]('FaxAccount',attributes,{'tableName':_0x29ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 68aaeac..8e07297 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 _0x4bc3=['orderBy','Contacts','length','defaults','create','contact','spread','autoclose','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','*,*,*,*','startRouting','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','include','map','model','catch','NotifyFaxAccount','body','fax','CmContact','describe','then','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','find','account','CmList','DESC','FaxApplication','Applications','List','get','applications'];(function(_0x21c991,_0xb2401c){var _0x3f99fa=function(_0x198c53){while(--_0x198c53){_0x21c991['push'](_0x21c991['shift']());}};_0x3f99fa(++_0xb2401c);}(_0x4bc3,0x107));var _0x34bc=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x4bc3[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require(_0x34bc('0x0'));var moment=require(_0x34bc('0x1'));var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require(_0x34bc('0x4'));var db=require(_0x34bc('0x5'))['db'];var utils=require(_0x34bc('0x6'));var logger=require(_0x34bc('0x7'))(_0x34bc('0x8'));var config=require(_0x34bc('0x9'));var jayson=require(_0x34bc('0xa'));var client=jayson['client']['http']({'port':0x232c});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x2afc2c,_0x52fb79,_0x609053){return new BPromise(function(_0x40d800,_0x447339){return client[_0x34bc('0x10')](_0x2afc2c,_0x609053)['then'](function(_0x8fdfc3){logger[_0x34bc('0x11')](_0x34bc('0x12'),_0x52fb79,_0x34bc('0x13'));logger[_0x34bc('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x52fb79,_0x34bc('0x13'),JSON[_0x34bc('0x15')](_0x8fdfc3));if(_0x8fdfc3[_0x34bc('0x16')]){if(_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x17')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x52fb79,_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);return _0x447339(_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);}logger[_0x34bc('0x16')](_0x34bc('0x12'),_0x52fb79,_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);return _0x40d800(_0x8fdfc3[_0x34bc('0x16')][_0x34bc('0x18')]);}else{logger[_0x34bc('0x11')](_0x34bc('0x12'),_0x52fb79,_0x34bc('0x13'));_0x40d800(_0x8fdfc3['result']['message']);}})['catch'](function(_0x4b537a){logger['error'](_0x34bc('0x12'),_0x52fb79,_0x4b537a);_0x447339(_0x4b537a);});});}exports[_0x34bc('0x19')]=function(_0x27912e){var _0x29425d=this;return new Promise(function(_0x474ee8,_0x2450f0){return db[_0x34bc('0x1a')][_0x34bc('0x1b')]({'raw':_0x27912e[_0x34bc('0x1c')]?_0x27912e[_0x34bc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x27912e[_0x34bc('0x1c')]?_0x27912e['options']['where']||null:null,'attributes':_0x27912e[_0x34bc('0x1c')]?_0x27912e['options'][_0x34bc('0x1d')]||null:null,'limit':_0x27912e['options']?_0x27912e[_0x34bc('0x1c')][_0x34bc('0x1e')]||null:null,'include':_0x27912e[_0x34bc('0x1c')]?_0x27912e[_0x34bc('0x1c')][_0x34bc('0x1f')]?_[_0x34bc('0x20')](_0x27912e['options']['include'],function(_0x42c4f2){return{'model':db[_0x42c4f2[_0x34bc('0x21')]],'as':_0x42c4f2['as'],'attributes':_0x42c4f2['attributes'],'include':_0x42c4f2['include']?_[_0x34bc('0x20')](_0x42c4f2['include'],function(_0x2a1d22){return{'model':db[_0x2a1d22[_0x34bc('0x21')]],'as':_0x2a1d22['as'],'attributes':_0x2a1d22['attributes'],'include':_0x2a1d22[_0x34bc('0x1f')]?_['map'](_0x2a1d22['include'],function(_0x1545ca){return{'model':db[_0x1545ca[_0x34bc('0x21')]],'as':_0x1545ca['as'],'attributes':_0x1545ca[_0x34bc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xdc37d9){logger[_0x34bc('0x11')](_0x34bc('0x19'),_0x27912e);logger[_0x34bc('0x14')](_0x34bc('0x19'),_0x27912e,JSON[_0x34bc('0x15')](_0xdc37d9));_0x474ee8(_0xdc37d9);})[_0x34bc('0x22')](function(_0x3544b2){logger[_0x34bc('0x16')]('GetFaxAccount',_0x3544b2[_0x34bc('0x18')],_0x27912e);_0x2450f0(_0x29425d[_0x34bc('0x16')](0x1f4,_0x3544b2['message']));});});};exports[_0x34bc('0x23')]=function(_0x1f5fa6,_0x2c48ea,_0x5aa528){var _0x3ee096=this;return new Promise(function(_0x146ff3,_0x28f948){var _0x498ad4={'body':_0x1f5fa6[_0x34bc('0x24')],'channel':_0x34bc('0x25')};var _0x1dfcc4=[];var _0x2b7e52=[];var _0x2a37dc={};return db[_0x34bc('0x26')][_0x34bc('0x27')]()[_0x34bc('0x28')](function(_0x5d9ba5){if(!_0x5d9ba5){throw new db[(_0x34bc('0x29'))][(_0x34bc('0x2a'))]('no\x20available\x20attributes');}_0x1dfcc4=_[_0x34bc('0x2b')](_[_0x34bc('0x2c')](_0x5d9ba5),[_0x34bc('0x2d'),_0x34bc('0x2e')]);_0x2b7e52=_[_0x34bc('0x2b')](_[_0x34bc('0x2c')](_0x5d9ba5),[_0x34bc('0x2d'),'updatedAt','CompanyId',_0x34bc('0x2f')]);if(_0x1f5fa6[_0x34bc('0x24')]['id']){delete _0x1f5fa6['body']['id'];}if(_['isNil'](_0x1f5fa6[_0x34bc('0x24')]['from'])){throw new db[(_0x34bc('0x29'))][(_0x34bc('0x2a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x24')])||_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x24')]===''){throw new db['Sequelize'][(_0x34bc('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')])){throw new db['Sequelize'][(_0x34bc('0x2a'))](_0x34bc('0x31')+_0x2b7e52);}if(!_[_0x34bc('0x32')](_0x2b7e52,_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b7e52);}_0x2a37dc[_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')]]=_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x33')];})['then'](function(){return db[_0x34bc('0x1a')][_0x34bc('0x34')]({'where':{'id':_0x1f5fa6[_0x34bc('0x35')]['id']},'include':[{'model':db[_0x34bc('0x36')],'as':'List','include':[{'model':db[_0x34bc('0x26')],'as':'Contacts','where':_0x2a37dc,'limit':0x1,'order':[['updatedAt',_0x34bc('0x37')]]}]},{'model':db[_0x34bc('0x38')],'as':_0x34bc('0x39')}]});})['then'](function(_0x22b6fd){if(_0x22b6fd&&_0x22b6fd[_0x34bc('0x3a')]){var _0x4307c2=_0x22b6fd[_0x34bc('0x3b')]({'plain':!![]});_0x498ad4['account']=_0x4307c2;_0x498ad4[_0x34bc('0x3c')]=_0x4307c2['Applications'];_0x498ad4['list']=_0x4307c2[_0x34bc('0x3a')];_0x498ad4[_0x34bc('0x3c')]=_[_0x34bc('0x3d')](_0x498ad4[_0x34bc('0x3c')],['priority'],['asc']);if(_0x498ad4[_0x34bc('0x35')][_0x34bc('0x39')]){delete _0x498ad4[_0x34bc('0x35')][_0x34bc('0x39')];}if(_0x498ad4[_0x34bc('0x35')][_0x34bc('0x3a')]&&_0x498ad4[_0x34bc('0x35')][_0x34bc('0x3a')][_0x34bc('0x3e')][_0x34bc('0x3f')]){return _0x498ad4[_0x34bc('0x35')]['List']['Contacts'][0x0];}var _0x74c65b=_[_0x34bc('0x40')](_0x1f5fa6[_0x34bc('0x24')],{'firstName':_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x33')],'ListId':_0x4307c2[_0x34bc('0x2f')]});_0x74c65b[_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x30')]]=_0x1f5fa6[_0x34bc('0x24')]['from'];return db['CmContact'][_0x34bc('0x41')](_0x74c65b,{'fields':_0x1dfcc4,'raw':!![]});}})[_0x34bc('0x28')](function(_0x22b818){_0x498ad4[_0x34bc('0x42')]=_0x22b818;if(_0x22b818){var _0x2979d0={'ContactId':_0x22b818['id'],'FaxAccountId':_0x1f5fa6[_0x34bc('0x35')]['id'],'fax':_0x22b818[_0x34bc('0x25')]};return db['FaxInteraction'][_0x34bc('0x34')]({'where':{'ContactId':_0x22b818['id'],'closed':![],'FaxAccountId':_0x1f5fa6[_0x34bc('0x35')]['id']}})['then'](function(_0x1ed46e){if(_0x1ed46e){return[_0x1ed46e,![]];}return db['FaxInteraction']['create'](_0x2979d0)[_0x34bc('0x28')](function(_0x243e64){return[_0x243e64,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x34bc('0x43')](function(_0x521474,_0x85c0e){var _0x5d9ec2=_0x521474[_0x34bc('0x3b')]({'plain':!![]});if(_0x85c0e){if(_0x498ad4[_0x34bc('0x35')][_0x34bc('0x44')]){_0x498ad4['applications']['push']({'id':0x0,'priority':_0x498ad4[_0x34bc('0x3c')][_0x34bc('0x3f')]+0x1,'app':_0x34bc('0x45'),'appdata':_0x34bc('0x46'),'interval':'*,*,*,*'});}_0x5d9ec2[_0x34bc('0x47')]=!![];}else{_0x5d9ec2[_0x34bc('0x47')]=![];}_0x498ad4[_0x34bc('0x48')]=_0x5d9ec2;return db[_0x34bc('0x49')][_0x34bc('0x41')]({'body':_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x24')],'FaxAccountId':_0x1f5fa6[_0x34bc('0x35')]['id'],'FaxInteractionId':_0x521474['id'],'direction':'in','ContactId':_0x521474[_0x34bc('0x4a')],'AttachmentId':_0x1f5fa6[_0x34bc('0x24')][_0x34bc('0x4b')]});})['then'](function(_0x32bff4){_0x498ad4[_0x34bc('0x18')]=_0x32bff4;if(_0x498ad4['interaction']['UserId']){return db[_0x34bc('0x4c')]['find']({'attributes':['id',_0x34bc('0x4d')],'where':{'id':_0x498ad4['interaction']['UserId']}})['then'](function(_0x5e1aaa){if(_0x5e1aaa){_0x498ad4[_0x34bc('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5e1aaa[_0x34bc('0x4d')]+','+(_0x498ad4[_0x34bc('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0x34bc('0x4e')});}return respondWithRpcPromise('Start',_0x34bc('0x4f'),_0x498ad4);});}return respondWithRpcPromise(_0x34bc('0x50'),_0x34bc('0x4f'),_0x498ad4);})[_0x34bc('0x28')](function(_0x1f803a){_0x146ff3(_0x1f803a);})[_0x34bc('0x22')](function(_0x7226da){_0x28f948(_0x3ee096[_0x34bc('0x16')](0x1f4,_0x7226da[_0x34bc('0x18')]));});});}; \ No newline at end of file +var _0xabf5=['keys','createdAt','updatedAt','ListId','body','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','*,*,*,*','FaxMessage','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference'];(function(_0x1376e7,_0x5e4644){var _0x1917d2=function(_0x28ccd5){while(--_0x28ccd5){_0x1376e7['push'](_0x1376e7['shift']());}};_0x1917d2(++_0x5e4644);}(_0xabf5,0x88));var _0x5abf=function(_0x261369,_0x525896){_0x261369=_0x261369-0x0;var _0xb03456=_0xabf5[_0x261369];return _0xb03456;};'use strict';var _=require('lodash');var util=require(_0x5abf('0x0'));var moment=require(_0x5abf('0x1'));var BPromise=require(_0x5abf('0x2'));var rs=require(_0x5abf('0x3'));var fs=require('fs');var Redis=require(_0x5abf('0x4'));var db=require(_0x5abf('0x5'))['db'];var utils=require(_0x5abf('0x6'));var logger=require(_0x5abf('0x7'))(_0x5abf('0x8'));var config=require(_0x5abf('0x9'));var jayson=require(_0x5abf('0xa'));var client=jayson[_0x5abf('0xb')][_0x5abf('0xc')]({'port':0x232c});config[_0x5abf('0xd')]=_[_0x5abf('0xe')](config[_0x5abf('0xd')],{'host':_0x5abf('0xf'),'port':0x18eb});var socket=require(_0x5abf('0x10'))(new Redis(config['redis']));require(_0x5abf('0x11'))['register'](socket);function respondWithRpcPromise(_0x568d4c,_0x316fa0,_0x3a4c0a){return new BPromise(function(_0x170cb7,_0xa42018){return client[_0x5abf('0x12')](_0x568d4c,_0x3a4c0a)[_0x5abf('0x13')](function(_0x37dc39){logger['info'](_0x5abf('0x14'),_0x316fa0,_0x5abf('0x15'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x316fa0,_0x5abf('0x15'),JSON['stringify'](_0x37dc39));if(_0x37dc39[_0x5abf('0x16')]){if(_0x37dc39['error'][_0x5abf('0x17')]===0x1f4){logger['error'](_0x5abf('0x14'),_0x316fa0,_0x37dc39[_0x5abf('0x16')]['message']);return _0xa42018(_0x37dc39[_0x5abf('0x16')]['message']);}logger[_0x5abf('0x16')](_0x5abf('0x14'),_0x316fa0,_0x37dc39[_0x5abf('0x16')]['message']);return _0x170cb7(_0x37dc39[_0x5abf('0x16')][_0x5abf('0x18')]);}else{logger[_0x5abf('0x19')](_0x5abf('0x14'),_0x316fa0,_0x5abf('0x15'));_0x170cb7(_0x37dc39[_0x5abf('0x1a')][_0x5abf('0x18')]);}})[_0x5abf('0x1b')](function(_0x5dedba){logger[_0x5abf('0x16')](_0x5abf('0x14'),_0x316fa0,_0x5dedba);_0xa42018(_0x5dedba);});});}exports[_0x5abf('0x1c')]=function(_0x2aad99){var _0x31df97=this;return new Promise(function(_0xf28d6a,_0x48dad7){return db[_0x5abf('0x1d')][_0x5abf('0x1e')]({'raw':_0x2aad99[_0x5abf('0x1f')]?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x20')]===undefined?!![]:![]:!![],'where':_0x2aad99['options']?_0x2aad99[_0x5abf('0x1f')]['where']||null:null,'attributes':_0x2aad99['options']?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x21')]||null:null,'limit':_0x2aad99['options']?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x22')]||null:null,'include':_0x2aad99[_0x5abf('0x1f')]?_0x2aad99[_0x5abf('0x1f')][_0x5abf('0x23')]?_[_0x5abf('0x24')](_0x2aad99['options'][_0x5abf('0x23')],function(_0x3a83a9){return{'model':db[_0x3a83a9[_0x5abf('0x25')]],'as':_0x3a83a9['as'],'attributes':_0x3a83a9[_0x5abf('0x21')],'include':_0x3a83a9['include']?_['map'](_0x3a83a9['include'],function(_0x23dc4b){return{'model':db[_0x23dc4b[_0x5abf('0x25')]],'as':_0x23dc4b['as'],'attributes':_0x23dc4b[_0x5abf('0x21')],'include':_0x23dc4b['include']?_[_0x5abf('0x24')](_0x23dc4b['include'],function(_0x2a95cf){return{'model':db[_0x2a95cf[_0x5abf('0x25')]],'as':_0x2a95cf['as'],'attributes':_0x2a95cf[_0x5abf('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c63c1){logger[_0x5abf('0x19')](_0x5abf('0x1c'),_0x2aad99);logger[_0x5abf('0x26')](_0x5abf('0x1c'),_0x2aad99,JSON[_0x5abf('0x27')](_0x4c63c1));_0xf28d6a(_0x4c63c1);})[_0x5abf('0x1b')](function(_0x5d0eb7){logger[_0x5abf('0x16')]('GetFaxAccount',_0x5d0eb7[_0x5abf('0x18')],_0x2aad99);_0x48dad7(_0x31df97[_0x5abf('0x16')](0x1f4,_0x5d0eb7[_0x5abf('0x18')]));});});};exports[_0x5abf('0x28')]=function(_0x4e4b5f,_0x550710,_0xecd507){var _0x245afb=this;return new Promise(function(_0x43a50a,_0x552e7c){var _0x346ebb={'body':_0x4e4b5f['body'],'channel':_0x5abf('0x29')};var _0x4b551e=[];var _0x1af3e0=[];var _0x4a81f7={};return db[_0x5abf('0x2a')][_0x5abf('0x2b')]()[_0x5abf('0x13')](function(_0x11730e){if(!_0x11730e){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))](_0x5abf('0x2e'));}_0x4b551e=_[_0x5abf('0x2f')](_[_0x5abf('0x30')](_0x11730e),[_0x5abf('0x31'),_0x5abf('0x32')]);_0x1af3e0=_[_0x5abf('0x2f')](_[_0x5abf('0x30')](_0x11730e),[_0x5abf('0x31'),'updatedAt','CompanyId',_0x5abf('0x33')]);if(_0x4e4b5f[_0x5abf('0x34')]['id']){delete _0x4e4b5f['body']['id'];}if(_['isNil'](_0x4e4b5f['body'][_0x5abf('0x35')])){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))]('from\x20is\x20mandatory');}if(_[_0x5abf('0x36')](_0x4e4b5f['body'][_0x5abf('0x34')])||_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x34')]===''){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))](_0x5abf('0x37'));}if(_[_0x5abf('0x36')](_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x38')])){throw new db[(_0x5abf('0x2c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1af3e0);}if(!_['includes'](_0x1af3e0,_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x38')])){throw new db[(_0x5abf('0x2c'))][(_0x5abf('0x2d'))](_0x5abf('0x39')+_0x1af3e0);}_0x4a81f7[_0x4e4b5f[_0x5abf('0x34')]['mapKey']]=_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x35')];})['then'](function(){return db[_0x5abf('0x1d')][_0x5abf('0x3a')]({'where':{'id':_0x4e4b5f[_0x5abf('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0x5abf('0x3c'),'include':[{'model':db[_0x5abf('0x2a')],'as':_0x5abf('0x3d'),'where':_0x4a81f7,'limit':0x1,'order':[[_0x5abf('0x32'),_0x5abf('0x3e')]]}]},{'model':db[_0x5abf('0x3f')],'as':'Applications'}]});})[_0x5abf('0x13')](function(_0x4825cd){if(_0x4825cd&&_0x4825cd[_0x5abf('0x3c')]){var _0x38d82c=_0x4825cd[_0x5abf('0x40')]({'plain':!![]});_0x346ebb[_0x5abf('0x3b')]=_0x38d82c;_0x346ebb[_0x5abf('0x41')]=_0x38d82c[_0x5abf('0x42')];_0x346ebb[_0x5abf('0x43')]=_0x38d82c['List'];_0x346ebb[_0x5abf('0x41')]=_[_0x5abf('0x44')](_0x346ebb[_0x5abf('0x41')],[_0x5abf('0x45')],['asc']);if(_0x346ebb[_0x5abf('0x3b')]['Applications']){delete _0x346ebb['account']['Applications'];}if(_0x346ebb[_0x5abf('0x3b')][_0x5abf('0x3c')]&&_0x346ebb[_0x5abf('0x3b')][_0x5abf('0x3c')]['Contacts']['length']){return _0x346ebb[_0x5abf('0x3b')][_0x5abf('0x3c')][_0x5abf('0x3d')][0x0];}var _0x4d1635=_[_0x5abf('0xe')](_0x4e4b5f['body'],{'firstName':_0x4e4b5f[_0x5abf('0x34')]['from'],'ListId':_0x38d82c[_0x5abf('0x33')]});_0x4d1635[_0x4e4b5f['body'][_0x5abf('0x38')]]=_0x4e4b5f[_0x5abf('0x34')]['from'];return db[_0x5abf('0x2a')][_0x5abf('0x46')](_0x4d1635,{'fields':_0x4b551e,'raw':!![]});}})[_0x5abf('0x13')](function(_0x1a7033){_0x346ebb[_0x5abf('0x47')]=_0x1a7033;if(_0x1a7033){var _0x23e686={'ContactId':_0x1a7033['id'],'FaxAccountId':_0x4e4b5f[_0x5abf('0x3b')]['id'],'fax':_0x1a7033[_0x5abf('0x29')]};return db[_0x5abf('0x48')][_0x5abf('0x3a')]({'where':{'ContactId':_0x1a7033['id'],'closed':![],'FaxAccountId':_0x4e4b5f[_0x5abf('0x3b')]['id']}})[_0x5abf('0x13')](function(_0x1f5d2a){if(_0x1f5d2a){return[_0x1f5d2a,![]];}return db[_0x5abf('0x48')]['create'](_0x23e686)[_0x5abf('0x13')](function(_0x1bbf81){return[_0x1bbf81,!![]];});});}else{throw new Error(_0x5abf('0x49'));}})[_0x5abf('0x4a')](function(_0x538a99,_0x4b5011){var _0x1529bd=_0x538a99['get']({'plain':!![]});if(_0x4b5011){if(_0x346ebb[_0x5abf('0x3b')][_0x5abf('0x4b')]){_0x346ebb[_0x5abf('0x41')][_0x5abf('0x4c')]({'id':0x0,'priority':_0x346ebb[_0x5abf('0x41')][_0x5abf('0x4d')]+0x1,'app':_0x5abf('0x4e'),'appdata':_0x5abf('0x4f'),'interval':_0x5abf('0x50')});}_0x1529bd['created']=!![];}else{_0x1529bd['created']=![];}_0x346ebb['interaction']=_0x1529bd;return db[_0x5abf('0x51')][_0x5abf('0x46')]({'body':_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x34')],'FaxAccountId':_0x4e4b5f[_0x5abf('0x3b')]['id'],'FaxInteractionId':_0x538a99['id'],'direction':'in','ContactId':_0x538a99['ContactId'],'AttachmentId':_0x4e4b5f[_0x5abf('0x34')][_0x5abf('0x52')]});})[_0x5abf('0x13')](function(_0x3bcaac){_0x346ebb[_0x5abf('0x18')]=_0x3bcaac;if(_0x346ebb[_0x5abf('0x53')][_0x5abf('0x54')]){return db[_0x5abf('0x55')][_0x5abf('0x3a')]({'attributes':['id',_0x5abf('0x56')],'where':{'id':_0x346ebb['interaction'][_0x5abf('0x54')]}})[_0x5abf('0x13')](function(_0x232c88){if(_0x232c88){_0x346ebb[_0x5abf('0x41')][_0x5abf('0x57')]({'id':0x0,'priority':0x0,'app':_0x5abf('0x58'),'appdata':_0x232c88[_0x5abf('0x56')]+','+(_0x346ebb['account'][_0x5abf('0x59')]||0xa),'interval':_0x5abf('0x50')});}return respondWithRpcPromise(_0x5abf('0x5a'),_0x5abf('0x5b'),_0x346ebb);});}return respondWithRpcPromise(_0x5abf('0x5a'),_0x5abf('0x5b'),_0x346ebb);})[_0x5abf('0x13')](function(_0x3979df){_0x43a50a(_0x3979df);})[_0x5abf('0x1b')](function(_0x4816e1){_0x552e7c(_0x245afb[_0x5abf('0x16')](0x1f4,_0x4816e1[_0x5abf('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d91e480..2e3b893 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 _0x81c6=['faxAccount:','save','emit','removeListener','register','length'];(function(_0x552081,_0x5e1773){var _0x30baef=function(_0x1b5aa7){while(--_0x1b5aa7){_0x552081['push'](_0x552081['shift']());}};_0x30baef(++_0x5e1773);}(_0x81c6,0x1d5));var _0x681c=function(_0x279841,_0x4e9e3b){_0x279841=_0x279841-0x0;var _0x4d3a9f=_0x81c6[_0x279841];return _0x4d3a9f;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x681c('0x0'),'remove','update'];function createListener(_0x57f8d2,_0x62d9fc){return function(_0x2d0fc0){_0x62d9fc[_0x681c('0x1')](_0x57f8d2,_0x2d0fc0);};}function removeListener(_0x5566e5,_0x44c18e){return function(){FaxAccountEvents[_0x681c('0x2')](_0x5566e5,_0x44c18e);};}exports[_0x681c('0x3')]=function(_0x1d31c8){for(var _0x4ea522=0x0,_0x45331=events[_0x681c('0x4')];_0x4ea522<_0x45331;_0x4ea522++){var _0x5624d7=events[_0x4ea522];var _0x5b5f22=createListener(_0x681c('0x5')+_0x5624d7,_0x1d31c8);FaxAccountEvents['on'](_0x5624d7,_0x5b5f22);}}; \ No newline at end of file +var _0x77d4=['save','update','removeListener','register'];(function(_0x30d05c,_0x5e3d55){var _0x16eca7=function(_0x50d495){while(--_0x50d495){_0x30d05c['push'](_0x30d05c['shift']());}};_0x16eca7(++_0x5e3d55);}(_0x77d4,0x108));var _0x477d=function(_0xde634,_0xbcee9b){_0xde634=_0xde634-0x0;var _0x232588=_0x77d4[_0xde634];return _0x232588;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x477d('0x0'),'remove',_0x477d('0x1')];function createListener(_0x59945b,_0x41bcf1){return function(_0x13ad75){_0x41bcf1['emit'](_0x59945b,_0x13ad75);};}function removeListener(_0x53e1b8,_0x16213f){return function(){FaxAccountEvents[_0x477d('0x2')](_0x53e1b8,_0x16213f);};}exports[_0x477d('0x3')]=function(_0x471fca){for(var _0x2545e5=0x0,_0x45ca2d=events['length'];_0x2545e5<_0x45ca2d;_0x2545e5++){var _0x4f4fb4=events[_0x2545e5];var _0x2dd5d2=createListener('faxAccount:'+_0x4f4fb4,_0x471fca);FaxAccountEvents['on'](_0x4f4fb4,_0x2dd5d2);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 7e9c69f..5a674cb 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 _0xd59d=['addAnswer','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','put','/:id','update','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/describe','describe','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','create','/:id/dispositions','addDisposition','post'];(function(_0x2429ea,_0x963210){var _0x48e231=function(_0x525455){while(--_0x525455){_0x2429ea['push'](_0x2429ea['shift']());}};_0x48e231(++_0x963210);}(_0xd59d,0x176));var _0xdd59=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xd59d[_0x4dcc2d];return _0x1bbd79;};'use strict';var multer=require('multer');var util=require(_0xdd59('0x0'));var path=require(_0xdd59('0x1'));var timeout=require(_0xdd59('0x2'));var express=require(_0xdd59('0x3'));var router=express['Router']();var auth=require(_0xdd59('0x4'));var interaction=require(_0xdd59('0x5'));var config=require(_0xdd59('0x6'));var controller=require(_0xdd59('0x7'));router['get']('/',auth[_0xdd59('0x8')](),controller[_0xdd59('0x9')]);router[_0xdd59('0xa')](_0xdd59('0xb'),auth[_0xdd59('0x8')](),controller[_0xdd59('0xc')]);router[_0xdd59('0xa')]('/:id',auth[_0xdd59('0x8')](),controller['show']);router[_0xdd59('0xa')]('/:id/dispositions',auth[_0xdd59('0x8')](),controller[_0xdd59('0xd')]);router[_0xdd59('0xa')](_0xdd59('0xe'),auth[_0xdd59('0x8')](),controller['getAnswers']);router['get'](_0xdd59('0xf'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x10')]);router[_0xdd59('0xa')](_0xdd59('0x11'),auth[_0xdd59('0x8')](),controller['getApplications']);router[_0xdd59('0xa')](_0xdd59('0x12'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x13')]);router[_0xdd59('0xa')](_0xdd59('0x14'),auth['isAuthenticated'](),controller[_0xdd59('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdd59('0x16')]);router['post'](_0xdd59('0x17'),auth['isAuthenticated'](),controller[_0xdd59('0x18')]);router[_0xdd59('0x19')](_0xdd59('0xe'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x1a')]);router[_0xdd59('0x19')](_0xdd59('0xf'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x1b')]);router[_0xdd59('0x19')](_0xdd59('0x11'),auth[_0xdd59('0x8')](),controller['addApplications']);router['post'](_0xdd59('0x1c'),auth['isAuthenticated'](),controller[_0xdd59('0x1d')]);router['post'](_0xdd59('0x1e'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x1f')]);router[_0xdd59('0x19')]('/:id/send',auth[_0xdd59('0x8')](),controller[_0xdd59('0x20')]);router['post'](_0xdd59('0x14'),auth[_0xdd59('0x8')](),controller['addAgents']);router[_0xdd59('0x21')](_0xdd59('0x22'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x23')]);router[_0xdd59('0x24')](_0xdd59('0x22'),auth[_0xdd59('0x8')](),controller['destroy']);router[_0xdd59('0x24')](_0xdd59('0x17'),auth[_0xdd59('0x8')](),controller['removeDispositions']);router['delete'](_0xdd59('0xe'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x25')]);router['delete'](_0xdd59('0x14'),auth[_0xdd59('0x8')](),controller[_0xdd59('0x26')]);module[_0xdd59('0x27')]=router; \ No newline at end of file +var _0x7cf5=['addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction'];(function(_0x403d12,_0x193238){var _0x67be85=function(_0x3360c8){while(--_0x3360c8){_0x403d12['push'](_0x403d12['shift']());}};_0x67be85(++_0x193238);}(_0x7cf5,0xbf));var _0x57cf=function(_0x1e561f,_0x478648){_0x1e561f=_0x1e561f-0x0;var _0x13b05b=_0x7cf5[_0x1e561f];return _0x13b05b;};'use strict';var multer=require(_0x57cf('0x0'));var util=require(_0x57cf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x57cf('0x2'));var router=express[_0x57cf('0x3')]();var auth=require(_0x57cf('0x4'));var interaction=require(_0x57cf('0x5'));var config=require(_0x57cf('0x6'));var controller=require(_0x57cf('0x7'));router[_0x57cf('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x57cf('0x8')](_0x57cf('0x9'),auth[_0x57cf('0xa')](),controller[_0x57cf('0xb')]);router['get'](_0x57cf('0xc'),auth['isAuthenticated'](),controller[_0x57cf('0xd')]);router[_0x57cf('0x8')](_0x57cf('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x57cf('0x8')]('/:id/canned_answers',auth[_0x57cf('0xa')](),controller[_0x57cf('0xf')]);router['get'](_0x57cf('0x10'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x11')]);router[_0x57cf('0x8')](_0x57cf('0x12'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x13')]);router['get'](_0x57cf('0x14'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x15')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x57cf('0x16')]);router['post']('/',auth[_0x57cf('0xa')](),controller[_0x57cf('0x17')]);router[_0x57cf('0x18')](_0x57cf('0xe'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x19')]);router[_0x57cf('0x18')](_0x57cf('0x1a'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x1b')]);router['post'](_0x57cf('0x10'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x1c')]);router[_0x57cf('0x18')](_0x57cf('0x12'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x1d')]);router['post'](_0x57cf('0x1e'),auth[_0x57cf('0xa')](),controller['addAccountApplications']);router['post'](_0x57cf('0x1f'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x20')]);router['post'](_0x57cf('0x21'),auth[_0x57cf('0xa')](),controller['send']);router['post'](_0x57cf('0x22'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x23')]);router[_0x57cf('0x24')](_0x57cf('0xc'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x25')]);router[_0x57cf('0x26')](_0x57cf('0xc'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x27')]);router[_0x57cf('0x26')](_0x57cf('0xe'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x28')]);router[_0x57cf('0x26')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x57cf('0x29')]);router['delete'](_0x57cf('0x22'),auth[_0x57cf('0xa')](),controller[_0x57cf('0x2a')]);module[_0x57cf('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 6819ec7..95252c0 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 _0xb8de=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3ed6a8,_0x1b2d2c){var _0x39f741=function(_0xd018fe){while(--_0xd018fe){_0x3ed6a8['push'](_0x3ed6a8['shift']());}};_0x39f741(++_0x1b2d2c);}(_0xb8de,0x152));var _0xeb8d=function(_0x220eeb,_0x2b8a71){_0x220eeb=_0x220eeb-0x0;var _0x418464=_0xb8de[_0x220eeb];return _0x418464;};'use strict';var Sequelize=require(_0xeb8d('0x0'));module[_0xeb8d('0x1')]={'priority':{'type':Sequelize[_0xeb8d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xeb8d('0x3')],'allowNull':![],'defaultValue':_0xeb8d('0x4')},'appdata':{'type':Sequelize[_0xeb8d('0x5')]()},'description':{'type':Sequelize[_0xeb8d('0x3')]},'interval':{'type':Sequelize[_0xeb8d('0x3')],'defaultValue':_0xeb8d('0x6')}}; \ No newline at end of file +var _0xcf2e=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x20f084,_0xbedc94){var _0x28afb8=function(_0x5bc83e){while(--_0x5bc83e){_0x20f084['push'](_0x20f084['shift']());}};_0x28afb8(++_0xbedc94);}(_0xcf2e,0x197));var _0xecf2=function(_0x93b411,_0x4263ca){_0x93b411=_0x93b411-0x0;var _0x14ce11=_0xcf2e[_0x93b411];return _0x14ce11;};'use strict';var Sequelize=require(_0xecf2('0x0'));module[_0xecf2('0x1')]={'priority':{'type':Sequelize[_0xecf2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xecf2('0x3')],'allowNull':![],'defaultValue':_0xecf2('0x4')},'appdata':{'type':Sequelize[_0xecf2('0x5')]()},'description':{'type':Sequelize[_0xecf2('0x3')]},'interval':{'type':Sequelize[_0xecf2('0x3')],'defaultValue':_0xecf2('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 1a5aa05..2da7804 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x85f4e4,_0x45ed36){var _0x2825a5=function(_0x4cca89){while(--_0x4cca89){_0x85f4e4['push'](_0x85f4e4['shift']());}};_0x2825a5(++_0x45ed36);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3889c0,_0x1c0f0e){_0x3889c0=_0x3889c0-0x0;var _0x35b279=_0x8ef6[_0x3889c0];return _0x35b279;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file +var _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x5a4a2e,_0x229265){var _0x312a18=function(_0x12c664){while(--_0x12c664){_0x5a4a2e['push'](_0x5a4a2e['shift']());}};_0x312a18(++_0x229265);}(_0x8ef6,0xf2));var _0x68ef=function(_0x21c721,_0x528197){_0x21c721=_0x21c721-0x0;var _0x4922b1=_0x8ef6[_0x21c721];return _0x4922b1;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 57ed232..90d1f8d 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 _0xac9d=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x59f908,_0x33878f){var _0x44bf1a=function(_0x3fcf95){while(--_0x3fcf95){_0x59f908['push'](_0x59f908['shift']());}};_0x44bf1a(++_0x33878f);}(_0xac9d,0xfb));var _0xdac9=function(_0x358927,_0x1eee11){_0x358927=_0x358927-0x0;var _0x4d5873=_0xac9d[_0x358927];return _0x4d5873;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var logger=require(_0xdac9('0x2'))(_0xdac9('0x3'));var moment=require(_0xdac9('0x4'));var BPromise=require(_0xdac9('0x5'));var rp=require(_0xdac9('0x6'));var fs=require('fs');var path=require(_0xdac9('0x7'));var rimraf=require(_0xdac9('0x8'));var config=require(_0xdac9('0x9'));var attributes=require(_0xdac9('0xa'));module[_0xdac9('0xb')]=function(_0x2f2cd0,_0x10a63f){return _0x2f2cd0[_0xdac9('0xc')](_0xdac9('0xd'),attributes,{'tableName':_0xdac9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdac9('0xf')});}; \ No newline at end of file +var _0x6ec2=['fax_applications','lodash','../../config/logger','bluebird','path','../../config/environment','exports','define','FaxApplication'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x6ec2,0x121));var _0x26ec=function(_0x4d1c8f,_0x1c13cf){_0x4d1c8f=_0x4d1c8f-0x0;var _0x4175aa=_0x6ec2[_0x4d1c8f];return _0x4175aa;};'use strict';var _=require(_0x26ec('0x0'));var util=require('util');var logger=require(_0x26ec('0x1'))('api');var moment=require('moment');var BPromise=require(_0x26ec('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26ec('0x3'));var rimraf=require('rimraf');var config=require(_0x26ec('0x4'));var attributes=require('./faxApplication.attributes');module[_0x26ec('0x5')]=function(_0x11b3b3,_0x1a73c9){return _0x11b3b3[_0x26ec('0x6')](_0x26ec('0x7'),attributes,{'tableName':_0x26ec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 533e399..389f3f5 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 _0x42b7=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','debug','stringify','catch'];(function(_0x12c076,_0x5bef17){var _0x2ddd18=function(_0x436336){while(--_0x436336){_0x12c076['push'](_0x12c076['shift']());}};_0x2ddd18(++_0x5bef17);}(_0x42b7,0x70));var _0x742b=function(_0x12bd18,_0x50ca61){_0x12bd18=_0x12bd18-0x0;var _0x1230ad=_0x42b7[_0x12bd18];return _0x1230ad;};'use strict';var _=require(_0x742b('0x0'));var util=require('util');var moment=require(_0x742b('0x1'));var BPromise=require('bluebird');var rs=require(_0x742b('0x2'));var fs=require('fs');var Redis=require(_0x742b('0x3'));var db=require(_0x742b('0x4'))['db'];var utils=require(_0x742b('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x742b('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x155516,_0x49fc41,_0x2ba95d){return new BPromise(function(_0x2892fb,_0x3245cc){return client[_0x742b('0x7')](_0x155516,_0x2ba95d)[_0x742b('0x8')](function(_0x1fabec){logger[_0x742b('0x9')](_0x742b('0xa'),_0x49fc41,_0x742b('0xb'));logger['debug'](_0x742b('0xc'),_0x49fc41,_0x742b('0xb'),JSON['stringify'](_0x1fabec));if(_0x1fabec[_0x742b('0xd')]){if(_0x1fabec[_0x742b('0xd')][_0x742b('0xe')]===0x1f4){logger[_0x742b('0xd')](_0x742b('0xa'),_0x49fc41,_0x1fabec[_0x742b('0xd')][_0x742b('0xf')]);return _0x3245cc(_0x1fabec[_0x742b('0xd')]['message']);}logger[_0x742b('0xd')](_0x742b('0xa'),_0x49fc41,_0x1fabec[_0x742b('0xd')][_0x742b('0xf')]);return _0x2892fb(_0x1fabec['error'][_0x742b('0xf')]);}else{logger[_0x742b('0x9')](_0x742b('0xa'),_0x49fc41,_0x742b('0xb'));_0x2892fb(_0x1fabec[_0x742b('0x10')][_0x742b('0xf')]);}})['catch'](function(_0x4cad3f){logger['error'](_0x742b('0xa'),_0x49fc41,_0x4cad3f);_0x3245cc(_0x4cad3f);});});}exports[_0x742b('0x11')]=function(_0x2a22eb){var _0x8aaee=this;return new Promise(function(_0x321871,_0x171280){return db[_0x742b('0x12')][_0x742b('0x13')](_0x2a22eb['body'],{'raw':_0x2a22eb[_0x742b('0x14')]?_0x2a22eb[_0x742b('0x14')][_0x742b('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a22eb[_0x742b('0x14')]?_0x2a22eb[_0x742b('0x14')][_0x742b('0x16')]||null:null,'attributes':_0x2a22eb[_0x742b('0x14')]?_0x2a22eb[_0x742b('0x14')][_0x742b('0x17')]||null:null,'limit':_0x2a22eb[_0x742b('0x14')]?_0x2a22eb[_0x742b('0x14')][_0x742b('0x18')]||null:null})[_0x742b('0x8')](function(_0x46dfb2){logger[_0x742b('0x9')](_0x742b('0x11'),_0x2a22eb);logger[_0x742b('0x19')]('UpdateFaxApplication',_0x2a22eb,JSON[_0x742b('0x1a')](_0x46dfb2));_0x321871(_0x46dfb2);})[_0x742b('0x1b')](function(_0x4e46ab){logger[_0x742b('0xd')]('UpdateFaxApplication',_0x4e46ab[_0x742b('0xf')],_0x2a22eb);_0x171280(_0x8aaee['error'](0x1f4,_0x4e46ab['message']));});});}; \ No newline at end of file +var _0xb894=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateFaxApplication','update','options','where','limit','then','lodash','util','bluebird'];(function(_0x47c549,_0x23473b){var _0x2cc386=function(_0x4baab3){while(--_0x4baab3){_0x47c549['push'](_0x47c549['shift']());}};_0x2cc386(++_0x23473b);}(_0xb894,0xb3));var _0x4b89=function(_0x35d1c2,_0x25acb0){_0x35d1c2=_0x35d1c2-0x0;var _0x17a007=_0xb894[_0x35d1c2];return _0x17a007;};'use strict';var _=require(_0x4b89('0x0'));var util=require(_0x4b89('0x1'));var moment=require('moment');var BPromise=require(_0x4b89('0x2'));var rs=require(_0x4b89('0x3'));var fs=require('fs');var Redis=require(_0x4b89('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4b89('0x5'))(_0x4b89('0x6'));var config=require(_0x4b89('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4b89('0x8')][_0x4b89('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x126b8a,_0x4ed61b,_0x1160f0){return new BPromise(function(_0x428319,_0x43f530){return client['request'](_0x126b8a,_0x1160f0)['then'](function(_0xfe4715){logger[_0x4b89('0xa')](_0x4b89('0xb'),_0x4ed61b,_0x4b89('0xc'));logger[_0x4b89('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4ed61b,'request\x20sent',JSON[_0x4b89('0xe')](_0xfe4715));if(_0xfe4715['error']){if(_0xfe4715[_0x4b89('0xf')][_0x4b89('0x10')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4ed61b,_0xfe4715[_0x4b89('0xf')][_0x4b89('0x11')]);return _0x43f530(_0xfe4715['error'][_0x4b89('0x11')]);}logger[_0x4b89('0xf')]('FaxApplication,\x20%s,\x20%s',_0x4ed61b,_0xfe4715['error'][_0x4b89('0x11')]);return _0x428319(_0xfe4715[_0x4b89('0xf')][_0x4b89('0x11')]);}else{logger[_0x4b89('0xa')](_0x4b89('0xb'),_0x4ed61b,'request\x20sent');_0x428319(_0xfe4715[_0x4b89('0x12')]['message']);}})[_0x4b89('0x13')](function(_0xefdc0f){logger['error'](_0x4b89('0xb'),_0x4ed61b,_0xefdc0f);_0x43f530(_0xefdc0f);});});}exports[_0x4b89('0x14')]=function(_0x400b7c){var _0x55aa4b=this;return new Promise(function(_0x33db77,_0x30bf66){return db['FaxApplication'][_0x4b89('0x15')](_0x400b7c['body'],{'raw':_0x400b7c['options']?_0x400b7c[_0x4b89('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x400b7c[_0x4b89('0x16')]?_0x400b7c['options'][_0x4b89('0x17')]||null:null,'attributes':_0x400b7c[_0x4b89('0x16')]?_0x400b7c[_0x4b89('0x16')]['attributes']||null:null,'limit':_0x400b7c['options']?_0x400b7c[_0x4b89('0x16')][_0x4b89('0x18')]||null:null})[_0x4b89('0x19')](function(_0x1b46fe){logger[_0x4b89('0xa')](_0x4b89('0x14'),_0x400b7c);logger[_0x4b89('0xd')](_0x4b89('0x14'),_0x400b7c,JSON['stringify'](_0x1b46fe));_0x33db77(_0x1b46fe);})[_0x4b89('0x13')](function(_0x21ad53){logger['error'](_0x4b89('0x14'),_0x21ad53[_0x4b89('0x11')],_0x400b7c);_0x30bf66(_0x55aa4b['error'](0x1f4,_0x21ad53[_0x4b89('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index a5add0c..fb839df 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 _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x589248,_0x31dea3){var _0x486750=function(_0x3e7c21){while(--_0x3e7c21){_0x589248['push'](_0x589248['shift']());}};_0x486750(++_0x31dea3);}(_0x687b,0x14a));var _0xb687=function(_0x5df5e1,_0x3e0305){_0x5df5e1=_0x5df5e1-0x0;var _0x2fffd3=_0x687b[_0x5df5e1];return _0x2fffd3;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file +var _0xf2ca=['update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x58f28d,_0x34642e){var _0x685d1a=function(_0xc18e3b){while(--_0xc18e3b){_0x58f28d['push'](_0x58f28d['shift']());}};_0x685d1a(++_0x34642e);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0xf2ca[_0x223461];return _0x4dbe0a;};'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('0xe')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xf')]);router['put'](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0x10')]);router[_0xaf2c('0x11')](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 30400cb..c66a17b 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 _0x63df=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x40c5d2,_0xd2541c){var _0x2b36f4=function(_0x7efba8){while(--_0x7efba8){_0x40c5d2['push'](_0x40c5d2['shift']());}};_0x2b36f4(++_0xd2541c);}(_0x63df,0x112));var _0xf63d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x63df[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xf63d('0x0'));module[_0xf63d('0x1')]={'closed':{'type':Sequelize[_0xf63d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf63d('0x3')]},'disposition':{'type':Sequelize[_0xf63d('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf63d('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xf63d('0x5')]('in',_0xf63d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf63d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf63d('0x5')]('in',_0xf63d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x790a=['out','sequelize','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x790a,0x7f));var _0xa790=function(_0x9e19f7,_0x5ee087){_0x9e19f7=_0x9e19f7-0x0;var _0x5aa6f3=_0x790a[_0x9e19f7];return _0x5aa6f3;};'use strict';var Sequelize=require(_0xa790('0x0'));module['exports']={'closed':{'type':Sequelize[_0xa790('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa790('0x2')]},'disposition':{'type':Sequelize[_0xa790('0x3')]},'note':{'type':Sequelize[_0xa790('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xa790('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa790('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa790('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa790('0x4')]('in',_0xa790('0x5')),'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 f00acc0..338690a 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 _0xc4e1=['Tags','TagIds','split','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','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','buildExpression','compact','isEmpty','forEach','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','push','all','rows','catch','show','params','includeAll','include','merge','create','body','destroy','describe','ids','omit','getMessages','findOne','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','spread','emit','faxInteractionTags:save','download','join','server','files','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','send','Users','map'];(function(_0x4091da,_0x5740a4){var _0xa14d25=function(_0xa75e86){while(--_0xa75e86){_0x4091da['push'](_0x4091da['shift']());}};_0xa14d25(++_0x5740a4);}(_0xc4e1,0x172));var _0x1c4e=function(_0x17c30c,_0x1b410a){_0x17c30c=_0x17c30c-0x0;var _0x3e86c1=_0xc4e1[_0x17c30c];return _0x3e86c1;};'use strict';var pdf=require(_0x1c4e('0x0'));var emlformat=require(_0x1c4e('0x1'));var rimraf=require(_0x1c4e('0x2'));var zipdir=require(_0x1c4e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c4e('0x4'));var moment=require('moment');var BPromise=require(_0x1c4e('0x5'));var Mustache=require('mustache');var util=require(_0x1c4e('0x6'));var path=require('path');var sox=require(_0x1c4e('0x7'));var csv=require(_0x1c4e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c4e('0x9'));var squel=require(_0x1c4e('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c4e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1c4e('0xc'));var Papa=require('papaparse');var Redis=require(_0x1c4e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1c4e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c4e('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1c4e('0x10'));var db=require(_0x1c4e('0x11'))['db'];config[_0x1c4e('0x12')]=_['defaults'](config[_0x1c4e('0x12')],{'host':_0x1c4e('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0x1c4e('0x14')](socket);function respondWithStatusCode(_0x2b6459,_0x5889db){_0x5889db=_0x5889db||0xcc;return function(_0x9d8629){if(_0x9d8629){return _0x2b6459[_0x1c4e('0x15')](_0x5889db);}return _0x2b6459[_0x1c4e('0x16')](_0x5889db)[_0x1c4e('0x17')]();};}function respondWithResult(_0x2d55bb,_0x4b12b3){_0x4b12b3=_0x4b12b3||0xc8;return function(_0x17259a){if(_0x17259a){return _0x2d55bb[_0x1c4e('0x16')](_0x4b12b3)['json'](_0x17259a);}};}function respondWithFilteredResult(_0x4a5786,_0x572737){return function(_0x54ef20){if(_0x54ef20){var _0x285d65=_0x54ef20[_0x1c4e('0x18')],_0x3d980a=_0x572737[_0x1c4e('0x19')],_0x4faa6a=_0x572737[_0x1c4e('0x19')]+_0x572737[_0x1c4e('0x1a')],_0x17cb13;if(_0x4faa6a>=_0x285d65){_0x4faa6a=_0x285d65;_0x17cb13=0xc8;}else{_0x17cb13=0xce;}_0x4a5786[_0x1c4e('0x16')](_0x17cb13);return _0x4a5786[_0x1c4e('0x1b')](_0x1c4e('0x1c'),_0x3d980a+'-'+_0x4faa6a+'/'+_0x285d65)[_0x1c4e('0x1d')](_0x54ef20);}return null;};}function patchUpdates(_0x491fdb){return function(_0xadbff8){try{jsonpatch['apply'](_0xadbff8,_0x491fdb,!![]);}catch(_0x29b574){return BPromise[_0x1c4e('0x1e')](_0x29b574);}return _0xadbff8[_0x1c4e('0x1f')]();};}function saveUpdates(_0x1353e4,_0xb79c5){return function(_0x4d7871){if(_0x4d7871){return _0x4d7871[_0x1c4e('0x20')](_0x1353e4)[_0x1c4e('0x21')](function(_0x20f93d){return _0x20f93d;});}return null;};}function removeEntity(_0x41bbe6,_0x18ee91){return function(_0x179a2b){if(_0x179a2b){return _0x179a2b['destroy']()[_0x1c4e('0x21')](function(){_0x41bbe6[_0x1c4e('0x16')](0xcc)[_0x1c4e('0x17')]();});}};}function handleEntityNotFound(_0x1ec251,_0x2bf026){return function(_0x3a2c40){if(!_0x3a2c40){_0x1ec251['sendStatus'](0x194);}return _0x3a2c40;};}function handleError(_0x133b6a,_0x2e2d32){_0x2e2d32=_0x2e2d32||0x1f4;return function(_0x5925aa){logger[_0x1c4e('0x22')](_0x5925aa[_0x1c4e('0x23')]);if(_0x5925aa[_0x1c4e('0x24')]){delete _0x5925aa[_0x1c4e('0x24')];}_0x133b6a['status'](_0x2e2d32)[_0x1c4e('0x25')](_0x5925aa);};}function getInteractionUsers(_0xd843da,_0x2ae1d1){return new BPromise(function(_0x536e52,_0x111bec){try{if(_0x2ae1d1[_0xd843da['id']]){_0xd843da[_0x1c4e('0x26')]=_[_0x1c4e('0x27')](_0x2ae1d1[_0xd843da['id']],function(_0x1b354c){return{'id':_0x1b354c['id'],'fullname':_0x1b354c['fullname']};});}}catch(_0x31ed66){_0x111bec(_0x31ed66);}_0x536e52(_0xd843da);});}function getInteractionTags(_0x37f50b,_0x32eb93){return new BPromise(function(_0x1166c9,_0x5005a6){try{if(_0x37f50b['TagIds']){_0x37f50b[_0x1c4e('0x28')]=[];_0x37f50b[_0x1c4e('0x29')][_0x1c4e('0x2a')](',')['forEach'](function(_0x340268){_0x37f50b[_0x1c4e('0x28')]['push'](_0x32eb93[_0x340268]);});}delete _0x37f50b[_0x1c4e('0x29')];}catch(_0x404057){_0x5005a6(_0x404057);}_0x1166c9(_0x37f50b);});}function updateFaxInteraction(_0x2038f5,_0x1333eb,_0x216cf4){return new BPromise(function(_0x53da71,_0x212fe0){return getInteractionUsers(_0x2038f5,_0x216cf4)[_0x1c4e('0x21')](function(_0x1e2559){return getInteractionTags(_0x1e2559,_0x1333eb);})[_0x1c4e('0x21')](function(_0x28dc1f){_0x53da71(_0x28dc1f);})['catch'](function(_0xf09509){_0x212fe0(_0xf09509);});});}exports['index']=function(_0x1fff83,_0x2fd7ef){var _0x165fbb={},_0x18a038={},_0x2b386a={'count':0x0,'rows':[]};var _0x4bc375=_[_0x1c4e('0x27')](db[_0x1c4e('0x2b')][_0x1c4e('0x2c')],function(_0x8f6786){return{'name':_0x8f6786[_0x1c4e('0x2d')],'type':_0x8f6786[_0x1c4e('0x2e')][_0x1c4e('0x2f')]};});_0x18a038[_0x1c4e('0x30')]=_[_0x1c4e('0x27')](_0x4bc375,_0x1c4e('0x24'));_0x18a038[_0x1c4e('0x31')]=_[_0x1c4e('0x32')](_0x1fff83[_0x1c4e('0x31')]);_0x18a038['filters']=_[_0x1c4e('0x33')](_0x18a038[_0x1c4e('0x30')],_0x18a038[_0x1c4e('0x31')]);_0x165fbb[_0x1c4e('0x34')]=_[_0x1c4e('0x33')](_0x18a038['model'],qs[_0x1c4e('0x35')](_0x1fff83['query']['fields']));_0x165fbb[_0x1c4e('0x34')]=_0x165fbb['attributes'][_0x1c4e('0x36')]?_0x165fbb[_0x1c4e('0x34')]:_0x18a038['model'];if(!_0x1fff83['query'][_0x1c4e('0x37')](_0x1c4e('0x38'))){_0x165fbb[_0x1c4e('0x1a')]=qs[_0x1c4e('0x1a')](_0x1fff83['query']['limit']);_0x165fbb['offset']=qs['offset'](_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x19')]);}_0x165fbb[_0x1c4e('0x39')]=qs[_0x1c4e('0x3a')](_0x1fff83[_0x1c4e('0x31')]['sort']);_0x165fbb['where']=qs[_0x1c4e('0x3b')](_[_0x1c4e('0x3c')](_0x1fff83[_0x1c4e('0x31')],_0x18a038[_0x1c4e('0x3b')]),_0x4bc375);var _0x5179d9=[];var _0xb1102d=squel['select']()['field']('id')[_0x1c4e('0x3d')](_0x1c4e('0x24'))['field'](_0x1c4e('0x3e'))[_0x1c4e('0x3f')](_0x1c4e('0x40'));var _0x34a0f2=squel[_0x1c4e('0x41')]()['field'](_0x1c4e('0x42'))['field'](_0x1c4e('0x43'))['field'](_0x1c4e('0x44'))[_0x1c4e('0x3f')](_0x1c4e('0x45'),'ui')[_0x1c4e('0x46')](_0x1c4e('0x47'),'u',_0x1c4e('0x48'));var _0x2d9204=squel[_0x1c4e('0x41')]()[_0x1c4e('0x3f')](_0x1c4e('0x49'),'i')[_0x1c4e('0x46')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1c4e('0x46')]('users','o','o.id\x20=\x20i.UserId')[_0x1c4e('0x46')](_0x1c4e('0x4a'),'a',_0x1c4e('0x4b'))[_0x1c4e('0x46')](_0x1c4e('0x4c'),'me',_0x1c4e('0x4d'))[_0x1c4e('0x46')](_0x1c4e('0x4e'),'it',_0x1c4e('0x4f'))[_0x1c4e('0x46')](_0x1c4e('0x40'),'t','t.id\x20=\x20it.TagId');var _0x219b6b=squel[_0x1c4e('0x50')]();var _0x281ca7=[];var _0x3cc44f=squel[_0x1c4e('0x50')]();var _0x4169b7;if(_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x51')]){_0x4169b7=as['parseSearch'](_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x51')]);var _0x5a7d19=_0x4169b7[_0x1c4e('0x52')];for(var _0x36ad9d=0x0;_0x36ad9d<_0x4169b7[_0x1c4e('0x53')]['length'];_0x36ad9d++){var _0x5196aa=_0x4169b7['conditions'][_0x36ad9d];var _0x1a1d88='i';var _0x232bbe=_[_0x1c4e('0x54')](_0x4bc375,[_0x1c4e('0x24'),_0x5196aa['field']]);if(!_0x232bbe){switch(_0x5196aa['field']){case _0x1c4e('0x55'):if(_0x5196aa[_0x1c4e('0x56')]==0x1){_0x2d9204[_0x1c4e('0x57')]('`'+_0x5196aa['field']+_0x1c4e('0x58'));}else{_0x2d9204[_0x1c4e('0x57')]('`'+_0x5196aa[_0x1c4e('0x3d')]+_0x1c4e('0x59'));}break;case'Contact':if(_0x5196aa[_0x1c4e('0x5a')]===_0x1c4e('0x5b')){if(_0x5196aa[_0x1c4e('0x56')][_0x1c4e('0x2a')]('\x20')[_0x1c4e('0x36')]>0x1){_0x219b6b[_0x5a7d19](_0x1c4e('0x5c'),qs[_0x1c4e('0x5d')](_0x5196aa[_0x1c4e('0x56')]),null);}else{var _0x1fb50f='%'+_0x5196aa[_0x1c4e('0x56')]+'%';_0x219b6b[_0x5a7d19](_0x1c4e('0x5e'),_0x1fb50f,_0x1fb50f,_0x1fb50f);}}else{_0x232bbe=_[_0x1c4e('0x54')](_0x4bc375,['name',_0x1c4e('0x5f')]);_0x5196aa['field']=_0x1c4e('0x5f');_0x478384=as['buildExpression'](_0x1a1d88,_0x232bbe[_0x1c4e('0x2e')],_0x5196aa);_0x219b6b[_0x5a7d19](_0x478384[_0x1c4e('0x60')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x61')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x17')]);}break;case _0x1c4e('0x62'):var _0x3f75b0=_0x5196aa['value']['split'](',')[_0x1c4e('0x27')](function(_0x4e81a2){return Number(_0x4e81a2);});_0x3f75b0['forEach'](function(_0x7c6ee8){_0x3cc44f['or'](_0x1c4e('0x63'),'%,'+_0x7c6ee8+',%');});_0x281ca7=_[_0x1c4e('0x64')](_0x281ca7,_0x3f75b0);break;case _0x1c4e('0x65'):if(_0x5196aa[_0x1c4e('0x5a')]===_0x1c4e('0x5b')){_0x219b6b[_0x5a7d19](_0x1c4e('0x66'),'%'+_0x5196aa[_0x1c4e('0x56')]+'%',null);}else{_0x232bbe=_[_0x1c4e('0x54')](_0x4bc375,[_0x1c4e('0x24'),_0x1c4e('0x67')]);_0x5196aa[_0x1c4e('0x3d')]=_0x1c4e('0x67');_0x478384=as[_0x1c4e('0x68')](_0x1a1d88,_0x232bbe[_0x1c4e('0x2e')],_0x5196aa);_0x219b6b[_0x5a7d19](_0x478384[_0x1c4e('0x60')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x61')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x17')]);}break;case'body':_0x478384=as[_0x1c4e('0x68')]('me',null,_0x5196aa);_0x219b6b[_0x5a7d19](_0x478384[_0x1c4e('0x60')],_0x478384['value'][_0x1c4e('0x61')],_0x478384['value'][_0x1c4e('0x17')]);break;}}else{var _0x478384=as[_0x1c4e('0x68')](_0x1a1d88,_0x232bbe['type'],_0x5196aa);_0x219b6b[_0x5a7d19](_0x478384[_0x1c4e('0x60')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x61')],_0x478384[_0x1c4e('0x56')][_0x1c4e('0x17')]);}}}else{var _0x211ae2=_(_0x1fff83[_0x1c4e('0x31')])[_0x1c4e('0x32')]()[_0x1c4e('0x27')](function(_0x99d68e){return _['some'](_0x4bc375,['name',_0x99d68e])?_0x99d68e:undefined;})[_0x1c4e('0x69')]()['value']();if(!_[_0x1c4e('0x6a')](_0x211ae2)){_0x211ae2[_0x1c4e('0x6b')](function(_0x15dea5){if(_0x15dea5===_0x1c4e('0x6c')){_0x2d9204[_0x1c4e('0x6d')](_0x1c4e('0x6e'),[][_0x1c4e('0x6f')](_0x1fff83[_0x1c4e('0x31')][_0x15dea5]));}else if(_0x15dea5===_0x1c4e('0x70')){var _0x5a1e4d=JSON[_0x1c4e('0x71')](_0x1fff83[_0x1c4e('0x31')][_0x15dea5])[_0x1c4e('0x72')];var _0x594cc3=JSON[_0x1c4e('0x71')](_0x1fff83[_0x1c4e('0x31')][_0x15dea5])[_0x1c4e('0x73')];_0x2d9204[_0x1c4e('0x6d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5a1e4d,_0x594cc3);}else{if(_0x1fff83['query'][_0x15dea5]===_0x1c4e('0x74')){_0x2d9204['where']('i.'+_0x15dea5+_0x1c4e('0x75'));}else{_0x2d9204[_0x1c4e('0x6d')]('i.'+_0x15dea5+_0x1c4e('0x76'),_0x1fff83[_0x1c4e('0x31')][_0x15dea5]);}}});}if(_0x1fff83['query']['read']){if(_0x1fff83[_0x1c4e('0x31')]['read']==0x1){_0x2d9204[_0x1c4e('0x57')]('`unreadMessages`\x20=\x200');}else{_0x2d9204[_0x1c4e('0x57')]('`unreadMessages`\x20>\x200');}}if(_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x77')]){_0x281ca7=_[_0x1c4e('0x78')](_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x77')])?_0x1fff83[_0x1c4e('0x31')]['tag']:new Array(_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x77')]);_0x281ca7[_0x1c4e('0x6b')](function(_0x246390){_0x3cc44f['or'](_0x1c4e('0x63'),'%,'+_0x246390+',%');});}if(_0x1fff83['query'][_0x1c4e('0x79')]){var _0x456339=_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x79')]['replace']('\x5c','\x5c\x5c')[_0x1c4e('0x7a')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x1c4e('0x7b')](_0x456339)){_0x219b6b['or'](_0x1c4e('0x7c'),_0x456339+'%')['or']('i.fax\x20LIKE\x20?',_0x456339+'%');}_0x219b6b['or'](_0x1c4e('0x7d'),_0x456339+'%');}}_0x2d9204[_0x1c4e('0x6d')](_0x219b6b);_0x2d9204[_0x1c4e('0x7e')](_0x1c4e('0x7f'));var _0x56274a={'type':db[_0x1c4e('0x80')][_0x1c4e('0x81')][_0x1c4e('0x82')],'raw':!![]};var _0x920730=_0x2d9204[_0x1c4e('0x83')]();_0x920730[_0x1c4e('0x3d')](_0x1c4e('0x7f'));_0x920730[_0x1c4e('0x3d')](_0x1c4e('0x84'),_0x1c4e('0x55'));if(_0x165fbb['order']){_0x165fbb[_0x1c4e('0x39')][_0x1c4e('0x6b')](function(_0x49f6b4){_0x2d9204[_0x1c4e('0x39')]('i.'+_0x49f6b4[0x0],_0x49f6b4[0x1]===_0x1c4e('0x85')?![]:!![]);});}if(!_[_0x1c4e('0x6a')](_0x281ca7)){_0x2d9204[_0x1c4e('0x57')](_0x3cc44f);_0x920730[_0x1c4e('0x6d')](_0x1c4e('0x86'),_0x281ca7);}BPromise[_0x1c4e('0x87')]()[_0x1c4e('0x21')](function(){if(!_0x4169b7){if(_0x1fff83[_0x1c4e('0x31')]['FaxAccountId']||_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x88')])return;_0x920730[_0x1c4e('0x6d')](_0x1c4e('0x89'));_0x2d9204['where'](_0x1c4e('0x89'));return;}return _0x1fff83[_0x1c4e('0x8a')][_0x1c4e('0x8b')]({'attributes':['id'],'raw':!![]})[_0x1c4e('0x21')](function(_0x3575b5){if(_[_0x1c4e('0x6a')](_0x3575b5)){_0x920730['where']('i.FaxAccountId\x20IS\x20NULL');_0x2d9204['where'](_0x1c4e('0x8c'));}else{_0x920730[_0x1c4e('0x6d')](_0x1c4e('0x6e'),_[_0x1c4e('0x27')](_0x3575b5,'id'));_0x2d9204[_0x1c4e('0x6d')](_0x1c4e('0x6e'),_[_0x1c4e('0x27')](_0x3575b5,'id'));}});})[_0x1c4e('0x21')](function(){db[_0x1c4e('0x8d')][_0x1c4e('0x31')](_0x920730[_0x1c4e('0x8e')](),_0x56274a)['then'](function(_0x46d6c5){_0x2b386a[_0x1c4e('0x18')]=_0x46d6c5['length'];if(_0x2b386a['count']===0x0)return[];return db['sequelize'][_0x1c4e('0x31')](_0xb1102d[_0x1c4e('0x8e')](),_0x56274a)[_0x1c4e('0x21')](function(_0xf23e50){_0x5179d9=_[_0x1c4e('0x8f')](_0xf23e50,'id');_0x56274a=_['merge'](_0x56274a,{'model':db[_0x1c4e('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1fff83[_0x1c4e('0x31')][_0x1c4e('0x35')]){_0x165fbb[_0x1c4e('0x34')]['forEach'](function(_0x378c0f){_0x2d9204[_0x1c4e('0x3d')]('i.'+_0x378c0f);});}else{_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x84'),'unreadMessages');_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x90'),'Account.key');_0x2d9204['field'](_0x1c4e('0x91'),_0x1c4e('0x92'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x93'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x94'),'Contact.firstName');_0x2d9204[_0x1c4e('0x3d')]('c.lastName','Contact.lastName');_0x2d9204['field'](_0x1c4e('0x95'),'Contact.email');_0x2d9204[_0x1c4e('0x3d')]('c.phone',_0x1c4e('0x96'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x97'),'Contact.mobile');_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x98'),_0x1c4e('0x99'));_0x2d9204['field'](_0x1c4e('0x9a'),_0x1c4e('0x9b'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x9c'),_0x1c4e('0x9d'));_0x2d9204[_0x1c4e('0x3d')](_0x1c4e('0x9e'),_0x1c4e('0x29'));}if(_0x165fbb[_0x1c4e('0x1a')])_0x2d9204[_0x1c4e('0x1a')](_0x165fbb[_0x1c4e('0x1a')]);if(_0x165fbb[_0x1c4e('0x19')])_0x2d9204[_0x1c4e('0x19')](_0x165fbb[_0x1c4e('0x19')]);return db[_0x1c4e('0x8d')][_0x1c4e('0x31')](_0x2d9204[_0x1c4e('0x8e')](),_0x56274a);})[_0x1c4e('0x21')](function(_0x5b94e9){_0x34a0f2[_0x1c4e('0x6d')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x5b94e9,'id'));return db[_0x1c4e('0x8d')]['query'](_0x34a0f2[_0x1c4e('0x8e')](),_0x56274a)[_0x1c4e('0x21')](function(_0x5a1474){var _0x431dff=_['groupBy'](_0x5a1474,_0x1c4e('0x9f'));var _0x2aac85=[];_0x5b94e9[_0x1c4e('0x6b')](function(_0x2e8b07){_0x2aac85[_0x1c4e('0xa0')](updateFaxInteraction(_0x2e8b07,_0x5179d9,_0x431dff));});return BPromise[_0x1c4e('0xa1')](_0x2aac85);});});})['then'](function(_0x4c0b7f){_0x2b386a[_0x1c4e('0xa2')]=_0x4c0b7f;return _0x2b386a;})['then'](respondWithFilteredResult(_0x2fd7ef,_0x165fbb));})[_0x1c4e('0xa3')](handleError(_0x2fd7ef,null));};exports[_0x1c4e('0xa4')]=function(_0x1fee23,_0x1f3979){var _0x1a40ff={'raw':![],'where':{'id':_0x1fee23[_0x1c4e('0xa5')]['id']}},_0xae06cf={};_0xae06cf[_0x1c4e('0x30')]=_[_0x1c4e('0x32')](db[_0x1c4e('0x2b')][_0x1c4e('0x2c')]);_0xae06cf[_0x1c4e('0x31')]=_['keys'](_0x1fee23[_0x1c4e('0x31')]);_0xae06cf[_0x1c4e('0x3b')]=_['intersection'](_0xae06cf[_0x1c4e('0x30')],_0xae06cf[_0x1c4e('0x31')]);_0x1a40ff[_0x1c4e('0x34')]=_['intersection'](_0xae06cf[_0x1c4e('0x30')],qs[_0x1c4e('0x35')](_0x1fee23[_0x1c4e('0x31')][_0x1c4e('0x35')]));_0x1a40ff['attributes']=_0x1a40ff[_0x1c4e('0x34')][_0x1c4e('0x36')]?_0x1a40ff[_0x1c4e('0x34')]:_0xae06cf[_0x1c4e('0x30')];if(_0x1fee23[_0x1c4e('0x31')][_0x1c4e('0xa6')]){_0x1a40ff[_0x1c4e('0xa7')]=[{'all':!![]}];}_0x1a40ff=_[_0x1c4e('0xa8')]({},_0x1a40ff,_0x1fee23['options']);return db[_0x1c4e('0x2b')][_0x1c4e('0x54')](_0x1a40ff)[_0x1c4e('0x21')](handleEntityNotFound(_0x1f3979,null))[_0x1c4e('0x21')](respondWithResult(_0x1f3979,null))['catch'](handleError(_0x1f3979,null));};exports['create']=function(_0x459c01,_0x3cd41d){return db[_0x1c4e('0x2b')][_0x1c4e('0xa9')](_0x459c01[_0x1c4e('0xaa')],{})[_0x1c4e('0x21')](respondWithResult(_0x3cd41d,0xc9))[_0x1c4e('0xa3')](handleError(_0x3cd41d,null));};exports[_0x1c4e('0x20')]=function(_0x1a2833,_0x3cba43){if(_0x1a2833[_0x1c4e('0xaa')]['id']){delete _0x1a2833[_0x1c4e('0xaa')]['id'];}return db[_0x1c4e('0x2b')][_0x1c4e('0x54')]({'where':{'id':_0x1a2833[_0x1c4e('0xa5')]['id']}})['then'](handleEntityNotFound(_0x3cba43,null))['then'](saveUpdates(_0x1a2833[_0x1c4e('0xaa')],null))[_0x1c4e('0x21')](respondWithResult(_0x3cba43,null))[_0x1c4e('0xa3')](handleError(_0x3cba43,null));};exports[_0x1c4e('0xab')]=function(_0x453ad7,_0x3aa67f){return db[_0x1c4e('0x2b')][_0x1c4e('0x54')]({'where':{'id':_0x453ad7[_0x1c4e('0xa5')]['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x3aa67f,null))['then'](removeEntity(_0x3aa67f,null))[_0x1c4e('0xa3')](handleError(_0x3aa67f,null));};exports[_0x1c4e('0xac')]=function(_0x44c61c,_0x7c1b34){return db[_0x1c4e('0x2b')]['describe']()[_0x1c4e('0x21')](respondWithResult(_0x7c1b34,null))[_0x1c4e('0xa3')](handleError(_0x7c1b34,null));};exports['addMessage']=function(_0x308658,_0x27223b,_0xfe2df4){return db['FaxMessage'][_0x1c4e('0x54')]({'where':{'id':_0x308658[_0x1c4e('0xa5')]['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x27223b,null))[_0x1c4e('0x21')](function(_0x1d14f3){if(_0x1d14f3){return _0x1d14f3['addMessage'](_0x308658['body'][_0x1c4e('0xad')],_[_0x1c4e('0xae')](_0x308658['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x27223b,null))[_0x1c4e('0xa3')](handleError(_0x27223b,null));};exports[_0x1c4e('0xaf')]=function(_0x2c680f,_0x4672b3,_0x1e3fb){var _0x2c50c5={'raw':![],'where':{}};var _0xf07fa7={};var _0x5055db={'count':0x0,'rows':[]};return db[_0x1c4e('0x2b')][_0x1c4e('0xb0')]({'where':{'id':_0x2c680f[_0x1c4e('0xa5')]['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x4672b3,null))[_0x1c4e('0x21')](function(_0xd535f9){if(_0xd535f9){_0xf07fa7[_0x1c4e('0x30')]=_[_0x1c4e('0x32')](db[_0x1c4e('0xb1')][_0x1c4e('0x2c')]);_0xf07fa7[_0x1c4e('0x31')]=_[_0x1c4e('0x32')](_0x2c680f[_0x1c4e('0x31')]);_0xf07fa7[_0x1c4e('0x3b')]=_[_0x1c4e('0x33')](_0xf07fa7[_0x1c4e('0x30')],_0xf07fa7[_0x1c4e('0x31')]);_0x2c50c5[_0x1c4e('0x34')]=_['intersection'](_0xf07fa7[_0x1c4e('0x30')],qs['fields'](_0x2c680f[_0x1c4e('0x31')][_0x1c4e('0x35')]));_0x2c50c5[_0x1c4e('0x34')]=_0x2c50c5[_0x1c4e('0x34')][_0x1c4e('0x36')]?_0x2c50c5[_0x1c4e('0x34')]:_0xf07fa7['model'];if(!_0x2c680f[_0x1c4e('0x31')]['hasOwnProperty'](_0x1c4e('0x38'))){_0x2c50c5['limit']=qs[_0x1c4e('0x1a')](_0x2c680f['query'][_0x1c4e('0x1a')]);_0x2c50c5[_0x1c4e('0x19')]=qs[_0x1c4e('0x19')](_0x2c680f[_0x1c4e('0x31')]['offset']);}_0x2c50c5['order']=qs[_0x1c4e('0x3a')](_0x2c680f[_0x1c4e('0x31')][_0x1c4e('0x3a')]);_0x2c50c5[_0x1c4e('0x6d')]=qs[_0x1c4e('0x3b')](_[_0x1c4e('0x3c')](_0x2c680f[_0x1c4e('0x31')],_0xf07fa7[_0x1c4e('0x3b')]));_0x2c50c5[_0x1c4e('0x6d')][_0x1c4e('0x9f')]=_0xd535f9['id'];if(_0x2c680f['query'][_0x1c4e('0x79')]){_0x2c50c5['where']=_[_0x1c4e('0xa8')](_0x2c50c5['where'],{'$or':_[_0x1c4e('0x27')](_0x2c50c5[_0x1c4e('0x34')],function(_0x2644cf){var _0x42ed1d={};_0x42ed1d[_0x2644cf]={'$like':'%'+_0x2c680f[_0x1c4e('0x31')][_0x1c4e('0x79')]+'%'};return _0x42ed1d;})});}if(_0x2c680f['query'][_0x1c4e('0x72')]){var _0x1faeee=_0x2c680f[_0x1c4e('0x31')][_0x1c4e('0x72')][_0x1c4e('0x2a')](',');var _0x3aa357={};_0x3aa357[_0x1faeee[0x0]]={'$gte':moment(_0x1faeee[0x1])[_0x1c4e('0xb2')](_0x1c4e('0xb3'))};_0x2c50c5[_0x1c4e('0x6d')]=_[_0x1c4e('0xa8')](_0x2c50c5[_0x1c4e('0x6d')],_0x3aa357);}_0x2c50c5=_[_0x1c4e('0xa8')]({},_0x2c50c5,_0x2c680f[_0x1c4e('0xb4')]);return db['FaxMessage'][_0x1c4e('0x18')]({'where':_0x2c50c5[_0x1c4e('0x6d')]})['then'](function(_0x241aa8){_0x5055db[_0x1c4e('0x18')]=_0x241aa8;if(_0x2c680f['query'][_0x1c4e('0xa6')]){_0x2c50c5[_0x1c4e('0xa7')]=[{'all':!![]}];}return db[_0x1c4e('0xb1')][_0x1c4e('0xb5')](_0x2c50c5);})['then'](function(_0x5bb92b){_0x5055db[_0x1c4e('0xa2')]=_0x5bb92b;return _0x5055db;});}})['then'](respondWithFilteredResult(_0x4672b3,_0x2c50c5))[_0x1c4e('0xa3')](handleError(_0x4672b3,null));};exports['addTags']=function(_0x4284d6,_0x423847,_0x1036ab){return db['FaxInteraction'][_0x1c4e('0x54')]({'where':{'id':_0x4284d6['params']['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x423847,null))[_0x1c4e('0x21')](function(_0x4b76ad){if(_0x4b76ad){return _0x4b76ad[_0x1c4e('0xb6')](_0x4284d6[_0x1c4e('0xaa')][_0x1c4e('0xad')],_[_0x1c4e('0xae')](_0x4284d6[_0x1c4e('0xaa')],[_0x1c4e('0xad'),'id'])||{})[_0x1c4e('0xb7')](function(){return db[_0x1c4e('0x62')][_0x1c4e('0xb5')]({'attributes':['id',_0x1c4e('0x24'),'color'],'where':{'id':_0x4284d6[_0x1c4e('0xaa')][_0x1c4e('0xad')]}});})[_0x1c4e('0x21')](function(_0x4a87da){socket[_0x1c4e('0xb8')](_0x1c4e('0xb9'),{'id':Number(_0x4284d6[_0x1c4e('0xa5')]['id']),'tags':_0x4a87da||[]});return{'id':Number(_0x4284d6[_0x1c4e('0xa5')]['id']),'tags':_0x4a87da||[]};});}})[_0x1c4e('0x21')](respondWithResult(_0x423847,null))[_0x1c4e('0xa3')](handleError(_0x423847,null));};exports['removeTags']=function(_0xb0a185,_0x124745,_0x5f5c18){return db[_0x1c4e('0x2b')]['find']({'where':{'id':_0xb0a185[_0x1c4e('0xa5')]['id']}})[_0x1c4e('0x21')](handleEntityNotFound(_0x124745,null))[_0x1c4e('0x21')](function(_0x2eafae){if(_0x2eafae){return _0x2eafae['removeTags'](_0xb0a185[_0x1c4e('0x31')][_0x1c4e('0xad')]);}})[_0x1c4e('0x21')](respondWithStatusCode(_0x124745,null))[_0x1c4e('0xa3')](handleError(_0x124745,null));};exports[_0x1c4e('0xba')]=function(_0x414aa1,_0x5f4853){var _0x362d02=moment()['unix']()[_0x1c4e('0x8e')]();var _0x58d032=path[_0x1c4e('0xbb')](config['root'],_0x1c4e('0xbc'),_0x1c4e('0xbd'),'tmp');var _0x3dc7af=path['join'](config[_0x1c4e('0xbe')],'server',_0x1c4e('0xbd'),_0x1c4e('0xbf'));var _0x56714b=path['join'](_0x58d032,_0x362d02);var _0x4407ea=util['format'](_0x1c4e('0xc0'),_0x414aa1['params']['id'],_0x362d02);var _0x3bb03b=path[_0x1c4e('0xbb')](_0x58d032,_0x4407ea);var _0xf5a67a=[];_0xf5a67a[_0x1c4e('0xa0')]({'model':db['Attachment'],'as':_0x1c4e('0xc1'),'raw':!![]});var _0xd0959e=[{'model':db[_0x1c4e('0xb1')],'as':_0x1c4e('0xc2'),'attributes':['id','body',_0x1c4e('0x70')],'include':_0xf5a67a}];return db[_0x1c4e('0x2b')]['find']({'where':{'id':_0x414aa1[_0x1c4e('0xa5')]['id']},'include':_0xd0959e})[_0x1c4e('0x21')](handleEntityNotFound(_0x5f4853,null))[_0x1c4e('0x21')](function(_0x1055c0){if(_0x1055c0&&_0x1055c0[_0x1c4e('0xc2')]){var _0x2bbde2=_0x1055c0[_0x1c4e('0xc3')]({'plain':!![]});fs[_0x1c4e('0xc4')](_0x56714b);for(var _0x379412=0x0;_0x379412<_0x2bbde2[_0x1c4e('0xc2')]['length'];_0x379412++){var _0x1ad353=_0x2bbde2[_0x1c4e('0xc2')][_0x379412][_0x1c4e('0xc1')];if(_0x1ad353){var _0x41b1d8=path[_0x1c4e('0xbb')](_0x3dc7af,_0x1ad353[_0x1c4e('0xc5')]);if(fs[_0x1c4e('0xc6')](_0x41b1d8)){fs[_0x1c4e('0xc7')](_0x41b1d8)[_0x1c4e('0xc8')](fs[_0x1c4e('0xc9')](path['join'](_0x56714b,_0x1ad353[_0x1c4e('0xc5')])));}}}return BPromise[_0x1c4e('0x87')]()[_0x1c4e('0x21')](function(){return new BPromise(function(_0x309e8e,_0x148a3b){zipdir(_0x56714b,{'saveTo':_0x3bb03b},function(_0x218da1,_0x50b834){if(_0x218da1)return _0x148a3b(_0x218da1);return _0x309e8e(_0x50b834);});})[_0x1c4e('0x21')](function(){return new BPromise(function(_0x149230,_0x545959){rimraf(_0x56714b,function(_0x3a345a){if(_0x3a345a)_0x545959(_0x3a345a);return _0x149230();});});})['then'](function(){return _0x5f4853[_0x1c4e('0xba')](_0x3bb03b,_0x4407ea,function(_0x79b39d){if(_0x79b39d){console[_0x1c4e('0xca')](_0x1c4e('0xcb'),_0x79b39d);}else{fs[_0x1c4e('0xcc')](_0x3bb03b);}});});});}else{return _0x5f4853[_0x1c4e('0x15')](0xc8);}})[_0x1c4e('0xa3')](handleError(_0x5f4853,null));}; \ No newline at end of file +var _0x4227=['u.id\x20=\x20ui.UserId','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','body','some','compact','isEmpty','FaxAccountId','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`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?','group','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','catch','show','rawAttributes','include','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','pipe','basename','log','unlinkSync','html-pdf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./faxInteraction.socket','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','FaxInteraction','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_fax_interactions','users'];(function(_0x494376,_0x1c77a2){var _0x9fd443=function(_0xea6c32){while(--_0xea6c32){_0x494376['push'](_0x494376['shift']());}};_0x9fd443(++_0x1c77a2);}(_0x4227,0x89));var _0x7422=function(_0x521019,_0x371e24){_0x521019=_0x521019-0x0;var _0x3b496e=_0x4227[_0x521019];return _0x3b496e;};'use strict';var pdf=require(_0x7422('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7422('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7422('0x2'));var moment=require(_0x7422('0x3'));var BPromise=require(_0x7422('0x4'));var Mustache=require('mustache');var util=require(_0x7422('0x5'));var path=require(_0x7422('0x6'));var sox=require(_0x7422('0x7'));var csv=require(_0x7422('0x8'));var ejs=require(_0x7422('0x9'));var fs=require('fs');var _=require(_0x7422('0xa'));var squel=require(_0x7422('0xb'));var crypto=require(_0x7422('0xc'));var jsforce=require(_0x7422('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7422('0x8'));var querystring=require(_0x7422('0xe'));var Papa=require(_0x7422('0xf'));var Redis=require('ioredis');var authService=require(_0x7422('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7422('0x11'));var hardwareService=require(_0x7422('0x12'));var logger=require(_0x7422('0x13'))(_0x7422('0x14'));var utils=require(_0x7422('0x15'));var config=require('../../config/environment');var db=require(_0x7422('0x16'))['db'];config[_0x7422('0x17')]=_['defaults'](config[_0x7422('0x17')],{'host':_0x7422('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7422('0x17')]));require(_0x7422('0x19'))['register'](socket);function respondWithStatusCode(_0x4d3f91,_0xeafd58){_0xeafd58=_0xeafd58||0xcc;return function(_0x4ca0e4){if(_0x4ca0e4){return _0x4d3f91[_0x7422('0x1a')](_0xeafd58);}return _0x4d3f91[_0x7422('0x1b')](_0xeafd58)['end']();};}function respondWithResult(_0x149c50,_0x39c31c){_0x39c31c=_0x39c31c||0xc8;return function(_0x31c3ec){if(_0x31c3ec){return _0x149c50[_0x7422('0x1b')](_0x39c31c)[_0x7422('0x1c')](_0x31c3ec);}};}function respondWithFilteredResult(_0x25401d,_0x4e2b60){return function(_0x21d4b9){if(_0x21d4b9){var _0xa7ff41=_0x21d4b9[_0x7422('0x1d')],_0x493f59=_0x4e2b60['offset'],_0x30656d=_0x4e2b60[_0x7422('0x1e')]+_0x4e2b60[_0x7422('0x1f')],_0x57b8bf;if(_0x30656d>=_0xa7ff41){_0x30656d=_0xa7ff41;_0x57b8bf=0xc8;}else{_0x57b8bf=0xce;}_0x25401d[_0x7422('0x1b')](_0x57b8bf);return _0x25401d['set'](_0x7422('0x20'),_0x493f59+'-'+_0x30656d+'/'+_0xa7ff41)[_0x7422('0x1c')](_0x21d4b9);}return null;};}function patchUpdates(_0x368e96){return function(_0x3eb555){try{jsonpatch['apply'](_0x3eb555,_0x368e96,!![]);}catch(_0x58e617){return BPromise[_0x7422('0x21')](_0x58e617);}return _0x3eb555[_0x7422('0x22')]();};}function saveUpdates(_0x20c1e3,_0x7d34f2){return function(_0x71d28c){if(_0x71d28c){return _0x71d28c[_0x7422('0x23')](_0x20c1e3)[_0x7422('0x24')](function(_0x596b89){return _0x596b89;});}return null;};}function removeEntity(_0x24ce62,_0x46b927){return function(_0x4fc200){if(_0x4fc200){return _0x4fc200[_0x7422('0x25')]()[_0x7422('0x24')](function(){_0x24ce62[_0x7422('0x1b')](0xcc)[_0x7422('0x26')]();});}};}function handleEntityNotFound(_0x5436a4,_0x3f579a){return function(_0x2eed9f){if(!_0x2eed9f){_0x5436a4[_0x7422('0x1a')](0x194);}return _0x2eed9f;};}function handleError(_0x2dd10f,_0x3438d1){_0x3438d1=_0x3438d1||0x1f4;return function(_0x5e997b){logger[_0x7422('0x27')](_0x5e997b[_0x7422('0x28')]);if(_0x5e997b[_0x7422('0x29')]){delete _0x5e997b[_0x7422('0x29')];}_0x2dd10f['status'](_0x3438d1)[_0x7422('0x2a')](_0x5e997b);};}function getInteractionUsers(_0x20f71e,_0x9b0144){return new BPromise(function(_0x702aef,_0x59bc52){try{if(_0x9b0144[_0x20f71e['id']]){_0x20f71e[_0x7422('0x2b')]=_[_0x7422('0x2c')](_0x9b0144[_0x20f71e['id']],function(_0x5be605){return{'id':_0x5be605['id'],'fullname':_0x5be605['fullname']};});}}catch(_0x2baac6){_0x59bc52(_0x2baac6);}_0x702aef(_0x20f71e);});}function getInteractionTags(_0x2fb125,_0x5e08f7){return new BPromise(function(_0x1d5ae5,_0x194a5e){try{if(_0x2fb125[_0x7422('0x2d')]){_0x2fb125[_0x7422('0x2e')]=[];_0x2fb125[_0x7422('0x2d')][_0x7422('0x2f')](',')[_0x7422('0x30')](function(_0xa9d41){_0x2fb125[_0x7422('0x2e')][_0x7422('0x31')](_0x5e08f7[_0xa9d41]);});}delete _0x2fb125[_0x7422('0x2d')];}catch(_0x47e57b){_0x194a5e(_0x47e57b);}_0x1d5ae5(_0x2fb125);});}function updateFaxInteraction(_0x50c794,_0x3d0fb9,_0x22327f){return new BPromise(function(_0x1eff48,_0x4c4984){return getInteractionUsers(_0x50c794,_0x22327f)[_0x7422('0x24')](function(_0x339b85){return getInteractionTags(_0x339b85,_0x3d0fb9);})[_0x7422('0x24')](function(_0x58d9fe){_0x1eff48(_0x58d9fe);})['catch'](function(_0x1fe00d){_0x4c4984(_0x1fe00d);});});}exports['index']=function(_0x234c12,_0x55c622){var _0x18b594={},_0x57d732={},_0x45e26d={'count':0x0,'rows':[]};var _0x566d99=_['map'](db[_0x7422('0x32')]['rawAttributes'],function(_0x37da42){return{'name':_0x37da42[_0x7422('0x33')],'type':_0x37da42[_0x7422('0x34')][_0x7422('0x35')]};});_0x57d732[_0x7422('0x36')]=_[_0x7422('0x2c')](_0x566d99,_0x7422('0x29'));_0x57d732['query']=_[_0x7422('0x37')](_0x234c12[_0x7422('0x38')]);_0x57d732[_0x7422('0x39')]=_[_0x7422('0x3a')](_0x57d732[_0x7422('0x36')],_0x57d732['query']);_0x18b594[_0x7422('0x3b')]=_[_0x7422('0x3a')](_0x57d732['model'],qs[_0x7422('0x3c')](_0x234c12['query'][_0x7422('0x3c')]));_0x18b594['attributes']=_0x18b594['attributes'][_0x7422('0x3d')]?_0x18b594[_0x7422('0x3b')]:_0x57d732[_0x7422('0x36')];if(!_0x234c12['query'][_0x7422('0x3e')](_0x7422('0x3f'))){_0x18b594['limit']=qs[_0x7422('0x1f')](_0x234c12['query'][_0x7422('0x1f')]);_0x18b594[_0x7422('0x1e')]=qs[_0x7422('0x1e')](_0x234c12[_0x7422('0x38')][_0x7422('0x1e')]);}_0x18b594[_0x7422('0x40')]=qs[_0x7422('0x41')](_0x234c12['query'][_0x7422('0x41')]);_0x18b594[_0x7422('0x42')]=qs['filters'](_[_0x7422('0x43')](_0x234c12[_0x7422('0x38')],_0x57d732['filters']),_0x566d99);var _0xca1546=[];var _0x4e2cd4=squel[_0x7422('0x44')]()['field']('id')[_0x7422('0x45')](_0x7422('0x29'))[_0x7422('0x45')](_0x7422('0x46'))[_0x7422('0x47')](_0x7422('0x48'));var _0x40c1dd=squel[_0x7422('0x44')]()[_0x7422('0x45')](_0x7422('0x49'))['field'](_0x7422('0x4a'))['field']('ui.FaxInteractionId')[_0x7422('0x47')](_0x7422('0x4b'),'ui')['left_join'](_0x7422('0x4c'),'u',_0x7422('0x4d'));var _0x1d09e9=squel[_0x7422('0x44')]()[_0x7422('0x47')](_0x7422('0x4e'),'i')[_0x7422('0x4f')]('cm_contacts','c',_0x7422('0x50'))[_0x7422('0x4f')](_0x7422('0x4c'),'o',_0x7422('0x51'))['left_join'](_0x7422('0x52'),'a',_0x7422('0x53'))[_0x7422('0x4f')]('fax_messages','me',_0x7422('0x54'))[_0x7422('0x4f')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x7422('0x48'),'t',_0x7422('0x55'));var _0x5b4694=squel[_0x7422('0x56')]();var _0x50e9bb=[];var _0x546828=squel[_0x7422('0x56')]();var _0x2986ec;if(_0x234c12[_0x7422('0x38')]['search']){_0x2986ec=as['parseSearch'](_0x234c12[_0x7422('0x38')][_0x7422('0x57')]);var _0x58e670=_0x2986ec[_0x7422('0x58')];for(var _0x2fbe91=0x0;_0x2fbe91<_0x2986ec['conditions'][_0x7422('0x3d')];_0x2fbe91++){var _0x17de3f=_0x2986ec[_0x7422('0x59')][_0x2fbe91];var _0x3c738c='i';var _0x3dbe87=_[_0x7422('0x5a')](_0x566d99,[_0x7422('0x29'),_0x17de3f[_0x7422('0x45')]]);if(!_0x3dbe87){switch(_0x17de3f[_0x7422('0x45')]){case _0x7422('0x5b'):if(_0x17de3f['value']==0x1){_0x1d09e9[_0x7422('0x5c')]('`'+_0x17de3f[_0x7422('0x45')]+_0x7422('0x5d'));}else{_0x1d09e9['having']('`'+_0x17de3f[_0x7422('0x45')]+_0x7422('0x5e'));}break;case _0x7422('0x5f'):if(_0x17de3f[_0x7422('0x60')]===_0x7422('0x61')){if(_0x17de3f[_0x7422('0x62')]['split']('\x20')[_0x7422('0x3d')]>0x1){_0x5b4694[_0x58e670](_0x7422('0x63'),qs[_0x7422('0x64')](_0x17de3f[_0x7422('0x62')]),null);}else{var _0x309daf='%'+_0x17de3f[_0x7422('0x62')]+'%';_0x5b4694[_0x58e670](_0x7422('0x65'),_0x309daf,_0x309daf,_0x309daf);}}else{_0x3dbe87=_['find'](_0x566d99,[_0x7422('0x29'),'ContactId']);_0x17de3f['field']=_0x7422('0x66');_0x529c48=as['buildExpression'](_0x3c738c,_0x3dbe87[_0x7422('0x34')],_0x17de3f);_0x5b4694[_0x58e670](_0x529c48[_0x7422('0x67')],_0x529c48[_0x7422('0x62')]['start'],_0x529c48[_0x7422('0x62')][_0x7422('0x26')]);}break;case _0x7422('0x68'):var _0x1e5475=_0x17de3f['value']['split'](',')[_0x7422('0x2c')](function(_0x2162f6){return Number(_0x2162f6);});_0x1e5475['forEach'](function(_0x5e8802){_0x546828['or'](_0x7422('0x69'),'%,'+_0x5e8802+',%');});_0x50e9bb=_[_0x7422('0x6a')](_0x50e9bb,_0x1e5475);break;case _0x7422('0x6b'):if(_0x17de3f[_0x7422('0x60')]===_0x7422('0x61')){_0x5b4694[_0x58e670](_0x7422('0x6c'),'%'+_0x17de3f[_0x7422('0x62')]+'%',null);}else{_0x3dbe87=_[_0x7422('0x5a')](_0x566d99,[_0x7422('0x29'),_0x7422('0x6d')]);_0x17de3f['field']=_0x7422('0x6d');_0x529c48=as[_0x7422('0x6e')](_0x3c738c,_0x3dbe87[_0x7422('0x34')],_0x17de3f);_0x5b4694[_0x58e670](_0x529c48[_0x7422('0x67')],_0x529c48[_0x7422('0x62')][_0x7422('0x6f')],_0x529c48['value'][_0x7422('0x26')]);}break;case _0x7422('0x70'):_0x529c48=as[_0x7422('0x6e')]('me',null,_0x17de3f);_0x5b4694[_0x58e670](_0x529c48[_0x7422('0x67')],_0x529c48[_0x7422('0x62')][_0x7422('0x6f')],_0x529c48[_0x7422('0x62')][_0x7422('0x26')]);break;}}else{var _0x529c48=as['buildExpression'](_0x3c738c,_0x3dbe87[_0x7422('0x34')],_0x17de3f);_0x5b4694[_0x58e670](_0x529c48[_0x7422('0x67')],_0x529c48[_0x7422('0x62')]['start'],_0x529c48[_0x7422('0x62')]['end']);}}}else{var _0x502711=_(_0x234c12[_0x7422('0x38')])['keys']()[_0x7422('0x2c')](function(_0x216869){return _[_0x7422('0x71')](_0x566d99,[_0x7422('0x29'),_0x216869])?_0x216869:undefined;})[_0x7422('0x72')]()[_0x7422('0x62')]();if(!_[_0x7422('0x73')](_0x502711)){_0x502711[_0x7422('0x30')](function(_0x20d329){if(_0x20d329===_0x7422('0x74')){_0x1d09e9[_0x7422('0x42')]('i.FaxAccountId\x20IN\x20?',[][_0x7422('0x75')](_0x234c12[_0x7422('0x38')][_0x20d329]));}else if(_0x20d329===_0x7422('0x76')){var _0x2ff7c7=JSON['parse'](_0x234c12[_0x7422('0x38')][_0x20d329])['$gte'];var _0x4450ec=JSON['parse'](_0x234c12[_0x7422('0x38')][_0x20d329])[_0x7422('0x77')];_0x1d09e9['where'](_0x7422('0x78'),_0x2ff7c7,_0x4450ec);}else{if(_0x234c12[_0x7422('0x38')][_0x20d329]===_0x7422('0x79')){_0x1d09e9[_0x7422('0x42')]('i.'+_0x20d329+_0x7422('0x7a'));}else{_0x1d09e9[_0x7422('0x42')]('i.'+_0x20d329+'\x20=\x20?',_0x234c12[_0x7422('0x38')][_0x20d329]);}}});}if(_0x234c12[_0x7422('0x38')]['read']){if(_0x234c12[_0x7422('0x38')][_0x7422('0x7b')]==0x1){_0x1d09e9['having'](_0x7422('0x7c'));}else{_0x1d09e9['having'](_0x7422('0x7d'));}}if(_0x234c12[_0x7422('0x38')][_0x7422('0x7e')]){_0x50e9bb=_[_0x7422('0x7f')](_0x234c12[_0x7422('0x38')][_0x7422('0x7e')])?_0x234c12[_0x7422('0x38')]['tag']:new Array(_0x234c12[_0x7422('0x38')]['tag']);_0x50e9bb[_0x7422('0x30')](function(_0x140d4a){_0x546828['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x140d4a+',%');});}if(_0x234c12[_0x7422('0x38')][_0x7422('0x80')]){var _0x1a728d=_0x234c12[_0x7422('0x38')]['filter']['replace']('\x5c','\x5c\x5c')[_0x7422('0x81')]('\x27\x27',_0x7422('0x82'));if(qs[_0x7422('0x83')](_0x1a728d)){_0x5b4694['or'](_0x7422('0x84'),_0x1a728d+'%')['or'](_0x7422('0x85'),_0x1a728d+'%');}_0x5b4694['or'](_0x7422('0x86'),_0x1a728d+'%');}}_0x1d09e9[_0x7422('0x42')](_0x5b4694);_0x1d09e9[_0x7422('0x87')](_0x7422('0x88'));var _0x4f04be={'type':db[_0x7422('0x89')]['QueryTypes']['SELECT'],'raw':!![]};var _0x110b3f=_0x1d09e9['clone']();_0x110b3f['field'](_0x7422('0x88'));_0x110b3f[_0x7422('0x45')](_0x7422('0x8a'),_0x7422('0x5b'));if(_0x18b594[_0x7422('0x40')]){_0x18b594[_0x7422('0x40')][_0x7422('0x30')](function(_0x1b01ff){_0x1d09e9['order']('i.'+_0x1b01ff[0x0],_0x1b01ff[0x1]===_0x7422('0x8b')?![]:!![]);});}if(!_[_0x7422('0x73')](_0x50e9bb)){_0x1d09e9[_0x7422('0x5c')](_0x546828);_0x110b3f[_0x7422('0x42')]('t.id\x20IN\x20?',_0x50e9bb);}BPromise[_0x7422('0x8c')]()[_0x7422('0x24')](function(){if(!_0x2986ec){if(_0x234c12[_0x7422('0x38')][_0x7422('0x74')]||_0x234c12['query'][_0x7422('0x8d')])return;_0x110b3f[_0x7422('0x42')](_0x7422('0x8e'));_0x1d09e9['where'](_0x7422('0x8e'));return;}return _0x234c12[_0x7422('0x8f')][_0x7422('0x90')]({'attributes':['id'],'raw':!![]})[_0x7422('0x24')](function(_0x73988){if(_[_0x7422('0x73')](_0x73988)){_0x110b3f[_0x7422('0x42')]('i.FaxAccountId\x20IS\x20NULL');_0x1d09e9[_0x7422('0x42')](_0x7422('0x91'));}else{_0x110b3f[_0x7422('0x42')](_0x7422('0x92'),_['map'](_0x73988,'id'));_0x1d09e9[_0x7422('0x42')]('i.FaxAccountId\x20IN\x20?',_[_0x7422('0x2c')](_0x73988,'id'));}});})[_0x7422('0x24')](function(){db[_0x7422('0x93')]['query'](_0x110b3f[_0x7422('0x94')](),_0x4f04be)[_0x7422('0x24')](function(_0xd69503){_0x45e26d['count']=_0xd69503[_0x7422('0x3d')];if(_0x45e26d[_0x7422('0x1d')]===0x0)return[];return db[_0x7422('0x93')]['query'](_0x4e2cd4[_0x7422('0x94')](),_0x4f04be)[_0x7422('0x24')](function(_0x3fe673){_0xca1546=_[_0x7422('0x95')](_0x3fe673,'id');_0x4f04be=_[_0x7422('0x96')](_0x4f04be,{'model':db[_0x7422('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x234c12[_0x7422('0x38')]['fields']){_0x18b594[_0x7422('0x3b')][_0x7422('0x30')](function(_0x1210f7){_0x1d09e9[_0x7422('0x45')]('i.'+_0x1210f7);});}else{_0x1d09e9[_0x7422('0x45')](_0x7422('0x8a'),_0x7422('0x5b'));_0x1d09e9[_0x7422('0x45')](_0x7422('0x97'),_0x7422('0x98'));_0x1d09e9[_0x7422('0x45')](_0x7422('0x99'),_0x7422('0x9a'));_0x1d09e9[_0x7422('0x45')](_0x7422('0x9b'));_0x1d09e9[_0x7422('0x45')]('c.firstName',_0x7422('0x9c'));_0x1d09e9[_0x7422('0x45')](_0x7422('0x9d'),_0x7422('0x9e'));_0x1d09e9['field'](_0x7422('0x9f'),_0x7422('0xa0'));_0x1d09e9['field'](_0x7422('0xa1'),_0x7422('0xa2'));_0x1d09e9['field'](_0x7422('0xa3'),_0x7422('0xa4'));_0x1d09e9[_0x7422('0x45')](_0x7422('0xa5'),'Contact.fax');_0x1d09e9[_0x7422('0x45')](_0x7422('0xa6'),_0x7422('0xa7'));_0x1d09e9['field'](_0x7422('0xa8'),_0x7422('0xa9'));_0x1d09e9[_0x7422('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7422('0x2d'));}if(_0x18b594[_0x7422('0x1f')])_0x1d09e9[_0x7422('0x1f')](_0x18b594[_0x7422('0x1f')]);if(_0x18b594[_0x7422('0x1e')])_0x1d09e9['offset'](_0x18b594[_0x7422('0x1e')]);return db[_0x7422('0x93')][_0x7422('0x38')](_0x1d09e9['toString'](),_0x4f04be);})[_0x7422('0x24')](function(_0x326463){_0x40c1dd[_0x7422('0x42')](_0x7422('0xaa'),_['map'](_0x326463,'id'));return db[_0x7422('0x93')][_0x7422('0x38')](_0x40c1dd['toString'](),_0x4f04be)[_0x7422('0x24')](function(_0x380de9){var _0x1bd2b8=_[_0x7422('0xab')](_0x380de9,_0x7422('0xac'));var _0x267a86=[];_0x326463[_0x7422('0x30')](function(_0x2961d8){_0x267a86['push'](updateFaxInteraction(_0x2961d8,_0xca1546,_0x1bd2b8));});return BPromise[_0x7422('0xad')](_0x267a86);});});})[_0x7422('0x24')](function(_0x659249){_0x45e26d['rows']=_0x659249;return _0x45e26d;})[_0x7422('0x24')](respondWithFilteredResult(_0x55c622,_0x18b594));})[_0x7422('0xae')](handleError(_0x55c622,null));};exports[_0x7422('0xaf')]=function(_0x2402fb,_0x368554){var _0x326c72={'raw':![],'where':{'id':_0x2402fb['params']['id']}},_0x21232a={};_0x21232a[_0x7422('0x36')]=_[_0x7422('0x37')](db[_0x7422('0x32')][_0x7422('0xb0')]);_0x21232a[_0x7422('0x38')]=_[_0x7422('0x37')](_0x2402fb[_0x7422('0x38')]);_0x21232a[_0x7422('0x39')]=_[_0x7422('0x3a')](_0x21232a['model'],_0x21232a['query']);_0x326c72[_0x7422('0x3b')]=_['intersection'](_0x21232a[_0x7422('0x36')],qs[_0x7422('0x3c')](_0x2402fb[_0x7422('0x38')][_0x7422('0x3c')]));_0x326c72[_0x7422('0x3b')]=_0x326c72[_0x7422('0x3b')][_0x7422('0x3d')]?_0x326c72[_0x7422('0x3b')]:_0x21232a[_0x7422('0x36')];if(_0x2402fb[_0x7422('0x38')]['includeAll']){_0x326c72[_0x7422('0xb1')]=[{'all':!![]}];}_0x326c72=_[_0x7422('0x96')]({},_0x326c72,_0x2402fb[_0x7422('0xb2')]);return db['FaxInteraction'][_0x7422('0x5a')](_0x326c72)['then'](handleEntityNotFound(_0x368554,null))[_0x7422('0x24')](respondWithResult(_0x368554,null))[_0x7422('0xae')](handleError(_0x368554,null));};exports[_0x7422('0xb3')]=function(_0x55f775,_0x110443){return db[_0x7422('0x32')][_0x7422('0xb3')](_0x55f775[_0x7422('0x70')],{})[_0x7422('0x24')](respondWithResult(_0x110443,0xc9))[_0x7422('0xae')](handleError(_0x110443,null));};exports[_0x7422('0x23')]=function(_0x425937,_0x2f9ceb){if(_0x425937['body']['id']){delete _0x425937['body']['id'];}return db[_0x7422('0x32')][_0x7422('0x5a')]({'where':{'id':_0x425937[_0x7422('0xb4')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x2f9ceb,null))[_0x7422('0x24')](saveUpdates(_0x425937[_0x7422('0x70')],null))['then'](respondWithResult(_0x2f9ceb,null))[_0x7422('0xae')](handleError(_0x2f9ceb,null));};exports['destroy']=function(_0x410c97,_0x424e06){return db[_0x7422('0x32')]['find']({'where':{'id':_0x410c97[_0x7422('0xb4')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x424e06,null))[_0x7422('0x24')](removeEntity(_0x424e06,null))['catch'](handleError(_0x424e06,null));};exports['describe']=function(_0x102986,_0x5ad29c){return db['FaxInteraction'][_0x7422('0xb5')]()[_0x7422('0x24')](respondWithResult(_0x5ad29c,null))[_0x7422('0xae')](handleError(_0x5ad29c,null));};exports[_0x7422('0xb6')]=function(_0x1b9b0d,_0x2f8eda,_0x19a3fb){return db[_0x7422('0xb7')][_0x7422('0x5a')]({'where':{'id':_0x1b9b0d[_0x7422('0xb4')]['id']}})['then'](handleEntityNotFound(_0x2f8eda,null))[_0x7422('0x24')](function(_0x4ebc0c){if(_0x4ebc0c){return _0x4ebc0c[_0x7422('0xb6')](_0x1b9b0d['body'][_0x7422('0xb8')],_[_0x7422('0xb9')](_0x1b9b0d['body'],[_0x7422('0xb8'),'id'])||{});}})[_0x7422('0x24')](respondWithResult(_0x2f8eda,null))[_0x7422('0xae')](handleError(_0x2f8eda,null));};exports[_0x7422('0xba')]=function(_0x414197,_0x3a1f22,_0x5cc169){var _0xe8b729={'raw':![],'where':{}};var _0x1eddb5={};var _0x5c1bab={'count':0x0,'rows':[]};return db[_0x7422('0x32')]['findOne']({'where':{'id':_0x414197[_0x7422('0xb4')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x3a1f22,null))[_0x7422('0x24')](function(_0x503601){if(_0x503601){_0x1eddb5[_0x7422('0x36')]=_['keys'](db[_0x7422('0xb7')][_0x7422('0xb0')]);_0x1eddb5[_0x7422('0x38')]=_[_0x7422('0x37')](_0x414197['query']);_0x1eddb5['filters']=_[_0x7422('0x3a')](_0x1eddb5[_0x7422('0x36')],_0x1eddb5[_0x7422('0x38')]);_0xe8b729[_0x7422('0x3b')]=_[_0x7422('0x3a')](_0x1eddb5[_0x7422('0x36')],qs[_0x7422('0x3c')](_0x414197[_0x7422('0x38')][_0x7422('0x3c')]));_0xe8b729[_0x7422('0x3b')]=_0xe8b729[_0x7422('0x3b')]['length']?_0xe8b729[_0x7422('0x3b')]:_0x1eddb5['model'];if(!_0x414197[_0x7422('0x38')][_0x7422('0x3e')](_0x7422('0x3f'))){_0xe8b729[_0x7422('0x1f')]=qs[_0x7422('0x1f')](_0x414197['query'][_0x7422('0x1f')]);_0xe8b729[_0x7422('0x1e')]=qs[_0x7422('0x1e')](_0x414197[_0x7422('0x38')][_0x7422('0x1e')]);}_0xe8b729['order']=qs[_0x7422('0x41')](_0x414197[_0x7422('0x38')][_0x7422('0x41')]);_0xe8b729[_0x7422('0x42')]=qs[_0x7422('0x39')](_[_0x7422('0x43')](_0x414197[_0x7422('0x38')],_0x1eddb5['filters']));_0xe8b729['where']['FaxInteractionId']=_0x503601['id'];if(_0x414197[_0x7422('0x38')][_0x7422('0x80')]){_0xe8b729[_0x7422('0x42')]=_[_0x7422('0x96')](_0xe8b729[_0x7422('0x42')],{'$or':_[_0x7422('0x2c')](_0xe8b729[_0x7422('0x3b')],function(_0x5c068b){var _0xc037b7={};_0xc037b7[_0x5c068b]={'$like':'%'+_0x414197[_0x7422('0x38')][_0x7422('0x80')]+'%'};return _0xc037b7;})});}if(_0x414197[_0x7422('0x38')][_0x7422('0xbb')]){var _0x59a1c0=_0x414197[_0x7422('0x38')][_0x7422('0xbb')][_0x7422('0x2f')](',');var _0x34e480={};_0x34e480[_0x59a1c0[0x0]]={'$gte':moment(_0x59a1c0[0x1])['format'](_0x7422('0xbc'))};_0xe8b729['where']=_[_0x7422('0x96')](_0xe8b729[_0x7422('0x42')],_0x34e480);}_0xe8b729=_['merge']({},_0xe8b729,_0x414197[_0x7422('0xb2')]);return db[_0x7422('0xb7')][_0x7422('0x1d')]({'where':_0xe8b729['where']})[_0x7422('0x24')](function(_0x2b7afc){_0x5c1bab[_0x7422('0x1d')]=_0x2b7afc;if(_0x414197['query']['includeAll']){_0xe8b729[_0x7422('0xb1')]=[{'all':!![]}];}return db[_0x7422('0xb7')]['findAll'](_0xe8b729);})[_0x7422('0x24')](function(_0x25c130){_0x5c1bab[_0x7422('0xbd')]=_0x25c130;return _0x5c1bab;});}})[_0x7422('0x24')](respondWithFilteredResult(_0x3a1f22,_0xe8b729))[_0x7422('0xae')](handleError(_0x3a1f22,null));};exports[_0x7422('0xbe')]=function(_0x109ece,_0x1e139a,_0x100f46){return db['FaxInteraction'][_0x7422('0x5a')]({'where':{'id':_0x109ece[_0x7422('0xb4')]['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x1e139a,null))[_0x7422('0x24')](function(_0x2d85c0){if(_0x2d85c0){return _0x2d85c0[_0x7422('0xbf')](_0x109ece[_0x7422('0x70')][_0x7422('0xb8')],_[_0x7422('0xb9')](_0x109ece[_0x7422('0x70')],[_0x7422('0xb8'),'id'])||{})[_0x7422('0xc0')](function(){return db[_0x7422('0x68')]['findAll']({'attributes':['id','name',_0x7422('0x46')],'where':{'id':_0x109ece[_0x7422('0x70')][_0x7422('0xb8')]}});})[_0x7422('0x24')](function(_0x1f23ad){socket[_0x7422('0xc1')]('faxInteractionTags:save',{'id':Number(_0x109ece[_0x7422('0xb4')]['id']),'tags':_0x1f23ad||[]});return{'id':Number(_0x109ece[_0x7422('0xb4')]['id']),'tags':_0x1f23ad||[]};});}})[_0x7422('0x24')](respondWithResult(_0x1e139a,null))[_0x7422('0xae')](handleError(_0x1e139a,null));};exports[_0x7422('0xc2')]=function(_0x3b6f96,_0x394da5,_0x52f49b){return db[_0x7422('0x32')][_0x7422('0x5a')]({'where':{'id':_0x3b6f96['params']['id']}})[_0x7422('0x24')](handleEntityNotFound(_0x394da5,null))[_0x7422('0x24')](function(_0x47b455){if(_0x47b455){return _0x47b455['removeTags'](_0x3b6f96[_0x7422('0x38')][_0x7422('0xb8')]);}})['then'](respondWithStatusCode(_0x394da5,null))[_0x7422('0xae')](handleError(_0x394da5,null));};exports[_0x7422('0xc3')]=function(_0x4baf72,_0x1fc8a5){var _0x46b819=moment()[_0x7422('0xc4')]()[_0x7422('0x94')]();var _0x2ee967=path[_0x7422('0xc5')](config[_0x7422('0xc6')],_0x7422('0xc7'),_0x7422('0xc8'),_0x7422('0xc9'));var _0xb08d5a=path[_0x7422('0xc5')](config['root'],_0x7422('0xc7'),_0x7422('0xc8'),_0x7422('0xca'));var _0x193515=path[_0x7422('0xc5')](_0x2ee967,_0x46b819);var _0x4e31cd=util['format'](_0x7422('0xcb'),_0x4baf72['params']['id'],_0x46b819);var _0x11e767=path[_0x7422('0xc5')](_0x2ee967,_0x4e31cd);var _0x21acd9=[];_0x21acd9['push']({'model':db[_0x7422('0xcc')],'as':_0x7422('0xcc'),'raw':!![]});var _0x4e8222=[{'model':db[_0x7422('0xb7')],'as':_0x7422('0xcd'),'attributes':['id','body',_0x7422('0x76')],'include':_0x21acd9}];return db[_0x7422('0x32')][_0x7422('0x5a')]({'where':{'id':_0x4baf72[_0x7422('0xb4')]['id']},'include':_0x4e8222})[_0x7422('0x24')](handleEntityNotFound(_0x1fc8a5,null))[_0x7422('0x24')](function(_0x12a28a){if(_0x12a28a&&_0x12a28a[_0x7422('0xcd')]){var _0xbd18f2=_0x12a28a[_0x7422('0xce')]({'plain':!![]});fs[_0x7422('0xcf')](_0x193515);for(var _0x14ae26=0x0;_0x14ae26<_0xbd18f2['Messages'][_0x7422('0x3d')];_0x14ae26++){var _0x5a120c=_0xbd18f2[_0x7422('0xcd')][_0x14ae26][_0x7422('0xcc')];if(_0x5a120c){var _0x591af2=path[_0x7422('0xc5')](_0xb08d5a,_0x5a120c['basename']);if(fs[_0x7422('0xd0')](_0x591af2)){fs[_0x7422('0xd1')](_0x591af2)[_0x7422('0xd2')](fs['createWriteStream'](path[_0x7422('0xc5')](_0x193515,_0x5a120c[_0x7422('0xd3')])));}}}return BPromise[_0x7422('0x8c')]()['then'](function(){return new BPromise(function(_0x36b780,_0x558b78){zipdir(_0x193515,{'saveTo':_0x11e767},function(_0x14461c,_0x248b0f){if(_0x14461c)return _0x558b78(_0x14461c);return _0x36b780(_0x248b0f);});})[_0x7422('0x24')](function(){return new BPromise(function(_0x4fce11,_0xb0fd85){rimraf(_0x193515,function(_0x1f82d6){if(_0x1f82d6)_0xb0fd85(_0x1f82d6);return _0x4fce11();});});})[_0x7422('0x24')](function(){return _0x1fc8a5[_0x7422('0xc3')](_0x11e767,_0x4e31cd,function(_0x3c17bb){if(_0x3c17bb){console[_0x7422('0xd4')]('err',_0x3c17bb);}else{fs[_0x7422('0xd5')](_0x11e767);}});});});}else{return _0x1fc8a5[_0x7422('0x1a')](0xc8);}})['catch'](handleError(_0x1fc8a5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 8e47054..912f65d 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(_0xd715d7,_0x4b29a4){_0xd715d7=_0xd715d7-0x0;var _0x5e1be3=_0x2ef3[_0xd715d7];return _0x5e1be3;};'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 _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index fb61c60..da31baa 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 _0xa8a8=['bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x509c7d,_0x226ce5){var _0xb8d722=function(_0x6c6129){while(--_0x6c6129){_0x509c7d['push'](_0x509c7d['shift']());}};_0xb8d722(++_0x226ce5);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1f2f27,_0x121b11){_0x1f2f27=_0x1f2f27-0x0;var _0x335c38=_0xa8a8[_0x1f2f27];return _0x335c38;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4225b9,_0xecaa6f,_0x3287f5){if(_0x4225b9['changed']('closed')){_0x4225b9[_0x8a8a('0xe')]=moment()['format'](_0x8a8a('0xf'));}_0x3287f5(null,_0x4225b9);}}});}; \ No newline at end of file +var _0x91a7=['bluebird','path','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x5c221b,_0x2ffc5d){var _0x136355=function(_0x5c37ec){while(--_0x5c37ec){_0x5c221b['push'](_0x5c221b['shift']());}};_0x136355(++_0x2ffc5d);}(_0x91a7,0xe7));var _0x791a=function(_0x506b83,_0x5f5b01){_0x506b83=_0x506b83-0x0;var _0x1b04f2=_0x91a7[_0x506b83];return _0x1b04f2;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5aa10a,_0x1a32b4,_0x12884d){if(_0x5aa10a[_0x791a('0x9')](_0x791a('0xa'))){_0x5aa10a[_0x791a('0xb')]=moment()['format'](_0x791a('0xc'));}_0x12884d(null,_0x5aa10a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index da44c0f..28e437d 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 _0x7a2c=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','debug','AddTagsToFaxInteraction','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4c17dd,_0x1a3ae0){var _0x536c17=function(_0x425876){while(--_0x425876){_0x4c17dd['push'](_0x4c17dd['shift']());}};_0x536c17(++_0x1a3ae0);}(_0x7a2c,0x65));var _0xc7a2=function(_0x217fdb,_0x4badeb){_0x217fdb=_0x217fdb-0x0;var _0x122d41=_0x7a2c[_0x217fdb];return _0x122d41;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var moment=require(_0xc7a2('0x1'));var BPromise=require(_0xc7a2('0x2'));var rs=require(_0xc7a2('0x3'));var fs=require('fs');var Redis=require(_0xc7a2('0x4'));var db=require(_0xc7a2('0x5'))['db'];var utils=require(_0xc7a2('0x6'));var logger=require(_0xc7a2('0x7'))(_0xc7a2('0x8'));var config=require(_0xc7a2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc7a2('0xa')]['http']({'port':0x232a});config[_0xc7a2('0xb')]=_[_0xc7a2('0xc')](config[_0xc7a2('0xb')],{'host':_0xc7a2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7a2('0xb')]));require(_0xc7a2('0xe'))['register'](socket);function respondWithRpcPromise(_0x2c5fd7,_0x22fdf1,_0x3ab3db){return new BPromise(function(_0x5dd8e0,_0x33aab0){return client['request'](_0x2c5fd7,_0x3ab3db)[_0xc7a2('0xf')](function(_0x7293de){logger[_0xc7a2('0x10')](_0xc7a2('0x11'),_0x22fdf1,_0xc7a2('0x12'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x22fdf1,_0xc7a2('0x12'),JSON[_0xc7a2('0x13')](_0x7293de));if(_0x7293de[_0xc7a2('0x14')]){if(_0x7293de['error']['code']===0x1f4){logger[_0xc7a2('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x22fdf1,_0x7293de[_0xc7a2('0x14')]['message']);return _0x33aab0(_0x7293de[_0xc7a2('0x14')][_0xc7a2('0x15')]);}logger[_0xc7a2('0x14')](_0xc7a2('0x11'),_0x22fdf1,_0x7293de[_0xc7a2('0x14')][_0xc7a2('0x15')]);return _0x5dd8e0(_0x7293de[_0xc7a2('0x14')][_0xc7a2('0x15')]);}else{logger['info'](_0xc7a2('0x11'),_0x22fdf1,_0xc7a2('0x12'));_0x5dd8e0(_0x7293de['result'][_0xc7a2('0x15')]);}})[_0xc7a2('0x16')](function(_0x3cfa18){logger['error'](_0xc7a2('0x11'),_0x22fdf1,_0x3cfa18);_0x33aab0(_0x3cfa18);});});}exports[_0xc7a2('0x17')]=function(_0x1804e7){var _0x5dc32b=this;return new Promise(function(_0x193417,_0x463d8d){return db[_0xc7a2('0x18')][_0xc7a2('0x19')](_0x1804e7[_0xc7a2('0x1a')],{'raw':_0x1804e7[_0xc7a2('0x1b')]?_0x1804e7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1804e7[_0xc7a2('0x1b')]?_0x1804e7[_0xc7a2('0x1b')][_0xc7a2('0x1c')]||null:null,'attributes':_0x1804e7[_0xc7a2('0x1b')]?_0x1804e7[_0xc7a2('0x1b')][_0xc7a2('0x1d')]||null:null,'limit':_0x1804e7[_0xc7a2('0x1b')]?_0x1804e7[_0xc7a2('0x1b')][_0xc7a2('0x1e')]||null:null})[_0xc7a2('0xf')](function(_0x138c22){logger[_0xc7a2('0x10')](_0xc7a2('0x17'),_0x1804e7);logger[_0xc7a2('0x1f')](_0xc7a2('0x17'),_0x1804e7,JSON['stringify'](_0x138c22));_0x193417(_0x138c22);})[_0xc7a2('0x16')](function(_0x40ff87){logger['error']('UpdateFaxInteraction',_0x40ff87[_0xc7a2('0x15')],_0x1804e7);_0x463d8d(_0x5dc32b[_0xc7a2('0x14')](0x1f4,_0x40ff87[_0xc7a2('0x15')]));});});};exports[_0xc7a2('0x20')]=function(_0x1c3c44){return new Promise(function(_0x1b507e,_0x1e62fa){return db[_0xc7a2('0x18')]['find']({'where':_0x1c3c44[_0xc7a2('0x1b')]?_0x1c3c44['options'][_0xc7a2('0x1c')]||null:null})['then'](function(_0x4bdc37){if(_0x4bdc37){return _0x4bdc37['addTags'](_0x1c3c44[_0xc7a2('0x1a')][_0xc7a2('0x21')],_['omit'](_0x1c3c44[_0xc7a2('0x1a')],[_0xc7a2('0x21'),'id'])||{});}})[_0xc7a2('0x22')](function(_0x231d19){logger[_0xc7a2('0x10')](_0xc7a2('0x23'),_0x1c3c44);logger[_0xc7a2('0x1f')](_0xc7a2('0x23'),_0x1c3c44,JSON[_0xc7a2('0x13')](_0x231d19));_0x1b507e(_0x231d19);})[_0xc7a2('0x16')](function(_0xa1988b){logger[_0xc7a2('0x14')]('AddTags',_0xa1988b[_0xc7a2('0x15')],_0x1c3c44);_0x1e62fa(_this[_0xc7a2('0x14')](0x1f4,_0xa1988b[_0xc7a2('0x15')]));});});}; \ No newline at end of file +var _0xd740=['util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToFaxInteraction','find','where','ids','omit','AddTags','stringify','lodash'];(function(_0x35888b,_0x8e1cf3){var _0x3487d4=function(_0x1c08a5){while(--_0x1c08a5){_0x35888b['push'](_0x35888b['shift']());}};_0x3487d4(++_0x8e1cf3);}(_0xd740,0xcc));var _0x0d74=function(_0x530db1,_0x2b9531){_0x530db1=_0x530db1-0x0;var _0x31c1f2=_0xd740[_0x530db1];return _0x31c1f2;};'use strict';var _=require(_0x0d74('0x0'));var util=require(_0x0d74('0x1'));var moment=require('moment');var BPromise=require(_0x0d74('0x2'));var rs=require(_0x0d74('0x3'));var fs=require('fs');var Redis=require(_0x0d74('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0d74('0x5'));var jayson=require(_0x0d74('0x6'));var client=jayson[_0x0d74('0x7')][_0x0d74('0x8')]({'port':0x232a});config[_0x0d74('0x9')]=_[_0x0d74('0xa')](config[_0x0d74('0x9')],{'host':_0x0d74('0xb'),'port':0x18eb});var socket=require(_0x0d74('0xc'))(new Redis(config[_0x0d74('0x9')]));require('./faxInteraction.socket')[_0x0d74('0xd')](socket);function respondWithRpcPromise(_0x255c46,_0xb0de7c,_0xa2f28f){return new BPromise(function(_0x580c3b,_0x47467c){return client[_0x0d74('0xe')](_0x255c46,_0xa2f28f)[_0x0d74('0xf')](function(_0x532aab){logger[_0x0d74('0x10')]('FaxInteraction,\x20%s,\x20%s',_0xb0de7c,_0x0d74('0x11'));logger['debug'](_0x0d74('0x12'),_0xb0de7c,'request\x20sent',JSON['stringify'](_0x532aab));if(_0x532aab['error']){if(_0x532aab[_0x0d74('0x13')][_0x0d74('0x14')]===0x1f4){logger[_0x0d74('0x13')]('FaxInteraction,\x20%s,\x20%s',_0xb0de7c,_0x532aab[_0x0d74('0x13')][_0x0d74('0x15')]);return _0x47467c(_0x532aab[_0x0d74('0x13')][_0x0d74('0x15')]);}logger[_0x0d74('0x13')]('FaxInteraction,\x20%s,\x20%s',_0xb0de7c,_0x532aab['error'][_0x0d74('0x15')]);return _0x580c3b(_0x532aab[_0x0d74('0x13')][_0x0d74('0x15')]);}else{logger[_0x0d74('0x10')](_0x0d74('0x16'),_0xb0de7c,_0x0d74('0x11'));_0x580c3b(_0x532aab[_0x0d74('0x17')]['message']);}})[_0x0d74('0x18')](function(_0x10c62d){logger[_0x0d74('0x13')](_0x0d74('0x16'),_0xb0de7c,_0x10c62d);_0x47467c(_0x10c62d);});});}exports[_0x0d74('0x19')]=function(_0x49c912){var _0x254e76=this;return new Promise(function(_0x108eaf,_0x2ec720){return db[_0x0d74('0x1a')][_0x0d74('0x1b')](_0x49c912[_0x0d74('0x1c')],{'raw':_0x49c912[_0x0d74('0x1d')]?_0x49c912[_0x0d74('0x1d')][_0x0d74('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49c912[_0x0d74('0x1d')]?_0x49c912[_0x0d74('0x1d')]['where']||null:null,'attributes':_0x49c912['options']?_0x49c912['options'][_0x0d74('0x1f')]||null:null,'limit':_0x49c912[_0x0d74('0x1d')]?_0x49c912[_0x0d74('0x1d')][_0x0d74('0x20')]||null:null})[_0x0d74('0xf')](function(_0xba82ea){logger[_0x0d74('0x10')](_0x0d74('0x19'),_0x49c912);logger[_0x0d74('0x21')](_0x0d74('0x19'),_0x49c912,JSON['stringify'](_0xba82ea));_0x108eaf(_0xba82ea);})[_0x0d74('0x18')](function(_0x198a79){logger[_0x0d74('0x13')](_0x0d74('0x19'),_0x198a79[_0x0d74('0x15')],_0x49c912);_0x2ec720(_0x254e76[_0x0d74('0x13')](0x1f4,_0x198a79[_0x0d74('0x15')]));});});};exports[_0x0d74('0x22')]=function(_0x1c06ba){return new Promise(function(_0xd5e4d3,_0x102bf7){return db['FaxInteraction'][_0x0d74('0x23')]({'where':_0x1c06ba[_0x0d74('0x1d')]?_0x1c06ba['options'][_0x0d74('0x24')]||null:null})[_0x0d74('0xf')](function(_0x20c725){if(_0x20c725){return _0x20c725['addTags'](_0x1c06ba['body'][_0x0d74('0x25')],_[_0x0d74('0x26')](_0x1c06ba[_0x0d74('0x1c')],[_0x0d74('0x25'),'id'])||{});}})['spread'](function(_0x552f62){logger[_0x0d74('0x10')](_0x0d74('0x27'),_0x1c06ba);logger[_0x0d74('0x21')]('AddTags',_0x1c06ba,JSON[_0x0d74('0x28')](_0x552f62));_0xd5e4d3(_0x552f62);})[_0x0d74('0x18')](function(_0x54dd2c){logger[_0x0d74('0x13')](_0x0d74('0x27'),_0x54dd2c[_0x0d74('0x15')],_0x1c06ba);_0x102bf7(_this[_0x0d74('0x13')](0x1f4,_0x54dd2c[_0x0d74('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 219d808..fc8dffc 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 _0xc457=['remove','emit','register','length','./faxInteraction.events'];(function(_0x4ec356,_0x3763df){var _0x5b18e6=function(_0xbd7ba5){while(--_0xbd7ba5){_0x4ec356['push'](_0x4ec356['shift']());}};_0x5b18e6(++_0x3763df);}(_0xc457,0x1df));var _0x7c45=function(_0x468bfe,_0x1ff7a8){_0x468bfe=_0x468bfe-0x0;var _0x15edfd=_0xc457[_0x468bfe];return _0x15edfd;};'use strict';var FaxInteractionEvents=require(_0x7c45('0x0'));var events=['save',_0x7c45('0x1'),'update'];function createListener(_0x10c1a9,_0x497f22){return function(_0xd4e27){_0x497f22[_0x7c45('0x2')](_0x10c1a9,_0xd4e27);};}function removeListener(_0x512564,_0x4f136a){return function(){FaxInteractionEvents['removeListener'](_0x512564,_0x4f136a);};}exports[_0x7c45('0x3')]=function(_0x289018){for(var _0x11a5d3=0x0,_0x193de2=events[_0x7c45('0x4')];_0x11a5d3<_0x193de2;_0x11a5d3++){var _0x4adf43=events[_0x11a5d3];var _0x4e1f44=createListener('faxInteraction:'+_0x4adf43,_0x289018);FaxInteractionEvents['on'](_0x4adf43,_0x4e1f44);}}; \ No newline at end of file +var _0x40f0=['removeListener','register','faxInteraction:','remove','update','emit'];(function(_0x382d66,_0x2f5271){var _0xa3c411=function(_0x22810d){while(--_0x22810d){_0x382d66['push'](_0x382d66['shift']());}};_0xa3c411(++_0x2f5271);}(_0x40f0,0x6f));var _0x040f=function(_0x2db756,_0x30f837){_0x2db756=_0x2db756-0x0;var _0x27baa6=_0x40f0[_0x2db756];return _0x27baa6;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x040f('0x0'),_0x040f('0x1')];function createListener(_0x2073d7,_0x5a8406){return function(_0x364fe0){_0x5a8406[_0x040f('0x2')](_0x2073d7,_0x364fe0);};}function removeListener(_0x748177,_0x5a5f64){return function(){FaxInteractionEvents[_0x040f('0x3')](_0x748177,_0x5a5f64);};}exports[_0x040f('0x4')]=function(_0x300268){for(var _0x3c57a7=0x0,_0x4de01c=events['length'];_0x3c57a7<_0x4de01c;_0x3c57a7++){var _0x3c46e6=events[_0x3c57a7];var _0x43a65f=createListener(_0x040f('0x5')+_0x3c46e6,_0x300268);FaxInteractionEvents['on'](_0x3c46e6,_0x43a65f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e6e144a..039f71a 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 _0x65fd=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','removeTags','exports','multer'];(function(_0x5a57c6,_0x394b7d){var _0x509601=function(_0x1bb60b){while(--_0x1bb60b){_0x5a57c6['push'](_0x5a57c6['shift']());}};_0x509601(++_0x394b7d);}(_0x65fd,0x185));var _0xd65f=function(_0x172ce2,_0x302ab1){_0x172ce2=_0x172ce2-0x0;var _0x3043d4=_0x65fd[_0x172ce2];return _0x3043d4;};'use strict';var multer=require(_0xd65f('0x0'));var util=require(_0xd65f('0x1'));var path=require(_0xd65f('0x2'));var timeout=require(_0xd65f('0x3'));var express=require('express');var router=express[_0xd65f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd65f('0x5'));var config=require(_0xd65f('0x6'));var controller=require(_0xd65f('0x7'));router[_0xd65f('0x8')]('/',auth[_0xd65f('0x9')](),controller['index']);router['get'](_0xd65f('0xa'),auth[_0xd65f('0x9')](),controller[_0xd65f('0xb')]);router[_0xd65f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd65f('0xc')]);router[_0xd65f('0x8')](_0xd65f('0xd'),auth['isAuthenticated'](),controller[_0xd65f('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xd65f('0xf')]('/',auth[_0xd65f('0x9')](),controller[_0xd65f('0x10')]);router[_0xd65f('0xf')](_0xd65f('0xd'),auth[_0xd65f('0x9')](),controller[_0xd65f('0x11')]);router[_0xd65f('0xf')](_0xd65f('0x12'),auth[_0xd65f('0x9')](),interaction[_0xd65f('0x13')](_0xd65f('0x14'),_0xd65f('0x15')),controller[_0xd65f('0x16')]);router[_0xd65f('0x17')](_0xd65f('0x18'),auth[_0xd65f('0x9')](),interaction[_0xd65f('0x13')](_0xd65f('0x14'),_0xd65f('0x19')),controller[_0xd65f('0x1a')]);router['delete'](_0xd65f('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0xd65f('0x14'),'faxinteraction:destroy'),controller['destroy']);router[_0xd65f('0x1b')](_0xd65f('0x12'),auth[_0xd65f('0x9')](),controller[_0xd65f('0x1c')]);module[_0xd65f('0x1d')]=router; \ No newline at end of file +var _0xbff9=['isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxInteraction.controller','get'];(function(_0x519145,_0x2b854c){var _0x33de12=function(_0xf78e8b){while(--_0xf78e8b){_0x519145['push'](_0x519145['shift']());}};_0x33de12(++_0x2b854c);}(_0xbff9,0x197));var _0x9bff=function(_0x2cbfa5,_0x369a91){_0x2cbfa5=_0x2cbfa5-0x0;var _0x53c11c=_0xbff9[_0x2cbfa5];return _0x53c11c;};'use strict';var multer=require(_0x9bff('0x0'));var util=require(_0x9bff('0x1'));var path=require(_0x9bff('0x2'));var timeout=require(_0x9bff('0x3'));var express=require(_0x9bff('0x4'));var router=express[_0x9bff('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9bff('0x6'));var config=require('../../config/environment');var controller=require(_0x9bff('0x7'));router[_0x9bff('0x8')]('/',auth[_0x9bff('0x9')](),controller[_0x9bff('0xa')]);router['get'](_0x9bff('0xb'),auth[_0x9bff('0x9')](),controller[_0x9bff('0xc')]);router[_0x9bff('0x8')](_0x9bff('0xd'),auth[_0x9bff('0x9')](),controller['show']);router['get'](_0x9bff('0xe'),auth[_0x9bff('0x9')](),controller['getMessages']);router[_0x9bff('0x8')](_0x9bff('0xf'),auth[_0x9bff('0x9')](),controller[_0x9bff('0x10')]);router[_0x9bff('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9bff('0x11')]('/:id/messages',auth[_0x9bff('0x9')](),controller[_0x9bff('0x12')]);router[_0x9bff('0x11')](_0x9bff('0x13'),auth[_0x9bff('0x9')](),interaction[_0x9bff('0x14')](_0x9bff('0x15'),_0x9bff('0x16')),controller[_0x9bff('0x17')]);router[_0x9bff('0x18')]('/:id',auth[_0x9bff('0x9')](),interaction[_0x9bff('0x14')](_0x9bff('0x15'),_0x9bff('0x19')),controller[_0x9bff('0x1a')]);router[_0x9bff('0x1b')]('/:id',auth[_0x9bff('0x9')](),interaction[_0x9bff('0x14')](_0x9bff('0x15'),_0x9bff('0x1c')),controller[_0x9bff('0x1d')]);router['delete'](_0x9bff('0x13'),auth[_0x9bff('0x9')](),controller[_0x9bff('0x1e')]);module[_0x9bff('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 9abd74e..85baa31 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 _0x42e3=['ENUM','out','TEXT','DATE','sequelize','exports','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42e3,0x1ac));var _0x342e=function(_0x58dcd2,_0x38977e){_0x58dcd2=_0x58dcd2-0x0;var _0x43f7e6=_0x42e3[_0x58dcd2];return _0x43f7e6;};'use strict';var Sequelize=require(_0x342e('0x0'));module[_0x342e('0x1')]={'body':{'type':Sequelize['TEXT'](_0x342e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x342e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x342e('0x4')]('in',_0x342e('0x5')),'defaultValue':_0x342e('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x342e('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x342e('0x7')]}}; \ No newline at end of file +var _0xeeda=['BOOLEAN','ENUM','out','TEXT','medium'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xeeda,0x8a));var _0xaeed=function(_0x46c92f,_0x56039e){_0x46c92f=_0x46c92f-0x0;var _0x70777c=_0xeeda[_0x46c92f];return _0x70777c;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xaeed('0x0')](_0xaeed('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xaeed('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaeed('0x3')]('in',_0xaeed('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xaeed('0x0')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 26a1e9f..302b389 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 _0x43d1=['isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','files','attachments','basename','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s','message','sendStatus','status','json','count','offset','set','Content-Range','apply','save','destroy','end','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','update','body','find','describe','fax-interactions','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteractionId'];(function(_0x54971c,_0x2ade4d){var _0x59df2c=function(_0x31a982){while(--_0x31a982){_0x54971c['push'](_0x54971c['shift']());}};_0x59df2c(++_0x2ade4d);}(_0x43d1,0x1b2));var _0x143d=function(_0x137e28,_0x2ce3f9){_0x137e28=_0x137e28-0x0;var _0x54f56a=_0x43d1[_0x137e28];return _0x54f56a;};'use strict';var pdf=require(_0x143d('0x0'));var emlformat=require(_0x143d('0x1'));var rimraf=require(_0x143d('0x2'));var zipdir=require(_0x143d('0x3'));var jsonpatch=require(_0x143d('0x4'));var rp=require(_0x143d('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x143d('0x6'));var util=require(_0x143d('0x7'));var path=require(_0x143d('0x8'));var sox=require('sox');var csv=require(_0x143d('0x9'));var ejs=require(_0x143d('0xa'));var fs=require('fs');var _=require(_0x143d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x143d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x143d('0xd'));var Papa=require(_0x143d('0xe'));var Redis=require(_0x143d('0xf'));var authService=require(_0x143d('0x10'));var qs=require(_0x143d('0x11'));var as=require(_0x143d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x143d('0x13'))('api');var utils=require(_0x143d('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x143d('0x15')]=_[_0x143d('0x16')](config[_0x143d('0x15')],{'host':_0x143d('0x17'),'port':0x18eb});var socket=require(_0x143d('0x18'))(new Redis(config[_0x143d('0x15')]));require(_0x143d('0x19'))['register'](socket);var jayson=require(_0x143d('0x1a'));var client=jayson['client'][_0x143d('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x143d('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1e0a4a,_0xa83541,_0x2d24e9){if(_0x2d24e9){var _0x184007=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x184007[_0x143d('0x1c')](_0xa83541)){return _0x1e0a4a;}else{throw new db[(_0x143d('0x1d'))]['ValidationError'](_0x143d('0x1e'));}}else{return _0x1e0a4a;}}function respondWithRpcPromise(_0xe61e,_0x4d6f05,_0x5987d7,_0x179ec0){return new BPromise(function(_0x88d58e,_0x439f89){var _0x58275d=_0x179ec0||client;return _0x58275d[_0x143d('0x1f')](_0xe61e,_0x5987d7)[_0x143d('0x20')](function(_0x45bbb4){logger[_0x143d('0x21')]('FaxMessage,\x20%s,\x20%s',_0x4d6f05,_0x143d('0x22'));logger[_0x143d('0x23')](_0x143d('0x24'),_0x4d6f05,_0x143d('0x22'),JSON[_0x143d('0x25')](_0x45bbb4));if(_0x45bbb4[_0x143d('0x26')]){if(_0x45bbb4[_0x143d('0x26')]['code']===0x1f4){logger[_0x143d('0x26')](_0x143d('0x27'),_0x4d6f05,_0x45bbb4[_0x143d('0x26')][_0x143d('0x28')]);return _0x439f89(_0x45bbb4[_0x143d('0x26')][_0x143d('0x28')]);}logger[_0x143d('0x26')](_0x143d('0x27'),_0x4d6f05,_0x45bbb4['error'][_0x143d('0x28')]);return _0x88d58e(_0x45bbb4[_0x143d('0x26')][_0x143d('0x28')]);}else{logger[_0x143d('0x21')](_0x143d('0x27'),_0x4d6f05,'request\x20sent');_0x88d58e(_0x45bbb4['result'][_0x143d('0x28')]);}})['catch'](function(_0x41f96e){logger[_0x143d('0x26')](_0x143d('0x27'),_0x4d6f05,_0x41f96e);_0x439f89(_0x41f96e);});});}function respondWithStatusCode(_0x2a756c,_0x56b233){_0x56b233=_0x56b233||0xcc;return function(_0x3b7af4){if(_0x3b7af4){return _0x2a756c[_0x143d('0x29')](_0x56b233);}return _0x2a756c[_0x143d('0x2a')](_0x56b233)['end']();};}function respondWithResult(_0x266b99,_0x397fbc){_0x397fbc=_0x397fbc||0xc8;return function(_0x2656c6){if(_0x2656c6){return _0x266b99[_0x143d('0x2a')](_0x397fbc)[_0x143d('0x2b')](_0x2656c6);}};}function respondWithFilteredResult(_0x2c3423,_0x267232){return function(_0x51f245){if(_0x51f245){var _0x3dc5aa=_0x51f245[_0x143d('0x2c')],_0x4ef9a0=_0x267232['offset'],_0x1429b7=_0x267232[_0x143d('0x2d')]+_0x267232['limit'],_0x32884e;if(_0x1429b7>=_0x3dc5aa){_0x1429b7=_0x3dc5aa;_0x32884e=0xc8;}else{_0x32884e=0xce;}_0x2c3423[_0x143d('0x2a')](_0x32884e);return _0x2c3423[_0x143d('0x2e')](_0x143d('0x2f'),_0x4ef9a0+'-'+_0x1429b7+'/'+_0x3dc5aa)[_0x143d('0x2b')](_0x51f245);}return null;};}function patchUpdates(_0x2f8019){return function(_0x4e2aa7){try{jsonpatch[_0x143d('0x30')](_0x4e2aa7,_0x2f8019,!![]);}catch(_0x35d952){return BPromise['reject'](_0x35d952);}return _0x4e2aa7[_0x143d('0x31')]();};}function saveUpdates(_0x3f18b6,_0x5dc856){return function(_0x5620bd){if(_0x5620bd){return _0x5620bd['update'](_0x3f18b6)[_0x143d('0x20')](function(_0x1bbdf4){return _0x1bbdf4;});}return null;};}function removeEntity(_0x2e5348,_0x456737){return function(_0x462015){if(_0x462015){return _0x462015[_0x143d('0x32')]()[_0x143d('0x20')](function(){_0x2e5348['status'](0xcc)[_0x143d('0x33')]();});}};}function handleEntityNotFound(_0x113dd5,_0x3bc129){return function(_0x574c40){if(!_0x574c40){_0x113dd5[_0x143d('0x29')](0x194);}return _0x574c40;};}function handleError(_0x9aba9d,_0x25bac9){_0x25bac9=_0x25bac9||0x1f4;return function(_0x3cd80e){logger[_0x143d('0x26')](_0x3cd80e[_0x143d('0x34')]);if(_0x3cd80e[_0x143d('0x35')]){delete _0x3cd80e[_0x143d('0x35')];}_0x9aba9d[_0x143d('0x2a')](_0x25bac9)[_0x143d('0x36')](_0x3cd80e);};}exports[_0x143d('0x37')]=function(_0x57511f,_0x89d353){var _0x4981bb={},_0x1da9ca={},_0x29bae7={'count':0x0,'rows':[]};var _0x587324=_[_0x143d('0x38')](db[_0x143d('0x39')][_0x143d('0x3a')],function(_0xd5056f){return{'name':_0xd5056f[_0x143d('0x3b')],'type':_0xd5056f[_0x143d('0x3c')][_0x143d('0x3d')]};});_0x1da9ca['model']=_[_0x143d('0x38')](_0x587324,_0x143d('0x35'));_0x1da9ca[_0x143d('0x3e')]=_[_0x143d('0x3f')](_0x57511f['query']);_0x1da9ca[_0x143d('0x40')]=_[_0x143d('0x41')](_0x1da9ca[_0x143d('0x42')],_0x1da9ca[_0x143d('0x3e')]);_0x4981bb[_0x143d('0x43')]=_[_0x143d('0x41')](_0x1da9ca[_0x143d('0x42')],qs[_0x143d('0x44')](_0x57511f['query'][_0x143d('0x44')]));_0x4981bb[_0x143d('0x43')]=_0x4981bb[_0x143d('0x43')][_0x143d('0x45')]?_0x4981bb[_0x143d('0x43')]:_0x1da9ca['model'];if(!_0x57511f['query']['hasOwnProperty'](_0x143d('0x46'))){_0x4981bb[_0x143d('0x47')]=qs['limit'](_0x57511f['query']['limit']);_0x4981bb['offset']=qs[_0x143d('0x2d')](_0x57511f['query'][_0x143d('0x2d')]);}_0x4981bb[_0x143d('0x48')]=qs[_0x143d('0x49')](_0x57511f[_0x143d('0x3e')][_0x143d('0x49')]);_0x4981bb['where']=qs['filters'](_[_0x143d('0x4a')](_0x57511f[_0x143d('0x3e')],_0x1da9ca[_0x143d('0x40')]),_0x587324);if(_0x57511f[_0x143d('0x3e')][_0x143d('0x4b')]){_0x4981bb[_0x143d('0x4c')]=_[_0x143d('0x4d')](_0x4981bb[_0x143d('0x4c')],{'$or':_[_0x143d('0x38')](_0x587324,function(_0x2c3df4){if(_0x2c3df4['type']!==_0x143d('0x4e')){var _0x2b2245={};_0x2b2245[_0x2c3df4[_0x143d('0x35')]]={'$like':'%'+_0x57511f[_0x143d('0x3e')][_0x143d('0x4b')]+'%'};return _0x2b2245;}})});}_0x4981bb=_[_0x143d('0x4d')]({},_0x4981bb,_0x57511f[_0x143d('0x4f')]);var _0x4a9bf7={'where':_0x4981bb[_0x143d('0x4c')]};return db['FaxMessage'][_0x143d('0x2c')](_0x4a9bf7)[_0x143d('0x20')](function(_0x544f9a){_0x29bae7[_0x143d('0x2c')]=_0x544f9a;if(_0x57511f[_0x143d('0x3e')][_0x143d('0x50')]){_0x4981bb['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x4981bb);})[_0x143d('0x20')](function(_0x324835){_0x29bae7['rows']=_0x324835;return _0x29bae7;})[_0x143d('0x20')](respondWithFilteredResult(_0x89d353,_0x4981bb))[_0x143d('0x51')](handleError(_0x89d353,null));};exports[_0x143d('0x52')]=function(_0x158e8d,_0xb90f0b){var _0x45c2eb={'raw':!![],'where':{'id':_0x158e8d[_0x143d('0x53')]['id']}},_0x1b1ca4={};_0x1b1ca4[_0x143d('0x42')]=_[_0x143d('0x3f')](db[_0x143d('0x39')][_0x143d('0x3a')]);_0x1b1ca4[_0x143d('0x3e')]=_['keys'](_0x158e8d['query']);_0x1b1ca4[_0x143d('0x40')]=_[_0x143d('0x41')](_0x1b1ca4[_0x143d('0x42')],_0x1b1ca4[_0x143d('0x3e')]);_0x45c2eb[_0x143d('0x43')]=_['intersection'](_0x1b1ca4[_0x143d('0x42')],qs['fields'](_0x158e8d[_0x143d('0x3e')][_0x143d('0x44')]));_0x45c2eb[_0x143d('0x43')]=_0x45c2eb[_0x143d('0x43')][_0x143d('0x45')]?_0x45c2eb[_0x143d('0x43')]:_0x1b1ca4[_0x143d('0x42')];if(_0x158e8d[_0x143d('0x3e')][_0x143d('0x50')]){_0x45c2eb['include']=[{'all':!![]}];}_0x45c2eb=_[_0x143d('0x4d')]({},_0x45c2eb,_0x158e8d[_0x143d('0x4f')]);return db[_0x143d('0x39')]['find'](_0x45c2eb)[_0x143d('0x20')](handleEntityNotFound(_0xb90f0b,null))[_0x143d('0x20')](respondWithResult(_0xb90f0b,null))[_0x143d('0x51')](handleError(_0xb90f0b,null));};exports[_0x143d('0x54')]=function(_0x4cd26e,_0x33abec){if(_0x4cd26e[_0x143d('0x55')]['id']){delete _0x4cd26e[_0x143d('0x55')]['id'];}return db[_0x143d('0x39')][_0x143d('0x56')]({'where':{'id':_0x4cd26e[_0x143d('0x53')]['id']}})['then'](handleEntityNotFound(_0x33abec,null))[_0x143d('0x20')](saveUpdates(_0x4cd26e['body'],null))[_0x143d('0x20')](respondWithResult(_0x33abec,null))[_0x143d('0x51')](handleError(_0x33abec,null));};exports[_0x143d('0x32')]=function(_0x52b247,_0x22ad54){return db['FaxMessage']['find']({'where':{'id':_0x52b247['params']['id']}})['then'](handleEntityNotFound(_0x22ad54,null))[_0x143d('0x20')](removeEntity(_0x22ad54,null))[_0x143d('0x51')](handleError(_0x22ad54,null));};exports['describe']=function(_0x4d1278,_0x22b051){return db[_0x143d('0x39')][_0x143d('0x57')]()[_0x143d('0x20')](respondWithResult(_0x22b051,null))[_0x143d('0x51')](handleError(_0x22b051,null));};var interaction_log=require('../../config/logger')(_0x143d('0x58'));exports['accept']=function(_0x4d8925,_0x432b0b,_0x3312dc){var _0x3f79b2={'channel':_0x143d('0x59')};if(_0x4d8925[_0x143d('0x55')]['id']){delete _0x4d8925['body']['id'];}_0x4d8925[_0x143d('0x55')]['read']=!![];_0x4d8925[_0x143d('0x55')]['readAt']=moment()[_0x143d('0x5a')](_0x143d('0x5b'));_0x4d8925['body']['UserId']=_0x4d8925[_0x143d('0x55')][_0x143d('0x5c')]||_0x4d8925[_0x143d('0x5d')]['id'];return db[_0x143d('0x39')][_0x143d('0x56')]({'where':{'id':_0x4d8925[_0x143d('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x143d('0x5e')],'as':_0x143d('0x5f')}]})['then'](handleEntityNotFound(_0x432b0b,null))[_0x143d('0x20')](saveUpdates(_0x4d8925[_0x143d('0x55')],null))[_0x143d('0x20')](function(_0x2c97c5){if(_0x2c97c5){_0x3f79b2['message']=_0x2c97c5[_0x143d('0x60')]({'plain':!![]});return db['FaxInteraction'][_0x143d('0x56')]({'where':{'id':_0x2c97c5[_0x143d('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x432b0b,null))[_0x143d('0x20')](function(_0x5f61d8){if(_0x5f61d8){return _0x5f61d8[_0x143d('0x54')]({'UserId':_0x4d8925[_0x143d('0x55')][_0x143d('0x5c')],'read1stAt':_[_0x143d('0x62')](_0x5f61d8['read1stAt'])?moment()[_0x143d('0x5a')](_0x143d('0x5b')):undefined});}return null;})[_0x143d('0x20')](function(_0x49a653){if(_0x49a653){_0x3f79b2[_0x143d('0x63')]=_0x49a653[_0x143d('0x60')]({'plain':!![]});interaction_log[_0x143d('0x21')](_0x143d('0x64'),_0x4d8925[_0x143d('0x5d')]['id'],_0x4d8925[_0x143d('0x5d')][_0x143d('0x35')],_0x4d8925[_0x143d('0x5d')][_0x143d('0x65')],_0x3f79b2[_0x143d('0x63')]['id'],_0x4d8925[_0x143d('0x55')]?JSON[_0x143d('0x25')](_0x4d8925['body']):_0x143d('0x66'));return respondWithRpcPromise(_0x143d('0x67'),_0x143d('0x68'),_0x3f79b2);}return null;})[_0x143d('0x20')](function(_0x321f51){if(_0x321f51){if(_0x4d8925[_0x143d('0x55')][_0x143d('0x69')]){_0x3f79b2[_0x143d('0x28')]['interface']=util[_0x143d('0x5a')](_0x143d('0x6a'),_0x4d8925[_0x143d('0x5d')][_0x143d('0x35')]);_0x3f79b2[_0x143d('0x28')][_0x143d('0x6b')]=_0x3f79b2[_0x143d('0x6b')];_0x3f79b2[_0x143d('0x28')][_0x143d('0x6c')]=_0x143d('0x6d');return respondWithRpcPromise(_0x143d('0x6e'),_0x143d('0x6e'),{'event':_0x143d('0x6f'),'message':_0x3f79b2[_0x143d('0x28')]},client9002)[_0x143d('0x20')](function(){return _0x3f79b2;});}return _0x3f79b2;}return null;})[_0x143d('0x20')](respondWithResult(_0x432b0b,null))[_0x143d('0x51')](handleError(_0x432b0b,null));};var interaction_log=require(_0x143d('0x13'))(_0x143d('0x58'));exports[_0x143d('0x70')]=function(_0x12f22c,_0x752090,_0x2ca544){var _0x5ed3fd={'agent':{},'channel':_0x143d('0x59')};if(_0x12f22c[_0x143d('0x55')]['id']){delete _0x12f22c[_0x143d('0x55')]['id'];}_0x12f22c[_0x143d('0x55')]['UserId']=_0x12f22c['body']['UserId']||_0x12f22c[_0x143d('0x5d')]['id'];_0x5ed3fd[_0x143d('0x71')]['id']=_0x12f22c['body']['UserId'];return db[_0x143d('0x39')][_0x143d('0x56')]({'where':{'id':_0x12f22c[_0x143d('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x752090,null))[_0x143d('0x20')](function(_0x339cdd){if(_0x339cdd){_0x5ed3fd[_0x143d('0x28')]=_0x339cdd[_0x143d('0x60')]({'plain':!![]});return db[_0x143d('0x72')][_0x143d('0x56')]({'where':{'id':_0x339cdd[_0x143d('0x61')]}});}return null;})[_0x143d('0x20')](handleEntityNotFound(_0x752090,null))['then'](function(_0x5df164){if(_0x5df164){_0x5ed3fd[_0x143d('0x63')]=_0x5df164['get']({'plain':!![]});interaction_log[_0x143d('0x21')](_0x143d('0x73'),_0x12f22c['user']['id'],_0x12f22c[_0x143d('0x5d')][_0x143d('0x35')],_0x12f22c['user'][_0x143d('0x65')],_0x5ed3fd[_0x143d('0x63')]['id'],_0x12f22c['body']?JSON[_0x143d('0x25')](_0x12f22c[_0x143d('0x55')]):_0x143d('0x66'));return respondWithRpcPromise(_0x143d('0x74'),_0x143d('0x75'),_0x5ed3fd);}return null;})['then'](function(_0x2b99da){if(_0x2b99da){_0x2b99da[_0x143d('0x28')]['interface']=util[_0x143d('0x5a')](_0x143d('0x6a'),_0x12f22c['user'][_0x143d('0x35')]);_0x2b99da[_0x143d('0x28')][_0x143d('0x6b')]=_0x5ed3fd[_0x143d('0x6b')];_0x2b99da[_0x143d('0x28')][_0x143d('0x6c')]=_0x143d('0x70');respondWithRpcPromise(_0x143d('0x6e'),_0x143d('0x6e'),{'event':_0x143d('0x76'),'message':_0x2b99da[_0x143d('0x28')]},client9002);return _0x5ed3fd;}return null;})[_0x143d('0x20')](respondWithResult(_0x752090,null))[_0x143d('0x51')](handleError(_0x752090,null));};exports[_0x143d('0x77')]=function(_0x2e123e,_0x1c5a27){var _0x339a52;return db[_0x143d('0x39')][_0x143d('0x77')](_0x2e123e[_0x143d('0x55')],{})['then'](function(_0x41d8db){_0x339a52=_0x41d8db;return db['CmContact'][_0x143d('0x78')]({'where':{'id':_0x339a52[_0x143d('0x79')]}});})[_0x143d('0x20')](function(_0xaf17e4){if(_[_0x143d('0x62')](_0xaf17e4)){return;}else{_0x339a52[_0x143d('0x59')]=_0xaf17e4[_0x143d('0x59')];return db[_0x143d('0x7a')][_0x143d('0x78')]({'where':{'id':_0x339a52[_0x143d('0x7b')]}});}})[_0x143d('0x20')](function(_0x21c554){return respondWithRpcPromise(_0x143d('0x7c'),'SendFax',{'FaxAccountId':_[_0x143d('0x62')](_0x2e123e[_0x143d('0x55')])?undefined:_0x2e123e[_0x143d('0x55')][_0x143d('0x7d')],'path':_[_0x143d('0x62')](_0x21c554)?undefined:util[_0x143d('0x5a')](_0x143d('0x7e'),_0x21c554['basename']),'fax':_['isNil'](_0x339a52['fax'])?undefined:_0x339a52[_0x143d('0x59')],'AttachmentId':_0x339a52[_0x143d('0x7b')]},client9002);})[_0x143d('0x20')](respondWithResult(_0x1c5a27,0xc9))[_0x143d('0x51')](handleError(_0x1c5a27,null));};exports[_0x143d('0x7f')]=function(_0x4f39c4,_0x129860){var _0x420e84=path[_0x143d('0x80')](config[_0x143d('0x81')],'server',_0x143d('0x82'),_0x143d('0x83'));return db['FaxMessage']['find']({'where':{'id':_0x4f39c4[_0x143d('0x53')]['id']},'include':[{'model':db[_0x143d('0x7a')],'as':_0x143d('0x7a')}]})[_0x143d('0x20')](handleEntityNotFound(_0x129860,null))[_0x143d('0x20')](function(_0x517040){if(_0x517040){return _0x129860[_0x143d('0x7f')](path[_0x143d('0x80')](_0x420e84,_0x517040[_0x143d('0x7a')][_0x143d('0x84')]));}})['catch'](handleError(_0x129860,null));}; \ No newline at end of file +var _0xd06b=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','find','body','params','describe','fax-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','create','findOne','ContactId','fax','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','attachments','basename','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xd06b,0x79));var _0xbd06=function(_0x54b0d9,_0x17f415){_0x54b0d9=_0x54b0d9-0x0;var _0x1bef29=_0xd06b[_0x54b0d9];return _0x1bef29;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xbd06('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd06('0x1'));var rp=require(_0xbd06('0x2'));var moment=require(_0xbd06('0x3'));var BPromise=require(_0xbd06('0x4'));var Mustache=require(_0xbd06('0x5'));var util=require(_0xbd06('0x6'));var path=require(_0xbd06('0x7'));var sox=require(_0xbd06('0x8'));var csv=require(_0xbd06('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbd06('0xa'));var squel=require(_0xbd06('0xb'));var crypto=require(_0xbd06('0xc'));var jsforce=require(_0xbd06('0xd'));var deskjs=require(_0xbd06('0xe'));var toCsv=require(_0xbd06('0x9'));var querystring=require(_0xbd06('0xf'));var Papa=require(_0xbd06('0x10'));var Redis=require('ioredis');var authService=require(_0xbd06('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbd06('0x12'));var hardwareService=require(_0xbd06('0x13'));var logger=require(_0xbd06('0x14'))(_0xbd06('0x15'));var utils=require('../../config/utils');var config=require(_0xbd06('0x16'));var db=require(_0xbd06('0x17'))['db'];config[_0xbd06('0x18')]=_[_0xbd06('0x19')](config[_0xbd06('0x18')],{'host':_0xbd06('0x1a'),'port':0x18eb});var socket=require(_0xbd06('0x1b'))(new Redis(config['redis']));require(_0xbd06('0x1c'))[_0xbd06('0x1d')](socket);var jayson=require(_0xbd06('0x1e'));var client=jayson['client'][_0xbd06('0x1f')]({'port':0x232c});var client9002=jayson[_0xbd06('0x20')][_0xbd06('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x278d54,_0x2d2532,_0x391b72){if(_0x391b72){var _0x1c60af=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c60af[_0xbd06('0x21')](_0x2d2532)){return _0x278d54;}else{throw new db[(_0xbd06('0x22'))][(_0xbd06('0x23'))](_0xbd06('0x24'));}}else{return _0x278d54;}}function respondWithRpcPromise(_0x425d15,_0x3566a3,_0x4dfc81,_0x693dcc){return new BPromise(function(_0x2e3d58,_0x2720ff){var _0x23883b=_0x693dcc||client;return _0x23883b[_0xbd06('0x25')](_0x425d15,_0x4dfc81)[_0xbd06('0x26')](function(_0x27b147){logger['info'](_0xbd06('0x27'),_0x3566a3,'request\x20sent');logger[_0xbd06('0x28')](_0xbd06('0x29'),_0x3566a3,'request\x20sent',JSON[_0xbd06('0x2a')](_0x27b147));if(_0x27b147[_0xbd06('0x2b')]){if(_0x27b147[_0xbd06('0x2b')]['code']===0x1f4){logger[_0xbd06('0x2b')](_0xbd06('0x27'),_0x3566a3,_0x27b147[_0xbd06('0x2b')]['message']);return _0x2720ff(_0x27b147[_0xbd06('0x2b')][_0xbd06('0x2c')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x3566a3,_0x27b147[_0xbd06('0x2b')][_0xbd06('0x2c')]);return _0x2e3d58(_0x27b147[_0xbd06('0x2b')][_0xbd06('0x2c')]);}else{logger['info'](_0xbd06('0x27'),_0x3566a3,'request\x20sent');_0x2e3d58(_0x27b147[_0xbd06('0x2d')][_0xbd06('0x2c')]);}})[_0xbd06('0x2e')](function(_0x2e536d){logger[_0xbd06('0x2b')](_0xbd06('0x27'),_0x3566a3,_0x2e536d);_0x2720ff(_0x2e536d);});});}function respondWithStatusCode(_0xb77a71,_0x512726){_0x512726=_0x512726||0xcc;return function(_0x400ded){if(_0x400ded){return _0xb77a71[_0xbd06('0x2f')](_0x512726);}return _0xb77a71['status'](_0x512726)['end']();};}function respondWithResult(_0x1d8c62,_0x572df4){_0x572df4=_0x572df4||0xc8;return function(_0xb4f97){if(_0xb4f97){return _0x1d8c62[_0xbd06('0x30')](_0x572df4)[_0xbd06('0x31')](_0xb4f97);}};}function respondWithFilteredResult(_0x197372,_0x538dd7){return function(_0x15629a){if(_0x15629a){var _0x357de1=_0x15629a[_0xbd06('0x32')],_0x44019d=_0x538dd7[_0xbd06('0x33')],_0x292fce=_0x538dd7[_0xbd06('0x33')]+_0x538dd7[_0xbd06('0x34')],_0x38f85b;if(_0x292fce>=_0x357de1){_0x292fce=_0x357de1;_0x38f85b=0xc8;}else{_0x38f85b=0xce;}_0x197372[_0xbd06('0x30')](_0x38f85b);return _0x197372[_0xbd06('0x35')](_0xbd06('0x36'),_0x44019d+'-'+_0x292fce+'/'+_0x357de1)['json'](_0x15629a);}return null;};}function patchUpdates(_0x2b75a4){return function(_0x344acb){try{jsonpatch['apply'](_0x344acb,_0x2b75a4,!![]);}catch(_0x19d5c8){return BPromise[_0xbd06('0x37')](_0x19d5c8);}return _0x344acb['save']();};}function saveUpdates(_0x39f276,_0xdc9f6e){return function(_0x234165){if(_0x234165){return _0x234165[_0xbd06('0x38')](_0x39f276)[_0xbd06('0x26')](function(_0x2c83dc){return _0x2c83dc;});}return null;};}function removeEntity(_0x57a2da,_0x5b3851){return function(_0x5e6de7){if(_0x5e6de7){return _0x5e6de7[_0xbd06('0x39')]()[_0xbd06('0x26')](function(){_0x57a2da[_0xbd06('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20f3da,_0x4050e6){return function(_0x234722){if(!_0x234722){_0x20f3da[_0xbd06('0x2f')](0x194);}return _0x234722;};}function handleError(_0x14cdc4,_0xf497f){_0xf497f=_0xf497f||0x1f4;return function(_0x2b523d){logger[_0xbd06('0x2b')](_0x2b523d[_0xbd06('0x3a')]);if(_0x2b523d[_0xbd06('0x3b')]){delete _0x2b523d[_0xbd06('0x3b')];}_0x14cdc4[_0xbd06('0x30')](_0xf497f)['send'](_0x2b523d);};}exports[_0xbd06('0x3c')]=function(_0x45eeeb,_0x4503d9){var _0x319ca0={},_0x18c8dd={},_0x3a703c={'count':0x0,'rows':[]};var _0x827436=_[_0xbd06('0x3d')](db[_0xbd06('0x3e')][_0xbd06('0x3f')],function(_0x2c6ed6){return{'name':_0x2c6ed6[_0xbd06('0x40')],'type':_0x2c6ed6[_0xbd06('0x41')]['key']};});_0x18c8dd['model']=_['map'](_0x827436,_0xbd06('0x3b'));_0x18c8dd['query']=_[_0xbd06('0x42')](_0x45eeeb[_0xbd06('0x43')]);_0x18c8dd[_0xbd06('0x44')]=_[_0xbd06('0x45')](_0x18c8dd[_0xbd06('0x46')],_0x18c8dd[_0xbd06('0x43')]);_0x319ca0[_0xbd06('0x47')]=_['intersection'](_0x18c8dd[_0xbd06('0x46')],qs[_0xbd06('0x48')](_0x45eeeb['query'][_0xbd06('0x48')]));_0x319ca0['attributes']=_0x319ca0['attributes'][_0xbd06('0x49')]?_0x319ca0[_0xbd06('0x47')]:_0x18c8dd[_0xbd06('0x46')];if(!_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x4a')](_0xbd06('0x4b'))){_0x319ca0[_0xbd06('0x34')]=qs[_0xbd06('0x34')](_0x45eeeb['query'][_0xbd06('0x34')]);_0x319ca0[_0xbd06('0x33')]=qs['offset'](_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x33')]);}_0x319ca0[_0xbd06('0x4c')]=qs[_0xbd06('0x4d')](_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x4d')]);_0x319ca0[_0xbd06('0x4e')]=qs['filters'](_['pick'](_0x45eeeb[_0xbd06('0x43')],_0x18c8dd[_0xbd06('0x44')]),_0x827436);if(_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x4f')]){_0x319ca0['where']=_[_0xbd06('0x50')](_0x319ca0[_0xbd06('0x4e')],{'$or':_[_0xbd06('0x3d')](_0x827436,function(_0x8fb499){if(_0x8fb499[_0xbd06('0x41')]!=='VIRTUAL'){var _0x362d45={};_0x362d45[_0x8fb499[_0xbd06('0x3b')]]={'$like':'%'+_0x45eeeb[_0xbd06('0x43')]['filter']+'%'};return _0x362d45;}})});}_0x319ca0=_['merge']({},_0x319ca0,_0x45eeeb[_0xbd06('0x51')]);var _0x48b348={'where':_0x319ca0[_0xbd06('0x4e')]};return db[_0xbd06('0x3e')][_0xbd06('0x32')](_0x48b348)[_0xbd06('0x26')](function(_0x2e6615){_0x3a703c[_0xbd06('0x32')]=_0x2e6615;if(_0x45eeeb[_0xbd06('0x43')][_0xbd06('0x52')]){_0x319ca0[_0xbd06('0x53')]=[{'all':!![]}];}return db[_0xbd06('0x3e')][_0xbd06('0x54')](_0x319ca0);})[_0xbd06('0x26')](function(_0x3f7474){_0x3a703c[_0xbd06('0x55')]=_0x3f7474;return _0x3a703c;})['then'](respondWithFilteredResult(_0x4503d9,_0x319ca0))[_0xbd06('0x2e')](handleError(_0x4503d9,null));};exports['show']=function(_0x26c76f,_0x1bcd83){var _0x8405d7={'raw':!![],'where':{'id':_0x26c76f['params']['id']}},_0x40c123={};_0x40c123[_0xbd06('0x46')]=_[_0xbd06('0x42')](db['FaxMessage'][_0xbd06('0x3f')]);_0x40c123['query']=_[_0xbd06('0x42')](_0x26c76f[_0xbd06('0x43')]);_0x40c123[_0xbd06('0x44')]=_[_0xbd06('0x45')](_0x40c123[_0xbd06('0x46')],_0x40c123[_0xbd06('0x43')]);_0x8405d7[_0xbd06('0x47')]=_[_0xbd06('0x45')](_0x40c123[_0xbd06('0x46')],qs[_0xbd06('0x48')](_0x26c76f[_0xbd06('0x43')][_0xbd06('0x48')]));_0x8405d7[_0xbd06('0x47')]=_0x8405d7[_0xbd06('0x47')][_0xbd06('0x49')]?_0x8405d7[_0xbd06('0x47')]:_0x40c123[_0xbd06('0x46')];if(_0x26c76f[_0xbd06('0x43')][_0xbd06('0x52')]){_0x8405d7[_0xbd06('0x53')]=[{'all':!![]}];}_0x8405d7=_['merge']({},_0x8405d7,_0x26c76f[_0xbd06('0x51')]);return db['FaxMessage'][_0xbd06('0x56')](_0x8405d7)[_0xbd06('0x26')](handleEntityNotFound(_0x1bcd83,null))[_0xbd06('0x26')](respondWithResult(_0x1bcd83,null))[_0xbd06('0x2e')](handleError(_0x1bcd83,null));};exports[_0xbd06('0x38')]=function(_0x520652,_0x38a980){if(_0x520652[_0xbd06('0x57')]['id']){delete _0x520652['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0x520652[_0xbd06('0x58')]['id']}})[_0xbd06('0x26')](handleEntityNotFound(_0x38a980,null))[_0xbd06('0x26')](saveUpdates(_0x520652['body'],null))[_0xbd06('0x26')](respondWithResult(_0x38a980,null))['catch'](handleError(_0x38a980,null));};exports[_0xbd06('0x39')]=function(_0x156dfe,_0x32d48f){return db['FaxMessage'][_0xbd06('0x56')]({'where':{'id':_0x156dfe[_0xbd06('0x58')]['id']}})['then'](handleEntityNotFound(_0x32d48f,null))[_0xbd06('0x26')](removeEntity(_0x32d48f,null))[_0xbd06('0x2e')](handleError(_0x32d48f,null));};exports[_0xbd06('0x59')]=function(_0x1a9de4,_0x260613){return db[_0xbd06('0x3e')]['describe']()['then'](respondWithResult(_0x260613,null))['catch'](handleError(_0x260613,null));};var interaction_log=require(_0xbd06('0x14'))(_0xbd06('0x5a'));exports['accept']=function(_0x41fe1a,_0x35e9b9,_0xb06f89){var _0x354615={'channel':'fax'};if(_0x41fe1a[_0xbd06('0x57')]['id']){delete _0x41fe1a[_0xbd06('0x57')]['id'];}_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5b')]=!![];_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5c')]=moment()[_0xbd06('0x5d')](_0xbd06('0x5e'));_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5f')]=_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5f')]||_0x41fe1a[_0xbd06('0x60')]['id'];return db[_0xbd06('0x3e')][_0xbd06('0x56')]({'where':{'id':_0x41fe1a[_0xbd06('0x58')]['id'],'UserId':null},'include':[{'model':db[_0xbd06('0x61')],'as':'Contact'}]})[_0xbd06('0x26')](handleEntityNotFound(_0x35e9b9,null))[_0xbd06('0x26')](saveUpdates(_0x41fe1a[_0xbd06('0x57')],null))[_0xbd06('0x26')](function(_0xa866ee){if(_0xa866ee){_0x354615['message']=_0xa866ee[_0xbd06('0x62')]({'plain':!![]});return db[_0xbd06('0x63')][_0xbd06('0x56')]({'where':{'id':_0xa866ee[_0xbd06('0x64')]}});}return null;})[_0xbd06('0x26')](handleEntityNotFound(_0x35e9b9,null))['then'](function(_0x5947f3){if(_0x5947f3){return _0x5947f3[_0xbd06('0x38')]({'UserId':_0x41fe1a[_0xbd06('0x57')][_0xbd06('0x5f')],'read1stAt':_[_0xbd06('0x65')](_0x5947f3[_0xbd06('0x66')])?moment()[_0xbd06('0x5d')](_0xbd06('0x5e')):undefined});}return null;})[_0xbd06('0x26')](function(_0x2dd7c0){if(_0x2dd7c0){_0x354615[_0xbd06('0x67')]=_0x2dd7c0[_0xbd06('0x62')]({'plain':!![]});interaction_log[_0xbd06('0x68')](_0xbd06('0x69'),_0x41fe1a['user']['id'],_0x41fe1a[_0xbd06('0x60')][_0xbd06('0x3b')],_0x41fe1a[_0xbd06('0x60')][_0xbd06('0x6a')],_0x354615['interaction']['id'],_0x41fe1a[_0xbd06('0x57')]?JSON[_0xbd06('0x2a')](_0x41fe1a[_0xbd06('0x57')]):_0xbd06('0x6b'));return respondWithRpcPromise(_0xbd06('0x6c'),_0xbd06('0x6d'),_0x354615);}return null;})[_0xbd06('0x26')](function(_0x3031ef){if(_0x3031ef){if(_0x41fe1a[_0xbd06('0x57')]['manual']){_0x354615[_0xbd06('0x2c')][_0xbd06('0x6e')]=util['format'](_0xbd06('0x6f'),_0x41fe1a['user'][_0xbd06('0x3b')]);_0x354615[_0xbd06('0x2c')][_0xbd06('0x70')]=_0x354615[_0xbd06('0x70')];_0x354615['message'][_0xbd06('0x71')]='accept';return respondWithRpcPromise(_0xbd06('0x72'),'EventManager',{'event':'acceptmessage','message':_0x354615[_0xbd06('0x2c')]},client9002)[_0xbd06('0x26')](function(){return _0x354615;});}return _0x354615;}return null;})['then'](respondWithResult(_0x35e9b9,null))[_0xbd06('0x2e')](handleError(_0x35e9b9,null));};var interaction_log=require(_0xbd06('0x14'))(_0xbd06('0x5a'));exports[_0xbd06('0x37')]=function(_0x18bc01,_0x1ce439,_0x45f7c5){var _0x2ff98b={'agent':{},'channel':'fax'};if(_0x18bc01[_0xbd06('0x57')]['id']){delete _0x18bc01[_0xbd06('0x57')]['id'];}_0x18bc01['body'][_0xbd06('0x5f')]=_0x18bc01[_0xbd06('0x57')]['UserId']||_0x18bc01[_0xbd06('0x60')]['id'];_0x2ff98b[_0xbd06('0x73')]['id']=_0x18bc01['body'][_0xbd06('0x5f')];return db[_0xbd06('0x3e')][_0xbd06('0x56')]({'where':{'id':_0x18bc01[_0xbd06('0x58')]['id'],'UserId':null}})[_0xbd06('0x26')](handleEntityNotFound(_0x1ce439,null))[_0xbd06('0x26')](function(_0x32f69a){if(_0x32f69a){_0x2ff98b[_0xbd06('0x2c')]=_0x32f69a[_0xbd06('0x62')]({'plain':!![]});return db[_0xbd06('0x63')][_0xbd06('0x56')]({'where':{'id':_0x32f69a[_0xbd06('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1ce439,null))[_0xbd06('0x26')](function(_0x55ccab){if(_0x55ccab){_0x2ff98b['interaction']=_0x55ccab['get']({'plain':!![]});interaction_log[_0xbd06('0x68')](_0xbd06('0x74'),_0x18bc01[_0xbd06('0x60')]['id'],_0x18bc01[_0xbd06('0x60')][_0xbd06('0x3b')],_0x18bc01[_0xbd06('0x60')][_0xbd06('0x6a')],_0x2ff98b[_0xbd06('0x67')]['id'],_0x18bc01[_0xbd06('0x57')]?JSON[_0xbd06('0x2a')](_0x18bc01[_0xbd06('0x57')]):_0xbd06('0x6b'));return respondWithRpcPromise(_0xbd06('0x75'),_0xbd06('0x76'),_0x2ff98b);}return null;})[_0xbd06('0x26')](function(_0x5e83c1){if(_0x5e83c1){_0x5e83c1[_0xbd06('0x2c')][_0xbd06('0x6e')]=util[_0xbd06('0x5d')](_0xbd06('0x6f'),_0x18bc01[_0xbd06('0x60')]['name']);_0x5e83c1[_0xbd06('0x2c')][_0xbd06('0x70')]=_0x2ff98b['channel'];_0x5e83c1[_0xbd06('0x2c')][_0xbd06('0x71')]='reject';respondWithRpcPromise('EventManager',_0xbd06('0x72'),{'event':_0xbd06('0x77'),'message':_0x5e83c1['message']},client9002);return _0x2ff98b;}return null;})[_0xbd06('0x26')](respondWithResult(_0x1ce439,null))['catch'](handleError(_0x1ce439,null));};exports[_0xbd06('0x78')]=function(_0x1ae0df,_0x3afc00){var _0x302588;return db[_0xbd06('0x3e')]['create'](_0x1ae0df[_0xbd06('0x57')],{})[_0xbd06('0x26')](function(_0x102674){_0x302588=_0x102674;return db['CmContact'][_0xbd06('0x79')]({'where':{'id':_0x302588[_0xbd06('0x7a')]}});})[_0xbd06('0x26')](function(_0x10d849){if(_['isNil'](_0x10d849)){return;}else{_0x302588[_0xbd06('0x7b')]=_0x10d849[_0xbd06('0x7b')];return db[_0xbd06('0x7c')]['findOne']({'where':{'id':_0x302588[_0xbd06('0x7d')]}});}})[_0xbd06('0x26')](function(_0x4e7b61){return respondWithRpcPromise(_0xbd06('0x7e'),'SendFax',{'FaxAccountId':_[_0xbd06('0x65')](_0x1ae0df[_0xbd06('0x57')])?undefined:_0x1ae0df[_0xbd06('0x57')][_0xbd06('0x7f')],'path':_[_0xbd06('0x65')](_0x4e7b61)?undefined:util[_0xbd06('0x5d')](_0xbd06('0x80'),_0x4e7b61['basename']),'fax':_[_0xbd06('0x65')](_0x302588[_0xbd06('0x7b')])?undefined:_0x302588[_0xbd06('0x7b')],'AttachmentId':_0x302588[_0xbd06('0x7d')]},client9002);})[_0xbd06('0x26')](respondWithResult(_0x3afc00,0xc9))[_0xbd06('0x2e')](handleError(_0x3afc00,null));};exports[_0xbd06('0x81')]=function(_0x42de20,_0x5658c7){var _0x5afa08=path[_0xbd06('0x82')](config[_0xbd06('0x83')],_0xbd06('0x84'),'files',_0xbd06('0x85'));return db['FaxMessage'][_0xbd06('0x56')]({'where':{'id':_0x42de20['params']['id']},'include':[{'model':db[_0xbd06('0x7c')],'as':_0xbd06('0x7c')}]})[_0xbd06('0x26')](handleEntityNotFound(_0x5658c7,null))[_0xbd06('0x26')](function(_0x36f835){if(_0x36f835){return _0x5658c7[_0xbd06('0x81')](path['join'](_0x5afa08,_0x36f835[_0xbd06('0x7c')][_0xbd06('0x86')]));}})[_0xbd06('0x2e')](handleError(_0x5658c7,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index db710fc..e3b76ca 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x2cbc0b,_0x2f6971){var _0x62c915=function(_0x1cfbef){while(--_0x1cfbef){_0x2cbc0b['push'](_0x2cbc0b['shift']());}};_0x62c915(++_0x2f6971);}(_0x008c,0x188));var _0xc008=function(_0x38381f,_0x4eff8a){_0x38381f=_0x38381f-0x0;var _0x1c1631=_0x008c[_0x38381f];return _0x1c1631;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x1b5ee0,_0x390506){var _0x3e4c55=function(_0x2adceb){while(--_0x2adceb){_0x1b5ee0['push'](_0x1b5ee0['shift']());}};_0x3e4c55(++_0x390506);}(_0x008c,0x188));var _0xc008=function(_0xc81f5f,_0x181205){_0xc81f5f=_0xc81f5f-0x0;var _0x4410dc=_0x008c[_0xc81f5f];return _0x4410dc;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 77b561b..35e8c99 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 _0x4329=['FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./faxMessage.attributes','exports','define'];(function(_0x4f1cee,_0x35f397){var _0x2f4572=function(_0x54b323){while(--_0x54b323){_0x4f1cee['push'](_0x4f1cee['shift']());}};_0x2f4572(++_0x35f397);}(_0x4329,0x18c));var _0x9432=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x4329[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var logger=require(_0x9432('0x2'))('api');var moment=require(_0x9432('0x3'));var BPromise=require(_0x9432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9432('0x5'));var rimraf=require('rimraf');var config=require(_0x9432('0x6'));var attributes=require(_0x9432('0x7'));module[_0x9432('0x8')]=function(_0x1cd073,_0x15ef52){return _0x1cd073[_0x9432('0x9')](_0x9432('0xa'),attributes,{'tableName':_0x9432('0xb'),'paranoid':![],'indexes':[{'name':_0x9432('0xc'),'fields':[_0x9432('0xd')],'type':_0x9432('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49cd0a,_0x1047b7,_0x221e57){var _0x2dd420=_0x1cd073[_0x9432('0xf')];var _0x35e014=_0x49cd0a['get']({'plain':!![]});if(_0x35e014[_0x9432('0x10')]['toLowerCase']()==='in'||_0x35e014[_0x9432('0x10')][_0x9432('0x11')]()==='out'&&!_0x35e014['secret']&&!_[_0x9432('0x12')](_0x35e014[_0x9432('0x13')])){_0x2dd420[_0x9432('0x14')][_0x9432('0x15')]({'where':{'id':_0x35e014[_0x9432('0x16')]}})['then'](function(_0xcb5014){if(_0xcb5014){_0xcb5014[_0x9432('0x17')]({'lastMsgAt':_0x35e014[_0x9432('0x18')],'lastMsgDirection':_0x35e014['direction'][_0x9432('0x11')]()});}})[_0x9432('0x19')](function(_0x5624fb){console[_0x9432('0x1a')](_0x5624fb);});}_0x221e57();}},'charset':_0x9432('0x1b'),'collate':_0x9432('0x1c')});}; \ No newline at end of file +var _0xddca=['out','secret','isNil','UserId','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','body','get','toLowerCase'];(function(_0x4b935f,_0x2a6cb5){var _0x2e4202=function(_0x3bf6f4){while(--_0x3bf6f4){_0x4b935f['push'](_0x4b935f['shift']());}};_0x2e4202(++_0x2a6cb5);}(_0xddca,0x1a0));var _0xaddc=function(_0x8f095e,_0x25bccb){_0x8f095e=_0x8f095e-0x0;var _0x29d39c=_0xddca[_0x8f095e];return _0x29d39c;};'use strict';var _=require(_0xaddc('0x0'));var util=require('util');var logger=require(_0xaddc('0x1'))(_0xaddc('0x2'));var moment=require(_0xaddc('0x3'));var BPromise=require(_0xaddc('0x4'));var rp=require(_0xaddc('0x5'));var fs=require('fs');var path=require(_0xaddc('0x6'));var rimraf=require(_0xaddc('0x7'));var config=require(_0xaddc('0x8'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0xa970d6,_0x5910dc){return _0xa970d6[_0xaddc('0x9')](_0xaddc('0xa'),attributes,{'tableName':_0xaddc('0xb'),'paranoid':![],'indexes':[{'name':_0xaddc('0xc'),'fields':[_0xaddc('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d69ab,_0xf3af45,_0x57a526){var _0x4e6a88=_0xa970d6['models'];var _0x4071ab=_0x3d69ab[_0xaddc('0xe')]({'plain':!![]});if(_0x4071ab['direction']['toLowerCase']()==='in'||_0x4071ab['direction'][_0xaddc('0xf')]()===_0xaddc('0x10')&&!_0x4071ab[_0xaddc('0x11')]&&!_[_0xaddc('0x12')](_0x4071ab[_0xaddc('0x13')])){_0x4e6a88['FaxInteraction'][_0xaddc('0x14')]({'where':{'id':_0x4071ab['FaxInteractionId']}})['then'](function(_0x2f35b4){if(_0x2f35b4){_0x2f35b4[_0xaddc('0x15')]({'lastMsgAt':_0x4071ab[_0xaddc('0x16')],'lastMsgDirection':_0x4071ab['direction'][_0xaddc('0xf')]()});}})[_0xaddc('0x17')](function(_0x538249){console[_0xaddc('0x18')](_0x538249);});}_0x57a526();}},'charset':_0xaddc('0x19'),'collate':_0xaddc('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6f902a9..f6e159a 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 _0x2d19=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x2d19,0x1b5));var _0x92d1=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x2d19[_0x3ee1fe];return _0x1ae57a;};'use strict';var _=require(_0x92d1('0x0'));var util=require('util');var moment=require(_0x92d1('0x1'));var BPromise=require(_0x92d1('0x2'));var rs=require(_0x92d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92d1('0x4'))['db'];var utils=require(_0x92d1('0x5'));var logger=require('../../config/logger')(_0x92d1('0x6'));var config=require(_0x92d1('0x7'));var jayson=require(_0x92d1('0x8'));var client=jayson['client'][_0x92d1('0x9')]({'port':0x232a});config[_0x92d1('0xa')]=_[_0x92d1('0xb')](config[_0x92d1('0xa')],{'host':_0x92d1('0xc'),'port':0x18eb});var socket=require(_0x92d1('0xd'))(new Redis(config[_0x92d1('0xa')]));require(_0x92d1('0xe'))[_0x92d1('0xf')](socket);function respondWithRpcPromise(_0x2c0e1f,_0x4d8047,_0x12b6d0){return new BPromise(function(_0x1424e7,_0x4c941b){return client['request'](_0x2c0e1f,_0x12b6d0)['then'](function(_0x3b116b){logger[_0x92d1('0x10')](_0x92d1('0x11'),_0x4d8047,_0x92d1('0x12'));logger[_0x92d1('0x13')](_0x92d1('0x14'),_0x4d8047,'request\x20sent',JSON[_0x92d1('0x15')](_0x3b116b));if(_0x3b116b[_0x92d1('0x16')]){if(_0x3b116b[_0x92d1('0x16')][_0x92d1('0x17')]===0x1f4){logger[_0x92d1('0x16')](_0x92d1('0x11'),_0x4d8047,_0x3b116b[_0x92d1('0x16')][_0x92d1('0x18')]);return _0x4c941b(_0x3b116b[_0x92d1('0x16')][_0x92d1('0x18')]);}logger['error'](_0x92d1('0x11'),_0x4d8047,_0x3b116b[_0x92d1('0x16')][_0x92d1('0x18')]);return _0x1424e7(_0x3b116b[_0x92d1('0x16')][_0x92d1('0x18')]);}else{logger[_0x92d1('0x10')](_0x92d1('0x11'),_0x4d8047,_0x92d1('0x12'));_0x1424e7(_0x3b116b[_0x92d1('0x19')][_0x92d1('0x18')]);}})[_0x92d1('0x1a')](function(_0x3e54ad){logger['error'](_0x92d1('0x11'),_0x4d8047,_0x3e54ad);_0x4c941b(_0x3e54ad);});});}exports[_0x92d1('0x1b')]=function(_0x402ab1){var _0x408a8a=this;return new Promise(function(_0xfedfdb,_0x150fa2){return db[_0x92d1('0x1c')]['create'](_0x402ab1[_0x92d1('0x1d')],{'raw':_0x402ab1[_0x92d1('0x1e')]?_0x402ab1['options'][_0x92d1('0x1f')]===undefined?!![]:![]:!![]})[_0x92d1('0x20')](function(_0xd72da8){logger[_0x92d1('0x10')](_0x92d1('0x1b'),_0x402ab1);logger['debug'](_0x92d1('0x1b'),_0x402ab1,JSON[_0x92d1('0x15')](_0xd72da8));_0xfedfdb(_0xd72da8);})[_0x92d1('0x1a')](function(_0x2945ac){logger[_0x92d1('0x16')](_0x92d1('0x1b'),_0x2945ac[_0x92d1('0x18')],_0x402ab1);_0x150fa2(_0x408a8a[_0x92d1('0x16')](0x1f4,_0x2945ac[_0x92d1('0x18')]));});});};exports[_0x92d1('0x21')]=function(_0x2e4f06){var _0x4be738=this;return new Promise(function(_0x41c695,_0x3315d5){return db['FaxMessage'][_0x92d1('0x22')](_0x2e4f06[_0x92d1('0x1d')],{'raw':_0x2e4f06['options']?_0x2e4f06[_0x92d1('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e4f06[_0x92d1('0x1e')]?_0x2e4f06[_0x92d1('0x1e')][_0x92d1('0x23')]||null:null,'attributes':_0x2e4f06[_0x92d1('0x1e')]?_0x2e4f06[_0x92d1('0x1e')][_0x92d1('0x24')]||null:null,'limit':_0x2e4f06[_0x92d1('0x1e')]?_0x2e4f06[_0x92d1('0x1e')][_0x92d1('0x25')]||null:null})[_0x92d1('0x20')](function(_0x33dfe0){logger[_0x92d1('0x10')](_0x92d1('0x21'),_0x2e4f06);logger[_0x92d1('0x13')](_0x92d1('0x21'),_0x2e4f06,JSON[_0x92d1('0x15')](_0x33dfe0));_0x41c695(_0x33dfe0);})['catch'](function(_0x2f9fe8){logger[_0x92d1('0x16')](_0x92d1('0x21'),_0x2f9fe8['message'],_0x2e4f06);_0x3315d5(_0x4be738[_0x92d1('0x16')](0x1f4,_0x2f9fe8[_0x92d1('0x18')]));});});}; \ No newline at end of file +var _0xb95e=['options','raw','then','CreateFaxMessage','catch','update','where','UpdateFaxMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxMessage','create','body'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb95e,0x128));var _0xeb95=function(_0x224fbf,_0x6ecead){_0x224fbf=_0x224fbf-0x0;var _0x18a98f=_0xb95e[_0x224fbf];return _0x18a98f;};'use strict';var _=require(_0xeb95('0x0'));var util=require('util');var moment=require(_0xeb95('0x1'));var BPromise=require(_0xeb95('0x2'));var rs=require(_0xeb95('0x3'));var fs=require('fs');var Redis=require(_0xeb95('0x4'));var db=require(_0xeb95('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb95('0x6'))(_0xeb95('0x7'));var config=require(_0xeb95('0x8'));var jayson=require(_0xeb95('0x9'));var client=jayson['client'][_0xeb95('0xa')]({'port':0x232a});config[_0xeb95('0xb')]=_[_0xeb95('0xc')](config['redis'],{'host':_0xeb95('0xd'),'port':0x18eb});var socket=require(_0xeb95('0xe'))(new Redis(config[_0xeb95('0xb')]));require(_0xeb95('0xf'))[_0xeb95('0x10')](socket);function respondWithRpcPromise(_0x58b459,_0xf9e219,_0xc0a5c0){return new BPromise(function(_0x1fa1ca,_0x5178e3){return client['request'](_0x58b459,_0xc0a5c0)['then'](function(_0x3d2fb7){logger[_0xeb95('0x11')](_0xeb95('0x12'),_0xf9e219,_0xeb95('0x13'));logger[_0xeb95('0x14')](_0xeb95('0x15'),_0xf9e219,_0xeb95('0x13'),JSON[_0xeb95('0x16')](_0x3d2fb7));if(_0x3d2fb7[_0xeb95('0x17')]){if(_0x3d2fb7[_0xeb95('0x17')]['code']===0x1f4){logger['error'](_0xeb95('0x12'),_0xf9e219,_0x3d2fb7[_0xeb95('0x17')][_0xeb95('0x18')]);return _0x5178e3(_0x3d2fb7[_0xeb95('0x17')]['message']);}logger[_0xeb95('0x17')]('FaxMessage,\x20%s,\x20%s',_0xf9e219,_0x3d2fb7[_0xeb95('0x17')][_0xeb95('0x18')]);return _0x1fa1ca(_0x3d2fb7['error'][_0xeb95('0x18')]);}else{logger[_0xeb95('0x11')](_0xeb95('0x12'),_0xf9e219,_0xeb95('0x13'));_0x1fa1ca(_0x3d2fb7['result'][_0xeb95('0x18')]);}})['catch'](function(_0x395f5c){logger['error'](_0xeb95('0x12'),_0xf9e219,_0x395f5c);_0x5178e3(_0x395f5c);});});}exports['CreateFaxMessage']=function(_0x1a874c){var _0x3ae8e9=this;return new Promise(function(_0x449238,_0x21e0e6){return db[_0xeb95('0x19')][_0xeb95('0x1a')](_0x1a874c[_0xeb95('0x1b')],{'raw':_0x1a874c['options']?_0x1a874c[_0xeb95('0x1c')][_0xeb95('0x1d')]===undefined?!![]:![]:!![]})[_0xeb95('0x1e')](function(_0x41ee85){logger['info'](_0xeb95('0x1f'),_0x1a874c);logger[_0xeb95('0x14')](_0xeb95('0x1f'),_0x1a874c,JSON['stringify'](_0x41ee85));_0x449238(_0x41ee85);})[_0xeb95('0x20')](function(_0xa50a8d){logger[_0xeb95('0x17')](_0xeb95('0x1f'),_0xa50a8d[_0xeb95('0x18')],_0x1a874c);_0x21e0e6(_0x3ae8e9[_0xeb95('0x17')](0x1f4,_0xa50a8d[_0xeb95('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x2056d5){var _0x6f2caf=this;return new Promise(function(_0x11fafc,_0x2230b0){return db['FaxMessage'][_0xeb95('0x21')](_0x2056d5[_0xeb95('0x1b')],{'raw':_0x2056d5[_0xeb95('0x1c')]?_0x2056d5[_0xeb95('0x1c')][_0xeb95('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2056d5['options']?_0x2056d5[_0xeb95('0x1c')][_0xeb95('0x22')]||null:null,'attributes':_0x2056d5[_0xeb95('0x1c')]?_0x2056d5[_0xeb95('0x1c')]['attributes']||null:null,'limit':_0x2056d5[_0xeb95('0x1c')]?_0x2056d5[_0xeb95('0x1c')]['limit']||null:null})[_0xeb95('0x1e')](function(_0x4fa215){logger[_0xeb95('0x11')](_0xeb95('0x23'),_0x2056d5);logger['debug'](_0xeb95('0x23'),_0x2056d5,JSON['stringify'](_0x4fa215));_0x11fafc(_0x4fa215);})[_0xeb95('0x20')](function(_0x5cf992){logger[_0xeb95('0x17')](_0xeb95('0x23'),_0x5cf992[_0xeb95('0x18')],_0x2056d5);_0x2230b0(_0x6f2caf[_0xeb95('0x17')](0x1f4,_0x5cf992[_0xeb95('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 6382d0c..d89a029 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(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index ad14bfc..e77c22d 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 _0x5981=['describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe'];(function(_0x1ad092,_0x1b68ba){var _0x3a3c3e=function(_0x867ba8){while(--_0x867ba8){_0x1ad092['push'](_0x1ad092['shift']());}};_0x3a3c3e(++_0x1b68ba);}(_0x5981,0xa7));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1598('0x0'));var util=require(_0x1598('0x1'));var path=require(_0x1598('0x2'));var timeout=require(_0x1598('0x3'));var express=require(_0x1598('0x4'));var router=express[_0x1598('0x5')]();var auth=require(_0x1598('0x6'));var interaction=require(_0x1598('0x7'));var config=require(_0x1598('0x8'));var controller=require(_0x1598('0x9'));router['get']('/',auth[_0x1598('0xa')](),controller['index']);router[_0x1598('0xb')](_0x1598('0xc'),auth[_0x1598('0xa')](),controller[_0x1598('0xd')]);router[_0x1598('0xb')](_0x1598('0xe'),auth[_0x1598('0xa')](),controller[_0x1598('0xf')]);router[_0x1598('0xb')](_0x1598('0x10'),auth[_0x1598('0xa')](),controller['download']);router[_0x1598('0x11')]('/',auth[_0x1598('0xa')](),interaction[_0x1598('0x12')](_0x1598('0x13'),_0x1598('0x14')),controller[_0x1598('0x15')]);router[_0x1598('0x16')]('/:id',auth[_0x1598('0xa')](),controller['update']);router[_0x1598('0x16')](_0x1598('0x17'),auth[_0x1598('0xa')](),controller[_0x1598('0x18')]);router[_0x1598('0x16')](_0x1598('0x19'),auth[_0x1598('0xa')](),controller[_0x1598('0x1a')]);router[_0x1598('0x1b')]('/:id',auth[_0x1598('0xa')](),controller[_0x1598('0x1c')]);module[_0x1598('0x1d')]=router; \ No newline at end of file +var _0x7c5e=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','tracked','fax','faxmessage:create','put','/:id/accept','accept','/:id/reject','exports','multer'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x7c5e,0x11d));var _0xe7c5=function(_0x4779d6,_0x51a72b){_0x4779d6=_0x4779d6-0x0;var _0x10139f=_0x7c5e[_0x4779d6];return _0x10139f;};'use strict';var multer=require(_0xe7c5('0x0'));var util=require(_0xe7c5('0x1'));var path=require(_0xe7c5('0x2'));var timeout=require(_0xe7c5('0x3'));var express=require(_0xe7c5('0x4'));var router=express[_0xe7c5('0x5')]();var auth=require(_0xe7c5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe7c5('0x7'));var controller=require(_0xe7c5('0x8'));router[_0xe7c5('0x9')]('/',auth[_0xe7c5('0xa')](),controller[_0xe7c5('0xb')]);router[_0xe7c5('0x9')](_0xe7c5('0xc'),auth[_0xe7c5('0xa')](),controller[_0xe7c5('0xd')]);router[_0xe7c5('0x9')](_0xe7c5('0xe'),auth[_0xe7c5('0xa')](),controller[_0xe7c5('0xf')]);router[_0xe7c5('0x9')](_0xe7c5('0x10'),auth['isAuthenticated'](),controller[_0xe7c5('0x11')]);router['post']('/',auth[_0xe7c5('0xa')](),interaction[_0xe7c5('0x12')](_0xe7c5('0x13'),_0xe7c5('0x14')),controller['create']);router[_0xe7c5('0x15')](_0xe7c5('0xe'),auth[_0xe7c5('0xa')](),controller['update']);router['put'](_0xe7c5('0x16'),auth['isAuthenticated'](),controller[_0xe7c5('0x17')]);router[_0xe7c5('0x15')](_0xe7c5('0x18'),auth[_0xe7c5('0xa')](),controller['reject']);router['delete'](_0xe7c5('0xe'),auth[_0xe7c5('0xa')](),controller['destroy']);module[_0xe7c5('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 08070f2..c537828 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 _0x669d=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x841d72,_0x5b127a){var _0x1c5dc7=function(_0x251ba9){while(--_0x251ba9){_0x841d72['push'](_0x841d72['shift']());}};_0x1c5dc7(++_0x5b127a);}(_0x669d,0xc9));var _0xd669=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x669d[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0xd669('0x0'));module[_0xd669('0x1')]={'name':{'type':Sequelize[_0xd669('0x2')],'unique':_0xd669('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd669('0x2')]},'timeout':{'type':Sequelize[_0xd669('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd669('0x5')](_0xd669('0x6'),'beepall',_0xd669('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd669('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1032=['exports','name','STRING','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x39d73a,_0x2f8047){var _0x1ad707=function(_0x8a7fd){while(--_0x8a7fd){_0x39d73a['push'](_0x39d73a['shift']());}};_0x1ad707(++_0x2f8047);}(_0x1032,0x1cd));var _0x2103=function(_0x53ed48,_0xf76bb7){_0x53ed48=_0x53ed48-0x0;var _0x6129d0=_0x1032[_0x53ed48];return _0x6129d0;};'use strict';var Sequelize=require(_0x2103('0x0'));module[_0x2103('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2103('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2103('0x3')]},'timeout':{'type':Sequelize[_0x2103('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2103('0x5')](_0x2103('0x6'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2103('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 acea56a..498f236 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 _0x6f18=['forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','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','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','type','model','keys','query','filters','attributes','intersection','fields','length','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserFaxQueue','nolimit','FaxQueueId','findAll','User','findAndCountAll','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','pick','hasOwnProperty','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','compact','transaction','removeAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f18,0x1b4));var _0x86f1=function(_0x51a6bf,_0x5eb1ee){_0x51a6bf=_0x51a6bf-0x0;var _0x4a39b4=_0x6f18[_0x51a6bf];return _0x4a39b4;};'use strict';var pdf=require(_0x86f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x86f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86f1('0x2'));var rp=require(_0x86f1('0x3'));var moment=require('moment');var BPromise=require(_0x86f1('0x4'));var Mustache=require(_0x86f1('0x5'));var util=require('util');var path=require(_0x86f1('0x6'));var sox=require(_0x86f1('0x7'));var csv=require(_0x86f1('0x8'));var ejs=require(_0x86f1('0x9'));var fs=require('fs');var _=require(_0x86f1('0xa'));var squel=require('squel');var crypto=require(_0x86f1('0xb'));var jsforce=require(_0x86f1('0xc'));var deskjs=require(_0x86f1('0xd'));var toCsv=require(_0x86f1('0x8'));var querystring=require(_0x86f1('0xe'));var Papa=require('papaparse');var Redis=require(_0x86f1('0xf'));var authService=require(_0x86f1('0x10'));var qs=require(_0x86f1('0x11'));var as=require(_0x86f1('0x12'));var hardwareService=require(_0x86f1('0x13'));var logger=require(_0x86f1('0x14'))(_0x86f1('0x15'));var utils=require(_0x86f1('0x16'));var config=require('../../config/environment');var db=require(_0x86f1('0x17'))['db'];config[_0x86f1('0x18')]=_[_0x86f1('0x19')](config[_0x86f1('0x18')],{'host':_0x86f1('0x1a'),'port':0x18eb});var socket=require(_0x86f1('0x1b'))(new Redis(config['redis']));require(_0x86f1('0x1c'))[_0x86f1('0x1d')](socket);function respondWithStatusCode(_0x1b16ff,_0x648502){_0x648502=_0x648502||0xcc;return function(_0x2a2281){if(_0x2a2281){return _0x1b16ff[_0x86f1('0x1e')](_0x648502);}return _0x1b16ff[_0x86f1('0x1f')](_0x648502)[_0x86f1('0x20')]();};}function respondWithResult(_0x512cde,_0x2cae10){_0x2cae10=_0x2cae10||0xc8;return function(_0x15abcb){if(_0x15abcb){return _0x512cde[_0x86f1('0x1f')](_0x2cae10)[_0x86f1('0x21')](_0x15abcb);}};}function respondWithFilteredResult(_0x2ffc52,_0x129b03){return function(_0x290bca){if(_0x290bca){var _0x7e1756=_0x290bca[_0x86f1('0x22')],_0x1adad5=_0x129b03[_0x86f1('0x23')],_0x4fd6dc=_0x129b03['offset']+_0x129b03['limit'],_0x144018;if(_0x4fd6dc>=_0x7e1756){_0x4fd6dc=_0x7e1756;_0x144018=0xc8;}else{_0x144018=0xce;}_0x2ffc52[_0x86f1('0x1f')](_0x144018);return _0x2ffc52[_0x86f1('0x24')](_0x86f1('0x25'),_0x1adad5+'-'+_0x4fd6dc+'/'+_0x7e1756)[_0x86f1('0x21')](_0x290bca);}return null;};}function patchUpdates(_0xabac12){return function(_0x2196fd){try{jsonpatch[_0x86f1('0x26')](_0x2196fd,_0xabac12,!![]);}catch(_0xe937bc){return BPromise[_0x86f1('0x27')](_0xe937bc);}return _0x2196fd[_0x86f1('0x28')]();};}function saveUpdates(_0x4c13ed,_0x9fced7){return function(_0x22e66f){if(_0x22e66f){return _0x22e66f[_0x86f1('0x29')](_0x4c13ed)['then'](function(_0xe41503){return _0xe41503;});}return null;};}function removeEntity(_0x4b3b6c,_0x398224){return function(_0x6cba5c){if(_0x6cba5c){return _0x6cba5c[_0x86f1('0x2a')]()[_0x86f1('0x2b')](function(){var _0x57573=_0x6cba5c[_0x86f1('0x2c')]({'plain':!![]});var _0x282155=_0x86f1('0x2d');return db[_0x86f1('0x2e')][_0x86f1('0x2a')]({'where':{'type':_0x282155,'resourceId':_0x57573['id']}})[_0x86f1('0x2b')](function(){return _0x6cba5c;});})['then'](function(){_0x4b3b6c[_0x86f1('0x1f')](0xcc)[_0x86f1('0x20')]();});}};}function handleEntityNotFound(_0x5f575b,_0x4e98b7){return function(_0x360480){if(!_0x360480){_0x5f575b[_0x86f1('0x1e')](0x194);}return _0x360480;};}function handleError(_0x39685e,_0x5f18ad){_0x5f18ad=_0x5f18ad||0x1f4;return function(_0x16e3b3){logger[_0x86f1('0x2f')](_0x16e3b3['stack']);if(_0x16e3b3[_0x86f1('0x30')]){delete _0x16e3b3[_0x86f1('0x30')];}_0x39685e[_0x86f1('0x1f')](_0x5f18ad)[_0x86f1('0x31')](_0x16e3b3);};}exports[_0x86f1('0x32')]=function(_0x48b21b,_0x57e4f2){var _0x486991={},_0x82c486={},_0x18dea6={'count':0x0,'rows':[]};var _0x34e4c1=_[_0x86f1('0x33')](db[_0x86f1('0x34')]['rawAttributes'],function(_0x2dc7d7){return{'name':_0x2dc7d7['fieldName'],'type':_0x2dc7d7[_0x86f1('0x35')]['key']};});_0x82c486[_0x86f1('0x36')]=_[_0x86f1('0x33')](_0x34e4c1,_0x86f1('0x30'));_0x82c486['query']=_[_0x86f1('0x37')](_0x48b21b[_0x86f1('0x38')]);_0x82c486[_0x86f1('0x39')]=_['intersection'](_0x82c486['model'],_0x82c486[_0x86f1('0x38')]);_0x486991[_0x86f1('0x3a')]=_[_0x86f1('0x3b')](_0x82c486[_0x86f1('0x36')],qs[_0x86f1('0x3c')](_0x48b21b[_0x86f1('0x38')][_0x86f1('0x3c')]));_0x486991[_0x86f1('0x3a')]=_0x486991[_0x86f1('0x3a')][_0x86f1('0x3d')]?_0x486991[_0x86f1('0x3a')]:_0x82c486[_0x86f1('0x36')];if(!_0x48b21b[_0x86f1('0x38')]['hasOwnProperty']('nolimit')){_0x486991[_0x86f1('0x3e')]=qs['limit'](_0x48b21b['query'][_0x86f1('0x3e')]);_0x486991[_0x86f1('0x23')]=qs[_0x86f1('0x23')](_0x48b21b[_0x86f1('0x38')][_0x86f1('0x23')]);}_0x486991[_0x86f1('0x3f')]=qs['sort'](_0x48b21b['query'][_0x86f1('0x40')]);_0x486991[_0x86f1('0x41')]=qs['filters'](_['pick'](_0x48b21b['query'],_0x82c486[_0x86f1('0x39')]),_0x34e4c1);if(_0x48b21b[_0x86f1('0x38')][_0x86f1('0x42')]){_0x486991[_0x86f1('0x41')]=_['merge'](_0x486991[_0x86f1('0x41')],{'$or':_[_0x86f1('0x33')](_0x34e4c1,function(_0xfb6d2){if(_0xfb6d2[_0x86f1('0x35')]!==_0x86f1('0x43')){var _0x345ef0={};_0x345ef0[_0xfb6d2[_0x86f1('0x30')]]={'$like':'%'+_0x48b21b[_0x86f1('0x38')]['filter']+'%'};return _0x345ef0;}})});}_0x486991=_[_0x86f1('0x44')]({},_0x486991,_0x48b21b[_0x86f1('0x45')]);var _0x382196={'where':_0x486991[_0x86f1('0x41')]};return db[_0x86f1('0x34')][_0x86f1('0x22')](_0x382196)[_0x86f1('0x2b')](function(_0x618ad9){_0x18dea6[_0x86f1('0x22')]=_0x618ad9;if(_0x48b21b[_0x86f1('0x38')][_0x86f1('0x46')]){_0x486991[_0x86f1('0x47')]=[{'all':!![]}];}return db[_0x86f1('0x34')]['findAll'](_0x486991);})['then'](function(_0x30ec49){_0x18dea6[_0x86f1('0x48')]=_0x30ec49;return _0x18dea6;})[_0x86f1('0x2b')](respondWithFilteredResult(_0x57e4f2,_0x486991))[_0x86f1('0x49')](handleError(_0x57e4f2,null));};exports[_0x86f1('0x4a')]=function(_0x32a455,_0x1b0918){var _0x561058={'raw':!![],'where':{'id':_0x32a455['params']['id']}},_0x40c8af={};_0x40c8af[_0x86f1('0x36')]=_['keys'](db[_0x86f1('0x34')][_0x86f1('0x4b')]);_0x40c8af[_0x86f1('0x38')]=_[_0x86f1('0x37')](_0x32a455[_0x86f1('0x38')]);_0x40c8af[_0x86f1('0x39')]=_[_0x86f1('0x3b')](_0x40c8af[_0x86f1('0x36')],_0x40c8af[_0x86f1('0x38')]);_0x561058[_0x86f1('0x3a')]=_[_0x86f1('0x3b')](_0x40c8af[_0x86f1('0x36')],qs[_0x86f1('0x3c')](_0x32a455['query'][_0x86f1('0x3c')]));_0x561058[_0x86f1('0x3a')]=_0x561058[_0x86f1('0x3a')][_0x86f1('0x3d')]?_0x561058[_0x86f1('0x3a')]:_0x40c8af['model'];if(_0x32a455[_0x86f1('0x38')][_0x86f1('0x46')]){_0x561058[_0x86f1('0x47')]=[{'all':!![]}];}_0x561058=_[_0x86f1('0x44')]({},_0x561058,_0x32a455[_0x86f1('0x45')]);return db[_0x86f1('0x34')][_0x86f1('0x4c')](_0x561058)['then'](handleEntityNotFound(_0x1b0918,null))['then'](respondWithResult(_0x1b0918,null))[_0x86f1('0x49')](handleError(_0x1b0918,null));};exports['create']=function(_0x28c671,_0x2fe07b){return db['FaxQueue'][_0x86f1('0x4d')](_0x28c671[_0x86f1('0x4e')],{})[_0x86f1('0x2b')](function(_0x2e5d29){var _0x32ad7c=_0x28c671['user']['get']({'plain':!![]});if(!_0x32ad7c)throw new Error(_0x86f1('0x4f'));if(_0x32ad7c[_0x86f1('0x50')]===_0x86f1('0x51')){var _0x961ea3=_0x2e5d29[_0x86f1('0x2c')]({'plain':!![]});var _0x2cb1d3=_0x86f1('0x2d');return db['UserProfileSection'][_0x86f1('0x4c')]({'where':{'name':_0x2cb1d3,'userProfileId':_0x32ad7c[_0x86f1('0x52')]},'raw':!![]})[_0x86f1('0x2b')](function(_0x15838a){if(_0x15838a&&_0x15838a[_0x86f1('0x53')]===0x0){return db[_0x86f1('0x2e')][_0x86f1('0x4d')]({'name':_0x961ea3[_0x86f1('0x30')],'resourceId':_0x961ea3['id'],'type':_0x15838a['name'],'sectionId':_0x15838a['id']},{})[_0x86f1('0x2b')](function(){return _0x2e5d29;});}else{return _0x2e5d29;}})['catch'](function(_0x4f335c){logger[_0x86f1('0x2f')](_0x86f1('0x54'),_0x4f335c);throw _0x4f335c;});}return _0x2e5d29;})['then'](respondWithResult(_0x2fe07b,0xc9))[_0x86f1('0x49')](handleError(_0x2fe07b,null));};exports[_0x86f1('0x29')]=function(_0xb5c3db,_0x1ea9f2){if(_0xb5c3db['body']['id']){delete _0xb5c3db['body']['id'];}return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0xb5c3db[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x1ea9f2,null))['then'](saveUpdates(_0xb5c3db[_0x86f1('0x4e')],null))[_0x86f1('0x2b')](respondWithResult(_0x1ea9f2,null))[_0x86f1('0x49')](handleError(_0x1ea9f2,null));};exports[_0x86f1('0x2a')]=function(_0x2f788b,_0x1a72bb){return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x2f788b[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x1a72bb,null))[_0x86f1('0x2b')](removeEntity(_0x1a72bb,null))[_0x86f1('0x49')](handleError(_0x1a72bb,null));};exports[_0x86f1('0x56')]=function(_0x1fdfbe,_0x297635){return db[_0x86f1('0x34')]['describe']()[_0x86f1('0x2b')](respondWithResult(_0x297635,null))['catch'](handleError(_0x297635,null));};exports['getMembers']=function(_0x20e162,_0x70be66,_0x490d65){var _0x5a65a5={'raw':!![],'where':{}},_0xb2e276={},_0x4f5cb4;return db[_0x86f1('0x34')][_0x86f1('0x57')]({'where':{'id':_0x20e162[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x70be66,null))[_0x86f1('0x2b')](function(_0x59b7dd){if(_0x59b7dd){_0x4f5cb4=_0x59b7dd['get']({'plain':!![]});_0xb2e276[_0x86f1('0x36')]=_[_0x86f1('0x37')](db[_0x86f1('0x58')][_0x86f1('0x4b')]);_0xb2e276[_0x86f1('0x38')]=_[_0x86f1('0x37')](_0x20e162['query']);_0xb2e276['filters']=_[_0x86f1('0x3b')](_0xb2e276['model'],_0xb2e276[_0x86f1('0x38')]);_0x5a65a5['attributes']=_[_0x86f1('0x3b')](_0xb2e276['model'],qs[_0x86f1('0x3c')](_0x20e162[_0x86f1('0x38')][_0x86f1('0x3c')]));_0x5a65a5[_0x86f1('0x3a')]=_0x5a65a5['attributes'][_0x86f1('0x3d')]?_0x5a65a5[_0x86f1('0x3a')]:_0xb2e276[_0x86f1('0x36')];if(!_0x20e162[_0x86f1('0x38')]['hasOwnProperty'](_0x86f1('0x59'))){_0x5a65a5[_0x86f1('0x3e')]=qs[_0x86f1('0x3e')](_0x20e162[_0x86f1('0x38')][_0x86f1('0x3e')]);_0x5a65a5['offset']=qs[_0x86f1('0x23')](_0x20e162['query'][_0x86f1('0x23')]);}_0x5a65a5[_0x86f1('0x3f')]=qs[_0x86f1('0x40')](_0x20e162[_0x86f1('0x38')][_0x86f1('0x40')]);_0x5a65a5[_0x86f1('0x41')]=qs[_0x86f1('0x39')](_['pick'](_0x20e162['query'],_0xb2e276[_0x86f1('0x39')]));_0x5a65a5['where'][_0x86f1('0x5a')]=_0x59b7dd['id'];if(_0x20e162[_0x86f1('0x38')][_0x86f1('0x42')]){_0x5a65a5['where']=_['merge'](_0x5a65a5[_0x86f1('0x41')],{'$or':_[_0x86f1('0x33')](_0x5a65a5[_0x86f1('0x3a')],function(_0x5989ec){var _0x1f6cf3={};_0x1f6cf3[_0x5989ec]={'$like':'%'+_0x20e162[_0x86f1('0x38')][_0x86f1('0x42')]+'%'};return _0x1f6cf3;})});}_0x5a65a5=_[_0x86f1('0x44')]({},_0x5a65a5,_0x20e162[_0x86f1('0x45')]);return db[_0x86f1('0x58')][_0x86f1('0x5b')](_0x5a65a5);}})[_0x86f1('0x2b')](function(_0x282450){if(_0x282450){return db[_0x86f1('0x5c')][_0x86f1('0x5d')]({'where':{'id':_['map'](_0x282450,'UserId'),'role':_0x86f1('0x5e')},'attributes':['id',_0x86f1('0x30'),_0x86f1('0x5f'),'updatedAt',_0x86f1('0x60')]});}})[_0x86f1('0x2b')](function(_0x137380){if(_0x137380){return{'count':_0x137380['count'],'rows':_[_0x86f1('0x33')](_0x137380[_0x86f1('0x48')],function(_0x3314c3){return{'membername':_0x3314c3[_0x86f1('0x30')],'UserId':_0x3314c3['id'],'queue_name':_0x4f5cb4['name'],'FaxQueueId':_0x4f5cb4['id'],'interface':util[_0x86f1('0x61')](_0x86f1('0x62'),_0x86f1('0x63'),_0x3314c3[_0x86f1('0x30')]),'penalty':0x0,'paused':_0x3314c3['faxPause'],'createdAt':_0x3314c3[_0x86f1('0x60')],'updatedAt':_0x3314c3[_0x86f1('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x70be66,_0x5a65a5))[_0x86f1('0x49')](handleError(_0x70be66,null));};exports[_0x86f1('0x65')]=function(_0x4c5115,_0x34d58b,_0x3f4dc6){var _0x505b38={};var _0x4596c3={};var _0x54f91b;var _0x4e6fd9;return db[_0x86f1('0x34')]['findOne']({'where':{'id':_0x4c5115['params']['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x34d58b,null))[_0x86f1('0x2b')](function(_0x585c91){if(_0x585c91){_0x54f91b=_0x585c91;_0x4596c3[_0x86f1('0x36')]=_[_0x86f1('0x37')](db[_0x86f1('0x66')][_0x86f1('0x4b')]);_0x4596c3[_0x86f1('0x38')]=_[_0x86f1('0x37')](_0x4c5115[_0x86f1('0x38')]);_0x4596c3['filters']=_[_0x86f1('0x3b')](_0x4596c3[_0x86f1('0x36')],_0x4596c3[_0x86f1('0x38')]);_0x505b38['attributes']=_[_0x86f1('0x3b')](_0x4596c3['model'],qs[_0x86f1('0x3c')](_0x4c5115[_0x86f1('0x38')]['fields']));_0x505b38['attributes']=_0x505b38[_0x86f1('0x3a')][_0x86f1('0x3d')]?_0x505b38[_0x86f1('0x3a')]:_0x4596c3['model'];_0x505b38[_0x86f1('0x3f')]=qs[_0x86f1('0x40')](_0x4c5115['query'][_0x86f1('0x40')]);_0x505b38[_0x86f1('0x41')]=qs[_0x86f1('0x39')](_[_0x86f1('0x67')](_0x4c5115['query'],_0x4596c3[_0x86f1('0x39')]));if(_0x4c5115['query'][_0x86f1('0x42')]){_0x505b38[_0x86f1('0x41')]=_[_0x86f1('0x44')](_0x505b38[_0x86f1('0x41')],{'$or':_[_0x86f1('0x33')](_0x505b38[_0x86f1('0x3a')],function(_0x27cb20){var _0x320146={};_0x320146[_0x27cb20]={'$like':'%'+_0x4c5115[_0x86f1('0x38')]['filter']+'%'};return _0x320146;})});}_0x505b38=_[_0x86f1('0x44')]({},_0x505b38,_0x4c5115['options']);return _0x54f91b['getTeams'](_0x505b38);}})[_0x86f1('0x2b')](function(_0xc8fee2){if(_0xc8fee2){_0x4e6fd9=_0xc8fee2[_0x86f1('0x3d')];if(!_0x4c5115[_0x86f1('0x38')][_0x86f1('0x68')](_0x86f1('0x59'))){_0x505b38['limit']=qs[_0x86f1('0x3e')](_0x4c5115[_0x86f1('0x38')][_0x86f1('0x3e')]);_0x505b38[_0x86f1('0x23')]=qs['offset'](_0x4c5115['query'][_0x86f1('0x23')]);}return _0x54f91b['getTeams'](_0x505b38);}})['then'](function(_0x42d4e2){if(_0x42d4e2){return _0x42d4e2?{'count':_0x4e6fd9,'rows':_0x42d4e2}:null;}})[_0x86f1('0x2b')](respondWithResult(_0x34d58b,null))[_0x86f1('0x49')](handleError(_0x34d58b,null));};exports[_0x86f1('0x69')]=function(_0x116891,_0x4f9c38,_0xd4baa3){var _0x5cf573=_0x116891[_0x86f1('0x4e')][_0x86f1('0x6a')];return db['Team'][_0x86f1('0x5b')]({'where':{'id':_0x5cf573},'attributes':['id'],'include':[{'model':db[_0x86f1('0x5c')],'as':'Agents','attributes':['id',_0x86f1('0x30'),_0x86f1('0x6b'),_0x86f1('0x6c'),_0x86f1('0x6d')],'raw':!![]}]})[_0x86f1('0x2b')](function(_0x2336e6){if(_0x2336e6){var _0x46a0fd=_[_0x86f1('0x6e')](_0x2336e6,function(_0x459c0a){var _0x40c508=_0x459c0a[_0x86f1('0x2c')]({'plain':!![]});return _0x40c508[_0x86f1('0x6f')];});return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x116891['params']['id']}})[_0x86f1('0x2b')](function(_0x59a5aa){return db[_0x86f1('0x70')]['transaction'](function(_0x2f7bc9){return _0x59a5aa[_0x86f1('0x69')](_0x5cf573,{'transaction':_0x2f7bc9})['then'](function(){return BPromise[_0x86f1('0x71')](_0x46a0fd,function(_0x535836){return db[_0x86f1('0x58')]['findOrCreate']({'where':{'UserId':_0x535836['id'],'FaxQueueId':_0x116891[_0x86f1('0x55')]['id']},'transaction':_0x2f7bc9});});})['then'](function(){_0x46a0fd['forEach'](function(_0x4db0d6){socket[_0x86f1('0x72')](_0x86f1('0x73'),{'UserId':_0x4db0d6['id'],'FaxQueueId':_0x59a5aa['id']});});});});});}})[_0x86f1('0x2b')](respondWithStatusCode(_0x4f9c38,null))[_0x86f1('0x49')](handleError(_0x4f9c38,null));};exports[_0x86f1('0x74')]=function(_0x299285,_0x162f19,_0x1cf838){return db[_0x86f1('0x66')][_0x86f1('0x5b')]({'where':{'id':_0x299285[_0x86f1('0x38')][_0x86f1('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x86f1('0x5c')],'as':_0x86f1('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x162f19,null))[_0x86f1('0x2b')](function(_0x1d81bf){var _0x617d4e=_[_0x86f1('0x33')](_0x1d81bf,'id');var _0x3fb15b=[];var _0x5040f5=[];var _0x4fc156=squel[_0x86f1('0x75')]();_0x4fc156[_0x86f1('0x76')](_0x86f1('0x77'))[_0x86f1('0x78')](_0x86f1('0x79'),'tq')[_0x86f1('0x7a')](_0x86f1('0x7b'),'ut',_0x86f1('0x7c'))[_0x86f1('0x41')]('FaxQueueId\x20=\x20?',_0x299285[_0x86f1('0x55')]['id']);for(var _0x4e86f8=0x0;_0x4e86f8<_0x1d81bf[_0x86f1('0x3d')];_0x4e86f8+=0x1){let _0x6394c2=_0x1d81bf[_0x4e86f8];for(var _0x2ef891=0x0;_0x2ef891<_0x6394c2[_0x86f1('0x6f')][_0x86f1('0x3d')];_0x2ef891+=0x1){let _0x451171=_0x6394c2[_0x86f1('0x6f')][_0x2ef891];var _0x3bc3a7=_0x4fc156[_0x86f1('0x7d')]();_0x3bc3a7[_0x86f1('0x41')](_0x86f1('0x7e'),_0x451171['id']);_0x5040f5[_0x86f1('0x7f')](db[_0x86f1('0x70')][_0x86f1('0x38')](_0x3bc3a7[_0x86f1('0x80')](),{'type':db[_0x86f1('0x70')][_0x86f1('0x81')]['SELECT']})['then'](function(_0x3c2bf0){if(_0x3c2bf0[_0x86f1('0x3d')]===0x1){return _0x451171['id'];}else{var _0x85597d=_['every'](_[_0x86f1('0x33')](_0x3c2bf0,_0x86f1('0x82')),function(_0x33f01d){return _[_0x86f1('0x83')](_0x617d4e,_0x33f01d);});if(_0x85597d){return _0x451171['id'];}}}));}}return BPromise[_0x86f1('0x84')](_0x5040f5)[_0x86f1('0x2b')](function(_0x3c140f){_0x3fb15b=_(_0x3fb15b)['union'](_0x3c140f)[_0x86f1('0x85')]()['value']();return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x299285[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](function(_0x237bb2){return db[_0x86f1('0x70')][_0x86f1('0x86')](function(_0x336149){return _0x237bb2['removeTeams'](_0x299285[_0x86f1('0x38')]['ids'],{'transaction':_0x336149})[_0x86f1('0x2b')](function(){if(!_['isEmpty'](_0x3fb15b)){return _0x237bb2[_0x86f1('0x87')](_0x3fb15b,{'transaction':_0x336149});}})['then'](function(){_0x3fb15b[_0x86f1('0x88')](function(_0x2b749f){socket['emit'](_0x86f1('0x89'),{'UserId':_0x2b749f,'FaxQueueId':_0x237bb2['id']});});});});});});})[_0x86f1('0x2b')](respondWithStatusCode(_0x162f19,null))[_0x86f1('0x49')](handleError(_0x162f19,null));};exports[_0x86f1('0x8a')]=function(_0x5256cc,_0x2092ab,_0x3e5801){return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x5256cc[_0x86f1('0x55')]['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x2092ab,null))[_0x86f1('0x2b')](function(_0x113e97){if(_0x113e97){return _0x113e97[_0x86f1('0x8a')](_0x5256cc['body'][_0x86f1('0x6a')],_[_0x86f1('0x8b')](_0x5256cc[_0x86f1('0x4e')],[_0x86f1('0x6a'),'id'])||{})[_0x86f1('0x8c')](function(_0x4061b3){for(var _0x2f85e2=0x0;_0x2f85e2<_0x5256cc['body'][_0x86f1('0x6a')]['length'];_0x2f85e2+=0x1){socket[_0x86f1('0x72')](_0x86f1('0x73'),{'UserId':_0x5256cc[_0x86f1('0x4e')][_0x86f1('0x6a')][_0x2f85e2],'FaxQueueId':_0x5256cc[_0x86f1('0x55')]['id']});}return _0x4061b3;});}})['then'](respondWithResult(_0x2092ab,null))[_0x86f1('0x49')](handleError(_0x2092ab,null));};exports['removeAgents']=function(_0x3c96df,_0x44ba73,_0x42602c){return db[_0x86f1('0x34')][_0x86f1('0x4c')]({'where':{'id':_0x3c96df['params']['id']}})['then'](handleEntityNotFound(_0x44ba73,null))[_0x86f1('0x2b')](function(_0x4fa14f){if(_0x4fa14f){return _0x4fa14f[_0x86f1('0x87')](_0x3c96df[_0x86f1('0x38')][_0x86f1('0x6a')])[_0x86f1('0x2b')](function(){if(_[_0x86f1('0x8d')](_0x3c96df['query'][_0x86f1('0x6a')])){for(var _0x2f2ac9=0x0;_0x2f2ac9<_0x3c96df[_0x86f1('0x38')][_0x86f1('0x6a')][_0x86f1('0x3d')];_0x2f2ac9+=0x1){socket['emit'](_0x86f1('0x89'),{'UserId':Number(_0x3c96df[_0x86f1('0x38')][_0x86f1('0x6a')][_0x2f2ac9]),'FaxQueueId':Number(_0x3c96df[_0x86f1('0x55')]['id'])});}}else{socket[_0x86f1('0x72')](_0x86f1('0x89'),{'UserId':Number(_0x3c96df['query']['ids']),'FaxQueueId':Number(_0x3c96df[_0x86f1('0x55')]['id'])});}});}})[_0x86f1('0x2b')](respondWithStatusCode(_0x44ba73,null))[_0x86f1('0x49')](handleError(_0x44ba73,null));};exports[_0x86f1('0x8e')]=function(_0x298b8e,_0x3bc0ae,_0x2feec0){var _0x27f7ad={};var _0x22d45d={};var _0x2b6784;var _0x20fbd0;return db[_0x86f1('0x34')][_0x86f1('0x57')]({'where':{'id':_0x298b8e['params']['id']}})[_0x86f1('0x2b')](handleEntityNotFound(_0x3bc0ae,null))['then'](function(_0x17f85b){if(_0x17f85b){_0x2b6784=_0x17f85b;_0x22d45d[_0x86f1('0x36')]=_['keys'](db[_0x86f1('0x5c')]['rawAttributes']);_0x22d45d[_0x86f1('0x38')]=_[_0x86f1('0x37')](_0x298b8e[_0x86f1('0x38')]);_0x22d45d[_0x86f1('0x39')]=_['intersection'](_0x22d45d[_0x86f1('0x36')],_0x22d45d[_0x86f1('0x38')]);_0x27f7ad[_0x86f1('0x3a')]=_[_0x86f1('0x3b')](_0x22d45d['model'],qs[_0x86f1('0x3c')](_0x298b8e['query']['fields']));_0x27f7ad['attributes']=_0x27f7ad[_0x86f1('0x3a')][_0x86f1('0x3d')]?_0x27f7ad[_0x86f1('0x3a')]:_0x22d45d['model'];_0x27f7ad[_0x86f1('0x3f')]=qs[_0x86f1('0x40')](_0x298b8e[_0x86f1('0x38')][_0x86f1('0x40')]);_0x27f7ad[_0x86f1('0x41')]=qs[_0x86f1('0x39')](_[_0x86f1('0x67')](_0x298b8e[_0x86f1('0x38')],_0x22d45d['filters']));if(_0x298b8e[_0x86f1('0x38')][_0x86f1('0x42')]){_0x27f7ad[_0x86f1('0x41')]=_['merge'](_0x27f7ad[_0x86f1('0x41')],{'$or':_[_0x86f1('0x33')](_0x27f7ad[_0x86f1('0x3a')],function(_0x179e97){var _0x31335d={};_0x31335d[_0x179e97]={'$like':'%'+_0x298b8e[_0x86f1('0x38')][_0x86f1('0x42')]+'%'};return _0x31335d;})});}_0x27f7ad=_[_0x86f1('0x44')]({},_0x27f7ad,_0x298b8e['options']);return _0x2b6784['getAgents'](_0x27f7ad);}})[_0x86f1('0x2b')](function(_0x47a136){if(_0x47a136){_0x20fbd0=_0x47a136['length'];if(!_0x298b8e['query'][_0x86f1('0x68')](_0x86f1('0x59'))){_0x27f7ad['limit']=qs[_0x86f1('0x3e')](_0x298b8e['query'][_0x86f1('0x3e')]);_0x27f7ad[_0x86f1('0x23')]=qs[_0x86f1('0x23')](_0x298b8e['query']['offset']);}return _0x2b6784[_0x86f1('0x8e')](_0x27f7ad);}})[_0x86f1('0x2b')](function(_0x156542){if(_0x156542){return _0x156542?{'count':_0x20fbd0,'rows':_0x156542}:null;}})['then'](respondWithResult(_0x3bc0ae,null))['catch'](handleError(_0x3bc0ae,null));}; \ No newline at end of file +var _0x3dcc=['socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','FaxQueues','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','FaxQueueId','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','User','Agents','online','voicePause','flatMap','sequelize','each','UserFaxQueue','findOrCreate','forEach','emit','removeTeams','select','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','TeamId','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','ids','spread','userFaxQueue:save','isArray','getAgents','html-pdf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3dcc,0xf5));var _0xc3dc=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x3dcc[_0x476b00];return _0x44ec8e;};'use strict';var pdf=require(_0xc3dc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc3dc('0x1'));var moment=require(_0xc3dc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc3dc('0x3'));var util=require(_0xc3dc('0x4'));var path=require(_0xc3dc('0x5'));var sox=require('sox');var csv=require(_0xc3dc('0x6'));var ejs=require(_0xc3dc('0x7'));var fs=require('fs');var _=require(_0xc3dc('0x8'));var squel=require(_0xc3dc('0x9'));var crypto=require(_0xc3dc('0xa'));var jsforce=require(_0xc3dc('0xb'));var deskjs=require(_0xc3dc('0xc'));var toCsv=require(_0xc3dc('0x6'));var querystring=require(_0xc3dc('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc3dc('0xe'));var qs=require(_0xc3dc('0xf'));var as=require(_0xc3dc('0x10'));var hardwareService=require(_0xc3dc('0x11'));var logger=require(_0xc3dc('0x12'))(_0xc3dc('0x13'));var utils=require('../../config/utils');var config=require(_0xc3dc('0x14'));var db=require(_0xc3dc('0x15'))['db'];config[_0xc3dc('0x16')]=_[_0xc3dc('0x17')](config['redis'],{'host':_0xc3dc('0x18'),'port':0x18eb});var socket=require(_0xc3dc('0x19'))(new Redis(config[_0xc3dc('0x16')]));require(_0xc3dc('0x1a'))[_0xc3dc('0x1b')](socket);function respondWithStatusCode(_0x4f9126,_0x3b421e){_0x3b421e=_0x3b421e||0xcc;return function(_0x52aa3a){if(_0x52aa3a){return _0x4f9126[_0xc3dc('0x1c')](_0x3b421e);}return _0x4f9126[_0xc3dc('0x1d')](_0x3b421e)[_0xc3dc('0x1e')]();};}function respondWithResult(_0x28acd8,_0x3b8964){_0x3b8964=_0x3b8964||0xc8;return function(_0x336993){if(_0x336993){return _0x28acd8[_0xc3dc('0x1d')](_0x3b8964)[_0xc3dc('0x1f')](_0x336993);}};}function respondWithFilteredResult(_0x57edc6,_0xc46e77){return function(_0x3a23a2){if(_0x3a23a2){var _0x367bea=_0x3a23a2[_0xc3dc('0x20')],_0x52290c=_0xc46e77['offset'],_0x5cabbf=_0xc46e77[_0xc3dc('0x21')]+_0xc46e77[_0xc3dc('0x22')],_0x12832a;if(_0x5cabbf>=_0x367bea){_0x5cabbf=_0x367bea;_0x12832a=0xc8;}else{_0x12832a=0xce;}_0x57edc6[_0xc3dc('0x1d')](_0x12832a);return _0x57edc6[_0xc3dc('0x23')](_0xc3dc('0x24'),_0x52290c+'-'+_0x5cabbf+'/'+_0x367bea)[_0xc3dc('0x1f')](_0x3a23a2);}return null;};}function patchUpdates(_0x3822f8){return function(_0x2cffe5){try{jsonpatch[_0xc3dc('0x25')](_0x2cffe5,_0x3822f8,!![]);}catch(_0x45878c){return BPromise['reject'](_0x45878c);}return _0x2cffe5[_0xc3dc('0x26')]();};}function saveUpdates(_0x2c4cce,_0xbb7299){return function(_0x1ef2ab){if(_0x1ef2ab){return _0x1ef2ab['update'](_0x2c4cce)['then'](function(_0x516f77){return _0x516f77;});}return null;};}function removeEntity(_0x2efbe5,_0xd22f4){return function(_0x27848f){if(_0x27848f){return _0x27848f[_0xc3dc('0x27')]()[_0xc3dc('0x28')](function(){var _0x511169=_0x27848f['get']({'plain':!![]});var _0x459280='FaxQueues';return db['UserProfileResource'][_0xc3dc('0x27')]({'where':{'type':_0x459280,'resourceId':_0x511169['id']}})['then'](function(){return _0x27848f;});})[_0xc3dc('0x28')](function(){_0x2efbe5[_0xc3dc('0x1d')](0xcc)[_0xc3dc('0x1e')]();});}};}function handleEntityNotFound(_0x32d04e,_0x53312d){return function(_0x16c862){if(!_0x16c862){_0x32d04e[_0xc3dc('0x1c')](0x194);}return _0x16c862;};}function handleError(_0x3ccc05,_0x219393){_0x219393=_0x219393||0x1f4;return function(_0x5f1ddb){logger[_0xc3dc('0x29')](_0x5f1ddb['stack']);if(_0x5f1ddb[_0xc3dc('0x2a')]){delete _0x5f1ddb[_0xc3dc('0x2a')];}_0x3ccc05[_0xc3dc('0x1d')](_0x219393)[_0xc3dc('0x2b')](_0x5f1ddb);};}exports[_0xc3dc('0x2c')]=function(_0x2e5fc9,_0x1b01c1){var _0x1c7f37={},_0x35490f={},_0x18c4d4={'count':0x0,'rows':[]};var _0x439aef=_[_0xc3dc('0x2d')](db[_0xc3dc('0x2e')][_0xc3dc('0x2f')],function(_0x2b8953){return{'name':_0x2b8953[_0xc3dc('0x30')],'type':_0x2b8953['type'][_0xc3dc('0x31')]};});_0x35490f[_0xc3dc('0x32')]=_[_0xc3dc('0x2d')](_0x439aef,_0xc3dc('0x2a'));_0x35490f['query']=_[_0xc3dc('0x33')](_0x2e5fc9[_0xc3dc('0x34')]);_0x35490f[_0xc3dc('0x35')]=_['intersection'](_0x35490f[_0xc3dc('0x32')],_0x35490f['query']);_0x1c7f37['attributes']=_[_0xc3dc('0x36')](_0x35490f[_0xc3dc('0x32')],qs[_0xc3dc('0x37')](_0x2e5fc9[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0x1c7f37[_0xc3dc('0x38')]=_0x1c7f37[_0xc3dc('0x38')][_0xc3dc('0x39')]?_0x1c7f37[_0xc3dc('0x38')]:_0x35490f[_0xc3dc('0x32')];if(!_0x2e5fc9[_0xc3dc('0x34')][_0xc3dc('0x3a')](_0xc3dc('0x3b'))){_0x1c7f37[_0xc3dc('0x22')]=qs['limit'](_0x2e5fc9[_0xc3dc('0x34')]['limit']);_0x1c7f37['offset']=qs[_0xc3dc('0x21')](_0x2e5fc9[_0xc3dc('0x34')][_0xc3dc('0x21')]);}_0x1c7f37[_0xc3dc('0x3c')]=qs[_0xc3dc('0x3d')](_0x2e5fc9[_0xc3dc('0x34')]['sort']);_0x1c7f37['where']=qs['filters'](_[_0xc3dc('0x3e')](_0x2e5fc9['query'],_0x35490f[_0xc3dc('0x35')]),_0x439aef);if(_0x2e5fc9['query']['filter']){_0x1c7f37[_0xc3dc('0x3f')]=_['merge'](_0x1c7f37['where'],{'$or':_['map'](_0x439aef,function(_0x1759a1){if(_0x1759a1[_0xc3dc('0x40')]!==_0xc3dc('0x41')){var _0x8f24bb={};_0x8f24bb[_0x1759a1[_0xc3dc('0x2a')]]={'$like':'%'+_0x2e5fc9['query'][_0xc3dc('0x42')]+'%'};return _0x8f24bb;}})});}_0x1c7f37=_[_0xc3dc('0x43')]({},_0x1c7f37,_0x2e5fc9[_0xc3dc('0x44')]);var _0x1b60ad={'where':_0x1c7f37[_0xc3dc('0x3f')]};return db[_0xc3dc('0x2e')]['count'](_0x1b60ad)[_0xc3dc('0x28')](function(_0x14e49a){_0x18c4d4[_0xc3dc('0x20')]=_0x14e49a;if(_0x2e5fc9['query'][_0xc3dc('0x45')]){_0x1c7f37['include']=[{'all':!![]}];}return db[_0xc3dc('0x2e')][_0xc3dc('0x46')](_0x1c7f37);})[_0xc3dc('0x28')](function(_0xd73d04){_0x18c4d4[_0xc3dc('0x47')]=_0xd73d04;return _0x18c4d4;})['then'](respondWithFilteredResult(_0x1b01c1,_0x1c7f37))['catch'](handleError(_0x1b01c1,null));};exports[_0xc3dc('0x48')]=function(_0xf3bd33,_0x29195e){var _0x28b774={'raw':!![],'where':{'id':_0xf3bd33[_0xc3dc('0x49')]['id']}},_0x4b39eb={};_0x4b39eb['model']=_['keys'](db[_0xc3dc('0x2e')][_0xc3dc('0x2f')]);_0x4b39eb[_0xc3dc('0x34')]=_[_0xc3dc('0x33')](_0xf3bd33[_0xc3dc('0x34')]);_0x4b39eb['filters']=_[_0xc3dc('0x36')](_0x4b39eb[_0xc3dc('0x32')],_0x4b39eb[_0xc3dc('0x34')]);_0x28b774[_0xc3dc('0x38')]=_['intersection'](_0x4b39eb[_0xc3dc('0x32')],qs[_0xc3dc('0x37')](_0xf3bd33[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0x28b774[_0xc3dc('0x38')]=_0x28b774[_0xc3dc('0x38')][_0xc3dc('0x39')]?_0x28b774[_0xc3dc('0x38')]:_0x4b39eb[_0xc3dc('0x32')];if(_0xf3bd33[_0xc3dc('0x34')]['includeAll']){_0x28b774['include']=[{'all':!![]}];}_0x28b774=_[_0xc3dc('0x43')]({},_0x28b774,_0xf3bd33[_0xc3dc('0x44')]);return db[_0xc3dc('0x2e')]['find'](_0x28b774)[_0xc3dc('0x28')](handleEntityNotFound(_0x29195e,null))[_0xc3dc('0x28')](respondWithResult(_0x29195e,null))[_0xc3dc('0x4a')](handleError(_0x29195e,null));};exports[_0xc3dc('0x4b')]=function(_0x177754,_0x3b6836){return db['FaxQueue'][_0xc3dc('0x4b')](_0x177754['body'],{})['then'](function(_0x21a2f5){var _0x3dc563=_0x177754['user'][_0xc3dc('0x4c')]({'plain':!![]});if(!_0x3dc563)throw new Error(_0xc3dc('0x4d'));if(_0x3dc563['role']===_0xc3dc('0x4e')){var _0x34696d=_0x21a2f5[_0xc3dc('0x4c')]({'plain':!![]});var _0x49047e=_0xc3dc('0x4f');return db[_0xc3dc('0x50')][_0xc3dc('0x51')]({'where':{'name':_0x49047e,'userProfileId':_0x3dc563['userProfileId']},'raw':!![]})[_0xc3dc('0x28')](function(_0x3fd7cd){if(_0x3fd7cd&&_0x3fd7cd[_0xc3dc('0x52')]===0x0){return db[_0xc3dc('0x53')][_0xc3dc('0x4b')]({'name':_0x34696d[_0xc3dc('0x2a')],'resourceId':_0x34696d['id'],'type':_0x3fd7cd[_0xc3dc('0x2a')],'sectionId':_0x3fd7cd['id']},{})[_0xc3dc('0x28')](function(){return _0x21a2f5;});}else{return _0x21a2f5;}})[_0xc3dc('0x4a')](function(_0x323780){logger[_0xc3dc('0x29')](_0xc3dc('0x54'),_0x323780);throw _0x323780;});}return _0x21a2f5;})[_0xc3dc('0x28')](respondWithResult(_0x3b6836,0xc9))[_0xc3dc('0x4a')](handleError(_0x3b6836,null));};exports[_0xc3dc('0x55')]=function(_0x1c796a,_0x1b5582){if(_0x1c796a[_0xc3dc('0x56')]['id']){delete _0x1c796a[_0xc3dc('0x56')]['id'];}return db[_0xc3dc('0x2e')]['find']({'where':{'id':_0x1c796a[_0xc3dc('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b5582,null))[_0xc3dc('0x28')](saveUpdates(_0x1c796a['body'],null))[_0xc3dc('0x28')](respondWithResult(_0x1b5582,null))[_0xc3dc('0x4a')](handleError(_0x1b5582,null));};exports[_0xc3dc('0x27')]=function(_0x5665bd,_0x1a19b3){return db[_0xc3dc('0x2e')][_0xc3dc('0x51')]({'where':{'id':_0x5665bd[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x1a19b3,null))[_0xc3dc('0x28')](removeEntity(_0x1a19b3,null))[_0xc3dc('0x4a')](handleError(_0x1a19b3,null));};exports[_0xc3dc('0x57')]=function(_0x21960a,_0x30d5c9){return db['FaxQueue']['describe']()[_0xc3dc('0x28')](respondWithResult(_0x30d5c9,null))['catch'](handleError(_0x30d5c9,null));};exports['getMembers']=function(_0x5e165e,_0x26ca38,_0xe28781){var _0x2583df={'raw':!![],'where':{}},_0xf433b7={},_0x3ecc85;return db[_0xc3dc('0x2e')]['findOne']({'where':{'id':_0x5e165e[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x26ca38,null))['then'](function(_0x5c486f){if(_0x5c486f){_0x3ecc85=_0x5c486f[_0xc3dc('0x4c')]({'plain':!![]});_0xf433b7[_0xc3dc('0x32')]=_[_0xc3dc('0x33')](db['UserFaxQueue'][_0xc3dc('0x2f')]);_0xf433b7[_0xc3dc('0x34')]=_[_0xc3dc('0x33')](_0x5e165e[_0xc3dc('0x34')]);_0xf433b7['filters']=_[_0xc3dc('0x36')](_0xf433b7[_0xc3dc('0x32')],_0xf433b7[_0xc3dc('0x34')]);_0x2583df['attributes']=_[_0xc3dc('0x36')](_0xf433b7[_0xc3dc('0x32')],qs['fields'](_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0x2583df[_0xc3dc('0x38')]=_0x2583df['attributes'][_0xc3dc('0x39')]?_0x2583df[_0xc3dc('0x38')]:_0xf433b7[_0xc3dc('0x32')];if(!_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x3a')](_0xc3dc('0x3b'))){_0x2583df[_0xc3dc('0x22')]=qs[_0xc3dc('0x22')](_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x22')]);_0x2583df[_0xc3dc('0x21')]=qs[_0xc3dc('0x21')](_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x21')]);}_0x2583df[_0xc3dc('0x3c')]=qs[_0xc3dc('0x3d')](_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x3d')]);_0x2583df[_0xc3dc('0x3f')]=qs[_0xc3dc('0x35')](_[_0xc3dc('0x3e')](_0x5e165e['query'],_0xf433b7[_0xc3dc('0x35')]));_0x2583df[_0xc3dc('0x3f')][_0xc3dc('0x58')]=_0x5c486f['id'];if(_0x5e165e[_0xc3dc('0x34')]['filter']){_0x2583df[_0xc3dc('0x3f')]=_[_0xc3dc('0x43')](_0x2583df['where'],{'$or':_[_0xc3dc('0x2d')](_0x2583df['attributes'],function(_0x895c44){var _0x5c9017={};_0x5c9017[_0x895c44]={'$like':'%'+_0x5e165e[_0xc3dc('0x34')][_0xc3dc('0x42')]+'%'};return _0x5c9017;})});}_0x2583df=_[_0xc3dc('0x43')]({},_0x2583df,_0x5e165e[_0xc3dc('0x44')]);return db['UserFaxQueue'][_0xc3dc('0x46')](_0x2583df);}})[_0xc3dc('0x28')](function(_0x477150){if(_0x477150){return db['User']['findAndCountAll']({'where':{'id':_[_0xc3dc('0x2d')](_0x477150,_0xc3dc('0x59')),'role':_0xc3dc('0x5a')},'attributes':['id','name',_0xc3dc('0x5b'),_0xc3dc('0x5c'),_0xc3dc('0x5d')]});}})[_0xc3dc('0x28')](function(_0xc16f5d){if(_0xc16f5d){return{'count':_0xc16f5d['count'],'rows':_[_0xc3dc('0x2d')](_0xc16f5d[_0xc3dc('0x47')],function(_0x1c6571){return{'membername':_0x1c6571[_0xc3dc('0x2a')],'UserId':_0x1c6571['id'],'queue_name':_0x3ecc85['name'],'FaxQueueId':_0x3ecc85['id'],'interface':util[_0xc3dc('0x5e')]('%s/%s',_0xc3dc('0x5f'),_0x1c6571[_0xc3dc('0x2a')]),'penalty':0x0,'paused':_0x1c6571[_0xc3dc('0x5b')],'createdAt':_0x1c6571[_0xc3dc('0x5d')],'updatedAt':_0x1c6571[_0xc3dc('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x26ca38,_0x2583df))[_0xc3dc('0x4a')](handleError(_0x26ca38,null));};exports[_0xc3dc('0x60')]=function(_0xff9900,_0x4f9998,_0x1810fc){var _0x19d2a7={};var _0x464764={};var _0x35afd6;var _0x464060;return db['FaxQueue'][_0xc3dc('0x61')]({'where':{'id':_0xff9900[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x4f9998,null))['then'](function(_0xdd0705){if(_0xdd0705){_0x35afd6=_0xdd0705;_0x464764[_0xc3dc('0x32')]=_[_0xc3dc('0x33')](db[_0xc3dc('0x62')]['rawAttributes']);_0x464764[_0xc3dc('0x34')]=_[_0xc3dc('0x33')](_0xff9900[_0xc3dc('0x34')]);_0x464764[_0xc3dc('0x35')]=_['intersection'](_0x464764[_0xc3dc('0x32')],_0x464764[_0xc3dc('0x34')]);_0x19d2a7[_0xc3dc('0x38')]=_[_0xc3dc('0x36')](_0x464764['model'],qs[_0xc3dc('0x37')](_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0x19d2a7[_0xc3dc('0x38')]=_0x19d2a7[_0xc3dc('0x38')][_0xc3dc('0x39')]?_0x19d2a7[_0xc3dc('0x38')]:_0x464764['model'];_0x19d2a7[_0xc3dc('0x3c')]=qs[_0xc3dc('0x3d')](_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x3d')]);_0x19d2a7[_0xc3dc('0x3f')]=qs[_0xc3dc('0x35')](_[_0xc3dc('0x3e')](_0xff9900[_0xc3dc('0x34')],_0x464764['filters']));if(_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x42')]){_0x19d2a7[_0xc3dc('0x3f')]=_[_0xc3dc('0x43')](_0x19d2a7[_0xc3dc('0x3f')],{'$or':_[_0xc3dc('0x2d')](_0x19d2a7['attributes'],function(_0x2c9774){var _0x1856f0={};_0x1856f0[_0x2c9774]={'$like':'%'+_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x42')]+'%'};return _0x1856f0;})});}_0x19d2a7=_[_0xc3dc('0x43')]({},_0x19d2a7,_0xff9900['options']);return _0x35afd6[_0xc3dc('0x60')](_0x19d2a7);}})['then'](function(_0x1e1ff6){if(_0x1e1ff6){_0x464060=_0x1e1ff6[_0xc3dc('0x39')];if(!_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x3a')](_0xc3dc('0x3b'))){_0x19d2a7['limit']=qs[_0xc3dc('0x22')](_0xff9900[_0xc3dc('0x34')][_0xc3dc('0x22')]);_0x19d2a7['offset']=qs[_0xc3dc('0x21')](_0xff9900['query'][_0xc3dc('0x21')]);}return _0x35afd6[_0xc3dc('0x60')](_0x19d2a7);}})[_0xc3dc('0x28')](function(_0x3c8931){if(_0x3c8931){return _0x3c8931?{'count':_0x464060,'rows':_0x3c8931}:null;}})['then'](respondWithResult(_0x4f9998,null))['catch'](handleError(_0x4f9998,null));};exports[_0xc3dc('0x63')]=function(_0x5303a2,_0x1842be,_0x40eb3f){var _0x32ad9e=_0x5303a2[_0xc3dc('0x56')]['ids'];return db[_0xc3dc('0x62')][_0xc3dc('0x46')]({'where':{'id':_0x32ad9e},'attributes':['id'],'include':[{'model':db[_0xc3dc('0x64')],'as':_0xc3dc('0x65'),'attributes':['id',_0xc3dc('0x2a'),_0xc3dc('0x66'),_0xc3dc('0x67'),'interface'],'raw':!![]}]})[_0xc3dc('0x28')](function(_0x2a8a47){if(_0x2a8a47){var _0x52f8d3=_[_0xc3dc('0x68')](_0x2a8a47,function(_0xac2d19){var _0x4510d1=_0xac2d19[_0xc3dc('0x4c')]({'plain':!![]});return _0x4510d1['Agents'];});return db[_0xc3dc('0x2e')]['find']({'where':{'id':_0x5303a2['params']['id']}})[_0xc3dc('0x28')](function(_0x88d5aa){return db[_0xc3dc('0x69')]['transaction'](function(_0x4586ef){return _0x88d5aa[_0xc3dc('0x63')](_0x32ad9e,{'transaction':_0x4586ef})[_0xc3dc('0x28')](function(){return BPromise[_0xc3dc('0x6a')](_0x52f8d3,function(_0x3f44dd){return db[_0xc3dc('0x6b')][_0xc3dc('0x6c')]({'where':{'UserId':_0x3f44dd['id'],'FaxQueueId':_0x5303a2['params']['id']},'transaction':_0x4586ef});});})[_0xc3dc('0x28')](function(){_0x52f8d3[_0xc3dc('0x6d')](function(_0x3f3a63){socket[_0xc3dc('0x6e')]('userFaxQueue:save',{'UserId':_0x3f3a63['id'],'FaxQueueId':_0x88d5aa['id']});});});});});}})[_0xc3dc('0x28')](respondWithStatusCode(_0x1842be,null))['catch'](handleError(_0x1842be,null));};exports[_0xc3dc('0x6f')]=function(_0x3b48a5,_0x4929fc,_0x3766d8){return db[_0xc3dc('0x62')][_0xc3dc('0x46')]({'where':{'id':_0x3b48a5[_0xc3dc('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc3dc('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc3dc('0x28')](handleEntityNotFound(_0x4929fc,null))['then'](function(_0x18bf78){var _0x56d052=_['map'](_0x18bf78,'id');var _0x519869=[];var _0x40cc4b=[];var _0x1eb231=squel[_0xc3dc('0x70')]();_0x1eb231['field']('tq.TeamId')['from']('team_has_fax_queues','tq')[_0xc3dc('0x71')](_0xc3dc('0x72'),'ut',_0xc3dc('0x73'))[_0xc3dc('0x3f')]('FaxQueueId\x20=\x20?',_0x3b48a5[_0xc3dc('0x49')]['id']);for(var _0x573b6b=0x0;_0x573b6b<_0x18bf78[_0xc3dc('0x39')];_0x573b6b+=0x1){let _0x4fe547=_0x18bf78[_0x573b6b];for(var _0x5c19d0=0x0;_0x5c19d0<_0x4fe547['Agents'][_0xc3dc('0x39')];_0x5c19d0+=0x1){let _0xcac977=_0x4fe547[_0xc3dc('0x65')][_0x5c19d0];var _0x5d1db4=_0x1eb231[_0xc3dc('0x74')]();_0x5d1db4[_0xc3dc('0x3f')]('ut.UserId\x20=\x20?',_0xcac977['id']);_0x40cc4b['push'](db[_0xc3dc('0x69')][_0xc3dc('0x34')](_0x5d1db4[_0xc3dc('0x75')](),{'type':db[_0xc3dc('0x69')][_0xc3dc('0x76')][_0xc3dc('0x77')]})[_0xc3dc('0x28')](function(_0x351907){if(_0x351907[_0xc3dc('0x39')]===0x1){return _0xcac977['id'];}else{var _0x2fbd0c=_[_0xc3dc('0x78')](_[_0xc3dc('0x2d')](_0x351907,_0xc3dc('0x79')),function(_0x1a701a){return _['includes'](_0x56d052,_0x1a701a);});if(_0x2fbd0c){return _0xcac977['id'];}}}));}}return BPromise['all'](_0x40cc4b)['then'](function(_0x39619){_0x519869=_(_0x519869)[_0xc3dc('0x7a')](_0x39619)[_0xc3dc('0x7b')]()['value']();return db[_0xc3dc('0x2e')][_0xc3dc('0x51')]({'where':{'id':_0x3b48a5[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](function(_0x1e5539){return db[_0xc3dc('0x69')][_0xc3dc('0x7c')](function(_0x305cc5){return _0x1e5539[_0xc3dc('0x6f')](_0x3b48a5['query']['ids'],{'transaction':_0x305cc5})[_0xc3dc('0x28')](function(){if(!_[_0xc3dc('0x7d')](_0x519869)){return _0x1e5539[_0xc3dc('0x7e')](_0x519869,{'transaction':_0x305cc5});}})[_0xc3dc('0x28')](function(){_0x519869['forEach'](function(_0x26cbe4){socket[_0xc3dc('0x6e')](_0xc3dc('0x7f'),{'UserId':_0x26cbe4,'FaxQueueId':_0x1e5539['id']});});});});});});})[_0xc3dc('0x28')](respondWithStatusCode(_0x4929fc,null))[_0xc3dc('0x4a')](handleError(_0x4929fc,null));};exports[_0xc3dc('0x80')]=function(_0xe0fdbc,_0x583e9e,_0x46f08b){return db[_0xc3dc('0x2e')]['find']({'where':{'id':_0xe0fdbc['params']['id']}})['then'](handleEntityNotFound(_0x583e9e,null))['then'](function(_0x3c247a){if(_0x3c247a){return _0x3c247a['addAgents'](_0xe0fdbc[_0xc3dc('0x56')]['ids'],_[_0xc3dc('0x81')](_0xe0fdbc[_0xc3dc('0x56')],[_0xc3dc('0x82'),'id'])||{})[_0xc3dc('0x83')](function(_0x12ac82){for(var _0x79fdd8=0x0;_0x79fdd8<_0xe0fdbc[_0xc3dc('0x56')][_0xc3dc('0x82')][_0xc3dc('0x39')];_0x79fdd8+=0x1){socket[_0xc3dc('0x6e')](_0xc3dc('0x84'),{'UserId':_0xe0fdbc[_0xc3dc('0x56')][_0xc3dc('0x82')][_0x79fdd8],'FaxQueueId':_0xe0fdbc[_0xc3dc('0x49')]['id']});}return _0x12ac82;});}})['then'](respondWithResult(_0x583e9e,null))[_0xc3dc('0x4a')](handleError(_0x583e9e,null));};exports[_0xc3dc('0x7e')]=function(_0x49bd33,_0x2bd4ec,_0x55aca2){return db[_0xc3dc('0x2e')][_0xc3dc('0x51')]({'where':{'id':_0x49bd33[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x2bd4ec,null))['then'](function(_0x564d33){if(_0x564d33){return _0x564d33[_0xc3dc('0x7e')](_0x49bd33['query'][_0xc3dc('0x82')])['then'](function(){if(_[_0xc3dc('0x85')](_0x49bd33[_0xc3dc('0x34')][_0xc3dc('0x82')])){for(var _0x3ecb34=0x0;_0x3ecb34<_0x49bd33[_0xc3dc('0x34')][_0xc3dc('0x82')][_0xc3dc('0x39')];_0x3ecb34+=0x1){socket['emit'](_0xc3dc('0x7f'),{'UserId':Number(_0x49bd33[_0xc3dc('0x34')][_0xc3dc('0x82')][_0x3ecb34]),'FaxQueueId':Number(_0x49bd33[_0xc3dc('0x49')]['id'])});}}else{socket[_0xc3dc('0x6e')](_0xc3dc('0x7f'),{'UserId':Number(_0x49bd33[_0xc3dc('0x34')][_0xc3dc('0x82')]),'FaxQueueId':Number(_0x49bd33['params']['id'])});}});}})[_0xc3dc('0x28')](respondWithStatusCode(_0x2bd4ec,null))[_0xc3dc('0x4a')](handleError(_0x2bd4ec,null));};exports[_0xc3dc('0x86')]=function(_0x3eaeae,_0x5aebdf,_0x5caf7e){var _0xb8b880={};var _0x13021e={};var _0xf9e4b8;var _0x4b1b9c;return db['FaxQueue'][_0xc3dc('0x61')]({'where':{'id':_0x3eaeae[_0xc3dc('0x49')]['id']}})[_0xc3dc('0x28')](handleEntityNotFound(_0x5aebdf,null))[_0xc3dc('0x28')](function(_0x497658){if(_0x497658){_0xf9e4b8=_0x497658;_0x13021e[_0xc3dc('0x32')]=_[_0xc3dc('0x33')](db[_0xc3dc('0x64')]['rawAttributes']);_0x13021e[_0xc3dc('0x34')]=_[_0xc3dc('0x33')](_0x3eaeae[_0xc3dc('0x34')]);_0x13021e[_0xc3dc('0x35')]=_[_0xc3dc('0x36')](_0x13021e[_0xc3dc('0x32')],_0x13021e[_0xc3dc('0x34')]);_0xb8b880['attributes']=_['intersection'](_0x13021e[_0xc3dc('0x32')],qs['fields'](_0x3eaeae[_0xc3dc('0x34')][_0xc3dc('0x37')]));_0xb8b880[_0xc3dc('0x38')]=_0xb8b880[_0xc3dc('0x38')][_0xc3dc('0x39')]?_0xb8b880[_0xc3dc('0x38')]:_0x13021e[_0xc3dc('0x32')];_0xb8b880['order']=qs[_0xc3dc('0x3d')](_0x3eaeae['query']['sort']);_0xb8b880[_0xc3dc('0x3f')]=qs[_0xc3dc('0x35')](_['pick'](_0x3eaeae[_0xc3dc('0x34')],_0x13021e[_0xc3dc('0x35')]));if(_0x3eaeae[_0xc3dc('0x34')][_0xc3dc('0x42')]){_0xb8b880[_0xc3dc('0x3f')]=_[_0xc3dc('0x43')](_0xb8b880[_0xc3dc('0x3f')],{'$or':_[_0xc3dc('0x2d')](_0xb8b880[_0xc3dc('0x38')],function(_0xe86e5e){var _0x3e41c2={};_0x3e41c2[_0xe86e5e]={'$like':'%'+_0x3eaeae['query'][_0xc3dc('0x42')]+'%'};return _0x3e41c2;})});}_0xb8b880=_['merge']({},_0xb8b880,_0x3eaeae[_0xc3dc('0x44')]);return _0xf9e4b8[_0xc3dc('0x86')](_0xb8b880);}})['then'](function(_0x3be03c){if(_0x3be03c){_0x4b1b9c=_0x3be03c['length'];if(!_0x3eaeae[_0xc3dc('0x34')]['hasOwnProperty']('nolimit')){_0xb8b880[_0xc3dc('0x22')]=qs['limit'](_0x3eaeae[_0xc3dc('0x34')][_0xc3dc('0x22')]);_0xb8b880[_0xc3dc('0x21')]=qs['offset'](_0x3eaeae[_0xc3dc('0x34')][_0xc3dc('0x21')]);}return _0xf9e4b8[_0xc3dc('0x86')](_0xb8b880);}})[_0xc3dc('0x28')](function(_0x5837f7){if(_0x5837f7){return _0x5837f7?{'count':_0x4b1b9c,'rows':_0x5837f7}:null;}})[_0xc3dc('0x28')](respondWithResult(_0x5aebdf,null))['catch'](handleError(_0x5aebdf,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 63749ae..c87f7c0 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 _0xe435=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x32e83a,_0x3f88d0){var _0x89facd=function(_0x231178){while(--_0x231178){_0x32e83a['push'](_0x32e83a['shift']());}};_0x89facd(++_0x3f88d0);}(_0xe435,0x1d9));var _0x5e43=function(_0x5d14bf,_0x5214bd){_0x5d14bf=_0x5d14bf-0x0;var _0x4a1810=_0xe435[_0x5d14bf];return _0x4a1810;};'use strict';var EventEmitter=require(_0x5e43('0x0'));var FaxQueue=require(_0x5e43('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e43('0x2'),'afterUpdate':_0x5e43('0x3'),'afterDestroy':_0x5e43('0x4')};function emitEvent(_0x3bc3fe){return function(_0x365cfb,_0x5db2da,_0xbceba5){FaxQueueEvents['emit'](_0x3bc3fe+':'+_0x365cfb['id'],_0x365cfb);FaxQueueEvents[_0x5e43('0x5')](_0x3bc3fe,_0x365cfb);_0xbceba5(null);};}for(var e in events){if(events[_0x5e43('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x5e43('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x27f3=['hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x495229,_0xc68730){var _0x37ae6d=function(_0x4d5498){while(--_0x4d5498){_0x495229['push'](_0x495229['shift']());}};_0x37ae6d(++_0xc68730);}(_0x27f3,0x6e));var _0x327f=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0x27f3[_0x405385];return _0x43837b;};'use strict';var EventEmitter=require(_0x327f('0x0'));var FaxQueue=require(_0x327f('0x1'))['db'][_0x327f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x327f('0x3')](0x0);var events={'afterCreate':_0x327f('0x4'),'afterUpdate':'update','afterDestroy':_0x327f('0x5')};function emitEvent(_0x3f0dea){return function(_0x69eafc,_0x2e23c8,_0x45a58c){FaxQueueEvents[_0x327f('0x6')](_0x3f0dea+':'+_0x69eafc['id'],_0x69eafc);FaxQueueEvents['emit'](_0x3f0dea,_0x69eafc);_0x45a58c(null);};}for(var e in events){if(events[_0x327f('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x327f('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 1075a82..02be5ea 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 _0x76b0=['path','rimraf','../../config/environment','exports','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','request-promise'];(function(_0x507597,_0x412525){var _0x110a0f=function(_0x57935a){while(--_0x57935a){_0x507597['push'](_0x507597['shift']());}};_0x110a0f(++_0x412525);}(_0x76b0,0x8a));var _0x076b=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x76b0[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x076b('0x0'));var util=require('util');var logger=require(_0x076b('0x1'))(_0x076b('0x2'));var moment=require(_0x076b('0x3'));var BPromise=require('bluebird');var rp=require(_0x076b('0x4'));var fs=require('fs');var path=require(_0x076b('0x5'));var rimraf=require(_0x076b('0x6'));var config=require(_0x076b('0x7'));var attributes=require('./faxQueue.attributes');module[_0x076b('0x8')]=function(_0x44b796,_0x33ca02){return _0x44b796['define'](_0x076b('0x9'),attributes,{'tableName':_0x076b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91ad=['fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxQueue'];(function(_0x296754,_0x5befe9){var _0x1d9f1d=function(_0x3f033e){while(--_0x3f033e){_0x296754['push'](_0x296754['shift']());}};_0x1d9f1d(++_0x5befe9);}(_0x91ad,0xfd));var _0xd91a=function(_0x36b46a,_0x23b060){_0x36b46a=_0x36b46a-0x0;var _0x3fef23=_0x91ad[_0x36b46a];return _0x3fef23;};'use strict';var _=require(_0xd91a('0x0'));var util=require(_0xd91a('0x1'));var logger=require('../../config/logger')(_0xd91a('0x2'));var moment=require(_0xd91a('0x3'));var BPromise=require(_0xd91a('0x4'));var rp=require(_0xd91a('0x5'));var fs=require('fs');var path=require(_0xd91a('0x6'));var rimraf=require(_0xd91a('0x7'));var config=require(_0xd91a('0x8'));var attributes=require('./faxQueue.attributes');module[_0xd91a('0x9')]=function(_0x35fd2e,_0xcfe847){return _0x35fd2e['define'](_0xd91a('0xa'),attributes,{'tableName':_0xd91a('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 e2de2a3..ea57f39 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 _0xaeff=['map','model','GetFaxQueue','catch','find','ShowFaxQueue','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','FaxQueue','options','raw','where','attributes','limit','include'];(function(_0x3dec8f,_0x6622c4){var _0x2f67cb=function(_0x436717){while(--_0x436717){_0x3dec8f['push'](_0x3dec8f['shift']());}};_0x2f67cb(++_0x6622c4);}(_0xaeff,0x18d));var _0xfaef=function(_0x3174db,_0x49da42){_0x3174db=_0x3174db-0x0;var _0x4a897=_0xaeff[_0x3174db];return _0x4a897;};'use strict';var _=require('lodash');var util=require(_0xfaef('0x0'));var moment=require(_0xfaef('0x1'));var BPromise=require(_0xfaef('0x2'));var rs=require(_0xfaef('0x3'));var fs=require('fs');var Redis=require(_0xfaef('0x4'));var db=require(_0xfaef('0x5'))['db'];var utils=require(_0xfaef('0x6'));var logger=require(_0xfaef('0x7'))('rpc');var config=require(_0xfaef('0x8'));var jayson=require(_0xfaef('0x9'));var client=jayson[_0xfaef('0xa')]['http']({'port':0x232a});config[_0xfaef('0xb')]=_[_0xfaef('0xc')](config['redis'],{'host':_0xfaef('0xd'),'port':0x18eb});var socket=require(_0xfaef('0xe'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xfaef('0xf')](socket);function respondWithRpcPromise(_0x1644fc,_0xd91162,_0x5ace64){return new BPromise(function(_0x5f321e,_0x4fef77){return client['request'](_0x1644fc,_0x5ace64)[_0xfaef('0x10')](function(_0x3f121f){logger[_0xfaef('0x11')](_0xfaef('0x12'),_0xd91162,'request\x20sent');logger[_0xfaef('0x13')](_0xfaef('0x14'),_0xd91162,_0xfaef('0x15'),JSON['stringify'](_0x3f121f));if(_0x3f121f[_0xfaef('0x16')]){if(_0x3f121f[_0xfaef('0x16')]['code']===0x1f4){logger[_0xfaef('0x16')](_0xfaef('0x12'),_0xd91162,_0x3f121f['error'][_0xfaef('0x17')]);return _0x4fef77(_0x3f121f[_0xfaef('0x16')]['message']);}logger[_0xfaef('0x16')](_0xfaef('0x12'),_0xd91162,_0x3f121f[_0xfaef('0x16')][_0xfaef('0x17')]);return _0x5f321e(_0x3f121f['error'][_0xfaef('0x17')]);}else{logger[_0xfaef('0x11')](_0xfaef('0x12'),_0xd91162,_0xfaef('0x15'));_0x5f321e(_0x3f121f[_0xfaef('0x18')][_0xfaef('0x17')]);}})['catch'](function(_0x47a0bf){logger['error']('FaxQueue,\x20%s,\x20%s',_0xd91162,_0x47a0bf);_0x4fef77(_0x47a0bf);});});}exports['GetFaxQueue']=function(_0x52b976){var _0x547327=this;return new Promise(function(_0x347836,_0x4b4aea){return db[_0xfaef('0x19')]['findAll']({'raw':_0x52b976['options']?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1b')]===undefined?!![]:![]:!![],'where':_0x52b976[_0xfaef('0x1a')]?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1c')]||null:null,'attributes':_0x52b976[_0xfaef('0x1a')]?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1d')]||null:null,'limit':_0x52b976['options']?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1e')]||null:null,'include':_0x52b976[_0xfaef('0x1a')]?_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1f')]?_[_0xfaef('0x20')](_0x52b976[_0xfaef('0x1a')][_0xfaef('0x1f')],function(_0x129226){return{'model':db[_0x129226[_0xfaef('0x21')]],'as':_0x129226['as'],'attributes':_0x129226[_0xfaef('0x1d')],'include':_0x129226[_0xfaef('0x1f')]?_[_0xfaef('0x20')](_0x129226['include'],function(_0xb5106b){return{'model':db[_0xb5106b[_0xfaef('0x21')]],'as':_0xb5106b['as'],'attributes':_0xb5106b['attributes'],'include':_0xb5106b[_0xfaef('0x1f')]?_[_0xfaef('0x20')](_0xb5106b[_0xfaef('0x1f')],function(_0x2232d8){return{'model':db[_0x2232d8[_0xfaef('0x21')]],'as':_0x2232d8['as'],'attributes':_0x2232d8['attributes']};}):[]};}):[]};}):[]:[]})[_0xfaef('0x10')](function(_0x47795c){logger['info'](_0xfaef('0x22'),_0x52b976);logger[_0xfaef('0x13')](_0xfaef('0x22'),_0x52b976,JSON['stringify'](_0x47795c));_0x347836(_0x47795c);})[_0xfaef('0x23')](function(_0x266d4d){logger['error']('GetFaxQueue',_0x266d4d[_0xfaef('0x17')],_0x52b976);_0x4b4aea(_0x547327[_0xfaef('0x16')](0x1f4,_0x266d4d[_0xfaef('0x17')]));});});};exports['ShowFaxQueue']=function(_0x3d3c57){var _0x48e2c1=this;return new Promise(function(_0x42d72b,_0x12a05c){return db[_0xfaef('0x19')][_0xfaef('0x24')]({'raw':_0x3d3c57[_0xfaef('0x1a')]?_0x3d3c57['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d3c57[_0xfaef('0x1a')]?_0x3d3c57['options']['where']||null:null,'attributes':_0x3d3c57[_0xfaef('0x1a')]?_0x3d3c57[_0xfaef('0x1a')][_0xfaef('0x1d')]||null:null,'include':_0x3d3c57[_0xfaef('0x1a')]?_0x3d3c57[_0xfaef('0x1a')][_0xfaef('0x1f')]?_[_0xfaef('0x20')](_0x3d3c57['options']['include'],function(_0x33057b){return{'model':db[_0x33057b[_0xfaef('0x21')]],'as':_0x33057b['as'],'attributes':_0x33057b[_0xfaef('0x1d')],'include':_0x33057b[_0xfaef('0x1f')]?_['map'](_0x33057b[_0xfaef('0x1f')],function(_0x53be23){return{'model':db[_0x53be23[_0xfaef('0x21')]],'as':_0x53be23['as'],'attributes':_0x53be23[_0xfaef('0x1d')],'include':_0x53be23['include']?_['map'](_0x53be23[_0xfaef('0x1f')],function(_0x761f48){return{'model':db[_0x761f48[_0xfaef('0x21')]],'as':_0x761f48['as'],'attributes':_0x761f48['attributes']};}):[]};}):[]};}):[]:[]})[_0xfaef('0x10')](function(_0x311182){logger['info'](_0xfaef('0x25'),_0x3d3c57);logger['debug'](_0xfaef('0x25'),_0x3d3c57,JSON[_0xfaef('0x26')](_0x311182));_0x42d72b(_0x311182);})[_0xfaef('0x23')](function(_0xe39b15){logger[_0xfaef('0x16')](_0xfaef('0x25'),_0xe39b15[_0xfaef('0x17')],_0x3d3c57);_0x12a05c(_0x48e2c1[_0xfaef('0x16')](0x1f4,_0xe39b15['message']));});});}; \ No newline at end of file +var _0x2458=['jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','include','map','model','attributes','debug','ShowFaxQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5c4ce5,_0x216a3c){var _0x2729d5=function(_0xfcbc2e){while(--_0xfcbc2e){_0x5c4ce5['push'](_0x5c4ce5['shift']());}};_0x2729d5(++_0x216a3c);}(_0x2458,0x10e));var _0x8245=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2458[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x8245('0x0'));var util=require(_0x8245('0x1'));var moment=require(_0x8245('0x2'));var BPromise=require(_0x8245('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8245('0x4'));var db=require(_0x8245('0x5'))['db'];var utils=require(_0x8245('0x6'));var logger=require(_0x8245('0x7'))(_0x8245('0x8'));var config=require(_0x8245('0x9'));var jayson=require(_0x8245('0xa'));var client=jayson[_0x8245('0xb')]['http']({'port':0x232a});config['redis']=_[_0x8245('0xc')](config[_0x8245('0xd')],{'host':_0x8245('0xe'),'port':0x18eb});var socket=require(_0x8245('0xf'))(new Redis(config[_0x8245('0xd')]));require('./faxQueue.socket')[_0x8245('0x10')](socket);function respondWithRpcPromise(_0x273ad1,_0x233623,_0x409c78){return new BPromise(function(_0x1bf51c,_0x51ca3e){return client['request'](_0x273ad1,_0x409c78)[_0x8245('0x11')](function(_0x5148d9){logger[_0x8245('0x12')](_0x8245('0x13'),_0x233623,_0x8245('0x14'));logger['debug'](_0x8245('0x15'),_0x233623,_0x8245('0x14'),JSON[_0x8245('0x16')](_0x5148d9));if(_0x5148d9['error']){if(_0x5148d9[_0x8245('0x17')]['code']===0x1f4){logger['error'](_0x8245('0x13'),_0x233623,_0x5148d9['error'][_0x8245('0x18')]);return _0x51ca3e(_0x5148d9['error']['message']);}logger[_0x8245('0x17')](_0x8245('0x13'),_0x233623,_0x5148d9[_0x8245('0x17')][_0x8245('0x18')]);return _0x1bf51c(_0x5148d9[_0x8245('0x17')][_0x8245('0x18')]);}else{logger[_0x8245('0x12')](_0x8245('0x13'),_0x233623,'request\x20sent');_0x1bf51c(_0x5148d9['result']['message']);}})[_0x8245('0x19')](function(_0x5552c0){logger[_0x8245('0x17')]('FaxQueue,\x20%s,\x20%s',_0x233623,_0x5552c0);_0x51ca3e(_0x5552c0);});});}exports[_0x8245('0x1a')]=function(_0x63d619){var _0xa7f914=this;return new Promise(function(_0x148888,_0x27b72f){return db[_0x8245('0x1b')][_0x8245('0x1c')]({'raw':_0x63d619[_0x8245('0x1d')]?_0x63d619['options']['raw']===undefined?!![]:![]:!![],'where':_0x63d619[_0x8245('0x1d')]?_0x63d619[_0x8245('0x1d')][_0x8245('0x1e')]||null:null,'attributes':_0x63d619[_0x8245('0x1d')]?_0x63d619[_0x8245('0x1d')]['attributes']||null:null,'limit':_0x63d619[_0x8245('0x1d')]?_0x63d619[_0x8245('0x1d')][_0x8245('0x1f')]||null:null,'include':_0x63d619[_0x8245('0x1d')]?_0x63d619[_0x8245('0x1d')][_0x8245('0x20')]?_[_0x8245('0x21')](_0x63d619['options'][_0x8245('0x20')],function(_0x4466a8){return{'model':db[_0x4466a8[_0x8245('0x22')]],'as':_0x4466a8['as'],'attributes':_0x4466a8['attributes'],'include':_0x4466a8['include']?_[_0x8245('0x21')](_0x4466a8[_0x8245('0x20')],function(_0x3cf644){return{'model':db[_0x3cf644[_0x8245('0x22')]],'as':_0x3cf644['as'],'attributes':_0x3cf644['attributes'],'include':_0x3cf644[_0x8245('0x20')]?_['map'](_0x3cf644[_0x8245('0x20')],function(_0x83ef49){return{'model':db[_0x83ef49[_0x8245('0x22')]],'as':_0x83ef49['as'],'attributes':_0x83ef49[_0x8245('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9f0545){logger['info'](_0x8245('0x1a'),_0x63d619);logger[_0x8245('0x24')](_0x8245('0x1a'),_0x63d619,JSON[_0x8245('0x16')](_0x9f0545));_0x148888(_0x9f0545);})['catch'](function(_0xf4fbc9){logger[_0x8245('0x17')](_0x8245('0x1a'),_0xf4fbc9[_0x8245('0x18')],_0x63d619);_0x27b72f(_0xa7f914['error'](0x1f4,_0xf4fbc9[_0x8245('0x18')]));});});};exports[_0x8245('0x25')]=function(_0xc0322c){var _0x7f4a6b=this;return new Promise(function(_0x348f76,_0x22d9a5){return db['FaxQueue'][_0x8245('0x26')]({'raw':_0xc0322c[_0x8245('0x1d')]?_0xc0322c[_0x8245('0x1d')][_0x8245('0x27')]===undefined?!![]:![]:!![],'where':_0xc0322c[_0x8245('0x1d')]?_0xc0322c['options'][_0x8245('0x1e')]||null:null,'attributes':_0xc0322c['options']?_0xc0322c[_0x8245('0x1d')]['attributes']||null:null,'include':_0xc0322c[_0x8245('0x1d')]?_0xc0322c[_0x8245('0x1d')][_0x8245('0x20')]?_[_0x8245('0x21')](_0xc0322c['options'][_0x8245('0x20')],function(_0x5f2dcb){return{'model':db[_0x5f2dcb[_0x8245('0x22')]],'as':_0x5f2dcb['as'],'attributes':_0x5f2dcb[_0x8245('0x23')],'include':_0x5f2dcb[_0x8245('0x20')]?_[_0x8245('0x21')](_0x5f2dcb[_0x8245('0x20')],function(_0x5cdcb5){return{'model':db[_0x5cdcb5[_0x8245('0x22')]],'as':_0x5cdcb5['as'],'attributes':_0x5cdcb5[_0x8245('0x23')],'include':_0x5cdcb5[_0x8245('0x20')]?_[_0x8245('0x21')](_0x5cdcb5[_0x8245('0x20')],function(_0x1b8f24){return{'model':db[_0x1b8f24['model']],'as':_0x1b8f24['as'],'attributes':_0x1b8f24[_0x8245('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8245('0x11')](function(_0x579ca2){logger[_0x8245('0x12')](_0x8245('0x25'),_0xc0322c);logger[_0x8245('0x24')](_0x8245('0x25'),_0xc0322c,JSON[_0x8245('0x16')](_0x579ca2));_0x348f76(_0x579ca2);})['catch'](function(_0xab2e68){logger[_0x8245('0x17')](_0x8245('0x25'),_0xab2e68['message'],_0xc0322c);_0x22d9a5(_0x7f4a6b[_0x8245('0x17')](0x1f4,_0xab2e68['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index fb4def4..5657749 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 _0xc2e2=['emit','removeListener','register','length','./faxQueue.events','update'];(function(_0x3622db,_0x54fd21){var _0x5f34a3=function(_0x2fb452){while(--_0x2fb452){_0x3622db['push'](_0x3622db['shift']());}};_0x5f34a3(++_0x54fd21);}(_0xc2e2,0xb2));var _0x2c2e=function(_0x1a14fa,_0x544583){_0x1a14fa=_0x1a14fa-0x0;var _0x46d83f=_0xc2e2[_0x1a14fa];return _0x46d83f;};'use strict';var FaxQueueEvents=require(_0x2c2e('0x0'));var events=['save','remove',_0x2c2e('0x1')];function createListener(_0x14efdb,_0x5a8976){return function(_0x25815e){_0x5a8976[_0x2c2e('0x2')](_0x14efdb,_0x25815e);};}function removeListener(_0x4072cc,_0x34d0d0){return function(){FaxQueueEvents[_0x2c2e('0x3')](_0x4072cc,_0x34d0d0);};}exports[_0x2c2e('0x4')]=function(_0xbe077b){for(var _0x5994bb=0x0,_0x19d299=events[_0x2c2e('0x5')];_0x5994bb<_0x19d299;_0x5994bb++){var _0x45ab15=events[_0x5994bb];var _0x5a4e6a=createListener('faxQueue:'+_0x45ab15,_0xbe077b);FaxQueueEvents['on'](_0x45ab15,_0x5a4e6a);}}; \ No newline at end of file +var _0xee05=['remove','update','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x1c1955,_0x347c1b){var _0xed061a=function(_0x5ec4dc){while(--_0x5ec4dc){_0x1c1955['push'](_0x1c1955['shift']());}};_0xed061a(++_0x347c1b);}(_0xee05,0x110));var _0x5ee0=function(_0x551a64,_0x4407e0){_0x551a64=_0x551a64-0x0;var _0x3452c3=_0xee05[_0x551a64];return _0x3452c3;};'use strict';var FaxQueueEvents=require(_0x5ee0('0x0'));var events=['save',_0x5ee0('0x1'),_0x5ee0('0x2')];function createListener(_0xaca72d,_0x57dca3){return function(_0x114723){_0x57dca3['emit'](_0xaca72d,_0x114723);};}function removeListener(_0x36203c,_0x39917a){return function(){FaxQueueEvents[_0x5ee0('0x3')](_0x36203c,_0x39917a);};}exports[_0x5ee0('0x4')]=function(_0x324c3){for(var _0x2ec17e=0x0,_0x121c54=events[_0x5ee0('0x5')];_0x2ec17e<_0x121c54;_0x2ec17e++){var _0x56f90c=events[_0x2ec17e];var _0x282e48=createListener(_0x5ee0('0x6')+_0x56f90c,_0x324c3);FaxQueueEvents['on'](_0x56f90c,_0x282e48);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4e0cfcf..072c268 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e2272,_0x2e1ae0){_0x4e2272=_0x4e2272-0x0;var _0x45511c=_0x0b0e[_0x4e2272];return _0x45511c;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file +var _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(_0x4b2fb5,_0x4d4120){var _0x2fd394=function(_0x4da0c9){while(--_0x4da0c9){_0x4b2fb5['push'](_0x4b2fb5['shift']());}};_0x2fd394(++_0x4d4120);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0ae52e6..a02725d 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 _0x0145=['STRING','DATE','moment','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0145,0x1e2));var _0x5014=function(_0xd9fd65,_0x52f51f){_0xd9fd65=_0xd9fd65-0x0;var _0x12c2c3=_0x0145[_0xd9fd65];return _0x12c2c3;};'use strict';var moment=require(_0x5014('0x0'));var Sequelize=require(_0x5014('0x1'));module[_0x5014('0x2')]={'uniqueid':{'type':Sequelize[_0x5014('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5014('0x4')]},'exitAt':{'type':Sequelize[_0x5014('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbd8e=['STRING','DATE','moment','exports'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0xbd8e,0x15a));var _0xebd8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbd8e[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require(_0xebd8('0x0'));var Sequelize=require('sequelize');module[_0xebd8('0x1')]={'uniqueid':{'type':Sequelize[_0xebd8('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xebd8('0x3')]},'acceptAt':{'type':Sequelize[_0xebd8('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c43258e..dd1f357 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 _0x3f24=['rows','show','params','keys','create','body','catch','find','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include'];(function(_0xeda28,_0x42da7a){var _0x697e43=function(_0x32368d){while(--_0x32368d){_0xeda28['push'](_0xeda28['shift']());}};_0x697e43(++_0x42da7a);}(_0x3f24,0x163));var _0x43f2=function(_0xcc3c31,_0x3c509b){_0xcc3c31=_0xcc3c31-0x0;var _0x55d249=_0x3f24[_0xcc3c31];return _0x55d249;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x43f2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43f2('0x1'));var rp=require(_0x43f2('0x2'));var moment=require('moment');var BPromise=require(_0x43f2('0x3'));var Mustache=require(_0x43f2('0x4'));var util=require(_0x43f2('0x5'));var path=require(_0x43f2('0x6'));var sox=require(_0x43f2('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x43f2('0x8'));var jsforce=require(_0x43f2('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x43f2('0xa'));var Papa=require(_0x43f2('0xb'));var Redis=require(_0x43f2('0xc'));var authService=require(_0x43f2('0xd'));var qs=require(_0x43f2('0xe'));var as=require(_0x43f2('0xf'));var hardwareService=require(_0x43f2('0x10'));var logger=require(_0x43f2('0x11'))(_0x43f2('0x12'));var utils=require(_0x43f2('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13a79b,_0x208edb){_0x208edb=_0x208edb||0xcc;return function(_0x1e0d32){if(_0x1e0d32){return _0x13a79b[_0x43f2('0x14')](_0x208edb);}return _0x13a79b['status'](_0x208edb)[_0x43f2('0x15')]();};}function respondWithResult(_0x5d58c6,_0x183688){_0x183688=_0x183688||0xc8;return function(_0x20d36e){if(_0x20d36e){return _0x5d58c6[_0x43f2('0x16')](_0x183688)[_0x43f2('0x17')](_0x20d36e);}};}function respondWithFilteredResult(_0x1c1903,_0x29f93c){return function(_0x4e5763){if(_0x4e5763){var _0x47442b=_0x4e5763[_0x43f2('0x18')],_0x3369d2=_0x29f93c[_0x43f2('0x19')],_0x3a2f03=_0x29f93c[_0x43f2('0x19')]+_0x29f93c[_0x43f2('0x1a')],_0x2a4d57;if(_0x3a2f03>=_0x47442b){_0x3a2f03=_0x47442b;_0x2a4d57=0xc8;}else{_0x2a4d57=0xce;}_0x1c1903[_0x43f2('0x16')](_0x2a4d57);return _0x1c1903[_0x43f2('0x1b')](_0x43f2('0x1c'),_0x3369d2+'-'+_0x3a2f03+'/'+_0x47442b)[_0x43f2('0x17')](_0x4e5763);}return null;};}function patchUpdates(_0x40238e){return function(_0x47c834){try{jsonpatch[_0x43f2('0x1d')](_0x47c834,_0x40238e,!![]);}catch(_0x219e40){return BPromise['reject'](_0x219e40);}return _0x47c834[_0x43f2('0x1e')]();};}function saveUpdates(_0x1ac978,_0x32e4cf){return function(_0x4e0d31){if(_0x4e0d31){return _0x4e0d31[_0x43f2('0x1f')](_0x1ac978)[_0x43f2('0x20')](function(_0x30a391){return _0x30a391;});}return null;};}function removeEntity(_0x4586bf,_0x1ad763){return function(_0x201750){if(_0x201750){return _0x201750['destroy']()[_0x43f2('0x20')](function(){_0x4586bf[_0x43f2('0x16')](0xcc)[_0x43f2('0x15')]();});}};}function handleEntityNotFound(_0x20f953,_0x2d534e){return function(_0x2d2145){if(!_0x2d2145){_0x20f953[_0x43f2('0x14')](0x194);}return _0x2d2145;};}function handleError(_0x2f7ee3,_0x23c5b8){_0x23c5b8=_0x23c5b8||0x1f4;return function(_0x49b87d){logger[_0x43f2('0x21')](_0x49b87d[_0x43f2('0x22')]);if(_0x49b87d[_0x43f2('0x23')]){delete _0x49b87d[_0x43f2('0x23')];}_0x2f7ee3[_0x43f2('0x16')](_0x23c5b8)[_0x43f2('0x24')](_0x49b87d);};}exports[_0x43f2('0x25')]=function(_0x4e428d,_0x1b8e61){var _0x10d1de={},_0x4cdbe5={},_0x39c6af={'count':0x0,'rows':[]};var _0x4cbaca=_[_0x43f2('0x26')](db[_0x43f2('0x27')][_0x43f2('0x28')],function(_0x2e9b73){return{'name':_0x2e9b73[_0x43f2('0x29')],'type':_0x2e9b73['type'][_0x43f2('0x2a')]};});_0x4cdbe5[_0x43f2('0x2b')]=_[_0x43f2('0x26')](_0x4cbaca,_0x43f2('0x23'));_0x4cdbe5[_0x43f2('0x2c')]=_['keys'](_0x4e428d['query']);_0x4cdbe5[_0x43f2('0x2d')]=_[_0x43f2('0x2e')](_0x4cdbe5[_0x43f2('0x2b')],_0x4cdbe5[_0x43f2('0x2c')]);_0x10d1de[_0x43f2('0x2f')]=_[_0x43f2('0x2e')](_0x4cdbe5[_0x43f2('0x2b')],qs[_0x43f2('0x30')](_0x4e428d[_0x43f2('0x2c')][_0x43f2('0x30')]));_0x10d1de[_0x43f2('0x2f')]=_0x10d1de[_0x43f2('0x2f')][_0x43f2('0x31')]?_0x10d1de[_0x43f2('0x2f')]:_0x4cdbe5['model'];if(!_0x4e428d[_0x43f2('0x2c')]['hasOwnProperty']('nolimit')){_0x10d1de[_0x43f2('0x1a')]=qs[_0x43f2('0x1a')](_0x4e428d[_0x43f2('0x2c')][_0x43f2('0x1a')]);_0x10d1de[_0x43f2('0x19')]=qs[_0x43f2('0x19')](_0x4e428d[_0x43f2('0x2c')]['offset']);}_0x10d1de[_0x43f2('0x32')]=qs[_0x43f2('0x33')](_0x4e428d[_0x43f2('0x2c')]['sort']);_0x10d1de['where']=qs['filters'](_[_0x43f2('0x34')](_0x4e428d[_0x43f2('0x2c')],_0x4cdbe5['filters']),_0x4cbaca);if(_0x4e428d[_0x43f2('0x2c')]['filter']){_0x10d1de[_0x43f2('0x35')]=_[_0x43f2('0x36')](_0x10d1de[_0x43f2('0x35')],{'$or':_[_0x43f2('0x26')](_0x4cbaca,function(_0x92c763){if(_0x92c763['type']!==_0x43f2('0x37')){var _0x4c4602={};_0x4c4602[_0x92c763[_0x43f2('0x23')]]={'$like':'%'+_0x4e428d[_0x43f2('0x2c')][_0x43f2('0x38')]+'%'};return _0x4c4602;}})});}_0x10d1de=_[_0x43f2('0x36')]({},_0x10d1de,_0x4e428d['options']);var _0x2e3805={'where':_0x10d1de[_0x43f2('0x35')]};return db[_0x43f2('0x27')][_0x43f2('0x18')](_0x2e3805)[_0x43f2('0x20')](function(_0x5a04a3){_0x39c6af[_0x43f2('0x18')]=_0x5a04a3;if(_0x4e428d['query'][_0x43f2('0x39')]){_0x10d1de[_0x43f2('0x3a')]=[{'all':!![]}];}return db[_0x43f2('0x27')]['findAll'](_0x10d1de);})['then'](function(_0x36ce23){_0x39c6af[_0x43f2('0x3b')]=_0x36ce23;return _0x39c6af;})[_0x43f2('0x20')](respondWithFilteredResult(_0x1b8e61,_0x10d1de))['catch'](handleError(_0x1b8e61,null));};exports[_0x43f2('0x3c')]=function(_0x48fe65,_0x4ebe1e){var _0x20f6d3={'raw':!![],'where':{'id':_0x48fe65[_0x43f2('0x3d')]['id']}},_0xb7a400={};_0xb7a400[_0x43f2('0x2b')]=_[_0x43f2('0x3e')](db['FaxQueueReport'][_0x43f2('0x28')]);_0xb7a400[_0x43f2('0x2c')]=_[_0x43f2('0x3e')](_0x48fe65[_0x43f2('0x2c')]);_0xb7a400[_0x43f2('0x2d')]=_[_0x43f2('0x2e')](_0xb7a400[_0x43f2('0x2b')],_0xb7a400[_0x43f2('0x2c')]);_0x20f6d3['attributes']=_[_0x43f2('0x2e')](_0xb7a400['model'],qs[_0x43f2('0x30')](_0x48fe65[_0x43f2('0x2c')][_0x43f2('0x30')]));_0x20f6d3['attributes']=_0x20f6d3[_0x43f2('0x2f')][_0x43f2('0x31')]?_0x20f6d3[_0x43f2('0x2f')]:_0xb7a400[_0x43f2('0x2b')];if(_0x48fe65[_0x43f2('0x2c')][_0x43f2('0x39')]){_0x20f6d3[_0x43f2('0x3a')]=[{'all':!![]}];}_0x20f6d3=_['merge']({},_0x20f6d3,_0x48fe65['options']);return db[_0x43f2('0x27')]['find'](_0x20f6d3)[_0x43f2('0x20')](handleEntityNotFound(_0x4ebe1e,null))[_0x43f2('0x20')](respondWithResult(_0x4ebe1e,null))['catch'](handleError(_0x4ebe1e,null));};exports[_0x43f2('0x3f')]=function(_0x58136d,_0x1a66b3){return db['FaxQueueReport'][_0x43f2('0x3f')](_0x58136d[_0x43f2('0x40')],{})['then'](respondWithResult(_0x1a66b3,0xc9))[_0x43f2('0x41')](handleError(_0x1a66b3,null));};exports[_0x43f2('0x1f')]=function(_0x3b5593,_0x17c6f4){if(_0x3b5593[_0x43f2('0x40')]['id']){delete _0x3b5593['body']['id'];}return db[_0x43f2('0x27')][_0x43f2('0x42')]({'where':{'id':_0x3b5593['params']['id']}})[_0x43f2('0x20')](handleEntityNotFound(_0x17c6f4,null))['then'](saveUpdates(_0x3b5593[_0x43f2('0x40')],null))[_0x43f2('0x20')](respondWithResult(_0x17c6f4,null))['catch'](handleError(_0x17c6f4,null));};exports[_0x43f2('0x43')]=function(_0x5ba550,_0x32c620){return db[_0x43f2('0x27')][_0x43f2('0x42')]({'where':{'id':_0x5ba550[_0x43f2('0x3d')]['id']}})[_0x43f2('0x20')](handleEntityNotFound(_0x32c620,null))['then'](removeEntity(_0x32c620,null))[_0x43f2('0x41')](handleError(_0x32c620,null));};exports[_0x43f2('0x44')]=function(_0xd058de,_0x10557d){return db[_0x43f2('0x27')][_0x43f2('0x44')]()[_0x43f2('0x20')](respondWithResult(_0x10557d,null))[_0x43f2('0x41')](handleError(_0x10557d,null));}; \ No newline at end of file +var _0xa5d6=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','FaxQueueReport','findAll','rows','catch','create','body','find','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection'];(function(_0x2f3dc4,_0x3b81fe){var _0x6588fb=function(_0x5bed64){while(--_0x5bed64){_0x2f3dc4['push'](_0x2f3dc4['shift']());}};_0x6588fb(++_0x3b81fe);}(_0xa5d6,0x1d5));var _0x6a5d=function(_0x3865e4,_0x6a1cd7){_0x3865e4=_0x3865e4-0x0;var _0x1ec05e=_0xa5d6[_0x3865e4];return _0x1ec05e;};'use strict';var pdf=require(_0x6a5d('0x0'));var emlformat=require(_0x6a5d('0x1'));var rimraf=require(_0x6a5d('0x2'));var zipdir=require(_0x6a5d('0x3'));var jsonpatch=require(_0x6a5d('0x4'));var rp=require(_0x6a5d('0x5'));var moment=require('moment');var BPromise=require(_0x6a5d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6a5d('0x7'));var sox=require('sox');var csv=require(_0x6a5d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6a5d('0x9'));var crypto=require(_0x6a5d('0xa'));var jsforce=require(_0x6a5d('0xb'));var deskjs=require(_0x6a5d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6a5d('0xd'));var Redis=require(_0x6a5d('0xe'));var authService=require(_0x6a5d('0xf'));var qs=require(_0x6a5d('0x10'));var as=require(_0x6a5d('0x11'));var hardwareService=require(_0x6a5d('0x12'));var logger=require(_0x6a5d('0x13'))(_0x6a5d('0x14'));var utils=require(_0x6a5d('0x15'));var config=require('../../config/environment');var db=require(_0x6a5d('0x16'))['db'];function respondWithStatusCode(_0x2256d2,_0x460af2){_0x460af2=_0x460af2||0xcc;return function(_0x172748){if(_0x172748){return _0x2256d2[_0x6a5d('0x17')](_0x460af2);}return _0x2256d2[_0x6a5d('0x18')](_0x460af2)['end']();};}function respondWithResult(_0x454bbf,_0x22ed55){_0x22ed55=_0x22ed55||0xc8;return function(_0x58a4b3){if(_0x58a4b3){return _0x454bbf[_0x6a5d('0x18')](_0x22ed55)['json'](_0x58a4b3);}};}function respondWithFilteredResult(_0xa0479,_0x29547d){return function(_0x4d3991){if(_0x4d3991){var _0x5bfa26=_0x4d3991[_0x6a5d('0x19')],_0x470d31=_0x29547d[_0x6a5d('0x1a')],_0x566333=_0x29547d['offset']+_0x29547d[_0x6a5d('0x1b')],_0x43f0e8;if(_0x566333>=_0x5bfa26){_0x566333=_0x5bfa26;_0x43f0e8=0xc8;}else{_0x43f0e8=0xce;}_0xa0479[_0x6a5d('0x18')](_0x43f0e8);return _0xa0479[_0x6a5d('0x1c')](_0x6a5d('0x1d'),_0x470d31+'-'+_0x566333+'/'+_0x5bfa26)[_0x6a5d('0x1e')](_0x4d3991);}return null;};}function patchUpdates(_0x111ebf){return function(_0x421302){try{jsonpatch[_0x6a5d('0x1f')](_0x421302,_0x111ebf,!![]);}catch(_0x36bb5e){return BPromise['reject'](_0x36bb5e);}return _0x421302[_0x6a5d('0x20')]();};}function saveUpdates(_0x2a35d2,_0x2fe5c7){return function(_0x2771ef){if(_0x2771ef){return _0x2771ef[_0x6a5d('0x21')](_0x2a35d2)[_0x6a5d('0x22')](function(_0x271b51){return _0x271b51;});}return null;};}function removeEntity(_0x21a5a1,_0x4675b9){return function(_0x3b12c4){if(_0x3b12c4){return _0x3b12c4['destroy']()[_0x6a5d('0x22')](function(){_0x21a5a1[_0x6a5d('0x18')](0xcc)[_0x6a5d('0x23')]();});}};}function handleEntityNotFound(_0x493796,_0x3ba965){return function(_0x3ca973){if(!_0x3ca973){_0x493796[_0x6a5d('0x17')](0x194);}return _0x3ca973;};}function handleError(_0xb84604,_0x58eaab){_0x58eaab=_0x58eaab||0x1f4;return function(_0x173522){logger['error'](_0x173522[_0x6a5d('0x24')]);if(_0x173522['name']){delete _0x173522[_0x6a5d('0x25')];}_0xb84604[_0x6a5d('0x18')](_0x58eaab)[_0x6a5d('0x26')](_0x173522);};}exports[_0x6a5d('0x27')]=function(_0x123827,_0x6f1a09){var _0x47b4b5={},_0x2de4c5={},_0x500563={'count':0x0,'rows':[]};var _0x25b9d1=_[_0x6a5d('0x28')](db['FaxQueueReport'][_0x6a5d('0x29')],function(_0x39f970){return{'name':_0x39f970[_0x6a5d('0x2a')],'type':_0x39f970[_0x6a5d('0x2b')][_0x6a5d('0x2c')]};});_0x2de4c5[_0x6a5d('0x2d')]=_[_0x6a5d('0x28')](_0x25b9d1,_0x6a5d('0x25'));_0x2de4c5[_0x6a5d('0x2e')]=_[_0x6a5d('0x2f')](_0x123827[_0x6a5d('0x2e')]);_0x2de4c5['filters']=_[_0x6a5d('0x30')](_0x2de4c5[_0x6a5d('0x2d')],_0x2de4c5[_0x6a5d('0x2e')]);_0x47b4b5[_0x6a5d('0x31')]=_[_0x6a5d('0x30')](_0x2de4c5[_0x6a5d('0x2d')],qs[_0x6a5d('0x32')](_0x123827[_0x6a5d('0x2e')]['fields']));_0x47b4b5[_0x6a5d('0x31')]=_0x47b4b5[_0x6a5d('0x31')][_0x6a5d('0x33')]?_0x47b4b5[_0x6a5d('0x31')]:_0x2de4c5['model'];if(!_0x123827['query'][_0x6a5d('0x34')](_0x6a5d('0x35'))){_0x47b4b5[_0x6a5d('0x1b')]=qs[_0x6a5d('0x1b')](_0x123827['query'][_0x6a5d('0x1b')]);_0x47b4b5[_0x6a5d('0x1a')]=qs['offset'](_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x1a')]);}_0x47b4b5['order']=qs[_0x6a5d('0x36')](_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x36')]);_0x47b4b5[_0x6a5d('0x37')]=qs['filters'](_[_0x6a5d('0x38')](_0x123827[_0x6a5d('0x2e')],_0x2de4c5[_0x6a5d('0x39')]),_0x25b9d1);if(_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x3a')]){_0x47b4b5[_0x6a5d('0x37')]=_['merge'](_0x47b4b5[_0x6a5d('0x37')],{'$or':_[_0x6a5d('0x28')](_0x25b9d1,function(_0x588fec){if(_0x588fec[_0x6a5d('0x2b')]!==_0x6a5d('0x3b')){var _0x2ad7ab={};_0x2ad7ab[_0x588fec[_0x6a5d('0x25')]]={'$like':'%'+_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x3a')]+'%'};return _0x2ad7ab;}})});}_0x47b4b5=_[_0x6a5d('0x3c')]({},_0x47b4b5,_0x123827[_0x6a5d('0x3d')]);var _0x2be23b={'where':_0x47b4b5[_0x6a5d('0x37')]};return db['FaxQueueReport'][_0x6a5d('0x19')](_0x2be23b)['then'](function(_0x305af8){_0x500563[_0x6a5d('0x19')]=_0x305af8;if(_0x123827[_0x6a5d('0x2e')][_0x6a5d('0x3e')]){_0x47b4b5[_0x6a5d('0x3f')]=[{'all':!![]}];}return db[_0x6a5d('0x40')][_0x6a5d('0x41')](_0x47b4b5);})[_0x6a5d('0x22')](function(_0x401ae7){_0x500563[_0x6a5d('0x42')]=_0x401ae7;return _0x500563;})['then'](respondWithFilteredResult(_0x6f1a09,_0x47b4b5))[_0x6a5d('0x43')](handleError(_0x6f1a09,null));};exports['show']=function(_0x2778b7,_0x26c446){var _0x75d62c={'raw':!![],'where':{'id':_0x2778b7['params']['id']}},_0x2289be={};_0x2289be[_0x6a5d('0x2d')]=_['keys'](db[_0x6a5d('0x40')]['rawAttributes']);_0x2289be[_0x6a5d('0x2e')]=_[_0x6a5d('0x2f')](_0x2778b7[_0x6a5d('0x2e')]);_0x2289be[_0x6a5d('0x39')]=_[_0x6a5d('0x30')](_0x2289be['model'],_0x2289be[_0x6a5d('0x2e')]);_0x75d62c[_0x6a5d('0x31')]=_[_0x6a5d('0x30')](_0x2289be[_0x6a5d('0x2d')],qs[_0x6a5d('0x32')](_0x2778b7[_0x6a5d('0x2e')]['fields']));_0x75d62c[_0x6a5d('0x31')]=_0x75d62c[_0x6a5d('0x31')][_0x6a5d('0x33')]?_0x75d62c[_0x6a5d('0x31')]:_0x2289be[_0x6a5d('0x2d')];if(_0x2778b7[_0x6a5d('0x2e')][_0x6a5d('0x3e')]){_0x75d62c['include']=[{'all':!![]}];}_0x75d62c=_[_0x6a5d('0x3c')]({},_0x75d62c,_0x2778b7[_0x6a5d('0x3d')]);return db[_0x6a5d('0x40')]['find'](_0x75d62c)[_0x6a5d('0x22')](handleEntityNotFound(_0x26c446,null))[_0x6a5d('0x22')](respondWithResult(_0x26c446,null))[_0x6a5d('0x43')](handleError(_0x26c446,null));};exports[_0x6a5d('0x44')]=function(_0x4afa59,_0x1cfe64){return db[_0x6a5d('0x40')][_0x6a5d('0x44')](_0x4afa59[_0x6a5d('0x45')],{})[_0x6a5d('0x22')](respondWithResult(_0x1cfe64,0xc9))[_0x6a5d('0x43')](handleError(_0x1cfe64,null));};exports[_0x6a5d('0x21')]=function(_0x36af03,_0x255260){if(_0x36af03['body']['id']){delete _0x36af03[_0x6a5d('0x45')]['id'];}return db['FaxQueueReport'][_0x6a5d('0x46')]({'where':{'id':_0x36af03[_0x6a5d('0x47')]['id']}})[_0x6a5d('0x22')](handleEntityNotFound(_0x255260,null))['then'](saveUpdates(_0x36af03[_0x6a5d('0x45')],null))[_0x6a5d('0x22')](respondWithResult(_0x255260,null))[_0x6a5d('0x43')](handleError(_0x255260,null));};exports[_0x6a5d('0x48')]=function(_0x23d296,_0x58d883){return db[_0x6a5d('0x40')][_0x6a5d('0x46')]({'where':{'id':_0x23d296[_0x6a5d('0x47')]['id']}})['then'](handleEntityNotFound(_0x58d883,null))[_0x6a5d('0x22')](removeEntity(_0x58d883,null))[_0x6a5d('0x43')](handleError(_0x58d883,null));};exports[_0x6a5d('0x49')]=function(_0x5dcd6e,_0x4690d7){return db['FaxQueueReport'][_0x6a5d('0x49')]()[_0x6a5d('0x22')](respondWithResult(_0x4690d7,null))[_0x6a5d('0x43')](handleError(_0x4690d7,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 12897a9..6f47f41 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 _0xf61e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x526dc2,_0x37ebb8){var _0x54e521=function(_0x186bfb){while(--_0x186bfb){_0x526dc2['push'](_0x526dc2['shift']());}};_0x54e521(++_0x37ebb8);}(_0xf61e,0x191));var _0xef61=function(_0x254ba1,_0x3ce1f1){_0x254ba1=_0x254ba1-0x0;var _0x6c1995=_0xf61e[_0x254ba1];return _0x6c1995;};'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')]('FaxQueueReport',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x229c=['util','moment','path','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid'];(function(_0x367598,_0x234902){var _0xc85f35=function(_0x1d6e28){while(--_0x1d6e28){_0x367598['push'](_0x367598['shift']());}};_0xc85f35(++_0x234902);}(_0x229c,0xcf));var _0xc229=function(_0x3d44e7,_0x1b0cea){_0x3d44e7=_0x3d44e7-0x0;var _0x15e490=_0x229c[_0x3d44e7];return _0x15e490;};'use strict';var _=require('lodash');var util=require(_0xc229('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc229('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc229('0x2'));var rimraf=require('rimraf');var config=require(_0xc229('0x3'));var attributes=require(_0xc229('0x4'));module[_0xc229('0x5')]=function(_0x5a0d2c,_0x44aba3){return _0x5a0d2c['define'](_0xc229('0x6'),attributes,{'tableName':_0xc229('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc229('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e3871cf..ed0dbf3 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 _0x1455=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','then','UpdateFaxQueueReport','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x1455,0x17d));var _0x5145=function(_0x54ca89,_0xa23eb){_0x54ca89=_0x54ca89-0x0;var _0x129799=_0x1455[_0x54ca89];return _0x129799;};'use strict';var _=require(_0x5145('0x0'));var util=require('util');var moment=require(_0x5145('0x1'));var BPromise=require(_0x5145('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5145('0x3'));var db=require(_0x5145('0x4'))['db'];var utils=require(_0x5145('0x5'));var logger=require(_0x5145('0x6'))(_0x5145('0x7'));var config=require(_0x5145('0x8'));var jayson=require(_0x5145('0x9'));var client=jayson[_0x5145('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x563a42,_0x1c28d2,_0x38cd70){return new BPromise(function(_0x5be7ac,_0x1e5811){return client[_0x5145('0xb')](_0x563a42,_0x38cd70)['then'](function(_0x8f607c){logger[_0x5145('0xc')](_0x5145('0xd'),_0x1c28d2,_0x5145('0xe'));logger[_0x5145('0xf')](_0x5145('0x10'),_0x1c28d2,'request\x20sent',JSON[_0x5145('0x11')](_0x8f607c));if(_0x8f607c['error']){if(_0x8f607c[_0x5145('0x12')][_0x5145('0x13')]===0x1f4){logger[_0x5145('0x12')](_0x5145('0xd'),_0x1c28d2,_0x8f607c['error'][_0x5145('0x14')]);return _0x1e5811(_0x8f607c[_0x5145('0x12')][_0x5145('0x14')]);}logger['error'](_0x5145('0xd'),_0x1c28d2,_0x8f607c[_0x5145('0x12')]['message']);return _0x5be7ac(_0x8f607c['error'][_0x5145('0x14')]);}else{logger[_0x5145('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x1c28d2,_0x5145('0xe'));_0x5be7ac(_0x8f607c[_0x5145('0x15')][_0x5145('0x14')]);}})[_0x5145('0x16')](function(_0x13cb0a){logger[_0x5145('0x12')](_0x5145('0xd'),_0x1c28d2,_0x13cb0a);_0x1e5811(_0x13cb0a);});});}exports[_0x5145('0x17')]=function(_0x208bc1){var _0x2fdbb2=this;return new Promise(function(_0x29db5a,_0x1aa92b){return db[_0x5145('0x18')]['create'](_0x208bc1[_0x5145('0x19')],{'raw':_0x208bc1[_0x5145('0x1a')]?_0x208bc1['options'][_0x5145('0x1b')]===undefined?!![]:![]:!![]})[_0x5145('0x1c')](function(_0xd2b107){logger[_0x5145('0xc')]('CreateFaxQueueReport',_0x208bc1);logger['debug']('CreateFaxQueueReport',_0x208bc1,JSON[_0x5145('0x11')](_0xd2b107));_0x29db5a(_0xd2b107);})[_0x5145('0x16')](function(_0x9fc7b8){logger[_0x5145('0x12')](_0x5145('0x17'),_0x9fc7b8[_0x5145('0x14')],_0x208bc1);_0x1aa92b(_0x2fdbb2[_0x5145('0x12')](0x1f4,_0x9fc7b8[_0x5145('0x14')]));});});};exports[_0x5145('0x1d')]=function(_0x419b01){var _0x41a697=this;return new Promise(function(_0x2809ad,_0x38e0f6){return db[_0x5145('0x18')]['update'](_0x419b01[_0x5145('0x19')],{'raw':_0x419b01[_0x5145('0x1a')]?_0x419b01[_0x5145('0x1a')][_0x5145('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x419b01[_0x5145('0x1a')]?_0x419b01[_0x5145('0x1a')][_0x5145('0x1e')]||null:null,'attributes':_0x419b01[_0x5145('0x1a')]?_0x419b01[_0x5145('0x1a')][_0x5145('0x1f')]||null:null,'limit':_0x419b01[_0x5145('0x1a')]?_0x419b01[_0x5145('0x1a')][_0x5145('0x20')]||null:null})['then'](function(_0xf272c1){logger[_0x5145('0xc')](_0x5145('0x1d'),_0x419b01);logger[_0x5145('0xf')](_0x5145('0x1d'),_0x419b01,JSON[_0x5145('0x11')](_0xf272c1));_0x2809ad(_0xf272c1);})[_0x5145('0x16')](function(_0x430489){logger[_0x5145('0x12')](_0x5145('0x1d'),_0x430489['message'],_0x419b01);_0x38e0f6(_0x41a697[_0x5145('0x12')](0x1f4,_0x430489[_0x5145('0x14')]));});});}; \ No newline at end of file +var _0x5ced=['UpdateFaxQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','FaxQueueReport,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateFaxQueueReport','FaxQueueReport','options','raw','debug'];(function(_0x415626,_0xf346d4){var _0x5c05a7=function(_0x250f02){while(--_0x250f02){_0x415626['push'](_0x415626['shift']());}};_0x5c05a7(++_0xf346d4);}(_0x5ced,0xb3));var _0xd5ce=function(_0xc74297,_0x246db4){_0xc74297=_0xc74297-0x0;var _0x1ea354=_0x5ced[_0xc74297];return _0x1ea354;};'use strict';var _=require('lodash');var util=require(_0xd5ce('0x0'));var moment=require(_0xd5ce('0x1'));var BPromise=require(_0xd5ce('0x2'));var rs=require(_0xd5ce('0x3'));var fs=require('fs');var Redis=require(_0xd5ce('0x4'));var db=require(_0xd5ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd5ce('0x6'))(_0xd5ce('0x7'));var config=require(_0xd5ce('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3acc20,_0x1b3a7c,_0x40633b){return new BPromise(function(_0x49f9eb,_0x4f58b0){return client[_0xd5ce('0x9')](_0x3acc20,_0x40633b)[_0xd5ce('0xa')](function(_0x3259eb){logger[_0xd5ce('0xb')](_0xd5ce('0xc'),_0x1b3a7c,'request\x20sent');logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1b3a7c,'request\x20sent',JSON[_0xd5ce('0xd')](_0x3259eb));if(_0x3259eb['error']){if(_0x3259eb[_0xd5ce('0xe')][_0xd5ce('0xf')]===0x1f4){logger[_0xd5ce('0xe')](_0xd5ce('0xc'),_0x1b3a7c,_0x3259eb[_0xd5ce('0xe')][_0xd5ce('0x10')]);return _0x4f58b0(_0x3259eb[_0xd5ce('0xe')][_0xd5ce('0x10')]);}logger[_0xd5ce('0xe')](_0xd5ce('0xc'),_0x1b3a7c,_0x3259eb['error']['message']);return _0x49f9eb(_0x3259eb[_0xd5ce('0xe')][_0xd5ce('0x10')]);}else{logger[_0xd5ce('0xb')](_0xd5ce('0xc'),_0x1b3a7c,_0xd5ce('0x11'));_0x49f9eb(_0x3259eb[_0xd5ce('0x12')][_0xd5ce('0x10')]);}})['catch'](function(_0x28afb9){logger[_0xd5ce('0xe')](_0xd5ce('0xc'),_0x1b3a7c,_0x28afb9);_0x4f58b0(_0x28afb9);});});}exports[_0xd5ce('0x13')]=function(_0x51c99c){var _0x223809=this;return new Promise(function(_0x1f1974,_0x159187){return db[_0xd5ce('0x14')]['create'](_0x51c99c['body'],{'raw':_0x51c99c[_0xd5ce('0x15')]?_0x51c99c['options'][_0xd5ce('0x16')]===undefined?!![]:![]:!![]})[_0xd5ce('0xa')](function(_0x5a088f){logger[_0xd5ce('0xb')](_0xd5ce('0x13'),_0x51c99c);logger[_0xd5ce('0x17')]('CreateFaxQueueReport',_0x51c99c,JSON[_0xd5ce('0xd')](_0x5a088f));_0x1f1974(_0x5a088f);})['catch'](function(_0x2d0c6c){logger[_0xd5ce('0xe')]('CreateFaxQueueReport',_0x2d0c6c[_0xd5ce('0x10')],_0x51c99c);_0x159187(_0x223809[_0xd5ce('0xe')](0x1f4,_0x2d0c6c[_0xd5ce('0x10')]));});});};exports[_0xd5ce('0x18')]=function(_0x14a5a4){var _0x57f46b=this;return new Promise(function(_0x2ef619,_0x3bbcff){return db[_0xd5ce('0x14')][_0xd5ce('0x19')](_0x14a5a4['body'],{'raw':_0x14a5a4[_0xd5ce('0x15')]?_0x14a5a4[_0xd5ce('0x15')][_0xd5ce('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14a5a4[_0xd5ce('0x15')]?_0x14a5a4['options'][_0xd5ce('0x1a')]||null:null,'attributes':_0x14a5a4[_0xd5ce('0x15')]?_0x14a5a4['options'][_0xd5ce('0x1b')]||null:null,'limit':_0x14a5a4[_0xd5ce('0x15')]?_0x14a5a4[_0xd5ce('0x15')][_0xd5ce('0x1c')]||null:null})[_0xd5ce('0xa')](function(_0x524ceb){logger[_0xd5ce('0xb')]('UpdateFaxQueueReport',_0x14a5a4);logger[_0xd5ce('0x17')]('UpdateFaxQueueReport',_0x14a5a4,JSON[_0xd5ce('0xd')](_0x524ceb));_0x2ef619(_0x524ceb);})['catch'](function(_0x26b9ec){logger[_0xd5ce('0xe')](_0xd5ce('0x18'),_0x26b9ec[_0xd5ce('0x10')],_0x14a5a4);_0x3bbcff(_0x57f46b['error'](0x1f4,_0x26b9ec['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 6187292..952a6bc 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 _0x4baa=['describe','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','/describe'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x4baa,0x19a));var _0xa4ba=function(_0x3d937c,_0x534e35){_0x3d937c=_0x3d937c-0x0;var _0x1976e8=_0x4baa[_0x3d937c];return _0x1976e8;};'use strict';var multer=require(_0xa4ba('0x0'));var util=require('util');var path=require(_0xa4ba('0x1'));var timeout=require(_0xa4ba('0x2'));var express=require('express');var router=express[_0xa4ba('0x3')]();var auth=require(_0xa4ba('0x4'));var interaction=require(_0xa4ba('0x5'));var config=require(_0xa4ba('0x6'));var controller=require(_0xa4ba('0x7'));router[_0xa4ba('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa4ba('0x8')](_0xa4ba('0x9'),auth['isAuthenticated'](),controller[_0xa4ba('0xa')]);router[_0xa4ba('0x8')](_0xa4ba('0xb'),auth[_0xa4ba('0xc')](),controller[_0xa4ba('0xd')]);router[_0xa4ba('0xe')]('/',auth[_0xa4ba('0xc')](),controller[_0xa4ba('0xf')]);router[_0xa4ba('0x10')](_0xa4ba('0xb'),auth[_0xa4ba('0xc')](),controller['update']);router[_0xa4ba('0x11')](_0xa4ba('0xb'),auth[_0xa4ba('0xc')](),controller[_0xa4ba('0x12')]);module[_0xa4ba('0x13')]=router; \ No newline at end of file +var _0xa824=['post','create','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show'];(function(_0x483351,_0xb26b44){var _0x2f9d65=function(_0x4b88eb){while(--_0x4b88eb){_0x483351['push'](_0x483351['shift']());}};_0x2f9d65(++_0xb26b44);}(_0xa824,0x16e));var _0x4a82=function(_0xc205a4,_0x36b067){_0xc205a4=_0xc205a4-0x0;var _0xab679a=_0xa824[_0xc205a4];return _0xab679a;};'use strict';var multer=require(_0x4a82('0x0'));var util=require(_0x4a82('0x1'));var path=require(_0x4a82('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a82('0x3')]();var auth=require(_0x4a82('0x4'));var interaction=require(_0x4a82('0x5'));var config=require(_0x4a82('0x6'));var controller=require('./faxQueueReport.controller');router[_0x4a82('0x7')]('/',auth[_0x4a82('0x8')](),controller['index']);router[_0x4a82('0x7')](_0x4a82('0x9'),auth[_0x4a82('0x8')](),controller['describe']);router[_0x4a82('0x7')](_0x4a82('0xa'),auth[_0x4a82('0x8')](),controller[_0x4a82('0xb')]);router[_0x4a82('0xc')]('/',auth[_0x4a82('0x8')](),controller[_0x4a82('0xd')]);router[_0x4a82('0xe')]('/:id',auth[_0x4a82('0x8')](),controller[_0x4a82('0xf')]);router[_0x4a82('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4a82('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index bdbdf4c..c76322f 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 _0x07e7=['queue','DATE','moment','sequelize','STRING','ENUM','account','agent'];(function(_0x4c0dc1,_0x2cd142){var _0x5caa5c=function(_0x4effbe){while(--_0x4effbe){_0x4c0dc1['push'](_0x4c0dc1['shift']());}};_0x5caa5c(++_0x2cd142);}(_0x07e7,0xfa));var _0x707e=function(_0x817aa5,_0x3504f9){_0x817aa5=_0x817aa5-0x0;var _0x530c00=_0x07e7[_0x817aa5];return _0x530c00;};'use strict';var moment=require(_0x707e('0x0'));var Sequelize=require(_0x707e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x707e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x707e('0x3')](_0x707e('0x4'),_0x707e('0x5'),_0x707e('0x6')),'allowNull':![],'defaultValue':_0x707e('0x6')},'transferredAt':{'type':Sequelize[_0x707e('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x7d07=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x289a04,_0x1e923b){var _0x2064bf=function(_0x311380){while(--_0x311380){_0x289a04['push'](_0x289a04['shift']());}};_0x2064bf(++_0x1e923b);}(_0x7d07,0x8e));var _0x77d0=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x7d07[_0x28611e];return _0x530f69;};'use strict';var moment=require('moment');var Sequelize=require(_0x77d0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x77d0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x77d0('0x2')](_0x77d0('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0x77d0('0x4')},'transferredAt':{'type':Sequelize[_0x77d0('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 3339a3f..d0bd5c0 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 _0x0b0e=['index','map','FaxTransferReport','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','count','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','reject','update','then','destroy','end','error','name'];(function(_0x5e24bc,_0x1dfc37){var _0x54b0f7=function(_0x37e413){while(--_0x37e413){_0x5e24bc['push'](_0x5e24bc['shift']());}};_0x54b0f7(++_0x1dfc37);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x0b0e[_0x18aaaf];return _0x52d892;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3068c0,_0x1c358a){_0x1c358a=_0x1c358a||0xcc;return function(_0x3cc19a){if(_0x3cc19a){return _0x3068c0[_0xe0b0('0x17')](_0x1c358a);}return _0x3068c0[_0xe0b0('0x18')](_0x1c358a)['end']();};}function respondWithResult(_0x3782be,_0x154de6){_0x154de6=_0x154de6||0xc8;return function(_0x743318){if(_0x743318){return _0x3782be[_0xe0b0('0x18')](_0x154de6)[_0xe0b0('0x19')](_0x743318);}};}function respondWithFilteredResult(_0x55d884,_0x41a7e2){return function(_0x5adb01){if(_0x5adb01){var _0x35cb40=_0x5adb01['count'],_0xadee6e=_0x41a7e2[_0xe0b0('0x1a')],_0x519ae8=_0x41a7e2[_0xe0b0('0x1a')]+_0x41a7e2['limit'],_0x11fdca;if(_0x519ae8>=_0x35cb40){_0x519ae8=_0x35cb40;_0x11fdca=0xc8;}else{_0x11fdca=0xce;}_0x55d884['status'](_0x11fdca);return _0x55d884[_0xe0b0('0x1b')]('Content-Range',_0xadee6e+'-'+_0x519ae8+'/'+_0x35cb40)['json'](_0x5adb01);}return null;};}function patchUpdates(_0x4bce65){return function(_0x1920ee){try{jsonpatch['apply'](_0x1920ee,_0x4bce65,!![]);}catch(_0x52598b){return BPromise[_0xe0b0('0x1c')](_0x52598b);}return _0x1920ee['save']();};}function saveUpdates(_0x472286,_0x5dba2f){return function(_0x2c84cc){if(_0x2c84cc){return _0x2c84cc[_0xe0b0('0x1d')](_0x472286)[_0xe0b0('0x1e')](function(_0x310a6d){return _0x310a6d;});}return null;};}function removeEntity(_0x2cf6a1,_0x58b804){return function(_0x4cae54){if(_0x4cae54){return _0x4cae54[_0xe0b0('0x1f')]()['then'](function(){_0x2cf6a1[_0xe0b0('0x18')](0xcc)[_0xe0b0('0x20')]();});}};}function handleEntityNotFound(_0x513e63,_0x170ad8){return function(_0x503883){if(!_0x503883){_0x513e63[_0xe0b0('0x17')](0x194);}return _0x503883;};}function handleError(_0x49a727,_0x28586d){_0x28586d=_0x28586d||0x1f4;return function(_0x576352){logger[_0xe0b0('0x21')](_0x576352['stack']);if(_0x576352[_0xe0b0('0x22')]){delete _0x576352['name'];}_0x49a727[_0xe0b0('0x18')](_0x28586d)['send'](_0x576352);};}exports[_0xe0b0('0x23')]=function(_0x3c3bc2,_0x1f1ebd){var _0x1d91ad={},_0x3ec2={},_0x10745d={'count':0x0,'rows':[]};var _0x5200a6=_[_0xe0b0('0x24')](db[_0xe0b0('0x25')]['rawAttributes'],function(_0x15e13b){return{'name':_0x15e13b[_0xe0b0('0x26')],'type':_0x15e13b[_0xe0b0('0x27')][_0xe0b0('0x28')]};});_0x3ec2[_0xe0b0('0x29')]=_[_0xe0b0('0x24')](_0x5200a6,_0xe0b0('0x22'));_0x3ec2['query']=_[_0xe0b0('0x2a')](_0x3c3bc2[_0xe0b0('0x2b')]);_0x3ec2['filters']=_['intersection'](_0x3ec2[_0xe0b0('0x29')],_0x3ec2[_0xe0b0('0x2b')]);_0x1d91ad[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x3ec2[_0xe0b0('0x29')],qs['fields'](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x2e')]));_0x1d91ad[_0xe0b0('0x2c')]=_0x1d91ad[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x1d91ad['attributes']:_0x3ec2[_0xe0b0('0x29')];if(!_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x30')](_0xe0b0('0x31'))){_0x1d91ad[_0xe0b0('0x32')]=qs[_0xe0b0('0x32')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x32')]);_0x1d91ad[_0xe0b0('0x1a')]=qs[_0xe0b0('0x1a')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x1a')]);}_0x1d91ad[_0xe0b0('0x33')]=qs[_0xe0b0('0x34')](_0x3c3bc2[_0xe0b0('0x2b')]['sort']);_0x1d91ad[_0xe0b0('0x35')]=qs[_0xe0b0('0x36')](_[_0xe0b0('0x37')](_0x3c3bc2[_0xe0b0('0x2b')],_0x3ec2[_0xe0b0('0x36')]),_0x5200a6);if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]){_0x1d91ad['where']=_['merge'](_0x1d91ad['where'],{'$or':_['map'](_0x5200a6,function(_0x26137c){if(_0x26137c[_0xe0b0('0x27')]!==_0xe0b0('0x39')){var _0x4e4b20={};_0x4e4b20[_0x26137c[_0xe0b0('0x22')]]={'$like':'%'+_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]+'%'};return _0x4e4b20;}})});}_0x1d91ad=_[_0xe0b0('0x3a')]({},_0x1d91ad,_0x3c3bc2['options']);var _0xed3226={'where':_0x1d91ad[_0xe0b0('0x35')]};return db[_0xe0b0('0x25')][_0xe0b0('0x3b')](_0xed3226)[_0xe0b0('0x1e')](function(_0x1205db){_0x10745d[_0xe0b0('0x3b')]=_0x1205db;if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x1d91ad['include']=[{'all':!![]}];}return db[_0xe0b0('0x25')]['findAll'](_0x1d91ad);})[_0xe0b0('0x1e')](function(_0x2d5f47){_0x10745d[_0xe0b0('0x3d')]=_0x2d5f47;return _0x10745d;})[_0xe0b0('0x1e')](respondWithFilteredResult(_0x1f1ebd,_0x1d91ad))['catch'](handleError(_0x1f1ebd,null));};exports[_0xe0b0('0x3e')]=function(_0x41adcb,_0x33706d){var _0x402a0e={'raw':!![],'where':{'id':_0x41adcb[_0xe0b0('0x3f')]['id']}},_0x19c80e={};_0x19c80e[_0xe0b0('0x29')]=_[_0xe0b0('0x2a')](db['FaxTransferReport'][_0xe0b0('0x40')]);_0x19c80e[_0xe0b0('0x2b')]=_['keys'](_0x41adcb['query']);_0x19c80e[_0xe0b0('0x36')]=_[_0xe0b0('0x2d')](_0x19c80e['model'],_0x19c80e[_0xe0b0('0x2b')]);_0x402a0e[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x19c80e[_0xe0b0('0x29')],qs[_0xe0b0('0x2e')](_0x41adcb['query']['fields']));_0x402a0e['attributes']=_0x402a0e[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x402a0e['attributes']:_0x19c80e[_0xe0b0('0x29')];if(_0x41adcb[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x402a0e[_0xe0b0('0x41')]=[{'all':!![]}];}_0x402a0e=_[_0xe0b0('0x3a')]({},_0x402a0e,_0x41adcb['options']);return db['FaxTransferReport'][_0xe0b0('0x42')](_0x402a0e)[_0xe0b0('0x1e')](handleEntityNotFound(_0x33706d,null))[_0xe0b0('0x1e')](respondWithResult(_0x33706d,null))[_0xe0b0('0x43')](handleError(_0x33706d,null));};exports[_0xe0b0('0x44')]=function(_0x575c7d,_0x3b1474){return db[_0xe0b0('0x25')]['create'](_0x575c7d['body'],{})['then'](respondWithResult(_0x3b1474,0xc9))[_0xe0b0('0x43')](handleError(_0x3b1474,null));};exports[_0xe0b0('0x1d')]=function(_0x2419ce,_0x364877){if(_0x2419ce['body']['id']){delete _0x2419ce[_0xe0b0('0x45')]['id'];}return db[_0xe0b0('0x25')]['find']({'where':{'id':_0x2419ce['params']['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x364877,null))[_0xe0b0('0x1e')](saveUpdates(_0x2419ce['body'],null))[_0xe0b0('0x1e')](respondWithResult(_0x364877,null))[_0xe0b0('0x43')](handleError(_0x364877,null));};exports['destroy']=function(_0x5cb2b6,_0x123ad2){return db['FaxTransferReport'][_0xe0b0('0x42')]({'where':{'id':_0x5cb2b6[_0xe0b0('0x3f')]['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x123ad2,null))[_0xe0b0('0x1e')](removeEntity(_0x123ad2,null))[_0xe0b0('0x43')](handleError(_0x123ad2,null));};exports[_0xe0b0('0x46')]=function(_0x5f5486,_0x5d018d){return db[_0xe0b0('0x25')]['describe']()['then'](respondWithResult(_0x5d018d,null))[_0xe0b0('0x43')](handleError(_0x5d018d,null));}; \ No newline at end of file +var _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x585f2f,_0x4c9e6e){var _0x251072=function(_0x5e769e){while(--_0x5e769e){_0x585f2f['push'](_0x585f2f['shift']());}};_0x251072(++_0x4c9e6e);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index ab143f7..882150a 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 _0x602a=['api','moment','bluebird','path','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger'];(function(_0x4d5005,_0x45209b){var _0x778b8e=function(_0x564da6){while(--_0x564da6){_0x4d5005['push'](_0x4d5005['shift']());}};_0x778b8e(++_0x45209b);}(_0x602a,0x1de));var _0xa602=function(_0x41aa73,_0x278085){_0x41aa73=_0x41aa73-0x0;var _0x2f733a=_0x602a[_0x41aa73];return _0x2f733a;};'use strict';var _=require(_0xa602('0x0'));var util=require('util');var logger=require(_0xa602('0x1'))(_0xa602('0x2'));var moment=require(_0xa602('0x3'));var BPromise=require(_0xa602('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa602('0x5'));var rimraf=require(_0xa602('0x6'));var config=require('../../config/environment');var attributes=require(_0xa602('0x7'));module[_0xa602('0x8')]=function(_0x5c79a1,_0x2a9d2f){return _0x5c79a1['define'](_0xa602('0x9'),attributes,{'tableName':_0xa602('0xa'),'paranoid':![],'indexes':[{'name':_0xa602('0xb'),'fields':[_0xa602('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe50e=['path','rimraf','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x51e268,_0x4bb0eb){var _0x308e36=function(_0x3e1523){while(--_0x3e1523){_0x51e268['push'](_0x51e268['shift']());}};_0x308e36(++_0x4bb0eb);}(_0xe50e,0x7e));var _0xee50=function(_0xbb447b,_0x3aed8e){_0xbb447b=_0xbb447b-0x0;var _0x510ffc=_0xe50e[_0xbb447b];return _0x510ffc;};'use strict';var _=require(_0xee50('0x0'));var util=require(_0xee50('0x1'));var logger=require(_0xee50('0x2'))('api');var moment=require('moment');var BPromise=require(_0xee50('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee50('0x4'));var rimraf=require(_0xee50('0x5'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0xf35af1,_0x3b24f7){return _0xf35af1[_0xee50('0x6')](_0xee50('0x7'),attributes,{'tableName':_0xee50('0x8'),'paranoid':![],'indexes':[{'name':_0xee50('0x9'),'fields':[_0xee50('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 04bf72a..3b3fb16 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 _0xd9f2=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0xd9f2,0x162));var _0x2d9f=function(_0x2a0bf6,_0x10a432){_0x2a0bf6=_0x2a0bf6-0x0;var _0x5d85d0=_0xd9f2[_0x2a0bf6];return _0x5d85d0;};'use strict';var _=require(_0x2d9f('0x0'));var util=require('util');var moment=require(_0x2d9f('0x1'));var BPromise=require(_0x2d9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d9f('0x3'));var db=require(_0x2d9f('0x4'))['db'];var utils=require(_0x2d9f('0x5'));var logger=require('../../config/logger')(_0x2d9f('0x6'));var config=require(_0x2d9f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d9f('0x8')][_0x2d9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9c9a8c,_0x43a4c3,_0x4a2ab6){return new BPromise(function(_0x55699d,_0x1e12b3){return client[_0x2d9f('0xa')](_0x9c9a8c,_0x4a2ab6)[_0x2d9f('0xb')](function(_0x5582ce){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x43a4c3,_0x2d9f('0xc'));logger[_0x2d9f('0xd')](_0x2d9f('0xe'),_0x43a4c3,_0x2d9f('0xc'),JSON[_0x2d9f('0xf')](_0x5582ce));if(_0x5582ce[_0x2d9f('0x10')]){if(_0x5582ce['error'][_0x2d9f('0x11')]===0x1f4){logger[_0x2d9f('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x43a4c3,_0x5582ce[_0x2d9f('0x10')][_0x2d9f('0x12')]);return _0x1e12b3(_0x5582ce[_0x2d9f('0x10')][_0x2d9f('0x12')]);}logger[_0x2d9f('0x10')](_0x2d9f('0x13'),_0x43a4c3,_0x5582ce[_0x2d9f('0x10')]['message']);return _0x55699d(_0x5582ce[_0x2d9f('0x10')][_0x2d9f('0x12')]);}else{logger[_0x2d9f('0x14')](_0x2d9f('0x13'),_0x43a4c3,_0x2d9f('0xc'));_0x55699d(_0x5582ce[_0x2d9f('0x15')]['message']);}})[_0x2d9f('0x16')](function(_0x3ff256){logger[_0x2d9f('0x10')](_0x2d9f('0x13'),_0x43a4c3,_0x3ff256);_0x1e12b3(_0x3ff256);});});} \ No newline at end of file +var _0xbd66=['request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x3c99df,_0x515ff9){var _0x539ef6=function(_0x155312){while(--_0x155312){_0x3c99df['push'](_0x3c99df['shift']());}};_0x539ef6(++_0x515ff9);}(_0xbd66,0x7a));var _0x6bd6=function(_0x3609db,_0x594ea2){_0x3609db=_0x3609db-0x0;var _0xda653a=_0xbd66[_0x3609db];return _0xda653a;};'use strict';var _=require(_0x6bd6('0x0'));var util=require(_0x6bd6('0x1'));var moment=require(_0x6bd6('0x2'));var BPromise=require(_0x6bd6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bd6('0x4'));var db=require(_0x6bd6('0x5'))['db'];var utils=require(_0x6bd6('0x6'));var logger=require(_0x6bd6('0x7'))(_0x6bd6('0x8'));var config=require('../../config/environment');var jayson=require(_0x6bd6('0x9'));var client=jayson['client'][_0x6bd6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x349010,_0x3f20d7,_0x346042){return new BPromise(function(_0xe4f556,_0x366f49){return client[_0x6bd6('0xb')](_0x349010,_0x346042)[_0x6bd6('0xc')](function(_0x19005b){logger['info'](_0x6bd6('0xd'),_0x3f20d7,_0x6bd6('0xe'));logger['debug'](_0x6bd6('0xf'),_0x3f20d7,_0x6bd6('0xe'),JSON['stringify'](_0x19005b));if(_0x19005b[_0x6bd6('0x10')]){if(_0x19005b[_0x6bd6('0x10')][_0x6bd6('0x11')]===0x1f4){logger[_0x6bd6('0x10')](_0x6bd6('0xd'),_0x3f20d7,_0x19005b['error'][_0x6bd6('0x12')]);return _0x366f49(_0x19005b[_0x6bd6('0x10')][_0x6bd6('0x12')]);}logger['error'](_0x6bd6('0xd'),_0x3f20d7,_0x19005b[_0x6bd6('0x10')][_0x6bd6('0x12')]);return _0xe4f556(_0x19005b['error'][_0x6bd6('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x3f20d7,_0x6bd6('0xe'));_0xe4f556(_0x19005b['result'][_0x6bd6('0x12')]);}})['catch'](function(_0x3fdd78){logger[_0x6bd6('0x10')](_0x6bd6('0xd'),_0x3f20d7,_0x3fdd78);_0x366f49(_0x3fdd78);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 27227c0..6386a14 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 _0xc596=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','describe','/:id','isAuthenticated','show','put','update','delete','destroy','multer','path','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc596,0x12c));var _0x6c59=function(_0x38f5c0,_0x57b250){_0x38f5c0=_0x38f5c0-0x0;var _0x54f13a=_0xc596[_0x38f5c0];return _0x54f13a;};'use strict';var multer=require(_0x6c59('0x0'));var util=require('util');var path=require(_0x6c59('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c59('0x2')]();var auth=require(_0x6c59('0x3'));var interaction=require(_0x6c59('0x4'));var config=require(_0x6c59('0x5'));var controller=require(_0x6c59('0x6'));router[_0x6c59('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6c59('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6c59('0x8')]);router[_0x6c59('0x7')](_0x6c59('0x9'),auth[_0x6c59('0xa')](),controller[_0x6c59('0xb')]);router['post']('/',auth[_0x6c59('0xa')](),controller['create']);router[_0x6c59('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x6c59('0xd')]);router[_0x6c59('0xe')](_0x6c59('0x9'),auth[_0x6c59('0xa')](),controller[_0x6c59('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf74d=['/describe','describe','/:id','show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x346cb0,_0x47b7d2){var _0x5d554b=function(_0x52c55b){while(--_0x52c55b){_0x346cb0['push'](_0x346cb0['shift']());}};_0x5d554b(++_0x47b7d2);}(_0xf74d,0x1c9));var _0xdf74=function(_0x22d730,_0x3ebbe8){_0x22d730=_0x22d730-0x0;var _0x43d1a5=_0xf74d[_0x22d730];return _0x43d1a5;};'use strict';var multer=require(_0xdf74('0x0'));var util=require(_0xdf74('0x1'));var path=require(_0xdf74('0x2'));var timeout=require(_0xdf74('0x3'));var express=require(_0xdf74('0x4'));var router=express[_0xdf74('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf74('0x6'));var config=require('../../config/environment');var controller=require(_0xdf74('0x7'));router[_0xdf74('0x8')]('/',auth[_0xdf74('0x9')](),controller[_0xdf74('0xa')]);router['get'](_0xdf74('0xb'),auth['isAuthenticated'](),controller[_0xdf74('0xc')]);router[_0xdf74('0x8')](_0xdf74('0xd'),auth['isAuthenticated'](),controller[_0xdf74('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdf74('0xf')]('/:id',auth[_0xdf74('0x9')](),controller['update']);router[_0xdf74('0x10')](_0xdf74('0xd'),auth['isAuthenticated'](),controller[_0xdf74('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0831314..aaebb9a 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 _0xab86=['path','Router','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','update','destroy','exports','multer','util'];(function(_0x4217cb,_0x3a371d){var _0x325fca=function(_0x4096f7){while(--_0x4096f7){_0x4217cb['push'](_0x4217cb['shift']());}};_0x325fca(++_0x3a371d);}(_0xab86,0x13e));var _0x6ab8=function(_0x8fdfe3,_0x39c95c){_0x8fdfe3=_0x8fdfe3-0x0;var _0x9b768=_0xab86[_0x8fdfe3];return _0x9b768;};'use strict';var multer=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var path=require(_0x6ab8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ab8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ab8('0x4'));var config=require('../../config/environment');var controller=require(_0x6ab8('0x5'));router[_0x6ab8('0x6')]('/',auth[_0x6ab8('0x7')](),controller[_0x6ab8('0x8')]);router[_0x6ab8('0x6')](_0x6ab8('0x9'),auth[_0x6ab8('0x7')](),controller[_0x6ab8('0xa')]);router[_0x6ab8('0x6')](_0x6ab8('0xb'),auth[_0x6ab8('0x7')](),controller[_0x6ab8('0xc')]);router[_0x6ab8('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6ab8('0xd')]);router['post']('/',auth[_0x6ab8('0x7')](),controller[_0x6ab8('0xe')]);router[_0x6ab8('0xf')]('/:id/configurations',auth[_0x6ab8('0x7')](),controller[_0x6ab8('0x10')]);router['put'](_0x6ab8('0x9'),auth[_0x6ab8('0x7')](),controller[_0x6ab8('0x11')]);router['delete'](_0x6ab8('0x9'),auth[_0x6ab8('0x7')](),controller[_0x6ab8('0x12')]);module[_0x6ab8('0x13')]=router; \ No newline at end of file +var _0xf725=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x1a03e2,_0x373c4d){var _0x36389e=function(_0x1796dc){while(--_0x1796dc){_0x1a03e2['push'](_0x1a03e2['shift']());}};_0x36389e(++_0x373c4d);}(_0xf725,0x7e));var _0x5f72=function(_0x56c342,_0x28d735){_0x56c342=_0x56c342-0x0;var _0x1cd10c=_0xf725[_0x56c342];return _0x1cd10c;};'use strict';var multer=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var path=require(_0x5f72('0x2'));var timeout=require(_0x5f72('0x3'));var express=require(_0x5f72('0x4'));var router=express[_0x5f72('0x5')]();var auth=require(_0x5f72('0x6'));var interaction=require(_0x5f72('0x7'));var config=require(_0x5f72('0x8'));var controller=require(_0x5f72('0x9'));router['get']('/',auth[_0x5f72('0xa')](),controller[_0x5f72('0xb')]);router[_0x5f72('0xc')](_0x5f72('0xd'),auth[_0x5f72('0xa')](),controller[_0x5f72('0xe')]);router[_0x5f72('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5f72('0xf')]);router[_0x5f72('0xc')]('/:id/fields',auth[_0x5f72('0xa')](),controller[_0x5f72('0x10')]);router['post']('/',auth[_0x5f72('0xa')](),controller[_0x5f72('0x11')]);router[_0x5f72('0x12')](_0x5f72('0x13'),auth[_0x5f72('0xa')](),controller[_0x5f72('0x14')]);router[_0x5f72('0x15')]('/:id',auth[_0x5f72('0xa')](),controller[_0x5f72('0x16')]);router[_0x5f72('0x17')](_0x5f72('0xd'),auth[_0x5f72('0xa')](),controller['destroy']);module[_0x5f72('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 13d6bc6..ed3410d 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 _0x6767=['sequelize','exports','STRING','basic','newTab','integrationTab'];(function(_0x352039,_0x270e6f){var _0x3c97c9=function(_0x2eee5f){while(--_0x2eee5f){_0x352039['push'](_0x352039['shift']());}};_0x3c97c9(++_0x270e6f);}(_0x6767,0x1e6));var _0x7676=function(_0x4a89ce,_0x409c55){_0x4a89ce=_0x4a89ce-0x0;var _0x2f3ac0=_0x6767[_0x4a89ce];return _0x2f3ac0;};'use strict';var Sequelize=require(_0x7676('0x0'));module[_0x7676('0x1')]={'name':{'type':Sequelize[_0x7676('0x2')]},'description':{'type':Sequelize[_0x7676('0x2')]},'username':{'type':Sequelize[_0x7676('0x2')]},'remoteUri':{'type':Sequelize[_0x7676('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x7676('0x3')),'defaultValue':_0x7676('0x3')},'password':{'type':Sequelize[_0x7676('0x2')]},'consumerKey':{'type':Sequelize[_0x7676('0x2')]},'consumerSecret':{'type':Sequelize[_0x7676('0x2')]},'token':{'type':Sequelize[_0x7676('0x2')]},'tokenSecret':{'type':Sequelize[_0x7676('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('integrationTab',_0x7676('0x4')),'defaultValue':_0x7676('0x5')}}; \ No newline at end of file +var _0x8bba=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x4a3612,_0x36e426){var _0x5e8e72=function(_0x3392be){while(--_0x3392be){_0x4a3612['push'](_0x4a3612['shift']());}};_0x5e8e72(++_0x36e426);}(_0x8bba,0x1c9));var _0xa8bb=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x8bba[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require(_0xa8bb('0x0'));module[_0xa8bb('0x1')]={'name':{'type':Sequelize[_0xa8bb('0x2')]},'description':{'type':Sequelize[_0xa8bb('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa8bb('0x2')]},'authType':{'type':Sequelize[_0xa8bb('0x3')](_0xa8bb('0x4')),'defaultValue':_0xa8bb('0x4')},'password':{'type':Sequelize[_0xa8bb('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xa8bb('0x2')]},'token':{'type':Sequelize[_0xa8bb('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa8bb('0x2')]},'type':{'type':Sequelize[_0xa8bb('0x3')](_0xa8bb('0x5'),_0xa8bb('0x6')),'defaultValue':_0xa8bb('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 70956dd..1810543 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 _0x3319=['end','stack','name','send','DeskAccount','type','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','rawAttributes','find','body','getConfigurations','DeskConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','_embedded','entries','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','DeskAccount,\x20%s,\x20%s','message','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3319,0xc6));var _0x9331=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3319[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x9331('0x0'));var emlformat=require(_0x9331('0x1'));var rimraf=require(_0x9331('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9331('0x3'));var rp=require('request-promise');var moment=require(_0x9331('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9331('0x5'));var util=require(_0x9331('0x6'));var path=require(_0x9331('0x7'));var sox=require(_0x9331('0x8'));var csv=require('to-csv');var ejs=require(_0x9331('0x9'));var fs=require('fs');var _=require(_0x9331('0xa'));var squel=require(_0x9331('0xb'));var crypto=require(_0x9331('0xc'));var jsforce=require(_0x9331('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9331('0xe'));var querystring=require(_0x9331('0xf'));var Papa=require(_0x9331('0x10'));var Redis=require(_0x9331('0x11'));var authService=require(_0x9331('0x12'));var qs=require(_0x9331('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9331('0x14'));var logger=require('../../config/logger')(_0x9331('0x15'));var utils=require(_0x9331('0x16'));var config=require(_0x9331('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9331('0x18'));var jayson=require(_0x9331('0x19'));var client=jayson[_0x9331('0x1a')][_0x9331('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x80c99b,_0x593910,_0x3fe4a9){if(_0x3fe4a9){var _0x1ed602=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ed602[_0x9331('0x1c')](_0x593910)){return _0x80c99b;}else{throw new db[(_0x9331('0x1d'))][(_0x9331('0x1e'))](_0x9331('0x1f'));}}else{return _0x80c99b;}}function respondWithRpcPromise(_0x371007,_0x4e0a52,_0x122b67,_0xf49acf){return new BPromise(function(_0x454335,_0x1d7833){var _0x43b54b=_0xf49acf||client;return _0x43b54b[_0x9331('0x20')](_0x371007,_0x122b67)[_0x9331('0x21')](function(_0x4a98dc){logger[_0x9331('0x22')]('DeskAccount,\x20%s,\x20%s',_0x4e0a52,_0x9331('0x23'));logger[_0x9331('0x24')](_0x9331('0x25'),_0x4e0a52,'request\x20sent',JSON[_0x9331('0x26')](_0x4a98dc));if(_0x4a98dc['error']){if(_0x4a98dc['error'][_0x9331('0x27')]===0x1f4){logger[_0x9331('0x28')](_0x9331('0x29'),_0x4e0a52,_0x4a98dc['error']['message']);return _0x1d7833(_0x4a98dc['error']['message']);}logger[_0x9331('0x28')](_0x9331('0x29'),_0x4e0a52,_0x4a98dc[_0x9331('0x28')][_0x9331('0x2a')]);return _0x454335(_0x4a98dc[_0x9331('0x28')][_0x9331('0x2a')]);}else{logger[_0x9331('0x22')](_0x9331('0x29'),_0x4e0a52,_0x9331('0x23'));_0x454335(_0x4a98dc['result'][_0x9331('0x2a')]);}})['catch'](function(_0x1ab870){logger['error'](_0x9331('0x29'),_0x4e0a52,_0x1ab870);_0x1d7833(_0x1ab870);});});}function respondWithStatusCode(_0x1c8d15,_0x4f84ca){_0x4f84ca=_0x4f84ca||0xcc;return function(_0x1483c1){if(_0x1483c1){return _0x1c8d15[_0x9331('0x2b')](_0x4f84ca);}return _0x1c8d15['status'](_0x4f84ca)['end']();};}function respondWithResult(_0x34cd36,_0x221644){_0x221644=_0x221644||0xc8;return function(_0x4f4eee){if(_0x4f4eee){return _0x34cd36[_0x9331('0x2c')](_0x221644)[_0x9331('0x2d')](_0x4f4eee);}};}function respondWithFilteredResult(_0x371fea,_0x1be1bf){return function(_0x2ee872){if(_0x2ee872){var _0x295464=_0x2ee872['count'],_0xd30224=_0x1be1bf[_0x9331('0x2e')],_0x3a6c20=_0x1be1bf[_0x9331('0x2e')]+_0x1be1bf['limit'],_0x24a298;if(_0x3a6c20>=_0x295464){_0x3a6c20=_0x295464;_0x24a298=0xc8;}else{_0x24a298=0xce;}_0x371fea[_0x9331('0x2c')](_0x24a298);return _0x371fea[_0x9331('0x2f')](_0x9331('0x30'),_0xd30224+'-'+_0x3a6c20+'/'+_0x295464)['json'](_0x2ee872);}return null;};}function patchUpdates(_0x35b7fc){return function(_0x45727d){try{jsonpatch[_0x9331('0x31')](_0x45727d,_0x35b7fc,!![]);}catch(_0x157767){return BPromise[_0x9331('0x32')](_0x157767);}return _0x45727d[_0x9331('0x33')]();};}function saveUpdates(_0x56d2ba,_0x3f7e41){return function(_0x11e73a){if(_0x11e73a){return _0x11e73a[_0x9331('0x34')](_0x56d2ba)[_0x9331('0x21')](function(_0x2012e9){return _0x2012e9;});}return null;};}function removeEntity(_0x92809d,_0x7a4a28){return function(_0x17b4a0){if(_0x17b4a0){return _0x17b4a0[_0x9331('0x35')]()[_0x9331('0x21')](function(){_0x92809d[_0x9331('0x2c')](0xcc)[_0x9331('0x36')]();});}};}function handleEntityNotFound(_0x51b02d,_0x5245bf){return function(_0x3cdb54){if(!_0x3cdb54){_0x51b02d[_0x9331('0x2b')](0x194);}return _0x3cdb54;};}function handleError(_0x590298,_0x3e8b78){_0x3e8b78=_0x3e8b78||0x1f4;return function(_0x2ac291){logger[_0x9331('0x28')](_0x2ac291[_0x9331('0x37')]);if(_0x2ac291[_0x9331('0x38')]){delete _0x2ac291[_0x9331('0x38')];}_0x590298['status'](_0x3e8b78)[_0x9331('0x39')](_0x2ac291);};}exports['index']=function(_0x1bf8da,_0x1f5cfe){var _0x517bc2={},_0x1e53aa={},_0x27b532={'count':0x0,'rows':[]};var _0x45053b=_['map'](db[_0x9331('0x3a')]['rawAttributes'],function(_0x223702){return{'name':_0x223702['fieldName'],'type':_0x223702[_0x9331('0x3b')][_0x9331('0x3c')]};});_0x1e53aa['model']=_[_0x9331('0x3d')](_0x45053b,_0x9331('0x38'));_0x1e53aa[_0x9331('0x3e')]=_[_0x9331('0x3f')](_0x1bf8da[_0x9331('0x3e')]);_0x1e53aa['filters']=_[_0x9331('0x40')](_0x1e53aa['model'],_0x1e53aa[_0x9331('0x3e')]);_0x517bc2[_0x9331('0x41')]=_['intersection'](_0x1e53aa[_0x9331('0x42')],qs[_0x9331('0x43')](_0x1bf8da[_0x9331('0x3e')][_0x9331('0x43')]));_0x517bc2[_0x9331('0x41')]=_0x517bc2['attributes'][_0x9331('0x44')]?_0x517bc2[_0x9331('0x41')]:_0x1e53aa[_0x9331('0x42')];if(!_0x1bf8da[_0x9331('0x3e')][_0x9331('0x45')](_0x9331('0x46'))){_0x517bc2[_0x9331('0x47')]=qs[_0x9331('0x47')](_0x1bf8da[_0x9331('0x3e')][_0x9331('0x47')]);_0x517bc2['offset']=qs[_0x9331('0x2e')](_0x1bf8da['query'][_0x9331('0x2e')]);}_0x517bc2[_0x9331('0x48')]=qs['sort'](_0x1bf8da[_0x9331('0x3e')][_0x9331('0x49')]);_0x517bc2['where']=qs['filters'](_[_0x9331('0x4a')](_0x1bf8da[_0x9331('0x3e')],_0x1e53aa[_0x9331('0x4b')]),_0x45053b);if(_0x1bf8da[_0x9331('0x3e')][_0x9331('0x4c')]){_0x517bc2[_0x9331('0x4d')]=_[_0x9331('0x4e')](_0x517bc2[_0x9331('0x4d')],{'$or':_['map'](_0x45053b,function(_0x510f59){if(_0x510f59[_0x9331('0x3b')]!==_0x9331('0x4f')){var _0x50c73a={};_0x50c73a[_0x510f59[_0x9331('0x38')]]={'$like':'%'+_0x1bf8da[_0x9331('0x3e')]['filter']+'%'};return _0x50c73a;}})});}_0x517bc2=_[_0x9331('0x4e')]({},_0x517bc2,_0x1bf8da[_0x9331('0x50')]);var _0x564104={'where':_0x517bc2[_0x9331('0x4d')]};return db[_0x9331('0x3a')][_0x9331('0x51')](_0x564104)[_0x9331('0x21')](function(_0x2cc48c){_0x27b532[_0x9331('0x51')]=_0x2cc48c;if(_0x1bf8da['query'][_0x9331('0x52')]){_0x517bc2[_0x9331('0x53')]=[{'all':!![]}];}return db[_0x9331('0x3a')]['findAll'](_0x517bc2);})[_0x9331('0x21')](function(_0x5a2589){_0x27b532[_0x9331('0x54')]=_0x5a2589;return _0x27b532;})[_0x9331('0x21')](respondWithFilteredResult(_0x1f5cfe,_0x517bc2))[_0x9331('0x55')](handleError(_0x1f5cfe,null));};exports['show']=function(_0x716ef2,_0x17df61){var _0x2b18ea={'raw':![],'where':{'id':_0x716ef2[_0x9331('0x56')]['id']}},_0x12c4cc={};_0x12c4cc['model']=_[_0x9331('0x3f')](db['DeskAccount'][_0x9331('0x57')]);_0x12c4cc[_0x9331('0x3e')]=_[_0x9331('0x3f')](_0x716ef2['query']);_0x12c4cc['filters']=_[_0x9331('0x40')](_0x12c4cc[_0x9331('0x42')],_0x12c4cc['query']);_0x2b18ea['attributes']=_[_0x9331('0x40')](_0x12c4cc['model'],qs[_0x9331('0x43')](_0x716ef2[_0x9331('0x3e')][_0x9331('0x43')]));_0x2b18ea[_0x9331('0x41')]=_0x2b18ea[_0x9331('0x41')]['length']?_0x2b18ea[_0x9331('0x41')]:_0x12c4cc[_0x9331('0x42')];if(_0x716ef2[_0x9331('0x3e')][_0x9331('0x52')]){_0x2b18ea[_0x9331('0x53')]=[{'all':!![]}];}_0x2b18ea=_[_0x9331('0x4e')]({},_0x2b18ea,_0x716ef2[_0x9331('0x50')]);return db[_0x9331('0x3a')][_0x9331('0x58')](_0x2b18ea)[_0x9331('0x21')](handleEntityNotFound(_0x17df61,null))[_0x9331('0x21')](respondWithResult(_0x17df61,null))['catch'](handleError(_0x17df61,null));};exports['create']=function(_0x3e8ba1,_0x41f4ed){return db[_0x9331('0x3a')]['create'](_0x3e8ba1[_0x9331('0x59')],{})[_0x9331('0x21')](respondWithResult(_0x41f4ed,0xc9))[_0x9331('0x55')](handleError(_0x41f4ed,null));};exports[_0x9331('0x34')]=function(_0x3e5ccf,_0x23a011){if(_0x3e5ccf[_0x9331('0x59')]['id']){delete _0x3e5ccf[_0x9331('0x59')]['id'];}return db['DeskAccount'][_0x9331('0x58')]({'where':{'id':_0x3e5ccf[_0x9331('0x56')]['id']}})['then'](handleEntityNotFound(_0x23a011,null))[_0x9331('0x21')](saveUpdates(_0x3e5ccf[_0x9331('0x59')],null))['then'](respondWithResult(_0x23a011,null))[_0x9331('0x55')](handleError(_0x23a011,null));};exports[_0x9331('0x35')]=function(_0x29a36e,_0x55310a){return db[_0x9331('0x3a')][_0x9331('0x58')]({'where':{'id':_0x29a36e[_0x9331('0x56')]['id']}})[_0x9331('0x21')](handleEntityNotFound(_0x55310a,null))[_0x9331('0x21')](removeEntity(_0x55310a,null))[_0x9331('0x55')](handleError(_0x55310a,null));};exports[_0x9331('0x5a')]=function(_0x4a2efe,_0x1e7a77,_0x5c8e4b){var _0x4f2a2a={};var _0x2cecce={};var _0x12b3b9;var _0x2ce178;return db[_0x9331('0x3a')]['findOne']({'where':{'id':_0x4a2efe[_0x9331('0x56')]['id']}})[_0x9331('0x21')](handleEntityNotFound(_0x1e7a77,null))[_0x9331('0x21')](function(_0x36484c){if(_0x36484c){_0x12b3b9=_0x36484c;_0x2cecce[_0x9331('0x42')]=_[_0x9331('0x3f')](db[_0x9331('0x5b')][_0x9331('0x57')]);_0x2cecce[_0x9331('0x3e')]=_[_0x9331('0x3f')](_0x4a2efe[_0x9331('0x3e')]);_0x2cecce[_0x9331('0x4b')]=_['intersection'](_0x2cecce[_0x9331('0x42')],_0x2cecce['query']);_0x4f2a2a[_0x9331('0x41')]=_[_0x9331('0x40')](_0x2cecce[_0x9331('0x42')],qs['fields'](_0x4a2efe[_0x9331('0x3e')]['fields']));_0x4f2a2a['attributes']=_0x4f2a2a[_0x9331('0x41')][_0x9331('0x44')]?_0x4f2a2a[_0x9331('0x41')]:_0x2cecce['model'];_0x4f2a2a[_0x9331('0x48')]=qs[_0x9331('0x49')](_0x4a2efe[_0x9331('0x3e')]['sort']);_0x4f2a2a['where']=qs[_0x9331('0x4b')](_[_0x9331('0x4a')](_0x4a2efe[_0x9331('0x3e')],_0x2cecce[_0x9331('0x4b')]));if(_0x4a2efe[_0x9331('0x3e')]['filter']){_0x4f2a2a[_0x9331('0x4d')]=_[_0x9331('0x4e')](_0x4f2a2a[_0x9331('0x4d')],{'$or':_['map'](_0x4f2a2a[_0x9331('0x41')],function(_0x33efb0){var _0x125387={};_0x125387[_0x33efb0]={'$like':'%'+_0x4a2efe['query']['filter']+'%'};return _0x125387;})});}_0x4f2a2a=_['merge']({},_0x4f2a2a,_0x4a2efe[_0x9331('0x50')]);return _0x12b3b9[_0x9331('0x5a')](_0x4f2a2a);}})[_0x9331('0x21')](function(_0x178f15){if(_0x178f15){_0x2ce178=_0x178f15['length'];if(!_0x4a2efe['query'][_0x9331('0x45')]('nolimit')){_0x4f2a2a[_0x9331('0x47')]=qs[_0x9331('0x47')](_0x4a2efe[_0x9331('0x3e')][_0x9331('0x47')]);_0x4f2a2a[_0x9331('0x2e')]=qs[_0x9331('0x2e')](_0x4a2efe['query'][_0x9331('0x2e')]);}return _0x12b3b9[_0x9331('0x5a')](_0x4f2a2a);}})[_0x9331('0x21')](function(_0x40ec86){if(_0x40ec86){return _0x40ec86?{'count':_0x2ce178,'rows':_0x40ec86}:null;}})[_0x9331('0x21')](respondWithResult(_0x1e7a77,null))[_0x9331('0x55')](handleError(_0x1e7a77,null));};exports[_0x9331('0x5c')]=function(_0x134cf9,_0x2f4a6d,_0x45c7aa){if(_0x134cf9[_0x9331('0x59')]['id']){delete _0x134cf9['body']['id'];}return db[_0x9331('0x3a')][_0x9331('0x5d')]({'where':{'id':_0x134cf9[_0x9331('0x56')]['id']}})[_0x9331('0x21')](handleEntityNotFound(_0x2f4a6d,null))[_0x9331('0x21')](function(_0x40ffd7){if(_0x40ffd7){_0x134cf9[_0x9331('0x59')]['AccountId']=_0x40ffd7['id'];_0x134cf9[_0x9331('0x59')][_0x9331('0x5e')]=integrations[_0x9331('0x5f')](_0x134cf9[_0x9331('0x59')][_0x9331('0x60')],_0x134cf9['body'][_0x9331('0x3b')]);_0x134cf9[_0x9331('0x59')][_0x9331('0x61')]=integrations[_0x9331('0x62')](_0x134cf9[_0x9331('0x59')]['channel'],_0x134cf9[_0x9331('0x59')][_0x9331('0x3b')]);return db[_0x9331('0x5b')][_0x9331('0x63')](_0x134cf9['body'],{'include':[{'model':db[_0x9331('0x64')],'as':_0x9331('0x5e')},{'model':db[_0x9331('0x64')],'as':_0x9331('0x61')}]});}return null;})[_0x9331('0x21')](respondWithResult(_0x2f4a6d,null))[_0x9331('0x55')](handleError(_0x2f4a6d,null));};exports[_0x9331('0x65')]=function(_0x49b6ab,_0x3c41f7,_0x201bd3){var _0x936c5a=[{'name':_0x9331('0x66'),'label':_0x9331('0x66'),'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 _0x583a5a='';return db[_0x9331('0x3a')][_0x9331('0x5d')]({'where':{'id':_0x49b6ab[_0x9331('0x56')]['id']},'attributes':['id',_0x9331('0x67'),_0x9331('0x68'),_0x9331('0x69'),_0x9331('0x6a'),_0x9331('0x6b'),'consumerSecret',_0x9331('0x6c'),_0x9331('0x6d')]})['then'](handleEntityNotFound(_0x3c41f7,null))[_0x9331('0x21')](function(_0x577411){if(_0x577411){_0x583a5a=_0x577411[_0x9331('0x67')];var _0x4a66ae=_0x583a5a['slice'](-0x1);if(_0x4a66ae==='/'){_0x583a5a=_0x583a5a[_0x9331('0x6e')](0x0,_0x583a5a[_0x9331('0x6f')](_0x4a66ae));}var _0x4cfdbc={'method':'GET','uri':util[_0x9331('0x70')](_0x9331('0x71'),_0x583a5a),'headers':{'Content-Type':_0x9331('0x72'),'Accept':_0x9331('0x72')},'json':!![]};if(_0x577411['authType']===_0x9331('0x73')){_0x4cfdbc[_0x9331('0x74')][_0x9331('0x75')]=util[_0x9331('0x70')](_0x9331('0x76'),new Buffer(util['format'](_0x9331('0x77'),_0x577411[_0x9331('0x69')],_0x577411[_0x9331('0x6a')]))['toString'](_0x9331('0x78')));}return rp(_0x4cfdbc)[_0x9331('0x21')](function(_0x3fbb14){return _0x936c5a['concat'](_['map'](_0x3fbb14[_0x9331('0x79')][_0x9331('0x7a')],function(_0x435043){return{'id':_0x435043[_0x9331('0x38')],'name':_0x435043[_0x9331('0x38')],'type':_0x435043['type'],'active':_0x435043['active'],'label':_0x435043['label'],'custom':!![]};}));});}})[_0x9331('0x21')](function(_0x3f9c18){return{'count':_0x3f9c18[_0x9331('0x44')],'rows':_0x3f9c18};})[_0x9331('0x21')](respondWithResult(_0x3c41f7,null))[_0x9331('0x55')](function(_0xfcc3bf){var _0x5b4bf2=_0x49b6ab[_0x9331('0x3e')]['test']?0x1f4:_0xfcc3bf[_0x9331('0x7b')]||0x1f4;logger[_0x9331('0x28')](_0x9331('0x7c'),'getFields',_0x5b4bf2,JSON[_0x9331('0x26')](_0xfcc3bf));delete _0xfcc3bf[_0x9331('0x38')];if(_0x5b4bf2===0x191){_0x5b4bf2=0x190;}_0x3c41f7[_0x9331('0x2c')](_0x5b4bf2)['send'](_0x49b6ab['query']['test']?{'message':_0x9331('0x7d'),'statusCode':_0xfcc3bf['statusCode']}:_0xfcc3bf);});}; \ No newline at end of file +var _0x0b4e=['create','update','body','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','DeskField','Descriptions','priority','authType','username','password','consumerKey','token','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','map','DeskAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','params','keys'];(function(_0x30af93,_0x399a17){var _0x2ed31a=function(_0x19f1fc){while(--_0x19f1fc){_0x30af93['push'](_0x30af93['shift']());}};_0x2ed31a(++_0x399a17);}(_0x0b4e,0x117));var _0xe0b4=function(_0x3d820a,_0x4ab7e7){_0x3d820a=_0x3d820a-0x0;var _0x4da191=_0x0b4e[_0x3d820a];return _0x4da191;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe0b4('0x0'));var rimraf=require(_0xe0b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b4('0x2'));var rp=require(_0xe0b4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe0b4('0x4'));var util=require(_0xe0b4('0x5'));var path=require(_0xe0b4('0x6'));var sox=require('sox');var csv=require(_0xe0b4('0x7'));var ejs=require(_0xe0b4('0x8'));var fs=require('fs');var _=require(_0xe0b4('0x9'));var squel=require('squel');var crypto=require(_0xe0b4('0xa'));var jsforce=require(_0xe0b4('0xb'));var deskjs=require(_0xe0b4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe0b4('0xd'));var Papa=require('papaparse');var Redis=require(_0xe0b4('0xe'));var authService=require(_0xe0b4('0xf'));var qs=require(_0xe0b4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0b4('0x11'));var logger=require(_0xe0b4('0x12'))('api');var utils=require(_0xe0b4('0x13'));var config=require(_0xe0b4('0x14'));var db=require(_0xe0b4('0x15'))['db'];var integrations=require(_0xe0b4('0x16'));var jayson=require(_0xe0b4('0x17'));var client=jayson[_0xe0b4('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x1a164b,_0x4ae588,_0x3bde9b){if(_0x3bde9b){var _0x491d92=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x491d92[_0xe0b4('0x19')](_0x4ae588)){return _0x1a164b;}else{throw new db[(_0xe0b4('0x1a'))][(_0xe0b4('0x1b'))](_0xe0b4('0x1c'));}}else{return _0x1a164b;}}function respondWithRpcPromise(_0x4d903b,_0x360dd3,_0x131780,_0x11fbb1){return new BPromise(function(_0x3adde9,_0x1b9e6f){var _0xb93012=_0x11fbb1||client;return _0xb93012[_0xe0b4('0x1d')](_0x4d903b,_0x131780)['then'](function(_0x33e1eb){logger[_0xe0b4('0x1e')](_0xe0b4('0x1f'),_0x360dd3,_0xe0b4('0x20'));logger[_0xe0b4('0x21')](_0xe0b4('0x22'),_0x360dd3,_0xe0b4('0x20'),JSON[_0xe0b4('0x23')](_0x33e1eb));if(_0x33e1eb['error']){if(_0x33e1eb[_0xe0b4('0x24')]['code']===0x1f4){logger[_0xe0b4('0x24')](_0xe0b4('0x1f'),_0x360dd3,_0x33e1eb[_0xe0b4('0x24')]['message']);return _0x1b9e6f(_0x33e1eb['error'][_0xe0b4('0x25')]);}logger[_0xe0b4('0x24')](_0xe0b4('0x1f'),_0x360dd3,_0x33e1eb[_0xe0b4('0x24')][_0xe0b4('0x25')]);return _0x3adde9(_0x33e1eb[_0xe0b4('0x24')][_0xe0b4('0x25')]);}else{logger[_0xe0b4('0x1e')](_0xe0b4('0x1f'),_0x360dd3,_0xe0b4('0x20'));_0x3adde9(_0x33e1eb[_0xe0b4('0x26')][_0xe0b4('0x25')]);}})[_0xe0b4('0x27')](function(_0x584eb8){logger[_0xe0b4('0x24')](_0xe0b4('0x1f'),_0x360dd3,_0x584eb8);_0x1b9e6f(_0x584eb8);});});}function respondWithStatusCode(_0x11ab5a,_0x31d3f1){_0x31d3f1=_0x31d3f1||0xcc;return function(_0x185594){if(_0x185594){return _0x11ab5a[_0xe0b4('0x28')](_0x31d3f1);}return _0x11ab5a[_0xe0b4('0x29')](_0x31d3f1)[_0xe0b4('0x2a')]();};}function respondWithResult(_0x3d7353,_0x2395a2){_0x2395a2=_0x2395a2||0xc8;return function(_0x210c8c){if(_0x210c8c){return _0x3d7353['status'](_0x2395a2)[_0xe0b4('0x2b')](_0x210c8c);}};}function respondWithFilteredResult(_0x1cace8,_0x3c4516){return function(_0x48fffb){if(_0x48fffb){var _0x46574e=_0x48fffb[_0xe0b4('0x2c')],_0x48d937=_0x3c4516[_0xe0b4('0x2d')],_0x45d32b=_0x3c4516['offset']+_0x3c4516[_0xe0b4('0x2e')],_0x41334c;if(_0x45d32b>=_0x46574e){_0x45d32b=_0x46574e;_0x41334c=0xc8;}else{_0x41334c=0xce;}_0x1cace8['status'](_0x41334c);return _0x1cace8['set'](_0xe0b4('0x2f'),_0x48d937+'-'+_0x45d32b+'/'+_0x46574e)[_0xe0b4('0x2b')](_0x48fffb);}return null;};}function patchUpdates(_0x72bc23){return function(_0x6b346){try{jsonpatch[_0xe0b4('0x30')](_0x6b346,_0x72bc23,!![]);}catch(_0x38dde3){return BPromise[_0xe0b4('0x31')](_0x38dde3);}return _0x6b346[_0xe0b4('0x32')]();};}function saveUpdates(_0x4504cf,_0x804f5a){return function(_0x31ee8d){if(_0x31ee8d){return _0x31ee8d['update'](_0x4504cf)[_0xe0b4('0x33')](function(_0x182148){return _0x182148;});}return null;};}function removeEntity(_0x5dadd9,_0x4fdd11){return function(_0xe75c0b){if(_0xe75c0b){return _0xe75c0b[_0xe0b4('0x34')]()[_0xe0b4('0x33')](function(){_0x5dadd9[_0xe0b4('0x29')](0xcc)[_0xe0b4('0x2a')]();});}};}function handleEntityNotFound(_0x3e108e,_0x31f432){return function(_0x5180e2){if(!_0x5180e2){_0x3e108e[_0xe0b4('0x28')](0x194);}return _0x5180e2;};}function handleError(_0x14ed1d,_0x3db756){_0x3db756=_0x3db756||0x1f4;return function(_0x44c512){logger['error'](_0x44c512[_0xe0b4('0x35')]);if(_0x44c512[_0xe0b4('0x36')]){delete _0x44c512['name'];}_0x14ed1d[_0xe0b4('0x29')](_0x3db756)['send'](_0x44c512);};}exports['index']=function(_0x3f6d3f,_0xc1a0c3){var _0x3f1170={},_0xc65335={},_0x53b942={'count':0x0,'rows':[]};var _0x768c73=_[_0xe0b4('0x37')](db[_0xe0b4('0x38')][_0xe0b4('0x39')],function(_0x5de258){return{'name':_0x5de258['fieldName'],'type':_0x5de258[_0xe0b4('0x3a')][_0xe0b4('0x3b')]};});_0xc65335[_0xe0b4('0x3c')]=_[_0xe0b4('0x37')](_0x768c73,_0xe0b4('0x36'));_0xc65335[_0xe0b4('0x3d')]=_['keys'](_0x3f6d3f[_0xe0b4('0x3d')]);_0xc65335[_0xe0b4('0x3e')]=_[_0xe0b4('0x3f')](_0xc65335[_0xe0b4('0x3c')],_0xc65335[_0xe0b4('0x3d')]);_0x3f1170[_0xe0b4('0x40')]=_['intersection'](_0xc65335['model'],qs[_0xe0b4('0x41')](_0x3f6d3f[_0xe0b4('0x3d')][_0xe0b4('0x41')]));_0x3f1170['attributes']=_0x3f1170[_0xe0b4('0x40')][_0xe0b4('0x42')]?_0x3f1170[_0xe0b4('0x40')]:_0xc65335['model'];if(!_0x3f6d3f[_0xe0b4('0x3d')][_0xe0b4('0x43')](_0xe0b4('0x44'))){_0x3f1170['limit']=qs['limit'](_0x3f6d3f[_0xe0b4('0x3d')]['limit']);_0x3f1170['offset']=qs['offset'](_0x3f6d3f['query'][_0xe0b4('0x2d')]);}_0x3f1170[_0xe0b4('0x45')]=qs[_0xe0b4('0x46')](_0x3f6d3f['query'][_0xe0b4('0x46')]);_0x3f1170['where']=qs[_0xe0b4('0x3e')](_[_0xe0b4('0x47')](_0x3f6d3f['query'],_0xc65335[_0xe0b4('0x3e')]),_0x768c73);if(_0x3f6d3f[_0xe0b4('0x3d')][_0xe0b4('0x48')]){_0x3f1170[_0xe0b4('0x49')]=_[_0xe0b4('0x4a')](_0x3f1170['where'],{'$or':_[_0xe0b4('0x37')](_0x768c73,function(_0x2e537f){if(_0x2e537f['type']!=='VIRTUAL'){var _0x4069c3={};_0x4069c3[_0x2e537f[_0xe0b4('0x36')]]={'$like':'%'+_0x3f6d3f[_0xe0b4('0x3d')]['filter']+'%'};return _0x4069c3;}})});}_0x3f1170=_[_0xe0b4('0x4a')]({},_0x3f1170,_0x3f6d3f[_0xe0b4('0x4b')]);var _0x4c4949={'where':_0x3f1170[_0xe0b4('0x49')]};return db['DeskAccount'][_0xe0b4('0x2c')](_0x4c4949)['then'](function(_0xb37c20){_0x53b942['count']=_0xb37c20;if(_0x3f6d3f[_0xe0b4('0x3d')][_0xe0b4('0x4c')]){_0x3f1170[_0xe0b4('0x4d')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x3f1170);})[_0xe0b4('0x33')](function(_0x51a539){_0x53b942[_0xe0b4('0x4e')]=_0x51a539;return _0x53b942;})['then'](respondWithFilteredResult(_0xc1a0c3,_0x3f1170))[_0xe0b4('0x27')](handleError(_0xc1a0c3,null));};exports['show']=function(_0x36061f,_0x551a61){var _0xab0603={'raw':![],'where':{'id':_0x36061f[_0xe0b4('0x4f')]['id']}},_0x2b73f9={};_0x2b73f9[_0xe0b4('0x3c')]=_[_0xe0b4('0x50')](db['DeskAccount'][_0xe0b4('0x39')]);_0x2b73f9[_0xe0b4('0x3d')]=_[_0xe0b4('0x50')](_0x36061f[_0xe0b4('0x3d')]);_0x2b73f9[_0xe0b4('0x3e')]=_['intersection'](_0x2b73f9[_0xe0b4('0x3c')],_0x2b73f9[_0xe0b4('0x3d')]);_0xab0603[_0xe0b4('0x40')]=_[_0xe0b4('0x3f')](_0x2b73f9[_0xe0b4('0x3c')],qs['fields'](_0x36061f[_0xe0b4('0x3d')][_0xe0b4('0x41')]));_0xab0603[_0xe0b4('0x40')]=_0xab0603[_0xe0b4('0x40')]['length']?_0xab0603[_0xe0b4('0x40')]:_0x2b73f9[_0xe0b4('0x3c')];if(_0x36061f[_0xe0b4('0x3d')][_0xe0b4('0x4c')]){_0xab0603[_0xe0b4('0x4d')]=[{'all':!![]}];}_0xab0603=_['merge']({},_0xab0603,_0x36061f[_0xe0b4('0x4b')]);return db[_0xe0b4('0x38')]['find'](_0xab0603)[_0xe0b4('0x33')](handleEntityNotFound(_0x551a61,null))[_0xe0b4('0x33')](respondWithResult(_0x551a61,null))[_0xe0b4('0x27')](handleError(_0x551a61,null));};exports['create']=function(_0x59b3b8,_0x1cc236){return db[_0xe0b4('0x38')][_0xe0b4('0x51')](_0x59b3b8['body'],{})['then'](respondWithResult(_0x1cc236,0xc9))[_0xe0b4('0x27')](handleError(_0x1cc236,null));};exports[_0xe0b4('0x52')]=function(_0x163baa,_0x217cf3){if(_0x163baa[_0xe0b4('0x53')]['id']){delete _0x163baa['body']['id'];}return db[_0xe0b4('0x38')][_0xe0b4('0x54')]({'where':{'id':_0x163baa[_0xe0b4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x217cf3,null))[_0xe0b4('0x33')](saveUpdates(_0x163baa[_0xe0b4('0x53')],null))[_0xe0b4('0x33')](respondWithResult(_0x217cf3,null))[_0xe0b4('0x27')](handleError(_0x217cf3,null));};exports[_0xe0b4('0x34')]=function(_0x93f934,_0x55f150){return db[_0xe0b4('0x38')]['find']({'where':{'id':_0x93f934['params']['id']}})['then'](handleEntityNotFound(_0x55f150,null))[_0xe0b4('0x33')](removeEntity(_0x55f150,null))[_0xe0b4('0x27')](handleError(_0x55f150,null));};exports[_0xe0b4('0x55')]=function(_0x222fce,_0x2c3598,_0x16c640){var _0x13badb={};var _0x551459={};var _0x4932fd;var _0x348465;return db[_0xe0b4('0x38')][_0xe0b4('0x56')]({'where':{'id':_0x222fce[_0xe0b4('0x4f')]['id']}})[_0xe0b4('0x33')](handleEntityNotFound(_0x2c3598,null))[_0xe0b4('0x33')](function(_0x4ed0e7){if(_0x4ed0e7){_0x4932fd=_0x4ed0e7;_0x551459[_0xe0b4('0x3c')]=_[_0xe0b4('0x50')](db[_0xe0b4('0x57')][_0xe0b4('0x39')]);_0x551459['query']=_[_0xe0b4('0x50')](_0x222fce[_0xe0b4('0x3d')]);_0x551459[_0xe0b4('0x3e')]=_['intersection'](_0x551459[_0xe0b4('0x3c')],_0x551459['query']);_0x13badb[_0xe0b4('0x40')]=_[_0xe0b4('0x3f')](_0x551459[_0xe0b4('0x3c')],qs['fields'](_0x222fce[_0xe0b4('0x3d')][_0xe0b4('0x41')]));_0x13badb[_0xe0b4('0x40')]=_0x13badb[_0xe0b4('0x40')][_0xe0b4('0x42')]?_0x13badb['attributes']:_0x551459[_0xe0b4('0x3c')];_0x13badb[_0xe0b4('0x45')]=qs['sort'](_0x222fce[_0xe0b4('0x3d')][_0xe0b4('0x46')]);_0x13badb[_0xe0b4('0x49')]=qs[_0xe0b4('0x3e')](_[_0xe0b4('0x47')](_0x222fce[_0xe0b4('0x3d')],_0x551459[_0xe0b4('0x3e')]));if(_0x222fce[_0xe0b4('0x3d')]['filter']){_0x13badb[_0xe0b4('0x49')]=_['merge'](_0x13badb['where'],{'$or':_['map'](_0x13badb[_0xe0b4('0x40')],function(_0x2254e3){var _0x3b5e94={};_0x3b5e94[_0x2254e3]={'$like':'%'+_0x222fce[_0xe0b4('0x3d')]['filter']+'%'};return _0x3b5e94;})});}_0x13badb=_[_0xe0b4('0x4a')]({},_0x13badb,_0x222fce['options']);return _0x4932fd[_0xe0b4('0x55')](_0x13badb);}})['then'](function(_0x244bb8){if(_0x244bb8){_0x348465=_0x244bb8[_0xe0b4('0x42')];if(!_0x222fce['query'][_0xe0b4('0x43')](_0xe0b4('0x44'))){_0x13badb[_0xe0b4('0x2e')]=qs[_0xe0b4('0x2e')](_0x222fce[_0xe0b4('0x3d')][_0xe0b4('0x2e')]);_0x13badb[_0xe0b4('0x2d')]=qs[_0xe0b4('0x2d')](_0x222fce[_0xe0b4('0x3d')]['offset']);}return _0x4932fd[_0xe0b4('0x55')](_0x13badb);}})[_0xe0b4('0x33')](function(_0x5468e3){if(_0x5468e3){return _0x5468e3?{'count':_0x348465,'rows':_0x5468e3}:null;}})[_0xe0b4('0x33')](respondWithResult(_0x2c3598,null))['catch'](handleError(_0x2c3598,null));};exports[_0xe0b4('0x58')]=function(_0x4f1b80,_0x42e526,_0x5334ab){if(_0x4f1b80[_0xe0b4('0x53')]['id']){delete _0x4f1b80[_0xe0b4('0x53')]['id'];}return db[_0xe0b4('0x38')][_0xe0b4('0x56')]({'where':{'id':_0x4f1b80[_0xe0b4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x42e526,null))[_0xe0b4('0x33')](function(_0x14393c){if(_0x14393c){_0x4f1b80[_0xe0b4('0x53')][_0xe0b4('0x59')]=_0x14393c['id'];_0x4f1b80[_0xe0b4('0x53')][_0xe0b4('0x5a')]=integrations[_0xe0b4('0x5b')](_0x4f1b80[_0xe0b4('0x53')]['channel'],_0x4f1b80['body'][_0xe0b4('0x3a')]);_0x4f1b80['body']['Descriptions']=integrations[_0xe0b4('0x5c')](_0x4f1b80['body'][_0xe0b4('0x5d')],_0x4f1b80[_0xe0b4('0x53')][_0xe0b4('0x3a')]);return db['DeskConfiguration'][_0xe0b4('0x51')](_0x4f1b80[_0xe0b4('0x53')],{'include':[{'model':db[_0xe0b4('0x5e')],'as':_0xe0b4('0x5a')},{'model':db['DeskField'],'as':_0xe0b4('0x5f')}]});}return null;})[_0xe0b4('0x33')](respondWithResult(_0x42e526,null))['catch'](handleError(_0x42e526,null));};exports['getFields']=function(_0x305451,_0x421ba2,_0x3e121a){var _0x4d9989=[{'name':_0xe0b4('0x60'),'label':_0xe0b4('0x60'),'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 _0x4acc81='';return db[_0xe0b4('0x38')]['findOne']({'where':{'id':_0x305451['params']['id']},'attributes':['id','remoteUri',_0xe0b4('0x61'),_0xe0b4('0x62'),_0xe0b4('0x63'),_0xe0b4('0x64'),'consumerSecret',_0xe0b4('0x65'),'tokenSecret']})[_0xe0b4('0x33')](handleEntityNotFound(_0x421ba2,null))[_0xe0b4('0x33')](function(_0x220e8b){if(_0x220e8b){_0x4acc81=_0x220e8b['remoteUri'];var _0x2b7377=_0x4acc81['slice'](-0x1);if(_0x2b7377==='/'){_0x4acc81=_0x4acc81[_0xe0b4('0x66')](0x0,_0x4acc81['lastIndexOf'](_0x2b7377));}var _0x1f00ef={'method':_0xe0b4('0x67'),'uri':util[_0xe0b4('0x68')](_0xe0b4('0x69'),_0x4acc81),'headers':{'Content-Type':'application/json','Accept':_0xe0b4('0x6a')},'json':!![]};if(_0x220e8b[_0xe0b4('0x61')]===_0xe0b4('0x6b')){_0x1f00ef[_0xe0b4('0x6c')][_0xe0b4('0x6d')]=util[_0xe0b4('0x68')]('Basic\x20%s',new Buffer(util[_0xe0b4('0x68')](_0xe0b4('0x6e'),_0x220e8b['username'],_0x220e8b['password']))['toString']('base64'));}return rp(_0x1f00ef)[_0xe0b4('0x33')](function(_0x4ae3a7){return _0x4d9989[_0xe0b4('0x6f')](_[_0xe0b4('0x37')](_0x4ae3a7[_0xe0b4('0x70')][_0xe0b4('0x71')],function(_0xd8076a){return{'id':_0xd8076a[_0xe0b4('0x36')],'name':_0xd8076a['name'],'type':_0xd8076a['type'],'active':_0xd8076a[_0xe0b4('0x72')],'label':_0xd8076a[_0xe0b4('0x73')],'custom':!![]};}));});}})[_0xe0b4('0x33')](function(_0x4e7b3a){return{'count':_0x4e7b3a[_0xe0b4('0x42')],'rows':_0x4e7b3a};})[_0xe0b4('0x33')](respondWithResult(_0x421ba2,null))[_0xe0b4('0x27')](function(_0x303bf3){var _0x3088c8=_0x305451[_0xe0b4('0x3d')][_0xe0b4('0x19')]?0x1f4:_0x303bf3[_0xe0b4('0x74')]||0x1f4;logger[_0xe0b4('0x24')](_0xe0b4('0x75'),_0xe0b4('0x76'),_0x3088c8,JSON[_0xe0b4('0x23')](_0x303bf3));delete _0x303bf3[_0xe0b4('0x36')];if(_0x3088c8===0x191){_0x3088c8=0x190;}_0x421ba2['status'](_0x3088c8)[_0xe0b4('0x77')](_0x305451[_0xe0b4('0x3d')][_0xe0b4('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x303bf3[_0xe0b4('0x74')]}:_0x303bf3);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 85c83e7..0b5dccb 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 _0x82a2=['define','DeskAccount','int_desk_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4360f0,_0x39d82c){var _0x12aeac=function(_0x2a0892){while(--_0x2a0892){_0x4360f0['push'](_0x4360f0['shift']());}};_0x12aeac(++_0x39d82c);}(_0x82a2,0x196));var _0x282a=function(_0x24126c,_0x17aa2f){_0x24126c=_0x24126c-0x0;var _0x53bcbd=_0x82a2[_0x24126c];return _0x53bcbd;};'use strict';var _=require(_0x282a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x282a('0x1'));var moment=require('moment');var BPromise=require(_0x282a('0x2'));var rp=require(_0x282a('0x3'));var fs=require('fs');var path=require(_0x282a('0x4'));var rimraf=require(_0x282a('0x5'));var config=require(_0x282a('0x6'));var attributes=require(_0x282a('0x7'));var integrations=require(_0x282a('0x8'));module[_0x282a('0x9')]=function(_0x5c0e85,_0x481047){return _0x5c0e85[_0x282a('0xa')](_0x282a('0xb'),attributes,{'tableName':_0x282a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd892=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x37bb49,_0x3bdfa){var _0x5cc827=function(_0x52ef57){while(--_0x52ef57){_0x37bb49['push'](_0x37bb49['shift']());}};_0x5cc827(++_0x3bdfa);}(_0xd892,0x103));var _0x2d89=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xd892[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x2d89('0x0'));var util=require('util');var logger=require(_0x2d89('0x1'))(_0x2d89('0x2'));var moment=require(_0x2d89('0x3'));var BPromise=require('bluebird');var rp=require(_0x2d89('0x4'));var fs=require('fs');var path=require(_0x2d89('0x5'));var rimraf=require(_0x2d89('0x6'));var config=require(_0x2d89('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x2d89('0x8'));module[_0x2d89('0x9')]=function(_0x4c51b9,_0x47d7b4){return _0x4c51b9[_0x2d89('0xa')](_0x2d89('0xb'),attributes,{'tableName':_0x2d89('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index c0b2252..7ba73ec 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 _0x1eb9=['where','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetDeskAccount','findAll','options','raw','attributes','limit','map','include','model','then','debug','ShowDeskAccount','DeskAccount'];(function(_0x3c0af0,_0x9f26d6){var _0x5be111=function(_0x156154){while(--_0x156154){_0x3c0af0['push'](_0x3c0af0['shift']());}};_0x5be111(++_0x9f26d6);}(_0x1eb9,0x1c1));var _0x91eb=function(_0x49ce11,_0x751697){_0x49ce11=_0x49ce11-0x0;var _0x1c51f6=_0x1eb9[_0x49ce11];return _0x1c51f6;};'use strict';var _=require(_0x91eb('0x0'));var util=require(_0x91eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91eb('0x2'))['db'];var utils=require(_0x91eb('0x3'));var logger=require(_0x91eb('0x4'))(_0x91eb('0x5'));var config=require(_0x91eb('0x6'));var jayson=require(_0x91eb('0x7'));var client=jayson[_0x91eb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2867e2,_0x3c99cc,_0x525ff7){return new BPromise(function(_0x29061f,_0x58d7db){return client[_0x91eb('0x9')](_0x2867e2,_0x525ff7)['then'](function(_0x4d193e){logger[_0x91eb('0xa')](_0x91eb('0xb'),_0x3c99cc,_0x91eb('0xc'));logger['debug'](_0x91eb('0xd'),_0x3c99cc,_0x91eb('0xc'),JSON[_0x91eb('0xe')](_0x4d193e));if(_0x4d193e[_0x91eb('0xf')]){if(_0x4d193e[_0x91eb('0xf')]['code']===0x1f4){logger[_0x91eb('0xf')]('DeskAccount,\x20%s,\x20%s',_0x3c99cc,_0x4d193e[_0x91eb('0xf')]['message']);return _0x58d7db(_0x4d193e[_0x91eb('0xf')][_0x91eb('0x10')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x3c99cc,_0x4d193e[_0x91eb('0xf')][_0x91eb('0x10')]);return _0x29061f(_0x4d193e[_0x91eb('0xf')][_0x91eb('0x10')]);}else{logger[_0x91eb('0xa')]('DeskAccount,\x20%s,\x20%s',_0x3c99cc,'request\x20sent');_0x29061f(_0x4d193e['result'][_0x91eb('0x10')]);}})[_0x91eb('0x11')](function(_0x4659ca){logger[_0x91eb('0xf')](_0x91eb('0xb'),_0x3c99cc,_0x4659ca);_0x58d7db(_0x4659ca);});});}exports[_0x91eb('0x12')]=function(_0x586dda){var _0x61f3cc=this;return new Promise(function(_0x283f46,_0x920d09){return db['DeskAccount'][_0x91eb('0x13')]({'raw':_0x586dda['options']?_0x586dda[_0x91eb('0x14')][_0x91eb('0x15')]===undefined?!![]:![]:!![],'where':_0x586dda[_0x91eb('0x14')]?_0x586dda[_0x91eb('0x14')]['where']||null:null,'attributes':_0x586dda[_0x91eb('0x14')]?_0x586dda[_0x91eb('0x14')][_0x91eb('0x16')]||null:null,'limit':_0x586dda['options']?_0x586dda[_0x91eb('0x14')][_0x91eb('0x17')]||null:null,'include':_0x586dda['options']?_0x586dda[_0x91eb('0x14')]['include']?_[_0x91eb('0x18')](_0x586dda[_0x91eb('0x14')][_0x91eb('0x19')],function(_0x1e41ef){return{'model':db[_0x1e41ef['model']],'as':_0x1e41ef['as'],'attributes':_0x1e41ef['attributes'],'include':_0x1e41ef['include']?_[_0x91eb('0x18')](_0x1e41ef[_0x91eb('0x19')],function(_0xf9917b){return{'model':db[_0xf9917b[_0x91eb('0x1a')]],'as':_0xf9917b['as'],'attributes':_0xf9917b[_0x91eb('0x16')],'include':_0xf9917b[_0x91eb('0x19')]?_[_0x91eb('0x18')](_0xf9917b['include'],function(_0x56bbdc){return{'model':db[_0x56bbdc[_0x91eb('0x1a')]],'as':_0x56bbdc['as'],'attributes':_0x56bbdc['attributes']};}):[]};}):[]};}):[]:[]})[_0x91eb('0x1b')](function(_0x49c7e0){logger[_0x91eb('0xa')](_0x91eb('0x12'),_0x586dda);logger[_0x91eb('0x1c')](_0x91eb('0x12'),_0x586dda,JSON[_0x91eb('0xe')](_0x49c7e0));_0x283f46(_0x49c7e0);})['catch'](function(_0x384598){logger[_0x91eb('0xf')](_0x91eb('0x12'),_0x384598[_0x91eb('0x10')],_0x586dda);_0x920d09(_0x61f3cc[_0x91eb('0xf')](0x1f4,_0x384598[_0x91eb('0x10')]));});});};exports[_0x91eb('0x1d')]=function(_0x330b58){var _0x2c8ba5=this;return new Promise(function(_0x3ce690,_0x44bca7){return db[_0x91eb('0x1e')]['find']({'raw':_0x330b58[_0x91eb('0x14')]?_0x330b58[_0x91eb('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x330b58['options']?_0x330b58[_0x91eb('0x14')][_0x91eb('0x1f')]||null:null,'attributes':_0x330b58[_0x91eb('0x14')]?_0x330b58[_0x91eb('0x14')][_0x91eb('0x16')]||null:null,'include':_0x330b58[_0x91eb('0x14')]?_0x330b58[_0x91eb('0x14')][_0x91eb('0x19')]?_[_0x91eb('0x18')](_0x330b58[_0x91eb('0x14')][_0x91eb('0x19')],function(_0x2d6e70){return{'model':db[_0x2d6e70['model']],'as':_0x2d6e70['as'],'attributes':_0x2d6e70['attributes'],'include':_0x2d6e70[_0x91eb('0x19')]?_[_0x91eb('0x18')](_0x2d6e70[_0x91eb('0x19')],function(_0xbe7ed2){return{'model':db[_0xbe7ed2[_0x91eb('0x1a')]],'as':_0xbe7ed2['as'],'attributes':_0xbe7ed2['attributes'],'include':_0xbe7ed2['include']?_['map'](_0xbe7ed2[_0x91eb('0x19')],function(_0x43083c){return{'model':db[_0x43083c[_0x91eb('0x1a')]],'as':_0x43083c['as'],'attributes':_0x43083c[_0x91eb('0x16')]};}):[]};}):[]};}):[]:[]})[_0x91eb('0x1b')](function(_0x3d5ee9){logger[_0x91eb('0xa')](_0x91eb('0x1d'),_0x330b58);logger['debug'](_0x91eb('0x1d'),_0x330b58,JSON[_0x91eb('0xe')](_0x3d5ee9));_0x3ce690(_0x3d5ee9);})[_0x91eb('0x11')](function(_0x3cf493){logger[_0x91eb('0xf')](_0x91eb('0x1d'),_0x3cf493[_0x91eb('0x10')],_0x330b58);_0x44bca7(_0x2c8ba5[_0x91eb('0xf')](0x1f4,_0x3cf493[_0x91eb('0x10')]));});});}; \ No newline at end of file +var _0xd76b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','include','map','model','attributes','then','stringify','ShowDeskAccount','find','where','catch','lodash','moment'];(function(_0x51d248,_0x208867){var _0x4cb400=function(_0x2942ec){while(--_0x2942ec){_0x51d248['push'](_0x51d248['shift']());}};_0x4cb400(++_0x208867);}(_0xd76b,0x1ba));var _0xbd76=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xd76b[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xbd76('0x0'));var util=require('util');var moment=require(_0xbd76('0x1'));var BPromise=require(_0xbd76('0x2'));var rs=require(_0xbd76('0x3'));var fs=require('fs');var Redis=require(_0xbd76('0x4'));var db=require(_0xbd76('0x5'))['db'];var utils=require(_0xbd76('0x6'));var logger=require(_0xbd76('0x7'))(_0xbd76('0x8'));var config=require(_0xbd76('0x9'));var jayson=require(_0xbd76('0xa'));var client=jayson['client'][_0xbd76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57ef01,_0x105ba6,_0x54a6ac){return new BPromise(function(_0x7501f9,_0x5a055d){return client[_0xbd76('0xc')](_0x57ef01,_0x54a6ac)['then'](function(_0x253bc4){logger[_0xbd76('0xd')](_0xbd76('0xe'),_0x105ba6,'request\x20sent');logger[_0xbd76('0xf')](_0xbd76('0x10'),_0x105ba6,_0xbd76('0x11'),JSON['stringify'](_0x253bc4));if(_0x253bc4[_0xbd76('0x12')]){if(_0x253bc4[_0xbd76('0x12')][_0xbd76('0x13')]===0x1f4){logger[_0xbd76('0x12')](_0xbd76('0xe'),_0x105ba6,_0x253bc4[_0xbd76('0x12')][_0xbd76('0x14')]);return _0x5a055d(_0x253bc4[_0xbd76('0x12')][_0xbd76('0x14')]);}logger[_0xbd76('0x12')](_0xbd76('0xe'),_0x105ba6,_0x253bc4['error']['message']);return _0x7501f9(_0x253bc4[_0xbd76('0x12')][_0xbd76('0x14')]);}else{logger[_0xbd76('0xd')](_0xbd76('0xe'),_0x105ba6,_0xbd76('0x11'));_0x7501f9(_0x253bc4[_0xbd76('0x15')]['message']);}})['catch'](function(_0x74e80f){logger[_0xbd76('0x12')](_0xbd76('0xe'),_0x105ba6,_0x74e80f);_0x5a055d(_0x74e80f);});});}exports[_0xbd76('0x16')]=function(_0x134591){var _0x1440ed=this;return new Promise(function(_0x2e4744,_0x4abce6){return db[_0xbd76('0x17')][_0xbd76('0x18')]({'raw':_0x134591[_0xbd76('0x19')]?_0x134591[_0xbd76('0x19')][_0xbd76('0x1a')]===undefined?!![]:![]:!![],'where':_0x134591[_0xbd76('0x19')]?_0x134591['options']['where']||null:null,'attributes':_0x134591[_0xbd76('0x19')]?_0x134591[_0xbd76('0x19')]['attributes']||null:null,'limit':_0x134591[_0xbd76('0x19')]?_0x134591[_0xbd76('0x19')]['limit']||null:null,'include':_0x134591[_0xbd76('0x19')]?_0x134591['options'][_0xbd76('0x1b')]?_[_0xbd76('0x1c')](_0x134591[_0xbd76('0x19')]['include'],function(_0x50081c){return{'model':db[_0x50081c[_0xbd76('0x1d')]],'as':_0x50081c['as'],'attributes':_0x50081c[_0xbd76('0x1e')],'include':_0x50081c[_0xbd76('0x1b')]?_['map'](_0x50081c[_0xbd76('0x1b')],function(_0x53d722){return{'model':db[_0x53d722[_0xbd76('0x1d')]],'as':_0x53d722['as'],'attributes':_0x53d722[_0xbd76('0x1e')],'include':_0x53d722[_0xbd76('0x1b')]?_[_0xbd76('0x1c')](_0x53d722[_0xbd76('0x1b')],function(_0x248226){return{'model':db[_0x248226[_0xbd76('0x1d')]],'as':_0x248226['as'],'attributes':_0x248226[_0xbd76('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbd76('0x1f')](function(_0x18f6ac){logger['info'](_0xbd76('0x16'),_0x134591);logger[_0xbd76('0xf')](_0xbd76('0x16'),_0x134591,JSON[_0xbd76('0x20')](_0x18f6ac));_0x2e4744(_0x18f6ac);})['catch'](function(_0x385819){logger[_0xbd76('0x12')](_0xbd76('0x16'),_0x385819['message'],_0x134591);_0x4abce6(_0x1440ed[_0xbd76('0x12')](0x1f4,_0x385819[_0xbd76('0x14')]));});});};exports[_0xbd76('0x21')]=function(_0x249cab){var _0x5e44e8=this;return new Promise(function(_0x6d6ed5,_0x2c55d2){return db[_0xbd76('0x17')][_0xbd76('0x22')]({'raw':_0x249cab[_0xbd76('0x19')]?_0x249cab[_0xbd76('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x249cab[_0xbd76('0x19')]?_0x249cab[_0xbd76('0x19')][_0xbd76('0x23')]||null:null,'attributes':_0x249cab[_0xbd76('0x19')]?_0x249cab['options'][_0xbd76('0x1e')]||null:null,'include':_0x249cab[_0xbd76('0x19')]?_0x249cab[_0xbd76('0x19')]['include']?_[_0xbd76('0x1c')](_0x249cab[_0xbd76('0x19')][_0xbd76('0x1b')],function(_0x3d4297){return{'model':db[_0x3d4297['model']],'as':_0x3d4297['as'],'attributes':_0x3d4297[_0xbd76('0x1e')],'include':_0x3d4297[_0xbd76('0x1b')]?_[_0xbd76('0x1c')](_0x3d4297['include'],function(_0x1d7f2c){return{'model':db[_0x1d7f2c[_0xbd76('0x1d')]],'as':_0x1d7f2c['as'],'attributes':_0x1d7f2c[_0xbd76('0x1e')],'include':_0x1d7f2c[_0xbd76('0x1b')]?_['map'](_0x1d7f2c[_0xbd76('0x1b')],function(_0x1c7145){return{'model':db[_0x1c7145['model']],'as':_0x1c7145['as'],'attributes':_0x1c7145[_0xbd76('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbd76('0x1f')](function(_0x963f41){logger[_0xbd76('0xd')](_0xbd76('0x21'),_0x249cab);logger[_0xbd76('0xf')](_0xbd76('0x21'),_0x249cab,JSON[_0xbd76('0x20')](_0x963f41));_0x6d6ed5(_0x963f41);})[_0xbd76('0x24')](function(_0xeb3669){logger['error'](_0xbd76('0x21'),_0xeb3669['message'],_0x249cab);_0x2c55d2(_0x5e44e8[_0xbd76('0x12')](0x1f4,_0xeb3669[_0xbd76('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f41ff3c..0556afc 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 _0x160c=['put','update','/:id','destroy','exports','util','path','connect-timeout','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post'];(function(_0x3804da,_0x4b1678){var _0x1038e3=function(_0x46dbaf){while(--_0x46dbaf){_0x3804da['push'](_0x3804da['shift']());}};_0x1038e3(++_0x4b1678);}(_0x160c,0x181));var _0xc160=function(_0x3df0d4,_0x45f109){_0x3df0d4=_0x3df0d4-0x0;var _0x2906da=_0x160c[_0x3df0d4];return _0x2906da;};'use strict';var multer=require('multer');var util=require(_0xc160('0x0'));var path=require(_0xc160('0x1'));var timeout=require(_0xc160('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc160('0x3'));var config=require('../../config/environment');var controller=require(_0xc160('0x4'));router[_0xc160('0x5')]('/',auth[_0xc160('0x6')](),controller['index']);router[_0xc160('0x5')]('/:id',auth[_0xc160('0x6')](),controller['show']);router[_0xc160('0x5')](_0xc160('0x7'),auth['isAuthenticated'](),controller[_0xc160('0x8')]);router[_0xc160('0x5')]('/:id/subjects',auth[_0xc160('0x6')](),controller[_0xc160('0x9')]);router[_0xc160('0x5')](_0xc160('0xa'),auth[_0xc160('0x6')](),controller[_0xc160('0xb')]);router[_0xc160('0x5')](_0xc160('0xc'),auth[_0xc160('0x6')](),controller['getTags']);router[_0xc160('0xd')]('/',auth[_0xc160('0x6')](),controller['create']);router[_0xc160('0xd')](_0xc160('0xc'),auth[_0xc160('0x6')](),controller['setTags']);router[_0xc160('0xe')]('/:id',auth[_0xc160('0x6')](),controller[_0xc160('0xf')]);router['delete'](_0xc160('0x10'),auth['isAuthenticated'](),controller[_0xc160('0x11')]);module[_0xc160('0x12')]=router; \ No newline at end of file +var _0x7374=['index','get','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller'];(function(_0x1a49fc,_0x527071){var _0x5589fc=function(_0x1bf972){while(--_0x1bf972){_0x1a49fc['push'](_0x1a49fc['shift']());}};_0x5589fc(++_0x527071);}(_0x7374,0x1b9));var _0x4737=function(_0x2a67dc,_0x59b6df){_0x2a67dc=_0x2a67dc-0x0;var _0x379fb3=_0x7374[_0x2a67dc];return _0x379fb3;};'use strict';var multer=require(_0x4737('0x0'));var util=require(_0x4737('0x1'));var path=require(_0x4737('0x2'));var timeout=require(_0x4737('0x3'));var express=require(_0x4737('0x4'));var router=express['Router']();var auth=require(_0x4737('0x5'));var interaction=require(_0x4737('0x6'));var config=require(_0x4737('0x7'));var controller=require(_0x4737('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4737('0x9')]);router[_0x4737('0xa')](_0x4737('0xb'),auth[_0x4737('0xc')](),controller['show']);router[_0x4737('0xa')](_0x4737('0xd'),auth[_0x4737('0xc')](),controller[_0x4737('0xe')]);router[_0x4737('0xa')]('/:id/subjects',auth[_0x4737('0xc')](),controller[_0x4737('0xf')]);router[_0x4737('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x4737('0x10')]);router[_0x4737('0xa')](_0x4737('0x11'),auth[_0x4737('0xc')](),controller[_0x4737('0x12')]);router[_0x4737('0x13')]('/',auth[_0x4737('0xc')](),controller[_0x4737('0x14')]);router[_0x4737('0x13')]('/:id/tags',auth[_0x4737('0xc')](),controller[_0x4737('0x15')]);router[_0x4737('0x16')](_0x4737('0xb'),auth[_0x4737('0xc')](),controller['update']);router['delete'](_0x4737('0xb'),auth['isAuthenticated'](),controller[_0x4737('0x17')]);module[_0x4737('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 5bd91ca..4100086 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 _0x01a0=['STRING','sequelize','exports'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x01a0,0x6a));var _0x001a=function(_0x2df47a,_0x1b4403){_0x2df47a=_0x2df47a-0x0;var _0xac464f=_0x01a0[_0x2df47a];return _0xac464f;};'use strict';var Sequelize=require(_0x001a('0x0'));module[_0x001a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x001a('0x2')]}}; \ No newline at end of file +var _0x3b43=['exports','STRING','sequelize'];(function(_0x557beb,_0x1a4de9){var _0x5bb13c=function(_0x5d4ba3){while(--_0x5d4ba3){_0x557beb['push'](_0x557beb['shift']());}};_0x5bb13c(++_0x1a4de9);}(_0x3b43,0x1c1));var _0x33b4=function(_0x26e4ea,_0x436d35){_0x26e4ea=_0x26e4ea-0x0;var _0x483409=_0x3b43[_0x26e4ea];return _0x483409;};'use strict';var Sequelize=require(_0x33b4('0x0'));module[_0x33b4('0x1')]={'name':{'type':Sequelize[_0x33b4('0x2')]},'description':{'type':Sequelize[_0x33b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index cf79862..d48f329 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 _0x6688=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','test','Sequelize','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','save','end','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','DeskConfiguration','findAll','rows','show','params','length','include','find','create','body','update','destroy','getFields','findOne','getSubjects','getDescriptions','DeskField','Tag','getTags','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x253889,_0x4d71e6){var _0x24f09e=function(_0x389a96){while(--_0x389a96){_0x253889['push'](_0x253889['shift']());}};_0x24f09e(++_0x4d71e6);}(_0x6688,0x10e));var _0x8668=function(_0x45440f,_0x575c5f){_0x45440f=_0x45440f-0x0;var _0x4480bd=_0x6688[_0x45440f];return _0x4480bd;};'use strict';var pdf=require(_0x8668('0x0'));var emlformat=require(_0x8668('0x1'));var rimraf=require(_0x8668('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8668('0x3'));var rp=require(_0x8668('0x4'));var moment=require(_0x8668('0x5'));var BPromise=require(_0x8668('0x6'));var Mustache=require(_0x8668('0x7'));var util=require(_0x8668('0x8'));var path=require(_0x8668('0x9'));var sox=require('sox');var csv=require(_0x8668('0xa'));var ejs=require(_0x8668('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8668('0xc'));var crypto=require(_0x8668('0xd'));var jsforce=require(_0x8668('0xe'));var deskjs=require(_0x8668('0xf'));var toCsv=require(_0x8668('0xa'));var querystring=require(_0x8668('0x10'));var Papa=require(_0x8668('0x11'));var Redis=require(_0x8668('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8668('0x13'))(_0x8668('0x14'));var utils=require(_0x8668('0x15'));var config=require(_0x8668('0x16'));var db=require(_0x8668('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x8668('0x18')]({'port':0x232a});function checkPasswordPattern(_0x118b00,_0x1440ef,_0x48311a){if(_0x48311a){var _0x3c8de8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c8de8[_0x8668('0x19')](_0x1440ef)){return _0x118b00;}else{throw new db[(_0x8668('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x118b00;}}function respondWithRpcPromise(_0x12c31e,_0x16fe4b,_0x1095ea,_0x20dd0a){return new BPromise(function(_0x5a68f6,_0x590e51){var _0x246506=_0x20dd0a||client;return _0x246506[_0x8668('0x1b')](_0x12c31e,_0x1095ea)[_0x8668('0x1c')](function(_0x43a3c9){logger[_0x8668('0x1d')](_0x8668('0x1e'),_0x16fe4b,'request\x20sent');logger[_0x8668('0x1f')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x16fe4b,'request\x20sent',JSON['stringify'](_0x43a3c9));if(_0x43a3c9['error']){if(_0x43a3c9[_0x8668('0x20')][_0x8668('0x21')]===0x1f4){logger[_0x8668('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x16fe4b,_0x43a3c9[_0x8668('0x20')]['message']);return _0x590e51(_0x43a3c9[_0x8668('0x20')][_0x8668('0x22')]);}logger[_0x8668('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x16fe4b,_0x43a3c9[_0x8668('0x20')][_0x8668('0x22')]);return _0x5a68f6(_0x43a3c9[_0x8668('0x20')]['message']);}else{logger[_0x8668('0x1d')](_0x8668('0x1e'),_0x16fe4b,_0x8668('0x23'));_0x5a68f6(_0x43a3c9[_0x8668('0x24')][_0x8668('0x22')]);}})[_0x8668('0x25')](function(_0xbd5c3a){logger[_0x8668('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x16fe4b,_0xbd5c3a);_0x590e51(_0xbd5c3a);});});}function respondWithStatusCode(_0x48f655,_0x3073d7){_0x3073d7=_0x3073d7||0xcc;return function(_0x3286e3){if(_0x3286e3){return _0x48f655[_0x8668('0x26')](_0x3073d7);}return _0x48f655[_0x8668('0x27')](_0x3073d7)['end']();};}function respondWithResult(_0xc765c8,_0x215cef){_0x215cef=_0x215cef||0xc8;return function(_0x459cf8){if(_0x459cf8){return _0xc765c8[_0x8668('0x27')](_0x215cef)[_0x8668('0x28')](_0x459cf8);}};}function respondWithFilteredResult(_0x5c5c14,_0x51fb3b){return function(_0x1f3035){if(_0x1f3035){var _0x105356=_0x1f3035[_0x8668('0x29')],_0x43b8d1=_0x51fb3b[_0x8668('0x2a')],_0x55ee78=_0x51fb3b[_0x8668('0x2a')]+_0x51fb3b['limit'],_0x1bc260;if(_0x55ee78>=_0x105356){_0x55ee78=_0x105356;_0x1bc260=0xc8;}else{_0x1bc260=0xce;}_0x5c5c14[_0x8668('0x27')](_0x1bc260);return _0x5c5c14[_0x8668('0x2b')](_0x8668('0x2c'),_0x43b8d1+'-'+_0x55ee78+'/'+_0x105356)[_0x8668('0x28')](_0x1f3035);}return null;};}function patchUpdates(_0x56ed97){return function(_0x213a58){try{jsonpatch[_0x8668('0x2d')](_0x213a58,_0x56ed97,!![]);}catch(_0x2d66c5){return BPromise['reject'](_0x2d66c5);}return _0x213a58[_0x8668('0x2e')]();};}function saveUpdates(_0x158833,_0x443245){return function(_0x3797e3){if(_0x3797e3){return _0x3797e3['update'](_0x158833)['then'](function(_0xe83805){return _0xe83805;});}return null;};}function removeEntity(_0x3e6498,_0x36e356){return function(_0x13c1da){if(_0x13c1da){return _0x13c1da['destroy']()[_0x8668('0x1c')](function(){_0x3e6498[_0x8668('0x27')](0xcc)[_0x8668('0x2f')]();});}};}function handleEntityNotFound(_0x59a9e0,_0x14c8f1){return function(_0x1adc35){if(!_0x1adc35){_0x59a9e0[_0x8668('0x26')](0x194);}return _0x1adc35;};}function handleError(_0x419a91,_0x509b11){_0x509b11=_0x509b11||0x1f4;return function(_0x31af14){logger['error'](_0x31af14[_0x8668('0x30')]);if(_0x31af14[_0x8668('0x31')]){delete _0x31af14['name'];}_0x419a91['status'](_0x509b11)[_0x8668('0x32')](_0x31af14);};}exports[_0x8668('0x33')]=function(_0x3be395,_0x5bd175){var _0x489fe9={},_0x24e902={},_0x48c14d={'count':0x0,'rows':[]};var _0x2e2c19=_[_0x8668('0x34')](db['DeskConfiguration'][_0x8668('0x35')],function(_0x59829e){return{'name':_0x59829e['fieldName'],'type':_0x59829e[_0x8668('0x36')]['key']};});_0x24e902[_0x8668('0x37')]=_[_0x8668('0x34')](_0x2e2c19,_0x8668('0x31'));_0x24e902[_0x8668('0x38')]=_[_0x8668('0x39')](_0x3be395[_0x8668('0x38')]);_0x24e902['filters']=_[_0x8668('0x3a')](_0x24e902[_0x8668('0x37')],_0x24e902[_0x8668('0x38')]);_0x489fe9[_0x8668('0x3b')]=_[_0x8668('0x3a')](_0x24e902[_0x8668('0x37')],qs[_0x8668('0x3c')](_0x3be395['query']['fields']));_0x489fe9[_0x8668('0x3b')]=_0x489fe9[_0x8668('0x3b')]['length']?_0x489fe9[_0x8668('0x3b')]:_0x24e902['model'];if(!_0x3be395[_0x8668('0x38')][_0x8668('0x3d')](_0x8668('0x3e'))){_0x489fe9['limit']=qs[_0x8668('0x3f')](_0x3be395[_0x8668('0x38')][_0x8668('0x3f')]);_0x489fe9['offset']=qs[_0x8668('0x2a')](_0x3be395[_0x8668('0x38')]['offset']);}_0x489fe9[_0x8668('0x40')]=qs[_0x8668('0x41')](_0x3be395[_0x8668('0x38')][_0x8668('0x41')]);_0x489fe9['where']=qs[_0x8668('0x42')](_[_0x8668('0x43')](_0x3be395[_0x8668('0x38')],_0x24e902[_0x8668('0x42')]),_0x2e2c19);if(_0x3be395[_0x8668('0x38')][_0x8668('0x44')]){_0x489fe9[_0x8668('0x45')]=_[_0x8668('0x46')](_0x489fe9['where'],{'$or':_[_0x8668('0x34')](_0x2e2c19,function(_0x3ae1eb){if(_0x3ae1eb['type']!==_0x8668('0x47')){var _0x27b91f={};_0x27b91f[_0x3ae1eb['name']]={'$like':'%'+_0x3be395[_0x8668('0x38')]['filter']+'%'};return _0x27b91f;}})});}_0x489fe9=_['merge']({},_0x489fe9,_0x3be395[_0x8668('0x48')]);var _0x56a3b9={'where':_0x489fe9[_0x8668('0x45')]};return db['DeskConfiguration']['count'](_0x56a3b9)[_0x8668('0x1c')](function(_0x184353){_0x48c14d['count']=_0x184353;if(_0x3be395[_0x8668('0x38')][_0x8668('0x49')]){_0x489fe9['include']=[{'all':!![]}];}return db[_0x8668('0x4a')][_0x8668('0x4b')](_0x489fe9);})['then'](function(_0x12c04b){_0x48c14d[_0x8668('0x4c')]=_0x12c04b;return _0x48c14d;})[_0x8668('0x1c')](respondWithFilteredResult(_0x5bd175,_0x489fe9))[_0x8668('0x25')](handleError(_0x5bd175,null));};exports[_0x8668('0x4d')]=function(_0x278f2e,_0xe4fecb){var _0x4e3680={'raw':![],'where':{'id':_0x278f2e[_0x8668('0x4e')]['id']}},_0x5138da={};_0x5138da[_0x8668('0x37')]=_[_0x8668('0x39')](db['DeskConfiguration'][_0x8668('0x35')]);_0x5138da[_0x8668('0x38')]=_[_0x8668('0x39')](_0x278f2e[_0x8668('0x38')]);_0x5138da[_0x8668('0x42')]=_[_0x8668('0x3a')](_0x5138da[_0x8668('0x37')],_0x5138da[_0x8668('0x38')]);_0x4e3680[_0x8668('0x3b')]=_['intersection'](_0x5138da['model'],qs[_0x8668('0x3c')](_0x278f2e[_0x8668('0x38')][_0x8668('0x3c')]));_0x4e3680['attributes']=_0x4e3680[_0x8668('0x3b')][_0x8668('0x4f')]?_0x4e3680[_0x8668('0x3b')]:_0x5138da[_0x8668('0x37')];if(_0x278f2e[_0x8668('0x38')][_0x8668('0x49')]){_0x4e3680[_0x8668('0x50')]=[{'all':!![]}];}_0x4e3680=_[_0x8668('0x46')]({},_0x4e3680,_0x278f2e['options']);return db[_0x8668('0x4a')][_0x8668('0x51')](_0x4e3680)['then'](handleEntityNotFound(_0xe4fecb,null))[_0x8668('0x1c')](respondWithResult(_0xe4fecb,null))[_0x8668('0x25')](handleError(_0xe4fecb,null));};exports[_0x8668('0x52')]=function(_0x2d8eb5,_0x5aa439){return db[_0x8668('0x4a')][_0x8668('0x52')](_0x2d8eb5[_0x8668('0x53')],{})[_0x8668('0x1c')](respondWithResult(_0x5aa439,0xc9))[_0x8668('0x25')](handleError(_0x5aa439,null));};exports[_0x8668('0x54')]=function(_0x1b19a6,_0x4d25a6){if(_0x1b19a6[_0x8668('0x53')]['id']){delete _0x1b19a6[_0x8668('0x53')]['id'];}return db[_0x8668('0x4a')][_0x8668('0x51')]({'where':{'id':_0x1b19a6[_0x8668('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d25a6,null))[_0x8668('0x1c')](saveUpdates(_0x1b19a6[_0x8668('0x53')],null))[_0x8668('0x1c')](respondWithResult(_0x4d25a6,null))[_0x8668('0x25')](handleError(_0x4d25a6,null));};exports[_0x8668('0x55')]=function(_0xb44544,_0x5077ed){return db[_0x8668('0x4a')][_0x8668('0x51')]({'where':{'id':_0xb44544['params']['id']}})['then'](handleEntityNotFound(_0x5077ed,null))[_0x8668('0x1c')](removeEntity(_0x5077ed,null))['catch'](handleError(_0x5077ed,null));};exports[_0x8668('0x56')]=function(_0x5aba00,_0x259830,_0x5dac22){var _0x180137={};var _0x9ca6e2={};var _0x1e63fc;var _0x1829ef;return db[_0x8668('0x4a')][_0x8668('0x57')]({'where':{'id':_0x5aba00['params']['id']}})[_0x8668('0x1c')](handleEntityNotFound(_0x259830,null))['then'](function(_0x45dc5f){if(_0x45dc5f){_0x1e63fc=_0x45dc5f;_0x9ca6e2['model']=_[_0x8668('0x39')](db['DeskField']['rawAttributes']);_0x9ca6e2[_0x8668('0x38')]=_[_0x8668('0x39')](_0x5aba00[_0x8668('0x38')]);_0x9ca6e2[_0x8668('0x42')]=_['intersection'](_0x9ca6e2[_0x8668('0x37')],_0x9ca6e2[_0x8668('0x38')]);_0x180137[_0x8668('0x3b')]=_[_0x8668('0x3a')](_0x9ca6e2[_0x8668('0x37')],qs[_0x8668('0x3c')](_0x5aba00[_0x8668('0x38')]['fields']));_0x180137[_0x8668('0x3b')]=_0x180137[_0x8668('0x3b')]['length']?_0x180137[_0x8668('0x3b')]:_0x9ca6e2[_0x8668('0x37')];_0x180137[_0x8668('0x40')]=qs[_0x8668('0x41')](_0x5aba00['query'][_0x8668('0x41')]);_0x180137['where']=qs[_0x8668('0x42')](_[_0x8668('0x43')](_0x5aba00[_0x8668('0x38')],_0x9ca6e2[_0x8668('0x42')]));if(_0x5aba00['query']['filter']){_0x180137[_0x8668('0x45')]=_[_0x8668('0x46')](_0x180137[_0x8668('0x45')],{'$or':_[_0x8668('0x34')](_0x180137[_0x8668('0x3b')],function(_0x9fe594){var _0x57d0cf={};_0x57d0cf[_0x9fe594]={'$like':'%'+_0x5aba00[_0x8668('0x38')][_0x8668('0x44')]+'%'};return _0x57d0cf;})});}_0x180137=_[_0x8668('0x46')]({},_0x180137,_0x5aba00[_0x8668('0x48')]);return _0x1e63fc['getFields'](_0x180137);}})[_0x8668('0x1c')](function(_0x1d19a1){if(_0x1d19a1){_0x1829ef=_0x1d19a1[_0x8668('0x4f')];if(!_0x5aba00[_0x8668('0x38')][_0x8668('0x3d')](_0x8668('0x3e'))){_0x180137[_0x8668('0x3f')]=qs['limit'](_0x5aba00[_0x8668('0x38')]['limit']);_0x180137[_0x8668('0x2a')]=qs[_0x8668('0x2a')](_0x5aba00['query'][_0x8668('0x2a')]);}return _0x1e63fc[_0x8668('0x56')](_0x180137);}})[_0x8668('0x1c')](function(_0x11d21d){if(_0x11d21d){return _0x11d21d?{'count':_0x1829ef,'rows':_0x11d21d}:null;}})['then'](respondWithResult(_0x259830,null))['catch'](handleError(_0x259830,null));};exports[_0x8668('0x58')]=function(_0x15969a,_0x18532a,_0x13d1f7){var _0x29cb6c={};var _0x544bb3={};var _0xc973dc;var _0xf03dc3;return db[_0x8668('0x4a')]['findOne']({'where':{'id':_0x15969a['params']['id']}})[_0x8668('0x1c')](handleEntityNotFound(_0x18532a,null))['then'](function(_0x396f95){if(_0x396f95){_0xc973dc=_0x396f95;_0x544bb3[_0x8668('0x37')]=_[_0x8668('0x39')](db['DeskField'][_0x8668('0x35')]);_0x544bb3[_0x8668('0x38')]=_[_0x8668('0x39')](_0x15969a[_0x8668('0x38')]);_0x544bb3[_0x8668('0x42')]=_[_0x8668('0x3a')](_0x544bb3[_0x8668('0x37')],_0x544bb3[_0x8668('0x38')]);_0x29cb6c[_0x8668('0x3b')]=_[_0x8668('0x3a')](_0x544bb3[_0x8668('0x37')],qs[_0x8668('0x3c')](_0x15969a[_0x8668('0x38')][_0x8668('0x3c')]));_0x29cb6c['attributes']=_0x29cb6c[_0x8668('0x3b')][_0x8668('0x4f')]?_0x29cb6c[_0x8668('0x3b')]:_0x544bb3[_0x8668('0x37')];_0x29cb6c['order']=qs['sort'](_0x15969a[_0x8668('0x38')][_0x8668('0x41')]);_0x29cb6c[_0x8668('0x45')]=qs[_0x8668('0x42')](_[_0x8668('0x43')](_0x15969a[_0x8668('0x38')],_0x544bb3[_0x8668('0x42')]));if(_0x15969a[_0x8668('0x38')]['filter']){_0x29cb6c[_0x8668('0x45')]=_[_0x8668('0x46')](_0x29cb6c['where'],{'$or':_[_0x8668('0x34')](_0x29cb6c[_0x8668('0x3b')],function(_0xf8412d){var _0x1486ff={};_0x1486ff[_0xf8412d]={'$like':'%'+_0x15969a[_0x8668('0x38')][_0x8668('0x44')]+'%'};return _0x1486ff;})});}_0x29cb6c=_['merge']({},_0x29cb6c,_0x15969a[_0x8668('0x48')]);return _0xc973dc[_0x8668('0x58')](_0x29cb6c);}})[_0x8668('0x1c')](function(_0x2c9852){if(_0x2c9852){_0xf03dc3=_0x2c9852['length'];if(!_0x15969a[_0x8668('0x38')]['hasOwnProperty'](_0x8668('0x3e'))){_0x29cb6c[_0x8668('0x3f')]=qs[_0x8668('0x3f')](_0x15969a[_0x8668('0x38')][_0x8668('0x3f')]);_0x29cb6c[_0x8668('0x2a')]=qs['offset'](_0x15969a[_0x8668('0x38')][_0x8668('0x2a')]);}return _0xc973dc['getSubjects'](_0x29cb6c);}})[_0x8668('0x1c')](function(_0x4c1f05){if(_0x4c1f05){return _0x4c1f05?{'count':_0xf03dc3,'rows':_0x4c1f05}:null;}})[_0x8668('0x1c')](respondWithResult(_0x18532a,null))[_0x8668('0x25')](handleError(_0x18532a,null));};exports[_0x8668('0x59')]=function(_0x58acd4,_0x646a5c,_0x5b37b5){var _0x30797a={};var _0x3adbc2={};var _0x2266e1;var _0x399871;return db['DeskConfiguration'][_0x8668('0x57')]({'where':{'id':_0x58acd4[_0x8668('0x4e')]['id']}})['then'](handleEntityNotFound(_0x646a5c,null))[_0x8668('0x1c')](function(_0x5d1965){if(_0x5d1965){_0x2266e1=_0x5d1965;_0x3adbc2[_0x8668('0x37')]=_[_0x8668('0x39')](db[_0x8668('0x5a')]['rawAttributes']);_0x3adbc2['query']=_[_0x8668('0x39')](_0x58acd4[_0x8668('0x38')]);_0x3adbc2['filters']=_['intersection'](_0x3adbc2['model'],_0x3adbc2['query']);_0x30797a[_0x8668('0x3b')]=_['intersection'](_0x3adbc2['model'],qs['fields'](_0x58acd4['query'][_0x8668('0x3c')]));_0x30797a[_0x8668('0x3b')]=_0x30797a[_0x8668('0x3b')][_0x8668('0x4f')]?_0x30797a[_0x8668('0x3b')]:_0x3adbc2['model'];_0x30797a[_0x8668('0x40')]=qs[_0x8668('0x41')](_0x58acd4[_0x8668('0x38')][_0x8668('0x41')]);_0x30797a[_0x8668('0x45')]=qs[_0x8668('0x42')](_['pick'](_0x58acd4[_0x8668('0x38')],_0x3adbc2['filters']));if(_0x58acd4[_0x8668('0x38')][_0x8668('0x44')]){_0x30797a[_0x8668('0x45')]=_[_0x8668('0x46')](_0x30797a['where'],{'$or':_[_0x8668('0x34')](_0x30797a[_0x8668('0x3b')],function(_0x438383){var _0x3511f6={};_0x3511f6[_0x438383]={'$like':'%'+_0x58acd4['query'][_0x8668('0x44')]+'%'};return _0x3511f6;})});}_0x30797a=_[_0x8668('0x46')]({},_0x30797a,_0x58acd4['options']);return _0x2266e1[_0x8668('0x59')](_0x30797a);}})[_0x8668('0x1c')](function(_0x1a8f9f){if(_0x1a8f9f){_0x399871=_0x1a8f9f[_0x8668('0x4f')];if(!_0x58acd4['query'][_0x8668('0x3d')](_0x8668('0x3e'))){_0x30797a[_0x8668('0x3f')]=qs[_0x8668('0x3f')](_0x58acd4[_0x8668('0x38')]['limit']);_0x30797a['offset']=qs[_0x8668('0x2a')](_0x58acd4[_0x8668('0x38')][_0x8668('0x2a')]);}return _0x2266e1[_0x8668('0x59')](_0x30797a);}})[_0x8668('0x1c')](function(_0x15566e){if(_0x15566e){return _0x15566e?{'count':_0x399871,'rows':_0x15566e}:null;}})[_0x8668('0x1c')](respondWithResult(_0x646a5c,null))[_0x8668('0x25')](handleError(_0x646a5c,null));};exports['getTags']=function(_0x409c75,_0x22e8c9,_0x52b3c8){var _0x13a066={};var _0xedbeee={};var _0x187c91;var _0x503139;return db[_0x8668('0x4a')]['findOne']({'where':{'id':_0x409c75[_0x8668('0x4e')]['id']}})[_0x8668('0x1c')](handleEntityNotFound(_0x22e8c9,null))[_0x8668('0x1c')](function(_0x17c47c){if(_0x17c47c){_0x187c91=_0x17c47c;_0xedbeee[_0x8668('0x37')]=_[_0x8668('0x39')](db[_0x8668('0x5b')][_0x8668('0x35')]);_0xedbeee[_0x8668('0x38')]=_[_0x8668('0x39')](_0x409c75['query']);_0xedbeee[_0x8668('0x42')]=_['intersection'](_0xedbeee['model'],_0xedbeee[_0x8668('0x38')]);_0x13a066[_0x8668('0x3b')]=_[_0x8668('0x3a')](_0xedbeee[_0x8668('0x37')],qs[_0x8668('0x3c')](_0x409c75[_0x8668('0x38')][_0x8668('0x3c')]));_0x13a066[_0x8668('0x3b')]=_0x13a066[_0x8668('0x3b')][_0x8668('0x4f')]?_0x13a066[_0x8668('0x3b')]:_0xedbeee[_0x8668('0x37')];_0x13a066[_0x8668('0x40')]=qs[_0x8668('0x41')](_0x409c75[_0x8668('0x38')]['sort']);_0x13a066[_0x8668('0x45')]=qs['filters'](_[_0x8668('0x43')](_0x409c75[_0x8668('0x38')],_0xedbeee['filters']));if(_0x409c75[_0x8668('0x38')][_0x8668('0x44')]){_0x13a066['where']=_['merge'](_0x13a066['where'],{'$or':_[_0x8668('0x34')](_0x13a066[_0x8668('0x3b')],function(_0x5cf846){var _0x2c993c={};_0x2c993c[_0x5cf846]={'$like':'%'+_0x409c75[_0x8668('0x38')]['filter']+'%'};return _0x2c993c;})});}_0x13a066=_[_0x8668('0x46')]({},_0x13a066,_0x409c75[_0x8668('0x48')]);return _0x187c91[_0x8668('0x5c')](_0x13a066);}})[_0x8668('0x1c')](function(_0x465cac){if(_0x465cac){_0x503139=_0x465cac[_0x8668('0x4f')];if(!_0x409c75['query'][_0x8668('0x3d')](_0x8668('0x3e'))){_0x13a066[_0x8668('0x3f')]=qs[_0x8668('0x3f')](_0x409c75[_0x8668('0x38')][_0x8668('0x3f')]);_0x13a066[_0x8668('0x2a')]=qs[_0x8668('0x2a')](_0x409c75[_0x8668('0x38')]['offset']);}return _0x187c91[_0x8668('0x5c')](_0x13a066);}})['then'](function(_0x14a77d){if(_0x14a77d){return _0x14a77d?{'count':_0x503139,'rows':_0x14a77d}:null;}})[_0x8668('0x1c')](respondWithResult(_0x22e8c9,null))[_0x8668('0x25')](handleError(_0x22e8c9,null));};exports[_0x8668('0x5d')]=function(_0x4a6a59,_0x228aa7,_0x14bc3d){if(_0x4a6a59[_0x8668('0x53')]['id']){delete _0x4a6a59[_0x8668('0x53')]['id'];}return db[_0x8668('0x4a')][_0x8668('0x57')]({'where':{'id':_0x4a6a59[_0x8668('0x4e')]['id']}})['then'](handleEntityNotFound(_0x228aa7,null))[_0x8668('0x1c')](function(_0x236422){if(_0x236422){return _0x236422[_0x8668('0x5d')](_0x4a6a59[_0x8668('0x53')]['ids']||[]);}return null;})[_0x8668('0x1c')](respondWithResult(_0x228aa7,null))[_0x8668('0x25')](handleError(_0x228aa7,null));}; \ No newline at end of file +var _0x0207=['info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','where','DeskConfiguration','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','params','getFields','DeskField','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then'];(function(_0x45e9d3,_0xa7eada){var _0x511220=function(_0x5c2c90){while(--_0x5c2c90){_0x45e9d3['push'](_0x45e9d3['shift']());}};_0x511220(++_0xa7eada);}(_0x0207,0x162));var _0x7020=function(_0x4fdc45,_0x2bd675){_0x4fdc45=_0x4fdc45-0x0;var _0x18230f=_0x0207[_0x4fdc45];return _0x18230f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7020('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7020('0x1'));var rp=require(_0x7020('0x2'));var moment=require(_0x7020('0x3'));var BPromise=require(_0x7020('0x4'));var Mustache=require(_0x7020('0x5'));var util=require(_0x7020('0x6'));var path=require(_0x7020('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7020('0x8'));var fs=require('fs');var _=require(_0x7020('0x9'));var squel=require(_0x7020('0xa'));var crypto=require(_0x7020('0xb'));var jsforce=require(_0x7020('0xc'));var deskjs=require(_0x7020('0xd'));var toCsv=require(_0x7020('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7020('0xf'));var authService=require(_0x7020('0x10'));var qs=require(_0x7020('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7020('0x12'));var logger=require(_0x7020('0x13'))('api');var utils=require(_0x7020('0x14'));var config=require(_0x7020('0x15'));var db=require(_0x7020('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7020('0x17')][_0x7020('0x18')]({'port':0x232a});function checkPasswordPattern(_0xd41aed,_0x1bedde,_0x3ae8f5){if(_0x3ae8f5){var _0x5e47f5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e47f5[_0x7020('0x19')](_0x1bedde)){return _0xd41aed;}else{throw new db['Sequelize'][(_0x7020('0x1a'))](_0x7020('0x1b'));}}else{return _0xd41aed;}}function respondWithRpcPromise(_0x12da12,_0x176190,_0x17260e,_0x308324){return new BPromise(function(_0x55c8b9,_0x36f895){var _0x5bcda5=_0x308324||client;return _0x5bcda5[_0x7020('0x1c')](_0x12da12,_0x17260e)[_0x7020('0x1d')](function(_0x1a3569){logger[_0x7020('0x1e')]('DeskConfiguration,\x20%s,\x20%s',_0x176190,_0x7020('0x1f'));logger[_0x7020('0x20')](_0x7020('0x21'),_0x176190,_0x7020('0x1f'),JSON[_0x7020('0x22')](_0x1a3569));if(_0x1a3569[_0x7020('0x23')]){if(_0x1a3569['error']['code']===0x1f4){logger[_0x7020('0x23')](_0x7020('0x24'),_0x176190,_0x1a3569[_0x7020('0x23')][_0x7020('0x25')]);return _0x36f895(_0x1a3569['error'][_0x7020('0x25')]);}logger[_0x7020('0x23')](_0x7020('0x24'),_0x176190,_0x1a3569[_0x7020('0x23')]['message']);return _0x55c8b9(_0x1a3569[_0x7020('0x23')][_0x7020('0x25')]);}else{logger[_0x7020('0x1e')](_0x7020('0x24'),_0x176190,_0x7020('0x1f'));_0x55c8b9(_0x1a3569[_0x7020('0x26')][_0x7020('0x25')]);}})[_0x7020('0x27')](function(_0x502923){logger[_0x7020('0x23')](_0x7020('0x24'),_0x176190,_0x502923);_0x36f895(_0x502923);});});}function respondWithStatusCode(_0x35b539,_0x5586f8){_0x5586f8=_0x5586f8||0xcc;return function(_0x28f9f0){if(_0x28f9f0){return _0x35b539['sendStatus'](_0x5586f8);}return _0x35b539['status'](_0x5586f8)['end']();};}function respondWithResult(_0x178cbd,_0x55957e){_0x55957e=_0x55957e||0xc8;return function(_0x46b379){if(_0x46b379){return _0x178cbd['status'](_0x55957e)[_0x7020('0x28')](_0x46b379);}};}function respondWithFilteredResult(_0x35103d,_0x32da40){return function(_0x2fd58e){if(_0x2fd58e){var _0xb03bd6=_0x2fd58e[_0x7020('0x29')],_0x1dff20=_0x32da40[_0x7020('0x2a')],_0x2ba734=_0x32da40[_0x7020('0x2a')]+_0x32da40[_0x7020('0x2b')],_0x15a1cc;if(_0x2ba734>=_0xb03bd6){_0x2ba734=_0xb03bd6;_0x15a1cc=0xc8;}else{_0x15a1cc=0xce;}_0x35103d[_0x7020('0x2c')](_0x15a1cc);return _0x35103d['set'](_0x7020('0x2d'),_0x1dff20+'-'+_0x2ba734+'/'+_0xb03bd6)[_0x7020('0x28')](_0x2fd58e);}return null;};}function patchUpdates(_0x351778){return function(_0x191eda){try{jsonpatch[_0x7020('0x2e')](_0x191eda,_0x351778,!![]);}catch(_0x3a4e3d){return BPromise[_0x7020('0x2f')](_0x3a4e3d);}return _0x191eda[_0x7020('0x30')]();};}function saveUpdates(_0x166b2d,_0x39a568){return function(_0x1646ed){if(_0x1646ed){return _0x1646ed[_0x7020('0x31')](_0x166b2d)[_0x7020('0x1d')](function(_0x1e45cd){return _0x1e45cd;});}return null;};}function removeEntity(_0x56b9b6,_0x451b57){return function(_0x978000){if(_0x978000){return _0x978000[_0x7020('0x32')]()[_0x7020('0x1d')](function(){_0x56b9b6[_0x7020('0x2c')](0xcc)[_0x7020('0x33')]();});}};}function handleEntityNotFound(_0x165c20,_0x37a6b5){return function(_0x11dc0e){if(!_0x11dc0e){_0x165c20[_0x7020('0x34')](0x194);}return _0x11dc0e;};}function handleError(_0x2bff37,_0x30191b){_0x30191b=_0x30191b||0x1f4;return function(_0x2294da){logger[_0x7020('0x23')](_0x2294da['stack']);if(_0x2294da[_0x7020('0x35')]){delete _0x2294da[_0x7020('0x35')];}_0x2bff37[_0x7020('0x2c')](_0x30191b)['send'](_0x2294da);};}exports[_0x7020('0x36')]=function(_0x1236ae,_0x3bf437){var _0x371b27={},_0x1f65a6={},_0x24160e={'count':0x0,'rows':[]};var _0x5ce36b=_[_0x7020('0x37')](db['DeskConfiguration']['rawAttributes'],function(_0x47a147){return{'name':_0x47a147[_0x7020('0x38')],'type':_0x47a147[_0x7020('0x39')][_0x7020('0x3a')]};});_0x1f65a6[_0x7020('0x3b')]=_[_0x7020('0x37')](_0x5ce36b,'name');_0x1f65a6['query']=_[_0x7020('0x3c')](_0x1236ae[_0x7020('0x3d')]);_0x1f65a6[_0x7020('0x3e')]=_[_0x7020('0x3f')](_0x1f65a6['model'],_0x1f65a6[_0x7020('0x3d')]);_0x371b27['attributes']=_[_0x7020('0x3f')](_0x1f65a6[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x1236ae['query']['fields']));_0x371b27[_0x7020('0x41')]=_0x371b27['attributes'][_0x7020('0x42')]?_0x371b27[_0x7020('0x41')]:_0x1f65a6['model'];if(!_0x1236ae[_0x7020('0x3d')][_0x7020('0x43')](_0x7020('0x44'))){_0x371b27['limit']=qs[_0x7020('0x2b')](_0x1236ae['query'][_0x7020('0x2b')]);_0x371b27[_0x7020('0x2a')]=qs[_0x7020('0x2a')](_0x1236ae['query'][_0x7020('0x2a')]);}_0x371b27[_0x7020('0x45')]=qs[_0x7020('0x46')](_0x1236ae[_0x7020('0x3d')][_0x7020('0x46')]);_0x371b27['where']=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x1236ae[_0x7020('0x3d')],_0x1f65a6[_0x7020('0x3e')]),_0x5ce36b);if(_0x1236ae['query'][_0x7020('0x48')]){_0x371b27['where']=_['merge'](_0x371b27['where'],{'$or':_[_0x7020('0x37')](_0x5ce36b,function(_0x569e94){if(_0x569e94[_0x7020('0x39')]!==_0x7020('0x49')){var _0x18037d={};_0x18037d[_0x569e94['name']]={'$like':'%'+_0x1236ae[_0x7020('0x3d')]['filter']+'%'};return _0x18037d;}})});}_0x371b27=_[_0x7020('0x4a')]({},_0x371b27,_0x1236ae[_0x7020('0x4b')]);var _0x19c9d4={'where':_0x371b27[_0x7020('0x4c')]};return db[_0x7020('0x4d')][_0x7020('0x29')](_0x19c9d4)[_0x7020('0x1d')](function(_0x364a84){_0x24160e[_0x7020('0x29')]=_0x364a84;if(_0x1236ae[_0x7020('0x3d')][_0x7020('0x4e')]){_0x371b27[_0x7020('0x4f')]=[{'all':!![]}];}return db[_0x7020('0x4d')][_0x7020('0x50')](_0x371b27);})[_0x7020('0x1d')](function(_0x241ff1){_0x24160e[_0x7020('0x51')]=_0x241ff1;return _0x24160e;})[_0x7020('0x1d')](respondWithFilteredResult(_0x3bf437,_0x371b27))['catch'](handleError(_0x3bf437,null));};exports[_0x7020('0x52')]=function(_0x1acda5,_0x1b8198){var _0x2a3344={'raw':![],'where':{'id':_0x1acda5['params']['id']}},_0x41f642={};_0x41f642['model']=_[_0x7020('0x3c')](db['DeskConfiguration'][_0x7020('0x53')]);_0x41f642[_0x7020('0x3d')]=_[_0x7020('0x3c')](_0x1acda5[_0x7020('0x3d')]);_0x41f642['filters']=_['intersection'](_0x41f642[_0x7020('0x3b')],_0x41f642[_0x7020('0x3d')]);_0x2a3344[_0x7020('0x41')]=_[_0x7020('0x3f')](_0x41f642[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x1acda5[_0x7020('0x3d')][_0x7020('0x40')]));_0x2a3344[_0x7020('0x41')]=_0x2a3344[_0x7020('0x41')][_0x7020('0x42')]?_0x2a3344[_0x7020('0x41')]:_0x41f642['model'];if(_0x1acda5['query']['includeAll']){_0x2a3344[_0x7020('0x4f')]=[{'all':!![]}];}_0x2a3344=_['merge']({},_0x2a3344,_0x1acda5[_0x7020('0x4b')]);return db[_0x7020('0x4d')][_0x7020('0x54')](_0x2a3344)[_0x7020('0x1d')](handleEntityNotFound(_0x1b8198,null))[_0x7020('0x1d')](respondWithResult(_0x1b8198,null))[_0x7020('0x27')](handleError(_0x1b8198,null));};exports[_0x7020('0x55')]=function(_0x5bf6b5,_0x1dc476){return db['DeskConfiguration'][_0x7020('0x55')](_0x5bf6b5[_0x7020('0x56')],{})[_0x7020('0x1d')](respondWithResult(_0x1dc476,0xc9))[_0x7020('0x27')](handleError(_0x1dc476,null));};exports[_0x7020('0x31')]=function(_0x381a95,_0x440f7e){if(_0x381a95['body']['id']){delete _0x381a95[_0x7020('0x56')]['id'];}return db[_0x7020('0x4d')][_0x7020('0x54')]({'where':{'id':_0x381a95[_0x7020('0x57')]['id']}})['then'](handleEntityNotFound(_0x440f7e,null))['then'](saveUpdates(_0x381a95['body'],null))[_0x7020('0x1d')](respondWithResult(_0x440f7e,null))[_0x7020('0x27')](handleError(_0x440f7e,null));};exports[_0x7020('0x32')]=function(_0x40b31c,_0x45ee73){return db[_0x7020('0x4d')]['find']({'where':{'id':_0x40b31c[_0x7020('0x57')]['id']}})[_0x7020('0x1d')](handleEntityNotFound(_0x45ee73,null))[_0x7020('0x1d')](removeEntity(_0x45ee73,null))[_0x7020('0x27')](handleError(_0x45ee73,null));};exports[_0x7020('0x58')]=function(_0x29732c,_0xe23a08,_0x1bdcc7){var _0x3644d5={};var _0x5b7a18={};var _0x265d18;var _0x54b65e;return db[_0x7020('0x4d')]['findOne']({'where':{'id':_0x29732c['params']['id']}})[_0x7020('0x1d')](handleEntityNotFound(_0xe23a08,null))[_0x7020('0x1d')](function(_0xf4a3e4){if(_0xf4a3e4){_0x265d18=_0xf4a3e4;_0x5b7a18['model']=_[_0x7020('0x3c')](db[_0x7020('0x59')][_0x7020('0x53')]);_0x5b7a18[_0x7020('0x3d')]=_[_0x7020('0x3c')](_0x29732c[_0x7020('0x3d')]);_0x5b7a18[_0x7020('0x3e')]=_[_0x7020('0x3f')](_0x5b7a18[_0x7020('0x3b')],_0x5b7a18['query']);_0x3644d5[_0x7020('0x41')]=_[_0x7020('0x3f')](_0x5b7a18[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x29732c[_0x7020('0x3d')]['fields']));_0x3644d5[_0x7020('0x41')]=_0x3644d5[_0x7020('0x41')]['length']?_0x3644d5[_0x7020('0x41')]:_0x5b7a18[_0x7020('0x3b')];_0x3644d5[_0x7020('0x45')]=qs['sort'](_0x29732c['query'][_0x7020('0x46')]);_0x3644d5[_0x7020('0x4c')]=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x29732c[_0x7020('0x3d')],_0x5b7a18[_0x7020('0x3e')]));if(_0x29732c[_0x7020('0x3d')][_0x7020('0x48')]){_0x3644d5[_0x7020('0x4c')]=_[_0x7020('0x4a')](_0x3644d5['where'],{'$or':_['map'](_0x3644d5['attributes'],function(_0xc54b44){var _0x26a7ae={};_0x26a7ae[_0xc54b44]={'$like':'%'+_0x29732c[_0x7020('0x3d')]['filter']+'%'};return _0x26a7ae;})});}_0x3644d5=_[_0x7020('0x4a')]({},_0x3644d5,_0x29732c[_0x7020('0x4b')]);return _0x265d18[_0x7020('0x58')](_0x3644d5);}})[_0x7020('0x1d')](function(_0x27d1b3){if(_0x27d1b3){_0x54b65e=_0x27d1b3[_0x7020('0x42')];if(!_0x29732c[_0x7020('0x3d')][_0x7020('0x43')](_0x7020('0x44'))){_0x3644d5['limit']=qs['limit'](_0x29732c[_0x7020('0x3d')]['limit']);_0x3644d5['offset']=qs[_0x7020('0x2a')](_0x29732c['query']['offset']);}return _0x265d18[_0x7020('0x58')](_0x3644d5);}})[_0x7020('0x1d')](function(_0x2672d2){if(_0x2672d2){return _0x2672d2?{'count':_0x54b65e,'rows':_0x2672d2}:null;}})[_0x7020('0x1d')](respondWithResult(_0xe23a08,null))[_0x7020('0x27')](handleError(_0xe23a08,null));};exports['getSubjects']=function(_0x47c9b5,_0x4eafc0,_0xe4241c){var _0x426c50={};var _0x122c37={};var _0x77d041;var _0x2f4aaf;return db['DeskConfiguration']['findOne']({'where':{'id':_0x47c9b5[_0x7020('0x57')]['id']}})['then'](handleEntityNotFound(_0x4eafc0,null))[_0x7020('0x1d')](function(_0x13c064){if(_0x13c064){_0x77d041=_0x13c064;_0x122c37[_0x7020('0x3b')]=_['keys'](db[_0x7020('0x59')]['rawAttributes']);_0x122c37[_0x7020('0x3d')]=_['keys'](_0x47c9b5['query']);_0x122c37[_0x7020('0x3e')]=_[_0x7020('0x3f')](_0x122c37[_0x7020('0x3b')],_0x122c37[_0x7020('0x3d')]);_0x426c50[_0x7020('0x41')]=_[_0x7020('0x3f')](_0x122c37[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x47c9b5[_0x7020('0x3d')]['fields']));_0x426c50['attributes']=_0x426c50[_0x7020('0x41')]['length']?_0x426c50[_0x7020('0x41')]:_0x122c37['model'];_0x426c50[_0x7020('0x45')]=qs[_0x7020('0x46')](_0x47c9b5[_0x7020('0x3d')][_0x7020('0x46')]);_0x426c50[_0x7020('0x4c')]=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x47c9b5[_0x7020('0x3d')],_0x122c37['filters']));if(_0x47c9b5[_0x7020('0x3d')][_0x7020('0x48')]){_0x426c50[_0x7020('0x4c')]=_[_0x7020('0x4a')](_0x426c50[_0x7020('0x4c')],{'$or':_[_0x7020('0x37')](_0x426c50['attributes'],function(_0x1f3176){var _0x2f5851={};_0x2f5851[_0x1f3176]={'$like':'%'+_0x47c9b5[_0x7020('0x3d')][_0x7020('0x48')]+'%'};return _0x2f5851;})});}_0x426c50=_[_0x7020('0x4a')]({},_0x426c50,_0x47c9b5['options']);return _0x77d041[_0x7020('0x5a')](_0x426c50);}})[_0x7020('0x1d')](function(_0x4488a6){if(_0x4488a6){_0x2f4aaf=_0x4488a6[_0x7020('0x42')];if(!_0x47c9b5['query'][_0x7020('0x43')](_0x7020('0x44'))){_0x426c50['limit']=qs[_0x7020('0x2b')](_0x47c9b5[_0x7020('0x3d')]['limit']);_0x426c50['offset']=qs['offset'](_0x47c9b5[_0x7020('0x3d')][_0x7020('0x2a')]);}return _0x77d041[_0x7020('0x5a')](_0x426c50);}})[_0x7020('0x1d')](function(_0x314d4d){if(_0x314d4d){return _0x314d4d?{'count':_0x2f4aaf,'rows':_0x314d4d}:null;}})[_0x7020('0x1d')](respondWithResult(_0x4eafc0,null))[_0x7020('0x27')](handleError(_0x4eafc0,null));};exports[_0x7020('0x5b')]=function(_0x2b0d0f,_0x4bc838,_0x4a9048){var _0x35ff2f={};var _0x46419b={};var _0x30df99;var _0x5e8ec4;return db[_0x7020('0x4d')][_0x7020('0x5c')]({'where':{'id':_0x2b0d0f['params']['id']}})['then'](handleEntityNotFound(_0x4bc838,null))['then'](function(_0x476547){if(_0x476547){_0x30df99=_0x476547;_0x46419b[_0x7020('0x3b')]=_['keys'](db['DeskField'][_0x7020('0x53')]);_0x46419b['query']=_[_0x7020('0x3c')](_0x2b0d0f['query']);_0x46419b['filters']=_[_0x7020('0x3f')](_0x46419b[_0x7020('0x3b')],_0x46419b[_0x7020('0x3d')]);_0x35ff2f[_0x7020('0x41')]=_[_0x7020('0x3f')](_0x46419b[_0x7020('0x3b')],qs['fields'](_0x2b0d0f[_0x7020('0x3d')]['fields']));_0x35ff2f[_0x7020('0x41')]=_0x35ff2f[_0x7020('0x41')][_0x7020('0x42')]?_0x35ff2f[_0x7020('0x41')]:_0x46419b[_0x7020('0x3b')];_0x35ff2f[_0x7020('0x45')]=qs[_0x7020('0x46')](_0x2b0d0f[_0x7020('0x3d')]['sort']);_0x35ff2f[_0x7020('0x4c')]=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x2b0d0f[_0x7020('0x3d')],_0x46419b[_0x7020('0x3e')]));if(_0x2b0d0f[_0x7020('0x3d')][_0x7020('0x48')]){_0x35ff2f[_0x7020('0x4c')]=_['merge'](_0x35ff2f['where'],{'$or':_[_0x7020('0x37')](_0x35ff2f[_0x7020('0x41')],function(_0x250541){var _0x2d9850={};_0x2d9850[_0x250541]={'$like':'%'+_0x2b0d0f[_0x7020('0x3d')]['filter']+'%'};return _0x2d9850;})});}_0x35ff2f=_[_0x7020('0x4a')]({},_0x35ff2f,_0x2b0d0f['options']);return _0x30df99['getDescriptions'](_0x35ff2f);}})[_0x7020('0x1d')](function(_0x4238c6){if(_0x4238c6){_0x5e8ec4=_0x4238c6['length'];if(!_0x2b0d0f[_0x7020('0x3d')][_0x7020('0x43')]('nolimit')){_0x35ff2f[_0x7020('0x2b')]=qs[_0x7020('0x2b')](_0x2b0d0f[_0x7020('0x3d')][_0x7020('0x2b')]);_0x35ff2f[_0x7020('0x2a')]=qs[_0x7020('0x2a')](_0x2b0d0f[_0x7020('0x3d')][_0x7020('0x2a')]);}return _0x30df99[_0x7020('0x5b')](_0x35ff2f);}})[_0x7020('0x1d')](function(_0x380038){if(_0x380038){return _0x380038?{'count':_0x5e8ec4,'rows':_0x380038}:null;}})[_0x7020('0x1d')](respondWithResult(_0x4bc838,null))[_0x7020('0x27')](handleError(_0x4bc838,null));};exports[_0x7020('0x5d')]=function(_0x26e00d,_0x1e22a5,_0x4e996b){var _0x1decb3={};var _0x155cd9={};var _0x26b2e8;var _0xf9be9f;return db[_0x7020('0x4d')][_0x7020('0x5c')]({'where':{'id':_0x26e00d[_0x7020('0x57')]['id']}})['then'](handleEntityNotFound(_0x1e22a5,null))['then'](function(_0x259ead){if(_0x259ead){_0x26b2e8=_0x259ead;_0x155cd9['model']=_[_0x7020('0x3c')](db[_0x7020('0x5e')][_0x7020('0x53')]);_0x155cd9[_0x7020('0x3d')]=_['keys'](_0x26e00d[_0x7020('0x3d')]);_0x155cd9[_0x7020('0x3e')]=_[_0x7020('0x3f')](_0x155cd9[_0x7020('0x3b')],_0x155cd9['query']);_0x1decb3['attributes']=_[_0x7020('0x3f')](_0x155cd9[_0x7020('0x3b')],qs[_0x7020('0x40')](_0x26e00d[_0x7020('0x3d')][_0x7020('0x40')]));_0x1decb3[_0x7020('0x41')]=_0x1decb3[_0x7020('0x41')]['length']?_0x1decb3['attributes']:_0x155cd9['model'];_0x1decb3[_0x7020('0x45')]=qs[_0x7020('0x46')](_0x26e00d[_0x7020('0x3d')][_0x7020('0x46')]);_0x1decb3['where']=qs[_0x7020('0x3e')](_[_0x7020('0x47')](_0x26e00d['query'],_0x155cd9[_0x7020('0x3e')]));if(_0x26e00d[_0x7020('0x3d')][_0x7020('0x48')]){_0x1decb3[_0x7020('0x4c')]=_[_0x7020('0x4a')](_0x1decb3['where'],{'$or':_[_0x7020('0x37')](_0x1decb3['attributes'],function(_0x238da4){var _0x1a553a={};_0x1a553a[_0x238da4]={'$like':'%'+_0x26e00d[_0x7020('0x3d')]['filter']+'%'};return _0x1a553a;})});}_0x1decb3=_[_0x7020('0x4a')]({},_0x1decb3,_0x26e00d[_0x7020('0x4b')]);return _0x26b2e8['getTags'](_0x1decb3);}})[_0x7020('0x1d')](function(_0x510738){if(_0x510738){_0xf9be9f=_0x510738[_0x7020('0x42')];if(!_0x26e00d[_0x7020('0x3d')][_0x7020('0x43')](_0x7020('0x44'))){_0x1decb3[_0x7020('0x2b')]=qs['limit'](_0x26e00d['query']['limit']);_0x1decb3[_0x7020('0x2a')]=qs['offset'](_0x26e00d[_0x7020('0x3d')][_0x7020('0x2a')]);}return _0x26b2e8[_0x7020('0x5d')](_0x1decb3);}})[_0x7020('0x1d')](function(_0x46f053){if(_0x46f053){return _0x46f053?{'count':_0xf9be9f,'rows':_0x46f053}:null;}})[_0x7020('0x1d')](respondWithResult(_0x1e22a5,null))[_0x7020('0x27')](handleError(_0x1e22a5,null));};exports[_0x7020('0x5f')]=function(_0x2507e8,_0x12e63c,_0x370460){if(_0x2507e8[_0x7020('0x56')]['id']){delete _0x2507e8[_0x7020('0x56')]['id'];}return db[_0x7020('0x4d')]['findOne']({'where':{'id':_0x2507e8[_0x7020('0x57')]['id']}})[_0x7020('0x1d')](handleEntityNotFound(_0x12e63c,null))[_0x7020('0x1d')](function(_0x4dd4f6){if(_0x4dd4f6){return _0x4dd4f6[_0x7020('0x5f')](_0x2507e8[_0x7020('0x56')]['ids']||[]);}return null;})['then'](respondWithResult(_0x12e63c,null))['catch'](handleError(_0x12e63c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e214025..8e5d0ed 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 _0x1aa6=['request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1aa6,0x14a));var _0x61aa=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x1aa6[_0x2df724];return _0x1b2504;};'use strict';var _=require(_0x61aa('0x0'));var util=require(_0x61aa('0x1'));var logger=require(_0x61aa('0x2'))(_0x61aa('0x3'));var moment=require(_0x61aa('0x4'));var BPromise=require(_0x61aa('0x5'));var rp=require(_0x61aa('0x6'));var fs=require('fs');var path=require(_0x61aa('0x7'));var rimraf=require('rimraf');var config=require(_0x61aa('0x8'));var attributes=require(_0x61aa('0x9'));module[_0x61aa('0xa')]=function(_0x442945,_0x4f1f19){return _0x442945[_0x61aa('0xb')](_0x61aa('0xc'),attributes,{'tableName':_0x61aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b55=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','DeskConfiguration','lodash'];(function(_0x3ebd14,_0x3f3e59){var _0x5b4757=function(_0x7e274d){while(--_0x7e274d){_0x3ebd14['push'](_0x3ebd14['shift']());}};_0x5b4757(++_0x3f3e59);}(_0x9b55,0x78));var _0x59b5=function(_0x2918c4,_0x110da0){_0x2918c4=_0x2918c4-0x0;var _0x38bfe7=_0x9b55[_0x2918c4];return _0x38bfe7;};'use strict';var _=require(_0x59b5('0x0'));var util=require(_0x59b5('0x1'));var logger=require(_0x59b5('0x2'))(_0x59b5('0x3'));var moment=require(_0x59b5('0x4'));var BPromise=require(_0x59b5('0x5'));var rp=require(_0x59b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59b5('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x59b5('0x8')]=function(_0x2467a3,_0x250a69){return _0x2467a3[_0x59b5('0x9')](_0x59b5('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 659baaa..8341f0c 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 _0x33a4=['rpc','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x1b8664,_0x316fc3){var _0x84cd00=function(_0x252f47){while(--_0x252f47){_0x1b8664['push'](_0x1b8664['shift']());}};_0x84cd00(++_0x316fc3);}(_0x33a4,0x88));var _0x433a=function(_0x4a080c,_0x4320c5){_0x4a080c=_0x4a080c-0x0;var _0x4d88c9=_0x33a4[_0x4a080c];return _0x4d88c9;};'use strict';var _=require('lodash');var util=require(_0x433a('0x0'));var moment=require('moment');var BPromise=require(_0x433a('0x1'));var rs=require(_0x433a('0x2'));var fs=require('fs');var Redis=require(_0x433a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x433a('0x4'));var config=require(_0x433a('0x5'));var jayson=require(_0x433a('0x6'));var client=jayson[_0x433a('0x7')][_0x433a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fcc88,_0x422eb9,_0x58e65c){return new BPromise(function(_0x2c2404,_0x3156ec){return client[_0x433a('0x9')](_0x4fcc88,_0x58e65c)[_0x433a('0xa')](function(_0x4c1057){logger['info'](_0x433a('0xb'),_0x422eb9,_0x433a('0xc'));logger[_0x433a('0xd')](_0x433a('0xe'),_0x422eb9,_0x433a('0xc'),JSON['stringify'](_0x4c1057));if(_0x4c1057['error']){if(_0x4c1057[_0x433a('0xf')][_0x433a('0x10')]===0x1f4){logger[_0x433a('0xf')](_0x433a('0xb'),_0x422eb9,_0x4c1057['error'][_0x433a('0x11')]);return _0x3156ec(_0x4c1057[_0x433a('0xf')]['message']);}logger[_0x433a('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x422eb9,_0x4c1057[_0x433a('0xf')][_0x433a('0x11')]);return _0x2c2404(_0x4c1057[_0x433a('0xf')]['message']);}else{logger['info'](_0x433a('0xb'),_0x422eb9,_0x433a('0xc'));_0x2c2404(_0x4c1057[_0x433a('0x12')][_0x433a('0x11')]);}})[_0x433a('0x13')](function(_0x4df77a){logger['error'](_0x433a('0xb'),_0x422eb9,_0x4df77a);_0x3156ec(_0x4df77a);});});} \ No newline at end of file +var _0x4e34=['error','code','message','DeskConfiguration,\x20%s,\x20%s','request\x20sent','catch','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4e34,0x19e));var _0x44e3=function(_0x5d900a,_0x54c3ed){_0x5d900a=_0x5d900a-0x0;var _0x3b5c14=_0x4e34[_0x5d900a];return _0x3b5c14;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x44e3('0x0'));var BPromise=require(_0x44e3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44e3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x44e3('0x3'))(_0x44e3('0x4'));var config=require(_0x44e3('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x44e3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x19e7de,_0x163879,_0x1ca56e){return new BPromise(function(_0x37b7d4,_0x196941){return client[_0x44e3('0x7')](_0x19e7de,_0x1ca56e)['then'](function(_0xf7e448){logger[_0x44e3('0x8')]('DeskConfiguration,\x20%s,\x20%s',_0x163879,'request\x20sent');logger[_0x44e3('0x9')](_0x44e3('0xa'),_0x163879,'request\x20sent',JSON['stringify'](_0xf7e448));if(_0xf7e448[_0x44e3('0xb')]){if(_0xf7e448[_0x44e3('0xb')][_0x44e3('0xc')]===0x1f4){logger[_0x44e3('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x163879,_0xf7e448[_0x44e3('0xb')][_0x44e3('0xd')]);return _0x196941(_0xf7e448[_0x44e3('0xb')][_0x44e3('0xd')]);}logger[_0x44e3('0xb')](_0x44e3('0xe'),_0x163879,_0xf7e448[_0x44e3('0xb')][_0x44e3('0xd')]);return _0x37b7d4(_0xf7e448['error'][_0x44e3('0xd')]);}else{logger['info'](_0x44e3('0xe'),_0x163879,_0x44e3('0xf'));_0x37b7d4(_0xf7e448['result'][_0x44e3('0xd')]);}})[_0x44e3('0x10')](function(_0x103eb0){logger[_0x44e3('0xb')](_0x44e3('0xe'),_0x163879,_0x103eb0);_0x196941(_0x103eb0);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3e4dd9e..34ece2a 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 _0x783a=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','post','create','update','destroy'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x783a,0xc0));var _0xa783=function(_0x3ed24e,_0x20a13b){_0x3ed24e=_0x3ed24e-0x0;var _0x2bbf0f=_0x783a[_0x3ed24e];return _0x2bbf0f;};'use strict';var multer=require(_0xa783('0x0'));var util=require(_0xa783('0x1'));var path=require(_0xa783('0x2'));var timeout=require(_0xa783('0x3'));var express=require('express');var router=express[_0xa783('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa783('0x5'));var config=require(_0xa783('0x6'));var controller=require(_0xa783('0x7'));router[_0xa783('0x8')]('/',auth[_0xa783('0x9')](),controller[_0xa783('0xa')]);router[_0xa783('0x8')](_0xa783('0xb'),auth[_0xa783('0x9')](),controller['show']);router[_0xa783('0xc')]('/',auth[_0xa783('0x9')](),controller[_0xa783('0xd')]);router['put']('/:id',auth[_0xa783('0x9')](),controller[_0xa783('0xe')]);router['delete'](_0xa783('0xb'),auth['isAuthenticated'](),controller[_0xa783('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4c97=['index','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x4abb5a,_0x500456){var _0x5572e6=function(_0x47f1d1){while(--_0x47f1d1){_0x4abb5a['push'](_0x4abb5a['shift']());}};_0x5572e6(++_0x500456);}(_0x4c97,0x14b));var _0x74c9=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4c97[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x74c9('0x0'));var util=require(_0x74c9('0x1'));var path=require('path');var timeout=require(_0x74c9('0x2'));var express=require(_0x74c9('0x3'));var router=express['Router']();var auth=require(_0x74c9('0x4'));var interaction=require(_0x74c9('0x5'));var config=require(_0x74c9('0x6'));var controller=require(_0x74c9('0x7'));router[_0x74c9('0x8')]('/',auth['isAuthenticated'](),controller[_0x74c9('0x9')]);router[_0x74c9('0x8')](_0x74c9('0xa'),auth[_0x74c9('0xb')](),controller[_0x74c9('0xc')]);router['post']('/',auth[_0x74c9('0xb')](),controller[_0x74c9('0xd')]);router[_0x74c9('0xe')]('/:id',auth[_0x74c9('0xb')](),controller['update']);router['delete'](_0x74c9('0xa'),auth['isAuthenticated'](),controller[_0x74c9('0xf')]);module[_0x74c9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 56ad924..6d9a271 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 _0xdc4d=['string','customVariable','STRING','sequelize','exports','ENUM'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdc4d,0x14d));var _0xddc4=function(_0x4987e9,_0x4bc691){_0x4987e9=_0x4987e9-0x0;var _0x4baa89=_0xdc4d[_0x4987e9];return _0x4baa89;};'use strict';var Sequelize=require(_0xddc4('0x0'));module[_0xddc4('0x1')]={'type':{'type':Sequelize[_0xddc4('0x2')](_0xddc4('0x3'),'variable',_0xddc4('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xddc4('0x5')]},'key':{'type':Sequelize[_0xddc4('0x5')]},'keyType':{'type':Sequelize[_0xddc4('0x2')](_0xddc4('0x3'),'variable',_0xddc4('0x4'))},'keyContent':{'type':Sequelize[_0xddc4('0x5')]},'idField':{'type':Sequelize[_0xddc4('0x5')]},'nameField':{'type':Sequelize[_0xddc4('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xddc4('0x5')]}}; \ No newline at end of file +var _0x4840=['ENUM','string','variable','customVariable','keyValue','STRING','exports'];(function(_0x2d502d,_0x14cf66){var _0x2d2c3f=function(_0x208d36){while(--_0x208d36){_0x2d502d['push'](_0x2d502d['shift']());}};_0x2d2c3f(++_0x14cf66);}(_0x4840,0x6f));var _0x0484=function(_0x45f575,_0x3ae51c){_0x45f575=_0x45f575-0x0;var _0xd8e1a1=_0x4840[_0x45f575];return _0xd8e1a1;};'use strict';var Sequelize=require('sequelize');module[_0x0484('0x0')]={'type':{'type':Sequelize[_0x0484('0x1')](_0x0484('0x2'),_0x0484('0x3'),_0x0484('0x4'),_0x0484('0x5')),'defaultValue':_0x0484('0x2')},'content':{'type':Sequelize[_0x0484('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0484('0x1')](_0x0484('0x2'),_0x0484('0x3'),_0x0484('0x4'))},'keyContent':{'type':Sequelize[_0x0484('0x6')]},'idField':{'type':Sequelize[_0x0484('0x6')]},'nameField':{'type':Sequelize[_0x0484('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0484('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index bf4f208..7c92333 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 _0x66a9=['destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','reject','save','update','then','error','stack','name','map','DeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body'];(function(_0x26e9da,_0x4ca5a7){var _0x45ed73=function(_0x4a1a5a){while(--_0x4a1a5a){_0x26e9da['push'](_0x26e9da['shift']());}};_0x45ed73(++_0x4ca5a7);}(_0x66a9,0x1b7));var _0x966a=function(_0x4ca1b8,_0x9faad5){_0x4ca1b8=_0x4ca1b8-0x0;var _0x49b9e4=_0x66a9[_0x4ca1b8];return _0x49b9e4;};'use strict';var pdf=require(_0x966a('0x0'));var emlformat=require(_0x966a('0x1'));var rimraf=require(_0x966a('0x2'));var zipdir=require(_0x966a('0x3'));var jsonpatch=require(_0x966a('0x4'));var rp=require(_0x966a('0x5'));var moment=require(_0x966a('0x6'));var BPromise=require(_0x966a('0x7'));var Mustache=require('mustache');var util=require(_0x966a('0x8'));var path=require('path');var sox=require(_0x966a('0x9'));var csv=require('to-csv');var ejs=require(_0x966a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x966a('0xb'));var crypto=require(_0x966a('0xc'));var jsforce=require(_0x966a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x966a('0xe'));var querystring=require(_0x966a('0xf'));var Papa=require(_0x966a('0x10'));var Redis=require(_0x966a('0x11'));var authService=require(_0x966a('0x12'));var qs=require(_0x966a('0x13'));var as=require(_0x966a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x966a('0x15'))(_0x966a('0x16'));var utils=require(_0x966a('0x17'));var config=require(_0x966a('0x18'));var db=require(_0x966a('0x19'))['db'];function respondWithStatusCode(_0x3873f0,_0x30e691){_0x30e691=_0x30e691||0xcc;return function(_0x3aba88){if(_0x3aba88){return _0x3873f0[_0x966a('0x1a')](_0x30e691);}return _0x3873f0[_0x966a('0x1b')](_0x30e691)[_0x966a('0x1c')]();};}function respondWithResult(_0x399172,_0x285c51){_0x285c51=_0x285c51||0xc8;return function(_0x249043){if(_0x249043){return _0x399172[_0x966a('0x1b')](_0x285c51)[_0x966a('0x1d')](_0x249043);}};}function respondWithFilteredResult(_0xe2e43f,_0x339556){return function(_0x5ac13a){if(_0x5ac13a){var _0x47c9da=_0x5ac13a[_0x966a('0x1e')],_0x43fba8=_0x339556['offset'],_0x15b9ea=_0x339556['offset']+_0x339556[_0x966a('0x1f')],_0x1be99d;if(_0x15b9ea>=_0x47c9da){_0x15b9ea=_0x47c9da;_0x1be99d=0xc8;}else{_0x1be99d=0xce;}_0xe2e43f['status'](_0x1be99d);return _0xe2e43f['set']('Content-Range',_0x43fba8+'-'+_0x15b9ea+'/'+_0x47c9da)[_0x966a('0x1d')](_0x5ac13a);}return null;};}function patchUpdates(_0x36a110){return function(_0x1c77ff){try{jsonpatch['apply'](_0x1c77ff,_0x36a110,!![]);}catch(_0x4756d0){return BPromise[_0x966a('0x20')](_0x4756d0);}return _0x1c77ff[_0x966a('0x21')]();};}function saveUpdates(_0x1043df,_0x2a3428){return function(_0x295e64){if(_0x295e64){return _0x295e64[_0x966a('0x22')](_0x1043df)['then'](function(_0x5eaf9d){return _0x5eaf9d;});}return null;};}function removeEntity(_0x54e569,_0x5e9cf9){return function(_0x26ab4d){if(_0x26ab4d){return _0x26ab4d['destroy']()[_0x966a('0x23')](function(){_0x54e569['status'](0xcc)[_0x966a('0x1c')]();});}};}function handleEntityNotFound(_0x578e40,_0x53afc7){return function(_0x5a1cae){if(!_0x5a1cae){_0x578e40[_0x966a('0x1a')](0x194);}return _0x5a1cae;};}function handleError(_0x1b03c6,_0x1936c5){_0x1936c5=_0x1936c5||0x1f4;return function(_0x5767f8){logger[_0x966a('0x24')](_0x5767f8[_0x966a('0x25')]);if(_0x5767f8[_0x966a('0x26')]){delete _0x5767f8[_0x966a('0x26')];}_0x1b03c6[_0x966a('0x1b')](_0x1936c5)['send'](_0x5767f8);};}exports['index']=function(_0x4f5e5e,_0x2c95c9){var _0x32c43c={},_0x593cec={},_0xaf567b={'count':0x0,'rows':[]};var _0x1fdd3a=_[_0x966a('0x27')](db[_0x966a('0x28')][_0x966a('0x29')],function(_0x33fab5){return{'name':_0x33fab5[_0x966a('0x2a')],'type':_0x33fab5[_0x966a('0x2b')]['key']};});_0x593cec[_0x966a('0x2c')]=_[_0x966a('0x27')](_0x1fdd3a,_0x966a('0x26'));_0x593cec[_0x966a('0x2d')]=_[_0x966a('0x2e')](_0x4f5e5e[_0x966a('0x2d')]);_0x593cec[_0x966a('0x2f')]=_[_0x966a('0x30')](_0x593cec[_0x966a('0x2c')],_0x593cec['query']);_0x32c43c[_0x966a('0x31')]=_[_0x966a('0x30')](_0x593cec[_0x966a('0x2c')],qs[_0x966a('0x32')](_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x32')]));_0x32c43c['attributes']=_0x32c43c[_0x966a('0x31')][_0x966a('0x33')]?_0x32c43c['attributes']:_0x593cec['model'];if(!_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x34')](_0x966a('0x35'))){_0x32c43c[_0x966a('0x1f')]=qs[_0x966a('0x1f')](_0x4f5e5e['query']['limit']);_0x32c43c[_0x966a('0x36')]=qs[_0x966a('0x36')](_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x36')]);}_0x32c43c[_0x966a('0x37')]=qs[_0x966a('0x38')](_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x38')]);_0x32c43c[_0x966a('0x39')]=qs['filters'](_[_0x966a('0x3a')](_0x4f5e5e[_0x966a('0x2d')],_0x593cec[_0x966a('0x2f')]),_0x1fdd3a);if(_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x3b')]){_0x32c43c[_0x966a('0x39')]=_['merge'](_0x32c43c[_0x966a('0x39')],{'$or':_[_0x966a('0x27')](_0x1fdd3a,function(_0x134bbb){if(_0x134bbb['type']!==_0x966a('0x3c')){var _0x35e993={};_0x35e993[_0x134bbb['name']]={'$like':'%'+_0x4f5e5e[_0x966a('0x2d')][_0x966a('0x3b')]+'%'};return _0x35e993;}})});}_0x32c43c=_[_0x966a('0x3d')]({},_0x32c43c,_0x4f5e5e[_0x966a('0x3e')]);var _0x210ced={'where':_0x32c43c[_0x966a('0x39')]};return db[_0x966a('0x28')][_0x966a('0x1e')](_0x210ced)['then'](function(_0x435bd6){_0xaf567b[_0x966a('0x1e')]=_0x435bd6;if(_0x4f5e5e[_0x966a('0x2d')]['includeAll']){_0x32c43c[_0x966a('0x3f')]=[{'all':!![]}];}return db['DeskField'][_0x966a('0x40')](_0x32c43c);})['then'](function(_0x3042eb){_0xaf567b['rows']=_0x3042eb;return _0xaf567b;})['then'](respondWithFilteredResult(_0x2c95c9,_0x32c43c))[_0x966a('0x41')](handleError(_0x2c95c9,null));};exports[_0x966a('0x42')]=function(_0x3329f0,_0x3cda8c){var _0x10f40a={'raw':!![],'where':{'id':_0x3329f0[_0x966a('0x43')]['id']}},_0x382d6e={};_0x382d6e[_0x966a('0x2c')]=_[_0x966a('0x2e')](db[_0x966a('0x28')][_0x966a('0x29')]);_0x382d6e[_0x966a('0x2d')]=_[_0x966a('0x2e')](_0x3329f0[_0x966a('0x2d')]);_0x382d6e['filters']=_[_0x966a('0x30')](_0x382d6e[_0x966a('0x2c')],_0x382d6e['query']);_0x10f40a[_0x966a('0x31')]=_[_0x966a('0x30')](_0x382d6e['model'],qs['fields'](_0x3329f0[_0x966a('0x2d')][_0x966a('0x32')]));_0x10f40a[_0x966a('0x31')]=_0x10f40a['attributes'][_0x966a('0x33')]?_0x10f40a[_0x966a('0x31')]:_0x382d6e['model'];if(_0x3329f0[_0x966a('0x2d')][_0x966a('0x44')]){_0x10f40a[_0x966a('0x3f')]=[{'all':!![]}];}_0x10f40a=_[_0x966a('0x3d')]({},_0x10f40a,_0x3329f0['options']);return db[_0x966a('0x28')][_0x966a('0x45')](_0x10f40a)['then'](handleEntityNotFound(_0x3cda8c,null))['then'](respondWithResult(_0x3cda8c,null))[_0x966a('0x41')](handleError(_0x3cda8c,null));};exports[_0x966a('0x46')]=function(_0xc6122f,_0x181d31){return db[_0x966a('0x28')]['create'](_0xc6122f[_0x966a('0x47')],{})['then'](respondWithResult(_0x181d31,0xc9))[_0x966a('0x41')](handleError(_0x181d31,null));};exports['update']=function(_0x2a247e,_0x17ba73){if(_0x2a247e['body']['id']){delete _0x2a247e[_0x966a('0x47')]['id'];}return db[_0x966a('0x28')][_0x966a('0x45')]({'where':{'id':_0x2a247e[_0x966a('0x43')]['id']}})['then'](handleEntityNotFound(_0x17ba73,null))['then'](saveUpdates(_0x2a247e[_0x966a('0x47')],null))[_0x966a('0x23')](respondWithResult(_0x17ba73,null))[_0x966a('0x41')](handleError(_0x17ba73,null));};exports[_0x966a('0x48')]=function(_0x350a89,_0x19dd2f){return db[_0x966a('0x28')]['find']({'where':{'id':_0x350a89[_0x966a('0x43')]['id']}})[_0x966a('0x23')](handleEntityNotFound(_0x19dd2f,null))[_0x966a('0x23')](removeEntity(_0x19dd2f,null))[_0x966a('0x41')](handleError(_0x19dd2f,null));}; \ No newline at end of file +var _0x6469=['../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','DeskField','fieldName','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','params','rawAttributes','keys','include','find','catch','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x46a8e,_0x493b90){var _0xeb06e1=function(_0x482636){while(--_0x482636){_0x46a8e['push'](_0x46a8e['shift']());}};_0xeb06e1(++_0x493b90);}(_0x6469,0x7f));var _0x9646=function(_0x2a9ecf,_0x465b06){_0x2a9ecf=_0x2a9ecf-0x0;var _0x853928=_0x6469[_0x2a9ecf];return _0x853928;};'use strict';var pdf=require(_0x9646('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9646('0x1'));var jsonpatch=require(_0x9646('0x2'));var rp=require(_0x9646('0x3'));var moment=require(_0x9646('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9646('0x5'));var util=require('util');var path=require(_0x9646('0x6'));var sox=require(_0x9646('0x7'));var csv=require(_0x9646('0x8'));var ejs=require(_0x9646('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9646('0xa'));var crypto=require(_0x9646('0xb'));var jsforce=require(_0x9646('0xc'));var deskjs=require(_0x9646('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9646('0xe'));var Papa=require(_0x9646('0xf'));var Redis=require(_0x9646('0x10'));var authService=require(_0x9646('0x11'));var qs=require(_0x9646('0x12'));var as=require(_0x9646('0x13'));var hardwareService=require(_0x9646('0x14'));var logger=require(_0x9646('0x15'))('api');var utils=require(_0x9646('0x16'));var config=require(_0x9646('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x220811,_0x54fe97){_0x54fe97=_0x54fe97||0xcc;return function(_0x3059ae){if(_0x3059ae){return _0x220811[_0x9646('0x18')](_0x54fe97);}return _0x220811[_0x9646('0x19')](_0x54fe97)[_0x9646('0x1a')]();};}function respondWithResult(_0x26cf2f,_0xb9b7e4){_0xb9b7e4=_0xb9b7e4||0xc8;return function(_0x33ad0c){if(_0x33ad0c){return _0x26cf2f[_0x9646('0x19')](_0xb9b7e4)[_0x9646('0x1b')](_0x33ad0c);}};}function respondWithFilteredResult(_0x2ba92f,_0x3520ce){return function(_0x44dbc6){if(_0x44dbc6){var _0x259e55=_0x44dbc6[_0x9646('0x1c')],_0x5d2e20=_0x3520ce[_0x9646('0x1d')],_0x5db985=_0x3520ce[_0x9646('0x1d')]+_0x3520ce[_0x9646('0x1e')],_0x233311;if(_0x5db985>=_0x259e55){_0x5db985=_0x259e55;_0x233311=0xc8;}else{_0x233311=0xce;}_0x2ba92f[_0x9646('0x19')](_0x233311);return _0x2ba92f[_0x9646('0x1f')](_0x9646('0x20'),_0x5d2e20+'-'+_0x5db985+'/'+_0x259e55)[_0x9646('0x1b')](_0x44dbc6);}return null;};}function patchUpdates(_0x5d8b64){return function(_0x28bb72){try{jsonpatch[_0x9646('0x21')](_0x28bb72,_0x5d8b64,!![]);}catch(_0x3a3691){return BPromise[_0x9646('0x22')](_0x3a3691);}return _0x28bb72[_0x9646('0x23')]();};}function saveUpdates(_0x21d6e0,_0x1c18d5){return function(_0x1cf92d){if(_0x1cf92d){return _0x1cf92d[_0x9646('0x24')](_0x21d6e0)[_0x9646('0x25')](function(_0x1d3dad){return _0x1d3dad;});}return null;};}function removeEntity(_0x3fd37e,_0x2d78d0){return function(_0x2c801a){if(_0x2c801a){return _0x2c801a[_0x9646('0x26')]()['then'](function(){_0x3fd37e[_0x9646('0x19')](0xcc)[_0x9646('0x1a')]();});}};}function handleEntityNotFound(_0x32a21a,_0x794d9e){return function(_0x3f824d){if(!_0x3f824d){_0x32a21a[_0x9646('0x18')](0x194);}return _0x3f824d;};}function handleError(_0x648348,_0x708f71){_0x708f71=_0x708f71||0x1f4;return function(_0x5e0f51){logger[_0x9646('0x27')](_0x5e0f51[_0x9646('0x28')]);if(_0x5e0f51[_0x9646('0x29')]){delete _0x5e0f51[_0x9646('0x29')];}_0x648348[_0x9646('0x19')](_0x708f71)[_0x9646('0x2a')](_0x5e0f51);};}exports['index']=function(_0x4f55bf,_0x534d3b){var _0x46d3a7={},_0x30bd60={},_0x1918ec={'count':0x0,'rows':[]};var _0x2ac99a=_[_0x9646('0x2b')](db[_0x9646('0x2c')]['rawAttributes'],function(_0x5906c2){return{'name':_0x5906c2[_0x9646('0x2d')],'type':_0x5906c2['type'][_0x9646('0x2e')]};});_0x30bd60['model']=_[_0x9646('0x2b')](_0x2ac99a,_0x9646('0x29'));_0x30bd60['query']=_['keys'](_0x4f55bf[_0x9646('0x2f')]);_0x30bd60[_0x9646('0x30')]=_['intersection'](_0x30bd60[_0x9646('0x31')],_0x30bd60['query']);_0x46d3a7['attributes']=_[_0x9646('0x32')](_0x30bd60['model'],qs[_0x9646('0x33')](_0x4f55bf[_0x9646('0x2f')][_0x9646('0x33')]));_0x46d3a7[_0x9646('0x34')]=_0x46d3a7[_0x9646('0x34')][_0x9646('0x35')]?_0x46d3a7[_0x9646('0x34')]:_0x30bd60[_0x9646('0x31')];if(!_0x4f55bf[_0x9646('0x2f')][_0x9646('0x36')](_0x9646('0x37'))){_0x46d3a7[_0x9646('0x1e')]=qs[_0x9646('0x1e')](_0x4f55bf[_0x9646('0x2f')][_0x9646('0x1e')]);_0x46d3a7['offset']=qs[_0x9646('0x1d')](_0x4f55bf['query'][_0x9646('0x1d')]);}_0x46d3a7['order']=qs[_0x9646('0x38')](_0x4f55bf[_0x9646('0x2f')]['sort']);_0x46d3a7[_0x9646('0x39')]=qs[_0x9646('0x30')](_[_0x9646('0x3a')](_0x4f55bf[_0x9646('0x2f')],_0x30bd60[_0x9646('0x30')]),_0x2ac99a);if(_0x4f55bf['query'][_0x9646('0x3b')]){_0x46d3a7[_0x9646('0x39')]=_[_0x9646('0x3c')](_0x46d3a7['where'],{'$or':_[_0x9646('0x2b')](_0x2ac99a,function(_0xfb6b94){if(_0xfb6b94[_0x9646('0x3d')]!=='VIRTUAL'){var _0x1f1185={};_0x1f1185[_0xfb6b94[_0x9646('0x29')]]={'$like':'%'+_0x4f55bf[_0x9646('0x2f')]['filter']+'%'};return _0x1f1185;}})});}_0x46d3a7=_[_0x9646('0x3c')]({},_0x46d3a7,_0x4f55bf[_0x9646('0x3e')]);var _0x2cd33e={'where':_0x46d3a7[_0x9646('0x39')]};return db[_0x9646('0x2c')][_0x9646('0x1c')](_0x2cd33e)[_0x9646('0x25')](function(_0x13026e){_0x1918ec[_0x9646('0x1c')]=_0x13026e;if(_0x4f55bf['query'][_0x9646('0x3f')]){_0x46d3a7['include']=[{'all':!![]}];}return db[_0x9646('0x2c')][_0x9646('0x40')](_0x46d3a7);})[_0x9646('0x25')](function(_0x1cbce4){_0x1918ec[_0x9646('0x41')]=_0x1cbce4;return _0x1918ec;})[_0x9646('0x25')](respondWithFilteredResult(_0x534d3b,_0x46d3a7))['catch'](handleError(_0x534d3b,null));};exports['show']=function(_0x5dd406,_0x770bdf){var _0x42e878={'raw':!![],'where':{'id':_0x5dd406[_0x9646('0x42')]['id']}},_0x1f17af={};_0x1f17af[_0x9646('0x31')]=_['keys'](db[_0x9646('0x2c')][_0x9646('0x43')]);_0x1f17af[_0x9646('0x2f')]=_[_0x9646('0x44')](_0x5dd406[_0x9646('0x2f')]);_0x1f17af[_0x9646('0x30')]=_[_0x9646('0x32')](_0x1f17af[_0x9646('0x31')],_0x1f17af[_0x9646('0x2f')]);_0x42e878[_0x9646('0x34')]=_[_0x9646('0x32')](_0x1f17af[_0x9646('0x31')],qs[_0x9646('0x33')](_0x5dd406[_0x9646('0x2f')][_0x9646('0x33')]));_0x42e878['attributes']=_0x42e878['attributes'][_0x9646('0x35')]?_0x42e878[_0x9646('0x34')]:_0x1f17af[_0x9646('0x31')];if(_0x5dd406[_0x9646('0x2f')][_0x9646('0x3f')]){_0x42e878[_0x9646('0x45')]=[{'all':!![]}];}_0x42e878=_[_0x9646('0x3c')]({},_0x42e878,_0x5dd406[_0x9646('0x3e')]);return db['DeskField'][_0x9646('0x46')](_0x42e878)['then'](handleEntityNotFound(_0x770bdf,null))[_0x9646('0x25')](respondWithResult(_0x770bdf,null))[_0x9646('0x47')](handleError(_0x770bdf,null));};exports['create']=function(_0x32678a,_0x12d412){return db['DeskField'][_0x9646('0x48')](_0x32678a['body'],{})[_0x9646('0x25')](respondWithResult(_0x12d412,0xc9))['catch'](handleError(_0x12d412,null));};exports[_0x9646('0x24')]=function(_0x5a3797,_0x96c1d5){if(_0x5a3797[_0x9646('0x49')]['id']){delete _0x5a3797['body']['id'];}return db[_0x9646('0x2c')][_0x9646('0x46')]({'where':{'id':_0x5a3797[_0x9646('0x42')]['id']}})['then'](handleEntityNotFound(_0x96c1d5,null))[_0x9646('0x25')](saveUpdates(_0x5a3797[_0x9646('0x49')],null))['then'](respondWithResult(_0x96c1d5,null))[_0x9646('0x47')](handleError(_0x96c1d5,null));};exports[_0x9646('0x26')]=function(_0x39221d,_0x1f1300){return db[_0x9646('0x2c')][_0x9646('0x46')]({'where':{'id':_0x39221d['params']['id']}})[_0x9646('0x25')](handleEntityNotFound(_0x1f1300,null))[_0x9646('0x25')](removeEntity(_0x1f1300,null))[_0x9646('0x47')](handleError(_0x1f1300,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3a03aab..9fd389a 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 _0x1e53=['int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','DeskField'];(function(_0x1cd5fe,_0x94ba03){var _0x57b44f=function(_0x3f4ea5){while(--_0x3f4ea5){_0x1cd5fe['push'](_0x1cd5fe['shift']());}};_0x57b44f(++_0x94ba03);}(_0x1e53,0x199));var _0x31e5=function(_0x45e18e,_0x47cc4d){_0x45e18e=_0x45e18e-0x0;var _0x175e61=_0x1e53[_0x45e18e];return _0x175e61;};'use strict';var _=require(_0x31e5('0x0'));var util=require(_0x31e5('0x1'));var logger=require(_0x31e5('0x2'))(_0x31e5('0x3'));var moment=require(_0x31e5('0x4'));var BPromise=require('bluebird');var rp=require(_0x31e5('0x5'));var fs=require('fs');var path=require(_0x31e5('0x6'));var rimraf=require(_0x31e5('0x7'));var config=require(_0x31e5('0x8'));var attributes=require('./intDeskField.attributes');module[_0x31e5('0x9')]=function(_0x2bae49,_0x2a081d){return _0x2bae49['define'](_0x31e5('0xa'),attributes,{'tableName':_0x31e5('0xb'),'paranoid':![],'indexes':[{'name':_0x31e5('0xc'),'fields':['idField',_0x31e5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9fa4=['bluebird','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','lodash','util','../../config/logger','moment'];(function(_0x56f6f6,_0x15c619){var _0x21c082=function(_0x26637f){while(--_0x26637f){_0x56f6f6['push'](_0x56f6f6['shift']());}};_0x21c082(++_0x15c619);}(_0x9fa4,0x1ac));var _0x49fa=function(_0xf58b88,_0x4219dc){_0xf58b88=_0xf58b88-0x0;var _0x544e6d=_0x9fa4[_0xf58b88];return _0x544e6d;};'use strict';var _=require(_0x49fa('0x0'));var util=require(_0x49fa('0x1'));var logger=require(_0x49fa('0x2'))('api');var moment=require(_0x49fa('0x3'));var BPromise=require(_0x49fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49fa('0x5'));var rimraf=require(_0x49fa('0x6'));var config=require('../../config/environment');var attributes=require(_0x49fa('0x7'));module[_0x49fa('0x8')]=function(_0x3d669f,_0x2f95d9){return _0x3d669f[_0x49fa('0x9')](_0x49fa('0xa'),attributes,{'tableName':_0x49fa('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','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 abe9b37..c833ce4 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 _0x160a=['rpc','jayson/promise','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','DeskField,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x160a,0x116));var _0xa160=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x160a[_0x557fd2];return _0x1b54a2;};'use strict';var _=require(_0xa160('0x0'));var util=require(_0xa160('0x1'));var moment=require(_0xa160('0x2'));var BPromise=require(_0xa160('0x3'));var rs=require(_0xa160('0x4'));var fs=require('fs');var Redis=require(_0xa160('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa160('0x6'))(_0xa160('0x7'));var config=require('../../config/environment');var jayson=require(_0xa160('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d6893,_0x5efda2,_0x35096b){return new BPromise(function(_0x2f2dd7,_0x362c1c){return client['request'](_0x2d6893,_0x35096b)[_0xa160('0x9')](function(_0x3fc9d0){logger[_0xa160('0xa')]('DeskField,\x20%s,\x20%s',_0x5efda2,_0xa160('0xb'));logger[_0xa160('0xc')](_0xa160('0xd'),_0x5efda2,'request\x20sent',JSON['stringify'](_0x3fc9d0));if(_0x3fc9d0[_0xa160('0xe')]){if(_0x3fc9d0['error'][_0xa160('0xf')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x5efda2,_0x3fc9d0['error']['message']);return _0x362c1c(_0x3fc9d0['error'][_0xa160('0x10')]);}logger[_0xa160('0xe')](_0xa160('0x11'),_0x5efda2,_0x3fc9d0[_0xa160('0xe')][_0xa160('0x10')]);return _0x2f2dd7(_0x3fc9d0[_0xa160('0xe')][_0xa160('0x10')]);}else{logger[_0xa160('0xa')](_0xa160('0x11'),_0x5efda2,_0xa160('0xb'));_0x2f2dd7(_0x3fc9d0[_0xa160('0x12')][_0xa160('0x10')]);}})['catch'](function(_0x27a012){logger[_0xa160('0xe')](_0xa160('0x11'),_0x5efda2,_0x27a012);_0x362c1c(_0x27a012);});});} \ No newline at end of file +var _0xd886=['debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x35597c,_0x166c9f){var _0x5e9c3e=function(_0x31562c){while(--_0x31562c){_0x35597c['push'](_0x35597c['shift']());}};_0x5e9c3e(++_0x166c9f);}(_0xd886,0x1bd));var _0x6d88=function(_0x576532,_0x151467){_0x576532=_0x576532-0x0;var _0x1678e4=_0xd886[_0x576532];return _0x1678e4;};'use strict';var _=require(_0x6d88('0x0'));var util=require(_0x6d88('0x1'));var moment=require(_0x6d88('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d88('0x3'));var db=require(_0x6d88('0x4'))['db'];var utils=require(_0x6d88('0x5'));var logger=require('../../config/logger')(_0x6d88('0x6'));var config=require(_0x6d88('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16988c,_0x3c8388,_0x294c88){return new BPromise(function(_0x24071c,_0x57ffaa){return client[_0x6d88('0x8')](_0x16988c,_0x294c88)['then'](function(_0x1b54e9){logger['info'](_0x6d88('0x9'),_0x3c8388,_0x6d88('0xa'));logger[_0x6d88('0xb')](_0x6d88('0xc'),_0x3c8388,_0x6d88('0xa'),JSON[_0x6d88('0xd')](_0x1b54e9));if(_0x1b54e9[_0x6d88('0xe')]){if(_0x1b54e9[_0x6d88('0xe')][_0x6d88('0xf')]===0x1f4){logger[_0x6d88('0xe')](_0x6d88('0x9'),_0x3c8388,_0x1b54e9[_0x6d88('0xe')][_0x6d88('0x10')]);return _0x57ffaa(_0x1b54e9[_0x6d88('0xe')][_0x6d88('0x10')]);}logger['error'](_0x6d88('0x9'),_0x3c8388,_0x1b54e9['error'][_0x6d88('0x10')]);return _0x24071c(_0x1b54e9[_0x6d88('0xe')][_0x6d88('0x10')]);}else{logger[_0x6d88('0x11')]('DeskField,\x20%s,\x20%s',_0x3c8388,_0x6d88('0xa'));_0x24071c(_0x1b54e9['result'][_0x6d88('0x10')]);}})[_0x6d88('0x12')](function(_0xbd535a){logger[_0x6d88('0xe')](_0x6d88('0x9'),_0x3c8388,_0xbd535a);_0x57ffaa(_0xbd535a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ae4cbb6..8414a8d 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 _0xef2b=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x58f8d6,_0x3de6e9){var _0x249399=function(_0x5a2d88){while(--_0x5a2d88){_0x58f8d6['push'](_0x58f8d6['shift']());}};_0x249399(++_0x3de6e9);}(_0xef2b,0x13a));var _0xbef2=function(_0x126f3b,_0x4b76ec){_0x126f3b=_0x126f3b-0x0;var _0x5d83b8=_0xef2b[_0x126f3b];return _0x5d83b8;};'use strict';var multer=require(_0xbef2('0x0'));var util=require(_0xbef2('0x1'));var path=require(_0xbef2('0x2'));var timeout=require('connect-timeout');var express=require(_0xbef2('0x3'));var router=express[_0xbef2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbef2('0x5'));var config=require(_0xbef2('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xbef2('0x7')]('/',auth[_0xbef2('0x8')](),controller[_0xbef2('0x9')]);router[_0xbef2('0x7')](_0xbef2('0xa'),auth[_0xbef2('0x8')](),controller['show']);router[_0xbef2('0x7')](_0xbef2('0xb'),auth['isAuthenticated'](),controller[_0xbef2('0xc')]);router[_0xbef2('0x7')](_0xbef2('0xd'),auth['isAuthenticated'](),controller[_0xbef2('0xe')]);router[_0xbef2('0xf')]('/',auth['isAuthenticated'](),controller[_0xbef2('0x10')]);router['post'](_0xbef2('0xb'),auth['isAuthenticated'](),controller[_0xbef2('0x11')]);router[_0xbef2('0x12')](_0xbef2('0xa'),auth['isAuthenticated'](),controller[_0xbef2('0x13')]);router[_0xbef2('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xbef2('0x15')]);module[_0xbef2('0x16')]=router; \ No newline at end of file +var _0xe7eb=['index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe7eb,0x8b));var _0xbe7e=function(_0x506a9c,_0x3b1539){_0x506a9c=_0x506a9c-0x0;var _0x2b7829=_0xe7eb[_0x506a9c];return _0x2b7829;};'use strict';var multer=require(_0xbe7e('0x0'));var util=require(_0xbe7e('0x1'));var path=require(_0xbe7e('0x2'));var timeout=require(_0xbe7e('0x3'));var express=require('express');var router=express[_0xbe7e('0x4')]();var auth=require(_0xbe7e('0x5'));var interaction=require(_0xbe7e('0x6'));var config=require(_0xbe7e('0x7'));var controller=require(_0xbe7e('0x8'));router[_0xbe7e('0x9')]('/',auth[_0xbe7e('0xa')](),controller[_0xbe7e('0xb')]);router[_0xbe7e('0x9')](_0xbe7e('0xc'),auth[_0xbe7e('0xa')](),controller[_0xbe7e('0xd')]);router[_0xbe7e('0x9')](_0xbe7e('0xe'),auth[_0xbe7e('0xa')](),controller['getConfigurations']);router[_0xbe7e('0x9')](_0xbe7e('0xf'),auth[_0xbe7e('0xa')](),controller[_0xbe7e('0x10')]);router[_0xbe7e('0x11')]('/',auth[_0xbe7e('0xa')](),controller[_0xbe7e('0x12')]);router[_0xbe7e('0x11')](_0xbe7e('0xe'),auth[_0xbe7e('0xa')](),controller[_0xbe7e('0x13')]);router[_0xbe7e('0x14')](_0xbe7e('0xc'),auth['isAuthenticated'](),controller[_0xbe7e('0x15')]);router[_0xbe7e('0x16')](_0xbe7e('0xc'),auth['isAuthenticated'](),controller[_0xbe7e('0x17')]);module[_0xbe7e('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 d867a4d..96e9d01 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 _0x5dcd=['sequelize','exports','STRING'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x5dcd,0x1bc));var _0xd5dc=function(_0x2a9633,_0x3fbfa8){_0x2a9633=_0x2a9633-0x0;var _0x56a4ee=_0x5dcd[_0x2a9633];return _0x56a4ee;};'use strict';var Sequelize=require(_0xd5dc('0x0'));module[_0xd5dc('0x1')]={'name':{'type':Sequelize[_0xd5dc('0x2')]},'username':{'type':Sequelize[_0xd5dc('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd5dc('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd5dc('0x2')]}}; \ No newline at end of file +var _0xc1a6=['STRING','exports'];(function(_0x4b89f1,_0x590c84){var _0x3530fd=function(_0x4b8582){while(--_0x4b8582){_0x4b89f1['push'](_0x4b89f1['shift']());}};_0x3530fd(++_0x590c84);}(_0xc1a6,0x109));var _0x6c1a=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xc1a6[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require('sequelize');module[_0x6c1a('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6c1a('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6c1a('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6c1a('0x1')]},'clientSecret':{'type':Sequelize[_0x6c1a('0x1')]},'serverUrl':{'type':Sequelize[_0x6c1a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d39fccf..6975a13 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 _0x9d57=['options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','Dynamics365Configuration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','clientId','slice','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','Attributes','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','statusCode','send','Wrong\x20credentials','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','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','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','json','count','limit','set','Content-Range','save','update','destroy','end','stack','name','index','map','Dynamics365Account','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x9d57,0x16b));var _0x79d5=function(_0x17d114,_0x5a9988){_0x17d114=_0x17d114-0x0;var _0x95997b=_0x9d57[_0x17d114];return _0x95997b;};'use strict';var pdf=require(_0x79d5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x79d5('0x1'));var zipdir=require(_0x79d5('0x2'));var jsonpatch=require(_0x79d5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x79d5('0x4'));var Mustache=require('mustache');var util=require(_0x79d5('0x5'));var path=require(_0x79d5('0x6'));var sox=require(_0x79d5('0x7'));var csv=require('to-csv');var ejs=require(_0x79d5('0x8'));var fs=require('fs');var _=require(_0x79d5('0x9'));var squel=require(_0x79d5('0xa'));var crypto=require(_0x79d5('0xb'));var jsforce=require(_0x79d5('0xc'));var deskjs=require(_0x79d5('0xd'));var toCsv=require(_0x79d5('0xe'));var querystring=require(_0x79d5('0xf'));var Papa=require(_0x79d5('0x10'));var Redis=require(_0x79d5('0x11'));var authService=require(_0x79d5('0x12'));var qs=require(_0x79d5('0x13'));var as=require(_0x79d5('0x14'));var hardwareService=require(_0x79d5('0x15'));var logger=require('../../config/logger')(_0x79d5('0x16'));var utils=require(_0x79d5('0x17'));var config=require(_0x79d5('0x18'));var db=require(_0x79d5('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x79d5('0x1a'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3f27d7,_0x42cf62,_0x5bfd17){if(_0x5bfd17){var _0x521d30=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x521d30[_0x79d5('0x1b')](_0x42cf62)){return _0x3f27d7;}else{throw new db['Sequelize'][(_0x79d5('0x1c'))](_0x79d5('0x1d'));}}else{return _0x3f27d7;}}function respondWithRpcPromise(_0x39779a,_0x38bcbb,_0x239bf3,_0x2e3cb7){return new BPromise(function(_0x406052,_0x21abef){var _0x132c8c=_0x2e3cb7||client;return _0x132c8c['request'](_0x39779a,_0x239bf3)[_0x79d5('0x1e')](function(_0x521bec){logger['info'](_0x79d5('0x1f'),_0x38bcbb,_0x79d5('0x20'));logger[_0x79d5('0x21')](_0x79d5('0x22'),_0x38bcbb,_0x79d5('0x20'),JSON[_0x79d5('0x23')](_0x521bec));if(_0x521bec[_0x79d5('0x24')]){if(_0x521bec['error'][_0x79d5('0x25')]===0x1f4){logger[_0x79d5('0x24')]('Dynamics365Account,\x20%s,\x20%s',_0x38bcbb,_0x521bec[_0x79d5('0x24')][_0x79d5('0x26')]);return _0x21abef(_0x521bec[_0x79d5('0x24')][_0x79d5('0x26')]);}logger[_0x79d5('0x24')](_0x79d5('0x1f'),_0x38bcbb,_0x521bec[_0x79d5('0x24')][_0x79d5('0x26')]);return _0x406052(_0x521bec['error'][_0x79d5('0x26')]);}else{logger[_0x79d5('0x27')](_0x79d5('0x1f'),_0x38bcbb,_0x79d5('0x20'));_0x406052(_0x521bec[_0x79d5('0x28')]['message']);}})['catch'](function(_0x402a97){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x38bcbb,_0x402a97);_0x21abef(_0x402a97);});});}function respondWithStatusCode(_0x120897,_0x168a1a){_0x168a1a=_0x168a1a||0xcc;return function(_0x76b518){if(_0x76b518){return _0x120897[_0x79d5('0x29')](_0x168a1a);}return _0x120897[_0x79d5('0x2a')](_0x168a1a)['end']();};}function respondWithResult(_0x460c89,_0x1cc396){_0x1cc396=_0x1cc396||0xc8;return function(_0x233e9d){if(_0x233e9d){return _0x460c89['status'](_0x1cc396)[_0x79d5('0x2b')](_0x233e9d);}};}function respondWithFilteredResult(_0x36a9a4,_0x327ba1){return function(_0x34a2ad){if(_0x34a2ad){var _0x449f51=_0x34a2ad[_0x79d5('0x2c')],_0x34ef76=_0x327ba1['offset'],_0x36dd23=_0x327ba1['offset']+_0x327ba1[_0x79d5('0x2d')],_0x5a5fa5;if(_0x36dd23>=_0x449f51){_0x36dd23=_0x449f51;_0x5a5fa5=0xc8;}else{_0x5a5fa5=0xce;}_0x36a9a4[_0x79d5('0x2a')](_0x5a5fa5);return _0x36a9a4[_0x79d5('0x2e')](_0x79d5('0x2f'),_0x34ef76+'-'+_0x36dd23+'/'+_0x449f51)[_0x79d5('0x2b')](_0x34a2ad);}return null;};}function patchUpdates(_0x4ae5a5){return function(_0x15fe42){try{jsonpatch['apply'](_0x15fe42,_0x4ae5a5,!![]);}catch(_0x36090f){return BPromise['reject'](_0x36090f);}return _0x15fe42[_0x79d5('0x30')]();};}function saveUpdates(_0x343bbf,_0x3f97e4){return function(_0x51e468){if(_0x51e468){return _0x51e468[_0x79d5('0x31')](_0x343bbf)[_0x79d5('0x1e')](function(_0x33f264){return _0x33f264;});}return null;};}function removeEntity(_0x595cb1,_0x51ec76){return function(_0x551d4e){if(_0x551d4e){return _0x551d4e[_0x79d5('0x32')]()[_0x79d5('0x1e')](function(){_0x595cb1['status'](0xcc)[_0x79d5('0x33')]();});}};}function handleEntityNotFound(_0x3add52,_0x3aedce){return function(_0x30efa0){if(!_0x30efa0){_0x3add52[_0x79d5('0x29')](0x194);}return _0x30efa0;};}function handleError(_0x380ab2,_0x490702){_0x490702=_0x490702||0x1f4;return function(_0x19d8ee){logger['error'](_0x19d8ee[_0x79d5('0x34')]);if(_0x19d8ee[_0x79d5('0x35')]){delete _0x19d8ee[_0x79d5('0x35')];}_0x380ab2['status'](_0x490702)['send'](_0x19d8ee);};}exports[_0x79d5('0x36')]=function(_0x336d1e,_0x33b963){var _0x1b8923={},_0x306eb3={},_0x68b8e0={'count':0x0,'rows':[]};var _0x48398f=_[_0x79d5('0x37')](db[_0x79d5('0x38')][_0x79d5('0x39')],function(_0x595f16){return{'name':_0x595f16['fieldName'],'type':_0x595f16[_0x79d5('0x3a')][_0x79d5('0x3b')]};});_0x306eb3['model']=_['map'](_0x48398f,_0x79d5('0x35'));_0x306eb3[_0x79d5('0x3c')]=_[_0x79d5('0x3d')](_0x336d1e['query']);_0x306eb3[_0x79d5('0x3e')]=_[_0x79d5('0x3f')](_0x306eb3[_0x79d5('0x40')],_0x306eb3['query']);_0x1b8923[_0x79d5('0x41')]=_[_0x79d5('0x3f')](_0x306eb3['model'],qs[_0x79d5('0x42')](_0x336d1e[_0x79d5('0x3c')][_0x79d5('0x42')]));_0x1b8923[_0x79d5('0x41')]=_0x1b8923[_0x79d5('0x41')]['length']?_0x1b8923[_0x79d5('0x41')]:_0x306eb3[_0x79d5('0x40')];if(!_0x336d1e[_0x79d5('0x3c')][_0x79d5('0x43')](_0x79d5('0x44'))){_0x1b8923[_0x79d5('0x2d')]=qs[_0x79d5('0x2d')](_0x336d1e['query'][_0x79d5('0x2d')]);_0x1b8923[_0x79d5('0x45')]=qs[_0x79d5('0x45')](_0x336d1e[_0x79d5('0x3c')]['offset']);}_0x1b8923[_0x79d5('0x46')]=qs[_0x79d5('0x47')](_0x336d1e[_0x79d5('0x3c')]['sort']);_0x1b8923[_0x79d5('0x48')]=qs[_0x79d5('0x3e')](_[_0x79d5('0x49')](_0x336d1e[_0x79d5('0x3c')],_0x306eb3[_0x79d5('0x3e')]),_0x48398f);if(_0x336d1e[_0x79d5('0x3c')][_0x79d5('0x4a')]){_0x1b8923['where']=_[_0x79d5('0x4b')](_0x1b8923[_0x79d5('0x48')],{'$or':_[_0x79d5('0x37')](_0x48398f,function(_0x258fa4){if(_0x258fa4[_0x79d5('0x3a')]!==_0x79d5('0x4c')){var _0x955959={};_0x955959[_0x258fa4[_0x79d5('0x35')]]={'$like':'%'+_0x336d1e[_0x79d5('0x3c')][_0x79d5('0x4a')]+'%'};return _0x955959;}})});}_0x1b8923=_[_0x79d5('0x4b')]({},_0x1b8923,_0x336d1e[_0x79d5('0x4d')]);var _0x3b27fb={'where':_0x1b8923[_0x79d5('0x48')]};return db['Dynamics365Account']['count'](_0x3b27fb)['then'](function(_0x38eb68){_0x68b8e0[_0x79d5('0x2c')]=_0x38eb68;if(_0x336d1e['query'][_0x79d5('0x4e')]){_0x1b8923[_0x79d5('0x4f')]=[{'all':!![]}];}return db[_0x79d5('0x38')][_0x79d5('0x50')](_0x1b8923);})[_0x79d5('0x1e')](function(_0x50bc93){_0x68b8e0[_0x79d5('0x51')]=_0x50bc93;return _0x68b8e0;})['then'](respondWithFilteredResult(_0x33b963,_0x1b8923))[_0x79d5('0x52')](handleError(_0x33b963,null));};exports[_0x79d5('0x53')]=function(_0xa42b7d,_0x2425e1){var _0xeb3cb3={'raw':![],'where':{'id':_0xa42b7d['params']['id']}},_0x4357f3={};_0x4357f3['model']=_[_0x79d5('0x3d')](db['Dynamics365Account'][_0x79d5('0x39')]);_0x4357f3[_0x79d5('0x3c')]=_[_0x79d5('0x3d')](_0xa42b7d[_0x79d5('0x3c')]);_0x4357f3[_0x79d5('0x3e')]=_[_0x79d5('0x3f')](_0x4357f3[_0x79d5('0x40')],_0x4357f3[_0x79d5('0x3c')]);_0xeb3cb3[_0x79d5('0x41')]=_[_0x79d5('0x3f')](_0x4357f3[_0x79d5('0x40')],qs[_0x79d5('0x42')](_0xa42b7d[_0x79d5('0x3c')][_0x79d5('0x42')]));_0xeb3cb3['attributes']=_0xeb3cb3[_0x79d5('0x41')][_0x79d5('0x54')]?_0xeb3cb3[_0x79d5('0x41')]:_0x4357f3[_0x79d5('0x40')];if(_0xa42b7d[_0x79d5('0x3c')][_0x79d5('0x4e')]){_0xeb3cb3[_0x79d5('0x4f')]=[{'all':!![]}];}_0xeb3cb3=_[_0x79d5('0x4b')]({},_0xeb3cb3,_0xa42b7d[_0x79d5('0x4d')]);return db[_0x79d5('0x38')][_0x79d5('0x55')](_0xeb3cb3)['then'](handleEntityNotFound(_0x2425e1,null))[_0x79d5('0x1e')](respondWithResult(_0x2425e1,null))[_0x79d5('0x52')](handleError(_0x2425e1,null));};exports[_0x79d5('0x56')]=function(_0x49fdcb,_0x1ce7a2){return db[_0x79d5('0x38')][_0x79d5('0x56')](_0x49fdcb['body'],{})[_0x79d5('0x1e')](respondWithResult(_0x1ce7a2,0xc9))['catch'](handleError(_0x1ce7a2,null));};exports[_0x79d5('0x31')]=function(_0x583da1,_0x26a441){if(_0x583da1[_0x79d5('0x57')]['id']){delete _0x583da1['body']['id'];}return db[_0x79d5('0x38')][_0x79d5('0x55')]({'where':{'id':_0x583da1[_0x79d5('0x58')]['id']}})[_0x79d5('0x1e')](handleEntityNotFound(_0x26a441,null))['then'](saveUpdates(_0x583da1['body'],null))[_0x79d5('0x1e')](respondWithResult(_0x26a441,null))['catch'](handleError(_0x26a441,null));};exports[_0x79d5('0x32')]=function(_0xaa2324,_0x540eb6){return db['Dynamics365Account'][_0x79d5('0x55')]({'where':{'id':_0xaa2324[_0x79d5('0x58')]['id']}})[_0x79d5('0x1e')](handleEntityNotFound(_0x540eb6,null))[_0x79d5('0x1e')](removeEntity(_0x540eb6,null))[_0x79d5('0x52')](handleError(_0x540eb6,null));};exports[_0x79d5('0x59')]=function(_0x3d2c7c,_0x74697f,_0x3d94e6){var _0x299642={};var _0x4010ed={};var _0x16abdf;var _0x4f867a;return db[_0x79d5('0x38')]['findOne']({'where':{'id':_0x3d2c7c[_0x79d5('0x58')]['id']}})[_0x79d5('0x1e')](handleEntityNotFound(_0x74697f,null))[_0x79d5('0x1e')](function(_0x32c83e){if(_0x32c83e){_0x16abdf=_0x32c83e;_0x4010ed[_0x79d5('0x40')]=_[_0x79d5('0x3d')](db[_0x79d5('0x5a')][_0x79d5('0x39')]);_0x4010ed[_0x79d5('0x3c')]=_[_0x79d5('0x3d')](_0x3d2c7c[_0x79d5('0x3c')]);_0x4010ed[_0x79d5('0x3e')]=_[_0x79d5('0x3f')](_0x4010ed[_0x79d5('0x40')],_0x4010ed['query']);_0x299642['attributes']=_['intersection'](_0x4010ed[_0x79d5('0x40')],qs[_0x79d5('0x42')](_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x42')]));_0x299642[_0x79d5('0x41')]=_0x299642[_0x79d5('0x41')][_0x79d5('0x54')]?_0x299642[_0x79d5('0x41')]:_0x4010ed[_0x79d5('0x40')];_0x299642[_0x79d5('0x46')]=qs[_0x79d5('0x47')](_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x47')]);_0x299642[_0x79d5('0x48')]=qs['filters'](_[_0x79d5('0x49')](_0x3d2c7c[_0x79d5('0x3c')],_0x4010ed['filters']));if(_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x4a')]){_0x299642[_0x79d5('0x48')]=_[_0x79d5('0x4b')](_0x299642['where'],{'$or':_['map'](_0x299642[_0x79d5('0x41')],function(_0x91a943){var _0x5c081e={};_0x5c081e[_0x91a943]={'$like':'%'+_0x3d2c7c[_0x79d5('0x3c')]['filter']+'%'};return _0x5c081e;})});}_0x299642=_[_0x79d5('0x4b')]({},_0x299642,_0x3d2c7c['options']);return _0x16abdf[_0x79d5('0x59')](_0x299642);}})[_0x79d5('0x1e')](function(_0x2dab04){if(_0x2dab04){_0x4f867a=_0x2dab04[_0x79d5('0x54')];if(!_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x43')](_0x79d5('0x44'))){_0x299642['limit']=qs[_0x79d5('0x2d')](_0x3d2c7c['query'][_0x79d5('0x2d')]);_0x299642[_0x79d5('0x45')]=qs['offset'](_0x3d2c7c[_0x79d5('0x3c')][_0x79d5('0x45')]);}return _0x16abdf[_0x79d5('0x59')](_0x299642);}})[_0x79d5('0x1e')](function(_0x531a41){if(_0x531a41){return _0x531a41?{'count':_0x4f867a,'rows':_0x531a41}:null;}})['then'](respondWithResult(_0x74697f,null))[_0x79d5('0x52')](handleError(_0x74697f,null));};exports['addConfiguration']=function(_0x3a0ebd,_0x19af5b,_0x2ec7bc){if(_0x3a0ebd[_0x79d5('0x57')]['id']){delete _0x3a0ebd[_0x79d5('0x57')]['id'];}return db[_0x79d5('0x38')][_0x79d5('0x5b')]({'where':{'id':_0x3a0ebd['params']['id']}})['then'](handleEntityNotFound(_0x19af5b,null))[_0x79d5('0x1e')](function(_0x1e9462){if(_0x1e9462){_0x3a0ebd['body']['AccountId']=_0x1e9462['id'];_0x3a0ebd[_0x79d5('0x57')][_0x79d5('0x5c')]=integrations[_0x79d5('0x5d')](_0x3a0ebd[_0x79d5('0x57')][_0x79d5('0x5e')],_0x3a0ebd[_0x79d5('0x57')]['type']);_0x3a0ebd[_0x79d5('0x57')][_0x79d5('0x5f')]=integrations[_0x79d5('0x60')](_0x3a0ebd['body'][_0x79d5('0x5e')],_0x3a0ebd[_0x79d5('0x57')][_0x79d5('0x3a')]);return db['Dynamics365Configuration'][_0x79d5('0x56')](_0x3a0ebd[_0x79d5('0x57')],{'include':[{'model':db['Dynamics365Field'],'as':_0x79d5('0x5c')},{'model':db['Dynamics365Field'],'as':_0x79d5('0x5f')}]});}return null;})['then'](respondWithResult(_0x19af5b,null))[_0x79d5('0x52')](handleError(_0x19af5b,null));};exports[_0x79d5('0x61')]=function(_0x34767e,_0x429c45,_0x396c9f){var _0x5ba9ea=_0x34767e[_0x79d5('0x3c')]['ticketType'];var _0x3a5281=_0x5ba9ea===_0x79d5('0x62')?'Incident':_0x79d5('0x63');var _0x3d72fb='';var _0x750872='';var _0x3ff89e='';var _0x4aa523='';var _0x4d4dd1='';var _0xe630f='';var _0x1920b6='';var _0xe938fb='';var _0x327bd8=[_0x79d5('0x64'),_0x79d5('0x65'),_0x79d5('0x66'),_0x79d5('0x67'),_0x79d5('0x68'),_0x79d5('0x69'),'phonenumber','regardingobjectid',_0x79d5('0x6a'),_0x79d5('0x6b')];var _0x156b2c=[_0x79d5('0x6c'),_0x79d5('0x6d'),_0x79d5('0x6e'),_0x79d5('0x6f'),_0x79d5('0x70'),_0x79d5('0x71'),_0x79d5('0x72'),_0x79d5('0x73'),_0x79d5('0x74'),_0x79d5('0x75'),'createdbyname','createdbyyominame',_0x79d5('0x76'),_0x79d5('0x77'),_0x79d5('0x78'),_0x79d5('0x79'),_0x79d5('0x7a'),_0x79d5('0x7b'),_0x79d5('0x7c'),_0x79d5('0x7d'),_0x79d5('0x7e'),_0x79d5('0x7f'),_0x79d5('0x80'),_0x79d5('0x81'),_0x79d5('0x82'),_0x79d5('0x83'),'importsequencenumber',_0x79d5('0x84'),_0x79d5('0x85'),'lastonholdtime','masteridname',_0x79d5('0x86'),_0x79d5('0x87'),_0x79d5('0x88'),'modifiedbyyominame',_0x79d5('0x89'),_0x79d5('0x8a'),_0x79d5('0x8b'),_0x79d5('0x8c'),_0x79d5('0x8d'),'numberofchildincidents',_0x79d5('0x8e'),_0x79d5('0x8f'),_0x79d5('0x90'),'owneridtype',_0x79d5('0x91'),_0x79d5('0x92'),_0x79d5('0x93'),_0x79d5('0x94'),_0x79d5('0x95'),'productidname',_0x79d5('0x96'),_0x79d5('0x97'),_0x79d5('0x98'),_0x79d5('0x99'),_0x79d5('0x9a'),_0x79d5('0x9b'),_0x79d5('0x9c'),'slainvokedidname',_0x79d5('0x9d'),_0x79d5('0x9e'),_0x79d5('0x9f'),_0x79d5('0xa0'),'subjectidname','ticketnumber',_0x79d5('0xa1'),_0x79d5('0xa2'),_0x79d5('0xa3'),_0x79d5('0xa4'),'versionnumber'];var _0x1cb1db=_0x327bd8[_0x79d5('0xa5')](_0x156b2c);return db[_0x79d5('0x38')][_0x79d5('0x5b')]({'where':{'id':_0x34767e['params']['id']},'attributes':['id',_0x79d5('0xa6'),_0x79d5('0xa7'),_0x79d5('0xa8'),'tenantId',_0x79d5('0xa9'),'clientSecret']})[_0x79d5('0x1e')](handleEntityNotFound(_0x429c45,null))[_0x79d5('0x1e')](function(_0x49d17b){if(_0x49d17b){_0xe938fb=_0x49d17b[_0x79d5('0xa8')];var _0x3e7508=_0xe938fb[_0x79d5('0xaa')](-0x1);if(_0x3e7508==='/'){_0xe938fb=_0xe938fb['substring'](0x0,_0xe938fb[_0x79d5('0xab')](_0x3e7508));}_0x1920b6=util['format'](_0x79d5('0xac'),_0xe938fb);var _0x3f1d22={'method':_0x79d5('0xad'),'uri':_0x79d5('0xae')+_0x49d17b[_0x79d5('0xaf')]+_0x79d5('0xb0'),'form':{'client_id':_0x49d17b[_0x79d5('0xa9')],'resource':_0xe938fb,'username':_0x49d17b['username'],'password':_0x49d17b[_0x79d5('0xa7')],'grant_type':'password','client_secret':_0x49d17b['clientSecret']},'json':!![]};return rp(_0x3f1d22);}})['then'](function(_0x4ac2fb){_0xe630f=_0x4ac2fb[_0x79d5('0xb1')];var _0x258475={'method':'GET','uri':encodeURI(_0x1920b6+_0x79d5('0xb2')+_0x3a5281+'\x27'),'headers':{'Authorization':_0x79d5('0xb3')+_0xe630f,'If-None-Match':null,'OData-Version':_0x79d5('0xb4')},'json':!![]};return rp(_0x258475);})[_0x79d5('0x1e')](function(_0x525a2a){var _0x2a3813=_0x525a2a[_0x79d5('0xb5')][0x0];var _0x57649f=_0x2a3813[_0x79d5('0xb6')];var _0x5b3664={'method':_0x79d5('0xb7'),'uri':_0x1920b6+'EntityDefinitions('+_0x57649f+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x79d5('0xb3')+_0xe630f,'If-None-Match':null,'OData-Version':_0x79d5('0xb4')},'json':!![]};return rp(_0x5b3664);})[_0x79d5('0x1e')](function(_0x4e8ae8){_0x3d72fb=_0x4e8ae8;_0x750872=_0x3d72fb[_0x79d5('0xb8')];_0x750872=_['remove'](_0x750872,function(_0x6cf6f4){return!_0x1cb1db[_0x79d5('0xb9')](_0x6cf6f4[_0x79d5('0xba')]);});var _0x41c2ec=[];var _0x57beb3=[];_0x750872[_0x79d5('0xbb')](function(_0x262699){if(_0x262699[_0x79d5('0xbc')]){var _0xf581fc=_0x262699[_0x79d5('0xbc')][_0x79d5('0xbd')](_0x262699[_0x79d5('0xbc')][_0x79d5('0xab')]('.')+0x1);if(_0xf581fc===_0x79d5('0xbe')){_0x41c2ec['push'](getSelectList(_0x1920b6,_0x5ba9ea,_0x57beb3,_0x3d72fb[_0x79d5('0xb6')],_0x262699[_0x79d5('0xb6')],_0xe630f));}}});return Promise['all'](_0x41c2ec);})[_0x79d5('0x1e')](function(_0x26089f){_0x3ff89e=_0x26089f[0x0];var _0x3e89f1=[];var _0x5a6125=[];_0x750872[_0x79d5('0xbb')](function(_0x1860eb){if(!_[_0x79d5('0xbf')](_0x1860eb[_0x79d5('0xbc')])){var _0x1ff75e=_0x1860eb[_0x79d5('0xbc')][_0x79d5('0xbd')](_0x1860eb[_0x79d5('0xbc')][_0x79d5('0xab')]('.')+0x1);if(_0x1ff75e===_0x79d5('0xc0')){_0x3e89f1['push'](getBooleanList(_0x1920b6,_0x5ba9ea,_0x5a6125,_0x3d72fb[_0x79d5('0xb6')],_0x1860eb['MetadataId'],_0xe630f));}}});return Promise[_0x79d5('0xc1')](_0x3e89f1);})[_0x79d5('0x1e')](function(_0x4f9850){_0x4aa523=_0x4f9850[0x0];var _0x4541e3=[];var _0x598b17=[];_0x750872[_0x79d5('0xbb')](function(_0x5dc2bf){if(_0x5dc2bf[_0x79d5('0xbc')]){var _0xd10cb4=_0x5dc2bf[_0x79d5('0xbc')][_0x79d5('0xbd')](_0x5dc2bf[_0x79d5('0xbc')]['lastIndexOf']('.')+0x1);if(_0xd10cb4==='StringAttributeMetadata'||_0xd10cb4===_0x79d5('0xc2')||_0xd10cb4===_0x79d5('0xc3')||_0xd10cb4===_0x79d5('0xc4')||_0xd10cb4==='MemoAttributeMetadata'||_0xd10cb4==='DateTimeAttributeMetadata'||_0xd10cb4===_0x79d5('0xc5')||_0xd10cb4===_0x79d5('0xc6')||_0xd10cb4===_0x79d5('0xc7')||_0xd10cb4===_0x79d5('0xc8')){_0x4541e3[_0x79d5('0xc9')](getInputList(_0x1920b6,_0x5ba9ea,_0xd10cb4,_0x598b17,_0x3d72fb[_0x79d5('0xb6')],_0x5dc2bf['MetadataId'],_0xe630f));}}});return Promise[_0x79d5('0xc1')](_0x4541e3);})['then'](function(_0x5caf12){_0x4d4dd1=_0x5caf12[0x0];var _0x4142f6=_0x3ff89e[_0x79d5('0xa5')](_0x4aa523)[_0x79d5('0xa5')](_0x4d4dd1);var _0xce548a={'count':_0x4142f6[_0x79d5('0x54')],'rows':_0x4142f6};return _0xce548a;})[_0x79d5('0x1e')](respondWithResult(_0x429c45,null))['catch'](function(_0x32c872){var _0x459b84=_0x34767e[_0x79d5('0x3c')][_0x79d5('0x1b')]?0x1f4:_0x32c872[_0x79d5('0xca')]||0x1f4;logger[_0x79d5('0x24')](_0x32c872[_0x79d5('0x34')]);delete _0x32c872['name'];if(_0x459b84===0x191){_0x459b84=0x190;}_0x429c45[_0x79d5('0x2a')](_0x459b84)[_0x79d5('0xcb')](_0x34767e[_0x79d5('0x3c')][_0x79d5('0x1b')]?{'message':_0x79d5('0xcc'),'statusCode':_0x32c872['statusCode']}:_0x32c872);});};function getSelectList(_0x4ba402,_0x1370d2,_0x83a4e6,_0x42ef78,_0x2ed62b,_0x27e4cc){var _0x45997f={'method':_0x79d5('0xb7'),'uri':_0x4ba402+_0x79d5('0xcd')+_0x42ef78+')/Attributes('+_0x2ed62b+_0x79d5('0xce')+_0x79d5('0xcf'),'headers':{'Authorization':'Bearer\x20'+_0x27e4cc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x45997f)[_0x79d5('0x1e')](function(_0x211434){var _0x2d6d9d=[];var _0x5a03f0=_0x211434[_0x79d5('0xd0')][_0x79d5('0xd1')];_0x5a03f0[_0x79d5('0xbb')](function(_0x17d8b3){_0x2d6d9d[_0x79d5('0xc9')]({'name':_0x17d8b3['Label']['UserLocalizedLabel'][_0x79d5('0xd2')],'value':String(_0x17d8b3['Value'])});});var _0x3938b5={'id':_0x1370d2+'_'+_0x211434[_0x79d5('0xba')],'name':_0x211434['DisplayName'][_0x79d5('0xd3')][_0x79d5('0xd2')],'custom':![],'options':_0x2d6d9d};_0x83a4e6[_0x79d5('0xc9')](_0x3938b5);return _0x83a4e6;});}function getBooleanList(_0x432179,_0x47bd35,_0x24c3f2,_0x14826b,_0x1b5323,_0x3b4b63){var _0x1d964e={'method':_0x79d5('0xb7'),'uri':_0x432179+_0x79d5('0xcd')+_0x14826b+_0x79d5('0xd4')+_0x1b5323+_0x79d5('0xd5'),'headers':{'Authorization':_0x79d5('0xb3')+_0x3b4b63,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1d964e)[_0x79d5('0x1e')](function(_0x3b3d48){var _0x1915bd=[];_0x1915bd[_0x79d5('0xc9')]({'name':_0x3b3d48[_0x79d5('0xd0')][_0x79d5('0xd6')][_0x79d5('0xd2')][_0x79d5('0xd3')][_0x79d5('0xd2')],'value':_0x79d5('0xd7')},{'name':_0x3b3d48[_0x79d5('0xd0')]['FalseOption'][_0x79d5('0xd2')][_0x79d5('0xd3')][_0x79d5('0xd2')],'value':_0x79d5('0xd8')});var _0x4db2be={'id':_0x47bd35+'_'+_0x3b3d48['LogicalName'],'name':_0x3b3d48[_0x79d5('0xd9')][_0x79d5('0xd3')][_0x79d5('0xd2')],'custom':![],'options':_0x1915bd};_0x24c3f2[_0x79d5('0xc9')](_0x4db2be);return _0x24c3f2;});}function getInputList(_0xf53aa7,_0xb0f8f0,_0x153653,_0x273d65,_0x39e181,_0x207dc8,_0x2caa88){var _0x86f777={'method':_0x79d5('0xb7'),'uri':_0xf53aa7+_0x79d5('0xcd')+_0x39e181+')/Attributes('+_0x207dc8+_0x79d5('0xda')+_0x153653+_0x79d5('0xdb'),'headers':{'Authorization':_0x79d5('0xb3')+_0x2caa88,'If-None-Match':null,'OData-Version':_0x79d5('0xb4')},'json':!![]};return rp(_0x86f777)[_0x79d5('0x1e')](function(_0x204a74){var _0xadef9a={'id':_0xb0f8f0+'_'+_0x204a74['LogicalName'],'name':_0x204a74['DisplayName'][_0x79d5('0xd3')]?_0x204a74[_0x79d5('0xd9')][_0x79d5('0xd3')][_0x79d5('0xd2')]:_0x204a74[_0x79d5('0xba')],'custom':![],'options':[]};_0x273d65['push'](_0xadef9a);return _0x273d65;});} \ No newline at end of file +var _0x6607=['then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','title','customerid','subject','phonenumber','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','traversedpath','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientId','clientSecret','slice','%s/api/data/v9.0/','POST','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','@odata.type','substring','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../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'];(function(_0x100bb5,_0x478230){var _0x550073=function(_0x195a20){while(--_0x195a20){_0x100bb5['push'](_0x100bb5['shift']());}};_0x550073(++_0x478230);}(_0x6607,0xbe));var _0x7660=function(_0x294127,_0x27641f){_0x294127=_0x294127-0x0;var _0x2c269e=_0x6607[_0x294127];return _0x2c269e;};'use strict';var pdf=require(_0x7660('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7660('0x1'));var zipdir=require(_0x7660('0x2'));var jsonpatch=require(_0x7660('0x3'));var rp=require('request-promise');var moment=require(_0x7660('0x4'));var BPromise=require(_0x7660('0x5'));var Mustache=require('mustache');var util=require(_0x7660('0x6'));var path=require(_0x7660('0x7'));var sox=require('sox');var csv=require(_0x7660('0x8'));var ejs=require(_0x7660('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7660('0xa'));var crypto=require(_0x7660('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7660('0x8'));var querystring=require(_0x7660('0xc'));var Papa=require(_0x7660('0xd'));var Redis=require(_0x7660('0xe'));var authService=require(_0x7660('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7660('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7660('0x11'))('api');var utils=require(_0x7660('0x12'));var config=require('../../config/environment');var db=require(_0x7660('0x13'))['db'];var integrations=require(_0x7660('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x7660('0x15')][_0x7660('0x16')]({'port':0x232a});function checkPasswordPattern(_0x39ceec,_0x2dddc3,_0x52e8f6){if(_0x52e8f6){var _0x41b986=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41b986[_0x7660('0x17')](_0x2dddc3)){return _0x39ceec;}else{throw new db[(_0x7660('0x18'))][(_0x7660('0x19'))](_0x7660('0x1a'));}}else{return _0x39ceec;}}function respondWithRpcPromise(_0x29ae1a,_0x3b1c52,_0x329101,_0x1afd85){return new BPromise(function(_0x47cead,_0x200727){var _0x4f1848=_0x1afd85||client;return _0x4f1848[_0x7660('0x1b')](_0x29ae1a,_0x329101)[_0x7660('0x1c')](function(_0x1d3930){logger[_0x7660('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x3b1c52,_0x7660('0x1e'));logger['debug'](_0x7660('0x1f'),_0x3b1c52,_0x7660('0x1e'),JSON[_0x7660('0x20')](_0x1d3930));if(_0x1d3930['error']){if(_0x1d3930['error']['code']===0x1f4){logger[_0x7660('0x21')](_0x7660('0x22'),_0x3b1c52,_0x1d3930[_0x7660('0x21')][_0x7660('0x23')]);return _0x200727(_0x1d3930[_0x7660('0x21')][_0x7660('0x23')]);}logger[_0x7660('0x21')](_0x7660('0x22'),_0x3b1c52,_0x1d3930[_0x7660('0x21')]['message']);return _0x47cead(_0x1d3930['error'][_0x7660('0x23')]);}else{logger[_0x7660('0x1d')](_0x7660('0x22'),_0x3b1c52,_0x7660('0x1e'));_0x47cead(_0x1d3930['result'][_0x7660('0x23')]);}})[_0x7660('0x24')](function(_0x1481cf){logger[_0x7660('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x3b1c52,_0x1481cf);_0x200727(_0x1481cf);});});}function respondWithStatusCode(_0x68562a,_0x175ed9){_0x175ed9=_0x175ed9||0xcc;return function(_0x454a87){if(_0x454a87){return _0x68562a[_0x7660('0x25')](_0x175ed9);}return _0x68562a['status'](_0x175ed9)[_0x7660('0x26')]();};}function respondWithResult(_0x59cdeb,_0x3ea3d8){_0x3ea3d8=_0x3ea3d8||0xc8;return function(_0x4f3987){if(_0x4f3987){return _0x59cdeb[_0x7660('0x27')](_0x3ea3d8)[_0x7660('0x28')](_0x4f3987);}};}function respondWithFilteredResult(_0x14ba76,_0x5bffa3){return function(_0x4df67b){if(_0x4df67b){var _0x32eeab=_0x4df67b[_0x7660('0x29')],_0x1dd394=_0x5bffa3[_0x7660('0x2a')],_0xb6cbdc=_0x5bffa3[_0x7660('0x2a')]+_0x5bffa3[_0x7660('0x2b')],_0x19a75f;if(_0xb6cbdc>=_0x32eeab){_0xb6cbdc=_0x32eeab;_0x19a75f=0xc8;}else{_0x19a75f=0xce;}_0x14ba76[_0x7660('0x27')](_0x19a75f);return _0x14ba76['set'](_0x7660('0x2c'),_0x1dd394+'-'+_0xb6cbdc+'/'+_0x32eeab)[_0x7660('0x28')](_0x4df67b);}return null;};}function patchUpdates(_0x51d184){return function(_0x18518a){try{jsonpatch[_0x7660('0x2d')](_0x18518a,_0x51d184,!![]);}catch(_0x21e50a){return BPromise[_0x7660('0x2e')](_0x21e50a);}return _0x18518a[_0x7660('0x2f')]();};}function saveUpdates(_0xa8db67,_0x12b6c8){return function(_0x4196c3){if(_0x4196c3){return _0x4196c3[_0x7660('0x30')](_0xa8db67)[_0x7660('0x1c')](function(_0x14b98e){return _0x14b98e;});}return null;};}function removeEntity(_0x189e5c,_0x25271d){return function(_0xf85be7){if(_0xf85be7){return _0xf85be7[_0x7660('0x31')]()['then'](function(){_0x189e5c[_0x7660('0x27')](0xcc)[_0x7660('0x26')]();});}};}function handleEntityNotFound(_0x2330c4,_0x44d2be){return function(_0x2ea42e){if(!_0x2ea42e){_0x2330c4[_0x7660('0x25')](0x194);}return _0x2ea42e;};}function handleError(_0x319121,_0x216ddf){_0x216ddf=_0x216ddf||0x1f4;return function(_0x5b7259){logger['error'](_0x5b7259[_0x7660('0x32')]);if(_0x5b7259[_0x7660('0x33')]){delete _0x5b7259[_0x7660('0x33')];}_0x319121['status'](_0x216ddf)[_0x7660('0x34')](_0x5b7259);};}exports[_0x7660('0x35')]=function(_0x4f41c8,_0x5cfa9d){var _0x3088c6={},_0x341fce={},_0x320747={'count':0x0,'rows':[]};var _0x1228f2=_[_0x7660('0x36')](db[_0x7660('0x37')][_0x7660('0x38')],function(_0x6b23f8){return{'name':_0x6b23f8[_0x7660('0x39')],'type':_0x6b23f8[_0x7660('0x3a')]['key']};});_0x341fce[_0x7660('0x3b')]=_['map'](_0x1228f2,_0x7660('0x33'));_0x341fce[_0x7660('0x3c')]=_[_0x7660('0x3d')](_0x4f41c8[_0x7660('0x3c')]);_0x341fce[_0x7660('0x3e')]=_[_0x7660('0x3f')](_0x341fce[_0x7660('0x3b')],_0x341fce[_0x7660('0x3c')]);_0x3088c6[_0x7660('0x40')]=_[_0x7660('0x3f')](_0x341fce['model'],qs['fields'](_0x4f41c8[_0x7660('0x3c')]['fields']));_0x3088c6[_0x7660('0x40')]=_0x3088c6[_0x7660('0x40')][_0x7660('0x41')]?_0x3088c6['attributes']:_0x341fce[_0x7660('0x3b')];if(!_0x4f41c8['query'][_0x7660('0x42')](_0x7660('0x43'))){_0x3088c6[_0x7660('0x2b')]=qs[_0x7660('0x2b')](_0x4f41c8[_0x7660('0x3c')]['limit']);_0x3088c6[_0x7660('0x2a')]=qs[_0x7660('0x2a')](_0x4f41c8[_0x7660('0x3c')]['offset']);}_0x3088c6['order']=qs[_0x7660('0x44')](_0x4f41c8['query']['sort']);_0x3088c6[_0x7660('0x45')]=qs[_0x7660('0x3e')](_['pick'](_0x4f41c8[_0x7660('0x3c')],_0x341fce[_0x7660('0x3e')]),_0x1228f2);if(_0x4f41c8[_0x7660('0x3c')][_0x7660('0x46')]){_0x3088c6[_0x7660('0x45')]=_[_0x7660('0x47')](_0x3088c6[_0x7660('0x45')],{'$or':_[_0x7660('0x36')](_0x1228f2,function(_0x785b90){if(_0x785b90[_0x7660('0x3a')]!==_0x7660('0x48')){var _0x508ca0={};_0x508ca0[_0x785b90[_0x7660('0x33')]]={'$like':'%'+_0x4f41c8['query']['filter']+'%'};return _0x508ca0;}})});}_0x3088c6=_[_0x7660('0x47')]({},_0x3088c6,_0x4f41c8[_0x7660('0x49')]);var _0x401b9b={'where':_0x3088c6['where']};return db[_0x7660('0x37')][_0x7660('0x29')](_0x401b9b)[_0x7660('0x1c')](function(_0x340a8f){_0x320747['count']=_0x340a8f;if(_0x4f41c8[_0x7660('0x3c')][_0x7660('0x4a')]){_0x3088c6['include']=[{'all':!![]}];}return db[_0x7660('0x37')][_0x7660('0x4b')](_0x3088c6);})[_0x7660('0x1c')](function(_0x336460){_0x320747[_0x7660('0x4c')]=_0x336460;return _0x320747;})[_0x7660('0x1c')](respondWithFilteredResult(_0x5cfa9d,_0x3088c6))[_0x7660('0x24')](handleError(_0x5cfa9d,null));};exports[_0x7660('0x4d')]=function(_0x534ff4,_0x1fbc14){var _0x49e260={'raw':![],'where':{'id':_0x534ff4[_0x7660('0x4e')]['id']}},_0x20023d={};_0x20023d[_0x7660('0x3b')]=_[_0x7660('0x3d')](db[_0x7660('0x37')]['rawAttributes']);_0x20023d[_0x7660('0x3c')]=_[_0x7660('0x3d')](_0x534ff4[_0x7660('0x3c')]);_0x20023d[_0x7660('0x3e')]=_['intersection'](_0x20023d[_0x7660('0x3b')],_0x20023d[_0x7660('0x3c')]);_0x49e260['attributes']=_[_0x7660('0x3f')](_0x20023d[_0x7660('0x3b')],qs[_0x7660('0x4f')](_0x534ff4['query']['fields']));_0x49e260['attributes']=_0x49e260[_0x7660('0x40')][_0x7660('0x41')]?_0x49e260[_0x7660('0x40')]:_0x20023d[_0x7660('0x3b')];if(_0x534ff4[_0x7660('0x3c')][_0x7660('0x4a')]){_0x49e260[_0x7660('0x50')]=[{'all':!![]}];}_0x49e260=_[_0x7660('0x47')]({},_0x49e260,_0x534ff4[_0x7660('0x49')]);return db[_0x7660('0x37')][_0x7660('0x51')](_0x49e260)['then'](handleEntityNotFound(_0x1fbc14,null))[_0x7660('0x1c')](respondWithResult(_0x1fbc14,null))[_0x7660('0x24')](handleError(_0x1fbc14,null));};exports[_0x7660('0x52')]=function(_0x39fd91,_0x233389){return db['Dynamics365Account'][_0x7660('0x52')](_0x39fd91[_0x7660('0x53')],{})[_0x7660('0x1c')](respondWithResult(_0x233389,0xc9))[_0x7660('0x24')](handleError(_0x233389,null));};exports[_0x7660('0x30')]=function(_0xfdb634,_0x1d378f){if(_0xfdb634[_0x7660('0x53')]['id']){delete _0xfdb634[_0x7660('0x53')]['id'];}return db[_0x7660('0x37')][_0x7660('0x51')]({'where':{'id':_0xfdb634[_0x7660('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1d378f,null))[_0x7660('0x1c')](saveUpdates(_0xfdb634[_0x7660('0x53')],null))[_0x7660('0x1c')](respondWithResult(_0x1d378f,null))[_0x7660('0x24')](handleError(_0x1d378f,null));};exports[_0x7660('0x31')]=function(_0x17bc01,_0x1175db){return db[_0x7660('0x37')]['find']({'where':{'id':_0x17bc01[_0x7660('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1175db,null))['then'](removeEntity(_0x1175db,null))[_0x7660('0x24')](handleError(_0x1175db,null));};exports[_0x7660('0x54')]=function(_0x145402,_0x290550,_0x2730cc){var _0x29fb07={};var _0x58cf0d={};var _0x4afaa4;var _0x3291db;return db[_0x7660('0x37')][_0x7660('0x55')]({'where':{'id':_0x145402[_0x7660('0x4e')]['id']}})['then'](handleEntityNotFound(_0x290550,null))['then'](function(_0x556eb8){if(_0x556eb8){_0x4afaa4=_0x556eb8;_0x58cf0d[_0x7660('0x3b')]=_[_0x7660('0x3d')](db[_0x7660('0x56')][_0x7660('0x38')]);_0x58cf0d['query']=_[_0x7660('0x3d')](_0x145402[_0x7660('0x3c')]);_0x58cf0d[_0x7660('0x3e')]=_[_0x7660('0x3f')](_0x58cf0d[_0x7660('0x3b')],_0x58cf0d[_0x7660('0x3c')]);_0x29fb07[_0x7660('0x40')]=_['intersection'](_0x58cf0d[_0x7660('0x3b')],qs['fields'](_0x145402[_0x7660('0x3c')][_0x7660('0x4f')]));_0x29fb07['attributes']=_0x29fb07[_0x7660('0x40')][_0x7660('0x41')]?_0x29fb07[_0x7660('0x40')]:_0x58cf0d['model'];_0x29fb07[_0x7660('0x57')]=qs[_0x7660('0x44')](_0x145402[_0x7660('0x3c')][_0x7660('0x44')]);_0x29fb07[_0x7660('0x45')]=qs[_0x7660('0x3e')](_[_0x7660('0x58')](_0x145402[_0x7660('0x3c')],_0x58cf0d['filters']));if(_0x145402[_0x7660('0x3c')][_0x7660('0x46')]){_0x29fb07[_0x7660('0x45')]=_[_0x7660('0x47')](_0x29fb07['where'],{'$or':_[_0x7660('0x36')](_0x29fb07[_0x7660('0x40')],function(_0x16c199){var _0x1267e3={};_0x1267e3[_0x16c199]={'$like':'%'+_0x145402[_0x7660('0x3c')][_0x7660('0x46')]+'%'};return _0x1267e3;})});}_0x29fb07=_['merge']({},_0x29fb07,_0x145402[_0x7660('0x49')]);return _0x4afaa4[_0x7660('0x54')](_0x29fb07);}})['then'](function(_0x2c172f){if(_0x2c172f){_0x3291db=_0x2c172f[_0x7660('0x41')];if(!_0x145402[_0x7660('0x3c')][_0x7660('0x42')](_0x7660('0x43'))){_0x29fb07[_0x7660('0x2b')]=qs[_0x7660('0x2b')](_0x145402['query'][_0x7660('0x2b')]);_0x29fb07[_0x7660('0x2a')]=qs['offset'](_0x145402[_0x7660('0x3c')]['offset']);}return _0x4afaa4[_0x7660('0x54')](_0x29fb07);}})['then'](function(_0x2a5dac){if(_0x2a5dac){return _0x2a5dac?{'count':_0x3291db,'rows':_0x2a5dac}:null;}})[_0x7660('0x1c')](respondWithResult(_0x290550,null))[_0x7660('0x24')](handleError(_0x290550,null));};exports[_0x7660('0x59')]=function(_0x4dc216,_0x366848,_0x5dcf1f){if(_0x4dc216[_0x7660('0x53')]['id']){delete _0x4dc216[_0x7660('0x53')]['id'];}return db[_0x7660('0x37')][_0x7660('0x55')]({'where':{'id':_0x4dc216[_0x7660('0x4e')]['id']}})[_0x7660('0x1c')](handleEntityNotFound(_0x366848,null))[_0x7660('0x1c')](function(_0x36da42){if(_0x36da42){_0x4dc216[_0x7660('0x53')][_0x7660('0x5a')]=_0x36da42['id'];_0x4dc216[_0x7660('0x53')][_0x7660('0x5b')]=integrations[_0x7660('0x5c')](_0x4dc216[_0x7660('0x53')][_0x7660('0x5d')],_0x4dc216[_0x7660('0x53')][_0x7660('0x3a')]);_0x4dc216[_0x7660('0x53')][_0x7660('0x5e')]=integrations[_0x7660('0x5f')](_0x4dc216[_0x7660('0x53')][_0x7660('0x5d')],_0x4dc216[_0x7660('0x53')][_0x7660('0x3a')]);return db[_0x7660('0x56')][_0x7660('0x52')](_0x4dc216[_0x7660('0x53')],{'include':[{'model':db[_0x7660('0x60')],'as':_0x7660('0x5b')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x7660('0x1c')](respondWithResult(_0x366848,null))[_0x7660('0x24')](handleError(_0x366848,null));};exports[_0x7660('0x61')]=function(_0x1398d4,_0x4377ed,_0x2405f1){var _0x5debc6=_0x1398d4[_0x7660('0x3c')][_0x7660('0x62')];var _0x5a3f6b=_0x5debc6===_0x7660('0x63')?_0x7660('0x64'):'PhoneCall';var _0x30fb72='';var _0x59077d='';var _0x1016b6='';var _0x4e039b='';var _0x1345b9='';var _0x333d18='';var _0x25028b='';var _0x55d2be='';var _0x25f8ad=[_0x7660('0x65'),'description',_0x7660('0x66'),'ownerid','caseorigincode',_0x7660('0x67'),_0x7660('0x68'),'regardingobjectid','directioncode',_0x7660('0x69')];var _0x5998f8=[_0x7660('0x6a'),_0x7660('0x6b'),_0x7660('0x6c'),_0x7660('0x6d'),_0x7660('0x6e'),_0x7660('0x6f'),_0x7660('0x70'),_0x7660('0x71'),_0x7660('0x72'),_0x7660('0x73'),_0x7660('0x74'),'createdbyyominame',_0x7660('0x75'),_0x7660('0x76'),'createdonbehalfbyyominame',_0x7660('0x77'),_0x7660('0x78'),_0x7660('0x79'),'emailaddress',_0x7660('0x7a'),_0x7660('0x7b'),_0x7660('0x7c'),_0x7660('0x7d'),_0x7660('0x7e'),'firstresponsebykpiidname','followupby',_0x7660('0x7f'),_0x7660('0x80'),_0x7660('0x81'),_0x7660('0x82'),_0x7660('0x83'),_0x7660('0x84'),'modifiedbyexternalpartyyominame',_0x7660('0x85'),_0x7660('0x86'),_0x7660('0x87'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x7660('0x88'),'msdyn_iotalertname',_0x7660('0x89'),_0x7660('0x8a'),_0x7660('0x8b'),_0x7660('0x8c'),'owneridtype',_0x7660('0x8d'),'parentcaseidname',_0x7660('0x8e'),_0x7660('0x8f'),_0x7660('0x90'),_0x7660('0x91'),_0x7660('0x92'),_0x7660('0x93'),'resolvebykpiidname',_0x7660('0x94'),_0x7660('0x95'),_0x7660('0x96'),'sentimentvalue',_0x7660('0x97'),_0x7660('0x98'),_0x7660('0x99'),_0x7660('0x9a'),_0x7660('0x9b'),_0x7660('0x9c'),_0x7660('0x9d'),'timezoneruleversionnumber','transactioncurrencyidname',_0x7660('0x9e'),_0x7660('0x9f'),'versionnumber'];var _0x1528f7=_0x25f8ad[_0x7660('0xa0')](_0x5998f8);return db['Dynamics365Account'][_0x7660('0x55')]({'where':{'id':_0x1398d4['params']['id']},'attributes':['id',_0x7660('0xa1'),'password',_0x7660('0xa2'),_0x7660('0xa3'),_0x7660('0xa4'),_0x7660('0xa5')]})[_0x7660('0x1c')](handleEntityNotFound(_0x4377ed,null))[_0x7660('0x1c')](function(_0x5109c7){if(_0x5109c7){_0x55d2be=_0x5109c7[_0x7660('0xa2')];var _0x470493=_0x55d2be[_0x7660('0xa6')](-0x1);if(_0x470493==='/'){_0x55d2be=_0x55d2be['substring'](0x0,_0x55d2be['lastIndexOf'](_0x470493));}_0x25028b=util['format'](_0x7660('0xa7'),_0x55d2be);var _0x376e64={'method':_0x7660('0xa8'),'uri':'https://login.microsoftonline.com/'+_0x5109c7[_0x7660('0xa3')]+_0x7660('0xa9'),'form':{'client_id':_0x5109c7[_0x7660('0xa4')],'resource':_0x55d2be,'username':_0x5109c7['username'],'password':_0x5109c7['password'],'grant_type':_0x7660('0xaa'),'client_secret':_0x5109c7[_0x7660('0xa5')]},'json':!![]};return rp(_0x376e64);}})[_0x7660('0x1c')](function(_0x6b0a15){_0x333d18=_0x6b0a15[_0x7660('0xab')];var _0x29bfe6={'method':_0x7660('0xac'),'uri':encodeURI(_0x25028b+_0x7660('0xad')+_0x5a3f6b+'\x27'),'headers':{'Authorization':_0x7660('0xae')+_0x333d18,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0x29bfe6);})[_0x7660('0x1c')](function(_0x4c8561){var _0x13a615=_0x4c8561[_0x7660('0xb0')][0x0];var _0x5279b9=_0x13a615[_0x7660('0xb1')];var _0xe22be2={'method':_0x7660('0xac'),'uri':_0x25028b+_0x7660('0xb2')+_0x5279b9+_0x7660('0xb3'),'headers':{'Authorization':_0x7660('0xae')+_0x333d18,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0xe22be2);})[_0x7660('0x1c')](function(_0x700687){_0x30fb72=_0x700687;_0x59077d=_0x30fb72[_0x7660('0xb4')];_0x59077d=_[_0x7660('0xb5')](_0x59077d,function(_0x4f1880){return!_0x1528f7[_0x7660('0xb6')](_0x4f1880['LogicalName']);});var _0x2e3805=[];var _0x4c3030=[];_0x59077d['forEach'](function(_0x3f636b){if(_0x3f636b[_0x7660('0xb7')]){var _0x2823d4=_0x3f636b[_0x7660('0xb7')][_0x7660('0xb8')](_0x3f636b[_0x7660('0xb7')][_0x7660('0xb9')]('.')+0x1);if(_0x2823d4===_0x7660('0xba')){_0x2e3805[_0x7660('0xbb')](getSelectList(_0x25028b,_0x5debc6,_0x4c3030,_0x30fb72[_0x7660('0xb1')],_0x3f636b[_0x7660('0xb1')],_0x333d18));}}});return Promise[_0x7660('0xbc')](_0x2e3805);})[_0x7660('0x1c')](function(_0x12b847){_0x1016b6=_0x12b847[0x0];var _0x2ef770=[];var _0x4af824=[];_0x59077d[_0x7660('0xbd')](function(_0x4764d3){if(!_[_0x7660('0xbe')](_0x4764d3['@odata.type'])){var _0x4554ff=_0x4764d3[_0x7660('0xb7')][_0x7660('0xb8')](_0x4764d3[_0x7660('0xb7')][_0x7660('0xb9')]('.')+0x1);if(_0x4554ff===_0x7660('0xbf')){_0x2ef770['push'](getBooleanList(_0x25028b,_0x5debc6,_0x4af824,_0x30fb72['MetadataId'],_0x4764d3[_0x7660('0xb1')],_0x333d18));}}});return Promise[_0x7660('0xbc')](_0x2ef770);})[_0x7660('0x1c')](function(_0xc0e824){_0x4e039b=_0xc0e824[0x0];var _0x16db14=[];var _0x19c94a=[];_0x59077d[_0x7660('0xbd')](function(_0xe06de1){if(_0xe06de1['@odata.type']){var _0x542b77=_0xe06de1[_0x7660('0xb7')]['substring'](_0xe06de1[_0x7660('0xb7')]['lastIndexOf']('.')+0x1);if(_0x542b77===_0x7660('0xc0')||_0x542b77===_0x7660('0xc1')||_0x542b77==='BigIntAttributeMetadata'||_0x542b77===_0x7660('0xc2')||_0x542b77===_0x7660('0xc3')||_0x542b77===_0x7660('0xc4')||_0x542b77===_0x7660('0xc5')||_0x542b77===_0x7660('0xc6')||_0x542b77==='StateAttributeMetadata'||_0x542b77===_0x7660('0xc7')){_0x16db14[_0x7660('0xbb')](getInputList(_0x25028b,_0x5debc6,_0x542b77,_0x19c94a,_0x30fb72[_0x7660('0xb1')],_0xe06de1[_0x7660('0xb1')],_0x333d18));}}});return Promise[_0x7660('0xbc')](_0x16db14);})[_0x7660('0x1c')](function(_0x5ab491){_0x1345b9=_0x5ab491[0x0];var _0x247493=_0x1016b6[_0x7660('0xa0')](_0x4e039b)[_0x7660('0xa0')](_0x1345b9);var _0x54820={'count':_0x247493['length'],'rows':_0x247493};return _0x54820;})[_0x7660('0x1c')](respondWithResult(_0x4377ed,null))[_0x7660('0x24')](function(_0x3f78e3){var _0x437679=_0x1398d4['query'][_0x7660('0x17')]?0x1f4:_0x3f78e3[_0x7660('0xc8')]||0x1f4;logger[_0x7660('0x21')](_0x3f78e3[_0x7660('0x32')]);delete _0x3f78e3[_0x7660('0x33')];if(_0x437679===0x191){_0x437679=0x190;}_0x4377ed['status'](_0x437679)['send'](_0x1398d4[_0x7660('0x3c')][_0x7660('0x17')]?{'message':_0x7660('0xc9'),'statusCode':_0x3f78e3[_0x7660('0xc8')]}:_0x3f78e3);});};function getSelectList(_0x21ffa7,_0x576c82,_0x490417,_0x14a2d1,_0x5ab853,_0x21592c){var _0x18715b={'method':_0x7660('0xac'),'uri':_0x21ffa7+_0x7660('0xb2')+_0x14a2d1+_0x7660('0xca')+_0x5ab853+_0x7660('0xcb')+_0x7660('0xcc'),'headers':{'Authorization':_0x7660('0xae')+_0x21592c,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0x18715b)[_0x7660('0x1c')](function(_0x3872dd){var _0x35cf08=[];var _0x51b687=_0x3872dd[_0x7660('0xcd')][_0x7660('0xce')];_0x51b687[_0x7660('0xbd')](function(_0x577160){_0x35cf08[_0x7660('0xbb')]({'name':_0x577160[_0x7660('0xcf')][_0x7660('0xd0')]['Label'],'value':String(_0x577160[_0x7660('0xd1')])});});var _0x4e4f5d={'id':_0x576c82+'_'+_0x3872dd[_0x7660('0xd2')],'name':_0x3872dd[_0x7660('0xd3')]['UserLocalizedLabel'][_0x7660('0xcf')],'custom':![],'options':_0x35cf08};_0x490417['push'](_0x4e4f5d);return _0x490417;});}function getBooleanList(_0x53894a,_0x3db016,_0x24764d,_0x1e634f,_0x526311,_0x350b91){var _0x92593c={'method':_0x7660('0xac'),'uri':_0x53894a+_0x7660('0xb2')+_0x1e634f+_0x7660('0xca')+_0x526311+_0x7660('0xd4'),'headers':{'Authorization':'Bearer\x20'+_0x350b91,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0x92593c)[_0x7660('0x1c')](function(_0x5e6d36){var _0x1a356b=[];_0x1a356b[_0x7660('0xbb')]({'name':_0x5e6d36['OptionSet'][_0x7660('0xd5')][_0x7660('0xcf')]['UserLocalizedLabel'][_0x7660('0xcf')],'value':_0x7660('0xd6')},{'name':_0x5e6d36[_0x7660('0xcd')][_0x7660('0xd7')][_0x7660('0xcf')][_0x7660('0xd0')]['Label'],'value':_0x7660('0xd8')});var _0x473d99={'id':_0x3db016+'_'+_0x5e6d36[_0x7660('0xd2')],'name':_0x5e6d36[_0x7660('0xd3')][_0x7660('0xd0')][_0x7660('0xcf')],'custom':![],'options':_0x1a356b};_0x24764d['push'](_0x473d99);return _0x24764d;});}function getInputList(_0x5d6dde,_0x568dee,_0x5dec9c,_0x4ee4b1,_0x4fceeb,_0xadd8ea,_0x42be41){var _0x32fd96={'method':'GET','uri':_0x5d6dde+_0x7660('0xb2')+_0x4fceeb+_0x7660('0xca')+_0xadd8ea+')/Microsoft.Dynamics.CRM.'+_0x5dec9c+_0x7660('0xd9'),'headers':{'Authorization':'Bearer\x20'+_0x42be41,'If-None-Match':null,'OData-Version':_0x7660('0xaf')},'json':!![]};return rp(_0x32fd96)['then'](function(_0x43978e){var _0x290875={'id':_0x568dee+'_'+_0x43978e['LogicalName'],'name':_0x43978e[_0x7660('0xd3')][_0x7660('0xd0')]?_0x43978e[_0x7660('0xd3')]['UserLocalizedLabel'][_0x7660('0xcf')]:_0x43978e[_0x7660('0xd2')],'custom':![],'options':[]};_0x4ee4b1[_0x7660('0xbb')](_0x290875);return _0x4ee4b1;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 19244c9..f91f73e 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 _0xb9e7=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define','Dynamics365Account','int_dynamics365_accounts','util'];(function(_0x444e1e,_0x27b3bf){var _0x1d190a=function(_0x4efaab){while(--_0x4efaab){_0x444e1e['push'](_0x444e1e['shift']());}};_0x1d190a(++_0x27b3bf);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xb9e7[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require('lodash');var util=require(_0x7b9e('0x0'));var logger=require(_0x7b9e('0x1'))(_0x7b9e('0x2'));var moment=require(_0x7b9e('0x3'));var BPromise=require(_0x7b9e('0x4'));var rp=require(_0x7b9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b9e('0x6'));var config=require(_0x7b9e('0x7'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x7b9e('0x8'));module['exports']=function(_0x3a9c5e,_0x3e7ea3){return _0x3a9c5e[_0x7b9e('0x9')](_0x7b9e('0xa'),attributes,{'tableName':_0x7b9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3c8=['define','Dynamics365Account','int_dynamics365_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0xa265ca,_0x2ff07c){var _0x3a50ef=function(_0x5255f1){while(--_0x5255f1){_0xa265ca['push'](_0xa265ca['shift']());}};_0x3a50ef(++_0x2ff07c);}(_0xd3c8,0x161));var _0x8d3c=function(_0x4998b3,_0x3cd673){_0x4998b3=_0x4998b3-0x0;var _0x225977=_0xd3c8[_0x4998b3];return _0x225977;};'use strict';var _=require(_0x8d3c('0x0'));var util=require(_0x8d3c('0x1'));var logger=require(_0x8d3c('0x2'))(_0x8d3c('0x3'));var moment=require(_0x8d3c('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d3c('0x5'));var fs=require('fs');var path=require(_0x8d3c('0x6'));var rimraf=require(_0x8d3c('0x7'));var config=require(_0x8d3c('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x8d3c('0x9'));module[_0x8d3c('0xa')]=function(_0x103825,_0x37d7b4){return _0x103825[_0x8d3c('0xb')](_0x8d3c('0xc'),attributes,{'tableName':_0x8d3c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 75ab0b1..4e05bd8 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 _0x9541=['message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','include','map','model','stringify','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','result'];(function(_0x1d7b73,_0x61e140){var _0x55d329=function(_0x1a354b){while(--_0x1a354b){_0x1d7b73['push'](_0x1d7b73['shift']());}};_0x55d329(++_0x61e140);}(_0x9541,0xb3));var _0x1954=function(_0x2c4672,_0x17da5f){_0x2c4672=_0x2c4672-0x0;var _0x1317c2=_0x9541[_0x2c4672];return _0x1317c2;};'use strict';var _=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var moment=require(_0x1954('0x2'));var BPromise=require(_0x1954('0x3'));var rs=require(_0x1954('0x4'));var fs=require('fs');var Redis=require(_0x1954('0x5'));var db=require(_0x1954('0x6'))['db'];var utils=require(_0x1954('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1954('0x8'));var jayson=require(_0x1954('0x9'));var client=jayson['client'][_0x1954('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21ceca,_0x30beea,_0x2ccff8){return new BPromise(function(_0xda7a2f,_0xa7a784){return client['request'](_0x21ceca,_0x2ccff8)[_0x1954('0xb')](function(_0x2f2c4b){logger[_0x1954('0xc')](_0x1954('0xd'),_0x30beea,_0x1954('0xe'));logger[_0x1954('0xf')](_0x1954('0x10'),_0x30beea,_0x1954('0xe'),JSON['stringify'](_0x2f2c4b));if(_0x2f2c4b[_0x1954('0x11')]){if(_0x2f2c4b[_0x1954('0x11')]['code']===0x1f4){logger[_0x1954('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x30beea,_0x2f2c4b[_0x1954('0x11')]['message']);return _0xa7a784(_0x2f2c4b['error']['message']);}logger[_0x1954('0x11')](_0x1954('0xd'),_0x30beea,_0x2f2c4b[_0x1954('0x11')]['message']);return _0xda7a2f(_0x2f2c4b[_0x1954('0x11')]['message']);}else{logger['info'](_0x1954('0xd'),_0x30beea,_0x1954('0xe'));_0xda7a2f(_0x2f2c4b[_0x1954('0x12')][_0x1954('0x13')]);}})[_0x1954('0x14')](function(_0x37f4fc){logger[_0x1954('0x11')](_0x1954('0xd'),_0x30beea,_0x37f4fc);_0xa7a784(_0x37f4fc);});});}exports[_0x1954('0x15')]=function(_0xb9c2cd){var _0xc8cb0b=this;return new Promise(function(_0x3da757,_0x16b8b1){return db[_0x1954('0x16')][_0x1954('0x17')]({'raw':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')][_0x1954('0x19')]===undefined?!![]:![]:!![],'where':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')]['where']||null:null,'attributes':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')][_0x1954('0x1a')]||null:null,'limit':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')]['limit']||null:null,'include':_0xb9c2cd[_0x1954('0x18')]?_0xb9c2cd[_0x1954('0x18')][_0x1954('0x1b')]?_[_0x1954('0x1c')](_0xb9c2cd[_0x1954('0x18')]['include'],function(_0x4d1b25){return{'model':db[_0x4d1b25[_0x1954('0x1d')]],'as':_0x4d1b25['as'],'attributes':_0x4d1b25[_0x1954('0x1a')],'include':_0x4d1b25[_0x1954('0x1b')]?_[_0x1954('0x1c')](_0x4d1b25['include'],function(_0x21f395){return{'model':db[_0x21f395[_0x1954('0x1d')]],'as':_0x21f395['as'],'attributes':_0x21f395[_0x1954('0x1a')],'include':_0x21f395[_0x1954('0x1b')]?_[_0x1954('0x1c')](_0x21f395[_0x1954('0x1b')],function(_0x46fdc1){return{'model':db[_0x46fdc1['model']],'as':_0x46fdc1['as'],'attributes':_0x46fdc1[_0x1954('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1954('0xb')](function(_0x513917){logger[_0x1954('0xc')](_0x1954('0x15'),_0xb9c2cd);logger[_0x1954('0xf')](_0x1954('0x15'),_0xb9c2cd,JSON[_0x1954('0x1e')](_0x513917));_0x3da757(_0x513917);})[_0x1954('0x14')](function(_0x41b143){logger[_0x1954('0x11')](_0x1954('0x15'),_0x41b143[_0x1954('0x13')],_0xb9c2cd);_0x16b8b1(_0xc8cb0b[_0x1954('0x11')](0x1f4,_0x41b143[_0x1954('0x13')]));});});};exports[_0x1954('0x1f')]=function(_0x22509c){var _0x228a57=this;return new Promise(function(_0x26b1db,_0x24cc47){return db[_0x1954('0x16')][_0x1954('0x20')]({'raw':_0x22509c[_0x1954('0x18')]?_0x22509c[_0x1954('0x18')][_0x1954('0x19')]===undefined?!![]:![]:!![],'where':_0x22509c[_0x1954('0x18')]?_0x22509c[_0x1954('0x18')]['where']||null:null,'attributes':_0x22509c['options']?_0x22509c[_0x1954('0x18')]['attributes']||null:null,'include':_0x22509c[_0x1954('0x18')]?_0x22509c[_0x1954('0x18')]['include']?_[_0x1954('0x1c')](_0x22509c[_0x1954('0x18')]['include'],function(_0x55ec43){return{'model':db[_0x55ec43[_0x1954('0x1d')]],'as':_0x55ec43['as'],'attributes':_0x55ec43[_0x1954('0x1a')],'include':_0x55ec43[_0x1954('0x1b')]?_[_0x1954('0x1c')](_0x55ec43[_0x1954('0x1b')],function(_0x316dc8){return{'model':db[_0x316dc8[_0x1954('0x1d')]],'as':_0x316dc8['as'],'attributes':_0x316dc8['attributes'],'include':_0x316dc8['include']?_[_0x1954('0x1c')](_0x316dc8[_0x1954('0x1b')],function(_0x1bbe28){return{'model':db[_0x1bbe28[_0x1954('0x1d')]],'as':_0x1bbe28['as'],'attributes':_0x1bbe28[_0x1954('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1954('0xb')](function(_0x5d235f){logger[_0x1954('0xc')](_0x1954('0x1f'),_0x22509c);logger['debug'](_0x1954('0x1f'),_0x22509c,JSON[_0x1954('0x1e')](_0x5d235f));_0x26b1db(_0x5d235f);})['catch'](function(_0x580990){logger[_0x1954('0x11')](_0x1954('0x1f'),_0x580990['message'],_0x22509c);_0x24cc47(_0x228a57[_0x1954('0x11')](0x1f4,_0x580990[_0x1954('0x13')]));});});}; \ No newline at end of file +var _0x5c91=['include','map','model','debug','stringify','ShowDynamics365Account','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x5c91,0x1e9));var _0x15c9=function(_0x4f769a,_0x25b20e){_0x4f769a=_0x4f769a-0x0;var _0x5ef724=_0x5c91[_0x4f769a];return _0x5ef724;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var moment=require(_0x15c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x15c9('0x3'));var fs=require('fs');var Redis=require(_0x15c9('0x4'));var db=require(_0x15c9('0x5'))['db'];var utils=require(_0x15c9('0x6'));var logger=require(_0x15c9('0x7'))(_0x15c9('0x8'));var config=require('../../config/environment');var jayson=require(_0x15c9('0x9'));var client=jayson[_0x15c9('0xa')][_0x15c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42bcb6,_0x2c213e,_0x51a779){return new BPromise(function(_0x191695,_0x114775){return client[_0x15c9('0xc')](_0x42bcb6,_0x51a779)['then'](function(_0x23adaf){logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,'request\x20sent');logger['debug'](_0x15c9('0xf'),_0x2c213e,_0x15c9('0x10'),JSON['stringify'](_0x23adaf));if(_0x23adaf['error']){if(_0x23adaf['error'][_0x15c9('0x11')]===0x1f4){logger[_0x15c9('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x2c213e,_0x23adaf[_0x15c9('0x12')][_0x15c9('0x13')]);return _0x114775(_0x23adaf[_0x15c9('0x12')]['message']);}logger['error'](_0x15c9('0xe'),_0x2c213e,_0x23adaf[_0x15c9('0x12')]['message']);return _0x191695(_0x23adaf[_0x15c9('0x12')]['message']);}else{logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x2c213e,_0x15c9('0x10'));_0x191695(_0x23adaf[_0x15c9('0x14')][_0x15c9('0x13')]);}})[_0x15c9('0x15')](function(_0x5eb50e){logger[_0x15c9('0x12')](_0x15c9('0xe'),_0x2c213e,_0x5eb50e);_0x114775(_0x5eb50e);});});}exports[_0x15c9('0x16')]=function(_0x449f20){var _0x2390a4=this;return new Promise(function(_0x2d36e5,_0x1c4b1a){return db[_0x15c9('0x17')]['findAll']({'raw':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x19')]===undefined?!![]:![]:!![],'where':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1a')]||null:null,'attributes':_0x449f20[_0x15c9('0x18')]?_0x449f20['options'][_0x15c9('0x1b')]||null:null,'limit':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1c')]||null:null,'include':_0x449f20[_0x15c9('0x18')]?_0x449f20[_0x15c9('0x18')][_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x449f20[_0x15c9('0x18')][_0x15c9('0x1d')],function(_0x499ae2){return{'model':db[_0x499ae2[_0x15c9('0x1f')]],'as':_0x499ae2['as'],'attributes':_0x499ae2['attributes'],'include':_0x499ae2[_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x499ae2['include'],function(_0x229ae9){return{'model':db[_0x229ae9[_0x15c9('0x1f')]],'as':_0x229ae9['as'],'attributes':_0x229ae9[_0x15c9('0x1b')],'include':_0x229ae9['include']?_['map'](_0x229ae9[_0x15c9('0x1d')],function(_0x3f372b){return{'model':db[_0x3f372b[_0x15c9('0x1f')]],'as':_0x3f372b['as'],'attributes':_0x3f372b[_0x15c9('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12f6ed){logger[_0x15c9('0xd')](_0x15c9('0x16'),_0x449f20);logger[_0x15c9('0x20')](_0x15c9('0x16'),_0x449f20,JSON[_0x15c9('0x21')](_0x12f6ed));_0x2d36e5(_0x12f6ed);})[_0x15c9('0x15')](function(_0x86fd2e){logger['error'](_0x15c9('0x16'),_0x86fd2e[_0x15c9('0x13')],_0x449f20);_0x1c4b1a(_0x2390a4[_0x15c9('0x12')](0x1f4,_0x86fd2e[_0x15c9('0x13')]));});});};exports[_0x15c9('0x22')]=function(_0x201e8b){var _0x411357=this;return new Promise(function(_0x7cf151,_0x32aba4){return db[_0x15c9('0x17')][_0x15c9('0x23')]({'raw':_0x201e8b[_0x15c9('0x18')]?_0x201e8b['options'][_0x15c9('0x19')]===undefined?!![]:![]:!![],'where':_0x201e8b['options']?_0x201e8b[_0x15c9('0x18')]['where']||null:null,'attributes':_0x201e8b[_0x15c9('0x18')]?_0x201e8b[_0x15c9('0x18')][_0x15c9('0x1b')]||null:null,'include':_0x201e8b['options']?_0x201e8b[_0x15c9('0x18')][_0x15c9('0x1d')]?_['map'](_0x201e8b['options'][_0x15c9('0x1d')],function(_0x1c0ad4){return{'model':db[_0x1c0ad4['model']],'as':_0x1c0ad4['as'],'attributes':_0x1c0ad4[_0x15c9('0x1b')],'include':_0x1c0ad4[_0x15c9('0x1d')]?_[_0x15c9('0x1e')](_0x1c0ad4[_0x15c9('0x1d')],function(_0x12649d){return{'model':db[_0x12649d[_0x15c9('0x1f')]],'as':_0x12649d['as'],'attributes':_0x12649d['attributes'],'include':_0x12649d[_0x15c9('0x1d')]?_['map'](_0x12649d[_0x15c9('0x1d')],function(_0x2cddaf){return{'model':db[_0x2cddaf['model']],'as':_0x2cddaf['as'],'attributes':_0x2cddaf[_0x15c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x15c9('0x24')](function(_0x58e57e){logger[_0x15c9('0xd')](_0x15c9('0x22'),_0x201e8b);logger['debug']('ShowDynamics365Account',_0x201e8b,JSON[_0x15c9('0x21')](_0x58e57e));_0x7cf151(_0x58e57e);})[_0x15c9('0x15')](function(_0x4a81d5){logger['error']('ShowDynamics365Account',_0x4a81d5[_0x15c9('0x13')],_0x201e8b);_0x32aba4(_0x411357[_0x15c9('0x12')](0x1f4,_0x4a81d5['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ca9200e..1f66894 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 _0x6c67=['../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2716e1,_0x448036){var _0x4a41d6=function(_0x107a59){while(--_0x107a59){_0x2716e1['push'](_0x2716e1['shift']());}};_0x4a41d6(++_0x448036);}(_0x6c67,0x1f4));var _0x76c6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6c67[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x76c6('0x0'));var util=require(_0x76c6('0x1'));var path=require(_0x76c6('0x2'));var timeout=require(_0x76c6('0x3'));var express=require(_0x76c6('0x4'));var router=express[_0x76c6('0x5')]();var auth=require(_0x76c6('0x6'));var interaction=require(_0x76c6('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x76c6('0x8')]);router['get'](_0x76c6('0x9'),auth[_0x76c6('0xa')](),controller[_0x76c6('0xb')]);router[_0x76c6('0xc')](_0x76c6('0xd'),auth[_0x76c6('0xa')](),controller[_0x76c6('0xe')]);router[_0x76c6('0xc')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x76c6('0xf')]);router['get'](_0x76c6('0x10'),auth[_0x76c6('0xa')](),controller[_0x76c6('0x11')]);router['post']('/',auth[_0x76c6('0xa')](),controller[_0x76c6('0x12')]);router['put']('/:id',auth[_0x76c6('0xa')](),controller[_0x76c6('0x13')]);router[_0x76c6('0x14')](_0x76c6('0x9'),auth[_0x76c6('0xa')](),controller['destroy']);module[_0x76c6('0x15')]=router; \ No newline at end of file +var _0xdc31=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util'];(function(_0x32a979,_0x209a70){var _0x53c276=function(_0x5e7e6d){while(--_0x5e7e6d){_0x32a979['push'](_0x32a979['shift']());}};_0x53c276(++_0x209a70);}(_0xdc31,0xdf));var _0x1dc3=function(_0x26ad69,_0x5c1e3f){_0x26ad69=_0x26ad69-0x0;var _0x4a8fda=_0xdc31[_0x26ad69];return _0x4a8fda;};'use strict';var multer=require(_0x1dc3('0x0'));var util=require(_0x1dc3('0x1'));var path=require(_0x1dc3('0x2'));var timeout=require(_0x1dc3('0x3'));var express=require(_0x1dc3('0x4'));var router=express[_0x1dc3('0x5')]();var auth=require(_0x1dc3('0x6'));var interaction=require(_0x1dc3('0x7'));var config=require(_0x1dc3('0x8'));var controller=require(_0x1dc3('0x9'));router['get']('/',auth[_0x1dc3('0xa')](),controller['index']);router[_0x1dc3('0xb')]('/:id',auth[_0x1dc3('0xa')](),controller[_0x1dc3('0xc')]);router['get'](_0x1dc3('0xd'),auth[_0x1dc3('0xa')](),controller[_0x1dc3('0xe')]);router[_0x1dc3('0xb')](_0x1dc3('0xf'),auth[_0x1dc3('0xa')](),controller[_0x1dc3('0x10')]);router['get'](_0x1dc3('0x11'),auth[_0x1dc3('0xa')](),controller[_0x1dc3('0x12')]);router[_0x1dc3('0x13')]('/',auth[_0x1dc3('0xa')](),controller[_0x1dc3('0x14')]);router[_0x1dc3('0x15')]('/:id',auth[_0x1dc3('0xa')](),controller[_0x1dc3('0x16')]);router[_0x1dc3('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x1dc3('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0ef60fd..2be0566 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 _0x6210=['sequelize','exports','STRING','ENUM','incident'];(function(_0x16b1ee,_0x1bfa03){var _0x133d4c=function(_0x526034){while(--_0x526034){_0x16b1ee['push'](_0x16b1ee['shift']());}};_0x133d4c(++_0x1bfa03);}(_0x6210,0x13b));var _0x0621=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x6210[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0x0621('0x0'));module[_0x0621('0x1')]={'name':{'type':Sequelize[_0x0621('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x0621('0x3')](_0x0621('0x4'),'phonecall'),'defaultValue':_0x0621('0x4')}}; \ No newline at end of file +var _0xd126=['sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x41ba03,_0x211771){var _0x180cae=function(_0x30a975){while(--_0x30a975){_0x41ba03['push'](_0x41ba03['shift']());}};_0x180cae(++_0x211771);}(_0xd126,0x162));var _0x6d12=function(_0x4eaa9c,_0x3a879a){_0x4eaa9c=_0x4eaa9c-0x0;var _0x46b796=_0xd126[_0x4eaa9c];return _0x46b796;};'use strict';var Sequelize=require(_0x6d12('0x0'));module[_0x6d12('0x1')]={'name':{'type':Sequelize[_0x6d12('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x6d12('0x3')](_0x6d12('0x4'),_0x6d12('0x5')),'defaultValue':_0x6d12('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1bdb344..9420493 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 _0x7c38=['filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','Dynamics365Configuration','includeAll','findAll','rows','catch','show','params','fields','include','merge','find','create','body','getFields','hasOwnProperty','getSubjects','Dynamics365Field','getDescriptions','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','model','query','keys'];(function(_0x4bc6c1,_0x5519d0){var _0x2270ab=function(_0x4a423b){while(--_0x4a423b){_0x4bc6c1['push'](_0x4bc6c1['shift']());}};_0x2270ab(++_0x5519d0);}(_0x7c38,0x1a8));var _0x87c3=function(_0x3756e9,_0x23ea1a){_0x3756e9=_0x3756e9-0x0;var _0x86d411=_0x7c38[_0x3756e9];return _0x86d411;};'use strict';var pdf=require(_0x87c3('0x0'));var emlformat=require(_0x87c3('0x1'));var rimraf=require(_0x87c3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x87c3('0x3'));var rp=require(_0x87c3('0x4'));var moment=require(_0x87c3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x87c3('0x6'));var util=require(_0x87c3('0x7'));var path=require(_0x87c3('0x8'));var sox=require(_0x87c3('0x9'));var csv=require(_0x87c3('0xa'));var ejs=require(_0x87c3('0xb'));var fs=require('fs');var _=require(_0x87c3('0xc'));var squel=require(_0x87c3('0xd'));var crypto=require(_0x87c3('0xe'));var jsforce=require(_0x87c3('0xf'));var deskjs=require(_0x87c3('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x87c3('0x11'));var Redis=require('ioredis');var authService=require(_0x87c3('0x12'));var qs=require(_0x87c3('0x13'));var as=require(_0x87c3('0x14'));var hardwareService=require(_0x87c3('0x15'));var logger=require(_0x87c3('0x16'))(_0x87c3('0x17'));var utils=require(_0x87c3('0x18'));var config=require(_0x87c3('0x19'));var db=require(_0x87c3('0x1a'))['db'];var jayson=require(_0x87c3('0x1b'));var client=jayson[_0x87c3('0x1c')][_0x87c3('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x54d69e,_0xfcb357,_0x1f8103){if(_0x1f8103){var _0x313bda=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x313bda['test'](_0xfcb357)){return _0x54d69e;}else{throw new db[(_0x87c3('0x1e'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x54d69e;}}function respondWithRpcPromise(_0x18b953,_0x413e85,_0x56cf72,_0x1af5f7){return new BPromise(function(_0x5a851c,_0x291028){var _0x145a52=_0x1af5f7||client;return _0x145a52[_0x87c3('0x1f')](_0x18b953,_0x56cf72)[_0x87c3('0x20')](function(_0x452327){logger[_0x87c3('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x413e85,_0x87c3('0x22'));logger[_0x87c3('0x23')](_0x87c3('0x24'),_0x413e85,_0x87c3('0x22'),JSON[_0x87c3('0x25')](_0x452327));if(_0x452327[_0x87c3('0x26')]){if(_0x452327[_0x87c3('0x26')][_0x87c3('0x27')]===0x1f4){logger[_0x87c3('0x26')](_0x87c3('0x28'),_0x413e85,_0x452327[_0x87c3('0x26')][_0x87c3('0x29')]);return _0x291028(_0x452327['error'][_0x87c3('0x29')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x413e85,_0x452327[_0x87c3('0x26')][_0x87c3('0x29')]);return _0x5a851c(_0x452327[_0x87c3('0x26')][_0x87c3('0x29')]);}else{logger[_0x87c3('0x21')](_0x87c3('0x28'),_0x413e85,'request\x20sent');_0x5a851c(_0x452327[_0x87c3('0x2a')][_0x87c3('0x29')]);}})['catch'](function(_0x5094c5){logger[_0x87c3('0x26')](_0x87c3('0x28'),_0x413e85,_0x5094c5);_0x291028(_0x5094c5);});});}function respondWithStatusCode(_0x25735b,_0x153079){_0x153079=_0x153079||0xcc;return function(_0x1e55af){if(_0x1e55af){return _0x25735b[_0x87c3('0x2b')](_0x153079);}return _0x25735b[_0x87c3('0x2c')](_0x153079)[_0x87c3('0x2d')]();};}function respondWithResult(_0x5080bb,_0x1de26d){_0x1de26d=_0x1de26d||0xc8;return function(_0x29ed01){if(_0x29ed01){return _0x5080bb[_0x87c3('0x2c')](_0x1de26d)[_0x87c3('0x2e')](_0x29ed01);}};}function respondWithFilteredResult(_0x2e0f30,_0x59522b){return function(_0x2ee0d4){if(_0x2ee0d4){var _0x423587=_0x2ee0d4[_0x87c3('0x2f')],_0x15cb5e=_0x59522b[_0x87c3('0x30')],_0x32cfbc=_0x59522b[_0x87c3('0x30')]+_0x59522b[_0x87c3('0x31')],_0xd96601;if(_0x32cfbc>=_0x423587){_0x32cfbc=_0x423587;_0xd96601=0xc8;}else{_0xd96601=0xce;}_0x2e0f30[_0x87c3('0x2c')](_0xd96601);return _0x2e0f30[_0x87c3('0x32')](_0x87c3('0x33'),_0x15cb5e+'-'+_0x32cfbc+'/'+_0x423587)['json'](_0x2ee0d4);}return null;};}function patchUpdates(_0x2af42e){return function(_0x3f88c0){try{jsonpatch[_0x87c3('0x34')](_0x3f88c0,_0x2af42e,!![]);}catch(_0x1a88cb){return BPromise[_0x87c3('0x35')](_0x1a88cb);}return _0x3f88c0[_0x87c3('0x36')]();};}function saveUpdates(_0x14fa91,_0x3de82b){return function(_0x5e1dce){if(_0x5e1dce){return _0x5e1dce[_0x87c3('0x37')](_0x14fa91)[_0x87c3('0x20')](function(_0x15e362){return _0x15e362;});}return null;};}function removeEntity(_0x5b850e,_0x38a45b){return function(_0x52395e){if(_0x52395e){return _0x52395e[_0x87c3('0x38')]()[_0x87c3('0x20')](function(){_0x5b850e[_0x87c3('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28bc0e,_0x3316a5){return function(_0x5f16cb){if(!_0x5f16cb){_0x28bc0e[_0x87c3('0x2b')](0x194);}return _0x5f16cb;};}function handleError(_0x30c6d6,_0x309677){_0x309677=_0x309677||0x1f4;return function(_0x206b36){logger[_0x87c3('0x26')](_0x206b36['stack']);if(_0x206b36['name']){delete _0x206b36[_0x87c3('0x39')];}_0x30c6d6[_0x87c3('0x2c')](_0x309677)[_0x87c3('0x3a')](_0x206b36);};}exports[_0x87c3('0x3b')]=function(_0x4afeed,_0x40634c){var _0x6935e8={},_0x39187b={},_0x11ebc8={'count':0x0,'rows':[]};var _0x363f5a=_[_0x87c3('0x3c')](db['Dynamics365Configuration'][_0x87c3('0x3d')],function(_0x3769e7){return{'name':_0x3769e7[_0x87c3('0x3e')],'type':_0x3769e7['type']['key']};});_0x39187b[_0x87c3('0x3f')]=_['map'](_0x363f5a,_0x87c3('0x39'));_0x39187b[_0x87c3('0x40')]=_[_0x87c3('0x41')](_0x4afeed[_0x87c3('0x40')]);_0x39187b[_0x87c3('0x42')]=_[_0x87c3('0x43')](_0x39187b[_0x87c3('0x3f')],_0x39187b[_0x87c3('0x40')]);_0x6935e8['attributes']=_[_0x87c3('0x43')](_0x39187b[_0x87c3('0x3f')],qs['fields'](_0x4afeed[_0x87c3('0x40')]['fields']));_0x6935e8['attributes']=_0x6935e8[_0x87c3('0x44')][_0x87c3('0x45')]?_0x6935e8['attributes']:_0x39187b['model'];if(!_0x4afeed[_0x87c3('0x40')]['hasOwnProperty'](_0x87c3('0x46'))){_0x6935e8['limit']=qs[_0x87c3('0x31')](_0x4afeed['query'][_0x87c3('0x31')]);_0x6935e8[_0x87c3('0x30')]=qs[_0x87c3('0x30')](_0x4afeed[_0x87c3('0x40')][_0x87c3('0x30')]);}_0x6935e8[_0x87c3('0x47')]=qs['sort'](_0x4afeed[_0x87c3('0x40')][_0x87c3('0x48')]);_0x6935e8[_0x87c3('0x49')]=qs[_0x87c3('0x42')](_[_0x87c3('0x4a')](_0x4afeed[_0x87c3('0x40')],_0x39187b['filters']),_0x363f5a);if(_0x4afeed[_0x87c3('0x40')][_0x87c3('0x4b')]){_0x6935e8[_0x87c3('0x49')]=_['merge'](_0x6935e8[_0x87c3('0x49')],{'$or':_[_0x87c3('0x3c')](_0x363f5a,function(_0x4614d5){if(_0x4614d5[_0x87c3('0x4c')]!==_0x87c3('0x4d')){var _0x5afc59={};_0x5afc59[_0x4614d5['name']]={'$like':'%'+_0x4afeed['query'][_0x87c3('0x4b')]+'%'};return _0x5afc59;}})});}_0x6935e8=_['merge']({},_0x6935e8,_0x4afeed[_0x87c3('0x4e')]);var _0x263027={'where':_0x6935e8['where']};return db[_0x87c3('0x4f')][_0x87c3('0x2f')](_0x263027)[_0x87c3('0x20')](function(_0x54415e){_0x11ebc8[_0x87c3('0x2f')]=_0x54415e;if(_0x4afeed['query'][_0x87c3('0x50')]){_0x6935e8['include']=[{'all':!![]}];}return db[_0x87c3('0x4f')][_0x87c3('0x51')](_0x6935e8);})[_0x87c3('0x20')](function(_0x5c6765){_0x11ebc8[_0x87c3('0x52')]=_0x5c6765;return _0x11ebc8;})[_0x87c3('0x20')](respondWithFilteredResult(_0x40634c,_0x6935e8))[_0x87c3('0x53')](handleError(_0x40634c,null));};exports[_0x87c3('0x54')]=function(_0x3eff0b,_0x4889ec){var _0x1b927f={'raw':![],'where':{'id':_0x3eff0b[_0x87c3('0x55')]['id']}},_0x431645={};_0x431645['model']=_[_0x87c3('0x41')](db[_0x87c3('0x4f')]['rawAttributes']);_0x431645['query']=_[_0x87c3('0x41')](_0x3eff0b[_0x87c3('0x40')]);_0x431645[_0x87c3('0x42')]=_[_0x87c3('0x43')](_0x431645[_0x87c3('0x3f')],_0x431645[_0x87c3('0x40')]);_0x1b927f[_0x87c3('0x44')]=_[_0x87c3('0x43')](_0x431645[_0x87c3('0x3f')],qs[_0x87c3('0x56')](_0x3eff0b[_0x87c3('0x40')][_0x87c3('0x56')]));_0x1b927f['attributes']=_0x1b927f[_0x87c3('0x44')]['length']?_0x1b927f[_0x87c3('0x44')]:_0x431645[_0x87c3('0x3f')];if(_0x3eff0b[_0x87c3('0x40')][_0x87c3('0x50')]){_0x1b927f[_0x87c3('0x57')]=[{'all':!![]}];}_0x1b927f=_[_0x87c3('0x58')]({},_0x1b927f,_0x3eff0b[_0x87c3('0x4e')]);return db['Dynamics365Configuration'][_0x87c3('0x59')](_0x1b927f)[_0x87c3('0x20')](handleEntityNotFound(_0x4889ec,null))[_0x87c3('0x20')](respondWithResult(_0x4889ec,null))['catch'](handleError(_0x4889ec,null));};exports[_0x87c3('0x5a')]=function(_0xf322c5,_0x3760ae){return db[_0x87c3('0x4f')][_0x87c3('0x5a')](_0xf322c5[_0x87c3('0x5b')],{})[_0x87c3('0x20')](respondWithResult(_0x3760ae,0xc9))[_0x87c3('0x53')](handleError(_0x3760ae,null));};exports[_0x87c3('0x37')]=function(_0x1e333d,_0x58f798){if(_0x1e333d[_0x87c3('0x5b')]['id']){delete _0x1e333d[_0x87c3('0x5b')]['id'];}return db[_0x87c3('0x4f')][_0x87c3('0x59')]({'where':{'id':_0x1e333d[_0x87c3('0x55')]['id']}})['then'](handleEntityNotFound(_0x58f798,null))['then'](saveUpdates(_0x1e333d[_0x87c3('0x5b')],null))[_0x87c3('0x20')](respondWithResult(_0x58f798,null))['catch'](handleError(_0x58f798,null));};exports[_0x87c3('0x38')]=function(_0x1836c9,_0x379ea3){return db['Dynamics365Configuration'][_0x87c3('0x59')]({'where':{'id':_0x1836c9[_0x87c3('0x55')]['id']}})['then'](handleEntityNotFound(_0x379ea3,null))[_0x87c3('0x20')](removeEntity(_0x379ea3,null))[_0x87c3('0x53')](handleError(_0x379ea3,null));};exports[_0x87c3('0x5c')]=function(_0x524759,_0x113298,_0x21f705){var _0x4c589b={};var _0x3d918d={};var _0x3a6cdf;var _0x1eccd4;return db[_0x87c3('0x4f')]['findOne']({'where':{'id':_0x524759[_0x87c3('0x55')]['id']}})[_0x87c3('0x20')](handleEntityNotFound(_0x113298,null))[_0x87c3('0x20')](function(_0x595185){if(_0x595185){_0x3a6cdf=_0x595185;_0x3d918d[_0x87c3('0x3f')]=_[_0x87c3('0x41')](db['Dynamics365Field'][_0x87c3('0x3d')]);_0x3d918d[_0x87c3('0x40')]=_['keys'](_0x524759[_0x87c3('0x40')]);_0x3d918d[_0x87c3('0x42')]=_['intersection'](_0x3d918d[_0x87c3('0x3f')],_0x3d918d['query']);_0x4c589b[_0x87c3('0x44')]=_['intersection'](_0x3d918d[_0x87c3('0x3f')],qs[_0x87c3('0x56')](_0x524759[_0x87c3('0x40')]['fields']));_0x4c589b[_0x87c3('0x44')]=_0x4c589b[_0x87c3('0x44')][_0x87c3('0x45')]?_0x4c589b[_0x87c3('0x44')]:_0x3d918d[_0x87c3('0x3f')];_0x4c589b[_0x87c3('0x47')]=qs['sort'](_0x524759[_0x87c3('0x40')]['sort']);_0x4c589b[_0x87c3('0x49')]=qs[_0x87c3('0x42')](_[_0x87c3('0x4a')](_0x524759[_0x87c3('0x40')],_0x3d918d[_0x87c3('0x42')]));if(_0x524759[_0x87c3('0x40')][_0x87c3('0x4b')]){_0x4c589b[_0x87c3('0x49')]=_[_0x87c3('0x58')](_0x4c589b[_0x87c3('0x49')],{'$or':_[_0x87c3('0x3c')](_0x4c589b[_0x87c3('0x44')],function(_0x960185){var _0x527109={};_0x527109[_0x960185]={'$like':'%'+_0x524759['query'][_0x87c3('0x4b')]+'%'};return _0x527109;})});}_0x4c589b=_[_0x87c3('0x58')]({},_0x4c589b,_0x524759[_0x87c3('0x4e')]);return _0x3a6cdf[_0x87c3('0x5c')](_0x4c589b);}})[_0x87c3('0x20')](function(_0x2a355e){if(_0x2a355e){_0x1eccd4=_0x2a355e[_0x87c3('0x45')];if(!_0x524759[_0x87c3('0x40')][_0x87c3('0x5d')](_0x87c3('0x46'))){_0x4c589b[_0x87c3('0x31')]=qs[_0x87c3('0x31')](_0x524759['query'][_0x87c3('0x31')]);_0x4c589b[_0x87c3('0x30')]=qs['offset'](_0x524759[_0x87c3('0x40')][_0x87c3('0x30')]);}return _0x3a6cdf[_0x87c3('0x5c')](_0x4c589b);}})[_0x87c3('0x20')](function(_0x78fea1){if(_0x78fea1){return _0x78fea1?{'count':_0x1eccd4,'rows':_0x78fea1}:null;}})['then'](respondWithResult(_0x113298,null))[_0x87c3('0x53')](handleError(_0x113298,null));};exports[_0x87c3('0x5e')]=function(_0x18b043,_0x543131,_0x4b3d20){var _0x457a8d={};var _0xd4988c={};var _0x1d0637;var _0x389f41;return db[_0x87c3('0x4f')]['findOne']({'where':{'id':_0x18b043[_0x87c3('0x55')]['id']}})[_0x87c3('0x20')](handleEntityNotFound(_0x543131,null))[_0x87c3('0x20')](function(_0x2d24a5){if(_0x2d24a5){_0x1d0637=_0x2d24a5;_0xd4988c[_0x87c3('0x3f')]=_[_0x87c3('0x41')](db[_0x87c3('0x5f')][_0x87c3('0x3d')]);_0xd4988c[_0x87c3('0x40')]=_[_0x87c3('0x41')](_0x18b043[_0x87c3('0x40')]);_0xd4988c['filters']=_[_0x87c3('0x43')](_0xd4988c[_0x87c3('0x3f')],_0xd4988c['query']);_0x457a8d[_0x87c3('0x44')]=_[_0x87c3('0x43')](_0xd4988c[_0x87c3('0x3f')],qs[_0x87c3('0x56')](_0x18b043[_0x87c3('0x40')][_0x87c3('0x56')]));_0x457a8d[_0x87c3('0x44')]=_0x457a8d[_0x87c3('0x44')][_0x87c3('0x45')]?_0x457a8d[_0x87c3('0x44')]:_0xd4988c[_0x87c3('0x3f')];_0x457a8d['order']=qs[_0x87c3('0x48')](_0x18b043[_0x87c3('0x40')][_0x87c3('0x48')]);_0x457a8d[_0x87c3('0x49')]=qs[_0x87c3('0x42')](_[_0x87c3('0x4a')](_0x18b043[_0x87c3('0x40')],_0xd4988c['filters']));if(_0x18b043[_0x87c3('0x40')][_0x87c3('0x4b')]){_0x457a8d['where']=_[_0x87c3('0x58')](_0x457a8d[_0x87c3('0x49')],{'$or':_['map'](_0x457a8d[_0x87c3('0x44')],function(_0x27247c){var _0x5699e5={};_0x5699e5[_0x27247c]={'$like':'%'+_0x18b043[_0x87c3('0x40')][_0x87c3('0x4b')]+'%'};return _0x5699e5;})});}_0x457a8d=_['merge']({},_0x457a8d,_0x18b043[_0x87c3('0x4e')]);return _0x1d0637[_0x87c3('0x5e')](_0x457a8d);}})[_0x87c3('0x20')](function(_0x3f798a){if(_0x3f798a){_0x389f41=_0x3f798a[_0x87c3('0x45')];if(!_0x18b043[_0x87c3('0x40')][_0x87c3('0x5d')](_0x87c3('0x46'))){_0x457a8d[_0x87c3('0x31')]=qs['limit'](_0x18b043[_0x87c3('0x40')][_0x87c3('0x31')]);_0x457a8d[_0x87c3('0x30')]=qs[_0x87c3('0x30')](_0x18b043[_0x87c3('0x40')]['offset']);}return _0x1d0637[_0x87c3('0x5e')](_0x457a8d);}})[_0x87c3('0x20')](function(_0x2ff428){if(_0x2ff428){return _0x2ff428?{'count':_0x389f41,'rows':_0x2ff428}:null;}})[_0x87c3('0x20')](respondWithResult(_0x543131,null))[_0x87c3('0x53')](handleError(_0x543131,null));};exports[_0x87c3('0x60')]=function(_0x562998,_0x412cc3,_0x4085b7){var _0x3ba761={};var _0x6c3e4b={};var _0xe96527;var _0x250437;return db[_0x87c3('0x4f')][_0x87c3('0x61')]({'where':{'id':_0x562998['params']['id']}})[_0x87c3('0x20')](handleEntityNotFound(_0x412cc3,null))[_0x87c3('0x20')](function(_0x1cad37){if(_0x1cad37){_0xe96527=_0x1cad37;_0x6c3e4b['model']=_['keys'](db[_0x87c3('0x5f')][_0x87c3('0x3d')]);_0x6c3e4b[_0x87c3('0x40')]=_[_0x87c3('0x41')](_0x562998[_0x87c3('0x40')]);_0x6c3e4b['filters']=_[_0x87c3('0x43')](_0x6c3e4b[_0x87c3('0x3f')],_0x6c3e4b['query']);_0x3ba761[_0x87c3('0x44')]=_[_0x87c3('0x43')](_0x6c3e4b['model'],qs[_0x87c3('0x56')](_0x562998[_0x87c3('0x40')][_0x87c3('0x56')]));_0x3ba761[_0x87c3('0x44')]=_0x3ba761[_0x87c3('0x44')][_0x87c3('0x45')]?_0x3ba761[_0x87c3('0x44')]:_0x6c3e4b[_0x87c3('0x3f')];_0x3ba761[_0x87c3('0x47')]=qs[_0x87c3('0x48')](_0x562998[_0x87c3('0x40')][_0x87c3('0x48')]);_0x3ba761[_0x87c3('0x49')]=qs[_0x87c3('0x42')](_[_0x87c3('0x4a')](_0x562998[_0x87c3('0x40')],_0x6c3e4b[_0x87c3('0x42')]));if(_0x562998[_0x87c3('0x40')][_0x87c3('0x4b')]){_0x3ba761[_0x87c3('0x49')]=_[_0x87c3('0x58')](_0x3ba761['where'],{'$or':_[_0x87c3('0x3c')](_0x3ba761[_0x87c3('0x44')],function(_0x5a5369){var _0x429484={};_0x429484[_0x5a5369]={'$like':'%'+_0x562998[_0x87c3('0x40')]['filter']+'%'};return _0x429484;})});}_0x3ba761=_[_0x87c3('0x58')]({},_0x3ba761,_0x562998[_0x87c3('0x4e')]);return _0xe96527[_0x87c3('0x60')](_0x3ba761);}})[_0x87c3('0x20')](function(_0x38c085){if(_0x38c085){_0x250437=_0x38c085['length'];if(!_0x562998[_0x87c3('0x40')][_0x87c3('0x5d')](_0x87c3('0x46'))){_0x3ba761['limit']=qs[_0x87c3('0x31')](_0x562998[_0x87c3('0x40')][_0x87c3('0x31')]);_0x3ba761[_0x87c3('0x30')]=qs[_0x87c3('0x30')](_0x562998[_0x87c3('0x40')][_0x87c3('0x30')]);}return _0xe96527[_0x87c3('0x60')](_0x3ba761);}})[_0x87c3('0x20')](function(_0x46f374){if(_0x46f374){return _0x46f374?{'count':_0x250437,'rows':_0x46f374}:null;}})[_0x87c3('0x20')](respondWithResult(_0x412cc3,null))[_0x87c3('0x53')](handleError(_0x412cc3,null));}; \ No newline at end of file +var _0x614c=['params','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','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','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','reject','update','destroy','stack','name','index','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','count','includeAll','rows','show'];(function(_0x52921b,_0x30928e){var _0x3a4ed3=function(_0x1c8004){while(--_0x1c8004){_0x52921b['push'](_0x52921b['shift']());}};_0x3a4ed3(++_0x30928e);}(_0x614c,0xbb));var _0xc614=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x614c[_0x462999];return _0x4b1366;};'use strict';var pdf=require(_0xc614('0x0'));var emlformat=require(_0xc614('0x1'));var rimraf=require(_0xc614('0x2'));var zipdir=require(_0xc614('0x3'));var jsonpatch=require(_0xc614('0x4'));var rp=require(_0xc614('0x5'));var moment=require(_0xc614('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc614('0x7'));var path=require('path');var sox=require(_0xc614('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc614('0x9'));var squel=require(_0xc614('0xa'));var crypto=require(_0xc614('0xb'));var jsforce=require(_0xc614('0xc'));var deskjs=require(_0xc614('0xd'));var toCsv=require(_0xc614('0xe'));var querystring=require(_0xc614('0xf'));var Papa=require(_0xc614('0x10'));var Redis=require(_0xc614('0x11'));var authService=require(_0xc614('0x12'));var qs=require(_0xc614('0x13'));var as=require(_0xc614('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc614('0x15'))(_0xc614('0x16'));var utils=require(_0xc614('0x17'));var config=require('../../config/environment');var db=require(_0xc614('0x18'))['db'];var jayson=require(_0xc614('0x19'));var client=jayson[_0xc614('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x5a4f8e,_0x367118,_0x3bf7ca){if(_0x3bf7ca){var _0x2024b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2024b1['test'](_0x367118)){return _0x5a4f8e;}else{throw new db[(_0xc614('0x1b'))][(_0xc614('0x1c'))](_0xc614('0x1d'));}}else{return _0x5a4f8e;}}function respondWithRpcPromise(_0x16aa09,_0x1cb592,_0x3e491c,_0x47a8b6){return new BPromise(function(_0x25a1f0,_0x2f4ca8){var _0x1173f3=_0x47a8b6||client;return _0x1173f3[_0xc614('0x1e')](_0x16aa09,_0x3e491c)[_0xc614('0x1f')](function(_0x4fd890){logger['info'](_0xc614('0x20'),_0x1cb592,'request\x20sent');logger['debug'](_0xc614('0x21'),_0x1cb592,'request\x20sent',JSON[_0xc614('0x22')](_0x4fd890));if(_0x4fd890[_0xc614('0x23')]){if(_0x4fd890[_0xc614('0x23')][_0xc614('0x24')]===0x1f4){logger['error'](_0xc614('0x20'),_0x1cb592,_0x4fd890[_0xc614('0x23')]['message']);return _0x2f4ca8(_0x4fd890['error'][_0xc614('0x25')]);}logger[_0xc614('0x23')](_0xc614('0x20'),_0x1cb592,_0x4fd890[_0xc614('0x23')]['message']);return _0x25a1f0(_0x4fd890[_0xc614('0x23')][_0xc614('0x25')]);}else{logger[_0xc614('0x26')](_0xc614('0x20'),_0x1cb592,_0xc614('0x27'));_0x25a1f0(_0x4fd890[_0xc614('0x28')][_0xc614('0x25')]);}})[_0xc614('0x29')](function(_0x1a8e8a){logger[_0xc614('0x23')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1cb592,_0x1a8e8a);_0x2f4ca8(_0x1a8e8a);});});}function respondWithStatusCode(_0x3ab992,_0xffc179){_0xffc179=_0xffc179||0xcc;return function(_0x3f2148){if(_0x3f2148){return _0x3ab992[_0xc614('0x2a')](_0xffc179);}return _0x3ab992[_0xc614('0x2b')](_0xffc179)[_0xc614('0x2c')]();};}function respondWithResult(_0x1ad912,_0x2ea5cb){_0x2ea5cb=_0x2ea5cb||0xc8;return function(_0x4ff9bb){if(_0x4ff9bb){return _0x1ad912[_0xc614('0x2b')](_0x2ea5cb)[_0xc614('0x2d')](_0x4ff9bb);}};}function respondWithFilteredResult(_0x3fc99e,_0x5653f2){return function(_0x58be49){if(_0x58be49){var _0x49b63e=_0x58be49['count'],_0x123d5f=_0x5653f2[_0xc614('0x2e')],_0x911993=_0x5653f2[_0xc614('0x2e')]+_0x5653f2[_0xc614('0x2f')],_0x5ab8cf;if(_0x911993>=_0x49b63e){_0x911993=_0x49b63e;_0x5ab8cf=0xc8;}else{_0x5ab8cf=0xce;}_0x3fc99e[_0xc614('0x2b')](_0x5ab8cf);return _0x3fc99e['set']('Content-Range',_0x123d5f+'-'+_0x911993+'/'+_0x49b63e)[_0xc614('0x2d')](_0x58be49);}return null;};}function patchUpdates(_0x80b84f){return function(_0x535c15){try{jsonpatch['apply'](_0x535c15,_0x80b84f,!![]);}catch(_0xa3f99d){return BPromise[_0xc614('0x30')](_0xa3f99d);}return _0x535c15['save']();};}function saveUpdates(_0x1d15a7,_0x4700b1){return function(_0x4528f8){if(_0x4528f8){return _0x4528f8[_0xc614('0x31')](_0x1d15a7)[_0xc614('0x1f')](function(_0x1afda4){return _0x1afda4;});}return null;};}function removeEntity(_0x1980b4,_0x18c343){return function(_0x4c7fc6){if(_0x4c7fc6){return _0x4c7fc6[_0xc614('0x32')]()[_0xc614('0x1f')](function(){_0x1980b4[_0xc614('0x2b')](0xcc)[_0xc614('0x2c')]();});}};}function handleEntityNotFound(_0x50a9eb,_0x51a0e6){return function(_0x1c7e98){if(!_0x1c7e98){_0x50a9eb['sendStatus'](0x194);}return _0x1c7e98;};}function handleError(_0x11fd99,_0x573bdc){_0x573bdc=_0x573bdc||0x1f4;return function(_0x3c57a6){logger[_0xc614('0x23')](_0x3c57a6[_0xc614('0x33')]);if(_0x3c57a6[_0xc614('0x34')]){delete _0x3c57a6[_0xc614('0x34')];}_0x11fd99[_0xc614('0x2b')](_0x573bdc)['send'](_0x3c57a6);};}exports[_0xc614('0x35')]=function(_0xbb4660,_0x8761cd){var _0x2129b8={},_0x1ea82b={},_0x23b45b={'count':0x0,'rows':[]};var _0xe7fd6e=_['map'](db['Dynamics365Configuration'][_0xc614('0x36')],function(_0x301b74){return{'name':_0x301b74['fieldName'],'type':_0x301b74['type'][_0xc614('0x37')]};});_0x1ea82b[_0xc614('0x38')]=_[_0xc614('0x39')](_0xe7fd6e,_0xc614('0x34'));_0x1ea82b[_0xc614('0x3a')]=_[_0xc614('0x3b')](_0xbb4660[_0xc614('0x3a')]);_0x1ea82b[_0xc614('0x3c')]=_[_0xc614('0x3d')](_0x1ea82b[_0xc614('0x38')],_0x1ea82b['query']);_0x2129b8['attributes']=_[_0xc614('0x3d')](_0x1ea82b[_0xc614('0x38')],qs[_0xc614('0x3e')](_0xbb4660[_0xc614('0x3a')][_0xc614('0x3e')]));_0x2129b8[_0xc614('0x3f')]=_0x2129b8[_0xc614('0x3f')][_0xc614('0x40')]?_0x2129b8[_0xc614('0x3f')]:_0x1ea82b[_0xc614('0x38')];if(!_0xbb4660[_0xc614('0x3a')][_0xc614('0x41')](_0xc614('0x42'))){_0x2129b8[_0xc614('0x2f')]=qs[_0xc614('0x2f')](_0xbb4660[_0xc614('0x3a')][_0xc614('0x2f')]);_0x2129b8[_0xc614('0x2e')]=qs['offset'](_0xbb4660[_0xc614('0x3a')][_0xc614('0x2e')]);}_0x2129b8[_0xc614('0x43')]=qs[_0xc614('0x44')](_0xbb4660[_0xc614('0x3a')][_0xc614('0x44')]);_0x2129b8[_0xc614('0x45')]=qs[_0xc614('0x3c')](_[_0xc614('0x46')](_0xbb4660[_0xc614('0x3a')],_0x1ea82b['filters']),_0xe7fd6e);if(_0xbb4660[_0xc614('0x3a')][_0xc614('0x47')]){_0x2129b8[_0xc614('0x45')]=_[_0xc614('0x48')](_0x2129b8[_0xc614('0x45')],{'$or':_[_0xc614('0x39')](_0xe7fd6e,function(_0x4a0adb){if(_0x4a0adb['type']!==_0xc614('0x49')){var _0x3147ed={};_0x3147ed[_0x4a0adb[_0xc614('0x34')]]={'$like':'%'+_0xbb4660[_0xc614('0x3a')]['filter']+'%'};return _0x3147ed;}})});}_0x2129b8=_['merge']({},_0x2129b8,_0xbb4660[_0xc614('0x4a')]);var _0x27ec7f={'where':_0x2129b8[_0xc614('0x45')]};return db[_0xc614('0x4b')][_0xc614('0x4c')](_0x27ec7f)[_0xc614('0x1f')](function(_0x3d9c79){_0x23b45b['count']=_0x3d9c79;if(_0xbb4660[_0xc614('0x3a')][_0xc614('0x4d')]){_0x2129b8['include']=[{'all':!![]}];}return db[_0xc614('0x4b')]['findAll'](_0x2129b8);})['then'](function(_0x4365d2){_0x23b45b[_0xc614('0x4e')]=_0x4365d2;return _0x23b45b;})['then'](respondWithFilteredResult(_0x8761cd,_0x2129b8))['catch'](handleError(_0x8761cd,null));};exports[_0xc614('0x4f')]=function(_0x128c48,_0x2307f9){var _0xe1104b={'raw':![],'where':{'id':_0x128c48[_0xc614('0x50')]['id']}},_0xc91c1d={};_0xc91c1d[_0xc614('0x38')]=_['keys'](db[_0xc614('0x4b')][_0xc614('0x36')]);_0xc91c1d[_0xc614('0x3a')]=_['keys'](_0x128c48[_0xc614('0x3a')]);_0xc91c1d['filters']=_[_0xc614('0x3d')](_0xc91c1d[_0xc614('0x38')],_0xc91c1d[_0xc614('0x3a')]);_0xe1104b[_0xc614('0x3f')]=_[_0xc614('0x3d')](_0xc91c1d[_0xc614('0x38')],qs[_0xc614('0x3e')](_0x128c48[_0xc614('0x3a')][_0xc614('0x3e')]));_0xe1104b[_0xc614('0x3f')]=_0xe1104b[_0xc614('0x3f')]['length']?_0xe1104b[_0xc614('0x3f')]:_0xc91c1d['model'];if(_0x128c48[_0xc614('0x3a')]['includeAll']){_0xe1104b['include']=[{'all':!![]}];}_0xe1104b=_[_0xc614('0x48')]({},_0xe1104b,_0x128c48[_0xc614('0x4a')]);return db['Dynamics365Configuration'][_0xc614('0x51')](_0xe1104b)['then'](handleEntityNotFound(_0x2307f9,null))[_0xc614('0x1f')](respondWithResult(_0x2307f9,null))[_0xc614('0x29')](handleError(_0x2307f9,null));};exports[_0xc614('0x52')]=function(_0x4792ee,_0xc6e5d6){return db[_0xc614('0x4b')][_0xc614('0x52')](_0x4792ee[_0xc614('0x53')],{})[_0xc614('0x1f')](respondWithResult(_0xc6e5d6,0xc9))[_0xc614('0x29')](handleError(_0xc6e5d6,null));};exports[_0xc614('0x31')]=function(_0xa25cd9,_0x1504f6){if(_0xa25cd9[_0xc614('0x53')]['id']){delete _0xa25cd9[_0xc614('0x53')]['id'];}return db['Dynamics365Configuration'][_0xc614('0x51')]({'where':{'id':_0xa25cd9[_0xc614('0x50')]['id']}})['then'](handleEntityNotFound(_0x1504f6,null))[_0xc614('0x1f')](saveUpdates(_0xa25cd9[_0xc614('0x53')],null))[_0xc614('0x1f')](respondWithResult(_0x1504f6,null))[_0xc614('0x29')](handleError(_0x1504f6,null));};exports[_0xc614('0x32')]=function(_0x3e29aa,_0x4689ef){return db[_0xc614('0x4b')]['find']({'where':{'id':_0x3e29aa[_0xc614('0x50')]['id']}})['then'](handleEntityNotFound(_0x4689ef,null))[_0xc614('0x1f')](removeEntity(_0x4689ef,null))['catch'](handleError(_0x4689ef,null));};exports[_0xc614('0x54')]=function(_0x4d387f,_0x1b85ed,_0x5575b1){var _0x3723dc={};var _0x4f602c={};var _0x4df7c0;var _0x32a600;return db['Dynamics365Configuration'][_0xc614('0x55')]({'where':{'id':_0x4d387f[_0xc614('0x50')]['id']}})[_0xc614('0x1f')](handleEntityNotFound(_0x1b85ed,null))[_0xc614('0x1f')](function(_0x562f4d){if(_0x562f4d){_0x4df7c0=_0x562f4d;_0x4f602c['model']=_[_0xc614('0x3b')](db[_0xc614('0x56')][_0xc614('0x36')]);_0x4f602c[_0xc614('0x3a')]=_['keys'](_0x4d387f[_0xc614('0x3a')]);_0x4f602c[_0xc614('0x3c')]=_[_0xc614('0x3d')](_0x4f602c['model'],_0x4f602c['query']);_0x3723dc[_0xc614('0x3f')]=_[_0xc614('0x3d')](_0x4f602c[_0xc614('0x38')],qs['fields'](_0x4d387f[_0xc614('0x3a')][_0xc614('0x3e')]));_0x3723dc[_0xc614('0x3f')]=_0x3723dc[_0xc614('0x3f')][_0xc614('0x40')]?_0x3723dc[_0xc614('0x3f')]:_0x4f602c[_0xc614('0x38')];_0x3723dc['order']=qs[_0xc614('0x44')](_0x4d387f[_0xc614('0x3a')][_0xc614('0x44')]);_0x3723dc['where']=qs[_0xc614('0x3c')](_[_0xc614('0x46')](_0x4d387f[_0xc614('0x3a')],_0x4f602c['filters']));if(_0x4d387f['query']['filter']){_0x3723dc['where']=_[_0xc614('0x48')](_0x3723dc[_0xc614('0x45')],{'$or':_[_0xc614('0x39')](_0x3723dc[_0xc614('0x3f')],function(_0x436465){var _0x4d8da7={};_0x4d8da7[_0x436465]={'$like':'%'+_0x4d387f[_0xc614('0x3a')][_0xc614('0x47')]+'%'};return _0x4d8da7;})});}_0x3723dc=_['merge']({},_0x3723dc,_0x4d387f['options']);return _0x4df7c0[_0xc614('0x54')](_0x3723dc);}})['then'](function(_0x28835c){if(_0x28835c){_0x32a600=_0x28835c['length'];if(!_0x4d387f[_0xc614('0x3a')]['hasOwnProperty']('nolimit')){_0x3723dc['limit']=qs[_0xc614('0x2f')](_0x4d387f[_0xc614('0x3a')][_0xc614('0x2f')]);_0x3723dc['offset']=qs[_0xc614('0x2e')](_0x4d387f[_0xc614('0x3a')][_0xc614('0x2e')]);}return _0x4df7c0[_0xc614('0x54')](_0x3723dc);}})[_0xc614('0x1f')](function(_0x57038b){if(_0x57038b){return _0x57038b?{'count':_0x32a600,'rows':_0x57038b}:null;}})[_0xc614('0x1f')](respondWithResult(_0x1b85ed,null))[_0xc614('0x29')](handleError(_0x1b85ed,null));};exports[_0xc614('0x57')]=function(_0x3d2cdc,_0x4a09ac,_0xcc30b8){var _0x164af0={};var _0x5eae0d={};var _0x5ceb78;var _0x4a8ea2;return db[_0xc614('0x4b')][_0xc614('0x55')]({'where':{'id':_0x3d2cdc[_0xc614('0x50')]['id']}})[_0xc614('0x1f')](handleEntityNotFound(_0x4a09ac,null))[_0xc614('0x1f')](function(_0x2b960e){if(_0x2b960e){_0x5ceb78=_0x2b960e;_0x5eae0d['model']=_[_0xc614('0x3b')](db[_0xc614('0x56')][_0xc614('0x36')]);_0x5eae0d[_0xc614('0x3a')]=_[_0xc614('0x3b')](_0x3d2cdc[_0xc614('0x3a')]);_0x5eae0d[_0xc614('0x3c')]=_['intersection'](_0x5eae0d[_0xc614('0x38')],_0x5eae0d[_0xc614('0x3a')]);_0x164af0['attributes']=_[_0xc614('0x3d')](_0x5eae0d['model'],qs[_0xc614('0x3e')](_0x3d2cdc[_0xc614('0x3a')]['fields']));_0x164af0['attributes']=_0x164af0['attributes'][_0xc614('0x40')]?_0x164af0[_0xc614('0x3f')]:_0x5eae0d['model'];_0x164af0[_0xc614('0x43')]=qs[_0xc614('0x44')](_0x3d2cdc['query'][_0xc614('0x44')]);_0x164af0[_0xc614('0x45')]=qs[_0xc614('0x3c')](_[_0xc614('0x46')](_0x3d2cdc[_0xc614('0x3a')],_0x5eae0d[_0xc614('0x3c')]));if(_0x3d2cdc['query'][_0xc614('0x47')]){_0x164af0[_0xc614('0x45')]=_[_0xc614('0x48')](_0x164af0['where'],{'$or':_['map'](_0x164af0['attributes'],function(_0x2348ba){var _0x27146d={};_0x27146d[_0x2348ba]={'$like':'%'+_0x3d2cdc[_0xc614('0x3a')][_0xc614('0x47')]+'%'};return _0x27146d;})});}_0x164af0=_[_0xc614('0x48')]({},_0x164af0,_0x3d2cdc['options']);return _0x5ceb78['getSubjects'](_0x164af0);}})[_0xc614('0x1f')](function(_0x3bf1d2){if(_0x3bf1d2){_0x4a8ea2=_0x3bf1d2[_0xc614('0x40')];if(!_0x3d2cdc[_0xc614('0x3a')][_0xc614('0x41')](_0xc614('0x42'))){_0x164af0[_0xc614('0x2f')]=qs[_0xc614('0x2f')](_0x3d2cdc[_0xc614('0x3a')][_0xc614('0x2f')]);_0x164af0['offset']=qs[_0xc614('0x2e')](_0x3d2cdc['query'][_0xc614('0x2e')]);}return _0x5ceb78[_0xc614('0x57')](_0x164af0);}})[_0xc614('0x1f')](function(_0x242100){if(_0x242100){return _0x242100?{'count':_0x4a8ea2,'rows':_0x242100}:null;}})[_0xc614('0x1f')](respondWithResult(_0x4a09ac,null))[_0xc614('0x29')](handleError(_0x4a09ac,null));};exports[_0xc614('0x58')]=function(_0x3f6744,_0x2f4b37,_0x42d82d){var _0x6d8a02={};var _0x417034={};var _0x2c9fbd;var _0xae2c8e;return db[_0xc614('0x4b')][_0xc614('0x55')]({'where':{'id':_0x3f6744[_0xc614('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f4b37,null))['then'](function(_0x57833c){if(_0x57833c){_0x2c9fbd=_0x57833c;_0x417034['model']=_[_0xc614('0x3b')](db[_0xc614('0x56')][_0xc614('0x36')]);_0x417034[_0xc614('0x3a')]=_[_0xc614('0x3b')](_0x3f6744[_0xc614('0x3a')]);_0x417034[_0xc614('0x3c')]=_[_0xc614('0x3d')](_0x417034[_0xc614('0x38')],_0x417034[_0xc614('0x3a')]);_0x6d8a02[_0xc614('0x3f')]=_[_0xc614('0x3d')](_0x417034['model'],qs[_0xc614('0x3e')](_0x3f6744['query'][_0xc614('0x3e')]));_0x6d8a02[_0xc614('0x3f')]=_0x6d8a02[_0xc614('0x3f')][_0xc614('0x40')]?_0x6d8a02['attributes']:_0x417034[_0xc614('0x38')];_0x6d8a02[_0xc614('0x43')]=qs[_0xc614('0x44')](_0x3f6744[_0xc614('0x3a')][_0xc614('0x44')]);_0x6d8a02[_0xc614('0x45')]=qs[_0xc614('0x3c')](_[_0xc614('0x46')](_0x3f6744['query'],_0x417034[_0xc614('0x3c')]));if(_0x3f6744['query'][_0xc614('0x47')]){_0x6d8a02['where']=_[_0xc614('0x48')](_0x6d8a02[_0xc614('0x45')],{'$or':_['map'](_0x6d8a02[_0xc614('0x3f')],function(_0x5c77e6){var _0x15a093={};_0x15a093[_0x5c77e6]={'$like':'%'+_0x3f6744[_0xc614('0x3a')][_0xc614('0x47')]+'%'};return _0x15a093;})});}_0x6d8a02=_[_0xc614('0x48')]({},_0x6d8a02,_0x3f6744[_0xc614('0x4a')]);return _0x2c9fbd[_0xc614('0x58')](_0x6d8a02);}})[_0xc614('0x1f')](function(_0x499dac){if(_0x499dac){_0xae2c8e=_0x499dac[_0xc614('0x40')];if(!_0x3f6744[_0xc614('0x3a')][_0xc614('0x41')]('nolimit')){_0x6d8a02[_0xc614('0x2f')]=qs[_0xc614('0x2f')](_0x3f6744[_0xc614('0x3a')][_0xc614('0x2f')]);_0x6d8a02[_0xc614('0x2e')]=qs[_0xc614('0x2e')](_0x3f6744[_0xc614('0x3a')][_0xc614('0x2e')]);}return _0x2c9fbd[_0xc614('0x58')](_0x6d8a02);}})['then'](function(_0xff7f7e){if(_0xff7f7e){return _0xff7f7e?{'count':_0xae2c8e,'rows':_0xff7f7e}:null;}})[_0xc614('0x1f')](respondWithResult(_0x2f4b37,null))[_0xc614('0x29')](handleError(_0x2f4b37,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 02e00b5..5969310 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 _0x3415=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','moment','rimraf'];(function(_0x56fb2e,_0x37c994){var _0x536a28=function(_0x1b294d){while(--_0x1b294d){_0x56fb2e['push'](_0x56fb2e['shift']());}};_0x536a28(++_0x37c994);}(_0x3415,0xd8));var _0x5341=function(_0x5bcd6c,_0x306dc8){_0x5bcd6c=_0x5bcd6c-0x0;var _0x1542f1=_0x3415[_0x5bcd6c];return _0x1542f1;};'use strict';var _=require(_0x5341('0x0'));var util=require('util');var logger=require(_0x5341('0x1'))('api');var moment=require(_0x5341('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5341('0x3'));var config=require(_0x5341('0x4'));var attributes=require(_0x5341('0x5'));module[_0x5341('0x6')]=function(_0x5b3d74,_0x311ad3){return _0x5b3d74[_0x5341('0x7')](_0x5341('0x8'),attributes,{'tableName':_0x5341('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a82=['./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3ae38e,_0x3aaa14){var _0x483595=function(_0x5c55ff){while(--_0x5c55ff){_0x3ae38e['push'](_0x3ae38e['shift']());}};_0x483595(++_0x3aaa14);}(_0x7a82,0x93));var _0x27a8=function(_0x33ce8f,_0x156c99){_0x33ce8f=_0x33ce8f-0x0;var _0x58605d=_0x7a82[_0x33ce8f];return _0x58605d;};'use strict';var _=require(_0x27a8('0x0'));var util=require(_0x27a8('0x1'));var logger=require('../../config/logger')(_0x27a8('0x2'));var moment=require(_0x27a8('0x3'));var BPromise=require('bluebird');var rp=require(_0x27a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27a8('0x5'));var config=require(_0x27a8('0x6'));var attributes=require(_0x27a8('0x7'));module[_0x27a8('0x8')]=function(_0x416edb,_0x3047aa){return _0x416edb[_0x27a8('0x9')](_0x27a8('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 55eb529..7d12297 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 _0x5284=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','randomstring'];(function(_0x274540,_0x59ff44){var _0x156702=function(_0x5c72cf){while(--_0x5c72cf){_0x274540['push'](_0x274540['shift']());}};_0x156702(++_0x59ff44);}(_0x5284,0x1d8));var _0x4528=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5284[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x4528('0x0'));var util=require('util');var moment=require(_0x4528('0x1'));var BPromise=require('bluebird');var rs=require(_0x4528('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4528('0x3'));var logger=require(_0x4528('0x4'))(_0x4528('0x5'));var config=require(_0x4528('0x6'));var jayson=require(_0x4528('0x7'));var client=jayson[_0x4528('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x498187,_0x390c15,_0x3580cd){return new BPromise(function(_0x1ddc3f,_0x272ef2){return client['request'](_0x498187,_0x3580cd)[_0x4528('0x9')](function(_0x16cbab){logger[_0x4528('0xa')](_0x4528('0xb'),_0x390c15,'request\x20sent');logger[_0x4528('0xc')](_0x4528('0xd'),_0x390c15,_0x4528('0xe'),JSON['stringify'](_0x16cbab));if(_0x16cbab[_0x4528('0xf')]){if(_0x16cbab[_0x4528('0xf')][_0x4528('0x10')]===0x1f4){logger[_0x4528('0xf')](_0x4528('0xb'),_0x390c15,_0x16cbab['error'][_0x4528('0x11')]);return _0x272ef2(_0x16cbab[_0x4528('0xf')][_0x4528('0x11')]);}logger['error'](_0x4528('0xb'),_0x390c15,_0x16cbab['error'][_0x4528('0x11')]);return _0x1ddc3f(_0x16cbab[_0x4528('0xf')][_0x4528('0x11')]);}else{logger[_0x4528('0xa')](_0x4528('0xb'),_0x390c15,'request\x20sent');_0x1ddc3f(_0x16cbab[_0x4528('0x12')][_0x4528('0x11')]);}})['catch'](function(_0x26222e){logger[_0x4528('0xf')](_0x4528('0xb'),_0x390c15,_0x26222e);_0x272ef2(_0x26222e);});});} \ No newline at end of file +var _0xf362=['error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x417de2,_0x2898e0){var _0x4ff3cb=function(_0x37744a){while(--_0x37744a){_0x417de2['push'](_0x417de2['shift']());}};_0x4ff3cb(++_0x2898e0);}(_0xf362,0x1d2));var _0x2f36=function(_0x53bee0,_0x4561b5){_0x53bee0=_0x53bee0-0x0;var _0x1c94bd=_0xf362[_0x53bee0];return _0x1c94bd;};'use strict';var _=require('lodash');var util=require(_0x2f36('0x0'));var moment=require(_0x2f36('0x1'));var BPromise=require(_0x2f36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f36('0x3'));var db=require(_0x2f36('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f36('0x5'))(_0x2f36('0x6'));var config=require(_0x2f36('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5eb12e,_0x48a0b5,_0x8018a2){return new BPromise(function(_0x3a983a,_0x4cd0fa){return client[_0x2f36('0x9')](_0x5eb12e,_0x8018a2)[_0x2f36('0xa')](function(_0x2cb84b){logger['info'](_0x2f36('0xb'),_0x48a0b5,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x48a0b5,_0x2f36('0xc'),JSON[_0x2f36('0xd')](_0x2cb84b));if(_0x2cb84b['error']){if(_0x2cb84b[_0x2f36('0xe')][_0x2f36('0xf')]===0x1f4){logger[_0x2f36('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x48a0b5,_0x2cb84b[_0x2f36('0xe')][_0x2f36('0x10')]);return _0x4cd0fa(_0x2cb84b['error']['message']);}logger[_0x2f36('0xe')](_0x2f36('0xb'),_0x48a0b5,_0x2cb84b['error'][_0x2f36('0x10')]);return _0x3a983a(_0x2cb84b[_0x2f36('0xe')][_0x2f36('0x10')]);}else{logger[_0x2f36('0x11')](_0x2f36('0xb'),_0x48a0b5,_0x2f36('0xc'));_0x3a983a(_0x2cb84b[_0x2f36('0x12')][_0x2f36('0x10')]);}})[_0x2f36('0x13')](function(_0x18bc7b){logger['error'](_0x2f36('0xb'),_0x48a0b5,_0x18bc7b);_0x4cd0fa(_0x18bc7b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 6862ae1..babe344 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 _0x867f=['../../config/environment','isAuthenticated','index','get','/:id','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x10d8a0,_0x583b3f){var _0x2e49e1=function(_0x14ed1c){while(--_0x14ed1c){_0x10d8a0['push'](_0x10d8a0['shift']());}};_0x2e49e1(++_0x583b3f);}(_0x867f,0xe6));var _0xf867=function(_0x549555,_0x5c2217){_0x549555=_0x549555-0x0;var _0x259593=_0x867f[_0x549555];return _0x259593;};'use strict';var multer=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var path=require(_0xf867('0x2'));var timeout=require(_0xf867('0x3'));var express=require(_0xf867('0x4'));var router=express[_0xf867('0x5')]();var auth=require(_0xf867('0x6'));var interaction=require(_0xf867('0x7'));var config=require(_0xf867('0x8'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xf867('0x9')](),controller[_0xf867('0xa')]);router[_0xf867('0xb')](_0xf867('0xc'),auth[_0xf867('0x9')](),controller['show']);router['post']('/',auth[_0xf867('0x9')](),controller['create']);router[_0xf867('0xd')](_0xf867('0xc'),auth[_0xf867('0x9')](),controller[_0xf867('0xe')]);router[_0xf867('0xf')](_0xf867('0xc'),auth[_0xf867('0x9')](),controller[_0xf867('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe205=['create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe205,0xa7));var _0x5e20=function(_0x1220af,_0x4aa144){_0x1220af=_0x1220af-0x0;var _0x22beed=_0xe205[_0x1220af];return _0x22beed;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var auth=require(_0x5e20('0x6'));var interaction=require(_0x5e20('0x7'));var config=require(_0x5e20('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x5e20('0x9')]('/',auth[_0x5e20('0xa')](),controller[_0x5e20('0xb')]);router[_0x5e20('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5e20('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e20('0xd')]);router[_0x5e20('0xe')]('/:id',auth[_0x5e20('0xa')](),controller[_0x5e20('0xf')]);router[_0x5e20('0x10')](_0x5e20('0x11'),auth['isAuthenticated'](),controller[_0x5e20('0x12')]);module[_0x5e20('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a98a796..955d178 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 _0x3069=['customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize','string'];(function(_0x5e19ee,_0x5395be){var _0x4fce7c=function(_0x46c733){while(--_0x46c733){_0x5e19ee['push'](_0x5e19ee['shift']());}};_0x4fce7c(++_0x5395be);}(_0x3069,0x1e6));var _0x9306=function(_0x1fc429,_0x2321df){_0x1fc429=_0x1fc429-0x0;var _0x10d7a7=_0x3069[_0x1fc429];return _0x10d7a7;};'use strict';var Sequelize=require(_0x9306('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x9306('0x1'),'variable',_0x9306('0x2'),_0x9306('0x3')),'defaultValue':_0x9306('0x1')},'content':{'type':Sequelize[_0x9306('0x4')]},'key':{'type':Sequelize[_0x9306('0x4')]},'keyType':{'type':Sequelize[_0x9306('0x5')](_0x9306('0x1'),_0x9306('0x6'),_0x9306('0x2'))},'keyContent':{'type':Sequelize[_0x9306('0x4')]},'idField':{'type':Sequelize[_0x9306('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9306('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9306('0x4')]}}; \ No newline at end of file +var _0x8d4c=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x2dd14a,_0x29255b){var _0x470162=function(_0x3040da){while(--_0x3040da){_0x2dd14a['push'](_0x2dd14a['shift']());}};_0x470162(++_0x29255b);}(_0x8d4c,0x133));var _0xc8d4=function(_0x149cf0,_0x3746f2){_0x149cf0=_0x149cf0-0x0;var _0x2ee2c8=_0x8d4c[_0x149cf0];return _0x2ee2c8;};'use strict';var Sequelize=require(_0xc8d4('0x0'));module[_0xc8d4('0x1')]={'type':{'type':Sequelize[_0xc8d4('0x2')](_0xc8d4('0x3'),'variable',_0xc8d4('0x4'),'keyValue'),'defaultValue':_0xc8d4('0x3')},'content':{'type':Sequelize[_0xc8d4('0x5')]},'key':{'type':Sequelize[_0xc8d4('0x5')]},'keyType':{'type':Sequelize[_0xc8d4('0x2')](_0xc8d4('0x3'),_0xc8d4('0x6'),_0xc8d4('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc8d4('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc8d4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc8d4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index cf38d16..4d61b7d 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 _0x075e=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','error','stack','name','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','include','findAll','catch','show','params','length','includeAll','find'];(function(_0x3d6295,_0x1f3258){var _0x17e096=function(_0x4606be){while(--_0x4606be){_0x3d6295['push'](_0x3d6295['shift']());}};_0x17e096(++_0x1f3258);}(_0x075e,0x92));var _0xe075=function(_0x43f6ee,_0x167363){_0x43f6ee=_0x43f6ee-0x0;var _0x3d0e02=_0x075e[_0x43f6ee];return _0x3d0e02;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe075('0x0'));var rimraf=require(_0xe075('0x1'));var zipdir=require(_0xe075('0x2'));var jsonpatch=require(_0xe075('0x3'));var rp=require(_0xe075('0x4'));var moment=require(_0xe075('0x5'));var BPromise=require(_0xe075('0x6'));var Mustache=require(_0xe075('0x7'));var util=require('util');var path=require(_0xe075('0x8'));var sox=require(_0xe075('0x9'));var csv=require('to-csv');var ejs=require(_0xe075('0xa'));var fs=require('fs');var _=require(_0xe075('0xb'));var squel=require(_0xe075('0xc'));var crypto=require(_0xe075('0xd'));var jsforce=require(_0xe075('0xe'));var deskjs=require(_0xe075('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe075('0x10'));var Papa=require(_0xe075('0x11'));var Redis=require('ioredis');var authService=require(_0xe075('0x12'));var qs=require(_0xe075('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe075('0x14'));var logger=require(_0xe075('0x15'))(_0xe075('0x16'));var utils=require(_0xe075('0x17'));var config=require(_0xe075('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53223a,_0x541a66){_0x541a66=_0x541a66||0xcc;return function(_0x414adb){if(_0x414adb){return _0x53223a[_0xe075('0x19')](_0x541a66);}return _0x53223a[_0xe075('0x1a')](_0x541a66)[_0xe075('0x1b')]();};}function respondWithResult(_0x4d0182,_0x21aa92){_0x21aa92=_0x21aa92||0xc8;return function(_0x4fbf61){if(_0x4fbf61){return _0x4d0182[_0xe075('0x1a')](_0x21aa92)[_0xe075('0x1c')](_0x4fbf61);}};}function respondWithFilteredResult(_0x1cbf7e,_0x403a6d){return function(_0x1d283a){if(_0x1d283a){var _0x5767d3=_0x1d283a[_0xe075('0x1d')],_0x58a9a9=_0x403a6d[_0xe075('0x1e')],_0xe08799=_0x403a6d[_0xe075('0x1e')]+_0x403a6d[_0xe075('0x1f')],_0x16d8fc;if(_0xe08799>=_0x5767d3){_0xe08799=_0x5767d3;_0x16d8fc=0xc8;}else{_0x16d8fc=0xce;}_0x1cbf7e[_0xe075('0x1a')](_0x16d8fc);return _0x1cbf7e['set'](_0xe075('0x20'),_0x58a9a9+'-'+_0xe08799+'/'+_0x5767d3)[_0xe075('0x1c')](_0x1d283a);}return null;};}function patchUpdates(_0x2c3953){return function(_0xeb0586){try{jsonpatch['apply'](_0xeb0586,_0x2c3953,!![]);}catch(_0x3893db){return BPromise[_0xe075('0x21')](_0x3893db);}return _0xeb0586[_0xe075('0x22')]();};}function saveUpdates(_0x3623f2,_0x308360){return function(_0x3691c6){if(_0x3691c6){return _0x3691c6[_0xe075('0x23')](_0x3623f2)['then'](function(_0x487cb3){return _0x487cb3;});}return null;};}function removeEntity(_0x459445,_0x213880){return function(_0x265769){if(_0x265769){return _0x265769[_0xe075('0x24')]()['then'](function(){_0x459445['status'](0xcc)[_0xe075('0x1b')]();});}};}function handleEntityNotFound(_0x125042,_0x1120e2){return function(_0x532e63){if(!_0x532e63){_0x125042[_0xe075('0x19')](0x194);}return _0x532e63;};}function handleError(_0x49a989,_0x24a924){_0x24a924=_0x24a924||0x1f4;return function(_0x31b1bd){logger[_0xe075('0x25')](_0x31b1bd[_0xe075('0x26')]);if(_0x31b1bd[_0xe075('0x27')]){delete _0x31b1bd['name'];}_0x49a989[_0xe075('0x1a')](_0x24a924)['send'](_0x31b1bd);};}exports['index']=function(_0x54838c,_0x523934){var _0x3e68e2={},_0x59520e={},_0xf797f3={'count':0x0,'rows':[]};var _0x1901c1=_[_0xe075('0x28')](db[_0xe075('0x29')][_0xe075('0x2a')],function(_0x43570b){return{'name':_0x43570b['fieldName'],'type':_0x43570b[_0xe075('0x2b')][_0xe075('0x2c')]};});_0x59520e[_0xe075('0x2d')]=_['map'](_0x1901c1,'name');_0x59520e[_0xe075('0x2e')]=_[_0xe075('0x2f')](_0x54838c[_0xe075('0x2e')]);_0x59520e[_0xe075('0x30')]=_[_0xe075('0x31')](_0x59520e[_0xe075('0x2d')],_0x59520e[_0xe075('0x2e')]);_0x3e68e2[_0xe075('0x32')]=_['intersection'](_0x59520e[_0xe075('0x2d')],qs['fields'](_0x54838c[_0xe075('0x2e')][_0xe075('0x33')]));_0x3e68e2[_0xe075('0x32')]=_0x3e68e2['attributes']['length']?_0x3e68e2[_0xe075('0x32')]:_0x59520e[_0xe075('0x2d')];if(!_0x54838c[_0xe075('0x2e')][_0xe075('0x34')](_0xe075('0x35'))){_0x3e68e2[_0xe075('0x1f')]=qs['limit'](_0x54838c[_0xe075('0x2e')][_0xe075('0x1f')]);_0x3e68e2[_0xe075('0x1e')]=qs[_0xe075('0x1e')](_0x54838c['query'][_0xe075('0x1e')]);}_0x3e68e2[_0xe075('0x36')]=qs[_0xe075('0x37')](_0x54838c[_0xe075('0x2e')][_0xe075('0x37')]);_0x3e68e2[_0xe075('0x38')]=qs[_0xe075('0x30')](_[_0xe075('0x39')](_0x54838c[_0xe075('0x2e')],_0x59520e[_0xe075('0x30')]),_0x1901c1);if(_0x54838c[_0xe075('0x2e')][_0xe075('0x3a')]){_0x3e68e2[_0xe075('0x38')]=_[_0xe075('0x3b')](_0x3e68e2[_0xe075('0x38')],{'$or':_[_0xe075('0x28')](_0x1901c1,function(_0x5ad672){if(_0x5ad672[_0xe075('0x2b')]!=='VIRTUAL'){var _0x33f842={};_0x33f842[_0x5ad672[_0xe075('0x27')]]={'$like':'%'+_0x54838c[_0xe075('0x2e')][_0xe075('0x3a')]+'%'};return _0x33f842;}})});}_0x3e68e2=_['merge']({},_0x3e68e2,_0x54838c[_0xe075('0x3c')]);var _0x5e55b4={'where':_0x3e68e2['where']};return db[_0xe075('0x29')][_0xe075('0x1d')](_0x5e55b4)[_0xe075('0x3d')](function(_0x471b53){_0xf797f3[_0xe075('0x1d')]=_0x471b53;if(_0x54838c[_0xe075('0x2e')]['includeAll']){_0x3e68e2[_0xe075('0x3e')]=[{'all':!![]}];}return db[_0xe075('0x29')][_0xe075('0x3f')](_0x3e68e2);})[_0xe075('0x3d')](function(_0x31d010){_0xf797f3['rows']=_0x31d010;return _0xf797f3;})[_0xe075('0x3d')](respondWithFilteredResult(_0x523934,_0x3e68e2))[_0xe075('0x40')](handleError(_0x523934,null));};exports[_0xe075('0x41')]=function(_0x17a301,_0x12bc09){var _0x6d4afe={'raw':!![],'where':{'id':_0x17a301[_0xe075('0x42')]['id']}},_0x1330b4={};_0x1330b4['model']=_['keys'](db[_0xe075('0x29')][_0xe075('0x2a')]);_0x1330b4[_0xe075('0x2e')]=_[_0xe075('0x2f')](_0x17a301[_0xe075('0x2e')]);_0x1330b4[_0xe075('0x30')]=_['intersection'](_0x1330b4[_0xe075('0x2d')],_0x1330b4[_0xe075('0x2e')]);_0x6d4afe[_0xe075('0x32')]=_['intersection'](_0x1330b4[_0xe075('0x2d')],qs[_0xe075('0x33')](_0x17a301['query'][_0xe075('0x33')]));_0x6d4afe[_0xe075('0x32')]=_0x6d4afe['attributes'][_0xe075('0x43')]?_0x6d4afe['attributes']:_0x1330b4['model'];if(_0x17a301['query'][_0xe075('0x44')]){_0x6d4afe[_0xe075('0x3e')]=[{'all':!![]}];}_0x6d4afe=_[_0xe075('0x3b')]({},_0x6d4afe,_0x17a301[_0xe075('0x3c')]);return db[_0xe075('0x29')][_0xe075('0x45')](_0x6d4afe)[_0xe075('0x3d')](handleEntityNotFound(_0x12bc09,null))[_0xe075('0x3d')](respondWithResult(_0x12bc09,null))[_0xe075('0x40')](handleError(_0x12bc09,null));};exports[_0xe075('0x46')]=function(_0x35f7c4,_0xd7d246){return db[_0xe075('0x29')][_0xe075('0x46')](_0x35f7c4['body'],{})[_0xe075('0x3d')](respondWithResult(_0xd7d246,0xc9))[_0xe075('0x40')](handleError(_0xd7d246,null));};exports[_0xe075('0x23')]=function(_0x15f6d0,_0x1979bd){if(_0x15f6d0[_0xe075('0x47')]['id']){delete _0x15f6d0[_0xe075('0x47')]['id'];}return db[_0xe075('0x29')][_0xe075('0x45')]({'where':{'id':_0x15f6d0['params']['id']}})[_0xe075('0x3d')](handleEntityNotFound(_0x1979bd,null))[_0xe075('0x3d')](saveUpdates(_0x15f6d0[_0xe075('0x47')],null))[_0xe075('0x3d')](respondWithResult(_0x1979bd,null))[_0xe075('0x40')](handleError(_0x1979bd,null));};exports[_0xe075('0x24')]=function(_0x4b3499,_0x569977){return db['Dynamics365Field'][_0xe075('0x45')]({'where':{'id':_0x4b3499['params']['id']}})[_0xe075('0x3d')](handleEntityNotFound(_0x569977,null))[_0xe075('0x3d')](removeEntity(_0x569977,null))[_0xe075('0x40')](handleError(_0x569977,null));}; \ No newline at end of file +var _0x30dc=['apply','reject','save','destroy','then','sendStatus','error','stack','name','send','map','Dynamics365Field','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','params','keys','length','include','find','catch','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range'];(function(_0x5b4bd7,_0x32bf7f){var _0x41772a=function(_0x4f0666){while(--_0x4f0666){_0x5b4bd7['push'](_0x5b4bd7['shift']());}};_0x41772a(++_0x32bf7f);}(_0x30dc,0x14a));var _0xc30d=function(_0x3c13b1,_0x1c975a){_0x3c13b1=_0x3c13b1-0x0;var _0x48c4b5=_0x30dc[_0x3c13b1];return _0x48c4b5;};'use strict';var pdf=require(_0xc30d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc30d('0x1'));var zipdir=require(_0xc30d('0x2'));var jsonpatch=require(_0xc30d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc30d('0x4'));var Mustache=require(_0xc30d('0x5'));var util=require(_0xc30d('0x6'));var path=require(_0xc30d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc30d('0x8'));var crypto=require(_0xc30d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc30d('0xa'));var toCsv=require(_0xc30d('0xb'));var querystring=require(_0xc30d('0xc'));var Papa=require(_0xc30d('0xd'));var Redis=require(_0xc30d('0xe'));var authService=require(_0xc30d('0xf'));var qs=require(_0xc30d('0x10'));var as=require(_0xc30d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc30d('0x12'));var utils=require(_0xc30d('0x13'));var config=require(_0xc30d('0x14'));var db=require(_0xc30d('0x15'))['db'];function respondWithStatusCode(_0x4bebf1,_0x41dce2){_0x41dce2=_0x41dce2||0xcc;return function(_0x274c20){if(_0x274c20){return _0x4bebf1['sendStatus'](_0x41dce2);}return _0x4bebf1['status'](_0x41dce2)[_0xc30d('0x16')]();};}function respondWithResult(_0x297ee4,_0x53bac6){_0x53bac6=_0x53bac6||0xc8;return function(_0x2702a6){if(_0x2702a6){return _0x297ee4['status'](_0x53bac6)[_0xc30d('0x17')](_0x2702a6);}};}function respondWithFilteredResult(_0x251d79,_0xb844cd){return function(_0x14fe6e){if(_0x14fe6e){var _0x44b147=_0x14fe6e[_0xc30d('0x18')],_0xd1d4cb=_0xb844cd[_0xc30d('0x19')],_0x3f2140=_0xb844cd[_0xc30d('0x19')]+_0xb844cd[_0xc30d('0x1a')],_0x10c362;if(_0x3f2140>=_0x44b147){_0x3f2140=_0x44b147;_0x10c362=0xc8;}else{_0x10c362=0xce;}_0x251d79[_0xc30d('0x1b')](_0x10c362);return _0x251d79[_0xc30d('0x1c')](_0xc30d('0x1d'),_0xd1d4cb+'-'+_0x3f2140+'/'+_0x44b147)[_0xc30d('0x17')](_0x14fe6e);}return null;};}function patchUpdates(_0xed4abe){return function(_0x2e07f8){try{jsonpatch[_0xc30d('0x1e')](_0x2e07f8,_0xed4abe,!![]);}catch(_0x1503c6){return BPromise[_0xc30d('0x1f')](_0x1503c6);}return _0x2e07f8[_0xc30d('0x20')]();};}function saveUpdates(_0x514a25,_0x1c8355){return function(_0x3811df){if(_0x3811df){return _0x3811df['update'](_0x514a25)['then'](function(_0x344db1){return _0x344db1;});}return null;};}function removeEntity(_0x56faff,_0x12e980){return function(_0x3133b6){if(_0x3133b6){return _0x3133b6[_0xc30d('0x21')]()[_0xc30d('0x22')](function(){_0x56faff[_0xc30d('0x1b')](0xcc)[_0xc30d('0x16')]();});}};}function handleEntityNotFound(_0x23eeb1,_0x558428){return function(_0x14e2e1){if(!_0x14e2e1){_0x23eeb1[_0xc30d('0x23')](0x194);}return _0x14e2e1;};}function handleError(_0x52d430,_0x5bb4db){_0x5bb4db=_0x5bb4db||0x1f4;return function(_0x5d8178){logger[_0xc30d('0x24')](_0x5d8178[_0xc30d('0x25')]);if(_0x5d8178[_0xc30d('0x26')]){delete _0x5d8178[_0xc30d('0x26')];}_0x52d430[_0xc30d('0x1b')](_0x5bb4db)[_0xc30d('0x27')](_0x5d8178);};}exports['index']=function(_0x60c108,_0x13fb4e){var _0x3b3504={},_0x382587={},_0x2c3a6c={'count':0x0,'rows':[]};var _0x5b0aae=_[_0xc30d('0x28')](db[_0xc30d('0x29')]['rawAttributes'],function(_0x25265c){return{'name':_0x25265c[_0xc30d('0x2a')],'type':_0x25265c[_0xc30d('0x2b')][_0xc30d('0x2c')]};});_0x382587[_0xc30d('0x2d')]=_['map'](_0x5b0aae,_0xc30d('0x26'));_0x382587[_0xc30d('0x2e')]=_['keys'](_0x60c108[_0xc30d('0x2e')]);_0x382587['filters']=_[_0xc30d('0x2f')](_0x382587[_0xc30d('0x2d')],_0x382587[_0xc30d('0x2e')]);_0x3b3504['attributes']=_[_0xc30d('0x2f')](_0x382587[_0xc30d('0x2d')],qs['fields'](_0x60c108['query'][_0xc30d('0x30')]));_0x3b3504['attributes']=_0x3b3504[_0xc30d('0x31')]['length']?_0x3b3504['attributes']:_0x382587[_0xc30d('0x2d')];if(!_0x60c108['query'][_0xc30d('0x32')]('nolimit')){_0x3b3504[_0xc30d('0x1a')]=qs[_0xc30d('0x1a')](_0x60c108[_0xc30d('0x2e')][_0xc30d('0x1a')]);_0x3b3504[_0xc30d('0x19')]=qs[_0xc30d('0x19')](_0x60c108[_0xc30d('0x2e')][_0xc30d('0x19')]);}_0x3b3504[_0xc30d('0x33')]=qs['sort'](_0x60c108[_0xc30d('0x2e')][_0xc30d('0x34')]);_0x3b3504['where']=qs['filters'](_[_0xc30d('0x35')](_0x60c108[_0xc30d('0x2e')],_0x382587[_0xc30d('0x36')]),_0x5b0aae);if(_0x60c108[_0xc30d('0x2e')][_0xc30d('0x37')]){_0x3b3504['where']=_[_0xc30d('0x38')](_0x3b3504[_0xc30d('0x39')],{'$or':_[_0xc30d('0x28')](_0x5b0aae,function(_0x32f9d9){if(_0x32f9d9['type']!==_0xc30d('0x3a')){var _0x3f48f0={};_0x3f48f0[_0x32f9d9[_0xc30d('0x26')]]={'$like':'%'+_0x60c108[_0xc30d('0x2e')][_0xc30d('0x37')]+'%'};return _0x3f48f0;}})});}_0x3b3504=_['merge']({},_0x3b3504,_0x60c108[_0xc30d('0x3b')]);var _0x43d045={'where':_0x3b3504[_0xc30d('0x39')]};return db[_0xc30d('0x29')]['count'](_0x43d045)[_0xc30d('0x22')](function(_0x3495e9){_0x2c3a6c[_0xc30d('0x18')]=_0x3495e9;if(_0x60c108[_0xc30d('0x2e')][_0xc30d('0x3c')]){_0x3b3504['include']=[{'all':!![]}];}return db[_0xc30d('0x29')][_0xc30d('0x3d')](_0x3b3504);})[_0xc30d('0x22')](function(_0x70a2f0){_0x2c3a6c['rows']=_0x70a2f0;return _0x2c3a6c;})[_0xc30d('0x22')](respondWithFilteredResult(_0x13fb4e,_0x3b3504))['catch'](handleError(_0x13fb4e,null));};exports[_0xc30d('0x3e')]=function(_0x309dc2,_0x1b4b7b){var _0x5a82f8={'raw':!![],'where':{'id':_0x309dc2[_0xc30d('0x3f')]['id']}},_0x7d45ed={};_0x7d45ed[_0xc30d('0x2d')]=_[_0xc30d('0x40')](db[_0xc30d('0x29')]['rawAttributes']);_0x7d45ed[_0xc30d('0x2e')]=_[_0xc30d('0x40')](_0x309dc2['query']);_0x7d45ed[_0xc30d('0x36')]=_[_0xc30d('0x2f')](_0x7d45ed[_0xc30d('0x2d')],_0x7d45ed[_0xc30d('0x2e')]);_0x5a82f8[_0xc30d('0x31')]=_[_0xc30d('0x2f')](_0x7d45ed['model'],qs[_0xc30d('0x30')](_0x309dc2[_0xc30d('0x2e')][_0xc30d('0x30')]));_0x5a82f8[_0xc30d('0x31')]=_0x5a82f8[_0xc30d('0x31')][_0xc30d('0x41')]?_0x5a82f8[_0xc30d('0x31')]:_0x7d45ed['model'];if(_0x309dc2['query'][_0xc30d('0x3c')]){_0x5a82f8[_0xc30d('0x42')]=[{'all':!![]}];}_0x5a82f8=_[_0xc30d('0x38')]({},_0x5a82f8,_0x309dc2['options']);return db[_0xc30d('0x29')][_0xc30d('0x43')](_0x5a82f8)[_0xc30d('0x22')](handleEntityNotFound(_0x1b4b7b,null))[_0xc30d('0x22')](respondWithResult(_0x1b4b7b,null))[_0xc30d('0x44')](handleError(_0x1b4b7b,null));};exports[_0xc30d('0x45')]=function(_0x169fd9,_0x2b9173){return db[_0xc30d('0x29')][_0xc30d('0x45')](_0x169fd9[_0xc30d('0x46')],{})[_0xc30d('0x22')](respondWithResult(_0x2b9173,0xc9))[_0xc30d('0x44')](handleError(_0x2b9173,null));};exports[_0xc30d('0x47')]=function(_0x181793,_0x249370){if(_0x181793[_0xc30d('0x46')]['id']){delete _0x181793[_0xc30d('0x46')]['id'];}return db[_0xc30d('0x29')]['find']({'where':{'id':_0x181793['params']['id']}})[_0xc30d('0x22')](handleEntityNotFound(_0x249370,null))[_0xc30d('0x22')](saveUpdates(_0x181793[_0xc30d('0x46')],null))[_0xc30d('0x22')](respondWithResult(_0x249370,null))[_0xc30d('0x44')](handleError(_0x249370,null));};exports[_0xc30d('0x21')]=function(_0x597ad0,_0x3db716){return db[_0xc30d('0x29')][_0xc30d('0x43')]({'where':{'id':_0x597ad0[_0xc30d('0x3f')]['id']}})[_0xc30d('0x22')](handleEntityNotFound(_0x3db716,null))[_0xc30d('0x22')](removeEntity(_0x3db716,null))[_0xc30d('0x44')](handleError(_0x3db716,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 0a93195..adbaca5 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 _0x94a5=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x94a5,0x7e));var _0x594a=function(_0x55e1db,_0x446f3f){_0x55e1db=_0x55e1db-0x0;var _0x2e06e0=_0x94a5[_0x55e1db];return _0x2e06e0;};'use strict';var _=require('lodash');var util=require(_0x594a('0x0'));var logger=require(_0x594a('0x1'))(_0x594a('0x2'));var moment=require(_0x594a('0x3'));var BPromise=require(_0x594a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x594a('0x5'));var rimraf=require(_0x594a('0x6'));var config=require(_0x594a('0x7'));var attributes=require(_0x594a('0x8'));module['exports']=function(_0x4031ea,_0x112b13){return _0x4031ea[_0x594a('0x9')](_0x594a('0xa'),attributes,{'tableName':_0x594a('0xb'),'paranoid':![],'indexes':[{'name':_0x594a('0xc'),'fields':[_0x594a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4796=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1f7c53,_0x102af1){var _0x29cb0c=function(_0x269305){while(--_0x269305){_0x1f7c53['push'](_0x1f7c53['shift']());}};_0x29cb0c(++_0x102af1);}(_0x4796,0x107));var _0x6479=function(_0xd72523,_0xc35df7){_0xd72523=_0xd72523-0x0;var _0x28bb2e=_0x4796[_0xd72523];return _0x28bb2e;};'use strict';var _=require(_0x6479('0x0'));var util=require(_0x6479('0x1'));var logger=require(_0x6479('0x2'))(_0x6479('0x3'));var moment=require(_0x6479('0x4'));var BPromise=require(_0x6479('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6479('0x6'));var rimraf=require(_0x6479('0x7'));var config=require(_0x6479('0x8'));var attributes=require(_0x6479('0x9'));module[_0x6479('0xa')]=function(_0x45b09f,_0x537973){return _0x45b09f[_0x6479('0xb')]('Dynamics365Field',attributes,{'tableName':_0x6479('0xc'),'paranoid':![],'indexes':[{'name':_0x6479('0xd'),'fields':['idField',_0x6479('0xe')],'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 1bffb41..3150328 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 _0x7f94=['Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xf8a419,_0x4d2075){var _0xf61db2=function(_0x53388e){while(--_0x53388e){_0xf8a419['push'](_0xf8a419['shift']());}};_0xf61db2(++_0x4d2075);}(_0x7f94,0x65));var _0x47f9=function(_0x558484,_0x2d7a8c){_0x558484=_0x558484-0x0;var _0x10c7dc=_0x7f94[_0x558484];return _0x10c7dc;};'use strict';var _=require(_0x47f9('0x0'));var util=require('util');var moment=require(_0x47f9('0x1'));var BPromise=require(_0x47f9('0x2'));var rs=require(_0x47f9('0x3'));var fs=require('fs');var Redis=require(_0x47f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47f9('0x5'));var logger=require(_0x47f9('0x6'))(_0x47f9('0x7'));var config=require(_0x47f9('0x8'));var jayson=require(_0x47f9('0x9'));var client=jayson[_0x47f9('0xa')][_0x47f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x572cab,_0x42fa6d,_0x4a8f54){return new BPromise(function(_0x23ab0b,_0x3240cf){return client[_0x47f9('0xc')](_0x572cab,_0x4a8f54)[_0x47f9('0xd')](function(_0x813b51){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x42fa6d,'request\x20sent');logger['debug'](_0x47f9('0xe'),_0x42fa6d,_0x47f9('0xf'),JSON[_0x47f9('0x10')](_0x813b51));if(_0x813b51[_0x47f9('0x11')]){if(_0x813b51[_0x47f9('0x11')][_0x47f9('0x12')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x42fa6d,_0x813b51[_0x47f9('0x11')]['message']);return _0x3240cf(_0x813b51['error']['message']);}logger[_0x47f9('0x11')](_0x47f9('0x13'),_0x42fa6d,_0x813b51['error'][_0x47f9('0x14')]);return _0x23ab0b(_0x813b51[_0x47f9('0x11')][_0x47f9('0x14')]);}else{logger[_0x47f9('0x15')]('Dynamics365Field,\x20%s,\x20%s',_0x42fa6d,_0x47f9('0xf'));_0x23ab0b(_0x813b51[_0x47f9('0x16')][_0x47f9('0x14')]);}})[_0x47f9('0x17')](function(_0x27ad5e){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x42fa6d,_0x27ad5e);_0x3240cf(_0x27ad5e);});});} \ No newline at end of file +var _0xdbb1=['request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','../../config/utils','rpc','../../config/environment','http','request','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb1,0x105));var _0x1dbb=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xdbb1[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x1dbb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1dbb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1dbb('0x2'));var logger=require('../../config/logger')(_0x1dbb('0x3'));var config=require(_0x1dbb('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1dbb('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x38259d,_0x2070a8,_0x7c2269){return new BPromise(function(_0x5e622c,_0x3ffb54){return client[_0x1dbb('0x6')](_0x38259d,_0x7c2269)['then'](function(_0x208220){logger[_0x1dbb('0x7')](_0x1dbb('0x8'),_0x2070a8,_0x1dbb('0x9'));logger[_0x1dbb('0xa')](_0x1dbb('0xb'),_0x2070a8,_0x1dbb('0x9'),JSON[_0x1dbb('0xc')](_0x208220));if(_0x208220[_0x1dbb('0xd')]){if(_0x208220[_0x1dbb('0xd')][_0x1dbb('0xe')]===0x1f4){logger['error'](_0x1dbb('0x8'),_0x2070a8,_0x208220[_0x1dbb('0xd')][_0x1dbb('0xf')]);return _0x3ffb54(_0x208220[_0x1dbb('0xd')]['message']);}logger['error'](_0x1dbb('0x8'),_0x2070a8,_0x208220[_0x1dbb('0xd')][_0x1dbb('0xf')]);return _0x5e622c(_0x208220[_0x1dbb('0xd')][_0x1dbb('0xf')]);}else{logger['info'](_0x1dbb('0x8'),_0x2070a8,_0x1dbb('0x9'));_0x5e622c(_0x208220[_0x1dbb('0x10')]['message']);}})[_0x1dbb('0x11')](function(_0x363224){logger['error'](_0x1dbb('0x8'),_0x2070a8,_0x363224);_0x3ffb54(_0x363224);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 456cfa7..7760ff0 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 _0x4d1d=['exports','multer','util','path','express','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','destroy'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4d1d,0x1cd));var _0xd4d1=function(_0xeef7d1,_0x3bfbf5){_0xeef7d1=_0xeef7d1-0x0;var _0x5416ec=_0x4d1d[_0xeef7d1];return _0x5416ec;};'use strict';var multer=require(_0xd4d1('0x0'));var util=require(_0xd4d1('0x1'));var path=require(_0xd4d1('0x2'));var timeout=require('connect-timeout');var express=require(_0xd4d1('0x3'));var router=express['Router']();var auth=require(_0xd4d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd4d1('0x5'));var controller=require(_0xd4d1('0x6'));router[_0xd4d1('0x7')]('/',auth[_0xd4d1('0x8')](),controller['index']);router[_0xd4d1('0x7')](_0xd4d1('0x9'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0xa')]);router[_0xd4d1('0x7')](_0xd4d1('0xb'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0xc')]);router[_0xd4d1('0x7')](_0xd4d1('0xd'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0xe')]);router['post']('/',auth[_0xd4d1('0x8')](),controller['create']);router[_0xd4d1('0xf')](_0xd4d1('0xb'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0x10')]);router['put'](_0xd4d1('0x9'),auth[_0xd4d1('0x8')](),controller['update']);router[_0xd4d1('0x11')](_0xd4d1('0x9'),auth[_0xd4d1('0x8')](),controller[_0xd4d1('0x12')]);module[_0xd4d1('0x13')]=router; \ No newline at end of file +var _0x7514=['getFields','post','/:id/configurations','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show'];(function(_0x53bf11,_0x3acb5e){var _0x3a4f47=function(_0x5d215e){while(--_0x5d215e){_0x53bf11['push'](_0x53bf11['shift']());}};_0x3a4f47(++_0x3acb5e);}(_0x7514,0x1ea));var _0x4751=function(_0x672720,_0x4969da){_0x672720=_0x672720-0x0;var _0x376f9d=_0x7514[_0x672720];return _0x376f9d;};'use strict';var multer=require(_0x4751('0x0'));var util=require(_0x4751('0x1'));var path=require(_0x4751('0x2'));var timeout=require(_0x4751('0x3'));var express=require(_0x4751('0x4'));var router=express[_0x4751('0x5')]();var auth=require(_0x4751('0x6'));var interaction=require(_0x4751('0x7'));var config=require('../../config/environment');var controller=require(_0x4751('0x8'));router[_0x4751('0x9')]('/',auth['isAuthenticated'](),controller[_0x4751('0xa')]);router[_0x4751('0x9')](_0x4751('0xb'),auth[_0x4751('0xc')](),controller[_0x4751('0xd')]);router[_0x4751('0x9')]('/:id/configurations',auth[_0x4751('0xc')](),controller['getConfigurations']);router[_0x4751('0x9')]('/:id/fields',auth[_0x4751('0xc')](),controller[_0x4751('0xe')]);router[_0x4751('0xf')]('/',auth[_0x4751('0xc')](),controller['create']);router[_0x4751('0xf')](_0x4751('0x10'),auth[_0x4751('0xc')](),controller[_0x4751('0x11')]);router[_0x4751('0x12')](_0x4751('0xb'),auth[_0x4751('0xc')](),controller[_0x4751('0x13')]);router['delete'](_0x4751('0xb'),auth[_0x4751('0xc')](),controller['destroy']);module[_0x4751('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 3482ce0..0d74984 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 _0x8325=['STRING','remoteUri','sequelize'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0x8325,0x1f1));var _0x5832=function(_0x47fc57,_0x5f0285){_0x47fc57=_0x47fc57-0x0;var _0x12944a=_0x8325[_0x47fc57];return _0x12944a;};'use strict';var Sequelize=require(_0x5832('0x0'));module['exports']={'name':{'type':Sequelize[_0x5832('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5832('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0x5832('0x1')]},'remoteUri':{'type':Sequelize[_0x5832('0x1')],'unique':_0x5832('0x2')},'serverUrl':{'type':Sequelize[_0x5832('0x1')]}}; \ No newline at end of file +var _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0xd5577a,_0x3bf904){var _0x2ad6e5=function(_0x4284a7){while(--_0x4284a7){_0xd5577a['push'](_0xd5577a['shift']());}};_0x2ad6e5(++_0x3bf904);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index ec72d14..47d5e67 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 _0xe14b=['apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','priority','group','ticket_type','company','includes','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','show','params','include','find','create','body','update','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri'];(function(_0x14f051,_0x85870b){var _0x3f59ee=function(_0xc8785a){while(--_0xc8785a){_0x14f051['push'](_0x14f051['shift']());}};_0x3f59ee(++_0x85870b);}(_0xe14b,0x93));var _0xbe14=function(_0x1c3e65,_0x326a33){_0x1c3e65=_0x1c3e65-0x0;var _0x3d988c=_0xe14b[_0x1c3e65];return _0x3d988c;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];var integrations=require(_0xbe14('0x15'));var jayson=require(_0xbe14('0x16'));var client=jayson[_0xbe14('0x17')][_0xbe14('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2850cb,_0x16893f,_0xa2cf72){if(_0xa2cf72){var _0x1e4826=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e4826[_0xbe14('0x19')](_0x16893f)){return _0x2850cb;}else{throw new db[(_0xbe14('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2850cb;}}function respondWithRpcPromise(_0x3f58f5,_0x3dc4a9,_0xf4ac9,_0x37ce4e){return new BPromise(function(_0x4e8f34,_0x21c789){var _0xe9c3ec=_0x37ce4e||client;return _0xe9c3ec[_0xbe14('0x1b')](_0x3f58f5,_0xf4ac9)[_0xbe14('0x1c')](function(_0x38f1ea){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');logger[_0xbe14('0x1f')](_0xbe14('0x20'),_0x3dc4a9,_0xbe14('0x21'),JSON[_0xbe14('0x22')](_0x38f1ea));if(_0x38f1ea[_0xbe14('0x23')]){if(_0x38f1ea[_0xbe14('0x23')]['code']===0x1f4){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')][_0xbe14('0x24')]);return _0x21c789(_0x38f1ea[_0xbe14('0x23')]['message']);}logger[_0xbe14('0x23')]('FreshdeskAccount,\x20%s,\x20%s',_0x3dc4a9,_0x38f1ea[_0xbe14('0x23')]['message']);return _0x4e8f34(_0x38f1ea[_0xbe14('0x23')]['message']);}else{logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3dc4a9,'request\x20sent');_0x4e8f34(_0x38f1ea[_0xbe14('0x25')]['message']);}})[_0xbe14('0x26')](function(_0x4851f8){logger[_0xbe14('0x23')](_0xbe14('0x1e'),_0x3dc4a9,_0x4851f8);_0x21c789(_0x4851f8);});});}function respondWithStatusCode(_0x1ee9c1,_0x39cc81){_0x39cc81=_0x39cc81||0xcc;return function(_0x15ef02){if(_0x15ef02){return _0x1ee9c1[_0xbe14('0x27')](_0x39cc81);}return _0x1ee9c1['status'](_0x39cc81)[_0xbe14('0x28')]();};}function respondWithResult(_0x1ba46a,_0x391556){_0x391556=_0x391556||0xc8;return function(_0x169369){if(_0x169369){return _0x1ba46a['status'](_0x391556)[_0xbe14('0x29')](_0x169369);}};}function respondWithFilteredResult(_0x29fc64,_0x59bf34){return function(_0x3c3613){if(_0x3c3613){var _0x3b3e84=_0x3c3613[_0xbe14('0x2a')],_0x1c7cc7=_0x59bf34[_0xbe14('0x2b')],_0x19252f=_0x59bf34[_0xbe14('0x2b')]+_0x59bf34[_0xbe14('0x2c')],_0x34d648;if(_0x19252f>=_0x3b3e84){_0x19252f=_0x3b3e84;_0x34d648=0xc8;}else{_0x34d648=0xce;}_0x29fc64[_0xbe14('0x2d')](_0x34d648);return _0x29fc64[_0xbe14('0x2e')](_0xbe14('0x2f'),_0x1c7cc7+'-'+_0x19252f+'/'+_0x3b3e84)[_0xbe14('0x29')](_0x3c3613);}return null;};}function patchUpdates(_0x10ae36){return function(_0x223f7a){try{jsonpatch[_0xbe14('0x30')](_0x223f7a,_0x10ae36,!![]);}catch(_0x6ba36c){return BPromise[_0xbe14('0x31')](_0x6ba36c);}return _0x223f7a[_0xbe14('0x32')]();};}function saveUpdates(_0x14e7c4,_0x581e86){return function(_0x2e33e1){if(_0x2e33e1){return _0x2e33e1['update'](_0x14e7c4)['then'](function(_0x46c2d1){return _0x46c2d1;});}return null;};}function removeEntity(_0x4c1e7e,_0x243524){return function(_0x345b0){if(_0x345b0){return _0x345b0['destroy']()['then'](function(){_0x4c1e7e['status'](0xcc)[_0xbe14('0x28')]();});}};}function handleEntityNotFound(_0xa3d24,_0x5f27b6){return function(_0x46c570){if(!_0x46c570){_0xa3d24[_0xbe14('0x27')](0x194);}return _0x46c570;};}function handleError(_0x452635,_0x1aa849){_0x1aa849=_0x1aa849||0x1f4;return function(_0x29c23e){logger['error'](_0x29c23e['stack']);if(_0x29c23e[_0xbe14('0x33')]){delete _0x29c23e['name'];}_0x452635['status'](_0x1aa849)['send'](_0x29c23e);};}exports[_0xbe14('0x34')]=function(_0x393f6b,_0x2bb45){var _0x3dbacb={},_0x172e79={},_0x29356f={'count':0x0,'rows':[]};var _0xcdc50=_[_0xbe14('0x35')](db[_0xbe14('0x36')][_0xbe14('0x37')],function(_0x41652d){return{'name':_0x41652d[_0xbe14('0x38')],'type':_0x41652d['type']['key']};});_0x172e79[_0xbe14('0x39')]=_[_0xbe14('0x35')](_0xcdc50,_0xbe14('0x33'));_0x172e79['query']=_[_0xbe14('0x3a')](_0x393f6b[_0xbe14('0x3b')]);_0x172e79[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],_0x172e79[_0xbe14('0x3b')]);_0x3dbacb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x172e79[_0xbe14('0x39')],qs['fields'](_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x3dbacb[_0xbe14('0x3e')]=_0x3dbacb[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x3dbacb[_0xbe14('0x3e')]:_0x172e79['model'];if(!_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x3dbacb[_0xbe14('0x2c')]=qs['limit'](_0x393f6b['query'][_0xbe14('0x2c')]);_0x3dbacb[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x393f6b['query']['offset']);}_0x3dbacb[_0xbe14('0x43')]=qs['sort'](_0x393f6b['query'][_0xbe14('0x44')]);_0x3dbacb[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x393f6b['query'],_0x172e79['filters']),_0xcdc50);if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x3dbacb[_0xbe14('0x45')]=_['merge'](_0x3dbacb[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0xcdc50,function(_0x32f22e){if(_0x32f22e[_0xbe14('0x47')]!=='VIRTUAL'){var _0x4a1a4b={};_0x4a1a4b[_0x32f22e[_0xbe14('0x33')]]={'$like':'%'+_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0x4a1a4b;}})});}_0x3dbacb=_[_0xbe14('0x48')]({},_0x3dbacb,_0x393f6b[_0xbe14('0x49')]);var _0x4f2d95={'where':_0x3dbacb['where']};return db[_0xbe14('0x36')][_0xbe14('0x2a')](_0x4f2d95)[_0xbe14('0x1c')](function(_0x2a3b35){_0x29356f['count']=_0x2a3b35;if(_0x393f6b[_0xbe14('0x3b')][_0xbe14('0x4a')]){_0x3dbacb['include']=[{'all':!![]}];}return db[_0xbe14('0x36')][_0xbe14('0x4b')](_0x3dbacb);})[_0xbe14('0x1c')](function(_0x36c20c){_0x29356f['rows']=_0x36c20c;return _0x29356f;})['then'](respondWithFilteredResult(_0x2bb45,_0x3dbacb))[_0xbe14('0x26')](handleError(_0x2bb45,null));};exports[_0xbe14('0x4c')]=function(_0x4a1a37,_0x5acf90){var _0xca8cdb={'raw':![],'where':{'id':_0x4a1a37[_0xbe14('0x4d')]['id']}},_0x5d3726={};_0x5d3726[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x36')][_0xbe14('0x37')]);_0x5d3726['query']=_[_0xbe14('0x3a')](_0x4a1a37[_0xbe14('0x3b')]);_0x5d3726[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],_0x5d3726['query']);_0xca8cdb[_0xbe14('0x3e')]=_[_0xbe14('0x3d')](_0x5d3726[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x4a1a37[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0xca8cdb['attributes']=_0xca8cdb['attributes'][_0xbe14('0x40')]?_0xca8cdb[_0xbe14('0x3e')]:_0x5d3726[_0xbe14('0x39')];if(_0x4a1a37['query']['includeAll']){_0xca8cdb[_0xbe14('0x4e')]=[{'all':!![]}];}_0xca8cdb=_[_0xbe14('0x48')]({},_0xca8cdb,_0x4a1a37['options']);return db[_0xbe14('0x36')][_0xbe14('0x4f')](_0xca8cdb)['then'](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x1c')](respondWithResult(_0x5acf90,null))['catch'](handleError(_0x5acf90,null));};exports[_0xbe14('0x50')]=function(_0x410c59,_0x12a9de){return db['FreshdeskAccount'][_0xbe14('0x50')](_0x410c59[_0xbe14('0x51')],{})['then'](respondWithResult(_0x12a9de,0xc9))[_0xbe14('0x26')](handleError(_0x12a9de,null));};exports[_0xbe14('0x52')]=function(_0x2210cc,_0x20c48d){if(_0x2210cc[_0xbe14('0x51')]['id']){delete _0x2210cc['body']['id'];}return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x2210cc[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x20c48d,null))[_0xbe14('0x1c')](saveUpdates(_0x2210cc[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x20c48d,null))['catch'](handleError(_0x20c48d,null));};exports[_0xbe14('0x53')]=function(_0x1b47a4,_0x941ee2){return db[_0xbe14('0x36')][_0xbe14('0x4f')]({'where':{'id':_0x1b47a4[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x941ee2,null))[_0xbe14('0x1c')](removeEntity(_0x941ee2,null))[_0xbe14('0x26')](handleError(_0x941ee2,null));};exports[_0xbe14('0x54')]=function(_0x358950,_0x4bccfc,_0x56bcd3){var _0x58dd79={};var _0x10c0bc={};var _0x1bfcbf;var _0x2f4e52;return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x358950[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x4bccfc,null))[_0xbe14('0x1c')](function(_0x31d015){if(_0x31d015){_0x1bfcbf=_0x31d015;_0x10c0bc[_0xbe14('0x39')]=_[_0xbe14('0x3a')](db[_0xbe14('0x56')][_0xbe14('0x37')]);_0x10c0bc[_0xbe14('0x3b')]=_[_0xbe14('0x3a')](_0x358950[_0xbe14('0x3b')]);_0x10c0bc[_0xbe14('0x3c')]=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],_0x10c0bc[_0xbe14('0x3b')]);_0x58dd79['attributes']=_[_0xbe14('0x3d')](_0x10c0bc[_0xbe14('0x39')],qs[_0xbe14('0x3f')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x3f')]));_0x58dd79[_0xbe14('0x3e')]=_0x58dd79[_0xbe14('0x3e')][_0xbe14('0x40')]?_0x58dd79[_0xbe14('0x3e')]:_0x10c0bc[_0xbe14('0x39')];_0x58dd79['order']=qs[_0xbe14('0x44')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x44')]);_0x58dd79[_0xbe14('0x45')]=qs[_0xbe14('0x3c')](_['pick'](_0x358950[_0xbe14('0x3b')],_0x10c0bc[_0xbe14('0x3c')]));if(_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]){_0x58dd79[_0xbe14('0x45')]=_['merge'](_0x58dd79[_0xbe14('0x45')],{'$or':_[_0xbe14('0x35')](_0x58dd79[_0xbe14('0x3e')],function(_0x29bb26){var _0xaebce8={};_0xaebce8[_0x29bb26]={'$like':'%'+_0x358950[_0xbe14('0x3b')][_0xbe14('0x46')]+'%'};return _0xaebce8;})});}_0x58dd79=_[_0xbe14('0x48')]({},_0x58dd79,_0x358950['options']);return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x2fdf5d){if(_0x2fdf5d){_0x2f4e52=_0x2fdf5d[_0xbe14('0x40')];if(!_0x358950[_0xbe14('0x3b')][_0xbe14('0x41')](_0xbe14('0x42'))){_0x58dd79['limit']=qs['limit'](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2c')]);_0x58dd79[_0xbe14('0x2b')]=qs[_0xbe14('0x2b')](_0x358950[_0xbe14('0x3b')][_0xbe14('0x2b')]);}return _0x1bfcbf[_0xbe14('0x54')](_0x58dd79);}})[_0xbe14('0x1c')](function(_0x50e644){if(_0x50e644){return _0x50e644?{'count':_0x2f4e52,'rows':_0x50e644}:null;}})['then'](respondWithResult(_0x4bccfc,null))[_0xbe14('0x26')](handleError(_0x4bccfc,null));};exports[_0xbe14('0x57')]=function(_0x29aa52,_0x57729f,_0x76e91e){if(_0x29aa52[_0xbe14('0x51')]['id']){delete _0x29aa52[_0xbe14('0x51')]['id'];}return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x29aa52[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x57729f,null))['then'](function(_0x43b817){if(_0x43b817){_0x29aa52[_0xbe14('0x51')][_0xbe14('0x58')]=_0x43b817['id'];_0x29aa52[_0xbe14('0x51')][_0xbe14('0x59')]=integrations[_0xbe14('0x5a')](_0x29aa52[_0xbe14('0x51')]['channel'],_0x29aa52[_0xbe14('0x51')][_0xbe14('0x47')]);_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5b')]=integrations[_0xbe14('0x5c')](_0x29aa52[_0xbe14('0x51')][_0xbe14('0x5d')],_0x29aa52[_0xbe14('0x51')]['type']);return db[_0xbe14('0x56')][_0xbe14('0x50')](_0x29aa52[_0xbe14('0x51')],{'include':[{'model':db[_0xbe14('0x5e')],'as':_0xbe14('0x59')},{'model':db[_0xbe14('0x5e')],'as':'Descriptions'}]});}return null;})[_0xbe14('0x1c')](respondWithResult(_0x57729f,null))[_0xbe14('0x26')](handleError(_0x57729f,null));};exports[_0xbe14('0x5f')]=function(_0x1b23a1,_0x508455,_0x7e9e5c){var _0x1578b6='';return db[_0xbe14('0x36')][_0xbe14('0x55')]({'where':{'id':_0x1b23a1[_0xbe14('0x4d')]['id']},'attributes':['id',_0xbe14('0x60'),_0xbe14('0x61')]})['then'](handleEntityNotFound(_0x508455,null))[_0xbe14('0x1c')](function(_0x589197){if(_0x589197){_0x1578b6=_0x589197[_0xbe14('0x60')];var _0x5d85d3=_0x1578b6[_0xbe14('0x62')](-0x1);if(_0x5d85d3==='/'){_0x1578b6=_0x1578b6[_0xbe14('0x63')](0x0,_0x1578b6[_0xbe14('0x64')](_0x5d85d3));}return rp({'method':'GET','uri':util[_0xbe14('0x65')](_0xbe14('0x66'),_0x1578b6,_0xbe14('0x67')),'headers':{'Authorization':util['format'](_0xbe14('0x68'),new Buffer(util[_0xbe14('0x65')](_0xbe14('0x69'),_0x589197[_0xbe14('0x61')]))['toString'](_0xbe14('0x6a')))},'json':!![]});}})[_0xbe14('0x1c')](function(_0x34f90b){if(_0x34f90b){var _0x2b2e0e=[_0xbe14('0x6b'),_0xbe14('0x6c'),_0xbe14('0x6d'),'description',_0xbe14('0x2d'),_0xbe14('0x6e'),_0xbe14('0x6f'),'source',_0xbe14('0x70'),_0xbe14('0x6f'),_0xbe14('0x71')];_['remove'](_0x34f90b,function(_0xa53262){return _0x2b2e0e[_0xbe14('0x72')](_0xa53262['name'])||!_0xa53262[_0xbe14('0x73')]&&_0xa53262['type']!==_0xbe14('0x74')&&_0xa53262[_0xbe14('0x47')]!=='custom_dropdown';});return{'count':_0x34f90b['length'],'rows':_[_0xbe14('0x35')](_0x34f90b,function(_0x3db955){return{'id':_0x3db955[_0xbe14('0x33')],'name':_0x3db955['label'],'custom':!_0x3db955[_0xbe14('0x73')],'options':_0x3db955[_0xbe14('0x75')]?_[_0xbe14('0x35')](_0x3db955[_0xbe14('0x75')],function(_0x5ee624){return{'name':_['capitalize'](_0x5ee624),'value':_0x5ee624};}):[]};})};}})[_0xbe14('0x1c')](respondWithResult(_0x508455,null))[_0xbe14('0x26')](function(_0xc8d0f6){var _0x215d5b=_0x1b23a1[_0xbe14('0x3b')][_0xbe14('0x19')]?0x1f4:_0xc8d0f6[_0xbe14('0x76')]||0x1f4;logger['error'](_0xbe14('0x77'),'getFields',_0x215d5b,JSON[_0xbe14('0x22')](_0xc8d0f6));delete _0xc8d0f6[_0xbe14('0x33')];if(_0x215d5b===0x191){_0x215d5b=0x190;}_0x508455[_0xbe14('0x2d')](_0x215d5b)[_0xbe14('0x78')](_0x1b23a1['query'][_0xbe14('0x19')]?{'message':_0xbe14('0x79'),'statusCode':_0xc8d0f6[_0xbe14('0x76')]}:_0xc8d0f6);});}; \ No newline at end of file +var _0xabce=['%s/%s','api/v2/ticket_fields','base64','requester','agent','priority','source','company','remove','includes','custom_text','custom_dropdown','label','default','choices','test','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','FreshdeskAccount','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','include','rows','show','params','rawAttributes','fields','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','getSubjects','channel','getDescriptions','type','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','slice','substring','GET','format'];(function(_0x2dd16b,_0x589ea5){var _0x832e78=function(_0x136f79){while(--_0x136f79){_0x2dd16b['push'](_0x2dd16b['shift']());}};_0x832e78(++_0x589ea5);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];var integrations=require(_0xeabc('0x19'));var jayson=require(_0xeabc('0x1a'));var client=jayson[_0xeabc('0x1b')][_0xeabc('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x53df9c,_0x235c2d,_0x1319f3){if(_0x1319f3){var _0x3251c6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3251c6['test'](_0x235c2d)){return _0x53df9c;}else{throw new db['Sequelize'][(_0xeabc('0x1d'))](_0xeabc('0x1e'));}}else{return _0x53df9c;}}function respondWithRpcPromise(_0x326bac,_0x53d5cb,_0xf913d7,_0x638976){return new BPromise(function(_0x49f2d8,_0x53fe28){var _0x10fa8e=_0x638976||client;return _0x10fa8e['request'](_0x326bac,_0xf913d7)[_0xeabc('0x1f')](function(_0x1b64b9){logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));logger[_0xeabc('0x23')](_0xeabc('0x24'),_0x53d5cb,_0xeabc('0x22'),JSON['stringify'](_0x1b64b9));if(_0x1b64b9[_0xeabc('0x25')]){if(_0x1b64b9['error'][_0xeabc('0x26')]===0x1f4){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x53fe28(_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);}logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x49f2d8(_0x1b64b9[_0xeabc('0x25')]['message']);}else{logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));_0x49f2d8(_0x1b64b9[_0xeabc('0x28')]['message']);}})[_0xeabc('0x29')](function(_0x480440){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x480440);_0x53fe28(_0x480440);});});}function respondWithStatusCode(_0x811f0d,_0x12acbd){_0x12acbd=_0x12acbd||0xcc;return function(_0x269621){if(_0x269621){return _0x811f0d[_0xeabc('0x2a')](_0x12acbd);}return _0x811f0d[_0xeabc('0x2b')](_0x12acbd)[_0xeabc('0x2c')]();};}function respondWithResult(_0x131722,_0x4c2693){_0x4c2693=_0x4c2693||0xc8;return function(_0x5b2934){if(_0x5b2934){return _0x131722[_0xeabc('0x2b')](_0x4c2693)['json'](_0x5b2934);}};}function respondWithFilteredResult(_0x3c1b5b,_0x2b342c){return function(_0x48fb52){if(_0x48fb52){var _0x2163e6=_0x48fb52[_0xeabc('0x2d')],_0x38572d=_0x2b342c[_0xeabc('0x2e')],_0x2b568f=_0x2b342c[_0xeabc('0x2e')]+_0x2b342c[_0xeabc('0x2f')],_0x2f8633;if(_0x2b568f>=_0x2163e6){_0x2b568f=_0x2163e6;_0x2f8633=0xc8;}else{_0x2f8633=0xce;}_0x3c1b5b[_0xeabc('0x2b')](_0x2f8633);return _0x3c1b5b['set'](_0xeabc('0x30'),_0x38572d+'-'+_0x2b568f+'/'+_0x2163e6)['json'](_0x48fb52);}return null;};}function patchUpdates(_0x2f03e8){return function(_0x2d027e){try{jsonpatch[_0xeabc('0x31')](_0x2d027e,_0x2f03e8,!![]);}catch(_0x3c606a){return BPromise[_0xeabc('0x32')](_0x3c606a);}return _0x2d027e[_0xeabc('0x33')]();};}function saveUpdates(_0x61c0af,_0x545d7f){return function(_0x78510a){if(_0x78510a){return _0x78510a[_0xeabc('0x34')](_0x61c0af)[_0xeabc('0x1f')](function(_0x4918e2){return _0x4918e2;});}return null;};}function removeEntity(_0x1e74ca,_0x3777c1){return function(_0x4492fd){if(_0x4492fd){return _0x4492fd['destroy']()[_0xeabc('0x1f')](function(){_0x1e74ca[_0xeabc('0x2b')](0xcc)[_0xeabc('0x2c')]();});}};}function handleEntityNotFound(_0x521091,_0xf98c7c){return function(_0x286203){if(!_0x286203){_0x521091['sendStatus'](0x194);}return _0x286203;};}function handleError(_0x50cca2,_0x254568){_0x254568=_0x254568||0x1f4;return function(_0x3829a9){logger['error'](_0x3829a9[_0xeabc('0x35')]);if(_0x3829a9[_0xeabc('0x36')]){delete _0x3829a9[_0xeabc('0x36')];}_0x50cca2[_0xeabc('0x2b')](_0x254568)[_0xeabc('0x37')](_0x3829a9);};}exports['index']=function(_0x353e48,_0x5b61fa){var _0x31ee7a={},_0x2bda29={},_0x311291={'count':0x0,'rows':[]};var _0x5b52c4=_['map'](db[_0xeabc('0x38')]['rawAttributes'],function(_0x113d5a){return{'name':_0x113d5a['fieldName'],'type':_0x113d5a['type']['key']};});_0x2bda29['model']=_[_0xeabc('0x39')](_0x5b52c4,'name');_0x2bda29[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x353e48['query']);_0x2bda29[_0xeabc('0x3c')]=_['intersection'](_0x2bda29[_0xeabc('0x3d')],_0x2bda29['query']);_0x31ee7a[_0xeabc('0x3e')]=_[_0xeabc('0x3f')](_0x2bda29[_0xeabc('0x3d')],qs['fields'](_0x353e48['query']['fields']));_0x31ee7a[_0xeabc('0x3e')]=_0x31ee7a[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x31ee7a['attributes']:_0x2bda29['model'];if(!_0x353e48[_0xeabc('0x3a')][_0xeabc('0x41')]('nolimit')){_0x31ee7a[_0xeabc('0x2f')]=qs['limit'](_0x353e48[_0xeabc('0x3a')]['limit']);_0x31ee7a['offset']=qs['offset'](_0x353e48[_0xeabc('0x3a')][_0xeabc('0x2e')]);}_0x31ee7a[_0xeabc('0x42')]=qs[_0xeabc('0x43')](_0x353e48['query'][_0xeabc('0x43')]);_0x31ee7a['where']=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x353e48[_0xeabc('0x3a')],_0x2bda29[_0xeabc('0x3c')]),_0x5b52c4);if(_0x353e48[_0xeabc('0x3a')]['filter']){_0x31ee7a['where']=_[_0xeabc('0x45')](_0x31ee7a['where'],{'$or':_[_0xeabc('0x39')](_0x5b52c4,function(_0x2cdf59){if(_0x2cdf59['type']!==_0xeabc('0x46')){var _0x2b3c28={};_0x2b3c28[_0x2cdf59[_0xeabc('0x36')]]={'$like':'%'+_0x353e48[_0xeabc('0x3a')][_0xeabc('0x47')]+'%'};return _0x2b3c28;}})});}_0x31ee7a=_[_0xeabc('0x45')]({},_0x31ee7a,_0x353e48[_0xeabc('0x48')]);var _0x4b2fb6={'where':_0x31ee7a[_0xeabc('0x49')]};return db[_0xeabc('0x38')][_0xeabc('0x2d')](_0x4b2fb6)[_0xeabc('0x1f')](function(_0x271f8c){_0x311291[_0xeabc('0x2d')]=_0x271f8c;if(_0x353e48[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x31ee7a[_0xeabc('0x4b')]=[{'all':!![]}];}return db[_0xeabc('0x38')]['findAll'](_0x31ee7a);})[_0xeabc('0x1f')](function(_0x2e6efb){_0x311291[_0xeabc('0x4c')]=_0x2e6efb;return _0x311291;})[_0xeabc('0x1f')](respondWithFilteredResult(_0x5b61fa,_0x31ee7a))[_0xeabc('0x29')](handleError(_0x5b61fa,null));};exports[_0xeabc('0x4d')]=function(_0x268d95,_0x48df43){var _0x766743={'raw':![],'where':{'id':_0x268d95[_0xeabc('0x4e')]['id']}},_0x32e09b={};_0x32e09b[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db['FreshdeskAccount'][_0xeabc('0x4f')]);_0x32e09b[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x268d95[_0xeabc('0x3a')]);_0x32e09b['filters']=_[_0xeabc('0x3f')](_0x32e09b[_0xeabc('0x3d')],_0x32e09b['query']);_0x766743[_0xeabc('0x3e')]=_['intersection'](_0x32e09b[_0xeabc('0x3d')],qs['fields'](_0x268d95[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x766743[_0xeabc('0x3e')]=_0x766743[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x766743[_0xeabc('0x3e')]:_0x32e09b[_0xeabc('0x3d')];if(_0x268d95[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x766743[_0xeabc('0x4b')]=[{'all':!![]}];}_0x766743=_['merge']({},_0x766743,_0x268d95[_0xeabc('0x48')]);return db[_0xeabc('0x38')][_0xeabc('0x51')](_0x766743)[_0xeabc('0x1f')](handleEntityNotFound(_0x48df43,null))['then'](respondWithResult(_0x48df43,null))[_0xeabc('0x29')](handleError(_0x48df43,null));};exports[_0xeabc('0x52')]=function(_0x10d56f,_0x21f972){return db['FreshdeskAccount'][_0xeabc('0x52')](_0x10d56f[_0xeabc('0x53')],{})[_0xeabc('0x1f')](respondWithResult(_0x21f972,0xc9))[_0xeabc('0x29')](handleError(_0x21f972,null));};exports[_0xeabc('0x34')]=function(_0x3b5e94,_0x14c322){if(_0x3b5e94[_0xeabc('0x53')]['id']){delete _0x3b5e94[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0x3b5e94['params']['id']}})['then'](handleEntityNotFound(_0x14c322,null))['then'](saveUpdates(_0x3b5e94[_0xeabc('0x53')],null))[_0xeabc('0x1f')](respondWithResult(_0x14c322,null))[_0xeabc('0x29')](handleError(_0x14c322,null));};exports[_0xeabc('0x54')]=function(_0xe89728,_0x2f78f3){return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0xe89728[_0xeabc('0x4e')]['id']}})[_0xeabc('0x1f')](handleEntityNotFound(_0x2f78f3,null))[_0xeabc('0x1f')](removeEntity(_0x2f78f3,null))[_0xeabc('0x29')](handleError(_0x2f78f3,null));};exports[_0xeabc('0x55')]=function(_0x1750e9,_0x25c728,_0x5820ca){var _0x5b8370={};var _0x180e62={};var _0x340520;var _0x2c0894;return db['FreshdeskAccount'][_0xeabc('0x56')]({'where':{'id':_0x1750e9['params']['id']}})['then'](handleEntityNotFound(_0x25c728,null))[_0xeabc('0x1f')](function(_0x1fca99){if(_0x1fca99){_0x340520=_0x1fca99;_0x180e62[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db[_0xeabc('0x57')][_0xeabc('0x4f')]);_0x180e62['query']=_[_0xeabc('0x3b')](_0x1750e9[_0xeabc('0x3a')]);_0x180e62[_0xeabc('0x3c')]=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],_0x180e62[_0xeabc('0x3a')]);_0x5b8370['attributes']=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],qs[_0xeabc('0x50')](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x5b8370[_0xeabc('0x3e')]=_0x5b8370[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x5b8370[_0xeabc('0x3e')]:_0x180e62['model'];_0x5b8370[_0xeabc('0x42')]=qs['sort'](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x43')]);_0x5b8370[_0xeabc('0x49')]=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x1750e9[_0xeabc('0x3a')],_0x180e62[_0xeabc('0x3c')]));if(_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x47')]){_0x5b8370[_0xeabc('0x49')]=_['merge'](_0x5b8370[_0xeabc('0x49')],{'$or':_[_0xeabc('0x39')](_0x5b8370[_0xeabc('0x3e')],function(_0x41cad5){var _0x5b4430={};_0x5b4430[_0x41cad5]={'$like':'%'+_0x1750e9[_0xeabc('0x3a')]['filter']+'%'};return _0x5b4430;})});}_0x5b8370=_['merge']({},_0x5b8370,_0x1750e9[_0xeabc('0x48')]);return _0x340520[_0xeabc('0x55')](_0x5b8370);}})[_0xeabc('0x1f')](function(_0x1c91e4){if(_0x1c91e4){_0x2c0894=_0x1c91e4['length'];if(!_0x1750e9['query'][_0xeabc('0x41')]('nolimit')){_0x5b8370['limit']=qs[_0xeabc('0x2f')](_0x1750e9['query']['limit']);_0x5b8370[_0xeabc('0x2e')]=qs[_0xeabc('0x2e')](_0x1750e9['query']['offset']);}return _0x340520[_0xeabc('0x55')](_0x5b8370);}})['then'](function(_0x238e2d){if(_0x238e2d){return _0x238e2d?{'count':_0x2c0894,'rows':_0x238e2d}:null;}})[_0xeabc('0x1f')](respondWithResult(_0x25c728,null))['catch'](handleError(_0x25c728,null));};exports['addConfiguration']=function(_0x24365a,_0x74f5ac,_0xd86ea7){if(_0x24365a[_0xeabc('0x53')]['id']){delete _0x24365a[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x24365a[_0xeabc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x74f5ac,null))[_0xeabc('0x1f')](function(_0x5086c6){if(_0x5086c6){_0x24365a[_0xeabc('0x53')]['AccountId']=_0x5086c6['id'];_0x24365a[_0xeabc('0x53')]['Subjects']=integrations[_0xeabc('0x58')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')]['type']);_0x24365a[_0xeabc('0x53')]['Descriptions']=integrations[_0xeabc('0x5a')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')][_0xeabc('0x5b')]);return db['FreshdeskConfiguration'][_0xeabc('0x52')](_0x24365a[_0xeabc('0x53')],{'include':[{'model':db[_0xeabc('0x5c')],'as':_0xeabc('0x5d')},{'model':db['FreshdeskField'],'as':_0xeabc('0x5e')}]});}return null;})[_0xeabc('0x1f')](respondWithResult(_0x74f5ac,null))[_0xeabc('0x29')](handleError(_0x74f5ac,null));};exports[_0xeabc('0x5f')]=function(_0x5bacbb,_0xb9b460,_0x368cd4){var _0x287f88='';return db[_0xeabc('0x38')]['findOne']({'where':{'id':_0x5bacbb['params']['id']},'attributes':['id',_0xeabc('0x60'),'apiKey']})['then'](handleEntityNotFound(_0xb9b460,null))[_0xeabc('0x1f')](function(_0x460f07){if(_0x460f07){_0x287f88=_0x460f07[_0xeabc('0x60')];var _0x49679d=_0x287f88[_0xeabc('0x61')](-0x1);if(_0x49679d==='/'){_0x287f88=_0x287f88[_0xeabc('0x62')](0x0,_0x287f88['lastIndexOf'](_0x49679d));}return rp({'method':_0xeabc('0x63'),'uri':util[_0xeabc('0x64')](_0xeabc('0x65'),_0x287f88,_0xeabc('0x66')),'headers':{'Authorization':util[_0xeabc('0x64')]('Basic\x20%s',new Buffer(util[_0xeabc('0x64')]('%s:X',_0x460f07['apiKey']))['toString'](_0xeabc('0x67')))},'json':!![]});}})[_0xeabc('0x1f')](function(_0x1b6e9e){if(_0x1b6e9e){var _0x4424ce=[_0xeabc('0x68'),'subject',_0xeabc('0x69'),'description',_0xeabc('0x2b'),_0xeabc('0x6a'),'group',_0xeabc('0x6b'),'ticket_type','group',_0xeabc('0x6c')];_[_0xeabc('0x6d')](_0x1b6e9e,function(_0x439a48){return _0x4424ce[_0xeabc('0x6e')](_0x439a48[_0xeabc('0x36')])||!_0x439a48['default']&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x6f')&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x70');});return{'count':_0x1b6e9e[_0xeabc('0x40')],'rows':_[_0xeabc('0x39')](_0x1b6e9e,function(_0x2d05b4){return{'id':_0x2d05b4[_0xeabc('0x36')],'name':_0x2d05b4[_0xeabc('0x71')],'custom':!_0x2d05b4[_0xeabc('0x72')],'options':_0x2d05b4['choices']?_[_0xeabc('0x39')](_0x2d05b4[_0xeabc('0x73')],function(_0xba29f){return{'name':_['capitalize'](_0xba29f),'value':_0xba29f};}):[]};})};}})['then'](respondWithResult(_0xb9b460,null))[_0xeabc('0x29')](function(_0x273ca5){var _0xe90200=_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?0x1f4:_0x273ca5['statusCode']||0x1f4;logger[_0xeabc('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xe90200,JSON[_0xeabc('0x75')](_0x273ca5));delete _0x273ca5[_0xeabc('0x36')];if(_0xe90200===0x191){_0xe90200=0x190;}_0xb9b460['status'](_0xe90200)[_0xeabc('0x37')](_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?{'message':_0xeabc('0x76'),'statusCode':_0x273ca5[_0xeabc('0x77')]}:_0x273ca5);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index b5a99c9..e732c85 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 _0xf4af=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x17a5c2,_0x3ad5a5){var _0x25fa0a=function(_0x2cc2b9){while(--_0x2cc2b9){_0x17a5c2['push'](_0x17a5c2['shift']());}};_0x25fa0a(++_0x3ad5a5);}(_0xf4af,0x13b));var _0xff4a=function(_0x353643,_0x568495){_0x353643=_0x353643-0x0;var _0x394b32=_0xf4af[_0x353643];return _0x394b32;};'use strict';var _=require('lodash');var util=require(_0xff4a('0x0'));var logger=require(_0xff4a('0x1'))('api');var moment=require(_0xff4a('0x2'));var BPromise=require(_0xff4a('0x3'));var rp=require(_0xff4a('0x4'));var fs=require('fs');var path=require(_0xff4a('0x5'));var rimraf=require(_0xff4a('0x6'));var config=require(_0xff4a('0x7'));var attributes=require(_0xff4a('0x8'));var integrations=require(_0xff4a('0x9'));module[_0xff4a('0xa')]=function(_0x310258,_0x28bb41){return _0x310258[_0xff4a('0xb')](_0xff4a('0xc'),attributes,{'tableName':_0xff4a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bfd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','util'];(function(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0x6bfd,0x113));var _0xd6bf=function(_0x34053b,_0x9098d6){_0x34053b=_0x34053b-0x0;var _0x18970d=_0x6bfd[_0x34053b];return _0x18970d;};'use strict';var _=require('lodash');var util=require(_0xd6bf('0x0'));var logger=require(_0xd6bf('0x1'))(_0xd6bf('0x2'));var moment=require(_0xd6bf('0x3'));var BPromise=require(_0xd6bf('0x4'));var rp=require(_0xd6bf('0x5'));var fs=require('fs');var path=require(_0xd6bf('0x6'));var rimraf=require(_0xd6bf('0x7'));var config=require(_0xd6bf('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xd6bf('0x9'));module[_0xd6bf('0xa')]=function(_0x26379f,_0x4b585d){return _0x26379f[_0xd6bf('0xb')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 5d6cd46..abb68dd 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 _0xac68=['GetFreshdeskAccount','ShowFreshdeskAccount','find','raw','where','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','FreshdeskAccount','findAll','options','limit','map','include','model','attributes'];(function(_0x3e46d6,_0x4f5a19){var _0x12f066=function(_0x1aa0ca){while(--_0x1aa0ca){_0x3e46d6['push'](_0x3e46d6['shift']());}};_0x12f066(++_0x4f5a19);}(_0xac68,0xcc));var _0x8ac6=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0xac68[_0x75f869];return _0x10af8b;};'use strict';var _=require(_0x8ac6('0x0'));var util=require('util');var moment=require(_0x8ac6('0x1'));var BPromise=require('bluebird');var rs=require(_0x8ac6('0x2'));var fs=require('fs');var Redis=require(_0x8ac6('0x3'));var db=require(_0x8ac6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8ac6('0x5'));var config=require(_0x8ac6('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ac6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x441605,_0xd756f5,_0x25ef1c){return new BPromise(function(_0x13d4db,_0x42c093){return client[_0x8ac6('0x8')](_0x441605,_0x25ef1c)[_0x8ac6('0x9')](function(_0x133a4a){logger[_0x8ac6('0xa')](_0x8ac6('0xb'),_0xd756f5,_0x8ac6('0xc'));logger[_0x8ac6('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xd756f5,_0x8ac6('0xc'),JSON['stringify'](_0x133a4a));if(_0x133a4a['error']){if(_0x133a4a[_0x8ac6('0xe')][_0x8ac6('0xf')]===0x1f4){logger[_0x8ac6('0xe')](_0x8ac6('0xb'),_0xd756f5,_0x133a4a[_0x8ac6('0xe')]['message']);return _0x42c093(_0x133a4a[_0x8ac6('0xe')][_0x8ac6('0x10')]);}logger[_0x8ac6('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0xd756f5,_0x133a4a['error'][_0x8ac6('0x10')]);return _0x13d4db(_0x133a4a[_0x8ac6('0xe')][_0x8ac6('0x10')]);}else{logger[_0x8ac6('0xa')](_0x8ac6('0xb'),_0xd756f5,_0x8ac6('0xc'));_0x13d4db(_0x133a4a[_0x8ac6('0x11')][_0x8ac6('0x10')]);}})[_0x8ac6('0x12')](function(_0x45ff76){logger[_0x8ac6('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0xd756f5,_0x45ff76);_0x42c093(_0x45ff76);});});}exports['GetFreshdeskAccount']=function(_0x5c5b98){var _0x5d9e9e=this;return new Promise(function(_0x2282b9,_0x4ec8e3){return db[_0x8ac6('0x13')][_0x8ac6('0x14')]({'raw':_0x5c5b98[_0x8ac6('0x15')]?_0x5c5b98[_0x8ac6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5c5b98[_0x8ac6('0x15')]?_0x5c5b98['options']['where']||null:null,'attributes':_0x5c5b98[_0x8ac6('0x15')]?_0x5c5b98[_0x8ac6('0x15')]['attributes']||null:null,'limit':_0x5c5b98['options']?_0x5c5b98[_0x8ac6('0x15')][_0x8ac6('0x16')]||null:null,'include':_0x5c5b98[_0x8ac6('0x15')]?_0x5c5b98[_0x8ac6('0x15')]['include']?_[_0x8ac6('0x17')](_0x5c5b98[_0x8ac6('0x15')][_0x8ac6('0x18')],function(_0x19b8e2){return{'model':db[_0x19b8e2[_0x8ac6('0x19')]],'as':_0x19b8e2['as'],'attributes':_0x19b8e2['attributes'],'include':_0x19b8e2[_0x8ac6('0x18')]?_[_0x8ac6('0x17')](_0x19b8e2[_0x8ac6('0x18')],function(_0x2f5595){return{'model':db[_0x2f5595[_0x8ac6('0x19')]],'as':_0x2f5595['as'],'attributes':_0x2f5595[_0x8ac6('0x1a')],'include':_0x2f5595[_0x8ac6('0x18')]?_['map'](_0x2f5595[_0x8ac6('0x18')],function(_0x1f25e4){return{'model':db[_0x1f25e4[_0x8ac6('0x19')]],'as':_0x1f25e4['as'],'attributes':_0x1f25e4[_0x8ac6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f2541){logger[_0x8ac6('0xa')]('GetFreshdeskAccount',_0x5c5b98);logger[_0x8ac6('0xd')]('GetFreshdeskAccount',_0x5c5b98,JSON['stringify'](_0x4f2541));_0x2282b9(_0x4f2541);})[_0x8ac6('0x12')](function(_0x2f33ec){logger['error'](_0x8ac6('0x1b'),_0x2f33ec[_0x8ac6('0x10')],_0x5c5b98);_0x4ec8e3(_0x5d9e9e[_0x8ac6('0xe')](0x1f4,_0x2f33ec[_0x8ac6('0x10')]));});});};exports[_0x8ac6('0x1c')]=function(_0x1f9319){var _0x45eb9c=this;return new Promise(function(_0x1de448,_0x2397d9){return db[_0x8ac6('0x13')][_0x8ac6('0x1d')]({'raw':_0x1f9319[_0x8ac6('0x15')]?_0x1f9319[_0x8ac6('0x15')][_0x8ac6('0x1e')]===undefined?!![]:![]:!![],'where':_0x1f9319[_0x8ac6('0x15')]?_0x1f9319['options'][_0x8ac6('0x1f')]||null:null,'attributes':_0x1f9319['options']?_0x1f9319[_0x8ac6('0x15')][_0x8ac6('0x1a')]||null:null,'include':_0x1f9319[_0x8ac6('0x15')]?_0x1f9319[_0x8ac6('0x15')][_0x8ac6('0x18')]?_[_0x8ac6('0x17')](_0x1f9319[_0x8ac6('0x15')]['include'],function(_0x551784){return{'model':db[_0x551784['model']],'as':_0x551784['as'],'attributes':_0x551784['attributes'],'include':_0x551784[_0x8ac6('0x18')]?_[_0x8ac6('0x17')](_0x551784[_0x8ac6('0x18')],function(_0x4bd16d){return{'model':db[_0x4bd16d[_0x8ac6('0x19')]],'as':_0x4bd16d['as'],'attributes':_0x4bd16d[_0x8ac6('0x1a')],'include':_0x4bd16d[_0x8ac6('0x18')]?_[_0x8ac6('0x17')](_0x4bd16d[_0x8ac6('0x18')],function(_0xf2f890){return{'model':db[_0xf2f890[_0x8ac6('0x19')]],'as':_0xf2f890['as'],'attributes':_0xf2f890[_0x8ac6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ac6('0x9')](function(_0x45c600){logger[_0x8ac6('0xa')](_0x8ac6('0x1c'),_0x1f9319);logger[_0x8ac6('0xd')]('ShowFreshdeskAccount',_0x1f9319,JSON[_0x8ac6('0x20')](_0x45c600));_0x1de448(_0x45c600);})[_0x8ac6('0x12')](function(_0x34ae19){logger[_0x8ac6('0xe')](_0x8ac6('0x1c'),_0x34ae19[_0x8ac6('0x10')],_0x1f9319);_0x2397d9(_0x45eb9c['error'](0x1f4,_0x34ae19[_0x8ac6('0x10')]));});});}; \ No newline at end of file +var _0x6da2=['result','GetFreshdeskAccount','FreshdeskAccount','options','raw','limit','include','map','model','attributes','then','debug','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3f9882,_0x4063bb){var _0x18b725=function(_0x8e5916){while(--_0x8e5916){_0x3f9882['push'](_0x3f9882['shift']());}};_0x18b725(++_0x4063bb);}(_0x6da2,0x112));var _0x26da=function(_0x4d0d2d,_0x4b4ca1){_0x4d0d2d=_0x4d0d2d-0x0;var _0x1e1a80=_0x6da2[_0x4d0d2d];return _0x1e1a80;};'use strict';var _=require(_0x26da('0x0'));var util=require(_0x26da('0x1'));var moment=require(_0x26da('0x2'));var BPromise=require(_0x26da('0x3'));var rs=require(_0x26da('0x4'));var fs=require('fs');var Redis=require(_0x26da('0x5'));var db=require(_0x26da('0x6'))['db'];var utils=require(_0x26da('0x7'));var logger=require(_0x26da('0x8'))(_0x26da('0x9'));var config=require(_0x26da('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x26da('0xb')][_0x26da('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a45bd,_0x3f5059,_0x4fed25){return new BPromise(function(_0x5e1bda,_0x51655c){return client[_0x26da('0xd')](_0x3a45bd,_0x4fed25)['then'](function(_0x2198f9){logger['info'](_0x26da('0xe'),_0x3f5059,_0x26da('0xf'));logger['debug'](_0x26da('0x10'),_0x3f5059,_0x26da('0xf'),JSON[_0x26da('0x11')](_0x2198f9));if(_0x2198f9[_0x26da('0x12')]){if(_0x2198f9['error'][_0x26da('0x13')]===0x1f4){logger[_0x26da('0x12')](_0x26da('0xe'),_0x3f5059,_0x2198f9['error'][_0x26da('0x14')]);return _0x51655c(_0x2198f9[_0x26da('0x12')][_0x26da('0x14')]);}logger['error'](_0x26da('0xe'),_0x3f5059,_0x2198f9[_0x26da('0x12')][_0x26da('0x14')]);return _0x5e1bda(_0x2198f9[_0x26da('0x12')][_0x26da('0x14')]);}else{logger[_0x26da('0x15')](_0x26da('0xe'),_0x3f5059,'request\x20sent');_0x5e1bda(_0x2198f9[_0x26da('0x16')][_0x26da('0x14')]);}})['catch'](function(_0x6685c5){logger['error'](_0x26da('0xe'),_0x3f5059,_0x6685c5);_0x51655c(_0x6685c5);});});}exports[_0x26da('0x17')]=function(_0x33d172){var _0x391371=this;return new Promise(function(_0x5e4d83,_0x4f0545){return db[_0x26da('0x18')]['findAll']({'raw':_0x33d172['options']?_0x33d172[_0x26da('0x19')][_0x26da('0x1a')]===undefined?!![]:![]:!![],'where':_0x33d172[_0x26da('0x19')]?_0x33d172[_0x26da('0x19')]['where']||null:null,'attributes':_0x33d172[_0x26da('0x19')]?_0x33d172['options']['attributes']||null:null,'limit':_0x33d172[_0x26da('0x19')]?_0x33d172[_0x26da('0x19')][_0x26da('0x1b')]||null:null,'include':_0x33d172[_0x26da('0x19')]?_0x33d172[_0x26da('0x19')][_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x33d172[_0x26da('0x19')][_0x26da('0x1c')],function(_0x54c667){return{'model':db[_0x54c667[_0x26da('0x1e')]],'as':_0x54c667['as'],'attributes':_0x54c667[_0x26da('0x1f')],'include':_0x54c667[_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x54c667[_0x26da('0x1c')],function(_0x46cb02){return{'model':db[_0x46cb02[_0x26da('0x1e')]],'as':_0x46cb02['as'],'attributes':_0x46cb02[_0x26da('0x1f')],'include':_0x46cb02[_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x46cb02['include'],function(_0x393334){return{'model':db[_0x393334['model']],'as':_0x393334['as'],'attributes':_0x393334[_0x26da('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x26da('0x20')](function(_0x415556){logger[_0x26da('0x15')](_0x26da('0x17'),_0x33d172);logger[_0x26da('0x21')](_0x26da('0x17'),_0x33d172,JSON[_0x26da('0x11')](_0x415556));_0x5e4d83(_0x415556);})[_0x26da('0x22')](function(_0x21cb43){logger[_0x26da('0x12')]('GetFreshdeskAccount',_0x21cb43[_0x26da('0x14')],_0x33d172);_0x4f0545(_0x391371[_0x26da('0x12')](0x1f4,_0x21cb43[_0x26da('0x14')]));});});};exports[_0x26da('0x23')]=function(_0x31afc9){var _0x2e8e21=this;return new Promise(function(_0x34e183,_0x1ddf53){return db['FreshdeskAccount'][_0x26da('0x24')]({'raw':_0x31afc9[_0x26da('0x19')]?_0x31afc9[_0x26da('0x19')][_0x26da('0x1a')]===undefined?!![]:![]:!![],'where':_0x31afc9[_0x26da('0x19')]?_0x31afc9[_0x26da('0x19')]['where']||null:null,'attributes':_0x31afc9[_0x26da('0x19')]?_0x31afc9[_0x26da('0x19')][_0x26da('0x1f')]||null:null,'include':_0x31afc9['options']?_0x31afc9['options'][_0x26da('0x1c')]?_['map'](_0x31afc9[_0x26da('0x19')][_0x26da('0x1c')],function(_0x1ec2bd){return{'model':db[_0x1ec2bd[_0x26da('0x1e')]],'as':_0x1ec2bd['as'],'attributes':_0x1ec2bd[_0x26da('0x1f')],'include':_0x1ec2bd[_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x1ec2bd['include'],function(_0x58aa5e){return{'model':db[_0x58aa5e[_0x26da('0x1e')]],'as':_0x58aa5e['as'],'attributes':_0x58aa5e[_0x26da('0x1f')],'include':_0x58aa5e[_0x26da('0x1c')]?_[_0x26da('0x1d')](_0x58aa5e[_0x26da('0x1c')],function(_0x2590f9){return{'model':db[_0x2590f9[_0x26da('0x1e')]],'as':_0x2590f9['as'],'attributes':_0x2590f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x26da('0x20')](function(_0x515502){logger[_0x26da('0x15')](_0x26da('0x23'),_0x31afc9);logger['debug'](_0x26da('0x23'),_0x31afc9,JSON[_0x26da('0x11')](_0x515502));_0x34e183(_0x515502);})[_0x26da('0x22')](function(_0x27a828){logger[_0x26da('0x12')](_0x26da('0x23'),_0x27a828['message'],_0x31afc9);_0x1ddf53(_0x2e8e21['error'](0x1f4,_0x27a828[_0x26da('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a84ad89..0026f04 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 _0xd216=['/:id/fields','getFields','/:id/tags','post','create','put','update','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd216,0xa9));var _0x6d21=function(_0x2e3796,_0x26a534){_0x2e3796=_0x2e3796-0x0;var _0x373be1=_0xd216[_0x2e3796];return _0x373be1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d21('0x0'));var timeout=require(_0x6d21('0x1'));var express=require(_0x6d21('0x2'));var router=express['Router']();var auth=require(_0x6d21('0x3'));var interaction=require(_0x6d21('0x4'));var config=require(_0x6d21('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x6d21('0x6')]('/',auth[_0x6d21('0x7')](),controller[_0x6d21('0x8')]);router['get'](_0x6d21('0x9'),auth[_0x6d21('0x7')](),controller[_0x6d21('0xa')]);router[_0x6d21('0x6')](_0x6d21('0xb'),auth[_0x6d21('0x7')](),controller[_0x6d21('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x6d21('0x7')](),controller['getDescriptions']);router[_0x6d21('0x6')](_0x6d21('0xd'),auth[_0x6d21('0x7')](),controller['getTags']);router[_0x6d21('0xe')]('/',auth[_0x6d21('0x7')](),controller[_0x6d21('0xf')]);router[_0x6d21('0xe')](_0x6d21('0xd'),auth['isAuthenticated'](),controller['setTags']);router[_0x6d21('0x10')](_0x6d21('0x9'),auth[_0x6d21('0x7')](),controller[_0x6d21('0x11')]);router['delete'](_0x6d21('0x9'),auth[_0x6d21('0x7')](),controller[_0x6d21('0x12')]);module[_0x6d21('0x13')]=router; \ No newline at end of file +var _0xb630=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete'];(function(_0x301a9e,_0xae4efe){var _0x28e9ca=function(_0xb6f3a3){while(--_0xb6f3a3){_0x301a9e['push'](_0x301a9e['shift']());}};_0x28e9ca(++_0xae4efe);}(_0xb630,0x106));var _0x0b63=function(_0x1090f8,_0xd83a11){_0x1090f8=_0x1090f8-0x0;var _0x180524=_0xb630[_0x1090f8];return _0x180524;};'use strict';var multer=require(_0x0b63('0x0'));var util=require(_0x0b63('0x1'));var path=require(_0x0b63('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0b63('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0b63('0x4'));var config=require(_0x0b63('0x5'));var controller=require(_0x0b63('0x6'));router[_0x0b63('0x7')]('/',auth[_0x0b63('0x8')](),controller[_0x0b63('0x9')]);router['get'](_0x0b63('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0b63('0xb'),auth[_0x0b63('0x8')](),controller[_0x0b63('0xc')]);router[_0x0b63('0x7')]('/:id/subjects',auth[_0x0b63('0x8')](),controller[_0x0b63('0xd')]);router[_0x0b63('0x7')](_0x0b63('0xe'),auth[_0x0b63('0x8')](),controller[_0x0b63('0xf')]);router[_0x0b63('0x7')](_0x0b63('0x10'),auth[_0x0b63('0x8')](),controller[_0x0b63('0x11')]);router[_0x0b63('0x12')]('/',auth[_0x0b63('0x8')](),controller[_0x0b63('0x13')]);router[_0x0b63('0x12')](_0x0b63('0x10'),auth[_0x0b63('0x8')](),controller[_0x0b63('0x14')]);router[_0x0b63('0x15')](_0x0b63('0xa'),auth['isAuthenticated'](),controller[_0x0b63('0x16')]);router[_0x0b63('0x17')](_0x0b63('0xa'),auth[_0x0b63('0x8')](),controller[_0x0b63('0x18')]);module[_0x0b63('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 6e1d5ee..a325098 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 _0x0fe5=['STRING','sequelize','exports'];(function(_0x15534e,_0x313eab){var _0x3327bf=function(_0x3204c9){while(--_0x3204c9){_0x15534e['push'](_0x15534e['shift']());}};_0x3327bf(++_0x313eab);}(_0x0fe5,0xd3));var _0x50fe=function(_0x376555,_0x1fbf37){_0x376555=_0x376555-0x0;var _0x13023a=_0x0fe5[_0x376555];return _0x13023a;};'use strict';var Sequelize=require(_0x50fe('0x0'));module[_0x50fe('0x1')]={'name':{'type':Sequelize[_0x50fe('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb54d=['STRING','sequelize','exports'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb54d,0x1de));var _0xdb54=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0xb54d[_0x500785];return _0x1f8bcc;};'use strict';var Sequelize=require(_0xdb54('0x0'));module[_0xdb54('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb54('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 2b62ee6..030d816 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 _0x00bb=['rows','length','find','create','body','params','getFields','findOne','FreshdeskField','order','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','findAll'];(function(_0xd081f8,_0xe64ecb){var _0x3b026e=function(_0x3ad59d){while(--_0x3ad59d){_0xd081f8['push'](_0xd081f8['shift']());}};_0x3b026e(++_0xe64ecb);}(_0x00bb,0x1d8));var _0xb00b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x00bb[_0x23e7c1];return _0x1add43;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xb00b('0x14'));var client=jayson[_0xb00b('0x15')][_0xb00b('0x16')]({'port':0x232a});function checkPasswordPattern(_0x466b9b,_0xef5d52,_0x1f1c1d){if(_0x1f1c1d){var _0x4ada81=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ada81[_0xb00b('0x17')](_0xef5d52)){return _0x466b9b;}else{throw new db[(_0xb00b('0x18'))]['ValidationError'](_0xb00b('0x19'));}}else{return _0x466b9b;}}function respondWithRpcPromise(_0x1084a6,_0x540b79,_0x5da36b,_0x9b471e){return new BPromise(function(_0x4dcd45,_0x51d136){var _0x1f9c78=_0x9b471e||client;return _0x1f9c78[_0xb00b('0x1a')](_0x1084a6,_0x5da36b)[_0xb00b('0x1b')](function(_0xbb72fc){logger['info'](_0xb00b('0x1c'),_0x540b79,'request\x20sent');logger[_0xb00b('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x540b79,_0xb00b('0x1e'),JSON['stringify'](_0xbb72fc));if(_0xbb72fc[_0xb00b('0x1f')]){if(_0xbb72fc[_0xb00b('0x1f')]['code']===0x1f4){logger['error'](_0xb00b('0x1c'),_0x540b79,_0xbb72fc['error'][_0xb00b('0x20')]);return _0x51d136(_0xbb72fc[_0xb00b('0x1f')][_0xb00b('0x20')]);}logger[_0xb00b('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x540b79,_0xbb72fc[_0xb00b('0x1f')]['message']);return _0x4dcd45(_0xbb72fc[_0xb00b('0x1f')][_0xb00b('0x20')]);}else{logger['info'](_0xb00b('0x1c'),_0x540b79,_0xb00b('0x1e'));_0x4dcd45(_0xbb72fc['result'][_0xb00b('0x20')]);}})[_0xb00b('0x21')](function(_0x5568bb){logger[_0xb00b('0x1f')](_0xb00b('0x1c'),_0x540b79,_0x5568bb);_0x51d136(_0x5568bb);});});}function respondWithStatusCode(_0x3c9500,_0x8caadf){_0x8caadf=_0x8caadf||0xcc;return function(_0x520e55){if(_0x520e55){return _0x3c9500['sendStatus'](_0x8caadf);}return _0x3c9500[_0xb00b('0x22')](_0x8caadf)['end']();};}function respondWithResult(_0x550587,_0x4a635e){_0x4a635e=_0x4a635e||0xc8;return function(_0x16ac55){if(_0x16ac55){return _0x550587[_0xb00b('0x22')](_0x4a635e)[_0xb00b('0x23')](_0x16ac55);}};}function respondWithFilteredResult(_0x3825af,_0x1f14fa){return function(_0x197379){if(_0x197379){var _0x15d3b9=_0x197379[_0xb00b('0x24')],_0x4a8d2b=_0x1f14fa[_0xb00b('0x25')],_0x22c22d=_0x1f14fa[_0xb00b('0x25')]+_0x1f14fa['limit'],_0x503c9c;if(_0x22c22d>=_0x15d3b9){_0x22c22d=_0x15d3b9;_0x503c9c=0xc8;}else{_0x503c9c=0xce;}_0x3825af[_0xb00b('0x22')](_0x503c9c);return _0x3825af[_0xb00b('0x26')](_0xb00b('0x27'),_0x4a8d2b+'-'+_0x22c22d+'/'+_0x15d3b9)[_0xb00b('0x23')](_0x197379);}return null;};}function patchUpdates(_0x303625){return function(_0x2b9824){try{jsonpatch[_0xb00b('0x28')](_0x2b9824,_0x303625,!![]);}catch(_0x7c56e7){return BPromise[_0xb00b('0x29')](_0x7c56e7);}return _0x2b9824['save']();};}function saveUpdates(_0x2b5f41,_0x44918d){return function(_0x49078d){if(_0x49078d){return _0x49078d[_0xb00b('0x2a')](_0x2b5f41)[_0xb00b('0x1b')](function(_0x5a5e5a){return _0x5a5e5a;});}return null;};}function removeEntity(_0x456241,_0x4d2ee5){return function(_0x20e1c9){if(_0x20e1c9){return _0x20e1c9[_0xb00b('0x2b')]()[_0xb00b('0x1b')](function(){_0x456241[_0xb00b('0x22')](0xcc)[_0xb00b('0x2c')]();});}};}function handleEntityNotFound(_0x1436ad,_0x17f613){return function(_0x594840){if(!_0x594840){_0x1436ad['sendStatus'](0x194);}return _0x594840;};}function handleError(_0x5b04c2,_0x347e73){_0x347e73=_0x347e73||0x1f4;return function(_0xc21102){logger[_0xb00b('0x1f')](_0xc21102[_0xb00b('0x2d')]);if(_0xc21102['name']){delete _0xc21102[_0xb00b('0x2e')];}_0x5b04c2[_0xb00b('0x22')](_0x347e73)[_0xb00b('0x2f')](_0xc21102);};}exports[_0xb00b('0x30')]=function(_0x261c80,_0x39da49){var _0x8785ec={},_0x3302ac={},_0x5efc18={'count':0x0,'rows':[]};var _0x55451e=_[_0xb00b('0x31')](db['FreshdeskConfiguration'][_0xb00b('0x32')],function(_0x1c5400){return{'name':_0x1c5400[_0xb00b('0x33')],'type':_0x1c5400[_0xb00b('0x34')][_0xb00b('0x35')]};});_0x3302ac[_0xb00b('0x36')]=_[_0xb00b('0x31')](_0x55451e,'name');_0x3302ac[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x261c80[_0xb00b('0x37')]);_0x3302ac[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x3302ac[_0xb00b('0x36')],_0x3302ac['query']);_0x8785ec[_0xb00b('0x3b')]=_[_0xb00b('0x3a')](_0x3302ac['model'],qs[_0xb00b('0x3c')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x8785ec[_0xb00b('0x3b')]=_0x8785ec[_0xb00b('0x3b')]['length']?_0x8785ec[_0xb00b('0x3b')]:_0x3302ac[_0xb00b('0x36')];if(!_0x261c80[_0xb00b('0x37')][_0xb00b('0x3d')]('nolimit')){_0x8785ec['limit']=qs[_0xb00b('0x3e')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x8785ec[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x25')]);}_0x8785ec['order']=qs[_0xb00b('0x3f')](_0x261c80[_0xb00b('0x37')][_0xb00b('0x3f')]);_0x8785ec[_0xb00b('0x40')]=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x261c80[_0xb00b('0x37')],_0x3302ac[_0xb00b('0x39')]),_0x55451e);if(_0x261c80[_0xb00b('0x37')][_0xb00b('0x42')]){_0x8785ec[_0xb00b('0x40')]=_[_0xb00b('0x43')](_0x8785ec['where'],{'$or':_[_0xb00b('0x31')](_0x55451e,function(_0x35a0ba){if(_0x35a0ba[_0xb00b('0x34')]!==_0xb00b('0x44')){var _0x10b136={};_0x10b136[_0x35a0ba[_0xb00b('0x2e')]]={'$like':'%'+_0x261c80[_0xb00b('0x37')][_0xb00b('0x42')]+'%'};return _0x10b136;}})});}_0x8785ec=_[_0xb00b('0x43')]({},_0x8785ec,_0x261c80[_0xb00b('0x45')]);var _0x1eec12={'where':_0x8785ec[_0xb00b('0x40')]};return db['FreshdeskConfiguration']['count'](_0x1eec12)['then'](function(_0x3f8f60){_0x5efc18[_0xb00b('0x24')]=_0x3f8f60;if(_0x261c80['query'][_0xb00b('0x46')]){_0x8785ec[_0xb00b('0x47')]=[{'all':!![]}];}return db[_0xb00b('0x48')][_0xb00b('0x49')](_0x8785ec);})['then'](function(_0x58e9cb){_0x5efc18[_0xb00b('0x4a')]=_0x58e9cb;return _0x5efc18;})[_0xb00b('0x1b')](respondWithFilteredResult(_0x39da49,_0x8785ec))['catch'](handleError(_0x39da49,null));};exports['show']=function(_0x154759,_0x3a205d){var _0x4e0be4={'raw':![],'where':{'id':_0x154759['params']['id']}},_0x2228e9={};_0x2228e9['model']=_['keys'](db[_0xb00b('0x48')]['rawAttributes']);_0x2228e9[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x154759[_0xb00b('0x37')]);_0x2228e9[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x2228e9[_0xb00b('0x36')],_0x2228e9['query']);_0x4e0be4['attributes']=_[_0xb00b('0x3a')](_0x2228e9[_0xb00b('0x36')],qs['fields'](_0x154759[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x4e0be4['attributes']=_0x4e0be4[_0xb00b('0x3b')][_0xb00b('0x4b')]?_0x4e0be4[_0xb00b('0x3b')]:_0x2228e9['model'];if(_0x154759['query'][_0xb00b('0x46')]){_0x4e0be4[_0xb00b('0x47')]=[{'all':!![]}];}_0x4e0be4=_[_0xb00b('0x43')]({},_0x4e0be4,_0x154759[_0xb00b('0x45')]);return db['FreshdeskConfiguration'][_0xb00b('0x4c')](_0x4e0be4)[_0xb00b('0x1b')](handleEntityNotFound(_0x3a205d,null))['then'](respondWithResult(_0x3a205d,null))['catch'](handleError(_0x3a205d,null));};exports[_0xb00b('0x4d')]=function(_0x524b05,_0x1ab196){return db[_0xb00b('0x48')][_0xb00b('0x4d')](_0x524b05[_0xb00b('0x4e')],{})[_0xb00b('0x1b')](respondWithResult(_0x1ab196,0xc9))[_0xb00b('0x21')](handleError(_0x1ab196,null));};exports['update']=function(_0x5d52a5,_0x51c9e3){if(_0x5d52a5[_0xb00b('0x4e')]['id']){delete _0x5d52a5[_0xb00b('0x4e')]['id'];}return db[_0xb00b('0x48')]['find']({'where':{'id':_0x5d52a5[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x51c9e3,null))[_0xb00b('0x1b')](saveUpdates(_0x5d52a5['body'],null))[_0xb00b('0x1b')](respondWithResult(_0x51c9e3,null))[_0xb00b('0x21')](handleError(_0x51c9e3,null));};exports[_0xb00b('0x2b')]=function(_0x385029,_0x131848){return db[_0xb00b('0x48')][_0xb00b('0x4c')]({'where':{'id':_0x385029[_0xb00b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x131848,null))[_0xb00b('0x1b')](removeEntity(_0x131848,null))[_0xb00b('0x21')](handleError(_0x131848,null));};exports[_0xb00b('0x50')]=function(_0x4a22dd,_0x237419,_0x24a8a2){var _0x309799={};var _0x2b7148={};var _0x1ad387;var _0x4bfe0b;return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x4a22dd[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x237419,null))['then'](function(_0x32b9fe){if(_0x32b9fe){_0x1ad387=_0x32b9fe;_0x2b7148[_0xb00b('0x36')]=_[_0xb00b('0x38')](db[_0xb00b('0x52')][_0xb00b('0x32')]);_0x2b7148[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x4a22dd['query']);_0x2b7148[_0xb00b('0x39')]=_['intersection'](_0x2b7148[_0xb00b('0x36')],_0x2b7148['query']);_0x309799[_0xb00b('0x3b')]=_['intersection'](_0x2b7148[_0xb00b('0x36')],qs['fields'](_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x309799[_0xb00b('0x3b')]=_0x309799['attributes']['length']?_0x309799['attributes']:_0x2b7148[_0xb00b('0x36')];_0x309799[_0xb00b('0x53')]=qs[_0xb00b('0x3f')](_0x4a22dd['query'][_0xb00b('0x3f')]);_0x309799[_0xb00b('0x40')]=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x4a22dd[_0xb00b('0x37')],_0x2b7148['filters']));if(_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x42')]){_0x309799['where']=_[_0xb00b('0x43')](_0x309799[_0xb00b('0x40')],{'$or':_[_0xb00b('0x31')](_0x309799['attributes'],function(_0x4e8b85){var _0x359669={};_0x359669[_0x4e8b85]={'$like':'%'+_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x42')]+'%'};return _0x359669;})});}_0x309799=_['merge']({},_0x309799,_0x4a22dd['options']);return _0x1ad387['getFields'](_0x309799);}})['then'](function(_0xc695f){if(_0xc695f){_0x4bfe0b=_0xc695f['length'];if(!_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x3d')]('nolimit')){_0x309799[_0xb00b('0x3e')]=qs[_0xb00b('0x3e')](_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x309799[_0xb00b('0x25')]=qs['offset'](_0x4a22dd[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x1ad387[_0xb00b('0x50')](_0x309799);}})[_0xb00b('0x1b')](function(_0x8e7e4e){if(_0x8e7e4e){return _0x8e7e4e?{'count':_0x4bfe0b,'rows':_0x8e7e4e}:null;}})[_0xb00b('0x1b')](respondWithResult(_0x237419,null))[_0xb00b('0x21')](handleError(_0x237419,null));};exports['getSubjects']=function(_0x27b3ae,_0x258d0b,_0xe6188b){var _0x328f72={};var _0x109f56={};var _0x432b68;var _0x3f010a;return db[_0xb00b('0x48')]['findOne']({'where':{'id':_0x27b3ae[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x258d0b,null))[_0xb00b('0x1b')](function(_0x3e6a79){if(_0x3e6a79){_0x432b68=_0x3e6a79;_0x109f56[_0xb00b('0x36')]=_[_0xb00b('0x38')](db[_0xb00b('0x52')][_0xb00b('0x32')]);_0x109f56['query']=_[_0xb00b('0x38')](_0x27b3ae[_0xb00b('0x37')]);_0x109f56[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x109f56[_0xb00b('0x36')],_0x109f56[_0xb00b('0x37')]);_0x328f72[_0xb00b('0x3b')]=_['intersection'](_0x109f56[_0xb00b('0x36')],qs[_0xb00b('0x3c')](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x3c')]));_0x328f72[_0xb00b('0x3b')]=_0x328f72[_0xb00b('0x3b')]['length']?_0x328f72[_0xb00b('0x3b')]:_0x109f56['model'];_0x328f72[_0xb00b('0x53')]=qs['sort'](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x3f')]);_0x328f72[_0xb00b('0x40')]=qs['filters'](_['pick'](_0x27b3ae[_0xb00b('0x37')],_0x109f56[_0xb00b('0x39')]));if(_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x42')]){_0x328f72[_0xb00b('0x40')]=_[_0xb00b('0x43')](_0x328f72[_0xb00b('0x40')],{'$or':_[_0xb00b('0x31')](_0x328f72[_0xb00b('0x3b')],function(_0x25bef6){var _0x257430={};_0x257430[_0x25bef6]={'$like':'%'+_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x42')]+'%'};return _0x257430;})});}_0x328f72=_[_0xb00b('0x43')]({},_0x328f72,_0x27b3ae['options']);return _0x432b68['getSubjects'](_0x328f72);}})[_0xb00b('0x1b')](function(_0x180008){if(_0x180008){_0x3f010a=_0x180008['length'];if(!_0x27b3ae['query'][_0xb00b('0x3d')](_0xb00b('0x54'))){_0x328f72[_0xb00b('0x3e')]=qs['limit'](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x328f72[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x27b3ae[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x432b68[_0xb00b('0x55')](_0x328f72);}})['then'](function(_0x4168cf){if(_0x4168cf){return _0x4168cf?{'count':_0x3f010a,'rows':_0x4168cf}:null;}})['then'](respondWithResult(_0x258d0b,null))[_0xb00b('0x21')](handleError(_0x258d0b,null));};exports[_0xb00b('0x56')]=function(_0x545dfd,_0xcef063,_0x1099cb){var _0xe80a21={};var _0x263f0b={};var _0x410d68;var _0x4434fa;return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x545dfd[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0xcef063,null))[_0xb00b('0x1b')](function(_0x3893df){if(_0x3893df){_0x410d68=_0x3893df;_0x263f0b['model']=_[_0xb00b('0x38')](db[_0xb00b('0x52')][_0xb00b('0x32')]);_0x263f0b[_0xb00b('0x37')]=_['keys'](_0x545dfd[_0xb00b('0x37')]);_0x263f0b[_0xb00b('0x39')]=_[_0xb00b('0x3a')](_0x263f0b[_0xb00b('0x36')],_0x263f0b[_0xb00b('0x37')]);_0xe80a21['attributes']=_[_0xb00b('0x3a')](_0x263f0b[_0xb00b('0x36')],qs[_0xb00b('0x3c')](_0x545dfd[_0xb00b('0x37')]['fields']));_0xe80a21[_0xb00b('0x3b')]=_0xe80a21['attributes'][_0xb00b('0x4b')]?_0xe80a21[_0xb00b('0x3b')]:_0x263f0b[_0xb00b('0x36')];_0xe80a21[_0xb00b('0x53')]=qs[_0xb00b('0x3f')](_0x545dfd[_0xb00b('0x37')][_0xb00b('0x3f')]);_0xe80a21[_0xb00b('0x40')]=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x545dfd[_0xb00b('0x37')],_0x263f0b['filters']));if(_0x545dfd[_0xb00b('0x37')][_0xb00b('0x42')]){_0xe80a21[_0xb00b('0x40')]=_[_0xb00b('0x43')](_0xe80a21['where'],{'$or':_[_0xb00b('0x31')](_0xe80a21[_0xb00b('0x3b')],function(_0x4b5508){var _0x5c1aaa={};_0x5c1aaa[_0x4b5508]={'$like':'%'+_0x545dfd['query'][_0xb00b('0x42')]+'%'};return _0x5c1aaa;})});}_0xe80a21=_[_0xb00b('0x43')]({},_0xe80a21,_0x545dfd[_0xb00b('0x45')]);return _0x410d68['getDescriptions'](_0xe80a21);}})[_0xb00b('0x1b')](function(_0x296be0){if(_0x296be0){_0x4434fa=_0x296be0[_0xb00b('0x4b')];if(!_0x545dfd[_0xb00b('0x37')][_0xb00b('0x3d')](_0xb00b('0x54'))){_0xe80a21[_0xb00b('0x3e')]=qs[_0xb00b('0x3e')](_0x545dfd[_0xb00b('0x37')]['limit']);_0xe80a21['offset']=qs[_0xb00b('0x25')](_0x545dfd[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x410d68[_0xb00b('0x56')](_0xe80a21);}})['then'](function(_0x62f47){if(_0x62f47){return _0x62f47?{'count':_0x4434fa,'rows':_0x62f47}:null;}})[_0xb00b('0x1b')](respondWithResult(_0xcef063,null))['catch'](handleError(_0xcef063,null));};exports[_0xb00b('0x57')]=function(_0x21cdbe,_0x2762fb,_0x54244b){var _0x1abcd8={};var _0x1dd043={};var _0x51d9de;var _0x2b7fa9;return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x21cdbe[_0xb00b('0x4f')]['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0x2762fb,null))[_0xb00b('0x1b')](function(_0x3a7db7){if(_0x3a7db7){_0x51d9de=_0x3a7db7;_0x1dd043[_0xb00b('0x36')]=_['keys'](db[_0xb00b('0x58')][_0xb00b('0x32')]);_0x1dd043[_0xb00b('0x37')]=_[_0xb00b('0x38')](_0x21cdbe['query']);_0x1dd043[_0xb00b('0x39')]=_['intersection'](_0x1dd043[_0xb00b('0x36')],_0x1dd043['query']);_0x1abcd8[_0xb00b('0x3b')]=_[_0xb00b('0x3a')](_0x1dd043[_0xb00b('0x36')],qs[_0xb00b('0x3c')](_0x21cdbe[_0xb00b('0x37')]['fields']));_0x1abcd8[_0xb00b('0x3b')]=_0x1abcd8[_0xb00b('0x3b')]['length']?_0x1abcd8[_0xb00b('0x3b')]:_0x1dd043['model'];_0x1abcd8[_0xb00b('0x53')]=qs[_0xb00b('0x3f')](_0x21cdbe[_0xb00b('0x37')][_0xb00b('0x3f')]);_0x1abcd8['where']=qs[_0xb00b('0x39')](_[_0xb00b('0x41')](_0x21cdbe[_0xb00b('0x37')],_0x1dd043[_0xb00b('0x39')]));if(_0x21cdbe[_0xb00b('0x37')]['filter']){_0x1abcd8['where']=_[_0xb00b('0x43')](_0x1abcd8[_0xb00b('0x40')],{'$or':_[_0xb00b('0x31')](_0x1abcd8[_0xb00b('0x3b')],function(_0x35ad28){var _0x4d2c18={};_0x4d2c18[_0x35ad28]={'$like':'%'+_0x21cdbe['query'][_0xb00b('0x42')]+'%'};return _0x4d2c18;})});}_0x1abcd8=_[_0xb00b('0x43')]({},_0x1abcd8,_0x21cdbe[_0xb00b('0x45')]);return _0x51d9de[_0xb00b('0x57')](_0x1abcd8);}})[_0xb00b('0x1b')](function(_0x38b718){if(_0x38b718){_0x2b7fa9=_0x38b718[_0xb00b('0x4b')];if(!_0x21cdbe['query'][_0xb00b('0x3d')]('nolimit')){_0x1abcd8[_0xb00b('0x3e')]=qs['limit'](_0x21cdbe[_0xb00b('0x37')][_0xb00b('0x3e')]);_0x1abcd8[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x21cdbe[_0xb00b('0x37')][_0xb00b('0x25')]);}return _0x51d9de[_0xb00b('0x57')](_0x1abcd8);}})[_0xb00b('0x1b')](function(_0x2268d0){if(_0x2268d0){return _0x2268d0?{'count':_0x2b7fa9,'rows':_0x2268d0}:null;}})[_0xb00b('0x1b')](respondWithResult(_0x2762fb,null))[_0xb00b('0x21')](handleError(_0x2762fb,null));};exports['setTags']=function(_0x456a2f,_0xaad8c4,_0x29742c){if(_0x456a2f[_0xb00b('0x4e')]['id']){delete _0x456a2f['body']['id'];}return db[_0xb00b('0x48')][_0xb00b('0x51')]({'where':{'id':_0x456a2f['params']['id']}})[_0xb00b('0x1b')](handleEntityNotFound(_0xaad8c4,null))['then'](function(_0x22d726){if(_0x22d726){return _0x22d726[_0xb00b('0x59')](_0x456a2f['body'][_0xb00b('0x5a')]||[]);}return null;})[_0xb00b('0x1b')](respondWithResult(_0xaad8c4,null))[_0xb00b('0x21')](handleError(_0xaad8c4,null));}; \ No newline at end of file +var _0x2086=['find','create','body','getFields','findOne','order','sort','hasOwnProperty','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','sendStatus','status','json','offset','apply','reject','save','update','then','destroy','stack','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params'];(function(_0x55a89d,_0x584ea7){var _0x1b0e5a=function(_0x2f9b88){while(--_0x2f9b88){_0x55a89d['push'](_0x55a89d['shift']());}};_0x1b0e5a(++_0x584ea7);}(_0x2086,0x124));var _0x6208=function(_0x39ca13,_0x1d9925){_0x39ca13=_0x39ca13-0x0;var _0x12d301=_0x2086[_0x39ca13];return _0x12d301;};'use strict';var pdf=require(_0x6208('0x0'));var emlformat=require(_0x6208('0x1'));var rimraf=require(_0x6208('0x2'));var zipdir=require(_0x6208('0x3'));var jsonpatch=require(_0x6208('0x4'));var rp=require(_0x6208('0x5'));var moment=require('moment');var BPromise=require(_0x6208('0x6'));var Mustache=require(_0x6208('0x7'));var util=require('util');var path=require(_0x6208('0x8'));var sox=require(_0x6208('0x9'));var csv=require(_0x6208('0xa'));var ejs=require(_0x6208('0xb'));var fs=require('fs');var _=require(_0x6208('0xc'));var squel=require('squel');var crypto=require(_0x6208('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6208('0xa'));var querystring=require(_0x6208('0xe'));var Papa=require(_0x6208('0xf'));var Redis=require(_0x6208('0x10'));var authService=require(_0x6208('0x11'));var qs=require(_0x6208('0x12'));var as=require(_0x6208('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6208('0x14'))(_0x6208('0x15'));var utils=require(_0x6208('0x16'));var config=require(_0x6208('0x17'));var db=require(_0x6208('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6208('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3b1cab,_0x1e1d2e,_0x3d95b4){if(_0x3d95b4){var _0x53962d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53962d[_0x6208('0x1a')](_0x1e1d2e)){return _0x3b1cab;}else{throw new db[(_0x6208('0x1b'))][(_0x6208('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 _0x3b1cab;}}function respondWithRpcPromise(_0x307367,_0x32dda8,_0x1735e1,_0x582218){return new BPromise(function(_0x37db49,_0x11cd8b){var _0x2b4b44=_0x582218||client;return _0x2b4b44['request'](_0x307367,_0x1735e1)['then'](function(_0x43263a){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x32dda8,_0x6208('0x1d'));logger['debug'](_0x6208('0x1e'),_0x32dda8,_0x6208('0x1d'),JSON[_0x6208('0x1f')](_0x43263a));if(_0x43263a[_0x6208('0x20')]){if(_0x43263a[_0x6208('0x20')][_0x6208('0x21')]===0x1f4){logger[_0x6208('0x20')](_0x6208('0x22'),_0x32dda8,_0x43263a[_0x6208('0x20')][_0x6208('0x23')]);return _0x11cd8b(_0x43263a[_0x6208('0x20')][_0x6208('0x23')]);}logger['error'](_0x6208('0x22'),_0x32dda8,_0x43263a[_0x6208('0x20')][_0x6208('0x23')]);return _0x37db49(_0x43263a[_0x6208('0x20')][_0x6208('0x23')]);}else{logger[_0x6208('0x24')](_0x6208('0x22'),_0x32dda8,_0x6208('0x1d'));_0x37db49(_0x43263a['result'][_0x6208('0x23')]);}})[_0x6208('0x25')](function(_0x1ed151){logger[_0x6208('0x20')](_0x6208('0x22'),_0x32dda8,_0x1ed151);_0x11cd8b(_0x1ed151);});});}function respondWithStatusCode(_0x40bab6,_0x117fa7){_0x117fa7=_0x117fa7||0xcc;return function(_0x364b13){if(_0x364b13){return _0x40bab6[_0x6208('0x26')](_0x117fa7);}return _0x40bab6[_0x6208('0x27')](_0x117fa7)['end']();};}function respondWithResult(_0x2bb9df,_0x7a0478){_0x7a0478=_0x7a0478||0xc8;return function(_0x330ac9){if(_0x330ac9){return _0x2bb9df[_0x6208('0x27')](_0x7a0478)[_0x6208('0x28')](_0x330ac9);}};}function respondWithFilteredResult(_0x2bfc3a,_0x5d03d7){return function(_0x4f8cdd){if(_0x4f8cdd){var _0x76dcda=_0x4f8cdd['count'],_0x90d6c0=_0x5d03d7[_0x6208('0x29')],_0x18df12=_0x5d03d7[_0x6208('0x29')]+_0x5d03d7['limit'],_0x46f36d;if(_0x18df12>=_0x76dcda){_0x18df12=_0x76dcda;_0x46f36d=0xc8;}else{_0x46f36d=0xce;}_0x2bfc3a[_0x6208('0x27')](_0x46f36d);return _0x2bfc3a['set']('Content-Range',_0x90d6c0+'-'+_0x18df12+'/'+_0x76dcda)['json'](_0x4f8cdd);}return null;};}function patchUpdates(_0x3f5474){return function(_0x586af3){try{jsonpatch[_0x6208('0x2a')](_0x586af3,_0x3f5474,!![]);}catch(_0x494fa0){return BPromise[_0x6208('0x2b')](_0x494fa0);}return _0x586af3[_0x6208('0x2c')]();};}function saveUpdates(_0x482379,_0x7eadd7){return function(_0x531e1f){if(_0x531e1f){return _0x531e1f[_0x6208('0x2d')](_0x482379)[_0x6208('0x2e')](function(_0x1322d9){return _0x1322d9;});}return null;};}function removeEntity(_0x563d58,_0x35c781){return function(_0xd856b6){if(_0xd856b6){return _0xd856b6[_0x6208('0x2f')]()[_0x6208('0x2e')](function(){_0x563d58[_0x6208('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a8816,_0x1d77b2){return function(_0x3be3ca){if(!_0x3be3ca){_0x2a8816[_0x6208('0x26')](0x194);}return _0x3be3ca;};}function handleError(_0x1594f3,_0xff8668){_0xff8668=_0xff8668||0x1f4;return function(_0x5a5dd6){logger['error'](_0x5a5dd6[_0x6208('0x30')]);if(_0x5a5dd6['name']){delete _0x5a5dd6['name'];}_0x1594f3[_0x6208('0x27')](_0xff8668)[_0x6208('0x31')](_0x5a5dd6);};}exports[_0x6208('0x32')]=function(_0x49b7bb,_0x3829b8){var _0x27f70f={},_0x45e10f={},_0x361941={'count':0x0,'rows':[]};var _0x158e30=_[_0x6208('0x33')](db[_0x6208('0x34')][_0x6208('0x35')],function(_0x49c2e3){return{'name':_0x49c2e3[_0x6208('0x36')],'type':_0x49c2e3[_0x6208('0x37')]['key']};});_0x45e10f[_0x6208('0x38')]=_[_0x6208('0x33')](_0x158e30,_0x6208('0x39'));_0x45e10f[_0x6208('0x3a')]=_[_0x6208('0x3b')](_0x49b7bb[_0x6208('0x3a')]);_0x45e10f[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x45e10f[_0x6208('0x38')],_0x45e10f[_0x6208('0x3a')]);_0x27f70f[_0x6208('0x3e')]=_[_0x6208('0x3d')](_0x45e10f[_0x6208('0x38')],qs[_0x6208('0x3f')](_0x49b7bb[_0x6208('0x3a')][_0x6208('0x3f')]));_0x27f70f[_0x6208('0x3e')]=_0x27f70f[_0x6208('0x3e')][_0x6208('0x40')]?_0x27f70f[_0x6208('0x3e')]:_0x45e10f[_0x6208('0x38')];if(!_0x49b7bb['query']['hasOwnProperty'](_0x6208('0x41'))){_0x27f70f['limit']=qs[_0x6208('0x42')](_0x49b7bb[_0x6208('0x3a')]['limit']);_0x27f70f[_0x6208('0x29')]=qs[_0x6208('0x29')](_0x49b7bb['query'][_0x6208('0x29')]);}_0x27f70f['order']=qs['sort'](_0x49b7bb[_0x6208('0x3a')]['sort']);_0x27f70f[_0x6208('0x43')]=qs['filters'](_[_0x6208('0x44')](_0x49b7bb[_0x6208('0x3a')],_0x45e10f['filters']),_0x158e30);if(_0x49b7bb[_0x6208('0x3a')][_0x6208('0x45')]){_0x27f70f['where']=_[_0x6208('0x46')](_0x27f70f[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x158e30,function(_0x1ae348){if(_0x1ae348['type']!==_0x6208('0x47')){var _0x5e4b14={};_0x5e4b14[_0x1ae348[_0x6208('0x39')]]={'$like':'%'+_0x49b7bb['query'][_0x6208('0x45')]+'%'};return _0x5e4b14;}})});}_0x27f70f=_[_0x6208('0x46')]({},_0x27f70f,_0x49b7bb[_0x6208('0x48')]);var _0x3aa01e={'where':_0x27f70f[_0x6208('0x43')]};return db['FreshdeskConfiguration'][_0x6208('0x49')](_0x3aa01e)[_0x6208('0x2e')](function(_0x3692a2){_0x361941['count']=_0x3692a2;if(_0x49b7bb['query'][_0x6208('0x4a')]){_0x27f70f[_0x6208('0x4b')]=[{'all':!![]}];}return db[_0x6208('0x34')][_0x6208('0x4c')](_0x27f70f);})['then'](function(_0x200957){_0x361941[_0x6208('0x4d')]=_0x200957;return _0x361941;})[_0x6208('0x2e')](respondWithFilteredResult(_0x3829b8,_0x27f70f))[_0x6208('0x25')](handleError(_0x3829b8,null));};exports[_0x6208('0x4e')]=function(_0xc7e04e,_0x1aca58){var _0x2f8481={'raw':![],'where':{'id':_0xc7e04e[_0x6208('0x4f')]['id']}},_0x560566={};_0x560566[_0x6208('0x38')]=_[_0x6208('0x3b')](db[_0x6208('0x34')]['rawAttributes']);_0x560566[_0x6208('0x3a')]=_['keys'](_0xc7e04e[_0x6208('0x3a')]);_0x560566[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x560566['model'],_0x560566['query']);_0x2f8481[_0x6208('0x3e')]=_[_0x6208('0x3d')](_0x560566[_0x6208('0x38')],qs['fields'](_0xc7e04e[_0x6208('0x3a')][_0x6208('0x3f')]));_0x2f8481[_0x6208('0x3e')]=_0x2f8481[_0x6208('0x3e')]['length']?_0x2f8481['attributes']:_0x560566[_0x6208('0x38')];if(_0xc7e04e[_0x6208('0x3a')][_0x6208('0x4a')]){_0x2f8481[_0x6208('0x4b')]=[{'all':!![]}];}_0x2f8481=_[_0x6208('0x46')]({},_0x2f8481,_0xc7e04e['options']);return db[_0x6208('0x34')][_0x6208('0x50')](_0x2f8481)[_0x6208('0x2e')](handleEntityNotFound(_0x1aca58,null))[_0x6208('0x2e')](respondWithResult(_0x1aca58,null))[_0x6208('0x25')](handleError(_0x1aca58,null));};exports[_0x6208('0x51')]=function(_0x32b937,_0x53221f){return db[_0x6208('0x34')][_0x6208('0x51')](_0x32b937[_0x6208('0x52')],{})[_0x6208('0x2e')](respondWithResult(_0x53221f,0xc9))[_0x6208('0x25')](handleError(_0x53221f,null));};exports[_0x6208('0x2d')]=function(_0x119da9,_0x2720ae){if(_0x119da9['body']['id']){delete _0x119da9['body']['id'];}return db[_0x6208('0x34')]['find']({'where':{'id':_0x119da9[_0x6208('0x4f')]['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x2720ae,null))[_0x6208('0x2e')](saveUpdates(_0x119da9[_0x6208('0x52')],null))[_0x6208('0x2e')](respondWithResult(_0x2720ae,null))['catch'](handleError(_0x2720ae,null));};exports[_0x6208('0x2f')]=function(_0x56e6a5,_0x4c8aed){return db[_0x6208('0x34')][_0x6208('0x50')]({'where':{'id':_0x56e6a5[_0x6208('0x4f')]['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x4c8aed,null))[_0x6208('0x2e')](removeEntity(_0x4c8aed,null))[_0x6208('0x25')](handleError(_0x4c8aed,null));};exports[_0x6208('0x53')]=function(_0x58cceb,_0x24a701,_0x2a578b){var _0x45dfdf={};var _0x48a135={};var _0x243769;var _0x34dec6;return db[_0x6208('0x34')][_0x6208('0x54')]({'where':{'id':_0x58cceb['params']['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x24a701,null))[_0x6208('0x2e')](function(_0x479c8c){if(_0x479c8c){_0x243769=_0x479c8c;_0x48a135[_0x6208('0x38')]=_[_0x6208('0x3b')](db['FreshdeskField'][_0x6208('0x35')]);_0x48a135[_0x6208('0x3a')]=_[_0x6208('0x3b')](_0x58cceb[_0x6208('0x3a')]);_0x48a135[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x48a135['model'],_0x48a135[_0x6208('0x3a')]);_0x45dfdf[_0x6208('0x3e')]=_['intersection'](_0x48a135[_0x6208('0x38')],qs[_0x6208('0x3f')](_0x58cceb['query']['fields']));_0x45dfdf[_0x6208('0x3e')]=_0x45dfdf[_0x6208('0x3e')][_0x6208('0x40')]?_0x45dfdf[_0x6208('0x3e')]:_0x48a135[_0x6208('0x38')];_0x45dfdf[_0x6208('0x55')]=qs[_0x6208('0x56')](_0x58cceb[_0x6208('0x3a')][_0x6208('0x56')]);_0x45dfdf[_0x6208('0x43')]=qs['filters'](_['pick'](_0x58cceb['query'],_0x48a135['filters']));if(_0x58cceb[_0x6208('0x3a')][_0x6208('0x45')]){_0x45dfdf[_0x6208('0x43')]=_[_0x6208('0x46')](_0x45dfdf[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x45dfdf[_0x6208('0x3e')],function(_0x4c789f){var _0x4aa147={};_0x4aa147[_0x4c789f]={'$like':'%'+_0x58cceb[_0x6208('0x3a')][_0x6208('0x45')]+'%'};return _0x4aa147;})});}_0x45dfdf=_[_0x6208('0x46')]({},_0x45dfdf,_0x58cceb[_0x6208('0x48')]);return _0x243769[_0x6208('0x53')](_0x45dfdf);}})[_0x6208('0x2e')](function(_0x2e6e0a){if(_0x2e6e0a){_0x34dec6=_0x2e6e0a[_0x6208('0x40')];if(!_0x58cceb['query'][_0x6208('0x57')](_0x6208('0x41'))){_0x45dfdf[_0x6208('0x42')]=qs[_0x6208('0x42')](_0x58cceb[_0x6208('0x3a')][_0x6208('0x42')]);_0x45dfdf['offset']=qs[_0x6208('0x29')](_0x58cceb['query'][_0x6208('0x29')]);}return _0x243769[_0x6208('0x53')](_0x45dfdf);}})[_0x6208('0x2e')](function(_0x38efee){if(_0x38efee){return _0x38efee?{'count':_0x34dec6,'rows':_0x38efee}:null;}})[_0x6208('0x2e')](respondWithResult(_0x24a701,null))[_0x6208('0x25')](handleError(_0x24a701,null));};exports[_0x6208('0x58')]=function(_0x2da9b8,_0x3321ff,_0x200283){var _0x76d72={};var _0x44f818={};var _0x3b1e62;var _0x3dc6b1;return db[_0x6208('0x34')][_0x6208('0x54')]({'where':{'id':_0x2da9b8[_0x6208('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3321ff,null))[_0x6208('0x2e')](function(_0x13f605){if(_0x13f605){_0x3b1e62=_0x13f605;_0x44f818[_0x6208('0x38')]=_[_0x6208('0x3b')](db[_0x6208('0x59')][_0x6208('0x35')]);_0x44f818[_0x6208('0x3a')]=_[_0x6208('0x3b')](_0x2da9b8[_0x6208('0x3a')]);_0x44f818[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x44f818[_0x6208('0x38')],_0x44f818['query']);_0x76d72['attributes']=_[_0x6208('0x3d')](_0x44f818['model'],qs[_0x6208('0x3f')](_0x2da9b8[_0x6208('0x3a')][_0x6208('0x3f')]));_0x76d72[_0x6208('0x3e')]=_0x76d72['attributes'][_0x6208('0x40')]?_0x76d72[_0x6208('0x3e')]:_0x44f818['model'];_0x76d72[_0x6208('0x55')]=qs[_0x6208('0x56')](_0x2da9b8[_0x6208('0x3a')][_0x6208('0x56')]);_0x76d72['where']=qs[_0x6208('0x3c')](_[_0x6208('0x44')](_0x2da9b8[_0x6208('0x3a')],_0x44f818['filters']));if(_0x2da9b8[_0x6208('0x3a')][_0x6208('0x45')]){_0x76d72[_0x6208('0x43')]=_[_0x6208('0x46')](_0x76d72[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x76d72[_0x6208('0x3e')],function(_0xf0687e){var _0x2408a9={};_0x2408a9[_0xf0687e]={'$like':'%'+_0x2da9b8[_0x6208('0x3a')][_0x6208('0x45')]+'%'};return _0x2408a9;})});}_0x76d72=_[_0x6208('0x46')]({},_0x76d72,_0x2da9b8['options']);return _0x3b1e62[_0x6208('0x58')](_0x76d72);}})[_0x6208('0x2e')](function(_0x29066f){if(_0x29066f){_0x3dc6b1=_0x29066f[_0x6208('0x40')];if(!_0x2da9b8['query']['hasOwnProperty'](_0x6208('0x41'))){_0x76d72['limit']=qs[_0x6208('0x42')](_0x2da9b8[_0x6208('0x3a')]['limit']);_0x76d72['offset']=qs[_0x6208('0x29')](_0x2da9b8['query']['offset']);}return _0x3b1e62[_0x6208('0x58')](_0x76d72);}})[_0x6208('0x2e')](function(_0x28270d){if(_0x28270d){return _0x28270d?{'count':_0x3dc6b1,'rows':_0x28270d}:null;}})[_0x6208('0x2e')](respondWithResult(_0x3321ff,null))[_0x6208('0x25')](handleError(_0x3321ff,null));};exports[_0x6208('0x5a')]=function(_0x1c2f76,_0x74a33d,_0x4e9379){var _0x5c655f={};var _0x4301ca={};var _0x1dc52e;var _0x7ba321;return db['FreshdeskConfiguration'][_0x6208('0x54')]({'where':{'id':_0x1c2f76['params']['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x74a33d,null))['then'](function(_0x31bbb7){if(_0x31bbb7){_0x1dc52e=_0x31bbb7;_0x4301ca[_0x6208('0x38')]=_[_0x6208('0x3b')](db[_0x6208('0x59')][_0x6208('0x35')]);_0x4301ca[_0x6208('0x3a')]=_[_0x6208('0x3b')](_0x1c2f76['query']);_0x4301ca[_0x6208('0x3c')]=_['intersection'](_0x4301ca[_0x6208('0x38')],_0x4301ca[_0x6208('0x3a')]);_0x5c655f[_0x6208('0x3e')]=_[_0x6208('0x3d')](_0x4301ca['model'],qs['fields'](_0x1c2f76[_0x6208('0x3a')][_0x6208('0x3f')]));_0x5c655f['attributes']=_0x5c655f['attributes'][_0x6208('0x40')]?_0x5c655f[_0x6208('0x3e')]:_0x4301ca[_0x6208('0x38')];_0x5c655f[_0x6208('0x55')]=qs[_0x6208('0x56')](_0x1c2f76[_0x6208('0x3a')][_0x6208('0x56')]);_0x5c655f['where']=qs[_0x6208('0x3c')](_[_0x6208('0x44')](_0x1c2f76['query'],_0x4301ca[_0x6208('0x3c')]));if(_0x1c2f76[_0x6208('0x3a')][_0x6208('0x45')]){_0x5c655f[_0x6208('0x43')]=_[_0x6208('0x46')](_0x5c655f[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x5c655f[_0x6208('0x3e')],function(_0x2375da){var _0x8eae66={};_0x8eae66[_0x2375da]={'$like':'%'+_0x1c2f76[_0x6208('0x3a')][_0x6208('0x45')]+'%'};return _0x8eae66;})});}_0x5c655f=_[_0x6208('0x46')]({},_0x5c655f,_0x1c2f76[_0x6208('0x48')]);return _0x1dc52e[_0x6208('0x5a')](_0x5c655f);}})['then'](function(_0x473e13){if(_0x473e13){_0x7ba321=_0x473e13[_0x6208('0x40')];if(!_0x1c2f76['query'][_0x6208('0x57')](_0x6208('0x41'))){_0x5c655f['limit']=qs[_0x6208('0x42')](_0x1c2f76[_0x6208('0x3a')]['limit']);_0x5c655f[_0x6208('0x29')]=qs[_0x6208('0x29')](_0x1c2f76[_0x6208('0x3a')]['offset']);}return _0x1dc52e['getDescriptions'](_0x5c655f);}})['then'](function(_0x49b72d){if(_0x49b72d){return _0x49b72d?{'count':_0x7ba321,'rows':_0x49b72d}:null;}})[_0x6208('0x2e')](respondWithResult(_0x74a33d,null))['catch'](handleError(_0x74a33d,null));};exports[_0x6208('0x5b')]=function(_0x303620,_0x592954,_0x2623ae){var _0x5c5ca2={};var _0x30c391={};var _0x579bf3;var _0x2c5189;return db['FreshdeskConfiguration'][_0x6208('0x54')]({'where':{'id':_0x303620[_0x6208('0x4f')]['id']}})['then'](handleEntityNotFound(_0x592954,null))['then'](function(_0x33e1bc){if(_0x33e1bc){_0x579bf3=_0x33e1bc;_0x30c391['model']=_[_0x6208('0x3b')](db['Tag'][_0x6208('0x35')]);_0x30c391['query']=_['keys'](_0x303620[_0x6208('0x3a')]);_0x30c391[_0x6208('0x3c')]=_[_0x6208('0x3d')](_0x30c391['model'],_0x30c391[_0x6208('0x3a')]);_0x5c5ca2[_0x6208('0x3e')]=_[_0x6208('0x3d')](_0x30c391[_0x6208('0x38')],qs[_0x6208('0x3f')](_0x303620[_0x6208('0x3a')][_0x6208('0x3f')]));_0x5c5ca2['attributes']=_0x5c5ca2['attributes'][_0x6208('0x40')]?_0x5c5ca2[_0x6208('0x3e')]:_0x30c391[_0x6208('0x38')];_0x5c5ca2[_0x6208('0x55')]=qs[_0x6208('0x56')](_0x303620[_0x6208('0x3a')]['sort']);_0x5c5ca2[_0x6208('0x43')]=qs['filters'](_[_0x6208('0x44')](_0x303620[_0x6208('0x3a')],_0x30c391[_0x6208('0x3c')]));if(_0x303620[_0x6208('0x3a')][_0x6208('0x45')]){_0x5c5ca2[_0x6208('0x43')]=_[_0x6208('0x46')](_0x5c5ca2[_0x6208('0x43')],{'$or':_[_0x6208('0x33')](_0x5c5ca2['attributes'],function(_0x4e18b1){var _0x380d76={};_0x380d76[_0x4e18b1]={'$like':'%'+_0x303620[_0x6208('0x3a')][_0x6208('0x45')]+'%'};return _0x380d76;})});}_0x5c5ca2=_[_0x6208('0x46')]({},_0x5c5ca2,_0x303620['options']);return _0x579bf3[_0x6208('0x5b')](_0x5c5ca2);}})[_0x6208('0x2e')](function(_0x194e67){if(_0x194e67){_0x2c5189=_0x194e67[_0x6208('0x40')];if(!_0x303620[_0x6208('0x3a')][_0x6208('0x57')](_0x6208('0x41'))){_0x5c5ca2[_0x6208('0x42')]=qs[_0x6208('0x42')](_0x303620[_0x6208('0x3a')][_0x6208('0x42')]);_0x5c5ca2[_0x6208('0x29')]=qs[_0x6208('0x29')](_0x303620['query'][_0x6208('0x29')]);}return _0x579bf3[_0x6208('0x5b')](_0x5c5ca2);}})[_0x6208('0x2e')](function(_0x2d7f3b){if(_0x2d7f3b){return _0x2d7f3b?{'count':_0x2c5189,'rows':_0x2d7f3b}:null;}})[_0x6208('0x2e')](respondWithResult(_0x592954,null))[_0x6208('0x25')](handleError(_0x592954,null));};exports[_0x6208('0x5c')]=function(_0x1ab759,_0x3483ff,_0x175c92){if(_0x1ab759[_0x6208('0x52')]['id']){delete _0x1ab759[_0x6208('0x52')]['id'];}return db[_0x6208('0x34')][_0x6208('0x54')]({'where':{'id':_0x1ab759[_0x6208('0x4f')]['id']}})[_0x6208('0x2e')](handleEntityNotFound(_0x3483ff,null))[_0x6208('0x2e')](function(_0x2de53e){if(_0x2de53e){return _0x2de53e[_0x6208('0x5c')](_0x1ab759[_0x6208('0x52')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3483ff,null))[_0x6208('0x25')](handleError(_0x3483ff,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7eb6d1b..c59907d 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 _0x8ef6=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x17b23c,_0x423472){var _0x3af1b4=function(_0x34e307){while(--_0x34e307){_0x17b23c['push'](_0x17b23c['shift']());}};_0x3af1b4(++_0x423472);}(_0x8ef6,0xf2));var _0x68ef=function(_0x499d80,_0x174450){_0x499d80=_0x499d80-0x0;var _0x48c74f=_0x8ef6[_0x499d80];return _0x48c74f;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x4fda14,_0x6ab4cb){var _0x570673=function(_0x13adc6){while(--_0x13adc6){_0x4fda14['push'](_0x4fda14['shift']());}};_0x570673(++_0x6ab4cb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x24f86c,_0x1e2cf2){_0x24f86c=_0x24f86c-0x0;var _0x2b58c4=_0x8ef6[_0x24f86c];return _0x2b58c4;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'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 9d445c3..36e98f2 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 _0x5a12=['rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b9c43,_0x49b9cd){var _0x3e3c32=function(_0x48b8fe){while(--_0x48b8fe){_0x2b9c43['push'](_0x2b9c43['shift']());}};_0x3e3c32(++_0x49b9cd);}(_0x5a12,0x101));var _0x25a1=function(_0x3af782,_0x4eb7e2){_0x3af782=_0x3af782-0x0;var _0x407343=_0x5a12[_0x3af782];return _0x407343;};'use strict';var _=require(_0x25a1('0x0'));var util=require('util');var moment=require(_0x25a1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25a1('0x2'));var fs=require('fs');var Redis=require(_0x25a1('0x3'));var db=require(_0x25a1('0x4'))['db'];var utils=require(_0x25a1('0x5'));var logger=require(_0x25a1('0x6'))(_0x25a1('0x7'));var config=require(_0x25a1('0x8'));var jayson=require(_0x25a1('0x9'));var client=jayson['client'][_0x25a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37bfe6,_0x48763e,_0x55c792){return new BPromise(function(_0x135d7d,_0xa8c803){return client['request'](_0x37bfe6,_0x55c792)[_0x25a1('0xb')](function(_0x126ff3){logger[_0x25a1('0xc')](_0x25a1('0xd'),_0x48763e,_0x25a1('0xe'));logger[_0x25a1('0xf')](_0x25a1('0x10'),_0x48763e,_0x25a1('0xe'),JSON[_0x25a1('0x11')](_0x126ff3));if(_0x126ff3['error']){if(_0x126ff3[_0x25a1('0x12')][_0x25a1('0x13')]===0x1f4){logger['error'](_0x25a1('0xd'),_0x48763e,_0x126ff3[_0x25a1('0x12')][_0x25a1('0x14')]);return _0xa8c803(_0x126ff3[_0x25a1('0x12')]['message']);}logger[_0x25a1('0x12')](_0x25a1('0xd'),_0x48763e,_0x126ff3[_0x25a1('0x12')][_0x25a1('0x14')]);return _0x135d7d(_0x126ff3['error'][_0x25a1('0x14')]);}else{logger['info'](_0x25a1('0xd'),_0x48763e,_0x25a1('0xe'));_0x135d7d(_0x126ff3['result'][_0x25a1('0x14')]);}})[_0x25a1('0x15')](function(_0x5e3f11){logger[_0x25a1('0x12')](_0x25a1('0xd'),_0x48763e,_0x5e3f11);_0xa8c803(_0x5e3f11);});});} \ No newline at end of file +var _0xdd9c=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x12bb55,_0xd955e2){var _0x29ab1d=function(_0x49a56f){while(--_0x49a56f){_0x12bb55['push'](_0x12bb55['shift']());}};_0x29ab1d(++_0xd955e2);}(_0xdd9c,0x198));var _0xcdd9=function(_0x589c7f,_0x261d01){_0x589c7f=_0x589c7f-0x0;var _0xb37277=_0xdd9c[_0x589c7f];return _0xb37277;};'use strict';var _=require(_0xcdd9('0x0'));var util=require(_0xcdd9('0x1'));var moment=require(_0xcdd9('0x2'));var BPromise=require(_0xcdd9('0x3'));var rs=require(_0xcdd9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdd9('0x5'))['db'];var utils=require(_0xcdd9('0x6'));var logger=require(_0xcdd9('0x7'))(_0xcdd9('0x8'));var config=require('../../config/environment');var jayson=require(_0xcdd9('0x9'));var client=jayson[_0xcdd9('0xa')][_0xcdd9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x594435,_0x1a8d4f,_0x2c0cef){return new BPromise(function(_0x2aec9b,_0x1384af){return client[_0xcdd9('0xc')](_0x594435,_0x2c0cef)[_0xcdd9('0xd')](function(_0x161567){logger[_0xcdd9('0xe')](_0xcdd9('0xf'),_0x1a8d4f,'request\x20sent');logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1a8d4f,'request\x20sent',JSON['stringify'](_0x161567));if(_0x161567[_0xcdd9('0x10')]){if(_0x161567[_0xcdd9('0x10')]['code']===0x1f4){logger[_0xcdd9('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1a8d4f,_0x161567['error'][_0xcdd9('0x11')]);return _0x1384af(_0x161567['error']['message']);}logger[_0xcdd9('0x10')](_0xcdd9('0xf'),_0x1a8d4f,_0x161567[_0xcdd9('0x10')][_0xcdd9('0x11')]);return _0x2aec9b(_0x161567['error'][_0xcdd9('0x11')]);}else{logger[_0xcdd9('0xe')](_0xcdd9('0xf'),_0x1a8d4f,_0xcdd9('0x12'));_0x2aec9b(_0x161567[_0xcdd9('0x13')][_0xcdd9('0x11')]);}})[_0xcdd9('0x14')](function(_0x45a370){logger[_0xcdd9('0x10')](_0xcdd9('0xf'),_0x1a8d4f,_0x45a370);_0x1384af(_0x45a370);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0c8db22..aabdea7 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 _0x70e0=['create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0x5d8084,_0x1947e9){var _0x4c0147=function(_0x20c7f0){while(--_0x20c7f0){_0x5d8084['push'](_0x5d8084['shift']());}};_0x4c0147(++_0x1947e9);}(_0x70e0,0x17b));var _0x070e=function(_0xcbe91d,_0xc1f3c1){_0xcbe91d=_0xcbe91d-0x0;var _0xfb018c=_0x70e0[_0xcbe91d];return _0xfb018c;};'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('./intFreshdeskField.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0xa')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')](_0x070e('0xe'),auth[_0x070e('0xb')](),controller['update']);router['delete'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);module[_0x070e('0x10')]=router; \ No newline at end of file +var _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xcb91[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index f225c5c..51a9f0d 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 _0xa5ca=['string','STRING','sequelize','exports','ENUM','customVariable','keyValue'];(function(_0x533879,_0x184a56){var _0x583f88=function(_0x5dfc82){while(--_0x5dfc82){_0x533879['push'](_0x533879['shift']());}};_0x583f88(++_0x184a56);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xa5ca[_0x2adbeb];return _0x5e18a6;};'use strict';var Sequelize=require(_0xaa5c('0x0'));module[_0xaa5c('0x1')]={'type':{'type':Sequelize[_0xaa5c('0x2')]('string','variable',_0xaa5c('0x3'),_0xaa5c('0x4')),'defaultValue':_0xaa5c('0x5')},'content':{'type':Sequelize[_0xaa5c('0x6')]},'key':{'type':Sequelize[_0xaa5c('0x6')]},'keyType':{'type':Sequelize[_0xaa5c('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xaa5c('0x6')]},'idField':{'type':Sequelize[_0xaa5c('0x6')]},'nameField':{'type':Sequelize[_0xaa5c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5c71=['sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x51c291,_0xbd12c3){var _0x3893ea=function(_0x53c16d){while(--_0x53c16d){_0x51c291['push'](_0x51c291['shift']());}};_0x3893ea(++_0xbd12c3);}(_0x5c71,0x188));var _0x15c7=function(_0x24a97b,_0x2feac0){_0x24a97b=_0x24a97b-0x0;var _0x186301=_0x5c71[_0x24a97b];return _0x186301;};'use strict';var Sequelize=require(_0x15c7('0x0'));module[_0x15c7('0x1')]={'type':{'type':Sequelize[_0x15c7('0x2')](_0x15c7('0x3'),_0x15c7('0x4'),_0x15c7('0x5'),'keyValue'),'defaultValue':_0x15c7('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x15c7('0x3'),'variable',_0x15c7('0x5'))},'keyContent':{'type':Sequelize[_0x15c7('0x6')]},'idField':{'type':Sequelize[_0x15c7('0x6')]},'nameField':{'type':Sequelize[_0x15c7('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x15c7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e466c2e..52632ed 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 _0xb67b=['eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','findAll','rows','catch','params','keys','length','include','options','find','create','body','html-pdf'];(function(_0x27ff3a,_0x11ab58){var _0x41ac12=function(_0x16afda){while(--_0x16afda){_0x27ff3a['push'](_0x27ff3a['shift']());}};_0x41ac12(++_0x11ab58);}(_0xb67b,0x91));var _0xbb67=function(_0x57d0dc,_0x387f3e){_0x57d0dc=_0x57d0dc-0x0;var _0x177765=_0xb67b[_0x57d0dc];return _0x177765;};'use strict';var pdf=require(_0xbb67('0x0'));var emlformat=require(_0xbb67('0x1'));var rimraf=require(_0xbb67('0x2'));var zipdir=require(_0xbb67('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb67('0x4'));var moment=require(_0xbb67('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbb67('0x6'));var util=require(_0xbb67('0x7'));var path=require(_0xbb67('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb67('0x9'));var fs=require('fs');var _=require(_0xbb67('0xa'));var squel=require(_0xbb67('0xb'));var crypto=require('crypto');var jsforce=require(_0xbb67('0xc'));var deskjs=require(_0xbb67('0xd'));var toCsv=require(_0xbb67('0xe'));var querystring=require(_0xbb67('0xf'));var Papa=require(_0xbb67('0x10'));var Redis=require(_0xbb67('0x11'));var authService=require(_0xbb67('0x12'));var qs=require(_0xbb67('0x13'));var as=require(_0xbb67('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb67('0x15'))('api');var utils=require(_0xbb67('0x16'));var config=require(_0xbb67('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x304bff,_0x33c861){_0x33c861=_0x33c861||0xcc;return function(_0x5b3fc5){if(_0x5b3fc5){return _0x304bff[_0xbb67('0x18')](_0x33c861);}return _0x304bff['status'](_0x33c861)[_0xbb67('0x19')]();};}function respondWithResult(_0x3cee63,_0x4afffd){_0x4afffd=_0x4afffd||0xc8;return function(_0x42d0d9){if(_0x42d0d9){return _0x3cee63['status'](_0x4afffd)['json'](_0x42d0d9);}};}function respondWithFilteredResult(_0x34183b,_0x2ccea1){return function(_0x1d2c22){if(_0x1d2c22){var _0x4dc70b=_0x1d2c22[_0xbb67('0x1a')],_0x4fddb4=_0x2ccea1[_0xbb67('0x1b')],_0x303dcb=_0x2ccea1[_0xbb67('0x1b')]+_0x2ccea1[_0xbb67('0x1c')],_0x17d8e8;if(_0x303dcb>=_0x4dc70b){_0x303dcb=_0x4dc70b;_0x17d8e8=0xc8;}else{_0x17d8e8=0xce;}_0x34183b[_0xbb67('0x1d')](_0x17d8e8);return _0x34183b[_0xbb67('0x1e')](_0xbb67('0x1f'),_0x4fddb4+'-'+_0x303dcb+'/'+_0x4dc70b)[_0xbb67('0x20')](_0x1d2c22);}return null;};}function patchUpdates(_0x483ef3){return function(_0x50b5a4){try{jsonpatch['apply'](_0x50b5a4,_0x483ef3,!![]);}catch(_0x6736c4){return BPromise[_0xbb67('0x21')](_0x6736c4);}return _0x50b5a4[_0xbb67('0x22')]();};}function saveUpdates(_0x4f89e7,_0x3d7c4a){return function(_0x203a9c){if(_0x203a9c){return _0x203a9c[_0xbb67('0x23')](_0x4f89e7)[_0xbb67('0x24')](function(_0x41c525){return _0x41c525;});}return null;};}function removeEntity(_0x2397d2,_0x59e80e){return function(_0x4e01c1){if(_0x4e01c1){return _0x4e01c1[_0xbb67('0x25')]()[_0xbb67('0x24')](function(){_0x2397d2[_0xbb67('0x1d')](0xcc)[_0xbb67('0x19')]();});}};}function handleEntityNotFound(_0x45d2ed,_0x45bf79){return function(_0x27b72d){if(!_0x27b72d){_0x45d2ed[_0xbb67('0x18')](0x194);}return _0x27b72d;};}function handleError(_0x1abfc1,_0x34a553){_0x34a553=_0x34a553||0x1f4;return function(_0x23ff93){logger[_0xbb67('0x26')](_0x23ff93[_0xbb67('0x27')]);if(_0x23ff93[_0xbb67('0x28')]){delete _0x23ff93['name'];}_0x1abfc1[_0xbb67('0x1d')](_0x34a553)[_0xbb67('0x29')](_0x23ff93);};}exports[_0xbb67('0x2a')]=function(_0x38bd3e,_0x38afe9){var _0x49720b={},_0x4f2734={},_0x307c26={'count':0x0,'rows':[]};var _0x4785da=_['map'](db[_0xbb67('0x2b')][_0xbb67('0x2c')],function(_0x1fdf7b){return{'name':_0x1fdf7b[_0xbb67('0x2d')],'type':_0x1fdf7b[_0xbb67('0x2e')][_0xbb67('0x2f')]};});_0x4f2734[_0xbb67('0x30')]=_[_0xbb67('0x31')](_0x4785da,'name');_0x4f2734[_0xbb67('0x32')]=_['keys'](_0x38bd3e['query']);_0x4f2734['filters']=_[_0xbb67('0x33')](_0x4f2734[_0xbb67('0x30')],_0x4f2734[_0xbb67('0x32')]);_0x49720b[_0xbb67('0x34')]=_['intersection'](_0x4f2734['model'],qs[_0xbb67('0x35')](_0x38bd3e['query'][_0xbb67('0x35')]));_0x49720b[_0xbb67('0x34')]=_0x49720b[_0xbb67('0x34')]['length']?_0x49720b[_0xbb67('0x34')]:_0x4f2734[_0xbb67('0x30')];if(!_0x38bd3e[_0xbb67('0x32')]['hasOwnProperty'](_0xbb67('0x36'))){_0x49720b[_0xbb67('0x1c')]=qs[_0xbb67('0x1c')](_0x38bd3e['query'][_0xbb67('0x1c')]);_0x49720b['offset']=qs[_0xbb67('0x1b')](_0x38bd3e[_0xbb67('0x32')]['offset']);}_0x49720b[_0xbb67('0x37')]=qs[_0xbb67('0x38')](_0x38bd3e[_0xbb67('0x32')][_0xbb67('0x38')]);_0x49720b[_0xbb67('0x39')]=qs['filters'](_[_0xbb67('0x3a')](_0x38bd3e[_0xbb67('0x32')],_0x4f2734[_0xbb67('0x3b')]),_0x4785da);if(_0x38bd3e['query'][_0xbb67('0x3c')]){_0x49720b[_0xbb67('0x39')]=_[_0xbb67('0x3d')](_0x49720b[_0xbb67('0x39')],{'$or':_['map'](_0x4785da,function(_0x52111e){if(_0x52111e[_0xbb67('0x2e')]!=='VIRTUAL'){var _0x30c2ea={};_0x30c2ea[_0x52111e[_0xbb67('0x28')]]={'$like':'%'+_0x38bd3e['query']['filter']+'%'};return _0x30c2ea;}})});}_0x49720b=_[_0xbb67('0x3d')]({},_0x49720b,_0x38bd3e['options']);var _0x1066fc={'where':_0x49720b[_0xbb67('0x39')]};return db[_0xbb67('0x2b')]['count'](_0x1066fc)[_0xbb67('0x24')](function(_0x47a924){_0x307c26[_0xbb67('0x1a')]=_0x47a924;if(_0x38bd3e[_0xbb67('0x32')]['includeAll']){_0x49720b['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xbb67('0x3e')](_0x49720b);})['then'](function(_0x118bf6){_0x307c26[_0xbb67('0x3f')]=_0x118bf6;return _0x307c26;})[_0xbb67('0x24')](respondWithFilteredResult(_0x38afe9,_0x49720b))[_0xbb67('0x40')](handleError(_0x38afe9,null));};exports['show']=function(_0x318a09,_0x1ea57f){var _0x55b6a5={'raw':!![],'where':{'id':_0x318a09[_0xbb67('0x41')]['id']}},_0x33b1e6={};_0x33b1e6[_0xbb67('0x30')]=_[_0xbb67('0x42')](db[_0xbb67('0x2b')]['rawAttributes']);_0x33b1e6[_0xbb67('0x32')]=_[_0xbb67('0x42')](_0x318a09[_0xbb67('0x32')]);_0x33b1e6[_0xbb67('0x3b')]=_['intersection'](_0x33b1e6[_0xbb67('0x30')],_0x33b1e6['query']);_0x55b6a5[_0xbb67('0x34')]=_[_0xbb67('0x33')](_0x33b1e6[_0xbb67('0x30')],qs[_0xbb67('0x35')](_0x318a09['query'][_0xbb67('0x35')]));_0x55b6a5['attributes']=_0x55b6a5[_0xbb67('0x34')][_0xbb67('0x43')]?_0x55b6a5[_0xbb67('0x34')]:_0x33b1e6[_0xbb67('0x30')];if(_0x318a09[_0xbb67('0x32')]['includeAll']){_0x55b6a5[_0xbb67('0x44')]=[{'all':!![]}];}_0x55b6a5=_[_0xbb67('0x3d')]({},_0x55b6a5,_0x318a09[_0xbb67('0x45')]);return db[_0xbb67('0x2b')][_0xbb67('0x46')](_0x55b6a5)[_0xbb67('0x24')](handleEntityNotFound(_0x1ea57f,null))[_0xbb67('0x24')](respondWithResult(_0x1ea57f,null))[_0xbb67('0x40')](handleError(_0x1ea57f,null));};exports[_0xbb67('0x47')]=function(_0x174097,_0xb0943e){return db[_0xbb67('0x2b')][_0xbb67('0x47')](_0x174097[_0xbb67('0x48')],{})[_0xbb67('0x24')](respondWithResult(_0xb0943e,0xc9))[_0xbb67('0x40')](handleError(_0xb0943e,null));};exports[_0xbb67('0x23')]=function(_0x583074,_0x1cf9a3){if(_0x583074['body']['id']){delete _0x583074[_0xbb67('0x48')]['id'];}return db['FreshdeskField'][_0xbb67('0x46')]({'where':{'id':_0x583074[_0xbb67('0x41')]['id']}})['then'](handleEntityNotFound(_0x1cf9a3,null))[_0xbb67('0x24')](saveUpdates(_0x583074[_0xbb67('0x48')],null))['then'](respondWithResult(_0x1cf9a3,null))['catch'](handleError(_0x1cf9a3,null));};exports[_0xbb67('0x25')]=function(_0x5a5a28,_0x3355b2){return db[_0xbb67('0x2b')]['find']({'where':{'id':_0x5a5a28[_0xbb67('0x41')]['id']}})[_0xbb67('0x24')](handleEntityNotFound(_0x3355b2,null))[_0xbb67('0x24')](removeEntity(_0x3355b2,null))['catch'](handleError(_0x3355b2,null));}; \ No newline at end of file +var _0x3b1d=['error','stack','name','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','intersection','options','catch','create','body','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','status','set','Content-Range','reject','save','then','destroy'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0x3b1d,0x172));var _0xd3b1=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x3b1d[_0x18ab2a];return _0x16dcee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd3b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3b1('0x2'));var moment=require(_0xd3b1('0x3'));var BPromise=require(_0xd3b1('0x4'));var Mustache=require(_0xd3b1('0x5'));var util=require(_0xd3b1('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd3b1('0x7'));var squel=require(_0xd3b1('0x8'));var crypto=require(_0xd3b1('0x9'));var jsforce=require(_0xd3b1('0xa'));var deskjs=require(_0xd3b1('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd3b1('0xc'));var Papa=require('papaparse');var Redis=require(_0xd3b1('0xd'));var authService=require(_0xd3b1('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3b1('0xf'));var logger=require(_0xd3b1('0x10'))(_0xd3b1('0x11'));var utils=require(_0xd3b1('0x12'));var config=require(_0xd3b1('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d66e4,_0x47c796){_0x47c796=_0x47c796||0xcc;return function(_0x37de16){if(_0x37de16){return _0x7d66e4[_0xd3b1('0x14')](_0x47c796);}return _0x7d66e4['status'](_0x47c796)[_0xd3b1('0x15')]();};}function respondWithResult(_0x3efe54,_0x40a462){_0x40a462=_0x40a462||0xc8;return function(_0x2e955c){if(_0x2e955c){return _0x3efe54['status'](_0x40a462)[_0xd3b1('0x16')](_0x2e955c);}};}function respondWithFilteredResult(_0x596f9d,_0x1f8500){return function(_0x44cd74){if(_0x44cd74){var _0x4e2a6f=_0x44cd74[_0xd3b1('0x17')],_0x235ba3=_0x1f8500[_0xd3b1('0x18')],_0x38e6ef=_0x1f8500[_0xd3b1('0x18')]+_0x1f8500['limit'],_0x2e2fe9;if(_0x38e6ef>=_0x4e2a6f){_0x38e6ef=_0x4e2a6f;_0x2e2fe9=0xc8;}else{_0x2e2fe9=0xce;}_0x596f9d[_0xd3b1('0x19')](_0x2e2fe9);return _0x596f9d[_0xd3b1('0x1a')](_0xd3b1('0x1b'),_0x235ba3+'-'+_0x38e6ef+'/'+_0x4e2a6f)[_0xd3b1('0x16')](_0x44cd74);}return null;};}function patchUpdates(_0x3fc755){return function(_0x2e091b){try{jsonpatch['apply'](_0x2e091b,_0x3fc755,!![]);}catch(_0x4a50e3){return BPromise[_0xd3b1('0x1c')](_0x4a50e3);}return _0x2e091b[_0xd3b1('0x1d')]();};}function saveUpdates(_0x263de1,_0x5ab1a6){return function(_0x3ba193){if(_0x3ba193){return _0x3ba193['update'](_0x263de1)[_0xd3b1('0x1e')](function(_0x512618){return _0x512618;});}return null;};}function removeEntity(_0x2cb671,_0x3b5010){return function(_0x54469a){if(_0x54469a){return _0x54469a[_0xd3b1('0x1f')]()[_0xd3b1('0x1e')](function(){_0x2cb671['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7df5,_0x598991){return function(_0x5c403b){if(!_0x5c403b){_0x4a7df5[_0xd3b1('0x14')](0x194);}return _0x5c403b;};}function handleError(_0x455939,_0x274e01){_0x274e01=_0x274e01||0x1f4;return function(_0x4197a8){logger[_0xd3b1('0x20')](_0x4197a8[_0xd3b1('0x21')]);if(_0x4197a8[_0xd3b1('0x22')]){delete _0x4197a8[_0xd3b1('0x22')];}_0x455939['status'](_0x274e01)['send'](_0x4197a8);};}exports['index']=function(_0x2ff9bb,_0x25e3e4){var _0x4cd878={},_0x442b4d={},_0x27a29c={'count':0x0,'rows':[]};var _0x5dde2b=_[_0xd3b1('0x23')](db[_0xd3b1('0x24')][_0xd3b1('0x25')],function(_0x5838fe){return{'name':_0x5838fe[_0xd3b1('0x26')],'type':_0x5838fe['type'][_0xd3b1('0x27')]};});_0x442b4d[_0xd3b1('0x28')]=_[_0xd3b1('0x23')](_0x5dde2b,_0xd3b1('0x22'));_0x442b4d[_0xd3b1('0x29')]=_[_0xd3b1('0x2a')](_0x2ff9bb[_0xd3b1('0x29')]);_0x442b4d['filters']=_['intersection'](_0x442b4d[_0xd3b1('0x28')],_0x442b4d['query']);_0x4cd878[_0xd3b1('0x2b')]=_['intersection'](_0x442b4d[_0xd3b1('0x28')],qs['fields'](_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x2c')]));_0x4cd878['attributes']=_0x4cd878[_0xd3b1('0x2b')][_0xd3b1('0x2d')]?_0x4cd878[_0xd3b1('0x2b')]:_0x442b4d[_0xd3b1('0x28')];if(!_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x2e')](_0xd3b1('0x2f'))){_0x4cd878['limit']=qs[_0xd3b1('0x30')](_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x30')]);_0x4cd878[_0xd3b1('0x18')]=qs[_0xd3b1('0x18')](_0x2ff9bb['query'][_0xd3b1('0x18')]);}_0x4cd878['order']=qs[_0xd3b1('0x31')](_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x31')]);_0x4cd878[_0xd3b1('0x32')]=qs['filters'](_['pick'](_0x2ff9bb[_0xd3b1('0x29')],_0x442b4d[_0xd3b1('0x33')]),_0x5dde2b);if(_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x34')]){_0x4cd878[_0xd3b1('0x32')]=_['merge'](_0x4cd878['where'],{'$or':_[_0xd3b1('0x23')](_0x5dde2b,function(_0xb9a4cc){if(_0xb9a4cc[_0xd3b1('0x35')]!==_0xd3b1('0x36')){var _0x1d26ae={};_0x1d26ae[_0xb9a4cc[_0xd3b1('0x22')]]={'$like':'%'+_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x34')]+'%'};return _0x1d26ae;}})});}_0x4cd878=_[_0xd3b1('0x37')]({},_0x4cd878,_0x2ff9bb['options']);var _0x16a79e={'where':_0x4cd878[_0xd3b1('0x32')]};return db[_0xd3b1('0x24')][_0xd3b1('0x17')](_0x16a79e)[_0xd3b1('0x1e')](function(_0x3dbcc0){_0x27a29c['count']=_0x3dbcc0;if(_0x2ff9bb[_0xd3b1('0x29')][_0xd3b1('0x38')]){_0x4cd878[_0xd3b1('0x39')]=[{'all':!![]}];}return db[_0xd3b1('0x24')][_0xd3b1('0x3a')](_0x4cd878);})[_0xd3b1('0x1e')](function(_0x218d9e){_0x27a29c[_0xd3b1('0x3b')]=_0x218d9e;return _0x27a29c;})[_0xd3b1('0x1e')](respondWithFilteredResult(_0x25e3e4,_0x4cd878))['catch'](handleError(_0x25e3e4,null));};exports['show']=function(_0xcc70f1,_0x416317){var _0x50c7f8={'raw':!![],'where':{'id':_0xcc70f1['params']['id']}},_0x4ec85a={};_0x4ec85a['model']=_['keys'](db[_0xd3b1('0x24')][_0xd3b1('0x25')]);_0x4ec85a[_0xd3b1('0x29')]=_[_0xd3b1('0x2a')](_0xcc70f1[_0xd3b1('0x29')]);_0x4ec85a['filters']=_[_0xd3b1('0x3c')](_0x4ec85a[_0xd3b1('0x28')],_0x4ec85a['query']);_0x50c7f8[_0xd3b1('0x2b')]=_[_0xd3b1('0x3c')](_0x4ec85a['model'],qs[_0xd3b1('0x2c')](_0xcc70f1[_0xd3b1('0x29')][_0xd3b1('0x2c')]));_0x50c7f8[_0xd3b1('0x2b')]=_0x50c7f8[_0xd3b1('0x2b')][_0xd3b1('0x2d')]?_0x50c7f8[_0xd3b1('0x2b')]:_0x4ec85a[_0xd3b1('0x28')];if(_0xcc70f1['query'][_0xd3b1('0x38')]){_0x50c7f8[_0xd3b1('0x39')]=[{'all':!![]}];}_0x50c7f8=_[_0xd3b1('0x37')]({},_0x50c7f8,_0xcc70f1[_0xd3b1('0x3d')]);return db['FreshdeskField']['find'](_0x50c7f8)[_0xd3b1('0x1e')](handleEntityNotFound(_0x416317,null))[_0xd3b1('0x1e')](respondWithResult(_0x416317,null))[_0xd3b1('0x3e')](handleError(_0x416317,null));};exports['create']=function(_0x4c93e9,_0x59e5c7){return db[_0xd3b1('0x24')][_0xd3b1('0x3f')](_0x4c93e9['body'],{})[_0xd3b1('0x1e')](respondWithResult(_0x59e5c7,0xc9))[_0xd3b1('0x3e')](handleError(_0x59e5c7,null));};exports['update']=function(_0x35b2f2,_0x704fd0){if(_0x35b2f2[_0xd3b1('0x40')]['id']){delete _0x35b2f2[_0xd3b1('0x40')]['id'];}return db[_0xd3b1('0x24')][_0xd3b1('0x41')]({'where':{'id':_0x35b2f2[_0xd3b1('0x42')]['id']}})[_0xd3b1('0x1e')](handleEntityNotFound(_0x704fd0,null))[_0xd3b1('0x1e')](saveUpdates(_0x35b2f2[_0xd3b1('0x40')],null))['then'](respondWithResult(_0x704fd0,null))[_0xd3b1('0x3e')](handleError(_0x704fd0,null));};exports[_0xd3b1('0x1f')]=function(_0x322689,_0x27776d){return db['FreshdeskField']['find']({'where':{'id':_0x322689[_0xd3b1('0x42')]['id']}})[_0xd3b1('0x1e')](handleEntityNotFound(_0x27776d,null))['then'](removeEntity(_0x27776d,null))[_0xd3b1('0x3e')](handleError(_0x27776d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 9fdabd9..27a3b18 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 _0x2cad=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x2cad,0x1e5));var _0xd2ca=function(_0x1e90a6,_0x3d43b5){_0x1e90a6=_0x1e90a6-0x0;var _0x27c6cd=_0x2cad[_0x1e90a6];return _0x27c6cd;};'use strict';var _=require(_0xd2ca('0x0'));var util=require(_0xd2ca('0x1'));var logger=require(_0xd2ca('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd2ca('0x3'));var rp=require(_0xd2ca('0x4'));var fs=require('fs');var path=require(_0xd2ca('0x5'));var rimraf=require(_0xd2ca('0x6'));var config=require(_0xd2ca('0x7'));var attributes=require(_0xd2ca('0x8'));module[_0xd2ca('0x9')]=function(_0x26a84b,_0x26b2f4){return _0x26a84b['define'](_0xd2ca('0xa'),attributes,{'tableName':_0xd2ca('0xb'),'paranoid':![],'indexes':[{'name':_0xd2ca('0xc'),'fields':[_0xd2ca('0xd'),_0xd2ca('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x69ee=['define','FreshdeskField','int_freshdesk_fields','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x411ac4,_0x32bca6){var _0x512c89=function(_0x549f3b){while(--_0x549f3b){_0x411ac4['push'](_0x411ac4['shift']());}};_0x512c89(++_0x32bca6);}(_0x69ee,0x1ee));var _0xe69e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x69ee[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xe69e('0x0'));var util=require(_0xe69e('0x1'));var logger=require(_0xe69e('0x2'))(_0xe69e('0x3'));var moment=require(_0xe69e('0x4'));var BPromise=require('bluebird');var rp=require(_0xe69e('0x5'));var fs=require('fs');var path=require(_0xe69e('0x6'));var rimraf=require(_0xe69e('0x7'));var config=require(_0xe69e('0x8'));var attributes=require(_0xe69e('0x9'));module['exports']=function(_0x1e271a,_0x19ae48){return _0x1e271a[_0xe69e('0xa')](_0xe69e('0xb'),attributes,{'tableName':_0xe69e('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0xe69e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 0132fad..f229ff1 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(_0x2ff3e6,_0x58d46a){var _0x5ee0e2=function(_0x591afd){while(--_0x591afd){_0x2ff3e6['push'](_0x2ff3e6['shift']());}};_0x5ee0e2(++_0x58d46a);}(_0xb10b,0x12a));var _0xbb10=function(_0x20c809,_0x26b566){_0x20c809=_0x20c809-0x0;var _0x1064a1=_0xb10b[_0x20c809];return _0x1064a1;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xd3e0cf,_0x4622c3){var _0x3ce84d=function(_0x37b1ce){while(--_0x37b1ce){_0xd3e0cf['push'](_0xd3e0cf['shift']());}};_0x3ce84d(++_0x4622c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f38c6,_0x428650){_0x1f38c6=_0x1f38c6-0x0;var _0x259367=_0xb10b[_0x1f38c6];return _0x259367;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9b4873e..280178c 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 _0xd340=['./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../config/environment'];(function(_0x2fc5db,_0x2253b1){var _0x1ef11b=function(_0x2846a5){while(--_0x2846a5){_0x2fc5db['push'](_0x2fc5db['shift']());}};_0x1ef11b(++_0x2253b1);}(_0xd340,0xe0));var _0x0d34=function(_0x2a4551,_0x312009){_0x2a4551=_0x2a4551-0x0;var _0x287585=_0xd340[_0x2a4551];return _0x287585;};'use strict';var multer=require(_0x0d34('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d34('0x1'));var router=express['Router']();var auth=require(_0x0d34('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x0d34('0x3'));var controller=require(_0x0d34('0x4'));router[_0x0d34('0x5')]('/',auth['isAuthenticated'](),controller[_0x0d34('0x6')]);router[_0x0d34('0x5')](_0x0d34('0x7'),auth[_0x0d34('0x8')](),controller[_0x0d34('0x9')]);router[_0x0d34('0x5')](_0x0d34('0xa'),auth['isAuthenticated'](),controller[_0x0d34('0xb')]);router[_0x0d34('0x5')]('/:id/fields',auth[_0x0d34('0x8')](),controller[_0x0d34('0xc')]);router[_0x0d34('0xd')]('/',auth[_0x0d34('0x8')](),controller[_0x0d34('0xe')]);router['post'](_0x0d34('0xa'),auth[_0x0d34('0x8')](),controller['addConfiguration']);router[_0x0d34('0xf')](_0x0d34('0x7'),auth['isAuthenticated'](),controller[_0x0d34('0x10')]);router['delete'](_0x0d34('0x7'),auth['isAuthenticated'](),controller[_0x0d34('0x11')]);module[_0x0d34('0x12')]=router; \ No newline at end of file +var _0x0e4a=['delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update'];(function(_0x2ced60,_0xed0e58){var _0x32e8b7=function(_0x108656){while(--_0x108656){_0x2ced60['push'](_0x2ced60['shift']());}};_0x32e8b7(++_0xed0e58);}(_0x0e4a,0x113));var _0xa0e4=function(_0x4f0ee2,_0x4300ef){_0x4f0ee2=_0x4f0ee2-0x0;var _0x5ce564=_0x0e4a[_0x4f0ee2];return _0x5ce564;};'use strict';var multer=require(_0xa0e4('0x0'));var util=require(_0xa0e4('0x1'));var path=require('path');var timeout=require(_0xa0e4('0x2'));var express=require(_0xa0e4('0x3'));var router=express[_0xa0e4('0x4')]();var auth=require(_0xa0e4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa0e4('0x6'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xa0e4('0x7')](),controller['index']);router[_0xa0e4('0x8')]('/:id',auth[_0xa0e4('0x7')](),controller['show']);router['get']('/:id/configurations',auth[_0xa0e4('0x7')](),controller[_0xa0e4('0x9')]);router[_0xa0e4('0x8')](_0xa0e4('0xa'),auth[_0xa0e4('0x7')](),controller[_0xa0e4('0xb')]);router[_0xa0e4('0xc')]('/',auth['isAuthenticated'](),controller[_0xa0e4('0xd')]);router['post'](_0xa0e4('0xe'),auth['isAuthenticated'](),controller[_0xa0e4('0xf')]);router[_0xa0e4('0x10')](_0xa0e4('0x11'),auth[_0xa0e4('0x7')](),controller[_0xa0e4('0x12')]);router[_0xa0e4('0x13')](_0xa0e4('0x11'),auth[_0xa0e4('0x7')](),controller['destroy']);module[_0xa0e4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index aa9e477..0492071 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 _0x7382=['exports','STRING','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7382,0x111));var _0x2738=function(_0xce6a9d,_0x4b1804){_0xce6a9d=_0xce6a9d-0x0;var _0x344e2=_0x7382[_0xce6a9d];return _0x344e2;};'use strict';var Sequelize=require('sequelize');module[_0x2738('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2738('0x1')],'unique':_0x2738('0x2')},'serverUrl':{'type':Sequelize[_0x2738('0x1')]}}; \ No newline at end of file +var _0xcaaf=['username','remoteUri','sequelize','STRING'];(function(_0x49aec4,_0xcf2687){var _0x26be4e=function(_0x53f168){while(--_0x53f168){_0x49aec4['push'](_0x49aec4['shift']());}};_0x26be4e(++_0xcf2687);}(_0xcaaf,0x66));var _0xfcaa=function(_0x1dc4b6,_0x42d637){_0x1dc4b6=_0x1dc4b6-0x0;var _0x3c296f=_0xcaaf[_0x1dc4b6];return _0x3c296f;};'use strict';var Sequelize=require(_0xfcaa('0x0'));module['exports']={'name':{'type':Sequelize[_0xfcaa('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xfcaa('0x2')},'apiKey':{'type':Sequelize[_0xfcaa('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfcaa('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 9a7df95..abc4af7 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 _0xd701=['params','intersection','length','find','create','body','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','slice','substring','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','FreshsalesAccount','rawAttributes','type','model','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show'];(function(_0x48ced1,_0x502259){var _0x33edb6=function(_0x4f260c){while(--_0x4f260c){_0x48ced1['push'](_0x48ced1['shift']());}};_0x33edb6(++_0x502259);}(_0xd701,0x86));var _0x1d70=function(_0x4fd540,_0x4de6c7){_0x4fd540=_0x4fd540-0x0;var _0x735bb2=_0xd701[_0x4fd540];return _0x735bb2;};'use strict';var pdf=require(_0x1d70('0x0'));var emlformat=require(_0x1d70('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1d70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d70('0x3'));var moment=require(_0x1d70('0x4'));var BPromise=require(_0x1d70('0x5'));var Mustache=require(_0x1d70('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1d70('0x7'));var csv=require('to-csv');var ejs=require(_0x1d70('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d70('0x9'));var crypto=require('crypto');var jsforce=require(_0x1d70('0xa'));var deskjs=require(_0x1d70('0xb'));var toCsv=require(_0x1d70('0xc'));var querystring=require(_0x1d70('0xd'));var Papa=require(_0x1d70('0xe'));var Redis=require(_0x1d70('0xf'));var authService=require(_0x1d70('0x10'));var qs=require(_0x1d70('0x11'));var as=require(_0x1d70('0x12'));var hardwareService=require(_0x1d70('0x13'));var logger=require(_0x1d70('0x14'))(_0x1d70('0x15'));var utils=require('../../config/utils');var config=require(_0x1d70('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1d70('0x17'));var client=jayson['client'][_0x1d70('0x18')]({'port':0x232a});function checkPasswordPattern(_0x385e8a,_0x420211,_0x98e95c){if(_0x98e95c){var _0x397ef5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x397ef5[_0x1d70('0x19')](_0x420211)){return _0x385e8a;}else{throw new db['Sequelize'][(_0x1d70('0x1a'))](_0x1d70('0x1b'));}}else{return _0x385e8a;}}function respondWithRpcPromise(_0x411ef1,_0x51f73f,_0x35ba16,_0x2042b5){return new BPromise(function(_0x4b99a7,_0x4aeccd){var _0x5328de=_0x2042b5||client;return _0x5328de['request'](_0x411ef1,_0x35ba16)[_0x1d70('0x1c')](function(_0x3c74f7){logger[_0x1d70('0x1d')]('FreshsalesAccount,\x20%s,\x20%s',_0x51f73f,'request\x20sent');logger[_0x1d70('0x1e')](_0x1d70('0x1f'),_0x51f73f,_0x1d70('0x20'),JSON['stringify'](_0x3c74f7));if(_0x3c74f7[_0x1d70('0x21')]){if(_0x3c74f7['error']['code']===0x1f4){logger[_0x1d70('0x21')](_0x1d70('0x22'),_0x51f73f,_0x3c74f7[_0x1d70('0x21')]['message']);return _0x4aeccd(_0x3c74f7[_0x1d70('0x21')]['message']);}logger[_0x1d70('0x21')]('FreshsalesAccount,\x20%s,\x20%s',_0x51f73f,_0x3c74f7[_0x1d70('0x21')][_0x1d70('0x23')]);return _0x4b99a7(_0x3c74f7[_0x1d70('0x21')]['message']);}else{logger[_0x1d70('0x1d')](_0x1d70('0x22'),_0x51f73f,_0x1d70('0x20'));_0x4b99a7(_0x3c74f7[_0x1d70('0x24')][_0x1d70('0x23')]);}})[_0x1d70('0x25')](function(_0x439073){logger[_0x1d70('0x21')](_0x1d70('0x22'),_0x51f73f,_0x439073);_0x4aeccd(_0x439073);});});}function respondWithStatusCode(_0x3f47e7,_0x5d7c79){_0x5d7c79=_0x5d7c79||0xcc;return function(_0x4a7fbd){if(_0x4a7fbd){return _0x3f47e7[_0x1d70('0x26')](_0x5d7c79);}return _0x3f47e7['status'](_0x5d7c79)['end']();};}function respondWithResult(_0x4c65a9,_0x37c939){_0x37c939=_0x37c939||0xc8;return function(_0xf2e962){if(_0xf2e962){return _0x4c65a9[_0x1d70('0x27')](_0x37c939)[_0x1d70('0x28')](_0xf2e962);}};}function respondWithFilteredResult(_0x2e2194,_0x5b4da3){return function(_0x42367b){if(_0x42367b){var _0x3a0363=_0x42367b[_0x1d70('0x29')],_0x34d333=_0x5b4da3[_0x1d70('0x2a')],_0x370253=_0x5b4da3[_0x1d70('0x2a')]+_0x5b4da3[_0x1d70('0x2b')],_0x1b20cc;if(_0x370253>=_0x3a0363){_0x370253=_0x3a0363;_0x1b20cc=0xc8;}else{_0x1b20cc=0xce;}_0x2e2194['status'](_0x1b20cc);return _0x2e2194[_0x1d70('0x2c')](_0x1d70('0x2d'),_0x34d333+'-'+_0x370253+'/'+_0x3a0363)[_0x1d70('0x28')](_0x42367b);}return null;};}function patchUpdates(_0x379dec){return function(_0x37ed0d){try{jsonpatch[_0x1d70('0x2e')](_0x37ed0d,_0x379dec,!![]);}catch(_0x3cb963){return BPromise[_0x1d70('0x2f')](_0x3cb963);}return _0x37ed0d[_0x1d70('0x30')]();};}function saveUpdates(_0x1b4f59,_0xc2733b){return function(_0x42959b){if(_0x42959b){return _0x42959b[_0x1d70('0x31')](_0x1b4f59)[_0x1d70('0x1c')](function(_0x2eeaeb){return _0x2eeaeb;});}return null;};}function removeEntity(_0x78c185,_0x57bd01){return function(_0x98df8){if(_0x98df8){return _0x98df8[_0x1d70('0x32')]()[_0x1d70('0x1c')](function(){_0x78c185[_0x1d70('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a435a,_0x32d22c){return function(_0x230b70){if(!_0x230b70){_0x1a435a[_0x1d70('0x26')](0x194);}return _0x230b70;};}function handleError(_0x5cfa94,_0x118aae){_0x118aae=_0x118aae||0x1f4;return function(_0x565a74){logger[_0x1d70('0x21')](_0x565a74['stack']);if(_0x565a74[_0x1d70('0x33')]){delete _0x565a74['name'];}_0x5cfa94[_0x1d70('0x27')](_0x118aae)[_0x1d70('0x34')](_0x565a74);};}exports[_0x1d70('0x35')]=function(_0x12fae8,_0x18e128){var _0x10e94c={},_0x5309dc={},_0x247b42={'count':0x0,'rows':[]};var _0x3d1cea=_[_0x1d70('0x36')](db[_0x1d70('0x37')][_0x1d70('0x38')],function(_0xf4f421){return{'name':_0xf4f421['fieldName'],'type':_0xf4f421[_0x1d70('0x39')]['key']};});_0x5309dc[_0x1d70('0x3a')]=_['map'](_0x3d1cea,_0x1d70('0x33'));_0x5309dc[_0x1d70('0x3b')]=_[_0x1d70('0x3c')](_0x12fae8[_0x1d70('0x3b')]);_0x5309dc[_0x1d70('0x3d')]=_['intersection'](_0x5309dc[_0x1d70('0x3a')],_0x5309dc['query']);_0x10e94c['attributes']=_['intersection'](_0x5309dc[_0x1d70('0x3a')],qs[_0x1d70('0x3e')](_0x12fae8[_0x1d70('0x3b')][_0x1d70('0x3e')]));_0x10e94c[_0x1d70('0x3f')]=_0x10e94c[_0x1d70('0x3f')]['length']?_0x10e94c[_0x1d70('0x3f')]:_0x5309dc['model'];if(!_0x12fae8[_0x1d70('0x3b')]['hasOwnProperty'](_0x1d70('0x40'))){_0x10e94c['limit']=qs[_0x1d70('0x2b')](_0x12fae8[_0x1d70('0x3b')]['limit']);_0x10e94c[_0x1d70('0x2a')]=qs['offset'](_0x12fae8['query'][_0x1d70('0x2a')]);}_0x10e94c[_0x1d70('0x41')]=qs['sort'](_0x12fae8['query'][_0x1d70('0x42')]);_0x10e94c[_0x1d70('0x43')]=qs['filters'](_[_0x1d70('0x44')](_0x12fae8[_0x1d70('0x3b')],_0x5309dc[_0x1d70('0x3d')]),_0x3d1cea);if(_0x12fae8[_0x1d70('0x3b')][_0x1d70('0x45')]){_0x10e94c['where']=_['merge'](_0x10e94c[_0x1d70('0x43')],{'$or':_[_0x1d70('0x36')](_0x3d1cea,function(_0xc3b3d3){if(_0xc3b3d3[_0x1d70('0x39')]!==_0x1d70('0x46')){var _0x48eee9={};_0x48eee9[_0xc3b3d3[_0x1d70('0x33')]]={'$like':'%'+_0x12fae8[_0x1d70('0x3b')][_0x1d70('0x45')]+'%'};return _0x48eee9;}})});}_0x10e94c=_[_0x1d70('0x47')]({},_0x10e94c,_0x12fae8[_0x1d70('0x48')]);var _0x9db34f={'where':_0x10e94c['where']};return db[_0x1d70('0x37')][_0x1d70('0x29')](_0x9db34f)[_0x1d70('0x1c')](function(_0x584c4e){_0x247b42[_0x1d70('0x29')]=_0x584c4e;if(_0x12fae8[_0x1d70('0x3b')][_0x1d70('0x49')]){_0x10e94c['include']=[{'all':!![]}];}return db[_0x1d70('0x37')]['findAll'](_0x10e94c);})[_0x1d70('0x1c')](function(_0x5918c8){_0x247b42[_0x1d70('0x4a')]=_0x5918c8;return _0x247b42;})['then'](respondWithFilteredResult(_0x18e128,_0x10e94c))[_0x1d70('0x25')](handleError(_0x18e128,null));};exports[_0x1d70('0x4b')]=function(_0x37fca7,_0x465620){var _0x5ca88b={'raw':![],'where':{'id':_0x37fca7[_0x1d70('0x4c')]['id']}},_0x14c163={};_0x14c163[_0x1d70('0x3a')]=_[_0x1d70('0x3c')](db[_0x1d70('0x37')][_0x1d70('0x38')]);_0x14c163[_0x1d70('0x3b')]=_[_0x1d70('0x3c')](_0x37fca7['query']);_0x14c163[_0x1d70('0x3d')]=_[_0x1d70('0x4d')](_0x14c163[_0x1d70('0x3a')],_0x14c163[_0x1d70('0x3b')]);_0x5ca88b['attributes']=_[_0x1d70('0x4d')](_0x14c163[_0x1d70('0x3a')],qs[_0x1d70('0x3e')](_0x37fca7[_0x1d70('0x3b')][_0x1d70('0x3e')]));_0x5ca88b[_0x1d70('0x3f')]=_0x5ca88b[_0x1d70('0x3f')][_0x1d70('0x4e')]?_0x5ca88b[_0x1d70('0x3f')]:_0x14c163['model'];if(_0x37fca7[_0x1d70('0x3b')][_0x1d70('0x49')]){_0x5ca88b['include']=[{'all':!![]}];}_0x5ca88b=_[_0x1d70('0x47')]({},_0x5ca88b,_0x37fca7['options']);return db[_0x1d70('0x37')][_0x1d70('0x4f')](_0x5ca88b)[_0x1d70('0x1c')](handleEntityNotFound(_0x465620,null))['then'](respondWithResult(_0x465620,null))[_0x1d70('0x25')](handleError(_0x465620,null));};exports[_0x1d70('0x50')]=function(_0x38b49c,_0x286ac6){return db[_0x1d70('0x37')]['create'](_0x38b49c['body'],{})[_0x1d70('0x1c')](respondWithResult(_0x286ac6,0xc9))[_0x1d70('0x25')](handleError(_0x286ac6,null));};exports[_0x1d70('0x31')]=function(_0x31c05c,_0x9b17fa){if(_0x31c05c[_0x1d70('0x51')]['id']){delete _0x31c05c[_0x1d70('0x51')]['id'];}return db['FreshsalesAccount'][_0x1d70('0x4f')]({'where':{'id':_0x31c05c['params']['id']}})[_0x1d70('0x1c')](handleEntityNotFound(_0x9b17fa,null))[_0x1d70('0x1c')](saveUpdates(_0x31c05c[_0x1d70('0x51')],null))[_0x1d70('0x1c')](respondWithResult(_0x9b17fa,null))[_0x1d70('0x25')](handleError(_0x9b17fa,null));};exports['destroy']=function(_0x3bb7ce,_0x37abbb){return db[_0x1d70('0x37')][_0x1d70('0x4f')]({'where':{'id':_0x3bb7ce[_0x1d70('0x4c')]['id']}})[_0x1d70('0x1c')](handleEntityNotFound(_0x37abbb,null))[_0x1d70('0x1c')](removeEntity(_0x37abbb,null))[_0x1d70('0x25')](handleError(_0x37abbb,null));};exports[_0x1d70('0x52')]=function(_0x21a7e9,_0x5ef66c,_0x4a15b8){var _0x4a4d04={};var _0x5344f4={};var _0x26b11c;var _0x2b0259;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x21a7e9['params']['id']}})['then'](handleEntityNotFound(_0x5ef66c,null))['then'](function(_0x414bb6){if(_0x414bb6){_0x26b11c=_0x414bb6;_0x5344f4[_0x1d70('0x3a')]=_[_0x1d70('0x3c')](db['FreshsalesConfiguration'][_0x1d70('0x38')]);_0x5344f4['query']=_[_0x1d70('0x3c')](_0x21a7e9[_0x1d70('0x3b')]);_0x5344f4[_0x1d70('0x3d')]=_[_0x1d70('0x4d')](_0x5344f4[_0x1d70('0x3a')],_0x5344f4[_0x1d70('0x3b')]);_0x4a4d04[_0x1d70('0x3f')]=_[_0x1d70('0x4d')](_0x5344f4[_0x1d70('0x3a')],qs[_0x1d70('0x3e')](_0x21a7e9[_0x1d70('0x3b')][_0x1d70('0x3e')]));_0x4a4d04[_0x1d70('0x3f')]=_0x4a4d04[_0x1d70('0x3f')][_0x1d70('0x4e')]?_0x4a4d04[_0x1d70('0x3f')]:_0x5344f4['model'];_0x4a4d04['order']=qs[_0x1d70('0x42')](_0x21a7e9[_0x1d70('0x3b')][_0x1d70('0x42')]);_0x4a4d04['where']=qs[_0x1d70('0x3d')](_[_0x1d70('0x44')](_0x21a7e9[_0x1d70('0x3b')],_0x5344f4[_0x1d70('0x3d')]));if(_0x21a7e9[_0x1d70('0x3b')][_0x1d70('0x45')]){_0x4a4d04[_0x1d70('0x43')]=_['merge'](_0x4a4d04[_0x1d70('0x43')],{'$or':_['map'](_0x4a4d04[_0x1d70('0x3f')],function(_0x6b4a89){var _0x33d994={};_0x33d994[_0x6b4a89]={'$like':'%'+_0x21a7e9['query']['filter']+'%'};return _0x33d994;})});}_0x4a4d04=_[_0x1d70('0x47')]({},_0x4a4d04,_0x21a7e9[_0x1d70('0x48')]);return _0x26b11c[_0x1d70('0x52')](_0x4a4d04);}})[_0x1d70('0x1c')](function(_0xfb75b2){if(_0xfb75b2){_0x2b0259=_0xfb75b2[_0x1d70('0x4e')];if(!_0x21a7e9[_0x1d70('0x3b')]['hasOwnProperty']('nolimit')){_0x4a4d04[_0x1d70('0x2b')]=qs['limit'](_0x21a7e9['query'][_0x1d70('0x2b')]);_0x4a4d04[_0x1d70('0x2a')]=qs[_0x1d70('0x2a')](_0x21a7e9[_0x1d70('0x3b')][_0x1d70('0x2a')]);}return _0x26b11c[_0x1d70('0x52')](_0x4a4d04);}})['then'](function(_0x1b1171){if(_0x1b1171){return _0x1b1171?{'count':_0x2b0259,'rows':_0x1b1171}:null;}})['then'](respondWithResult(_0x5ef66c,null))[_0x1d70('0x25')](handleError(_0x5ef66c,null));};exports[_0x1d70('0x53')]=function(_0x3f104c,_0xce57a2,_0x2567f8){if(_0x3f104c['body']['id']){delete _0x3f104c[_0x1d70('0x51')]['id'];}return db[_0x1d70('0x37')][_0x1d70('0x54')]({'where':{'id':_0x3f104c[_0x1d70('0x4c')]['id']}})[_0x1d70('0x1c')](handleEntityNotFound(_0xce57a2,null))[_0x1d70('0x1c')](function(_0x42ceb3){if(_0x42ceb3){_0x3f104c[_0x1d70('0x51')]['AccountId']=_0x42ceb3['id'];_0x3f104c['body'][_0x1d70('0x55')]=integrations[_0x1d70('0x56')](_0x3f104c[_0x1d70('0x51')][_0x1d70('0x57')],_0x3f104c[_0x1d70('0x51')]['type']);_0x3f104c[_0x1d70('0x51')][_0x1d70('0x58')]=integrations[_0x1d70('0x59')](_0x3f104c[_0x1d70('0x51')]['channel'],_0x3f104c['body'][_0x1d70('0x39')]);return db[_0x1d70('0x5a')][_0x1d70('0x50')](_0x3f104c['body'],{'include':[{'model':db[_0x1d70('0x5b')],'as':'Subjects'},{'model':db[_0x1d70('0x5b')],'as':_0x1d70('0x58')}]});}return null;})['then'](respondWithResult(_0xce57a2,null))[_0x1d70('0x25')](handleError(_0xce57a2,null));};exports[_0x1d70('0x5c')]=function(_0x558946,_0x139e7a,_0x311ceb){var _0x18b777='';var _0xdd0b86='';return db[_0x1d70('0x37')][_0x1d70('0x54')]({'where':{'id':_0x558946[_0x1d70('0x4c')]['id']},'attributes':['id',_0x1d70('0x5d'),_0x1d70('0x5e'),'apiKey']})[_0x1d70('0x1c')](handleEntityNotFound(_0x139e7a,null))[_0x1d70('0x1c')](function(_0x232a41){if(_0x232a41){_0xdd0b86=_0x232a41[_0x1d70('0x5d')];_0x18b777=_0x232a41[_0x1d70('0x5e')];var _0xc6f7f7=_0x232a41[_0x1d70('0x5e')][_0x1d70('0x5f')](-0x1);if(_0xc6f7f7==='/'){_0x18b777=_0x18b777[_0x1d70('0x60')](0x0,_0x18b777['lastIndexOf'](_0xc6f7f7));}return rp({'method':'GET','uri':util['format'](_0x1d70('0x61'),_0x18b777,_0x1d70('0x62')),'headers':{'Authorization':_0x1d70('0x63')+_0x232a41['apiKey']},'json':!![]});}})[_0x1d70('0x1c')](function(_0x2b157e){if(_0x2b157e){var _0x3f1efc=_0x2b157e[_0x1d70('0x64')];var _0x36597d=![];var _0x148495=null;for(_0x148495=0x0;_0x148495<_0x3f1efc['length'];_0x148495++){if(_0x3f1efc[_0x148495][_0x1d70('0x65')]===_0xdd0b86){_0x36597d=!![];}}if(_0x36597d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1d70('0x66')});}}})[_0x1d70('0x1c')](respondWithResult(_0x139e7a,null))[_0x1d70('0x25')](function(_0x39ad93){var _0x4f0362=_0x558946[_0x1d70('0x3b')][_0x1d70('0x19')]?0x1f4:_0x39ad93['statusCode']||0x1f4;logger[_0x1d70('0x21')](_0x1d70('0x67'),_0x1d70('0x5c'),_0x4f0362,JSON['stringify'](_0x39ad93));delete _0x39ad93['name'];if(_0x4f0362===0x191){_0x4f0362=0x190;}_0x139e7a['status'](_0x4f0362)[_0x1d70('0x34')](_0x558946[_0x1d70('0x3b')][_0x1d70('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x39ad93[_0x1d70('0x68')]}:_0x39ad93);});}; \ No newline at end of file +var _0xa33f=['show','includeAll','merge','create','body','params','destroy','getConfigurations','findOne','keys','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','format','%s%s','/api/selector/owners','Token\x20token=','users','email','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','limit','set','Content-Range','apply','save','stack','name','send','index','map','FreshsalesAccount','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','type','VIRTUAL','options','include','rows'];(function(_0x371c1b,_0x46e8c7){var _0x2ed0d7=function(_0x24dbf0){while(--_0x24dbf0){_0x371c1b['push'](_0x371c1b['shift']());}};_0x2ed0d7(++_0x46e8c7);}(_0xa33f,0x97));var _0xfa33=function(_0x4f6f8c,_0x5e2778){_0x4f6f8c=_0x4f6f8c-0x0;var _0x245dd9=_0xa33f[_0x4f6f8c];return _0x245dd9;};'use strict';var pdf=require(_0xfa33('0x0'));var emlformat=require(_0xfa33('0x1'));var rimraf=require(_0xfa33('0x2'));var zipdir=require(_0xfa33('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa33('0x4'));var moment=require(_0xfa33('0x5'));var BPromise=require(_0xfa33('0x6'));var Mustache=require(_0xfa33('0x7'));var util=require(_0xfa33('0x8'));var path=require(_0xfa33('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfa33('0xa'));var fs=require('fs');var _=require(_0xfa33('0xb'));var squel=require(_0xfa33('0xc'));var crypto=require(_0xfa33('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa33('0xe'));var querystring=require(_0xfa33('0xf'));var Papa=require(_0xfa33('0x10'));var Redis=require(_0xfa33('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa33('0x12'));var hardwareService=require(_0xfa33('0x13'));var logger=require(_0xfa33('0x14'))(_0xfa33('0x15'));var utils=require(_0xfa33('0x16'));var config=require(_0xfa33('0x17'));var db=require(_0xfa33('0x18'))['db'];var integrations=require(_0xfa33('0x19'));var jayson=require(_0xfa33('0x1a'));var client=jayson[_0xfa33('0x1b')][_0xfa33('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4c869f,_0x3e0d24,_0x158e19){if(_0x158e19){var _0x5134ff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5134ff[_0xfa33('0x1d')](_0x3e0d24)){return _0x4c869f;}else{throw new db[(_0xfa33('0x1e'))]['ValidationError'](_0xfa33('0x1f'));}}else{return _0x4c869f;}}function respondWithRpcPromise(_0x4379b4,_0x1d2c29,_0x1c7219,_0x1843c8){return new BPromise(function(_0x521c0c,_0x292dbd){var _0x389f14=_0x1843c8||client;return _0x389f14[_0xfa33('0x20')](_0x4379b4,_0x1c7219)[_0xfa33('0x21')](function(_0x4b4265){logger[_0xfa33('0x22')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d2c29,_0xfa33('0x23'));logger[_0xfa33('0x24')](_0xfa33('0x25'),_0x1d2c29,'request\x20sent',JSON[_0xfa33('0x26')](_0x4b4265));if(_0x4b4265[_0xfa33('0x27')]){if(_0x4b4265['error'][_0xfa33('0x28')]===0x1f4){logger[_0xfa33('0x27')](_0xfa33('0x29'),_0x1d2c29,_0x4b4265[_0xfa33('0x27')][_0xfa33('0x2a')]);return _0x292dbd(_0x4b4265[_0xfa33('0x27')][_0xfa33('0x2a')]);}logger[_0xfa33('0x27')](_0xfa33('0x29'),_0x1d2c29,_0x4b4265['error'][_0xfa33('0x2a')]);return _0x521c0c(_0x4b4265[_0xfa33('0x27')][_0xfa33('0x2a')]);}else{logger[_0xfa33('0x22')](_0xfa33('0x29'),_0x1d2c29,_0xfa33('0x23'));_0x521c0c(_0x4b4265[_0xfa33('0x2b')][_0xfa33('0x2a')]);}})[_0xfa33('0x2c')](function(_0x26481c){logger[_0xfa33('0x27')](_0xfa33('0x29'),_0x1d2c29,_0x26481c);_0x292dbd(_0x26481c);});});}function respondWithStatusCode(_0x25e825,_0x11ed83){_0x11ed83=_0x11ed83||0xcc;return function(_0x580c5c){if(_0x580c5c){return _0x25e825[_0xfa33('0x2d')](_0x11ed83);}return _0x25e825['status'](_0x11ed83)[_0xfa33('0x2e')]();};}function respondWithResult(_0x3e3fb6,_0x1beab0){_0x1beab0=_0x1beab0||0xc8;return function(_0x10580b){if(_0x10580b){return _0x3e3fb6[_0xfa33('0x2f')](_0x1beab0)[_0xfa33('0x30')](_0x10580b);}};}function respondWithFilteredResult(_0x169e34,_0x47dc0e){return function(_0x4dcecc){if(_0x4dcecc){var _0x17db63=_0x4dcecc[_0xfa33('0x31')],_0x3a6f1c=_0x47dc0e['offset'],_0x2b3e9a=_0x47dc0e['offset']+_0x47dc0e[_0xfa33('0x32')],_0x3d0c74;if(_0x2b3e9a>=_0x17db63){_0x2b3e9a=_0x17db63;_0x3d0c74=0xc8;}else{_0x3d0c74=0xce;}_0x169e34[_0xfa33('0x2f')](_0x3d0c74);return _0x169e34[_0xfa33('0x33')](_0xfa33('0x34'),_0x3a6f1c+'-'+_0x2b3e9a+'/'+_0x17db63)[_0xfa33('0x30')](_0x4dcecc);}return null;};}function patchUpdates(_0x580f0a){return function(_0x1a04cd){try{jsonpatch[_0xfa33('0x35')](_0x1a04cd,_0x580f0a,!![]);}catch(_0x8d41a6){return BPromise['reject'](_0x8d41a6);}return _0x1a04cd[_0xfa33('0x36')]();};}function saveUpdates(_0x3a06d1,_0x491340){return function(_0x3e2a63){if(_0x3e2a63){return _0x3e2a63['update'](_0x3a06d1)[_0xfa33('0x21')](function(_0x45793e){return _0x45793e;});}return null;};}function removeEntity(_0x30aaa5,_0x30a5fe){return function(_0x3ff95a){if(_0x3ff95a){return _0x3ff95a['destroy']()[_0xfa33('0x21')](function(){_0x30aaa5[_0xfa33('0x2f')](0xcc)[_0xfa33('0x2e')]();});}};}function handleEntityNotFound(_0x5cd23e,_0x475eac){return function(_0x52974d){if(!_0x52974d){_0x5cd23e[_0xfa33('0x2d')](0x194);}return _0x52974d;};}function handleError(_0x5b04ff,_0x4fab5d){_0x4fab5d=_0x4fab5d||0x1f4;return function(_0x49a9f3){logger['error'](_0x49a9f3[_0xfa33('0x37')]);if(_0x49a9f3[_0xfa33('0x38')]){delete _0x49a9f3[_0xfa33('0x38')];}_0x5b04ff['status'](_0x4fab5d)[_0xfa33('0x39')](_0x49a9f3);};}exports[_0xfa33('0x3a')]=function(_0x429955,_0x7fd8c0){var _0x384575={},_0x24db24={},_0x25846a={'count':0x0,'rows':[]};var _0x3b149f=_[_0xfa33('0x3b')](db[_0xfa33('0x3c')][_0xfa33('0x3d')],function(_0x2bf410){return{'name':_0x2bf410['fieldName'],'type':_0x2bf410['type'][_0xfa33('0x3e')]};});_0x24db24[_0xfa33('0x3f')]=_['map'](_0x3b149f,_0xfa33('0x38'));_0x24db24[_0xfa33('0x40')]=_['keys'](_0x429955[_0xfa33('0x40')]);_0x24db24[_0xfa33('0x41')]=_['intersection'](_0x24db24['model'],_0x24db24[_0xfa33('0x40')]);_0x384575[_0xfa33('0x42')]=_[_0xfa33('0x43')](_0x24db24[_0xfa33('0x3f')],qs[_0xfa33('0x44')](_0x429955[_0xfa33('0x40')]['fields']));_0x384575[_0xfa33('0x42')]=_0x384575[_0xfa33('0x42')][_0xfa33('0x45')]?_0x384575[_0xfa33('0x42')]:_0x24db24['model'];if(!_0x429955[_0xfa33('0x40')][_0xfa33('0x46')]('nolimit')){_0x384575[_0xfa33('0x32')]=qs[_0xfa33('0x32')](_0x429955[_0xfa33('0x40')][_0xfa33('0x32')]);_0x384575['offset']=qs['offset'](_0x429955['query'][_0xfa33('0x47')]);}_0x384575[_0xfa33('0x48')]=qs[_0xfa33('0x49')](_0x429955[_0xfa33('0x40')][_0xfa33('0x49')]);_0x384575[_0xfa33('0x4a')]=qs[_0xfa33('0x41')](_[_0xfa33('0x4b')](_0x429955['query'],_0x24db24[_0xfa33('0x41')]),_0x3b149f);if(_0x429955['query']['filter']){_0x384575[_0xfa33('0x4a')]=_['merge'](_0x384575[_0xfa33('0x4a')],{'$or':_[_0xfa33('0x3b')](_0x3b149f,function(_0x2bec66){if(_0x2bec66[_0xfa33('0x4c')]!==_0xfa33('0x4d')){var _0x156258={};_0x156258[_0x2bec66['name']]={'$like':'%'+_0x429955['query']['filter']+'%'};return _0x156258;}})});}_0x384575=_['merge']({},_0x384575,_0x429955[_0xfa33('0x4e')]);var _0x5ceb60={'where':_0x384575['where']};return db[_0xfa33('0x3c')][_0xfa33('0x31')](_0x5ceb60)[_0xfa33('0x21')](function(_0x20d60d){_0x25846a[_0xfa33('0x31')]=_0x20d60d;if(_0x429955['query']['includeAll']){_0x384575[_0xfa33('0x4f')]=[{'all':!![]}];}return db[_0xfa33('0x3c')]['findAll'](_0x384575);})[_0xfa33('0x21')](function(_0x1e26ee){_0x25846a[_0xfa33('0x50')]=_0x1e26ee;return _0x25846a;})[_0xfa33('0x21')](respondWithFilteredResult(_0x7fd8c0,_0x384575))[_0xfa33('0x2c')](handleError(_0x7fd8c0,null));};exports[_0xfa33('0x51')]=function(_0x4b0cd2,_0x250fc9){var _0x28cd3f={'raw':![],'where':{'id':_0x4b0cd2['params']['id']}},_0x4e1f19={};_0x4e1f19[_0xfa33('0x3f')]=_['keys'](db[_0xfa33('0x3c')][_0xfa33('0x3d')]);_0x4e1f19[_0xfa33('0x40')]=_['keys'](_0x4b0cd2[_0xfa33('0x40')]);_0x4e1f19['filters']=_['intersection'](_0x4e1f19['model'],_0x4e1f19[_0xfa33('0x40')]);_0x28cd3f['attributes']=_[_0xfa33('0x43')](_0x4e1f19[_0xfa33('0x3f')],qs['fields'](_0x4b0cd2['query'][_0xfa33('0x44')]));_0x28cd3f[_0xfa33('0x42')]=_0x28cd3f[_0xfa33('0x42')]['length']?_0x28cd3f[_0xfa33('0x42')]:_0x4e1f19['model'];if(_0x4b0cd2[_0xfa33('0x40')][_0xfa33('0x52')]){_0x28cd3f[_0xfa33('0x4f')]=[{'all':!![]}];}_0x28cd3f=_[_0xfa33('0x53')]({},_0x28cd3f,_0x4b0cd2[_0xfa33('0x4e')]);return db[_0xfa33('0x3c')]['find'](_0x28cd3f)[_0xfa33('0x21')](handleEntityNotFound(_0x250fc9,null))[_0xfa33('0x21')](respondWithResult(_0x250fc9,null))[_0xfa33('0x2c')](handleError(_0x250fc9,null));};exports[_0xfa33('0x54')]=function(_0x489e19,_0x4b19ea){return db[_0xfa33('0x3c')][_0xfa33('0x54')](_0x489e19['body'],{})[_0xfa33('0x21')](respondWithResult(_0x4b19ea,0xc9))[_0xfa33('0x2c')](handleError(_0x4b19ea,null));};exports['update']=function(_0x4eb8f4,_0x2a4d41){if(_0x4eb8f4[_0xfa33('0x55')]['id']){delete _0x4eb8f4['body']['id'];}return db[_0xfa33('0x3c')]['find']({'where':{'id':_0x4eb8f4[_0xfa33('0x56')]['id']}})[_0xfa33('0x21')](handleEntityNotFound(_0x2a4d41,null))[_0xfa33('0x21')](saveUpdates(_0x4eb8f4['body'],null))[_0xfa33('0x21')](respondWithResult(_0x2a4d41,null))['catch'](handleError(_0x2a4d41,null));};exports[_0xfa33('0x57')]=function(_0x32beea,_0x4c6ae0){return db['FreshsalesAccount']['find']({'where':{'id':_0x32beea[_0xfa33('0x56')]['id']}})['then'](handleEntityNotFound(_0x4c6ae0,null))['then'](removeEntity(_0x4c6ae0,null))[_0xfa33('0x2c')](handleError(_0x4c6ae0,null));};exports[_0xfa33('0x58')]=function(_0x5a6db5,_0x32d363,_0x2a6a16){var _0x382dd8={};var _0x2106d4={};var _0x4cd239;var _0x5c5767;return db[_0xfa33('0x3c')][_0xfa33('0x59')]({'where':{'id':_0x5a6db5[_0xfa33('0x56')]['id']}})[_0xfa33('0x21')](handleEntityNotFound(_0x32d363,null))[_0xfa33('0x21')](function(_0x4b9aca){if(_0x4b9aca){_0x4cd239=_0x4b9aca;_0x2106d4[_0xfa33('0x3f')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x2106d4[_0xfa33('0x40')]=_[_0xfa33('0x5a')](_0x5a6db5['query']);_0x2106d4[_0xfa33('0x41')]=_['intersection'](_0x2106d4['model'],_0x2106d4[_0xfa33('0x40')]);_0x382dd8[_0xfa33('0x42')]=_[_0xfa33('0x43')](_0x2106d4[_0xfa33('0x3f')],qs[_0xfa33('0x44')](_0x5a6db5[_0xfa33('0x40')][_0xfa33('0x44')]));_0x382dd8[_0xfa33('0x42')]=_0x382dd8[_0xfa33('0x42')][_0xfa33('0x45')]?_0x382dd8[_0xfa33('0x42')]:_0x2106d4[_0xfa33('0x3f')];_0x382dd8[_0xfa33('0x48')]=qs['sort'](_0x5a6db5[_0xfa33('0x40')][_0xfa33('0x49')]);_0x382dd8[_0xfa33('0x4a')]=qs[_0xfa33('0x41')](_[_0xfa33('0x4b')](_0x5a6db5['query'],_0x2106d4[_0xfa33('0x41')]));if(_0x5a6db5[_0xfa33('0x40')][_0xfa33('0x5b')]){_0x382dd8['where']=_[_0xfa33('0x53')](_0x382dd8[_0xfa33('0x4a')],{'$or':_[_0xfa33('0x3b')](_0x382dd8[_0xfa33('0x42')],function(_0x14cd6f){var _0x13b67a={};_0x13b67a[_0x14cd6f]={'$like':'%'+_0x5a6db5['query'][_0xfa33('0x5b')]+'%'};return _0x13b67a;})});}_0x382dd8=_[_0xfa33('0x53')]({},_0x382dd8,_0x5a6db5['options']);return _0x4cd239[_0xfa33('0x58')](_0x382dd8);}})['then'](function(_0x4f8b3c){if(_0x4f8b3c){_0x5c5767=_0x4f8b3c[_0xfa33('0x45')];if(!_0x5a6db5['query'][_0xfa33('0x46')](_0xfa33('0x5c'))){_0x382dd8[_0xfa33('0x32')]=qs[_0xfa33('0x32')](_0x5a6db5['query']['limit']);_0x382dd8[_0xfa33('0x47')]=qs[_0xfa33('0x47')](_0x5a6db5[_0xfa33('0x40')][_0xfa33('0x47')]);}return _0x4cd239[_0xfa33('0x58')](_0x382dd8);}})[_0xfa33('0x21')](function(_0x2d82a4){if(_0x2d82a4){return _0x2d82a4?{'count':_0x5c5767,'rows':_0x2d82a4}:null;}})[_0xfa33('0x21')](respondWithResult(_0x32d363,null))[_0xfa33('0x2c')](handleError(_0x32d363,null));};exports[_0xfa33('0x5d')]=function(_0x3e27a7,_0x3905a3,_0x496952){if(_0x3e27a7[_0xfa33('0x55')]['id']){delete _0x3e27a7[_0xfa33('0x55')]['id'];}return db['FreshsalesAccount'][_0xfa33('0x59')]({'where':{'id':_0x3e27a7[_0xfa33('0x56')]['id']}})['then'](handleEntityNotFound(_0x3905a3,null))[_0xfa33('0x21')](function(_0x2450b8){if(_0x2450b8){_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x5e')]=_0x2450b8['id'];_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x5f')]=integrations[_0xfa33('0x60')](_0x3e27a7[_0xfa33('0x55')]['channel'],_0x3e27a7[_0xfa33('0x55')]['type']);_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x61')]=integrations[_0xfa33('0x62')](_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x63')],_0x3e27a7[_0xfa33('0x55')][_0xfa33('0x4c')]);return db[_0xfa33('0x64')]['create'](_0x3e27a7[_0xfa33('0x55')],{'include':[{'model':db[_0xfa33('0x65')],'as':'Subjects'},{'model':db[_0xfa33('0x65')],'as':'Descriptions'}]});}return null;})[_0xfa33('0x21')](respondWithResult(_0x3905a3,null))['catch'](handleError(_0x3905a3,null));};exports[_0xfa33('0x66')]=function(_0x450046,_0x563556,_0x2329a4){var _0x2dfb3f='';var _0x5bd02d='';return db['FreshsalesAccount'][_0xfa33('0x59')]({'where':{'id':_0x450046['params']['id']},'attributes':['id',_0xfa33('0x67'),_0xfa33('0x68'),_0xfa33('0x69')]})[_0xfa33('0x21')](handleEntityNotFound(_0x563556,null))['then'](function(_0x22c1c6){if(_0x22c1c6){_0x5bd02d=_0x22c1c6[_0xfa33('0x67')];_0x2dfb3f=_0x22c1c6[_0xfa33('0x68')];var _0x1e369f=_0x22c1c6['remoteUri'][_0xfa33('0x6a')](-0x1);if(_0x1e369f==='/'){_0x2dfb3f=_0x2dfb3f[_0xfa33('0x6b')](0x0,_0x2dfb3f['lastIndexOf'](_0x1e369f));}return rp({'method':'GET','uri':util[_0xfa33('0x6c')](_0xfa33('0x6d'),_0x2dfb3f,_0xfa33('0x6e')),'headers':{'Authorization':_0xfa33('0x6f')+_0x22c1c6['apiKey']},'json':!![]});}})[_0xfa33('0x21')](function(_0x14d2e7){if(_0x14d2e7){var _0x431887=_0x14d2e7[_0xfa33('0x70')];var _0x254b3d=![];var _0x42a527=null;for(_0x42a527=0x0;_0x42a527<_0x431887[_0xfa33('0x45')];_0x42a527++){if(_0x431887[_0x42a527][_0xfa33('0x71')]===_0x5bd02d){_0x254b3d=!![];}}if(_0x254b3d){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xfa33('0x21')](respondWithResult(_0x563556,null))[_0xfa33('0x2c')](function(_0x59138c){var _0x5ab87c=_0x450046[_0xfa33('0x40')][_0xfa33('0x1d')]?0x1f4:_0x59138c[_0xfa33('0x72')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xfa33('0x66'),_0x5ab87c,JSON[_0xfa33('0x26')](_0x59138c));delete _0x59138c[_0xfa33('0x38')];if(_0x5ab87c===0x191){_0x5ab87c=0x190;}_0x563556[_0xfa33('0x2f')](_0x5ab87c)[_0xfa33('0x39')](_0x450046[_0xfa33('0x40')][_0xfa33('0x1d')]?{'message':_0xfa33('0x73'),'statusCode':_0x59138c[_0xfa33('0x72')]}:_0x59138c);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 817a9ed..eef4e61 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 _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','int_freshsales_accounts'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x885a,0x180));var _0xa885=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x885a[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));var integrations=require(_0xa885('0x9'));module['exports']=function(_0x7ac6bd,_0x1200c7){return _0x7ac6bd[_0xa885('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xa885('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts'];(function(_0x432432,_0x232f5c){var _0x554327=function(_0x1b1903){while(--_0x1b1903){_0x432432['push'](_0x432432['shift']());}};_0x554327(++_0x232f5c);}(_0xe14d,0x1ee));var _0xde14=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xe14d[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));var integrations=require(_0xde14('0x9'));module[_0xde14('0xa')]=function(_0xba1514,_0x4b1f6b){return _0xba1514['define'](_0xde14('0xb'),attributes,{'tableName':_0xde14('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 91c19be..9700734 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 _0xd26f=['GetFreshsalesAccount','FreshsalesAccount','raw','options','limit','map','model','include','attributes','then','ShowFreshsalesAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x44df8a,_0x58af81){var _0x1a7d01=function(_0x416059){while(--_0x416059){_0x44df8a['push'](_0x44df8a['shift']());}};_0x1a7d01(++_0x58af81);}(_0xd26f,0x113));var _0xfd26=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd26f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});}exports[_0xfd26('0x16')]=function(_0xeb7aeb){var _0x210dd4=this;return new Promise(function(_0x36a275,_0x5b3e8b){return db[_0xfd26('0x17')]['findAll']({'raw':_0xeb7aeb['options']?_0xeb7aeb['options'][_0xfd26('0x18')]===undefined?!![]:![]:!![],'where':_0xeb7aeb[_0xfd26('0x19')]?_0xeb7aeb['options']['where']||null:null,'attributes':_0xeb7aeb[_0xfd26('0x19')]?_0xeb7aeb[_0xfd26('0x19')]['attributes']||null:null,'limit':_0xeb7aeb[_0xfd26('0x19')]?_0xeb7aeb['options'][_0xfd26('0x1a')]||null:null,'include':_0xeb7aeb['options']?_0xeb7aeb[_0xfd26('0x19')]['include']?_[_0xfd26('0x1b')](_0xeb7aeb[_0xfd26('0x19')]['include'],function(_0x5f5d51){return{'model':db[_0x5f5d51[_0xfd26('0x1c')]],'as':_0x5f5d51['as'],'attributes':_0x5f5d51['attributes'],'include':_0x5f5d51[_0xfd26('0x1d')]?_[_0xfd26('0x1b')](_0x5f5d51[_0xfd26('0x1d')],function(_0x20be94){return{'model':db[_0x20be94[_0xfd26('0x1c')]],'as':_0x20be94['as'],'attributes':_0x20be94['attributes'],'include':_0x20be94[_0xfd26('0x1d')]?_['map'](_0x20be94[_0xfd26('0x1d')],function(_0x217a38){return{'model':db[_0x217a38['model']],'as':_0x217a38['as'],'attributes':_0x217a38[_0xfd26('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfd26('0x1f')](function(_0x375c98){logger[_0xfd26('0xc')](_0xfd26('0x16'),_0xeb7aeb);logger[_0xfd26('0xf')](_0xfd26('0x16'),_0xeb7aeb,JSON[_0xfd26('0x11')](_0x375c98));_0x36a275(_0x375c98);})[_0xfd26('0x15')](function(_0x5b3be9){logger['error']('GetFreshsalesAccount',_0x5b3be9['message'],_0xeb7aeb);_0x5b3e8b(_0x210dd4[_0xfd26('0x12')](0x1f4,_0x5b3be9['message']));});});};exports[_0xfd26('0x20')]=function(_0x944d20){var _0x481b18=this;return new Promise(function(_0x5d8dab,_0x2b166c){return db['FreshsalesAccount']['find']({'raw':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')][_0xfd26('0x18')]===undefined?!![]:![]:!![],'where':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')]['where']||null:null,'attributes':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')][_0xfd26('0x1e')]||null:null,'include':_0x944d20[_0xfd26('0x19')]?_0x944d20[_0xfd26('0x19')]['include']?_[_0xfd26('0x1b')](_0x944d20['options'][_0xfd26('0x1d')],function(_0x1f1e63){return{'model':db[_0x1f1e63[_0xfd26('0x1c')]],'as':_0x1f1e63['as'],'attributes':_0x1f1e63['attributes'],'include':_0x1f1e63[_0xfd26('0x1d')]?_[_0xfd26('0x1b')](_0x1f1e63[_0xfd26('0x1d')],function(_0xd76274){return{'model':db[_0xd76274['model']],'as':_0xd76274['as'],'attributes':_0xd76274['attributes'],'include':_0xd76274[_0xfd26('0x1d')]?_['map'](_0xd76274[_0xfd26('0x1d')],function(_0x57a5a4){return{'model':db[_0x57a5a4[_0xfd26('0x1c')]],'as':_0x57a5a4['as'],'attributes':_0x57a5a4[_0xfd26('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfd26('0x1f')](function(_0x5ed9de){logger[_0xfd26('0xc')](_0xfd26('0x20'),_0x944d20);logger[_0xfd26('0xf')](_0xfd26('0x20'),_0x944d20,JSON['stringify'](_0x5ed9de));_0x5d8dab(_0x5ed9de);})[_0xfd26('0x15')](function(_0x50cca5){logger[_0xfd26('0x12')]('ShowFreshsalesAccount',_0x50cca5[_0xfd26('0x13')],_0x944d20);_0x2b166c(_0x481b18[_0xfd26('0x12')](0x1f4,_0x50cca5[_0xfd26('0x13')]));});});}; \ No newline at end of file +var _0x781d=['model','map','GetFreshsalesAccount','find','ShowFreshsalesAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x781d,0x14a));var _0xd781=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x781d[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['GetFreshsalesAccount']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')]({'raw':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'limit':_0x1407fc[_0xd781('0x19')]?_0x1407fc['options'][_0xd781('0x1c')]||null:null,'include':_0x1407fc['options']?_0x1407fc['options'][_0xd781('0x1d')]?_['map'](_0x1407fc[_0xd781('0x19')][_0xd781('0x1d')],function(_0x395087){return{'model':db[_0x395087[_0xd781('0x1e')]],'as':_0x395087['as'],'attributes':_0x395087[_0xd781('0x1b')],'include':_0x395087[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x395087[_0xd781('0x1d')],function(_0x10940b){return{'model':db[_0x10940b['model']],'as':_0x10940b['as'],'attributes':_0x10940b['attributes'],'include':_0x10940b[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x10940b[_0xd781('0x1d')],function(_0x57b41e){return{'model':db[_0x57b41e[_0xd781('0x1e')]],'as':_0x57b41e['as'],'attributes':_0x57b41e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e29c8){logger['info'](_0xd781('0x20'),_0x1407fc);logger[_0xd781('0xf')]('GetFreshsalesAccount',_0x1407fc,JSON['stringify'](_0x1e29c8));_0x395d9c(_0x1e29c8);})[_0xd781('0x16')](function(_0x5b0464){logger[_0xd781('0x11')]('GetFreshsalesAccount',_0x5b0464[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x5b0464['message']));});});};exports['ShowFreshsalesAccount']=function(_0x432d14){var _0x29e81a=this;return new Promise(function(_0x1c7d83,_0x5a389c){return db['FreshsalesAccount'][_0xd781('0x21')]({'raw':_0x432d14[_0xd781('0x19')]?_0x432d14[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'include':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x432d14[_0xd781('0x19')]['include'],function(_0x23dffb){return{'model':db[_0x23dffb[_0xd781('0x1e')]],'as':_0x23dffb['as'],'attributes':_0x23dffb[_0xd781('0x1b')],'include':_0x23dffb[_0xd781('0x1d')]?_['map'](_0x23dffb[_0xd781('0x1d')],function(_0x3f20e2){return{'model':db[_0x3f20e2['model']],'as':_0x3f20e2['as'],'attributes':_0x3f20e2[_0xd781('0x1b')],'include':_0x3f20e2['include']?_[_0xd781('0x1f')](_0x3f20e2[_0xd781('0x1d')],function(_0x57fdb6){return{'model':db[_0x57fdb6[_0xd781('0x1e')]],'as':_0x57fdb6['as'],'attributes':_0x57fdb6[_0xd781('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a29b7){logger['info'](_0xd781('0x22'),_0x432d14);logger[_0xd781('0xf')]('ShowFreshsalesAccount',_0x432d14,JSON[_0xd781('0x23')](_0x2a29b7));_0x1c7d83(_0x2a29b7);})[_0xd781('0x16')](function(_0x5651de){logger[_0xd781('0x11')](_0xd781('0x22'),_0x5651de[_0xd781('0x13')],_0x432d14);_0x5a389c(_0x29e81a['error'](0x1f4,_0x5651de[_0xd781('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6203d8a..f391f6c 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 _0xb31f=['get','getDescriptions','getFields','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects'];(function(_0x27a773,_0x4d6eb2){var _0x31655e=function(_0x5f4744){while(--_0x5f4744){_0x27a773['push'](_0x27a773['shift']());}};_0x31655e(++_0x4d6eb2);}(_0xb31f,0x16e));var _0xfb31=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xb31f[_0x4099ee];return _0x1b7bfc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb31('0x0'));var timeout=require(_0xfb31('0x1'));var express=require(_0xfb31('0x2'));var router=express[_0xfb31('0x3')]();var auth=require(_0xfb31('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfb31('0x5'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xfb31('0x6')](),controller[_0xfb31('0x7')]);router['get'](_0xfb31('0x8'),auth[_0xfb31('0x6')](),controller[_0xfb31('0x9')]);router['get'](_0xfb31('0xa'),auth[_0xfb31('0x6')](),controller[_0xfb31('0xb')]);router[_0xfb31('0xc')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xfb31('0xd')]);router[_0xfb31('0xc')]('/:id/fields',auth[_0xfb31('0x6')](),controller[_0xfb31('0xe')]);router[_0xfb31('0xf')]('/',auth[_0xfb31('0x6')](),controller['create']);router[_0xfb31('0x10')](_0xfb31('0x8'),auth[_0xfb31('0x6')](),controller[_0xfb31('0x11')]);router[_0xfb31('0x12')](_0xfb31('0x8'),auth[_0xfb31('0x6')](),controller[_0xfb31('0x13')]);module[_0xfb31('0x14')]=router; \ No newline at end of file +var _0x24ea=['index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','isAuthenticated','getDescriptions','/:id/fields','post','create','update','delete','multer','util','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x3b590f,_0x27ccfd){var _0x156132=function(_0x51d816){while(--_0x51d816){_0x3b590f['push'](_0x3b590f['shift']());}};_0x156132(++_0x27ccfd);}(_0x24ea,0xa1));var _0xa24e=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x24ea[_0xbc1a4b];return _0x108b87;};'use strict';var multer=require(_0xa24e('0x0'));var util=require(_0xa24e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa24e('0x2'));var router=express[_0xa24e('0x3')]();var auth=require(_0xa24e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa24e('0x5'));var controller=require(_0xa24e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa24e('0x7')]);router[_0xa24e('0x8')](_0xa24e('0x9'),auth['isAuthenticated'](),controller[_0xa24e('0xa')]);router[_0xa24e('0x8')](_0xa24e('0xb'),auth['isAuthenticated'](),controller[_0xa24e('0xc')]);router[_0xa24e('0x8')](_0xa24e('0xd'),auth[_0xa24e('0xe')](),controller[_0xa24e('0xf')]);router[_0xa24e('0x8')](_0xa24e('0x10'),auth[_0xa24e('0xe')](),controller['getFields']);router[_0xa24e('0x11')]('/',auth[_0xa24e('0xe')](),controller[_0xa24e('0x12')]);router['put'](_0xa24e('0x9'),auth[_0xa24e('0xe')](),controller[_0xa24e('0x13')]);router[_0xa24e('0x14')](_0xa24e('0x9'),auth[_0xa24e('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 10a5de0..9720614 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 _0x926e=['exports','sequelize'];(function(_0x55bd12,_0x3ccb52){var _0x1941dd=function(_0x22fa61){while(--_0x22fa61){_0x55bd12['push'](_0x55bd12['shift']());}};_0x1941dd(++_0x3ccb52);}(_0x926e,0x1af));var _0xe926=function(_0x1f7609,_0x50ef5d){_0x1f7609=_0x1f7609-0x0;var _0x31a1c2=_0x926e[_0x1f7609];return _0x31a1c2;};'use strict';var Sequelize=require(_0xe926('0x0'));module[_0xe926('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x42ce=['STRING','sequelize'];(function(_0x242df5,_0x263a0c){var _0x54475d=function(_0x259fad){while(--_0x259fad){_0x242df5['push'](_0x242df5['shift']());}};_0x54475d(++_0x263a0c);}(_0x42ce,0x1ed));var _0xe42c=function(_0x2929ac,_0x56a221){_0x2929ac=_0x2929ac-0x0;var _0x4e1633=_0x42ce[_0x2929ac];return _0x4e1633;};'use strict';var Sequelize=require(_0xe42c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe42c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index bb4db24..d9fa52b 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 _0x21ba=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','FreshsalesConfiguration','includeAll','findAll','include','create','body','update','params','find','getSubjects','FreshsalesField','getDescriptions','findOne','nolimit','getFields','options','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','reject','save','then','destroy','end','stack','name','map','rawAttributes','fieldName','type'];(function(_0x492e0b,_0x495310){var _0x5c646a=function(_0x54a0e3){while(--_0x54a0e3){_0x492e0b['push'](_0x492e0b['shift']());}};_0x5c646a(++_0x495310);}(_0x21ba,0x1e3));var _0xa21b=function(_0x1cb526,_0x372383){_0x1cb526=_0x1cb526-0x0;var _0x582cbe=_0x21ba[_0x1cb526];return _0x582cbe;};'use strict';var pdf=require(_0xa21b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa21b('0x1'));var jsonpatch=require(_0xa21b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa21b('0x3'));var Mustache=require(_0xa21b('0x4'));var util=require(_0xa21b('0x5'));var path=require(_0xa21b('0x6'));var sox=require('sox');var csv=require(_0xa21b('0x7'));var ejs=require(_0xa21b('0x8'));var fs=require('fs');var _=require(_0xa21b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa21b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa21b('0x7'));var querystring=require(_0xa21b('0xb'));var Papa=require('papaparse');var Redis=require(_0xa21b('0xc'));var authService=require(_0xa21b('0xd'));var qs=require(_0xa21b('0xe'));var as=require(_0xa21b('0xf'));var hardwareService=require(_0xa21b('0x10'));var logger=require(_0xa21b('0x11'))(_0xa21b('0x12'));var utils=require(_0xa21b('0x13'));var config=require(_0xa21b('0x14'));var db=require(_0xa21b('0x15'))['db'];var jayson=require(_0xa21b('0x16'));var client=jayson[_0xa21b('0x17')][_0xa21b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5f2212,_0x57f0a6,_0x344d7f){if(_0x344d7f){var _0x3a63f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a63f6[_0xa21b('0x19')](_0x57f0a6)){return _0x5f2212;}else{throw new db[(_0xa21b('0x1a'))]['ValidationError'](_0xa21b('0x1b'));}}else{return _0x5f2212;}}function respondWithRpcPromise(_0xb0ec1b,_0x549cac,_0x253ed2,_0x29f2c2){return new BPromise(function(_0x3d4a8c,_0x334963){var _0x623d60=_0x29f2c2||client;return _0x623d60[_0xa21b('0x1c')](_0xb0ec1b,_0x253ed2)['then'](function(_0x837215){logger[_0xa21b('0x1d')](_0xa21b('0x1e'),_0x549cac,_0xa21b('0x1f'));logger['debug'](_0xa21b('0x20'),_0x549cac,_0xa21b('0x1f'),JSON[_0xa21b('0x21')](_0x837215));if(_0x837215[_0xa21b('0x22')]){if(_0x837215['error'][_0xa21b('0x23')]===0x1f4){logger[_0xa21b('0x22')](_0xa21b('0x1e'),_0x549cac,_0x837215['error']['message']);return _0x334963(_0x837215[_0xa21b('0x22')][_0xa21b('0x24')]);}logger[_0xa21b('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x549cac,_0x837215[_0xa21b('0x22')]['message']);return _0x3d4a8c(_0x837215[_0xa21b('0x22')]['message']);}else{logger[_0xa21b('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x549cac,_0xa21b('0x1f'));_0x3d4a8c(_0x837215[_0xa21b('0x25')][_0xa21b('0x24')]);}})[_0xa21b('0x26')](function(_0x37fe32){logger[_0xa21b('0x22')](_0xa21b('0x1e'),_0x549cac,_0x37fe32);_0x334963(_0x37fe32);});});}function respondWithStatusCode(_0x35d2f7,_0x343598){_0x343598=_0x343598||0xcc;return function(_0x553ff9){if(_0x553ff9){return _0x35d2f7[_0xa21b('0x27')](_0x343598);}return _0x35d2f7[_0xa21b('0x28')](_0x343598)['end']();};}function respondWithResult(_0x474aba,_0x272730){_0x272730=_0x272730||0xc8;return function(_0x66c5d8){if(_0x66c5d8){return _0x474aba['status'](_0x272730)[_0xa21b('0x29')](_0x66c5d8);}};}function respondWithFilteredResult(_0x23f997,_0x1bdda2){return function(_0x401004){if(_0x401004){var _0x4b6ed1=_0x401004[_0xa21b('0x2a')],_0x339418=_0x1bdda2['offset'],_0x1f050e=_0x1bdda2['offset']+_0x1bdda2[_0xa21b('0x2b')],_0x451773;if(_0x1f050e>=_0x4b6ed1){_0x1f050e=_0x4b6ed1;_0x451773=0xc8;}else{_0x451773=0xce;}_0x23f997['status'](_0x451773);return _0x23f997[_0xa21b('0x2c')](_0xa21b('0x2d'),_0x339418+'-'+_0x1f050e+'/'+_0x4b6ed1)[_0xa21b('0x29')](_0x401004);}return null;};}function patchUpdates(_0x37afa6){return function(_0x39b00f){try{jsonpatch['apply'](_0x39b00f,_0x37afa6,!![]);}catch(_0x1c69b2){return BPromise[_0xa21b('0x2e')](_0x1c69b2);}return _0x39b00f[_0xa21b('0x2f')]();};}function saveUpdates(_0x3825da,_0x21cc30){return function(_0x10539c){if(_0x10539c){return _0x10539c['update'](_0x3825da)[_0xa21b('0x30')](function(_0x427e97){return _0x427e97;});}return null;};}function removeEntity(_0x422b03,_0x5e3354){return function(_0x50db07){if(_0x50db07){return _0x50db07[_0xa21b('0x31')]()[_0xa21b('0x30')](function(){_0x422b03[_0xa21b('0x28')](0xcc)[_0xa21b('0x32')]();});}};}function handleEntityNotFound(_0x3673e0,_0x16e138){return function(_0x25a06f){if(!_0x25a06f){_0x3673e0[_0xa21b('0x27')](0x194);}return _0x25a06f;};}function handleError(_0x4c0893,_0x5059c2){_0x5059c2=_0x5059c2||0x1f4;return function(_0x17e2b7){logger[_0xa21b('0x22')](_0x17e2b7[_0xa21b('0x33')]);if(_0x17e2b7[_0xa21b('0x34')]){delete _0x17e2b7[_0xa21b('0x34')];}_0x4c0893[_0xa21b('0x28')](_0x5059c2)['send'](_0x17e2b7);};}exports['index']=function(_0x2d716c,_0x50f035){var _0x111098={},_0xc47803={},_0xabeb1d={'count':0x0,'rows':[]};var _0x418a19=_[_0xa21b('0x35')](db['FreshsalesConfiguration'][_0xa21b('0x36')],function(_0x3da218){return{'name':_0x3da218[_0xa21b('0x37')],'type':_0x3da218[_0xa21b('0x38')]['key']};});_0xc47803[_0xa21b('0x39')]=_[_0xa21b('0x35')](_0x418a19,_0xa21b('0x34'));_0xc47803[_0xa21b('0x3a')]=_[_0xa21b('0x3b')](_0x2d716c['query']);_0xc47803[_0xa21b('0x3c')]=_[_0xa21b('0x3d')](_0xc47803[_0xa21b('0x39')],_0xc47803[_0xa21b('0x3a')]);_0x111098[_0xa21b('0x3e')]=_[_0xa21b('0x3d')](_0xc47803[_0xa21b('0x39')],qs[_0xa21b('0x3f')](_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x3f')]));_0x111098['attributes']=_0x111098['attributes'][_0xa21b('0x40')]?_0x111098['attributes']:_0xc47803[_0xa21b('0x39')];if(!_0x2d716c['query'][_0xa21b('0x41')]('nolimit')){_0x111098[_0xa21b('0x2b')]=qs['limit'](_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x2b')]);_0x111098[_0xa21b('0x42')]=qs[_0xa21b('0x42')](_0x2d716c['query'][_0xa21b('0x42')]);}_0x111098[_0xa21b('0x43')]=qs['sort'](_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x44')]);_0x111098[_0xa21b('0x45')]=qs['filters'](_[_0xa21b('0x46')](_0x2d716c[_0xa21b('0x3a')],_0xc47803['filters']),_0x418a19);if(_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x47')]){_0x111098[_0xa21b('0x45')]=_[_0xa21b('0x48')](_0x111098[_0xa21b('0x45')],{'$or':_['map'](_0x418a19,function(_0x5aba63){if(_0x5aba63[_0xa21b('0x38')]!==_0xa21b('0x49')){var _0x1b8b99={};_0x1b8b99[_0x5aba63[_0xa21b('0x34')]]={'$like':'%'+_0x2d716c['query']['filter']+'%'};return _0x1b8b99;}})});}_0x111098=_[_0xa21b('0x48')]({},_0x111098,_0x2d716c['options']);var _0x4cd761={'where':_0x111098[_0xa21b('0x45')]};return db[_0xa21b('0x4a')][_0xa21b('0x2a')](_0x4cd761)[_0xa21b('0x30')](function(_0x514198){_0xabeb1d['count']=_0x514198;if(_0x2d716c[_0xa21b('0x3a')][_0xa21b('0x4b')]){_0x111098['include']=[{'all':!![]}];}return db[_0xa21b('0x4a')][_0xa21b('0x4c')](_0x111098);})['then'](function(_0xf31ac0){_0xabeb1d['rows']=_0xf31ac0;return _0xabeb1d;})[_0xa21b('0x30')](respondWithFilteredResult(_0x50f035,_0x111098))[_0xa21b('0x26')](handleError(_0x50f035,null));};exports['show']=function(_0x50b101,_0x26abec){var _0x277dc5={'raw':![],'where':{'id':_0x50b101['params']['id']}},_0x45a3c4={};_0x45a3c4[_0xa21b('0x39')]=_['keys'](db[_0xa21b('0x4a')][_0xa21b('0x36')]);_0x45a3c4[_0xa21b('0x3a')]=_[_0xa21b('0x3b')](_0x50b101[_0xa21b('0x3a')]);_0x45a3c4[_0xa21b('0x3c')]=_[_0xa21b('0x3d')](_0x45a3c4[_0xa21b('0x39')],_0x45a3c4[_0xa21b('0x3a')]);_0x277dc5[_0xa21b('0x3e')]=_['intersection'](_0x45a3c4['model'],qs['fields'](_0x50b101[_0xa21b('0x3a')]['fields']));_0x277dc5[_0xa21b('0x3e')]=_0x277dc5['attributes']['length']?_0x277dc5['attributes']:_0x45a3c4[_0xa21b('0x39')];if(_0x50b101[_0xa21b('0x3a')][_0xa21b('0x4b')]){_0x277dc5[_0xa21b('0x4d')]=[{'all':!![]}];}_0x277dc5=_[_0xa21b('0x48')]({},_0x277dc5,_0x50b101['options']);return db[_0xa21b('0x4a')]['find'](_0x277dc5)[_0xa21b('0x30')](handleEntityNotFound(_0x26abec,null))[_0xa21b('0x30')](respondWithResult(_0x26abec,null))[_0xa21b('0x26')](handleError(_0x26abec,null));};exports[_0xa21b('0x4e')]=function(_0x57fd53,_0x3ab670){return db['FreshsalesConfiguration'][_0xa21b('0x4e')](_0x57fd53[_0xa21b('0x4f')],{})[_0xa21b('0x30')](respondWithResult(_0x3ab670,0xc9))[_0xa21b('0x26')](handleError(_0x3ab670,null));};exports[_0xa21b('0x50')]=function(_0x1c4c39,_0x1069ba){if(_0x1c4c39[_0xa21b('0x4f')]['id']){delete _0x1c4c39['body']['id'];}return db[_0xa21b('0x4a')]['find']({'where':{'id':_0x1c4c39[_0xa21b('0x51')]['id']}})[_0xa21b('0x30')](handleEntityNotFound(_0x1069ba,null))['then'](saveUpdates(_0x1c4c39['body'],null))[_0xa21b('0x30')](respondWithResult(_0x1069ba,null))[_0xa21b('0x26')](handleError(_0x1069ba,null));};exports[_0xa21b('0x31')]=function(_0x8b1c8e,_0x7fefc8){return db[_0xa21b('0x4a')][_0xa21b('0x52')]({'where':{'id':_0x8b1c8e['params']['id']}})[_0xa21b('0x30')](handleEntityNotFound(_0x7fefc8,null))['then'](removeEntity(_0x7fefc8,null))[_0xa21b('0x26')](handleError(_0x7fefc8,null));};exports[_0xa21b('0x53')]=function(_0x294f6f,_0x2b8c8e,_0x36d788){var _0x593361={};var _0x426a24={};var _0x3fc3e0;var _0x1beb7f;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x294f6f[_0xa21b('0x51')]['id']}})['then'](handleEntityNotFound(_0x2b8c8e,null))['then'](function(_0x9fb3c2){if(_0x9fb3c2){_0x3fc3e0=_0x9fb3c2;_0x426a24[_0xa21b('0x39')]=_[_0xa21b('0x3b')](db[_0xa21b('0x54')]['rawAttributes']);_0x426a24[_0xa21b('0x3a')]=_[_0xa21b('0x3b')](_0x294f6f['query']);_0x426a24[_0xa21b('0x3c')]=_[_0xa21b('0x3d')](_0x426a24[_0xa21b('0x39')],_0x426a24[_0xa21b('0x3a')]);_0x593361[_0xa21b('0x3e')]=_[_0xa21b('0x3d')](_0x426a24[_0xa21b('0x39')],qs['fields'](_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x3f')]));_0x593361[_0xa21b('0x3e')]=_0x593361[_0xa21b('0x3e')]['length']?_0x593361[_0xa21b('0x3e')]:_0x426a24[_0xa21b('0x39')];_0x593361[_0xa21b('0x43')]=qs[_0xa21b('0x44')](_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x44')]);_0x593361[_0xa21b('0x45')]=qs[_0xa21b('0x3c')](_['pick'](_0x294f6f[_0xa21b('0x3a')],_0x426a24[_0xa21b('0x3c')]));if(_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x47')]){_0x593361[_0xa21b('0x45')]=_[_0xa21b('0x48')](_0x593361[_0xa21b('0x45')],{'$or':_[_0xa21b('0x35')](_0x593361['attributes'],function(_0x47b793){var _0x4d686c={};_0x4d686c[_0x47b793]={'$like':'%'+_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x47')]+'%'};return _0x4d686c;})});}_0x593361=_[_0xa21b('0x48')]({},_0x593361,_0x294f6f['options']);return _0x3fc3e0[_0xa21b('0x53')](_0x593361);}})[_0xa21b('0x30')](function(_0x16b7dd){if(_0x16b7dd){_0x1beb7f=_0x16b7dd[_0xa21b('0x40')];if(!_0x294f6f['query']['hasOwnProperty']('nolimit')){_0x593361[_0xa21b('0x2b')]=qs[_0xa21b('0x2b')](_0x294f6f['query'][_0xa21b('0x2b')]);_0x593361[_0xa21b('0x42')]=qs[_0xa21b('0x42')](_0x294f6f[_0xa21b('0x3a')][_0xa21b('0x42')]);}return _0x3fc3e0[_0xa21b('0x53')](_0x593361);}})[_0xa21b('0x30')](function(_0x236572){if(_0x236572){return _0x236572?{'count':_0x1beb7f,'rows':_0x236572}:null;}})[_0xa21b('0x30')](respondWithResult(_0x2b8c8e,null))[_0xa21b('0x26')](handleError(_0x2b8c8e,null));};exports[_0xa21b('0x55')]=function(_0xe04361,_0xc6bae2,_0x5093c4){var _0x247218={};var _0x55bd34={};var _0x92c9f8;var _0x546db8;return db[_0xa21b('0x4a')][_0xa21b('0x56')]({'where':{'id':_0xe04361[_0xa21b('0x51')]['id']}})[_0xa21b('0x30')](handleEntityNotFound(_0xc6bae2,null))[_0xa21b('0x30')](function(_0x4a510e){if(_0x4a510e){_0x92c9f8=_0x4a510e;_0x55bd34['model']=_[_0xa21b('0x3b')](db[_0xa21b('0x54')][_0xa21b('0x36')]);_0x55bd34['query']=_['keys'](_0xe04361[_0xa21b('0x3a')]);_0x55bd34[_0xa21b('0x3c')]=_['intersection'](_0x55bd34[_0xa21b('0x39')],_0x55bd34[_0xa21b('0x3a')]);_0x247218[_0xa21b('0x3e')]=_[_0xa21b('0x3d')](_0x55bd34['model'],qs[_0xa21b('0x3f')](_0xe04361[_0xa21b('0x3a')][_0xa21b('0x3f')]));_0x247218[_0xa21b('0x3e')]=_0x247218['attributes']['length']?_0x247218['attributes']:_0x55bd34[_0xa21b('0x39')];_0x247218[_0xa21b('0x43')]=qs['sort'](_0xe04361[_0xa21b('0x3a')][_0xa21b('0x44')]);_0x247218[_0xa21b('0x45')]=qs[_0xa21b('0x3c')](_[_0xa21b('0x46')](_0xe04361['query'],_0x55bd34['filters']));if(_0xe04361[_0xa21b('0x3a')]['filter']){_0x247218['where']=_['merge'](_0x247218['where'],{'$or':_['map'](_0x247218[_0xa21b('0x3e')],function(_0x3d9f19){var _0x5535d8={};_0x5535d8[_0x3d9f19]={'$like':'%'+_0xe04361[_0xa21b('0x3a')]['filter']+'%'};return _0x5535d8;})});}_0x247218=_['merge']({},_0x247218,_0xe04361['options']);return _0x92c9f8[_0xa21b('0x55')](_0x247218);}})[_0xa21b('0x30')](function(_0x2361a4){if(_0x2361a4){_0x546db8=_0x2361a4['length'];if(!_0xe04361[_0xa21b('0x3a')][_0xa21b('0x41')](_0xa21b('0x57'))){_0x247218[_0xa21b('0x2b')]=qs['limit'](_0xe04361['query'][_0xa21b('0x2b')]);_0x247218[_0xa21b('0x42')]=qs[_0xa21b('0x42')](_0xe04361[_0xa21b('0x3a')][_0xa21b('0x42')]);}return _0x92c9f8[_0xa21b('0x55')](_0x247218);}})[_0xa21b('0x30')](function(_0x1b4e54){if(_0x1b4e54){return _0x1b4e54?{'count':_0x546db8,'rows':_0x1b4e54}:null;}})['then'](respondWithResult(_0xc6bae2,null))[_0xa21b('0x26')](handleError(_0xc6bae2,null));};exports[_0xa21b('0x58')]=function(_0x5297bd,_0x3ecb62,_0x2bbac8){var _0xdd6d74={};var _0x63a667={};var _0x62d6c0;var _0x30700d;return db[_0xa21b('0x4a')][_0xa21b('0x56')]({'where':{'id':_0x5297bd[_0xa21b('0x51')]['id']}})[_0xa21b('0x30')](handleEntityNotFound(_0x3ecb62,null))[_0xa21b('0x30')](function(_0x435182){if(_0x435182){_0x62d6c0=_0x435182;_0x63a667[_0xa21b('0x39')]=_['keys'](db[_0xa21b('0x54')][_0xa21b('0x36')]);_0x63a667['query']=_[_0xa21b('0x3b')](_0x5297bd[_0xa21b('0x3a')]);_0x63a667[_0xa21b('0x3c')]=_[_0xa21b('0x3d')](_0x63a667[_0xa21b('0x39')],_0x63a667[_0xa21b('0x3a')]);_0xdd6d74[_0xa21b('0x3e')]=_['intersection'](_0x63a667[_0xa21b('0x39')],qs[_0xa21b('0x3f')](_0x5297bd[_0xa21b('0x3a')]['fields']));_0xdd6d74[_0xa21b('0x3e')]=_0xdd6d74[_0xa21b('0x3e')]['length']?_0xdd6d74[_0xa21b('0x3e')]:_0x63a667[_0xa21b('0x39')];_0xdd6d74['order']=qs[_0xa21b('0x44')](_0x5297bd[_0xa21b('0x3a')][_0xa21b('0x44')]);_0xdd6d74[_0xa21b('0x45')]=qs[_0xa21b('0x3c')](_[_0xa21b('0x46')](_0x5297bd[_0xa21b('0x3a')],_0x63a667[_0xa21b('0x3c')]));if(_0x5297bd[_0xa21b('0x3a')]['filter']){_0xdd6d74[_0xa21b('0x45')]=_[_0xa21b('0x48')](_0xdd6d74[_0xa21b('0x45')],{'$or':_[_0xa21b('0x35')](_0xdd6d74[_0xa21b('0x3e')],function(_0x4dc876){var _0x6ea227={};_0x6ea227[_0x4dc876]={'$like':'%'+_0x5297bd[_0xa21b('0x3a')]['filter']+'%'};return _0x6ea227;})});}_0xdd6d74=_[_0xa21b('0x48')]({},_0xdd6d74,_0x5297bd[_0xa21b('0x59')]);return _0x62d6c0[_0xa21b('0x58')](_0xdd6d74);}})[_0xa21b('0x30')](function(_0x5e874b){if(_0x5e874b){_0x30700d=_0x5e874b[_0xa21b('0x40')];if(!_0x5297bd[_0xa21b('0x3a')][_0xa21b('0x41')](_0xa21b('0x57'))){_0xdd6d74[_0xa21b('0x2b')]=qs[_0xa21b('0x2b')](_0x5297bd['query'][_0xa21b('0x2b')]);_0xdd6d74[_0xa21b('0x42')]=qs[_0xa21b('0x42')](_0x5297bd[_0xa21b('0x3a')][_0xa21b('0x42')]);}return _0x62d6c0['getFields'](_0xdd6d74);}})['then'](function(_0x13de07){if(_0x13de07){return _0x13de07?{'count':_0x30700d,'rows':_0x13de07}:null;}})[_0xa21b('0x30')](respondWithResult(_0x3ecb62,null))['catch'](handleError(_0x3ecb62,null));}; \ No newline at end of file +var _0xd0a8=['merge','options','count','includeAll','include','findAll','show','params','create','body','find','FreshsalesField','pick','getSubjects','hasOwnProperty','findOne','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../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','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','save','update','destroy','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xd0a8,0x1e8));var _0x8d0a=function(_0x2e479f,_0x1bef04){_0x2e479f=_0x2e479f-0x0;var _0x23a61d=_0xd0a8[_0x2e479f];return _0x23a61d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8d0a('0x0'));var rimraf=require(_0x8d0a('0x1'));var zipdir=require(_0x8d0a('0x2'));var jsonpatch=require(_0x8d0a('0x3'));var rp=require(_0x8d0a('0x4'));var moment=require(_0x8d0a('0x5'));var BPromise=require(_0x8d0a('0x6'));var Mustache=require(_0x8d0a('0x7'));var util=require('util');var path=require(_0x8d0a('0x8'));var sox=require(_0x8d0a('0x9'));var csv=require(_0x8d0a('0xa'));var ejs=require(_0x8d0a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8d0a('0xc'));var crypto=require(_0x8d0a('0xd'));var jsforce=require(_0x8d0a('0xe'));var deskjs=require(_0x8d0a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8d0a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d0a('0x11'));var logger=require(_0x8d0a('0x12'))(_0x8d0a('0x13'));var utils=require(_0x8d0a('0x14'));var config=require(_0x8d0a('0x15'));var db=require(_0x8d0a('0x16'))['db'];var jayson=require(_0x8d0a('0x17'));var client=jayson[_0x8d0a('0x18')][_0x8d0a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x256721,_0x3ea97b,_0x26d00f){if(_0x26d00f){var _0x3d51e0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d51e0[_0x8d0a('0x1a')](_0x3ea97b)){return _0x256721;}else{throw new db[(_0x8d0a('0x1b'))][(_0x8d0a('0x1c'))](_0x8d0a('0x1d'));}}else{return _0x256721;}}function respondWithRpcPromise(_0x2ebb2e,_0x443780,_0x47a875,_0x2cac0f){return new BPromise(function(_0x459c9e,_0x2c97f2){var _0x18f1f1=_0x2cac0f||client;return _0x18f1f1[_0x8d0a('0x1e')](_0x2ebb2e,_0x47a875)[_0x8d0a('0x1f')](function(_0x175fbc){logger[_0x8d0a('0x20')](_0x8d0a('0x21'),_0x443780,_0x8d0a('0x22'));logger['debug'](_0x8d0a('0x23'),_0x443780,'request\x20sent',JSON[_0x8d0a('0x24')](_0x175fbc));if(_0x175fbc['error']){if(_0x175fbc['error'][_0x8d0a('0x25')]===0x1f4){logger[_0x8d0a('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x443780,_0x175fbc[_0x8d0a('0x26')][_0x8d0a('0x27')]);return _0x2c97f2(_0x175fbc[_0x8d0a('0x26')][_0x8d0a('0x27')]);}logger[_0x8d0a('0x26')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x443780,_0x175fbc[_0x8d0a('0x26')][_0x8d0a('0x27')]);return _0x459c9e(_0x175fbc['error'][_0x8d0a('0x27')]);}else{logger[_0x8d0a('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x443780,'request\x20sent');_0x459c9e(_0x175fbc[_0x8d0a('0x28')][_0x8d0a('0x27')]);}})[_0x8d0a('0x29')](function(_0x412788){logger[_0x8d0a('0x26')](_0x8d0a('0x21'),_0x443780,_0x412788);_0x2c97f2(_0x412788);});});}function respondWithStatusCode(_0x2397dd,_0x7ae2f5){_0x7ae2f5=_0x7ae2f5||0xcc;return function(_0x26d77b){if(_0x26d77b){return _0x2397dd[_0x8d0a('0x2a')](_0x7ae2f5);}return _0x2397dd['status'](_0x7ae2f5)[_0x8d0a('0x2b')]();};}function respondWithResult(_0xe75a22,_0x5791f9){_0x5791f9=_0x5791f9||0xc8;return function(_0xacbf11){if(_0xacbf11){return _0xe75a22['status'](_0x5791f9)[_0x8d0a('0x2c')](_0xacbf11);}};}function respondWithFilteredResult(_0x30f306,_0x5e9637){return function(_0x444424){if(_0x444424){var _0xac6e77=_0x444424['count'],_0x48a64f=_0x5e9637['offset'],_0x4fbfca=_0x5e9637[_0x8d0a('0x2d')]+_0x5e9637[_0x8d0a('0x2e')],_0x229bda;if(_0x4fbfca>=_0xac6e77){_0x4fbfca=_0xac6e77;_0x229bda=0xc8;}else{_0x229bda=0xce;}_0x30f306[_0x8d0a('0x2f')](_0x229bda);return _0x30f306[_0x8d0a('0x30')](_0x8d0a('0x31'),_0x48a64f+'-'+_0x4fbfca+'/'+_0xac6e77)[_0x8d0a('0x2c')](_0x444424);}return null;};}function patchUpdates(_0x5e217d){return function(_0x216626){try{jsonpatch[_0x8d0a('0x32')](_0x216626,_0x5e217d,!![]);}catch(_0x10d4cb){return BPromise['reject'](_0x10d4cb);}return _0x216626[_0x8d0a('0x33')]();};}function saveUpdates(_0x417249,_0x5c0ead){return function(_0x11755b){if(_0x11755b){return _0x11755b[_0x8d0a('0x34')](_0x417249)['then'](function(_0x5a376d){return _0x5a376d;});}return null;};}function removeEntity(_0xe61b39,_0x14dfca){return function(_0x3f73e7){if(_0x3f73e7){return _0x3f73e7[_0x8d0a('0x35')]()['then'](function(){_0xe61b39[_0x8d0a('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49dd95,_0x28300e){return function(_0x207ffa){if(!_0x207ffa){_0x49dd95[_0x8d0a('0x2a')](0x194);}return _0x207ffa;};}function handleError(_0x2e21ff,_0x1e58c3){_0x1e58c3=_0x1e58c3||0x1f4;return function(_0x1961e0){logger['error'](_0x1961e0[_0x8d0a('0x36')]);if(_0x1961e0[_0x8d0a('0x37')]){delete _0x1961e0['name'];}_0x2e21ff['status'](_0x1e58c3)[_0x8d0a('0x38')](_0x1961e0);};}exports['index']=function(_0x4825a0,_0x17fdc4){var _0x368bbe={},_0x41663b={},_0x465c0e={'count':0x0,'rows':[]};var _0x4e52d8=_[_0x8d0a('0x39')](db[_0x8d0a('0x3a')][_0x8d0a('0x3b')],function(_0x1b431f){return{'name':_0x1b431f[_0x8d0a('0x3c')],'type':_0x1b431f[_0x8d0a('0x3d')]['key']};});_0x41663b[_0x8d0a('0x3e')]=_[_0x8d0a('0x39')](_0x4e52d8,_0x8d0a('0x37'));_0x41663b[_0x8d0a('0x3f')]=_[_0x8d0a('0x40')](_0x4825a0['query']);_0x41663b[_0x8d0a('0x41')]=_[_0x8d0a('0x42')](_0x41663b[_0x8d0a('0x3e')],_0x41663b['query']);_0x368bbe[_0x8d0a('0x43')]=_[_0x8d0a('0x42')](_0x41663b['model'],qs[_0x8d0a('0x44')](_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x44')]));_0x368bbe['attributes']=_0x368bbe[_0x8d0a('0x43')][_0x8d0a('0x45')]?_0x368bbe['attributes']:_0x41663b['model'];if(!_0x4825a0['query']['hasOwnProperty'](_0x8d0a('0x46'))){_0x368bbe[_0x8d0a('0x2e')]=qs[_0x8d0a('0x2e')](_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x2e')]);_0x368bbe[_0x8d0a('0x2d')]=qs[_0x8d0a('0x2d')](_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x2d')]);}_0x368bbe[_0x8d0a('0x47')]=qs[_0x8d0a('0x48')](_0x4825a0['query'][_0x8d0a('0x48')]);_0x368bbe[_0x8d0a('0x49')]=qs[_0x8d0a('0x41')](_['pick'](_0x4825a0[_0x8d0a('0x3f')],_0x41663b['filters']),_0x4e52d8);if(_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x4a')]){_0x368bbe[_0x8d0a('0x49')]=_['merge'](_0x368bbe['where'],{'$or':_['map'](_0x4e52d8,function(_0x2b790c){if(_0x2b790c[_0x8d0a('0x3d')]!==_0x8d0a('0x4b')){var _0x5081dd={};_0x5081dd[_0x2b790c['name']]={'$like':'%'+_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x4a')]+'%'};return _0x5081dd;}})});}_0x368bbe=_[_0x8d0a('0x4c')]({},_0x368bbe,_0x4825a0[_0x8d0a('0x4d')]);var _0x295a46={'where':_0x368bbe[_0x8d0a('0x49')]};return db['FreshsalesConfiguration'][_0x8d0a('0x4e')](_0x295a46)[_0x8d0a('0x1f')](function(_0x44ebef){_0x465c0e[_0x8d0a('0x4e')]=_0x44ebef;if(_0x4825a0[_0x8d0a('0x3f')][_0x8d0a('0x4f')]){_0x368bbe[_0x8d0a('0x50')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x8d0a('0x51')](_0x368bbe);})['then'](function(_0x2f26ac){_0x465c0e['rows']=_0x2f26ac;return _0x465c0e;})[_0x8d0a('0x1f')](respondWithFilteredResult(_0x17fdc4,_0x368bbe))[_0x8d0a('0x29')](handleError(_0x17fdc4,null));};exports[_0x8d0a('0x52')]=function(_0x3d9dba,_0x5971d3){var _0x17ddee={'raw':![],'where':{'id':_0x3d9dba[_0x8d0a('0x53')]['id']}},_0x229505={};_0x229505[_0x8d0a('0x3e')]=_[_0x8d0a('0x40')](db[_0x8d0a('0x3a')]['rawAttributes']);_0x229505[_0x8d0a('0x3f')]=_[_0x8d0a('0x40')](_0x3d9dba[_0x8d0a('0x3f')]);_0x229505['filters']=_[_0x8d0a('0x42')](_0x229505['model'],_0x229505[_0x8d0a('0x3f')]);_0x17ddee[_0x8d0a('0x43')]=_[_0x8d0a('0x42')](_0x229505[_0x8d0a('0x3e')],qs[_0x8d0a('0x44')](_0x3d9dba[_0x8d0a('0x3f')]['fields']));_0x17ddee['attributes']=_0x17ddee[_0x8d0a('0x43')][_0x8d0a('0x45')]?_0x17ddee['attributes']:_0x229505[_0x8d0a('0x3e')];if(_0x3d9dba[_0x8d0a('0x3f')]['includeAll']){_0x17ddee['include']=[{'all':!![]}];}_0x17ddee=_[_0x8d0a('0x4c')]({},_0x17ddee,_0x3d9dba[_0x8d0a('0x4d')]);return db[_0x8d0a('0x3a')]['find'](_0x17ddee)[_0x8d0a('0x1f')](handleEntityNotFound(_0x5971d3,null))['then'](respondWithResult(_0x5971d3,null))[_0x8d0a('0x29')](handleError(_0x5971d3,null));};exports[_0x8d0a('0x54')]=function(_0x893233,_0x3e84f7){return db[_0x8d0a('0x3a')][_0x8d0a('0x54')](_0x893233[_0x8d0a('0x55')],{})[_0x8d0a('0x1f')](respondWithResult(_0x3e84f7,0xc9))[_0x8d0a('0x29')](handleError(_0x3e84f7,null));};exports['update']=function(_0x40bbdc,_0x108dd6){if(_0x40bbdc[_0x8d0a('0x55')]['id']){delete _0x40bbdc['body']['id'];}return db[_0x8d0a('0x3a')][_0x8d0a('0x56')]({'where':{'id':_0x40bbdc[_0x8d0a('0x53')]['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x108dd6,null))[_0x8d0a('0x1f')](saveUpdates(_0x40bbdc['body'],null))['then'](respondWithResult(_0x108dd6,null))[_0x8d0a('0x29')](handleError(_0x108dd6,null));};exports[_0x8d0a('0x35')]=function(_0x3eebb9,_0x442a85){return db[_0x8d0a('0x3a')]['find']({'where':{'id':_0x3eebb9['params']['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x442a85,null))[_0x8d0a('0x1f')](removeEntity(_0x442a85,null))[_0x8d0a('0x29')](handleError(_0x442a85,null));};exports['getSubjects']=function(_0x15e30b,_0x4a3113,_0x435943){var _0x52ef7c={};var _0x2db769={};var _0x18deff;var _0x15ff88;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x15e30b[_0x8d0a('0x53')]['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x4a3113,null))['then'](function(_0xa5da09){if(_0xa5da09){_0x18deff=_0xa5da09;_0x2db769['model']=_['keys'](db[_0x8d0a('0x57')][_0x8d0a('0x3b')]);_0x2db769[_0x8d0a('0x3f')]=_[_0x8d0a('0x40')](_0x15e30b[_0x8d0a('0x3f')]);_0x2db769[_0x8d0a('0x41')]=_[_0x8d0a('0x42')](_0x2db769[_0x8d0a('0x3e')],_0x2db769['query']);_0x52ef7c[_0x8d0a('0x43')]=_['intersection'](_0x2db769[_0x8d0a('0x3e')],qs[_0x8d0a('0x44')](_0x15e30b[_0x8d0a('0x3f')][_0x8d0a('0x44')]));_0x52ef7c[_0x8d0a('0x43')]=_0x52ef7c['attributes']['length']?_0x52ef7c[_0x8d0a('0x43')]:_0x2db769[_0x8d0a('0x3e')];_0x52ef7c[_0x8d0a('0x47')]=qs['sort'](_0x15e30b[_0x8d0a('0x3f')]['sort']);_0x52ef7c['where']=qs['filters'](_[_0x8d0a('0x58')](_0x15e30b['query'],_0x2db769[_0x8d0a('0x41')]));if(_0x15e30b[_0x8d0a('0x3f')][_0x8d0a('0x4a')]){_0x52ef7c[_0x8d0a('0x49')]=_[_0x8d0a('0x4c')](_0x52ef7c['where'],{'$or':_[_0x8d0a('0x39')](_0x52ef7c[_0x8d0a('0x43')],function(_0xa41068){var _0x40fff7={};_0x40fff7[_0xa41068]={'$like':'%'+_0x15e30b[_0x8d0a('0x3f')][_0x8d0a('0x4a')]+'%'};return _0x40fff7;})});}_0x52ef7c=_['merge']({},_0x52ef7c,_0x15e30b[_0x8d0a('0x4d')]);return _0x18deff[_0x8d0a('0x59')](_0x52ef7c);}})['then'](function(_0x5d4b0f){if(_0x5d4b0f){_0x15ff88=_0x5d4b0f[_0x8d0a('0x45')];if(!_0x15e30b['query'][_0x8d0a('0x5a')]('nolimit')){_0x52ef7c['limit']=qs[_0x8d0a('0x2e')](_0x15e30b[_0x8d0a('0x3f')][_0x8d0a('0x2e')]);_0x52ef7c[_0x8d0a('0x2d')]=qs[_0x8d0a('0x2d')](_0x15e30b['query'][_0x8d0a('0x2d')]);}return _0x18deff[_0x8d0a('0x59')](_0x52ef7c);}})['then'](function(_0x3128e1){if(_0x3128e1){return _0x3128e1?{'count':_0x15ff88,'rows':_0x3128e1}:null;}})['then'](respondWithResult(_0x4a3113,null))[_0x8d0a('0x29')](handleError(_0x4a3113,null));};exports['getDescriptions']=function(_0x56413f,_0x3d55c3,_0x4c2fbc){var _0x142214={};var _0x39d01c={};var _0x4eeb9f;var _0x596340;return db[_0x8d0a('0x3a')][_0x8d0a('0x5b')]({'where':{'id':_0x56413f[_0x8d0a('0x53')]['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x3d55c3,null))[_0x8d0a('0x1f')](function(_0x6d54c1){if(_0x6d54c1){_0x4eeb9f=_0x6d54c1;_0x39d01c['model']=_[_0x8d0a('0x40')](db[_0x8d0a('0x57')][_0x8d0a('0x3b')]);_0x39d01c['query']=_['keys'](_0x56413f[_0x8d0a('0x3f')]);_0x39d01c[_0x8d0a('0x41')]=_[_0x8d0a('0x42')](_0x39d01c[_0x8d0a('0x3e')],_0x39d01c[_0x8d0a('0x3f')]);_0x142214['attributes']=_[_0x8d0a('0x42')](_0x39d01c['model'],qs['fields'](_0x56413f[_0x8d0a('0x3f')]['fields']));_0x142214['attributes']=_0x142214[_0x8d0a('0x43')][_0x8d0a('0x45')]?_0x142214[_0x8d0a('0x43')]:_0x39d01c[_0x8d0a('0x3e')];_0x142214['order']=qs['sort'](_0x56413f[_0x8d0a('0x3f')][_0x8d0a('0x48')]);_0x142214[_0x8d0a('0x49')]=qs[_0x8d0a('0x41')](_[_0x8d0a('0x58')](_0x56413f[_0x8d0a('0x3f')],_0x39d01c['filters']));if(_0x56413f[_0x8d0a('0x3f')]['filter']){_0x142214[_0x8d0a('0x49')]=_[_0x8d0a('0x4c')](_0x142214['where'],{'$or':_[_0x8d0a('0x39')](_0x142214['attributes'],function(_0x12e308){var _0xae2d2={};_0xae2d2[_0x12e308]={'$like':'%'+_0x56413f['query'][_0x8d0a('0x4a')]+'%'};return _0xae2d2;})});}_0x142214=_[_0x8d0a('0x4c')]({},_0x142214,_0x56413f[_0x8d0a('0x4d')]);return _0x4eeb9f[_0x8d0a('0x5c')](_0x142214);}})[_0x8d0a('0x1f')](function(_0x36ba55){if(_0x36ba55){_0x596340=_0x36ba55[_0x8d0a('0x45')];if(!_0x56413f['query']['hasOwnProperty'](_0x8d0a('0x46'))){_0x142214[_0x8d0a('0x2e')]=qs['limit'](_0x56413f[_0x8d0a('0x3f')]['limit']);_0x142214['offset']=qs[_0x8d0a('0x2d')](_0x56413f[_0x8d0a('0x3f')]['offset']);}return _0x4eeb9f['getDescriptions'](_0x142214);}})[_0x8d0a('0x1f')](function(_0x1af4f4){if(_0x1af4f4){return _0x1af4f4?{'count':_0x596340,'rows':_0x1af4f4}:null;}})[_0x8d0a('0x1f')](respondWithResult(_0x3d55c3,null))[_0x8d0a('0x29')](handleError(_0x3d55c3,null));};exports[_0x8d0a('0x5d')]=function(_0x12ac41,_0x104860,_0x5df927){var _0x593cea={};var _0x27a3c4={};var _0xfcc0e4;var _0x29320d;return db['FreshsalesConfiguration'][_0x8d0a('0x5b')]({'where':{'id':_0x12ac41[_0x8d0a('0x53')]['id']}})[_0x8d0a('0x1f')](handleEntityNotFound(_0x104860,null))['then'](function(_0x1f81f1){if(_0x1f81f1){_0xfcc0e4=_0x1f81f1;_0x27a3c4[_0x8d0a('0x3e')]=_[_0x8d0a('0x40')](db[_0x8d0a('0x57')]['rawAttributes']);_0x27a3c4['query']=_[_0x8d0a('0x40')](_0x12ac41[_0x8d0a('0x3f')]);_0x27a3c4[_0x8d0a('0x41')]=_[_0x8d0a('0x42')](_0x27a3c4[_0x8d0a('0x3e')],_0x27a3c4[_0x8d0a('0x3f')]);_0x593cea[_0x8d0a('0x43')]=_['intersection'](_0x27a3c4['model'],qs[_0x8d0a('0x44')](_0x12ac41[_0x8d0a('0x3f')][_0x8d0a('0x44')]));_0x593cea[_0x8d0a('0x43')]=_0x593cea[_0x8d0a('0x43')][_0x8d0a('0x45')]?_0x593cea['attributes']:_0x27a3c4['model'];_0x593cea[_0x8d0a('0x47')]=qs['sort'](_0x12ac41['query'][_0x8d0a('0x48')]);_0x593cea[_0x8d0a('0x49')]=qs['filters'](_['pick'](_0x12ac41[_0x8d0a('0x3f')],_0x27a3c4[_0x8d0a('0x41')]));if(_0x12ac41['query'][_0x8d0a('0x4a')]){_0x593cea['where']=_['merge'](_0x593cea['where'],{'$or':_[_0x8d0a('0x39')](_0x593cea[_0x8d0a('0x43')],function(_0x1aa1f6){var _0x232c2d={};_0x232c2d[_0x1aa1f6]={'$like':'%'+_0x12ac41[_0x8d0a('0x3f')][_0x8d0a('0x4a')]+'%'};return _0x232c2d;})});}_0x593cea=_[_0x8d0a('0x4c')]({},_0x593cea,_0x12ac41[_0x8d0a('0x4d')]);return _0xfcc0e4[_0x8d0a('0x5d')](_0x593cea);}})[_0x8d0a('0x1f')](function(_0x5b2b96){if(_0x5b2b96){_0x29320d=_0x5b2b96[_0x8d0a('0x45')];if(!_0x12ac41['query']['hasOwnProperty'](_0x8d0a('0x46'))){_0x593cea[_0x8d0a('0x2e')]=qs[_0x8d0a('0x2e')](_0x12ac41[_0x8d0a('0x3f')][_0x8d0a('0x2e')]);_0x593cea[_0x8d0a('0x2d')]=qs['offset'](_0x12ac41['query'][_0x8d0a('0x2d')]);}return _0xfcc0e4[_0x8d0a('0x5d')](_0x593cea);}})[_0x8d0a('0x1f')](function(_0x42e1b6){if(_0x42e1b6){return _0x42e1b6?{'count':_0x29320d,'rows':_0x42e1b6}:null;}})['then'](respondWithResult(_0x104860,null))[_0x8d0a('0x29')](handleError(_0x104860,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 55271df..43abc2d 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 _0x78d4=['util','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','lodash'];(function(_0x4135d8,_0x2672a2){var _0x227f8b=function(_0x5f9ca6){while(--_0x5f9ca6){_0x4135d8['push'](_0x4135d8['shift']());}};_0x227f8b(++_0x2672a2);}(_0x78d4,0xef));var _0x478d=function(_0x480387,_0x1eeafd){_0x480387=_0x480387-0x0;var _0x1aed30=_0x78d4[_0x480387];return _0x1aed30;};'use strict';var _=require(_0x478d('0x0'));var util=require(_0x478d('0x1'));var logger=require('../../config/logger')(_0x478d('0x2'));var moment=require('moment');var BPromise=require(_0x478d('0x3'));var rp=require(_0x478d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x478d('0x5'));var config=require(_0x478d('0x6'));var attributes=require(_0x478d('0x7'));module['exports']=function(_0x52e76e,_0x27d894){return _0x52e76e[_0x478d('0x8')](_0x478d('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb951=['int_freshsales_configurations','lodash','util','api','moment','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x5004d5,_0x50ab11){var _0x33469a=function(_0x270937){while(--_0x270937){_0x5004d5['push'](_0x5004d5['shift']());}};_0x33469a(++_0x50ab11);}(_0xb951,0x139));var _0x1b95=function(_0x2bff01,_0x1d1396){_0x2bff01=_0x2bff01-0x0;var _0x9e6bef=_0xb951[_0x2bff01];return _0x9e6bef;};'use strict';var _=require(_0x1b95('0x0'));var util=require(_0x1b95('0x1'));var logger=require('../../config/logger')(_0x1b95('0x2'));var moment=require(_0x1b95('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b95('0x4'));var fs=require('fs');var path=require(_0x1b95('0x5'));var rimraf=require('rimraf');var config=require(_0x1b95('0x6'));var attributes=require(_0x1b95('0x7'));module[_0x1b95('0x8')]=function(_0x22a97a,_0x5babbb){return _0x22a97a[_0x1b95('0x9')](_0x1b95('0xa'),attributes,{'tableName':_0x1b95('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 54715f0..3401143 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 _0x38d0=['debug','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0xc86ab7,_0x1a1cea){var _0x24c021=function(_0x5578d4){while(--_0x5578d4){_0xc86ab7['push'](_0xc86ab7['shift']());}};_0x24c021(++_0x1a1cea);}(_0x38d0,0x123));var _0x038d=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x38d0[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require(_0x038d('0x0'));var moment=require(_0x038d('0x1'));var BPromise=require(_0x038d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x038d('0x3'));var db=require(_0x038d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x038d('0x5'));var config=require('../../config/environment');var jayson=require(_0x038d('0x6'));var client=jayson[_0x038d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10dca5,_0x18b35a,_0x434026){return new BPromise(function(_0x76bc10,_0x22d8ab){return client[_0x038d('0x8')](_0x10dca5,_0x434026)[_0x038d('0x9')](function(_0x353806){logger[_0x038d('0xa')](_0x038d('0xb'),_0x18b35a,_0x038d('0xc'));logger[_0x038d('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x18b35a,_0x038d('0xc'),JSON[_0x038d('0xe')](_0x353806));if(_0x353806[_0x038d('0xf')]){if(_0x353806['error'][_0x038d('0x10')]===0x1f4){logger[_0x038d('0xf')](_0x038d('0xb'),_0x18b35a,_0x353806[_0x038d('0xf')][_0x038d('0x11')]);return _0x22d8ab(_0x353806[_0x038d('0xf')][_0x038d('0x11')]);}logger[_0x038d('0xf')](_0x038d('0xb'),_0x18b35a,_0x353806['error']['message']);return _0x76bc10(_0x353806['error'][_0x038d('0x11')]);}else{logger[_0x038d('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x18b35a,'request\x20sent');_0x76bc10(_0x353806['result']['message']);}})[_0x038d('0x12')](function(_0x748d51){logger[_0x038d('0xf')](_0x038d('0xb'),_0x18b35a,_0x748d51);_0x22d8ab(_0x748d51);});});} \ No newline at end of file +var _0xfb71=['request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2fdbbb,_0x557b4e){var _0x2eac63=function(_0x56cf4d){while(--_0x56cf4d){_0x2fdbbb['push'](_0x2fdbbb['shift']());}};_0x2eac63(++_0x557b4e);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x2d558f,_0x30a473){_0x2d558f=_0x2d558f-0x0;var _0x398589=_0xfb71[_0x2d558f];return _0x398589;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var moment=require(_0x1fb7('0x2'));var BPromise=require(_0x1fb7('0x3'));var rs=require(_0x1fb7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1fb7('0x5'));var logger=require(_0x1fb7('0x6'))(_0x1fb7('0x7'));var config=require('../../config/environment');var jayson=require(_0x1fb7('0x8'));var client=jayson[_0x1fb7('0x9')][_0x1fb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2112f8,_0x42fc30,_0x45742f){return new BPromise(function(_0x4abac2,_0x287b4a){return client[_0x1fb7('0xb')](_0x2112f8,_0x45742f)['then'](function(_0x968df9){logger[_0x1fb7('0xc')](_0x1fb7('0xd'),_0x42fc30,_0x1fb7('0xe'));logger[_0x1fb7('0xf')](_0x1fb7('0x10'),_0x42fc30,'request\x20sent',JSON['stringify'](_0x968df9));if(_0x968df9[_0x1fb7('0x11')]){if(_0x968df9[_0x1fb7('0x11')][_0x1fb7('0x12')]===0x1f4){logger['error'](_0x1fb7('0xd'),_0x42fc30,_0x968df9[_0x1fb7('0x11')][_0x1fb7('0x13')]);return _0x287b4a(_0x968df9['error']['message']);}logger[_0x1fb7('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x42fc30,_0x968df9['error'][_0x1fb7('0x13')]);return _0x4abac2(_0x968df9['error'][_0x1fb7('0x13')]);}else{logger[_0x1fb7('0xc')](_0x1fb7('0xd'),_0x42fc30,_0x1fb7('0xe'));_0x4abac2(_0x968df9[_0x1fb7('0x14')][_0x1fb7('0x13')]);}})[_0x1fb7('0x15')](function(_0x3126bf){logger[_0x1fb7('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x42fc30,_0x3126bf);_0x287b4a(_0x3126bf);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c882675..bcbfee7 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 _0xf6e2=['Router','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5ddb24,_0x81cab2){var _0x3578b8=function(_0x63522b){while(--_0x63522b){_0x5ddb24['push'](_0x5ddb24['shift']());}};_0x3578b8(++_0x81cab2);}(_0xf6e2,0x1e2));var _0x2f6e=function(_0x64b6e,_0x391478){_0x64b6e=_0x64b6e-0x0;var _0x5d4448=_0xf6e2[_0x64b6e];return _0x5d4448;};'use strict';var multer=require(_0x2f6e('0x0'));var util=require('util');var path=require(_0x2f6e('0x1'));var timeout=require(_0x2f6e('0x2'));var express=require(_0x2f6e('0x3'));var router=express[_0x2f6e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f6e('0x5'));var controller=require(_0x2f6e('0x6'));router[_0x2f6e('0x7')]('/',auth[_0x2f6e('0x8')](),controller[_0x2f6e('0x9')]);router[_0x2f6e('0x7')](_0x2f6e('0xa'),auth['isAuthenticated'](),controller[_0x2f6e('0xb')]);router[_0x2f6e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2f6e('0xd')](_0x2f6e('0xa'),auth['isAuthenticated'](),controller[_0x2f6e('0xe')]);router[_0x2f6e('0xf')](_0x2f6e('0xa'),auth[_0x2f6e('0x8')](),controller[_0x2f6e('0x10')]);module[_0x2f6e('0x11')]=router; \ No newline at end of file +var _0x819d=['get','isAuthenticated','/:id','show','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x36087c,_0x34daad){var _0x24563e=function(_0x485aa8){while(--_0x485aa8){_0x36087c['push'](_0x36087c['shift']());}};_0x24563e(++_0x34daad);}(_0x819d,0x1a7));var _0xd819=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x819d[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0xd819('0x0'));var util=require(_0xd819('0x1'));var path=require(_0xd819('0x2'));var timeout=require('connect-timeout');var express=require(_0xd819('0x3'));var router=express[_0xd819('0x4')]();var auth=require(_0xd819('0x5'));var interaction=require(_0xd819('0x6'));var config=require(_0xd819('0x7'));var controller=require(_0xd819('0x8'));router[_0xd819('0x9')]('/',auth[_0xd819('0xa')](),controller['index']);router[_0xd819('0x9')](_0xd819('0xb'),auth['isAuthenticated'](),controller[_0xd819('0xc')]);router['post']('/',auth[_0xd819('0xa')](),controller[_0xd819('0xd')]);router[_0xd819('0xe')](_0xd819('0xb'),auth[_0xd819('0xa')](),controller[_0xd819('0xf')]);router[_0xd819('0x10')](_0xd819('0xb'),auth[_0xd819('0xa')](),controller['destroy']);module[_0xd819('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 805c74e..64ea7b3 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 _0x603c=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x603c,0x16b));var _0xc603=function(_0xa8ec8f,_0x3eaefa){_0xa8ec8f=_0xa8ec8f-0x0;var _0xcd07ea=_0x603c[_0xa8ec8f];return _0xcd07ea;};'use strict';var Sequelize=require(_0xc603('0x0'));module[_0xc603('0x1')]={'type':{'type':Sequelize[_0xc603('0x2')](_0xc603('0x3'),'variable','customVariable',_0xc603('0x4')),'defaultValue':_0xc603('0x3')},'content':{'type':Sequelize[_0xc603('0x5')]},'key':{'type':Sequelize[_0xc603('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xc603('0x3'),'variable',_0xc603('0x6'))},'keyContent':{'type':Sequelize[_0xc603('0x5')]},'idField':{'type':Sequelize[_0xc603('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc603('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc603('0x5')]}}; \ No newline at end of file +var _0x1c0a=['customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x2c2b58,_0x58e092){var _0x50c466=function(_0x4ee393){while(--_0x4ee393){_0x2c2b58['push'](_0x2c2b58['shift']());}};_0x50c466(++_0x58e092);}(_0x1c0a,0x14a));var _0xa1c0=function(_0x48ac3f,_0x5c612f){_0x48ac3f=_0x48ac3f-0x0;var _0x2bb971=_0x1c0a[_0x48ac3f];return _0x2bb971;};'use strict';var Sequelize=require('sequelize');module[_0xa1c0('0x0')]={'type':{'type':Sequelize[_0xa1c0('0x1')](_0xa1c0('0x2'),_0xa1c0('0x3'),'customVariable',_0xa1c0('0x4')),'defaultValue':_0xa1c0('0x2')},'content':{'type':Sequelize[_0xa1c0('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa1c0('0x1')](_0xa1c0('0x2'),_0xa1c0('0x3'),_0xa1c0('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa1c0('0x5')]},'nameField':{'type':Sequelize[_0xa1c0('0x5')]},'customField':{'type':Sequelize[_0xa1c0('0x7')],'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 88163ad..5d08764 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 _0x6f13=['papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','set','Content-Range','json','save','then','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x6f13,0x1d4));var _0x36f1=function(_0x466b51,_0x13e3ea){_0x466b51=_0x466b51-0x0;var _0x54138b=_0x6f13[_0x466b51];return _0x54138b;};'use strict';var pdf=require(_0x36f1('0x0'));var emlformat=require(_0x36f1('0x1'));var rimraf=require(_0x36f1('0x2'));var zipdir=require(_0x36f1('0x3'));var jsonpatch=require(_0x36f1('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x36f1('0x5'));var Mustache=require(_0x36f1('0x6'));var util=require(_0x36f1('0x7'));var path=require(_0x36f1('0x8'));var sox=require(_0x36f1('0x9'));var csv=require('to-csv');var ejs=require(_0x36f1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x36f1('0xb'));var crypto=require(_0x36f1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x36f1('0xd'));var toCsv=require(_0x36f1('0xe'));var querystring=require('querystring');var Papa=require(_0x36f1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x36f1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x36f1('0x11'));var config=require(_0x36f1('0x12'));var db=require(_0x36f1('0x13'))['db'];function respondWithStatusCode(_0x5569d3,_0x5e12f7){_0x5e12f7=_0x5e12f7||0xcc;return function(_0x52b6aa){if(_0x52b6aa){return _0x5569d3[_0x36f1('0x14')](_0x5e12f7);}return _0x5569d3[_0x36f1('0x15')](_0x5e12f7)[_0x36f1('0x16')]();};}function respondWithResult(_0x2fc800,_0x19bc2a){_0x19bc2a=_0x19bc2a||0xc8;return function(_0x2e14d0){if(_0x2e14d0){return _0x2fc800['status'](_0x19bc2a)['json'](_0x2e14d0);}};}function respondWithFilteredResult(_0x4ccc45,_0x3b8e99){return function(_0x2bc92a){if(_0x2bc92a){var _0x2cc632=_0x2bc92a[_0x36f1('0x17')],_0x220afa=_0x3b8e99['offset'],_0x4124f5=_0x3b8e99['offset']+_0x3b8e99['limit'],_0x211e43;if(_0x4124f5>=_0x2cc632){_0x4124f5=_0x2cc632;_0x211e43=0xc8;}else{_0x211e43=0xce;}_0x4ccc45[_0x36f1('0x15')](_0x211e43);return _0x4ccc45[_0x36f1('0x18')](_0x36f1('0x19'),_0x220afa+'-'+_0x4124f5+'/'+_0x2cc632)[_0x36f1('0x1a')](_0x2bc92a);}return null;};}function patchUpdates(_0x3fa616){return function(_0x5e9de3){try{jsonpatch['apply'](_0x5e9de3,_0x3fa616,!![]);}catch(_0x2bc889){return BPromise['reject'](_0x2bc889);}return _0x5e9de3[_0x36f1('0x1b')]();};}function saveUpdates(_0x517875,_0x5e01ba){return function(_0x205207){if(_0x205207){return _0x205207['update'](_0x517875)[_0x36f1('0x1c')](function(_0x5c7d77){return _0x5c7d77;});}return null;};}function removeEntity(_0x13a285,_0x10bee4){return function(_0x2fce1a){if(_0x2fce1a){return _0x2fce1a['destroy']()[_0x36f1('0x1c')](function(){_0x13a285[_0x36f1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ddd9,_0x320ae3){return function(_0x342f23){if(!_0x342f23){_0x47ddd9[_0x36f1('0x14')](0x194);}return _0x342f23;};}function handleError(_0x4e5578,_0x345833){_0x345833=_0x345833||0x1f4;return function(_0x235647){logger['error'](_0x235647[_0x36f1('0x1d')]);if(_0x235647[_0x36f1('0x1e')]){delete _0x235647[_0x36f1('0x1e')];}_0x4e5578[_0x36f1('0x15')](_0x345833)[_0x36f1('0x1f')](_0x235647);};}exports[_0x36f1('0x20')]=function(_0x56fa96,_0x396428){var _0x318908={},_0x205f45={},_0x22112a={'count':0x0,'rows':[]};var _0x3c69a7=_[_0x36f1('0x21')](db[_0x36f1('0x22')][_0x36f1('0x23')],function(_0x4ec36b){return{'name':_0x4ec36b[_0x36f1('0x24')],'type':_0x4ec36b[_0x36f1('0x25')][_0x36f1('0x26')]};});_0x205f45[_0x36f1('0x27')]=_[_0x36f1('0x21')](_0x3c69a7,_0x36f1('0x1e'));_0x205f45[_0x36f1('0x28')]=_[_0x36f1('0x29')](_0x56fa96[_0x36f1('0x28')]);_0x205f45[_0x36f1('0x2a')]=_[_0x36f1('0x2b')](_0x205f45[_0x36f1('0x27')],_0x205f45[_0x36f1('0x28')]);_0x318908[_0x36f1('0x2c')]=_['intersection'](_0x205f45[_0x36f1('0x27')],qs['fields'](_0x56fa96[_0x36f1('0x28')]['fields']));_0x318908[_0x36f1('0x2c')]=_0x318908['attributes'][_0x36f1('0x2d')]?_0x318908[_0x36f1('0x2c')]:_0x205f45[_0x36f1('0x27')];if(!_0x56fa96[_0x36f1('0x28')][_0x36f1('0x2e')](_0x36f1('0x2f'))){_0x318908['limit']=qs[_0x36f1('0x30')](_0x56fa96[_0x36f1('0x28')][_0x36f1('0x30')]);_0x318908[_0x36f1('0x31')]=qs['offset'](_0x56fa96[_0x36f1('0x28')][_0x36f1('0x31')]);}_0x318908[_0x36f1('0x32')]=qs[_0x36f1('0x33')](_0x56fa96[_0x36f1('0x28')][_0x36f1('0x33')]);_0x318908['where']=qs['filters'](_[_0x36f1('0x34')](_0x56fa96[_0x36f1('0x28')],_0x205f45[_0x36f1('0x2a')]),_0x3c69a7);if(_0x56fa96[_0x36f1('0x28')][_0x36f1('0x35')]){_0x318908[_0x36f1('0x36')]=_[_0x36f1('0x37')](_0x318908[_0x36f1('0x36')],{'$or':_[_0x36f1('0x21')](_0x3c69a7,function(_0x40e23f){if(_0x40e23f[_0x36f1('0x25')]!==_0x36f1('0x38')){var _0x4e0c98={};_0x4e0c98[_0x40e23f['name']]={'$like':'%'+_0x56fa96['query'][_0x36f1('0x35')]+'%'};return _0x4e0c98;}})});}_0x318908=_[_0x36f1('0x37')]({},_0x318908,_0x56fa96[_0x36f1('0x39')]);var _0x1cd05f={'where':_0x318908[_0x36f1('0x36')]};return db[_0x36f1('0x22')][_0x36f1('0x17')](_0x1cd05f)[_0x36f1('0x1c')](function(_0x14a37a){_0x22112a[_0x36f1('0x17')]=_0x14a37a;if(_0x56fa96[_0x36f1('0x28')][_0x36f1('0x3a')]){_0x318908[_0x36f1('0x3b')]=[{'all':!![]}];}return db['FreshsalesField'][_0x36f1('0x3c')](_0x318908);})['then'](function(_0x5d755c){_0x22112a[_0x36f1('0x3d')]=_0x5d755c;return _0x22112a;})[_0x36f1('0x1c')](respondWithFilteredResult(_0x396428,_0x318908))[_0x36f1('0x3e')](handleError(_0x396428,null));};exports[_0x36f1('0x3f')]=function(_0xcb4e24,_0x804b71){var _0x14a2a3={'raw':!![],'where':{'id':_0xcb4e24[_0x36f1('0x40')]['id']}},_0x443f8b={};_0x443f8b[_0x36f1('0x27')]=_[_0x36f1('0x29')](db[_0x36f1('0x22')][_0x36f1('0x23')]);_0x443f8b[_0x36f1('0x28')]=_[_0x36f1('0x29')](_0xcb4e24[_0x36f1('0x28')]);_0x443f8b[_0x36f1('0x2a')]=_[_0x36f1('0x2b')](_0x443f8b[_0x36f1('0x27')],_0x443f8b[_0x36f1('0x28')]);_0x14a2a3[_0x36f1('0x2c')]=_[_0x36f1('0x2b')](_0x443f8b['model'],qs['fields'](_0xcb4e24[_0x36f1('0x28')][_0x36f1('0x41')]));_0x14a2a3['attributes']=_0x14a2a3[_0x36f1('0x2c')][_0x36f1('0x2d')]?_0x14a2a3[_0x36f1('0x2c')]:_0x443f8b[_0x36f1('0x27')];if(_0xcb4e24[_0x36f1('0x28')][_0x36f1('0x3a')]){_0x14a2a3[_0x36f1('0x3b')]=[{'all':!![]}];}_0x14a2a3=_[_0x36f1('0x37')]({},_0x14a2a3,_0xcb4e24[_0x36f1('0x39')]);return db[_0x36f1('0x22')][_0x36f1('0x42')](_0x14a2a3)[_0x36f1('0x1c')](handleEntityNotFound(_0x804b71,null))['then'](respondWithResult(_0x804b71,null))['catch'](handleError(_0x804b71,null));};exports[_0x36f1('0x43')]=function(_0x753d31,_0x6bf3ea){return db[_0x36f1('0x22')][_0x36f1('0x43')](_0x753d31[_0x36f1('0x44')],{})[_0x36f1('0x1c')](respondWithResult(_0x6bf3ea,0xc9))['catch'](handleError(_0x6bf3ea,null));};exports['update']=function(_0x23106f,_0x76d7a0){if(_0x23106f['body']['id']){delete _0x23106f[_0x36f1('0x44')]['id'];}return db[_0x36f1('0x22')][_0x36f1('0x42')]({'where':{'id':_0x23106f['params']['id']}})[_0x36f1('0x1c')](handleEntityNotFound(_0x76d7a0,null))[_0x36f1('0x1c')](saveUpdates(_0x23106f[_0x36f1('0x44')],null))['then'](respondWithResult(_0x76d7a0,null))['catch'](handleError(_0x76d7a0,null));};exports['destroy']=function(_0x42fea5,_0x28bc09){return db[_0x36f1('0x22')][_0x36f1('0x42')]({'where':{'id':_0x42fea5['params']['id']}})['then'](handleEntityNotFound(_0x28bc09,null))[_0x36f1('0x1c')](removeEntity(_0x28bc09,null))['catch'](handleError(_0x28bc09,null));}; \ No newline at end of file +var _0xb27f=['bluebird','util','path','sox','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','update','body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4b2421,_0x47eab6){var _0x2be003=function(_0xf23bb3){while(--_0xf23bb3){_0x4b2421['push'](_0x4b2421['shift']());}};_0x2be003(++_0x47eab6);}(_0xb27f,0x158));var _0xfb27=function(_0x56536b,_0x3206b3){_0x56536b=_0x56536b-0x0;var _0x27066a=_0xb27f[_0x56536b];return _0x27066a;};'use strict';var pdf=require(_0xfb27('0x0'));var emlformat=require(_0xfb27('0x1'));var rimraf=require(_0xfb27('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb27('0x3'));var rp=require(_0xfb27('0x4'));var moment=require(_0xfb27('0x5'));var BPromise=require(_0xfb27('0x6'));var Mustache=require('mustache');var util=require(_0xfb27('0x7'));var path=require(_0xfb27('0x8'));var sox=require(_0xfb27('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb27('0xa'));var squel=require(_0xfb27('0xb'));var crypto=require('crypto');var jsforce=require(_0xfb27('0xc'));var deskjs=require(_0xfb27('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfb27('0xe'));var Redis=require(_0xfb27('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfb27('0x10'));var as=require(_0xfb27('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb27('0x12'));var utils=require(_0xfb27('0x13'));var config=require('../../config/environment');var db=require(_0xfb27('0x14'))['db'];function respondWithStatusCode(_0x5b74a8,_0x5a6b2c){_0x5a6b2c=_0x5a6b2c||0xcc;return function(_0x22964c){if(_0x22964c){return _0x5b74a8[_0xfb27('0x15')](_0x5a6b2c);}return _0x5b74a8['status'](_0x5a6b2c)[_0xfb27('0x16')]();};}function respondWithResult(_0x23dfc8,_0x5ca2cd){_0x5ca2cd=_0x5ca2cd||0xc8;return function(_0x10476f){if(_0x10476f){return _0x23dfc8[_0xfb27('0x17')](_0x5ca2cd)[_0xfb27('0x18')](_0x10476f);}};}function respondWithFilteredResult(_0x4507be,_0x3a3799){return function(_0x2f02ec){if(_0x2f02ec){var _0xb956fe=_0x2f02ec[_0xfb27('0x19')],_0x130117=_0x3a3799[_0xfb27('0x1a')],_0x1cefbc=_0x3a3799[_0xfb27('0x1a')]+_0x3a3799[_0xfb27('0x1b')],_0x16a18f;if(_0x1cefbc>=_0xb956fe){_0x1cefbc=_0xb956fe;_0x16a18f=0xc8;}else{_0x16a18f=0xce;}_0x4507be[_0xfb27('0x17')](_0x16a18f);return _0x4507be[_0xfb27('0x1c')](_0xfb27('0x1d'),_0x130117+'-'+_0x1cefbc+'/'+_0xb956fe)[_0xfb27('0x18')](_0x2f02ec);}return null;};}function patchUpdates(_0x39bbba){return function(_0x427629){try{jsonpatch[_0xfb27('0x1e')](_0x427629,_0x39bbba,!![]);}catch(_0x4f84f8){return BPromise[_0xfb27('0x1f')](_0x4f84f8);}return _0x427629['save']();};}function saveUpdates(_0x560b81,_0x5c4cd3){return function(_0x3c853e){if(_0x3c853e){return _0x3c853e['update'](_0x560b81)[_0xfb27('0x20')](function(_0x15dd22){return _0x15dd22;});}return null;};}function removeEntity(_0x48f4ca,_0x3635a8){return function(_0x1a8924){if(_0x1a8924){return _0x1a8924[_0xfb27('0x21')]()[_0xfb27('0x20')](function(){_0x48f4ca[_0xfb27('0x17')](0xcc)[_0xfb27('0x16')]();});}};}function handleEntityNotFound(_0x4280e9,_0x38990e){return function(_0x4343fe){if(!_0x4343fe){_0x4280e9[_0xfb27('0x15')](0x194);}return _0x4343fe;};}function handleError(_0x4df60d,_0x36b57c){_0x36b57c=_0x36b57c||0x1f4;return function(_0x37f02f){logger['error'](_0x37f02f[_0xfb27('0x22')]);if(_0x37f02f[_0xfb27('0x23')]){delete _0x37f02f[_0xfb27('0x23')];}_0x4df60d['status'](_0x36b57c)[_0xfb27('0x24')](_0x37f02f);};}exports['index']=function(_0x533d17,_0x4030f8){var _0x272df1={},_0x400536={},_0x322af6={'count':0x0,'rows':[]};var _0x41280e=_[_0xfb27('0x25')](db[_0xfb27('0x26')][_0xfb27('0x27')],function(_0x5f11f6){return{'name':_0x5f11f6[_0xfb27('0x28')],'type':_0x5f11f6[_0xfb27('0x29')][_0xfb27('0x2a')]};});_0x400536['model']=_['map'](_0x41280e,_0xfb27('0x23'));_0x400536[_0xfb27('0x2b')]=_[_0xfb27('0x2c')](_0x533d17[_0xfb27('0x2b')]);_0x400536[_0xfb27('0x2d')]=_[_0xfb27('0x2e')](_0x400536[_0xfb27('0x2f')],_0x400536['query']);_0x272df1[_0xfb27('0x30')]=_['intersection'](_0x400536['model'],qs[_0xfb27('0x31')](_0x533d17['query'][_0xfb27('0x31')]));_0x272df1['attributes']=_0x272df1[_0xfb27('0x30')]['length']?_0x272df1[_0xfb27('0x30')]:_0x400536[_0xfb27('0x2f')];if(!_0x533d17[_0xfb27('0x2b')][_0xfb27('0x32')](_0xfb27('0x33'))){_0x272df1[_0xfb27('0x1b')]=qs[_0xfb27('0x1b')](_0x533d17[_0xfb27('0x2b')]['limit']);_0x272df1[_0xfb27('0x1a')]=qs['offset'](_0x533d17['query'][_0xfb27('0x1a')]);}_0x272df1[_0xfb27('0x34')]=qs['sort'](_0x533d17[_0xfb27('0x2b')][_0xfb27('0x35')]);_0x272df1['where']=qs[_0xfb27('0x2d')](_['pick'](_0x533d17[_0xfb27('0x2b')],_0x400536[_0xfb27('0x2d')]),_0x41280e);if(_0x533d17[_0xfb27('0x2b')]['filter']){_0x272df1[_0xfb27('0x36')]=_['merge'](_0x272df1['where'],{'$or':_[_0xfb27('0x25')](_0x41280e,function(_0x5a3739){if(_0x5a3739['type']!==_0xfb27('0x37')){var _0x33dff7={};_0x33dff7[_0x5a3739[_0xfb27('0x23')]]={'$like':'%'+_0x533d17[_0xfb27('0x2b')]['filter']+'%'};return _0x33dff7;}})});}_0x272df1=_[_0xfb27('0x38')]({},_0x272df1,_0x533d17[_0xfb27('0x39')]);var _0x58ebe0={'where':_0x272df1['where']};return db[_0xfb27('0x26')][_0xfb27('0x19')](_0x58ebe0)['then'](function(_0x5d0c39){_0x322af6[_0xfb27('0x19')]=_0x5d0c39;if(_0x533d17[_0xfb27('0x2b')][_0xfb27('0x3a')]){_0x272df1['include']=[{'all':!![]}];}return db[_0xfb27('0x26')][_0xfb27('0x3b')](_0x272df1);})[_0xfb27('0x20')](function(_0x1f1699){_0x322af6[_0xfb27('0x3c')]=_0x1f1699;return _0x322af6;})[_0xfb27('0x20')](respondWithFilteredResult(_0x4030f8,_0x272df1))[_0xfb27('0x3d')](handleError(_0x4030f8,null));};exports[_0xfb27('0x3e')]=function(_0x15a52c,_0x18cf47){var _0x3d1693={'raw':!![],'where':{'id':_0x15a52c[_0xfb27('0x3f')]['id']}},_0x46aa77={};_0x46aa77[_0xfb27('0x2f')]=_[_0xfb27('0x2c')](db[_0xfb27('0x26')][_0xfb27('0x27')]);_0x46aa77[_0xfb27('0x2b')]=_[_0xfb27('0x2c')](_0x15a52c[_0xfb27('0x2b')]);_0x46aa77['filters']=_[_0xfb27('0x2e')](_0x46aa77[_0xfb27('0x2f')],_0x46aa77['query']);_0x3d1693['attributes']=_['intersection'](_0x46aa77[_0xfb27('0x2f')],qs['fields'](_0x15a52c[_0xfb27('0x2b')]['fields']));_0x3d1693[_0xfb27('0x30')]=_0x3d1693['attributes'][_0xfb27('0x40')]?_0x3d1693[_0xfb27('0x30')]:_0x46aa77['model'];if(_0x15a52c['query'][_0xfb27('0x3a')]){_0x3d1693[_0xfb27('0x41')]=[{'all':!![]}];}_0x3d1693=_['merge']({},_0x3d1693,_0x15a52c['options']);return db[_0xfb27('0x26')]['find'](_0x3d1693)[_0xfb27('0x20')](handleEntityNotFound(_0x18cf47,null))[_0xfb27('0x20')](respondWithResult(_0x18cf47,null))[_0xfb27('0x3d')](handleError(_0x18cf47,null));};exports[_0xfb27('0x42')]=function(_0x564d07,_0x3b5767){return db[_0xfb27('0x26')][_0xfb27('0x42')](_0x564d07['body'],{})[_0xfb27('0x20')](respondWithResult(_0x3b5767,0xc9))[_0xfb27('0x3d')](handleError(_0x3b5767,null));};exports[_0xfb27('0x43')]=function(_0x113b06,_0x1725da){if(_0x113b06[_0xfb27('0x44')]['id']){delete _0x113b06[_0xfb27('0x44')]['id'];}return db['FreshsalesField'][_0xfb27('0x45')]({'where':{'id':_0x113b06[_0xfb27('0x3f')]['id']}})[_0xfb27('0x20')](handleEntityNotFound(_0x1725da,null))[_0xfb27('0x20')](saveUpdates(_0x113b06['body'],null))['then'](respondWithResult(_0x1725da,null))['catch'](handleError(_0x1725da,null));};exports['destroy']=function(_0x30459b,_0x5238f8){return db['FreshsalesField'][_0xfb27('0x45')]({'where':{'id':_0x30459b[_0xfb27('0x3f')]['id']}})[_0xfb27('0x20')](handleEntityNotFound(_0x5238f8,null))[_0xfb27('0x20')](removeEntity(_0x5238f8,null))[_0xfb27('0x3d')](handleError(_0x5238f8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 3ddb960..c736f70 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 _0xe81b=['define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe81b,0x1f3));var _0xbe81=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xe81b[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xbe81('0x0'));var util=require(_0xbe81('0x1'));var logger=require(_0xbe81('0x2'))(_0xbe81('0x3'));var moment=require(_0xbe81('0x4'));var BPromise=require(_0xbe81('0x5'));var rp=require(_0xbe81('0x6'));var fs=require('fs');var path=require(_0xbe81('0x7'));var rimraf=require(_0xbe81('0x8'));var config=require(_0xbe81('0x9'));var attributes=require(_0xbe81('0xa'));module['exports']=function(_0xc346af,_0x5d2b54){return _0xc346af[_0xbe81('0xb')](_0xbe81('0xc'),attributes,{'tableName':_0xbe81('0xd'),'paranoid':![],'indexes':[{'name':_0xbe81('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3a1=['freshsales_unique_index','idField','FieldId','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshsalesField','int_freshsales_fields'];(function(_0x5bc453,_0x554c35){var _0x32966c=function(_0x291284){while(--_0x291284){_0x5bc453['push'](_0x5bc453['shift']());}};_0x32966c(++_0x554c35);}(_0xf3a1,0x114));var _0x1f3a=function(_0x4a4fb7,_0x565de7){_0x4a4fb7=_0x4a4fb7-0x0;var _0x5c9d10=_0xf3a1[_0x4a4fb7];return _0x5c9d10;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1f3a('0x0'));var moment=require(_0x1f3a('0x1'));var BPromise=require(_0x1f3a('0x2'));var rp=require(_0x1f3a('0x3'));var fs=require('fs');var path=require(_0x1f3a('0x4'));var rimraf=require(_0x1f3a('0x5'));var config=require(_0x1f3a('0x6'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x2c0964,_0x574d91){return _0x2c0964[_0x1f3a('0x7')](_0x1f3a('0x8'),attributes,{'tableName':_0x1f3a('0x9'),'paranoid':![],'indexes':[{'name':_0x1f3a('0xa'),'fields':[_0x1f3a('0xb'),_0x1f3a('0xc')],'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 ae43f78..1b125f4 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 _0x462f=['FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x151b28,_0x372ae4){var _0x261219=function(_0xa1f1d3){while(--_0xa1f1d3){_0x151b28['push'](_0x151b28['shift']());}};_0x261219(++_0x372ae4);}(_0x462f,0x1d7));var _0xf462=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x462f[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0xf462('0x0'));var util=require(_0xf462('0x1'));var moment=require(_0xf462('0x2'));var BPromise=require(_0xf462('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf462('0x4'));var db=require(_0xf462('0x5'))['db'];var utils=require(_0xf462('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf462('0x7'));var jayson=require(_0xf462('0x8'));var client=jayson[_0xf462('0x9')][_0xf462('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cc10f,_0x2344a8,_0x270440){return new BPromise(function(_0x2b0a6c,_0x413c11){return client[_0xf462('0xb')](_0x4cc10f,_0x270440)[_0xf462('0xc')](function(_0x81e5b7){logger['info'](_0xf462('0xd'),_0x2344a8,'request\x20sent');logger[_0xf462('0xe')](_0xf462('0xf'),_0x2344a8,_0xf462('0x10'),JSON[_0xf462('0x11')](_0x81e5b7));if(_0x81e5b7[_0xf462('0x12')]){if(_0x81e5b7[_0xf462('0x12')]['code']===0x1f4){logger['error'](_0xf462('0xd'),_0x2344a8,_0x81e5b7[_0xf462('0x12')][_0xf462('0x13')]);return _0x413c11(_0x81e5b7[_0xf462('0x12')][_0xf462('0x13')]);}logger[_0xf462('0x12')](_0xf462('0xd'),_0x2344a8,_0x81e5b7['error'][_0xf462('0x13')]);return _0x2b0a6c(_0x81e5b7[_0xf462('0x12')][_0xf462('0x13')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2344a8,_0xf462('0x10'));_0x2b0a6c(_0x81e5b7[_0xf462('0x14')]['message']);}})[_0xf462('0x15')](function(_0x3f1496){logger[_0xf462('0x12')](_0xf462('0xd'),_0x2344a8,_0x3f1496);_0x413c11(_0x3f1496);});});} \ No newline at end of file +var _0x94ed=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x192324,_0x369f3f){var _0x15ebdf=function(_0x19f208){while(--_0x19f208){_0x192324['push'](_0x192324['shift']());}};_0x15ebdf(++_0x369f3f);}(_0x94ed,0xbd));var _0xd94e=function(_0x17cdd6,_0x94ae6d){_0x17cdd6=_0x17cdd6-0x0;var _0x42970a=_0x94ed[_0x17cdd6];return _0x42970a;};'use strict';var _=require(_0xd94e('0x0'));var util=require(_0xd94e('0x1'));var moment=require(_0xd94e('0x2'));var BPromise=require(_0xd94e('0x3'));var rs=require(_0xd94e('0x4'));var fs=require('fs');var Redis=require(_0xd94e('0x5'));var db=require(_0xd94e('0x6'))['db'];var utils=require(_0xd94e('0x7'));var logger=require('../../config/logger')(_0xd94e('0x8'));var config=require(_0xd94e('0x9'));var jayson=require(_0xd94e('0xa'));var client=jayson[_0xd94e('0xb')][_0xd94e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dd48a,_0x12751f,_0x55350c){return new BPromise(function(_0x590bf0,_0x2165c4){return client[_0xd94e('0xd')](_0x5dd48a,_0x55350c)[_0xd94e('0xe')](function(_0x284739){logger[_0xd94e('0xf')](_0xd94e('0x10'),_0x12751f,'request\x20sent');logger['debug'](_0xd94e('0x11'),_0x12751f,_0xd94e('0x12'),JSON['stringify'](_0x284739));if(_0x284739[_0xd94e('0x13')]){if(_0x284739['error']['code']===0x1f4){logger[_0xd94e('0x13')](_0xd94e('0x10'),_0x12751f,_0x284739['error'][_0xd94e('0x14')]);return _0x2165c4(_0x284739[_0xd94e('0x13')]['message']);}logger[_0xd94e('0x13')](_0xd94e('0x10'),_0x12751f,_0x284739['error'][_0xd94e('0x14')]);return _0x590bf0(_0x284739[_0xd94e('0x13')]['message']);}else{logger[_0xd94e('0xf')](_0xd94e('0x10'),_0x12751f,_0xd94e('0x12'));_0x590bf0(_0x284739['result']['message']);}})['catch'](function(_0x9e0984){logger[_0xd94e('0x13')](_0xd94e('0x10'),_0x12751f,_0x9e0984);_0x2165c4(_0x9e0984);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 81be476..9f6572a 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 _0x69b4=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','update','delete','exports','multer'];(function(_0x2ae28c,_0x3fa73c){var _0x30ff86=function(_0x5b89cd){while(--_0x5b89cd){_0x2ae28c['push'](_0x2ae28c['shift']());}};_0x30ff86(++_0x3fa73c);}(_0x69b4,0x133));var _0x469b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x69b4[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x469b('0x0'));var util=require(_0x469b('0x1'));var path=require(_0x469b('0x2'));var timeout=require('connect-timeout');var express=require(_0x469b('0x3'));var router=express[_0x469b('0x4')]();var auth=require(_0x469b('0x5'));var interaction=require(_0x469b('0x6'));var config=require(_0x469b('0x7'));var controller=require(_0x469b('0x8'));router[_0x469b('0x9')]('/',auth[_0x469b('0xa')](),controller[_0x469b('0xb')]);router[_0x469b('0x9')](_0x469b('0xc'),auth['isAuthenticated'](),controller[_0x469b('0xd')]);router['get'](_0x469b('0xe'),auth[_0x469b('0xa')](),controller[_0x469b('0xf')]);router[_0x469b('0x9')]('/:id/fields',auth[_0x469b('0xa')](),controller[_0x469b('0x10')]);router[_0x469b('0x11')]('/',auth[_0x469b('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0x469b('0xa')](),controller[_0x469b('0x12')]);router['put'](_0x469b('0xc'),auth[_0x469b('0xa')](),controller[_0x469b('0x13')]);router[_0x469b('0x14')](_0x469b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x469b('0x15')]=router; \ No newline at end of file +var _0xa8fb=['get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller'];(function(_0x3aa3a3,_0x30b6a2){var _0x15e179=function(_0x13645e){while(--_0x13645e){_0x3aa3a3['push'](_0x3aa3a3['shift']());}};_0x15e179(++_0x30b6a2);}(_0xa8fb,0x172));var _0xba8f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa8fb[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xba8f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba8f('0x1'));var express=require(_0xba8f('0x2'));var router=express[_0xba8f('0x3')]();var auth=require(_0xba8f('0x4'));var interaction=require(_0xba8f('0x5'));var config=require(_0xba8f('0x6'));var controller=require(_0xba8f('0x7'));router[_0xba8f('0x8')]('/',auth[_0xba8f('0x9')](),controller[_0xba8f('0xa')]);router[_0xba8f('0x8')](_0xba8f('0xb'),auth[_0xba8f('0x9')](),controller['show']);router[_0xba8f('0x8')](_0xba8f('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xba8f('0x8')](_0xba8f('0xd'),auth[_0xba8f('0x9')](),controller[_0xba8f('0xe')]);router[_0xba8f('0xf')]('/',auth[_0xba8f('0x9')](),controller[_0xba8f('0x10')]);router[_0xba8f('0xf')](_0xba8f('0xc'),auth[_0xba8f('0x9')](),controller['addConfiguration']);router[_0xba8f('0x11')](_0xba8f('0xb'),auth[_0xba8f('0x9')](),controller['update']);router[_0xba8f('0x12')](_0xba8f('0xb'),auth['isAuthenticated'](),controller[_0xba8f('0x13')]);module[_0xba8f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 80e00ae..563f641 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x350dc0,_0x137137){var _0x39fb3f=function(_0x507f69){while(--_0x507f69){_0x350dc0['push'](_0x350dc0['shift']());}};_0x39fb3f(++_0x137137);}(_0xf494,0x1c6));var _0x4f49=function(_0x2aca18,_0x5ca170){_0x2aca18=_0x2aca18-0x0;var _0xbee03c=_0xf494[_0x2aca18];return _0xbee03c;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4f49('0x2')],'unique':_0x4f49('0x3')},'remoteUri':{'type':Sequelize[_0x4f49('0x2')]},'password':{'type':Sequelize[_0x4f49('0x2')]},'clientId':{'type':Sequelize[_0x4f49('0x2')]},'clientSecret':{'type':Sequelize[_0x4f49('0x2')]},'securityToken':{'type':Sequelize[_0x4f49('0x2')]},'serverUrl':{'type':Sequelize[_0x4f49('0x2')]},'type':{'type':Sequelize[_0x4f49('0x4')](_0x4f49('0x5'),_0x4f49('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4975=['username','integrationTab','sequelize','STRING'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0x4975,0x86));var _0x5497=function(_0x1be0d5,_0x33463d){_0x1be0d5=_0x1be0d5-0x0;var _0x1854a1=_0x4975[_0x1be0d5];return _0x1854a1;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'name':{'type':Sequelize[_0x5497('0x1')]},'description':{'type':Sequelize[_0x5497('0x1')]},'username':{'type':Sequelize[_0x5497('0x1')],'unique':_0x5497('0x2')},'remoteUri':{'type':Sequelize[_0x5497('0x1')]},'password':{'type':Sequelize[_0x5497('0x1')]},'clientId':{'type':Sequelize[_0x5497('0x1')]},'clientSecret':{'type':Sequelize[_0x5497('0x1')]},'securityToken':{'type':Sequelize[_0x5497('0x1')]},'serverUrl':{'type':Sequelize[_0x5497('0x1')]},'type':{'type':Sequelize['ENUM'](_0x5497('0x3'),'newTab'),'defaultValue':_0x5497('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index ea88374..302f1de 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 _0x5bd0=['where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','keys','intersection','create','body','find','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','Connection','login','concat','securityToken','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','Status','Type','Case','Origin','Reason','Priority','IsEscalated','SuppliedCompany','remove','custom','includes','length','picklistValues','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../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','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','attributes','fields','sort'];(function(_0x7d324f,_0x33cd55){var _0x4c54db=function(_0xf6a52c){while(--_0xf6a52c){_0x7d324f['push'](_0x7d324f['shift']());}};_0x4c54db(++_0x33cd55);}(_0x5bd0,0x1d7));var _0x05bd=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x5bd0[_0x48f7cf];return _0xc201c0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x05bd('0x0'));var jsonpatch=require(_0x05bd('0x1'));var rp=require('request-promise');var moment=require(_0x05bd('0x2'));var BPromise=require(_0x05bd('0x3'));var Mustache=require(_0x05bd('0x4'));var util=require(_0x05bd('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x05bd('0x6'));var ejs=require(_0x05bd('0x7'));var fs=require('fs');var _=require(_0x05bd('0x8'));var squel=require(_0x05bd('0x9'));var crypto=require(_0x05bd('0xa'));var jsforce=require(_0x05bd('0xb'));var deskjs=require(_0x05bd('0xc'));var toCsv=require(_0x05bd('0x6'));var querystring=require('querystring');var Papa=require(_0x05bd('0xd'));var Redis=require(_0x05bd('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x05bd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05bd('0x10'))(_0x05bd('0x11'));var utils=require(_0x05bd('0x12'));var config=require(_0x05bd('0x13'));var db=require(_0x05bd('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x05bd('0x15'));var client=jayson['client'][_0x05bd('0x16')]({'port':0x232a});function checkPasswordPattern(_0x2d57b6,_0x63f8f5,_0x3c2081){if(_0x3c2081){var _0x3911ac=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3911ac[_0x05bd('0x17')](_0x63f8f5)){return _0x2d57b6;}else{throw new db['Sequelize'][(_0x05bd('0x18'))](_0x05bd('0x19'));}}else{return _0x2d57b6;}}function respondWithRpcPromise(_0x76fa10,_0x13bce0,_0x2cae58,_0x3ed20a){return new BPromise(function(_0x174a57,_0xf39cc5){var _0x328bac=_0x3ed20a||client;return _0x328bac[_0x05bd('0x1a')](_0x76fa10,_0x2cae58)['then'](function(_0x15889c){logger['info'](_0x05bd('0x1b'),_0x13bce0,'request\x20sent');logger[_0x05bd('0x1c')](_0x05bd('0x1d'),_0x13bce0,_0x05bd('0x1e'),JSON[_0x05bd('0x1f')](_0x15889c));if(_0x15889c['error']){if(_0x15889c['error'][_0x05bd('0x20')]===0x1f4){logger[_0x05bd('0x21')](_0x05bd('0x1b'),_0x13bce0,_0x15889c[_0x05bd('0x21')][_0x05bd('0x22')]);return _0xf39cc5(_0x15889c['error'][_0x05bd('0x22')]);}logger[_0x05bd('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x13bce0,_0x15889c[_0x05bd('0x21')][_0x05bd('0x22')]);return _0x174a57(_0x15889c[_0x05bd('0x21')]['message']);}else{logger[_0x05bd('0x23')](_0x05bd('0x1b'),_0x13bce0,_0x05bd('0x1e'));_0x174a57(_0x15889c[_0x05bd('0x24')][_0x05bd('0x22')]);}})[_0x05bd('0x25')](function(_0x4bc2bd){logger[_0x05bd('0x21')](_0x05bd('0x1b'),_0x13bce0,_0x4bc2bd);_0xf39cc5(_0x4bc2bd);});});}function respondWithStatusCode(_0x7c1202,_0x2adeda){_0x2adeda=_0x2adeda||0xcc;return function(_0x12f988){if(_0x12f988){return _0x7c1202[_0x05bd('0x26')](_0x2adeda);}return _0x7c1202[_0x05bd('0x27')](_0x2adeda)[_0x05bd('0x28')]();};}function respondWithResult(_0x3039e2,_0x451501){_0x451501=_0x451501||0xc8;return function(_0x2bc00e){if(_0x2bc00e){return _0x3039e2[_0x05bd('0x27')](_0x451501)['json'](_0x2bc00e);}};}function respondWithFilteredResult(_0x85e032,_0x102ce5){return function(_0x2f349d){if(_0x2f349d){var _0x5e8559=_0x2f349d[_0x05bd('0x29')],_0x52f214=_0x102ce5['offset'],_0x28082f=_0x102ce5[_0x05bd('0x2a')]+_0x102ce5[_0x05bd('0x2b')],_0x32dc42;if(_0x28082f>=_0x5e8559){_0x28082f=_0x5e8559;_0x32dc42=0xc8;}else{_0x32dc42=0xce;}_0x85e032[_0x05bd('0x27')](_0x32dc42);return _0x85e032['set'](_0x05bd('0x2c'),_0x52f214+'-'+_0x28082f+'/'+_0x5e8559)['json'](_0x2f349d);}return null;};}function patchUpdates(_0xbf72ea){return function(_0x49dd8a){try{jsonpatch[_0x05bd('0x2d')](_0x49dd8a,_0xbf72ea,!![]);}catch(_0x5a2529){return BPromise[_0x05bd('0x2e')](_0x5a2529);}return _0x49dd8a[_0x05bd('0x2f')]();};}function saveUpdates(_0x40bfea,_0x2bda43){return function(_0x4b5a12){if(_0x4b5a12){return _0x4b5a12[_0x05bd('0x30')](_0x40bfea)[_0x05bd('0x31')](function(_0x1aeb00){return _0x1aeb00;});}return null;};}function removeEntity(_0x4733b8,_0x5288f9){return function(_0xe69a98){if(_0xe69a98){return _0xe69a98[_0x05bd('0x32')]()[_0x05bd('0x31')](function(){_0x4733b8[_0x05bd('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8fba,_0x5513ea){return function(_0x4c7c50){if(!_0x4c7c50){_0x5e8fba['sendStatus'](0x194);}return _0x4c7c50;};}function handleError(_0x2f793c,_0x5b50f2){_0x5b50f2=_0x5b50f2||0x1f4;return function(_0x190e47){logger['error'](_0x190e47[_0x05bd('0x33')]);if(_0x190e47['name']){delete _0x190e47[_0x05bd('0x34')];}_0x2f793c[_0x05bd('0x27')](_0x5b50f2)[_0x05bd('0x35')](_0x190e47);};}exports[_0x05bd('0x36')]=function(_0x28e3c5,_0x3d1020){var _0x6ee2da={},_0x49fdcc={},_0x55c47f={'count':0x0,'rows':[]};var _0x5ad08f=_[_0x05bd('0x37')](db[_0x05bd('0x38')][_0x05bd('0x39')],function(_0x1c714f){return{'name':_0x1c714f[_0x05bd('0x3a')],'type':_0x1c714f[_0x05bd('0x3b')]['key']};});_0x49fdcc[_0x05bd('0x3c')]=_[_0x05bd('0x37')](_0x5ad08f,_0x05bd('0x34'));_0x49fdcc[_0x05bd('0x3d')]=_['keys'](_0x28e3c5['query']);_0x49fdcc['filters']=_['intersection'](_0x49fdcc[_0x05bd('0x3c')],_0x49fdcc['query']);_0x6ee2da[_0x05bd('0x3e')]=_['intersection'](_0x49fdcc['model'],qs[_0x05bd('0x3f')](_0x28e3c5[_0x05bd('0x3d')]['fields']));_0x6ee2da['attributes']=_0x6ee2da[_0x05bd('0x3e')]['length']?_0x6ee2da['attributes']:_0x49fdcc[_0x05bd('0x3c')];if(!_0x28e3c5[_0x05bd('0x3d')]['hasOwnProperty']('nolimit')){_0x6ee2da['limit']=qs['limit'](_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x2b')]);_0x6ee2da[_0x05bd('0x2a')]=qs[_0x05bd('0x2a')](_0x28e3c5[_0x05bd('0x3d')]['offset']);}_0x6ee2da['order']=qs[_0x05bd('0x40')](_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x40')]);_0x6ee2da[_0x05bd('0x41')]=qs[_0x05bd('0x42')](_[_0x05bd('0x43')](_0x28e3c5[_0x05bd('0x3d')],_0x49fdcc[_0x05bd('0x42')]),_0x5ad08f);if(_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x44')]){_0x6ee2da['where']=_['merge'](_0x6ee2da[_0x05bd('0x41')],{'$or':_[_0x05bd('0x37')](_0x5ad08f,function(_0x3a03f6){if(_0x3a03f6['type']!==_0x05bd('0x45')){var _0x4308cb={};_0x4308cb[_0x3a03f6[_0x05bd('0x34')]]={'$like':'%'+_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x44')]+'%'};return _0x4308cb;}})});}_0x6ee2da=_[_0x05bd('0x46')]({},_0x6ee2da,_0x28e3c5[_0x05bd('0x47')]);var _0x1d4dc={'where':_0x6ee2da[_0x05bd('0x41')]};return db[_0x05bd('0x38')][_0x05bd('0x29')](_0x1d4dc)[_0x05bd('0x31')](function(_0x173f1f){_0x55c47f[_0x05bd('0x29')]=_0x173f1f;if(_0x28e3c5[_0x05bd('0x3d')][_0x05bd('0x48')]){_0x6ee2da[_0x05bd('0x49')]=[{'all':!![]}];}return db[_0x05bd('0x38')]['findAll'](_0x6ee2da);})[_0x05bd('0x31')](function(_0x4752ed){_0x55c47f['rows']=_0x4752ed;return _0x55c47f;})[_0x05bd('0x31')](respondWithFilteredResult(_0x3d1020,_0x6ee2da))[_0x05bd('0x25')](handleError(_0x3d1020,null));};exports[_0x05bd('0x4a')]=function(_0x3bec95,_0x135a53){var _0x4fde93={'raw':![],'where':{'id':_0x3bec95[_0x05bd('0x4b')]['id']}},_0xcd24aa={};_0xcd24aa[_0x05bd('0x3c')]=_[_0x05bd('0x4c')](db[_0x05bd('0x38')][_0x05bd('0x39')]);_0xcd24aa[_0x05bd('0x3d')]=_[_0x05bd('0x4c')](_0x3bec95[_0x05bd('0x3d')]);_0xcd24aa[_0x05bd('0x42')]=_[_0x05bd('0x4d')](_0xcd24aa[_0x05bd('0x3c')],_0xcd24aa[_0x05bd('0x3d')]);_0x4fde93['attributes']=_[_0x05bd('0x4d')](_0xcd24aa['model'],qs['fields'](_0x3bec95[_0x05bd('0x3d')][_0x05bd('0x3f')]));_0x4fde93[_0x05bd('0x3e')]=_0x4fde93[_0x05bd('0x3e')]['length']?_0x4fde93['attributes']:_0xcd24aa['model'];if(_0x3bec95[_0x05bd('0x3d')]['includeAll']){_0x4fde93[_0x05bd('0x49')]=[{'all':!![]}];}_0x4fde93=_['merge']({},_0x4fde93,_0x3bec95['options']);return db[_0x05bd('0x38')]['find'](_0x4fde93)['then'](handleEntityNotFound(_0x135a53,null))[_0x05bd('0x31')](respondWithResult(_0x135a53,null))[_0x05bd('0x25')](handleError(_0x135a53,null));};exports[_0x05bd('0x4e')]=function(_0x52c087,_0x17d3c7){return db[_0x05bd('0x38')][_0x05bd('0x4e')](_0x52c087['body'],{})['then'](respondWithResult(_0x17d3c7,0xc9))[_0x05bd('0x25')](handleError(_0x17d3c7,null));};exports[_0x05bd('0x30')]=function(_0x277d87,_0x1c9e87){if(_0x277d87[_0x05bd('0x4f')]['id']){delete _0x277d87[_0x05bd('0x4f')]['id'];}return db[_0x05bd('0x38')][_0x05bd('0x50')]({'where':{'id':_0x277d87[_0x05bd('0x4b')]['id']}})[_0x05bd('0x31')](handleEntityNotFound(_0x1c9e87,null))[_0x05bd('0x31')](saveUpdates(_0x277d87[_0x05bd('0x4f')],null))[_0x05bd('0x31')](respondWithResult(_0x1c9e87,null))[_0x05bd('0x25')](handleError(_0x1c9e87,null));};exports['destroy']=function(_0x464e82,_0x134aba){return db['SalesforceAccount']['find']({'where':{'id':_0x464e82[_0x05bd('0x4b')]['id']}})[_0x05bd('0x31')](handleEntityNotFound(_0x134aba,null))['then'](removeEntity(_0x134aba,null))['catch'](handleError(_0x134aba,null));};exports[_0x05bd('0x51')]=function(_0x4305b0,_0x286eb4,_0xb1a80){var _0xbe6d38={};var _0x5b70ad={};var _0x166d98;var _0x101321;return db['SalesforceAccount'][_0x05bd('0x52')]({'where':{'id':_0x4305b0[_0x05bd('0x4b')]['id']}})[_0x05bd('0x31')](handleEntityNotFound(_0x286eb4,null))['then'](function(_0x22008d){if(_0x22008d){_0x166d98=_0x22008d;_0x5b70ad[_0x05bd('0x3c')]=_[_0x05bd('0x4c')](db[_0x05bd('0x53')]['rawAttributes']);_0x5b70ad[_0x05bd('0x3d')]=_[_0x05bd('0x4c')](_0x4305b0[_0x05bd('0x3d')]);_0x5b70ad['filters']=_[_0x05bd('0x4d')](_0x5b70ad[_0x05bd('0x3c')],_0x5b70ad[_0x05bd('0x3d')]);_0xbe6d38[_0x05bd('0x3e')]=_[_0x05bd('0x4d')](_0x5b70ad['model'],qs[_0x05bd('0x3f')](_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x3f')]));_0xbe6d38['attributes']=_0xbe6d38[_0x05bd('0x3e')]['length']?_0xbe6d38[_0x05bd('0x3e')]:_0x5b70ad[_0x05bd('0x3c')];_0xbe6d38['order']=qs['sort'](_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x40')]);_0xbe6d38[_0x05bd('0x41')]=qs[_0x05bd('0x42')](_[_0x05bd('0x43')](_0x4305b0['query'],_0x5b70ad[_0x05bd('0x42')]));if(_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x44')]){_0xbe6d38[_0x05bd('0x41')]=_[_0x05bd('0x46')](_0xbe6d38[_0x05bd('0x41')],{'$or':_['map'](_0xbe6d38[_0x05bd('0x3e')],function(_0x57a61d){var _0x51adaf={};_0x51adaf[_0x57a61d]={'$like':'%'+_0x4305b0['query'][_0x05bd('0x44')]+'%'};return _0x51adaf;})});}_0xbe6d38=_[_0x05bd('0x46')]({},_0xbe6d38,_0x4305b0['options']);return _0x166d98[_0x05bd('0x51')](_0xbe6d38);}})[_0x05bd('0x31')](function(_0x165d30){if(_0x165d30){_0x101321=_0x165d30['length'];if(!_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x54')](_0x05bd('0x55'))){_0xbe6d38['limit']=qs[_0x05bd('0x2b')](_0x4305b0['query'][_0x05bd('0x2b')]);_0xbe6d38[_0x05bd('0x2a')]=qs[_0x05bd('0x2a')](_0x4305b0[_0x05bd('0x3d')][_0x05bd('0x2a')]);}return _0x166d98['getConfigurations'](_0xbe6d38);}})[_0x05bd('0x31')](function(_0x153a24){if(_0x153a24){return _0x153a24?{'count':_0x101321,'rows':_0x153a24}:null;}})[_0x05bd('0x31')](respondWithResult(_0x286eb4,null))[_0x05bd('0x25')](handleError(_0x286eb4,null));};exports[_0x05bd('0x56')]=function(_0x1560ae,_0x483028,_0x27c502){if(_0x1560ae[_0x05bd('0x4f')]['id']){delete _0x1560ae[_0x05bd('0x4f')]['id'];}return db[_0x05bd('0x38')]['findOne']({'where':{'id':_0x1560ae[_0x05bd('0x4b')]['id']}})[_0x05bd('0x31')](handleEntityNotFound(_0x483028,null))[_0x05bd('0x31')](function(_0x4dfdae){if(_0x4dfdae){_0x1560ae[_0x05bd('0x4f')]['AccountId']=_0x4dfdae['id'];_0x1560ae['body'][_0x05bd('0x57')]=integrations[_0x05bd('0x58')](_0x1560ae[_0x05bd('0x4f')]['channel'],_0x1560ae['body'][_0x05bd('0x3b')]);_0x1560ae[_0x05bd('0x4f')][_0x05bd('0x59')]=integrations[_0x05bd('0x5a')](_0x1560ae[_0x05bd('0x4f')][_0x05bd('0x5b')],_0x1560ae[_0x05bd('0x4f')][_0x05bd('0x3b')]);return db['SalesforceConfiguration'][_0x05bd('0x4e')](_0x1560ae[_0x05bd('0x4f')],{'include':[{'model':db[_0x05bd('0x5c')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x05bd('0x59')}]});}return null;})[_0x05bd('0x31')](respondWithResult(_0x483028,null))[_0x05bd('0x25')](handleError(_0x483028,null));};exports[_0x05bd('0x5d')]=function(_0x54e580,_0x32d5ac,_0x1be3b5){var _0x5bacc3;var _0x5269c0='';var _0x1cce3c=_0x05bd('0x5e');return db['SalesforceAccount'][_0x05bd('0x52')]({'where':{'id':_0x54e580['params']['id']},'attributes':['id',_0x05bd('0x5f'),_0x05bd('0x60'),_0x05bd('0x61'),_0x05bd('0x62'),_0x05bd('0x63'),'securityToken']})[_0x05bd('0x31')](handleEntityNotFound(_0x32d5ac,null))[_0x05bd('0x31')](function(_0x51c89c){if(_0x51c89c){_0x5269c0=_0x51c89c[_0x05bd('0x5f')];var _0x5aad37=_0x5269c0[_0x05bd('0x64')](-0x1);if(_0x5aad37==='/'){_0x5269c0=_0x5269c0[_0x05bd('0x65')](0x0,_0x5269c0['lastIndexOf'](_0x5aad37));}_0x5bacc3=new jsforce[(_0x05bd('0x66'))]({'oauth2':{'loginUrl':_0x5269c0,'clientId':_0x51c89c[_0x05bd('0x60')],'clientSecret':_0x51c89c[_0x05bd('0x61')]}});return _0x5bacc3[_0x05bd('0x67')](_0x51c89c[_0x05bd('0x62')],_0x51c89c[_0x05bd('0x63')][_0x05bd('0x68')](_0x51c89c[_0x05bd('0x69')]));}})[_0x05bd('0x31')](function(_0x12f9e1){if(_0x12f9e1){if(!_[_0x05bd('0x6a')](_0x54e580[_0x05bd('0x3d')][_0x05bd('0x6b')])){_0x1cce3c=_0x54e580[_0x05bd('0x3d')][_0x05bd('0x6b')];}return _0x5bacc3[_0x05bd('0x6c')](_0x1cce3c)['describe']();}})[_0x05bd('0x31')](function(_0x16334a){var _0x3a715b=[_0x05bd('0x6d'),_0x05bd('0x6e'),_0x05bd('0x6f'),'CallType','IsArchived','Priority',_0x05bd('0x70'),_0x05bd('0x71')];if(!_['isNil'](_0x54e580[_0x05bd('0x3d')]['ticketType'])&&_0x54e580['query'][_0x05bd('0x6b')]===_0x05bd('0x72')){_0x3a715b=[_0x05bd('0x71'),_0x05bd('0x73'),_0x05bd('0x74'),_0x05bd('0x70'),_0x05bd('0x75'),_0x05bd('0x76'),'SuppliedName',_0x05bd('0x77')];}if(_0x16334a){_[_0x05bd('0x78')](_0x16334a[_0x05bd('0x3f')],function(_0x2351d0){return _0x2351d0[_0x05bd('0x79')]===![]&&!_0x3a715b[_0x05bd('0x7a')](_0x2351d0['name']);});return{'count':_0x16334a[_0x05bd('0x3f')][_0x05bd('0x7b')],'rows':_['map'](_0x16334a[_0x05bd('0x3f')],function(_0x588ab4){return{'id':_0x588ab4['name'],'name':_0x588ab4['label'],'custom':_0x588ab4[_0x05bd('0x79')],'options':_0x588ab4[_0x05bd('0x7c')][_0x05bd('0x7b')]>0x0?_['map'](_0x588ab4[_0x05bd('0x7c')],function(_0x56d0c9){return{'name':_0x56d0c9['label'],'value':_0x56d0c9[_0x05bd('0x7d')]};}):_0x588ab4[_0x05bd('0x3b')]==_0x05bd('0x7e')?[{'name':_0x05bd('0x7f'),'value':_0x05bd('0x80')},{'name':_0x05bd('0x81'),'value':_0x05bd('0x82')}]:[]};})};}})[_0x05bd('0x31')](respondWithResult(_0x32d5ac,null))[_0x05bd('0x25')](function(_0x2cc476){var _0x38650d=_0x54e580[_0x05bd('0x3d')]['test']?0x1f4:_0x2cc476[_0x05bd('0x83')]||0x1f4;logger['error'](_0x05bd('0x84'),_0x05bd('0x5d'),_0x38650d,JSON['stringify'](_0x2cc476));delete _0x2cc476[_0x05bd('0x34')];if(_0x38650d===0x191){_0x38650d=0x190;}_0x32d5ac[_0x05bd('0x27')](_0x38650d)[_0x05bd('0x35')](_0x54e580[_0x05bd('0x3d')]['test']?{'message':_0x05bd('0x85'),'statusCode':_0x2cc476[_0x05bd('0x83')]}:_0x2cc476);});}; \ No newline at end of file +var _0xb3f8=['CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Priority','Status','Type','Case','Origin','IsEscalated','SuppliedName','remove','custom','includes','label','picklistValues','value','boolean','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','request\x20sent','error','SalesforceAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','apply','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','create','SalesforceAccount','body','update','destroy','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','password','isNil','ticketType','sobject','describe'];(function(_0x203311,_0x38b061){var _0x355de8=function(_0x411752){while(--_0x411752){_0x203311['push'](_0x203311['shift']());}};_0x355de8(++_0x38b061);}(_0xb3f8,0x1bd));var _0x8b3f=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0xb3f8[_0x4cee4b];return _0x4d891d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b3f('0x0'));var rimraf=require(_0x8b3f('0x1'));var zipdir=require(_0x8b3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b3f('0x3'));var moment=require(_0x8b3f('0x4'));var BPromise=require(_0x8b3f('0x5'));var Mustache=require(_0x8b3f('0x6'));var util=require(_0x8b3f('0x7'));var path=require(_0x8b3f('0x8'));var sox=require(_0x8b3f('0x9'));var csv=require('to-csv');var ejs=require(_0x8b3f('0xa'));var fs=require('fs');var _=require(_0x8b3f('0xb'));var squel=require(_0x8b3f('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b3f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8b3f('0xe'));var querystring=require(_0x8b3f('0xf'));var Papa=require(_0x8b3f('0x10'));var Redis=require(_0x8b3f('0x11'));var authService=require(_0x8b3f('0x12'));var qs=require(_0x8b3f('0x13'));var as=require(_0x8b3f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b3f('0x15'))('api');var utils=require(_0x8b3f('0x16'));var config=require(_0x8b3f('0x17'));var db=require(_0x8b3f('0x18'))['db'];var integrations=require(_0x8b3f('0x19'));var jayson=require(_0x8b3f('0x1a'));var client=jayson[_0x8b3f('0x1b')][_0x8b3f('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x5dd896,_0x2514e5,_0x52d592){if(_0x52d592){var _0x519f09=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x519f09[_0x8b3f('0x1d')](_0x2514e5)){return _0x5dd896;}else{throw new db[(_0x8b3f('0x1e'))][(_0x8b3f('0x1f'))](_0x8b3f('0x20'));}}else{return _0x5dd896;}}function respondWithRpcPromise(_0x493de9,_0x5951f9,_0x17d530,_0x435b25){return new BPromise(function(_0x62fc93,_0x1d2231){var _0x1370a7=_0x435b25||client;return _0x1370a7[_0x8b3f('0x21')](_0x493de9,_0x17d530)[_0x8b3f('0x22')](function(_0x40acda){logger[_0x8b3f('0x23')]('SalesforceAccount,\x20%s,\x20%s',_0x5951f9,'request\x20sent');logger[_0x8b3f('0x24')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5951f9,_0x8b3f('0x25'),JSON['stringify'](_0x40acda));if(_0x40acda[_0x8b3f('0x26')]){if(_0x40acda[_0x8b3f('0x26')]['code']===0x1f4){logger[_0x8b3f('0x26')](_0x8b3f('0x27'),_0x5951f9,_0x40acda[_0x8b3f('0x26')][_0x8b3f('0x28')]);return _0x1d2231(_0x40acda[_0x8b3f('0x26')]['message']);}logger[_0x8b3f('0x26')](_0x8b3f('0x27'),_0x5951f9,_0x40acda[_0x8b3f('0x26')][_0x8b3f('0x28')]);return _0x62fc93(_0x40acda[_0x8b3f('0x26')][_0x8b3f('0x28')]);}else{logger[_0x8b3f('0x23')](_0x8b3f('0x27'),_0x5951f9,'request\x20sent');_0x62fc93(_0x40acda[_0x8b3f('0x29')][_0x8b3f('0x28')]);}})[_0x8b3f('0x2a')](function(_0x2d19aa){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5951f9,_0x2d19aa);_0x1d2231(_0x2d19aa);});});}function respondWithStatusCode(_0x811bd7,_0x55b4ec){_0x55b4ec=_0x55b4ec||0xcc;return function(_0xe7bc3d){if(_0xe7bc3d){return _0x811bd7['sendStatus'](_0x55b4ec);}return _0x811bd7[_0x8b3f('0x2b')](_0x55b4ec)[_0x8b3f('0x2c')]();};}function respondWithResult(_0x5e74fc,_0x1f033f){_0x1f033f=_0x1f033f||0xc8;return function(_0x3e987c){if(_0x3e987c){return _0x5e74fc[_0x8b3f('0x2b')](_0x1f033f)[_0x8b3f('0x2d')](_0x3e987c);}};}function respondWithFilteredResult(_0xc550b7,_0x26b789){return function(_0x528fe2){if(_0x528fe2){var _0x386b3e=_0x528fe2[_0x8b3f('0x2e')],_0x491827=_0x26b789[_0x8b3f('0x2f')],_0x59752c=_0x26b789[_0x8b3f('0x2f')]+_0x26b789[_0x8b3f('0x30')],_0x543c1b;if(_0x59752c>=_0x386b3e){_0x59752c=_0x386b3e;_0x543c1b=0xc8;}else{_0x543c1b=0xce;}_0xc550b7[_0x8b3f('0x2b')](_0x543c1b);return _0xc550b7[_0x8b3f('0x31')]('Content-Range',_0x491827+'-'+_0x59752c+'/'+_0x386b3e)[_0x8b3f('0x2d')](_0x528fe2);}return null;};}function patchUpdates(_0x1c5033){return function(_0x1353fb){try{jsonpatch[_0x8b3f('0x32')](_0x1353fb,_0x1c5033,!![]);}catch(_0x3828cc){return BPromise['reject'](_0x3828cc);}return _0x1353fb['save']();};}function saveUpdates(_0x7c927a,_0x2f811b){return function(_0x2ba0d9){if(_0x2ba0d9){return _0x2ba0d9['update'](_0x7c927a)[_0x8b3f('0x22')](function(_0x31ff36){return _0x31ff36;});}return null;};}function removeEntity(_0x27ef3a,_0x235f39){return function(_0x211aba){if(_0x211aba){return _0x211aba['destroy']()['then'](function(){_0x27ef3a[_0x8b3f('0x2b')](0xcc)[_0x8b3f('0x2c')]();});}};}function handleEntityNotFound(_0x1e5648,_0x3728da){return function(_0x51e78b){if(!_0x51e78b){_0x1e5648[_0x8b3f('0x33')](0x194);}return _0x51e78b;};}function handleError(_0xc99176,_0x4646b2){_0x4646b2=_0x4646b2||0x1f4;return function(_0x3f0797){logger[_0x8b3f('0x26')](_0x3f0797[_0x8b3f('0x34')]);if(_0x3f0797[_0x8b3f('0x35')]){delete _0x3f0797[_0x8b3f('0x35')];}_0xc99176[_0x8b3f('0x2b')](_0x4646b2)[_0x8b3f('0x36')](_0x3f0797);};}exports[_0x8b3f('0x37')]=function(_0x1654c2,_0x34e39e){var _0x32ff26={},_0x52e1af={},_0x5acde2={'count':0x0,'rows':[]};var _0x2181cd=_[_0x8b3f('0x38')](db['SalesforceAccount'][_0x8b3f('0x39')],function(_0x2e456b){return{'name':_0x2e456b[_0x8b3f('0x3a')],'type':_0x2e456b['type'][_0x8b3f('0x3b')]};});_0x52e1af[_0x8b3f('0x3c')]=_['map'](_0x2181cd,_0x8b3f('0x35'));_0x52e1af[_0x8b3f('0x3d')]=_['keys'](_0x1654c2[_0x8b3f('0x3d')]);_0x52e1af[_0x8b3f('0x3e')]=_[_0x8b3f('0x3f')](_0x52e1af[_0x8b3f('0x3c')],_0x52e1af[_0x8b3f('0x3d')]);_0x32ff26[_0x8b3f('0x40')]=_['intersection'](_0x52e1af[_0x8b3f('0x3c')],qs[_0x8b3f('0x41')](_0x1654c2[_0x8b3f('0x3d')]['fields']));_0x32ff26[_0x8b3f('0x40')]=_0x32ff26[_0x8b3f('0x40')][_0x8b3f('0x42')]?_0x32ff26[_0x8b3f('0x40')]:_0x52e1af[_0x8b3f('0x3c')];if(!_0x1654c2['query'][_0x8b3f('0x43')](_0x8b3f('0x44'))){_0x32ff26['limit']=qs[_0x8b3f('0x30')](_0x1654c2[_0x8b3f('0x3d')][_0x8b3f('0x30')]);_0x32ff26['offset']=qs[_0x8b3f('0x2f')](_0x1654c2['query']['offset']);}_0x32ff26[_0x8b3f('0x45')]=qs[_0x8b3f('0x46')](_0x1654c2[_0x8b3f('0x3d')][_0x8b3f('0x46')]);_0x32ff26[_0x8b3f('0x47')]=qs[_0x8b3f('0x3e')](_[_0x8b3f('0x48')](_0x1654c2['query'],_0x52e1af[_0x8b3f('0x3e')]),_0x2181cd);if(_0x1654c2['query'][_0x8b3f('0x49')]){_0x32ff26['where']=_[_0x8b3f('0x4a')](_0x32ff26[_0x8b3f('0x47')],{'$or':_[_0x8b3f('0x38')](_0x2181cd,function(_0x6f51fe){if(_0x6f51fe[_0x8b3f('0x4b')]!==_0x8b3f('0x4c')){var _0x47f00d={};_0x47f00d[_0x6f51fe[_0x8b3f('0x35')]]={'$like':'%'+_0x1654c2[_0x8b3f('0x3d')][_0x8b3f('0x49')]+'%'};return _0x47f00d;}})});}_0x32ff26=_[_0x8b3f('0x4a')]({},_0x32ff26,_0x1654c2[_0x8b3f('0x4d')]);var _0x597dd5={'where':_0x32ff26['where']};return db['SalesforceAccount']['count'](_0x597dd5)['then'](function(_0x4c08c7){_0x5acde2['count']=_0x4c08c7;if(_0x1654c2['query'][_0x8b3f('0x4e')]){_0x32ff26[_0x8b3f('0x4f')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x32ff26);})[_0x8b3f('0x22')](function(_0x39456d){_0x5acde2[_0x8b3f('0x50')]=_0x39456d;return _0x5acde2;})[_0x8b3f('0x22')](respondWithFilteredResult(_0x34e39e,_0x32ff26))[_0x8b3f('0x2a')](handleError(_0x34e39e,null));};exports[_0x8b3f('0x51')]=function(_0x2b8446,_0x2a7873){var _0x7aad02={'raw':![],'where':{'id':_0x2b8446[_0x8b3f('0x52')]['id']}},_0x38289a={};_0x38289a[_0x8b3f('0x3c')]=_[_0x8b3f('0x53')](db['SalesforceAccount'][_0x8b3f('0x39')]);_0x38289a[_0x8b3f('0x3d')]=_[_0x8b3f('0x53')](_0x2b8446['query']);_0x38289a[_0x8b3f('0x3e')]=_['intersection'](_0x38289a[_0x8b3f('0x3c')],_0x38289a['query']);_0x7aad02[_0x8b3f('0x40')]=_[_0x8b3f('0x3f')](_0x38289a[_0x8b3f('0x3c')],qs[_0x8b3f('0x41')](_0x2b8446[_0x8b3f('0x3d')][_0x8b3f('0x41')]));_0x7aad02['attributes']=_0x7aad02['attributes'][_0x8b3f('0x42')]?_0x7aad02[_0x8b3f('0x40')]:_0x38289a['model'];if(_0x2b8446['query']['includeAll']){_0x7aad02[_0x8b3f('0x4f')]=[{'all':!![]}];}_0x7aad02=_['merge']({},_0x7aad02,_0x2b8446[_0x8b3f('0x4d')]);return db['SalesforceAccount'][_0x8b3f('0x54')](_0x7aad02)[_0x8b3f('0x22')](handleEntityNotFound(_0x2a7873,null))[_0x8b3f('0x22')](respondWithResult(_0x2a7873,null))[_0x8b3f('0x2a')](handleError(_0x2a7873,null));};exports[_0x8b3f('0x55')]=function(_0x22ef56,_0x1f105a){return db[_0x8b3f('0x56')][_0x8b3f('0x55')](_0x22ef56[_0x8b3f('0x57')],{})[_0x8b3f('0x22')](respondWithResult(_0x1f105a,0xc9))[_0x8b3f('0x2a')](handleError(_0x1f105a,null));};exports[_0x8b3f('0x58')]=function(_0x330057,_0x566374){if(_0x330057[_0x8b3f('0x57')]['id']){delete _0x330057[_0x8b3f('0x57')]['id'];}return db[_0x8b3f('0x56')][_0x8b3f('0x54')]({'where':{'id':_0x330057[_0x8b3f('0x52')]['id']}})[_0x8b3f('0x22')](handleEntityNotFound(_0x566374,null))['then'](saveUpdates(_0x330057['body'],null))['then'](respondWithResult(_0x566374,null))['catch'](handleError(_0x566374,null));};exports[_0x8b3f('0x59')]=function(_0x27a83e,_0x4e0c75){return db[_0x8b3f('0x56')][_0x8b3f('0x54')]({'where':{'id':_0x27a83e[_0x8b3f('0x52')]['id']}})[_0x8b3f('0x22')](handleEntityNotFound(_0x4e0c75,null))['then'](removeEntity(_0x4e0c75,null))[_0x8b3f('0x2a')](handleError(_0x4e0c75,null));};exports[_0x8b3f('0x5a')]=function(_0x2cf5e1,_0x16924e,_0x5ba8bf){var _0x2c9f2d={};var _0xc015d3={};var _0x398fcb;var _0x3997f6;return db[_0x8b3f('0x56')][_0x8b3f('0x5b')]({'where':{'id':_0x2cf5e1[_0x8b3f('0x52')]['id']}})[_0x8b3f('0x22')](handleEntityNotFound(_0x16924e,null))[_0x8b3f('0x22')](function(_0x4d4482){if(_0x4d4482){_0x398fcb=_0x4d4482;_0xc015d3['model']=_[_0x8b3f('0x53')](db['SalesforceConfiguration'][_0x8b3f('0x39')]);_0xc015d3[_0x8b3f('0x3d')]=_[_0x8b3f('0x53')](_0x2cf5e1[_0x8b3f('0x3d')]);_0xc015d3[_0x8b3f('0x3e')]=_['intersection'](_0xc015d3['model'],_0xc015d3[_0x8b3f('0x3d')]);_0x2c9f2d['attributes']=_[_0x8b3f('0x3f')](_0xc015d3[_0x8b3f('0x3c')],qs[_0x8b3f('0x41')](_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x41')]));_0x2c9f2d[_0x8b3f('0x40')]=_0x2c9f2d[_0x8b3f('0x40')]['length']?_0x2c9f2d[_0x8b3f('0x40')]:_0xc015d3[_0x8b3f('0x3c')];_0x2c9f2d[_0x8b3f('0x45')]=qs['sort'](_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x46')]);_0x2c9f2d['where']=qs[_0x8b3f('0x3e')](_[_0x8b3f('0x48')](_0x2cf5e1[_0x8b3f('0x3d')],_0xc015d3[_0x8b3f('0x3e')]));if(_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x49')]){_0x2c9f2d[_0x8b3f('0x47')]=_['merge'](_0x2c9f2d[_0x8b3f('0x47')],{'$or':_[_0x8b3f('0x38')](_0x2c9f2d[_0x8b3f('0x40')],function(_0x45c3e0){var _0x951a74={};_0x951a74[_0x45c3e0]={'$like':'%'+_0x2cf5e1['query'][_0x8b3f('0x49')]+'%'};return _0x951a74;})});}_0x2c9f2d=_[_0x8b3f('0x4a')]({},_0x2c9f2d,_0x2cf5e1[_0x8b3f('0x4d')]);return _0x398fcb[_0x8b3f('0x5a')](_0x2c9f2d);}})['then'](function(_0x5d19a3){if(_0x5d19a3){_0x3997f6=_0x5d19a3[_0x8b3f('0x42')];if(!_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x43')](_0x8b3f('0x44'))){_0x2c9f2d[_0x8b3f('0x30')]=qs['limit'](_0x2cf5e1[_0x8b3f('0x3d')][_0x8b3f('0x30')]);_0x2c9f2d[_0x8b3f('0x2f')]=qs[_0x8b3f('0x2f')](_0x2cf5e1['query'][_0x8b3f('0x2f')]);}return _0x398fcb[_0x8b3f('0x5a')](_0x2c9f2d);}})[_0x8b3f('0x22')](function(_0x47ac5c){if(_0x47ac5c){return _0x47ac5c?{'count':_0x3997f6,'rows':_0x47ac5c}:null;}})[_0x8b3f('0x22')](respondWithResult(_0x16924e,null))[_0x8b3f('0x2a')](handleError(_0x16924e,null));};exports['addConfiguration']=function(_0xe6f2d3,_0x3ec76e,_0x5711f4){if(_0xe6f2d3[_0x8b3f('0x57')]['id']){delete _0xe6f2d3[_0x8b3f('0x57')]['id'];}return db['SalesforceAccount'][_0x8b3f('0x5b')]({'where':{'id':_0xe6f2d3[_0x8b3f('0x52')]['id']}})[_0x8b3f('0x22')](handleEntityNotFound(_0x3ec76e,null))[_0x8b3f('0x22')](function(_0x1f1087){if(_0x1f1087){_0xe6f2d3[_0x8b3f('0x57')][_0x8b3f('0x5c')]=_0x1f1087['id'];_0xe6f2d3['body'][_0x8b3f('0x5d')]=integrations[_0x8b3f('0x5e')](_0xe6f2d3['body'][_0x8b3f('0x5f')],_0xe6f2d3[_0x8b3f('0x57')][_0x8b3f('0x4b')]);_0xe6f2d3[_0x8b3f('0x57')]['Descriptions']=integrations['getDescriptions'](_0xe6f2d3[_0x8b3f('0x57')][_0x8b3f('0x5f')],_0xe6f2d3[_0x8b3f('0x57')][_0x8b3f('0x4b')]);return db['SalesforceConfiguration'][_0x8b3f('0x55')](_0xe6f2d3['body'],{'include':[{'model':db[_0x8b3f('0x60')],'as':_0x8b3f('0x5d')},{'model':db[_0x8b3f('0x60')],'as':_0x8b3f('0x61')}]});}return null;})[_0x8b3f('0x22')](respondWithResult(_0x3ec76e,null))[_0x8b3f('0x2a')](handleError(_0x3ec76e,null));};exports[_0x8b3f('0x62')]=function(_0x1ecb03,_0x4e34b6,_0x27a8c0){var _0x1cfa34;var _0x308548='';var _0x1fdc7e=_0x8b3f('0x63');return db[_0x8b3f('0x56')][_0x8b3f('0x5b')]({'where':{'id':_0x1ecb03[_0x8b3f('0x52')]['id']},'attributes':['id',_0x8b3f('0x64'),'clientId',_0x8b3f('0x65'),_0x8b3f('0x66'),'password',_0x8b3f('0x67')]})[_0x8b3f('0x22')](handleEntityNotFound(_0x4e34b6,null))[_0x8b3f('0x22')](function(_0x5830e6){if(_0x5830e6){_0x308548=_0x5830e6[_0x8b3f('0x64')];var _0x4655bd=_0x308548[_0x8b3f('0x68')](-0x1);if(_0x4655bd==='/'){_0x308548=_0x308548[_0x8b3f('0x69')](0x0,_0x308548[_0x8b3f('0x6a')](_0x4655bd));}_0x1cfa34=new jsforce[(_0x8b3f('0x6b'))]({'oauth2':{'loginUrl':_0x308548,'clientId':_0x5830e6[_0x8b3f('0x6c')],'clientSecret':_0x5830e6['clientSecret']}});return _0x1cfa34[_0x8b3f('0x6d')](_0x5830e6['username'],_0x5830e6[_0x8b3f('0x6e')]['concat'](_0x5830e6[_0x8b3f('0x67')]));}})[_0x8b3f('0x22')](function(_0xa2df4c){if(_0xa2df4c){if(!_[_0x8b3f('0x6f')](_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x70')])){_0x1fdc7e=_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x70')];}return _0x1cfa34[_0x8b3f('0x71')](_0x1fdc7e)[_0x8b3f('0x72')]();}})['then'](function(_0xda9785){var _0x1ca99e=[_0x8b3f('0x73'),_0x8b3f('0x74'),_0x8b3f('0x75'),'CallType',_0x8b3f('0x76'),_0x8b3f('0x77'),_0x8b3f('0x78'),_0x8b3f('0x79')];if(!_[_0x8b3f('0x6f')](_0x1ecb03['query'][_0x8b3f('0x70')])&&_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x70')]===_0x8b3f('0x7a')){_0x1ca99e=['Type',_0x8b3f('0x7b'),'Reason',_0x8b3f('0x78'),'Priority',_0x8b3f('0x7c'),_0x8b3f('0x7d'),'SuppliedCompany'];}if(_0xda9785){_[_0x8b3f('0x7e')](_0xda9785[_0x8b3f('0x41')],function(_0x388c5e){return _0x388c5e[_0x8b3f('0x7f')]===![]&&!_0x1ca99e[_0x8b3f('0x80')](_0x388c5e[_0x8b3f('0x35')]);});return{'count':_0xda9785['fields'][_0x8b3f('0x42')],'rows':_[_0x8b3f('0x38')](_0xda9785['fields'],function(_0x30e531){return{'id':_0x30e531[_0x8b3f('0x35')],'name':_0x30e531[_0x8b3f('0x81')],'custom':_0x30e531[_0x8b3f('0x7f')],'options':_0x30e531['picklistValues'][_0x8b3f('0x42')]>0x0?_['map'](_0x30e531[_0x8b3f('0x82')],function(_0x5eaec7){return{'name':_0x5eaec7['label'],'value':_0x5eaec7[_0x8b3f('0x83')]};}):_0x30e531['type']==_0x8b3f('0x84')?[{'name':_0x8b3f('0x85'),'value':_0x8b3f('0x86')},{'name':'False','value':_0x8b3f('0x87')}]:[]};})};}})[_0x8b3f('0x22')](respondWithResult(_0x4e34b6,null))[_0x8b3f('0x2a')](function(_0x29e92b){var _0x70739c=_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x1d')]?0x1f4:_0x29e92b[_0x8b3f('0x88')]||0x1f4;logger[_0x8b3f('0x26')](_0x8b3f('0x89'),_0x8b3f('0x62'),_0x70739c,JSON[_0x8b3f('0x8a')](_0x29e92b));delete _0x29e92b[_0x8b3f('0x35')];if(_0x70739c===0x191){_0x70739c=0x190;}_0x4e34b6['status'](_0x70739c)[_0x8b3f('0x36')](_0x1ecb03[_0x8b3f('0x3d')][_0x8b3f('0x1d')]?{'message':_0x8b3f('0x8b'),'statusCode':_0x29e92b[_0x8b3f('0x88')]}:_0x29e92b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c5bdafa..13506bf 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 _0xbac3=['./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x141dd0,_0x13f015){var _0x41aa2a=function(_0x51213d){while(--_0x51213d){_0x141dd0['push'](_0x141dd0['shift']());}};_0x41aa2a(++_0x13f015);}(_0xbac3,0x1f0));var _0x3bac=function(_0x3303fb,_0x1266dd){_0x3303fb=_0x3303fb-0x0;var _0x71a686=_0xbac3[_0x3303fb];return _0x71a686;};'use strict';var _=require(_0x3bac('0x0'));var util=require(_0x3bac('0x1'));var logger=require('../../config/logger')(_0x3bac('0x2'));var moment=require(_0x3bac('0x3'));var BPromise=require('bluebird');var rp=require(_0x3bac('0x4'));var fs=require('fs');var path=require(_0x3bac('0x5'));var rimraf=require(_0x3bac('0x6'));var config=require(_0x3bac('0x7'));var attributes=require(_0x3bac('0x8'));var integrations=require(_0x3bac('0x9'));module[_0x3bac('0xa')]=function(_0x2b1868,_0x2e10de){return _0x2b1868[_0x3bac('0xb')](_0x3bac('0xc'),attributes,{'tableName':_0x3bac('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1712=['rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1f025f,_0x520449){var _0x21e427=function(_0x8e24a8){while(--_0x8e24a8){_0x1f025f['push'](_0x1f025f['shift']());}};_0x21e427(++_0x520449);}(_0x1712,0xc9));var _0x2171=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x1712[_0x53ad58];return _0x554b03;};'use strict';var _=require(_0x2171('0x0'));var util=require(_0x2171('0x1'));var logger=require(_0x2171('0x2'))('api');var moment=require(_0x2171('0x3'));var BPromise=require(_0x2171('0x4'));var rp=require(_0x2171('0x5'));var fs=require('fs');var path=require(_0x2171('0x6'));var rimraf=require(_0x2171('0x7'));var config=require('../../config/environment');var attributes=require(_0x2171('0x8'));var integrations=require(_0x2171('0x9'));module[_0x2171('0xa')]=function(_0x59dc40,_0x559c78){return _0x59dc40['define'](_0x2171('0xb'),attributes,{'tableName':_0x2171('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 1d80439..42d26c4 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 _0x579c=['error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','include','map','model','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x177b82,_0x57d19e){var _0x54163a=function(_0x48c09a){while(--_0x48c09a){_0x177b82['push'](_0x177b82['shift']());}};_0x54163a(++_0x57d19e);}(_0x579c,0xda));var _0xc579=function(_0xce5f43,_0x2820b8){_0xce5f43=_0xce5f43-0x0;var _0x4d07ed=_0x579c[_0xce5f43];return _0x4d07ed;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});}exports[_0xc579('0x18')]=function(_0x33d341){var _0xbbbe3e=this;return new Promise(function(_0x3da8a1,_0xa41248){return db[_0xc579('0x19')]['findAll']({'raw':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1b')]||null:null,'attributes':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'limit':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')]['limit']||null:null,'include':_0x33d341[_0xc579('0x1a')]?_0x33d341[_0xc579('0x1a')][_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x33d341[_0xc579('0x1a')]['include'],function(_0x3634f2){return{'model':db[_0x3634f2[_0xc579('0x1f')]],'as':_0x3634f2['as'],'attributes':_0x3634f2[_0xc579('0x1c')],'include':_0x3634f2['include']?_[_0xc579('0x1e')](_0x3634f2['include'],function(_0x4610c2){return{'model':db[_0x4610c2[_0xc579('0x1f')]],'as':_0x4610c2['as'],'attributes':_0x4610c2[_0xc579('0x1c')],'include':_0x4610c2['include']?_[_0xc579('0x1e')](_0x4610c2['include'],function(_0x532b33){return{'model':db[_0x532b33['model']],'as':_0x532b33['as'],'attributes':_0x532b33[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0xfdbb73){logger[_0xc579('0xe')](_0xc579('0x18'),_0x33d341);logger[_0xc579('0x10')](_0xc579('0x18'),_0x33d341,JSON['stringify'](_0xfdbb73));_0x3da8a1(_0xfdbb73);})['catch'](function(_0x4a5f6){logger['error'](_0xc579('0x18'),_0x4a5f6[_0xc579('0x16')],_0x33d341);_0xa41248(_0xbbbe3e[_0xc579('0x14')](0x1f4,_0x4a5f6[_0xc579('0x16')]));});});};exports[_0xc579('0x20')]=function(_0x156bf5){var _0x45e6a3=this;return new Promise(function(_0x133d08,_0x49b48f){return db[_0xc579('0x19')][_0xc579('0x21')]({'raw':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x156bf5['options']?_0x156bf5[_0xc579('0x1a')]['where']||null:null,'attributes':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')][_0xc579('0x1c')]||null:null,'include':_0x156bf5[_0xc579('0x1a')]?_0x156bf5[_0xc579('0x1a')]['include']?_[_0xc579('0x1e')](_0x156bf5['options'][_0xc579('0x1d')],function(_0x473000){return{'model':db[_0x473000['model']],'as':_0x473000['as'],'attributes':_0x473000[_0xc579('0x1c')],'include':_0x473000[_0xc579('0x1d')]?_['map'](_0x473000['include'],function(_0x37bce9){return{'model':db[_0x37bce9[_0xc579('0x1f')]],'as':_0x37bce9['as'],'attributes':_0x37bce9['attributes'],'include':_0x37bce9[_0xc579('0x1d')]?_[_0xc579('0x1e')](_0x37bce9['include'],function(_0x32589a){return{'model':db[_0x32589a['model']],'as':_0x32589a['as'],'attributes':_0x32589a[_0xc579('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc579('0xd')](function(_0x5c6f38){logger[_0xc579('0xe')](_0xc579('0x20'),_0x156bf5);logger[_0xc579('0x10')](_0xc579('0x20'),_0x156bf5,JSON[_0xc579('0x13')](_0x5c6f38));_0x133d08(_0x5c6f38);})[_0xc579('0x17')](function(_0x59ae89){logger[_0xc579('0x14')](_0xc579('0x20'),_0x59ae89['message'],_0x156bf5);_0x49b48f(_0x45e6a3[_0xc579('0x14')](0x1f4,_0x59ae89[_0xc579('0x16')]));});});}; \ No newline at end of file +var _0x7a2c=['attributes','SalesforceAccount','find','then','ShowSalesforceAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','findAll','options','limit','include','map','model'];(function(_0x11a962,_0x3cc338){var _0x55d423=function(_0xf4b236){while(--_0xf4b236){_0x11a962['push'](_0x11a962['shift']());}};_0x55d423(++_0x3cc338);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x14eda4,_0x2209eb){_0x14eda4=_0x14eda4-0x0;var _0x177773=_0x7a2c[_0x14eda4];return _0x177773;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var moment=require(_0xc7a2('0x1'));var BPromise=require(_0xc7a2('0x2'));var rs=require(_0xc7a2('0x3'));var fs=require('fs');var Redis=require(_0xc7a2('0x4'));var db=require(_0xc7a2('0x5'))['db'];var utils=require(_0xc7a2('0x6'));var logger=require(_0xc7a2('0x7'))(_0xc7a2('0x8'));var config=require('../../config/environment');var jayson=require(_0xc7a2('0x9'));var client=jayson[_0xc7a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481430,_0x48773c,_0x1dd150){return new BPromise(function(_0x3de428,_0x3f0573){return client[_0xc7a2('0xb')](_0x481430,_0x1dd150)['then'](function(_0x38518b){logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,'request\x20sent');logger[_0xc7a2('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x48773c,_0xc7a2('0xf'),JSON[_0xc7a2('0x10')](_0x38518b));if(_0x38518b[_0xc7a2('0x11')]){if(_0x38518b['error'][_0xc7a2('0x12')]===0x1f4){logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b['error'][_0xc7a2('0x13')]);return _0x3f0573(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);return _0x3de428(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}else{logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,_0xc7a2('0xf'));_0x3de428(_0x38518b[_0xc7a2('0x14')][_0xc7a2('0x13')]);}})[_0xc7a2('0x15')](function(_0x506396){logger[_0xc7a2('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x48773c,_0x506396);_0x3f0573(_0x506396);});});}exports[_0xc7a2('0x16')]=function(_0x302d54){var _0x293343=this;return new Promise(function(_0x3da373,_0x4e50fb){return db['SalesforceAccount'][_0xc7a2('0x17')]({'raw':_0x302d54[_0xc7a2('0x18')]?_0x302d54['options']['raw']===undefined?!![]:![]:!![],'where':_0x302d54['options']?_0x302d54[_0xc7a2('0x18')]['where']||null:null,'attributes':_0x302d54[_0xc7a2('0x18')]?_0x302d54[_0xc7a2('0x18')]['attributes']||null:null,'limit':_0x302d54[_0xc7a2('0x18')]?_0x302d54[_0xc7a2('0x18')][_0xc7a2('0x19')]||null:null,'include':_0x302d54[_0xc7a2('0x18')]?_0x302d54[_0xc7a2('0x18')][_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x302d54['options']['include'],function(_0x194ca4){return{'model':db[_0x194ca4[_0xc7a2('0x1c')]],'as':_0x194ca4['as'],'attributes':_0x194ca4['attributes'],'include':_0x194ca4[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x194ca4[_0xc7a2('0x1a')],function(_0x2c2281){return{'model':db[_0x2c2281[_0xc7a2('0x1c')]],'as':_0x2c2281['as'],'attributes':_0x2c2281[_0xc7a2('0x1d')],'include':_0x2c2281[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x2c2281['include'],function(_0x35a6e0){return{'model':db[_0x35a6e0['model']],'as':_0x35a6e0['as'],'attributes':_0x35a6e0[_0xc7a2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20404b){logger[_0xc7a2('0xc')](_0xc7a2('0x16'),_0x302d54);logger[_0xc7a2('0xe')]('GetSalesforceAccount',_0x302d54,JSON['stringify'](_0x20404b));_0x3da373(_0x20404b);})[_0xc7a2('0x15')](function(_0x2f3097){logger[_0xc7a2('0x11')](_0xc7a2('0x16'),_0x2f3097[_0xc7a2('0x13')],_0x302d54);_0x4e50fb(_0x293343[_0xc7a2('0x11')](0x1f4,_0x2f3097[_0xc7a2('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x8cb6bf){var _0x926b6c=this;return new Promise(function(_0x496386,_0xe8c061){return db[_0xc7a2('0x1e')][_0xc7a2('0x1f')]({'raw':_0x8cb6bf['options']?_0x8cb6bf[_0xc7a2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x8cb6bf[_0xc7a2('0x18')]?_0x8cb6bf['options']['where']||null:null,'attributes':_0x8cb6bf[_0xc7a2('0x18')]?_0x8cb6bf['options']['attributes']||null:null,'include':_0x8cb6bf[_0xc7a2('0x18')]?_0x8cb6bf['options'][_0xc7a2('0x1a')]?_['map'](_0x8cb6bf[_0xc7a2('0x18')][_0xc7a2('0x1a')],function(_0x13ee53){return{'model':db[_0x13ee53[_0xc7a2('0x1c')]],'as':_0x13ee53['as'],'attributes':_0x13ee53[_0xc7a2('0x1d')],'include':_0x13ee53[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x13ee53[_0xc7a2('0x1a')],function(_0x29771b){return{'model':db[_0x29771b[_0xc7a2('0x1c')]],'as':_0x29771b['as'],'attributes':_0x29771b['attributes'],'include':_0x29771b[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x29771b['include'],function(_0x31a8d2){return{'model':db[_0x31a8d2[_0xc7a2('0x1c')]],'as':_0x31a8d2['as'],'attributes':_0x31a8d2[_0xc7a2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc7a2('0x20')](function(_0x178c3e){logger[_0xc7a2('0xc')](_0xc7a2('0x21'),_0x8cb6bf);logger['debug'](_0xc7a2('0x21'),_0x8cb6bf,JSON[_0xc7a2('0x10')](_0x178c3e));_0x496386(_0x178c3e);})[_0xc7a2('0x15')](function(_0x49ad1f){logger[_0xc7a2('0x11')](_0xc7a2('0x21'),_0x49ad1f['message'],_0x8cb6bf);_0xe8c061(_0x926b6c[_0xc7a2('0x11')](0x1f4,_0x49ad1f[_0xc7a2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 086bffd..7ede1e8 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 _0xd81f=['/:id/descriptions','getDescriptions','create','put','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xd81f,0xaf));var _0xfd81=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xd81f[_0x1bc013];return _0x55df36;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfd81('0x0'));var express=require(_0xfd81('0x1'));var router=express[_0xfd81('0x2')]();var auth=require(_0xfd81('0x3'));var interaction=require(_0xfd81('0x4'));var config=require(_0xfd81('0x5'));var controller=require(_0xfd81('0x6'));router[_0xfd81('0x7')]('/',auth[_0xfd81('0x8')](),controller[_0xfd81('0x9')]);router[_0xfd81('0x7')](_0xfd81('0xa'),auth[_0xfd81('0x8')](),controller[_0xfd81('0xb')]);router[_0xfd81('0x7')](_0xfd81('0xc'),auth[_0xfd81('0x8')](),controller[_0xfd81('0xd')]);router[_0xfd81('0x7')]('/:id/subjects',auth[_0xfd81('0x8')](),controller['getSubjects']);router[_0xfd81('0x7')](_0xfd81('0xe'),auth[_0xfd81('0x8')](),controller[_0xfd81('0xf')]);router['post']('/',auth[_0xfd81('0x8')](),controller[_0xfd81('0x10')]);router[_0xfd81('0x11')](_0xfd81('0xa'),auth[_0xfd81('0x8')](),controller[_0xfd81('0x12')]);router['delete']('/:id',auth[_0xfd81('0x8')](),controller[_0xfd81('0x13')]);module[_0xfd81('0x14')]=router; \ No newline at end of file +var _0x5268=['/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects'];(function(_0x36579e,_0x475f2b){var _0x38b983=function(_0x4958aa){while(--_0x4958aa){_0x36579e['push'](_0x36579e['shift']());}};_0x38b983(++_0x475f2b);}(_0x5268,0x1a6));var _0x8526=function(_0xcb8b0f,_0x51adf9){_0xcb8b0f=_0xcb8b0f-0x0;var _0x24c5be=_0x5268[_0xcb8b0f];return _0x24c5be;};'use strict';var multer=require('multer');var util=require(_0x8526('0x0'));var path=require(_0x8526('0x1'));var timeout=require(_0x8526('0x2'));var express=require(_0x8526('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8526('0x4'));var config=require(_0x8526('0x5'));var controller=require(_0x8526('0x6'));router[_0x8526('0x7')]('/',auth['isAuthenticated'](),controller[_0x8526('0x8')]);router['get'](_0x8526('0x9'),auth[_0x8526('0xa')](),controller[_0x8526('0xb')]);router['get'](_0x8526('0xc'),auth[_0x8526('0xa')](),controller[_0x8526('0xd')]);router[_0x8526('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8526('0xe')]);router[_0x8526('0x7')](_0x8526('0xf'),auth[_0x8526('0xa')](),controller[_0x8526('0x10')]);router[_0x8526('0x11')]('/',auth[_0x8526('0xa')](),controller[_0x8526('0x12')]);router[_0x8526('0x13')](_0x8526('0x9'),auth[_0x8526('0xa')](),controller[_0x8526('0x14')]);router['delete'](_0x8526('0x9'),auth['isAuthenticated'](),controller[_0x8526('0x15')]);module[_0x8526('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1997c40..3cca14f 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 _0x9623=['Task','Case','contact_lead','contact','nothing','lead','sequelize','exports','STRING','ENUM'];(function(_0x5b065e,_0x51d0d2){var _0x1afd26=function(_0x33b3ee){while(--_0x33b3ee){_0x5b065e['push'](_0x5b065e['shift']());}};_0x1afd26(++_0x51d0d2);}(_0x9623,0x1a0));var _0x3962=function(_0x180e7b,_0x599496){_0x180e7b=_0x180e7b-0x0;var _0x328f56=_0x9623[_0x180e7b];return _0x328f56;};'use strict';var Sequelize=require(_0x3962('0x0'));module[_0x3962('0x1')]={'name':{'type':Sequelize[_0x3962('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x3962('0x3')](_0x3962('0x4'),_0x3962('0x5')),'defaultValue':_0x3962('0x4')},'moduleSearch':{'type':Sequelize[_0x3962('0x3')](_0x3962('0x6'),_0x3962('0x7'),'lead'),'defaultValue':_0x3962('0x6')},'moduleCreate':{'type':Sequelize[_0x3962('0x3')](_0x3962('0x8'),'contact',_0x3962('0x9')),'defaultValue':_0x3962('0x9')}}; \ No newline at end of file +var _0xd4df=['contact_lead','contact','lead','ENUM','nothing','exports','STRING','Case'];(function(_0x3eee56,_0x176daf){var _0x506bcd=function(_0x3cfe8b){while(--_0x3cfe8b){_0x3eee56['push'](_0x3eee56['shift']());}};_0x506bcd(++_0x176daf);}(_0xd4df,0x6d));var _0xfd4d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4df[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xfd4d('0x0')]={'name':{'type':Sequelize[_0xfd4d('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('Task',_0xfd4d('0x2')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0xfd4d('0x3'),_0xfd4d('0x4'),_0xfd4d('0x5')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xfd4d('0x6')](_0xfd4d('0x7'),_0xfd4d('0x4'),_0xfd4d('0x5')),'defaultValue':_0xfd4d('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index a4a5d9d..d4d62ee 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 _0xe7b3=['fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','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','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','limit','set','apply','reject','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','destroy','getFields','SalesforceField','pick','getSubjects','findOne','getDescriptions','html-pdf','zip-dir'];(function(_0x5df7fd,_0xc0eb56){var _0x2e8026=function(_0x2dd913){while(--_0x2dd913){_0x5df7fd['push'](_0x5df7fd['shift']());}};_0x2e8026(++_0xc0eb56);}(_0xe7b3,0x1b6));var _0x3e7b=function(_0x2b60a6,_0x1fcbd7){_0x2b60a6=_0x2b60a6-0x0;var _0x17e0db=_0xe7b3[_0x2b60a6];return _0x17e0db;};'use strict';var pdf=require(_0x3e7b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3e7b('0x1'));var jsonpatch=require(_0x3e7b('0x2'));var rp=require(_0x3e7b('0x3'));var moment=require(_0x3e7b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3e7b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3e7b('0x6'));var csv=require(_0x3e7b('0x7'));var ejs=require(_0x3e7b('0x8'));var fs=require('fs');var _=require(_0x3e7b('0x9'));var squel=require('squel');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(_0x3e7b('0xa'));var Redis=require(_0x3e7b('0xb'));var authService=require(_0x3e7b('0xc'));var qs=require(_0x3e7b('0xd'));var as=require(_0x3e7b('0xe'));var hardwareService=require(_0x3e7b('0xf'));var logger=require(_0x3e7b('0x10'))('api');var utils=require(_0x3e7b('0x11'));var config=require(_0x3e7b('0x12'));var db=require(_0x3e7b('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3e7b('0x14')][_0x3e7b('0x15')]({'port':0x232a});function checkPasswordPattern(_0x125890,_0x53a7fc,_0x5710d2){if(_0x5710d2){var _0x27b2b9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27b2b9['test'](_0x53a7fc)){return _0x125890;}else{throw new db[(_0x3e7b('0x16'))]['ValidationError'](_0x3e7b('0x17'));}}else{return _0x125890;}}function respondWithRpcPromise(_0xbfe5a4,_0x5a107f,_0x4fd138,_0xcd6996){return new BPromise(function(_0xed1941,_0x5c6968){var _0x185e81=_0xcd6996||client;return _0x185e81[_0x3e7b('0x18')](_0xbfe5a4,_0x4fd138)[_0x3e7b('0x19')](function(_0x20ed2e){logger['info'](_0x3e7b('0x1a'),_0x5a107f,'request\x20sent');logger[_0x3e7b('0x1b')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5a107f,_0x3e7b('0x1c'),JSON['stringify'](_0x20ed2e));if(_0x20ed2e[_0x3e7b('0x1d')]){if(_0x20ed2e[_0x3e7b('0x1d')][_0x3e7b('0x1e')]===0x1f4){logger[_0x3e7b('0x1d')](_0x3e7b('0x1a'),_0x5a107f,_0x20ed2e[_0x3e7b('0x1d')][_0x3e7b('0x1f')]);return _0x5c6968(_0x20ed2e['error']['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5a107f,_0x20ed2e[_0x3e7b('0x1d')][_0x3e7b('0x1f')]);return _0xed1941(_0x20ed2e[_0x3e7b('0x1d')]['message']);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x5a107f,_0x3e7b('0x1c'));_0xed1941(_0x20ed2e[_0x3e7b('0x20')][_0x3e7b('0x1f')]);}})['catch'](function(_0x52799f){logger[_0x3e7b('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5a107f,_0x52799f);_0x5c6968(_0x52799f);});});}function respondWithStatusCode(_0x180925,_0x196d08){_0x196d08=_0x196d08||0xcc;return function(_0xe8f889){if(_0xe8f889){return _0x180925[_0x3e7b('0x21')](_0x196d08);}return _0x180925[_0x3e7b('0x22')](_0x196d08)[_0x3e7b('0x23')]();};}function respondWithResult(_0x2652bc,_0x1a6f1b){_0x1a6f1b=_0x1a6f1b||0xc8;return function(_0x3f2427){if(_0x3f2427){return _0x2652bc[_0x3e7b('0x22')](_0x1a6f1b)[_0x3e7b('0x24')](_0x3f2427);}};}function respondWithFilteredResult(_0x26179d,_0x571011){return function(_0x5736af){if(_0x5736af){var _0x4c94b2=_0x5736af['count'],_0x5afba1=_0x571011[_0x3e7b('0x25')],_0x1ad126=_0x571011[_0x3e7b('0x25')]+_0x571011[_0x3e7b('0x26')],_0x3cdc2f;if(_0x1ad126>=_0x4c94b2){_0x1ad126=_0x4c94b2;_0x3cdc2f=0xc8;}else{_0x3cdc2f=0xce;}_0x26179d[_0x3e7b('0x22')](_0x3cdc2f);return _0x26179d[_0x3e7b('0x27')]('Content-Range',_0x5afba1+'-'+_0x1ad126+'/'+_0x4c94b2)[_0x3e7b('0x24')](_0x5736af);}return null;};}function patchUpdates(_0x2d40b4){return function(_0xfbe8b9){try{jsonpatch[_0x3e7b('0x28')](_0xfbe8b9,_0x2d40b4,!![]);}catch(_0x41fa76){return BPromise[_0x3e7b('0x29')](_0x41fa76);}return _0xfbe8b9['save']();};}function saveUpdates(_0x32db89,_0x518ba5){return function(_0x1a5763){if(_0x1a5763){return _0x1a5763['update'](_0x32db89)[_0x3e7b('0x19')](function(_0x221e3c){return _0x221e3c;});}return null;};}function removeEntity(_0xbd247d,_0x33a2be){return function(_0x5c2974){if(_0x5c2974){return _0x5c2974['destroy']()['then'](function(){_0xbd247d[_0x3e7b('0x22')](0xcc)[_0x3e7b('0x23')]();});}};}function handleEntityNotFound(_0x541002,_0x5be292){return function(_0x663b42){if(!_0x663b42){_0x541002[_0x3e7b('0x21')](0x194);}return _0x663b42;};}function handleError(_0x3de949,_0x320eaa){_0x320eaa=_0x320eaa||0x1f4;return function(_0x461147){logger['error'](_0x461147[_0x3e7b('0x2a')]);if(_0x461147[_0x3e7b('0x2b')]){delete _0x461147[_0x3e7b('0x2b')];}_0x3de949[_0x3e7b('0x22')](_0x320eaa)[_0x3e7b('0x2c')](_0x461147);};}exports[_0x3e7b('0x2d')]=function(_0x5443d6,_0x24c9fc){var _0x1bbefd={},_0x159f30={},_0x5352b5={'count':0x0,'rows':[]};var _0x70ac2=_[_0x3e7b('0x2e')](db[_0x3e7b('0x2f')][_0x3e7b('0x30')],function(_0x8a4e7c){return{'name':_0x8a4e7c[_0x3e7b('0x31')],'type':_0x8a4e7c[_0x3e7b('0x32')][_0x3e7b('0x33')]};});_0x159f30[_0x3e7b('0x34')]=_[_0x3e7b('0x2e')](_0x70ac2,'name');_0x159f30[_0x3e7b('0x35')]=_[_0x3e7b('0x36')](_0x5443d6[_0x3e7b('0x35')]);_0x159f30['filters']=_[_0x3e7b('0x37')](_0x159f30[_0x3e7b('0x34')],_0x159f30[_0x3e7b('0x35')]);_0x1bbefd[_0x3e7b('0x38')]=_[_0x3e7b('0x37')](_0x159f30[_0x3e7b('0x34')],qs[_0x3e7b('0x39')](_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x39')]));_0x1bbefd[_0x3e7b('0x38')]=_0x1bbefd[_0x3e7b('0x38')]['length']?_0x1bbefd[_0x3e7b('0x38')]:_0x159f30[_0x3e7b('0x34')];if(!_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x3a')](_0x3e7b('0x3b'))){_0x1bbefd[_0x3e7b('0x26')]=qs[_0x3e7b('0x26')](_0x5443d6[_0x3e7b('0x35')]['limit']);_0x1bbefd[_0x3e7b('0x25')]=qs[_0x3e7b('0x25')](_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x25')]);}_0x1bbefd[_0x3e7b('0x3c')]=qs[_0x3e7b('0x3d')](_0x5443d6['query'][_0x3e7b('0x3d')]);_0x1bbefd[_0x3e7b('0x3e')]=qs[_0x3e7b('0x3f')](_['pick'](_0x5443d6[_0x3e7b('0x35')],_0x159f30[_0x3e7b('0x3f')]),_0x70ac2);if(_0x5443d6[_0x3e7b('0x35')]['filter']){_0x1bbefd[_0x3e7b('0x3e')]=_[_0x3e7b('0x40')](_0x1bbefd[_0x3e7b('0x3e')],{'$or':_['map'](_0x70ac2,function(_0x1609a1){if(_0x1609a1[_0x3e7b('0x32')]!==_0x3e7b('0x41')){var _0xd94a6c={};_0xd94a6c[_0x1609a1['name']]={'$like':'%'+_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x42')]+'%'};return _0xd94a6c;}})});}_0x1bbefd=_[_0x3e7b('0x40')]({},_0x1bbefd,_0x5443d6[_0x3e7b('0x43')]);var _0x48d03b={'where':_0x1bbefd[_0x3e7b('0x3e')]};return db['SalesforceConfiguration'][_0x3e7b('0x44')](_0x48d03b)['then'](function(_0x57ad07){_0x5352b5[_0x3e7b('0x44')]=_0x57ad07;if(_0x5443d6[_0x3e7b('0x35')][_0x3e7b('0x45')]){_0x1bbefd[_0x3e7b('0x46')]=[{'all':!![]}];}return db[_0x3e7b('0x2f')][_0x3e7b('0x47')](_0x1bbefd);})[_0x3e7b('0x19')](function(_0x187945){_0x5352b5[_0x3e7b('0x48')]=_0x187945;return _0x5352b5;})[_0x3e7b('0x19')](respondWithFilteredResult(_0x24c9fc,_0x1bbefd))[_0x3e7b('0x49')](handleError(_0x24c9fc,null));};exports[_0x3e7b('0x4a')]=function(_0x34bf3f,_0x3eba4e){var _0x5ca6c5={'raw':![],'where':{'id':_0x34bf3f[_0x3e7b('0x4b')]['id']}},_0x157694={};_0x157694['model']=_['keys'](db[_0x3e7b('0x2f')]['rawAttributes']);_0x157694[_0x3e7b('0x35')]=_[_0x3e7b('0x36')](_0x34bf3f[_0x3e7b('0x35')]);_0x157694[_0x3e7b('0x3f')]=_['intersection'](_0x157694[_0x3e7b('0x34')],_0x157694[_0x3e7b('0x35')]);_0x5ca6c5['attributes']=_[_0x3e7b('0x37')](_0x157694['model'],qs[_0x3e7b('0x39')](_0x34bf3f[_0x3e7b('0x35')][_0x3e7b('0x39')]));_0x5ca6c5[_0x3e7b('0x38')]=_0x5ca6c5[_0x3e7b('0x38')][_0x3e7b('0x4c')]?_0x5ca6c5[_0x3e7b('0x38')]:_0x157694[_0x3e7b('0x34')];if(_0x34bf3f[_0x3e7b('0x35')][_0x3e7b('0x45')]){_0x5ca6c5[_0x3e7b('0x46')]=[{'all':!![]}];}_0x5ca6c5=_[_0x3e7b('0x40')]({},_0x5ca6c5,_0x34bf3f['options']);return db[_0x3e7b('0x2f')][_0x3e7b('0x4d')](_0x5ca6c5)[_0x3e7b('0x19')](handleEntityNotFound(_0x3eba4e,null))['then'](respondWithResult(_0x3eba4e,null))[_0x3e7b('0x49')](handleError(_0x3eba4e,null));};exports[_0x3e7b('0x4e')]=function(_0x8208d9,_0x48a8c0){return db[_0x3e7b('0x2f')]['create'](_0x8208d9[_0x3e7b('0x4f')],{})[_0x3e7b('0x19')](respondWithResult(_0x48a8c0,0xc9))[_0x3e7b('0x49')](handleError(_0x48a8c0,null));};exports[_0x3e7b('0x50')]=function(_0x507ff6,_0x395f6b){if(_0x507ff6[_0x3e7b('0x4f')]['id']){delete _0x507ff6[_0x3e7b('0x4f')]['id'];}return db[_0x3e7b('0x2f')][_0x3e7b('0x4d')]({'where':{'id':_0x507ff6['params']['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0x395f6b,null))[_0x3e7b('0x19')](saveUpdates(_0x507ff6[_0x3e7b('0x4f')],null))[_0x3e7b('0x19')](respondWithResult(_0x395f6b,null))['catch'](handleError(_0x395f6b,null));};exports[_0x3e7b('0x51')]=function(_0x332adc,_0x2d3d63){return db['SalesforceConfiguration'][_0x3e7b('0x4d')]({'where':{'id':_0x332adc[_0x3e7b('0x4b')]['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0x2d3d63,null))['then'](removeEntity(_0x2d3d63,null))[_0x3e7b('0x49')](handleError(_0x2d3d63,null));};exports[_0x3e7b('0x52')]=function(_0xa8e825,_0x2f63ba,_0x334c43){var _0x5db42d={};var _0x3f9516={};var _0x3eaf56;var _0x57e84e;return db[_0x3e7b('0x2f')]['findOne']({'where':{'id':_0xa8e825[_0x3e7b('0x4b')]['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0x2f63ba,null))[_0x3e7b('0x19')](function(_0x35a1c7){if(_0x35a1c7){_0x3eaf56=_0x35a1c7;_0x3f9516['model']=_[_0x3e7b('0x36')](db[_0x3e7b('0x53')]['rawAttributes']);_0x3f9516[_0x3e7b('0x35')]=_[_0x3e7b('0x36')](_0xa8e825[_0x3e7b('0x35')]);_0x3f9516[_0x3e7b('0x3f')]=_[_0x3e7b('0x37')](_0x3f9516['model'],_0x3f9516[_0x3e7b('0x35')]);_0x5db42d['attributes']=_[_0x3e7b('0x37')](_0x3f9516[_0x3e7b('0x34')],qs[_0x3e7b('0x39')](_0xa8e825[_0x3e7b('0x35')]['fields']));_0x5db42d[_0x3e7b('0x38')]=_0x5db42d[_0x3e7b('0x38')]['length']?_0x5db42d[_0x3e7b('0x38')]:_0x3f9516[_0x3e7b('0x34')];_0x5db42d[_0x3e7b('0x3c')]=qs[_0x3e7b('0x3d')](_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x3d')]);_0x5db42d[_0x3e7b('0x3e')]=qs[_0x3e7b('0x3f')](_[_0x3e7b('0x54')](_0xa8e825['query'],_0x3f9516[_0x3e7b('0x3f')]));if(_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x42')]){_0x5db42d['where']=_[_0x3e7b('0x40')](_0x5db42d[_0x3e7b('0x3e')],{'$or':_['map'](_0x5db42d['attributes'],function(_0x33eb14){var _0x466e35={};_0x466e35[_0x33eb14]={'$like':'%'+_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x42')]+'%'};return _0x466e35;})});}_0x5db42d=_[_0x3e7b('0x40')]({},_0x5db42d,_0xa8e825['options']);return _0x3eaf56['getFields'](_0x5db42d);}})[_0x3e7b('0x19')](function(_0xbefd9b){if(_0xbefd9b){_0x57e84e=_0xbefd9b['length'];if(!_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x3a')](_0x3e7b('0x3b'))){_0x5db42d[_0x3e7b('0x26')]=qs[_0x3e7b('0x26')](_0xa8e825[_0x3e7b('0x35')][_0x3e7b('0x26')]);_0x5db42d[_0x3e7b('0x25')]=qs['offset'](_0xa8e825[_0x3e7b('0x35')]['offset']);}return _0x3eaf56['getFields'](_0x5db42d);}})['then'](function(_0x290c44){if(_0x290c44){return _0x290c44?{'count':_0x57e84e,'rows':_0x290c44}:null;}})[_0x3e7b('0x19')](respondWithResult(_0x2f63ba,null))[_0x3e7b('0x49')](handleError(_0x2f63ba,null));};exports[_0x3e7b('0x55')]=function(_0x52a82a,_0x4e114c,_0x1f5503){var _0x2ec7af={};var _0x31655e={};var _0x5d4c07;var _0x4d7b9c;return db[_0x3e7b('0x2f')][_0x3e7b('0x56')]({'where':{'id':_0x52a82a['params']['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0x4e114c,null))[_0x3e7b('0x19')](function(_0x1b6229){if(_0x1b6229){_0x5d4c07=_0x1b6229;_0x31655e[_0x3e7b('0x34')]=_['keys'](db['SalesforceField'][_0x3e7b('0x30')]);_0x31655e[_0x3e7b('0x35')]=_[_0x3e7b('0x36')](_0x52a82a[_0x3e7b('0x35')]);_0x31655e['filters']=_[_0x3e7b('0x37')](_0x31655e[_0x3e7b('0x34')],_0x31655e[_0x3e7b('0x35')]);_0x2ec7af[_0x3e7b('0x38')]=_['intersection'](_0x31655e[_0x3e7b('0x34')],qs['fields'](_0x52a82a[_0x3e7b('0x35')][_0x3e7b('0x39')]));_0x2ec7af['attributes']=_0x2ec7af[_0x3e7b('0x38')][_0x3e7b('0x4c')]?_0x2ec7af[_0x3e7b('0x38')]:_0x31655e[_0x3e7b('0x34')];_0x2ec7af[_0x3e7b('0x3c')]=qs['sort'](_0x52a82a['query'][_0x3e7b('0x3d')]);_0x2ec7af[_0x3e7b('0x3e')]=qs['filters'](_[_0x3e7b('0x54')](_0x52a82a[_0x3e7b('0x35')],_0x31655e[_0x3e7b('0x3f')]));if(_0x52a82a[_0x3e7b('0x35')][_0x3e7b('0x42')]){_0x2ec7af[_0x3e7b('0x3e')]=_[_0x3e7b('0x40')](_0x2ec7af[_0x3e7b('0x3e')],{'$or':_[_0x3e7b('0x2e')](_0x2ec7af['attributes'],function(_0x19b874){var _0x584127={};_0x584127[_0x19b874]={'$like':'%'+_0x52a82a[_0x3e7b('0x35')]['filter']+'%'};return _0x584127;})});}_0x2ec7af=_[_0x3e7b('0x40')]({},_0x2ec7af,_0x52a82a[_0x3e7b('0x43')]);return _0x5d4c07[_0x3e7b('0x55')](_0x2ec7af);}})['then'](function(_0x519ce9){if(_0x519ce9){_0x4d7b9c=_0x519ce9['length'];if(!_0x52a82a['query'][_0x3e7b('0x3a')](_0x3e7b('0x3b'))){_0x2ec7af[_0x3e7b('0x26')]=qs['limit'](_0x52a82a[_0x3e7b('0x35')][_0x3e7b('0x26')]);_0x2ec7af['offset']=qs[_0x3e7b('0x25')](_0x52a82a[_0x3e7b('0x35')][_0x3e7b('0x25')]);}return _0x5d4c07[_0x3e7b('0x55')](_0x2ec7af);}})[_0x3e7b('0x19')](function(_0x3f271f){if(_0x3f271f){return _0x3f271f?{'count':_0x4d7b9c,'rows':_0x3f271f}:null;}})['then'](respondWithResult(_0x4e114c,null))[_0x3e7b('0x49')](handleError(_0x4e114c,null));};exports[_0x3e7b('0x57')]=function(_0x13957c,_0xe12f0c,_0x21f365){var _0x2f102f={};var _0x5977fb={};var _0x474f29;var _0x2a409f;return db['SalesforceConfiguration'][_0x3e7b('0x56')]({'where':{'id':_0x13957c[_0x3e7b('0x4b')]['id']}})[_0x3e7b('0x19')](handleEntityNotFound(_0xe12f0c,null))[_0x3e7b('0x19')](function(_0x5c3584){if(_0x5c3584){_0x474f29=_0x5c3584;_0x5977fb[_0x3e7b('0x34')]=_[_0x3e7b('0x36')](db[_0x3e7b('0x53')]['rawAttributes']);_0x5977fb['query']=_[_0x3e7b('0x36')](_0x13957c['query']);_0x5977fb[_0x3e7b('0x3f')]=_[_0x3e7b('0x37')](_0x5977fb['model'],_0x5977fb[_0x3e7b('0x35')]);_0x2f102f[_0x3e7b('0x38')]=_[_0x3e7b('0x37')](_0x5977fb[_0x3e7b('0x34')],qs[_0x3e7b('0x39')](_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x39')]));_0x2f102f['attributes']=_0x2f102f[_0x3e7b('0x38')][_0x3e7b('0x4c')]?_0x2f102f[_0x3e7b('0x38')]:_0x5977fb[_0x3e7b('0x34')];_0x2f102f['order']=qs[_0x3e7b('0x3d')](_0x13957c['query']['sort']);_0x2f102f['where']=qs[_0x3e7b('0x3f')](_[_0x3e7b('0x54')](_0x13957c[_0x3e7b('0x35')],_0x5977fb[_0x3e7b('0x3f')]));if(_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x42')]){_0x2f102f[_0x3e7b('0x3e')]=_[_0x3e7b('0x40')](_0x2f102f[_0x3e7b('0x3e')],{'$or':_[_0x3e7b('0x2e')](_0x2f102f['attributes'],function(_0x49279d){var _0xc17e5e={};_0xc17e5e[_0x49279d]={'$like':'%'+_0x13957c['query']['filter']+'%'};return _0xc17e5e;})});}_0x2f102f=_[_0x3e7b('0x40')]({},_0x2f102f,_0x13957c['options']);return _0x474f29[_0x3e7b('0x57')](_0x2f102f);}})[_0x3e7b('0x19')](function(_0x3653f6){if(_0x3653f6){_0x2a409f=_0x3653f6[_0x3e7b('0x4c')];if(!_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x3a')](_0x3e7b('0x3b'))){_0x2f102f[_0x3e7b('0x26')]=qs[_0x3e7b('0x26')](_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x26')]);_0x2f102f['offset']=qs[_0x3e7b('0x25')](_0x13957c[_0x3e7b('0x35')][_0x3e7b('0x25')]);}return _0x474f29[_0x3e7b('0x57')](_0x2f102f);}})[_0x3e7b('0x19')](function(_0x3d356b){if(_0x3d356b){return _0x3d356b?{'count':_0x2a409f,'rows':_0x3d356b}:null;}})[_0x3e7b('0x19')](respondWithResult(_0xe12f0c,null))['catch'](handleError(_0xe12f0c,null));}; \ No newline at end of file +var _0x5096=['length','include','find','create','body','findOne','SalesforceField','getFields','getSubjects','pick','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','json','count','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0x5096,0x6c));var _0x6509=function(_0x25cb87,_0xc2d352){_0x25cb87=_0x25cb87-0x0;var _0x3a7537=_0x5096[_0x25cb87];return _0x3a7537;};'use strict';var pdf=require(_0x6509('0x0'));var emlformat=require(_0x6509('0x1'));var rimraf=require(_0x6509('0x2'));var zipdir=require(_0x6509('0x3'));var jsonpatch=require(_0x6509('0x4'));var rp=require('request-promise');var moment=require(_0x6509('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6509('0x6'));var util=require(_0x6509('0x7'));var path=require(_0x6509('0x8'));var sox=require(_0x6509('0x9'));var csv=require(_0x6509('0xa'));var ejs=require(_0x6509('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6509('0xc'));var crypto=require(_0x6509('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6509('0xe'));var toCsv=require(_0x6509('0xa'));var querystring=require(_0x6509('0xf'));var Papa=require(_0x6509('0x10'));var Redis=require(_0x6509('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6509('0x12'));var as=require(_0x6509('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6509('0x14'));var utils=require(_0x6509('0x15'));var config=require(_0x6509('0x16'));var db=require(_0x6509('0x17'))['db'];var jayson=require(_0x6509('0x18'));var client=jayson[_0x6509('0x19')][_0x6509('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x444488,_0x39b39f,_0x178977){if(_0x178977){var _0x580098=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x580098[_0x6509('0x1b')](_0x39b39f)){return _0x444488;}else{throw new db[(_0x6509('0x1c'))][(_0x6509('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x444488;}}function respondWithRpcPromise(_0x42bc70,_0x466af3,_0x392511,_0x395b15){return new BPromise(function(_0x3e0478,_0x23da13){var _0x56f514=_0x395b15||client;return _0x56f514[_0x6509('0x1e')](_0x42bc70,_0x392511)[_0x6509('0x1f')](function(_0x1c9909){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x466af3,_0x6509('0x20'));logger[_0x6509('0x21')](_0x6509('0x22'),_0x466af3,'request\x20sent',JSON[_0x6509('0x23')](_0x1c9909));if(_0x1c9909[_0x6509('0x24')]){if(_0x1c9909['error'][_0x6509('0x25')]===0x1f4){logger[_0x6509('0x24')](_0x6509('0x26'),_0x466af3,_0x1c9909['error'][_0x6509('0x27')]);return _0x23da13(_0x1c9909[_0x6509('0x24')][_0x6509('0x27')]);}logger[_0x6509('0x24')](_0x6509('0x26'),_0x466af3,_0x1c9909[_0x6509('0x24')][_0x6509('0x27')]);return _0x3e0478(_0x1c9909[_0x6509('0x24')]['message']);}else{logger['info'](_0x6509('0x26'),_0x466af3,_0x6509('0x20'));_0x3e0478(_0x1c9909[_0x6509('0x28')][_0x6509('0x27')]);}})['catch'](function(_0x4052e6){logger[_0x6509('0x24')](_0x6509('0x26'),_0x466af3,_0x4052e6);_0x23da13(_0x4052e6);});});}function respondWithStatusCode(_0x8ef38c,_0x1abf30){_0x1abf30=_0x1abf30||0xcc;return function(_0x296c49){if(_0x296c49){return _0x8ef38c[_0x6509('0x29')](_0x1abf30);}return _0x8ef38c[_0x6509('0x2a')](_0x1abf30)['end']();};}function respondWithResult(_0x36294d,_0x681de4){_0x681de4=_0x681de4||0xc8;return function(_0x36dba3){if(_0x36dba3){return _0x36294d[_0x6509('0x2a')](_0x681de4)[_0x6509('0x2b')](_0x36dba3);}};}function respondWithFilteredResult(_0x10d08d,_0x8f63d0){return function(_0x3977b3){if(_0x3977b3){var _0x3d98fb=_0x3977b3[_0x6509('0x2c')],_0x55d210=_0x8f63d0['offset'],_0x4e0cf6=_0x8f63d0['offset']+_0x8f63d0['limit'],_0x9f73bb;if(_0x4e0cf6>=_0x3d98fb){_0x4e0cf6=_0x3d98fb;_0x9f73bb=0xc8;}else{_0x9f73bb=0xce;}_0x10d08d[_0x6509('0x2a')](_0x9f73bb);return _0x10d08d[_0x6509('0x2d')]('Content-Range',_0x55d210+'-'+_0x4e0cf6+'/'+_0x3d98fb)[_0x6509('0x2b')](_0x3977b3);}return null;};}function patchUpdates(_0x36fba1){return function(_0x796de){try{jsonpatch[_0x6509('0x2e')](_0x796de,_0x36fba1,!![]);}catch(_0x287e79){return BPromise[_0x6509('0x2f')](_0x287e79);}return _0x796de[_0x6509('0x30')]();};}function saveUpdates(_0x1a8999,_0x4a7ff4){return function(_0x647d27){if(_0x647d27){return _0x647d27[_0x6509('0x31')](_0x1a8999)[_0x6509('0x1f')](function(_0x3862da){return _0x3862da;});}return null;};}function removeEntity(_0xfabbe6,_0x2e144c){return function(_0x4c53bb){if(_0x4c53bb){return _0x4c53bb[_0x6509('0x32')]()['then'](function(){_0xfabbe6[_0x6509('0x2a')](0xcc)[_0x6509('0x33')]();});}};}function handleEntityNotFound(_0xd30706,_0x5b3c88){return function(_0xad386c){if(!_0xad386c){_0xd30706['sendStatus'](0x194);}return _0xad386c;};}function handleError(_0x20dc14,_0xf1be96){_0xf1be96=_0xf1be96||0x1f4;return function(_0x288f18){logger['error'](_0x288f18[_0x6509('0x34')]);if(_0x288f18[_0x6509('0x35')]){delete _0x288f18[_0x6509('0x35')];}_0x20dc14['status'](_0xf1be96)[_0x6509('0x36')](_0x288f18);};}exports[_0x6509('0x37')]=function(_0x1aaa1e,_0xaff3fb){var _0xe29775={},_0x1cccbd={},_0x340998={'count':0x0,'rows':[]};var _0x2f4496=_[_0x6509('0x38')](db[_0x6509('0x39')][_0x6509('0x3a')],function(_0x44e9c1){return{'name':_0x44e9c1[_0x6509('0x3b')],'type':_0x44e9c1['type'][_0x6509('0x3c')]};});_0x1cccbd[_0x6509('0x3d')]=_[_0x6509('0x38')](_0x2f4496,_0x6509('0x35'));_0x1cccbd[_0x6509('0x3e')]=_['keys'](_0x1aaa1e[_0x6509('0x3e')]);_0x1cccbd[_0x6509('0x3f')]=_[_0x6509('0x40')](_0x1cccbd[_0x6509('0x3d')],_0x1cccbd[_0x6509('0x3e')]);_0xe29775[_0x6509('0x41')]=_[_0x6509('0x40')](_0x1cccbd[_0x6509('0x3d')],qs[_0x6509('0x42')](_0x1aaa1e[_0x6509('0x3e')]['fields']));_0xe29775['attributes']=_0xe29775['attributes']['length']?_0xe29775['attributes']:_0x1cccbd[_0x6509('0x3d')];if(!_0x1aaa1e[_0x6509('0x3e')][_0x6509('0x43')](_0x6509('0x44'))){_0xe29775[_0x6509('0x45')]=qs[_0x6509('0x45')](_0x1aaa1e[_0x6509('0x3e')][_0x6509('0x45')]);_0xe29775['offset']=qs['offset'](_0x1aaa1e['query'][_0x6509('0x46')]);}_0xe29775[_0x6509('0x47')]=qs['sort'](_0x1aaa1e['query'][_0x6509('0x48')]);_0xe29775[_0x6509('0x49')]=qs[_0x6509('0x3f')](_['pick'](_0x1aaa1e[_0x6509('0x3e')],_0x1cccbd[_0x6509('0x3f')]),_0x2f4496);if(_0x1aaa1e[_0x6509('0x3e')]['filter']){_0xe29775[_0x6509('0x49')]=_[_0x6509('0x4a')](_0xe29775[_0x6509('0x49')],{'$or':_['map'](_0x2f4496,function(_0x2a3da4){if(_0x2a3da4[_0x6509('0x4b')]!==_0x6509('0x4c')){var _0x21172f={};_0x21172f[_0x2a3da4['name']]={'$like':'%'+_0x1aaa1e[_0x6509('0x3e')][_0x6509('0x4d')]+'%'};return _0x21172f;}})});}_0xe29775=_[_0x6509('0x4a')]({},_0xe29775,_0x1aaa1e[_0x6509('0x4e')]);var _0x306a95={'where':_0xe29775[_0x6509('0x49')]};return db['SalesforceConfiguration'][_0x6509('0x2c')](_0x306a95)[_0x6509('0x1f')](function(_0x137275){_0x340998[_0x6509('0x2c')]=_0x137275;if(_0x1aaa1e[_0x6509('0x3e')][_0x6509('0x4f')]){_0xe29775['include']=[{'all':!![]}];}return db[_0x6509('0x39')][_0x6509('0x50')](_0xe29775);})[_0x6509('0x1f')](function(_0x49e9ae){_0x340998[_0x6509('0x51')]=_0x49e9ae;return _0x340998;})[_0x6509('0x1f')](respondWithFilteredResult(_0xaff3fb,_0xe29775))[_0x6509('0x52')](handleError(_0xaff3fb,null));};exports[_0x6509('0x53')]=function(_0x256f53,_0x272d6c){var _0x1af1c5={'raw':![],'where':{'id':_0x256f53[_0x6509('0x54')]['id']}},_0x33bc61={};_0x33bc61[_0x6509('0x3d')]=_[_0x6509('0x55')](db[_0x6509('0x39')][_0x6509('0x3a')]);_0x33bc61['query']=_[_0x6509('0x55')](_0x256f53[_0x6509('0x3e')]);_0x33bc61[_0x6509('0x3f')]=_[_0x6509('0x40')](_0x33bc61[_0x6509('0x3d')],_0x33bc61[_0x6509('0x3e')]);_0x1af1c5[_0x6509('0x41')]=_['intersection'](_0x33bc61[_0x6509('0x3d')],qs[_0x6509('0x42')](_0x256f53[_0x6509('0x3e')]['fields']));_0x1af1c5['attributes']=_0x1af1c5[_0x6509('0x41')][_0x6509('0x56')]?_0x1af1c5[_0x6509('0x41')]:_0x33bc61[_0x6509('0x3d')];if(_0x256f53[_0x6509('0x3e')][_0x6509('0x4f')]){_0x1af1c5[_0x6509('0x57')]=[{'all':!![]}];}_0x1af1c5=_[_0x6509('0x4a')]({},_0x1af1c5,_0x256f53[_0x6509('0x4e')]);return db['SalesforceConfiguration'][_0x6509('0x58')](_0x1af1c5)[_0x6509('0x1f')](handleEntityNotFound(_0x272d6c,null))[_0x6509('0x1f')](respondWithResult(_0x272d6c,null))['catch'](handleError(_0x272d6c,null));};exports[_0x6509('0x59')]=function(_0x14cd04,_0x112821){return db[_0x6509('0x39')][_0x6509('0x59')](_0x14cd04[_0x6509('0x5a')],{})[_0x6509('0x1f')](respondWithResult(_0x112821,0xc9))[_0x6509('0x52')](handleError(_0x112821,null));};exports['update']=function(_0x2bdd46,_0x2d5e6c){if(_0x2bdd46[_0x6509('0x5a')]['id']){delete _0x2bdd46[_0x6509('0x5a')]['id'];}return db[_0x6509('0x39')][_0x6509('0x58')]({'where':{'id':_0x2bdd46[_0x6509('0x54')]['id']}})[_0x6509('0x1f')](handleEntityNotFound(_0x2d5e6c,null))[_0x6509('0x1f')](saveUpdates(_0x2bdd46[_0x6509('0x5a')],null))[_0x6509('0x1f')](respondWithResult(_0x2d5e6c,null))['catch'](handleError(_0x2d5e6c,null));};exports[_0x6509('0x32')]=function(_0x5aebf1,_0x5d0ed0){return db['SalesforceConfiguration'][_0x6509('0x58')]({'where':{'id':_0x5aebf1[_0x6509('0x54')]['id']}})[_0x6509('0x1f')](handleEntityNotFound(_0x5d0ed0,null))[_0x6509('0x1f')](removeEntity(_0x5d0ed0,null))[_0x6509('0x52')](handleError(_0x5d0ed0,null));};exports['getFields']=function(_0x12a765,_0x10b49f,_0x4d4c71){var _0x4d0435={};var _0x1633cf={};var _0x297ba3;var _0x1e0e9a;return db[_0x6509('0x39')][_0x6509('0x5b')]({'where':{'id':_0x12a765[_0x6509('0x54')]['id']}})[_0x6509('0x1f')](handleEntityNotFound(_0x10b49f,null))[_0x6509('0x1f')](function(_0x3c9eeb){if(_0x3c9eeb){_0x297ba3=_0x3c9eeb;_0x1633cf['model']=_[_0x6509('0x55')](db[_0x6509('0x5c')]['rawAttributes']);_0x1633cf[_0x6509('0x3e')]=_[_0x6509('0x55')](_0x12a765[_0x6509('0x3e')]);_0x1633cf[_0x6509('0x3f')]=_[_0x6509('0x40')](_0x1633cf[_0x6509('0x3d')],_0x1633cf[_0x6509('0x3e')]);_0x4d0435[_0x6509('0x41')]=_[_0x6509('0x40')](_0x1633cf['model'],qs[_0x6509('0x42')](_0x12a765[_0x6509('0x3e')]['fields']));_0x4d0435[_0x6509('0x41')]=_0x4d0435['attributes'][_0x6509('0x56')]?_0x4d0435[_0x6509('0x41')]:_0x1633cf['model'];_0x4d0435[_0x6509('0x47')]=qs[_0x6509('0x48')](_0x12a765['query']['sort']);_0x4d0435[_0x6509('0x49')]=qs[_0x6509('0x3f')](_['pick'](_0x12a765[_0x6509('0x3e')],_0x1633cf[_0x6509('0x3f')]));if(_0x12a765[_0x6509('0x3e')][_0x6509('0x4d')]){_0x4d0435[_0x6509('0x49')]=_[_0x6509('0x4a')](_0x4d0435[_0x6509('0x49')],{'$or':_[_0x6509('0x38')](_0x4d0435[_0x6509('0x41')],function(_0xb8144b){var _0x31c0ca={};_0x31c0ca[_0xb8144b]={'$like':'%'+_0x12a765[_0x6509('0x3e')]['filter']+'%'};return _0x31c0ca;})});}_0x4d0435=_[_0x6509('0x4a')]({},_0x4d0435,_0x12a765[_0x6509('0x4e')]);return _0x297ba3[_0x6509('0x5d')](_0x4d0435);}})[_0x6509('0x1f')](function(_0x3d200e){if(_0x3d200e){_0x1e0e9a=_0x3d200e['length'];if(!_0x12a765[_0x6509('0x3e')][_0x6509('0x43')](_0x6509('0x44'))){_0x4d0435['limit']=qs[_0x6509('0x45')](_0x12a765['query']['limit']);_0x4d0435['offset']=qs[_0x6509('0x46')](_0x12a765[_0x6509('0x3e')][_0x6509('0x46')]);}return _0x297ba3[_0x6509('0x5d')](_0x4d0435);}})['then'](function(_0x518122){if(_0x518122){return _0x518122?{'count':_0x1e0e9a,'rows':_0x518122}:null;}})[_0x6509('0x1f')](respondWithResult(_0x10b49f,null))[_0x6509('0x52')](handleError(_0x10b49f,null));};exports[_0x6509('0x5e')]=function(_0x2c927a,_0x59d19d,_0x5706eb){var _0x14be52={};var _0x3c8e53={};var _0x2a10e1;var _0x278b2c;return db[_0x6509('0x39')][_0x6509('0x5b')]({'where':{'id':_0x2c927a['params']['id']}})[_0x6509('0x1f')](handleEntityNotFound(_0x59d19d,null))[_0x6509('0x1f')](function(_0xda3f29){if(_0xda3f29){_0x2a10e1=_0xda3f29;_0x3c8e53[_0x6509('0x3d')]=_[_0x6509('0x55')](db['SalesforceField'][_0x6509('0x3a')]);_0x3c8e53['query']=_[_0x6509('0x55')](_0x2c927a[_0x6509('0x3e')]);_0x3c8e53['filters']=_[_0x6509('0x40')](_0x3c8e53[_0x6509('0x3d')],_0x3c8e53[_0x6509('0x3e')]);_0x14be52[_0x6509('0x41')]=_['intersection'](_0x3c8e53[_0x6509('0x3d')],qs[_0x6509('0x42')](_0x2c927a[_0x6509('0x3e')]['fields']));_0x14be52[_0x6509('0x41')]=_0x14be52[_0x6509('0x41')][_0x6509('0x56')]?_0x14be52[_0x6509('0x41')]:_0x3c8e53['model'];_0x14be52[_0x6509('0x47')]=qs[_0x6509('0x48')](_0x2c927a['query'][_0x6509('0x48')]);_0x14be52[_0x6509('0x49')]=qs[_0x6509('0x3f')](_[_0x6509('0x5f')](_0x2c927a[_0x6509('0x3e')],_0x3c8e53[_0x6509('0x3f')]));if(_0x2c927a[_0x6509('0x3e')][_0x6509('0x4d')]){_0x14be52['where']=_['merge'](_0x14be52[_0x6509('0x49')],{'$or':_['map'](_0x14be52[_0x6509('0x41')],function(_0x25e9cc){var _0x1784b1={};_0x1784b1[_0x25e9cc]={'$like':'%'+_0x2c927a[_0x6509('0x3e')]['filter']+'%'};return _0x1784b1;})});}_0x14be52=_['merge']({},_0x14be52,_0x2c927a[_0x6509('0x4e')]);return _0x2a10e1[_0x6509('0x5e')](_0x14be52);}})['then'](function(_0x400967){if(_0x400967){_0x278b2c=_0x400967[_0x6509('0x56')];if(!_0x2c927a['query'][_0x6509('0x43')](_0x6509('0x44'))){_0x14be52[_0x6509('0x45')]=qs[_0x6509('0x45')](_0x2c927a[_0x6509('0x3e')]['limit']);_0x14be52['offset']=qs[_0x6509('0x46')](_0x2c927a[_0x6509('0x3e')][_0x6509('0x46')]);}return _0x2a10e1[_0x6509('0x5e')](_0x14be52);}})[_0x6509('0x1f')](function(_0x42fc45){if(_0x42fc45){return _0x42fc45?{'count':_0x278b2c,'rows':_0x42fc45}:null;}})[_0x6509('0x1f')](respondWithResult(_0x59d19d,null))['catch'](handleError(_0x59d19d,null));};exports[_0x6509('0x60')]=function(_0x452ad6,_0x3f8668,_0x1bbbb8){var _0x377e7e={};var _0x185ef7={};var _0x427445;var _0x43d619;return db['SalesforceConfiguration'][_0x6509('0x5b')]({'where':{'id':_0x452ad6['params']['id']}})['then'](handleEntityNotFound(_0x3f8668,null))[_0x6509('0x1f')](function(_0x15cbb7){if(_0x15cbb7){_0x427445=_0x15cbb7;_0x185ef7[_0x6509('0x3d')]=_[_0x6509('0x55')](db[_0x6509('0x5c')][_0x6509('0x3a')]);_0x185ef7[_0x6509('0x3e')]=_[_0x6509('0x55')](_0x452ad6[_0x6509('0x3e')]);_0x185ef7[_0x6509('0x3f')]=_[_0x6509('0x40')](_0x185ef7[_0x6509('0x3d')],_0x185ef7[_0x6509('0x3e')]);_0x377e7e['attributes']=_['intersection'](_0x185ef7[_0x6509('0x3d')],qs[_0x6509('0x42')](_0x452ad6['query'][_0x6509('0x42')]));_0x377e7e['attributes']=_0x377e7e[_0x6509('0x41')][_0x6509('0x56')]?_0x377e7e['attributes']:_0x185ef7[_0x6509('0x3d')];_0x377e7e[_0x6509('0x47')]=qs[_0x6509('0x48')](_0x452ad6['query'][_0x6509('0x48')]);_0x377e7e['where']=qs['filters'](_[_0x6509('0x5f')](_0x452ad6[_0x6509('0x3e')],_0x185ef7[_0x6509('0x3f')]));if(_0x452ad6[_0x6509('0x3e')][_0x6509('0x4d')]){_0x377e7e[_0x6509('0x49')]=_['merge'](_0x377e7e['where'],{'$or':_[_0x6509('0x38')](_0x377e7e['attributes'],function(_0xcd6d42){var _0x257d3c={};_0x257d3c[_0xcd6d42]={'$like':'%'+_0x452ad6[_0x6509('0x3e')][_0x6509('0x4d')]+'%'};return _0x257d3c;})});}_0x377e7e=_[_0x6509('0x4a')]({},_0x377e7e,_0x452ad6['options']);return _0x427445[_0x6509('0x60')](_0x377e7e);}})[_0x6509('0x1f')](function(_0x280da7){if(_0x280da7){_0x43d619=_0x280da7[_0x6509('0x56')];if(!_0x452ad6['query'][_0x6509('0x43')]('nolimit')){_0x377e7e['limit']=qs[_0x6509('0x45')](_0x452ad6[_0x6509('0x3e')][_0x6509('0x45')]);_0x377e7e['offset']=qs[_0x6509('0x46')](_0x452ad6['query'][_0x6509('0x46')]);}return _0x427445[_0x6509('0x60')](_0x377e7e);}})[_0x6509('0x1f')](function(_0x28f24c){if(_0x28f24c){return _0x28f24c?{'count':_0x43d619,'rows':_0x28f24c}:null;}})[_0x6509('0x1f')](respondWithResult(_0x3f8668,null))[_0x6509('0x52')](handleError(_0x3f8668,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 29e3d0d..7e4a35e 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 _0x113d=['util','api','moment','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x29fea7,_0x44c996){var _0x27208c=function(_0x410aa6){while(--_0x410aa6){_0x29fea7['push'](_0x29fea7['shift']());}};_0x27208c(++_0x44c996);}(_0x113d,0x82));var _0xd113=function(_0x33aca5,_0x19daff){_0x33aca5=_0x33aca5-0x0;var _0x4fe2a5=_0x113d[_0x33aca5];return _0x4fe2a5;};'use strict';var _=require('lodash');var util=require(_0xd113('0x0'));var logger=require('../../config/logger')(_0xd113('0x1'));var moment=require(_0xd113('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd113('0x3'));var rimraf=require(_0xd113('0x4'));var config=require('../../config/environment');var attributes=require(_0xd113('0x5'));module[_0xd113('0x6')]=function(_0x5c5b22,_0x28eca4){return _0x5c5b22[_0xd113('0x7')](_0xd113('0x8'),attributes,{'tableName':_0xd113('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x101e=['bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x101e,0x141));var _0xe101=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x101e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xe101('0x0'));var util=require(_0xe101('0x1'));var logger=require(_0xe101('0x2'))('api');var moment=require(_0xe101('0x3'));var BPromise=require(_0xe101('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe101('0x5'));var rimraf=require(_0xe101('0x6'));var config=require(_0xe101('0x7'));var attributes=require(_0xe101('0x8'));module[_0xe101('0x9')]=function(_0x4e311e,_0x42bbaa){return _0x4e311e[_0xe101('0xa')](_0xe101('0xb'),attributes,{'tableName':_0xe101('0xc'),'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 6d660bb..290d511 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 _0x8de0=['http','then','info','request\x20sent','debug','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0x8de0,0x155));var _0x08de=function(_0x480edd,_0x37f398){_0x480edd=_0x480edd-0x0;var _0x12b311=_0x8de0[_0x480edd];return _0x12b311;};'use strict';var _=require(_0x08de('0x0'));var util=require(_0x08de('0x1'));var moment=require(_0x08de('0x2'));var BPromise=require(_0x08de('0x3'));var rs=require(_0x08de('0x4'));var fs=require('fs');var Redis=require(_0x08de('0x5'));var db=require(_0x08de('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x08de('0x7'))(_0x08de('0x8'));var config=require(_0x08de('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x08de('0xa')][_0x08de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a1d9e,_0x27924e,_0x131c31){return new BPromise(function(_0x498409,_0x480453){return client['request'](_0x2a1d9e,_0x131c31)[_0x08de('0xc')](function(_0x15f515){logger[_0x08de('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x27924e,_0x08de('0xe'));logger[_0x08de('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x27924e,_0x08de('0xe'),JSON[_0x08de('0x10')](_0x15f515));if(_0x15f515['error']){if(_0x15f515[_0x08de('0x11')][_0x08de('0x12')]===0x1f4){logger[_0x08de('0x11')](_0x08de('0x13'),_0x27924e,_0x15f515[_0x08de('0x11')]['message']);return _0x480453(_0x15f515[_0x08de('0x11')][_0x08de('0x14')]);}logger[_0x08de('0x11')](_0x08de('0x13'),_0x27924e,_0x15f515[_0x08de('0x11')][_0x08de('0x14')]);return _0x498409(_0x15f515[_0x08de('0x11')]['message']);}else{logger['info'](_0x08de('0x13'),_0x27924e,_0x08de('0xe'));_0x498409(_0x15f515['result'][_0x08de('0x14')]);}})[_0x08de('0x15')](function(_0x6c58c4){logger['error'](_0x08de('0x13'),_0x27924e,_0x6c58c4);_0x480453(_0x6c58c4);});});} \ No newline at end of file +var _0xf7c4=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xf7c4,0xd1));var _0x4f7c=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xf7c4[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x4f7c('0x0'));var moment=require(_0x4f7c('0x1'));var BPromise=require('bluebird');var rs=require(_0x4f7c('0x2'));var fs=require('fs');var Redis=require(_0x4f7c('0x3'));var db=require(_0x4f7c('0x4'))['db'];var utils=require(_0x4f7c('0x5'));var logger=require('../../config/logger')(_0x4f7c('0x6'));var config=require('../../config/environment');var jayson=require(_0x4f7c('0x7'));var client=jayson[_0x4f7c('0x8')][_0x4f7c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58a088,_0x4175d5,_0x79c873){return new BPromise(function(_0x533aff,_0x4e293f){return client[_0x4f7c('0xa')](_0x58a088,_0x79c873)[_0x4f7c('0xb')](function(_0x26f690){logger[_0x4f7c('0xc')](_0x4f7c('0xd'),_0x4175d5,_0x4f7c('0xe'));logger[_0x4f7c('0xf')](_0x4f7c('0x10'),_0x4175d5,_0x4f7c('0xe'),JSON[_0x4f7c('0x11')](_0x26f690));if(_0x26f690[_0x4f7c('0x12')]){if(_0x26f690[_0x4f7c('0x12')][_0x4f7c('0x13')]===0x1f4){logger[_0x4f7c('0x12')](_0x4f7c('0xd'),_0x4175d5,_0x26f690[_0x4f7c('0x12')][_0x4f7c('0x14')]);return _0x4e293f(_0x26f690[_0x4f7c('0x12')]['message']);}logger[_0x4f7c('0x12')](_0x4f7c('0xd'),_0x4175d5,_0x26f690[_0x4f7c('0x12')]['message']);return _0x533aff(_0x26f690[_0x4f7c('0x12')][_0x4f7c('0x14')]);}else{logger['info'](_0x4f7c('0xd'),_0x4175d5,_0x4f7c('0xe'));_0x533aff(_0x26f690[_0x4f7c('0x15')][_0x4f7c('0x14')]);}})[_0x4f7c('0x16')](function(_0x4740ae){logger[_0x4f7c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4175d5,_0x4740ae);_0x4e293f(_0x4740ae);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 1768777..ddaf1f9 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(_0x47f62e,_0x5180f8){var _0x216014=function(_0x51c75d){while(--_0x51c75d){_0x47f62e['push'](_0x47f62e['shift']());}};_0x216014(++_0x5180f8);}(_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 _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x17636e,_0x38ce15){var _0xafd088=function(_0xf20682){while(--_0xf20682){_0x17636e['push'](_0x17636e['shift']());}};_0xafd088(++_0x38ce15);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x110870,_0x3a552a){_0x110870=_0x110870-0x0;var _0x480097=_0x3f8a[_0x110870];return _0x480097;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 07244d2..cdb1de1 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 _0xd9f7=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xd9f7,0x13a));var _0x7d9f=function(_0x14146b,_0xc72b05){_0x14146b=_0x14146b-0x0;var _0x4ab737=_0xd9f7[_0x14146b];return _0x4ab737;};'use strict';var Sequelize=require(_0x7d9f('0x0'));module['exports']={'type':{'type':Sequelize[_0x7d9f('0x1')](_0x7d9f('0x2'),_0x7d9f('0x3'),_0x7d9f('0x4'),_0x7d9f('0x5')),'defaultValue':_0x7d9f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7d9f('0x6')]},'keyType':{'type':Sequelize[_0x7d9f('0x1')](_0x7d9f('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x7d9f('0x6')]},'idField':{'type':Sequelize[_0x7d9f('0x6')]},'variableName':{'type':Sequelize[_0x7d9f('0x6')]}}; \ No newline at end of file +var _0x8557=['string','variable','keyValue','STRING','sequelize','exports'];(function(_0x1119c8,_0x87303e){var _0x3f3071=function(_0x27a847){while(--_0x27a847){_0x1119c8['push'](_0x1119c8['shift']());}};_0x3f3071(++_0x87303e);}(_0x8557,0xd6));var _0x7855=function(_0x16aa70,_0x5b1f73){_0x16aa70=_0x16aa70-0x0;var _0x11875f=_0x8557[_0x16aa70];return _0x11875f;};'use strict';var Sequelize=require(_0x7855('0x0'));module[_0x7855('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7855('0x2'),_0x7855('0x3'),'customVariable',_0x7855('0x4')),'defaultValue':_0x7855('0x2')},'content':{'type':Sequelize[_0x7855('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7855('0x2'),_0x7855('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7855('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 59c73ac..5219a8e 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 _0x492b=['name','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','catch','show','params','SalesforceField','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','index','map','rawAttributes','fieldName','type','key'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x492b,0x18e));var _0xb492=function(_0x2a08b8,_0x39bd90){_0x2a08b8=_0x2a08b8-0x0;var _0x74e1e=_0x492b[_0x2a08b8];return _0x74e1e;};'use strict';var pdf=require(_0xb492('0x0'));var emlformat=require(_0xb492('0x1'));var rimraf=require(_0xb492('0x2'));var zipdir=require(_0xb492('0x3'));var jsonpatch=require(_0xb492('0x4'));var rp=require(_0xb492('0x5'));var moment=require(_0xb492('0x6'));var BPromise=require(_0xb492('0x7'));var Mustache=require(_0xb492('0x8'));var util=require('util');var path=require(_0xb492('0x9'));var sox=require(_0xb492('0xa'));var csv=require('to-csv');var ejs=require(_0xb492('0xb'));var fs=require('fs');var _=require(_0xb492('0xc'));var squel=require(_0xb492('0xd'));var crypto=require(_0xb492('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb492('0xf'));var toCsv=require(_0xb492('0x10'));var querystring=require(_0xb492('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb492('0x12'));var qs=require(_0xb492('0x13'));var as=require(_0xb492('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb492('0x15'))(_0xb492('0x16'));var utils=require(_0xb492('0x17'));var config=require(_0xb492('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcb7311,_0x186a5f){_0x186a5f=_0x186a5f||0xcc;return function(_0xd1c3bd){if(_0xd1c3bd){return _0xcb7311['sendStatus'](_0x186a5f);}return _0xcb7311[_0xb492('0x19')](_0x186a5f)[_0xb492('0x1a')]();};}function respondWithResult(_0x3cd495,_0x350b24){_0x350b24=_0x350b24||0xc8;return function(_0x531c28){if(_0x531c28){return _0x3cd495[_0xb492('0x19')](_0x350b24)['json'](_0x531c28);}};}function respondWithFilteredResult(_0x3eb8dd,_0x13a670){return function(_0x4fd74b){if(_0x4fd74b){var _0x3178db=_0x4fd74b['count'],_0x108e12=_0x13a670[_0xb492('0x1b')],_0x59242f=_0x13a670[_0xb492('0x1b')]+_0x13a670[_0xb492('0x1c')],_0x1daa20;if(_0x59242f>=_0x3178db){_0x59242f=_0x3178db;_0x1daa20=0xc8;}else{_0x1daa20=0xce;}_0x3eb8dd['status'](_0x1daa20);return _0x3eb8dd[_0xb492('0x1d')](_0xb492('0x1e'),_0x108e12+'-'+_0x59242f+'/'+_0x3178db)[_0xb492('0x1f')](_0x4fd74b);}return null;};}function patchUpdates(_0x1e3aaa){return function(_0x5e0ea){try{jsonpatch[_0xb492('0x20')](_0x5e0ea,_0x1e3aaa,!![]);}catch(_0x74fb6a){return BPromise['reject'](_0x74fb6a);}return _0x5e0ea[_0xb492('0x21')]();};}function saveUpdates(_0x3fd408,_0x4950b4){return function(_0x5b634d){if(_0x5b634d){return _0x5b634d[_0xb492('0x22')](_0x3fd408)[_0xb492('0x23')](function(_0x50c958){return _0x50c958;});}return null;};}function removeEntity(_0x164ee7,_0x4eb82b){return function(_0x2aebf4){if(_0x2aebf4){return _0x2aebf4[_0xb492('0x24')]()['then'](function(){_0x164ee7['status'](0xcc)[_0xb492('0x1a')]();});}};}function handleEntityNotFound(_0x44ca84,_0x1d93a1){return function(_0x59ddc5){if(!_0x59ddc5){_0x44ca84[_0xb492('0x25')](0x194);}return _0x59ddc5;};}function handleError(_0x582ae9,_0x4cb9d4){_0x4cb9d4=_0x4cb9d4||0x1f4;return function(_0x59ce2d){logger[_0xb492('0x26')](_0x59ce2d[_0xb492('0x27')]);if(_0x59ce2d['name']){delete _0x59ce2d['name'];}_0x582ae9[_0xb492('0x19')](_0x4cb9d4)['send'](_0x59ce2d);};}exports[_0xb492('0x28')]=function(_0x281112,_0x4899cc){var _0x11bc1f={},_0x5e88a4={},_0x13ba78={'count':0x0,'rows':[]};var _0x502640=_[_0xb492('0x29')](db['SalesforceField'][_0xb492('0x2a')],function(_0x36aadb){return{'name':_0x36aadb[_0xb492('0x2b')],'type':_0x36aadb[_0xb492('0x2c')][_0xb492('0x2d')]};});_0x5e88a4['model']=_[_0xb492('0x29')](_0x502640,_0xb492('0x2e'));_0x5e88a4[_0xb492('0x2f')]=_[_0xb492('0x30')](_0x281112[_0xb492('0x2f')]);_0x5e88a4[_0xb492('0x31')]=_[_0xb492('0x32')](_0x5e88a4[_0xb492('0x33')],_0x5e88a4['query']);_0x11bc1f[_0xb492('0x34')]=_['intersection'](_0x5e88a4[_0xb492('0x33')],qs['fields'](_0x281112['query'][_0xb492('0x35')]));_0x11bc1f[_0xb492('0x34')]=_0x11bc1f[_0xb492('0x34')][_0xb492('0x36')]?_0x11bc1f[_0xb492('0x34')]:_0x5e88a4[_0xb492('0x33')];if(!_0x281112[_0xb492('0x2f')]['hasOwnProperty'](_0xb492('0x37'))){_0x11bc1f[_0xb492('0x1c')]=qs[_0xb492('0x1c')](_0x281112[_0xb492('0x2f')][_0xb492('0x1c')]);_0x11bc1f[_0xb492('0x1b')]=qs['offset'](_0x281112[_0xb492('0x2f')][_0xb492('0x1b')]);}_0x11bc1f['order']=qs[_0xb492('0x38')](_0x281112[_0xb492('0x2f')]['sort']);_0x11bc1f[_0xb492('0x39')]=qs[_0xb492('0x31')](_[_0xb492('0x3a')](_0x281112['query'],_0x5e88a4[_0xb492('0x31')]),_0x502640);if(_0x281112[_0xb492('0x2f')][_0xb492('0x3b')]){_0x11bc1f[_0xb492('0x39')]=_['merge'](_0x11bc1f[_0xb492('0x39')],{'$or':_['map'](_0x502640,function(_0x4f1495){if(_0x4f1495[_0xb492('0x2c')]!==_0xb492('0x3c')){var _0x1122da={};_0x1122da[_0x4f1495['name']]={'$like':'%'+_0x281112[_0xb492('0x2f')]['filter']+'%'};return _0x1122da;}})});}_0x11bc1f=_[_0xb492('0x3d')]({},_0x11bc1f,_0x281112[_0xb492('0x3e')]);var _0x32fff3={'where':_0x11bc1f['where']};return db['SalesforceField'][_0xb492('0x3f')](_0x32fff3)['then'](function(_0x3c281c){_0x13ba78['count']=_0x3c281c;if(_0x281112[_0xb492('0x2f')][_0xb492('0x40')]){_0x11bc1f['include']=[{'all':!![]}];}return db['SalesforceField'][_0xb492('0x41')](_0x11bc1f);})[_0xb492('0x23')](function(_0x1be09c){_0x13ba78['rows']=_0x1be09c;return _0x13ba78;})['then'](respondWithFilteredResult(_0x4899cc,_0x11bc1f))[_0xb492('0x42')](handleError(_0x4899cc,null));};exports[_0xb492('0x43')]=function(_0x80aeed,_0x4e783c){var _0x28ba80={'raw':!![],'where':{'id':_0x80aeed[_0xb492('0x44')]['id']}},_0x5bc66f={};_0x5bc66f['model']=_[_0xb492('0x30')](db[_0xb492('0x45')][_0xb492('0x2a')]);_0x5bc66f[_0xb492('0x2f')]=_[_0xb492('0x30')](_0x80aeed[_0xb492('0x2f')]);_0x5bc66f[_0xb492('0x31')]=_['intersection'](_0x5bc66f[_0xb492('0x33')],_0x5bc66f[_0xb492('0x2f')]);_0x28ba80[_0xb492('0x34')]=_[_0xb492('0x32')](_0x5bc66f[_0xb492('0x33')],qs[_0xb492('0x35')](_0x80aeed[_0xb492('0x2f')][_0xb492('0x35')]));_0x28ba80[_0xb492('0x34')]=_0x28ba80[_0xb492('0x34')][_0xb492('0x36')]?_0x28ba80[_0xb492('0x34')]:_0x5bc66f[_0xb492('0x33')];if(_0x80aeed[_0xb492('0x2f')][_0xb492('0x40')]){_0x28ba80[_0xb492('0x46')]=[{'all':!![]}];}_0x28ba80=_[_0xb492('0x3d')]({},_0x28ba80,_0x80aeed[_0xb492('0x3e')]);return db[_0xb492('0x45')][_0xb492('0x47')](_0x28ba80)[_0xb492('0x23')](handleEntityNotFound(_0x4e783c,null))[_0xb492('0x23')](respondWithResult(_0x4e783c,null))['catch'](handleError(_0x4e783c,null));};exports['create']=function(_0x39c78c,_0x4d20ac){return db['SalesforceField'][_0xb492('0x48')](_0x39c78c[_0xb492('0x49')],{})[_0xb492('0x23')](respondWithResult(_0x4d20ac,0xc9))['catch'](handleError(_0x4d20ac,null));};exports['update']=function(_0x2b655a,_0x10f5a9){if(_0x2b655a['body']['id']){delete _0x2b655a['body']['id'];}return db[_0xb492('0x45')][_0xb492('0x47')]({'where':{'id':_0x2b655a['params']['id']}})[_0xb492('0x23')](handleEntityNotFound(_0x10f5a9,null))[_0xb492('0x23')](saveUpdates(_0x2b655a[_0xb492('0x49')],null))[_0xb492('0x23')](respondWithResult(_0x10f5a9,null))['catch'](handleError(_0x10f5a9,null));};exports['destroy']=function(_0x1dda81,_0x19c8c){return db[_0xb492('0x45')][_0xb492('0x47')]({'where':{'id':_0x1dda81[_0xb492('0x44')]['id']}})[_0xb492('0x23')](handleEntityNotFound(_0x19c8c,null))[_0xb492('0x23')](removeEntity(_0x19c8c,null))['catch'](handleError(_0x19c8c,null));}; \ No newline at end of file +var _0xa44c=['stack','name','send','index','map','SalesforceField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xa44c,0x13f));var _0xca44=function(_0xe62d0d,_0xae1934){_0xe62d0d=_0xe62d0d-0x0;var _0x28d151=_0xa44c[_0xe62d0d];return _0x28d151;};'use strict';var pdf=require(_0xca44('0x0'));var emlformat=require(_0xca44('0x1'));var rimraf=require(_0xca44('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca44('0x3'));var rp=require(_0xca44('0x4'));var moment=require(_0xca44('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xca44('0x6'));var util=require('util');var path=require('path');var sox=require(_0xca44('0x7'));var csv=require(_0xca44('0x8'));var ejs=require(_0xca44('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xca44('0xa'));var crypto=require('crypto');var jsforce=require(_0xca44('0xb'));var deskjs=require(_0xca44('0xc'));var toCsv=require(_0xca44('0x8'));var querystring=require(_0xca44('0xd'));var Papa=require(_0xca44('0xe'));var Redis=require(_0xca44('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca44('0x10'));var as=require(_0xca44('0x11'));var hardwareService=require(_0xca44('0x12'));var logger=require(_0xca44('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xca44('0x14'))['db'];function respondWithStatusCode(_0x37627e,_0x289c84){_0x289c84=_0x289c84||0xcc;return function(_0x52d139){if(_0x52d139){return _0x37627e[_0xca44('0x15')](_0x289c84);}return _0x37627e[_0xca44('0x16')](_0x289c84)[_0xca44('0x17')]();};}function respondWithResult(_0x15dc01,_0x48017d){_0x48017d=_0x48017d||0xc8;return function(_0x278860){if(_0x278860){return _0x15dc01['status'](_0x48017d)[_0xca44('0x18')](_0x278860);}};}function respondWithFilteredResult(_0x53aac5,_0x3a3b8f){return function(_0x3c909b){if(_0x3c909b){var _0x213943=_0x3c909b[_0xca44('0x19')],_0x3176f6=_0x3a3b8f['offset'],_0x26852f=_0x3a3b8f[_0xca44('0x1a')]+_0x3a3b8f[_0xca44('0x1b')],_0x36d9d2;if(_0x26852f>=_0x213943){_0x26852f=_0x213943;_0x36d9d2=0xc8;}else{_0x36d9d2=0xce;}_0x53aac5['status'](_0x36d9d2);return _0x53aac5[_0xca44('0x1c')](_0xca44('0x1d'),_0x3176f6+'-'+_0x26852f+'/'+_0x213943)['json'](_0x3c909b);}return null;};}function patchUpdates(_0x32983b){return function(_0x22784c){try{jsonpatch['apply'](_0x22784c,_0x32983b,!![]);}catch(_0x4016ad){return BPromise[_0xca44('0x1e')](_0x4016ad);}return _0x22784c[_0xca44('0x1f')]();};}function saveUpdates(_0x205061,_0x148880){return function(_0x2f5dad){if(_0x2f5dad){return _0x2f5dad[_0xca44('0x20')](_0x205061)[_0xca44('0x21')](function(_0x474fe8){return _0x474fe8;});}return null;};}function removeEntity(_0x47437b,_0x26b297){return function(_0xb81ee5){if(_0xb81ee5){return _0xb81ee5[_0xca44('0x22')]()[_0xca44('0x21')](function(){_0x47437b['status'](0xcc)[_0xca44('0x17')]();});}};}function handleEntityNotFound(_0x1b14db,_0x41ae5c){return function(_0xe6c520){if(!_0xe6c520){_0x1b14db[_0xca44('0x15')](0x194);}return _0xe6c520;};}function handleError(_0x3eaa47,_0x1375c0){_0x1375c0=_0x1375c0||0x1f4;return function(_0x437c5e){logger[_0xca44('0x23')](_0x437c5e[_0xca44('0x24')]);if(_0x437c5e['name']){delete _0x437c5e[_0xca44('0x25')];}_0x3eaa47[_0xca44('0x16')](_0x1375c0)[_0xca44('0x26')](_0x437c5e);};}exports[_0xca44('0x27')]=function(_0x3ce68d,_0x5b49d0){var _0x20d374={},_0xe972e3={},_0x3cb116={'count':0x0,'rows':[]};var _0x55df18=_[_0xca44('0x28')](db[_0xca44('0x29')][_0xca44('0x2a')],function(_0x28e3c8){return{'name':_0x28e3c8['fieldName'],'type':_0x28e3c8['type'][_0xca44('0x2b')]};});_0xe972e3[_0xca44('0x2c')]=_[_0xca44('0x28')](_0x55df18,'name');_0xe972e3[_0xca44('0x2d')]=_[_0xca44('0x2e')](_0x3ce68d[_0xca44('0x2d')]);_0xe972e3[_0xca44('0x2f')]=_[_0xca44('0x30')](_0xe972e3[_0xca44('0x2c')],_0xe972e3[_0xca44('0x2d')]);_0x20d374[_0xca44('0x31')]=_[_0xca44('0x30')](_0xe972e3[_0xca44('0x2c')],qs[_0xca44('0x32')](_0x3ce68d[_0xca44('0x2d')][_0xca44('0x32')]));_0x20d374['attributes']=_0x20d374[_0xca44('0x31')][_0xca44('0x33')]?_0x20d374[_0xca44('0x31')]:_0xe972e3['model'];if(!_0x3ce68d['query'][_0xca44('0x34')](_0xca44('0x35'))){_0x20d374[_0xca44('0x1b')]=qs[_0xca44('0x1b')](_0x3ce68d[_0xca44('0x2d')][_0xca44('0x1b')]);_0x20d374['offset']=qs[_0xca44('0x1a')](_0x3ce68d[_0xca44('0x2d')]['offset']);}_0x20d374[_0xca44('0x36')]=qs[_0xca44('0x37')](_0x3ce68d[_0xca44('0x2d')]['sort']);_0x20d374[_0xca44('0x38')]=qs['filters'](_[_0xca44('0x39')](_0x3ce68d[_0xca44('0x2d')],_0xe972e3[_0xca44('0x2f')]),_0x55df18);if(_0x3ce68d[_0xca44('0x2d')][_0xca44('0x3a')]){_0x20d374[_0xca44('0x38')]=_[_0xca44('0x3b')](_0x20d374[_0xca44('0x38')],{'$or':_['map'](_0x55df18,function(_0x570063){if(_0x570063[_0xca44('0x3c')]!==_0xca44('0x3d')){var _0x493161={};_0x493161[_0x570063[_0xca44('0x25')]]={'$like':'%'+_0x3ce68d[_0xca44('0x2d')][_0xca44('0x3a')]+'%'};return _0x493161;}})});}_0x20d374=_[_0xca44('0x3b')]({},_0x20d374,_0x3ce68d[_0xca44('0x3e')]);var _0x124032={'where':_0x20d374[_0xca44('0x38')]};return db[_0xca44('0x29')][_0xca44('0x19')](_0x124032)[_0xca44('0x21')](function(_0x2ba1df){_0x3cb116['count']=_0x2ba1df;if(_0x3ce68d[_0xca44('0x2d')][_0xca44('0x3f')]){_0x20d374[_0xca44('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0xca44('0x41')](_0x20d374);})[_0xca44('0x21')](function(_0x48743c){_0x3cb116[_0xca44('0x42')]=_0x48743c;return _0x3cb116;})[_0xca44('0x21')](respondWithFilteredResult(_0x5b49d0,_0x20d374))['catch'](handleError(_0x5b49d0,null));};exports['show']=function(_0x315677,_0x40d15d){var _0xc5ed44={'raw':!![],'where':{'id':_0x315677[_0xca44('0x43')]['id']}},_0x5d354e={};_0x5d354e['model']=_['keys'](db['SalesforceField']['rawAttributes']);_0x5d354e[_0xca44('0x2d')]=_[_0xca44('0x2e')](_0x315677[_0xca44('0x2d')]);_0x5d354e[_0xca44('0x2f')]=_[_0xca44('0x30')](_0x5d354e[_0xca44('0x2c')],_0x5d354e[_0xca44('0x2d')]);_0xc5ed44[_0xca44('0x31')]=_[_0xca44('0x30')](_0x5d354e['model'],qs[_0xca44('0x32')](_0x315677[_0xca44('0x2d')][_0xca44('0x32')]));_0xc5ed44[_0xca44('0x31')]=_0xc5ed44[_0xca44('0x31')][_0xca44('0x33')]?_0xc5ed44['attributes']:_0x5d354e['model'];if(_0x315677[_0xca44('0x2d')]['includeAll']){_0xc5ed44[_0xca44('0x40')]=[{'all':!![]}];}_0xc5ed44=_[_0xca44('0x3b')]({},_0xc5ed44,_0x315677[_0xca44('0x3e')]);return db['SalesforceField'][_0xca44('0x44')](_0xc5ed44)[_0xca44('0x21')](handleEntityNotFound(_0x40d15d,null))['then'](respondWithResult(_0x40d15d,null))[_0xca44('0x45')](handleError(_0x40d15d,null));};exports['create']=function(_0x980172,_0x43abce){return db[_0xca44('0x29')]['create'](_0x980172[_0xca44('0x46')],{})[_0xca44('0x21')](respondWithResult(_0x43abce,0xc9))['catch'](handleError(_0x43abce,null));};exports[_0xca44('0x20')]=function(_0x37dc70,_0x58ab5c){if(_0x37dc70[_0xca44('0x46')]['id']){delete _0x37dc70[_0xca44('0x46')]['id'];}return db[_0xca44('0x29')][_0xca44('0x44')]({'where':{'id':_0x37dc70[_0xca44('0x43')]['id']}})[_0xca44('0x21')](handleEntityNotFound(_0x58ab5c,null))[_0xca44('0x21')](saveUpdates(_0x37dc70['body'],null))[_0xca44('0x21')](respondWithResult(_0x58ab5c,null))['catch'](handleError(_0x58ab5c,null));};exports[_0xca44('0x22')]=function(_0xf7b48b,_0x44e0a3){return db[_0xca44('0x29')][_0xca44('0x44')]({'where':{'id':_0xf7b48b[_0xca44('0x43')]['id']}})[_0xca44('0x21')](handleEntityNotFound(_0x44e0a3,null))[_0xca44('0x21')](removeEntity(_0x44e0a3,null))['catch'](handleError(_0x44e0a3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 44c609c..e25de21 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 _0xbacb=['salesforce_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','SalesforceField'];(function(_0x41d82a,_0x29fc06){var _0x1a9380=function(_0x3d38bd){while(--_0x3d38bd){_0x41d82a['push'](_0x41d82a['shift']());}};_0x1a9380(++_0x29fc06);}(_0xbacb,0xbd));var _0xbbac=function(_0xa8dc4f,_0x96622c){_0xa8dc4f=_0xa8dc4f-0x0;var _0x45b00c=_0xbacb[_0xa8dc4f];return _0x45b00c;};'use strict';var _=require(_0xbbac('0x0'));var util=require('util');var logger=require(_0xbbac('0x1'))(_0xbbac('0x2'));var moment=require(_0xbbac('0x3'));var BPromise=require(_0xbbac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbbac('0x5'));var config=require(_0xbbac('0x6'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x48183f,_0x1eb111){return _0x48183f[_0xbbac('0x7')](_0xbbac('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xbbac('0x9'),'fields':['idField',_0xbbac('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4966=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x5b278c,_0x59c94e){var _0x1afb84=function(_0x3c2e38){while(--_0x3c2e38){_0x5b278c['push'](_0x5b278c['shift']());}};_0x1afb84(++_0x59c94e);}(_0x4966,0x82));var _0x6496=function(_0x2ae444,_0x5e9881){_0x2ae444=_0x2ae444-0x0;var _0x4d8790=_0x4966[_0x2ae444];return _0x4d8790;};'use strict';var _=require(_0x6496('0x0'));var util=require(_0x6496('0x1'));var logger=require(_0x6496('0x2'))(_0x6496('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6496('0x4'));var fs=require('fs');var path=require(_0x6496('0x5'));var rimraf=require(_0x6496('0x6'));var config=require(_0x6496('0x7'));var attributes=require(_0x6496('0x8'));module['exports']=function(_0x1ffafc,_0x3db579){return _0x1ffafc[_0x6496('0x9')]('SalesforceField',attributes,{'tableName':_0x6496('0xa'),'paranoid':![],'indexes':[{'name':_0x6496('0xb'),'fields':[_0x6496('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index c8d4ab3..f6f1a0c 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 _0x6f0d=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x1a4b99,_0x118280){var _0x5cef7e=function(_0x56b233){while(--_0x56b233){_0x1a4b99['push'](_0x1a4b99['shift']());}};_0x5cef7e(++_0x118280);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x9d6272,_0x11e0ac){_0x9d6272=_0x9d6272-0x0;var _0x23bdeb=_0x6f0d[_0x9d6272];return _0x23bdeb;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2d866f,_0x4ab197){var _0x592669=function(_0x3ecf07){while(--_0x3ecf07){_0x2d866f['push'](_0x2d866f['shift']());}};_0x592669(++_0x4ab197);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5106f5,_0x54fc3c){_0x5106f5=_0x5106f5-0x0;var _0x3e4fd6=_0xb43b[_0x5106f5];return _0x3e4fd6;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index c16bdb6..9965d39 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 _0xdcd9=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x2a3808,_0x4fd0d5){var _0x2dd4c3=function(_0x2075d0){while(--_0x2075d0){_0x2a3808['push'](_0x2a3808['shift']());}};_0x2dd4c3(++_0x4fd0d5);}(_0xdcd9,0xf5));var _0x9dcd=function(_0x211782,_0x2e256d){_0x211782=_0x211782-0x0;var _0x327c3f=_0xdcd9[_0x211782];return _0x327c3f;};'use strict';var multer=require('multer');var util=require(_0x9dcd('0x0'));var path=require('path');var timeout=require(_0x9dcd('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x9dcd('0x2'));var interaction=require(_0x9dcd('0x3'));var config=require(_0x9dcd('0x4'));var controller=require(_0x9dcd('0x5'));router[_0x9dcd('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9dcd('0x6')](_0x9dcd('0x7'),auth[_0x9dcd('0x8')](),controller[_0x9dcd('0x9')]);router[_0x9dcd('0x6')](_0x9dcd('0xa'),auth[_0x9dcd('0x8')](),controller[_0x9dcd('0xb')]);router[_0x9dcd('0x6')](_0x9dcd('0xc'),auth['isAuthenticated'](),controller[_0x9dcd('0xd')]);router[_0x9dcd('0xe')]('/',auth[_0x9dcd('0x8')](),controller[_0x9dcd('0xf')]);router['post']('/:id/configurations',auth[_0x9dcd('0x8')](),controller[_0x9dcd('0x10')]);router[_0x9dcd('0x11')](_0x9dcd('0x7'),auth[_0x9dcd('0x8')](),controller[_0x9dcd('0x12')]);router[_0x9dcd('0x13')](_0x9dcd('0x7'),auth[_0x9dcd('0x8')](),controller['destroy']);module[_0x9dcd('0x14')]=router; \ No newline at end of file +var _0x9901=['/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9901,0x15e));var _0x1990=function(_0x4d973c,_0x36153f){_0x4d973c=_0x4d973c-0x0;var _0x33d408=_0x9901[_0x4d973c];return _0x33d408;};'use strict';var multer=require('multer');var util=require(_0x1990('0x0'));var path=require('path');var timeout=require(_0x1990('0x1'));var express=require(_0x1990('0x2'));var router=express[_0x1990('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1990('0x4'));var config=require(_0x1990('0x5'));var controller=require(_0x1990('0x6'));router[_0x1990('0x7')]('/',auth[_0x1990('0x8')](),controller[_0x1990('0x9')]);router[_0x1990('0x7')](_0x1990('0xa'),auth[_0x1990('0x8')](),controller[_0x1990('0xb')]);router[_0x1990('0x7')]('/:id/configurations',auth[_0x1990('0x8')](),controller[_0x1990('0xc')]);router[_0x1990('0x7')](_0x1990('0xd'),auth[_0x1990('0x8')](),controller[_0x1990('0xe')]);router[_0x1990('0xf')]('/',auth[_0x1990('0x8')](),controller[_0x1990('0x10')]);router[_0x1990('0xf')](_0x1990('0x11'),auth[_0x1990('0x8')](),controller['addConfiguration']);router[_0x1990('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1990('0x13')]);router['delete'](_0x1990('0xa'),auth[_0x1990('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 3f898e1..6ea604b 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 _0x98bf=['exports','STRING','username','remoteUri','sequelize'];(function(_0xf7d47e,_0x7222c8){var _0x31733c=function(_0x1efa27){while(--_0x1efa27){_0xf7d47e['push'](_0xf7d47e['shift']());}};_0x31733c(++_0x7222c8);}(_0x98bf,0x6d));var _0xf98b=function(_0x407a3e,_0x15acb0){_0x407a3e=_0x407a3e-0x0;var _0x129fe3=_0x98bf[_0x407a3e];return _0x129fe3;};'use strict';var Sequelize=require(_0xf98b('0x0'));module[_0xf98b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf98b('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf98b('0x3')},'password':{'type':Sequelize[_0xf98b('0x2')]},'email':{'type':Sequelize[_0xf98b('0x2')]},'remoteUri':{'type':Sequelize[_0xf98b('0x2')],'unique':_0xf98b('0x4')},'serverUrl':{'type':Sequelize[_0xf98b('0x2')]}}; \ No newline at end of file +var _0xbc86=['sequelize','exports','STRING','username','remoteUri'];(function(_0x480eca,_0x2167d2){var _0x4c3917=function(_0x5cee39){while(--_0x5cee39){_0x480eca['push'](_0x480eca['shift']());}};_0x4c3917(++_0x2167d2);}(_0xbc86,0x1e0));var _0x6bc8=function(_0x30bc19,_0xfcd0f1){_0x30bc19=_0x30bc19-0x0;var _0x331b0c=_0xbc86[_0x30bc19];return _0x331b0c;};'use strict';var Sequelize=require(_0x6bc8('0x0'));module[_0x6bc8('0x1')]={'name':{'type':Sequelize[_0x6bc8('0x2')]},'description':{'type':Sequelize[_0x6bc8('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6bc8('0x3')},'password':{'type':Sequelize[_0x6bc8('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6bc8('0x2')],'unique':_0x6bc8('0x4')},'serverUrl':{'type':Sequelize[_0x6bc8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index fcd4c3b..1381a13 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 _0x87f3=['request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','create','body','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','opened_at','group_list','work_end','reopened_time','resolved_at','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','location','password','email','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','push','all','TCL:\x20_object','includes','label','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then'];(function(_0x1f8ee9,_0x521f85){var _0x24c8a9=function(_0x351d5a){while(--_0x351d5a){_0x1f8ee9['push'](_0x1f8ee9['shift']());}};_0x24c8a9(++_0x521f85);}(_0x87f3,0x165));var _0x387f=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x87f3[_0x16629d];return _0x56ccee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x387f('0x0'));var rimraf=require(_0x387f('0x1'));var zipdir=require(_0x387f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x387f('0x3'));var moment=require(_0x387f('0x4'));var BPromise=require(_0x387f('0x5'));var Mustache=require('mustache');var util=require(_0x387f('0x6'));var path=require(_0x387f('0x7'));var sox=require('sox');var csv=require(_0x387f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x387f('0x9'));var squel=require(_0x387f('0xa'));var crypto=require(_0x387f('0xb'));var jsforce=require(_0x387f('0xc'));var deskjs=require(_0x387f('0xd'));var toCsv=require(_0x387f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x387f('0xe'));var qs=require(_0x387f('0xf'));var as=require(_0x387f('0x10'));var hardwareService=require(_0x387f('0x11'));var logger=require('../../config/logger')(_0x387f('0x12'));var utils=require(_0x387f('0x13'));var config=require(_0x387f('0x14'));var db=require(_0x387f('0x15'))['db'];var integrations=require(_0x387f('0x16'));var jayson=require(_0x387f('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0xa67403,_0x4b4dd7,_0x48361e){if(_0x48361e){var _0x557547=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x557547[_0x387f('0x18')](_0x4b4dd7)){return _0xa67403;}else{throw new db[(_0x387f('0x19'))]['ValidationError'](_0x387f('0x1a'));}}else{return _0xa67403;}}function respondWithRpcPromise(_0x396045,_0x5928d9,_0x3d87be,_0xa16ca1){return new BPromise(function(_0x5a5bec,_0x47d8a6){var _0xf029b6=_0xa16ca1||client;return _0xf029b6[_0x387f('0x1b')](_0x396045,_0x3d87be)[_0x387f('0x1c')](function(_0x8892){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x5928d9,_0x387f('0x1d'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5928d9,_0x387f('0x1d'),JSON[_0x387f('0x1e')](_0x8892));if(_0x8892[_0x387f('0x1f')]){if(_0x8892[_0x387f('0x1f')]['code']===0x1f4){logger[_0x387f('0x1f')](_0x387f('0x20'),_0x5928d9,_0x8892[_0x387f('0x1f')]['message']);return _0x47d8a6(_0x8892['error'][_0x387f('0x21')]);}logger[_0x387f('0x1f')](_0x387f('0x20'),_0x5928d9,_0x8892[_0x387f('0x1f')]['message']);return _0x5a5bec(_0x8892['error'][_0x387f('0x21')]);}else{logger[_0x387f('0x22')](_0x387f('0x20'),_0x5928d9,_0x387f('0x1d'));_0x5a5bec(_0x8892['result'][_0x387f('0x21')]);}})[_0x387f('0x23')](function(_0xd8f664){logger['error'](_0x387f('0x20'),_0x5928d9,_0xd8f664);_0x47d8a6(_0xd8f664);});});}function respondWithStatusCode(_0x292f52,_0x3c4450){_0x3c4450=_0x3c4450||0xcc;return function(_0x136113){if(_0x136113){return _0x292f52[_0x387f('0x24')](_0x3c4450);}return _0x292f52[_0x387f('0x25')](_0x3c4450)[_0x387f('0x26')]();};}function respondWithResult(_0x5e1ac8,_0xbbe09f){_0xbbe09f=_0xbbe09f||0xc8;return function(_0x225ac1){if(_0x225ac1){return _0x5e1ac8[_0x387f('0x25')](_0xbbe09f)[_0x387f('0x27')](_0x225ac1);}};}function respondWithFilteredResult(_0x41f487,_0x131274){return function(_0x12afa9){if(_0x12afa9){var _0x1949b6=_0x12afa9[_0x387f('0x28')],_0x3b7024=_0x131274[_0x387f('0x29')],_0xec885a=_0x131274[_0x387f('0x29')]+_0x131274[_0x387f('0x2a')],_0x51765c;if(_0xec885a>=_0x1949b6){_0xec885a=_0x1949b6;_0x51765c=0xc8;}else{_0x51765c=0xce;}_0x41f487[_0x387f('0x25')](_0x51765c);return _0x41f487[_0x387f('0x2b')](_0x387f('0x2c'),_0x3b7024+'-'+_0xec885a+'/'+_0x1949b6)[_0x387f('0x27')](_0x12afa9);}return null;};}function patchUpdates(_0x5d0866){return function(_0x5394ea){try{jsonpatch[_0x387f('0x2d')](_0x5394ea,_0x5d0866,!![]);}catch(_0x465387){return BPromise[_0x387f('0x2e')](_0x465387);}return _0x5394ea[_0x387f('0x2f')]();};}function saveUpdates(_0x5a94b9,_0x209dec){return function(_0x1976f8){if(_0x1976f8){return _0x1976f8[_0x387f('0x30')](_0x5a94b9)['then'](function(_0x17ec75){return _0x17ec75;});}return null;};}function removeEntity(_0x3ee95b,_0xf3edaf){return function(_0x208b91){if(_0x208b91){return _0x208b91[_0x387f('0x31')]()[_0x387f('0x1c')](function(){_0x3ee95b['status'](0xcc)[_0x387f('0x26')]();});}};}function handleEntityNotFound(_0x1a4cdf,_0x5cccf2){return function(_0x27605e){if(!_0x27605e){_0x1a4cdf[_0x387f('0x24')](0x194);}return _0x27605e;};}function handleError(_0x3e81a2,_0x500849){_0x500849=_0x500849||0x1f4;return function(_0x5e5c0b){logger['error'](_0x5e5c0b['stack']);if(_0x5e5c0b[_0x387f('0x32')]){delete _0x5e5c0b['name'];}_0x3e81a2[_0x387f('0x25')](_0x500849)[_0x387f('0x33')](_0x5e5c0b);};}exports[_0x387f('0x34')]=function(_0x361f1b,_0x2fb4ac){var _0x2b26aa={},_0x3aa02a={},_0x554993={'count':0x0,'rows':[]};var _0x4101cc=_[_0x387f('0x35')](db[_0x387f('0x36')]['rawAttributes'],function(_0x2b7d04){return{'name':_0x2b7d04[_0x387f('0x37')],'type':_0x2b7d04[_0x387f('0x38')][_0x387f('0x39')]};});_0x3aa02a[_0x387f('0x3a')]=_[_0x387f('0x35')](_0x4101cc,_0x387f('0x32'));_0x3aa02a[_0x387f('0x3b')]=_[_0x387f('0x3c')](_0x361f1b[_0x387f('0x3b')]);_0x3aa02a[_0x387f('0x3d')]=_['intersection'](_0x3aa02a[_0x387f('0x3a')],_0x3aa02a[_0x387f('0x3b')]);_0x2b26aa[_0x387f('0x3e')]=_[_0x387f('0x3f')](_0x3aa02a[_0x387f('0x3a')],qs[_0x387f('0x40')](_0x361f1b[_0x387f('0x3b')][_0x387f('0x40')]));_0x2b26aa['attributes']=_0x2b26aa['attributes']['length']?_0x2b26aa[_0x387f('0x3e')]:_0x3aa02a['model'];if(!_0x361f1b[_0x387f('0x3b')][_0x387f('0x41')](_0x387f('0x42'))){_0x2b26aa['limit']=qs[_0x387f('0x2a')](_0x361f1b['query'][_0x387f('0x2a')]);_0x2b26aa['offset']=qs[_0x387f('0x29')](_0x361f1b['query']['offset']);}_0x2b26aa[_0x387f('0x43')]=qs[_0x387f('0x44')](_0x361f1b[_0x387f('0x3b')]['sort']);_0x2b26aa[_0x387f('0x45')]=qs[_0x387f('0x3d')](_[_0x387f('0x46')](_0x361f1b[_0x387f('0x3b')],_0x3aa02a[_0x387f('0x3d')]),_0x4101cc);if(_0x361f1b['query'][_0x387f('0x47')]){_0x2b26aa[_0x387f('0x45')]=_[_0x387f('0x48')](_0x2b26aa[_0x387f('0x45')],{'$or':_[_0x387f('0x35')](_0x4101cc,function(_0x4fe4ca){if(_0x4fe4ca['type']!=='VIRTUAL'){var _0x30ee0f={};_0x30ee0f[_0x4fe4ca[_0x387f('0x32')]]={'$like':'%'+_0x361f1b[_0x387f('0x3b')][_0x387f('0x47')]+'%'};return _0x30ee0f;}})});}_0x2b26aa=_[_0x387f('0x48')]({},_0x2b26aa,_0x361f1b[_0x387f('0x49')]);var _0x14904a={'where':_0x2b26aa[_0x387f('0x45')]};return db[_0x387f('0x36')][_0x387f('0x28')](_0x14904a)[_0x387f('0x1c')](function(_0x144a57){_0x554993[_0x387f('0x28')]=_0x144a57;if(_0x361f1b[_0x387f('0x3b')][_0x387f('0x4a')]){_0x2b26aa['include']=[{'all':!![]}];}return db[_0x387f('0x36')][_0x387f('0x4b')](_0x2b26aa);})[_0x387f('0x1c')](function(_0x273f8b){_0x554993[_0x387f('0x4c')]=_0x273f8b;return _0x554993;})[_0x387f('0x1c')](respondWithFilteredResult(_0x2fb4ac,_0x2b26aa))[_0x387f('0x23')](handleError(_0x2fb4ac,null));};exports[_0x387f('0x4d')]=function(_0x465b7d,_0x182abd){var _0x273560={'raw':![],'where':{'id':_0x465b7d[_0x387f('0x4e')]['id']}},_0x5718d8={};_0x5718d8[_0x387f('0x3a')]=_[_0x387f('0x3c')](db[_0x387f('0x36')][_0x387f('0x4f')]);_0x5718d8[_0x387f('0x3b')]=_[_0x387f('0x3c')](_0x465b7d[_0x387f('0x3b')]);_0x5718d8[_0x387f('0x3d')]=_[_0x387f('0x3f')](_0x5718d8[_0x387f('0x3a')],_0x5718d8[_0x387f('0x3b')]);_0x273560[_0x387f('0x3e')]=_['intersection'](_0x5718d8[_0x387f('0x3a')],qs[_0x387f('0x40')](_0x465b7d[_0x387f('0x3b')][_0x387f('0x40')]));_0x273560['attributes']=_0x273560[_0x387f('0x3e')][_0x387f('0x50')]?_0x273560[_0x387f('0x3e')]:_0x5718d8[_0x387f('0x3a')];if(_0x465b7d[_0x387f('0x3b')][_0x387f('0x4a')]){_0x273560[_0x387f('0x51')]=[{'all':!![]}];}_0x273560=_['merge']({},_0x273560,_0x465b7d[_0x387f('0x49')]);return db[_0x387f('0x36')][_0x387f('0x52')](_0x273560)[_0x387f('0x1c')](handleEntityNotFound(_0x182abd,null))['then'](respondWithResult(_0x182abd,null))[_0x387f('0x23')](handleError(_0x182abd,null));};exports[_0x387f('0x53')]=function(_0x2b777d,_0x368b39){return db[_0x387f('0x36')][_0x387f('0x53')](_0x2b777d[_0x387f('0x54')],{})['then'](respondWithResult(_0x368b39,0xc9))[_0x387f('0x23')](handleError(_0x368b39,null));};exports[_0x387f('0x30')]=function(_0x518c3b,_0x35a8ec){if(_0x518c3b[_0x387f('0x54')]['id']){delete _0x518c3b['body']['id'];}return db[_0x387f('0x36')][_0x387f('0x52')]({'where':{'id':_0x518c3b[_0x387f('0x4e')]['id']}})[_0x387f('0x1c')](handleEntityNotFound(_0x35a8ec,null))[_0x387f('0x1c')](saveUpdates(_0x518c3b['body'],null))[_0x387f('0x1c')](respondWithResult(_0x35a8ec,null))[_0x387f('0x23')](handleError(_0x35a8ec,null));};exports[_0x387f('0x31')]=function(_0x46c5f3,_0x4ab236){return db[_0x387f('0x36')][_0x387f('0x52')]({'where':{'id':_0x46c5f3['params']['id']}})[_0x387f('0x1c')](handleEntityNotFound(_0x4ab236,null))['then'](removeEntity(_0x4ab236,null))[_0x387f('0x23')](handleError(_0x4ab236,null));};exports[_0x387f('0x55')]=function(_0x14e71e,_0x8e7ab8,_0x2d7c15){var _0x108b2c={};var _0x75e9a1={};var _0x1af69d;var _0xc91155;return db[_0x387f('0x36')]['findOne']({'where':{'id':_0x14e71e['params']['id']}})[_0x387f('0x1c')](handleEntityNotFound(_0x8e7ab8,null))[_0x387f('0x1c')](function(_0x306828){if(_0x306828){_0x1af69d=_0x306828;_0x75e9a1[_0x387f('0x3a')]=_[_0x387f('0x3c')](db[_0x387f('0x56')]['rawAttributes']);_0x75e9a1[_0x387f('0x3b')]=_[_0x387f('0x3c')](_0x14e71e['query']);_0x75e9a1[_0x387f('0x3d')]=_['intersection'](_0x75e9a1[_0x387f('0x3a')],_0x75e9a1[_0x387f('0x3b')]);_0x108b2c[_0x387f('0x3e')]=_[_0x387f('0x3f')](_0x75e9a1[_0x387f('0x3a')],qs[_0x387f('0x40')](_0x14e71e[_0x387f('0x3b')][_0x387f('0x40')]));_0x108b2c[_0x387f('0x3e')]=_0x108b2c[_0x387f('0x3e')][_0x387f('0x50')]?_0x108b2c[_0x387f('0x3e')]:_0x75e9a1['model'];_0x108b2c[_0x387f('0x43')]=qs[_0x387f('0x44')](_0x14e71e[_0x387f('0x3b')][_0x387f('0x44')]);_0x108b2c[_0x387f('0x45')]=qs[_0x387f('0x3d')](_['pick'](_0x14e71e[_0x387f('0x3b')],_0x75e9a1[_0x387f('0x3d')]));if(_0x14e71e[_0x387f('0x3b')]['filter']){_0x108b2c[_0x387f('0x45')]=_[_0x387f('0x48')](_0x108b2c[_0x387f('0x45')],{'$or':_[_0x387f('0x35')](_0x108b2c[_0x387f('0x3e')],function(_0x12fb64){var _0xcd953a={};_0xcd953a[_0x12fb64]={'$like':'%'+_0x14e71e[_0x387f('0x3b')][_0x387f('0x47')]+'%'};return _0xcd953a;})});}_0x108b2c=_[_0x387f('0x48')]({},_0x108b2c,_0x14e71e[_0x387f('0x49')]);return _0x1af69d[_0x387f('0x55')](_0x108b2c);}})['then'](function(_0x1d15e3){if(_0x1d15e3){_0xc91155=_0x1d15e3[_0x387f('0x50')];if(!_0x14e71e['query'][_0x387f('0x41')](_0x387f('0x42'))){_0x108b2c[_0x387f('0x2a')]=qs['limit'](_0x14e71e[_0x387f('0x3b')][_0x387f('0x2a')]);_0x108b2c[_0x387f('0x29')]=qs[_0x387f('0x29')](_0x14e71e[_0x387f('0x3b')]['offset']);}return _0x1af69d[_0x387f('0x55')](_0x108b2c);}})[_0x387f('0x1c')](function(_0x52ba65){if(_0x52ba65){return _0x52ba65?{'count':_0xc91155,'rows':_0x52ba65}:null;}})[_0x387f('0x1c')](respondWithResult(_0x8e7ab8,null))['catch'](handleError(_0x8e7ab8,null));};exports[_0x387f('0x57')]=function(_0x8b5fba,_0x17dad4,_0x4f3873){if(_0x8b5fba[_0x387f('0x54')]['id']){delete _0x8b5fba['body']['id'];}return db['ServicenowAccount'][_0x387f('0x58')]({'where':{'id':_0x8b5fba[_0x387f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17dad4,null))[_0x387f('0x1c')](function(_0x59afaa){if(_0x59afaa){_0x8b5fba[_0x387f('0x54')][_0x387f('0x59')]=_0x59afaa['id'];_0x8b5fba['body'][_0x387f('0x5a')]=integrations[_0x387f('0x5b')](_0x8b5fba['body']['channel'],_0x8b5fba[_0x387f('0x54')][_0x387f('0x38')]);_0x8b5fba[_0x387f('0x54')][_0x387f('0x5c')]=integrations['getDescriptions'](_0x8b5fba[_0x387f('0x54')]['channel'],_0x8b5fba[_0x387f('0x54')]['type']);return db['ServicenowConfiguration'][_0x387f('0x53')](_0x8b5fba[_0x387f('0x54')],{'include':[{'model':db['ServicenowField'],'as':_0x387f('0x5a')},{'model':db[_0x387f('0x5d')],'as':'Descriptions'}]});}return null;})[_0x387f('0x1c')](respondWithResult(_0x17dad4,null))[_0x387f('0x23')](handleError(_0x17dad4,null));};exports[_0x387f('0x5e')]=function(_0x119742,_0x49fae8,_0x32f030){var _0x53a86a=[_0x387f('0x5f'),_0x387f('0x60'),_0x387f('0x61'),'subcategory',_0x387f('0x62'),'notify',_0x387f('0x63'),_0x387f('0x64'),_0x387f('0x65')];var _0x4a1deb=[_0x387f('0x66'),_0x387f('0x5f'),_0x387f('0x67'),_0x387f('0x68'),_0x387f('0x69'),_0x387f('0x6a'),_0x387f('0x6b'),_0x387f('0x60'),_0x387f('0x6c'),_0x387f('0x6d'),_0x387f('0x6e'),_0x387f('0x6f'),_0x387f('0x70'),_0x387f('0x71'),'sys_created_on',_0x387f('0x72'),_0x387f('0x73'),'sys_created_by',_0x387f('0x61'),_0x387f('0x43'),'calendar_stc',_0x387f('0x74'),_0x387f('0x75'),_0x387f('0x76'),'impact',_0x387f('0x77'),_0x387f('0x78'),_0x387f('0x79'),'priority','sys_domain_path','rfc','time_worked','expected_start',_0x387f('0x7a'),'business_duration',_0x387f('0x7b'),_0x387f('0x7c'),_0x387f('0x7d'),_0x387f('0x7e'),'caller_id',_0x387f('0x7f'),_0x387f('0x80'),_0x387f('0x81'),_0x387f('0x82'),_0x387f('0x62'),_0x387f('0x83'),_0x387f('0x84'),_0x387f('0x85'),_0x387f('0x86'),_0x387f('0x87'),'additional_assignee_list',_0x387f('0x88'),_0x387f('0x89'),_0x387f('0x8a'),_0x387f('0x8b'),_0x387f('0x8c'),_0x387f('0x8d'),_0x387f('0x8e'),_0x387f('0x8f'),_0x387f('0x90'),_0x387f('0x91'),'reopened_by','incident_state','urgency',_0x387f('0x92'),'company',_0x387f('0x93'),_0x387f('0x94'),_0x387f('0x95'),'severity',_0x387f('0x96'),_0x387f('0x97'),_0x387f('0x98'),_0x387f('0x99'),_0x387f('0x9a'),_0x387f('0x9b'),_0x387f('0x9c'),_0x387f('0x9d'),'escalation',_0x387f('0x9e'),'correlation_id',_0x387f('0x9f'),_0x387f('0x65')];var _0x53076d='';var _0x13988d='';var _0xd7941a=[];var _0x59e7e6='';var _0xb9e74a='';var _0x5dac4a=[];var _0x49692b='';var _0x485c31='';var _0x19716d={};var _0xc80621='';return db[_0x387f('0x36')][_0x387f('0x58')]({'where':{'id':_0x119742['params']['id']},'attributes':['id','username',_0x387f('0xa0'),_0x387f('0xa1'),'remoteUri',_0x387f('0xa2')]})['then'](handleEntityNotFound(_0x49fae8,null))[_0x387f('0x1c')](function(_0x4d9ac1){if(_0x4d9ac1){_0xc80621=_0x4d9ac1['remoteUri'];var _0x47befc=_0xc80621[_0x387f('0xa3')](-0x1);if(_0x47befc==='/'){_0xc80621=_0xc80621[_0x387f('0xa4')](0x0,_0xc80621[_0x387f('0xa5')](_0x47befc));}_0x485c31=util['format'](_0x387f('0xa6'),_0xc80621);_0x49692b=util[_0x387f('0xa7')](_0x387f('0xa8'),_0xc80621);_0x19716d={'user':_0x4d9ac1['username'],'pass':_0x4d9ac1['password']};var _0x5c1738={'method':_0x387f('0xa9'),'uri':_0x485c31+_0x387f('0xaa'),'auth':_0x19716d,'json':!![]};return rp(_0x5c1738);}})[_0x387f('0x1c')](function(_0x4e295f){if(_0x4e295f[_0x387f('0xab')][_0x387f('0x50')]>0x0){_0x53076d=_0x4e295f[_0x387f('0xab')];}console[_0x387f('0xac')](_0x387f('0xad'),_0x53076d);_0x5dac4a=[];_0x13988d=Object[_0x387f('0xae')]([],_0x53076d);_[_0x387f('0xaf')](_0x13988d,function(_0x47508f){return!_0x53a86a['includes'](_0x47508f[_0x387f('0x32')]);});_0x13988d[_0x387f('0xb0')](function(_0x307e1f){var _0x407fdd=createFieldObject(_0x49692b,_0x19716d,_0x307e1f[_0x387f('0xb1')],_0x307e1f['name'],_0x307e1f['label'],![]);_0x5dac4a[_0x387f('0xb2')](_0x407fdd);});return Promise[_0x387f('0xb3')](_0x5dac4a);})[_0x387f('0x1c')](function(_0xbeb72d){_0xd7941a=_0xbeb72d;_0x59e7e6=Object[_0x387f('0xae')]([],_0x53076d);console['log'](_0x387f('0xb4'),_0x53076d);_[_0x387f('0xaf')](_0x59e7e6,function(_0x5d13a2){return _0x4a1deb[_0x387f('0xb5')](_0x5d13a2['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x59e7e6);_0x5dac4a=[];_0x59e7e6[_0x387f('0xb0')](function(_0x366437){var _0x17ccaf=createFieldObject(_0x49692b,_0x19716d,_0x366437['internalType'],_0x366437[_0x387f('0x32')],_0x366437[_0x387f('0xb6')],!![]);_0x5dac4a[_0x387f('0xb2')](_0x17ccaf);});return Promise[_0x387f('0xb3')](_0x5dac4a);})[_0x387f('0x1c')](function(_0x2eb567){_0xb9e74a=_0x2eb567;var _0x395d5e=_0xd7941a[_0x387f('0xb7')](_0xb9e74a);return{'count':_0x395d5e[_0x387f('0x50')],'rows':_0x395d5e};})['then'](respondWithResult(_0x49fae8,null))[_0x387f('0x23')](function(_0x297a50){console['log'](_0x387f('0xb8')+_0x297a50);var _0x28ea2e=_0x119742[_0x387f('0x3b')][_0x387f('0x18')]?0x1f4:_0x297a50[_0x387f('0xb9')]||0x1f4;logger['error'](_0x297a50['stack']);delete _0x297a50['name'];if(_0x28ea2e===0x191){_0x28ea2e=0x190;}_0x49fae8[_0x387f('0x25')](_0x28ea2e)[_0x387f('0x33')](_0x119742[_0x387f('0x3b')]['test']?{'message':_0x387f('0xba'),'statusCode':_0x297a50['statusCode']}:_0x297a50);});};function createFieldObject(_0x399ca8,_0x737aed,_0x1fec64,_0x38e16a,_0x369d66,_0x4eb5d1){return new Promise(function(_0x4097d8,_0x129a27){var _0x48c8ac={'id':_0x38e16a,'name':_0x369d66,'custom':_0x4eb5d1};if(_0x1fec64==='boolean'){_0x48c8ac['options']=[{'name':_0x387f('0xbb'),'value':_0x387f('0xbc')},{'name':'False','value':'false'}];_0x4097d8(_0x48c8ac);}else{var _0x58c7ef={'method':_0x387f('0xa9'),'uri':_0x399ca8+_0x387f('0xbd')+_0x38e16a,'auth':_0x737aed,'json':!![]};return rp(_0x58c7ef)[_0x387f('0x1c')](function(_0x4c23a9){var _0xc66552=[];if(_0x4c23a9[_0x387f('0xab')][_0x387f('0x50')]>0x0){_0x4c23a9[_0x387f('0xab')]['forEach'](function(_0x573d3d){if(_0x573d3d[_0x387f('0xbe')]===_0x387f('0xbf')){var _0x589ffd={'name':_0x573d3d[_0x387f('0xb6')],'value':_0x573d3d[_0x387f('0xc0')]};_0xc66552[_0x387f('0xb2')](_0x589ffd);}});}_0x48c8ac[_0x387f('0x49')]=_0xc66552;if(_0x48c8ac['options'][_0x387f('0x50')]>0x0){_0x4097d8(_0x48c8ac);}else{if(_0x4eb5d1==![]){_0x4097d8();}else{_0x4097d8(_0x48c8ac);}}});}});} \ No newline at end of file +var _0x13d1=['debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','catch','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','ServicenowAccount','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','channel','getDescriptions','Subjects','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','urgency','company','activity_due','assigned_to','comments','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','category','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','incident?sysparm_display_value=all','result','log','assign','remove','includes','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','concat','statusCode','Wrong\x20credentials','True','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent'];(function(_0x3e2b13,_0x240522){var _0x38bcb4=function(_0x34c27e){while(--_0x34c27e){_0x3e2b13['push'](_0x3e2b13['shift']());}};_0x38bcb4(++_0x240522);}(_0x13d1,0xa3));var _0x113d=function(_0x473806,_0xcd4d75){_0x473806=_0x473806-0x0;var _0x4aca29=_0x13d1[_0x473806];return _0x4aca29;};'use strict';var pdf=require(_0x113d('0x0'));var emlformat=require(_0x113d('0x1'));var rimraf=require(_0x113d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x113d('0x3'));var rp=require(_0x113d('0x4'));var moment=require(_0x113d('0x5'));var BPromise=require(_0x113d('0x6'));var Mustache=require('mustache');var util=require(_0x113d('0x7'));var path=require(_0x113d('0x8'));var sox=require(_0x113d('0x9'));var csv=require(_0x113d('0xa'));var ejs=require(_0x113d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x113d('0xc'));var crypto=require(_0x113d('0xd'));var jsforce=require(_0x113d('0xe'));var deskjs=require(_0x113d('0xf'));var toCsv=require(_0x113d('0xa'));var querystring=require('querystring');var Papa=require(_0x113d('0x10'));var Redis=require(_0x113d('0x11'));var authService=require(_0x113d('0x12'));var qs=require(_0x113d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x113d('0x14'))(_0x113d('0x15'));var utils=require(_0x113d('0x16'));var config=require(_0x113d('0x17'));var db=require(_0x113d('0x18'))['db'];var integrations=require(_0x113d('0x19'));var jayson=require(_0x113d('0x1a'));var client=jayson[_0x113d('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x1feede,_0x3e56bc,_0x305055){if(_0x305055){var _0x1e37ed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e37ed[_0x113d('0x1c')](_0x3e56bc)){return _0x1feede;}else{throw new db[(_0x113d('0x1d'))][(_0x113d('0x1e'))](_0x113d('0x1f'));}}else{return _0x1feede;}}function respondWithRpcPromise(_0x36c9d4,_0x519f8c,_0x4b85e3,_0xf79b27){return new BPromise(function(_0x1ab4af,_0x1bba84){var _0x54a740=_0xf79b27||client;return _0x54a740[_0x113d('0x20')](_0x36c9d4,_0x4b85e3)[_0x113d('0x21')](function(_0x339470){logger[_0x113d('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x519f8c,_0x113d('0x23'));logger[_0x113d('0x24')](_0x113d('0x25'),_0x519f8c,_0x113d('0x23'),JSON[_0x113d('0x26')](_0x339470));if(_0x339470[_0x113d('0x27')]){if(_0x339470[_0x113d('0x27')]['code']===0x1f4){logger[_0x113d('0x27')](_0x113d('0x28'),_0x519f8c,_0x339470['error'][_0x113d('0x29')]);return _0x1bba84(_0x339470[_0x113d('0x27')][_0x113d('0x29')]);}logger[_0x113d('0x27')](_0x113d('0x28'),_0x519f8c,_0x339470[_0x113d('0x27')][_0x113d('0x29')]);return _0x1ab4af(_0x339470[_0x113d('0x27')]['message']);}else{logger[_0x113d('0x22')]('ServicenowAccount,\x20%s,\x20%s',_0x519f8c,_0x113d('0x23'));_0x1ab4af(_0x339470['result']['message']);}})[_0x113d('0x2a')](function(_0x40649e){logger[_0x113d('0x27')](_0x113d('0x28'),_0x519f8c,_0x40649e);_0x1bba84(_0x40649e);});});}function respondWithStatusCode(_0x66a3f2,_0x4fa5b1){_0x4fa5b1=_0x4fa5b1||0xcc;return function(_0x1f6f6e){if(_0x1f6f6e){return _0x66a3f2['sendStatus'](_0x4fa5b1);}return _0x66a3f2[_0x113d('0x2b')](_0x4fa5b1)[_0x113d('0x2c')]();};}function respondWithResult(_0xdf6aff,_0x3789cf){_0x3789cf=_0x3789cf||0xc8;return function(_0x4a8030){if(_0x4a8030){return _0xdf6aff[_0x113d('0x2b')](_0x3789cf)[_0x113d('0x2d')](_0x4a8030);}};}function respondWithFilteredResult(_0xc66328,_0xf5eef1){return function(_0x18e7a9){if(_0x18e7a9){var _0x24b58f=_0x18e7a9[_0x113d('0x2e')],_0x78b58c=_0xf5eef1[_0x113d('0x2f')],_0x46fbad=_0xf5eef1['offset']+_0xf5eef1[_0x113d('0x30')],_0x4200ac;if(_0x46fbad>=_0x24b58f){_0x46fbad=_0x24b58f;_0x4200ac=0xc8;}else{_0x4200ac=0xce;}_0xc66328[_0x113d('0x2b')](_0x4200ac);return _0xc66328[_0x113d('0x31')]('Content-Range',_0x78b58c+'-'+_0x46fbad+'/'+_0x24b58f)[_0x113d('0x2d')](_0x18e7a9);}return null;};}function patchUpdates(_0x1d6380){return function(_0x2ca8ef){try{jsonpatch[_0x113d('0x32')](_0x2ca8ef,_0x1d6380,!![]);}catch(_0x454003){return BPromise[_0x113d('0x33')](_0x454003);}return _0x2ca8ef[_0x113d('0x34')]();};}function saveUpdates(_0x2db53c,_0x14b196){return function(_0x1dc78e){if(_0x1dc78e){return _0x1dc78e[_0x113d('0x35')](_0x2db53c)[_0x113d('0x21')](function(_0x57f7ae){return _0x57f7ae;});}return null;};}function removeEntity(_0x1842b6,_0x32fe5e){return function(_0x5c9048){if(_0x5c9048){return _0x5c9048[_0x113d('0x36')]()['then'](function(){_0x1842b6[_0x113d('0x2b')](0xcc)[_0x113d('0x2c')]();});}};}function handleEntityNotFound(_0x34e9e4,_0x3c80e3){return function(_0x50e5a1){if(!_0x50e5a1){_0x34e9e4[_0x113d('0x37')](0x194);}return _0x50e5a1;};}function handleError(_0x3a84d9,_0x4a7aa0){_0x4a7aa0=_0x4a7aa0||0x1f4;return function(_0x36d69e){logger[_0x113d('0x27')](_0x36d69e[_0x113d('0x38')]);if(_0x36d69e[_0x113d('0x39')]){delete _0x36d69e[_0x113d('0x39')];}_0x3a84d9['status'](_0x4a7aa0)[_0x113d('0x3a')](_0x36d69e);};}exports[_0x113d('0x3b')]=function(_0x1395a7,_0x29e89a){var _0x1e2651={},_0x12a781={},_0x28e108={'count':0x0,'rows':[]};var _0x45214c=_[_0x113d('0x3c')](db[_0x113d('0x3d')]['rawAttributes'],function(_0x2973e6){return{'name':_0x2973e6['fieldName'],'type':_0x2973e6[_0x113d('0x3e')][_0x113d('0x3f')]};});_0x12a781[_0x113d('0x40')]=_[_0x113d('0x3c')](_0x45214c,_0x113d('0x39'));_0x12a781['query']=_[_0x113d('0x41')](_0x1395a7[_0x113d('0x42')]);_0x12a781[_0x113d('0x43')]=_[_0x113d('0x44')](_0x12a781[_0x113d('0x40')],_0x12a781[_0x113d('0x42')]);_0x1e2651[_0x113d('0x45')]=_['intersection'](_0x12a781['model'],qs[_0x113d('0x46')](_0x1395a7['query'][_0x113d('0x46')]));_0x1e2651[_0x113d('0x45')]=_0x1e2651['attributes'][_0x113d('0x47')]?_0x1e2651[_0x113d('0x45')]:_0x12a781[_0x113d('0x40')];if(!_0x1395a7[_0x113d('0x42')][_0x113d('0x48')](_0x113d('0x49'))){_0x1e2651[_0x113d('0x30')]=qs[_0x113d('0x30')](_0x1395a7['query'][_0x113d('0x30')]);_0x1e2651[_0x113d('0x2f')]=qs['offset'](_0x1395a7['query']['offset']);}_0x1e2651[_0x113d('0x4a')]=qs[_0x113d('0x4b')](_0x1395a7[_0x113d('0x42')][_0x113d('0x4b')]);_0x1e2651['where']=qs[_0x113d('0x43')](_[_0x113d('0x4c')](_0x1395a7[_0x113d('0x42')],_0x12a781['filters']),_0x45214c);if(_0x1395a7['query'][_0x113d('0x4d')]){_0x1e2651[_0x113d('0x4e')]=_[_0x113d('0x4f')](_0x1e2651[_0x113d('0x4e')],{'$or':_[_0x113d('0x3c')](_0x45214c,function(_0x2f8a3b){if(_0x2f8a3b['type']!==_0x113d('0x50')){var _0x46186a={};_0x46186a[_0x2f8a3b['name']]={'$like':'%'+_0x1395a7[_0x113d('0x42')][_0x113d('0x4d')]+'%'};return _0x46186a;}})});}_0x1e2651=_[_0x113d('0x4f')]({},_0x1e2651,_0x1395a7[_0x113d('0x51')]);var _0x8b558e={'where':_0x1e2651['where']};return db[_0x113d('0x3d')]['count'](_0x8b558e)[_0x113d('0x21')](function(_0x5e2551){_0x28e108[_0x113d('0x2e')]=_0x5e2551;if(_0x1395a7[_0x113d('0x42')][_0x113d('0x52')]){_0x1e2651['include']=[{'all':!![]}];}return db[_0x113d('0x3d')][_0x113d('0x53')](_0x1e2651);})['then'](function(_0x4de7aa){_0x28e108[_0x113d('0x54')]=_0x4de7aa;return _0x28e108;})[_0x113d('0x21')](respondWithFilteredResult(_0x29e89a,_0x1e2651))['catch'](handleError(_0x29e89a,null));};exports[_0x113d('0x55')]=function(_0x3072e3,_0x4bad4e){var _0x1a3b0e={'raw':![],'where':{'id':_0x3072e3[_0x113d('0x56')]['id']}},_0x2f6595={};_0x2f6595[_0x113d('0x40')]=_['keys'](db[_0x113d('0x3d')][_0x113d('0x57')]);_0x2f6595[_0x113d('0x42')]=_[_0x113d('0x41')](_0x3072e3[_0x113d('0x42')]);_0x2f6595[_0x113d('0x43')]=_[_0x113d('0x44')](_0x2f6595['model'],_0x2f6595[_0x113d('0x42')]);_0x1a3b0e[_0x113d('0x45')]=_[_0x113d('0x44')](_0x2f6595[_0x113d('0x40')],qs[_0x113d('0x46')](_0x3072e3[_0x113d('0x42')][_0x113d('0x46')]));_0x1a3b0e[_0x113d('0x45')]=_0x1a3b0e[_0x113d('0x45')]['length']?_0x1a3b0e[_0x113d('0x45')]:_0x2f6595['model'];if(_0x3072e3[_0x113d('0x42')][_0x113d('0x52')]){_0x1a3b0e[_0x113d('0x58')]=[{'all':!![]}];}_0x1a3b0e=_[_0x113d('0x4f')]({},_0x1a3b0e,_0x3072e3[_0x113d('0x51')]);return db[_0x113d('0x3d')][_0x113d('0x59')](_0x1a3b0e)[_0x113d('0x21')](handleEntityNotFound(_0x4bad4e,null))[_0x113d('0x21')](respondWithResult(_0x4bad4e,null))['catch'](handleError(_0x4bad4e,null));};exports['create']=function(_0x57200e,_0x4444f6){return db[_0x113d('0x3d')][_0x113d('0x5a')](_0x57200e[_0x113d('0x5b')],{})[_0x113d('0x21')](respondWithResult(_0x4444f6,0xc9))[_0x113d('0x2a')](handleError(_0x4444f6,null));};exports[_0x113d('0x35')]=function(_0x5e7502,_0x4c272e){if(_0x5e7502[_0x113d('0x5b')]['id']){delete _0x5e7502[_0x113d('0x5b')]['id'];}return db[_0x113d('0x3d')][_0x113d('0x59')]({'where':{'id':_0x5e7502['params']['id']}})['then'](handleEntityNotFound(_0x4c272e,null))[_0x113d('0x21')](saveUpdates(_0x5e7502[_0x113d('0x5b')],null))[_0x113d('0x21')](respondWithResult(_0x4c272e,null))[_0x113d('0x2a')](handleError(_0x4c272e,null));};exports[_0x113d('0x36')]=function(_0x4cac62,_0x17e6fa){return db[_0x113d('0x3d')]['find']({'where':{'id':_0x4cac62['params']['id']}})[_0x113d('0x21')](handleEntityNotFound(_0x17e6fa,null))[_0x113d('0x21')](removeEntity(_0x17e6fa,null))[_0x113d('0x2a')](handleError(_0x17e6fa,null));};exports[_0x113d('0x5c')]=function(_0xf34c52,_0x3ca167,_0x27c395){var _0x211a64={};var _0x1cc166={};var _0x4b51e5;var _0x3aedf5;return db[_0x113d('0x3d')][_0x113d('0x5d')]({'where':{'id':_0xf34c52[_0x113d('0x56')]['id']}})[_0x113d('0x21')](handleEntityNotFound(_0x3ca167,null))['then'](function(_0x25bbed){if(_0x25bbed){_0x4b51e5=_0x25bbed;_0x1cc166[_0x113d('0x40')]=_[_0x113d('0x41')](db[_0x113d('0x5e')][_0x113d('0x57')]);_0x1cc166['query']=_['keys'](_0xf34c52['query']);_0x1cc166[_0x113d('0x43')]=_[_0x113d('0x44')](_0x1cc166[_0x113d('0x40')],_0x1cc166[_0x113d('0x42')]);_0x211a64[_0x113d('0x45')]=_[_0x113d('0x44')](_0x1cc166['model'],qs[_0x113d('0x46')](_0xf34c52[_0x113d('0x42')][_0x113d('0x46')]));_0x211a64[_0x113d('0x45')]=_0x211a64[_0x113d('0x45')][_0x113d('0x47')]?_0x211a64[_0x113d('0x45')]:_0x1cc166[_0x113d('0x40')];_0x211a64['order']=qs[_0x113d('0x4b')](_0xf34c52[_0x113d('0x42')][_0x113d('0x4b')]);_0x211a64[_0x113d('0x4e')]=qs[_0x113d('0x43')](_['pick'](_0xf34c52['query'],_0x1cc166[_0x113d('0x43')]));if(_0xf34c52[_0x113d('0x42')][_0x113d('0x4d')]){_0x211a64[_0x113d('0x4e')]=_[_0x113d('0x4f')](_0x211a64[_0x113d('0x4e')],{'$or':_[_0x113d('0x3c')](_0x211a64[_0x113d('0x45')],function(_0x51fc3c){var _0x45c1ee={};_0x45c1ee[_0x51fc3c]={'$like':'%'+_0xf34c52[_0x113d('0x42')][_0x113d('0x4d')]+'%'};return _0x45c1ee;})});}_0x211a64=_[_0x113d('0x4f')]({},_0x211a64,_0xf34c52['options']);return _0x4b51e5['getConfigurations'](_0x211a64);}})[_0x113d('0x21')](function(_0x2ef8d4){if(_0x2ef8d4){_0x3aedf5=_0x2ef8d4['length'];if(!_0xf34c52[_0x113d('0x42')][_0x113d('0x48')]('nolimit')){_0x211a64[_0x113d('0x30')]=qs[_0x113d('0x30')](_0xf34c52['query'][_0x113d('0x30')]);_0x211a64[_0x113d('0x2f')]=qs[_0x113d('0x2f')](_0xf34c52[_0x113d('0x42')][_0x113d('0x2f')]);}return _0x4b51e5[_0x113d('0x5c')](_0x211a64);}})['then'](function(_0x1545f9){if(_0x1545f9){return _0x1545f9?{'count':_0x3aedf5,'rows':_0x1545f9}:null;}})[_0x113d('0x21')](respondWithResult(_0x3ca167,null))[_0x113d('0x2a')](handleError(_0x3ca167,null));};exports[_0x113d('0x5f')]=function(_0x368441,_0xa0b66,_0xd7b621){if(_0x368441['body']['id']){delete _0x368441[_0x113d('0x5b')]['id'];}return db[_0x113d('0x3d')][_0x113d('0x5d')]({'where':{'id':_0x368441[_0x113d('0x56')]['id']}})[_0x113d('0x21')](handleEntityNotFound(_0xa0b66,null))[_0x113d('0x21')](function(_0x276950){if(_0x276950){_0x368441[_0x113d('0x5b')][_0x113d('0x60')]=_0x276950['id'];_0x368441[_0x113d('0x5b')]['Subjects']=integrations['getSubjects'](_0x368441[_0x113d('0x5b')][_0x113d('0x61')],_0x368441[_0x113d('0x5b')][_0x113d('0x3e')]);_0x368441[_0x113d('0x5b')]['Descriptions']=integrations[_0x113d('0x62')](_0x368441[_0x113d('0x5b')][_0x113d('0x61')],_0x368441['body'][_0x113d('0x3e')]);return db[_0x113d('0x5e')][_0x113d('0x5a')](_0x368441[_0x113d('0x5b')],{'include':[{'model':db['ServicenowField'],'as':_0x113d('0x63')},{'model':db[_0x113d('0x64')],'as':_0x113d('0x65')}]});}return null;})[_0x113d('0x21')](respondWithResult(_0xa0b66,null))[_0x113d('0x2a')](handleError(_0xa0b66,null));};exports[_0x113d('0x66')]=function(_0x35af26,_0x30573c,_0xea5da4){var _0x54f49c=[_0x113d('0x67'),_0x113d('0x68'),_0x113d('0x69'),_0x113d('0x6a'),_0x113d('0x6b'),_0x113d('0x6c'),_0x113d('0x6d'),_0x113d('0x6e'),'category'];var _0x21cc0c=[_0x113d('0x6f'),_0x113d('0x67'),'caused_by','watch_list',_0x113d('0x70'),_0x113d('0x71'),'child_incidents',_0x113d('0x68'),'approval_history',_0x113d('0x72'),_0x113d('0x73'),_0x113d('0x74'),_0x113d('0x75'),_0x113d('0x76'),_0x113d('0x77'),_0x113d('0x78'),_0x113d('0x79'),'sys_created_by',_0x113d('0x69'),_0x113d('0x4a'),'calendar_stc','closed_at',_0x113d('0x7a'),_0x113d('0x7b'),_0x113d('0x7c'),_0x113d('0x7d'),_0x113d('0x7e'),_0x113d('0x7f'),_0x113d('0x80'),_0x113d('0x81'),_0x113d('0x82'),_0x113d('0x83'),'expected_start',_0x113d('0x84'),_0x113d('0x85'),_0x113d('0x86'),_0x113d('0x87'),_0x113d('0x88'),_0x113d('0x89'),'caller_id',_0x113d('0x8a'),'subcategory',_0x113d('0x8b'),_0x113d('0x8c'),_0x113d('0x6b'),_0x113d('0x8d'),_0x113d('0x8e'),_0x113d('0x8f'),_0x113d('0x90'),_0x113d('0x91'),'additional_assignee_list','description',_0x113d('0x92'),_0x113d('0x6c'),_0x113d('0x93'),_0x113d('0x94'),_0x113d('0x95'),_0x113d('0x96'),_0x113d('0x97'),'sys_id',_0x113d('0x98'),'reopened_by',_0x113d('0x6d'),_0x113d('0x99'),'problem_id',_0x113d('0x9a'),'reassignment_count',_0x113d('0x9b'),_0x113d('0x9c'),_0x113d('0x6e'),_0x113d('0x9d'),'sla_due',_0x113d('0x9e'),'comments_and_work_notes',_0x113d('0x9f'),_0x113d('0xa0'),_0x113d('0xa1'),_0x113d('0xa2'),_0x113d('0xa3'),'upon_approval',_0x113d('0xa4'),_0x113d('0xa5'),_0x113d('0xa6')];var _0x5571ed='';var _0x299bbc='';var _0x5a83f8=[];var _0x3bd7b1='';var _0x4192bd='';var _0x38f4f8=[];var _0x4d6c4e='';var _0x23d4d9='';var _0x55e513={};var _0x267ab3='';return db[_0x113d('0x3d')]['findOne']({'where':{'id':_0x35af26[_0x113d('0x56')]['id']},'attributes':['id','username','password',_0x113d('0xa7'),'remoteUri',_0x113d('0xa8')]})[_0x113d('0x21')](handleEntityNotFound(_0x30573c,null))[_0x113d('0x21')](function(_0x3604f6){if(_0x3604f6){_0x267ab3=_0x3604f6[_0x113d('0xa9')];var _0x5776b6=_0x267ab3[_0x113d('0xaa')](-0x1);if(_0x5776b6==='/'){_0x267ab3=_0x267ab3[_0x113d('0xab')](0x0,_0x267ab3[_0x113d('0xac')](_0x5776b6));}_0x23d4d9=util[_0x113d('0xad')](_0x113d('0xae'),_0x267ab3);_0x4d6c4e=util['format'](_0x113d('0xaf'),_0x267ab3);_0x55e513={'user':_0x3604f6[_0x113d('0xb0')],'pass':_0x3604f6['password']};var _0x344674={'method':'GET','uri':_0x23d4d9+_0x113d('0xb1'),'auth':_0x55e513,'json':!![]};return rp(_0x344674);}})[_0x113d('0x21')](function(_0x1987ef){if(_0x1987ef[_0x113d('0xb2')][_0x113d('0x47')]>0x0){_0x5571ed=_0x1987ef[_0x113d('0xb2')];}console[_0x113d('0xb3')]('incident\x20table\x20objects',_0x5571ed);_0x38f4f8=[];_0x299bbc=Object[_0x113d('0xb4')]([],_0x5571ed);_[_0x113d('0xb5')](_0x299bbc,function(_0x1b4fc9){return!_0x54f49c[_0x113d('0xb6')](_0x1b4fc9[_0x113d('0x39')]);});_0x299bbc['forEach'](function(_0x475e30){var _0x104868=createFieldObject(_0x4d6c4e,_0x55e513,_0x475e30['internalType'],_0x475e30['name'],_0x475e30[_0x113d('0xb7')],![]);_0x38f4f8[_0x113d('0xb8')](_0x104868);});return Promise['all'](_0x38f4f8);})[_0x113d('0x21')](function(_0x58ccdf){_0x5a83f8=_0x58ccdf;_0x3bd7b1=Object[_0x113d('0xb4')]([],_0x5571ed);console[_0x113d('0xb3')](_0x113d('0xb9'),_0x5571ed);_['remove'](_0x3bd7b1,function(_0x28eaf4){return _0x21cc0c['includes'](_0x28eaf4[_0x113d('0x39')]);});console[_0x113d('0xb3')](_0x113d('0xba'),_0x3bd7b1);_0x38f4f8=[];_0x3bd7b1[_0x113d('0xbb')](function(_0x56c0a2){var _0x24b26b=createFieldObject(_0x4d6c4e,_0x55e513,_0x56c0a2[_0x113d('0xbc')],_0x56c0a2[_0x113d('0x39')],_0x56c0a2[_0x113d('0xb7')],!![]);_0x38f4f8[_0x113d('0xb8')](_0x24b26b);});return Promise['all'](_0x38f4f8);})[_0x113d('0x21')](function(_0x5bac1e){_0x4192bd=_0x5bac1e;var _0x4bc034=_0x5a83f8[_0x113d('0xbd')](_0x4192bd);return{'count':_0x4bc034[_0x113d('0x47')],'rows':_0x4bc034};})[_0x113d('0x21')](respondWithResult(_0x30573c,null))[_0x113d('0x2a')](function(_0x3e638f){console['log']('ServiceNow\x20error:\x20'+_0x3e638f);var _0x824d64=_0x35af26[_0x113d('0x42')][_0x113d('0x1c')]?0x1f4:_0x3e638f[_0x113d('0xbe')]||0x1f4;logger['error'](_0x3e638f[_0x113d('0x38')]);delete _0x3e638f[_0x113d('0x39')];if(_0x824d64===0x191){_0x824d64=0x190;}_0x30573c['status'](_0x824d64)[_0x113d('0x3a')](_0x35af26[_0x113d('0x42')]['test']?{'message':_0x113d('0xbf'),'statusCode':_0x3e638f[_0x113d('0xbe')]}:_0x3e638f);});};function createFieldObject(_0x3e75de,_0x516220,_0x2c0981,_0x3b3024,_0x1b8fb3,_0x533c17){return new Promise(function(_0x316061,_0x49ee81){var _0x36030f={'id':_0x3b3024,'name':_0x1b8fb3,'custom':_0x533c17};if(_0x2c0981==='boolean'){_0x36030f[_0x113d('0x51')]=[{'name':_0x113d('0xc0'),'value':_0x113d('0xc1')},{'name':'False','value':_0x113d('0xc2')}];_0x316061(_0x36030f);}else{var _0x1bbfee={'method':_0x113d('0xc3'),'uri':_0x3e75de+_0x113d('0xc4')+_0x3b3024,'auth':_0x516220,'json':!![]};return rp(_0x1bbfee)[_0x113d('0x21')](function(_0x320938){var _0x3f118b=[];if(_0x320938[_0x113d('0xb2')]['length']>0x0){_0x320938[_0x113d('0xb2')][_0x113d('0xbb')](function(_0x2fee4d){if(_0x2fee4d[_0x113d('0xc5')]===_0x113d('0xc2')){var _0x307db3={'name':_0x2fee4d[_0x113d('0xb7')],'value':_0x2fee4d[_0x113d('0xc6')]};_0x3f118b[_0x113d('0xb8')](_0x307db3);}});}_0x36030f['options']=_0x3f118b;if(_0x36030f[_0x113d('0x51')][_0x113d('0x47')]>0x0){_0x316061(_0x36030f);}else{if(_0x533c17==![]){_0x316061();}else{_0x316061(_0x36030f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 077cf91..7a8bcb0 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 _0x10cb=['define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x12aa66,_0x2d35c1){var _0x53dfe9=function(_0x2ab011){while(--_0x2ab011){_0x12aa66['push'](_0x12aa66['shift']());}};_0x53dfe9(++_0x2d35c1);}(_0x10cb,0x145));var _0xb10c=function(_0x57326a,_0x4682f5){_0x57326a=_0x57326a-0x0;var _0x24b1e7=_0x10cb[_0x57326a];return _0x24b1e7;};'use strict';var _=require(_0xb10c('0x0'));var util=require('util');var logger=require(_0xb10c('0x1'))(_0xb10c('0x2'));var moment=require('moment');var BPromise=require(_0xb10c('0x3'));var rp=require(_0xb10c('0x4'));var fs=require('fs');var path=require(_0xb10c('0x5'));var rimraf=require(_0xb10c('0x6'));var config=require(_0xb10c('0x7'));var attributes=require(_0xb10c('0x8'));var integrations=require(_0xb10c('0x9'));module[_0xb10c('0xa')]=function(_0x1336e1,_0x4a9a65){return _0x1336e1[_0xb10c('0xb')](_0xb10c('0xc'),attributes,{'tableName':_0xb10c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0dc=['ServicenowAccount','lodash','util','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc0dc,0xb1));var _0xcc0d=function(_0x1dc8dc,_0x24ba3f){_0x1dc8dc=_0x1dc8dc-0x0;var _0x34053e=_0xc0dc[_0x1dc8dc];return _0x34053e;};'use strict';var _=require(_0xcc0d('0x0'));var util=require(_0xcc0d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc0d('0x2'));var BPromise=require(_0xcc0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc0d('0x4'));var rimraf=require(_0xcc0d('0x5'));var config=require(_0xcc0d('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xcc0d('0x7'));module[_0xcc0d('0x8')]=function(_0x59b3a1,_0x39299b){return _0x59b3a1[_0xcc0d('0x9')](_0xcc0d('0xa'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 2d3f021..1d1a3b4 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 _0x09d2=['ServicenowAccount','findAll','raw','options','where','attributes','limit','map','include','model','catch','find','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount'];(function(_0x2ef644,_0x2ab0ff){var _0x11f00e=function(_0x32983a){while(--_0x32983a){_0x2ef644['push'](_0x2ef644['shift']());}};_0x11f00e(++_0x2ab0ff);}(_0x09d2,0x13d));var _0x209d=function(_0x27a2c3,_0x15cca8){_0x27a2c3=_0x27a2c3-0x0;var _0x179c00=_0x09d2[_0x27a2c3];return _0x179c00;};'use strict';var _=require(_0x209d('0x0'));var util=require(_0x209d('0x1'));var moment=require(_0x209d('0x2'));var BPromise=require(_0x209d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x209d('0x4'));var db=require(_0x209d('0x5'))['db'];var utils=require(_0x209d('0x6'));var logger=require(_0x209d('0x7'))(_0x209d('0x8'));var config=require(_0x209d('0x9'));var jayson=require(_0x209d('0xa'));var client=jayson['client'][_0x209d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x460bd9,_0xbc980c,_0x212d8f){return new BPromise(function(_0x5a0f39,_0x5ba1e0){return client[_0x209d('0xc')](_0x460bd9,_0x212d8f)[_0x209d('0xd')](function(_0x227628){logger[_0x209d('0xe')](_0x209d('0xf'),_0xbc980c,_0x209d('0x10'));logger[_0x209d('0x11')](_0x209d('0x12'),_0xbc980c,_0x209d('0x10'),JSON[_0x209d('0x13')](_0x227628));if(_0x227628['error']){if(_0x227628[_0x209d('0x14')][_0x209d('0x15')]===0x1f4){logger[_0x209d('0x14')](_0x209d('0xf'),_0xbc980c,_0x227628[_0x209d('0x14')][_0x209d('0x16')]);return _0x5ba1e0(_0x227628[_0x209d('0x14')]['message']);}logger[_0x209d('0x14')](_0x209d('0xf'),_0xbc980c,_0x227628[_0x209d('0x14')]['message']);return _0x5a0f39(_0x227628[_0x209d('0x14')]['message']);}else{logger['info'](_0x209d('0xf'),_0xbc980c,_0x209d('0x10'));_0x5a0f39(_0x227628[_0x209d('0x17')][_0x209d('0x16')]);}})['catch'](function(_0x2fc9ae){logger[_0x209d('0x14')](_0x209d('0xf'),_0xbc980c,_0x2fc9ae);_0x5ba1e0(_0x2fc9ae);});});}exports[_0x209d('0x18')]=function(_0x4aed86){var _0x30e121=this;return new Promise(function(_0x52d681,_0x443d3b){return db[_0x209d('0x19')][_0x209d('0x1a')]({'raw':_0x4aed86['options']?_0x4aed86['options'][_0x209d('0x1b')]===undefined?!![]:![]:!![],'where':_0x4aed86['options']?_0x4aed86[_0x209d('0x1c')][_0x209d('0x1d')]||null:null,'attributes':_0x4aed86[_0x209d('0x1c')]?_0x4aed86[_0x209d('0x1c')][_0x209d('0x1e')]||null:null,'limit':_0x4aed86[_0x209d('0x1c')]?_0x4aed86[_0x209d('0x1c')][_0x209d('0x1f')]||null:null,'include':_0x4aed86[_0x209d('0x1c')]?_0x4aed86[_0x209d('0x1c')]['include']?_[_0x209d('0x20')](_0x4aed86['options'][_0x209d('0x21')],function(_0x1025f4){return{'model':db[_0x1025f4[_0x209d('0x22')]],'as':_0x1025f4['as'],'attributes':_0x1025f4['attributes'],'include':_0x1025f4['include']?_[_0x209d('0x20')](_0x1025f4['include'],function(_0x2fef73){return{'model':db[_0x2fef73['model']],'as':_0x2fef73['as'],'attributes':_0x2fef73[_0x209d('0x1e')],'include':_0x2fef73[_0x209d('0x21')]?_[_0x209d('0x20')](_0x2fef73['include'],function(_0x270baf){return{'model':db[_0x270baf[_0x209d('0x22')]],'as':_0x270baf['as'],'attributes':_0x270baf['attributes']};}):[]};}):[]};}):[]:[]})[_0x209d('0xd')](function(_0xdc3ebe){logger[_0x209d('0xe')]('GetServicenowAccount',_0x4aed86);logger[_0x209d('0x11')](_0x209d('0x18'),_0x4aed86,JSON['stringify'](_0xdc3ebe));_0x52d681(_0xdc3ebe);})[_0x209d('0x23')](function(_0x15aaf1){logger[_0x209d('0x14')](_0x209d('0x18'),_0x15aaf1[_0x209d('0x16')],_0x4aed86);_0x443d3b(_0x30e121[_0x209d('0x14')](0x1f4,_0x15aaf1[_0x209d('0x16')]));});});};exports['ShowServicenowAccount']=function(_0x525558){var _0x23e8fb=this;return new Promise(function(_0x5d88c8,_0x4c5793){return db[_0x209d('0x19')][_0x209d('0x24')]({'raw':_0x525558[_0x209d('0x1c')]?_0x525558[_0x209d('0x1c')][_0x209d('0x1b')]===undefined?!![]:![]:!![],'where':_0x525558[_0x209d('0x1c')]?_0x525558[_0x209d('0x1c')][_0x209d('0x1d')]||null:null,'attributes':_0x525558[_0x209d('0x1c')]?_0x525558[_0x209d('0x1c')][_0x209d('0x1e')]||null:null,'include':_0x525558[_0x209d('0x1c')]?_0x525558[_0x209d('0x1c')][_0x209d('0x21')]?_[_0x209d('0x20')](_0x525558[_0x209d('0x1c')][_0x209d('0x21')],function(_0x1f129e){return{'model':db[_0x1f129e['model']],'as':_0x1f129e['as'],'attributes':_0x1f129e['attributes'],'include':_0x1f129e[_0x209d('0x21')]?_[_0x209d('0x20')](_0x1f129e[_0x209d('0x21')],function(_0x205ead){return{'model':db[_0x205ead[_0x209d('0x22')]],'as':_0x205ead['as'],'attributes':_0x205ead[_0x209d('0x1e')],'include':_0x205ead[_0x209d('0x21')]?_[_0x209d('0x20')](_0x205ead[_0x209d('0x21')],function(_0x45cfa8){return{'model':db[_0x45cfa8[_0x209d('0x22')]],'as':_0x45cfa8['as'],'attributes':_0x45cfa8[_0x209d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x209d('0xd')](function(_0x4a917b){logger[_0x209d('0xe')](_0x209d('0x25'),_0x525558);logger['debug'](_0x209d('0x25'),_0x525558,JSON['stringify'](_0x4a917b));_0x5d88c8(_0x4a917b);})[_0x209d('0x23')](function(_0x5d8500){logger[_0x209d('0x14')](_0x209d('0x25'),_0x5d8500[_0x209d('0x16')],_0x525558);_0x4c5793(_0x23e8fb[_0x209d('0x14')](0x1f4,_0x5d8500[_0x209d('0x16')]));});});}; \ No newline at end of file +var _0x5850=['client','http','request','then','info','request\x20sent','debug','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','options','raw','where','limit','include','map','attributes','model','stringify','ShowServicenowAccount','ServicenowAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x5850,0xbd));var _0x0585=function(_0x41a12a,_0x2a3f9b){_0x41a12a=_0x41a12a-0x0;var _0x5a9a72=_0x5850[_0x41a12a];return _0x5a9a72;};'use strict';var _=require(_0x0585('0x0'));var util=require('util');var moment=require(_0x0585('0x1'));var BPromise=require(_0x0585('0x2'));var rs=require(_0x0585('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0585('0x4'))['db'];var utils=require(_0x0585('0x5'));var logger=require(_0x0585('0x6'))(_0x0585('0x7'));var config=require(_0x0585('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0585('0x9')][_0x0585('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23ad62,_0x2651c4,_0x21c3eb){return new BPromise(function(_0x298c7e,_0x46624f){return client[_0x0585('0xb')](_0x23ad62,_0x21c3eb)[_0x0585('0xc')](function(_0x4a42fd){logger[_0x0585('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x2651c4,_0x0585('0xe'));logger[_0x0585('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2651c4,_0x0585('0xe'),JSON['stringify'](_0x4a42fd));if(_0x4a42fd[_0x0585('0x10')]){if(_0x4a42fd[_0x0585('0x10')]['code']===0x1f4){logger[_0x0585('0x10')](_0x0585('0x11'),_0x2651c4,_0x4a42fd[_0x0585('0x10')][_0x0585('0x12')]);return _0x46624f(_0x4a42fd[_0x0585('0x10')]['message']);}logger[_0x0585('0x10')](_0x0585('0x11'),_0x2651c4,_0x4a42fd['error'][_0x0585('0x12')]);return _0x298c7e(_0x4a42fd[_0x0585('0x10')][_0x0585('0x12')]);}else{logger[_0x0585('0xd')](_0x0585('0x11'),_0x2651c4,_0x0585('0xe'));_0x298c7e(_0x4a42fd[_0x0585('0x13')][_0x0585('0x12')]);}})[_0x0585('0x14')](function(_0x54b19c){logger['error'](_0x0585('0x11'),_0x2651c4,_0x54b19c);_0x46624f(_0x54b19c);});});}exports[_0x0585('0x15')]=function(_0x1f4df2){var _0x208c88=this;return new Promise(function(_0x2feefc,_0x131895){return db['ServicenowAccount']['findAll']({'raw':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')][_0x0585('0x17')]===undefined?!![]:![]:!![],'where':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')][_0x0585('0x18')]||null:null,'attributes':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')]['attributes']||null:null,'limit':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')][_0x0585('0x19')]||null:null,'include':_0x1f4df2[_0x0585('0x16')]?_0x1f4df2[_0x0585('0x16')][_0x0585('0x1a')]?_[_0x0585('0x1b')](_0x1f4df2[_0x0585('0x16')][_0x0585('0x1a')],function(_0x4109d0){return{'model':db[_0x4109d0['model']],'as':_0x4109d0['as'],'attributes':_0x4109d0[_0x0585('0x1c')],'include':_0x4109d0[_0x0585('0x1a')]?_['map'](_0x4109d0[_0x0585('0x1a')],function(_0xf2b43c){return{'model':db[_0xf2b43c['model']],'as':_0xf2b43c['as'],'attributes':_0xf2b43c[_0x0585('0x1c')],'include':_0xf2b43c[_0x0585('0x1a')]?_[_0x0585('0x1b')](_0xf2b43c[_0x0585('0x1a')],function(_0x33dfcc){return{'model':db[_0x33dfcc[_0x0585('0x1d')]],'as':_0x33dfcc['as'],'attributes':_0x33dfcc[_0x0585('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0585('0xc')](function(_0x420f9e){logger['info'](_0x0585('0x15'),_0x1f4df2);logger[_0x0585('0xf')](_0x0585('0x15'),_0x1f4df2,JSON[_0x0585('0x1e')](_0x420f9e));_0x2feefc(_0x420f9e);})[_0x0585('0x14')](function(_0x558d3a){logger['error']('GetServicenowAccount',_0x558d3a[_0x0585('0x12')],_0x1f4df2);_0x131895(_0x208c88[_0x0585('0x10')](0x1f4,_0x558d3a[_0x0585('0x12')]));});});};exports[_0x0585('0x1f')]=function(_0x588ef8){var _0x328077=this;return new Promise(function(_0x582b6f,_0x2dd0c0){return db[_0x0585('0x20')]['find']({'raw':_0x588ef8[_0x0585('0x16')]?_0x588ef8[_0x0585('0x16')][_0x0585('0x17')]===undefined?!![]:![]:!![],'where':_0x588ef8[_0x0585('0x16')]?_0x588ef8[_0x0585('0x16')][_0x0585('0x18')]||null:null,'attributes':_0x588ef8[_0x0585('0x16')]?_0x588ef8[_0x0585('0x16')]['attributes']||null:null,'include':_0x588ef8['options']?_0x588ef8[_0x0585('0x16')][_0x0585('0x1a')]?_[_0x0585('0x1b')](_0x588ef8[_0x0585('0x16')][_0x0585('0x1a')],function(_0x1da59d){return{'model':db[_0x1da59d[_0x0585('0x1d')]],'as':_0x1da59d['as'],'attributes':_0x1da59d[_0x0585('0x1c')],'include':_0x1da59d[_0x0585('0x1a')]?_[_0x0585('0x1b')](_0x1da59d[_0x0585('0x1a')],function(_0x18aa16){return{'model':db[_0x18aa16['model']],'as':_0x18aa16['as'],'attributes':_0x18aa16['attributes'],'include':_0x18aa16['include']?_['map'](_0x18aa16['include'],function(_0x11755d){return{'model':db[_0x11755d[_0x0585('0x1d')]],'as':_0x11755d['as'],'attributes':_0x11755d[_0x0585('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0585('0xc')](function(_0x3b584b){logger[_0x0585('0xd')](_0x0585('0x1f'),_0x588ef8);logger['debug'](_0x0585('0x1f'),_0x588ef8,JSON[_0x0585('0x1e')](_0x3b584b));_0x582b6f(_0x3b584b);})[_0x0585('0x14')](function(_0xaad9e3){logger[_0x0585('0x10')](_0x0585('0x1f'),_0xaad9e3[_0x0585('0x12')],_0x588ef8);_0x2dd0c0(_0x328077[_0x0585('0x10')](0x1f4,_0xaad9e3[_0x0585('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 56027c0..4812447 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 _0xc6da=['/:id/descriptions','getDescriptions','create','put','update','destroy','util','path','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','index','/:id','isAuthenticated','get','getFields','/:id/subjects','getSubjects'];(function(_0x16fc1e,_0x590c8e){var _0x4e21a2=function(_0x4c9483){while(--_0x4c9483){_0x16fc1e['push'](_0x16fc1e['shift']());}};_0x4e21a2(++_0x590c8e);}(_0xc6da,0x182));var _0xac6d=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xc6da[_0x5c9307];return _0x373e29;};'use strict';var multer=require('multer');var util=require(_0xac6d('0x0'));var path=require(_0xac6d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac6d('0x2')]();var auth=require(_0xac6d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xac6d('0x4'));var controller=require(_0xac6d('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xac6d('0x6')]);router['get'](_0xac6d('0x7'),auth[_0xac6d('0x8')](),controller['show']);router[_0xac6d('0x9')]('/:id/fields',auth[_0xac6d('0x8')](),controller[_0xac6d('0xa')]);router[_0xac6d('0x9')](_0xac6d('0xb'),auth[_0xac6d('0x8')](),controller[_0xac6d('0xc')]);router[_0xac6d('0x9')](_0xac6d('0xd'),auth['isAuthenticated'](),controller[_0xac6d('0xe')]);router['post']('/',auth[_0xac6d('0x8')](),controller[_0xac6d('0xf')]);router[_0xac6d('0x10')](_0xac6d('0x7'),auth[_0xac6d('0x8')](),controller[_0xac6d('0x11')]);router['delete'](_0xac6d('0x7'),auth['isAuthenticated'](),controller[_0xac6d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x351a=['getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x358357,_0x346319){var _0x5c1a89=function(_0x5b394b){while(--_0x5b394b){_0x358357['push'](_0x358357['shift']());}};_0x5c1a89(++_0x346319);}(_0x351a,0x68));var _0xa351=function(_0x5906cc,_0xcbbb0c){_0x5906cc=_0x5906cc-0x0;var _0x3cb49a=_0x351a[_0x5906cc];return _0x3cb49a;};'use strict';var multer=require(_0xa351('0x0'));var util=require('util');var path=require(_0xa351('0x1'));var timeout=require(_0xa351('0x2'));var express=require(_0xa351('0x3'));var router=express[_0xa351('0x4')]();var auth=require(_0xa351('0x5'));var interaction=require(_0xa351('0x6'));var config=require('../../config/environment');var controller=require(_0xa351('0x7'));router[_0xa351('0x8')]('/',auth[_0xa351('0x9')](),controller[_0xa351('0xa')]);router[_0xa351('0x8')](_0xa351('0xb'),auth['isAuthenticated'](),controller[_0xa351('0xc')]);router[_0xa351('0x8')](_0xa351('0xd'),auth[_0xa351('0x9')](),controller[_0xa351('0xe')]);router[_0xa351('0x8')](_0xa351('0xf'),auth['isAuthenticated'](),controller[_0xa351('0x10')]);router[_0xa351('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa351('0x11')]);router[_0xa351('0x12')]('/',auth[_0xa351('0x9')](),controller[_0xa351('0x13')]);router['put'](_0xa351('0xb'),auth[_0xa351('0x9')](),controller[_0xa351('0x14')]);router[_0xa351('0x15')](_0xa351('0xb'),auth[_0xa351('0x9')](),controller[_0xa351('0x16')]);module[_0xa351('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 427ebd8..6948d9b 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 _0x78bb=['exports','STRING'];(function(_0x4cf322,_0x503e21){var _0x3fb757=function(_0x296175){while(--_0x296175){_0x4cf322['push'](_0x4cf322['shift']());}};_0x3fb757(++_0x503e21);}(_0x78bb,0x84));var _0xb78b=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x78bb[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require('sequelize');module[_0xb78b('0x0')]={'name':{'type':Sequelize[_0xb78b('0x1')]},'description':{'type':Sequelize[_0xb78b('0x1')]}}; \ No newline at end of file +var _0xe56a=['sequelize','exports','STRING'];(function(_0x19da09,_0x2275e3){var _0xe4b545=function(_0x4836ae){while(--_0x4836ae){_0x19da09['push'](_0x19da09['shift']());}};_0xe4b545(++_0x2275e3);}(_0xe56a,0x1ef));var _0xae56=function(_0x244bc4,_0x2b463d){_0x244bc4=_0x244bc4-0x0;var _0x33a9a6=_0xe56a[_0x244bc4];return _0x33a9a6;};'use strict';var Sequelize=require(_0xae56('0x0'));module[_0xae56('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xae56('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 28197c9..617ffa7 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 _0xb688=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','create','update','body','find','params','getFields','findOne','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','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','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','status','count','offset','limit','set','Content-Range','apply','save','destroy','sendStatus','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x4e66e2,_0x34899d){var _0x338b70=function(_0x2b6de7){while(--_0x2b6de7){_0x4e66e2['push'](_0x4e66e2['shift']());}};_0x338b70(++_0x34899d);}(_0xb688,0xcf));var _0x8b68=function(_0x34357d,_0x85bbe2){_0x34357d=_0x34357d-0x0;var _0x3115c9=_0xb688[_0x34357d];return _0x3115c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require(_0x8b68('0x2'));var jsonpatch=require(_0x8b68('0x3'));var rp=require(_0x8b68('0x4'));var moment=require(_0x8b68('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0xf'));var querystring=require(_0x8b68('0x10'));var Papa=require(_0x8b68('0x11'));var Redis=require(_0x8b68('0x12'));var authService=require(_0x8b68('0x13'));var qs=require(_0x8b68('0x14'));var as=require(_0x8b68('0x15'));var hardwareService=require(_0x8b68('0x16'));var logger=require(_0x8b68('0x17'))('api');var utils=require(_0x8b68('0x18'));var config=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];var jayson=require(_0x8b68('0x1b'));var client=jayson[_0x8b68('0x1c')][_0x8b68('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xaa8725,_0x137c8e,_0x2686c7){if(_0x2686c7){var _0x5b4364=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b4364[_0x8b68('0x1e')](_0x137c8e)){return _0xaa8725;}else{throw new db['Sequelize']['ValidationError'](_0x8b68('0x1f'));}}else{return _0xaa8725;}}function respondWithRpcPromise(_0x1554d6,_0x27d717,_0x5d3468,_0x5c8d0e){return new BPromise(function(_0x23bd52,_0x5c1e44){var _0x136f1b=_0x5c8d0e||client;return _0x136f1b[_0x8b68('0x20')](_0x1554d6,_0x5d3468)[_0x8b68('0x21')](function(_0x10c9c6){logger['info'](_0x8b68('0x22'),_0x27d717,_0x8b68('0x23'));logger['debug'](_0x8b68('0x24'),_0x27d717,_0x8b68('0x23'),JSON[_0x8b68('0x25')](_0x10c9c6));if(_0x10c9c6[_0x8b68('0x26')]){if(_0x10c9c6[_0x8b68('0x26')]['code']===0x1f4){logger[_0x8b68('0x26')](_0x8b68('0x22'),_0x27d717,_0x10c9c6[_0x8b68('0x26')][_0x8b68('0x27')]);return _0x5c1e44(_0x10c9c6[_0x8b68('0x26')][_0x8b68('0x27')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x27d717,_0x10c9c6[_0x8b68('0x26')]['message']);return _0x23bd52(_0x10c9c6[_0x8b68('0x26')][_0x8b68('0x27')]);}else{logger[_0x8b68('0x28')](_0x8b68('0x22'),_0x27d717,_0x8b68('0x23'));_0x23bd52(_0x10c9c6[_0x8b68('0x29')]['message']);}})[_0x8b68('0x2a')](function(_0x46e827){logger['error'](_0x8b68('0x22'),_0x27d717,_0x46e827);_0x5c1e44(_0x46e827);});});}function respondWithStatusCode(_0x3cf8d2,_0x240b0b){_0x240b0b=_0x240b0b||0xcc;return function(_0x5590ec){if(_0x5590ec){return _0x3cf8d2['sendStatus'](_0x240b0b);}return _0x3cf8d2['status'](_0x240b0b)[_0x8b68('0x2b')]();};}function respondWithResult(_0x448e43,_0x2ba2a3){_0x2ba2a3=_0x2ba2a3||0xc8;return function(_0x583476){if(_0x583476){return _0x448e43[_0x8b68('0x2c')](_0x2ba2a3)['json'](_0x583476);}};}function respondWithFilteredResult(_0x4cf89d,_0x3865ea){return function(_0x59b3ce){if(_0x59b3ce){var _0x26cad7=_0x59b3ce[_0x8b68('0x2d')],_0x3ac356=_0x3865ea[_0x8b68('0x2e')],_0x48e2c8=_0x3865ea[_0x8b68('0x2e')]+_0x3865ea[_0x8b68('0x2f')],_0x494ce4;if(_0x48e2c8>=_0x26cad7){_0x48e2c8=_0x26cad7;_0x494ce4=0xc8;}else{_0x494ce4=0xce;}_0x4cf89d[_0x8b68('0x2c')](_0x494ce4);return _0x4cf89d[_0x8b68('0x30')](_0x8b68('0x31'),_0x3ac356+'-'+_0x48e2c8+'/'+_0x26cad7)['json'](_0x59b3ce);}return null;};}function patchUpdates(_0x3b6d1b){return function(_0x50a1e9){try{jsonpatch[_0x8b68('0x32')](_0x50a1e9,_0x3b6d1b,!![]);}catch(_0x133b75){return BPromise['reject'](_0x133b75);}return _0x50a1e9[_0x8b68('0x33')]();};}function saveUpdates(_0x93daf7,_0x26fe0e){return function(_0x49ce2d){if(_0x49ce2d){return _0x49ce2d['update'](_0x93daf7)[_0x8b68('0x21')](function(_0x8c11aa){return _0x8c11aa;});}return null;};}function removeEntity(_0x3e905a,_0x394cca){return function(_0x2c0ace){if(_0x2c0ace){return _0x2c0ace[_0x8b68('0x34')]()[_0x8b68('0x21')](function(){_0x3e905a[_0x8b68('0x2c')](0xcc)[_0x8b68('0x2b')]();});}};}function handleEntityNotFound(_0x7fe301,_0x49e2db){return function(_0x15027a){if(!_0x15027a){_0x7fe301[_0x8b68('0x35')](0x194);}return _0x15027a;};}function handleError(_0x439d36,_0x10aca9){_0x10aca9=_0x10aca9||0x1f4;return function(_0x151277){logger[_0x8b68('0x26')](_0x151277[_0x8b68('0x36')]);if(_0x151277[_0x8b68('0x37')]){delete _0x151277[_0x8b68('0x37')];}_0x439d36[_0x8b68('0x2c')](_0x10aca9)[_0x8b68('0x38')](_0x151277);};}exports['index']=function(_0x5c158b,_0x24026c){var _0x262d6c={},_0x23554d={},_0xb9b5b1={'count':0x0,'rows':[]};var _0xf2154f=_[_0x8b68('0x39')](db[_0x8b68('0x3a')][_0x8b68('0x3b')],function(_0x5b628e){return{'name':_0x5b628e[_0x8b68('0x3c')],'type':_0x5b628e[_0x8b68('0x3d')][_0x8b68('0x3e')]};});_0x23554d[_0x8b68('0x3f')]=_[_0x8b68('0x39')](_0xf2154f,_0x8b68('0x37'));_0x23554d[_0x8b68('0x40')]=_[_0x8b68('0x41')](_0x5c158b['query']);_0x23554d[_0x8b68('0x42')]=_[_0x8b68('0x43')](_0x23554d[_0x8b68('0x3f')],_0x23554d[_0x8b68('0x40')]);_0x262d6c[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x23554d[_0x8b68('0x3f')],qs['fields'](_0x5c158b[_0x8b68('0x40')][_0x8b68('0x45')]));_0x262d6c['attributes']=_0x262d6c[_0x8b68('0x44')][_0x8b68('0x46')]?_0x262d6c['attributes']:_0x23554d['model'];if(!_0x5c158b['query']['hasOwnProperty'](_0x8b68('0x47'))){_0x262d6c[_0x8b68('0x2f')]=qs['limit'](_0x5c158b[_0x8b68('0x40')]['limit']);_0x262d6c[_0x8b68('0x2e')]=qs[_0x8b68('0x2e')](_0x5c158b['query'][_0x8b68('0x2e')]);}_0x262d6c['order']=qs['sort'](_0x5c158b['query'][_0x8b68('0x48')]);_0x262d6c[_0x8b68('0x49')]=qs[_0x8b68('0x42')](_[_0x8b68('0x4a')](_0x5c158b['query'],_0x23554d[_0x8b68('0x42')]),_0xf2154f);if(_0x5c158b['query'][_0x8b68('0x4b')]){_0x262d6c[_0x8b68('0x49')]=_['merge'](_0x262d6c[_0x8b68('0x49')],{'$or':_[_0x8b68('0x39')](_0xf2154f,function(_0x422f91){if(_0x422f91[_0x8b68('0x3d')]!=='VIRTUAL'){var _0x14fa5a={};_0x14fa5a[_0x422f91[_0x8b68('0x37')]]={'$like':'%'+_0x5c158b[_0x8b68('0x40')][_0x8b68('0x4b')]+'%'};return _0x14fa5a;}})});}_0x262d6c=_[_0x8b68('0x4c')]({},_0x262d6c,_0x5c158b[_0x8b68('0x4d')]);var _0x41d9a2={'where':_0x262d6c[_0x8b68('0x49')]};return db[_0x8b68('0x3a')][_0x8b68('0x2d')](_0x41d9a2)[_0x8b68('0x21')](function(_0x2a2a99){_0xb9b5b1[_0x8b68('0x2d')]=_0x2a2a99;if(_0x5c158b[_0x8b68('0x40')][_0x8b68('0x4e')]){_0x262d6c[_0x8b68('0x4f')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x8b68('0x50')](_0x262d6c);})[_0x8b68('0x21')](function(_0x5dd099){_0xb9b5b1[_0x8b68('0x51')]=_0x5dd099;return _0xb9b5b1;})['then'](respondWithFilteredResult(_0x24026c,_0x262d6c))['catch'](handleError(_0x24026c,null));};exports['show']=function(_0x1c8a3e,_0x35874b){var _0x34047c={'raw':![],'where':{'id':_0x1c8a3e['params']['id']}},_0x6da48b={};_0x6da48b['model']=_[_0x8b68('0x41')](db[_0x8b68('0x3a')][_0x8b68('0x3b')]);_0x6da48b['query']=_[_0x8b68('0x41')](_0x1c8a3e[_0x8b68('0x40')]);_0x6da48b['filters']=_[_0x8b68('0x43')](_0x6da48b[_0x8b68('0x3f')],_0x6da48b['query']);_0x34047c[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x6da48b['model'],qs[_0x8b68('0x45')](_0x1c8a3e[_0x8b68('0x40')]['fields']));_0x34047c['attributes']=_0x34047c['attributes'][_0x8b68('0x46')]?_0x34047c[_0x8b68('0x44')]:_0x6da48b[_0x8b68('0x3f')];if(_0x1c8a3e[_0x8b68('0x40')]['includeAll']){_0x34047c['include']=[{'all':!![]}];}_0x34047c=_[_0x8b68('0x4c')]({},_0x34047c,_0x1c8a3e[_0x8b68('0x4d')]);return db[_0x8b68('0x3a')]['find'](_0x34047c)[_0x8b68('0x21')](handleEntityNotFound(_0x35874b,null))[_0x8b68('0x21')](respondWithResult(_0x35874b,null))[_0x8b68('0x2a')](handleError(_0x35874b,null));};exports['create']=function(_0x49dc86,_0x4825df){return db[_0x8b68('0x3a')][_0x8b68('0x52')](_0x49dc86['body'],{})[_0x8b68('0x21')](respondWithResult(_0x4825df,0xc9))[_0x8b68('0x2a')](handleError(_0x4825df,null));};exports[_0x8b68('0x53')]=function(_0xcd88b4,_0x8cc614){if(_0xcd88b4['body']['id']){delete _0xcd88b4[_0x8b68('0x54')]['id'];}return db[_0x8b68('0x3a')][_0x8b68('0x55')]({'where':{'id':_0xcd88b4[_0x8b68('0x56')]['id']}})[_0x8b68('0x21')](handleEntityNotFound(_0x8cc614,null))[_0x8b68('0x21')](saveUpdates(_0xcd88b4[_0x8b68('0x54')],null))[_0x8b68('0x21')](respondWithResult(_0x8cc614,null))['catch'](handleError(_0x8cc614,null));};exports[_0x8b68('0x34')]=function(_0x1a85da,_0x1e8694){return db[_0x8b68('0x3a')][_0x8b68('0x55')]({'where':{'id':_0x1a85da[_0x8b68('0x56')]['id']}})[_0x8b68('0x21')](handleEntityNotFound(_0x1e8694,null))[_0x8b68('0x21')](removeEntity(_0x1e8694,null))[_0x8b68('0x2a')](handleError(_0x1e8694,null));};exports[_0x8b68('0x57')]=function(_0x368c86,_0x42871e,_0x1019cb){var _0x275b31={};var _0x28e7aa={};var _0xd7e86d;var _0xf07a90;return db[_0x8b68('0x3a')][_0x8b68('0x58')]({'where':{'id':_0x368c86[_0x8b68('0x56')]['id']}})['then'](handleEntityNotFound(_0x42871e,null))[_0x8b68('0x21')](function(_0x51e17b){if(_0x51e17b){_0xd7e86d=_0x51e17b;_0x28e7aa['model']=_[_0x8b68('0x41')](db['ServicenowField'][_0x8b68('0x3b')]);_0x28e7aa[_0x8b68('0x40')]=_[_0x8b68('0x41')](_0x368c86['query']);_0x28e7aa[_0x8b68('0x42')]=_[_0x8b68('0x43')](_0x28e7aa[_0x8b68('0x3f')],_0x28e7aa[_0x8b68('0x40')]);_0x275b31[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x28e7aa[_0x8b68('0x3f')],qs['fields'](_0x368c86['query'][_0x8b68('0x45')]));_0x275b31[_0x8b68('0x44')]=_0x275b31[_0x8b68('0x44')][_0x8b68('0x46')]?_0x275b31[_0x8b68('0x44')]:_0x28e7aa[_0x8b68('0x3f')];_0x275b31[_0x8b68('0x59')]=qs[_0x8b68('0x48')](_0x368c86[_0x8b68('0x40')][_0x8b68('0x48')]);_0x275b31[_0x8b68('0x49')]=qs[_0x8b68('0x42')](_[_0x8b68('0x4a')](_0x368c86[_0x8b68('0x40')],_0x28e7aa[_0x8b68('0x42')]));if(_0x368c86[_0x8b68('0x40')][_0x8b68('0x4b')]){_0x275b31[_0x8b68('0x49')]=_['merge'](_0x275b31['where'],{'$or':_[_0x8b68('0x39')](_0x275b31[_0x8b68('0x44')],function(_0x5bd581){var _0x48d57a={};_0x48d57a[_0x5bd581]={'$like':'%'+_0x368c86['query'][_0x8b68('0x4b')]+'%'};return _0x48d57a;})});}_0x275b31=_[_0x8b68('0x4c')]({},_0x275b31,_0x368c86[_0x8b68('0x4d')]);return _0xd7e86d[_0x8b68('0x57')](_0x275b31);}})[_0x8b68('0x21')](function(_0x58d93c){if(_0x58d93c){_0xf07a90=_0x58d93c[_0x8b68('0x46')];if(!_0x368c86[_0x8b68('0x40')]['hasOwnProperty'](_0x8b68('0x47'))){_0x275b31['limit']=qs['limit'](_0x368c86['query'][_0x8b68('0x2f')]);_0x275b31[_0x8b68('0x2e')]=qs[_0x8b68('0x2e')](_0x368c86[_0x8b68('0x40')][_0x8b68('0x2e')]);}return _0xd7e86d[_0x8b68('0x57')](_0x275b31);}})[_0x8b68('0x21')](function(_0x34456d){if(_0x34456d){return _0x34456d?{'count':_0xf07a90,'rows':_0x34456d}:null;}})[_0x8b68('0x21')](respondWithResult(_0x42871e,null))[_0x8b68('0x2a')](handleError(_0x42871e,null));};exports['getSubjects']=function(_0x3a8d15,_0x335b3b,_0x310ec9){var _0x49cce6={};var _0x5deaba={};var _0x1854a9;var _0x1966f6;return db['ServicenowConfiguration'][_0x8b68('0x58')]({'where':{'id':_0x3a8d15[_0x8b68('0x56')]['id']}})[_0x8b68('0x21')](handleEntityNotFound(_0x335b3b,null))[_0x8b68('0x21')](function(_0x50fd2c){if(_0x50fd2c){_0x1854a9=_0x50fd2c;_0x5deaba[_0x8b68('0x3f')]=_['keys'](db['ServicenowField'][_0x8b68('0x3b')]);_0x5deaba['query']=_[_0x8b68('0x41')](_0x3a8d15[_0x8b68('0x40')]);_0x5deaba['filters']=_[_0x8b68('0x43')](_0x5deaba[_0x8b68('0x3f')],_0x5deaba[_0x8b68('0x40')]);_0x49cce6[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x5deaba['model'],qs[_0x8b68('0x45')](_0x3a8d15[_0x8b68('0x40')][_0x8b68('0x45')]));_0x49cce6[_0x8b68('0x44')]=_0x49cce6[_0x8b68('0x44')]['length']?_0x49cce6['attributes']:_0x5deaba[_0x8b68('0x3f')];_0x49cce6['order']=qs[_0x8b68('0x48')](_0x3a8d15[_0x8b68('0x40')][_0x8b68('0x48')]);_0x49cce6[_0x8b68('0x49')]=qs[_0x8b68('0x42')](_[_0x8b68('0x4a')](_0x3a8d15[_0x8b68('0x40')],_0x5deaba['filters']));if(_0x3a8d15[_0x8b68('0x40')]['filter']){_0x49cce6[_0x8b68('0x49')]=_[_0x8b68('0x4c')](_0x49cce6[_0x8b68('0x49')],{'$or':_['map'](_0x49cce6[_0x8b68('0x44')],function(_0x50d0b9){var _0x104a9d={};_0x104a9d[_0x50d0b9]={'$like':'%'+_0x3a8d15['query'][_0x8b68('0x4b')]+'%'};return _0x104a9d;})});}_0x49cce6=_[_0x8b68('0x4c')]({},_0x49cce6,_0x3a8d15[_0x8b68('0x4d')]);return _0x1854a9['getSubjects'](_0x49cce6);}})[_0x8b68('0x21')](function(_0x1fc6dc){if(_0x1fc6dc){_0x1966f6=_0x1fc6dc[_0x8b68('0x46')];if(!_0x3a8d15[_0x8b68('0x40')][_0x8b68('0x5a')](_0x8b68('0x47'))){_0x49cce6[_0x8b68('0x2f')]=qs[_0x8b68('0x2f')](_0x3a8d15[_0x8b68('0x40')]['limit']);_0x49cce6[_0x8b68('0x2e')]=qs[_0x8b68('0x2e')](_0x3a8d15[_0x8b68('0x40')][_0x8b68('0x2e')]);}return _0x1854a9[_0x8b68('0x5b')](_0x49cce6);}})['then'](function(_0x3dfd43){if(_0x3dfd43){return _0x3dfd43?{'count':_0x1966f6,'rows':_0x3dfd43}:null;}})['then'](respondWithResult(_0x335b3b,null))[_0x8b68('0x2a')](handleError(_0x335b3b,null));};exports[_0x8b68('0x5c')]=function(_0x524763,_0x20c8b4,_0x75af51){var _0xa7890f={};var _0x4c9e0f={};var _0x3cca8c;var _0x18ee1a;return db[_0x8b68('0x3a')][_0x8b68('0x58')]({'where':{'id':_0x524763[_0x8b68('0x56')]['id']}})[_0x8b68('0x21')](handleEntityNotFound(_0x20c8b4,null))['then'](function(_0x3b1c92){if(_0x3b1c92){_0x3cca8c=_0x3b1c92;_0x4c9e0f[_0x8b68('0x3f')]=_[_0x8b68('0x41')](db['ServicenowField'][_0x8b68('0x3b')]);_0x4c9e0f[_0x8b68('0x40')]=_[_0x8b68('0x41')](_0x524763[_0x8b68('0x40')]);_0x4c9e0f[_0x8b68('0x42')]=_[_0x8b68('0x43')](_0x4c9e0f[_0x8b68('0x3f')],_0x4c9e0f[_0x8b68('0x40')]);_0xa7890f[_0x8b68('0x44')]=_[_0x8b68('0x43')](_0x4c9e0f[_0x8b68('0x3f')],qs['fields'](_0x524763['query'][_0x8b68('0x45')]));_0xa7890f[_0x8b68('0x44')]=_0xa7890f[_0x8b68('0x44')][_0x8b68('0x46')]?_0xa7890f[_0x8b68('0x44')]:_0x4c9e0f['model'];_0xa7890f[_0x8b68('0x59')]=qs[_0x8b68('0x48')](_0x524763[_0x8b68('0x40')][_0x8b68('0x48')]);_0xa7890f['where']=qs['filters'](_[_0x8b68('0x4a')](_0x524763[_0x8b68('0x40')],_0x4c9e0f[_0x8b68('0x42')]));if(_0x524763[_0x8b68('0x40')][_0x8b68('0x4b')]){_0xa7890f[_0x8b68('0x49')]=_[_0x8b68('0x4c')](_0xa7890f[_0x8b68('0x49')],{'$or':_['map'](_0xa7890f[_0x8b68('0x44')],function(_0x3fa9be){var _0x2b03b8={};_0x2b03b8[_0x3fa9be]={'$like':'%'+_0x524763[_0x8b68('0x40')][_0x8b68('0x4b')]+'%'};return _0x2b03b8;})});}_0xa7890f=_[_0x8b68('0x4c')]({},_0xa7890f,_0x524763['options']);return _0x3cca8c[_0x8b68('0x5c')](_0xa7890f);}})[_0x8b68('0x21')](function(_0x327cff){if(_0x327cff){_0x18ee1a=_0x327cff['length'];if(!_0x524763[_0x8b68('0x40')]['hasOwnProperty'](_0x8b68('0x47'))){_0xa7890f['limit']=qs[_0x8b68('0x2f')](_0x524763[_0x8b68('0x40')][_0x8b68('0x2f')]);_0xa7890f[_0x8b68('0x2e')]=qs[_0x8b68('0x2e')](_0x524763[_0x8b68('0x40')]['offset']);}return _0x3cca8c['getDescriptions'](_0xa7890f);}})['then'](function(_0xa20bfd){if(_0xa20bfd){return _0xa20bfd?{'count':_0x18ee1a,'rows':_0xa20bfd}:null;}})[_0x8b68('0x21')](respondWithResult(_0x20c8b4,null))[_0x8b68('0x2a')](handleError(_0x20c8b4,null));}; \ No newline at end of file +var _0x757a=['save','update','destroy','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','includeAll','rows','show','params','include','options','catch','create','body','find','findOne','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result','sendStatus','end','json','count','offset','status','set','apply','reject'];(function(_0x1b10b6,_0x2be625){var _0x397078=function(_0xe3dd06){while(--_0xe3dd06){_0x1b10b6['push'](_0x1b10b6['shift']());}};_0x397078(++_0x2be625);}(_0x757a,0xde));var _0xa757=function(_0x10ab5d,_0x2fc31a){_0x10ab5d=_0x10ab5d-0x0;var _0x3e5352=_0x757a[_0x10ab5d];return _0x3e5352;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var as=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))(_0xa757('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa757('0x16')]({'port':0x232a});function checkPasswordPattern(_0x544b45,_0x564187,_0x2ed0d2){if(_0x2ed0d2){var _0x513b1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x513b1f['test'](_0x564187)){return _0x544b45;}else{throw new db[(_0xa757('0x17'))][(_0xa757('0x18'))](_0xa757('0x19'));}}else{return _0x544b45;}}function respondWithRpcPromise(_0x4a0c38,_0x86abd,_0x31cfd2,_0xf12b68){return new BPromise(function(_0x2f7947,_0x185011){var _0x3df1f9=_0xf12b68||client;return _0x3df1f9['request'](_0x4a0c38,_0x31cfd2)[_0xa757('0x1a')](function(_0x44eab8){logger[_0xa757('0x1b')]('ServicenowConfiguration,\x20%s,\x20%s',_0x86abd,'request\x20sent');logger[_0xa757('0x1c')](_0xa757('0x1d'),_0x86abd,_0xa757('0x1e'),JSON[_0xa757('0x1f')](_0x44eab8));if(_0x44eab8[_0xa757('0x20')]){if(_0x44eab8[_0xa757('0x20')]['code']===0x1f4){logger[_0xa757('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x86abd,_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);return _0x185011(_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x86abd,_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);return _0x2f7947(_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);}else{logger[_0xa757('0x1b')](_0xa757('0x22'),_0x86abd,_0xa757('0x1e'));_0x2f7947(_0x44eab8[_0xa757('0x23')][_0xa757('0x21')]);}})['catch'](function(_0x3707c1){logger['error'](_0xa757('0x22'),_0x86abd,_0x3707c1);_0x185011(_0x3707c1);});});}function respondWithStatusCode(_0x47903b,_0x40551d){_0x40551d=_0x40551d||0xcc;return function(_0x3859ce){if(_0x3859ce){return _0x47903b[_0xa757('0x24')](_0x40551d);}return _0x47903b['status'](_0x40551d)[_0xa757('0x25')]();};}function respondWithResult(_0xcd98bd,_0x471e84){_0x471e84=_0x471e84||0xc8;return function(_0x3bf7f3){if(_0x3bf7f3){return _0xcd98bd['status'](_0x471e84)[_0xa757('0x26')](_0x3bf7f3);}};}function respondWithFilteredResult(_0x54263b,_0x5a5664){return function(_0x54b75e){if(_0x54b75e){var _0x4f8de2=_0x54b75e[_0xa757('0x27')],_0xfdf69d=_0x5a5664['offset'],_0x596ae2=_0x5a5664[_0xa757('0x28')]+_0x5a5664['limit'],_0x2208f9;if(_0x596ae2>=_0x4f8de2){_0x596ae2=_0x4f8de2;_0x2208f9=0xc8;}else{_0x2208f9=0xce;}_0x54263b[_0xa757('0x29')](_0x2208f9);return _0x54263b[_0xa757('0x2a')]('Content-Range',_0xfdf69d+'-'+_0x596ae2+'/'+_0x4f8de2)[_0xa757('0x26')](_0x54b75e);}return null;};}function patchUpdates(_0x5ade7b){return function(_0x3a4a66){try{jsonpatch[_0xa757('0x2b')](_0x3a4a66,_0x5ade7b,!![]);}catch(_0x458974){return BPromise[_0xa757('0x2c')](_0x458974);}return _0x3a4a66[_0xa757('0x2d')]();};}function saveUpdates(_0x2c1885,_0x1a44a9){return function(_0x2220df){if(_0x2220df){return _0x2220df[_0xa757('0x2e')](_0x2c1885)[_0xa757('0x1a')](function(_0x1f5d5a){return _0x1f5d5a;});}return null;};}function removeEntity(_0x20735f,_0x25dfbb){return function(_0x2dfb33){if(_0x2dfb33){return _0x2dfb33[_0xa757('0x2f')]()[_0xa757('0x1a')](function(){_0x20735f[_0xa757('0x29')](0xcc)[_0xa757('0x25')]();});}};}function handleEntityNotFound(_0x1eacde,_0x29a5ba){return function(_0x3de18f){if(!_0x3de18f){_0x1eacde[_0xa757('0x24')](0x194);}return _0x3de18f;};}function handleError(_0x379de7,_0x3aae1e){_0x3aae1e=_0x3aae1e||0x1f4;return function(_0x59700d){logger[_0xa757('0x20')](_0x59700d[_0xa757('0x30')]);if(_0x59700d[_0xa757('0x31')]){delete _0x59700d[_0xa757('0x31')];}_0x379de7[_0xa757('0x29')](_0x3aae1e)['send'](_0x59700d);};}exports[_0xa757('0x32')]=function(_0x2af470,_0x37b1a3){var _0x2c34b1={},_0xd54446={},_0xc97cb8={'count':0x0,'rows':[]};var _0x499390=_[_0xa757('0x33')](db[_0xa757('0x34')][_0xa757('0x35')],function(_0xc34409){return{'name':_0xc34409[_0xa757('0x36')],'type':_0xc34409[_0xa757('0x37')][_0xa757('0x38')]};});_0xd54446[_0xa757('0x39')]=_[_0xa757('0x33')](_0x499390,'name');_0xd54446[_0xa757('0x3a')]=_[_0xa757('0x3b')](_0x2af470[_0xa757('0x3a')]);_0xd54446[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0xd54446[_0xa757('0x39')],_0xd54446['query']);_0x2c34b1[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0xd54446['model'],qs['fields'](_0x2af470[_0xa757('0x3a')][_0xa757('0x3f')]));_0x2c34b1['attributes']=_0x2c34b1['attributes'][_0xa757('0x40')]?_0x2c34b1[_0xa757('0x3e')]:_0xd54446[_0xa757('0x39')];if(!_0x2af470['query'][_0xa757('0x41')](_0xa757('0x42'))){_0x2c34b1[_0xa757('0x43')]=qs[_0xa757('0x43')](_0x2af470[_0xa757('0x3a')]['limit']);_0x2c34b1[_0xa757('0x28')]=qs['offset'](_0x2af470['query'][_0xa757('0x28')]);}_0x2c34b1[_0xa757('0x44')]=qs[_0xa757('0x45')](_0x2af470[_0xa757('0x3a')][_0xa757('0x45')]);_0x2c34b1['where']=qs['filters'](_[_0xa757('0x46')](_0x2af470[_0xa757('0x3a')],_0xd54446[_0xa757('0x3c')]),_0x499390);if(_0x2af470[_0xa757('0x3a')][_0xa757('0x47')]){_0x2c34b1[_0xa757('0x48')]=_['merge'](_0x2c34b1[_0xa757('0x48')],{'$or':_[_0xa757('0x33')](_0x499390,function(_0x4d66d4){if(_0x4d66d4[_0xa757('0x37')]!=='VIRTUAL'){var _0x2d111e={};_0x2d111e[_0x4d66d4[_0xa757('0x31')]]={'$like':'%'+_0x2af470['query'][_0xa757('0x47')]+'%'};return _0x2d111e;}})});}_0x2c34b1=_[_0xa757('0x49')]({},_0x2c34b1,_0x2af470['options']);var _0x2f4709={'where':_0x2c34b1[_0xa757('0x48')]};return db[_0xa757('0x34')][_0xa757('0x27')](_0x2f4709)['then'](function(_0x199dc9){_0xc97cb8[_0xa757('0x27')]=_0x199dc9;if(_0x2af470[_0xa757('0x3a')][_0xa757('0x4a')]){_0x2c34b1['include']=[{'all':!![]}];}return db[_0xa757('0x34')]['findAll'](_0x2c34b1);})['then'](function(_0x2acf88){_0xc97cb8[_0xa757('0x4b')]=_0x2acf88;return _0xc97cb8;})[_0xa757('0x1a')](respondWithFilteredResult(_0x37b1a3,_0x2c34b1))['catch'](handleError(_0x37b1a3,null));};exports[_0xa757('0x4c')]=function(_0x560c6c,_0x2ed63f){var _0x151cc3={'raw':![],'where':{'id':_0x560c6c[_0xa757('0x4d')]['id']}},_0x265793={};_0x265793[_0xa757('0x39')]=_[_0xa757('0x3b')](db[_0xa757('0x34')][_0xa757('0x35')]);_0x265793['query']=_[_0xa757('0x3b')](_0x560c6c[_0xa757('0x3a')]);_0x265793[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x265793[_0xa757('0x39')],_0x265793[_0xa757('0x3a')]);_0x151cc3[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x265793[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x560c6c[_0xa757('0x3a')][_0xa757('0x3f')]));_0x151cc3[_0xa757('0x3e')]=_0x151cc3[_0xa757('0x3e')][_0xa757('0x40')]?_0x151cc3[_0xa757('0x3e')]:_0x265793['model'];if(_0x560c6c[_0xa757('0x3a')]['includeAll']){_0x151cc3[_0xa757('0x4e')]=[{'all':!![]}];}_0x151cc3=_[_0xa757('0x49')]({},_0x151cc3,_0x560c6c[_0xa757('0x4f')]);return db[_0xa757('0x34')]['find'](_0x151cc3)[_0xa757('0x1a')](handleEntityNotFound(_0x2ed63f,null))[_0xa757('0x1a')](respondWithResult(_0x2ed63f,null))[_0xa757('0x50')](handleError(_0x2ed63f,null));};exports[_0xa757('0x51')]=function(_0x595f16,_0x383674){return db[_0xa757('0x34')][_0xa757('0x51')](_0x595f16[_0xa757('0x52')],{})[_0xa757('0x1a')](respondWithResult(_0x383674,0xc9))[_0xa757('0x50')](handleError(_0x383674,null));};exports['update']=function(_0x485100,_0x5d21c1){if(_0x485100['body']['id']){delete _0x485100[_0xa757('0x52')]['id'];}return db[_0xa757('0x34')][_0xa757('0x53')]({'where':{'id':_0x485100[_0xa757('0x4d')]['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x5d21c1,null))[_0xa757('0x1a')](saveUpdates(_0x485100['body'],null))[_0xa757('0x1a')](respondWithResult(_0x5d21c1,null))[_0xa757('0x50')](handleError(_0x5d21c1,null));};exports[_0xa757('0x2f')]=function(_0x29b2f5,_0x48b578){return db[_0xa757('0x34')][_0xa757('0x53')]({'where':{'id':_0x29b2f5['params']['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x48b578,null))['then'](removeEntity(_0x48b578,null))[_0xa757('0x50')](handleError(_0x48b578,null));};exports['getFields']=function(_0x51be6e,_0x58633a,_0x4badee){var _0x367b48={};var _0x235c1e={};var _0x1b6058;var _0x1b5db5;return db[_0xa757('0x34')][_0xa757('0x54')]({'where':{'id':_0x51be6e['params']['id']}})['then'](handleEntityNotFound(_0x58633a,null))[_0xa757('0x1a')](function(_0x3afa56){if(_0x3afa56){_0x1b6058=_0x3afa56;_0x235c1e[_0xa757('0x39')]=_['keys'](db['ServicenowField'][_0xa757('0x35')]);_0x235c1e[_0xa757('0x3a')]=_[_0xa757('0x3b')](_0x51be6e[_0xa757('0x3a')]);_0x235c1e[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x235c1e['model'],_0x235c1e[_0xa757('0x3a')]);_0x367b48[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x235c1e[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x51be6e[_0xa757('0x3a')][_0xa757('0x3f')]));_0x367b48[_0xa757('0x3e')]=_0x367b48[_0xa757('0x3e')][_0xa757('0x40')]?_0x367b48['attributes']:_0x235c1e[_0xa757('0x39')];_0x367b48['order']=qs['sort'](_0x51be6e[_0xa757('0x3a')][_0xa757('0x45')]);_0x367b48[_0xa757('0x48')]=qs[_0xa757('0x3c')](_[_0xa757('0x46')](_0x51be6e[_0xa757('0x3a')],_0x235c1e[_0xa757('0x3c')]));if(_0x51be6e[_0xa757('0x3a')][_0xa757('0x47')]){_0x367b48[_0xa757('0x48')]=_[_0xa757('0x49')](_0x367b48['where'],{'$or':_[_0xa757('0x33')](_0x367b48[_0xa757('0x3e')],function(_0x5f0b71){var _0x11ebb3={};_0x11ebb3[_0x5f0b71]={'$like':'%'+_0x51be6e[_0xa757('0x3a')][_0xa757('0x47')]+'%'};return _0x11ebb3;})});}_0x367b48=_[_0xa757('0x49')]({},_0x367b48,_0x51be6e[_0xa757('0x4f')]);return _0x1b6058[_0xa757('0x55')](_0x367b48);}})['then'](function(_0x413217){if(_0x413217){_0x1b5db5=_0x413217['length'];if(!_0x51be6e[_0xa757('0x3a')][_0xa757('0x41')](_0xa757('0x42'))){_0x367b48[_0xa757('0x43')]=qs[_0xa757('0x43')](_0x51be6e['query']['limit']);_0x367b48[_0xa757('0x28')]=qs[_0xa757('0x28')](_0x51be6e[_0xa757('0x3a')]['offset']);}return _0x1b6058[_0xa757('0x55')](_0x367b48);}})['then'](function(_0x34982a){if(_0x34982a){return _0x34982a?{'count':_0x1b5db5,'rows':_0x34982a}:null;}})[_0xa757('0x1a')](respondWithResult(_0x58633a,null))[_0xa757('0x50')](handleError(_0x58633a,null));};exports[_0xa757('0x56')]=function(_0x10cb5e,_0x40a79b,_0x54730c){var _0xa28144={};var _0x193233={};var _0x1e15ee;var _0x125bda;return db[_0xa757('0x34')]['findOne']({'where':{'id':_0x10cb5e[_0xa757('0x4d')]['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x40a79b,null))[_0xa757('0x1a')](function(_0x38724c){if(_0x38724c){_0x1e15ee=_0x38724c;_0x193233[_0xa757('0x39')]=_['keys'](db[_0xa757('0x57')][_0xa757('0x35')]);_0x193233[_0xa757('0x3a')]=_['keys'](_0x10cb5e[_0xa757('0x3a')]);_0x193233[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x193233[_0xa757('0x39')],_0x193233[_0xa757('0x3a')]);_0xa28144[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x193233[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x3f')]));_0xa28144[_0xa757('0x3e')]=_0xa28144[_0xa757('0x3e')][_0xa757('0x40')]?_0xa28144['attributes']:_0x193233[_0xa757('0x39')];_0xa28144[_0xa757('0x44')]=qs['sort'](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x45')]);_0xa28144['where']=qs[_0xa757('0x3c')](_[_0xa757('0x46')](_0x10cb5e[_0xa757('0x3a')],_0x193233[_0xa757('0x3c')]));if(_0x10cb5e[_0xa757('0x3a')][_0xa757('0x47')]){_0xa28144[_0xa757('0x48')]=_[_0xa757('0x49')](_0xa28144[_0xa757('0x48')],{'$or':_[_0xa757('0x33')](_0xa28144[_0xa757('0x3e')],function(_0x189195){var _0x2c2b40={};_0x2c2b40[_0x189195]={'$like':'%'+_0x10cb5e[_0xa757('0x3a')][_0xa757('0x47')]+'%'};return _0x2c2b40;})});}_0xa28144=_[_0xa757('0x49')]({},_0xa28144,_0x10cb5e['options']);return _0x1e15ee[_0xa757('0x56')](_0xa28144);}})['then'](function(_0x39357f){if(_0x39357f){_0x125bda=_0x39357f[_0xa757('0x40')];if(!_0x10cb5e[_0xa757('0x3a')][_0xa757('0x41')](_0xa757('0x42'))){_0xa28144['limit']=qs[_0xa757('0x43')](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x43')]);_0xa28144['offset']=qs[_0xa757('0x28')](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x28')]);}return _0x1e15ee['getSubjects'](_0xa28144);}})['then'](function(_0x1f437d){if(_0x1f437d){return _0x1f437d?{'count':_0x125bda,'rows':_0x1f437d}:null;}})[_0xa757('0x1a')](respondWithResult(_0x40a79b,null))[_0xa757('0x50')](handleError(_0x40a79b,null));};exports['getDescriptions']=function(_0x5dcd35,_0x4cc1ad,_0x4cfc69){var _0x45b424={};var _0x1adf5a={};var _0x476297;var _0x5bf64b;return db[_0xa757('0x34')][_0xa757('0x54')]({'where':{'id':_0x5dcd35[_0xa757('0x4d')]['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x4cc1ad,null))[_0xa757('0x1a')](function(_0x2d0ce0){if(_0x2d0ce0){_0x476297=_0x2d0ce0;_0x1adf5a[_0xa757('0x39')]=_[_0xa757('0x3b')](db[_0xa757('0x57')][_0xa757('0x35')]);_0x1adf5a[_0xa757('0x3a')]=_[_0xa757('0x3b')](_0x5dcd35['query']);_0x1adf5a[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x1adf5a[_0xa757('0x39')],_0x1adf5a[_0xa757('0x3a')]);_0x45b424[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x1adf5a[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x5dcd35[_0xa757('0x3a')][_0xa757('0x3f')]));_0x45b424[_0xa757('0x3e')]=_0x45b424[_0xa757('0x3e')][_0xa757('0x40')]?_0x45b424[_0xa757('0x3e')]:_0x1adf5a[_0xa757('0x39')];_0x45b424[_0xa757('0x44')]=qs[_0xa757('0x45')](_0x5dcd35[_0xa757('0x3a')][_0xa757('0x45')]);_0x45b424[_0xa757('0x48')]=qs[_0xa757('0x3c')](_[_0xa757('0x46')](_0x5dcd35['query'],_0x1adf5a[_0xa757('0x3c')]));if(_0x5dcd35[_0xa757('0x3a')]['filter']){_0x45b424[_0xa757('0x48')]=_['merge'](_0x45b424[_0xa757('0x48')],{'$or':_[_0xa757('0x33')](_0x45b424['attributes'],function(_0x33a613){var _0x2eac20={};_0x2eac20[_0x33a613]={'$like':'%'+_0x5dcd35[_0xa757('0x3a')][_0xa757('0x47')]+'%'};return _0x2eac20;})});}_0x45b424=_['merge']({},_0x45b424,_0x5dcd35[_0xa757('0x4f')]);return _0x476297[_0xa757('0x58')](_0x45b424);}})['then'](function(_0x30716a){if(_0x30716a){_0x5bf64b=_0x30716a[_0xa757('0x40')];if(!_0x5dcd35['query'][_0xa757('0x41')](_0xa757('0x42'))){_0x45b424[_0xa757('0x43')]=qs[_0xa757('0x43')](_0x5dcd35[_0xa757('0x3a')][_0xa757('0x43')]);_0x45b424[_0xa757('0x28')]=qs[_0xa757('0x28')](_0x5dcd35[_0xa757('0x3a')]['offset']);}return _0x476297['getDescriptions'](_0x45b424);}})[_0xa757('0x1a')](function(_0x770298){if(_0x770298){return _0x770298?{'count':_0x5bf64b,'rows':_0x770298}:null;}})[_0xa757('0x1a')](respondWithResult(_0x4cc1ad,null))[_0xa757('0x50')](handleError(_0x4cc1ad,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 73d2bbc..623d3c7 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 _0xe0dc=['./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xe0dc,0x190));var _0xce0d=function(_0x57d500,_0xf52c67){_0x57d500=_0x57d500-0x0;var _0x142c14=_0xe0dc[_0x57d500];return _0x142c14;};'use strict';var _=require(_0xce0d('0x0'));var util=require('util');var logger=require(_0xce0d('0x1'))(_0xce0d('0x2'));var moment=require('moment');var BPromise=require(_0xce0d('0x3'));var rp=require(_0xce0d('0x4'));var fs=require('fs');var path=require(_0xce0d('0x5'));var rimraf=require(_0xce0d('0x6'));var config=require('../../config/environment');var attributes=require(_0xce0d('0x7'));module['exports']=function(_0x3e7888,_0x33f430){return _0x3e7888[_0xce0d('0x8')](_0xce0d('0x9'),attributes,{'tableName':_0xce0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb258=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0xc83032,_0x45a177){var _0x43f1f5=function(_0x401e12){while(--_0x401e12){_0xc83032['push'](_0xc83032['shift']());}};_0x43f1f5(++_0x45a177);}(_0xb258,0x19c));var _0x8b25=function(_0x205b9e,_0x2426bc){_0x205b9e=_0x205b9e-0x0;var _0x338aa8=_0xb258[_0x205b9e];return _0x338aa8;};'use strict';var _=require('lodash');var util=require(_0x8b25('0x0'));var logger=require(_0x8b25('0x1'))('api');var moment=require(_0x8b25('0x2'));var BPromise=require(_0x8b25('0x3'));var rp=require(_0x8b25('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b25('0x5'));var config=require(_0x8b25('0x6'));var attributes=require(_0x8b25('0x7'));module[_0x8b25('0x8')]=function(_0x20c7d9,_0x489b6f){return _0x20c7d9[_0x8b25('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x8b25('0xa'),'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 1cd537d..f8965c8 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 _0x8106=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x46d393,_0x4c3c22){var _0x532209=function(_0x48c10c){while(--_0x48c10c){_0x46d393['push'](_0x46d393['shift']());}};_0x532209(++_0x4c3c22);}(_0x8106,0x76));var _0x6810=function(_0x2a673c,_0x1e01ff){_0x2a673c=_0x2a673c-0x0;var _0x2cbafa=_0x8106[_0x2a673c];return _0x2cbafa;};'use strict';var _=require(_0x6810('0x0'));var util=require(_0x6810('0x1'));var moment=require(_0x6810('0x2'));var BPromise=require(_0x6810('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6810('0x4'));var db=require(_0x6810('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6810('0x6'))(_0x6810('0x7'));var config=require(_0x6810('0x8'));var jayson=require(_0x6810('0x9'));var client=jayson['client'][_0x6810('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59d477,_0xd88e0a,_0x364e61){return new BPromise(function(_0x2b047d,_0x4088e5){return client[_0x6810('0xb')](_0x59d477,_0x364e61)[_0x6810('0xc')](function(_0x46bb7a){logger[_0x6810('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0xd88e0a,'request\x20sent');logger[_0x6810('0xe')](_0x6810('0xf'),_0xd88e0a,_0x6810('0x10'),JSON[_0x6810('0x11')](_0x46bb7a));if(_0x46bb7a[_0x6810('0x12')]){if(_0x46bb7a[_0x6810('0x12')][_0x6810('0x13')]===0x1f4){logger[_0x6810('0x12')](_0x6810('0x14'),_0xd88e0a,_0x46bb7a[_0x6810('0x12')][_0x6810('0x15')]);return _0x4088e5(_0x46bb7a[_0x6810('0x12')][_0x6810('0x15')]);}logger[_0x6810('0x12')](_0x6810('0x14'),_0xd88e0a,_0x46bb7a['error'][_0x6810('0x15')]);return _0x2b047d(_0x46bb7a[_0x6810('0x12')][_0x6810('0x15')]);}else{logger[_0x6810('0xd')](_0x6810('0x14'),_0xd88e0a,'request\x20sent');_0x2b047d(_0x46bb7a[_0x6810('0x16')]['message']);}})[_0x6810('0x17')](function(_0x4f2376){logger[_0x6810('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0xd88e0a,_0x4f2376);_0x4088e5(_0x4f2376);});});} \ No newline at end of file +var _0xd065=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xd065,0x8f));var _0x5d06=function(_0x62208,_0x23b8ae){_0x62208=_0x62208-0x0;var _0x5a174e=_0xd065[_0x62208];return _0x5a174e;};'use strict';var _=require(_0x5d06('0x0'));var util=require(_0x5d06('0x1'));var moment=require(_0x5d06('0x2'));var BPromise=require(_0x5d06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d06('0x4'));var db=require(_0x5d06('0x5'))['db'];var utils=require(_0x5d06('0x6'));var logger=require(_0x5d06('0x7'))(_0x5d06('0x8'));var config=require('../../config/environment');var jayson=require(_0x5d06('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30c037,_0xaa0ef,_0x314272){return new BPromise(function(_0x3e7a59,_0x3e4875){return client[_0x5d06('0xa')](_0x30c037,_0x314272)[_0x5d06('0xb')](function(_0x1e6f34){logger[_0x5d06('0xc')](_0x5d06('0xd'),_0xaa0ef,_0x5d06('0xe'));logger[_0x5d06('0xf')](_0x5d06('0x10'),_0xaa0ef,_0x5d06('0xe'),JSON['stringify'](_0x1e6f34));if(_0x1e6f34[_0x5d06('0x11')]){if(_0x1e6f34[_0x5d06('0x11')]['code']===0x1f4){logger[_0x5d06('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xaa0ef,_0x1e6f34['error'][_0x5d06('0x12')]);return _0x3e4875(_0x1e6f34[_0x5d06('0x11')]['message']);}logger[_0x5d06('0x11')](_0x5d06('0xd'),_0xaa0ef,_0x1e6f34[_0x5d06('0x11')][_0x5d06('0x12')]);return _0x3e7a59(_0x1e6f34['error'][_0x5d06('0x12')]);}else{logger[_0x5d06('0xc')](_0x5d06('0xd'),_0xaa0ef,'request\x20sent');_0x3e7a59(_0x1e6f34[_0x5d06('0x13')][_0x5d06('0x12')]);}})[_0x5d06('0x14')](function(_0x5b6613){logger[_0x5d06('0x11')](_0x5d06('0xd'),_0xaa0ef,_0x5b6613);_0x3e4875(_0x5b6613);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 328f973..5575ef6 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 _0xecc3=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','show','post','put','/:id','update','exports','multer'];(function(_0x3f4989,_0x484af9){var _0x36ccdd=function(_0x4dedd8){while(--_0x4dedd8){_0x3f4989['push'](_0x3f4989['shift']());}};_0x36ccdd(++_0x484af9);}(_0xecc3,0xbd));var _0x3ecc=function(_0x414f6b,_0x585e6d){_0x414f6b=_0x414f6b-0x0;var _0x3f2fba=_0xecc3[_0x414f6b];return _0x3f2fba;};'use strict';var multer=require(_0x3ecc('0x0'));var util=require(_0x3ecc('0x1'));var path=require(_0x3ecc('0x2'));var timeout=require(_0x3ecc('0x3'));var express=require(_0x3ecc('0x4'));var router=express[_0x3ecc('0x5')]();var auth=require(_0x3ecc('0x6'));var interaction=require(_0x3ecc('0x7'));var config=require(_0x3ecc('0x8'));var controller=require(_0x3ecc('0x9'));router[_0x3ecc('0xa')]('/',auth[_0x3ecc('0xb')](),controller[_0x3ecc('0xc')]);router[_0x3ecc('0xa')]('/:id',auth[_0x3ecc('0xb')](),controller[_0x3ecc('0xd')]);router[_0x3ecc('0xe')]('/',auth[_0x3ecc('0xb')](),controller['create']);router[_0x3ecc('0xf')](_0x3ecc('0x10'),auth[_0x3ecc('0xb')](),controller[_0x3ecc('0x11')]);router['delete'](_0x3ecc('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x3ecc('0x12')]=router; \ No newline at end of file +var _0x710c=['../../config/environment','isAuthenticated','index','get','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3763f9,_0x37866b){var _0x27a104=function(_0x59862c){while(--_0x59862c){_0x3763f9['push'](_0x3763f9['shift']());}};_0x27a104(++_0x37866b);}(_0x710c,0xf8));var _0xc710=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x710c[_0x265aa2];return _0x447a3a;};'use strict';var multer=require(_0xc710('0x0'));var util=require(_0xc710('0x1'));var path=require(_0xc710('0x2'));var timeout=require(_0xc710('0x3'));var express=require('express');var router=express[_0xc710('0x4')]();var auth=require(_0xc710('0x5'));var interaction=require(_0xc710('0x6'));var config=require(_0xc710('0x7'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xc710('0x8')](),controller[_0xc710('0x9')]);router[_0xc710('0xa')]('/:id',auth[_0xc710('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc710('0xb')]);router[_0xc710('0xc')](_0xc710('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xc710('0xe')](_0xc710('0xd'),auth[_0xc710('0x8')](),controller[_0xc710('0xf')]);module[_0xc710('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1cbeec3..033f769 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 _0x0d00=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3e81b2,_0x44d939){var _0x281c48=function(_0x9867d0){while(--_0x9867d0){_0x3e81b2['push'](_0x3e81b2['shift']());}};_0x281c48(++_0x44d939);}(_0x0d00,0x13d));var _0x00d0=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x0d00[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require(_0x00d0('0x0'));module[_0x00d0('0x1')]={'type':{'type':Sequelize[_0x00d0('0x2')](_0x00d0('0x3'),_0x00d0('0x4'),_0x00d0('0x5'),'keyValue'),'defaultValue':_0x00d0('0x3')},'content':{'type':Sequelize[_0x00d0('0x6')]},'key':{'type':Sequelize[_0x00d0('0x6')]},'keyType':{'type':Sequelize[_0x00d0('0x2')](_0x00d0('0x3'),_0x00d0('0x4'),_0x00d0('0x5'))},'keyContent':{'type':Sequelize[_0x00d0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x00d0('0x6')]},'customField':{'type':Sequelize[_0x00d0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00d0('0x6')]}}; \ No newline at end of file +var _0x0404=['ENUM','string','variable','customVariable','keyValue','STRING','exports'];(function(_0x4ddc7a,_0x5b6cb8){var _0x4547c1=function(_0x3739e7){while(--_0x3739e7){_0x4ddc7a['push'](_0x4ddc7a['shift']());}};_0x4547c1(++_0x5b6cb8);}(_0x0404,0xf4));var _0x4040=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0x0404[_0x1428d9];return _0x438019;};'use strict';var Sequelize=require('sequelize');module[_0x4040('0x0')]={'type':{'type':Sequelize[_0x4040('0x1')](_0x4040('0x2'),_0x4040('0x3'),_0x4040('0x4'),_0x4040('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4040('0x6')]},'key':{'type':Sequelize[_0x4040('0x6')]},'keyType':{'type':Sequelize[_0x4040('0x1')](_0x4040('0x2'),'variable',_0x4040('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4040('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4040('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 72d38dc..5760d91 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1ec506,_0x1e882d){var _0x56381f=function(_0x5bc395){while(--_0x5bc395){_0x1ec506['push'](_0x1ec506['shift']());}};_0x56381f(++_0x1e882d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x268267,_0x2f2d79){var _0x54815e=function(_0x54f8cb){while(--_0x54f8cb){_0x268267['push'](_0x268267['shift']());}};_0x54815e(++_0x2f2d79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 5be4171..bead9fd 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 _0xc4d4=['path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','idField','lodash','util','../../config/logger','api','moment'];(function(_0x59d0c0,_0x39a54d){var _0x3f28d2=function(_0x58c365){while(--_0x58c365){_0x59d0c0['push'](_0x59d0c0['shift']());}};_0x3f28d2(++_0x39a54d);}(_0xc4d4,0x193));var _0x4c4d=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0xc4d4[_0x4d821c];return _0x15dd5b;};'use strict';var _=require(_0x4c4d('0x0'));var util=require(_0x4c4d('0x1'));var logger=require(_0x4c4d('0x2'))(_0x4c4d('0x3'));var moment=require(_0x4c4d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c4d('0x5'));var rimraf=require(_0x4c4d('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c4d('0x7'));module[_0x4c4d('0x8')]=function(_0xea4b4d,_0x15358a){return _0xea4b4d[_0x4c4d('0x9')](_0x4c4d('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x4c4d('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47b8=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','int_servicenow_fields','FieldId','lodash','../../config/logger','api'];(function(_0xad295a,_0x1d20eb){var _0x3df315=function(_0x5883fd){while(--_0x5883fd){_0xad295a['push'](_0xad295a['shift']());}};_0x3df315(++_0x1d20eb);}(_0x47b8,0x111));var _0x847b=function(_0x44051e,_0xfdce41){_0x44051e=_0x44051e-0x0;var _0x57a6d0=_0x47b8[_0x44051e];return _0x57a6d0;};'use strict';var _=require(_0x847b('0x0'));var util=require('util');var logger=require(_0x847b('0x1'))(_0x847b('0x2'));var moment=require(_0x847b('0x3'));var BPromise=require('bluebird');var rp=require(_0x847b('0x4'));var fs=require('fs');var path=require(_0x847b('0x5'));var rimraf=require(_0x847b('0x6'));var config=require(_0x847b('0x7'));var attributes=require(_0x847b('0x8'));module[_0x847b('0x9')]=function(_0x591175,_0x440ac4){return _0x591175['define']('ServicenowField',attributes,{'tableName':_0x847b('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x847b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 291528d..4586cee 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 _0xfbc2=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbc2,0xb4));var _0x2fbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfbc2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fbc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2fbc('0x1'));var rs=require(_0x2fbc('0x2'));var fs=require('fs');var Redis=require(_0x2fbc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fbc('0x4'));var logger=require(_0x2fbc('0x5'))(_0x2fbc('0x6'));var config=require(_0x2fbc('0x7'));var jayson=require(_0x2fbc('0x8'));var client=jayson['client'][_0x2fbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51cea9,_0xe1f12a,_0x5b51c0){return new BPromise(function(_0x5da2d2,_0x2df5c4){return client[_0x2fbc('0xa')](_0x51cea9,_0x5b51c0)[_0x2fbc('0xb')](function(_0x22c7f1){logger[_0x2fbc('0xc')](_0x2fbc('0xd'),_0xe1f12a,_0x2fbc('0xe'));logger['debug']('ServicenowField,\x20%s,\x20%s,\x20%s',_0xe1f12a,_0x2fbc('0xe'),JSON[_0x2fbc('0xf')](_0x22c7f1));if(_0x22c7f1[_0x2fbc('0x10')]){if(_0x22c7f1[_0x2fbc('0x10')][_0x2fbc('0x11')]===0x1f4){logger[_0x2fbc('0x10')](_0x2fbc('0xd'),_0xe1f12a,_0x22c7f1[_0x2fbc('0x10')][_0x2fbc('0x12')]);return _0x2df5c4(_0x22c7f1[_0x2fbc('0x10')][_0x2fbc('0x12')]);}logger[_0x2fbc('0x10')](_0x2fbc('0xd'),_0xe1f12a,_0x22c7f1['error'][_0x2fbc('0x12')]);return _0x5da2d2(_0x22c7f1[_0x2fbc('0x10')][_0x2fbc('0x12')]);}else{logger[_0x2fbc('0xc')](_0x2fbc('0xd'),_0xe1f12a,_0x2fbc('0xe'));_0x5da2d2(_0x22c7f1[_0x2fbc('0x13')]['message']);}})[_0x2fbc('0x14')](function(_0x4d0c6a){logger[_0x2fbc('0x10')]('ServicenowField,\x20%s,\x20%s',_0xe1f12a,_0x4d0c6a);_0x2df5c4(_0x4d0c6a);});});} \ No newline at end of file +var _0x9c9f=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x9c9f,0xde));var _0xf9c9=function(_0x4a5292,_0x5deee0){_0x4a5292=_0x4a5292-0x0;var _0x31c72d=_0x9c9f[_0x4a5292];return _0x31c72d;};'use strict';var _=require('lodash');var util=require(_0xf9c9('0x0'));var moment=require(_0xf9c9('0x1'));var BPromise=require(_0xf9c9('0x2'));var rs=require(_0xf9c9('0x3'));var fs=require('fs');var Redis=require(_0xf9c9('0x4'));var db=require(_0xf9c9('0x5'))['db'];var utils=require(_0xf9c9('0x6'));var logger=require('../../config/logger')(_0xf9c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xf9c9('0x8'));var client=jayson[_0xf9c9('0x9')][_0xf9c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x540c27,_0x93cdb4,_0x36076b){return new BPromise(function(_0x50765b,_0x51ca64){return client[_0xf9c9('0xb')](_0x540c27,_0x36076b)[_0xf9c9('0xc')](function(_0x597b68){logger[_0xf9c9('0xd')](_0xf9c9('0xe'),_0x93cdb4,_0xf9c9('0xf'));logger[_0xf9c9('0x10')](_0xf9c9('0x11'),_0x93cdb4,'request\x20sent',JSON[_0xf9c9('0x12')](_0x597b68));if(_0x597b68['error']){if(_0x597b68[_0xf9c9('0x13')][_0xf9c9('0x14')]===0x1f4){logger['error']('ServicenowField,\x20%s,\x20%s',_0x93cdb4,_0x597b68[_0xf9c9('0x13')][_0xf9c9('0x15')]);return _0x51ca64(_0x597b68['error']['message']);}logger['error'](_0xf9c9('0xe'),_0x93cdb4,_0x597b68[_0xf9c9('0x13')][_0xf9c9('0x15')]);return _0x50765b(_0x597b68['error'][_0xf9c9('0x15')]);}else{logger[_0xf9c9('0xd')](_0xf9c9('0xe'),_0x93cdb4,_0xf9c9('0xf'));_0x50765b(_0x597b68[_0xf9c9('0x16')]['message']);}})[_0xf9c9('0x17')](function(_0xbdc13){logger[_0xf9c9('0x13')](_0xf9c9('0xe'),_0x93cdb4,_0xbdc13);_0x51ca64(_0xbdc13);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 01c6ae4..0aa2f58 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 _0x4314=['addConfiguration','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0xaac2c8,_0x4252f8){var _0xae37aa=function(_0x2d0835){while(--_0x2d0835){_0xaac2c8['push'](_0xaac2c8['shift']());}};_0xae37aa(++_0x4252f8);}(_0x4314,0xca));var _0x4431=function(_0x1fd590,_0x1232c0){_0x1fd590=_0x1fd590-0x0;var _0x227edc=_0x4314[_0x1fd590];return _0x227edc;};'use strict';var multer=require(_0x4431('0x0'));var util=require('util');var path=require(_0x4431('0x1'));var timeout=require(_0x4431('0x2'));var express=require(_0x4431('0x3'));var router=express[_0x4431('0x4')]();var auth=require(_0x4431('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4431('0x6'));router['get']('/',auth[_0x4431('0x7')](),controller[_0x4431('0x8')]);router[_0x4431('0x9')](_0x4431('0xa'),auth[_0x4431('0x7')](),controller[_0x4431('0xb')]);router[_0x4431('0x9')](_0x4431('0xc'),auth[_0x4431('0x7')](),controller[_0x4431('0xd')]);router[_0x4431('0x9')](_0x4431('0xe'),auth[_0x4431('0x7')](),controller[_0x4431('0xf')]);router[_0x4431('0x10')]('/',auth[_0x4431('0x7')](),controller[_0x4431('0x11')]);router[_0x4431('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4431('0x12')]);router[_0x4431('0x13')](_0x4431('0xa'),auth[_0x4431('0x7')](),controller['update']);router[_0x4431('0x14')](_0x4431('0xa'),auth[_0x4431('0x7')](),controller['destroy']);module[_0x4431('0x15')]=router; \ No newline at end of file +var _0x7b10=['index','/:id','show','/:id/fields','post','create','/:id/configurations','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated'];(function(_0xa82845,_0x142cdf){var _0x153b30=function(_0xd44b8a){while(--_0xd44b8a){_0xa82845['push'](_0xa82845['shift']());}};_0x153b30(++_0x142cdf);}(_0x7b10,0xde));var _0x07b1=function(_0x282577,_0x1bf04d){_0x282577=_0x282577-0x0;var _0xceb014=_0x7b10[_0x282577];return _0xceb014;};'use strict';var multer=require('multer');var util=require(_0x07b1('0x0'));var path=require('path');var timeout=require(_0x07b1('0x1'));var express=require(_0x07b1('0x2'));var router=express[_0x07b1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x07b1('0x4'));var config=require(_0x07b1('0x5'));var controller=require(_0x07b1('0x6'));router[_0x07b1('0x7')]('/',auth[_0x07b1('0x8')](),controller[_0x07b1('0x9')]);router[_0x07b1('0x7')](_0x07b1('0xa'),auth[_0x07b1('0x8')](),controller[_0x07b1('0xb')]);router[_0x07b1('0x7')]('/:id/configurations',auth[_0x07b1('0x8')](),controller['getConfigurations']);router[_0x07b1('0x7')](_0x07b1('0xc'),auth[_0x07b1('0x8')](),controller['getFields']);router[_0x07b1('0xd')]('/',auth[_0x07b1('0x8')](),controller[_0x07b1('0xe')]);router[_0x07b1('0xd')](_0x07b1('0xf'),auth[_0x07b1('0x8')](),controller['addConfiguration']);router[_0x07b1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x07b1('0x11')]);router[_0x07b1('0x12')]('/:id',auth[_0x07b1('0x8')](),controller[_0x07b1('0x13')]);module[_0x07b1('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 1debf5b..d908360 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 _0x1161=['username','remoteUri','sequelize','exports','STRING'];(function(_0x291220,_0x137a1b){var _0x49275f=function(_0x1a733d){while(--_0x1a733d){_0x291220['push'](_0x291220['shift']());}};_0x49275f(++_0x137a1b);}(_0x1161,0x156));var _0x1116=function(_0x14f7a1,_0x1ff4c7){_0x14f7a1=_0x14f7a1-0x0;var _0x117110=_0x1161[_0x14f7a1];return _0x117110;};'use strict';var Sequelize=require(_0x1116('0x0'));module[_0x1116('0x1')]={'name':{'type':Sequelize[_0x1116('0x2')]},'description':{'type':Sequelize[_0x1116('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1116('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1116('0x2')],'unique':_0x1116('0x4')},'serverUrl':{'type':Sequelize[_0x1116('0x2')]}}; \ No newline at end of file +var _0xc40f=['username','sequelize','STRING'];(function(_0x5a4a1e,_0x5f014c){var _0x13b91d=function(_0x1b8403){while(--_0x1b8403){_0x5a4a1e['push'](_0x5a4a1e['shift']());}};_0x13b91d(++_0x5f014c);}(_0xc40f,0x1f0));var _0xfc40=function(_0x33403b,_0x5cca9c){_0x33403b=_0x33403b-0x0;var _0x2d8657=_0xc40f[_0x33403b];return _0x2d8657;};'use strict';var Sequelize=require(_0xfc40('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc40('0x1')]},'description':{'type':Sequelize[_0xfc40('0x1')]},'username':{'type':Sequelize[_0xfc40('0x1')],'unique':_0xfc40('0x2')},'password':{'type':Sequelize[_0xfc40('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xfc40('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index bc50d7d..c1c753b 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 _0xf3d0=['statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','status','end','json','offset','limit','set','apply','update','destroy','sendStatus','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','show','params','intersection','fields','length','include','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','format','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','label','endsWith','value'];(function(_0x11f2ec,_0x1c6718){var _0x1681a1=function(_0x208432){while(--_0x208432){_0x11f2ec['push'](_0x11f2ec['shift']());}};_0x1681a1(++_0x1c6718);}(_0xf3d0,0x87));var _0x0f3d=function(_0x3f9973,_0xafff86){_0x3f9973=_0x3f9973-0x0;var _0x4e694c=_0xf3d0[_0x3f9973];return _0x4e694c;};'use strict';var pdf=require(_0x0f3d('0x0'));var emlformat=require(_0x0f3d('0x1'));var rimraf=require(_0x0f3d('0x2'));var zipdir=require(_0x0f3d('0x3'));var jsonpatch=require(_0x0f3d('0x4'));var rp=require(_0x0f3d('0x5'));var moment=require(_0x0f3d('0x6'));var BPromise=require(_0x0f3d('0x7'));var Mustache=require(_0x0f3d('0x8'));var util=require(_0x0f3d('0x9'));var path=require(_0x0f3d('0xa'));var sox=require(_0x0f3d('0xb'));var csv=require(_0x0f3d('0xc'));var ejs=require(_0x0f3d('0xd'));var fs=require('fs');var _=require(_0x0f3d('0xe'));var squel=require(_0x0f3d('0xf'));var crypto=require('crypto');var jsforce=require(_0x0f3d('0x10'));var deskjs=require(_0x0f3d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0f3d('0x12'));var Papa=require(_0x0f3d('0x13'));var Redis=require(_0x0f3d('0x14'));var authService=require(_0x0f3d('0x15'));var qs=require(_0x0f3d('0x16'));var as=require(_0x0f3d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f3d('0x18'))('api');var utils=require(_0x0f3d('0x19'));var config=require(_0x0f3d('0x1a'));var db=require(_0x0f3d('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0f3d('0x1c'));var client=jayson['client'][_0x0f3d('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3e02e2,_0x34588e,_0x181258){if(_0x181258){var _0x2bf609=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2bf609[_0x0f3d('0x1e')](_0x34588e)){return _0x3e02e2;}else{throw new db[(_0x0f3d('0x1f'))][(_0x0f3d('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3e02e2;}}function respondWithRpcPromise(_0x4b085c,_0x58b093,_0x53b980,_0x302aec){return new BPromise(function(_0x103ad3,_0x3682c2){var _0x515889=_0x302aec||client;return _0x515889[_0x0f3d('0x21')](_0x4b085c,_0x53b980)[_0x0f3d('0x22')](function(_0x14a664){logger[_0x0f3d('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x58b093,_0x0f3d('0x24'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x58b093,'request\x20sent',JSON['stringify'](_0x14a664));if(_0x14a664[_0x0f3d('0x25')]){if(_0x14a664[_0x0f3d('0x25')][_0x0f3d('0x26')]===0x1f4){logger[_0x0f3d('0x25')](_0x0f3d('0x27'),_0x58b093,_0x14a664[_0x0f3d('0x25')]['message']);return _0x3682c2(_0x14a664[_0x0f3d('0x25')][_0x0f3d('0x28')]);}logger[_0x0f3d('0x25')](_0x0f3d('0x27'),_0x58b093,_0x14a664[_0x0f3d('0x25')][_0x0f3d('0x28')]);return _0x103ad3(_0x14a664['error'][_0x0f3d('0x28')]);}else{logger[_0x0f3d('0x23')](_0x0f3d('0x27'),_0x58b093,_0x0f3d('0x24'));_0x103ad3(_0x14a664['result'][_0x0f3d('0x28')]);}})[_0x0f3d('0x29')](function(_0x29554e){logger[_0x0f3d('0x25')](_0x0f3d('0x27'),_0x58b093,_0x29554e);_0x3682c2(_0x29554e);});});}function respondWithStatusCode(_0x39c01f,_0x8c9b43){_0x8c9b43=_0x8c9b43||0xcc;return function(_0x2ba875){if(_0x2ba875){return _0x39c01f['sendStatus'](_0x8c9b43);}return _0x39c01f[_0x0f3d('0x2a')](_0x8c9b43)[_0x0f3d('0x2b')]();};}function respondWithResult(_0x3a4141,_0x267a53){_0x267a53=_0x267a53||0xc8;return function(_0x3caa46){if(_0x3caa46){return _0x3a4141[_0x0f3d('0x2a')](_0x267a53)[_0x0f3d('0x2c')](_0x3caa46);}};}function respondWithFilteredResult(_0x30ce46,_0x20cbf3){return function(_0x56197b){if(_0x56197b){var _0x3a9b10=_0x56197b['count'],_0x5247ad=_0x20cbf3[_0x0f3d('0x2d')],_0x33296b=_0x20cbf3[_0x0f3d('0x2d')]+_0x20cbf3[_0x0f3d('0x2e')],_0x158da9;if(_0x33296b>=_0x3a9b10){_0x33296b=_0x3a9b10;_0x158da9=0xc8;}else{_0x158da9=0xce;}_0x30ce46[_0x0f3d('0x2a')](_0x158da9);return _0x30ce46[_0x0f3d('0x2f')]('Content-Range',_0x5247ad+'-'+_0x33296b+'/'+_0x3a9b10)[_0x0f3d('0x2c')](_0x56197b);}return null;};}function patchUpdates(_0x236e9e){return function(_0x578b14){try{jsonpatch[_0x0f3d('0x30')](_0x578b14,_0x236e9e,!![]);}catch(_0x2ff3a6){return BPromise['reject'](_0x2ff3a6);}return _0x578b14['save']();};}function saveUpdates(_0x397949,_0x1c7973){return function(_0x566e5a){if(_0x566e5a){return _0x566e5a[_0x0f3d('0x31')](_0x397949)['then'](function(_0x101631){return _0x101631;});}return null;};}function removeEntity(_0x191371,_0x2b08fd){return function(_0x1c8551){if(_0x1c8551){return _0x1c8551[_0x0f3d('0x32')]()['then'](function(){_0x191371[_0x0f3d('0x2a')](0xcc)[_0x0f3d('0x2b')]();});}};}function handleEntityNotFound(_0xb34848,_0x2a904e){return function(_0x379b83){if(!_0x379b83){_0xb34848[_0x0f3d('0x33')](0x194);}return _0x379b83;};}function handleError(_0x4c633f,_0x54938e){_0x54938e=_0x54938e||0x1f4;return function(_0x410d2b){logger[_0x0f3d('0x25')](_0x410d2b[_0x0f3d('0x34')]);if(_0x410d2b[_0x0f3d('0x35')]){delete _0x410d2b[_0x0f3d('0x35')];}_0x4c633f[_0x0f3d('0x2a')](_0x54938e)[_0x0f3d('0x36')](_0x410d2b);};}exports['index']=function(_0x16378d,_0x3e991b){var _0x440e14={},_0x134f00={},_0x4312fe={'count':0x0,'rows':[]};var _0x380456=_[_0x0f3d('0x37')](db[_0x0f3d('0x38')][_0x0f3d('0x39')],function(_0x18cb71){return{'name':_0x18cb71[_0x0f3d('0x3a')],'type':_0x18cb71[_0x0f3d('0x3b')][_0x0f3d('0x3c')]};});_0x134f00[_0x0f3d('0x3d')]=_[_0x0f3d('0x37')](_0x380456,'name');_0x134f00[_0x0f3d('0x3e')]=_[_0x0f3d('0x3f')](_0x16378d['query']);_0x134f00[_0x0f3d('0x40')]=_['intersection'](_0x134f00[_0x0f3d('0x3d')],_0x134f00[_0x0f3d('0x3e')]);_0x440e14['attributes']=_['intersection'](_0x134f00[_0x0f3d('0x3d')],qs['fields'](_0x16378d[_0x0f3d('0x3e')]['fields']));_0x440e14[_0x0f3d('0x41')]=_0x440e14[_0x0f3d('0x41')]['length']?_0x440e14[_0x0f3d('0x41')]:_0x134f00['model'];if(!_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x42')](_0x0f3d('0x43'))){_0x440e14['limit']=qs['limit'](_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x2e')]);_0x440e14[_0x0f3d('0x2d')]=qs['offset'](_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x2d')]);}_0x440e14[_0x0f3d('0x44')]=qs[_0x0f3d('0x45')](_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x45')]);_0x440e14[_0x0f3d('0x46')]=qs['filters'](_[_0x0f3d('0x47')](_0x16378d[_0x0f3d('0x3e')],_0x134f00['filters']),_0x380456);if(_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x48')]){_0x440e14[_0x0f3d('0x46')]=_['merge'](_0x440e14[_0x0f3d('0x46')],{'$or':_[_0x0f3d('0x37')](_0x380456,function(_0x10bf8b){if(_0x10bf8b[_0x0f3d('0x3b')]!==_0x0f3d('0x49')){var _0x255458={};_0x255458[_0x10bf8b[_0x0f3d('0x35')]]={'$like':'%'+_0x16378d[_0x0f3d('0x3e')][_0x0f3d('0x48')]+'%'};return _0x255458;}})});}_0x440e14=_[_0x0f3d('0x4a')]({},_0x440e14,_0x16378d[_0x0f3d('0x4b')]);var _0x188044={'where':_0x440e14['where']};return db[_0x0f3d('0x38')]['count'](_0x188044)['then'](function(_0x5d5be9){_0x4312fe[_0x0f3d('0x4c')]=_0x5d5be9;if(_0x16378d['query'][_0x0f3d('0x4d')]){_0x440e14['include']=[{'all':!![]}];}return db[_0x0f3d('0x38')][_0x0f3d('0x4e')](_0x440e14);})[_0x0f3d('0x22')](function(_0x1105e5){_0x4312fe['rows']=_0x1105e5;return _0x4312fe;})[_0x0f3d('0x22')](respondWithFilteredResult(_0x3e991b,_0x440e14))[_0x0f3d('0x29')](handleError(_0x3e991b,null));};exports[_0x0f3d('0x4f')]=function(_0x2797b0,_0x4a9dfe){var _0x4e0059={'raw':![],'where':{'id':_0x2797b0[_0x0f3d('0x50')]['id']}},_0x364cff={};_0x364cff[_0x0f3d('0x3d')]=_[_0x0f3d('0x3f')](db[_0x0f3d('0x38')]['rawAttributes']);_0x364cff[_0x0f3d('0x3e')]=_[_0x0f3d('0x3f')](_0x2797b0[_0x0f3d('0x3e')]);_0x364cff[_0x0f3d('0x40')]=_['intersection'](_0x364cff[_0x0f3d('0x3d')],_0x364cff[_0x0f3d('0x3e')]);_0x4e0059[_0x0f3d('0x41')]=_[_0x0f3d('0x51')](_0x364cff[_0x0f3d('0x3d')],qs[_0x0f3d('0x52')](_0x2797b0[_0x0f3d('0x3e')][_0x0f3d('0x52')]));_0x4e0059[_0x0f3d('0x41')]=_0x4e0059['attributes'][_0x0f3d('0x53')]?_0x4e0059[_0x0f3d('0x41')]:_0x364cff['model'];if(_0x2797b0[_0x0f3d('0x3e')][_0x0f3d('0x4d')]){_0x4e0059[_0x0f3d('0x54')]=[{'all':!![]}];}_0x4e0059=_['merge']({},_0x4e0059,_0x2797b0[_0x0f3d('0x4b')]);return db[_0x0f3d('0x38')][_0x0f3d('0x55')](_0x4e0059)[_0x0f3d('0x22')](handleEntityNotFound(_0x4a9dfe,null))[_0x0f3d('0x22')](respondWithResult(_0x4a9dfe,null))[_0x0f3d('0x29')](handleError(_0x4a9dfe,null));};exports[_0x0f3d('0x56')]=function(_0x4f3423,_0x411a7c){return db['SugarcrmAccount'][_0x0f3d('0x56')](_0x4f3423[_0x0f3d('0x57')],{})[_0x0f3d('0x22')](respondWithResult(_0x411a7c,0xc9))[_0x0f3d('0x29')](handleError(_0x411a7c,null));};exports[_0x0f3d('0x31')]=function(_0x43eb3d,_0x1e51da){if(_0x43eb3d[_0x0f3d('0x57')]['id']){delete _0x43eb3d[_0x0f3d('0x57')]['id'];}return db[_0x0f3d('0x38')]['find']({'where':{'id':_0x43eb3d[_0x0f3d('0x50')]['id']}})[_0x0f3d('0x22')](handleEntityNotFound(_0x1e51da,null))['then'](saveUpdates(_0x43eb3d['body'],null))[_0x0f3d('0x22')](respondWithResult(_0x1e51da,null))['catch'](handleError(_0x1e51da,null));};exports['destroy']=function(_0x14fc65,_0x5b1d31){return db['SugarcrmAccount'][_0x0f3d('0x55')]({'where':{'id':_0x14fc65[_0x0f3d('0x50')]['id']}})['then'](handleEntityNotFound(_0x5b1d31,null))[_0x0f3d('0x22')](removeEntity(_0x5b1d31,null))[_0x0f3d('0x29')](handleError(_0x5b1d31,null));};exports[_0x0f3d('0x58')]=function(_0x167d91,_0x25cee4,_0x1314b6){var _0x13f58f={};var _0x4fd68e={};var _0x2da10c;var _0x55308b;return db[_0x0f3d('0x38')][_0x0f3d('0x59')]({'where':{'id':_0x167d91[_0x0f3d('0x50')]['id']}})['then'](handleEntityNotFound(_0x25cee4,null))[_0x0f3d('0x22')](function(_0x33afd7){if(_0x33afd7){_0x2da10c=_0x33afd7;_0x4fd68e['model']=_[_0x0f3d('0x3f')](db['SugarcrmConfiguration']['rawAttributes']);_0x4fd68e['query']=_[_0x0f3d('0x3f')](_0x167d91[_0x0f3d('0x3e')]);_0x4fd68e[_0x0f3d('0x40')]=_[_0x0f3d('0x51')](_0x4fd68e['model'],_0x4fd68e[_0x0f3d('0x3e')]);_0x13f58f['attributes']=_[_0x0f3d('0x51')](_0x4fd68e[_0x0f3d('0x3d')],qs[_0x0f3d('0x52')](_0x167d91[_0x0f3d('0x3e')][_0x0f3d('0x52')]));_0x13f58f[_0x0f3d('0x41')]=_0x13f58f[_0x0f3d('0x41')][_0x0f3d('0x53')]?_0x13f58f[_0x0f3d('0x41')]:_0x4fd68e[_0x0f3d('0x3d')];_0x13f58f[_0x0f3d('0x44')]=qs['sort'](_0x167d91['query'][_0x0f3d('0x45')]);_0x13f58f['where']=qs[_0x0f3d('0x40')](_[_0x0f3d('0x47')](_0x167d91[_0x0f3d('0x3e')],_0x4fd68e[_0x0f3d('0x40')]));if(_0x167d91['query'][_0x0f3d('0x48')]){_0x13f58f[_0x0f3d('0x46')]=_['merge'](_0x13f58f[_0x0f3d('0x46')],{'$or':_[_0x0f3d('0x37')](_0x13f58f[_0x0f3d('0x41')],function(_0xfad85f){var _0x6e2759={};_0x6e2759[_0xfad85f]={'$like':'%'+_0x167d91[_0x0f3d('0x3e')][_0x0f3d('0x48')]+'%'};return _0x6e2759;})});}_0x13f58f=_[_0x0f3d('0x4a')]({},_0x13f58f,_0x167d91[_0x0f3d('0x4b')]);return _0x2da10c['getConfigurations'](_0x13f58f);}})['then'](function(_0x4cbf78){if(_0x4cbf78){_0x55308b=_0x4cbf78[_0x0f3d('0x53')];if(!_0x167d91[_0x0f3d('0x3e')]['hasOwnProperty'](_0x0f3d('0x43'))){_0x13f58f[_0x0f3d('0x2e')]=qs[_0x0f3d('0x2e')](_0x167d91['query'][_0x0f3d('0x2e')]);_0x13f58f['offset']=qs[_0x0f3d('0x2d')](_0x167d91[_0x0f3d('0x3e')][_0x0f3d('0x2d')]);}return _0x2da10c[_0x0f3d('0x58')](_0x13f58f);}})[_0x0f3d('0x22')](function(_0x47b4ab){if(_0x47b4ab){return _0x47b4ab?{'count':_0x55308b,'rows':_0x47b4ab}:null;}})[_0x0f3d('0x22')](respondWithResult(_0x25cee4,null))[_0x0f3d('0x29')](handleError(_0x25cee4,null));};exports[_0x0f3d('0x5a')]=function(_0x2b0d2e,_0x4743af,_0x5d4c1a){if(_0x2b0d2e[_0x0f3d('0x57')]['id']){delete _0x2b0d2e[_0x0f3d('0x57')]['id'];}return db['SugarcrmAccount'][_0x0f3d('0x59')]({'where':{'id':_0x2b0d2e[_0x0f3d('0x50')]['id']}})[_0x0f3d('0x22')](handleEntityNotFound(_0x4743af,null))[_0x0f3d('0x22')](function(_0x25f955){if(_0x25f955){_0x2b0d2e['body'][_0x0f3d('0x5b')]=_0x25f955['id'];_0x2b0d2e[_0x0f3d('0x57')][_0x0f3d('0x5c')]=integrations[_0x0f3d('0x5d')](_0x2b0d2e['body'][_0x0f3d('0x5e')],_0x2b0d2e[_0x0f3d('0x57')][_0x0f3d('0x3b')]);_0x2b0d2e[_0x0f3d('0x57')][_0x0f3d('0x5f')]=integrations[_0x0f3d('0x60')](_0x2b0d2e[_0x0f3d('0x57')][_0x0f3d('0x5e')],_0x2b0d2e['body'][_0x0f3d('0x3b')]);return db[_0x0f3d('0x61')][_0x0f3d('0x56')](_0x2b0d2e[_0x0f3d('0x57')],{'include':[{'model':db[_0x0f3d('0x62')],'as':_0x0f3d('0x5c')},{'model':db[_0x0f3d('0x62')],'as':_0x0f3d('0x5f')}]});}return null;})[_0x0f3d('0x22')](respondWithResult(_0x4743af,null))['catch'](handleError(_0x4743af,null));};exports[_0x0f3d('0x63')]=function(_0xe246bd,_0x10ee64,_0x5121dc){var _0x2e55ac='';var _0x338d8d=['id',_0x0f3d('0x35'),_0x0f3d('0x64'),'created_by',_0x0f3d('0x65'),'date_start',_0x0f3d('0x66'),_0x0f3d('0x67'),_0x0f3d('0x68'),_0x0f3d('0x69'),_0x0f3d('0x6a'),_0x0f3d('0x6b')];return db[_0x0f3d('0x38')][_0x0f3d('0x59')]({'where':{'id':_0xe246bd[_0x0f3d('0x50')]['id']},'attributes':['id',_0x0f3d('0x6c'),_0x0f3d('0x6d'),_0x0f3d('0x6e')]})['then'](handleEntityNotFound(_0x10ee64,null))['then'](function(_0x6826dd){if(_0x6826dd){_0x2e55ac=_0x6826dd[_0x0f3d('0x6e')];var _0x22d036=_0x2e55ac['slice'](-0x1);if(_0x22d036==='/'){_0x2e55ac=_0x2e55ac[_0x0f3d('0x6f')](0x0,_0x2e55ac[_0x0f3d('0x70')](_0x22d036));}return rp({'method':_0x0f3d('0x71'),'uri':util['format'](_0x0f3d('0x72'),_0x2e55ac,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0f3d('0x73'),'input_type':'JSON','response_type':_0x0f3d('0x74'),'rest_data':JSON[_0x0f3d('0x75')]({'user_auth':{'user_name':_0x6826dd['username'],'password':_0x6826dd['password'],'encryption':_0x0f3d('0x76')},'application':_0x0f3d('0x77')})}});}})[_0x0f3d('0x22')](function(_0x13f2ae){if(_0x13f2ae&&_0x13f2ae['name']!=='Invalid\x20Login'&&_0x13f2ae['name']!==_0x0f3d('0x78')){return rp({'method':_0x0f3d('0x71'),'uri':util[_0x0f3d('0x79')]('%s%s',_0x2e55ac,_0x0f3d('0x7a')),'json':!![],'form':{'method':_0x0f3d('0x7b'),'input_type':_0x0f3d('0x74'),'response_type':_0x0f3d('0x74'),'rest_data':JSON[_0x0f3d('0x75')]({'session':_0x13f2ae['id'],'module_name':_0x0f3d('0x7c')})}})[_0x0f3d('0x22')](function(_0x20aca7){if(_0x20aca7){var _0x414485=_[_0x0f3d('0x7d')](_0x20aca7[_0x0f3d('0x7e')]);_[_0x0f3d('0x7f')](_0x414485,function(_0x39b6c1){return _0x338d8d['includes'](_0x39b6c1[_0x0f3d('0x35')]);});return{'count':_0x414485[_0x0f3d('0x53')],'rows':_[_0x0f3d('0x37')](_0x414485,function(_0x37822f){return{'id':_0x37822f[_0x0f3d('0x35')],'name':_0x37822f[_0x0f3d('0x80')],'custom':_[_0x0f3d('0x81')](_0x37822f[_0x0f3d('0x35')],'_c')?!![]:![],'options':_0x37822f[_0x0f3d('0x4b')]?_[_0x0f3d('0x37')](_[_0x0f3d('0x7d')](_0x37822f[_0x0f3d('0x4b')]),function(_0x3e24f4){return{'name':_0x3e24f4[_0x0f3d('0x82')],'value':_0x3e24f4[_0x0f3d('0x35')]};}):[]};})};}})[_0x0f3d('0x22')](respondWithResult(_0x10ee64,null))[_0x0f3d('0x29')](function(_0x4015a7){var _0x205ed3=_0xe246bd[_0x0f3d('0x3e')][_0x0f3d('0x1e')]?0x1f4:_0x4015a7[_0x0f3d('0x83')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x205ed3,JSON[_0x0f3d('0x75')](_0x4015a7));delete _0x4015a7[_0x0f3d('0x35')];if(_0x205ed3===0x191){_0x205ed3=0x190;}_0x10ee64[_0x0f3d('0x2a')](_0x205ed3)['send'](_0xe246bd[_0x0f3d('0x3e')][_0x0f3d('0x1e')]?{'message':_0x0f3d('0x84'),'statusCode':_0x4015a7['statusCode']}:_0x4015a7);});}else{var _0x12ad7d=0x1f4;_0x10ee64['status'](_0x12ad7d)[_0x0f3d('0x36')]({'message':_0x0f3d('0x84'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x784f=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','includes','label','value','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','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/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~!@#$%^&-_=+[{]}.','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x908eb6,_0x59199b){var _0x511a09=function(_0x376c8b){while(--_0x376c8b){_0x908eb6['push'](_0x908eb6['shift']());}};_0x511a09(++_0x59199b);}(_0x784f,0x1ee));var _0xf784=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x784f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf784('0x0'));var rimraf=require(_0xf784('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf784('0x2'));var rp=require(_0xf784('0x3'));var moment=require(_0xf784('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf784('0x5'));var sox=require(_0xf784('0x6'));var csv=require(_0xf784('0x7'));var ejs=require(_0xf784('0x8'));var fs=require('fs');var _=require(_0xf784('0x9'));var squel=require(_0xf784('0xa'));var crypto=require(_0xf784('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf784('0x7'));var querystring=require(_0xf784('0xc'));var Papa=require(_0xf784('0xd'));var Redis=require(_0xf784('0xe'));var authService=require(_0xf784('0xf'));var qs=require(_0xf784('0x10'));var as=require(_0xf784('0x11'));var hardwareService=require(_0xf784('0x12'));var logger=require(_0xf784('0x13'))(_0xf784('0x14'));var utils=require('../../config/utils');var config=require(_0xf784('0x15'));var db=require(_0xf784('0x16'))['db'];var integrations=require(_0xf784('0x17'));var jayson=require(_0xf784('0x18'));var client=jayson[_0xf784('0x19')][_0xf784('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5f6438,_0x2ed59c,_0xc183ca){if(_0xc183ca){var _0x2fcd21=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fcd21['test'](_0x2ed59c)){return _0x5f6438;}else{throw new db[(_0xf784('0x1b'))][(_0xf784('0x1c'))](_0xf784('0x1d'));}}else{return _0x5f6438;}}function respondWithRpcPromise(_0x10e9d1,_0x255078,_0xf29228,_0x5336f8){return new BPromise(function(_0x5bc402,_0x15ee0c){var _0x39f6b7=_0x5336f8||client;return _0x39f6b7['request'](_0x10e9d1,_0xf29228)[_0xf784('0x1e')](function(_0x12359e){logger[_0xf784('0x1f')](_0xf784('0x20'),_0x255078,'request\x20sent');logger[_0xf784('0x21')](_0xf784('0x22'),_0x255078,_0xf784('0x23'),JSON[_0xf784('0x24')](_0x12359e));if(_0x12359e[_0xf784('0x25')]){if(_0x12359e['error'][_0xf784('0x26')]===0x1f4){logger[_0xf784('0x25')](_0xf784('0x20'),_0x255078,_0x12359e[_0xf784('0x25')]['message']);return _0x15ee0c(_0x12359e[_0xf784('0x25')][_0xf784('0x27')]);}logger[_0xf784('0x25')]('SugarcrmAccount,\x20%s,\x20%s',_0x255078,_0x12359e[_0xf784('0x25')][_0xf784('0x27')]);return _0x5bc402(_0x12359e[_0xf784('0x25')][_0xf784('0x27')]);}else{logger[_0xf784('0x1f')](_0xf784('0x20'),_0x255078,_0xf784('0x23'));_0x5bc402(_0x12359e[_0xf784('0x28')][_0xf784('0x27')]);}})[_0xf784('0x29')](function(_0x5ed1c0){logger[_0xf784('0x25')](_0xf784('0x20'),_0x255078,_0x5ed1c0);_0x15ee0c(_0x5ed1c0);});});}function respondWithStatusCode(_0x2c7f3d,_0x364c1e){_0x364c1e=_0x364c1e||0xcc;return function(_0x2ebd3a){if(_0x2ebd3a){return _0x2c7f3d[_0xf784('0x2a')](_0x364c1e);}return _0x2c7f3d[_0xf784('0x2b')](_0x364c1e)[_0xf784('0x2c')]();};}function respondWithResult(_0x402b41,_0x3abac2){_0x3abac2=_0x3abac2||0xc8;return function(_0x2f857d){if(_0x2f857d){return _0x402b41[_0xf784('0x2b')](_0x3abac2)[_0xf784('0x2d')](_0x2f857d);}};}function respondWithFilteredResult(_0x23e940,_0x3fbb8f){return function(_0x126277){if(_0x126277){var _0x3320ec=_0x126277[_0xf784('0x2e')],_0x2dc779=_0x3fbb8f[_0xf784('0x2f')],_0x261740=_0x3fbb8f[_0xf784('0x2f')]+_0x3fbb8f[_0xf784('0x30')],_0x5028e6;if(_0x261740>=_0x3320ec){_0x261740=_0x3320ec;_0x5028e6=0xc8;}else{_0x5028e6=0xce;}_0x23e940[_0xf784('0x2b')](_0x5028e6);return _0x23e940[_0xf784('0x31')](_0xf784('0x32'),_0x2dc779+'-'+_0x261740+'/'+_0x3320ec)[_0xf784('0x2d')](_0x126277);}return null;};}function patchUpdates(_0x18e305){return function(_0x4535e5){try{jsonpatch[_0xf784('0x33')](_0x4535e5,_0x18e305,!![]);}catch(_0x3b30a6){return BPromise[_0xf784('0x34')](_0x3b30a6);}return _0x4535e5[_0xf784('0x35')]();};}function saveUpdates(_0x22c39d,_0x39d881){return function(_0x152795){if(_0x152795){return _0x152795[_0xf784('0x36')](_0x22c39d)[_0xf784('0x1e')](function(_0x245cde){return _0x245cde;});}return null;};}function removeEntity(_0x11900f,_0x198b6b){return function(_0x1eae26){if(_0x1eae26){return _0x1eae26[_0xf784('0x37')]()[_0xf784('0x1e')](function(){_0x11900f[_0xf784('0x2b')](0xcc)[_0xf784('0x2c')]();});}};}function handleEntityNotFound(_0x12012b,_0x7c416c){return function(_0x45b26d){if(!_0x45b26d){_0x12012b['sendStatus'](0x194);}return _0x45b26d;};}function handleError(_0x5c3308,_0x4bee7b){_0x4bee7b=_0x4bee7b||0x1f4;return function(_0x1a3da4){logger[_0xf784('0x25')](_0x1a3da4[_0xf784('0x38')]);if(_0x1a3da4[_0xf784('0x39')]){delete _0x1a3da4['name'];}_0x5c3308[_0xf784('0x2b')](_0x4bee7b)[_0xf784('0x3a')](_0x1a3da4);};}exports[_0xf784('0x3b')]=function(_0xb42e40,_0x348f98){var _0x5c73a0={},_0x202c7b={},_0x5b6aab={'count':0x0,'rows':[]};var _0x1ba950=_['map'](db[_0xf784('0x3c')][_0xf784('0x3d')],function(_0x5ea879){return{'name':_0x5ea879[_0xf784('0x3e')],'type':_0x5ea879[_0xf784('0x3f')][_0xf784('0x40')]};});_0x202c7b[_0xf784('0x41')]=_[_0xf784('0x42')](_0x1ba950,_0xf784('0x39'));_0x202c7b[_0xf784('0x43')]=_[_0xf784('0x44')](_0xb42e40['query']);_0x202c7b[_0xf784('0x45')]=_[_0xf784('0x46')](_0x202c7b['model'],_0x202c7b[_0xf784('0x43')]);_0x5c73a0['attributes']=_['intersection'](_0x202c7b['model'],qs[_0xf784('0x47')](_0xb42e40[_0xf784('0x43')][_0xf784('0x47')]));_0x5c73a0[_0xf784('0x48')]=_0x5c73a0[_0xf784('0x48')][_0xf784('0x49')]?_0x5c73a0['attributes']:_0x202c7b[_0xf784('0x41')];if(!_0xb42e40['query'][_0xf784('0x4a')](_0xf784('0x4b'))){_0x5c73a0[_0xf784('0x30')]=qs['limit'](_0xb42e40['query'][_0xf784('0x30')]);_0x5c73a0['offset']=qs[_0xf784('0x2f')](_0xb42e40[_0xf784('0x43')][_0xf784('0x2f')]);}_0x5c73a0[_0xf784('0x4c')]=qs[_0xf784('0x4d')](_0xb42e40[_0xf784('0x43')][_0xf784('0x4d')]);_0x5c73a0[_0xf784('0x4e')]=qs[_0xf784('0x45')](_[_0xf784('0x4f')](_0xb42e40[_0xf784('0x43')],_0x202c7b[_0xf784('0x45')]),_0x1ba950);if(_0xb42e40['query'][_0xf784('0x50')]){_0x5c73a0[_0xf784('0x4e')]=_[_0xf784('0x51')](_0x5c73a0['where'],{'$or':_['map'](_0x1ba950,function(_0x3dead7){if(_0x3dead7[_0xf784('0x3f')]!=='VIRTUAL'){var _0x1ca01d={};_0x1ca01d[_0x3dead7[_0xf784('0x39')]]={'$like':'%'+_0xb42e40[_0xf784('0x43')][_0xf784('0x50')]+'%'};return _0x1ca01d;}})});}_0x5c73a0=_[_0xf784('0x51')]({},_0x5c73a0,_0xb42e40[_0xf784('0x52')]);var _0x386c8d={'where':_0x5c73a0[_0xf784('0x4e')]};return db[_0xf784('0x3c')][_0xf784('0x2e')](_0x386c8d)[_0xf784('0x1e')](function(_0x67d20f){_0x5b6aab[_0xf784('0x2e')]=_0x67d20f;if(_0xb42e40[_0xf784('0x43')][_0xf784('0x53')]){_0x5c73a0[_0xf784('0x54')]=[{'all':!![]}];}return db[_0xf784('0x3c')][_0xf784('0x55')](_0x5c73a0);})['then'](function(_0x23c77d){_0x5b6aab[_0xf784('0x56')]=_0x23c77d;return _0x5b6aab;})['then'](respondWithFilteredResult(_0x348f98,_0x5c73a0))[_0xf784('0x29')](handleError(_0x348f98,null));};exports[_0xf784('0x57')]=function(_0x3c9ec7,_0x53f298){var _0x451f83={'raw':![],'where':{'id':_0x3c9ec7[_0xf784('0x58')]['id']}},_0x1bf9b9={};_0x1bf9b9[_0xf784('0x41')]=_[_0xf784('0x44')](db['SugarcrmAccount'][_0xf784('0x3d')]);_0x1bf9b9[_0xf784('0x43')]=_[_0xf784('0x44')](_0x3c9ec7[_0xf784('0x43')]);_0x1bf9b9[_0xf784('0x45')]=_[_0xf784('0x46')](_0x1bf9b9[_0xf784('0x41')],_0x1bf9b9[_0xf784('0x43')]);_0x451f83[_0xf784('0x48')]=_['intersection'](_0x1bf9b9[_0xf784('0x41')],qs['fields'](_0x3c9ec7[_0xf784('0x43')]['fields']));_0x451f83[_0xf784('0x48')]=_0x451f83['attributes'][_0xf784('0x49')]?_0x451f83[_0xf784('0x48')]:_0x1bf9b9['model'];if(_0x3c9ec7['query']['includeAll']){_0x451f83[_0xf784('0x54')]=[{'all':!![]}];}_0x451f83=_[_0xf784('0x51')]({},_0x451f83,_0x3c9ec7[_0xf784('0x52')]);return db[_0xf784('0x3c')][_0xf784('0x59')](_0x451f83)[_0xf784('0x1e')](handleEntityNotFound(_0x53f298,null))[_0xf784('0x1e')](respondWithResult(_0x53f298,null))[_0xf784('0x29')](handleError(_0x53f298,null));};exports[_0xf784('0x5a')]=function(_0x53c29b,_0xa79bfb){return db[_0xf784('0x3c')][_0xf784('0x5a')](_0x53c29b['body'],{})[_0xf784('0x1e')](respondWithResult(_0xa79bfb,0xc9))[_0xf784('0x29')](handleError(_0xa79bfb,null));};exports[_0xf784('0x36')]=function(_0x5ba52c,_0x4621db){if(_0x5ba52c['body']['id']){delete _0x5ba52c[_0xf784('0x5b')]['id'];}return db[_0xf784('0x3c')]['find']({'where':{'id':_0x5ba52c[_0xf784('0x58')]['id']}})[_0xf784('0x1e')](handleEntityNotFound(_0x4621db,null))['then'](saveUpdates(_0x5ba52c[_0xf784('0x5b')],null))[_0xf784('0x1e')](respondWithResult(_0x4621db,null))[_0xf784('0x29')](handleError(_0x4621db,null));};exports['destroy']=function(_0x3d806f,_0xd54627){return db['SugarcrmAccount']['find']({'where':{'id':_0x3d806f['params']['id']}})['then'](handleEntityNotFound(_0xd54627,null))[_0xf784('0x1e')](removeEntity(_0xd54627,null))[_0xf784('0x29')](handleError(_0xd54627,null));};exports[_0xf784('0x5c')]=function(_0x11a0d5,_0xd04a87,_0x412b60){var _0xb106a5={};var _0x2646eb={};var _0x3c8698;var _0x4e7d8b;return db[_0xf784('0x3c')][_0xf784('0x5d')]({'where':{'id':_0x11a0d5[_0xf784('0x58')]['id']}})[_0xf784('0x1e')](handleEntityNotFound(_0xd04a87,null))[_0xf784('0x1e')](function(_0x228df0){if(_0x228df0){_0x3c8698=_0x228df0;_0x2646eb[_0xf784('0x41')]=_[_0xf784('0x44')](db[_0xf784('0x5e')][_0xf784('0x3d')]);_0x2646eb[_0xf784('0x43')]=_[_0xf784('0x44')](_0x11a0d5[_0xf784('0x43')]);_0x2646eb[_0xf784('0x45')]=_[_0xf784('0x46')](_0x2646eb[_0xf784('0x41')],_0x2646eb[_0xf784('0x43')]);_0xb106a5[_0xf784('0x48')]=_[_0xf784('0x46')](_0x2646eb[_0xf784('0x41')],qs['fields'](_0x11a0d5['query'][_0xf784('0x47')]));_0xb106a5[_0xf784('0x48')]=_0xb106a5[_0xf784('0x48')][_0xf784('0x49')]?_0xb106a5[_0xf784('0x48')]:_0x2646eb[_0xf784('0x41')];_0xb106a5['order']=qs[_0xf784('0x4d')](_0x11a0d5['query'][_0xf784('0x4d')]);_0xb106a5[_0xf784('0x4e')]=qs[_0xf784('0x45')](_[_0xf784('0x4f')](_0x11a0d5[_0xf784('0x43')],_0x2646eb[_0xf784('0x45')]));if(_0x11a0d5[_0xf784('0x43')]['filter']){_0xb106a5[_0xf784('0x4e')]=_[_0xf784('0x51')](_0xb106a5[_0xf784('0x4e')],{'$or':_[_0xf784('0x42')](_0xb106a5[_0xf784('0x48')],function(_0x53303f){var _0x57787c={};_0x57787c[_0x53303f]={'$like':'%'+_0x11a0d5[_0xf784('0x43')][_0xf784('0x50')]+'%'};return _0x57787c;})});}_0xb106a5=_['merge']({},_0xb106a5,_0x11a0d5['options']);return _0x3c8698[_0xf784('0x5c')](_0xb106a5);}})[_0xf784('0x1e')](function(_0x2ef765){if(_0x2ef765){_0x4e7d8b=_0x2ef765[_0xf784('0x49')];if(!_0x11a0d5[_0xf784('0x43')][_0xf784('0x4a')]('nolimit')){_0xb106a5[_0xf784('0x30')]=qs['limit'](_0x11a0d5[_0xf784('0x43')][_0xf784('0x30')]);_0xb106a5[_0xf784('0x2f')]=qs[_0xf784('0x2f')](_0x11a0d5[_0xf784('0x43')][_0xf784('0x2f')]);}return _0x3c8698['getConfigurations'](_0xb106a5);}})[_0xf784('0x1e')](function(_0xd81f6e){if(_0xd81f6e){return _0xd81f6e?{'count':_0x4e7d8b,'rows':_0xd81f6e}:null;}})[_0xf784('0x1e')](respondWithResult(_0xd04a87,null))[_0xf784('0x29')](handleError(_0xd04a87,null));};exports['addConfiguration']=function(_0x45b532,_0x8606e6,_0x3b433f){if(_0x45b532['body']['id']){delete _0x45b532[_0xf784('0x5b')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x45b532['params']['id']}})[_0xf784('0x1e')](handleEntityNotFound(_0x8606e6,null))[_0xf784('0x1e')](function(_0x1e179a){if(_0x1e179a){_0x45b532[_0xf784('0x5b')][_0xf784('0x5f')]=_0x1e179a['id'];_0x45b532[_0xf784('0x5b')][_0xf784('0x60')]=integrations[_0xf784('0x61')](_0x45b532[_0xf784('0x5b')][_0xf784('0x62')],_0x45b532['body']['type']);_0x45b532[_0xf784('0x5b')][_0xf784('0x63')]=integrations[_0xf784('0x64')](_0x45b532['body'][_0xf784('0x62')],_0x45b532[_0xf784('0x5b')][_0xf784('0x3f')]);return db['SugarcrmConfiguration'][_0xf784('0x5a')](_0x45b532['body'],{'include':[{'model':db[_0xf784('0x65')],'as':_0xf784('0x60')},{'model':db[_0xf784('0x65')],'as':_0xf784('0x63')}]});}return null;})[_0xf784('0x1e')](respondWithResult(_0x8606e6,null))[_0xf784('0x29')](handleError(_0x8606e6,null));};exports['getFields']=function(_0x170409,_0x434c2a,_0x5e95ba){var _0x30b77c='';var _0x588bbb=['id',_0xf784('0x39'),_0xf784('0x66'),_0xf784('0x67'),_0xf784('0x68'),_0xf784('0x69'),_0xf784('0x6a'),_0xf784('0x6b'),_0xf784('0x6c'),'parent_type',_0xf784('0x6d'),'direction'];return db['SugarcrmAccount'][_0xf784('0x5d')]({'where':{'id':_0x170409[_0xf784('0x58')]['id']},'attributes':['id',_0xf784('0x6e'),_0xf784('0x6f'),_0xf784('0x70')]})[_0xf784('0x1e')](handleEntityNotFound(_0x434c2a,null))['then'](function(_0x1db682){if(_0x1db682){_0x30b77c=_0x1db682[_0xf784('0x70')];var _0x3114c5=_0x30b77c[_0xf784('0x71')](-0x1);if(_0x3114c5==='/'){_0x30b77c=_0x30b77c[_0xf784('0x72')](0x0,_0x30b77c[_0xf784('0x73')](_0x3114c5));}return rp({'method':_0xf784('0x74'),'uri':util[_0xf784('0x75')](_0xf784('0x76'),_0x30b77c,_0xf784('0x77')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xf784('0x78'),'rest_data':JSON[_0xf784('0x24')]({'user_auth':{'user_name':_0x1db682[_0xf784('0x6e')],'password':_0x1db682[_0xf784('0x6f')],'encryption':_0xf784('0x79')},'application':_0xf784('0x7a')})}});}})[_0xf784('0x1e')](function(_0x1e03ef){if(_0x1e03ef&&_0x1e03ef[_0xf784('0x39')]!==_0xf784('0x7b')&&_0x1e03ef[_0xf784('0x39')]!==_0xf784('0x7c')){return rp({'method':_0xf784('0x74'),'uri':util['format'](_0xf784('0x76'),_0x30b77c,_0xf784('0x77')),'json':!![],'form':{'method':_0xf784('0x7d'),'input_type':_0xf784('0x78'),'response_type':_0xf784('0x78'),'rest_data':JSON[_0xf784('0x24')]({'session':_0x1e03ef['id'],'module_name':'Calls'})}})[_0xf784('0x1e')](function(_0x4530e7){if(_0x4530e7){var _0x49c334=_[_0xf784('0x7e')](_0x4530e7['module_fields']);_['remove'](_0x49c334,function(_0x4cf05b){return _0x588bbb[_0xf784('0x7f')](_0x4cf05b[_0xf784('0x39')]);});return{'count':_0x49c334[_0xf784('0x49')],'rows':_[_0xf784('0x42')](_0x49c334,function(_0x2a8eb9){return{'id':_0x2a8eb9['name'],'name':_0x2a8eb9[_0xf784('0x80')],'custom':_['endsWith'](_0x2a8eb9[_0xf784('0x39')],'_c')?!![]:![],'options':_0x2a8eb9[_0xf784('0x52')]?_[_0xf784('0x42')](_[_0xf784('0x7e')](_0x2a8eb9[_0xf784('0x52')]),function(_0x4c0f14){return{'name':_0x4c0f14[_0xf784('0x81')],'value':_0x4c0f14[_0xf784('0x39')]};}):[]};})};}})[_0xf784('0x1e')](respondWithResult(_0x434c2a,null))[_0xf784('0x29')](function(_0x5d1bb8){var _0x376c21=_0x170409[_0xf784('0x43')][_0xf784('0x82')]?0x1f4:_0x5d1bb8[_0xf784('0x83')]||0x1f4;logger[_0xf784('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xf784('0x84'),_0x376c21,JSON[_0xf784('0x24')](_0x5d1bb8));delete _0x5d1bb8[_0xf784('0x39')];if(_0x376c21===0x191){_0x376c21=0x190;}_0x434c2a['status'](_0x376c21)[_0xf784('0x3a')](_0x170409[_0xf784('0x43')]['test']?{'message':_0xf784('0x85'),'statusCode':_0x5d1bb8[_0xf784('0x83')]}:_0x5d1bb8);});}else{var _0x5b2af8=0x1f4;_0x434c2a[_0xf784('0x2b')](_0x5b2af8)[_0xf784('0x3a')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index b9e8a5a..4d85d6f 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 _0xf181=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x578b8f,_0x586eb1){var _0x3394f3=function(_0x1be308){while(--_0x1be308){_0x578b8f['push'](_0x578b8f['shift']());}};_0x3394f3(++_0x586eb1);}(_0xf181,0x1d8));var _0x1f18=function(_0x2d92bd,_0x416726){_0x2d92bd=_0x2d92bd-0x0;var _0x51a00f=_0xf181[_0x2d92bd];return _0x51a00f;};'use strict';var _=require(_0x1f18('0x0'));var util=require(_0x1f18('0x1'));var logger=require(_0x1f18('0x2'))(_0x1f18('0x3'));var moment=require(_0x1f18('0x4'));var BPromise=require(_0x1f18('0x5'));var rp=require(_0x1f18('0x6'));var fs=require('fs');var path=require(_0x1f18('0x7'));var rimraf=require(_0x1f18('0x8'));var config=require(_0x1f18('0x9'));var attributes=require(_0x1f18('0xa'));var integrations=require(_0x1f18('0xb'));module[_0x1f18('0xc')]=function(_0x237768,_0x5c101d){return _0x237768[_0x1f18('0xd')](_0x1f18('0xe'),attributes,{'tableName':_0x1f18('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfac=['api','moment','bluebird','request-promise','rimraf','../../config/environment','SugarcrmAccount','../../config/logger'];(function(_0x152bf9,_0x55d823){var _0x51cef6=function(_0x262cff){while(--_0x262cff){_0x152bf9['push'](_0x152bf9['shift']());}};_0x51cef6(++_0x55d823);}(_0xbfac,0x107));var _0xcbfa=function(_0x484770,_0xd0dc79){_0x484770=_0x484770-0x0;var _0x12b135=_0xbfac[_0x484770];return _0x12b135;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcbfa('0x0'))(_0xcbfa('0x1'));var moment=require(_0xcbfa('0x2'));var BPromise=require(_0xcbfa('0x3'));var rp=require(_0xcbfa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbfa('0x5'));var config=require(_0xcbfa('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1baac,_0x3eae56){return _0x1baac['define'](_0xcbfa('0x7'),attributes,{'tableName':'int_sugarcrm_accounts','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 bd99b20..fdb2036 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 _0x80fe=['stringify','error','message','info','catch','GetSugarcrmAccount','findAll','options','raw','attributes','limit','include','map','model','then','ShowSugarcrmAccount','SugarcrmAccount','find','where','lodash','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x80fe,0x93));var _0xe80f=function(_0x491733,_0x255579){_0x491733=_0x491733-0x0;var _0x3ebb39=_0x80fe[_0x491733];return _0x3ebb39;};'use strict';var _=require(_0xe80f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe80f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe80f('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe80f('0x3'));var config=require(_0xe80f('0x4'));var jayson=require(_0xe80f('0x5'));var client=jayson[_0xe80f('0x6')][_0xe80f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f10d7,_0x38581f,_0x575f58){return new BPromise(function(_0x33e2b9,_0x48d29b){return client[_0xe80f('0x8')](_0x5f10d7,_0x575f58)['then'](function(_0x4ea9ae){logger['info'](_0xe80f('0x9'),_0x38581f,_0xe80f('0xa'));logger[_0xe80f('0xb')](_0xe80f('0xc'),_0x38581f,_0xe80f('0xa'),JSON[_0xe80f('0xd')](_0x4ea9ae));if(_0x4ea9ae['error']){if(_0x4ea9ae['error']['code']===0x1f4){logger[_0xe80f('0xe')](_0xe80f('0x9'),_0x38581f,_0x4ea9ae[_0xe80f('0xe')]['message']);return _0x48d29b(_0x4ea9ae[_0xe80f('0xe')][_0xe80f('0xf')]);}logger[_0xe80f('0xe')](_0xe80f('0x9'),_0x38581f,_0x4ea9ae[_0xe80f('0xe')][_0xe80f('0xf')]);return _0x33e2b9(_0x4ea9ae[_0xe80f('0xe')][_0xe80f('0xf')]);}else{logger[_0xe80f('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x38581f,'request\x20sent');_0x33e2b9(_0x4ea9ae['result']['message']);}})[_0xe80f('0x11')](function(_0xf2f1b8){logger['error'](_0xe80f('0x9'),_0x38581f,_0xf2f1b8);_0x48d29b(_0xf2f1b8);});});}exports[_0xe80f('0x12')]=function(_0xce33a1){var _0x351451=this;return new Promise(function(_0x193d3a,_0x26a3f9){return db['SugarcrmAccount'][_0xe80f('0x13')]({'raw':_0xce33a1['options']?_0xce33a1[_0xe80f('0x14')][_0xe80f('0x15')]===undefined?!![]:![]:!![],'where':_0xce33a1[_0xe80f('0x14')]?_0xce33a1[_0xe80f('0x14')]['where']||null:null,'attributes':_0xce33a1[_0xe80f('0x14')]?_0xce33a1[_0xe80f('0x14')][_0xe80f('0x16')]||null:null,'limit':_0xce33a1['options']?_0xce33a1[_0xe80f('0x14')][_0xe80f('0x17')]||null:null,'include':_0xce33a1[_0xe80f('0x14')]?_0xce33a1[_0xe80f('0x14')][_0xe80f('0x18')]?_[_0xe80f('0x19')](_0xce33a1[_0xe80f('0x14')]['include'],function(_0x53639d){return{'model':db[_0x53639d['model']],'as':_0x53639d['as'],'attributes':_0x53639d[_0xe80f('0x16')],'include':_0x53639d[_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x53639d[_0xe80f('0x18')],function(_0x27d48c){return{'model':db[_0x27d48c[_0xe80f('0x1a')]],'as':_0x27d48c['as'],'attributes':_0x27d48c[_0xe80f('0x16')],'include':_0x27d48c[_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x27d48c['include'],function(_0x1b861f){return{'model':db[_0x1b861f[_0xe80f('0x1a')]],'as':_0x1b861f['as'],'attributes':_0x1b861f[_0xe80f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe80f('0x1b')](function(_0x85ca4e){logger[_0xe80f('0x10')](_0xe80f('0x12'),_0xce33a1);logger['debug'](_0xe80f('0x12'),_0xce33a1,JSON[_0xe80f('0xd')](_0x85ca4e));_0x193d3a(_0x85ca4e);})[_0xe80f('0x11')](function(_0x4195fd){logger[_0xe80f('0xe')]('GetSugarcrmAccount',_0x4195fd[_0xe80f('0xf')],_0xce33a1);_0x26a3f9(_0x351451[_0xe80f('0xe')](0x1f4,_0x4195fd[_0xe80f('0xf')]));});});};exports[_0xe80f('0x1c')]=function(_0x4d2764){var _0x2f65c5=this;return new Promise(function(_0x56e69f,_0x4c4d4d){return db[_0xe80f('0x1d')][_0xe80f('0x1e')]({'raw':_0x4d2764[_0xe80f('0x14')]?_0x4d2764[_0xe80f('0x14')][_0xe80f('0x15')]===undefined?!![]:![]:!![],'where':_0x4d2764[_0xe80f('0x14')]?_0x4d2764[_0xe80f('0x14')][_0xe80f('0x1f')]||null:null,'attributes':_0x4d2764[_0xe80f('0x14')]?_0x4d2764['options'][_0xe80f('0x16')]||null:null,'include':_0x4d2764[_0xe80f('0x14')]?_0x4d2764[_0xe80f('0x14')][_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x4d2764[_0xe80f('0x14')][_0xe80f('0x18')],function(_0x5b7a55){return{'model':db[_0x5b7a55[_0xe80f('0x1a')]],'as':_0x5b7a55['as'],'attributes':_0x5b7a55[_0xe80f('0x16')],'include':_0x5b7a55[_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x5b7a55[_0xe80f('0x18')],function(_0x3f587c){return{'model':db[_0x3f587c['model']],'as':_0x3f587c['as'],'attributes':_0x3f587c[_0xe80f('0x16')],'include':_0x3f587c[_0xe80f('0x18')]?_[_0xe80f('0x19')](_0x3f587c[_0xe80f('0x18')],function(_0x58371d){return{'model':db[_0x58371d[_0xe80f('0x1a')]],'as':_0x58371d['as'],'attributes':_0x58371d[_0xe80f('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27bec0){logger['info'](_0xe80f('0x1c'),_0x4d2764);logger[_0xe80f('0xb')]('ShowSugarcrmAccount',_0x4d2764,JSON['stringify'](_0x27bec0));_0x56e69f(_0x27bec0);})['catch'](function(_0x569e2b){logger[_0xe80f('0xe')](_0xe80f('0x1c'),_0x569e2b[_0xe80f('0xf')],_0x4d2764);_0x4c4d4d(_0x2f65c5['error'](0x1f4,_0x569e2b[_0xe80f('0xf')]));});});}; \ No newline at end of file +var _0x6d17=['../../config/logger','../../config/environment','jayson/promise','http','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options','where','attributes','include','map','model','debug','catch','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','../../config/utils'];(function(_0xbc89e5,_0x19ce43){var _0x555b08=function(_0x22d51f){while(--_0x22d51f){_0xbc89e5['push'](_0xbc89e5['shift']());}};_0x555b08(++_0x19ce43);}(_0x6d17,0x1a8));var _0x76d1=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x6d17[_0x4702ee];return _0x62ca7d;};'use strict';var _=require('lodash');var util=require(_0x76d1('0x0'));var moment=require(_0x76d1('0x1'));var BPromise=require(_0x76d1('0x2'));var rs=require(_0x76d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x76d1('0x4'));var logger=require(_0x76d1('0x5'))('rpc');var config=require(_0x76d1('0x6'));var jayson=require(_0x76d1('0x7'));var client=jayson['client'][_0x76d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x415b30,_0x22aa6f,_0x5660b2){return new BPromise(function(_0x4884d3,_0x2c74d2){return client['request'](_0x415b30,_0x5660b2)[_0x76d1('0x9')](function(_0x2e5c81){logger[_0x76d1('0xa')](_0x76d1('0xb'),_0x22aa6f,'request\x20sent');logger['debug'](_0x76d1('0xc'),_0x22aa6f,_0x76d1('0xd'),JSON[_0x76d1('0xe')](_0x2e5c81));if(_0x2e5c81[_0x76d1('0xf')]){if(_0x2e5c81['error'][_0x76d1('0x10')]===0x1f4){logger['error'](_0x76d1('0xb'),_0x22aa6f,_0x2e5c81[_0x76d1('0xf')][_0x76d1('0x11')]);return _0x2c74d2(_0x2e5c81['error']['message']);}logger[_0x76d1('0xf')](_0x76d1('0xb'),_0x22aa6f,_0x2e5c81[_0x76d1('0xf')][_0x76d1('0x11')]);return _0x4884d3(_0x2e5c81[_0x76d1('0xf')]['message']);}else{logger[_0x76d1('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x22aa6f,_0x76d1('0xd'));_0x4884d3(_0x2e5c81[_0x76d1('0x12')][_0x76d1('0x11')]);}})['catch'](function(_0x237eab){logger['error'](_0x76d1('0xb'),_0x22aa6f,_0x237eab);_0x2c74d2(_0x237eab);});});}exports[_0x76d1('0x13')]=function(_0x241643){var _0x3b7af1=this;return new Promise(function(_0x2d7bdf,_0x474055){return db[_0x76d1('0x14')][_0x76d1('0x15')]({'raw':_0x241643['options']?_0x241643['options'][_0x76d1('0x16')]===undefined?!![]:![]:!![],'where':_0x241643['options']?_0x241643[_0x76d1('0x17')][_0x76d1('0x18')]||null:null,'attributes':_0x241643[_0x76d1('0x17')]?_0x241643['options'][_0x76d1('0x19')]||null:null,'limit':_0x241643[_0x76d1('0x17')]?_0x241643[_0x76d1('0x17')]['limit']||null:null,'include':_0x241643['options']?_0x241643[_0x76d1('0x17')][_0x76d1('0x1a')]?_[_0x76d1('0x1b')](_0x241643[_0x76d1('0x17')][_0x76d1('0x1a')],function(_0x2aef9c){return{'model':db[_0x2aef9c[_0x76d1('0x1c')]],'as':_0x2aef9c['as'],'attributes':_0x2aef9c['attributes'],'include':_0x2aef9c['include']?_[_0x76d1('0x1b')](_0x2aef9c[_0x76d1('0x1a')],function(_0x33ff19){return{'model':db[_0x33ff19['model']],'as':_0x33ff19['as'],'attributes':_0x33ff19[_0x76d1('0x19')],'include':_0x33ff19[_0x76d1('0x1a')]?_['map'](_0x33ff19[_0x76d1('0x1a')],function(_0x10af70){return{'model':db[_0x10af70[_0x76d1('0x1c')]],'as':_0x10af70['as'],'attributes':_0x10af70[_0x76d1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x76d1('0x9')](function(_0x3e67b2){logger[_0x76d1('0xa')](_0x76d1('0x13'),_0x241643);logger[_0x76d1('0x1d')](_0x76d1('0x13'),_0x241643,JSON[_0x76d1('0xe')](_0x3e67b2));_0x2d7bdf(_0x3e67b2);})[_0x76d1('0x1e')](function(_0x1c2c42){logger[_0x76d1('0xf')]('GetSugarcrmAccount',_0x1c2c42[_0x76d1('0x11')],_0x241643);_0x474055(_0x3b7af1['error'](0x1f4,_0x1c2c42[_0x76d1('0x11')]));});});};exports[_0x76d1('0x1f')]=function(_0xb3e23){var _0x5ab41a=this;return new Promise(function(_0x4eac6c,_0x758778){return db[_0x76d1('0x14')][_0x76d1('0x20')]({'raw':_0xb3e23[_0x76d1('0x17')]?_0xb3e23[_0x76d1('0x17')][_0x76d1('0x16')]===undefined?!![]:![]:!![],'where':_0xb3e23[_0x76d1('0x17')]?_0xb3e23[_0x76d1('0x17')][_0x76d1('0x18')]||null:null,'attributes':_0xb3e23['options']?_0xb3e23['options'][_0x76d1('0x19')]||null:null,'include':_0xb3e23[_0x76d1('0x17')]?_0xb3e23[_0x76d1('0x17')][_0x76d1('0x1a')]?_[_0x76d1('0x1b')](_0xb3e23[_0x76d1('0x17')][_0x76d1('0x1a')],function(_0x37648b){return{'model':db[_0x37648b['model']],'as':_0x37648b['as'],'attributes':_0x37648b['attributes'],'include':_0x37648b[_0x76d1('0x1a')]?_[_0x76d1('0x1b')](_0x37648b[_0x76d1('0x1a')],function(_0x2f7c53){return{'model':db[_0x2f7c53['model']],'as':_0x2f7c53['as'],'attributes':_0x2f7c53['attributes'],'include':_0x2f7c53[_0x76d1('0x1a')]?_['map'](_0x2f7c53[_0x76d1('0x1a')],function(_0x781ebc){return{'model':db[_0x781ebc[_0x76d1('0x1c')]],'as':_0x781ebc['as'],'attributes':_0x781ebc['attributes']};}):[]};}):[]};}):[]:[]})[_0x76d1('0x9')](function(_0x10791b){logger[_0x76d1('0xa')]('ShowSugarcrmAccount',_0xb3e23);logger['debug'](_0x76d1('0x1f'),_0xb3e23,JSON[_0x76d1('0xe')](_0x10791b));_0x4eac6c(_0x10791b);})['catch'](function(_0x5d7baa){logger[_0x76d1('0xf')]('ShowSugarcrmAccount',_0x5d7baa[_0x76d1('0x11')],_0xb3e23);_0x758778(_0x5ab41a[_0x76d1('0xf')](0x1f4,_0x5d7baa[_0x76d1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 0ccbbf9..7815cec 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 _0xa7d2=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','delete','destroy','exports','util','path','express','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields'];(function(_0x1cbdda,_0x49a2fc){var _0x46d35a=function(_0x5aa437){while(--_0x5aa437){_0x1cbdda['push'](_0x1cbdda['shift']());}};_0x46d35a(++_0x49a2fc);}(_0xa7d2,0x86));var _0x2a7d=function(_0xc0e093,_0x5eb6fc){_0xc0e093=_0xc0e093-0x0;var _0x518a6c=_0xa7d2[_0xc0e093];return _0x518a6c;};'use strict';var multer=require('multer');var util=require(_0x2a7d('0x0'));var path=require(_0x2a7d('0x1'));var timeout=require('connect-timeout');var express=require(_0x2a7d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a7d('0x3'));var controller=require(_0x2a7d('0x4'));router[_0x2a7d('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2a7d('0x6'),auth[_0x2a7d('0x7')](),controller[_0x2a7d('0x8')]);router[_0x2a7d('0x5')](_0x2a7d('0x9'),auth[_0x2a7d('0x7')](),controller[_0x2a7d('0xa')]);router['get'](_0x2a7d('0xb'),auth[_0x2a7d('0x7')](),controller['getSubjects']);router[_0x2a7d('0x5')](_0x2a7d('0xc'),auth['isAuthenticated'](),controller[_0x2a7d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2a7d('0xe')](_0x2a7d('0x6'),auth['isAuthenticated'](),controller['update']);router[_0x2a7d('0xf')](_0x2a7d('0x6'),auth[_0x2a7d('0x7')](),controller[_0x2a7d('0x10')]);module[_0x2a7d('0x11')]=router; \ No newline at end of file +var _0x53f0=['./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xab79c3,_0x302627){var _0x52179d=function(_0x483b12){while(--_0x483b12){_0xab79c3['push'](_0xab79c3['shift']());}};_0x52179d(++_0x302627);}(_0x53f0,0x1d9));var _0x053f=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x53f0[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x053f('0x0'));var util=require('util');var path=require(_0x053f('0x1'));var timeout=require(_0x053f('0x2'));var express=require(_0x053f('0x3'));var router=express[_0x053f('0x4')]();var auth=require(_0x053f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x053f('0x6'));var controller=require(_0x053f('0x7'));router[_0x053f('0x8')]('/',auth['isAuthenticated'](),controller[_0x053f('0x9')]);router['get'](_0x053f('0xa'),auth[_0x053f('0xb')](),controller[_0x053f('0xc')]);router[_0x053f('0x8')](_0x053f('0xd'),auth[_0x053f('0xb')](),controller[_0x053f('0xe')]);router[_0x053f('0x8')](_0x053f('0xf'),auth[_0x053f('0xb')](),controller[_0x053f('0x10')]);router[_0x053f('0x8')](_0x053f('0x11'),auth[_0x053f('0xb')](),controller[_0x053f('0x12')]);router[_0x053f('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x053f('0x14')](_0x053f('0xa'),auth[_0x053f('0xb')](),controller[_0x053f('0x15')]);router[_0x053f('0x16')]('/:id',auth[_0x053f('0xb')](),controller[_0x053f('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index d3ff2c5..664b37c 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 _0x588c=['exports','STRING','sequelize'];(function(_0xedf6bc,_0x4b8d10){var _0x52891e=function(_0x1791a9){while(--_0x1791a9){_0xedf6bc['push'](_0xedf6bc['shift']());}};_0x52891e(++_0x4b8d10);}(_0x588c,0x1d3));var _0xc588=function(_0x446f95,_0x5f8e04){_0x446f95=_0x446f95-0x0;var _0x368664=_0x588c[_0x446f95];return _0x368664;};'use strict';var Sequelize=require(_0xc588('0x0'));module[_0xc588('0x1')]={'name':{'type':Sequelize[_0xc588('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c2c=['STRING','sequelize','exports'];(function(_0x534b49,_0x464ea8){var _0x107e16=function(_0x5ab612){while(--_0x5ab612){_0x534b49['push'](_0x534b49['shift']());}};_0x107e16(++_0x464ea8);}(_0x6c2c,0xb2));var _0xc6c2=function(_0x5e244b,_0x1f3ef6){_0x5e244b=_0x5e244b-0x0;var _0x4bddfe=_0x6c2c[_0x5e244b];return _0x4bddfe;};'use strict';var Sequelize=require(_0xc6c2('0x0'));module[_0xc6c2('0x1')]={'name':{'type':Sequelize[_0xc6c2('0x2')]},'description':{'type':Sequelize[_0xc6c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5f4680f..b772e8d 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 _0x957b=['save','destroy','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','SugarcrmConfiguration','includeAll','include','findAll','rows','rawAttributes','options','find','create','body','update','params','getFields','length','merge','getSubjects','findOne','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','catch','status','end','json','count','offset','limit','set','Content-Range','reject'];(function(_0x17f50f,_0x4cb44d){var _0x55b7a5=function(_0x4eba52){while(--_0x4eba52){_0x17f50f['push'](_0x17f50f['shift']());}};_0x55b7a5(++_0x4cb44d);}(_0x957b,0x8a));var _0xb957=function(_0xf316bd,_0x194537){_0xf316bd=_0xf316bd-0x0;var _0x1127e1=_0x957b[_0xf316bd];return _0x1127e1;};'use strict';var pdf=require(_0xb957('0x0'));var emlformat=require(_0xb957('0x1'));var rimraf=require(_0xb957('0x2'));var zipdir=require(_0xb957('0x3'));var jsonpatch=require(_0xb957('0x4'));var rp=require(_0xb957('0x5'));var moment=require(_0xb957('0x6'));var BPromise=require(_0xb957('0x7'));var Mustache=require(_0xb957('0x8'));var util=require(_0xb957('0x9'));var path=require('path');var sox=require(_0xb957('0xa'));var csv=require(_0xb957('0xb'));var ejs=require(_0xb957('0xc'));var fs=require('fs');var _=require(_0xb957('0xd'));var squel=require(_0xb957('0xe'));var crypto=require('crypto');var jsforce=require(_0xb957('0xf'));var deskjs=require(_0xb957('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb957('0x11'));var Papa=require('papaparse');var Redis=require(_0xb957('0x12'));var authService=require(_0xb957('0x13'));var qs=require(_0xb957('0x14'));var as=require(_0xb957('0x15'));var hardwareService=require(_0xb957('0x16'));var logger=require(_0xb957('0x17'))(_0xb957('0x18'));var utils=require(_0xb957('0x19'));var config=require(_0xb957('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb957('0x1b'));var client=jayson[_0xb957('0x1c')][_0xb957('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x148a3a,_0x41233b,_0x1c5884){if(_0x1c5884){var _0x83e9a1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x83e9a1[_0xb957('0x1e')](_0x41233b)){return _0x148a3a;}else{throw new db['Sequelize'][(_0xb957('0x1f'))](_0xb957('0x20'));}}else{return _0x148a3a;}}function respondWithRpcPromise(_0x4f0ec1,_0x2eaef3,_0x95b7df,_0x358cf5){return new BPromise(function(_0x525509,_0x2ec2f3){var _0x327ecf=_0x358cf5||client;return _0x327ecf[_0xb957('0x21')](_0x4f0ec1,_0x95b7df)[_0xb957('0x22')](function(_0x431e37){logger['info'](_0xb957('0x23'),_0x2eaef3,_0xb957('0x24'));logger[_0xb957('0x25')](_0xb957('0x26'),_0x2eaef3,_0xb957('0x24'),JSON['stringify'](_0x431e37));if(_0x431e37[_0xb957('0x27')]){if(_0x431e37[_0xb957('0x27')]['code']===0x1f4){logger['error'](_0xb957('0x23'),_0x2eaef3,_0x431e37[_0xb957('0x27')]['message']);return _0x2ec2f3(_0x431e37[_0xb957('0x27')]['message']);}logger[_0xb957('0x27')](_0xb957('0x23'),_0x2eaef3,_0x431e37[_0xb957('0x27')][_0xb957('0x28')]);return _0x525509(_0x431e37[_0xb957('0x27')][_0xb957('0x28')]);}else{logger[_0xb957('0x29')](_0xb957('0x23'),_0x2eaef3,_0xb957('0x24'));_0x525509(_0x431e37['result'][_0xb957('0x28')]);}})[_0xb957('0x2a')](function(_0x3f9cb8){logger['error'](_0xb957('0x23'),_0x2eaef3,_0x3f9cb8);_0x2ec2f3(_0x3f9cb8);});});}function respondWithStatusCode(_0x1d2c0b,_0x2d242e){_0x2d242e=_0x2d242e||0xcc;return function(_0xff4dfb){if(_0xff4dfb){return _0x1d2c0b['sendStatus'](_0x2d242e);}return _0x1d2c0b[_0xb957('0x2b')](_0x2d242e)[_0xb957('0x2c')]();};}function respondWithResult(_0xc13ca1,_0x266e6a){_0x266e6a=_0x266e6a||0xc8;return function(_0x5ca64a){if(_0x5ca64a){return _0xc13ca1[_0xb957('0x2b')](_0x266e6a)[_0xb957('0x2d')](_0x5ca64a);}};}function respondWithFilteredResult(_0x57cb5b,_0x18c297){return function(_0x4b1d81){if(_0x4b1d81){var _0x108a05=_0x4b1d81[_0xb957('0x2e')],_0x4c29dc=_0x18c297['offset'],_0x349267=_0x18c297[_0xb957('0x2f')]+_0x18c297[_0xb957('0x30')],_0x26218f;if(_0x349267>=_0x108a05){_0x349267=_0x108a05;_0x26218f=0xc8;}else{_0x26218f=0xce;}_0x57cb5b[_0xb957('0x2b')](_0x26218f);return _0x57cb5b[_0xb957('0x31')](_0xb957('0x32'),_0x4c29dc+'-'+_0x349267+'/'+_0x108a05)['json'](_0x4b1d81);}return null;};}function patchUpdates(_0x29dcba){return function(_0x154cbc){try{jsonpatch['apply'](_0x154cbc,_0x29dcba,!![]);}catch(_0x3f9b62){return BPromise[_0xb957('0x33')](_0x3f9b62);}return _0x154cbc[_0xb957('0x34')]();};}function saveUpdates(_0x531046,_0x2c4fc3){return function(_0x33c95d){if(_0x33c95d){return _0x33c95d['update'](_0x531046)[_0xb957('0x22')](function(_0x56c6df){return _0x56c6df;});}return null;};}function removeEntity(_0x42618c,_0x47bb6c){return function(_0x4bb8ca){if(_0x4bb8ca){return _0x4bb8ca[_0xb957('0x35')]()[_0xb957('0x22')](function(){_0x42618c['status'](0xcc)[_0xb957('0x2c')]();});}};}function handleEntityNotFound(_0x448303,_0x9593fc){return function(_0x74a778){if(!_0x74a778){_0x448303['sendStatus'](0x194);}return _0x74a778;};}function handleError(_0x197c65,_0x345204){_0x345204=_0x345204||0x1f4;return function(_0xefc193){logger[_0xb957('0x27')](_0xefc193[_0xb957('0x36')]);if(_0xefc193[_0xb957('0x37')]){delete _0xefc193[_0xb957('0x37')];}_0x197c65[_0xb957('0x2b')](_0x345204)[_0xb957('0x38')](_0xefc193);};}exports[_0xb957('0x39')]=function(_0x5d617f,_0x5cf169){var _0x2129c6={},_0x12d5de={},_0x383e95={'count':0x0,'rows':[]};var _0x3eee42=_[_0xb957('0x3a')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x4b0fb7){return{'name':_0x4b0fb7['fieldName'],'type':_0x4b0fb7[_0xb957('0x3b')][_0xb957('0x3c')]};});_0x12d5de[_0xb957('0x3d')]=_['map'](_0x3eee42,'name');_0x12d5de[_0xb957('0x3e')]=_[_0xb957('0x3f')](_0x5d617f[_0xb957('0x3e')]);_0x12d5de[_0xb957('0x40')]=_[_0xb957('0x41')](_0x12d5de[_0xb957('0x3d')],_0x12d5de[_0xb957('0x3e')]);_0x2129c6[_0xb957('0x42')]=_[_0xb957('0x41')](_0x12d5de[_0xb957('0x3d')],qs[_0xb957('0x43')](_0x5d617f[_0xb957('0x3e')][_0xb957('0x43')]));_0x2129c6[_0xb957('0x42')]=_0x2129c6[_0xb957('0x42')]['length']?_0x2129c6[_0xb957('0x42')]:_0x12d5de[_0xb957('0x3d')];if(!_0x5d617f[_0xb957('0x3e')][_0xb957('0x44')](_0xb957('0x45'))){_0x2129c6['limit']=qs[_0xb957('0x30')](_0x5d617f[_0xb957('0x3e')][_0xb957('0x30')]);_0x2129c6['offset']=qs[_0xb957('0x2f')](_0x5d617f[_0xb957('0x3e')][_0xb957('0x2f')]);}_0x2129c6[_0xb957('0x46')]=qs[_0xb957('0x47')](_0x5d617f[_0xb957('0x3e')][_0xb957('0x47')]);_0x2129c6[_0xb957('0x48')]=qs[_0xb957('0x40')](_[_0xb957('0x49')](_0x5d617f[_0xb957('0x3e')],_0x12d5de['filters']),_0x3eee42);if(_0x5d617f[_0xb957('0x3e')][_0xb957('0x4a')]){_0x2129c6[_0xb957('0x48')]=_['merge'](_0x2129c6[_0xb957('0x48')],{'$or':_[_0xb957('0x3a')](_0x3eee42,function(_0x32ff78){if(_0x32ff78[_0xb957('0x3b')]!==_0xb957('0x4b')){var _0x5df06a={};_0x5df06a[_0x32ff78[_0xb957('0x37')]]={'$like':'%'+_0x5d617f[_0xb957('0x3e')]['filter']+'%'};return _0x5df06a;}})});}_0x2129c6=_['merge']({},_0x2129c6,_0x5d617f['options']);var _0x57536a={'where':_0x2129c6['where']};return db[_0xb957('0x4c')][_0xb957('0x2e')](_0x57536a)[_0xb957('0x22')](function(_0x38a16a){_0x383e95[_0xb957('0x2e')]=_0x38a16a;if(_0x5d617f[_0xb957('0x3e')][_0xb957('0x4d')]){_0x2129c6[_0xb957('0x4e')]=[{'all':!![]}];}return db[_0xb957('0x4c')][_0xb957('0x4f')](_0x2129c6);})['then'](function(_0x2fc6cc){_0x383e95[_0xb957('0x50')]=_0x2fc6cc;return _0x383e95;})[_0xb957('0x22')](respondWithFilteredResult(_0x5cf169,_0x2129c6))[_0xb957('0x2a')](handleError(_0x5cf169,null));};exports['show']=function(_0x524185,_0x30c576){var _0x45eaa0={'raw':![],'where':{'id':_0x524185['params']['id']}},_0x1fec70={};_0x1fec70['model']=_[_0xb957('0x3f')](db[_0xb957('0x4c')][_0xb957('0x51')]);_0x1fec70[_0xb957('0x3e')]=_[_0xb957('0x3f')](_0x524185['query']);_0x1fec70['filters']=_['intersection'](_0x1fec70[_0xb957('0x3d')],_0x1fec70[_0xb957('0x3e')]);_0x45eaa0[_0xb957('0x42')]=_[_0xb957('0x41')](_0x1fec70[_0xb957('0x3d')],qs[_0xb957('0x43')](_0x524185[_0xb957('0x3e')][_0xb957('0x43')]));_0x45eaa0[_0xb957('0x42')]=_0x45eaa0[_0xb957('0x42')]['length']?_0x45eaa0['attributes']:_0x1fec70[_0xb957('0x3d')];if(_0x524185['query'][_0xb957('0x4d')]){_0x45eaa0[_0xb957('0x4e')]=[{'all':!![]}];}_0x45eaa0=_['merge']({},_0x45eaa0,_0x524185[_0xb957('0x52')]);return db['SugarcrmConfiguration'][_0xb957('0x53')](_0x45eaa0)[_0xb957('0x22')](handleEntityNotFound(_0x30c576,null))[_0xb957('0x22')](respondWithResult(_0x30c576,null))[_0xb957('0x2a')](handleError(_0x30c576,null));};exports['create']=function(_0x1b7369,_0x39659d){return db[_0xb957('0x4c')][_0xb957('0x54')](_0x1b7369[_0xb957('0x55')],{})[_0xb957('0x22')](respondWithResult(_0x39659d,0xc9))[_0xb957('0x2a')](handleError(_0x39659d,null));};exports[_0xb957('0x56')]=function(_0xeda774,_0x2d53b5){if(_0xeda774['body']['id']){delete _0xeda774['body']['id'];}return db[_0xb957('0x4c')][_0xb957('0x53')]({'where':{'id':_0xeda774[_0xb957('0x57')]['id']}})[_0xb957('0x22')](handleEntityNotFound(_0x2d53b5,null))[_0xb957('0x22')](saveUpdates(_0xeda774[_0xb957('0x55')],null))['then'](respondWithResult(_0x2d53b5,null))['catch'](handleError(_0x2d53b5,null));};exports['destroy']=function(_0x30a68f,_0x4d001f){return db[_0xb957('0x4c')][_0xb957('0x53')]({'where':{'id':_0x30a68f[_0xb957('0x57')]['id']}})[_0xb957('0x22')](handleEntityNotFound(_0x4d001f,null))[_0xb957('0x22')](removeEntity(_0x4d001f,null))['catch'](handleError(_0x4d001f,null));};exports[_0xb957('0x58')]=function(_0x573fe8,_0x4f061d,_0xba7148){var _0x4747e9={};var _0x32cbea={};var _0x423e64;var _0x3756ed;return db[_0xb957('0x4c')]['findOne']({'where':{'id':_0x573fe8[_0xb957('0x57')]['id']}})['then'](handleEntityNotFound(_0x4f061d,null))[_0xb957('0x22')](function(_0x4d019d){if(_0x4d019d){_0x423e64=_0x4d019d;_0x32cbea[_0xb957('0x3d')]=_[_0xb957('0x3f')](db['SugarcrmField'][_0xb957('0x51')]);_0x32cbea[_0xb957('0x3e')]=_['keys'](_0x573fe8[_0xb957('0x3e')]);_0x32cbea['filters']=_['intersection'](_0x32cbea[_0xb957('0x3d')],_0x32cbea[_0xb957('0x3e')]);_0x4747e9[_0xb957('0x42')]=_[_0xb957('0x41')](_0x32cbea[_0xb957('0x3d')],qs[_0xb957('0x43')](_0x573fe8[_0xb957('0x3e')][_0xb957('0x43')]));_0x4747e9[_0xb957('0x42')]=_0x4747e9[_0xb957('0x42')][_0xb957('0x59')]?_0x4747e9[_0xb957('0x42')]:_0x32cbea[_0xb957('0x3d')];_0x4747e9[_0xb957('0x46')]=qs[_0xb957('0x47')](_0x573fe8[_0xb957('0x3e')]['sort']);_0x4747e9[_0xb957('0x48')]=qs[_0xb957('0x40')](_[_0xb957('0x49')](_0x573fe8[_0xb957('0x3e')],_0x32cbea['filters']));if(_0x573fe8[_0xb957('0x3e')][_0xb957('0x4a')]){_0x4747e9[_0xb957('0x48')]=_['merge'](_0x4747e9[_0xb957('0x48')],{'$or':_[_0xb957('0x3a')](_0x4747e9[_0xb957('0x42')],function(_0x31c2f1){var _0x1dcdae={};_0x1dcdae[_0x31c2f1]={'$like':'%'+_0x573fe8[_0xb957('0x3e')][_0xb957('0x4a')]+'%'};return _0x1dcdae;})});}_0x4747e9=_[_0xb957('0x5a')]({},_0x4747e9,_0x573fe8[_0xb957('0x52')]);return _0x423e64[_0xb957('0x58')](_0x4747e9);}})['then'](function(_0x2c9444){if(_0x2c9444){_0x3756ed=_0x2c9444[_0xb957('0x59')];if(!_0x573fe8[_0xb957('0x3e')][_0xb957('0x44')](_0xb957('0x45'))){_0x4747e9[_0xb957('0x30')]=qs[_0xb957('0x30')](_0x573fe8[_0xb957('0x3e')][_0xb957('0x30')]);_0x4747e9[_0xb957('0x2f')]=qs[_0xb957('0x2f')](_0x573fe8[_0xb957('0x3e')]['offset']);}return _0x423e64[_0xb957('0x58')](_0x4747e9);}})[_0xb957('0x22')](function(_0x16a664){if(_0x16a664){return _0x16a664?{'count':_0x3756ed,'rows':_0x16a664}:null;}})[_0xb957('0x22')](respondWithResult(_0x4f061d,null))['catch'](handleError(_0x4f061d,null));};exports[_0xb957('0x5b')]=function(_0x5e6faf,_0x1efd63,_0x1392ab){var _0xa25c7c={};var _0xd71549={};var _0x1dccd2;var _0x442f90;return db[_0xb957('0x4c')][_0xb957('0x5c')]({'where':{'id':_0x5e6faf['params']['id']}})[_0xb957('0x22')](handleEntityNotFound(_0x1efd63,null))[_0xb957('0x22')](function(_0x3c3175){if(_0x3c3175){_0x1dccd2=_0x3c3175;_0xd71549[_0xb957('0x3d')]=_[_0xb957('0x3f')](db[_0xb957('0x5d')][_0xb957('0x51')]);_0xd71549[_0xb957('0x3e')]=_['keys'](_0x5e6faf[_0xb957('0x3e')]);_0xd71549[_0xb957('0x40')]=_[_0xb957('0x41')](_0xd71549[_0xb957('0x3d')],_0xd71549[_0xb957('0x3e')]);_0xa25c7c[_0xb957('0x42')]=_[_0xb957('0x41')](_0xd71549['model'],qs['fields'](_0x5e6faf[_0xb957('0x3e')][_0xb957('0x43')]));_0xa25c7c[_0xb957('0x42')]=_0xa25c7c[_0xb957('0x42')]['length']?_0xa25c7c[_0xb957('0x42')]:_0xd71549['model'];_0xa25c7c['order']=qs[_0xb957('0x47')](_0x5e6faf[_0xb957('0x3e')][_0xb957('0x47')]);_0xa25c7c[_0xb957('0x48')]=qs[_0xb957('0x40')](_['pick'](_0x5e6faf['query'],_0xd71549[_0xb957('0x40')]));if(_0x5e6faf['query'][_0xb957('0x4a')]){_0xa25c7c[_0xb957('0x48')]=_[_0xb957('0x5a')](_0xa25c7c[_0xb957('0x48')],{'$or':_[_0xb957('0x3a')](_0xa25c7c[_0xb957('0x42')],function(_0x24256c){var _0x3d831f={};_0x3d831f[_0x24256c]={'$like':'%'+_0x5e6faf['query'][_0xb957('0x4a')]+'%'};return _0x3d831f;})});}_0xa25c7c=_[_0xb957('0x5a')]({},_0xa25c7c,_0x5e6faf[_0xb957('0x52')]);return _0x1dccd2['getSubjects'](_0xa25c7c);}})[_0xb957('0x22')](function(_0x1f5252){if(_0x1f5252){_0x442f90=_0x1f5252[_0xb957('0x59')];if(!_0x5e6faf['query'][_0xb957('0x44')](_0xb957('0x45'))){_0xa25c7c['limit']=qs['limit'](_0x5e6faf[_0xb957('0x3e')][_0xb957('0x30')]);_0xa25c7c[_0xb957('0x2f')]=qs[_0xb957('0x2f')](_0x5e6faf[_0xb957('0x3e')][_0xb957('0x2f')]);}return _0x1dccd2[_0xb957('0x5b')](_0xa25c7c);}})[_0xb957('0x22')](function(_0xe8e790){if(_0xe8e790){return _0xe8e790?{'count':_0x442f90,'rows':_0xe8e790}:null;}})[_0xb957('0x22')](respondWithResult(_0x1efd63,null))['catch'](handleError(_0x1efd63,null));};exports['getDescriptions']=function(_0x87b1e0,_0x3ee49f,_0x5dcf10){var _0x25cd26={};var _0x57b7b3={};var _0x2f7fb1;var _0x46ea85;return db[_0xb957('0x4c')][_0xb957('0x5c')]({'where':{'id':_0x87b1e0[_0xb957('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ee49f,null))[_0xb957('0x22')](function(_0x4dccf8){if(_0x4dccf8){_0x2f7fb1=_0x4dccf8;_0x57b7b3['model']=_['keys'](db['SugarcrmField']['rawAttributes']);_0x57b7b3[_0xb957('0x3e')]=_[_0xb957('0x3f')](_0x87b1e0[_0xb957('0x3e')]);_0x57b7b3['filters']=_[_0xb957('0x41')](_0x57b7b3[_0xb957('0x3d')],_0x57b7b3[_0xb957('0x3e')]);_0x25cd26[_0xb957('0x42')]=_[_0xb957('0x41')](_0x57b7b3[_0xb957('0x3d')],qs[_0xb957('0x43')](_0x87b1e0[_0xb957('0x3e')][_0xb957('0x43')]));_0x25cd26[_0xb957('0x42')]=_0x25cd26[_0xb957('0x42')][_0xb957('0x59')]?_0x25cd26[_0xb957('0x42')]:_0x57b7b3[_0xb957('0x3d')];_0x25cd26['order']=qs[_0xb957('0x47')](_0x87b1e0[_0xb957('0x3e')][_0xb957('0x47')]);_0x25cd26[_0xb957('0x48')]=qs['filters'](_[_0xb957('0x49')](_0x87b1e0[_0xb957('0x3e')],_0x57b7b3['filters']));if(_0x87b1e0[_0xb957('0x3e')][_0xb957('0x4a')]){_0x25cd26[_0xb957('0x48')]=_[_0xb957('0x5a')](_0x25cd26[_0xb957('0x48')],{'$or':_[_0xb957('0x3a')](_0x25cd26[_0xb957('0x42')],function(_0x8d66e1){var _0x5cd9e1={};_0x5cd9e1[_0x8d66e1]={'$like':'%'+_0x87b1e0[_0xb957('0x3e')][_0xb957('0x4a')]+'%'};return _0x5cd9e1;})});}_0x25cd26=_[_0xb957('0x5a')]({},_0x25cd26,_0x87b1e0[_0xb957('0x52')]);return _0x2f7fb1[_0xb957('0x5e')](_0x25cd26);}})['then'](function(_0x508614){if(_0x508614){_0x46ea85=_0x508614[_0xb957('0x59')];if(!_0x87b1e0['query'][_0xb957('0x44')]('nolimit')){_0x25cd26[_0xb957('0x30')]=qs[_0xb957('0x30')](_0x87b1e0[_0xb957('0x3e')][_0xb957('0x30')]);_0x25cd26[_0xb957('0x2f')]=qs[_0xb957('0x2f')](_0x87b1e0[_0xb957('0x3e')]['offset']);}return _0x2f7fb1[_0xb957('0x5e')](_0x25cd26);}})[_0xb957('0x22')](function(_0x79921a){if(_0x79921a){return _0x79921a?{'count':_0x46ea85,'rows':_0x79921a}:null;}})[_0xb957('0x22')](respondWithResult(_0x3ee49f,null))[_0xb957('0x2a')](handleError(_0x3ee49f,null));}; \ No newline at end of file +var _0xa21f=['index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','getFields','findOne','filter','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','limit','set','apply','reject','update','then','destroy','end','stack','name','send'];(function(_0x9b9fb6,_0x58305a){var _0x33909b=function(_0x489eb4){while(--_0x489eb4){_0x9b9fb6['push'](_0x9b9fb6['shift']());}};_0x33909b(++_0x58305a);}(_0xa21f,0x14f));var _0xfa21=function(_0x1361f9,_0x2c6390){_0x1361f9=_0x1361f9-0x0;var _0x3e5caf=_0xa21f[_0x1361f9];return _0x3e5caf;};'use strict';var pdf=require(_0xfa21('0x0'));var emlformat=require(_0xfa21('0x1'));var rimraf=require(_0xfa21('0x2'));var zipdir=require(_0xfa21('0x3'));var jsonpatch=require(_0xfa21('0x4'));var rp=require(_0xfa21('0x5'));var moment=require('moment');var BPromise=require(_0xfa21('0x6'));var Mustache=require(_0xfa21('0x7'));var util=require(_0xfa21('0x8'));var path=require(_0xfa21('0x9'));var sox=require(_0xfa21('0xa'));var csv=require(_0xfa21('0xb'));var ejs=require(_0xfa21('0xc'));var fs=require('fs');var _=require(_0xfa21('0xd'));var squel=require(_0xfa21('0xe'));var crypto=require(_0xfa21('0xf'));var jsforce=require(_0xfa21('0x10'));var deskjs=require(_0xfa21('0x11'));var toCsv=require(_0xfa21('0xb'));var querystring=require(_0xfa21('0x12'));var Papa=require(_0xfa21('0x13'));var Redis=require(_0xfa21('0x14'));var authService=require(_0xfa21('0x15'));var qs=require(_0xfa21('0x16'));var as=require(_0xfa21('0x17'));var hardwareService=require(_0xfa21('0x18'));var logger=require(_0xfa21('0x19'))('api');var utils=require('../../config/utils');var config=require(_0xfa21('0x1a'));var db=require(_0xfa21('0x1b'))['db'];var jayson=require(_0xfa21('0x1c'));var client=jayson[_0xfa21('0x1d')][_0xfa21('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x3d2958,_0x20b40f,_0x3437bf){if(_0x3437bf){var _0xe162a3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe162a3['test'](_0x20b40f)){return _0x3d2958;}else{throw new db[(_0xfa21('0x1f'))]['ValidationError'](_0xfa21('0x20'));}}else{return _0x3d2958;}}function respondWithRpcPromise(_0x9c68fd,_0x324f5c,_0x39a2e1,_0x378260){return new BPromise(function(_0xce8bb3,_0x154360){var _0x37c52d=_0x378260||client;return _0x37c52d['request'](_0x9c68fd,_0x39a2e1)['then'](function(_0x33975d){logger[_0xfa21('0x21')](_0xfa21('0x22'),_0x324f5c,_0xfa21('0x23'));logger[_0xfa21('0x24')](_0xfa21('0x25'),_0x324f5c,_0xfa21('0x23'),JSON[_0xfa21('0x26')](_0x33975d));if(_0x33975d[_0xfa21('0x27')]){if(_0x33975d[_0xfa21('0x27')][_0xfa21('0x28')]===0x1f4){logger[_0xfa21('0x27')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x324f5c,_0x33975d['error'][_0xfa21('0x29')]);return _0x154360(_0x33975d[_0xfa21('0x27')][_0xfa21('0x29')]);}logger[_0xfa21('0x27')](_0xfa21('0x22'),_0x324f5c,_0x33975d[_0xfa21('0x27')][_0xfa21('0x29')]);return _0xce8bb3(_0x33975d['error']['message']);}else{logger[_0xfa21('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x324f5c,_0xfa21('0x23'));_0xce8bb3(_0x33975d['result']['message']);}})['catch'](function(_0x304704){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x324f5c,_0x304704);_0x154360(_0x304704);});});}function respondWithStatusCode(_0xc3b7cc,_0x30f0b1){_0x30f0b1=_0x30f0b1||0xcc;return function(_0x413562){if(_0x413562){return _0xc3b7cc[_0xfa21('0x2a')](_0x30f0b1);}return _0xc3b7cc[_0xfa21('0x2b')](_0x30f0b1)['end']();};}function respondWithResult(_0x451b08,_0x2aa35c){_0x2aa35c=_0x2aa35c||0xc8;return function(_0x24c22f){if(_0x24c22f){return _0x451b08[_0xfa21('0x2b')](_0x2aa35c)[_0xfa21('0x2c')](_0x24c22f);}};}function respondWithFilteredResult(_0x376f82,_0x4a3717){return function(_0x5cb074){if(_0x5cb074){var _0x5dfec9=_0x5cb074['count'],_0x21d120=_0x4a3717[_0xfa21('0x2d')],_0x3f386e=_0x4a3717[_0xfa21('0x2d')]+_0x4a3717[_0xfa21('0x2e')],_0x6217a9;if(_0x3f386e>=_0x5dfec9){_0x3f386e=_0x5dfec9;_0x6217a9=0xc8;}else{_0x6217a9=0xce;}_0x376f82['status'](_0x6217a9);return _0x376f82[_0xfa21('0x2f')]('Content-Range',_0x21d120+'-'+_0x3f386e+'/'+_0x5dfec9)[_0xfa21('0x2c')](_0x5cb074);}return null;};}function patchUpdates(_0x67b9c4){return function(_0x5f04e1){try{jsonpatch[_0xfa21('0x30')](_0x5f04e1,_0x67b9c4,!![]);}catch(_0x5ebdff){return BPromise[_0xfa21('0x31')](_0x5ebdff);}return _0x5f04e1['save']();};}function saveUpdates(_0x167c19,_0x334cfa){return function(_0x89f7e3){if(_0x89f7e3){return _0x89f7e3[_0xfa21('0x32')](_0x167c19)[_0xfa21('0x33')](function(_0x11bfd4){return _0x11bfd4;});}return null;};}function removeEntity(_0x32b45c,_0x1cb2b9){return function(_0x4d3ac3){if(_0x4d3ac3){return _0x4d3ac3[_0xfa21('0x34')]()[_0xfa21('0x33')](function(){_0x32b45c[_0xfa21('0x2b')](0xcc)[_0xfa21('0x35')]();});}};}function handleEntityNotFound(_0x4f328c,_0x193304){return function(_0x4be967){if(!_0x4be967){_0x4f328c['sendStatus'](0x194);}return _0x4be967;};}function handleError(_0x5d44f7,_0x5e8749){_0x5e8749=_0x5e8749||0x1f4;return function(_0x4ca5a0){logger['error'](_0x4ca5a0[_0xfa21('0x36')]);if(_0x4ca5a0[_0xfa21('0x37')]){delete _0x4ca5a0[_0xfa21('0x37')];}_0x5d44f7[_0xfa21('0x2b')](_0x5e8749)[_0xfa21('0x38')](_0x4ca5a0);};}exports[_0xfa21('0x39')]=function(_0x10ebcd,_0x6eda70){var _0x3f2a0d={},_0x158c1f={},_0x3a3d5c={'count':0x0,'rows':[]};var _0x51771d=_[_0xfa21('0x3a')](db[_0xfa21('0x3b')][_0xfa21('0x3c')],function(_0x574e85){return{'name':_0x574e85[_0xfa21('0x3d')],'type':_0x574e85[_0xfa21('0x3e')][_0xfa21('0x3f')]};});_0x158c1f[_0xfa21('0x40')]=_[_0xfa21('0x3a')](_0x51771d,_0xfa21('0x37'));_0x158c1f['query']=_[_0xfa21('0x41')](_0x10ebcd[_0xfa21('0x42')]);_0x158c1f['filters']=_[_0xfa21('0x43')](_0x158c1f[_0xfa21('0x40')],_0x158c1f[_0xfa21('0x42')]);_0x3f2a0d[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x158c1f[_0xfa21('0x40')],qs['fields'](_0x10ebcd[_0xfa21('0x42')][_0xfa21('0x45')]));_0x3f2a0d[_0xfa21('0x44')]=_0x3f2a0d['attributes'][_0xfa21('0x46')]?_0x3f2a0d['attributes']:_0x158c1f[_0xfa21('0x40')];if(!_0x10ebcd['query'][_0xfa21('0x47')](_0xfa21('0x48'))){_0x3f2a0d['limit']=qs[_0xfa21('0x2e')](_0x10ebcd[_0xfa21('0x42')][_0xfa21('0x2e')]);_0x3f2a0d[_0xfa21('0x2d')]=qs[_0xfa21('0x2d')](_0x10ebcd[_0xfa21('0x42')][_0xfa21('0x2d')]);}_0x3f2a0d[_0xfa21('0x49')]=qs[_0xfa21('0x4a')](_0x10ebcd['query'][_0xfa21('0x4a')]);_0x3f2a0d[_0xfa21('0x4b')]=qs[_0xfa21('0x4c')](_[_0xfa21('0x4d')](_0x10ebcd[_0xfa21('0x42')],_0x158c1f[_0xfa21('0x4c')]),_0x51771d);if(_0x10ebcd['query']['filter']){_0x3f2a0d[_0xfa21('0x4b')]=_['merge'](_0x3f2a0d[_0xfa21('0x4b')],{'$or':_['map'](_0x51771d,function(_0x4e252e){if(_0x4e252e[_0xfa21('0x3e')]!==_0xfa21('0x4e')){var _0x2dacf3={};_0x2dacf3[_0x4e252e[_0xfa21('0x37')]]={'$like':'%'+_0x10ebcd[_0xfa21('0x42')]['filter']+'%'};return _0x2dacf3;}})});}_0x3f2a0d=_[_0xfa21('0x4f')]({},_0x3f2a0d,_0x10ebcd[_0xfa21('0x50')]);var _0x34fd8a={'where':_0x3f2a0d[_0xfa21('0x4b')]};return db[_0xfa21('0x3b')][_0xfa21('0x51')](_0x34fd8a)[_0xfa21('0x33')](function(_0x1cf98c){_0x3a3d5c[_0xfa21('0x51')]=_0x1cf98c;if(_0x10ebcd[_0xfa21('0x42')][_0xfa21('0x52')]){_0x3f2a0d['include']=[{'all':!![]}];}return db[_0xfa21('0x3b')][_0xfa21('0x53')](_0x3f2a0d);})[_0xfa21('0x33')](function(_0x2d3591){_0x3a3d5c[_0xfa21('0x54')]=_0x2d3591;return _0x3a3d5c;})[_0xfa21('0x33')](respondWithFilteredResult(_0x6eda70,_0x3f2a0d))[_0xfa21('0x55')](handleError(_0x6eda70,null));};exports[_0xfa21('0x56')]=function(_0x3c9cea,_0x1a05d6){var _0x2e76e6={'raw':![],'where':{'id':_0x3c9cea['params']['id']}},_0x480572={};_0x480572[_0xfa21('0x40')]=_[_0xfa21('0x41')](db[_0xfa21('0x3b')]['rawAttributes']);_0x480572[_0xfa21('0x42')]=_[_0xfa21('0x41')](_0x3c9cea[_0xfa21('0x42')]);_0x480572[_0xfa21('0x4c')]=_[_0xfa21('0x43')](_0x480572[_0xfa21('0x40')],_0x480572['query']);_0x2e76e6[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x480572[_0xfa21('0x40')],qs['fields'](_0x3c9cea['query']['fields']));_0x2e76e6[_0xfa21('0x44')]=_0x2e76e6[_0xfa21('0x44')][_0xfa21('0x46')]?_0x2e76e6[_0xfa21('0x44')]:_0x480572[_0xfa21('0x40')];if(_0x3c9cea[_0xfa21('0x42')][_0xfa21('0x52')]){_0x2e76e6[_0xfa21('0x57')]=[{'all':!![]}];}_0x2e76e6=_['merge']({},_0x2e76e6,_0x3c9cea[_0xfa21('0x50')]);return db[_0xfa21('0x3b')][_0xfa21('0x58')](_0x2e76e6)[_0xfa21('0x33')](handleEntityNotFound(_0x1a05d6,null))[_0xfa21('0x33')](respondWithResult(_0x1a05d6,null))[_0xfa21('0x55')](handleError(_0x1a05d6,null));};exports[_0xfa21('0x59')]=function(_0x451e89,_0xeac3c3){return db[_0xfa21('0x3b')][_0xfa21('0x59')](_0x451e89['body'],{})['then'](respondWithResult(_0xeac3c3,0xc9))['catch'](handleError(_0xeac3c3,null));};exports['update']=function(_0x366558,_0x410609){if(_0x366558[_0xfa21('0x5a')]['id']){delete _0x366558[_0xfa21('0x5a')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x366558[_0xfa21('0x5b')]['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x410609,null))[_0xfa21('0x33')](saveUpdates(_0x366558[_0xfa21('0x5a')],null))[_0xfa21('0x33')](respondWithResult(_0x410609,null))[_0xfa21('0x55')](handleError(_0x410609,null));};exports[_0xfa21('0x34')]=function(_0x3966c9,_0x1259e1){return db[_0xfa21('0x3b')]['find']({'where':{'id':_0x3966c9[_0xfa21('0x5b')]['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x1259e1,null))[_0xfa21('0x33')](removeEntity(_0x1259e1,null))[_0xfa21('0x55')](handleError(_0x1259e1,null));};exports[_0xfa21('0x5c')]=function(_0x572d0a,_0x93f01c,_0x209a9f){var _0x531518={};var _0x3bf2b7={};var _0x5ba85b;var _0x16b96c;return db[_0xfa21('0x3b')][_0xfa21('0x5d')]({'where':{'id':_0x572d0a[_0xfa21('0x5b')]['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x93f01c,null))[_0xfa21('0x33')](function(_0x188bf5){if(_0x188bf5){_0x5ba85b=_0x188bf5;_0x3bf2b7['model']=_[_0xfa21('0x41')](db['SugarcrmField'][_0xfa21('0x3c')]);_0x3bf2b7[_0xfa21('0x42')]=_[_0xfa21('0x41')](_0x572d0a[_0xfa21('0x42')]);_0x3bf2b7[_0xfa21('0x4c')]=_['intersection'](_0x3bf2b7[_0xfa21('0x40')],_0x3bf2b7['query']);_0x531518[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x3bf2b7[_0xfa21('0x40')],qs[_0xfa21('0x45')](_0x572d0a[_0xfa21('0x42')][_0xfa21('0x45')]));_0x531518['attributes']=_0x531518[_0xfa21('0x44')][_0xfa21('0x46')]?_0x531518['attributes']:_0x3bf2b7[_0xfa21('0x40')];_0x531518['order']=qs[_0xfa21('0x4a')](_0x572d0a['query'][_0xfa21('0x4a')]);_0x531518['where']=qs[_0xfa21('0x4c')](_['pick'](_0x572d0a['query'],_0x3bf2b7[_0xfa21('0x4c')]));if(_0x572d0a[_0xfa21('0x42')][_0xfa21('0x5e')]){_0x531518[_0xfa21('0x4b')]=_[_0xfa21('0x4f')](_0x531518[_0xfa21('0x4b')],{'$or':_[_0xfa21('0x3a')](_0x531518[_0xfa21('0x44')],function(_0x41400f){var _0x4f1422={};_0x4f1422[_0x41400f]={'$like':'%'+_0x572d0a[_0xfa21('0x42')][_0xfa21('0x5e')]+'%'};return _0x4f1422;})});}_0x531518=_[_0xfa21('0x4f')]({},_0x531518,_0x572d0a[_0xfa21('0x50')]);return _0x5ba85b[_0xfa21('0x5c')](_0x531518);}})[_0xfa21('0x33')](function(_0x2c4bcf){if(_0x2c4bcf){_0x16b96c=_0x2c4bcf['length'];if(!_0x572d0a['query'][_0xfa21('0x47')]('nolimit')){_0x531518[_0xfa21('0x2e')]=qs[_0xfa21('0x2e')](_0x572d0a[_0xfa21('0x42')]['limit']);_0x531518[_0xfa21('0x2d')]=qs['offset'](_0x572d0a['query'][_0xfa21('0x2d')]);}return _0x5ba85b[_0xfa21('0x5c')](_0x531518);}})[_0xfa21('0x33')](function(_0x1333eb){if(_0x1333eb){return _0x1333eb?{'count':_0x16b96c,'rows':_0x1333eb}:null;}})['then'](respondWithResult(_0x93f01c,null))[_0xfa21('0x55')](handleError(_0x93f01c,null));};exports[_0xfa21('0x5f')]=function(_0x503715,_0x25ff17,_0xb818ec){var _0x2585a6={};var _0x2f14fb={};var _0x4c7847;var _0x1d57bf;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x503715[_0xfa21('0x5b')]['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x25ff17,null))[_0xfa21('0x33')](function(_0x58979c){if(_0x58979c){_0x4c7847=_0x58979c;_0x2f14fb['model']=_['keys'](db[_0xfa21('0x60')]['rawAttributes']);_0x2f14fb[_0xfa21('0x42')]=_[_0xfa21('0x41')](_0x503715[_0xfa21('0x42')]);_0x2f14fb[_0xfa21('0x4c')]=_[_0xfa21('0x43')](_0x2f14fb[_0xfa21('0x40')],_0x2f14fb[_0xfa21('0x42')]);_0x2585a6[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x2f14fb['model'],qs['fields'](_0x503715[_0xfa21('0x42')][_0xfa21('0x45')]));_0x2585a6[_0xfa21('0x44')]=_0x2585a6[_0xfa21('0x44')][_0xfa21('0x46')]?_0x2585a6[_0xfa21('0x44')]:_0x2f14fb[_0xfa21('0x40')];_0x2585a6[_0xfa21('0x49')]=qs[_0xfa21('0x4a')](_0x503715[_0xfa21('0x42')]['sort']);_0x2585a6[_0xfa21('0x4b')]=qs[_0xfa21('0x4c')](_[_0xfa21('0x4d')](_0x503715['query'],_0x2f14fb[_0xfa21('0x4c')]));if(_0x503715[_0xfa21('0x42')][_0xfa21('0x5e')]){_0x2585a6['where']=_[_0xfa21('0x4f')](_0x2585a6[_0xfa21('0x4b')],{'$or':_['map'](_0x2585a6[_0xfa21('0x44')],function(_0x91fc17){var _0x146122={};_0x146122[_0x91fc17]={'$like':'%'+_0x503715[_0xfa21('0x42')]['filter']+'%'};return _0x146122;})});}_0x2585a6=_[_0xfa21('0x4f')]({},_0x2585a6,_0x503715[_0xfa21('0x50')]);return _0x4c7847['getSubjects'](_0x2585a6);}})['then'](function(_0x2d9b90){if(_0x2d9b90){_0x1d57bf=_0x2d9b90[_0xfa21('0x46')];if(!_0x503715[_0xfa21('0x42')]['hasOwnProperty'](_0xfa21('0x48'))){_0x2585a6[_0xfa21('0x2e')]=qs[_0xfa21('0x2e')](_0x503715['query'][_0xfa21('0x2e')]);_0x2585a6['offset']=qs['offset'](_0x503715['query'][_0xfa21('0x2d')]);}return _0x4c7847[_0xfa21('0x5f')](_0x2585a6);}})['then'](function(_0x15fab1){if(_0x15fab1){return _0x15fab1?{'count':_0x1d57bf,'rows':_0x15fab1}:null;}})[_0xfa21('0x33')](respondWithResult(_0x25ff17,null))['catch'](handleError(_0x25ff17,null));};exports[_0xfa21('0x61')]=function(_0x38873c,_0x44aa67,_0x56ae3d){var _0x13a047={};var _0x23a0d5={};var _0x385a75;var _0x2791e4;return db[_0xfa21('0x3b')][_0xfa21('0x5d')]({'where':{'id':_0x38873c['params']['id']}})[_0xfa21('0x33')](handleEntityNotFound(_0x44aa67,null))[_0xfa21('0x33')](function(_0x4c5a05){if(_0x4c5a05){_0x385a75=_0x4c5a05;_0x23a0d5[_0xfa21('0x40')]=_[_0xfa21('0x41')](db[_0xfa21('0x60')][_0xfa21('0x3c')]);_0x23a0d5[_0xfa21('0x42')]=_[_0xfa21('0x41')](_0x38873c[_0xfa21('0x42')]);_0x23a0d5['filters']=_['intersection'](_0x23a0d5[_0xfa21('0x40')],_0x23a0d5['query']);_0x13a047[_0xfa21('0x44')]=_[_0xfa21('0x43')](_0x23a0d5['model'],qs[_0xfa21('0x45')](_0x38873c[_0xfa21('0x42')][_0xfa21('0x45')]));_0x13a047[_0xfa21('0x44')]=_0x13a047[_0xfa21('0x44')][_0xfa21('0x46')]?_0x13a047[_0xfa21('0x44')]:_0x23a0d5[_0xfa21('0x40')];_0x13a047[_0xfa21('0x49')]=qs[_0xfa21('0x4a')](_0x38873c[_0xfa21('0x42')][_0xfa21('0x4a')]);_0x13a047[_0xfa21('0x4b')]=qs[_0xfa21('0x4c')](_[_0xfa21('0x4d')](_0x38873c[_0xfa21('0x42')],_0x23a0d5[_0xfa21('0x4c')]));if(_0x38873c[_0xfa21('0x42')][_0xfa21('0x5e')]){_0x13a047[_0xfa21('0x4b')]=_[_0xfa21('0x4f')](_0x13a047[_0xfa21('0x4b')],{'$or':_[_0xfa21('0x3a')](_0x13a047['attributes'],function(_0x508c92){var _0x5b1f37={};_0x5b1f37[_0x508c92]={'$like':'%'+_0x38873c[_0xfa21('0x42')][_0xfa21('0x5e')]+'%'};return _0x5b1f37;})});}_0x13a047=_[_0xfa21('0x4f')]({},_0x13a047,_0x38873c['options']);return _0x385a75[_0xfa21('0x61')](_0x13a047);}})['then'](function(_0x3148df){if(_0x3148df){_0x2791e4=_0x3148df[_0xfa21('0x46')];if(!_0x38873c[_0xfa21('0x42')][_0xfa21('0x47')](_0xfa21('0x48'))){_0x13a047[_0xfa21('0x2e')]=qs['limit'](_0x38873c[_0xfa21('0x42')][_0xfa21('0x2e')]);_0x13a047[_0xfa21('0x2d')]=qs[_0xfa21('0x2d')](_0x38873c[_0xfa21('0x42')][_0xfa21('0x2d')]);}return _0x385a75[_0xfa21('0x61')](_0x13a047);}})[_0xfa21('0x33')](function(_0x458d99){if(_0x458d99){return _0x458d99?{'count':_0x2791e4,'rows':_0x458d99}:null;}})[_0xfa21('0x33')](respondWithResult(_0x44aa67,null))[_0xfa21('0x55')](handleError(_0x44aa67,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c6e0f31..ea71429 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 _0xfe73=['define','int_sugarcrm_configurations','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfe73,0x1e8));var _0x3fe7=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xfe73[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3fe7('0x0'))('api');var moment=require(_0x3fe7('0x1'));var BPromise=require(_0x3fe7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fe7('0x3'));var rimraf=require(_0x3fe7('0x4'));var config=require(_0x3fe7('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x3fe7('0x6')]=function(_0x20aa3d,_0x39a8a3){return _0x20aa3d[_0x3fe7('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0x3fe7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9168=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1cea91,_0x4c8bbb){var _0x592b58=function(_0x1f4fb2){while(--_0x1f4fb2){_0x1cea91['push'](_0x1cea91['shift']());}};_0x592b58(++_0x4c8bbb);}(_0x9168,0x117));var _0x8916=function(_0x4fcb2c,_0x414a9e){_0x4fcb2c=_0x4fcb2c-0x0;var _0xe55d89=_0x9168[_0x4fcb2c];return _0xe55d89;};'use strict';var _=require('lodash');var util=require(_0x8916('0x0'));var logger=require(_0x8916('0x1'))('api');var moment=require(_0x8916('0x2'));var BPromise=require(_0x8916('0x3'));var rp=require(_0x8916('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8916('0x5'));var config=require(_0x8916('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x8916('0x7')]=function(_0x20e4e2,_0x1f04f6){return _0x20e4e2[_0x8916('0x8')](_0x8916('0x9'),attributes,{'tableName':_0x8916('0xa'),'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 2b0d993..69df304 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 _0x9377=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9377,0x107));var _0x7937=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9377[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7937('0x0'));var util=require(_0x7937('0x1'));var moment=require('moment');var BPromise=require(_0x7937('0x2'));var rs=require(_0x7937('0x3'));var fs=require('fs');var Redis=require(_0x7937('0x4'));var db=require(_0x7937('0x5'))['db'];var utils=require(_0x7937('0x6'));var logger=require(_0x7937('0x7'))(_0x7937('0x8'));var config=require(_0x7937('0x9'));var jayson=require(_0x7937('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeb8f51,_0x33e858,_0x588384){return new BPromise(function(_0x2c93c,_0x5c1afe){return client[_0x7937('0xb')](_0xeb8f51,_0x588384)[_0x7937('0xc')](function(_0x5c5411){logger[_0x7937('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x33e858,_0x7937('0xe'));logger[_0x7937('0xf')](_0x7937('0x10'),_0x33e858,_0x7937('0xe'),JSON[_0x7937('0x11')](_0x5c5411));if(_0x5c5411[_0x7937('0x12')]){if(_0x5c5411[_0x7937('0x12')][_0x7937('0x13')]===0x1f4){logger['error'](_0x7937('0x14'),_0x33e858,_0x5c5411[_0x7937('0x12')][_0x7937('0x15')]);return _0x5c1afe(_0x5c5411[_0x7937('0x12')][_0x7937('0x15')]);}logger[_0x7937('0x12')](_0x7937('0x14'),_0x33e858,_0x5c5411[_0x7937('0x12')][_0x7937('0x15')]);return _0x2c93c(_0x5c5411['error'][_0x7937('0x15')]);}else{logger[_0x7937('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x33e858,'request\x20sent');_0x2c93c(_0x5c5411[_0x7937('0x16')]['message']);}})[_0x7937('0x17')](function(_0x242c21){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x33e858,_0x242c21);_0x5c1afe(_0x242c21);});});} \ No newline at end of file +var _0xf00d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2b78e3,_0x57aced){var _0x3e41f5=function(_0x2e5456){while(--_0x2e5456){_0x2b78e3['push'](_0x2b78e3['shift']());}};_0x3e41f5(++_0x57aced);}(_0xf00d,0x175));var _0xdf00=function(_0x4f1a47,_0x676b68){_0x4f1a47=_0x4f1a47-0x0;var _0x1b97ff=_0xf00d[_0x4f1a47];return _0x1b97ff;};'use strict';var _=require('lodash');var util=require(_0xdf00('0x0'));var moment=require('moment');var BPromise=require(_0xdf00('0x1'));var rs=require(_0xdf00('0x2'));var fs=require('fs');var Redis=require(_0xdf00('0x3'));var db=require(_0xdf00('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf00('0x5'))(_0xdf00('0x6'));var config=require(_0xdf00('0x7'));var jayson=require(_0xdf00('0x8'));var client=jayson[_0xdf00('0x9')][_0xdf00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1014f2,_0x2f19df,_0x19bb28){return new BPromise(function(_0x5d699c,_0x290946){return client[_0xdf00('0xb')](_0x1014f2,_0x19bb28)[_0xdf00('0xc')](function(_0x3f1d73){logger[_0xdf00('0xd')](_0xdf00('0xe'),_0x2f19df,_0xdf00('0xf'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2f19df,_0xdf00('0xf'),JSON[_0xdf00('0x10')](_0x3f1d73));if(_0x3f1d73[_0xdf00('0x11')]){if(_0x3f1d73['error']['code']===0x1f4){logger['error'](_0xdf00('0xe'),_0x2f19df,_0x3f1d73[_0xdf00('0x11')][_0xdf00('0x12')]);return _0x290946(_0x3f1d73['error'][_0xdf00('0x12')]);}logger['error'](_0xdf00('0xe'),_0x2f19df,_0x3f1d73[_0xdf00('0x11')][_0xdf00('0x12')]);return _0x5d699c(_0x3f1d73[_0xdf00('0x11')]['message']);}else{logger[_0xdf00('0xd')](_0xdf00('0xe'),_0x2f19df,'request\x20sent');_0x5d699c(_0x3f1d73[_0xdf00('0x13')][_0xdf00('0x12')]);}})[_0xdf00('0x14')](function(_0x28e44a){logger[_0xdf00('0x11')](_0xdf00('0xe'),_0x2f19df,_0x28e44a);_0x290946(_0x28e44a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 28596c0..8815586 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 _0xa0b2=['isAuthenticated','index','show','create','put','update','delete','/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x463a6e,_0x1b47b5){var _0x51d8c6=function(_0x21f507){while(--_0x21f507){_0x463a6e['push'](_0x463a6e['shift']());}};_0x51d8c6(++_0x1b47b5);}(_0xa0b2,0x106));var _0x2a0b=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0xa0b2[_0x263f4c];return _0x3a78d3;};'use strict';var multer=require(_0x2a0b('0x0'));var util=require('util');var path=require(_0x2a0b('0x1'));var timeout=require('connect-timeout');var express=require(_0x2a0b('0x2'));var router=express[_0x2a0b('0x3')]();var auth=require(_0x2a0b('0x4'));var interaction=require(_0x2a0b('0x5'));var config=require(_0x2a0b('0x6'));var controller=require('./intSugarcrmField.controller');router[_0x2a0b('0x7')]('/',auth[_0x2a0b('0x8')](),controller[_0x2a0b('0x9')]);router[_0x2a0b('0x7')]('/:id',auth[_0x2a0b('0x8')](),controller[_0x2a0b('0xa')]);router['post']('/',auth[_0x2a0b('0x8')](),controller[_0x2a0b('0xb')]);router[_0x2a0b('0xc')]('/:id',auth[_0x2a0b('0x8')](),controller[_0x2a0b('0xd')]);router[_0x2a0b('0xe')](_0x2a0b('0xf'),auth[_0x2a0b('0x8')](),controller[_0x2a0b('0x10')]);module[_0x2a0b('0x11')]=router; \ No newline at end of file +var _0x26fe=['Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','multer','connect-timeout','express'];(function(_0x2fbf47,_0x1a3d42){var _0x1f8126=function(_0x59cfd4){while(--_0x59cfd4){_0x2fbf47['push'](_0x2fbf47['shift']());}};_0x1f8126(++_0x1a3d42);}(_0x26fe,0xfd));var _0xe26f=function(_0x222ba8,_0x41631c){_0x222ba8=_0x222ba8-0x0;var _0x1b67d9=_0x26fe[_0x222ba8];return _0x1b67d9;};'use strict';var multer=require(_0xe26f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe26f('0x1'));var express=require(_0xe26f('0x2'));var router=express[_0xe26f('0x3')]();var auth=require(_0xe26f('0x4'));var interaction=require(_0xe26f('0x5'));var config=require('../../config/environment');var controller=require(_0xe26f('0x6'));router[_0xe26f('0x7')]('/',auth[_0xe26f('0x8')](),controller[_0xe26f('0x9')]);router[_0xe26f('0x7')](_0xe26f('0xa'),auth[_0xe26f('0x8')](),controller[_0xe26f('0xb')]);router['post']('/',auth[_0xe26f('0x8')](),controller['create']);router[_0xe26f('0xc')]('/:id',auth[_0xe26f('0x8')](),controller[_0xe26f('0xd')]);router[_0xe26f('0xe')](_0xe26f('0xa'),auth[_0xe26f('0x8')](),controller['destroy']);module[_0xe26f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 2ddac9e..70a70ff 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 _0x795a=['STRING','BOOLEAN','exports','ENUM','variable','keyValue','string','customVariable'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x795a,0xa2));var _0xa795=function(_0x4a6ead,_0xd2c0e6){_0x4a6ead=_0x4a6ead-0x0;var _0x1d9676=_0x795a[_0x4a6ead];return _0x1d9676;};'use strict';var Sequelize=require('sequelize');module[_0xa795('0x0')]={'type':{'type':Sequelize[_0xa795('0x1')]('string',_0xa795('0x2'),'customVariable',_0xa795('0x3')),'defaultValue':_0xa795('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa795('0x1')](_0xa795('0x4'),_0xa795('0x2'),_0xa795('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa795('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa795('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9305=['customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x29c87a,_0x150a93){var _0x11e059=function(_0x595970){while(--_0x595970){_0x29c87a['push'](_0x29c87a['shift']());}};_0x11e059(++_0x150a93);}(_0x9305,0x1e2));var _0x5930=function(_0xdb0cc5,_0x33653a){_0xdb0cc5=_0xdb0cc5-0x0;var _0x153aa=_0x9305[_0xdb0cc5];return _0x153aa;};'use strict';var Sequelize=require(_0x5930('0x0'));module[_0x5930('0x1')]={'type':{'type':Sequelize[_0x5930('0x2')](_0x5930('0x3'),'variable',_0x5930('0x4'),_0x5930('0x5')),'defaultValue':_0x5930('0x3')},'content':{'type':Sequelize[_0x5930('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5930('0x2')](_0x5930('0x3'),_0x5930('0x7'),_0x5930('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5930('0x6')]},'customField':{'type':Sequelize[_0x5930('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5930('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index a2a4455..babe7dd 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 _0x85a8=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SugarcrmField','count','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto'];(function(_0x93aa24,_0x2363ba){var _0x5252ad=function(_0x382c59){while(--_0x382c59){_0x93aa24['push'](_0x93aa24['shift']());}};_0x5252ad(++_0x2363ba);}(_0x85a8,0x168));var _0x885a=function(_0xf2dfe2,_0x54fde6){_0xf2dfe2=_0xf2dfe2-0x0;var _0x5cf2d5=_0x85a8[_0xf2dfe2];return _0x5cf2d5;};'use strict';var pdf=require(_0x885a('0x0'));var emlformat=require(_0x885a('0x1'));var rimraf=require(_0x885a('0x2'));var zipdir=require(_0x885a('0x3'));var jsonpatch=require(_0x885a('0x4'));var rp=require(_0x885a('0x5'));var moment=require(_0x885a('0x6'));var BPromise=require(_0x885a('0x7'));var Mustache=require(_0x885a('0x8'));var util=require(_0x885a('0x9'));var path=require(_0x885a('0xa'));var sox=require('sox');var csv=require(_0x885a('0xb'));var ejs=require(_0x885a('0xc'));var fs=require('fs');var _=require(_0x885a('0xd'));var squel=require('squel');var crypto=require(_0x885a('0xe'));var jsforce=require(_0x885a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x885a('0x10'));var Papa=require(_0x885a('0x11'));var Redis=require(_0x885a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x885a('0x13'));var as=require(_0x885a('0x14'));var hardwareService=require(_0x885a('0x15'));var logger=require(_0x885a('0x16'))(_0x885a('0x17'));var utils=require('../../config/utils');var config=require(_0x885a('0x18'));var db=require(_0x885a('0x19'))['db'];function respondWithStatusCode(_0x231f36,_0x2933c0){_0x2933c0=_0x2933c0||0xcc;return function(_0x37a8f3){if(_0x37a8f3){return _0x231f36[_0x885a('0x1a')](_0x2933c0);}return _0x231f36[_0x885a('0x1b')](_0x2933c0)[_0x885a('0x1c')]();};}function respondWithResult(_0x54d4db,_0x3d4a89){_0x3d4a89=_0x3d4a89||0xc8;return function(_0x29ac10){if(_0x29ac10){return _0x54d4db[_0x885a('0x1b')](_0x3d4a89)[_0x885a('0x1d')](_0x29ac10);}};}function respondWithFilteredResult(_0x4ee37a,_0x169440){return function(_0x488427){if(_0x488427){var _0x1a0450=_0x488427['count'],_0x4470bd=_0x169440[_0x885a('0x1e')],_0x5ce4c1=_0x169440[_0x885a('0x1e')]+_0x169440[_0x885a('0x1f')],_0x1768ee;if(_0x5ce4c1>=_0x1a0450){_0x5ce4c1=_0x1a0450;_0x1768ee=0xc8;}else{_0x1768ee=0xce;}_0x4ee37a['status'](_0x1768ee);return _0x4ee37a['set'](_0x885a('0x20'),_0x4470bd+'-'+_0x5ce4c1+'/'+_0x1a0450)['json'](_0x488427);}return null;};}function patchUpdates(_0x589e95){return function(_0x4aa9ae){try{jsonpatch[_0x885a('0x21')](_0x4aa9ae,_0x589e95,!![]);}catch(_0x223d58){return BPromise[_0x885a('0x22')](_0x223d58);}return _0x4aa9ae['save']();};}function saveUpdates(_0x1eda16,_0xa7f8cc){return function(_0x5c27e6){if(_0x5c27e6){return _0x5c27e6['update'](_0x1eda16)[_0x885a('0x23')](function(_0x4a10a4){return _0x4a10a4;});}return null;};}function removeEntity(_0x49d52a,_0x1cebe3){return function(_0x530acc){if(_0x530acc){return _0x530acc[_0x885a('0x24')]()[_0x885a('0x23')](function(){_0x49d52a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb239,_0x58c7c7){return function(_0x40deb7){if(!_0x40deb7){_0x5cb239[_0x885a('0x1a')](0x194);}return _0x40deb7;};}function handleError(_0x3ca2c1,_0x15938e){_0x15938e=_0x15938e||0x1f4;return function(_0x44e50e){logger[_0x885a('0x25')](_0x44e50e[_0x885a('0x26')]);if(_0x44e50e[_0x885a('0x27')]){delete _0x44e50e['name'];}_0x3ca2c1[_0x885a('0x1b')](_0x15938e)[_0x885a('0x28')](_0x44e50e);};}exports[_0x885a('0x29')]=function(_0x105959,_0x56abea){var _0x1e622e={},_0x1b5d84={},_0xb82929={'count':0x0,'rows':[]};var _0x1166c2=_[_0x885a('0x2a')](db['SugarcrmField'][_0x885a('0x2b')],function(_0x22943e){return{'name':_0x22943e[_0x885a('0x2c')],'type':_0x22943e[_0x885a('0x2d')]['key']};});_0x1b5d84[_0x885a('0x2e')]=_['map'](_0x1166c2,_0x885a('0x27'));_0x1b5d84[_0x885a('0x2f')]=_[_0x885a('0x30')](_0x105959[_0x885a('0x2f')]);_0x1b5d84[_0x885a('0x31')]=_[_0x885a('0x32')](_0x1b5d84[_0x885a('0x2e')],_0x1b5d84['query']);_0x1e622e[_0x885a('0x33')]=_[_0x885a('0x32')](_0x1b5d84[_0x885a('0x2e')],qs['fields'](_0x105959['query'][_0x885a('0x34')]));_0x1e622e[_0x885a('0x33')]=_0x1e622e[_0x885a('0x33')]['length']?_0x1e622e[_0x885a('0x33')]:_0x1b5d84['model'];if(!_0x105959['query']['hasOwnProperty'](_0x885a('0x35'))){_0x1e622e[_0x885a('0x1f')]=qs[_0x885a('0x1f')](_0x105959[_0x885a('0x2f')][_0x885a('0x1f')]);_0x1e622e[_0x885a('0x1e')]=qs['offset'](_0x105959[_0x885a('0x2f')][_0x885a('0x1e')]);}_0x1e622e[_0x885a('0x36')]=qs[_0x885a('0x37')](_0x105959['query'][_0x885a('0x37')]);_0x1e622e[_0x885a('0x38')]=qs[_0x885a('0x31')](_['pick'](_0x105959[_0x885a('0x2f')],_0x1b5d84[_0x885a('0x31')]),_0x1166c2);if(_0x105959[_0x885a('0x2f')][_0x885a('0x39')]){_0x1e622e[_0x885a('0x38')]=_['merge'](_0x1e622e[_0x885a('0x38')],{'$or':_['map'](_0x1166c2,function(_0x3ed2d9){if(_0x3ed2d9[_0x885a('0x2d')]!==_0x885a('0x3a')){var _0x244001={};_0x244001[_0x3ed2d9[_0x885a('0x27')]]={'$like':'%'+_0x105959[_0x885a('0x2f')][_0x885a('0x39')]+'%'};return _0x244001;}})});}_0x1e622e=_[_0x885a('0x3b')]({},_0x1e622e,_0x105959[_0x885a('0x3c')]);var _0x537ccb={'where':_0x1e622e[_0x885a('0x38')]};return db[_0x885a('0x3d')]['count'](_0x537ccb)[_0x885a('0x23')](function(_0x434da9){_0xb82929[_0x885a('0x3e')]=_0x434da9;if(_0x105959[_0x885a('0x2f')][_0x885a('0x3f')]){_0x1e622e[_0x885a('0x40')]=[{'all':!![]}];}return db[_0x885a('0x3d')][_0x885a('0x41')](_0x1e622e);})[_0x885a('0x23')](function(_0x5126c5){_0xb82929[_0x885a('0x42')]=_0x5126c5;return _0xb82929;})[_0x885a('0x23')](respondWithFilteredResult(_0x56abea,_0x1e622e))['catch'](handleError(_0x56abea,null));};exports[_0x885a('0x43')]=function(_0x47b20b,_0x3d9ea9){var _0x4f5c4f={'raw':!![],'where':{'id':_0x47b20b[_0x885a('0x44')]['id']}},_0x581264={};_0x581264[_0x885a('0x2e')]=_[_0x885a('0x30')](db['SugarcrmField'][_0x885a('0x2b')]);_0x581264[_0x885a('0x2f')]=_[_0x885a('0x30')](_0x47b20b[_0x885a('0x2f')]);_0x581264['filters']=_['intersection'](_0x581264[_0x885a('0x2e')],_0x581264[_0x885a('0x2f')]);_0x4f5c4f[_0x885a('0x33')]=_[_0x885a('0x32')](_0x581264[_0x885a('0x2e')],qs['fields'](_0x47b20b[_0x885a('0x2f')][_0x885a('0x34')]));_0x4f5c4f[_0x885a('0x33')]=_0x4f5c4f['attributes'][_0x885a('0x45')]?_0x4f5c4f[_0x885a('0x33')]:_0x581264[_0x885a('0x2e')];if(_0x47b20b['query']['includeAll']){_0x4f5c4f[_0x885a('0x40')]=[{'all':!![]}];}_0x4f5c4f=_[_0x885a('0x3b')]({},_0x4f5c4f,_0x47b20b[_0x885a('0x3c')]);return db[_0x885a('0x3d')][_0x885a('0x46')](_0x4f5c4f)[_0x885a('0x23')](handleEntityNotFound(_0x3d9ea9,null))[_0x885a('0x23')](respondWithResult(_0x3d9ea9,null))[_0x885a('0x47')](handleError(_0x3d9ea9,null));};exports[_0x885a('0x48')]=function(_0x383de1,_0x2d2e46){return db[_0x885a('0x3d')][_0x885a('0x48')](_0x383de1['body'],{})[_0x885a('0x23')](respondWithResult(_0x2d2e46,0xc9))['catch'](handleError(_0x2d2e46,null));};exports[_0x885a('0x49')]=function(_0x199f6e,_0x22c992){if(_0x199f6e[_0x885a('0x4a')]['id']){delete _0x199f6e['body']['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x199f6e[_0x885a('0x44')]['id']}})[_0x885a('0x23')](handleEntityNotFound(_0x22c992,null))['then'](saveUpdates(_0x199f6e['body'],null))[_0x885a('0x23')](respondWithResult(_0x22c992,null))[_0x885a('0x47')](handleError(_0x22c992,null));};exports[_0x885a('0x24')]=function(_0x5c934e,_0x4ef752){return db['SugarcrmField'][_0x885a('0x46')]({'where':{'id':_0x5c934e[_0x885a('0x44')]['id']}})[_0x885a('0x23')](handleEntityNotFound(_0x4ef752,null))[_0x885a('0x23')](removeEntity(_0x4ef752,null))[_0x885a('0x47')](handleError(_0x4ef752,null));}; \ No newline at end of file +var _0xbcc9=['update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','limit','set','reject','save'];(function(_0x3bc772,_0x3be7ba){var _0x4388db=function(_0x2e4d5a){while(--_0x2e4d5a){_0x3bc772['push'](_0x3bc772['shift']());}};_0x4388db(++_0x3be7ba);}(_0xbcc9,0x104));var _0x9bcc=function(_0x174771,_0x574d7d){_0x174771=_0x174771-0x0;var _0x2e9cfa=_0xbcc9[_0x174771];return _0x2e9cfa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9bcc('0x0'));var rimraf=require(_0x9bcc('0x1'));var zipdir=require(_0x9bcc('0x2'));var jsonpatch=require(_0x9bcc('0x3'));var rp=require('request-promise');var moment=require(_0x9bcc('0x4'));var BPromise=require(_0x9bcc('0x5'));var Mustache=require(_0x9bcc('0x6'));var util=require(_0x9bcc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9bcc('0x8'));var ejs=require(_0x9bcc('0x9'));var fs=require('fs');var _=require(_0x9bcc('0xa'));var squel=require(_0x9bcc('0xb'));var crypto=require(_0x9bcc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9bcc('0xd'));var toCsv=require(_0x9bcc('0x8'));var querystring=require('querystring');var Papa=require(_0x9bcc('0xe'));var Redis=require(_0x9bcc('0xf'));var authService=require(_0x9bcc('0x10'));var qs=require(_0x9bcc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bcc('0x12'));var logger=require(_0x9bcc('0x13'))(_0x9bcc('0x14'));var utils=require(_0x9bcc('0x15'));var config=require('../../config/environment');var db=require(_0x9bcc('0x16'))['db'];function respondWithStatusCode(_0x2aa06a,_0x11eb3b){_0x11eb3b=_0x11eb3b||0xcc;return function(_0x29f67b){if(_0x29f67b){return _0x2aa06a[_0x9bcc('0x17')](_0x11eb3b);}return _0x2aa06a['status'](_0x11eb3b)[_0x9bcc('0x18')]();};}function respondWithResult(_0x272189,_0x4cd240){_0x4cd240=_0x4cd240||0xc8;return function(_0x7683dc){if(_0x7683dc){return _0x272189[_0x9bcc('0x19')](_0x4cd240)[_0x9bcc('0x1a')](_0x7683dc);}};}function respondWithFilteredResult(_0xbb7197,_0x1c7c59){return function(_0x4124d2){if(_0x4124d2){var _0x19d867=_0x4124d2[_0x9bcc('0x1b')],_0xa7e6ff=_0x1c7c59['offset'],_0x3076c2=_0x1c7c59['offset']+_0x1c7c59[_0x9bcc('0x1c')],_0x3e81d6;if(_0x3076c2>=_0x19d867){_0x3076c2=_0x19d867;_0x3e81d6=0xc8;}else{_0x3e81d6=0xce;}_0xbb7197[_0x9bcc('0x19')](_0x3e81d6);return _0xbb7197[_0x9bcc('0x1d')]('Content-Range',_0xa7e6ff+'-'+_0x3076c2+'/'+_0x19d867)[_0x9bcc('0x1a')](_0x4124d2);}return null;};}function patchUpdates(_0x5700b0){return function(_0xb9931b){try{jsonpatch['apply'](_0xb9931b,_0x5700b0,!![]);}catch(_0x13ee7c){return BPromise[_0x9bcc('0x1e')](_0x13ee7c);}return _0xb9931b[_0x9bcc('0x1f')]();};}function saveUpdates(_0x17e718,_0x49e2ab){return function(_0x49ac5f){if(_0x49ac5f){return _0x49ac5f[_0x9bcc('0x20')](_0x17e718)[_0x9bcc('0x21')](function(_0x44d6c9){return _0x44d6c9;});}return null;};}function removeEntity(_0x531927,_0x22c5d9){return function(_0x1e33f0){if(_0x1e33f0){return _0x1e33f0[_0x9bcc('0x22')]()[_0x9bcc('0x21')](function(){_0x531927[_0x9bcc('0x19')](0xcc)[_0x9bcc('0x18')]();});}};}function handleEntityNotFound(_0x36bc68,_0x35ed78){return function(_0x42893a){if(!_0x42893a){_0x36bc68[_0x9bcc('0x17')](0x194);}return _0x42893a;};}function handleError(_0x70034b,_0xe5df0f){_0xe5df0f=_0xe5df0f||0x1f4;return function(_0x1fe85e){logger[_0x9bcc('0x23')](_0x1fe85e[_0x9bcc('0x24')]);if(_0x1fe85e[_0x9bcc('0x25')]){delete _0x1fe85e[_0x9bcc('0x25')];}_0x70034b[_0x9bcc('0x19')](_0xe5df0f)[_0x9bcc('0x26')](_0x1fe85e);};}exports[_0x9bcc('0x27')]=function(_0x11c63f,_0x278dfd){var _0xb867a8={},_0x5e3c28={},_0x2894ba={'count':0x0,'rows':[]};var _0x34acfc=_[_0x9bcc('0x28')](db[_0x9bcc('0x29')][_0x9bcc('0x2a')],function(_0x530817){return{'name':_0x530817[_0x9bcc('0x2b')],'type':_0x530817['type'][_0x9bcc('0x2c')]};});_0x5e3c28[_0x9bcc('0x2d')]=_[_0x9bcc('0x28')](_0x34acfc,_0x9bcc('0x25'));_0x5e3c28[_0x9bcc('0x2e')]=_['keys'](_0x11c63f[_0x9bcc('0x2e')]);_0x5e3c28['filters']=_[_0x9bcc('0x2f')](_0x5e3c28['model'],_0x5e3c28['query']);_0xb867a8[_0x9bcc('0x30')]=_[_0x9bcc('0x2f')](_0x5e3c28['model'],qs['fields'](_0x11c63f['query'][_0x9bcc('0x31')]));_0xb867a8[_0x9bcc('0x30')]=_0xb867a8[_0x9bcc('0x30')][_0x9bcc('0x32')]?_0xb867a8[_0x9bcc('0x30')]:_0x5e3c28['model'];if(!_0x11c63f[_0x9bcc('0x2e')]['hasOwnProperty'](_0x9bcc('0x33'))){_0xb867a8[_0x9bcc('0x1c')]=qs['limit'](_0x11c63f[_0x9bcc('0x2e')]['limit']);_0xb867a8['offset']=qs[_0x9bcc('0x34')](_0x11c63f[_0x9bcc('0x2e')][_0x9bcc('0x34')]);}_0xb867a8[_0x9bcc('0x35')]=qs[_0x9bcc('0x36')](_0x11c63f[_0x9bcc('0x2e')]['sort']);_0xb867a8[_0x9bcc('0x37')]=qs[_0x9bcc('0x38')](_[_0x9bcc('0x39')](_0x11c63f[_0x9bcc('0x2e')],_0x5e3c28[_0x9bcc('0x38')]),_0x34acfc);if(_0x11c63f[_0x9bcc('0x2e')][_0x9bcc('0x3a')]){_0xb867a8[_0x9bcc('0x37')]=_[_0x9bcc('0x3b')](_0xb867a8[_0x9bcc('0x37')],{'$or':_[_0x9bcc('0x28')](_0x34acfc,function(_0x1c525c){if(_0x1c525c[_0x9bcc('0x3c')]!==_0x9bcc('0x3d')){var _0x5873c2={};_0x5873c2[_0x1c525c['name']]={'$like':'%'+_0x11c63f[_0x9bcc('0x2e')][_0x9bcc('0x3a')]+'%'};return _0x5873c2;}})});}_0xb867a8=_['merge']({},_0xb867a8,_0x11c63f[_0x9bcc('0x3e')]);var _0x4fed13={'where':_0xb867a8[_0x9bcc('0x37')]};return db[_0x9bcc('0x29')][_0x9bcc('0x1b')](_0x4fed13)[_0x9bcc('0x21')](function(_0x2e20a0){_0x2894ba[_0x9bcc('0x1b')]=_0x2e20a0;if(_0x11c63f[_0x9bcc('0x2e')][_0x9bcc('0x3f')]){_0xb867a8[_0x9bcc('0x40')]=[{'all':!![]}];}return db[_0x9bcc('0x29')][_0x9bcc('0x41')](_0xb867a8);})['then'](function(_0xaa198f){_0x2894ba['rows']=_0xaa198f;return _0x2894ba;})[_0x9bcc('0x21')](respondWithFilteredResult(_0x278dfd,_0xb867a8))['catch'](handleError(_0x278dfd,null));};exports[_0x9bcc('0x42')]=function(_0x1a1fc2,_0x5d660a){var _0x31ecd9={'raw':!![],'where':{'id':_0x1a1fc2[_0x9bcc('0x43')]['id']}},_0x1ca6ae={};_0x1ca6ae[_0x9bcc('0x2d')]=_[_0x9bcc('0x44')](db['SugarcrmField']['rawAttributes']);_0x1ca6ae[_0x9bcc('0x2e')]=_[_0x9bcc('0x44')](_0x1a1fc2[_0x9bcc('0x2e')]);_0x1ca6ae[_0x9bcc('0x38')]=_[_0x9bcc('0x2f')](_0x1ca6ae[_0x9bcc('0x2d')],_0x1ca6ae[_0x9bcc('0x2e')]);_0x31ecd9[_0x9bcc('0x30')]=_[_0x9bcc('0x2f')](_0x1ca6ae[_0x9bcc('0x2d')],qs[_0x9bcc('0x31')](_0x1a1fc2['query']['fields']));_0x31ecd9[_0x9bcc('0x30')]=_0x31ecd9[_0x9bcc('0x30')]['length']?_0x31ecd9[_0x9bcc('0x30')]:_0x1ca6ae[_0x9bcc('0x2d')];if(_0x1a1fc2[_0x9bcc('0x2e')][_0x9bcc('0x3f')]){_0x31ecd9['include']=[{'all':!![]}];}_0x31ecd9=_[_0x9bcc('0x3b')]({},_0x31ecd9,_0x1a1fc2[_0x9bcc('0x3e')]);return db['SugarcrmField']['find'](_0x31ecd9)['then'](handleEntityNotFound(_0x5d660a,null))[_0x9bcc('0x21')](respondWithResult(_0x5d660a,null))[_0x9bcc('0x45')](handleError(_0x5d660a,null));};exports[_0x9bcc('0x46')]=function(_0x27aef0,_0x1fc750){return db[_0x9bcc('0x29')]['create'](_0x27aef0[_0x9bcc('0x47')],{})[_0x9bcc('0x21')](respondWithResult(_0x1fc750,0xc9))['catch'](handleError(_0x1fc750,null));};exports['update']=function(_0x425710,_0x5964e3){if(_0x425710[_0x9bcc('0x47')]['id']){delete _0x425710[_0x9bcc('0x47')]['id'];}return db['SugarcrmField'][_0x9bcc('0x48')]({'where':{'id':_0x425710[_0x9bcc('0x43')]['id']}})[_0x9bcc('0x21')](handleEntityNotFound(_0x5964e3,null))[_0x9bcc('0x21')](saveUpdates(_0x425710[_0x9bcc('0x47')],null))[_0x9bcc('0x21')](respondWithResult(_0x5964e3,null))['catch'](handleError(_0x5964e3,null));};exports[_0x9bcc('0x22')]=function(_0x182f49,_0x15d846){return db['SugarcrmField']['find']({'where':{'id':_0x182f49[_0x9bcc('0x43')]['id']}})['then'](handleEntityNotFound(_0x15d846,null))[_0x9bcc('0x21')](removeEntity(_0x15d846,null))[_0x9bcc('0x45')](handleError(_0x15d846,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6c332ae..feadd00 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 _0x09fe=['./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','FieldId','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xf1c26a,_0x1ca014){var _0x4be4a8=function(_0x58e7a2){while(--_0x58e7a2){_0xf1c26a['push'](_0xf1c26a['shift']());}};_0x4be4a8(++_0x1ca014);}(_0x09fe,0x10e));var _0xe09f=function(_0x48132f,_0x35c1ce){_0x48132f=_0x48132f-0x0;var _0x1d3c28=_0x09fe[_0x48132f];return _0x1d3c28;};'use strict';var _=require('lodash');var util=require(_0xe09f('0x0'));var logger=require(_0xe09f('0x1'))(_0xe09f('0x2'));var moment=require('moment');var BPromise=require(_0xe09f('0x3'));var rp=require(_0xe09f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe09f('0x5'));var config=require('../../config/environment');var attributes=require(_0xe09f('0x6'));module[_0xe09f('0x7')]=function(_0x5ab7ae,_0x5beb97){return _0x5ab7ae[_0xe09f('0x8')](_0xe09f('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xe09f('0xa'),'fields':['idField',_0xe09f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d11=['request-promise','../../config/environment','define','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0x9d11,0x19a));var _0x19d1=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0x9d11[_0x20ebb5];return _0x487182;};'use strict';var _=require(_0x19d1('0x0'));var util=require('util');var logger=require(_0x19d1('0x1'))(_0x19d1('0x2'));var moment=require(_0x19d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x19d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19d1('0x5'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x3ebc98,_0x5dcf89){return _0x3ebc98[_0x19d1('0x6')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x19d1('0x7'),_0x19d1('0x8')],'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 3c982a1..1e9500e 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 _0x9ffd=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x316b7b,_0x5ba87e){var _0xcedfe1=function(_0x1c184e){while(--_0x1c184e){_0x316b7b['push'](_0x316b7b['shift']());}};_0xcedfe1(++_0x5ba87e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2910d7,_0x258e63){_0x2910d7=_0x2910d7-0x0;var _0x22d9b9=_0x9ffd[_0x2910d7];return _0x22d9b9;};'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']('SugarcrmField,\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')]('SugarcrmField,\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')]('SugarcrmField,\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 +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x255840,_0x411b6e){var _0x40dad5=function(_0x258d8d){while(--_0x258d8d){_0x255840['push'](_0x255840['shift']());}};_0x40dad5(++_0x411b6e);}(_0xda2d,0x102));var _0xdda2=function(_0x13b848,_0x5bfb6b){_0x13b848=_0x13b848-0x0;var _0x587d77=_0xda2d[_0x13b848];return _0x587d77;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 08c2699..8ca6083 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 _0xd4a1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','multer','util','path'];(function(_0x415912,_0x133e44){var _0x31c3ec=function(_0x55cdcb){while(--_0x55cdcb){_0x415912['push'](_0x415912['shift']());}};_0x31c3ec(++_0x133e44);}(_0xd4a1,0x105));var _0x1d4a=function(_0x19b9cb,_0x32c322){_0x19b9cb=_0x19b9cb-0x0;var _0x1a33c7=_0xd4a1[_0x19b9cb];return _0x1a33c7;};'use strict';var multer=require(_0x1d4a('0x0'));var util=require(_0x1d4a('0x1'));var path=require(_0x1d4a('0x2'));var timeout=require(_0x1d4a('0x3'));var express=require(_0x1d4a('0x4'));var router=express[_0x1d4a('0x5')]();var auth=require(_0x1d4a('0x6'));var interaction=require(_0x1d4a('0x7'));var config=require('../../config/environment');var controller=require(_0x1d4a('0x8'));router[_0x1d4a('0x9')]('/',auth[_0x1d4a('0xa')](),controller['index']);router['get'](_0x1d4a('0xb'),auth[_0x1d4a('0xa')](),controller[_0x1d4a('0xc')]);router['get']('/:id/configurations',auth[_0x1d4a('0xa')](),controller[_0x1d4a('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x1d4a('0xe')]);router[_0x1d4a('0xf')]('/',auth['isAuthenticated'](),controller[_0x1d4a('0x10')]);router[_0x1d4a('0xf')](_0x1d4a('0x11'),auth[_0x1d4a('0xa')](),controller[_0x1d4a('0x12')]);router[_0x1d4a('0x13')](_0x1d4a('0xb'),auth[_0x1d4a('0xa')](),controller['update']);router['delete']('/:id',auth[_0x1d4a('0xa')](),controller[_0x1d4a('0x14')]);module[_0x1d4a('0x15')]=router; \ No newline at end of file +var _0xc21a=['index','get','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated'];(function(_0x38d2a5,_0x3e4915){var _0x4d0941=function(_0x20f1f3){while(--_0x20f1f3){_0x38d2a5['push'](_0x38d2a5['shift']());}};_0x4d0941(++_0x3e4915);}(_0xc21a,0x1b0));var _0xac21=function(_0x48c38b,_0x978045){_0x48c38b=_0x48c38b-0x0;var _0x47cefd=_0xc21a[_0x48c38b];return _0x47cefd;};'use strict';var multer=require(_0xac21('0x0'));var util=require('util');var path=require(_0xac21('0x1'));var timeout=require(_0xac21('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xac21('0x3'));var interaction=require(_0xac21('0x4'));var config=require(_0xac21('0x5'));var controller=require(_0xac21('0x6'));router['get']('/',auth[_0xac21('0x7')](),controller[_0xac21('0x8')]);router[_0xac21('0x9')](_0xac21('0xa'),auth[_0xac21('0x7')](),controller[_0xac21('0xb')]);router[_0xac21('0x9')](_0xac21('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xac21('0x9')](_0xac21('0xd'),auth[_0xac21('0x7')](),controller['getFields']);router[_0xac21('0xe')]('/',auth[_0xac21('0x7')](),controller[_0xac21('0xf')]);router[_0xac21('0xe')](_0xac21('0xc'),auth['isAuthenticated'](),controller[_0xac21('0x10')]);router['put'](_0xac21('0xa'),auth[_0xac21('0x7')](),controller[_0xac21('0x11')]);router[_0xac21('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xac21('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a5edb38..d52099f 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 _0x1f6a=['STRING','HelpDesk','sequelize'];(function(_0x616d44,_0x4ba865){var _0x4b2644=function(_0x1b193c){while(--_0x1b193c){_0x616d44['push'](_0x616d44['shift']());}};_0x4b2644(++_0x4ba865);}(_0x1f6a,0xd7));var _0xa1f6=function(_0x16f6e4,_0x288b61){_0x16f6e4=_0x16f6e4-0x0;var _0x275354=_0x1f6a[_0x16f6e4];return _0x275354;};'use strict';var Sequelize=require(_0xa1f6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa1f6('0x1')]},'username':{'type':Sequelize[_0xa1f6('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa1f6('0x1')],'allowNull':![],'defaultValue':_0xa1f6('0x2')},'remoteUri':{'type':Sequelize[_0xa1f6('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa1f6('0x1')]},'accessKey':{'type':Sequelize[_0xa1f6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x547f=['STRING','HelpDesk','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x547f,0x1be));var _0xf547=function(_0x486359,_0x3aa5e6){_0x486359=_0x486359-0x0;var _0x598887=_0x547f[_0x486359];return _0x598887;};'use strict';var Sequelize=require(_0xf547('0x0'));module[_0xf547('0x1')]={'name':{'type':Sequelize[_0xf547('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf547('0x2')]},'username':{'type':Sequelize[_0xf547('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf547('0x2')],'allowNull':![],'defaultValue':_0xf547('0x3')},'remoteUri':{'type':Sequelize[_0xf547('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf547('0x2')]},'accessKey':{'type':Sequelize[_0xf547('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 7e2f5cb..9119b05 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 _0xa0e0=['picklistValues','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','end','sendStatus','stack','name','index','map','VtigerAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri','serverUrl','slice','format','GET','getchallenge','POST','login','token','describe','sessionName','success','reference','owner','remove','includes','editable','false','label'];(function(_0x309e21,_0x4f920a){var _0x12306f=function(_0x2c789c){while(--_0x2c789c){_0x309e21['push'](_0x309e21['shift']());}};_0x12306f(++_0x4f920a);}(_0xa0e0,0x103));var _0x0a0e=function(_0x41596c,_0x18b32d){_0x41596c=_0x41596c-0x0;var _0x159c3f=_0xa0e0[_0x41596c];return _0x159c3f;};'use strict';var pdf=require(_0x0a0e('0x0'));var emlformat=require(_0x0a0e('0x1'));var rimraf=require(_0x0a0e('0x2'));var zipdir=require(_0x0a0e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a0e('0x4'));var moment=require(_0x0a0e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0a0e('0x6'));var util=require(_0x0a0e('0x7'));var path=require(_0x0a0e('0x8'));var sox=require(_0x0a0e('0x9'));var csv=require('to-csv');var ejs=require(_0x0a0e('0xa'));var fs=require('fs');var _=require(_0x0a0e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a0e('0xc'));var toCsv=require(_0x0a0e('0xd'));var querystring=require(_0x0a0e('0xe'));var Papa=require(_0x0a0e('0xf'));var Redis=require(_0x0a0e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0a0e('0x11'));var as=require(_0x0a0e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a0e('0x13'))(_0x0a0e('0x14'));var utils=require(_0x0a0e('0x15'));var config=require('../../config/environment');var db=require(_0x0a0e('0x16'))['db'];var integrations=require(_0x0a0e('0x17'));var jayson=require(_0x0a0e('0x18'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x23c913,_0x36ca39,_0x375e94){if(_0x375e94){var _0x17c4c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17c4c7[_0x0a0e('0x19')](_0x36ca39)){return _0x23c913;}else{throw new db[(_0x0a0e('0x1a'))][(_0x0a0e('0x1b'))](_0x0a0e('0x1c'));}}else{return _0x23c913;}}function respondWithRpcPromise(_0x41cf97,_0x25626c,_0x1c05ad,_0x12bd43){return new BPromise(function(_0x412e21,_0x379a3b){var _0x23a21a=_0x12bd43||client;return _0x23a21a['request'](_0x41cf97,_0x1c05ad)[_0x0a0e('0x1d')](function(_0xb6dffa){logger[_0x0a0e('0x1e')](_0x0a0e('0x1f'),_0x25626c,_0x0a0e('0x20'));logger[_0x0a0e('0x21')](_0x0a0e('0x22'),_0x25626c,_0x0a0e('0x20'),JSON[_0x0a0e('0x23')](_0xb6dffa));if(_0xb6dffa[_0x0a0e('0x24')]){if(_0xb6dffa['error'][_0x0a0e('0x25')]===0x1f4){logger['error'](_0x0a0e('0x1f'),_0x25626c,_0xb6dffa[_0x0a0e('0x24')][_0x0a0e('0x26')]);return _0x379a3b(_0xb6dffa[_0x0a0e('0x24')]['message']);}logger[_0x0a0e('0x24')](_0x0a0e('0x1f'),_0x25626c,_0xb6dffa[_0x0a0e('0x24')]['message']);return _0x412e21(_0xb6dffa[_0x0a0e('0x24')][_0x0a0e('0x26')]);}else{logger[_0x0a0e('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x25626c,'request\x20sent');_0x412e21(_0xb6dffa[_0x0a0e('0x27')][_0x0a0e('0x26')]);}})[_0x0a0e('0x28')](function(_0x28cada){logger[_0x0a0e('0x24')]('VtigerAccount,\x20%s,\x20%s',_0x25626c,_0x28cada);_0x379a3b(_0x28cada);});});}function respondWithStatusCode(_0x1bf9ab,_0x1a90c9){_0x1a90c9=_0x1a90c9||0xcc;return function(_0x532152){if(_0x532152){return _0x1bf9ab['sendStatus'](_0x1a90c9);}return _0x1bf9ab[_0x0a0e('0x29')](_0x1a90c9)['end']();};}function respondWithResult(_0x3dd520,_0x5ad56d){_0x5ad56d=_0x5ad56d||0xc8;return function(_0x3f83f5){if(_0x3f83f5){return _0x3dd520['status'](_0x5ad56d)[_0x0a0e('0x2a')](_0x3f83f5);}};}function respondWithFilteredResult(_0x55974,_0x281ef1){return function(_0x386313){if(_0x386313){var _0x1cc101=_0x386313[_0x0a0e('0x2b')],_0x143a11=_0x281ef1[_0x0a0e('0x2c')],_0x55d57b=_0x281ef1['offset']+_0x281ef1[_0x0a0e('0x2d')],_0x3e051f;if(_0x55d57b>=_0x1cc101){_0x55d57b=_0x1cc101;_0x3e051f=0xc8;}else{_0x3e051f=0xce;}_0x55974[_0x0a0e('0x29')](_0x3e051f);return _0x55974['set'](_0x0a0e('0x2e'),_0x143a11+'-'+_0x55d57b+'/'+_0x1cc101)[_0x0a0e('0x2a')](_0x386313);}return null;};}function patchUpdates(_0x560710){return function(_0x2d9525){try{jsonpatch[_0x0a0e('0x2f')](_0x2d9525,_0x560710,!![]);}catch(_0x2779c7){return BPromise[_0x0a0e('0x30')](_0x2779c7);}return _0x2d9525[_0x0a0e('0x31')]();};}function saveUpdates(_0x260d40,_0x3cf27b){return function(_0x101c22){if(_0x101c22){return _0x101c22['update'](_0x260d40)[_0x0a0e('0x1d')](function(_0x3c59a0){return _0x3c59a0;});}return null;};}function removeEntity(_0x505739,_0x47748f){return function(_0x3960f7){if(_0x3960f7){return _0x3960f7['destroy']()[_0x0a0e('0x1d')](function(){_0x505739[_0x0a0e('0x29')](0xcc)[_0x0a0e('0x32')]();});}};}function handleEntityNotFound(_0x52e02f,_0x29f72b){return function(_0x2d913f){if(!_0x2d913f){_0x52e02f[_0x0a0e('0x33')](0x194);}return _0x2d913f;};}function handleError(_0x372048,_0x1c7cfa){_0x1c7cfa=_0x1c7cfa||0x1f4;return function(_0x5327fd){logger[_0x0a0e('0x24')](_0x5327fd[_0x0a0e('0x34')]);if(_0x5327fd[_0x0a0e('0x35')]){delete _0x5327fd[_0x0a0e('0x35')];}_0x372048[_0x0a0e('0x29')](_0x1c7cfa)['send'](_0x5327fd);};}exports[_0x0a0e('0x36')]=function(_0x43f672,_0x39777a){var _0x3824ab={},_0x405a4d={},_0x2e0cc0={'count':0x0,'rows':[]};var _0x179ea8=_[_0x0a0e('0x37')](db[_0x0a0e('0x38')]['rawAttributes'],function(_0x10f66d){return{'name':_0x10f66d[_0x0a0e('0x39')],'type':_0x10f66d[_0x0a0e('0x3a')][_0x0a0e('0x3b')]};});_0x405a4d[_0x0a0e('0x3c')]=_[_0x0a0e('0x37')](_0x179ea8,'name');_0x405a4d['query']=_['keys'](_0x43f672[_0x0a0e('0x3d')]);_0x405a4d[_0x0a0e('0x3e')]=_[_0x0a0e('0x3f')](_0x405a4d['model'],_0x405a4d[_0x0a0e('0x3d')]);_0x3824ab['attributes']=_[_0x0a0e('0x3f')](_0x405a4d[_0x0a0e('0x3c')],qs[_0x0a0e('0x40')](_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x40')]));_0x3824ab[_0x0a0e('0x41')]=_0x3824ab[_0x0a0e('0x41')][_0x0a0e('0x42')]?_0x3824ab[_0x0a0e('0x41')]:_0x405a4d[_0x0a0e('0x3c')];if(!_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x43')]('nolimit')){_0x3824ab[_0x0a0e('0x2d')]=qs[_0x0a0e('0x2d')](_0x43f672['query'][_0x0a0e('0x2d')]);_0x3824ab[_0x0a0e('0x2c')]=qs[_0x0a0e('0x2c')](_0x43f672[_0x0a0e('0x3d')]['offset']);}_0x3824ab[_0x0a0e('0x44')]=qs['sort'](_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x45')]);_0x3824ab[_0x0a0e('0x46')]=qs[_0x0a0e('0x3e')](_[_0x0a0e('0x47')](_0x43f672[_0x0a0e('0x3d')],_0x405a4d[_0x0a0e('0x3e')]),_0x179ea8);if(_0x43f672[_0x0a0e('0x3d')]['filter']){_0x3824ab[_0x0a0e('0x46')]=_[_0x0a0e('0x48')](_0x3824ab[_0x0a0e('0x46')],{'$or':_[_0x0a0e('0x37')](_0x179ea8,function(_0x4c1b3a){if(_0x4c1b3a[_0x0a0e('0x3a')]!==_0x0a0e('0x49')){var _0x50e092={};_0x50e092[_0x4c1b3a[_0x0a0e('0x35')]]={'$like':'%'+_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x4a')]+'%'};return _0x50e092;}})});}_0x3824ab=_['merge']({},_0x3824ab,_0x43f672[_0x0a0e('0x4b')]);var _0x47711f={'where':_0x3824ab[_0x0a0e('0x46')]};return db[_0x0a0e('0x38')][_0x0a0e('0x2b')](_0x47711f)[_0x0a0e('0x1d')](function(_0x1e129d){_0x2e0cc0[_0x0a0e('0x2b')]=_0x1e129d;if(_0x43f672[_0x0a0e('0x3d')][_0x0a0e('0x4c')]){_0x3824ab[_0x0a0e('0x4d')]=[{'all':!![]}];}return db['VtigerAccount'][_0x0a0e('0x4e')](_0x3824ab);})[_0x0a0e('0x1d')](function(_0x566a38){_0x2e0cc0['rows']=_0x566a38;return _0x2e0cc0;})[_0x0a0e('0x1d')](respondWithFilteredResult(_0x39777a,_0x3824ab))['catch'](handleError(_0x39777a,null));};exports[_0x0a0e('0x4f')]=function(_0x512115,_0x5b5635){var _0x2d3ff4={'raw':![],'where':{'id':_0x512115[_0x0a0e('0x50')]['id']}},_0x3c4be9={};_0x3c4be9['model']=_[_0x0a0e('0x51')](db[_0x0a0e('0x38')][_0x0a0e('0x52')]);_0x3c4be9[_0x0a0e('0x3d')]=_['keys'](_0x512115[_0x0a0e('0x3d')]);_0x3c4be9[_0x0a0e('0x3e')]=_[_0x0a0e('0x3f')](_0x3c4be9[_0x0a0e('0x3c')],_0x3c4be9[_0x0a0e('0x3d')]);_0x2d3ff4[_0x0a0e('0x41')]=_['intersection'](_0x3c4be9[_0x0a0e('0x3c')],qs[_0x0a0e('0x40')](_0x512115[_0x0a0e('0x3d')][_0x0a0e('0x40')]));_0x2d3ff4[_0x0a0e('0x41')]=_0x2d3ff4[_0x0a0e('0x41')]['length']?_0x2d3ff4[_0x0a0e('0x41')]:_0x3c4be9[_0x0a0e('0x3c')];if(_0x512115['query'][_0x0a0e('0x4c')]){_0x2d3ff4[_0x0a0e('0x4d')]=[{'all':!![]}];}_0x2d3ff4=_[_0x0a0e('0x48')]({},_0x2d3ff4,_0x512115[_0x0a0e('0x4b')]);return db[_0x0a0e('0x38')][_0x0a0e('0x53')](_0x2d3ff4)['then'](handleEntityNotFound(_0x5b5635,null))[_0x0a0e('0x1d')](respondWithResult(_0x5b5635,null))['catch'](handleError(_0x5b5635,null));};exports[_0x0a0e('0x54')]=function(_0x4c0511,_0x17bc08){return db[_0x0a0e('0x38')][_0x0a0e('0x54')](_0x4c0511[_0x0a0e('0x55')],{})[_0x0a0e('0x1d')](respondWithResult(_0x17bc08,0xc9))[_0x0a0e('0x28')](handleError(_0x17bc08,null));};exports[_0x0a0e('0x56')]=function(_0x23d1e9,_0x35e297){if(_0x23d1e9[_0x0a0e('0x55')]['id']){delete _0x23d1e9[_0x0a0e('0x55')]['id'];}return db[_0x0a0e('0x38')][_0x0a0e('0x53')]({'where':{'id':_0x23d1e9[_0x0a0e('0x50')]['id']}})[_0x0a0e('0x1d')](handleEntityNotFound(_0x35e297,null))[_0x0a0e('0x1d')](saveUpdates(_0x23d1e9[_0x0a0e('0x55')],null))[_0x0a0e('0x1d')](respondWithResult(_0x35e297,null))[_0x0a0e('0x28')](handleError(_0x35e297,null));};exports['destroy']=function(_0x11e425,_0x29d437){return db[_0x0a0e('0x38')]['find']({'where':{'id':_0x11e425[_0x0a0e('0x50')]['id']}})[_0x0a0e('0x1d')](handleEntityNotFound(_0x29d437,null))['then'](removeEntity(_0x29d437,null))['catch'](handleError(_0x29d437,null));};exports[_0x0a0e('0x57')]=function(_0x2a9974,_0x36a888,_0x484009){var _0x709272={};var _0x1f0360={};var _0xf5f18d;var _0x299578;return db[_0x0a0e('0x38')][_0x0a0e('0x58')]({'where':{'id':_0x2a9974[_0x0a0e('0x50')]['id']}})[_0x0a0e('0x1d')](handleEntityNotFound(_0x36a888,null))[_0x0a0e('0x1d')](function(_0x3e2b98){if(_0x3e2b98){_0xf5f18d=_0x3e2b98;_0x1f0360['model']=_[_0x0a0e('0x51')](db[_0x0a0e('0x59')][_0x0a0e('0x52')]);_0x1f0360[_0x0a0e('0x3d')]=_[_0x0a0e('0x51')](_0x2a9974[_0x0a0e('0x3d')]);_0x1f0360[_0x0a0e('0x3e')]=_['intersection'](_0x1f0360['model'],_0x1f0360[_0x0a0e('0x3d')]);_0x709272[_0x0a0e('0x41')]=_['intersection'](_0x1f0360[_0x0a0e('0x3c')],qs[_0x0a0e('0x40')](_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x40')]));_0x709272[_0x0a0e('0x41')]=_0x709272[_0x0a0e('0x41')]['length']?_0x709272[_0x0a0e('0x41')]:_0x1f0360[_0x0a0e('0x3c')];_0x709272[_0x0a0e('0x44')]=qs[_0x0a0e('0x45')](_0x2a9974['query'][_0x0a0e('0x45')]);_0x709272['where']=qs[_0x0a0e('0x3e')](_[_0x0a0e('0x47')](_0x2a9974[_0x0a0e('0x3d')],_0x1f0360['filters']));if(_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x4a')]){_0x709272['where']=_[_0x0a0e('0x48')](_0x709272['where'],{'$or':_['map'](_0x709272[_0x0a0e('0x41')],function(_0x3f7e66){var _0x23c05d={};_0x23c05d[_0x3f7e66]={'$like':'%'+_0x2a9974['query'][_0x0a0e('0x4a')]+'%'};return _0x23c05d;})});}_0x709272=_[_0x0a0e('0x48')]({},_0x709272,_0x2a9974['options']);return _0xf5f18d['getConfigurations'](_0x709272);}})[_0x0a0e('0x1d')](function(_0x5324ed){if(_0x5324ed){_0x299578=_0x5324ed[_0x0a0e('0x42')];if(!_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x43')](_0x0a0e('0x5a'))){_0x709272[_0x0a0e('0x2d')]=qs[_0x0a0e('0x2d')](_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x2d')]);_0x709272['offset']=qs[_0x0a0e('0x2c')](_0x2a9974[_0x0a0e('0x3d')][_0x0a0e('0x2c')]);}return _0xf5f18d[_0x0a0e('0x57')](_0x709272);}})[_0x0a0e('0x1d')](function(_0x23b3c6){if(_0x23b3c6){return _0x23b3c6?{'count':_0x299578,'rows':_0x23b3c6}:null;}})[_0x0a0e('0x1d')](respondWithResult(_0x36a888,null))[_0x0a0e('0x28')](handleError(_0x36a888,null));};exports[_0x0a0e('0x5b')]=function(_0x29bc09,_0x2e79d6,_0x531d44){if(_0x29bc09['body']['id']){delete _0x29bc09[_0x0a0e('0x55')]['id'];}return db[_0x0a0e('0x38')][_0x0a0e('0x58')]({'where':{'id':_0x29bc09[_0x0a0e('0x50')]['id']}})['then'](handleEntityNotFound(_0x2e79d6,null))['then'](function(_0x4a9ab5){if(_0x4a9ab5){_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x5c')]=_0x4a9ab5['id'];_0x29bc09['body']['Subjects']=integrations[_0x0a0e('0x5d')](_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x5e')],_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x3a')]);_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x5f')]=integrations[_0x0a0e('0x60')](_0x29bc09['body']['channel'],_0x29bc09[_0x0a0e('0x55')][_0x0a0e('0x3a')]);return db[_0x0a0e('0x59')][_0x0a0e('0x54')](_0x29bc09[_0x0a0e('0x55')],{'include':[{'model':db[_0x0a0e('0x61')],'as':_0x0a0e('0x62')},{'model':db[_0x0a0e('0x61')],'as':_0x0a0e('0x5f')}]});}return null;})['then'](respondWithResult(_0x2e79d6,null))[_0x0a0e('0x28')](handleError(_0x2e79d6,null));};var md5=require('md5');exports[_0x0a0e('0x63')]=function(_0x23ced5,_0x1c8e1b,_0x26f738){var _0x3c98e3=null;var _0x374a79=null;var _0x5dcf63=null;var _0x30bdaa=null;var _0x1d1f6b='';return db[_0x0a0e('0x38')][_0x0a0e('0x58')]({'where':{'id':_0x23ced5['params']['id']},'attributes':['id',_0x0a0e('0x35'),_0x0a0e('0x64'),_0x0a0e('0x65'),_0x0a0e('0x66'),_0x0a0e('0x67'),_0x0a0e('0x68'),'accessKey']})[_0x0a0e('0x1d')](handleEntityNotFound(_0x1c8e1b,null))[_0x0a0e('0x1d')](function(_0xe4ff36){if(_0xe4ff36){_0x3c98e3=_0xe4ff36[_0x0a0e('0x64')];_0x374a79=_0xe4ff36['accessKey'];_0x5dcf63=_0xe4ff36[_0x0a0e('0x66')];_0x1d1f6b=_0xe4ff36[_0x0a0e('0x67')];var _0x571592=_0x1d1f6b[_0x0a0e('0x69')](-0x1);if(_0x571592==='/'){_0x1d1f6b=_0x1d1f6b['substring'](0x0,_0x1d1f6b['lastIndexOf'](_0x571592));}_0x30bdaa=util[_0x0a0e('0x6a')]('%s/webservice.php',_0x1d1f6b);var _0x2716c2={'method':_0x0a0e('0x6b'),'uri':_0x30bdaa,'qs':{'operation':_0x0a0e('0x6c'),'username':_0xe4ff36['username']},'json':!![]};return rp(_0x2716c2);}})['then'](function(_0xb4556f){if(_0xb4556f['success']){var _0x5b0b1a={'method':_0x0a0e('0x6d'),'uri':_0x30bdaa,'form':{'operation':_0x0a0e('0x6e'),'username':_0x3c98e3,'accessKey':md5(_0xb4556f[_0x0a0e('0x27')][_0x0a0e('0x6f')]+_0x374a79)},'json':!![]};return rp(_0x5b0b1a);}})[_0x0a0e('0x1d')](function(_0x6ff3a5){if(_0x6ff3a5['success']){var _0x552f33={'method':_0x0a0e('0x6b'),'uri':_0x30bdaa,'qs':{'operation':_0x0a0e('0x70'),'username':_0x3c98e3,'sessionName':_0x6ff3a5[_0x0a0e('0x27')][_0x0a0e('0x71')],'elementType':_0x5dcf63},'json':!![]};return rp(_0x552f33);}})[_0x0a0e('0x1d')](function(_0x2377af){if(_0x2377af[_0x0a0e('0x72')]){var _0x366b61=['autogenerated',_0x0a0e('0x73'),_0x0a0e('0x74')];_[_0x0a0e('0x75')](_0x2377af['result'][_0x0a0e('0x40')],function(_0x2f5e64){return _0x366b61[_0x0a0e('0x76')](_0x2f5e64[_0x0a0e('0x3a')][_0x0a0e('0x35')]);});_[_0x0a0e('0x75')](_0x2377af[_0x0a0e('0x27')][_0x0a0e('0x40')],function(_0x421d6f){return _0x421d6f[_0x0a0e('0x77')]===_0x0a0e('0x78');});return{'count':_0x2377af[_0x0a0e('0x27')][_0x0a0e('0x40')]['length'],'rows':_[_0x0a0e('0x37')](_0x2377af[_0x0a0e('0x27')][_0x0a0e('0x40')],function(_0x4fe9bc){return{'id':_0x4fe9bc[_0x0a0e('0x35')],'name':_0x4fe9bc[_0x0a0e('0x79')],'custom':_['startsWith'](_0x4fe9bc[_0x0a0e('0x35')],'cf_')?!![]:![],'options':_0x4fe9bc[_0x0a0e('0x3a')]['name']==='picklist'&&_0x4fe9bc[_0x0a0e('0x3a')]['picklistValues'][_0x0a0e('0x42')]>0x0?_[_0x0a0e('0x37')](_0x4fe9bc[_0x0a0e('0x3a')][_0x0a0e('0x7a')],function(_0x2afd66){return{'name':_0x2afd66[_0x0a0e('0x79')],'value':_0x2afd66['value']};}):[]};})};}})['then'](respondWithResult(_0x1c8e1b,null))[_0x0a0e('0x28')](function(_0x3b0aeb){console['log'](_0x0a0e('0x7b')+_0x3b0aeb);var _0x56f13b=_0x23ced5[_0x0a0e('0x3d')][_0x0a0e('0x19')]?0x1f4:_0x3b0aeb['statusCode']||0x1f4;logger['error'](_0x0a0e('0x7c'),_0x0a0e('0x63'),_0x56f13b,JSON[_0x0a0e('0x23')](_0x3b0aeb));delete _0x3b0aeb[_0x0a0e('0x35')];if(_0x56f13b===0x191){_0x56f13b=0x190;}_0x1c8e1b[_0x0a0e('0x29')](_0x56f13b)[_0x0a0e('0x7d')](_0x23ced5[_0x0a0e('0x3d')]['test']?{'message':_0x0a0e('0x7e'),'statusCode':_0x3b0aeb['statusCode']}:_0x3b0aeb);});}; \ No newline at end of file +var _0xffcc=['where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','create','VtigerField','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','format','%s/webservice.php','GET','getchallenge','POST','login','token','success','result','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../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','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xffcc,0x147));var _0xcffc=function(_0x212a70,_0x4f289e){_0x212a70=_0x212a70-0x0;var _0x48ae7c=_0xffcc[_0x212a70];return _0x48ae7c;};'use strict';var pdf=require(_0xcffc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcffc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcffc('0x2'));var rp=require(_0xcffc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcffc('0x4'));var util=require(_0xcffc('0x5'));var path=require(_0xcffc('0x6'));var sox=require(_0xcffc('0x7'));var csv=require(_0xcffc('0x8'));var ejs=require(_0xcffc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcffc('0xa'));var jsforce=require(_0xcffc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcffc('0xc'));var Papa=require(_0xcffc('0xd'));var Redis=require(_0xcffc('0xe'));var authService=require(_0xcffc('0xf'));var qs=require(_0xcffc('0x10'));var as=require(_0xcffc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcffc('0x12'))('api');var utils=require(_0xcffc('0x13'));var config=require(_0xcffc('0x14'));var db=require(_0xcffc('0x15'))['db'];var integrations=require(_0xcffc('0x16'));var jayson=require(_0xcffc('0x17'));var client=jayson[_0xcffc('0x18')][_0xcffc('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4afd07,_0x452c53,_0x5cb199){if(_0x5cb199){var _0x2aea39=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2aea39[_0xcffc('0x1a')](_0x452c53)){return _0x4afd07;}else{throw new db['Sequelize']['ValidationError'](_0xcffc('0x1b'));}}else{return _0x4afd07;}}function respondWithRpcPromise(_0x2d613e,_0x5a9cb3,_0x4e2700,_0x5dc71b){return new BPromise(function(_0x201e23,_0x2d724b){var _0x3437f1=_0x5dc71b||client;return _0x3437f1[_0xcffc('0x1c')](_0x2d613e,_0x4e2700)[_0xcffc('0x1d')](function(_0x2cd0b7){logger[_0xcffc('0x1e')](_0xcffc('0x1f'),_0x5a9cb3,_0xcffc('0x20'));logger[_0xcffc('0x21')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x5a9cb3,_0xcffc('0x20'),JSON[_0xcffc('0x22')](_0x2cd0b7));if(_0x2cd0b7[_0xcffc('0x23')]){if(_0x2cd0b7['error']['code']===0x1f4){logger[_0xcffc('0x23')](_0xcffc('0x1f'),_0x5a9cb3,_0x2cd0b7['error'][_0xcffc('0x24')]);return _0x2d724b(_0x2cd0b7['error'][_0xcffc('0x24')]);}logger[_0xcffc('0x23')](_0xcffc('0x1f'),_0x5a9cb3,_0x2cd0b7[_0xcffc('0x23')][_0xcffc('0x24')]);return _0x201e23(_0x2cd0b7[_0xcffc('0x23')][_0xcffc('0x24')]);}else{logger['info'](_0xcffc('0x1f'),_0x5a9cb3,_0xcffc('0x20'));_0x201e23(_0x2cd0b7['result'][_0xcffc('0x24')]);}})[_0xcffc('0x25')](function(_0x1dae91){logger[_0xcffc('0x23')](_0xcffc('0x1f'),_0x5a9cb3,_0x1dae91);_0x2d724b(_0x1dae91);});});}function respondWithStatusCode(_0xfe69c4,_0x318711){_0x318711=_0x318711||0xcc;return function(_0x3c5223){if(_0x3c5223){return _0xfe69c4['sendStatus'](_0x318711);}return _0xfe69c4['status'](_0x318711)['end']();};}function respondWithResult(_0x54bef1,_0x4a922f){_0x4a922f=_0x4a922f||0xc8;return function(_0x5a8fd5){if(_0x5a8fd5){return _0x54bef1[_0xcffc('0x26')](_0x4a922f)['json'](_0x5a8fd5);}};}function respondWithFilteredResult(_0x2496ea,_0x3cc16f){return function(_0x106903){if(_0x106903){var _0x223c6f=_0x106903[_0xcffc('0x27')],_0x2479a7=_0x3cc16f[_0xcffc('0x28')],_0x3fba22=_0x3cc16f['offset']+_0x3cc16f[_0xcffc('0x29')],_0x3dc8f1;if(_0x3fba22>=_0x223c6f){_0x3fba22=_0x223c6f;_0x3dc8f1=0xc8;}else{_0x3dc8f1=0xce;}_0x2496ea['status'](_0x3dc8f1);return _0x2496ea[_0xcffc('0x2a')](_0xcffc('0x2b'),_0x2479a7+'-'+_0x3fba22+'/'+_0x223c6f)[_0xcffc('0x2c')](_0x106903);}return null;};}function patchUpdates(_0x5e39c2){return function(_0x226835){try{jsonpatch[_0xcffc('0x2d')](_0x226835,_0x5e39c2,!![]);}catch(_0x3e00ed){return BPromise[_0xcffc('0x2e')](_0x3e00ed);}return _0x226835[_0xcffc('0x2f')]();};}function saveUpdates(_0x5d0cd8,_0x137662){return function(_0x320c13){if(_0x320c13){return _0x320c13[_0xcffc('0x30')](_0x5d0cd8)['then'](function(_0x435128){return _0x435128;});}return null;};}function removeEntity(_0x5cf9cf,_0x1c974d){return function(_0x3e96a2){if(_0x3e96a2){return _0x3e96a2[_0xcffc('0x31')]()['then'](function(){_0x5cf9cf[_0xcffc('0x26')](0xcc)[_0xcffc('0x32')]();});}};}function handleEntityNotFound(_0xd81784,_0x4ed928){return function(_0x297ac4){if(!_0x297ac4){_0xd81784[_0xcffc('0x33')](0x194);}return _0x297ac4;};}function handleError(_0x37c122,_0x3aae95){_0x3aae95=_0x3aae95||0x1f4;return function(_0x523cb7){logger[_0xcffc('0x23')](_0x523cb7[_0xcffc('0x34')]);if(_0x523cb7[_0xcffc('0x35')]){delete _0x523cb7[_0xcffc('0x35')];}_0x37c122[_0xcffc('0x26')](_0x3aae95)[_0xcffc('0x36')](_0x523cb7);};}exports[_0xcffc('0x37')]=function(_0x332e42,_0x4adf43){var _0x4b56c4={},_0x373db8={},_0x138cfd={'count':0x0,'rows':[]};var _0x1382fd=_[_0xcffc('0x38')](db[_0xcffc('0x39')][_0xcffc('0x3a')],function(_0x28f6c2){return{'name':_0x28f6c2[_0xcffc('0x3b')],'type':_0x28f6c2['type'][_0xcffc('0x3c')]};});_0x373db8['model']=_['map'](_0x1382fd,'name');_0x373db8[_0xcffc('0x3d')]=_[_0xcffc('0x3e')](_0x332e42[_0xcffc('0x3d')]);_0x373db8[_0xcffc('0x3f')]=_[_0xcffc('0x40')](_0x373db8['model'],_0x373db8[_0xcffc('0x3d')]);_0x4b56c4[_0xcffc('0x41')]=_[_0xcffc('0x40')](_0x373db8[_0xcffc('0x42')],qs[_0xcffc('0x43')](_0x332e42[_0xcffc('0x3d')]['fields']));_0x4b56c4[_0xcffc('0x41')]=_0x4b56c4[_0xcffc('0x41')][_0xcffc('0x44')]?_0x4b56c4['attributes']:_0x373db8[_0xcffc('0x42')];if(!_0x332e42[_0xcffc('0x3d')][_0xcffc('0x45')](_0xcffc('0x46'))){_0x4b56c4['limit']=qs[_0xcffc('0x29')](_0x332e42['query'][_0xcffc('0x29')]);_0x4b56c4[_0xcffc('0x28')]=qs[_0xcffc('0x28')](_0x332e42[_0xcffc('0x3d')][_0xcffc('0x28')]);}_0x4b56c4[_0xcffc('0x47')]=qs['sort'](_0x332e42[_0xcffc('0x3d')][_0xcffc('0x48')]);_0x4b56c4['where']=qs[_0xcffc('0x3f')](_[_0xcffc('0x49')](_0x332e42[_0xcffc('0x3d')],_0x373db8[_0xcffc('0x3f')]),_0x1382fd);if(_0x332e42[_0xcffc('0x3d')][_0xcffc('0x4a')]){_0x4b56c4[_0xcffc('0x4b')]=_[_0xcffc('0x4c')](_0x4b56c4[_0xcffc('0x4b')],{'$or':_[_0xcffc('0x38')](_0x1382fd,function(_0x3c3d88){if(_0x3c3d88[_0xcffc('0x4d')]!==_0xcffc('0x4e')){var _0x26b647={};_0x26b647[_0x3c3d88[_0xcffc('0x35')]]={'$like':'%'+_0x332e42['query'][_0xcffc('0x4a')]+'%'};return _0x26b647;}})});}_0x4b56c4=_[_0xcffc('0x4c')]({},_0x4b56c4,_0x332e42['options']);var _0xfca253={'where':_0x4b56c4[_0xcffc('0x4b')]};return db[_0xcffc('0x39')]['count'](_0xfca253)['then'](function(_0xd745c0){_0x138cfd[_0xcffc('0x27')]=_0xd745c0;if(_0x332e42['query'][_0xcffc('0x4f')]){_0x4b56c4[_0xcffc('0x50')]=[{'all':!![]}];}return db['VtigerAccount'][_0xcffc('0x51')](_0x4b56c4);})[_0xcffc('0x1d')](function(_0x223e85){_0x138cfd[_0xcffc('0x52')]=_0x223e85;return _0x138cfd;})[_0xcffc('0x1d')](respondWithFilteredResult(_0x4adf43,_0x4b56c4))[_0xcffc('0x25')](handleError(_0x4adf43,null));};exports[_0xcffc('0x53')]=function(_0x18aefa,_0x27e5de){var _0x1f470d={'raw':![],'where':{'id':_0x18aefa[_0xcffc('0x54')]['id']}},_0x310861={};_0x310861[_0xcffc('0x42')]=_['keys'](db[_0xcffc('0x39')][_0xcffc('0x3a')]);_0x310861['query']=_['keys'](_0x18aefa['query']);_0x310861[_0xcffc('0x3f')]=_[_0xcffc('0x40')](_0x310861['model'],_0x310861['query']);_0x1f470d[_0xcffc('0x41')]=_[_0xcffc('0x40')](_0x310861[_0xcffc('0x42')],qs[_0xcffc('0x43')](_0x18aefa[_0xcffc('0x3d')][_0xcffc('0x43')]));_0x1f470d[_0xcffc('0x41')]=_0x1f470d[_0xcffc('0x41')]['length']?_0x1f470d[_0xcffc('0x41')]:_0x310861[_0xcffc('0x42')];if(_0x18aefa[_0xcffc('0x3d')][_0xcffc('0x4f')]){_0x1f470d[_0xcffc('0x50')]=[{'all':!![]}];}_0x1f470d=_[_0xcffc('0x4c')]({},_0x1f470d,_0x18aefa[_0xcffc('0x55')]);return db[_0xcffc('0x39')][_0xcffc('0x56')](_0x1f470d)[_0xcffc('0x1d')](handleEntityNotFound(_0x27e5de,null))[_0xcffc('0x1d')](respondWithResult(_0x27e5de,null))[_0xcffc('0x25')](handleError(_0x27e5de,null));};exports['create']=function(_0x1fd5b5,_0x572534){return db[_0xcffc('0x39')]['create'](_0x1fd5b5[_0xcffc('0x57')],{})[_0xcffc('0x1d')](respondWithResult(_0x572534,0xc9))['catch'](handleError(_0x572534,null));};exports[_0xcffc('0x30')]=function(_0x4ed807,_0x47dd8d){if(_0x4ed807[_0xcffc('0x57')]['id']){delete _0x4ed807[_0xcffc('0x57')]['id'];}return db[_0xcffc('0x39')][_0xcffc('0x56')]({'where':{'id':_0x4ed807[_0xcffc('0x54')]['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x47dd8d,null))['then'](saveUpdates(_0x4ed807[_0xcffc('0x57')],null))[_0xcffc('0x1d')](respondWithResult(_0x47dd8d,null))['catch'](handleError(_0x47dd8d,null));};exports[_0xcffc('0x31')]=function(_0x332081,_0x12f30c){return db[_0xcffc('0x39')][_0xcffc('0x56')]({'where':{'id':_0x332081[_0xcffc('0x54')]['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x12f30c,null))[_0xcffc('0x1d')](removeEntity(_0x12f30c,null))[_0xcffc('0x25')](handleError(_0x12f30c,null));};exports[_0xcffc('0x58')]=function(_0x2d6a7e,_0x1c2065,_0x5c929a){var _0x2a710f={};var _0x1aad70={};var _0x1e510c;var _0x8ec63a;return db[_0xcffc('0x39')]['findOne']({'where':{'id':_0x2d6a7e[_0xcffc('0x54')]['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x1c2065,null))[_0xcffc('0x1d')](function(_0x3faf20){if(_0x3faf20){_0x1e510c=_0x3faf20;_0x1aad70[_0xcffc('0x42')]=_[_0xcffc('0x3e')](db['VtigerConfiguration'][_0xcffc('0x3a')]);_0x1aad70[_0xcffc('0x3d')]=_['keys'](_0x2d6a7e[_0xcffc('0x3d')]);_0x1aad70[_0xcffc('0x3f')]=_[_0xcffc('0x40')](_0x1aad70['model'],_0x1aad70['query']);_0x2a710f['attributes']=_[_0xcffc('0x40')](_0x1aad70[_0xcffc('0x42')],qs['fields'](_0x2d6a7e['query'][_0xcffc('0x43')]));_0x2a710f[_0xcffc('0x41')]=_0x2a710f['attributes'][_0xcffc('0x44')]?_0x2a710f['attributes']:_0x1aad70[_0xcffc('0x42')];_0x2a710f[_0xcffc('0x47')]=qs['sort'](_0x2d6a7e[_0xcffc('0x3d')]['sort']);_0x2a710f['where']=qs[_0xcffc('0x3f')](_[_0xcffc('0x49')](_0x2d6a7e['query'],_0x1aad70[_0xcffc('0x3f')]));if(_0x2d6a7e[_0xcffc('0x3d')][_0xcffc('0x4a')]){_0x2a710f[_0xcffc('0x4b')]=_[_0xcffc('0x4c')](_0x2a710f[_0xcffc('0x4b')],{'$or':_[_0xcffc('0x38')](_0x2a710f[_0xcffc('0x41')],function(_0x52e050){var _0x3fdda5={};_0x3fdda5[_0x52e050]={'$like':'%'+_0x2d6a7e['query'][_0xcffc('0x4a')]+'%'};return _0x3fdda5;})});}_0x2a710f=_['merge']({},_0x2a710f,_0x2d6a7e[_0xcffc('0x55')]);return _0x1e510c[_0xcffc('0x58')](_0x2a710f);}})['then'](function(_0x5c3f72){if(_0x5c3f72){_0x8ec63a=_0x5c3f72[_0xcffc('0x44')];if(!_0x2d6a7e[_0xcffc('0x3d')]['hasOwnProperty'](_0xcffc('0x46'))){_0x2a710f['limit']=qs[_0xcffc('0x29')](_0x2d6a7e[_0xcffc('0x3d')][_0xcffc('0x29')]);_0x2a710f[_0xcffc('0x28')]=qs['offset'](_0x2d6a7e[_0xcffc('0x3d')][_0xcffc('0x28')]);}return _0x1e510c[_0xcffc('0x58')](_0x2a710f);}})[_0xcffc('0x1d')](function(_0x388a01){if(_0x388a01){return _0x388a01?{'count':_0x8ec63a,'rows':_0x388a01}:null;}})[_0xcffc('0x1d')](respondWithResult(_0x1c2065,null))[_0xcffc('0x25')](handleError(_0x1c2065,null));};exports[_0xcffc('0x59')]=function(_0x16093c,_0x553558,_0x314fe3){if(_0x16093c[_0xcffc('0x57')]['id']){delete _0x16093c[_0xcffc('0x57')]['id'];}return db['VtigerAccount'][_0xcffc('0x5a')]({'where':{'id':_0x16093c['params']['id']}})[_0xcffc('0x1d')](handleEntityNotFound(_0x553558,null))[_0xcffc('0x1d')](function(_0x5c9a8b){if(_0x5c9a8b){_0x16093c[_0xcffc('0x57')][_0xcffc('0x5b')]=_0x5c9a8b['id'];_0x16093c[_0xcffc('0x57')][_0xcffc('0x5c')]=integrations['getSubjects'](_0x16093c[_0xcffc('0x57')][_0xcffc('0x5d')],_0x16093c[_0xcffc('0x57')][_0xcffc('0x4d')]);_0x16093c[_0xcffc('0x57')][_0xcffc('0x5e')]=integrations[_0xcffc('0x5f')](_0x16093c[_0xcffc('0x57')][_0xcffc('0x5d')],_0x16093c[_0xcffc('0x57')][_0xcffc('0x4d')]);return db[_0xcffc('0x60')][_0xcffc('0x61')](_0x16093c[_0xcffc('0x57')],{'include':[{'model':db[_0xcffc('0x62')],'as':_0xcffc('0x5c')},{'model':db['VtigerField'],'as':_0xcffc('0x5e')}]});}return null;})[_0xcffc('0x1d')](respondWithResult(_0x553558,null))[_0xcffc('0x25')](handleError(_0x553558,null));};var md5=require('md5');exports['getFields']=function(_0x178a7c,_0x4db6bb,_0x1551f9){var _0x40ca80=null;var _0x51527f=null;var _0x2f84ff=null;var _0xc11552=null;var _0xf45843='';return db[_0xcffc('0x39')][_0xcffc('0x5a')]({'where':{'id':_0x178a7c[_0xcffc('0x54')]['id']},'attributes':['id',_0xcffc('0x35'),_0xcffc('0x63'),_0xcffc('0x64'),'moduleName',_0xcffc('0x65'),_0xcffc('0x66'),_0xcffc('0x67')]})[_0xcffc('0x1d')](handleEntityNotFound(_0x4db6bb,null))[_0xcffc('0x1d')](function(_0x4f30af){if(_0x4f30af){_0x40ca80=_0x4f30af[_0xcffc('0x63')];_0x51527f=_0x4f30af[_0xcffc('0x67')];_0x2f84ff=_0x4f30af[_0xcffc('0x68')];_0xf45843=_0x4f30af[_0xcffc('0x65')];var _0x542ea3=_0xf45843[_0xcffc('0x69')](-0x1);if(_0x542ea3==='/'){_0xf45843=_0xf45843['substring'](0x0,_0xf45843['lastIndexOf'](_0x542ea3));}_0xc11552=util[_0xcffc('0x6a')](_0xcffc('0x6b'),_0xf45843);var _0x40598a={'method':_0xcffc('0x6c'),'uri':_0xc11552,'qs':{'operation':_0xcffc('0x6d'),'username':_0x4f30af['username']},'json':!![]};return rp(_0x40598a);}})[_0xcffc('0x1d')](function(_0x31930b){if(_0x31930b['success']){var _0x1331b1={'method':_0xcffc('0x6e'),'uri':_0xc11552,'form':{'operation':_0xcffc('0x6f'),'username':_0x40ca80,'accessKey':md5(_0x31930b['result'][_0xcffc('0x70')]+_0x51527f)},'json':!![]};return rp(_0x1331b1);}})[_0xcffc('0x1d')](function(_0x306c4b){if(_0x306c4b[_0xcffc('0x71')]){var _0x39dfc1={'method':_0xcffc('0x6c'),'uri':_0xc11552,'qs':{'operation':'describe','username':_0x40ca80,'sessionName':_0x306c4b[_0xcffc('0x72')][_0xcffc('0x73')],'elementType':_0x2f84ff},'json':!![]};return rp(_0x39dfc1);}})['then'](function(_0x30ea30){if(_0x30ea30['success']){var _0x524d47=[_0xcffc('0x74'),_0xcffc('0x75'),_0xcffc('0x76')];_[_0xcffc('0x77')](_0x30ea30['result']['fields'],function(_0x321ff5){return _0x524d47['includes'](_0x321ff5[_0xcffc('0x4d')][_0xcffc('0x35')]);});_['remove'](_0x30ea30[_0xcffc('0x72')][_0xcffc('0x43')],function(_0x4c0846){return _0x4c0846[_0xcffc('0x78')]===_0xcffc('0x79');});return{'count':_0x30ea30[_0xcffc('0x72')][_0xcffc('0x43')][_0xcffc('0x44')],'rows':_[_0xcffc('0x38')](_0x30ea30[_0xcffc('0x72')]['fields'],function(_0x2f8bb9){return{'id':_0x2f8bb9[_0xcffc('0x35')],'name':_0x2f8bb9[_0xcffc('0x7a')],'custom':_[_0xcffc('0x7b')](_0x2f8bb9[_0xcffc('0x35')],_0xcffc('0x7c'))?!![]:![],'options':_0x2f8bb9['type'][_0xcffc('0x35')]===_0xcffc('0x7d')&&_0x2f8bb9[_0xcffc('0x4d')]['picklistValues']['length']>0x0?_[_0xcffc('0x38')](_0x2f8bb9['type'][_0xcffc('0x7e')],function(_0xdc276f){return{'name':_0xdc276f[_0xcffc('0x7a')],'value':_0xdc276f[_0xcffc('0x7f')]};}):[]};})};}})[_0xcffc('0x1d')](respondWithResult(_0x4db6bb,null))[_0xcffc('0x25')](function(_0x799509){console[_0xcffc('0x80')](_0xcffc('0x81')+_0x799509);var _0x56034d=_0x178a7c['query'][_0xcffc('0x1a')]?0x1f4:_0x799509[_0xcffc('0x82')]||0x1f4;logger[_0xcffc('0x23')](_0xcffc('0x83'),_0xcffc('0x84'),_0x56034d,JSON[_0xcffc('0x22')](_0x799509));delete _0x799509[_0xcffc('0x35')];if(_0x56034d===0x191){_0x56034d=0x190;}_0x4db6bb['status'](_0x56034d)[_0xcffc('0x36')](_0x178a7c[_0xcffc('0x3d')][_0xcffc('0x1a')]?{'message':_0xcffc('0x85'),'statusCode':_0x799509['statusCode']}:_0x799509);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 0e001e5..99b91d1 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 _0xa9d1=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x9eb64c,_0x5f0b4a){var _0x5128bf=function(_0x328dcd){while(--_0x328dcd){_0x9eb64c['push'](_0x9eb64c['shift']());}};_0x5128bf(++_0x5f0b4a);}(_0xa9d1,0x74));var _0x1a9d=function(_0x5af6f6,_0x563f0e){_0x5af6f6=_0x5af6f6-0x0;var _0x1939bb=_0xa9d1[_0x5af6f6];return _0x1939bb;};'use strict';var _=require(_0x1a9d('0x0'));var util=require(_0x1a9d('0x1'));var logger=require(_0x1a9d('0x2'))(_0x1a9d('0x3'));var moment=require(_0x1a9d('0x4'));var BPromise=require(_0x1a9d('0x5'));var rp=require(_0x1a9d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a9d('0x7'));var attributes=require(_0x1a9d('0x8'));var integrations=require(_0x1a9d('0x9'));module[_0x1a9d('0xa')]=function(_0x2a764e,_0xff906f){return _0x2a764e[_0x1a9d('0xb')](_0x1a9d('0xc'),attributes,{'tableName':_0x1a9d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab53=['../../components/integrations/configuration','define','int_vtiger_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./intVtigerAccount.attributes'];(function(_0x2e2549,_0x3f04da){var _0xf099ff=function(_0x34e06f){while(--_0x34e06f){_0x2e2549['push'](_0x2e2549['shift']());}};_0xf099ff(++_0x3f04da);}(_0xab53,0x193));var _0x3ab5=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xab53[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x3ab5('0x0'));var util=require('util');var logger=require(_0x3ab5('0x1'))('api');var moment=require(_0x3ab5('0x2'));var BPromise=require(_0x3ab5('0x3'));var rp=require(_0x3ab5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ab5('0x5'));var config=require('../../config/environment');var attributes=require(_0x3ab5('0x6'));var integrations=require(_0x3ab5('0x7'));module['exports']=function(_0x217ac8,_0x55a1d3){return _0x217ac8[_0x3ab5('0x8')]('VtigerAccount',attributes,{'tableName':_0x3ab5('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 514b109..6e699f8 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 _0x86f3=['GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','ShowVtigerAccount','find','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x18c50c,_0x14230b){var _0x4a8711=function(_0x3f027d){while(--_0x3f027d){_0x18c50c['push'](_0x18c50c['shift']());}};_0x4a8711(++_0x14230b);}(_0x86f3,0x73));var _0x386f=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x86f3[_0x1c34e7];return _0x378cb1;};'use strict';var _=require(_0x386f('0x0'));var util=require(_0x386f('0x1'));var moment=require(_0x386f('0x2'));var BPromise=require(_0x386f('0x3'));var rs=require(_0x386f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x386f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x386f('0x6'))(_0x386f('0x7'));var config=require(_0x386f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x381f38,_0x251a02,_0x23a773){return new BPromise(function(_0x1dba05,_0x584f94){return client[_0x386f('0x9')](_0x381f38,_0x23a773)[_0x386f('0xa')](function(_0x3d6dfd){logger[_0x386f('0xb')](_0x386f('0xc'),_0x251a02,_0x386f('0xd'));logger[_0x386f('0xe')](_0x386f('0xf'),_0x251a02,_0x386f('0xd'),JSON['stringify'](_0x3d6dfd));if(_0x3d6dfd[_0x386f('0x10')]){if(_0x3d6dfd[_0x386f('0x10')][_0x386f('0x11')]===0x1f4){logger[_0x386f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x251a02,_0x3d6dfd[_0x386f('0x10')]['message']);return _0x584f94(_0x3d6dfd[_0x386f('0x10')][_0x386f('0x12')]);}logger[_0x386f('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x251a02,_0x3d6dfd[_0x386f('0x10')][_0x386f('0x12')]);return _0x1dba05(_0x3d6dfd[_0x386f('0x10')]['message']);}else{logger['info'](_0x386f('0xc'),_0x251a02,_0x386f('0xd'));_0x1dba05(_0x3d6dfd[_0x386f('0x13')]['message']);}})[_0x386f('0x14')](function(_0x5e342e){logger[_0x386f('0x10')](_0x386f('0xc'),_0x251a02,_0x5e342e);_0x584f94(_0x5e342e);});});}exports[_0x386f('0x15')]=function(_0x44bbcd){var _0x204500=this;return new Promise(function(_0x36ba08,_0x34a768){return db[_0x386f('0x16')][_0x386f('0x17')]({'raw':_0x44bbcd['options']?_0x44bbcd[_0x386f('0x18')][_0x386f('0x19')]===undefined?!![]:![]:!![],'where':_0x44bbcd['options']?_0x44bbcd[_0x386f('0x18')][_0x386f('0x1a')]||null:null,'attributes':_0x44bbcd[_0x386f('0x18')]?_0x44bbcd[_0x386f('0x18')][_0x386f('0x1b')]||null:null,'limit':_0x44bbcd[_0x386f('0x18')]?_0x44bbcd[_0x386f('0x18')]['limit']||null:null,'include':_0x44bbcd['options']?_0x44bbcd['options'][_0x386f('0x1c')]?_['map'](_0x44bbcd['options'][_0x386f('0x1c')],function(_0x267f31){return{'model':db[_0x267f31['model']],'as':_0x267f31['as'],'attributes':_0x267f31[_0x386f('0x1b')],'include':_0x267f31['include']?_[_0x386f('0x1d')](_0x267f31[_0x386f('0x1c')],function(_0x48007c){return{'model':db[_0x48007c['model']],'as':_0x48007c['as'],'attributes':_0x48007c[_0x386f('0x1b')],'include':_0x48007c[_0x386f('0x1c')]?_[_0x386f('0x1d')](_0x48007c[_0x386f('0x1c')],function(_0xee56a0){return{'model':db[_0xee56a0[_0x386f('0x1e')]],'as':_0xee56a0['as'],'attributes':_0xee56a0[_0x386f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2951dd){logger[_0x386f('0xb')](_0x386f('0x15'),_0x44bbcd);logger[_0x386f('0xe')](_0x386f('0x15'),_0x44bbcd,JSON['stringify'](_0x2951dd));_0x36ba08(_0x2951dd);})[_0x386f('0x14')](function(_0x107252){logger['error'](_0x386f('0x15'),_0x107252[_0x386f('0x12')],_0x44bbcd);_0x34a768(_0x204500[_0x386f('0x10')](0x1f4,_0x107252[_0x386f('0x12')]));});});};exports[_0x386f('0x1f')]=function(_0x49d47a){var _0x24880d=this;return new Promise(function(_0x48e1a6,_0x17d5f0){return db[_0x386f('0x16')][_0x386f('0x20')]({'raw':_0x49d47a[_0x386f('0x18')]?_0x49d47a['options'][_0x386f('0x19')]===undefined?!![]:![]:!![],'where':_0x49d47a[_0x386f('0x18')]?_0x49d47a[_0x386f('0x18')]['where']||null:null,'attributes':_0x49d47a['options']?_0x49d47a[_0x386f('0x18')][_0x386f('0x1b')]||null:null,'include':_0x49d47a['options']?_0x49d47a[_0x386f('0x18')]['include']?_[_0x386f('0x1d')](_0x49d47a['options'][_0x386f('0x1c')],function(_0x414d86){return{'model':db[_0x414d86[_0x386f('0x1e')]],'as':_0x414d86['as'],'attributes':_0x414d86[_0x386f('0x1b')],'include':_0x414d86[_0x386f('0x1c')]?_[_0x386f('0x1d')](_0x414d86[_0x386f('0x1c')],function(_0x435422){return{'model':db[_0x435422[_0x386f('0x1e')]],'as':_0x435422['as'],'attributes':_0x435422['attributes'],'include':_0x435422[_0x386f('0x1c')]?_['map'](_0x435422['include'],function(_0x2df171){return{'model':db[_0x2df171[_0x386f('0x1e')]],'as':_0x2df171['as'],'attributes':_0x2df171['attributes']};}):[]};}):[]};}):[]:[]})[_0x386f('0xa')](function(_0x56f7ba){logger[_0x386f('0xb')]('ShowVtigerAccount',_0x49d47a);logger[_0x386f('0xe')](_0x386f('0x1f'),_0x49d47a,JSON[_0x386f('0x21')](_0x56f7ba));_0x48e1a6(_0x56f7ba);})[_0x386f('0x14')](function(_0x590c58){logger[_0x386f('0x10')]('ShowVtigerAccount',_0x590c58['message'],_0x49d47a);_0x17d5f0(_0x24880d['error'](0x1f4,_0x590c58[_0x386f('0x12')]));});});}; \ No newline at end of file +var _0xa51b=['map','model','GetVtigerAccount','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x441474,_0x3c518b){var _0x2ce240=function(_0x397ea3){while(--_0x397ea3){_0x441474['push'](_0x441474['shift']());}};_0x2ce240(++_0x3c518b);}(_0xa51b,0x73));var _0xba51=function(_0x3b14e4,_0x277d5c){_0x3b14e4=_0x3b14e4-0x0;var _0x3e8616=_0xa51b[_0x3b14e4];return _0x3e8616;};'use strict';var _=require(_0xba51('0x0'));var util=require(_0xba51('0x1'));var moment=require(_0xba51('0x2'));var BPromise=require(_0xba51('0x3'));var rs=require(_0xba51('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba51('0x5'))['db'];var utils=require(_0xba51('0x6'));var logger=require(_0xba51('0x7'))(_0xba51('0x8'));var config=require(_0xba51('0x9'));var jayson=require(_0xba51('0xa'));var client=jayson[_0xba51('0xb')][_0xba51('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33fc90,_0xd6ef3,_0x249e6e){return new BPromise(function(_0x2d22fa,_0xe6f7c7){return client[_0xba51('0xd')](_0x33fc90,_0x249e6e)[_0xba51('0xe')](function(_0x211677){logger[_0xba51('0xf')](_0xba51('0x10'),_0xd6ef3,'request\x20sent');logger[_0xba51('0x11')](_0xba51('0x12'),_0xd6ef3,'request\x20sent',JSON[_0xba51('0x13')](_0x211677));if(_0x211677['error']){if(_0x211677[_0xba51('0x14')]['code']===0x1f4){logger[_0xba51('0x14')](_0xba51('0x10'),_0xd6ef3,_0x211677[_0xba51('0x14')]['message']);return _0xe6f7c7(_0x211677[_0xba51('0x14')]['message']);}logger[_0xba51('0x14')](_0xba51('0x10'),_0xd6ef3,_0x211677[_0xba51('0x14')][_0xba51('0x15')]);return _0x2d22fa(_0x211677['error'][_0xba51('0x15')]);}else{logger[_0xba51('0xf')](_0xba51('0x10'),_0xd6ef3,_0xba51('0x16'));_0x2d22fa(_0x211677[_0xba51('0x17')]['message']);}})[_0xba51('0x18')](function(_0x525d76){logger[_0xba51('0x14')](_0xba51('0x10'),_0xd6ef3,_0x525d76);_0xe6f7c7(_0x525d76);});});}exports['GetVtigerAccount']=function(_0x4627cb){var _0x2731eb=this;return new Promise(function(_0x15f21a,_0x3aae76){return db[_0xba51('0x19')][_0xba51('0x1a')]({'raw':_0x4627cb[_0xba51('0x1b')]?_0x4627cb[_0xba51('0x1b')][_0xba51('0x1c')]===undefined?!![]:![]:!![],'where':_0x4627cb[_0xba51('0x1b')]?_0x4627cb[_0xba51('0x1b')][_0xba51('0x1d')]||null:null,'attributes':_0x4627cb[_0xba51('0x1b')]?_0x4627cb[_0xba51('0x1b')][_0xba51('0x1e')]||null:null,'limit':_0x4627cb['options']?_0x4627cb[_0xba51('0x1b')][_0xba51('0x1f')]||null:null,'include':_0x4627cb['options']?_0x4627cb[_0xba51('0x1b')][_0xba51('0x20')]?_[_0xba51('0x21')](_0x4627cb[_0xba51('0x1b')][_0xba51('0x20')],function(_0x2b85d3){return{'model':db[_0x2b85d3['model']],'as':_0x2b85d3['as'],'attributes':_0x2b85d3[_0xba51('0x1e')],'include':_0x2b85d3[_0xba51('0x20')]?_[_0xba51('0x21')](_0x2b85d3[_0xba51('0x20')],function(_0x264668){return{'model':db[_0x264668[_0xba51('0x22')]],'as':_0x264668['as'],'attributes':_0x264668[_0xba51('0x1e')],'include':_0x264668[_0xba51('0x20')]?_[_0xba51('0x21')](_0x264668[_0xba51('0x20')],function(_0x1af57d){return{'model':db[_0x1af57d[_0xba51('0x22')]],'as':_0x1af57d['as'],'attributes':_0x1af57d[_0xba51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xba51('0xe')](function(_0x114a15){logger[_0xba51('0xf')](_0xba51('0x23'),_0x4627cb);logger[_0xba51('0x11')](_0xba51('0x23'),_0x4627cb,JSON['stringify'](_0x114a15));_0x15f21a(_0x114a15);})[_0xba51('0x18')](function(_0x341293){logger[_0xba51('0x14')](_0xba51('0x23'),_0x341293[_0xba51('0x15')],_0x4627cb);_0x3aae76(_0x2731eb[_0xba51('0x14')](0x1f4,_0x341293[_0xba51('0x15')]));});});};exports[_0xba51('0x24')]=function(_0x48bd58){var _0x4c10be=this;return new Promise(function(_0x2df366,_0x521c3c){return db[_0xba51('0x19')]['find']({'raw':_0x48bd58['options']?_0x48bd58['options'][_0xba51('0x1c')]===undefined?!![]:![]:!![],'where':_0x48bd58[_0xba51('0x1b')]?_0x48bd58[_0xba51('0x1b')][_0xba51('0x1d')]||null:null,'attributes':_0x48bd58[_0xba51('0x1b')]?_0x48bd58[_0xba51('0x1b')][_0xba51('0x1e')]||null:null,'include':_0x48bd58[_0xba51('0x1b')]?_0x48bd58[_0xba51('0x1b')][_0xba51('0x20')]?_[_0xba51('0x21')](_0x48bd58['options'][_0xba51('0x20')],function(_0x3ce27c){return{'model':db[_0x3ce27c[_0xba51('0x22')]],'as':_0x3ce27c['as'],'attributes':_0x3ce27c[_0xba51('0x1e')],'include':_0x3ce27c[_0xba51('0x20')]?_['map'](_0x3ce27c['include'],function(_0x364b9a){return{'model':db[_0x364b9a['model']],'as':_0x364b9a['as'],'attributes':_0x364b9a['attributes'],'include':_0x364b9a['include']?_[_0xba51('0x21')](_0x364b9a[_0xba51('0x20')],function(_0xdc787e){return{'model':db[_0xdc787e[_0xba51('0x22')]],'as':_0xdc787e['as'],'attributes':_0xdc787e[_0xba51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xba51('0xe')](function(_0x354e08){logger[_0xba51('0xf')]('ShowVtigerAccount',_0x48bd58);logger[_0xba51('0x11')](_0xba51('0x24'),_0x48bd58,JSON[_0xba51('0x13')](_0x354e08));_0x2df366(_0x354e08);})[_0xba51('0x18')](function(_0x1765ab){logger[_0xba51('0x14')](_0xba51('0x24'),_0x1765ab[_0xba51('0x15')],_0x48bd58);_0x521c3c(_0x4c10be[_0xba51('0x14')](0x1f4,_0x1765ab[_0xba51('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 4d5ee52..01fab0d 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x5ce2ba,_0x52efc4){var _0xf26586=function(_0x58cba3){while(--_0x58cba3){_0x5ce2ba['push'](_0x5ce2ba['shift']());}};_0xf26586(++_0x52efc4);}(_0xb10b,0x12a));var _0xbb10=function(_0x536380,_0x3f79d5){_0x536380=_0x536380-0x0;var _0xd2229d=_0xb10b[_0x536380];return _0xd2229d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x450eee,_0xda8c7a){var _0x45f228=function(_0x385ebb){while(--_0x385ebb){_0x450eee['push'](_0x450eee['shift']());}};_0x45f228(++_0xda8c7a);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c3281,_0x5c69a0){_0x1c3281=_0x1c3281-0x0;var _0x27588d=_0xb10b[_0x1c3281];return _0x27588d;};'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 362ca22..cc52a0f 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 _0xaa56=['STRING','sequelize','exports'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xaa56,0x1b4));var _0x6aa5=function(_0x7fe39b,_0x372720){_0x7fe39b=_0x7fe39b-0x0;var _0x227ad9=_0xaa56[_0x7fe39b];return _0x227ad9;};'use strict';var Sequelize=require(_0x6aa5('0x0'));module[_0x6aa5('0x1')]={'name':{'type':Sequelize[_0x6aa5('0x2')]},'description':{'type':Sequelize[_0x6aa5('0x2')]}}; \ No newline at end of file +var _0x1169=['sequelize','exports','STRING'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x1169,0x9c));var _0x9116=function(_0x45ef67,_0x5294c6){_0x45ef67=_0x45ef67-0x0;var _0x4ade37=_0x1169[_0x45ef67];return _0x4ade37;};'use strict';var Sequelize=require(_0x9116('0x0'));module[_0x9116('0x1')]={'name':{'type':Sequelize[_0x9116('0x2')]},'description':{'type':Sequelize[_0x9116('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7b09e22..14e3177 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 _0x32f0=['http','test','Sequelize','ValidationError','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','limit','set','json','apply','reject','update','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getFields','findOne','getSubjects','VtigerField','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x23c9f1,_0x67ad6f){var _0x59434f=function(_0x5a3bcb){while(--_0x5a3bcb){_0x23c9f1['push'](_0x23c9f1['shift']());}};_0x59434f(++_0x67ad6f);}(_0x32f0,0x1ab));var _0x032f=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x32f0[_0xbb9dbf];return _0x30223c;};'use strict';var pdf=require(_0x032f('0x0'));var emlformat=require(_0x032f('0x1'));var rimraf=require(_0x032f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x032f('0x3'));var rp=require(_0x032f('0x4'));var moment=require('moment');var BPromise=require(_0x032f('0x5'));var Mustache=require(_0x032f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x032f('0x7'));var csv=require(_0x032f('0x8'));var ejs=require(_0x032f('0x9'));var fs=require('fs');var _=require(_0x032f('0xa'));var squel=require(_0x032f('0xb'));var crypto=require('crypto');var jsforce=require(_0x032f('0xc'));var deskjs=require(_0x032f('0xd'));var toCsv=require(_0x032f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x032f('0xe'));var authService=require(_0x032f('0xf'));var qs=require(_0x032f('0x10'));var as=require(_0x032f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x032f('0x12'));var utils=require(_0x032f('0x13'));var config=require(_0x032f('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x032f('0x15'));var client=jayson[_0x032f('0x16')][_0x032f('0x17')]({'port':0x232a});function checkPasswordPattern(_0x175dff,_0x3efcdd,_0x401438){if(_0x401438){var _0x1f7270=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f7270[_0x032f('0x18')](_0x3efcdd)){return _0x175dff;}else{throw new db[(_0x032f('0x19'))][(_0x032f('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 _0x175dff;}}function respondWithRpcPromise(_0x1afdd,_0x4d94a0,_0x406e73,_0x2afa83){return new BPromise(function(_0x40882e,_0x1c7c05){var _0x24551f=_0x2afa83||client;return _0x24551f[_0x032f('0x1b')](_0x1afdd,_0x406e73)[_0x032f('0x1c')](function(_0x552b46){logger[_0x032f('0x1d')](_0x032f('0x1e'),_0x4d94a0,_0x032f('0x1f'));logger[_0x032f('0x20')](_0x032f('0x21'),_0x4d94a0,_0x032f('0x1f'),JSON[_0x032f('0x22')](_0x552b46));if(_0x552b46[_0x032f('0x23')]){if(_0x552b46['error'][_0x032f('0x24')]===0x1f4){logger[_0x032f('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x4d94a0,_0x552b46[_0x032f('0x23')]['message']);return _0x1c7c05(_0x552b46[_0x032f('0x23')][_0x032f('0x25')]);}logger[_0x032f('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x4d94a0,_0x552b46['error'][_0x032f('0x25')]);return _0x40882e(_0x552b46['error'][_0x032f('0x25')]);}else{logger[_0x032f('0x1d')]('VtigerConfiguration,\x20%s,\x20%s',_0x4d94a0,_0x032f('0x1f'));_0x40882e(_0x552b46[_0x032f('0x26')]['message']);}})['catch'](function(_0x228844){logger[_0x032f('0x23')](_0x032f('0x1e'),_0x4d94a0,_0x228844);_0x1c7c05(_0x228844);});});}function respondWithStatusCode(_0xd58ad9,_0x30bbe3){_0x30bbe3=_0x30bbe3||0xcc;return function(_0x250cc8){if(_0x250cc8){return _0xd58ad9[_0x032f('0x27')](_0x30bbe3);}return _0xd58ad9[_0x032f('0x28')](_0x30bbe3)[_0x032f('0x29')]();};}function respondWithResult(_0x3a0ad1,_0x10f8c3){_0x10f8c3=_0x10f8c3||0xc8;return function(_0x45096d){if(_0x45096d){return _0x3a0ad1[_0x032f('0x28')](_0x10f8c3)['json'](_0x45096d);}};}function respondWithFilteredResult(_0x575897,_0x25a5b6){return function(_0xd00e27){if(_0xd00e27){var _0x283e74=_0xd00e27['count'],_0x451e4f=_0x25a5b6[_0x032f('0x2a')],_0x52ecf6=_0x25a5b6['offset']+_0x25a5b6[_0x032f('0x2b')],_0x521d22;if(_0x52ecf6>=_0x283e74){_0x52ecf6=_0x283e74;_0x521d22=0xc8;}else{_0x521d22=0xce;}_0x575897[_0x032f('0x28')](_0x521d22);return _0x575897[_0x032f('0x2c')]('Content-Range',_0x451e4f+'-'+_0x52ecf6+'/'+_0x283e74)[_0x032f('0x2d')](_0xd00e27);}return null;};}function patchUpdates(_0x5eb553){return function(_0x2b8d5c){try{jsonpatch[_0x032f('0x2e')](_0x2b8d5c,_0x5eb553,!![]);}catch(_0x49f94c){return BPromise[_0x032f('0x2f')](_0x49f94c);}return _0x2b8d5c['save']();};}function saveUpdates(_0x251f79,_0x249ab6){return function(_0x51f788){if(_0x51f788){return _0x51f788[_0x032f('0x30')](_0x251f79)[_0x032f('0x1c')](function(_0x5198af){return _0x5198af;});}return null;};}function removeEntity(_0x588293,_0x4ddab5){return function(_0x389a6d){if(_0x389a6d){return _0x389a6d['destroy']()['then'](function(){_0x588293[_0x032f('0x28')](0xcc)[_0x032f('0x29')]();});}};}function handleEntityNotFound(_0x7045b8,_0x3e694b){return function(_0x55b3a2){if(!_0x55b3a2){_0x7045b8['sendStatus'](0x194);}return _0x55b3a2;};}function handleError(_0x2beb8f,_0x5cd2dc){_0x5cd2dc=_0x5cd2dc||0x1f4;return function(_0x57f9e1){logger[_0x032f('0x23')](_0x57f9e1[_0x032f('0x31')]);if(_0x57f9e1[_0x032f('0x32')]){delete _0x57f9e1[_0x032f('0x32')];}_0x2beb8f[_0x032f('0x28')](_0x5cd2dc)['send'](_0x57f9e1);};}exports[_0x032f('0x33')]=function(_0xb20ed,_0x188fa0){var _0x1d89ae={},_0x492088={},_0x31476c={'count':0x0,'rows':[]};var _0x5070fe=_[_0x032f('0x34')](db[_0x032f('0x35')][_0x032f('0x36')],function(_0x59aef1){return{'name':_0x59aef1[_0x032f('0x37')],'type':_0x59aef1['type']['key']};});_0x492088[_0x032f('0x38')]=_[_0x032f('0x34')](_0x5070fe,'name');_0x492088[_0x032f('0x39')]=_[_0x032f('0x3a')](_0xb20ed['query']);_0x492088['filters']=_['intersection'](_0x492088[_0x032f('0x38')],_0x492088[_0x032f('0x39')]);_0x1d89ae[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x492088[_0x032f('0x38')],qs[_0x032f('0x3d')](_0xb20ed['query'][_0x032f('0x3d')]));_0x1d89ae['attributes']=_0x1d89ae[_0x032f('0x3b')][_0x032f('0x3e')]?_0x1d89ae[_0x032f('0x3b')]:_0x492088[_0x032f('0x38')];if(!_0xb20ed['query'][_0x032f('0x3f')](_0x032f('0x40'))){_0x1d89ae[_0x032f('0x2b')]=qs['limit'](_0xb20ed[_0x032f('0x39')][_0x032f('0x2b')]);_0x1d89ae[_0x032f('0x2a')]=qs['offset'](_0xb20ed[_0x032f('0x39')]['offset']);}_0x1d89ae[_0x032f('0x41')]=qs[_0x032f('0x42')](_0xb20ed[_0x032f('0x39')]['sort']);_0x1d89ae[_0x032f('0x43')]=qs['filters'](_[_0x032f('0x44')](_0xb20ed['query'],_0x492088[_0x032f('0x45')]),_0x5070fe);if(_0xb20ed[_0x032f('0x39')][_0x032f('0x46')]){_0x1d89ae[_0x032f('0x43')]=_[_0x032f('0x47')](_0x1d89ae[_0x032f('0x43')],{'$or':_['map'](_0x5070fe,function(_0x5bd417){if(_0x5bd417['type']!=='VIRTUAL'){var _0x3ef179={};_0x3ef179[_0x5bd417[_0x032f('0x32')]]={'$like':'%'+_0xb20ed[_0x032f('0x39')][_0x032f('0x46')]+'%'};return _0x3ef179;}})});}_0x1d89ae=_['merge']({},_0x1d89ae,_0xb20ed[_0x032f('0x48')]);var _0x5a5e08={'where':_0x1d89ae[_0x032f('0x43')]};return db[_0x032f('0x35')]['count'](_0x5a5e08)[_0x032f('0x1c')](function(_0xb12d1b){_0x31476c[_0x032f('0x49')]=_0xb12d1b;if(_0xb20ed[_0x032f('0x39')][_0x032f('0x4a')]){_0x1d89ae[_0x032f('0x4b')]=[{'all':!![]}];}return db[_0x032f('0x35')][_0x032f('0x4c')](_0x1d89ae);})[_0x032f('0x1c')](function(_0x314d1b){_0x31476c[_0x032f('0x4d')]=_0x314d1b;return _0x31476c;})['then'](respondWithFilteredResult(_0x188fa0,_0x1d89ae))[_0x032f('0x4e')](handleError(_0x188fa0,null));};exports[_0x032f('0x4f')]=function(_0x34ef18,_0x34570d){var _0x260b22={'raw':![],'where':{'id':_0x34ef18[_0x032f('0x50')]['id']}},_0x18b740={};_0x18b740['model']=_[_0x032f('0x3a')](db[_0x032f('0x35')][_0x032f('0x36')]);_0x18b740[_0x032f('0x39')]=_[_0x032f('0x3a')](_0x34ef18[_0x032f('0x39')]);_0x18b740[_0x032f('0x45')]=_[_0x032f('0x3c')](_0x18b740['model'],_0x18b740[_0x032f('0x39')]);_0x260b22[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x18b740[_0x032f('0x38')],qs[_0x032f('0x3d')](_0x34ef18[_0x032f('0x39')][_0x032f('0x3d')]));_0x260b22['attributes']=_0x260b22['attributes']['length']?_0x260b22['attributes']:_0x18b740[_0x032f('0x38')];if(_0x34ef18[_0x032f('0x39')][_0x032f('0x4a')]){_0x260b22[_0x032f('0x4b')]=[{'all':!![]}];}_0x260b22=_[_0x032f('0x47')]({},_0x260b22,_0x34ef18[_0x032f('0x48')]);return db['VtigerConfiguration'][_0x032f('0x51')](_0x260b22)[_0x032f('0x1c')](handleEntityNotFound(_0x34570d,null))[_0x032f('0x1c')](respondWithResult(_0x34570d,null))[_0x032f('0x4e')](handleError(_0x34570d,null));};exports[_0x032f('0x52')]=function(_0x5480b2,_0x45aa74){return db[_0x032f('0x35')][_0x032f('0x52')](_0x5480b2['body'],{})[_0x032f('0x1c')](respondWithResult(_0x45aa74,0xc9))[_0x032f('0x4e')](handleError(_0x45aa74,null));};exports[_0x032f('0x30')]=function(_0x3263fa,_0x53f736){if(_0x3263fa[_0x032f('0x53')]['id']){delete _0x3263fa['body']['id'];}return db[_0x032f('0x35')][_0x032f('0x51')]({'where':{'id':_0x3263fa[_0x032f('0x50')]['id']}})[_0x032f('0x1c')](handleEntityNotFound(_0x53f736,null))[_0x032f('0x1c')](saveUpdates(_0x3263fa[_0x032f('0x53')],null))[_0x032f('0x1c')](respondWithResult(_0x53f736,null))[_0x032f('0x4e')](handleError(_0x53f736,null));};exports[_0x032f('0x54')]=function(_0x201c86,_0xc57f88){return db[_0x032f('0x35')]['find']({'where':{'id':_0x201c86[_0x032f('0x50')]['id']}})[_0x032f('0x1c')](handleEntityNotFound(_0xc57f88,null))[_0x032f('0x1c')](removeEntity(_0xc57f88,null))['catch'](handleError(_0xc57f88,null));};exports[_0x032f('0x55')]=function(_0x24d608,_0x155c59,_0x2177c9){var _0x5a0708={};var _0x1b567f={};var _0x5333bc;var _0x29fba3;return db['VtigerConfiguration'][_0x032f('0x56')]({'where':{'id':_0x24d608['params']['id']}})['then'](handleEntityNotFound(_0x155c59,null))[_0x032f('0x1c')](function(_0x5793f2){if(_0x5793f2){_0x5333bc=_0x5793f2;_0x1b567f[_0x032f('0x38')]=_[_0x032f('0x3a')](db['VtigerField'][_0x032f('0x36')]);_0x1b567f[_0x032f('0x39')]=_[_0x032f('0x3a')](_0x24d608[_0x032f('0x39')]);_0x1b567f['filters']=_['intersection'](_0x1b567f['model'],_0x1b567f[_0x032f('0x39')]);_0x5a0708[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x1b567f[_0x032f('0x38')],qs['fields'](_0x24d608[_0x032f('0x39')][_0x032f('0x3d')]));_0x5a0708[_0x032f('0x3b')]=_0x5a0708[_0x032f('0x3b')][_0x032f('0x3e')]?_0x5a0708[_0x032f('0x3b')]:_0x1b567f[_0x032f('0x38')];_0x5a0708['order']=qs[_0x032f('0x42')](_0x24d608['query'][_0x032f('0x42')]);_0x5a0708['where']=qs['filters'](_[_0x032f('0x44')](_0x24d608[_0x032f('0x39')],_0x1b567f[_0x032f('0x45')]));if(_0x24d608['query']['filter']){_0x5a0708[_0x032f('0x43')]=_['merge'](_0x5a0708[_0x032f('0x43')],{'$or':_['map'](_0x5a0708[_0x032f('0x3b')],function(_0x2fd666){var _0x5c7729={};_0x5c7729[_0x2fd666]={'$like':'%'+_0x24d608[_0x032f('0x39')][_0x032f('0x46')]+'%'};return _0x5c7729;})});}_0x5a0708=_[_0x032f('0x47')]({},_0x5a0708,_0x24d608[_0x032f('0x48')]);return _0x5333bc[_0x032f('0x55')](_0x5a0708);}})[_0x032f('0x1c')](function(_0xeac93a){if(_0xeac93a){_0x29fba3=_0xeac93a[_0x032f('0x3e')];if(!_0x24d608['query']['hasOwnProperty']('nolimit')){_0x5a0708[_0x032f('0x2b')]=qs['limit'](_0x24d608['query']['limit']);_0x5a0708[_0x032f('0x2a')]=qs[_0x032f('0x2a')](_0x24d608[_0x032f('0x39')]['offset']);}return _0x5333bc[_0x032f('0x55')](_0x5a0708);}})[_0x032f('0x1c')](function(_0x35fee7){if(_0x35fee7){return _0x35fee7?{'count':_0x29fba3,'rows':_0x35fee7}:null;}})[_0x032f('0x1c')](respondWithResult(_0x155c59,null))[_0x032f('0x4e')](handleError(_0x155c59,null));};exports[_0x032f('0x57')]=function(_0x17c45a,_0x172957,_0x4a31c5){var _0x45cdd4={};var _0x1b9345={};var _0x27f8f0;var _0x4603d1;return db[_0x032f('0x35')][_0x032f('0x56')]({'where':{'id':_0x17c45a[_0x032f('0x50')]['id']}})[_0x032f('0x1c')](handleEntityNotFound(_0x172957,null))[_0x032f('0x1c')](function(_0x1fdd5b){if(_0x1fdd5b){_0x27f8f0=_0x1fdd5b;_0x1b9345['model']=_[_0x032f('0x3a')](db[_0x032f('0x58')][_0x032f('0x36')]);_0x1b9345[_0x032f('0x39')]=_[_0x032f('0x3a')](_0x17c45a[_0x032f('0x39')]);_0x1b9345['filters']=_['intersection'](_0x1b9345[_0x032f('0x38')],_0x1b9345[_0x032f('0x39')]);_0x45cdd4[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x1b9345['model'],qs[_0x032f('0x3d')](_0x17c45a['query'][_0x032f('0x3d')]));_0x45cdd4[_0x032f('0x3b')]=_0x45cdd4['attributes'][_0x032f('0x3e')]?_0x45cdd4[_0x032f('0x3b')]:_0x1b9345['model'];_0x45cdd4[_0x032f('0x41')]=qs['sort'](_0x17c45a[_0x032f('0x39')][_0x032f('0x42')]);_0x45cdd4[_0x032f('0x43')]=qs[_0x032f('0x45')](_[_0x032f('0x44')](_0x17c45a['query'],_0x1b9345[_0x032f('0x45')]));if(_0x17c45a[_0x032f('0x39')][_0x032f('0x46')]){_0x45cdd4[_0x032f('0x43')]=_[_0x032f('0x47')](_0x45cdd4[_0x032f('0x43')],{'$or':_[_0x032f('0x34')](_0x45cdd4[_0x032f('0x3b')],function(_0xd5725){var _0x1ecd47={};_0x1ecd47[_0xd5725]={'$like':'%'+_0x17c45a[_0x032f('0x39')][_0x032f('0x46')]+'%'};return _0x1ecd47;})});}_0x45cdd4=_['merge']({},_0x45cdd4,_0x17c45a['options']);return _0x27f8f0[_0x032f('0x57')](_0x45cdd4);}})[_0x032f('0x1c')](function(_0xd9dcdd){if(_0xd9dcdd){_0x4603d1=_0xd9dcdd[_0x032f('0x3e')];if(!_0x17c45a['query'][_0x032f('0x3f')](_0x032f('0x40'))){_0x45cdd4[_0x032f('0x2b')]=qs[_0x032f('0x2b')](_0x17c45a[_0x032f('0x39')][_0x032f('0x2b')]);_0x45cdd4['offset']=qs[_0x032f('0x2a')](_0x17c45a[_0x032f('0x39')][_0x032f('0x2a')]);}return _0x27f8f0['getSubjects'](_0x45cdd4);}})[_0x032f('0x1c')](function(_0x458525){if(_0x458525){return _0x458525?{'count':_0x4603d1,'rows':_0x458525}:null;}})[_0x032f('0x1c')](respondWithResult(_0x172957,null))[_0x032f('0x4e')](handleError(_0x172957,null));};exports[_0x032f('0x59')]=function(_0x17401f,_0x27d07e,_0xc88b05){var _0x4c7b21={};var _0x3fb900={};var _0x365744;var _0x2a999d;return db[_0x032f('0x35')][_0x032f('0x56')]({'where':{'id':_0x17401f['params']['id']}})[_0x032f('0x1c')](handleEntityNotFound(_0x27d07e,null))[_0x032f('0x1c')](function(_0x52dfe6){if(_0x52dfe6){_0x365744=_0x52dfe6;_0x3fb900[_0x032f('0x38')]=_[_0x032f('0x3a')](db[_0x032f('0x58')][_0x032f('0x36')]);_0x3fb900[_0x032f('0x39')]=_['keys'](_0x17401f[_0x032f('0x39')]);_0x3fb900['filters']=_[_0x032f('0x3c')](_0x3fb900[_0x032f('0x38')],_0x3fb900['query']);_0x4c7b21[_0x032f('0x3b')]=_[_0x032f('0x3c')](_0x3fb900[_0x032f('0x38')],qs[_0x032f('0x3d')](_0x17401f[_0x032f('0x39')][_0x032f('0x3d')]));_0x4c7b21[_0x032f('0x3b')]=_0x4c7b21['attributes'][_0x032f('0x3e')]?_0x4c7b21[_0x032f('0x3b')]:_0x3fb900[_0x032f('0x38')];_0x4c7b21[_0x032f('0x41')]=qs['sort'](_0x17401f['query'][_0x032f('0x42')]);_0x4c7b21[_0x032f('0x43')]=qs['filters'](_[_0x032f('0x44')](_0x17401f['query'],_0x3fb900[_0x032f('0x45')]));if(_0x17401f[_0x032f('0x39')][_0x032f('0x46')]){_0x4c7b21[_0x032f('0x43')]=_[_0x032f('0x47')](_0x4c7b21[_0x032f('0x43')],{'$or':_['map'](_0x4c7b21[_0x032f('0x3b')],function(_0x184293){var _0x42f87a={};_0x42f87a[_0x184293]={'$like':'%'+_0x17401f[_0x032f('0x39')][_0x032f('0x46')]+'%'};return _0x42f87a;})});}_0x4c7b21=_['merge']({},_0x4c7b21,_0x17401f[_0x032f('0x48')]);return _0x365744[_0x032f('0x59')](_0x4c7b21);}})['then'](function(_0x440965){if(_0x440965){_0x2a999d=_0x440965[_0x032f('0x3e')];if(!_0x17401f['query'][_0x032f('0x3f')](_0x032f('0x40'))){_0x4c7b21['limit']=qs[_0x032f('0x2b')](_0x17401f['query']['limit']);_0x4c7b21[_0x032f('0x2a')]=qs['offset'](_0x17401f[_0x032f('0x39')][_0x032f('0x2a')]);}return _0x365744['getDescriptions'](_0x4c7b21);}})['then'](function(_0x377183){if(_0x377183){return _0x377183?{'count':_0x2a999d,'rows':_0x377183}:null;}})[_0x032f('0x1c')](respondWithResult(_0x27d07e,null))['catch'](handleError(_0x27d07e,null));}; \ No newline at end of file +var _0x4760=['jayson/promise','client','http','test','Sequelize','ValidationError','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','end','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','pick','filter','merge','where','type','options','count','includeAll','findAll','rows','catch','show','length','create','body','update','find','params','destroy','findOne','VtigerField','order','sort','getFields','nolimit','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x2fba7d,_0x33ffa0){var _0x4e60a3=function(_0x421b35){while(--_0x421b35){_0x2fba7d['push'](_0x2fba7d['shift']());}};_0x4e60a3(++_0x33ffa0);}(_0x4760,0x1b4));var _0x0476=function(_0x3070d5,_0x1e44e8){_0x3070d5=_0x3070d5-0x0;var _0x23521a=_0x4760[_0x3070d5];return _0x23521a;};'use strict';var pdf=require(_0x0476('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0476('0x1'));var zipdir=require(_0x0476('0x2'));var jsonpatch=require(_0x0476('0x3'));var rp=require(_0x0476('0x4'));var moment=require(_0x0476('0x5'));var BPromise=require(_0x0476('0x6'));var Mustache=require('mustache');var util=require(_0x0476('0x7'));var path=require(_0x0476('0x8'));var sox=require(_0x0476('0x9'));var csv=require(_0x0476('0xa'));var ejs=require(_0x0476('0xb'));var fs=require('fs');var _=require(_0x0476('0xc'));var squel=require(_0x0476('0xd'));var crypto=require(_0x0476('0xe'));var jsforce=require(_0x0476('0xf'));var deskjs=require(_0x0476('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0476('0x11'));var qs=require(_0x0476('0x12'));var as=require(_0x0476('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0476('0x14'))(_0x0476('0x15'));var utils=require('../../config/utils');var config=require(_0x0476('0x16'));var db=require(_0x0476('0x17'))['db'];var jayson=require(_0x0476('0x18'));var client=jayson[_0x0476('0x19')][_0x0476('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2afd62,_0x5568c8,_0x3013f5){if(_0x3013f5){var _0x32933b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32933b[_0x0476('0x1b')](_0x5568c8)){return _0x2afd62;}else{throw new db[(_0x0476('0x1c'))][(_0x0476('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2afd62;}}function respondWithRpcPromise(_0x121469,_0x3fc829,_0x82564c,_0x17c0d1){return new BPromise(function(_0x4646e6,_0x3c5dbe){var _0x1d860f=_0x17c0d1||client;return _0x1d860f['request'](_0x121469,_0x82564c)[_0x0476('0x1e')](function(_0x294e4d){logger[_0x0476('0x1f')](_0x0476('0x20'),_0x3fc829,_0x0476('0x21'));logger['debug'](_0x0476('0x22'),_0x3fc829,_0x0476('0x21'),JSON[_0x0476('0x23')](_0x294e4d));if(_0x294e4d[_0x0476('0x24')]){if(_0x294e4d[_0x0476('0x24')]['code']===0x1f4){logger[_0x0476('0x24')](_0x0476('0x20'),_0x3fc829,_0x294e4d[_0x0476('0x24')][_0x0476('0x25')]);return _0x3c5dbe(_0x294e4d[_0x0476('0x24')][_0x0476('0x25')]);}logger[_0x0476('0x24')](_0x0476('0x20'),_0x3fc829,_0x294e4d['error']['message']);return _0x4646e6(_0x294e4d['error'][_0x0476('0x25')]);}else{logger[_0x0476('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x3fc829,_0x0476('0x21'));_0x4646e6(_0x294e4d[_0x0476('0x26')]['message']);}})['catch'](function(_0x1e4dc7){logger['error'](_0x0476('0x20'),_0x3fc829,_0x1e4dc7);_0x3c5dbe(_0x1e4dc7);});});}function respondWithStatusCode(_0x1d93c6,_0x21653e){_0x21653e=_0x21653e||0xcc;return function(_0x192d27){if(_0x192d27){return _0x1d93c6[_0x0476('0x27')](_0x21653e);}return _0x1d93c6['status'](_0x21653e)['end']();};}function respondWithResult(_0x43be2e,_0x160612){_0x160612=_0x160612||0xc8;return function(_0x27ef0){if(_0x27ef0){return _0x43be2e['status'](_0x160612)[_0x0476('0x28')](_0x27ef0);}};}function respondWithFilteredResult(_0x2b7a40,_0x18e92c){return function(_0x56519d){if(_0x56519d){var _0xf7d72f=_0x56519d['count'],_0x365531=_0x18e92c[_0x0476('0x29')],_0x5833d6=_0x18e92c[_0x0476('0x29')]+_0x18e92c[_0x0476('0x2a')],_0x3fb8e5;if(_0x5833d6>=_0xf7d72f){_0x5833d6=_0xf7d72f;_0x3fb8e5=0xc8;}else{_0x3fb8e5=0xce;}_0x2b7a40[_0x0476('0x2b')](_0x3fb8e5);return _0x2b7a40[_0x0476('0x2c')](_0x0476('0x2d'),_0x365531+'-'+_0x5833d6+'/'+_0xf7d72f)[_0x0476('0x28')](_0x56519d);}return null;};}function patchUpdates(_0x27dbc8){return function(_0x493215){try{jsonpatch[_0x0476('0x2e')](_0x493215,_0x27dbc8,!![]);}catch(_0x292b88){return BPromise[_0x0476('0x2f')](_0x292b88);}return _0x493215['save']();};}function saveUpdates(_0x252028,_0x217f4d){return function(_0x316512){if(_0x316512){return _0x316512['update'](_0x252028)[_0x0476('0x1e')](function(_0x16003b){return _0x16003b;});}return null;};}function removeEntity(_0xfd9cc1,_0x476103){return function(_0x52f33a){if(_0x52f33a){return _0x52f33a['destroy']()[_0x0476('0x1e')](function(){_0xfd9cc1['status'](0xcc)[_0x0476('0x30')]();});}};}function handleEntityNotFound(_0x5ce731,_0x4e5d45){return function(_0x141c37){if(!_0x141c37){_0x5ce731[_0x0476('0x27')](0x194);}return _0x141c37;};}function handleError(_0x576a7f,_0x3f4058){_0x3f4058=_0x3f4058||0x1f4;return function(_0x5aad38){logger[_0x0476('0x24')](_0x5aad38[_0x0476('0x31')]);if(_0x5aad38[_0x0476('0x32')]){delete _0x5aad38[_0x0476('0x32')];}_0x576a7f['status'](_0x3f4058)[_0x0476('0x33')](_0x5aad38);};}exports['index']=function(_0x3288b7,_0x1e91dc){var _0x3cca13={},_0x2eb9c4={},_0x2d920e={'count':0x0,'rows':[]};var _0xd74123=_[_0x0476('0x34')](db[_0x0476('0x35')][_0x0476('0x36')],function(_0x292677){return{'name':_0x292677[_0x0476('0x37')],'type':_0x292677['type'][_0x0476('0x38')]};});_0x2eb9c4['model']=_[_0x0476('0x34')](_0xd74123,_0x0476('0x32'));_0x2eb9c4[_0x0476('0x39')]=_[_0x0476('0x3a')](_0x3288b7[_0x0476('0x39')]);_0x2eb9c4[_0x0476('0x3b')]=_[_0x0476('0x3c')](_0x2eb9c4[_0x0476('0x3d')],_0x2eb9c4[_0x0476('0x39')]);_0x3cca13[_0x0476('0x3e')]=_[_0x0476('0x3c')](_0x2eb9c4['model'],qs[_0x0476('0x3f')](_0x3288b7[_0x0476('0x39')][_0x0476('0x3f')]));_0x3cca13[_0x0476('0x3e')]=_0x3cca13[_0x0476('0x3e')]['length']?_0x3cca13[_0x0476('0x3e')]:_0x2eb9c4['model'];if(!_0x3288b7[_0x0476('0x39')][_0x0476('0x40')]('nolimit')){_0x3cca13[_0x0476('0x2a')]=qs[_0x0476('0x2a')](_0x3288b7[_0x0476('0x39')][_0x0476('0x2a')]);_0x3cca13[_0x0476('0x29')]=qs['offset'](_0x3288b7[_0x0476('0x39')]['offset']);}_0x3cca13['order']=qs['sort'](_0x3288b7[_0x0476('0x39')]['sort']);_0x3cca13['where']=qs[_0x0476('0x3b')](_[_0x0476('0x41')](_0x3288b7[_0x0476('0x39')],_0x2eb9c4[_0x0476('0x3b')]),_0xd74123);if(_0x3288b7[_0x0476('0x39')][_0x0476('0x42')]){_0x3cca13['where']=_[_0x0476('0x43')](_0x3cca13[_0x0476('0x44')],{'$or':_[_0x0476('0x34')](_0xd74123,function(_0x129c40){if(_0x129c40[_0x0476('0x45')]!=='VIRTUAL'){var _0x52c9bb={};_0x52c9bb[_0x129c40[_0x0476('0x32')]]={'$like':'%'+_0x3288b7['query']['filter']+'%'};return _0x52c9bb;}})});}_0x3cca13=_[_0x0476('0x43')]({},_0x3cca13,_0x3288b7[_0x0476('0x46')]);var _0x455623={'where':_0x3cca13[_0x0476('0x44')]};return db[_0x0476('0x35')][_0x0476('0x47')](_0x455623)[_0x0476('0x1e')](function(_0x4e119e){_0x2d920e[_0x0476('0x47')]=_0x4e119e;if(_0x3288b7[_0x0476('0x39')][_0x0476('0x48')]){_0x3cca13['include']=[{'all':!![]}];}return db[_0x0476('0x35')][_0x0476('0x49')](_0x3cca13);})[_0x0476('0x1e')](function(_0x5efbf7){_0x2d920e[_0x0476('0x4a')]=_0x5efbf7;return _0x2d920e;})['then'](respondWithFilteredResult(_0x1e91dc,_0x3cca13))[_0x0476('0x4b')](handleError(_0x1e91dc,null));};exports[_0x0476('0x4c')]=function(_0xa53399,_0x433eff){var _0x177224={'raw':![],'where':{'id':_0xa53399['params']['id']}},_0x31d68e={};_0x31d68e[_0x0476('0x3d')]=_['keys'](db[_0x0476('0x35')][_0x0476('0x36')]);_0x31d68e[_0x0476('0x39')]=_[_0x0476('0x3a')](_0xa53399[_0x0476('0x39')]);_0x31d68e[_0x0476('0x3b')]=_[_0x0476('0x3c')](_0x31d68e[_0x0476('0x3d')],_0x31d68e[_0x0476('0x39')]);_0x177224[_0x0476('0x3e')]=_[_0x0476('0x3c')](_0x31d68e[_0x0476('0x3d')],qs[_0x0476('0x3f')](_0xa53399[_0x0476('0x39')][_0x0476('0x3f')]));_0x177224[_0x0476('0x3e')]=_0x177224[_0x0476('0x3e')][_0x0476('0x4d')]?_0x177224['attributes']:_0x31d68e[_0x0476('0x3d')];if(_0xa53399[_0x0476('0x39')][_0x0476('0x48')]){_0x177224['include']=[{'all':!![]}];}_0x177224=_[_0x0476('0x43')]({},_0x177224,_0xa53399[_0x0476('0x46')]);return db['VtigerConfiguration']['find'](_0x177224)[_0x0476('0x1e')](handleEntityNotFound(_0x433eff,null))[_0x0476('0x1e')](respondWithResult(_0x433eff,null))['catch'](handleError(_0x433eff,null));};exports['create']=function(_0x3f871e,_0x1fdcb5){return db[_0x0476('0x35')][_0x0476('0x4e')](_0x3f871e[_0x0476('0x4f')],{})[_0x0476('0x1e')](respondWithResult(_0x1fdcb5,0xc9))[_0x0476('0x4b')](handleError(_0x1fdcb5,null));};exports[_0x0476('0x50')]=function(_0x159730,_0x34a536){if(_0x159730[_0x0476('0x4f')]['id']){delete _0x159730['body']['id'];}return db[_0x0476('0x35')][_0x0476('0x51')]({'where':{'id':_0x159730[_0x0476('0x52')]['id']}})[_0x0476('0x1e')](handleEntityNotFound(_0x34a536,null))[_0x0476('0x1e')](saveUpdates(_0x159730[_0x0476('0x4f')],null))['then'](respondWithResult(_0x34a536,null))[_0x0476('0x4b')](handleError(_0x34a536,null));};exports[_0x0476('0x53')]=function(_0x5d3edd,_0x10e521){return db[_0x0476('0x35')][_0x0476('0x51')]({'where':{'id':_0x5d3edd['params']['id']}})[_0x0476('0x1e')](handleEntityNotFound(_0x10e521,null))[_0x0476('0x1e')](removeEntity(_0x10e521,null))[_0x0476('0x4b')](handleError(_0x10e521,null));};exports['getFields']=function(_0x57acb2,_0x2ade7a,_0x50774a){var _0x3a0ec1={};var _0x5c9f45={};var _0x29cdf8;var _0x46d757;return db['VtigerConfiguration'][_0x0476('0x54')]({'where':{'id':_0x57acb2[_0x0476('0x52')]['id']}})[_0x0476('0x1e')](handleEntityNotFound(_0x2ade7a,null))['then'](function(_0x18f081){if(_0x18f081){_0x29cdf8=_0x18f081;_0x5c9f45[_0x0476('0x3d')]=_[_0x0476('0x3a')](db[_0x0476('0x55')][_0x0476('0x36')]);_0x5c9f45[_0x0476('0x39')]=_['keys'](_0x57acb2[_0x0476('0x39')]);_0x5c9f45[_0x0476('0x3b')]=_[_0x0476('0x3c')](_0x5c9f45[_0x0476('0x3d')],_0x5c9f45['query']);_0x3a0ec1[_0x0476('0x3e')]=_[_0x0476('0x3c')](_0x5c9f45[_0x0476('0x3d')],qs[_0x0476('0x3f')](_0x57acb2[_0x0476('0x39')][_0x0476('0x3f')]));_0x3a0ec1['attributes']=_0x3a0ec1[_0x0476('0x3e')][_0x0476('0x4d')]?_0x3a0ec1[_0x0476('0x3e')]:_0x5c9f45[_0x0476('0x3d')];_0x3a0ec1[_0x0476('0x56')]=qs[_0x0476('0x57')](_0x57acb2[_0x0476('0x39')][_0x0476('0x57')]);_0x3a0ec1[_0x0476('0x44')]=qs['filters'](_[_0x0476('0x41')](_0x57acb2['query'],_0x5c9f45[_0x0476('0x3b')]));if(_0x57acb2[_0x0476('0x39')][_0x0476('0x42')]){_0x3a0ec1[_0x0476('0x44')]=_[_0x0476('0x43')](_0x3a0ec1[_0x0476('0x44')],{'$or':_[_0x0476('0x34')](_0x3a0ec1[_0x0476('0x3e')],function(_0x2258d3){var _0xc57794={};_0xc57794[_0x2258d3]={'$like':'%'+_0x57acb2[_0x0476('0x39')][_0x0476('0x42')]+'%'};return _0xc57794;})});}_0x3a0ec1=_[_0x0476('0x43')]({},_0x3a0ec1,_0x57acb2['options']);return _0x29cdf8[_0x0476('0x58')](_0x3a0ec1);}})[_0x0476('0x1e')](function(_0x431904){if(_0x431904){_0x46d757=_0x431904[_0x0476('0x4d')];if(!_0x57acb2['query'][_0x0476('0x40')](_0x0476('0x59'))){_0x3a0ec1['limit']=qs[_0x0476('0x2a')](_0x57acb2['query'][_0x0476('0x2a')]);_0x3a0ec1[_0x0476('0x29')]=qs[_0x0476('0x29')](_0x57acb2['query']['offset']);}return _0x29cdf8[_0x0476('0x58')](_0x3a0ec1);}})[_0x0476('0x1e')](function(_0x7639cd){if(_0x7639cd){return _0x7639cd?{'count':_0x46d757,'rows':_0x7639cd}:null;}})[_0x0476('0x1e')](respondWithResult(_0x2ade7a,null))['catch'](handleError(_0x2ade7a,null));};exports[_0x0476('0x5a')]=function(_0x367ae3,_0x59567b,_0x484ae6){var _0x323d3c={};var _0x20e409={};var _0x25ce78;var _0x2dfb21;return db[_0x0476('0x35')][_0x0476('0x54')]({'where':{'id':_0x367ae3['params']['id']}})['then'](handleEntityNotFound(_0x59567b,null))[_0x0476('0x1e')](function(_0x314b5d){if(_0x314b5d){_0x25ce78=_0x314b5d;_0x20e409[_0x0476('0x3d')]=_[_0x0476('0x3a')](db[_0x0476('0x55')][_0x0476('0x36')]);_0x20e409[_0x0476('0x39')]=_[_0x0476('0x3a')](_0x367ae3[_0x0476('0x39')]);_0x20e409[_0x0476('0x3b')]=_[_0x0476('0x3c')](_0x20e409[_0x0476('0x3d')],_0x20e409[_0x0476('0x39')]);_0x323d3c['attributes']=_[_0x0476('0x3c')](_0x20e409['model'],qs[_0x0476('0x3f')](_0x367ae3[_0x0476('0x39')][_0x0476('0x3f')]));_0x323d3c[_0x0476('0x3e')]=_0x323d3c[_0x0476('0x3e')][_0x0476('0x4d')]?_0x323d3c[_0x0476('0x3e')]:_0x20e409['model'];_0x323d3c['order']=qs[_0x0476('0x57')](_0x367ae3[_0x0476('0x39')][_0x0476('0x57')]);_0x323d3c[_0x0476('0x44')]=qs[_0x0476('0x3b')](_[_0x0476('0x41')](_0x367ae3[_0x0476('0x39')],_0x20e409['filters']));if(_0x367ae3['query']['filter']){_0x323d3c[_0x0476('0x44')]=_[_0x0476('0x43')](_0x323d3c[_0x0476('0x44')],{'$or':_['map'](_0x323d3c[_0x0476('0x3e')],function(_0x5ee197){var _0x362bf4={};_0x362bf4[_0x5ee197]={'$like':'%'+_0x367ae3[_0x0476('0x39')]['filter']+'%'};return _0x362bf4;})});}_0x323d3c=_[_0x0476('0x43')]({},_0x323d3c,_0x367ae3[_0x0476('0x46')]);return _0x25ce78[_0x0476('0x5a')](_0x323d3c);}})[_0x0476('0x1e')](function(_0xe2bfcc){if(_0xe2bfcc){_0x2dfb21=_0xe2bfcc[_0x0476('0x4d')];if(!_0x367ae3[_0x0476('0x39')]['hasOwnProperty'](_0x0476('0x59'))){_0x323d3c[_0x0476('0x2a')]=qs[_0x0476('0x2a')](_0x367ae3[_0x0476('0x39')][_0x0476('0x2a')]);_0x323d3c[_0x0476('0x29')]=qs[_0x0476('0x29')](_0x367ae3['query'][_0x0476('0x29')]);}return _0x25ce78['getSubjects'](_0x323d3c);}})[_0x0476('0x1e')](function(_0x1e2a60){if(_0x1e2a60){return _0x1e2a60?{'count':_0x2dfb21,'rows':_0x1e2a60}:null;}})['then'](respondWithResult(_0x59567b,null))[_0x0476('0x4b')](handleError(_0x59567b,null));};exports[_0x0476('0x5b')]=function(_0xfd3309,_0x4dde89,_0xab6a4e){var _0x4c3fdb={};var _0x4785f1={};var _0x58248b;var _0x40f796;return db[_0x0476('0x35')][_0x0476('0x54')]({'where':{'id':_0xfd3309[_0x0476('0x52')]['id']}})[_0x0476('0x1e')](handleEntityNotFound(_0x4dde89,null))['then'](function(_0x539236){if(_0x539236){_0x58248b=_0x539236;_0x4785f1[_0x0476('0x3d')]=_[_0x0476('0x3a')](db[_0x0476('0x55')][_0x0476('0x36')]);_0x4785f1[_0x0476('0x39')]=_[_0x0476('0x3a')](_0xfd3309[_0x0476('0x39')]);_0x4785f1['filters']=_[_0x0476('0x3c')](_0x4785f1[_0x0476('0x3d')],_0x4785f1[_0x0476('0x39')]);_0x4c3fdb[_0x0476('0x3e')]=_[_0x0476('0x3c')](_0x4785f1['model'],qs[_0x0476('0x3f')](_0xfd3309[_0x0476('0x39')][_0x0476('0x3f')]));_0x4c3fdb[_0x0476('0x3e')]=_0x4c3fdb[_0x0476('0x3e')][_0x0476('0x4d')]?_0x4c3fdb['attributes']:_0x4785f1[_0x0476('0x3d')];_0x4c3fdb['order']=qs[_0x0476('0x57')](_0xfd3309[_0x0476('0x39')][_0x0476('0x57')]);_0x4c3fdb[_0x0476('0x44')]=qs[_0x0476('0x3b')](_[_0x0476('0x41')](_0xfd3309[_0x0476('0x39')],_0x4785f1[_0x0476('0x3b')]));if(_0xfd3309[_0x0476('0x39')][_0x0476('0x42')]){_0x4c3fdb[_0x0476('0x44')]=_[_0x0476('0x43')](_0x4c3fdb[_0x0476('0x44')],{'$or':_[_0x0476('0x34')](_0x4c3fdb[_0x0476('0x3e')],function(_0x41ddf9){var _0x30a039={};_0x30a039[_0x41ddf9]={'$like':'%'+_0xfd3309[_0x0476('0x39')][_0x0476('0x42')]+'%'};return _0x30a039;})});}_0x4c3fdb=_['merge']({},_0x4c3fdb,_0xfd3309[_0x0476('0x46')]);return _0x58248b['getDescriptions'](_0x4c3fdb);}})[_0x0476('0x1e')](function(_0x180b6f){if(_0x180b6f){_0x40f796=_0x180b6f[_0x0476('0x4d')];if(!_0xfd3309['query'][_0x0476('0x40')]('nolimit')){_0x4c3fdb[_0x0476('0x2a')]=qs[_0x0476('0x2a')](_0xfd3309[_0x0476('0x39')][_0x0476('0x2a')]);_0x4c3fdb[_0x0476('0x29')]=qs['offset'](_0xfd3309['query'][_0x0476('0x29')]);}return _0x58248b['getDescriptions'](_0x4c3fdb);}})[_0x0476('0x1e')](function(_0x206608){if(_0x206608){return _0x206608?{'count':_0x40f796,'rows':_0x206608}:null;}})[_0x0476('0x1e')](respondWithResult(_0x4dde89,null))[_0x0476('0x4b')](handleError(_0x4dde89,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9852777..17afa32 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 _0x02ed=['bluebird','request-promise','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x02ed,0x173));var _0xd02e=function(_0x58f0db,_0x4e59e1){_0x58f0db=_0x58f0db-0x0;var _0x24a34e=_0x02ed[_0x58f0db];return _0x24a34e;};'use strict';var _=require('lodash');var util=require(_0xd02e('0x0'));var logger=require(_0xd02e('0x1'))(_0xd02e('0x2'));var moment=require('moment');var BPromise=require(_0xd02e('0x3'));var rp=require(_0xd02e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd02e('0x5'));var config=require(_0xd02e('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xd02e('0x7')]=function(_0x26a37c,_0x5c54e3){return _0x26a37c[_0xd02e('0x8')](_0xd02e('0x9'),attributes,{'tableName':_0xd02e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd967=['bluebird','request-promise','rimraf','../../config/environment','exports','define','VtigerConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x44251,_0x1b9d97){var _0x3b26e7=function(_0x589541){while(--_0x589541){_0x44251['push'](_0x44251['shift']());}};_0x3b26e7(++_0x1b9d97);}(_0xd967,0x16f));var _0x7d96=function(_0x4ffa03,_0x363a82){_0x4ffa03=_0x4ffa03-0x0;var _0x30d661=_0xd967[_0x4ffa03];return _0x30d661;};'use strict';var _=require(_0x7d96('0x0'));var util=require(_0x7d96('0x1'));var logger=require(_0x7d96('0x2'))(_0x7d96('0x3'));var moment=require(_0x7d96('0x4'));var BPromise=require(_0x7d96('0x5'));var rp=require(_0x7d96('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d96('0x7'));var config=require(_0x7d96('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x7d96('0x9')]=function(_0x343fdc,_0x132cbd){return _0x343fdc[_0x7d96('0xa')](_0x7d96('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 46b17b4..69f2aa9 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 _0xe146=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis'];(function(_0x330740,_0x58c0c0){var _0x1cb5f2=function(_0xa5c99a){while(--_0xa5c99a){_0x330740['push'](_0x330740['shift']());}};_0x1cb5f2(++_0x58c0c0);}(_0xe146,0x10f));var _0x6e14=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0xe146[_0x19115e];return _0x45bbd4;};'use strict';var _=require(_0x6e14('0x0'));var util=require(_0x6e14('0x1'));var moment=require('moment');var BPromise=require(_0x6e14('0x2'));var rs=require(_0x6e14('0x3'));var fs=require('fs');var Redis=require(_0x6e14('0x4'));var db=require(_0x6e14('0x5'))['db'];var utils=require(_0x6e14('0x6'));var logger=require(_0x6e14('0x7'))(_0x6e14('0x8'));var config=require(_0x6e14('0x9'));var jayson=require(_0x6e14('0xa'));var client=jayson[_0x6e14('0xb')][_0x6e14('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cdb3c,_0x85d4be,_0x158e7d){return new BPromise(function(_0x140b15,_0x299742){return client[_0x6e14('0xd')](_0x1cdb3c,_0x158e7d)['then'](function(_0xf1bd26){logger[_0x6e14('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x85d4be,_0x6e14('0xf'));logger[_0x6e14('0x10')](_0x6e14('0x11'),_0x85d4be,_0x6e14('0xf'),JSON[_0x6e14('0x12')](_0xf1bd26));if(_0xf1bd26[_0x6e14('0x13')]){if(_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x14')]===0x1f4){logger[_0x6e14('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x85d4be,_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x15')]);return _0x299742(_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x15')]);}logger[_0x6e14('0x13')](_0x6e14('0x16'),_0x85d4be,_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x15')]);return _0x140b15(_0xf1bd26[_0x6e14('0x13')][_0x6e14('0x15')]);}else{logger[_0x6e14('0xe')](_0x6e14('0x16'),_0x85d4be,_0x6e14('0xf'));_0x140b15(_0xf1bd26['result'][_0x6e14('0x15')]);}})['catch'](function(_0x5bb6c1){logger[_0x6e14('0x13')](_0x6e14('0x16'),_0x85d4be,_0x5bb6c1);_0x299742(_0x5bb6c1);});});} \ No newline at end of file +var _0x65b4=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3ed4ad,_0xc112b5){var _0x5d2947=function(_0x2a1916){while(--_0x2a1916){_0x3ed4ad['push'](_0x3ed4ad['shift']());}};_0x5d2947(++_0xc112b5);}(_0x65b4,0xa4));var _0x465b=function(_0x2d4610,_0x2a038e){_0x2d4610=_0x2d4610-0x0;var _0x2a50b0=_0x65b4[_0x2d4610];return _0x2a50b0;};'use strict';var _=require('lodash');var util=require(_0x465b('0x0'));var moment=require(_0x465b('0x1'));var BPromise=require(_0x465b('0x2'));var rs=require(_0x465b('0x3'));var fs=require('fs');var Redis=require(_0x465b('0x4'));var db=require(_0x465b('0x5'))['db'];var utils=require(_0x465b('0x6'));var logger=require(_0x465b('0x7'))(_0x465b('0x8'));var config=require(_0x465b('0x9'));var jayson=require(_0x465b('0xa'));var client=jayson['client'][_0x465b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x217082,_0x184a02,_0x278375){return new BPromise(function(_0x2af17c,_0x102fdd){return client[_0x465b('0xc')](_0x217082,_0x278375)[_0x465b('0xd')](function(_0x140b02){logger[_0x465b('0xe')](_0x465b('0xf'),_0x184a02,_0x465b('0x10'));logger[_0x465b('0x11')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x184a02,_0x465b('0x10'),JSON[_0x465b('0x12')](_0x140b02));if(_0x140b02[_0x465b('0x13')]){if(_0x140b02[_0x465b('0x13')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x184a02,_0x140b02[_0x465b('0x13')]['message']);return _0x102fdd(_0x140b02[_0x465b('0x13')][_0x465b('0x14')]);}logger[_0x465b('0x13')](_0x465b('0xf'),_0x184a02,_0x140b02[_0x465b('0x13')][_0x465b('0x14')]);return _0x2af17c(_0x140b02[_0x465b('0x13')][_0x465b('0x14')]);}else{logger[_0x465b('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x184a02,_0x465b('0x10'));_0x2af17c(_0x140b02[_0x465b('0x15')][_0x465b('0x14')]);}})[_0x465b('0x16')](function(_0x43bc3c){logger[_0x465b('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x184a02,_0x43bc3c);_0x102fdd(_0x43bc3c);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 80165aa..9e5ae6f 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 _0xcfaa=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x4c288b,_0x424d2b){var _0x54896a=function(_0x3a8188){while(--_0x3a8188){_0x4c288b['push'](_0x4c288b['shift']());}};_0x54896a(++_0x424d2b);}(_0xcfaa,0x18f));var _0xacfa=function(_0x5012a0,_0x25c11b){_0x5012a0=_0x5012a0-0x0;var _0x37839d=_0xcfaa[_0x5012a0];return _0x37839d;};'use strict';var multer=require(_0xacfa('0x0'));var util=require(_0xacfa('0x1'));var path=require(_0xacfa('0x2'));var timeout=require(_0xacfa('0x3'));var express=require(_0xacfa('0x4'));var router=express[_0xacfa('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xacfa('0x6'));var config=require(_0xacfa('0x7'));var controller=require(_0xacfa('0x8'));router[_0xacfa('0x9')]('/',auth[_0xacfa('0xa')](),controller[_0xacfa('0xb')]);router[_0xacfa('0x9')](_0xacfa('0xc'),auth[_0xacfa('0xa')](),controller[_0xacfa('0xd')]);router[_0xacfa('0xe')]('/',auth[_0xacfa('0xa')](),controller[_0xacfa('0xf')]);router['put'](_0xacfa('0xc'),auth[_0xacfa('0xa')](),controller[_0xacfa('0x10')]);router[_0xacfa('0x11')](_0xacfa('0xc'),auth[_0xacfa('0xa')](),controller[_0xacfa('0x12')]);module[_0xacfa('0x13')]=router; \ No newline at end of file +var _0x2bfa=['express','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','update','delete','exports','multer','path','connect-timeout'];(function(_0x409e4f,_0x1bfc92){var _0x10af63=function(_0xac7b42){while(--_0xac7b42){_0x409e4f['push'](_0x409e4f['shift']());}};_0x10af63(++_0x1bfc92);}(_0x2bfa,0x15c));var _0xa2bf=function(_0x106315,_0x447952){_0x106315=_0x106315-0x0;var _0xbe2f49=_0x2bfa[_0x106315];return _0xbe2f49;};'use strict';var multer=require(_0xa2bf('0x0'));var util=require('util');var path=require(_0xa2bf('0x1'));var timeout=require(_0xa2bf('0x2'));var express=require(_0xa2bf('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa2bf('0x4'));var config=require(_0xa2bf('0x5'));var controller=require(_0xa2bf('0x6'));router[_0xa2bf('0x7')]('/',auth[_0xa2bf('0x8')](),controller['index']);router[_0xa2bf('0x7')](_0xa2bf('0x9'),auth[_0xa2bf('0x8')](),controller['show']);router['post']('/',auth[_0xa2bf('0x8')](),controller['create']);router['put'](_0xa2bf('0x9'),auth['isAuthenticated'](),controller[_0xa2bf('0xa')]);router[_0xa2bf('0xb')](_0xa2bf('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xa2bf('0xc')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 82c530b..3f2e95b 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 _0xd73c=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x18d479,_0x32bc04){var _0x26b12e=function(_0x2bbbdc){while(--_0x2bbbdc){_0x18d479['push'](_0x18d479['shift']());}};_0x26b12e(++_0x32bc04);}(_0xd73c,0x134));var _0xcd73=function(_0x1cb3ff,_0x40fa84){_0x1cb3ff=_0x1cb3ff-0x0;var _0x4b8018=_0xd73c[_0x1cb3ff];return _0x4b8018;};'use strict';var Sequelize=require(_0xcd73('0x0'));module[_0xcd73('0x1')]={'type':{'type':Sequelize[_0xcd73('0x2')](_0xcd73('0x3'),_0xcd73('0x4'),_0xcd73('0x5'),_0xcd73('0x6')),'defaultValue':_0xcd73('0x3')},'content':{'type':Sequelize[_0xcd73('0x7')]},'key':{'type':Sequelize[_0xcd73('0x7')]},'keyType':{'type':Sequelize[_0xcd73('0x2')](_0xcd73('0x3'),_0xcd73('0x4'),_0xcd73('0x5'))},'keyContent':{'type':Sequelize[_0xcd73('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcd73('0x7')]},'customField':{'type':Sequelize[_0xcd73('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcd73('0x7')]}}; \ No newline at end of file +var _0xabe8=['customVariable','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xabe8,0x8c));var _0x8abe=function(_0x47b2b8,_0x1ad11b){_0x47b2b8=_0x47b2b8-0x0;var _0x4bdf28=_0xabe8[_0x47b2b8];return _0x4bdf28;};'use strict';var Sequelize=require(_0x8abe('0x0'));module[_0x8abe('0x1')]={'type':{'type':Sequelize[_0x8abe('0x2')]('string',_0x8abe('0x3'),_0x8abe('0x4'),'keyValue'),'defaultValue':_0x8abe('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8abe('0x6')]},'keyType':{'type':Sequelize[_0x8abe('0x2')](_0x8abe('0x5'),_0x8abe('0x3'),_0x8abe('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8abe('0x6')]},'customField':{'type':Sequelize[_0x8abe('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8abe('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5b89c94..858eac8 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 _0x2143=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VtigerField','findAll','rows','catch','show','fields','includeAll','include','options','find','create','body','params','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0x2143,0x114));var _0x3214=function(_0x388134,_0x49904f){_0x388134=_0x388134-0x0;var _0x125f71=_0x2143[_0x388134];return _0x125f71;};'use strict';var pdf=require(_0x3214('0x0'));var emlformat=require(_0x3214('0x1'));var rimraf=require(_0x3214('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3214('0x3'));var moment=require(_0x3214('0x4'));var BPromise=require(_0x3214('0x5'));var Mustache=require(_0x3214('0x6'));var util=require(_0x3214('0x7'));var path=require(_0x3214('0x8'));var sox=require(_0x3214('0x9'));var csv=require(_0x3214('0xa'));var ejs=require(_0x3214('0xb'));var fs=require('fs');var _=require(_0x3214('0xc'));var squel=require(_0x3214('0xd'));var crypto=require(_0x3214('0xe'));var jsforce=require(_0x3214('0xf'));var deskjs=require(_0x3214('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3214('0x11'));var Redis=require(_0x3214('0x12'));var authService=require(_0x3214('0x13'));var qs=require(_0x3214('0x14'));var as=require(_0x3214('0x15'));var hardwareService=require(_0x3214('0x16'));var logger=require('../../config/logger')(_0x3214('0x17'));var utils=require('../../config/utils');var config=require(_0x3214('0x18'));var db=require(_0x3214('0x19'))['db'];function respondWithStatusCode(_0x378d3e,_0x597c99){_0x597c99=_0x597c99||0xcc;return function(_0x352cc0){if(_0x352cc0){return _0x378d3e[_0x3214('0x1a')](_0x597c99);}return _0x378d3e['status'](_0x597c99)['end']();};}function respondWithResult(_0x32e4af,_0x5ec0fb){_0x5ec0fb=_0x5ec0fb||0xc8;return function(_0x17689f){if(_0x17689f){return _0x32e4af[_0x3214('0x1b')](_0x5ec0fb)[_0x3214('0x1c')](_0x17689f);}};}function respondWithFilteredResult(_0x326a58,_0x51ba9e){return function(_0x110e9d){if(_0x110e9d){var _0x4a94fd=_0x110e9d[_0x3214('0x1d')],_0x585fea=_0x51ba9e[_0x3214('0x1e')],_0xa2b205=_0x51ba9e[_0x3214('0x1e')]+_0x51ba9e[_0x3214('0x1f')],_0x4cebec;if(_0xa2b205>=_0x4a94fd){_0xa2b205=_0x4a94fd;_0x4cebec=0xc8;}else{_0x4cebec=0xce;}_0x326a58[_0x3214('0x1b')](_0x4cebec);return _0x326a58[_0x3214('0x20')]('Content-Range',_0x585fea+'-'+_0xa2b205+'/'+_0x4a94fd)[_0x3214('0x1c')](_0x110e9d);}return null;};}function patchUpdates(_0x12db65){return function(_0x24ed9e){try{jsonpatch[_0x3214('0x21')](_0x24ed9e,_0x12db65,!![]);}catch(_0x4fe358){return BPromise['reject'](_0x4fe358);}return _0x24ed9e[_0x3214('0x22')]();};}function saveUpdates(_0x58fc25,_0x46d489){return function(_0x5ebadf){if(_0x5ebadf){return _0x5ebadf[_0x3214('0x23')](_0x58fc25)[_0x3214('0x24')](function(_0x1f7741){return _0x1f7741;});}return null;};}function removeEntity(_0x16e2a5,_0x3cbee7){return function(_0x3698b8){if(_0x3698b8){return _0x3698b8[_0x3214('0x25')]()[_0x3214('0x24')](function(){_0x16e2a5[_0x3214('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e1dd5,_0x4c1c59){return function(_0x173a99){if(!_0x173a99){_0x1e1dd5['sendStatus'](0x194);}return _0x173a99;};}function handleError(_0xc40b47,_0x1e3ec3){_0x1e3ec3=_0x1e3ec3||0x1f4;return function(_0x1936e5){logger[_0x3214('0x26')](_0x1936e5['stack']);if(_0x1936e5['name']){delete _0x1936e5[_0x3214('0x27')];}_0xc40b47[_0x3214('0x1b')](_0x1e3ec3)['send'](_0x1936e5);};}exports[_0x3214('0x28')]=function(_0x31ae63,_0x1d9e68){var _0xa4a839={},_0x5ad679={},_0x166b66={'count':0x0,'rows':[]};var _0x46b7a2=_[_0x3214('0x29')](db['VtigerField'][_0x3214('0x2a')],function(_0x10859b){return{'name':_0x10859b[_0x3214('0x2b')],'type':_0x10859b[_0x3214('0x2c')][_0x3214('0x2d')]};});_0x5ad679[_0x3214('0x2e')]=_[_0x3214('0x29')](_0x46b7a2,_0x3214('0x27'));_0x5ad679[_0x3214('0x2f')]=_[_0x3214('0x30')](_0x31ae63[_0x3214('0x2f')]);_0x5ad679['filters']=_['intersection'](_0x5ad679[_0x3214('0x2e')],_0x5ad679[_0x3214('0x2f')]);_0xa4a839[_0x3214('0x31')]=_[_0x3214('0x32')](_0x5ad679[_0x3214('0x2e')],qs['fields'](_0x31ae63['query']['fields']));_0xa4a839['attributes']=_0xa4a839[_0x3214('0x31')][_0x3214('0x33')]?_0xa4a839[_0x3214('0x31')]:_0x5ad679['model'];if(!_0x31ae63[_0x3214('0x2f')][_0x3214('0x34')](_0x3214('0x35'))){_0xa4a839[_0x3214('0x1f')]=qs[_0x3214('0x1f')](_0x31ae63[_0x3214('0x2f')][_0x3214('0x1f')]);_0xa4a839[_0x3214('0x1e')]=qs['offset'](_0x31ae63['query'][_0x3214('0x1e')]);}_0xa4a839[_0x3214('0x36')]=qs[_0x3214('0x37')](_0x31ae63[_0x3214('0x2f')][_0x3214('0x37')]);_0xa4a839[_0x3214('0x38')]=qs[_0x3214('0x39')](_[_0x3214('0x3a')](_0x31ae63[_0x3214('0x2f')],_0x5ad679[_0x3214('0x39')]),_0x46b7a2);if(_0x31ae63[_0x3214('0x2f')]['filter']){_0xa4a839[_0x3214('0x38')]=_['merge'](_0xa4a839[_0x3214('0x38')],{'$or':_[_0x3214('0x29')](_0x46b7a2,function(_0x5ffb99){if(_0x5ffb99['type']!=='VIRTUAL'){var _0x1f8a8b={};_0x1f8a8b[_0x5ffb99[_0x3214('0x27')]]={'$like':'%'+_0x31ae63[_0x3214('0x2f')][_0x3214('0x3b')]+'%'};return _0x1f8a8b;}})});}_0xa4a839=_[_0x3214('0x3c')]({},_0xa4a839,_0x31ae63['options']);var _0x24634c={'where':_0xa4a839[_0x3214('0x38')]};return db[_0x3214('0x3d')]['count'](_0x24634c)[_0x3214('0x24')](function(_0xd14057){_0x166b66[_0x3214('0x1d')]=_0xd14057;if(_0x31ae63[_0x3214('0x2f')]['includeAll']){_0xa4a839['include']=[{'all':!![]}];}return db[_0x3214('0x3d')][_0x3214('0x3e')](_0xa4a839);})[_0x3214('0x24')](function(_0x14087c){_0x166b66[_0x3214('0x3f')]=_0x14087c;return _0x166b66;})[_0x3214('0x24')](respondWithFilteredResult(_0x1d9e68,_0xa4a839))[_0x3214('0x40')](handleError(_0x1d9e68,null));};exports[_0x3214('0x41')]=function(_0x4a0e07,_0x33fe1e){var _0x5ee04b={'raw':!![],'where':{'id':_0x4a0e07['params']['id']}},_0x76afa3={};_0x76afa3['model']=_[_0x3214('0x30')](db[_0x3214('0x3d')][_0x3214('0x2a')]);_0x76afa3[_0x3214('0x2f')]=_[_0x3214('0x30')](_0x4a0e07[_0x3214('0x2f')]);_0x76afa3[_0x3214('0x39')]=_[_0x3214('0x32')](_0x76afa3[_0x3214('0x2e')],_0x76afa3['query']);_0x5ee04b[_0x3214('0x31')]=_[_0x3214('0x32')](_0x76afa3[_0x3214('0x2e')],qs[_0x3214('0x42')](_0x4a0e07['query']['fields']));_0x5ee04b[_0x3214('0x31')]=_0x5ee04b[_0x3214('0x31')][_0x3214('0x33')]?_0x5ee04b[_0x3214('0x31')]:_0x76afa3[_0x3214('0x2e')];if(_0x4a0e07[_0x3214('0x2f')][_0x3214('0x43')]){_0x5ee04b[_0x3214('0x44')]=[{'all':!![]}];}_0x5ee04b=_[_0x3214('0x3c')]({},_0x5ee04b,_0x4a0e07[_0x3214('0x45')]);return db['VtigerField'][_0x3214('0x46')](_0x5ee04b)[_0x3214('0x24')](handleEntityNotFound(_0x33fe1e,null))[_0x3214('0x24')](respondWithResult(_0x33fe1e,null))[_0x3214('0x40')](handleError(_0x33fe1e,null));};exports[_0x3214('0x47')]=function(_0x46a5f9,_0x119c02){return db[_0x3214('0x3d')][_0x3214('0x47')](_0x46a5f9[_0x3214('0x48')],{})['then'](respondWithResult(_0x119c02,0xc9))['catch'](handleError(_0x119c02,null));};exports[_0x3214('0x23')]=function(_0x55a80b,_0x447542){if(_0x55a80b['body']['id']){delete _0x55a80b[_0x3214('0x48')]['id'];}return db[_0x3214('0x3d')]['find']({'where':{'id':_0x55a80b['params']['id']}})[_0x3214('0x24')](handleEntityNotFound(_0x447542,null))[_0x3214('0x24')](saveUpdates(_0x55a80b[_0x3214('0x48')],null))['then'](respondWithResult(_0x447542,null))['catch'](handleError(_0x447542,null));};exports[_0x3214('0x25')]=function(_0x2a402f,_0x4d9bb8){return db[_0x3214('0x3d')][_0x3214('0x46')]({'where':{'id':_0x2a402f[_0x3214('0x49')]['id']}})[_0x3214('0x24')](handleEntityNotFound(_0x4d9bb8,null))[_0x3214('0x24')](removeEntity(_0x4d9bb8,null))[_0x3214('0x40')](handleError(_0x4d9bb8,null));}; \ No newline at end of file +var _0x1c6a=['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/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','VtigerField','include','rows','catch','show','params','find','create','body','update','html-pdf','rimraf','zip-dir','request-promise','moment'];(function(_0x249ed2,_0x1f25d3){var _0x5a7127=function(_0x278315){while(--_0x278315){_0x249ed2['push'](_0x249ed2['shift']());}};_0x5a7127(++_0x1f25d3);}(_0x1c6a,0x154));var _0xa1c6=function(_0x4ea1b4,_0x4f21c3){_0x4ea1b4=_0x4ea1b4-0x0;var _0x440fd7=_0x1c6a[_0x4ea1b4];return _0x440fd7;};'use strict';var pdf=require(_0xa1c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa1c6('0x1'));var zipdir=require(_0xa1c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c6('0x3'));var moment=require(_0xa1c6('0x4'));var BPromise=require(_0xa1c6('0x5'));var Mustache=require(_0xa1c6('0x6'));var util=require(_0xa1c6('0x7'));var path=require(_0xa1c6('0x8'));var sox=require('sox');var csv=require(_0xa1c6('0x9'));var ejs=require(_0xa1c6('0xa'));var fs=require('fs');var _=require(_0xa1c6('0xb'));var squel=require('squel');var crypto=require(_0xa1c6('0xc'));var jsforce=require(_0xa1c6('0xd'));var deskjs=require(_0xa1c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa1c6('0xf'));var Papa=require(_0xa1c6('0x10'));var Redis=require(_0xa1c6('0x11'));var authService=require(_0xa1c6('0x12'));var qs=require(_0xa1c6('0x13'));var as=require(_0xa1c6('0x14'));var hardwareService=require(_0xa1c6('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa1c6('0x16'));var config=require(_0xa1c6('0x17'));var db=require(_0xa1c6('0x18'))['db'];function respondWithStatusCode(_0x1b5858,_0x51c92f){_0x51c92f=_0x51c92f||0xcc;return function(_0x41d289){if(_0x41d289){return _0x1b5858[_0xa1c6('0x19')](_0x51c92f);}return _0x1b5858['status'](_0x51c92f)[_0xa1c6('0x1a')]();};}function respondWithResult(_0x13c129,_0x5f1dbe){_0x5f1dbe=_0x5f1dbe||0xc8;return function(_0x524e3e){if(_0x524e3e){return _0x13c129[_0xa1c6('0x1b')](_0x5f1dbe)[_0xa1c6('0x1c')](_0x524e3e);}};}function respondWithFilteredResult(_0x106d80,_0x1a334e){return function(_0x261ae3){if(_0x261ae3){var _0x5e17f9=_0x261ae3[_0xa1c6('0x1d')],_0x11e9dd=_0x1a334e[_0xa1c6('0x1e')],_0x23efa3=_0x1a334e['offset']+_0x1a334e[_0xa1c6('0x1f')],_0x9ac511;if(_0x23efa3>=_0x5e17f9){_0x23efa3=_0x5e17f9;_0x9ac511=0xc8;}else{_0x9ac511=0xce;}_0x106d80[_0xa1c6('0x1b')](_0x9ac511);return _0x106d80['set']('Content-Range',_0x11e9dd+'-'+_0x23efa3+'/'+_0x5e17f9)[_0xa1c6('0x1c')](_0x261ae3);}return null;};}function patchUpdates(_0x19561d){return function(_0x2ac972){try{jsonpatch[_0xa1c6('0x20')](_0x2ac972,_0x19561d,!![]);}catch(_0x439388){return BPromise[_0xa1c6('0x21')](_0x439388);}return _0x2ac972['save']();};}function saveUpdates(_0x3ce3e3,_0xc532b8){return function(_0x39f6d9){if(_0x39f6d9){return _0x39f6d9['update'](_0x3ce3e3)[_0xa1c6('0x22')](function(_0x4c4723){return _0x4c4723;});}return null;};}function removeEntity(_0xab22a5,_0x2acb2c){return function(_0xeed334){if(_0xeed334){return _0xeed334[_0xa1c6('0x23')]()[_0xa1c6('0x22')](function(){_0xab22a5[_0xa1c6('0x1b')](0xcc)[_0xa1c6('0x1a')]();});}};}function handleEntityNotFound(_0x4ff952,_0x33dffb){return function(_0x471dcd){if(!_0x471dcd){_0x4ff952['sendStatus'](0x194);}return _0x471dcd;};}function handleError(_0x2f95cb,_0x54c642){_0x54c642=_0x54c642||0x1f4;return function(_0x33aa43){logger['error'](_0x33aa43[_0xa1c6('0x24')]);if(_0x33aa43[_0xa1c6('0x25')]){delete _0x33aa43['name'];}_0x2f95cb[_0xa1c6('0x1b')](_0x54c642)[_0xa1c6('0x26')](_0x33aa43);};}exports['index']=function(_0x34a863,_0x460c16){var _0xc8b39a={},_0x5c6644={},_0x5ce45d={'count':0x0,'rows':[]};var _0x1c3e8f=_[_0xa1c6('0x27')](db['VtigerField'][_0xa1c6('0x28')],function(_0x1fc2a5){return{'name':_0x1fc2a5[_0xa1c6('0x29')],'type':_0x1fc2a5['type'][_0xa1c6('0x2a')]};});_0x5c6644[_0xa1c6('0x2b')]=_[_0xa1c6('0x27')](_0x1c3e8f,_0xa1c6('0x25'));_0x5c6644[_0xa1c6('0x2c')]=_[_0xa1c6('0x2d')](_0x34a863['query']);_0x5c6644['filters']=_[_0xa1c6('0x2e')](_0x5c6644[_0xa1c6('0x2b')],_0x5c6644['query']);_0xc8b39a[_0xa1c6('0x2f')]=_['intersection'](_0x5c6644[_0xa1c6('0x2b')],qs[_0xa1c6('0x30')](_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x30')]));_0xc8b39a['attributes']=_0xc8b39a[_0xa1c6('0x2f')][_0xa1c6('0x31')]?_0xc8b39a['attributes']:_0x5c6644[_0xa1c6('0x2b')];if(!_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x32')](_0xa1c6('0x33'))){_0xc8b39a[_0xa1c6('0x1f')]=qs[_0xa1c6('0x1f')](_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x1f')]);_0xc8b39a['offset']=qs[_0xa1c6('0x1e')](_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x1e')]);}_0xc8b39a['order']=qs[_0xa1c6('0x34')](_0x34a863[_0xa1c6('0x2c')][_0xa1c6('0x34')]);_0xc8b39a[_0xa1c6('0x35')]=qs[_0xa1c6('0x36')](_[_0xa1c6('0x37')](_0x34a863[_0xa1c6('0x2c')],_0x5c6644[_0xa1c6('0x36')]),_0x1c3e8f);if(_0x34a863['query'][_0xa1c6('0x38')]){_0xc8b39a[_0xa1c6('0x35')]=_['merge'](_0xc8b39a[_0xa1c6('0x35')],{'$or':_['map'](_0x1c3e8f,function(_0x3a6739){if(_0x3a6739['type']!=='VIRTUAL'){var _0x19de2d={};_0x19de2d[_0x3a6739[_0xa1c6('0x25')]]={'$like':'%'+_0x34a863[_0xa1c6('0x2c')]['filter']+'%'};return _0x19de2d;}})});}_0xc8b39a=_[_0xa1c6('0x39')]({},_0xc8b39a,_0x34a863[_0xa1c6('0x3a')]);var _0x3d2848={'where':_0xc8b39a[_0xa1c6('0x35')]};return db[_0xa1c6('0x3b')][_0xa1c6('0x1d')](_0x3d2848)[_0xa1c6('0x22')](function(_0x5ce5fb){_0x5ce45d[_0xa1c6('0x1d')]=_0x5ce5fb;if(_0x34a863['query']['includeAll']){_0xc8b39a[_0xa1c6('0x3c')]=[{'all':!![]}];}return db[_0xa1c6('0x3b')]['findAll'](_0xc8b39a);})['then'](function(_0x1928d8){_0x5ce45d[_0xa1c6('0x3d')]=_0x1928d8;return _0x5ce45d;})[_0xa1c6('0x22')](respondWithFilteredResult(_0x460c16,_0xc8b39a))[_0xa1c6('0x3e')](handleError(_0x460c16,null));};exports[_0xa1c6('0x3f')]=function(_0x19feb6,_0x2ae05b){var _0x4d91c8={'raw':!![],'where':{'id':_0x19feb6[_0xa1c6('0x40')]['id']}},_0x53fbc2={};_0x53fbc2[_0xa1c6('0x2b')]=_[_0xa1c6('0x2d')](db['VtigerField'][_0xa1c6('0x28')]);_0x53fbc2[_0xa1c6('0x2c')]=_['keys'](_0x19feb6[_0xa1c6('0x2c')]);_0x53fbc2[_0xa1c6('0x36')]=_['intersection'](_0x53fbc2[_0xa1c6('0x2b')],_0x53fbc2[_0xa1c6('0x2c')]);_0x4d91c8[_0xa1c6('0x2f')]=_[_0xa1c6('0x2e')](_0x53fbc2[_0xa1c6('0x2b')],qs[_0xa1c6('0x30')](_0x19feb6[_0xa1c6('0x2c')][_0xa1c6('0x30')]));_0x4d91c8[_0xa1c6('0x2f')]=_0x4d91c8[_0xa1c6('0x2f')][_0xa1c6('0x31')]?_0x4d91c8[_0xa1c6('0x2f')]:_0x53fbc2[_0xa1c6('0x2b')];if(_0x19feb6[_0xa1c6('0x2c')]['includeAll']){_0x4d91c8[_0xa1c6('0x3c')]=[{'all':!![]}];}_0x4d91c8=_['merge']({},_0x4d91c8,_0x19feb6[_0xa1c6('0x3a')]);return db[_0xa1c6('0x3b')][_0xa1c6('0x41')](_0x4d91c8)[_0xa1c6('0x22')](handleEntityNotFound(_0x2ae05b,null))[_0xa1c6('0x22')](respondWithResult(_0x2ae05b,null))['catch'](handleError(_0x2ae05b,null));};exports[_0xa1c6('0x42')]=function(_0x572128,_0x4b330b){return db[_0xa1c6('0x3b')]['create'](_0x572128[_0xa1c6('0x43')],{})[_0xa1c6('0x22')](respondWithResult(_0x4b330b,0xc9))[_0xa1c6('0x3e')](handleError(_0x4b330b,null));};exports[_0xa1c6('0x44')]=function(_0x54fd71,_0x139833){if(_0x54fd71['body']['id']){delete _0x54fd71[_0xa1c6('0x43')]['id'];}return db[_0xa1c6('0x3b')][_0xa1c6('0x41')]({'where':{'id':_0x54fd71['params']['id']}})[_0xa1c6('0x22')](handleEntityNotFound(_0x139833,null))[_0xa1c6('0x22')](saveUpdates(_0x54fd71['body'],null))[_0xa1c6('0x22')](respondWithResult(_0x139833,null))[_0xa1c6('0x3e')](handleError(_0x139833,null));};exports['destroy']=function(_0x49f418,_0x17a7a3){return db[_0xa1c6('0x3b')][_0xa1c6('0x41')]({'where':{'id':_0x49f418[_0xa1c6('0x40')]['id']}})['then'](handleEntityNotFound(_0x17a7a3,null))[_0xa1c6('0x22')](removeEntity(_0x17a7a3,null))[_0xa1c6('0x3e')](handleError(_0x17a7a3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 75b6389..3362d21 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 _0x70e0=['path','rimraf','./intVtigerField.attributes','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x3090b6,_0x233710){var _0x8fdb83=function(_0x54f7b7){while(--_0x54f7b7){_0x3090b6['push'](_0x3090b6['shift']());}};_0x8fdb83(++_0x233710);}(_0x70e0,0x17b));var _0x070e=function(_0x5cf694,_0x7be551){_0x5cf694=_0x5cf694-0x0;var _0x3af377=_0x70e0[_0x5cf694];return _0x3af377;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VtigerField',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0xa'),_0x070e('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['VtigerField','int_vtiger_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerField.attributes','define'];(function(_0x3ed367,_0x36ecef){var _0x38ef61=function(_0x206705){while(--_0x206705){_0x3ed367['push'](_0x3ed367['shift']());}};_0x38ef61(++_0x36ecef);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x49c4('0xa'),_0x49c4('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index a66691b..1f3c62f 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 _0xbaf0=['client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('VtigerField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0x7633=['request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x7633,0x1c4));var _0x3763=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7633[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x3763('0x0'));var util=require(_0x3763('0x1'));var moment=require(_0x3763('0x2'));var BPromise=require(_0x3763('0x3'));var rs=require(_0x3763('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3763('0x5'))['db'];var utils=require(_0x3763('0x6'));var logger=require('../../config/logger')(_0x3763('0x7'));var config=require(_0x3763('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3763('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8a2d3e,_0x28f9b0,_0x335382){return new BPromise(function(_0x50b634,_0x550b39){return client[_0x3763('0xa')](_0x8a2d3e,_0x335382)[_0x3763('0xb')](function(_0x4aa292){logger[_0x3763('0xc')](_0x3763('0xd'),_0x28f9b0,_0x3763('0xe'));logger[_0x3763('0xf')](_0x3763('0x10'),_0x28f9b0,_0x3763('0xe'),JSON[_0x3763('0x11')](_0x4aa292));if(_0x4aa292[_0x3763('0x12')]){if(_0x4aa292['error'][_0x3763('0x13')]===0x1f4){logger[_0x3763('0x12')](_0x3763('0xd'),_0x28f9b0,_0x4aa292['error']['message']);return _0x550b39(_0x4aa292[_0x3763('0x12')]['message']);}logger[_0x3763('0x12')](_0x3763('0xd'),_0x28f9b0,_0x4aa292[_0x3763('0x12')][_0x3763('0x14')]);return _0x50b634(_0x4aa292[_0x3763('0x12')][_0x3763('0x14')]);}else{logger[_0x3763('0xc')]('VtigerField,\x20%s,\x20%s',_0x28f9b0,_0x3763('0xe'));_0x50b634(_0x4aa292[_0x3763('0x15')][_0x3763('0x14')]);}})['catch'](function(_0x4dde36){logger['error'](_0x3763('0xd'),_0x28f9b0,_0x4dde36);_0x550b39(_0x4dde36);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 60aaf9a..88f588c 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 _0x4ec1=['/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0x4ec1,0x11e));var _0x14ec=function(_0x150d70,_0x2da39b){_0x150d70=_0x150d70-0x0;var _0x57dff4=_0x4ec1[_0x150d70];return _0x57dff4;};'use strict';var multer=require('multer');var util=require(_0x14ec('0x0'));var path=require(_0x14ec('0x1'));var timeout=require(_0x14ec('0x2'));var express=require(_0x14ec('0x3'));var router=express[_0x14ec('0x4')]();var auth=require(_0x14ec('0x5'));var interaction=require(_0x14ec('0x6'));var config=require(_0x14ec('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x14ec('0x8')]('/',auth[_0x14ec('0x9')](),controller[_0x14ec('0xa')]);router['get'](_0x14ec('0xb'),auth[_0x14ec('0x9')](),controller[_0x14ec('0xc')]);router[_0x14ec('0x8')](_0x14ec('0xd'),auth[_0x14ec('0x9')](),controller['getConfigurations']);router[_0x14ec('0x8')](_0x14ec('0xe'),auth['isAuthenticated'](),controller[_0x14ec('0xf')]);router['post']('/',auth[_0x14ec('0x9')](),controller[_0x14ec('0x10')]);router[_0x14ec('0x11')](_0x14ec('0xd'),auth['isAuthenticated'](),controller[_0x14ec('0x12')]);router[_0x14ec('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x14ec('0x14')]);router[_0x14ec('0x15')](_0x14ec('0xb'),auth['isAuthenticated'](),controller[_0x14ec('0x16')]);module['exports']=router; \ No newline at end of file +var _0xcbc7=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x206ec3,_0x18cda4){var _0x1c57fa=function(_0xf653a0){while(--_0xf653a0){_0x206ec3['push'](_0x206ec3['shift']());}};_0x1c57fa(++_0x18cda4);}(_0xcbc7,0x13f));var _0x7cbc=function(_0x3b5a4a,_0x4096e5){_0x3b5a4a=_0x3b5a4a-0x0;var _0xaaec44=_0xcbc7[_0x3b5a4a];return _0xaaec44;};'use strict';var multer=require('multer');var util=require(_0x7cbc('0x0'));var path=require(_0x7cbc('0x1'));var timeout=require(_0x7cbc('0x2'));var express=require(_0x7cbc('0x3'));var router=express[_0x7cbc('0x4')]();var auth=require(_0x7cbc('0x5'));var interaction=require(_0x7cbc('0x6'));var config=require(_0x7cbc('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x7cbc('0x8')]('/',auth[_0x7cbc('0x9')](),controller[_0x7cbc('0xa')]);router[_0x7cbc('0x8')](_0x7cbc('0xb'),auth[_0x7cbc('0x9')](),controller['show']);router[_0x7cbc('0x8')](_0x7cbc('0xc'),auth[_0x7cbc('0x9')](),controller[_0x7cbc('0xd')]);router[_0x7cbc('0x8')](_0x7cbc('0xe'),auth['isAuthenticated'](),controller[_0x7cbc('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7cbc('0x10')]);router[_0x7cbc('0x11')](_0x7cbc('0xc'),auth['isAuthenticated'](),controller[_0x7cbc('0x12')]);router[_0x7cbc('0x13')](_0x7cbc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7cbc('0x14')](_0x7cbc('0xb'),auth[_0x7cbc('0x9')](),controller[_0x7cbc('0x15')]);module[_0x7cbc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index da34dca..f886786 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 _0x3afd=['token','password','integrationTab','newTab','sequelize','exports','STRING','remoteUri','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3afd,0x1d8));var _0xd3af=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0x3afd[_0x2c18a8];return _0x1e009a;};'use strict';var Sequelize=require(_0xd3af('0x0'));module[_0xd3af('0x1')]={'name':{'type':Sequelize[_0xd3af('0x2')]},'description':{'type':Sequelize[_0xd3af('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xd3af('0x2')]},'token':{'type':Sequelize[_0xd3af('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd3af('0x3')},'authType':{'type':Sequelize[_0xd3af('0x4')]('password',_0xd3af('0x5')),'defaultValue':_0xd3af('0x6')},'serverUrl':{'type':Sequelize[_0xd3af('0x2')]},'type':{'type':Sequelize['ENUM'](_0xd3af('0x7'),_0xd3af('0x8')),'defaultValue':_0xd3af('0x7')}}; \ No newline at end of file +var _0x7657=['STRING','remoteUri','ENUM','token','integrationTab','newTab','exports'];(function(_0x4b5409,_0x472b71){var _0x90b623=function(_0x596445){while(--_0x596445){_0x4b5409['push'](_0x4b5409['shift']());}};_0x90b623(++_0x472b71);}(_0x7657,0x179));var _0x7765=function(_0x160c10,_0x1aa3d5){_0x160c10=_0x160c10-0x0;var _0x592b83=_0x7657[_0x160c10];return _0x592b83;};'use strict';var Sequelize=require('sequelize');module[_0x7765('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7765('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x7765('0x1')]},'remoteUri':{'type':Sequelize[_0x7765('0x1')],'unique':_0x7765('0x2')},'authType':{'type':Sequelize[_0x7765('0x3')]('password',_0x7765('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7765('0x3')](_0x7765('0x5'),_0x7765('0x6')),'defaultValue':_0x7765('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a2ba6bc..9bc0fc6 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 _0xdbe2=['base64','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','includes','position','system_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ZendeskAccount','includeAll','include','findAll','rows','catch','find','create','body','params','findOne','ZendeskConfiguration','filters','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString'];(function(_0x1d9fd5,_0x13f9bc){var _0x5ddcf8=function(_0x5b955c){while(--_0x5b955c){_0x1d9fd5['push'](_0x1d9fd5['shift']());}};_0x5ddcf8(++_0x13f9bc);}(_0xdbe2,0x109));var _0x2dbe=function(_0x171e4d,_0x4f2493){_0x171e4d=_0x171e4d-0x0;var _0x2d2bf4=_0xdbe2[_0x171e4d];return _0x2d2bf4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2dbe('0x0'));var zipdir=require(_0x2dbe('0x1'));var jsonpatch=require(_0x2dbe('0x2'));var rp=require(_0x2dbe('0x3'));var moment=require(_0x2dbe('0x4'));var BPromise=require(_0x2dbe('0x5'));var Mustache=require(_0x2dbe('0x6'));var util=require('util');var path=require(_0x2dbe('0x7'));var sox=require(_0x2dbe('0x8'));var csv=require(_0x2dbe('0x9'));var ejs=require(_0x2dbe('0xa'));var fs=require('fs');var _=require(_0x2dbe('0xb'));var squel=require(_0x2dbe('0xc'));var crypto=require(_0x2dbe('0xd'));var jsforce=require(_0x2dbe('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2dbe('0x9'));var querystring=require(_0x2dbe('0xf'));var Papa=require(_0x2dbe('0x10'));var Redis=require(_0x2dbe('0x11'));var authService=require(_0x2dbe('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dbe('0x13'))(_0x2dbe('0x14'));var utils=require(_0x2dbe('0x15'));var config=require(_0x2dbe('0x16'));var db=require(_0x2dbe('0x17'))['db'];var integrations=require(_0x2dbe('0x18'));var jayson=require(_0x2dbe('0x19'));var client=jayson['client'][_0x2dbe('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x189a20,_0x372434,_0x3e91f7){if(_0x3e91f7){var _0x1d13e6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d13e6[_0x2dbe('0x1b')](_0x372434)){return _0x189a20;}else{throw new db[(_0x2dbe('0x1c'))][(_0x2dbe('0x1d'))](_0x2dbe('0x1e'));}}else{return _0x189a20;}}function respondWithRpcPromise(_0x1ac581,_0x2bd785,_0x8db038,_0x3a1c79){return new BPromise(function(_0x3a3a09,_0x5e2f0e){var _0x1be2b9=_0x3a1c79||client;return _0x1be2b9['request'](_0x1ac581,_0x8db038)[_0x2dbe('0x1f')](function(_0x4f42e6){logger[_0x2dbe('0x20')](_0x2dbe('0x21'),_0x2bd785,_0x2dbe('0x22'));logger[_0x2dbe('0x23')](_0x2dbe('0x24'),_0x2bd785,_0x2dbe('0x22'),JSON[_0x2dbe('0x25')](_0x4f42e6));if(_0x4f42e6['error']){if(_0x4f42e6[_0x2dbe('0x26')][_0x2dbe('0x27')]===0x1f4){logger[_0x2dbe('0x26')]('ZendeskAccount,\x20%s,\x20%s',_0x2bd785,_0x4f42e6[_0x2dbe('0x26')][_0x2dbe('0x28')]);return _0x5e2f0e(_0x4f42e6['error'][_0x2dbe('0x28')]);}logger[_0x2dbe('0x26')](_0x2dbe('0x21'),_0x2bd785,_0x4f42e6[_0x2dbe('0x26')][_0x2dbe('0x28')]);return _0x3a3a09(_0x4f42e6[_0x2dbe('0x26')][_0x2dbe('0x28')]);}else{logger[_0x2dbe('0x20')](_0x2dbe('0x21'),_0x2bd785,'request\x20sent');_0x3a3a09(_0x4f42e6['result'][_0x2dbe('0x28')]);}})['catch'](function(_0x28d08a){logger[_0x2dbe('0x26')]('ZendeskAccount,\x20%s,\x20%s',_0x2bd785,_0x28d08a);_0x5e2f0e(_0x28d08a);});});}function respondWithStatusCode(_0x12bf09,_0x5b2b57){_0x5b2b57=_0x5b2b57||0xcc;return function(_0x231159){if(_0x231159){return _0x12bf09[_0x2dbe('0x29')](_0x5b2b57);}return _0x12bf09[_0x2dbe('0x2a')](_0x5b2b57)[_0x2dbe('0x2b')]();};}function respondWithResult(_0x560f30,_0x3a1603){_0x3a1603=_0x3a1603||0xc8;return function(_0x5862bb){if(_0x5862bb){return _0x560f30[_0x2dbe('0x2a')](_0x3a1603)[_0x2dbe('0x2c')](_0x5862bb);}};}function respondWithFilteredResult(_0x41dacf,_0x4c1fed){return function(_0x52caa6){if(_0x52caa6){var _0x2d8af8=_0x52caa6[_0x2dbe('0x2d')],_0x3bdff5=_0x4c1fed[_0x2dbe('0x2e')],_0x2eea2c=_0x4c1fed[_0x2dbe('0x2e')]+_0x4c1fed[_0x2dbe('0x2f')],_0x3b00a8;if(_0x2eea2c>=_0x2d8af8){_0x2eea2c=_0x2d8af8;_0x3b00a8=0xc8;}else{_0x3b00a8=0xce;}_0x41dacf[_0x2dbe('0x2a')](_0x3b00a8);return _0x41dacf[_0x2dbe('0x30')](_0x2dbe('0x31'),_0x3bdff5+'-'+_0x2eea2c+'/'+_0x2d8af8)[_0x2dbe('0x2c')](_0x52caa6);}return null;};}function patchUpdates(_0x53252d){return function(_0x11c40c){try{jsonpatch['apply'](_0x11c40c,_0x53252d,!![]);}catch(_0x304d76){return BPromise[_0x2dbe('0x32')](_0x304d76);}return _0x11c40c[_0x2dbe('0x33')]();};}function saveUpdates(_0x4a3fa9,_0x52efd7){return function(_0x1589d2){if(_0x1589d2){return _0x1589d2[_0x2dbe('0x34')](_0x4a3fa9)[_0x2dbe('0x1f')](function(_0x24d0ec){return _0x24d0ec;});}return null;};}function removeEntity(_0x149d76,_0x54b37a){return function(_0x5c6892){if(_0x5c6892){return _0x5c6892[_0x2dbe('0x35')]()['then'](function(){_0x149d76[_0x2dbe('0x2a')](0xcc)[_0x2dbe('0x2b')]();});}};}function handleEntityNotFound(_0x18d13c,_0x3d540a){return function(_0x1d7874){if(!_0x1d7874){_0x18d13c[_0x2dbe('0x29')](0x194);}return _0x1d7874;};}function handleError(_0x4d0d18,_0x42711f){_0x42711f=_0x42711f||0x1f4;return function(_0x4f4681){logger[_0x2dbe('0x26')](_0x4f4681[_0x2dbe('0x36')]);if(_0x4f4681[_0x2dbe('0x37')]){delete _0x4f4681[_0x2dbe('0x37')];}_0x4d0d18[_0x2dbe('0x2a')](_0x42711f)['send'](_0x4f4681);};}exports[_0x2dbe('0x38')]=function(_0x256169,_0x336c65){var _0x3e5fd5={},_0xb1fb01={},_0x211e82={'count':0x0,'rows':[]};var _0x8983c4=_[_0x2dbe('0x39')](db['ZendeskAccount'][_0x2dbe('0x3a')],function(_0x593187){return{'name':_0x593187[_0x2dbe('0x3b')],'type':_0x593187[_0x2dbe('0x3c')]['key']};});_0xb1fb01[_0x2dbe('0x3d')]=_['map'](_0x8983c4,_0x2dbe('0x37'));_0xb1fb01[_0x2dbe('0x3e')]=_[_0x2dbe('0x3f')](_0x256169[_0x2dbe('0x3e')]);_0xb1fb01['filters']=_[_0x2dbe('0x40')](_0xb1fb01[_0x2dbe('0x3d')],_0xb1fb01[_0x2dbe('0x3e')]);_0x3e5fd5[_0x2dbe('0x41')]=_['intersection'](_0xb1fb01['model'],qs[_0x2dbe('0x42')](_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x42')]));_0x3e5fd5['attributes']=_0x3e5fd5[_0x2dbe('0x41')][_0x2dbe('0x43')]?_0x3e5fd5[_0x2dbe('0x41')]:_0xb1fb01[_0x2dbe('0x3d')];if(!_0x256169['query'][_0x2dbe('0x44')](_0x2dbe('0x45'))){_0x3e5fd5[_0x2dbe('0x2f')]=qs[_0x2dbe('0x2f')](_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x2f')]);_0x3e5fd5['offset']=qs[_0x2dbe('0x2e')](_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x2e')]);}_0x3e5fd5[_0x2dbe('0x46')]=qs[_0x2dbe('0x47')](_0x256169['query'][_0x2dbe('0x47')]);_0x3e5fd5[_0x2dbe('0x48')]=qs['filters'](_[_0x2dbe('0x49')](_0x256169[_0x2dbe('0x3e')],_0xb1fb01['filters']),_0x8983c4);if(_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x4a')]){_0x3e5fd5[_0x2dbe('0x48')]=_['merge'](_0x3e5fd5['where'],{'$or':_[_0x2dbe('0x39')](_0x8983c4,function(_0x20263b){if(_0x20263b[_0x2dbe('0x3c')]!=='VIRTUAL'){var _0x44dee3={};_0x44dee3[_0x20263b[_0x2dbe('0x37')]]={'$like':'%'+_0x256169[_0x2dbe('0x3e')]['filter']+'%'};return _0x44dee3;}})});}_0x3e5fd5=_[_0x2dbe('0x4b')]({},_0x3e5fd5,_0x256169[_0x2dbe('0x4c')]);var _0x29d39f={'where':_0x3e5fd5[_0x2dbe('0x48')]};return db[_0x2dbe('0x4d')]['count'](_0x29d39f)[_0x2dbe('0x1f')](function(_0x2c867d){_0x211e82['count']=_0x2c867d;if(_0x256169[_0x2dbe('0x3e')][_0x2dbe('0x4e')]){_0x3e5fd5[_0x2dbe('0x4f')]=[{'all':!![]}];}return db[_0x2dbe('0x4d')][_0x2dbe('0x50')](_0x3e5fd5);})[_0x2dbe('0x1f')](function(_0x14379d){_0x211e82[_0x2dbe('0x51')]=_0x14379d;return _0x211e82;})[_0x2dbe('0x1f')](respondWithFilteredResult(_0x336c65,_0x3e5fd5))[_0x2dbe('0x52')](handleError(_0x336c65,null));};exports['show']=function(_0x31c616,_0x51ce0d){var _0x2db1e0={'raw':![],'where':{'id':_0x31c616['params']['id']}},_0x360d0c={};_0x360d0c[_0x2dbe('0x3d')]=_[_0x2dbe('0x3f')](db[_0x2dbe('0x4d')][_0x2dbe('0x3a')]);_0x360d0c[_0x2dbe('0x3e')]=_[_0x2dbe('0x3f')](_0x31c616[_0x2dbe('0x3e')]);_0x360d0c['filters']=_['intersection'](_0x360d0c[_0x2dbe('0x3d')],_0x360d0c[_0x2dbe('0x3e')]);_0x2db1e0[_0x2dbe('0x41')]=_['intersection'](_0x360d0c['model'],qs[_0x2dbe('0x42')](_0x31c616[_0x2dbe('0x3e')][_0x2dbe('0x42')]));_0x2db1e0[_0x2dbe('0x41')]=_0x2db1e0[_0x2dbe('0x41')]['length']?_0x2db1e0[_0x2dbe('0x41')]:_0x360d0c[_0x2dbe('0x3d')];if(_0x31c616[_0x2dbe('0x3e')][_0x2dbe('0x4e')]){_0x2db1e0['include']=[{'all':!![]}];}_0x2db1e0=_[_0x2dbe('0x4b')]({},_0x2db1e0,_0x31c616[_0x2dbe('0x4c')]);return db[_0x2dbe('0x4d')][_0x2dbe('0x53')](_0x2db1e0)[_0x2dbe('0x1f')](handleEntityNotFound(_0x51ce0d,null))[_0x2dbe('0x1f')](respondWithResult(_0x51ce0d,null))[_0x2dbe('0x52')](handleError(_0x51ce0d,null));};exports[_0x2dbe('0x54')]=function(_0x2cf6aa,_0x120799){return db[_0x2dbe('0x4d')][_0x2dbe('0x54')](_0x2cf6aa['body'],{})[_0x2dbe('0x1f')](respondWithResult(_0x120799,0xc9))[_0x2dbe('0x52')](handleError(_0x120799,null));};exports['update']=function(_0x167161,_0x1e909c){if(_0x167161['body']['id']){delete _0x167161[_0x2dbe('0x55')]['id'];}return db[_0x2dbe('0x4d')][_0x2dbe('0x53')]({'where':{'id':_0x167161[_0x2dbe('0x56')]['id']}})[_0x2dbe('0x1f')](handleEntityNotFound(_0x1e909c,null))[_0x2dbe('0x1f')](saveUpdates(_0x167161[_0x2dbe('0x55')],null))[_0x2dbe('0x1f')](respondWithResult(_0x1e909c,null))[_0x2dbe('0x52')](handleError(_0x1e909c,null));};exports[_0x2dbe('0x35')]=function(_0x792f02,_0x16e161){return db[_0x2dbe('0x4d')][_0x2dbe('0x53')]({'where':{'id':_0x792f02[_0x2dbe('0x56')]['id']}})['then'](handleEntityNotFound(_0x16e161,null))['then'](removeEntity(_0x16e161,null))[_0x2dbe('0x52')](handleError(_0x16e161,null));};exports['getConfigurations']=function(_0x3a5b03,_0x6ff55b,_0x399882){var _0x1c09d8={};var _0x2ccce7={};var _0x5cb63a;var _0x3f52a8;return db['ZendeskAccount'][_0x2dbe('0x57')]({'where':{'id':_0x3a5b03[_0x2dbe('0x56')]['id']}})['then'](handleEntityNotFound(_0x6ff55b,null))[_0x2dbe('0x1f')](function(_0xaeda87){if(_0xaeda87){_0x5cb63a=_0xaeda87;_0x2ccce7['model']=_[_0x2dbe('0x3f')](db[_0x2dbe('0x58')]['rawAttributes']);_0x2ccce7[_0x2dbe('0x3e')]=_[_0x2dbe('0x3f')](_0x3a5b03[_0x2dbe('0x3e')]);_0x2ccce7[_0x2dbe('0x59')]=_[_0x2dbe('0x40')](_0x2ccce7[_0x2dbe('0x3d')],_0x2ccce7['query']);_0x1c09d8['attributes']=_[_0x2dbe('0x40')](_0x2ccce7[_0x2dbe('0x3d')],qs['fields'](_0x3a5b03[_0x2dbe('0x3e')][_0x2dbe('0x42')]));_0x1c09d8[_0x2dbe('0x41')]=_0x1c09d8[_0x2dbe('0x41')]['length']?_0x1c09d8[_0x2dbe('0x41')]:_0x2ccce7['model'];_0x1c09d8[_0x2dbe('0x46')]=qs[_0x2dbe('0x47')](_0x3a5b03['query']['sort']);_0x1c09d8[_0x2dbe('0x48')]=qs[_0x2dbe('0x59')](_['pick'](_0x3a5b03[_0x2dbe('0x3e')],_0x2ccce7[_0x2dbe('0x59')]));if(_0x3a5b03['query']['filter']){_0x1c09d8[_0x2dbe('0x48')]=_[_0x2dbe('0x4b')](_0x1c09d8[_0x2dbe('0x48')],{'$or':_[_0x2dbe('0x39')](_0x1c09d8['attributes'],function(_0xaa5e){var _0x253102={};_0x253102[_0xaa5e]={'$like':'%'+_0x3a5b03[_0x2dbe('0x3e')]['filter']+'%'};return _0x253102;})});}_0x1c09d8=_[_0x2dbe('0x4b')]({},_0x1c09d8,_0x3a5b03[_0x2dbe('0x4c')]);return _0x5cb63a[_0x2dbe('0x5a')](_0x1c09d8);}})[_0x2dbe('0x1f')](function(_0x5d9937){if(_0x5d9937){_0x3f52a8=_0x5d9937['length'];if(!_0x3a5b03[_0x2dbe('0x3e')]['hasOwnProperty'](_0x2dbe('0x45'))){_0x1c09d8[_0x2dbe('0x2f')]=qs['limit'](_0x3a5b03[_0x2dbe('0x3e')][_0x2dbe('0x2f')]);_0x1c09d8['offset']=qs[_0x2dbe('0x2e')](_0x3a5b03['query'][_0x2dbe('0x2e')]);}return _0x5cb63a['getConfigurations'](_0x1c09d8);}})['then'](function(_0x957c1e){if(_0x957c1e){return _0x957c1e?{'count':_0x3f52a8,'rows':_0x957c1e}:null;}})[_0x2dbe('0x1f')](respondWithResult(_0x6ff55b,null))[_0x2dbe('0x52')](handleError(_0x6ff55b,null));};exports[_0x2dbe('0x5b')]=function(_0x5e8c58,_0x5dfc06,_0x59bbf3){if(_0x5e8c58['body']['id']){delete _0x5e8c58[_0x2dbe('0x55')]['id'];}return db[_0x2dbe('0x4d')]['findOne']({'where':{'id':_0x5e8c58['params']['id']}})[_0x2dbe('0x1f')](handleEntityNotFound(_0x5dfc06,null))[_0x2dbe('0x1f')](function(_0x3efc08){if(_0x3efc08){_0x5e8c58['body'][_0x2dbe('0x5c')]=_0x3efc08['id'];_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x5d')]=integrations[_0x2dbe('0x5e')](_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x5f')],_0x5e8c58['body'][_0x2dbe('0x3c')]);_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x60')]=integrations[_0x2dbe('0x61')](_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x5f')],_0x5e8c58[_0x2dbe('0x55')][_0x2dbe('0x3c')]);return db[_0x2dbe('0x58')][_0x2dbe('0x54')](_0x5e8c58[_0x2dbe('0x55')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x2dbe('0x62')],'as':_0x2dbe('0x60')}]});}return null;})[_0x2dbe('0x1f')](respondWithResult(_0x5dfc06,null))[_0x2dbe('0x52')](handleError(_0x5dfc06,null));};exports[_0x2dbe('0x63')]=function(_0x1507e1,_0x114f67,_0x586587){var _0x21e19d='';return db[_0x2dbe('0x4d')]['findOne']({'where':{'id':_0x1507e1['params']['id']},'attributes':['id',_0x2dbe('0x64'),_0x2dbe('0x65'),_0x2dbe('0x66'),'authType',_0x2dbe('0x67')]})[_0x2dbe('0x1f')](handleEntityNotFound(_0x114f67,null))[_0x2dbe('0x1f')](function(_0x9803d2){if(_0x9803d2){_0x21e19d=_0x9803d2[_0x2dbe('0x67')];var _0x103ecd=_0x21e19d[_0x2dbe('0x68')](-0x1);if(_0x103ecd==='/'){_0x21e19d=_0x21e19d[_0x2dbe('0x69')](0x0,_0x21e19d[_0x2dbe('0x6a')](_0x103ecd));}var _0x570851={'method':_0x2dbe('0x6b'),'uri':util[_0x2dbe('0x6c')](_0x2dbe('0x6d'),_0x21e19d,_0x2dbe('0x6e')),'json':!![]};switch(_0x9803d2[_0x2dbe('0x6f')]){case _0x2dbe('0x65'):_0x570851[_0x2dbe('0x70')]={'Authorization':util[_0x2dbe('0x6c')](_0x2dbe('0x71'),new Buffer(util[_0x2dbe('0x6c')](_0x2dbe('0x72'),_0x9803d2[_0x2dbe('0x64')],_0x9803d2[_0x2dbe('0x65')]))[_0x2dbe('0x73')](_0x2dbe('0x74')))};break;case'token':_0x570851['headers']={'Authorization':util[_0x2dbe('0x6c')](_0x2dbe('0x71'),new Buffer(util[_0x2dbe('0x6c')](_0x2dbe('0x75'),_0x9803d2[_0x2dbe('0x64')],_0x9803d2['token']))[_0x2dbe('0x73')]('base64'))};break;default:throw new db[(_0x2dbe('0x1c'))][(_0x2dbe('0x1d'))](_0x2dbe('0x76'));}return rp(_0x570851);}})[_0x2dbe('0x1f')](function(_0x4b8a6b){if(_0x4b8a6b){var _0x4ecc55=[_0x2dbe('0x77'),_0x2dbe('0x78'),_0x2dbe('0x79'),'assignee'];_['remove'](_0x4b8a6b[_0x2dbe('0x6e')],function(_0x267366){return _0x4ecc55[_0x2dbe('0x7a')](_0x267366['type']);});return{'count':_0x4b8a6b['ticket_fields'][_0x2dbe('0x43')],'rows':_[_0x2dbe('0x39')](_0x4b8a6b['ticket_fields'],function(_0x17e31d){return{'id':_0x17e31d['id'],'name':_0x17e31d[_0x2dbe('0x7b')]>0x7?_0x17e31d['title']:_0x17e31d[_0x2dbe('0x3c')],'custom':_0x17e31d[_0x2dbe('0x7b')]>0x7?!![]:![],'options':_0x17e31d[_0x2dbe('0x7c')]?_0x17e31d[_0x2dbe('0x7c')]:_0x17e31d['custom_field_options']?_0x17e31d['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x114f67,null))[_0x2dbe('0x52')](function(_0x207046){var _0x2b332c=_0x1507e1['query']['test']?0x1f4:_0x207046[_0x2dbe('0x7d')]||0x1f4;logger[_0x2dbe('0x26')](_0x2dbe('0x7e'),'getFields',_0x2b332c,JSON['stringify'](_0x207046));delete _0x207046['name'];if(_0x2b332c===0x191){_0x2b332c=0x190;}_0x114f67[_0x2dbe('0x2a')](_0x2b332c)['send'](_0x1507e1[_0x2dbe('0x3e')][_0x2dbe('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x207046[_0x2dbe('0x7d')]}:_0x207046);});}; \ No newline at end of file +var _0xca74=['map','ZendeskAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','getConfigurations','pick','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','includes','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','send'];(function(_0x5934e1,_0x53e2f3){var _0x40d296=function(_0x29208a){while(--_0x29208a){_0x5934e1['push'](_0x5934e1['shift']());}};_0x40d296(++_0x53e2f3);}(_0xca74,0xca));var _0x4ca7=function(_0x32be74,_0x1c6d78){_0x32be74=_0x32be74-0x0;var _0x59407f=_0xca74[_0x32be74];return _0x59407f;};'use strict';var pdf=require(_0x4ca7('0x0'));var emlformat=require(_0x4ca7('0x1'));var rimraf=require(_0x4ca7('0x2'));var zipdir=require(_0x4ca7('0x3'));var jsonpatch=require(_0x4ca7('0x4'));var rp=require('request-promise');var moment=require(_0x4ca7('0x5'));var BPromise=require(_0x4ca7('0x6'));var Mustache=require(_0x4ca7('0x7'));var util=require(_0x4ca7('0x8'));var path=require(_0x4ca7('0x9'));var sox=require(_0x4ca7('0xa'));var csv=require(_0x4ca7('0xb'));var ejs=require(_0x4ca7('0xc'));var fs=require('fs');var _=require(_0x4ca7('0xd'));var squel=require(_0x4ca7('0xe'));var crypto=require(_0x4ca7('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4ca7('0x10'));var toCsv=require(_0x4ca7('0xb'));var querystring=require(_0x4ca7('0x11'));var Papa=require(_0x4ca7('0x12'));var Redis=require('ioredis');var authService=require(_0x4ca7('0x13'));var qs=require(_0x4ca7('0x14'));var as=require(_0x4ca7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ca7('0x16'))(_0x4ca7('0x17'));var utils=require('../../config/utils');var config=require(_0x4ca7('0x18'));var db=require(_0x4ca7('0x19'))['db'];var integrations=require(_0x4ca7('0x1a'));var jayson=require(_0x4ca7('0x1b'));var client=jayson[_0x4ca7('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x296ebf,_0x4812d3,_0x3da19c){if(_0x3da19c){var _0x1cfbde=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cfbde['test'](_0x4812d3)){return _0x296ebf;}else{throw new db[(_0x4ca7('0x1d'))][(_0x4ca7('0x1e'))](_0x4ca7('0x1f'));}}else{return _0x296ebf;}}function respondWithRpcPromise(_0x13acce,_0x420711,_0x18d85,_0x40bfac){return new BPromise(function(_0x568357,_0x6781e9){var _0x2242d3=_0x40bfac||client;return _0x2242d3['request'](_0x13acce,_0x18d85)['then'](function(_0x3cdfd9){logger['info'](_0x4ca7('0x20'),_0x420711,_0x4ca7('0x21'));logger[_0x4ca7('0x22')](_0x4ca7('0x23'),_0x420711,_0x4ca7('0x21'),JSON[_0x4ca7('0x24')](_0x3cdfd9));if(_0x3cdfd9[_0x4ca7('0x25')]){if(_0x3cdfd9[_0x4ca7('0x25')]['code']===0x1f4){logger[_0x4ca7('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x420711,_0x3cdfd9['error'][_0x4ca7('0x26')]);return _0x6781e9(_0x3cdfd9['error']['message']);}logger[_0x4ca7('0x25')](_0x4ca7('0x20'),_0x420711,_0x3cdfd9[_0x4ca7('0x25')][_0x4ca7('0x26')]);return _0x568357(_0x3cdfd9[_0x4ca7('0x25')]['message']);}else{logger[_0x4ca7('0x27')]('ZendeskAccount,\x20%s,\x20%s',_0x420711,'request\x20sent');_0x568357(_0x3cdfd9[_0x4ca7('0x28')][_0x4ca7('0x26')]);}})['catch'](function(_0x10ef28){logger[_0x4ca7('0x25')](_0x4ca7('0x20'),_0x420711,_0x10ef28);_0x6781e9(_0x10ef28);});});}function respondWithStatusCode(_0x2fa382,_0x22fc29){_0x22fc29=_0x22fc29||0xcc;return function(_0x2e163a){if(_0x2e163a){return _0x2fa382[_0x4ca7('0x29')](_0x22fc29);}return _0x2fa382['status'](_0x22fc29)['end']();};}function respondWithResult(_0x32c228,_0x96913e){_0x96913e=_0x96913e||0xc8;return function(_0x13db51){if(_0x13db51){return _0x32c228[_0x4ca7('0x2a')](_0x96913e)[_0x4ca7('0x2b')](_0x13db51);}};}function respondWithFilteredResult(_0x5a8296,_0x4de5f2){return function(_0x177506){if(_0x177506){var _0x153391=_0x177506[_0x4ca7('0x2c')],_0x2fb99d=_0x4de5f2[_0x4ca7('0x2d')],_0xcb0d96=_0x4de5f2[_0x4ca7('0x2d')]+_0x4de5f2[_0x4ca7('0x2e')],_0x3bc6ca;if(_0xcb0d96>=_0x153391){_0xcb0d96=_0x153391;_0x3bc6ca=0xc8;}else{_0x3bc6ca=0xce;}_0x5a8296[_0x4ca7('0x2a')](_0x3bc6ca);return _0x5a8296[_0x4ca7('0x2f')](_0x4ca7('0x30'),_0x2fb99d+'-'+_0xcb0d96+'/'+_0x153391)[_0x4ca7('0x2b')](_0x177506);}return null;};}function patchUpdates(_0xa3a313){return function(_0x5a273b){try{jsonpatch[_0x4ca7('0x31')](_0x5a273b,_0xa3a313,!![]);}catch(_0x58d639){return BPromise['reject'](_0x58d639);}return _0x5a273b[_0x4ca7('0x32')]();};}function saveUpdates(_0x458636,_0x2de525){return function(_0x42d757){if(_0x42d757){return _0x42d757[_0x4ca7('0x33')](_0x458636)[_0x4ca7('0x34')](function(_0x2baede){return _0x2baede;});}return null;};}function removeEntity(_0x4a2a77,_0x41d40b){return function(_0x571d18){if(_0x571d18){return _0x571d18[_0x4ca7('0x35')]()[_0x4ca7('0x34')](function(){_0x4a2a77[_0x4ca7('0x2a')](0xcc)[_0x4ca7('0x36')]();});}};}function handleEntityNotFound(_0x5fc3fa,_0x381ce1){return function(_0x333a0c){if(!_0x333a0c){_0x5fc3fa['sendStatus'](0x194);}return _0x333a0c;};}function handleError(_0x211c9a,_0x2cc8e3){_0x2cc8e3=_0x2cc8e3||0x1f4;return function(_0x3d385a){logger['error'](_0x3d385a[_0x4ca7('0x37')]);if(_0x3d385a[_0x4ca7('0x38')]){delete _0x3d385a[_0x4ca7('0x38')];}_0x211c9a['status'](_0x2cc8e3)[_0x4ca7('0x39')](_0x3d385a);};}exports['index']=function(_0x1f8f90,_0x238444){var _0x293abe={},_0x3abf1a={},_0x361dc2={'count':0x0,'rows':[]};var _0x492fba=_[_0x4ca7('0x3a')](db[_0x4ca7('0x3b')][_0x4ca7('0x3c')],function(_0x5d2578){return{'name':_0x5d2578[_0x4ca7('0x3d')],'type':_0x5d2578['type']['key']};});_0x3abf1a[_0x4ca7('0x3e')]=_[_0x4ca7('0x3a')](_0x492fba,'name');_0x3abf1a[_0x4ca7('0x3f')]=_[_0x4ca7('0x40')](_0x1f8f90[_0x4ca7('0x3f')]);_0x3abf1a[_0x4ca7('0x41')]=_[_0x4ca7('0x42')](_0x3abf1a[_0x4ca7('0x3e')],_0x3abf1a[_0x4ca7('0x3f')]);_0x293abe['attributes']=_[_0x4ca7('0x42')](_0x3abf1a[_0x4ca7('0x3e')],qs[_0x4ca7('0x43')](_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x43')]));_0x293abe[_0x4ca7('0x44')]=_0x293abe[_0x4ca7('0x44')][_0x4ca7('0x45')]?_0x293abe[_0x4ca7('0x44')]:_0x3abf1a[_0x4ca7('0x3e')];if(!_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x46')](_0x4ca7('0x47'))){_0x293abe[_0x4ca7('0x2e')]=qs[_0x4ca7('0x2e')](_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x2e')]);_0x293abe['offset']=qs[_0x4ca7('0x2d')](_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x2d')]);}_0x293abe[_0x4ca7('0x48')]=qs[_0x4ca7('0x49')](_0x1f8f90[_0x4ca7('0x3f')]['sort']);_0x293abe['where']=qs[_0x4ca7('0x41')](_['pick'](_0x1f8f90[_0x4ca7('0x3f')],_0x3abf1a[_0x4ca7('0x41')]),_0x492fba);if(_0x1f8f90[_0x4ca7('0x3f')][_0x4ca7('0x4a')]){_0x293abe[_0x4ca7('0x4b')]=_[_0x4ca7('0x4c')](_0x293abe['where'],{'$or':_[_0x4ca7('0x3a')](_0x492fba,function(_0x157684){if(_0x157684[_0x4ca7('0x4d')]!=='VIRTUAL'){var _0x2bec8e={};_0x2bec8e[_0x157684[_0x4ca7('0x38')]]={'$like':'%'+_0x1f8f90['query'][_0x4ca7('0x4a')]+'%'};return _0x2bec8e;}})});}_0x293abe=_[_0x4ca7('0x4c')]({},_0x293abe,_0x1f8f90['options']);var _0x1a9896={'where':_0x293abe[_0x4ca7('0x4b')]};return db['ZendeskAccount'][_0x4ca7('0x2c')](_0x1a9896)[_0x4ca7('0x34')](function(_0x49ce2b){_0x361dc2[_0x4ca7('0x2c')]=_0x49ce2b;if(_0x1f8f90[_0x4ca7('0x3f')]['includeAll']){_0x293abe[_0x4ca7('0x4e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4ca7('0x4f')](_0x293abe);})[_0x4ca7('0x34')](function(_0x4b0f72){_0x361dc2[_0x4ca7('0x50')]=_0x4b0f72;return _0x361dc2;})[_0x4ca7('0x34')](respondWithFilteredResult(_0x238444,_0x293abe))[_0x4ca7('0x51')](handleError(_0x238444,null));};exports[_0x4ca7('0x52')]=function(_0x52a33a,_0x4ee596){var _0x1997bb={'raw':![],'where':{'id':_0x52a33a[_0x4ca7('0x53')]['id']}},_0x9c67b6={};_0x9c67b6[_0x4ca7('0x3e')]=_[_0x4ca7('0x40')](db['ZendeskAccount']['rawAttributes']);_0x9c67b6[_0x4ca7('0x3f')]=_[_0x4ca7('0x40')](_0x52a33a[_0x4ca7('0x3f')]);_0x9c67b6['filters']=_[_0x4ca7('0x42')](_0x9c67b6[_0x4ca7('0x3e')],_0x9c67b6[_0x4ca7('0x3f')]);_0x1997bb[_0x4ca7('0x44')]=_[_0x4ca7('0x42')](_0x9c67b6[_0x4ca7('0x3e')],qs['fields'](_0x52a33a[_0x4ca7('0x3f')][_0x4ca7('0x43')]));_0x1997bb[_0x4ca7('0x44')]=_0x1997bb['attributes']['length']?_0x1997bb[_0x4ca7('0x44')]:_0x9c67b6[_0x4ca7('0x3e')];if(_0x52a33a[_0x4ca7('0x3f')][_0x4ca7('0x54')]){_0x1997bb[_0x4ca7('0x4e')]=[{'all':!![]}];}_0x1997bb=_['merge']({},_0x1997bb,_0x52a33a[_0x4ca7('0x55')]);return db['ZendeskAccount']['find'](_0x1997bb)[_0x4ca7('0x34')](handleEntityNotFound(_0x4ee596,null))['then'](respondWithResult(_0x4ee596,null))[_0x4ca7('0x51')](handleError(_0x4ee596,null));};exports[_0x4ca7('0x56')]=function(_0x44e1bc,_0x3b3c49){return db['ZendeskAccount'][_0x4ca7('0x56')](_0x44e1bc[_0x4ca7('0x57')],{})[_0x4ca7('0x34')](respondWithResult(_0x3b3c49,0xc9))['catch'](handleError(_0x3b3c49,null));};exports['update']=function(_0x21c942,_0x51adb2){if(_0x21c942['body']['id']){delete _0x21c942['body']['id'];}return db['ZendeskAccount'][_0x4ca7('0x58')]({'where':{'id':_0x21c942[_0x4ca7('0x53')]['id']}})[_0x4ca7('0x34')](handleEntityNotFound(_0x51adb2,null))[_0x4ca7('0x34')](saveUpdates(_0x21c942[_0x4ca7('0x57')],null))[_0x4ca7('0x34')](respondWithResult(_0x51adb2,null))[_0x4ca7('0x51')](handleError(_0x51adb2,null));};exports[_0x4ca7('0x35')]=function(_0x15e03c,_0x172fbe){return db[_0x4ca7('0x3b')][_0x4ca7('0x58')]({'where':{'id':_0x15e03c[_0x4ca7('0x53')]['id']}})[_0x4ca7('0x34')](handleEntityNotFound(_0x172fbe,null))[_0x4ca7('0x34')](removeEntity(_0x172fbe,null))[_0x4ca7('0x51')](handleError(_0x172fbe,null));};exports[_0x4ca7('0x59')]=function(_0x2285bc,_0x43574c,_0x21319a){var _0x3b7f44={};var _0x1404cc={};var _0x4ff382;var _0x4278e7;return db[_0x4ca7('0x3b')]['findOne']({'where':{'id':_0x2285bc[_0x4ca7('0x53')]['id']}})[_0x4ca7('0x34')](handleEntityNotFound(_0x43574c,null))[_0x4ca7('0x34')](function(_0x2cde0d){if(_0x2cde0d){_0x4ff382=_0x2cde0d;_0x1404cc[_0x4ca7('0x3e')]=_[_0x4ca7('0x40')](db['ZendeskConfiguration'][_0x4ca7('0x3c')]);_0x1404cc[_0x4ca7('0x3f')]=_[_0x4ca7('0x40')](_0x2285bc[_0x4ca7('0x3f')]);_0x1404cc[_0x4ca7('0x41')]=_[_0x4ca7('0x42')](_0x1404cc['model'],_0x1404cc[_0x4ca7('0x3f')]);_0x3b7f44[_0x4ca7('0x44')]=_['intersection'](_0x1404cc[_0x4ca7('0x3e')],qs[_0x4ca7('0x43')](_0x2285bc[_0x4ca7('0x3f')][_0x4ca7('0x43')]));_0x3b7f44['attributes']=_0x3b7f44[_0x4ca7('0x44')][_0x4ca7('0x45')]?_0x3b7f44[_0x4ca7('0x44')]:_0x1404cc[_0x4ca7('0x3e')];_0x3b7f44['order']=qs[_0x4ca7('0x49')](_0x2285bc['query'][_0x4ca7('0x49')]);_0x3b7f44[_0x4ca7('0x4b')]=qs[_0x4ca7('0x41')](_[_0x4ca7('0x5a')](_0x2285bc['query'],_0x1404cc[_0x4ca7('0x41')]));if(_0x2285bc[_0x4ca7('0x3f')]['filter']){_0x3b7f44['where']=_[_0x4ca7('0x4c')](_0x3b7f44['where'],{'$or':_[_0x4ca7('0x3a')](_0x3b7f44[_0x4ca7('0x44')],function(_0x270b99){var _0x15344d={};_0x15344d[_0x270b99]={'$like':'%'+_0x2285bc[_0x4ca7('0x3f')]['filter']+'%'};return _0x15344d;})});}_0x3b7f44=_[_0x4ca7('0x4c')]({},_0x3b7f44,_0x2285bc[_0x4ca7('0x55')]);return _0x4ff382[_0x4ca7('0x59')](_0x3b7f44);}})[_0x4ca7('0x34')](function(_0x435242){if(_0x435242){_0x4278e7=_0x435242['length'];if(!_0x2285bc[_0x4ca7('0x3f')]['hasOwnProperty'](_0x4ca7('0x47'))){_0x3b7f44[_0x4ca7('0x2e')]=qs[_0x4ca7('0x2e')](_0x2285bc[_0x4ca7('0x3f')]['limit']);_0x3b7f44[_0x4ca7('0x2d')]=qs[_0x4ca7('0x2d')](_0x2285bc[_0x4ca7('0x3f')][_0x4ca7('0x2d')]);}return _0x4ff382[_0x4ca7('0x59')](_0x3b7f44);}})[_0x4ca7('0x34')](function(_0x11cde9){if(_0x11cde9){return _0x11cde9?{'count':_0x4278e7,'rows':_0x11cde9}:null;}})['then'](respondWithResult(_0x43574c,null))[_0x4ca7('0x51')](handleError(_0x43574c,null));};exports[_0x4ca7('0x5b')]=function(_0x401300,_0x295d74,_0x27e68f){if(_0x401300[_0x4ca7('0x57')]['id']){delete _0x401300[_0x4ca7('0x57')]['id'];}return db[_0x4ca7('0x3b')][_0x4ca7('0x5c')]({'where':{'id':_0x401300[_0x4ca7('0x53')]['id']}})['then'](handleEntityNotFound(_0x295d74,null))[_0x4ca7('0x34')](function(_0x42955c){if(_0x42955c){_0x401300[_0x4ca7('0x57')][_0x4ca7('0x5d')]=_0x42955c['id'];_0x401300[_0x4ca7('0x57')][_0x4ca7('0x5e')]=integrations['getSubjects'](_0x401300['body'][_0x4ca7('0x5f')],_0x401300[_0x4ca7('0x57')]['type']);_0x401300[_0x4ca7('0x57')][_0x4ca7('0x60')]=integrations[_0x4ca7('0x61')](_0x401300[_0x4ca7('0x57')][_0x4ca7('0x5f')],_0x401300[_0x4ca7('0x57')][_0x4ca7('0x4d')]);return db[_0x4ca7('0x62')][_0x4ca7('0x56')](_0x401300[_0x4ca7('0x57')],{'include':[{'model':db[_0x4ca7('0x63')],'as':'Subjects'},{'model':db[_0x4ca7('0x63')],'as':_0x4ca7('0x60')}]});}return null;})[_0x4ca7('0x34')](respondWithResult(_0x295d74,null))[_0x4ca7('0x51')](handleError(_0x295d74,null));};exports[_0x4ca7('0x64')]=function(_0x48af6b,_0x4c0ac4,_0x18c0c6){var _0x2560a3='';return db[_0x4ca7('0x3b')][_0x4ca7('0x5c')]({'where':{'id':_0x48af6b[_0x4ca7('0x53')]['id']},'attributes':['id',_0x4ca7('0x65'),'password',_0x4ca7('0x66'),_0x4ca7('0x67'),_0x4ca7('0x68')]})[_0x4ca7('0x34')](handleEntityNotFound(_0x4c0ac4,null))[_0x4ca7('0x34')](function(_0x4b33d9){if(_0x4b33d9){_0x2560a3=_0x4b33d9[_0x4ca7('0x68')];var _0x14c1d1=_0x2560a3[_0x4ca7('0x69')](-0x1);if(_0x14c1d1==='/'){_0x2560a3=_0x2560a3[_0x4ca7('0x6a')](0x0,_0x2560a3[_0x4ca7('0x6b')](_0x14c1d1));}var _0x448e70={'method':_0x4ca7('0x6c'),'uri':util[_0x4ca7('0x6d')](_0x4ca7('0x6e'),_0x2560a3,_0x4ca7('0x6f')),'json':!![]};switch(_0x4b33d9['authType']){case _0x4ca7('0x70'):_0x448e70[_0x4ca7('0x71')]={'Authorization':util[_0x4ca7('0x6d')](_0x4ca7('0x72'),new Buffer(util['format'](_0x4ca7('0x73'),_0x4b33d9[_0x4ca7('0x65')],_0x4b33d9[_0x4ca7('0x70')]))['toString'](_0x4ca7('0x74')))};break;case'token':_0x448e70[_0x4ca7('0x71')]={'Authorization':util[_0x4ca7('0x6d')]('Basic\x20%s',new Buffer(util['format'](_0x4ca7('0x75'),_0x4b33d9[_0x4ca7('0x65')],_0x4b33d9[_0x4ca7('0x66')]))['toString'](_0x4ca7('0x74')))};break;default:throw new db[(_0x4ca7('0x1d'))][(_0x4ca7('0x1e'))](_0x4ca7('0x76'));}return rp(_0x448e70);}})['then'](function(_0x44fdbf){if(_0x44fdbf){var _0x1884a4=[_0x4ca7('0x77'),_0x4ca7('0x78'),_0x4ca7('0x79'),_0x4ca7('0x7a')];_['remove'](_0x44fdbf['ticket_fields'],function(_0x17ff58){return _0x1884a4[_0x4ca7('0x7b')](_0x17ff58[_0x4ca7('0x4d')]);});return{'count':_0x44fdbf['ticket_fields'][_0x4ca7('0x45')],'rows':_[_0x4ca7('0x3a')](_0x44fdbf[_0x4ca7('0x6f')],function(_0x378cf2){return{'id':_0x378cf2['id'],'name':_0x378cf2[_0x4ca7('0x7c')]>0x7?_0x378cf2['title']:_0x378cf2[_0x4ca7('0x4d')],'custom':_0x378cf2[_0x4ca7('0x7c')]>0x7?!![]:![],'options':_0x378cf2[_0x4ca7('0x7d')]?_0x378cf2[_0x4ca7('0x7d')]:_0x378cf2[_0x4ca7('0x7e')]?_0x378cf2[_0x4ca7('0x7e')]:[]};})};}})[_0x4ca7('0x34')](respondWithResult(_0x4c0ac4,null))[_0x4ca7('0x51')](function(_0x37d3bd){var _0x53ce09=_0x48af6b[_0x4ca7('0x3f')]['test']?0x1f4:_0x37d3bd[_0x4ca7('0x7f')]||0x1f4;logger[_0x4ca7('0x25')](_0x4ca7('0x80'),_0x4ca7('0x64'),_0x53ce09,JSON[_0x4ca7('0x24')](_0x37d3bd));delete _0x37d3bd['name'];if(_0x53ce09===0x191){_0x53ce09=0x190;}_0x4c0ac4[_0x4ca7('0x2a')](_0x53ce09)[_0x4ca7('0x39')](_0x48af6b[_0x4ca7('0x3f')][_0x4ca7('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x37d3bd[_0x4ca7('0x7f')]}:_0x37d3bd);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5fb7714..b77cb7d 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 _0xf543=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash'];(function(_0x572715,_0x28b3ac){var _0x9d97c6=function(_0x4a496a){while(--_0x4a496a){_0x572715['push'](_0x572715['shift']());}};_0x9d97c6(++_0x28b3ac);}(_0xf543,0x77));var _0x3f54=function(_0x15003d,_0x1f5482){_0x15003d=_0x15003d-0x0;var _0x4c9bdd=_0xf543[_0x15003d];return _0x4c9bdd;};'use strict';var _=require(_0x3f54('0x0'));var util=require(_0x3f54('0x1'));var logger=require(_0x3f54('0x2'))(_0x3f54('0x3'));var moment=require(_0x3f54('0x4'));var BPromise=require(_0x3f54('0x5'));var rp=require(_0x3f54('0x6'));var fs=require('fs');var path=require(_0x3f54('0x7'));var rimraf=require(_0x3f54('0x8'));var config=require(_0x3f54('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3f54('0xa')]=function(_0x29b354,_0x1afdd8){return _0x29b354[_0x3f54('0xb')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8643=['lodash','util','api','moment','bluebird','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x510875,_0x45af7d){var _0x243c42=function(_0x2c1eff){while(--_0x2c1eff){_0x510875['push'](_0x510875['shift']());}};_0x243c42(++_0x45af7d);}(_0x8643,0xb0));var _0x3864=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8643[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x3864('0x0'));var util=require(_0x3864('0x1'));var logger=require('../../config/logger')(_0x3864('0x2'));var moment=require(_0x3864('0x3'));var BPromise=require(_0x3864('0x4'));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(_0x3864('0x5'));var integrations=require(_0x3864('0x6'));module[_0x3864('0x7')]=function(_0x41d3bc,_0x3a8ced){return _0x41d3bc[_0x3864('0x8')](_0x3864('0x9'),attributes,{'tableName':_0x3864('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index c5dc1ee..e24c86d 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x133296,_0xe8ff9a){var _0x193517=function(_0x161ffd){while(--_0x161ffd){_0x133296['push'](_0x133296['shift']());}};_0x193517(++_0xe8ff9a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetZendeskAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x195848,_0xf1dce3){var _0xe7511=function(_0x2b12bf){while(--_0x2b12bf){_0x195848['push'](_0x195848['shift']());}};_0xe7511(++_0xf1dce3);}(_0xe706,0xa3));var _0x6e70=function(_0x139d3a,_0x23931e){_0x139d3a=_0x139d3a-0x0;var _0x345d6b=_0xe706[_0x139d3a];return _0x345d6b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 3a4c822..c49f831 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 _0x43a4=['Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x33b6c9,_0x13a936){var _0x2090f3=function(_0x23e392){while(--_0x23e392){_0x33b6c9['push'](_0x33b6c9['shift']());}};_0x2090f3(++_0x13a936);}(_0x43a4,0x82));var _0x443a=function(_0x364f67,_0x24b0d7){_0x364f67=_0x364f67-0x0;var _0x474f32=_0x43a4[_0x364f67];return _0x474f32;};'use strict';var multer=require(_0x443a('0x0'));var util=require(_0x443a('0x1'));var path=require(_0x443a('0x2'));var timeout=require(_0x443a('0x3'));var express=require(_0x443a('0x4'));var router=express[_0x443a('0x5')]();var auth=require(_0x443a('0x6'));var interaction=require(_0x443a('0x7'));var config=require('../../config/environment');var controller=require(_0x443a('0x8'));router['get']('/',auth[_0x443a('0x9')](),controller['index']);router[_0x443a('0xa')](_0x443a('0xb'),auth[_0x443a('0x9')](),controller[_0x443a('0xc')]);router[_0x443a('0xa')](_0x443a('0xd'),auth[_0x443a('0x9')](),controller[_0x443a('0xe')]);router[_0x443a('0xa')](_0x443a('0xf'),auth[_0x443a('0x9')](),controller['getSubjects']);router[_0x443a('0xa')](_0x443a('0x10'),auth['isAuthenticated'](),controller[_0x443a('0x11')]);router[_0x443a('0xa')]('/:id/tags',auth[_0x443a('0x9')](),controller[_0x443a('0x12')]);router[_0x443a('0x13')]('/',auth['isAuthenticated'](),controller[_0x443a('0x14')]);router['post'](_0x443a('0x15'),auth[_0x443a('0x9')](),controller[_0x443a('0x16')]);router[_0x443a('0x17')](_0x443a('0xb'),auth[_0x443a('0x9')](),controller[_0x443a('0x18')]);router['delete'](_0x443a('0xb'),auth['isAuthenticated'](),controller[_0x443a('0x19')]);module[_0x443a('0x1a')]=router; \ No newline at end of file +var _0x1576=['show','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','/:id'];(function(_0x22f846,_0x395ef9){var _0x4f80e5=function(_0x1147ce){while(--_0x1147ce){_0x22f846['push'](_0x22f846['shift']());}};_0x4f80e5(++_0x395ef9);}(_0x1576,0xed));var _0x6157=function(_0xddcb6f,_0x34f5c1){_0xddcb6f=_0xddcb6f-0x0;var _0x22a491=_0x1576[_0xddcb6f];return _0x22a491;};'use strict';var multer=require(_0x6157('0x0'));var util=require(_0x6157('0x1'));var path=require(_0x6157('0x2'));var timeout=require(_0x6157('0x3'));var express=require(_0x6157('0x4'));var router=express[_0x6157('0x5')]();var auth=require(_0x6157('0x6'));var interaction=require(_0x6157('0x7'));var config=require(_0x6157('0x8'));var controller=require(_0x6157('0x9'));router[_0x6157('0xa')]('/',auth[_0x6157('0xb')](),controller['index']);router[_0x6157('0xa')](_0x6157('0xc'),auth[_0x6157('0xb')](),controller[_0x6157('0xd')]);router[_0x6157('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x6157('0xa')](_0x6157('0xe'),auth[_0x6157('0xb')](),controller[_0x6157('0xf')]);router[_0x6157('0xa')](_0x6157('0x10'),auth[_0x6157('0xb')](),controller['getDescriptions']);router['get'](_0x6157('0x11'),auth['isAuthenticated'](),controller[_0x6157('0x12')]);router[_0x6157('0x13')]('/',auth[_0x6157('0xb')](),controller[_0x6157('0x14')]);router[_0x6157('0x13')](_0x6157('0x11'),auth[_0x6157('0xb')](),controller['setTags']);router[_0x6157('0x15')](_0x6157('0xc'),auth[_0x6157('0xb')](),controller['update']);router[_0x6157('0x16')](_0x6157('0xc'),auth[_0x6157('0xb')](),controller[_0x6157('0x17')]);module[_0x6157('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 21112a0..3cb6696 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 _0xb5d3=['exports','STRING','sequelize'];(function(_0x21fa5e,_0x1c73ff){var _0x582fdd=function(_0x15dd4b){while(--_0x15dd4b){_0x21fa5e['push'](_0x21fa5e['shift']());}};_0x582fdd(++_0x1c73ff);}(_0xb5d3,0x170));var _0x3b5d=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xb5d3[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0x3b5d('0x0'));module[_0x3b5d('0x1')]={'name':{'type':Sequelize[_0x3b5d('0x2')]},'description':{'type':Sequelize[_0x3b5d('0x2')]}}; \ No newline at end of file +var _0x6c88=['exports','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6c88,0xe4));var _0x86c8=function(_0x315b7c,_0x19ff8e){_0x315b7c=_0x315b7c-0x0;var _0x3a99eb=_0x6c88[_0x315b7c];return _0x3a99eb;};'use strict';var Sequelize=require('sequelize');module[_0x86c8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x86c8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 03c266d..a667b69 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 _0x65b4=['querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','getFields','ZendeskField','nolimit','getSubjects','getDescriptions','findOne','Tag','getTags','setTags','ids','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js'];(function(_0x14e75e,_0x43a34d){var _0x5fc83b=function(_0x37bcb1){while(--_0x37bcb1){_0x14e75e['push'](_0x14e75e['shift']());}};_0x5fc83b(++_0x43a34d);}(_0x65b4,0x172));var _0x465b=function(_0x1c3b40,_0x1bb555){_0x1c3b40=_0x1c3b40-0x0;var _0x38f43a=_0x65b4[_0x1c3b40];return _0x38f43a;};'use strict';var pdf=require(_0x465b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x465b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x465b('0x2'));var moment=require(_0x465b('0x3'));var BPromise=require(_0x465b('0x4'));var Mustache=require(_0x465b('0x5'));var util=require(_0x465b('0x6'));var path=require(_0x465b('0x7'));var sox=require(_0x465b('0x8'));var csv=require(_0x465b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x465b('0xa'));var squel=require('squel');var crypto=require(_0x465b('0xb'));var jsforce=require(_0x465b('0xc'));var deskjs=require(_0x465b('0xd'));var toCsv=require(_0x465b('0x9'));var querystring=require(_0x465b('0xe'));var Papa=require(_0x465b('0xf'));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(_0x465b('0x10'));var logger=require(_0x465b('0x11'))(_0x465b('0x12'));var utils=require(_0x465b('0x13'));var config=require(_0x465b('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x465b('0x15')][_0x465b('0x16')]({'port':0x232a});function checkPasswordPattern(_0x35d347,_0xfc0753,_0x1f9650){if(_0x1f9650){var _0x4e1aea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e1aea[_0x465b('0x17')](_0xfc0753)){return _0x35d347;}else{throw new db[(_0x465b('0x18'))]['ValidationError'](_0x465b('0x19'));}}else{return _0x35d347;}}function respondWithRpcPromise(_0x4d3af7,_0x3a2554,_0x13c21e,_0x26dfba){return new BPromise(function(_0x12a649,_0xdc1f7b){var _0x59a3c4=_0x26dfba||client;return _0x59a3c4[_0x465b('0x1a')](_0x4d3af7,_0x13c21e)['then'](function(_0x3e6b5d){logger[_0x465b('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a2554,'request\x20sent');logger['debug'](_0x465b('0x1c'),_0x3a2554,_0x465b('0x1d'),JSON[_0x465b('0x1e')](_0x3e6b5d));if(_0x3e6b5d['error']){if(_0x3e6b5d[_0x465b('0x1f')][_0x465b('0x20')]===0x1f4){logger[_0x465b('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3a2554,_0x3e6b5d[_0x465b('0x1f')][_0x465b('0x21')]);return _0xdc1f7b(_0x3e6b5d['error'][_0x465b('0x21')]);}logger[_0x465b('0x1f')](_0x465b('0x22'),_0x3a2554,_0x3e6b5d[_0x465b('0x1f')][_0x465b('0x21')]);return _0x12a649(_0x3e6b5d[_0x465b('0x1f')]['message']);}else{logger[_0x465b('0x1b')](_0x465b('0x22'),_0x3a2554,_0x465b('0x1d'));_0x12a649(_0x3e6b5d[_0x465b('0x23')][_0x465b('0x21')]);}})[_0x465b('0x24')](function(_0x4392fa){logger['error'](_0x465b('0x22'),_0x3a2554,_0x4392fa);_0xdc1f7b(_0x4392fa);});});}function respondWithStatusCode(_0x4715d4,_0x11fa3b){_0x11fa3b=_0x11fa3b||0xcc;return function(_0x4e8a75){if(_0x4e8a75){return _0x4715d4['sendStatus'](_0x11fa3b);}return _0x4715d4['status'](_0x11fa3b)[_0x465b('0x25')]();};}function respondWithResult(_0x47fc09,_0x11e845){_0x11e845=_0x11e845||0xc8;return function(_0x16fe68){if(_0x16fe68){return _0x47fc09[_0x465b('0x26')](_0x11e845)[_0x465b('0x27')](_0x16fe68);}};}function respondWithFilteredResult(_0x367b83,_0x4e3ec5){return function(_0x325775){if(_0x325775){var _0x548904=_0x325775[_0x465b('0x28')],_0x34fc9d=_0x4e3ec5[_0x465b('0x29')],_0x3e4e66=_0x4e3ec5['offset']+_0x4e3ec5[_0x465b('0x2a')],_0x473bc1;if(_0x3e4e66>=_0x548904){_0x3e4e66=_0x548904;_0x473bc1=0xc8;}else{_0x473bc1=0xce;}_0x367b83[_0x465b('0x26')](_0x473bc1);return _0x367b83['set'](_0x465b('0x2b'),_0x34fc9d+'-'+_0x3e4e66+'/'+_0x548904)[_0x465b('0x27')](_0x325775);}return null;};}function patchUpdates(_0x36a34e){return function(_0x35eb05){try{jsonpatch[_0x465b('0x2c')](_0x35eb05,_0x36a34e,!![]);}catch(_0x34095d){return BPromise[_0x465b('0x2d')](_0x34095d);}return _0x35eb05[_0x465b('0x2e')]();};}function saveUpdates(_0x2b3b16,_0x4200cf){return function(_0x3eab1a){if(_0x3eab1a){return _0x3eab1a[_0x465b('0x2f')](_0x2b3b16)[_0x465b('0x30')](function(_0x4fe7da){return _0x4fe7da;});}return null;};}function removeEntity(_0x7859c7,_0x10ca21){return function(_0x231e5b){if(_0x231e5b){return _0x231e5b[_0x465b('0x31')]()[_0x465b('0x30')](function(){_0x7859c7[_0x465b('0x26')](0xcc)[_0x465b('0x25')]();});}};}function handleEntityNotFound(_0x3706bf,_0x55878b){return function(_0x2de40a){if(!_0x2de40a){_0x3706bf[_0x465b('0x32')](0x194);}return _0x2de40a;};}function handleError(_0xa2356d,_0x47e410){_0x47e410=_0x47e410||0x1f4;return function(_0x92c211){logger['error'](_0x92c211[_0x465b('0x33')]);if(_0x92c211[_0x465b('0x34')]){delete _0x92c211[_0x465b('0x34')];}_0xa2356d[_0x465b('0x26')](_0x47e410)[_0x465b('0x35')](_0x92c211);};}exports['index']=function(_0x3d9bc7,_0x40cc79){var _0x14ae6a={},_0x241c60={},_0x4d9abf={'count':0x0,'rows':[]};var _0x3d8756=_[_0x465b('0x36')](db[_0x465b('0x37')][_0x465b('0x38')],function(_0x4d0b34){return{'name':_0x4d0b34[_0x465b('0x39')],'type':_0x4d0b34[_0x465b('0x3a')][_0x465b('0x3b')]};});_0x241c60['model']=_[_0x465b('0x36')](_0x3d8756,_0x465b('0x34'));_0x241c60[_0x465b('0x3c')]=_[_0x465b('0x3d')](_0x3d9bc7[_0x465b('0x3c')]);_0x241c60['filters']=_[_0x465b('0x3e')](_0x241c60[_0x465b('0x3f')],_0x241c60[_0x465b('0x3c')]);_0x14ae6a[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x241c60['model'],qs[_0x465b('0x41')](_0x3d9bc7['query'][_0x465b('0x41')]));_0x14ae6a[_0x465b('0x40')]=_0x14ae6a[_0x465b('0x40')][_0x465b('0x42')]?_0x14ae6a[_0x465b('0x40')]:_0x241c60[_0x465b('0x3f')];if(!_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x43')]('nolimit')){_0x14ae6a['limit']=qs['limit'](_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x2a')]);_0x14ae6a[_0x465b('0x29')]=qs[_0x465b('0x29')](_0x3d9bc7['query'][_0x465b('0x29')]);}_0x14ae6a[_0x465b('0x44')]=qs[_0x465b('0x45')](_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x45')]);_0x14ae6a[_0x465b('0x46')]=qs[_0x465b('0x47')](_[_0x465b('0x48')](_0x3d9bc7[_0x465b('0x3c')],_0x241c60['filters']),_0x3d8756);if(_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x49')]){_0x14ae6a['where']=_[_0x465b('0x4a')](_0x14ae6a[_0x465b('0x46')],{'$or':_['map'](_0x3d8756,function(_0x389327){if(_0x389327['type']!==_0x465b('0x4b')){var _0x4fae7e={};_0x4fae7e[_0x389327[_0x465b('0x34')]]={'$like':'%'+_0x3d9bc7['query'][_0x465b('0x49')]+'%'};return _0x4fae7e;}})});}_0x14ae6a=_[_0x465b('0x4a')]({},_0x14ae6a,_0x3d9bc7[_0x465b('0x4c')]);var _0x232abd={'where':_0x14ae6a[_0x465b('0x46')]};return db[_0x465b('0x37')][_0x465b('0x28')](_0x232abd)['then'](function(_0x50243f){_0x4d9abf[_0x465b('0x28')]=_0x50243f;if(_0x3d9bc7[_0x465b('0x3c')][_0x465b('0x4d')]){_0x14ae6a[_0x465b('0x4e')]=[{'all':!![]}];}return db[_0x465b('0x37')][_0x465b('0x4f')](_0x14ae6a);})[_0x465b('0x30')](function(_0x5378dd){_0x4d9abf[_0x465b('0x50')]=_0x5378dd;return _0x4d9abf;})[_0x465b('0x30')](respondWithFilteredResult(_0x40cc79,_0x14ae6a))['catch'](handleError(_0x40cc79,null));};exports[_0x465b('0x51')]=function(_0x1ba8e2,_0x30814d){var _0x4429a5={'raw':![],'where':{'id':_0x1ba8e2[_0x465b('0x52')]['id']}},_0x30da30={};_0x30da30[_0x465b('0x3f')]=_[_0x465b('0x3d')](db[_0x465b('0x37')]['rawAttributes']);_0x30da30[_0x465b('0x3c')]=_[_0x465b('0x3d')](_0x1ba8e2[_0x465b('0x3c')]);_0x30da30[_0x465b('0x47')]=_[_0x465b('0x3e')](_0x30da30[_0x465b('0x3f')],_0x30da30['query']);_0x4429a5[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x30da30['model'],qs[_0x465b('0x41')](_0x1ba8e2[_0x465b('0x3c')][_0x465b('0x41')]));_0x4429a5['attributes']=_0x4429a5[_0x465b('0x40')]['length']?_0x4429a5[_0x465b('0x40')]:_0x30da30['model'];if(_0x1ba8e2[_0x465b('0x3c')][_0x465b('0x4d')]){_0x4429a5[_0x465b('0x4e')]=[{'all':!![]}];}_0x4429a5=_[_0x465b('0x4a')]({},_0x4429a5,_0x1ba8e2[_0x465b('0x4c')]);return db[_0x465b('0x37')]['find'](_0x4429a5)['then'](handleEntityNotFound(_0x30814d,null))[_0x465b('0x30')](respondWithResult(_0x30814d,null))[_0x465b('0x24')](handleError(_0x30814d,null));};exports['create']=function(_0x5bea3a,_0x522c4f){return db[_0x465b('0x37')][_0x465b('0x53')](_0x5bea3a[_0x465b('0x54')],{})[_0x465b('0x30')](respondWithResult(_0x522c4f,0xc9))[_0x465b('0x24')](handleError(_0x522c4f,null));};exports['update']=function(_0x3478ef,_0x3133e0){if(_0x3478ef['body']['id']){delete _0x3478ef[_0x465b('0x54')]['id'];}return db[_0x465b('0x37')][_0x465b('0x55')]({'where':{'id':_0x3478ef[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x3133e0,null))[_0x465b('0x30')](saveUpdates(_0x3478ef[_0x465b('0x54')],null))['then'](respondWithResult(_0x3133e0,null))[_0x465b('0x24')](handleError(_0x3133e0,null));};exports[_0x465b('0x31')]=function(_0x151c84,_0x3ea3fa){return db[_0x465b('0x37')][_0x465b('0x55')]({'where':{'id':_0x151c84[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x3ea3fa,null))[_0x465b('0x30')](removeEntity(_0x3ea3fa,null))[_0x465b('0x24')](handleError(_0x3ea3fa,null));};exports[_0x465b('0x56')]=function(_0x45d600,_0x2154af,_0x42cec4){var _0x5ea390={};var _0x28d865={};var _0x174b72;var _0x239bb6;return db[_0x465b('0x37')]['findOne']({'where':{'id':_0x45d600[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x2154af,null))['then'](function(_0x4409bb){if(_0x4409bb){_0x174b72=_0x4409bb;_0x28d865[_0x465b('0x3f')]=_[_0x465b('0x3d')](db[_0x465b('0x57')][_0x465b('0x38')]);_0x28d865['query']=_[_0x465b('0x3d')](_0x45d600[_0x465b('0x3c')]);_0x28d865[_0x465b('0x47')]=_[_0x465b('0x3e')](_0x28d865[_0x465b('0x3f')],_0x28d865[_0x465b('0x3c')]);_0x5ea390[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x28d865[_0x465b('0x3f')],qs[_0x465b('0x41')](_0x45d600[_0x465b('0x3c')][_0x465b('0x41')]));_0x5ea390['attributes']=_0x5ea390['attributes'][_0x465b('0x42')]?_0x5ea390['attributes']:_0x28d865[_0x465b('0x3f')];_0x5ea390[_0x465b('0x44')]=qs[_0x465b('0x45')](_0x45d600['query']['sort']);_0x5ea390['where']=qs[_0x465b('0x47')](_[_0x465b('0x48')](_0x45d600[_0x465b('0x3c')],_0x28d865[_0x465b('0x47')]));if(_0x45d600[_0x465b('0x3c')][_0x465b('0x49')]){_0x5ea390[_0x465b('0x46')]=_[_0x465b('0x4a')](_0x5ea390['where'],{'$or':_[_0x465b('0x36')](_0x5ea390[_0x465b('0x40')],function(_0x4863ea){var _0x31b24c={};_0x31b24c[_0x4863ea]={'$like':'%'+_0x45d600['query'][_0x465b('0x49')]+'%'};return _0x31b24c;})});}_0x5ea390=_[_0x465b('0x4a')]({},_0x5ea390,_0x45d600['options']);return _0x174b72[_0x465b('0x56')](_0x5ea390);}})['then'](function(_0x4a7d00){if(_0x4a7d00){_0x239bb6=_0x4a7d00['length'];if(!_0x45d600[_0x465b('0x3c')][_0x465b('0x43')](_0x465b('0x58'))){_0x5ea390[_0x465b('0x2a')]=qs[_0x465b('0x2a')](_0x45d600[_0x465b('0x3c')]['limit']);_0x5ea390[_0x465b('0x29')]=qs[_0x465b('0x29')](_0x45d600[_0x465b('0x3c')][_0x465b('0x29')]);}return _0x174b72['getFields'](_0x5ea390);}})[_0x465b('0x30')](function(_0x54692a){if(_0x54692a){return _0x54692a?{'count':_0x239bb6,'rows':_0x54692a}:null;}})[_0x465b('0x30')](respondWithResult(_0x2154af,null))['catch'](handleError(_0x2154af,null));};exports[_0x465b('0x59')]=function(_0xeb36a,_0x2930e5,_0x2c5234){var _0x31824d={};var _0x216c97={};var _0x89628c;var _0x42372b;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xeb36a[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x2930e5,null))[_0x465b('0x30')](function(_0xb6725){if(_0xb6725){_0x89628c=_0xb6725;_0x216c97['model']=_[_0x465b('0x3d')](db['ZendeskField'][_0x465b('0x38')]);_0x216c97[_0x465b('0x3c')]=_[_0x465b('0x3d')](_0xeb36a[_0x465b('0x3c')]);_0x216c97[_0x465b('0x47')]=_['intersection'](_0x216c97[_0x465b('0x3f')],_0x216c97[_0x465b('0x3c')]);_0x31824d[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x216c97[_0x465b('0x3f')],qs[_0x465b('0x41')](_0xeb36a[_0x465b('0x3c')][_0x465b('0x41')]));_0x31824d[_0x465b('0x40')]=_0x31824d['attributes']['length']?_0x31824d['attributes']:_0x216c97[_0x465b('0x3f')];_0x31824d[_0x465b('0x44')]=qs[_0x465b('0x45')](_0xeb36a[_0x465b('0x3c')][_0x465b('0x45')]);_0x31824d[_0x465b('0x46')]=qs[_0x465b('0x47')](_[_0x465b('0x48')](_0xeb36a[_0x465b('0x3c')],_0x216c97['filters']));if(_0xeb36a[_0x465b('0x3c')][_0x465b('0x49')]){_0x31824d[_0x465b('0x46')]=_[_0x465b('0x4a')](_0x31824d['where'],{'$or':_['map'](_0x31824d[_0x465b('0x40')],function(_0x29ffe8){var _0x4ef373={};_0x4ef373[_0x29ffe8]={'$like':'%'+_0xeb36a[_0x465b('0x3c')][_0x465b('0x49')]+'%'};return _0x4ef373;})});}_0x31824d=_[_0x465b('0x4a')]({},_0x31824d,_0xeb36a[_0x465b('0x4c')]);return _0x89628c['getSubjects'](_0x31824d);}})['then'](function(_0x38087d){if(_0x38087d){_0x42372b=_0x38087d[_0x465b('0x42')];if(!_0xeb36a[_0x465b('0x3c')][_0x465b('0x43')]('nolimit')){_0x31824d['limit']=qs[_0x465b('0x2a')](_0xeb36a[_0x465b('0x3c')][_0x465b('0x2a')]);_0x31824d[_0x465b('0x29')]=qs[_0x465b('0x29')](_0xeb36a[_0x465b('0x3c')]['offset']);}return _0x89628c['getSubjects'](_0x31824d);}})[_0x465b('0x30')](function(_0x597b79){if(_0x597b79){return _0x597b79?{'count':_0x42372b,'rows':_0x597b79}:null;}})[_0x465b('0x30')](respondWithResult(_0x2930e5,null))[_0x465b('0x24')](handleError(_0x2930e5,null));};exports[_0x465b('0x5a')]=function(_0x1770cc,_0x2013c1,_0x40950c){var _0x1adbb1={};var _0x1a14e5={};var _0x329c2f;var _0x435d3b;return db[_0x465b('0x37')][_0x465b('0x5b')]({'where':{'id':_0x1770cc[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x2013c1,null))[_0x465b('0x30')](function(_0x5126e5){if(_0x5126e5){_0x329c2f=_0x5126e5;_0x1a14e5[_0x465b('0x3f')]=_[_0x465b('0x3d')](db[_0x465b('0x57')]['rawAttributes']);_0x1a14e5['query']=_[_0x465b('0x3d')](_0x1770cc['query']);_0x1a14e5[_0x465b('0x47')]=_[_0x465b('0x3e')](_0x1a14e5[_0x465b('0x3f')],_0x1a14e5['query']);_0x1adbb1[_0x465b('0x40')]=_[_0x465b('0x3e')](_0x1a14e5[_0x465b('0x3f')],qs[_0x465b('0x41')](_0x1770cc[_0x465b('0x3c')][_0x465b('0x41')]));_0x1adbb1[_0x465b('0x40')]=_0x1adbb1[_0x465b('0x40')]['length']?_0x1adbb1[_0x465b('0x40')]:_0x1a14e5[_0x465b('0x3f')];_0x1adbb1['order']=qs[_0x465b('0x45')](_0x1770cc[_0x465b('0x3c')]['sort']);_0x1adbb1[_0x465b('0x46')]=qs['filters'](_[_0x465b('0x48')](_0x1770cc[_0x465b('0x3c')],_0x1a14e5[_0x465b('0x47')]));if(_0x1770cc[_0x465b('0x3c')][_0x465b('0x49')]){_0x1adbb1[_0x465b('0x46')]=_[_0x465b('0x4a')](_0x1adbb1['where'],{'$or':_[_0x465b('0x36')](_0x1adbb1[_0x465b('0x40')],function(_0x1dbd4c){var _0x4c06df={};_0x4c06df[_0x1dbd4c]={'$like':'%'+_0x1770cc[_0x465b('0x3c')][_0x465b('0x49')]+'%'};return _0x4c06df;})});}_0x1adbb1=_[_0x465b('0x4a')]({},_0x1adbb1,_0x1770cc[_0x465b('0x4c')]);return _0x329c2f['getDescriptions'](_0x1adbb1);}})[_0x465b('0x30')](function(_0x4147d3){if(_0x4147d3){_0x435d3b=_0x4147d3[_0x465b('0x42')];if(!_0x1770cc[_0x465b('0x3c')][_0x465b('0x43')](_0x465b('0x58'))){_0x1adbb1['limit']=qs['limit'](_0x1770cc[_0x465b('0x3c')][_0x465b('0x2a')]);_0x1adbb1['offset']=qs[_0x465b('0x29')](_0x1770cc[_0x465b('0x3c')][_0x465b('0x29')]);}return _0x329c2f[_0x465b('0x5a')](_0x1adbb1);}})[_0x465b('0x30')](function(_0x25d785){if(_0x25d785){return _0x25d785?{'count':_0x435d3b,'rows':_0x25d785}:null;}})[_0x465b('0x30')](respondWithResult(_0x2013c1,null))[_0x465b('0x24')](handleError(_0x2013c1,null));};exports['getTags']=function(_0x39cc97,_0x52409e,_0x4e71ed){var _0xb3d627={};var _0x264128={};var _0x378e38;var _0x2d4a62;return db[_0x465b('0x37')][_0x465b('0x5b')]({'where':{'id':_0x39cc97[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x52409e,null))[_0x465b('0x30')](function(_0x1df918){if(_0x1df918){_0x378e38=_0x1df918;_0x264128[_0x465b('0x3f')]=_[_0x465b('0x3d')](db[_0x465b('0x5c')][_0x465b('0x38')]);_0x264128[_0x465b('0x3c')]=_[_0x465b('0x3d')](_0x39cc97[_0x465b('0x3c')]);_0x264128['filters']=_[_0x465b('0x3e')](_0x264128[_0x465b('0x3f')],_0x264128[_0x465b('0x3c')]);_0xb3d627['attributes']=_['intersection'](_0x264128[_0x465b('0x3f')],qs[_0x465b('0x41')](_0x39cc97['query'][_0x465b('0x41')]));_0xb3d627[_0x465b('0x40')]=_0xb3d627['attributes']['length']?_0xb3d627[_0x465b('0x40')]:_0x264128[_0x465b('0x3f')];_0xb3d627[_0x465b('0x44')]=qs[_0x465b('0x45')](_0x39cc97[_0x465b('0x3c')]['sort']);_0xb3d627['where']=qs[_0x465b('0x47')](_[_0x465b('0x48')](_0x39cc97[_0x465b('0x3c')],_0x264128[_0x465b('0x47')]));if(_0x39cc97[_0x465b('0x3c')][_0x465b('0x49')]){_0xb3d627[_0x465b('0x46')]=_[_0x465b('0x4a')](_0xb3d627[_0x465b('0x46')],{'$or':_[_0x465b('0x36')](_0xb3d627[_0x465b('0x40')],function(_0x2b8c37){var _0xba0232={};_0xba0232[_0x2b8c37]={'$like':'%'+_0x39cc97[_0x465b('0x3c')][_0x465b('0x49')]+'%'};return _0xba0232;})});}_0xb3d627=_[_0x465b('0x4a')]({},_0xb3d627,_0x39cc97[_0x465b('0x4c')]);return _0x378e38[_0x465b('0x5d')](_0xb3d627);}})[_0x465b('0x30')](function(_0x791016){if(_0x791016){_0x2d4a62=_0x791016[_0x465b('0x42')];if(!_0x39cc97[_0x465b('0x3c')][_0x465b('0x43')](_0x465b('0x58'))){_0xb3d627['limit']=qs[_0x465b('0x2a')](_0x39cc97[_0x465b('0x3c')][_0x465b('0x2a')]);_0xb3d627['offset']=qs[_0x465b('0x29')](_0x39cc97[_0x465b('0x3c')][_0x465b('0x29')]);}return _0x378e38[_0x465b('0x5d')](_0xb3d627);}})[_0x465b('0x30')](function(_0x43469d){if(_0x43469d){return _0x43469d?{'count':_0x2d4a62,'rows':_0x43469d}:null;}})[_0x465b('0x30')](respondWithResult(_0x52409e,null))[_0x465b('0x24')](handleError(_0x52409e,null));};exports[_0x465b('0x5e')]=function(_0x2ad4d0,_0x300bee,_0x37d03c){if(_0x2ad4d0[_0x465b('0x54')]['id']){delete _0x2ad4d0[_0x465b('0x54')]['id'];}return db[_0x465b('0x37')][_0x465b('0x5b')]({'where':{'id':_0x2ad4d0[_0x465b('0x52')]['id']}})[_0x465b('0x30')](handleEntityNotFound(_0x300bee,null))[_0x465b('0x30')](function(_0x5d1bdd){if(_0x5d1bdd){return _0x5d1bdd[_0x465b('0x5e')](_0x2ad4d0[_0x465b('0x54')][_0x465b('0x5f')]||[]);}return null;})[_0x465b('0x30')](respondWithResult(_0x300bee,null))['catch'](handleError(_0x300bee,null));}; \ No newline at end of file +var _0xeb55=['fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','update','getFields','findOne','ZendeskField','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','ZendeskConfiguration','rawAttributes'];(function(_0x179edd,_0x125b3b){var _0x24d305=function(_0x409bb7){while(--_0x409bb7){_0x179edd['push'](_0x179edd['shift']());}};_0x24d305(++_0x125b3b);}(_0xeb55,0x8a));var _0x5eb5=function(_0x5c0d33,_0x1ed4f0){_0x5c0d33=_0x5c0d33-0x0;var _0x16425e=_0xeb55[_0x5c0d33];return _0x16425e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5eb5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5eb5('0x1'));var jsonpatch=require(_0x5eb5('0x2'));var rp=require(_0x5eb5('0x3'));var moment=require(_0x5eb5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5eb5('0x5'));var util=require(_0x5eb5('0x6'));var path=require('path');var sox=require(_0x5eb5('0x7'));var csv=require(_0x5eb5('0x8'));var ejs=require(_0x5eb5('0x9'));var fs=require('fs');var _=require(_0x5eb5('0xa'));var squel=require(_0x5eb5('0xb'));var crypto=require(_0x5eb5('0xc'));var jsforce=require(_0x5eb5('0xd'));var deskjs=require(_0x5eb5('0xe'));var toCsv=require(_0x5eb5('0x8'));var querystring=require(_0x5eb5('0xf'));var Papa=require('papaparse');var Redis=require(_0x5eb5('0x10'));var authService=require(_0x5eb5('0x11'));var qs=require(_0x5eb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5eb5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5eb5('0x14'));var config=require(_0x5eb5('0x15'));var db=require(_0x5eb5('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5eb5('0x17')][_0x5eb5('0x18')]({'port':0x232a});function checkPasswordPattern(_0x515bd2,_0x5c9065,_0x4d5748){if(_0x4d5748){var _0x25a5fe=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25a5fe[_0x5eb5('0x19')](_0x5c9065)){return _0x515bd2;}else{throw new db[(_0x5eb5('0x1a'))][(_0x5eb5('0x1b'))](_0x5eb5('0x1c'));}}else{return _0x515bd2;}}function respondWithRpcPromise(_0x3a86f6,_0x5b8f1c,_0x21da12,_0x39c724){return new BPromise(function(_0x2062bd,_0x4558b7){var _0x3c0e27=_0x39c724||client;return _0x3c0e27[_0x5eb5('0x1d')](_0x3a86f6,_0x21da12)[_0x5eb5('0x1e')](function(_0x17ed2b){logger[_0x5eb5('0x1f')](_0x5eb5('0x20'),_0x5b8f1c,_0x5eb5('0x21'));logger[_0x5eb5('0x22')](_0x5eb5('0x23'),_0x5b8f1c,_0x5eb5('0x21'),JSON['stringify'](_0x17ed2b));if(_0x17ed2b[_0x5eb5('0x24')]){if(_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x25')]===0x1f4){logger[_0x5eb5('0x24')](_0x5eb5('0x20'),_0x5b8f1c,_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x26')]);return _0x4558b7(_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x26')]);}logger[_0x5eb5('0x24')](_0x5eb5('0x20'),_0x5b8f1c,_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x26')]);return _0x2062bd(_0x17ed2b[_0x5eb5('0x24')][_0x5eb5('0x26')]);}else{logger[_0x5eb5('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5b8f1c,_0x5eb5('0x21'));_0x2062bd(_0x17ed2b[_0x5eb5('0x27')][_0x5eb5('0x26')]);}})['catch'](function(_0x3f3331){logger['error'](_0x5eb5('0x20'),_0x5b8f1c,_0x3f3331);_0x4558b7(_0x3f3331);});});}function respondWithStatusCode(_0x354ff9,_0x8670b1){_0x8670b1=_0x8670b1||0xcc;return function(_0x551982){if(_0x551982){return _0x354ff9[_0x5eb5('0x28')](_0x8670b1);}return _0x354ff9[_0x5eb5('0x29')](_0x8670b1)[_0x5eb5('0x2a')]();};}function respondWithResult(_0x31fe1c,_0x3f09c8){_0x3f09c8=_0x3f09c8||0xc8;return function(_0x26ea46){if(_0x26ea46){return _0x31fe1c[_0x5eb5('0x29')](_0x3f09c8)['json'](_0x26ea46);}};}function respondWithFilteredResult(_0x592011,_0xdf91d3){return function(_0x393796){if(_0x393796){var _0x3f4f51=_0x393796[_0x5eb5('0x2b')],_0x503b34=_0xdf91d3[_0x5eb5('0x2c')],_0x403b19=_0xdf91d3[_0x5eb5('0x2c')]+_0xdf91d3[_0x5eb5('0x2d')],_0x1b406e;if(_0x403b19>=_0x3f4f51){_0x403b19=_0x3f4f51;_0x1b406e=0xc8;}else{_0x1b406e=0xce;}_0x592011[_0x5eb5('0x29')](_0x1b406e);return _0x592011[_0x5eb5('0x2e')](_0x5eb5('0x2f'),_0x503b34+'-'+_0x403b19+'/'+_0x3f4f51)['json'](_0x393796);}return null;};}function patchUpdates(_0x5e3ba7){return function(_0x5ab12c){try{jsonpatch[_0x5eb5('0x30')](_0x5ab12c,_0x5e3ba7,!![]);}catch(_0x384f03){return BPromise[_0x5eb5('0x31')](_0x384f03);}return _0x5ab12c['save']();};}function saveUpdates(_0x43f067,_0x3a18bb){return function(_0x1f1040){if(_0x1f1040){return _0x1f1040['update'](_0x43f067)['then'](function(_0x555fea){return _0x555fea;});}return null;};}function removeEntity(_0x78d326,_0x2ba1bb){return function(_0x313549){if(_0x313549){return _0x313549[_0x5eb5('0x32')]()['then'](function(){_0x78d326[_0x5eb5('0x29')](0xcc)[_0x5eb5('0x2a')]();});}};}function handleEntityNotFound(_0x620641,_0x3d3527){return function(_0x2e9739){if(!_0x2e9739){_0x620641['sendStatus'](0x194);}return _0x2e9739;};}function handleError(_0x113786,_0x5c21b8){_0x5c21b8=_0x5c21b8||0x1f4;return function(_0x4f6d77){logger['error'](_0x4f6d77[_0x5eb5('0x33')]);if(_0x4f6d77[_0x5eb5('0x34')]){delete _0x4f6d77[_0x5eb5('0x34')];}_0x113786['status'](_0x5c21b8)[_0x5eb5('0x35')](_0x4f6d77);};}exports['index']=function(_0x470d5c,_0x20bdeb){var _0x54b2bf={},_0x3178c6={},_0x5d8fed={'count':0x0,'rows':[]};var _0x2041c5=_['map'](db[_0x5eb5('0x36')][_0x5eb5('0x37')],function(_0x31e26b){return{'name':_0x31e26b[_0x5eb5('0x38')],'type':_0x31e26b[_0x5eb5('0x39')][_0x5eb5('0x3a')]};});_0x3178c6['model']=_[_0x5eb5('0x3b')](_0x2041c5,_0x5eb5('0x34'));_0x3178c6[_0x5eb5('0x3c')]=_['keys'](_0x470d5c[_0x5eb5('0x3c')]);_0x3178c6[_0x5eb5('0x3d')]=_[_0x5eb5('0x3e')](_0x3178c6[_0x5eb5('0x3f')],_0x3178c6[_0x5eb5('0x3c')]);_0x54b2bf[_0x5eb5('0x40')]=_['intersection'](_0x3178c6['model'],qs[_0x5eb5('0x41')](_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x41')]));_0x54b2bf['attributes']=_0x54b2bf[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x54b2bf['attributes']:_0x3178c6[_0x5eb5('0x3f')];if(!_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x43')]('nolimit')){_0x54b2bf['limit']=qs[_0x5eb5('0x2d')](_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x2d')]);_0x54b2bf[_0x5eb5('0x2c')]=qs[_0x5eb5('0x2c')](_0x470d5c[_0x5eb5('0x3c')]['offset']);}_0x54b2bf[_0x5eb5('0x44')]=qs[_0x5eb5('0x45')](_0x470d5c['query'][_0x5eb5('0x45')]);_0x54b2bf['where']=qs[_0x5eb5('0x3d')](_[_0x5eb5('0x46')](_0x470d5c['query'],_0x3178c6['filters']),_0x2041c5);if(_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x47')]){_0x54b2bf[_0x5eb5('0x48')]=_['merge'](_0x54b2bf[_0x5eb5('0x48')],{'$or':_['map'](_0x2041c5,function(_0x19e0dc){if(_0x19e0dc[_0x5eb5('0x39')]!==_0x5eb5('0x49')){var _0x206761={};_0x206761[_0x19e0dc[_0x5eb5('0x34')]]={'$like':'%'+_0x470d5c[_0x5eb5('0x3c')][_0x5eb5('0x47')]+'%'};return _0x206761;}})});}_0x54b2bf=_[_0x5eb5('0x4a')]({},_0x54b2bf,_0x470d5c[_0x5eb5('0x4b')]);var _0x469527={'where':_0x54b2bf[_0x5eb5('0x48')]};return db[_0x5eb5('0x36')][_0x5eb5('0x2b')](_0x469527)['then'](function(_0x457c0c){_0x5d8fed[_0x5eb5('0x2b')]=_0x457c0c;if(_0x470d5c['query'][_0x5eb5('0x4c')]){_0x54b2bf[_0x5eb5('0x4d')]=[{'all':!![]}];}return db[_0x5eb5('0x36')][_0x5eb5('0x4e')](_0x54b2bf);})[_0x5eb5('0x1e')](function(_0xa437db){_0x5d8fed[_0x5eb5('0x4f')]=_0xa437db;return _0x5d8fed;})[_0x5eb5('0x1e')](respondWithFilteredResult(_0x20bdeb,_0x54b2bf))['catch'](handleError(_0x20bdeb,null));};exports[_0x5eb5('0x50')]=function(_0xf6cd98,_0xd299f7){var _0x2b6b6c={'raw':![],'where':{'id':_0xf6cd98[_0x5eb5('0x51')]['id']}},_0x2232ee={};_0x2232ee['model']=_[_0x5eb5('0x52')](db['ZendeskConfiguration']['rawAttributes']);_0x2232ee[_0x5eb5('0x3c')]=_['keys'](_0xf6cd98[_0x5eb5('0x3c')]);_0x2232ee[_0x5eb5('0x3d')]=_['intersection'](_0x2232ee[_0x5eb5('0x3f')],_0x2232ee[_0x5eb5('0x3c')]);_0x2b6b6c[_0x5eb5('0x40')]=_['intersection'](_0x2232ee[_0x5eb5('0x3f')],qs[_0x5eb5('0x41')](_0xf6cd98[_0x5eb5('0x3c')][_0x5eb5('0x41')]));_0x2b6b6c[_0x5eb5('0x40')]=_0x2b6b6c[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x2b6b6c[_0x5eb5('0x40')]:_0x2232ee['model'];if(_0xf6cd98['query'][_0x5eb5('0x4c')]){_0x2b6b6c[_0x5eb5('0x4d')]=[{'all':!![]}];}_0x2b6b6c=_[_0x5eb5('0x4a')]({},_0x2b6b6c,_0xf6cd98['options']);return db[_0x5eb5('0x36')][_0x5eb5('0x53')](_0x2b6b6c)[_0x5eb5('0x1e')](handleEntityNotFound(_0xd299f7,null))[_0x5eb5('0x1e')](respondWithResult(_0xd299f7,null))[_0x5eb5('0x54')](handleError(_0xd299f7,null));};exports[_0x5eb5('0x55')]=function(_0x3b1f5d,_0x3785c4){return db['ZendeskConfiguration']['create'](_0x3b1f5d[_0x5eb5('0x56')],{})['then'](respondWithResult(_0x3785c4,0xc9))[_0x5eb5('0x54')](handleError(_0x3785c4,null));};exports[_0x5eb5('0x57')]=function(_0x4316c2,_0x1cf391){if(_0x4316c2[_0x5eb5('0x56')]['id']){delete _0x4316c2[_0x5eb5('0x56')]['id'];}return db['ZendeskConfiguration'][_0x5eb5('0x53')]({'where':{'id':_0x4316c2[_0x5eb5('0x51')]['id']}})['then'](handleEntityNotFound(_0x1cf391,null))[_0x5eb5('0x1e')](saveUpdates(_0x4316c2[_0x5eb5('0x56')],null))['then'](respondWithResult(_0x1cf391,null))['catch'](handleError(_0x1cf391,null));};exports[_0x5eb5('0x32')]=function(_0x4d51db,_0x587700){return db[_0x5eb5('0x36')][_0x5eb5('0x53')]({'where':{'id':_0x4d51db['params']['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x587700,null))[_0x5eb5('0x1e')](removeEntity(_0x587700,null))[_0x5eb5('0x54')](handleError(_0x587700,null));};exports[_0x5eb5('0x58')]=function(_0x179af1,_0x16fc07,_0x5e0b25){var _0x36c85c={};var _0x184a28={};var _0x1fb9fd;var _0x614ca4;return db[_0x5eb5('0x36')][_0x5eb5('0x59')]({'where':{'id':_0x179af1[_0x5eb5('0x51')]['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x16fc07,null))['then'](function(_0x3dd161){if(_0x3dd161){_0x1fb9fd=_0x3dd161;_0x184a28[_0x5eb5('0x3f')]=_[_0x5eb5('0x52')](db[_0x5eb5('0x5a')][_0x5eb5('0x37')]);_0x184a28[_0x5eb5('0x3c')]=_[_0x5eb5('0x52')](_0x179af1[_0x5eb5('0x3c')]);_0x184a28[_0x5eb5('0x3d')]=_[_0x5eb5('0x3e')](_0x184a28[_0x5eb5('0x3f')],_0x184a28[_0x5eb5('0x3c')]);_0x36c85c[_0x5eb5('0x40')]=_[_0x5eb5('0x3e')](_0x184a28[_0x5eb5('0x3f')],qs[_0x5eb5('0x41')](_0x179af1[_0x5eb5('0x3c')]['fields']));_0x36c85c[_0x5eb5('0x40')]=_0x36c85c[_0x5eb5('0x40')]['length']?_0x36c85c['attributes']:_0x184a28[_0x5eb5('0x3f')];_0x36c85c[_0x5eb5('0x44')]=qs[_0x5eb5('0x45')](_0x179af1[_0x5eb5('0x3c')][_0x5eb5('0x45')]);_0x36c85c[_0x5eb5('0x48')]=qs[_0x5eb5('0x3d')](_['pick'](_0x179af1[_0x5eb5('0x3c')],_0x184a28['filters']));if(_0x179af1['query']['filter']){_0x36c85c[_0x5eb5('0x48')]=_[_0x5eb5('0x4a')](_0x36c85c[_0x5eb5('0x48')],{'$or':_[_0x5eb5('0x3b')](_0x36c85c[_0x5eb5('0x40')],function(_0x546396){var _0x1d4bc8={};_0x1d4bc8[_0x546396]={'$like':'%'+_0x179af1[_0x5eb5('0x3c')]['filter']+'%'};return _0x1d4bc8;})});}_0x36c85c=_['merge']({},_0x36c85c,_0x179af1['options']);return _0x1fb9fd['getFields'](_0x36c85c);}})[_0x5eb5('0x1e')](function(_0x2fc048){if(_0x2fc048){_0x614ca4=_0x2fc048['length'];if(!_0x179af1[_0x5eb5('0x3c')][_0x5eb5('0x43')](_0x5eb5('0x5b'))){_0x36c85c['limit']=qs['limit'](_0x179af1[_0x5eb5('0x3c')][_0x5eb5('0x2d')]);_0x36c85c[_0x5eb5('0x2c')]=qs['offset'](_0x179af1[_0x5eb5('0x3c')][_0x5eb5('0x2c')]);}return _0x1fb9fd['getFields'](_0x36c85c);}})[_0x5eb5('0x1e')](function(_0x4272bb){if(_0x4272bb){return _0x4272bb?{'count':_0x614ca4,'rows':_0x4272bb}:null;}})[_0x5eb5('0x1e')](respondWithResult(_0x16fc07,null))[_0x5eb5('0x54')](handleError(_0x16fc07,null));};exports['getSubjects']=function(_0x1fc17c,_0x551d61,_0x55ed12){var _0x4ded1c={};var _0x263377={};var _0x5e4d8e;var _0x4de5d8;return db[_0x5eb5('0x36')][_0x5eb5('0x59')]({'where':{'id':_0x1fc17c[_0x5eb5('0x51')]['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x551d61,null))[_0x5eb5('0x1e')](function(_0x3ff85){if(_0x3ff85){_0x5e4d8e=_0x3ff85;_0x263377[_0x5eb5('0x3f')]=_[_0x5eb5('0x52')](db[_0x5eb5('0x5a')][_0x5eb5('0x37')]);_0x263377[_0x5eb5('0x3c')]=_[_0x5eb5('0x52')](_0x1fc17c['query']);_0x263377[_0x5eb5('0x3d')]=_[_0x5eb5('0x3e')](_0x263377[_0x5eb5('0x3f')],_0x263377['query']);_0x4ded1c['attributes']=_[_0x5eb5('0x3e')](_0x263377[_0x5eb5('0x3f')],qs[_0x5eb5('0x41')](_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x41')]));_0x4ded1c[_0x5eb5('0x40')]=_0x4ded1c[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x4ded1c['attributes']:_0x263377[_0x5eb5('0x3f')];_0x4ded1c[_0x5eb5('0x44')]=qs['sort'](_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x45')]);_0x4ded1c[_0x5eb5('0x48')]=qs[_0x5eb5('0x3d')](_[_0x5eb5('0x46')](_0x1fc17c[_0x5eb5('0x3c')],_0x263377['filters']));if(_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x47')]){_0x4ded1c[_0x5eb5('0x48')]=_[_0x5eb5('0x4a')](_0x4ded1c[_0x5eb5('0x48')],{'$or':_['map'](_0x4ded1c[_0x5eb5('0x40')],function(_0x6f184){var _0x5e7823={};_0x5e7823[_0x6f184]={'$like':'%'+_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x47')]+'%'};return _0x5e7823;})});}_0x4ded1c=_[_0x5eb5('0x4a')]({},_0x4ded1c,_0x1fc17c[_0x5eb5('0x4b')]);return _0x5e4d8e[_0x5eb5('0x5c')](_0x4ded1c);}})[_0x5eb5('0x1e')](function(_0x25638e){if(_0x25638e){_0x4de5d8=_0x25638e[_0x5eb5('0x42')];if(!_0x1fc17c[_0x5eb5('0x3c')]['hasOwnProperty'](_0x5eb5('0x5b'))){_0x4ded1c[_0x5eb5('0x2d')]=qs['limit'](_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x2d')]);_0x4ded1c[_0x5eb5('0x2c')]=qs['offset'](_0x1fc17c[_0x5eb5('0x3c')][_0x5eb5('0x2c')]);}return _0x5e4d8e[_0x5eb5('0x5c')](_0x4ded1c);}})[_0x5eb5('0x1e')](function(_0x3606b6){if(_0x3606b6){return _0x3606b6?{'count':_0x4de5d8,'rows':_0x3606b6}:null;}})[_0x5eb5('0x1e')](respondWithResult(_0x551d61,null))[_0x5eb5('0x54')](handleError(_0x551d61,null));};exports[_0x5eb5('0x5d')]=function(_0x341904,_0x4b8c6d,_0x254763){var _0x5865b8={};var _0x40ee68={};var _0x4f431a;var _0x4457ed;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x341904[_0x5eb5('0x51')]['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x4b8c6d,null))[_0x5eb5('0x1e')](function(_0x60883a){if(_0x60883a){_0x4f431a=_0x60883a;_0x40ee68[_0x5eb5('0x3f')]=_[_0x5eb5('0x52')](db[_0x5eb5('0x5a')][_0x5eb5('0x37')]);_0x40ee68[_0x5eb5('0x3c')]=_[_0x5eb5('0x52')](_0x341904[_0x5eb5('0x3c')]);_0x40ee68[_0x5eb5('0x3d')]=_[_0x5eb5('0x3e')](_0x40ee68[_0x5eb5('0x3f')],_0x40ee68['query']);_0x5865b8[_0x5eb5('0x40')]=_[_0x5eb5('0x3e')](_0x40ee68['model'],qs['fields'](_0x341904['query'][_0x5eb5('0x41')]));_0x5865b8['attributes']=_0x5865b8[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x5865b8[_0x5eb5('0x40')]:_0x40ee68['model'];_0x5865b8[_0x5eb5('0x44')]=qs[_0x5eb5('0x45')](_0x341904[_0x5eb5('0x3c')][_0x5eb5('0x45')]);_0x5865b8[_0x5eb5('0x48')]=qs[_0x5eb5('0x3d')](_[_0x5eb5('0x46')](_0x341904[_0x5eb5('0x3c')],_0x40ee68[_0x5eb5('0x3d')]));if(_0x341904['query'][_0x5eb5('0x47')]){_0x5865b8[_0x5eb5('0x48')]=_['merge'](_0x5865b8['where'],{'$or':_[_0x5eb5('0x3b')](_0x5865b8[_0x5eb5('0x40')],function(_0x597189){var _0x3b4f74={};_0x3b4f74[_0x597189]={'$like':'%'+_0x341904['query'][_0x5eb5('0x47')]+'%'};return _0x3b4f74;})});}_0x5865b8=_[_0x5eb5('0x4a')]({},_0x5865b8,_0x341904[_0x5eb5('0x4b')]);return _0x4f431a['getDescriptions'](_0x5865b8);}})['then'](function(_0x4897d4){if(_0x4897d4){_0x4457ed=_0x4897d4['length'];if(!_0x341904[_0x5eb5('0x3c')][_0x5eb5('0x43')](_0x5eb5('0x5b'))){_0x5865b8[_0x5eb5('0x2d')]=qs[_0x5eb5('0x2d')](_0x341904['query'][_0x5eb5('0x2d')]);_0x5865b8[_0x5eb5('0x2c')]=qs['offset'](_0x341904['query'][_0x5eb5('0x2c')]);}return _0x4f431a[_0x5eb5('0x5d')](_0x5865b8);}})['then'](function(_0x1ba80b){if(_0x1ba80b){return _0x1ba80b?{'count':_0x4457ed,'rows':_0x1ba80b}:null;}})['then'](respondWithResult(_0x4b8c6d,null))[_0x5eb5('0x54')](handleError(_0x4b8c6d,null));};exports[_0x5eb5('0x5e')]=function(_0x3311eb,_0x389d6f,_0x4463a3){var _0x33a1cd={};var _0x4db22b={};var _0x16a88f;var _0x14e2e1;return db[_0x5eb5('0x36')][_0x5eb5('0x59')]({'where':{'id':_0x3311eb[_0x5eb5('0x51')]['id']}})['then'](handleEntityNotFound(_0x389d6f,null))[_0x5eb5('0x1e')](function(_0x4504aa){if(_0x4504aa){_0x16a88f=_0x4504aa;_0x4db22b[_0x5eb5('0x3f')]=_['keys'](db['Tag'][_0x5eb5('0x37')]);_0x4db22b[_0x5eb5('0x3c')]=_[_0x5eb5('0x52')](_0x3311eb[_0x5eb5('0x3c')]);_0x4db22b['filters']=_[_0x5eb5('0x3e')](_0x4db22b[_0x5eb5('0x3f')],_0x4db22b[_0x5eb5('0x3c')]);_0x33a1cd[_0x5eb5('0x40')]=_[_0x5eb5('0x3e')](_0x4db22b[_0x5eb5('0x3f')],qs[_0x5eb5('0x41')](_0x3311eb['query'][_0x5eb5('0x41')]));_0x33a1cd[_0x5eb5('0x40')]=_0x33a1cd[_0x5eb5('0x40')][_0x5eb5('0x42')]?_0x33a1cd[_0x5eb5('0x40')]:_0x4db22b[_0x5eb5('0x3f')];_0x33a1cd['order']=qs['sort'](_0x3311eb['query'][_0x5eb5('0x45')]);_0x33a1cd[_0x5eb5('0x48')]=qs[_0x5eb5('0x3d')](_[_0x5eb5('0x46')](_0x3311eb[_0x5eb5('0x3c')],_0x4db22b[_0x5eb5('0x3d')]));if(_0x3311eb['query']['filter']){_0x33a1cd[_0x5eb5('0x48')]=_['merge'](_0x33a1cd[_0x5eb5('0x48')],{'$or':_[_0x5eb5('0x3b')](_0x33a1cd[_0x5eb5('0x40')],function(_0x5f4824){var _0x453291={};_0x453291[_0x5f4824]={'$like':'%'+_0x3311eb[_0x5eb5('0x3c')]['filter']+'%'};return _0x453291;})});}_0x33a1cd=_[_0x5eb5('0x4a')]({},_0x33a1cd,_0x3311eb[_0x5eb5('0x4b')]);return _0x16a88f[_0x5eb5('0x5e')](_0x33a1cd);}})[_0x5eb5('0x1e')](function(_0x36c1aa){if(_0x36c1aa){_0x14e2e1=_0x36c1aa[_0x5eb5('0x42')];if(!_0x3311eb[_0x5eb5('0x3c')][_0x5eb5('0x43')](_0x5eb5('0x5b'))){_0x33a1cd[_0x5eb5('0x2d')]=qs[_0x5eb5('0x2d')](_0x3311eb[_0x5eb5('0x3c')]['limit']);_0x33a1cd['offset']=qs[_0x5eb5('0x2c')](_0x3311eb[_0x5eb5('0x3c')][_0x5eb5('0x2c')]);}return _0x16a88f[_0x5eb5('0x5e')](_0x33a1cd);}})[_0x5eb5('0x1e')](function(_0x5277ab){if(_0x5277ab){return _0x5277ab?{'count':_0x14e2e1,'rows':_0x5277ab}:null;}})[_0x5eb5('0x1e')](respondWithResult(_0x389d6f,null))[_0x5eb5('0x54')](handleError(_0x389d6f,null));};exports['setTags']=function(_0x46e0f0,_0x387010,_0x1c5d9a){if(_0x46e0f0[_0x5eb5('0x56')]['id']){delete _0x46e0f0[_0x5eb5('0x56')]['id'];}return db['ZendeskConfiguration'][_0x5eb5('0x59')]({'where':{'id':_0x46e0f0[_0x5eb5('0x51')]['id']}})[_0x5eb5('0x1e')](handleEntityNotFound(_0x387010,null))['then'](function(_0x5ebd8f){if(_0x5ebd8f){return _0x5ebd8f[_0x5eb5('0x5f')](_0x46e0f0[_0x5eb5('0x56')][_0x5eb5('0x60')]||[]);}return null;})[_0x5eb5('0x1e')](respondWithResult(_0x387010,null))[_0x5eb5('0x54')](handleError(_0x387010,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 12e7825..a08e9d2 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 _0x20a0=['int_zendesk_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration'];(function(_0x48f80a,_0x3bb5d4){var _0x1327fb=function(_0x46293e){while(--_0x46293e){_0x48f80a['push'](_0x48f80a['shift']());}};_0x1327fb(++_0x3bb5d4);}(_0x20a0,0x15d));var _0x020a=function(_0xd6574d,_0x4cce7c){_0xd6574d=_0xd6574d-0x0;var _0x592d73=_0x20a0[_0xd6574d];return _0x592d73;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x020a('0x0'))(_0x020a('0x1'));var moment=require(_0x020a('0x2'));var BPromise=require(_0x020a('0x3'));var rp=require(_0x020a('0x4'));var fs=require('fs');var path=require(_0x020a('0x5'));var rimraf=require(_0x020a('0x6'));var config=require(_0x020a('0x7'));var attributes=require(_0x020a('0x8'));module[_0x020a('0x9')]=function(_0x552f85,_0x1bab6f){return _0x552f85['define'](_0x020a('0xa'),attributes,{'tableName':_0x020a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x490c=['rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x36cf99,_0x1271a8){var _0x2be556=function(_0xdefc0b){while(--_0xdefc0b){_0x36cf99['push'](_0x36cf99['shift']());}};_0x2be556(++_0x1271a8);}(_0x490c,0x124));var _0xc490=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x490c[_0x1dc24d];return _0x5d7fb2;};'use strict';var _=require(_0xc490('0x0'));var util=require(_0xc490('0x1'));var logger=require(_0xc490('0x2'))(_0xc490('0x3'));var moment=require(_0xc490('0x4'));var BPromise=require(_0xc490('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc490('0x6'));var rimraf=require(_0xc490('0x7'));var config=require('../../config/environment');var attributes=require(_0xc490('0x8'));module[_0xc490('0x9')]=function(_0xd09cd8,_0x48edd8){return _0xd09cd8[_0xc490('0xa')](_0xc490('0xb'),attributes,{'tableName':_0xc490('0xc'),'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 d0b84d7..80e3a61 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 _0xcb97=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x1de69c,_0x41666e){var _0x37dbe8=function(_0x1159f7){while(--_0x1159f7){_0x1de69c['push'](_0x1de69c['shift']());}};_0x37dbe8(++_0x41666e);}(_0xcb97,0x16b));var _0x7cb9=function(_0x50f719,_0x5b915b){_0x50f719=_0x50f719-0x0;var _0x2e9e1f=_0xcb97[_0x50f719];return _0x2e9e1f;};'use strict';var _=require(_0x7cb9('0x0'));var util=require(_0x7cb9('0x1'));var moment=require(_0x7cb9('0x2'));var BPromise=require(_0x7cb9('0x3'));var rs=require(_0x7cb9('0x4'));var fs=require('fs');var Redis=require(_0x7cb9('0x5'));var db=require(_0x7cb9('0x6'))['db'];var utils=require(_0x7cb9('0x7'));var logger=require(_0x7cb9('0x8'))(_0x7cb9('0x9'));var config=require('../../config/environment');var jayson=require(_0x7cb9('0xa'));var client=jayson[_0x7cb9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c75f0,_0x51188b,_0x53514d){return new BPromise(function(_0x3c4f35,_0x5be1bd){return client[_0x7cb9('0xc')](_0x5c75f0,_0x53514d)[_0x7cb9('0xd')](function(_0xb2e7c4){logger[_0x7cb9('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x51188b,_0x7cb9('0xf'));logger[_0x7cb9('0x10')](_0x7cb9('0x11'),_0x51188b,_0x7cb9('0xf'),JSON[_0x7cb9('0x12')](_0xb2e7c4));if(_0xb2e7c4[_0x7cb9('0x13')]){if(_0xb2e7c4['error']['code']===0x1f4){logger['error'](_0x7cb9('0x14'),_0x51188b,_0xb2e7c4[_0x7cb9('0x13')][_0x7cb9('0x15')]);return _0x5be1bd(_0xb2e7c4[_0x7cb9('0x13')][_0x7cb9('0x15')]);}logger['error'](_0x7cb9('0x14'),_0x51188b,_0xb2e7c4['error'][_0x7cb9('0x15')]);return _0x3c4f35(_0xb2e7c4[_0x7cb9('0x13')][_0x7cb9('0x15')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x51188b,_0x7cb9('0xf'));_0x3c4f35(_0xb2e7c4[_0x7cb9('0x16')][_0x7cb9('0x15')]);}})[_0x7cb9('0x17')](function(_0x1ea145){logger[_0x7cb9('0x13')](_0x7cb9('0x14'),_0x51188b,_0x1ea145);_0x5be1bd(_0x1ea145);});});} \ No newline at end of file +var _0xf58e=['http','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf58e,0xdc));var _0xef58=function(_0x1e1570,_0x3efc84){_0x1e1570=_0x1e1570-0x0;var _0x828c7=_0xf58e[_0x1e1570];return _0x828c7;};'use strict';var _=require(_0xef58('0x0'));var util=require(_0xef58('0x1'));var moment=require(_0xef58('0x2'));var BPromise=require('bluebird');var rs=require(_0xef58('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xef58('0x5'))(_0xef58('0x6'));var config=require(_0xef58('0x7'));var jayson=require(_0xef58('0x8'));var client=jayson[_0xef58('0x9')][_0xef58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x105017,_0x1172f5,_0x124db0){return new BPromise(function(_0x53502b,_0x4ec930){return client[_0xef58('0xb')](_0x105017,_0x124db0)[_0xef58('0xc')](function(_0x24a560){logger[_0xef58('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1172f5,_0xef58('0xe'));logger['debug'](_0xef58('0xf'),_0x1172f5,_0xef58('0xe'),JSON[_0xef58('0x10')](_0x24a560));if(_0x24a560[_0xef58('0x11')]){if(_0x24a560['error'][_0xef58('0x12')]===0x1f4){logger['error'](_0xef58('0x13'),_0x1172f5,_0x24a560[_0xef58('0x11')][_0xef58('0x14')]);return _0x4ec930(_0x24a560[_0xef58('0x11')][_0xef58('0x14')]);}logger[_0xef58('0x11')](_0xef58('0x13'),_0x1172f5,_0x24a560[_0xef58('0x11')][_0xef58('0x14')]);return _0x53502b(_0x24a560[_0xef58('0x11')][_0xef58('0x14')]);}else{logger[_0xef58('0xd')](_0xef58('0x13'),_0x1172f5,_0xef58('0xe'));_0x53502b(_0x24a560[_0xef58('0x15')][_0xef58('0x14')]);}})[_0xef58('0x16')](function(_0x481f64){logger[_0xef58('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1172f5,_0x481f64);_0x4ec930(_0x481f64);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 9f0025f..0606853 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 _0x0fc2=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x204e3a,_0x322db0){var _0x37f26d=function(_0x59dd3e){while(--_0x59dd3e){_0x204e3a['push'](_0x204e3a['shift']());}};_0x37f26d(++_0x322db0);}(_0x0fc2,0x6e));var _0x20fc=function(_0x2c06ad,_0x36f164){_0x2c06ad=_0x2c06ad-0x0;var _0x5113ff=_0x0fc2[_0x2c06ad];return _0x5113ff;};'use strict';var multer=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var path=require(_0x20fc('0x2'));var timeout=require(_0x20fc('0x3'));var express=require('express');var router=express[_0x20fc('0x4')]();var auth=require(_0x20fc('0x5'));var interaction=require(_0x20fc('0x6'));var config=require(_0x20fc('0x7'));var controller=require(_0x20fc('0x8'));router[_0x20fc('0x9')]('/',auth[_0x20fc('0xa')](),controller[_0x20fc('0xb')]);router[_0x20fc('0x9')](_0x20fc('0xc'),auth[_0x20fc('0xa')](),controller[_0x20fc('0xd')]);router[_0x20fc('0xe')]('/',auth[_0x20fc('0xa')](),controller[_0x20fc('0xf')]);router[_0x20fc('0x10')]('/:id',auth[_0x20fc('0xa')](),controller[_0x20fc('0x11')]);router[_0x20fc('0x12')]('/:id',auth[_0x20fc('0xa')](),controller[_0x20fc('0x13')]);module[_0x20fc('0x14')]=router; \ No newline at end of file +var _0x8f4e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','multer'];(function(_0x24c859,_0x4a65e7){var _0xa5e5bd=function(_0x383cb7){while(--_0x383cb7){_0x24c859['push'](_0x24c859['shift']());}};_0xa5e5bd(++_0x4a65e7);}(_0x8f4e,0x149));var _0xe8f4=function(_0x2eedd3,_0x4da463){_0x2eedd3=_0x2eedd3-0x0;var _0xb4d3b=_0x8f4e[_0x2eedd3];return _0xb4d3b;};'use strict';var multer=require(_0xe8f4('0x0'));var util=require('util');var path=require(_0xe8f4('0x1'));var timeout=require(_0xe8f4('0x2'));var express=require(_0xe8f4('0x3'));var router=express['Router']();var auth=require(_0xe8f4('0x4'));var interaction=require(_0xe8f4('0x5'));var config=require(_0xe8f4('0x6'));var controller=require(_0xe8f4('0x7'));router[_0xe8f4('0x8')]('/',auth[_0xe8f4('0x9')](),controller['index']);router[_0xe8f4('0x8')](_0xe8f4('0xa'),auth[_0xe8f4('0x9')](),controller[_0xe8f4('0xb')]);router[_0xe8f4('0xc')]('/',auth[_0xe8f4('0x9')](),controller[_0xe8f4('0xd')]);router[_0xe8f4('0xe')](_0xe8f4('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe8f4('0xa'),auth[_0xe8f4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index ef03ae4..39faaa9 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 _0x6c32=['keyValue','string','customVariable','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x26c3('0x0'));module['exports']={'type':{'type':Sequelize[_0x26c3('0x1')]('string',_0x26c3('0x2'),'customVariable',_0x26c3('0x3')),'defaultValue':_0x26c3('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x26c3('0x1')](_0x26c3('0x4'),_0x26c3('0x2'),_0x26c3('0x5'))},'keyContent':{'type':Sequelize[_0x26c3('0x6')]},'idField':{'type':Sequelize[_0x26c3('0x6')]},'nameField':{'type':Sequelize[_0x26c3('0x6')]},'customField':{'type':Sequelize[_0x26c3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x26c3('0x6')]}}; \ No newline at end of file +var _0x77d9=['STRING','ENUM','BOOLEAN','variable','customVariable','string'];(function(_0x2abf06,_0x65778b){var _0xeb4360=function(_0x18bb26){while(--_0x18bb26){_0x2abf06['push'](_0x2abf06['shift']());}};_0xeb4360(++_0x65778b);}(_0x77d9,0x159));var _0x977d=function(_0x32ef5a,_0x38647a){_0x32ef5a=_0x32ef5a-0x0;var _0x31c603=_0x77d9[_0x32ef5a];return _0x31c603;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x977d('0x0'),_0x977d('0x1'),'keyValue'),'defaultValue':_0x977d('0x2')},'content':{'type':Sequelize[_0x977d('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x977d('0x4')](_0x977d('0x2'),'variable',_0x977d('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x977d('0x3')]},'nameField':{'type':Sequelize[_0x977d('0x3')]},'customField':{'type':Sequelize[_0x977d('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x977d('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 435249f..27f4ba4 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 _0xf300=['json','apply','reject','save','then','destroy','stack','name','send','index','map','fieldName','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','ZendeskField','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xf300,0x105));var _0x0f30=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0xf300[_0x2212d1];return _0x15eec5;};'use strict';var pdf=require(_0x0f30('0x0'));var emlformat=require(_0x0f30('0x1'));var rimraf=require(_0x0f30('0x2'));var zipdir=require(_0x0f30('0x3'));var jsonpatch=require(_0x0f30('0x4'));var rp=require('request-promise');var moment=require(_0x0f30('0x5'));var BPromise=require(_0x0f30('0x6'));var Mustache=require('mustache');var util=require(_0x0f30('0x7'));var path=require(_0x0f30('0x8'));var sox=require(_0x0f30('0x9'));var csv=require(_0x0f30('0xa'));var ejs=require(_0x0f30('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f30('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0f30('0xd'));var toCsv=require(_0x0f30('0xa'));var querystring=require(_0x0f30('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f30('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f30('0x10'));var logger=require(_0x0f30('0x11'))(_0x0f30('0x12'));var utils=require(_0x0f30('0x13'));var config=require(_0x0f30('0x14'));var db=require(_0x0f30('0x15'))['db'];function respondWithStatusCode(_0x4e142f,_0x1c3906){_0x1c3906=_0x1c3906||0xcc;return function(_0x4944da){if(_0x4944da){return _0x4e142f[_0x0f30('0x16')](_0x1c3906);}return _0x4e142f[_0x0f30('0x17')](_0x1c3906)[_0x0f30('0x18')]();};}function respondWithResult(_0x54d780,_0x44498c){_0x44498c=_0x44498c||0xc8;return function(_0x5d3b0d){if(_0x5d3b0d){return _0x54d780[_0x0f30('0x17')](_0x44498c)['json'](_0x5d3b0d);}};}function respondWithFilteredResult(_0x28827e,_0x2c06db){return function(_0x5113c3){if(_0x5113c3){var _0x2c6f6f=_0x5113c3[_0x0f30('0x19')],_0x395b29=_0x2c06db['offset'],_0x3b1e6c=_0x2c06db[_0x0f30('0x1a')]+_0x2c06db['limit'],_0x3d2a32;if(_0x3b1e6c>=_0x2c6f6f){_0x3b1e6c=_0x2c6f6f;_0x3d2a32=0xc8;}else{_0x3d2a32=0xce;}_0x28827e[_0x0f30('0x17')](_0x3d2a32);return _0x28827e['set']('Content-Range',_0x395b29+'-'+_0x3b1e6c+'/'+_0x2c6f6f)[_0x0f30('0x1b')](_0x5113c3);}return null;};}function patchUpdates(_0xfa6b2){return function(_0x1bd024){try{jsonpatch[_0x0f30('0x1c')](_0x1bd024,_0xfa6b2,!![]);}catch(_0x5c3569){return BPromise[_0x0f30('0x1d')](_0x5c3569);}return _0x1bd024[_0x0f30('0x1e')]();};}function saveUpdates(_0x2a925f,_0x4d6fd7){return function(_0x20bd49){if(_0x20bd49){return _0x20bd49['update'](_0x2a925f)[_0x0f30('0x1f')](function(_0x57e9ca){return _0x57e9ca;});}return null;};}function removeEntity(_0x43fdea,_0x2a80c3){return function(_0x3143f0){if(_0x3143f0){return _0x3143f0[_0x0f30('0x20')]()[_0x0f30('0x1f')](function(){_0x43fdea[_0x0f30('0x17')](0xcc)[_0x0f30('0x18')]();});}};}function handleEntityNotFound(_0x3ac161,_0x47f151){return function(_0x43d103){if(!_0x43d103){_0x3ac161[_0x0f30('0x16')](0x194);}return _0x43d103;};}function handleError(_0x5607c1,_0x4394d7){_0x4394d7=_0x4394d7||0x1f4;return function(_0x43213c){logger['error'](_0x43213c[_0x0f30('0x21')]);if(_0x43213c[_0x0f30('0x22')]){delete _0x43213c['name'];}_0x5607c1['status'](_0x4394d7)[_0x0f30('0x23')](_0x43213c);};}exports[_0x0f30('0x24')]=function(_0x1a8d75,_0x47fc00){var _0x142cf8={},_0x2b02ae={},_0x1cff0f={'count':0x0,'rows':[]};var _0x55c862=_[_0x0f30('0x25')](db['ZendeskField']['rawAttributes'],function(_0x32a28){return{'name':_0x32a28[_0x0f30('0x26')],'type':_0x32a28['type'][_0x0f30('0x27')]};});_0x2b02ae[_0x0f30('0x28')]=_['map'](_0x55c862,'name');_0x2b02ae['query']=_['keys'](_0x1a8d75[_0x0f30('0x29')]);_0x2b02ae['filters']=_[_0x0f30('0x2a')](_0x2b02ae[_0x0f30('0x28')],_0x2b02ae[_0x0f30('0x29')]);_0x142cf8[_0x0f30('0x2b')]=_[_0x0f30('0x2a')](_0x2b02ae[_0x0f30('0x28')],qs['fields'](_0x1a8d75[_0x0f30('0x29')]['fields']));_0x142cf8[_0x0f30('0x2b')]=_0x142cf8['attributes'][_0x0f30('0x2c')]?_0x142cf8[_0x0f30('0x2b')]:_0x2b02ae[_0x0f30('0x28')];if(!_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x2d')](_0x0f30('0x2e'))){_0x142cf8[_0x0f30('0x2f')]=qs[_0x0f30('0x2f')](_0x1a8d75['query'][_0x0f30('0x2f')]);_0x142cf8[_0x0f30('0x1a')]=qs[_0x0f30('0x1a')](_0x1a8d75['query'][_0x0f30('0x1a')]);}_0x142cf8[_0x0f30('0x30')]=qs[_0x0f30('0x31')](_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x31')]);_0x142cf8[_0x0f30('0x32')]=qs[_0x0f30('0x33')](_[_0x0f30('0x34')](_0x1a8d75[_0x0f30('0x29')],_0x2b02ae['filters']),_0x55c862);if(_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x35')]){_0x142cf8[_0x0f30('0x32')]=_[_0x0f30('0x36')](_0x142cf8[_0x0f30('0x32')],{'$or':_[_0x0f30('0x25')](_0x55c862,function(_0x598c3e){if(_0x598c3e[_0x0f30('0x37')]!==_0x0f30('0x38')){var _0x157c72={};_0x157c72[_0x598c3e[_0x0f30('0x22')]]={'$like':'%'+_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x35')]+'%'};return _0x157c72;}})});}_0x142cf8=_[_0x0f30('0x36')]({},_0x142cf8,_0x1a8d75[_0x0f30('0x39')]);var _0x1825fa={'where':_0x142cf8[_0x0f30('0x32')]};return db['ZendeskField'][_0x0f30('0x19')](_0x1825fa)['then'](function(_0x28fa30){_0x1cff0f['count']=_0x28fa30;if(_0x1a8d75[_0x0f30('0x29')][_0x0f30('0x3a')]){_0x142cf8[_0x0f30('0x3b')]=[{'all':!![]}];}return db[_0x0f30('0x3c')][_0x0f30('0x3d')](_0x142cf8);})[_0x0f30('0x1f')](function(_0x6f477b){_0x1cff0f[_0x0f30('0x3e')]=_0x6f477b;return _0x1cff0f;})[_0x0f30('0x1f')](respondWithFilteredResult(_0x47fc00,_0x142cf8))[_0x0f30('0x3f')](handleError(_0x47fc00,null));};exports[_0x0f30('0x40')]=function(_0x422e02,_0x1231ba){var _0x41ac20={'raw':!![],'where':{'id':_0x422e02[_0x0f30('0x41')]['id']}},_0x145597={};_0x145597[_0x0f30('0x28')]=_[_0x0f30('0x42')](db[_0x0f30('0x3c')][_0x0f30('0x43')]);_0x145597[_0x0f30('0x29')]=_[_0x0f30('0x42')](_0x422e02[_0x0f30('0x29')]);_0x145597[_0x0f30('0x33')]=_[_0x0f30('0x2a')](_0x145597[_0x0f30('0x28')],_0x145597[_0x0f30('0x29')]);_0x41ac20[_0x0f30('0x2b')]=_['intersection'](_0x145597[_0x0f30('0x28')],qs['fields'](_0x422e02[_0x0f30('0x29')][_0x0f30('0x44')]));_0x41ac20[_0x0f30('0x2b')]=_0x41ac20[_0x0f30('0x2b')][_0x0f30('0x2c')]?_0x41ac20[_0x0f30('0x2b')]:_0x145597[_0x0f30('0x28')];if(_0x422e02['query'][_0x0f30('0x3a')]){_0x41ac20['include']=[{'all':!![]}];}_0x41ac20=_['merge']({},_0x41ac20,_0x422e02[_0x0f30('0x39')]);return db[_0x0f30('0x3c')][_0x0f30('0x45')](_0x41ac20)[_0x0f30('0x1f')](handleEntityNotFound(_0x1231ba,null))[_0x0f30('0x1f')](respondWithResult(_0x1231ba,null))[_0x0f30('0x3f')](handleError(_0x1231ba,null));};exports['create']=function(_0x5ac3ab,_0x2f9594){return db[_0x0f30('0x3c')]['create'](_0x5ac3ab[_0x0f30('0x46')],{})[_0x0f30('0x1f')](respondWithResult(_0x2f9594,0xc9))[_0x0f30('0x3f')](handleError(_0x2f9594,null));};exports[_0x0f30('0x47')]=function(_0x9782c6,_0xaf6f98){if(_0x9782c6[_0x0f30('0x46')]['id']){delete _0x9782c6[_0x0f30('0x46')]['id'];}return db[_0x0f30('0x3c')][_0x0f30('0x45')]({'where':{'id':_0x9782c6[_0x0f30('0x41')]['id']}})[_0x0f30('0x1f')](handleEntityNotFound(_0xaf6f98,null))[_0x0f30('0x1f')](saveUpdates(_0x9782c6['body'],null))[_0x0f30('0x1f')](respondWithResult(_0xaf6f98,null))[_0x0f30('0x3f')](handleError(_0xaf6f98,null));};exports[_0x0f30('0x20')]=function(_0x1de872,_0x28ae95){return db[_0x0f30('0x3c')][_0x0f30('0x45')]({'where':{'id':_0x1de872[_0x0f30('0x41')]['id']}})[_0x0f30('0x1f')](handleEntityNotFound(_0x28ae95,null))[_0x0f30('0x1f')](removeEntity(_0x28ae95,null))[_0x0f30('0x3f')](handleError(_0x28ae95,null));}; \ No newline at end of file +var _0x68f8=['index','ZendeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name'];(function(_0xfc1811,_0x5ae90f){var _0x1d16d1=function(_0x4ab636){while(--_0x4ab636){_0xfc1811['push'](_0xfc1811['shift']());}};_0x1d16d1(++_0x5ae90f);}(_0x68f8,0xf6));var _0x868f=function(_0x4580c3,_0x303026){_0x4580c3=_0x4580c3-0x0;var _0x5e15be=_0x68f8[_0x4580c3];return _0x5e15be;};'use strict';var pdf=require(_0x868f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x868f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x868f('0x2'));var moment=require('moment');var BPromise=require(_0x868f('0x3'));var Mustache=require(_0x868f('0x4'));var util=require(_0x868f('0x5'));var path=require(_0x868f('0x6'));var sox=require(_0x868f('0x7'));var csv=require(_0x868f('0x8'));var ejs=require(_0x868f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x868f('0xa'));var crypto=require(_0x868f('0xb'));var jsforce=require(_0x868f('0xc'));var deskjs=require(_0x868f('0xd'));var toCsv=require(_0x868f('0x8'));var querystring=require(_0x868f('0xe'));var Papa=require(_0x868f('0xf'));var Redis=require(_0x868f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x868f('0x11'));var as=require(_0x868f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x868f('0x13'))('api');var utils=require(_0x868f('0x14'));var config=require(_0x868f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xada953,_0x2c4df2){_0x2c4df2=_0x2c4df2||0xcc;return function(_0x878f5b){if(_0x878f5b){return _0xada953[_0x868f('0x16')](_0x2c4df2);}return _0xada953[_0x868f('0x17')](_0x2c4df2)[_0x868f('0x18')]();};}function respondWithResult(_0x334483,_0x526bca){_0x526bca=_0x526bca||0xc8;return function(_0x197fed){if(_0x197fed){return _0x334483['status'](_0x526bca)[_0x868f('0x19')](_0x197fed);}};}function respondWithFilteredResult(_0x3cfff6,_0x2535fa){return function(_0x5f49b0){if(_0x5f49b0){var _0x355c68=_0x5f49b0[_0x868f('0x1a')],_0x2cf67c=_0x2535fa[_0x868f('0x1b')],_0x5786af=_0x2535fa['offset']+_0x2535fa[_0x868f('0x1c')],_0x5114a1;if(_0x5786af>=_0x355c68){_0x5786af=_0x355c68;_0x5114a1=0xc8;}else{_0x5114a1=0xce;}_0x3cfff6[_0x868f('0x17')](_0x5114a1);return _0x3cfff6['set'](_0x868f('0x1d'),_0x2cf67c+'-'+_0x5786af+'/'+_0x355c68)[_0x868f('0x19')](_0x5f49b0);}return null;};}function patchUpdates(_0x314919){return function(_0x46e5ed){try{jsonpatch[_0x868f('0x1e')](_0x46e5ed,_0x314919,!![]);}catch(_0x2460d4){return BPromise[_0x868f('0x1f')](_0x2460d4);}return _0x46e5ed[_0x868f('0x20')]();};}function saveUpdates(_0x45c340,_0x344b76){return function(_0xd9ffbe){if(_0xd9ffbe){return _0xd9ffbe[_0x868f('0x21')](_0x45c340)[_0x868f('0x22')](function(_0x3d4256){return _0x3d4256;});}return null;};}function removeEntity(_0x175880,_0x15fd72){return function(_0x128968){if(_0x128968){return _0x128968[_0x868f('0x23')]()[_0x868f('0x22')](function(){_0x175880[_0x868f('0x17')](0xcc)[_0x868f('0x18')]();});}};}function handleEntityNotFound(_0x3fdb78,_0x3071f2){return function(_0x588387){if(!_0x588387){_0x3fdb78[_0x868f('0x16')](0x194);}return _0x588387;};}function handleError(_0x1f0268,_0x3896ce){_0x3896ce=_0x3896ce||0x1f4;return function(_0x16fc80){logger['error'](_0x16fc80[_0x868f('0x24')]);if(_0x16fc80['name']){delete _0x16fc80[_0x868f('0x25')];}_0x1f0268[_0x868f('0x17')](_0x3896ce)['send'](_0x16fc80);};}exports[_0x868f('0x26')]=function(_0x2c3ea2,_0x484c7b){var _0x52d458={},_0x500f40={},_0x264a42={'count':0x0,'rows':[]};var _0x900a48=_['map'](db[_0x868f('0x27')][_0x868f('0x28')],function(_0x3cd3c5){return{'name':_0x3cd3c5[_0x868f('0x29')],'type':_0x3cd3c5[_0x868f('0x2a')][_0x868f('0x2b')]};});_0x500f40[_0x868f('0x2c')]=_[_0x868f('0x2d')](_0x900a48,_0x868f('0x25'));_0x500f40[_0x868f('0x2e')]=_[_0x868f('0x2f')](_0x2c3ea2['query']);_0x500f40[_0x868f('0x30')]=_[_0x868f('0x31')](_0x500f40[_0x868f('0x2c')],_0x500f40[_0x868f('0x2e')]);_0x52d458['attributes']=_[_0x868f('0x31')](_0x500f40[_0x868f('0x2c')],qs[_0x868f('0x32')](_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x32')]));_0x52d458['attributes']=_0x52d458[_0x868f('0x33')][_0x868f('0x34')]?_0x52d458['attributes']:_0x500f40[_0x868f('0x2c')];if(!_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x35')](_0x868f('0x36'))){_0x52d458[_0x868f('0x1c')]=qs[_0x868f('0x1c')](_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x1c')]);_0x52d458[_0x868f('0x1b')]=qs[_0x868f('0x1b')](_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x1b')]);}_0x52d458[_0x868f('0x37')]=qs[_0x868f('0x38')](_0x2c3ea2['query']['sort']);_0x52d458[_0x868f('0x39')]=qs[_0x868f('0x30')](_[_0x868f('0x3a')](_0x2c3ea2['query'],_0x500f40[_0x868f('0x30')]),_0x900a48);if(_0x2c3ea2[_0x868f('0x2e')]['filter']){_0x52d458[_0x868f('0x39')]=_[_0x868f('0x3b')](_0x52d458['where'],{'$or':_[_0x868f('0x2d')](_0x900a48,function(_0xa9e5f3){if(_0xa9e5f3[_0x868f('0x2a')]!==_0x868f('0x3c')){var _0x3f71c6={};_0x3f71c6[_0xa9e5f3[_0x868f('0x25')]]={'$like':'%'+_0x2c3ea2[_0x868f('0x2e')]['filter']+'%'};return _0x3f71c6;}})});}_0x52d458=_[_0x868f('0x3b')]({},_0x52d458,_0x2c3ea2[_0x868f('0x3d')]);var _0x29742d={'where':_0x52d458[_0x868f('0x39')]};return db['ZendeskField'][_0x868f('0x1a')](_0x29742d)[_0x868f('0x22')](function(_0x2fedca){_0x264a42['count']=_0x2fedca;if(_0x2c3ea2[_0x868f('0x2e')][_0x868f('0x3e')]){_0x52d458[_0x868f('0x3f')]=[{'all':!![]}];}return db[_0x868f('0x27')][_0x868f('0x40')](_0x52d458);})['then'](function(_0x2b4f6f){_0x264a42['rows']=_0x2b4f6f;return _0x264a42;})[_0x868f('0x22')](respondWithFilteredResult(_0x484c7b,_0x52d458))[_0x868f('0x41')](handleError(_0x484c7b,null));};exports[_0x868f('0x42')]=function(_0x5609cc,_0x168f1f){var _0x143ab7={'raw':!![],'where':{'id':_0x5609cc['params']['id']}},_0x4333d1={};_0x4333d1[_0x868f('0x2c')]=_[_0x868f('0x2f')](db['ZendeskField']['rawAttributes']);_0x4333d1[_0x868f('0x2e')]=_[_0x868f('0x2f')](_0x5609cc[_0x868f('0x2e')]);_0x4333d1[_0x868f('0x30')]=_[_0x868f('0x31')](_0x4333d1[_0x868f('0x2c')],_0x4333d1['query']);_0x143ab7['attributes']=_['intersection'](_0x4333d1[_0x868f('0x2c')],qs[_0x868f('0x32')](_0x5609cc[_0x868f('0x2e')]['fields']));_0x143ab7[_0x868f('0x33')]=_0x143ab7['attributes'][_0x868f('0x34')]?_0x143ab7['attributes']:_0x4333d1['model'];if(_0x5609cc[_0x868f('0x2e')][_0x868f('0x3e')]){_0x143ab7['include']=[{'all':!![]}];}_0x143ab7=_[_0x868f('0x3b')]({},_0x143ab7,_0x5609cc[_0x868f('0x3d')]);return db[_0x868f('0x27')][_0x868f('0x43')](_0x143ab7)[_0x868f('0x22')](handleEntityNotFound(_0x168f1f,null))['then'](respondWithResult(_0x168f1f,null))[_0x868f('0x41')](handleError(_0x168f1f,null));};exports[_0x868f('0x44')]=function(_0x121023,_0x306ca3){return db['ZendeskField']['create'](_0x121023[_0x868f('0x45')],{})[_0x868f('0x22')](respondWithResult(_0x306ca3,0xc9))[_0x868f('0x41')](handleError(_0x306ca3,null));};exports['update']=function(_0x399ff4,_0x1f5039){if(_0x399ff4[_0x868f('0x45')]['id']){delete _0x399ff4[_0x868f('0x45')]['id'];}return db[_0x868f('0x27')]['find']({'where':{'id':_0x399ff4[_0x868f('0x46')]['id']}})[_0x868f('0x22')](handleEntityNotFound(_0x1f5039,null))[_0x868f('0x22')](saveUpdates(_0x399ff4[_0x868f('0x45')],null))[_0x868f('0x22')](respondWithResult(_0x1f5039,null))[_0x868f('0x41')](handleError(_0x1f5039,null));};exports['destroy']=function(_0x1981bd,_0x4928ab){return db[_0x868f('0x27')]['find']({'where':{'id':_0x1981bd[_0x868f('0x46')]['id']}})['then'](handleEntityNotFound(_0x4928ab,null))[_0x868f('0x22')](removeEntity(_0x4928ab,null))[_0x868f('0x41')](handleError(_0x4928ab,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index dcb22dc..112c84f 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 _0xd5fc=['../../config/environment','exports','define','idField','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0xd5fc,0xae));var _0xcd5f=function(_0x269705,_0x1276a3){_0x269705=_0x269705-0x0;var _0x372a1b=_0xd5fc[_0x269705];return _0x372a1b;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcd5f('0x1'));var BPromise=require(_0xcd5f('0x2'));var rp=require(_0xcd5f('0x3'));var fs=require('fs');var path=require(_0xcd5f('0x4'));var rimraf=require(_0xcd5f('0x5'));var config=require(_0xcd5f('0x6'));var attributes=require('./intZendeskField.attributes');module[_0xcd5f('0x7')]=function(_0x4b4ca8,_0x95b8bb){return _0x4b4ca8[_0xcd5f('0x8')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xcd5f('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed3c=['exports','zendesk_unique_index','lodash','util','../../config/logger','api','bluebird','request-promise','path','./intZendeskField.attributes'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xed3c,0x1a6));var _0xced3=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0xed3c[_0x2906e6];return _0x12517a;};'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']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xced3('0x9'),'fields':['idField','FieldId'],'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 fdaa038..ef58dd9 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 _0xfc55=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb'];(function(_0x4ded2b,_0x4ec27a){var _0x406c24=function(_0x447905){while(--_0x447905){_0x4ded2b['push'](_0x4ded2b['shift']());}};_0x406c24(++_0x4ec27a);}(_0xfc55,0x1ca));var _0x5fc5=function(_0xdfb6f8,_0x2641be){_0xdfb6f8=_0xdfb6f8-0x0;var _0xaf622e=_0xfc55[_0xdfb6f8];return _0xaf622e;};'use strict';var _=require('lodash');var util=require(_0x5fc5('0x0'));var moment=require(_0x5fc5('0x1'));var BPromise=require('bluebird');var rs=require(_0x5fc5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fc5('0x3'))['db'];var utils=require(_0x5fc5('0x4'));var logger=require(_0x5fc5('0x5'))(_0x5fc5('0x6'));var config=require(_0x5fc5('0x7'));var jayson=require(_0x5fc5('0x8'));var client=jayson[_0x5fc5('0x9')][_0x5fc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c4718,_0x59dfda,_0x456136){return new BPromise(function(_0x328c90,_0x3e4295){return client[_0x5fc5('0xb')](_0x2c4718,_0x456136)['then'](function(_0x8b6de4){logger[_0x5fc5('0xc')](_0x5fc5('0xd'),_0x59dfda,_0x5fc5('0xe'));logger[_0x5fc5('0xf')](_0x5fc5('0x10'),_0x59dfda,_0x5fc5('0xe'),JSON[_0x5fc5('0x11')](_0x8b6de4));if(_0x8b6de4[_0x5fc5('0x12')]){if(_0x8b6de4[_0x5fc5('0x12')]['code']===0x1f4){logger[_0x5fc5('0x12')](_0x5fc5('0xd'),_0x59dfda,_0x8b6de4[_0x5fc5('0x12')][_0x5fc5('0x13')]);return _0x3e4295(_0x8b6de4[_0x5fc5('0x12')][_0x5fc5('0x13')]);}logger[_0x5fc5('0x12')](_0x5fc5('0xd'),_0x59dfda,_0x8b6de4[_0x5fc5('0x12')][_0x5fc5('0x13')]);return _0x328c90(_0x8b6de4['error'][_0x5fc5('0x13')]);}else{logger[_0x5fc5('0xc')]('ZendeskField,\x20%s,\x20%s',_0x59dfda,_0x5fc5('0xe'));_0x328c90(_0x8b6de4[_0x5fc5('0x14')][_0x5fc5('0x13')]);}})[_0x5fc5('0x15')](function(_0x4e47de){logger[_0x5fc5('0x12')](_0x5fc5('0xd'),_0x59dfda,_0x4e47de);_0x3e4295(_0x4e47de);});});} \ No newline at end of file +var _0xe1fb=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZendeskField,\x20%s,\x20%s','result'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0xe1fb,0xc9));var _0xbe1f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe1fb[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xbe1f('0x0'));var util=require(_0xbe1f('0x1'));var moment=require(_0xbe1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe1f('0x3'));var fs=require('fs');var Redis=require(_0xbe1f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe1f('0x5'));var logger=require(_0xbe1f('0x6'))(_0xbe1f('0x7'));var config=require(_0xbe1f('0x8'));var jayson=require(_0xbe1f('0x9'));var client=jayson[_0xbe1f('0xa')][_0xbe1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x456b42,_0x4f71ec,_0x5249a1){return new BPromise(function(_0x1e99e3,_0x24c4bc){return client[_0xbe1f('0xc')](_0x456b42,_0x5249a1)[_0xbe1f('0xd')](function(_0x1613d3){logger[_0xbe1f('0xe')]('ZendeskField,\x20%s,\x20%s',_0x4f71ec,_0xbe1f('0xf'));logger[_0xbe1f('0x10')](_0xbe1f('0x11'),_0x4f71ec,_0xbe1f('0xf'),JSON[_0xbe1f('0x12')](_0x1613d3));if(_0x1613d3[_0xbe1f('0x13')]){if(_0x1613d3[_0xbe1f('0x13')][_0xbe1f('0x14')]===0x1f4){logger[_0xbe1f('0x13')]('ZendeskField,\x20%s,\x20%s',_0x4f71ec,_0x1613d3['error'][_0xbe1f('0x15')]);return _0x24c4bc(_0x1613d3[_0xbe1f('0x13')][_0xbe1f('0x15')]);}logger['error'](_0xbe1f('0x16'),_0x4f71ec,_0x1613d3['error']['message']);return _0x1e99e3(_0x1613d3['error'][_0xbe1f('0x15')]);}else{logger[_0xbe1f('0xe')](_0xbe1f('0x16'),_0x4f71ec,'request\x20sent');_0x1e99e3(_0x1613d3[_0xbe1f('0x17')][_0xbe1f('0x15')]);}})[_0xbe1f('0x18')](function(_0x406c74){logger[_0xbe1f('0x13')]('ZendeskField,\x20%s,\x20%s',_0x4f71ec,_0x406c74);_0x24c4bc(_0x406c74);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 67df54a..68e1c9f 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 _0x6a0d=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','put','update','delete','destroy','exports','util','path'];(function(_0x49c550,_0xa9cdcd){var _0x39da96=function(_0x1dc6d8){while(--_0x1dc6d8){_0x49c550['push'](_0x49c550['shift']());}};_0x39da96(++_0xa9cdcd);}(_0x6a0d,0x18d));var _0xd6a0=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6a0d[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0xd6a0('0x0'));var path=require(_0xd6a0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd6a0('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xd6a0('0x3'));var config=require(_0xd6a0('0x4'));var controller=require('./intZohoAccount.controller');router[_0xd6a0('0x5')]('/',auth[_0xd6a0('0x6')](),controller[_0xd6a0('0x7')]);router[_0xd6a0('0x5')](_0xd6a0('0x8'),auth['isAuthenticated'](),controller[_0xd6a0('0x9')]);router['get'](_0xd6a0('0xa'),auth[_0xd6a0('0x6')](),controller[_0xd6a0('0xb')]);router[_0xd6a0('0x5')]('/:id/fields',auth[_0xd6a0('0x6')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd6a0('0xc')]('/:id/configurations',auth[_0xd6a0('0x6')](),controller[_0xd6a0('0xd')]);router[_0xd6a0('0xe')](_0xd6a0('0x8'),auth['isAuthenticated'](),controller[_0xd6a0('0xf')]);router[_0xd6a0('0x10')](_0xd6a0('0x8'),auth['isAuthenticated'](),controller[_0xd6a0('0x11')]);module[_0xd6a0('0x12')]=router; \ No newline at end of file +var _0xff34=['express','Router','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x13b8a6,_0x461a63){var _0x59a844=function(_0x573536){while(--_0x573536){_0x13b8a6['push'](_0x13b8a6['shift']());}};_0x59a844(++_0x461a63);}(_0xff34,0x178));var _0x4ff3=function(_0x4911ed,_0x476941){_0x4911ed=_0x4911ed-0x0;var _0x230288=_0xff34[_0x4911ed];return _0x230288;};'use strict';var multer=require(_0x4ff3('0x0'));var util=require(_0x4ff3('0x1'));var path=require(_0x4ff3('0x2'));var timeout=require(_0x4ff3('0x3'));var express=require(_0x4ff3('0x4'));var router=express[_0x4ff3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ff3('0x6'));var config=require(_0x4ff3('0x7'));var controller=require('./intZohoAccount.controller');router[_0x4ff3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4ff3('0x8')](_0x4ff3('0x9'),auth['isAuthenticated'](),controller[_0x4ff3('0xa')]);router[_0x4ff3('0x8')](_0x4ff3('0xb'),auth[_0x4ff3('0xc')](),controller[_0x4ff3('0xd')]);router[_0x4ff3('0x8')]('/:id/fields',auth[_0x4ff3('0xc')](),controller[_0x4ff3('0xe')]);router[_0x4ff3('0xf')]('/',auth[_0x4ff3('0xc')](),controller[_0x4ff3('0x10')]);router[_0x4ff3('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x4ff3('0xc')](),controller['update']);router[_0x4ff3('0x11')](_0x4ff3('0x9'),auth[_0x4ff3('0xc')](),controller[_0x4ff3('0x12')]);module[_0x4ff3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 166e36d..a2c5863 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 _0x6e51=['exports','STRING'];(function(_0x15fca0,_0x1cf85f){var _0x2e6a37=function(_0x5306cd){while(--_0x5306cd){_0x15fca0['push'](_0x15fca0['shift']());}};_0x2e6a37(++_0x1cf85f);}(_0x6e51,0x138));var _0x16e5=function(_0x51020c,_0x28eb60){_0x51020c=_0x51020c-0x0;var _0x29280d=_0x6e51[_0x51020c];return _0x29280d;};'use strict';var Sequelize=require('sequelize');module[_0x16e5('0x0')]={'name':{'type':Sequelize[_0x16e5('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x16e5('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x16e5('0x1')]},'clientSecret':{'type':Sequelize[_0x16e5('0x1')]},'serverUrl':{'type':Sequelize[_0x16e5('0x1')]},'code':{'type':Sequelize[_0x16e5('0x1')]},'refreshToken':{'type':Sequelize[_0x16e5('0x1')]}}; \ No newline at end of file +var _0x682e=['sequelize','exports','STRING'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x682e,0x1ce));var _0xe682=function(_0x4b1a6f,_0x2a7e3d){_0x4b1a6f=_0x4b1a6f-0x0;var _0x5d9378=_0x682e[_0x4b1a6f];return _0x5d9378;};'use strict';var Sequelize=require(_0xe682('0x0'));module[_0xe682('0x1')]={'name':{'type':Sequelize[_0xe682('0x2')]},'description':{'type':Sequelize[_0xe682('0x2')]},'host':{'type':Sequelize[_0xe682('0x2')]},'zone':{'type':Sequelize[_0xe682('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe682('0x2')]},'serverUrl':{'type':Sequelize[_0xe682('0x2')]},'code':{'type':Sequelize[_0xe682('0x2')]},'refreshToken':{'type':Sequelize[_0xe682('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 4171f44..c5371a3 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 _0x0236=['sort','where','pick','filters','filter','merge','findAll','params','includeAll','options','find','body','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','getDescriptions','create','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','host','clientId','serverUrl','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../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~!@#$%^&-_=+[{]}.','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','Content-Range','save','update','then','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','limit','order'];(function(_0x3185ad,_0x5e5ca2){var _0x4f77fb=function(_0x435aca){while(--_0x435aca){_0x3185ad['push'](_0x3185ad['shift']());}};_0x4f77fb(++_0x5e5ca2);}(_0x0236,0xce));var _0x6023=function(_0x12d917,_0x59ddd4){_0x12d917=_0x12d917-0x0;var _0x576d1a=_0x0236[_0x12d917];return _0x576d1a;};'use strict';var pdf=require(_0x6023('0x0'));var emlformat=require(_0x6023('0x1'));var rimraf=require(_0x6023('0x2'));var zipdir=require(_0x6023('0x3'));var jsonpatch=require(_0x6023('0x4'));var rp=require('request-promise');var moment=require(_0x6023('0x5'));var BPromise=require(_0x6023('0x6'));var Mustache=require('mustache');var util=require(_0x6023('0x7'));var path=require(_0x6023('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6023('0x9'));var squel=require(_0x6023('0xa'));var crypto=require(_0x6023('0xb'));var jsforce=require(_0x6023('0xc'));var deskjs=require(_0x6023('0xd'));var toCsv=require(_0x6023('0xe'));var querystring=require(_0x6023('0xf'));var Papa=require(_0x6023('0x10'));var Redis=require('ioredis');var authService=require(_0x6023('0x11'));var qs=require(_0x6023('0x12'));var as=require(_0x6023('0x13'));var hardwareService=require(_0x6023('0x14'));var logger=require(_0x6023('0x15'))('api');var utils=require(_0x6023('0x16'));var config=require('../../config/environment');var db=require(_0x6023('0x17'))['db'];var integrations=require(_0x6023('0x18'));var jayson=require(_0x6023('0x19'));var client=jayson['client'][_0x6023('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x29bc2a,_0x45290f,_0x27c48e){if(_0x27c48e){var _0x5cb1e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5cb1e5[_0x6023('0x1b')](_0x45290f)){return _0x29bc2a;}else{throw new db[(_0x6023('0x1c'))][(_0x6023('0x1d'))](_0x6023('0x1e'));}}else{return _0x29bc2a;}}function respondWithRpcPromise(_0x3627b2,_0x184dc0,_0x9470d2,_0x5e9ce6){return new BPromise(function(_0x133544,_0x144b70){var _0x195b14=_0x5e9ce6||client;return _0x195b14['request'](_0x3627b2,_0x9470d2)['then'](function(_0x500ec5){logger[_0x6023('0x1f')](_0x6023('0x20'),_0x184dc0,_0x6023('0x21'));logger[_0x6023('0x22')](_0x6023('0x23'),_0x184dc0,'request\x20sent',JSON[_0x6023('0x24')](_0x500ec5));if(_0x500ec5[_0x6023('0x25')]){if(_0x500ec5[_0x6023('0x25')][_0x6023('0x26')]===0x1f4){logger[_0x6023('0x25')](_0x6023('0x20'),_0x184dc0,_0x500ec5[_0x6023('0x25')][_0x6023('0x27')]);return _0x144b70(_0x500ec5['error'][_0x6023('0x27')]);}logger['error'](_0x6023('0x20'),_0x184dc0,_0x500ec5[_0x6023('0x25')]['message']);return _0x133544(_0x500ec5['error']['message']);}else{logger[_0x6023('0x1f')](_0x6023('0x20'),_0x184dc0,_0x6023('0x21'));_0x133544(_0x500ec5['result']['message']);}})[_0x6023('0x28')](function(_0x217729){logger[_0x6023('0x25')](_0x6023('0x20'),_0x184dc0,_0x217729);_0x144b70(_0x217729);});});}function respondWithStatusCode(_0x1bbe5d,_0x403edd){_0x403edd=_0x403edd||0xcc;return function(_0x163280){if(_0x163280){return _0x1bbe5d[_0x6023('0x29')](_0x403edd);}return _0x1bbe5d[_0x6023('0x2a')](_0x403edd)[_0x6023('0x2b')]();};}function respondWithResult(_0x5f01f9,_0x3294e3){_0x3294e3=_0x3294e3||0xc8;return function(_0x4a34f9){if(_0x4a34f9){return _0x5f01f9[_0x6023('0x2a')](_0x3294e3)[_0x6023('0x2c')](_0x4a34f9);}};}function respondWithFilteredResult(_0x48dfd2,_0x1cab1b){return function(_0x4b7136){if(_0x4b7136){var _0x5eb3c1=_0x4b7136[_0x6023('0x2d')],_0xe8128a=_0x1cab1b[_0x6023('0x2e')],_0x6b0112=_0x1cab1b['offset']+_0x1cab1b['limit'],_0x2366cc;if(_0x6b0112>=_0x5eb3c1){_0x6b0112=_0x5eb3c1;_0x2366cc=0xc8;}else{_0x2366cc=0xce;}_0x48dfd2[_0x6023('0x2a')](_0x2366cc);return _0x48dfd2['set'](_0x6023('0x2f'),_0xe8128a+'-'+_0x6b0112+'/'+_0x5eb3c1)[_0x6023('0x2c')](_0x4b7136);}return null;};}function patchUpdates(_0x437f33){return function(_0x123a2a){try{jsonpatch['apply'](_0x123a2a,_0x437f33,!![]);}catch(_0x102d43){return BPromise['reject'](_0x102d43);}return _0x123a2a[_0x6023('0x30')]();};}function saveUpdates(_0x3679dd,_0x41c3d0){return function(_0x32e90c){if(_0x32e90c){return _0x32e90c[_0x6023('0x31')](_0x3679dd)[_0x6023('0x32')](function(_0x2183eb){return _0x2183eb;});}return null;};}function removeEntity(_0x2a4cc8,_0x2b7ce1){return function(_0x5de172){if(_0x5de172){return _0x5de172[_0x6023('0x33')]()[_0x6023('0x32')](function(){_0x2a4cc8[_0x6023('0x2a')](0xcc)[_0x6023('0x2b')]();});}};}function handleEntityNotFound(_0x1a6073,_0x4e4feb){return function(_0x2280f0){if(!_0x2280f0){_0x1a6073['sendStatus'](0x194);}return _0x2280f0;};}function handleError(_0xd803be,_0x353b47){_0x353b47=_0x353b47||0x1f4;return function(_0x2c370d){logger[_0x6023('0x25')](_0x2c370d[_0x6023('0x34')]);if(_0x2c370d[_0x6023('0x35')]){delete _0x2c370d[_0x6023('0x35')];}_0xd803be[_0x6023('0x2a')](_0x353b47)[_0x6023('0x36')](_0x2c370d);};}exports[_0x6023('0x37')]=function(_0xacfa65,_0x3f05e5){var _0x1c62ed={},_0x3e07a3={},_0x1862fd={'count':0x0,'rows':[]};var _0xb2e79a=_[_0x6023('0x38')](db[_0x6023('0x39')][_0x6023('0x3a')],function(_0x1272d9){return{'name':_0x1272d9[_0x6023('0x3b')],'type':_0x1272d9[_0x6023('0x3c')][_0x6023('0x3d')]};});_0x3e07a3[_0x6023('0x3e')]=_[_0x6023('0x38')](_0xb2e79a,_0x6023('0x35'));_0x3e07a3['query']=_[_0x6023('0x3f')](_0xacfa65[_0x6023('0x40')]);_0x3e07a3['filters']=_[_0x6023('0x41')](_0x3e07a3[_0x6023('0x3e')],_0x3e07a3['query']);_0x1c62ed['attributes']=_['intersection'](_0x3e07a3[_0x6023('0x3e')],qs[_0x6023('0x42')](_0xacfa65[_0x6023('0x40')][_0x6023('0x42')]));_0x1c62ed['attributes']=_0x1c62ed[_0x6023('0x43')][_0x6023('0x44')]?_0x1c62ed['attributes']:_0x3e07a3[_0x6023('0x3e')];if(!_0xacfa65['query']['hasOwnProperty'](_0x6023('0x45'))){_0x1c62ed[_0x6023('0x46')]=qs[_0x6023('0x46')](_0xacfa65['query'][_0x6023('0x46')]);_0x1c62ed[_0x6023('0x2e')]=qs[_0x6023('0x2e')](_0xacfa65[_0x6023('0x40')][_0x6023('0x2e')]);}_0x1c62ed[_0x6023('0x47')]=qs[_0x6023('0x48')](_0xacfa65[_0x6023('0x40')]['sort']);_0x1c62ed[_0x6023('0x49')]=qs['filters'](_[_0x6023('0x4a')](_0xacfa65[_0x6023('0x40')],_0x3e07a3[_0x6023('0x4b')]),_0xb2e79a);if(_0xacfa65[_0x6023('0x40')][_0x6023('0x4c')]){_0x1c62ed[_0x6023('0x49')]=_[_0x6023('0x4d')](_0x1c62ed[_0x6023('0x49')],{'$or':_['map'](_0xb2e79a,function(_0x2f37ff){if(_0x2f37ff[_0x6023('0x3c')]!=='VIRTUAL'){var _0x32c81c={};_0x32c81c[_0x2f37ff[_0x6023('0x35')]]={'$like':'%'+_0xacfa65[_0x6023('0x40')][_0x6023('0x4c')]+'%'};return _0x32c81c;}})});}_0x1c62ed=_[_0x6023('0x4d')]({},_0x1c62ed,_0xacfa65['options']);var _0x2e5648={'where':_0x1c62ed[_0x6023('0x49')]};return db['ZohoAccount'][_0x6023('0x2d')](_0x2e5648)[_0x6023('0x32')](function(_0x1732ca){_0x1862fd[_0x6023('0x2d')]=_0x1732ca;if(_0xacfa65['query']['includeAll']){_0x1c62ed['include']=[{'all':!![]}];}return db[_0x6023('0x39')][_0x6023('0x4e')](_0x1c62ed);})[_0x6023('0x32')](function(_0x4476c0){_0x1862fd['rows']=_0x4476c0;return _0x1862fd;})[_0x6023('0x32')](respondWithFilteredResult(_0x3f05e5,_0x1c62ed))['catch'](handleError(_0x3f05e5,null));};exports['show']=function(_0xbab65,_0x113be0){var _0x26ad4c={'raw':![],'where':{'id':_0xbab65[_0x6023('0x4f')]['id']}},_0x563a6b={};_0x563a6b[_0x6023('0x3e')]=_[_0x6023('0x3f')](db[_0x6023('0x39')][_0x6023('0x3a')]);_0x563a6b[_0x6023('0x40')]=_['keys'](_0xbab65[_0x6023('0x40')]);_0x563a6b[_0x6023('0x4b')]=_['intersection'](_0x563a6b[_0x6023('0x3e')],_0x563a6b['query']);_0x26ad4c[_0x6023('0x43')]=_[_0x6023('0x41')](_0x563a6b[_0x6023('0x3e')],qs[_0x6023('0x42')](_0xbab65[_0x6023('0x40')][_0x6023('0x42')]));_0x26ad4c[_0x6023('0x43')]=_0x26ad4c[_0x6023('0x43')]['length']?_0x26ad4c[_0x6023('0x43')]:_0x563a6b[_0x6023('0x3e')];if(_0xbab65[_0x6023('0x40')][_0x6023('0x50')]){_0x26ad4c['include']=[{'all':!![]}];}_0x26ad4c=_['merge']({},_0x26ad4c,_0xbab65[_0x6023('0x51')]);return db['ZohoAccount'][_0x6023('0x52')](_0x26ad4c)[_0x6023('0x32')](handleEntityNotFound(_0x113be0,null))[_0x6023('0x32')](respondWithResult(_0x113be0,null))[_0x6023('0x28')](handleError(_0x113be0,null));};exports['create']=function(_0x5e0c55,_0x46b456){return db['ZohoAccount']['create'](_0x5e0c55[_0x6023('0x53')],{})[_0x6023('0x32')](respondWithResult(_0x46b456,0xc9))['catch'](handleError(_0x46b456,null));};exports['update']=function(_0x2ef322,_0x25e9b4){if(_0x2ef322[_0x6023('0x53')]['id']){delete _0x2ef322[_0x6023('0x53')]['id'];}return db[_0x6023('0x39')][_0x6023('0x52')]({'where':{'id':_0x2ef322['params']['id']}})[_0x6023('0x32')](handleEntityNotFound(_0x25e9b4,null))[_0x6023('0x32')](saveUpdates(_0x2ef322[_0x6023('0x53')],null))[_0x6023('0x32')](respondWithResult(_0x25e9b4,null))[_0x6023('0x28')](handleError(_0x25e9b4,null));};exports[_0x6023('0x33')]=function(_0x540649,_0x59a52e){return db[_0x6023('0x39')]['find']({'where':{'id':_0x540649[_0x6023('0x4f')]['id']}})['then'](handleEntityNotFound(_0x59a52e,null))[_0x6023('0x32')](removeEntity(_0x59a52e,null))[_0x6023('0x28')](handleError(_0x59a52e,null));};exports['getConfigurations']=function(_0x5abd5a,_0x33c75a,_0x1f477c){var _0x36c54f={};var _0x76b84a={};var _0x33fb7f;var _0x27ef45;return db['ZohoAccount'][_0x6023('0x54')]({'where':{'id':_0x5abd5a['params']['id']}})[_0x6023('0x32')](handleEntityNotFound(_0x33c75a,null))['then'](function(_0x5464ae){if(_0x5464ae){_0x33fb7f=_0x5464ae;_0x76b84a['model']=_[_0x6023('0x3f')](db[_0x6023('0x55')][_0x6023('0x3a')]);_0x76b84a[_0x6023('0x40')]=_['keys'](_0x5abd5a[_0x6023('0x40')]);_0x76b84a[_0x6023('0x4b')]=_[_0x6023('0x41')](_0x76b84a[_0x6023('0x3e')],_0x76b84a['query']);_0x36c54f[_0x6023('0x43')]=_['intersection'](_0x76b84a[_0x6023('0x3e')],qs[_0x6023('0x42')](_0x5abd5a[_0x6023('0x40')][_0x6023('0x42')]));_0x36c54f[_0x6023('0x43')]=_0x36c54f['attributes'][_0x6023('0x44')]?_0x36c54f[_0x6023('0x43')]:_0x76b84a[_0x6023('0x3e')];_0x36c54f[_0x6023('0x47')]=qs[_0x6023('0x48')](_0x5abd5a['query'][_0x6023('0x48')]);_0x36c54f[_0x6023('0x49')]=qs[_0x6023('0x4b')](_[_0x6023('0x4a')](_0x5abd5a[_0x6023('0x40')],_0x76b84a[_0x6023('0x4b')]));if(_0x5abd5a[_0x6023('0x40')][_0x6023('0x4c')]){_0x36c54f['where']=_[_0x6023('0x4d')](_0x36c54f[_0x6023('0x49')],{'$or':_[_0x6023('0x38')](_0x36c54f[_0x6023('0x43')],function(_0xd69b7){var _0xec801b={};_0xec801b[_0xd69b7]={'$like':'%'+_0x5abd5a[_0x6023('0x40')][_0x6023('0x4c')]+'%'};return _0xec801b;})});}_0x36c54f=_[_0x6023('0x4d')]({},_0x36c54f,_0x5abd5a['options']);return _0x33fb7f[_0x6023('0x56')](_0x36c54f);}})[_0x6023('0x32')](function(_0x1ff6c8){if(_0x1ff6c8){_0x27ef45=_0x1ff6c8[_0x6023('0x44')];if(!_0x5abd5a[_0x6023('0x40')]['hasOwnProperty']('nolimit')){_0x36c54f[_0x6023('0x46')]=qs[_0x6023('0x46')](_0x5abd5a[_0x6023('0x40')]['limit']);_0x36c54f[_0x6023('0x2e')]=qs[_0x6023('0x2e')](_0x5abd5a[_0x6023('0x40')][_0x6023('0x2e')]);}return _0x33fb7f['getConfigurations'](_0x36c54f);}})[_0x6023('0x32')](function(_0x3b0755){if(_0x3b0755){return _0x3b0755?{'count':_0x27ef45,'rows':_0x3b0755}:null;}})[_0x6023('0x32')](respondWithResult(_0x33c75a,null))['catch'](handleError(_0x33c75a,null));};exports[_0x6023('0x57')]=function(_0x8a8fc9,_0x25bea9,_0x29c8af){if(_0x8a8fc9[_0x6023('0x53')]['id']){delete _0x8a8fc9['body']['id'];}return db[_0x6023('0x39')][_0x6023('0x54')]({'where':{'id':_0x8a8fc9[_0x6023('0x4f')]['id']}})['then'](handleEntityNotFound(_0x25bea9,null))[_0x6023('0x32')](function(_0xf0a6d7){if(_0xf0a6d7){_0x8a8fc9[_0x6023('0x53')][_0x6023('0x58')]=_0xf0a6d7['id'];_0x8a8fc9[_0x6023('0x53')]['Subjects']=integrations[_0x6023('0x59')](_0x8a8fc9[_0x6023('0x53')][_0x6023('0x5a')],_0x8a8fc9[_0x6023('0x53')][_0x6023('0x3c')]);_0x8a8fc9['body']['Descriptions']=integrations[_0x6023('0x5b')](_0x8a8fc9[_0x6023('0x53')]['channel'],_0x8a8fc9[_0x6023('0x53')][_0x6023('0x3c')]);return db['ZohoConfiguration'][_0x6023('0x5c')](_0x8a8fc9['body'],{'include':[{'model':db[_0x6023('0x5d')],'as':_0x6023('0x5e')},{'model':db['ZohoField'],'as':_0x6023('0x5f')}]});}return null;})[_0x6023('0x32')](respondWithResult(_0x25bea9,null))[_0x6023('0x28')](handleError(_0x25bea9,null));};function getAccessToken(_0x3c4b21){return new Promise(function(_0x27f2fd,_0x5498e9){var _0x573a19;switch(_0x3c4b21[_0x6023('0x60')]){case'US':_0x573a19='https://accounts.zoho.com';break;case'AU':_0x573a19=_0x6023('0x61');break;case'EU':_0x573a19=_0x6023('0x62');break;case'IN':_0x573a19='https://accounts.zoho.in';break;case'CN':_0x573a19=_0x6023('0x63');break;default:_0x573a19=_0x6023('0x62');break;}var _0x449afb={'method':_0x6023('0x64'),'uri':_0x573a19+_0x6023('0x65'),'qs':{'refresh_token':_0x3c4b21[_0x6023('0x66')],'client_id':_0x3c4b21['clientId'],'client_secret':_0x3c4b21[_0x6023('0x67')],'grant_type':_0x6023('0x68')},'json':!![]};return rp(_0x449afb)[_0x6023('0x32')](function(_0x53a336){if(_0x53a336['access_token']){_0x27f2fd(_0x53a336[_0x6023('0x69')]);}else{_0x5498e9('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x6023('0x28')](function(_0x4eb238){_0x5498e9(_0x4eb238);});});}exports['getFields']=function(_0x421980,_0x4bc9f4,_0x2ddbb7){var _0xa2fee8,_0x47ec0a,_0x39150c,_0x2829df,_0x32c636;return db['ZohoAccount'][_0x6023('0x54')]({'where':{'id':_0x421980[_0x6023('0x4f')]['id']},'attributes':['id',_0x6023('0x6a'),_0x6023('0x60'),_0x6023('0x6b'),'clientSecret',_0x6023('0x6c'),_0x6023('0x26'),'refreshToken']})['then'](handleEntityNotFound(_0x4bc9f4,null))['then'](function(_0x1ae814){_0x32c636=_0x1ae814;_0xa2fee8=_0x32c636[_0x6023('0x6a')];_0x47ec0a=_0xa2fee8==='zoho.eu'?'eu':_0x6023('0x6d');_0x39150c=_0x32c636[_0x6023('0x6c')];var _0x5b937e=_0x39150c[_0x6023('0x6e')](-0x1);if(_0x5b937e==='/'||_0x5b937e==='\x5c'||_0x5b937e===':'){_0x39150c=_0x39150c[_0x6023('0x6f')](0x0,_0x39150c[_0x6023('0x70')](_0x5b937e));}if(!_0x32c636['refreshToken']){throw new Error(_0x6023('0x71'));}return getAccessToken(_0x32c636);})[_0x6023('0x32')](function(_0x5d9d94){if(_0x5d9d94){return rp({'method':_0x6023('0x72'),'uri':util[_0x6023('0x73')](_0x6023('0x74'),_0x47ec0a),'qs':{'module':_0x6023('0x75')},'headers':{'Authorization':_0x6023('0x76')+_0x5d9d94},'json':!![]});}})['then'](function(_0xdb7bf3){if(_0xdb7bf3){if(_0xdb7bf3[_0x6023('0x77')]&&_0xdb7bf3['response'][_0x6023('0x25')]){throw new Error(_0xdb7bf3[_0x6023('0x77')][_0x6023('0x25')][_0x6023('0x27')]);}var _0x308941=[];var _0x34c89b=[];var _0x2fdde4=[_0x6023('0x78'),_0x6023('0x79'),_0x6023('0x7a'),_0x6023('0x7b'),_0x6023('0x7c'),_0x6023('0x7d'),_0x6023('0x7e'),_0x6023('0x7f')];_0x34c89b=_[_0x6023('0x80')](_0xdb7bf3[_0x6023('0x42')],function(_0x478c00){return _0x2fdde4[_0x6023('0x81')](_0x478c00[_0x6023('0x82')]);});for(var _0x76a146=0x0;_0x76a146<_0x34c89b[_0x6023('0x44')];_0x76a146++){if(_0x34c89b[_0x76a146][_0x6023('0x83')]===![]){_0x308941['push']({'id':_0x34c89b[_0x76a146]['id'],'name':_0x34c89b[_0x76a146][_0x6023('0x84')],'custom':_0x34c89b[_0x76a146][_0x6023('0x85')],'options':_0x34c89b[_0x76a146][_0x6023('0x86')]===_0x6023('0x87')&&_0x34c89b[_0x76a146][_0x6023('0x88')][_0x6023('0x44')]>-0x1?_[_0x6023('0x38')](_0x34c89b[_0x76a146][_0x6023('0x88')],function(_0x38bca7){return{'name':_0x38bca7,'value':_0x38bca7};}):[]});}}return{'count':_0x308941[_0x6023('0x44')],'rows':_0x308941};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4bc9f4,null))[_0x6023('0x28')](function(_0x3eacd4){var _0x260a56=_0x421980[_0x6023('0x40')][_0x6023('0x1b')]?0x1f4:_0x3eacd4['statusCode']||0x1f4;logger['error'](_0x6023('0x89'),'getFields',_0x260a56,JSON['stringify'](_0x3eacd4));delete _0x3eacd4['name'];if(_0x260a56===0x191){_0x260a56=0x190;}_0x4bc9f4['status'](_0x260a56)['send'](_0x421980[_0x6023('0x40')][_0x6023('0x1b')]?{'message':_0x6023('0x8a'),'statusCode':_0x3eacd4['statusCode']}:_0x3eacd4);});}; \ No newline at end of file +var _0x221b=['ZohoConfiguration','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Call_Duration','Call_Result','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x221b,0x13a));var _0xb221=function(_0x4925d2,_0x33dd4a){_0x4925d2=_0x4925d2-0x0;var _0x164d3e=_0x221b[_0x4925d2];return _0x164d3e;};'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(_0xb221('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb221('0x5'));var util=require(_0xb221('0x6'));var path=require(_0xb221('0x7'));var sox=require(_0xb221('0x8'));var csv=require(_0xb221('0x9'));var ejs=require(_0xb221('0xa'));var fs=require('fs');var _=require(_0xb221('0xb'));var squel=require('squel');var crypto=require(_0xb221('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb221('0xd'));var toCsv=require(_0xb221('0x9'));var querystring=require(_0xb221('0xe'));var Papa=require('papaparse');var Redis=require(_0xb221('0xf'));var authService=require(_0xb221('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb221('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb221('0x12'));var utils=require(_0xb221('0x13'));var config=require(_0xb221('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb221('0x15'));var jayson=require(_0xb221('0x16'));var client=jayson['client'][_0xb221('0x17')]({'port':0x232a});function checkPasswordPattern(_0x5e18e9,_0x2064a5,_0x4c8cc5){if(_0x4c8cc5){var _0x288f24=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x288f24['test'](_0x2064a5)){return _0x5e18e9;}else{throw new db['Sequelize'][(_0xb221('0x18'))](_0xb221('0x19'));}}else{return _0x5e18e9;}}function respondWithRpcPromise(_0x8bdc20,_0x5d4a82,_0x48eb4f,_0x22b7b7){return new BPromise(function(_0x1b2e2d,_0x54a58b){var _0x38f297=_0x22b7b7||client;return _0x38f297['request'](_0x8bdc20,_0x48eb4f)[_0xb221('0x1a')](function(_0x3c74b1){logger[_0xb221('0x1b')](_0xb221('0x1c'),_0x5d4a82,'request\x20sent');logger[_0xb221('0x1d')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5d4a82,_0xb221('0x1e'),JSON['stringify'](_0x3c74b1));if(_0x3c74b1[_0xb221('0x1f')]){if(_0x3c74b1[_0xb221('0x1f')][_0xb221('0x20')]===0x1f4){logger[_0xb221('0x1f')]('ZohoAccount,\x20%s,\x20%s',_0x5d4a82,_0x3c74b1[_0xb221('0x1f')]['message']);return _0x54a58b(_0x3c74b1[_0xb221('0x1f')][_0xb221('0x21')]);}logger['error'](_0xb221('0x1c'),_0x5d4a82,_0x3c74b1['error'][_0xb221('0x21')]);return _0x1b2e2d(_0x3c74b1[_0xb221('0x1f')]['message']);}else{logger[_0xb221('0x1b')](_0xb221('0x1c'),_0x5d4a82,'request\x20sent');_0x1b2e2d(_0x3c74b1['result'][_0xb221('0x21')]);}})[_0xb221('0x22')](function(_0x3a5786){logger[_0xb221('0x1f')](_0xb221('0x1c'),_0x5d4a82,_0x3a5786);_0x54a58b(_0x3a5786);});});}function respondWithStatusCode(_0x2bfb9b,_0x968272){_0x968272=_0x968272||0xcc;return function(_0x3570b8){if(_0x3570b8){return _0x2bfb9b[_0xb221('0x23')](_0x968272);}return _0x2bfb9b['status'](_0x968272)[_0xb221('0x24')]();};}function respondWithResult(_0x498c7c,_0x1390ed){_0x1390ed=_0x1390ed||0xc8;return function(_0x4edd75){if(_0x4edd75){return _0x498c7c[_0xb221('0x25')](_0x1390ed)['json'](_0x4edd75);}};}function respondWithFilteredResult(_0x125356,_0x3a1a0f){return function(_0xcb38b1){if(_0xcb38b1){var _0x2fa87f=_0xcb38b1[_0xb221('0x26')],_0x392c27=_0x3a1a0f[_0xb221('0x27')],_0x12ae52=_0x3a1a0f['offset']+_0x3a1a0f['limit'],_0x666e8c;if(_0x12ae52>=_0x2fa87f){_0x12ae52=_0x2fa87f;_0x666e8c=0xc8;}else{_0x666e8c=0xce;}_0x125356[_0xb221('0x25')](_0x666e8c);return _0x125356[_0xb221('0x28')](_0xb221('0x29'),_0x392c27+'-'+_0x12ae52+'/'+_0x2fa87f)[_0xb221('0x2a')](_0xcb38b1);}return null;};}function patchUpdates(_0x1cad1d){return function(_0x1fd765){try{jsonpatch[_0xb221('0x2b')](_0x1fd765,_0x1cad1d,!![]);}catch(_0x6a78ee){return BPromise[_0xb221('0x2c')](_0x6a78ee);}return _0x1fd765[_0xb221('0x2d')]();};}function saveUpdates(_0x24e4c6,_0x3adc25){return function(_0x3ec456){if(_0x3ec456){return _0x3ec456[_0xb221('0x2e')](_0x24e4c6)['then'](function(_0x46afc1){return _0x46afc1;});}return null;};}function removeEntity(_0x4147af,_0x527b13){return function(_0x3b59c6){if(_0x3b59c6){return _0x3b59c6[_0xb221('0x2f')]()['then'](function(){_0x4147af[_0xb221('0x25')](0xcc)[_0xb221('0x24')]();});}};}function handleEntityNotFound(_0x5d5853,_0x418b83){return function(_0x353cc5){if(!_0x353cc5){_0x5d5853[_0xb221('0x23')](0x194);}return _0x353cc5;};}function handleError(_0x37fce1,_0x17e309){_0x17e309=_0x17e309||0x1f4;return function(_0x58c38a){logger[_0xb221('0x1f')](_0x58c38a[_0xb221('0x30')]);if(_0x58c38a[_0xb221('0x31')]){delete _0x58c38a[_0xb221('0x31')];}_0x37fce1[_0xb221('0x25')](_0x17e309)['send'](_0x58c38a);};}exports[_0xb221('0x32')]=function(_0x58bd79,_0x236c8a){var _0x2d285f={},_0x4ffc22={},_0x442e61={'count':0x0,'rows':[]};var _0x34b9d3=_['map'](db[_0xb221('0x33')][_0xb221('0x34')],function(_0x2ecf95){return{'name':_0x2ecf95[_0xb221('0x35')],'type':_0x2ecf95[_0xb221('0x36')][_0xb221('0x37')]};});_0x4ffc22[_0xb221('0x38')]=_[_0xb221('0x39')](_0x34b9d3,_0xb221('0x31'));_0x4ffc22[_0xb221('0x3a')]=_[_0xb221('0x3b')](_0x58bd79[_0xb221('0x3a')]);_0x4ffc22[_0xb221('0x3c')]=_[_0xb221('0x3d')](_0x4ffc22[_0xb221('0x38')],_0x4ffc22[_0xb221('0x3a')]);_0x2d285f[_0xb221('0x3e')]=_[_0xb221('0x3d')](_0x4ffc22[_0xb221('0x38')],qs[_0xb221('0x3f')](_0x58bd79[_0xb221('0x3a')][_0xb221('0x3f')]));_0x2d285f[_0xb221('0x3e')]=_0x2d285f['attributes'][_0xb221('0x40')]?_0x2d285f[_0xb221('0x3e')]:_0x4ffc22['model'];if(!_0x58bd79['query'][_0xb221('0x41')](_0xb221('0x42'))){_0x2d285f[_0xb221('0x43')]=qs['limit'](_0x58bd79['query'][_0xb221('0x43')]);_0x2d285f['offset']=qs[_0xb221('0x27')](_0x58bd79[_0xb221('0x3a')][_0xb221('0x27')]);}_0x2d285f[_0xb221('0x44')]=qs[_0xb221('0x45')](_0x58bd79['query'][_0xb221('0x45')]);_0x2d285f[_0xb221('0x46')]=qs[_0xb221('0x3c')](_[_0xb221('0x47')](_0x58bd79[_0xb221('0x3a')],_0x4ffc22[_0xb221('0x3c')]),_0x34b9d3);if(_0x58bd79[_0xb221('0x3a')][_0xb221('0x48')]){_0x2d285f[_0xb221('0x46')]=_[_0xb221('0x49')](_0x2d285f[_0xb221('0x46')],{'$or':_[_0xb221('0x39')](_0x34b9d3,function(_0x20fbbc){if(_0x20fbbc[_0xb221('0x36')]!=='VIRTUAL'){var _0x4086d2={};_0x4086d2[_0x20fbbc[_0xb221('0x31')]]={'$like':'%'+_0x58bd79[_0xb221('0x3a')][_0xb221('0x48')]+'%'};return _0x4086d2;}})});}_0x2d285f=_[_0xb221('0x49')]({},_0x2d285f,_0x58bd79[_0xb221('0x4a')]);var _0x148878={'where':_0x2d285f[_0xb221('0x46')]};return db[_0xb221('0x33')]['count'](_0x148878)['then'](function(_0x41f314){_0x442e61[_0xb221('0x26')]=_0x41f314;if(_0x58bd79[_0xb221('0x3a')][_0xb221('0x4b')]){_0x2d285f[_0xb221('0x4c')]=[{'all':!![]}];}return db[_0xb221('0x33')]['findAll'](_0x2d285f);})['then'](function(_0x22394d){_0x442e61[_0xb221('0x4d')]=_0x22394d;return _0x442e61;})[_0xb221('0x1a')](respondWithFilteredResult(_0x236c8a,_0x2d285f))[_0xb221('0x22')](handleError(_0x236c8a,null));};exports[_0xb221('0x4e')]=function(_0x156abd,_0xb26ffe){var _0x20f16b={'raw':![],'where':{'id':_0x156abd[_0xb221('0x4f')]['id']}},_0xde2086={};_0xde2086['model']=_['keys'](db[_0xb221('0x33')][_0xb221('0x34')]);_0xde2086['query']=_[_0xb221('0x3b')](_0x156abd[_0xb221('0x3a')]);_0xde2086[_0xb221('0x3c')]=_['intersection'](_0xde2086[_0xb221('0x38')],_0xde2086['query']);_0x20f16b[_0xb221('0x3e')]=_[_0xb221('0x3d')](_0xde2086[_0xb221('0x38')],qs[_0xb221('0x3f')](_0x156abd[_0xb221('0x3a')][_0xb221('0x3f')]));_0x20f16b['attributes']=_0x20f16b[_0xb221('0x3e')][_0xb221('0x40')]?_0x20f16b[_0xb221('0x3e')]:_0xde2086['model'];if(_0x156abd[_0xb221('0x3a')][_0xb221('0x4b')]){_0x20f16b[_0xb221('0x4c')]=[{'all':!![]}];}_0x20f16b=_[_0xb221('0x49')]({},_0x20f16b,_0x156abd[_0xb221('0x4a')]);return db['ZohoAccount'][_0xb221('0x50')](_0x20f16b)[_0xb221('0x1a')](handleEntityNotFound(_0xb26ffe,null))[_0xb221('0x1a')](respondWithResult(_0xb26ffe,null))['catch'](handleError(_0xb26ffe,null));};exports[_0xb221('0x51')]=function(_0x2ba8d2,_0x5d879a){return db[_0xb221('0x33')][_0xb221('0x51')](_0x2ba8d2[_0xb221('0x52')],{})[_0xb221('0x1a')](respondWithResult(_0x5d879a,0xc9))[_0xb221('0x22')](handleError(_0x5d879a,null));};exports['update']=function(_0x5e9270,_0x4786eb){if(_0x5e9270[_0xb221('0x52')]['id']){delete _0x5e9270['body']['id'];}return db['ZohoAccount'][_0xb221('0x50')]({'where':{'id':_0x5e9270[_0xb221('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4786eb,null))['then'](saveUpdates(_0x5e9270[_0xb221('0x52')],null))[_0xb221('0x1a')](respondWithResult(_0x4786eb,null))[_0xb221('0x22')](handleError(_0x4786eb,null));};exports[_0xb221('0x2f')]=function(_0x26dbb0,_0xf71dc1){return db[_0xb221('0x33')][_0xb221('0x50')]({'where':{'id':_0x26dbb0[_0xb221('0x4f')]['id']}})[_0xb221('0x1a')](handleEntityNotFound(_0xf71dc1,null))[_0xb221('0x1a')](removeEntity(_0xf71dc1,null))[_0xb221('0x22')](handleError(_0xf71dc1,null));};exports[_0xb221('0x53')]=function(_0x3665da,_0x46b41b,_0x5d6ff8){var _0x5903fa={};var _0x4256e8={};var _0x25409a;var _0x3cd6e0;return db['ZohoAccount'][_0xb221('0x54')]({'where':{'id':_0x3665da[_0xb221('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46b41b,null))[_0xb221('0x1a')](function(_0x166ff5){if(_0x166ff5){_0x25409a=_0x166ff5;_0x4256e8[_0xb221('0x38')]=_[_0xb221('0x3b')](db['ZohoConfiguration'][_0xb221('0x34')]);_0x4256e8[_0xb221('0x3a')]=_[_0xb221('0x3b')](_0x3665da[_0xb221('0x3a')]);_0x4256e8[_0xb221('0x3c')]=_[_0xb221('0x3d')](_0x4256e8[_0xb221('0x38')],_0x4256e8['query']);_0x5903fa[_0xb221('0x3e')]=_[_0xb221('0x3d')](_0x4256e8[_0xb221('0x38')],qs['fields'](_0x3665da[_0xb221('0x3a')][_0xb221('0x3f')]));_0x5903fa[_0xb221('0x3e')]=_0x5903fa[_0xb221('0x3e')][_0xb221('0x40')]?_0x5903fa[_0xb221('0x3e')]:_0x4256e8['model'];_0x5903fa[_0xb221('0x44')]=qs[_0xb221('0x45')](_0x3665da[_0xb221('0x3a')][_0xb221('0x45')]);_0x5903fa[_0xb221('0x46')]=qs['filters'](_[_0xb221('0x47')](_0x3665da[_0xb221('0x3a')],_0x4256e8[_0xb221('0x3c')]));if(_0x3665da[_0xb221('0x3a')][_0xb221('0x48')]){_0x5903fa['where']=_['merge'](_0x5903fa[_0xb221('0x46')],{'$or':_['map'](_0x5903fa['attributes'],function(_0x49f292){var _0x268e81={};_0x268e81[_0x49f292]={'$like':'%'+_0x3665da[_0xb221('0x3a')]['filter']+'%'};return _0x268e81;})});}_0x5903fa=_[_0xb221('0x49')]({},_0x5903fa,_0x3665da[_0xb221('0x4a')]);return _0x25409a[_0xb221('0x53')](_0x5903fa);}})[_0xb221('0x1a')](function(_0xaaaf62){if(_0xaaaf62){_0x3cd6e0=_0xaaaf62[_0xb221('0x40')];if(!_0x3665da['query'][_0xb221('0x41')](_0xb221('0x42'))){_0x5903fa[_0xb221('0x43')]=qs['limit'](_0x3665da[_0xb221('0x3a')]['limit']);_0x5903fa['offset']=qs[_0xb221('0x27')](_0x3665da['query'][_0xb221('0x27')]);}return _0x25409a['getConfigurations'](_0x5903fa);}})['then'](function(_0x1b0c8c){if(_0x1b0c8c){return _0x1b0c8c?{'count':_0x3cd6e0,'rows':_0x1b0c8c}:null;}})['then'](respondWithResult(_0x46b41b,null))['catch'](handleError(_0x46b41b,null));};exports[_0xb221('0x55')]=function(_0x58966c,_0x3b2b91,_0x2882f0){if(_0x58966c['body']['id']){delete _0x58966c[_0xb221('0x52')]['id'];}return db['ZohoAccount'][_0xb221('0x54')]({'where':{'id':_0x58966c['params']['id']}})[_0xb221('0x1a')](handleEntityNotFound(_0x3b2b91,null))[_0xb221('0x1a')](function(_0x368fe5){if(_0x368fe5){_0x58966c[_0xb221('0x52')][_0xb221('0x56')]=_0x368fe5['id'];_0x58966c['body'][_0xb221('0x57')]=integrations[_0xb221('0x58')](_0x58966c[_0xb221('0x52')][_0xb221('0x59')],_0x58966c['body'][_0xb221('0x36')]);_0x58966c[_0xb221('0x52')]['Descriptions']=integrations[_0xb221('0x5a')](_0x58966c[_0xb221('0x52')]['channel'],_0x58966c[_0xb221('0x52')][_0xb221('0x36')]);return db[_0xb221('0x5b')][_0xb221('0x51')](_0x58966c['body'],{'include':[{'model':db[_0xb221('0x5c')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xb221('0x1a')](respondWithResult(_0x3b2b91,null))[_0xb221('0x22')](handleError(_0x3b2b91,null));};function getAccessToken(_0x4f50a2){return new Promise(function(_0x2af749,_0x147231){var _0x2bbee6;switch(_0x4f50a2[_0xb221('0x5d')]){case'US':_0x2bbee6='https://accounts.zoho.com';break;case'AU':_0x2bbee6='https://accounts.zoho.com.au';break;case'EU':_0x2bbee6=_0xb221('0x5e');break;case'IN':_0x2bbee6=_0xb221('0x5f');break;case'CN':_0x2bbee6=_0xb221('0x60');break;default:_0x2bbee6=_0xb221('0x5e');break;}var _0x2f3a1a={'method':_0xb221('0x61'),'uri':_0x2bbee6+_0xb221('0x62'),'qs':{'refresh_token':_0x4f50a2[_0xb221('0x63')],'client_id':_0x4f50a2[_0xb221('0x64')],'client_secret':_0x4f50a2[_0xb221('0x65')],'grant_type':_0xb221('0x66')},'json':!![]};return rp(_0x2f3a1a)[_0xb221('0x1a')](function(_0x3d7303){if(_0x3d7303['access_token']){_0x2af749(_0x3d7303[_0xb221('0x67')]);}else{_0x147231('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xb221('0x22')](function(_0xe6006e){_0x147231(_0xe6006e);});});}exports[_0xb221('0x68')]=function(_0x5335db,_0x543001,_0x53772a){var _0x58b5f1,_0x3a903d,_0xd286b3,_0xcee362,_0x5f507c;return db[_0xb221('0x33')][_0xb221('0x54')]({'where':{'id':_0x5335db[_0xb221('0x4f')]['id']},'attributes':['id',_0xb221('0x69'),'zone',_0xb221('0x64'),_0xb221('0x65'),_0xb221('0x6a'),_0xb221('0x20'),_0xb221('0x63')]})['then'](handleEntityNotFound(_0x543001,null))[_0xb221('0x1a')](function(_0x2a6706){_0x5f507c=_0x2a6706;_0x58b5f1=_0x5f507c[_0xb221('0x69')];_0x3a903d=_0x58b5f1==='zoho.eu'?'eu':_0xb221('0x6b');_0xd286b3=_0x5f507c[_0xb221('0x6a')];var _0x23cda5=_0xd286b3[_0xb221('0x6c')](-0x1);if(_0x23cda5==='/'||_0x23cda5==='\x5c'||_0x23cda5===':'){_0xd286b3=_0xd286b3[_0xb221('0x6d')](0x0,_0xd286b3[_0xb221('0x6e')](_0x23cda5));}if(!_0x5f507c['refreshToken']){throw new Error(_0xb221('0x6f'));}return getAccessToken(_0x5f507c);})['then'](function(_0x2a4b31){if(_0x2a4b31){return rp({'method':_0xb221('0x70'),'uri':util[_0xb221('0x71')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3a903d),'qs':{'module':_0xb221('0x72')},'headers':{'Authorization':_0xb221('0x73')+_0x2a4b31},'json':!![]});}})[_0xb221('0x1a')](function(_0xb11e07){if(_0xb11e07){if(_0xb11e07[_0xb221('0x74')]&&_0xb11e07[_0xb221('0x74')]['error']){throw new Error(_0xb11e07['response'][_0xb221('0x1f')][_0xb221('0x21')]);}var _0x29d960=[];var _0x481298=[];var _0x2b2e5a=[_0xb221('0x75'),'Subject','Description','WhoId',_0xb221('0x76'),_0xb221('0x77'),'Call_Start_Time',_0xb221('0x78')];_0x481298=_[_0xb221('0x79')](_0xb11e07[_0xb221('0x3f')],function(_0x3b2fce){return _0x2b2e5a[_0xb221('0x7a')](_0x3b2fce['api_name']);});for(var _0x5df8db=0x0;_0x5df8db<_0x481298[_0xb221('0x40')];_0x5df8db++){if(_0x481298[_0x5df8db][_0xb221('0x7b')]===![]){_0x29d960[_0xb221('0x7c')]({'id':_0x481298[_0x5df8db]['id'],'name':_0x481298[_0x5df8db][_0xb221('0x7d')],'custom':_0x481298[_0x5df8db][_0xb221('0x7e')],'options':_0x481298[_0x5df8db][_0xb221('0x7f')]===_0xb221('0x80')&&_0x481298[_0x5df8db][_0xb221('0x81')][_0xb221('0x40')]>-0x1?_[_0xb221('0x39')](_0x481298[_0x5df8db][_0xb221('0x81')],function(_0x3286a2){return{'name':_0x3286a2,'value':_0x3286a2};}):[]});}}return{'count':_0x29d960['length'],'rows':_0x29d960};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x543001,null))['catch'](function(_0x2e1ce4){var _0x22aa36=_0x5335db['query'][_0xb221('0x82')]?0x1f4:_0x2e1ce4[_0xb221('0x83')]||0x1f4;logger[_0xb221('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xb221('0x68'),_0x22aa36,JSON[_0xb221('0x84')](_0x2e1ce4));delete _0x2e1ce4['name'];if(_0x22aa36===0x191){_0x22aa36=0x190;}_0x543001[_0xb221('0x25')](_0x22aa36)[_0xb221('0x85')](_0x5335db[_0xb221('0x3a')][_0xb221('0x82')]?{'message':_0xb221('0x86'),'statusCode':_0x2e1ce4[_0xb221('0x83')]}:_0x2e1ce4);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 63e3a5a..f090475 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 _0x5fd1=['lastIndexOf','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','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.eu','info','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','zone','changed','clientId','clientSecret','code','host','serverUrl','slice','substring'];(function(_0x4dd15b,_0x1d880a){var _0x2445f2=function(_0x236d63){while(--_0x236d63){_0x4dd15b['push'](_0x4dd15b['shift']());}};_0x2445f2(++_0x1d880a);}(_0x5fd1,0x13b));var _0x15fd=function(_0x559e4e,_0x1d1130){_0x559e4e=_0x559e4e-0x0;var _0x3fc11d=_0x5fd1[_0x559e4e];return _0x3fc11d;};'use strict';var _=require('lodash');var util=require(_0x15fd('0x0'));var logger=require(_0x15fd('0x1'))(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var BPromise=require(_0x15fd('0x4'));var rp=require(_0x15fd('0x5'));var fs=require('fs');var path=require(_0x15fd('0x6'));var rimraf=require('rimraf');var config=require(_0x15fd('0x7'));var attributes=require(_0x15fd('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x15fd('0x9')]=function(_0x5690c6,_0x5105ee){return _0x5690c6['define'](_0x15fd('0xa'),attributes,{'tableName':_0x15fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x544ee7,_0xc86fda,_0x1ce395){if(_0x544ee7['changed'](_0x15fd('0xc'))||_0x544ee7[_0x15fd('0xd')]('serverUrl')||_0x544ee7['changed'](_0x15fd('0xe'))||_0x544ee7[_0x15fd('0xd')](_0x15fd('0xf'))||_0x544ee7[_0x15fd('0xd')](_0x15fd('0x10'))||_0x544ee7['changed'](_0x15fd('0x11'))){var _0x170eec,_0x377400;_0x170eec=_0x544ee7[_0x15fd('0x12')];var _0x3aec0e=_0x170eec[_0x15fd('0x13')](-0x1);if(_0x3aec0e==='/'||_0x3aec0e==='\x5c'||_0x3aec0e===':'){_0x170eec=_0x170eec[_0x15fd('0x14')](0x0,_0x170eec[_0x15fd('0x15')](_0x3aec0e));}switch(_0x544ee7[_0x15fd('0xc')]){case'US':_0x377400=_0x15fd('0x16');break;case'AU':_0x377400=_0x15fd('0x17');break;case'IN':_0x377400=_0x15fd('0x18');break;case'CN':_0x377400=_0x15fd('0x19');break;default:_0x377400='https://accounts.zoho.eu';break;}var _0x4dfe91={'method':_0x15fd('0x1a'),'uri':_0x377400+_0x15fd('0x1b'),'form':{'grant_type':_0x15fd('0x1c'),'client_id':_0x544ee7['clientId'],'client_secret':_0x544ee7[_0x15fd('0xf')],'redirect_uri':_0x544ee7[_0x15fd('0x12')],'code':_0x544ee7[_0x15fd('0x10')]},'headers':{'Content-Type':_0x15fd('0x1d')}};return rp(_0x4dfe91)[_0x15fd('0x1e')](function(_0x23d1a5){var _0x4b57cf=JSON[_0x15fd('0x1f')](_0x23d1a5);if(_0x4b57cf[_0x15fd('0x20')]){_0x544ee7[_0x15fd('0x21')]=_0x4b57cf[_0x15fd('0x20')];logger['info'](util[_0x15fd('0x22')](_0x15fd('0x23'),_0x544ee7[_0x15fd('0x24')],_0x544ee7['id']));}else{logger[_0x15fd('0x25')](util[_0x15fd('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x544ee7['name'],_0x544ee7['id']),util[_0x15fd('0x26')](_0x4b57cf,{'showHidden':![],'depth':null}));}return _0x1ce395(null,_0xc86fda);})['catch'](function(_0x5e40e6){logger[_0x15fd('0x25')](util['format'](_0x15fd('0x27'),_0x544ee7[_0x15fd('0x24')],_0x544ee7['id']),util[_0x15fd('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1ce395(_0x5e40e6);});}else{return _0x1ce395(null,_0xc86fda);}},'beforeUpdate':function(_0x4dfc42,_0x2ec166,_0x4eea89){if(_0x4dfc42[_0x15fd('0xd')]('zone')||_0x4dfc42[_0x15fd('0xd')](_0x15fd('0x12'))||_0x4dfc42[_0x15fd('0xd')]('clientId')||_0x4dfc42['changed'](_0x15fd('0xf'))||_0x4dfc42[_0x15fd('0xd')](_0x15fd('0x10'))||_0x4dfc42['changed'](_0x15fd('0x11'))){var _0x18f241,_0x4d83a3;_0x18f241=_0x4dfc42['serverUrl'];var _0x2dc57f=_0x18f241[_0x15fd('0x13')](-0x1);if(_0x2dc57f==='/'||_0x2dc57f==='\x5c'||_0x2dc57f===':'){_0x18f241=_0x18f241['substring'](0x0,_0x18f241['lastIndexOf'](_0x2dc57f));}switch(_0x4dfc42[_0x15fd('0xc')]){case'US':_0x4d83a3=_0x15fd('0x16');break;case'AU':_0x4d83a3=_0x15fd('0x17');break;case'IN':_0x4d83a3=_0x15fd('0x18');break;case'CN':_0x4d83a3=_0x15fd('0x19');break;default:_0x4d83a3=_0x15fd('0x28');break;}var _0x52e53c={'method':_0x15fd('0x1a'),'uri':_0x4d83a3+'/oauth/v2/token','form':{'grant_type':_0x15fd('0x1c'),'client_id':_0x4dfc42[_0x15fd('0xe')],'client_secret':_0x4dfc42[_0x15fd('0xf')],'redirect_uri':_0x4dfc42[_0x15fd('0x12')],'code':_0x4dfc42[_0x15fd('0x10')]},'headers':{'Content-Type':_0x15fd('0x1d')}};return rp(_0x52e53c)[_0x15fd('0x1e')](function(_0x166f77){var _0xf61a5b=JSON[_0x15fd('0x1f')](_0x166f77);if(_0xf61a5b[_0x15fd('0x20')]){_0x4dfc42[_0x15fd('0x21')]=_0xf61a5b[_0x15fd('0x20')];logger[_0x15fd('0x29')](util[_0x15fd('0x22')](_0x15fd('0x23'),_0x4dfc42[_0x15fd('0x24')],_0x4dfc42['id']));}else{logger[_0x15fd('0x25')](util[_0x15fd('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4dfc42[_0x15fd('0x24')],_0x4dfc42['id']),util['inspect'](_0xf61a5b,{'showHidden':![],'depth':null}));}return _0x4eea89(null,_0x2ec166);})['catch'](function(_0x568a75){logger[_0x15fd('0x25')](util[_0x15fd('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4dfc42[_0x15fd('0x24')],_0x4dfc42['id']),util[_0x15fd('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x4eea89(_0x568a75);});}else{return _0x4eea89(null,_0x2ec166);}}}});}; \ No newline at end of file +var _0x3797=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','substring','lodash','util','../../config/logger','api'];(function(_0x25486e,_0x819fc5){var _0x4fa77b=function(_0x368bcd){while(--_0x368bcd){_0x25486e['push'](_0x25486e['shift']());}};_0x4fa77b(++_0x819fc5);}(_0x3797,0x196));var _0x7379=function(_0x344d91,_0x16e5f5){_0x344d91=_0x344d91-0x0;var _0x30507f=_0x3797[_0x344d91];return _0x30507f;};'use strict';var _=require(_0x7379('0x0'));var util=require(_0x7379('0x1'));var logger=require(_0x7379('0x2'))(_0x7379('0x3'));var moment=require('moment');var BPromise=require(_0x7379('0x4'));var rp=require(_0x7379('0x5'));var fs=require('fs');var path=require(_0x7379('0x6'));var rimraf=require(_0x7379('0x7'));var config=require(_0x7379('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x7379('0x9'));module[_0x7379('0xa')]=function(_0x3c9341,_0x115938){return _0x3c9341[_0x7379('0xb')](_0x7379('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2cf7b5,_0x3682b8,_0x4a1598){if(_0x2cf7b5[_0x7379('0xd')](_0x7379('0xe'))||_0x2cf7b5[_0x7379('0xd')](_0x7379('0xf'))||_0x2cf7b5[_0x7379('0xd')]('clientId')||_0x2cf7b5[_0x7379('0xd')](_0x7379('0x10'))||_0x2cf7b5[_0x7379('0xd')](_0x7379('0x11'))||_0x2cf7b5[_0x7379('0xd')]('host')){var _0x511f1f,_0x5f562a;_0x511f1f=_0x2cf7b5['serverUrl'];var _0x235772=_0x511f1f[_0x7379('0x12')](-0x1);if(_0x235772==='/'||_0x235772==='\x5c'||_0x235772===':'){_0x511f1f=_0x511f1f['substring'](0x0,_0x511f1f[_0x7379('0x13')](_0x235772));}switch(_0x2cf7b5[_0x7379('0xe')]){case'US':_0x5f562a='https://accounts.zoho.com';break;case'AU':_0x5f562a=_0x7379('0x14');break;case'IN':_0x5f562a=_0x7379('0x15');break;case'CN':_0x5f562a=_0x7379('0x16');break;default:_0x5f562a='https://accounts.zoho.eu';break;}var _0x4b813e={'method':_0x7379('0x17'),'uri':_0x5f562a+_0x7379('0x18'),'form':{'grant_type':_0x7379('0x19'),'client_id':_0x2cf7b5[_0x7379('0x1a')],'client_secret':_0x2cf7b5['clientSecret'],'redirect_uri':_0x2cf7b5[_0x7379('0xf')],'code':_0x2cf7b5['code']},'headers':{'Content-Type':_0x7379('0x1b')}};return rp(_0x4b813e)[_0x7379('0x1c')](function(_0x105725){var _0x2a155f=JSON[_0x7379('0x1d')](_0x105725);if(_0x2a155f[_0x7379('0x1e')]){_0x2cf7b5[_0x7379('0x1f')]=_0x2a155f[_0x7379('0x1e')];logger[_0x7379('0x20')](util['format'](_0x7379('0x21'),_0x2cf7b5['name'],_0x2cf7b5['id']));}else{logger[_0x7379('0x22')](util[_0x7379('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2cf7b5['name'],_0x2cf7b5['id']),util[_0x7379('0x24')](_0x2a155f,{'showHidden':![],'depth':null}));}return _0x4a1598(null,_0x3682b8);})[_0x7379('0x25')](function(_0x5a390e){logger[_0x7379('0x22')](util['format'](_0x7379('0x26'),_0x2cf7b5[_0x7379('0x27')],_0x2cf7b5['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4a1598(_0x5a390e);});}else{return _0x4a1598(null,_0x3682b8);}},'beforeUpdate':function(_0x18bcef,_0x1fd68c,_0x3857bd){if(_0x18bcef[_0x7379('0xd')](_0x7379('0xe'))||_0x18bcef[_0x7379('0xd')](_0x7379('0xf'))||_0x18bcef['changed'](_0x7379('0x1a'))||_0x18bcef[_0x7379('0xd')](_0x7379('0x10'))||_0x18bcef['changed'](_0x7379('0x11'))||_0x18bcef[_0x7379('0xd')]('host')){var _0x14cec3,_0x5f3a49;_0x14cec3=_0x18bcef[_0x7379('0xf')];var _0x38ca30=_0x14cec3[_0x7379('0x12')](-0x1);if(_0x38ca30==='/'||_0x38ca30==='\x5c'||_0x38ca30===':'){_0x14cec3=_0x14cec3[_0x7379('0x28')](0x0,_0x14cec3[_0x7379('0x13')](_0x38ca30));}switch(_0x18bcef[_0x7379('0xe')]){case'US':_0x5f3a49='https://accounts.zoho.com';break;case'AU':_0x5f3a49=_0x7379('0x14');break;case'IN':_0x5f3a49='https://accounts.zoho.in';break;case'CN':_0x5f3a49=_0x7379('0x16');break;default:_0x5f3a49='https://accounts.zoho.eu';break;}var _0x6b53d2={'method':'POST','uri':_0x5f3a49+_0x7379('0x18'),'form':{'grant_type':_0x7379('0x19'),'client_id':_0x18bcef[_0x7379('0x1a')],'client_secret':_0x18bcef[_0x7379('0x10')],'redirect_uri':_0x18bcef[_0x7379('0xf')],'code':_0x18bcef[_0x7379('0x11')]},'headers':{'Content-Type':_0x7379('0x1b')}};return rp(_0x6b53d2)[_0x7379('0x1c')](function(_0x529d72){var _0x60c79=JSON[_0x7379('0x1d')](_0x529d72);if(_0x60c79[_0x7379('0x1e')]){_0x18bcef[_0x7379('0x1f')]=_0x60c79[_0x7379('0x1e')];logger['info'](util[_0x7379('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x18bcef['name'],_0x18bcef['id']));}else{logger[_0x7379('0x22')](util['format'](_0x7379('0x26'),_0x18bcef[_0x7379('0x27')],_0x18bcef['id']),util[_0x7379('0x24')](_0x60c79,{'showHidden':![],'depth':null}));}return _0x3857bd(null,_0x1fd68c);})[_0x7379('0x25')](function(_0xbd7311){logger[_0x7379('0x22')](util[_0x7379('0x23')](_0x7379('0x26'),_0x18bcef[_0x7379('0x27')],_0x18bcef['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3857bd(_0xbd7311);});}else{return _0x3857bd(null,_0x1fd68c);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 5d66f75..529d7dd 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 _0x2f8a=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowZohoAccount','find','lodash'];(function(_0x7cce8d,_0x8d7c9c){var _0x381b50=function(_0x4ab2d4){while(--_0x4ab2d4){_0x7cce8d['push'](_0x7cce8d['shift']());}};_0x381b50(++_0x8d7c9c);}(_0x2f8a,0x12f));var _0xa2f8=function(_0x117cb1,_0x538faa){_0x117cb1=_0x117cb1-0x0;var _0xb82d6a=_0x2f8a[_0x117cb1];return _0xb82d6a;};'use strict';var _=require(_0xa2f8('0x0'));var util=require(_0xa2f8('0x1'));var moment=require(_0xa2f8('0x2'));var BPromise=require(_0xa2f8('0x3'));var rs=require(_0xa2f8('0x4'));var fs=require('fs');var Redis=require(_0xa2f8('0x5'));var db=require(_0xa2f8('0x6'))['db'];var utils=require(_0xa2f8('0x7'));var logger=require(_0xa2f8('0x8'))(_0xa2f8('0x9'));var config=require(_0xa2f8('0xa'));var jayson=require(_0xa2f8('0xb'));var client=jayson[_0xa2f8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42b8f8,_0x40fbf0,_0x4e4bb0){return new BPromise(function(_0x72b48c,_0xfd507a){return client[_0xa2f8('0xd')](_0x42b8f8,_0x4e4bb0)[_0xa2f8('0xe')](function(_0x474d61){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x40fbf0,_0xa2f8('0xf'));logger[_0xa2f8('0x10')](_0xa2f8('0x11'),_0x40fbf0,_0xa2f8('0xf'),JSON[_0xa2f8('0x12')](_0x474d61));if(_0x474d61[_0xa2f8('0x13')]){if(_0x474d61[_0xa2f8('0x13')][_0xa2f8('0x14')]===0x1f4){logger[_0xa2f8('0x13')](_0xa2f8('0x15'),_0x40fbf0,_0x474d61['error'][_0xa2f8('0x16')]);return _0xfd507a(_0x474d61[_0xa2f8('0x13')]['message']);}logger[_0xa2f8('0x13')](_0xa2f8('0x15'),_0x40fbf0,_0x474d61[_0xa2f8('0x13')]['message']);return _0x72b48c(_0x474d61[_0xa2f8('0x13')][_0xa2f8('0x16')]);}else{logger[_0xa2f8('0x17')]('ZohoAccount,\x20%s,\x20%s',_0x40fbf0,_0xa2f8('0xf'));_0x72b48c(_0x474d61['result'][_0xa2f8('0x16')]);}})[_0xa2f8('0x18')](function(_0xa2273b){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x40fbf0,_0xa2273b);_0xfd507a(_0xa2273b);});});}exports[_0xa2f8('0x19')]=function(_0x4928e1){var _0x5ea6db=this;return new Promise(function(_0x553749,_0x4554a4){return db[_0xa2f8('0x1a')][_0xa2f8('0x1b')]({'raw':_0x4928e1[_0xa2f8('0x1c')]?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x4928e1[_0xa2f8('0x1c')]?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x1e')]||null:null,'attributes':_0x4928e1[_0xa2f8('0x1c')]?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x1f')]||null:null,'limit':_0x4928e1[_0xa2f8('0x1c')]?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x20')]||null:null,'include':_0x4928e1['options']?_0x4928e1[_0xa2f8('0x1c')][_0xa2f8('0x21')]?_['map'](_0x4928e1['options']['include'],function(_0x21eaac){return{'model':db[_0x21eaac[_0xa2f8('0x22')]],'as':_0x21eaac['as'],'attributes':_0x21eaac[_0xa2f8('0x1f')],'include':_0x21eaac[_0xa2f8('0x21')]?_['map'](_0x21eaac[_0xa2f8('0x21')],function(_0x49c8e9){return{'model':db[_0x49c8e9[_0xa2f8('0x22')]],'as':_0x49c8e9['as'],'attributes':_0x49c8e9[_0xa2f8('0x1f')],'include':_0x49c8e9['include']?_[_0xa2f8('0x23')](_0x49c8e9[_0xa2f8('0x21')],function(_0x2dca85){return{'model':db[_0x2dca85[_0xa2f8('0x22')]],'as':_0x2dca85['as'],'attributes':_0x2dca85[_0xa2f8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa2f8('0xe')](function(_0x43d44d){logger['info'](_0xa2f8('0x19'),_0x4928e1);logger[_0xa2f8('0x10')](_0xa2f8('0x19'),_0x4928e1,JSON[_0xa2f8('0x12')](_0x43d44d));_0x553749(_0x43d44d);})[_0xa2f8('0x18')](function(_0x7f2903){logger[_0xa2f8('0x13')]('GetZohoAccount',_0x7f2903[_0xa2f8('0x16')],_0x4928e1);_0x4554a4(_0x5ea6db[_0xa2f8('0x13')](0x1f4,_0x7f2903['message']));});});};exports[_0xa2f8('0x24')]=function(_0x2afaac){var _0x40500c=this;return new Promise(function(_0x2cb882,_0x5b7d4b){return db['ZohoAccount'][_0xa2f8('0x25')]({'raw':_0x2afaac[_0xa2f8('0x1c')]?_0x2afaac['options'][_0xa2f8('0x1d')]===undefined?!![]:![]:!![],'where':_0x2afaac[_0xa2f8('0x1c')]?_0x2afaac['options'][_0xa2f8('0x1e')]||null:null,'attributes':_0x2afaac['options']?_0x2afaac[_0xa2f8('0x1c')][_0xa2f8('0x1f')]||null:null,'include':_0x2afaac[_0xa2f8('0x1c')]?_0x2afaac[_0xa2f8('0x1c')][_0xa2f8('0x21')]?_[_0xa2f8('0x23')](_0x2afaac['options'][_0xa2f8('0x21')],function(_0x309234){return{'model':db[_0x309234['model']],'as':_0x309234['as'],'attributes':_0x309234['attributes'],'include':_0x309234[_0xa2f8('0x21')]?_[_0xa2f8('0x23')](_0x309234[_0xa2f8('0x21')],function(_0xa7fe72){return{'model':db[_0xa7fe72['model']],'as':_0xa7fe72['as'],'attributes':_0xa7fe72['attributes'],'include':_0xa7fe72['include']?_[_0xa2f8('0x23')](_0xa7fe72['include'],function(_0x23883d){return{'model':db[_0x23883d[_0xa2f8('0x22')]],'as':_0x23883d['as'],'attributes':_0x23883d[_0xa2f8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa2f8('0xe')](function(_0x5049fc){logger[_0xa2f8('0x17')]('ShowZohoAccount',_0x2afaac);logger[_0xa2f8('0x10')](_0xa2f8('0x24'),_0x2afaac,JSON[_0xa2f8('0x12')](_0x5049fc));_0x2cb882(_0x5049fc);})[_0xa2f8('0x18')](function(_0x5765f3){logger[_0xa2f8('0x13')]('ShowZohoAccount',_0x5765f3[_0xa2f8('0x16')],_0x2afaac);_0x5b7d4b(_0x40500c[_0xa2f8('0x13')](0x1f4,_0x5765f3[_0xa2f8('0x16')]));});});}; \ No newline at end of file +var _0x9e35=['limit','map','include','model','then','debug','ShowZohoAccount','ZohoAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','options','raw','where','attributes'];(function(_0x424c0f,_0x31a27d){var _0x265bf4=function(_0x419f69){while(--_0x419f69){_0x424c0f['push'](_0x424c0f['shift']());}};_0x265bf4(++_0x31a27d);}(_0x9e35,0x1f3));var _0x59e3=function(_0xa073d1,_0x521d5b){_0xa073d1=_0xa073d1-0x0;var _0x2a94d4=_0x9e35[_0xa073d1];return _0x2a94d4;};'use strict';var _=require('lodash');var util=require(_0x59e3('0x0'));var moment=require('moment');var BPromise=require(_0x59e3('0x1'));var rs=require(_0x59e3('0x2'));var fs=require('fs');var Redis=require(_0x59e3('0x3'));var db=require(_0x59e3('0x4'))['db'];var utils=require(_0x59e3('0x5'));var logger=require('../../config/logger')(_0x59e3('0x6'));var config=require(_0x59e3('0x7'));var jayson=require(_0x59e3('0x8'));var client=jayson['client'][_0x59e3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e83d2,_0x281deb,_0x139b44){return new BPromise(function(_0x5b9ca5,_0x235822){return client[_0x59e3('0xa')](_0x2e83d2,_0x139b44)['then'](function(_0x5782bd){logger[_0x59e3('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x281deb,_0x59e3('0xc'));logger['debug'](_0x59e3('0xd'),_0x281deb,_0x59e3('0xc'),JSON[_0x59e3('0xe')](_0x5782bd));if(_0x5782bd[_0x59e3('0xf')]){if(_0x5782bd[_0x59e3('0xf')][_0x59e3('0x10')]===0x1f4){logger[_0x59e3('0xf')](_0x59e3('0x11'),_0x281deb,_0x5782bd[_0x59e3('0xf')][_0x59e3('0x12')]);return _0x235822(_0x5782bd['error'][_0x59e3('0x12')]);}logger[_0x59e3('0xf')](_0x59e3('0x11'),_0x281deb,_0x5782bd[_0x59e3('0xf')][_0x59e3('0x12')]);return _0x5b9ca5(_0x5782bd[_0x59e3('0xf')][_0x59e3('0x12')]);}else{logger['info'](_0x59e3('0x11'),_0x281deb,_0x59e3('0xc'));_0x5b9ca5(_0x5782bd[_0x59e3('0x13')][_0x59e3('0x12')]);}})[_0x59e3('0x14')](function(_0x54b57b){logger[_0x59e3('0xf')](_0x59e3('0x11'),_0x281deb,_0x54b57b);_0x235822(_0x54b57b);});});}exports[_0x59e3('0x15')]=function(_0x2be6f4){var _0x42685e=this;return new Promise(function(_0x203e1b,_0x1f75d1){return db['ZohoAccount']['findAll']({'raw':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4[_0x59e3('0x16')][_0x59e3('0x17')]===undefined?!![]:![]:!![],'where':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4[_0x59e3('0x16')][_0x59e3('0x18')]||null:null,'attributes':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4[_0x59e3('0x16')][_0x59e3('0x19')]||null:null,'limit':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4[_0x59e3('0x16')][_0x59e3('0x1a')]||null:null,'include':_0x2be6f4[_0x59e3('0x16')]?_0x2be6f4['options']['include']?_[_0x59e3('0x1b')](_0x2be6f4['options'][_0x59e3('0x1c')],function(_0x49337f){return{'model':db[_0x49337f[_0x59e3('0x1d')]],'as':_0x49337f['as'],'attributes':_0x49337f[_0x59e3('0x19')],'include':_0x49337f[_0x59e3('0x1c')]?_[_0x59e3('0x1b')](_0x49337f['include'],function(_0xe78e8c){return{'model':db[_0xe78e8c[_0x59e3('0x1d')]],'as':_0xe78e8c['as'],'attributes':_0xe78e8c['attributes'],'include':_0xe78e8c[_0x59e3('0x1c')]?_['map'](_0xe78e8c['include'],function(_0x3b5cf9){return{'model':db[_0x3b5cf9[_0x59e3('0x1d')]],'as':_0x3b5cf9['as'],'attributes':_0x3b5cf9[_0x59e3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x59e3('0x1e')](function(_0xf43ac8){logger[_0x59e3('0xb')](_0x59e3('0x15'),_0x2be6f4);logger[_0x59e3('0x1f')]('GetZohoAccount',_0x2be6f4,JSON['stringify'](_0xf43ac8));_0x203e1b(_0xf43ac8);})[_0x59e3('0x14')](function(_0x43a9b4){logger[_0x59e3('0xf')]('GetZohoAccount',_0x43a9b4['message'],_0x2be6f4);_0x1f75d1(_0x42685e['error'](0x1f4,_0x43a9b4[_0x59e3('0x12')]));});});};exports[_0x59e3('0x20')]=function(_0xc32152){var _0x20b4e6=this;return new Promise(function(_0x5a4aa9,_0x51fb65){return db[_0x59e3('0x21')][_0x59e3('0x22')]({'raw':_0xc32152[_0x59e3('0x16')]?_0xc32152['options']['raw']===undefined?!![]:![]:!![],'where':_0xc32152['options']?_0xc32152[_0x59e3('0x16')][_0x59e3('0x18')]||null:null,'attributes':_0xc32152[_0x59e3('0x16')]?_0xc32152[_0x59e3('0x16')]['attributes']||null:null,'include':_0xc32152[_0x59e3('0x16')]?_0xc32152[_0x59e3('0x16')][_0x59e3('0x1c')]?_[_0x59e3('0x1b')](_0xc32152[_0x59e3('0x16')][_0x59e3('0x1c')],function(_0x597f48){return{'model':db[_0x597f48[_0x59e3('0x1d')]],'as':_0x597f48['as'],'attributes':_0x597f48[_0x59e3('0x19')],'include':_0x597f48[_0x59e3('0x1c')]?_['map'](_0x597f48['include'],function(_0x32f7a8){return{'model':db[_0x32f7a8[_0x59e3('0x1d')]],'as':_0x32f7a8['as'],'attributes':_0x32f7a8[_0x59e3('0x19')],'include':_0x32f7a8[_0x59e3('0x1c')]?_['map'](_0x32f7a8[_0x59e3('0x1c')],function(_0x40e253){return{'model':db[_0x40e253[_0x59e3('0x1d')]],'as':_0x40e253['as'],'attributes':_0x40e253[_0x59e3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x59e3('0x1e')](function(_0x1747c8){logger[_0x59e3('0xb')](_0x59e3('0x20'),_0xc32152);logger[_0x59e3('0x1f')](_0x59e3('0x20'),_0xc32152,JSON[_0x59e3('0xe')](_0x1747c8));_0x5a4aa9(_0x1747c8);})[_0x59e3('0x14')](function(_0x5ce44b){logger[_0x59e3('0xf')](_0x59e3('0x20'),_0x5ce44b[_0x59e3('0x12')],_0xc32152);_0x51fb65(_0x20b4e6['error'](0x1f4,_0x5ce44b[_0x59e3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1c9222e..da5abc8 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 _0x2cb0=['get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x128de4,_0x511592){var _0x167659=function(_0x5d4b6d){while(--_0x5d4b6d){_0x128de4['push'](_0x128de4['shift']());}};_0x167659(++_0x511592);}(_0x2cb0,0x12c));var _0x02cb=function(_0x33c2db,_0x3940e0){_0x33c2db=_0x33c2db-0x0;var _0x94c99b=_0x2cb0[_0x33c2db];return _0x94c99b;};'use strict';var multer=require(_0x02cb('0x0'));var util=require(_0x02cb('0x1'));var path=require('path');var timeout=require(_0x02cb('0x2'));var express=require(_0x02cb('0x3'));var router=express[_0x02cb('0x4')]();var auth=require(_0x02cb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x02cb('0x6'));var controller=require(_0x02cb('0x7'));router[_0x02cb('0x8')]('/',auth[_0x02cb('0x9')](),controller[_0x02cb('0xa')]);router[_0x02cb('0x8')](_0x02cb('0xb'),auth[_0x02cb('0x9')](),controller['show']);router[_0x02cb('0x8')](_0x02cb('0xc'),auth[_0x02cb('0x9')](),controller[_0x02cb('0xd')]);router[_0x02cb('0x8')]('/:id/subjects',auth[_0x02cb('0x9')](),controller[_0x02cb('0xe')]);router[_0x02cb('0x8')]('/:id/descriptions',auth[_0x02cb('0x9')](),controller[_0x02cb('0xf')]);router[_0x02cb('0x10')]('/',auth[_0x02cb('0x9')](),controller['create']);router[_0x02cb('0x11')](_0x02cb('0xb'),auth[_0x02cb('0x9')](),controller[_0x02cb('0x12')]);router[_0x02cb('0x13')](_0x02cb('0xb'),auth['isAuthenticated'](),controller[_0x02cb('0x14')]);module[_0x02cb('0x15')]=router; \ No newline at end of file +var _0xa1aa=['get','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index'];(function(_0xd5169b,_0x5ab446){var _0x50fe84=function(_0x3ad28c){while(--_0x3ad28c){_0xd5169b['push'](_0xd5169b['shift']());}};_0x50fe84(++_0x5ab446);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x4ece06,_0x3d82ef){_0x4ece06=_0x4ece06-0x0;var _0x41f9bd=_0xa1aa[_0x4ece06];return _0x41f9bd;};'use strict';var multer=require('multer');var util=require(_0xaa1a('0x0'));var path=require(_0xaa1a('0x1'));var timeout=require(_0xaa1a('0x2'));var express=require(_0xaa1a('0x3'));var router=express[_0xaa1a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaa1a('0x5'));var controller=require(_0xaa1a('0x6'));router['get']('/',auth[_0xaa1a('0x7')](),controller[_0xaa1a('0x8')]);router[_0xaa1a('0x9')]('/:id',auth[_0xaa1a('0x7')](),controller['show']);router[_0xaa1a('0x9')]('/:id/fields',auth[_0xaa1a('0x7')](),controller[_0xaa1a('0xa')]);router['get']('/:id/subjects',auth[_0xaa1a('0x7')](),controller[_0xaa1a('0xb')]);router[_0xaa1a('0x9')](_0xaa1a('0xc'),auth['isAuthenticated'](),controller[_0xaa1a('0xd')]);router[_0xaa1a('0xe')]('/',auth[_0xaa1a('0x7')](),controller[_0xaa1a('0xf')]);router[_0xaa1a('0x10')](_0xaa1a('0x11'),auth[_0xaa1a('0x7')](),controller[_0xaa1a('0x12')]);router[_0xaa1a('0x13')](_0xaa1a('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xaa1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 72a8e0d..42f96e9 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 _0x8de8=['ENUM','lead','contact','nothing','contact_lead','exports','STRING'];(function(_0xd1e092,_0x58f358){var _0x390470=function(_0x358e32){while(--_0x358e32){_0xd1e092['push'](_0xd1e092['shift']());}};_0x390470(++_0x58f358);}(_0x8de8,0xbb));var _0x88de=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8de8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x88de('0x0')]={'name':{'type':Sequelize[_0x88de('0x1')]},'moduleCreate':{'type':Sequelize[_0x88de('0x2')](_0x88de('0x3'),_0x88de('0x4'),_0x88de('0x5')),'defaultValue':_0x88de('0x3')},'moduleSearch':{'type':Sequelize[_0x88de('0x2')](_0x88de('0x6'),_0x88de('0x4'),_0x88de('0x3')),'defaultValue':_0x88de('0x6')},'description':{'type':Sequelize[_0x88de('0x1')]}}; \ No newline at end of file +var _0x0cee=['contact_lead','STRING','exports','ENUM','lead','contact','nothing'];(function(_0x74b46c,_0x2b79d6){var _0x38cc40=function(_0x2cc73d){while(--_0x2cc73d){_0x74b46c['push'](_0x74b46c['shift']());}};_0x38cc40(++_0x2b79d6);}(_0x0cee,0x1c2));var _0xe0ce=function(_0x2e953b,_0x4fab53){_0x2e953b=_0x2e953b-0x0;var _0x15a756=_0x0cee[_0x2e953b];return _0x15a756;};'use strict';var Sequelize=require('sequelize');module[_0xe0ce('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xe0ce('0x1')](_0xe0ce('0x2'),_0xe0ce('0x3'),_0xe0ce('0x4')),'defaultValue':_0xe0ce('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xe0ce('0x3'),_0xe0ce('0x2')),'defaultValue':_0xe0ce('0x5')},'description':{'type':Sequelize[_0xe0ce('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index a37ab7c..2007959 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 _0xe68b=['catch','params','rawAttributes','options','find','create','body','getFields','findOne','ZohoField','pick','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ZohoConfiguration,\x20%s,\x20%s','result','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','ZohoConfiguration','includeAll','include','rows'];(function(_0x411e71,_0xf9652){var _0x226ae3=function(_0x1339f6){while(--_0x1339f6){_0x411e71['push'](_0x411e71['shift']());}};_0x226ae3(++_0xf9652);}(_0xe68b,0x18a));var _0xbe68=function(_0x4f6537,_0x44df55){_0x4f6537=_0x4f6537-0x0;var _0x4eb387=_0xe68b[_0x4f6537];return _0x4eb387;};'use strict';var pdf=require(_0xbe68('0x0'));var emlformat=require(_0xbe68('0x1'));var rimraf=require(_0xbe68('0x2'));var zipdir=require(_0xbe68('0x3'));var jsonpatch=require(_0xbe68('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbe68('0x5'));var Mustache=require(_0xbe68('0x6'));var util=require(_0xbe68('0x7'));var path=require('path');var sox=require(_0xbe68('0x8'));var csv=require(_0xbe68('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbe68('0xa'));var squel=require(_0xbe68('0xb'));var crypto=require(_0xbe68('0xc'));var jsforce=require(_0xbe68('0xd'));var deskjs=require(_0xbe68('0xe'));var toCsv=require(_0xbe68('0x9'));var querystring=require(_0xbe68('0xf'));var Papa=require(_0xbe68('0x10'));var Redis=require(_0xbe68('0x11'));var authService=require(_0xbe68('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbe68('0x13'));var hardwareService=require(_0xbe68('0x14'));var logger=require(_0xbe68('0x15'))('api');var utils=require(_0xbe68('0x16'));var config=require(_0xbe68('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbe68('0x18'));var client=jayson[_0xbe68('0x19')][_0xbe68('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x216a67,_0x3df6f2,_0x584781){if(_0x584781){var _0x3a4f88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a4f88[_0xbe68('0x1b')](_0x3df6f2)){return _0x216a67;}else{throw new db[(_0xbe68('0x1c'))][(_0xbe68('0x1d'))](_0xbe68('0x1e'));}}else{return _0x216a67;}}function respondWithRpcPromise(_0x4abec4,_0x42454c,_0xa21dd4,_0x1f7092){return new BPromise(function(_0x31f5d3,_0x1ab0f6){var _0x5d350a=_0x1f7092||client;return _0x5d350a[_0xbe68('0x1f')](_0x4abec4,_0xa21dd4)[_0xbe68('0x20')](function(_0x2575ea){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x42454c,_0xbe68('0x21'));logger[_0xbe68('0x22')](_0xbe68('0x23'),_0x42454c,_0xbe68('0x21'),JSON[_0xbe68('0x24')](_0x2575ea));if(_0x2575ea['error']){if(_0x2575ea[_0xbe68('0x25')][_0xbe68('0x26')]===0x1f4){logger[_0xbe68('0x25')]('ZohoConfiguration,\x20%s,\x20%s',_0x42454c,_0x2575ea[_0xbe68('0x25')][_0xbe68('0x27')]);return _0x1ab0f6(_0x2575ea[_0xbe68('0x25')][_0xbe68('0x27')]);}logger[_0xbe68('0x25')]('ZohoConfiguration,\x20%s,\x20%s',_0x42454c,_0x2575ea[_0xbe68('0x25')][_0xbe68('0x27')]);return _0x31f5d3(_0x2575ea[_0xbe68('0x25')][_0xbe68('0x27')]);}else{logger[_0xbe68('0x28')](_0xbe68('0x29'),_0x42454c,_0xbe68('0x21'));_0x31f5d3(_0x2575ea[_0xbe68('0x2a')]['message']);}})['catch'](function(_0x2a51d9){logger['error'](_0xbe68('0x29'),_0x42454c,_0x2a51d9);_0x1ab0f6(_0x2a51d9);});});}function respondWithStatusCode(_0x525abb,_0x1ce64a){_0x1ce64a=_0x1ce64a||0xcc;return function(_0x315f53){if(_0x315f53){return _0x525abb[_0xbe68('0x2b')](_0x1ce64a);}return _0x525abb['status'](_0x1ce64a)[_0xbe68('0x2c')]();};}function respondWithResult(_0x1070ba,_0x4ca788){_0x4ca788=_0x4ca788||0xc8;return function(_0x33996f){if(_0x33996f){return _0x1070ba[_0xbe68('0x2d')](_0x4ca788)[_0xbe68('0x2e')](_0x33996f);}};}function respondWithFilteredResult(_0x550779,_0x46f9f2){return function(_0x57187a){if(_0x57187a){var _0x3f20e8=_0x57187a[_0xbe68('0x2f')],_0x5a36e1=_0x46f9f2['offset'],_0x2b6950=_0x46f9f2[_0xbe68('0x30')]+_0x46f9f2['limit'],_0x46b9ec;if(_0x2b6950>=_0x3f20e8){_0x2b6950=_0x3f20e8;_0x46b9ec=0xc8;}else{_0x46b9ec=0xce;}_0x550779[_0xbe68('0x2d')](_0x46b9ec);return _0x550779[_0xbe68('0x31')](_0xbe68('0x32'),_0x5a36e1+'-'+_0x2b6950+'/'+_0x3f20e8)['json'](_0x57187a);}return null;};}function patchUpdates(_0x5cc293){return function(_0x5946f6){try{jsonpatch[_0xbe68('0x33')](_0x5946f6,_0x5cc293,!![]);}catch(_0x2c72f3){return BPromise[_0xbe68('0x34')](_0x2c72f3);}return _0x5946f6[_0xbe68('0x35')]();};}function saveUpdates(_0x129b7f,_0x20d286){return function(_0x2595cc){if(_0x2595cc){return _0x2595cc[_0xbe68('0x36')](_0x129b7f)[_0xbe68('0x20')](function(_0x55b069){return _0x55b069;});}return null;};}function removeEntity(_0x552383,_0xc6fd25){return function(_0x1e16f3){if(_0x1e16f3){return _0x1e16f3[_0xbe68('0x37')]()['then'](function(){_0x552383[_0xbe68('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d4da5,_0x32ecc4){return function(_0x63f45){if(!_0x63f45){_0x2d4da5[_0xbe68('0x2b')](0x194);}return _0x63f45;};}function handleError(_0x3f179a,_0x152ae2){_0x152ae2=_0x152ae2||0x1f4;return function(_0x4850){logger['error'](_0x4850[_0xbe68('0x38')]);if(_0x4850[_0xbe68('0x39')]){delete _0x4850['name'];}_0x3f179a[_0xbe68('0x2d')](_0x152ae2)['send'](_0x4850);};}exports['index']=function(_0x21590e,_0x3943e2){var _0x57a633={},_0x5b0a3c={},_0x16017c={'count':0x0,'rows':[]};var _0x5cc316=_[_0xbe68('0x3a')](db['ZohoConfiguration']['rawAttributes'],function(_0x2e7dad){return{'name':_0x2e7dad[_0xbe68('0x3b')],'type':_0x2e7dad[_0xbe68('0x3c')]['key']};});_0x5b0a3c['model']=_['map'](_0x5cc316,_0xbe68('0x39'));_0x5b0a3c['query']=_[_0xbe68('0x3d')](_0x21590e[_0xbe68('0x3e')]);_0x5b0a3c[_0xbe68('0x3f')]=_['intersection'](_0x5b0a3c[_0xbe68('0x40')],_0x5b0a3c[_0xbe68('0x3e')]);_0x57a633[_0xbe68('0x41')]=_[_0xbe68('0x42')](_0x5b0a3c[_0xbe68('0x40')],qs['fields'](_0x21590e[_0xbe68('0x3e')][_0xbe68('0x43')]));_0x57a633[_0xbe68('0x41')]=_0x57a633[_0xbe68('0x41')][_0xbe68('0x44')]?_0x57a633[_0xbe68('0x41')]:_0x5b0a3c[_0xbe68('0x40')];if(!_0x21590e[_0xbe68('0x3e')][_0xbe68('0x45')]('nolimit')){_0x57a633[_0xbe68('0x46')]=qs['limit'](_0x21590e['query'][_0xbe68('0x46')]);_0x57a633[_0xbe68('0x30')]=qs[_0xbe68('0x30')](_0x21590e[_0xbe68('0x3e')][_0xbe68('0x30')]);}_0x57a633[_0xbe68('0x47')]=qs[_0xbe68('0x48')](_0x21590e['query'][_0xbe68('0x48')]);_0x57a633[_0xbe68('0x49')]=qs[_0xbe68('0x3f')](_['pick'](_0x21590e[_0xbe68('0x3e')],_0x5b0a3c[_0xbe68('0x3f')]),_0x5cc316);if(_0x21590e[_0xbe68('0x3e')][_0xbe68('0x4a')]){_0x57a633[_0xbe68('0x49')]=_[_0xbe68('0x4b')](_0x57a633['where'],{'$or':_[_0xbe68('0x3a')](_0x5cc316,function(_0x9c9d45){if(_0x9c9d45[_0xbe68('0x3c')]!==_0xbe68('0x4c')){var _0x1a7a2c={};_0x1a7a2c[_0x9c9d45[_0xbe68('0x39')]]={'$like':'%'+_0x21590e[_0xbe68('0x3e')]['filter']+'%'};return _0x1a7a2c;}})});}_0x57a633=_['merge']({},_0x57a633,_0x21590e['options']);var _0x1f9233={'where':_0x57a633[_0xbe68('0x49')]};return db[_0xbe68('0x4d')][_0xbe68('0x2f')](_0x1f9233)[_0xbe68('0x20')](function(_0x11a6dc){_0x16017c['count']=_0x11a6dc;if(_0x21590e[_0xbe68('0x3e')][_0xbe68('0x4e')]){_0x57a633[_0xbe68('0x4f')]=[{'all':!![]}];}return db[_0xbe68('0x4d')]['findAll'](_0x57a633);})[_0xbe68('0x20')](function(_0xb54914){_0x16017c[_0xbe68('0x50')]=_0xb54914;return _0x16017c;})['then'](respondWithFilteredResult(_0x3943e2,_0x57a633))[_0xbe68('0x51')](handleError(_0x3943e2,null));};exports['show']=function(_0x1adbdf,_0x5d435d){var _0x47ded3={'raw':![],'where':{'id':_0x1adbdf[_0xbe68('0x52')]['id']}},_0x382bd1={};_0x382bd1[_0xbe68('0x40')]=_[_0xbe68('0x3d')](db[_0xbe68('0x4d')][_0xbe68('0x53')]);_0x382bd1[_0xbe68('0x3e')]=_['keys'](_0x1adbdf[_0xbe68('0x3e')]);_0x382bd1['filters']=_[_0xbe68('0x42')](_0x382bd1[_0xbe68('0x40')],_0x382bd1[_0xbe68('0x3e')]);_0x47ded3[_0xbe68('0x41')]=_[_0xbe68('0x42')](_0x382bd1[_0xbe68('0x40')],qs[_0xbe68('0x43')](_0x1adbdf[_0xbe68('0x3e')][_0xbe68('0x43')]));_0x47ded3[_0xbe68('0x41')]=_0x47ded3[_0xbe68('0x41')][_0xbe68('0x44')]?_0x47ded3[_0xbe68('0x41')]:_0x382bd1[_0xbe68('0x40')];if(_0x1adbdf['query'][_0xbe68('0x4e')]){_0x47ded3[_0xbe68('0x4f')]=[{'all':!![]}];}_0x47ded3=_['merge']({},_0x47ded3,_0x1adbdf[_0xbe68('0x54')]);return db['ZohoConfiguration'][_0xbe68('0x55')](_0x47ded3)[_0xbe68('0x20')](handleEntityNotFound(_0x5d435d,null))['then'](respondWithResult(_0x5d435d,null))['catch'](handleError(_0x5d435d,null));};exports[_0xbe68('0x56')]=function(_0x399c77,_0x157eb8){return db[_0xbe68('0x4d')]['create'](_0x399c77[_0xbe68('0x57')],{})[_0xbe68('0x20')](respondWithResult(_0x157eb8,0xc9))[_0xbe68('0x51')](handleError(_0x157eb8,null));};exports[_0xbe68('0x36')]=function(_0x2c5b4e,_0x539cba){if(_0x2c5b4e['body']['id']){delete _0x2c5b4e['body']['id'];}return db[_0xbe68('0x4d')]['find']({'where':{'id':_0x2c5b4e[_0xbe68('0x52')]['id']}})[_0xbe68('0x20')](handleEntityNotFound(_0x539cba,null))['then'](saveUpdates(_0x2c5b4e[_0xbe68('0x57')],null))[_0xbe68('0x20')](respondWithResult(_0x539cba,null))[_0xbe68('0x51')](handleError(_0x539cba,null));};exports[_0xbe68('0x37')]=function(_0x1cde0e,_0x528c35){return db[_0xbe68('0x4d')][_0xbe68('0x55')]({'where':{'id':_0x1cde0e[_0xbe68('0x52')]['id']}})[_0xbe68('0x20')](handleEntityNotFound(_0x528c35,null))[_0xbe68('0x20')](removeEntity(_0x528c35,null))[_0xbe68('0x51')](handleError(_0x528c35,null));};exports[_0xbe68('0x58')]=function(_0x241e60,_0x582791,_0x296e3b){var _0x552656={};var _0x235263={};var _0x16de0c;var _0x4fd6ba;return db[_0xbe68('0x4d')][_0xbe68('0x59')]({'where':{'id':_0x241e60[_0xbe68('0x52')]['id']}})[_0xbe68('0x20')](handleEntityNotFound(_0x582791,null))[_0xbe68('0x20')](function(_0x3a083d){if(_0x3a083d){_0x16de0c=_0x3a083d;_0x235263['model']=_[_0xbe68('0x3d')](db[_0xbe68('0x5a')]['rawAttributes']);_0x235263['query']=_['keys'](_0x241e60[_0xbe68('0x3e')]);_0x235263[_0xbe68('0x3f')]=_[_0xbe68('0x42')](_0x235263['model'],_0x235263[_0xbe68('0x3e')]);_0x552656[_0xbe68('0x41')]=_[_0xbe68('0x42')](_0x235263[_0xbe68('0x40')],qs[_0xbe68('0x43')](_0x241e60['query']['fields']));_0x552656[_0xbe68('0x41')]=_0x552656[_0xbe68('0x41')][_0xbe68('0x44')]?_0x552656[_0xbe68('0x41')]:_0x235263[_0xbe68('0x40')];_0x552656[_0xbe68('0x47')]=qs['sort'](_0x241e60[_0xbe68('0x3e')]['sort']);_0x552656['where']=qs['filters'](_[_0xbe68('0x5b')](_0x241e60[_0xbe68('0x3e')],_0x235263[_0xbe68('0x3f')]));if(_0x241e60['query'][_0xbe68('0x4a')]){_0x552656[_0xbe68('0x49')]=_[_0xbe68('0x4b')](_0x552656['where'],{'$or':_[_0xbe68('0x3a')](_0x552656['attributes'],function(_0x2214c8){var _0x489203={};_0x489203[_0x2214c8]={'$like':'%'+_0x241e60['query'][_0xbe68('0x4a')]+'%'};return _0x489203;})});}_0x552656=_['merge']({},_0x552656,_0x241e60[_0xbe68('0x54')]);return _0x16de0c[_0xbe68('0x58')](_0x552656);}})[_0xbe68('0x20')](function(_0x5a3472){if(_0x5a3472){_0x4fd6ba=_0x5a3472[_0xbe68('0x44')];if(!_0x241e60[_0xbe68('0x3e')]['hasOwnProperty'](_0xbe68('0x5c'))){_0x552656[_0xbe68('0x46')]=qs['limit'](_0x241e60[_0xbe68('0x3e')][_0xbe68('0x46')]);_0x552656[_0xbe68('0x30')]=qs[_0xbe68('0x30')](_0x241e60[_0xbe68('0x3e')][_0xbe68('0x30')]);}return _0x16de0c[_0xbe68('0x58')](_0x552656);}})[_0xbe68('0x20')](function(_0x57139d){if(_0x57139d){return _0x57139d?{'count':_0x4fd6ba,'rows':_0x57139d}:null;}})['then'](respondWithResult(_0x582791,null))[_0xbe68('0x51')](handleError(_0x582791,null));};exports[_0xbe68('0x5d')]=function(_0x52d187,_0x453773,_0x5bdf02){var _0x25eaf2={};var _0x326416={};var _0x5aa27f;var _0x1b2fec;return db['ZohoConfiguration'][_0xbe68('0x59')]({'where':{'id':_0x52d187[_0xbe68('0x52')]['id']}})[_0xbe68('0x20')](handleEntityNotFound(_0x453773,null))['then'](function(_0x2e68d7){if(_0x2e68d7){_0x5aa27f=_0x2e68d7;_0x326416['model']=_['keys'](db[_0xbe68('0x5a')]['rawAttributes']);_0x326416[_0xbe68('0x3e')]=_['keys'](_0x52d187[_0xbe68('0x3e')]);_0x326416[_0xbe68('0x3f')]=_[_0xbe68('0x42')](_0x326416['model'],_0x326416[_0xbe68('0x3e')]);_0x25eaf2[_0xbe68('0x41')]=_['intersection'](_0x326416[_0xbe68('0x40')],qs[_0xbe68('0x43')](_0x52d187[_0xbe68('0x3e')]['fields']));_0x25eaf2[_0xbe68('0x41')]=_0x25eaf2[_0xbe68('0x41')][_0xbe68('0x44')]?_0x25eaf2[_0xbe68('0x41')]:_0x326416[_0xbe68('0x40')];_0x25eaf2[_0xbe68('0x47')]=qs[_0xbe68('0x48')](_0x52d187[_0xbe68('0x3e')]['sort']);_0x25eaf2['where']=qs[_0xbe68('0x3f')](_[_0xbe68('0x5b')](_0x52d187[_0xbe68('0x3e')],_0x326416['filters']));if(_0x52d187[_0xbe68('0x3e')][_0xbe68('0x4a')]){_0x25eaf2[_0xbe68('0x49')]=_[_0xbe68('0x4b')](_0x25eaf2['where'],{'$or':_[_0xbe68('0x3a')](_0x25eaf2[_0xbe68('0x41')],function(_0x3c715a){var _0xc648c4={};_0xc648c4[_0x3c715a]={'$like':'%'+_0x52d187[_0xbe68('0x3e')][_0xbe68('0x4a')]+'%'};return _0xc648c4;})});}_0x25eaf2=_[_0xbe68('0x4b')]({},_0x25eaf2,_0x52d187['options']);return _0x5aa27f[_0xbe68('0x5d')](_0x25eaf2);}})['then'](function(_0x50f210){if(_0x50f210){_0x1b2fec=_0x50f210['length'];if(!_0x52d187[_0xbe68('0x3e')][_0xbe68('0x45')](_0xbe68('0x5c'))){_0x25eaf2['limit']=qs[_0xbe68('0x46')](_0x52d187[_0xbe68('0x3e')]['limit']);_0x25eaf2[_0xbe68('0x30')]=qs[_0xbe68('0x30')](_0x52d187['query']['offset']);}return _0x5aa27f['getSubjects'](_0x25eaf2);}})['then'](function(_0x598a54){if(_0x598a54){return _0x598a54?{'count':_0x1b2fec,'rows':_0x598a54}:null;}})[_0xbe68('0x20')](respondWithResult(_0x453773,null))[_0xbe68('0x51')](handleError(_0x453773,null));};exports[_0xbe68('0x5e')]=function(_0x2980df,_0x351cc0,_0x2d30c1){var _0x43ce00={};var _0x25fe02={};var _0x115f46;var _0x1a66c1;return db[_0xbe68('0x4d')][_0xbe68('0x59')]({'where':{'id':_0x2980df['params']['id']}})['then'](handleEntityNotFound(_0x351cc0,null))[_0xbe68('0x20')](function(_0x32db45){if(_0x32db45){_0x115f46=_0x32db45;_0x25fe02[_0xbe68('0x40')]=_[_0xbe68('0x3d')](db[_0xbe68('0x5a')][_0xbe68('0x53')]);_0x25fe02[_0xbe68('0x3e')]=_[_0xbe68('0x3d')](_0x2980df['query']);_0x25fe02['filters']=_[_0xbe68('0x42')](_0x25fe02[_0xbe68('0x40')],_0x25fe02[_0xbe68('0x3e')]);_0x43ce00[_0xbe68('0x41')]=_[_0xbe68('0x42')](_0x25fe02[_0xbe68('0x40')],qs[_0xbe68('0x43')](_0x2980df[_0xbe68('0x3e')][_0xbe68('0x43')]));_0x43ce00[_0xbe68('0x41')]=_0x43ce00['attributes'][_0xbe68('0x44')]?_0x43ce00[_0xbe68('0x41')]:_0x25fe02[_0xbe68('0x40')];_0x43ce00[_0xbe68('0x47')]=qs[_0xbe68('0x48')](_0x2980df[_0xbe68('0x3e')][_0xbe68('0x48')]);_0x43ce00['where']=qs[_0xbe68('0x3f')](_[_0xbe68('0x5b')](_0x2980df['query'],_0x25fe02[_0xbe68('0x3f')]));if(_0x2980df['query'][_0xbe68('0x4a')]){_0x43ce00[_0xbe68('0x49')]=_[_0xbe68('0x4b')](_0x43ce00['where'],{'$or':_['map'](_0x43ce00[_0xbe68('0x41')],function(_0x36ef1c){var _0x372eec={};_0x372eec[_0x36ef1c]={'$like':'%'+_0x2980df[_0xbe68('0x3e')][_0xbe68('0x4a')]+'%'};return _0x372eec;})});}_0x43ce00=_[_0xbe68('0x4b')]({},_0x43ce00,_0x2980df[_0xbe68('0x54')]);return _0x115f46[_0xbe68('0x5e')](_0x43ce00);}})[_0xbe68('0x20')](function(_0x2bb2ab){if(_0x2bb2ab){_0x1a66c1=_0x2bb2ab[_0xbe68('0x44')];if(!_0x2980df[_0xbe68('0x3e')]['hasOwnProperty'](_0xbe68('0x5c'))){_0x43ce00[_0xbe68('0x46')]=qs['limit'](_0x2980df[_0xbe68('0x3e')][_0xbe68('0x46')]);_0x43ce00[_0xbe68('0x30')]=qs[_0xbe68('0x30')](_0x2980df[_0xbe68('0x3e')][_0xbe68('0x30')]);}return _0x115f46['getDescriptions'](_0x43ce00);}})[_0xbe68('0x20')](function(_0x5a18d0){if(_0x5a18d0){return _0x5a18d0?{'count':_0x1a66c1,'rows':_0x5a18d0}:null;}})['then'](respondWithResult(_0x351cc0,null))[_0xbe68('0x51')](handleError(_0x351cc0,null));}; \ No newline at end of file +var _0x88fd=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','getFields','findOne','getSubjects','ZohoField','hasOwnProperty','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','Sequelize','ValidationError'];(function(_0x5c5fb4,_0x2cb903){var _0x4c0813=function(_0x13d311){while(--_0x13d311){_0x5c5fb4['push'](_0x5c5fb4['shift']());}};_0x4c0813(++_0x2cb903);}(_0x88fd,0x150));var _0xd88f=function(_0x2529bb,_0x25854b){_0x2529bb=_0x2529bb-0x0;var _0x56c1bd=_0x88fd[_0x2529bb];return _0x56c1bd;};'use strict';var pdf=require(_0xd88f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd88f('0x1'));var zipdir=require(_0xd88f('0x2'));var jsonpatch=require(_0xd88f('0x3'));var rp=require(_0xd88f('0x4'));var moment=require('moment');var BPromise=require(_0xd88f('0x5'));var Mustache=require(_0xd88f('0x6'));var util=require(_0xd88f('0x7'));var path=require('path');var sox=require(_0xd88f('0x8'));var csv=require(_0xd88f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd88f('0xa'));var squel=require('squel');var crypto=require(_0xd88f('0xb'));var jsforce=require(_0xd88f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd88f('0x9'));var querystring=require(_0xd88f('0xd'));var Papa=require(_0xd88f('0xe'));var Redis=require('ioredis');var authService=require(_0xd88f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd88f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd88f('0x11'));var utils=require(_0xd88f('0x12'));var config=require(_0xd88f('0x13'));var db=require(_0xd88f('0x14'))['db'];var jayson=require(_0xd88f('0x15'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2f49f3,_0xfb7ba9,_0x24254c){if(_0x24254c){var _0x33ebc4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33ebc4['test'](_0xfb7ba9)){return _0x2f49f3;}else{throw new db[(_0xd88f('0x16'))][(_0xd88f('0x17'))](_0xd88f('0x18'));}}else{return _0x2f49f3;}}function respondWithRpcPromise(_0x3a077f,_0x44a85b,_0x209de8,_0x42db08){return new BPromise(function(_0x1a58e3,_0x537e52){var _0x2939c4=_0x42db08||client;return _0x2939c4[_0xd88f('0x19')](_0x3a077f,_0x209de8)[_0xd88f('0x1a')](function(_0x9e5a4c){logger['info'](_0xd88f('0x1b'),_0x44a85b,_0xd88f('0x1c'));logger[_0xd88f('0x1d')](_0xd88f('0x1e'),_0x44a85b,_0xd88f('0x1c'),JSON['stringify'](_0x9e5a4c));if(_0x9e5a4c[_0xd88f('0x1f')]){if(_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x20')]===0x1f4){logger[_0xd88f('0x1f')]('ZohoConfiguration,\x20%s,\x20%s',_0x44a85b,_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x21')]);return _0x537e52(_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x21')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x44a85b,_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x21')]);return _0x1a58e3(_0x9e5a4c[_0xd88f('0x1f')][_0xd88f('0x21')]);}else{logger[_0xd88f('0x22')](_0xd88f('0x1b'),_0x44a85b,'request\x20sent');_0x1a58e3(_0x9e5a4c[_0xd88f('0x23')]['message']);}})[_0xd88f('0x24')](function(_0x4d528b){logger[_0xd88f('0x1f')](_0xd88f('0x1b'),_0x44a85b,_0x4d528b);_0x537e52(_0x4d528b);});});}function respondWithStatusCode(_0xf926f9,_0x3f1ecb){_0x3f1ecb=_0x3f1ecb||0xcc;return function(_0x213410){if(_0x213410){return _0xf926f9[_0xd88f('0x25')](_0x3f1ecb);}return _0xf926f9[_0xd88f('0x26')](_0x3f1ecb)[_0xd88f('0x27')]();};}function respondWithResult(_0x4a762c,_0x14b025){_0x14b025=_0x14b025||0xc8;return function(_0x52cbae){if(_0x52cbae){return _0x4a762c[_0xd88f('0x26')](_0x14b025)[_0xd88f('0x28')](_0x52cbae);}};}function respondWithFilteredResult(_0x12f545,_0x5175c6){return function(_0x2aa453){if(_0x2aa453){var _0x3f0f03=_0x2aa453[_0xd88f('0x29')],_0x7305d=_0x5175c6[_0xd88f('0x2a')],_0x2a0ddf=_0x5175c6[_0xd88f('0x2a')]+_0x5175c6[_0xd88f('0x2b')],_0x501a4e;if(_0x2a0ddf>=_0x3f0f03){_0x2a0ddf=_0x3f0f03;_0x501a4e=0xc8;}else{_0x501a4e=0xce;}_0x12f545['status'](_0x501a4e);return _0x12f545[_0xd88f('0x2c')](_0xd88f('0x2d'),_0x7305d+'-'+_0x2a0ddf+'/'+_0x3f0f03)[_0xd88f('0x28')](_0x2aa453);}return null;};}function patchUpdates(_0x320895){return function(_0x399368){try{jsonpatch[_0xd88f('0x2e')](_0x399368,_0x320895,!![]);}catch(_0x11d47d){return BPromise['reject'](_0x11d47d);}return _0x399368[_0xd88f('0x2f')]();};}function saveUpdates(_0x472736,_0x34cda2){return function(_0x4cfe4d){if(_0x4cfe4d){return _0x4cfe4d[_0xd88f('0x30')](_0x472736)['then'](function(_0x3a0465){return _0x3a0465;});}return null;};}function removeEntity(_0x278ff8,_0x4f8133){return function(_0x3d64c5){if(_0x3d64c5){return _0x3d64c5[_0xd88f('0x31')]()['then'](function(){_0x278ff8[_0xd88f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c755,_0x2197fd){return function(_0x602b0c){if(!_0x602b0c){_0x34c755['sendStatus'](0x194);}return _0x602b0c;};}function handleError(_0x410528,_0x37d4db){_0x37d4db=_0x37d4db||0x1f4;return function(_0x390ba4){logger['error'](_0x390ba4[_0xd88f('0x32')]);if(_0x390ba4[_0xd88f('0x33')]){delete _0x390ba4[_0xd88f('0x33')];}_0x410528['status'](_0x37d4db)[_0xd88f('0x34')](_0x390ba4);};}exports[_0xd88f('0x35')]=function(_0x379b11,_0x270281){var _0x5d5183={},_0x342515={},_0x1da402={'count':0x0,'rows':[]};var _0x38910b=_[_0xd88f('0x36')](db[_0xd88f('0x37')][_0xd88f('0x38')],function(_0x4cda57){return{'name':_0x4cda57[_0xd88f('0x39')],'type':_0x4cda57[_0xd88f('0x3a')]['key']};});_0x342515[_0xd88f('0x3b')]=_[_0xd88f('0x36')](_0x38910b,'name');_0x342515[_0xd88f('0x3c')]=_['keys'](_0x379b11[_0xd88f('0x3c')]);_0x342515[_0xd88f('0x3d')]=_[_0xd88f('0x3e')](_0x342515[_0xd88f('0x3b')],_0x342515[_0xd88f('0x3c')]);_0x5d5183[_0xd88f('0x3f')]=_[_0xd88f('0x3e')](_0x342515[_0xd88f('0x3b')],qs[_0xd88f('0x40')](_0x379b11[_0xd88f('0x3c')]['fields']));_0x5d5183[_0xd88f('0x3f')]=_0x5d5183[_0xd88f('0x3f')][_0xd88f('0x41')]?_0x5d5183[_0xd88f('0x3f')]:_0x342515[_0xd88f('0x3b')];if(!_0x379b11[_0xd88f('0x3c')]['hasOwnProperty'](_0xd88f('0x42'))){_0x5d5183[_0xd88f('0x2b')]=qs[_0xd88f('0x2b')](_0x379b11[_0xd88f('0x3c')][_0xd88f('0x2b')]);_0x5d5183[_0xd88f('0x2a')]=qs['offset'](_0x379b11[_0xd88f('0x3c')][_0xd88f('0x2a')]);}_0x5d5183[_0xd88f('0x43')]=qs['sort'](_0x379b11[_0xd88f('0x3c')][_0xd88f('0x44')]);_0x5d5183[_0xd88f('0x45')]=qs['filters'](_[_0xd88f('0x46')](_0x379b11[_0xd88f('0x3c')],_0x342515[_0xd88f('0x3d')]),_0x38910b);if(_0x379b11[_0xd88f('0x3c')]['filter']){_0x5d5183['where']=_[_0xd88f('0x47')](_0x5d5183[_0xd88f('0x45')],{'$or':_[_0xd88f('0x36')](_0x38910b,function(_0x8f372){if(_0x8f372['type']!=='VIRTUAL'){var _0x43e698={};_0x43e698[_0x8f372['name']]={'$like':'%'+_0x379b11[_0xd88f('0x3c')][_0xd88f('0x48')]+'%'};return _0x43e698;}})});}_0x5d5183=_[_0xd88f('0x47')]({},_0x5d5183,_0x379b11[_0xd88f('0x49')]);var _0x346afb={'where':_0x5d5183[_0xd88f('0x45')]};return db[_0xd88f('0x37')][_0xd88f('0x29')](_0x346afb)[_0xd88f('0x1a')](function(_0x7319e0){_0x1da402[_0xd88f('0x29')]=_0x7319e0;if(_0x379b11[_0xd88f('0x3c')][_0xd88f('0x4a')]){_0x5d5183['include']=[{'all':!![]}];}return db[_0xd88f('0x37')][_0xd88f('0x4b')](_0x5d5183);})[_0xd88f('0x1a')](function(_0x2e8153){_0x1da402[_0xd88f('0x4c')]=_0x2e8153;return _0x1da402;})[_0xd88f('0x1a')](respondWithFilteredResult(_0x270281,_0x5d5183))[_0xd88f('0x24')](handleError(_0x270281,null));};exports[_0xd88f('0x4d')]=function(_0x463497,_0x9a014){var _0x39cea4={'raw':![],'where':{'id':_0x463497[_0xd88f('0x4e')]['id']}},_0x2cb164={};_0x2cb164[_0xd88f('0x3b')]=_['keys'](db[_0xd88f('0x37')][_0xd88f('0x38')]);_0x2cb164[_0xd88f('0x3c')]=_[_0xd88f('0x4f')](_0x463497[_0xd88f('0x3c')]);_0x2cb164[_0xd88f('0x3d')]=_[_0xd88f('0x3e')](_0x2cb164[_0xd88f('0x3b')],_0x2cb164[_0xd88f('0x3c')]);_0x39cea4['attributes']=_[_0xd88f('0x3e')](_0x2cb164[_0xd88f('0x3b')],qs[_0xd88f('0x40')](_0x463497[_0xd88f('0x3c')][_0xd88f('0x40')]));_0x39cea4[_0xd88f('0x3f')]=_0x39cea4[_0xd88f('0x3f')]['length']?_0x39cea4['attributes']:_0x2cb164['model'];if(_0x463497[_0xd88f('0x3c')][_0xd88f('0x4a')]){_0x39cea4[_0xd88f('0x50')]=[{'all':!![]}];}_0x39cea4=_[_0xd88f('0x47')]({},_0x39cea4,_0x463497[_0xd88f('0x49')]);return db[_0xd88f('0x37')][_0xd88f('0x51')](_0x39cea4)[_0xd88f('0x1a')](handleEntityNotFound(_0x9a014,null))[_0xd88f('0x1a')](respondWithResult(_0x9a014,null))[_0xd88f('0x24')](handleError(_0x9a014,null));};exports['create']=function(_0x5f00a3,_0x5f1d16){return db[_0xd88f('0x37')][_0xd88f('0x52')](_0x5f00a3['body'],{})['then'](respondWithResult(_0x5f1d16,0xc9))['catch'](handleError(_0x5f1d16,null));};exports[_0xd88f('0x30')]=function(_0x148fd1,_0x31749a){if(_0x148fd1['body']['id']){delete _0x148fd1[_0xd88f('0x53')]['id'];}return db['ZohoConfiguration'][_0xd88f('0x51')]({'where':{'id':_0x148fd1[_0xd88f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x31749a,null))[_0xd88f('0x1a')](saveUpdates(_0x148fd1['body'],null))[_0xd88f('0x1a')](respondWithResult(_0x31749a,null))[_0xd88f('0x24')](handleError(_0x31749a,null));};exports[_0xd88f('0x31')]=function(_0x32eb40,_0x56cb54){return db[_0xd88f('0x37')][_0xd88f('0x51')]({'where':{'id':_0x32eb40[_0xd88f('0x4e')]['id']}})[_0xd88f('0x1a')](handleEntityNotFound(_0x56cb54,null))[_0xd88f('0x1a')](removeEntity(_0x56cb54,null))['catch'](handleError(_0x56cb54,null));};exports[_0xd88f('0x54')]=function(_0x45a34b,_0x31f0ef,_0x2f9df7){var _0x37f9eb={};var _0x5f3eba={};var _0x458cb9;var _0x51a8c9;return db['ZohoConfiguration'][_0xd88f('0x55')]({'where':{'id':_0x45a34b['params']['id']}})[_0xd88f('0x1a')](handleEntityNotFound(_0x31f0ef,null))[_0xd88f('0x1a')](function(_0x227af6){if(_0x227af6){_0x458cb9=_0x227af6;_0x5f3eba[_0xd88f('0x3b')]=_[_0xd88f('0x4f')](db['ZohoField'][_0xd88f('0x38')]);_0x5f3eba[_0xd88f('0x3c')]=_['keys'](_0x45a34b[_0xd88f('0x3c')]);_0x5f3eba[_0xd88f('0x3d')]=_[_0xd88f('0x3e')](_0x5f3eba[_0xd88f('0x3b')],_0x5f3eba[_0xd88f('0x3c')]);_0x37f9eb[_0xd88f('0x3f')]=_['intersection'](_0x5f3eba['model'],qs[_0xd88f('0x40')](_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x40')]));_0x37f9eb[_0xd88f('0x3f')]=_0x37f9eb[_0xd88f('0x3f')][_0xd88f('0x41')]?_0x37f9eb[_0xd88f('0x3f')]:_0x5f3eba[_0xd88f('0x3b')];_0x37f9eb[_0xd88f('0x43')]=qs[_0xd88f('0x44')](_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x44')]);_0x37f9eb['where']=qs['filters'](_[_0xd88f('0x46')](_0x45a34b[_0xd88f('0x3c')],_0x5f3eba[_0xd88f('0x3d')]));if(_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x48')]){_0x37f9eb[_0xd88f('0x45')]=_['merge'](_0x37f9eb[_0xd88f('0x45')],{'$or':_['map'](_0x37f9eb['attributes'],function(_0x2e3879){var _0x3288ce={};_0x3288ce[_0x2e3879]={'$like':'%'+_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x48')]+'%'};return _0x3288ce;})});}_0x37f9eb=_[_0xd88f('0x47')]({},_0x37f9eb,_0x45a34b[_0xd88f('0x49')]);return _0x458cb9[_0xd88f('0x54')](_0x37f9eb);}})[_0xd88f('0x1a')](function(_0x594681){if(_0x594681){_0x51a8c9=_0x594681[_0xd88f('0x41')];if(!_0x45a34b[_0xd88f('0x3c')]['hasOwnProperty'](_0xd88f('0x42'))){_0x37f9eb[_0xd88f('0x2b')]=qs['limit'](_0x45a34b['query'][_0xd88f('0x2b')]);_0x37f9eb[_0xd88f('0x2a')]=qs[_0xd88f('0x2a')](_0x45a34b[_0xd88f('0x3c')][_0xd88f('0x2a')]);}return _0x458cb9[_0xd88f('0x54')](_0x37f9eb);}})[_0xd88f('0x1a')](function(_0x4c368d){if(_0x4c368d){return _0x4c368d?{'count':_0x51a8c9,'rows':_0x4c368d}:null;}})[_0xd88f('0x1a')](respondWithResult(_0x31f0ef,null))[_0xd88f('0x24')](handleError(_0x31f0ef,null));};exports[_0xd88f('0x56')]=function(_0x444202,_0x3ba4b8,_0x4ad06c){var _0x6ac955={};var _0x1512fb={};var _0x2eaeea;var _0x5917b0;return db['ZohoConfiguration'][_0xd88f('0x55')]({'where':{'id':_0x444202['params']['id']}})['then'](handleEntityNotFound(_0x3ba4b8,null))[_0xd88f('0x1a')](function(_0x586a02){if(_0x586a02){_0x2eaeea=_0x586a02;_0x1512fb['model']=_[_0xd88f('0x4f')](db[_0xd88f('0x57')][_0xd88f('0x38')]);_0x1512fb[_0xd88f('0x3c')]=_[_0xd88f('0x4f')](_0x444202[_0xd88f('0x3c')]);_0x1512fb[_0xd88f('0x3d')]=_[_0xd88f('0x3e')](_0x1512fb[_0xd88f('0x3b')],_0x1512fb[_0xd88f('0x3c')]);_0x6ac955['attributes']=_[_0xd88f('0x3e')](_0x1512fb['model'],qs[_0xd88f('0x40')](_0x444202[_0xd88f('0x3c')]['fields']));_0x6ac955[_0xd88f('0x3f')]=_0x6ac955['attributes'][_0xd88f('0x41')]?_0x6ac955['attributes']:_0x1512fb[_0xd88f('0x3b')];_0x6ac955[_0xd88f('0x43')]=qs['sort'](_0x444202[_0xd88f('0x3c')][_0xd88f('0x44')]);_0x6ac955[_0xd88f('0x45')]=qs['filters'](_[_0xd88f('0x46')](_0x444202['query'],_0x1512fb['filters']));if(_0x444202['query'][_0xd88f('0x48')]){_0x6ac955[_0xd88f('0x45')]=_[_0xd88f('0x47')](_0x6ac955['where'],{'$or':_['map'](_0x6ac955[_0xd88f('0x3f')],function(_0x53a767){var _0x150c5a={};_0x150c5a[_0x53a767]={'$like':'%'+_0x444202[_0xd88f('0x3c')][_0xd88f('0x48')]+'%'};return _0x150c5a;})});}_0x6ac955=_['merge']({},_0x6ac955,_0x444202['options']);return _0x2eaeea['getSubjects'](_0x6ac955);}})['then'](function(_0x2f205d){if(_0x2f205d){_0x5917b0=_0x2f205d['length'];if(!_0x444202[_0xd88f('0x3c')][_0xd88f('0x58')](_0xd88f('0x42'))){_0x6ac955[_0xd88f('0x2b')]=qs[_0xd88f('0x2b')](_0x444202[_0xd88f('0x3c')][_0xd88f('0x2b')]);_0x6ac955[_0xd88f('0x2a')]=qs[_0xd88f('0x2a')](_0x444202[_0xd88f('0x3c')][_0xd88f('0x2a')]);}return _0x2eaeea[_0xd88f('0x56')](_0x6ac955);}})[_0xd88f('0x1a')](function(_0x428343){if(_0x428343){return _0x428343?{'count':_0x5917b0,'rows':_0x428343}:null;}})[_0xd88f('0x1a')](respondWithResult(_0x3ba4b8,null))[_0xd88f('0x24')](handleError(_0x3ba4b8,null));};exports[_0xd88f('0x59')]=function(_0x29b029,_0x16b43c,_0x2ecd5b){var _0x5a9f37={};var _0x8761df={};var _0x35e65d;var _0x38ddee;return db[_0xd88f('0x37')][_0xd88f('0x55')]({'where':{'id':_0x29b029[_0xd88f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16b43c,null))[_0xd88f('0x1a')](function(_0x280cab){if(_0x280cab){_0x35e65d=_0x280cab;_0x8761df['model']=_[_0xd88f('0x4f')](db[_0xd88f('0x57')][_0xd88f('0x38')]);_0x8761df['query']=_[_0xd88f('0x4f')](_0x29b029[_0xd88f('0x3c')]);_0x8761df['filters']=_[_0xd88f('0x3e')](_0x8761df[_0xd88f('0x3b')],_0x8761df[_0xd88f('0x3c')]);_0x5a9f37['attributes']=_[_0xd88f('0x3e')](_0x8761df[_0xd88f('0x3b')],qs[_0xd88f('0x40')](_0x29b029['query'][_0xd88f('0x40')]));_0x5a9f37['attributes']=_0x5a9f37[_0xd88f('0x3f')][_0xd88f('0x41')]?_0x5a9f37[_0xd88f('0x3f')]:_0x8761df[_0xd88f('0x3b')];_0x5a9f37[_0xd88f('0x43')]=qs[_0xd88f('0x44')](_0x29b029[_0xd88f('0x3c')][_0xd88f('0x44')]);_0x5a9f37[_0xd88f('0x45')]=qs[_0xd88f('0x3d')](_[_0xd88f('0x46')](_0x29b029[_0xd88f('0x3c')],_0x8761df[_0xd88f('0x3d')]));if(_0x29b029['query'][_0xd88f('0x48')]){_0x5a9f37[_0xd88f('0x45')]=_[_0xd88f('0x47')](_0x5a9f37[_0xd88f('0x45')],{'$or':_['map'](_0x5a9f37[_0xd88f('0x3f')],function(_0x2bc46a){var _0x2e7bd7={};_0x2e7bd7[_0x2bc46a]={'$like':'%'+_0x29b029[_0xd88f('0x3c')][_0xd88f('0x48')]+'%'};return _0x2e7bd7;})});}_0x5a9f37=_[_0xd88f('0x47')]({},_0x5a9f37,_0x29b029[_0xd88f('0x49')]);return _0x35e65d[_0xd88f('0x59')](_0x5a9f37);}})['then'](function(_0x5040f2){if(_0x5040f2){_0x38ddee=_0x5040f2['length'];if(!_0x29b029[_0xd88f('0x3c')][_0xd88f('0x58')](_0xd88f('0x42'))){_0x5a9f37['limit']=qs[_0xd88f('0x2b')](_0x29b029[_0xd88f('0x3c')][_0xd88f('0x2b')]);_0x5a9f37['offset']=qs[_0xd88f('0x2a')](_0x29b029['query'][_0xd88f('0x2a')]);}return _0x35e65d[_0xd88f('0x59')](_0x5a9f37);}})[_0xd88f('0x1a')](function(_0x57d549){if(_0x57d549){return _0x57d549?{'count':_0x38ddee,'rows':_0x57d549}:null;}})[_0xd88f('0x1a')](respondWithResult(_0x16b43c,null))[_0xd88f('0x24')](handleError(_0x16b43c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c596415..c3f3405 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 _0x2c49=['rimraf','./intZohoConfiguration.attributes','define','ZohoConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x2c49,0xd5));var _0x92c4=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0x2c49[_0x2c18a8];return _0x1e009a;};'use strict';var _=require(_0x92c4('0x0'));var util=require(_0x92c4('0x1'));var logger=require(_0x92c4('0x2'))(_0x92c4('0x3'));var moment=require('moment');var BPromise=require(_0x92c4('0x4'));var rp=require(_0x92c4('0x5'));var fs=require('fs');var path=require(_0x92c4('0x6'));var rimraf=require(_0x92c4('0x7'));var config=require('../../config/environment');var attributes=require(_0x92c4('0x8'));module['exports']=function(_0xa8e776,_0x28c55b){return _0xa8e776[_0x92c4('0x9')](_0x92c4('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb365=['api','path','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0xb365,0x10f));var _0x5b36=function(_0x247de6,_0x36bc2e){_0x247de6=_0x247de6-0x0;var _0x515420=_0xb365[_0x247de6];return _0x515420;};'use strict';var _=require(_0x5b36('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b36('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b36('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5b36('0x3'));module[_0x5b36('0x4')]=function(_0x1123ba,_0x361567){return _0x1123ba[_0x5b36('0x5')](_0x5b36('0x6'),attributes,{'tableName':_0x5b36('0x7'),'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 097f0fe..956e6dd 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 _0x34ab=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x5c6fde,_0x29fac8){var _0x2a9c77=function(_0x22d576){while(--_0x22d576){_0x5c6fde['push'](_0x5c6fde['shift']());}};_0x2a9c77(++_0x29fac8);}(_0x34ab,0x6d));var _0xb34a=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0x34ab[_0x1bf809];return _0x1caa4e;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var moment=require('moment');var BPromise=require(_0xb34a('0x2'));var rs=require(_0xb34a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb34a('0x4'))['db'];var utils=require(_0xb34a('0x5'));var logger=require(_0xb34a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb34a('0x7'));var client=jayson[_0xb34a('0x8')][_0xb34a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x485f65,_0x22675f,_0x41162c){return new BPromise(function(_0x5c3626,_0x1b85ac){return client[_0xb34a('0xa')](_0x485f65,_0x41162c)[_0xb34a('0xb')](function(_0xfaab84){logger[_0xb34a('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x22675f,'request\x20sent');logger[_0xb34a('0xd')](_0xb34a('0xe'),_0x22675f,_0xb34a('0xf'),JSON[_0xb34a('0x10')](_0xfaab84));if(_0xfaab84[_0xb34a('0x11')]){if(_0xfaab84['error'][_0xb34a('0x12')]===0x1f4){logger['error'](_0xb34a('0x13'),_0x22675f,_0xfaab84[_0xb34a('0x11')]['message']);return _0x1b85ac(_0xfaab84[_0xb34a('0x11')]['message']);}logger[_0xb34a('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x22675f,_0xfaab84[_0xb34a('0x11')][_0xb34a('0x14')]);return _0x5c3626(_0xfaab84['error']['message']);}else{logger[_0xb34a('0xc')](_0xb34a('0x13'),_0x22675f,'request\x20sent');_0x5c3626(_0xfaab84['result']['message']);}})[_0xb34a('0x15')](function(_0x2b4f25){logger[_0xb34a('0x11')](_0xb34a('0x13'),_0x22675f,_0x2b4f25);_0x1b85ac(_0x2b4f25);});});} \ No newline at end of file +var _0xbdc8=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x533290,_0x31e3ae){var _0x23f13d=function(_0x3473fb){while(--_0x3473fb){_0x533290['push'](_0x533290['shift']());}};_0x23f13d(++_0x31e3ae);}(_0xbdc8,0x10e));var _0x8bdc=function(_0x333cfa,_0x74e10b){_0x333cfa=_0x333cfa-0x0;var _0x592349=_0xbdc8[_0x333cfa];return _0x592349;};'use strict';var _=require(_0x8bdc('0x0'));var util=require(_0x8bdc('0x1'));var moment=require(_0x8bdc('0x2'));var BPromise=require(_0x8bdc('0x3'));var rs=require(_0x8bdc('0x4'));var fs=require('fs');var Redis=require(_0x8bdc('0x5'));var db=require(_0x8bdc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bdc('0x7'))('rpc');var config=require(_0x8bdc('0x8'));var jayson=require(_0x8bdc('0x9'));var client=jayson[_0x8bdc('0xa')][_0x8bdc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x479371,_0x5cd9a1,_0x53f52a){return new BPromise(function(_0x442183,_0x45c349){return client[_0x8bdc('0xc')](_0x479371,_0x53f52a)[_0x8bdc('0xd')](function(_0x3a4274){logger[_0x8bdc('0xe')](_0x8bdc('0xf'),_0x5cd9a1,_0x8bdc('0x10'));logger[_0x8bdc('0x11')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5cd9a1,_0x8bdc('0x10'),JSON[_0x8bdc('0x12')](_0x3a4274));if(_0x3a4274[_0x8bdc('0x13')]){if(_0x3a4274[_0x8bdc('0x13')][_0x8bdc('0x14')]===0x1f4){logger[_0x8bdc('0x13')](_0x8bdc('0xf'),_0x5cd9a1,_0x3a4274[_0x8bdc('0x13')][_0x8bdc('0x15')]);return _0x45c349(_0x3a4274[_0x8bdc('0x13')][_0x8bdc('0x15')]);}logger[_0x8bdc('0x13')](_0x8bdc('0xf'),_0x5cd9a1,_0x3a4274[_0x8bdc('0x13')][_0x8bdc('0x15')]);return _0x442183(_0x3a4274[_0x8bdc('0x13')]['message']);}else{logger[_0x8bdc('0xe')](_0x8bdc('0xf'),_0x5cd9a1,_0x8bdc('0x10'));_0x442183(_0x3a4274[_0x8bdc('0x16')][_0x8bdc('0x15')]);}})['catch'](function(_0x31419e){logger['error'](_0x8bdc('0xf'),_0x5cd9a1,_0x31419e);_0x45c349(_0x31419e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 29de417..3924908 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 _0x8e3f=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var path=require(_0xf8e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8e3('0x3'));var router=express[_0xf8e3('0x4')]();var auth=require(_0xf8e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8e3('0x6'));var controller=require(_0xf8e3('0x7'));router['get']('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x9')]);router[_0xf8e3('0xa')](_0xf8e3('0xb'),auth['isAuthenticated'](),controller[_0xf8e3('0xc')]);router[_0xf8e3('0xd')]('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0xe')]);router[_0xf8e3('0xf')](_0xf8e3('0xb'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x10')]);router[_0xf8e3('0x11')](_0xf8e3('0xb'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4e2e=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x1e90b8,_0x31e660){var _0x36fdd6=function(_0x37f7dc){while(--_0x37f7dc){_0x1e90b8['push'](_0x1e90b8['shift']());}};_0x36fdd6(++_0x31e660);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2f2eb8,_0x52b0f0){_0x2f2eb8=_0x2f2eb8-0x0;var _0x3f8e1f=_0x4e2e[_0x2f2eb8];return _0x3f8e1f;};'use strict';var multer=require('multer');var util=require(_0xe4e2('0x0'));var path=require(_0xe4e2('0x1'));var timeout=require(_0xe4e2('0x2'));var express=require(_0xe4e2('0x3'));var router=express[_0xe4e2('0x4')]();var auth=require(_0xe4e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe4e2('0x6'));var controller=require(_0xe4e2('0x7'));router[_0xe4e2('0x8')]('/',auth[_0xe4e2('0x9')](),controller['index']);router[_0xe4e2('0x8')](_0xe4e2('0xa'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xb')]);router[_0xe4e2('0xc')]('/',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xd')]);router[_0xe4e2('0xe')]('/:id',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xf')]);router[_0xe4e2('0x10')]('/:id',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x11')]);module[_0xe4e2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e19bc36..b1cd1c1 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 _0x7b47=['exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0x7b47,0x118));var _0x77b4=function(_0x2bafd8,_0x53effd){_0x2bafd8=_0x2bafd8-0x0;var _0x347087=_0x7b47[_0x2bafd8];return _0x347087;};'use strict';var Sequelize=require('sequelize');module[_0x77b4('0x0')]={'type':{'type':Sequelize['ENUM'](_0x77b4('0x1'),_0x77b4('0x2'),_0x77b4('0x3'),_0x77b4('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x77b4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x77b4('0x6')](_0x77b4('0x1'),_0x77b4('0x2'),_0x77b4('0x3'))},'keyContent':{'type':Sequelize[_0x77b4('0x5')]},'idField':{'type':Sequelize[_0x77b4('0x5')]},'nameField':{'type':Sequelize[_0x77b4('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77b4('0x5')]}}; \ No newline at end of file +var _0x374f=['keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x74e8d3,_0x123707){var _0x56a804=function(_0x2e2362){while(--_0x2e2362){_0x74e8d3['push'](_0x74e8d3['shift']());}};_0x56a804(++_0x123707);}(_0x374f,0x13f));var _0xf374=function(_0x24c84f,_0x42550e){_0x24c84f=_0x24c84f-0x0;var _0x579499=_0x374f[_0x24c84f];return _0x579499;};'use strict';var Sequelize=require(_0xf374('0x0'));module[_0xf374('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf374('0x2'),_0xf374('0x3'),_0xf374('0x4'),_0xf374('0x5')),'defaultValue':_0xf374('0x2')},'content':{'type':Sequelize[_0xf374('0x6')]},'key':{'type':Sequelize[_0xf374('0x6')]},'keyType':{'type':Sequelize[_0xf374('0x7')](_0xf374('0x2'),_0xf374('0x3'),_0xf374('0x4'))},'keyContent':{'type':Sequelize[_0xf374('0x6')]},'idField':{'type':Sequelize[_0xf374('0x6')]},'nameField':{'type':Sequelize[_0xf374('0x6')]},'customField':{'type':Sequelize[_0xf374('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf374('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 36a4c7b..55c0411 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x3046d8,_0x19af5e){var _0x56ecb6=function(_0x4d50f9){while(--_0x4d50f9){_0x3046d8['push'](_0x3046d8['shift']());}};_0x56ecb6(++_0x19af5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5484cf,_0x153f52){var _0x5b7de7=function(_0x56c53a){while(--_0x56c53a){_0x5484cf['push'](_0x5484cf['shift']());}};_0x5b7de7(++_0x153f52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 8627b83..0a5c0ba 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 _0xe3fb=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0xe3fb,0x9c));var _0xbe3f=function(_0x32ca7a,_0x4a069d){_0x32ca7a=_0x32ca7a-0x0;var _0xab41b9=_0xe3fb[_0x32ca7a];return _0xab41b9;};'use strict';var _=require(_0xbe3f('0x0'));var util=require('util');var logger=require(_0xbe3f('0x1'))(_0xbe3f('0x2'));var moment=require('moment');var BPromise=require(_0xbe3f('0x3'));var rp=require(_0xbe3f('0x4'));var fs=require('fs');var path=require(_0xbe3f('0x5'));var rimraf=require(_0xbe3f('0x6'));var config=require(_0xbe3f('0x7'));var attributes=require('./intZohoField.attributes');module[_0xbe3f('0x8')]=function(_0x331574,_0x14da19){return _0x331574[_0xbe3f('0x9')](_0xbe3f('0xa'),attributes,{'tableName':_0xbe3f('0xb'),'paranoid':![],'indexes':[{'name':_0xbe3f('0xc'),'fields':[_0xbe3f('0xd'),_0xbe3f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad6b=['int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','define','ZohoField'];(function(_0x11bb0f,_0x208efb){var _0x371e38=function(_0x38699e){while(--_0x38699e){_0x11bb0f['push'](_0x11bb0f['shift']());}};_0x371e38(++_0x208efb);}(_0xad6b,0xd4));var _0xbad6=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xad6b[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xbad6('0x0'));var util=require(_0xbad6('0x1'));var logger=require(_0xbad6('0x2'))(_0xbad6('0x3'));var moment=require(_0xbad6('0x4'));var BPromise=require(_0xbad6('0x5'));var rp=require(_0xbad6('0x6'));var fs=require('fs');var path=require(_0xbad6('0x7'));var rimraf=require(_0xbad6('0x8'));var config=require('../../config/environment');var attributes=require(_0xbad6('0x9'));module['exports']=function(_0x1a603a,_0x4ddc47){return _0x1a603a[_0xbad6('0xa')](_0xbad6('0xb'),attributes,{'tableName':_0xbad6('0xc'),'paranoid':![],'indexes':[{'name':_0xbad6('0xd'),'fields':[_0xbad6('0xe'),_0xbad6('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index a18a031..9b80d4f 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(_0x55b7ef,_0x3f234e){var _0x1f62b8=function(_0x5b872f){while(--_0x5b872f){_0x55b7ef['push'](_0x55b7ef['shift']());}};_0x1f62b8(++_0x3f234e);}(_0x6aa7,0x178));var _0x76aa=function(_0x5b055a,_0x47b65e){_0x5b055a=_0x5b055a-0x0;var _0x5ec09b=_0x6aa7[_0x5b055a];return _0x5ec09b;};'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 _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x7bae[_0x3826ad];return _0x17b900;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('ZohoField,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('ZohoField,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 11c6868..318ddd7 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 _0xf748=['../../config/environment','exports','path','express','../../components/interaction/service'];(function(_0x2de0ec,_0x38812f){var _0x13aa7b=function(_0x340176){while(--_0x340176){_0x2de0ec['push'](_0x2de0ec['shift']());}};_0x13aa7b(++_0x38812f);}(_0xf748,0x1d8));var _0x8f74=function(_0x2df537,_0x1359a8){_0x2df537=_0x2df537-0x0;var _0x288850=_0xf748[_0x2df537];return _0x288850;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f74('0x0'));var timeout=require('connect-timeout');var express=require(_0x8f74('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8f74('0x2'));var config=require(_0x8f74('0x3'));module[_0x8f74('0x4')]=router; \ No newline at end of file +var _0x48ac=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x48ac,0x157));var _0xc48a=function(_0x1875f8,_0x29fcfc){_0x1875f8=_0x1875f8-0x0;var _0x1465cf=_0x48ac[_0x1875f8];return _0x1465cf;};'use strict';var multer=require(_0xc48a('0x0'));var util=require(_0xc48a('0x1'));var path=require(_0xc48a('0x2'));var timeout=require(_0xc48a('0x3'));var express=require(_0xc48a('0x4'));var router=express[_0xc48a('0x5')]();var auth=require(_0xc48a('0x6'));var interaction=require(_0xc48a('0x7'));var config=require(_0xc48a('0x8'));module[_0xc48a('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index cca99d8..2dda7ed 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 _0x5501=['state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x212c61,_0x5beafd){var _0xd63be8=function(_0x4096c3){while(--_0x4096c3){_0x212c61['push'](_0x212c61['shift']());}};_0xd63be8(++_0x5beafd);}(_0x5501,0xe5));var _0x1550=function(_0x481866,_0x50427b){_0x481866=_0x481866-0x0;var _0x3abeca=_0x5501[_0x481866];return _0x3abeca;};'use strict';var Sequelize=require(_0x1550('0x0'));module[_0x1550('0x1')]={'name':{'type':Sequelize[_0x1550('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x1550('0x2')],'allowNull':![],'unique':_0x1550('0x3')},'main':{'type':Sequelize[_0x1550('0x2')],'defaultValue':_0x1550('0x4')},'filename':{'type':Sequelize[_0x1550('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x1550('0x2')]},'logo':{'type':Sequelize[_0x1550('0x2')]},'state':{'type':Sequelize[_0x1550('0x2')],'unique':_0x1550('0x5')},'description':{'type':Sequelize[_0x1550('0x2')]},'title':{'type':Sequelize[_0x1550('0x2')]},'remoteUri':{'type':Sequelize[_0x1550('0x2')]},'link':{'type':Sequelize[_0x1550('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xec63=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xec63,0x129));var _0x3ec6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec63[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3ec6('0x0'));module[_0x3ec6('0x1')]={'name':{'type':Sequelize[_0x3ec6('0x2')],'allowNull':![],'unique':_0x3ec6('0x3')},'version':{'type':Sequelize[_0x3ec6('0x2')],'allowNull':![],'unique':_0x3ec6('0x3')},'main':{'type':Sequelize[_0x3ec6('0x2')],'defaultValue':_0x3ec6('0x4')},'filename':{'type':Sequelize[_0x3ec6('0x2')]},'path':{'type':Sequelize[_0x3ec6('0x2')]},'type':{'type':Sequelize[_0x3ec6('0x2')]},'size':{'type':Sequelize[_0x3ec6('0x5')]},'active':{'type':Sequelize[_0x3ec6('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x3ec6('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x3ec6('0x2')],'unique':_0x3ec6('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x3ec6('0x2')]},'remoteUri':{'type':Sequelize[_0x3ec6('0x2')]},'link':{'type':Sequelize[_0x3ec6('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 3e29404..9816488 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 _0x20b6=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','Integration','rawAttributes','fieldName','type','key','keys','query','filters'];(function(_0x423865,_0x499a7a){var _0x332593=function(_0x50c2bf){while(--_0x50c2bf){_0x423865['push'](_0x423865['shift']());}};_0x332593(++_0x499a7a);}(_0x20b6,0x180));var _0x620b=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0x20b6[_0x47a40b];return _0x19610c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x620b('0x0'));var rimraf=require(_0x620b('0x1'));var zipdir=require(_0x620b('0x2'));var jsonpatch=require(_0x620b('0x3'));var rp=require(_0x620b('0x4'));var moment=require(_0x620b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x620b('0x6'));var path=require(_0x620b('0x7'));var sox=require('sox');var csv=require(_0x620b('0x8'));var ejs=require(_0x620b('0x9'));var fs=require('fs');var _=require(_0x620b('0xa'));var squel=require(_0x620b('0xb'));var crypto=require(_0x620b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x620b('0xd'));var toCsv=require(_0x620b('0x8'));var querystring=require(_0x620b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x620b('0xf'));var qs=require(_0x620b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x620b('0x11'));var logger=require('../../config/logger')(_0x620b('0x12'));var utils=require(_0x620b('0x13'));var config=require(_0x620b('0x14'));var db=require(_0x620b('0x15'))['db'];function respondWithStatusCode(_0x522adf,_0x5d6092){_0x5d6092=_0x5d6092||0xcc;return function(_0x4786ba){if(_0x4786ba){return _0x522adf[_0x620b('0x16')](_0x5d6092);}return _0x522adf[_0x620b('0x17')](_0x5d6092)['end']();};}function respondWithResult(_0x4ebe84,_0xf30045){_0xf30045=_0xf30045||0xc8;return function(_0x162ee8){if(_0x162ee8){return _0x4ebe84[_0x620b('0x17')](_0xf30045)[_0x620b('0x18')](_0x162ee8);}};}function respondWithFilteredResult(_0x2abada,_0x6f0672){return function(_0x47e60e){if(_0x47e60e){var _0x577e05=_0x47e60e[_0x620b('0x19')],_0x28f4af=_0x6f0672['offset'],_0x24c110=_0x6f0672[_0x620b('0x1a')]+_0x6f0672[_0x620b('0x1b')],_0x38f1b2;if(_0x24c110>=_0x577e05){_0x24c110=_0x577e05;_0x38f1b2=0xc8;}else{_0x38f1b2=0xce;}_0x2abada['status'](_0x38f1b2);return _0x2abada['set'](_0x620b('0x1c'),_0x28f4af+'-'+_0x24c110+'/'+_0x577e05)['json'](_0x47e60e);}return null;};}function patchUpdates(_0x1a3b39){return function(_0x3a2609){try{jsonpatch[_0x620b('0x1d')](_0x3a2609,_0x1a3b39,!![]);}catch(_0x11196b){return BPromise[_0x620b('0x1e')](_0x11196b);}return _0x3a2609[_0x620b('0x1f')]();};}function saveUpdates(_0x1be4a0,_0x35c6e5){return function(_0x2a4a90){if(_0x2a4a90){return _0x2a4a90[_0x620b('0x20')](_0x1be4a0)[_0x620b('0x21')](function(_0x1141d7){return _0x1141d7;});}return null;};}function removeEntity(_0x39e50c,_0x4b9b9c){return function(_0x29c645){if(_0x29c645){return _0x29c645[_0x620b('0x22')]()['then'](function(){_0x39e50c['status'](0xcc)[_0x620b('0x23')]();});}};}function handleEntityNotFound(_0x6e7911,_0x3460c6){return function(_0xc1796a){if(!_0xc1796a){_0x6e7911[_0x620b('0x16')](0x194);}return _0xc1796a;};}function handleError(_0x2f34ff,_0x5d8268){_0x5d8268=_0x5d8268||0x1f4;return function(_0x1f5d56){logger['error'](_0x1f5d56[_0x620b('0x24')]);if(_0x1f5d56[_0x620b('0x25')]){delete _0x1f5d56['name'];}_0x2f34ff[_0x620b('0x17')](_0x5d8268)['send'](_0x1f5d56);};}exports[_0x620b('0x26')]=function(_0xb45d75,_0x53d01c){var _0x3c5d0d={},_0x327417={},_0x532ca0={'count':0x0,'rows':[]};var _0x3f7bf3=_[_0x620b('0x27')](db[_0x620b('0x28')][_0x620b('0x29')],function(_0x42725a){return{'name':_0x42725a[_0x620b('0x2a')],'type':_0x42725a[_0x620b('0x2b')][_0x620b('0x2c')]};});_0x327417['model']=_[_0x620b('0x27')](_0x3f7bf3,_0x620b('0x25'));_0x327417['query']=_[_0x620b('0x2d')](_0xb45d75[_0x620b('0x2e')]);_0x327417[_0x620b('0x2f')]=_['intersection'](_0x327417['model'],_0x327417[_0x620b('0x2e')]);_0x3c5d0d['attributes']=_[_0x620b('0x30')](_0x327417[_0x620b('0x31')],qs['fields'](_0xb45d75[_0x620b('0x2e')][_0x620b('0x32')]));_0x3c5d0d[_0x620b('0x33')]=_0x3c5d0d[_0x620b('0x33')][_0x620b('0x34')]?_0x3c5d0d[_0x620b('0x33')]:_0x327417[_0x620b('0x31')];if(!_0xb45d75[_0x620b('0x2e')][_0x620b('0x35')](_0x620b('0x36'))){_0x3c5d0d['limit']=qs[_0x620b('0x1b')](_0xb45d75[_0x620b('0x2e')][_0x620b('0x1b')]);_0x3c5d0d[_0x620b('0x1a')]=qs[_0x620b('0x1a')](_0xb45d75[_0x620b('0x2e')][_0x620b('0x1a')]);}_0x3c5d0d[_0x620b('0x37')]=qs['sort'](_0xb45d75[_0x620b('0x2e')][_0x620b('0x38')]);_0x3c5d0d[_0x620b('0x39')]=qs[_0x620b('0x2f')](_[_0x620b('0x3a')](_0xb45d75[_0x620b('0x2e')],_0x327417[_0x620b('0x2f')]),_0x3f7bf3);if(_0xb45d75['query'][_0x620b('0x3b')]){_0x3c5d0d[_0x620b('0x39')]=_[_0x620b('0x3c')](_0x3c5d0d[_0x620b('0x39')],{'$or':_[_0x620b('0x27')](_0x3f7bf3,function(_0x30de67){if(_0x30de67[_0x620b('0x2b')]!==_0x620b('0x3d')){var _0x15a83e={};_0x15a83e[_0x30de67[_0x620b('0x25')]]={'$like':'%'+_0xb45d75[_0x620b('0x2e')][_0x620b('0x3b')]+'%'};return _0x15a83e;}})});}_0x3c5d0d=_[_0x620b('0x3c')]({},_0x3c5d0d,_0xb45d75['options']);var _0x265905={'where':_0x3c5d0d[_0x620b('0x39')]};return db[_0x620b('0x28')][_0x620b('0x19')](_0x265905)[_0x620b('0x21')](function(_0x50b5c4){_0x532ca0[_0x620b('0x19')]=_0x50b5c4;if(_0xb45d75[_0x620b('0x2e')][_0x620b('0x3e')]){_0x3c5d0d[_0x620b('0x3f')]=[{'all':!![]}];}return db[_0x620b('0x28')][_0x620b('0x40')](_0x3c5d0d);})[_0x620b('0x21')](function(_0xdebfae){_0x532ca0['rows']=_0xdebfae;return _0x532ca0;})[_0x620b('0x21')](respondWithFilteredResult(_0x53d01c,_0x3c5d0d))[_0x620b('0x41')](handleError(_0x53d01c,null));};exports[_0x620b('0x42')]=function(_0x1eca35,_0x5d2571){var _0x596a9e={'raw':![],'where':{'id':_0x1eca35[_0x620b('0x43')]['id']}},_0x2962f8={};_0x2962f8['model']=_[_0x620b('0x2d')](db[_0x620b('0x28')][_0x620b('0x29')]);_0x2962f8[_0x620b('0x2e')]=_[_0x620b('0x2d')](_0x1eca35[_0x620b('0x2e')]);_0x2962f8['filters']=_['intersection'](_0x2962f8['model'],_0x2962f8[_0x620b('0x2e')]);_0x596a9e[_0x620b('0x33')]=_[_0x620b('0x30')](_0x2962f8[_0x620b('0x31')],qs[_0x620b('0x32')](_0x1eca35[_0x620b('0x2e')][_0x620b('0x32')]));_0x596a9e[_0x620b('0x33')]=_0x596a9e[_0x620b('0x33')][_0x620b('0x34')]?_0x596a9e['attributes']:_0x2962f8[_0x620b('0x31')];if(_0x1eca35[_0x620b('0x2e')][_0x620b('0x3e')]){_0x596a9e[_0x620b('0x3f')]=[{'all':!![]}];}_0x596a9e=_[_0x620b('0x3c')]({},_0x596a9e,_0x1eca35[_0x620b('0x44')]);return db[_0x620b('0x28')][_0x620b('0x45')](_0x596a9e)['then'](handleEntityNotFound(_0x5d2571,null))[_0x620b('0x21')](respondWithResult(_0x5d2571,null))[_0x620b('0x41')](handleError(_0x5d2571,null));};exports[_0x620b('0x46')]=function(_0xcc94f9,_0x132576){return db['Integration'][_0x620b('0x46')](_0xcc94f9[_0x620b('0x47')],{})['then'](respondWithResult(_0x132576,0xc9))[_0x620b('0x41')](handleError(_0x132576,null));};exports['update']=function(_0x2d4fde,_0x4c979e){if(_0x2d4fde[_0x620b('0x47')]['id']){delete _0x2d4fde[_0x620b('0x47')]['id'];}return db[_0x620b('0x28')][_0x620b('0x45')]({'where':{'id':_0x2d4fde[_0x620b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c979e,null))[_0x620b('0x21')](saveUpdates(_0x2d4fde[_0x620b('0x47')],null))[_0x620b('0x21')](respondWithResult(_0x4c979e,null))[_0x620b('0x41')](handleError(_0x4c979e,null));};exports['destroy']=function(_0x385282,_0x501610){return db[_0x620b('0x28')][_0x620b('0x45')]({'where':{'id':_0x385282[_0x620b('0x43')]['id']}})['then'](handleEntityNotFound(_0x501610,null))['then'](removeEntity(_0x501610,null))[_0x620b('0x41')](handleError(_0x501610,null));}; \ No newline at end of file +var _0xead5=['stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','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','json','apply','reject','save','update','then','destroy','end'];(function(_0x4e8288,_0x4ffcb2){var _0xc551f7=function(_0xd402de){while(--_0xd402de){_0x4e8288['push'](_0x4e8288['shift']());}};_0xc551f7(++_0x4ffcb2);}(_0xead5,0xbc));var _0x5ead=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xead5[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0x5ead('0x0'));var emlformat=require(_0x5ead('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5ead('0x2'));var jsonpatch=require(_0x5ead('0x3'));var rp=require(_0x5ead('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5ead('0x5'));var util=require(_0x5ead('0x6'));var path=require(_0x5ead('0x7'));var sox=require(_0x5ead('0x8'));var csv=require('to-csv');var ejs=require(_0x5ead('0x9'));var fs=require('fs');var _=require(_0x5ead('0xa'));var squel=require(_0x5ead('0xb'));var crypto=require(_0x5ead('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5ead('0xd'));var toCsv=require(_0x5ead('0xe'));var querystring=require(_0x5ead('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ead('0x10'));var authService=require(_0x5ead('0x11'));var qs=require(_0x5ead('0x12'));var as=require(_0x5ead('0x13'));var hardwareService=require(_0x5ead('0x14'));var logger=require('../../config/logger')(_0x5ead('0x15'));var utils=require(_0x5ead('0x16'));var config=require(_0x5ead('0x17'));var db=require(_0x5ead('0x18'))['db'];function respondWithStatusCode(_0x443527,_0x16984b){_0x16984b=_0x16984b||0xcc;return function(_0x3c78d0){if(_0x3c78d0){return _0x443527[_0x5ead('0x19')](_0x16984b);}return _0x443527[_0x5ead('0x1a')](_0x16984b)['end']();};}function respondWithResult(_0x1e8118,_0x19ed5b){_0x19ed5b=_0x19ed5b||0xc8;return function(_0x4a2496){if(_0x4a2496){return _0x1e8118['status'](_0x19ed5b)['json'](_0x4a2496);}};}function respondWithFilteredResult(_0x2c39b0,_0x19e5fe){return function(_0x2819f1){if(_0x2819f1){var _0x2867e2=_0x2819f1[_0x5ead('0x1b')],_0x98fe34=_0x19e5fe[_0x5ead('0x1c')],_0x19a5d7=_0x19e5fe[_0x5ead('0x1c')]+_0x19e5fe[_0x5ead('0x1d')],_0xe8e6b0;if(_0x19a5d7>=_0x2867e2){_0x19a5d7=_0x2867e2;_0xe8e6b0=0xc8;}else{_0xe8e6b0=0xce;}_0x2c39b0[_0x5ead('0x1a')](_0xe8e6b0);return _0x2c39b0[_0x5ead('0x1e')](_0x5ead('0x1f'),_0x98fe34+'-'+_0x19a5d7+'/'+_0x2867e2)[_0x5ead('0x20')](_0x2819f1);}return null;};}function patchUpdates(_0x467023){return function(_0x119b3e){try{jsonpatch[_0x5ead('0x21')](_0x119b3e,_0x467023,!![]);}catch(_0x4a2556){return BPromise[_0x5ead('0x22')](_0x4a2556);}return _0x119b3e[_0x5ead('0x23')]();};}function saveUpdates(_0x5d6cd1,_0x1ee8fb){return function(_0x45c3d1){if(_0x45c3d1){return _0x45c3d1[_0x5ead('0x24')](_0x5d6cd1)[_0x5ead('0x25')](function(_0x55eb39){return _0x55eb39;});}return null;};}function removeEntity(_0x39174c,_0x305e22){return function(_0x5bc714){if(_0x5bc714){return _0x5bc714[_0x5ead('0x26')]()[_0x5ead('0x25')](function(){_0x39174c[_0x5ead('0x1a')](0xcc)[_0x5ead('0x27')]();});}};}function handleEntityNotFound(_0x2ab4f9,_0x40c4a1){return function(_0x1a616a){if(!_0x1a616a){_0x2ab4f9['sendStatus'](0x194);}return _0x1a616a;};}function handleError(_0x2e3e55,_0x4ec8a1){_0x4ec8a1=_0x4ec8a1||0x1f4;return function(_0x39aca2){logger['error'](_0x39aca2[_0x5ead('0x28')]);if(_0x39aca2[_0x5ead('0x29')]){delete _0x39aca2[_0x5ead('0x29')];}_0x2e3e55['status'](_0x4ec8a1)[_0x5ead('0x2a')](_0x39aca2);};}exports[_0x5ead('0x2b')]=function(_0x29736b,_0x3ff832){var _0x443ec5={},_0x1f9690={},_0x2a9116={'count':0x0,'rows':[]};var _0x297f5d=_['map'](db[_0x5ead('0x2c')][_0x5ead('0x2d')],function(_0x258792){return{'name':_0x258792[_0x5ead('0x2e')],'type':_0x258792[_0x5ead('0x2f')]['key']};});_0x1f9690['model']=_[_0x5ead('0x30')](_0x297f5d,'name');_0x1f9690[_0x5ead('0x31')]=_[_0x5ead('0x32')](_0x29736b[_0x5ead('0x31')]);_0x1f9690[_0x5ead('0x33')]=_['intersection'](_0x1f9690[_0x5ead('0x34')],_0x1f9690[_0x5ead('0x31')]);_0x443ec5[_0x5ead('0x35')]=_[_0x5ead('0x36')](_0x1f9690['model'],qs[_0x5ead('0x37')](_0x29736b[_0x5ead('0x31')][_0x5ead('0x37')]));_0x443ec5[_0x5ead('0x35')]=_0x443ec5[_0x5ead('0x35')][_0x5ead('0x38')]?_0x443ec5[_0x5ead('0x35')]:_0x1f9690['model'];if(!_0x29736b[_0x5ead('0x31')][_0x5ead('0x39')]('nolimit')){_0x443ec5[_0x5ead('0x1d')]=qs[_0x5ead('0x1d')](_0x29736b[_0x5ead('0x31')][_0x5ead('0x1d')]);_0x443ec5['offset']=qs[_0x5ead('0x1c')](_0x29736b[_0x5ead('0x31')][_0x5ead('0x1c')]);}_0x443ec5[_0x5ead('0x3a')]=qs[_0x5ead('0x3b')](_0x29736b['query'][_0x5ead('0x3b')]);_0x443ec5[_0x5ead('0x3c')]=qs[_0x5ead('0x33')](_[_0x5ead('0x3d')](_0x29736b[_0x5ead('0x31')],_0x1f9690['filters']),_0x297f5d);if(_0x29736b[_0x5ead('0x31')][_0x5ead('0x3e')]){_0x443ec5[_0x5ead('0x3c')]=_['merge'](_0x443ec5[_0x5ead('0x3c')],{'$or':_[_0x5ead('0x30')](_0x297f5d,function(_0x58247){if(_0x58247[_0x5ead('0x2f')]!==_0x5ead('0x3f')){var _0x5b8b6c={};_0x5b8b6c[_0x58247[_0x5ead('0x29')]]={'$like':'%'+_0x29736b['query']['filter']+'%'};return _0x5b8b6c;}})});}_0x443ec5=_[_0x5ead('0x40')]({},_0x443ec5,_0x29736b[_0x5ead('0x41')]);var _0xbbb5f0={'where':_0x443ec5[_0x5ead('0x3c')]};return db[_0x5ead('0x2c')][_0x5ead('0x1b')](_0xbbb5f0)[_0x5ead('0x25')](function(_0x283176){_0x2a9116[_0x5ead('0x1b')]=_0x283176;if(_0x29736b[_0x5ead('0x31')]['includeAll']){_0x443ec5['include']=[{'all':!![]}];}return db[_0x5ead('0x2c')][_0x5ead('0x42')](_0x443ec5);})[_0x5ead('0x25')](function(_0x136766){_0x2a9116[_0x5ead('0x43')]=_0x136766;return _0x2a9116;})[_0x5ead('0x25')](respondWithFilteredResult(_0x3ff832,_0x443ec5))[_0x5ead('0x44')](handleError(_0x3ff832,null));};exports[_0x5ead('0x45')]=function(_0x162a64,_0x52c337){var _0x235687={'raw':![],'where':{'id':_0x162a64[_0x5ead('0x46')]['id']}},_0x34e06d={};_0x34e06d[_0x5ead('0x34')]=_['keys'](db['Integration'][_0x5ead('0x2d')]);_0x34e06d[_0x5ead('0x31')]=_[_0x5ead('0x32')](_0x162a64[_0x5ead('0x31')]);_0x34e06d[_0x5ead('0x33')]=_[_0x5ead('0x36')](_0x34e06d[_0x5ead('0x34')],_0x34e06d[_0x5ead('0x31')]);_0x235687[_0x5ead('0x35')]=_[_0x5ead('0x36')](_0x34e06d[_0x5ead('0x34')],qs[_0x5ead('0x37')](_0x162a64[_0x5ead('0x31')][_0x5ead('0x37')]));_0x235687[_0x5ead('0x35')]=_0x235687[_0x5ead('0x35')][_0x5ead('0x38')]?_0x235687[_0x5ead('0x35')]:_0x34e06d[_0x5ead('0x34')];if(_0x162a64[_0x5ead('0x31')][_0x5ead('0x47')]){_0x235687[_0x5ead('0x48')]=[{'all':!![]}];}_0x235687=_['merge']({},_0x235687,_0x162a64[_0x5ead('0x41')]);return db['Integration'][_0x5ead('0x49')](_0x235687)[_0x5ead('0x25')](handleEntityNotFound(_0x52c337,null))['then'](respondWithResult(_0x52c337,null))[_0x5ead('0x44')](handleError(_0x52c337,null));};exports[_0x5ead('0x4a')]=function(_0x19dbce,_0x43a8c2){return db[_0x5ead('0x2c')][_0x5ead('0x4a')](_0x19dbce[_0x5ead('0x4b')],{})['then'](respondWithResult(_0x43a8c2,0xc9))[_0x5ead('0x44')](handleError(_0x43a8c2,null));};exports[_0x5ead('0x24')]=function(_0x322fdc,_0x2bd7ee){if(_0x322fdc['body']['id']){delete _0x322fdc[_0x5ead('0x4b')]['id'];}return db[_0x5ead('0x2c')][_0x5ead('0x49')]({'where':{'id':_0x322fdc[_0x5ead('0x46')]['id']}})[_0x5ead('0x25')](handleEntityNotFound(_0x2bd7ee,null))[_0x5ead('0x25')](saveUpdates(_0x322fdc[_0x5ead('0x4b')],null))[_0x5ead('0x25')](respondWithResult(_0x2bd7ee,null))[_0x5ead('0x44')](handleError(_0x2bd7ee,null));};exports[_0x5ead('0x26')]=function(_0x326372,_0x2cad2a){return db['Integration']['find']({'where':{'id':_0x326372[_0x5ead('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cad2a,null))[_0x5ead('0x25')](removeEntity(_0x2cad2a,null))[_0x5ead('0x44')](handleError(_0x2cad2a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f1a75ad..5a91ba6 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 _0x2ef5=['../../config/environment','./integration.attributes','exports','define','Integration','lodash','util','request-promise','path','rimraf'];(function(_0x380a7c,_0x3713c8){var _0x3983f3=function(_0x3acc19){while(--_0x3acc19){_0x380a7c['push'](_0x380a7c['shift']());}};_0x3983f3(++_0x3713c8);}(_0x2ef5,0x1db));var _0x52ef=function(_0x210d95,_0x478cd5){_0x210d95=_0x210d95-0x0;var _0x561600=_0x2ef5[_0x210d95];return _0x561600;};'use strict';var _=require(_0x52ef('0x0'));var util=require(_0x52ef('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x52ef('0x2'));var fs=require('fs');var path=require(_0x52ef('0x3'));var rimraf=require(_0x52ef('0x4'));var config=require(_0x52ef('0x5'));var attributes=require(_0x52ef('0x6'));module[_0x52ef('0x7')]=function(_0x509054,_0x34639a){return _0x509054[_0x52ef('0x8')](_0x52ef('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30ba=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash'];(function(_0x524d60,_0x36663c){var _0x2caaf3=function(_0x237d5d){while(--_0x237d5d){_0x524d60['push'](_0x524d60['shift']());}};_0x2caaf3(++_0x36663c);}(_0x30ba,0x18b));var _0xa30b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x30ba[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xa30b('0x0'));var util=require(_0xa30b('0x1'));var logger=require('../../config/logger')(_0xa30b('0x2'));var moment=require('moment');var BPromise=require(_0xa30b('0x3'));var rp=require(_0xa30b('0x4'));var fs=require('fs');var path=require(_0xa30b('0x5'));var rimraf=require(_0xa30b('0x6'));var config=require(_0xa30b('0x7'));var attributes=require(_0xa30b('0x8'));module[_0xa30b('0x9')]=function(_0x1d5ab3,_0x55934c){return _0x1d5ab3['define'](_0xa30b('0xa'),attributes,{'tableName':_0xa30b('0xb'),'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 7e6b8b2..85f217e 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 _0x8ece=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8ece,0x195));var _0xe8ec=function(_0x5c8a11,_0x10805f){_0x5c8a11=_0x5c8a11-0x0;var _0x116b22=_0x8ece[_0x5c8a11];return _0x116b22;};'use strict';var _=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var moment=require(_0xe8ec('0x2'));var BPromise=require(_0xe8ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8ec('0x4'))['db'];var utils=require(_0xe8ec('0x5'));var logger=require(_0xe8ec('0x6'))(_0xe8ec('0x7'));var config=require(_0xe8ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe8ec('0x9')][_0xe8ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x64ed4c,_0x234b67,_0x3682cb){return new BPromise(function(_0x122f36,_0x406f7e){return client['request'](_0x64ed4c,_0x3682cb)[_0xe8ec('0xb')](function(_0x5e1fe9){logger[_0xe8ec('0xc')]('Integration,\x20%s,\x20%s',_0x234b67,_0xe8ec('0xd'));logger[_0xe8ec('0xe')](_0xe8ec('0xf'),_0x234b67,_0xe8ec('0xd'),JSON[_0xe8ec('0x10')](_0x5e1fe9));if(_0x5e1fe9[_0xe8ec('0x11')]){if(_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x12')]===0x1f4){logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);return _0x406f7e(_0x5e1fe9[_0xe8ec('0x11')]['message']);}logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);return _0x122f36(_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);}else{logger[_0xe8ec('0xc')](_0xe8ec('0x13'),_0x234b67,'request\x20sent');_0x122f36(_0x5e1fe9[_0xe8ec('0x15')][_0xe8ec('0x14')]);}})[_0xe8ec('0x16')](function(_0x50f8ed){logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x50f8ed);_0x406f7e(_0x50f8ed);});});} \ No newline at end of file +var _0x482d=['request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x49a276,_0x2c73d6){var _0x33dbb9=function(_0x4c0130){while(--_0x4c0130){_0x49a276['push'](_0x49a276['shift']());}};_0x33dbb9(++_0x2c73d6);}(_0x482d,0x16c));var _0xd482=function(_0x19a6b7,_0x488c30){_0x19a6b7=_0x19a6b7-0x0;var _0x42a703=_0x482d[_0x19a6b7];return _0x42a703;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd482('0x0'));var BPromise=require(_0xd482('0x1'));var rs=require(_0xd482('0x2'));var fs=require('fs');var Redis=require(_0xd482('0x3'));var db=require(_0xd482('0x4'))['db'];var utils=require(_0xd482('0x5'));var logger=require('../../config/logger')(_0xd482('0x6'));var config=require(_0xd482('0x7'));var jayson=require(_0xd482('0x8'));var client=jayson['client'][_0xd482('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d6b47,_0x5bfc0f,_0x478af5){return new BPromise(function(_0x144d7d,_0x74f369){return client[_0xd482('0xa')](_0x5d6b47,_0x478af5)['then'](function(_0x144d5b){logger[_0xd482('0xb')](_0xd482('0xc'),_0x5bfc0f,_0xd482('0xd'));logger[_0xd482('0xe')](_0xd482('0xf'),_0x5bfc0f,_0xd482('0xd'),JSON[_0xd482('0x10')](_0x144d5b));if(_0x144d5b['error']){if(_0x144d5b[_0xd482('0x11')][_0xd482('0x12')]===0x1f4){logger[_0xd482('0x11')](_0xd482('0xc'),_0x5bfc0f,_0x144d5b['error'][_0xd482('0x13')]);return _0x74f369(_0x144d5b[_0xd482('0x11')][_0xd482('0x13')]);}logger['error'](_0xd482('0xc'),_0x5bfc0f,_0x144d5b['error']['message']);return _0x144d7d(_0x144d5b[_0xd482('0x11')]['message']);}else{logger[_0xd482('0xb')](_0xd482('0xc'),_0x5bfc0f,'request\x20sent');_0x144d7d(_0x144d5b[_0xd482('0x14')][_0xd482('0x13')]);}})[_0xd482('0x15')](function(_0x2cc6e1){logger[_0xd482('0x11')]('Integration,\x20%s,\x20%s',_0x5bfc0f,_0x2cc6e1);_0x74f369(_0x2cc6e1);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index cf953bd..52328dc 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 _0x95fa=['show','post','create','update','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/:id'];(function(_0x23aabf,_0x552fa4){var _0x122c6e=function(_0x38ebff){while(--_0x38ebff){_0x23aabf['push'](_0x23aabf['shift']());}};_0x122c6e(++_0x552fa4);}(_0x95fa,0x196));var _0xa95f=function(_0x151c85,_0x2d21be){_0x151c85=_0x151c85-0x0;var _0x2db453=_0x95fa[_0x151c85];return _0x2db453;};'use strict';var multer=require(_0xa95f('0x0'));var util=require(_0xa95f('0x1'));var path=require('path');var timeout=require(_0xa95f('0x2'));var express=require('express');var router=express[_0xa95f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa95f('0x4'));var config=require(_0xa95f('0x5'));var controller=require(_0xa95f('0x6'));router[_0xa95f('0x7')]('/',auth[_0xa95f('0x8')](),controller['index']);router['get']('/describe',auth[_0xa95f('0x8')](),controller['describe']);router[_0xa95f('0x7')](_0xa95f('0x9'),auth[_0xa95f('0x8')](),controller[_0xa95f('0xa')]);router[_0xa95f('0xb')]('/',auth[_0xa95f('0x8')](),controller[_0xa95f('0xc')]);router['put']('/:id',auth[_0xa95f('0x8')](),controller[_0xa95f('0xd')]);router['delete'](_0xa95f('0x9'),auth[_0xa95f('0x8')](),controller[_0xa95f('0xe')]);module[_0xa95f('0xf')]=router; \ No newline at end of file +var _0x0a2c=['get','/describe','describe','/:id','show','post','isAuthenticated','create','put','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0a2c,0x1df));var _0xc0a2=function(_0x7acf4f,_0x3e7f15){_0x7acf4f=_0x7acf4f-0x0;var _0x2c911c=_0x0a2c[_0x7acf4f];return _0x2c911c;};'use strict';var multer=require(_0xc0a2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc0a2('0x1'));var express=require(_0xc0a2('0x2'));var router=express[_0xc0a2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc0a2('0x4'));var config=require(_0xc0a2('0x5'));var controller=require(_0xc0a2('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc0a2('0x7')](_0xc0a2('0x8'),auth['isAuthenticated'](),controller[_0xc0a2('0x9')]);router[_0xc0a2('0x7')](_0xc0a2('0xa'),auth['isAuthenticated'](),controller[_0xc0a2('0xb')]);router[_0xc0a2('0xc')]('/',auth[_0xc0a2('0xd')](),controller[_0xc0a2('0xe')]);router[_0xc0a2('0xf')](_0xc0a2('0xa'),auth[_0xc0a2('0xd')](),controller['update']);router['delete'](_0xc0a2('0xa'),auth[_0xc0a2('0xd')](),controller[_0xc0a2('0x10')]);module[_0xc0a2('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index cab2b6c..53d5c4d 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 _0xbf8a=['BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','STRING','INTEGER','DATE'];(function(_0xbb59c6,_0x47edc0){var _0x32b906=function(_0xc309c0){while(--_0xc309c0){_0xbb59c6['push'](_0xbb59c6['shift']());}};_0x32b906(++_0x47edc0);}(_0xbf8a,0x11d));var _0xabf8=function(_0x40ef50,_0x2f571d){_0x40ef50=_0x40ef50-0x0;var _0x544784=_0xbf8a[_0x40ef50];return _0x544784;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xabf8('0x0')]},'exitStatus':{'type':Sequelize[_0xabf8('0x0')]},'ticketId':{'type':Sequelize[_0xabf8('0x0')]},'integrationId':{'type':Sequelize[_0xabf8('0x1')]},'contacts':{'type':Sequelize[_0xabf8('0x0')]},'uniqueid':{'type':Sequelize[_0xabf8('0x0')]},'calleridnum':{'type':Sequelize[_0xabf8('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xabf8('0x0')]},'interface':{'type':Sequelize[_0xabf8('0x0')]},'membername':{'type':Sequelize[_0xabf8('0x0')]},'agentcalledAt':{'type':Sequelize[_0xabf8('0x2')]},'agentconnectAt':{'type':Sequelize[_0xabf8('0x2')]},'holdtime':{'type':Sequelize[_0xabf8('0x1')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xabf8('0x2')]},'talktime':{'type':Sequelize[_0xabf8('0x1')]},'agentacw':{'type':Sequelize[_0xabf8('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xabf8('0x0')]},'agentringnoanswer':{'type':Sequelize[_0xabf8('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xabf8('0x2')]},'lastevent':{'type':Sequelize[_0xabf8('0x0')]},'channel':{'type':Sequelize[_0xabf8('0x0')]},'channelstate':{'type':Sequelize[_0xabf8('0x1')]},'channelstatedesc':{'type':Sequelize[_0xabf8('0x0')]},'connectedlinenum':{'type':Sequelize[_0xabf8('0x0')]},'connectedlinename':{'type':Sequelize[_0xabf8('0x0')]},'language':{'type':Sequelize[_0xabf8('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xabf8('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xabf8('0x0')]},'destchannelstate':{'type':Sequelize[_0xabf8('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0xabf8('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xabf8('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xabf8('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xabf8('0x0')]},'destlanguage':{'type':Sequelize[_0xabf8('0x0')]},'destaccountcode':{'type':Sequelize[_0xabf8('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xabf8('0x0')]},'destuniqueid':{'type':Sequelize[_0xabf8('0x0')]},'messageId':{'type':Sequelize[_0xabf8('0x0')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xabf8('0x0')]},'from':{'type':Sequelize[_0xabf8('0x0')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xabf8('0x4')]},'html':{'type':Sequelize[_0xabf8('0x4')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xabf8('0x5')]('SENT',_0xabf8('0x6'),_0xabf8('0x7'),_0xabf8('0x8'))},'url':{'type':Sequelize[_0xabf8('0x0')]},'app':{'type':Sequelize[_0xabf8('0x0')]},'appdata':{'type':Sequelize[_0xabf8('0x0')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xccc8=['DATE','BOOLEAN','TEXT','ENUM','SENDING','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x1c14be,_0xf01911){var _0x4db556=function(_0xd755c9){while(--_0xd755c9){_0x1c14be['push'](_0x1c14be['shift']());}};_0x4db556(++_0xf01911);}(_0xccc8,0x178));var _0x8ccc=function(_0x3f940e,_0x140c3b){_0x3f940e=_0x3f940e-0x0;var _0x424b2e=_0xccc8[_0x3f940e];return _0x424b2e;};'use strict';var Sequelize=require(_0x8ccc('0x0'));module[_0x8ccc('0x1')]={'integration':{'type':Sequelize[_0x8ccc('0x2')]},'eventChannel':{'type':Sequelize[_0x8ccc('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x8ccc('0x2')]},'integrationId':{'type':Sequelize[_0x8ccc('0x3')]},'contacts':{'type':Sequelize[_0x8ccc('0x2')]},'uniqueid':{'type':Sequelize[_0x8ccc('0x2')]},'calleridnum':{'type':Sequelize[_0x8ccc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8ccc('0x2')]},'interface':{'type':Sequelize[_0x8ccc('0x2')]},'membername':{'type':Sequelize[_0x8ccc('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8ccc('0x4')]},'agentconnectAt':{'type':Sequelize[_0x8ccc('0x4')]},'holdtime':{'type':Sequelize[_0x8ccc('0x3')]},'agentcomplete':{'type':Sequelize[_0x8ccc('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x8ccc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x8ccc('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x8ccc('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8ccc('0x4')]},'agentdump':{'type':Sequelize[_0x8ccc('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8ccc('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8ccc('0x2')]},'channelstate':{'type':Sequelize[_0x8ccc('0x3')]},'channelstatedesc':{'type':Sequelize[_0x8ccc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8ccc('0x2')]},'connectedlinename':{'type':Sequelize[_0x8ccc('0x2')]},'language':{'type':Sequelize[_0x8ccc('0x2')]},'accountcode':{'type':Sequelize[_0x8ccc('0x2')]},'context':{'type':Sequelize[_0x8ccc('0x2')]},'exten':{'type':Sequelize[_0x8ccc('0x2')]},'priority':{'type':Sequelize[_0x8ccc('0x2')]},'destchannel':{'type':Sequelize[_0x8ccc('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8ccc('0x2')]},'destcalleridname':{'type':Sequelize[_0x8ccc('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x8ccc('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8ccc('0x2')]},'destcontext':{'type':Sequelize[_0x8ccc('0x2')]},'destexten':{'type':Sequelize[_0x8ccc('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x8ccc('0x2')]},'inReplyTo':{'type':Sequelize[_0x8ccc('0x2')]},'subject':{'type':Sequelize[_0x8ccc('0x2')]},'from':{'type':Sequelize[_0x8ccc('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x8ccc('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x8ccc('0x6')]},'text':{'type':Sequelize[_0x8ccc('0x6')]},'status':{'type':Sequelize[_0x8ccc('0x7')]('SENT',_0x8ccc('0x8'),'RECEIVED',_0x8ccc('0x9'))},'url':{'type':Sequelize[_0x8ccc('0x2')]},'app':{'type':Sequelize[_0x8ccc('0x2')]},'appdata':{'type':Sequelize[_0x8ccc('0x2')]},'projectId':{'type':Sequelize[_0x8ccc('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 71bf803..e6492dd 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 _0x737c=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','json','apply','save','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','IntegrationReport','includeAll','include','findAll','rows','show','find','catch','create','body','destroy','params','describe','html-pdf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x116482,_0x35ddae){var _0x56db37=function(_0xc3685c){while(--_0xc3685c){_0x116482['push'](_0x116482['shift']());}};_0x56db37(++_0x35ddae);}(_0x737c,0x11e));var _0xc737=function(_0x1b1dff,_0x4c2de2){_0x1b1dff=_0x1b1dff-0x0;var _0x280d9d=_0x737c[_0x1b1dff];return _0x280d9d;};'use strict';var pdf=require(_0xc737('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc737('0x1'));var moment=require(_0xc737('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc737('0x3'));var util=require(_0xc737('0x4'));var path=require(_0xc737('0x5'));var sox=require(_0xc737('0x6'));var csv=require(_0xc737('0x7'));var ejs=require(_0xc737('0x8'));var fs=require('fs');var _=require(_0xc737('0x9'));var squel=require(_0xc737('0xa'));var crypto=require(_0xc737('0xb'));var jsforce=require(_0xc737('0xc'));var deskjs=require(_0xc737('0xd'));var toCsv=require(_0xc737('0x7'));var querystring=require(_0xc737('0xe'));var Papa=require(_0xc737('0xf'));var Redis=require('ioredis');var authService=require(_0xc737('0x10'));var qs=require(_0xc737('0x11'));var as=require(_0xc737('0x12'));var hardwareService=require(_0xc737('0x13'));var logger=require(_0xc737('0x14'))('api');var utils=require(_0xc737('0x15'));var config=require(_0xc737('0x16'));var db=require(_0xc737('0x17'))['db'];function respondWithStatusCode(_0x2ddb6f,_0x453a32){_0x453a32=_0x453a32||0xcc;return function(_0x5ec203){if(_0x5ec203){return _0x2ddb6f[_0xc737('0x18')](_0x453a32);}return _0x2ddb6f[_0xc737('0x19')](_0x453a32)['end']();};}function respondWithResult(_0x498c18,_0x7c9c00){_0x7c9c00=_0x7c9c00||0xc8;return function(_0x38db5f){if(_0x38db5f){return _0x498c18['status'](_0x7c9c00)['json'](_0x38db5f);}};}function respondWithFilteredResult(_0x1aeac9,_0x1ff172){return function(_0x4dedd0){if(_0x4dedd0){var _0xe94c8b=_0x4dedd0[_0xc737('0x1a')],_0x573386=_0x1ff172[_0xc737('0x1b')],_0x276f72=_0x1ff172['offset']+_0x1ff172['limit'],_0x37bcc5;if(_0x276f72>=_0xe94c8b){_0x276f72=_0xe94c8b;_0x37bcc5=0xc8;}else{_0x37bcc5=0xce;}_0x1aeac9[_0xc737('0x19')](_0x37bcc5);return _0x1aeac9[_0xc737('0x1c')]('Content-Range',_0x573386+'-'+_0x276f72+'/'+_0xe94c8b)[_0xc737('0x1d')](_0x4dedd0);}return null;};}function patchUpdates(_0x221af0){return function(_0x71ebbf){try{jsonpatch[_0xc737('0x1e')](_0x71ebbf,_0x221af0,!![]);}catch(_0x14cb00){return BPromise['reject'](_0x14cb00);}return _0x71ebbf[_0xc737('0x1f')]();};}function saveUpdates(_0x3f4832,_0x3fdd7f){return function(_0xc001dc){if(_0xc001dc){return _0xc001dc[_0xc737('0x20')](_0x3f4832)[_0xc737('0x21')](function(_0x51eb99){return _0x51eb99;});}return null;};}function removeEntity(_0x5844fe,_0x53a555){return function(_0x1d8434){if(_0x1d8434){return _0x1d8434['destroy']()[_0xc737('0x21')](function(){_0x5844fe['status'](0xcc)[_0xc737('0x22')]();});}};}function handleEntityNotFound(_0x2c963a,_0x36b4a3){return function(_0x249f73){if(!_0x249f73){_0x2c963a[_0xc737('0x18')](0x194);}return _0x249f73;};}function handleError(_0x12d108,_0xbf9750){_0xbf9750=_0xbf9750||0x1f4;return function(_0x2e29fa){logger['error'](_0x2e29fa[_0xc737('0x23')]);if(_0x2e29fa[_0xc737('0x24')]){delete _0x2e29fa['name'];}_0x12d108[_0xc737('0x19')](_0xbf9750)[_0xc737('0x25')](_0x2e29fa);};}exports[_0xc737('0x26')]=function(_0x463a9f,_0x4563ed){var _0x3fe25f={},_0x54e40e={},_0x483687={'count':0x0,'rows':[]};var _0x3a9001=_[_0xc737('0x27')](db['IntegrationReport'][_0xc737('0x28')],function(_0x426d67){return{'name':_0x426d67[_0xc737('0x29')],'type':_0x426d67[_0xc737('0x2a')][_0xc737('0x2b')]};});_0x54e40e[_0xc737('0x2c')]=_[_0xc737('0x27')](_0x3a9001,'name');_0x54e40e['query']=_[_0xc737('0x2d')](_0x463a9f[_0xc737('0x2e')]);_0x54e40e[_0xc737('0x2f')]=_['intersection'](_0x54e40e['model'],_0x54e40e[_0xc737('0x2e')]);_0x3fe25f[_0xc737('0x30')]=_[_0xc737('0x31')](_0x54e40e['model'],qs[_0xc737('0x32')](_0x463a9f[_0xc737('0x2e')][_0xc737('0x32')]));_0x3fe25f['attributes']=_0x3fe25f['attributes'][_0xc737('0x33')]?_0x3fe25f[_0xc737('0x30')]:_0x54e40e[_0xc737('0x2c')];if(!_0x463a9f[_0xc737('0x2e')]['hasOwnProperty'](_0xc737('0x34'))){_0x3fe25f[_0xc737('0x35')]=qs[_0xc737('0x35')](_0x463a9f['query'][_0xc737('0x35')]);_0x3fe25f[_0xc737('0x1b')]=qs['offset'](_0x463a9f['query'][_0xc737('0x1b')]);}_0x3fe25f[_0xc737('0x36')]=qs[_0xc737('0x37')](_0x463a9f[_0xc737('0x2e')][_0xc737('0x37')]);_0x3fe25f[_0xc737('0x38')]=qs[_0xc737('0x2f')](_[_0xc737('0x39')](_0x463a9f[_0xc737('0x2e')],_0x54e40e[_0xc737('0x2f')]),_0x3a9001);if(_0x463a9f[_0xc737('0x2e')]['filter']){_0x3fe25f[_0xc737('0x38')]=_[_0xc737('0x3a')](_0x3fe25f[_0xc737('0x38')],{'$or':_[_0xc737('0x27')](_0x3a9001,function(_0x5b4583){if(_0x5b4583['type']!==_0xc737('0x3b')){var _0x5b2fbd={};_0x5b2fbd[_0x5b4583['name']]={'$like':'%'+_0x463a9f[_0xc737('0x2e')][_0xc737('0x3c')]+'%'};return _0x5b2fbd;}})});}_0x3fe25f=_[_0xc737('0x3a')]({},_0x3fe25f,_0x463a9f[_0xc737('0x3d')]);var _0x1f9daf={'where':_0x3fe25f[_0xc737('0x38')]};return db[_0xc737('0x3e')][_0xc737('0x1a')](_0x1f9daf)['then'](function(_0x4424bd){_0x483687[_0xc737('0x1a')]=_0x4424bd;if(_0x463a9f[_0xc737('0x2e')][_0xc737('0x3f')]){_0x3fe25f[_0xc737('0x40')]=[{'all':!![]}];}return db[_0xc737('0x3e')][_0xc737('0x41')](_0x3fe25f);})[_0xc737('0x21')](function(_0x211bfe){_0x483687[_0xc737('0x42')]=_0x211bfe;return _0x483687;})[_0xc737('0x21')](respondWithFilteredResult(_0x4563ed,_0x3fe25f))['catch'](handleError(_0x4563ed,null));};exports[_0xc737('0x43')]=function(_0x1b503a,_0x13c950){var _0x173745={'raw':![],'where':{'id':_0x1b503a['params']['id']}},_0x3e22a9={};_0x3e22a9['model']=_['keys'](db[_0xc737('0x3e')][_0xc737('0x28')]);_0x3e22a9[_0xc737('0x2e')]=_[_0xc737('0x2d')](_0x1b503a[_0xc737('0x2e')]);_0x3e22a9[_0xc737('0x2f')]=_[_0xc737('0x31')](_0x3e22a9['model'],_0x3e22a9[_0xc737('0x2e')]);_0x173745[_0xc737('0x30')]=_[_0xc737('0x31')](_0x3e22a9['model'],qs[_0xc737('0x32')](_0x1b503a['query']['fields']));_0x173745['attributes']=_0x173745[_0xc737('0x30')][_0xc737('0x33')]?_0x173745[_0xc737('0x30')]:_0x3e22a9[_0xc737('0x2c')];if(_0x1b503a[_0xc737('0x2e')][_0xc737('0x3f')]){_0x173745[_0xc737('0x40')]=[{'all':!![]}];}_0x173745=_[_0xc737('0x3a')]({},_0x173745,_0x1b503a['options']);return db[_0xc737('0x3e')][_0xc737('0x44')](_0x173745)[_0xc737('0x21')](handleEntityNotFound(_0x13c950,null))['then'](respondWithResult(_0x13c950,null))[_0xc737('0x45')](handleError(_0x13c950,null));};exports[_0xc737('0x46')]=function(_0xdc4195,_0x2b8e83){return db[_0xc737('0x3e')]['create'](_0xdc4195[_0xc737('0x47')],{})[_0xc737('0x21')](respondWithResult(_0x2b8e83,0xc9))[_0xc737('0x45')](handleError(_0x2b8e83,null));};exports['update']=function(_0x1115c8,_0xab9a28){if(_0x1115c8[_0xc737('0x47')]['id']){delete _0x1115c8[_0xc737('0x47')]['id'];}return db[_0xc737('0x3e')][_0xc737('0x44')]({'where':{'id':_0x1115c8['params']['id']}})['then'](handleEntityNotFound(_0xab9a28,null))[_0xc737('0x21')](saveUpdates(_0x1115c8[_0xc737('0x47')],null))[_0xc737('0x21')](respondWithResult(_0xab9a28,null))[_0xc737('0x45')](handleError(_0xab9a28,null));};exports[_0xc737('0x48')]=function(_0x5da7ef,_0x2e644a){return db['IntegrationReport'][_0xc737('0x44')]({'where':{'id':_0x5da7ef[_0xc737('0x49')]['id']}})[_0xc737('0x21')](handleEntityNotFound(_0x2e644a,null))[_0xc737('0x21')](removeEntity(_0x2e644a,null))[_0xc737('0x45')](handleError(_0x2e644a,null));};exports[_0xc737('0x4a')]=function(_0x2fa7b6,_0x3c7649){return db['IntegrationReport'][_0xc737('0x4a')]()['then'](respondWithResult(_0x3c7649,null))['catch'](handleError(_0x3c7649,null));}; \ No newline at end of file +var _0x7b88=['hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length'];(function(_0x2b4c94,_0x1bff38){var _0x4efce6=function(_0x525a43){while(--_0x525a43){_0x2b4c94['push'](_0x2b4c94['shift']());}};_0x4efce6(++_0x1bff38);}(_0x7b88,0x194));var _0x87b8=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x7b88[_0xaa1b3e];return _0x454d7d;};'use strict';var pdf=require(_0x87b8('0x0'));var emlformat=require(_0x87b8('0x1'));var rimraf=require(_0x87b8('0x2'));var zipdir=require(_0x87b8('0x3'));var jsonpatch=require(_0x87b8('0x4'));var rp=require(_0x87b8('0x5'));var moment=require('moment');var BPromise=require(_0x87b8('0x6'));var Mustache=require('mustache');var util=require(_0x87b8('0x7'));var path=require(_0x87b8('0x8'));var sox=require(_0x87b8('0x9'));var csv=require(_0x87b8('0xa'));var ejs=require(_0x87b8('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x87b8('0xc'));var crypto=require(_0x87b8('0xd'));var jsforce=require(_0x87b8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x87b8('0xa'));var querystring=require(_0x87b8('0xf'));var Papa=require('papaparse');var Redis=require(_0x87b8('0x10'));var authService=require(_0x87b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x87b8('0x12'));var hardwareService=require(_0x87b8('0x13'));var logger=require(_0x87b8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x87b8('0x15'));var db=require(_0x87b8('0x16'))['db'];function respondWithStatusCode(_0x21c1eb,_0x5947ea){_0x5947ea=_0x5947ea||0xcc;return function(_0x55d2eb){if(_0x55d2eb){return _0x21c1eb[_0x87b8('0x17')](_0x5947ea);}return _0x21c1eb[_0x87b8('0x18')](_0x5947ea)['end']();};}function respondWithResult(_0x197201,_0x4fe9fb){_0x4fe9fb=_0x4fe9fb||0xc8;return function(_0x3b943f){if(_0x3b943f){return _0x197201['status'](_0x4fe9fb)[_0x87b8('0x19')](_0x3b943f);}};}function respondWithFilteredResult(_0x16409f,_0x25a327){return function(_0x13032f){if(_0x13032f){var _0x2b703f=_0x13032f[_0x87b8('0x1a')],_0x5e9de4=_0x25a327['offset'],_0x380410=_0x25a327[_0x87b8('0x1b')]+_0x25a327['limit'],_0x3ee2a3;if(_0x380410>=_0x2b703f){_0x380410=_0x2b703f;_0x3ee2a3=0xc8;}else{_0x3ee2a3=0xce;}_0x16409f[_0x87b8('0x18')](_0x3ee2a3);return _0x16409f[_0x87b8('0x1c')]('Content-Range',_0x5e9de4+'-'+_0x380410+'/'+_0x2b703f)[_0x87b8('0x19')](_0x13032f);}return null;};}function patchUpdates(_0x5dbbf8){return function(_0x2d384e){try{jsonpatch[_0x87b8('0x1d')](_0x2d384e,_0x5dbbf8,!![]);}catch(_0x4ae199){return BPromise[_0x87b8('0x1e')](_0x4ae199);}return _0x2d384e[_0x87b8('0x1f')]();};}function saveUpdates(_0x3d054e,_0x5ce28e){return function(_0x34ad0b){if(_0x34ad0b){return _0x34ad0b[_0x87b8('0x20')](_0x3d054e)[_0x87b8('0x21')](function(_0x2e3b00){return _0x2e3b00;});}return null;};}function removeEntity(_0xf3f21,_0x20d8af){return function(_0x368230){if(_0x368230){return _0x368230['destroy']()[_0x87b8('0x21')](function(){_0xf3f21['status'](0xcc)[_0x87b8('0x22')]();});}};}function handleEntityNotFound(_0x596bb0,_0x2e7911){return function(_0x2a1443){if(!_0x2a1443){_0x596bb0['sendStatus'](0x194);}return _0x2a1443;};}function handleError(_0x425267,_0x43e63f){_0x43e63f=_0x43e63f||0x1f4;return function(_0x3840b0){logger[_0x87b8('0x23')](_0x3840b0[_0x87b8('0x24')]);if(_0x3840b0['name']){delete _0x3840b0[_0x87b8('0x25')];}_0x425267['status'](_0x43e63f)[_0x87b8('0x26')](_0x3840b0);};}exports[_0x87b8('0x27')]=function(_0x549135,_0x368594){var _0x3f80e5={},_0x1d071f={},_0x162941={'count':0x0,'rows':[]};var _0x431f52=_[_0x87b8('0x28')](db[_0x87b8('0x29')][_0x87b8('0x2a')],function(_0x3ff5e3){return{'name':_0x3ff5e3['fieldName'],'type':_0x3ff5e3[_0x87b8('0x2b')][_0x87b8('0x2c')]};});_0x1d071f[_0x87b8('0x2d')]=_[_0x87b8('0x28')](_0x431f52,_0x87b8('0x25'));_0x1d071f[_0x87b8('0x2e')]=_[_0x87b8('0x2f')](_0x549135['query']);_0x1d071f['filters']=_[_0x87b8('0x30')](_0x1d071f['model'],_0x1d071f[_0x87b8('0x2e')]);_0x3f80e5['attributes']=_[_0x87b8('0x30')](_0x1d071f[_0x87b8('0x2d')],qs[_0x87b8('0x31')](_0x549135[_0x87b8('0x2e')]['fields']));_0x3f80e5[_0x87b8('0x32')]=_0x3f80e5[_0x87b8('0x32')][_0x87b8('0x33')]?_0x3f80e5[_0x87b8('0x32')]:_0x1d071f['model'];if(!_0x549135['query'][_0x87b8('0x34')](_0x87b8('0x35'))){_0x3f80e5[_0x87b8('0x36')]=qs[_0x87b8('0x36')](_0x549135[_0x87b8('0x2e')][_0x87b8('0x36')]);_0x3f80e5['offset']=qs[_0x87b8('0x1b')](_0x549135[_0x87b8('0x2e')][_0x87b8('0x1b')]);}_0x3f80e5[_0x87b8('0x37')]=qs['sort'](_0x549135[_0x87b8('0x2e')][_0x87b8('0x38')]);_0x3f80e5[_0x87b8('0x39')]=qs[_0x87b8('0x3a')](_[_0x87b8('0x3b')](_0x549135['query'],_0x1d071f[_0x87b8('0x3a')]),_0x431f52);if(_0x549135['query'][_0x87b8('0x3c')]){_0x3f80e5['where']=_[_0x87b8('0x3d')](_0x3f80e5['where'],{'$or':_[_0x87b8('0x28')](_0x431f52,function(_0x3ee7b5){if(_0x3ee7b5[_0x87b8('0x2b')]!==_0x87b8('0x3e')){var _0x22d034={};_0x22d034[_0x3ee7b5[_0x87b8('0x25')]]={'$like':'%'+_0x549135['query']['filter']+'%'};return _0x22d034;}})});}_0x3f80e5=_[_0x87b8('0x3d')]({},_0x3f80e5,_0x549135['options']);var _0x2003f1={'where':_0x3f80e5[_0x87b8('0x39')]};return db[_0x87b8('0x29')][_0x87b8('0x1a')](_0x2003f1)[_0x87b8('0x21')](function(_0x27b5ed){_0x162941[_0x87b8('0x1a')]=_0x27b5ed;if(_0x549135[_0x87b8('0x2e')][_0x87b8('0x3f')]){_0x3f80e5['include']=[{'all':!![]}];}return db[_0x87b8('0x29')][_0x87b8('0x40')](_0x3f80e5);})[_0x87b8('0x21')](function(_0x4d2221){_0x162941[_0x87b8('0x41')]=_0x4d2221;return _0x162941;})[_0x87b8('0x21')](respondWithFilteredResult(_0x368594,_0x3f80e5))[_0x87b8('0x42')](handleError(_0x368594,null));};exports[_0x87b8('0x43')]=function(_0x3ac372,_0x276308){var _0x28feb0={'raw':![],'where':{'id':_0x3ac372[_0x87b8('0x44')]['id']}},_0x3ecf8f={};_0x3ecf8f[_0x87b8('0x2d')]=_[_0x87b8('0x2f')](db[_0x87b8('0x29')][_0x87b8('0x2a')]);_0x3ecf8f[_0x87b8('0x2e')]=_[_0x87b8('0x2f')](_0x3ac372[_0x87b8('0x2e')]);_0x3ecf8f[_0x87b8('0x3a')]=_[_0x87b8('0x30')](_0x3ecf8f[_0x87b8('0x2d')],_0x3ecf8f[_0x87b8('0x2e')]);_0x28feb0['attributes']=_[_0x87b8('0x30')](_0x3ecf8f['model'],qs[_0x87b8('0x31')](_0x3ac372[_0x87b8('0x2e')]['fields']));_0x28feb0[_0x87b8('0x32')]=_0x28feb0[_0x87b8('0x32')]['length']?_0x28feb0[_0x87b8('0x32')]:_0x3ecf8f[_0x87b8('0x2d')];if(_0x3ac372[_0x87b8('0x2e')][_0x87b8('0x3f')]){_0x28feb0[_0x87b8('0x45')]=[{'all':!![]}];}_0x28feb0=_[_0x87b8('0x3d')]({},_0x28feb0,_0x3ac372[_0x87b8('0x46')]);return db[_0x87b8('0x29')][_0x87b8('0x47')](_0x28feb0)[_0x87b8('0x21')](handleEntityNotFound(_0x276308,null))[_0x87b8('0x21')](respondWithResult(_0x276308,null))['catch'](handleError(_0x276308,null));};exports['create']=function(_0x38ee57,_0x5b72cc){return db[_0x87b8('0x29')][_0x87b8('0x48')](_0x38ee57[_0x87b8('0x49')],{})[_0x87b8('0x21')](respondWithResult(_0x5b72cc,0xc9))[_0x87b8('0x42')](handleError(_0x5b72cc,null));};exports['update']=function(_0x265658,_0x54ca09){if(_0x265658[_0x87b8('0x49')]['id']){delete _0x265658['body']['id'];}return db[_0x87b8('0x29')][_0x87b8('0x47')]({'where':{'id':_0x265658[_0x87b8('0x44')]['id']}})[_0x87b8('0x21')](handleEntityNotFound(_0x54ca09,null))[_0x87b8('0x21')](saveUpdates(_0x265658[_0x87b8('0x49')],null))[_0x87b8('0x21')](respondWithResult(_0x54ca09,null))['catch'](handleError(_0x54ca09,null));};exports[_0x87b8('0x4a')]=function(_0x5ca072,_0x487853){return db[_0x87b8('0x29')]['find']({'where':{'id':_0x5ca072[_0x87b8('0x44')]['id']}})[_0x87b8('0x21')](handleEntityNotFound(_0x487853,null))[_0x87b8('0x21')](removeEntity(_0x487853,null))['catch'](handleError(_0x487853,null));};exports[_0x87b8('0x4b')]=function(_0x2d8edd,_0x5d3378){return db[_0x87b8('0x29')]['describe']()['then'](respondWithResult(_0x5d3378,null))['catch'](handleError(_0x5d3378,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5338bb8..a618b35 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 _0x390d=['define','report_integration','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x390d,0x188));var _0xd390=function(_0x70fca0,_0x13e939){_0x70fca0=_0x70fca0-0x0;var _0x25d265=_0x390d[_0x70fca0];return _0x25d265;};'use strict';var _=require(_0xd390('0x0'));var util=require('util');var logger=require(_0xd390('0x1'))(_0xd390('0x2'));var moment=require(_0xd390('0x3'));var BPromise=require('bluebird');var rp=require(_0xd390('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd390('0x5'));var config=require(_0xd390('0x6'));var attributes=require(_0xd390('0x7'));module['exports']=function(_0x2a6c16,_0x29d416){return _0x2a6c16[_0xd390('0x8')]('IntegrationReport',attributes,{'tableName':_0xd390('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6398=['../../config/environment','exports','define','report_integration','util','api','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6398,0x90));var _0x8639=function(_0x540311,_0x53ca8b){_0x540311=_0x540311-0x0;var _0x56beef=_0x6398[_0x540311];return _0x56beef;};'use strict';var _=require('lodash');var util=require(_0x8639('0x0'));var logger=require('../../config/logger')(_0x8639('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8639('0x2'));var rimraf=require('rimraf');var config=require(_0x8639('0x3'));var attributes=require('./integrationReport.attributes');module[_0x8639('0x4')]=function(_0x3f056a,_0x37b7d5){return _0x3f056a[_0x8639('0x5')]('IntegrationReport',attributes,{'tableName':_0x8639('0x6'),'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 e414349..43f160c 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 _0xb7e7=['IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x340010,_0x3aecdd){var _0x59be2a=function(_0x2c6704){while(--_0x2c6704){_0x340010['push'](_0x340010['shift']());}};_0x59be2a(++_0x3aecdd);}(_0xb7e7,0x121));var _0x7b7e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xb7e7[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0x9ffd=['IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x586f85,_0x57e85e){var _0x5ffa49=function(_0x3ab859){while(--_0x3ab859){_0x586f85['push'](_0x586f85['shift']());}};_0x5ffa49(++_0x57e85e);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x48fb90,_0x45f6f3){_0x48fb90=_0x48fb90-0x0;var _0x192ead=_0x9ffd[_0x48fb90];return _0x192ead;};'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']('IntegrationReport,\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')]('IntegrationReport,\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')]('IntegrationReport,\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/interval/index.js b/server/api/interval/index.js index ed9be1d..dece33b 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x55ca,0x126));var _0xa55c=function(_0x44caf2,_0x8ffb16){_0x44caf2=_0x44caf2-0x0;var _0x25978d=_0x55ca[_0x44caf2];return _0x25978d;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./interval.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller['addInterval']);router[_0x7995('0xe')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('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 80d0f44..dab6f6f 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 _0x26be=['STRING'];(function(_0x456759,_0x51bd2f){var _0x3f9662=function(_0xc0d965){while(--_0xc0d965){_0x456759['push'](_0x456759['shift']());}};_0x3f9662(++_0x51bd2f);}(_0x26be,0x104));var _0xe26b=function(_0x4184da,_0x5c5a9b){_0x4184da=_0x4184da-0x0;var _0x5b3c97=_0x26be[_0x4184da];return _0x5b3c97;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe26b('0x0')]},'description':{'type':Sequelize[_0xe26b('0x0')]},'interval':{'type':Sequelize[_0xe26b('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0xe8cc=['STRING','exports'];(function(_0x23189e,_0x3c013e){var _0x752182=function(_0x4b678c){while(--_0x4b678c){_0x23189e['push'](_0x23189e['shift']());}};_0x752182(++_0x3c013e);}(_0xe8cc,0xfd));var _0xce8c=function(_0x584bcc,_0x117ee6){_0x584bcc=_0x584bcc-0x0;var _0x39dc0a=_0xe8cc[_0x584bcc];return _0x39dc0a;};'use strict';var Sequelize=require('sequelize');module[_0xce8c('0x0')]={'name':{'type':Sequelize[_0xce8c('0x1')]},'description':{'type':Sequelize[_0xce8c('0x1')]},'interval':{'type':Sequelize[_0xce8c('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index d0b7115..4b17c7c 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 _0x954c=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','IntervalId','getIntervals','findOne','filter','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','then','destroy','get','Intervals','UserProfileResource','error','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','count','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find'];(function(_0x240860,_0x20c04d){var _0x40e288=function(_0x38a753){while(--_0x38a753){_0x240860['push'](_0x240860['shift']());}};_0x40e288(++_0x20c04d);}(_0x954c,0x69));var _0xc954=function(_0x482523,_0x3063ec){_0x482523=_0x482523-0x0;var _0x4223b6=_0x954c[_0x482523];return _0x4223b6;};'use strict';var pdf=require(_0xc954('0x0'));var emlformat=require(_0xc954('0x1'));var rimraf=require(_0xc954('0x2'));var zipdir=require(_0xc954('0x3'));var jsonpatch=require(_0xc954('0x4'));var rp=require(_0xc954('0x5'));var moment=require(_0xc954('0x6'));var BPromise=require(_0xc954('0x7'));var Mustache=require('mustache');var util=require(_0xc954('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc954('0x9'));var ejs=require(_0xc954('0xa'));var fs=require('fs');var _=require(_0xc954('0xb'));var squel=require(_0xc954('0xc'));var crypto=require(_0xc954('0xd'));var jsforce=require(_0xc954('0xe'));var deskjs=require(_0xc954('0xf'));var toCsv=require(_0xc954('0x9'));var querystring=require(_0xc954('0x10'));var Papa=require('papaparse');var Redis=require(_0xc954('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc954('0x12'));var as=require(_0xc954('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc954('0x14'));var utils=require(_0xc954('0x15'));var config=require(_0xc954('0x16'));var db=require(_0xc954('0x17'))['db'];var extensions=require(_0xc954('0x18'));function respondWithStatusCode(_0x4494ba,_0x4512ab){_0x4512ab=_0x4512ab||0xcc;return function(_0x3a08f2){if(_0x3a08f2){return _0x4494ba[_0xc954('0x19')](_0x4512ab);}return _0x4494ba[_0xc954('0x1a')](_0x4512ab)[_0xc954('0x1b')]();};}function respondWithResult(_0x3d0098,_0xca60e){_0xca60e=_0xca60e||0xc8;return function(_0x4f5eea){if(_0x4f5eea){return _0x3d0098['status'](_0xca60e)['json'](_0x4f5eea);}};}function respondWithFilteredResult(_0x1c6d85,_0x52d41b){return function(_0x240ef0){if(_0x240ef0){var _0x4338fd=_0x240ef0['count'],_0x5cc9a1=_0x52d41b[_0xc954('0x1c')],_0x5ceb4f=_0x52d41b[_0xc954('0x1c')]+_0x52d41b[_0xc954('0x1d')],_0x571d2a;if(_0x5ceb4f>=_0x4338fd){_0x5ceb4f=_0x4338fd;_0x571d2a=0xc8;}else{_0x571d2a=0xce;}_0x1c6d85[_0xc954('0x1a')](_0x571d2a);return _0x1c6d85[_0xc954('0x1e')](_0xc954('0x1f'),_0x5cc9a1+'-'+_0x5ceb4f+'/'+_0x4338fd)[_0xc954('0x20')](_0x240ef0);}return null;};}function patchUpdates(_0x1c575a){return function(_0x8810f1){try{jsonpatch[_0xc954('0x21')](_0x8810f1,_0x1c575a,!![]);}catch(_0x5b453c){return BPromise['reject'](_0x5b453c);}return _0x8810f1['save']();};}function saveUpdates(_0x136188,_0x43ea9b){return function(_0x55644b){if(_0x55644b){return _0x55644b['update'](_0x136188)[_0xc954('0x22')](function(_0x103580){return _0x103580;});}return null;};}function removeEntity(_0x53acb4,_0x5f18e4){return function(_0x3fba80){if(_0x3fba80){return _0x3fba80[_0xc954('0x23')]()[_0xc954('0x22')](function(){var _0x5f4d36=_0x3fba80[_0xc954('0x24')]({'plain':!![]});var _0x4cd498=_0xc954('0x25');return db[_0xc954('0x26')]['destroy']({'where':{'type':_0x4cd498,'resourceId':_0x5f4d36['id']}})[_0xc954('0x22')](function(){return _0x3fba80;});})['then'](function(){_0x53acb4[_0xc954('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35af6e,_0x365dba){return function(_0x10e477){if(!_0x10e477){_0x35af6e[_0xc954('0x19')](0x194);}return _0x10e477;};}function handleError(_0x42ffb1,_0x4146b0){_0x4146b0=_0x4146b0||0x1f4;return function(_0x5b2967){logger[_0xc954('0x27')](_0x5b2967['stack']);if(_0x5b2967[_0xc954('0x28')]){delete _0x5b2967['name'];}_0x42ffb1[_0xc954('0x1a')](_0x4146b0)[_0xc954('0x29')](_0x5b2967);};}exports[_0xc954('0x2a')]=function(_0x31f070,_0x384d71){var _0x30a288={},_0x560542={},_0x5afa11={'count':0x0,'rows':[]};var _0x17ed68=_[_0xc954('0x2b')](db[_0xc954('0x2c')]['rawAttributes'],function(_0x7386e9){return{'name':_0x7386e9[_0xc954('0x2d')],'type':_0x7386e9[_0xc954('0x2e')][_0xc954('0x2f')]};});_0x560542[_0xc954('0x30')]=_[_0xc954('0x2b')](_0x17ed68,_0xc954('0x28'));_0x560542[_0xc954('0x31')]=_[_0xc954('0x32')](_0x31f070[_0xc954('0x31')]);_0x560542[_0xc954('0x33')]=_['intersection'](_0x560542[_0xc954('0x30')],_0x560542[_0xc954('0x31')]);_0x30a288['attributes']=_[_0xc954('0x34')](_0x560542['model'],qs[_0xc954('0x35')](_0x31f070[_0xc954('0x31')][_0xc954('0x35')]));_0x30a288[_0xc954('0x36')]=_0x30a288[_0xc954('0x36')][_0xc954('0x37')]?_0x30a288[_0xc954('0x36')]:_0x560542[_0xc954('0x30')];if(!_0x31f070[_0xc954('0x31')][_0xc954('0x38')](_0xc954('0x39'))){_0x30a288['limit']=qs['limit'](_0x31f070[_0xc954('0x31')][_0xc954('0x1d')]);_0x30a288[_0xc954('0x1c')]=qs[_0xc954('0x1c')](_0x31f070[_0xc954('0x31')][_0xc954('0x1c')]);}_0x30a288[_0xc954('0x3a')]=qs[_0xc954('0x3b')](_0x31f070[_0xc954('0x31')][_0xc954('0x3b')]);_0x30a288[_0xc954('0x3c')]=qs[_0xc954('0x33')](_[_0xc954('0x3d')](_0x31f070[_0xc954('0x31')],_0x560542[_0xc954('0x33')]),_0x17ed68);if(_0x31f070[_0xc954('0x31')]['filter']){_0x30a288[_0xc954('0x3c')]=_['merge'](_0x30a288['where'],{'$or':_[_0xc954('0x2b')](_0x17ed68,function(_0x400150){if(_0x400150[_0xc954('0x2e')]!==_0xc954('0x3e')){var _0x125fd8={};_0x125fd8[_0x400150[_0xc954('0x28')]]={'$like':'%'+_0x31f070[_0xc954('0x31')]['filter']+'%'};return _0x125fd8;}})});}_0x30a288=_[_0xc954('0x3f')]({},_0x30a288,_0x31f070[_0xc954('0x40')]);var _0x5c8eda={'where':_0x30a288[_0xc954('0x3c')]};return db[_0xc954('0x2c')][_0xc954('0x41')](_0x5c8eda)[_0xc954('0x22')](function(_0x1d34ca){_0x5afa11[_0xc954('0x41')]=_0x1d34ca;if(_0x31f070[_0xc954('0x31')]['includeAll']){_0x30a288['include']=[{'all':!![]}];}return db[_0xc954('0x2c')][_0xc954('0x42')](_0x30a288);})['then'](function(_0x429b06){_0x5afa11[_0xc954('0x43')]=_0x429b06;return _0x5afa11;})[_0xc954('0x22')](respondWithFilteredResult(_0x384d71,_0x30a288))[_0xc954('0x44')](handleError(_0x384d71,null));};exports[_0xc954('0x45')]=function(_0xe817a0,_0x39de10){var _0x19edc7={'raw':!![],'where':{'id':_0xe817a0[_0xc954('0x46')]['id']}},_0x30768f={};_0x30768f[_0xc954('0x30')]=_[_0xc954('0x32')](db[_0xc954('0x2c')][_0xc954('0x47')]);_0x30768f[_0xc954('0x31')]=_[_0xc954('0x32')](_0xe817a0[_0xc954('0x31')]);_0x30768f[_0xc954('0x33')]=_['intersection'](_0x30768f[_0xc954('0x30')],_0x30768f[_0xc954('0x31')]);_0x19edc7[_0xc954('0x36')]=_['intersection'](_0x30768f[_0xc954('0x30')],qs['fields'](_0xe817a0[_0xc954('0x31')]['fields']));_0x19edc7[_0xc954('0x36')]=_0x19edc7['attributes'][_0xc954('0x37')]?_0x19edc7[_0xc954('0x36')]:_0x30768f[_0xc954('0x30')];if(_0xe817a0[_0xc954('0x31')][_0xc954('0x48')]){_0x19edc7[_0xc954('0x49')]=[{'all':!![]}];}_0x19edc7=_['merge']({},_0x19edc7,_0xe817a0[_0xc954('0x40')]);return db['Interval'][_0xc954('0x4a')](_0x19edc7)[_0xc954('0x22')](handleEntityNotFound(_0x39de10,null))['then'](respondWithResult(_0x39de10,null))[_0xc954('0x44')](handleError(_0x39de10,null));};exports['create']=function(_0x4e75e5,_0x52cb21){return db[_0xc954('0x2c')][_0xc954('0x4b')](_0x4e75e5[_0xc954('0x4c')],{})[_0xc954('0x22')](function(_0xa8189b){var _0xaccda6=_0x4e75e5['user']['get']({'plain':!![]});if(!_0xaccda6)throw new Error(_0xc954('0x4d'));if(_0xaccda6[_0xc954('0x4e')]==='user'){var _0x184549=_0xa8189b['get']({'plain':!![]});var _0xf85ad=_0xc954('0x25');return db[_0xc954('0x4f')][_0xc954('0x4a')]({'where':{'name':_0xf85ad,'userProfileId':_0xaccda6[_0xc954('0x50')]},'raw':!![]})[_0xc954('0x22')](function(_0x4caf17){if(_0x4caf17&&_0x4caf17[_0xc954('0x51')]===0x0){return db[_0xc954('0x26')][_0xc954('0x4b')]({'name':_0x184549['name'],'resourceId':_0x184549['id'],'type':_0x4caf17[_0xc954('0x28')],'sectionId':_0x4caf17['id']},{})[_0xc954('0x22')](function(){return _0xa8189b;});}else{return _0xa8189b;}})[_0xc954('0x44')](function(_0x36f5d7){logger[_0xc954('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36f5d7);throw _0x36f5d7;});}return _0xa8189b;})['then'](respondWithResult(_0x52cb21,0xc9))[_0xc954('0x44')](handleError(_0x52cb21,null));};exports[_0xc954('0x52')]=function(_0x5283ce,_0x275762){if(_0x5283ce[_0xc954('0x4c')]['id']){delete _0x5283ce[_0xc954('0x4c')]['id'];}return db[_0xc954('0x2c')][_0xc954('0x4a')]({'where':{'id':_0x5283ce['params']['id']}})[_0xc954('0x22')](handleEntityNotFound(_0x275762,null))['then'](saveUpdates(_0x5283ce[_0xc954('0x4c')],null))[_0xc954('0x22')](respondWithResult(_0x275762,null))[_0xc954('0x44')](handleError(_0x275762,null));};exports['destroy']=function(_0x416921,_0x13e063){return db[_0xc954('0x2c')]['find']({'where':{'id':_0x416921[_0xc954('0x46')]['id']}})['then'](handleEntityNotFound(_0x13e063,null))['then'](removeEntity(_0x13e063,null))[_0xc954('0x44')](handleError(_0x13e063,null));};exports['addInterval']=function(_0x43749d,_0x5488f6,_0x13d560){if(_0x43749d[_0xc954('0x4c')]['id']){delete _0x43749d[_0xc954('0x4c')]['id'];}return db['Interval'][_0xc954('0x4a')]({'where':{'id':_0x43749d[_0xc954('0x46')]['id']}})['then'](handleEntityNotFound(_0x5488f6,null))[_0xc954('0x22')](function(_0x3f239c){if(_0x3f239c){_0x43749d['body'][_0xc954('0x53')]=_0x3f239c['id'];return db[_0xc954('0x2c')][_0xc954('0x4b')](_0x43749d[_0xc954('0x4c')]);}})[_0xc954('0x22')](respondWithResult(_0x5488f6,null))[_0xc954('0x44')](handleError(_0x5488f6,null));};exports[_0xc954('0x54')]=function(_0x4d1e3a,_0x4c7bc8,_0x54af40){var _0x9183c1={};var _0x5e36b0={};var _0x15dadf;var _0x4c22f2;return db[_0xc954('0x2c')][_0xc954('0x55')]({'where':{'id':_0x4d1e3a[_0xc954('0x46')]['id']}})[_0xc954('0x22')](handleEntityNotFound(_0x4c7bc8,null))[_0xc954('0x22')](function(_0x59ec96){if(_0x59ec96){_0x15dadf=_0x59ec96;_0x5e36b0[_0xc954('0x30')]=_[_0xc954('0x32')](db[_0xc954('0x2c')][_0xc954('0x47')]);_0x5e36b0[_0xc954('0x31')]=_[_0xc954('0x32')](_0x4d1e3a[_0xc954('0x31')]);_0x5e36b0['filters']=_[_0xc954('0x34')](_0x5e36b0[_0xc954('0x30')],_0x5e36b0[_0xc954('0x31')]);_0x9183c1[_0xc954('0x36')]=_[_0xc954('0x34')](_0x5e36b0[_0xc954('0x30')],qs['fields'](_0x4d1e3a['query']['fields']));_0x9183c1[_0xc954('0x36')]=_0x9183c1['attributes']['length']?_0x9183c1[_0xc954('0x36')]:_0x5e36b0[_0xc954('0x30')];_0x9183c1['order']=qs[_0xc954('0x3b')](_0x4d1e3a['query'][_0xc954('0x3b')]);_0x9183c1[_0xc954('0x3c')]=qs[_0xc954('0x33')](_[_0xc954('0x3d')](_0x4d1e3a['query'],_0x5e36b0['filters']));if(_0x4d1e3a[_0xc954('0x31')][_0xc954('0x56')]){_0x9183c1[_0xc954('0x3c')]=_['merge'](_0x9183c1[_0xc954('0x3c')],{'$or':_[_0xc954('0x2b')](_0x9183c1[_0xc954('0x36')],function(_0x3e29ad){var _0x1a4e2b={};_0x1a4e2b[_0x3e29ad]={'$like':'%'+_0x4d1e3a[_0xc954('0x31')][_0xc954('0x56')]+'%'};return _0x1a4e2b;})});}_0x9183c1=_[_0xc954('0x3f')]({},_0x9183c1,_0x4d1e3a[_0xc954('0x40')]);return _0x15dadf[_0xc954('0x54')](_0x9183c1);}})[_0xc954('0x22')](function(_0x5dd627){if(_0x5dd627){_0x4c22f2=_0x5dd627['length'];if(!_0x4d1e3a[_0xc954('0x31')][_0xc954('0x38')]('nolimit')){_0x9183c1['limit']=qs[_0xc954('0x1d')](_0x4d1e3a['query'][_0xc954('0x1d')]);_0x9183c1['offset']=qs[_0xc954('0x1c')](_0x4d1e3a[_0xc954('0x31')]['offset']);}return _0x15dadf[_0xc954('0x54')](_0x9183c1);}})[_0xc954('0x22')](function(_0x361ee6){if(_0x361ee6){return _0x361ee6?{'count':_0x4c22f2,'rows':_0x361ee6}:null;}})[_0xc954('0x22')](respondWithResult(_0x4c7bc8,null))[_0xc954('0x44')](handleError(_0x4c7bc8,null));};exports['addIntervals']=function(_0x566798,_0x146621,_0x17a594){return db[_0xc954('0x2c')]['findOne']({'where':{'id':_0x566798[_0xc954('0x46')]['id']}})[_0xc954('0x22')](handleEntityNotFound(_0x146621,null))['then'](function(_0x283455){if(_0x283455){return db[_0xc954('0x57')][_0xc954('0x58')](function(_0xa423e1){return db[_0xc954('0x2c')][_0xc954('0x23')]({'where':{'IntervalId':_0x566798[_0xc954('0x46')]['id']},'transaction':_0xa423e1})[_0xc954('0x22')](function(_0x276ca1){var _0xcd7fe=_['map'](_0x566798[_0xc954('0x4c')],function(_0x550342){delete _0x550342['id'];_0x550342[_0xc954('0x53')]=_0x566798[_0xc954('0x46')]['id'];return _0x550342;});return db[_0xc954('0x2c')][_0xc954('0x59')](_0xcd7fe,{'transaction':_0xa423e1});});})[_0xc954('0x22')](function(){return db[_0xc954('0x2c')][_0xc954('0x42')]({'where':{'IntervalId':_0x566798[_0xc954('0x46')]['id']}});});}})['then'](respondWithResult(_0x146621,null))['catch'](handleError(_0x146621,null));}; \ No newline at end of file +var _0x7385=['show','params','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','body','addInterval','IntervalId','getIntervals','findOne','pick','nolimit','addIntervals','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','merge','filter','options','Interval','includeAll','include','findAll','rows','catch'];(function(_0x5eb83e,_0x386039){var _0x2ba972=function(_0x324087){while(--_0x324087){_0x5eb83e['push'](_0x5eb83e['shift']());}};_0x2ba972(++_0x386039);}(_0x7385,0x1ca));var _0x5738=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7385[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0x5738('0x0'));var emlformat=require(_0x5738('0x1'));var rimraf=require(_0x5738('0x2'));var zipdir=require(_0x5738('0x3'));var jsonpatch=require(_0x5738('0x4'));var rp=require(_0x5738('0x5'));var moment=require(_0x5738('0x6'));var BPromise=require(_0x5738('0x7'));var Mustache=require(_0x5738('0x8'));var util=require('util');var path=require(_0x5738('0x9'));var sox=require('sox');var csv=require(_0x5738('0xa'));var ejs=require(_0x5738('0xb'));var fs=require('fs');var _=require(_0x5738('0xc'));var squel=require('squel');var crypto=require(_0x5738('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5738('0xe'));var toCsv=require(_0x5738('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5738('0xf'));var qs=require(_0x5738('0x10'));var as=require(_0x5738('0x11'));var hardwareService=require(_0x5738('0x12'));var logger=require(_0x5738('0x13'))(_0x5738('0x14'));var utils=require(_0x5738('0x15'));var config=require(_0x5738('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x5738('0x17'));function respondWithStatusCode(_0x126d9b,_0x3d46ef){_0x3d46ef=_0x3d46ef||0xcc;return function(_0x4a358b){if(_0x4a358b){return _0x126d9b[_0x5738('0x18')](_0x3d46ef);}return _0x126d9b[_0x5738('0x19')](_0x3d46ef)['end']();};}function respondWithResult(_0x29253f,_0x57f7be){_0x57f7be=_0x57f7be||0xc8;return function(_0x40533c){if(_0x40533c){return _0x29253f['status'](_0x57f7be)[_0x5738('0x1a')](_0x40533c);}};}function respondWithFilteredResult(_0x318350,_0x5d5440){return function(_0x54b1c5){if(_0x54b1c5){var _0x42d552=_0x54b1c5[_0x5738('0x1b')],_0x557acf=_0x5d5440[_0x5738('0x1c')],_0x31d7cb=_0x5d5440['offset']+_0x5d5440[_0x5738('0x1d')],_0x88fd0a;if(_0x31d7cb>=_0x42d552){_0x31d7cb=_0x42d552;_0x88fd0a=0xc8;}else{_0x88fd0a=0xce;}_0x318350[_0x5738('0x19')](_0x88fd0a);return _0x318350[_0x5738('0x1e')](_0x5738('0x1f'),_0x557acf+'-'+_0x31d7cb+'/'+_0x42d552)[_0x5738('0x1a')](_0x54b1c5);}return null;};}function patchUpdates(_0x526c3b){return function(_0x2de36e){try{jsonpatch['apply'](_0x2de36e,_0x526c3b,!![]);}catch(_0x32ad19){return BPromise[_0x5738('0x20')](_0x32ad19);}return _0x2de36e[_0x5738('0x21')]();};}function saveUpdates(_0x4db63c,_0x5f4179){return function(_0x42a14f){if(_0x42a14f){return _0x42a14f[_0x5738('0x22')](_0x4db63c)[_0x5738('0x23')](function(_0x31ccc4){return _0x31ccc4;});}return null;};}function removeEntity(_0x58a719,_0x539892){return function(_0x510065){if(_0x510065){return _0x510065[_0x5738('0x24')]()[_0x5738('0x23')](function(){var _0x4e4cbd=_0x510065[_0x5738('0x25')]({'plain':!![]});var _0x451304=_0x5738('0x26');return db[_0x5738('0x27')][_0x5738('0x24')]({'where':{'type':_0x451304,'resourceId':_0x4e4cbd['id']}})[_0x5738('0x23')](function(){return _0x510065;});})['then'](function(){_0x58a719[_0x5738('0x19')](0xcc)[_0x5738('0x28')]();});}};}function handleEntityNotFound(_0x56b66b,_0x557a5b){return function(_0x173c4c){if(!_0x173c4c){_0x56b66b['sendStatus'](0x194);}return _0x173c4c;};}function handleError(_0x53b58d,_0x20f2d5){_0x20f2d5=_0x20f2d5||0x1f4;return function(_0x459b5e){logger[_0x5738('0x29')](_0x459b5e[_0x5738('0x2a')]);if(_0x459b5e[_0x5738('0x2b')]){delete _0x459b5e[_0x5738('0x2b')];}_0x53b58d[_0x5738('0x19')](_0x20f2d5)[_0x5738('0x2c')](_0x459b5e);};}exports[_0x5738('0x2d')]=function(_0x2707fa,_0x105d0f){var _0x29a7a2={},_0x236f1d={},_0x2a3c79={'count':0x0,'rows':[]};var _0x37b3ff=_[_0x5738('0x2e')](db['Interval'][_0x5738('0x2f')],function(_0x47f4b0){return{'name':_0x47f4b0[_0x5738('0x30')],'type':_0x47f4b0[_0x5738('0x31')]['key']};});_0x236f1d['model']=_['map'](_0x37b3ff,_0x5738('0x2b'));_0x236f1d['query']=_[_0x5738('0x32')](_0x2707fa[_0x5738('0x33')]);_0x236f1d[_0x5738('0x34')]=_[_0x5738('0x35')](_0x236f1d[_0x5738('0x36')],_0x236f1d[_0x5738('0x33')]);_0x29a7a2[_0x5738('0x37')]=_[_0x5738('0x35')](_0x236f1d[_0x5738('0x36')],qs['fields'](_0x2707fa[_0x5738('0x33')][_0x5738('0x38')]));_0x29a7a2['attributes']=_0x29a7a2[_0x5738('0x37')][_0x5738('0x39')]?_0x29a7a2[_0x5738('0x37')]:_0x236f1d['model'];if(!_0x2707fa['query'][_0x5738('0x3a')]('nolimit')){_0x29a7a2['limit']=qs[_0x5738('0x1d')](_0x2707fa['query'][_0x5738('0x1d')]);_0x29a7a2[_0x5738('0x1c')]=qs[_0x5738('0x1c')](_0x2707fa[_0x5738('0x33')][_0x5738('0x1c')]);}_0x29a7a2['order']=qs[_0x5738('0x3b')](_0x2707fa[_0x5738('0x33')]['sort']);_0x29a7a2['where']=qs[_0x5738('0x34')](_['pick'](_0x2707fa[_0x5738('0x33')],_0x236f1d[_0x5738('0x34')]),_0x37b3ff);if(_0x2707fa[_0x5738('0x33')]['filter']){_0x29a7a2[_0x5738('0x3c')]=_[_0x5738('0x3d')](_0x29a7a2['where'],{'$or':_[_0x5738('0x2e')](_0x37b3ff,function(_0x150d5a){if(_0x150d5a[_0x5738('0x31')]!=='VIRTUAL'){var _0x5c274b={};_0x5c274b[_0x150d5a[_0x5738('0x2b')]]={'$like':'%'+_0x2707fa['query'][_0x5738('0x3e')]+'%'};return _0x5c274b;}})});}_0x29a7a2=_[_0x5738('0x3d')]({},_0x29a7a2,_0x2707fa[_0x5738('0x3f')]);var _0x3f38e1={'where':_0x29a7a2['where']};return db[_0x5738('0x40')]['count'](_0x3f38e1)['then'](function(_0x52bb35){_0x2a3c79['count']=_0x52bb35;if(_0x2707fa['query'][_0x5738('0x41')]){_0x29a7a2[_0x5738('0x42')]=[{'all':!![]}];}return db['Interval'][_0x5738('0x43')](_0x29a7a2);})['then'](function(_0x1f861d){_0x2a3c79[_0x5738('0x44')]=_0x1f861d;return _0x2a3c79;})[_0x5738('0x23')](respondWithFilteredResult(_0x105d0f,_0x29a7a2))[_0x5738('0x45')](handleError(_0x105d0f,null));};exports[_0x5738('0x46')]=function(_0x153239,_0x4d5159){var _0x5c28c4={'raw':!![],'where':{'id':_0x153239[_0x5738('0x47')]['id']}},_0x4d1031={};_0x4d1031[_0x5738('0x36')]=_[_0x5738('0x32')](db['Interval']['rawAttributes']);_0x4d1031[_0x5738('0x33')]=_['keys'](_0x153239[_0x5738('0x33')]);_0x4d1031[_0x5738('0x34')]=_[_0x5738('0x35')](_0x4d1031[_0x5738('0x36')],_0x4d1031[_0x5738('0x33')]);_0x5c28c4[_0x5738('0x37')]=_[_0x5738('0x35')](_0x4d1031[_0x5738('0x36')],qs['fields'](_0x153239[_0x5738('0x33')][_0x5738('0x38')]));_0x5c28c4[_0x5738('0x37')]=_0x5c28c4[_0x5738('0x37')][_0x5738('0x39')]?_0x5c28c4['attributes']:_0x4d1031['model'];if(_0x153239[_0x5738('0x33')][_0x5738('0x41')]){_0x5c28c4[_0x5738('0x42')]=[{'all':!![]}];}_0x5c28c4=_['merge']({},_0x5c28c4,_0x153239[_0x5738('0x3f')]);return db['Interval']['find'](_0x5c28c4)[_0x5738('0x23')](handleEntityNotFound(_0x4d5159,null))[_0x5738('0x23')](respondWithResult(_0x4d5159,null))[_0x5738('0x45')](handleError(_0x4d5159,null));};exports[_0x5738('0x48')]=function(_0x24f06b,_0x4a9443){return db['Interval'][_0x5738('0x48')](_0x24f06b['body'],{})[_0x5738('0x23')](function(_0x27f637){var _0x4af419=_0x24f06b[_0x5738('0x49')]['get']({'plain':!![]});if(!_0x4af419)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4af419[_0x5738('0x4a')]===_0x5738('0x49')){var _0xed003d=_0x27f637[_0x5738('0x25')]({'plain':!![]});var _0x2e0064=_0x5738('0x26');return db[_0x5738('0x4b')][_0x5738('0x4c')]({'where':{'name':_0x2e0064,'userProfileId':_0x4af419[_0x5738('0x4d')]},'raw':!![]})[_0x5738('0x23')](function(_0x16f2d2){if(_0x16f2d2&&_0x16f2d2[_0x5738('0x4e')]===0x0){return db['UserProfileResource'][_0x5738('0x48')]({'name':_0xed003d['name'],'resourceId':_0xed003d['id'],'type':_0x16f2d2['name'],'sectionId':_0x16f2d2['id']},{})[_0x5738('0x23')](function(){return _0x27f637;});}else{return _0x27f637;}})[_0x5738('0x45')](function(_0x36672d){logger[_0x5738('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36672d);throw _0x36672d;});}return _0x27f637;})[_0x5738('0x23')](respondWithResult(_0x4a9443,0xc9))[_0x5738('0x45')](handleError(_0x4a9443,null));};exports[_0x5738('0x22')]=function(_0x32abf2,_0x32e64e){if(_0x32abf2[_0x5738('0x4f')]['id']){delete _0x32abf2[_0x5738('0x4f')]['id'];}return db[_0x5738('0x40')][_0x5738('0x4c')]({'where':{'id':_0x32abf2[_0x5738('0x47')]['id']}})[_0x5738('0x23')](handleEntityNotFound(_0x32e64e,null))[_0x5738('0x23')](saveUpdates(_0x32abf2['body'],null))[_0x5738('0x23')](respondWithResult(_0x32e64e,null))['catch'](handleError(_0x32e64e,null));};exports[_0x5738('0x24')]=function(_0x575ea8,_0xeeca4e){return db[_0x5738('0x40')][_0x5738('0x4c')]({'where':{'id':_0x575ea8[_0x5738('0x47')]['id']}})['then'](handleEntityNotFound(_0xeeca4e,null))[_0x5738('0x23')](removeEntity(_0xeeca4e,null))['catch'](handleError(_0xeeca4e,null));};exports[_0x5738('0x50')]=function(_0x55a8d9,_0x4dc03f,_0x755ee4){if(_0x55a8d9['body']['id']){delete _0x55a8d9['body']['id'];}return db['Interval']['find']({'where':{'id':_0x55a8d9[_0x5738('0x47')]['id']}})['then'](handleEntityNotFound(_0x4dc03f,null))['then'](function(_0x4df2c3){if(_0x4df2c3){_0x55a8d9[_0x5738('0x4f')][_0x5738('0x51')]=_0x4df2c3['id'];return db[_0x5738('0x40')][_0x5738('0x48')](_0x55a8d9['body']);}})[_0x5738('0x23')](respondWithResult(_0x4dc03f,null))[_0x5738('0x45')](handleError(_0x4dc03f,null));};exports[_0x5738('0x52')]=function(_0x359e80,_0x12fbf9,_0x3b0e56){var _0x4d5c6a={};var _0x28f4d4={};var _0x5df6c4;var _0x25a836;return db[_0x5738('0x40')][_0x5738('0x53')]({'where':{'id':_0x359e80[_0x5738('0x47')]['id']}})[_0x5738('0x23')](handleEntityNotFound(_0x12fbf9,null))[_0x5738('0x23')](function(_0x472488){if(_0x472488){_0x5df6c4=_0x472488;_0x28f4d4[_0x5738('0x36')]=_[_0x5738('0x32')](db['Interval'][_0x5738('0x2f')]);_0x28f4d4[_0x5738('0x33')]=_['keys'](_0x359e80[_0x5738('0x33')]);_0x28f4d4[_0x5738('0x34')]=_[_0x5738('0x35')](_0x28f4d4['model'],_0x28f4d4[_0x5738('0x33')]);_0x4d5c6a['attributes']=_['intersection'](_0x28f4d4[_0x5738('0x36')],qs[_0x5738('0x38')](_0x359e80[_0x5738('0x33')][_0x5738('0x38')]));_0x4d5c6a[_0x5738('0x37')]=_0x4d5c6a[_0x5738('0x37')][_0x5738('0x39')]?_0x4d5c6a[_0x5738('0x37')]:_0x28f4d4[_0x5738('0x36')];_0x4d5c6a['order']=qs['sort'](_0x359e80['query'][_0x5738('0x3b')]);_0x4d5c6a[_0x5738('0x3c')]=qs['filters'](_[_0x5738('0x54')](_0x359e80['query'],_0x28f4d4[_0x5738('0x34')]));if(_0x359e80[_0x5738('0x33')]['filter']){_0x4d5c6a['where']=_['merge'](_0x4d5c6a['where'],{'$or':_[_0x5738('0x2e')](_0x4d5c6a[_0x5738('0x37')],function(_0x2ad8cf){var _0x4ffd16={};_0x4ffd16[_0x2ad8cf]={'$like':'%'+_0x359e80[_0x5738('0x33')][_0x5738('0x3e')]+'%'};return _0x4ffd16;})});}_0x4d5c6a=_[_0x5738('0x3d')]({},_0x4d5c6a,_0x359e80[_0x5738('0x3f')]);return _0x5df6c4[_0x5738('0x52')](_0x4d5c6a);}})[_0x5738('0x23')](function(_0x2a74ce){if(_0x2a74ce){_0x25a836=_0x2a74ce[_0x5738('0x39')];if(!_0x359e80[_0x5738('0x33')][_0x5738('0x3a')](_0x5738('0x55'))){_0x4d5c6a['limit']=qs[_0x5738('0x1d')](_0x359e80[_0x5738('0x33')][_0x5738('0x1d')]);_0x4d5c6a[_0x5738('0x1c')]=qs['offset'](_0x359e80[_0x5738('0x33')]['offset']);}return _0x5df6c4['getIntervals'](_0x4d5c6a);}})['then'](function(_0x415479){if(_0x415479){return _0x415479?{'count':_0x25a836,'rows':_0x415479}:null;}})[_0x5738('0x23')](respondWithResult(_0x12fbf9,null))[_0x5738('0x45')](handleError(_0x12fbf9,null));};exports[_0x5738('0x56')]=function(_0x635fb8,_0x46ca21,_0x3259a0){return db[_0x5738('0x40')][_0x5738('0x53')]({'where':{'id':_0x635fb8[_0x5738('0x47')]['id']}})['then'](handleEntityNotFound(_0x46ca21,null))[_0x5738('0x23')](function(_0x1af777){if(_0x1af777){return db['sequelize']['transaction'](function(_0x1d4a4a){return db[_0x5738('0x40')]['destroy']({'where':{'IntervalId':_0x635fb8['params']['id']},'transaction':_0x1d4a4a})[_0x5738('0x23')](function(_0x1ccefa){var _0x192a33=_[_0x5738('0x2e')](_0x635fb8[_0x5738('0x4f')],function(_0x288a42){delete _0x288a42['id'];_0x288a42[_0x5738('0x51')]=_0x635fb8['params']['id'];return _0x288a42;});return db[_0x5738('0x40')][_0x5738('0x57')](_0x192a33,{'transaction':_0x1d4a4a});});})['then'](function(){return db['Interval'][_0x5738('0x43')]({'where':{'IntervalId':_0x635fb8[_0x5738('0x47')]['id']}});});}})[_0x5738('0x23')](respondWithResult(_0x46ca21,null))[_0x5738('0x45')](handleError(_0x46ca21,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 03f2c5e..ffd8a3a 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 _0x95af=['rimraf','../../config/environment','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x26c26c,_0x39f9cf){var _0x153b04=function(_0x57aa87){while(--_0x57aa87){_0x26c26c['push'](_0x26c26c['shift']());}};_0x153b04(++_0x39f9cf);}(_0x95af,0x173));var _0xf95a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x95af[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xf95a('0x0'));var util=require(_0xf95a('0x1'));var logger=require('../../config/logger')(_0xf95a('0x2'));var moment=require(_0xf95a('0x3'));var BPromise=require(_0xf95a('0x4'));var rp=require(_0xf95a('0x5'));var fs=require('fs');var path=require(_0xf95a('0x6'));var rimraf=require(_0xf95a('0x7'));var config=require(_0xf95a('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0xf95a('0x9'));module['exports']=function(_0xaa15ba,_0x576610){return _0xaa15ba[_0xf95a('0xa')](_0xf95a('0xb'),attributes,{'tableName':_0xf95a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x48d314,_0x474d95){extensions[_0xf95a('0xd')](_0xaa15ba,_0x48d314);},'afterBulkCreate':function(_0x5afd05,_0x1e5aa3,_0x49656e){_0x49656e();extensions[_0xf95a('0xd')](_0xaa15ba,_0x5afd05[0x0]);},'afterUpdate':function(_0x1058b6,_0x2a24bd){extensions[_0xf95a('0xd')](_0xaa15ba,_0x1058b6);},'afterDestroy':function(_0x442f20,_0xf221e4){extensions[_0xf95a('0xd')](_0xaa15ba,_0x442f20);}}});}; \ No newline at end of file +var _0x3ae9=['Interval','tools_intervals','rewrite','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','define'];(function(_0x40b7c8,_0x184ab8){var _0x4c39a3=function(_0x2ccbe8){while(--_0x2ccbe8){_0x40b7c8['push'](_0x40b7c8['shift']());}};_0x4c39a3(++_0x184ab8);}(_0x3ae9,0xdb));var _0x93ae=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x3ae9[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x93ae('0x0'))(_0x93ae('0x1'));var moment=require(_0x93ae('0x2'));var BPromise=require('bluebird');var rp=require(_0x93ae('0x3'));var fs=require('fs');var path=require(_0x93ae('0x4'));var rimraf=require(_0x93ae('0x5'));var config=require(_0x93ae('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0x93ae('0x7'));module['exports']=function(_0x3a9a9c,_0x32564c){return _0x3a9a9c[_0x93ae('0x8')](_0x93ae('0x9'),attributes,{'tableName':_0x93ae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x354bf9,_0x57d1f6){extensions[_0x93ae('0xb')](_0x3a9a9c,_0x354bf9);},'afterBulkCreate':function(_0x4ac4b0,_0x52fd48,_0x5a373a){_0x5a373a();extensions[_0x93ae('0xb')](_0x3a9a9c,_0x4ac4b0[0x0]);},'afterUpdate':function(_0x7eb772,_0x2d0afa){extensions[_0x93ae('0xb')](_0x3a9a9c,_0x7eb772);},'afterDestroy':function(_0x2d9be2,_0x3a5011){extensions['rewrite'](_0x3a9a9c,_0x2d9be2);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 3357569..88cafe2 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 _0x7ef9=['GetInterval','Interval','options','where','include','map','model','attributes','ShowInterval','find','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1ee16,_0xcdebe6){var _0x2cd332=function(_0x527db8){while(--_0x527db8){_0x1ee16['push'](_0x1ee16['shift']());}};_0x2cd332(++_0xcdebe6);}(_0x7ef9,0x1eb));var _0x97ef=function(_0x33b4f7,_0x16f341){_0x33b4f7=_0x33b4f7-0x0;var _0x199990=_0x7ef9[_0x33b4f7];return _0x199990;};'use strict';var _=require(_0x97ef('0x0'));var util=require(_0x97ef('0x1'));var moment=require(_0x97ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x97ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x97ef('0x5'))(_0x97ef('0x6'));var config=require(_0x97ef('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1429f2,_0x5246d7,_0x54a21e){return new BPromise(function(_0x1601ba,_0x4ae86d){return client[_0x97ef('0x8')](_0x1429f2,_0x54a21e)[_0x97ef('0x9')](function(_0x19eb52){logger[_0x97ef('0xa')](_0x97ef('0xb'),_0x5246d7,_0x97ef('0xc'));logger[_0x97ef('0xd')](_0x97ef('0xe'),_0x5246d7,_0x97ef('0xc'),JSON[_0x97ef('0xf')](_0x19eb52));if(_0x19eb52[_0x97ef('0x10')]){if(_0x19eb52[_0x97ef('0x10')]['code']===0x1f4){logger['error'](_0x97ef('0xb'),_0x5246d7,_0x19eb52['error']['message']);return _0x4ae86d(_0x19eb52['error']['message']);}logger[_0x97ef('0x10')](_0x97ef('0xb'),_0x5246d7,_0x19eb52[_0x97ef('0x10')][_0x97ef('0x11')]);return _0x1601ba(_0x19eb52[_0x97ef('0x10')][_0x97ef('0x11')]);}else{logger['info'](_0x97ef('0xb'),_0x5246d7,_0x97ef('0xc'));_0x1601ba(_0x19eb52['result'][_0x97ef('0x11')]);}})[_0x97ef('0x12')](function(_0x454c30){logger[_0x97ef('0x10')](_0x97ef('0xb'),_0x5246d7,_0x454c30);_0x4ae86d(_0x454c30);});});}exports[_0x97ef('0x13')]=function(_0x14d311){var _0x2020ef=this;return new Promise(function(_0x2c0031,_0x214ee5){return db[_0x97ef('0x14')]['findAll']({'raw':_0x14d311[_0x97ef('0x15')]?_0x14d311[_0x97ef('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x14d311[_0x97ef('0x15')]?_0x14d311[_0x97ef('0x15')][_0x97ef('0x16')]||null:null,'attributes':_0x14d311[_0x97ef('0x15')]?_0x14d311['options']['attributes']||null:null,'limit':_0x14d311[_0x97ef('0x15')]?_0x14d311[_0x97ef('0x15')]['limit']||null:null,'include':_0x14d311[_0x97ef('0x15')]?_0x14d311['options'][_0x97ef('0x17')]?_[_0x97ef('0x18')](_0x14d311['options']['include'],function(_0x4ab2a6){return{'model':db[_0x4ab2a6[_0x97ef('0x19')]],'as':_0x4ab2a6['as'],'attributes':_0x4ab2a6[_0x97ef('0x1a')],'include':_0x4ab2a6[_0x97ef('0x17')]?_['map'](_0x4ab2a6[_0x97ef('0x17')],function(_0x6fff10){return{'model':db[_0x6fff10[_0x97ef('0x19')]],'as':_0x6fff10['as'],'attributes':_0x6fff10[_0x97ef('0x1a')],'include':_0x6fff10[_0x97ef('0x17')]?_[_0x97ef('0x18')](_0x6fff10[_0x97ef('0x17')],function(_0x1a2e52){return{'model':db[_0x1a2e52[_0x97ef('0x19')]],'as':_0x1a2e52['as'],'attributes':_0x1a2e52[_0x97ef('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x97ef('0x9')](function(_0x273c1e){logger['info']('GetInterval',_0x14d311);logger[_0x97ef('0xd')](_0x97ef('0x13'),_0x14d311,JSON[_0x97ef('0xf')](_0x273c1e));_0x2c0031(_0x273c1e);})['catch'](function(_0x31b6f6){logger['error'](_0x97ef('0x13'),_0x31b6f6[_0x97ef('0x11')],_0x14d311);_0x214ee5(_0x2020ef[_0x97ef('0x10')](0x1f4,_0x31b6f6[_0x97ef('0x11')]));});});};exports[_0x97ef('0x1b')]=function(_0x1ec7e2){var _0x4f1ff0=this;return new Promise(function(_0x478935,_0x389668){return db[_0x97ef('0x14')][_0x97ef('0x1c')]({'raw':_0x1ec7e2['options']?_0x1ec7e2[_0x97ef('0x15')][_0x97ef('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ec7e2['options']?_0x1ec7e2['options'][_0x97ef('0x16')]||null:null,'attributes':_0x1ec7e2[_0x97ef('0x15')]?_0x1ec7e2['options'][_0x97ef('0x1a')]||null:null,'include':_0x1ec7e2[_0x97ef('0x15')]?_0x1ec7e2['options'][_0x97ef('0x17')]?_[_0x97ef('0x18')](_0x1ec7e2[_0x97ef('0x15')][_0x97ef('0x17')],function(_0x2cbf01){return{'model':db[_0x2cbf01[_0x97ef('0x19')]],'as':_0x2cbf01['as'],'attributes':_0x2cbf01['attributes'],'include':_0x2cbf01[_0x97ef('0x17')]?_['map'](_0x2cbf01['include'],function(_0x48ccf2){return{'model':db[_0x48ccf2['model']],'as':_0x48ccf2['as'],'attributes':_0x48ccf2[_0x97ef('0x1a')],'include':_0x48ccf2[_0x97ef('0x17')]?_[_0x97ef('0x18')](_0x48ccf2['include'],function(_0x36ee39){return{'model':db[_0x36ee39[_0x97ef('0x19')]],'as':_0x36ee39['as'],'attributes':_0x36ee39[_0x97ef('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x97ef('0x9')](function(_0x2805ee){logger['info'](_0x97ef('0x1b'),_0x1ec7e2);logger['debug']('ShowInterval',_0x1ec7e2,JSON[_0x97ef('0xf')](_0x2805ee));_0x478935(_0x2805ee);})['catch'](function(_0x412508){logger[_0x97ef('0x10')]('ShowInterval',_0x412508['message'],_0x1ec7e2);_0x389668(_0x4f1ff0[_0x97ef('0x10')](0x1f4,_0x412508[_0x97ef('0x11')]));});});}; \ No newline at end of file +var _0x58ca=['catch','ShowInterval','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Interval','findAll','options','raw','where','attributes','limit','include','map','model','GetInterval','debug'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x58ca,0x1a7));var _0xa58c=function(_0x394d87,_0x37c157){_0x394d87=_0x394d87-0x0;var _0x20bec8=_0x58ca[_0x394d87];return _0x20bec8;};'use strict';var _=require(_0xa58c('0x0'));var util=require(_0xa58c('0x1'));var moment=require(_0xa58c('0x2'));var BPromise=require(_0xa58c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa58c('0x4'));var db=require(_0xa58c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa58c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa58c('0x7'));var client=jayson[_0xa58c('0x8')][_0xa58c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44507e,_0x334878,_0xf8691b){return new BPromise(function(_0x535880,_0x120853){return client['request'](_0x44507e,_0xf8691b)[_0xa58c('0xa')](function(_0x406d39){logger[_0xa58c('0xb')](_0xa58c('0xc'),_0x334878,_0xa58c('0xd'));logger['debug'](_0xa58c('0xe'),_0x334878,_0xa58c('0xd'),JSON[_0xa58c('0xf')](_0x406d39));if(_0x406d39[_0xa58c('0x10')]){if(_0x406d39[_0xa58c('0x10')][_0xa58c('0x11')]===0x1f4){logger[_0xa58c('0x10')](_0xa58c('0xc'),_0x334878,_0x406d39[_0xa58c('0x10')][_0xa58c('0x12')]);return _0x120853(_0x406d39[_0xa58c('0x10')][_0xa58c('0x12')]);}logger[_0xa58c('0x10')](_0xa58c('0xc'),_0x334878,_0x406d39[_0xa58c('0x10')]['message']);return _0x535880(_0x406d39[_0xa58c('0x10')][_0xa58c('0x12')]);}else{logger[_0xa58c('0xb')]('Interval,\x20%s,\x20%s',_0x334878,_0xa58c('0xd'));_0x535880(_0x406d39[_0xa58c('0x13')][_0xa58c('0x12')]);}})['catch'](function(_0x1ba3b5){logger['error'](_0xa58c('0xc'),_0x334878,_0x1ba3b5);_0x120853(_0x1ba3b5);});});}exports['GetInterval']=function(_0x432960){var _0x12c624=this;return new Promise(function(_0x5048b6,_0x15f180){return db[_0xa58c('0x14')][_0xa58c('0x15')]({'raw':_0x432960[_0xa58c('0x16')]?_0x432960[_0xa58c('0x16')][_0xa58c('0x17')]===undefined?!![]:![]:!![],'where':_0x432960[_0xa58c('0x16')]?_0x432960[_0xa58c('0x16')][_0xa58c('0x18')]||null:null,'attributes':_0x432960[_0xa58c('0x16')]?_0x432960[_0xa58c('0x16')][_0xa58c('0x19')]||null:null,'limit':_0x432960['options']?_0x432960[_0xa58c('0x16')][_0xa58c('0x1a')]||null:null,'include':_0x432960[_0xa58c('0x16')]?_0x432960[_0xa58c('0x16')][_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0x432960[_0xa58c('0x16')][_0xa58c('0x1b')],function(_0x2ae956){return{'model':db[_0x2ae956['model']],'as':_0x2ae956['as'],'attributes':_0x2ae956[_0xa58c('0x19')],'include':_0x2ae956[_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0x2ae956[_0xa58c('0x1b')],function(_0x5d0abc){return{'model':db[_0x5d0abc[_0xa58c('0x1d')]],'as':_0x5d0abc['as'],'attributes':_0x5d0abc['attributes'],'include':_0x5d0abc['include']?_[_0xa58c('0x1c')](_0x5d0abc[_0xa58c('0x1b')],function(_0xf97143){return{'model':db[_0xf97143[_0xa58c('0x1d')]],'as':_0xf97143['as'],'attributes':_0xf97143[_0xa58c('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa58c('0xa')](function(_0x3841e6){logger[_0xa58c('0xb')](_0xa58c('0x1e'),_0x432960);logger[_0xa58c('0x1f')](_0xa58c('0x1e'),_0x432960,JSON['stringify'](_0x3841e6));_0x5048b6(_0x3841e6);})[_0xa58c('0x20')](function(_0x1a2dd2){logger['error'](_0xa58c('0x1e'),_0x1a2dd2[_0xa58c('0x12')],_0x432960);_0x15f180(_0x12c624[_0xa58c('0x10')](0x1f4,_0x1a2dd2[_0xa58c('0x12')]));});});};exports[_0xa58c('0x21')]=function(_0x869a9c){var _0x354f69=this;return new Promise(function(_0x4da2d4,_0x50fda3){return db[_0xa58c('0x14')][_0xa58c('0x22')]({'raw':_0x869a9c[_0xa58c('0x16')]?_0x869a9c[_0xa58c('0x16')][_0xa58c('0x17')]===undefined?!![]:![]:!![],'where':_0x869a9c[_0xa58c('0x16')]?_0x869a9c[_0xa58c('0x16')]['where']||null:null,'attributes':_0x869a9c['options']?_0x869a9c[_0xa58c('0x16')][_0xa58c('0x19')]||null:null,'include':_0x869a9c['options']?_0x869a9c['options'][_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0x869a9c[_0xa58c('0x16')]['include'],function(_0x85edfe){return{'model':db[_0x85edfe['model']],'as':_0x85edfe['as'],'attributes':_0x85edfe[_0xa58c('0x19')],'include':_0x85edfe[_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0x85edfe[_0xa58c('0x1b')],function(_0xc389bd){return{'model':db[_0xc389bd[_0xa58c('0x1d')]],'as':_0xc389bd['as'],'attributes':_0xc389bd['attributes'],'include':_0xc389bd[_0xa58c('0x1b')]?_[_0xa58c('0x1c')](_0xc389bd[_0xa58c('0x1b')],function(_0x142ac3){return{'model':db[_0x142ac3[_0xa58c('0x1d')]],'as':_0x142ac3['as'],'attributes':_0x142ac3[_0xa58c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46b771){logger[_0xa58c('0xb')](_0xa58c('0x21'),_0x869a9c);logger[_0xa58c('0x1f')]('ShowInterval',_0x869a9c,JSON[_0xa58c('0xf')](_0x46b771));_0x4da2d4(_0x46b771);})[_0xa58c('0x20')](function(_0x2e27be){logger[_0xa58c('0x10')](_0xa58c('0x21'),_0x2e27be[_0xa58c('0x12')],_0x869a9c);_0x50fda3(_0x354f69[_0xa58c('0x10')](0x1f4,_0x2e27be[_0xa58c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index cb1eb2f..0bffc59 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 _0xfb45=['exports','express','Router','../../components/auth/service','isAuthenticated','send'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xfb45,0x115));var _0x5fb4=function(_0x2bd739,_0x42ec0a){_0x2bd739=_0x2bd739-0x0;var _0x8fbeaa=_0xfb45[_0x2bd739];return _0x8fbeaa;};'use strict';var express=require(_0x5fb4('0x0'));var router=express[_0x5fb4('0x1')]();var auth=require(_0x5fb4('0x2'));var controller=require('./jira.controller');router['post']('/',auth[_0x5fb4('0x3')](),controller[_0x5fb4('0x4')]);module[_0x5fb4('0x5')]=router; \ No newline at end of file +var _0xa23a=['post','send','exports','express','Router','./jira.controller'];(function(_0x4f3b17,_0xa7be64){var _0x10d5bb=function(_0x402d4c){while(--_0x402d4c){_0x4f3b17['push'](_0x4f3b17['shift']());}};_0x10d5bb(++_0xa7be64);}(_0xa23a,0xe1));var _0xaa23=function(_0x2ea680,_0x99a563){_0x2ea680=_0x2ea680-0x0;var _0x317396=_0xa23a[_0x2ea680];return _0x317396;};'use strict';var express=require(_0xaa23('0x0'));var router=express[_0xaa23('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xaa23('0x2'));router[_0xaa23('0x3')]('/',auth['isAuthenticated'](),controller[_0xaa23('0x4')]);module[_0xaa23('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 415aa0e..f254300 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 _0x551f=['toString','base64','request','setEncoding','end','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','../../config/logger','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','stringify','issuetype','Bug','customfield_11501','oldToken','fields','customfield_11502','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20'];(function(_0x18d417,_0x692f5e){var _0x40fb7a=function(_0x54163b){while(--_0x54163b){_0x18d417['push'](_0x18d417['shift']());}};_0x40fb7a(++_0x692f5e);}(_0x551f,0x67));var _0xf551=function(_0x5f0f89,_0x1fc5cc){_0x5f0f89=_0x5f0f89-0x0;var _0x541945=_0x551f[_0x5f0f89];return _0x541945;};'use strict';var BPromise=require(_0xf551('0x0'));var https=require('https');var logger=require(_0xf551('0x1'))('api');var USERNAME=_0xf551('0x2');var PASSWORD=_0xf551('0x3');function openIssue(_0x500048,_0x2e2f8f){var _0x5d2060={'fields':{'project':{'key':_0x500048['key']||_0xf551('0x4')},'summary':(_0x500048[_0xf551('0x5')]||'Report')+_0xf551('0x6')+_0x500048['ip'],'description':_0x500048['description']||JSON[_0xf551('0x7')](_0x500048),'issuetype':{'name':_0x500048[_0xf551('0x8')]||_0xf551('0x9')}}};_0x5d2060['fields']['customfield_11500']=_0x500048['email'];_0x5d2060['fields'][_0xf551('0xa')]=_0x500048[_0xf551('0xb')];_0x5d2060[_0xf551('0xc')][_0xf551('0xd')]=_0x500048['newToken'];_0x5d2060[_0xf551('0xc')]['customfield_11503']=_0x500048[_0xf551('0xe')];_0x5d2060[_0xf551('0xc')][_0xf551('0xf')]=_0x500048[_0xf551('0x10')];_0x5d2060[_0xf551('0xc')][_0xf551('0x11')]=_0x500048['ip'];var _0x2e8947={'host':_0xf551('0x12'),'port':0x1bb,'path':_0xf551('0x13'),'method':_0xf551('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xf551('0x15'),'Authorization':_0xf551('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xf551('0x17')](_0xf551('0x18'))}};var _0x593567=JSON[_0xf551('0x7')](_0x5d2060);var _0x396bf5=https[_0xf551('0x19')](_0x2e8947,function(_0x38ed7d){_0x38ed7d[_0xf551('0x1a')]('utf8');var _0x3c8ded='';_0x38ed7d['on']('data',function(_0x5bf956){_0x3c8ded+=_0x5bf956;});_0x38ed7d['on'](_0xf551('0x1b'),function(){if(_0x2e2f8f){return _0x2e2f8f['status'](_0x38ed7d['statusCode'])[_0xf551('0x1c')](JSON[_0xf551('0x1d')](_0x3c8ded));}});});_0x396bf5['on'](_0xf551('0x1e'),function(_0x31db80){if(_0x2e2f8f){return _0x2e2f8f[_0xf551('0x1f')](0x1f4)[_0xf551('0x1c')]({'errors':[{'message':_0xf551('0x20'),'type':_0xf551('0x21')}]});}});_0x396bf5[_0xf551('0x22')](_0x593567);_0x396bf5[_0xf551('0x1b')]();}exports[_0xf551('0x23')]=openIssue;exports['send']=function(_0x590632,_0x34797e){_0x590632[_0xf551('0x24')]['ip']=_0x590632[_0xf551('0x25')][_0xf551('0x26')]||_0x590632['connection'][_0xf551('0x27')]||_0x590632[_0xf551('0x28')][_0xf551('0x27')]||_0x590632[_0xf551('0x29')][_0xf551('0x28')][_0xf551('0x27')];return openIssue(_0x590632[_0xf551('0x24')],_0x34797e);}; \ No newline at end of file +var _0x5dbb=['email','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','utf8','data','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','description','stringify','issuetype','Bug','fields'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x5dbb,0x71));var _0xb5db=function(_0x27f5b0,_0x21cdef){_0x27f5b0=_0x27f5b0-0x0;var _0x4c3d1e=_0x5dbb[_0x27f5b0];return _0x4c3d1e;};'use strict';var BPromise=require(_0xb5db('0x0'));var https=require(_0xb5db('0x1'));var logger=require(_0xb5db('0x2'))(_0xb5db('0x3'));var USERNAME=_0xb5db('0x4');var PASSWORD=_0xb5db('0x5');function openIssue(_0x5b4296,_0x205b9c){var _0x14690d={'fields':{'project':{'key':_0x5b4296[_0xb5db('0x6')]||_0xb5db('0x7')},'summary':(_0x5b4296['summary']||'Report')+'\x20from\x20'+_0x5b4296['ip'],'description':_0x5b4296[_0xb5db('0x8')]||JSON[_0xb5db('0x9')](_0x5b4296),'issuetype':{'name':_0x5b4296[_0xb5db('0xa')]||_0xb5db('0xb')}}};_0x14690d[_0xb5db('0xc')]['customfield_11500']=_0x5b4296[_0xb5db('0xd')];_0x14690d[_0xb5db('0xc')]['customfield_11501']=_0x5b4296[_0xb5db('0xe')];_0x14690d[_0xb5db('0xc')][_0xb5db('0xf')]=_0x5b4296[_0xb5db('0x10')];_0x14690d[_0xb5db('0xc')][_0xb5db('0x11')]=_0x5b4296[_0xb5db('0x12')];_0x14690d[_0xb5db('0xc')][_0xb5db('0x13')]=_0x5b4296[_0xb5db('0x14')];_0x14690d[_0xb5db('0xc')]['customfield_10102']=_0x5b4296['ip'];var _0x451534={'host':_0xb5db('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xb5db('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xb5db('0x17'),'Authorization':_0xb5db('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xb5db('0x19')](_0xb5db('0x1a'))}};var _0x5e2a88=JSON[_0xb5db('0x9')](_0x14690d);var _0x438dc3=https[_0xb5db('0x1b')](_0x451534,function(_0x5535ee){_0x5535ee['setEncoding'](_0xb5db('0x1c'));var _0x5e7800='';_0x5535ee['on'](_0xb5db('0x1d'),function(_0x48c257){_0x5e7800+=_0x48c257;});_0x5535ee['on'](_0xb5db('0x1e'),function(){if(_0x205b9c){return _0x205b9c[_0xb5db('0x1f')](_0x5535ee['statusCode'])[_0xb5db('0x20')](JSON[_0xb5db('0x21')](_0x5e7800));}});});_0x438dc3['on']('error',function(_0xac9b6e){if(_0x205b9c){return _0x205b9c[_0xb5db('0x1f')](0x1f4)['json']({'errors':[{'message':_0xb5db('0x22'),'type':'api.jira'}]});}});_0x438dc3['write'](_0x5e2a88);_0x438dc3[_0xb5db('0x1e')]();}exports[_0xb5db('0x23')]=openIssue;exports[_0xb5db('0x24')]=function(_0x284cc2,_0x42799f){_0x284cc2[_0xb5db('0x25')]['ip']=_0x284cc2['headers'][_0xb5db('0x26')]||_0x284cc2[_0xb5db('0x27')][_0xb5db('0x28')]||_0x284cc2['socket'][_0xb5db('0x28')]||_0x284cc2['connection'][_0xb5db('0x29')]['remoteAddress'];return openIssue(_0x284cc2[_0xb5db('0x25')],_0x42799f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 5c32d62..31b0bb3 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 _0xc86d=['../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4fb721,_0x245cab){var _0x8e7738=function(_0x1eddbe){while(--_0x1eddbe){_0x4fb721['push'](_0x4fb721['shift']());}};_0x8e7738(++_0x245cab);}(_0xc86d,0xae));var _0xdc86=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc86d[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xdc86('0x0'));var util=require(_0xdc86('0x1'));var path=require(_0xdc86('0x2'));var timeout=require(_0xdc86('0x3'));var express=require(_0xdc86('0x4'));var router=express[_0xdc86('0x5')]();var auth=require(_0xdc86('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc86('0x7'));var controller=require(_0xdc86('0x8'));router[_0xdc86('0x9')]('/',auth['isAuthenticated'](),controller[_0xdc86('0xa')]);router['get'](_0xdc86('0xb'),auth[_0xdc86('0xc')](),controller[_0xdc86('0xd')]);router[_0xdc86('0x9')](_0xdc86('0xe'),auth[_0xdc86('0xc')](),controller[_0xdc86('0xf')]);router['post']('/',auth[_0xdc86('0xc')](),controller['create']);router[_0xdc86('0x10')](_0xdc86('0xe'),auth['isAuthenticated'](),controller[_0xdc86('0x11')]);router[_0xdc86('0x12')](_0xdc86('0xe'),auth[_0xdc86('0xc')](),controller['destroy']);module[_0xdc86('0x13')]=router; \ No newline at end of file +var _0x34f2=['Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','express'];(function(_0x5d1508,_0x3738cc){var _0x5ea529=function(_0x452f05){while(--_0x452f05){_0x5d1508['push'](_0x5d1508['shift']());}};_0x5ea529(++_0x3738cc);}(_0x34f2,0xbb));var _0x234f=function(_0x5cd0b0,_0x49f496){_0x5cd0b0=_0x5cd0b0-0x0;var _0x10b0e9=_0x34f2[_0x5cd0b0];return _0x10b0e9;};'use strict';var multer=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x234f('0x2'));var router=express[_0x234f('0x3')]();var auth=require(_0x234f('0x4'));var interaction=require(_0x234f('0x5'));var config=require('../../config/environment');var controller=require(_0x234f('0x6'));router[_0x234f('0x7')]('/',auth[_0x234f('0x8')](),controller[_0x234f('0x9')]);router[_0x234f('0x7')](_0x234f('0xa'),auth[_0x234f('0x8')](),controller[_0x234f('0xb')]);router[_0x234f('0x7')](_0x234f('0xc'),auth['isAuthenticated'](),controller[_0x234f('0xd')]);router['post']('/',auth[_0x234f('0x8')](),controller['create']);router[_0x234f('0xe')](_0x234f('0xc'),auth[_0x234f('0x8')](),controller[_0x234f('0xf')]);router[_0x234f('0x10')](_0x234f('0xc'),auth[_0x234f('0x8')](),controller[_0x234f('0x11')]);module[_0x234f('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 39ccf81..94d4317 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 _0x4f46=['STRING','TEXT','long','sequelize','exports'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x4f46,0x80));var _0x64f4=function(_0x5d0d1b,_0x44b391){_0x5d0d1b=_0x5d0d1b-0x0;var _0x196810=_0x4f46[_0x5d0d1b];return _0x196810;};'use strict';var Sequelize=require(_0x64f4('0x0'));module[_0x64f4('0x1')]={'question':{'type':Sequelize[_0x64f4('0x2')]},'answer':{'type':Sequelize[_0x64f4('0x3')](_0x64f4('0x4'))},'membername':{'type':Sequelize[_0x64f4('0x2')]},'projectname':{'type':Sequelize[_0x64f4('0x2')]},'queue':{'type':Sequelize[_0x64f4('0x2')]},'uniqueid':{'type':Sequelize[_0x64f4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x64f4('0x2')]}}; \ No newline at end of file +var _0x64f8=['TEXT','long','exports','STRING'];(function(_0x5c1548,_0x4a139c){var _0x319502=function(_0x3bd143){while(--_0x3bd143){_0x5c1548['push'](_0x5c1548['shift']());}};_0x319502(++_0x4a139c);}(_0x64f8,0x6e));var _0x864f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64f8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x864f('0x0')]={'question':{'type':Sequelize[_0x864f('0x1')]},'answer':{'type':Sequelize[_0x864f('0x2')](_0x864f('0x3'))},'membername':{'type':Sequelize[_0x864f('0x1')]},'projectname':{'type':Sequelize[_0x864f('0x1')]},'queue':{'type':Sequelize[_0x864f('0x1')]},'uniqueid':{'type':Sequelize[_0x864f('0x1')]},'calleridname':{'type':Sequelize[_0x864f('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x864f('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index f5ff34f..4cc2b55 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 _0x6e1e=['options','count','includeAll','rows','show','params','fields','include','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','sendStatus','end','json','offset','limit','apply','reject','save','update','then','error','stack','name','status','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x3eb450,_0x592b0a){var _0x2c4cfd=function(_0x34f5dc){while(--_0x34f5dc){_0x3eb450['push'](_0x3eb450['shift']());}};_0x2c4cfd(++_0x592b0a);}(_0x6e1e,0x142));var _0xe6e1=function(_0x3679cd,_0x1aa98a){_0x3679cd=_0x3679cd-0x0;var _0x281367=_0x6e1e[_0x3679cd];return _0x281367;};'use strict';var pdf=require(_0xe6e1('0x0'));var emlformat=require(_0xe6e1('0x1'));var rimraf=require(_0xe6e1('0x2'));var zipdir=require(_0xe6e1('0x3'));var jsonpatch=require(_0xe6e1('0x4'));var rp=require(_0xe6e1('0x5'));var moment=require(_0xe6e1('0x6'));var BPromise=require(_0xe6e1('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe6e1('0x8'));var csv=require(_0xe6e1('0x9'));var ejs=require(_0xe6e1('0xa'));var fs=require('fs');var _=require(_0xe6e1('0xb'));var squel=require(_0xe6e1('0xc'));var crypto=require(_0xe6e1('0xd'));var jsforce=require(_0xe6e1('0xe'));var deskjs=require(_0xe6e1('0xf'));var toCsv=require(_0xe6e1('0x9'));var querystring=require(_0xe6e1('0x10'));var Papa=require(_0xe6e1('0x11'));var Redis=require(_0xe6e1('0x12'));var authService=require(_0xe6e1('0x13'));var qs=require(_0xe6e1('0x14'));var as=require(_0xe6e1('0x15'));var hardwareService=require(_0xe6e1('0x16'));var logger=require(_0xe6e1('0x17'))(_0xe6e1('0x18'));var utils=require(_0xe6e1('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5687e6,_0x3b18a1){_0x3b18a1=_0x3b18a1||0xcc;return function(_0x52eb76){if(_0x52eb76){return _0x5687e6[_0xe6e1('0x1a')](_0x3b18a1);}return _0x5687e6['status'](_0x3b18a1)[_0xe6e1('0x1b')]();};}function respondWithResult(_0x3d338d,_0x4dc8e9){_0x4dc8e9=_0x4dc8e9||0xc8;return function(_0x4a3cda){if(_0x4a3cda){return _0x3d338d['status'](_0x4dc8e9)[_0xe6e1('0x1c')](_0x4a3cda);}};}function respondWithFilteredResult(_0x862804,_0x41c528){return function(_0xa8e36){if(_0xa8e36){var _0x3fac60=_0xa8e36['count'],_0x2ede78=_0x41c528[_0xe6e1('0x1d')],_0xbee614=_0x41c528[_0xe6e1('0x1d')]+_0x41c528[_0xe6e1('0x1e')],_0x36ae45;if(_0xbee614>=_0x3fac60){_0xbee614=_0x3fac60;_0x36ae45=0xc8;}else{_0x36ae45=0xce;}_0x862804['status'](_0x36ae45);return _0x862804['set']('Content-Range',_0x2ede78+'-'+_0xbee614+'/'+_0x3fac60)[_0xe6e1('0x1c')](_0xa8e36);}return null;};}function patchUpdates(_0x4cad31){return function(_0x407a80){try{jsonpatch[_0xe6e1('0x1f')](_0x407a80,_0x4cad31,!![]);}catch(_0x3c0387){return BPromise[_0xe6e1('0x20')](_0x3c0387);}return _0x407a80[_0xe6e1('0x21')]();};}function saveUpdates(_0x455e22,_0x456ccc){return function(_0x306892){if(_0x306892){return _0x306892[_0xe6e1('0x22')](_0x455e22)['then'](function(_0x3aa0c9){return _0x3aa0c9;});}return null;};}function removeEntity(_0xe436e,_0x2f7d57){return function(_0x2b5757){if(_0x2b5757){return _0x2b5757['destroy']()[_0xe6e1('0x23')](function(){_0xe436e['status'](0xcc)[_0xe6e1('0x1b')]();});}};}function handleEntityNotFound(_0x138f41,_0x3e2c34){return function(_0x49cd15){if(!_0x49cd15){_0x138f41['sendStatus'](0x194);}return _0x49cd15;};}function handleError(_0x4734ab,_0x9767c9){_0x9767c9=_0x9767c9||0x1f4;return function(_0x456e7b){logger[_0xe6e1('0x24')](_0x456e7b[_0xe6e1('0x25')]);if(_0x456e7b[_0xe6e1('0x26')]){delete _0x456e7b['name'];}_0x4734ab[_0xe6e1('0x27')](_0x9767c9)[_0xe6e1('0x28')](_0x456e7b);};}exports[_0xe6e1('0x29')]=function(_0x9a7175,_0x37505a){var _0x2288a6={},_0x39f647={},_0x38489a={'count':0x0,'rows':[]};var _0x3447b2=_['map'](db[_0xe6e1('0x2a')][_0xe6e1('0x2b')],function(_0x3901ac){return{'name':_0x3901ac[_0xe6e1('0x2c')],'type':_0x3901ac[_0xe6e1('0x2d')]['key']};});_0x39f647[_0xe6e1('0x2e')]=_[_0xe6e1('0x2f')](_0x3447b2,'name');_0x39f647[_0xe6e1('0x30')]=_[_0xe6e1('0x31')](_0x9a7175['query']);_0x39f647[_0xe6e1('0x32')]=_[_0xe6e1('0x33')](_0x39f647[_0xe6e1('0x2e')],_0x39f647[_0xe6e1('0x30')]);_0x2288a6[_0xe6e1('0x34')]=_[_0xe6e1('0x33')](_0x39f647[_0xe6e1('0x2e')],qs['fields'](_0x9a7175[_0xe6e1('0x30')]['fields']));_0x2288a6[_0xe6e1('0x34')]=_0x2288a6[_0xe6e1('0x34')][_0xe6e1('0x35')]?_0x2288a6[_0xe6e1('0x34')]:_0x39f647[_0xe6e1('0x2e')];if(!_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x36')](_0xe6e1('0x37'))){_0x2288a6['limit']=qs[_0xe6e1('0x1e')](_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x1e')]);_0x2288a6['offset']=qs[_0xe6e1('0x1d')](_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x1d')]);}_0x2288a6[_0xe6e1('0x38')]=qs[_0xe6e1('0x39')](_0x9a7175['query'][_0xe6e1('0x39')]);_0x2288a6[_0xe6e1('0x3a')]=qs[_0xe6e1('0x32')](_[_0xe6e1('0x3b')](_0x9a7175[_0xe6e1('0x30')],_0x39f647[_0xe6e1('0x32')]),_0x3447b2);if(_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x3c')]){_0x2288a6['where']=_[_0xe6e1('0x3d')](_0x2288a6[_0xe6e1('0x3a')],{'$or':_[_0xe6e1('0x2f')](_0x3447b2,function(_0x200e87){if(_0x200e87[_0xe6e1('0x2d')]!==_0xe6e1('0x3e')){var _0x1bc57b={};_0x1bc57b[_0x200e87[_0xe6e1('0x26')]]={'$like':'%'+_0x9a7175['query'][_0xe6e1('0x3c')]+'%'};return _0x1bc57b;}})});}_0x2288a6=_[_0xe6e1('0x3d')]({},_0x2288a6,_0x9a7175[_0xe6e1('0x3f')]);var _0x343a15={'where':_0x2288a6[_0xe6e1('0x3a')]};return db['JscriptyAnswerReport'][_0xe6e1('0x40')](_0x343a15)[_0xe6e1('0x23')](function(_0x43505b){_0x38489a['count']=_0x43505b;if(_0x9a7175[_0xe6e1('0x30')][_0xe6e1('0x41')]){_0x2288a6['include']=[{'all':!![]}];}return db[_0xe6e1('0x2a')]['findAll'](_0x2288a6);})['then'](function(_0x37100e){_0x38489a[_0xe6e1('0x42')]=_0x37100e;return _0x38489a;})[_0xe6e1('0x23')](respondWithFilteredResult(_0x37505a,_0x2288a6))['catch'](handleError(_0x37505a,null));};exports[_0xe6e1('0x43')]=function(_0x2a818d,_0x422127){var _0x5b55da={'raw':!![],'where':{'id':_0x2a818d[_0xe6e1('0x44')]['id']}},_0x2159ea={};_0x2159ea[_0xe6e1('0x2e')]=_['keys'](db[_0xe6e1('0x2a')][_0xe6e1('0x2b')]);_0x2159ea[_0xe6e1('0x30')]=_[_0xe6e1('0x31')](_0x2a818d[_0xe6e1('0x30')]);_0x2159ea['filters']=_[_0xe6e1('0x33')](_0x2159ea[_0xe6e1('0x2e')],_0x2159ea['query']);_0x5b55da['attributes']=_[_0xe6e1('0x33')](_0x2159ea[_0xe6e1('0x2e')],qs[_0xe6e1('0x45')](_0x2a818d['query']['fields']));_0x5b55da['attributes']=_0x5b55da[_0xe6e1('0x34')][_0xe6e1('0x35')]?_0x5b55da[_0xe6e1('0x34')]:_0x2159ea[_0xe6e1('0x2e')];if(_0x2a818d['query'][_0xe6e1('0x41')]){_0x5b55da[_0xe6e1('0x46')]=[{'all':!![]}];}_0x5b55da=_[_0xe6e1('0x3d')]({},_0x5b55da,_0x2a818d[_0xe6e1('0x3f')]);return db[_0xe6e1('0x2a')][_0xe6e1('0x47')](_0x5b55da)[_0xe6e1('0x23')](handleEntityNotFound(_0x422127,null))[_0xe6e1('0x23')](respondWithResult(_0x422127,null))[_0xe6e1('0x48')](handleError(_0x422127,null));};exports[_0xe6e1('0x49')]=function(_0x4f87c2,_0x3c1b6f){return db[_0xe6e1('0x2a')][_0xe6e1('0x49')](_0x4f87c2[_0xe6e1('0x4a')],{})[_0xe6e1('0x23')](respondWithResult(_0x3c1b6f,0xc9))[_0xe6e1('0x48')](handleError(_0x3c1b6f,null));};exports['update']=function(_0x2dfa69,_0x2c4640){if(_0x2dfa69[_0xe6e1('0x4a')]['id']){delete _0x2dfa69[_0xe6e1('0x4a')]['id'];}return db[_0xe6e1('0x2a')][_0xe6e1('0x47')]({'where':{'id':_0x2dfa69[_0xe6e1('0x44')]['id']}})[_0xe6e1('0x23')](handleEntityNotFound(_0x2c4640,null))[_0xe6e1('0x23')](saveUpdates(_0x2dfa69['body'],null))[_0xe6e1('0x23')](respondWithResult(_0x2c4640,null))[_0xe6e1('0x48')](handleError(_0x2c4640,null));};exports[_0xe6e1('0x4b')]=function(_0x2292ff,_0x2b2386){return db[_0xe6e1('0x2a')][_0xe6e1('0x47')]({'where':{'id':_0x2292ff[_0xe6e1('0x44')]['id']}})[_0xe6e1('0x23')](handleEntityNotFound(_0x2b2386,null))[_0xe6e1('0x23')](removeEntity(_0x2b2386,null))['catch'](handleError(_0x2b2386,null));};exports[_0xe6e1('0x4c')]=function(_0x15fdca,_0x4edf92){return db[_0xe6e1('0x2a')]['describe']()[_0xe6e1('0x23')](respondWithResult(_0x4edf92,null))[_0xe6e1('0x48')](handleError(_0x4edf92,null));}; \ No newline at end of file +var _0x7762=['destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','save','update','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','VIRTUAL','options','count','then','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find'];(function(_0x91fab6,_0x4bbc0d){var _0x6fcbe3=function(_0x321bf7){while(--_0x321bf7){_0x91fab6['push'](_0x91fab6['shift']());}};_0x6fcbe3(++_0x4bbc0d);}(_0x7762,0xda));var _0x2776=function(_0x31380a,_0x1fadd3){_0x31380a=_0x31380a-0x0;var _0x21c02e=_0x7762[_0x31380a];return _0x21c02e;};'use strict';var pdf=require(_0x2776('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2776('0x1'));var zipdir=require(_0x2776('0x2'));var jsonpatch=require(_0x2776('0x3'));var rp=require(_0x2776('0x4'));var moment=require(_0x2776('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2776('0x6'));var util=require('util');var path=require(_0x2776('0x7'));var sox=require('sox');var csv=require(_0x2776('0x8'));var ejs=require(_0x2776('0x9'));var fs=require('fs');var _=require(_0x2776('0xa'));var squel=require(_0x2776('0xb'));var crypto=require(_0x2776('0xc'));var jsforce=require(_0x2776('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2776('0x8'));var querystring=require(_0x2776('0xe'));var Papa=require(_0x2776('0xf'));var Redis=require(_0x2776('0x10'));var authService=require(_0x2776('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2776('0x12'));var hardwareService=require(_0x2776('0x13'));var logger=require(_0x2776('0x14'))(_0x2776('0x15'));var utils=require(_0x2776('0x16'));var config=require(_0x2776('0x17'));var db=require(_0x2776('0x18'))['db'];function respondWithStatusCode(_0x38f50b,_0x110a88){_0x110a88=_0x110a88||0xcc;return function(_0x121222){if(_0x121222){return _0x38f50b['sendStatus'](_0x110a88);}return _0x38f50b[_0x2776('0x19')](_0x110a88)[_0x2776('0x1a')]();};}function respondWithResult(_0x1811f6,_0x50fafd){_0x50fafd=_0x50fafd||0xc8;return function(_0x4d0233){if(_0x4d0233){return _0x1811f6[_0x2776('0x19')](_0x50fafd)[_0x2776('0x1b')](_0x4d0233);}};}function respondWithFilteredResult(_0xc9d825,_0xc4eceb){return function(_0x63a21){if(_0x63a21){var _0x4dfccb=_0x63a21['count'],_0x435ce9=_0xc4eceb[_0x2776('0x1c')],_0x3a8e83=_0xc4eceb[_0x2776('0x1c')]+_0xc4eceb[_0x2776('0x1d')],_0xb37b4f;if(_0x3a8e83>=_0x4dfccb){_0x3a8e83=_0x4dfccb;_0xb37b4f=0xc8;}else{_0xb37b4f=0xce;}_0xc9d825[_0x2776('0x19')](_0xb37b4f);return _0xc9d825['set'](_0x2776('0x1e'),_0x435ce9+'-'+_0x3a8e83+'/'+_0x4dfccb)['json'](_0x63a21);}return null;};}function patchUpdates(_0x4af633){return function(_0x2f21ad){try{jsonpatch[_0x2776('0x1f')](_0x2f21ad,_0x4af633,!![]);}catch(_0x469c01){return BPromise[_0x2776('0x20')](_0x469c01);}return _0x2f21ad[_0x2776('0x21')]();};}function saveUpdates(_0x52ad61,_0x394b70){return function(_0x2d7244){if(_0x2d7244){return _0x2d7244[_0x2776('0x22')](_0x52ad61)['then'](function(_0x1fa59c){return _0x1fa59c;});}return null;};}function removeEntity(_0xee760a,_0x16e833){return function(_0x554300){if(_0x554300){return _0x554300['destroy']()['then'](function(){_0xee760a[_0x2776('0x19')](0xcc)[_0x2776('0x1a')]();});}};}function handleEntityNotFound(_0xd67989,_0x227f40){return function(_0x477623){if(!_0x477623){_0xd67989['sendStatus'](0x194);}return _0x477623;};}function handleError(_0x1e6dfc,_0xa0fb15){_0xa0fb15=_0xa0fb15||0x1f4;return function(_0x2e5665){logger[_0x2776('0x23')](_0x2e5665[_0x2776('0x24')]);if(_0x2e5665['name']){delete _0x2e5665[_0x2776('0x25')];}_0x1e6dfc[_0x2776('0x19')](_0xa0fb15)[_0x2776('0x26')](_0x2e5665);};}exports[_0x2776('0x27')]=function(_0x5ef86b,_0x91267d){var _0xd8d6c7={},_0x386786={},_0x40a3dd={'count':0x0,'rows':[]};var _0x1c37aa=_['map'](db[_0x2776('0x28')][_0x2776('0x29')],function(_0x418fed){return{'name':_0x418fed['fieldName'],'type':_0x418fed[_0x2776('0x2a')]['key']};});_0x386786[_0x2776('0x2b')]=_[_0x2776('0x2c')](_0x1c37aa,'name');_0x386786[_0x2776('0x2d')]=_['keys'](_0x5ef86b['query']);_0x386786[_0x2776('0x2e')]=_[_0x2776('0x2f')](_0x386786[_0x2776('0x2b')],_0x386786[_0x2776('0x2d')]);_0xd8d6c7[_0x2776('0x30')]=_[_0x2776('0x2f')](_0x386786[_0x2776('0x2b')],qs[_0x2776('0x31')](_0x5ef86b[_0x2776('0x2d')][_0x2776('0x31')]));_0xd8d6c7[_0x2776('0x30')]=_0xd8d6c7[_0x2776('0x30')]['length']?_0xd8d6c7['attributes']:_0x386786[_0x2776('0x2b')];if(!_0x5ef86b['query'][_0x2776('0x32')]('nolimit')){_0xd8d6c7[_0x2776('0x1d')]=qs[_0x2776('0x1d')](_0x5ef86b[_0x2776('0x2d')][_0x2776('0x1d')]);_0xd8d6c7[_0x2776('0x1c')]=qs['offset'](_0x5ef86b[_0x2776('0x2d')][_0x2776('0x1c')]);}_0xd8d6c7['order']=qs[_0x2776('0x33')](_0x5ef86b['query'][_0x2776('0x33')]);_0xd8d6c7[_0x2776('0x34')]=qs['filters'](_['pick'](_0x5ef86b[_0x2776('0x2d')],_0x386786[_0x2776('0x2e')]),_0x1c37aa);if(_0x5ef86b[_0x2776('0x2d')][_0x2776('0x35')]){_0xd8d6c7['where']=_['merge'](_0xd8d6c7[_0x2776('0x34')],{'$or':_[_0x2776('0x2c')](_0x1c37aa,function(_0x7670f8){if(_0x7670f8[_0x2776('0x2a')]!==_0x2776('0x36')){var _0x280b64={};_0x280b64[_0x7670f8[_0x2776('0x25')]]={'$like':'%'+_0x5ef86b[_0x2776('0x2d')]['filter']+'%'};return _0x280b64;}})});}_0xd8d6c7=_['merge']({},_0xd8d6c7,_0x5ef86b[_0x2776('0x37')]);var _0x58d4db={'where':_0xd8d6c7[_0x2776('0x34')]};return db[_0x2776('0x28')][_0x2776('0x38')](_0x58d4db)[_0x2776('0x39')](function(_0x596251){_0x40a3dd['count']=_0x596251;if(_0x5ef86b[_0x2776('0x2d')][_0x2776('0x3a')]){_0xd8d6c7[_0x2776('0x3b')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2776('0x3c')](_0xd8d6c7);})[_0x2776('0x39')](function(_0x28dbec){_0x40a3dd[_0x2776('0x3d')]=_0x28dbec;return _0x40a3dd;})[_0x2776('0x39')](respondWithFilteredResult(_0x91267d,_0xd8d6c7))[_0x2776('0x3e')](handleError(_0x91267d,null));};exports[_0x2776('0x3f')]=function(_0x3bacf3,_0x226cb3){var _0x3aad8e={'raw':!![],'where':{'id':_0x3bacf3[_0x2776('0x40')]['id']}},_0x409676={};_0x409676[_0x2776('0x2b')]=_[_0x2776('0x41')](db[_0x2776('0x28')][_0x2776('0x29')]);_0x409676['query']=_['keys'](_0x3bacf3['query']);_0x409676[_0x2776('0x2e')]=_[_0x2776('0x2f')](_0x409676[_0x2776('0x2b')],_0x409676[_0x2776('0x2d')]);_0x3aad8e[_0x2776('0x30')]=_[_0x2776('0x2f')](_0x409676['model'],qs[_0x2776('0x31')](_0x3bacf3['query']['fields']));_0x3aad8e[_0x2776('0x30')]=_0x3aad8e['attributes'][_0x2776('0x42')]?_0x3aad8e[_0x2776('0x30')]:_0x409676['model'];if(_0x3bacf3[_0x2776('0x2d')][_0x2776('0x3a')]){_0x3aad8e[_0x2776('0x3b')]=[{'all':!![]}];}_0x3aad8e=_['merge']({},_0x3aad8e,_0x3bacf3[_0x2776('0x37')]);return db[_0x2776('0x28')]['find'](_0x3aad8e)[_0x2776('0x39')](handleEntityNotFound(_0x226cb3,null))[_0x2776('0x39')](respondWithResult(_0x226cb3,null))[_0x2776('0x3e')](handleError(_0x226cb3,null));};exports[_0x2776('0x43')]=function(_0x505970,_0x217144){return db[_0x2776('0x28')]['create'](_0x505970['body'],{})[_0x2776('0x39')](respondWithResult(_0x217144,0xc9))[_0x2776('0x3e')](handleError(_0x217144,null));};exports['update']=function(_0x2b5e45,_0x487d6f){if(_0x2b5e45[_0x2776('0x44')]['id']){delete _0x2b5e45[_0x2776('0x44')]['id'];}return db['JscriptyAnswerReport'][_0x2776('0x45')]({'where':{'id':_0x2b5e45['params']['id']}})[_0x2776('0x39')](handleEntityNotFound(_0x487d6f,null))[_0x2776('0x39')](saveUpdates(_0x2b5e45[_0x2776('0x44')],null))[_0x2776('0x39')](respondWithResult(_0x487d6f,null))[_0x2776('0x3e')](handleError(_0x487d6f,null));};exports[_0x2776('0x46')]=function(_0x2f5481,_0xc317bb){return db[_0x2776('0x28')]['find']({'where':{'id':_0x2f5481[_0x2776('0x40')]['id']}})['then'](handleEntityNotFound(_0xc317bb,null))[_0x2776('0x39')](removeEntity(_0xc317bb,null))[_0x2776('0x3e')](handleError(_0xc317bb,null));};exports[_0x2776('0x47')]=function(_0x20d64a,_0x4eb103){return db[_0x2776('0x28')][_0x2776('0x47')]()[_0x2776('0x39')](respondWithResult(_0x4eb103,null))[_0x2776('0x3e')](handleError(_0x4eb103,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4e3e0b8..4fb6ecc 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 _0x1f9e=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','report_jscripty_answers'];(function(_0x5515a7,_0x2c4af1){var _0x43f4bf=function(_0x3d519d){while(--_0x3d519d){_0x5515a7['push'](_0x5515a7['shift']());}};_0x43f4bf(++_0x2c4af1);}(_0x1f9e,0x19a));var _0xe1f9=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x1f9e[_0x5de214];return _0x4df627;};'use strict';var _=require(_0xe1f9('0x0'));var util=require(_0xe1f9('0x1'));var logger=require(_0xe1f9('0x2'))('api');var moment=require(_0xe1f9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe1f9('0x4'));var fs=require('fs');var path=require(_0xe1f9('0x5'));var rimraf=require(_0xe1f9('0x6'));var config=require(_0xe1f9('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x184032,_0xfca3a0){return _0x184032[_0xe1f9('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0xe1f9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbcb=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0xfbcb,0x1b4));var _0xbfbc=function(_0x22ecb6,_0xe9f768){_0x22ecb6=_0x22ecb6-0x0;var _0x32bacd=_0xfbcb[_0x22ecb6];return _0x32bacd;};'use strict';var _=require(_0xbfbc('0x0'));var util=require(_0xbfbc('0x1'));var logger=require(_0xbfbc('0x2'))('api');var moment=require(_0xbfbc('0x3'));var BPromise=require(_0xbfbc('0x4'));var rp=require(_0xbfbc('0x5'));var fs=require('fs');var path=require(_0xbfbc('0x6'));var rimraf=require(_0xbfbc('0x7'));var config=require(_0xbfbc('0x8'));var attributes=require(_0xbfbc('0x9'));module[_0xbfbc('0xa')]=function(_0x30ec27,_0x510da6){return _0x30ec27[_0xbfbc('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0xbfbc('0xc'),'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 e8973ba..061c6e7 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 _0xeb8b=['info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xeb8b,0x106));var _0xbeb8=function(_0x5956e4,_0x4e4c98){_0x5956e4=_0x5956e4-0x0;var _0x48e972=_0xeb8b[_0x5956e4];return _0x48e972;};'use strict';var _=require(_0xbeb8('0x0'));var util=require(_0xbeb8('0x1'));var moment=require(_0xbeb8('0x2'));var BPromise=require(_0xbeb8('0x3'));var rs=require(_0xbeb8('0x4'));var fs=require('fs');var Redis=require(_0xbeb8('0x5'));var db=require(_0xbeb8('0x6'))['db'];var utils=require(_0xbeb8('0x7'));var logger=require(_0xbeb8('0x8'))(_0xbeb8('0x9'));var config=require(_0xbeb8('0xa'));var jayson=require(_0xbeb8('0xb'));var client=jayson[_0xbeb8('0xc')][_0xbeb8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2d4936,_0x249197,_0x36e22b){return new BPromise(function(_0x4c55f2,_0x5dc502){return client['request'](_0x2d4936,_0x36e22b)['then'](function(_0x21f5d6){logger[_0xbeb8('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x249197,_0xbeb8('0xf'));logger['debug'](_0xbeb8('0x10'),_0x249197,_0xbeb8('0xf'),JSON[_0xbeb8('0x11')](_0x21f5d6));if(_0x21f5d6[_0xbeb8('0x12')]){if(_0x21f5d6['error']['code']===0x1f4){logger[_0xbeb8('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x249197,_0x21f5d6[_0xbeb8('0x12')][_0xbeb8('0x13')]);return _0x5dc502(_0x21f5d6['error']['message']);}logger[_0xbeb8('0x12')](_0xbeb8('0x14'),_0x249197,_0x21f5d6[_0xbeb8('0x12')][_0xbeb8('0x13')]);return _0x4c55f2(_0x21f5d6[_0xbeb8('0x12')][_0xbeb8('0x13')]);}else{logger[_0xbeb8('0xe')](_0xbeb8('0x14'),_0x249197,_0xbeb8('0xf'));_0x4c55f2(_0x21f5d6[_0xbeb8('0x15')]['message']);}})[_0xbeb8('0x16')](function(_0x141287){logger['error'](_0xbeb8('0x14'),_0x249197,_0x141287);_0x5dc502(_0x141287);});});} \ No newline at end of file +var _0x1d6c=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x1018bb,_0x4518d2){var _0x569984=function(_0x4a97e6){while(--_0x4a97e6){_0x1018bb['push'](_0x1018bb['shift']());}};_0x569984(++_0x4518d2);}(_0x1d6c,0xc9));var _0xc1d6=function(_0xaa4f3,_0x37be20){_0xaa4f3=_0xaa4f3-0x0;var _0x163cc9=_0x1d6c[_0xaa4f3];return _0x163cc9;};'use strict';var _=require('lodash');var util=require(_0xc1d6('0x0'));var moment=require('moment');var BPromise=require(_0xc1d6('0x1'));var rs=require(_0xc1d6('0x2'));var fs=require('fs');var Redis=require(_0xc1d6('0x3'));var db=require(_0xc1d6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1d6('0x5'))(_0xc1d6('0x6'));var config=require(_0xc1d6('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56c950,_0x287b18,_0x4b6e19){return new BPromise(function(_0x2992f9,_0xb34cfb){return client[_0xc1d6('0x8')](_0x56c950,_0x4b6e19)[_0xc1d6('0x9')](function(_0x584f55){logger[_0xc1d6('0xa')](_0xc1d6('0xb'),_0x287b18,'request\x20sent');logger[_0xc1d6('0xc')](_0xc1d6('0xd'),_0x287b18,_0xc1d6('0xe'),JSON['stringify'](_0x584f55));if(_0x584f55['error']){if(_0x584f55[_0xc1d6('0xf')][_0xc1d6('0x10')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x287b18,_0x584f55[_0xc1d6('0xf')][_0xc1d6('0x11')]);return _0xb34cfb(_0x584f55['error'][_0xc1d6('0x11')]);}logger[_0xc1d6('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x287b18,_0x584f55[_0xc1d6('0xf')][_0xc1d6('0x11')]);return _0x2992f9(_0x584f55[_0xc1d6('0xf')]['message']);}else{logger[_0xc1d6('0xa')](_0xc1d6('0xb'),_0x287b18,_0xc1d6('0xe'));_0x2992f9(_0x584f55[_0xc1d6('0x12')][_0xc1d6('0x11')]);}})[_0xc1d6('0x13')](function(_0x18c3cb){logger['error'](_0xc1d6('0xb'),_0x287b18,_0x18c3cb);_0xb34cfb(_0x18c3cb);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ba630b8..78bc095 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 _0x7ca0=['/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers'];(function(_0xac6c0b,_0x28e148){var _0x39077d=function(_0x59ebd4){while(--_0x59ebd4){_0xac6c0b['push'](_0xac6c0b['shift']());}};_0x39077d(++_0x28e148);}(_0x7ca0,0xe2));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x07ca('0x0'));var util=require(_0x07ca('0x1'));var path=require(_0x07ca('0x2'));var timeout=require(_0x07ca('0x3'));var express=require(_0x07ca('0x4'));var router=express['Router']();var auth=require(_0x07ca('0x5'));var interaction=require(_0x07ca('0x6'));var config=require('../../config/environment');var controller=require(_0x07ca('0x7'));router['get']('/',auth[_0x07ca('0x8')](),controller[_0x07ca('0x9')]);router[_0x07ca('0xa')](_0x07ca('0xb'),auth[_0x07ca('0x8')](),controller[_0x07ca('0xc')]);router[_0x07ca('0xa')](_0x07ca('0xd'),auth[_0x07ca('0x8')](),controller[_0x07ca('0xe')]);router['get'](_0x07ca('0xf'),auth['isAuthenticated'](),controller[_0x07ca('0x10')]);router[_0x07ca('0xa')](_0x07ca('0x11'),auth['isAuthenticated'](),timeout(_0x07ca('0x12')),controller['getSummary']);router[_0x07ca('0x13')]('/',auth['isAuthenticated'](),controller[_0x07ca('0x14')]);router[_0x07ca('0x13')](_0x07ca('0x15'),auth['isAuthenticated'](),controller[_0x07ca('0x16')]);router[_0x07ca('0x17')](_0x07ca('0xb'),auth[_0x07ca('0x8')](),controller[_0x07ca('0x18')]);router[_0x07ca('0x19')](_0x07ca('0xb'),auth[_0x07ca('0x8')](),controller['destroy']);module[_0x07ca('0x1a')]=router; \ No newline at end of file +var _0x9b07=['get','isAuthenticated','index','/:id','/:id/sessions','getSessions','getAnswers','30s','getSummary','post','create','clone','put','update','delete','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller'];(function(_0x32c4a5,_0xd7deca){var _0x5eae77=function(_0x242354){while(--_0x242354){_0x32c4a5['push'](_0x32c4a5['shift']());}};_0x5eae77(++_0xd7deca);}(_0x9b07,0x198));var _0x79b0=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9b07[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require(_0x79b0('0x0'));var path=require('path');var timeout=require(_0x79b0('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x79b0('0x2'));var interaction=require(_0x79b0('0x3'));var config=require(_0x79b0('0x4'));var controller=require(_0x79b0('0x5'));router[_0x79b0('0x6')]('/',auth[_0x79b0('0x7')](),controller[_0x79b0('0x8')]);router['get'](_0x79b0('0x9'),auth[_0x79b0('0x7')](),controller['show']);router[_0x79b0('0x6')](_0x79b0('0xa'),auth[_0x79b0('0x7')](),controller[_0x79b0('0xb')]);router[_0x79b0('0x6')]('/:id/answers',auth[_0x79b0('0x7')](),controller[_0x79b0('0xc')]);router[_0x79b0('0x6')]('/:id/summary',auth[_0x79b0('0x7')](),timeout(_0x79b0('0xd')),controller[_0x79b0('0xe')]);router[_0x79b0('0xf')]('/',auth[_0x79b0('0x7')](),controller[_0x79b0('0x10')]);router[_0x79b0('0xf')]('/:id/clone',auth[_0x79b0('0x7')](),controller[_0x79b0('0x11')]);router[_0x79b0('0x12')]('/:id',auth[_0x79b0('0x7')](),controller[_0x79b0('0x13')]);router[_0x79b0('0x14')]('/:id',auth[_0x79b0('0x7')](),controller[_0x79b0('0x15')]);module[_0x79b0('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 4dbc0a4..7cce447 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 _0x9bf4=['BOOLEAN','lodash','util','exports','STRING','TEXT','long','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name'];(function(_0x2e48a9,_0x2a0896){var _0x5eb0bc=function(_0x192646){while(--_0x192646){_0x2e48a9['push'](_0x2e48a9['shift']());}};_0x5eb0bc(++_0x2a0896);}(_0x9bf4,0x1a5));var _0x49bf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bf4[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var _=require(_0x49bf('0x0'));var util=require(_0x49bf('0x1'));module[_0x49bf('0x2')]={'name':{'type':Sequelize[_0x49bf('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x49bf('0x4')](_0x49bf('0x5')),'set':function(_0x47f644){if(_['isObjectLike'](_0x47f644)){this[_0x49bf('0x6')](_0x49bf('0x7'),JSON['stringify'](_0x47f644));}else if(_['isString'](_0x47f644)){this[_0x49bf('0x6')]('formData',_0x47f644);}else{this[_0x49bf('0x6')](_0x49bf('0x7'),util['format'](_0x49bf('0x8'),this[_0x49bf('0x9')](_0x49bf('0xa'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x49bf('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x7d5b=['formData','stringify','setDataValue','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','long'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x7d5b,0xa3));var _0xb7d5=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x7d5b[_0x243b59];return _0x3e1676;};'use strict';var Sequelize=require(_0xb7d5('0x0'));var _=require(_0xb7d5('0x1'));var util=require(_0xb7d5('0x2'));module['exports']={'name':{'type':Sequelize[_0xb7d5('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xb7d5('0x4')),'set':function(_0x43e547){if(_['isObjectLike'](_0x43e547)){this['setDataValue'](_0xb7d5('0x5'),JSON[_0xb7d5('0x6')](_0x43e547));}else if(_['isString'](_0x43e547)){this[_0xb7d5('0x7')]('formData',_0x43e547);}else{this[_0xb7d5('0x7')](_0xb7d5('0x5'),util[_0xb7d5('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xb7d5('0x9')]('name')||'',this['getDataValue'](_0xb7d5('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb7d5('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb7d5('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index f7b952d..2d40ea7 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 _0x6d51=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','createdAt','updatedAt','omit','getSessions','findOne','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','starttime','startTime','JscriptySessionReport','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','rimraf','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x546e26,_0x18fc24){var _0x4702e7=function(_0x96ba40){while(--_0x96ba40){_0x546e26['push'](_0x546e26['shift']());}};_0x4702e7(++_0x18fc24);}(_0x6d51,0x173));var _0x16d5=function(_0xfc6f76,_0x43044a){_0xfc6f76=_0xfc6f76-0x0;var _0xeaeef7=_0x6d51[_0xfc6f76];return _0xeaeef7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x16d5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x16d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x16d5('0x2'));var path=require(_0x16d5('0x3'));var sox=require(_0x16d5('0x4'));var csv=require(_0x16d5('0x5'));var ejs=require(_0x16d5('0x6'));var fs=require('fs');var _=require(_0x16d5('0x7'));var squel=require('squel');var crypto=require(_0x16d5('0x8'));var jsforce=require(_0x16d5('0x9'));var deskjs=require(_0x16d5('0xa'));var toCsv=require(_0x16d5('0x5'));var querystring=require(_0x16d5('0xb'));var Papa=require('papaparse');var Redis=require(_0x16d5('0xc'));var authService=require(_0x16d5('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x16d5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16d5('0xf'))(_0x16d5('0x10'));var utils=require(_0x16d5('0x11'));var config=require(_0x16d5('0x12'));var db=require(_0x16d5('0x13'))['db'];function respondWithStatusCode(_0x912b09,_0x1758e0){_0x1758e0=_0x1758e0||0xcc;return function(_0x3590c2){if(_0x3590c2){return _0x912b09['sendStatus'](_0x1758e0);}return _0x912b09[_0x16d5('0x14')](_0x1758e0)[_0x16d5('0x15')]();};}function respondWithResult(_0x19cbf7,_0x3cc650){_0x3cc650=_0x3cc650||0xc8;return function(_0x472825){if(_0x472825){return _0x19cbf7[_0x16d5('0x14')](_0x3cc650)[_0x16d5('0x16')](_0x472825);}};}function respondWithFilteredResult(_0x460a73,_0x1e6862){return function(_0x262329){if(_0x262329){var _0x4e72fd=_0x262329[_0x16d5('0x17')],_0x2407f0=_0x1e6862['offset'],_0x204d84=_0x1e6862[_0x16d5('0x18')]+_0x1e6862[_0x16d5('0x19')],_0x399c8e;if(_0x204d84>=_0x4e72fd){_0x204d84=_0x4e72fd;_0x399c8e=0xc8;}else{_0x399c8e=0xce;}_0x460a73['status'](_0x399c8e);return _0x460a73[_0x16d5('0x1a')](_0x16d5('0x1b'),_0x2407f0+'-'+_0x204d84+'/'+_0x4e72fd)[_0x16d5('0x16')](_0x262329);}return null;};}function patchUpdates(_0x25c3d2){return function(_0x2f0354){try{jsonpatch[_0x16d5('0x1c')](_0x2f0354,_0x25c3d2,!![]);}catch(_0x2e2e4d){return BPromise[_0x16d5('0x1d')](_0x2e2e4d);}return _0x2f0354[_0x16d5('0x1e')]();};}function saveUpdates(_0x1dc276,_0x568d49){return function(_0x147dc6){if(_0x147dc6){return _0x147dc6[_0x16d5('0x1f')](_0x1dc276)[_0x16d5('0x20')](function(_0xb678fe){return _0xb678fe;});}return null;};}function removeEntity(_0x5f4c55,_0x4d2883){return function(_0xfa0ea8){if(_0xfa0ea8){return _0xfa0ea8[_0x16d5('0x21')]()[_0x16d5('0x20')](function(){var _0xa4c542=_0xfa0ea8[_0x16d5('0x22')]({'plain':!![]});var _0x4a4ea6=_0x16d5('0x23');return db[_0x16d5('0x24')]['destroy']({'where':{'type':_0x4a4ea6,'resourceId':_0xa4c542['id']}})[_0x16d5('0x20')](function(){return _0xfa0ea8;});})[_0x16d5('0x20')](function(){_0x5f4c55[_0x16d5('0x14')](0xcc)[_0x16d5('0x15')]();});}};}function handleEntityNotFound(_0xd6ced4,_0x66ee0e){return function(_0x44db35){if(!_0x44db35){_0xd6ced4[_0x16d5('0x25')](0x194);}return _0x44db35;};}function handleError(_0x2b6c83,_0x4a204a){_0x4a204a=_0x4a204a||0x1f4;return function(_0xb64dc0){logger[_0x16d5('0x26')](_0xb64dc0[_0x16d5('0x27')]);if(_0xb64dc0[_0x16d5('0x28')]){delete _0xb64dc0['name'];}_0x2b6c83[_0x16d5('0x14')](_0x4a204a)[_0x16d5('0x29')](_0xb64dc0);};}exports[_0x16d5('0x2a')]=function(_0x316a19,_0xb7fbff){var _0x53715a={},_0x442861={},_0x15dbd5={'count':0x0,'rows':[]};var _0x4283bc=_[_0x16d5('0x2b')](db[_0x16d5('0x2c')]['rawAttributes'],function(_0x5b4fa0){return{'name':_0x5b4fa0[_0x16d5('0x2d')],'type':_0x5b4fa0[_0x16d5('0x2e')]['key']};});_0x442861[_0x16d5('0x2f')]=_[_0x16d5('0x2b')](_0x4283bc,_0x16d5('0x28'));_0x442861[_0x16d5('0x30')]=_[_0x16d5('0x31')](_0x316a19[_0x16d5('0x30')]);_0x442861[_0x16d5('0x32')]=_['intersection'](_0x442861[_0x16d5('0x2f')],_0x442861[_0x16d5('0x30')]);_0x53715a[_0x16d5('0x33')]=_[_0x16d5('0x34')](_0x442861[_0x16d5('0x2f')],qs[_0x16d5('0x35')](_0x316a19[_0x16d5('0x30')]['fields']));_0x53715a[_0x16d5('0x33')]=_0x53715a['attributes']['length']?_0x53715a[_0x16d5('0x33')]:_0x442861[_0x16d5('0x2f')];if(!_0x316a19[_0x16d5('0x30')][_0x16d5('0x36')](_0x16d5('0x37'))){_0x53715a[_0x16d5('0x19')]=qs[_0x16d5('0x19')](_0x316a19[_0x16d5('0x30')][_0x16d5('0x19')]);_0x53715a[_0x16d5('0x18')]=qs['offset'](_0x316a19[_0x16d5('0x30')]['offset']);}_0x53715a[_0x16d5('0x38')]=qs['sort'](_0x316a19[_0x16d5('0x30')][_0x16d5('0x39')]);_0x53715a['where']=qs[_0x16d5('0x32')](_[_0x16d5('0x3a')](_0x316a19[_0x16d5('0x30')],_0x442861[_0x16d5('0x32')]),_0x4283bc);if(_0x316a19[_0x16d5('0x30')][_0x16d5('0x3b')]){_0x53715a[_0x16d5('0x3c')]=_['merge'](_0x53715a['where'],{'$or':_['map'](_0x4283bc,function(_0x28a83b){if(_0x28a83b[_0x16d5('0x2e')]!==_0x16d5('0x3d')){var _0x558fe4={};_0x558fe4[_0x28a83b['name']]={'$like':'%'+_0x316a19[_0x16d5('0x30')][_0x16d5('0x3b')]+'%'};return _0x558fe4;}})});}_0x53715a=_[_0x16d5('0x3e')]({},_0x53715a,_0x316a19[_0x16d5('0x3f')]);var _0x1afe10={'where':_0x53715a[_0x16d5('0x3c')]};return db[_0x16d5('0x2c')]['count'](_0x1afe10)['then'](function(_0x5e41cb){_0x15dbd5[_0x16d5('0x17')]=_0x5e41cb;if(_0x316a19[_0x16d5('0x30')][_0x16d5('0x40')]){_0x53715a['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x16d5('0x41')](_0x53715a);})[_0x16d5('0x20')](function(_0x2ebb84){_0x15dbd5[_0x16d5('0x42')]=_0x2ebb84;return _0x15dbd5;})[_0x16d5('0x20')](respondWithFilteredResult(_0xb7fbff,_0x53715a))[_0x16d5('0x43')](handleError(_0xb7fbff,null));};exports['show']=function(_0x1dbbfb,_0x430c5d){var _0x47b653={'raw':![],'where':{'id':_0x1dbbfb[_0x16d5('0x44')]['id']}},_0x44606e={};_0x44606e[_0x16d5('0x2f')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x44606e['query']=_[_0x16d5('0x31')](_0x1dbbfb[_0x16d5('0x30')]);_0x44606e[_0x16d5('0x32')]=_[_0x16d5('0x34')](_0x44606e['model'],_0x44606e[_0x16d5('0x30')]);_0x47b653[_0x16d5('0x33')]=_[_0x16d5('0x34')](_0x44606e[_0x16d5('0x2f')],qs[_0x16d5('0x35')](_0x1dbbfb[_0x16d5('0x30')][_0x16d5('0x35')]));_0x47b653[_0x16d5('0x33')]=_0x47b653[_0x16d5('0x33')][_0x16d5('0x45')]?_0x47b653[_0x16d5('0x33')]:_0x44606e['model'];if(_0x1dbbfb[_0x16d5('0x30')][_0x16d5('0x40')]){_0x47b653[_0x16d5('0x46')]=[{'all':!![]}];}_0x47b653=_[_0x16d5('0x3e')]({},_0x47b653,_0x1dbbfb[_0x16d5('0x3f')]);return db[_0x16d5('0x2c')][_0x16d5('0x47')](_0x47b653)['then'](handleEntityNotFound(_0x430c5d,null))[_0x16d5('0x20')](respondWithResult(_0x430c5d,null))['catch'](handleError(_0x430c5d,null));};exports[_0x16d5('0x48')]=function(_0x14aa42,_0x160cf1){return db['JscriptyProject'][_0x16d5('0x48')](_0x14aa42[_0x16d5('0x49')],{})[_0x16d5('0x20')](function(_0x263df3){var _0x393f84=_0x14aa42[_0x16d5('0x4a')][_0x16d5('0x22')]({'plain':!![]});if(!_0x393f84)throw new Error(_0x16d5('0x4b'));if(_0x393f84[_0x16d5('0x4c')]===_0x16d5('0x4a')){var _0x58efec=_0x263df3[_0x16d5('0x22')]({'plain':!![]});var _0x2413be=_0x16d5('0x23');return db[_0x16d5('0x4d')][_0x16d5('0x47')]({'where':{'name':_0x2413be,'userProfileId':_0x393f84[_0x16d5('0x4e')]},'raw':!![]})[_0x16d5('0x20')](function(_0x240106){if(_0x240106&&_0x240106[_0x16d5('0x4f')]===0x0){return db[_0x16d5('0x24')][_0x16d5('0x48')]({'name':_0x58efec[_0x16d5('0x28')],'resourceId':_0x58efec['id'],'type':_0x240106[_0x16d5('0x28')],'sectionId':_0x240106['id']},{})[_0x16d5('0x20')](function(){return _0x263df3;});}else{return _0x263df3;}})[_0x16d5('0x43')](function(_0x5f00e5){logger[_0x16d5('0x26')](_0x16d5('0x50'),_0x5f00e5);throw _0x5f00e5;});}return _0x263df3;})['then'](respondWithResult(_0x160cf1,0xc9))['catch'](handleError(_0x160cf1,null));};exports[_0x16d5('0x51')]=function(_0x473904,_0x14fba1){var _0x369b6b={'where':{'id':_0x473904[_0x16d5('0x44')]['id']}},_0x5a36a7={};_0x5a36a7[_0x16d5('0x2f')]=_['keys'](db['JscriptyProject'][_0x16d5('0x52')]);_0x369b6b[_0x16d5('0x33')]=_[_0x16d5('0x34')](_0x5a36a7[_0x16d5('0x2f')],qs[_0x16d5('0x35')](_0x473904[_0x16d5('0x30')][_0x16d5('0x35')]));_0x369b6b[_0x16d5('0x33')]=_0x369b6b[_0x16d5('0x33')][_0x16d5('0x45')]?_0x369b6b[_0x16d5('0x33')]:_0x5a36a7[_0x16d5('0x2f')];if(_0x473904[_0x16d5('0x30')][_0x16d5('0x40')]){_0x369b6b[_0x16d5('0x46')]=[{'all':!![]}];}_0x369b6b=_[_0x16d5('0x3e')]({},_0x369b6b,_0x473904['options']);return db['JscriptyProject'][_0x16d5('0x47')](_0x369b6b)[_0x16d5('0x20')](handleEntityNotFound(_0x14fba1,null))[_0x16d5('0x20')](function(_0x8437f5){if(_0x8437f5){var _0x1ef4dd=_0x8437f5[_0x16d5('0x22')]({'plain':!![]});_0x1ef4dd=qs['omit'](_0x1ef4dd,['id',_0x16d5('0x53'),_0x16d5('0x54')]);_0x473904[_0x16d5('0x49')]=_[_0x16d5('0x55')](_0x473904[_0x16d5('0x49')],['id',_0x16d5('0x53'),_0x16d5('0x54')]);return db[_0x16d5('0x2c')]['create'](_[_0x16d5('0x3e')](_0x1ef4dd,_0x473904[_0x16d5('0x49')]),{'include':_0x473904[_0x16d5('0x30')][_0x16d5('0x40')]?[{'all':!![]}]:undefined})[_0x16d5('0x20')](function(_0x34c12f){var _0x49411d=_0x473904['user'][_0x16d5('0x22')]({'plain':!![]});if(!_0x49411d)throw new Error(_0x16d5('0x4b'));if(_0x49411d[_0x16d5('0x4c')]===_0x16d5('0x4a')){var _0x407d62=_0x34c12f['get']({'plain':!![]});var _0x199d4b='Projects';return db['UserProfileSection'][_0x16d5('0x47')]({'where':{'name':_0x199d4b,'userProfileId':_0x49411d[_0x16d5('0x4e')]},'raw':!![]})[_0x16d5('0x20')](function(_0x304829){if(_0x304829&&_0x304829[_0x16d5('0x4f')]===0x0){return db[_0x16d5('0x24')]['create']({'name':_0x407d62['name'],'resourceId':_0x407d62['id'],'type':_0x304829[_0x16d5('0x28')],'sectionId':_0x304829['id']},{})[_0x16d5('0x20')](function(){return _0x34c12f;});}else{return _0x34c12f;}})[_0x16d5('0x43')](function(_0x45cc6f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45cc6f);throw _0x45cc6f;});}return _0x34c12f;});}})[_0x16d5('0x20')](respondWithResult(_0x14fba1,0xc9))[_0x16d5('0x43')](handleError(_0x14fba1,null));};exports[_0x16d5('0x1f')]=function(_0x4e6579,_0x263271){if(_0x4e6579[_0x16d5('0x49')]['id']){delete _0x4e6579['body']['id'];}return db[_0x16d5('0x2c')]['find']({'where':{'id':_0x4e6579['params']['id']}})[_0x16d5('0x20')](handleEntityNotFound(_0x263271,null))[_0x16d5('0x20')](saveUpdates(_0x4e6579[_0x16d5('0x49')],null))[_0x16d5('0x20')](respondWithResult(_0x263271,null))[_0x16d5('0x43')](handleError(_0x263271,null));};exports[_0x16d5('0x21')]=function(_0x2db5ba,_0x1aff03){return db[_0x16d5('0x2c')][_0x16d5('0x47')]({'where':{'id':_0x2db5ba[_0x16d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aff03,null))['then'](removeEntity(_0x1aff03,null))[_0x16d5('0x43')](handleError(_0x1aff03,null));};exports[_0x16d5('0x56')]=function(_0xcb9a18,_0x3197fb,_0x143f1f){var _0x30fc31={'raw':!![],'where':{}};var _0xa52688={};var _0x196b4d={'count':0x0,'rows':[]};return db[_0x16d5('0x2c')][_0x16d5('0x57')]({'where':{'id':_0xcb9a18[_0x16d5('0x44')]['id']}})[_0x16d5('0x20')](handleEntityNotFound(_0x3197fb,null))[_0x16d5('0x20')](function(_0x8bea07){if(_0x8bea07){_0xa52688[_0x16d5('0x2f')]=_[_0x16d5('0x31')](db['JscriptySessionReport'][_0x16d5('0x52')]);_0xa52688[_0x16d5('0x30')]=_[_0x16d5('0x31')](_0xcb9a18[_0x16d5('0x30')]);_0xa52688['filters']=_[_0x16d5('0x34')](_0xa52688[_0x16d5('0x2f')],_0xa52688['query']);_0x30fc31['attributes']=_[_0x16d5('0x34')](_0xa52688[_0x16d5('0x2f')],qs['fields'](_0xcb9a18[_0x16d5('0x30')][_0x16d5('0x35')]));_0x30fc31[_0x16d5('0x33')]=_0x30fc31[_0x16d5('0x33')]['length']?_0x30fc31[_0x16d5('0x33')]:_0xa52688[_0x16d5('0x2f')];if(!_0xcb9a18[_0x16d5('0x30')][_0x16d5('0x36')](_0x16d5('0x37'))){_0x30fc31['limit']=qs[_0x16d5('0x19')](_0xcb9a18['query'][_0x16d5('0x19')]);_0x30fc31[_0x16d5('0x18')]=qs[_0x16d5('0x18')](_0xcb9a18[_0x16d5('0x30')][_0x16d5('0x18')]);}_0x30fc31[_0x16d5('0x38')]=qs[_0x16d5('0x39')](_0xcb9a18[_0x16d5('0x30')][_0x16d5('0x39')]);_0x30fc31['where']=qs[_0x16d5('0x32')](_[_0x16d5('0x3a')](_0xcb9a18['query'],_0xa52688[_0x16d5('0x32')]));_0x30fc31['where'][_0x16d5('0x58')]=_0x8bea07['id'];if(_0xcb9a18[_0x16d5('0x30')]['filter']){_0x30fc31[_0x16d5('0x3c')]=_[_0x16d5('0x3e')](_0x30fc31[_0x16d5('0x3c')],{'$or':_[_0x16d5('0x2b')](_0x30fc31[_0x16d5('0x33')],function(_0x5673d1){var _0x5dfdf3={};_0x5dfdf3[_0x5673d1]={'$like':'%'+_0xcb9a18[_0x16d5('0x30')]['filter']+'%'};return _0x5dfdf3;})});}_0x30fc31=_['merge']({},_0x30fc31,_0xcb9a18['options']);return db['JscriptySessionReport']['count']({'where':_0x30fc31['where']})[_0x16d5('0x20')](function(_0x44ef5b){_0x196b4d[_0x16d5('0x17')]=_0x44ef5b;if(_0xcb9a18['query']['includeAll']){_0x30fc31['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x30fc31);})['then'](function(_0x16c01b){_0x196b4d[_0x16d5('0x42')]=_0x16c01b;return _0x196b4d;});}})[_0x16d5('0x20')](respondWithFilteredResult(_0x3197fb,_0x30fc31))[_0x16d5('0x43')](handleError(_0x3197fb,null));};exports['getAnswers']=function(_0x3ecc3d,_0x29aba9,_0x32241b){var _0x17ac10={'raw':!![],'where':{}};var _0x4c141e={};var _0x6d1701={'count':0x0,'rows':[]};return db[_0x16d5('0x2c')][_0x16d5('0x57')]({'where':{'id':_0x3ecc3d[_0x16d5('0x44')]['id']}})[_0x16d5('0x20')](handleEntityNotFound(_0x29aba9,null))[_0x16d5('0x20')](function(_0x3cb7f9){if(_0x3cb7f9){_0x4c141e['model']=_[_0x16d5('0x31')](db[_0x16d5('0x59')]['rawAttributes']);_0x4c141e[_0x16d5('0x30')]=_[_0x16d5('0x31')](_0x3ecc3d[_0x16d5('0x30')]);_0x4c141e[_0x16d5('0x32')]=_[_0x16d5('0x34')](_0x4c141e[_0x16d5('0x2f')],_0x4c141e[_0x16d5('0x30')]);_0x17ac10['attributes']=_[_0x16d5('0x34')](_0x4c141e[_0x16d5('0x2f')],qs['fields'](_0x3ecc3d['query'][_0x16d5('0x35')]));_0x17ac10['attributes']=_0x17ac10[_0x16d5('0x33')][_0x16d5('0x45')]?_0x17ac10[_0x16d5('0x33')]:_0x4c141e[_0x16d5('0x2f')];if(!_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x36')](_0x16d5('0x37'))){_0x17ac10['limit']=qs[_0x16d5('0x19')](_0x3ecc3d[_0x16d5('0x30')]['limit']);_0x17ac10[_0x16d5('0x18')]=qs[_0x16d5('0x18')](_0x3ecc3d[_0x16d5('0x30')]['offset']);}_0x17ac10[_0x16d5('0x38')]=qs[_0x16d5('0x39')](_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x39')]);_0x17ac10['where']=qs[_0x16d5('0x32')](_[_0x16d5('0x3a')](_0x3ecc3d[_0x16d5('0x30')],_0x4c141e['filters']));_0x17ac10['where'][_0x16d5('0x58')]=_0x3cb7f9['id'];if(_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x3b')]){_0x17ac10['where']=_[_0x16d5('0x3e')](_0x17ac10['where'],{'$or':_['map'](_0x17ac10['attributes'],function(_0x4ea24c){var _0x3f5532={};_0x3f5532[_0x4ea24c]={'$like':'%'+_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x3b')]+'%'};return _0x3f5532;})});}_0x17ac10=_[_0x16d5('0x3e')]({},_0x17ac10,_0x3ecc3d[_0x16d5('0x3f')]);return db[_0x16d5('0x59')][_0x16d5('0x17')]({'where':_0x17ac10['where']})[_0x16d5('0x20')](function(_0x1ff55d){_0x6d1701[_0x16d5('0x17')]=_0x1ff55d;if(_0x3ecc3d[_0x16d5('0x30')][_0x16d5('0x40')]){_0x17ac10[_0x16d5('0x46')]=[{'all':!![]}];}return db[_0x16d5('0x59')][_0x16d5('0x41')](_0x17ac10);})[_0x16d5('0x20')](function(_0xf2d522){_0x6d1701['rows']=_0xf2d522;return _0x6d1701;});}})['then'](respondWithFilteredResult(_0x29aba9,_0x17ac10))[_0x16d5('0x43')](handleError(_0x29aba9,null));};function char(_0x192e40){return _0x16d5('0x5a')===typeof _0x192e40?String[_0x16d5('0x5b')][_0x16d5('0x1c')](null,arguments):_0x192e40;}function needsEncapsulation(_0x27cbe9){return!!_0x27cbe9&&(_0x27cbe9[_0x16d5('0x5c')]()[_0x16d5('0x5d')](char(0xd))>=0x0||_0x27cbe9['toString']()['indexOf'](char(0xa))>=0x0||_0x27cbe9[_0x16d5('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x27cbe9[_0x16d5('0x5c')]()[_0x16d5('0x5d')](char(0x22))>=0x0);}function encapsulate(_0xa50dec){var _0x4e3f0a=char(0x22),_0x3dd25c='\x5c'+char(0x22),_0x28f27e=_0xa50dec[_0x16d5('0x5c')]()['replace'](new RegExp(_0x4e3f0a,'g'),_0x3dd25c);return _0x4e3f0a+_0x28f27e+_0x4e3f0a;}exports[_0x16d5('0x5e')]=function(_0x127fd5,_0x30460e,_0x236a3d){var _0x1c579a,_0x361dd6;var _0xa318db={'where':{'ProjectId':_0x127fd5[_0x16d5('0x44')]['id']}};if(_0x127fd5[_0x16d5('0x30')]['startTime']){_0xa318db[_0x16d5('0x3c')][_0x16d5('0x5f')]=JSON['parse'](_0x127fd5[_0x16d5('0x30')][_0x16d5('0x60')]);}return db[_0x16d5('0x61')][_0x16d5('0x41')](_0xa318db)[_0x16d5('0x20')](handleEntityNotFound(_0x30460e,null))[_0x16d5('0x20')](function(_0x4e178a){if(_0x4e178a){_0x1c579a=_0x4e178a;return db[_0x16d5('0x62')]['findAll']({'where':{'SessionId':{'$in':_[_0x16d5('0x2b')](_0x1c579a,'id')},'ProjectId':_0x127fd5[_0x16d5('0x44')]['id']},'order':_0x16d5('0x63')});}})[_0x16d5('0x20')](handleEntityNotFound(_0x30460e,null))[_0x16d5('0x20')](function(_0x34253b){if(_0x34253b){_0x361dd6=_0x34253b;var _0x1f7e11={};for(var _0x55ea61=0x0,_0x5b3c73=_0x361dd6[_0x16d5('0x45')];_0x55ea61<_0x5b3c73;_0x55ea61++){if(!_0x1f7e11['hasOwnProperty'](_0x361dd6[_0x55ea61]['questionId'])){_0x1f7e11[_0x361dd6[_0x55ea61][_0x16d5('0x64')]]=needsEncapsulation(_0x361dd6[_0x55ea61][_0x16d5('0x65')])?encapsulate(_0x361dd6[_0x55ea61][_0x16d5('0x65')]):_0x361dd6[_0x55ea61][_0x16d5('0x65')];}}var _0x475634=[],_0x20067e={};for(var _0xac2730=0x0,_0xa7a5cd=_0x1c579a[_0x16d5('0x45')];_0xac2730<_0xa7a5cd;_0xac2730++){_0x20067e={'ProjectId':_0x127fd5[_0x16d5('0x44')]['id'],'SessionId':_0x1c579a[_0xac2730]['id'],'StartTime':moment(_0x1c579a[_0xac2730][_0x16d5('0x5f')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x59a4d2=0x0,_0x55519d=_0x361dd6[_0x16d5('0x45')];_0x59a4d2<_0x55519d;_0x59a4d2++){if(_0x361dd6[_0x59a4d2][_0x16d5('0x66')]==_0x1c579a[_0xac2730]['id']&&_0x1f7e11[_0x16d5('0x36')](_0x361dd6[_0x59a4d2][_0x16d5('0x64')])){_0x20067e[_0x1f7e11[_0x361dd6[_0x59a4d2][_0x16d5('0x64')]]]=_0x361dd6[_0x59a4d2][_0x16d5('0x67')];}}for(var _0x49ea0a in _0x1f7e11){if(!_0x20067e['hasOwnProperty'](_0x1f7e11[_0x49ea0a])){_0x20067e[_0x1f7e11[_0x49ea0a]]=null;}}_0x475634['push'](_0x20067e);}return _0x475634;}})[_0x16d5('0x20')](function(_0x46769e){if(!_[_0x16d5('0x68')](_0x46769e)){var _0x345988=toCsv(_0x46769e);var _0x22ab91=Date['now']();fs[_0x16d5('0x69')](util[_0x16d5('0x6a')](_0x16d5('0x6b'),_0x127fd5[_0x16d5('0x44')]['id'],_0x22ab91),_0x345988);_0x30460e[_0x16d5('0x6c')](_0x16d5('0x6d'),_0x16d5('0x6e')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x127fd5['params']['id'],_0x22ab91));_0x30460e[_0x16d5('0x6c')](_0x16d5('0x6f'),'text/csv');return _0x30460e['download'](util[_0x16d5('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x127fd5[_0x16d5('0x44')]['id'],_0x22ab91));}else{return _0x30460e[_0x16d5('0x25')](0xcc);}})[_0x16d5('0x43')](handleError(_0x30460e,null));}; \ No newline at end of file +var _0x1917=['push','now','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','Projects','UserProfileResource','end','stack','name','send','map','JscriptyProject','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','params','omit','updatedAt','createdAt','error','findOne','JscriptySessionReport','rows','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','getSummary','parse','startTime','JscriptyQuestionReport','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer'];(function(_0x5e1f0f,_0x45a0e7){var _0x99c34a=function(_0x66dbdb){while(--_0x66dbdb){_0x5e1f0f['push'](_0x5e1f0f['shift']());}};_0x99c34a(++_0x45a0e7);}(_0x1917,0xf2));var _0x7191=function(_0x29d0f0,_0x2282c0){_0x29d0f0=_0x29d0f0-0x0;var _0x1ae6f0=_0x1917[_0x29d0f0];return _0x1ae6f0;};'use strict';var pdf=require(_0x7191('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7191('0x1'));var zipdir=require(_0x7191('0x2'));var jsonpatch=require(_0x7191('0x3'));var rp=require(_0x7191('0x4'));var moment=require('moment');var BPromise=require(_0x7191('0x5'));var Mustache=require(_0x7191('0x6'));var util=require(_0x7191('0x7'));var path=require('path');var sox=require(_0x7191('0x8'));var csv=require(_0x7191('0x9'));var ejs=require(_0x7191('0xa'));var fs=require('fs');var _=require(_0x7191('0xb'));var squel=require('squel');var crypto=require(_0x7191('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7191('0xd'));var toCsv=require(_0x7191('0x9'));var querystring=require(_0x7191('0xe'));var Papa=require(_0x7191('0xf'));var Redis=require(_0x7191('0x10'));var authService=require(_0x7191('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7191('0x12'));var hardwareService=require(_0x7191('0x13'));var logger=require(_0x7191('0x14'))('api');var utils=require(_0x7191('0x15'));var config=require(_0x7191('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x325800,_0x5d6b15){_0x5d6b15=_0x5d6b15||0xcc;return function(_0x204561){if(_0x204561){return _0x325800['sendStatus'](_0x5d6b15);}return _0x325800[_0x7191('0x17')](_0x5d6b15)['end']();};}function respondWithResult(_0xd750f2,_0x35a44e){_0x35a44e=_0x35a44e||0xc8;return function(_0x28c3df){if(_0x28c3df){return _0xd750f2[_0x7191('0x17')](_0x35a44e)['json'](_0x28c3df);}};}function respondWithFilteredResult(_0x4aee55,_0x4eb8bf){return function(_0x5cbf24){if(_0x5cbf24){var _0xd21514=_0x5cbf24['count'],_0x162361=_0x4eb8bf['offset'],_0x169557=_0x4eb8bf[_0x7191('0x18')]+_0x4eb8bf[_0x7191('0x19')],_0x144db5;if(_0x169557>=_0xd21514){_0x169557=_0xd21514;_0x144db5=0xc8;}else{_0x144db5=0xce;}_0x4aee55[_0x7191('0x17')](_0x144db5);return _0x4aee55[_0x7191('0x1a')](_0x7191('0x1b'),_0x162361+'-'+_0x169557+'/'+_0xd21514)[_0x7191('0x1c')](_0x5cbf24);}return null;};}function patchUpdates(_0x381723){return function(_0x3e47cc){try{jsonpatch[_0x7191('0x1d')](_0x3e47cc,_0x381723,!![]);}catch(_0x30b108){return BPromise[_0x7191('0x1e')](_0x30b108);}return _0x3e47cc[_0x7191('0x1f')]();};}function saveUpdates(_0x20624c,_0x3ebff0){return function(_0x1a693d){if(_0x1a693d){return _0x1a693d[_0x7191('0x20')](_0x20624c)['then'](function(_0x3c24b9){return _0x3c24b9;});}return null;};}function removeEntity(_0xea45e2,_0x35ab0){return function(_0x1ca370){if(_0x1ca370){return _0x1ca370['destroy']()[_0x7191('0x21')](function(){var _0x549780=_0x1ca370[_0x7191('0x22')]({'plain':!![]});var _0x5a4962=_0x7191('0x23');return db[_0x7191('0x24')]['destroy']({'where':{'type':_0x5a4962,'resourceId':_0x549780['id']}})[_0x7191('0x21')](function(){return _0x1ca370;});})[_0x7191('0x21')](function(){_0xea45e2[_0x7191('0x17')](0xcc)[_0x7191('0x25')]();});}};}function handleEntityNotFound(_0x204a3a,_0x1d9d9d){return function(_0x320f47){if(!_0x320f47){_0x204a3a['sendStatus'](0x194);}return _0x320f47;};}function handleError(_0x584450,_0x5d5916){_0x5d5916=_0x5d5916||0x1f4;return function(_0x3ccaec){logger['error'](_0x3ccaec[_0x7191('0x26')]);if(_0x3ccaec[_0x7191('0x27')]){delete _0x3ccaec[_0x7191('0x27')];}_0x584450[_0x7191('0x17')](_0x5d5916)[_0x7191('0x28')](_0x3ccaec);};}exports['index']=function(_0x327c59,_0x1b9eea){var _0xad2a4b={},_0x5a9d21={},_0x2a09de={'count':0x0,'rows':[]};var _0x1d30dd=_[_0x7191('0x29')](db[_0x7191('0x2a')][_0x7191('0x2b')],function(_0x17b2e3){return{'name':_0x17b2e3['fieldName'],'type':_0x17b2e3[_0x7191('0x2c')][_0x7191('0x2d')]};});_0x5a9d21[_0x7191('0x2e')]=_[_0x7191('0x29')](_0x1d30dd,_0x7191('0x27'));_0x5a9d21[_0x7191('0x2f')]=_[_0x7191('0x30')](_0x327c59[_0x7191('0x2f')]);_0x5a9d21[_0x7191('0x31')]=_[_0x7191('0x32')](_0x5a9d21[_0x7191('0x2e')],_0x5a9d21[_0x7191('0x2f')]);_0xad2a4b['attributes']=_[_0x7191('0x32')](_0x5a9d21[_0x7191('0x2e')],qs[_0x7191('0x33')](_0x327c59[_0x7191('0x2f')][_0x7191('0x33')]));_0xad2a4b[_0x7191('0x34')]=_0xad2a4b['attributes'][_0x7191('0x35')]?_0xad2a4b['attributes']:_0x5a9d21[_0x7191('0x2e')];if(!_0x327c59[_0x7191('0x2f')][_0x7191('0x36')](_0x7191('0x37'))){_0xad2a4b['limit']=qs[_0x7191('0x19')](_0x327c59[_0x7191('0x2f')][_0x7191('0x19')]);_0xad2a4b['offset']=qs[_0x7191('0x18')](_0x327c59[_0x7191('0x2f')][_0x7191('0x18')]);}_0xad2a4b[_0x7191('0x38')]=qs[_0x7191('0x39')](_0x327c59[_0x7191('0x2f')][_0x7191('0x39')]);_0xad2a4b[_0x7191('0x3a')]=qs[_0x7191('0x31')](_[_0x7191('0x3b')](_0x327c59[_0x7191('0x2f')],_0x5a9d21[_0x7191('0x31')]),_0x1d30dd);if(_0x327c59[_0x7191('0x2f')][_0x7191('0x3c')]){_0xad2a4b[_0x7191('0x3a')]=_['merge'](_0xad2a4b[_0x7191('0x3a')],{'$or':_[_0x7191('0x29')](_0x1d30dd,function(_0x514820){if(_0x514820['type']!=='VIRTUAL'){var _0xb3fe1d={};_0xb3fe1d[_0x514820[_0x7191('0x27')]]={'$like':'%'+_0x327c59['query'][_0x7191('0x3c')]+'%'};return _0xb3fe1d;}})});}_0xad2a4b=_[_0x7191('0x3d')]({},_0xad2a4b,_0x327c59[_0x7191('0x3e')]);var _0x5e7f86={'where':_0xad2a4b[_0x7191('0x3a')]};return db[_0x7191('0x2a')][_0x7191('0x3f')](_0x5e7f86)['then'](function(_0x3f29b2){_0x2a09de[_0x7191('0x3f')]=_0x3f29b2;if(_0x327c59[_0x7191('0x2f')][_0x7191('0x40')]){_0xad2a4b['include']=[{'all':!![]}];}return db[_0x7191('0x2a')][_0x7191('0x41')](_0xad2a4b);})[_0x7191('0x21')](function(_0x278da3){_0x2a09de['rows']=_0x278da3;return _0x2a09de;})['then'](respondWithFilteredResult(_0x1b9eea,_0xad2a4b))['catch'](handleError(_0x1b9eea,null));};exports[_0x7191('0x42')]=function(_0x2a3794,_0x4d3edf){var _0x2dd0c3={'raw':![],'where':{'id':_0x2a3794['params']['id']}},_0x53665d={};_0x53665d[_0x7191('0x2e')]=_[_0x7191('0x30')](db[_0x7191('0x2a')][_0x7191('0x2b')]);_0x53665d['query']=_[_0x7191('0x30')](_0x2a3794[_0x7191('0x2f')]);_0x53665d[_0x7191('0x31')]=_[_0x7191('0x32')](_0x53665d[_0x7191('0x2e')],_0x53665d[_0x7191('0x2f')]);_0x2dd0c3['attributes']=_['intersection'](_0x53665d[_0x7191('0x2e')],qs[_0x7191('0x33')](_0x2a3794['query']['fields']));_0x2dd0c3['attributes']=_0x2dd0c3[_0x7191('0x34')]['length']?_0x2dd0c3[_0x7191('0x34')]:_0x53665d['model'];if(_0x2a3794[_0x7191('0x2f')][_0x7191('0x40')]){_0x2dd0c3[_0x7191('0x43')]=[{'all':!![]}];}_0x2dd0c3=_[_0x7191('0x3d')]({},_0x2dd0c3,_0x2a3794[_0x7191('0x3e')]);return db[_0x7191('0x2a')][_0x7191('0x44')](_0x2dd0c3)[_0x7191('0x21')](handleEntityNotFound(_0x4d3edf,null))[_0x7191('0x21')](respondWithResult(_0x4d3edf,null))[_0x7191('0x45')](handleError(_0x4d3edf,null));};exports[_0x7191('0x46')]=function(_0x21538a,_0x3e5c6d){return db['JscriptyProject'][_0x7191('0x46')](_0x21538a[_0x7191('0x47')],{})[_0x7191('0x21')](function(_0x236bff){var _0x5cbd86=_0x21538a[_0x7191('0x48')]['get']({'plain':!![]});if(!_0x5cbd86)throw new Error(_0x7191('0x49'));if(_0x5cbd86[_0x7191('0x4a')]==='user'){var _0x320667=_0x236bff[_0x7191('0x22')]({'plain':!![]});var _0x481e96=_0x7191('0x23');return db['UserProfileSection'][_0x7191('0x44')]({'where':{'name':_0x481e96,'userProfileId':_0x5cbd86[_0x7191('0x4b')]},'raw':!![]})[_0x7191('0x21')](function(_0x277301){if(_0x277301&&_0x277301[_0x7191('0x4c')]===0x0){return db[_0x7191('0x24')][_0x7191('0x46')]({'name':_0x320667[_0x7191('0x27')],'resourceId':_0x320667['id'],'type':_0x277301['name'],'sectionId':_0x277301['id']},{})[_0x7191('0x21')](function(){return _0x236bff;});}else{return _0x236bff;}})[_0x7191('0x45')](function(_0x29d844){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29d844);throw _0x29d844;});}return _0x236bff;})['then'](respondWithResult(_0x3e5c6d,0xc9))[_0x7191('0x45')](handleError(_0x3e5c6d,null));};exports[_0x7191('0x4d')]=function(_0x49d8ea,_0x2d015d){var _0x32e0c6={'where':{'id':_0x49d8ea[_0x7191('0x4e')]['id']}},_0x403947={};_0x403947['model']=_[_0x7191('0x30')](db[_0x7191('0x2a')][_0x7191('0x2b')]);_0x32e0c6[_0x7191('0x34')]=_[_0x7191('0x32')](_0x403947[_0x7191('0x2e')],qs[_0x7191('0x33')](_0x49d8ea[_0x7191('0x2f')][_0x7191('0x33')]));_0x32e0c6[_0x7191('0x34')]=_0x32e0c6['attributes'][_0x7191('0x35')]?_0x32e0c6['attributes']:_0x403947[_0x7191('0x2e')];if(_0x49d8ea[_0x7191('0x2f')][_0x7191('0x40')]){_0x32e0c6['include']=[{'all':!![]}];}_0x32e0c6=_[_0x7191('0x3d')]({},_0x32e0c6,_0x49d8ea['options']);return db[_0x7191('0x2a')][_0x7191('0x44')](_0x32e0c6)[_0x7191('0x21')](handleEntityNotFound(_0x2d015d,null))[_0x7191('0x21')](function(_0x4d6d40){if(_0x4d6d40){var _0x15afe8=_0x4d6d40[_0x7191('0x22')]({'plain':!![]});_0x15afe8=qs[_0x7191('0x4f')](_0x15afe8,['id','createdAt',_0x7191('0x50')]);_0x49d8ea[_0x7191('0x47')]=_[_0x7191('0x4f')](_0x49d8ea['body'],['id',_0x7191('0x51'),_0x7191('0x50')]);return db[_0x7191('0x2a')]['create'](_[_0x7191('0x3d')](_0x15afe8,_0x49d8ea['body']),{'include':_0x49d8ea[_0x7191('0x2f')][_0x7191('0x40')]?[{'all':!![]}]:undefined})[_0x7191('0x21')](function(_0x55c458){var _0x2dd03a=_0x49d8ea[_0x7191('0x48')][_0x7191('0x22')]({'plain':!![]});if(!_0x2dd03a)throw new Error(_0x7191('0x49'));if(_0x2dd03a[_0x7191('0x4a')]==='user'){var _0x5efe5e=_0x55c458[_0x7191('0x22')]({'plain':!![]});var _0x5a214f=_0x7191('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x5a214f,'userProfileId':_0x2dd03a['userProfileId']},'raw':!![]})['then'](function(_0x4daca3){if(_0x4daca3&&_0x4daca3[_0x7191('0x4c')]===0x0){return db[_0x7191('0x24')][_0x7191('0x46')]({'name':_0x5efe5e[_0x7191('0x27')],'resourceId':_0x5efe5e['id'],'type':_0x4daca3[_0x7191('0x27')],'sectionId':_0x4daca3['id']},{})['then'](function(){return _0x55c458;});}else{return _0x55c458;}})[_0x7191('0x45')](function(_0x247849){logger[_0x7191('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x247849);throw _0x247849;});}return _0x55c458;});}})[_0x7191('0x21')](respondWithResult(_0x2d015d,0xc9))['catch'](handleError(_0x2d015d,null));};exports[_0x7191('0x20')]=function(_0x95fe15,_0xe64828){if(_0x95fe15['body']['id']){delete _0x95fe15[_0x7191('0x47')]['id'];}return db[_0x7191('0x2a')]['find']({'where':{'id':_0x95fe15['params']['id']}})[_0x7191('0x21')](handleEntityNotFound(_0xe64828,null))[_0x7191('0x21')](saveUpdates(_0x95fe15['body'],null))[_0x7191('0x21')](respondWithResult(_0xe64828,null))[_0x7191('0x45')](handleError(_0xe64828,null));};exports['destroy']=function(_0x545c92,_0x3d41b3){return db[_0x7191('0x2a')]['find']({'where':{'id':_0x545c92[_0x7191('0x4e')]['id']}})[_0x7191('0x21')](handleEntityNotFound(_0x3d41b3,null))['then'](removeEntity(_0x3d41b3,null))[_0x7191('0x45')](handleError(_0x3d41b3,null));};exports['getSessions']=function(_0x4296a8,_0x55d62a,_0x2a4e4){var _0x11bbae={'raw':!![],'where':{}};var _0x504788={};var _0x39ac04={'count':0x0,'rows':[]};return db[_0x7191('0x2a')][_0x7191('0x53')]({'where':{'id':_0x4296a8[_0x7191('0x4e')]['id']}})[_0x7191('0x21')](handleEntityNotFound(_0x55d62a,null))[_0x7191('0x21')](function(_0x154d5d){if(_0x154d5d){_0x504788['model']=_[_0x7191('0x30')](db[_0x7191('0x54')][_0x7191('0x2b')]);_0x504788['query']=_[_0x7191('0x30')](_0x4296a8[_0x7191('0x2f')]);_0x504788['filters']=_[_0x7191('0x32')](_0x504788[_0x7191('0x2e')],_0x504788[_0x7191('0x2f')]);_0x11bbae[_0x7191('0x34')]=_[_0x7191('0x32')](_0x504788[_0x7191('0x2e')],qs[_0x7191('0x33')](_0x4296a8[_0x7191('0x2f')][_0x7191('0x33')]));_0x11bbae[_0x7191('0x34')]=_0x11bbae['attributes']['length']?_0x11bbae['attributes']:_0x504788[_0x7191('0x2e')];if(!_0x4296a8['query']['hasOwnProperty'](_0x7191('0x37'))){_0x11bbae[_0x7191('0x19')]=qs[_0x7191('0x19')](_0x4296a8[_0x7191('0x2f')][_0x7191('0x19')]);_0x11bbae['offset']=qs[_0x7191('0x18')](_0x4296a8['query'][_0x7191('0x18')]);}_0x11bbae[_0x7191('0x38')]=qs[_0x7191('0x39')](_0x4296a8['query'][_0x7191('0x39')]);_0x11bbae[_0x7191('0x3a')]=qs[_0x7191('0x31')](_[_0x7191('0x3b')](_0x4296a8[_0x7191('0x2f')],_0x504788[_0x7191('0x31')]));_0x11bbae[_0x7191('0x3a')]['ProjectId']=_0x154d5d['id'];if(_0x4296a8[_0x7191('0x2f')]['filter']){_0x11bbae[_0x7191('0x3a')]=_[_0x7191('0x3d')](_0x11bbae[_0x7191('0x3a')],{'$or':_[_0x7191('0x29')](_0x11bbae[_0x7191('0x34')],function(_0xd1aec2){var _0x12cc78={};_0x12cc78[_0xd1aec2]={'$like':'%'+_0x4296a8[_0x7191('0x2f')][_0x7191('0x3c')]+'%'};return _0x12cc78;})});}_0x11bbae=_[_0x7191('0x3d')]({},_0x11bbae,_0x4296a8['options']);return db[_0x7191('0x54')]['count']({'where':_0x11bbae['where']})[_0x7191('0x21')](function(_0x62ae9a){_0x39ac04['count']=_0x62ae9a;if(_0x4296a8[_0x7191('0x2f')]['includeAll']){_0x11bbae[_0x7191('0x43')]=[{'all':!![]}];}return db[_0x7191('0x54')][_0x7191('0x41')](_0x11bbae);})[_0x7191('0x21')](function(_0x4e33c8){_0x39ac04[_0x7191('0x55')]=_0x4e33c8;return _0x39ac04;});}})[_0x7191('0x21')](respondWithFilteredResult(_0x55d62a,_0x11bbae))[_0x7191('0x45')](handleError(_0x55d62a,null));};exports['getAnswers']=function(_0x504189,_0x112e01,_0x5301cb){var _0x1efec8={'raw':!![],'where':{}};var _0x52ed62={};var _0x40fc80={'count':0x0,'rows':[]};return db[_0x7191('0x2a')]['findOne']({'where':{'id':_0x504189[_0x7191('0x4e')]['id']}})[_0x7191('0x21')](handleEntityNotFound(_0x112e01,null))[_0x7191('0x21')](function(_0x314cb3){if(_0x314cb3){_0x52ed62[_0x7191('0x2e')]=_[_0x7191('0x30')](db[_0x7191('0x56')][_0x7191('0x2b')]);_0x52ed62['query']=_['keys'](_0x504189[_0x7191('0x2f')]);_0x52ed62[_0x7191('0x31')]=_[_0x7191('0x32')](_0x52ed62[_0x7191('0x2e')],_0x52ed62[_0x7191('0x2f')]);_0x1efec8[_0x7191('0x34')]=_[_0x7191('0x32')](_0x52ed62[_0x7191('0x2e')],qs['fields'](_0x504189['query'][_0x7191('0x33')]));_0x1efec8['attributes']=_0x1efec8[_0x7191('0x34')]['length']?_0x1efec8[_0x7191('0x34')]:_0x52ed62[_0x7191('0x2e')];if(!_0x504189[_0x7191('0x2f')]['hasOwnProperty'](_0x7191('0x37'))){_0x1efec8['limit']=qs[_0x7191('0x19')](_0x504189[_0x7191('0x2f')][_0x7191('0x19')]);_0x1efec8['offset']=qs[_0x7191('0x18')](_0x504189[_0x7191('0x2f')][_0x7191('0x18')]);}_0x1efec8[_0x7191('0x38')]=qs[_0x7191('0x39')](_0x504189['query'][_0x7191('0x39')]);_0x1efec8['where']=qs[_0x7191('0x31')](_['pick'](_0x504189['query'],_0x52ed62[_0x7191('0x31')]));_0x1efec8[_0x7191('0x3a')][_0x7191('0x57')]=_0x314cb3['id'];if(_0x504189[_0x7191('0x2f')][_0x7191('0x3c')]){_0x1efec8[_0x7191('0x3a')]=_[_0x7191('0x3d')](_0x1efec8[_0x7191('0x3a')],{'$or':_[_0x7191('0x29')](_0x1efec8[_0x7191('0x34')],function(_0x132960){var _0xe635da={};_0xe635da[_0x132960]={'$like':'%'+_0x504189['query'][_0x7191('0x3c')]+'%'};return _0xe635da;})});}_0x1efec8=_[_0x7191('0x3d')]({},_0x1efec8,_0x504189[_0x7191('0x3e')]);return db[_0x7191('0x56')][_0x7191('0x3f')]({'where':_0x1efec8[_0x7191('0x3a')]})[_0x7191('0x21')](function(_0x2dd198){_0x40fc80[_0x7191('0x3f')]=_0x2dd198;if(_0x504189[_0x7191('0x2f')][_0x7191('0x40')]){_0x1efec8[_0x7191('0x43')]=[{'all':!![]}];}return db[_0x7191('0x56')][_0x7191('0x41')](_0x1efec8);})[_0x7191('0x21')](function(_0x30c0e8){_0x40fc80[_0x7191('0x55')]=_0x30c0e8;return _0x40fc80;});}})[_0x7191('0x21')](respondWithFilteredResult(_0x112e01,_0x1efec8))[_0x7191('0x45')](handleError(_0x112e01,null));};function char(_0x581304){return _0x7191('0x58')===typeof _0x581304?String[_0x7191('0x59')]['apply'](null,arguments):_0x581304;}function needsEncapsulation(_0x247b09){return!!_0x247b09&&(_0x247b09[_0x7191('0x5a')]()[_0x7191('0x5b')](char(0xd))>=0x0||_0x247b09[_0x7191('0x5a')]()[_0x7191('0x5b')](char(0xa))>=0x0||_0x247b09[_0x7191('0x5a')]()[_0x7191('0x5b')](char(0x2c))>=0x0||_0x247b09[_0x7191('0x5a')]()[_0x7191('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x8d276a){var _0x1ee345=char(0x22),_0x3e9c55='\x5c'+char(0x22),_0x139743=_0x8d276a[_0x7191('0x5a')]()['replace'](new RegExp(_0x1ee345,'g'),_0x3e9c55);return _0x1ee345+_0x139743+_0x1ee345;}exports[_0x7191('0x5c')]=function(_0x390a7a,_0x3fe870,_0x4bf439){var _0x343344,_0x382b93;var _0x340371={'where':{'ProjectId':_0x390a7a[_0x7191('0x4e')]['id']}};if(_0x390a7a[_0x7191('0x2f')]['startTime']){_0x340371['where']['starttime']=JSON[_0x7191('0x5d')](_0x390a7a[_0x7191('0x2f')][_0x7191('0x5e')]);}return db[_0x7191('0x54')]['findAll'](_0x340371)[_0x7191('0x21')](handleEntityNotFound(_0x3fe870,null))[_0x7191('0x21')](function(_0x5527e4){if(_0x5527e4){_0x343344=_0x5527e4;return db[_0x7191('0x5f')][_0x7191('0x41')]({'where':{'SessionId':{'$in':_[_0x7191('0x29')](_0x343344,'id')},'ProjectId':_0x390a7a[_0x7191('0x4e')]['id']},'order':'-createdAt'});}})[_0x7191('0x21')](handleEntityNotFound(_0x3fe870,null))['then'](function(_0x5781c9){if(_0x5781c9){_0x382b93=_0x5781c9;var _0x19df68={};for(var _0x11ed66=0x0,_0x399024=_0x382b93[_0x7191('0x35')];_0x11ed66<_0x399024;_0x11ed66++){if(!_0x19df68['hasOwnProperty'](_0x382b93[_0x11ed66]['questionId'])){_0x19df68[_0x382b93[_0x11ed66][_0x7191('0x60')]]=needsEncapsulation(_0x382b93[_0x11ed66][_0x7191('0x61')])?encapsulate(_0x382b93[_0x11ed66][_0x7191('0x61')]):_0x382b93[_0x11ed66][_0x7191('0x61')];}}var _0x486d71=[],_0x541f9a={};for(var _0x3df89f=0x0,_0x545051=_0x343344[_0x7191('0x35')];_0x3df89f<_0x545051;_0x3df89f++){_0x541f9a={'ProjectId':_0x390a7a[_0x7191('0x4e')]['id'],'SessionId':_0x343344[_0x3df89f]['id'],'StartTime':moment(_0x343344[_0x3df89f][_0x7191('0x62')])[_0x7191('0x63')](_0x7191('0x64'))};for(var _0x412679=0x0,_0x198d27=_0x382b93['length'];_0x412679<_0x198d27;_0x412679++){if(_0x382b93[_0x412679][_0x7191('0x65')]==_0x343344[_0x3df89f]['id']&&_0x19df68['hasOwnProperty'](_0x382b93[_0x412679][_0x7191('0x60')])){_0x541f9a[_0x19df68[_0x382b93[_0x412679][_0x7191('0x60')]]]=_0x382b93[_0x412679][_0x7191('0x66')];}}for(var _0x339ec5 in _0x19df68){if(!_0x541f9a[_0x7191('0x36')](_0x19df68[_0x339ec5])){_0x541f9a[_0x19df68[_0x339ec5]]=null;}}_0x486d71[_0x7191('0x67')](_0x541f9a);}return _0x486d71;}})[_0x7191('0x21')](function(_0x24e9b9){if(!_['isEmpty'](_0x24e9b9)){var _0x27ce2a=toCsv(_0x24e9b9);var _0x175d1a=Date[_0x7191('0x68')]();fs[_0x7191('0x69')](util[_0x7191('0x63')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x390a7a['params']['id'],_0x175d1a),_0x27ce2a);_0x3fe870['setHeader'](_0x7191('0x6a'),_0x7191('0x6b')+util[_0x7191('0x63')](_0x7191('0x6c'),_0x390a7a[_0x7191('0x4e')]['id'],_0x175d1a));_0x3fe870[_0x7191('0x6d')](_0x7191('0x6e'),_0x7191('0x6f'));return _0x3fe870[_0x7191('0x70')](util[_0x7191('0x63')](_0x7191('0x71'),_0x390a7a['params']['id'],_0x175d1a));}else{return _0x3fe870[_0x7191('0x72')](0xcc);}})[_0x7191('0x45')](handleError(_0x3fe870,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c7e6f4a..9f16c4e 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 _0x446e=['jscripty_projects','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','JscriptyProject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x446e,0x1f0));var _0xe446=function(_0x2e6660,_0x35d5b9){_0x2e6660=_0x2e6660-0x0;var _0x8241ed=_0x446e[_0x2e6660];return _0x8241ed;};'use strict';var _=require(_0xe446('0x0'));var util=require(_0xe446('0x1'));var logger=require('../../config/logger')(_0xe446('0x2'));var moment=require(_0xe446('0x3'));var BPromise=require(_0xe446('0x4'));var rp=require(_0xe446('0x5'));var fs=require('fs');var path=require(_0xe446('0x6'));var rimraf=require(_0xe446('0x7'));var config=require(_0xe446('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x52b114,_0x1d1444){return _0x52b114['define'](_0xe446('0x9'),attributes,{'tableName':_0xe446('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e49=['exports','JscriptyProject','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes'];(function(_0x57dff9,_0x37bd67){var _0x346ae6=function(_0x14197b){while(--_0x14197b){_0x57dff9['push'](_0x57dff9['shift']());}};_0x346ae6(++_0x37bd67);}(_0x9e49,0x7a));var _0x99e4=function(_0xb7ccdb,_0x42e36b){_0xb7ccdb=_0xb7ccdb-0x0;var _0x4aa9c3=_0x9e49[_0xb7ccdb];return _0x4aa9c3;};'use strict';var _=require(_0x99e4('0x0'));var util=require(_0x99e4('0x1'));var logger=require(_0x99e4('0x2'))(_0x99e4('0x3'));var moment=require(_0x99e4('0x4'));var BPromise=require(_0x99e4('0x5'));var rp=require(_0x99e4('0x6'));var fs=require('fs');var path=require(_0x99e4('0x7'));var rimraf=require('rimraf');var config=require(_0x99e4('0x8'));var attributes=require(_0x99e4('0x9'));module[_0x99e4('0xa')]=function(_0x1510a8,_0x58b6ef){return _0x1510a8['define'](_0x99e4('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index bb06061..3e25dd9 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 _0x9148=['then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xc3b746,_0x437056){var _0x9264dc=function(_0x10ad6a){while(--_0x10ad6a){_0xc3b746['push'](_0xc3b746['shift']());}};_0x9264dc(++_0x437056);}(_0x9148,0x1ab));var _0x8914=function(_0x843c14,_0x2368d5){_0x843c14=_0x843c14-0x0;var _0x433454=_0x9148[_0x843c14];return _0x433454;};'use strict';var _=require(_0x8914('0x0'));var util=require(_0x8914('0x1'));var moment=require(_0x8914('0x2'));var BPromise=require(_0x8914('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8914('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8914('0x5'));var logger=require(_0x8914('0x6'))(_0x8914('0x7'));var config=require(_0x8914('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8914('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44556f,_0x2567e9,_0x586b39){return new BPromise(function(_0xcc434,_0x379eea){return client['request'](_0x44556f,_0x586b39)[_0x8914('0xa')](function(_0x2c6ef2){logger[_0x8914('0xb')](_0x8914('0xc'),_0x2567e9,_0x8914('0xd'));logger[_0x8914('0xe')](_0x8914('0xf'),_0x2567e9,'request\x20sent',JSON['stringify'](_0x2c6ef2));if(_0x2c6ef2[_0x8914('0x10')]){if(_0x2c6ef2[_0x8914('0x10')]['code']===0x1f4){logger[_0x8914('0x10')](_0x8914('0xc'),_0x2567e9,_0x2c6ef2[_0x8914('0x10')][_0x8914('0x11')]);return _0x379eea(_0x2c6ef2[_0x8914('0x10')][_0x8914('0x11')]);}logger['error'](_0x8914('0xc'),_0x2567e9,_0x2c6ef2['error'][_0x8914('0x11')]);return _0xcc434(_0x2c6ef2[_0x8914('0x10')]['message']);}else{logger[_0x8914('0xb')](_0x8914('0xc'),_0x2567e9,_0x8914('0xd'));_0xcc434(_0x2c6ef2['result']['message']);}})[_0x8914('0x12')](function(_0x4a840a){logger[_0x8914('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x2567e9,_0x4a840a);_0x379eea(_0x4a840a);});});} \ No newline at end of file +var _0x49e4=['message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyProject,\x20%s,\x20%s','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x49e4,0x1a5));var _0x449e=function(_0x19810e,_0x172a94){_0x19810e=_0x19810e-0x0;var _0x45eeb0=_0x49e4[_0x19810e];return _0x45eeb0;};'use strict';var _=require(_0x449e('0x0'));var util=require(_0x449e('0x1'));var moment=require(_0x449e('0x2'));var BPromise=require(_0x449e('0x3'));var rs=require(_0x449e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x449e('0x5'))['db'];var utils=require(_0x449e('0x6'));var logger=require(_0x449e('0x7'))(_0x449e('0x8'));var config=require(_0x449e('0x9'));var jayson=require(_0x449e('0xa'));var client=jayson[_0x449e('0xb')][_0x449e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b9b26,_0x10d529,_0x5d0a41){return new BPromise(function(_0x66fa64,_0x5d0f4a){return client['request'](_0x1b9b26,_0x5d0a41)[_0x449e('0xd')](function(_0x5c110a){logger[_0x449e('0xe')](_0x449e('0xf'),_0x10d529,'request\x20sent');logger['debug'](_0x449e('0x10'),_0x10d529,_0x449e('0x11'),JSON[_0x449e('0x12')](_0x5c110a));if(_0x5c110a[_0x449e('0x13')]){if(_0x5c110a[_0x449e('0x13')]['code']===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x10d529,_0x5c110a[_0x449e('0x13')][_0x449e('0x14')]);return _0x5d0f4a(_0x5c110a['error'][_0x449e('0x14')]);}logger[_0x449e('0x13')](_0x449e('0xf'),_0x10d529,_0x5c110a[_0x449e('0x13')][_0x449e('0x14')]);return _0x66fa64(_0x5c110a[_0x449e('0x13')][_0x449e('0x14')]);}else{logger[_0x449e('0xe')](_0x449e('0xf'),_0x10d529,_0x449e('0x11'));_0x66fa64(_0x5c110a['result'][_0x449e('0x14')]);}})['catch'](function(_0x2c0d5a){logger[_0x449e('0x13')](_0x449e('0xf'),_0x10d529,_0x2c0d5a);_0x5d0f4a(_0x2c0d5a);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 0bc3fdb..1efa902 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 _0x278b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put'];(function(_0x3c6f40,_0x59119e){var _0x16f167=function(_0x295a0d){while(--_0x295a0d){_0x3c6f40['push'](_0x3c6f40['shift']());}};_0x16f167(++_0x59119e);}(_0x278b,0x1bc));var _0xb278=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x278b[_0x51ac09];return _0x3f827d;};'use strict';var multer=require('multer');var util=require(_0xb278('0x0'));var path=require(_0xb278('0x1'));var timeout=require(_0xb278('0x2'));var express=require('express');var router=express[_0xb278('0x3')]();var auth=require(_0xb278('0x4'));var interaction=require(_0xb278('0x5'));var config=require(_0xb278('0x6'));var controller=require(_0xb278('0x7'));router[_0xb278('0x8')]('/',auth[_0xb278('0x9')](),controller['index']);router['get'](_0xb278('0xa'),auth[_0xb278('0x9')](),controller['describe']);router['get'](_0xb278('0xb'),auth[_0xb278('0x9')](),controller[_0xb278('0xc')]);router[_0xb278('0xd')]('/',auth[_0xb278('0x9')](),controller[_0xb278('0xe')]);router[_0xb278('0xf')](_0xb278('0xb'),auth[_0xb278('0x9')](),controller[_0xb278('0x10')]);router[_0xb278('0x11')]('/:id',auth[_0xb278('0x9')](),controller[_0xb278('0x12')]);module[_0xb278('0x13')]=router; \ No newline at end of file +var _0x2bcd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','/describe','describe','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','util'];(function(_0x105f4b,_0x174182){var _0x3bd088=function(_0x5e82f9){while(--_0x5e82f9){_0x105f4b['push'](_0x105f4b['shift']());}};_0x3bd088(++_0x174182);}(_0x2bcd,0x76));var _0xd2bc=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x2bcd[_0x1bfe2b];return _0x1477d4;};'use strict';var multer=require(_0xd2bc('0x0'));var util=require(_0xd2bc('0x1'));var path=require(_0xd2bc('0x2'));var timeout=require(_0xd2bc('0x3'));var express=require(_0xd2bc('0x4'));var router=express[_0xd2bc('0x5')]();var auth=require(_0xd2bc('0x6'));var interaction=require(_0xd2bc('0x7'));var config=require('../../config/environment');var controller=require(_0xd2bc('0x8'));router[_0xd2bc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd2bc('0x9')](_0xd2bc('0xa'),auth['isAuthenticated'](),controller[_0xd2bc('0xb')]);router['get'](_0xd2bc('0xc'),auth['isAuthenticated'](),controller[_0xd2bc('0xd')]);router['post']('/',auth[_0xd2bc('0xe')](),controller['create']);router[_0xd2bc('0xf')](_0xd2bc('0xc'),auth[_0xd2bc('0xe')](),controller[_0xd2bc('0x10')]);router[_0xd2bc('0x11')](_0xd2bc('0xc'),auth['isAuthenticated'](),controller[_0xd2bc('0x12')]);module[_0xd2bc('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b39ba4d..4d5cf77 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 _0x1d3c=['STRING','TEXT','long','sequelize','exports'];(function(_0x258bd8,_0x1ec976){var _0x1f2dfd=function(_0x35b0a3){while(--_0x35b0a3){_0x258bd8['push'](_0x258bd8['shift']());}};_0x1f2dfd(++_0x1ec976);}(_0x1d3c,0x1ac));var _0xc1d3=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x1d3c[_0x2af29a];return _0x5ef02f;};'use strict';var Sequelize=require(_0xc1d3('0x0'));module[_0xc1d3('0x1')]={'question':{'type':Sequelize[_0xc1d3('0x2')]},'answer':{'type':Sequelize[_0xc1d3('0x3')](_0xc1d3('0x4'))},'membername':{'type':Sequelize[_0xc1d3('0x2')]},'projectname':{'type':Sequelize[_0xc1d3('0x2')]},'queue':{'type':Sequelize[_0xc1d3('0x2')]},'uniqueid':{'type':Sequelize[_0xc1d3('0x2')]},'calleridname':{'type':Sequelize[_0xc1d3('0x2')]},'calleridnum':{'type':Sequelize[_0xc1d3('0x2')]},'questionId':{'type':Sequelize[_0xc1d3('0x2')]}}; \ No newline at end of file +var _0x001c=['TEXT','long','STRING','sequelize','exports'];(function(_0xf16ae3,_0x2170a9){var _0x3a6126=function(_0x2a6f9d){while(--_0x2a6f9d){_0xf16ae3['push'](_0xf16ae3['shift']());}};_0x3a6126(++_0x2170a9);}(_0x001c,0x175));var _0xc001=function(_0x2eaaf0,_0x48c592){_0x2eaaf0=_0x2eaaf0-0x0;var _0x467812=_0x001c[_0x2eaaf0];return _0x467812;};'use strict';var Sequelize=require(_0xc001('0x0'));module[_0xc001('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xc001('0x2')](_0xc001('0x3'))},'membername':{'type':Sequelize[_0xc001('0x4')]},'projectname':{'type':Sequelize[_0xc001('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc001('0x4')]},'calleridname':{'type':Sequelize[_0xc001('0x4')]},'calleridnum':{'type':Sequelize[_0xc001('0x4')]},'questionId':{'type':Sequelize[_0xc001('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index f9045fb..2d8615d 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 _0xd455=['status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4fcb54,_0x27db23){var _0x30a590=function(_0x271d66){while(--_0x271d66){_0x4fcb54['push'](_0x4fcb54['shift']());}};_0x30a590(++_0x27db23);}(_0xd455,0xc5));var _0x5d45=function(_0x81ea4,_0x15dc79){_0x81ea4=_0x81ea4-0x0;var _0x127577=_0xd455[_0x81ea4];return _0x127577;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5d45('0x0'));var rimraf=require(_0x5d45('0x1'));var zipdir=require(_0x5d45('0x2'));var jsonpatch=require(_0x5d45('0x3'));var rp=require(_0x5d45('0x4'));var moment=require(_0x5d45('0x5'));var BPromise=require(_0x5d45('0x6'));var Mustache=require(_0x5d45('0x7'));var util=require('util');var path=require(_0x5d45('0x8'));var sox=require(_0x5d45('0x9'));var csv=require(_0x5d45('0xa'));var ejs=require(_0x5d45('0xb'));var fs=require('fs');var _=require(_0x5d45('0xc'));var squel=require(_0x5d45('0xd'));var crypto=require(_0x5d45('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5d45('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5d45('0x10'));var Redis=require(_0x5d45('0x11'));var authService=require(_0x5d45('0x12'));var qs=require(_0x5d45('0x13'));var as=require(_0x5d45('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d45('0x15'))('api');var utils=require(_0x5d45('0x16'));var config=require(_0x5d45('0x17'));var db=require(_0x5d45('0x18'))['db'];function respondWithStatusCode(_0x3aa9be,_0x8f5a34){_0x8f5a34=_0x8f5a34||0xcc;return function(_0x553b00){if(_0x553b00){return _0x3aa9be['sendStatus'](_0x8f5a34);}return _0x3aa9be[_0x5d45('0x19')](_0x8f5a34)['end']();};}function respondWithResult(_0x3c6cc5,_0x303eab){_0x303eab=_0x303eab||0xc8;return function(_0x34a8db){if(_0x34a8db){return _0x3c6cc5[_0x5d45('0x19')](_0x303eab)[_0x5d45('0x1a')](_0x34a8db);}};}function respondWithFilteredResult(_0x33b07e,_0x4c0b54){return function(_0x4f4991){if(_0x4f4991){var _0x13f2a9=_0x4f4991[_0x5d45('0x1b')],_0x3474a2=_0x4c0b54[_0x5d45('0x1c')],_0x137e8e=_0x4c0b54[_0x5d45('0x1c')]+_0x4c0b54[_0x5d45('0x1d')],_0x363958;if(_0x137e8e>=_0x13f2a9){_0x137e8e=_0x13f2a9;_0x363958=0xc8;}else{_0x363958=0xce;}_0x33b07e[_0x5d45('0x19')](_0x363958);return _0x33b07e[_0x5d45('0x1e')](_0x5d45('0x1f'),_0x3474a2+'-'+_0x137e8e+'/'+_0x13f2a9)[_0x5d45('0x1a')](_0x4f4991);}return null;};}function patchUpdates(_0x1949ad){return function(_0xd9475a){try{jsonpatch[_0x5d45('0x20')](_0xd9475a,_0x1949ad,!![]);}catch(_0x306b3b){return BPromise[_0x5d45('0x21')](_0x306b3b);}return _0xd9475a[_0x5d45('0x22')]();};}function saveUpdates(_0x552a57,_0x123c4d){return function(_0x2f57ab){if(_0x2f57ab){return _0x2f57ab[_0x5d45('0x23')](_0x552a57)[_0x5d45('0x24')](function(_0x37da96){return _0x37da96;});}return null;};}function removeEntity(_0x4787ce,_0x4e55f7){return function(_0x4bf365){if(_0x4bf365){return _0x4bf365['destroy']()[_0x5d45('0x24')](function(){_0x4787ce['status'](0xcc)[_0x5d45('0x25')]();});}};}function handleEntityNotFound(_0x1e8f61,_0x486710){return function(_0x11500d){if(!_0x11500d){_0x1e8f61[_0x5d45('0x26')](0x194);}return _0x11500d;};}function handleError(_0x4e739d,_0x50e2b9){_0x50e2b9=_0x50e2b9||0x1f4;return function(_0x2d42da){logger[_0x5d45('0x27')](_0x2d42da[_0x5d45('0x28')]);if(_0x2d42da[_0x5d45('0x29')]){delete _0x2d42da['name'];}_0x4e739d[_0x5d45('0x19')](_0x50e2b9)['send'](_0x2d42da);};}exports[_0x5d45('0x2a')]=function(_0x39b8a5,_0x2745a6){var _0x2c0b44={},_0x536715={},_0x13c341={'count':0x0,'rows':[]};var _0x8d6b1c=_[_0x5d45('0x2b')](db['JscriptyQuestionReport'][_0x5d45('0x2c')],function(_0x54d45f){return{'name':_0x54d45f[_0x5d45('0x2d')],'type':_0x54d45f['type'][_0x5d45('0x2e')]};});_0x536715['model']=_[_0x5d45('0x2b')](_0x8d6b1c,_0x5d45('0x29'));_0x536715[_0x5d45('0x2f')]=_[_0x5d45('0x30')](_0x39b8a5[_0x5d45('0x2f')]);_0x536715[_0x5d45('0x31')]=_[_0x5d45('0x32')](_0x536715[_0x5d45('0x33')],_0x536715[_0x5d45('0x2f')]);_0x2c0b44[_0x5d45('0x34')]=_[_0x5d45('0x32')](_0x536715[_0x5d45('0x33')],qs[_0x5d45('0x35')](_0x39b8a5[_0x5d45('0x2f')]['fields']));_0x2c0b44[_0x5d45('0x34')]=_0x2c0b44['attributes'][_0x5d45('0x36')]?_0x2c0b44['attributes']:_0x536715[_0x5d45('0x33')];if(!_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x37')](_0x5d45('0x38'))){_0x2c0b44[_0x5d45('0x1d')]=qs[_0x5d45('0x1d')](_0x39b8a5[_0x5d45('0x2f')]['limit']);_0x2c0b44[_0x5d45('0x1c')]=qs[_0x5d45('0x1c')](_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x1c')]);}_0x2c0b44[_0x5d45('0x39')]=qs[_0x5d45('0x3a')](_0x39b8a5['query']['sort']);_0x2c0b44[_0x5d45('0x3b')]=qs[_0x5d45('0x31')](_['pick'](_0x39b8a5['query'],_0x536715[_0x5d45('0x31')]),_0x8d6b1c);if(_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x3c')]){_0x2c0b44['where']=_[_0x5d45('0x3d')](_0x2c0b44[_0x5d45('0x3b')],{'$or':_[_0x5d45('0x2b')](_0x8d6b1c,function(_0xe11f9f){if(_0xe11f9f[_0x5d45('0x3e')]!==_0x5d45('0x3f')){var _0x264b14={};_0x264b14[_0xe11f9f[_0x5d45('0x29')]]={'$like':'%'+_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x3c')]+'%'};return _0x264b14;}})});}_0x2c0b44=_[_0x5d45('0x3d')]({},_0x2c0b44,_0x39b8a5[_0x5d45('0x40')]);var _0x5ac44d={'where':_0x2c0b44[_0x5d45('0x3b')]};return db[_0x5d45('0x41')][_0x5d45('0x1b')](_0x5ac44d)['then'](function(_0x162c09){_0x13c341['count']=_0x162c09;if(_0x39b8a5[_0x5d45('0x2f')][_0x5d45('0x42')]){_0x2c0b44[_0x5d45('0x43')]=[{'all':!![]}];}return db[_0x5d45('0x41')]['findAll'](_0x2c0b44);})['then'](function(_0x308265){_0x13c341[_0x5d45('0x44')]=_0x308265;return _0x13c341;})[_0x5d45('0x24')](respondWithFilteredResult(_0x2745a6,_0x2c0b44))[_0x5d45('0x45')](handleError(_0x2745a6,null));};exports['show']=function(_0x2b2fa6,_0x5bfb06){var _0x374093={'raw':!![],'where':{'id':_0x2b2fa6[_0x5d45('0x46')]['id']}},_0x12a0de={};_0x12a0de[_0x5d45('0x33')]=_[_0x5d45('0x30')](db['JscriptyQuestionReport'][_0x5d45('0x2c')]);_0x12a0de[_0x5d45('0x2f')]=_['keys'](_0x2b2fa6[_0x5d45('0x2f')]);_0x12a0de[_0x5d45('0x31')]=_[_0x5d45('0x32')](_0x12a0de[_0x5d45('0x33')],_0x12a0de[_0x5d45('0x2f')]);_0x374093[_0x5d45('0x34')]=_[_0x5d45('0x32')](_0x12a0de['model'],qs[_0x5d45('0x35')](_0x2b2fa6[_0x5d45('0x2f')][_0x5d45('0x35')]));_0x374093[_0x5d45('0x34')]=_0x374093[_0x5d45('0x34')][_0x5d45('0x36')]?_0x374093[_0x5d45('0x34')]:_0x12a0de[_0x5d45('0x33')];if(_0x2b2fa6['query'][_0x5d45('0x42')]){_0x374093[_0x5d45('0x43')]=[{'all':!![]}];}_0x374093=_[_0x5d45('0x3d')]({},_0x374093,_0x2b2fa6[_0x5d45('0x40')]);return db[_0x5d45('0x41')][_0x5d45('0x47')](_0x374093)[_0x5d45('0x24')](handleEntityNotFound(_0x5bfb06,null))[_0x5d45('0x24')](respondWithResult(_0x5bfb06,null))['catch'](handleError(_0x5bfb06,null));};exports[_0x5d45('0x48')]=function(_0x4c78a5,_0x13ed2d){return db['JscriptyQuestionReport'][_0x5d45('0x48')](_0x4c78a5[_0x5d45('0x49')],{})[_0x5d45('0x24')](respondWithResult(_0x13ed2d,0xc9))[_0x5d45('0x45')](handleError(_0x13ed2d,null));};exports['update']=function(_0x3e1cfc,_0x26a966){if(_0x3e1cfc[_0x5d45('0x49')]['id']){delete _0x3e1cfc[_0x5d45('0x49')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x3e1cfc['params']['id']}})[_0x5d45('0x24')](handleEntityNotFound(_0x26a966,null))[_0x5d45('0x24')](saveUpdates(_0x3e1cfc[_0x5d45('0x49')],null))[_0x5d45('0x24')](respondWithResult(_0x26a966,null))[_0x5d45('0x45')](handleError(_0x26a966,null));};exports['destroy']=function(_0x34b6f6,_0x51295b){return db[_0x5d45('0x41')]['find']({'where':{'id':_0x34b6f6[_0x5d45('0x46')]['id']}})['then'](handleEntityNotFound(_0x51295b,null))[_0x5d45('0x24')](removeEntity(_0x51295b,null))[_0x5d45('0x45')](handleError(_0x51295b,null));};exports['describe']=function(_0x8594c0,_0x5de94f){return db[_0x5d45('0x41')]['describe']()['then'](respondWithResult(_0x5de94f,null))[_0x5d45('0x45')](handleError(_0x5de94f,null));}; \ No newline at end of file +var _0x40d1=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','ejs','lodash','jsforce','desk.js'];(function(_0x1c62f5,_0x260f11){var _0x161c5d=function(_0x492393){while(--_0x492393){_0x1c62f5['push'](_0x1c62f5['shift']());}};_0x161c5d(++_0x260f11);}(_0x40d1,0x1a7));var _0x140d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x40d1[_0x6c993a];return _0x27f547;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x140d('0x0'));var rimraf=require(_0x140d('0x1'));var zipdir=require(_0x140d('0x2'));var jsonpatch=require(_0x140d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x140d('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x140d('0x5'));var fs=require('fs');var _=require(_0x140d('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x140d('0x7'));var deskjs=require(_0x140d('0x8'));var toCsv=require(_0x140d('0x9'));var querystring=require(_0x140d('0xa'));var Papa=require(_0x140d('0xb'));var Redis=require(_0x140d('0xc'));var authService=require(_0x140d('0xd'));var qs=require(_0x140d('0xe'));var as=require(_0x140d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x140d('0x10'))(_0x140d('0x11'));var utils=require('../../config/utils');var config=require(_0x140d('0x12'));var db=require(_0x140d('0x13'))['db'];function respondWithStatusCode(_0x3a0388,_0x580e9d){_0x580e9d=_0x580e9d||0xcc;return function(_0x5ebd15){if(_0x5ebd15){return _0x3a0388[_0x140d('0x14')](_0x580e9d);}return _0x3a0388[_0x140d('0x15')](_0x580e9d)[_0x140d('0x16')]();};}function respondWithResult(_0x51240d,_0x20116a){_0x20116a=_0x20116a||0xc8;return function(_0x2f7139){if(_0x2f7139){return _0x51240d['status'](_0x20116a)[_0x140d('0x17')](_0x2f7139);}};}function respondWithFilteredResult(_0x5a64ec,_0x2e2e79){return function(_0x1fafcd){if(_0x1fafcd){var _0x3eaea4=_0x1fafcd[_0x140d('0x18')],_0x5420e4=_0x2e2e79[_0x140d('0x19')],_0x664c3e=_0x2e2e79[_0x140d('0x19')]+_0x2e2e79[_0x140d('0x1a')],_0x36f9df;if(_0x664c3e>=_0x3eaea4){_0x664c3e=_0x3eaea4;_0x36f9df=0xc8;}else{_0x36f9df=0xce;}_0x5a64ec[_0x140d('0x15')](_0x36f9df);return _0x5a64ec[_0x140d('0x1b')](_0x140d('0x1c'),_0x5420e4+'-'+_0x664c3e+'/'+_0x3eaea4)['json'](_0x1fafcd);}return null;};}function patchUpdates(_0x4c37af){return function(_0x38f810){try{jsonpatch['apply'](_0x38f810,_0x4c37af,!![]);}catch(_0x5a80ea){return BPromise['reject'](_0x5a80ea);}return _0x38f810[_0x140d('0x1d')]();};}function saveUpdates(_0x3d3704,_0xe31801){return function(_0x495b5e){if(_0x495b5e){return _0x495b5e['update'](_0x3d3704)[_0x140d('0x1e')](function(_0x4f9e6b){return _0x4f9e6b;});}return null;};}function removeEntity(_0x483f44,_0x1c5e1a){return function(_0x57e8d5){if(_0x57e8d5){return _0x57e8d5[_0x140d('0x1f')]()[_0x140d('0x1e')](function(){_0x483f44[_0x140d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b7329,_0x1e78c9){return function(_0x5aa91d){if(!_0x5aa91d){_0x4b7329['sendStatus'](0x194);}return _0x5aa91d;};}function handleError(_0x1285f7,_0x46367d){_0x46367d=_0x46367d||0x1f4;return function(_0x2ce070){logger[_0x140d('0x20')](_0x2ce070[_0x140d('0x21')]);if(_0x2ce070[_0x140d('0x22')]){delete _0x2ce070[_0x140d('0x22')];}_0x1285f7['status'](_0x46367d)[_0x140d('0x23')](_0x2ce070);};}exports[_0x140d('0x24')]=function(_0x49293d,_0x5c7ca6){var _0x5d690a={},_0x1419fd={},_0xb2d7ab={'count':0x0,'rows':[]};var _0x48b550=_[_0x140d('0x25')](db[_0x140d('0x26')]['rawAttributes'],function(_0x1d6bab){return{'name':_0x1d6bab[_0x140d('0x27')],'type':_0x1d6bab[_0x140d('0x28')][_0x140d('0x29')]};});_0x1419fd[_0x140d('0x2a')]=_[_0x140d('0x25')](_0x48b550,_0x140d('0x22'));_0x1419fd[_0x140d('0x2b')]=_[_0x140d('0x2c')](_0x49293d[_0x140d('0x2b')]);_0x1419fd[_0x140d('0x2d')]=_[_0x140d('0x2e')](_0x1419fd['model'],_0x1419fd[_0x140d('0x2b')]);_0x5d690a['attributes']=_[_0x140d('0x2e')](_0x1419fd[_0x140d('0x2a')],qs[_0x140d('0x2f')](_0x49293d[_0x140d('0x2b')]['fields']));_0x5d690a[_0x140d('0x30')]=_0x5d690a['attributes'][_0x140d('0x31')]?_0x5d690a['attributes']:_0x1419fd[_0x140d('0x2a')];if(!_0x49293d[_0x140d('0x2b')][_0x140d('0x32')]('nolimit')){_0x5d690a[_0x140d('0x1a')]=qs[_0x140d('0x1a')](_0x49293d['query'][_0x140d('0x1a')]);_0x5d690a[_0x140d('0x19')]=qs['offset'](_0x49293d[_0x140d('0x2b')][_0x140d('0x19')]);}_0x5d690a[_0x140d('0x33')]=qs[_0x140d('0x34')](_0x49293d[_0x140d('0x2b')][_0x140d('0x34')]);_0x5d690a[_0x140d('0x35')]=qs[_0x140d('0x2d')](_[_0x140d('0x36')](_0x49293d[_0x140d('0x2b')],_0x1419fd[_0x140d('0x2d')]),_0x48b550);if(_0x49293d[_0x140d('0x2b')]['filter']){_0x5d690a[_0x140d('0x35')]=_[_0x140d('0x37')](_0x5d690a[_0x140d('0x35')],{'$or':_[_0x140d('0x25')](_0x48b550,function(_0x207607){if(_0x207607[_0x140d('0x28')]!==_0x140d('0x38')){var _0x3a94d6={};_0x3a94d6[_0x207607['name']]={'$like':'%'+_0x49293d[_0x140d('0x2b')][_0x140d('0x39')]+'%'};return _0x3a94d6;}})});}_0x5d690a=_[_0x140d('0x37')]({},_0x5d690a,_0x49293d[_0x140d('0x3a')]);var _0x1ae3bf={'where':_0x5d690a['where']};return db[_0x140d('0x26')]['count'](_0x1ae3bf)['then'](function(_0x135e3d){_0xb2d7ab[_0x140d('0x18')]=_0x135e3d;if(_0x49293d[_0x140d('0x2b')]['includeAll']){_0x5d690a[_0x140d('0x3b')]=[{'all':!![]}];}return db[_0x140d('0x26')][_0x140d('0x3c')](_0x5d690a);})[_0x140d('0x1e')](function(_0x1cd312){_0xb2d7ab[_0x140d('0x3d')]=_0x1cd312;return _0xb2d7ab;})[_0x140d('0x1e')](respondWithFilteredResult(_0x5c7ca6,_0x5d690a))[_0x140d('0x3e')](handleError(_0x5c7ca6,null));};exports[_0x140d('0x3f')]=function(_0x810acd,_0x26de63){var _0x3196ee={'raw':!![],'where':{'id':_0x810acd['params']['id']}},_0x2296cb={};_0x2296cb[_0x140d('0x2a')]=_[_0x140d('0x2c')](db[_0x140d('0x26')][_0x140d('0x40')]);_0x2296cb[_0x140d('0x2b')]=_['keys'](_0x810acd[_0x140d('0x2b')]);_0x2296cb['filters']=_[_0x140d('0x2e')](_0x2296cb[_0x140d('0x2a')],_0x2296cb['query']);_0x3196ee[_0x140d('0x30')]=_[_0x140d('0x2e')](_0x2296cb[_0x140d('0x2a')],qs[_0x140d('0x2f')](_0x810acd['query'][_0x140d('0x2f')]));_0x3196ee['attributes']=_0x3196ee[_0x140d('0x30')][_0x140d('0x31')]?_0x3196ee[_0x140d('0x30')]:_0x2296cb['model'];if(_0x810acd[_0x140d('0x2b')][_0x140d('0x41')]){_0x3196ee[_0x140d('0x3b')]=[{'all':!![]}];}_0x3196ee=_[_0x140d('0x37')]({},_0x3196ee,_0x810acd['options']);return db[_0x140d('0x26')][_0x140d('0x42')](_0x3196ee)['then'](handleEntityNotFound(_0x26de63,null))[_0x140d('0x1e')](respondWithResult(_0x26de63,null))['catch'](handleError(_0x26de63,null));};exports[_0x140d('0x43')]=function(_0x2f78ed,_0x214c5a){return db[_0x140d('0x26')][_0x140d('0x43')](_0x2f78ed[_0x140d('0x44')],{})['then'](respondWithResult(_0x214c5a,0xc9))[_0x140d('0x3e')](handleError(_0x214c5a,null));};exports[_0x140d('0x45')]=function(_0x599cd0,_0x1a0ead){if(_0x599cd0[_0x140d('0x44')]['id']){delete _0x599cd0[_0x140d('0x44')]['id'];}return db['JscriptyQuestionReport'][_0x140d('0x42')]({'where':{'id':_0x599cd0[_0x140d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a0ead,null))['then'](saveUpdates(_0x599cd0[_0x140d('0x44')],null))[_0x140d('0x1e')](respondWithResult(_0x1a0ead,null))[_0x140d('0x3e')](handleError(_0x1a0ead,null));};exports[_0x140d('0x1f')]=function(_0x2f761f,_0x52e083){return db[_0x140d('0x26')][_0x140d('0x42')]({'where':{'id':_0x2f761f['params']['id']}})[_0x140d('0x1e')](handleEntityNotFound(_0x52e083,null))[_0x140d('0x1e')](removeEntity(_0x52e083,null))[_0x140d('0x3e')](handleError(_0x52e083,null));};exports[_0x140d('0x47')]=function(_0x50485f,_0x4adf58){return db[_0x140d('0x26')][_0x140d('0x47')]()['then'](respondWithResult(_0x4adf58,null))[_0x140d('0x3e')](handleError(_0x4adf58,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 49fdadb..912c3bc 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 _0x3724=['request-promise','rimraf','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','bluebird'];(function(_0x4d2de8,_0x1391e9){var _0x58eaa0=function(_0xbd2834){while(--_0xbd2834){_0x4d2de8['push'](_0x4d2de8['shift']());}};_0x58eaa0(++_0x1391e9);}(_0x3724,0x87));var _0x4372=function(_0x156489,_0x2bbaf2){_0x156489=_0x156489-0x0;var _0x4d2814=_0x3724[_0x156489];return _0x4d2814;};'use strict';var _=require(_0x4372('0x0'));var util=require(_0x4372('0x1'));var logger=require(_0x4372('0x2'))(_0x4372('0x3'));var moment=require('moment');var BPromise=require(_0x4372('0x4'));var rp=require(_0x4372('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4372('0x6'));var config=require('../../config/environment');var attributes=require(_0x4372('0x7'));module['exports']=function(_0x41da19,_0x1ec767){return _0x41da19[_0x4372('0x8')](_0x4372('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3418=['bluebird','path','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3418,0x72));var _0x8341=function(_0x3a0bcc,_0xa9dc0c){_0x3a0bcc=_0x3a0bcc-0x0;var _0x38f258=_0x3418[_0x3a0bcc];return _0x38f258;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8341('0x0'))(_0x8341('0x1'));var moment=require(_0x8341('0x2'));var BPromise=require(_0x8341('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8341('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8341('0x5'));module[_0x8341('0x6')]=function(_0x13a322,_0x58c02e){return _0x13a322[_0x8341('0x7')]('JscriptyQuestionReport',attributes,{'tableName':_0x8341('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 9c39041..f000f5d 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 _0xe50a=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash'];(function(_0x42bb0a,_0x5c713f){var _0x548011=function(_0x1532c8){while(--_0x1532c8){_0x42bb0a['push'](_0x42bb0a['shift']());}};_0x548011(++_0x5c713f);}(_0xe50a,0xb3));var _0xae50=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xe50a[_0x4d45c1];return _0x244478;};'use strict';var _=require(_0xae50('0x0'));var util=require(_0xae50('0x1'));var moment=require(_0xae50('0x2'));var BPromise=require('bluebird');var rs=require(_0xae50('0x3'));var fs=require('fs');var Redis=require(_0xae50('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae50('0x5'));var logger=require(_0xae50('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae50('0x7'));var client=jayson[_0xae50('0x8')][_0xae50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3e7a,_0x251848,_0xf73925){return new BPromise(function(_0x30366e,_0x3a54c3){return client[_0xae50('0xa')](_0x4c3e7a,_0xf73925)[_0xae50('0xb')](function(_0x31ca72){logger[_0xae50('0xc')](_0xae50('0xd'),_0x251848,_0xae50('0xe'));logger[_0xae50('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x251848,_0xae50('0xe'),JSON[_0xae50('0x10')](_0x31ca72));if(_0x31ca72[_0xae50('0x11')]){if(_0x31ca72[_0xae50('0x11')]['code']===0x1f4){logger[_0xae50('0x11')](_0xae50('0xd'),_0x251848,_0x31ca72[_0xae50('0x11')][_0xae50('0x12')]);return _0x3a54c3(_0x31ca72[_0xae50('0x11')][_0xae50('0x12')]);}logger[_0xae50('0x11')](_0xae50('0xd'),_0x251848,_0x31ca72['error'][_0xae50('0x12')]);return _0x30366e(_0x31ca72[_0xae50('0x11')][_0xae50('0x12')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x251848,_0xae50('0xe'));_0x30366e(_0x31ca72['result'][_0xae50('0x12')]);}})[_0xae50('0x13')](function(_0x4a9a21){logger['error'](_0xae50('0xd'),_0x251848,_0x4a9a21);_0x3a54c3(_0x4a9a21);});});} \ No newline at end of file +var _0x13b5=['http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x484e47,_0x155a54){var _0x5c6ea5=function(_0x312683){while(--_0x312683){_0x484e47['push'](_0x484e47['shift']());}};_0x5c6ea5(++_0x155a54);}(_0x13b5,0x1e4));var _0x513b=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x13b5[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x513b('0x0'));var util=require('util');var moment=require(_0x513b('0x1'));var BPromise=require(_0x513b('0x2'));var rs=require(_0x513b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x513b('0x4'))['db'];var utils=require(_0x513b('0x5'));var logger=require(_0x513b('0x6'))(_0x513b('0x7'));var config=require(_0x513b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x513b('0x9')][_0x513b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288b6b,_0x7edce3,_0x42559c){return new BPromise(function(_0x4e5e99,_0x5b3620){return client['request'](_0x288b6b,_0x42559c)[_0x513b('0xb')](function(_0x51a8bd){logger[_0x513b('0xc')](_0x513b('0xd'),_0x7edce3,_0x513b('0xe'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x7edce3,_0x513b('0xe'),JSON['stringify'](_0x51a8bd));if(_0x51a8bd[_0x513b('0xf')]){if(_0x51a8bd['error'][_0x513b('0x10')]===0x1f4){logger[_0x513b('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x7edce3,_0x51a8bd[_0x513b('0xf')]['message']);return _0x5b3620(_0x51a8bd[_0x513b('0xf')][_0x513b('0x11')]);}logger[_0x513b('0xf')](_0x513b('0xd'),_0x7edce3,_0x51a8bd['error'][_0x513b('0x11')]);return _0x4e5e99(_0x51a8bd[_0x513b('0xf')][_0x513b('0x11')]);}else{logger['info'](_0x513b('0xd'),_0x7edce3,_0x513b('0xe'));_0x4e5e99(_0x51a8bd[_0x513b('0x12')]['message']);}})['catch'](function(_0x2cdd8c){logger['error'](_0x513b('0xd'),_0x7edce3,_0x2cdd8c);_0x5b3620(_0x2cdd8c);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 631210b..b489410 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 _0x1670=['getQuestions','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/questions'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x1670,0x9a));var _0x0167=function(_0x21cda3,_0x17b90a){_0x21cda3=_0x21cda3-0x0;var _0x558dc3=_0x1670[_0x21cda3];return _0x558dc3;};'use strict';var multer=require(_0x0167('0x0'));var util=require(_0x0167('0x1'));var path=require('path');var timeout=require(_0x0167('0x2'));var express=require('express');var router=express[_0x0167('0x3')]();var auth=require(_0x0167('0x4'));var interaction=require(_0x0167('0x5'));var config=require(_0x0167('0x6'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x0167('0x7')](),controller[_0x0167('0x8')]);router[_0x0167('0x9')](_0x0167('0xa'),auth[_0x0167('0x7')](),controller[_0x0167('0xb')]);router[_0x0167('0x9')](_0x0167('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0167('0x9')](_0x0167('0xd'),auth[_0x0167('0x7')](),controller[_0x0167('0xe')]);router[_0x0167('0xf')]('/',auth[_0x0167('0x7')](),controller[_0x0167('0x10')]);router[_0x0167('0x11')](_0x0167('0xc'),auth[_0x0167('0x7')](),controller[_0x0167('0x12')]);router[_0x0167('0x13')](_0x0167('0xc'),auth[_0x0167('0x7')](),controller['destroy']);module[_0x0167('0x14')]=router; \ No newline at end of file +var _0xde64=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show','/:id/questions','getQuestions','create','put','delete','exports'];(function(_0x5b5ffe,_0xa8bf6e){var _0x4c2fb0=function(_0x48ca31){while(--_0x48ca31){_0x5b5ffe['push'](_0x5b5ffe['shift']());}};_0x4c2fb0(++_0xa8bf6e);}(_0xde64,0x17c));var _0x4de6=function(_0x55e725,_0x2499e1){_0x55e725=_0x55e725-0x0;var _0x571836=_0xde64[_0x55e725];return _0x571836;};'use strict';var multer=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var path=require(_0x4de6('0x2'));var timeout=require(_0x4de6('0x3'));var express=require(_0x4de6('0x4'));var router=express[_0x4de6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4de6('0x6'));var config=require(_0x4de6('0x7'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x4de6('0x8')](),controller[_0x4de6('0x9')]);router['get']('/describe',auth[_0x4de6('0x8')](),controller[_0x4de6('0xa')]);router[_0x4de6('0xb')](_0x4de6('0xc'),auth[_0x4de6('0x8')](),controller[_0x4de6('0xd')]);router['get'](_0x4de6('0xe'),auth[_0x4de6('0x8')](),controller[_0x4de6('0xf')]);router['post']('/',auth[_0x4de6('0x8')](),controller[_0x4de6('0x10')]);router[_0x4de6('0x11')](_0x4de6('0xc'),auth[_0x4de6('0x8')](),controller['update']);router[_0x4de6('0x12')](_0x4de6('0xc'),auth[_0x4de6('0x8')](),controller['destroy']);module[_0x4de6('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 51e1636..7d682ef 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 _0x0320=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0x571d85,_0xda439c){var _0x3c2e07=function(_0x2d2144){while(--_0x2d2144){_0x571d85['push'](_0x571d85['shift']());}};_0x3c2e07(++_0xda439c);}(_0x0320,0x145));var _0x0032=function(_0x74039f,_0x3a5d17){_0x74039f=_0x74039f-0x0;var _0x76d3fa=_0x0320[_0x74039f];return _0x76d3fa;};'use strict';var moment=require(_0x0032('0x0'));var Sequelize=require(_0x0032('0x1'));module[_0x0032('0x2')]={'starttime':{'type':Sequelize[_0x0032('0x3')],'set':function(_0x39852f){this[_0x0032('0x4')]('starttime',_0x39852f);this[_0x0032('0x4')](_0x0032('0x5'),moment()[_0x0032('0x6')](_0x0032('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0032('0x8')]},'uniqueid':{'type':Sequelize[_0x0032('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0032('0x8')]},'completed':{'type':Sequelize[_0x0032('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x6903=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','exports','DATE'];(function(_0x3f6dd7,_0x484b9f){var _0x482ee6=function(_0x445f80){while(--_0x445f80){_0x3f6dd7['push'](_0x3f6dd7['shift']());}};_0x482ee6(++_0x484b9f);}(_0x6903,0x7b));var _0x3690=function(_0x4f779d,_0x26729d){_0x4f779d=_0x4f779d-0x0;var _0x1130be=_0x6903[_0x4f779d];return _0x1130be;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3690('0x0')]={'starttime':{'type':Sequelize[_0x3690('0x1')],'set':function(_0x5a7b8a){this['setDataValue']('starttime',_0x5a7b8a);this['setDataValue']('endtime',moment()[_0x3690('0x2')](_0x3690('0x3')));}},'endtime':{'type':Sequelize[_0x3690('0x1')]},'membername':{'type':Sequelize[_0x3690('0x4')]},'projectname':{'type':Sequelize[_0x3690('0x4')]},'queue':{'type':Sequelize[_0x3690('0x4')]},'uniqueid':{'type':Sequelize[_0x3690('0x4')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'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 757bb0d..6f8a45b 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 _0xf4f7=['include','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','findAll','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','JscriptySessionReport','includeAll','rows','catch','show','params','rawAttributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf4f7,0xa3));var _0x7f4f=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0xf4f7[_0x5d8018];return _0x151ac4;};'use strict';var pdf=require(_0x7f4f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f4f('0x2'));var rp=require(_0x7f4f('0x3'));var moment=require(_0x7f4f('0x4'));var BPromise=require(_0x7f4f('0x5'));var Mustache=require('mustache');var util=require(_0x7f4f('0x6'));var path=require('path');var sox=require(_0x7f4f('0x7'));var csv=require(_0x7f4f('0x8'));var ejs=require(_0x7f4f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f4f('0xa'));var crypto=require('crypto');var jsforce=require(_0x7f4f('0xb'));var deskjs=require(_0x7f4f('0xc'));var toCsv=require(_0x7f4f('0x8'));var querystring=require('querystring');var Papa=require(_0x7f4f('0xd'));var Redis=require(_0x7f4f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7f4f('0xf'));var as=require(_0x7f4f('0x10'));var hardwareService=require(_0x7f4f('0x11'));var logger=require(_0x7f4f('0x12'))('api');var utils=require(_0x7f4f('0x13'));var config=require(_0x7f4f('0x14'));var db=require(_0x7f4f('0x15'))['db'];function respondWithStatusCode(_0x327469,_0xd0ff84){_0xd0ff84=_0xd0ff84||0xcc;return function(_0x12f3c2){if(_0x12f3c2){return _0x327469['sendStatus'](_0xd0ff84);}return _0x327469[_0x7f4f('0x16')](_0xd0ff84)[_0x7f4f('0x17')]();};}function respondWithResult(_0x4e4227,_0x56de91){_0x56de91=_0x56de91||0xc8;return function(_0x566a37){if(_0x566a37){return _0x4e4227[_0x7f4f('0x16')](_0x56de91)['json'](_0x566a37);}};}function respondWithFilteredResult(_0x64f4ca,_0x555020){return function(_0x29b174){if(_0x29b174){var _0x1b414e=_0x29b174[_0x7f4f('0x18')],_0x4ac13f=_0x555020[_0x7f4f('0x19')],_0x47a226=_0x555020[_0x7f4f('0x19')]+_0x555020['limit'],_0x5c41f5;if(_0x47a226>=_0x1b414e){_0x47a226=_0x1b414e;_0x5c41f5=0xc8;}else{_0x5c41f5=0xce;}_0x64f4ca['status'](_0x5c41f5);return _0x64f4ca[_0x7f4f('0x1a')](_0x7f4f('0x1b'),_0x4ac13f+'-'+_0x47a226+'/'+_0x1b414e)[_0x7f4f('0x1c')](_0x29b174);}return null;};}function patchUpdates(_0x227527){return function(_0x4ea80d){try{jsonpatch[_0x7f4f('0x1d')](_0x4ea80d,_0x227527,!![]);}catch(_0xa016c1){return BPromise[_0x7f4f('0x1e')](_0xa016c1);}return _0x4ea80d[_0x7f4f('0x1f')]();};}function saveUpdates(_0x419bc5,_0x2d92cf){return function(_0x1a687b){if(_0x1a687b){return _0x1a687b[_0x7f4f('0x20')](_0x419bc5)['then'](function(_0x26e502){return _0x26e502;});}return null;};}function removeEntity(_0x59d0db,_0x225cd5){return function(_0x8975e1){if(_0x8975e1){return _0x8975e1[_0x7f4f('0x21')]()[_0x7f4f('0x22')](function(){_0x59d0db[_0x7f4f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230467,_0x449cd7){return function(_0x7bdbe2){if(!_0x7bdbe2){_0x230467[_0x7f4f('0x23')](0x194);}return _0x7bdbe2;};}function handleError(_0x61e72f,_0x35be7e){_0x35be7e=_0x35be7e||0x1f4;return function(_0x471340){logger[_0x7f4f('0x24')](_0x471340[_0x7f4f('0x25')]);if(_0x471340[_0x7f4f('0x26')]){delete _0x471340[_0x7f4f('0x26')];}_0x61e72f['status'](_0x35be7e)[_0x7f4f('0x27')](_0x471340);};}exports['index']=function(_0x4d2189,_0x1e68b4){var _0x26525d={},_0x51ce56={},_0x13662f={'count':0x0,'rows':[]};var _0x1f834a=_[_0x7f4f('0x28')](db['JscriptySessionReport']['rawAttributes'],function(_0x5dd2af){return{'name':_0x5dd2af['fieldName'],'type':_0x5dd2af['type']['key']};});_0x51ce56['model']=_[_0x7f4f('0x28')](_0x1f834a,_0x7f4f('0x26'));_0x51ce56[_0x7f4f('0x29')]=_[_0x7f4f('0x2a')](_0x4d2189['query']);_0x51ce56[_0x7f4f('0x2b')]=_['intersection'](_0x51ce56[_0x7f4f('0x2c')],_0x51ce56[_0x7f4f('0x29')]);_0x26525d[_0x7f4f('0x2d')]=_[_0x7f4f('0x2e')](_0x51ce56[_0x7f4f('0x2c')],qs[_0x7f4f('0x2f')](_0x4d2189[_0x7f4f('0x29')]['fields']));_0x26525d[_0x7f4f('0x2d')]=_0x26525d['attributes'][_0x7f4f('0x30')]?_0x26525d[_0x7f4f('0x2d')]:_0x51ce56[_0x7f4f('0x2c')];if(!_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x31')](_0x7f4f('0x32'))){_0x26525d['limit']=qs[_0x7f4f('0x33')](_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x33')]);_0x26525d['offset']=qs[_0x7f4f('0x19')](_0x4d2189['query'][_0x7f4f('0x19')]);}_0x26525d[_0x7f4f('0x34')]=qs[_0x7f4f('0x35')](_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x35')]);_0x26525d[_0x7f4f('0x36')]=qs[_0x7f4f('0x2b')](_[_0x7f4f('0x37')](_0x4d2189[_0x7f4f('0x29')],_0x51ce56[_0x7f4f('0x2b')]),_0x1f834a);if(_0x4d2189['query'][_0x7f4f('0x38')]){_0x26525d[_0x7f4f('0x36')]=_['merge'](_0x26525d['where'],{'$or':_['map'](_0x1f834a,function(_0x2e36e6){if(_0x2e36e6[_0x7f4f('0x39')]!==_0x7f4f('0x3a')){var _0x2f8da8={};_0x2f8da8[_0x2e36e6[_0x7f4f('0x26')]]={'$like':'%'+_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x38')]+'%'};return _0x2f8da8;}})});}_0x26525d=_[_0x7f4f('0x3b')]({},_0x26525d,_0x4d2189[_0x7f4f('0x3c')]);var _0x557d89={'where':_0x26525d[_0x7f4f('0x36')]};return db[_0x7f4f('0x3d')][_0x7f4f('0x18')](_0x557d89)[_0x7f4f('0x22')](function(_0x1933a8){_0x13662f[_0x7f4f('0x18')]=_0x1933a8;if(_0x4d2189[_0x7f4f('0x29')][_0x7f4f('0x3e')]){_0x26525d['include']=[{'all':!![]}];}return db[_0x7f4f('0x3d')]['findAll'](_0x26525d);})[_0x7f4f('0x22')](function(_0x475a66){_0x13662f[_0x7f4f('0x3f')]=_0x475a66;return _0x13662f;})[_0x7f4f('0x22')](respondWithFilteredResult(_0x1e68b4,_0x26525d))[_0x7f4f('0x40')](handleError(_0x1e68b4,null));};exports[_0x7f4f('0x41')]=function(_0x36a383,_0x5b89b4){var _0x5a436a={'raw':!![],'where':{'id':_0x36a383[_0x7f4f('0x42')]['id']}},_0x24ef96={};_0x24ef96['model']=_[_0x7f4f('0x2a')](db[_0x7f4f('0x3d')][_0x7f4f('0x43')]);_0x24ef96[_0x7f4f('0x29')]=_[_0x7f4f('0x2a')](_0x36a383['query']);_0x24ef96[_0x7f4f('0x2b')]=_[_0x7f4f('0x2e')](_0x24ef96[_0x7f4f('0x2c')],_0x24ef96[_0x7f4f('0x29')]);_0x5a436a[_0x7f4f('0x2d')]=_[_0x7f4f('0x2e')](_0x24ef96['model'],qs[_0x7f4f('0x2f')](_0x36a383[_0x7f4f('0x29')][_0x7f4f('0x2f')]));_0x5a436a['attributes']=_0x5a436a['attributes'][_0x7f4f('0x30')]?_0x5a436a[_0x7f4f('0x2d')]:_0x24ef96[_0x7f4f('0x2c')];if(_0x36a383[_0x7f4f('0x29')][_0x7f4f('0x3e')]){_0x5a436a[_0x7f4f('0x44')]=[{'all':!![]}];}_0x5a436a=_[_0x7f4f('0x3b')]({},_0x5a436a,_0x36a383[_0x7f4f('0x3c')]);return db['JscriptySessionReport']['find'](_0x5a436a)['then'](handleEntityNotFound(_0x5b89b4,null))[_0x7f4f('0x22')](respondWithResult(_0x5b89b4,null))[_0x7f4f('0x40')](handleError(_0x5b89b4,null));};exports[_0x7f4f('0x45')]=function(_0xcb3798,_0x19bb7c){return db['JscriptySessionReport'][_0x7f4f('0x45')](_0xcb3798[_0x7f4f('0x46')],{})['then'](respondWithResult(_0x19bb7c,0xc9))['catch'](handleError(_0x19bb7c,null));};exports[_0x7f4f('0x20')]=function(_0x47e737,_0x5abe2e){if(_0x47e737[_0x7f4f('0x46')]['id']){delete _0x47e737[_0x7f4f('0x46')]['id'];}return db[_0x7f4f('0x3d')][_0x7f4f('0x47')]({'where':{'id':_0x47e737[_0x7f4f('0x42')]['id']}})[_0x7f4f('0x22')](handleEntityNotFound(_0x5abe2e,null))[_0x7f4f('0x22')](saveUpdates(_0x47e737['body'],null))[_0x7f4f('0x22')](respondWithResult(_0x5abe2e,null))[_0x7f4f('0x40')](handleError(_0x5abe2e,null));};exports['destroy']=function(_0x317614,_0x243c9a){return db[_0x7f4f('0x3d')][_0x7f4f('0x47')]({'where':{'id':_0x317614[_0x7f4f('0x42')]['id']}})[_0x7f4f('0x22')](handleEntityNotFound(_0x243c9a,null))['then'](removeEntity(_0x243c9a,null))[_0x7f4f('0x40')](handleError(_0x243c9a,null));};exports[_0x7f4f('0x48')]=function(_0x471886,_0x4172af){return db[_0x7f4f('0x3d')][_0x7f4f('0x48')]()[_0x7f4f('0x22')](respondWithResult(_0x4172af,null))[_0x7f4f('0x40')](handleError(_0x4172af,null));};exports[_0x7f4f('0x49')]=function(_0x23eacd,_0xc84f60,_0x503dab){var _0x21fa5={'raw':!![],'where':{}};var _0x1c940e={};var _0x8ad013={'count':0x0,'rows':[]};return db[_0x7f4f('0x3d')][_0x7f4f('0x4a')]({'where':{'id':_0x23eacd[_0x7f4f('0x42')]['id']}})[_0x7f4f('0x22')](handleEntityNotFound(_0xc84f60,null))[_0x7f4f('0x22')](function(_0xd90bae){if(_0xd90bae){_0x1c940e['model']=_[_0x7f4f('0x2a')](db[_0x7f4f('0x4b')][_0x7f4f('0x43')]);_0x1c940e[_0x7f4f('0x29')]=_[_0x7f4f('0x2a')](_0x23eacd[_0x7f4f('0x29')]);_0x1c940e[_0x7f4f('0x2b')]=_[_0x7f4f('0x2e')](_0x1c940e[_0x7f4f('0x2c')],_0x1c940e[_0x7f4f('0x29')]);_0x21fa5[_0x7f4f('0x2d')]=_[_0x7f4f('0x2e')](_0x1c940e['model'],qs[_0x7f4f('0x2f')](_0x23eacd[_0x7f4f('0x29')][_0x7f4f('0x2f')]));_0x21fa5[_0x7f4f('0x2d')]=_0x21fa5[_0x7f4f('0x2d')]['length']?_0x21fa5['attributes']:_0x1c940e['model'];if(!_0x23eacd[_0x7f4f('0x29')][_0x7f4f('0x31')](_0x7f4f('0x32'))){_0x21fa5[_0x7f4f('0x33')]=qs[_0x7f4f('0x33')](_0x23eacd[_0x7f4f('0x29')][_0x7f4f('0x33')]);_0x21fa5['offset']=qs[_0x7f4f('0x19')](_0x23eacd['query'][_0x7f4f('0x19')]);}_0x21fa5[_0x7f4f('0x34')]=qs['sort'](_0x23eacd[_0x7f4f('0x29')]['sort']);_0x21fa5[_0x7f4f('0x36')]=qs[_0x7f4f('0x2b')](_[_0x7f4f('0x37')](_0x23eacd['query'],_0x1c940e[_0x7f4f('0x2b')]));_0x21fa5[_0x7f4f('0x36')]['SessionId']=_0xd90bae['id'];if(_0x23eacd[_0x7f4f('0x29')][_0x7f4f('0x38')]){_0x21fa5[_0x7f4f('0x36')]=_['merge'](_0x21fa5[_0x7f4f('0x36')],{'$or':_[_0x7f4f('0x28')](_0x21fa5[_0x7f4f('0x2d')],function(_0x37b06b){var _0x3f7d8d={};_0x3f7d8d[_0x37b06b]={'$like':'%'+_0x23eacd['query'][_0x7f4f('0x38')]+'%'};return _0x3f7d8d;})});}_0x21fa5=_[_0x7f4f('0x3b')]({},_0x21fa5,_0x23eacd[_0x7f4f('0x3c')]);return db[_0x7f4f('0x4b')][_0x7f4f('0x18')]({'where':_0x21fa5[_0x7f4f('0x36')]})[_0x7f4f('0x22')](function(_0x3279cd){_0x8ad013[_0x7f4f('0x18')]=_0x3279cd;if(_0x23eacd[_0x7f4f('0x29')]['includeAll']){_0x21fa5[_0x7f4f('0x44')]=[{'all':!![]}];}return db[_0x7f4f('0x4b')][_0x7f4f('0x4c')](_0x21fa5);})[_0x7f4f('0x22')](function(_0x885ac0){_0x8ad013['rows']=_0x885ac0;return _0x8ad013;});}})[_0x7f4f('0x22')](respondWithFilteredResult(_0xc84f60,_0x21fa5))[_0x7f4f('0x40')](handleError(_0xc84f60,null));}; \ No newline at end of file +var _0x753d=['options','JscriptySessionReport','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','create','body','find','destroy','describe','JscriptyQuestionReport','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','end','error','stack','name','send','index','fieldName','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x1a425a,_0x2b8620){var _0x2506d7=function(_0x41833f){while(--_0x41833f){_0x1a425a['push'](_0x1a425a['shift']());}};_0x2506d7(++_0x2b8620);}(_0x753d,0x141));var _0xd753=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x753d[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xd753('0x0'));var emlformat=require(_0xd753('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd753('0x2'));var rp=require('request-promise');var moment=require(_0xd753('0x3'));var BPromise=require(_0xd753('0x4'));var Mustache=require(_0xd753('0x5'));var util=require(_0xd753('0x6'));var path=require(_0xd753('0x7'));var sox=require('sox');var csv=require(_0xd753('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd753('0x9'));var squel=require('squel');var crypto=require(_0xd753('0xa'));var jsforce=require(_0xd753('0xb'));var deskjs=require(_0xd753('0xc'));var toCsv=require(_0xd753('0x8'));var querystring=require(_0xd753('0xd'));var Papa=require(_0xd753('0xe'));var Redis=require(_0xd753('0xf'));var authService=require(_0xd753('0x10'));var qs=require(_0xd753('0x11'));var as=require(_0xd753('0x12'));var hardwareService=require(_0xd753('0x13'));var logger=require(_0xd753('0x14'))(_0xd753('0x15'));var utils=require(_0xd753('0x16'));var config=require('../../config/environment');var db=require(_0xd753('0x17'))['db'];function respondWithStatusCode(_0x3658ad,_0xde6216){_0xde6216=_0xde6216||0xcc;return function(_0xc6eff6){if(_0xc6eff6){return _0x3658ad[_0xd753('0x18')](_0xde6216);}return _0x3658ad[_0xd753('0x19')](_0xde6216)['end']();};}function respondWithResult(_0x586083,_0x33b514){_0x33b514=_0x33b514||0xc8;return function(_0x5c80fa){if(_0x5c80fa){return _0x586083['status'](_0x33b514)[_0xd753('0x1a')](_0x5c80fa);}};}function respondWithFilteredResult(_0x236156,_0x3e2eb0){return function(_0x373919){if(_0x373919){var _0x511f67=_0x373919[_0xd753('0x1b')],_0x4e8813=_0x3e2eb0[_0xd753('0x1c')],_0x380d6a=_0x3e2eb0[_0xd753('0x1c')]+_0x3e2eb0[_0xd753('0x1d')],_0x76d644;if(_0x380d6a>=_0x511f67){_0x380d6a=_0x511f67;_0x76d644=0xc8;}else{_0x76d644=0xce;}_0x236156[_0xd753('0x19')](_0x76d644);return _0x236156[_0xd753('0x1e')](_0xd753('0x1f'),_0x4e8813+'-'+_0x380d6a+'/'+_0x511f67)[_0xd753('0x1a')](_0x373919);}return null;};}function patchUpdates(_0x16aa49){return function(_0x145e5e){try{jsonpatch['apply'](_0x145e5e,_0x16aa49,!![]);}catch(_0x3f7f07){return BPromise[_0xd753('0x20')](_0x3f7f07);}return _0x145e5e['save']();};}function saveUpdates(_0x2a94c5,_0x569f13){return function(_0x18159f){if(_0x18159f){return _0x18159f[_0xd753('0x21')](_0x2a94c5)['then'](function(_0x12bccf){return _0x12bccf;});}return null;};}function removeEntity(_0x700fc5,_0x3a58e4){return function(_0x1b116b){if(_0x1b116b){return _0x1b116b['destroy']()[_0xd753('0x22')](function(){_0x700fc5[_0xd753('0x19')](0xcc)[_0xd753('0x23')]();});}};}function handleEntityNotFound(_0x2ea128,_0x2b9df3){return function(_0x220c63){if(!_0x220c63){_0x2ea128['sendStatus'](0x194);}return _0x220c63;};}function handleError(_0x14e0be,_0x1a2f19){_0x1a2f19=_0x1a2f19||0x1f4;return function(_0x13b20f){logger[_0xd753('0x24')](_0x13b20f[_0xd753('0x25')]);if(_0x13b20f[_0xd753('0x26')]){delete _0x13b20f[_0xd753('0x26')];}_0x14e0be[_0xd753('0x19')](_0x1a2f19)[_0xd753('0x27')](_0x13b20f);};}exports[_0xd753('0x28')]=function(_0x35a5f4,_0x524fbb){var _0x22818c={},_0x4b6c28={},_0x42b0f8={'count':0x0,'rows':[]};var _0x1bc8f8=_['map'](db['JscriptySessionReport']['rawAttributes'],function(_0x3cbd59){return{'name':_0x3cbd59[_0xd753('0x29')],'type':_0x3cbd59['type'][_0xd753('0x2a')]};});_0x4b6c28[_0xd753('0x2b')]=_[_0xd753('0x2c')](_0x1bc8f8,_0xd753('0x26'));_0x4b6c28['query']=_['keys'](_0x35a5f4[_0xd753('0x2d')]);_0x4b6c28[_0xd753('0x2e')]=_['intersection'](_0x4b6c28['model'],_0x4b6c28[_0xd753('0x2d')]);_0x22818c[_0xd753('0x2f')]=_[_0xd753('0x30')](_0x4b6c28[_0xd753('0x2b')],qs[_0xd753('0x31')](_0x35a5f4[_0xd753('0x2d')][_0xd753('0x31')]));_0x22818c['attributes']=_0x22818c[_0xd753('0x2f')]['length']?_0x22818c['attributes']:_0x4b6c28[_0xd753('0x2b')];if(!_0x35a5f4[_0xd753('0x2d')][_0xd753('0x32')](_0xd753('0x33'))){_0x22818c['limit']=qs[_0xd753('0x1d')](_0x35a5f4[_0xd753('0x2d')][_0xd753('0x1d')]);_0x22818c[_0xd753('0x1c')]=qs['offset'](_0x35a5f4[_0xd753('0x2d')][_0xd753('0x1c')]);}_0x22818c[_0xd753('0x34')]=qs[_0xd753('0x35')](_0x35a5f4[_0xd753('0x2d')]['sort']);_0x22818c[_0xd753('0x36')]=qs['filters'](_[_0xd753('0x37')](_0x35a5f4[_0xd753('0x2d')],_0x4b6c28[_0xd753('0x2e')]),_0x1bc8f8);if(_0x35a5f4[_0xd753('0x2d')][_0xd753('0x38')]){_0x22818c[_0xd753('0x36')]=_[_0xd753('0x39')](_0x22818c[_0xd753('0x36')],{'$or':_['map'](_0x1bc8f8,function(_0x1c3e84){if(_0x1c3e84[_0xd753('0x3a')]!=='VIRTUAL'){var _0x12a30c={};_0x12a30c[_0x1c3e84[_0xd753('0x26')]]={'$like':'%'+_0x35a5f4['query'][_0xd753('0x38')]+'%'};return _0x12a30c;}})});}_0x22818c=_[_0xd753('0x39')]({},_0x22818c,_0x35a5f4[_0xd753('0x3b')]);var _0x59cb8c={'where':_0x22818c['where']};return db[_0xd753('0x3c')][_0xd753('0x1b')](_0x59cb8c)[_0xd753('0x22')](function(_0x156fb4){_0x42b0f8[_0xd753('0x1b')]=_0x156fb4;if(_0x35a5f4[_0xd753('0x2d')][_0xd753('0x3d')]){_0x22818c[_0xd753('0x3e')]=[{'all':!![]}];}return db[_0xd753('0x3c')][_0xd753('0x3f')](_0x22818c);})[_0xd753('0x22')](function(_0x2980d3){_0x42b0f8[_0xd753('0x40')]=_0x2980d3;return _0x42b0f8;})[_0xd753('0x22')](respondWithFilteredResult(_0x524fbb,_0x22818c))[_0xd753('0x41')](handleError(_0x524fbb,null));};exports['show']=function(_0x4e3c94,_0x5b6767){var _0x3ad7c0={'raw':!![],'where':{'id':_0x4e3c94[_0xd753('0x42')]['id']}},_0x3fab0e={};_0x3fab0e['model']=_[_0xd753('0x43')](db[_0xd753('0x3c')][_0xd753('0x44')]);_0x3fab0e[_0xd753('0x2d')]=_['keys'](_0x4e3c94[_0xd753('0x2d')]);_0x3fab0e[_0xd753('0x2e')]=_[_0xd753('0x30')](_0x3fab0e[_0xd753('0x2b')],_0x3fab0e[_0xd753('0x2d')]);_0x3ad7c0[_0xd753('0x2f')]=_[_0xd753('0x30')](_0x3fab0e[_0xd753('0x2b')],qs[_0xd753('0x31')](_0x4e3c94[_0xd753('0x2d')][_0xd753('0x31')]));_0x3ad7c0[_0xd753('0x2f')]=_0x3ad7c0['attributes'][_0xd753('0x45')]?_0x3ad7c0[_0xd753('0x2f')]:_0x3fab0e['model'];if(_0x4e3c94['query'][_0xd753('0x3d')]){_0x3ad7c0[_0xd753('0x3e')]=[{'all':!![]}];}_0x3ad7c0=_['merge']({},_0x3ad7c0,_0x4e3c94[_0xd753('0x3b')]);return db[_0xd753('0x3c')]['find'](_0x3ad7c0)['then'](handleEntityNotFound(_0x5b6767,null))[_0xd753('0x22')](respondWithResult(_0x5b6767,null))['catch'](handleError(_0x5b6767,null));};exports[_0xd753('0x46')]=function(_0x1ea922,_0x3e165a){return db[_0xd753('0x3c')][_0xd753('0x46')](_0x1ea922[_0xd753('0x47')],{})[_0xd753('0x22')](respondWithResult(_0x3e165a,0xc9))['catch'](handleError(_0x3e165a,null));};exports[_0xd753('0x21')]=function(_0x515940,_0x194e47){if(_0x515940[_0xd753('0x47')]['id']){delete _0x515940[_0xd753('0x47')]['id'];}return db[_0xd753('0x3c')][_0xd753('0x48')]({'where':{'id':_0x515940[_0xd753('0x42')]['id']}})[_0xd753('0x22')](handleEntityNotFound(_0x194e47,null))[_0xd753('0x22')](saveUpdates(_0x515940[_0xd753('0x47')],null))[_0xd753('0x22')](respondWithResult(_0x194e47,null))['catch'](handleError(_0x194e47,null));};exports[_0xd753('0x49')]=function(_0x3af6fc,_0x2acacb){return db[_0xd753('0x3c')][_0xd753('0x48')]({'where':{'id':_0x3af6fc[_0xd753('0x42')]['id']}})['then'](handleEntityNotFound(_0x2acacb,null))[_0xd753('0x22')](removeEntity(_0x2acacb,null))[_0xd753('0x41')](handleError(_0x2acacb,null));};exports['describe']=function(_0x2ec7c3,_0x45a0f3){return db[_0xd753('0x3c')][_0xd753('0x4a')]()[_0xd753('0x22')](respondWithResult(_0x45a0f3,null))[_0xd753('0x41')](handleError(_0x45a0f3,null));};exports['getQuestions']=function(_0x318199,_0x496d3d,_0x594c89){var _0x53ffb5={'raw':!![],'where':{}};var _0x147d13={};var _0x5b26b7={'count':0x0,'rows':[]};return db[_0xd753('0x3c')]['findOne']({'where':{'id':_0x318199['params']['id']}})[_0xd753('0x22')](handleEntityNotFound(_0x496d3d,null))[_0xd753('0x22')](function(_0x56652e){if(_0x56652e){_0x147d13[_0xd753('0x2b')]=_[_0xd753('0x43')](db[_0xd753('0x4b')]['rawAttributes']);_0x147d13[_0xd753('0x2d')]=_[_0xd753('0x43')](_0x318199[_0xd753('0x2d')]);_0x147d13[_0xd753('0x2e')]=_['intersection'](_0x147d13[_0xd753('0x2b')],_0x147d13[_0xd753('0x2d')]);_0x53ffb5[_0xd753('0x2f')]=_[_0xd753('0x30')](_0x147d13[_0xd753('0x2b')],qs[_0xd753('0x31')](_0x318199[_0xd753('0x2d')][_0xd753('0x31')]));_0x53ffb5['attributes']=_0x53ffb5[_0xd753('0x2f')][_0xd753('0x45')]?_0x53ffb5['attributes']:_0x147d13[_0xd753('0x2b')];if(!_0x318199['query'][_0xd753('0x32')](_0xd753('0x33'))){_0x53ffb5[_0xd753('0x1d')]=qs[_0xd753('0x1d')](_0x318199['query'][_0xd753('0x1d')]);_0x53ffb5['offset']=qs[_0xd753('0x1c')](_0x318199[_0xd753('0x2d')][_0xd753('0x1c')]);}_0x53ffb5[_0xd753('0x34')]=qs[_0xd753('0x35')](_0x318199[_0xd753('0x2d')][_0xd753('0x35')]);_0x53ffb5[_0xd753('0x36')]=qs['filters'](_[_0xd753('0x37')](_0x318199['query'],_0x147d13['filters']));_0x53ffb5['where']['SessionId']=_0x56652e['id'];if(_0x318199['query'][_0xd753('0x38')]){_0x53ffb5[_0xd753('0x36')]=_[_0xd753('0x39')](_0x53ffb5[_0xd753('0x36')],{'$or':_[_0xd753('0x2c')](_0x53ffb5[_0xd753('0x2f')],function(_0x500885){var _0x2af92f={};_0x2af92f[_0x500885]={'$like':'%'+_0x318199[_0xd753('0x2d')][_0xd753('0x38')]+'%'};return _0x2af92f;})});}_0x53ffb5=_['merge']({},_0x53ffb5,_0x318199[_0xd753('0x3b')]);return db[_0xd753('0x4b')][_0xd753('0x1b')]({'where':_0x53ffb5[_0xd753('0x36')]})['then'](function(_0x41c0a0){_0x5b26b7[_0xd753('0x1b')]=_0x41c0a0;if(_0x318199['query'][_0xd753('0x3d')]){_0x53ffb5[_0xd753('0x3e')]=[{'all':!![]}];}return db[_0xd753('0x4b')]['findAll'](_0x53ffb5);})['then'](function(_0x5789fc){_0x5b26b7[_0xd753('0x40')]=_0x5789fc;return _0x5b26b7;});}})[_0xd753('0x22')](respondWithFilteredResult(_0x496d3d,_0x53ffb5))[_0xd753('0x41')](handleError(_0x496d3d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 1dec656..3ad67d4 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 _0x38b8=['../../config/logger','api','bluebird','rimraf','../../config/environment','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x38b8,0x7f));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x838b('0x0'));var util=require('util');var logger=require(_0x838b('0x1'))(_0x838b('0x2'));var moment=require('moment');var BPromise=require(_0x838b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x838b('0x4'));var config=require(_0x838b('0x5'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x43fd53,_0x4299dc){return _0x43fd53['define'](_0x838b('0x6'),attributes,{'tableName':_0x838b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0120=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0x0120,0x6f));var _0x0012=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0120[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));module[_0x0012('0xb')]=function(_0x4eaa5b,_0x4b396c){return _0x4eaa5b['define'](_0x0012('0xc'),attributes,{'tableName':_0x0012('0xd'),'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 b6b8343..4b8aee7 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 _0xc67b=['util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xc67b,0x17a));var _0xbc67=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc67b[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xbc67('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbc67('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc67('0x2'))['db'];var utils=require(_0xbc67('0x3'));var logger=require('../../config/logger')(_0xbc67('0x4'));var config=require(_0xbc67('0x5'));var jayson=require(_0xbc67('0x6'));var client=jayson[_0xbc67('0x7')][_0xbc67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eb7ca,_0x14f949,_0x4f0be4){return new BPromise(function(_0x55cf26,_0x5eae18){return client[_0xbc67('0x9')](_0x1eb7ca,_0x4f0be4)[_0xbc67('0xa')](function(_0x35b900){logger['info'](_0xbc67('0xb'),_0x14f949,_0xbc67('0xc'));logger[_0xbc67('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x14f949,'request\x20sent',JSON[_0xbc67('0xe')](_0x35b900));if(_0x35b900[_0xbc67('0xf')]){if(_0x35b900[_0xbc67('0xf')][_0xbc67('0x10')]===0x1f4){logger[_0xbc67('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x14f949,_0x35b900['error'][_0xbc67('0x11')]);return _0x5eae18(_0x35b900['error'][_0xbc67('0x11')]);}logger['error'](_0xbc67('0xb'),_0x14f949,_0x35b900[_0xbc67('0xf')][_0xbc67('0x11')]);return _0x55cf26(_0x35b900[_0xbc67('0xf')]['message']);}else{logger[_0xbc67('0x12')](_0xbc67('0xb'),_0x14f949,_0xbc67('0xc'));_0x55cf26(_0x35b900[_0xbc67('0x13')][_0xbc67('0x11')]);}})[_0xbc67('0x14')](function(_0x4bd640){logger[_0xbc67('0xf')](_0xbc67('0xb'),_0x14f949,_0x4bd640);_0x5eae18(_0x4bd640);});});} \ No newline at end of file +var _0xfde8=['rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x29486f,_0x23a728){var _0x2893c7=function(_0x494d70){while(--_0x494d70){_0x29486f['push'](_0x29486f['shift']());}};_0x2893c7(++_0x23a728);}(_0xfde8,0x111));var _0x8fde=function(_0x3d22ac,_0x2f2663){_0x3d22ac=_0x3d22ac-0x0;var _0x1d8f78=_0xfde8[_0x3d22ac];return _0x1d8f78;};'use strict';var _=require('lodash');var util=require(_0x8fde('0x0'));var moment=require(_0x8fde('0x1'));var BPromise=require(_0x8fde('0x2'));var rs=require(_0x8fde('0x3'));var fs=require('fs');var Redis=require(_0x8fde('0x4'));var db=require(_0x8fde('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fde('0x6'))(_0x8fde('0x7'));var config=require(_0x8fde('0x8'));var jayson=require(_0x8fde('0x9'));var client=jayson[_0x8fde('0xa')][_0x8fde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47d8b9,_0x2f7e6b,_0x217453){return new BPromise(function(_0x38e62c,_0x24cca5){return client['request'](_0x47d8b9,_0x217453)['then'](function(_0x37aea8){logger[_0x8fde('0xc')](_0x8fde('0xd'),_0x2f7e6b,_0x8fde('0xe'));logger['debug'](_0x8fde('0xf'),_0x2f7e6b,'request\x20sent',JSON['stringify'](_0x37aea8));if(_0x37aea8[_0x8fde('0x10')]){if(_0x37aea8['error'][_0x8fde('0x11')]===0x1f4){logger[_0x8fde('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f7e6b,_0x37aea8[_0x8fde('0x10')][_0x8fde('0x12')]);return _0x24cca5(_0x37aea8[_0x8fde('0x10')]['message']);}logger['error'](_0x8fde('0xd'),_0x2f7e6b,_0x37aea8['error']['message']);return _0x38e62c(_0x37aea8['error'][_0x8fde('0x12')]);}else{logger[_0x8fde('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f7e6b,'request\x20sent');_0x38e62c(_0x37aea8['result'][_0x8fde('0x12')]);}})[_0x8fde('0x13')](function(_0x33398b){logger[_0x8fde('0x10')](_0x8fde('0xd'),_0x2f7e6b,_0x33398b);_0x24cca5(_0x33398b);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 4bfff5c..6e07c7c 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 _0x0840=['put','isAuthenticated','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./license.controller','get'];(function(_0x5afd6a,_0x559bee){var _0xb2a24d=function(_0x15ca38){while(--_0x15ca38){_0x5afd6a['push'](_0x5afd6a['shift']());}};_0xb2a24d(++_0x559bee);}(_0x0840,0x6b));var _0x0084=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x0840[_0x22eb96];return _0x5e1adf;};'use strict';var multer=require(_0x0084('0x0'));var util=require(_0x0084('0x1'));var path=require(_0x0084('0x2'));var timeout=require(_0x0084('0x3'));var express=require(_0x0084('0x4'));var router=express[_0x0084('0x5')]();var auth=require(_0x0084('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0084('0x7'));var controller=require(_0x0084('0x8'));router[_0x0084('0x9')]('/',controller['index']);router[_0x0084('0xa')]('/:id',auth[_0x0084('0xb')](),controller[_0x0084('0xc')]);module['exports']=router; \ No newline at end of file +var _0x50b6=['index','/:id','isAuthenticated','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x50b6,0x64));var _0x650b=function(_0x14ab74,_0x770feb){_0x14ab74=_0x14ab74-0x0;var _0x27858b=_0x50b6[_0x14ab74];return _0x27858b;};'use strict';var multer=require(_0x650b('0x0'));var util=require(_0x650b('0x1'));var path=require(_0x650b('0x2'));var timeout=require(_0x650b('0x3'));var express=require(_0x650b('0x4'));var router=express['Router']();var auth=require(_0x650b('0x5'));var interaction=require(_0x650b('0x6'));var config=require(_0x650b('0x7'));var controller=require('./license.controller');router['get']('/',controller[_0x650b('0x8')]);router['put'](_0x650b('0x9'),auth[_0x650b('0xa')](),controller['update']);module[_0x650b('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 ffe8ee9..462bc07 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 _0x4819=['INTEGER','exports','TEXT','STRING'];(function(_0x1fbd72,_0x5b353f){var _0x47e61a=function(_0x24581a){while(--_0x24581a){_0x1fbd72['push'](_0x1fbd72['shift']());}};_0x47e61a(++_0x5b353f);}(_0x4819,0xcd));var _0x9481=function(_0x597992,_0x516580){_0x597992=_0x597992-0x0;var _0x2bea67=_0x4819[_0x597992];return _0x2bea67;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'license':{'type':Sequelize[_0x9481('0x1')]},'data1':{'type':Sequelize[_0x9481('0x2')]},'data2':{'type':Sequelize[_0x9481('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x9481('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xda19=['exports','TEXT','STRING'];(function(_0x2a8e60,_0xd4fd67){var _0x35371c=function(_0x386dd6){while(--_0x386dd6){_0x2a8e60['push'](_0x2a8e60['shift']());}};_0x35371c(++_0xd4fd67);}(_0xda19,0xd5));var _0x9da1=function(_0x35d8d5,_0x53b9fa){_0x35d8d5=_0x35d8d5-0x0;var _0x540655=_0xda19[_0x35d8d5];return _0x540655;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'license':{'type':Sequelize[_0x9da1('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9da1('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index da32978..38c34bf 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 _0x62ba=['../../config/environment','sendStatus','end','json','offset','limit','status','set','Content-Range','reject','then','stack','name','send','../../config/license/util','index','keys','License','rawAttributes','query','intersection','model','attributes','fields','length','merge','options','getLicense','catch','update','body','find','params','get','checkLicense','key','demo','html-pdf','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x5c0122,_0x3ec654){var _0x15daf3=function(_0x3ae671){while(--_0x3ae671){_0x5c0122['push'](_0x5c0122['shift']());}};_0x15daf3(++_0x3ec654);}(_0x62ba,0x10d));var _0xa62b=function(_0x4bb8ce,_0x2e7bf3){_0x4bb8ce=_0x4bb8ce-0x0;var _0x1ec99f=_0x62ba[_0x4bb8ce];return _0x1ec99f;};'use strict';var pdf=require(_0xa62b('0x0'));var emlformat=require(_0xa62b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa62b('0x2'));var BPromise=require(_0xa62b('0x3'));var Mustache=require(_0xa62b('0x4'));var util=require(_0xa62b('0x5'));var path=require(_0xa62b('0x6'));var sox=require(_0xa62b('0x7'));var csv=require(_0xa62b('0x8'));var ejs=require(_0xa62b('0x9'));var fs=require('fs');var _=require(_0xa62b('0xa'));var squel=require('squel');var crypto=require(_0xa62b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa62b('0xc'));var toCsv=require(_0xa62b('0x8'));var querystring=require(_0xa62b('0xd'));var Papa=require(_0xa62b('0xe'));var Redis=require(_0xa62b('0xf'));var authService=require(_0xa62b('0x10'));var qs=require(_0xa62b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa62b('0x12'))(_0xa62b('0x13'));var utils=require(_0xa62b('0x14'));var config=require(_0xa62b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaa1759,_0x5ef11e){_0x5ef11e=_0x5ef11e||0xcc;return function(_0x3a9399){if(_0x3a9399){return _0xaa1759[_0xa62b('0x16')](_0x5ef11e);}return _0xaa1759['status'](_0x5ef11e)[_0xa62b('0x17')]();};}function respondWithResult(_0x307ccc,_0x103908){_0x103908=_0x103908||0xc8;return function(_0x2fc58e){if(_0x2fc58e){return _0x307ccc['status'](_0x103908)[_0xa62b('0x18')](_0x2fc58e);}};}function respondWithFilteredResult(_0x4fd309,_0x310fe0){return function(_0x6c757b){if(_0x6c757b){var _0x14e911=_0x6c757b['count'],_0x2a638e=_0x310fe0[_0xa62b('0x19')],_0x355485=_0x310fe0['offset']+_0x310fe0[_0xa62b('0x1a')],_0x10a9e0;if(_0x355485>=_0x14e911){_0x355485=_0x14e911;_0x10a9e0=0xc8;}else{_0x10a9e0=0xce;}_0x4fd309[_0xa62b('0x1b')](_0x10a9e0);return _0x4fd309[_0xa62b('0x1c')](_0xa62b('0x1d'),_0x2a638e+'-'+_0x355485+'/'+_0x14e911)['json'](_0x6c757b);}return null;};}function patchUpdates(_0x4a5ac5){return function(_0x46eff9){try{jsonpatch['apply'](_0x46eff9,_0x4a5ac5,!![]);}catch(_0x199f92){return BPromise[_0xa62b('0x1e')](_0x199f92);}return _0x46eff9['save']();};}function saveUpdates(_0x1fa681,_0x3feec0){return function(_0x358eb9){if(_0x358eb9){return _0x358eb9['update'](_0x1fa681)['then'](function(_0x529354){return _0x529354;});}return null;};}function removeEntity(_0x3fea58,_0x238ecf){return function(_0x32df02){if(_0x32df02){return _0x32df02['destroy']()[_0xa62b('0x1f')](function(){_0x3fea58[_0xa62b('0x1b')](0xcc)[_0xa62b('0x17')]();});}};}function handleEntityNotFound(_0x5dd4f0,_0x545485){return function(_0x565663){if(!_0x565663){_0x5dd4f0[_0xa62b('0x16')](0x194);}return _0x565663;};}function handleError(_0x4c5b72,_0x3c4a7a){_0x3c4a7a=_0x3c4a7a||0x1f4;return function(_0x5c63ea){logger['error'](_0x5c63ea[_0xa62b('0x20')]);if(_0x5c63ea[_0xa62b('0x21')]){delete _0x5c63ea[_0xa62b('0x21')];}_0x4c5b72['status'](_0x3c4a7a)[_0xa62b('0x22')](_0x5c63ea);};}var utilLicense=require(_0xa62b('0x23'));exports[_0xa62b('0x24')]=function(_0xa706f0,_0x2dc404){var _0x534210={'raw':!![],'where':{'id':0x1}},_0x3c2a67={};_0x3c2a67['model']=_[_0xa62b('0x25')](db[_0xa62b('0x26')][_0xa62b('0x27')]);_0x3c2a67['query']=_[_0xa62b('0x25')](_0xa706f0[_0xa62b('0x28')]);_0x3c2a67['filters']=_[_0xa62b('0x29')](_0x3c2a67[_0xa62b('0x2a')],_0x3c2a67[_0xa62b('0x28')]);_0x534210[_0xa62b('0x2b')]=_['intersection'](_0x3c2a67[_0xa62b('0x2a')],qs[_0xa62b('0x2c')](_0xa706f0['query'][_0xa62b('0x2c')]));_0x534210[_0xa62b('0x2b')]=_0x534210[_0xa62b('0x2b')][_0xa62b('0x2d')]?_0x534210[_0xa62b('0x2b')]:_0x3c2a67[_0xa62b('0x2a')];_0x534210=_[_0xa62b('0x2e')]({},_0x534210,_0xa706f0[_0xa62b('0x2f')]);return utilLicense[_0xa62b('0x30')](_0x534210)[_0xa62b('0x1f')](respondWithResult(_0x2dc404,null))[_0xa62b('0x31')](handleError(_0x2dc404,null));};exports[_0xa62b('0x32')]=function(_0x5b65bc,_0x3ebeb0){if(_0x5b65bc[_0xa62b('0x33')]['id']){delete _0x5b65bc[_0xa62b('0x33')]['id'];}return db[_0xa62b('0x26')][_0xa62b('0x34')]({'where':{'id':_0x5b65bc[_0xa62b('0x35')]['id']}})[_0xa62b('0x1f')](handleEntityNotFound(_0x3ebeb0,null))[_0xa62b('0x1f')](function(_0x1dd497){var _0x4b5c1d=_0x1dd497[_0xa62b('0x36')]({'plain':!![]});return utilLicense[_0xa62b('0x37')](_0x4b5c1d,_0x5b65bc[_0xa62b('0x33')][_0xa62b('0x38')]);})[_0xa62b('0x1f')](function(_0x3203ce){if(!_0x3203ce[_0xa62b('0x39')]){return saveUpdates(_0x5b65bc[_0xa62b('0x33')],null);}return _0x3203ce;})['then'](respondWithResult(_0x3ebeb0,null))['catch'](handleError(_0x3ebeb0,null));}; \ No newline at end of file +var _0x50d9=['keys','filters','intersection','model','attributes','fields','length','merge','getLicense','catch','body','find','params','get','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','send','License','rawAttributes','query'];(function(_0x17141f,_0x4d7c4b){var _0x3ee900=function(_0x5ec0f4){while(--_0x5ec0f4){_0x17141f['push'](_0x17141f['shift']());}};_0x3ee900(++_0x4d7c4b);}(_0x50d9,0x7b));var _0x950d=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x50d9[_0xae7c2f];return _0x5d7001;};'use strict';var pdf=require(_0x950d('0x0'));var emlformat=require(_0x950d('0x1'));var rimraf=require(_0x950d('0x2'));var zipdir=require(_0x950d('0x3'));var jsonpatch=require(_0x950d('0x4'));var rp=require(_0x950d('0x5'));var moment=require(_0x950d('0x6'));var BPromise=require(_0x950d('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x950d('0x8'));var sox=require(_0x950d('0x9'));var csv=require(_0x950d('0xa'));var ejs=require(_0x950d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x950d('0xc'));var crypto=require(_0x950d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x950d('0xa'));var querystring=require('querystring');var Papa=require(_0x950d('0xe'));var Redis=require(_0x950d('0xf'));var authService=require(_0x950d('0x10'));var qs=require(_0x950d('0x11'));var as=require(_0x950d('0x12'));var hardwareService=require(_0x950d('0x13'));var logger=require('../../config/logger')(_0x950d('0x14'));var utils=require('../../config/utils');var config=require(_0x950d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52e0a6,_0x2312dc){_0x2312dc=_0x2312dc||0xcc;return function(_0xcebead){if(_0xcebead){return _0x52e0a6[_0x950d('0x16')](_0x2312dc);}return _0x52e0a6[_0x950d('0x17')](_0x2312dc)['end']();};}function respondWithResult(_0x57ecdb,_0x38f01c){_0x38f01c=_0x38f01c||0xc8;return function(_0xfbd76c){if(_0xfbd76c){return _0x57ecdb[_0x950d('0x17')](_0x38f01c)[_0x950d('0x18')](_0xfbd76c);}};}function respondWithFilteredResult(_0x516413,_0x31772f){return function(_0x238a74){if(_0x238a74){var _0x561d61=_0x238a74[_0x950d('0x19')],_0x34be3f=_0x31772f[_0x950d('0x1a')],_0x1f002a=_0x31772f['offset']+_0x31772f['limit'],_0x5c5d53;if(_0x1f002a>=_0x561d61){_0x1f002a=_0x561d61;_0x5c5d53=0xc8;}else{_0x5c5d53=0xce;}_0x516413[_0x950d('0x17')](_0x5c5d53);return _0x516413['set'](_0x950d('0x1b'),_0x34be3f+'-'+_0x1f002a+'/'+_0x561d61)['json'](_0x238a74);}return null;};}function patchUpdates(_0x53b79b){return function(_0x9cf092){try{jsonpatch[_0x950d('0x1c')](_0x9cf092,_0x53b79b,!![]);}catch(_0x564cdb){return BPromise[_0x950d('0x1d')](_0x564cdb);}return _0x9cf092[_0x950d('0x1e')]();};}function saveUpdates(_0x2883f4,_0x51a0a1){return function(_0x1830c6){if(_0x1830c6){return _0x1830c6[_0x950d('0x1f')](_0x2883f4)[_0x950d('0x20')](function(_0x2a3d36){return _0x2a3d36;});}return null;};}function removeEntity(_0x24fb4c,_0x9b18bb){return function(_0x206995){if(_0x206995){return _0x206995[_0x950d('0x21')]()['then'](function(){_0x24fb4c['status'](0xcc)[_0x950d('0x22')]();});}};}function handleEntityNotFound(_0x7a9faa,_0x9de99f){return function(_0x6a6271){if(!_0x6a6271){_0x7a9faa[_0x950d('0x16')](0x194);}return _0x6a6271;};}function handleError(_0x1292a4,_0x3ac7e7){_0x3ac7e7=_0x3ac7e7||0x1f4;return function(_0x20dbd5){logger['error'](_0x20dbd5['stack']);if(_0x20dbd5['name']){delete _0x20dbd5['name'];}_0x1292a4[_0x950d('0x17')](_0x3ac7e7)[_0x950d('0x23')](_0x20dbd5);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x517a53,_0x27ac2e){var _0x405848={'raw':!![],'where':{'id':0x1}},_0x8763f7={};_0x8763f7['model']=_['keys'](db[_0x950d('0x24')][_0x950d('0x25')]);_0x8763f7[_0x950d('0x26')]=_[_0x950d('0x27')](_0x517a53[_0x950d('0x26')]);_0x8763f7[_0x950d('0x28')]=_[_0x950d('0x29')](_0x8763f7[_0x950d('0x2a')],_0x8763f7[_0x950d('0x26')]);_0x405848[_0x950d('0x2b')]=_[_0x950d('0x29')](_0x8763f7[_0x950d('0x2a')],qs[_0x950d('0x2c')](_0x517a53[_0x950d('0x26')][_0x950d('0x2c')]));_0x405848[_0x950d('0x2b')]=_0x405848[_0x950d('0x2b')][_0x950d('0x2d')]?_0x405848[_0x950d('0x2b')]:_0x8763f7[_0x950d('0x2a')];_0x405848=_[_0x950d('0x2e')]({},_0x405848,_0x517a53['options']);return utilLicense[_0x950d('0x2f')](_0x405848)[_0x950d('0x20')](respondWithResult(_0x27ac2e,null))[_0x950d('0x30')](handleError(_0x27ac2e,null));};exports['update']=function(_0x1e7175,_0x19bad2){if(_0x1e7175[_0x950d('0x31')]['id']){delete _0x1e7175['body']['id'];}return db[_0x950d('0x24')][_0x950d('0x32')]({'where':{'id':_0x1e7175[_0x950d('0x33')]['id']}})[_0x950d('0x20')](handleEntityNotFound(_0x19bad2,null))[_0x950d('0x20')](function(_0x4b32a7){var _0x5b8296=_0x4b32a7[_0x950d('0x34')]({'plain':!![]});return utilLicense['checkLicense'](_0x5b8296,_0x1e7175['body']['key']);})['then'](function(_0x3a6c18){if(!_0x3a6c18[_0x950d('0x35')]){return saveUpdates(_0x1e7175[_0x950d('0x31')],null);}return _0x3a6c18;})[_0x950d('0x20')](respondWithResult(_0x19bad2,null))[_0x950d('0x30')](handleError(_0x19bad2,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4dd8019..7ee11ae 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x35d3a8,_0x44406a){var _0x182378=function(_0x298e0b){while(--_0x298e0b){_0x35d3a8['push'](_0x35d3a8['shift']());}};_0x182378(++_0x44406a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a5b9f,_0x599f46){_0x3a5b9f=_0x3a5b9f-0x0;var _0x4e9b72=_0xb10b[_0x3a5b9f];return _0x4e9b72;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./license.attributes','exports','define','License','lodash','util','../../config/logger','api','moment'];(function(_0x471760,_0x51d47e){var _0x18b91d=function(_0x4dcc94){while(--_0x4dcc94){_0x471760['push'](_0x471760['shift']());}};_0x18b91d(++_0x51d47e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x5f2f[_0x412e27];return _0x53da42;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index d5ce28c..a15cf2b 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 _0x652b=['util','moment','randomstring','../../config/utils','../../config/logger','rpc','client','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','License,\x20%s,\x20%s','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x652b,0x68));var _0xb652=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x652b[_0x57975f];return _0x4793b8;};'use strict';var _=require(_0xb652('0x0'));var util=require(_0xb652('0x1'));var moment=require(_0xb652('0x2'));var BPromise=require('bluebird');var rs=require(_0xb652('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb652('0x4'));var logger=require(_0xb652('0x5'))(_0xb652('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb652('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58d168,_0x10b742,_0x5c0245){return new BPromise(function(_0x2b82fd,_0x117e49){return client[_0xb652('0x8')](_0x58d168,_0x5c0245)[_0xb652('0x9')](function(_0x2f06f0){logger[_0xb652('0xa')]('License,\x20%s,\x20%s',_0x10b742,'request\x20sent');logger[_0xb652('0xb')](_0xb652('0xc'),_0x10b742,_0xb652('0xd'),JSON[_0xb652('0xe')](_0x2f06f0));if(_0x2f06f0['error']){if(_0x2f06f0[_0xb652('0xf')][_0xb652('0x10')]===0x1f4){logger[_0xb652('0xf')]('License,\x20%s,\x20%s',_0x10b742,_0x2f06f0[_0xb652('0xf')][_0xb652('0x11')]);return _0x117e49(_0x2f06f0['error']['message']);}logger['error']('License,\x20%s,\x20%s',_0x10b742,_0x2f06f0[_0xb652('0xf')]['message']);return _0x2b82fd(_0x2f06f0[_0xb652('0xf')][_0xb652('0x11')]);}else{logger[_0xb652('0xa')]('License,\x20%s,\x20%s',_0x10b742,_0xb652('0xd'));_0x2b82fd(_0x2f06f0[_0xb652('0x12')][_0xb652('0x11')]);}})[_0xb652('0x13')](function(_0x4ba393){logger[_0xb652('0xf')](_0xb652('0x14'),_0x10b742,_0x4ba393);_0x117e49(_0x4ba393);});});} \ No newline at end of file +var _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2ff055,_0x43cb6f){var _0x3c579b=function(_0x2d98b1){while(--_0x2d98b1){_0x2ff055['push'](_0x2ff055['shift']());}};_0x3c579b(++_0x43cb6f);}(_0xa75b,0x170));var _0xba75=function(_0x2f2846,_0x4bb408){_0x2f2846=_0x2f2846-0x0;var _0x1175b2=_0xa75b[_0x2f2846];return _0x1175b2;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f283f16..2160ae1 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 _0x073e=['/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','addSmtp','addInteraction'];(function(_0x402f08,_0x5a3d66){var _0x14632a=function(_0x3e3584){while(--_0x3e3584){_0x402f08['push'](_0x402f08['shift']());}};_0x14632a(++_0x5a3d66);}(_0x073e,0x14e));var _0xe073=function(_0x329101,_0x1eb476){_0x329101=_0x329101-0x0;var _0x1641d6=_0x073e[_0x329101];return _0x1641d6;};'use strict';var multer=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var path=require(_0xe073('0x2'));var timeout=require(_0xe073('0x3'));var express=require(_0xe073('0x4'));var router=express['Router']();var auth=require(_0xe073('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe073('0x6'));var controller=require(_0xe073('0x7'));router[_0xe073('0x8')]('/',auth[_0xe073('0x9')](),controller[_0xe073('0xa')]);router[_0xe073('0x8')](_0xe073('0xb'),auth[_0xe073('0x9')](),controller[_0xe073('0xc')]);router[_0xe073('0x8')](_0xe073('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe073('0x8')](_0xe073('0xe'),auth[_0xe073('0x9')](),controller[_0xe073('0xf')]);router[_0xe073('0x8')]('/:id/canned_answers',auth[_0xe073('0x9')](),controller[_0xe073('0x10')]);router[_0xe073('0x8')](_0xe073('0x11'),auth['isAuthenticated'](),controller[_0xe073('0x12')]);router['get'](_0xe073('0x13'),auth['isAuthenticated'](),controller['getSmtp']);router[_0xe073('0x8')](_0xe073('0x14'),auth[_0xe073('0x9')](),controller[_0xe073('0x15')]);router[_0xe073('0x8')](_0xe073('0x16'),auth[_0xe073('0x9')](),controller[_0xe073('0x17')]);router['get']('/:id/messages',auth[_0xe073('0x9')](),controller[_0xe073('0x18')]);router[_0xe073('0x8')](_0xe073('0x19'),auth[_0xe073('0x9')](),controller[_0xe073('0x1a')]);router[_0xe073('0x8')](_0xe073('0x1b'),auth['isAuthenticated'](),controller[_0xe073('0x1c')]);router['post'](_0xe073('0xe'),auth['isAuthenticated'](),controller[_0xe073('0x1d')]);router[_0xe073('0x1e')]('/:id/canned_answers',auth[_0xe073('0x9')](),controller[_0xe073('0x1f')]);router[_0xe073('0x1e')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe073('0x1e')](_0xe073('0x11'),auth[_0xe073('0x9')](),controller['addImap']);router[_0xe073('0x1e')](_0xe073('0x13'),auth[_0xe073('0x9')](),controller[_0xe073('0x20')]);router[_0xe073('0x1e')](_0xe073('0x14'),auth[_0xe073('0x9')](),controller[_0xe073('0x21')]);router[_0xe073('0x1e')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xe073('0x1e')](_0xe073('0x22'),auth[_0xe073('0x9')](),controller[_0xe073('0x23')]);router[_0xe073('0x1e')](_0xe073('0x1b'),auth['isAuthenticated'](),controller[_0xe073('0x24')]);router['put'](_0xe073('0xd'),auth[_0xe073('0x9')](),controller[_0xe073('0x25')]);router[_0xe073('0x26')](_0xe073('0xe'),auth[_0xe073('0x9')](),controller[_0xe073('0x27')]);router[_0xe073('0x26')]('/:id/canned_answers',auth[_0xe073('0x9')](),controller[_0xe073('0x28')]);router[_0xe073('0x26')]('/:id/in_servers',auth[_0xe073('0x9')](),controller[_0xe073('0x29')]);router[_0xe073('0x26')]('/:id/out_servers',auth[_0xe073('0x9')](),controller[_0xe073('0x2a')]);router[_0xe073('0x26')](_0xe073('0xd'),auth[_0xe073('0x9')](),controller[_0xe073('0x2b')]);router[_0xe073('0x26')](_0xe073('0x1b'),auth[_0xe073('0x9')](),controller[_0xe073('0x2c')]);module[_0xe073('0x2d')]=router; \ No newline at end of file +var _0x12b9=['/:id/dispositions','getDispositions','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','update','delete','/:id/canned_answers','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x121886,_0x8cd8e5){var _0x20ca01=function(_0x15e144){while(--_0x15e144){_0x121886['push'](_0x121886['shift']());}};_0x20ca01(++_0x8cd8e5);}(_0x12b9,0x17a));var _0x912b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x912b('0x0'));var express=require(_0x912b('0x1'));var router=express[_0x912b('0x2')]();var auth=require(_0x912b('0x3'));var interaction=require(_0x912b('0x4'));var config=require(_0x912b('0x5'));var controller=require(_0x912b('0x6'));router[_0x912b('0x7')]('/',auth[_0x912b('0x8')](),controller[_0x912b('0x9')]);router['get'](_0x912b('0xa'),auth['isAuthenticated'](),controller[_0x912b('0xb')]);router[_0x912b('0x7')](_0x912b('0xc'),auth['isAuthenticated'](),controller[_0x912b('0xd')]);router[_0x912b('0x7')](_0x912b('0xe'),auth[_0x912b('0x8')](),controller[_0x912b('0xf')]);router[_0x912b('0x7')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x912b('0x7')](_0x912b('0x10'),auth[_0x912b('0x8')](),controller[_0x912b('0x11')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x912b('0x12')]);router[_0x912b('0x7')](_0x912b('0x13'),auth[_0x912b('0x8')](),controller[_0x912b('0x14')]);router[_0x912b('0x7')](_0x912b('0x15'),auth['isAuthenticated'](),controller[_0x912b('0x16')]);router[_0x912b('0x7')](_0x912b('0x17'),auth['isAuthenticated'](),controller[_0x912b('0x18')]);router[_0x912b('0x7')](_0x912b('0x19'),auth[_0x912b('0x8')](),controller[_0x912b('0x1a')]);router[_0x912b('0x7')](_0x912b('0x1b'),auth[_0x912b('0x8')](),controller[_0x912b('0x1c')]);router[_0x912b('0x1d')](_0x912b('0xe'),auth[_0x912b('0x8')](),controller[_0x912b('0x1e')]);router['post']('/:id/canned_answers',auth[_0x912b('0x8')](),controller['addAnswer']);router[_0x912b('0x1d')]('/',auth['isAuthenticated'](),controller[_0x912b('0x1f')]);router[_0x912b('0x1d')](_0x912b('0x10'),auth['isAuthenticated'](),controller[_0x912b('0x20')]);router[_0x912b('0x1d')](_0x912b('0x21'),auth[_0x912b('0x8')](),controller[_0x912b('0x22')]);router[_0x912b('0x1d')](_0x912b('0x13'),auth[_0x912b('0x8')](),controller[_0x912b('0x23')]);router[_0x912b('0x1d')](_0x912b('0x15'),auth[_0x912b('0x8')](),controller[_0x912b('0x24')]);router['post'](_0x912b('0x25'),auth[_0x912b('0x8')](),controller[_0x912b('0x26')]);router['post'](_0x912b('0x1b'),auth[_0x912b('0x8')](),controller[_0x912b('0x27')]);router['put'](_0x912b('0xc'),auth[_0x912b('0x8')](),controller[_0x912b('0x28')]);router['delete'](_0x912b('0xe'),auth[_0x912b('0x8')](),controller['removeDispositions']);router[_0x912b('0x29')](_0x912b('0x2a'),auth[_0x912b('0x8')](),controller[_0x912b('0x2b')]);router['delete'](_0x912b('0x10'),auth[_0x912b('0x8')](),controller[_0x912b('0x2c')]);router['delete'](_0x912b('0x21'),auth[_0x912b('0x8')](),controller[_0x912b('0x2d')]);router['delete'](_0x912b('0xc'),auth['isAuthenticated'](),controller[_0x912b('0x2e')]);router[_0x912b('0x29')](_0x912b('0x1b'),auth[_0x912b('0x8')](),controller[_0x912b('0x2f')]);module[_0x912b('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 86606a9..48075c1 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 _0xd005=['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','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0xd005,0xe2));var _0x5d00=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd005[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x5d00('0x0'));module[_0x5d00('0x1')]={'description':{'type':Sequelize[_0x5d00('0x2')]},'name':{'type':Sequelize[_0x5d00('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x5d00('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x5d00('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x5d00('0x4')]},'markAsUnread':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5d00('0x5')},'fontSize':{'type':Sequelize[_0x5d00('0x6')](0x2)[_0x5d00('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5d00('0x4')],'defaultValue':function(){return _0x5d00('0x8');}},'notificationSound':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5d00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5d00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5d00('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5d00('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5d00('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x5d00('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5d00('0xa'),'set':function(_0x249b73){if(!_0x249b73)this[_0x5d00('0xb')]('mandatoryDispositionPauseId',null);this[_0x5d00('0xb')](_0x5d00('0xc'),_0x249b73);}}}; \ No newline at end of file +var _0x491c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','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'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x491c,0xe8));var _0xc491=function(_0x197e18,_0x137888){_0x197e18=_0x197e18-0x0;var _0x58064e=_0x491c[_0x197e18];return _0x58064e;};'use strict';var Sequelize=require('sequelize');module[_0xc491('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xc491('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc491('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc491('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc491('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc491('0x1')],'allowNull':![],'defaultValue':_0xc491('0x3')},'fontSize':{'type':Sequelize[_0xc491('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc491('0x5')],'defaultValue':function(){return _0xc491('0x6');}},'notificationSound':{'type':Sequelize[_0xc491('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc491('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc491('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc491('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc491('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc491('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc491('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xc491('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc491('0x8'),'set':function(_0x33286e){if(!_0x33286e)this[_0xc491('0x9')](_0xc491('0xa'),null);this[_0xc491('0x9')](_0xc491('0xb'),_0x33286e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index aac2949..21afb47 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 _0x8e22=['update','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','length','find','body','Pause','describe','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','email','ListId','isNil','active','cservice','cauthentication','user','cuser','password','authentication','host','port','service','pass','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','destroy','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','split','List','Contacts','from','format','%s\x20<%s>','attachments','join','basename','auth','secure','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','redis','./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','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x31e91d,_0x5333d4){var _0x19f4b8=function(_0x36edff){while(--_0x36edff){_0x31e91d['push'](_0x31e91d['shift']());}};_0x19f4b8(++_0x5333d4);}(_0x8e22,0x87));var _0x28e2=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0x8e22[_0x111494];return _0x1d0d8b;};'use strict';var pdf=require(_0x28e2('0x0'));var emlformat=require(_0x28e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x28e2('0x2'));var jsonpatch=require(_0x28e2('0x3'));var rp=require(_0x28e2('0x4'));var moment=require(_0x28e2('0x5'));var BPromise=require(_0x28e2('0x6'));var Mustache=require(_0x28e2('0x7'));var util=require(_0x28e2('0x8'));var path=require('path');var sox=require(_0x28e2('0x9'));var csv=require(_0x28e2('0xa'));var ejs=require(_0x28e2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x28e2('0xc'));var crypto=require(_0x28e2('0xd'));var jsforce=require(_0x28e2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28e2('0xa'));var querystring=require(_0x28e2('0xf'));var Papa=require(_0x28e2('0x10'));var Redis=require(_0x28e2('0x11'));var authService=require(_0x28e2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x28e2('0x13'));var hardwareService=require(_0x28e2('0x14'));var logger=require(_0x28e2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x28e2('0x16'));var db=require(_0x28e2('0x17'))['db'];config['redis']=_[_0x28e2('0x18')](config['redis'],{'host':_0x28e2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x28e2('0x1a')]));require(_0x28e2('0x1b'))['register'](socket);var jayson=require(_0x28e2('0x1c'));var client=jayson[_0x28e2('0x1d')][_0x28e2('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x5d207c,_0x39b766,_0x26b109){if(_0x26b109){var _0x1d50d8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d50d8[_0x28e2('0x1f')](_0x39b766)){return _0x5d207c;}else{throw new db[(_0x28e2('0x20'))][(_0x28e2('0x21'))](_0x28e2('0x22'));}}else{return _0x5d207c;}}function respondWithRpcPromise(_0x1ccfe9,_0x3dde23,_0x5ce179,_0x551c38){return new BPromise(function(_0x19eb9,_0x384d0a){var _0x3a0a76=_0x551c38||client;return _0x3a0a76[_0x28e2('0x23')](_0x1ccfe9,_0x5ce179)[_0x28e2('0x24')](function(_0x263363){logger[_0x28e2('0x25')]('MailAccount,\x20%s,\x20%s',_0x3dde23,'request\x20sent');logger[_0x28e2('0x26')](_0x28e2('0x27'),_0x3dde23,_0x28e2('0x28'),JSON['stringify'](_0x263363));if(_0x263363[_0x28e2('0x29')]){if(_0x263363['error'][_0x28e2('0x2a')]===0x1f4){logger['error'](_0x28e2('0x2b'),_0x3dde23,_0x263363[_0x28e2('0x29')][_0x28e2('0x2c')]);return _0x384d0a(_0x263363[_0x28e2('0x29')][_0x28e2('0x2c')]);}logger['error'](_0x28e2('0x2b'),_0x3dde23,_0x263363['error'][_0x28e2('0x2c')]);return _0x19eb9(_0x263363['error']['message']);}else{logger[_0x28e2('0x25')](_0x28e2('0x2b'),_0x3dde23,_0x28e2('0x28'));_0x19eb9(_0x263363[_0x28e2('0x2d')]['message']);}})[_0x28e2('0x2e')](function(_0x10b798){logger[_0x28e2('0x29')](_0x28e2('0x2b'),_0x3dde23,_0x10b798);_0x384d0a(_0x10b798);});});}function respondWithStatusCode(_0x223e25,_0x111c16){_0x111c16=_0x111c16||0xcc;return function(_0x3735dd){if(_0x3735dd){return _0x223e25[_0x28e2('0x2f')](_0x111c16);}return _0x223e25[_0x28e2('0x30')](_0x111c16)['end']();};}function respondWithResult(_0x39ae8c,_0x441793){_0x441793=_0x441793||0xc8;return function(_0x52fd61){if(_0x52fd61){return _0x39ae8c[_0x28e2('0x30')](_0x441793)[_0x28e2('0x31')](_0x52fd61);}};}function respondWithFilteredResult(_0x48d2b5,_0x5e61d2){return function(_0x537a02){if(_0x537a02){var _0x10cf77=_0x537a02[_0x28e2('0x32')],_0x3682b5=_0x5e61d2[_0x28e2('0x33')],_0x5e9ba7=_0x5e61d2[_0x28e2('0x33')]+_0x5e61d2[_0x28e2('0x34')],_0x1416c0;if(_0x5e9ba7>=_0x10cf77){_0x5e9ba7=_0x10cf77;_0x1416c0=0xc8;}else{_0x1416c0=0xce;}_0x48d2b5[_0x28e2('0x30')](_0x1416c0);return _0x48d2b5['set'](_0x28e2('0x35'),_0x3682b5+'-'+_0x5e9ba7+'/'+_0x10cf77)[_0x28e2('0x31')](_0x537a02);}return null;};}function patchUpdates(_0x5e7e20){return function(_0x154cf7){try{jsonpatch[_0x28e2('0x36')](_0x154cf7,_0x5e7e20,!![]);}catch(_0x59e7c2){return BPromise[_0x28e2('0x37')](_0x59e7c2);}return _0x154cf7[_0x28e2('0x38')]();};}function saveUpdates(_0x153390,_0x3b7151){return function(_0x1d5d88){if(_0x1d5d88){return _0x1d5d88[_0x28e2('0x39')](_0x153390)[_0x28e2('0x24')](function(_0x25ff08){return _0x25ff08;});}return null;};}function removeEntity(_0x3132c4,_0x14887e){return function(_0x463430){if(_0x463430){return _0x463430['destroy']()[_0x28e2('0x24')](function(){var _0x48ded2=_0x463430['get']({'plain':!![]});var _0x1114eb=_0x28e2('0x3a');return db[_0x28e2('0x3b')]['destroy']({'where':{'type':_0x1114eb,'resourceId':_0x48ded2['id']}})[_0x28e2('0x24')](function(){return _0x463430;});})[_0x28e2('0x24')](function(){_0x3132c4[_0x28e2('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7f813a,_0x146c43){return function(_0x1e85c1){if(!_0x1e85c1){_0x7f813a[_0x28e2('0x2f')](0x194);}return _0x1e85c1;};}function handleError(_0x79bc53,_0x320d3f){_0x320d3f=_0x320d3f||0x1f4;return function(_0x3f0975){logger[_0x28e2('0x29')](_0x3f0975[_0x28e2('0x3c')]);if(_0x3f0975[_0x28e2('0x3d')]){delete _0x3f0975[_0x28e2('0x3d')];}_0x79bc53[_0x28e2('0x30')](_0x320d3f)[_0x28e2('0x3e')](_0x3f0975);};}exports[_0x28e2('0x3f')]=function(_0x3e6f43,_0x531a25){var _0x1df645={'include':[{'model':db[_0x28e2('0x40')],'as':_0x28e2('0x41')},{'model':db[_0x28e2('0x42')],'as':_0x28e2('0x43')},{'model':db['Pause'],'as':_0x28e2('0x44')}]},_0x4412d2={},_0x5cb563={'count':0x0,'rows':[]};var _0x417385=_[_0x28e2('0x45')](db[_0x28e2('0x46')][_0x28e2('0x47')],function(_0x2a2842){return{'name':_0x2a2842[_0x28e2('0x48')],'type':_0x2a2842[_0x28e2('0x49')][_0x28e2('0x4a')]};});_0x4412d2['model']=_[_0x28e2('0x45')](_0x417385,_0x28e2('0x3d'));_0x4412d2[_0x28e2('0x4b')]=_[_0x28e2('0x4c')](_0x3e6f43[_0x28e2('0x4b')]);_0x4412d2[_0x28e2('0x4d')]=_['intersection'](_0x4412d2[_0x28e2('0x4e')],_0x4412d2['query']);_0x1df645[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x4412d2[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x1df645[_0x28e2('0x4f')]=_0x1df645[_0x28e2('0x4f')]['length']?_0x1df645[_0x28e2('0x4f')]:_0x4412d2[_0x28e2('0x4e')];if(!_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x52')]('nolimit')){_0x1df645[_0x28e2('0x34')]=qs[_0x28e2('0x34')](_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x34')]);_0x1df645[_0x28e2('0x33')]=qs[_0x28e2('0x33')](_0x3e6f43['query'][_0x28e2('0x33')]);}_0x1df645[_0x28e2('0x53')]=qs['sort'](_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x54')]);_0x1df645[_0x28e2('0x55')]=qs[_0x28e2('0x4d')](_[_0x28e2('0x56')](_0x3e6f43[_0x28e2('0x4b')],_0x4412d2[_0x28e2('0x4d')]),_0x417385);if(_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x57')]){_0x1df645[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x1df645[_0x28e2('0x55')],{'$or':_['map'](_0x417385,function(_0x211e03){if(_0x211e03[_0x28e2('0x49')]!==_0x28e2('0x59')){var _0x35b170={};_0x35b170[_0x211e03[_0x28e2('0x3d')]]={'$like':'%'+_0x3e6f43['query']['filter']+'%'};return _0x35b170;}})});}_0x1df645=_['merge']({},_0x1df645,_0x3e6f43[_0x28e2('0x5a')]);var _0x584eb8={'where':_0x1df645[_0x28e2('0x55')]};return db[_0x28e2('0x46')]['count'](_0x584eb8)[_0x28e2('0x24')](function(_0x527aa8){_0x5cb563[_0x28e2('0x32')]=_0x527aa8;if(_0x3e6f43[_0x28e2('0x4b')][_0x28e2('0x5b')]){_0x1df645[_0x28e2('0x5c')]=[{'all':!![]}];}return db[_0x28e2('0x46')]['findAll'](_0x1df645);})['then'](function(_0xe44a29){_0x5cb563['rows']=_0xe44a29;return _0x5cb563;})[_0x28e2('0x24')](respondWithFilteredResult(_0x531a25,_0x1df645))[_0x28e2('0x2e')](handleError(_0x531a25,null));};exports[_0x28e2('0x5d')]=function(_0x5deca7,_0x37cee3){var _0x111783={'raw':![],'where':{'id':_0x5deca7[_0x28e2('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x28e2('0x41')},{'model':db[_0x28e2('0x42')],'as':_0x28e2('0x43')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x46c331={};_0x46c331[_0x28e2('0x4e')]=_[_0x28e2('0x4c')](db[_0x28e2('0x46')][_0x28e2('0x47')]);_0x46c331[_0x28e2('0x4b')]=_[_0x28e2('0x4c')](_0x5deca7[_0x28e2('0x4b')]);_0x46c331['filters']=_['intersection'](_0x46c331[_0x28e2('0x4e')],_0x46c331[_0x28e2('0x4b')]);_0x111783[_0x28e2('0x4f')]=_['intersection'](_0x46c331['model'],qs[_0x28e2('0x51')](_0x5deca7[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x111783[_0x28e2('0x4f')]=_0x111783[_0x28e2('0x4f')][_0x28e2('0x5f')]?_0x111783[_0x28e2('0x4f')]:_0x46c331[_0x28e2('0x4e')];if(_0x5deca7[_0x28e2('0x4b')][_0x28e2('0x5b')]){_0x111783[_0x28e2('0x5c')]=[{'all':!![]}];}_0x111783=_[_0x28e2('0x58')]({},_0x111783,_0x5deca7[_0x28e2('0x5a')]);return db[_0x28e2('0x46')][_0x28e2('0x60')](_0x111783)[_0x28e2('0x24')](handleEntityNotFound(_0x37cee3,null))[_0x28e2('0x24')](respondWithResult(_0x37cee3,null))[_0x28e2('0x2e')](handleError(_0x37cee3,null));};exports['update']=function(_0x4ba6f6,_0x67747a){if(_0x4ba6f6['body']['id']){delete _0x4ba6f6[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x4ba6f6['params']['id']},'include':[{'model':db[_0x28e2('0x40')],'as':_0x28e2('0x41')},{'model':db[_0x28e2('0x42')],'as':'Smtp'},{'model':db[_0x28e2('0x62')],'as':_0x28e2('0x44')}]})[_0x28e2('0x24')](handleEntityNotFound(_0x67747a,null))['then'](saveUpdates(_0x4ba6f6[_0x28e2('0x61')],null))[_0x28e2('0x24')](function(_0x3f015c){if(_0x3f015c&&_0x4ba6f6[_0x28e2('0x61')]['Imap']){return db[_0x28e2('0x40')][_0x28e2('0x39')](_0x4ba6f6[_0x28e2('0x61')]['Imap'],{'where':{'MailAccountId':_0x3f015c['id']}})[_0x28e2('0x24')](function(){return _0x3f015c;});}return _0x3f015c;})[_0x28e2('0x24')](function(_0x1557c5){if(_0x1557c5&&_0x4ba6f6[_0x28e2('0x61')][_0x28e2('0x43')]){return db[_0x28e2('0x42')][_0x28e2('0x39')](_0x4ba6f6[_0x28e2('0x61')]['Smtp'],{'where':{'MailAccountId':_0x1557c5['id']}})[_0x28e2('0x24')](function(){return _0x1557c5;});}return _0x1557c5;})[_0x28e2('0x24')](respondWithResult(_0x67747a,null))[_0x28e2('0x2e')](handleError(_0x67747a,null));};exports[_0x28e2('0x63')]=function(_0x1eae77,_0x3632e5){return db[_0x28e2('0x46')]['describe']()['then'](respondWithResult(_0x3632e5,null))[_0x28e2('0x2e')](handleError(_0x3632e5,null));};exports['addDisposition']=function(_0x1a947a,_0x2054d2,_0x215ebf){if(_0x1a947a['body']['id']){delete _0x1a947a[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x1a947a[_0x28e2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2054d2,null))[_0x28e2('0x24')](function(_0x55e78d){if(_0x55e78d){_0x1a947a[_0x28e2('0x61')][_0x28e2('0x64')]=_0x55e78d['id'];return db[_0x28e2('0x65')][_0x28e2('0x66')](_0x1a947a[_0x28e2('0x61')]);}})['then'](respondWithResult(_0x2054d2,null))[_0x28e2('0x2e')](handleError(_0x2054d2,null));};exports[_0x28e2('0x67')]=function(_0x15d1a1,_0x10407e,_0xd663b8){var _0xcfe1ad={'raw':![],'where':{}};var _0x2782ae={};var _0x59fc29={'count':0x0,'rows':[]};return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0x15d1a1[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x10407e,null))[_0x28e2('0x24')](function(_0x52b3a2){if(_0x52b3a2){_0x2782ae['model']=_[_0x28e2('0x4c')](db['Disposition'][_0x28e2('0x47')]);_0x2782ae['query']=_['keys'](_0x15d1a1['query']);_0x2782ae[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x2782ae[_0x28e2('0x4e')],_0x2782ae[_0x28e2('0x4b')]);_0xcfe1ad[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x2782ae[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0x15d1a1[_0x28e2('0x4b')][_0x28e2('0x51')]));_0xcfe1ad[_0x28e2('0x4f')]=_0xcfe1ad['attributes'][_0x28e2('0x5f')]?_0xcfe1ad['attributes']:_0x2782ae[_0x28e2('0x4e')];if(!_0x15d1a1[_0x28e2('0x4b')][_0x28e2('0x52')](_0x28e2('0x69'))){_0xcfe1ad[_0x28e2('0x34')]=qs[_0x28e2('0x34')](_0x15d1a1[_0x28e2('0x4b')][_0x28e2('0x34')]);_0xcfe1ad[_0x28e2('0x33')]=qs['offset'](_0x15d1a1['query']['offset']);}_0xcfe1ad[_0x28e2('0x53')]=qs['sort'](_0x15d1a1['query'][_0x28e2('0x54')]);_0xcfe1ad['where']=qs[_0x28e2('0x4d')](_[_0x28e2('0x56')](_0x15d1a1[_0x28e2('0x4b')],_0x2782ae[_0x28e2('0x4d')]));_0xcfe1ad['where'][_0x28e2('0x64')]=_0x52b3a2['id'];if(_0x15d1a1['query']['filter']){_0xcfe1ad[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0xcfe1ad[_0x28e2('0x55')],{'$or':_[_0x28e2('0x45')](_0xcfe1ad[_0x28e2('0x4f')],function(_0x2559c6){var _0x419552={};_0x419552[_0x2559c6]={'$like':'%'+_0x15d1a1[_0x28e2('0x4b')][_0x28e2('0x57')]+'%'};return _0x419552;})});}_0xcfe1ad=_[_0x28e2('0x58')]({},_0xcfe1ad,_0x15d1a1['options']);return db[_0x28e2('0x65')]['count']({'where':_0xcfe1ad[_0x28e2('0x55')]})[_0x28e2('0x24')](function(_0xe7c731){_0x59fc29['count']=_0xe7c731;if(_0x15d1a1['query'][_0x28e2('0x5b')]){_0xcfe1ad[_0x28e2('0x5c')]=[{'all':!![]}];}return db[_0x28e2('0x65')]['findAll'](_0xcfe1ad);})['then'](function(_0x36e327){_0x59fc29[_0x28e2('0x6a')]=_0x36e327;return _0x59fc29;});}})[_0x28e2('0x24')](respondWithFilteredResult(_0x10407e,_0xcfe1ad))['catch'](handleError(_0x10407e,null));};exports[_0x28e2('0x6b')]=function(_0xe5d347,_0x33e61d,_0x5911e8){return db[_0x28e2('0x46')]['find']({'where':{'id':_0xe5d347[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x33e61d,null))[_0x28e2('0x24')](function(_0x57995e){if(_0x57995e){return _0x57995e['removeDispositions'](_0xe5d347['query'][_0x28e2('0x6c')]);}})[_0x28e2('0x24')](respondWithStatusCode(_0x33e61d,null))[_0x28e2('0x2e')](handleError(_0x33e61d,null));};exports[_0x28e2('0x6d')]=function(_0x1c4b3c,_0x33b16d,_0x3c30e8){if(_0x1c4b3c[_0x28e2('0x61')]['id']){delete _0x1c4b3c[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x1c4b3c[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x33b16d,null))[_0x28e2('0x24')](function(_0x2bdc61){if(_0x2bdc61){_0x1c4b3c['body']['MailAccountId']=_0x2bdc61['id'];return db[_0x28e2('0x6e')][_0x28e2('0x66')](_0x1c4b3c['body']);}})[_0x28e2('0x24')](respondWithResult(_0x33b16d,null))[_0x28e2('0x2e')](handleError(_0x33b16d,null));};exports[_0x28e2('0x6f')]=function(_0xc20061,_0x134933,_0x445c32){var _0x1e7259={'raw':![],'where':{}};var _0x5ddaca={};var _0x5ea82d={'count':0x0,'rows':[]};return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0xc20061[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x134933,null))[_0x28e2('0x24')](function(_0x18d16b){if(_0x18d16b){_0x5ddaca[_0x28e2('0x4e')]=_[_0x28e2('0x4c')](db[_0x28e2('0x6e')][_0x28e2('0x47')]);_0x5ddaca['query']=_[_0x28e2('0x4c')](_0xc20061[_0x28e2('0x4b')]);_0x5ddaca[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x5ddaca[_0x28e2('0x4e')],_0x5ddaca[_0x28e2('0x4b')]);_0x1e7259[_0x28e2('0x4f')]=_['intersection'](_0x5ddaca[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0xc20061[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x1e7259['attributes']=_0x1e7259['attributes'][_0x28e2('0x5f')]?_0x1e7259['attributes']:_0x5ddaca[_0x28e2('0x4e')];if(!_0xc20061[_0x28e2('0x4b')][_0x28e2('0x52')]('nolimit')){_0x1e7259[_0x28e2('0x34')]=qs[_0x28e2('0x34')](_0xc20061[_0x28e2('0x4b')][_0x28e2('0x34')]);_0x1e7259['offset']=qs[_0x28e2('0x33')](_0xc20061[_0x28e2('0x4b')]['offset']);}_0x1e7259[_0x28e2('0x53')]=qs[_0x28e2('0x54')](_0xc20061[_0x28e2('0x4b')]['sort']);_0x1e7259[_0x28e2('0x55')]=qs[_0x28e2('0x4d')](_['pick'](_0xc20061[_0x28e2('0x4b')],_0x5ddaca[_0x28e2('0x4d')]));_0x1e7259[_0x28e2('0x55')][_0x28e2('0x64')]=_0x18d16b['id'];if(_0xc20061[_0x28e2('0x4b')]['filter']){_0x1e7259[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x1e7259[_0x28e2('0x55')],{'$or':_[_0x28e2('0x45')](_0x1e7259[_0x28e2('0x4f')],function(_0x2ad99b){var _0x484959={};_0x484959[_0x2ad99b]={'$like':'%'+_0xc20061[_0x28e2('0x4b')][_0x28e2('0x57')]+'%'};return _0x484959;})});}_0x1e7259=_[_0x28e2('0x58')]({},_0x1e7259,_0xc20061[_0x28e2('0x5a')]);return db[_0x28e2('0x6e')][_0x28e2('0x32')]({'where':_0x1e7259[_0x28e2('0x55')]})[_0x28e2('0x24')](function(_0xd32670){_0x5ea82d[_0x28e2('0x32')]=_0xd32670;if(_0xc20061[_0x28e2('0x4b')][_0x28e2('0x5b')]){_0x1e7259[_0x28e2('0x5c')]=[{'all':!![]}];}return db[_0x28e2('0x6e')][_0x28e2('0x70')](_0x1e7259);})[_0x28e2('0x24')](function(_0x363414){_0x5ea82d[_0x28e2('0x6a')]=_0x363414;return _0x5ea82d;});}})[_0x28e2('0x24')](respondWithFilteredResult(_0x134933,_0x1e7259))[_0x28e2('0x2e')](handleError(_0x134933,null));};exports['removeAnswers']=function(_0x2ddee0,_0xd9e8f9,_0x4f7d5d){return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x2ddee0[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0xd9e8f9,null))[_0x28e2('0x24')](function(_0x3c0619){if(_0x3c0619){return _0x3c0619[_0x28e2('0x71')](_0x2ddee0[_0x28e2('0x4b')][_0x28e2('0x6c')]);}})[_0x28e2('0x24')](respondWithStatusCode(_0xd9e8f9,null))['catch'](handleError(_0xd9e8f9,null));};exports[_0x28e2('0x66')]=function(_0x561dec,_0x42a762){var _0x59283a={'name':_0x561dec[_0x28e2('0x61')]['name'],'key':_0x561dec[_0x28e2('0x61')][_0x28e2('0x4a')],'email':_0x561dec[_0x28e2('0x61')][_0x28e2('0x72')],'ListId':_0x561dec[_0x28e2('0x61')][_0x28e2('0x73')],'active':!_[_0x28e2('0x74')](_0x561dec['body'][_0x28e2('0x75')])?_0x561dec[_0x28e2('0x61')]['active']:!![],'description':_0x561dec[_0x28e2('0x61')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x28e2('0x74')](_0x561dec[_0x28e2('0x61')][_0x28e2('0x76')])){if(_0x561dec[_0x28e2('0x61')][_0x28e2('0x77')]){_0x59283a['Imap'][_0x28e2('0x78')]=_0x59283a[_0x28e2('0x43')][_0x28e2('0x78')]=_0x561dec['body'][_0x28e2('0x79')];_0x59283a['Imap'][_0x28e2('0x7a')]=_0x59283a[_0x28e2('0x43')]['pass']=_0x561dec[_0x28e2('0x61')]['cpassword'];}else{_0x59283a[_0x28e2('0x41')][_0x28e2('0x7b')]=_0x59283a['Smtp'][_0x28e2('0x7b')]=![];}_0x59283a[_0x28e2('0x41')][_0x28e2('0x7c')]=_0x561dec[_0x28e2('0x61')]['Imap'][_0x28e2('0x7c')];_0x59283a[_0x28e2('0x41')][_0x28e2('0x7d')]=_0x561dec[_0x28e2('0x61')][_0x28e2('0x41')][_0x28e2('0x7d')];_0x59283a['Smtp']['host']=_0x561dec['body'][_0x28e2('0x43')]['host'];_0x59283a[_0x28e2('0x43')][_0x28e2('0x7d')]=_0x561dec[_0x28e2('0x61')][_0x28e2('0x43')][_0x28e2('0x7d')];}else{_0x59283a[_0x28e2('0x41')]['service']=_0x59283a['Smtp'][_0x28e2('0x7e')]=_0x561dec[_0x28e2('0x61')][_0x28e2('0x76')];_0x59283a[_0x28e2('0x41')][_0x28e2('0x78')]=_0x59283a['Smtp'][_0x28e2('0x78')]=_0x561dec[_0x28e2('0x61')][_0x28e2('0x79')];_0x59283a['Imap'][_0x28e2('0x7a')]=_0x59283a[_0x28e2('0x43')][_0x28e2('0x7f')]=_0x561dec[_0x28e2('0x61')]['cpassword'];}return db[_0x28e2('0x46')][_0x28e2('0x66')](_0x59283a,{'include':[{'model':db[_0x28e2('0x42')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x28e2('0x41')}]})['then'](function(_0x2871c2){var _0x672c00=_0x561dec[_0x28e2('0x78')]['get']({'plain':!![]});if(!_0x672c00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x672c00['role']===_0x28e2('0x78')){var _0x1168ae=_0x2871c2[_0x28e2('0x80')]({'plain':!![]});return db[_0x28e2('0x81')][_0x28e2('0x60')]({'where':{'name':_0x28e2('0x3a'),'userProfileId':_0x672c00[_0x28e2('0x82')]},'raw':!![]})['then'](function(_0x1eaaa1){if(_0x1eaaa1&&_0x1eaaa1['autoAssociation']===0x0){return db['UserProfileResource'][_0x28e2('0x66')]({'name':_0x1168ae[_0x28e2('0x3d')],'resourceId':_0x1168ae['id'],'type':_0x1eaaa1[_0x28e2('0x3d')],'sectionId':_0x1eaaa1['id']},{})['then'](function(){return _0x2871c2;});}else{return _0x2871c2;}})[_0x28e2('0x2e')](function(_0x478213){logger[_0x28e2('0x29')](_0x28e2('0x83'),_0x478213);throw _0x478213;});}return _0x2871c2;})[_0x28e2('0x24')](respondWithResult(_0x42a762,0xc9))[_0x28e2('0x2e')](handleError(_0x42a762,null));};exports['getImap']=function(_0x1e6200,_0x3244e0,_0x5a908b){return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x1e6200['params']['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x3244e0,null))[_0x28e2('0x24')](function(_0xbd1995){if(_0xbd1995){return _0xbd1995[_0x28e2('0x84')]();}return null;})[_0x28e2('0x24')](respondWithResult(_0x3244e0,null))[_0x28e2('0x2e')](handleError(_0x3244e0,null));};exports[_0x28e2('0x85')]=function(_0x33ba07,_0xc30b7c,_0x40597a){if(_0x33ba07[_0x28e2('0x61')]['id']){delete _0x33ba07[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x33ba07[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0xc30b7c,null))[_0x28e2('0x24')](function(_0x419e28){if(_0x419e28){_0x33ba07[_0x28e2('0x61')]['MailAccountId']=_0x419e28['id'];return db[_0x28e2('0x40')][_0x28e2('0x66')](_0x33ba07['body']);}})[_0x28e2('0x24')](respondWithResult(_0xc30b7c,null))[_0x28e2('0x2e')](handleError(_0xc30b7c,null));};exports[_0x28e2('0x86')]=function(_0x290312,_0x593093,_0x3dba66){return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0x290312[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x593093,null))[_0x28e2('0x24')](function(_0x3facb5){if(_0x3facb5){return _0x3facb5[_0x28e2('0x87')](null);}return null;})[_0x28e2('0x24')](respondWithStatusCode(_0x593093,null))[_0x28e2('0x2e')](handleError(_0x593093,null));};exports['getSmtp']=function(_0x20c1eb,_0x20d394,_0x1846e1){return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x20c1eb[_0x28e2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x20d394,null))['then'](function(_0xb0fde3){if(_0xb0fde3){return _0xb0fde3[_0x28e2('0x88')]();}return null;})['then'](respondWithResult(_0x20d394,null))[_0x28e2('0x2e')](handleError(_0x20d394,null));};exports[_0x28e2('0x89')]=function(_0xfb0b62,_0x5916d2,_0x43162f){if(_0xfb0b62[_0x28e2('0x61')]['id']){delete _0xfb0b62[_0x28e2('0x61')]['id'];}return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0xfb0b62[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x5916d2,null))['then'](function(_0x3fc5b6){if(_0x3fc5b6){_0xfb0b62[_0x28e2('0x61')][_0x28e2('0x64')]=_0x3fc5b6['id'];return db[_0x28e2('0x42')][_0x28e2('0x66')](_0xfb0b62['body']);}})['then'](respondWithResult(_0x5916d2,null))[_0x28e2('0x2e')](handleError(_0x5916d2,null));};exports[_0x28e2('0x8a')]=function(_0x1a020c,_0x1799ca,_0x3f1a94){return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x1a020c['params']['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x1799ca,null))[_0x28e2('0x24')](function(_0xa6b756){if(_0xa6b756){return _0xa6b756[_0x28e2('0x8b')](null);}return null;})[_0x28e2('0x24')](respondWithStatusCode(_0x1799ca,null))['catch'](handleError(_0x1799ca,null));};exports[_0x28e2('0x8c')]=function(_0x3fd9ed,_0x2db6ee,_0x29ef35){return db[_0x28e2('0x8d')]['find']({'where':{'id':_0x3fd9ed['params']['id']}})['then'](handleEntityNotFound(_0x2db6ee,null))[_0x28e2('0x24')](function(_0x21812c){if(_0x21812c){return _0x21812c[_0x28e2('0x8c')](_0x3fd9ed['body'][_0x28e2('0x6c')],_[_0x28e2('0x8e')](_0x3fd9ed[_0x28e2('0x61')],['ids','id'])||{});}})[_0x28e2('0x24')](respondWithResult(_0x2db6ee,null))['catch'](handleError(_0x2db6ee,null));};exports[_0x28e2('0x8f')]=function(_0x5c03b0,_0x1ac328,_0x1bb3d6){var _0x54f9e7={'raw':![],'where':{}};var _0x13c639={};var _0x210085={'count':0x0,'rows':[]};return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0x5c03b0[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x1ac328,null))[_0x28e2('0x24')](function(_0x472eef){if(_0x472eef){_0x13c639[_0x28e2('0x4e')]=_[_0x28e2('0x4c')](db[_0x28e2('0x8d')]['rawAttributes']);_0x13c639['query']=_[_0x28e2('0x4c')](_0x5c03b0[_0x28e2('0x4b')]);_0x13c639[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x13c639['model'],_0x13c639['query']);_0x54f9e7[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x13c639[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0x5c03b0[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x54f9e7[_0x28e2('0x4f')]=_0x54f9e7['attributes']['length']?_0x54f9e7[_0x28e2('0x4f')]:_0x13c639[_0x28e2('0x4e')];if(!_0x5c03b0[_0x28e2('0x4b')]['hasOwnProperty'](_0x28e2('0x69'))){_0x54f9e7[_0x28e2('0x34')]=qs['limit'](_0x5c03b0[_0x28e2('0x4b')]['limit']);_0x54f9e7[_0x28e2('0x33')]=qs['offset'](_0x5c03b0[_0x28e2('0x4b')]['offset']);}_0x54f9e7[_0x28e2('0x53')]=qs[_0x28e2('0x54')](_0x5c03b0[_0x28e2('0x4b')]['sort']);_0x54f9e7[_0x28e2('0x55')]=qs['filters'](_[_0x28e2('0x56')](_0x5c03b0[_0x28e2('0x4b')],_0x13c639[_0x28e2('0x4d')]));_0x54f9e7[_0x28e2('0x55')][_0x28e2('0x64')]=_0x472eef['id'];if(_0x5c03b0['query'][_0x28e2('0x57')]){_0x54f9e7[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x54f9e7['where'],{'$or':_['map'](_0x54f9e7[_0x28e2('0x4f')],function(_0x16a6f0){var _0x5476d2={};_0x5476d2[_0x16a6f0]={'$like':'%'+_0x5c03b0['query'][_0x28e2('0x57')]+'%'};return _0x5476d2;})});}_0x54f9e7=_[_0x28e2('0x58')]({},_0x54f9e7,_0x5c03b0[_0x28e2('0x5a')]);return db['MailInteraction'][_0x28e2('0x32')]({'where':_0x54f9e7[_0x28e2('0x55')]})['then'](function(_0x5c7b0e){_0x210085[_0x28e2('0x32')]=_0x5c7b0e;if(_0x5c03b0['query'][_0x28e2('0x5b')]){_0x54f9e7[_0x28e2('0x5c')]=[{'model':db[_0x28e2('0x90')],'as':_0x28e2('0x91'),'required':![]},{'model':db[_0x28e2('0x92')],'as':_0x28e2('0x93'),'attributes':[_0x28e2('0x3d'),_0x28e2('0x94'),_0x28e2('0x95')],'required':![]},{'model':db[_0x28e2('0x96')],'as':_0x28e2('0x97'),'attributes':['id','name','color'],'where':_0x5c03b0[_0x28e2('0x4b')][_0x28e2('0x98')]?{'id':_0x5c03b0['query'][_0x28e2('0x98')]}:undefined,'required':_0x5c03b0['query'][_0x28e2('0x98')]?!![]:![]}];}return db[_0x28e2('0x8d')][_0x28e2('0x70')](_0x54f9e7);})[_0x28e2('0x24')](function(_0x3dce37){_0x210085['rows']=_0x3dce37;return _0x210085;});}})[_0x28e2('0x24')](respondWithFilteredResult(_0x1ac328,_0x54f9e7))['catch'](handleError(_0x1ac328,null));};exports[_0x28e2('0x99')]=function(_0x593f42,_0x3ef507,_0x378faf){return db[_0x28e2('0x46')][_0x28e2('0x68')]({'where':{'id':_0x593f42[_0x28e2('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3ef507,null))['then'](function(_0x281f83){if(_0x281f83){return db[_0x28e2('0x9a')][_0x28e2('0x9b')](function(_0x1b536e){return db[_0x28e2('0x9c')][_0x28e2('0x9d')]({'where':{'MailAccountId':_0x593f42[_0x28e2('0x5e')]['id']},'transaction':_0x1b536e})[_0x28e2('0x24')](function(_0x12bfae){var _0x1ecd50=_['map'](_0x593f42['body'],function(_0x104c86){_0x104c86[_0x28e2('0x64')]=_0x593f42['params']['id'];return _0x104c86;});return db[_0x28e2('0x9c')]['bulkCreate'](_0x1ecd50,{'transaction':_0x1b536e});});})[_0x28e2('0x24')](function(){return db[_0x28e2('0x9c')][_0x28e2('0x9e')]({'where':{'MailAccountId':_0x593f42['params']['id']},'order':_0x28e2('0x9f')});});}})[_0x28e2('0x24')](respondWithResult(_0x3ef507,null))['catch'](handleError(_0x3ef507,null));};exports[_0x28e2('0xa0')]=function(_0x447e5a,_0x10d627,_0x7da481){var _0x3bb918={};var _0xe1e649={};var _0x433a5e;var _0x2d8dc0;return db['MailAccount'][_0x28e2('0x68')]({'where':{'id':_0x447e5a[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x10d627,null))[_0x28e2('0x24')](function(_0x4b374a){if(_0x4b374a){_0x433a5e=_0x4b374a;_0xe1e649[_0x28e2('0x4e')]=_['keys'](db[_0x28e2('0x9c')][_0x28e2('0x47')]);_0xe1e649[_0x28e2('0x4b')]=_['keys'](_0x447e5a['query']);_0xe1e649['filters']=_[_0x28e2('0x50')](_0xe1e649['model'],_0xe1e649[_0x28e2('0x4b')]);_0x3bb918['attributes']=_['intersection'](_0xe1e649['model'],qs[_0x28e2('0x51')](_0x447e5a[_0x28e2('0x4b')]['fields']));_0x3bb918[_0x28e2('0x4f')]=_0x3bb918[_0x28e2('0x4f')]['length']?_0x3bb918[_0x28e2('0x4f')]:_0xe1e649[_0x28e2('0x4e')];_0x3bb918[_0x28e2('0x53')]=qs[_0x28e2('0x54')](_0x447e5a['query']['sort']);_0x3bb918[_0x28e2('0x55')]=qs['filters'](_['pick'](_0x447e5a[_0x28e2('0x4b')],_0xe1e649[_0x28e2('0x4d')]));if(_0x447e5a[_0x28e2('0x4b')][_0x28e2('0x57')]){_0x3bb918[_0x28e2('0x55')]=_['merge'](_0x3bb918['where'],{'$or':_[_0x28e2('0x45')](_0x3bb918[_0x28e2('0x4f')],function(_0x1bcb05){var _0x4390b3={};_0x4390b3[_0x1bcb05]={'$like':'%'+_0x447e5a[_0x28e2('0x4b')][_0x28e2('0x57')]+'%'};return _0x4390b3;})});}_0x3bb918=_['merge']({},_0x3bb918,_0x447e5a['options']);return _0x433a5e[_0x28e2('0xa0')](_0x3bb918);}})['then'](function(_0x48b0b9){if(_0x48b0b9){_0x2d8dc0=_0x48b0b9['length'];if(!_0x447e5a[_0x28e2('0x4b')][_0x28e2('0x52')](_0x28e2('0x69'))){_0x3bb918['limit']=qs[_0x28e2('0x34')](_0x447e5a['query'][_0x28e2('0x34')]);_0x3bb918[_0x28e2('0x33')]=qs[_0x28e2('0x33')](_0x447e5a['query']['offset']);}return _0x433a5e['getApplications'](_0x3bb918);}})['then'](function(_0x15a387){if(_0x15a387){return _0x15a387?{'count':_0x2d8dc0,'rows':_0x15a387}:null;}})[_0x28e2('0x24')](respondWithResult(_0x10d627,null))['catch'](handleError(_0x10d627,null));};exports[_0x28e2('0xa1')]=function(_0x5e0f1d,_0x181a5c,_0x8363e3){var _0x7896b9={'raw':!![],'where':{}};var _0x5bdbbe={};var _0x356072={'count':0x0,'rows':[]};return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x5e0f1d[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x181a5c,null))[_0x28e2('0x24')](function(_0x58ae58){if(_0x58ae58){_0x5bdbbe[_0x28e2('0x4e')]=_[_0x28e2('0x4c')](db[_0x28e2('0xa2')][_0x28e2('0x47')]);_0x5bdbbe[_0x28e2('0x4b')]=_[_0x28e2('0x4c')](_0x5e0f1d['query']);_0x5bdbbe[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x5bdbbe[_0x28e2('0x4e')],_0x5bdbbe[_0x28e2('0x4b')]);_0x7896b9[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x5bdbbe[_0x28e2('0x4e')],qs[_0x28e2('0x51')](_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x7896b9[_0x28e2('0x4f')]=_0x7896b9[_0x28e2('0x4f')][_0x28e2('0x5f')]?_0x7896b9['attributes']:_0x5bdbbe[_0x28e2('0x4e')];if(!_0x5e0f1d['query'][_0x28e2('0x52')]('nolimit')){_0x7896b9[_0x28e2('0x34')]=qs[_0x28e2('0x34')](_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x34')]);_0x7896b9[_0x28e2('0x33')]=qs[_0x28e2('0x33')](_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x33')]);}_0x7896b9[_0x28e2('0x53')]=qs['sort'](_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x54')]);_0x7896b9['where']=qs['filters'](_[_0x28e2('0x56')](_0x5e0f1d['query'],_0x5bdbbe['filters']));_0x7896b9['where'][_0x28e2('0x64')]=_0x58ae58['id'];if(_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x57')]){_0x7896b9[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x7896b9[_0x28e2('0x55')],{'$or':_['map'](_0x7896b9[_0x28e2('0x4f')],function(_0x5e4ea0){var _0x2bbcad={};_0x2bbcad[_0x5e4ea0]={'$like':'%'+_0x5e0f1d['query'][_0x28e2('0x57')]+'%'};return _0x2bbcad;})});}if(_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0xa3')]){var _0x1d784f=_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0xa3')]['split'](',');var _0x56a5f1={};_0x56a5f1[_0x1d784f[0x0]]={'$gte':moment(_0x1d784f[0x1])['format'](_0x28e2('0xa4'))};_0x7896b9['where']=_[_0x28e2('0x58')](_0x7896b9[_0x28e2('0x55')],_0x56a5f1);}_0x7896b9=_[_0x28e2('0x58')]({},_0x7896b9,_0x5e0f1d[_0x28e2('0x5a')]);return db[_0x28e2('0xa2')]['count']({'where':_0x7896b9[_0x28e2('0x55')]})['then'](function(_0x3002e0){_0x356072['count']=_0x3002e0;if(_0x5e0f1d[_0x28e2('0x4b')][_0x28e2('0x5b')]){_0x7896b9[_0x28e2('0x5c')]=[{'all':!![]}];}return db[_0x28e2('0xa2')][_0x28e2('0x70')](_0x7896b9);})[_0x28e2('0x24')](function(_0x1acb02){_0x356072[_0x28e2('0x6a')]=_0x1acb02;return _0x356072;});}})[_0x28e2('0x24')](respondWithFilteredResult(_0x181a5c,_0x7896b9))[_0x28e2('0x2e')](handleError(_0x181a5c,null));};exports[_0x28e2('0x3e')]=function(_0x3ef991,_0x4e7ff2,_0x2a40a7){var _0x3e68e1,_0x161c86={},_0x188822;if(_0x3ef991[_0x28e2('0x61')]['to']){_0x188822=_0x3ef991[_0x28e2('0x61')]['to'][_0x28e2('0xa5')](',')[0x0];}return db['MailAccount'][_0x28e2('0x60')]({'where':{'id':_0x3ef991[_0x28e2('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x28e2('0xa6'),'include':[{'model':db[_0x28e2('0x90')],'as':_0x28e2('0xa7'),'where':{'email':_0x188822},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x28e2('0x42')],'as':_0x28e2('0x43'),'raw':!![]}]})[_0x28e2('0x24')](handleEntityNotFound(_0x4e7ff2,null))[_0x28e2('0x24')](function(_0x41408f){if(_0x41408f){_0x3e68e1=_0x41408f;if(_0x41408f[_0x28e2('0x43')]){if(_['isNil'](_0x3ef991[_0x28e2('0x61')]['from'])){_0x3ef991[_0x28e2('0x61')][_0x28e2('0xa8')]=util[_0x28e2('0xa9')](_0x28e2('0xaa'),_0x41408f[_0x28e2('0x3d')],_0x41408f['email']||_0x41408f[_0x28e2('0x43')]['user']);}if(_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')]&&_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')][_0x28e2('0x5f')]){for(var _0x505a85=0x0;_0x505a85<_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')]['length'];_0x505a85+=0x1){_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')][_0x505a85]={'filename':_0x3ef991['body'][_0x28e2('0xab')][_0x505a85]['name'],'path':path[_0x28e2('0xac')](config['root'],'server/files/attachments',_0x3ef991[_0x28e2('0x61')][_0x28e2('0xab')][_0x505a85][_0x28e2('0xad')])};}}var _0x241681={'tls':{'rejectUnauthorized':![]}};if(_[_0x28e2('0x74')](_0x41408f[_0x28e2('0x43')][_0x28e2('0x7e')])){if(_0x41408f[_0x28e2('0x43')][_0x28e2('0x7b')]){_0x241681[_0x28e2('0xae')]={'user':_0x41408f[_0x28e2('0x43')][_0x28e2('0x78')],'pass':_0x41408f[_0x28e2('0x43')][_0x28e2('0x7f')]};}_0x241681[_0x28e2('0x7c')]=_0x41408f['Smtp'][_0x28e2('0x7c')];_0x241681[_0x28e2('0x7d')]=_0x41408f[_0x28e2('0x43')]['port'];_0x241681['secure']=_0x41408f['Smtp'][_0x28e2('0xaf')];}else{_0x241681[_0x28e2('0x7e')]=_0x41408f[_0x28e2('0x43')]['service'];_0x241681[_0x28e2('0xae')]={'user':_0x41408f[_0x28e2('0x43')][_0x28e2('0x78')],'pass':_0x41408f['Smtp'][_0x28e2('0x7f')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x241681,'message':_0x3ef991[_0x28e2('0x61')]});}else{throw new Error('List\x20not\x20found');}}})[_0x28e2('0x24')](function(_0x50ae1b){if(_0x50ae1b){_0x161c86=_0x50ae1b;if(_0x3e68e1[_0x28e2('0xa6')]){if(_0x3e68e1[_0x28e2('0xa6')]['Contacts'][_0x28e2('0x5f')]){return _0x3e68e1[_0x28e2('0xa6')][_0x28e2('0xa7')][0x0];}else{return db[_0x28e2('0x90')][_0x28e2('0x66')](_[_0x28e2('0x18')](_0x3ef991[_0x28e2('0x61')],{'firstName':_0x3ef991[_0x28e2('0x61')]['to'],'email':_0x3ef991[_0x28e2('0x61')]['to'],'phone':_0x3ef991[_0x28e2('0x61')]['to'],'ListId':_0x3e68e1[_0x28e2('0x73')]}));}}else{throw new Error(_0x28e2('0xb0'));}}})['then'](function(_0x313f54){if(_0x313f54){var _0x13437f={'UserId':_0x3ef991[_0x28e2('0x78')]['id'],'ContactId':_0x313f54['id'],'MailAccountId':_0x3e68e1['id'],'inReplyTo':_0x161c86[_0x28e2('0xb1')],'to':_0x3ef991[_0x28e2('0x61')][_0x28e2('0xa8')],'cc':_0x3ef991['body']['cc'],'subject':_0x3ef991['body'][_0x28e2('0xb2')],'attach':_0x3ef991[_0x28e2('0x61')][_0x28e2('0xb3')],'firstMsgDirection':_0x28e2('0xb4'),'lastMsgAt':moment()[_0x28e2('0xa9')](_0x28e2('0xa4')),'lastMsgDirection':_0x28e2('0xb4'),'lastMsgBody':_0x3ef991[_0x28e2('0x61')][_0x28e2('0x61')],'Messages':[_[_0x28e2('0x58')](_0x3ef991[_0x28e2('0x61')],{'messageId':_0x161c86[_0x28e2('0xb1')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3e68e1['id'],'UserId':_0x3ef991[_0x28e2('0x78')]['id'],'ContactId':_0x313f54['id']})]};if(_0x3ef991[_0x28e2('0x61')][_0x28e2('0xb5')]){_0x13437f=_['merge'](_0x13437f,_0x3ef991['body']['Interaction']);}return db[_0x28e2('0x8d')][_0x28e2('0x66')](_0x13437f,{'include':[{'model':db[_0x28e2('0xa2')],'as':_0x28e2('0xb6')}]});}})[_0x28e2('0x24')](respondWithResult(_0x4e7ff2,null))['catch'](handleError(_0x4e7ff2,null));};exports[_0x28e2('0xb7')]=function(_0xc0d420,_0x4da7ab,_0x9c86f9){return db[_0x28e2('0x46')]['find']({'where':{'id':_0xc0d420[_0x28e2('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x28e2('0x43'),'raw':!![]}]})[_0x28e2('0x24')](handleEntityNotFound(_0x4da7ab,null))[_0x28e2('0x24')](function(_0x290996){if(_0x290996&&_0x290996[_0x28e2('0x43')]){var _0x47ad81={'id':_0x290996['id'],'tls':{'rejectUnauthorized':![]}};if(_0x290996['Smtp'][_0x28e2('0x7e')]){_0x47ad81[_0x28e2('0x7e')]=_0x290996[_0x28e2('0x43')]['service'];}else{_0x47ad81['host']=_0x290996[_0x28e2('0x43')]['host'];_0x47ad81['port']=_0x290996[_0x28e2('0x43')]['port'];_0x47ad81[_0x28e2('0xaf')]=_0x290996[_0x28e2('0x43')][_0x28e2('0xaf')];}if(_0x290996[_0x28e2('0x43')][_0x28e2('0x7b')]){_0x47ad81[_0x28e2('0xae')]={'user':_0x290996[_0x28e2('0x43')][_0x28e2('0x78')],'pass':_0x290996[_0x28e2('0x43')]['pass']};}return respondWithRpcPromise(_0x28e2('0xb8'),_0x28e2('0xb7'),{'account':_0x47ad81});}})[_0x28e2('0x24')](respondWithResult(_0x4da7ab,null))[_0x28e2('0x2e')](handleError(_0x4da7ab,null));};exports[_0x28e2('0x9d')]=function(_0x5ccee4,_0x3a8842){return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x5ccee4[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x3a8842,null))[_0x28e2('0x24')](function(_0xd19477){if(_0xd19477&&_0xd19477[_0x28e2('0x7e')]){throw new db[(_0x28e2('0x20'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xd19477;})[_0x28e2('0x24')](removeEntity(_0x3a8842,null))[_0x28e2('0x2e')](handleError(_0x3a8842,null));};exports[_0x28e2('0xb9')]=function(_0x341217,_0x4aa746,_0x38c0f6){return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x341217['params']['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x4aa746,null))[_0x28e2('0x24')](function(_0x589e85){if(_0x589e85){return _0x589e85[_0x28e2('0xb9')](_0x341217[_0x28e2('0x61')]['ids'],_['omit'](_0x341217[_0x28e2('0x61')],['ids','id'])||{})[_0x28e2('0xba')](function(_0x2364a9){for(var _0x445ae7=0x0;_0x445ae7<_0x341217[_0x28e2('0x61')][_0x28e2('0x6c')][_0x28e2('0x5f')];_0x445ae7+=0x1){socket[_0x28e2('0xbb')](_0x28e2('0xbc'),{'UserId':_0x341217[_0x28e2('0x61')][_0x28e2('0x6c')][_0x445ae7],'MailAccountId':_0x341217['params']['id']});}return _0x2364a9;});}})[_0x28e2('0x24')](respondWithResult(_0x4aa746,null))[_0x28e2('0x2e')](handleError(_0x4aa746,null));};exports['removeAgents']=function(_0x1917da,_0x492d69,_0x594113){return db[_0x28e2('0x46')][_0x28e2('0x60')]({'where':{'id':_0x1917da[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x492d69,null))[_0x28e2('0x24')](function(_0x5c521e){if(_0x5c521e){return _0x5c521e['removeAgents'](_0x1917da[_0x28e2('0x4b')][_0x28e2('0x6c')])[_0x28e2('0x24')](function(){if(_[_0x28e2('0xbd')](_0x1917da[_0x28e2('0x4b')]['ids'])){for(var _0x469b78=0x0;_0x469b78<_0x1917da['query'][_0x28e2('0x6c')][_0x28e2('0x5f')];_0x469b78+=0x1){socket[_0x28e2('0xbb')](_0x28e2('0xbe'),{'UserId':Number(_0x1917da[_0x28e2('0x4b')][_0x28e2('0x6c')][_0x469b78]),'MailAccountId':Number(_0x1917da[_0x28e2('0x5e')]['id'])});}}else{socket[_0x28e2('0xbb')](_0x28e2('0xbe'),{'UserId':Number(_0x1917da[_0x28e2('0x4b')][_0x28e2('0x6c')]),'MailAccountId':Number(_0x1917da[_0x28e2('0x5e')]['id'])});}});}})[_0x28e2('0x24')](respondWithStatusCode(_0x492d69,null))['catch'](handleError(_0x492d69,null));};exports['getAgents']=function(_0x3cf32e,_0x1d88e7,_0x5359d4){var _0x4adb41={};var _0x58f24f={};var _0x1c9b6c;var _0x3e94b8;return db[_0x28e2('0x46')]['findOne']({'where':{'id':_0x3cf32e[_0x28e2('0x5e')]['id']}})[_0x28e2('0x24')](handleEntityNotFound(_0x1d88e7,null))['then'](function(_0x5b73bb){if(_0x5b73bb){_0x1c9b6c=_0x5b73bb;_0x58f24f[_0x28e2('0x4e')]=_['keys'](db[_0x28e2('0x92')][_0x28e2('0x47')]);_0x58f24f['query']=_['keys'](_0x3cf32e[_0x28e2('0x4b')]);_0x58f24f[_0x28e2('0x4d')]=_[_0x28e2('0x50')](_0x58f24f[_0x28e2('0x4e')],_0x58f24f['query']);_0x4adb41[_0x28e2('0x4f')]=_[_0x28e2('0x50')](_0x58f24f['model'],qs[_0x28e2('0x51')](_0x3cf32e[_0x28e2('0x4b')][_0x28e2('0x51')]));_0x4adb41['attributes']=_0x4adb41[_0x28e2('0x4f')][_0x28e2('0x5f')]?_0x4adb41[_0x28e2('0x4f')]:_0x58f24f[_0x28e2('0x4e')];_0x4adb41['order']=qs['sort'](_0x3cf32e['query'][_0x28e2('0x54')]);_0x4adb41[_0x28e2('0x55')]=qs[_0x28e2('0x4d')](_['pick'](_0x3cf32e[_0x28e2('0x4b')],_0x58f24f[_0x28e2('0x4d')]));if(_0x3cf32e['query'][_0x28e2('0x57')]){_0x4adb41[_0x28e2('0x55')]=_[_0x28e2('0x58')](_0x4adb41['where'],{'$or':_['map'](_0x4adb41['attributes'],function(_0x5828b7){var _0x2fef02={};_0x2fef02[_0x5828b7]={'$like':'%'+_0x3cf32e['query'][_0x28e2('0x57')]+'%'};return _0x2fef02;})});}_0x4adb41=_[_0x28e2('0x58')]({},_0x4adb41,_0x3cf32e[_0x28e2('0x5a')]);return _0x1c9b6c[_0x28e2('0xbf')](_0x4adb41);}})[_0x28e2('0x24')](function(_0x151977){if(_0x151977){_0x3e94b8=_0x151977[_0x28e2('0x5f')];if(!_0x3cf32e['query'][_0x28e2('0x52')](_0x28e2('0x69'))){_0x4adb41[_0x28e2('0x34')]=qs['limit'](_0x3cf32e[_0x28e2('0x4b')]['limit']);_0x4adb41[_0x28e2('0x33')]=qs[_0x28e2('0x33')](_0x3cf32e[_0x28e2('0x4b')][_0x28e2('0x33')]);}return _0x1c9b6c[_0x28e2('0xbf')](_0x4adb41);}})['then'](function(_0x25560a){if(_0x25560a){return _0x25560a?{'count':_0x3e94b8,'rows':_0x25560a}:null;}})['then'](respondWithResult(_0x1d88e7,null))[_0x28e2('0x2e')](handleError(_0x1d88e7,null));}; \ No newline at end of file +var _0xef32=['destroy','get','MailAccounts','UserProfileResource','name','MailServerIn','Imap','Smtp','Pause','MailAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','count','includeAll','rows','catch','params','MailServerOut','mandatoryDispositionPause','length','body','find','describe','addDisposition','MailAccountId','Disposition','create','order','include','findAll','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','key','email','ListId','active','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','CmContact','User','Owner','internal','Tag','Tags','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','format','split','List','Contacts','updatedAt','isNil','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','sendStatus','status','end','offset','limit','set','Content-Range','apply','save','update'];(function(_0x23a981,_0xdcdb57){var _0x3af34b=function(_0x2f13ff){while(--_0x2f13ff){_0x23a981['push'](_0x23a981['shift']());}};_0x3af34b(++_0xdcdb57);}(_0xef32,0x83));var _0x2ef3=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0xef32[_0x368bba];return _0x409f8f;};'use strict';var pdf=require(_0x2ef3('0x0'));var emlformat=require(_0x2ef3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2ef3('0x2'));var jsonpatch=require(_0x2ef3('0x3'));var rp=require(_0x2ef3('0x4'));var moment=require('moment');var BPromise=require(_0x2ef3('0x5'));var Mustache=require(_0x2ef3('0x6'));var util=require(_0x2ef3('0x7'));var path=require(_0x2ef3('0x8'));var sox=require(_0x2ef3('0x9'));var csv=require(_0x2ef3('0xa'));var ejs=require(_0x2ef3('0xb'));var fs=require('fs');var _=require(_0x2ef3('0xc'));var squel=require(_0x2ef3('0xd'));var crypto=require(_0x2ef3('0xe'));var jsforce=require(_0x2ef3('0xf'));var deskjs=require(_0x2ef3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2ef3('0x11'));var Papa=require(_0x2ef3('0x12'));var Redis=require(_0x2ef3('0x13'));var authService=require(_0x2ef3('0x14'));var qs=require(_0x2ef3('0x15'));var as=require(_0x2ef3('0x16'));var hardwareService=require(_0x2ef3('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2ef3('0x18'));var config=require('../../config/environment');var db=require(_0x2ef3('0x19'))['db'];config[_0x2ef3('0x1a')]=_[_0x2ef3('0x1b')](config['redis'],{'host':_0x2ef3('0x1c'),'port':0x18eb});var socket=require(_0x2ef3('0x1d'))(new Redis(config[_0x2ef3('0x1a')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x2ef3('0x1e'));var client=jayson[_0x2ef3('0x1f')][_0x2ef3('0x20')]({'port':0x232b});function checkPasswordPattern(_0x4aada,_0x50ca6c,_0x30baa8){if(_0x30baa8){var _0x1163b1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1163b1[_0x2ef3('0x21')](_0x50ca6c)){return _0x4aada;}else{throw new db[(_0x2ef3('0x22'))][(_0x2ef3('0x23'))](_0x2ef3('0x24'));}}else{return _0x4aada;}}function respondWithRpcPromise(_0x49cff4,_0x236dfd,_0x1ad8fa,_0x1d345f){return new BPromise(function(_0x3b5ac0,_0x2a5112){var _0x352f4d=_0x1d345f||client;return _0x352f4d['request'](_0x49cff4,_0x1ad8fa)[_0x2ef3('0x25')](function(_0x1293af){logger['info']('MailAccount,\x20%s,\x20%s',_0x236dfd,_0x2ef3('0x26'));logger[_0x2ef3('0x27')](_0x2ef3('0x28'),_0x236dfd,_0x2ef3('0x26'),JSON[_0x2ef3('0x29')](_0x1293af));if(_0x1293af[_0x2ef3('0x2a')]){if(_0x1293af['error']['code']===0x1f4){logger[_0x2ef3('0x2a')](_0x2ef3('0x2b'),_0x236dfd,_0x1293af[_0x2ef3('0x2a')][_0x2ef3('0x2c')]);return _0x2a5112(_0x1293af[_0x2ef3('0x2a')][_0x2ef3('0x2c')]);}logger[_0x2ef3('0x2a')]('MailAccount,\x20%s,\x20%s',_0x236dfd,_0x1293af[_0x2ef3('0x2a')]['message']);return _0x3b5ac0(_0x1293af[_0x2ef3('0x2a')][_0x2ef3('0x2c')]);}else{logger['info'](_0x2ef3('0x2b'),_0x236dfd,'request\x20sent');_0x3b5ac0(_0x1293af['result']['message']);}})['catch'](function(_0x23c400){logger[_0x2ef3('0x2a')]('MailAccount,\x20%s,\x20%s',_0x236dfd,_0x23c400);_0x2a5112(_0x23c400);});});}function respondWithStatusCode(_0x321708,_0x37e9ca){_0x37e9ca=_0x37e9ca||0xcc;return function(_0x58513c){if(_0x58513c){return _0x321708[_0x2ef3('0x2d')](_0x37e9ca);}return _0x321708[_0x2ef3('0x2e')](_0x37e9ca)[_0x2ef3('0x2f')]();};}function respondWithResult(_0x1e5351,_0xe60c51){_0xe60c51=_0xe60c51||0xc8;return function(_0x4de060){if(_0x4de060){return _0x1e5351[_0x2ef3('0x2e')](_0xe60c51)['json'](_0x4de060);}};}function respondWithFilteredResult(_0x5ac752,_0xc9ab5e){return function(_0x1b964a){if(_0x1b964a){var _0x376ad2=_0x1b964a['count'],_0x534c86=_0xc9ab5e[_0x2ef3('0x30')],_0x4d54bd=_0xc9ab5e[_0x2ef3('0x30')]+_0xc9ab5e[_0x2ef3('0x31')],_0x7a6fa7;if(_0x4d54bd>=_0x376ad2){_0x4d54bd=_0x376ad2;_0x7a6fa7=0xc8;}else{_0x7a6fa7=0xce;}_0x5ac752[_0x2ef3('0x2e')](_0x7a6fa7);return _0x5ac752[_0x2ef3('0x32')](_0x2ef3('0x33'),_0x534c86+'-'+_0x4d54bd+'/'+_0x376ad2)['json'](_0x1b964a);}return null;};}function patchUpdates(_0x25abe1){return function(_0x4a39b5){try{jsonpatch[_0x2ef3('0x34')](_0x4a39b5,_0x25abe1,!![]);}catch(_0x147466){return BPromise['reject'](_0x147466);}return _0x4a39b5[_0x2ef3('0x35')]();};}function saveUpdates(_0x5766fa,_0x4842e6){return function(_0x5b98d9){if(_0x5b98d9){return _0x5b98d9[_0x2ef3('0x36')](_0x5766fa)['then'](function(_0xd5a5){return _0xd5a5;});}return null;};}function removeEntity(_0x6f5b4c,_0x113dff){return function(_0x290b46){if(_0x290b46){return _0x290b46[_0x2ef3('0x37')]()[_0x2ef3('0x25')](function(){var _0x233f52=_0x290b46[_0x2ef3('0x38')]({'plain':!![]});var _0x630d77=_0x2ef3('0x39');return db[_0x2ef3('0x3a')][_0x2ef3('0x37')]({'where':{'type':_0x630d77,'resourceId':_0x233f52['id']}})[_0x2ef3('0x25')](function(){return _0x290b46;});})[_0x2ef3('0x25')](function(){_0x6f5b4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x407055,_0x56c155){return function(_0x16c872){if(!_0x16c872){_0x407055[_0x2ef3('0x2d')](0x194);}return _0x16c872;};}function handleError(_0x3d5057,_0xee53f7){_0xee53f7=_0xee53f7||0x1f4;return function(_0x48b245){logger['error'](_0x48b245['stack']);if(_0x48b245[_0x2ef3('0x3b')]){delete _0x48b245[_0x2ef3('0x3b')];}_0x3d5057[_0x2ef3('0x2e')](_0xee53f7)['send'](_0x48b245);};}exports['index']=function(_0x2c9f9b,_0x398e65){var _0x31fbf1={'include':[{'model':db[_0x2ef3('0x3c')],'as':_0x2ef3('0x3d')},{'model':db['MailServerOut'],'as':_0x2ef3('0x3e')},{'model':db[_0x2ef3('0x3f')],'as':'mandatoryDispositionPause'}]},_0x41935d={},_0x5d3339={'count':0x0,'rows':[]};var _0x157268=_['map'](db[_0x2ef3('0x40')][_0x2ef3('0x41')],function(_0x5cd5ef){return{'name':_0x5cd5ef[_0x2ef3('0x42')],'type':_0x5cd5ef[_0x2ef3('0x43')]['key']};});_0x41935d[_0x2ef3('0x44')]=_[_0x2ef3('0x45')](_0x157268,_0x2ef3('0x3b'));_0x41935d[_0x2ef3('0x46')]=_[_0x2ef3('0x47')](_0x2c9f9b[_0x2ef3('0x46')]);_0x41935d[_0x2ef3('0x48')]=_[_0x2ef3('0x49')](_0x41935d[_0x2ef3('0x44')],_0x41935d[_0x2ef3('0x46')]);_0x31fbf1[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x41935d[_0x2ef3('0x44')],qs[_0x2ef3('0x4b')](_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x31fbf1[_0x2ef3('0x4a')]=_0x31fbf1[_0x2ef3('0x4a')]['length']?_0x31fbf1[_0x2ef3('0x4a')]:_0x41935d[_0x2ef3('0x44')];if(!_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x4c')](_0x2ef3('0x4d'))){_0x31fbf1[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x31')]);_0x31fbf1['offset']=qs['offset'](_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x31fbf1['order']=qs[_0x2ef3('0x4e')](_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x4e')]);_0x31fbf1[_0x2ef3('0x4f')]=qs['filters'](_[_0x2ef3('0x50')](_0x2c9f9b[_0x2ef3('0x46')],_0x41935d[_0x2ef3('0x48')]),_0x157268);if(_0x2c9f9b['query']['filter']){_0x31fbf1[_0x2ef3('0x4f')]=_[_0x2ef3('0x51')](_0x31fbf1['where'],{'$or':_[_0x2ef3('0x45')](_0x157268,function(_0x12dbf8){if(_0x12dbf8[_0x2ef3('0x43')]!=='VIRTUAL'){var _0x35eb0c={};_0x35eb0c[_0x12dbf8[_0x2ef3('0x3b')]]={'$like':'%'+_0x2c9f9b['query'][_0x2ef3('0x52')]+'%'};return _0x35eb0c;}})});}_0x31fbf1=_[_0x2ef3('0x51')]({},_0x31fbf1,_0x2c9f9b[_0x2ef3('0x53')]);var _0x4afc3e={'where':_0x31fbf1[_0x2ef3('0x4f')]};return db[_0x2ef3('0x40')]['count'](_0x4afc3e)[_0x2ef3('0x25')](function(_0x548041){_0x5d3339[_0x2ef3('0x54')]=_0x548041;if(_0x2c9f9b[_0x2ef3('0x46')][_0x2ef3('0x55')]){_0x31fbf1['include']=[{'all':!![]}];}return db[_0x2ef3('0x40')]['findAll'](_0x31fbf1);})[_0x2ef3('0x25')](function(_0x47f463){_0x5d3339[_0x2ef3('0x56')]=_0x47f463;return _0x5d3339;})['then'](respondWithFilteredResult(_0x398e65,_0x31fbf1))[_0x2ef3('0x57')](handleError(_0x398e65,null));};exports['show']=function(_0x47383d,_0x297afe){var _0x582c28={'raw':![],'where':{'id':_0x47383d[_0x2ef3('0x58')]['id']},'include':[{'model':db[_0x2ef3('0x3c')],'as':_0x2ef3('0x3d')},{'model':db[_0x2ef3('0x59')],'as':_0x2ef3('0x3e')},{'model':db[_0x2ef3('0x3f')],'as':_0x2ef3('0x5a')}]},_0x32607b={};_0x32607b[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db[_0x2ef3('0x40')][_0x2ef3('0x41')]);_0x32607b[_0x2ef3('0x46')]=_['keys'](_0x47383d[_0x2ef3('0x46')]);_0x32607b[_0x2ef3('0x48')]=_['intersection'](_0x32607b['model'],_0x32607b['query']);_0x582c28[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x32607b[_0x2ef3('0x44')],qs['fields'](_0x47383d[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x582c28[_0x2ef3('0x4a')]=_0x582c28[_0x2ef3('0x4a')][_0x2ef3('0x5b')]?_0x582c28['attributes']:_0x32607b['model'];if(_0x47383d[_0x2ef3('0x46')][_0x2ef3('0x55')]){_0x582c28['include']=[{'all':!![]}];}_0x582c28=_[_0x2ef3('0x51')]({},_0x582c28,_0x47383d[_0x2ef3('0x53')]);return db['MailAccount']['find'](_0x582c28)[_0x2ef3('0x25')](handleEntityNotFound(_0x297afe,null))[_0x2ef3('0x25')](respondWithResult(_0x297afe,null))[_0x2ef3('0x57')](handleError(_0x297afe,null));};exports['update']=function(_0x16aafb,_0xb71a53){if(_0x16aafb['body']['id']){delete _0x16aafb[_0x2ef3('0x5c')]['id'];}return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x16aafb['params']['id']},'include':[{'model':db[_0x2ef3('0x3c')],'as':'Imap'},{'model':db[_0x2ef3('0x59')],'as':_0x2ef3('0x3e')},{'model':db[_0x2ef3('0x3f')],'as':'mandatoryDispositionPause'}]})[_0x2ef3('0x25')](handleEntityNotFound(_0xb71a53,null))[_0x2ef3('0x25')](saveUpdates(_0x16aafb[_0x2ef3('0x5c')],null))[_0x2ef3('0x25')](function(_0x5de4a4){if(_0x5de4a4&&_0x16aafb['body'][_0x2ef3('0x3d')]){return db[_0x2ef3('0x3c')]['update'](_0x16aafb[_0x2ef3('0x5c')]['Imap'],{'where':{'MailAccountId':_0x5de4a4['id']}})['then'](function(){return _0x5de4a4;});}return _0x5de4a4;})['then'](function(_0x4fa819){if(_0x4fa819&&_0x16aafb[_0x2ef3('0x5c')][_0x2ef3('0x3e')]){return db[_0x2ef3('0x59')][_0x2ef3('0x36')](_0x16aafb[_0x2ef3('0x5c')][_0x2ef3('0x3e')],{'where':{'MailAccountId':_0x4fa819['id']}})['then'](function(){return _0x4fa819;});}return _0x4fa819;})[_0x2ef3('0x25')](respondWithResult(_0xb71a53,null))['catch'](handleError(_0xb71a53,null));};exports[_0x2ef3('0x5e')]=function(_0x105a81,_0x161049){return db[_0x2ef3('0x40')][_0x2ef3('0x5e')]()[_0x2ef3('0x25')](respondWithResult(_0x161049,null))[_0x2ef3('0x57')](handleError(_0x161049,null));};exports[_0x2ef3('0x5f')]=function(_0x519bf8,_0x1e6f6e,_0x14693f){if(_0x519bf8[_0x2ef3('0x5c')]['id']){delete _0x519bf8[_0x2ef3('0x5c')]['id'];}return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x519bf8['params']['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x1e6f6e,null))['then'](function(_0x707950){if(_0x707950){_0x519bf8[_0x2ef3('0x5c')][_0x2ef3('0x60')]=_0x707950['id'];return db[_0x2ef3('0x61')][_0x2ef3('0x62')](_0x519bf8[_0x2ef3('0x5c')]);}})['then'](respondWithResult(_0x1e6f6e,null))['catch'](handleError(_0x1e6f6e,null));};exports['getDispositions']=function(_0x4ab6a2,_0x50fa7b,_0xedc4a7){var _0x499c7d={'raw':![],'where':{}};var _0x5d0c76={};var _0xf0ba57={'count':0x0,'rows':[]};return db[_0x2ef3('0x40')]['findOne']({'where':{'id':_0x4ab6a2[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x50fa7b,null))[_0x2ef3('0x25')](function(_0xba60b2){if(_0xba60b2){_0x5d0c76[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db[_0x2ef3('0x61')][_0x2ef3('0x41')]);_0x5d0c76[_0x2ef3('0x46')]=_['keys'](_0x4ab6a2['query']);_0x5d0c76['filters']=_[_0x2ef3('0x49')](_0x5d0c76['model'],_0x5d0c76[_0x2ef3('0x46')]);_0x499c7d[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x5d0c76[_0x2ef3('0x44')],qs['fields'](_0x4ab6a2['query'][_0x2ef3('0x4b')]));_0x499c7d[_0x2ef3('0x4a')]=_0x499c7d[_0x2ef3('0x4a')][_0x2ef3('0x5b')]?_0x499c7d[_0x2ef3('0x4a')]:_0x5d0c76[_0x2ef3('0x44')];if(!_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x4c')]('nolimit')){_0x499c7d[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x31')]);_0x499c7d[_0x2ef3('0x30')]=qs[_0x2ef3('0x30')](_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x499c7d[_0x2ef3('0x63')]=qs['sort'](_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x4e')]);_0x499c7d[_0x2ef3('0x4f')]=qs['filters'](_['pick'](_0x4ab6a2['query'],_0x5d0c76[_0x2ef3('0x48')]));_0x499c7d['where'][_0x2ef3('0x60')]=_0xba60b2['id'];if(_0x4ab6a2[_0x2ef3('0x46')]['filter']){_0x499c7d[_0x2ef3('0x4f')]=_[_0x2ef3('0x51')](_0x499c7d[_0x2ef3('0x4f')],{'$or':_[_0x2ef3('0x45')](_0x499c7d[_0x2ef3('0x4a')],function(_0x5d4fa5){var _0x59623c={};_0x59623c[_0x5d4fa5]={'$like':'%'+_0x4ab6a2[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0x59623c;})});}_0x499c7d=_[_0x2ef3('0x51')]({},_0x499c7d,_0x4ab6a2[_0x2ef3('0x53')]);return db['Disposition'][_0x2ef3('0x54')]({'where':_0x499c7d[_0x2ef3('0x4f')]})[_0x2ef3('0x25')](function(_0x18e667){_0xf0ba57[_0x2ef3('0x54')]=_0x18e667;if(_0x4ab6a2[_0x2ef3('0x46')]['includeAll']){_0x499c7d[_0x2ef3('0x64')]=[{'all':!![]}];}return db[_0x2ef3('0x61')][_0x2ef3('0x65')](_0x499c7d);})[_0x2ef3('0x25')](function(_0x4fcaa4){_0xf0ba57[_0x2ef3('0x56')]=_0x4fcaa4;return _0xf0ba57;});}})['then'](respondWithFilteredResult(_0x50fa7b,_0x499c7d))[_0x2ef3('0x57')](handleError(_0x50fa7b,null));};exports[_0x2ef3('0x66')]=function(_0x351e50,_0x6ad5b7,_0x550a01){return db['MailAccount']['find']({'where':{'id':_0x351e50[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x6ad5b7,null))[_0x2ef3('0x25')](function(_0x4f8013){if(_0x4f8013){return _0x4f8013[_0x2ef3('0x66')](_0x351e50[_0x2ef3('0x46')][_0x2ef3('0x67')]);}})[_0x2ef3('0x25')](respondWithStatusCode(_0x6ad5b7,null))[_0x2ef3('0x57')](handleError(_0x6ad5b7,null));};exports['addAnswer']=function(_0x7fc4eb,_0x534ec3,_0x291418){if(_0x7fc4eb[_0x2ef3('0x5c')]['id']){delete _0x7fc4eb[_0x2ef3('0x5c')]['id'];}return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x7fc4eb[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x534ec3,null))[_0x2ef3('0x25')](function(_0x4b116a){if(_0x4b116a){_0x7fc4eb[_0x2ef3('0x5c')]['MailAccountId']=_0x4b116a['id'];return db[_0x2ef3('0x68')]['create'](_0x7fc4eb[_0x2ef3('0x5c')]);}})[_0x2ef3('0x25')](respondWithResult(_0x534ec3,null))[_0x2ef3('0x57')](handleError(_0x534ec3,null));};exports['getAnswers']=function(_0xb17e24,_0x1724fb,_0x4bcd50){var _0x14ea61={'raw':![],'where':{}};var _0x57867e={};var _0x1320ae={'count':0x0,'rows':[]};return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0xb17e24[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x1724fb,null))[_0x2ef3('0x25')](function(_0x3d2d7d){if(_0x3d2d7d){_0x57867e[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db[_0x2ef3('0x68')]['rawAttributes']);_0x57867e[_0x2ef3('0x46')]=_[_0x2ef3('0x47')](_0xb17e24[_0x2ef3('0x46')]);_0x57867e[_0x2ef3('0x48')]=_[_0x2ef3('0x49')](_0x57867e['model'],_0x57867e[_0x2ef3('0x46')]);_0x14ea61[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x57867e[_0x2ef3('0x44')],qs[_0x2ef3('0x4b')](_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x14ea61['attributes']=_0x14ea61[_0x2ef3('0x4a')]['length']?_0x14ea61['attributes']:_0x57867e[_0x2ef3('0x44')];if(!_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x4c')]('nolimit')){_0x14ea61[_0x2ef3('0x31')]=qs['limit'](_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x31')]);_0x14ea61[_0x2ef3('0x30')]=qs['offset'](_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x14ea61[_0x2ef3('0x63')]=qs[_0x2ef3('0x4e')](_0xb17e24['query'][_0x2ef3('0x4e')]);_0x14ea61['where']=qs['filters'](_[_0x2ef3('0x50')](_0xb17e24[_0x2ef3('0x46')],_0x57867e[_0x2ef3('0x48')]));_0x14ea61[_0x2ef3('0x4f')][_0x2ef3('0x60')]=_0x3d2d7d['id'];if(_0xb17e24['query'][_0x2ef3('0x52')]){_0x14ea61['where']=_[_0x2ef3('0x51')](_0x14ea61[_0x2ef3('0x4f')],{'$or':_[_0x2ef3('0x45')](_0x14ea61['attributes'],function(_0x529644){var _0x19f0fd={};_0x19f0fd[_0x529644]={'$like':'%'+_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0x19f0fd;})});}_0x14ea61=_[_0x2ef3('0x51')]({},_0x14ea61,_0xb17e24[_0x2ef3('0x53')]);return db[_0x2ef3('0x68')][_0x2ef3('0x54')]({'where':_0x14ea61['where']})[_0x2ef3('0x25')](function(_0x377838){_0x1320ae[_0x2ef3('0x54')]=_0x377838;if(_0xb17e24[_0x2ef3('0x46')][_0x2ef3('0x55')]){_0x14ea61['include']=[{'all':!![]}];}return db[_0x2ef3('0x68')][_0x2ef3('0x65')](_0x14ea61);})[_0x2ef3('0x25')](function(_0x3bd685){_0x1320ae['rows']=_0x3bd685;return _0x1320ae;});}})['then'](respondWithFilteredResult(_0x1724fb,_0x14ea61))[_0x2ef3('0x57')](handleError(_0x1724fb,null));};exports[_0x2ef3('0x6a')]=function(_0x3afc33,_0x4cf6dc,_0x172124){return db[_0x2ef3('0x40')]['find']({'where':{'id':_0x3afc33['params']['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x4cf6dc,null))[_0x2ef3('0x25')](function(_0x2c3ec8){if(_0x2c3ec8){return _0x2c3ec8[_0x2ef3('0x6a')](_0x3afc33[_0x2ef3('0x46')]['ids']);}})[_0x2ef3('0x25')](respondWithStatusCode(_0x4cf6dc,null))[_0x2ef3('0x57')](handleError(_0x4cf6dc,null));};exports[_0x2ef3('0x62')]=function(_0x125abc,_0x2c7192){var _0x47d0ce={'name':_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3b')],'key':_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6b')],'email':_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6c')],'ListId':_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6d')],'active':!_['isNil'](_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6e')])?_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6e')]:!![],'description':_0x125abc['body']['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6f')])){if(_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x70')]){_0x47d0ce[_0x2ef3('0x3d')][_0x2ef3('0x71')]=_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x71')]=_0x125abc['body'][_0x2ef3('0x72')];_0x47d0ce[_0x2ef3('0x3d')]['password']=_0x47d0ce[_0x2ef3('0x3e')]['pass']=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x73')];}else{_0x47d0ce[_0x2ef3('0x3d')][_0x2ef3('0x74')]=_0x47d0ce['Smtp'][_0x2ef3('0x74')]=![];}_0x47d0ce[_0x2ef3('0x3d')]['host']=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3d')][_0x2ef3('0x75')];_0x47d0ce[_0x2ef3('0x3d')][_0x2ef3('0x76')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3d')][_0x2ef3('0x76')];_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x75')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3e')][_0x2ef3('0x75')];_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x76')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x3e')][_0x2ef3('0x76')];}else{_0x47d0ce['Imap'][_0x2ef3('0x77')]=_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x77')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x6f')];_0x47d0ce[_0x2ef3('0x3d')][_0x2ef3('0x71')]=_0x47d0ce[_0x2ef3('0x3e')]['user']=_0x125abc[_0x2ef3('0x5c')]['cuser'];_0x47d0ce['Imap'][_0x2ef3('0x78')]=_0x47d0ce[_0x2ef3('0x3e')][_0x2ef3('0x79')]=_0x125abc[_0x2ef3('0x5c')][_0x2ef3('0x73')];}return db[_0x2ef3('0x40')][_0x2ef3('0x62')](_0x47d0ce,{'include':[{'model':db[_0x2ef3('0x59')],'as':'Smtp'},{'model':db[_0x2ef3('0x3c')],'as':_0x2ef3('0x3d')}]})[_0x2ef3('0x25')](function(_0x3a904b){var _0x3d0c4b=_0x125abc[_0x2ef3('0x71')][_0x2ef3('0x38')]({'plain':!![]});if(!_0x3d0c4b)throw new Error(_0x2ef3('0x7a'));if(_0x3d0c4b[_0x2ef3('0x7b')]===_0x2ef3('0x71')){var _0x5a17cb=_0x3a904b[_0x2ef3('0x38')]({'plain':!![]});return db[_0x2ef3('0x7c')][_0x2ef3('0x5d')]({'where':{'name':'MailAccounts','userProfileId':_0x3d0c4b[_0x2ef3('0x7d')]},'raw':!![]})[_0x2ef3('0x25')](function(_0x26838c){if(_0x26838c&&_0x26838c[_0x2ef3('0x7e')]===0x0){return db['UserProfileResource'][_0x2ef3('0x62')]({'name':_0x5a17cb[_0x2ef3('0x3b')],'resourceId':_0x5a17cb['id'],'type':_0x26838c[_0x2ef3('0x3b')],'sectionId':_0x26838c['id']},{})['then'](function(){return _0x3a904b;});}else{return _0x3a904b;}})[_0x2ef3('0x57')](function(_0x18b204){logger[_0x2ef3('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18b204);throw _0x18b204;});}return _0x3a904b;})[_0x2ef3('0x25')](respondWithResult(_0x2c7192,0xc9))[_0x2ef3('0x57')](handleError(_0x2c7192,null));};exports[_0x2ef3('0x7f')]=function(_0x3a5a15,_0x2aad12,_0xaeab6e){return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0x3a5a15['params']['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x2aad12,null))[_0x2ef3('0x25')](function(_0x255ba5){if(_0x255ba5){return _0x255ba5[_0x2ef3('0x7f')]();}return null;})[_0x2ef3('0x25')](respondWithResult(_0x2aad12,null))[_0x2ef3('0x57')](handleError(_0x2aad12,null));};exports[_0x2ef3('0x80')]=function(_0x462c75,_0x5c323f,_0x40c87c){if(_0x462c75['body']['id']){delete _0x462c75[_0x2ef3('0x5c')]['id'];}return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x462c75[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x5c323f,null))[_0x2ef3('0x25')](function(_0x13d7b3){if(_0x13d7b3){_0x462c75[_0x2ef3('0x5c')][_0x2ef3('0x60')]=_0x13d7b3['id'];return db[_0x2ef3('0x3c')][_0x2ef3('0x62')](_0x462c75[_0x2ef3('0x5c')]);}})['then'](respondWithResult(_0x5c323f,null))['catch'](handleError(_0x5c323f,null));};exports[_0x2ef3('0x81')]=function(_0x5bd470,_0x4ca164,_0x4ecd12){return db[_0x2ef3('0x40')]['findOne']({'where':{'id':_0x5bd470[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ca164,null))[_0x2ef3('0x25')](function(_0x154cbf){if(_0x154cbf){return _0x154cbf[_0x2ef3('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x4ca164,null))[_0x2ef3('0x57')](handleError(_0x4ca164,null));};exports[_0x2ef3('0x83')]=function(_0x32d2e5,_0x57b2dd,_0x43bfb5){return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0x32d2e5[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x57b2dd,null))['then'](function(_0x500cf5){if(_0x500cf5){return _0x500cf5[_0x2ef3('0x83')]();}return null;})['then'](respondWithResult(_0x57b2dd,null))[_0x2ef3('0x57')](handleError(_0x57b2dd,null));};exports[_0x2ef3('0x84')]=function(_0x59d3b9,_0x29fde2,_0x4848d7){if(_0x59d3b9['body']['id']){delete _0x59d3b9[_0x2ef3('0x5c')]['id'];}return db['MailAccount'][_0x2ef3('0x5d')]({'where':{'id':_0x59d3b9[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x29fde2,null))[_0x2ef3('0x25')](function(_0x2747d2){if(_0x2747d2){_0x59d3b9[_0x2ef3('0x5c')][_0x2ef3('0x60')]=_0x2747d2['id'];return db[_0x2ef3('0x59')][_0x2ef3('0x62')](_0x59d3b9[_0x2ef3('0x5c')]);}})[_0x2ef3('0x25')](respondWithResult(_0x29fde2,null))['catch'](handleError(_0x29fde2,null));};exports[_0x2ef3('0x85')]=function(_0x445f38,_0x305d44,_0x28f1d1){return db['MailAccount']['findOne']({'where':{'id':_0x445f38[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x305d44,null))[_0x2ef3('0x25')](function(_0xf4ce92){if(_0xf4ce92){return _0xf4ce92['setSmtp'](null);}return null;})[_0x2ef3('0x25')](respondWithStatusCode(_0x305d44,null))[_0x2ef3('0x57')](handleError(_0x305d44,null));};exports['addInteraction']=function(_0x353705,_0x3d9f72,_0x5b6585){return db[_0x2ef3('0x86')]['find']({'where':{'id':_0x353705[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x3d9f72,null))[_0x2ef3('0x25')](function(_0x4501ce){if(_0x4501ce){return _0x4501ce[_0x2ef3('0x87')](_0x353705[_0x2ef3('0x5c')][_0x2ef3('0x67')],_[_0x2ef3('0x88')](_0x353705['body'],['ids','id'])||{});}})[_0x2ef3('0x25')](respondWithResult(_0x3d9f72,null))[_0x2ef3('0x57')](handleError(_0x3d9f72,null));};exports['getInteractions']=function(_0x3b5673,_0x47684e,_0x46f22c){var _0x382482={'raw':![],'where':{}};var _0x506c82={};var _0xa586d6={'count':0x0,'rows':[]};return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0x3b5673[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x47684e,null))[_0x2ef3('0x25')](function(_0x3bf33f){if(_0x3bf33f){_0x506c82[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db[_0x2ef3('0x86')][_0x2ef3('0x41')]);_0x506c82[_0x2ef3('0x46')]=_[_0x2ef3('0x47')](_0x3b5673['query']);_0x506c82['filters']=_[_0x2ef3('0x49')](_0x506c82['model'],_0x506c82[_0x2ef3('0x46')]);_0x382482[_0x2ef3('0x4a')]=_['intersection'](_0x506c82['model'],qs[_0x2ef3('0x4b')](_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x382482['attributes']=_0x382482['attributes'][_0x2ef3('0x5b')]?_0x382482['attributes']:_0x506c82['model'];if(!_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x4c')]('nolimit')){_0x382482[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x3b5673[_0x2ef3('0x46')]['limit']);_0x382482['offset']=qs[_0x2ef3('0x30')](_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x382482[_0x2ef3('0x63')]=qs[_0x2ef3('0x4e')](_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x4e')]);_0x382482[_0x2ef3('0x4f')]=qs[_0x2ef3('0x48')](_[_0x2ef3('0x50')](_0x3b5673[_0x2ef3('0x46')],_0x506c82[_0x2ef3('0x48')]));_0x382482['where']['MailAccountId']=_0x3bf33f['id'];if(_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x52')]){_0x382482['where']=_[_0x2ef3('0x51')](_0x382482[_0x2ef3('0x4f')],{'$or':_['map'](_0x382482[_0x2ef3('0x4a')],function(_0x2caff2){var _0xf6ab48={};_0xf6ab48[_0x2caff2]={'$like':'%'+_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0xf6ab48;})});}_0x382482=_['merge']({},_0x382482,_0x3b5673[_0x2ef3('0x53')]);return db['MailInteraction'][_0x2ef3('0x54')]({'where':_0x382482[_0x2ef3('0x4f')]})[_0x2ef3('0x25')](function(_0x554422){_0xa586d6['count']=_0x554422;if(_0x3b5673[_0x2ef3('0x46')]['includeAll']){_0x382482[_0x2ef3('0x64')]=[{'model':db[_0x2ef3('0x89')],'as':'Contact','required':![]},{'model':db[_0x2ef3('0x8a')],'as':_0x2ef3('0x8b'),'attributes':[_0x2ef3('0x3b'),'fullname',_0x2ef3('0x8c')],'required':![]},{'model':db[_0x2ef3('0x8d')],'as':_0x2ef3('0x8e'),'attributes':['id',_0x2ef3('0x3b'),'color'],'where':_0x3b5673['query'][_0x2ef3('0x8f')]?{'id':_0x3b5673[_0x2ef3('0x46')][_0x2ef3('0x8f')]}:undefined,'required':_0x3b5673[_0x2ef3('0x46')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x2ef3('0x65')](_0x382482);})[_0x2ef3('0x25')](function(_0x98c462){_0xa586d6[_0x2ef3('0x56')]=_0x98c462;return _0xa586d6;});}})[_0x2ef3('0x25')](respondWithFilteredResult(_0x47684e,_0x382482))[_0x2ef3('0x57')](handleError(_0x47684e,null));};exports['addApplications']=function(_0x104edd,_0x4969d5,_0x1342c0){return db['MailAccount']['findOne']({'where':{'id':_0x104edd[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x4969d5,null))[_0x2ef3('0x25')](function(_0x4d9918){if(_0x4d9918){return db[_0x2ef3('0x90')][_0x2ef3('0x91')](function(_0x192220){return db[_0x2ef3('0x92')]['destroy']({'where':{'MailAccountId':_0x104edd['params']['id']},'transaction':_0x192220})[_0x2ef3('0x25')](function(_0x21ef2a){var _0xbb6853=_[_0x2ef3('0x45')](_0x104edd[_0x2ef3('0x5c')],function(_0x5d464a){_0x5d464a['MailAccountId']=_0x104edd[_0x2ef3('0x58')]['id'];return _0x5d464a;});return db[_0x2ef3('0x92')][_0x2ef3('0x93')](_0xbb6853,{'transaction':_0x192220});});})[_0x2ef3('0x25')](function(){return db['MailApplication'][_0x2ef3('0x94')]({'where':{'MailAccountId':_0x104edd[_0x2ef3('0x58')]['id']},'order':_0x2ef3('0x95')});});}})[_0x2ef3('0x25')](respondWithResult(_0x4969d5,null))['catch'](handleError(_0x4969d5,null));};exports[_0x2ef3('0x96')]=function(_0x15225c,_0x3ede96,_0x1d970b){var _0x49c11b={};var _0xcdcd80={};var _0xcc5a00;var _0x457d9d;return db[_0x2ef3('0x40')][_0x2ef3('0x69')]({'where':{'id':_0x15225c[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x3ede96,null))[_0x2ef3('0x25')](function(_0x2c1cdf){if(_0x2c1cdf){_0xcc5a00=_0x2c1cdf;_0xcdcd80[_0x2ef3('0x44')]=_[_0x2ef3('0x47')](db['MailApplication'][_0x2ef3('0x41')]);_0xcdcd80['query']=_[_0x2ef3('0x47')](_0x15225c[_0x2ef3('0x46')]);_0xcdcd80[_0x2ef3('0x48')]=_[_0x2ef3('0x49')](_0xcdcd80[_0x2ef3('0x44')],_0xcdcd80['query']);_0x49c11b[_0x2ef3('0x4a')]=_['intersection'](_0xcdcd80[_0x2ef3('0x44')],qs['fields'](_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x49c11b[_0x2ef3('0x4a')]=_0x49c11b[_0x2ef3('0x4a')][_0x2ef3('0x5b')]?_0x49c11b['attributes']:_0xcdcd80[_0x2ef3('0x44')];_0x49c11b[_0x2ef3('0x63')]=qs['sort'](_0x15225c[_0x2ef3('0x46')]['sort']);_0x49c11b['where']=qs[_0x2ef3('0x48')](_[_0x2ef3('0x50')](_0x15225c[_0x2ef3('0x46')],_0xcdcd80['filters']));if(_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x52')]){_0x49c11b['where']=_[_0x2ef3('0x51')](_0x49c11b['where'],{'$or':_[_0x2ef3('0x45')](_0x49c11b['attributes'],function(_0x50f8a6){var _0x40221f={};_0x40221f[_0x50f8a6]={'$like':'%'+_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0x40221f;})});}_0x49c11b=_['merge']({},_0x49c11b,_0x15225c[_0x2ef3('0x53')]);return _0xcc5a00[_0x2ef3('0x96')](_0x49c11b);}})[_0x2ef3('0x25')](function(_0x3d0983){if(_0x3d0983){_0x457d9d=_0x3d0983[_0x2ef3('0x5b')];if(!_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x4c')](_0x2ef3('0x4d'))){_0x49c11b[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x15225c[_0x2ef3('0x46')]['limit']);_0x49c11b[_0x2ef3('0x30')]=qs[_0x2ef3('0x30')](_0x15225c[_0x2ef3('0x46')][_0x2ef3('0x30')]);}return _0xcc5a00[_0x2ef3('0x96')](_0x49c11b);}})[_0x2ef3('0x25')](function(_0xbe7a5d){if(_0xbe7a5d){return _0xbe7a5d?{'count':_0x457d9d,'rows':_0xbe7a5d}:null;}})[_0x2ef3('0x25')](respondWithResult(_0x3ede96,null))['catch'](handleError(_0x3ede96,null));};exports['getMessages']=function(_0x3c9333,_0x106902,_0x2cafed){var _0x4710ca={'raw':!![],'where':{}};var _0x48647d={};var _0x547ada={'count':0x0,'rows':[]};return db['MailAccount'][_0x2ef3('0x69')]({'where':{'id':_0x3c9333[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x106902,null))[_0x2ef3('0x25')](function(_0x322446){if(_0x322446){_0x48647d['model']=_[_0x2ef3('0x47')](db[_0x2ef3('0x97')]['rawAttributes']);_0x48647d[_0x2ef3('0x46')]=_['keys'](_0x3c9333[_0x2ef3('0x46')]);_0x48647d['filters']=_[_0x2ef3('0x49')](_0x48647d[_0x2ef3('0x44')],_0x48647d[_0x2ef3('0x46')]);_0x4710ca[_0x2ef3('0x4a')]=_[_0x2ef3('0x49')](_0x48647d[_0x2ef3('0x44')],qs[_0x2ef3('0x4b')](_0x3c9333[_0x2ef3('0x46')][_0x2ef3('0x4b')]));_0x4710ca[_0x2ef3('0x4a')]=_0x4710ca['attributes'][_0x2ef3('0x5b')]?_0x4710ca['attributes']:_0x48647d[_0x2ef3('0x44')];if(!_0x3c9333[_0x2ef3('0x46')][_0x2ef3('0x4c')](_0x2ef3('0x4d'))){_0x4710ca['limit']=qs['limit'](_0x3c9333['query'][_0x2ef3('0x31')]);_0x4710ca[_0x2ef3('0x30')]=qs[_0x2ef3('0x30')](_0x3c9333[_0x2ef3('0x46')][_0x2ef3('0x30')]);}_0x4710ca[_0x2ef3('0x63')]=qs[_0x2ef3('0x4e')](_0x3c9333[_0x2ef3('0x46')]['sort']);_0x4710ca[_0x2ef3('0x4f')]=qs[_0x2ef3('0x48')](_[_0x2ef3('0x50')](_0x3c9333[_0x2ef3('0x46')],_0x48647d[_0x2ef3('0x48')]));_0x4710ca[_0x2ef3('0x4f')][_0x2ef3('0x60')]=_0x322446['id'];if(_0x3c9333[_0x2ef3('0x46')]['filter']){_0x4710ca['where']=_[_0x2ef3('0x51')](_0x4710ca[_0x2ef3('0x4f')],{'$or':_[_0x2ef3('0x45')](_0x4710ca['attributes'],function(_0x596a6d){var _0xda34f7={};_0xda34f7[_0x596a6d]={'$like':'%'+_0x3c9333[_0x2ef3('0x46')]['filter']+'%'};return _0xda34f7;})});}if(_0x3c9333['query']['$gte']){var _0x5432f7=_0x3c9333[_0x2ef3('0x46')]['$gte']['split'](',');var _0x4992ed={};_0x4992ed[_0x5432f7[0x0]]={'$gte':moment(_0x5432f7[0x1])[_0x2ef3('0x98')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4710ca[_0x2ef3('0x4f')]=_[_0x2ef3('0x51')](_0x4710ca[_0x2ef3('0x4f')],_0x4992ed);}_0x4710ca=_[_0x2ef3('0x51')]({},_0x4710ca,_0x3c9333[_0x2ef3('0x53')]);return db[_0x2ef3('0x97')][_0x2ef3('0x54')]({'where':_0x4710ca[_0x2ef3('0x4f')]})[_0x2ef3('0x25')](function(_0x4c00d8){_0x547ada[_0x2ef3('0x54')]=_0x4c00d8;if(_0x3c9333[_0x2ef3('0x46')][_0x2ef3('0x55')]){_0x4710ca[_0x2ef3('0x64')]=[{'all':!![]}];}return db[_0x2ef3('0x97')][_0x2ef3('0x65')](_0x4710ca);})[_0x2ef3('0x25')](function(_0x522ff4){_0x547ada[_0x2ef3('0x56')]=_0x522ff4;return _0x547ada;});}})[_0x2ef3('0x25')](respondWithFilteredResult(_0x106902,_0x4710ca))['catch'](handleError(_0x106902,null));};exports['send']=function(_0x2d6293,_0xc3dcc4,_0x227bb4){var _0x22caa6,_0x457872={},_0x222c09;if(_0x2d6293['body']['to']){_0x222c09=_0x2d6293[_0x2ef3('0x5c')]['to'][_0x2ef3('0x99')](',')[0x0];}return db['MailAccount'][_0x2ef3('0x5d')]({'where':{'id':_0x2d6293[_0x2ef3('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x2ef3('0x9a'),'include':[{'model':db[_0x2ef3('0x89')],'as':_0x2ef3('0x9b'),'where':{'email':_0x222c09},'limit':0x1,'order':[[_0x2ef3('0x9c'),'DESC']]}]},{'model':db[_0x2ef3('0x59')],'as':'Smtp','raw':!![]}]})[_0x2ef3('0x25')](handleEntityNotFound(_0xc3dcc4,null))[_0x2ef3('0x25')](function(_0x8a5f07){if(_0x8a5f07){_0x22caa6=_0x8a5f07;if(_0x8a5f07[_0x2ef3('0x3e')]){if(_[_0x2ef3('0x9d')](_0x2d6293['body']['from'])){_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0x9e')]=util[_0x2ef3('0x98')](_0x2ef3('0x9f'),_0x8a5f07[_0x2ef3('0x3b')],_0x8a5f07['email']||_0x8a5f07[_0x2ef3('0x3e')]['user']);}if(_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xa0')]&&_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xa0')]['length']){for(var _0x214fa7=0x0;_0x214fa7<_0x2d6293['body'][_0x2ef3('0xa0')][_0x2ef3('0x5b')];_0x214fa7+=0x1){_0x2d6293['body'][_0x2ef3('0xa0')][_0x214fa7]={'filename':_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xa0')][_0x214fa7][_0x2ef3('0x3b')],'path':path[_0x2ef3('0xa1')](config[_0x2ef3('0xa2')],_0x2ef3('0xa3'),_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xa0')][_0x214fa7][_0x2ef3('0xa4')])};}}var _0x59c12a={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x77')])){if(_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x74')]){_0x59c12a[_0x2ef3('0xa5')]={'user':_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x71')],'pass':_0x8a5f07[_0x2ef3('0x3e')]['pass']};}_0x59c12a[_0x2ef3('0x75')]=_0x8a5f07['Smtp'][_0x2ef3('0x75')];_0x59c12a[_0x2ef3('0x76')]=_0x8a5f07[_0x2ef3('0x3e')]['port'];_0x59c12a['secure']=_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0xa6')];}else{_0x59c12a[_0x2ef3('0x77')]=_0x8a5f07[_0x2ef3('0x3e')]['service'];_0x59c12a[_0x2ef3('0xa5')]={'user':_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x71')],'pass':_0x8a5f07[_0x2ef3('0x3e')][_0x2ef3('0x79')]};}return respondWithRpcPromise(_0x2ef3('0xa7'),_0x2ef3('0xa8'),{'account':_0x59c12a,'message':_0x2d6293[_0x2ef3('0x5c')]});}else{throw new Error(_0x2ef3('0xa9'));}}})[_0x2ef3('0x25')](function(_0x1ceaf4){if(_0x1ceaf4){_0x457872=_0x1ceaf4;if(_0x22caa6[_0x2ef3('0x9a')]){if(_0x22caa6[_0x2ef3('0x9a')][_0x2ef3('0x9b')][_0x2ef3('0x5b')]){return _0x22caa6[_0x2ef3('0x9a')]['Contacts'][0x0];}else{return db[_0x2ef3('0x89')]['create'](_['defaults'](_0x2d6293[_0x2ef3('0x5c')],{'firstName':_0x2d6293[_0x2ef3('0x5c')]['to'],'email':_0x2d6293['body']['to'],'phone':_0x2d6293[_0x2ef3('0x5c')]['to'],'ListId':_0x22caa6[_0x2ef3('0x6d')]}));}}else{throw new Error(_0x2ef3('0xa9'));}}})['then'](function(_0x4f1875){if(_0x4f1875){var _0x3a16f4={'UserId':_0x2d6293[_0x2ef3('0x71')]['id'],'ContactId':_0x4f1875['id'],'MailAccountId':_0x22caa6['id'],'inReplyTo':_0x457872[_0x2ef3('0xaa')],'to':_0x2d6293['body']['from'],'cc':_0x2d6293['body']['cc'],'subject':_0x2d6293['body']['subject'],'attach':_0x2d6293['body'][_0x2ef3('0xab')],'firstMsgDirection':_0x2ef3('0xac'),'lastMsgAt':moment()[_0x2ef3('0x98')](_0x2ef3('0xad')),'lastMsgDirection':_0x2ef3('0xac'),'lastMsgBody':_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0x5c')],'Messages':[_[_0x2ef3('0x51')](_0x2d6293['body'],{'messageId':_0x457872[_0x2ef3('0xaa')],'sentAt':moment()[_0x2ef3('0x98')](_0x2ef3('0xad')),'read':!![],'MailAccountId':_0x22caa6['id'],'UserId':_0x2d6293['user']['id'],'ContactId':_0x4f1875['id']})]};if(_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xae')]){_0x3a16f4=_[_0x2ef3('0x51')](_0x3a16f4,_0x2d6293[_0x2ef3('0x5c')][_0x2ef3('0xae')]);}return db['MailInteraction'][_0x2ef3('0x62')](_0x3a16f4,{'include':[{'model':db[_0x2ef3('0x97')],'as':'Messages'}]});}})[_0x2ef3('0x25')](respondWithResult(_0xc3dcc4,null))[_0x2ef3('0x57')](handleError(_0xc3dcc4,null));};exports[_0x2ef3('0xaf')]=function(_0x4a9d2b,_0x1c8ede,_0x516084){return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x4a9d2b[_0x2ef3('0x58')]['id']},'include':[{'model':db[_0x2ef3('0x59')],'as':_0x2ef3('0x3e'),'raw':!![]}]})[_0x2ef3('0x25')](handleEntityNotFound(_0x1c8ede,null))[_0x2ef3('0x25')](function(_0x2dc4e1){if(_0x2dc4e1&&_0x2dc4e1['Smtp']){var _0x2b3237={'id':_0x2dc4e1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2dc4e1['Smtp'][_0x2ef3('0x77')]){_0x2b3237[_0x2ef3('0x77')]=_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x77')];}else{_0x2b3237['host']=_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x75')];_0x2b3237[_0x2ef3('0x76')]=_0x2dc4e1[_0x2ef3('0x3e')]['port'];_0x2b3237[_0x2ef3('0xa6')]=_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0xa6')];}if(_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x74')]){_0x2b3237[_0x2ef3('0xa5')]={'user':_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x71')],'pass':_0x2dc4e1[_0x2ef3('0x3e')][_0x2ef3('0x79')]};}return respondWithRpcPromise(_0x2ef3('0xb0'),_0x2ef3('0xaf'),{'account':_0x2b3237});}})[_0x2ef3('0x25')](respondWithResult(_0x1c8ede,null))['catch'](handleError(_0x1c8ede,null));};exports[_0x2ef3('0x37')]=function(_0x3808c9,_0x10483a){return db[_0x2ef3('0x40')][_0x2ef3('0x5d')]({'where':{'id':_0x3808c9[_0x2ef3('0x58')]['id']}})['then'](handleEntityNotFound(_0x10483a,null))[_0x2ef3('0x25')](function(_0x842bea){if(_0x842bea&&_0x842bea[_0x2ef3('0x77')]){throw new db[(_0x2ef3('0x22'))][(_0x2ef3('0x23'))](_0x2ef3('0xb1'));}return _0x842bea;})[_0x2ef3('0x25')](removeEntity(_0x10483a,null))[_0x2ef3('0x57')](handleError(_0x10483a,null));};exports[_0x2ef3('0xb2')]=function(_0x537da6,_0x25454f,_0x12fa8f){return db['MailAccount'][_0x2ef3('0x5d')]({'where':{'id':_0x537da6[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x25454f,null))[_0x2ef3('0x25')](function(_0x59b8d2){if(_0x59b8d2){return _0x59b8d2[_0x2ef3('0xb2')](_0x537da6[_0x2ef3('0x5c')][_0x2ef3('0x67')],_[_0x2ef3('0x88')](_0x537da6[_0x2ef3('0x5c')],[_0x2ef3('0x67'),'id'])||{})[_0x2ef3('0xb3')](function(_0x413489){for(var _0x1a9c32=0x0;_0x1a9c32<_0x537da6[_0x2ef3('0x5c')]['ids'][_0x2ef3('0x5b')];_0x1a9c32+=0x1){socket[_0x2ef3('0xb4')](_0x2ef3('0xb5'),{'UserId':_0x537da6[_0x2ef3('0x5c')]['ids'][_0x1a9c32],'MailAccountId':_0x537da6[_0x2ef3('0x58')]['id']});}return _0x413489;});}})[_0x2ef3('0x25')](respondWithResult(_0x25454f,null))['catch'](handleError(_0x25454f,null));};exports[_0x2ef3('0xb6')]=function(_0x5ac0a3,_0x2bc017,_0x57c13b){return db[_0x2ef3('0x40')]['find']({'where':{'id':_0x5ac0a3[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x2bc017,null))[_0x2ef3('0x25')](function(_0x194858){if(_0x194858){return _0x194858[_0x2ef3('0xb6')](_0x5ac0a3[_0x2ef3('0x46')][_0x2ef3('0x67')])['then'](function(){if(_[_0x2ef3('0xb7')](_0x5ac0a3[_0x2ef3('0x46')][_0x2ef3('0x67')])){for(var _0x15f58c=0x0;_0x15f58c<_0x5ac0a3[_0x2ef3('0x46')][_0x2ef3('0x67')][_0x2ef3('0x5b')];_0x15f58c+=0x1){socket[_0x2ef3('0xb4')](_0x2ef3('0xb8'),{'UserId':Number(_0x5ac0a3[_0x2ef3('0x46')][_0x2ef3('0x67')][_0x15f58c]),'MailAccountId':Number(_0x5ac0a3[_0x2ef3('0x58')]['id'])});}}else{socket[_0x2ef3('0xb4')](_0x2ef3('0xb8'),{'UserId':Number(_0x5ac0a3['query'][_0x2ef3('0x67')]),'MailAccountId':Number(_0x5ac0a3['params']['id'])});}});}})[_0x2ef3('0x25')](respondWithStatusCode(_0x2bc017,null))[_0x2ef3('0x57')](handleError(_0x2bc017,null));};exports[_0x2ef3('0xb9')]=function(_0x33c7b4,_0x17ba1,_0x5c40a6){var _0x15e8e2={};var _0x581066={};var _0x43f685;var _0x26e780;return db[_0x2ef3('0x40')]['findOne']({'where':{'id':_0x33c7b4[_0x2ef3('0x58')]['id']}})[_0x2ef3('0x25')](handleEntityNotFound(_0x17ba1,null))[_0x2ef3('0x25')](function(_0x5d8ff7){if(_0x5d8ff7){_0x43f685=_0x5d8ff7;_0x581066['model']=_[_0x2ef3('0x47')](db[_0x2ef3('0x8a')][_0x2ef3('0x41')]);_0x581066[_0x2ef3('0x46')]=_[_0x2ef3('0x47')](_0x33c7b4[_0x2ef3('0x46')]);_0x581066['filters']=_[_0x2ef3('0x49')](_0x581066[_0x2ef3('0x44')],_0x581066[_0x2ef3('0x46')]);_0x15e8e2[_0x2ef3('0x4a')]=_['intersection'](_0x581066[_0x2ef3('0x44')],qs[_0x2ef3('0x4b')](_0x33c7b4['query'][_0x2ef3('0x4b')]));_0x15e8e2['attributes']=_0x15e8e2[_0x2ef3('0x4a')][_0x2ef3('0x5b')]?_0x15e8e2['attributes']:_0x581066['model'];_0x15e8e2[_0x2ef3('0x63')]=qs[_0x2ef3('0x4e')](_0x33c7b4[_0x2ef3('0x46')]['sort']);_0x15e8e2[_0x2ef3('0x4f')]=qs['filters'](_['pick'](_0x33c7b4[_0x2ef3('0x46')],_0x581066['filters']));if(_0x33c7b4[_0x2ef3('0x46')][_0x2ef3('0x52')]){_0x15e8e2[_0x2ef3('0x4f')]=_[_0x2ef3('0x51')](_0x15e8e2[_0x2ef3('0x4f')],{'$or':_[_0x2ef3('0x45')](_0x15e8e2[_0x2ef3('0x4a')],function(_0x5e698b){var _0x2c3ce5={};_0x2c3ce5[_0x5e698b]={'$like':'%'+_0x33c7b4[_0x2ef3('0x46')][_0x2ef3('0x52')]+'%'};return _0x2c3ce5;})});}_0x15e8e2=_['merge']({},_0x15e8e2,_0x33c7b4[_0x2ef3('0x53')]);return _0x43f685[_0x2ef3('0xb9')](_0x15e8e2);}})[_0x2ef3('0x25')](function(_0x2e6750){if(_0x2e6750){_0x26e780=_0x2e6750['length'];if(!_0x33c7b4[_0x2ef3('0x46')][_0x2ef3('0x4c')](_0x2ef3('0x4d'))){_0x15e8e2[_0x2ef3('0x31')]=qs[_0x2ef3('0x31')](_0x33c7b4['query'][_0x2ef3('0x31')]);_0x15e8e2[_0x2ef3('0x30')]=qs[_0x2ef3('0x30')](_0x33c7b4[_0x2ef3('0x46')]['offset']);}return _0x43f685[_0x2ef3('0xb9')](_0x15e8e2);}})['then'](function(_0x571144){if(_0x571144){return _0x571144?{'count':_0x26e780,'rows':_0x571144}:null;}})[_0x2ef3('0x25')](respondWithResult(_0x17ba1,null))['catch'](handleError(_0x17ba1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3a8e58d..6168892 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 _0x4484=['hasOwnProperty','exports','save','update','remove','emit'];(function(_0x27a1e0,_0x3ff2cb){var _0x1ca624=function(_0x435802){while(--_0x435802){_0x27a1e0['push'](_0x27a1e0['shift']());}};_0x1ca624(++_0x3ff2cb);}(_0x4484,0xf2));var _0x4448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4484[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4448('0x0'),'afterUpdate':_0x4448('0x1'),'afterDestroy':_0x4448('0x2')};function emitEvent(_0x45e18c){return function(_0x151ddf,_0x19f471,_0x279cbc){MailAccountEvents[_0x4448('0x3')](_0x45e18c+':'+_0x151ddf['id'],_0x151ddf);MailAccountEvents[_0x4448('0x3')](_0x45e18c,_0x151ddf);_0x279cbc(null);};}for(var e in events){if(events[_0x4448('0x4')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x4448('0x5')]=MailAccountEvents; \ No newline at end of file +var _0xdfa0=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x53db29,_0x345447){var _0x3e854a=function(_0x26d8db){while(--_0x26d8db){_0x53db29['push'](_0x53db29['shift']());}};_0x3e854a(++_0x345447);}(_0xdfa0,0x11d));var _0x0dfa=function(_0xbc3ff3,_0x1f866a){_0xbc3ff3=_0xbc3ff3-0x0;var _0x2f375b=_0xdfa0[_0xbc3ff3];return _0x2f375b;};'use strict';var EventEmitter=require(_0x0dfa('0x0'));var MailAccount=require(_0x0dfa('0x1'))['db'][_0x0dfa('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x0dfa('0x3')](0x0);var events={'afterCreate':_0x0dfa('0x4'),'afterUpdate':_0x0dfa('0x5'),'afterDestroy':_0x0dfa('0x6')};function emitEvent(_0x3e08e0){return function(_0x44fac9,_0x50bf0b,_0x24183d){MailAccountEvents[_0x0dfa('0x7')](_0x3e08e0+':'+_0x44fac9['id'],_0x44fac9);MailAccountEvents['emit'](_0x3e08e0,_0x44fac9);_0x24183d(null);};}for(var e in events){if(events[_0x0dfa('0x8')](e)){var event=events[e];MailAccount[_0x0dfa('0x9')](e,emitEvent(event));}}module[_0x0dfa('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f6a1d75..077110c 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 _0x1dcf=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x1bb536,_0x23501c){var _0x12e57b=function(_0x954ffa){while(--_0x954ffa){_0x1bb536['push'](_0x1bb536['shift']());}};_0x12e57b(++_0x23501c);}(_0x1dcf,0x9c));var _0xf1dc=function(_0x3d529d,_0xa2e33c){_0x3d529d=_0x3d529d-0x0;var _0x334f87=_0x1dcf[_0x3d529d];return _0x334f87;};'use strict';var _=require(_0xf1dc('0x0'));var util=require(_0xf1dc('0x1'));var logger=require(_0xf1dc('0x2'))(_0xf1dc('0x3'));var moment=require(_0xf1dc('0x4'));var BPromise=require(_0xf1dc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1dc('0x6'));var rimraf=require(_0xf1dc('0x7'));var config=require('../../config/environment');var attributes=require(_0xf1dc('0x8'));module[_0xf1dc('0x9')]=function(_0x21674c,_0x134567){return _0x21674c[_0xf1dc('0xa')](_0xf1dc('0xb'),attributes,{'tableName':_0xf1dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9386=['MailAccount','mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports'];(function(_0x52f481,_0x42861c){var _0xe9cfc2=function(_0x2c27cf){while(--_0x2c27cf){_0x52f481['push'](_0x52f481['shift']());}};_0xe9cfc2(++_0x42861c);}(_0x9386,0x17b));var _0x6938=function(_0x1409f9,_0x4e7dbc){_0x1409f9=_0x1409f9-0x0;var _0x17d0a8=_0x9386[_0x1409f9];return _0x17d0a8;};'use strict';var _=require(_0x6938('0x0'));var util=require('util');var logger=require(_0x6938('0x1'))(_0x6938('0x2'));var moment=require(_0x6938('0x3'));var BPromise=require(_0x6938('0x4'));var rp=require(_0x6938('0x5'));var fs=require('fs');var path=require(_0x6938('0x6'));var rimraf=require(_0x6938('0x7'));var config=require(_0x6938('0x8'));var attributes=require(_0x6938('0x9'));module[_0x6938('0xa')]=function(_0x1512b0,_0x1f8944){return _0x1512b0['define'](_0x6938('0xb'),attributes,{'tableName':_0x6938('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 7c8fd3f..0f8171a 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 _0x453b=['includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','get','Applications','applications','orderBy','push','length','close','*,*,*,*','create','List\x20not\x20found','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','interaction','created','contact','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','name','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','GetMailAccount','options','raw','where','attributes','include','map','model','MailAccount','find','ShowMailAccount','stringify','catch','NotifyMailAccount','difference','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x3e6467,_0xd48e71){var _0x18fb37=function(_0x361969){while(--_0x361969){_0x3e6467['push'](_0x3e6467['shift']());}};_0x18fb37(++_0xd48e71);}(_0x453b,0x164));var _0xb453=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x453b[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require(_0xb453('0x0'));var util=require(_0xb453('0x1'));var moment=require(_0xb453('0x2'));var BPromise=require(_0xb453('0x3'));var rs=require(_0xb453('0x4'));var fs=require('fs');var Redis=require(_0xb453('0x5'));var db=require(_0xb453('0x6'))['db'];var utils=require(_0xb453('0x7'));var logger=require(_0xb453('0x8'))(_0xb453('0x9'));var config=require(_0xb453('0xa'));var jayson=require(_0xb453('0xb'));var client=jayson[_0xb453('0xc')][_0xb453('0xd')]({'port':0x232c});config[_0xb453('0xe')]=_[_0xb453('0xf')](config['redis'],{'host':_0xb453('0x10'),'port':0x18eb});var socket=require(_0xb453('0x11'))(new Redis(config['redis']));require(_0xb453('0x12'))['register'](socket);function respondWithRpcPromise(_0x894303,_0x2aa50b,_0x446cd3){return new BPromise(function(_0x1ec172,_0x4ef367){return client[_0xb453('0x13')](_0x894303,_0x446cd3)[_0xb453('0x14')](function(_0x1ac734){logger[_0xb453('0x15')](_0xb453('0x16'),_0x2aa50b,_0xb453('0x17'));logger[_0xb453('0x18')](_0xb453('0x19'),_0x2aa50b,_0xb453('0x17'),JSON['stringify'](_0x1ac734));if(_0x1ac734['error']){if(_0x1ac734['error'][_0xb453('0x1a')]===0x1f4){logger['error'](_0xb453('0x16'),_0x2aa50b,_0x1ac734[_0xb453('0x1b')][_0xb453('0x1c')]);return _0x4ef367(_0x1ac734['error']['message']);}logger[_0xb453('0x1b')](_0xb453('0x16'),_0x2aa50b,_0x1ac734[_0xb453('0x1b')][_0xb453('0x1c')]);return _0x1ec172(_0x1ac734[_0xb453('0x1b')][_0xb453('0x1c')]);}else{logger[_0xb453('0x15')](_0xb453('0x16'),_0x2aa50b,_0xb453('0x17'));_0x1ec172(_0x1ac734['result']['message']);}})['catch'](function(_0x5b5776){logger[_0xb453('0x1b')](_0xb453('0x16'),_0x2aa50b,_0x5b5776);_0x4ef367(_0x5b5776);});});}exports[_0xb453('0x1d')]=function(_0x3066cf){var _0x24e0f1=this;return new Promise(function(_0x8b6911,_0x590283){return db['MailAccount']['findAll']({'raw':_0x3066cf[_0xb453('0x1e')]?_0x3066cf['options'][_0xb453('0x1f')]===undefined?!![]:![]:!![],'where':_0x3066cf[_0xb453('0x1e')]?_0x3066cf[_0xb453('0x1e')][_0xb453('0x20')]||null:null,'attributes':_0x3066cf[_0xb453('0x1e')]?_0x3066cf[_0xb453('0x1e')][_0xb453('0x21')]||null:null,'limit':_0x3066cf[_0xb453('0x1e')]?_0x3066cf[_0xb453('0x1e')]['limit']||null:null,'include':_0x3066cf[_0xb453('0x1e')]?_0x3066cf[_0xb453('0x1e')][_0xb453('0x22')]?_[_0xb453('0x23')](_0x3066cf[_0xb453('0x1e')][_0xb453('0x22')],function(_0x31592f){return{'model':db[_0x31592f[_0xb453('0x24')]],'as':_0x31592f['as'],'attributes':_0x31592f[_0xb453('0x21')],'include':_0x31592f[_0xb453('0x22')]?_[_0xb453('0x23')](_0x31592f[_0xb453('0x22')],function(_0x3e6631){return{'model':db[_0x3e6631['model']],'as':_0x3e6631['as'],'attributes':_0x3e6631[_0xb453('0x21')],'include':_0x3e6631[_0xb453('0x22')]?_[_0xb453('0x23')](_0x3e6631[_0xb453('0x22')],function(_0x430ba4){return{'model':db[_0x430ba4[_0xb453('0x24')]],'as':_0x430ba4['as'],'attributes':_0x430ba4[_0xb453('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb453('0x14')](function(_0x1a6c72){logger['info'](_0xb453('0x1d'),_0x3066cf);logger[_0xb453('0x18')](_0xb453('0x1d'),_0x3066cf,JSON['stringify'](_0x1a6c72));_0x8b6911(_0x1a6c72);})['catch'](function(_0x1613d8){logger[_0xb453('0x1b')](_0xb453('0x1d'),_0x1613d8[_0xb453('0x1c')],_0x3066cf);_0x590283(_0x24e0f1['error'](0x1f4,_0x1613d8['message']));});});};exports['ShowMailAccount']=function(_0x3a4054){var _0x5c78a5=this;return new Promise(function(_0x5030f8,_0x397e23){return db[_0xb453('0x25')][_0xb453('0x26')]({'raw':_0x3a4054[_0xb453('0x1e')]?_0x3a4054[_0xb453('0x1e')][_0xb453('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a4054[_0xb453('0x1e')]?_0x3a4054[_0xb453('0x1e')]['where']||null:null,'attributes':_0x3a4054['options']?_0x3a4054[_0xb453('0x1e')]['attributes']||null:null,'include':_0x3a4054['options']?_0x3a4054[_0xb453('0x1e')][_0xb453('0x22')]?_['map'](_0x3a4054[_0xb453('0x1e')][_0xb453('0x22')],function(_0x474484){return{'model':db[_0x474484[_0xb453('0x24')]],'as':_0x474484['as'],'attributes':_0x474484[_0xb453('0x21')],'include':_0x474484['include']?_['map'](_0x474484['include'],function(_0x40bfa3){return{'model':db[_0x40bfa3[_0xb453('0x24')]],'as':_0x40bfa3['as'],'attributes':_0x40bfa3[_0xb453('0x21')],'include':_0x40bfa3['include']?_[_0xb453('0x23')](_0x40bfa3['include'],function(_0x246843){return{'model':db[_0x246843['model']],'as':_0x246843['as'],'attributes':_0x246843[_0xb453('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb453('0x14')](function(_0x20290c){logger[_0xb453('0x15')](_0xb453('0x27'),_0x3a4054);logger[_0xb453('0x18')](_0xb453('0x27'),_0x3a4054,JSON[_0xb453('0x28')](_0x20290c));_0x5030f8(_0x20290c);})[_0xb453('0x29')](function(_0x413b6e){logger['error']('ShowMailAccount',_0x413b6e[_0xb453('0x1c')],_0x3a4054);_0x397e23(_0x5c78a5[_0xb453('0x1b')](0x1f4,_0x413b6e[_0xb453('0x1c')]));});});};exports[_0xb453('0x2a')]=function(_0x559d5f){var _0x49a4f2=this;return new Promise(function(_0x499cdc,_0x37b51f){var _0x1e79c6={'body':_0x559d5f['body'],'channel':'mail'};var _0x1a1d4e=_[_0xb453('0x2b')](_['keys'](db[_0xb453('0x2c')][_0xb453('0x2d')]),[_0xb453('0x2e'),_0xb453('0x2f'),_0xb453('0x30'),_0xb453('0x31')]);var _0x4f062c=![];if(_0x559d5f['body']['id']){delete _0x559d5f[_0xb453('0x32')]['id'];}if(_[_0xb453('0x33')](_0x559d5f[_0xb453('0x32')][_0xb453('0x34')])){return _0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0xb453('0x35')));}if(_[_0xb453('0x33')](_0x559d5f[_0xb453('0x32')][_0xb453('0x32')])||_0x559d5f[_0xb453('0x32')][_0xb453('0x32')]===''){return _0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0xb453('0x36')));}if(_['isNil'](_0x559d5f[_0xb453('0x32')]['mapKey'])){return _0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0xb453('0x37')+_0x1a1d4e));}if(!_[_0xb453('0x38')](_0x1a1d4e,_0x559d5f[_0xb453('0x32')][_0xb453('0x39')])){return _0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0xb453('0x3a')+_0x1a1d4e));}var _0x35b3aa={};_0x35b3aa[_0x559d5f['body'][_0xb453('0x39')]]=_0x559d5f[_0xb453('0x32')][_0xb453('0x34')];return db[_0xb453('0x25')][_0xb453('0x26')]({'where':{'id':_0x559d5f[_0xb453('0x3b')]['id']},'include':[{'model':db[_0xb453('0x3c')],'as':_0xb453('0x3d'),'include':[{'model':db[_0xb453('0x2c')],'as':_0xb453('0x3e'),'where':_0x35b3aa,'limit':0x1,'order':[['updatedAt',_0xb453('0x3f')]]}]},{'model':db[_0xb453('0x40')],'as':'Applications'},{'model':db[_0xb453('0x41')],'as':_0xb453('0x42')}]})[_0xb453('0x14')](function(_0x5da822){if(_0x5da822&&_0x5da822[_0xb453('0x3d')]){var _0x53cb5b=_0x5da822[_0xb453('0x43')]({'plain':!![]});_0x1e79c6[_0xb453('0x3b')]=_['omit'](_0x53cb5b,[_0xb453('0x44'),'List']);_0x1e79c6[_0xb453('0x45')]=_0x53cb5b[_0xb453('0x44')];_0x1e79c6['list']=_0x53cb5b[_0xb453('0x3d')];_0x1e79c6[_0xb453('0x45')]=_[_0xb453('0x46')](_0x1e79c6[_0xb453('0x45')],['priority'],['asc']);if(_0x1e79c6[_0xb453('0x3b')]&&_0x1e79c6['account']['autoclose']){_0x1e79c6[_0xb453('0x45')][_0xb453('0x47')]({'id':0x0,'priority':_0x1e79c6['applications'][_0xb453('0x48')]+0x1,'app':_0xb453('0x49'),'appdata':'autoclose','interval':_0xb453('0x4a')});}if(_0x1e79c6['account']['Applications']){delete _0x1e79c6['account'][_0xb453('0x44')];}if(_0x1e79c6[_0xb453('0x3b')][_0xb453('0x3d')]){delete _0x1e79c6['account'][_0xb453('0x3d')];}if(_0x53cb5b['List'][_0xb453('0x3e')][_0xb453('0x48')]){return _0x53cb5b['List'][_0xb453('0x3e')][0x0];}var _0x5c5d6a=_[_0xb453('0xf')](_0x559d5f[_0xb453('0x32')],{'firstName':_0x559d5f['body'][_0xb453('0x34')],'ListId':_0x53cb5b[_0xb453('0x31')]});_0x5c5d6a[_0x559d5f[_0xb453('0x32')]['mapKey']]=_0x559d5f[_0xb453('0x32')]['from'];return db['CmContact'][_0xb453('0x4b')](_0x5c5d6a);}else{throw new Error(_0xb453('0x4c'));}})['then'](function(_0x7d5092){_0x1e79c6['contact']=_0x7d5092;if(_0x7d5092){if(!_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x4d')]){_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x4d')]=rs['generate']()+'\x20'+_0x559d5f['body'][_0xb453('0x1c')]['from'];}var _0x4149b9={'ContactId':_0x7d5092['id'],'MailAccountId':_0x559d5f['account']['id'],'inReplyTo':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['messageId'],'to':_0x559d5f['body'][_0xb453('0x1c')][_0xb453('0x34')],'cc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['cc'],'subject':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['subject'],'attach':_0x559d5f['body']['message'][_0xb453('0x4e')],'lastMsgAt':moment()[_0xb453('0x4f')](_0xb453('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x559d5f[_0xb453('0x32')][_0xb453('0x32')]};return db['MailInteraction'][_0xb453('0x26')]({'where':{'closed':![],'MailAccountId':_0x559d5f['account']['id']},'include':[{'model':db[_0xb453('0x51')],'as':_0xb453('0x52'),'attributes':[_0xb453('0x4d')],'where':{'messageId':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x53')]}}]})[_0xb453('0x14')](function(_0x53468a){if(_0x53468a){return[_0x53468a,![]];}return db['MailInteraction'][_0xb453('0x4b')](_0x4149b9)[_0xb453('0x14')](function(_0x421eb1){return[_0x421eb1,!![]];});});}else{throw new Error(_0xb453('0x54'));}})[_0xb453('0x55')](function(_0xae6425,_0x4562c0){if(_0xae6425){_0x4f062c=_0x4562c0;if(!_0x4562c0){return _0xae6425[_0xb453('0x56')]({'inReplyTo':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x4d')],'to':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['from'],'cc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['cc'],'subject':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x57')],'attach':_0xae6425[_0xb453('0x4e')]?_0xae6425['attach']:_0x559d5f[_0xb453('0x32')]['message'][_0xb453('0x4e')],'substatus':null,'substatusAt':moment()[_0xb453('0x4f')](_0xb453('0x50')),'lastMsgAt':moment()[_0xb453('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x559d5f[_0xb453('0x32')][_0xb453('0x32')]});}else{return _0xae6425;}}})[_0xb453('0x14')](function(_0x2308c0){_0x1e79c6[_0xb453('0x58')]=_0x2308c0[_0xb453('0x43')]({'plain':!![]});_0x1e79c6[_0xb453('0x58')][_0xb453('0x59')]=_0x4f062c;return db[_0xb453('0x51')][_0xb453('0x4b')]({'body':_0x559d5f['body'][_0xb453('0x32')],'MailAccountId':_0x559d5f[_0xb453('0x3b')]['id'],'MailInteractionId':_0x2308c0['id'],'direction':'in','ContactId':_0x1e79c6[_0xb453('0x5a')]['id'],'messageId':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x4d')],'from':_0x559d5f['body'][_0xb453('0x1c')][_0xb453('0x34')],'to':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['to'],'cc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')]['cc'],'subject':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x57')],'attach':_0x559d5f[_0xb453('0x32')]['message'][_0xb453('0x4e')],'Attachments':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x5b')],'originTo':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x5c')],'originCc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x5d')],'bcc':_0x559d5f[_0xb453('0x32')][_0xb453('0x1c')][_0xb453('0x5e')]},{'include':[{'model':db[_0xb453('0x5f')],'as':_0xb453('0x60')}]});})[_0xb453('0x14')](function(_0x4f32ff){_0x1e79c6[_0xb453('0x1c')]=_0x4f32ff;if(_0x1e79c6[_0xb453('0x58')][_0xb453('0x61')]){return db['User'][_0xb453('0x26')]({'attributes':['id',_0xb453('0x62')],'where':{'id':_0x1e79c6[_0xb453('0x58')]['UserId']}})[_0xb453('0x14')](function(_0x593cd4){if(_0x593cd4){_0x1e79c6[_0xb453('0x45')][_0xb453('0x63')]({'id':0x0,'priority':0x0,'app':_0xb453('0x64'),'appdata':_0x593cd4[_0xb453('0x62')]+','+(_0x1e79c6[_0xb453('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0xb453('0x4a')});}return respondWithRpcPromise(_0xb453('0x65'),'startRouting',_0x1e79c6);});}return respondWithRpcPromise(_0xb453('0x65'),_0xb453('0x66'),_0x1e79c6);})['then'](function(_0x91e752){_0x499cdc(_0x91e752);})['catch'](function(_0x5d7ca3){_0x37b51f(_0x49a4f2[_0xb453('0x1b')](0x1f4,_0x5d7ca3[_0xb453('0x1c')]));});});}; \ No newline at end of file +var _0x5bc5=['MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','raw','options','attributes','limit','include','map','model','debug','ShowMailAccount','find','where','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','get','omit','applications','list','orderBy','priority','asc','autoclose','length','close','Contacts','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','interaction','created','attachments','bcc','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailAccount.socket','register','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x5bc5,0xb2));var _0x55bc=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x5bc5[_0x540dcb];return _0x49353c;};'use strict';var _=require(_0x55bc('0x0'));var util=require(_0x55bc('0x1'));var moment=require(_0x55bc('0x2'));var BPromise=require(_0x55bc('0x3'));var rs=require(_0x55bc('0x4'));var fs=require('fs');var Redis=require(_0x55bc('0x5'));var db=require(_0x55bc('0x6'))['db'];var utils=require(_0x55bc('0x7'));var logger=require(_0x55bc('0x8'))(_0x55bc('0x9'));var config=require(_0x55bc('0xa'));var jayson=require(_0x55bc('0xb'));var client=jayson[_0x55bc('0xc')]['http']({'port':0x232c});config[_0x55bc('0xd')]=_[_0x55bc('0xe')](config[_0x55bc('0xd')],{'host':_0x55bc('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55bc('0xd')]));require(_0x55bc('0x10'))[_0x55bc('0x11')](socket);function respondWithRpcPromise(_0x3114d0,_0x3548fb,_0xe07566){return new BPromise(function(_0x72a619,_0x718891){return client['request'](_0x3114d0,_0xe07566)[_0x55bc('0x12')](function(_0xbae62d){logger[_0x55bc('0x13')]('MailAccount,\x20%s,\x20%s',_0x3548fb,_0x55bc('0x14'));logger['debug'](_0x55bc('0x15'),_0x3548fb,_0x55bc('0x14'),JSON[_0x55bc('0x16')](_0xbae62d));if(_0xbae62d['error']){if(_0xbae62d[_0x55bc('0x17')]['code']===0x1f4){logger[_0x55bc('0x17')](_0x55bc('0x18'),_0x3548fb,_0xbae62d[_0x55bc('0x17')]['message']);return _0x718891(_0xbae62d[_0x55bc('0x17')][_0x55bc('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3548fb,_0xbae62d[_0x55bc('0x17')]['message']);return _0x72a619(_0xbae62d['error'][_0x55bc('0x19')]);}else{logger[_0x55bc('0x13')](_0x55bc('0x18'),_0x3548fb,'request\x20sent');_0x72a619(_0xbae62d[_0x55bc('0x1a')][_0x55bc('0x19')]);}})[_0x55bc('0x1b')](function(_0x5714f5){logger[_0x55bc('0x17')]('MailAccount,\x20%s,\x20%s',_0x3548fb,_0x5714f5);_0x718891(_0x5714f5);});});}exports[_0x55bc('0x1c')]=function(_0x4a4d0d){var _0x53f103=this;return new Promise(function(_0x1cf770,_0x390af6){return db[_0x55bc('0x1d')]['findAll']({'raw':_0x4a4d0d['options']?_0x4a4d0d['options'][_0x55bc('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a4d0d[_0x55bc('0x1f')]?_0x4a4d0d['options']['where']||null:null,'attributes':_0x4a4d0d[_0x55bc('0x1f')]?_0x4a4d0d[_0x55bc('0x1f')][_0x55bc('0x20')]||null:null,'limit':_0x4a4d0d[_0x55bc('0x1f')]?_0x4a4d0d['options'][_0x55bc('0x21')]||null:null,'include':_0x4a4d0d['options']?_0x4a4d0d['options'][_0x55bc('0x22')]?_[_0x55bc('0x23')](_0x4a4d0d[_0x55bc('0x1f')][_0x55bc('0x22')],function(_0x293bee){return{'model':db[_0x293bee['model']],'as':_0x293bee['as'],'attributes':_0x293bee[_0x55bc('0x20')],'include':_0x293bee[_0x55bc('0x22')]?_[_0x55bc('0x23')](_0x293bee[_0x55bc('0x22')],function(_0x2d1735){return{'model':db[_0x2d1735[_0x55bc('0x24')]],'as':_0x2d1735['as'],'attributes':_0x2d1735['attributes'],'include':_0x2d1735[_0x55bc('0x22')]?_[_0x55bc('0x23')](_0x2d1735[_0x55bc('0x22')],function(_0x2ddee7){return{'model':db[_0x2ddee7[_0x55bc('0x24')]],'as':_0x2ddee7['as'],'attributes':_0x2ddee7[_0x55bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x55bc('0x12')](function(_0x29cf97){logger[_0x55bc('0x13')](_0x55bc('0x1c'),_0x4a4d0d);logger[_0x55bc('0x25')](_0x55bc('0x1c'),_0x4a4d0d,JSON['stringify'](_0x29cf97));_0x1cf770(_0x29cf97);})[_0x55bc('0x1b')](function(_0x1a6f6a){logger[_0x55bc('0x17')](_0x55bc('0x1c'),_0x1a6f6a[_0x55bc('0x19')],_0x4a4d0d);_0x390af6(_0x53f103['error'](0x1f4,_0x1a6f6a[_0x55bc('0x19')]));});});};exports[_0x55bc('0x26')]=function(_0x3e4c8d){var _0x206b54=this;return new Promise(function(_0x419bc7,_0x3e35e7){return db[_0x55bc('0x1d')][_0x55bc('0x27')]({'raw':_0x3e4c8d[_0x55bc('0x1f')]?_0x3e4c8d['options'][_0x55bc('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e4c8d[_0x55bc('0x1f')]?_0x3e4c8d[_0x55bc('0x1f')][_0x55bc('0x28')]||null:null,'attributes':_0x3e4c8d[_0x55bc('0x1f')]?_0x3e4c8d[_0x55bc('0x1f')][_0x55bc('0x20')]||null:null,'include':_0x3e4c8d['options']?_0x3e4c8d[_0x55bc('0x1f')][_0x55bc('0x22')]?_['map'](_0x3e4c8d[_0x55bc('0x1f')][_0x55bc('0x22')],function(_0x366378){return{'model':db[_0x366378[_0x55bc('0x24')]],'as':_0x366378['as'],'attributes':_0x366378[_0x55bc('0x20')],'include':_0x366378['include']?_['map'](_0x366378[_0x55bc('0x22')],function(_0xe5e90c){return{'model':db[_0xe5e90c[_0x55bc('0x24')]],'as':_0xe5e90c['as'],'attributes':_0xe5e90c[_0x55bc('0x20')],'include':_0xe5e90c[_0x55bc('0x22')]?_[_0x55bc('0x23')](_0xe5e90c[_0x55bc('0x22')],function(_0x38d0f9){return{'model':db[_0x38d0f9['model']],'as':_0x38d0f9['as'],'attributes':_0x38d0f9[_0x55bc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x55bc('0x12')](function(_0x397b77){logger['info']('ShowMailAccount',_0x3e4c8d);logger[_0x55bc('0x25')](_0x55bc('0x26'),_0x3e4c8d,JSON[_0x55bc('0x16')](_0x397b77));_0x419bc7(_0x397b77);})[_0x55bc('0x1b')](function(_0x4c1e8e){logger[_0x55bc('0x17')](_0x55bc('0x26'),_0x4c1e8e[_0x55bc('0x19')],_0x3e4c8d);_0x3e35e7(_0x206b54[_0x55bc('0x17')](0x1f4,_0x4c1e8e[_0x55bc('0x19')]));});});};exports[_0x55bc('0x29')]=function(_0x334e24){var _0x3e5b7c=this;return new Promise(function(_0x5ebce8,_0x339704){var _0xc3be10={'body':_0x334e24[_0x55bc('0x2a')],'channel':_0x55bc('0x2b')};var _0x488b7b=_[_0x55bc('0x2c')](_[_0x55bc('0x2d')](db[_0x55bc('0x2e')]['rawAttributes']),[_0x55bc('0x2f'),_0x55bc('0x30'),'CompanyId',_0x55bc('0x31')]);var _0x464f05=![];if(_0x334e24[_0x55bc('0x2a')]['id']){delete _0x334e24[_0x55bc('0x2a')]['id'];}if(_[_0x55bc('0x32')](_0x334e24[_0x55bc('0x2a')][_0x55bc('0x33')])){return _0x339704(_0x3e5b7c['error'](0x1f4,_0x55bc('0x34')));}if(_[_0x55bc('0x32')](_0x334e24[_0x55bc('0x2a')]['body'])||_0x334e24[_0x55bc('0x2a')][_0x55bc('0x2a')]===''){return _0x339704(_0x3e5b7c[_0x55bc('0x17')](0x1f4,_0x55bc('0x35')));}if(_['isNil'](_0x334e24[_0x55bc('0x2a')]['mapKey'])){return _0x339704(_0x3e5b7c['error'](0x1f4,_0x55bc('0x36')+_0x488b7b));}if(!_['includes'](_0x488b7b,_0x334e24[_0x55bc('0x2a')][_0x55bc('0x37')])){return _0x339704(_0x3e5b7c[_0x55bc('0x17')](0x1f4,_0x55bc('0x38')+_0x488b7b));}var _0x5f361d={};_0x5f361d[_0x334e24['body']['mapKey']]=_0x334e24['body'][_0x55bc('0x33')];return db[_0x55bc('0x1d')]['find']({'where':{'id':_0x334e24[_0x55bc('0x39')]['id']},'include':[{'model':db[_0x55bc('0x3a')],'as':_0x55bc('0x3b'),'include':[{'model':db[_0x55bc('0x2e')],'as':'Contacts','where':_0x5f361d,'limit':0x1,'order':[[_0x55bc('0x30'),_0x55bc('0x3c')]]}]},{'model':db[_0x55bc('0x3d')],'as':_0x55bc('0x3e')},{'model':db[_0x55bc('0x3f')],'as':'Smtp'}]})[_0x55bc('0x12')](function(_0x25ee24){if(_0x25ee24&&_0x25ee24[_0x55bc('0x3b')]){var _0x308f2c=_0x25ee24[_0x55bc('0x40')]({'plain':!![]});_0xc3be10[_0x55bc('0x39')]=_[_0x55bc('0x41')](_0x308f2c,['Applications',_0x55bc('0x3b')]);_0xc3be10[_0x55bc('0x42')]=_0x308f2c[_0x55bc('0x3e')];_0xc3be10[_0x55bc('0x43')]=_0x308f2c[_0x55bc('0x3b')];_0xc3be10[_0x55bc('0x42')]=_[_0x55bc('0x44')](_0xc3be10[_0x55bc('0x42')],[_0x55bc('0x45')],[_0x55bc('0x46')]);if(_0xc3be10[_0x55bc('0x39')]&&_0xc3be10[_0x55bc('0x39')][_0x55bc('0x47')]){_0xc3be10[_0x55bc('0x42')]['push']({'id':0x0,'priority':_0xc3be10['applications'][_0x55bc('0x48')]+0x1,'app':_0x55bc('0x49'),'appdata':_0x55bc('0x47'),'interval':'*,*,*,*'});}if(_0xc3be10[_0x55bc('0x39')]['Applications']){delete _0xc3be10[_0x55bc('0x39')]['Applications'];}if(_0xc3be10[_0x55bc('0x39')]['List']){delete _0xc3be10[_0x55bc('0x39')][_0x55bc('0x3b')];}if(_0x308f2c[_0x55bc('0x3b')]['Contacts'][_0x55bc('0x48')]){return _0x308f2c[_0x55bc('0x3b')][_0x55bc('0x4a')][0x0];}var _0x38c402=_[_0x55bc('0xe')](_0x334e24['body'],{'firstName':_0x334e24[_0x55bc('0x2a')]['from'],'ListId':_0x308f2c[_0x55bc('0x31')]});_0x38c402[_0x334e24[_0x55bc('0x2a')][_0x55bc('0x37')]]=_0x334e24[_0x55bc('0x2a')][_0x55bc('0x33')];return db[_0x55bc('0x2e')][_0x55bc('0x4b')](_0x38c402);}else{throw new Error(_0x55bc('0x4c'));}})[_0x55bc('0x12')](function(_0x189635){_0xc3be10[_0x55bc('0x4d')]=_0x189635;if(_0x189635){if(!_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x4e')]){_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x4e')]=rs['generate']()+'\x20'+_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x33')];}var _0x40899c={'ContactId':_0x189635['id'],'MailAccountId':_0x334e24[_0x55bc('0x39')]['id'],'inReplyTo':_0x334e24[_0x55bc('0x2a')]['message']['messageId'],'to':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x33')],'cc':_0x334e24['body'][_0x55bc('0x19')]['cc'],'subject':_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x4f')],'attach':_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x50')],'lastMsgAt':moment()[_0x55bc('0x51')](_0x55bc('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x334e24['body'][_0x55bc('0x2a')]};return db[_0x55bc('0x53')][_0x55bc('0x27')]({'where':{'closed':![],'MailAccountId':_0x334e24[_0x55bc('0x39')]['id']},'include':[{'model':db[_0x55bc('0x54')],'as':_0x55bc('0x55'),'attributes':[_0x55bc('0x4e')],'where':{'messageId':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x56')]}}]})[_0x55bc('0x12')](function(_0x3ba01e){if(_0x3ba01e){return[_0x3ba01e,![]];}return db['MailInteraction'][_0x55bc('0x4b')](_0x40899c)['then'](function(_0x55b8e1){return[_0x55b8e1,!![]];});});}else{throw new Error(_0x55bc('0x57'));}})['spread'](function(_0x500838,_0x2e962e){if(_0x500838){_0x464f05=_0x2e962e;if(!_0x2e962e){return _0x500838[_0x55bc('0x58')]({'inReplyTo':_0x334e24['body'][_0x55bc('0x19')][_0x55bc('0x4e')],'to':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x33')],'cc':_0x334e24[_0x55bc('0x2a')]['message']['cc'],'subject':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x4f')],'attach':_0x500838[_0x55bc('0x50')]?_0x500838[_0x55bc('0x50')]:_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x50')],'substatus':null,'substatusAt':moment()['format'](_0x55bc('0x52')),'lastMsgAt':moment()[_0x55bc('0x51')](_0x55bc('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x334e24[_0x55bc('0x2a')]['body']});}else{return _0x500838;}}})[_0x55bc('0x12')](function(_0x3794c7){_0xc3be10[_0x55bc('0x59')]=_0x3794c7[_0x55bc('0x40')]({'plain':!![]});_0xc3be10[_0x55bc('0x59')][_0x55bc('0x5a')]=_0x464f05;return db[_0x55bc('0x54')]['create']({'body':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x2a')],'MailAccountId':_0x334e24['account']['id'],'MailInteractionId':_0x3794c7['id'],'direction':'in','ContactId':_0xc3be10[_0x55bc('0x4d')]['id'],'messageId':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x4e')],'from':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x33')],'to':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')]['to'],'cc':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')]['cc'],'subject':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x4f')],'attach':_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x50')],'Attachments':_0x334e24[_0x55bc('0x2a')]['message'][_0x55bc('0x5b')],'originTo':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')]['originTo'],'originCc':_0x334e24['body']['message']['originCc'],'bcc':_0x334e24[_0x55bc('0x2a')][_0x55bc('0x19')][_0x55bc('0x5c')]},{'include':[{'model':db['Attachment'],'as':_0x55bc('0x5d')}]});})[_0x55bc('0x12')](function(_0x21511c){_0xc3be10[_0x55bc('0x19')]=_0x21511c;if(_0xc3be10[_0x55bc('0x59')][_0x55bc('0x5e')]){return db['User']['find']({'attributes':['id',_0x55bc('0x5f')],'where':{'id':_0xc3be10['interaction'][_0x55bc('0x5e')]}})[_0x55bc('0x12')](function(_0x4e1fbc){if(_0x4e1fbc){_0xc3be10[_0x55bc('0x42')][_0x55bc('0x60')]({'id':0x0,'priority':0x0,'app':_0x55bc('0x61'),'appdata':_0x4e1fbc[_0x55bc('0x5f')]+','+(_0xc3be10[_0x55bc('0x39')][_0x55bc('0x62')]||0xa),'interval':_0x55bc('0x63')});}return respondWithRpcPromise('Start',_0x55bc('0x64'),_0xc3be10);});}return respondWithRpcPromise('Start','startRouting',_0xc3be10);})['then'](function(_0x19e417){_0x5ebce8(_0x19e417);})['catch'](function(_0x9a802b){_0x339704(_0x3e5b7c[_0x55bc('0x17')](0x1f4,_0x9a802b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 0f150a5..16a44e1 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 _0xadf0=['mailAccount:','save','remove','update','emit','length'];(function(_0x2f2b9d,_0x5dfe4b){var _0x3d73c9=function(_0x223bfd){while(--_0x223bfd){_0x2f2b9d['push'](_0x2f2b9d['shift']());}};_0x3d73c9(++_0x5dfe4b);}(_0xadf0,0x12d));var _0x0adf=function(_0x215fea,_0x3231e9){_0x215fea=_0x215fea-0x0;var _0x584624=_0xadf0[_0x215fea];return _0x584624;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x0adf('0x0'),_0x0adf('0x1'),_0x0adf('0x2')];function createListener(_0x1cbfcb,_0x92e952){return function(_0x174968){_0x92e952[_0x0adf('0x3')](_0x1cbfcb,_0x174968);};}function removeListener(_0x4b4b16,_0xb48987){return function(){MailAccountEvents['removeListener'](_0x4b4b16,_0xb48987);};}exports['register']=function(_0x5b01b9){for(var _0x516b05=0x0,_0xd1de43=events[_0x0adf('0x4')];_0x516b05<_0xd1de43;_0x516b05++){var _0x514e20=events[_0x516b05];var _0x58f618=createListener(_0x0adf('0x5')+_0x514e20,_0x5b01b9);MailAccountEvents['on'](_0x514e20,_0x58f618);}}; \ No newline at end of file +var _0x4ce6=['./mailAccount.events','remove','update','emit','length','mailAccount:'];(function(_0x2e1d9d,_0x486f05){var _0x443d25=function(_0x1e4bc0){while(--_0x1e4bc0){_0x2e1d9d['push'](_0x2e1d9d['shift']());}};_0x443d25(++_0x486f05);}(_0x4ce6,0x108));var _0x64ce=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x4ce6[_0x2c3255];return _0x282aba;};'use strict';var MailAccountEvents=require(_0x64ce('0x0'));var events=['save',_0x64ce('0x1'),_0x64ce('0x2')];function createListener(_0x3f9718,_0x11bca6){return function(_0x3f0983){_0x11bca6[_0x64ce('0x3')](_0x3f9718,_0x3f0983);};}function removeListener(_0x4a8899,_0x469aa){return function(){MailAccountEvents['removeListener'](_0x4a8899,_0x469aa);};}exports['register']=function(_0x31bc0f){for(var _0x262751=0x0,_0x5b8f2d=events[_0x64ce('0x4')];_0x262751<_0x5b8f2d;_0x262751++){var _0x3c279f=events[_0x262751];var _0x134230=createListener(_0x64ce('0x5')+_0x3c279f,_0x31bc0f);MailAccountEvents['on'](_0x3c279f,_0x134230);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 37daedb..1c33415 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 _0xe511=['/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe511,0x16f));var _0x1e51=function(_0x17e174,_0x4991f8){_0x17e174=_0x17e174-0x0;var _0x3f26f1=_0xe511[_0x17e174];return _0x3f26f1;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var auth=require(_0x1e51('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1e51('0x5'));var controller=require(_0x1e51('0x6'));router[_0x1e51('0x7')](_0x1e51('0x8'),auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xd')]);module[_0x1e51('0xe')]=router; \ No newline at end of file +var _0xb7e7=['delete','isAuthenticated','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','./mailApplication.controller','get','show','put','/:id','update'];(function(_0xee122e,_0x58ef2e){var _0x34f98a=function(_0x18163e){while(--_0x18163e){_0xee122e['push'](_0xee122e['shift']());}};_0x34f98a(++_0x58ef2e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xb7e7[_0x3305de];return _0x3b5a84;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);module[_0x7b7e('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 95a1f87..cf5d83c 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 _0xd679=['noop','TEXT','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd679,0xec));var _0x9d67=function(_0x75b278,_0x36c456){_0x75b278=_0x75b278-0x0;var _0x25b42d=_0xd679[_0x75b278];return _0x25b42d;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9d67('0x0')],'allowNull':![],'defaultValue':_0x9d67('0x1')},'appdata':{'type':Sequelize[_0x9d67('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9d67('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xad8c=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x338102,_0x1662d9){var _0xc22587=function(_0x5eaa97){while(--_0x5eaa97){_0x338102['push'](_0x338102['shift']());}};_0xc22587(++_0x1662d9);}(_0xad8c,0x1de));var _0xcad8=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0xad8c[_0x48c4ef];return _0x435715;};'use strict';var Sequelize=require(_0xcad8('0x0'));module[_0xcad8('0x1')]={'priority':{'type':Sequelize[_0xcad8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcad8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcad8('0x4')]()},'description':{'type':Sequelize[_0xcad8('0x3')]},'interval':{'type':Sequelize[_0xcad8('0x3')],'defaultValue':_0xcad8('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index f22d863..7e1e595 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 _0x6dd1=['util','path','sox','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','MailApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','body','params','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x4057ba,_0x247285){var _0x3ae06=function(_0x2bc6e0){while(--_0x2bc6e0){_0x4057ba['push'](_0x4057ba['shift']());}};_0x3ae06(++_0x247285);}(_0x6dd1,0x111));var _0x16dd=function(_0x2d8b52,_0xc6c06f){_0x2d8b52=_0x2d8b52-0x0;var _0x15dae3=_0x6dd1[_0x2d8b52];return _0x15dae3;};'use strict';var pdf=require(_0x16dd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x16dd('0x1'));var zipdir=require(_0x16dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16dd('0x3'));var moment=require(_0x16dd('0x4'));var BPromise=require(_0x16dd('0x5'));var Mustache=require(_0x16dd('0x6'));var util=require(_0x16dd('0x7'));var path=require(_0x16dd('0x8'));var sox=require(_0x16dd('0x9'));var csv=require(_0x16dd('0xa'));var ejs=require(_0x16dd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x16dd('0xc'));var toCsv=require(_0x16dd('0xa'));var querystring=require(_0x16dd('0xd'));var Papa=require(_0x16dd('0xe'));var Redis=require('ioredis');var authService=require(_0x16dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x16dd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16dd('0x11'));var utils=require(_0x16dd('0x12'));var config=require('../../config/environment');var db=require(_0x16dd('0x13'))['db'];function respondWithStatusCode(_0x3a4916,_0x2b1de0){_0x2b1de0=_0x2b1de0||0xcc;return function(_0x5e24c8){if(_0x5e24c8){return _0x3a4916[_0x16dd('0x14')](_0x2b1de0);}return _0x3a4916[_0x16dd('0x15')](_0x2b1de0)[_0x16dd('0x16')]();};}function respondWithResult(_0x78caa4,_0x475e16){_0x475e16=_0x475e16||0xc8;return function(_0x4d460c){if(_0x4d460c){return _0x78caa4['status'](_0x475e16)[_0x16dd('0x17')](_0x4d460c);}};}function respondWithFilteredResult(_0x5e81b1,_0xb68f62){return function(_0x167c44){if(_0x167c44){var _0x31a026=_0x167c44[_0x16dd('0x18')],_0x1719ba=_0xb68f62[_0x16dd('0x19')],_0x3add51=_0xb68f62['offset']+_0xb68f62[_0x16dd('0x1a')],_0x25817d;if(_0x3add51>=_0x31a026){_0x3add51=_0x31a026;_0x25817d=0xc8;}else{_0x25817d=0xce;}_0x5e81b1[_0x16dd('0x15')](_0x25817d);return _0x5e81b1[_0x16dd('0x1b')](_0x16dd('0x1c'),_0x1719ba+'-'+_0x3add51+'/'+_0x31a026)[_0x16dd('0x17')](_0x167c44);}return null;};}function patchUpdates(_0x59fab3){return function(_0x1dcb48){try{jsonpatch[_0x16dd('0x1d')](_0x1dcb48,_0x59fab3,!![]);}catch(_0x3f36c0){return BPromise[_0x16dd('0x1e')](_0x3f36c0);}return _0x1dcb48[_0x16dd('0x1f')]();};}function saveUpdates(_0x2c0bd8,_0x3ac589){return function(_0x44464a){if(_0x44464a){return _0x44464a[_0x16dd('0x20')](_0x2c0bd8)[_0x16dd('0x21')](function(_0x5e4468){return _0x5e4468;});}return null;};}function removeEntity(_0x33b119,_0x82fb39){return function(_0x44f66b){if(_0x44f66b){return _0x44f66b[_0x16dd('0x22')]()[_0x16dd('0x21')](function(){_0x33b119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4445f8,_0x239e59){return function(_0x4d1f98){if(!_0x4d1f98){_0x4445f8[_0x16dd('0x14')](0x194);}return _0x4d1f98;};}function handleError(_0x1bb0d1,_0x11937c){_0x11937c=_0x11937c||0x1f4;return function(_0x5125fa){logger[_0x16dd('0x23')](_0x5125fa[_0x16dd('0x24')]);if(_0x5125fa[_0x16dd('0x25')]){delete _0x5125fa['name'];}_0x1bb0d1[_0x16dd('0x15')](_0x11937c)[_0x16dd('0x26')](_0x5125fa);};}exports[_0x16dd('0x27')]=function(_0x4a5dba,_0x4c1614){var _0x2dace6={'raw':!![],'where':{'id':_0x4a5dba['params']['id']}},_0x27b809={};_0x27b809['model']=_['keys'](db[_0x16dd('0x28')][_0x16dd('0x29')]);_0x27b809[_0x16dd('0x2a')]=_['keys'](_0x4a5dba[_0x16dd('0x2a')]);_0x27b809[_0x16dd('0x2b')]=_[_0x16dd('0x2c')](_0x27b809[_0x16dd('0x2d')],_0x27b809['query']);_0x2dace6[_0x16dd('0x2e')]=_[_0x16dd('0x2c')](_0x27b809['model'],qs[_0x16dd('0x2f')](_0x4a5dba[_0x16dd('0x2a')]['fields']));_0x2dace6[_0x16dd('0x2e')]=_0x2dace6['attributes'][_0x16dd('0x30')]?_0x2dace6['attributes']:_0x27b809[_0x16dd('0x2d')];if(_0x4a5dba[_0x16dd('0x2a')][_0x16dd('0x31')]){_0x2dace6['include']=[{'all':!![]}];}_0x2dace6=_[_0x16dd('0x32')]({},_0x2dace6,_0x4a5dba[_0x16dd('0x33')]);return db['MailApplication'][_0x16dd('0x34')](_0x2dace6)[_0x16dd('0x21')](handleEntityNotFound(_0x4c1614,null))[_0x16dd('0x21')](respondWithResult(_0x4c1614,null))[_0x16dd('0x35')](handleError(_0x4c1614,null));};exports['update']=function(_0x361f40,_0x101916){if(_0x361f40['body']['id']){delete _0x361f40[_0x16dd('0x36')]['id'];}return db['MailApplication'][_0x16dd('0x34')]({'where':{'id':_0x361f40[_0x16dd('0x37')]['id']}})['then'](handleEntityNotFound(_0x101916,null))['then'](saveUpdates(_0x361f40[_0x16dd('0x36')],null))[_0x16dd('0x21')](respondWithResult(_0x101916,null))[_0x16dd('0x35')](handleError(_0x101916,null));};exports[_0x16dd('0x22')]=function(_0x2134d2,_0x7edb3f){return db[_0x16dd('0x28')][_0x16dd('0x34')]({'where':{'id':_0x2134d2[_0x16dd('0x37')]['id']}})['then'](handleEntityNotFound(_0x7edb3f,null))[_0x16dd('0x21')](removeEntity(_0x7edb3f,null))[_0x16dd('0x35')](handleError(_0x7edb3f,null));}; \ No newline at end of file +var _0x697f=['name','send','show','model','keys','MailApplication','query','intersection','attributes','fields','length','includeAll','include','options','catch','body','find','params','html-pdf','rimraf','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','apply','reject','save','update','then','destroy','sendStatus','stack'];(function(_0x5659f4,_0x3a072a){var _0x18e9a5=function(_0x4816e1){while(--_0x4816e1){_0x5659f4['push'](_0x5659f4['shift']());}};_0x18e9a5(++_0x3a072a);}(_0x697f,0x1a2));var _0xf697=function(_0x15bacf,_0x24253f){_0x15bacf=_0x15bacf-0x0;var _0x576d15=_0x697f[_0x15bacf];return _0x576d15;};'use strict';var pdf=require(_0xf697('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf697('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf697('0x2'));var moment=require(_0xf697('0x3'));var BPromise=require(_0xf697('0x4'));var Mustache=require('mustache');var util=require(_0xf697('0x5'));var path=require('path');var sox=require(_0xf697('0x6'));var csv=require('to-csv');var ejs=require(_0xf697('0x7'));var fs=require('fs');var _=require(_0xf697('0x8'));var squel=require(_0xf697('0x9'));var crypto=require(_0xf697('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf697('0xb'));var toCsv=require(_0xf697('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf697('0xd'));var authService=require(_0xf697('0xe'));var qs=require(_0xf697('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf697('0x10'));var utils=require(_0xf697('0x11'));var config=require(_0xf697('0x12'));var db=require(_0xf697('0x13'))['db'];function respondWithStatusCode(_0x296155,_0x1f4c1d){_0x1f4c1d=_0x1f4c1d||0xcc;return function(_0xd0c065){if(_0xd0c065){return _0x296155['sendStatus'](_0x1f4c1d);}return _0x296155[_0xf697('0x14')](_0x1f4c1d)['end']();};}function respondWithResult(_0x5a5478,_0x2a7ae8){_0x2a7ae8=_0x2a7ae8||0xc8;return function(_0x25dd2e){if(_0x25dd2e){return _0x5a5478[_0xf697('0x14')](_0x2a7ae8)[_0xf697('0x15')](_0x25dd2e);}};}function respondWithFilteredResult(_0x5acfcd,_0x33bdb5){return function(_0x580668){if(_0x580668){var _0x33bd0e=_0x580668[_0xf697('0x16')],_0x3646c1=_0x33bdb5[_0xf697('0x17')],_0x4d33b9=_0x33bdb5['offset']+_0x33bdb5['limit'],_0x27304f;if(_0x4d33b9>=_0x33bd0e){_0x4d33b9=_0x33bd0e;_0x27304f=0xc8;}else{_0x27304f=0xce;}_0x5acfcd[_0xf697('0x14')](_0x27304f);return _0x5acfcd['set']('Content-Range',_0x3646c1+'-'+_0x4d33b9+'/'+_0x33bd0e)[_0xf697('0x15')](_0x580668);}return null;};}function patchUpdates(_0x1ff24c){return function(_0xee2fe6){try{jsonpatch[_0xf697('0x18')](_0xee2fe6,_0x1ff24c,!![]);}catch(_0x3bf246){return BPromise[_0xf697('0x19')](_0x3bf246);}return _0xee2fe6[_0xf697('0x1a')]();};}function saveUpdates(_0x385729,_0x348e26){return function(_0x3eccd1){if(_0x3eccd1){return _0x3eccd1[_0xf697('0x1b')](_0x385729)[_0xf697('0x1c')](function(_0x30cbf2){return _0x30cbf2;});}return null;};}function removeEntity(_0xd1eb06,_0xd92aca){return function(_0x50e37c){if(_0x50e37c){return _0x50e37c[_0xf697('0x1d')]()[_0xf697('0x1c')](function(){_0xd1eb06[_0xf697('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da714,_0x2a7936){return function(_0x2b64a6){if(!_0x2b64a6){_0x4da714[_0xf697('0x1e')](0x194);}return _0x2b64a6;};}function handleError(_0x4ed358,_0x42c781){_0x42c781=_0x42c781||0x1f4;return function(_0x509f1c){logger['error'](_0x509f1c[_0xf697('0x1f')]);if(_0x509f1c[_0xf697('0x20')]){delete _0x509f1c[_0xf697('0x20')];}_0x4ed358[_0xf697('0x14')](_0x42c781)[_0xf697('0x21')](_0x509f1c);};}exports[_0xf697('0x22')]=function(_0x45ec1b,_0x59c581){var _0x321d88={'raw':!![],'where':{'id':_0x45ec1b['params']['id']}},_0x1690d5={};_0x1690d5[_0xf697('0x23')]=_[_0xf697('0x24')](db[_0xf697('0x25')]['rawAttributes']);_0x1690d5[_0xf697('0x26')]=_['keys'](_0x45ec1b[_0xf697('0x26')]);_0x1690d5['filters']=_[_0xf697('0x27')](_0x1690d5[_0xf697('0x23')],_0x1690d5[_0xf697('0x26')]);_0x321d88[_0xf697('0x28')]=_[_0xf697('0x27')](_0x1690d5[_0xf697('0x23')],qs[_0xf697('0x29')](_0x45ec1b[_0xf697('0x26')][_0xf697('0x29')]));_0x321d88[_0xf697('0x28')]=_0x321d88[_0xf697('0x28')][_0xf697('0x2a')]?_0x321d88['attributes']:_0x1690d5[_0xf697('0x23')];if(_0x45ec1b['query'][_0xf697('0x2b')]){_0x321d88[_0xf697('0x2c')]=[{'all':!![]}];}_0x321d88=_['merge']({},_0x321d88,_0x45ec1b[_0xf697('0x2d')]);return db[_0xf697('0x25')]['find'](_0x321d88)[_0xf697('0x1c')](handleEntityNotFound(_0x59c581,null))[_0xf697('0x1c')](respondWithResult(_0x59c581,null))[_0xf697('0x2e')](handleError(_0x59c581,null));};exports[_0xf697('0x1b')]=function(_0x237ecf,_0x408860){if(_0x237ecf[_0xf697('0x2f')]['id']){delete _0x237ecf[_0xf697('0x2f')]['id'];}return db['MailApplication'][_0xf697('0x30')]({'where':{'id':_0x237ecf[_0xf697('0x31')]['id']}})[_0xf697('0x1c')](handleEntityNotFound(_0x408860,null))[_0xf697('0x1c')](saveUpdates(_0x237ecf[_0xf697('0x2f')],null))[_0xf697('0x1c')](respondWithResult(_0x408860,null))['catch'](handleError(_0x408860,null));};exports[_0xf697('0x1d')]=function(_0x4a0f44,_0x4c3b4f){return db[_0xf697('0x25')][_0xf697('0x30')]({'where':{'id':_0x4a0f44[_0xf697('0x31')]['id']}})[_0xf697('0x1c')](handleEntityNotFound(_0x4c3b4f,null))[_0xf697('0x1c')](removeEntity(_0x4c3b4f,null))[_0xf697('0x2e')](handleError(_0x4c3b4f,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 65aa6b7..fb3d669 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 _0x14c4=['rimraf','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x14c4,0x1f0));var _0x414c=function(_0x24403d,_0x94ebf1){_0x24403d=_0x24403d-0x0;var _0x3fabf3=_0x14c4[_0x24403d];return _0x3fabf3;};'use strict';var _=require('lodash');var util=require(_0x414c('0x0'));var logger=require(_0x414c('0x1'))('api');var moment=require(_0x414c('0x2'));var BPromise=require(_0x414c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x414c('0x4'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x414c('0x5')]=function(_0x506bd7,_0x48e95f){return _0x506bd7['define'](_0x414c('0x6'),attributes,{'tableName':_0x414c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x414c('0x8'),'collate':_0x414c('0x9')});}; \ No newline at end of file +var _0x348e=['bluebird','request-promise','path','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x6ed469,_0x4b92b8){var _0x5f22d6=function(_0x161ffb){while(--_0x161ffb){_0x6ed469['push'](_0x6ed469['shift']());}};_0x5f22d6(++_0x4b92b8);}(_0x348e,0xdb));var _0xe348=function(_0x17d900,_0x5d1514){_0x17d900=_0x17d900-0x0;var _0x355db8=_0x348e[_0x17d900];return _0x355db8;};'use strict';var _=require(_0xe348('0x0'));var util=require(_0xe348('0x1'));var logger=require(_0xe348('0x2'))(_0xe348('0x3'));var moment=require(_0xe348('0x4'));var BPromise=require(_0xe348('0x5'));var rp=require(_0xe348('0x6'));var fs=require('fs');var path=require(_0xe348('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe348('0x8'));module['exports']=function(_0x1249bf,_0x514ee9){return _0x1249bf[_0xe348('0x9')](_0xe348('0xa'),attributes,{'tableName':_0xe348('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe348('0xc'),'collate':_0xe348('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 70d93ca..8ba2ff5 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 _0x8dd0=['error','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x224a9a,_0x374004){var _0x2455cc=function(_0x54b78d){while(--_0x54b78d){_0x224a9a['push'](_0x224a9a['shift']());}};_0x2455cc(++_0x374004);}(_0x8dd0,0x6a));var _0x08dd=function(_0x43d723,_0x1c7fa5){_0x43d723=_0x43d723-0x0;var _0x5af076=_0x8dd0[_0x43d723];return _0x5af076;};'use strict';var _=require(_0x08dd('0x0'));var util=require('util');var moment=require(_0x08dd('0x1'));var BPromise=require(_0x08dd('0x2'));var rs=require(_0x08dd('0x3'));var fs=require('fs');var Redis=require(_0x08dd('0x4'));var db=require(_0x08dd('0x5'))['db'];var utils=require(_0x08dd('0x6'));var logger=require(_0x08dd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x08dd('0x8')][_0x08dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca965e,_0xde54a,_0x2d7748){return new BPromise(function(_0x1c5626,_0x5a6fdd){return client[_0x08dd('0xa')](_0xca965e,_0x2d7748)[_0x08dd('0xb')](function(_0x34e4c7){logger[_0x08dd('0xc')]('MailApplication,\x20%s,\x20%s',_0xde54a,_0x08dd('0xd'));logger[_0x08dd('0xe')](_0x08dd('0xf'),_0xde54a,_0x08dd('0xd'),JSON[_0x08dd('0x10')](_0x34e4c7));if(_0x34e4c7['error']){if(_0x34e4c7['error'][_0x08dd('0x11')]===0x1f4){logger[_0x08dd('0x12')](_0x08dd('0x13'),_0xde54a,_0x34e4c7[_0x08dd('0x12')][_0x08dd('0x14')]);return _0x5a6fdd(_0x34e4c7[_0x08dd('0x12')][_0x08dd('0x14')]);}logger['error'](_0x08dd('0x13'),_0xde54a,_0x34e4c7[_0x08dd('0x12')][_0x08dd('0x14')]);return _0x1c5626(_0x34e4c7[_0x08dd('0x12')][_0x08dd('0x14')]);}else{logger[_0x08dd('0xc')](_0x08dd('0x13'),_0xde54a,'request\x20sent');_0x1c5626(_0x34e4c7[_0x08dd('0x15')][_0x08dd('0x14')]);}})[_0x08dd('0x16')](function(_0x460544){logger[_0x08dd('0x12')](_0x08dd('0x13'),_0xde54a,_0x460544);_0x5a6fdd(_0x460544);});});}exports[_0x08dd('0x17')]=function(_0x177c36){var _0xcfef5f=this;return new Promise(function(_0x44ad0a,_0x2cdd12){return db[_0x08dd('0x18')][_0x08dd('0x19')](_0x177c36[_0x08dd('0x1a')],{'raw':_0x177c36['options']?_0x177c36[_0x08dd('0x1b')][_0x08dd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x177c36[_0x08dd('0x1b')]?_0x177c36[_0x08dd('0x1b')][_0x08dd('0x1d')]||null:null,'attributes':_0x177c36['options']?_0x177c36[_0x08dd('0x1b')]['attributes']||null:null,'limit':_0x177c36[_0x08dd('0x1b')]?_0x177c36[_0x08dd('0x1b')][_0x08dd('0x1e')]||null:null})[_0x08dd('0xb')](function(_0x5bc5a0){logger[_0x08dd('0xc')](_0x08dd('0x17'),_0x177c36);logger['debug'](_0x08dd('0x17'),_0x177c36,JSON[_0x08dd('0x10')](_0x5bc5a0));_0x44ad0a(_0x5bc5a0);})[_0x08dd('0x16')](function(_0x4c45c0){logger['error'](_0x08dd('0x17'),_0x4c45c0['message'],_0x177c36);_0x2cdd12(_0xcfef5f[_0x08dd('0x12')](0x1f4,_0x4c45c0[_0x08dd('0x14')]));});});}; \ No newline at end of file +var _0xec80=['update','options','where','attributes','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','UpdateMailApplication','MailApplication'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xec80,0x8c));var _0x0ec8=function(_0x300768,_0x515b0c){_0x300768=_0x300768-0x0;var _0x27bb75=_0xec80[_0x300768];return _0x27bb75;};'use strict';var _=require(_0x0ec8('0x0'));var util=require(_0x0ec8('0x1'));var moment=require(_0x0ec8('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ec8('0x3'));var fs=require('fs');var Redis=require(_0x0ec8('0x4'));var db=require(_0x0ec8('0x5'))['db'];var utils=require(_0x0ec8('0x6'));var logger=require('../../config/logger')(_0x0ec8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ec8('0x8')][_0x0ec8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38cd4f,_0x1e6ad3,_0x2173c3){return new BPromise(function(_0x796557,_0x5ccde8){return client[_0x0ec8('0xa')](_0x38cd4f,_0x2173c3)[_0x0ec8('0xb')](function(_0xec37f4){logger[_0x0ec8('0xc')](_0x0ec8('0xd'),_0x1e6ad3,'request\x20sent');logger[_0x0ec8('0xe')](_0x0ec8('0xf'),_0x1e6ad3,'request\x20sent',JSON['stringify'](_0xec37f4));if(_0xec37f4[_0x0ec8('0x10')]){if(_0xec37f4[_0x0ec8('0x10')]['code']===0x1f4){logger[_0x0ec8('0x10')](_0x0ec8('0xd'),_0x1e6ad3,_0xec37f4['error'][_0x0ec8('0x11')]);return _0x5ccde8(_0xec37f4['error'][_0x0ec8('0x11')]);}logger[_0x0ec8('0x10')](_0x0ec8('0xd'),_0x1e6ad3,_0xec37f4[_0x0ec8('0x10')][_0x0ec8('0x11')]);return _0x796557(_0xec37f4[_0x0ec8('0x10')][_0x0ec8('0x11')]);}else{logger[_0x0ec8('0xc')](_0x0ec8('0xd'),_0x1e6ad3,_0x0ec8('0x12'));_0x796557(_0xec37f4[_0x0ec8('0x13')]['message']);}})['catch'](function(_0x4a85ee){logger[_0x0ec8('0x10')](_0x0ec8('0xd'),_0x1e6ad3,_0x4a85ee);_0x5ccde8(_0x4a85ee);});});}exports[_0x0ec8('0x14')]=function(_0x2d7cc3){var _0x4f4b08=this;return new Promise(function(_0x234aa9,_0x565641){return db[_0x0ec8('0x15')][_0x0ec8('0x16')](_0x2d7cc3['body'],{'raw':_0x2d7cc3[_0x0ec8('0x17')]?_0x2d7cc3[_0x0ec8('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d7cc3['options']?_0x2d7cc3[_0x0ec8('0x17')][_0x0ec8('0x18')]||null:null,'attributes':_0x2d7cc3['options']?_0x2d7cc3[_0x0ec8('0x17')][_0x0ec8('0x19')]||null:null,'limit':_0x2d7cc3[_0x0ec8('0x17')]?_0x2d7cc3['options']['limit']||null:null})[_0x0ec8('0xb')](function(_0x578f92){logger[_0x0ec8('0xc')](_0x0ec8('0x14'),_0x2d7cc3);logger[_0x0ec8('0xe')](_0x0ec8('0x14'),_0x2d7cc3,JSON[_0x0ec8('0x1a')](_0x578f92));_0x234aa9(_0x578f92);})['catch'](function(_0x3de495){logger[_0x0ec8('0x10')]('UpdateMailApplication',_0x3de495[_0x0ec8('0x11')],_0x2d7cc3);_0x565641(_0x4f4b08[_0x0ec8('0x10')](0x1f4,_0x3de495['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 148b10a..3029236 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 _0xbcba=['/:id/tags','tracked','mail','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id/messages','getMessages','/:id/download','download','post','create','addMessage'];(function(_0x43cdc3,_0x9ccb13){var _0x2936bd=function(_0x3a6b1b){while(--_0x3a6b1b){_0x43cdc3['push'](_0x43cdc3['shift']());}};_0x2936bd(++_0x9ccb13);}(_0xbcba,0x6d));var _0xabcb=function(_0x4aad0d,_0x4d0202){_0x4aad0d=_0x4aad0d-0x0;var _0x43c2ba=_0xbcba[_0x4aad0d];return _0x43c2ba;};'use strict';var multer=require(_0xabcb('0x0'));var util=require(_0xabcb('0x1'));var path=require('path');var timeout=require(_0xabcb('0x2'));var express=require(_0xabcb('0x3'));var router=express[_0xabcb('0x4')]();var auth=require(_0xabcb('0x5'));var interaction=require(_0xabcb('0x6'));var config=require(_0xabcb('0x7'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0xabcb('0x8')](),controller[_0xabcb('0x9')]);router['get']('/describe',auth[_0xabcb('0x8')](),controller[_0xabcb('0xa')]);router['get']('/:id',auth[_0xabcb('0x8')](),controller['show']);router[_0xabcb('0xb')](_0xabcb('0xc'),auth[_0xabcb('0x8')](),controller[_0xabcb('0xd')]);router['get'](_0xabcb('0xe'),auth[_0xabcb('0x8')](),controller[_0xabcb('0xf')]);router[_0xabcb('0x10')]('/',auth[_0xabcb('0x8')](),controller[_0xabcb('0x11')]);router[_0xabcb('0x10')](_0xabcb('0xc'),auth['isAuthenticated'](),controller[_0xabcb('0x12')]);router[_0xabcb('0x10')](_0xabcb('0x13'),auth[_0xabcb('0x8')](),interaction[_0xabcb('0x14')](_0xabcb('0x15'),'mailinteraction:addtags'),controller[_0xabcb('0x16')]);router[_0xabcb('0x17')](_0xabcb('0x18'),auth[_0xabcb('0x8')](),interaction[_0xabcb('0x14')](_0xabcb('0x15'),_0xabcb('0x19')),controller[_0xabcb('0x1a')]);router[_0xabcb('0x1b')](_0xabcb('0x18'),auth['isAuthenticated'](),interaction[_0xabcb('0x14')](_0xabcb('0x15'),_0xabcb('0x1c')),controller[_0xabcb('0x1d')]);router[_0xabcb('0x1b')](_0xabcb('0x13'),auth[_0xabcb('0x8')](),controller[_0xabcb('0x1e')]);module[_0xabcb('0x1f')]=router; \ No newline at end of file +var _0xa17b=['../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','put','mailinteraction:update','update','delete','/:id','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0xe2d875,_0x447ae5){var _0x1030ad=function(_0x5368af){while(--_0x5368af){_0xe2d875['push'](_0xe2d875['shift']());}};_0x1030ad(++_0x447ae5);}(_0xa17b,0xbf));var _0xba17=function(_0x59c93e,_0x16b91c){_0x59c93e=_0x59c93e-0x0;var _0x487f72=_0xa17b[_0x59c93e];return _0x487f72;};'use strict';var multer=require(_0xba17('0x0'));var util=require(_0xba17('0x1'));var path=require(_0xba17('0x2'));var timeout=require(_0xba17('0x3'));var express=require(_0xba17('0x4'));var router=express['Router']();var auth=require(_0xba17('0x5'));var interaction=require(_0xba17('0x6'));var config=require(_0xba17('0x7'));var controller=require(_0xba17('0x8'));router[_0xba17('0x9')]('/',auth[_0xba17('0xa')](),controller[_0xba17('0xb')]);router[_0xba17('0x9')](_0xba17('0xc'),auth[_0xba17('0xa')](),controller[_0xba17('0xd')]);router[_0xba17('0x9')]('/:id',auth[_0xba17('0xa')](),controller['show']);router[_0xba17('0x9')](_0xba17('0xe'),auth[_0xba17('0xa')](),controller[_0xba17('0xf')]);router['get'](_0xba17('0x10'),auth[_0xba17('0xa')](),controller[_0xba17('0x11')]);router[_0xba17('0x12')]('/',auth[_0xba17('0xa')](),controller[_0xba17('0x13')]);router['post'](_0xba17('0xe'),auth[_0xba17('0xa')](),controller[_0xba17('0x14')]);router[_0xba17('0x12')](_0xba17('0x15'),auth['isAuthenticated'](),interaction[_0xba17('0x16')](_0xba17('0x17'),'mailinteraction:addtags'),controller['addTags']);router[_0xba17('0x18')]('/:id',auth[_0xba17('0xa')](),interaction[_0xba17('0x16')](_0xba17('0x17'),_0xba17('0x19')),controller[_0xba17('0x1a')]);router[_0xba17('0x1b')](_0xba17('0x1c'),auth[_0xba17('0xa')](),interaction[_0xba17('0x16')](_0xba17('0x17'),_0xba17('0x1d')),controller[_0xba17('0x1e')]);router[_0xba17('0x1b')](_0xba17('0x15'),auth[_0xba17('0xa')](),controller[_0xba17('0x1f')]);module[_0xba17('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 44e41dc..31a9fa0 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 _0x090d=['exports','BOOLEAN','DATE','STRING','TEXT','out','ENUM','long','sequelize','iconv'];(function(_0x535c2b,_0x13368b){var _0x347f9d=function(_0x1c3b4d){while(--_0x1c3b4d){_0x535c2b['push'](_0x535c2b['shift']());}};_0x347f9d(++_0x13368b);}(_0x090d,0xda));var _0xd090=function(_0x99a090,_0x94cf0a){_0x99a090=_0x99a090-0x0;var _0x13166b=_0x090d[_0x99a090];return _0x13166b;};'use strict';var Sequelize=require(_0xd090('0x0'));var iconv=require(_0xd090('0x1'));module[_0xd090('0x2')]={'closed':{'type':Sequelize[_0xd090('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd090('0x4')]},'disposition':{'type':Sequelize[_0xd090('0x5')]},'note':{'type':Sequelize[_0xd090('0x5')]},'inReplyTo':{'type':Sequelize[_0xd090('0x5')](0x1fe)},'to':{'type':Sequelize[_0xd090('0x5')]},'cc':{'type':Sequelize[_0xd090('0x6')]('long')},'subject':{'type':Sequelize[_0xd090('0x6')]()},'attach':{'type':Sequelize[_0xd090('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd090('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xd090('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd090('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd090('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd090('0x8')]('in',_0xd090('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd090('0x6')]('long')},'lastMsgText':{'type':Sequelize[_0xd090('0x6')](_0xd090('0x9'))}}; \ No newline at end of file +var _0x6fbd=['BOOLEAN','DATE','STRING','TEXT','long','out','ENUM','sequelize','iconv','exports'];(function(_0x289fd4,_0xd34ba6){var _0x3d4a88=function(_0x2a3726){while(--_0x2a3726){_0x289fd4['push'](_0x289fd4['shift']());}};_0x3d4a88(++_0xd34ba6);}(_0x6fbd,0x1f1));var _0xd6fb=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x6fbd[_0x2c0be1];return _0x3d4bd2;};'use strict';var Sequelize=require(_0xd6fb('0x0'));var iconv=require(_0xd6fb('0x1'));module[_0xd6fb('0x2')]={'closed':{'type':Sequelize[_0xd6fb('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd6fb('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd6fb('0x5')]},'inReplyTo':{'type':Sequelize[_0xd6fb('0x5')](0x1fe)},'to':{'type':Sequelize[_0xd6fb('0x5')]},'cc':{'type':Sequelize[_0xd6fb('0x6')](_0xd6fb('0x7'))},'subject':{'type':Sequelize[_0xd6fb('0x6')]()},'attach':{'type':Sequelize[_0xd6fb('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd6fb('0x4')]},'substatus':{'type':Sequelize[_0xd6fb('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xd6fb('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd6fb('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd6fb('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd6fb('0x9')]('in',_0xd6fb('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd6fb('0x6')](_0xd6fb('0x7'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xd6fb('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index b3a78fb..3cc1249 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x27a478,_0x1113bc){var _0xb9c7e2=function(_0x3be5b5){while(--_0x3be5b5){_0x27a478['push'](_0x27a478['shift']());}};_0xb9c7e2(++_0x1113bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x1365b9,_0x582215){var _0x385dce=function(_0x6e3361){while(--_0x6e3361){_0x1365b9['push'](_0x1365b9['shift']());}};_0x385dce(++_0x582215);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 25199e5..ef64082 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 _0xf1ef=['remove','getUsers','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','MailInteraction','MailMessage','save','update'];(function(_0x4c645d,_0x48d0a1){var _0x1a0fb0=function(_0x563f2a){while(--_0x563f2a){_0x4c645d['push'](_0x4c645d['shift']());}};_0x1a0fb0(++_0x48d0a1);}(_0xf1ef,0x171));var _0xff1e=function(_0x17eab3,_0x45e1e8){_0x17eab3=_0x17eab3-0x0;var _0x390e4c=_0xf1ef[_0x17eab3];return _0x390e4c;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xff1e('0x0'))['db'][_0xff1e('0x1')];var MailMessage=require(_0xff1e('0x0'))['db'][_0xff1e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xff1e('0x3'),'afterUpdate':_0xff1e('0x4'),'afterDestroy':_0xff1e('0x5')};function emitEvent(_0x18381f){return function(_0x2788f0,_0x37164f,_0x234703){_0x2788f0[_0xff1e('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x28062b){_0x2788f0['setDataValue'](_0xff1e('0x7'),_0x28062b[_0xff1e('0x8')](function(_0x16c160){return{'id':_0x16c160['id']};}));return MailMessage[_0xff1e('0x9')]({'where':{'MailInteractionId':_0x2788f0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x528532){_0x2788f0[_0xff1e('0xa')](_0xff1e('0xb'),_0x528532[_0xff1e('0xc')]);MailInteractionEvents[_0xff1e('0xd')](_0x18381f+':'+_0x2788f0['id'],_0x2788f0);MailInteractionEvents[_0xff1e('0xd')](_0x18381f,_0x2788f0);_0x234703(null);})[_0xff1e('0xe')](_0x234703(null));};}for(var e in events){if(events[_0xff1e('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xff1e('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x1dff=['MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x397f34,_0x3ac328){var _0x272cda=function(_0x2c9756){while(--_0x2c9756){_0x397f34['push'](_0x397f34['shift']());}};_0x272cda(++_0x3ac328);}(_0x1dff,0x1b9));var _0xf1df=function(_0x80544e,_0x37a3f3){_0x80544e=_0x80544e-0x0;var _0x4f9b90=_0x1dff[_0x80544e];return _0x4f9b90;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xf1df('0x0'))['db'][_0xf1df('0x1')];var MailMessage=require(_0xf1df('0x0'))['db'][_0xf1df('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf1df('0x3')](0x0);var events={'afterCreate':_0xf1df('0x4'),'afterUpdate':_0xf1df('0x5'),'afterDestroy':_0xf1df('0x6')};function emitEvent(_0x431113){return function(_0x1833cf,_0xd41bf3,_0xdf4a77){_0x1833cf[_0xf1df('0x7')]({'attributes':['id'],'raw':!![]})[_0xf1df('0x8')](function(_0x121c5c){_0x1833cf[_0xf1df('0x9')]('Users',_0x121c5c[_0xf1df('0xa')](function(_0x19f6d4){return{'id':_0x19f6d4['id']};}));return MailMessage[_0xf1df('0xb')]({'where':{'MailInteractionId':_0x1833cf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf1df('0x8')](function(_0x2316ce){_0x1833cf['setDataValue'](_0xf1df('0xc'),_0x2316ce['length']);MailInteractionEvents[_0xf1df('0xd')](_0x431113+':'+_0x1833cf['id'],_0x1833cf);MailInteractionEvents[_0xf1df('0xd')](_0x431113,_0x1833cf);_0xdf4a77(null);})['catch'](_0xdf4a77(null));};}for(var e in events){if(events[_0xf1df('0xe')](e)){var event=events[e];MailInteraction[_0xf1df('0xf')](e,emitEvent(event));}}module[_0xf1df('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 1c02288..a5109d2 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 _0x9957=['api','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','lodash','util','../../config/logger'];(function(_0x1b0ac7,_0x1a757c){var _0x12841e=function(_0x355299){while(--_0x355299){_0x1b0ac7['push'](_0x1b0ac7['shift']());}};_0x12841e(++_0x1a757c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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':'mail_interactions','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa2e5f0,_0x3116fb,_0x18c8a3){if(_0xa2e5f0[_0x7995('0xe')]){_0xa2e5f0[_0x7995('0xf')]=moment()[_0x7995('0x10')](_0x7995('0x11'));}if(_0xa2e5f0['closed']){_0xa2e5f0[_0x7995('0x12')]=moment()[_0x7995('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18c8a3(null,_0x3116fb);},'beforeUpdate':function(_0xb0c872,_0x2cb37a,_0x19a27e){if(_0xb0c872[_0x7995('0x13')](_0x7995('0xe'))){_0xb0c872[_0x7995('0xf')]=_0xb0c872[_0x7995('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xb0c872[_0x7995('0x13')](_0x7995('0x14'))){_0xb0c872[_0x7995('0x12')]=moment()[_0x7995('0x10')](_0x7995('0x11'));_0xb0c872[_0x7995('0xe')]=null;_0xb0c872[_0x7995('0xf')]=null;}_0x19a27e(null,_0xb0c872);},'afterUpdate':function(_0x41cbf0,_0x5377e5,_0x2eeacc){var _0x565d97=_0x137b6b[_0x7995('0x15')];var _0x37f297=_0x41cbf0[_0x7995('0x16')]({'plain':!![]});if(_0x37f297[_0x7995('0x14')]){return _0x565d97[_0x7995('0x17')][_0x7995('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x37f297['id']}})['then'](function(){_0x2eeacc();})['catch'](function(_0x2536c8){_0x2eeacc(_0x2536c8);});}else{_0x2eeacc();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x008c=['then','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','YYYY-MM-DD\x20HH:mm:ss','closed','format','changed','substatus','closedAt','models','update'];(function(_0x42dd25,_0x2da102){var _0x3a7854=function(_0x4bbbc6){while(--_0x4bbbc6){_0x42dd25['push'](_0x42dd25['shift']());}};_0x3a7854(++_0x2da102);}(_0x008c,0x188));var _0xc008=function(_0x27a45e,_0x556bb4){_0x27a45e=_0x27a45e-0x0;var _0x1fca64=_0x008c[_0x27a45e];return _0x1fca64;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('MailInteraction',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xc008('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52041f,_0x27830d,_0x7231b4){if(_0x52041f['substatus']){_0x52041f['substatusAt']=moment()['format'](_0xc008('0xe'));}if(_0x52041f[_0xc008('0xf')]){_0x52041f['closedAt']=moment()[_0xc008('0x10')](_0xc008('0xe'));}_0x7231b4(null,_0x27830d);},'beforeUpdate':function(_0x2ea200,_0x2a5b4e,_0x9ffa93){if(_0x2ea200[_0xc008('0x11')](_0xc008('0x12'))){_0x2ea200['substatusAt']=_0x2ea200['substatus']?moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2ea200[_0xc008('0x11')](_0xc008('0xf'))){_0x2ea200[_0xc008('0x13')]=moment()[_0xc008('0x10')](_0xc008('0xe'));_0x2ea200['substatus']=null;_0x2ea200['substatusAt']=null;}_0x9ffa93(null,_0x2ea200);},'afterUpdate':function(_0x4bd0f4,_0x11ef38,_0x15a6ad){var _0x3cafe3=_0x13aa7[_0xc008('0x14')];var _0x4fe771=_0x4bd0f4['get']({'plain':!![]});if(_0x4fe771['closed']){return _0x3cafe3['MailMessage'][_0xc008('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x4fe771['id']}})[_0xc008('0x16')](function(){_0x15a6ad();})['catch'](function(_0x813397){_0x15a6ad(_0x813397);});}else{_0x15a6ad();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8bd544c..1155229 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 _0xc577=['attributes','limit','then','stringify','AddTagsToMailInteraction','where','addTags','omit','ids','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options'];(function(_0x5e3115,_0x540600){var _0x5a1dc6=function(_0x1163f5){while(--_0x1163f5){_0x5e3115['push'](_0x5e3115['shift']());}};_0x5a1dc6(++_0x540600);}(_0xc577,0x172));var _0x7c57=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xc577[_0xa30766];return _0x24e780;};'use strict';var _=require(_0x7c57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c57('0x1'));var rs=require(_0x7c57('0x2'));var fs=require('fs');var Redis=require(_0x7c57('0x3'));var db=require(_0x7c57('0x4'))['db'];var utils=require(_0x7c57('0x5'));var logger=require(_0x7c57('0x6'))(_0x7c57('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c57('0x8'));var client=jayson[_0x7c57('0x9')][_0x7c57('0xa')]({'port':0x232a});config[_0x7c57('0xb')]=_[_0x7c57('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c57('0xb')]));require('./mailInteraction.socket')[_0x7c57('0xd')](socket);function respondWithRpcPromise(_0x2e63cc,_0x11dd41,_0x3665f9){return new BPromise(function(_0x4f8f51,_0x1e4a96){return client[_0x7c57('0xe')](_0x2e63cc,_0x3665f9)['then'](function(_0x20aae1){logger[_0x7c57('0xf')](_0x7c57('0x10'),_0x11dd41,_0x7c57('0x11'));logger[_0x7c57('0x12')](_0x7c57('0x13'),_0x11dd41,_0x7c57('0x11'),JSON['stringify'](_0x20aae1));if(_0x20aae1['error']){if(_0x20aae1['error'][_0x7c57('0x14')]===0x1f4){logger[_0x7c57('0x15')](_0x7c57('0x10'),_0x11dd41,_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);return _0x1e4a96(_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);}logger[_0x7c57('0x15')]('MailInteraction,\x20%s,\x20%s',_0x11dd41,_0x20aae1['error'][_0x7c57('0x16')]);return _0x4f8f51(_0x20aae1[_0x7c57('0x15')][_0x7c57('0x16')]);}else{logger[_0x7c57('0xf')](_0x7c57('0x10'),_0x11dd41,'request\x20sent');_0x4f8f51(_0x20aae1[_0x7c57('0x17')][_0x7c57('0x16')]);}})[_0x7c57('0x18')](function(_0x87617b){logger[_0x7c57('0x15')](_0x7c57('0x10'),_0x11dd41,_0x87617b);_0x1e4a96(_0x87617b);});});}exports[_0x7c57('0x19')]=function(_0x3a6dce){var _0x2ace9d=this;return new Promise(function(_0x5488b7,_0x45221e){return db[_0x7c57('0x1a')][_0x7c57('0x1b')](_0x3a6dce[_0x7c57('0x1c')],{'raw':_0x3a6dce['options']?_0x3a6dce['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a6dce[_0x7c57('0x1d')]?_0x3a6dce[_0x7c57('0x1d')]['where']||null:null,'attributes':_0x3a6dce[_0x7c57('0x1d')]?_0x3a6dce[_0x7c57('0x1d')][_0x7c57('0x1e')]||null:null,'limit':_0x3a6dce[_0x7c57('0x1d')]?_0x3a6dce[_0x7c57('0x1d')][_0x7c57('0x1f')]||null:null})[_0x7c57('0x20')](function(_0x56fd57){logger[_0x7c57('0xf')](_0x7c57('0x19'),_0x3a6dce);logger[_0x7c57('0x12')](_0x7c57('0x19'),_0x3a6dce,JSON[_0x7c57('0x21')](_0x56fd57));_0x5488b7(_0x56fd57);})[_0x7c57('0x18')](function(_0x41125b){logger[_0x7c57('0x15')](_0x7c57('0x19'),_0x41125b['message'],_0x3a6dce);_0x45221e(_0x2ace9d['error'](0x1f4,_0x41125b[_0x7c57('0x16')]));});});};exports[_0x7c57('0x22')]=function(_0x327575){return new Promise(function(_0x54b294,_0x9b9d1f){return db['MailInteraction']['find']({'where':_0x327575['options']?_0x327575[_0x7c57('0x1d')][_0x7c57('0x23')]||null:null})['then'](function(_0x423434){if(_0x423434){return _0x423434[_0x7c57('0x24')](_0x327575[_0x7c57('0x1c')]['ids'],_[_0x7c57('0x25')](_0x327575[_0x7c57('0x1c')],[_0x7c57('0x26'),'id'])||{});}})['spread'](function(_0x408860){logger[_0x7c57('0xf')](_0x7c57('0x27'),_0x327575);logger[_0x7c57('0x12')](_0x7c57('0x27'),_0x327575,JSON[_0x7c57('0x21')](_0x408860));_0x54b294(_0x408860);})[_0x7c57('0x18')](function(_0x299d22){logger[_0x7c57('0x15')](_0x7c57('0x27'),_0x299d22['message'],_0x327575);_0x9b9d1f(_this[_0x7c57('0x15')](0x1f4,_0x299d22[_0x7c57('0x16')]));});});}; \ No newline at end of file +var _0xffe1=['omit','body','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','attributes','limit','stringify','find','where','addTags','ids'];(function(_0xa1dcbd,_0x39a535){var _0x5a20dc=function(_0x33c40f){while(--_0x33c40f){_0xa1dcbd['push'](_0xa1dcbd['shift']());}};_0x5a20dc(++_0x39a535);}(_0xffe1,0x175));var _0x1ffe=function(_0x39cf6a,_0x35314c){_0x39cf6a=_0x39cf6a-0x0;var _0x1249c9=_0xffe1[_0x39cf6a];return _0x1249c9;};'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});config[_0x1ffe('0xa')]=_[_0x1ffe('0xb')](config[_0x1ffe('0xa')],{'host':_0x1ffe('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1ffe('0xd'))[_0x1ffe('0xe')](socket);function respondWithRpcPromise(_0x4774a8,_0x1cc54d,_0x558992){return new BPromise(function(_0x415a78,_0x29ef39){return client[_0x1ffe('0xf')](_0x4774a8,_0x558992)[_0x1ffe('0x10')](function(_0x2c48c3){logger[_0x1ffe('0x11')](_0x1ffe('0x12'),_0x1cc54d,_0x1ffe('0x13'));logger['debug'](_0x1ffe('0x14'),_0x1cc54d,_0x1ffe('0x13'),JSON['stringify'](_0x2c48c3));if(_0x2c48c3[_0x1ffe('0x15')]){if(_0x2c48c3[_0x1ffe('0x15')][_0x1ffe('0x16')]===0x1f4){logger[_0x1ffe('0x15')](_0x1ffe('0x12'),_0x1cc54d,_0x2c48c3['error'][_0x1ffe('0x17')]);return _0x29ef39(_0x2c48c3[_0x1ffe('0x15')][_0x1ffe('0x17')]);}logger['error'](_0x1ffe('0x12'),_0x1cc54d,_0x2c48c3['error'][_0x1ffe('0x17')]);return _0x415a78(_0x2c48c3['error'][_0x1ffe('0x17')]);}else{logger[_0x1ffe('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1cc54d,'request\x20sent');_0x415a78(_0x2c48c3['result'][_0x1ffe('0x17')]);}})[_0x1ffe('0x18')](function(_0x129865){logger[_0x1ffe('0x15')](_0x1ffe('0x12'),_0x1cc54d,_0x129865);_0x29ef39(_0x129865);});});}exports[_0x1ffe('0x19')]=function(_0x3b23b1){var _0x1c87f7=this;return new Promise(function(_0x399106,_0x38f189){return db[_0x1ffe('0x1a')][_0x1ffe('0x1b')](_0x3b23b1['body'],{'raw':_0x3b23b1['options']?_0x3b23b1[_0x1ffe('0x1c')][_0x1ffe('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b23b1[_0x1ffe('0x1c')]?_0x3b23b1['options']['where']||null:null,'attributes':_0x3b23b1[_0x1ffe('0x1c')]?_0x3b23b1[_0x1ffe('0x1c')][_0x1ffe('0x1e')]||null:null,'limit':_0x3b23b1['options']?_0x3b23b1[_0x1ffe('0x1c')][_0x1ffe('0x1f')]||null:null})[_0x1ffe('0x10')](function(_0x3df636){logger[_0x1ffe('0x11')](_0x1ffe('0x19'),_0x3b23b1);logger['debug'](_0x1ffe('0x19'),_0x3b23b1,JSON[_0x1ffe('0x20')](_0x3df636));_0x399106(_0x3df636);})[_0x1ffe('0x18')](function(_0x34e9e6){logger[_0x1ffe('0x15')](_0x1ffe('0x19'),_0x34e9e6[_0x1ffe('0x17')],_0x3b23b1);_0x38f189(_0x1c87f7['error'](0x1f4,_0x34e9e6['message']));});});};exports['AddTagsToMailInteraction']=function(_0x2550e5){return new Promise(function(_0x56ef11,_0x33b011){return db[_0x1ffe('0x1a')][_0x1ffe('0x21')]({'where':_0x2550e5['options']?_0x2550e5[_0x1ffe('0x1c')][_0x1ffe('0x22')]||null:null})[_0x1ffe('0x10')](function(_0x3c95a0){if(_0x3c95a0){return _0x3c95a0[_0x1ffe('0x23')](_0x2550e5['body'][_0x1ffe('0x24')],_[_0x1ffe('0x25')](_0x2550e5[_0x1ffe('0x26')],[_0x1ffe('0x24'),'id'])||{});}})[_0x1ffe('0x27')](function(_0x1c369a){logger['info'](_0x1ffe('0x28'),_0x2550e5);logger['debug'](_0x1ffe('0x28'),_0x2550e5,JSON[_0x1ffe('0x20')](_0x1c369a));_0x56ef11(_0x1c369a);})[_0x1ffe('0x18')](function(_0x22e814){logger[_0x1ffe('0x15')]('AddTags',_0x22e814['message'],_0x2550e5);_0x33b011(_this[_0x1ffe('0x15')](0x1f4,_0x22e814['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6abadd7..4eb14dc 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 _0xd1da=['./mailInteraction.events','save','remove','removeListener','register','length','mailInteraction:'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xd1da,0xe0));var _0xad1d=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xd1da[_0x251d9c];return _0x16ae64;};'use strict';var MailInteractionEvents=require(_0xad1d('0x0'));var events=[_0xad1d('0x1'),_0xad1d('0x2'),'update'];function createListener(_0x36200b,_0x46b231){return function(_0xfafb91){_0x46b231['emit'](_0x36200b,_0xfafb91);};}function removeListener(_0x4cee3a,_0x2589bb){return function(){MailInteractionEvents[_0xad1d('0x3')](_0x4cee3a,_0x2589bb);};}exports[_0xad1d('0x4')]=function(_0x50addc){for(var _0x4800ca=0x0,_0x13a2b2=events[_0xad1d('0x5')];_0x4800ca<_0x13a2b2;_0x4800ca++){var _0xcc74d2=events[_0x4800ca];var _0x57240c=createListener(_0xad1d('0x6')+_0xcc74d2,_0x50addc);MailInteractionEvents['on'](_0xcc74d2,_0x57240c);}}; \ No newline at end of file +var _0xfc91=['register','length','mailInteraction:','./mailInteraction.events','save','remove','emit'];(function(_0x42a17b,_0x4d0b45){var _0x6d4203=function(_0x2be00d){while(--_0x2be00d){_0x42a17b['push'](_0x42a17b['shift']());}};_0x6d4203(++_0x4d0b45);}(_0xfc91,0xc7));var _0x1fc9=function(_0x5725c7,_0x263d29){_0x5725c7=_0x5725c7-0x0;var _0x4bb926=_0xfc91[_0x5725c7];return _0x4bb926;};'use strict';var MailInteractionEvents=require(_0x1fc9('0x0'));var events=[_0x1fc9('0x1'),_0x1fc9('0x2'),'update'];function createListener(_0x78ab14,_0x5c94e9){return function(_0x28328f){_0x5c94e9[_0x1fc9('0x3')](_0x78ab14,_0x28328f);};}function removeListener(_0x40bab1,_0x26251c){return function(){MailInteractionEvents['removeListener'](_0x40bab1,_0x26251c);};}exports[_0x1fc9('0x4')]=function(_0x2f7d26){for(var _0x4d379e=0x0,_0x4f0aa3=events[_0x1fc9('0x5')];_0x4d379e<_0x4f0aa3;_0x4d379e++){var _0x2e33ae=events[_0x4d379e];var _0x2450ef=createListener(_0x1fc9('0x6')+_0x2e33ae,_0x2f7d26);MailInteractionEvents['on'](_0x2e33ae,_0x2450ef);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index b2bfd9e..783d6dd 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 _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x98a8,0x12c));var _0x898a=function(_0x5f07df,_0x45339a){_0x5f07df=_0x5f07df-0x0;var _0x121b66=_0x98a8[_0x5f07df];return _0x121b66;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file +var _0x84ab=['reject','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x42fbdd,_0xbb21a3){var _0x525b95=function(_0x330481){while(--_0x330481){_0x42fbdd['push'](_0x42fbdd['shift']());}};_0x525b95(++_0xbb21a3);}(_0x84ab,0x12f));var _0xb84a=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x84ab[_0x489b87];return _0x1823b6;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var auth=require(_0xb84a('0x5'));var interaction=require(_0xb84a('0x6'));var config=require('../../config/environment');var controller=require(_0xb84a('0x7'));router[_0xb84a('0x8')]('/',auth[_0xb84a('0x9')](),controller['index']);router['get']('/describe',auth[_0xb84a('0x9')](),controller['describe']);router[_0xb84a('0x8')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router['get'](_0xb84a('0xc'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xb84a('0xe'),_0xb84a('0xf')),controller[_0xb84a('0x10')]);router[_0xb84a('0x11')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0x12')]);router[_0xb84a('0x11')](_0xb84a('0x13'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x14')]);router[_0xb84a('0x11')](_0xb84a('0x15'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x16')]);router[_0xb84a('0x17')](_0xb84a('0xa'),auth[_0xb84a('0x9')](),controller['destroy']);module[_0xb84a('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 8391fba..f6899a4 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 _0xc5df=['long','DATE','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x3df209,_0xcd5524){var _0x579787=function(_0x2ff443){while(--_0x2ff443){_0x3df209['push'](_0x3df209['shift']());}};_0x579787(++_0xcd5524);}(_0xc5df,0x80));var _0xfc5d=function(_0x387767,_0x3fc71e){_0x387767=_0x387767-0x0;var _0xb463d2=_0xc5df[_0x387767];return _0xb463d2;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xfc5d('0x0')]={'body':{'type':Sequelize[_0xfc5d('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xfc5d('0x2'))},'read':{'type':Sequelize[_0xfc5d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfc5d('0x4')]('in',_0xfc5d('0x5')),'defaultValue':_0xfc5d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xfc5d('0x6')]},'to':{'type':Sequelize[_0xfc5d('0x1')](_0xfc5d('0x7'))},'cc':{'type':Sequelize[_0xfc5d('0x1')](_0xfc5d('0x7'))},'bcc':{'type':Sequelize[_0xfc5d('0x1')]('long')},'subject':{'type':Sequelize[_0xfc5d('0x1')]},'sentAt':{'type':Sequelize[_0xfc5d('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfc5d('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xfc5d('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xfc5d('0x7'))},'originCc':{'type':Sequelize[_0xfc5d('0x1')](_0xfc5d('0x7'))}}; \ No newline at end of file +var _0xa848=['long','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','sequelize','lodash','exports'];(function(_0xf9cc69,_0x2163ba){var _0x8d9bc7=function(_0x3e080a){while(--_0x3e080a){_0xf9cc69['push'](_0xf9cc69['shift']());}};_0x8d9bc7(++_0x2163ba);}(_0xa848,0x99));var _0x8a84=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa848[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x8a84('0x0'));var _=require(_0x8a84('0x1'));module[_0x8a84('0x2')]={'body':{'type':Sequelize['TEXT'](_0x8a84('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x5'))},'read':{'type':Sequelize[_0x8a84('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8a84('0x7')]('in',_0x8a84('0x8')),'defaultValue':_0x8a84('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8a84('0x9')](0x1fe)},'from':{'type':Sequelize[_0x8a84('0x9')]},'to':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x3'))},'cc':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x3'))},'bcc':{'type':Sequelize[_0x8a84('0x4')]('long')},'subject':{'type':Sequelize[_0x8a84('0x4')]},'sentAt':{'type':Sequelize[_0x8a84('0xa')]},'attach':{'type':Sequelize[_0x8a84('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8a84('0xa')]},'originTo':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x3'))},'originCc':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3eac686..cd1cd89 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 _0xdf70=['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','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','body','describe','create','direction','secret','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','ListId','List\x20not\x20found','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','Contact','get','MailInteraction','read1stAt','interaction','role','AcceptMessage','manual','interface','channel','event','EventManager','MailInteractionId','RejectMessage','reject','rejectmessage','download','unix','toString','server','from','bcc','subject','Attachment','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','Sequelize'];(function(_0xe42905,_0x4e0e9a){var _0x23df4e=function(_0x3d16a6){while(--_0x3d16a6){_0xe42905['push'](_0xe42905['shift']());}};_0x23df4e(++_0x4e0e9a);}(_0xdf70,0x86));var _0x0df7=function(_0x168c41,_0x4d5871){_0x168c41=_0x168c41-0x0;var _0xed0f90=_0xdf70[_0x168c41];return _0xed0f90;};'use strict';var pdf=require(_0x0df7('0x0'));var emlformat=require(_0x0df7('0x1'));var rimraf=require(_0x0df7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0df7('0x3'));var rp=require(_0x0df7('0x4'));var moment=require('moment');var BPromise=require(_0x0df7('0x5'));var Mustache=require('mustache');var util=require(_0x0df7('0x6'));var path=require(_0x0df7('0x7'));var sox=require('sox');var csv=require(_0x0df7('0x8'));var ejs=require(_0x0df7('0x9'));var fs=require('fs');var _=require(_0x0df7('0xa'));var squel=require('squel');var crypto=require(_0x0df7('0xb'));var jsforce=require(_0x0df7('0xc'));var deskjs=require(_0x0df7('0xd'));var toCsv=require(_0x0df7('0x8'));var querystring=require(_0x0df7('0xe'));var Papa=require(_0x0df7('0xf'));var Redis=require('ioredis');var authService=require(_0x0df7('0x10'));var qs=require(_0x0df7('0x11'));var as=require(_0x0df7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0df7('0x13'))(_0x0df7('0x14'));var utils=require(_0x0df7('0x15'));var config=require('../../config/environment');var db=require(_0x0df7('0x16'))['db'];config[_0x0df7('0x17')]=_[_0x0df7('0x18')](config['redis'],{'host':_0x0df7('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0df7('0x1a'))[_0x0df7('0x1b')](socket);var jayson=require(_0x0df7('0x1c'));var client=jayson[_0x0df7('0x1d')]['http']({'port':0x232c});var client9003=jayson[_0x0df7('0x1d')][_0x0df7('0x1e')]({'port':0x232b});var client9002=jayson[_0x0df7('0x1d')][_0x0df7('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x2c0399,_0x563951,_0x12945d){if(_0x12945d){var _0x4161d1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4161d1['test'](_0x563951)){return _0x2c0399;}else{throw new db[(_0x0df7('0x1f'))][(_0x0df7('0x20'))](_0x0df7('0x21'));}}else{return _0x2c0399;}}function respondWithRpcPromise(_0x124582,_0x32b3bd,_0x29ac87,_0x31a41c){return new BPromise(function(_0x501f13,_0x3339db){var _0x474004=_0x31a41c||client;return _0x474004['request'](_0x124582,_0x29ac87)[_0x0df7('0x22')](function(_0x51b3a5){logger[_0x0df7('0x23')](_0x0df7('0x24'),_0x32b3bd,_0x0df7('0x25'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x32b3bd,_0x0df7('0x25'),JSON[_0x0df7('0x26')](_0x51b3a5));if(_0x51b3a5[_0x0df7('0x27')]){if(_0x51b3a5['error'][_0x0df7('0x28')]===0x1f4){logger[_0x0df7('0x27')](_0x0df7('0x24'),_0x32b3bd,_0x51b3a5['error'][_0x0df7('0x29')]);return _0x3339db(_0x51b3a5[_0x0df7('0x27')]['message']);}logger[_0x0df7('0x27')](_0x0df7('0x24'),_0x32b3bd,_0x51b3a5[_0x0df7('0x27')][_0x0df7('0x29')]);return _0x501f13(_0x51b3a5['error'][_0x0df7('0x29')]);}else{logger[_0x0df7('0x23')](_0x0df7('0x24'),_0x32b3bd,'request\x20sent');_0x501f13(_0x51b3a5[_0x0df7('0x2a')][_0x0df7('0x29')]);}})['catch'](function(_0x41fbd8){logger[_0x0df7('0x27')](_0x0df7('0x24'),_0x32b3bd,_0x41fbd8);_0x3339db(_0x41fbd8);});});}function respondWithStatusCode(_0x5d104a,_0x1fe12a){_0x1fe12a=_0x1fe12a||0xcc;return function(_0x449966){if(_0x449966){return _0x5d104a[_0x0df7('0x2b')](_0x1fe12a);}return _0x5d104a[_0x0df7('0x2c')](_0x1fe12a)[_0x0df7('0x2d')]();};}function respondWithResult(_0x7437ff,_0x2d2acc){_0x2d2acc=_0x2d2acc||0xc8;return function(_0xe62dcf){if(_0xe62dcf){return _0x7437ff[_0x0df7('0x2c')](_0x2d2acc)[_0x0df7('0x2e')](_0xe62dcf);}};}function respondWithFilteredResult(_0x4a4880,_0x14d31c){return function(_0x1e88a9){if(_0x1e88a9){var _0x2f7ada=_0x1e88a9[_0x0df7('0x2f')],_0x19d002=_0x14d31c[_0x0df7('0x30')],_0x2422e2=_0x14d31c[_0x0df7('0x30')]+_0x14d31c[_0x0df7('0x31')],_0x578699;if(_0x2422e2>=_0x2f7ada){_0x2422e2=_0x2f7ada;_0x578699=0xc8;}else{_0x578699=0xce;}_0x4a4880[_0x0df7('0x2c')](_0x578699);return _0x4a4880[_0x0df7('0x32')](_0x0df7('0x33'),_0x19d002+'-'+_0x2422e2+'/'+_0x2f7ada)[_0x0df7('0x2e')](_0x1e88a9);}return null;};}function patchUpdates(_0x1071e5){return function(_0x1cf0d6){try{jsonpatch[_0x0df7('0x34')](_0x1cf0d6,_0x1071e5,!![]);}catch(_0x15ffca){return BPromise['reject'](_0x15ffca);}return _0x1cf0d6[_0x0df7('0x35')]();};}function saveUpdates(_0x5cd802,_0x34849b){return function(_0x58a43c){if(_0x58a43c){return _0x58a43c[_0x0df7('0x36')](_0x5cd802)['then'](function(_0x4122ec){return _0x4122ec;});}return null;};}function removeEntity(_0x3cf43e,_0x371d5b){return function(_0x47a9e3){if(_0x47a9e3){return _0x47a9e3[_0x0df7('0x37')]()[_0x0df7('0x22')](function(){_0x3cf43e[_0x0df7('0x2c')](0xcc)[_0x0df7('0x2d')]();});}};}function handleEntityNotFound(_0xe23c1b,_0x1a44dd){return function(_0x205c41){if(!_0x205c41){_0xe23c1b['sendStatus'](0x194);}return _0x205c41;};}function handleError(_0x522243,_0x537286){_0x537286=_0x537286||0x1f4;return function(_0x4d5aa2){logger['error'](_0x4d5aa2[_0x0df7('0x38')]);if(_0x4d5aa2['name']){delete _0x4d5aa2['name'];}_0x522243['status'](_0x537286)[_0x0df7('0x39')](_0x4d5aa2);};}exports[_0x0df7('0x3a')]=function(_0x240a3e,_0x768a12){var _0x2a997c={},_0x47aa1c={},_0x79718d={'count':0x0,'rows':[]};var _0x29f940=_['map'](db[_0x0df7('0x3b')][_0x0df7('0x3c')],function(_0x1285cb){return{'name':_0x1285cb[_0x0df7('0x3d')],'type':_0x1285cb[_0x0df7('0x3e')][_0x0df7('0x3f')]};});_0x47aa1c[_0x0df7('0x40')]=_[_0x0df7('0x41')](_0x29f940,_0x0df7('0x42'));_0x47aa1c[_0x0df7('0x43')]=_['keys'](_0x240a3e[_0x0df7('0x43')]);_0x47aa1c['filters']=_[_0x0df7('0x44')](_0x47aa1c[_0x0df7('0x40')],_0x47aa1c[_0x0df7('0x43')]);_0x2a997c[_0x0df7('0x45')]=_[_0x0df7('0x44')](_0x47aa1c['model'],qs[_0x0df7('0x46')](_0x240a3e[_0x0df7('0x43')][_0x0df7('0x46')]));_0x2a997c[_0x0df7('0x45')]=_0x2a997c['attributes'][_0x0df7('0x47')]?_0x2a997c['attributes']:_0x47aa1c['model'];if(!_0x240a3e[_0x0df7('0x43')][_0x0df7('0x48')](_0x0df7('0x49'))){_0x2a997c[_0x0df7('0x31')]=qs[_0x0df7('0x31')](_0x240a3e[_0x0df7('0x43')][_0x0df7('0x31')]);_0x2a997c[_0x0df7('0x30')]=qs[_0x0df7('0x30')](_0x240a3e['query']['offset']);}_0x2a997c[_0x0df7('0x4a')]=qs[_0x0df7('0x4b')](_0x240a3e['query'][_0x0df7('0x4b')]);_0x2a997c[_0x0df7('0x4c')]=qs['filters'](_['pick'](_0x240a3e[_0x0df7('0x43')],_0x47aa1c[_0x0df7('0x4d')]),_0x29f940);if(_0x240a3e[_0x0df7('0x43')][_0x0df7('0x4e')]){_0x2a997c[_0x0df7('0x4c')]=_[_0x0df7('0x4f')](_0x2a997c[_0x0df7('0x4c')],{'$or':_[_0x0df7('0x41')](_0x29f940,function(_0x1abd1f){if(_0x1abd1f[_0x0df7('0x3e')]!==_0x0df7('0x50')){var _0x1983de={};_0x1983de[_0x1abd1f[_0x0df7('0x42')]]={'$like':'%'+_0x240a3e[_0x0df7('0x43')]['filter']+'%'};return _0x1983de;}})});}_0x2a997c=_[_0x0df7('0x4f')]({},_0x2a997c,_0x240a3e[_0x0df7('0x51')]);var _0xc89edd={'where':_0x2a997c[_0x0df7('0x4c')]};return db[_0x0df7('0x3b')][_0x0df7('0x2f')](_0xc89edd)['then'](function(_0x4f12f3){_0x79718d[_0x0df7('0x2f')]=_0x4f12f3;if(_0x240a3e[_0x0df7('0x43')][_0x0df7('0x52')]){_0x2a997c['include']=[{'all':!![]}];}return db[_0x0df7('0x3b')][_0x0df7('0x53')](_0x2a997c);})[_0x0df7('0x22')](function(_0x1ecab5){_0x79718d['rows']=_0x1ecab5;return _0x79718d;})[_0x0df7('0x22')](respondWithFilteredResult(_0x768a12,_0x2a997c))[_0x0df7('0x54')](handleError(_0x768a12,null));};exports[_0x0df7('0x55')]=function(_0x570822,_0xc32ca5){var _0x8e3830={'raw':!![],'where':{'id':_0x570822[_0x0df7('0x56')]['id']}},_0x3d9189={};_0x3d9189[_0x0df7('0x40')]=_['keys'](db[_0x0df7('0x3b')][_0x0df7('0x3c')]);_0x3d9189[_0x0df7('0x43')]=_[_0x0df7('0x57')](_0x570822[_0x0df7('0x43')]);_0x3d9189['filters']=_[_0x0df7('0x44')](_0x3d9189[_0x0df7('0x40')],_0x3d9189[_0x0df7('0x43')]);_0x8e3830[_0x0df7('0x45')]=_[_0x0df7('0x44')](_0x3d9189[_0x0df7('0x40')],qs[_0x0df7('0x46')](_0x570822[_0x0df7('0x43')][_0x0df7('0x46')]));_0x8e3830[_0x0df7('0x45')]=_0x8e3830[_0x0df7('0x45')]['length']?_0x8e3830[_0x0df7('0x45')]:_0x3d9189[_0x0df7('0x40')];if(_0x570822[_0x0df7('0x43')][_0x0df7('0x52')]){_0x8e3830[_0x0df7('0x58')]=[{'all':!![]}];}_0x8e3830=_['merge']({},_0x8e3830,_0x570822['options']);return db[_0x0df7('0x3b')][_0x0df7('0x59')](_0x8e3830)['then'](handleEntityNotFound(_0xc32ca5,null))[_0x0df7('0x22')](respondWithResult(_0xc32ca5,null))['catch'](handleError(_0xc32ca5,null));};exports[_0x0df7('0x36')]=function(_0x36cba9,_0x2f8bcd){if(_0x36cba9[_0x0df7('0x5a')]['id']){delete _0x36cba9[_0x0df7('0x5a')]['id'];}return db[_0x0df7('0x3b')]['find']({'where':{'id':_0x36cba9[_0x0df7('0x56')]['id']}})['then'](handleEntityNotFound(_0x2f8bcd,null))[_0x0df7('0x22')](saveUpdates(_0x36cba9[_0x0df7('0x5a')],null))[_0x0df7('0x22')](respondWithResult(_0x2f8bcd,null))[_0x0df7('0x54')](handleError(_0x2f8bcd,null));};exports['destroy']=function(_0x4c0ffa,_0x5d3f59){return db[_0x0df7('0x3b')]['find']({'where':{'id':_0x4c0ffa['params']['id']}})[_0x0df7('0x22')](handleEntityNotFound(_0x5d3f59,null))[_0x0df7('0x22')](removeEntity(_0x5d3f59,null))[_0x0df7('0x54')](handleError(_0x5d3f59,null));};exports[_0x0df7('0x5b')]=function(_0xb2a48a,_0x58c55e){return db[_0x0df7('0x3b')]['describe']()[_0x0df7('0x22')](respondWithResult(_0x58c55e,null))[_0x0df7('0x54')](handleError(_0x58c55e,null));};exports[_0x0df7('0x5c')]=function(_0x548128,_0x547ee6){return db['MailMessage']['create'](_0x548128['body'])['then'](function(_0xd719af){if(_0xd719af){if(_0xd719af[_0x0df7('0x5d')]==='out'&&!_0xd719af[_0x0df7('0x5e')]){var _0x550a79,_0x33f46c,_0x386e7b;if(_0x548128[_0x0df7('0x5a')]['to']){_0x33f46c=_0x548128['body']['to'][_0x0df7('0x5f')](',')[0x0];}return db['MailAccount'][_0x0df7('0x60')]({'where':{'id':_0xd719af[_0x0df7('0x61')]},'include':[{'model':db[_0x0df7('0x62')],'as':_0x0df7('0x63'),'include':[{'model':db[_0x0df7('0x64')],'as':_0x0df7('0x65'),'where':{'email':_0x33f46c},'limit':0x1,'order':[['updatedAt',_0x0df7('0x66')]]}]},{'model':db[_0x0df7('0x67')],'as':_0x0df7('0x68'),'raw':!![]}]})['then'](function(_0x33b64b){_0x550a79=_0x33b64b;if(_0x550a79&&_0x550a79[_0x0df7('0x68')]){var _0x86c26f={'tls':{'rejectUnauthorized':![]}};if(_[_0x0df7('0x69')](_0x550a79[_0x0df7('0x68')][_0x0df7('0x6a')])){_0x86c26f['host']=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6b')];_0x86c26f['port']=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6c')];_0x86c26f[_0x0df7('0x6d')]=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6d')];if(_0x550a79['Smtp'][_0x0df7('0x6e')]){_0x86c26f[_0x0df7('0x6f')]={'user':_0x550a79[_0x0df7('0x68')][_0x0df7('0x70')],'pass':_0x550a79['Smtp'][_0x0df7('0x71')]};}}else{_0x86c26f[_0x0df7('0x6a')]=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6a')];_0x86c26f[_0x0df7('0x6f')]={'user':_0x550a79[_0x0df7('0x68')]['user'],'pass':_0x550a79['Smtp'][_0x0df7('0x71')]};_0x86c26f['secure']=_0x550a79[_0x0df7('0x68')][_0x0df7('0x6d')];}if(_0x548128[_0x0df7('0x5a')][_0x0df7('0x72')]&&_0x548128[_0x0df7('0x5a')][_0x0df7('0x72')][_0x0df7('0x47')]){for(var _0x3fdc47=0x0;_0x3fdc47<_0x548128[_0x0df7('0x5a')][_0x0df7('0x72')]['length'];_0x3fdc47+=0x1){_0x548128[_0x0df7('0x5a')]['attachments'][_0x3fdc47]={'filename':_0x548128[_0x0df7('0x5a')][_0x0df7('0x72')][_0x3fdc47][_0x0df7('0x42')],'path':path[_0x0df7('0x73')](config[_0x0df7('0x74')],_0x0df7('0x75'),_0x548128[_0x0df7('0x5a')]['attachments'][_0x3fdc47]['basename'])};}}_0x386e7b={'account':_0x86c26f,'message':_0x548128[_0x0df7('0x5a')]};return;}})[_0x0df7('0x22')](function(){if(_0x550a79['List']){if(_0x550a79['List']['Contacts'][_0x0df7('0x47')]){return _0x550a79[_0x0df7('0x63')][_0x0df7('0x65')][0x0];}else{return db[_0x0df7('0x64')][_0x0df7('0x5c')](_[_0x0df7('0x18')](_0x548128[_0x0df7('0x5a')],{'firstName':_0x548128[_0x0df7('0x5a')]['to'],'email':_0x548128[_0x0df7('0x5a')]['to'],'phone':_0x548128[_0x0df7('0x5a')]['to'],'ListId':_0x550a79[_0x0df7('0x76')]}));}}else{throw new Error(_0x0df7('0x77'));}})['then'](function(){if(_0x386e7b){return respondWithRpcPromise('SendMail',_0x0df7('0x78'),_0x386e7b,client9003)[_0x0df7('0x22')](function(_0x2709b3){return _0xd719af[_0x0df7('0x36')]({'read':!![],'messageId':_0x2709b3[_0x0df7('0x79')],'sentAt':moment()['format'](_0x0df7('0x7a'))});})[_0x0df7('0x54')](function(_0x58feec){logger[_0x0df7('0x27')]('%s',JSON[_0x0df7('0x26')](_0x58feec));return _0xd719af;});}return _0xd719af;});}return _0xd719af;}})[_0x0df7('0x22')](respondWithResult(_0x547ee6,0xc9))['catch'](handleError(_0x547ee6,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0x0df7('0x7b')]=function(_0x4ed97c,_0x246f1a,_0x924ba0){var _0x29bf63={'channel':_0x0df7('0x7c')};if(_0x4ed97c['body']['id']){delete _0x4ed97c['body']['id'];}_0x4ed97c['body'][_0x0df7('0x7d')]=!![];_0x4ed97c[_0x0df7('0x5a')][_0x0df7('0x7e')]=moment()[_0x0df7('0x7f')](_0x0df7('0x7a'));_0x4ed97c['body']['UserId']=_0x4ed97c[_0x0df7('0x5a')][_0x0df7('0x80')]||_0x4ed97c[_0x0df7('0x70')]['id'];return db[_0x0df7('0x3b')][_0x0df7('0x59')]({'where':{'id':_0x4ed97c[_0x0df7('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x0df7('0x64')],'as':_0x0df7('0x81')}]})[_0x0df7('0x22')](handleEntityNotFound(_0x246f1a,null))[_0x0df7('0x22')](saveUpdates(_0x4ed97c[_0x0df7('0x5a')],null))['then'](function(_0x7c1e2d){if(_0x7c1e2d){_0x29bf63[_0x0df7('0x29')]=_0x7c1e2d[_0x0df7('0x82')]({'plain':!![]});return db[_0x0df7('0x83')][_0x0df7('0x59')]({'where':{'id':_0x7c1e2d['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x246f1a,null))[_0x0df7('0x22')](function(_0x792577){if(_0x792577){return _0x792577[_0x0df7('0x36')]({'UserId':_0x4ed97c[_0x0df7('0x5a')][_0x0df7('0x80')],'read1stAt':_[_0x0df7('0x69')](_0x792577[_0x0df7('0x84')])?moment()[_0x0df7('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0df7('0x22')](function(_0x3a002c){if(_0x3a002c){_0x29bf63[_0x0df7('0x85')]=_0x3a002c['get']({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ed97c[_0x0df7('0x70')]['id'],_0x4ed97c['user']['name'],_0x4ed97c[_0x0df7('0x70')][_0x0df7('0x86')],_0x29bf63[_0x0df7('0x85')]['id'],_0x4ed97c[_0x0df7('0x5a')]?JSON[_0x0df7('0x26')](_0x4ed97c[_0x0df7('0x5a')]):'null');return respondWithRpcPromise(_0x0df7('0x87'),'acceptMessage',_0x29bf63);}return null;})['then'](function(_0xa38eb8){if(_0xa38eb8){if(_0x4ed97c[_0x0df7('0x5a')][_0x0df7('0x88')]){_0x29bf63[_0x0df7('0x29')][_0x0df7('0x89')]=util['format']('SIP/%s',_0x4ed97c['user']['name']);_0x29bf63[_0x0df7('0x29')][_0x0df7('0x8a')]=_0x29bf63[_0x0df7('0x8a')];_0x29bf63[_0x0df7('0x29')][_0x0df7('0x8b')]=_0x0df7('0x7b');return respondWithRpcPromise(_0x0df7('0x8c'),_0x0df7('0x8c'),{'event':'acceptmessage','message':_0x29bf63[_0x0df7('0x29')]},client9002)['then'](function(){return _0x29bf63;});}return _0x29bf63;}return null;})[_0x0df7('0x22')](respondWithResult(_0x246f1a,null))[_0x0df7('0x54')](handleError(_0x246f1a,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports['reject']=function(_0x4a0ddb,_0x3e8f0a,_0x31b4c7){var _0x24da7f={'agent':{},'channel':_0x0df7('0x7c')};if(_0x4a0ddb[_0x0df7('0x5a')]['id']){delete _0x4a0ddb[_0x0df7('0x5a')]['id'];}_0x4a0ddb[_0x0df7('0x5a')]['UserId']=_0x4a0ddb[_0x0df7('0x5a')]['UserId']||_0x4a0ddb[_0x0df7('0x70')]['id'];_0x24da7f['agent']['id']=_0x4a0ddb[_0x0df7('0x5a')]['UserId'];return db['MailMessage']['find']({'where':{'id':_0x4a0ddb['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e8f0a,null))[_0x0df7('0x22')](function(_0xb228d3){if(_0xb228d3){_0x24da7f[_0x0df7('0x29')]=_0xb228d3[_0x0df7('0x82')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0xb228d3[_0x0df7('0x8d')]}});}return null;})[_0x0df7('0x22')](handleEntityNotFound(_0x3e8f0a,null))['then'](function(_0x41576f){if(_0x41576f){_0x24da7f[_0x0df7('0x85')]=_0x41576f[_0x0df7('0x82')]({'plain':!![]});interaction_log[_0x0df7('0x23')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a0ddb[_0x0df7('0x70')]['id'],_0x4a0ddb[_0x0df7('0x70')][_0x0df7('0x42')],_0x4a0ddb[_0x0df7('0x70')][_0x0df7('0x86')],_0x24da7f['interaction']['id'],_0x4a0ddb[_0x0df7('0x5a')]?JSON[_0x0df7('0x26')](_0x4a0ddb[_0x0df7('0x5a')]):'null');return respondWithRpcPromise(_0x0df7('0x8e'),'rejectMessage',_0x24da7f);}return null;})[_0x0df7('0x22')](function(_0x4227be){if(_0x4227be){_0x4227be[_0x0df7('0x29')][_0x0df7('0x89')]=util['format']('SIP/%s',_0x4a0ddb['user']['name']);_0x4227be[_0x0df7('0x29')]['channel']=_0x24da7f[_0x0df7('0x8a')];_0x4227be[_0x0df7('0x29')]['event']=_0x0df7('0x8f');respondWithRpcPromise(_0x0df7('0x8c'),_0x0df7('0x8c'),{'event':_0x0df7('0x90'),'message':_0x4227be['message']},client9002);return _0x24da7f;}return null;})[_0x0df7('0x22')](respondWithResult(_0x3e8f0a,null))[_0x0df7('0x54')](handleError(_0x3e8f0a,null));};exports[_0x0df7('0x91')]=function(_0x2e3fcb,_0x169320){var _0xd0013a=moment()[_0x0df7('0x92')]()[_0x0df7('0x93')]();var _0x3798b5=path[_0x0df7('0x73')](config['root'],_0x0df7('0x94'),'files','tmp');var _0x1f9434=path[_0x0df7('0x73')](config[_0x0df7('0x74')],_0x0df7('0x94'),'files','attachments');var _0x1d9aab=util[_0x0df7('0x7f')]('message-%s.eml',_0xd0013a);return db[_0x0df7('0x3b')]['find']({'where':{'id':_0x2e3fcb['params']['id']},'attributes':['id',_0x0df7('0x5a'),_0x0df7('0x95'),'to','cc',_0x0df7('0x96'),_0x0df7('0x97'),'createdAt'],'include':_0x2e3fcb[_0x0df7('0x43')][_0x0df7('0x72')]?[{'model':db[_0x0df7('0x98')],'as':_0x0df7('0x99')}]:undefined})['then'](handleEntityNotFound(_0x169320,null))[_0x0df7('0x22')](function(_0xa57fff){if(_0xa57fff){var _0x154ad0=_0xa57fff;var _0x37415c={'from':_0x154ad0[_0x0df7('0x95')],'to':_0x154ad0['to'],'subject':_0x154ad0[_0x0df7('0x97')],'html':_0x154ad0[_0x0df7('0x5a')],'headers':{'Date':moment(_0x154ad0[_0x0df7('0x9a')])[_0x0df7('0x7f')](_0x0df7('0x9b'))},'attachments':[]};if(_0xa57fff['cc']){_0x37415c[_0x0df7('0x9c')]['Cc']=_0xa57fff['cc'];}if(_0xa57fff[_0x0df7('0x96')]){_0x37415c[_0x0df7('0x9c')][_0x0df7('0x9d')]=_0xa57fff[_0x0df7('0x96')];}return new BPromise(function(_0x3f6593,_0x9d97ec){if(_0xa57fff['Attachments']){for(var _0x1824e5=0x0;_0x1824e5<_0xa57fff[_0x0df7('0x99')][_0x0df7('0x47')];_0x1824e5++){var _0x4c1b1d=_0xa57fff[_0x0df7('0x99')][_0x1824e5];var _0x579806=path[_0x0df7('0x73')](_0x1f9434,_0x4c1b1d['basename']);if(fs[_0x0df7('0x9e')](_0x579806)){_0x37415c[_0x0df7('0x72')][_0x0df7('0x9f')]({'name':_0x4c1b1d[_0x0df7('0x42')],'contentType':_0x4c1b1d['type'],'data':fs[_0x0df7('0xa0')](_0x579806)});}}}emlformat[_0x0df7('0xa1')](_0x37415c,function(_0x4bf0a9,_0x156e42){if(_0x4bf0a9)return _0x9d97ec(_0x4bf0a9);fs[_0x0df7('0xa2')](path[_0x0df7('0x73')](_0x3798b5,_0x1d9aab),_0x156e42);return _0x3f6593(_0x156e42);});});}})[_0x0df7('0x22')](function(_0x216b8a){if(_0x216b8a){return _0x169320[_0x0df7('0x91')](path[_0x0df7('0x73')](_0x3798b5,_0x1d9aab),_0x1d9aab,function(_0x2d8b9d){if(_0x2d8b9d){console[_0x0df7('0xa3')](_0x0df7('0xa4'),_0x2d8b9d);}else{fs[_0x0df7('0xa5')](path[_0x0df7('0x73')](_0x3798b5,_0x1d9aab));}});}})[_0x0df7('0x54')](handleError(_0x169320,null));}; \ No newline at end of file +var _0x6dd1=['type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','merge','where','count','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','update','body','params','find','describe','direction','out','secret','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','host','port','secure','authentication','user','pass','service','auth','attachments','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','mail','read','readAt','format','UserId','MailInteraction','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','manual','interface','event','accept','EventManager','acceptmessage','../../config/logger','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SIP/%s','channel','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','join','existsSync','push','readFileSync','writeFileSync','log','err','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','http','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','offset','limit','set','json','apply','reject','save','end','stack','name','send','index','MailMessage'];(function(_0x24783e,_0x48f578){var _0x143b90=function(_0x28daac){while(--_0x28daac){_0x24783e['push'](_0x24783e['shift']());}};_0x143b90(++_0x48f578);}(_0x6dd1,0x111));var _0x16dd=function(_0x577f1a,_0x400939){_0x577f1a=_0x577f1a-0x0;var _0x3ef82f=_0x6dd1[_0x577f1a];return _0x3ef82f;};'use strict';var pdf=require(_0x16dd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x16dd('0x1'));var zipdir=require(_0x16dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16dd('0x3'));var moment=require(_0x16dd('0x4'));var BPromise=require(_0x16dd('0x5'));var Mustache=require(_0x16dd('0x6'));var util=require(_0x16dd('0x7'));var path=require(_0x16dd('0x8'));var sox=require(_0x16dd('0x9'));var csv=require(_0x16dd('0xa'));var ejs=require(_0x16dd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x16dd('0xc'));var toCsv=require(_0x16dd('0xa'));var querystring=require(_0x16dd('0xd'));var Papa=require(_0x16dd('0xe'));var Redis=require('ioredis');var authService=require(_0x16dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x16dd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x16dd('0x11'));var utils=require(_0x16dd('0x12'));var config=require('../../config/environment');var db=require(_0x16dd('0x13'))['db'];config[_0x16dd('0x14')]=_[_0x16dd('0x15')](config['redis'],{'host':_0x16dd('0x16'),'port':0x18eb});var socket=require(_0x16dd('0x17'))(new Redis(config[_0x16dd('0x14')]));require(_0x16dd('0x18'))[_0x16dd('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x16dd('0x1a')]({'port':0x232c});var client9003=jayson['client'][_0x16dd('0x1a')]({'port':0x232b});var client9002=jayson[_0x16dd('0x1b')][_0x16dd('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1719ba,_0x3add51,_0x25817d){if(_0x25817d){var _0x17a646=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x17a646[_0x16dd('0x1c')](_0x3add51)){return _0x1719ba;}else{throw new db['Sequelize'][(_0x16dd('0x1d'))](_0x16dd('0x1e'));}}else{return _0x1719ba;}}function respondWithRpcPromise(_0x15b012,_0x1f171a,_0x3e9236,_0x59fab3){return new BPromise(function(_0x1dcb48,_0x2fb27c){var _0x3f36c0=_0x59fab3||client;return _0x3f36c0[_0x16dd('0x1f')](_0x15b012,_0x3e9236)[_0x16dd('0x20')](function(_0x2c0bd8){logger[_0x16dd('0x21')](_0x16dd('0x22'),_0x1f171a,_0x16dd('0x23'));logger[_0x16dd('0x24')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x1f171a,_0x16dd('0x23'),JSON[_0x16dd('0x25')](_0x2c0bd8));if(_0x2c0bd8[_0x16dd('0x26')]){if(_0x2c0bd8[_0x16dd('0x26')][_0x16dd('0x27')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x1f171a,_0x2c0bd8[_0x16dd('0x26')][_0x16dd('0x28')]);return _0x2fb27c(_0x2c0bd8['error'][_0x16dd('0x28')]);}logger[_0x16dd('0x26')](_0x16dd('0x22'),_0x1f171a,_0x2c0bd8['error'][_0x16dd('0x28')]);return _0x1dcb48(_0x2c0bd8[_0x16dd('0x26')][_0x16dd('0x28')]);}else{logger['info'](_0x16dd('0x22'),_0x1f171a,_0x16dd('0x23'));_0x1dcb48(_0x2c0bd8[_0x16dd('0x29')]['message']);}})['catch'](function(_0x2dace6){logger[_0x16dd('0x26')]('MailMessage,\x20%s,\x20%s',_0x1f171a,_0x2dace6);_0x2fb27c(_0x2dace6);});});}function respondWithStatusCode(_0x4ab0fb,_0x511816){_0x511816=_0x511816||0xcc;return function(_0x2329fe){if(_0x2329fe){return _0x4ab0fb[_0x16dd('0x2a')](_0x511816);}return _0x4ab0fb[_0x16dd('0x2b')](_0x511816)['end']();};}function respondWithResult(_0x455b1d,_0xb5e868){_0xb5e868=_0xb5e868||0xc8;return function(_0x33af6f){if(_0x33af6f){return _0x455b1d[_0x16dd('0x2b')](_0xb5e868)['json'](_0x33af6f);}};}function respondWithFilteredResult(_0x134d7e,_0x2057e4){return function(_0x4ca886){if(_0x4ca886){var _0x1d9e3e=_0x4ca886['count'],_0x28f033=_0x2057e4[_0x16dd('0x2c')],_0x4ba4a1=_0x2057e4['offset']+_0x2057e4[_0x16dd('0x2d')],_0x46ff2e;if(_0x4ba4a1>=_0x1d9e3e){_0x4ba4a1=_0x1d9e3e;_0x46ff2e=0xc8;}else{_0x46ff2e=0xce;}_0x134d7e[_0x16dd('0x2b')](_0x46ff2e);return _0x134d7e[_0x16dd('0x2e')]('Content-Range',_0x28f033+'-'+_0x4ba4a1+'/'+_0x1d9e3e)[_0x16dd('0x2f')](_0x4ca886);}return null;};}function patchUpdates(_0x2bbcb4){return function(_0x49bc0c){try{jsonpatch[_0x16dd('0x30')](_0x49bc0c,_0x2bbcb4,!![]);}catch(_0x3fe7f1){return BPromise[_0x16dd('0x31')](_0x3fe7f1);}return _0x49bc0c[_0x16dd('0x32')]();};}function saveUpdates(_0x51d8fa,_0x361f40){return function(_0x101916){if(_0x101916){return _0x101916['update'](_0x51d8fa)[_0x16dd('0x20')](function(_0x53694d){return _0x53694d;});}return null;};}function removeEntity(_0xa04fee,_0x3128b1){return function(_0x4af652){if(_0x4af652){return _0x4af652['destroy']()[_0x16dd('0x20')](function(){_0xa04fee[_0x16dd('0x2b')](0xcc)[_0x16dd('0x33')]();});}};}function handleEntityNotFound(_0x2a09ec,_0x2134d2){return function(_0x7edb3f){if(!_0x7edb3f){_0x2a09ec[_0x16dd('0x2a')](0x194);}return _0x7edb3f;};}function handleError(_0x2bbed9,_0x12c14e){_0x12c14e=_0x12c14e||0x1f4;return function(_0x58ce74){logger[_0x16dd('0x26')](_0x58ce74[_0x16dd('0x34')]);if(_0x58ce74[_0x16dd('0x35')]){delete _0x58ce74['name'];}_0x2bbed9[_0x16dd('0x2b')](_0x12c14e)[_0x16dd('0x36')](_0x58ce74);};}exports[_0x16dd('0x37')]=function(_0x1f19bb,_0x4f1465){var _0x4e34a4={},_0x58a2cd={},_0x4c4788={'count':0x0,'rows':[]};var _0x11b826=_['map'](db[_0x16dd('0x38')]['rawAttributes'],function(_0x43dbdc){return{'name':_0x43dbdc['fieldName'],'type':_0x43dbdc[_0x16dd('0x39')][_0x16dd('0x3a')]};});_0x58a2cd[_0x16dd('0x3b')]=_[_0x16dd('0x3c')](_0x11b826,_0x16dd('0x35'));_0x58a2cd[_0x16dd('0x3d')]=_['keys'](_0x1f19bb[_0x16dd('0x3d')]);_0x58a2cd[_0x16dd('0x3e')]=_[_0x16dd('0x3f')](_0x58a2cd[_0x16dd('0x3b')],_0x58a2cd[_0x16dd('0x3d')]);_0x4e34a4[_0x16dd('0x40')]=_['intersection'](_0x58a2cd['model'],qs[_0x16dd('0x41')](_0x1f19bb['query']['fields']));_0x4e34a4[_0x16dd('0x40')]=_0x4e34a4[_0x16dd('0x40')][_0x16dd('0x42')]?_0x4e34a4[_0x16dd('0x40')]:_0x58a2cd[_0x16dd('0x3b')];if(!_0x1f19bb['query']['hasOwnProperty'](_0x16dd('0x43'))){_0x4e34a4[_0x16dd('0x2d')]=qs[_0x16dd('0x2d')](_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x2d')]);_0x4e34a4[_0x16dd('0x2c')]=qs[_0x16dd('0x2c')](_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x2c')]);}_0x4e34a4[_0x16dd('0x44')]=qs[_0x16dd('0x45')](_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x45')]);_0x4e34a4['where']=qs['filters'](_['pick'](_0x1f19bb[_0x16dd('0x3d')],_0x58a2cd[_0x16dd('0x3e')]),_0x11b826);if(_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x46')]){_0x4e34a4['where']=_[_0x16dd('0x47')](_0x4e34a4[_0x16dd('0x48')],{'$or':_[_0x16dd('0x3c')](_0x11b826,function(_0x1694ce){if(_0x1694ce[_0x16dd('0x39')]!=='VIRTUAL'){var _0x1ff461={};_0x1ff461[_0x1694ce[_0x16dd('0x35')]]={'$like':'%'+_0x1f19bb[_0x16dd('0x3d')][_0x16dd('0x46')]+'%'};return _0x1ff461;}})});}_0x4e34a4=_[_0x16dd('0x47')]({},_0x4e34a4,_0x1f19bb['options']);var _0x53258b={'where':_0x4e34a4[_0x16dd('0x48')]};return db['MailMessage']['count'](_0x53258b)[_0x16dd('0x20')](function(_0x305cb5){_0x4c4788[_0x16dd('0x49')]=_0x305cb5;if(_0x1f19bb['query'][_0x16dd('0x4a')]){_0x4e34a4[_0x16dd('0x4b')]=[{'all':!![]}];}return db[_0x16dd('0x38')][_0x16dd('0x4c')](_0x4e34a4);})[_0x16dd('0x20')](function(_0x6a6b5e){_0x4c4788[_0x16dd('0x4d')]=_0x6a6b5e;return _0x4c4788;})[_0x16dd('0x20')](respondWithFilteredResult(_0x4f1465,_0x4e34a4))[_0x16dd('0x4e')](handleError(_0x4f1465,null));};exports[_0x16dd('0x4f')]=function(_0x14c6e5,_0x316d85){var _0x33f878={'raw':!![],'where':{'id':_0x14c6e5['params']['id']}},_0x454aae={};_0x454aae[_0x16dd('0x3b')]=_['keys'](db['MailMessage'][_0x16dd('0x50')]);_0x454aae[_0x16dd('0x3d')]=_[_0x16dd('0x51')](_0x14c6e5[_0x16dd('0x3d')]);_0x454aae['filters']=_[_0x16dd('0x3f')](_0x454aae[_0x16dd('0x3b')],_0x454aae[_0x16dd('0x3d')]);_0x33f878[_0x16dd('0x40')]=_['intersection'](_0x454aae[_0x16dd('0x3b')],qs['fields'](_0x14c6e5[_0x16dd('0x3d')][_0x16dd('0x41')]));_0x33f878[_0x16dd('0x40')]=_0x33f878[_0x16dd('0x40')]['length']?_0x33f878[_0x16dd('0x40')]:_0x454aae[_0x16dd('0x3b')];if(_0x14c6e5[_0x16dd('0x3d')]['includeAll']){_0x33f878[_0x16dd('0x4b')]=[{'all':!![]}];}_0x33f878=_['merge']({},_0x33f878,_0x14c6e5[_0x16dd('0x52')]);return db[_0x16dd('0x38')]['find'](_0x33f878)[_0x16dd('0x20')](handleEntityNotFound(_0x316d85,null))[_0x16dd('0x20')](respondWithResult(_0x316d85,null))[_0x16dd('0x4e')](handleError(_0x316d85,null));};exports[_0x16dd('0x53')]=function(_0x2f6f0c,_0x39df48){if(_0x2f6f0c['body']['id']){delete _0x2f6f0c[_0x16dd('0x54')]['id'];}return db[_0x16dd('0x38')]['find']({'where':{'id':_0x2f6f0c[_0x16dd('0x55')]['id']}})['then'](handleEntityNotFound(_0x39df48,null))['then'](saveUpdates(_0x2f6f0c[_0x16dd('0x54')],null))[_0x16dd('0x20')](respondWithResult(_0x39df48,null))[_0x16dd('0x4e')](handleError(_0x39df48,null));};exports['destroy']=function(_0x450f39,_0x9b195c){return db[_0x16dd('0x38')][_0x16dd('0x56')]({'where':{'id':_0x450f39[_0x16dd('0x55')]['id']}})['then'](handleEntityNotFound(_0x9b195c,null))[_0x16dd('0x20')](removeEntity(_0x9b195c,null))['catch'](handleError(_0x9b195c,null));};exports['describe']=function(_0x40865b,_0x10be1b){return db[_0x16dd('0x38')][_0x16dd('0x57')]()[_0x16dd('0x20')](respondWithResult(_0x10be1b,null))[_0x16dd('0x4e')](handleError(_0x10be1b,null));};exports['create']=function(_0x5845eb,_0x582acf){return db[_0x16dd('0x38')]['create'](_0x5845eb[_0x16dd('0x54')])['then'](function(_0xece166){if(_0xece166){if(_0xece166[_0x16dd('0x58')]===_0x16dd('0x59')&&!_0xece166[_0x16dd('0x5a')]){var _0x78ebef,_0x48d552,_0x5c6317;if(_0x5845eb[_0x16dd('0x54')]['to']){_0x48d552=_0x5845eb[_0x16dd('0x54')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x16dd('0x5b')]({'where':{'id':_0xece166[_0x16dd('0x5c')]},'include':[{'model':db[_0x16dd('0x5d')],'as':_0x16dd('0x5e'),'include':[{'model':db[_0x16dd('0x5f')],'as':_0x16dd('0x60'),'where':{'email':_0x48d552},'limit':0x1,'order':[[_0x16dd('0x61'),_0x16dd('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x16dd('0x63'),'raw':!![]}]})[_0x16dd('0x20')](function(_0x3e5a05){_0x78ebef=_0x3e5a05;if(_0x78ebef&&_0x78ebef[_0x16dd('0x63')]){var _0x24e79f={'tls':{'rejectUnauthorized':![]}};if(_[_0x16dd('0x64')](_0x78ebef[_0x16dd('0x63')]['service'])){_0x24e79f[_0x16dd('0x65')]=_0x78ebef[_0x16dd('0x63')][_0x16dd('0x65')];_0x24e79f[_0x16dd('0x66')]=_0x78ebef[_0x16dd('0x63')][_0x16dd('0x66')];_0x24e79f[_0x16dd('0x67')]=_0x78ebef['Smtp'][_0x16dd('0x67')];if(_0x78ebef[_0x16dd('0x63')][_0x16dd('0x68')]){_0x24e79f['auth']={'user':_0x78ebef[_0x16dd('0x63')][_0x16dd('0x69')],'pass':_0x78ebef['Smtp'][_0x16dd('0x6a')]};}}else{_0x24e79f[_0x16dd('0x6b')]=_0x78ebef[_0x16dd('0x63')][_0x16dd('0x6b')];_0x24e79f[_0x16dd('0x6c')]={'user':_0x78ebef[_0x16dd('0x63')][_0x16dd('0x69')],'pass':_0x78ebef[_0x16dd('0x63')][_0x16dd('0x6a')]};_0x24e79f[_0x16dd('0x67')]=_0x78ebef['Smtp'][_0x16dd('0x67')];}if(_0x5845eb[_0x16dd('0x54')]['attachments']&&_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')][_0x16dd('0x42')]){for(var _0x177c6=0x0;_0x177c6<_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')]['length'];_0x177c6+=0x1){_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')][_0x177c6]={'filename':_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')][_0x177c6][_0x16dd('0x35')],'path':path['join'](config[_0x16dd('0x6e')],_0x16dd('0x6f'),_0x5845eb[_0x16dd('0x54')][_0x16dd('0x6d')][_0x177c6][_0x16dd('0x70')])};}}_0x5c6317={'account':_0x24e79f,'message':_0x5845eb['body']};return;}})[_0x16dd('0x20')](function(){if(_0x78ebef[_0x16dd('0x5e')]){if(_0x78ebef[_0x16dd('0x5e')][_0x16dd('0x60')]['length']){return _0x78ebef[_0x16dd('0x5e')][_0x16dd('0x60')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x5845eb[_0x16dd('0x54')],{'firstName':_0x5845eb['body']['to'],'email':_0x5845eb['body']['to'],'phone':_0x5845eb['body']['to'],'ListId':_0x78ebef['ListId']}));}}else{throw new Error(_0x16dd('0x71'));}})[_0x16dd('0x20')](function(){if(_0x5c6317){return respondWithRpcPromise(_0x16dd('0x72'),_0x16dd('0x73'),_0x5c6317,client9003)[_0x16dd('0x20')](function(_0x173e02){return _0xece166['update']({'read':!![],'messageId':_0x173e02[_0x16dd('0x74')],'sentAt':moment()['format'](_0x16dd('0x75'))});})['catch'](function(_0x1f1a87){logger[_0x16dd('0x26')]('%s',JSON[_0x16dd('0x25')](_0x1f1a87));return _0xece166;});}return _0xece166;});}return _0xece166;}})['then'](respondWithResult(_0x582acf,0xc9))['catch'](handleError(_0x582acf,null));};var interaction_log=require('../../config/logger')(_0x16dd('0x76'));exports['accept']=function(_0x3b09e8,_0x574d1a,_0x45779a){var _0x5a5473={'channel':_0x16dd('0x77')};if(_0x3b09e8['body']['id']){delete _0x3b09e8['body']['id'];}_0x3b09e8['body'][_0x16dd('0x78')]=!![];_0x3b09e8['body'][_0x16dd('0x79')]=moment()[_0x16dd('0x7a')](_0x16dd('0x75'));_0x3b09e8[_0x16dd('0x54')][_0x16dd('0x7b')]=_0x3b09e8[_0x16dd('0x54')][_0x16dd('0x7b')]||_0x3b09e8[_0x16dd('0x69')]['id'];return db[_0x16dd('0x38')][_0x16dd('0x56')]({'where':{'id':_0x3b09e8[_0x16dd('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x16dd('0x5f')],'as':'Contact'}]})[_0x16dd('0x20')](handleEntityNotFound(_0x574d1a,null))['then'](saveUpdates(_0x3b09e8[_0x16dd('0x54')],null))[_0x16dd('0x20')](function(_0x2b670a){if(_0x2b670a){_0x5a5473[_0x16dd('0x28')]=_0x2b670a['get']({'plain':!![]});return db[_0x16dd('0x7c')]['find']({'where':{'id':_0x2b670a['MailInteractionId']}});}return null;})[_0x16dd('0x20')](handleEntityNotFound(_0x574d1a,null))['then'](function(_0x5c6fef){if(_0x5c6fef){return _0x5c6fef[_0x16dd('0x53')]({'UserId':_0x3b09e8[_0x16dd('0x54')]['UserId'],'read1stAt':_[_0x16dd('0x64')](_0x5c6fef[_0x16dd('0x7d')])?moment()[_0x16dd('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x16dd('0x20')](function(_0x5a468e){if(_0x5a468e){_0x5a5473[_0x16dd('0x7e')]=_0x5a468e[_0x16dd('0x7f')]({'plain':!![]});interaction_log[_0x16dd('0x21')](_0x16dd('0x80'),_0x3b09e8[_0x16dd('0x69')]['id'],_0x3b09e8[_0x16dd('0x69')][_0x16dd('0x35')],_0x3b09e8[_0x16dd('0x69')]['role'],_0x5a5473[_0x16dd('0x7e')]['id'],_0x3b09e8[_0x16dd('0x54')]?JSON[_0x16dd('0x25')](_0x3b09e8[_0x16dd('0x54')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5a5473);}return null;})['then'](function(_0x10bfcd){if(_0x10bfcd){if(_0x3b09e8[_0x16dd('0x54')][_0x16dd('0x81')]){_0x5a5473[_0x16dd('0x28')][_0x16dd('0x82')]=util[_0x16dd('0x7a')]('SIP/%s',_0x3b09e8[_0x16dd('0x69')][_0x16dd('0x35')]);_0x5a5473[_0x16dd('0x28')]['channel']=_0x5a5473['channel'];_0x5a5473['message'][_0x16dd('0x83')]=_0x16dd('0x84');return respondWithRpcPromise(_0x16dd('0x85'),_0x16dd('0x85'),{'event':_0x16dd('0x86'),'message':_0x5a5473['message']},client9002)[_0x16dd('0x20')](function(){return _0x5a5473;});}return _0x5a5473;}return null;})[_0x16dd('0x20')](respondWithResult(_0x574d1a,null))['catch'](handleError(_0x574d1a,null));};var interaction_log=require(_0x16dd('0x87'))(_0x16dd('0x76'));exports[_0x16dd('0x31')]=function(_0x29e5fe,_0x1bda75,_0x47fcd3){var _0x4d1983={'agent':{},'channel':'mail'};if(_0x29e5fe[_0x16dd('0x54')]['id']){delete _0x29e5fe[_0x16dd('0x54')]['id'];}_0x29e5fe[_0x16dd('0x54')][_0x16dd('0x7b')]=_0x29e5fe['body'][_0x16dd('0x7b')]||_0x29e5fe[_0x16dd('0x69')]['id'];_0x4d1983[_0x16dd('0x88')]['id']=_0x29e5fe[_0x16dd('0x54')][_0x16dd('0x7b')];return db[_0x16dd('0x38')]['find']({'where':{'id':_0x29e5fe[_0x16dd('0x55')]['id'],'UserId':null}})[_0x16dd('0x20')](handleEntityNotFound(_0x1bda75,null))[_0x16dd('0x20')](function(_0x2dc670){if(_0x2dc670){_0x4d1983[_0x16dd('0x28')]=_0x2dc670[_0x16dd('0x7f')]({'plain':!![]});return db[_0x16dd('0x7c')][_0x16dd('0x56')]({'where':{'id':_0x2dc670['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1bda75,null))['then'](function(_0x5d5d39){if(_0x5d5d39){_0x4d1983[_0x16dd('0x7e')]=_0x5d5d39[_0x16dd('0x7f')]({'plain':!![]});interaction_log[_0x16dd('0x21')](_0x16dd('0x89'),_0x29e5fe[_0x16dd('0x69')]['id'],_0x29e5fe[_0x16dd('0x69')]['name'],_0x29e5fe[_0x16dd('0x69')][_0x16dd('0x8a')],_0x4d1983['interaction']['id'],_0x29e5fe[_0x16dd('0x54')]?JSON[_0x16dd('0x25')](_0x29e5fe['body']):_0x16dd('0x8b'));return respondWithRpcPromise('RejectMessage',_0x16dd('0x8c'),_0x4d1983);}return null;})[_0x16dd('0x20')](function(_0xf2b994){if(_0xf2b994){_0xf2b994[_0x16dd('0x28')][_0x16dd('0x82')]=util['format'](_0x16dd('0x8d'),_0x29e5fe[_0x16dd('0x69')][_0x16dd('0x35')]);_0xf2b994['message']['channel']=_0x4d1983[_0x16dd('0x8e')];_0xf2b994[_0x16dd('0x28')][_0x16dd('0x83')]=_0x16dd('0x31');respondWithRpcPromise('EventManager',_0x16dd('0x85'),{'event':_0x16dd('0x8f'),'message':_0xf2b994[_0x16dd('0x28')]},client9002);return _0x4d1983;}return null;})[_0x16dd('0x20')](respondWithResult(_0x1bda75,null))[_0x16dd('0x4e')](handleError(_0x1bda75,null));};exports[_0x16dd('0x90')]=function(_0x24a069,_0x1e1002){var _0x3858de=moment()[_0x16dd('0x91')]()[_0x16dd('0x92')]();var _0x1b4af4=path['join'](config[_0x16dd('0x6e')],'server','files','tmp');var _0x54050f=path['join'](config['root'],_0x16dd('0x93'),_0x16dd('0x94'),'attachments');var _0x208d33=util['format'](_0x16dd('0x95'),_0x3858de);return db['MailMessage'][_0x16dd('0x56')]({'where':{'id':_0x24a069[_0x16dd('0x55')]['id']},'attributes':['id','body',_0x16dd('0x96'),'to','cc',_0x16dd('0x97'),_0x16dd('0x98'),'createdAt'],'include':_0x24a069[_0x16dd('0x3d')]['attachments']?[{'model':db['Attachment'],'as':_0x16dd('0x99')}]:undefined})['then'](handleEntityNotFound(_0x1e1002,null))[_0x16dd('0x20')](function(_0x4a1c1c){if(_0x4a1c1c){var _0x402250=_0x4a1c1c;var _0x38190a={'from':_0x402250[_0x16dd('0x96')],'to':_0x402250['to'],'subject':_0x402250[_0x16dd('0x98')],'html':_0x402250['body'],'headers':{'Date':moment(_0x402250[_0x16dd('0x9a')])[_0x16dd('0x7a')](_0x16dd('0x9b'))},'attachments':[]};if(_0x4a1c1c['cc']){_0x38190a[_0x16dd('0x9c')]['Cc']=_0x4a1c1c['cc'];}if(_0x4a1c1c[_0x16dd('0x97')]){_0x38190a['headers']['Bcc']=_0x4a1c1c[_0x16dd('0x97')];}return new BPromise(function(_0x252c4c,_0x405e49){if(_0x4a1c1c[_0x16dd('0x99')]){for(var _0x592fc4=0x0;_0x592fc4<_0x4a1c1c['Attachments'][_0x16dd('0x42')];_0x592fc4++){var _0x4e25be=_0x4a1c1c[_0x16dd('0x99')][_0x592fc4];var _0x356f36=path[_0x16dd('0x9d')](_0x54050f,_0x4e25be['basename']);if(fs[_0x16dd('0x9e')](_0x356f36)){_0x38190a[_0x16dd('0x6d')][_0x16dd('0x9f')]({'name':_0x4e25be[_0x16dd('0x35')],'contentType':_0x4e25be[_0x16dd('0x39')],'data':fs[_0x16dd('0xa0')](_0x356f36)});}}}emlformat['build'](_0x38190a,function(_0x2cd653,_0x35f536){if(_0x2cd653)return _0x405e49(_0x2cd653);fs[_0x16dd('0xa1')](path[_0x16dd('0x9d')](_0x1b4af4,_0x208d33),_0x35f536);return _0x252c4c(_0x35f536);});});}})[_0x16dd('0x20')](function(_0x3d59e2){if(_0x3d59e2){return _0x1e1002[_0x16dd('0x90')](path[_0x16dd('0x9d')](_0x1b4af4,_0x208d33),_0x208d33,function(_0x4ee4c3){if(_0x4ee4c3){console[_0x16dd('0xa2')](_0x16dd('0xa3'),_0x4ee4c3);}else{fs[_0x16dd('0xa4')](path['join'](_0x1b4af4,_0x208d33));}});}})[_0x16dd('0x4e')](handleError(_0x1e1002,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 4b29d17..1a4f2a6 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 _0x67ed=['remove','emit','hasOwnProperty','hook','events','MailMessage','setMaxListeners','save','update'];(function(_0x2e6b97,_0x23c3f2){var _0x55c2af=function(_0x5f20c8){while(--_0x5f20c8){_0x2e6b97['push'](_0x2e6b97['shift']());}};_0x55c2af(++_0x23c3f2);}(_0x67ed,0x70));var _0xd67e=function(_0x1ea6b9,_0x46fbfb){_0x1ea6b9=_0x1ea6b9-0x0;var _0x2c9b37=_0x67ed[_0x1ea6b9];return _0x2c9b37;};'use strict';var EventEmitter=require(_0xd67e('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xd67e('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd67e('0x2')](0x0);var events={'afterCreate':_0xd67e('0x3'),'afterUpdate':_0xd67e('0x4'),'afterDestroy':_0xd67e('0x5')};function emitEvent(_0xbc5774){return function(_0x33a6a4,_0x59acdd,_0x5548d9){MailMessageEvents['emit'](_0xbc5774+':'+_0x33a6a4['id'],_0x33a6a4);MailMessageEvents[_0xd67e('0x6')](_0xbc5774,_0x33a6a4);_0x5548d9(null);};}for(var e in events){if(events[_0xd67e('0x7')](e)){var event=events[e];MailMessage[_0xd67e('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xb53a=['emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','save','update','remove'];(function(_0x12ae8c,_0x140092){var _0x4aeb1a=function(_0x488855){while(--_0x488855){_0x12ae8c['push'](_0x12ae8c['shift']());}};_0x4aeb1a(++_0x140092);}(_0xb53a,0x174));var _0xab53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb53a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xab53('0x0'));var MailMessage=require(_0xab53('0x1'))['db'][_0xab53('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab53('0x3'),'afterUpdate':_0xab53('0x4'),'afterDestroy':_0xab53('0x5')};function emitEvent(_0x7af2e4){return function(_0x3c4139,_0x110cdf,_0x44d360){MailMessageEvents[_0xab53('0x6')](_0x7af2e4+':'+_0x3c4139['id'],_0x3c4139);MailMessageEvents['emit'](_0x7af2e4,_0x3c4139);_0x44d360(null);};}for(var e in events){if(events[_0xab53('0x7')](e)){var event=events[e];MailMessage[_0xab53('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 07dbbb5..a8cb8ff 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 _0x2d84=['html-to-text','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x1ead2f,_0x4e5e24){var _0x1ad21d=function(_0x1f5ed3){while(--_0x1f5ed3){_0x1ead2f['push'](_0x1ead2f['shift']());}};_0x1ad21d(++_0x4e5e24);}(_0x2d84,0x181));var _0x42d8=function(_0x20b545,_0x4bba7c){_0x20b545=_0x20b545-0x0;var _0x1baaae=_0x2d84[_0x20b545];return _0x1baaae;};'use strict';var _=require('lodash');var util=require(_0x42d8('0x0'));var logger=require(_0x42d8('0x1'))(_0x42d8('0x2'));var moment=require(_0x42d8('0x3'));var BPromise=require(_0x42d8('0x4'));var rp=require('request-promise');var htmlToText=require(_0x42d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42d8('0x6'));var config=require('../../config/environment');var attributes=require(_0x42d8('0x7'));module[_0x42d8('0x8')]=function(_0x5d99b5,_0x4bab67){return _0x5d99b5[_0x42d8('0x9')](_0x42d8('0xa'),attributes,{'tableName':_0x42d8('0xb'),'paranoid':![],'indexes':[{'name':_0x42d8('0xc'),'fields':[_0x42d8('0xc')]},{'name':_0x42d8('0xd'),'fields':[_0x42d8('0xe'),'subject'],'type':_0x42d8('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x70a5a1,_0x585f7c,_0x2acb5c){if(_0x70a5a1[_0x42d8('0x10')]){_0x70a5a1[_0x42d8('0xe')]=htmlToText[_0x42d8('0x11')](_0x70a5a1[_0x42d8('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2acb5c(null,_0x585f7c);},'afterCreate':function(_0x2fcfd9,_0x5d4fcb,_0x2c7104){var _0x2f8e1c=_0x5d99b5[_0x42d8('0x12')];var _0x5733f7=_0x2fcfd9[_0x42d8('0x13')]({'plain':!![]});if(_0x5733f7[_0x42d8('0x14')][_0x42d8('0x15')]()==='in'||_0x5733f7[_0x42d8('0x14')][_0x42d8('0x15')]()===_0x42d8('0x16')&&!_0x5733f7[_0x42d8('0x17')]&&!_[_0x42d8('0x18')](_0x5733f7['UserId'])){_0x2f8e1c['MailInteraction']['findOne']({'where':{'id':_0x5733f7['MailInteractionId']}})['then'](function(_0x47bd11){if(_0x47bd11){_0x47bd11[_0x42d8('0x19')]({'lastMsgAt':_0x5733f7[_0x42d8('0x1a')],'lastMsgDirection':_0x5733f7[_0x42d8('0x14')][_0x42d8('0x15')](),'lastMsgBody':_0x5733f7[_0x42d8('0x10')]});}})['catch'](function(_0x8a19ab){console[_0x42d8('0x1b')](_0x8a19ab);});}_0x2c7104();}},'charset':_0x42d8('0x1c'),'collate':_0x42d8('0x1d')});}; \ No newline at end of file +var _0x7cfe=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','exports','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','models','get','direction','out','secret','UserId','MailInteraction','findOne','then','update','createdAt','toLowerCase'];(function(_0x376205,_0x285b4b){var _0x2e867b=function(_0x3799c7){while(--_0x3799c7){_0x376205['push'](_0x376205['shift']());}};_0x2e867b(++_0x285b4b);}(_0x7cfe,0xca));var _0xe7cf=function(_0x4778f2,_0x4a3c46){_0x4778f2=_0x4778f2-0x0;var _0x3d138a=_0x7cfe[_0x4778f2];return _0x3d138a;};'use strict';var _=require(_0xe7cf('0x0'));var util=require(_0xe7cf('0x1'));var logger=require(_0xe7cf('0x2'))('api');var moment=require(_0xe7cf('0x3'));var BPromise=require(_0xe7cf('0x4'));var rp=require(_0xe7cf('0x5'));var htmlToText=require(_0xe7cf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7cf('0x7'));var config=require(_0xe7cf('0x8'));var attributes=require('./mailMessage.attributes');module[_0xe7cf('0x9')]=function(_0x32ad7a,_0x352608){return _0x32ad7a['define'](_0xe7cf('0xa'),attributes,{'tableName':_0xe7cf('0xb'),'paranoid':![],'indexes':[{'name':_0xe7cf('0xc'),'fields':[_0xe7cf('0xc')]},{'name':'fti_mail_messages','fields':[_0xe7cf('0xd'),_0xe7cf('0xe')],'type':_0xe7cf('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7f7ef3,_0x670b4b,_0x289bf9){if(_0x7f7ef3[_0xe7cf('0x10')]){_0x7f7ef3[_0xe7cf('0xd')]=htmlToText['fromString'](_0x7f7ef3['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x289bf9(null,_0x670b4b);},'afterCreate':function(_0x1155da,_0x2ad7ef,_0x5089a4){var _0x435f0d=_0x32ad7a[_0xe7cf('0x11')];var _0x52f9e9=_0x1155da[_0xe7cf('0x12')]({'plain':!![]});if(_0x52f9e9['direction']['toLowerCase']()==='in'||_0x52f9e9[_0xe7cf('0x13')]['toLowerCase']()===_0xe7cf('0x14')&&!_0x52f9e9[_0xe7cf('0x15')]&&!_['isNil'](_0x52f9e9[_0xe7cf('0x16')])){_0x435f0d[_0xe7cf('0x17')][_0xe7cf('0x18')]({'where':{'id':_0x52f9e9['MailInteractionId']}})[_0xe7cf('0x19')](function(_0x111c90){if(_0x111c90){_0x111c90[_0xe7cf('0x1a')]({'lastMsgAt':_0x52f9e9[_0xe7cf('0x1b')],'lastMsgDirection':_0x52f9e9['direction'][_0xe7cf('0x1c')](),'lastMsgBody':_0x52f9e9[_0xe7cf('0x10')]});}})[_0xe7cf('0x1d')](function(_0x394068){console[_0xe7cf('0x1e')](_0x394068);});}_0x5089a4();}},'charset':_0xe7cf('0x1f'),'collate':_0xe7cf('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 8b74a91..526abad 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 _0x042a=['request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','MailMessage','create','body','options','raw','then','CreateMailMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailMessage.socket','register'];(function(_0x114bdf,_0x119ada){var _0x5658f6=function(_0xff3dc){while(--_0xff3dc){_0x114bdf['push'](_0x114bdf['shift']());}};_0x5658f6(++_0x119ada);}(_0x042a,0x1d9));var _0xa042=function(_0x2b8aa7,_0xe29311){_0x2b8aa7=_0x2b8aa7-0x0;var _0x37ce35=_0x042a[_0x2b8aa7];return _0x37ce35;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var moment=require(_0xa042('0x1'));var BPromise=require(_0xa042('0x2'));var rs=require(_0xa042('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa042('0x4'))['db'];var utils=require(_0xa042('0x5'));var logger=require(_0xa042('0x6'))(_0xa042('0x7'));var config=require(_0xa042('0x8'));var jayson=require(_0xa042('0x9'));var client=jayson[_0xa042('0xa')][_0xa042('0xb')]({'port':0x232a});config['redis']=_[_0xa042('0xc')](config[_0xa042('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa042('0xe'))(new Redis(config['redis']));require(_0xa042('0xf'))[_0xa042('0x10')](socket);function respondWithRpcPromise(_0x15426e,_0x2f195a,_0x172c37){return new BPromise(function(_0x2146f3,_0x550ee2){return client[_0xa042('0x11')](_0x15426e,_0x172c37)['then'](function(_0x411e3c){logger['info'](_0xa042('0x12'),_0x2f195a,_0xa042('0x13'));logger[_0xa042('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2f195a,_0xa042('0x13'),JSON[_0xa042('0x15')](_0x411e3c));if(_0x411e3c[_0xa042('0x16')]){if(_0x411e3c['error'][_0xa042('0x17')]===0x1f4){logger[_0xa042('0x16')](_0xa042('0x12'),_0x2f195a,_0x411e3c[_0xa042('0x16')]['message']);return _0x550ee2(_0x411e3c[_0xa042('0x16')][_0xa042('0x18')]);}logger[_0xa042('0x16')](_0xa042('0x12'),_0x2f195a,_0x411e3c[_0xa042('0x16')][_0xa042('0x18')]);return _0x2146f3(_0x411e3c['error']['message']);}else{logger[_0xa042('0x19')](_0xa042('0x12'),_0x2f195a,_0xa042('0x13'));_0x2146f3(_0x411e3c[_0xa042('0x1a')][_0xa042('0x18')]);}})[_0xa042('0x1b')](function(_0x42f2e4){logger['error']('MailMessage,\x20%s,\x20%s',_0x2f195a,_0x42f2e4);_0x550ee2(_0x42f2e4);});});}exports['CreateMailMessage']=function(_0x57fc35){var _0x52d815=this;return new Promise(function(_0x1f5f41,_0x16319e){return db[_0xa042('0x1c')][_0xa042('0x1d')](_0x57fc35[_0xa042('0x1e')],{'raw':_0x57fc35[_0xa042('0x1f')]?_0x57fc35['options'][_0xa042('0x20')]===undefined?!![]:![]:!![]})[_0xa042('0x21')](function(_0x3e164f){logger[_0xa042('0x19')]('CreateMailMessage',_0x57fc35);logger[_0xa042('0x14')](_0xa042('0x22'),_0x57fc35,JSON[_0xa042('0x15')](_0x3e164f));_0x1f5f41(_0x3e164f);})[_0xa042('0x1b')](function(_0x1561f3){logger[_0xa042('0x16')](_0xa042('0x22'),_0x1561f3[_0xa042('0x18')],_0x57fc35);_0x16319e(_0x52d815[_0xa042('0x16')](0x1f4,_0x1561f3[_0xa042('0x18')]));});});}; \ No newline at end of file +var _0x0f9f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','create','body','options','raw','lodash'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x0f9f,0xae));var _0xf0f9=function(_0x12e650,_0x33f29f){_0x12e650=_0x12e650-0x0;var _0x5b56b1=_0x0f9f[_0x12e650];return _0x5b56b1;};'use strict';var _=require(_0xf0f9('0x0'));var util=require(_0xf0f9('0x1'));var moment=require(_0xf0f9('0x2'));var BPromise=require(_0xf0f9('0x3'));var rs=require(_0xf0f9('0x4'));var fs=require('fs');var Redis=require(_0xf0f9('0x5'));var db=require(_0xf0f9('0x6'))['db'];var utils=require(_0xf0f9('0x7'));var logger=require(_0xf0f9('0x8'))(_0xf0f9('0x9'));var config=require(_0xf0f9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf0f9('0xb')][_0xf0f9('0xc')]({'port':0x232a});config['redis']=_[_0xf0f9('0xd')](config[_0xf0f9('0xe')],{'host':_0xf0f9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf0f9('0xe')]));require(_0xf0f9('0x10'))['register'](socket);function respondWithRpcPromise(_0x3261bc,_0x3b3721,_0x3368ee){return new BPromise(function(_0x3be7af,_0x2f446e){return client[_0xf0f9('0x11')](_0x3261bc,_0x3368ee)[_0xf0f9('0x12')](function(_0x161816){logger['info'](_0xf0f9('0x13'),_0x3b3721,_0xf0f9('0x14'));logger[_0xf0f9('0x15')](_0xf0f9('0x16'),_0x3b3721,'request\x20sent',JSON[_0xf0f9('0x17')](_0x161816));if(_0x161816[_0xf0f9('0x18')]){if(_0x161816['error'][_0xf0f9('0x19')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x3b3721,_0x161816[_0xf0f9('0x18')]['message']);return _0x2f446e(_0x161816[_0xf0f9('0x18')]['message']);}logger[_0xf0f9('0x18')](_0xf0f9('0x13'),_0x3b3721,_0x161816[_0xf0f9('0x18')][_0xf0f9('0x1a')]);return _0x3be7af(_0x161816[_0xf0f9('0x18')][_0xf0f9('0x1a')]);}else{logger[_0xf0f9('0x1b')]('MailMessage,\x20%s,\x20%s',_0x3b3721,_0xf0f9('0x14'));_0x3be7af(_0x161816[_0xf0f9('0x1c')][_0xf0f9('0x1a')]);}})[_0xf0f9('0x1d')](function(_0x3dc0e3){logger[_0xf0f9('0x18')](_0xf0f9('0x13'),_0x3b3721,_0x3dc0e3);_0x2f446e(_0x3dc0e3);});});}exports[_0xf0f9('0x1e')]=function(_0x5ebbe9){var _0x1fb2de=this;return new Promise(function(_0x5c2ce0,_0x3664ff){return db['MailMessage'][_0xf0f9('0x1f')](_0x5ebbe9[_0xf0f9('0x20')],{'raw':_0x5ebbe9[_0xf0f9('0x21')]?_0x5ebbe9[_0xf0f9('0x21')][_0xf0f9('0x22')]===undefined?!![]:![]:!![]})[_0xf0f9('0x12')](function(_0x49bddc){logger[_0xf0f9('0x1b')]('CreateMailMessage',_0x5ebbe9);logger[_0xf0f9('0x15')](_0xf0f9('0x1e'),_0x5ebbe9,JSON['stringify'](_0x49bddc));_0x5c2ce0(_0x49bddc);})[_0xf0f9('0x1d')](function(_0x20b5dc){logger['error'](_0xf0f9('0x1e'),_0x20b5dc[_0xf0f9('0x1a')],_0x5ebbe9);_0x3664ff(_0x1fb2de[_0xf0f9('0x18')](0x1f4,_0x20b5dc[_0xf0f9('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 1bac4ca..a258896 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 _0xace5=['remove','removeListener','register','length','mailMessage:','save'];(function(_0x3c5aa6,_0x4c4f86){var _0x49e397=function(_0x37004d){while(--_0x37004d){_0x3c5aa6['push'](_0x3c5aa6['shift']());}};_0x49e397(++_0x4c4f86);}(_0xace5,0x1df));var _0x5ace=function(_0x327079,_0x30f0d0){_0x327079=_0x327079-0x0;var _0x2f30ab=_0xace5[_0x327079];return _0x2f30ab;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x5ace('0x0'),_0x5ace('0x1'),'update'];function createListener(_0x4f9426,_0x5b18b2){return function(_0x35b72a){_0x5b18b2['emit'](_0x4f9426,_0x35b72a);};}function removeListener(_0x3bbadc,_0x478f15){return function(){MailMessageEvents[_0x5ace('0x2')](_0x3bbadc,_0x478f15);};}exports[_0x5ace('0x3')]=function(_0x12a832){for(var _0x53ffe7=0x0,_0x2c22e1=events[_0x5ace('0x4')];_0x53ffe7<_0x2c22e1;_0x53ffe7++){var _0xf5a570=events[_0x53ffe7];var _0x4cf63e=createListener(_0x5ace('0x5')+_0xf5a570,_0x12a832);MailMessageEvents['on'](_0xf5a570,_0x4cf63e);}}; \ No newline at end of file +var _0x8ccb=['removeListener','register','length','mailMessage:','./mailMessage.events','save','update'];(function(_0x3dec6e,_0x2187bc){var _0x3f6e9c=function(_0x374b20){while(--_0x374b20){_0x3dec6e['push'](_0x3dec6e['shift']());}};_0x3f6e9c(++_0x2187bc);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x8ccb[_0x4b91c4];return _0x25cb80;};'use strict';var MailMessageEvents=require(_0xb8cc('0x0'));var events=[_0xb8cc('0x1'),'remove',_0xb8cc('0x2')];function createListener(_0x101ec1,_0x2f49c3){return function(_0x673fa5){_0x2f49c3['emit'](_0x101ec1,_0x673fa5);};}function removeListener(_0x4e1ed7,_0x115fdc){return function(){MailMessageEvents[_0xb8cc('0x3')](_0x4e1ed7,_0x115fdc);};}exports[_0xb8cc('0x4')]=function(_0x4b6b5f){for(var _0x46ac6e=0x0,_0x349552=events[_0xb8cc('0x5')];_0x46ac6e<_0x349552;_0x46ac6e++){var _0x56951f=events[_0x46ac6e];var _0x35c86d=createListener(_0xb8cc('0x6')+_0x56951f,_0x4b6b5f);MailMessageEvents['on'](_0x56951f,_0x35c86d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e992fed..d671785 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 _0xbe7c=['post','create','addTeams','/:id/users','addAgents','destroy','delete','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbe7c,0xfc));var _0xcbe7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe7c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xcbe7('0x0'));var path=require(_0xcbe7('0x1'));var timeout=require(_0xcbe7('0x2'));var express=require(_0xcbe7('0x3'));var router=express[_0xcbe7('0x4')]();var auth=require(_0xcbe7('0x5'));var interaction=require(_0xcbe7('0x6'));var config=require(_0xcbe7('0x7'));var controller=require(_0xcbe7('0x8'));router[_0xcbe7('0x9')]('/',auth[_0xcbe7('0xa')](),controller[_0xcbe7('0xb')]);router[_0xcbe7('0x9')](_0xcbe7('0xc'),auth[_0xcbe7('0xa')](),controller['describe']);router[_0xcbe7('0x9')](_0xcbe7('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcbe7('0x9')]('/:id/members',auth[_0xcbe7('0xa')](),controller[_0xcbe7('0xe')]);router[_0xcbe7('0x9')](_0xcbe7('0xf'),auth['isAuthenticated'](),controller[_0xcbe7('0x10')]);router[_0xcbe7('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xcbe7('0x11')]);router[_0xcbe7('0x12')]('/',auth[_0xcbe7('0xa')](),controller[_0xcbe7('0x13')]);router[_0xcbe7('0x12')](_0xcbe7('0xf'),auth[_0xcbe7('0xa')](),controller[_0xcbe7('0x14')]);router[_0xcbe7('0x12')](_0xcbe7('0x15'),auth['isAuthenticated'](),controller[_0xcbe7('0x16')]);router['put'](_0xcbe7('0xd'),auth[_0xcbe7('0xa')](),controller['update']);router['delete'](_0xcbe7('0xd'),auth[_0xcbe7('0xa')](),controller[_0xcbe7('0x17')]);router[_0xcbe7('0x18')]('/:id/teams',auth[_0xcbe7('0xa')](),controller['removeTeams']);router['delete'](_0xcbe7('0x15'),auth[_0xcbe7('0xa')](),controller[_0xcbe7('0x19')]);module[_0xcbe7('0x1a')]=router; \ No newline at end of file +var _0x2a0a=['/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a0a,0x1c8));var _0xa2a0=function(_0xb442d3,_0x3f9cea){_0xb442d3=_0xb442d3-0x0;var _0x149673=_0x2a0a[_0xb442d3];return _0x149673;};'use strict';var multer=require(_0xa2a0('0x0'));var util=require(_0xa2a0('0x1'));var path=require(_0xa2a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa2a0('0x3'));var router=express[_0xa2a0('0x4')]();var auth=require(_0xa2a0('0x5'));var interaction=require(_0xa2a0('0x6'));var config=require(_0xa2a0('0x7'));var controller=require(_0xa2a0('0x8'));router[_0xa2a0('0x9')]('/',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xb')]);router['get'](_0xa2a0('0xc'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xd')]);router[_0xa2a0('0x9')]('/:id',auth[_0xa2a0('0xa')](),controller['show']);router[_0xa2a0('0x9')](_0xa2a0('0xe'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xf')]);router[_0xa2a0('0x9')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller[_0xa2a0('0x11')]);router['get']('/:id/users',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x12')]);router[_0xa2a0('0x13')]('/',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x14')]);router[_0xa2a0('0x13')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xa2a0('0x15'),auth['isAuthenticated'](),controller[_0xa2a0('0x16')]);router[_0xa2a0('0x17')](_0xa2a0('0x18'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x19')]);router[_0xa2a0('0x1a')](_0xa2a0('0x18'),auth[_0xa2a0('0xa')](),controller['destroy']);router[_0xa2a0('0x1a')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller[_0xa2a0('0x1b')]);router[_0xa2a0('0x1a')](_0xa2a0('0x15'),auth['isAuthenticated'](),controller[_0xa2a0('0x1c')]);module[_0xa2a0('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4b10529..138a6eb 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 _0x955f=['exports','STRING','name','ENUM','roundrobin','sequelize'];(function(_0x4f67f9,_0x1a5be6){var _0x3338fa=function(_0x214300){while(--_0x214300){_0x4f67f9['push'](_0x4f67f9['shift']());}};_0x3338fa(++_0x1a5be6);}(_0x955f,0x1eb));var _0xf955=function(_0x29ae4c,_0x43ddb7){_0x29ae4c=_0x29ae4c-0x0;var _0x408ccd=_0x955f[_0x29ae4c];return _0x408ccd;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')],'unique':_0xf955('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf955('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf955('0x4')]('rrmemory','beepall',_0xf955('0x5'))}}; \ No newline at end of file +var _0xa3d4=['ENUM','sequelize','STRING','name'];(function(_0x214648,_0x542367){var _0x3ade0e=function(_0x61ad5b){while(--_0x61ad5b){_0x214648['push'](_0x214648['shift']());}};_0x3ade0e(++_0x542367);}(_0xa3d4,0x151));var _0x4a3d=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa3d4[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x4a3d('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a3d('0x1')],'unique':_0x4a3d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4a3d('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4a3d('0x3')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index c54ed40..3d9d0fb 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 _0xc265=['getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','MailQueues','end','sendStatus','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','order','sort','MailQueueId','User','UserId','agent','mailPause','updatedAt','%s/%s','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userMailQueue:remove'];(function(_0x42caad,_0x3a0608){var _0x5668f2=function(_0x2e8ff8){while(--_0x2e8ff8){_0x42caad['push'](_0x42caad['shift']());}};_0x5668f2(++_0x3a0608);}(_0xc265,0x19c));var _0x5c26=function(_0x4f0306,_0x5e70d7){_0x4f0306=_0x4f0306-0x0;var _0x1416ac=_0xc265[_0x4f0306];return _0x1416ac;};'use strict';var pdf=require(_0x5c26('0x0'));var emlformat=require(_0x5c26('0x1'));var rimraf=require(_0x5c26('0x2'));var zipdir=require(_0x5c26('0x3'));var jsonpatch=require(_0x5c26('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c26('0x5'));var Mustache=require(_0x5c26('0x6'));var util=require(_0x5c26('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5c26('0x8'));var crypto=require(_0x5c26('0x9'));var jsforce=require(_0x5c26('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5c26('0xb'));var querystring=require('querystring');var Papa=require(_0x5c26('0xc'));var Redis=require(_0x5c26('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5c26('0xe'));var as=require(_0x5c26('0xf'));var hardwareService=require(_0x5c26('0x10'));var logger=require(_0x5c26('0x11'))(_0x5c26('0x12'));var utils=require('../../config/utils');var config=require(_0x5c26('0x13'));var db=require(_0x5c26('0x14'))['db'];config[_0x5c26('0x15')]=_[_0x5c26('0x16')](config[_0x5c26('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c26('0x17'))(new Redis(config['redis']));require(_0x5c26('0x18'))['register'](socket);function respondWithStatusCode(_0x3b2c62,_0x1719cf){_0x1719cf=_0x1719cf||0xcc;return function(_0x5806c6){if(_0x5806c6){return _0x3b2c62['sendStatus'](_0x1719cf);}return _0x3b2c62[_0x5c26('0x19')](_0x1719cf)['end']();};}function respondWithResult(_0x5a7eb0,_0x39db47){_0x39db47=_0x39db47||0xc8;return function(_0x522512){if(_0x522512){return _0x5a7eb0[_0x5c26('0x19')](_0x39db47)[_0x5c26('0x1a')](_0x522512);}};}function respondWithFilteredResult(_0x149a4e,_0x5ceb3a){return function(_0x2c01ee){if(_0x2c01ee){var _0x584f76=_0x2c01ee[_0x5c26('0x1b')],_0xf0abec=_0x5ceb3a[_0x5c26('0x1c')],_0x418018=_0x5ceb3a[_0x5c26('0x1c')]+_0x5ceb3a['limit'],_0x4c4146;if(_0x418018>=_0x584f76){_0x418018=_0x584f76;_0x4c4146=0xc8;}else{_0x4c4146=0xce;}_0x149a4e[_0x5c26('0x19')](_0x4c4146);return _0x149a4e[_0x5c26('0x1d')](_0x5c26('0x1e'),_0xf0abec+'-'+_0x418018+'/'+_0x584f76)[_0x5c26('0x1a')](_0x2c01ee);}return null;};}function patchUpdates(_0x192fbf){return function(_0x4a79ae){try{jsonpatch[_0x5c26('0x1f')](_0x4a79ae,_0x192fbf,!![]);}catch(_0x349556){return BPromise[_0x5c26('0x20')](_0x349556);}return _0x4a79ae['save']();};}function saveUpdates(_0x39adfc,_0x259cff){return function(_0x948087){if(_0x948087){return _0x948087[_0x5c26('0x21')](_0x39adfc)[_0x5c26('0x22')](function(_0x115bec){return _0x115bec;});}return null;};}function removeEntity(_0x23dadf,_0x40b2fa){return function(_0x5a98be){if(_0x5a98be){return _0x5a98be[_0x5c26('0x23')]()[_0x5c26('0x22')](function(){var _0xa7aee8=_0x5a98be[_0x5c26('0x24')]({'plain':!![]});var _0x4bc76b=_0x5c26('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4bc76b,'resourceId':_0xa7aee8['id']}})['then'](function(){return _0x5a98be;});})[_0x5c26('0x22')](function(){_0x23dadf[_0x5c26('0x19')](0xcc)[_0x5c26('0x26')]();});}};}function handleEntityNotFound(_0x44d4d8,_0x34902c){return function(_0x75ccb9){if(!_0x75ccb9){_0x44d4d8[_0x5c26('0x27')](0x194);}return _0x75ccb9;};}function handleError(_0x1681c7,_0x5c55cd){_0x5c55cd=_0x5c55cd||0x1f4;return function(_0x53c338){logger[_0x5c26('0x28')](_0x53c338[_0x5c26('0x29')]);if(_0x53c338['name']){delete _0x53c338[_0x5c26('0x2a')];}_0x1681c7[_0x5c26('0x19')](_0x5c55cd)[_0x5c26('0x2b')](_0x53c338);};}exports[_0x5c26('0x2c')]=function(_0x282b03,_0x5cc64f){var _0x4ae214={},_0x54b6f7={},_0x360e52={'count':0x0,'rows':[]};var _0x40b270=_['map'](db[_0x5c26('0x2d')][_0x5c26('0x2e')],function(_0x459f83){return{'name':_0x459f83[_0x5c26('0x2f')],'type':_0x459f83[_0x5c26('0x30')][_0x5c26('0x31')]};});_0x54b6f7['model']=_[_0x5c26('0x32')](_0x40b270,'name');_0x54b6f7[_0x5c26('0x33')]=_[_0x5c26('0x34')](_0x282b03[_0x5c26('0x33')]);_0x54b6f7[_0x5c26('0x35')]=_[_0x5c26('0x36')](_0x54b6f7[_0x5c26('0x37')],_0x54b6f7[_0x5c26('0x33')]);_0x4ae214['attributes']=_[_0x5c26('0x36')](_0x54b6f7['model'],qs[_0x5c26('0x38')](_0x282b03[_0x5c26('0x33')][_0x5c26('0x38')]));_0x4ae214[_0x5c26('0x39')]=_0x4ae214[_0x5c26('0x39')]['length']?_0x4ae214['attributes']:_0x54b6f7[_0x5c26('0x37')];if(!_0x282b03[_0x5c26('0x33')]['hasOwnProperty'](_0x5c26('0x3a'))){_0x4ae214[_0x5c26('0x3b')]=qs[_0x5c26('0x3b')](_0x282b03[_0x5c26('0x33')][_0x5c26('0x3b')]);_0x4ae214[_0x5c26('0x1c')]=qs[_0x5c26('0x1c')](_0x282b03['query'][_0x5c26('0x1c')]);}_0x4ae214['order']=qs['sort'](_0x282b03[_0x5c26('0x33')]['sort']);_0x4ae214[_0x5c26('0x3c')]=qs['filters'](_[_0x5c26('0x3d')](_0x282b03[_0x5c26('0x33')],_0x54b6f7[_0x5c26('0x35')]),_0x40b270);if(_0x282b03[_0x5c26('0x33')][_0x5c26('0x3e')]){_0x4ae214['where']=_['merge'](_0x4ae214[_0x5c26('0x3c')],{'$or':_[_0x5c26('0x32')](_0x40b270,function(_0x40ef31){if(_0x40ef31[_0x5c26('0x30')]!==_0x5c26('0x3f')){var _0x3327fd={};_0x3327fd[_0x40ef31[_0x5c26('0x2a')]]={'$like':'%'+_0x282b03[_0x5c26('0x33')]['filter']+'%'};return _0x3327fd;}})});}_0x4ae214=_[_0x5c26('0x40')]({},_0x4ae214,_0x282b03[_0x5c26('0x41')]);var _0x3243a7={'where':_0x4ae214[_0x5c26('0x3c')]};return db['MailQueue'][_0x5c26('0x1b')](_0x3243a7)[_0x5c26('0x22')](function(_0x5a00af){_0x360e52[_0x5c26('0x1b')]=_0x5a00af;if(_0x282b03[_0x5c26('0x33')][_0x5c26('0x42')]){_0x4ae214[_0x5c26('0x43')]=[{'all':!![]}];}return db[_0x5c26('0x2d')][_0x5c26('0x44')](_0x4ae214);})[_0x5c26('0x22')](function(_0x4ce12b){_0x360e52[_0x5c26('0x45')]=_0x4ce12b;return _0x360e52;})[_0x5c26('0x22')](respondWithFilteredResult(_0x5cc64f,_0x4ae214))[_0x5c26('0x46')](handleError(_0x5cc64f,null));};exports[_0x5c26('0x47')]=function(_0x5d036,_0x580d0d){var _0x2ff041={'raw':!![],'where':{'id':_0x5d036[_0x5c26('0x48')]['id']}},_0x34d0bb={};_0x34d0bb[_0x5c26('0x37')]=_[_0x5c26('0x34')](db[_0x5c26('0x2d')][_0x5c26('0x2e')]);_0x34d0bb[_0x5c26('0x33')]=_['keys'](_0x5d036[_0x5c26('0x33')]);_0x34d0bb['filters']=_[_0x5c26('0x36')](_0x34d0bb[_0x5c26('0x37')],_0x34d0bb[_0x5c26('0x33')]);_0x2ff041[_0x5c26('0x39')]=_[_0x5c26('0x36')](_0x34d0bb[_0x5c26('0x37')],qs[_0x5c26('0x38')](_0x5d036[_0x5c26('0x33')][_0x5c26('0x38')]));_0x2ff041[_0x5c26('0x39')]=_0x2ff041['attributes'][_0x5c26('0x49')]?_0x2ff041['attributes']:_0x34d0bb[_0x5c26('0x37')];if(_0x5d036[_0x5c26('0x33')][_0x5c26('0x42')]){_0x2ff041['include']=[{'all':!![]}];}_0x2ff041=_[_0x5c26('0x40')]({},_0x2ff041,_0x5d036[_0x5c26('0x41')]);return db[_0x5c26('0x2d')][_0x5c26('0x4a')](_0x2ff041)['then'](handleEntityNotFound(_0x580d0d,null))[_0x5c26('0x22')](respondWithResult(_0x580d0d,null))[_0x5c26('0x46')](handleError(_0x580d0d,null));};exports[_0x5c26('0x4b')]=function(_0x4e06a1,_0x86f7d9){return db['MailQueue'][_0x5c26('0x4b')](_0x4e06a1[_0x5c26('0x4c')],{})[_0x5c26('0x22')](function(_0xad80a8){var _0x49ef19=_0x4e06a1[_0x5c26('0x4d')][_0x5c26('0x24')]({'plain':!![]});if(!_0x49ef19)throw new Error(_0x5c26('0x4e'));if(_0x49ef19[_0x5c26('0x4f')]===_0x5c26('0x4d')){var _0x431daa=_0xad80a8['get']({'plain':!![]});var _0x564bc3=_0x5c26('0x25');return db[_0x5c26('0x50')][_0x5c26('0x4a')]({'where':{'name':_0x564bc3,'userProfileId':_0x49ef19[_0x5c26('0x51')]},'raw':!![]})[_0x5c26('0x22')](function(_0x50668d){if(_0x50668d&&_0x50668d[_0x5c26('0x52')]===0x0){return db[_0x5c26('0x53')][_0x5c26('0x4b')]({'name':_0x431daa[_0x5c26('0x2a')],'resourceId':_0x431daa['id'],'type':_0x50668d[_0x5c26('0x2a')],'sectionId':_0x50668d['id']},{})['then'](function(){return _0xad80a8;});}else{return _0xad80a8;}})[_0x5c26('0x46')](function(_0x515dc4){logger[_0x5c26('0x28')](_0x5c26('0x54'),_0x515dc4);throw _0x515dc4;});}return _0xad80a8;})[_0x5c26('0x22')](respondWithResult(_0x86f7d9,0xc9))['catch'](handleError(_0x86f7d9,null));};exports[_0x5c26('0x21')]=function(_0xbac8d,_0xc1c831){if(_0xbac8d[_0x5c26('0x4c')]['id']){delete _0xbac8d[_0x5c26('0x4c')]['id'];}return db[_0x5c26('0x2d')][_0x5c26('0x4a')]({'where':{'id':_0xbac8d[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0xc1c831,null))[_0x5c26('0x22')](saveUpdates(_0xbac8d['body'],null))['then'](respondWithResult(_0xc1c831,null))[_0x5c26('0x46')](handleError(_0xc1c831,null));};exports[_0x5c26('0x23')]=function(_0xe3be93,_0x131604){return db[_0x5c26('0x2d')][_0x5c26('0x4a')]({'where':{'id':_0xe3be93[_0x5c26('0x48')]['id']}})['then'](handleEntityNotFound(_0x131604,null))[_0x5c26('0x22')](removeEntity(_0x131604,null))[_0x5c26('0x46')](handleError(_0x131604,null));};exports[_0x5c26('0x55')]=function(_0x4bed98,_0x36d397){return db['MailQueue'][_0x5c26('0x55')]()['then'](respondWithResult(_0x36d397,null))['catch'](handleError(_0x36d397,null));};exports[_0x5c26('0x56')]=function(_0x359e01,_0x3b38b0,_0x2fba4b){var _0x4cf484={'raw':!![],'where':{}},_0x1c4907={},_0x3993de;return db[_0x5c26('0x2d')][_0x5c26('0x57')]({'where':{'id':_0x359e01['params']['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0x3b38b0,null))[_0x5c26('0x22')](function(_0x2c0e88){if(_0x2c0e88){_0x3993de=_0x2c0e88[_0x5c26('0x24')]({'plain':!![]});_0x1c4907[_0x5c26('0x37')]=_['keys'](db['UserMailQueue'][_0x5c26('0x2e')]);_0x1c4907[_0x5c26('0x33')]=_[_0x5c26('0x34')](_0x359e01['query']);_0x1c4907['filters']=_[_0x5c26('0x36')](_0x1c4907['model'],_0x1c4907[_0x5c26('0x33')]);_0x4cf484[_0x5c26('0x39')]=_[_0x5c26('0x36')](_0x1c4907[_0x5c26('0x37')],qs[_0x5c26('0x38')](_0x359e01[_0x5c26('0x33')][_0x5c26('0x38')]));_0x4cf484[_0x5c26('0x39')]=_0x4cf484[_0x5c26('0x39')][_0x5c26('0x49')]?_0x4cf484[_0x5c26('0x39')]:_0x1c4907[_0x5c26('0x37')];if(!_0x359e01[_0x5c26('0x33')][_0x5c26('0x58')](_0x5c26('0x3a'))){_0x4cf484[_0x5c26('0x3b')]=qs['limit'](_0x359e01['query'][_0x5c26('0x3b')]);_0x4cf484[_0x5c26('0x1c')]=qs['offset'](_0x359e01['query']['offset']);}_0x4cf484[_0x5c26('0x59')]=qs[_0x5c26('0x5a')](_0x359e01[_0x5c26('0x33')][_0x5c26('0x5a')]);_0x4cf484['where']=qs[_0x5c26('0x35')](_['pick'](_0x359e01[_0x5c26('0x33')],_0x1c4907['filters']));_0x4cf484[_0x5c26('0x3c')][_0x5c26('0x5b')]=_0x2c0e88['id'];if(_0x359e01[_0x5c26('0x33')][_0x5c26('0x3e')]){_0x4cf484[_0x5c26('0x3c')]=_[_0x5c26('0x40')](_0x4cf484[_0x5c26('0x3c')],{'$or':_[_0x5c26('0x32')](_0x4cf484[_0x5c26('0x39')],function(_0x3f2859){var _0xb2d402={};_0xb2d402[_0x3f2859]={'$like':'%'+_0x359e01[_0x5c26('0x33')]['filter']+'%'};return _0xb2d402;})});}_0x4cf484=_[_0x5c26('0x40')]({},_0x4cf484,_0x359e01[_0x5c26('0x41')]);return db['UserMailQueue']['findAll'](_0x4cf484);}})['then'](function(_0x390d48){if(_0x390d48){return db[_0x5c26('0x5c')]['findAndCountAll']({'where':{'id':_[_0x5c26('0x32')](_0x390d48,_0x5c26('0x5d')),'role':_0x5c26('0x5e')},'attributes':['id',_0x5c26('0x2a'),_0x5c26('0x5f'),_0x5c26('0x60'),'createdAt']});}})[_0x5c26('0x22')](function(_0x23662e){if(_0x23662e){return{'count':_0x23662e[_0x5c26('0x1b')],'rows':_[_0x5c26('0x32')](_0x23662e['rows'],function(_0x5be2f8){return{'membername':_0x5be2f8[_0x5c26('0x2a')],'UserId':_0x5be2f8['id'],'queue_name':_0x3993de[_0x5c26('0x2a')],'MailQueueId':_0x3993de['id'],'interface':util['format'](_0x5c26('0x61'),'SIP',_0x5be2f8[_0x5c26('0x2a')]),'penalty':0x0,'paused':_0x5be2f8[_0x5c26('0x5f')],'createdAt':_0x5be2f8['createdAt'],'updatedAt':_0x5be2f8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5c26('0x22')](respondWithFilteredResult(_0x3b38b0,_0x4cf484))[_0x5c26('0x46')](handleError(_0x3b38b0,null));};exports[_0x5c26('0x62')]=function(_0x596818,_0x54bc74,_0x53957c){var _0x2a1f13={};var _0x2f00ac={};var _0x2c4893;var _0xcb3f00;return db[_0x5c26('0x2d')][_0x5c26('0x57')]({'where':{'id':_0x596818[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0x54bc74,null))[_0x5c26('0x22')](function(_0x3b827b){if(_0x3b827b){_0x2c4893=_0x3b827b;_0x2f00ac[_0x5c26('0x37')]=_['keys'](db['Team'][_0x5c26('0x2e')]);_0x2f00ac[_0x5c26('0x33')]=_[_0x5c26('0x34')](_0x596818['query']);_0x2f00ac[_0x5c26('0x35')]=_['intersection'](_0x2f00ac[_0x5c26('0x37')],_0x2f00ac[_0x5c26('0x33')]);_0x2a1f13['attributes']=_['intersection'](_0x2f00ac['model'],qs['fields'](_0x596818[_0x5c26('0x33')]['fields']));_0x2a1f13[_0x5c26('0x39')]=_0x2a1f13[_0x5c26('0x39')][_0x5c26('0x49')]?_0x2a1f13['attributes']:_0x2f00ac[_0x5c26('0x37')];_0x2a1f13[_0x5c26('0x59')]=qs[_0x5c26('0x5a')](_0x596818[_0x5c26('0x33')][_0x5c26('0x5a')]);_0x2a1f13['where']=qs[_0x5c26('0x35')](_[_0x5c26('0x3d')](_0x596818[_0x5c26('0x33')],_0x2f00ac[_0x5c26('0x35')]));if(_0x596818[_0x5c26('0x33')][_0x5c26('0x3e')]){_0x2a1f13['where']=_[_0x5c26('0x40')](_0x2a1f13[_0x5c26('0x3c')],{'$or':_['map'](_0x2a1f13[_0x5c26('0x39')],function(_0x5bbd56){var _0x15f008={};_0x15f008[_0x5bbd56]={'$like':'%'+_0x596818[_0x5c26('0x33')]['filter']+'%'};return _0x15f008;})});}_0x2a1f13=_[_0x5c26('0x40')]({},_0x2a1f13,_0x596818[_0x5c26('0x41')]);return _0x2c4893['getTeams'](_0x2a1f13);}})[_0x5c26('0x22')](function(_0x46b24e){if(_0x46b24e){_0xcb3f00=_0x46b24e[_0x5c26('0x49')];if(!_0x596818[_0x5c26('0x33')][_0x5c26('0x58')](_0x5c26('0x3a'))){_0x2a1f13[_0x5c26('0x3b')]=qs[_0x5c26('0x3b')](_0x596818['query'][_0x5c26('0x3b')]);_0x2a1f13[_0x5c26('0x1c')]=qs['offset'](_0x596818[_0x5c26('0x33')][_0x5c26('0x1c')]);}return _0x2c4893[_0x5c26('0x62')](_0x2a1f13);}})[_0x5c26('0x22')](function(_0x3b59fc){if(_0x3b59fc){return _0x3b59fc?{'count':_0xcb3f00,'rows':_0x3b59fc}:null;}})[_0x5c26('0x22')](respondWithResult(_0x54bc74,null))[_0x5c26('0x46')](handleError(_0x54bc74,null));};exports[_0x5c26('0x63')]=function(_0x242780,_0x61593d,_0x2fe321){var _0x1511c8=_0x242780['body'][_0x5c26('0x64')];return db[_0x5c26('0x65')][_0x5c26('0x44')]({'where':{'id':_0x1511c8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5c26('0x66'),'attributes':['id',_0x5c26('0x2a'),_0x5c26('0x67'),_0x5c26('0x68'),'interface'],'raw':!![]}]})[_0x5c26('0x22')](function(_0x35d41d){if(_0x35d41d){var _0x199429=_[_0x5c26('0x69')](_0x35d41d,function(_0x13bd0c){var _0x3c7531=_0x13bd0c[_0x5c26('0x24')]({'plain':!![]});return _0x3c7531['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x242780[_0x5c26('0x48')]['id']}})['then'](function(_0x41da87){return db[_0x5c26('0x6a')][_0x5c26('0x6b')](function(_0x2c7f46){return _0x41da87[_0x5c26('0x63')](_0x1511c8,{'transaction':_0x2c7f46})[_0x5c26('0x22')](function(){return BPromise[_0x5c26('0x6c')](_0x199429,function(_0x218388){return db['UserMailQueue'][_0x5c26('0x6d')]({'where':{'UserId':_0x218388['id'],'MailQueueId':_0x242780[_0x5c26('0x48')]['id']},'transaction':_0x2c7f46});});})['then'](function(){_0x199429[_0x5c26('0x6e')](function(_0x5775f2){socket[_0x5c26('0x6f')](_0x5c26('0x70'),{'UserId':_0x5775f2['id'],'MailQueueId':_0x41da87['id']});});});});});}})[_0x5c26('0x22')](respondWithStatusCode(_0x61593d,null))[_0x5c26('0x46')](handleError(_0x61593d,null));};exports[_0x5c26('0x71')]=function(_0x13cec7,_0x4c4d5c,_0x42388f){return db[_0x5c26('0x65')]['findAll']({'where':{'id':_0x13cec7[_0x5c26('0x33')][_0x5c26('0x64')]},'attributes':['id'],'include':[{'model':db[_0x5c26('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c4d5c,null))['then'](function(_0x46f772){var _0x18edba=_[_0x5c26('0x32')](_0x46f772,'id');var _0x39e14b=[];var _0x56d9e9=[];var _0x27d870=squel[_0x5c26('0x72')]();_0x27d870['field'](_0x5c26('0x73'))['from']('team_has_mail_queues','tq')[_0x5c26('0x74')](_0x5c26('0x75'),'ut',_0x5c26('0x76'))[_0x5c26('0x3c')](_0x5c26('0x77'),_0x13cec7['params']['id']);for(var _0x54aa0f=0x0;_0x54aa0f<_0x46f772[_0x5c26('0x49')];_0x54aa0f+=0x1){let _0x2f6de0=_0x46f772[_0x54aa0f];for(var _0x38a6cc=0x0;_0x38a6cc<_0x2f6de0[_0x5c26('0x66')][_0x5c26('0x49')];_0x38a6cc+=0x1){let _0x230d3e=_0x2f6de0['Agents'][_0x38a6cc];var _0x13c3ed=_0x27d870[_0x5c26('0x78')]();_0x13c3ed['where']('ut.UserId\x20=\x20?',_0x230d3e['id']);_0x56d9e9[_0x5c26('0x79')](db[_0x5c26('0x6a')]['query'](_0x13c3ed['toString'](),{'type':db[_0x5c26('0x6a')][_0x5c26('0x7a')][_0x5c26('0x7b')]})[_0x5c26('0x22')](function(_0x41b580){if(_0x41b580['length']===0x1){return _0x230d3e['id'];}else{var _0xfe2f7a=_['every'](_[_0x5c26('0x32')](_0x41b580,_0x5c26('0x7c')),function(_0x5d6359){return _[_0x5c26('0x7d')](_0x18edba,_0x5d6359);});if(_0xfe2f7a){return _0x230d3e['id'];}}}));}}return BPromise[_0x5c26('0x7e')](_0x56d9e9)[_0x5c26('0x22')](function(_0x16b73a){_0x39e14b=_(_0x39e14b)[_0x5c26('0x7f')](_0x16b73a)[_0x5c26('0x80')]()[_0x5c26('0x81')]();return db[_0x5c26('0x2d')][_0x5c26('0x4a')]({'where':{'id':_0x13cec7[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](function(_0x238d80){return db[_0x5c26('0x6a')][_0x5c26('0x6b')](function(_0x13262f){return _0x238d80[_0x5c26('0x71')](_0x13cec7[_0x5c26('0x33')][_0x5c26('0x64')],{'transaction':_0x13262f})[_0x5c26('0x22')](function(){if(!_[_0x5c26('0x82')](_0x39e14b)){return _0x238d80[_0x5c26('0x83')](_0x39e14b,{'transaction':_0x13262f});}})[_0x5c26('0x22')](function(){_0x39e14b['forEach'](function(_0x41828a){socket['emit']('userMailQueue:remove',{'UserId':_0x41828a,'MailQueueId':_0x238d80['id']});});});});});});})[_0x5c26('0x22')](respondWithStatusCode(_0x4c4d5c,null))[_0x5c26('0x46')](handleError(_0x4c4d5c,null));};exports[_0x5c26('0x84')]=function(_0x158e29,_0x119154,_0x53ed85){return db[_0x5c26('0x2d')]['find']({'where':{'id':_0x158e29[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0x119154,null))[_0x5c26('0x22')](function(_0xde9c1c){if(_0xde9c1c){return _0xde9c1c[_0x5c26('0x84')](_0x158e29[_0x5c26('0x4c')]['ids'],_[_0x5c26('0x85')](_0x158e29[_0x5c26('0x4c')],[_0x5c26('0x64'),'id'])||{})[_0x5c26('0x86')](function(_0x28f5f0){for(var _0x571004=0x0;_0x571004<_0x158e29[_0x5c26('0x4c')]['ids'][_0x5c26('0x49')];_0x571004+=0x1){socket['emit'](_0x5c26('0x70'),{'UserId':_0x158e29[_0x5c26('0x4c')][_0x5c26('0x64')][_0x571004],'MailQueueId':_0x158e29['params']['id']});}return _0x28f5f0;});}})[_0x5c26('0x22')](respondWithResult(_0x119154,null))[_0x5c26('0x46')](handleError(_0x119154,null));};exports[_0x5c26('0x83')]=function(_0x3b6d77,_0x24367b,_0x4c500a){return db['MailQueue']['find']({'where':{'id':_0x3b6d77['params']['id']}})['then'](handleEntityNotFound(_0x24367b,null))[_0x5c26('0x22')](function(_0x48ecfe){if(_0x48ecfe){return _0x48ecfe[_0x5c26('0x83')](_0x3b6d77[_0x5c26('0x33')][_0x5c26('0x64')])[_0x5c26('0x22')](function(){if(_['isArray'](_0x3b6d77['query'][_0x5c26('0x64')])){for(var _0x59a1eb=0x0;_0x59a1eb<_0x3b6d77[_0x5c26('0x33')][_0x5c26('0x64')]['length'];_0x59a1eb+=0x1){socket[_0x5c26('0x6f')](_0x5c26('0x87'),{'UserId':Number(_0x3b6d77[_0x5c26('0x33')][_0x5c26('0x64')][_0x59a1eb]),'MailQueueId':Number(_0x3b6d77[_0x5c26('0x48')]['id'])});}}else{socket[_0x5c26('0x6f')](_0x5c26('0x87'),{'UserId':Number(_0x3b6d77[_0x5c26('0x33')][_0x5c26('0x64')]),'MailQueueId':Number(_0x3b6d77[_0x5c26('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x24367b,null))[_0x5c26('0x46')](handleError(_0x24367b,null));};exports['getAgents']=function(_0xeba5d1,_0x3ca2b3,_0x8d357d){var _0x369330={};var _0x2bb568={};var _0x1dc73a;var _0x2cdf7e;return db[_0x5c26('0x2d')][_0x5c26('0x57')]({'where':{'id':_0xeba5d1[_0x5c26('0x48')]['id']}})[_0x5c26('0x22')](handleEntityNotFound(_0x3ca2b3,null))[_0x5c26('0x22')](function(_0x5d0117){if(_0x5d0117){_0x1dc73a=_0x5d0117;_0x2bb568[_0x5c26('0x37')]=_['keys'](db[_0x5c26('0x5c')][_0x5c26('0x2e')]);_0x2bb568['query']=_[_0x5c26('0x34')](_0xeba5d1['query']);_0x2bb568['filters']=_[_0x5c26('0x36')](_0x2bb568[_0x5c26('0x37')],_0x2bb568[_0x5c26('0x33')]);_0x369330['attributes']=_[_0x5c26('0x36')](_0x2bb568[_0x5c26('0x37')],qs[_0x5c26('0x38')](_0xeba5d1[_0x5c26('0x33')]['fields']));_0x369330['attributes']=_0x369330[_0x5c26('0x39')][_0x5c26('0x49')]?_0x369330[_0x5c26('0x39')]:_0x2bb568[_0x5c26('0x37')];_0x369330[_0x5c26('0x59')]=qs['sort'](_0xeba5d1[_0x5c26('0x33')]['sort']);_0x369330[_0x5c26('0x3c')]=qs['filters'](_[_0x5c26('0x3d')](_0xeba5d1[_0x5c26('0x33')],_0x2bb568[_0x5c26('0x35')]));if(_0xeba5d1['query'][_0x5c26('0x3e')]){_0x369330[_0x5c26('0x3c')]=_['merge'](_0x369330[_0x5c26('0x3c')],{'$or':_['map'](_0x369330[_0x5c26('0x39')],function(_0x144cba){var _0x7ac508={};_0x7ac508[_0x144cba]={'$like':'%'+_0xeba5d1[_0x5c26('0x33')][_0x5c26('0x3e')]+'%'};return _0x7ac508;})});}_0x369330=_[_0x5c26('0x40')]({},_0x369330,_0xeba5d1[_0x5c26('0x41')]);return _0x1dc73a[_0x5c26('0x88')](_0x369330);}})[_0x5c26('0x22')](function(_0x14178d){if(_0x14178d){_0x2cdf7e=_0x14178d[_0x5c26('0x49')];if(!_0xeba5d1[_0x5c26('0x33')][_0x5c26('0x58')](_0x5c26('0x3a'))){_0x369330[_0x5c26('0x3b')]=qs[_0x5c26('0x3b')](_0xeba5d1['query'][_0x5c26('0x3b')]);_0x369330[_0x5c26('0x1c')]=qs[_0x5c26('0x1c')](_0xeba5d1[_0x5c26('0x33')][_0x5c26('0x1c')]);}return _0x1dc73a[_0x5c26('0x88')](_0x369330);}})[_0x5c26('0x22')](function(_0x1ea33e){if(_0x1ea33e){return _0x1ea33e?{'count':_0x2cdf7e,'rows':_0x1ea33e}:null;}})[_0x5c26('0x22')](respondWithResult(_0x3ca2b3,null))[_0x5c26('0x46')](handleError(_0x3ca2b3,null));}; \ No newline at end of file +var _0x31f8=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','name','index','map','MailQueue','fieldName','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','find','describe','findOne','pick','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','mailPause','getTeams','filter','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','compact','value','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','desk.js','querystring'];(function(_0x3d2d96,_0x5a5649){var _0x339c9e=function(_0x164ad3){while(--_0x164ad3){_0x3d2d96['push'](_0x3d2d96['shift']());}};_0x339c9e(++_0x5a5649);}(_0x31f8,0x79));var _0x831f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x31f8[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x831f('0x0'));var rimraf=require(_0x831f('0x1'));var zipdir=require(_0x831f('0x2'));var jsonpatch=require(_0x831f('0x3'));var rp=require('request-promise');var moment=require(_0x831f('0x4'));var BPromise=require(_0x831f('0x5'));var Mustache=require(_0x831f('0x6'));var util=require('util');var path=require(_0x831f('0x7'));var sox=require(_0x831f('0x8'));var csv=require(_0x831f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x831f('0xa'));var jsforce=require(_0x831f('0xb'));var deskjs=require(_0x831f('0xc'));var toCsv=require(_0x831f('0x9'));var querystring=require(_0x831f('0xd'));var Papa=require(_0x831f('0xe'));var Redis=require(_0x831f('0xf'));var authService=require(_0x831f('0x10'));var qs=require(_0x831f('0x11'));var as=require(_0x831f('0x12'));var hardwareService=require(_0x831f('0x13'));var logger=require(_0x831f('0x14'))(_0x831f('0x15'));var utils=require(_0x831f('0x16'));var config=require(_0x831f('0x17'));var db=require(_0x831f('0x18'))['db'];config['redis']=_[_0x831f('0x19')](config[_0x831f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0x831f('0x1b')](socket);function respondWithStatusCode(_0x25cf5e,_0x675f04){_0x675f04=_0x675f04||0xcc;return function(_0x396d74){if(_0x396d74){return _0x25cf5e[_0x831f('0x1c')](_0x675f04);}return _0x25cf5e[_0x831f('0x1d')](_0x675f04)[_0x831f('0x1e')]();};}function respondWithResult(_0x54aa31,_0xcd86a3){_0xcd86a3=_0xcd86a3||0xc8;return function(_0x541149){if(_0x541149){return _0x54aa31[_0x831f('0x1d')](_0xcd86a3)['json'](_0x541149);}};}function respondWithFilteredResult(_0x227772,_0x26936b){return function(_0x4cbe1e){if(_0x4cbe1e){var _0xc6c80a=_0x4cbe1e[_0x831f('0x1f')],_0x39f019=_0x26936b[_0x831f('0x20')],_0xfc926e=_0x26936b[_0x831f('0x20')]+_0x26936b['limit'],_0xdc3253;if(_0xfc926e>=_0xc6c80a){_0xfc926e=_0xc6c80a;_0xdc3253=0xc8;}else{_0xdc3253=0xce;}_0x227772[_0x831f('0x1d')](_0xdc3253);return _0x227772[_0x831f('0x21')](_0x831f('0x22'),_0x39f019+'-'+_0xfc926e+'/'+_0xc6c80a)[_0x831f('0x23')](_0x4cbe1e);}return null;};}function patchUpdates(_0x2bd6bf){return function(_0x4c671d){try{jsonpatch[_0x831f('0x24')](_0x4c671d,_0x2bd6bf,!![]);}catch(_0x4f1ed7){return BPromise[_0x831f('0x25')](_0x4f1ed7);}return _0x4c671d['save']();};}function saveUpdates(_0x19a415,_0x4c4064){return function(_0x35ae8c){if(_0x35ae8c){return _0x35ae8c[_0x831f('0x26')](_0x19a415)[_0x831f('0x27')](function(_0x2fb336){return _0x2fb336;});}return null;};}function removeEntity(_0x4bbcf9,_0x1a2f4c){return function(_0x1be592){if(_0x1be592){return _0x1be592[_0x831f('0x28')]()[_0x831f('0x27')](function(){var _0x190a66=_0x1be592[_0x831f('0x29')]({'plain':!![]});var _0x2c9969='MailQueues';return db[_0x831f('0x2a')][_0x831f('0x28')]({'where':{'type':_0x2c9969,'resourceId':_0x190a66['id']}})[_0x831f('0x27')](function(){return _0x1be592;});})[_0x831f('0x27')](function(){_0x4bbcf9[_0x831f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a54a4,_0x454ef2){return function(_0xf0216d){if(!_0xf0216d){_0x3a54a4[_0x831f('0x1c')](0x194);}return _0xf0216d;};}function handleError(_0x2851c3,_0x55845c){_0x55845c=_0x55845c||0x1f4;return function(_0x4e4090){logger[_0x831f('0x2b')](_0x4e4090['stack']);if(_0x4e4090[_0x831f('0x2c')]){delete _0x4e4090[_0x831f('0x2c')];}_0x2851c3[_0x831f('0x1d')](_0x55845c)['send'](_0x4e4090);};}exports[_0x831f('0x2d')]=function(_0x483371,_0x2f1cfa){var _0x20d9a2={},_0x5034f0={},_0x291992={'count':0x0,'rows':[]};var _0x2e147f=_[_0x831f('0x2e')](db[_0x831f('0x2f')]['rawAttributes'],function(_0x13ddce){return{'name':_0x13ddce[_0x831f('0x30')],'type':_0x13ddce[_0x831f('0x31')][_0x831f('0x32')]};});_0x5034f0['model']=_[_0x831f('0x2e')](_0x2e147f,_0x831f('0x2c'));_0x5034f0['query']=_[_0x831f('0x33')](_0x483371[_0x831f('0x34')]);_0x5034f0['filters']=_['intersection'](_0x5034f0['model'],_0x5034f0[_0x831f('0x34')]);_0x20d9a2[_0x831f('0x35')]=_[_0x831f('0x36')](_0x5034f0[_0x831f('0x37')],qs['fields'](_0x483371[_0x831f('0x34')][_0x831f('0x38')]));_0x20d9a2[_0x831f('0x35')]=_0x20d9a2[_0x831f('0x35')][_0x831f('0x39')]?_0x20d9a2[_0x831f('0x35')]:_0x5034f0[_0x831f('0x37')];if(!_0x483371[_0x831f('0x34')][_0x831f('0x3a')](_0x831f('0x3b'))){_0x20d9a2[_0x831f('0x3c')]=qs[_0x831f('0x3c')](_0x483371['query'][_0x831f('0x3c')]);_0x20d9a2['offset']=qs[_0x831f('0x20')](_0x483371[_0x831f('0x34')]['offset']);}_0x20d9a2[_0x831f('0x3d')]=qs[_0x831f('0x3e')](_0x483371[_0x831f('0x34')][_0x831f('0x3e')]);_0x20d9a2[_0x831f('0x3f')]=qs[_0x831f('0x40')](_['pick'](_0x483371['query'],_0x5034f0[_0x831f('0x40')]),_0x2e147f);if(_0x483371['query']['filter']){_0x20d9a2['where']=_[_0x831f('0x41')](_0x20d9a2['where'],{'$or':_[_0x831f('0x2e')](_0x2e147f,function(_0x199fd2){if(_0x199fd2['type']!=='VIRTUAL'){var _0x5eda89={};_0x5eda89[_0x199fd2[_0x831f('0x2c')]]={'$like':'%'+_0x483371[_0x831f('0x34')]['filter']+'%'};return _0x5eda89;}})});}_0x20d9a2=_[_0x831f('0x41')]({},_0x20d9a2,_0x483371[_0x831f('0x42')]);var _0x24dceb={'where':_0x20d9a2[_0x831f('0x3f')]};return db[_0x831f('0x2f')][_0x831f('0x1f')](_0x24dceb)['then'](function(_0x29e1ca){_0x291992[_0x831f('0x1f')]=_0x29e1ca;if(_0x483371['query'][_0x831f('0x43')]){_0x20d9a2[_0x831f('0x44')]=[{'all':!![]}];}return db['MailQueue'][_0x831f('0x45')](_0x20d9a2);})[_0x831f('0x27')](function(_0x725d6e){_0x291992[_0x831f('0x46')]=_0x725d6e;return _0x291992;})[_0x831f('0x27')](respondWithFilteredResult(_0x2f1cfa,_0x20d9a2))[_0x831f('0x47')](handleError(_0x2f1cfa,null));};exports['show']=function(_0x4d66a1,_0x5ec93a){var _0x90f193={'raw':!![],'where':{'id':_0x4d66a1[_0x831f('0x48')]['id']}},_0x514f4c={};_0x514f4c[_0x831f('0x37')]=_[_0x831f('0x33')](db[_0x831f('0x2f')][_0x831f('0x49')]);_0x514f4c[_0x831f('0x34')]=_[_0x831f('0x33')](_0x4d66a1['query']);_0x514f4c[_0x831f('0x40')]=_['intersection'](_0x514f4c[_0x831f('0x37')],_0x514f4c[_0x831f('0x34')]);_0x90f193[_0x831f('0x35')]=_['intersection'](_0x514f4c['model'],qs[_0x831f('0x38')](_0x4d66a1['query']['fields']));_0x90f193[_0x831f('0x35')]=_0x90f193['attributes'][_0x831f('0x39')]?_0x90f193[_0x831f('0x35')]:_0x514f4c['model'];if(_0x4d66a1[_0x831f('0x34')][_0x831f('0x43')]){_0x90f193[_0x831f('0x44')]=[{'all':!![]}];}_0x90f193=_[_0x831f('0x41')]({},_0x90f193,_0x4d66a1[_0x831f('0x42')]);return db['MailQueue']['find'](_0x90f193)[_0x831f('0x27')](handleEntityNotFound(_0x5ec93a,null))['then'](respondWithResult(_0x5ec93a,null))[_0x831f('0x47')](handleError(_0x5ec93a,null));};exports[_0x831f('0x4a')]=function(_0x5f203d,_0x1eb17f){return db['MailQueue'][_0x831f('0x4a')](_0x5f203d[_0x831f('0x4b')],{})['then'](function(_0x491692){var _0x3283cd=_0x5f203d[_0x831f('0x4c')][_0x831f('0x29')]({'plain':!![]});if(!_0x3283cd)throw new Error(_0x831f('0x4d'));if(_0x3283cd[_0x831f('0x4e')]===_0x831f('0x4c')){var _0xdbd17f=_0x491692[_0x831f('0x29')]({'plain':!![]});var _0x4bc9a3=_0x831f('0x4f');return db[_0x831f('0x50')]['find']({'where':{'name':_0x4bc9a3,'userProfileId':_0x3283cd[_0x831f('0x51')]},'raw':!![]})[_0x831f('0x27')](function(_0xc7afa4){if(_0xc7afa4&&_0xc7afa4[_0x831f('0x52')]===0x0){return db[_0x831f('0x2a')]['create']({'name':_0xdbd17f['name'],'resourceId':_0xdbd17f['id'],'type':_0xc7afa4[_0x831f('0x2c')],'sectionId':_0xc7afa4['id']},{})[_0x831f('0x27')](function(){return _0x491692;});}else{return _0x491692;}})[_0x831f('0x47')](function(_0xc89f3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc89f3);throw _0xc89f3;});}return _0x491692;})[_0x831f('0x27')](respondWithResult(_0x1eb17f,0xc9))[_0x831f('0x47')](handleError(_0x1eb17f,null));};exports['update']=function(_0x2cad99,_0x4489a0){if(_0x2cad99[_0x831f('0x4b')]['id']){delete _0x2cad99[_0x831f('0x4b')]['id'];}return db[_0x831f('0x2f')]['find']({'where':{'id':_0x2cad99['params']['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x4489a0,null))[_0x831f('0x27')](saveUpdates(_0x2cad99['body'],null))['then'](respondWithResult(_0x4489a0,null))['catch'](handleError(_0x4489a0,null));};exports[_0x831f('0x28')]=function(_0x4ce5ee,_0x2ea48d){return db[_0x831f('0x2f')][_0x831f('0x53')]({'where':{'id':_0x4ce5ee[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x2ea48d,null))[_0x831f('0x27')](removeEntity(_0x2ea48d,null))[_0x831f('0x47')](handleError(_0x2ea48d,null));};exports[_0x831f('0x54')]=function(_0x5de2a7,_0x2edf8a){return db[_0x831f('0x2f')][_0x831f('0x54')]()[_0x831f('0x27')](respondWithResult(_0x2edf8a,null))['catch'](handleError(_0x2edf8a,null));};exports['getMembers']=function(_0x1434cd,_0x60a42d,_0x2c6d2f){var _0x342171={'raw':!![],'where':{}},_0x160e2f={},_0x475fa8;return db['MailQueue'][_0x831f('0x55')]({'where':{'id':_0x1434cd[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x60a42d,null))[_0x831f('0x27')](function(_0x324d7e){if(_0x324d7e){_0x475fa8=_0x324d7e[_0x831f('0x29')]({'plain':!![]});_0x160e2f['model']=_['keys'](db['UserMailQueue'][_0x831f('0x49')]);_0x160e2f[_0x831f('0x34')]=_[_0x831f('0x33')](_0x1434cd[_0x831f('0x34')]);_0x160e2f[_0x831f('0x40')]=_['intersection'](_0x160e2f[_0x831f('0x37')],_0x160e2f['query']);_0x342171['attributes']=_[_0x831f('0x36')](_0x160e2f[_0x831f('0x37')],qs[_0x831f('0x38')](_0x1434cd[_0x831f('0x34')][_0x831f('0x38')]));_0x342171[_0x831f('0x35')]=_0x342171[_0x831f('0x35')]['length']?_0x342171[_0x831f('0x35')]:_0x160e2f[_0x831f('0x37')];if(!_0x1434cd['query'][_0x831f('0x3a')](_0x831f('0x3b'))){_0x342171[_0x831f('0x3c')]=qs[_0x831f('0x3c')](_0x1434cd[_0x831f('0x34')][_0x831f('0x3c')]);_0x342171[_0x831f('0x20')]=qs[_0x831f('0x20')](_0x1434cd[_0x831f('0x34')]['offset']);}_0x342171[_0x831f('0x3d')]=qs[_0x831f('0x3e')](_0x1434cd['query'][_0x831f('0x3e')]);_0x342171['where']=qs[_0x831f('0x40')](_[_0x831f('0x56')](_0x1434cd[_0x831f('0x34')],_0x160e2f['filters']));_0x342171['where'][_0x831f('0x57')]=_0x324d7e['id'];if(_0x1434cd[_0x831f('0x34')]['filter']){_0x342171[_0x831f('0x3f')]=_[_0x831f('0x41')](_0x342171[_0x831f('0x3f')],{'$or':_[_0x831f('0x2e')](_0x342171[_0x831f('0x35')],function(_0x367542){var _0x62ed26={};_0x62ed26[_0x367542]={'$like':'%'+_0x1434cd[_0x831f('0x34')]['filter']+'%'};return _0x62ed26;})});}_0x342171=_[_0x831f('0x41')]({},_0x342171,_0x1434cd[_0x831f('0x42')]);return db[_0x831f('0x58')][_0x831f('0x45')](_0x342171);}})[_0x831f('0x27')](function(_0x37f255){if(_0x37f255){return db[_0x831f('0x59')][_0x831f('0x5a')]({'where':{'id':_[_0x831f('0x2e')](_0x37f255,_0x831f('0x5b')),'role':_0x831f('0x5c')},'attributes':['id','name','mailPause',_0x831f('0x5d'),_0x831f('0x5e')]});}})[_0x831f('0x27')](function(_0xc58a5e){if(_0xc58a5e){return{'count':_0xc58a5e[_0x831f('0x1f')],'rows':_[_0x831f('0x2e')](_0xc58a5e[_0x831f('0x46')],function(_0x3e0cc0){return{'membername':_0x3e0cc0[_0x831f('0x2c')],'UserId':_0x3e0cc0['id'],'queue_name':_0x475fa8[_0x831f('0x2c')],'MailQueueId':_0x475fa8['id'],'interface':util[_0x831f('0x5f')]('%s/%s',_0x831f('0x60'),_0x3e0cc0[_0x831f('0x2c')]),'penalty':0x0,'paused':_0x3e0cc0[_0x831f('0x61')],'createdAt':_0x3e0cc0[_0x831f('0x5e')],'updatedAt':_0x3e0cc0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x831f('0x27')](respondWithFilteredResult(_0x60a42d,_0x342171))[_0x831f('0x47')](handleError(_0x60a42d,null));};exports[_0x831f('0x62')]=function(_0xc720ff,_0xa2442c,_0x4cd469){var _0x24c0d7={};var _0x43902b={};var _0x15acc6;var _0x1c3d65;return db[_0x831f('0x2f')][_0x831f('0x55')]({'where':{'id':_0xc720ff['params']['id']}})[_0x831f('0x27')](handleEntityNotFound(_0xa2442c,null))[_0x831f('0x27')](function(_0x524b42){if(_0x524b42){_0x15acc6=_0x524b42;_0x43902b['model']=_[_0x831f('0x33')](db['Team'][_0x831f('0x49')]);_0x43902b[_0x831f('0x34')]=_['keys'](_0xc720ff[_0x831f('0x34')]);_0x43902b[_0x831f('0x40')]=_['intersection'](_0x43902b['model'],_0x43902b[_0x831f('0x34')]);_0x24c0d7[_0x831f('0x35')]=_[_0x831f('0x36')](_0x43902b[_0x831f('0x37')],qs[_0x831f('0x38')](_0xc720ff[_0x831f('0x34')][_0x831f('0x38')]));_0x24c0d7[_0x831f('0x35')]=_0x24c0d7['attributes'][_0x831f('0x39')]?_0x24c0d7[_0x831f('0x35')]:_0x43902b['model'];_0x24c0d7[_0x831f('0x3d')]=qs[_0x831f('0x3e')](_0xc720ff[_0x831f('0x34')]['sort']);_0x24c0d7[_0x831f('0x3f')]=qs[_0x831f('0x40')](_[_0x831f('0x56')](_0xc720ff[_0x831f('0x34')],_0x43902b[_0x831f('0x40')]));if(_0xc720ff[_0x831f('0x34')]['filter']){_0x24c0d7[_0x831f('0x3f')]=_['merge'](_0x24c0d7['where'],{'$or':_[_0x831f('0x2e')](_0x24c0d7[_0x831f('0x35')],function(_0x38b3b6){var _0x4918ed={};_0x4918ed[_0x38b3b6]={'$like':'%'+_0xc720ff[_0x831f('0x34')][_0x831f('0x63')]+'%'};return _0x4918ed;})});}_0x24c0d7=_['merge']({},_0x24c0d7,_0xc720ff[_0x831f('0x42')]);return _0x15acc6[_0x831f('0x62')](_0x24c0d7);}})[_0x831f('0x27')](function(_0x15110e){if(_0x15110e){_0x1c3d65=_0x15110e[_0x831f('0x39')];if(!_0xc720ff[_0x831f('0x34')][_0x831f('0x3a')]('nolimit')){_0x24c0d7[_0x831f('0x3c')]=qs[_0x831f('0x3c')](_0xc720ff[_0x831f('0x34')]['limit']);_0x24c0d7[_0x831f('0x20')]=qs[_0x831f('0x20')](_0xc720ff[_0x831f('0x34')][_0x831f('0x20')]);}return _0x15acc6['getTeams'](_0x24c0d7);}})[_0x831f('0x27')](function(_0x1cd639){if(_0x1cd639){return _0x1cd639?{'count':_0x1c3d65,'rows':_0x1cd639}:null;}})[_0x831f('0x27')](respondWithResult(_0xa2442c,null))[_0x831f('0x47')](handleError(_0xa2442c,null));};exports['addTeams']=function(_0x465d69,_0x58cc8a,_0x4ef596){var _0x2af1cd=_0x465d69[_0x831f('0x4b')][_0x831f('0x64')];return db[_0x831f('0x65')][_0x831f('0x45')]({'where':{'id':_0x2af1cd},'attributes':['id'],'include':[{'model':db[_0x831f('0x59')],'as':_0x831f('0x66'),'attributes':['id','name',_0x831f('0x67'),_0x831f('0x68'),_0x831f('0x69')],'raw':!![]}]})[_0x831f('0x27')](function(_0x4973fe){if(_0x4973fe){var _0x5c8437=_[_0x831f('0x6a')](_0x4973fe,function(_0x15fea0){var _0x756377=_0x15fea0[_0x831f('0x29')]({'plain':!![]});return _0x756377[_0x831f('0x66')];});return db[_0x831f('0x2f')]['find']({'where':{'id':_0x465d69['params']['id']}})[_0x831f('0x27')](function(_0x414f5b){return db['sequelize'][_0x831f('0x6b')](function(_0x5e56fc){return _0x414f5b[_0x831f('0x6c')](_0x2af1cd,{'transaction':_0x5e56fc})[_0x831f('0x27')](function(){return BPromise[_0x831f('0x6d')](_0x5c8437,function(_0x33ddd6){return db['UserMailQueue'][_0x831f('0x6e')]({'where':{'UserId':_0x33ddd6['id'],'MailQueueId':_0x465d69[_0x831f('0x48')]['id']},'transaction':_0x5e56fc});});})['then'](function(){_0x5c8437[_0x831f('0x6f')](function(_0x3662b8){socket[_0x831f('0x70')](_0x831f('0x71'),{'UserId':_0x3662b8['id'],'MailQueueId':_0x414f5b['id']});});});});});}})[_0x831f('0x27')](respondWithStatusCode(_0x58cc8a,null))[_0x831f('0x47')](handleError(_0x58cc8a,null));};exports[_0x831f('0x72')]=function(_0x23fd80,_0x4793f2,_0x15d1dd){return db[_0x831f('0x65')][_0x831f('0x45')]({'where':{'id':_0x23fd80[_0x831f('0x34')][_0x831f('0x64')]},'attributes':['id'],'include':[{'model':db[_0x831f('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x831f('0x27')](handleEntityNotFound(_0x4793f2,null))[_0x831f('0x27')](function(_0x4cbbe0){var _0x5de1d4=_[_0x831f('0x2e')](_0x4cbbe0,'id');var _0x2a8e0d=[];var _0x5c28d5=[];var _0x302b6e=squel['select']();_0x302b6e['field']('tq.TeamId')[_0x831f('0x73')]('team_has_mail_queues','tq')['join'](_0x831f('0x74'),'ut',_0x831f('0x75'))[_0x831f('0x3f')](_0x831f('0x76'),_0x23fd80['params']['id']);for(var _0x192319=0x0;_0x192319<_0x4cbbe0[_0x831f('0x39')];_0x192319+=0x1){let _0x3b8011=_0x4cbbe0[_0x192319];for(var _0x428f6e=0x0;_0x428f6e<_0x3b8011['Agents'][_0x831f('0x39')];_0x428f6e+=0x1){let _0x18d943=_0x3b8011[_0x831f('0x66')][_0x428f6e];var _0x3efbd6=_0x302b6e[_0x831f('0x77')]();_0x3efbd6['where'](_0x831f('0x78'),_0x18d943['id']);_0x5c28d5[_0x831f('0x79')](db[_0x831f('0x7a')]['query'](_0x3efbd6['toString'](),{'type':db['sequelize'][_0x831f('0x7b')][_0x831f('0x7c')]})[_0x831f('0x27')](function(_0x1f110a){if(_0x1f110a['length']===0x1){return _0x18d943['id'];}else{var _0x87d794=_[_0x831f('0x7d')](_[_0x831f('0x2e')](_0x1f110a,'TeamId'),function(_0x42fae8){return _[_0x831f('0x7e')](_0x5de1d4,_0x42fae8);});if(_0x87d794){return _0x18d943['id'];}}}));}}return BPromise[_0x831f('0x7f')](_0x5c28d5)[_0x831f('0x27')](function(_0x3222ef){_0x2a8e0d=_(_0x2a8e0d)['union'](_0x3222ef)[_0x831f('0x80')]()[_0x831f('0x81')]();return db['MailQueue'][_0x831f('0x53')]({'where':{'id':_0x23fd80['params']['id']}})[_0x831f('0x27')](function(_0x3dde9e){return db['sequelize'][_0x831f('0x6b')](function(_0x323a07){return _0x3dde9e[_0x831f('0x72')](_0x23fd80['query'][_0x831f('0x64')],{'transaction':_0x323a07})[_0x831f('0x27')](function(){if(!_['isEmpty'](_0x2a8e0d)){return _0x3dde9e[_0x831f('0x82')](_0x2a8e0d,{'transaction':_0x323a07});}})[_0x831f('0x27')](function(){_0x2a8e0d[_0x831f('0x6f')](function(_0x5356c7){socket[_0x831f('0x70')](_0x831f('0x83'),{'UserId':_0x5356c7,'MailQueueId':_0x3dde9e['id']});});});});});});})[_0x831f('0x27')](respondWithStatusCode(_0x4793f2,null))['catch'](handleError(_0x4793f2,null));};exports[_0x831f('0x84')]=function(_0x3551ac,_0x2f9d35,_0x54f8e0){return db['MailQueue'][_0x831f('0x53')]({'where':{'id':_0x3551ac[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x2f9d35,null))[_0x831f('0x27')](function(_0x506d84){if(_0x506d84){return _0x506d84[_0x831f('0x84')](_0x3551ac[_0x831f('0x4b')][_0x831f('0x64')],_['omit'](_0x3551ac[_0x831f('0x4b')],[_0x831f('0x64'),'id'])||{})[_0x831f('0x85')](function(_0x24f413){for(var _0x309052=0x0;_0x309052<_0x3551ac['body'][_0x831f('0x64')][_0x831f('0x39')];_0x309052+=0x1){socket[_0x831f('0x70')](_0x831f('0x71'),{'UserId':_0x3551ac[_0x831f('0x4b')][_0x831f('0x64')][_0x309052],'MailQueueId':_0x3551ac[_0x831f('0x48')]['id']});}return _0x24f413;});}})['then'](respondWithResult(_0x2f9d35,null))[_0x831f('0x47')](handleError(_0x2f9d35,null));};exports['removeAgents']=function(_0x182842,_0x248887,_0x1d20e1){return db['MailQueue'][_0x831f('0x53')]({'where':{'id':_0x182842[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x248887,null))[_0x831f('0x27')](function(_0x16a151){if(_0x16a151){return _0x16a151['removeAgents'](_0x182842[_0x831f('0x34')][_0x831f('0x64')])['then'](function(){if(_['isArray'](_0x182842[_0x831f('0x34')][_0x831f('0x64')])){for(var _0x2806da=0x0;_0x2806da<_0x182842[_0x831f('0x34')][_0x831f('0x64')][_0x831f('0x39')];_0x2806da+=0x1){socket[_0x831f('0x70')](_0x831f('0x83'),{'UserId':Number(_0x182842[_0x831f('0x34')][_0x831f('0x64')][_0x2806da]),'MailQueueId':Number(_0x182842[_0x831f('0x48')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x182842[_0x831f('0x34')][_0x831f('0x64')]),'MailQueueId':Number(_0x182842[_0x831f('0x48')]['id'])});}});}})[_0x831f('0x27')](respondWithStatusCode(_0x248887,null))[_0x831f('0x47')](handleError(_0x248887,null));};exports[_0x831f('0x86')]=function(_0x24cb56,_0x5783be,_0x4e4fc1){var _0x971d03={};var _0x3ec0cb={};var _0x89374b;var _0x4c17c6;return db[_0x831f('0x2f')][_0x831f('0x55')]({'where':{'id':_0x24cb56[_0x831f('0x48')]['id']}})[_0x831f('0x27')](handleEntityNotFound(_0x5783be,null))[_0x831f('0x27')](function(_0xe441bb){if(_0xe441bb){_0x89374b=_0xe441bb;_0x3ec0cb[_0x831f('0x37')]=_[_0x831f('0x33')](db[_0x831f('0x59')][_0x831f('0x49')]);_0x3ec0cb[_0x831f('0x34')]=_['keys'](_0x24cb56[_0x831f('0x34')]);_0x3ec0cb[_0x831f('0x40')]=_['intersection'](_0x3ec0cb[_0x831f('0x37')],_0x3ec0cb['query']);_0x971d03['attributes']=_['intersection'](_0x3ec0cb[_0x831f('0x37')],qs[_0x831f('0x38')](_0x24cb56[_0x831f('0x34')][_0x831f('0x38')]));_0x971d03['attributes']=_0x971d03[_0x831f('0x35')][_0x831f('0x39')]?_0x971d03[_0x831f('0x35')]:_0x3ec0cb[_0x831f('0x37')];_0x971d03[_0x831f('0x3d')]=qs['sort'](_0x24cb56[_0x831f('0x34')]['sort']);_0x971d03['where']=qs[_0x831f('0x40')](_[_0x831f('0x56')](_0x24cb56['query'],_0x3ec0cb[_0x831f('0x40')]));if(_0x24cb56[_0x831f('0x34')][_0x831f('0x63')]){_0x971d03[_0x831f('0x3f')]=_['merge'](_0x971d03[_0x831f('0x3f')],{'$or':_['map'](_0x971d03[_0x831f('0x35')],function(_0x3e940a){var _0x1752f3={};_0x1752f3[_0x3e940a]={'$like':'%'+_0x24cb56[_0x831f('0x34')][_0x831f('0x63')]+'%'};return _0x1752f3;})});}_0x971d03=_[_0x831f('0x41')]({},_0x971d03,_0x24cb56[_0x831f('0x42')]);return _0x89374b[_0x831f('0x86')](_0x971d03);}})[_0x831f('0x27')](function(_0x3fb26f){if(_0x3fb26f){_0x4c17c6=_0x3fb26f[_0x831f('0x39')];if(!_0x24cb56['query']['hasOwnProperty']('nolimit')){_0x971d03['limit']=qs['limit'](_0x24cb56[_0x831f('0x34')][_0x831f('0x3c')]);_0x971d03[_0x831f('0x20')]=qs[_0x831f('0x20')](_0x24cb56[_0x831f('0x34')][_0x831f('0x20')]);}return _0x89374b[_0x831f('0x86')](_0x971d03);}})[_0x831f('0x27')](function(_0x365389){if(_0x365389){return _0x365389?{'count':_0x4c17c6,'rows':_0x365389}:null;}})[_0x831f('0x27')](respondWithResult(_0x5783be,null))[_0x831f('0x47')](handleError(_0x5783be,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 58fc612..5d0c033 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 _0x649c=['hook','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x649c,0xf9));var _0xc649=function(_0x5013b5,_0xaeb10d){_0x5013b5=_0x5013b5-0x0;var _0x5aa2e6=_0x649c[_0x5013b5];return _0x5aa2e6;};'use strict';var EventEmitter=require(_0xc649('0x0'));var MailQueue=require(_0xc649('0x1'))['db'][_0xc649('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc649('0x3')](0x0);var events={'afterCreate':_0xc649('0x4'),'afterUpdate':'update','afterDestroy':_0xc649('0x5')};function emitEvent(_0x14d9eb){return function(_0x41c136,_0x26e8f3,_0x980d05){MailQueueEvents[_0xc649('0x6')](_0x14d9eb+':'+_0x41c136['id'],_0x41c136);MailQueueEvents[_0xc649('0x6')](_0x14d9eb,_0x41c136);_0x980d05(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xc649('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x81ae=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x42f85f,_0x58e64e){var _0x4d1417=function(_0x2d98c5){while(--_0x2d98c5){_0x42f85f['push'](_0x42f85f['shift']());}};_0x4d1417(++_0x58e64e);}(_0x81ae,0x8c));var _0xe81a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x81ae[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require(_0xe81a('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe81a('0x1')](0x0);var events={'afterCreate':_0xe81a('0x2'),'afterUpdate':_0xe81a('0x3'),'afterDestroy':_0xe81a('0x4')};function emitEvent(_0x1c4dc2){return function(_0x3d5151,_0x28a76b,_0x5b2abf){MailQueueEvents[_0xe81a('0x5')](_0x1c4dc2+':'+_0x3d5151['id'],_0x3d5151);MailQueueEvents[_0xe81a('0x5')](_0x1c4dc2,_0x3d5151);_0x5b2abf(null);};}for(var e in events){if(events[_0xe81a('0x6')](e)){var event=events[e];MailQueue[_0xe81a('0x7')](e,emitEvent(event));}}module[_0xe81a('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index e61c5b0..fc7a826 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 _0x0710=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x0710,0x1dd));var _0x0071=function(_0x586c70,_0x5b5294){_0x586c70=_0x586c70-0x0;var _0x1fd79d=_0x0710[_0x586c70];return _0x1fd79d;};'use strict';var _=require('lodash');var util=require(_0x0071('0x0'));var logger=require(_0x0071('0x1'))(_0x0071('0x2'));var moment=require('moment');var BPromise=require(_0x0071('0x3'));var rp=require(_0x0071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0071('0x5'));var config=require(_0x0071('0x6'));var attributes=require(_0x0071('0x7'));module[_0x0071('0x8')]=function(_0x5ad4d5,_0x24864f){return _0x5ad4d5['define']('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x528f=['path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x528f,0x19e));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf528('0x0'));var util=require(_0xf528('0x1'));var logger=require('../../config/logger')(_0xf528('0x2'));var moment=require(_0xf528('0x3'));var BPromise=require(_0xf528('0x4'));var rp=require(_0xf528('0x5'));var fs=require('fs');var path=require(_0xf528('0x6'));var rimraf=require(_0xf528('0x7'));var config=require(_0xf528('0x8'));var attributes=require(_0xf528('0x9'));module[_0xf528('0xa')]=function(_0x322e4c,_0x1264b8){return _0x322e4c[_0xf528('0xb')](_0xf528('0xc'),attributes,{'tableName':_0xf528('0xd'),'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 b3ab948..fba5854 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 _0xad77=['info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','map','include','model','ShowMailQueue','find','raw','where','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','./mailQueue.socket','register','then'];(function(_0x3c6743,_0x544a90){var _0x1e2b85=function(_0x7a5553){while(--_0x7a5553){_0x3c6743['push'](_0x3c6743['shift']());}};_0x1e2b85(++_0x544a90);}(_0xad77,0x122));var _0x7ad7=function(_0x1235a8,_0x2db48e){_0x1235a8=_0x1235a8-0x0;var _0x41a2cf=_0xad77[_0x1235a8];return _0x41a2cf;};'use strict';var _=require('lodash');var util=require(_0x7ad7('0x0'));var moment=require('moment');var BPromise=require(_0x7ad7('0x1'));var rs=require(_0x7ad7('0x2'));var fs=require('fs');var Redis=require(_0x7ad7('0x3'));var db=require(_0x7ad7('0x4'))['db'];var utils=require(_0x7ad7('0x5'));var logger=require('../../config/logger')(_0x7ad7('0x6'));var config=require(_0x7ad7('0x7'));var jayson=require(_0x7ad7('0x8'));var client=jayson[_0x7ad7('0x9')]['http']({'port':0x232a});config[_0x7ad7('0xa')]=_['defaults'](config[_0x7ad7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ad7('0xa')]));require(_0x7ad7('0xb'))[_0x7ad7('0xc')](socket);function respondWithRpcPromise(_0x359b90,_0x56a717,_0x3dbc83){return new BPromise(function(_0x409ba2,_0x3bcb2b){return client['request'](_0x359b90,_0x3dbc83)[_0x7ad7('0xd')](function(_0x3de340){logger[_0x7ad7('0xe')](_0x7ad7('0xf'),_0x56a717,'request\x20sent');logger['debug'](_0x7ad7('0x10'),_0x56a717,_0x7ad7('0x11'),JSON[_0x7ad7('0x12')](_0x3de340));if(_0x3de340[_0x7ad7('0x13')]){if(_0x3de340[_0x7ad7('0x13')][_0x7ad7('0x14')]===0x1f4){logger[_0x7ad7('0x13')]('MailQueue,\x20%s,\x20%s',_0x56a717,_0x3de340[_0x7ad7('0x13')][_0x7ad7('0x15')]);return _0x3bcb2b(_0x3de340['error'][_0x7ad7('0x15')]);}logger[_0x7ad7('0x13')](_0x7ad7('0xf'),_0x56a717,_0x3de340[_0x7ad7('0x13')][_0x7ad7('0x15')]);return _0x409ba2(_0x3de340['error'][_0x7ad7('0x15')]);}else{logger[_0x7ad7('0xe')]('MailQueue,\x20%s,\x20%s',_0x56a717,_0x7ad7('0x11'));_0x409ba2(_0x3de340[_0x7ad7('0x16')][_0x7ad7('0x15')]);}})[_0x7ad7('0x17')](function(_0x41f251){logger[_0x7ad7('0x13')]('MailQueue,\x20%s,\x20%s',_0x56a717,_0x41f251);_0x3bcb2b(_0x41f251);});});}exports[_0x7ad7('0x18')]=function(_0x40ffe5){var _0x5f32e6=this;return new Promise(function(_0x1e2f34,_0x353ef7){return db[_0x7ad7('0x19')][_0x7ad7('0x1a')]({'raw':_0x40ffe5['options']?_0x40ffe5[_0x7ad7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x40ffe5[_0x7ad7('0x1b')]?_0x40ffe5[_0x7ad7('0x1b')]['where']||null:null,'attributes':_0x40ffe5[_0x7ad7('0x1b')]?_0x40ffe5[_0x7ad7('0x1b')][_0x7ad7('0x1c')]||null:null,'limit':_0x40ffe5[_0x7ad7('0x1b')]?_0x40ffe5[_0x7ad7('0x1b')][_0x7ad7('0x1d')]||null:null,'include':_0x40ffe5[_0x7ad7('0x1b')]?_0x40ffe5[_0x7ad7('0x1b')]['include']?_[_0x7ad7('0x1e')](_0x40ffe5[_0x7ad7('0x1b')][_0x7ad7('0x1f')],function(_0x44f29f){return{'model':db[_0x44f29f['model']],'as':_0x44f29f['as'],'attributes':_0x44f29f[_0x7ad7('0x1c')],'include':_0x44f29f[_0x7ad7('0x1f')]?_[_0x7ad7('0x1e')](_0x44f29f[_0x7ad7('0x1f')],function(_0x1652a9){return{'model':db[_0x1652a9['model']],'as':_0x1652a9['as'],'attributes':_0x1652a9[_0x7ad7('0x1c')],'include':_0x1652a9[_0x7ad7('0x1f')]?_[_0x7ad7('0x1e')](_0x1652a9[_0x7ad7('0x1f')],function(_0x5000cc){return{'model':db[_0x5000cc[_0x7ad7('0x20')]],'as':_0x5000cc['as'],'attributes':_0x5000cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ad7('0xd')](function(_0x5152d6){logger[_0x7ad7('0xe')](_0x7ad7('0x18'),_0x40ffe5);logger['debug']('GetMailQueue',_0x40ffe5,JSON[_0x7ad7('0x12')](_0x5152d6));_0x1e2f34(_0x5152d6);})[_0x7ad7('0x17')](function(_0x3faf9f){logger['error'](_0x7ad7('0x18'),_0x3faf9f[_0x7ad7('0x15')],_0x40ffe5);_0x353ef7(_0x5f32e6[_0x7ad7('0x13')](0x1f4,_0x3faf9f[_0x7ad7('0x15')]));});});};exports[_0x7ad7('0x21')]=function(_0x2fb9c2){var _0x26a0fb=this;return new Promise(function(_0x356195,_0x1f1311){return db[_0x7ad7('0x19')][_0x7ad7('0x22')]({'raw':_0x2fb9c2['options']?_0x2fb9c2[_0x7ad7('0x1b')][_0x7ad7('0x23')]===undefined?!![]:![]:!![],'where':_0x2fb9c2[_0x7ad7('0x1b')]?_0x2fb9c2[_0x7ad7('0x1b')][_0x7ad7('0x24')]||null:null,'attributes':_0x2fb9c2[_0x7ad7('0x1b')]?_0x2fb9c2[_0x7ad7('0x1b')][_0x7ad7('0x1c')]||null:null,'include':_0x2fb9c2['options']?_0x2fb9c2['options'][_0x7ad7('0x1f')]?_[_0x7ad7('0x1e')](_0x2fb9c2['options'][_0x7ad7('0x1f')],function(_0x455260){return{'model':db[_0x455260[_0x7ad7('0x20')]],'as':_0x455260['as'],'attributes':_0x455260[_0x7ad7('0x1c')],'include':_0x455260['include']?_[_0x7ad7('0x1e')](_0x455260['include'],function(_0x134d7e){return{'model':db[_0x134d7e['model']],'as':_0x134d7e['as'],'attributes':_0x134d7e['attributes'],'include':_0x134d7e[_0x7ad7('0x1f')]?_['map'](_0x134d7e[_0x7ad7('0x1f')],function(_0x1487a0){return{'model':db[_0x1487a0['model']],'as':_0x1487a0['as'],'attributes':_0x1487a0['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ad7('0xd')](function(_0x284cd0){logger[_0x7ad7('0xe')](_0x7ad7('0x21'),_0x2fb9c2);logger[_0x7ad7('0x25')](_0x7ad7('0x21'),_0x2fb9c2,JSON[_0x7ad7('0x12')](_0x284cd0));_0x356195(_0x284cd0);})[_0x7ad7('0x17')](function(_0x3a20fd){logger[_0x7ad7('0x13')]('ShowMailQueue',_0x3a20fd[_0x7ad7('0x15')],_0x2fb9c2);_0x1f1311(_0x26a0fb['error'](0x1f4,_0x3a20fd[_0x7ad7('0x15')]));});});}; \ No newline at end of file +var _0x132b=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetMailQueue','ShowMailQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x132b,0x8d));var _0xb132=function(_0x479f1e,_0x5c0dab){_0x479f1e=_0x479f1e-0x0;var _0xdf9172=_0x132b[_0x479f1e];return _0xdf9172;};'use strict';var _=require(_0xb132('0x0'));var util=require(_0xb132('0x1'));var moment=require('moment');var BPromise=require(_0xb132('0x2'));var rs=require(_0xb132('0x3'));var fs=require('fs');var Redis=require(_0xb132('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb132('0x5'));var logger=require(_0xb132('0x6'))('rpc');var config=require(_0xb132('0x7'));var jayson=require(_0xb132('0x8'));var client=jayson['client'][_0xb132('0x9')]({'port':0x232a});config[_0xb132('0xa')]=_[_0xb132('0xb')](config['redis'],{'host':_0xb132('0xc'),'port':0x18eb});var socket=require(_0xb132('0xd'))(new Redis(config[_0xb132('0xa')]));require('./mailQueue.socket')[_0xb132('0xe')](socket);function respondWithRpcPromise(_0x4741b7,_0x240c7c,_0x3c3c96){return new BPromise(function(_0x123f5b,_0x4a7934){return client[_0xb132('0xf')](_0x4741b7,_0x3c3c96)[_0xb132('0x10')](function(_0x3fa7ac){logger[_0xb132('0x11')](_0xb132('0x12'),_0x240c7c,_0xb132('0x13'));logger[_0xb132('0x14')](_0xb132('0x15'),_0x240c7c,_0xb132('0x13'),JSON[_0xb132('0x16')](_0x3fa7ac));if(_0x3fa7ac[_0xb132('0x17')]){if(_0x3fa7ac['error'][_0xb132('0x18')]===0x1f4){logger[_0xb132('0x17')]('MailQueue,\x20%s,\x20%s',_0x240c7c,_0x3fa7ac[_0xb132('0x17')][_0xb132('0x19')]);return _0x4a7934(_0x3fa7ac[_0xb132('0x17')][_0xb132('0x19')]);}logger[_0xb132('0x17')](_0xb132('0x12'),_0x240c7c,_0x3fa7ac['error'][_0xb132('0x19')]);return _0x123f5b(_0x3fa7ac[_0xb132('0x17')][_0xb132('0x19')]);}else{logger[_0xb132('0x11')](_0xb132('0x12'),_0x240c7c,_0xb132('0x13'));_0x123f5b(_0x3fa7ac['result'][_0xb132('0x19')]);}})[_0xb132('0x1a')](function(_0x4a08a4){logger[_0xb132('0x17')](_0xb132('0x12'),_0x240c7c,_0x4a08a4);_0x4a7934(_0x4a08a4);});});}exports['GetMailQueue']=function(_0x4f33a1){var _0x2f0360=this;return new Promise(function(_0x1521b0,_0x2cf9e7){return db[_0xb132('0x1b')][_0xb132('0x1c')]({'raw':_0x4f33a1['options']?_0x4f33a1[_0xb132('0x1d')][_0xb132('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f33a1[_0xb132('0x1d')]?_0x4f33a1[_0xb132('0x1d')][_0xb132('0x1f')]||null:null,'attributes':_0x4f33a1[_0xb132('0x1d')]?_0x4f33a1['options'][_0xb132('0x20')]||null:null,'limit':_0x4f33a1[_0xb132('0x1d')]?_0x4f33a1[_0xb132('0x1d')][_0xb132('0x21')]||null:null,'include':_0x4f33a1['options']?_0x4f33a1[_0xb132('0x1d')]['include']?_[_0xb132('0x22')](_0x4f33a1[_0xb132('0x1d')][_0xb132('0x23')],function(_0x4d8d96){return{'model':db[_0x4d8d96[_0xb132('0x24')]],'as':_0x4d8d96['as'],'attributes':_0x4d8d96[_0xb132('0x20')],'include':_0x4d8d96[_0xb132('0x23')]?_[_0xb132('0x22')](_0x4d8d96[_0xb132('0x23')],function(_0x191d4d){return{'model':db[_0x191d4d[_0xb132('0x24')]],'as':_0x191d4d['as'],'attributes':_0x191d4d[_0xb132('0x20')],'include':_0x191d4d['include']?_[_0xb132('0x22')](_0x191d4d[_0xb132('0x23')],function(_0xf4e443){return{'model':db[_0xf4e443[_0xb132('0x24')]],'as':_0xf4e443['as'],'attributes':_0xf4e443['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ec8d4){logger[_0xb132('0x11')](_0xb132('0x25'),_0x4f33a1);logger['debug']('GetMailQueue',_0x4f33a1,JSON[_0xb132('0x16')](_0x2ec8d4));_0x1521b0(_0x2ec8d4);})[_0xb132('0x1a')](function(_0x314bcc){logger[_0xb132('0x17')](_0xb132('0x25'),_0x314bcc[_0xb132('0x19')],_0x4f33a1);_0x2cf9e7(_0x2f0360[_0xb132('0x17')](0x1f4,_0x314bcc['message']));});});};exports[_0xb132('0x26')]=function(_0x169ea0){var _0x16b055=this;return new Promise(function(_0x30ee7d,_0x1b5c81){return db[_0xb132('0x1b')][_0xb132('0x27')]({'raw':_0x169ea0[_0xb132('0x1d')]?_0x169ea0[_0xb132('0x1d')][_0xb132('0x1e')]===undefined?!![]:![]:!![],'where':_0x169ea0[_0xb132('0x1d')]?_0x169ea0[_0xb132('0x1d')][_0xb132('0x1f')]||null:null,'attributes':_0x169ea0[_0xb132('0x1d')]?_0x169ea0['options'][_0xb132('0x20')]||null:null,'include':_0x169ea0[_0xb132('0x1d')]?_0x169ea0[_0xb132('0x1d')]['include']?_['map'](_0x169ea0[_0xb132('0x1d')][_0xb132('0x23')],function(_0x20725b){return{'model':db[_0x20725b[_0xb132('0x24')]],'as':_0x20725b['as'],'attributes':_0x20725b[_0xb132('0x20')],'include':_0x20725b[_0xb132('0x23')]?_[_0xb132('0x22')](_0x20725b[_0xb132('0x23')],function(_0x45f87f){return{'model':db[_0x45f87f['model']],'as':_0x45f87f['as'],'attributes':_0x45f87f[_0xb132('0x20')],'include':_0x45f87f[_0xb132('0x23')]?_['map'](_0x45f87f[_0xb132('0x23')],function(_0x4827a5){return{'model':db[_0x4827a5[_0xb132('0x24')]],'as':_0x4827a5['as'],'attributes':_0x4827a5[_0xb132('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb132('0x10')](function(_0x2836da){logger[_0xb132('0x11')](_0xb132('0x26'),_0x169ea0);logger[_0xb132('0x14')](_0xb132('0x26'),_0x169ea0,JSON[_0xb132('0x16')](_0x2836da));_0x30ee7d(_0x2836da);})['catch'](function(_0x10732c){logger['error'](_0xb132('0x26'),_0x10732c[_0xb132('0x19')],_0x169ea0);_0x1b5c81(_0x16b055[_0xb132('0x17')](0x1f4,_0x10732c[_0xb132('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index bc04453..8ac8bab 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 _0x21c7=['length','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x21c7,0x182));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0x721c('0x0'));var events=[_0x721c('0x1'),_0x721c('0x2'),_0x721c('0x3')];function createListener(_0x13d446,_0x1afef2){return function(_0x25b732){_0x1afef2[_0x721c('0x4')](_0x13d446,_0x25b732);};}function removeListener(_0x5a840a,_0x925870){return function(){MailQueueEvents[_0x721c('0x5')](_0x5a840a,_0x925870);};}exports['register']=function(_0x193506){for(var _0x122a13=0x0,_0xdb61ac=events[_0x721c('0x6')];_0x122a13<_0xdb61ac;_0x122a13++){var _0x592d64=events[_0x122a13];var _0x5c70cc=createListener('mailQueue:'+_0x592d64,_0x193506);MailQueueEvents['on'](_0x592d64,_0x5c70cc);}}; \ No newline at end of file +var _0x20ca=['mailQueue:','save','remove','update','emit','removeListener','length'];(function(_0x383836,_0x109ca1){var _0x64eedb=function(_0x5da0cd){while(--_0x5da0cd){_0x383836['push'](_0x383836['shift']());}};_0x64eedb(++_0x109ca1);}(_0x20ca,0x166));var _0xa20c=function(_0x335223,_0x3f9e24){_0x335223=_0x335223-0x0;var _0x4b5390=_0x20ca[_0x335223];return _0x4b5390;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xa20c('0x0'),_0xa20c('0x1'),_0xa20c('0x2')];function createListener(_0x468833,_0x58256c){return function(_0x300d78){_0x58256c[_0xa20c('0x3')](_0x468833,_0x300d78);};}function removeListener(_0x4cc4d9,_0x2c1403){return function(){MailQueueEvents[_0xa20c('0x4')](_0x4cc4d9,_0x2c1403);};}exports['register']=function(_0x4da23d){for(var _0x27300f=0x0,_0x1fdb6e=events[_0xa20c('0x5')];_0x27300f<_0x1fdb6e;_0x27300f++){var _0x45b5e6=events[_0x27300f];var _0x53b324=createListener(_0xa20c('0x6')+_0x45b5e6,_0x4da23d);MailQueueEvents['on'](_0x45b5e6,_0x53b324);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 3226fcc..2d2aafb 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 _0x5e0d=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','multer','util','path'];(function(_0x31cd47,_0x8c1faf){var _0x1e1881=function(_0x4658db){while(--_0x4658db){_0x31cd47['push'](_0x31cd47['shift']());}};_0x1e1881(++_0x8c1faf);}(_0x5e0d,0xf9));var _0xd5e0=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x5e0d[_0x277107];return _0x1da046;};'use strict';var multer=require(_0xd5e0('0x0'));var util=require(_0xd5e0('0x1'));var path=require(_0xd5e0('0x2'));var timeout=require(_0xd5e0('0x3'));var express=require(_0xd5e0('0x4'));var router=express[_0xd5e0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd5e0('0x6'));var config=require(_0xd5e0('0x7'));var controller=require('./mailQueueReport.controller');router[_0xd5e0('0x8')]('/',auth[_0xd5e0('0x9')](),controller[_0xd5e0('0xa')]);router[_0xd5e0('0x8')](_0xd5e0('0xb'),auth[_0xd5e0('0x9')](),controller[_0xd5e0('0xc')]);router[_0xd5e0('0x8')](_0xd5e0('0xd'),auth[_0xd5e0('0x9')](),controller[_0xd5e0('0xe')]);router['post']('/',auth[_0xd5e0('0x9')](),controller['create']);router[_0xd5e0('0xf')](_0xd5e0('0xd'),auth['isAuthenticated'](),controller[_0xd5e0('0x10')]);router[_0xd5e0('0x11')](_0xd5e0('0xd'),auth[_0xd5e0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0930=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x4d0e23,_0x4e03b7){var _0x4d2fc4=function(_0x26f074){while(--_0x26f074){_0x4d0e23['push'](_0x4d0e23['shift']());}};_0x4d2fc4(++_0x4e03b7);}(_0x0930,0x166));var _0x0093=function(_0x49bf38,_0x42c116){_0x49bf38=_0x49bf38-0x0;var _0xb76377=_0x0930[_0x49bf38];return _0xb76377;};'use strict';var multer=require(_0x0093('0x0'));var util=require(_0x0093('0x1'));var path=require('path');var timeout=require(_0x0093('0x2'));var express=require(_0x0093('0x3'));var router=express[_0x0093('0x4')]();var auth=require(_0x0093('0x5'));var interaction=require(_0x0093('0x6'));var config=require('../../config/environment');var controller=require(_0x0093('0x7'));router[_0x0093('0x8')]('/',auth[_0x0093('0x9')](),controller[_0x0093('0xa')]);router[_0x0093('0x8')](_0x0093('0xb'),auth[_0x0093('0x9')](),controller['describe']);router[_0x0093('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0093('0xc')]);router[_0x0093('0xd')]('/',auth[_0x0093('0x9')](),controller[_0x0093('0xe')]);router[_0x0093('0xf')](_0x0093('0x10'),auth[_0x0093('0x9')](),controller['update']);router[_0x0093('0x11')](_0x0093('0x10'),auth[_0x0093('0x9')](),controller[_0x0093('0x12')]);module[_0x0093('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a91e6bc..f270d7c 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 _0x9f9a=['STRING','DATE','moment','exports'];(function(_0x273517,_0x50b234){var _0x2c6334=function(_0x26c055){while(--_0x26c055){_0x273517['push'](_0x273517['shift']());}};_0x2c6334(++_0x50b234);}(_0x9f9a,0x76));var _0xa9f9=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x9f9a[_0x454e6d];return _0x4bc294;};'use strict';var moment=require(_0xa9f9('0x0'));var Sequelize=require('sequelize');module[_0xa9f9('0x1')]={'uniqueid':{'type':Sequelize[_0xa9f9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa9f9('0x2')]},'joinAt':{'type':Sequelize[_0xa9f9('0x3')]},'leaveAt':{'type':Sequelize[_0xa9f9('0x3')]},'acceptAt':{'type':Sequelize[_0xa9f9('0x3')]},'exitAt':{'type':Sequelize[_0xa9f9('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9f8b=['sequelize','STRING','DATE','moment'];(function(_0x5b374e,_0x244e02){var _0x5da9a4=function(_0x39a98b){while(--_0x39a98b){_0x5b374e['push'](_0x5b374e['shift']());}};_0x5da9a4(++_0x244e02);}(_0x9f8b,0x1e7));var _0xb9f8=function(_0x281820,_0x47572b){_0x281820=_0x281820-0x0;var _0x2d05f6=_0x9f8b[_0x281820];return _0x2d05f6;};'use strict';var moment=require(_0xb9f8('0x0'));var Sequelize=require(_0xb9f8('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb9f8('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb9f8('0x2')]},'joinAt':{'type':Sequelize[_0xb9f8('0x3')]},'leaveAt':{'type':Sequelize[_0xb9f8('0x3')]},'acceptAt':{'type':Sequelize[_0xb9f8('0x3')]},'exitAt':{'type':Sequelize[_0xb9f8('0x3')]},'reason':{'type':Sequelize[_0xb9f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f0d1d67..78e6b4f 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 _0xe200=['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','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','MailQueueReport','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','ejs','squel','crypto'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe200,0x8d));var _0x0e20=function(_0x182cb7,_0x37aded){_0x182cb7=_0x182cb7-0x0;var _0x71e9a3=_0xe200[_0x182cb7];return _0x71e9a3;};'use strict';var pdf=require(_0x0e20('0x0'));var emlformat=require(_0x0e20('0x1'));var rimraf=require(_0x0e20('0x2'));var zipdir=require(_0x0e20('0x3'));var jsonpatch=require(_0x0e20('0x4'));var rp=require(_0x0e20('0x5'));var moment=require(_0x0e20('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0e20('0x7'));var csv=require('to-csv');var ejs=require(_0x0e20('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0e20('0x9'));var crypto=require(_0x0e20('0xa'));var jsforce=require(_0x0e20('0xb'));var deskjs=require(_0x0e20('0xc'));var toCsv=require(_0x0e20('0xd'));var querystring=require(_0x0e20('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e20('0xf'));var authService=require(_0x0e20('0x10'));var qs=require(_0x0e20('0x11'));var as=require(_0x0e20('0x12'));var hardwareService=require(_0x0e20('0x13'));var logger=require(_0x0e20('0x14'))(_0x0e20('0x15'));var utils=require(_0x0e20('0x16'));var config=require(_0x0e20('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4357b0,_0x4660d8){_0x4660d8=_0x4660d8||0xcc;return function(_0x5afba7){if(_0x5afba7){return _0x4357b0['sendStatus'](_0x4660d8);}return _0x4357b0[_0x0e20('0x18')](_0x4660d8)[_0x0e20('0x19')]();};}function respondWithResult(_0x3beee9,_0x3acf2d){_0x3acf2d=_0x3acf2d||0xc8;return function(_0x3fec32){if(_0x3fec32){return _0x3beee9[_0x0e20('0x18')](_0x3acf2d)['json'](_0x3fec32);}};}function respondWithFilteredResult(_0x282825,_0xa02b33){return function(_0x5ddcaa){if(_0x5ddcaa){var _0x2fd969=_0x5ddcaa[_0x0e20('0x1a')],_0x2723a2=_0xa02b33[_0x0e20('0x1b')],_0x4a84b0=_0xa02b33['offset']+_0xa02b33[_0x0e20('0x1c')],_0x405084;if(_0x4a84b0>=_0x2fd969){_0x4a84b0=_0x2fd969;_0x405084=0xc8;}else{_0x405084=0xce;}_0x282825[_0x0e20('0x18')](_0x405084);return _0x282825['set'](_0x0e20('0x1d'),_0x2723a2+'-'+_0x4a84b0+'/'+_0x2fd969)[_0x0e20('0x1e')](_0x5ddcaa);}return null;};}function patchUpdates(_0x50f958){return function(_0x502c18){try{jsonpatch[_0x0e20('0x1f')](_0x502c18,_0x50f958,!![]);}catch(_0x419532){return BPromise[_0x0e20('0x20')](_0x419532);}return _0x502c18['save']();};}function saveUpdates(_0xc882b,_0x36b3b3){return function(_0x17e4ce){if(_0x17e4ce){return _0x17e4ce[_0x0e20('0x21')](_0xc882b)[_0x0e20('0x22')](function(_0x27fa19){return _0x27fa19;});}return null;};}function removeEntity(_0x2790b3,_0x5cc135){return function(_0x21542f){if(_0x21542f){return _0x21542f[_0x0e20('0x23')]()[_0x0e20('0x22')](function(){_0x2790b3[_0x0e20('0x18')](0xcc)[_0x0e20('0x19')]();});}};}function handleEntityNotFound(_0x2b516c,_0x23978f){return function(_0x2feb5a){if(!_0x2feb5a){_0x2b516c['sendStatus'](0x194);}return _0x2feb5a;};}function handleError(_0xbef29f,_0x41cbe0){_0x41cbe0=_0x41cbe0||0x1f4;return function(_0x56737a){logger[_0x0e20('0x24')](_0x56737a[_0x0e20('0x25')]);if(_0x56737a['name']){delete _0x56737a['name'];}_0xbef29f[_0x0e20('0x18')](_0x41cbe0)[_0x0e20('0x26')](_0x56737a);};}exports[_0x0e20('0x27')]=function(_0x6bbaa3,_0x4b8e93){var _0x104ae6={},_0x305286={},_0x51a36e={'count':0x0,'rows':[]};var _0x21685d=_[_0x0e20('0x28')](db['MailQueueReport'][_0x0e20('0x29')],function(_0x5daaea){return{'name':_0x5daaea[_0x0e20('0x2a')],'type':_0x5daaea[_0x0e20('0x2b')][_0x0e20('0x2c')]};});_0x305286['model']=_['map'](_0x21685d,_0x0e20('0x2d'));_0x305286['query']=_['keys'](_0x6bbaa3['query']);_0x305286[_0x0e20('0x2e')]=_[_0x0e20('0x2f')](_0x305286[_0x0e20('0x30')],_0x305286[_0x0e20('0x31')]);_0x104ae6[_0x0e20('0x32')]=_[_0x0e20('0x2f')](_0x305286['model'],qs[_0x0e20('0x33')](_0x6bbaa3[_0x0e20('0x31')][_0x0e20('0x33')]));_0x104ae6[_0x0e20('0x32')]=_0x104ae6['attributes'][_0x0e20('0x34')]?_0x104ae6['attributes']:_0x305286[_0x0e20('0x30')];if(!_0x6bbaa3[_0x0e20('0x31')][_0x0e20('0x35')](_0x0e20('0x36'))){_0x104ae6[_0x0e20('0x1c')]=qs['limit'](_0x6bbaa3[_0x0e20('0x31')][_0x0e20('0x1c')]);_0x104ae6[_0x0e20('0x1b')]=qs['offset'](_0x6bbaa3[_0x0e20('0x31')][_0x0e20('0x1b')]);}_0x104ae6[_0x0e20('0x37')]=qs['sort'](_0x6bbaa3['query'][_0x0e20('0x38')]);_0x104ae6[_0x0e20('0x39')]=qs[_0x0e20('0x2e')](_[_0x0e20('0x3a')](_0x6bbaa3['query'],_0x305286[_0x0e20('0x2e')]),_0x21685d);if(_0x6bbaa3['query'][_0x0e20('0x3b')]){_0x104ae6['where']=_['merge'](_0x104ae6[_0x0e20('0x39')],{'$or':_['map'](_0x21685d,function(_0x31c2d1){if(_0x31c2d1['type']!==_0x0e20('0x3c')){var _0x25e828={};_0x25e828[_0x31c2d1[_0x0e20('0x2d')]]={'$like':'%'+_0x6bbaa3[_0x0e20('0x31')]['filter']+'%'};return _0x25e828;}})});}_0x104ae6=_[_0x0e20('0x3d')]({},_0x104ae6,_0x6bbaa3['options']);var _0x4d6095={'where':_0x104ae6[_0x0e20('0x39')]};return db[_0x0e20('0x3e')][_0x0e20('0x1a')](_0x4d6095)['then'](function(_0x399cfb){_0x51a36e['count']=_0x399cfb;if(_0x6bbaa3['query'][_0x0e20('0x3f')]){_0x104ae6[_0x0e20('0x40')]=[{'all':!![]}];}return db[_0x0e20('0x3e')][_0x0e20('0x41')](_0x104ae6);})[_0x0e20('0x22')](function(_0x415bc4){_0x51a36e[_0x0e20('0x42')]=_0x415bc4;return _0x51a36e;})[_0x0e20('0x22')](respondWithFilteredResult(_0x4b8e93,_0x104ae6))['catch'](handleError(_0x4b8e93,null));};exports[_0x0e20('0x43')]=function(_0xf87182,_0x24564f){var _0x269a92={'raw':!![],'where':{'id':_0xf87182[_0x0e20('0x44')]['id']}},_0x51cb06={};_0x51cb06[_0x0e20('0x30')]=_[_0x0e20('0x45')](db[_0x0e20('0x3e')][_0x0e20('0x29')]);_0x51cb06[_0x0e20('0x31')]=_[_0x0e20('0x45')](_0xf87182['query']);_0x51cb06[_0x0e20('0x2e')]=_[_0x0e20('0x2f')](_0x51cb06[_0x0e20('0x30')],_0x51cb06[_0x0e20('0x31')]);_0x269a92[_0x0e20('0x32')]=_[_0x0e20('0x2f')](_0x51cb06[_0x0e20('0x30')],qs[_0x0e20('0x33')](_0xf87182[_0x0e20('0x31')][_0x0e20('0x33')]));_0x269a92['attributes']=_0x269a92[_0x0e20('0x32')][_0x0e20('0x34')]?_0x269a92[_0x0e20('0x32')]:_0x51cb06[_0x0e20('0x30')];if(_0xf87182[_0x0e20('0x31')]['includeAll']){_0x269a92[_0x0e20('0x40')]=[{'all':!![]}];}_0x269a92=_['merge']({},_0x269a92,_0xf87182[_0x0e20('0x46')]);return db[_0x0e20('0x3e')][_0x0e20('0x47')](_0x269a92)[_0x0e20('0x22')](handleEntityNotFound(_0x24564f,null))[_0x0e20('0x22')](respondWithResult(_0x24564f,null))[_0x0e20('0x48')](handleError(_0x24564f,null));};exports[_0x0e20('0x49')]=function(_0x3fc8f7,_0xd05698){return db[_0x0e20('0x3e')]['create'](_0x3fc8f7[_0x0e20('0x4a')],{})['then'](respondWithResult(_0xd05698,0xc9))[_0x0e20('0x48')](handleError(_0xd05698,null));};exports['update']=function(_0x35417d,_0x1b476b){if(_0x35417d['body']['id']){delete _0x35417d[_0x0e20('0x4a')]['id'];}return db['MailQueueReport'][_0x0e20('0x47')]({'where':{'id':_0x35417d[_0x0e20('0x44')]['id']}})[_0x0e20('0x22')](handleEntityNotFound(_0x1b476b,null))[_0x0e20('0x22')](saveUpdates(_0x35417d[_0x0e20('0x4a')],null))[_0x0e20('0x22')](respondWithResult(_0x1b476b,null))['catch'](handleError(_0x1b476b,null));};exports[_0x0e20('0x23')]=function(_0x4ba8ff,_0x1b16ef){return db[_0x0e20('0x3e')][_0x0e20('0x47')]({'where':{'id':_0x4ba8ff[_0x0e20('0x44')]['id']}})[_0x0e20('0x22')](handleEntityNotFound(_0x1b16ef,null))[_0x0e20('0x22')](removeEntity(_0x1b16ef,null))['catch'](handleError(_0x1b16ef,null));};exports['describe']=function(_0x26919b,_0x330746){return db[_0x0e20('0x3e')][_0x0e20('0x4b')]()[_0x0e20('0x22')](respondWithResult(_0x330746,null))[_0x0e20('0x48')](handleError(_0x330746,null));}; \ No newline at end of file +var _0x34d2=['status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','MailQueueReport','rawAttributes','fieldName','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x22d780,_0x5239a7){var _0x2c27cf=function(_0x5cc5cf){while(--_0x5cc5cf){_0x22d780['push'](_0x22d780['shift']());}};_0x2c27cf(++_0x5239a7);}(_0x34d2,0x7b));var _0x234d=function(_0x5e415d,_0x5797d5){_0x5e415d=_0x5e415d-0x0;var _0x4cc4b8=_0x34d2[_0x5e415d];return _0x4cc4b8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x234d('0x0'));var rimraf=require(_0x234d('0x1'));var zipdir=require(_0x234d('0x2'));var jsonpatch=require(_0x234d('0x3'));var rp=require(_0x234d('0x4'));var moment=require(_0x234d('0x5'));var BPromise=require(_0x234d('0x6'));var Mustache=require(_0x234d('0x7'));var util=require('util');var path=require(_0x234d('0x8'));var sox=require(_0x234d('0x9'));var csv=require('to-csv');var ejs=require(_0x234d('0xa'));var fs=require('fs');var _=require(_0x234d('0xb'));var squel=require(_0x234d('0xc'));var crypto=require(_0x234d('0xd'));var jsforce=require(_0x234d('0xe'));var deskjs=require(_0x234d('0xf'));var toCsv=require(_0x234d('0x10'));var querystring=require(_0x234d('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x234d('0x12'));var config=require(_0x234d('0x13'));var db=require(_0x234d('0x14'))['db'];function respondWithStatusCode(_0xd23bfb,_0x223657){_0x223657=_0x223657||0xcc;return function(_0x152dcc){if(_0x152dcc){return _0xd23bfb['sendStatus'](_0x223657);}return _0xd23bfb['status'](_0x223657)['end']();};}function respondWithResult(_0x5de751,_0x4a035b){_0x4a035b=_0x4a035b||0xc8;return function(_0x48a480){if(_0x48a480){return _0x5de751[_0x234d('0x15')](_0x4a035b)[_0x234d('0x16')](_0x48a480);}};}function respondWithFilteredResult(_0x4676aa,_0x4fc98a){return function(_0x46ed2e){if(_0x46ed2e){var _0x2094e5=_0x46ed2e['count'],_0x258b13=_0x4fc98a['offset'],_0x51de42=_0x4fc98a[_0x234d('0x17')]+_0x4fc98a[_0x234d('0x18')],_0x52b2a4;if(_0x51de42>=_0x2094e5){_0x51de42=_0x2094e5;_0x52b2a4=0xc8;}else{_0x52b2a4=0xce;}_0x4676aa[_0x234d('0x15')](_0x52b2a4);return _0x4676aa[_0x234d('0x19')](_0x234d('0x1a'),_0x258b13+'-'+_0x51de42+'/'+_0x2094e5)[_0x234d('0x16')](_0x46ed2e);}return null;};}function patchUpdates(_0x2b4ed2){return function(_0xc194ed){try{jsonpatch[_0x234d('0x1b')](_0xc194ed,_0x2b4ed2,!![]);}catch(_0x34ee4f){return BPromise[_0x234d('0x1c')](_0x34ee4f);}return _0xc194ed[_0x234d('0x1d')]();};}function saveUpdates(_0x213342,_0x2a5451){return function(_0x3e6e20){if(_0x3e6e20){return _0x3e6e20[_0x234d('0x1e')](_0x213342)[_0x234d('0x1f')](function(_0x49f04e){return _0x49f04e;});}return null;};}function removeEntity(_0x3da00d,_0x2a15e2){return function(_0x140a91){if(_0x140a91){return _0x140a91[_0x234d('0x20')]()['then'](function(){_0x3da00d[_0x234d('0x15')](0xcc)[_0x234d('0x21')]();});}};}function handleEntityNotFound(_0x44b77f,_0x36d378){return function(_0x5da4c2){if(!_0x5da4c2){_0x44b77f[_0x234d('0x22')](0x194);}return _0x5da4c2;};}function handleError(_0x59d66d,_0x1b373b){_0x1b373b=_0x1b373b||0x1f4;return function(_0x1cd419){logger['error'](_0x1cd419[_0x234d('0x23')]);if(_0x1cd419['name']){delete _0x1cd419[_0x234d('0x24')];}_0x59d66d['status'](_0x1b373b)[_0x234d('0x25')](_0x1cd419);};}exports['index']=function(_0x1f6c9a,_0x1df895){var _0x476d8a={},_0x1acab8={},_0x534c1e={'count':0x0,'rows':[]};var _0x91c9f3=_['map'](db[_0x234d('0x26')][_0x234d('0x27')],function(_0x3e98c8){return{'name':_0x3e98c8[_0x234d('0x28')],'type':_0x3e98c8['type'][_0x234d('0x29')]};});_0x1acab8[_0x234d('0x2a')]=_[_0x234d('0x2b')](_0x91c9f3,_0x234d('0x24'));_0x1acab8['query']=_[_0x234d('0x2c')](_0x1f6c9a[_0x234d('0x2d')]);_0x1acab8['filters']=_['intersection'](_0x1acab8[_0x234d('0x2a')],_0x1acab8[_0x234d('0x2d')]);_0x476d8a[_0x234d('0x2e')]=_[_0x234d('0x2f')](_0x1acab8['model'],qs[_0x234d('0x30')](_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x30')]));_0x476d8a['attributes']=_0x476d8a[_0x234d('0x2e')][_0x234d('0x31')]?_0x476d8a[_0x234d('0x2e')]:_0x1acab8['model'];if(!_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x32')](_0x234d('0x33'))){_0x476d8a['limit']=qs['limit'](_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x18')]);_0x476d8a[_0x234d('0x17')]=qs[_0x234d('0x17')](_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x17')]);}_0x476d8a['order']=qs[_0x234d('0x34')](_0x1f6c9a[_0x234d('0x2d')][_0x234d('0x34')]);_0x476d8a[_0x234d('0x35')]=qs[_0x234d('0x36')](_[_0x234d('0x37')](_0x1f6c9a['query'],_0x1acab8[_0x234d('0x36')]),_0x91c9f3);if(_0x1f6c9a['query']['filter']){_0x476d8a['where']=_[_0x234d('0x38')](_0x476d8a['where'],{'$or':_['map'](_0x91c9f3,function(_0x23bec7){if(_0x23bec7[_0x234d('0x39')]!==_0x234d('0x3a')){var _0x392219={};_0x392219[_0x23bec7['name']]={'$like':'%'+_0x1f6c9a[_0x234d('0x2d')]['filter']+'%'};return _0x392219;}})});}_0x476d8a=_['merge']({},_0x476d8a,_0x1f6c9a[_0x234d('0x3b')]);var _0x7f38d1={'where':_0x476d8a[_0x234d('0x35')]};return db['MailQueueReport'][_0x234d('0x3c')](_0x7f38d1)[_0x234d('0x1f')](function(_0x1aa720){_0x534c1e[_0x234d('0x3c')]=_0x1aa720;if(_0x1f6c9a[_0x234d('0x2d')]['includeAll']){_0x476d8a[_0x234d('0x3d')]=[{'all':!![]}];}return db[_0x234d('0x26')][_0x234d('0x3e')](_0x476d8a);})[_0x234d('0x1f')](function(_0x546e8b){_0x534c1e[_0x234d('0x3f')]=_0x546e8b;return _0x534c1e;})['then'](respondWithFilteredResult(_0x1df895,_0x476d8a))['catch'](handleError(_0x1df895,null));};exports[_0x234d('0x40')]=function(_0x28c15a,_0x30ecfc){var _0x26c47a={'raw':!![],'where':{'id':_0x28c15a[_0x234d('0x41')]['id']}},_0x16ab24={};_0x16ab24[_0x234d('0x2a')]=_[_0x234d('0x2c')](db[_0x234d('0x26')][_0x234d('0x27')]);_0x16ab24[_0x234d('0x2d')]=_[_0x234d('0x2c')](_0x28c15a[_0x234d('0x2d')]);_0x16ab24[_0x234d('0x36')]=_[_0x234d('0x2f')](_0x16ab24[_0x234d('0x2a')],_0x16ab24['query']);_0x26c47a[_0x234d('0x2e')]=_[_0x234d('0x2f')](_0x16ab24['model'],qs[_0x234d('0x30')](_0x28c15a[_0x234d('0x2d')]['fields']));_0x26c47a[_0x234d('0x2e')]=_0x26c47a[_0x234d('0x2e')][_0x234d('0x31')]?_0x26c47a['attributes']:_0x16ab24[_0x234d('0x2a')];if(_0x28c15a[_0x234d('0x2d')][_0x234d('0x42')]){_0x26c47a[_0x234d('0x3d')]=[{'all':!![]}];}_0x26c47a=_['merge']({},_0x26c47a,_0x28c15a[_0x234d('0x3b')]);return db[_0x234d('0x26')][_0x234d('0x43')](_0x26c47a)['then'](handleEntityNotFound(_0x30ecfc,null))['then'](respondWithResult(_0x30ecfc,null))['catch'](handleError(_0x30ecfc,null));};exports[_0x234d('0x44')]=function(_0x55599a,_0x22816a){return db[_0x234d('0x26')]['create'](_0x55599a[_0x234d('0x45')],{})[_0x234d('0x1f')](respondWithResult(_0x22816a,0xc9))[_0x234d('0x46')](handleError(_0x22816a,null));};exports['update']=function(_0x55239d,_0x25bc4b){if(_0x55239d['body']['id']){delete _0x55239d[_0x234d('0x45')]['id'];}return db[_0x234d('0x26')][_0x234d('0x43')]({'where':{'id':_0x55239d['params']['id']}})[_0x234d('0x1f')](handleEntityNotFound(_0x25bc4b,null))['then'](saveUpdates(_0x55239d[_0x234d('0x45')],null))['then'](respondWithResult(_0x25bc4b,null))[_0x234d('0x46')](handleError(_0x25bc4b,null));};exports[_0x234d('0x20')]=function(_0x53767d,_0x45b143){return db[_0x234d('0x26')][_0x234d('0x43')]({'where':{'id':_0x53767d[_0x234d('0x41')]['id']}})[_0x234d('0x1f')](handleEntityNotFound(_0x45b143,null))['then'](removeEntity(_0x45b143,null))['catch'](handleError(_0x45b143,null));};exports['describe']=function(_0x31ced6,_0x3f63f3){return db[_0x234d('0x26')][_0x234d('0x47')]()['then'](respondWithResult(_0x3f63f3,null))[_0x234d('0x46')](handleError(_0x3f63f3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 1fa6186..4e4af22 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 _0xf108=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xf108,0x1d9));var _0x8f10=function(_0x1e1911,_0x1326ce){_0x1e1911=_0x1e1911-0x0;var _0x51f6c7=_0xf108[_0x1e1911];return _0x51f6c7;};'use strict';var _=require(_0x8f10('0x0'));var util=require('util');var logger=require(_0x8f10('0x1'))(_0x8f10('0x2'));var moment=require(_0x8f10('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f10('0x4'));var config=require(_0x8f10('0x5'));var attributes=require(_0x8f10('0x6'));module[_0x8f10('0x7')]=function(_0x2e3419,_0x235737){return _0x2e3419[_0x8f10('0x8')](_0x8f10('0x9'),attributes,{'tableName':_0x8f10('0xa'),'paranoid':![],'indexes':[{'name':_0x8f10('0xb'),'fields':[_0x8f10('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x15b8=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x15b8,0xcd));var _0x815b=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x15b8[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var logger=require(_0x815b('0x1'))(_0x815b('0x2'));var moment=require(_0x815b('0x3'));var BPromise=require(_0x815b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x815b('0x5'));var rimraf=require(_0x815b('0x6'));var config=require(_0x815b('0x7'));var attributes=require(_0x815b('0x8'));module[_0x815b('0x9')]=function(_0x37a503,_0x581869){return _0x37a503[_0x815b('0xa')](_0x815b('0xb'),attributes,{'tableName':_0x815b('0xc'),'paranoid':![],'indexes':[{'name':_0x815b('0xd'),'fields':[_0x815b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 4193563..58aa373 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateMailQueueReport','create','body','options','debug','stringify','UpdateMailQueueReport','MailQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0xf494,0x1c6));var _0x4f49=function(_0x4e14be,_0x582681){_0x4e14be=_0x4e14be-0x0;var _0x411d69=_0xf494[_0x4e14be];return _0x411d69;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['MailQueueReport'][_0x4f49('0x17')](_0x4e85df[_0x4f49('0x18')],{'raw':_0x4e85df[_0x4f49('0x19')]?_0x4e85df[_0x4f49('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4f49('0xe')](function(_0x2aed27){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1a')]('CreateMailQueueReport',_0x4e85df,JSON[_0x4f49('0x1b')](_0x2aed27));_0x5bb23b(_0x2aed27);})[_0x4f49('0x15')](function(_0x3ae590){logger['error'](_0x4f49('0x16'),_0x3ae590[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x3ae590[_0x4f49('0x14')]));});});};exports[_0x4f49('0x1c')]=function(_0x36187b){var _0x559d98=this;return new Promise(function(_0x4e9041,_0x3a947b){return db[_0x4f49('0x1d')]['update'](_0x36187b[_0x4f49('0x18')],{'raw':_0x36187b[_0x4f49('0x19')]?_0x36187b[_0x4f49('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36187b[_0x4f49('0x19')]?_0x36187b[_0x4f49('0x19')][_0x4f49('0x1e')]||null:null,'attributes':_0x36187b[_0x4f49('0x19')]?_0x36187b[_0x4f49('0x19')][_0x4f49('0x1f')]||null:null,'limit':_0x36187b['options']?_0x36187b['options'][_0x4f49('0x20')]||null:null})[_0x4f49('0xe')](function(_0x605c91){logger['info'](_0x4f49('0x1c'),_0x36187b);logger[_0x4f49('0x1a')](_0x4f49('0x1c'),_0x36187b,JSON['stringify'](_0x605c91));_0x4e9041(_0x605c91);})['catch'](function(_0x3e207f){logger[_0x4f49('0x13')](_0x4f49('0x1c'),_0x3e207f['message'],_0x36187b);_0x3a947b(_0x559d98[_0x4f49('0x13')](0x1f4,_0x3e207f[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x28a8c2,_0x494d5){var _0x37ac3c=function(_0x2882b3){while(--_0x2882b3){_0x28a8c2['push'](_0x28a8c2['shift']());}};_0x37ac3c(++_0x494d5);}(_0xdb28,0x106));var _0x8db2=function(_0x220e4f,_0x42b51f){_0x220e4f=_0x220e4f-0x0;var _0x469368=_0xdb28[_0x220e4f];return _0x469368;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index fd0b9bb..c13ca22 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 _0x182f=['util','connect-timeout','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x182f,0x113));var _0xf182=function(_0x37b286,_0x55435a){_0x37b286=_0x37b286-0x0;var _0x446179=_0x182f[_0x37b286];return _0x446179;};'use strict';var multer=require(_0xf182('0x0'));var util=require(_0xf182('0x1'));var path=require('path');var timeout=require(_0xf182('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf182('0x3'));var config=require(_0xf182('0x4'));module[_0xf182('0x5')]=router; \ No newline at end of file +var _0x0d0e=['exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x15c070,_0x10012d){var _0x3f81bb=function(_0x237443){while(--_0x237443){_0x15c070['push'](_0x15c070['shift']());}};_0x3f81bb(++_0x10012d);}(_0x0d0e,0x17b));var _0xe0d0=function(_0x36c28a,_0x55c76c){_0x36c28a=_0x36c28a-0x0;var _0x2ee873=_0x0d0e[_0x36c28a];return _0x2ee873;};'use strict';var multer=require(_0xe0d0('0x0'));var util=require('util');var path=require(_0xe0d0('0x1'));var timeout=require(_0xe0d0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe0d0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe0d0('0x4'));module[_0xe0d0('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 7e3033b..a4bf9b7 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 _0xbc27=['STRING','BOOLEAN','username','INTEGER','sequelize','exports'];(function(_0x11cbcd,_0x13a2ce){var _0x597934=function(_0x253ba9){while(--_0x253ba9){_0x11cbcd['push'](_0x11cbcd['shift']());}};_0x597934(++_0x13a2ce);}(_0xbc27,0xdc));var _0x7bc2=function(_0x373d8,_0xb69e75){_0x373d8=_0x373d8-0x0;var _0x4d6d14=_0xbc27[_0x373d8];return _0x4d6d14;};'use strict';var Sequelize=require(_0x7bc2('0x0'));module[_0x7bc2('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7bc2('0x2')]},'authentication':{'type':Sequelize[_0x7bc2('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7bc2('0x2')],'unique':_0x7bc2('0x4')},'password':{'type':Sequelize[_0x7bc2('0x2')]},'port':{'type':Sequelize[_0x7bc2('0x5')]},'tls':{'type':Sequelize[_0x7bc2('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x7bc2('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7bc2('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x7bc2('0x2')]}}; \ No newline at end of file +var _0x02b7=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x10df87,_0x4e3dcb){var _0x22923d=function(_0x439738){while(--_0x439738){_0x10df87['push'](_0x10df87['shift']());}};_0x22923d(++_0x4e3dcb);}(_0x02b7,0x1ed));var _0x702b=function(_0x2a1cd3,_0x17a7cc){_0x2a1cd3=_0x2a1cd3-0x0;var _0x319831=_0x02b7[_0x2a1cd3];return _0x319831;};'use strict';var Sequelize=require(_0x702b('0x0'));module['exports']={'description':{'type':Sequelize[_0x702b('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x702b('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x702b('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x702b('0x1')]},'port':{'type':Sequelize[_0x702b('0x3')]},'tls':{'type':Sequelize[_0x702b('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x702b('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x702b('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x702b('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x702b('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0128c11..434dd2c 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 _0xfcbe=['mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x52b8a8,_0x383b86){var _0x49e67f=function(_0x55486e){while(--_0x55486e){_0x52b8a8['push'](_0x52b8a8['shift']());}};_0x49e67f(++_0x383b86);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x3dc2bf,_0x5c13dd){_0x3dc2bf=_0x3dc2bf-0x0;var _0x1c9865=_0xfcbe[_0x3dc2bf];return _0x1c9865;};'use strict';var _=require('lodash');var util=require(_0xefcb('0x0'));var logger=require(_0xefcb('0x1'))(_0xefcb('0x2'));var moment=require(_0xefcb('0x3'));var BPromise=require(_0xefcb('0x4'));var rp=require(_0xefcb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefcb('0x6'));var config=require(_0xefcb('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x50dcde,_0x3f322c){return _0x50dcde['define']('MailServerIn',attributes,{'tableName':_0xefcb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a63=['exports','MailServerIn','lodash','util','moment','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x5a63,0xe3));var _0x35a6=function(_0x3d78f0,_0x300cef){_0x3d78f0=_0x3d78f0-0x0;var _0x467e11=_0x5a63[_0x3d78f0];return _0x467e11;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x35a6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a6('0x3'));var rimraf=require(_0x35a6('0x4'));var config=require(_0x35a6('0x5'));var attributes=require(_0x35a6('0x6'));module[_0x35a6('0x7')]=function(_0x489043,_0x25e5a6){return _0x489043['define'](_0x35a6('0x8'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 797f4e6..7814d67 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 _0xce72=['attributes','limit','include','map','model','GetMailServerIn','catch','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','MailServerIn','raw','options'];(function(_0x2f97eb,_0x31e4cb){var _0x82abdb=function(_0x52f7a1){while(--_0x52f7a1){_0x2f97eb['push'](_0x2f97eb['shift']());}};_0x82abdb(++_0x31e4cb);}(_0xce72,0x115));var _0x2ce7=function(_0x3ed4f7,_0x521aa8){_0x3ed4f7=_0x3ed4f7-0x0;var _0x31cc7a=_0xce72[_0x3ed4f7];return _0x31cc7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2ce7('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ce7('0x1'))['db'];var utils=require(_0x2ce7('0x2'));var logger=require('../../config/logger')(_0x2ce7('0x3'));var config=require('../../config/environment');var jayson=require(_0x2ce7('0x4'));var client=jayson[_0x2ce7('0x5')][_0x2ce7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x187e10,_0xbbda4a,_0x410fe3){return new BPromise(function(_0x4f9e8e,_0x3369df){return client[_0x2ce7('0x7')](_0x187e10,_0x410fe3)[_0x2ce7('0x8')](function(_0x2d41ba){logger[_0x2ce7('0x9')](_0x2ce7('0xa'),_0xbbda4a,_0x2ce7('0xb'));logger[_0x2ce7('0xc')](_0x2ce7('0xd'),_0xbbda4a,_0x2ce7('0xb'),JSON[_0x2ce7('0xe')](_0x2d41ba));if(_0x2d41ba[_0x2ce7('0xf')]){if(_0x2d41ba['error']['code']===0x1f4){logger[_0x2ce7('0xf')]('MailServerIn,\x20%s,\x20%s',_0xbbda4a,_0x2d41ba[_0x2ce7('0xf')][_0x2ce7('0x10')]);return _0x3369df(_0x2d41ba[_0x2ce7('0xf')][_0x2ce7('0x10')]);}logger[_0x2ce7('0xf')](_0x2ce7('0xa'),_0xbbda4a,_0x2d41ba[_0x2ce7('0xf')]['message']);return _0x4f9e8e(_0x2d41ba['error'][_0x2ce7('0x10')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0xbbda4a,_0x2ce7('0xb'));_0x4f9e8e(_0x2d41ba['result'][_0x2ce7('0x10')]);}})['catch'](function(_0x431340){logger[_0x2ce7('0xf')](_0x2ce7('0xa'),_0xbbda4a,_0x431340);_0x3369df(_0x431340);});});}exports['GetMailServerIn']=function(_0x31d80c){var _0x57c83e=this;return new Promise(function(_0x46fd5f,_0x118758){return db[_0x2ce7('0x11')]['findAll']({'raw':_0x31d80c['options']?_0x31d80c['options'][_0x2ce7('0x12')]===undefined?!![]:![]:!![],'where':_0x31d80c[_0x2ce7('0x13')]?_0x31d80c[_0x2ce7('0x13')]['where']||null:null,'attributes':_0x31d80c['options']?_0x31d80c[_0x2ce7('0x13')][_0x2ce7('0x14')]||null:null,'limit':_0x31d80c[_0x2ce7('0x13')]?_0x31d80c[_0x2ce7('0x13')][_0x2ce7('0x15')]||null:null,'include':_0x31d80c[_0x2ce7('0x13')]?_0x31d80c[_0x2ce7('0x13')][_0x2ce7('0x16')]?_[_0x2ce7('0x17')](_0x31d80c[_0x2ce7('0x13')][_0x2ce7('0x16')],function(_0x4ef3a4){return{'model':db[_0x4ef3a4[_0x2ce7('0x18')]],'as':_0x4ef3a4['as'],'attributes':_0x4ef3a4[_0x2ce7('0x14')],'include':_0x4ef3a4[_0x2ce7('0x16')]?_[_0x2ce7('0x17')](_0x4ef3a4[_0x2ce7('0x16')],function(_0x2f12a6){return{'model':db[_0x2f12a6['model']],'as':_0x2f12a6['as'],'attributes':_0x2f12a6[_0x2ce7('0x14')],'include':_0x2f12a6[_0x2ce7('0x16')]?_[_0x2ce7('0x17')](_0x2f12a6['include'],function(_0x235656){return{'model':db[_0x235656[_0x2ce7('0x18')]],'as':_0x235656['as'],'attributes':_0x235656[_0x2ce7('0x14')]};}):[]};}):[]};}):[]:[]})[_0x2ce7('0x8')](function(_0x270b86){logger['info'](_0x2ce7('0x19'),_0x31d80c);logger[_0x2ce7('0xc')](_0x2ce7('0x19'),_0x31d80c,JSON[_0x2ce7('0xe')](_0x270b86));_0x46fd5f(_0x270b86);})[_0x2ce7('0x1a')](function(_0x412e10){logger[_0x2ce7('0xf')](_0x2ce7('0x19'),_0x412e10[_0x2ce7('0x10')],_0x31d80c);_0x118758(_0x57c83e[_0x2ce7('0xf')](0x1f4,_0x412e10[_0x2ce7('0x10')]));});});}; \ No newline at end of file +var _0x484e=['request','then','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','MailServerIn','findAll','options','raw','attributes','include','map','model','GetMailServerIn','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x3e9862,_0xe1f9d2){var _0x48a164=function(_0x4c973a){while(--_0x4c973a){_0x3e9862['push'](_0x3e9862['shift']());}};_0x48a164(++_0xe1f9d2);}(_0x484e,0x124));var _0xe484=function(_0x5a6fbd,_0x53345d){_0x5a6fbd=_0x5a6fbd-0x0;var _0x83b915=_0x484e[_0x5a6fbd];return _0x83b915;};'use strict';var _=require('lodash');var util=require(_0xe484('0x0'));var moment=require('moment');var BPromise=require(_0xe484('0x1'));var rs=require(_0xe484('0x2'));var fs=require('fs');var Redis=require(_0xe484('0x3'));var db=require(_0xe484('0x4'))['db'];var utils=require(_0xe484('0x5'));var logger=require('../../config/logger')(_0xe484('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe484('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13e599,_0x35c5f3,_0x5c5c34){return new BPromise(function(_0x322708,_0x30bde0){return client[_0xe484('0x8')](_0x13e599,_0x5c5c34)[_0xe484('0x9')](function(_0x2bb112){logger[_0xe484('0xa')]('MailServerIn,\x20%s,\x20%s',_0x35c5f3,_0xe484('0xb'));logger['debug'](_0xe484('0xc'),_0x35c5f3,_0xe484('0xb'),JSON[_0xe484('0xd')](_0x2bb112));if(_0x2bb112['error']){if(_0x2bb112[_0xe484('0xe')][_0xe484('0xf')]===0x1f4){logger[_0xe484('0xe')](_0xe484('0x10'),_0x35c5f3,_0x2bb112['error']['message']);return _0x30bde0(_0x2bb112[_0xe484('0xe')][_0xe484('0x11')]);}logger[_0xe484('0xe')]('MailServerIn,\x20%s,\x20%s',_0x35c5f3,_0x2bb112['error'][_0xe484('0x11')]);return _0x322708(_0x2bb112[_0xe484('0xe')][_0xe484('0x11')]);}else{logger[_0xe484('0xa')]('MailServerIn,\x20%s,\x20%s',_0x35c5f3,'request\x20sent');_0x322708(_0x2bb112[_0xe484('0x12')][_0xe484('0x11')]);}})[_0xe484('0x13')](function(_0x457090){logger[_0xe484('0xe')]('MailServerIn,\x20%s,\x20%s',_0x35c5f3,_0x457090);_0x30bde0(_0x457090);});});}exports['GetMailServerIn']=function(_0x286a05){var _0x21f986=this;return new Promise(function(_0x1ecf8b,_0x123152){return db[_0xe484('0x14')][_0xe484('0x15')]({'raw':_0x286a05[_0xe484('0x16')]?_0x286a05[_0xe484('0x16')][_0xe484('0x17')]===undefined?!![]:![]:!![],'where':_0x286a05[_0xe484('0x16')]?_0x286a05[_0xe484('0x16')]['where']||null:null,'attributes':_0x286a05['options']?_0x286a05[_0xe484('0x16')][_0xe484('0x18')]||null:null,'limit':_0x286a05[_0xe484('0x16')]?_0x286a05['options']['limit']||null:null,'include':_0x286a05[_0xe484('0x16')]?_0x286a05[_0xe484('0x16')][_0xe484('0x19')]?_[_0xe484('0x1a')](_0x286a05[_0xe484('0x16')]['include'],function(_0x5d2cf1){return{'model':db[_0x5d2cf1[_0xe484('0x1b')]],'as':_0x5d2cf1['as'],'attributes':_0x5d2cf1[_0xe484('0x18')],'include':_0x5d2cf1[_0xe484('0x19')]?_['map'](_0x5d2cf1['include'],function(_0x185481){return{'model':db[_0x185481['model']],'as':_0x185481['as'],'attributes':_0x185481[_0xe484('0x18')],'include':_0x185481[_0xe484('0x19')]?_[_0xe484('0x1a')](_0x185481[_0xe484('0x19')],function(_0xfeda7f){return{'model':db[_0xfeda7f[_0xe484('0x1b')]],'as':_0xfeda7f['as'],'attributes':_0xfeda7f[_0xe484('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe484('0x9')](function(_0x7280b7){logger[_0xe484('0xa')](_0xe484('0x1c'),_0x286a05);logger[_0xe484('0x1d')](_0xe484('0x1c'),_0x286a05,JSON[_0xe484('0xd')](_0x7280b7));_0x1ecf8b(_0x7280b7);})[_0xe484('0x13')](function(_0x15286a){logger[_0xe484('0xe')](_0xe484('0x1c'),_0x15286a['message'],_0x286a05);_0x123152(_0x21f986[_0xe484('0xe')](0x1f4,_0x15286a[_0xe484('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index fa3ae30..5a0eec9 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 _0x1c71=['multer','util','path','express','Router','../../components/auth/service','./mailServerOut.controller','isAuthenticated','index','get','show','post','create','update','delete','exports'];(function(_0x27887b,_0x23a9d8){var _0x20d858=function(_0x4daf87){while(--_0x4daf87){_0x27887b['push'](_0x27887b['shift']());}};_0x20d858(++_0x23a9d8);}(_0x1c71,0x1b0));var _0x11c7=function(_0x216fd1,_0x34d5dc){_0x216fd1=_0x216fd1-0x0;var _0x1829c8=_0x1c71[_0x216fd1];return _0x1829c8;};'use strict';var multer=require(_0x11c7('0x0'));var util=require(_0x11c7('0x1'));var path=require(_0x11c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x11c7('0x3'));var router=express[_0x11c7('0x4')]();var auth=require(_0x11c7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x11c7('0x6'));router['get']('/',auth[_0x11c7('0x7')](),controller[_0x11c7('0x8')]);router[_0x11c7('0x9')]('/:id',auth[_0x11c7('0x7')](),controller[_0x11c7('0xa')]);router[_0x11c7('0xb')]('/',auth['isAuthenticated'](),controller[_0x11c7('0xc')]);router['put']('/:id',auth[_0x11c7('0x7')](),controller[_0x11c7('0xd')]);router[_0x11c7('0xe')]('/:id',auth[_0x11c7('0x7')](),controller['destroy']);module[_0x11c7('0xf')]=router; \ No newline at end of file +var _0x2b81=['show','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','index','get','/:id'];(function(_0x138caa,_0x16baab){var _0x4d2be8=function(_0x3978bc){while(--_0x3978bc){_0x138caa['push'](_0x138caa['shift']());}};_0x4d2be8(++_0x16baab);}(_0x2b81,0x1b9));var _0x12b8=function(_0x1ad9a3,_0x56a1d){_0x1ad9a3=_0x1ad9a3-0x0;var _0x3dc656=_0x2b81[_0x1ad9a3];return _0x3dc656;};'use strict';var multer=require(_0x12b8('0x0'));var util=require(_0x12b8('0x1'));var path=require(_0x12b8('0x2'));var timeout=require(_0x12b8('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x12b8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x12b8('0x5'));var controller=require('./mailServerOut.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x12b8('0x6')]);router[_0x12b8('0x7')](_0x12b8('0x8'),auth['isAuthenticated'](),controller[_0x12b8('0x9')]);router['post']('/',auth[_0x12b8('0xa')](),controller['create']);router['put'](_0x12b8('0x8'),auth[_0x12b8('0xa')](),controller[_0x12b8('0xb')]);router[_0x12b8('0xc')](_0x12b8('0x8'),auth['isAuthenticated'](),controller[_0x12b8('0xd')]);module[_0x12b8('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 3eddd50..92e3482 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 _0xea4e=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0xaecc27,_0x3b15ab){var _0x2203ec=function(_0x47efdf){while(--_0x47efdf){_0xaecc27['push'](_0xaecc27['shift']());}};_0x2203ec(++_0x3b15ab);}(_0xea4e,0x10c));var _0xeea4=function(_0x4383e9,_0xa4b307){_0x4383e9=_0x4383e9-0x0;var _0x355405=_0xea4e[_0x4383e9];return _0x355405;};'use strict';var Sequelize=require(_0xeea4('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xeea4('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xeea4('0x2')]},'secure':{'type':Sequelize[_0xeea4('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xeea4('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x33ac=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x23e013,_0x5d060c){var _0x3cc945=function(_0x253331){while(--_0x253331){_0x23e013['push'](_0x23e013['shift']());}};_0x3cc945(++_0x5d060c);}(_0x33ac,0x1f2));var _0xc33a=function(_0x2fb3f5,_0x5a6374){_0x2fb3f5=_0x2fb3f5-0x0;var _0x1e23df=_0x33ac[_0x2fb3f5];return _0x1e23df;};'use strict';var Sequelize=require('sequelize');module[_0xc33a('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xc33a('0x1')]},'pass':{'type':Sequelize[_0xc33a('0x1')]},'port':{'type':Sequelize[_0xc33a('0x2')]},'secure':{'type':Sequelize[_0xc33a('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xc33a('0x1')]},'authentication':{'type':Sequelize[_0xc33a('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index caf8e3d..51a0268 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 _0x6488=['end','status','json','count','offset','limit','set','Content-Range','reject','then','error','name','send','index','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','map','type','filter','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6488,0x106));var _0x8648=function(_0x1501e2,_0x271210){_0x1501e2=_0x1501e2-0x0;var _0xfce8c5=_0x6488[_0x1501e2];return _0xfce8c5;};'use strict';var pdf=require(_0x8648('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8648('0x1'));var zipdir=require(_0x8648('0x2'));var jsonpatch=require(_0x8648('0x3'));var rp=require(_0x8648('0x4'));var moment=require(_0x8648('0x5'));var BPromise=require(_0x8648('0x6'));var Mustache=require(_0x8648('0x7'));var util=require(_0x8648('0x8'));var path=require(_0x8648('0x9'));var sox=require('sox');var csv=require(_0x8648('0xa'));var ejs=require(_0x8648('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8648('0xc'));var crypto=require(_0x8648('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8648('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8648('0xf'));var Papa=require('papaparse');var Redis=require(_0x8648('0x10'));var authService=require(_0x8648('0x11'));var qs=require(_0x8648('0x12'));var as=require(_0x8648('0x13'));var hardwareService=require(_0x8648('0x14'));var logger=require(_0x8648('0x15'))(_0x8648('0x16'));var utils=require(_0x8648('0x17'));var config=require(_0x8648('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a6afa,_0x245bc8){_0x245bc8=_0x245bc8||0xcc;return function(_0x23c547){if(_0x23c547){return _0x5a6afa[_0x8648('0x19')](_0x245bc8);}return _0x5a6afa['status'](_0x245bc8)[_0x8648('0x1a')]();};}function respondWithResult(_0x2944c2,_0x462d07){_0x462d07=_0x462d07||0xc8;return function(_0x209fb4){if(_0x209fb4){return _0x2944c2[_0x8648('0x1b')](_0x462d07)[_0x8648('0x1c')](_0x209fb4);}};}function respondWithFilteredResult(_0x4633aa,_0x9ae55c){return function(_0x7e432c){if(_0x7e432c){var _0x8e0aa4=_0x7e432c[_0x8648('0x1d')],_0x152a6a=_0x9ae55c[_0x8648('0x1e')],_0x3c4061=_0x9ae55c[_0x8648('0x1e')]+_0x9ae55c[_0x8648('0x1f')],_0x6cf922;if(_0x3c4061>=_0x8e0aa4){_0x3c4061=_0x8e0aa4;_0x6cf922=0xc8;}else{_0x6cf922=0xce;}_0x4633aa['status'](_0x6cf922);return _0x4633aa[_0x8648('0x20')](_0x8648('0x21'),_0x152a6a+'-'+_0x3c4061+'/'+_0x8e0aa4)[_0x8648('0x1c')](_0x7e432c);}return null;};}function patchUpdates(_0x49af2c){return function(_0x486bb6){try{jsonpatch['apply'](_0x486bb6,_0x49af2c,!![]);}catch(_0x1d81d5){return BPromise[_0x8648('0x22')](_0x1d81d5);}return _0x486bb6['save']();};}function saveUpdates(_0x11f7cd,_0x2a40af){return function(_0x259e69){if(_0x259e69){return _0x259e69['update'](_0x11f7cd)[_0x8648('0x23')](function(_0x5b9a27){return _0x5b9a27;});}return null;};}function removeEntity(_0xd047c6,_0x54709a){return function(_0x464248){if(_0x464248){return _0x464248['destroy']()[_0x8648('0x23')](function(){_0xd047c6['status'](0xcc)[_0x8648('0x1a')]();});}};}function handleEntityNotFound(_0x5b5ee6,_0x35b80b){return function(_0x2da08e){if(!_0x2da08e){_0x5b5ee6[_0x8648('0x19')](0x194);}return _0x2da08e;};}function handleError(_0x114fab,_0x1c0489){_0x1c0489=_0x1c0489||0x1f4;return function(_0x15326d){logger[_0x8648('0x24')](_0x15326d['stack']);if(_0x15326d['name']){delete _0x15326d[_0x8648('0x25')];}_0x114fab[_0x8648('0x1b')](_0x1c0489)[_0x8648('0x26')](_0x15326d);};}exports[_0x8648('0x27')]=function(_0x372106,_0x4bfc33){var _0x4b1c1f={},_0x131724={},_0x5e56c5={'count':0x0,'rows':[]};var _0x17b8fe=_['map'](db[_0x8648('0x28')][_0x8648('0x29')],function(_0x4d3eff){return{'name':_0x4d3eff[_0x8648('0x2a')],'type':_0x4d3eff['type'][_0x8648('0x2b')]};});_0x131724[_0x8648('0x2c')]=_['map'](_0x17b8fe,'name');_0x131724[_0x8648('0x2d')]=_[_0x8648('0x2e')](_0x372106[_0x8648('0x2d')]);_0x131724[_0x8648('0x2f')]=_['intersection'](_0x131724[_0x8648('0x2c')],_0x131724[_0x8648('0x2d')]);_0x4b1c1f[_0x8648('0x30')]=_['intersection'](_0x131724[_0x8648('0x2c')],qs[_0x8648('0x31')](_0x372106[_0x8648('0x2d')][_0x8648('0x31')]));_0x4b1c1f[_0x8648('0x30')]=_0x4b1c1f[_0x8648('0x30')]['length']?_0x4b1c1f['attributes']:_0x131724[_0x8648('0x2c')];if(!_0x372106[_0x8648('0x2d')][_0x8648('0x32')]('nolimit')){_0x4b1c1f[_0x8648('0x1f')]=qs[_0x8648('0x1f')](_0x372106[_0x8648('0x2d')][_0x8648('0x1f')]);_0x4b1c1f['offset']=qs[_0x8648('0x1e')](_0x372106[_0x8648('0x2d')][_0x8648('0x1e')]);}_0x4b1c1f[_0x8648('0x33')]=qs[_0x8648('0x34')](_0x372106[_0x8648('0x2d')][_0x8648('0x34')]);_0x4b1c1f[_0x8648('0x35')]=qs[_0x8648('0x2f')](_[_0x8648('0x36')](_0x372106[_0x8648('0x2d')],_0x131724['filters']),_0x17b8fe);if(_0x372106[_0x8648('0x2d')]['filter']){_0x4b1c1f[_0x8648('0x35')]=_[_0x8648('0x37')](_0x4b1c1f[_0x8648('0x35')],{'$or':_[_0x8648('0x38')](_0x17b8fe,function(_0x2bfa30){if(_0x2bfa30[_0x8648('0x39')]!=='VIRTUAL'){var _0x2fc4d9={};_0x2fc4d9[_0x2bfa30[_0x8648('0x25')]]={'$like':'%'+_0x372106[_0x8648('0x2d')][_0x8648('0x3a')]+'%'};return _0x2fc4d9;}})});}_0x4b1c1f=_[_0x8648('0x37')]({},_0x4b1c1f,_0x372106[_0x8648('0x3b')]);var _0x170903={'where':_0x4b1c1f[_0x8648('0x35')]};return db['MailServerOut'][_0x8648('0x1d')](_0x170903)[_0x8648('0x23')](function(_0x138365){_0x5e56c5[_0x8648('0x1d')]=_0x138365;if(_0x372106[_0x8648('0x2d')][_0x8648('0x3c')]){_0x4b1c1f[_0x8648('0x3d')]=[{'all':!![]}];}return db[_0x8648('0x28')][_0x8648('0x3e')](_0x4b1c1f);})[_0x8648('0x23')](function(_0x4db3ae){_0x5e56c5[_0x8648('0x3f')]=_0x4db3ae;return _0x5e56c5;})[_0x8648('0x23')](respondWithFilteredResult(_0x4bfc33,_0x4b1c1f))[_0x8648('0x40')](handleError(_0x4bfc33,null));};exports[_0x8648('0x41')]=function(_0xc5b4dd,_0x156182){var _0x592554={'raw':!![],'where':{'id':_0xc5b4dd['params']['id']}},_0x5377ae={};_0x5377ae[_0x8648('0x2c')]=_['keys'](db[_0x8648('0x28')][_0x8648('0x29')]);_0x5377ae[_0x8648('0x2d')]=_[_0x8648('0x2e')](_0xc5b4dd[_0x8648('0x2d')]);_0x5377ae['filters']=_['intersection'](_0x5377ae[_0x8648('0x2c')],_0x5377ae[_0x8648('0x2d')]);_0x592554['attributes']=_[_0x8648('0x42')](_0x5377ae[_0x8648('0x2c')],qs[_0x8648('0x31')](_0xc5b4dd[_0x8648('0x2d')]['fields']));_0x592554[_0x8648('0x30')]=_0x592554[_0x8648('0x30')][_0x8648('0x43')]?_0x592554[_0x8648('0x30')]:_0x5377ae[_0x8648('0x2c')];if(_0xc5b4dd['query'][_0x8648('0x3c')]){_0x592554[_0x8648('0x3d')]=[{'all':!![]}];}_0x592554=_[_0x8648('0x37')]({},_0x592554,_0xc5b4dd[_0x8648('0x3b')]);return db[_0x8648('0x28')][_0x8648('0x44')](_0x592554)['then'](handleEntityNotFound(_0x156182,null))[_0x8648('0x23')](respondWithResult(_0x156182,null))[_0x8648('0x40')](handleError(_0x156182,null));};exports[_0x8648('0x45')]=function(_0x3886e2,_0x209cdb){return db[_0x8648('0x28')][_0x8648('0x45')](_0x3886e2[_0x8648('0x46')],{})[_0x8648('0x23')](respondWithResult(_0x209cdb,0xc9))[_0x8648('0x40')](handleError(_0x209cdb,null));};exports['update']=function(_0x2da0f7,_0x517c62){if(_0x2da0f7['body']['id']){delete _0x2da0f7[_0x8648('0x46')]['id'];}return db[_0x8648('0x28')][_0x8648('0x44')]({'where':{'id':_0x2da0f7[_0x8648('0x47')]['id']}})[_0x8648('0x23')](handleEntityNotFound(_0x517c62,null))[_0x8648('0x23')](saveUpdates(_0x2da0f7[_0x8648('0x46')],null))[_0x8648('0x23')](respondWithResult(_0x517c62,null))['catch'](handleError(_0x517c62,null));};exports['destroy']=function(_0x297b29,_0x4cbe1a){return db['MailServerOut']['find']({'where':{'id':_0x297b29[_0x8648('0x47')]['id']}})[_0x8648('0x23')](handleEntityNotFound(_0x4cbe1a,null))[_0x8648('0x23')](removeEntity(_0x4cbe1a,null))[_0x8648('0x40')](handleError(_0x4cbe1a,null));}; \ No newline at end of file +var _0x616a=['MailServerOut','findAll','show','params','keys','length','merge','options','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','status','end','json','count','limit','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','offset','order','sort','where','pick','filter','includeAll','include'];(function(_0x23320d,_0x11c192){var _0x23aaa4=function(_0x28037d){while(--_0x28037d){_0x23320d['push'](_0x23320d['shift']());}};_0x23aaa4(++_0x11c192);}(_0x616a,0x11d));var _0xa616=function(_0x1c10b4,_0x3bbb18){_0x1c10b4=_0x1c10b4-0x0;var _0x1f766c=_0x616a[_0x1c10b4];return _0x1f766c;};'use strict';var pdf=require(_0xa616('0x0'));var emlformat=require(_0xa616('0x1'));var rimraf=require(_0xa616('0x2'));var zipdir=require(_0xa616('0x3'));var jsonpatch=require(_0xa616('0x4'));var rp=require('request-promise');var moment=require(_0xa616('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa616('0x6'));var util=require(_0xa616('0x7'));var path=require(_0xa616('0x8'));var sox=require('sox');var csv=require(_0xa616('0x9'));var ejs=require(_0xa616('0xa'));var fs=require('fs');var _=require(_0xa616('0xb'));var squel=require('squel');var crypto=require(_0xa616('0xc'));var jsforce=require(_0xa616('0xd'));var deskjs=require(_0xa616('0xe'));var toCsv=require(_0xa616('0x9'));var querystring=require(_0xa616('0xf'));var Papa=require('papaparse');var Redis=require(_0xa616('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa616('0x11'));var as=require(_0xa616('0x12'));var hardwareService=require(_0xa616('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa616('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x408fe2,_0x59b289){_0x59b289=_0x59b289||0xcc;return function(_0x11da77){if(_0x11da77){return _0x408fe2['sendStatus'](_0x59b289);}return _0x408fe2[_0xa616('0x15')](_0x59b289)[_0xa616('0x16')]();};}function respondWithResult(_0x524df4,_0xa7c604){_0xa7c604=_0xa7c604||0xc8;return function(_0x4daba9){if(_0x4daba9){return _0x524df4[_0xa616('0x15')](_0xa7c604)[_0xa616('0x17')](_0x4daba9);}};}function respondWithFilteredResult(_0x27d5d6,_0x2cd0d5){return function(_0x5d3c01){if(_0x5d3c01){var _0x5bd270=_0x5d3c01[_0xa616('0x18')],_0xb830cf=_0x2cd0d5['offset'],_0x24e0ac=_0x2cd0d5['offset']+_0x2cd0d5[_0xa616('0x19')],_0x168c4a;if(_0x24e0ac>=_0x5bd270){_0x24e0ac=_0x5bd270;_0x168c4a=0xc8;}else{_0x168c4a=0xce;}_0x27d5d6[_0xa616('0x15')](_0x168c4a);return _0x27d5d6[_0xa616('0x1a')](_0xa616('0x1b'),_0xb830cf+'-'+_0x24e0ac+'/'+_0x5bd270)[_0xa616('0x17')](_0x5d3c01);}return null;};}function patchUpdates(_0x1b1f34){return function(_0xf6c28b){try{jsonpatch[_0xa616('0x1c')](_0xf6c28b,_0x1b1f34,!![]);}catch(_0xa68473){return BPromise['reject'](_0xa68473);}return _0xf6c28b['save']();};}function saveUpdates(_0x548dd7,_0x29bcf0){return function(_0x26adf5){if(_0x26adf5){return _0x26adf5[_0xa616('0x1d')](_0x548dd7)[_0xa616('0x1e')](function(_0x2d1c36){return _0x2d1c36;});}return null;};}function removeEntity(_0x3170ab,_0x4d1390){return function(_0x273dbb){if(_0x273dbb){return _0x273dbb['destroy']()[_0xa616('0x1e')](function(){_0x3170ab[_0xa616('0x15')](0xcc)[_0xa616('0x16')]();});}};}function handleEntityNotFound(_0x25c46f,_0xd1892f){return function(_0x11d300){if(!_0x11d300){_0x25c46f[_0xa616('0x1f')](0x194);}return _0x11d300;};}function handleError(_0x43b2a6,_0xa931a3){_0xa931a3=_0xa931a3||0x1f4;return function(_0x3be3fd){logger[_0xa616('0x20')](_0x3be3fd[_0xa616('0x21')]);if(_0x3be3fd[_0xa616('0x22')]){delete _0x3be3fd['name'];}_0x43b2a6[_0xa616('0x15')](_0xa931a3)[_0xa616('0x23')](_0x3be3fd);};}exports['index']=function(_0x5ba539,_0x27a335){var _0x5ccfdf={},_0x2636fe={},_0x10e367={'count':0x0,'rows':[]};var _0x36016f=_[_0xa616('0x24')](db['MailServerOut'][_0xa616('0x25')],function(_0x506024){return{'name':_0x506024['fieldName'],'type':_0x506024[_0xa616('0x26')][_0xa616('0x27')]};});_0x2636fe[_0xa616('0x28')]=_[_0xa616('0x24')](_0x36016f,_0xa616('0x22'));_0x2636fe[_0xa616('0x29')]=_['keys'](_0x5ba539[_0xa616('0x29')]);_0x2636fe[_0xa616('0x2a')]=_[_0xa616('0x2b')](_0x2636fe['model'],_0x2636fe[_0xa616('0x29')]);_0x5ccfdf['attributes']=_[_0xa616('0x2b')](_0x2636fe[_0xa616('0x28')],qs[_0xa616('0x2c')](_0x5ba539['query']['fields']));_0x5ccfdf[_0xa616('0x2d')]=_0x5ccfdf[_0xa616('0x2d')]['length']?_0x5ccfdf['attributes']:_0x2636fe['model'];if(!_0x5ba539['query']['hasOwnProperty'](_0xa616('0x2e'))){_0x5ccfdf['limit']=qs[_0xa616('0x19')](_0x5ba539[_0xa616('0x29')][_0xa616('0x19')]);_0x5ccfdf[_0xa616('0x2f')]=qs[_0xa616('0x2f')](_0x5ba539['query'][_0xa616('0x2f')]);}_0x5ccfdf[_0xa616('0x30')]=qs[_0xa616('0x31')](_0x5ba539[_0xa616('0x29')]['sort']);_0x5ccfdf[_0xa616('0x32')]=qs['filters'](_[_0xa616('0x33')](_0x5ba539[_0xa616('0x29')],_0x2636fe[_0xa616('0x2a')]),_0x36016f);if(_0x5ba539[_0xa616('0x29')][_0xa616('0x34')]){_0x5ccfdf[_0xa616('0x32')]=_['merge'](_0x5ccfdf[_0xa616('0x32')],{'$or':_[_0xa616('0x24')](_0x36016f,function(_0x3b542f){if(_0x3b542f['type']!=='VIRTUAL'){var _0x4c76ee={};_0x4c76ee[_0x3b542f[_0xa616('0x22')]]={'$like':'%'+_0x5ba539[_0xa616('0x29')][_0xa616('0x34')]+'%'};return _0x4c76ee;}})});}_0x5ccfdf=_['merge']({},_0x5ccfdf,_0x5ba539['options']);var _0x2dde6d={'where':_0x5ccfdf['where']};return db['MailServerOut'][_0xa616('0x18')](_0x2dde6d)[_0xa616('0x1e')](function(_0xb8b4af){_0x10e367[_0xa616('0x18')]=_0xb8b4af;if(_0x5ba539[_0xa616('0x29')][_0xa616('0x35')]){_0x5ccfdf[_0xa616('0x36')]=[{'all':!![]}];}return db[_0xa616('0x37')][_0xa616('0x38')](_0x5ccfdf);})['then'](function(_0x247ca5){_0x10e367['rows']=_0x247ca5;return _0x10e367;})[_0xa616('0x1e')](respondWithFilteredResult(_0x27a335,_0x5ccfdf))['catch'](handleError(_0x27a335,null));};exports[_0xa616('0x39')]=function(_0x593c26,_0x309752){var _0x2875ad={'raw':!![],'where':{'id':_0x593c26[_0xa616('0x3a')]['id']}},_0x5d8b2b={};_0x5d8b2b['model']=_[_0xa616('0x3b')](db['MailServerOut'][_0xa616('0x25')]);_0x5d8b2b[_0xa616('0x29')]=_['keys'](_0x593c26[_0xa616('0x29')]);_0x5d8b2b[_0xa616('0x2a')]=_[_0xa616('0x2b')](_0x5d8b2b[_0xa616('0x28')],_0x5d8b2b[_0xa616('0x29')]);_0x2875ad[_0xa616('0x2d')]=_[_0xa616('0x2b')](_0x5d8b2b['model'],qs[_0xa616('0x2c')](_0x593c26[_0xa616('0x29')]['fields']));_0x2875ad[_0xa616('0x2d')]=_0x2875ad[_0xa616('0x2d')][_0xa616('0x3c')]?_0x2875ad[_0xa616('0x2d')]:_0x5d8b2b[_0xa616('0x28')];if(_0x593c26[_0xa616('0x29')][_0xa616('0x35')]){_0x2875ad['include']=[{'all':!![]}];}_0x2875ad=_[_0xa616('0x3d')]({},_0x2875ad,_0x593c26[_0xa616('0x3e')]);return db['MailServerOut'][_0xa616('0x3f')](_0x2875ad)[_0xa616('0x1e')](handleEntityNotFound(_0x309752,null))[_0xa616('0x1e')](respondWithResult(_0x309752,null))[_0xa616('0x40')](handleError(_0x309752,null));};exports['create']=function(_0x3e4d95,_0x43dcae){return db['MailServerOut'][_0xa616('0x41')](_0x3e4d95['body'],{})[_0xa616('0x1e')](respondWithResult(_0x43dcae,0xc9))[_0xa616('0x40')](handleError(_0x43dcae,null));};exports[_0xa616('0x1d')]=function(_0x3e63d7,_0x791dd4){if(_0x3e63d7[_0xa616('0x42')]['id']){delete _0x3e63d7['body']['id'];}return db[_0xa616('0x37')][_0xa616('0x3f')]({'where':{'id':_0x3e63d7[_0xa616('0x3a')]['id']}})[_0xa616('0x1e')](handleEntityNotFound(_0x791dd4,null))[_0xa616('0x1e')](saveUpdates(_0x3e63d7[_0xa616('0x42')],null))[_0xa616('0x1e')](respondWithResult(_0x791dd4,null))[_0xa616('0x40')](handleError(_0x791dd4,null));};exports[_0xa616('0x43')]=function(_0x596c05,_0x5425f0){return db[_0xa616('0x37')][_0xa616('0x3f')]({'where':{'id':_0x596c05[_0xa616('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5425f0,null))['then'](removeEntity(_0x5425f0,null))[_0xa616('0x40')](handleError(_0x5425f0,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c8b5f2f..b6b6010 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 _0x702b=['moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','util','../../config/logger'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0x702b,0x13d));var _0xb702=function(_0x41c8ac,_0x1ef222){_0x41c8ac=_0x41c8ac-0x0;var _0x1038d1=_0x702b[_0x41c8ac];return _0x1038d1;};'use strict';var _=require('lodash');var util=require(_0xb702('0x0'));var logger=require(_0xb702('0x1'))('api');var moment=require(_0xb702('0x2'));var BPromise=require(_0xb702('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb702('0x4'));var rimraf=require(_0xb702('0x5'));var config=require('../../config/environment');var attributes=require(_0xb702('0x6'));module[_0xb702('0x7')]=function(_0x45ffae,_0x473381){return _0x45ffae[_0xb702('0x8')](_0xb702('0x9'),attributes,{'tableName':_0xb702('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa076=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailServerOut'];(function(_0x56ca1c,_0x23b8f2){var _0xb74630=function(_0x432de7){while(--_0x432de7){_0x56ca1c['push'](_0x56ca1c['shift']());}};_0xb74630(++_0x23b8f2);}(_0xa076,0xfd));var _0x6a07=function(_0x311dba,_0xcf976){_0x311dba=_0x311dba-0x0;var _0x3ba537=_0xa076[_0x311dba];return _0x3ba537;};'use strict';var _=require('lodash');var util=require(_0x6a07('0x0'));var logger=require(_0x6a07('0x1'))(_0x6a07('0x2'));var moment=require(_0x6a07('0x3'));var BPromise=require(_0x6a07('0x4'));var rp=require(_0x6a07('0x5'));var fs=require('fs');var path=require(_0x6a07('0x6'));var rimraf=require(_0x6a07('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0x6a07('0x8')]=function(_0x29469a,_0x2a4e84){return _0x29469a[_0x6a07('0x9')](_0x6a07('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 4f64c09..d3caa21 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 _0x96da=['error','MailServerOut,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','code'];(function(_0x3d8a8f,_0x39c60f){var _0x3ff82c=function(_0x2c64c3){while(--_0x2c64c3){_0x3d8a8f['push'](_0x3d8a8f['shift']());}};_0x3ff82c(++_0x39c60f);}(_0x96da,0xb5));var _0xa96d=function(_0x280493,_0x1ffba2){_0x280493=_0x280493-0x0;var _0x55363f=_0x96da[_0x280493];return _0x55363f;};'use strict';var _=require(_0xa96d('0x0'));var util=require(_0xa96d('0x1'));var moment=require(_0xa96d('0x2'));var BPromise=require(_0xa96d('0x3'));var rs=require(_0xa96d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa96d('0x5'))['db'];var utils=require(_0xa96d('0x6'));var logger=require(_0xa96d('0x7'))(_0xa96d('0x8'));var config=require(_0xa96d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa96d('0xa')][_0xa96d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43ec51,_0x534c34,_0xebf126){return new BPromise(function(_0x54b156,_0x25dba6){return client[_0xa96d('0xc')](_0x43ec51,_0xebf126)[_0xa96d('0xd')](function(_0x579452){logger[_0xa96d('0xe')]('MailServerOut,\x20%s,\x20%s',_0x534c34,'request\x20sent');logger[_0xa96d('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x534c34,'request\x20sent',JSON['stringify'](_0x579452));if(_0x579452['error']){if(_0x579452['error'][_0xa96d('0x10')]===0x1f4){logger[_0xa96d('0x11')](_0xa96d('0x12'),_0x534c34,_0x579452[_0xa96d('0x11')][_0xa96d('0x13')]);return _0x25dba6(_0x579452[_0xa96d('0x11')][_0xa96d('0x13')]);}logger[_0xa96d('0x11')]('MailServerOut,\x20%s,\x20%s',_0x534c34,_0x579452[_0xa96d('0x11')][_0xa96d('0x13')]);return _0x54b156(_0x579452['error'][_0xa96d('0x13')]);}else{logger[_0xa96d('0xe')](_0xa96d('0x12'),_0x534c34,_0xa96d('0x14'));_0x54b156(_0x579452[_0xa96d('0x15')][_0xa96d('0x13')]);}})['catch'](function(_0x4b6001){logger[_0xa96d('0x11')]('MailServerOut,\x20%s,\x20%s',_0x534c34,_0x4b6001);_0x25dba6(_0x4b6001);});});} \ No newline at end of file +var _0xff2c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0x364450,_0xd81db8){var _0x3d9c5e=function(_0x447374){while(--_0x447374){_0x364450['push'](_0x364450['shift']());}};_0x3d9c5e(++_0xd81db8);}(_0xff2c,0xe4));var _0xcff2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xff2c[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xcff2('0x0'));var util=require('util');var moment=require(_0xcff2('0x1'));var BPromise=require(_0xcff2('0x2'));var rs=require(_0xcff2('0x3'));var fs=require('fs');var Redis=require(_0xcff2('0x4'));var db=require(_0xcff2('0x5'))['db'];var utils=require(_0xcff2('0x6'));var logger=require(_0xcff2('0x7'))('rpc');var config=require(_0xcff2('0x8'));var jayson=require(_0xcff2('0x9'));var client=jayson['client'][_0xcff2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59537f,_0x291eb7,_0x2bbbfe){return new BPromise(function(_0x1f17a2,_0x28f5ed){return client[_0xcff2('0xb')](_0x59537f,_0x2bbbfe)['then'](function(_0x4d9810){logger[_0xcff2('0xc')](_0xcff2('0xd'),_0x291eb7,_0xcff2('0xe'));logger[_0xcff2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x291eb7,'request\x20sent',JSON[_0xcff2('0x10')](_0x4d9810));if(_0x4d9810[_0xcff2('0x11')]){if(_0x4d9810['error'][_0xcff2('0x12')]===0x1f4){logger[_0xcff2('0x11')](_0xcff2('0xd'),_0x291eb7,_0x4d9810[_0xcff2('0x11')][_0xcff2('0x13')]);return _0x28f5ed(_0x4d9810[_0xcff2('0x11')]['message']);}logger[_0xcff2('0x11')]('MailServerOut,\x20%s,\x20%s',_0x291eb7,_0x4d9810[_0xcff2('0x11')][_0xcff2('0x13')]);return _0x1f17a2(_0x4d9810[_0xcff2('0x11')][_0xcff2('0x13')]);}else{logger[_0xcff2('0xc')](_0xcff2('0xd'),_0x291eb7,_0xcff2('0xe'));_0x1f17a2(_0x4d9810['result'][_0xcff2('0x13')]);}})[_0xcff2('0x14')](function(_0x18f641){logger[_0xcff2('0x11')](_0xcff2('0xd'),_0x291eb7,_0x18f641);_0x28f5ed(_0x18f641);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c0baaf5..71e0fcc 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 _0xffac=['destroy','exports','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','show','put','/:id','update','delete'];(function(_0x5e90b2,_0x55399a){var _0x2e38f6=function(_0x23f876){while(--_0x23f876){_0x5e90b2['push'](_0x5e90b2['shift']());}};_0x2e38f6(++_0x55399a);}(_0xffac,0x1d3));var _0xcffa=function(_0x301df2,_0x40548c){_0x301df2=_0x301df2-0x0;var _0x37879a=_0xffac[_0x301df2];return _0x37879a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xcffa('0x0'));var interaction=require(_0xcffa('0x1'));var config=require(_0xcffa('0x2'));var controller=require(_0xcffa('0x3'));router[_0xcffa('0x4')]('/',auth[_0xcffa('0x5')](),controller['index']);router[_0xcffa('0x4')](_0xcffa('0x6'),auth[_0xcffa('0x5')](),controller[_0xcffa('0x7')]);router[_0xcffa('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xcffa('0x8')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xcffa('0x9')](_0xcffa('0xa'),auth['isAuthenticated'](),controller[_0xcffa('0xb')]);router[_0xcffa('0xc')](_0xcffa('0xa'),auth[_0xcffa('0x5')](),controller[_0xcffa('0xd')]);module[_0xcffa('0xe')]=router; \ No newline at end of file +var _0x19ea=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put'];(function(_0x47aded,_0xb76625){var _0x505e9a=function(_0x68696d){while(--_0x68696d){_0x47aded['push'](_0x47aded['shift']());}};_0x505e9a(++_0xb76625);}(_0x19ea,0xe0));var _0xa19e=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x19ea[_0x424501];return _0xb719af;};'use strict';var multer=require('multer');var util=require(_0xa19e('0x0'));var path=require(_0xa19e('0x1'));var timeout=require(_0xa19e('0x2'));var express=require(_0xa19e('0x3'));var router=express[_0xa19e('0x4')]();var auth=require(_0xa19e('0x5'));var interaction=require(_0xa19e('0x6'));var config=require('../../config/environment');var controller=require(_0xa19e('0x7'));router[_0xa19e('0x8')]('/',auth[_0xa19e('0x9')](),controller[_0xa19e('0xa')]);router[_0xa19e('0x8')](_0xa19e('0xb'),auth[_0xa19e('0x9')](),controller[_0xa19e('0xc')]);router[_0xa19e('0x8')](_0xa19e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa19e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa19e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa19e('0x10')]);router[_0xa19e('0x11')](_0xa19e('0xd'),auth[_0xa19e('0x9')](),controller[_0xa19e('0x12')]);module[_0xa19e('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 73e8fc2..53b5ddd 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 _0x7d8a=['STRING','name','sequelize','exports'];(function(_0x389527,_0x15eb37){var _0x3e0f61=function(_0x127270){while(--_0x127270){_0x389527['push'](_0x389527['shift']());}};_0x3e0f61(++_0x15eb37);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7d8a[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xa7d8('0x0'));module[_0xa7d8('0x1')]={'name':{'type':Sequelize[_0xa7d8('0x2')],'unique':_0xa7d8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa7d8('0x2')]}}; \ No newline at end of file +var _0x04cc=['STRING','name','sequelize','exports'];(function(_0x575524,_0x758dc4){var _0x54547f=function(_0x10f9dd){while(--_0x10f9dd){_0x575524['push'](_0x575524['shift']());}};_0x54547f(++_0x758dc4);}(_0x04cc,0x11a));var _0xc04c=function(_0x3937e7,_0x91712b){_0x3937e7=_0x3937e7-0x0;var _0x197ad7=_0x04cc[_0x3937e7];return _0x197ad7;};'use strict';var Sequelize=require(_0xc04c('0x0'));module[_0xc04c('0x1')]={'name':{'type':Sequelize[_0xc04c('0x2')],'unique':_0xc04c('0x3'),'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 1d7f7b9..a9fb33b 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 _0x5946=['query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','MailSubstatus','findAll','rows','catch','show','keys','rawAttributes','includeAll','find','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','fieldName','type','key','map'];(function(_0x18ad70,_0x5ba075){var _0x1f747=function(_0x43a8e3){while(--_0x43a8e3){_0x18ad70['push'](_0x18ad70['shift']());}};_0x1f747(++_0x5ba075);}(_0x5946,0x157));var _0x6594=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x5946[_0x46aff0];return _0x9d78cf;};'use strict';var pdf=require(_0x6594('0x0'));var emlformat=require(_0x6594('0x1'));var rimraf=require(_0x6594('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6594('0x3'));var rp=require(_0x6594('0x4'));var moment=require('moment');var BPromise=require(_0x6594('0x5'));var Mustache=require(_0x6594('0x6'));var util=require(_0x6594('0x7'));var path=require(_0x6594('0x8'));var sox=require('sox');var csv=require(_0x6594('0x9'));var ejs=require(_0x6594('0xa'));var fs=require('fs');var _=require(_0x6594('0xb'));var squel=require(_0x6594('0xc'));var crypto=require(_0x6594('0xd'));var jsforce=require(_0x6594('0xe'));var deskjs=require(_0x6594('0xf'));var toCsv=require(_0x6594('0x9'));var querystring=require('querystring');var Papa=require(_0x6594('0x10'));var Redis=require(_0x6594('0x11'));var authService=require(_0x6594('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6594('0x13'));var hardwareService=require(_0x6594('0x14'));var logger=require(_0x6594('0x15'))(_0x6594('0x16'));var utils=require(_0x6594('0x17'));var config=require('../../config/environment');var db=require(_0x6594('0x18'))['db'];function respondWithStatusCode(_0x5e67f9,_0x3a6c42){_0x3a6c42=_0x3a6c42||0xcc;return function(_0x1691d8){if(_0x1691d8){return _0x5e67f9[_0x6594('0x19')](_0x3a6c42);}return _0x5e67f9[_0x6594('0x1a')](_0x3a6c42)['end']();};}function respondWithResult(_0x5962e1,_0x35de9f){_0x35de9f=_0x35de9f||0xc8;return function(_0x5b6160){if(_0x5b6160){return _0x5962e1['status'](_0x35de9f)[_0x6594('0x1b')](_0x5b6160);}};}function respondWithFilteredResult(_0x2f85db,_0x29258e){return function(_0x286522){if(_0x286522){var _0x5eeeb5=_0x286522['count'],_0x152295=_0x29258e['offset'],_0x2c2c96=_0x29258e[_0x6594('0x1c')]+_0x29258e[_0x6594('0x1d')],_0x5d5ac5;if(_0x2c2c96>=_0x5eeeb5){_0x2c2c96=_0x5eeeb5;_0x5d5ac5=0xc8;}else{_0x5d5ac5=0xce;}_0x2f85db['status'](_0x5d5ac5);return _0x2f85db[_0x6594('0x1e')](_0x6594('0x1f'),_0x152295+'-'+_0x2c2c96+'/'+_0x5eeeb5)[_0x6594('0x1b')](_0x286522);}return null;};}function patchUpdates(_0xaea2d){return function(_0x107e24){try{jsonpatch[_0x6594('0x20')](_0x107e24,_0xaea2d,!![]);}catch(_0x4dc9a6){return BPromise['reject'](_0x4dc9a6);}return _0x107e24[_0x6594('0x21')]();};}function saveUpdates(_0x252792,_0x1c585b){return function(_0x29c408){if(_0x29c408){return _0x29c408[_0x6594('0x22')](_0x252792)['then'](function(_0x3c599e){return _0x3c599e;});}return null;};}function removeEntity(_0xcda7ce,_0x7ff219){return function(_0x5f05ba){if(_0x5f05ba){return _0x5f05ba[_0x6594('0x23')]()[_0x6594('0x24')](function(){_0xcda7ce[_0x6594('0x1a')](0xcc)[_0x6594('0x25')]();});}};}function handleEntityNotFound(_0x3c67ad,_0x2d5192){return function(_0x5cc1f7){if(!_0x5cc1f7){_0x3c67ad[_0x6594('0x19')](0x194);}return _0x5cc1f7;};}function handleError(_0x47c1fb,_0x3e3d4){_0x3e3d4=_0x3e3d4||0x1f4;return function(_0x9b4fda){logger[_0x6594('0x26')](_0x9b4fda[_0x6594('0x27')]);if(_0x9b4fda[_0x6594('0x28')]){delete _0x9b4fda[_0x6594('0x28')];}_0x47c1fb[_0x6594('0x1a')](_0x3e3d4)[_0x6594('0x29')](_0x9b4fda);};}exports[_0x6594('0x2a')]=function(_0x2bb521,_0x3c8baf){var _0x3e68ae={},_0x351921={},_0x56b017={'count':0x0,'rows':[]};var _0x552f86=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x41f0f9){return{'name':_0x41f0f9[_0x6594('0x2b')],'type':_0x41f0f9[_0x6594('0x2c')][_0x6594('0x2d')]};});_0x351921['model']=_[_0x6594('0x2e')](_0x552f86,'name');_0x351921[_0x6594('0x2f')]=_['keys'](_0x2bb521[_0x6594('0x2f')]);_0x351921[_0x6594('0x30')]=_['intersection'](_0x351921['model'],_0x351921[_0x6594('0x2f')]);_0x3e68ae[_0x6594('0x31')]=_[_0x6594('0x32')](_0x351921[_0x6594('0x33')],qs[_0x6594('0x34')](_0x2bb521[_0x6594('0x2f')][_0x6594('0x34')]));_0x3e68ae[_0x6594('0x31')]=_0x3e68ae['attributes'][_0x6594('0x35')]?_0x3e68ae[_0x6594('0x31')]:_0x351921[_0x6594('0x33')];if(!_0x2bb521[_0x6594('0x2f')][_0x6594('0x36')](_0x6594('0x37'))){_0x3e68ae[_0x6594('0x1d')]=qs[_0x6594('0x1d')](_0x2bb521[_0x6594('0x2f')]['limit']);_0x3e68ae['offset']=qs['offset'](_0x2bb521[_0x6594('0x2f')][_0x6594('0x1c')]);}_0x3e68ae[_0x6594('0x38')]=qs[_0x6594('0x39')](_0x2bb521[_0x6594('0x2f')][_0x6594('0x39')]);_0x3e68ae[_0x6594('0x3a')]=qs['filters'](_[_0x6594('0x3b')](_0x2bb521[_0x6594('0x2f')],_0x351921[_0x6594('0x30')]),_0x552f86);if(_0x2bb521[_0x6594('0x2f')][_0x6594('0x3c')]){_0x3e68ae[_0x6594('0x3a')]=_[_0x6594('0x3d')](_0x3e68ae['where'],{'$or':_[_0x6594('0x2e')](_0x552f86,function(_0x441384){if(_0x441384[_0x6594('0x2c')]!==_0x6594('0x3e')){var _0x427694={};_0x427694[_0x441384[_0x6594('0x28')]]={'$like':'%'+_0x2bb521['query'][_0x6594('0x3c')]+'%'};return _0x427694;}})});}_0x3e68ae=_[_0x6594('0x3d')]({},_0x3e68ae,_0x2bb521[_0x6594('0x3f')]);var _0x175394={'where':_0x3e68ae['where']};return db['MailSubstatus'][_0x6594('0x40')](_0x175394)['then'](function(_0x3bf05b){_0x56b017['count']=_0x3bf05b;if(_0x2bb521[_0x6594('0x2f')]['includeAll']){_0x3e68ae[_0x6594('0x41')]=[{'all':!![]}];}return db[_0x6594('0x42')][_0x6594('0x43')](_0x3e68ae);})[_0x6594('0x24')](function(_0x529817){_0x56b017[_0x6594('0x44')]=_0x529817;return _0x56b017;})[_0x6594('0x24')](respondWithFilteredResult(_0x3c8baf,_0x3e68ae))[_0x6594('0x45')](handleError(_0x3c8baf,null));};exports[_0x6594('0x46')]=function(_0x3806f5,_0x545900){var _0x4c1b37={'raw':!![],'where':{'id':_0x3806f5['params']['id']}},_0x3a3d56={};_0x3a3d56[_0x6594('0x33')]=_[_0x6594('0x47')](db[_0x6594('0x42')][_0x6594('0x48')]);_0x3a3d56['query']=_[_0x6594('0x47')](_0x3806f5[_0x6594('0x2f')]);_0x3a3d56[_0x6594('0x30')]=_[_0x6594('0x32')](_0x3a3d56[_0x6594('0x33')],_0x3a3d56['query']);_0x4c1b37['attributes']=_[_0x6594('0x32')](_0x3a3d56[_0x6594('0x33')],qs[_0x6594('0x34')](_0x3806f5['query'][_0x6594('0x34')]));_0x4c1b37['attributes']=_0x4c1b37[_0x6594('0x31')][_0x6594('0x35')]?_0x4c1b37['attributes']:_0x3a3d56['model'];if(_0x3806f5[_0x6594('0x2f')][_0x6594('0x49')]){_0x4c1b37[_0x6594('0x41')]=[{'all':!![]}];}_0x4c1b37=_['merge']({},_0x4c1b37,_0x3806f5['options']);return db[_0x6594('0x42')][_0x6594('0x4a')](_0x4c1b37)[_0x6594('0x24')](handleEntityNotFound(_0x545900,null))['then'](respondWithResult(_0x545900,null))[_0x6594('0x45')](handleError(_0x545900,null));};exports['create']=function(_0x4c34c4,_0x115b09){return db[_0x6594('0x42')]['create'](_0x4c34c4[_0x6594('0x4b')],{})[_0x6594('0x24')](respondWithResult(_0x115b09,0xc9))[_0x6594('0x45')](handleError(_0x115b09,null));};exports[_0x6594('0x22')]=function(_0x3d99f7,_0x531225){if(_0x3d99f7[_0x6594('0x4b')]['id']){delete _0x3d99f7[_0x6594('0x4b')]['id'];}return db[_0x6594('0x42')]['find']({'where':{'id':_0x3d99f7[_0x6594('0x4c')]['id']}})['then'](handleEntityNotFound(_0x531225,null))[_0x6594('0x24')](saveUpdates(_0x3d99f7[_0x6594('0x4b')],null))[_0x6594('0x24')](respondWithResult(_0x531225,null))[_0x6594('0x45')](handleError(_0x531225,null));};exports['destroy']=function(_0x5c221c,_0x41f5f9){return db['MailSubstatus']['find']({'where':{'id':_0x5c221c[_0x6594('0x4c')]['id']}})[_0x6594('0x24')](handleEntityNotFound(_0x41f5f9,null))[_0x6594('0x24')](removeEntity(_0x41f5f9,null))[_0x6594('0x45')](handleError(_0x41f5f9,null));};exports[_0x6594('0x4d')]=function(_0x434971,_0x58a660){return db[_0x6594('0x42')][_0x6594('0x4d')]()[_0x6594('0x24')](respondWithResult(_0x58a660,null))[_0x6594('0x45')](handleError(_0x58a660,null));}; \ No newline at end of file +var _0xdfe1=['squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','findAll','rows','catch','params','keys','include','find','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x3cfba1,_0x334ed0){var _0x403063=function(_0x4e2698){while(--_0x4e2698){_0x3cfba1['push'](_0x3cfba1['shift']());}};_0x403063(++_0x334ed0);}(_0xdfe1,0x166));var _0x1dfe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfe1[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1dfe('0x0'));var emlformat=require(_0x1dfe('0x1'));var rimraf=require(_0x1dfe('0x2'));var zipdir=require(_0x1dfe('0x3'));var jsonpatch=require(_0x1dfe('0x4'));var rp=require('request-promise');var moment=require(_0x1dfe('0x5'));var BPromise=require(_0x1dfe('0x6'));var Mustache=require(_0x1dfe('0x7'));var util=require(_0x1dfe('0x8'));var path=require('path');var sox=require(_0x1dfe('0x9'));var csv=require(_0x1dfe('0xa'));var ejs=require(_0x1dfe('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1dfe('0xc'));var crypto=require(_0x1dfe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1dfe('0xe'));var toCsv=require(_0x1dfe('0xa'));var querystring=require(_0x1dfe('0xf'));var Papa=require('papaparse');var Redis=require(_0x1dfe('0x10'));var authService=require(_0x1dfe('0x11'));var qs=require(_0x1dfe('0x12'));var as=require(_0x1dfe('0x13'));var hardwareService=require(_0x1dfe('0x14'));var logger=require(_0x1dfe('0x15'))(_0x1dfe('0x16'));var utils=require(_0x1dfe('0x17'));var config=require(_0x1dfe('0x18'));var db=require(_0x1dfe('0x19'))['db'];function respondWithStatusCode(_0x5056fb,_0xb0e783){_0xb0e783=_0xb0e783||0xcc;return function(_0x1d6a6a){if(_0x1d6a6a){return _0x5056fb[_0x1dfe('0x1a')](_0xb0e783);}return _0x5056fb[_0x1dfe('0x1b')](_0xb0e783)[_0x1dfe('0x1c')]();};}function respondWithResult(_0x28fdfb,_0x20358b){_0x20358b=_0x20358b||0xc8;return function(_0x33a229){if(_0x33a229){return _0x28fdfb[_0x1dfe('0x1b')](_0x20358b)[_0x1dfe('0x1d')](_0x33a229);}};}function respondWithFilteredResult(_0x227606,_0x28d5f2){return function(_0x506e3c){if(_0x506e3c){var _0xc6f11=_0x506e3c[_0x1dfe('0x1e')],_0xc7791a=_0x28d5f2[_0x1dfe('0x1f')],_0x5e4a25=_0x28d5f2[_0x1dfe('0x1f')]+_0x28d5f2[_0x1dfe('0x20')],_0xc491ec;if(_0x5e4a25>=_0xc6f11){_0x5e4a25=_0xc6f11;_0xc491ec=0xc8;}else{_0xc491ec=0xce;}_0x227606[_0x1dfe('0x1b')](_0xc491ec);return _0x227606[_0x1dfe('0x21')](_0x1dfe('0x22'),_0xc7791a+'-'+_0x5e4a25+'/'+_0xc6f11)['json'](_0x506e3c);}return null;};}function patchUpdates(_0x51968c){return function(_0xa16f99){try{jsonpatch[_0x1dfe('0x23')](_0xa16f99,_0x51968c,!![]);}catch(_0x3a2563){return BPromise['reject'](_0x3a2563);}return _0xa16f99[_0x1dfe('0x24')]();};}function saveUpdates(_0x4b58dc,_0x156de9){return function(_0x4b065e){if(_0x4b065e){return _0x4b065e['update'](_0x4b58dc)[_0x1dfe('0x25')](function(_0x5f14bb){return _0x5f14bb;});}return null;};}function removeEntity(_0x47065f,_0x36b3ef){return function(_0x4aa631){if(_0x4aa631){return _0x4aa631[_0x1dfe('0x26')]()[_0x1dfe('0x25')](function(){_0x47065f[_0x1dfe('0x1b')](0xcc)[_0x1dfe('0x1c')]();});}};}function handleEntityNotFound(_0x459f74,_0x138ffd){return function(_0x1e0eda){if(!_0x1e0eda){_0x459f74['sendStatus'](0x194);}return _0x1e0eda;};}function handleError(_0x1960d1,_0xf675be){_0xf675be=_0xf675be||0x1f4;return function(_0x55141a){logger[_0x1dfe('0x27')](_0x55141a['stack']);if(_0x55141a[_0x1dfe('0x28')]){delete _0x55141a['name'];}_0x1960d1[_0x1dfe('0x1b')](_0xf675be)['send'](_0x55141a);};}exports[_0x1dfe('0x29')]=function(_0x324bc1,_0x44edc4){var _0x1cd6fd={},_0x33d15e={},_0x1dc761={'count':0x0,'rows':[]};var _0x2d6c51=_[_0x1dfe('0x2a')](db[_0x1dfe('0x2b')][_0x1dfe('0x2c')],function(_0x389367){return{'name':_0x389367[_0x1dfe('0x2d')],'type':_0x389367[_0x1dfe('0x2e')][_0x1dfe('0x2f')]};});_0x33d15e[_0x1dfe('0x30')]=_[_0x1dfe('0x2a')](_0x2d6c51,_0x1dfe('0x28'));_0x33d15e[_0x1dfe('0x31')]=_['keys'](_0x324bc1[_0x1dfe('0x31')]);_0x33d15e[_0x1dfe('0x32')]=_['intersection'](_0x33d15e[_0x1dfe('0x30')],_0x33d15e[_0x1dfe('0x31')]);_0x1cd6fd['attributes']=_[_0x1dfe('0x33')](_0x33d15e[_0x1dfe('0x30')],qs['fields'](_0x324bc1['query'][_0x1dfe('0x34')]));_0x1cd6fd[_0x1dfe('0x35')]=_0x1cd6fd['attributes'][_0x1dfe('0x36')]?_0x1cd6fd[_0x1dfe('0x35')]:_0x33d15e[_0x1dfe('0x30')];if(!_0x324bc1['query'][_0x1dfe('0x37')](_0x1dfe('0x38'))){_0x1cd6fd[_0x1dfe('0x20')]=qs[_0x1dfe('0x20')](_0x324bc1[_0x1dfe('0x31')][_0x1dfe('0x20')]);_0x1cd6fd[_0x1dfe('0x1f')]=qs['offset'](_0x324bc1[_0x1dfe('0x31')]['offset']);}_0x1cd6fd['order']=qs['sort'](_0x324bc1[_0x1dfe('0x31')][_0x1dfe('0x39')]);_0x1cd6fd['where']=qs[_0x1dfe('0x32')](_[_0x1dfe('0x3a')](_0x324bc1[_0x1dfe('0x31')],_0x33d15e[_0x1dfe('0x32')]),_0x2d6c51);if(_0x324bc1[_0x1dfe('0x31')][_0x1dfe('0x3b')]){_0x1cd6fd[_0x1dfe('0x3c')]=_[_0x1dfe('0x3d')](_0x1cd6fd[_0x1dfe('0x3c')],{'$or':_[_0x1dfe('0x2a')](_0x2d6c51,function(_0x3872ef){if(_0x3872ef[_0x1dfe('0x2e')]!=='VIRTUAL'){var _0x4214bc={};_0x4214bc[_0x3872ef['name']]={'$like':'%'+_0x324bc1[_0x1dfe('0x31')]['filter']+'%'};return _0x4214bc;}})});}_0x1cd6fd=_[_0x1dfe('0x3d')]({},_0x1cd6fd,_0x324bc1[_0x1dfe('0x3e')]);var _0x3ddb56={'where':_0x1cd6fd[_0x1dfe('0x3c')]};return db[_0x1dfe('0x2b')]['count'](_0x3ddb56)[_0x1dfe('0x25')](function(_0x132260){_0x1dc761[_0x1dfe('0x1e')]=_0x132260;if(_0x324bc1['query']['includeAll']){_0x1cd6fd['include']=[{'all':!![]}];}return db[_0x1dfe('0x2b')][_0x1dfe('0x3f')](_0x1cd6fd);})['then'](function(_0x49c734){_0x1dc761[_0x1dfe('0x40')]=_0x49c734;return _0x1dc761;})[_0x1dfe('0x25')](respondWithFilteredResult(_0x44edc4,_0x1cd6fd))[_0x1dfe('0x41')](handleError(_0x44edc4,null));};exports['show']=function(_0x4163bb,_0x58edb5){var _0xb785ed={'raw':!![],'where':{'id':_0x4163bb[_0x1dfe('0x42')]['id']}},_0x1fd7bc={};_0x1fd7bc[_0x1dfe('0x30')]=_[_0x1dfe('0x43')](db[_0x1dfe('0x2b')][_0x1dfe('0x2c')]);_0x1fd7bc[_0x1dfe('0x31')]=_[_0x1dfe('0x43')](_0x4163bb[_0x1dfe('0x31')]);_0x1fd7bc['filters']=_['intersection'](_0x1fd7bc[_0x1dfe('0x30')],_0x1fd7bc[_0x1dfe('0x31')]);_0xb785ed['attributes']=_[_0x1dfe('0x33')](_0x1fd7bc[_0x1dfe('0x30')],qs['fields'](_0x4163bb[_0x1dfe('0x31')][_0x1dfe('0x34')]));_0xb785ed['attributes']=_0xb785ed[_0x1dfe('0x35')][_0x1dfe('0x36')]?_0xb785ed[_0x1dfe('0x35')]:_0x1fd7bc['model'];if(_0x4163bb[_0x1dfe('0x31')]['includeAll']){_0xb785ed[_0x1dfe('0x44')]=[{'all':!![]}];}_0xb785ed=_['merge']({},_0xb785ed,_0x4163bb[_0x1dfe('0x3e')]);return db['MailSubstatus'][_0x1dfe('0x45')](_0xb785ed)[_0x1dfe('0x25')](handleEntityNotFound(_0x58edb5,null))['then'](respondWithResult(_0x58edb5,null))[_0x1dfe('0x41')](handleError(_0x58edb5,null));};exports[_0x1dfe('0x46')]=function(_0x496ac7,_0x7802ff){return db[_0x1dfe('0x2b')][_0x1dfe('0x46')](_0x496ac7['body'],{})['then'](respondWithResult(_0x7802ff,0xc9))[_0x1dfe('0x41')](handleError(_0x7802ff,null));};exports[_0x1dfe('0x47')]=function(_0x475cfc,_0x315b34){if(_0x475cfc[_0x1dfe('0x48')]['id']){delete _0x475cfc[_0x1dfe('0x48')]['id'];}return db[_0x1dfe('0x2b')][_0x1dfe('0x45')]({'where':{'id':_0x475cfc[_0x1dfe('0x42')]['id']}})['then'](handleEntityNotFound(_0x315b34,null))['then'](saveUpdates(_0x475cfc['body'],null))[_0x1dfe('0x25')](respondWithResult(_0x315b34,null))['catch'](handleError(_0x315b34,null));};exports[_0x1dfe('0x26')]=function(_0x33deb2,_0x27ab34){return db[_0x1dfe('0x2b')][_0x1dfe('0x45')]({'where':{'id':_0x33deb2[_0x1dfe('0x42')]['id']}})['then'](handleEntityNotFound(_0x27ab34,null))[_0x1dfe('0x25')](removeEntity(_0x27ab34,null))[_0x1dfe('0x41')](handleError(_0x27ab34,null));};exports[_0x1dfe('0x49')]=function(_0xa7b82b,_0x111c53){return db[_0x1dfe('0x2b')][_0x1dfe('0x49')]()['then'](respondWithResult(_0x111c53,null))['catch'](handleError(_0x111c53,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4d71ff9..c8d54d5 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 _0x1732=['request-promise','path','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4e7af4,_0x758572){var _0x2548f1=function(_0xa849c){while(--_0xa849c){_0x4e7af4['push'](_0x4e7af4['shift']());}};_0x2548f1(++_0x758572);}(_0x1732,0xae));var _0x2173=function(_0x1e5599,_0x496aa0){_0x1e5599=_0x1e5599-0x0;var _0x454efa=_0x1732[_0x1e5599];return _0x454efa;};'use strict';var _=require(_0x2173('0x0'));var util=require(_0x2173('0x1'));var logger=require(_0x2173('0x2'))(_0x2173('0x3'));var moment=require(_0x2173('0x4'));var BPromise=require(_0x2173('0x5'));var rp=require(_0x2173('0x6'));var fs=require('fs');var path=require(_0x2173('0x7'));var rimraf=require('rimraf');var config=require(_0x2173('0x8'));var attributes=require(_0x2173('0x9'));module['exports']=function(_0x47f200,_0xe9df91){return _0x47f200[_0x2173('0xa')](_0x2173('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9787=['./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x35858d,_0x1acd8d){var _0x1f6865=function(_0x6e9fc9){while(--_0x6e9fc9){_0x35858d['push'](_0x35858d['shift']());}};_0x1f6865(++_0x1acd8d);}(_0x9787,0xd4));var _0x7978=function(_0x372047,_0x7f5c2b){_0x372047=_0x372047-0x0;var _0x44f282=_0x9787[_0x372047];return _0x44f282;};'use strict';var _=require(_0x7978('0x0'));var util=require(_0x7978('0x1'));var logger=require('../../config/logger')(_0x7978('0x2'));var moment=require(_0x7978('0x3'));var BPromise=require(_0x7978('0x4'));var rp=require(_0x7978('0x5'));var fs=require('fs');var path=require(_0x7978('0x6'));var rimraf=require(_0x7978('0x7'));var config=require(_0x7978('0x8'));var attributes=require(_0x7978('0x9'));module[_0x7978('0xa')]=function(_0x11a076,_0x1847fb){return _0x11a076[_0x7978('0xb')](_0x7978('0xc'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 2546de5..284c4f6 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 _0xbec5=['info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','MailSubstatus,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2ae8d6,_0x4d7876){var _0x3d5145=function(_0x3c3638){while(--_0x3c3638){_0x2ae8d6['push'](_0x2ae8d6['shift']());}};_0x3d5145(++_0x4d7876);}(_0xbec5,0xe5));var _0x5bec=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0xbec5[_0x231b2e];return _0x3feb2a;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a427,_0x38456e,_0x406e65){return new BPromise(function(_0x43d96e,_0x302aae){return client[_0x5bec('0xb')](_0x28a427,_0x406e65)[_0x5bec('0xc')](function(_0x4d0d29){logger[_0x5bec('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x38456e,_0x5bec('0xe'));logger[_0x5bec('0xf')](_0x5bec('0x10'),_0x38456e,'request\x20sent',JSON[_0x5bec('0x11')](_0x4d0d29));if(_0x4d0d29[_0x5bec('0x12')]){if(_0x4d0d29[_0x5bec('0x12')]['code']===0x1f4){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29['error'][_0x5bec('0x14')]);return _0x302aae(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);return _0x43d96e(_0x4d0d29[_0x5bec('0x12')][_0x5bec('0x14')]);}else{logger[_0x5bec('0xd')](_0x5bec('0x13'),_0x38456e,_0x5bec('0xe'));_0x43d96e(_0x4d0d29[_0x5bec('0x15')]['message']);}})['catch'](function(_0x15af9b){logger[_0x5bec('0x12')](_0x5bec('0x13'),_0x38456e,_0x15af9b);_0x302aae(_0x15af9b);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a7c31,_0x30fc89){var _0x3ee630=function(_0xb873be){while(--_0xb873be){_0x4a7c31['push'](_0x4a7c31['shift']());}};_0x3ee630(++_0x30fc89);}(_0xe706,0xa3));var _0x6e70=function(_0x4c0998,_0x165050){_0x4c0998=_0x4c0998-0x0;var _0x1110e2=_0xe706[_0x4c0998];return _0x1110e2;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 092417f..3672389 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 _0x1b12=['describe','show','post','create','put','/:id','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated'];(function(_0x55d6bb,_0x52cce3){var _0x3c1fad=function(_0x563e8c){while(--_0x563e8c){_0x55d6bb['push'](_0x55d6bb['shift']());}};_0x3c1fad(++_0x52cce3);}(_0x1b12,0xbc));var _0x21b1=function(_0x454b8d,_0xca91a8){_0x454b8d=_0x454b8d-0x0;var _0x388fe5=_0x1b12[_0x454b8d];return _0x388fe5;};'use strict';var multer=require(_0x21b1('0x0'));var util=require('util');var path=require(_0x21b1('0x1'));var timeout=require(_0x21b1('0x2'));var express=require(_0x21b1('0x3'));var router=express[_0x21b1('0x4')]();var auth=require(_0x21b1('0x5'));var interaction=require(_0x21b1('0x6'));var config=require(_0x21b1('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x21b1('0x8')]);router[_0x21b1('0x9')](_0x21b1('0xa'),auth[_0x21b1('0xb')](),controller[_0x21b1('0xc')]);router[_0x21b1('0x9')]('/:id',auth[_0x21b1('0xb')](),controller[_0x21b1('0xd')]);router[_0x21b1('0xe')]('/',auth['isAuthenticated'](),controller[_0x21b1('0xf')]);router[_0x21b1('0x10')](_0x21b1('0x11'),auth['isAuthenticated'](),controller[_0x21b1('0x12')]);router[_0x21b1('0x13')]('/:id',auth[_0x21b1('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd370=['delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update'];(function(_0x8a304a,_0x2dd6fd){var _0x19292a=function(_0x3185b7){while(--_0x3185b7){_0x8a304a['push'](_0x8a304a['shift']());}};_0x19292a(++_0x2dd6fd);}(_0xd370,0xde));var _0x0d37=function(_0x15821d,_0x3d3029){_0x15821d=_0x15821d-0x0;var _0x5e443c=_0xd370[_0x15821d];return _0x5e443c;};'use strict';var multer=require('multer');var util=require(_0x0d37('0x0'));var path=require(_0x0d37('0x1'));var timeout=require(_0x0d37('0x2'));var express=require(_0x0d37('0x3'));var router=express[_0x0d37('0x4')]();var auth=require(_0x0d37('0x5'));var interaction=require(_0x0d37('0x6'));var config=require(_0x0d37('0x7'));var controller=require(_0x0d37('0x8'));router['get']('/',auth[_0x0d37('0x9')](),controller[_0x0d37('0xa')]);router[_0x0d37('0xb')](_0x0d37('0xc'),auth['isAuthenticated'](),controller[_0x0d37('0xd')]);router[_0x0d37('0xb')]('/:id',auth[_0x0d37('0x9')](),controller[_0x0d37('0xe')]);router[_0x0d37('0xf')]('/',auth[_0x0d37('0x9')](),controller[_0x0d37('0x10')]);router[_0x0d37('0x11')](_0x0d37('0x12'),auth[_0x0d37('0x9')](),controller[_0x0d37('0x13')]);router[_0x0d37('0x14')](_0x0d37('0x12'),auth['isAuthenticated'](),controller[_0x0d37('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 96b6310..a76fb58 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 _0x4310=['agent','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x53fafe,_0x346055){var _0x171ab8=function(_0x42eee6){while(--_0x42eee6){_0x53fafe['push'](_0x53fafe['shift']());}};_0x171ab8(++_0x346055);}(_0x4310,0x183));var _0x0431=function(_0x1a660d,_0x182bba){_0x1a660d=_0x1a660d-0x0;var _0x3c1a19=_0x4310[_0x1a660d];return _0x3c1a19;};'use strict';var moment=require(_0x0431('0x0'));var Sequelize=require(_0x0431('0x1'));module[_0x0431('0x2')]={'uniqueid':{'type':Sequelize[_0x0431('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0431('0x4')]('account',_0x0431('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x0431('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x0431('0x7')]}}; \ No newline at end of file +var _0x6220=['ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x208af5,_0x16c9dd){var _0x134933=function(_0x16916f){while(--_0x16916f){_0x208af5['push'](_0x208af5['shift']());}};_0x134933(++_0x16c9dd);}(_0x6220,0x67));var _0x0622=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6220[_0x4b369d];return _0x571a98;};'use strict';var moment=require(_0x0622('0x0'));var Sequelize=require(_0x0622('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0622('0x2')]('account',_0x0622('0x3'),_0x0622('0x4')),'allowNull':![],'defaultValue':_0x0622('0x4')},'transferredAt':{'type':Sequelize[_0x0622('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0622('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 93b1f7d..ba212a5 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 _0x9eda=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x6e7fc0,_0x18b91e){var _0xf69948=function(_0x707782){while(--_0x707782){_0x6e7fc0['push'](_0x6e7fc0['shift']());}};_0xf69948(++_0x18b91e);}(_0x9eda,0x158));var _0xa9ed=function(_0x57208f,_0x5e8667){_0x57208f=_0x57208f-0x0;var _0x17508c=_0x9eda[_0x57208f];return _0x17508c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa9ed('0x0'));var zipdir=require(_0xa9ed('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ed('0x2'));var moment=require(_0xa9ed('0x3'));var BPromise=require(_0xa9ed('0x4'));var Mustache=require(_0xa9ed('0x5'));var util=require(_0xa9ed('0x6'));var path=require(_0xa9ed('0x7'));var sox=require('sox');var csv=require(_0xa9ed('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa9ed('0x9'));var crypto=require(_0xa9ed('0xa'));var jsforce=require(_0xa9ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa9ed('0x8'));var querystring=require('querystring');var Papa=require(_0xa9ed('0xc'));var Redis=require('ioredis');var authService=require(_0xa9ed('0xd'));var qs=require(_0xa9ed('0xe'));var as=require(_0xa9ed('0xf'));var hardwareService=require(_0xa9ed('0x10'));var logger=require(_0xa9ed('0x11'))(_0xa9ed('0x12'));var utils=require(_0xa9ed('0x13'));var config=require('../../config/environment');var db=require(_0xa9ed('0x14'))['db'];function respondWithStatusCode(_0x1bb7b9,_0xcb15ce){_0xcb15ce=_0xcb15ce||0xcc;return function(_0x512044){if(_0x512044){return _0x1bb7b9[_0xa9ed('0x15')](_0xcb15ce);}return _0x1bb7b9['status'](_0xcb15ce)[_0xa9ed('0x16')]();};}function respondWithResult(_0x39ac4b,_0x18f2ef){_0x18f2ef=_0x18f2ef||0xc8;return function(_0x12428c){if(_0x12428c){return _0x39ac4b[_0xa9ed('0x17')](_0x18f2ef)[_0xa9ed('0x18')](_0x12428c);}};}function respondWithFilteredResult(_0x41c855,_0x30a391){return function(_0x577213){if(_0x577213){var _0x2549a3=_0x577213[_0xa9ed('0x19')],_0x493ad0=_0x30a391[_0xa9ed('0x1a')],_0x1f1ff8=_0x30a391[_0xa9ed('0x1a')]+_0x30a391['limit'],_0x284681;if(_0x1f1ff8>=_0x2549a3){_0x1f1ff8=_0x2549a3;_0x284681=0xc8;}else{_0x284681=0xce;}_0x41c855[_0xa9ed('0x17')](_0x284681);return _0x41c855[_0xa9ed('0x1b')](_0xa9ed('0x1c'),_0x493ad0+'-'+_0x1f1ff8+'/'+_0x2549a3)[_0xa9ed('0x18')](_0x577213);}return null;};}function patchUpdates(_0x4ca7d7){return function(_0xc4a46b){try{jsonpatch[_0xa9ed('0x1d')](_0xc4a46b,_0x4ca7d7,!![]);}catch(_0xc1cbd){return BPromise[_0xa9ed('0x1e')](_0xc1cbd);}return _0xc4a46b[_0xa9ed('0x1f')]();};}function saveUpdates(_0x4dc98a,_0x3a72d6){return function(_0x57bda7){if(_0x57bda7){return _0x57bda7[_0xa9ed('0x20')](_0x4dc98a)['then'](function(_0x1b1382){return _0x1b1382;});}return null;};}function removeEntity(_0x40d7bb,_0x5a961c){return function(_0x5c5af8){if(_0x5c5af8){return _0x5c5af8[_0xa9ed('0x21')]()[_0xa9ed('0x22')](function(){_0x40d7bb[_0xa9ed('0x17')](0xcc)[_0xa9ed('0x16')]();});}};}function handleEntityNotFound(_0x449eee,_0x2f084d){return function(_0x537a1b){if(!_0x537a1b){_0x449eee[_0xa9ed('0x15')](0x194);}return _0x537a1b;};}function handleError(_0x3a3cef,_0xa00385){_0xa00385=_0xa00385||0x1f4;return function(_0x307dd5){logger['error'](_0x307dd5['stack']);if(_0x307dd5['name']){delete _0x307dd5[_0xa9ed('0x23')];}_0x3a3cef[_0xa9ed('0x17')](_0xa00385)[_0xa9ed('0x24')](_0x307dd5);};}exports[_0xa9ed('0x25')]=function(_0x1c7a00,_0x49b6c7){var _0x24aa79={},_0x552dfb={},_0x53ade1={'count':0x0,'rows':[]};var _0x14cbcf=_[_0xa9ed('0x26')](db[_0xa9ed('0x27')][_0xa9ed('0x28')],function(_0x4e353c){return{'name':_0x4e353c[_0xa9ed('0x29')],'type':_0x4e353c[_0xa9ed('0x2a')]['key']};});_0x552dfb['model']=_[_0xa9ed('0x26')](_0x14cbcf,_0xa9ed('0x23'));_0x552dfb[_0xa9ed('0x2b')]=_[_0xa9ed('0x2c')](_0x1c7a00[_0xa9ed('0x2b')]);_0x552dfb[_0xa9ed('0x2d')]=_['intersection'](_0x552dfb[_0xa9ed('0x2e')],_0x552dfb['query']);_0x24aa79[_0xa9ed('0x2f')]=_[_0xa9ed('0x30')](_0x552dfb[_0xa9ed('0x2e')],qs[_0xa9ed('0x31')](_0x1c7a00['query']['fields']));_0x24aa79[_0xa9ed('0x2f')]=_0x24aa79[_0xa9ed('0x2f')]['length']?_0x24aa79[_0xa9ed('0x2f')]:_0x552dfb[_0xa9ed('0x2e')];if(!_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x32')](_0xa9ed('0x33'))){_0x24aa79[_0xa9ed('0x34')]=qs[_0xa9ed('0x34')](_0x1c7a00[_0xa9ed('0x2b')]['limit']);_0x24aa79[_0xa9ed('0x1a')]=qs[_0xa9ed('0x1a')](_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x1a')]);}_0x24aa79['order']=qs[_0xa9ed('0x35')](_0x1c7a00['query'][_0xa9ed('0x35')]);_0x24aa79['where']=qs[_0xa9ed('0x2d')](_[_0xa9ed('0x36')](_0x1c7a00[_0xa9ed('0x2b')],_0x552dfb[_0xa9ed('0x2d')]),_0x14cbcf);if(_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x37')]){_0x24aa79[_0xa9ed('0x38')]=_[_0xa9ed('0x39')](_0x24aa79[_0xa9ed('0x38')],{'$or':_[_0xa9ed('0x26')](_0x14cbcf,function(_0x1d3667){if(_0x1d3667[_0xa9ed('0x2a')]!==_0xa9ed('0x3a')){var _0x502ed6={};_0x502ed6[_0x1d3667[_0xa9ed('0x23')]]={'$like':'%'+_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x37')]+'%'};return _0x502ed6;}})});}_0x24aa79=_[_0xa9ed('0x39')]({},_0x24aa79,_0x1c7a00['options']);var _0x4b7326={'where':_0x24aa79['where']};return db[_0xa9ed('0x27')]['count'](_0x4b7326)[_0xa9ed('0x22')](function(_0x271421){_0x53ade1['count']=_0x271421;if(_0x1c7a00[_0xa9ed('0x2b')][_0xa9ed('0x3b')]){_0x24aa79[_0xa9ed('0x3c')]=[{'all':!![]}];}return db['MailTransferReport'][_0xa9ed('0x3d')](_0x24aa79);})['then'](function(_0x18856b){_0x53ade1[_0xa9ed('0x3e')]=_0x18856b;return _0x53ade1;})[_0xa9ed('0x22')](respondWithFilteredResult(_0x49b6c7,_0x24aa79))[_0xa9ed('0x3f')](handleError(_0x49b6c7,null));};exports[_0xa9ed('0x40')]=function(_0x4b0a30,_0x15a8f5){var _0x4b2b03={'raw':!![],'where':{'id':_0x4b0a30['params']['id']}},_0x4303ec={};_0x4303ec[_0xa9ed('0x2e')]=_[_0xa9ed('0x2c')](db[_0xa9ed('0x27')][_0xa9ed('0x28')]);_0x4303ec[_0xa9ed('0x2b')]=_[_0xa9ed('0x2c')](_0x4b0a30[_0xa9ed('0x2b')]);_0x4303ec[_0xa9ed('0x2d')]=_[_0xa9ed('0x30')](_0x4303ec[_0xa9ed('0x2e')],_0x4303ec['query']);_0x4b2b03['attributes']=_[_0xa9ed('0x30')](_0x4303ec[_0xa9ed('0x2e')],qs[_0xa9ed('0x31')](_0x4b0a30['query'][_0xa9ed('0x31')]));_0x4b2b03['attributes']=_0x4b2b03[_0xa9ed('0x2f')][_0xa9ed('0x41')]?_0x4b2b03[_0xa9ed('0x2f')]:_0x4303ec[_0xa9ed('0x2e')];if(_0x4b0a30[_0xa9ed('0x2b')]['includeAll']){_0x4b2b03[_0xa9ed('0x3c')]=[{'all':!![]}];}_0x4b2b03=_[_0xa9ed('0x39')]({},_0x4b2b03,_0x4b0a30[_0xa9ed('0x42')]);return db[_0xa9ed('0x27')][_0xa9ed('0x43')](_0x4b2b03)['then'](handleEntityNotFound(_0x15a8f5,null))['then'](respondWithResult(_0x15a8f5,null))[_0xa9ed('0x3f')](handleError(_0x15a8f5,null));};exports[_0xa9ed('0x44')]=function(_0x3d45e1,_0x4b9884){return db[_0xa9ed('0x27')][_0xa9ed('0x44')](_0x3d45e1[_0xa9ed('0x45')],{})[_0xa9ed('0x22')](respondWithResult(_0x4b9884,0xc9))[_0xa9ed('0x3f')](handleError(_0x4b9884,null));};exports[_0xa9ed('0x20')]=function(_0x506266,_0x22ebb4){if(_0x506266['body']['id']){delete _0x506266[_0xa9ed('0x45')]['id'];}return db[_0xa9ed('0x27')][_0xa9ed('0x43')]({'where':{'id':_0x506266[_0xa9ed('0x46')]['id']}})[_0xa9ed('0x22')](handleEntityNotFound(_0x22ebb4,null))[_0xa9ed('0x22')](saveUpdates(_0x506266[_0xa9ed('0x45')],null))['then'](respondWithResult(_0x22ebb4,null))['catch'](handleError(_0x22ebb4,null));};exports[_0xa9ed('0x21')]=function(_0x2435a3,_0x57cb97){return db[_0xa9ed('0x27')][_0xa9ed('0x43')]({'where':{'id':_0x2435a3[_0xa9ed('0x46')]['id']}})[_0xa9ed('0x22')](handleEntityNotFound(_0x57cb97,null))[_0xa9ed('0x22')](removeEntity(_0x57cb97,null))[_0xa9ed('0x3f')](handleError(_0x57cb97,null));};exports[_0xa9ed('0x47')]=function(_0x41e2c5,_0x56b6aa){return db[_0xa9ed('0x27')]['describe']()[_0xa9ed('0x22')](respondWithResult(_0x56b6aa,null))[_0xa9ed('0x3f')](handleError(_0x56b6aa,null));}; \ No newline at end of file +var _0x0e37=['rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','keys','options','find','body','params','describe','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0e37,0xf4));var _0x70e3=function(_0x4896ac,_0x2c6df5){_0x4896ac=_0x4896ac-0x0;var _0x58fffc=_0x0e37[_0x4896ac];return _0x58fffc;};'use strict';var pdf=require(_0x70e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x70e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70e3('0x2'));var rp=require('request-promise');var moment=require(_0x70e3('0x3'));var BPromise=require(_0x70e3('0x4'));var Mustache=require(_0x70e3('0x5'));var util=require(_0x70e3('0x6'));var path=require('path');var sox=require(_0x70e3('0x7'));var csv=require(_0x70e3('0x8'));var ejs=require(_0x70e3('0x9'));var fs=require('fs');var _=require(_0x70e3('0xa'));var squel=require(_0x70e3('0xb'));var crypto=require(_0x70e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x70e3('0xd'));var toCsv=require(_0x70e3('0x8'));var querystring=require(_0x70e3('0xe'));var Papa=require(_0x70e3('0xf'));var Redis=require(_0x70e3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x70e3('0x11'));var as=require(_0x70e3('0x12'));var hardwareService=require(_0x70e3('0x13'));var logger=require(_0x70e3('0x14'))(_0x70e3('0x15'));var utils=require(_0x70e3('0x16'));var config=require('../../config/environment');var db=require(_0x70e3('0x17'))['db'];function respondWithStatusCode(_0x2d9deb,_0x13bc77){_0x13bc77=_0x13bc77||0xcc;return function(_0x25172f){if(_0x25172f){return _0x2d9deb[_0x70e3('0x18')](_0x13bc77);}return _0x2d9deb[_0x70e3('0x19')](_0x13bc77)[_0x70e3('0x1a')]();};}function respondWithResult(_0x2b58b9,_0x331cf8){_0x331cf8=_0x331cf8||0xc8;return function(_0x169d81){if(_0x169d81){return _0x2b58b9[_0x70e3('0x19')](_0x331cf8)[_0x70e3('0x1b')](_0x169d81);}};}function respondWithFilteredResult(_0x3dd17c,_0x425adb){return function(_0x595b79){if(_0x595b79){var _0x22bca9=_0x595b79['count'],_0x2053e9=_0x425adb['offset'],_0x504b2e=_0x425adb[_0x70e3('0x1c')]+_0x425adb[_0x70e3('0x1d')],_0x4d0043;if(_0x504b2e>=_0x22bca9){_0x504b2e=_0x22bca9;_0x4d0043=0xc8;}else{_0x4d0043=0xce;}_0x3dd17c[_0x70e3('0x19')](_0x4d0043);return _0x3dd17c[_0x70e3('0x1e')]('Content-Range',_0x2053e9+'-'+_0x504b2e+'/'+_0x22bca9)['json'](_0x595b79);}return null;};}function patchUpdates(_0x1e74f7){return function(_0x1fa3df){try{jsonpatch[_0x70e3('0x1f')](_0x1fa3df,_0x1e74f7,!![]);}catch(_0x487320){return BPromise[_0x70e3('0x20')](_0x487320);}return _0x1fa3df[_0x70e3('0x21')]();};}function saveUpdates(_0x3109ca,_0x2f59fe){return function(_0x45a6f7){if(_0x45a6f7){return _0x45a6f7[_0x70e3('0x22')](_0x3109ca)[_0x70e3('0x23')](function(_0x39d664){return _0x39d664;});}return null;};}function removeEntity(_0x148ed7,_0x9f7744){return function(_0x36571e){if(_0x36571e){return _0x36571e[_0x70e3('0x24')]()[_0x70e3('0x23')](function(){_0x148ed7[_0x70e3('0x19')](0xcc)[_0x70e3('0x1a')]();});}};}function handleEntityNotFound(_0x5b771b,_0x1f18bc){return function(_0x382044){if(!_0x382044){_0x5b771b[_0x70e3('0x18')](0x194);}return _0x382044;};}function handleError(_0x5a7583,_0x17a879){_0x17a879=_0x17a879||0x1f4;return function(_0x3f1713){logger[_0x70e3('0x25')](_0x3f1713[_0x70e3('0x26')]);if(_0x3f1713['name']){delete _0x3f1713[_0x70e3('0x27')];}_0x5a7583['status'](_0x17a879)[_0x70e3('0x28')](_0x3f1713);};}exports[_0x70e3('0x29')]=function(_0x2dcb7e,_0x1483b2){var _0x3072e8={},_0x176951={},_0x54a961={'count':0x0,'rows':[]};var _0x35af92=_[_0x70e3('0x2a')](db[_0x70e3('0x2b')][_0x70e3('0x2c')],function(_0x2de260){return{'name':_0x2de260[_0x70e3('0x2d')],'type':_0x2de260[_0x70e3('0x2e')][_0x70e3('0x2f')]};});_0x176951[_0x70e3('0x30')]=_[_0x70e3('0x2a')](_0x35af92,_0x70e3('0x27'));_0x176951[_0x70e3('0x31')]=_['keys'](_0x2dcb7e['query']);_0x176951[_0x70e3('0x32')]=_[_0x70e3('0x33')](_0x176951[_0x70e3('0x30')],_0x176951[_0x70e3('0x31')]);_0x3072e8['attributes']=_[_0x70e3('0x33')](_0x176951['model'],qs['fields'](_0x2dcb7e[_0x70e3('0x31')][_0x70e3('0x34')]));_0x3072e8[_0x70e3('0x35')]=_0x3072e8['attributes'][_0x70e3('0x36')]?_0x3072e8[_0x70e3('0x35')]:_0x176951[_0x70e3('0x30')];if(!_0x2dcb7e[_0x70e3('0x31')]['hasOwnProperty'](_0x70e3('0x37'))){_0x3072e8['limit']=qs['limit'](_0x2dcb7e[_0x70e3('0x31')][_0x70e3('0x1d')]);_0x3072e8[_0x70e3('0x1c')]=qs[_0x70e3('0x1c')](_0x2dcb7e[_0x70e3('0x31')][_0x70e3('0x1c')]);}_0x3072e8['order']=qs[_0x70e3('0x38')](_0x2dcb7e['query']['sort']);_0x3072e8[_0x70e3('0x39')]=qs[_0x70e3('0x32')](_[_0x70e3('0x3a')](_0x2dcb7e['query'],_0x176951[_0x70e3('0x32')]),_0x35af92);if(_0x2dcb7e[_0x70e3('0x31')][_0x70e3('0x3b')]){_0x3072e8[_0x70e3('0x39')]=_[_0x70e3('0x3c')](_0x3072e8['where'],{'$or':_[_0x70e3('0x2a')](_0x35af92,function(_0x4a62bc){if(_0x4a62bc[_0x70e3('0x2e')]!=='VIRTUAL'){var _0x411979={};_0x411979[_0x4a62bc[_0x70e3('0x27')]]={'$like':'%'+_0x2dcb7e['query'][_0x70e3('0x3b')]+'%'};return _0x411979;}})});}_0x3072e8=_['merge']({},_0x3072e8,_0x2dcb7e['options']);var _0x5b472d={'where':_0x3072e8[_0x70e3('0x39')]};return db[_0x70e3('0x2b')]['count'](_0x5b472d)[_0x70e3('0x23')](function(_0x24e88c){_0x54a961['count']=_0x24e88c;if(_0x2dcb7e['query'][_0x70e3('0x3d')]){_0x3072e8[_0x70e3('0x3e')]=[{'all':!![]}];}return db[_0x70e3('0x2b')]['findAll'](_0x3072e8);})[_0x70e3('0x23')](function(_0x4359d9){_0x54a961[_0x70e3('0x3f')]=_0x4359d9;return _0x54a961;})[_0x70e3('0x23')](respondWithFilteredResult(_0x1483b2,_0x3072e8))[_0x70e3('0x40')](handleError(_0x1483b2,null));};exports[_0x70e3('0x41')]=function(_0x51acb9,_0x36da2d){var _0x448aee={'raw':!![],'where':{'id':_0x51acb9['params']['id']}},_0x377fea={};_0x377fea['model']=_['keys'](db[_0x70e3('0x2b')][_0x70e3('0x2c')]);_0x377fea[_0x70e3('0x31')]=_[_0x70e3('0x42')](_0x51acb9['query']);_0x377fea[_0x70e3('0x32')]=_[_0x70e3('0x33')](_0x377fea[_0x70e3('0x30')],_0x377fea[_0x70e3('0x31')]);_0x448aee[_0x70e3('0x35')]=_[_0x70e3('0x33')](_0x377fea[_0x70e3('0x30')],qs[_0x70e3('0x34')](_0x51acb9['query'][_0x70e3('0x34')]));_0x448aee['attributes']=_0x448aee[_0x70e3('0x35')][_0x70e3('0x36')]?_0x448aee[_0x70e3('0x35')]:_0x377fea['model'];if(_0x51acb9[_0x70e3('0x31')][_0x70e3('0x3d')]){_0x448aee[_0x70e3('0x3e')]=[{'all':!![]}];}_0x448aee=_[_0x70e3('0x3c')]({},_0x448aee,_0x51acb9[_0x70e3('0x43')]);return db[_0x70e3('0x2b')][_0x70e3('0x44')](_0x448aee)['then'](handleEntityNotFound(_0x36da2d,null))[_0x70e3('0x23')](respondWithResult(_0x36da2d,null))['catch'](handleError(_0x36da2d,null));};exports['create']=function(_0x251c0d,_0x3440bf){return db[_0x70e3('0x2b')]['create'](_0x251c0d[_0x70e3('0x45')],{})['then'](respondWithResult(_0x3440bf,0xc9))[_0x70e3('0x40')](handleError(_0x3440bf,null));};exports['update']=function(_0x3b7617,_0x1c3547){if(_0x3b7617[_0x70e3('0x45')]['id']){delete _0x3b7617[_0x70e3('0x45')]['id'];}return db[_0x70e3('0x2b')]['find']({'where':{'id':_0x3b7617[_0x70e3('0x46')]['id']}})[_0x70e3('0x23')](handleEntityNotFound(_0x1c3547,null))[_0x70e3('0x23')](saveUpdates(_0x3b7617['body'],null))[_0x70e3('0x23')](respondWithResult(_0x1c3547,null))['catch'](handleError(_0x1c3547,null));};exports[_0x70e3('0x24')]=function(_0x255bff,_0x2bcac7){return db[_0x70e3('0x2b')]['find']({'where':{'id':_0x255bff[_0x70e3('0x46')]['id']}})[_0x70e3('0x23')](handleEntityNotFound(_0x2bcac7,null))[_0x70e3('0x23')](removeEntity(_0x2bcac7,null))['catch'](handleError(_0x2bcac7,null));};exports[_0x70e3('0x47')]=function(_0x117e70,_0x5106df){return db[_0x70e3('0x2b')]['describe']()[_0x70e3('0x23')](respondWithResult(_0x5106df,null))[_0x70e3('0x40')](handleError(_0x5106df,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 3941f03..afe6574 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 _0x2269=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x17d82f,_0x5d9172){var _0x58137b=function(_0x40e198){while(--_0x40e198){_0x17d82f['push'](_0x17d82f['shift']());}};_0x58137b(++_0x5d9172);}(_0x2269,0x1f2));var _0x9226=function(_0xcb067d,_0x389261){_0xcb067d=_0xcb067d-0x0;var _0x314f93=_0x2269[_0xcb067d];return _0x314f93;};'use strict';var _=require(_0x9226('0x0'));var util=require(_0x9226('0x1'));var logger=require(_0x9226('0x2'))(_0x9226('0x3'));var moment=require('moment');var BPromise=require(_0x9226('0x4'));var rp=require(_0x9226('0x5'));var fs=require('fs');var path=require(_0x9226('0x6'));var rimraf=require(_0x9226('0x7'));var config=require(_0x9226('0x8'));var attributes=require(_0x9226('0x9'));module[_0x9226('0xa')]=function(_0x4e36f8,_0x1a82c1){return _0x4e36f8[_0x9226('0xb')](_0x9226('0xc'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x9226('0xd'),'fields':[_0x9226('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ea4=['../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x407cf7,_0x2c36e1){var _0x177160=function(_0x1c131f){while(--_0x1c131f){_0x407cf7['push'](_0x407cf7['shift']());}};_0x177160(++_0x2c36e1);}(_0x1ea4,0x14b));var _0x41ea=function(_0x35228f,_0x44e0d8){_0x35228f=_0x35228f-0x0;var _0x8f0971=_0x1ea4[_0x35228f];return _0x8f0971;};'use strict';var _=require(_0x41ea('0x0'));var util=require('util');var logger=require(_0x41ea('0x1'))(_0x41ea('0x2'));var moment=require(_0x41ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x41ea('0x4'));var fs=require('fs');var path=require(_0x41ea('0x5'));var rimraf=require(_0x41ea('0x6'));var config=require(_0x41ea('0x7'));var attributes=require(_0x41ea('0x8'));module['exports']=function(_0x62e4d9,_0x353445){return _0x62e4d9[_0x41ea('0x9')](_0x41ea('0xa'),attributes,{'tableName':_0x41ea('0xb'),'paranoid':![],'indexes':[{'name':_0x41ea('0xc'),'fields':[_0x41ea('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 c9dcf0a..3cacf34 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 _0x2d90=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash'];(function(_0xab0d92,_0x4739da){var _0x56846b=function(_0x35f3fa){while(--_0x35f3fa){_0xab0d92['push'](_0xab0d92['shift']());}};_0x56846b(++_0x4739da);}(_0x2d90,0xbf));var _0x02d9=function(_0x11b56c,_0x3c2dc1){_0x11b56c=_0x11b56c-0x0;var _0x1ef82e=_0x2d90[_0x11b56c];return _0x1ef82e;};'use strict';var _=require(_0x02d9('0x0'));var util=require('util');var moment=require(_0x02d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x02d9('0x2'));var fs=require('fs');var Redis=require(_0x02d9('0x3'));var db=require(_0x02d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x02d9('0x5'))(_0x02d9('0x6'));var config=require(_0x02d9('0x7'));var jayson=require(_0x02d9('0x8'));var client=jayson[_0x02d9('0x9')][_0x02d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6b2f,_0x2cd295,_0x479fdd){return new BPromise(function(_0xeccb8b,_0x182bce){return client[_0x02d9('0xb')](_0x2c6b2f,_0x479fdd)[_0x02d9('0xc')](function(_0x5373f5){logger['info'](_0x02d9('0xd'),_0x2cd295,'request\x20sent');logger[_0x02d9('0xe')](_0x02d9('0xf'),_0x2cd295,'request\x20sent',JSON[_0x02d9('0x10')](_0x5373f5));if(_0x5373f5[_0x02d9('0x11')]){if(_0x5373f5[_0x02d9('0x11')][_0x02d9('0x12')]===0x1f4){logger[_0x02d9('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x2cd295,_0x5373f5[_0x02d9('0x11')][_0x02d9('0x13')]);return _0x182bce(_0x5373f5[_0x02d9('0x11')][_0x02d9('0x13')]);}logger[_0x02d9('0x11')](_0x02d9('0xd'),_0x2cd295,_0x5373f5[_0x02d9('0x11')][_0x02d9('0x13')]);return _0xeccb8b(_0x5373f5[_0x02d9('0x11')]['message']);}else{logger[_0x02d9('0x14')](_0x02d9('0xd'),_0x2cd295,_0x02d9('0x15'));_0xeccb8b(_0x5373f5[_0x02d9('0x16')]['message']);}})[_0x02d9('0x17')](function(_0x2d7a77){logger[_0x02d9('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x2cd295,_0x2d7a77);_0x182bce(_0x2d7a77);});});} \ No newline at end of file +var _0xbe91=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0xb9470e,_0x1185b2){var _0x3db2d1=function(_0x572cdb){while(--_0x572cdb){_0xb9470e['push'](_0xb9470e['shift']());}};_0x3db2d1(++_0x1185b2);}(_0xbe91,0x1e0));var _0x1be9=function(_0x4982f6,_0x45ba31){_0x4982f6=_0x4982f6-0x0;var _0x3d8a48=_0xbe91[_0x4982f6];return _0x3d8a48;};'use strict';var _=require('lodash');var util=require(_0x1be9('0x0'));var moment=require(_0x1be9('0x1'));var BPromise=require(_0x1be9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1be9('0x3'));var db=require(_0x1be9('0x4'))['db'];var utils=require(_0x1be9('0x5'));var logger=require(_0x1be9('0x6'))(_0x1be9('0x7'));var config=require(_0x1be9('0x8'));var jayson=require(_0x1be9('0x9'));var client=jayson[_0x1be9('0xa')][_0x1be9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17d141,_0x28cf04,_0x237666){return new BPromise(function(_0x2a389e,_0x19d8a4){return client[_0x1be9('0xc')](_0x17d141,_0x237666)[_0x1be9('0xd')](function(_0x22cc5b){logger[_0x1be9('0xe')](_0x1be9('0xf'),_0x28cf04,_0x1be9('0x10'));logger[_0x1be9('0x11')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x28cf04,'request\x20sent',JSON['stringify'](_0x22cc5b));if(_0x22cc5b[_0x1be9('0x12')]){if(_0x22cc5b[_0x1be9('0x12')][_0x1be9('0x13')]===0x1f4){logger[_0x1be9('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x28cf04,_0x22cc5b[_0x1be9('0x12')][_0x1be9('0x14')]);return _0x19d8a4(_0x22cc5b[_0x1be9('0x12')][_0x1be9('0x14')]);}logger['error'](_0x1be9('0xf'),_0x28cf04,_0x22cc5b[_0x1be9('0x12')][_0x1be9('0x14')]);return _0x2a389e(_0x22cc5b['error']['message']);}else{logger[_0x1be9('0xe')](_0x1be9('0xf'),_0x28cf04,_0x1be9('0x10'));_0x2a389e(_0x22cc5b[_0x1be9('0x15')]['message']);}})[_0x1be9('0x16')](function(_0x1448e7){logger['error'](_0x1be9('0xf'),_0x28cf04,_0x1448e7);_0x19d8a4(_0x1448e7);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9da2219..d8ecb36 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 _0xdb71=['describe','show','create','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','/describe'];(function(_0x29f232,_0xa42136){var _0x583b19=function(_0x5b92ae){while(--_0x5b92ae){_0x29f232['push'](_0x29f232['shift']());}};_0x583b19(++_0xa42136);}(_0xdb71,0xe4));var _0x1db7=function(_0x254bd0,_0x14e419){_0x254bd0=_0x254bd0-0x0;var _0x130355=_0xdb71[_0x254bd0];return _0x130355;};'use strict';var multer=require(_0x1db7('0x0'));var util=require(_0x1db7('0x1'));var path=require(_0x1db7('0x2'));var timeout=require('connect-timeout');var express=require(_0x1db7('0x3'));var router=express[_0x1db7('0x4')]();var auth=require(_0x1db7('0x5'));var interaction=require(_0x1db7('0x6'));var config=require(_0x1db7('0x7'));var controller=require(_0x1db7('0x8'));router['get']('/',auth[_0x1db7('0x9')](),controller[_0x1db7('0xa')]);router['get'](_0x1db7('0xb'),auth[_0x1db7('0x9')](),controller[_0x1db7('0xc')]);router['get']('/:id',auth[_0x1db7('0x9')](),controller[_0x1db7('0xd')]);router['post']('/',auth[_0x1db7('0x9')](),controller[_0x1db7('0xe')]);router['put']('/:id',auth[_0x1db7('0x9')](),controller[_0x1db7('0xf')]);router[_0x1db7('0x10')](_0x1db7('0x11'),auth[_0x1db7('0x9')](),controller[_0x1db7('0x12')]);module[_0x1db7('0x13')]=router; \ No newline at end of file +var _0x9589=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9589,0xbc));var _0x9958=function(_0x28b5cf,_0x5824bd){_0x28b5cf=_0x28b5cf-0x0;var _0x9e1f2b=_0x9589[_0x28b5cf];return _0x9e1f2b;};'use strict';var multer=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var path=require(_0x9958('0x2'));var timeout=require(_0x9958('0x3'));var express=require(_0x9958('0x4'));var router=express['Router']();var auth=require(_0x9958('0x5'));var interaction=require(_0x9958('0x6'));var config=require(_0x9958('0x7'));var controller=require('./memberReport.controller');router[_0x9958('0x8')]('/',auth[_0x9958('0x9')](),controller[_0x9958('0xa')]);router[_0x9958('0x8')](_0x9958('0xb'),auth[_0x9958('0x9')](),controller['describe']);router[_0x9958('0x8')](_0x9958('0xc'),auth[_0x9958('0x9')](),controller[_0x9958('0xd')]);router[_0x9958('0xe')]('/',auth[_0x9958('0x9')](),controller[_0x9958('0xf')]);router[_0x9958('0x10')](_0x9958('0xc'),auth[_0x9958('0x9')](),controller[_0x9958('0x11')]);router[_0x9958('0x12')](_0x9958('0xc'),auth[_0x9958('0x9')](),controller[_0x9958('0x13')]);module[_0x9958('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8e6272f..11cbeb8 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 _0x6414=['STRING','DEFAULT\x20PAUSE','DATE','getDataValue','diff','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','INTEGER','sequelize'];(function(_0x5b66b0,_0x3c535b){var _0x63df50=function(_0x5b6024){while(--_0x5b6024){_0x5b66b0['push'](_0x5b66b0['shift']());}};_0x63df50(++_0x3c535b);}(_0x6414,0x185));var _0x4641=function(_0x3b4278,_0x12cadb){_0x3b4278=_0x3b4278-0x0;var _0x29b01e=_0x6414[_0x3b4278];return _0x29b01e;};'use strict';var Sequelize=require(_0x4641('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4641('0x1')]},'interface':{'type':Sequelize[_0x4641('0x1')]},'type':{'type':Sequelize[_0x4641('0x1')],'defaultValue':_0x4641('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4641('0x3')],'set':function(_0x157451){var _0x4f3ad9=moment(_0x157451);var _0x5ba3bc=moment(this[_0x4641('0x4')]('enterAt'));var _0x3dfafb=_0x4f3ad9[_0x4641('0x5')](_0x5ba3bc,'seconds');this['setDataValue'](_0x4641('0x6'),_0x157451);this[_0x4641('0x7')]('duration',_0x3dfafb||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x4641('0x8')},'data2':{'type':Sequelize[_0x4641('0x1')],'comment':_0x4641('0x9')},'data3':{'type':Sequelize[_0x4641('0x1')],'comment':_0x4641('0xa')},'data4':{'type':Sequelize[_0x4641('0x1')],'comment':_0x4641('0xb')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x4641('0x1')]},'internal':{'type':Sequelize[_0x4641('0xc')]},'uniqueid':{'type':Sequelize[_0x4641('0x1')]}}; \ No newline at end of file +var _0xb018=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','duration'];(function(_0x224166,_0x314ba8){var _0x7bd3d9=function(_0x2523ce){while(--_0x2523ce){_0x224166['push'](_0x224166['shift']());}};_0x7bd3d9(++_0x314ba8);}(_0xb018,0x173));var _0x8b01=function(_0x2ce345,_0x5ea50b){_0x2ce345=_0x2ce345-0x0;var _0x40bd2a=_0xb018[_0x2ce345];return _0x40bd2a;};'use strict';var Sequelize=require(_0x8b01('0x0'));var moment=require(_0x8b01('0x1'));module[_0x8b01('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8b01('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x8b01('0x4'),'comment':_0x8b01('0x5')},'duration':{'type':Sequelize[_0x8b01('0x6')]},'enterAt':{'type':Sequelize[_0x8b01('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x26f0fa){var _0x57c417=moment(_0x26f0fa);var _0x15214b=moment(this['getDataValue'](_0x8b01('0x8')));var _0x651536=_0x57c417[_0x8b01('0x9')](_0x15214b,_0x8b01('0xa'));this[_0x8b01('0xb')]('exitAt',_0x26f0fa);this[_0x8b01('0xb')](_0x8b01('0xc'),_0x651536||null);}},'data1':{'type':Sequelize[_0x8b01('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x8b01('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x8b01('0x3')],'comment':_0x8b01('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0x8b01('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0x8b01('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x8b01('0x6')]},'uniqueid':{'type':Sequelize[_0x8b01('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d5fde5f..15eaf2d 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 _0xe61c=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','count','offset','set','Content-Range','save','update','then','sendStatus','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','MemberReport','includeAll','findAll','rows','show','params','include','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xe61c,0x127));var _0xce61=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0xe61c[_0x54ea7a];return _0x65a10d;};'use strict';var pdf=require(_0xce61('0x0'));var emlformat=require(_0xce61('0x1'));var rimraf=require(_0xce61('0x2'));var zipdir=require(_0xce61('0x3'));var jsonpatch=require(_0xce61('0x4'));var rp=require(_0xce61('0x5'));var moment=require(_0xce61('0x6'));var BPromise=require(_0xce61('0x7'));var Mustache=require(_0xce61('0x8'));var util=require(_0xce61('0x9'));var path=require('path');var sox=require(_0xce61('0xa'));var csv=require(_0xce61('0xb'));var ejs=require(_0xce61('0xc'));var fs=require('fs');var _=require(_0xce61('0xd'));var squel=require(_0xce61('0xe'));var crypto=require(_0xce61('0xf'));var jsforce=require(_0xce61('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xce61('0xb'));var querystring=require(_0xce61('0x11'));var Papa=require(_0xce61('0x12'));var Redis=require('ioredis');var authService=require(_0xce61('0x13'));var qs=require(_0xce61('0x14'));var as=require(_0xce61('0x15'));var hardwareService=require(_0xce61('0x16'));var logger=require(_0xce61('0x17'))(_0xce61('0x18'));var utils=require(_0xce61('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ffcd4,_0x5ee590){_0x5ee590=_0x5ee590||0xcc;return function(_0x2c798f){if(_0x2c798f){return _0x2ffcd4['sendStatus'](_0x5ee590);}return _0x2ffcd4[_0xce61('0x1a')](_0x5ee590)[_0xce61('0x1b')]();};}function respondWithResult(_0x29df5a,_0xa32788){_0xa32788=_0xa32788||0xc8;return function(_0x10bb20){if(_0x10bb20){return _0x29df5a[_0xce61('0x1a')](_0xa32788)[_0xce61('0x1c')](_0x10bb20);}};}function respondWithFilteredResult(_0x194b42,_0x39d8bf){return function(_0x568078){if(_0x568078){var _0x56bda0=_0x568078[_0xce61('0x1d')],_0x204430=_0x39d8bf[_0xce61('0x1e')],_0x3a2740=_0x39d8bf[_0xce61('0x1e')]+_0x39d8bf['limit'],_0x2b0701;if(_0x3a2740>=_0x56bda0){_0x3a2740=_0x56bda0;_0x2b0701=0xc8;}else{_0x2b0701=0xce;}_0x194b42['status'](_0x2b0701);return _0x194b42[_0xce61('0x1f')](_0xce61('0x20'),_0x204430+'-'+_0x3a2740+'/'+_0x56bda0)[_0xce61('0x1c')](_0x568078);}return null;};}function patchUpdates(_0x30635f){return function(_0x5189d4){try{jsonpatch['apply'](_0x5189d4,_0x30635f,!![]);}catch(_0x210d3c){return BPromise['reject'](_0x210d3c);}return _0x5189d4[_0xce61('0x21')]();};}function saveUpdates(_0x14b36e,_0x4a3640){return function(_0x1b78ac){if(_0x1b78ac){return _0x1b78ac[_0xce61('0x22')](_0x14b36e)[_0xce61('0x23')](function(_0x2bd717){return _0x2bd717;});}return null;};}function removeEntity(_0x2c3a10,_0x28ca69){return function(_0x3deeb3){if(_0x3deeb3){return _0x3deeb3['destroy']()[_0xce61('0x23')](function(){_0x2c3a10[_0xce61('0x1a')](0xcc)[_0xce61('0x1b')]();});}};}function handleEntityNotFound(_0x45419d,_0x4ab021){return function(_0x30bcc7){if(!_0x30bcc7){_0x45419d[_0xce61('0x24')](0x194);}return _0x30bcc7;};}function handleError(_0xe88fea,_0x40f3aa){_0x40f3aa=_0x40f3aa||0x1f4;return function(_0x2aa202){logger[_0xce61('0x25')](_0x2aa202['stack']);if(_0x2aa202[_0xce61('0x26')]){delete _0x2aa202[_0xce61('0x26')];}_0xe88fea[_0xce61('0x1a')](_0x40f3aa)[_0xce61('0x27')](_0x2aa202);};}exports['index']=function(_0x439d9e,_0x47fdfb){var _0x44a941={},_0x49a0ae={},_0xed1616={'count':0x0,'rows':[]};var _0x3e0052=_[_0xce61('0x28')](db['MemberReport'][_0xce61('0x29')],function(_0x43633f){return{'name':_0x43633f['fieldName'],'type':_0x43633f[_0xce61('0x2a')][_0xce61('0x2b')]};});_0x49a0ae[_0xce61('0x2c')]=_['map'](_0x3e0052,_0xce61('0x26'));_0x49a0ae[_0xce61('0x2d')]=_[_0xce61('0x2e')](_0x439d9e[_0xce61('0x2d')]);_0x49a0ae[_0xce61('0x2f')]=_[_0xce61('0x30')](_0x49a0ae[_0xce61('0x2c')],_0x49a0ae['query']);_0x44a941[_0xce61('0x31')]=_[_0xce61('0x30')](_0x49a0ae[_0xce61('0x2c')],qs['fields'](_0x439d9e['query'][_0xce61('0x32')]));_0x44a941[_0xce61('0x31')]=_0x44a941[_0xce61('0x31')][_0xce61('0x33')]?_0x44a941[_0xce61('0x31')]:_0x49a0ae[_0xce61('0x2c')];if(!_0x439d9e[_0xce61('0x2d')][_0xce61('0x34')](_0xce61('0x35'))){_0x44a941[_0xce61('0x36')]=qs[_0xce61('0x36')](_0x439d9e[_0xce61('0x2d')]['limit']);_0x44a941[_0xce61('0x1e')]=qs['offset'](_0x439d9e[_0xce61('0x2d')][_0xce61('0x1e')]);}_0x44a941[_0xce61('0x37')]=qs[_0xce61('0x38')](_0x439d9e[_0xce61('0x2d')]['sort']);_0x44a941[_0xce61('0x39')]=qs['filters'](_[_0xce61('0x3a')](_0x439d9e[_0xce61('0x2d')],_0x49a0ae[_0xce61('0x2f')]),_0x3e0052);if(_0x439d9e[_0xce61('0x2d')][_0xce61('0x3b')]){_0x44a941[_0xce61('0x39')]=_[_0xce61('0x3c')](_0x44a941[_0xce61('0x39')],{'$or':_[_0xce61('0x28')](_0x3e0052,function(_0x2da1a5){if(_0x2da1a5[_0xce61('0x2a')]!==_0xce61('0x3d')){var _0x9732fc={};_0x9732fc[_0x2da1a5[_0xce61('0x26')]]={'$like':'%'+_0x439d9e[_0xce61('0x2d')][_0xce61('0x3b')]+'%'};return _0x9732fc;}})});}_0x44a941=_[_0xce61('0x3c')]({},_0x44a941,_0x439d9e[_0xce61('0x3e')]);var _0x5869b5={'where':_0x44a941[_0xce61('0x39')]};return db[_0xce61('0x3f')]['count'](_0x5869b5)[_0xce61('0x23')](function(_0x3d548f){_0xed1616[_0xce61('0x1d')]=_0x3d548f;if(_0x439d9e[_0xce61('0x2d')][_0xce61('0x40')]){_0x44a941['include']=[{'all':!![]}];}return db['MemberReport'][_0xce61('0x41')](_0x44a941);})[_0xce61('0x23')](function(_0x4ea4ce){_0xed1616[_0xce61('0x42')]=_0x4ea4ce;return _0xed1616;})[_0xce61('0x23')](respondWithFilteredResult(_0x47fdfb,_0x44a941))['catch'](handleError(_0x47fdfb,null));};exports[_0xce61('0x43')]=function(_0x10d213,_0x5c5861){var _0x1c2896={'raw':!![],'where':{'id':_0x10d213[_0xce61('0x44')]['id']}},_0x4c049e={};_0x4c049e[_0xce61('0x2c')]=_[_0xce61('0x2e')](db[_0xce61('0x3f')][_0xce61('0x29')]);_0x4c049e[_0xce61('0x2d')]=_[_0xce61('0x2e')](_0x10d213[_0xce61('0x2d')]);_0x4c049e['filters']=_['intersection'](_0x4c049e['model'],_0x4c049e[_0xce61('0x2d')]);_0x1c2896['attributes']=_[_0xce61('0x30')](_0x4c049e[_0xce61('0x2c')],qs['fields'](_0x10d213[_0xce61('0x2d')]['fields']));_0x1c2896[_0xce61('0x31')]=_0x1c2896[_0xce61('0x31')]['length']?_0x1c2896['attributes']:_0x4c049e[_0xce61('0x2c')];if(_0x10d213[_0xce61('0x2d')][_0xce61('0x40')]){_0x1c2896[_0xce61('0x45')]=[{'all':!![]}];}_0x1c2896=_[_0xce61('0x3c')]({},_0x1c2896,_0x10d213[_0xce61('0x3e')]);return db['MemberReport'][_0xce61('0x46')](_0x1c2896)['then'](handleEntityNotFound(_0x5c5861,null))[_0xce61('0x23')](respondWithResult(_0x5c5861,null))[_0xce61('0x47')](handleError(_0x5c5861,null));};exports[_0xce61('0x48')]=function(_0x3d7b11,_0xc5338c){return db[_0xce61('0x3f')][_0xce61('0x48')](_0x3d7b11[_0xce61('0x49')],{})[_0xce61('0x23')](respondWithResult(_0xc5338c,0xc9))[_0xce61('0x47')](handleError(_0xc5338c,null));};exports['update']=function(_0xcfe2e0,_0x302f76){if(_0xcfe2e0['body']['id']){delete _0xcfe2e0[_0xce61('0x49')]['id'];}return db[_0xce61('0x3f')][_0xce61('0x46')]({'where':{'id':_0xcfe2e0[_0xce61('0x44')]['id']}})[_0xce61('0x23')](handleEntityNotFound(_0x302f76,null))[_0xce61('0x23')](saveUpdates(_0xcfe2e0[_0xce61('0x49')],null))[_0xce61('0x23')](respondWithResult(_0x302f76,null))['catch'](handleError(_0x302f76,null));};exports[_0xce61('0x4a')]=function(_0x3ac5c1,_0x25a736){return db[_0xce61('0x3f')][_0xce61('0x46')]({'where':{'id':_0x3ac5c1[_0xce61('0x44')]['id']}})['then'](handleEntityNotFound(_0x25a736,null))['then'](removeEntity(_0x25a736,null))[_0xce61('0x47')](handleError(_0x25a736,null));};exports[_0xce61('0x4b')]=function(_0x4a811b,_0xee7b51){return db[_0xce61('0x3f')]['describe']()[_0xce61('0x23')](respondWithResult(_0xee7b51,null))[_0xce61('0x47')](handleError(_0xee7b51,null));}; \ No newline at end of file +var _0xa73a=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','index','map','MemberReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa73a,0x1e2));var _0xaa73=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0xa73a[_0x3b7b8a];return _0x441206;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa73('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa73('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa73('0x2'));var moment=require(_0xaa73('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaa73('0x4'));var util=require('util');var path=require('path');var sox=require(_0xaa73('0x5'));var csv=require(_0xaa73('0x6'));var ejs=require(_0xaa73('0x7'));var fs=require('fs');var _=require(_0xaa73('0x8'));var squel=require(_0xaa73('0x9'));var crypto=require(_0xaa73('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xaa73('0xb'));var toCsv=require(_0xaa73('0x6'));var querystring=require('querystring');var Papa=require(_0xaa73('0xc'));var Redis=require(_0xaa73('0xd'));var authService=require(_0xaa73('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xaa73('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa73('0x10'));var utils=require('../../config/utils');var config=require(_0xaa73('0x11'));var db=require(_0xaa73('0x12'))['db'];function respondWithStatusCode(_0x3fc842,_0x34cf9f){_0x34cf9f=_0x34cf9f||0xcc;return function(_0x458f85){if(_0x458f85){return _0x3fc842['sendStatus'](_0x34cf9f);}return _0x3fc842[_0xaa73('0x13')](_0x34cf9f)[_0xaa73('0x14')]();};}function respondWithResult(_0x21d29f,_0x1cab5e){_0x1cab5e=_0x1cab5e||0xc8;return function(_0x4dc096){if(_0x4dc096){return _0x21d29f[_0xaa73('0x13')](_0x1cab5e)[_0xaa73('0x15')](_0x4dc096);}};}function respondWithFilteredResult(_0x4830a1,_0x8088e9){return function(_0x346d00){if(_0x346d00){var _0x4dc0f1=_0x346d00[_0xaa73('0x16')],_0x5f12a8=_0x8088e9[_0xaa73('0x17')],_0x1a6a05=_0x8088e9['offset']+_0x8088e9[_0xaa73('0x18')],_0x3227c7;if(_0x1a6a05>=_0x4dc0f1){_0x1a6a05=_0x4dc0f1;_0x3227c7=0xc8;}else{_0x3227c7=0xce;}_0x4830a1['status'](_0x3227c7);return _0x4830a1[_0xaa73('0x19')](_0xaa73('0x1a'),_0x5f12a8+'-'+_0x1a6a05+'/'+_0x4dc0f1)[_0xaa73('0x15')](_0x346d00);}return null;};}function patchUpdates(_0x3ac9c6){return function(_0x346a07){try{jsonpatch[_0xaa73('0x1b')](_0x346a07,_0x3ac9c6,!![]);}catch(_0x13a778){return BPromise[_0xaa73('0x1c')](_0x13a778);}return _0x346a07['save']();};}function saveUpdates(_0x20ff53,_0x35e6f4){return function(_0x2d227b){if(_0x2d227b){return _0x2d227b[_0xaa73('0x1d')](_0x20ff53)['then'](function(_0x950763){return _0x950763;});}return null;};}function removeEntity(_0x29de1c,_0x328c43){return function(_0x71ced8){if(_0x71ced8){return _0x71ced8[_0xaa73('0x1e')]()[_0xaa73('0x1f')](function(){_0x29de1c[_0xaa73('0x13')](0xcc)[_0xaa73('0x14')]();});}};}function handleEntityNotFound(_0xb8734f,_0x1b0088){return function(_0x155ff4){if(!_0x155ff4){_0xb8734f[_0xaa73('0x20')](0x194);}return _0x155ff4;};}function handleError(_0x5307f7,_0x2e697c){_0x2e697c=_0x2e697c||0x1f4;return function(_0x2ee3c1){logger['error'](_0x2ee3c1[_0xaa73('0x21')]);if(_0x2ee3c1[_0xaa73('0x22')]){delete _0x2ee3c1['name'];}_0x5307f7[_0xaa73('0x13')](_0x2e697c)['send'](_0x2ee3c1);};}exports[_0xaa73('0x23')]=function(_0x4f4c9,_0x3d6f46){var _0x451f6c={},_0x46dd8c={},_0x417b8d={'count':0x0,'rows':[]};var _0xf83f34=_[_0xaa73('0x24')](db[_0xaa73('0x25')][_0xaa73('0x26')],function(_0x603389){return{'name':_0x603389[_0xaa73('0x27')],'type':_0x603389['type'][_0xaa73('0x28')]};});_0x46dd8c[_0xaa73('0x29')]=_[_0xaa73('0x24')](_0xf83f34,_0xaa73('0x22'));_0x46dd8c['query']=_[_0xaa73('0x2a')](_0x4f4c9[_0xaa73('0x2b')]);_0x46dd8c[_0xaa73('0x2c')]=_['intersection'](_0x46dd8c['model'],_0x46dd8c[_0xaa73('0x2b')]);_0x451f6c[_0xaa73('0x2d')]=_[_0xaa73('0x2e')](_0x46dd8c[_0xaa73('0x29')],qs[_0xaa73('0x2f')](_0x4f4c9[_0xaa73('0x2b')][_0xaa73('0x2f')]));_0x451f6c['attributes']=_0x451f6c['attributes'][_0xaa73('0x30')]?_0x451f6c[_0xaa73('0x2d')]:_0x46dd8c[_0xaa73('0x29')];if(!_0x4f4c9[_0xaa73('0x2b')][_0xaa73('0x31')](_0xaa73('0x32'))){_0x451f6c['limit']=qs[_0xaa73('0x18')](_0x4f4c9['query'][_0xaa73('0x18')]);_0x451f6c[_0xaa73('0x17')]=qs[_0xaa73('0x17')](_0x4f4c9[_0xaa73('0x2b')][_0xaa73('0x17')]);}_0x451f6c[_0xaa73('0x33')]=qs[_0xaa73('0x34')](_0x4f4c9[_0xaa73('0x2b')]['sort']);_0x451f6c[_0xaa73('0x35')]=qs[_0xaa73('0x2c')](_[_0xaa73('0x36')](_0x4f4c9['query'],_0x46dd8c['filters']),_0xf83f34);if(_0x4f4c9[_0xaa73('0x2b')][_0xaa73('0x37')]){_0x451f6c[_0xaa73('0x35')]=_['merge'](_0x451f6c[_0xaa73('0x35')],{'$or':_[_0xaa73('0x24')](_0xf83f34,function(_0x546062){if(_0x546062[_0xaa73('0x38')]!==_0xaa73('0x39')){var _0x55a2a0={};_0x55a2a0[_0x546062['name']]={'$like':'%'+_0x4f4c9['query'][_0xaa73('0x37')]+'%'};return _0x55a2a0;}})});}_0x451f6c=_[_0xaa73('0x3a')]({},_0x451f6c,_0x4f4c9[_0xaa73('0x3b')]);var _0x46929a={'where':_0x451f6c['where']};return db[_0xaa73('0x25')]['count'](_0x46929a)[_0xaa73('0x1f')](function(_0x55c294){_0x417b8d['count']=_0x55c294;if(_0x4f4c9['query'][_0xaa73('0x3c')]){_0x451f6c[_0xaa73('0x3d')]=[{'all':!![]}];}return db[_0xaa73('0x25')][_0xaa73('0x3e')](_0x451f6c);})['then'](function(_0x104020){_0x417b8d[_0xaa73('0x3f')]=_0x104020;return _0x417b8d;})[_0xaa73('0x1f')](respondWithFilteredResult(_0x3d6f46,_0x451f6c))['catch'](handleError(_0x3d6f46,null));};exports[_0xaa73('0x40')]=function(_0x4bb8f4,_0x22f617){var _0x435301={'raw':!![],'where':{'id':_0x4bb8f4['params']['id']}},_0x28f0e2={};_0x28f0e2[_0xaa73('0x29')]=_[_0xaa73('0x2a')](db[_0xaa73('0x25')]['rawAttributes']);_0x28f0e2[_0xaa73('0x2b')]=_[_0xaa73('0x2a')](_0x4bb8f4[_0xaa73('0x2b')]);_0x28f0e2['filters']=_[_0xaa73('0x2e')](_0x28f0e2[_0xaa73('0x29')],_0x28f0e2[_0xaa73('0x2b')]);_0x435301[_0xaa73('0x2d')]=_[_0xaa73('0x2e')](_0x28f0e2[_0xaa73('0x29')],qs[_0xaa73('0x2f')](_0x4bb8f4['query'][_0xaa73('0x2f')]));_0x435301[_0xaa73('0x2d')]=_0x435301[_0xaa73('0x2d')]['length']?_0x435301['attributes']:_0x28f0e2['model'];if(_0x4bb8f4[_0xaa73('0x2b')]['includeAll']){_0x435301[_0xaa73('0x3d')]=[{'all':!![]}];}_0x435301=_[_0xaa73('0x3a')]({},_0x435301,_0x4bb8f4[_0xaa73('0x3b')]);return db[_0xaa73('0x25')][_0xaa73('0x41')](_0x435301)[_0xaa73('0x1f')](handleEntityNotFound(_0x22f617,null))[_0xaa73('0x1f')](respondWithResult(_0x22f617,null))[_0xaa73('0x42')](handleError(_0x22f617,null));};exports[_0xaa73('0x43')]=function(_0x54c31a,_0x133cf1){return db[_0xaa73('0x25')][_0xaa73('0x43')](_0x54c31a[_0xaa73('0x44')],{})['then'](respondWithResult(_0x133cf1,0xc9))[_0xaa73('0x42')](handleError(_0x133cf1,null));};exports['update']=function(_0x3dddf4,_0x31c6ba){if(_0x3dddf4[_0xaa73('0x44')]['id']){delete _0x3dddf4[_0xaa73('0x44')]['id'];}return db['MemberReport']['find']({'where':{'id':_0x3dddf4['params']['id']}})['then'](handleEntityNotFound(_0x31c6ba,null))[_0xaa73('0x1f')](saveUpdates(_0x3dddf4['body'],null))['then'](respondWithResult(_0x31c6ba,null))[_0xaa73('0x42')](handleError(_0x31c6ba,null));};exports['destroy']=function(_0xf96718,_0x98d846){return db[_0xaa73('0x25')][_0xaa73('0x41')]({'where':{'id':_0xf96718['params']['id']}})[_0xaa73('0x1f')](handleEntityNotFound(_0x98d846,null))['then'](removeEntity(_0x98d846,null))[_0xaa73('0x42')](handleError(_0x98d846,null));};exports[_0xaa73('0x45')]=function(_0x4c5ee4,_0x2303a6){return db['MemberReport']['describe']()[_0xaa73('0x1f')](respondWithResult(_0x2303a6,null))[_0xaa73('0x42')](handleError(_0x2303a6,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3ca938a..79e0cc1 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 _0xac31=['request-promise','rimraf','../../config/environment','define','MemberReport','report_member','membername','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4563cc,_0x48ec74){var _0x2c0bd1=function(_0x5d1359){while(--_0x5d1359){_0x4563cc['push'](_0x4563cc['shift']());}};_0x2c0bd1(++_0x48ec74);}(_0xac31,0xca));var _0x1ac3=function(_0x52973d,_0xfb612f){_0x52973d=_0x52973d-0x0;var _0x1feec0=_0xac31[_0x52973d];return _0x1feec0;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./memberReport.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x1ac3('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x56e7=['../../config/environment','./memberReport.attributes','define','MemberReport','membername_interface','interface','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56e7,0x7b));var _0x756e=function(_0x12b4c1,_0x19f034){_0x12b4c1=_0x12b4c1-0x0;var _0x1329da=_0x56e7[_0x12b4c1];return _0x1329da;};'use strict';var _=require('lodash');var util=require(_0x756e('0x0'));var logger=require(_0x756e('0x1'))('api');var moment=require(_0x756e('0x2'));var BPromise=require(_0x756e('0x3'));var rp=require(_0x756e('0x4'));var fs=require('fs');var path=require(_0x756e('0x5'));var rimraf=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var attributes=require(_0x756e('0x8'));module['exports']=function(_0x3b3b8f,_0x404189){return _0x3b3b8f[_0x756e('0x9')](_0x756e('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x756e('0xb'),'fields':['membername',_0x756e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index af9b63f..80c6055 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 _0x17d5=['debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMemberReport','MemberReport','options','raw','where','attributes','limit','include','map','model','body','CreateMemberReport','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x17d5,0x197));var _0x517d=function(_0x3105be,_0x3dc57a){_0x3105be=_0x3105be-0x0;var _0x46c446=_0x17d5[_0x3105be];return _0x46c446;};'use strict';var _=require('lodash');var util=require(_0x517d('0x0'));var moment=require(_0x517d('0x1'));var BPromise=require(_0x517d('0x2'));var rs=require(_0x517d('0x3'));var fs=require('fs');var Redis=require(_0x517d('0x4'));var db=require(_0x517d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x517d('0x6'));var jayson=require(_0x517d('0x7'));var client=jayson[_0x517d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18ae1f,_0x4b2d6b,_0x28281a){return new BPromise(function(_0x544515,_0x3f7e40){return client[_0x517d('0x9')](_0x18ae1f,_0x28281a)[_0x517d('0xa')](function(_0x5577e2){logger['info'](_0x517d('0xb'),_0x4b2d6b,_0x517d('0xc'));logger[_0x517d('0xd')](_0x517d('0xe'),_0x4b2d6b,_0x517d('0xc'),JSON[_0x517d('0xf')](_0x5577e2));if(_0x5577e2[_0x517d('0x10')]){if(_0x5577e2[_0x517d('0x10')][_0x517d('0x11')]===0x1f4){logger[_0x517d('0x10')](_0x517d('0xb'),_0x4b2d6b,_0x5577e2[_0x517d('0x10')][_0x517d('0x12')]);return _0x3f7e40(_0x5577e2['error'][_0x517d('0x12')]);}logger[_0x517d('0x10')](_0x517d('0xb'),_0x4b2d6b,_0x5577e2[_0x517d('0x10')]['message']);return _0x544515(_0x5577e2['error']['message']);}else{logger[_0x517d('0x13')]('MemberReport,\x20%s,\x20%s',_0x4b2d6b,_0x517d('0xc'));_0x544515(_0x5577e2['result']['message']);}})[_0x517d('0x14')](function(_0x5cb068){logger['error'](_0x517d('0xb'),_0x4b2d6b,_0x5cb068);_0x3f7e40(_0x5cb068);});});}exports[_0x517d('0x15')]=function(_0x9af520){var _0x105210=this;return new Promise(function(_0x3836c0,_0x3f4059){return db[_0x517d('0x16')]['findAll']({'raw':_0x9af520[_0x517d('0x17')]?_0x9af520[_0x517d('0x17')][_0x517d('0x18')]===undefined?!![]:![]:!![],'where':_0x9af520[_0x517d('0x17')]?_0x9af520[_0x517d('0x17')][_0x517d('0x19')]||null:null,'attributes':_0x9af520[_0x517d('0x17')]?_0x9af520['options'][_0x517d('0x1a')]||null:null,'limit':_0x9af520['options']?_0x9af520['options'][_0x517d('0x1b')]||null:null,'include':_0x9af520[_0x517d('0x17')]?_0x9af520['options'][_0x517d('0x1c')]?_[_0x517d('0x1d')](_0x9af520[_0x517d('0x17')][_0x517d('0x1c')],function(_0x150718){return{'model':db[_0x150718[_0x517d('0x1e')]],'as':_0x150718['as'],'attributes':_0x150718[_0x517d('0x1a')],'include':_0x150718[_0x517d('0x1c')]?_[_0x517d('0x1d')](_0x150718[_0x517d('0x1c')],function(_0x2f28cb){return{'model':db[_0x2f28cb[_0x517d('0x1e')]],'as':_0x2f28cb['as'],'attributes':_0x2f28cb[_0x517d('0x1a')],'include':_0x2f28cb[_0x517d('0x1c')]?_[_0x517d('0x1d')](_0x2f28cb[_0x517d('0x1c')],function(_0x2005d4){return{'model':db[_0x2005d4[_0x517d('0x1e')]],'as':_0x2005d4['as'],'attributes':_0x2005d4[_0x517d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x517d('0xa')](function(_0x1e5d4a){logger['info'](_0x517d('0x15'),_0x9af520);logger[_0x517d('0xd')](_0x517d('0x15'),_0x9af520,JSON[_0x517d('0xf')](_0x1e5d4a));_0x3836c0(_0x1e5d4a);})[_0x517d('0x14')](function(_0x3e8209){logger[_0x517d('0x10')]('GetMemberReport',_0x3e8209[_0x517d('0x12')],_0x9af520);_0x3f4059(_0x105210[_0x517d('0x10')](0x1f4,_0x3e8209[_0x517d('0x12')]));});});};exports['CreateMemberReport']=function(_0xca317e){var _0x379e6f=this;return new Promise(function(_0x5bb830,_0x1dd4bd){return db['MemberReport']['create'](_0xca317e[_0x517d('0x1f')],{'raw':_0xca317e[_0x517d('0x17')]?_0xca317e['options']['raw']===undefined?!![]:![]:!![]})[_0x517d('0xa')](function(_0x9107ce){logger[_0x517d('0x13')](_0x517d('0x20'),_0xca317e);logger['debug'](_0x517d('0x20'),_0xca317e,JSON[_0x517d('0xf')](_0x9107ce));_0x5bb830(_0x9107ce);})[_0x517d('0x14')](function(_0x4c7673){logger['error'](_0x517d('0x20'),_0x4c7673[_0x517d('0x12')],_0xca317e);_0x1dd4bd(_0x379e6f[_0x517d('0x10')](0x1f4,_0x4c7673[_0x517d('0x12')]));});});};exports[_0x517d('0x21')]=function(_0x3be329){var _0x4d99b6=this;return new Promise(function(_0x178967,_0x1dbf82){return db[_0x517d('0x16')][_0x517d('0x22')](_0x3be329['body'],{'raw':_0x3be329[_0x517d('0x17')]?_0x3be329[_0x517d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3be329[_0x517d('0x17')]?_0x3be329['options'][_0x517d('0x19')]||null:null,'attributes':_0x3be329[_0x517d('0x17')]?_0x3be329[_0x517d('0x17')][_0x517d('0x1a')]||null:null,'limit':_0x3be329[_0x517d('0x17')]?_0x3be329['options'][_0x517d('0x1b')]||null:null})['then'](function(_0x1ef0c3){logger['info']('UpdateMemberReport',_0x3be329);logger[_0x517d('0xd')](_0x517d('0x21'),_0x3be329,JSON[_0x517d('0xf')](_0x1ef0c3));_0x178967(_0x1ef0c3);})['catch'](function(_0x9fd4ef){logger[_0x517d('0x10')]('UpdateMemberReport',_0x9fd4ef[_0x517d('0x12')],_0x3be329);_0x1dbf82(_0x4d99b6[_0x517d('0x10')](0x1f4,_0x9fd4ef['message']));});});}; \ No newline at end of file +var _0xad9f=['model','then','GetMemberReport','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','options','raw','attributes','limit','include','map'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xad9f,0xed));var _0xfad9=function(_0x394a18,_0x27dc77){_0x394a18=_0x394a18-0x0;var _0x58a49c=_0xad9f[_0x394a18];return _0x58a49c;};'use strict';var _=require(_0xfad9('0x0'));var util=require(_0xfad9('0x1'));var moment=require('moment');var BPromise=require(_0xfad9('0x2'));var rs=require(_0xfad9('0x3'));var fs=require('fs');var Redis=require(_0xfad9('0x4'));var db=require(_0xfad9('0x5'))['db'];var utils=require(_0xfad9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfad9('0x7'));var jayson=require(_0xfad9('0x8'));var client=jayson[_0xfad9('0x9')][_0xfad9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ef2ff,_0x444a74,_0x55784b){return new BPromise(function(_0x538415,_0x4d6e93){return client[_0xfad9('0xb')](_0x5ef2ff,_0x55784b)['then'](function(_0x46ba05){logger[_0xfad9('0xc')](_0xfad9('0xd'),_0x444a74,'request\x20sent');logger[_0xfad9('0xe')](_0xfad9('0xf'),_0x444a74,'request\x20sent',JSON[_0xfad9('0x10')](_0x46ba05));if(_0x46ba05[_0xfad9('0x11')]){if(_0x46ba05['error']['code']===0x1f4){logger[_0xfad9('0x11')](_0xfad9('0xd'),_0x444a74,_0x46ba05['error'][_0xfad9('0x12')]);return _0x4d6e93(_0x46ba05[_0xfad9('0x11')][_0xfad9('0x12')]);}logger[_0xfad9('0x11')](_0xfad9('0xd'),_0x444a74,_0x46ba05[_0xfad9('0x11')][_0xfad9('0x12')]);return _0x538415(_0x46ba05[_0xfad9('0x11')][_0xfad9('0x12')]);}else{logger[_0xfad9('0xc')](_0xfad9('0xd'),_0x444a74,_0xfad9('0x13'));_0x538415(_0x46ba05[_0xfad9('0x14')][_0xfad9('0x12')]);}})[_0xfad9('0x15')](function(_0x246804){logger['error'](_0xfad9('0xd'),_0x444a74,_0x246804);_0x4d6e93(_0x246804);});});}exports['GetMemberReport']=function(_0x4545fb){var _0x305386=this;return new Promise(function(_0x4b1f6a,_0x39b674){return db['MemberReport'][_0xfad9('0x16')]({'raw':_0x4545fb[_0xfad9('0x17')]?_0x4545fb[_0xfad9('0x17')][_0xfad9('0x18')]===undefined?!![]:![]:!![],'where':_0x4545fb['options']?_0x4545fb[_0xfad9('0x17')]['where']||null:null,'attributes':_0x4545fb[_0xfad9('0x17')]?_0x4545fb['options'][_0xfad9('0x19')]||null:null,'limit':_0x4545fb['options']?_0x4545fb[_0xfad9('0x17')][_0xfad9('0x1a')]||null:null,'include':_0x4545fb[_0xfad9('0x17')]?_0x4545fb[_0xfad9('0x17')][_0xfad9('0x1b')]?_[_0xfad9('0x1c')](_0x4545fb[_0xfad9('0x17')][_0xfad9('0x1b')],function(_0x41aa78){return{'model':db[_0x41aa78[_0xfad9('0x1d')]],'as':_0x41aa78['as'],'attributes':_0x41aa78[_0xfad9('0x19')],'include':_0x41aa78[_0xfad9('0x1b')]?_['map'](_0x41aa78['include'],function(_0x5e5b65){return{'model':db[_0x5e5b65[_0xfad9('0x1d')]],'as':_0x5e5b65['as'],'attributes':_0x5e5b65[_0xfad9('0x19')],'include':_0x5e5b65[_0xfad9('0x1b')]?_['map'](_0x5e5b65[_0xfad9('0x1b')],function(_0x36c274){return{'model':db[_0x36c274['model']],'as':_0x36c274['as'],'attributes':_0x36c274[_0xfad9('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfad9('0x1e')](function(_0x3d3446){logger['info'](_0xfad9('0x1f'),_0x4545fb);logger[_0xfad9('0xe')](_0xfad9('0x1f'),_0x4545fb,JSON[_0xfad9('0x10')](_0x3d3446));_0x4b1f6a(_0x3d3446);})['catch'](function(_0x43d4d8){logger[_0xfad9('0x11')]('GetMemberReport',_0x43d4d8[_0xfad9('0x12')],_0x4545fb);_0x39b674(_0x305386[_0xfad9('0x11')](0x1f4,_0x43d4d8[_0xfad9('0x12')]));});});};exports[_0xfad9('0x20')]=function(_0x5ddbd7){var _0x376542=this;return new Promise(function(_0xb4ad82,_0x5df5ae){return db[_0xfad9('0x21')][_0xfad9('0x22')](_0x5ddbd7[_0xfad9('0x23')],{'raw':_0x5ddbd7[_0xfad9('0x17')]?_0x5ddbd7[_0xfad9('0x17')][_0xfad9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5b7876){logger[_0xfad9('0xc')]('CreateMemberReport',_0x5ddbd7);logger[_0xfad9('0xe')](_0xfad9('0x20'),_0x5ddbd7,JSON['stringify'](_0x5b7876));_0xb4ad82(_0x5b7876);})[_0xfad9('0x15')](function(_0x2562e1){logger[_0xfad9('0x11')](_0xfad9('0x20'),_0x2562e1[_0xfad9('0x12')],_0x5ddbd7);_0x5df5ae(_0x376542[_0xfad9('0x11')](0x1f4,_0x2562e1[_0xfad9('0x12')]));});});};exports[_0xfad9('0x24')]=function(_0xd77d1){var _0x2f7e3c=this;return new Promise(function(_0x17c1c0,_0x4cadb4){return db[_0xfad9('0x21')][_0xfad9('0x25')](_0xd77d1[_0xfad9('0x23')],{'raw':_0xd77d1[_0xfad9('0x17')]?_0xd77d1['options'][_0xfad9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd77d1[_0xfad9('0x17')]?_0xd77d1[_0xfad9('0x17')]['where']||null:null,'attributes':_0xd77d1[_0xfad9('0x17')]?_0xd77d1['options']['attributes']||null:null,'limit':_0xd77d1['options']?_0xd77d1[_0xfad9('0x17')][_0xfad9('0x1a')]||null:null})[_0xfad9('0x1e')](function(_0x5cd79e){logger[_0xfad9('0xc')](_0xfad9('0x24'),_0xd77d1);logger[_0xfad9('0xe')](_0xfad9('0x24'),_0xd77d1,JSON['stringify'](_0x5cd79e));_0x17c1c0(_0x5cd79e);})[_0xfad9('0x15')](function(_0x75f08f){logger['error'](_0xfad9('0x24'),_0x75f08f['message'],_0xd77d1);_0x4cadb4(_0x2f7e3c[_0xfad9('0x11')](0x1f4,_0x75f08f[_0xfad9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index c0f339f..881c67c 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 _0x02ce=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x2c098a,_0xeab65c){var _0x2b2d0a=function(_0x176afb){while(--_0x176afb){_0x2c098a['push'](_0x2c098a['shift']());}};_0x2b2d0a(++_0xeab65c);}(_0x02ce,0x1ac));var _0xe02c=function(_0x478027,_0x2893f1){_0x478027=_0x478027-0x0;var _0x3f91a2=_0x02ce[_0x478027];return _0x3f91a2;};'use strict';var multer=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var path=require(_0xe02c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe02c('0x3'));var router=express['Router']();var auth=require(_0xe02c('0x4'));var interaction=require(_0xe02c('0x5'));var config=require(_0xe02c('0x6'));var controller=require(_0xe02c('0x7'));router[_0xe02c('0x8')]('/',controller[_0xe02c('0x9')]);module[_0xe02c('0xa')]=router; \ No newline at end of file +var _0x3c81=['index','exports','multer','util','connect-timeout','express','./migration.controller','get'];(function(_0xb34b55,_0x3c576a){var _0x48ef0e=function(_0x4fd5b5){while(--_0x4fd5b5){_0xb34b55['push'](_0xb34b55['shift']());}};_0x48ef0e(++_0x3c576a);}(_0x3c81,0x102));var _0x13c8=function(_0xa58432,_0x2e266e){_0xa58432=_0xa58432-0x0;var _0xeb10eb=_0x3c81[_0xa58432];return _0xeb10eb;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('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(_0x13c8('0x4'));router[_0x13c8('0x5')]('/',controller[_0x13c8('0x6')]);module[_0x13c8('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 5df53db..a3bc617 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 _0x94ff=['STRING','version','sequelize','exports'];(function(_0x4ba010,_0x5d3553){var _0xfcdb23=function(_0x3fd8f6){while(--_0x3fd8f6){_0x4ba010['push'](_0x4ba010['shift']());}};_0xfcdb23(++_0x5d3553);}(_0x94ff,0x86));var _0xf94f=function(_0xcbdce8,_0x241844){_0xcbdce8=_0xcbdce8-0x0;var _0x3f9817=_0x94ff[_0xcbdce8];return _0x3f9817;};'use strict';var Sequelize=require(_0xf94f('0x0'));module[_0xf94f('0x1')]={'version':{'type':Sequelize[_0xf94f('0x2')],'unique':_0xf94f('0x3')}}; \ No newline at end of file +var _0x1956=['STRING','version','sequelize','exports'];(function(_0x5e7b6c,_0x4916d0){var _0x3afdbd=function(_0x648ee6){while(--_0x648ee6){_0x5e7b6c['push'](_0x5e7b6c['shift']());}};_0x3afdbd(++_0x4916d0);}(_0x1956,0xae));var _0x6195=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0x1956[_0x152121];return _0x592a85;};'use strict';var Sequelize=require(_0x6195('0x0'));module[_0x6195('0x1')]={'version':{'type':Sequelize[_0x6195('0x2')],'unique':_0x6195('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 4fd6ac0..ee9310e 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','Migration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce'];(function(_0x3ecf95,_0x559a2c){var _0x3f1e72=function(_0x4160c0){while(--_0x4160c0){_0x3ecf95['push'](_0x3ecf95['shift']());}};_0x3f1e72(++_0x559a2c);}(_0x70e0,0x17b));var _0x070e=function(_0x993c5d,_0x135cf5){_0x993c5d=_0x993c5d-0x0;var _0x49760f=_0x70e0[_0x993c5d];return _0x49760f;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));}; \ No newline at end of file +var _0x008c=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','name','send','index','map','Migration','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','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'];(function(_0x2ca171,_0x5e45e8){var _0x1d5d28=function(_0x2525d8){while(--_0x2525d8){_0x2ca171['push'](_0x2ca171['shift']());}};_0x1d5d28(++_0x5e45e8);}(_0x008c,0x188));var _0xc008=function(_0x4a5fa5,_0x51dadc){_0x4a5fa5=_0x4a5fa5-0x0;var _0x241266=_0x008c[_0x4a5fa5];return _0x241266;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(!_0x58a6ea){_0x459fd9[_0xc008('0x17')](0x194);}return _0x58a6ea;};}function handleError(_0x36f358,_0x2e3cfb){_0x2e3cfb=_0x2e3cfb||0x1f4;return function(_0x3cb28c){logger['error'](_0x3cb28c['stack']);if(_0x3cb28c['name']){delete _0x3cb28c[_0xc008('0x1f')];}_0x36f358[_0xc008('0x18')](_0x2e3cfb)[_0xc008('0x20')](_0x3cb28c);};}exports[_0xc008('0x21')]=function(_0x5bebd9,_0x5e2aca){var _0x4fce9c={},_0x4adbab={},_0x4caaf4={'count':0x0,'rows':[]};var _0x3865c0=_[_0xc008('0x22')](db[_0xc008('0x23')]['rawAttributes'],function(_0x24c14c){return{'name':_0x24c14c[_0xc008('0x24')],'type':_0x24c14c[_0xc008('0x25')][_0xc008('0x26')]};});_0x4adbab['model']=_[_0xc008('0x22')](_0x3865c0,_0xc008('0x1f'));_0x4adbab['query']=_['keys'](_0x5bebd9['query']);_0x4adbab[_0xc008('0x27')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],_0x4adbab[_0xc008('0x2a')]);_0x4fce9c[_0xc008('0x2b')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2c')]));_0x4fce9c[_0xc008('0x2b')]=_0x4fce9c[_0xc008('0x2b')]['length']?_0x4fce9c[_0xc008('0x2b')]:_0x4adbab[_0xc008('0x29')];if(!_0x5bebd9['query'][_0xc008('0x2d')](_0xc008('0x2e'))){_0x4fce9c[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2f')]);_0x4fce9c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x5bebd9[_0xc008('0x2a')]['offset']);}_0x4fce9c[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x31')]);_0x4fce9c[_0xc008('0x32')]=qs[_0xc008('0x27')](_[_0xc008('0x33')](_0x5bebd9['query'],_0x4adbab[_0xc008('0x27')]),_0x3865c0);if(_0x5bebd9[_0xc008('0x2a')]['filter']){_0x4fce9c[_0xc008('0x32')]=_[_0xc008('0x34')](_0x4fce9c['where'],{'$or':_[_0xc008('0x22')](_0x3865c0,function(_0x2e4ae1){if(_0x2e4ae1[_0xc008('0x25')]!=='VIRTUAL'){var _0x53b353={};_0x53b353[_0x2e4ae1['name']]={'$like':'%'+_0x5bebd9[_0xc008('0x2a')]['filter']+'%'};return _0x53b353;}})});}_0x4fce9c=_[_0xc008('0x34')]({},_0x4fce9c,_0x5bebd9[_0xc008('0x35')]);var _0x6a4ccb={'where':_0x4fce9c[_0xc008('0x32')]};return db[_0xc008('0x23')][_0xc008('0x1a')](_0x6a4ccb)[_0xc008('0x1e')](function(_0x35b496){_0x4caaf4[_0xc008('0x1a')]=_0x35b496;if(_0x5bebd9[_0xc008('0x2a')][_0xc008('0x36')]){_0x4fce9c[_0xc008('0x37')]=[{'all':!![]}];}return db[_0xc008('0x23')][_0xc008('0x38')](_0x4fce9c);})['then'](function(_0x3238b4){_0x4caaf4[_0xc008('0x39')]=_0x3238b4;return _0x4caaf4;})[_0xc008('0x1e')](respondWithFilteredResult(_0x5e2aca,_0x4fce9c))[_0xc008('0x3a')](handleError(_0x5e2aca,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 34ac5e4..8430e30 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 _0x12c9=['lodash','../../config/logger','api','moment','path','rimraf','./migration.attributes','exports','define','Migration'];(function(_0x3062cb,_0x44ca12){var _0xf29731=function(_0x11fc4b){while(--_0x11fc4b){_0x3062cb['push'](_0x3062cb['shift']());}};_0xf29731(++_0x44ca12);}(_0x12c9,0x10e));var _0x912c=function(_0x19589a,_0x3e3425){_0x19589a=_0x19589a-0x0;var _0x2dd263=_0x12c9[_0x19589a];return _0x2dd263;};'use strict';var _=require(_0x912c('0x0'));var util=require('util');var logger=require(_0x912c('0x1'))(_0x912c('0x2'));var moment=require(_0x912c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x912c('0x4'));var rimraf=require(_0x912c('0x5'));var config=require('../../config/environment');var attributes=require(_0x912c('0x6'));module[_0x912c('0x7')]=function(_0x51a277,_0x3c595c){return _0x51a277[_0x912c('0x8')](_0x912c('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4db=['define','Migration','migrations','api','moment','bluebird','request-promise','path','rimraf','./migration.attributes'];(function(_0x20b6d2,_0x541df9){var _0x3e35ca=function(_0x47fa83){while(--_0x47fa83){_0x20b6d2['push'](_0x20b6d2['shift']());}};_0x3e35ca(++_0x541df9);}(_0xa4db,0x139));var _0xba4d=function(_0x41fe21,_0xb18e78){_0x41fe21=_0x41fe21-0x0;var _0x5de22d=_0xa4db[_0x41fe21];return _0x5de22d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xba4d('0x0'));var moment=require(_0xba4d('0x1'));var BPromise=require(_0xba4d('0x2'));var rp=require(_0xba4d('0x3'));var fs=require('fs');var path=require(_0xba4d('0x4'));var rimraf=require(_0xba4d('0x5'));var config=require('../../config/environment');var attributes=require(_0xba4d('0x6'));module['exports']=function(_0x1c798c,_0x1b1d52){return _0x1c798c[_0xba4d('0x7')](_0xba4d('0x8'),attributes,{'tableName':_0xba4d('0x9'),'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 6ac2d39..2a8f307 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 _0xbb27=['../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5f44c5,_0x17ca95){var _0x2b3397=function(_0x66f36e){while(--_0x66f36e){_0x5f44c5['push'](_0x5f44c5['shift']());}};_0x2b3397(++_0x17ca95);}(_0xbb27,0xf6));var _0x7bb2=function(_0x3782f1,_0xdb9da7){_0x3782f1=_0x3782f1-0x0;var _0x59aa2c=_0xbb27[_0x3782f1];return _0x59aa2c;};'use strict';var _=require(_0x7bb2('0x0'));var util=require(_0x7bb2('0x1'));var moment=require('moment');var BPromise=require(_0x7bb2('0x2'));var rs=require(_0x7bb2('0x3'));var fs=require('fs');var Redis=require(_0x7bb2('0x4'));var db=require(_0x7bb2('0x5'))['db'];var utils=require(_0x7bb2('0x6'));var logger=require(_0x7bb2('0x7'))(_0x7bb2('0x8'));var config=require('../../config/environment');var jayson=require(_0x7bb2('0x9'));var client=jayson['client'][_0x7bb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48c160,_0x189da4,_0x3a0f2d){return new BPromise(function(_0x41e24d,_0x37d401){return client['request'](_0x48c160,_0x3a0f2d)[_0x7bb2('0xb')](function(_0xa3887e){logger[_0x7bb2('0xc')](_0x7bb2('0xd'),_0x189da4,'request\x20sent');logger[_0x7bb2('0xe')](_0x7bb2('0xf'),_0x189da4,'request\x20sent',JSON[_0x7bb2('0x10')](_0xa3887e));if(_0xa3887e[_0x7bb2('0x11')]){if(_0xa3887e['error']['code']===0x1f4){logger[_0x7bb2('0x11')]('Migration,\x20%s,\x20%s',_0x189da4,_0xa3887e[_0x7bb2('0x11')][_0x7bb2('0x12')]);return _0x37d401(_0xa3887e[_0x7bb2('0x11')][_0x7bb2('0x12')]);}logger[_0x7bb2('0x11')]('Migration,\x20%s,\x20%s',_0x189da4,_0xa3887e[_0x7bb2('0x11')][_0x7bb2('0x12')]);return _0x41e24d(_0xa3887e[_0x7bb2('0x11')][_0x7bb2('0x12')]);}else{logger[_0x7bb2('0xc')]('Migration,\x20%s,\x20%s',_0x189da4,_0x7bb2('0x13'));_0x41e24d(_0xa3887e['result'][_0x7bb2('0x12')]);}})[_0x7bb2('0x14')](function(_0x1caa6a){logger[_0x7bb2('0x11')](_0x7bb2('0xd'),_0x189da4,_0x1caa6a);_0x37d401(_0x1caa6a);});});} \ No newline at end of file +var _0x72e7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0xd4dc46,_0x1f2867){var _0x316a4d=function(_0xdfd722){while(--_0xdfd722){_0xd4dc46['push'](_0xd4dc46['shift']());}};_0x316a4d(++_0x1f2867);}(_0x72e7,0x102));var _0x772e=function(_0x5da475,_0x29b99e){_0x5da475=_0x5da475-0x0;var _0x4257b3=_0x72e7[_0x5da475];return _0x4257b3;};'use strict';var _=require(_0x772e('0x0'));var util=require(_0x772e('0x1'));var moment=require(_0x772e('0x2'));var BPromise=require(_0x772e('0x3'));var rs=require(_0x772e('0x4'));var fs=require('fs');var Redis=require(_0x772e('0x5'));var db=require(_0x772e('0x6'))['db'];var utils=require(_0x772e('0x7'));var logger=require(_0x772e('0x8'))(_0x772e('0x9'));var config=require(_0x772e('0xa'));var jayson=require(_0x772e('0xb'));var client=jayson[_0x772e('0xc')][_0x772e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x164602,_0x3defeb,_0x53e18e){return new BPromise(function(_0x427a24,_0x366b1d){return client[_0x772e('0xe')](_0x164602,_0x53e18e)[_0x772e('0xf')](function(_0x1c2c38){logger['info'](_0x772e('0x10'),_0x3defeb,_0x772e('0x11'));logger['debug'](_0x772e('0x12'),_0x3defeb,_0x772e('0x11'),JSON[_0x772e('0x13')](_0x1c2c38));if(_0x1c2c38[_0x772e('0x14')]){if(_0x1c2c38[_0x772e('0x14')][_0x772e('0x15')]===0x1f4){logger[_0x772e('0x14')](_0x772e('0x10'),_0x3defeb,_0x1c2c38[_0x772e('0x14')][_0x772e('0x16')]);return _0x366b1d(_0x1c2c38[_0x772e('0x14')]['message']);}logger[_0x772e('0x14')](_0x772e('0x10'),_0x3defeb,_0x1c2c38['error'][_0x772e('0x16')]);return _0x427a24(_0x1c2c38[_0x772e('0x14')]['message']);}else{logger[_0x772e('0x17')](_0x772e('0x10'),_0x3defeb,_0x772e('0x11'));_0x427a24(_0x1c2c38[_0x772e('0x18')][_0x772e('0x16')]);}})[_0x772e('0x19')](function(_0x2db24c){logger[_0x772e('0x14')](_0x772e('0x10'),_0x3defeb,_0x2db24c);_0x366b1d(_0x2db24c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index b2b34db..0cfcdcd 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 _0xdfc5=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x43d0a0,_0x2ffc23){var _0x369f2f=function(_0x1b2c87){while(--_0x1b2c87){_0x43d0a0['push'](_0x43d0a0['shift']());}};_0x369f2f(++_0x2ffc23);}(_0xdfc5,0x13d));var _0x5dfc=function(_0x4d89e2,_0xcfaa82){_0x4d89e2=_0x4d89e2-0x0;var _0x440ac1=_0xdfc5[_0x4d89e2];return _0x440ac1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5dfc('0x0'));var express=require(_0x5dfc('0x1'));var router=express[_0x5dfc('0x2')]();var auth=require(_0x5dfc('0x3'));var interaction=require(_0x5dfc('0x4'));var config=require(_0x5dfc('0x5'));var controller=require(_0x5dfc('0x6'));router[_0x5dfc('0x7')]('/',auth[_0x5dfc('0x8')](),controller[_0x5dfc('0x9')]);router[_0x5dfc('0x7')](_0x5dfc('0xa'),auth[_0x5dfc('0x8')](),controller[_0x5dfc('0xb')]);router['post']('/',auth[_0x5dfc('0x8')](),controller[_0x5dfc('0xc')]);router[_0x5dfc('0xd')](_0x5dfc('0xa'),auth['isAuthenticated'](),controller[_0x5dfc('0xe')]);router[_0x5dfc('0xf')]('/:id',auth[_0x5dfc('0x8')](),controller[_0x5dfc('0x10')]);module[_0x5dfc('0x11')]=router; \ No newline at end of file +var _0xa5d5=['isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get'];(function(_0x2f92d8,_0x2ef7f4){var _0x200ef1=function(_0x24f52e){while(--_0x24f52e){_0x2f92d8['push'](_0x2f92d8['shift']());}};_0x200ef1(++_0x2ef7f4);}(_0xa5d5,0x100));var _0x5a5d=function(_0x5ea1b7,_0x4c935c){_0x5ea1b7=_0x5ea1b7-0x0;var _0x2f9b54=_0xa5d5[_0x5ea1b7];return _0x2f9b54;};'use strict';var multer=require(_0x5a5d('0x0'));var util=require(_0x5a5d('0x1'));var path=require(_0x5a5d('0x2'));var timeout=require(_0x5a5d('0x3'));var express=require('express');var router=express[_0x5a5d('0x4')]();var auth=require(_0x5a5d('0x5'));var interaction=require(_0x5a5d('0x6'));var config=require(_0x5a5d('0x7'));var controller=require(_0x5a5d('0x8'));router[_0x5a5d('0x9')]('/',auth[_0x5a5d('0xa')](),controller[_0x5a5d('0xb')]);router['get'](_0x5a5d('0xc'),auth[_0x5a5d('0xa')](),controller['show']);router[_0x5a5d('0xd')]('/',auth[_0x5a5d('0xa')](),controller[_0x5a5d('0xe')]);router['put'](_0x5a5d('0xc'),auth[_0x5a5d('0xa')](),controller[_0x5a5d('0xf')]);router[_0x5a5d('0x10')](_0x5a5d('0xc'),auth[_0x5a5d('0xa')](),controller[_0x5a5d('0x11')]);module[_0x5a5d('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6071072..fe03025 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(_0x22bbcc,_0x26593e){var _0x56cc53=function(_0x4c5976){while(--_0x4c5976){_0x22bbcc['push'](_0x22bbcc['shift']());}};_0x56cc53(++_0x26593e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x32a9e2,_0x520e67){var _0xc8f45a=function(_0x527463){while(--_0x527463){_0x32a9e2['push'](_0x32a9e2['shift']());}};_0xc8f45a(++_0x520e67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 c6100b3..b0871c5 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 _0x2d81=['message','catch','end','status','json','count','offset','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','sequelize','transaction','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','update','/etc/asterisk/turn_xcally.conf','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','http','ValidationError','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x513356,_0x490e68){var _0xced1fd=function(_0x2b125f){while(--_0x2b125f){_0x513356['push'](_0x513356['shift']());}};_0xced1fd(++_0x490e68);}(_0x2d81,0x11c));var _0x12d8=function(_0x4d2698,_0x3a5517){_0x4d2698=_0x4d2698-0x0;var _0x1e6b1f=_0x2d81[_0x4d2698];return _0x1e6b1f;};'use strict';var pdf=require(_0x12d8('0x0'));var emlformat=require(_0x12d8('0x1'));var rimraf=require(_0x12d8('0x2'));var zipdir=require(_0x12d8('0x3'));var jsonpatch=require(_0x12d8('0x4'));var rp=require(_0x12d8('0x5'));var moment=require('moment');var BPromise=require(_0x12d8('0x6'));var Mustache=require(_0x12d8('0x7'));var util=require(_0x12d8('0x8'));var path=require(_0x12d8('0x9'));var sox=require(_0x12d8('0xa'));var csv=require(_0x12d8('0xb'));var ejs=require(_0x12d8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x12d8('0xd'));var crypto=require(_0x12d8('0xe'));var jsforce=require(_0x12d8('0xf'));var deskjs=require(_0x12d8('0x10'));var toCsv=require(_0x12d8('0xb'));var querystring=require(_0x12d8('0x11'));var Papa=require(_0x12d8('0x12'));var Redis=require(_0x12d8('0x13'));var authService=require(_0x12d8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12d8('0x15'));var logger=require(_0x12d8('0x16'))('api');var utils=require(_0x12d8('0x17'));var config=require('../../config/environment');var db=require(_0x12d8('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x12d8('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1061d9,_0x1662c0,_0x175c7e){if(_0x175c7e){var _0x5e5841=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e5841['test'](_0x1662c0)){return _0x1061d9;}else{throw new db['Sequelize'][(_0x12d8('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 _0x1061d9;}}function respondWithRpcPromise(_0x22a4b8,_0x46f537,_0x369d92,_0x1b867a){return new BPromise(function(_0x2d835b,_0x58d4d3){var _0x55e1d6=_0x1b867a||client;return _0x55e1d6[_0x12d8('0x1b')](_0x22a4b8,_0x369d92)['then'](function(_0xb2ae46){logger[_0x12d8('0x1c')](_0x12d8('0x1d'),_0x46f537,_0x12d8('0x1e'));logger['debug'](_0x12d8('0x1f'),_0x46f537,_0x12d8('0x1e'),JSON['stringify'](_0xb2ae46));if(_0xb2ae46[_0x12d8('0x20')]){if(_0xb2ae46[_0x12d8('0x20')][_0x12d8('0x21')]===0x1f4){logger[_0x12d8('0x20')]('Network,\x20%s,\x20%s',_0x46f537,_0xb2ae46[_0x12d8('0x20')][_0x12d8('0x22')]);return _0x58d4d3(_0xb2ae46[_0x12d8('0x20')]['message']);}logger[_0x12d8('0x20')](_0x12d8('0x1d'),_0x46f537,_0xb2ae46[_0x12d8('0x20')][_0x12d8('0x22')]);return _0x2d835b(_0xb2ae46[_0x12d8('0x20')][_0x12d8('0x22')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x46f537,_0x12d8('0x1e'));_0x2d835b(_0xb2ae46['result'][_0x12d8('0x22')]);}})[_0x12d8('0x23')](function(_0x1959d4){logger[_0x12d8('0x20')]('Network,\x20%s,\x20%s',_0x46f537,_0x1959d4);_0x58d4d3(_0x1959d4);});});}function respondWithStatusCode(_0x3d406e,_0x30bd96){_0x30bd96=_0x30bd96||0xcc;return function(_0x5c46c6){if(_0x5c46c6){return _0x3d406e['sendStatus'](_0x30bd96);}return _0x3d406e['status'](_0x30bd96)[_0x12d8('0x24')]();};}function respondWithResult(_0x159f22,_0x26c39e){_0x26c39e=_0x26c39e||0xc8;return function(_0x561a62){if(_0x561a62){return _0x159f22[_0x12d8('0x25')](_0x26c39e)[_0x12d8('0x26')](_0x561a62);}};}function respondWithFilteredResult(_0x3e36e4,_0x150720){return function(_0x2654f2){if(_0x2654f2){var _0x282a87=_0x2654f2[_0x12d8('0x27')],_0x1a4fb5=_0x150720['offset'],_0x23b3a3=_0x150720[_0x12d8('0x28')]+_0x150720['limit'],_0x34e9d3;if(_0x23b3a3>=_0x282a87){_0x23b3a3=_0x282a87;_0x34e9d3=0xc8;}else{_0x34e9d3=0xce;}_0x3e36e4[_0x12d8('0x25')](_0x34e9d3);return _0x3e36e4['set']('Content-Range',_0x1a4fb5+'-'+_0x23b3a3+'/'+_0x282a87)['json'](_0x2654f2);}return null;};}function patchUpdates(_0x3fcf03){return function(_0x3ffb1a){try{jsonpatch[_0x12d8('0x29')](_0x3ffb1a,_0x3fcf03,!![]);}catch(_0x4bb1bb){return BPromise[_0x12d8('0x2a')](_0x4bb1bb);}return _0x3ffb1a[_0x12d8('0x2b')]();};}function saveUpdates(_0x5b43ad,_0x30c2bb){return function(_0x22ebfe){if(_0x22ebfe){return _0x22ebfe['update'](_0x5b43ad)[_0x12d8('0x2c')](function(_0x5057da){return _0x5057da;});}return null;};}function removeEntity(_0x9f18a5,_0x9be095){return function(_0x38ad17){if(_0x38ad17){return _0x38ad17[_0x12d8('0x2d')]()[_0x12d8('0x2c')](function(){_0x9f18a5[_0x12d8('0x25')](0xcc)[_0x12d8('0x24')]();});}};}function handleEntityNotFound(_0x52a345,_0x35719d){return function(_0x2439b6){if(!_0x2439b6){_0x52a345[_0x12d8('0x2e')](0x194);}return _0x2439b6;};}function handleError(_0x71375e,_0x30b37b){_0x30b37b=_0x30b37b||0x1f4;return function(_0x333665){logger[_0x12d8('0x20')](_0x333665[_0x12d8('0x2f')]);if(_0x333665[_0x12d8('0x30')]){delete _0x333665['name'];}_0x71375e['status'](_0x30b37b)[_0x12d8('0x31')](_0x333665);};}exports[_0x12d8('0x32')]=function(_0x129b38,_0x3b7a6e){var _0x215b67={},_0x3856db={},_0x437677={'count':0x0,'rows':[]};var _0x3535cb=_['map'](db[_0x12d8('0x33')][_0x12d8('0x34')],function(_0x5925b7){return{'name':_0x5925b7[_0x12d8('0x35')],'type':_0x5925b7[_0x12d8('0x36')][_0x12d8('0x37')]};});_0x3856db[_0x12d8('0x38')]=_['map'](_0x3535cb,_0x12d8('0x30'));_0x3856db[_0x12d8('0x39')]=_[_0x12d8('0x3a')](_0x129b38[_0x12d8('0x39')]);_0x3856db[_0x12d8('0x3b')]=_[_0x12d8('0x3c')](_0x3856db[_0x12d8('0x38')],_0x3856db[_0x12d8('0x39')]);_0x215b67[_0x12d8('0x3d')]=_[_0x12d8('0x3c')](_0x3856db[_0x12d8('0x38')],qs['fields'](_0x129b38[_0x12d8('0x39')][_0x12d8('0x3e')]));_0x215b67[_0x12d8('0x3d')]=_0x215b67[_0x12d8('0x3d')][_0x12d8('0x3f')]?_0x215b67[_0x12d8('0x3d')]:_0x3856db[_0x12d8('0x38')];if(!_0x129b38['query'][_0x12d8('0x40')](_0x12d8('0x41'))){_0x215b67['limit']=qs[_0x12d8('0x42')](_0x129b38['query'][_0x12d8('0x42')]);_0x215b67['offset']=qs[_0x12d8('0x28')](_0x129b38[_0x12d8('0x39')][_0x12d8('0x28')]);}_0x215b67[_0x12d8('0x43')]=qs[_0x12d8('0x44')](_0x129b38[_0x12d8('0x39')]['sort']);_0x215b67[_0x12d8('0x45')]=qs[_0x12d8('0x3b')](_[_0x12d8('0x46')](_0x129b38[_0x12d8('0x39')],_0x3856db[_0x12d8('0x3b')]),_0x3535cb);if(_0x129b38['query'][_0x12d8('0x47')]){_0x215b67[_0x12d8('0x45')]=_[_0x12d8('0x48')](_0x215b67[_0x12d8('0x45')],{'$or':_['map'](_0x3535cb,function(_0x248822){if(_0x248822[_0x12d8('0x36')]!==_0x12d8('0x49')){var _0x4062f6={};_0x4062f6[_0x248822[_0x12d8('0x30')]]={'$like':'%'+_0x129b38[_0x12d8('0x39')][_0x12d8('0x47')]+'%'};return _0x4062f6;}})});}_0x215b67=_[_0x12d8('0x48')]({},_0x215b67,_0x129b38[_0x12d8('0x4a')]);var _0x2d1354={'where':_0x215b67[_0x12d8('0x45')]};return db[_0x12d8('0x33')]['count'](_0x2d1354)['then'](function(_0x597a18){_0x437677[_0x12d8('0x27')]=_0x597a18;if(_0x129b38[_0x12d8('0x39')][_0x12d8('0x4b')]){_0x215b67['include']=[{'all':!![]}];}return db[_0x12d8('0x33')][_0x12d8('0x4c')](_0x215b67);})[_0x12d8('0x2c')](function(_0x2459d4){_0x437677[_0x12d8('0x4d')]=_0x2459d4;return _0x437677;})['then'](respondWithFilteredResult(_0x3b7a6e,_0x215b67))[_0x12d8('0x23')](handleError(_0x3b7a6e,null));};exports[_0x12d8('0x4e')]=function(_0x52cd22,_0x2b8c45){var _0x595dce={'raw':!![],'where':{'id':_0x52cd22[_0x12d8('0x4f')]['id']}},_0x5e224d={};_0x5e224d[_0x12d8('0x38')]=_[_0x12d8('0x3a')](db[_0x12d8('0x33')][_0x12d8('0x34')]);_0x5e224d['query']=_['keys'](_0x52cd22[_0x12d8('0x39')]);_0x5e224d[_0x12d8('0x3b')]=_[_0x12d8('0x3c')](_0x5e224d[_0x12d8('0x38')],_0x5e224d[_0x12d8('0x39')]);_0x595dce[_0x12d8('0x3d')]=_[_0x12d8('0x3c')](_0x5e224d['model'],qs[_0x12d8('0x3e')](_0x52cd22['query']['fields']));_0x595dce[_0x12d8('0x3d')]=_0x595dce[_0x12d8('0x3d')][_0x12d8('0x3f')]?_0x595dce[_0x12d8('0x3d')]:_0x5e224d['model'];if(_0x52cd22[_0x12d8('0x39')][_0x12d8('0x4b')]){_0x595dce[_0x12d8('0x50')]=[{'all':!![]}];}_0x595dce=_[_0x12d8('0x48')]({},_0x595dce,_0x52cd22[_0x12d8('0x4a')]);return db[_0x12d8('0x33')][_0x12d8('0x51')](_0x595dce)[_0x12d8('0x2c')](handleEntityNotFound(_0x2b8c45,null))['then'](respondWithResult(_0x2b8c45,null))[_0x12d8('0x23')](handleError(_0x2b8c45,null));};exports[_0x12d8('0x52')]=function(_0x4a019d,_0x17eb06,_0x55c61d){var _0x3be7be;return db[_0x12d8('0x53')][_0x12d8('0x54')](function(_0x2e3bde){return db[_0x12d8('0x33')][_0x12d8('0x52')](_0x4a019d['body'],{'raw':!![]})['then'](function(_0xac7b){_0x3be7be=_0xac7b;return db[_0x12d8('0x33')][_0x12d8('0x4c')]({'where':{'type':_0x4a019d['body'][_0x12d8('0x36')]},'raw':!![]});})[_0x12d8('0x2c')](function(_0x1dfd6f){if(_0x3be7be['type'][_0x12d8('0x55')]()==_0x12d8('0x56')){var _0x2a374d=fs[_0x12d8('0x57')](path['join'](config[_0x12d8('0x58')],_0x12d8('0x59')),_0x12d8('0x5a'));var _0x148c8c=ejs[_0x12d8('0x5b')](_0x2a374d,{'networks':_0x1dfd6f||[]});fs[_0x12d8('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x148c8c);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x52'),{'module':_0x12d8('0x5e')});}else if(_0x3be7be['type'][_0x12d8('0x55')]()==_0x12d8('0x5f')){var _0x4a5102=fs['readFileSync'](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x61')),_0x12d8('0x5a'));var _0x41dc14=ejs[_0x12d8('0x5b')](_0x4a5102,{'networks':_0x1dfd6f||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x41dc14);return respondWithRpcPromise('Reload',_0x12d8('0x52'),{'module':_0x12d8('0x5e')});}else{var _0x28aa37=fs[_0x12d8('0x57')](path['join'](config[_0x12d8('0x58')],_0x12d8('0x62')),'utf8');var _0x2ba54f=ejs['render'](_0x28aa37,{'networks':_0x1dfd6f||[]});fs['writeFileSync'](util['format'](_0x12d8('0x63'),_0x4a019d[_0x12d8('0x64')][_0x12d8('0x36')][_0x12d8('0x65')]()),_0x2ba54f);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x52'),{'module':_0x12d8('0x66')});}return null;})[_0x12d8('0x2c')](function(){return _0x3be7be;});})['then'](respondWithResult(_0x17eb06,0xc9))[_0x12d8('0x23')](handleError(_0x17eb06,null));};exports[_0x12d8('0x67')]=function(_0xf369cd,_0x51cfd1,_0x567ddc){var _0x33bb4f;return db[_0x12d8('0x53')][_0x12d8('0x54')](function(_0x148e21){return db[_0x12d8('0x33')][_0x12d8('0x51')]({'where':{'id':_0xf369cd[_0x12d8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x51cfd1,null))[_0x12d8('0x2c')](saveUpdates(_0xf369cd[_0x12d8('0x64')],null))[_0x12d8('0x2c')](function(_0x85dc67){if(_0x85dc67){_0x33bb4f=_0x85dc67;return db['Network'][_0x12d8('0x4c')]({'where':{'type':_0x33bb4f[_0x12d8('0x36')]},'raw':!![]});}return null;})['then'](function(_0x497824){if(_0x33bb4f[_0x12d8('0x36')][_0x12d8('0x55')]()==_0x12d8('0x56')){var _0x4584fa=fs[_0x12d8('0x57')](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x59')),'utf8');var _0x13d17c=ejs['render'](_0x4584fa,{'networks':_0x497824||[]});fs[_0x12d8('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x13d17c);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x67'),{'module':_0x12d8('0x5e')});}else if(_0x33bb4f[_0x12d8('0x36')][_0x12d8('0x55')]()=='TURN'){var _0x317a31=fs['readFileSync'](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x61')),_0x12d8('0x5a'));var _0x41f9a3=ejs[_0x12d8('0x5b')](_0x317a31,{'networks':_0x497824||[]});fs[_0x12d8('0x5c')](_0x12d8('0x68'),_0x41f9a3);return respondWithRpcPromise('Reload',_0x12d8('0x67'),{'module':_0x12d8('0x5e')});}else{var _0x453bf8=fs['readFileSync'](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x62')),_0x12d8('0x5a'));var _0x1224db=ejs[_0x12d8('0x5b')](_0x453bf8,{'networks':_0x497824||[]});fs[_0x12d8('0x5c')](util[_0x12d8('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0xf369cd['body']['type'][_0x12d8('0x65')]()),_0x1224db);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x67'),{'module':_0x12d8('0x66')});}return null;})[_0x12d8('0x2c')](function(_0x320e0f){if(_0x320e0f){return _0x33bb4f;}return null;});})[_0x12d8('0x2c')](respondWithResult(_0x51cfd1,null))[_0x12d8('0x23')](handleError(_0x51cfd1,null));};exports[_0x12d8('0x2d')]=function(_0x2a472c,_0x4e09e0,_0x53f516){var _0x5ccb4e;return db[_0x12d8('0x33')][_0x12d8('0x51')]({'where':{'id':_0x2a472c['params']['id']}})[_0x12d8('0x2c')](function(_0xf9bb6e){_0x5ccb4e=_0xf9bb6e;return _0xf9bb6e;})[_0x12d8('0x2c')](handleEntityNotFound(_0x4e09e0,null))[_0x12d8('0x2c')](removeEntity(_0x4e09e0,null))[_0x12d8('0x2c')](function(){if(_0x5ccb4e){return db[_0x12d8('0x33')][_0x12d8('0x4c')]({'where':{'type':_0x5ccb4e[_0x12d8('0x36')]},'raw':!![]});}})['then'](function(_0x2255da){if(_0x5ccb4e['type']['toUpperCase']()=='STUN'){var _0x1912d6=fs['readFileSync'](path[_0x12d8('0x60')](config['root'],_0x12d8('0x59')),_0x12d8('0x5a'));var _0x43624d=ejs[_0x12d8('0x5b')](_0x1912d6,{'networks':_0x2255da||[]});fs[_0x12d8('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x43624d);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x2d'),{'module':'res_stun_monitor.so'});}else if(_0x5ccb4e[_0x12d8('0x36')][_0x12d8('0x55')]()==_0x12d8('0x5f')){var _0x3b1d55=fs[_0x12d8('0x57')](path[_0x12d8('0x60')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x12d8('0x5a'));var _0xef08de=ejs[_0x12d8('0x5b')](_0x3b1d55,{'networks':_0x2255da||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xef08de);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x2d'),{'module':_0x12d8('0x5e')});}else{var _0x1b79ce=fs[_0x12d8('0x57')](path[_0x12d8('0x60')](config[_0x12d8('0x58')],_0x12d8('0x62')),_0x12d8('0x5a'));var _0x3e91f6=ejs[_0x12d8('0x5b')](_0x1b79ce,{'networks':_0x2255da||[]});fs['writeFileSync'](util[_0x12d8('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0x2a472c[_0x12d8('0x64')][_0x12d8('0x36')][_0x12d8('0x65')]()),_0x3e91f6);return respondWithRpcPromise(_0x12d8('0x5d'),_0x12d8('0x2d'),{'module':_0x12d8('0x66')});}return null;})['catch'](handleError(_0x4e09e0,null));}; \ No newline at end of file +var _0xc200=['request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','length','include','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','TURN','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','destroy','server/files/templates/network.ejs','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','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','Network,\x20%s,\x20%s'];(function(_0x25b2f3,_0x5edc9b){var _0x59eb14=function(_0x491e10){while(--_0x491e10){_0x25b2f3['push'](_0x25b2f3['shift']());}};_0x59eb14(++_0x5edc9b);}(_0xc200,0x19e));var _0x0c20=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xc200[_0x1beef3];return _0x5af964;};'use strict';var pdf=require(_0x0c20('0x0'));var emlformat=require(_0x0c20('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0c20('0x2'));var jsonpatch=require(_0x0c20('0x3'));var rp=require(_0x0c20('0x4'));var moment=require(_0x0c20('0x5'));var BPromise=require(_0x0c20('0x6'));var Mustache=require(_0x0c20('0x7'));var util=require(_0x0c20('0x8'));var path=require('path');var sox=require(_0x0c20('0x9'));var csv=require('to-csv');var ejs=require(_0x0c20('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0c20('0xb'));var crypto=require(_0x0c20('0xc'));var jsforce=require(_0x0c20('0xd'));var deskjs=require(_0x0c20('0xe'));var toCsv=require(_0x0c20('0xf'));var querystring=require(_0x0c20('0x10'));var Papa=require(_0x0c20('0x11'));var Redis=require(_0x0c20('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0c20('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c20('0x14'))(_0x0c20('0x15'));var utils=require(_0x0c20('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x0c20('0x17'));var client=jayson[_0x0c20('0x18')][_0x0c20('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2c796e,_0x9bdcb2,_0x2a034c){if(_0x2a034c){var _0x2e7812=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e7812[_0x0c20('0x1a')](_0x9bdcb2)){return _0x2c796e;}else{throw new db[(_0x0c20('0x1b'))][(_0x0c20('0x1c'))](_0x0c20('0x1d'));}}else{return _0x2c796e;}}function respondWithRpcPromise(_0x13bc39,_0x1126c9,_0x4f507a,_0x5f2b1e){return new BPromise(function(_0x26e276,_0x484b72){var _0xfed14f=_0x5f2b1e||client;return _0xfed14f[_0x0c20('0x1e')](_0x13bc39,_0x4f507a)[_0x0c20('0x1f')](function(_0x37cb5f){logger[_0x0c20('0x20')](_0x0c20('0x21'),_0x1126c9,_0x0c20('0x22'));logger[_0x0c20('0x23')](_0x0c20('0x24'),_0x1126c9,_0x0c20('0x22'),JSON[_0x0c20('0x25')](_0x37cb5f));if(_0x37cb5f[_0x0c20('0x26')]){if(_0x37cb5f[_0x0c20('0x26')][_0x0c20('0x27')]===0x1f4){logger[_0x0c20('0x26')](_0x0c20('0x21'),_0x1126c9,_0x37cb5f[_0x0c20('0x26')]['message']);return _0x484b72(_0x37cb5f['error'][_0x0c20('0x28')]);}logger['error'](_0x0c20('0x21'),_0x1126c9,_0x37cb5f[_0x0c20('0x26')][_0x0c20('0x28')]);return _0x26e276(_0x37cb5f['error'][_0x0c20('0x28')]);}else{logger[_0x0c20('0x20')](_0x0c20('0x21'),_0x1126c9,_0x0c20('0x22'));_0x26e276(_0x37cb5f[_0x0c20('0x29')][_0x0c20('0x28')]);}})[_0x0c20('0x2a')](function(_0x1b2ecb){logger[_0x0c20('0x26')]('Network,\x20%s,\x20%s',_0x1126c9,_0x1b2ecb);_0x484b72(_0x1b2ecb);});});}function respondWithStatusCode(_0x33261a,_0x29f5c0){_0x29f5c0=_0x29f5c0||0xcc;return function(_0x3e1d9e){if(_0x3e1d9e){return _0x33261a[_0x0c20('0x2b')](_0x29f5c0);}return _0x33261a[_0x0c20('0x2c')](_0x29f5c0)[_0x0c20('0x2d')]();};}function respondWithResult(_0x50f057,_0x26656e){_0x26656e=_0x26656e||0xc8;return function(_0x35a427){if(_0x35a427){return _0x50f057['status'](_0x26656e)[_0x0c20('0x2e')](_0x35a427);}};}function respondWithFilteredResult(_0x5016f8,_0x9a5e96){return function(_0x454eae){if(_0x454eae){var _0x23b6a1=_0x454eae[_0x0c20('0x2f')],_0x30e6df=_0x9a5e96[_0x0c20('0x30')],_0x4e024f=_0x9a5e96[_0x0c20('0x30')]+_0x9a5e96[_0x0c20('0x31')],_0x5b3f51;if(_0x4e024f>=_0x23b6a1){_0x4e024f=_0x23b6a1;_0x5b3f51=0xc8;}else{_0x5b3f51=0xce;}_0x5016f8[_0x0c20('0x2c')](_0x5b3f51);return _0x5016f8[_0x0c20('0x32')](_0x0c20('0x33'),_0x30e6df+'-'+_0x4e024f+'/'+_0x23b6a1)[_0x0c20('0x2e')](_0x454eae);}return null;};}function patchUpdates(_0x2f416d){return function(_0x244083){try{jsonpatch[_0x0c20('0x34')](_0x244083,_0x2f416d,!![]);}catch(_0x15c980){return BPromise['reject'](_0x15c980);}return _0x244083[_0x0c20('0x35')]();};}function saveUpdates(_0x566720,_0x1ad8ee){return function(_0x4be59f){if(_0x4be59f){return _0x4be59f[_0x0c20('0x36')](_0x566720)['then'](function(_0x5dc6d2){return _0x5dc6d2;});}return null;};}function removeEntity(_0x2fddae,_0x468d61){return function(_0x316aaa){if(_0x316aaa){return _0x316aaa['destroy']()[_0x0c20('0x1f')](function(){_0x2fddae[_0x0c20('0x2c')](0xcc)[_0x0c20('0x2d')]();});}};}function handleEntityNotFound(_0x3935b4,_0x345f6a){return function(_0x10aaa1){if(!_0x10aaa1){_0x3935b4[_0x0c20('0x2b')](0x194);}return _0x10aaa1;};}function handleError(_0x4d923c,_0x33e2f3){_0x33e2f3=_0x33e2f3||0x1f4;return function(_0x5dd0f1){logger[_0x0c20('0x26')](_0x5dd0f1[_0x0c20('0x37')]);if(_0x5dd0f1['name']){delete _0x5dd0f1[_0x0c20('0x38')];}_0x4d923c['status'](_0x33e2f3)[_0x0c20('0x39')](_0x5dd0f1);};}exports[_0x0c20('0x3a')]=function(_0x451217,_0x457710){var _0x580b48={},_0x4963a0={},_0x1a323c={'count':0x0,'rows':[]};var _0x39bbd4=_[_0x0c20('0x3b')](db[_0x0c20('0x3c')][_0x0c20('0x3d')],function(_0x189a36){return{'name':_0x189a36[_0x0c20('0x3e')],'type':_0x189a36[_0x0c20('0x3f')][_0x0c20('0x40')]};});_0x4963a0['model']=_[_0x0c20('0x3b')](_0x39bbd4,_0x0c20('0x38'));_0x4963a0[_0x0c20('0x41')]=_['keys'](_0x451217[_0x0c20('0x41')]);_0x4963a0[_0x0c20('0x42')]=_['intersection'](_0x4963a0[_0x0c20('0x43')],_0x4963a0[_0x0c20('0x41')]);_0x580b48[_0x0c20('0x44')]=_[_0x0c20('0x45')](_0x4963a0[_0x0c20('0x43')],qs[_0x0c20('0x46')](_0x451217['query'][_0x0c20('0x46')]));_0x580b48[_0x0c20('0x44')]=_0x580b48[_0x0c20('0x44')]['length']?_0x580b48[_0x0c20('0x44')]:_0x4963a0[_0x0c20('0x43')];if(!_0x451217['query'][_0x0c20('0x47')](_0x0c20('0x48'))){_0x580b48['limit']=qs['limit'](_0x451217['query']['limit']);_0x580b48[_0x0c20('0x30')]=qs[_0x0c20('0x30')](_0x451217[_0x0c20('0x41')][_0x0c20('0x30')]);}_0x580b48['order']=qs[_0x0c20('0x49')](_0x451217[_0x0c20('0x41')][_0x0c20('0x49')]);_0x580b48[_0x0c20('0x4a')]=qs[_0x0c20('0x42')](_['pick'](_0x451217[_0x0c20('0x41')],_0x4963a0[_0x0c20('0x42')]),_0x39bbd4);if(_0x451217['query'][_0x0c20('0x4b')]){_0x580b48[_0x0c20('0x4a')]=_[_0x0c20('0x4c')](_0x580b48['where'],{'$or':_[_0x0c20('0x3b')](_0x39bbd4,function(_0x40f11c){if(_0x40f11c[_0x0c20('0x3f')]!==_0x0c20('0x4d')){var _0x54ad89={};_0x54ad89[_0x40f11c[_0x0c20('0x38')]]={'$like':'%'+_0x451217[_0x0c20('0x41')][_0x0c20('0x4b')]+'%'};return _0x54ad89;}})});}_0x580b48=_['merge']({},_0x580b48,_0x451217[_0x0c20('0x4e')]);var _0x776321={'where':_0x580b48[_0x0c20('0x4a')]};return db[_0x0c20('0x3c')][_0x0c20('0x2f')](_0x776321)[_0x0c20('0x1f')](function(_0x262e73){_0x1a323c['count']=_0x262e73;if(_0x451217['query'][_0x0c20('0x4f')]){_0x580b48['include']=[{'all':!![]}];}return db['Network'][_0x0c20('0x50')](_0x580b48);})[_0x0c20('0x1f')](function(_0x377fda){_0x1a323c['rows']=_0x377fda;return _0x1a323c;})[_0x0c20('0x1f')](respondWithFilteredResult(_0x457710,_0x580b48))[_0x0c20('0x2a')](handleError(_0x457710,null));};exports[_0x0c20('0x51')]=function(_0x19ab8c,_0x4dd77c){var _0x3f7570={'raw':!![],'where':{'id':_0x19ab8c[_0x0c20('0x52')]['id']}},_0xf54b9={};_0xf54b9['model']=_['keys'](db[_0x0c20('0x3c')]['rawAttributes']);_0xf54b9[_0x0c20('0x41')]=_[_0x0c20('0x53')](_0x19ab8c[_0x0c20('0x41')]);_0xf54b9[_0x0c20('0x42')]=_[_0x0c20('0x45')](_0xf54b9[_0x0c20('0x43')],_0xf54b9['query']);_0x3f7570[_0x0c20('0x44')]=_[_0x0c20('0x45')](_0xf54b9[_0x0c20('0x43')],qs[_0x0c20('0x46')](_0x19ab8c[_0x0c20('0x41')][_0x0c20('0x46')]));_0x3f7570[_0x0c20('0x44')]=_0x3f7570['attributes'][_0x0c20('0x54')]?_0x3f7570['attributes']:_0xf54b9[_0x0c20('0x43')];if(_0x19ab8c['query'][_0x0c20('0x4f')]){_0x3f7570[_0x0c20('0x55')]=[{'all':!![]}];}_0x3f7570=_['merge']({},_0x3f7570,_0x19ab8c[_0x0c20('0x4e')]);return db['Network'][_0x0c20('0x56')](_0x3f7570)[_0x0c20('0x1f')](handleEntityNotFound(_0x4dd77c,null))['then'](respondWithResult(_0x4dd77c,null))[_0x0c20('0x2a')](handleError(_0x4dd77c,null));};exports[_0x0c20('0x57')]=function(_0x34b843,_0x7895af,_0x161588){var _0x5c6a87;return db[_0x0c20('0x58')][_0x0c20('0x59')](function(_0x5555c0){return db['Network']['create'](_0x34b843[_0x0c20('0x5a')],{'raw':!![]})[_0x0c20('0x1f')](function(_0x7d189a){_0x5c6a87=_0x7d189a;return db[_0x0c20('0x3c')][_0x0c20('0x50')]({'where':{'type':_0x34b843['body'][_0x0c20('0x3f')]},'raw':!![]});})[_0x0c20('0x1f')](function(_0x40c880){if(_0x5c6a87[_0x0c20('0x3f')][_0x0c20('0x5b')]()==_0x0c20('0x5c')){var _0x2f0c2c=fs[_0x0c20('0x5d')](path[_0x0c20('0x5e')](config['root'],_0x0c20('0x5f')),_0x0c20('0x60'));var _0x500ecb=ejs[_0x0c20('0x61')](_0x2f0c2c,{'networks':_0x40c880||[]});fs['writeFileSync'](_0x0c20('0x62'),_0x500ecb);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x57'),{'module':_0x0c20('0x64')});}else if(_0x5c6a87['type']['toUpperCase']()=='TURN'){var _0x3a2a9e=fs[_0x0c20('0x5d')](path['join'](config[_0x0c20('0x65')],_0x0c20('0x66')),_0x0c20('0x60'));var _0xf0950b=ejs[_0x0c20('0x61')](_0x3a2a9e,{'networks':_0x40c880||[]});fs[_0x0c20('0x67')](_0x0c20('0x68'),_0xf0950b);return respondWithRpcPromise('Reload',_0x0c20('0x57'),{'module':_0x0c20('0x64')});}else{var _0x2aa52=fs['readFileSync'](path[_0x0c20('0x5e')](config['root'],'server/files/templates/network.ejs'),_0x0c20('0x60'));var _0x21c5fe=ejs[_0x0c20('0x61')](_0x2aa52,{'networks':_0x40c880||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x34b843['body'][_0x0c20('0x3f')]['toLowerCase']()),_0x21c5fe);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x57'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x5c6a87;});})[_0x0c20('0x1f')](respondWithResult(_0x7895af,0xc9))['catch'](handleError(_0x7895af,null));};exports[_0x0c20('0x36')]=function(_0x1a65bb,_0x303baa,_0x5d2c69){var _0x27db98;return db[_0x0c20('0x58')][_0x0c20('0x59')](function(_0x4d5b06){return db[_0x0c20('0x3c')][_0x0c20('0x56')]({'where':{'id':_0x1a65bb[_0x0c20('0x52')]['id']}})['then'](handleEntityNotFound(_0x303baa,null))[_0x0c20('0x1f')](saveUpdates(_0x1a65bb[_0x0c20('0x5a')],null))[_0x0c20('0x1f')](function(_0x22bc4b){if(_0x22bc4b){_0x27db98=_0x22bc4b;return db['Network'][_0x0c20('0x50')]({'where':{'type':_0x27db98[_0x0c20('0x3f')]},'raw':!![]});}return null;})[_0x0c20('0x1f')](function(_0x8e29b2){if(_0x27db98[_0x0c20('0x3f')]['toUpperCase']()=='STUN'){var _0xc1dbee=fs[_0x0c20('0x5d')](path['join'](config[_0x0c20('0x65')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x257050=ejs[_0x0c20('0x61')](_0xc1dbee,{'networks':_0x8e29b2||[]});fs[_0x0c20('0x67')](_0x0c20('0x62'),_0x257050);return respondWithRpcPromise('Reload','update',{'module':_0x0c20('0x64')});}else if(_0x27db98[_0x0c20('0x3f')][_0x0c20('0x5b')]()==_0x0c20('0x69')){var _0x238078=fs[_0x0c20('0x5d')](path[_0x0c20('0x5e')](config[_0x0c20('0x65')],_0x0c20('0x66')),_0x0c20('0x60'));var _0xcffb4d=ejs['render'](_0x238078,{'networks':_0x8e29b2||[]});fs[_0x0c20('0x67')](_0x0c20('0x68'),_0xcffb4d);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x36'),{'module':'res_stun_monitor.so'});}else{var _0x9b299c=fs[_0x0c20('0x5d')](path[_0x0c20('0x5e')](config['root'],'server/files/templates/network.ejs'),_0x0c20('0x60'));var _0x3c5998=ejs[_0x0c20('0x61')](_0x9b299c,{'networks':_0x8e29b2||[]});fs[_0x0c20('0x67')](util[_0x0c20('0x6a')](_0x0c20('0x6b'),_0x1a65bb[_0x0c20('0x5a')][_0x0c20('0x3f')][_0x0c20('0x6c')]()),_0x3c5998);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x36'),{'module':_0x0c20('0x6d')});}return null;})['then'](function(_0x52d7ad){if(_0x52d7ad){return _0x27db98;}return null;});})['then'](respondWithResult(_0x303baa,null))[_0x0c20('0x2a')](handleError(_0x303baa,null));};exports[_0x0c20('0x6e')]=function(_0x22c422,_0x316ff8,_0x484e9d){var _0x43a984;return db[_0x0c20('0x3c')][_0x0c20('0x56')]({'where':{'id':_0x22c422[_0x0c20('0x52')]['id']}})['then'](function(_0x4e31b4){_0x43a984=_0x4e31b4;return _0x4e31b4;})[_0x0c20('0x1f')](handleEntityNotFound(_0x316ff8,null))[_0x0c20('0x1f')](removeEntity(_0x316ff8,null))['then'](function(){if(_0x43a984){return db['Network'][_0x0c20('0x50')]({'where':{'type':_0x43a984['type']},'raw':!![]});}})[_0x0c20('0x1f')](function(_0x7d8b4a){if(_0x43a984[_0x0c20('0x3f')][_0x0c20('0x5b')]()=='STUN'){var _0xdd75cc=fs[_0x0c20('0x5d')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x549741=ejs['render'](_0xdd75cc,{'networks':_0x7d8b4a||[]});fs[_0x0c20('0x67')](_0x0c20('0x62'),_0x549741);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x6e'),{'module':_0x0c20('0x64')});}else if(_0x43a984[_0x0c20('0x3f')]['toUpperCase']()==_0x0c20('0x69')){var _0x5438ae=fs[_0x0c20('0x5d')](path[_0x0c20('0x5e')](config[_0x0c20('0x65')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3c59cd=ejs[_0x0c20('0x61')](_0x5438ae,{'networks':_0x7d8b4a||[]});fs[_0x0c20('0x67')](_0x0c20('0x68'),_0x3c59cd);return respondWithRpcPromise(_0x0c20('0x63'),_0x0c20('0x6e'),{'module':_0x0c20('0x64')});}else{var _0x28710b=fs['readFileSync'](path[_0x0c20('0x5e')](config[_0x0c20('0x65')],_0x0c20('0x6f')),_0x0c20('0x60'));var _0x2c01dd=ejs[_0x0c20('0x61')](_0x28710b,{'networks':_0x7d8b4a||[]});fs[_0x0c20('0x67')](util[_0x0c20('0x6a')](_0x0c20('0x6b'),_0x22c422[_0x0c20('0x5a')]['type'][_0x0c20('0x6c')]()),_0x2c01dd);return respondWithRpcPromise('Reload',_0x0c20('0x6e'),{'module':'chan_sip.so'});}return null;})[_0x0c20('0x2a')](handleError(_0x316ff8,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index c29efbd..9fdb21a 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 _0xd0bb=['Network','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x5534ea,_0x3dd8b1){var _0x4035d1=function(_0x339d87){while(--_0x339d87){_0x5534ea['push'](_0x5534ea['shift']());}};_0x4035d1(++_0x3dd8b1);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x33c562,_0x54f29c){_0x33c562=_0x33c562-0x0;var _0x4199e3=_0xd0bb[_0x33c562];return _0x4199e3;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./network.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Network','network','lodash'];(function(_0x4ba438,_0x5c5650){var _0x476ebe=function(_0x27587b){while(--_0x27587b){_0x4ba438['push'](_0x4ba438['shift']());}};_0x476ebe(++_0x5c5650);}(_0xdace,0xc5));var _0xedac=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xdace[_0x365e54];return _0x13317a;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./network.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index ed1566c..570e827 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 _0x11a7=['debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Network,\x20%s,\x20%s','request\x20sent'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x11a7,0x11b));var _0x711a=function(_0x32e264,_0x41cee8){_0x32e264=_0x32e264-0x0;var _0x1d7175=_0x11a7[_0x32e264];return _0x1d7175;};'use strict';var _=require(_0x711a('0x0'));var util=require(_0x711a('0x1'));var moment=require(_0x711a('0x2'));var BPromise=require(_0x711a('0x3'));var rs=require(_0x711a('0x4'));var fs=require('fs');var Redis=require(_0x711a('0x5'));var db=require(_0x711a('0x6'))['db'];var utils=require(_0x711a('0x7'));var logger=require(_0x711a('0x8'))(_0x711a('0x9'));var config=require('../../config/environment');var jayson=require(_0x711a('0xa'));var client=jayson['client'][_0x711a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x183eb3,_0x547889,_0xe5ec7f){return new BPromise(function(_0x31d7a0,_0x463355){return client['request'](_0x183eb3,_0xe5ec7f)[_0x711a('0xc')](function(_0x225c22){logger[_0x711a('0xd')](_0x711a('0xe'),_0x547889,_0x711a('0xf'));logger[_0x711a('0x10')](_0x711a('0x11'),_0x547889,_0x711a('0xf'),JSON[_0x711a('0x12')](_0x225c22));if(_0x225c22[_0x711a('0x13')]){if(_0x225c22['error']['code']===0x1f4){logger[_0x711a('0x13')](_0x711a('0xe'),_0x547889,_0x225c22[_0x711a('0x13')]['message']);return _0x463355(_0x225c22[_0x711a('0x13')][_0x711a('0x14')]);}logger[_0x711a('0x13')](_0x711a('0xe'),_0x547889,_0x225c22[_0x711a('0x13')][_0x711a('0x14')]);return _0x31d7a0(_0x225c22['error'][_0x711a('0x14')]);}else{logger[_0x711a('0xd')](_0x711a('0xe'),_0x547889,'request\x20sent');_0x31d7a0(_0x225c22[_0x711a('0x15')]['message']);}})[_0x711a('0x16')](function(_0x46f5f2){logger[_0x711a('0x13')](_0x711a('0xe'),_0x547889,_0x46f5f2);_0x463355(_0x46f5f2);});});} \ No newline at end of file +var _0x0640=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x1f2461,_0xefc187){var _0x38ad6a=function(_0x74eb9f){while(--_0x74eb9f){_0x1f2461['push'](_0x1f2461['shift']());}};_0x38ad6a(++_0xefc187);}(_0x0640,0x81));var _0x0064=function(_0x25b3b7,_0x50d5f1){_0x25b3b7=_0x25b3b7-0x0;var _0x31662e=_0x0640[_0x25b3b7];return _0x31662e;};'use strict';var _=require(_0x0064('0x0'));var util=require(_0x0064('0x1'));var moment=require(_0x0064('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0064('0x3'));var db=require(_0x0064('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0064('0x5'))(_0x0064('0x6'));var config=require(_0x0064('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0064('0x8')][_0x0064('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2190ed,_0x359ad1,_0x22b718){return new BPromise(function(_0x273159,_0x3b8d7a){return client[_0x0064('0xa')](_0x2190ed,_0x22b718)[_0x0064('0xb')](function(_0x2c96d8){logger[_0x0064('0xc')](_0x0064('0xd'),_0x359ad1,_0x0064('0xe'));logger[_0x0064('0xf')](_0x0064('0x10'),_0x359ad1,_0x0064('0xe'),JSON[_0x0064('0x11')](_0x2c96d8));if(_0x2c96d8['error']){if(_0x2c96d8[_0x0064('0x12')]['code']===0x1f4){logger['error'](_0x0064('0xd'),_0x359ad1,_0x2c96d8[_0x0064('0x12')][_0x0064('0x13')]);return _0x3b8d7a(_0x2c96d8['error'][_0x0064('0x13')]);}logger['error'](_0x0064('0xd'),_0x359ad1,_0x2c96d8['error'][_0x0064('0x13')]);return _0x273159(_0x2c96d8[_0x0064('0x12')][_0x0064('0x13')]);}else{logger[_0x0064('0xc')](_0x0064('0xd'),_0x359ad1,'request\x20sent');_0x273159(_0x2c96d8[_0x0064('0x14')][_0x0064('0x13')]);}})[_0x0064('0x15')](function(_0x247069){logger[_0x0064('0x12')](_0x0064('0xd'),_0x359ad1,_0x247069);_0x3b8d7a(_0x247069);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 09de59c..2697508 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 _0xc8d8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','exports','util','path'];(function(_0x2a51d0,_0x2dc9eb){var _0x1d2615=function(_0x518946){while(--_0x518946){_0x2a51d0['push'](_0x2a51d0['shift']());}};_0x1d2615(++_0x2dc9eb);}(_0xc8d8,0xee));var _0x8c8d=function(_0x122633,_0x22057b){_0x122633=_0x122633-0x0;var _0x2d02e5=_0xc8d8[_0x122633];return _0x2d02e5;};'use strict';var multer=require('multer');var util=require(_0x8c8d('0x0'));var path=require(_0x8c8d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c8d('0x2')]();var auth=require(_0x8c8d('0x3'));var interaction=require(_0x8c8d('0x4'));var config=require(_0x8c8d('0x5'));var controller=require(_0x8c8d('0x6'));router[_0x8c8d('0x7')]('/',auth[_0x8c8d('0x8')](),controller['sendNotification']);module[_0x8c8d('0x9')]=router; \ No newline at end of file +var _0x18d2=['../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x57d20a,_0x1cce7b){var _0x4dc9ef=function(_0x35652a){while(--_0x35652a){_0x57d20a['push'](_0x57d20a['shift']());}};_0x4dc9ef(++_0x1cce7b);}(_0x18d2,0xa3));var _0x218d=function(_0x3f239d,_0xcd5030){_0x3f239d=_0x3f239d-0x0;var _0x4215e9=_0x18d2[_0x3f239d];return _0x4215e9;};'use strict';var multer=require(_0x218d('0x0'));var util=require('util');var path=require(_0x218d('0x1'));var timeout=require(_0x218d('0x2'));var express=require(_0x218d('0x3'));var router=express['Router']();var auth=require(_0x218d('0x4'));var interaction=require(_0x218d('0x5'));var config=require(_0x218d('0x6'));var controller=require(_0x218d('0x7'));router[_0x218d('0x8')]('/',auth[_0x218d('0x9')](),controller[_0x218d('0xa')]);module[_0x218d('0xb')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 07f6c07..6e62137 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 _0x539e=['STRING','BOOLEAN','TEXT'];(function(_0x5e6ea3,_0x9addd2){var _0x4048b5=function(_0x9092e4){while(--_0x9092e4){_0x5e6ea3['push'](_0x5e6ea3['shift']());}};_0x4048b5(++_0x9addd2);}(_0x539e,0x12e));var _0xe539=function(_0x33aa60,_0x416998){_0x33aa60=_0x33aa60-0x0;var _0x5ef4c1=_0x539e[_0x33aa60];return _0x5ef4c1;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xe539('0x0')]},'senderName':{'type':Sequelize[_0xe539('0x1')]},'recipientsId':{'type':Sequelize[_0xe539('0x0')]},'recipientsDescription':{'type':Sequelize[_0xe539('0x1')]},'beep':{'type':Sequelize[_0xe539('0x2')]}}; \ No newline at end of file +var _0xae9f=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2141a9,_0x46da91){var _0x563d3c=function(_0x44aad0){while(--_0x44aad0){_0x2141a9['push'](_0x2141a9['shift']());}};_0x563d3c(++_0x46da91);}(_0xae9f,0x17c));var _0xfae9=function(_0x219813,_0x189806){_0x219813=_0x219813-0x0;var _0x8e1f78=_0xae9f[_0x219813];return _0x8e1f78;};'use strict';var Sequelize=require(_0xfae9('0x0'));module[_0xfae9('0x1')]={'body':{'type':Sequelize[_0xfae9('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xfae9('0x2')]},'recipientsDescription':{'type':Sequelize[_0xfae9('0x3')]},'beep':{'type':Sequelize[_0xfae9('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 454dafd..a0b6f51 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 _0xd66f=['send','sendNotification','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','team','user','some','senderName','recipientsDescription','isEmpty','beep','recipientsId','join','sequelize','transaction','Notification','create','recipient','notification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','toLowerCase','User','union','includes','queue','Queue','forEach','push','all','getAgents','map','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name'];(function(_0x3b02da,_0x2795f6){var _0x138cf9=function(_0x3786d0){while(--_0x3786d0){_0x3b02da['push'](_0x3b02da['shift']());}};_0x138cf9(++_0x2795f6);}(_0xd66f,0x95));var _0xfd66=function(_0x32959e,_0x95c759){_0x32959e=_0x32959e-0x0;var _0x379025=_0xd66f[_0x32959e];return _0x379025;};'use strict';var pdf=require(_0xfd66('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfd66('0x1'));var zipdir=require(_0xfd66('0x2'));var jsonpatch=require(_0xfd66('0x3'));var rp=require(_0xfd66('0x4'));var moment=require('moment');var BPromise=require(_0xfd66('0x5'));var Mustache=require(_0xfd66('0x6'));var util=require(_0xfd66('0x7'));var path=require('path');var sox=require(_0xfd66('0x8'));var csv=require(_0xfd66('0x9'));var ejs=require(_0xfd66('0xa'));var fs=require('fs');var _=require(_0xfd66('0xb'));var squel=require(_0xfd66('0xc'));var crypto=require('crypto');var jsforce=require(_0xfd66('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfd66('0xe'));var Papa=require(_0xfd66('0xf'));var Redis=require(_0xfd66('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfd66('0x11'));var hardwareService=require(_0xfd66('0x12'));var logger=require(_0xfd66('0x13'))(_0xfd66('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfd66('0x15'))['db'];config[_0xfd66('0x16')]=_[_0xfd66('0x17')](config[_0xfd66('0x16')],{'host':_0xfd66('0x18'),'port':0x18eb});var socket=require(_0xfd66('0x19'))(new Redis(config[_0xfd66('0x16')]));require('./notification.socket')[_0xfd66('0x1a')](socket);function respondWithStatusCode(_0x357a23,_0x550454){_0x550454=_0x550454||0xcc;return function(_0x3c7a95){if(_0x3c7a95){return _0x357a23['sendStatus'](_0x550454);}return _0x357a23[_0xfd66('0x1b')](_0x550454)[_0xfd66('0x1c')]();};}function respondWithResult(_0x39d49a,_0xbf4a39){_0xbf4a39=_0xbf4a39||0xc8;return function(_0x42b18c){if(_0x42b18c){return _0x39d49a[_0xfd66('0x1b')](_0xbf4a39)[_0xfd66('0x1d')](_0x42b18c);}};}function respondWithFilteredResult(_0x366995,_0x2592b6){return function(_0x3c4759){if(_0x3c4759){var _0x97d2fc=_0x3c4759['count'],_0x4ef24c=_0x2592b6[_0xfd66('0x1e')],_0x11448d=_0x2592b6[_0xfd66('0x1e')]+_0x2592b6['limit'],_0xdd1f39;if(_0x11448d>=_0x97d2fc){_0x11448d=_0x97d2fc;_0xdd1f39=0xc8;}else{_0xdd1f39=0xce;}_0x366995[_0xfd66('0x1b')](_0xdd1f39);return _0x366995['set'](_0xfd66('0x1f'),_0x4ef24c+'-'+_0x11448d+'/'+_0x97d2fc)[_0xfd66('0x1d')](_0x3c4759);}return null;};}function patchUpdates(_0x34e315){return function(_0x53f83a){try{jsonpatch[_0xfd66('0x20')](_0x53f83a,_0x34e315,!![]);}catch(_0x5307d0){return BPromise[_0xfd66('0x21')](_0x5307d0);}return _0x53f83a[_0xfd66('0x22')]();};}function saveUpdates(_0x2e8756,_0x2c11bd){return function(_0x3c7da1){if(_0x3c7da1){return _0x3c7da1[_0xfd66('0x23')](_0x2e8756)[_0xfd66('0x24')](function(_0x1cd706){return _0x1cd706;});}return null;};}function removeEntity(_0x1023ba,_0xc71d65){return function(_0x393ae3){if(_0x393ae3){return _0x393ae3['destroy']()[_0xfd66('0x24')](function(){_0x1023ba[_0xfd66('0x1b')](0xcc)[_0xfd66('0x1c')]();});}};}function handleEntityNotFound(_0x4d3249,_0x3a9eee){return function(_0x28bedd){if(!_0x28bedd){_0x4d3249[_0xfd66('0x25')](0x194);}return _0x28bedd;};}function handleError(_0x59c337,_0x5f17da){_0x5f17da=_0x5f17da||0x1f4;return function(_0x4b3dfd){logger[_0xfd66('0x26')](_0x4b3dfd[_0xfd66('0x27')]);if(_0x4b3dfd['name']){delete _0x4b3dfd[_0xfd66('0x28')];}_0x59c337[_0xfd66('0x1b')](_0x5f17da)[_0xfd66('0x29')](_0x4b3dfd);};}exports[_0xfd66('0x2a')]=function(_0x2cba09,_0x5337e4,_0x99779e){if(!_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x2c')]('text')&&!_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x2c')]('TemplateId')){throw new db[(_0xfd66('0x2d'))][(_0xfd66('0x2e'))](_0xfd66('0x2f'));}else{if(_0x2cba09[_0xfd66('0x2b')]['hasOwnProperty'](_0xfd66('0x30'))&&!_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x2c')](_0xfd66('0x31'))){throw new db[(_0xfd66('0x2d'))]['ValidationError'](_0xfd66('0x32'));}if(!_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x2c')](_0xfd66('0x33'))){throw new db['Sequelize'][(_0xfd66('0x2e'))](_0xfd66('0x34'));}else{try{var _0x8f9103=JSON[_0xfd66('0x35')](_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x33')]);}catch(_0x268d5f){logger[_0xfd66('0x26')](_0x268d5f);throw new db['Sequelize'][(_0xfd66('0x2e'))](_0xfd66('0x36'));}var _0x34dae3=[_0xfd66('0x37'),_0xfd66('0x38'),_0xfd66('0x39'),'openchannelqueue',_0xfd66('0x3a'),_0xfd66('0x3b'),'whatsappqueue',_0xfd66('0x3c'),_0xfd66('0x3d')];if(_[_0xfd66('0x3e')](_0x8f9103,function(_0xbf9ba0){return!_['includes'](_0x34dae3,_0xbf9ba0['model']['toLowerCase']());})){throw new db['Sequelize'][(_0xfd66('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3b74d8={};_0x3b74d8[_0xfd66('0x3f')]=_0x2cba09['body'][_0xfd66('0x2c')](_0xfd66('0x3f'))?_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x3f')]:_0x2cba09[_0xfd66('0x3d')]['fullname'];_0x3b74d8[_0xfd66('0x40')]=_[_0xfd66('0x41')](_0x2cba09['body'][_0xfd66('0x40')])?null:_0x2cba09[_0xfd66('0x2b')]['recipientsDescription'];_0x3b74d8['beep']=_0x2cba09[_0xfd66('0x2b')][_0xfd66('0x42')]||![];_0x3b74d8['SenderId']=_0x2cba09[_0xfd66('0x3d')]['id'];return getContent(_0x2cba09[_0xfd66('0x2b')])[_0xfd66('0x24')](function(_0x2b6ffe){_0x3b74d8[_0xfd66('0x2b')]=_0x2b6ffe;return getRecipients(_0x8f9103);})['then'](function(_0x38cdb6){_0x3b74d8[_0xfd66('0x43')]=_['sortBy'](_0x38cdb6)[_0xfd66('0x44')](',');return db[_0xfd66('0x45')][_0xfd66('0x46')](function(_0x929016){return db[_0xfd66('0x47')][_0xfd66('0x48')](_0x3b74d8,{'raw':!![],'transaction':_0x929016})[_0xfd66('0x24')](function(_0xa4a2ac){var _0x50132e={'sender':_0x3b74d8[_0xfd66('0x3f')],'description':_0x3b74d8[_0xfd66('0x40')],'content':_0x3b74d8[_0xfd66('0x2b')],'beep':_0x3b74d8[_0xfd66('0x42')]};_0x38cdb6['forEach'](function(_0x18c3c8){_0x50132e[_0xfd66('0x49')]=_0x18c3c8;socket['emit'](_0xfd66('0x4a'),_0x50132e);});return _0xa4a2ac;});});})[_0xfd66('0x24')](respondWithResult(_0x5337e4,0xc9))[_0xfd66('0x4b')](handleError(_0x5337e4,null));};function getContent(_0x31a9e7){return new BPromise(function(_0x408d51,_0x331f51){if(_0x31a9e7[_0xfd66('0x4c')]){_0x408d51(_0x31a9e7[_0xfd66('0x4c')]);return;}return db[_0xfd66('0x4d')][_0xfd66('0x4e')]({'attributes':[_0xfd66('0x4f')],'where':{'id':_0x31a9e7['TemplateId']},'raw':!![]})['then'](function(_0x41b6de){if(!_0x41b6de)throw new db['Sequelize'][(_0xfd66('0x2e'))](_0xfd66('0x50'));var _0x4bb541=Mustache[_0xfd66('0x51')](_0x41b6de[_0xfd66('0x4f')],_0x31a9e7[_0xfd66('0x31')]);_0x408d51(_0x4bb541);})[_0xfd66('0x4b')](function(_0xbcfee){_0x331f51(_0xbcfee);});});}function getRecipients(_0x209201){return new BPromise(function(_0x1a100f,_0x58ffc7){var _0x36a961=[];var _0x231739=[];_0x209201['forEach'](function(_0x32fa2d){var _0x1e1c58=_[_0xfd66('0x52')](_0x32fa2d[_0xfd66('0x53')][_0xfd66('0x54')]());if(_0x1e1c58===_0xfd66('0x55')){_0x36a961=_[_0xfd66('0x56')](_0x36a961,_0x32fa2d['ids']);}else{if(_[_0xfd66('0x57')](_0x1e1c58,_0xfd66('0x58')))_0x1e1c58=_0x1e1c58['replace'](_0xfd66('0x58'),_0xfd66('0x59'));_0x32fa2d['ids'][_0xfd66('0x5a')](function(_0x2ad148){_0x231739[_0xfd66('0x5b')](getAgents(_0x1e1c58,_0x2ad148));});}});return BPromise[_0xfd66('0x5c')](_0x231739)[_0xfd66('0x24')](function(_0x56b220){_0x36a961=_[_0xfd66('0x56')](_0x36a961,_['flatten'](_0x56b220));_0x1a100f(_0x36a961);})[_0xfd66('0x4b')](function(_0x18ced0){_0x58ffc7(_0x18ced0);});});}function getAgents(_0x3c7b10,_0x3e9f73){return new BPromise(function(_0x3a4320,_0xb53b67){return db[_0x3c7b10][_0xfd66('0x4e')]({'where':{'id':_0x3e9f73}})[_0xfd66('0x24')](function(_0x4ff198){return _0x4ff198[_0xfd66('0x5d')]({'attributes':['id'],'raw':!![]})[_0xfd66('0x24')](function(_0x2c4c79){var _0x435c3c=_[_0xfd66('0x5e')](_0x2c4c79,'id');_0x3a4320(_0x435c3c);});})[_0xfd66('0x4b')](function(_0x32f4f1){_0xb53b67(_0x32f4f1);});});} \ No newline at end of file +var _0xf7d2=['voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','replace','queue','Queue','ids','all','union','flatten','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','./notification.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','sendNotification','hasOwnProperty','body','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue'];(function(_0x44fb02,_0x16bdbc){var _0x4d3aaa=function(_0xa5ccfd){while(--_0xa5ccfd){_0x44fb02['push'](_0x44fb02['shift']());}};_0x4d3aaa(++_0x16bdbc);}(_0xf7d2,0x8b));var _0x2f7d=function(_0x73076a,_0x42571a){_0x73076a=_0x73076a-0x0;var _0x1d7abd=_0xf7d2[_0x73076a];return _0x1d7abd;};'use strict';var pdf=require(_0x2f7d('0x0'));var emlformat=require(_0x2f7d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f7d('0x2'));var rp=require(_0x2f7d('0x3'));var moment=require(_0x2f7d('0x4'));var BPromise=require(_0x2f7d('0x5'));var Mustache=require(_0x2f7d('0x6'));var util=require(_0x2f7d('0x7'));var path=require(_0x2f7d('0x8'));var sox=require(_0x2f7d('0x9'));var csv=require(_0x2f7d('0xa'));var ejs=require(_0x2f7d('0xb'));var fs=require('fs');var _=require(_0x2f7d('0xc'));var squel=require('squel');var crypto=require(_0x2f7d('0xd'));var jsforce=require(_0x2f7d('0xe'));var deskjs=require(_0x2f7d('0xf'));var toCsv=require(_0x2f7d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2f7d('0x10'));var authService=require(_0x2f7d('0x11'));var qs=require(_0x2f7d('0x12'));var as=require(_0x2f7d('0x13'));var hardwareService=require(_0x2f7d('0x14'));var logger=require('../../config/logger')(_0x2f7d('0x15'));var utils=require('../../config/utils');var config=require(_0x2f7d('0x16'));var db=require(_0x2f7d('0x17'))['db'];config[_0x2f7d('0x18')]=_[_0x2f7d('0x19')](config[_0x2f7d('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f7d('0x18')]));require(_0x2f7d('0x1a'))[_0x2f7d('0x1b')](socket);function respondWithStatusCode(_0x246236,_0x2ee732){_0x2ee732=_0x2ee732||0xcc;return function(_0x33aecc){if(_0x33aecc){return _0x246236[_0x2f7d('0x1c')](_0x2ee732);}return _0x246236[_0x2f7d('0x1d')](_0x2ee732)[_0x2f7d('0x1e')]();};}function respondWithResult(_0x2673a6,_0x43a63c){_0x43a63c=_0x43a63c||0xc8;return function(_0x14068a){if(_0x14068a){return _0x2673a6[_0x2f7d('0x1d')](_0x43a63c)[_0x2f7d('0x1f')](_0x14068a);}};}function respondWithFilteredResult(_0x17da85,_0x449372){return function(_0x4c6f1e){if(_0x4c6f1e){var _0x4e373b=_0x4c6f1e[_0x2f7d('0x20')],_0x1da46a=_0x449372[_0x2f7d('0x21')],_0x4dc1a1=_0x449372['offset']+_0x449372[_0x2f7d('0x22')],_0x162f57;if(_0x4dc1a1>=_0x4e373b){_0x4dc1a1=_0x4e373b;_0x162f57=0xc8;}else{_0x162f57=0xce;}_0x17da85[_0x2f7d('0x1d')](_0x162f57);return _0x17da85[_0x2f7d('0x23')]('Content-Range',_0x1da46a+'-'+_0x4dc1a1+'/'+_0x4e373b)[_0x2f7d('0x1f')](_0x4c6f1e);}return null;};}function patchUpdates(_0x5763c6){return function(_0x5be982){try{jsonpatch[_0x2f7d('0x24')](_0x5be982,_0x5763c6,!![]);}catch(_0x2a9a8b){return BPromise['reject'](_0x2a9a8b);}return _0x5be982[_0x2f7d('0x25')]();};}function saveUpdates(_0x598d5b,_0x1e90f3){return function(_0x41ad88){if(_0x41ad88){return _0x41ad88[_0x2f7d('0x26')](_0x598d5b)[_0x2f7d('0x27')](function(_0x19aaa5){return _0x19aaa5;});}return null;};}function removeEntity(_0x2d8268,_0x3a8ab6){return function(_0x457766){if(_0x457766){return _0x457766[_0x2f7d('0x28')]()[_0x2f7d('0x27')](function(){_0x2d8268[_0x2f7d('0x1d')](0xcc)[_0x2f7d('0x1e')]();});}};}function handleEntityNotFound(_0x1a9a90,_0x245753){return function(_0x432745){if(!_0x432745){_0x1a9a90[_0x2f7d('0x1c')](0x194);}return _0x432745;};}function handleError(_0x513397,_0x1be1c3){_0x1be1c3=_0x1be1c3||0x1f4;return function(_0x1e80b8){logger[_0x2f7d('0x29')](_0x1e80b8[_0x2f7d('0x2a')]);if(_0x1e80b8[_0x2f7d('0x2b')]){delete _0x1e80b8[_0x2f7d('0x2b')];}_0x513397[_0x2f7d('0x1d')](_0x1be1c3)['send'](_0x1e80b8);};}exports[_0x2f7d('0x2c')]=function(_0x57c87f,_0x3682f8,_0x22d421){if(!_0x57c87f['body'][_0x2f7d('0x2d')]('text')&&!_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x2d')](_0x2f7d('0x2f'))){throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x57c87f['body'][_0x2f7d('0x2d')](_0x2f7d('0x2f'))&&!_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x2d')](_0x2f7d('0x32'))){throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))](_0x2f7d('0x33'));}if(!_0x57c87f['body'][_0x2f7d('0x2d')](_0x2f7d('0x34'))){throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))](_0x2f7d('0x35'));}else{try{var _0x4deb51=JSON[_0x2f7d('0x36')](_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x34')]);}catch(_0x11c9d1){logger[_0x2f7d('0x29')](_0x11c9d1);throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))](_0x2f7d('0x37'));}var _0x3566a1=[_0x2f7d('0x38'),_0x2f7d('0x39'),_0x2f7d('0x3a'),_0x2f7d('0x3b'),_0x2f7d('0x3c'),_0x2f7d('0x3d'),_0x2f7d('0x3e'),_0x2f7d('0x3f'),_0x2f7d('0x40')];if(_[_0x2f7d('0x41')](_0x4deb51,function(_0x4a4221){return!_[_0x2f7d('0x42')](_0x3566a1,_0x4a4221['model'][_0x2f7d('0x43')]());})){throw new db['Sequelize'][(_0x2f7d('0x31'))](_0x2f7d('0x44'));}}}var _0x1db4c1={};_0x1db4c1[_0x2f7d('0x45')]=_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x2d')]('senderName')?_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x45')]:_0x57c87f[_0x2f7d('0x40')][_0x2f7d('0x46')];_0x1db4c1['recipientsDescription']=_[_0x2f7d('0x47')](_0x57c87f['body'][_0x2f7d('0x48')])?null:_0x57c87f[_0x2f7d('0x2e')][_0x2f7d('0x48')];_0x1db4c1[_0x2f7d('0x49')]=_0x57c87f['body'][_0x2f7d('0x49')]||![];_0x1db4c1[_0x2f7d('0x4a')]=_0x57c87f[_0x2f7d('0x40')]['id'];return getContent(_0x57c87f[_0x2f7d('0x2e')])[_0x2f7d('0x27')](function(_0x3545c3){_0x1db4c1['body']=_0x3545c3;return getRecipients(_0x4deb51);})['then'](function(_0x20c025){_0x1db4c1['recipientsId']=_['sortBy'](_0x20c025)['join'](',');return db[_0x2f7d('0x4b')][_0x2f7d('0x4c')](function(_0x291171){return db[_0x2f7d('0x4d')][_0x2f7d('0x4e')](_0x1db4c1,{'raw':!![],'transaction':_0x291171})[_0x2f7d('0x27')](function(_0x3d7647){var _0x12eb3f={'sender':_0x1db4c1[_0x2f7d('0x45')],'description':_0x1db4c1[_0x2f7d('0x48')],'content':_0x1db4c1['body'],'beep':_0x1db4c1['beep']};_0x20c025[_0x2f7d('0x4f')](function(_0x4b52e7){_0x12eb3f[_0x2f7d('0x50')]=_0x4b52e7;socket[_0x2f7d('0x51')](_0x2f7d('0x52'),_0x12eb3f);});return _0x3d7647;});});})[_0x2f7d('0x27')](respondWithResult(_0x3682f8,0xc9))[_0x2f7d('0x53')](handleError(_0x3682f8,null));};function getContent(_0x43acb8){return new BPromise(function(_0x57ccf7,_0x17dfb6){if(_0x43acb8[_0x2f7d('0x54')]){_0x57ccf7(_0x43acb8[_0x2f7d('0x54')]);return;}return db[_0x2f7d('0x55')][_0x2f7d('0x56')]({'attributes':[_0x2f7d('0x57')],'where':{'id':_0x43acb8[_0x2f7d('0x2f')]},'raw':!![]})['then'](function(_0x6c1e8a){if(!_0x6c1e8a)throw new db[(_0x2f7d('0x30'))][(_0x2f7d('0x31'))](_0x2f7d('0x58'));var _0x2c938e=Mustache[_0x2f7d('0x59')](_0x6c1e8a[_0x2f7d('0x57')],_0x43acb8[_0x2f7d('0x32')]);_0x57ccf7(_0x2c938e);})[_0x2f7d('0x53')](function(_0x4dfcdf){_0x17dfb6(_0x4dfcdf);});});}function getRecipients(_0x5988f7){return new BPromise(function(_0x5a88ba,_0x120772){var _0x2d1126=[];var _0x33175c=[];_0x5988f7['forEach'](function(_0x407675){var _0x15218d=_[_0x2f7d('0x5a')](_0x407675[_0x2f7d('0x5b')][_0x2f7d('0x43')]());if(_0x15218d==='User'){_0x2d1126=_['union'](_0x2d1126,_0x407675['ids']);}else{if(_[_0x2f7d('0x42')](_0x15218d,'queue'))_0x15218d=_0x15218d[_0x2f7d('0x5c')](_0x2f7d('0x5d'),_0x2f7d('0x5e'));_0x407675[_0x2f7d('0x5f')][_0x2f7d('0x4f')](function(_0x2bdcb5){_0x33175c['push'](getAgents(_0x15218d,_0x2bdcb5));});}});return BPromise[_0x2f7d('0x60')](_0x33175c)[_0x2f7d('0x27')](function(_0x8c21b5){_0x2d1126=_[_0x2f7d('0x61')](_0x2d1126,_[_0x2f7d('0x62')](_0x8c21b5));_0x5a88ba(_0x2d1126);})['catch'](function(_0x368198){_0x120772(_0x368198);});});}function getAgents(_0x50d929,_0x24355b){return new BPromise(function(_0x286240,_0x3c8751){return db[_0x50d929][_0x2f7d('0x56')]({'where':{'id':_0x24355b}})[_0x2f7d('0x27')](function(_0x19e56a){return _0x19e56a[_0x2f7d('0x63')]({'attributes':['id'],'raw':!![]})[_0x2f7d('0x27')](function(_0x54ac2a){var _0x12441d=_['map'](_0x54ac2a,'id');_0x286240(_0x12441d);});})[_0x2f7d('0x53')](function(_0x4b246a){_0x3c8751(_0x4b246a);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index fb5bc08..762573f 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x19cfab,_0x20f3c0){var _0x5e186b=function(_0x55c1aa){while(--_0x55c1aa){_0x19cfab['push'](_0x19cfab['shift']());}};_0x5e186b(++_0x20f3c0);}(_0x757a,0xde));var _0xa757=function(_0x1b8570,_0x4a8149){_0x1b8570=_0x1b8570-0x0;var _0x550202=_0x757a[_0x1b8570];return _0x550202;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x51d6df,_0x23bf79){var _0x3284a8=function(_0x2e4f86){while(--_0x2e4f86){_0x51d6df['push'](_0x51d6df['shift']());}};_0x3284a8(++_0x23bf79);}(_0x5f2f,0x73));var _0xf5f2=function(_0x236a4a,_0x1bf351){_0x236a4a=_0x236a4a-0x0;var _0x5a2b58=_0x5f2f[_0x236a4a];return _0x5a2b58;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index e73b2b5..d81d424 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 _0x6cb4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./notification.attributes','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6cb4,0xff));var _0x46cb=function(_0x51b654,_0xcb5006){_0x51b654=_0x51b654-0x0;var _0x26dedf=_0x6cb4[_0x51b654];return _0x26dedf;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46cb('0xd'),'collate':_0x46cb('0xe')});}; \ No newline at end of file +var _0xb7e7=['Notification','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./notification.attributes','define'];(function(_0x566c9d,_0x5d357a){var _0x12dbff=function(_0x52d41d){while(--_0x52d41d){_0x566c9d['push'](_0x566c9d['shift']());}};_0x12dbff(++_0x5d357a);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 925429b..8c93176 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 _0x9968=['Notification,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./notification.socket','request','Notification,\x20%s,\x20%s','request\x20sent'];(function(_0x3f29ce,_0x3d63ae){var _0x29a47e=function(_0x196596){while(--_0x196596){_0x3f29ce['push'](_0x3f29ce['shift']());}};_0x29a47e(++_0x3d63ae);}(_0x9968,0x9b));var _0x8996=function(_0x20f6c4,_0x657aaf){_0x20f6c4=_0x20f6c4-0x0;var _0x48f055=_0x9968[_0x20f6c4];return _0x48f055;};'use strict';var _=require(_0x8996('0x0'));var util=require(_0x8996('0x1'));var moment=require(_0x8996('0x2'));var BPromise=require(_0x8996('0x3'));var rs=require(_0x8996('0x4'));var fs=require('fs');var Redis=require(_0x8996('0x5'));var db=require(_0x8996('0x6'))['db'];var utils=require(_0x8996('0x7'));var logger=require(_0x8996('0x8'))(_0x8996('0x9'));var config=require('../../config/environment');var jayson=require(_0x8996('0xa'));var client=jayson[_0x8996('0xb')][_0x8996('0xc')]({'port':0x232a});config[_0x8996('0xd')]=_['defaults'](config[_0x8996('0xd')],{'host':_0x8996('0xe'),'port':0x18eb});var socket=require(_0x8996('0xf'))(new Redis(config['redis']));require(_0x8996('0x10'))['register'](socket);function respondWithRpcPromise(_0x36bbd7,_0x2a8086,_0x1330f9){return new BPromise(function(_0x2df763,_0x405b40){return client[_0x8996('0x11')](_0x36bbd7,_0x1330f9)['then'](function(_0x3b837c){logger['info'](_0x8996('0x12'),_0x2a8086,_0x8996('0x13'));logger['debug'](_0x8996('0x14'),_0x2a8086,'request\x20sent',JSON['stringify'](_0x3b837c));if(_0x3b837c[_0x8996('0x15')]){if(_0x3b837c[_0x8996('0x15')][_0x8996('0x16')]===0x1f4){logger[_0x8996('0x15')]('Notification,\x20%s,\x20%s',_0x2a8086,_0x3b837c['error'][_0x8996('0x17')]);return _0x405b40(_0x3b837c[_0x8996('0x15')][_0x8996('0x17')]);}logger['error']('Notification,\x20%s,\x20%s',_0x2a8086,_0x3b837c[_0x8996('0x15')][_0x8996('0x17')]);return _0x2df763(_0x3b837c[_0x8996('0x15')]['message']);}else{logger['info']('Notification,\x20%s,\x20%s',_0x2a8086,_0x8996('0x13'));_0x2df763(_0x3b837c['result'][_0x8996('0x17')]);}})[_0x8996('0x18')](function(_0x4fb705){logger[_0x8996('0x15')](_0x8996('0x12'),_0x2a8086,_0x4fb705);_0x405b40(_0x4fb705);});});} \ No newline at end of file +var _0x94c5=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./notification.socket','register','request','then','info','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Notification,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x27ee98,_0x3bd543){var _0x5f00d1=function(_0x12d9ed){while(--_0x12d9ed){_0x27ee98['push'](_0x27ee98['shift']());}};_0x5f00d1(++_0x3bd543);}(_0x94c5,0x14c));var _0x594c=function(_0x33c77e,_0x5bbe5d){_0x33c77e=_0x33c77e-0x0;var _0x4793e5=_0x94c5[_0x33c77e];return _0x4793e5;};'use strict';var _=require('lodash');var util=require(_0x594c('0x0'));var moment=require('moment');var BPromise=require(_0x594c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x594c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x594c('0x3'));var logger=require(_0x594c('0x4'))(_0x594c('0x5'));var config=require(_0x594c('0x6'));var jayson=require(_0x594c('0x7'));var client=jayson[_0x594c('0x8')][_0x594c('0x9')]({'port':0x232a});config[_0x594c('0xa')]=_['defaults'](config[_0x594c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x594c('0xb'))(new Redis(config[_0x594c('0xa')]));require(_0x594c('0xc'))[_0x594c('0xd')](socket);function respondWithRpcPromise(_0x37c9b2,_0x199437,_0x59e136){return new BPromise(function(_0x4538c,_0x5540ec){return client[_0x594c('0xe')](_0x37c9b2,_0x59e136)[_0x594c('0xf')](function(_0x58df0d){logger[_0x594c('0x10')]('Notification,\x20%s,\x20%s',_0x199437,'request\x20sent');logger[_0x594c('0x11')](_0x594c('0x12'),_0x199437,_0x594c('0x13'),JSON[_0x594c('0x14')](_0x58df0d));if(_0x58df0d[_0x594c('0x15')]){if(_0x58df0d[_0x594c('0x15')]['code']===0x1f4){logger['error'](_0x594c('0x16'),_0x199437,_0x58df0d[_0x594c('0x15')]['message']);return _0x5540ec(_0x58df0d['error'][_0x594c('0x17')]);}logger[_0x594c('0x15')](_0x594c('0x16'),_0x199437,_0x58df0d[_0x594c('0x15')][_0x594c('0x17')]);return _0x4538c(_0x58df0d[_0x594c('0x15')][_0x594c('0x17')]);}else{logger[_0x594c('0x10')](_0x594c('0x16'),_0x199437,'request\x20sent');_0x4538c(_0x58df0d[_0x594c('0x18')]['message']);}})[_0x594c('0x19')](function(_0x17c5cf){logger['error']('Notification,\x20%s,\x20%s',_0x199437,_0x17c5cf);_0x5540ec(_0x17c5cf);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 67db967..9475688 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 _0xd1a4=['emit','removeListener','register','length','notification:','./notification.events','save','remove','update'];(function(_0x3cfc6c,_0x56dd3d){var _0x4187c5=function(_0x321034){while(--_0x321034){_0x3cfc6c['push'](_0x3cfc6c['shift']());}};_0x4187c5(++_0x56dd3d);}(_0xd1a4,0x1b5));var _0x4d1a=function(_0x4b4132,_0x3ecb4e){_0x4b4132=_0x4b4132-0x0;var _0x2a89f3=_0xd1a4[_0x4b4132];return _0x2a89f3;};'use strict';var NotificationEvents=require(_0x4d1a('0x0'));var events=[_0x4d1a('0x1'),_0x4d1a('0x2'),_0x4d1a('0x3')];function createListener(_0x1866ea,_0x53661b){return function(_0x223834){_0x53661b[_0x4d1a('0x4')](_0x1866ea,_0x223834);};}function removeListener(_0x4af35a,_0x301c79){return function(){NotificationEvents[_0x4d1a('0x5')](_0x4af35a,_0x301c79);};}exports[_0x4d1a('0x6')]=function(_0x3c82ca){for(var _0xfe7deb=0x0,_0x58c3c7=events[_0x4d1a('0x7')];_0xfe7deb<_0x58c3c7;_0xfe7deb++){var _0x3ceec3=events[_0xfe7deb];var _0x50c6d3=createListener(_0x4d1a('0x8')+_0x3ceec3,_0x3c82ca);NotificationEvents['on'](_0x3ceec3,_0x50c6d3);}}; \ No newline at end of file +var _0x53bc=['removeListener','register','length','notification:','save','remove','update','emit'];(function(_0x211ba8,_0x323ffa){var _0x367e96=function(_0x50f459){while(--_0x50f459){_0x211ba8['push'](_0x211ba8['shift']());}};_0x367e96(++_0x323ffa);}(_0x53bc,0x1ec));var _0xc53b=function(_0x7f72c6,_0x57444d){_0x7f72c6=_0x7f72c6-0x0;var _0x1d8755=_0x53bc[_0x7f72c6];return _0x1d8755;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0xc53b('0x0'),_0xc53b('0x1'),_0xc53b('0x2')];function createListener(_0x332c53,_0x2ffab8){return function(_0x1a36f0){_0x2ffab8[_0xc53b('0x3')](_0x332c53,_0x1a36f0);};}function removeListener(_0x21e0c7,_0x5d6079){return function(){NotificationEvents[_0xc53b('0x4')](_0x21e0c7,_0x5d6079);};}exports[_0xc53b('0x5')]=function(_0x598ca7){for(var _0x11f299=0x0,_0x422997=events[_0xc53b('0x6')];_0x11f299<_0x422997;_0x11f299++){var _0x372e33=events[_0x11f299];var _0x5a9e0f=createListener(_0xc53b('0x7')+_0x372e33,_0x598ca7);NotificationEvents['on'](_0x372e33,_0x5a9e0f);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 4bb18c7..a29a797 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 _0x05f1=['multer','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','show','/:id/dispositions','isAuthenticated','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0x2bfa87,_0x3e4c3b){var _0xca164d=function(_0x2cfee3){while(--_0x2cfee3){_0x2bfa87['push'](_0x2bfa87['shift']());}};_0xca164d(++_0x3e4c3b);}(_0x05f1,0x88));var _0x105f=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x05f1[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x105f('0x0'));var util=require('util');var path=require(_0x105f('0x1'));var timeout=require('connect-timeout');var express=require(_0x105f('0x2'));var router=express[_0x105f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x105f('0x4'));var config=require(_0x105f('0x5'));var controller=require(_0x105f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x105f('0x7')]);router[_0x105f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x105f('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x105f('0x9')]);router['get'](_0x105f('0xa'),auth[_0x105f('0xb')](),controller['getDispositions']);router['get'](_0x105f('0xc'),auth[_0x105f('0xb')](),controller[_0x105f('0xd')]);router[_0x105f('0x8')](_0x105f('0xe'),auth[_0x105f('0xb')](),controller[_0x105f('0xf')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x105f('0x10')]);router[_0x105f('0x8')](_0x105f('0x11'),auth[_0x105f('0xb')](),controller[_0x105f('0x12')]);router[_0x105f('0x13')]('/',auth[_0x105f('0xb')](),controller['create']);router[_0x105f('0x13')](_0x105f('0xa'),auth['isAuthenticated'](),controller[_0x105f('0x14')]);router['post'](_0x105f('0xc'),auth[_0x105f('0xb')](),controller[_0x105f('0x15')]);router['post']('/:id/notify',controller[_0x105f('0x16')]);router[_0x105f('0x13')]('/:id/applications',auth[_0x105f('0xb')](),controller[_0x105f('0x17')]);router[_0x105f('0x13')]('/:id/users',auth[_0x105f('0xb')](),controller[_0x105f('0x18')]);router[_0x105f('0x13')](_0x105f('0x19'),auth[_0x105f('0xb')](),controller['send']);router['put'](_0x105f('0x1a'),auth[_0x105f('0xb')](),controller[_0x105f('0x1b')]);router[_0x105f('0x1c')]('/:id',auth[_0x105f('0xb')](),controller[_0x105f('0x1d')]);router[_0x105f('0x1c')]('/:id/dispositions',auth[_0x105f('0xb')](),controller[_0x105f('0x1e')]);router[_0x105f('0x1c')](_0x105f('0xc'),auth[_0x105f('0xb')](),controller[_0x105f('0x1f')]);router[_0x105f('0x1c')](_0x105f('0x11'),auth[_0x105f('0xb')](),controller[_0x105f('0x20')]);module[_0x105f('0x21')]=router; \ No newline at end of file +var _0xed4f=['delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelAccount.controller','isAuthenticated','index','get','/describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update'];(function(_0x178fd8,_0x29024b){var _0x4c41eb=function(_0x692e4e){while(--_0x692e4e){_0x178fd8['push'](_0x178fd8['shift']());}};_0x4c41eb(++_0x29024b);}(_0xed4f,0x79));var _0xfed4=function(_0x2453b4,_0x2203ac){_0x2453b4=_0x2453b4-0x0;var _0x343772=_0xed4f[_0x2453b4];return _0x343772;};'use strict';var multer=require(_0xfed4('0x0'));var util=require(_0xfed4('0x1'));var path=require(_0xfed4('0x2'));var timeout=require(_0xfed4('0x3'));var express=require(_0xfed4('0x4'));var router=express[_0xfed4('0x5')]();var auth=require(_0xfed4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfed4('0x7'));router['get']('/',auth[_0xfed4('0x8')](),controller[_0xfed4('0x9')]);router[_0xfed4('0xa')](_0xfed4('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xfed4('0xa')](_0xfed4('0xc'),auth[_0xfed4('0x8')](),controller['show']);router['get'](_0xfed4('0xd'),auth[_0xfed4('0x8')](),controller[_0xfed4('0xe')]);router[_0xfed4('0xa')]('/:id/canned_answers',auth[_0xfed4('0x8')](),controller[_0xfed4('0xf')]);router['get'](_0xfed4('0x10'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x11')]);router[_0xfed4('0xa')](_0xfed4('0x12'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x13')]);router[_0xfed4('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xfed4('0x14')]);router[_0xfed4('0x15')]('/',auth[_0xfed4('0x8')](),controller[_0xfed4('0x16')]);router[_0xfed4('0x15')](_0xfed4('0xd'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x17')]);router[_0xfed4('0x15')](_0xfed4('0x18'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x19')]);router['post'](_0xfed4('0x1a'),controller[_0xfed4('0x1b')]);router[_0xfed4('0x15')](_0xfed4('0x10'),auth['isAuthenticated'](),controller[_0xfed4('0x1c')]);router['post'](_0xfed4('0x1d'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x1e')]);router[_0xfed4('0x15')](_0xfed4('0x1f'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x20')]);router[_0xfed4('0x21')](_0xfed4('0xc'),auth['isAuthenticated'](),controller[_0xfed4('0x22')]);router[_0xfed4('0x23')](_0xfed4('0xc'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x24')]);router[_0xfed4('0x23')](_0xfed4('0xd'),auth[_0xfed4('0x8')](),controller['removeDispositions']);router['delete'](_0xfed4('0x18'),auth[_0xfed4('0x8')](),controller['removeAnswers']);router[_0xfed4('0x23')](_0xfed4('0x1d'),auth[_0xfed4('0x8')](),controller[_0xfed4('0x25')]);module[_0xfed4('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 22f1f07..469ff07 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 _0x46fc=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x3efa2a,_0x4aa529){var _0x49b4f3=function(_0x5953bc){while(--_0x5953bc){_0x3efa2a['push'](_0x3efa2a['shift']());}};_0x49b4f3(++_0x4aa529);}(_0x46fc,0x1b1));var _0xc46f=function(_0x28e69f,_0x3ce461){_0x28e69f=_0x28e69f-0x0;var _0x1beff1=_0x46fc[_0x28e69f];return _0x1beff1;};'use strict';var Sequelize=require(_0xc46f('0x0'));var rs=require(_0xc46f('0x1'));module[_0xc46f('0x2')]={'name':{'type':Sequelize[_0xc46f('0x3')],'unique':_0xc46f('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xc46f('0x3')]},'token':{'type':Sequelize[_0xc46f('0x3')],'defaultValue':function(){return rs[_0xc46f('0x5')]();}},'replyUri':{'type':Sequelize[_0xc46f('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc46f('0x6')],'defaultValue':function(){return _0xc46f('0x7');}},'notificationSound':{'type':Sequelize[_0xc46f('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc46f('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc46f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xc46f('0x3')]},'queueTransfer':{'type':Sequelize[_0xc46f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc46f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc46f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc46f('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xc46f('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2e8551){if(!_0x2e8551)this[_0xc46f('0xb')](_0xc46f('0xc'),null);this[_0xc46f('0xb')]('mandatoryDisposition',_0x2e8551);}}}; \ No newline at end of file +var _0xc62a=['STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','exports','name'];(function(_0x38c3fc,_0x45612f){var _0x494073=function(_0x30c868){while(--_0x30c868){_0x38c3fc['push'](_0x38c3fc['shift']());}};_0x494073(++_0x45612f);}(_0xc62a,0xc9));var _0xac62=function(_0x13dfc0,_0x576169){_0x13dfc0=_0x13dfc0-0x0;var _0xb56571=_0xc62a[_0x13dfc0];return _0xb56571;};'use strict';var Sequelize=require(_0xac62('0x0'));var rs=require('randomstring');module[_0xac62('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xac62('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xac62('0x3')]},'token':{'type':Sequelize[_0xac62('0x3')],'defaultValue':function(){return rs[_0xac62('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xac62('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xac62('0x5')],'defaultValue':function(){return _0xac62('0x6');}},'notificationSound':{'type':Sequelize[_0xac62('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xac62('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xac62('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xac62('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xac62('0x8')],'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':_0xac62('0x9'),'set':function(_0x3439d1){if(!_0x3439d1)this['setDataValue'](_0xac62('0xa'),null);this[_0xac62('0xb')]('mandatoryDisposition',_0x3439d1);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 2975c1c..05e8262 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 _0xae2d=['from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','User','Owner','fullname','internal','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','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','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','Pause','mandatoryDispositionPause','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','options','OpenchannelAccount','includeAll','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','order','OpenchannelAccountId','findAll','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','ids','notify','openchannel','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae2d,0x1b3));var _0xdae2=function(_0x532d78,_0x25b6a8){_0x532d78=_0x532d78-0x0;var _0x5990c4=_0xae2d[_0x532d78];return _0x5990c4;};'use strict';var pdf=require(_0xdae2('0x0'));var emlformat=require(_0xdae2('0x1'));var rimraf=require(_0xdae2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdae2('0x3'));var rp=require(_0xdae2('0x4'));var moment=require(_0xdae2('0x5'));var BPromise=require(_0xdae2('0x6'));var Mustache=require(_0xdae2('0x7'));var util=require('util');var path=require(_0xdae2('0x8'));var sox=require('sox');var csv=require(_0xdae2('0x9'));var ejs=require(_0xdae2('0xa'));var fs=require('fs');var _=require(_0xdae2('0xb'));var squel=require(_0xdae2('0xc'));var crypto=require(_0xdae2('0xd'));var jsforce=require(_0xdae2('0xe'));var deskjs=require(_0xdae2('0xf'));var toCsv=require(_0xdae2('0x9'));var querystring=require(_0xdae2('0x10'));var Papa=require(_0xdae2('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdae2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdae2('0x13'));var logger=require('../../config/logger')(_0xdae2('0x14'));var utils=require(_0xdae2('0x15'));var config=require(_0xdae2('0x16'));var db=require(_0xdae2('0x17'))['db'];config[_0xdae2('0x18')]=_[_0xdae2('0x19')](config['redis'],{'host':_0xdae2('0x1a'),'port':0x18eb});var socket=require(_0xdae2('0x1b'))(new Redis(config['redis']));require(_0xdae2('0x1c'))[_0xdae2('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdae2('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xdae2('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0xa13a0,_0x42b374,_0x2e132b){if(_0x2e132b){var _0x2870e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2870e8[_0xdae2('0x1f')](_0x42b374)){return _0xa13a0;}else{throw new db[(_0xdae2('0x20'))][(_0xdae2('0x21'))](_0xdae2('0x22'));}}else{return _0xa13a0;}}function respondWithRpcPromise(_0x1fe085,_0x78324c,_0x1f2eeb,_0x273fd6){return new BPromise(function(_0x1b8757,_0x52cf42){var _0x568cad=_0x273fd6||client;return _0x568cad[_0xdae2('0x23')](_0x1fe085,_0x1f2eeb)[_0xdae2('0x24')](function(_0x373a42){logger[_0xdae2('0x25')](_0xdae2('0x26'),_0x78324c,_0xdae2('0x27'));logger[_0xdae2('0x28')](_0xdae2('0x29'),_0x78324c,_0xdae2('0x27'),JSON[_0xdae2('0x2a')](_0x373a42));if(_0x373a42[_0xdae2('0x2b')]){if(_0x373a42[_0xdae2('0x2b')][_0xdae2('0x2c')]===0x1f4){logger[_0xdae2('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x78324c,_0x373a42[_0xdae2('0x2b')][_0xdae2('0x2d')]);return _0x52cf42(_0x373a42[_0xdae2('0x2b')]['message']);}logger[_0xdae2('0x2b')](_0xdae2('0x26'),_0x78324c,_0x373a42['error']['message']);return _0x1b8757(_0x373a42[_0xdae2('0x2b')][_0xdae2('0x2d')]);}else{logger[_0xdae2('0x25')](_0xdae2('0x26'),_0x78324c,_0xdae2('0x27'));_0x1b8757(_0x373a42['result'][_0xdae2('0x2d')]);}})[_0xdae2('0x2e')](function(_0x312916){logger[_0xdae2('0x2b')](_0xdae2('0x26'),_0x78324c,_0x312916);_0x52cf42(_0x312916);});});}function respondWithStatusCode(_0x315c36,_0x500078){_0x500078=_0x500078||0xcc;return function(_0x314b5d){if(_0x314b5d){return _0x315c36['sendStatus'](_0x500078);}return _0x315c36['status'](_0x500078)['end']();};}function respondWithResult(_0x5966d9,_0x266137){_0x266137=_0x266137||0xc8;return function(_0x4dad41){if(_0x4dad41){return _0x5966d9['status'](_0x266137)[_0xdae2('0x2f')](_0x4dad41);}};}function respondWithFilteredResult(_0x1578fe,_0x320bab){return function(_0x33db2d){if(_0x33db2d){var _0x48e823=_0x33db2d[_0xdae2('0x30')],_0x20568f=_0x320bab[_0xdae2('0x31')],_0x1da29f=_0x320bab['offset']+_0x320bab[_0xdae2('0x32')],_0x18b3af;if(_0x1da29f>=_0x48e823){_0x1da29f=_0x48e823;_0x18b3af=0xc8;}else{_0x18b3af=0xce;}_0x1578fe[_0xdae2('0x33')](_0x18b3af);return _0x1578fe['set'](_0xdae2('0x34'),_0x20568f+'-'+_0x1da29f+'/'+_0x48e823)['json'](_0x33db2d);}return null;};}function patchUpdates(_0x744aea){return function(_0x3c5590){try{jsonpatch[_0xdae2('0x35')](_0x3c5590,_0x744aea,!![]);}catch(_0x58a5dc){return BPromise[_0xdae2('0x36')](_0x58a5dc);}return _0x3c5590[_0xdae2('0x37')]();};}function saveUpdates(_0x1e5e83,_0x4e58fb){return function(_0x1b5e99){if(_0x1b5e99){return _0x1b5e99[_0xdae2('0x38')](_0x1e5e83)['then'](function(_0x44af5f){return _0x44af5f;});}return null;};}function removeEntity(_0x3a372f,_0x511091){return function(_0xb418fc){if(_0xb418fc){return _0xb418fc[_0xdae2('0x39')]()[_0xdae2('0x24')](function(){var _0xb3fe7d=_0xb418fc['get']({'plain':!![]});var _0x1dc589='OpenchannelAccounts';return db['UserProfileResource'][_0xdae2('0x39')]({'where':{'type':_0x1dc589,'resourceId':_0xb3fe7d['id']}})[_0xdae2('0x24')](function(){return _0xb418fc;});})['then'](function(){_0x3a372f[_0xdae2('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d9630,_0x1a3f06){return function(_0x2bfc1e){if(!_0x2bfc1e){_0x8d9630[_0xdae2('0x3a')](0x194);}return _0x2bfc1e;};}function handleError(_0x5a70a7,_0x189be1){_0x189be1=_0x189be1||0x1f4;return function(_0x5f2567){logger[_0xdae2('0x2b')](_0x5f2567[_0xdae2('0x3b')]);if(_0x5f2567['name']){delete _0x5f2567[_0xdae2('0x3c')];}_0x5a70a7[_0xdae2('0x33')](_0x189be1)['send'](_0x5f2567);};}exports['index']=function(_0x151d97,_0x2e63d1){var _0x2d5837={'include':[{'model':db[_0xdae2('0x3d')],'as':_0xdae2('0x3e')}]},_0x2be23e={},_0x1f4f6c={'count':0x0,'rows':[]};var _0x2794e6=_['map'](db['OpenchannelAccount'][_0xdae2('0x3f')],function(_0x3f4d03){return{'name':_0x3f4d03[_0xdae2('0x40')],'type':_0x3f4d03['type']['key']};});_0x2be23e[_0xdae2('0x41')]=_['map'](_0x2794e6,_0xdae2('0x3c'));_0x2be23e['query']=_[_0xdae2('0x42')](_0x151d97[_0xdae2('0x43')]);_0x2be23e[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x2be23e[_0xdae2('0x41')],_0x2be23e['query']);_0x2d5837['attributes']=_[_0xdae2('0x45')](_0x2be23e[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x151d97[_0xdae2('0x43')][_0xdae2('0x46')]));_0x2d5837[_0xdae2('0x47')]=_0x2d5837[_0xdae2('0x47')][_0xdae2('0x48')]?_0x2d5837[_0xdae2('0x47')]:_0x2be23e['model'];if(!_0x151d97[_0xdae2('0x43')][_0xdae2('0x49')](_0xdae2('0x4a'))){_0x2d5837[_0xdae2('0x32')]=qs[_0xdae2('0x32')](_0x151d97[_0xdae2('0x43')][_0xdae2('0x32')]);_0x2d5837[_0xdae2('0x31')]=qs[_0xdae2('0x31')](_0x151d97[_0xdae2('0x43')][_0xdae2('0x31')]);}_0x2d5837['order']=qs[_0xdae2('0x4b')](_0x151d97[_0xdae2('0x43')][_0xdae2('0x4b')]);_0x2d5837[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_[_0xdae2('0x4d')](_0x151d97[_0xdae2('0x43')],_0x2be23e['filters']),_0x2794e6);if(_0x151d97[_0xdae2('0x43')]['filter']){_0x2d5837['where']=_[_0xdae2('0x4e')](_0x2d5837['where'],{'$or':_[_0xdae2('0x4f')](_0x2794e6,function(_0x43bd98){if(_0x43bd98['type']!==_0xdae2('0x50')){var _0x25ce4c={};_0x25ce4c[_0x43bd98[_0xdae2('0x3c')]]={'$like':'%'+_0x151d97['query'][_0xdae2('0x51')]+'%'};return _0x25ce4c;}})});}_0x2d5837=_[_0xdae2('0x4e')]({},_0x2d5837,_0x151d97[_0xdae2('0x52')]);var _0x24e60b={'where':_0x2d5837[_0xdae2('0x4c')]};return db[_0xdae2('0x53')]['count'](_0x24e60b)[_0xdae2('0x24')](function(_0x456f04){_0x1f4f6c['count']=_0x456f04;if(_0x151d97[_0xdae2('0x43')][_0xdae2('0x54')]){_0x2d5837['include']=[{'all':!![]}];}return db[_0xdae2('0x53')]['findAll'](_0x2d5837);})[_0xdae2('0x24')](function(_0x1920c0){_0x1f4f6c['rows']=_0x1920c0;return _0x1f4f6c;})['then'](respondWithFilteredResult(_0x2e63d1,_0x2d5837))[_0xdae2('0x2e')](handleError(_0x2e63d1,null));};exports['show']=function(_0x712572,_0x37bea2){var _0x495f2a={'raw':![],'where':{'id':_0x712572[_0xdae2('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x19ac30={};_0x19ac30[_0xdae2('0x41')]=_[_0xdae2('0x42')](db[_0xdae2('0x53')][_0xdae2('0x3f')]);_0x19ac30['query']=_['keys'](_0x712572[_0xdae2('0x43')]);_0x19ac30[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x19ac30['model'],_0x19ac30[_0xdae2('0x43')]);_0x495f2a['attributes']=_[_0xdae2('0x45')](_0x19ac30[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x712572[_0xdae2('0x43')][_0xdae2('0x46')]));_0x495f2a[_0xdae2('0x47')]=_0x495f2a[_0xdae2('0x47')][_0xdae2('0x48')]?_0x495f2a[_0xdae2('0x47')]:_0x19ac30[_0xdae2('0x41')];if(_0x712572[_0xdae2('0x43')][_0xdae2('0x54')]){_0x495f2a[_0xdae2('0x56')]=[{'all':!![]}];}_0x495f2a=_[_0xdae2('0x4e')]({},_0x495f2a,_0x712572[_0xdae2('0x52')]);return db[_0xdae2('0x53')][_0xdae2('0x57')](_0x495f2a)['then'](handleEntityNotFound(_0x37bea2,null))[_0xdae2('0x24')](respondWithResult(_0x37bea2,null))['catch'](handleError(_0x37bea2,null));};exports[_0xdae2('0x58')]=function(_0x44818e,_0x77486d){return db['OpenchannelAccount'][_0xdae2('0x58')](_0x44818e[_0xdae2('0x59')],{})['then'](function(_0x4f25a7){var _0x22292d=_0x44818e[_0xdae2('0x5a')][_0xdae2('0x5b')]({'plain':!![]});if(!_0x22292d)throw new Error(_0xdae2('0x5c'));if(_0x22292d[_0xdae2('0x5d')]===_0xdae2('0x5a')){var _0xecd71b=_0x4f25a7[_0xdae2('0x5b')]({'plain':!![]});var _0x382c67=_0xdae2('0x5e');return db['UserProfileSection'][_0xdae2('0x57')]({'where':{'name':_0x382c67,'userProfileId':_0x22292d[_0xdae2('0x5f')]},'raw':!![]})[_0xdae2('0x24')](function(_0x7b9e82){if(_0x7b9e82&&_0x7b9e82[_0xdae2('0x60')]===0x0){return db[_0xdae2('0x61')]['create']({'name':_0xecd71b[_0xdae2('0x3c')],'resourceId':_0xecd71b['id'],'type':_0x7b9e82[_0xdae2('0x3c')],'sectionId':_0x7b9e82['id']},{})[_0xdae2('0x24')](function(){return _0x4f25a7;});}else{return _0x4f25a7;}})[_0xdae2('0x2e')](function(_0x54aa65){logger['error'](_0xdae2('0x62'),_0x54aa65);throw _0x54aa65;});}return _0x4f25a7;})[_0xdae2('0x24')](respondWithResult(_0x77486d,0xc9))[_0xdae2('0x2e')](handleError(_0x77486d,null));};exports['update']=function(_0x29795c,_0x4f7f41){if(_0x29795c[_0xdae2('0x59')]['id']){delete _0x29795c['body']['id'];}return db['OpenchannelAccount'][_0xdae2('0x57')]({'where':{'id':_0x29795c[_0xdae2('0x55')]['id']},'include':[{'model':db[_0xdae2('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xdae2('0x24')](handleEntityNotFound(_0x4f7f41,null))[_0xdae2('0x24')](saveUpdates(_0x29795c[_0xdae2('0x59')],null))['then'](respondWithResult(_0x4f7f41,null))[_0xdae2('0x2e')](handleError(_0x4f7f41,null));};exports['destroy']=function(_0x19bfaf,_0x2e2e43){return db[_0xdae2('0x53')]['find']({'where':{'id':_0x19bfaf[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x2e2e43,null))[_0xdae2('0x24')](removeEntity(_0x2e2e43,null))[_0xdae2('0x2e')](handleError(_0x2e2e43,null));};exports[_0xdae2('0x63')]=function(_0x29a160,_0x261124){return db[_0xdae2('0x53')]['describe']()[_0xdae2('0x24')](respondWithResult(_0x261124,null))[_0xdae2('0x2e')](handleError(_0x261124,null));};exports[_0xdae2('0x64')]=function(_0x38c52f,_0x2ebdff,_0x22b533){if(_0x38c52f[_0xdae2('0x59')]['id']){delete _0x38c52f[_0xdae2('0x59')]['id'];}return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x38c52f[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x2ebdff,null))['then'](function(_0x4a83e9){if(_0x4a83e9){_0x38c52f[_0xdae2('0x59')][_0xdae2('0x65')]=_0x4a83e9['id'];return db[_0xdae2('0x66')]['create'](_0x38c52f['body']);}})['then'](respondWithResult(_0x2ebdff,null))['catch'](handleError(_0x2ebdff,null));};exports[_0xdae2('0x67')]=function(_0x4101dc,_0x2e4626,_0x3fae73){var _0x40a59d={'raw':![],'where':{}};var _0x1be11e={};var _0x5cf82a={'count':0x0,'rows':[]};return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x4101dc['params']['id']}})['then'](handleEntityNotFound(_0x2e4626,null))[_0xdae2('0x24')](function(_0x32c481){if(_0x32c481){_0x1be11e[_0xdae2('0x41')]=_[_0xdae2('0x42')](db['Disposition'][_0xdae2('0x3f')]);_0x1be11e[_0xdae2('0x43')]=_[_0xdae2('0x42')](_0x4101dc[_0xdae2('0x43')]);_0x1be11e[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x1be11e[_0xdae2('0x41')],_0x1be11e[_0xdae2('0x43')]);_0x40a59d[_0xdae2('0x47')]=_[_0xdae2('0x45')](_0x1be11e[_0xdae2('0x41')],qs['fields'](_0x4101dc['query'][_0xdae2('0x46')]));_0x40a59d[_0xdae2('0x47')]=_0x40a59d[_0xdae2('0x47')][_0xdae2('0x48')]?_0x40a59d['attributes']:_0x1be11e[_0xdae2('0x41')];if(!_0x4101dc[_0xdae2('0x43')][_0xdae2('0x49')](_0xdae2('0x4a'))){_0x40a59d[_0xdae2('0x32')]=qs[_0xdae2('0x32')](_0x4101dc[_0xdae2('0x43')][_0xdae2('0x32')]);_0x40a59d['offset']=qs[_0xdae2('0x31')](_0x4101dc['query'][_0xdae2('0x31')]);}_0x40a59d[_0xdae2('0x69')]=qs[_0xdae2('0x4b')](_0x4101dc['query'][_0xdae2('0x4b')]);_0x40a59d[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_[_0xdae2('0x4d')](_0x4101dc['query'],_0x1be11e[_0xdae2('0x44')]));_0x40a59d['where'][_0xdae2('0x6a')]=_0x32c481['id'];if(_0x4101dc[_0xdae2('0x43')]['filter']){_0x40a59d['where']=_[_0xdae2('0x4e')](_0x40a59d[_0xdae2('0x4c')],{'$or':_[_0xdae2('0x4f')](_0x40a59d[_0xdae2('0x47')],function(_0x5e1315){var _0x11c2a7={};_0x11c2a7[_0x5e1315]={'$like':'%'+_0x4101dc[_0xdae2('0x43')][_0xdae2('0x51')]+'%'};return _0x11c2a7;})});}_0x40a59d=_['merge']({},_0x40a59d,_0x4101dc[_0xdae2('0x52')]);return db[_0xdae2('0x66')]['count']({'where':_0x40a59d[_0xdae2('0x4c')]})[_0xdae2('0x24')](function(_0x5e13a0){_0x5cf82a[_0xdae2('0x30')]=_0x5e13a0;if(_0x4101dc[_0xdae2('0x43')][_0xdae2('0x54')]){_0x40a59d['include']=[{'all':!![]}];}return db['Disposition'][_0xdae2('0x6b')](_0x40a59d);})[_0xdae2('0x24')](function(_0x44d337){_0x5cf82a[_0xdae2('0x6c')]=_0x44d337;return _0x5cf82a;});}})[_0xdae2('0x24')](respondWithFilteredResult(_0x2e4626,_0x40a59d))['catch'](handleError(_0x2e4626,null));};exports[_0xdae2('0x6d')]=function(_0x5cec1f,_0x40c618,_0x54911a){return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x5cec1f['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x40c618,null))[_0xdae2('0x24')](function(_0x13b682){if(_0x13b682){return _0x13b682[_0xdae2('0x6d')](_0x5cec1f['query']['ids']);}})['then'](respondWithStatusCode(_0x40c618,null))[_0xdae2('0x2e')](handleError(_0x40c618,null));};exports[_0xdae2('0x6e')]=function(_0x542bcc,_0x3a0f34,_0x514b89){if(_0x542bcc[_0xdae2('0x59')]['id']){delete _0x542bcc[_0xdae2('0x59')]['id'];}return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x542bcc[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x3a0f34,null))[_0xdae2('0x24')](function(_0xe5b63b){if(_0xe5b63b){_0x542bcc[_0xdae2('0x59')][_0xdae2('0x6a')]=_0xe5b63b['id'];return db[_0xdae2('0x6f')][_0xdae2('0x58')](_0x542bcc[_0xdae2('0x59')]);}})[_0xdae2('0x24')](respondWithResult(_0x3a0f34,null))[_0xdae2('0x2e')](handleError(_0x3a0f34,null));};exports[_0xdae2('0x70')]=function(_0x2c45d8,_0x155515,_0x2abfce){var _0x4c03ba={'raw':![],'where':{}};var _0x4e14d9={};var _0x1c7ce2={'count':0x0,'rows':[]};return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x2c45d8[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x155515,null))[_0xdae2('0x24')](function(_0x4f2c72){if(_0x4f2c72){_0x4e14d9['model']=_[_0xdae2('0x42')](db[_0xdae2('0x6f')]['rawAttributes']);_0x4e14d9['query']=_[_0xdae2('0x42')](_0x2c45d8[_0xdae2('0x43')]);_0x4e14d9['filters']=_['intersection'](_0x4e14d9[_0xdae2('0x41')],_0x4e14d9[_0xdae2('0x43')]);_0x4c03ba[_0xdae2('0x47')]=_[_0xdae2('0x45')](_0x4e14d9[_0xdae2('0x41')],qs['fields'](_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x46')]));_0x4c03ba[_0xdae2('0x47')]=_0x4c03ba[_0xdae2('0x47')][_0xdae2('0x48')]?_0x4c03ba['attributes']:_0x4e14d9[_0xdae2('0x41')];if(!_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x49')](_0xdae2('0x4a'))){_0x4c03ba[_0xdae2('0x32')]=qs[_0xdae2('0x32')](_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x32')]);_0x4c03ba[_0xdae2('0x31')]=qs[_0xdae2('0x31')](_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x31')]);}_0x4c03ba['order']=qs['sort'](_0x2c45d8[_0xdae2('0x43')]['sort']);_0x4c03ba[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_['pick'](_0x2c45d8[_0xdae2('0x43')],_0x4e14d9[_0xdae2('0x44')]));_0x4c03ba[_0xdae2('0x4c')][_0xdae2('0x6a')]=_0x4f2c72['id'];if(_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x51')]){_0x4c03ba[_0xdae2('0x4c')]=_[_0xdae2('0x4e')](_0x4c03ba[_0xdae2('0x4c')],{'$or':_[_0xdae2('0x4f')](_0x4c03ba['attributes'],function(_0x3a3fd4){var _0x22928f={};_0x22928f[_0x3a3fd4]={'$like':'%'+_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x51')]+'%'};return _0x22928f;})});}_0x4c03ba=_['merge']({},_0x4c03ba,_0x2c45d8[_0xdae2('0x52')]);return db[_0xdae2('0x6f')]['count']({'where':_0x4c03ba[_0xdae2('0x4c')]})[_0xdae2('0x24')](function(_0x38e911){_0x1c7ce2[_0xdae2('0x30')]=_0x38e911;if(_0x2c45d8[_0xdae2('0x43')][_0xdae2('0x54')]){_0x4c03ba['include']=[{'all':!![]}];}return db[_0xdae2('0x6f')]['findAll'](_0x4c03ba);})['then'](function(_0x1638c8){_0x1c7ce2[_0xdae2('0x6c')]=_0x1638c8;return _0x1c7ce2;});}})[_0xdae2('0x24')](respondWithFilteredResult(_0x155515,_0x4c03ba))[_0xdae2('0x2e')](handleError(_0x155515,null));};exports['removeAnswers']=function(_0x2b5acd,_0x5d83df,_0x84c2ca){return db['OpenchannelAccount'][_0xdae2('0x57')]({'where':{'id':_0x2b5acd[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x5d83df,null))[_0xdae2('0x24')](function(_0x16e4fb){if(_0x16e4fb){return _0x16e4fb['removeAnswers'](_0x2b5acd[_0xdae2('0x43')][_0xdae2('0x71')]);}})['then'](respondWithStatusCode(_0x5d83df,null))[_0xdae2('0x2e')](handleError(_0x5d83df,null));};exports[_0xdae2('0x72')]=function(_0xd17a34,_0x36a9dc,_0x5c6daa){var _0x467a6c={'body':_0xd17a34['body'],'channel':_0xdae2('0x73')};var _0x1b79a0=[];var _0x220f7c=[];var _0x5a1c20={};var _0x541cdd=![];return db['CmContact']['describe']()[_0xdae2('0x24')](function(_0x241c9e){if(!_0x241c9e){throw new db[(_0xdae2('0x20'))][(_0xdae2('0x21'))](_0xdae2('0x74'));}_0x1b79a0=_[_0xdae2('0x75')](_[_0xdae2('0x42')](_0x241c9e),[_0xdae2('0x76'),_0xdae2('0x77')]);_0x220f7c=_[_0xdae2('0x75')](_[_0xdae2('0x42')](_0x241c9e),[_0xdae2('0x76'),'updatedAt',_0xdae2('0x78'),_0xdae2('0x79')]);if(_0xd17a34[_0xdae2('0x59')]['id']){delete _0xd17a34[_0xdae2('0x59')]['id'];}if(_[_0xdae2('0x7a')](_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7b')])){throw new db['Sequelize'][(_0xdae2('0x21'))](_0xdae2('0x7c'));}if(_[_0xdae2('0x7a')](_0xd17a34[_0xdae2('0x59')]['body'])||_0xd17a34[_0xdae2('0x59')][_0xdae2('0x59')]===''){throw new db[(_0xdae2('0x20'))][(_0xdae2('0x21'))](_0xdae2('0x7d'));}if(_[_0xdae2('0x7a')](_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7e')])){throw new db[(_0xdae2('0x20'))][(_0xdae2('0x21'))](_0xdae2('0x7f')+_0x220f7c);}if(!_[_0xdae2('0x80')](_0x220f7c,_0xd17a34[_0xdae2('0x59')]['mapKey'])){throw new db[(_0xdae2('0x20'))]['ValidationError'](_0xdae2('0x81')+_0x220f7c);}_0x5a1c20[_0xd17a34[_0xdae2('0x59')]['mapKey']]=_0xd17a34[_0xdae2('0x59')]['from'];})[_0xdae2('0x24')](function(){return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0xd17a34[_0xdae2('0x55')]['id']},'include':[{'model':db[_0xdae2('0x82')],'as':_0xdae2('0x83'),'include':[{'model':db[_0xdae2('0x84')],'as':_0xdae2('0x85'),'where':_0x5a1c20,'limit':0x1,'order':[[_0xdae2('0x77'),_0xdae2('0x86')]]}]},{'model':db[_0xdae2('0x87')],'as':_0xdae2('0x88')}]});})[_0xdae2('0x24')](handleEntityNotFound(_0x36a9dc,null))['then'](function(_0x3fcdd2){if(_0x3fcdd2&&_0x3fcdd2[_0xdae2('0x83')]){_0x467a6c[_0xdae2('0x89')]=_0x3fcdd2;_0x467a6c['applications']=_0x3fcdd2[_0xdae2('0x88')];_0x467a6c['list']=_0x3fcdd2[_0xdae2('0x83')];_0x467a6c[_0xdae2('0x8a')]=_['orderBy'](_0x467a6c[_0xdae2('0x8a')],[_0xdae2('0x8b')],[_0xdae2('0x8c')]);if(_0x467a6c[_0xdae2('0x89')][_0xdae2('0x88')]){delete _0x467a6c[_0xdae2('0x89')][_0xdae2('0x88')];}if(_0x467a6c[_0xdae2('0x89')][_0xdae2('0x83')]&&_0x467a6c[_0xdae2('0x89')][_0xdae2('0x83')][_0xdae2('0x85')][_0xdae2('0x48')]){return _0x467a6c['account']['List'][_0xdae2('0x85')][0x0];}var _0x17f8ac=_[_0xdae2('0x19')](_0xd17a34['body'],{'firstName':_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7b')],'ListId':_0x3fcdd2[_0xdae2('0x79')]});_0x17f8ac[_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7e')]]=_0xd17a34[_0xdae2('0x59')][_0xdae2('0x7b')];return db[_0xdae2('0x84')][_0xdae2('0x58')](_0x17f8ac,{'fields':_0x1b79a0,'raw':!![]});}})[_0xdae2('0x24')](handleEntityNotFound(_0x36a9dc,null))['then'](function(_0x1b43d1){_0x467a6c[_0xdae2('0x8d')]=_0x1b43d1;if(_0x1b43d1){var _0x380aaa={'ContactId':_0x1b43d1['id'],'OpenchannelAccountId':_0xd17a34['params']['id'],'from':(_0x1b43d1[_0xdae2('0x8e')]||'')+'\x20'+(_0x1b43d1[_0xdae2('0x8f')]||'')};var _0x4431d5={'OpenchannelAccountId':_0xd17a34[_0xdae2('0x55')]['id'],'closed':![]};if(_0xd17a34[_0xdae2('0x59')][_0xdae2('0x90')]){_0x4431d5[_0xdae2('0x90')]=_0xd17a34[_0xdae2('0x59')][_0xdae2('0x90')];return db[_0xdae2('0x91')][_0xdae2('0x57')]({'where':_0x4431d5})['then'](function(_0x50dd64){if(_0x50dd64){return[_0x50dd64,![]];}_0x380aaa['threadId']=_0xd17a34['body'][_0xdae2('0x90')];_0x380aaa[_0xdae2('0x92')]=_0xd17a34[_0xdae2('0x59')][_0xdae2('0x92')];return db[_0xdae2('0x91')]['create'](_0x380aaa)['then'](function(_0x401ecd){return[_0x401ecd,!![]];});});}else{_0x4431d5['threadId']=null;}_0x4431d5['ContactId']=_0x1b43d1['id'];return db[_0xdae2('0x91')][_0xdae2('0x57')]({'where':_0x4431d5})[_0xdae2('0x24')](function(_0x1fafba){if(_0x1fafba){return[_0x1fafba,![]];}return db['OpenchannelInteraction'][_0xdae2('0x58')](_0x380aaa)[_0xdae2('0x24')](function(_0x207dd6){return[_0x207dd6,!![]];});});}})[_0xdae2('0x93')](function(_0x46f684,_0x279141){if(_0x46f684){_0x541cdd=_0x279141;if(!_0x279141){var _0x433d62={'from':(_0x467a6c[_0xdae2('0x8d')][_0xdae2('0x8e')]||'')+'\x20'+(_0x467a6c[_0xdae2('0x8d')]['lastName']||'')};if(_0xd17a34[_0xdae2('0x59')]['threadId']&&_0xd17a34[_0xdae2('0x59')][_0xdae2('0x94')]&&_0xd17a34['body'][_0xdae2('0x90')]!=_0xd17a34[_0xdae2('0x59')][_0xdae2('0x94')]){_0x433d62['threadId']=_0xd17a34['body'][_0xdae2('0x94')];}return _0x46f684[_0xdae2('0x38')](_0x433d62);}else{return _0x46f684;}}})[_0xdae2('0x24')](function(_0x1abc90){_0x467a6c[_0xdae2('0x95')]=_0x1abc90[_0xdae2('0x5b')]({'plain':!![]});_0x467a6c[_0xdae2('0x95')][_0xdae2('0x96')]=_0x541cdd;if(_0x467a6c[_0xdae2('0x95')][_0xdae2('0x96')]){if(_0x467a6c[_0xdae2('0x89')][_0xdae2('0x97')]){_0x467a6c[_0xdae2('0x8a')]['push']({'id':0x0,'priority':_0x467a6c[_0xdae2('0x8a')][_0xdae2('0x48')]+0x1,'app':'close','appdata':_0xdae2('0x98'),'interval':_0xdae2('0x99')});}}return db[_0xdae2('0x9a')][_0xdae2('0x58')]({'body':_0xd17a34['body'][_0xdae2('0x59')],'OpenchannelAccountId':_0xd17a34[_0xdae2('0x55')]['id'],'OpenchannelInteractionId':_0x1abc90['id'],'direction':'in','ContactId':_0x467a6c[_0xdae2('0x8d')]['id'],'AttachmentId':_0xd17a34[_0xdae2('0x59')][_0xdae2('0x9b')]});})[_0xdae2('0x24')](function(_0x325fca){_0x467a6c['message']=_0x325fca;if(_0x467a6c['interaction']['UserId']){return db['User']['find']({'attributes':['id',_0xdae2('0x3c')],'where':{'id':_0x467a6c[_0xdae2('0x95')][_0xdae2('0x9c')]}})[_0xdae2('0x24')](function(_0x49f21b){if(_0x49f21b){_0x467a6c[_0xdae2('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdae2('0x9d'),'appdata':_0x49f21b[_0xdae2('0x3c')]+','+(_0x467a6c[_0xdae2('0x89')][_0xdae2('0x9e')]||0xa),'interval':_0xdae2('0x99')});_0x467a6c['forcedOwnership']=![];}return respondWithRpcPromise(_0xdae2('0x9f'),_0xdae2('0xa0'),_0x467a6c);});}return respondWithRpcPromise(_0xdae2('0x9f'),_0xdae2('0xa0'),_0x467a6c);})[_0xdae2('0x24')](function(_0x199306){respondWithRpcPromise(_0xdae2('0xa1'),_0xdae2('0xa1'),{'event':_0xdae2('0x72'),'message':_0x199306},client9002);return _0x199306;})['then'](respondWithResult(_0x36a9dc,null))[_0xdae2('0x2e')](handleError(_0x36a9dc,null));};exports[_0xdae2('0xa2')]=function(_0x1189c5,_0x2afb30,_0x4417c7){return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x1189c5['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x2afb30,null))['then'](function(_0x1bd278){if(_0x1bd278){return db[_0xdae2('0xa3')][_0xdae2('0xa4')](function(_0x23837e){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x1189c5[_0xdae2('0x55')]['id']},'transaction':_0x23837e})[_0xdae2('0x24')](function(_0x139980){var _0x270d45=_[_0xdae2('0x4f')](_0x1189c5[_0xdae2('0x59')],function(_0x2c3c41){_0x2c3c41[_0xdae2('0x6a')]=_0x1189c5[_0xdae2('0x55')]['id'];return _0x2c3c41;});return db[_0xdae2('0x87')][_0xdae2('0xa5')](_0x270d45,{'transaction':_0x23837e});});})[_0xdae2('0x24')](function(){return db[_0xdae2('0x87')][_0xdae2('0xa6')]({'where':{'OpenchannelAccountId':_0x1189c5['params']['id']},'order':_0xdae2('0x8b')});});}})[_0xdae2('0x24')](respondWithResult(_0x2afb30,null))[_0xdae2('0x2e')](handleError(_0x2afb30,null));};exports[_0xdae2('0xa7')]=function(_0x260091,_0x46596f,_0x339a98){var _0x35a941={};var _0x4956b4={};var _0x41ec99;var _0x4ee71c;return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x260091['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x46596f,null))[_0xdae2('0x24')](function(_0x418811){if(_0x418811){_0x41ec99=_0x418811;_0x4956b4[_0xdae2('0x41')]=_[_0xdae2('0x42')](db['OpenchannelApplication'][_0xdae2('0x3f')]);_0x4956b4[_0xdae2('0x43')]=_[_0xdae2('0x42')](_0x260091[_0xdae2('0x43')]);_0x4956b4[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x4956b4[_0xdae2('0x41')],_0x4956b4['query']);_0x35a941[_0xdae2('0x47')]=_[_0xdae2('0x45')](_0x4956b4[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x260091[_0xdae2('0x43')][_0xdae2('0x46')]));_0x35a941[_0xdae2('0x47')]=_0x35a941[_0xdae2('0x47')][_0xdae2('0x48')]?_0x35a941[_0xdae2('0x47')]:_0x4956b4[_0xdae2('0x41')];_0x35a941[_0xdae2('0x69')]=qs['sort'](_0x260091[_0xdae2('0x43')]['sort']);_0x35a941['where']=qs[_0xdae2('0x44')](_[_0xdae2('0x4d')](_0x260091[_0xdae2('0x43')],_0x4956b4['filters']));if(_0x260091['query'][_0xdae2('0x51')]){_0x35a941['where']=_[_0xdae2('0x4e')](_0x35a941[_0xdae2('0x4c')],{'$or':_[_0xdae2('0x4f')](_0x35a941[_0xdae2('0x47')],function(_0x137a5f){var _0x46b9ac={};_0x46b9ac[_0x137a5f]={'$like':'%'+_0x260091[_0xdae2('0x43')][_0xdae2('0x51')]+'%'};return _0x46b9ac;})});}_0x35a941=_[_0xdae2('0x4e')]({},_0x35a941,_0x260091['options']);return _0x41ec99[_0xdae2('0xa7')](_0x35a941);}})[_0xdae2('0x24')](function(_0x2739a4){if(_0x2739a4){_0x4ee71c=_0x2739a4[_0xdae2('0x48')];if(!_0x260091[_0xdae2('0x43')]['hasOwnProperty'](_0xdae2('0x4a'))){_0x35a941[_0xdae2('0x32')]=qs['limit'](_0x260091[_0xdae2('0x43')][_0xdae2('0x32')]);_0x35a941[_0xdae2('0x31')]=qs['offset'](_0x260091['query'][_0xdae2('0x31')]);}return _0x41ec99[_0xdae2('0xa7')](_0x35a941);}})[_0xdae2('0x24')](function(_0x2694ee){if(_0x2694ee){return _0x2694ee?{'count':_0x4ee71c,'rows':_0x2694ee}:null;}})['then'](respondWithResult(_0x46596f,null))['catch'](handleError(_0x46596f,null));};exports[_0xdae2('0xa8')]=function(_0x5eca34,_0x29d160,_0x11ca71){var _0x4885fc={'raw':![],'where':{}};var _0x3ce2ab={};var _0x9ef1a2={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5eca34[_0xdae2('0x55')]['id']}})['then'](handleEntityNotFound(_0x29d160,null))[_0xdae2('0x24')](function(_0x1a9b95){if(_0x1a9b95){_0x3ce2ab[_0xdae2('0x41')]=_['keys'](db['OpenchannelInteraction'][_0xdae2('0x3f')]);_0x3ce2ab[_0xdae2('0x43')]=_[_0xdae2('0x42')](_0x5eca34['query']);_0x3ce2ab[_0xdae2('0x44')]=_[_0xdae2('0x45')](_0x3ce2ab[_0xdae2('0x41')],_0x3ce2ab[_0xdae2('0x43')]);_0x4885fc[_0xdae2('0x47')]=_[_0xdae2('0x45')](_0x3ce2ab[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x5eca34[_0xdae2('0x43')][_0xdae2('0x46')]));_0x4885fc['attributes']=_0x4885fc[_0xdae2('0x47')][_0xdae2('0x48')]?_0x4885fc[_0xdae2('0x47')]:_0x3ce2ab[_0xdae2('0x41')];if(!_0x5eca34[_0xdae2('0x43')][_0xdae2('0x49')]('nolimit')){_0x4885fc[_0xdae2('0x32')]=qs[_0xdae2('0x32')](_0x5eca34[_0xdae2('0x43')]['limit']);_0x4885fc[_0xdae2('0x31')]=qs[_0xdae2('0x31')](_0x5eca34[_0xdae2('0x43')][_0xdae2('0x31')]);}_0x4885fc[_0xdae2('0x69')]=qs[_0xdae2('0x4b')](_0x5eca34[_0xdae2('0x43')][_0xdae2('0x4b')]);_0x4885fc[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_['pick'](_0x5eca34['query'],_0x3ce2ab[_0xdae2('0x44')]));_0x4885fc[_0xdae2('0x4c')]['OpenchannelAccountId']=_0x1a9b95['id'];if(_0x5eca34['query'][_0xdae2('0x51')]){_0x4885fc['where']=_[_0xdae2('0x4e')](_0x4885fc[_0xdae2('0x4c')],{'$or':_['map'](_0x4885fc[_0xdae2('0x47')],function(_0x305eb1){var _0x3f3df8={};_0x3f3df8[_0x305eb1]={'$like':'%'+_0x5eca34[_0xdae2('0x43')]['filter']+'%'};return _0x3f3df8;})});}_0x4885fc=_[_0xdae2('0x4e')]({},_0x4885fc,_0x5eca34['options']);return db[_0xdae2('0x91')][_0xdae2('0x30')]({'where':_0x4885fc[_0xdae2('0x4c')]})[_0xdae2('0x24')](function(_0x3fa02e){_0x9ef1a2[_0xdae2('0x30')]=_0x3fa02e;if(_0x5eca34[_0xdae2('0x43')][_0xdae2('0x54')]){_0x4885fc['include']=[{'model':db[_0xdae2('0x84')],'as':'Contact','required':![]},{'model':db[_0xdae2('0xa9')],'as':_0xdae2('0xaa'),'attributes':[_0xdae2('0x3c'),_0xdae2('0xab'),_0xdae2('0xac')],'required':![]},{'model':db['Tag'],'as':_0xdae2('0xad'),'attributes':['id','name','color'],'where':_0x5eca34[_0xdae2('0x43')][_0xdae2('0xae')]?{'id':_0x5eca34['query'][_0xdae2('0xae')]}:undefined,'required':_0x5eca34[_0xdae2('0x43')][_0xdae2('0xae')]?!![]:![]}];}return db[_0xdae2('0x91')]['findAll'](_0x4885fc);})[_0xdae2('0x24')](function(_0x3ec2dd){_0x9ef1a2[_0xdae2('0x6c')]=_0x3ec2dd;return _0x9ef1a2;});}})[_0xdae2('0x24')](respondWithFilteredResult(_0x29d160,_0x4885fc))['catch'](handleError(_0x29d160,null));};exports[_0xdae2('0xaf')]=function(_0x228b09,_0x4a9c91,_0x28b970){return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x228b09['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x4a9c91,null))[_0xdae2('0x24')](function(_0x5a263c){if(_0x5a263c){return _0x5a263c[_0xdae2('0xaf')](_0x228b09['body'][_0xdae2('0x71')],_[_0xdae2('0xb0')](_0x228b09[_0xdae2('0x59')],[_0xdae2('0x71'),'id'])||{})['spread'](function(_0x2d9c67){for(var _0x57835b=0x0;_0x57835b<_0x228b09['body'][_0xdae2('0x71')]['length'];_0x57835b+=0x1){socket[_0xdae2('0xb1')](_0xdae2('0xb2'),{'UserId':_0x228b09[_0xdae2('0x59')][_0xdae2('0x71')][_0x57835b],'OpenchannelAccountId':_0x228b09[_0xdae2('0x55')]['id']});}return _0x2d9c67;});}})[_0xdae2('0x24')](respondWithResult(_0x4a9c91,null))['catch'](handleError(_0x4a9c91,null));};exports['removeAgents']=function(_0x3a3857,_0x42d3f8,_0x38a5cc){return db['OpenchannelAccount'][_0xdae2('0x57')]({'where':{'id':_0x3a3857[_0xdae2('0x55')]['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x42d3f8,null))['then'](function(_0x4a7f74){if(_0x4a7f74){return _0x4a7f74[_0xdae2('0xb3')](_0x3a3857['query'][_0xdae2('0x71')])[_0xdae2('0x24')](function(){if(_['isArray'](_0x3a3857['query'][_0xdae2('0x71')])){for(var _0x30d694=0x0;_0x30d694<_0x3a3857['query'][_0xdae2('0x71')][_0xdae2('0x48')];_0x30d694+=0x1){socket[_0xdae2('0xb1')](_0xdae2('0xb4'),{'UserId':Number(_0x3a3857[_0xdae2('0x43')][_0xdae2('0x71')][_0x30d694]),'OpenchannelAccountId':Number(_0x3a3857[_0xdae2('0x55')]['id'])});}}else{socket[_0xdae2('0xb1')](_0xdae2('0xb4'),{'UserId':Number(_0x3a3857[_0xdae2('0x43')][_0xdae2('0x71')]),'OpenchannelAccountId':Number(_0x3a3857[_0xdae2('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x42d3f8,null))[_0xdae2('0x2e')](handleError(_0x42d3f8,null));};exports['getAgents']=function(_0x2411db,_0x2d9fdf,_0x42080e){var _0x5b7504={};var _0x160b9f={};var _0x2b911d;var _0x65ad2;return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x2411db['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x2d9fdf,null))[_0xdae2('0x24')](function(_0x400b15){if(_0x400b15){_0x2b911d=_0x400b15;_0x160b9f[_0xdae2('0x41')]=_[_0xdae2('0x42')](db['User'][_0xdae2('0x3f')]);_0x160b9f['query']=_['keys'](_0x2411db['query']);_0x160b9f[_0xdae2('0x44')]=_['intersection'](_0x160b9f[_0xdae2('0x41')],_0x160b9f['query']);_0x5b7504['attributes']=_[_0xdae2('0x45')](_0x160b9f[_0xdae2('0x41')],qs[_0xdae2('0x46')](_0x2411db[_0xdae2('0x43')][_0xdae2('0x46')]));_0x5b7504[_0xdae2('0x47')]=_0x5b7504[_0xdae2('0x47')][_0xdae2('0x48')]?_0x5b7504[_0xdae2('0x47')]:_0x160b9f['model'];_0x5b7504['order']=qs[_0xdae2('0x4b')](_0x2411db[_0xdae2('0x43')][_0xdae2('0x4b')]);_0x5b7504[_0xdae2('0x4c')]=qs[_0xdae2('0x44')](_[_0xdae2('0x4d')](_0x2411db[_0xdae2('0x43')],_0x160b9f['filters']));if(_0x2411db[_0xdae2('0x43')][_0xdae2('0x51')]){_0x5b7504[_0xdae2('0x4c')]=_[_0xdae2('0x4e')](_0x5b7504[_0xdae2('0x4c')],{'$or':_[_0xdae2('0x4f')](_0x5b7504['attributes'],function(_0x13c2ac){var _0x8b5a7a={};_0x8b5a7a[_0x13c2ac]={'$like':'%'+_0x2411db[_0xdae2('0x43')]['filter']+'%'};return _0x8b5a7a;})});}_0x5b7504=_[_0xdae2('0x4e')]({},_0x5b7504,_0x2411db[_0xdae2('0x52')]);return _0x2b911d[_0xdae2('0xb5')](_0x5b7504);}})[_0xdae2('0x24')](function(_0x18fe8f){if(_0x18fe8f){_0x65ad2=_0x18fe8f['length'];if(!_0x2411db[_0xdae2('0x43')][_0xdae2('0x49')](_0xdae2('0x4a'))){_0x5b7504['limit']=qs[_0xdae2('0x32')](_0x2411db[_0xdae2('0x43')][_0xdae2('0x32')]);_0x5b7504['offset']=qs[_0xdae2('0x31')](_0x2411db[_0xdae2('0x43')][_0xdae2('0x31')]);}return _0x2b911d[_0xdae2('0xb5')](_0x5b7504);}})[_0xdae2('0x24')](function(_0x56d5be){if(_0x56d5be){return _0x56d5be?{'count':_0x65ad2,'rows':_0x56d5be}:null;}})[_0xdae2('0x24')](respondWithResult(_0x2d9fdf,null))[_0xdae2('0x2e')](handleError(_0x2d9fdf,null));};exports[_0xdae2('0xb6')]=function(_0x41af76,_0x18c7ab,_0x49f447){var _0x2f22ac,_0x4807e1,_0x47ad00;if(_[_0xdae2('0x7a')](_0x41af76[_0xdae2('0x59')]['body'])||_0x41af76[_0xdae2('0x59')][_0xdae2('0x59')]===''){throw new db[(_0xdae2('0x20'))]['ValidationError'](_0xdae2('0x7d'));}if(_['isNil'](_0x41af76[_0xdae2('0x59')]['to'])){}_0x2f22ac=_0x41af76[_0xdae2('0x59')]['to'];return db[_0xdae2('0x53')][_0xdae2('0x68')]({'where':{'id':_0x41af76['params']['id']}})[_0xdae2('0x24')](handleEntityNotFound(_0x18c7ab,null))[_0xdae2('0x24')](function(_0x4b9b07){if(_0x4b9b07){return db[_0xdae2('0x53')][_0xdae2('0x57')]({'where':{'id':_0x4b9b07['id']},'include':[{'model':db[_0xdae2('0x82')],'as':_0xdae2('0x83'),'include':[{'model':db[_0xdae2('0x84')],'as':_0xdae2('0x85'),'where':{[_0x4b9b07[_0xdae2('0x7e')]]:_0x2f22ac},'limit':0x1,'order':[[_0xdae2('0x77'),_0xdae2('0x86')]]}]}]})[_0xdae2('0x24')](handleEntityNotFound(_0x18c7ab,null))[_0xdae2('0x24')](function(_0x125d3f){if(_0x125d3f&&_0x125d3f[_0xdae2('0x83')]){_0x4807e1=_0x125d3f[_0xdae2('0x5b')]({'plain':!![]});if(_0x4807e1[_0xdae2('0x83')]&&_0x4807e1[_0xdae2('0x83')]['Contacts'][_0xdae2('0x48')]){return _0x4807e1['List'][_0xdae2('0x85')][0x0];}return db[_0xdae2('0x84')][_0xdae2('0x58')](_['defaults'](_0x41af76['body'],{'firstName':_0x2f22ac,[_0x125d3f[_0xdae2('0x7e')]]:_0x2f22ac,'phone':_0x2f22ac,'ListId':_0x4807e1[_0xdae2('0x79')]}));}})['then'](handleEntityNotFound(_0x18c7ab,null))['then'](function(_0x19c36a){if(_0x19c36a){_0x47ad00=_0x19c36a;return db[_0xdae2('0x91')][_0xdae2('0x57')]({'where':{'ContactId':_0x47ad00['id'],'closed':![],'OpenchannelAccountId':_0x4807e1['id']}})[_0xdae2('0x24')](function(_0x3ec9ba){if(_0x3ec9ba){return[_0x3ec9ba,![]];}return db[_0xdae2('0x91')][_0xdae2('0x58')]({'UserId':_0x41af76[_0xdae2('0x5a')]['id'],'ContactId':_0x47ad00['id'],'OpenchannelAccountId':_0x4807e1['id'],'lastMsgDirection':_0xdae2('0xb7'),'Messages':[_[_0xdae2('0x4e')](_0x41af76[_0xdae2('0x59')],{'read':![],'body':_0x41af76[_0xdae2('0x59')]['body'],'OpenchannelAccountId':_0x4807e1['id'],'UserId':_0x41af76[_0xdae2('0x5a')]['id'],'ContactId':_0x47ad00['id']})]},{'include':[{'model':db[_0xdae2('0x9a')],'as':'Messages'}]})[_0xdae2('0x24')](function(_0x29395e){return[_0x29395e,!![]];});});}})[_0xdae2('0x93')](function(_0x4f0359,_0x277809){if(_0x277809){return _0x4f0359;}return db['OpenchannelMessage'][_0xdae2('0x58')](_[_0xdae2('0x4e')](_0x41af76[_0xdae2('0x59')],{'read':![],'body':_0x41af76[_0xdae2('0x59')][_0xdae2('0x59')],'OpenchannelAccountId':_0x4807e1['id'],'OpenchannelInteractionId':_0x4f0359['id'],'UserId':_0x41af76['user']['id'],'ContactId':_0x47ad00['id']}))[_0xdae2('0x24')](function(_0x13e10d){_0x4f0359['dataValues'][_0xdae2('0xb8')]=[];_0x4f0359[_0xdae2('0xb9')][_0xdae2('0xb8')]['push'](_0x13e10d[_0xdae2('0xb9')]);return _0x4f0359;});});}})[_0xdae2('0x24')](respondWithResult(_0x18c7ab,null))[_0xdae2('0x2e')](handleError(_0x18c7ab,null));}; \ No newline at end of file +var _0xb106=['json','count','offset','limit','set','apply','reject','save','destroy','get','OpenchannelAccounts','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','ids','notify','openchannel','CmContact','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','CmList','DESC','Applications','List','account','applications','orderBy','priority','defaults','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','Contacts','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','./openchannelAccount.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~!@#$%^&-_=+[{]}.','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end'];(function(_0x3d017e,_0x4bd1bb){var _0x300160=function(_0x54b05a){while(--_0x54b05a){_0x3d017e['push'](_0x3d017e['shift']());}};_0x300160(++_0x4bd1bb);}(_0xb106,0x144));var _0x6b10=function(_0x528342,_0x17a981){_0x528342=_0x528342-0x0;var _0x27dd91=_0xb106[_0x528342];return _0x27dd91;};'use strict';var pdf=require(_0x6b10('0x0'));var emlformat=require(_0x6b10('0x1'));var rimraf=require(_0x6b10('0x2'));var zipdir=require(_0x6b10('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b10('0x4'));var moment=require('moment');var BPromise=require(_0x6b10('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6b10('0x6'));var sox=require(_0x6b10('0x7'));var csv=require(_0x6b10('0x8'));var ejs=require(_0x6b10('0x9'));var fs=require('fs');var _=require(_0x6b10('0xa'));var squel=require(_0x6b10('0xb'));var crypto=require(_0x6b10('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b10('0xd'));var Papa=require(_0x6b10('0xe'));var Redis=require(_0x6b10('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6b10('0x10'));var as=require(_0x6b10('0x11'));var hardwareService=require(_0x6b10('0x12'));var logger=require(_0x6b10('0x13'))(_0x6b10('0x14'));var utils=require(_0x6b10('0x15'));var config=require(_0x6b10('0x16'));var db=require('../../mysqldb')['db'];config[_0x6b10('0x17')]=_['defaults'](config[_0x6b10('0x17')],{'host':_0x6b10('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b10('0x17')]));require(_0x6b10('0x19'))['register'](socket);var jayson=require(_0x6b10('0x1a'));var client=jayson[_0x6b10('0x1b')][_0x6b10('0x1c')]({'port':0x232c});var client9002=jayson[_0x6b10('0x1b')][_0x6b10('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x304bd1,_0x3fe4a4,_0x4f5c3d){if(_0x4f5c3d){var _0x5c5c56=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c5c56[_0x6b10('0x1d')](_0x3fe4a4)){return _0x304bd1;}else{throw new db[(_0x6b10('0x1e'))]['ValidationError'](_0x6b10('0x1f'));}}else{return _0x304bd1;}}function respondWithRpcPromise(_0x34a1a5,_0x8d3581,_0x48d40f,_0x404c6f){return new BPromise(function(_0x1813b4,_0xbfd954){var _0x1f7aed=_0x404c6f||client;return _0x1f7aed['request'](_0x34a1a5,_0x48d40f)[_0x6b10('0x20')](function(_0x57c688){logger[_0x6b10('0x21')](_0x6b10('0x22'),_0x8d3581,'request\x20sent');logger[_0x6b10('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x8d3581,_0x6b10('0x24'),JSON[_0x6b10('0x25')](_0x57c688));if(_0x57c688[_0x6b10('0x26')]){if(_0x57c688[_0x6b10('0x26')][_0x6b10('0x27')]===0x1f4){logger[_0x6b10('0x26')](_0x6b10('0x22'),_0x8d3581,_0x57c688[_0x6b10('0x26')][_0x6b10('0x28')]);return _0xbfd954(_0x57c688[_0x6b10('0x26')]['message']);}logger[_0x6b10('0x26')](_0x6b10('0x22'),_0x8d3581,_0x57c688[_0x6b10('0x26')][_0x6b10('0x28')]);return _0x1813b4(_0x57c688['error'][_0x6b10('0x28')]);}else{logger[_0x6b10('0x21')](_0x6b10('0x22'),_0x8d3581,_0x6b10('0x24'));_0x1813b4(_0x57c688[_0x6b10('0x29')][_0x6b10('0x28')]);}})[_0x6b10('0x2a')](function(_0xfafe02){logger['error'](_0x6b10('0x22'),_0x8d3581,_0xfafe02);_0xbfd954(_0xfafe02);});});}function respondWithStatusCode(_0x1552ba,_0xac6d8e){_0xac6d8e=_0xac6d8e||0xcc;return function(_0x3af19d){if(_0x3af19d){return _0x1552ba[_0x6b10('0x2b')](_0xac6d8e);}return _0x1552ba[_0x6b10('0x2c')](_0xac6d8e)[_0x6b10('0x2d')]();};}function respondWithResult(_0x23329a,_0x17d798){_0x17d798=_0x17d798||0xc8;return function(_0x33421e){if(_0x33421e){return _0x23329a[_0x6b10('0x2c')](_0x17d798)[_0x6b10('0x2e')](_0x33421e);}};}function respondWithFilteredResult(_0x49e2f5,_0x3f0304){return function(_0x255dff){if(_0x255dff){var _0x59b560=_0x255dff[_0x6b10('0x2f')],_0x43096a=_0x3f0304[_0x6b10('0x30')],_0x2a9de1=_0x3f0304[_0x6b10('0x30')]+_0x3f0304[_0x6b10('0x31')],_0x4500aa;if(_0x2a9de1>=_0x59b560){_0x2a9de1=_0x59b560;_0x4500aa=0xc8;}else{_0x4500aa=0xce;}_0x49e2f5[_0x6b10('0x2c')](_0x4500aa);return _0x49e2f5[_0x6b10('0x32')]('Content-Range',_0x43096a+'-'+_0x2a9de1+'/'+_0x59b560)[_0x6b10('0x2e')](_0x255dff);}return null;};}function patchUpdates(_0x49fcd3){return function(_0x2fb452){try{jsonpatch[_0x6b10('0x33')](_0x2fb452,_0x49fcd3,!![]);}catch(_0x17dbe5){return BPromise[_0x6b10('0x34')](_0x17dbe5);}return _0x2fb452[_0x6b10('0x35')]();};}function saveUpdates(_0x3add4c,_0x3e6b1a){return function(_0x547b21){if(_0x547b21){return _0x547b21['update'](_0x3add4c)['then'](function(_0x207b8c){return _0x207b8c;});}return null;};}function removeEntity(_0x2900bb,_0x45e8be){return function(_0x6a40ec){if(_0x6a40ec){return _0x6a40ec[_0x6b10('0x36')]()[_0x6b10('0x20')](function(){var _0x345298=_0x6a40ec[_0x6b10('0x37')]({'plain':!![]});var _0x285669=_0x6b10('0x38');return db['UserProfileResource'][_0x6b10('0x36')]({'where':{'type':_0x285669,'resourceId':_0x345298['id']}})[_0x6b10('0x20')](function(){return _0x6a40ec;});})['then'](function(){_0x2900bb[_0x6b10('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26a2b8,_0x4b8510){return function(_0x1fbbfb){if(!_0x1fbbfb){_0x26a2b8[_0x6b10('0x2b')](0x194);}return _0x1fbbfb;};}function handleError(_0x92c5e9,_0x2e3088){_0x2e3088=_0x2e3088||0x1f4;return function(_0x2d5c3a){logger['error'](_0x2d5c3a['stack']);if(_0x2d5c3a[_0x6b10('0x39')]){delete _0x2d5c3a[_0x6b10('0x39')];}_0x92c5e9[_0x6b10('0x2c')](_0x2e3088)['send'](_0x2d5c3a);};}exports[_0x6b10('0x3a')]=function(_0x502c17,_0x2b50b6){var _0x31fd2c={'include':[{'model':db[_0x6b10('0x3b')],'as':_0x6b10('0x3c')}]},_0x32b4cd={},_0x46359d={'count':0x0,'rows':[]};var _0x53ef2e=_[_0x6b10('0x3d')](db[_0x6b10('0x3e')][_0x6b10('0x3f')],function(_0xc05c7b){return{'name':_0xc05c7b[_0x6b10('0x40')],'type':_0xc05c7b[_0x6b10('0x41')][_0x6b10('0x42')]};});_0x32b4cd['model']=_[_0x6b10('0x3d')](_0x53ef2e,_0x6b10('0x39'));_0x32b4cd[_0x6b10('0x43')]=_[_0x6b10('0x44')](_0x502c17[_0x6b10('0x43')]);_0x32b4cd[_0x6b10('0x45')]=_[_0x6b10('0x46')](_0x32b4cd[_0x6b10('0x47')],_0x32b4cd['query']);_0x31fd2c['attributes']=_['intersection'](_0x32b4cd[_0x6b10('0x47')],qs[_0x6b10('0x48')](_0x502c17[_0x6b10('0x43')][_0x6b10('0x48')]));_0x31fd2c['attributes']=_0x31fd2c[_0x6b10('0x49')][_0x6b10('0x4a')]?_0x31fd2c['attributes']:_0x32b4cd[_0x6b10('0x47')];if(!_0x502c17['query'][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x31fd2c[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x502c17[_0x6b10('0x43')][_0x6b10('0x31')]);_0x31fd2c['offset']=qs[_0x6b10('0x30')](_0x502c17[_0x6b10('0x43')]['offset']);}_0x31fd2c[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x502c17[_0x6b10('0x43')][_0x6b10('0x4e')]);_0x31fd2c[_0x6b10('0x4f')]=qs[_0x6b10('0x45')](_['pick'](_0x502c17[_0x6b10('0x43')],_0x32b4cd[_0x6b10('0x45')]),_0x53ef2e);if(_0x502c17[_0x6b10('0x43')]['filter']){_0x31fd2c[_0x6b10('0x4f')]=_[_0x6b10('0x50')](_0x31fd2c[_0x6b10('0x4f')],{'$or':_[_0x6b10('0x3d')](_0x53ef2e,function(_0xf4ae95){if(_0xf4ae95[_0x6b10('0x41')]!=='VIRTUAL'){var _0x25fce3={};_0x25fce3[_0xf4ae95[_0x6b10('0x39')]]={'$like':'%'+_0x502c17['query'][_0x6b10('0x51')]+'%'};return _0x25fce3;}})});}_0x31fd2c=_[_0x6b10('0x50')]({},_0x31fd2c,_0x502c17[_0x6b10('0x52')]);var _0x22446d={'where':_0x31fd2c[_0x6b10('0x4f')]};return db[_0x6b10('0x3e')][_0x6b10('0x2f')](_0x22446d)['then'](function(_0x57ea6b){_0x46359d[_0x6b10('0x2f')]=_0x57ea6b;if(_0x502c17[_0x6b10('0x43')][_0x6b10('0x53')]){_0x31fd2c[_0x6b10('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x6b10('0x55')](_0x31fd2c);})[_0x6b10('0x20')](function(_0x92268a){_0x46359d[_0x6b10('0x56')]=_0x92268a;return _0x46359d;})[_0x6b10('0x20')](respondWithFilteredResult(_0x2b50b6,_0x31fd2c))['catch'](handleError(_0x2b50b6,null));};exports[_0x6b10('0x57')]=function(_0x3c572b,_0x2c4276){var _0x4d67e4={'raw':![],'where':{'id':_0x3c572b['params']['id']},'include':[{'model':db[_0x6b10('0x3b')],'as':'mandatoryDispositionPause'}]},_0x28ca69={};_0x28ca69[_0x6b10('0x47')]=_[_0x6b10('0x44')](db[_0x6b10('0x3e')][_0x6b10('0x3f')]);_0x28ca69[_0x6b10('0x43')]=_[_0x6b10('0x44')](_0x3c572b[_0x6b10('0x43')]);_0x28ca69['filters']=_[_0x6b10('0x46')](_0x28ca69['model'],_0x28ca69[_0x6b10('0x43')]);_0x4d67e4[_0x6b10('0x49')]=_[_0x6b10('0x46')](_0x28ca69['model'],qs[_0x6b10('0x48')](_0x3c572b[_0x6b10('0x43')][_0x6b10('0x48')]));_0x4d67e4[_0x6b10('0x49')]=_0x4d67e4[_0x6b10('0x49')]['length']?_0x4d67e4[_0x6b10('0x49')]:_0x28ca69[_0x6b10('0x47')];if(_0x3c572b[_0x6b10('0x43')][_0x6b10('0x53')]){_0x4d67e4[_0x6b10('0x54')]=[{'all':!![]}];}_0x4d67e4=_['merge']({},_0x4d67e4,_0x3c572b['options']);return db[_0x6b10('0x3e')]['find'](_0x4d67e4)['then'](handleEntityNotFound(_0x2c4276,null))[_0x6b10('0x20')](respondWithResult(_0x2c4276,null))[_0x6b10('0x2a')](handleError(_0x2c4276,null));};exports[_0x6b10('0x58')]=function(_0x558a7b,_0x1aa148){return db['OpenchannelAccount'][_0x6b10('0x58')](_0x558a7b[_0x6b10('0x59')],{})[_0x6b10('0x20')](function(_0x37ded7){var _0x4235d3=_0x558a7b[_0x6b10('0x5a')][_0x6b10('0x37')]({'plain':!![]});if(!_0x4235d3)throw new Error(_0x6b10('0x5b'));if(_0x4235d3[_0x6b10('0x5c')]===_0x6b10('0x5a')){var _0x51fa7e=_0x37ded7['get']({'plain':!![]});var _0x51c04d='OpenchannelAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x51c04d,'userProfileId':_0x4235d3[_0x6b10('0x5d')]},'raw':!![]})[_0x6b10('0x20')](function(_0x3fcbe6){if(_0x3fcbe6&&_0x3fcbe6[_0x6b10('0x5e')]===0x0){return db['UserProfileResource'][_0x6b10('0x58')]({'name':_0x51fa7e['name'],'resourceId':_0x51fa7e['id'],'type':_0x3fcbe6[_0x6b10('0x39')],'sectionId':_0x3fcbe6['id']},{})[_0x6b10('0x20')](function(){return _0x37ded7;});}else{return _0x37ded7;}})[_0x6b10('0x2a')](function(_0xe6c3ec){logger['error'](_0x6b10('0x5f'),_0xe6c3ec);throw _0xe6c3ec;});}return _0x37ded7;})['then'](respondWithResult(_0x1aa148,0xc9))[_0x6b10('0x2a')](handleError(_0x1aa148,null));};exports['update']=function(_0x446794,_0x5e0f95){if(_0x446794[_0x6b10('0x59')]['id']){delete _0x446794[_0x6b10('0x59')]['id'];}return db[_0x6b10('0x3e')][_0x6b10('0x60')]({'where':{'id':_0x446794[_0x6b10('0x61')]['id']},'include':[{'model':db[_0x6b10('0x3b')],'as':_0x6b10('0x3c')}]})[_0x6b10('0x20')](handleEntityNotFound(_0x5e0f95,null))[_0x6b10('0x20')](saveUpdates(_0x446794[_0x6b10('0x59')],null))[_0x6b10('0x20')](respondWithResult(_0x5e0f95,null))[_0x6b10('0x2a')](handleError(_0x5e0f95,null));};exports['destroy']=function(_0x148b9b,_0x5b0242){return db['OpenchannelAccount'][_0x6b10('0x60')]({'where':{'id':_0x148b9b[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x5b0242,null))[_0x6b10('0x20')](removeEntity(_0x5b0242,null))['catch'](handleError(_0x5b0242,null));};exports['describe']=function(_0x2eee98,_0x3fa8f1){return db[_0x6b10('0x3e')]['describe']()[_0x6b10('0x20')](respondWithResult(_0x3fa8f1,null))[_0x6b10('0x2a')](handleError(_0x3fa8f1,null));};exports[_0x6b10('0x62')]=function(_0x5acf52,_0x276629,_0x3f5145){if(_0x5acf52[_0x6b10('0x59')]['id']){delete _0x5acf52[_0x6b10('0x59')]['id'];}return db[_0x6b10('0x3e')][_0x6b10('0x60')]({'where':{'id':_0x5acf52[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x276629,null))['then'](function(_0x57fa24){if(_0x57fa24){_0x5acf52[_0x6b10('0x59')]['OpnechannelAccountId']=_0x57fa24['id'];return db[_0x6b10('0x63')][_0x6b10('0x58')](_0x5acf52[_0x6b10('0x59')]);}})[_0x6b10('0x20')](respondWithResult(_0x276629,null))[_0x6b10('0x2a')](handleError(_0x276629,null));};exports[_0x6b10('0x64')]=function(_0x4f730b,_0x49520a,_0x4f08af){var _0x49bb92={'raw':![],'where':{}};var _0x4c7d22={};var _0x476707={'count':0x0,'rows':[]};return db[_0x6b10('0x3e')][_0x6b10('0x65')]({'where':{'id':_0x4f730b['params']['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x49520a,null))[_0x6b10('0x20')](function(_0x1dc190){if(_0x1dc190){_0x4c7d22['model']=_['keys'](db[_0x6b10('0x63')][_0x6b10('0x3f')]);_0x4c7d22['query']=_[_0x6b10('0x44')](_0x4f730b[_0x6b10('0x43')]);_0x4c7d22[_0x6b10('0x45')]=_[_0x6b10('0x46')](_0x4c7d22[_0x6b10('0x47')],_0x4c7d22['query']);_0x49bb92['attributes']=_[_0x6b10('0x46')](_0x4c7d22[_0x6b10('0x47')],qs[_0x6b10('0x48')](_0x4f730b[_0x6b10('0x43')][_0x6b10('0x48')]));_0x49bb92[_0x6b10('0x49')]=_0x49bb92['attributes'][_0x6b10('0x4a')]?_0x49bb92[_0x6b10('0x49')]:_0x4c7d22[_0x6b10('0x47')];if(!_0x4f730b[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x49bb92[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x4f730b[_0x6b10('0x43')][_0x6b10('0x31')]);_0x49bb92[_0x6b10('0x30')]=qs[_0x6b10('0x30')](_0x4f730b[_0x6b10('0x43')]['offset']);}_0x49bb92[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x4f730b[_0x6b10('0x43')][_0x6b10('0x4e')]);_0x49bb92[_0x6b10('0x4f')]=qs[_0x6b10('0x45')](_['pick'](_0x4f730b[_0x6b10('0x43')],_0x4c7d22['filters']));_0x49bb92['where'][_0x6b10('0x66')]=_0x1dc190['id'];if(_0x4f730b[_0x6b10('0x43')][_0x6b10('0x51')]){_0x49bb92[_0x6b10('0x4f')]=_['merge'](_0x49bb92[_0x6b10('0x4f')],{'$or':_[_0x6b10('0x3d')](_0x49bb92[_0x6b10('0x49')],function(_0x264b7a){var _0x27d52c={};_0x27d52c[_0x264b7a]={'$like':'%'+_0x4f730b[_0x6b10('0x43')]['filter']+'%'};return _0x27d52c;})});}_0x49bb92=_[_0x6b10('0x50')]({},_0x49bb92,_0x4f730b[_0x6b10('0x52')]);return db[_0x6b10('0x63')]['count']({'where':_0x49bb92['where']})['then'](function(_0x387549){_0x476707[_0x6b10('0x2f')]=_0x387549;if(_0x4f730b[_0x6b10('0x43')][_0x6b10('0x53')]){_0x49bb92[_0x6b10('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x6b10('0x55')](_0x49bb92);})['then'](function(_0x14d9f6){_0x476707[_0x6b10('0x56')]=_0x14d9f6;return _0x476707;});}})[_0x6b10('0x20')](respondWithFilteredResult(_0x49520a,_0x49bb92))['catch'](handleError(_0x49520a,null));};exports[_0x6b10('0x67')]=function(_0xaf4197,_0x2352dc,_0x4e71b3){return db[_0x6b10('0x3e')]['find']({'where':{'id':_0xaf4197[_0x6b10('0x61')]['id']}})['then'](handleEntityNotFound(_0x2352dc,null))['then'](function(_0x356304){if(_0x356304){return _0x356304['removeDispositions'](_0xaf4197[_0x6b10('0x43')]['ids']);}})[_0x6b10('0x20')](respondWithStatusCode(_0x2352dc,null))[_0x6b10('0x2a')](handleError(_0x2352dc,null));};exports[_0x6b10('0x68')]=function(_0xeb3df5,_0x5de896,_0xaf59ab){if(_0xeb3df5[_0x6b10('0x59')]['id']){delete _0xeb3df5['body']['id'];}return db[_0x6b10('0x3e')][_0x6b10('0x60')]({'where':{'id':_0xeb3df5[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x5de896,null))['then'](function(_0xe8c89){if(_0xe8c89){_0xeb3df5['body'][_0x6b10('0x66')]=_0xe8c89['id'];return db[_0x6b10('0x69')][_0x6b10('0x58')](_0xeb3df5[_0x6b10('0x59')]);}})['then'](respondWithResult(_0x5de896,null))[_0x6b10('0x2a')](handleError(_0x5de896,null));};exports[_0x6b10('0x6a')]=function(_0x451451,_0x57049e,_0x3f6113){var _0x279603={'raw':![],'where':{}};var _0x565614={};var _0x5ebf97={'count':0x0,'rows':[]};return db[_0x6b10('0x3e')][_0x6b10('0x65')]({'where':{'id':_0x451451[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x57049e,null))[_0x6b10('0x20')](function(_0x1efeac){if(_0x1efeac){_0x565614[_0x6b10('0x47')]=_['keys'](db[_0x6b10('0x69')][_0x6b10('0x3f')]);_0x565614[_0x6b10('0x43')]=_['keys'](_0x451451['query']);_0x565614[_0x6b10('0x45')]=_[_0x6b10('0x46')](_0x565614[_0x6b10('0x47')],_0x565614[_0x6b10('0x43')]);_0x279603[_0x6b10('0x49')]=_[_0x6b10('0x46')](_0x565614[_0x6b10('0x47')],qs['fields'](_0x451451[_0x6b10('0x43')][_0x6b10('0x48')]));_0x279603[_0x6b10('0x49')]=_0x279603[_0x6b10('0x49')][_0x6b10('0x4a')]?_0x279603['attributes']:_0x565614[_0x6b10('0x47')];if(!_0x451451[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x279603[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x451451[_0x6b10('0x43')]['limit']);_0x279603['offset']=qs[_0x6b10('0x30')](_0x451451[_0x6b10('0x43')][_0x6b10('0x30')]);}_0x279603[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x451451[_0x6b10('0x43')]['sort']);_0x279603[_0x6b10('0x4f')]=qs[_0x6b10('0x45')](_[_0x6b10('0x6b')](_0x451451[_0x6b10('0x43')],_0x565614[_0x6b10('0x45')]));_0x279603[_0x6b10('0x4f')][_0x6b10('0x66')]=_0x1efeac['id'];if(_0x451451[_0x6b10('0x43')][_0x6b10('0x51')]){_0x279603['where']=_[_0x6b10('0x50')](_0x279603['where'],{'$or':_[_0x6b10('0x3d')](_0x279603[_0x6b10('0x49')],function(_0x288cbd){var _0x1171b9={};_0x1171b9[_0x288cbd]={'$like':'%'+_0x451451[_0x6b10('0x43')][_0x6b10('0x51')]+'%'};return _0x1171b9;})});}_0x279603=_[_0x6b10('0x50')]({},_0x279603,_0x451451['options']);return db[_0x6b10('0x69')][_0x6b10('0x2f')]({'where':_0x279603[_0x6b10('0x4f')]})[_0x6b10('0x20')](function(_0xd09f9a){_0x5ebf97[_0x6b10('0x2f')]=_0xd09f9a;if(_0x451451[_0x6b10('0x43')][_0x6b10('0x53')]){_0x279603[_0x6b10('0x54')]=[{'all':!![]}];}return db[_0x6b10('0x69')][_0x6b10('0x55')](_0x279603);})[_0x6b10('0x20')](function(_0x2af676){_0x5ebf97[_0x6b10('0x56')]=_0x2af676;return _0x5ebf97;});}})[_0x6b10('0x20')](respondWithFilteredResult(_0x57049e,_0x279603))[_0x6b10('0x2a')](handleError(_0x57049e,null));};exports[_0x6b10('0x6c')]=function(_0x22c3b5,_0x40c972,_0xc72632){return db['OpenchannelAccount']['find']({'where':{'id':_0x22c3b5[_0x6b10('0x61')]['id']}})['then'](handleEntityNotFound(_0x40c972,null))[_0x6b10('0x20')](function(_0xa8a4aa){if(_0xa8a4aa){return _0xa8a4aa[_0x6b10('0x6c')](_0x22c3b5[_0x6b10('0x43')][_0x6b10('0x6d')]);}})['then'](respondWithStatusCode(_0x40c972,null))[_0x6b10('0x2a')](handleError(_0x40c972,null));};exports[_0x6b10('0x6e')]=function(_0x1bdfdf,_0x3c24e9,_0x92bd99){var _0x2c4a13={'body':_0x1bdfdf[_0x6b10('0x59')],'channel':_0x6b10('0x6f')};var _0x3a9c11=[];var _0x5aa522=[];var _0x4db4ca={};var _0x3c97aa=![];return db[_0x6b10('0x70')]['describe']()[_0x6b10('0x20')](function(_0x4d7083){if(!_0x4d7083){throw new db['Sequelize'][(_0x6b10('0x71'))](_0x6b10('0x72'));}_0x3a9c11=_[_0x6b10('0x73')](_[_0x6b10('0x44')](_0x4d7083),[_0x6b10('0x74'),_0x6b10('0x75')]);_0x5aa522=_[_0x6b10('0x73')](_[_0x6b10('0x44')](_0x4d7083),[_0x6b10('0x74'),_0x6b10('0x75'),_0x6b10('0x76'),_0x6b10('0x77')]);if(_0x1bdfdf['body']['id']){delete _0x1bdfdf[_0x6b10('0x59')]['id'];}if(_[_0x6b10('0x78')](_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x79')])){throw new db['Sequelize'][(_0x6b10('0x71'))](_0x6b10('0x7a'));}if(_[_0x6b10('0x78')](_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x59')])||_0x1bdfdf['body'][_0x6b10('0x59')]===''){throw new db[(_0x6b10('0x1e'))][(_0x6b10('0x71'))](_0x6b10('0x7b'));}if(_[_0x6b10('0x78')](_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x7c')])){throw new db[(_0x6b10('0x1e'))][(_0x6b10('0x71'))](_0x6b10('0x7d')+_0x5aa522);}if(!_[_0x6b10('0x7e')](_0x5aa522,_0x1bdfdf['body'][_0x6b10('0x7c')])){throw new db[(_0x6b10('0x1e'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5aa522);}_0x4db4ca[_0x1bdfdf[_0x6b10('0x59')]['mapKey']]=_0x1bdfdf[_0x6b10('0x59')]['from'];})[_0x6b10('0x20')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x1bdfdf['params']['id']},'include':[{'model':db[_0x6b10('0x7f')],'as':'List','include':[{'model':db[_0x6b10('0x70')],'as':'Contacts','where':_0x4db4ca,'limit':0x1,'order':[[_0x6b10('0x75'),_0x6b10('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x6b10('0x81')}]});})[_0x6b10('0x20')](handleEntityNotFound(_0x3c24e9,null))[_0x6b10('0x20')](function(_0x54ee48){if(_0x54ee48&&_0x54ee48[_0x6b10('0x82')]){_0x2c4a13[_0x6b10('0x83')]=_0x54ee48;_0x2c4a13[_0x6b10('0x84')]=_0x54ee48['Applications'];_0x2c4a13['list']=_0x54ee48[_0x6b10('0x82')];_0x2c4a13[_0x6b10('0x84')]=_[_0x6b10('0x85')](_0x2c4a13[_0x6b10('0x84')],[_0x6b10('0x86')],['asc']);if(_0x2c4a13['account'][_0x6b10('0x81')]){delete _0x2c4a13['account'][_0x6b10('0x81')];}if(_0x2c4a13[_0x6b10('0x83')]['List']&&_0x2c4a13[_0x6b10('0x83')][_0x6b10('0x82')]['Contacts']['length']){return _0x2c4a13[_0x6b10('0x83')][_0x6b10('0x82')]['Contacts'][0x0];}var _0x4419ec=_[_0x6b10('0x87')](_0x1bdfdf[_0x6b10('0x59')],{'firstName':_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x79')],'ListId':_0x54ee48['ListId']});_0x4419ec[_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x7c')]]=_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x79')];return db[_0x6b10('0x70')][_0x6b10('0x58')](_0x4419ec,{'fields':_0x3a9c11,'raw':!![]});}})[_0x6b10('0x20')](handleEntityNotFound(_0x3c24e9,null))[_0x6b10('0x20')](function(_0x272009){_0x2c4a13[_0x6b10('0x88')]=_0x272009;if(_0x272009){var _0x51f1eb={'ContactId':_0x272009['id'],'OpenchannelAccountId':_0x1bdfdf[_0x6b10('0x61')]['id'],'from':(_0x272009[_0x6b10('0x89')]||'')+'\x20'+(_0x272009['lastName']||'')};var _0x1e9374={'OpenchannelAccountId':_0x1bdfdf[_0x6b10('0x61')]['id'],'closed':![]};if(_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x8a')]){_0x1e9374[_0x6b10('0x8a')]=_0x1bdfdf['body'][_0x6b10('0x8a')];return db[_0x6b10('0x8b')][_0x6b10('0x60')]({'where':_0x1e9374})[_0x6b10('0x20')](function(_0x5337e7){if(_0x5337e7){return[_0x5337e7,![]];}_0x51f1eb[_0x6b10('0x8a')]=_0x1bdfdf['body'][_0x6b10('0x8a')];_0x51f1eb[_0x6b10('0x8c')]=_0x1bdfdf['body']['externalUrl'];return db['OpenchannelInteraction'][_0x6b10('0x58')](_0x51f1eb)[_0x6b10('0x20')](function(_0x31cda5){return[_0x31cda5,!![]];});});}else{_0x1e9374['threadId']=null;}_0x1e9374[_0x6b10('0x8d')]=_0x272009['id'];return db[_0x6b10('0x8b')][_0x6b10('0x60')]({'where':_0x1e9374})[_0x6b10('0x20')](function(_0x33ac0a){if(_0x33ac0a){return[_0x33ac0a,![]];}return db[_0x6b10('0x8b')][_0x6b10('0x58')](_0x51f1eb)['then'](function(_0x494fbe){return[_0x494fbe,!![]];});});}})[_0x6b10('0x8e')](function(_0x4feb29,_0x156add){if(_0x4feb29){_0x3c97aa=_0x156add;if(!_0x156add){var _0x10fe7b={'from':(_0x2c4a13[_0x6b10('0x88')]['firstName']||'')+'\x20'+(_0x2c4a13[_0x6b10('0x88')][_0x6b10('0x8f')]||'')};if(_0x1bdfdf['body'][_0x6b10('0x8a')]&&_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x90')]&&_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x8a')]!=_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x90')]){_0x10fe7b[_0x6b10('0x8a')]=_0x1bdfdf['body'][_0x6b10('0x90')];}return _0x4feb29['update'](_0x10fe7b);}else{return _0x4feb29;}}})[_0x6b10('0x20')](function(_0x5a2ac5){_0x2c4a13[_0x6b10('0x91')]=_0x5a2ac5[_0x6b10('0x37')]({'plain':!![]});_0x2c4a13[_0x6b10('0x91')][_0x6b10('0x92')]=_0x3c97aa;if(_0x2c4a13[_0x6b10('0x91')][_0x6b10('0x92')]){if(_0x2c4a13['account']['autoclose']){_0x2c4a13[_0x6b10('0x84')][_0x6b10('0x93')]({'id':0x0,'priority':_0x2c4a13[_0x6b10('0x84')][_0x6b10('0x4a')]+0x1,'app':_0x6b10('0x94'),'appdata':_0x6b10('0x95'),'interval':_0x6b10('0x96')});}}return db[_0x6b10('0x97')][_0x6b10('0x58')]({'body':_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x59')],'OpenchannelAccountId':_0x1bdfdf['params']['id'],'OpenchannelInteractionId':_0x5a2ac5['id'],'direction':'in','ContactId':_0x2c4a13[_0x6b10('0x88')]['id'],'AttachmentId':_0x1bdfdf[_0x6b10('0x59')][_0x6b10('0x98')]});})[_0x6b10('0x20')](function(_0x416106){_0x2c4a13[_0x6b10('0x28')]=_0x416106;if(_0x2c4a13[_0x6b10('0x91')][_0x6b10('0x99')]){return db[_0x6b10('0x9a')][_0x6b10('0x60')]({'attributes':['id',_0x6b10('0x39')],'where':{'id':_0x2c4a13[_0x6b10('0x91')]['UserId']}})[_0x6b10('0x20')](function(_0xc5721b){if(_0xc5721b){_0x2c4a13[_0x6b10('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xc5721b[_0x6b10('0x39')]+','+(_0x2c4a13[_0x6b10('0x83')][_0x6b10('0x9b')]||0xa),'interval':_0x6b10('0x96')});_0x2c4a13[_0x6b10('0x9c')]=![];}return respondWithRpcPromise(_0x6b10('0x9d'),_0x6b10('0x9e'),_0x2c4a13);});}return respondWithRpcPromise('Start',_0x6b10('0x9e'),_0x2c4a13);})['then'](function(_0x4db836){respondWithRpcPromise(_0x6b10('0x9f'),_0x6b10('0x9f'),{'event':'notify','message':_0x4db836},client9002);return _0x4db836;})[_0x6b10('0x20')](respondWithResult(_0x3c24e9,null))[_0x6b10('0x2a')](handleError(_0x3c24e9,null));};exports[_0x6b10('0xa0')]=function(_0x277d1e,_0x1100fb,_0x365f38){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x277d1e[_0x6b10('0x61')]['id']}})['then'](handleEntityNotFound(_0x1100fb,null))[_0x6b10('0x20')](function(_0x3697d9){if(_0x3697d9){return db[_0x6b10('0xa1')][_0x6b10('0xa2')](function(_0x328b83){return db[_0x6b10('0xa3')][_0x6b10('0x36')]({'where':{'OpenchannelAccountId':_0x277d1e[_0x6b10('0x61')]['id']},'transaction':_0x328b83})[_0x6b10('0x20')](function(_0x1d202f){var _0x31a87c=_[_0x6b10('0x3d')](_0x277d1e[_0x6b10('0x59')],function(_0x5ac84d){_0x5ac84d['OpenchannelAccountId']=_0x277d1e['params']['id'];return _0x5ac84d;});return db[_0x6b10('0xa3')]['bulkCreate'](_0x31a87c,{'transaction':_0x328b83});});})[_0x6b10('0x20')](function(){return db[_0x6b10('0xa3')][_0x6b10('0xa4')]({'where':{'OpenchannelAccountId':_0x277d1e[_0x6b10('0x61')]['id']},'order':_0x6b10('0x86')});});}})['then'](respondWithResult(_0x1100fb,null))[_0x6b10('0x2a')](handleError(_0x1100fb,null));};exports['getApplications']=function(_0x4e448b,_0x2f095c,_0x8ed536){var _0xbb418e={};var _0xb99ec={};var _0x3d2fab;var _0x10d2ca;return db[_0x6b10('0x3e')]['findOne']({'where':{'id':_0x4e448b[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x2f095c,null))[_0x6b10('0x20')](function(_0x3c6442){if(_0x3c6442){_0x3d2fab=_0x3c6442;_0xb99ec[_0x6b10('0x47')]=_[_0x6b10('0x44')](db[_0x6b10('0xa3')][_0x6b10('0x3f')]);_0xb99ec[_0x6b10('0x43')]=_[_0x6b10('0x44')](_0x4e448b[_0x6b10('0x43')]);_0xb99ec[_0x6b10('0x45')]=_[_0x6b10('0x46')](_0xb99ec[_0x6b10('0x47')],_0xb99ec[_0x6b10('0x43')]);_0xbb418e[_0x6b10('0x49')]=_[_0x6b10('0x46')](_0xb99ec[_0x6b10('0x47')],qs[_0x6b10('0x48')](_0x4e448b[_0x6b10('0x43')]['fields']));_0xbb418e[_0x6b10('0x49')]=_0xbb418e[_0x6b10('0x49')][_0x6b10('0x4a')]?_0xbb418e[_0x6b10('0x49')]:_0xb99ec[_0x6b10('0x47')];_0xbb418e[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x4e448b[_0x6b10('0x43')][_0x6b10('0x4e')]);_0xbb418e['where']=qs[_0x6b10('0x45')](_[_0x6b10('0x6b')](_0x4e448b[_0x6b10('0x43')],_0xb99ec[_0x6b10('0x45')]));if(_0x4e448b[_0x6b10('0x43')][_0x6b10('0x51')]){_0xbb418e[_0x6b10('0x4f')]=_[_0x6b10('0x50')](_0xbb418e[_0x6b10('0x4f')],{'$or':_[_0x6b10('0x3d')](_0xbb418e[_0x6b10('0x49')],function(_0x4c7bcd){var _0x11471d={};_0x11471d[_0x4c7bcd]={'$like':'%'+_0x4e448b[_0x6b10('0x43')]['filter']+'%'};return _0x11471d;})});}_0xbb418e=_[_0x6b10('0x50')]({},_0xbb418e,_0x4e448b[_0x6b10('0x52')]);return _0x3d2fab[_0x6b10('0xa5')](_0xbb418e);}})[_0x6b10('0x20')](function(_0x23022b){if(_0x23022b){_0x10d2ca=_0x23022b['length'];if(!_0x4e448b[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0xbb418e[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x4e448b[_0x6b10('0x43')][_0x6b10('0x31')]);_0xbb418e[_0x6b10('0x30')]=qs[_0x6b10('0x30')](_0x4e448b[_0x6b10('0x43')][_0x6b10('0x30')]);}return _0x3d2fab[_0x6b10('0xa5')](_0xbb418e);}})['then'](function(_0x59b26e){if(_0x59b26e){return _0x59b26e?{'count':_0x10d2ca,'rows':_0x59b26e}:null;}})['then'](respondWithResult(_0x2f095c,null))[_0x6b10('0x2a')](handleError(_0x2f095c,null));};exports[_0x6b10('0xa6')]=function(_0x5ea574,_0x58d4dd,_0x2185d5){var _0x42a8ee={'raw':![],'where':{}};var _0x93256c={};var _0xdcce7={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6b10('0x65')]({'where':{'id':_0x5ea574['params']['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x58d4dd,null))[_0x6b10('0x20')](function(_0x2bfa17){if(_0x2bfa17){_0x93256c[_0x6b10('0x47')]=_[_0x6b10('0x44')](db['OpenchannelInteraction']['rawAttributes']);_0x93256c[_0x6b10('0x43')]=_[_0x6b10('0x44')](_0x5ea574[_0x6b10('0x43')]);_0x93256c['filters']=_[_0x6b10('0x46')](_0x93256c[_0x6b10('0x47')],_0x93256c[_0x6b10('0x43')]);_0x42a8ee[_0x6b10('0x49')]=_['intersection'](_0x93256c['model'],qs[_0x6b10('0x48')](_0x5ea574[_0x6b10('0x43')][_0x6b10('0x48')]));_0x42a8ee[_0x6b10('0x49')]=_0x42a8ee[_0x6b10('0x49')][_0x6b10('0x4a')]?_0x42a8ee[_0x6b10('0x49')]:_0x93256c[_0x6b10('0x47')];if(!_0x5ea574[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x42a8ee[_0x6b10('0x31')]=qs[_0x6b10('0x31')](_0x5ea574[_0x6b10('0x43')][_0x6b10('0x31')]);_0x42a8ee[_0x6b10('0x30')]=qs[_0x6b10('0x30')](_0x5ea574['query'][_0x6b10('0x30')]);}_0x42a8ee[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x5ea574[_0x6b10('0x43')][_0x6b10('0x4e')]);_0x42a8ee['where']=qs['filters'](_[_0x6b10('0x6b')](_0x5ea574[_0x6b10('0x43')],_0x93256c[_0x6b10('0x45')]));_0x42a8ee[_0x6b10('0x4f')][_0x6b10('0x66')]=_0x2bfa17['id'];if(_0x5ea574[_0x6b10('0x43')][_0x6b10('0x51')]){_0x42a8ee['where']=_['merge'](_0x42a8ee['where'],{'$or':_[_0x6b10('0x3d')](_0x42a8ee['attributes'],function(_0x29d086){var _0x137ffb={};_0x137ffb[_0x29d086]={'$like':'%'+_0x5ea574[_0x6b10('0x43')]['filter']+'%'};return _0x137ffb;})});}_0x42a8ee=_[_0x6b10('0x50')]({},_0x42a8ee,_0x5ea574[_0x6b10('0x52')]);return db[_0x6b10('0x8b')][_0x6b10('0x2f')]({'where':_0x42a8ee['where']})[_0x6b10('0x20')](function(_0x2f8290){_0xdcce7[_0x6b10('0x2f')]=_0x2f8290;if(_0x5ea574[_0x6b10('0x43')][_0x6b10('0x53')]){_0x42a8ee[_0x6b10('0x54')]=[{'model':db[_0x6b10('0x70')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x6b10('0xa7'),'attributes':[_0x6b10('0x39'),_0x6b10('0xa8'),_0x6b10('0xa9')],'required':![]},{'model':db['Tag'],'as':_0x6b10('0xaa'),'attributes':['id',_0x6b10('0x39'),_0x6b10('0xab')],'where':_0x5ea574['query'][_0x6b10('0xac')]?{'id':_0x5ea574[_0x6b10('0x43')][_0x6b10('0xac')]}:undefined,'required':_0x5ea574[_0x6b10('0x43')][_0x6b10('0xac')]?!![]:![]}];}return db[_0x6b10('0x8b')][_0x6b10('0x55')](_0x42a8ee);})[_0x6b10('0x20')](function(_0x54e688){_0xdcce7['rows']=_0x54e688;return _0xdcce7;});}})[_0x6b10('0x20')](respondWithFilteredResult(_0x58d4dd,_0x42a8ee))[_0x6b10('0x2a')](handleError(_0x58d4dd,null));};exports['addAgents']=function(_0x71b5ed,_0x1987f5,_0x134e6e){return db[_0x6b10('0x3e')][_0x6b10('0x60')]({'where':{'id':_0x71b5ed['params']['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x1987f5,null))[_0x6b10('0x20')](function(_0x49dd7c){if(_0x49dd7c){return _0x49dd7c[_0x6b10('0xad')](_0x71b5ed['body']['ids'],_[_0x6b10('0xae')](_0x71b5ed['body'],[_0x6b10('0x6d'),'id'])||{})[_0x6b10('0x8e')](function(_0x4e6a29){for(var _0x2f7cd8=0x0;_0x2f7cd8<_0x71b5ed[_0x6b10('0x59')]['ids'][_0x6b10('0x4a')];_0x2f7cd8+=0x1){socket[_0x6b10('0xaf')](_0x6b10('0xb0'),{'UserId':_0x71b5ed['body'][_0x6b10('0x6d')][_0x2f7cd8],'OpenchannelAccountId':_0x71b5ed['params']['id']});}return _0x4e6a29;});}})[_0x6b10('0x20')](respondWithResult(_0x1987f5,null))[_0x6b10('0x2a')](handleError(_0x1987f5,null));};exports[_0x6b10('0xb1')]=function(_0x112685,_0x381041,_0xa227fd){return db['OpenchannelAccount'][_0x6b10('0x60')]({'where':{'id':_0x112685[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x381041,null))['then'](function(_0x4c3d78){if(_0x4c3d78){return _0x4c3d78[_0x6b10('0xb1')](_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')])[_0x6b10('0x20')](function(){if(_['isArray'](_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')])){for(var _0x51d1d9=0x0;_0x51d1d9<_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')][_0x6b10('0x4a')];_0x51d1d9+=0x1){socket[_0x6b10('0xaf')](_0x6b10('0xb2'),{'UserId':Number(_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')][_0x51d1d9]),'OpenchannelAccountId':Number(_0x112685[_0x6b10('0x61')]['id'])});}}else{socket[_0x6b10('0xaf')](_0x6b10('0xb2'),{'UserId':Number(_0x112685[_0x6b10('0x43')][_0x6b10('0x6d')]),'OpenchannelAccountId':Number(_0x112685[_0x6b10('0x61')]['id'])});}});}})[_0x6b10('0x20')](respondWithStatusCode(_0x381041,null))[_0x6b10('0x2a')](handleError(_0x381041,null));};exports[_0x6b10('0xb3')]=function(_0x238784,_0x58b916,_0x510ccf){var _0x59126e={};var _0x1f748f={};var _0x144504;var _0x13fbba;return db['OpenchannelAccount'][_0x6b10('0x65')]({'where':{'id':_0x238784[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x58b916,null))[_0x6b10('0x20')](function(_0x3baa59){if(_0x3baa59){_0x144504=_0x3baa59;_0x1f748f[_0x6b10('0x47')]=_[_0x6b10('0x44')](db[_0x6b10('0x9a')]['rawAttributes']);_0x1f748f['query']=_['keys'](_0x238784[_0x6b10('0x43')]);_0x1f748f[_0x6b10('0x45')]=_['intersection'](_0x1f748f['model'],_0x1f748f[_0x6b10('0x43')]);_0x59126e[_0x6b10('0x49')]=_[_0x6b10('0x46')](_0x1f748f[_0x6b10('0x47')],qs[_0x6b10('0x48')](_0x238784['query'][_0x6b10('0x48')]));_0x59126e[_0x6b10('0x49')]=_0x59126e[_0x6b10('0x49')][_0x6b10('0x4a')]?_0x59126e[_0x6b10('0x49')]:_0x1f748f[_0x6b10('0x47')];_0x59126e[_0x6b10('0x4d')]=qs[_0x6b10('0x4e')](_0x238784['query'][_0x6b10('0x4e')]);_0x59126e[_0x6b10('0x4f')]=qs[_0x6b10('0x45')](_[_0x6b10('0x6b')](_0x238784['query'],_0x1f748f[_0x6b10('0x45')]));if(_0x238784[_0x6b10('0x43')][_0x6b10('0x51')]){_0x59126e[_0x6b10('0x4f')]=_[_0x6b10('0x50')](_0x59126e[_0x6b10('0x4f')],{'$or':_[_0x6b10('0x3d')](_0x59126e[_0x6b10('0x49')],function(_0x4d4470){var _0x184496={};_0x184496[_0x4d4470]={'$like':'%'+_0x238784[_0x6b10('0x43')]['filter']+'%'};return _0x184496;})});}_0x59126e=_['merge']({},_0x59126e,_0x238784[_0x6b10('0x52')]);return _0x144504[_0x6b10('0xb3')](_0x59126e);}})['then'](function(_0x1319df){if(_0x1319df){_0x13fbba=_0x1319df[_0x6b10('0x4a')];if(!_0x238784[_0x6b10('0x43')][_0x6b10('0x4b')](_0x6b10('0x4c'))){_0x59126e['limit']=qs[_0x6b10('0x31')](_0x238784[_0x6b10('0x43')][_0x6b10('0x31')]);_0x59126e[_0x6b10('0x30')]=qs[_0x6b10('0x30')](_0x238784[_0x6b10('0x43')][_0x6b10('0x30')]);}return _0x144504[_0x6b10('0xb3')](_0x59126e);}})[_0x6b10('0x20')](function(_0x281cda){if(_0x281cda){return _0x281cda?{'count':_0x13fbba,'rows':_0x281cda}:null;}})[_0x6b10('0x20')](respondWithResult(_0x58b916,null))['catch'](handleError(_0x58b916,null));};exports[_0x6b10('0xb4')]=function(_0x3ed240,_0x128310,_0x3badca){var _0x4567aa,_0x3f03e1,_0x52e205;if(_[_0x6b10('0x78')](_0x3ed240[_0x6b10('0x59')][_0x6b10('0x59')])||_0x3ed240[_0x6b10('0x59')][_0x6b10('0x59')]===''){throw new db[(_0x6b10('0x1e'))][(_0x6b10('0x71'))](_0x6b10('0x7b'));}if(_[_0x6b10('0x78')](_0x3ed240['body']['to'])){}_0x4567aa=_0x3ed240[_0x6b10('0x59')]['to'];return db[_0x6b10('0x3e')][_0x6b10('0x65')]({'where':{'id':_0x3ed240[_0x6b10('0x61')]['id']}})[_0x6b10('0x20')](handleEntityNotFound(_0x128310,null))[_0x6b10('0x20')](function(_0x33d734){if(_0x33d734){return db[_0x6b10('0x3e')]['find']({'where':{'id':_0x33d734['id']},'include':[{'model':db[_0x6b10('0x7f')],'as':_0x6b10('0x82'),'include':[{'model':db[_0x6b10('0x70')],'as':_0x6b10('0xb5'),'where':{[_0x33d734[_0x6b10('0x7c')]]:_0x4567aa},'limit':0x1,'order':[[_0x6b10('0x75'),'DESC']]}]}]})[_0x6b10('0x20')](handleEntityNotFound(_0x128310,null))['then'](function(_0x324c29){if(_0x324c29&&_0x324c29[_0x6b10('0x82')]){_0x3f03e1=_0x324c29[_0x6b10('0x37')]({'plain':!![]});if(_0x3f03e1['List']&&_0x3f03e1[_0x6b10('0x82')][_0x6b10('0xb5')]['length']){return _0x3f03e1[_0x6b10('0x82')]['Contacts'][0x0];}return db[_0x6b10('0x70')]['create'](_[_0x6b10('0x87')](_0x3ed240['body'],{'firstName':_0x4567aa,[_0x324c29['mapKey']]:_0x4567aa,'phone':_0x4567aa,'ListId':_0x3f03e1[_0x6b10('0x77')]}));}})['then'](handleEntityNotFound(_0x128310,null))[_0x6b10('0x20')](function(_0x2d4e45){if(_0x2d4e45){_0x52e205=_0x2d4e45;return db[_0x6b10('0x8b')][_0x6b10('0x60')]({'where':{'ContactId':_0x52e205['id'],'closed':![],'OpenchannelAccountId':_0x3f03e1['id']}})['then'](function(_0x2a88be){if(_0x2a88be){return[_0x2a88be,![]];}return db[_0x6b10('0x8b')][_0x6b10('0x58')]({'UserId':_0x3ed240[_0x6b10('0x5a')]['id'],'ContactId':_0x52e205['id'],'OpenchannelAccountId':_0x3f03e1['id'],'lastMsgDirection':_0x6b10('0xb6'),'Messages':[_['merge'](_0x3ed240[_0x6b10('0x59')],{'read':![],'body':_0x3ed240[_0x6b10('0x59')]['body'],'OpenchannelAccountId':_0x3f03e1['id'],'UserId':_0x3ed240[_0x6b10('0x5a')]['id'],'ContactId':_0x52e205['id']})]},{'include':[{'model':db[_0x6b10('0x97')],'as':_0x6b10('0xb7')}]})[_0x6b10('0x20')](function(_0xc656cc){return[_0xc656cc,!![]];});});}})[_0x6b10('0x8e')](function(_0x374ced,_0x466ea5){if(_0x466ea5){return _0x374ced;}return db[_0x6b10('0x97')]['create'](_['merge'](_0x3ed240['body'],{'read':![],'body':_0x3ed240['body'][_0x6b10('0x59')],'OpenchannelAccountId':_0x3f03e1['id'],'OpenchannelInteractionId':_0x374ced['id'],'UserId':_0x3ed240[_0x6b10('0x5a')]['id'],'ContactId':_0x52e205['id']}))[_0x6b10('0x20')](function(_0x5584ca){_0x374ced[_0x6b10('0xb8')][_0x6b10('0xb7')]=[];_0x374ced[_0x6b10('0xb8')]['Messages'][_0x6b10('0x93')](_0x5584ca['dataValues']);return _0x374ced;});});}})[_0x6b10('0x20')](respondWithResult(_0x128310,null))[_0x6b10('0x2a')](handleError(_0x128310,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index bd8a23d..0dbf59d 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 _0x4153=['hook','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4a66b6,_0x13b579){var _0x2fb1d3=function(_0x17c333){while(--_0x17c333){_0x4a66b6['push'](_0x4a66b6['shift']());}};_0x2fb1d3(++_0x13b579);}(_0x4153,0xd9));var _0x3415=function(_0x5b8922,_0x56729d){_0x5b8922=_0x5b8922-0x0;var _0x5237ef=_0x4153[_0x5b8922];return _0x5237ef;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x3415('0x0'))['db'][_0x3415('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3415('0x2')](0x0);var events={'afterCreate':_0x3415('0x3'),'afterUpdate':_0x3415('0x4'),'afterDestroy':_0x3415('0x5')};function emitEvent(_0x2f9ee7){return function(_0x38ed01,_0x20b74f,_0x2d27a7){OpenchannelAccountEvents[_0x3415('0x6')](_0x2f9ee7+':'+_0x38ed01['id'],_0x38ed01);OpenchannelAccountEvents[_0x3415('0x6')](_0x2f9ee7,_0x38ed01);_0x2d27a7(null);};}for(var e in events){if(events[_0x3415('0x7')](e)){var event=events[e];OpenchannelAccount[_0x3415('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xec0b=['setMaxListeners','update','emit','hasOwnProperty','events','OpenchannelAccount'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xec0b,0x17e));var _0xbec0=function(_0x13bd0e,_0x226c7){_0x13bd0e=_0x13bd0e-0x0;var _0xc082d7=_0xec0b[_0x13bd0e];return _0xc082d7;};'use strict';var EventEmitter=require(_0xbec0('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xbec0('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbec0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbec0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x568438){return function(_0x8fb331,_0x500465,_0x2c395e){OpenchannelAccountEvents[_0xbec0('0x4')](_0x568438+':'+_0x8fb331['id'],_0x8fb331);OpenchannelAccountEvents[_0xbec0('0x4')](_0x568438,_0x8fb331);_0x2c395e(null);};}for(var e in events){if(events[_0xbec0('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d3e4135..9f89f87 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 _0xb14e=['openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount'];(function(_0x4647f2,_0x2c0692){var _0x2b440a=function(_0x2aca44){while(--_0x2aca44){_0x4647f2['push'](_0x4647f2['shift']());}};_0x2b440a(++_0x2c0692);}(_0xb14e,0xd3));var _0xeb14=function(_0x30d866,_0x4fc349){_0x30d866=_0x30d866-0x0;var _0x58526b=_0xb14e[_0x30d866];return _0x58526b;};'use strict';var _=require(_0xeb14('0x0'));var util=require(_0xeb14('0x1'));var logger=require(_0xeb14('0x2'))(_0xeb14('0x3'));var moment=require(_0xeb14('0x4'));var BPromise=require(_0xeb14('0x5'));var rp=require(_0xeb14('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb14('0x7'));var config=require(_0xeb14('0x8'));var attributes=require(_0xeb14('0x9'));module[_0xeb14('0xa')]=function(_0x5bbbfc,_0x4ca06c){return _0x5bbbfc[_0xeb14('0xb')](_0xeb14('0xc'),attributes,{'tableName':_0xeb14('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9df0=['define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelAccount.attributes','exports'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0x9df0,0x92));var _0x09df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9df0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x09df('0x0'));var util=require(_0x09df('0x1'));var logger=require(_0x09df('0x2'))(_0x09df('0x3'));var moment=require(_0x09df('0x4'));var BPromise=require(_0x09df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09df('0x6'));var rimraf=require(_0x09df('0x7'));var config=require('../../config/environment');var attributes=require(_0x09df('0x8'));module[_0x09df('0x9')]=function(_0x1796b4,_0x44ef36){return _0x1796b4[_0x09df('0xa')](_0x09df('0xb'),attributes,{'tableName':_0x09df('0xc'),'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 baa5f98..274d0ba 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 _0xb860=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5bd64f,_0x47e5b7){var _0x4b0240=function(_0x55b15a){while(--_0x55b15a){_0x5bd64f['push'](_0x5bd64f['shift']());}};_0x4b0240(++_0x47e5b7);}(_0xb860,0x18c));var _0x0b86=function(_0x13a14d,_0x1e10d2){_0x13a14d=_0x13a14d-0x0;var _0x4772c6=_0xb860[_0x13a14d];return _0x4772c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b86('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b86('0x1'))['db'];var utils=require(_0x0b86('0x2'));var logger=require(_0x0b86('0x3'))(_0x0b86('0x4'));var config=require(_0x0b86('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0b86('0x6')]({'port':0x232a});config[_0x0b86('0x7')]=_[_0x0b86('0x8')](config[_0x0b86('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0b86('0x9'))(new Redis(config[_0x0b86('0x7')]));require('./openchannelAccount.socket')[_0x0b86('0xa')](socket);function respondWithRpcPromise(_0x35a22b,_0x2a9631,_0x428196){return new BPromise(function(_0x77d4ba,_0x30929c){return client[_0x0b86('0xb')](_0x35a22b,_0x428196)[_0x0b86('0xc')](function(_0xd04892){logger[_0x0b86('0xd')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0x0b86('0xe'));logger['debug'](_0x0b86('0xf'),_0x2a9631,'request\x20sent',JSON[_0x0b86('0x10')](_0xd04892));if(_0xd04892[_0x0b86('0x11')]){if(_0xd04892['error'][_0x0b86('0x12')]===0x1f4){logger[_0x0b86('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0xd04892[_0x0b86('0x11')][_0x0b86('0x13')]);return _0x30929c(_0xd04892[_0x0b86('0x11')]['message']);}logger[_0x0b86('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0xd04892[_0x0b86('0x11')]['message']);return _0x77d4ba(_0xd04892['error'][_0x0b86('0x13')]);}else{logger[_0x0b86('0xd')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0x0b86('0xe'));_0x77d4ba(_0xd04892[_0x0b86('0x14')][_0x0b86('0x13')]);}})[_0x0b86('0x15')](function(_0x18439e){logger[_0x0b86('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2a9631,_0x18439e);_0x30929c(_0x18439e);});});} \ No newline at end of file +var _0x6175=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x6175,0x71));var _0x5617=function(_0x232b51,_0x3da839){_0x232b51=_0x232b51-0x0;var _0x5b7777=_0x6175[_0x232b51];return _0x5b7777;};'use strict';var _=require('lodash');var util=require(_0x5617('0x0'));var moment=require(_0x5617('0x1'));var BPromise=require(_0x5617('0x2'));var rs=require(_0x5617('0x3'));var fs=require('fs');var Redis=require(_0x5617('0x4'));var db=require(_0x5617('0x5'))['db'];var utils=require(_0x5617('0x6'));var logger=require('../../config/logger')(_0x5617('0x7'));var config=require(_0x5617('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5617('0x9')][_0x5617('0xa')]({'port':0x232a});config[_0x5617('0xb')]=_['defaults'](config[_0x5617('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5617('0xc'))(new Redis(config['redis']));require(_0x5617('0xd'))[_0x5617('0xe')](socket);function respondWithRpcPromise(_0x249434,_0x5ab852,_0x3c111c){return new BPromise(function(_0x191f2c,_0x524fda){return client[_0x5617('0xf')](_0x249434,_0x3c111c)[_0x5617('0x10')](function(_0x4f6ac9){logger[_0x5617('0x11')](_0x5617('0x12'),_0x5ab852,_0x5617('0x13'));logger[_0x5617('0x14')](_0x5617('0x15'),_0x5ab852,'request\x20sent',JSON[_0x5617('0x16')](_0x4f6ac9));if(_0x4f6ac9['error']){if(_0x4f6ac9['error'][_0x5617('0x17')]===0x1f4){logger[_0x5617('0x18')](_0x5617('0x12'),_0x5ab852,_0x4f6ac9['error'][_0x5617('0x19')]);return _0x524fda(_0x4f6ac9[_0x5617('0x18')][_0x5617('0x19')]);}logger['error'](_0x5617('0x12'),_0x5ab852,_0x4f6ac9[_0x5617('0x18')][_0x5617('0x19')]);return _0x191f2c(_0x4f6ac9['error'][_0x5617('0x19')]);}else{logger[_0x5617('0x11')](_0x5617('0x12'),_0x5ab852,'request\x20sent');_0x191f2c(_0x4f6ac9[_0x5617('0x1a')][_0x5617('0x19')]);}})[_0x5617('0x1b')](function(_0x4affff){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5ab852,_0x4affff);_0x524fda(_0x4affff);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2990f50..61c61dd 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 _0x307f=['remove','removeListener','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x1322d7,_0xbdf1c0){var _0x55d13b=function(_0x54129b){while(--_0x54129b){_0x1322d7['push'](_0x1322d7['shift']());}};_0x55d13b(++_0xbdf1c0);}(_0x307f,0x1de));var _0xf307=function(_0x4f116f,_0x32a0f3){_0x4f116f=_0x4f116f-0x0;var _0x55d850=_0x307f[_0x4f116f];return _0x55d850;};'use strict';var OpenchannelAccountEvents=require(_0xf307('0x0'));var events=[_0xf307('0x1'),_0xf307('0x2'),'update'];function createListener(_0x2750ee,_0x13f7d3){return function(_0x470ff8){_0x13f7d3['emit'](_0x2750ee,_0x470ff8);};}function removeListener(_0x43d8c3,_0x151a4f){return function(){OpenchannelAccountEvents[_0xf307('0x3')](_0x43d8c3,_0x151a4f);};}exports['register']=function(_0x58a3f9){for(var _0x41a981=0x0,_0x4c91c2=events['length'];_0x41a981<_0x4c91c2;_0x41a981++){var _0x2f9230=events[_0x41a981];var _0x2ac1e0=createListener(_0xf307('0x4')+_0x2f9230,_0x58a3f9);OpenchannelAccountEvents['on'](_0x2f9230,_0x2ac1e0);}}; \ No newline at end of file +var _0xff4f=['update','emit','removeListener','length','./openchannelAccount.events','remove'];(function(_0x5b3309,_0xee99e9){var _0x3d373e=function(_0x421bfe){while(--_0x421bfe){_0x5b3309['push'](_0x5b3309['shift']());}};_0x3d373e(++_0xee99e9);}(_0xff4f,0xa0));var _0xfff4=function(_0x271f2f,_0x3d01b5){_0x271f2f=_0x271f2f-0x0;var _0x116945=_0xff4f[_0x271f2f];return _0x116945;};'use strict';var OpenchannelAccountEvents=require(_0xfff4('0x0'));var events=['save',_0xfff4('0x1'),_0xfff4('0x2')];function createListener(_0x2a0fc9,_0x2df78b){return function(_0x60cbf){_0x2df78b[_0xfff4('0x3')](_0x2a0fc9,_0x60cbf);};}function removeListener(_0x1686fc,_0x3acddb){return function(){OpenchannelAccountEvents[_0xfff4('0x4')](_0x1686fc,_0x3acddb);};}exports['register']=function(_0x1de03d){for(var _0x37eb11=0x0,_0xeb1bc6=events[_0xfff4('0x5')];_0x37eb11<_0xeb1bc6;_0x37eb11++){var _0x131f5e=events[_0x37eb11];var _0x2ae5a8=createListener('openchannelAccount:'+_0x131f5e,_0x1de03d);OpenchannelAccountEvents['on'](_0x131f5e,_0x2ae5a8);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2a2b14d..c46c61c 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 _0x1d7f=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x4f592a,_0x5a6135){var _0x3b6069=function(_0x29a44e){while(--_0x29a44e){_0x4f592a['push'](_0x4f592a['shift']());}};_0x3b6069(++_0x5a6135);}(_0x1d7f,0x6a));var _0xf1d7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1d7f[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xf1d7('0x0'));var util=require(_0xf1d7('0x1'));var path=require('path');var timeout=require(_0xf1d7('0x2'));var express=require(_0xf1d7('0x3'));var router=express[_0xf1d7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf1d7('0x5'));var config=require(_0xf1d7('0x6'));var controller=require(_0xf1d7('0x7'));router[_0xf1d7('0x8')]('/',auth[_0xf1d7('0x9')](),controller[_0xf1d7('0xa')]);router[_0xf1d7('0x8')](_0xf1d7('0xb'),auth['isAuthenticated'](),controller[_0xf1d7('0xc')]);router[_0xf1d7('0xd')]('/',auth[_0xf1d7('0x9')](),controller[_0xf1d7('0xe')]);router['put'](_0xf1d7('0xb'),auth[_0xf1d7('0x9')](),controller[_0xf1d7('0xf')]);router[_0xf1d7('0x10')]('/:id',auth[_0xf1d7('0x9')](),controller['destroy']);module[_0xf1d7('0x11')]=router; \ No newline at end of file +var _0x42bc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','update','destroy','multer','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x42bc,0xa8));var _0xc42b=function(_0x2236dc,_0x43c7f9){_0x2236dc=_0x2236dc-0x0;var _0x20583f=_0x42bc[_0x2236dc];return _0x20583f;};'use strict';var multer=require(_0xc42b('0x0'));var util=require(_0xc42b('0x1'));var path=require('path');var timeout=require(_0xc42b('0x2'));var express=require(_0xc42b('0x3'));var router=express[_0xc42b('0x4')]();var auth=require(_0xc42b('0x5'));var interaction=require(_0xc42b('0x6'));var config=require(_0xc42b('0x7'));var controller=require('./openchannelApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc42b('0x8')]);router[_0xc42b('0x9')](_0xc42b('0xa'),auth[_0xc42b('0xb')](),controller[_0xc42b('0xc')]);router[_0xc42b('0xd')]('/',auth[_0xc42b('0xb')](),controller[_0xc42b('0xe')]);router['put'](_0xc42b('0xa'),auth['isAuthenticated'](),controller[_0xc42b('0xf')]);router['delete']('/:id',auth[_0xc42b('0xb')](),controller[_0xc42b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index efc7837..ffb3789 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 _0xd73a=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x173b68,_0x5d9619){var _0x48991f=function(_0x261ee9){while(--_0x261ee9){_0x173b68['push'](_0x173b68['shift']());}};_0x48991f(++_0x5d9619);}(_0xd73a,0xcf));var _0xad73=function(_0x114450,_0x28fc12){_0x114450=_0x114450-0x0;var _0x1e4b65=_0xd73a[_0x114450];return _0x1e4b65;};'use strict';var Sequelize=require(_0xad73('0x0'));module[_0xad73('0x1')]={'priority':{'type':Sequelize[_0xad73('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad73('0x3')},'appdata':{'type':Sequelize[_0xad73('0x4')]()},'description':{'type':Sequelize[_0xad73('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xad73('0x6')}}; \ No newline at end of file +var _0xd3c5=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd3c5,0x1a1));var _0x5d3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3c5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5d3c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5d3c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5d3c('0x2')],'allowNull':![],'defaultValue':_0x5d3c('0x3')},'appdata':{'type':Sequelize[_0x5d3c('0x4')]()},'description':{'type':Sequelize[_0x5d3c('0x2')]},'interval':{'type':Sequelize[_0x5d3c('0x2')],'defaultValue':_0x5d3c('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 009df0d..acf41ee 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 _0xf23e=['json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','OpenchannelApplication','rows','catch','show','params','options','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xf23e,0xff));var _0xef23=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xf23e[_0x2642cb];return _0xe6e41;};'use strict';var pdf=require(_0xef23('0x0'));var emlformat=require(_0xef23('0x1'));var rimraf=require(_0xef23('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xef23('0x3'));var moment=require(_0xef23('0x4'));var BPromise=require(_0xef23('0x5'));var Mustache=require('mustache');var util=require(_0xef23('0x6'));var path=require(_0xef23('0x7'));var sox=require(_0xef23('0x8'));var csv=require(_0xef23('0x9'));var ejs=require(_0xef23('0xa'));var fs=require('fs');var _=require(_0xef23('0xb'));var squel=require(_0xef23('0xc'));var crypto=require('crypto');var jsforce=require(_0xef23('0xd'));var deskjs=require(_0xef23('0xe'));var toCsv=require(_0xef23('0x9'));var querystring=require(_0xef23('0xf'));var Papa=require('papaparse');var Redis=require(_0xef23('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xef23('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef23('0x12'));var logger=require(_0xef23('0x13'))(_0xef23('0x14'));var utils=require(_0xef23('0x15'));var config=require(_0xef23('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe461bb,_0x1abb66){_0x1abb66=_0x1abb66||0xcc;return function(_0x3ad43d){if(_0x3ad43d){return _0xe461bb[_0xef23('0x17')](_0x1abb66);}return _0xe461bb['status'](_0x1abb66)['end']();};}function respondWithResult(_0x467d49,_0x3acfef){_0x3acfef=_0x3acfef||0xc8;return function(_0x5aa039){if(_0x5aa039){return _0x467d49[_0xef23('0x18')](_0x3acfef)[_0xef23('0x19')](_0x5aa039);}};}function respondWithFilteredResult(_0x319377,_0x176a1c){return function(_0x69ed47){if(_0x69ed47){var _0x4f4fb3=_0x69ed47[_0xef23('0x1a')],_0x32fe51=_0x176a1c[_0xef23('0x1b')],_0x58583b=_0x176a1c[_0xef23('0x1b')]+_0x176a1c[_0xef23('0x1c')],_0x21a562;if(_0x58583b>=_0x4f4fb3){_0x58583b=_0x4f4fb3;_0x21a562=0xc8;}else{_0x21a562=0xce;}_0x319377[_0xef23('0x18')](_0x21a562);return _0x319377[_0xef23('0x1d')](_0xef23('0x1e'),_0x32fe51+'-'+_0x58583b+'/'+_0x4f4fb3)[_0xef23('0x19')](_0x69ed47);}return null;};}function patchUpdates(_0x5696b9){return function(_0x4fe0b){try{jsonpatch[_0xef23('0x1f')](_0x4fe0b,_0x5696b9,!![]);}catch(_0x5f8738){return BPromise[_0xef23('0x20')](_0x5f8738);}return _0x4fe0b[_0xef23('0x21')]();};}function saveUpdates(_0x199a9b,_0x338dbb){return function(_0x2c3177){if(_0x2c3177){return _0x2c3177['update'](_0x199a9b)[_0xef23('0x22')](function(_0x5236f1){return _0x5236f1;});}return null;};}function removeEntity(_0x2d4068,_0x1a690e){return function(_0x72744){if(_0x72744){return _0x72744[_0xef23('0x23')]()[_0xef23('0x22')](function(){_0x2d4068['status'](0xcc)[_0xef23('0x24')]();});}};}function handleEntityNotFound(_0xb86c1a,_0x314816){return function(_0x1da6ef){if(!_0x1da6ef){_0xb86c1a[_0xef23('0x17')](0x194);}return _0x1da6ef;};}function handleError(_0x3aca35,_0x49bc94){_0x49bc94=_0x49bc94||0x1f4;return function(_0x1216bf){logger[_0xef23('0x25')](_0x1216bf[_0xef23('0x26')]);if(_0x1216bf['name']){delete _0x1216bf[_0xef23('0x27')];}_0x3aca35[_0xef23('0x18')](_0x49bc94)[_0xef23('0x28')](_0x1216bf);};}exports[_0xef23('0x29')]=function(_0x53716f,_0x4cfdf8){var _0x4972d3={},_0x3d3c66={},_0x4b2cc0={'count':0x0,'rows':[]};var _0x26b1cd=_['map'](db['OpenchannelApplication']['rawAttributes'],function(_0x235dae){return{'name':_0x235dae['fieldName'],'type':_0x235dae[_0xef23('0x2a')][_0xef23('0x2b')]};});_0x3d3c66[_0xef23('0x2c')]=_[_0xef23('0x2d')](_0x26b1cd,_0xef23('0x27'));_0x3d3c66[_0xef23('0x2e')]=_[_0xef23('0x2f')](_0x53716f[_0xef23('0x2e')]);_0x3d3c66[_0xef23('0x30')]=_[_0xef23('0x31')](_0x3d3c66[_0xef23('0x2c')],_0x3d3c66['query']);_0x4972d3[_0xef23('0x32')]=_['intersection'](_0x3d3c66[_0xef23('0x2c')],qs[_0xef23('0x33')](_0x53716f[_0xef23('0x2e')][_0xef23('0x33')]));_0x4972d3[_0xef23('0x32')]=_0x4972d3['attributes'][_0xef23('0x34')]?_0x4972d3[_0xef23('0x32')]:_0x3d3c66[_0xef23('0x2c')];if(!_0x53716f[_0xef23('0x2e')][_0xef23('0x35')](_0xef23('0x36'))){_0x4972d3[_0xef23('0x1c')]=qs[_0xef23('0x1c')](_0x53716f[_0xef23('0x2e')][_0xef23('0x1c')]);_0x4972d3['offset']=qs[_0xef23('0x1b')](_0x53716f[_0xef23('0x2e')][_0xef23('0x1b')]);}_0x4972d3['order']=qs[_0xef23('0x37')](_0x53716f[_0xef23('0x2e')][_0xef23('0x37')]);_0x4972d3[_0xef23('0x38')]=qs['filters'](_[_0xef23('0x39')](_0x53716f['query'],_0x3d3c66[_0xef23('0x30')]),_0x26b1cd);if(_0x53716f[_0xef23('0x2e')]['filter']){_0x4972d3[_0xef23('0x38')]=_[_0xef23('0x3a')](_0x4972d3[_0xef23('0x38')],{'$or':_[_0xef23('0x2d')](_0x26b1cd,function(_0x48e420){if(_0x48e420['type']!=='VIRTUAL'){var _0x5ba4cc={};_0x5ba4cc[_0x48e420[_0xef23('0x27')]]={'$like':'%'+_0x53716f[_0xef23('0x2e')]['filter']+'%'};return _0x5ba4cc;}})});}_0x4972d3=_['merge']({},_0x4972d3,_0x53716f['options']);var _0x1cf864={'where':_0x4972d3[_0xef23('0x38')]};return db['OpenchannelApplication'][_0xef23('0x1a')](_0x1cf864)[_0xef23('0x22')](function(_0x277b3f){_0x4b2cc0[_0xef23('0x1a')]=_0x277b3f;if(_0x53716f[_0xef23('0x2e')][_0xef23('0x3b')]){_0x4972d3[_0xef23('0x3c')]=[{'all':!![]}];}return db[_0xef23('0x3d')]['findAll'](_0x4972d3);})[_0xef23('0x22')](function(_0x39d746){_0x4b2cc0[_0xef23('0x3e')]=_0x39d746;return _0x4b2cc0;})[_0xef23('0x22')](respondWithFilteredResult(_0x4cfdf8,_0x4972d3))[_0xef23('0x3f')](handleError(_0x4cfdf8,null));};exports[_0xef23('0x40')]=function(_0x454a81,_0x73d5d5){var _0x48fc8a={'raw':!![],'where':{'id':_0x454a81[_0xef23('0x41')]['id']}},_0x293ccf={};_0x293ccf['model']=_[_0xef23('0x2f')](db[_0xef23('0x3d')]['rawAttributes']);_0x293ccf[_0xef23('0x2e')]=_[_0xef23('0x2f')](_0x454a81[_0xef23('0x2e')]);_0x293ccf[_0xef23('0x30')]=_['intersection'](_0x293ccf['model'],_0x293ccf['query']);_0x48fc8a[_0xef23('0x32')]=_[_0xef23('0x31')](_0x293ccf['model'],qs[_0xef23('0x33')](_0x454a81['query'][_0xef23('0x33')]));_0x48fc8a['attributes']=_0x48fc8a[_0xef23('0x32')]['length']?_0x48fc8a[_0xef23('0x32')]:_0x293ccf[_0xef23('0x2c')];if(_0x454a81[_0xef23('0x2e')][_0xef23('0x3b')]){_0x48fc8a[_0xef23('0x3c')]=[{'all':!![]}];}_0x48fc8a=_[_0xef23('0x3a')]({},_0x48fc8a,_0x454a81[_0xef23('0x42')]);return db[_0xef23('0x3d')][_0xef23('0x43')](_0x48fc8a)[_0xef23('0x22')](handleEntityNotFound(_0x73d5d5,null))[_0xef23('0x22')](respondWithResult(_0x73d5d5,null))[_0xef23('0x3f')](handleError(_0x73d5d5,null));};exports['create']=function(_0xeb7b6e,_0xea5591){return db['OpenchannelApplication'][_0xef23('0x44')](_0xeb7b6e['body'],{})[_0xef23('0x22')](respondWithResult(_0xea5591,0xc9))[_0xef23('0x3f')](handleError(_0xea5591,null));};exports['update']=function(_0xa6f8fa,_0x4c8788){if(_0xa6f8fa['body']['id']){delete _0xa6f8fa[_0xef23('0x45')]['id'];}return db[_0xef23('0x3d')][_0xef23('0x43')]({'where':{'id':_0xa6f8fa[_0xef23('0x41')]['id']}})[_0xef23('0x22')](handleEntityNotFound(_0x4c8788,null))[_0xef23('0x22')](saveUpdates(_0xa6f8fa[_0xef23('0x45')],null))[_0xef23('0x22')](respondWithResult(_0x4c8788,null))[_0xef23('0x3f')](handleError(_0x4c8788,null));};exports['destroy']=function(_0x374ba1,_0x2ccbcc){return db['OpenchannelApplication']['find']({'where':{'id':_0x374ba1[_0xef23('0x41')]['id']}})[_0xef23('0x22')](handleEntityNotFound(_0x2ccbcc,null))[_0xef23('0x22')](removeEntity(_0x2ccbcc,null))[_0xef23('0x3f')](handleError(_0x2ccbcc,null));}; \ No newline at end of file +var _0x3626=['to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','update','then','destroy','end','stack','name','send','index','OpenchannelApplication','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','options','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x423453,_0x47fbd0){var _0x2da39d=function(_0x4999d2){while(--_0x4999d2){_0x423453['push'](_0x423453['shift']());}};_0x2da39d(++_0x47fbd0);}(_0x3626,0x1ac));var _0x6362=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3626[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x6362('0x0'));var emlformat=require(_0x6362('0x1'));var rimraf=require(_0x6362('0x2'));var zipdir=require(_0x6362('0x3'));var jsonpatch=require(_0x6362('0x4'));var rp=require('request-promise');var moment=require(_0x6362('0x5'));var BPromise=require(_0x6362('0x6'));var Mustache=require(_0x6362('0x7'));var util=require(_0x6362('0x8'));var path=require(_0x6362('0x9'));var sox=require('sox');var csv=require(_0x6362('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6362('0xb'));var crypto=require(_0x6362('0xc'));var jsforce=require(_0x6362('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6362('0xa'));var querystring=require(_0x6362('0xe'));var Papa=require(_0x6362('0xf'));var Redis=require(_0x6362('0x10'));var authService=require(_0x6362('0x11'));var qs=require(_0x6362('0x12'));var as=require(_0x6362('0x13'));var hardwareService=require(_0x6362('0x14'));var logger=require(_0x6362('0x15'))(_0x6362('0x16'));var utils=require(_0x6362('0x17'));var config=require(_0x6362('0x18'));var db=require(_0x6362('0x19'))['db'];function respondWithStatusCode(_0xb1d99,_0x22881f){_0x22881f=_0x22881f||0xcc;return function(_0x11ea5a){if(_0x11ea5a){return _0xb1d99[_0x6362('0x1a')](_0x22881f);}return _0xb1d99[_0x6362('0x1b')](_0x22881f)['end']();};}function respondWithResult(_0x5a4b3b,_0x1d2a55){_0x1d2a55=_0x1d2a55||0xc8;return function(_0x44952d){if(_0x44952d){return _0x5a4b3b[_0x6362('0x1b')](_0x1d2a55)[_0x6362('0x1c')](_0x44952d);}};}function respondWithFilteredResult(_0x54ae23,_0x13e64d){return function(_0x2664a5){if(_0x2664a5){var _0x426d3a=_0x2664a5[_0x6362('0x1d')],_0xeb4839=_0x13e64d['offset'],_0x14dad6=_0x13e64d[_0x6362('0x1e')]+_0x13e64d['limit'],_0x40c4fe;if(_0x14dad6>=_0x426d3a){_0x14dad6=_0x426d3a;_0x40c4fe=0xc8;}else{_0x40c4fe=0xce;}_0x54ae23[_0x6362('0x1b')](_0x40c4fe);return _0x54ae23['set'](_0x6362('0x1f'),_0xeb4839+'-'+_0x14dad6+'/'+_0x426d3a)[_0x6362('0x1c')](_0x2664a5);}return null;};}function patchUpdates(_0x4564f6){return function(_0x2b6073){try{jsonpatch['apply'](_0x2b6073,_0x4564f6,!![]);}catch(_0x3b4aaa){return BPromise['reject'](_0x3b4aaa);}return _0x2b6073['save']();};}function saveUpdates(_0x3091af,_0x54d0d2){return function(_0xadec31){if(_0xadec31){return _0xadec31[_0x6362('0x20')](_0x3091af)[_0x6362('0x21')](function(_0x3066db){return _0x3066db;});}return null;};}function removeEntity(_0x5543ab,_0x376af7){return function(_0x3e28d9){if(_0x3e28d9){return _0x3e28d9[_0x6362('0x22')]()[_0x6362('0x21')](function(){_0x5543ab[_0x6362('0x1b')](0xcc)[_0x6362('0x23')]();});}};}function handleEntityNotFound(_0x3a3a04,_0x2ae2d2){return function(_0x51ea12){if(!_0x51ea12){_0x3a3a04[_0x6362('0x1a')](0x194);}return _0x51ea12;};}function handleError(_0x8b64d,_0x5f5d62){_0x5f5d62=_0x5f5d62||0x1f4;return function(_0x1631f6){logger['error'](_0x1631f6[_0x6362('0x24')]);if(_0x1631f6[_0x6362('0x25')]){delete _0x1631f6[_0x6362('0x25')];}_0x8b64d[_0x6362('0x1b')](_0x5f5d62)[_0x6362('0x26')](_0x1631f6);};}exports[_0x6362('0x27')]=function(_0x3a00cd,_0x1a87ba){var _0x2cced7={},_0x5079ce={},_0x37b98f={'count':0x0,'rows':[]};var _0x867586=_['map'](db[_0x6362('0x28')]['rawAttributes'],function(_0x25a48c){return{'name':_0x25a48c[_0x6362('0x29')],'type':_0x25a48c[_0x6362('0x2a')][_0x6362('0x2b')]};});_0x5079ce['model']=_[_0x6362('0x2c')](_0x867586,_0x6362('0x25'));_0x5079ce['query']=_[_0x6362('0x2d')](_0x3a00cd[_0x6362('0x2e')]);_0x5079ce[_0x6362('0x2f')]=_[_0x6362('0x30')](_0x5079ce[_0x6362('0x31')],_0x5079ce[_0x6362('0x2e')]);_0x2cced7[_0x6362('0x32')]=_[_0x6362('0x30')](_0x5079ce[_0x6362('0x31')],qs[_0x6362('0x33')](_0x3a00cd[_0x6362('0x2e')][_0x6362('0x33')]));_0x2cced7[_0x6362('0x32')]=_0x2cced7[_0x6362('0x32')][_0x6362('0x34')]?_0x2cced7[_0x6362('0x32')]:_0x5079ce[_0x6362('0x31')];if(!_0x3a00cd[_0x6362('0x2e')][_0x6362('0x35')](_0x6362('0x36'))){_0x2cced7[_0x6362('0x37')]=qs[_0x6362('0x37')](_0x3a00cd['query']['limit']);_0x2cced7['offset']=qs[_0x6362('0x1e')](_0x3a00cd[_0x6362('0x2e')][_0x6362('0x1e')]);}_0x2cced7[_0x6362('0x38')]=qs[_0x6362('0x39')](_0x3a00cd['query'][_0x6362('0x39')]);_0x2cced7['where']=qs[_0x6362('0x2f')](_[_0x6362('0x3a')](_0x3a00cd['query'],_0x5079ce[_0x6362('0x2f')]),_0x867586);if(_0x3a00cd[_0x6362('0x2e')]['filter']){_0x2cced7[_0x6362('0x3b')]=_[_0x6362('0x3c')](_0x2cced7[_0x6362('0x3b')],{'$or':_['map'](_0x867586,function(_0x531a00){if(_0x531a00[_0x6362('0x2a')]!==_0x6362('0x3d')){var _0x1ad53f={};_0x1ad53f[_0x531a00[_0x6362('0x25')]]={'$like':'%'+_0x3a00cd[_0x6362('0x2e')]['filter']+'%'};return _0x1ad53f;}})});}_0x2cced7=_[_0x6362('0x3c')]({},_0x2cced7,_0x3a00cd[_0x6362('0x3e')]);var _0x228725={'where':_0x2cced7[_0x6362('0x3b')]};return db[_0x6362('0x28')][_0x6362('0x1d')](_0x228725)[_0x6362('0x21')](function(_0x557591){_0x37b98f[_0x6362('0x1d')]=_0x557591;if(_0x3a00cd[_0x6362('0x2e')]['includeAll']){_0x2cced7['include']=[{'all':!![]}];}return db[_0x6362('0x28')][_0x6362('0x3f')](_0x2cced7);})[_0x6362('0x21')](function(_0x2a84dc){_0x37b98f['rows']=_0x2a84dc;return _0x37b98f;})[_0x6362('0x21')](respondWithFilteredResult(_0x1a87ba,_0x2cced7))[_0x6362('0x40')](handleError(_0x1a87ba,null));};exports[_0x6362('0x41')]=function(_0x7c93e1,_0x842e0f){var _0x28939a={'raw':!![],'where':{'id':_0x7c93e1[_0x6362('0x42')]['id']}},_0x3f9704={};_0x3f9704['model']=_[_0x6362('0x2d')](db[_0x6362('0x28')][_0x6362('0x43')]);_0x3f9704[_0x6362('0x2e')]=_[_0x6362('0x2d')](_0x7c93e1[_0x6362('0x2e')]);_0x3f9704[_0x6362('0x2f')]=_[_0x6362('0x30')](_0x3f9704[_0x6362('0x31')],_0x3f9704[_0x6362('0x2e')]);_0x28939a[_0x6362('0x32')]=_['intersection'](_0x3f9704[_0x6362('0x31')],qs['fields'](_0x7c93e1['query'][_0x6362('0x33')]));_0x28939a[_0x6362('0x32')]=_0x28939a['attributes'][_0x6362('0x34')]?_0x28939a[_0x6362('0x32')]:_0x3f9704['model'];if(_0x7c93e1['query'][_0x6362('0x44')]){_0x28939a[_0x6362('0x45')]=[{'all':!![]}];}_0x28939a=_['merge']({},_0x28939a,_0x7c93e1[_0x6362('0x3e')]);return db['OpenchannelApplication'][_0x6362('0x46')](_0x28939a)[_0x6362('0x21')](handleEntityNotFound(_0x842e0f,null))['then'](respondWithResult(_0x842e0f,null))[_0x6362('0x40')](handleError(_0x842e0f,null));};exports[_0x6362('0x47')]=function(_0x5ba432,_0x1d5abb){return db[_0x6362('0x28')]['create'](_0x5ba432[_0x6362('0x48')],{})[_0x6362('0x21')](respondWithResult(_0x1d5abb,0xc9))[_0x6362('0x40')](handleError(_0x1d5abb,null));};exports[_0x6362('0x20')]=function(_0x441152,_0x4407b5){if(_0x441152['body']['id']){delete _0x441152[_0x6362('0x48')]['id'];}return db[_0x6362('0x28')]['find']({'where':{'id':_0x441152['params']['id']}})[_0x6362('0x21')](handleEntityNotFound(_0x4407b5,null))[_0x6362('0x21')](saveUpdates(_0x441152[_0x6362('0x48')],null))[_0x6362('0x21')](respondWithResult(_0x4407b5,null))[_0x6362('0x40')](handleError(_0x4407b5,null));};exports[_0x6362('0x22')]=function(_0x336f11,_0x3fe93f){return db[_0x6362('0x28')]['find']({'where':{'id':_0x336f11[_0x6362('0x42')]['id']}})['then'](handleEntityNotFound(_0x3fe93f,null))[_0x6362('0x21')](removeEntity(_0x3fe93f,null))[_0x6362('0x40')](handleError(_0x3fe93f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index a35f578..28637d0 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 _0x7880=['bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','api','moment'];(function(_0x55b142,_0x547c52){var _0x408769=function(_0x1d89e1){while(--_0x1d89e1){_0x55b142['push'](_0x55b142['shift']());}};_0x408769(++_0x547c52);}(_0x7880,0x1f4));var _0x0788=function(_0x153c6a,_0x2a217a){_0x153c6a=_0x153c6a-0x0;var _0xce898f=_0x7880[_0x153c6a];return _0xce898f;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));module[_0x0788('0x9')]=function(_0x262f5c,_0x775629){return _0x262f5c[_0x0788('0xa')](_0x0788('0xb'),attributes,{'tableName':_0x0788('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0788('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe51a=['./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','rimraf'];(function(_0x531e72,_0x571e05){var _0x2329fa=function(_0x51f69c){while(--_0x51f69c){_0x531e72['push'](_0x531e72['shift']());}};_0x2329fa(++_0x571e05);}(_0xe51a,0xaf));var _0xae51=function(_0x1ba264,_0x2dd506){_0x1ba264=_0x1ba264-0x0;var _0x4464aa=_0xe51a[_0x1ba264];return _0x4464aa;};'use strict';var _=require(_0xae51('0x0'));var util=require(_0xae51('0x1'));var logger=require(_0xae51('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae51('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae51('0x4'));var config=require('../../config/environment');var attributes=require(_0xae51('0x5'));module['exports']=function(_0x1f3a93,_0x415fa8){return _0x1f3a93[_0xae51('0x6')](_0xae51('0x7'),attributes,{'tableName':_0xae51('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xae51('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 2721ab6..ac4d45e 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xf810be,_0x4c896c){var _0x161387=function(_0x135582){while(--_0x135582){_0xf810be['push'](_0xf810be['shift']());}};_0x161387(++_0x4c896c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f8bc6,_0x4dc869){_0x2f8bc6=_0x2f8bc6-0x0;var _0x2d008a=_0xb10b[_0x2f8bc6];return _0x2d008a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x131916,_0x8eb089){var _0x283e61=function(_0x285d52){while(--_0x285d52){_0x131916['push'](_0x131916['shift']());}};_0x283e61(++_0x8eb089);}(_0xb10b,0x12a));var _0xbb10=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0xb10b[_0x27beea];return _0x122645;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index e215ca7..ee44461 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 _0xd755=['openchannelinteraction:destroy','destroy','removeTags','exports','util','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','/:id','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','addTags','put','update','delete'];(function(_0x3c2fd8,_0x2e7324){var _0x1e1b5e=function(_0x278d00){while(--_0x278d00){_0x3c2fd8['push'](_0x3c2fd8['shift']());}};_0x1e1b5e(++_0x2e7324);}(_0xd755,0x130));var _0x5d75=function(_0x336adb,_0x1c3608){_0x336adb=_0x336adb-0x0;var _0x5be7f5=_0xd755[_0x336adb];return _0x5be7f5;};'use strict';var multer=require('multer');var util=require(_0x5d75('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(_0x5d75('0x1'));var config=require(_0x5d75('0x2'));var controller=require(_0x5d75('0x3'));router[_0x5d75('0x4')]('/',auth[_0x5d75('0x5')](),controller['index']);router['get'](_0x5d75('0x6'),auth[_0x5d75('0x5')](),controller['describe']);router['get'](_0x5d75('0x7'),auth[_0x5d75('0x5')](),controller['show']);router[_0x5d75('0x4')]('/:id/messages',auth[_0x5d75('0x5')](),controller[_0x5d75('0x8')]);router[_0x5d75('0x4')](_0x5d75('0x9'),auth[_0x5d75('0x5')](),controller['download']);router[_0x5d75('0xa')]('/',auth[_0x5d75('0x5')](),controller[_0x5d75('0xb')]);router[_0x5d75('0xa')](_0x5d75('0xc'),auth['isAuthenticated'](),controller[_0x5d75('0xd')]);router[_0x5d75('0xa')](_0x5d75('0xe'),auth[_0x5d75('0x5')](),interaction[_0x5d75('0xf')](_0x5d75('0x10'),'openchannelinteraction:addtags'),controller[_0x5d75('0x11')]);router[_0x5d75('0x12')](_0x5d75('0x7'),auth['isAuthenticated'](),interaction[_0x5d75('0xf')](_0x5d75('0x10'),'openchannelinteraction:update'),controller[_0x5d75('0x13')]);router[_0x5d75('0x14')](_0x5d75('0x7'),auth[_0x5d75('0x5')](),interaction[_0x5d75('0xf')](_0x5d75('0x10'),_0x5d75('0x15')),controller[_0x5d75('0x16')]);router[_0x5d75('0x14')](_0x5d75('0xe'),auth[_0x5d75('0x5')](),controller[_0x5d75('0x17')]);module[_0x5d75('0x18')]=router; \ No newline at end of file +var _0x6c87=['path','connect-timeout','express','Router','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','update','openchannelinteraction:destroy','destroy','exports','multer'];(function(_0x1280a1,_0x5967cd){var _0x240d6f=function(_0x480ee9){while(--_0x480ee9){_0x1280a1['push'](_0x1280a1['shift']());}};_0x240d6f(++_0x5967cd);}(_0x6c87,0x1df));var _0x76c8=function(_0x2a7579,_0x1456c6){_0x2a7579=_0x2a7579-0x0;var _0x3b02ef=_0x6c87[_0x2a7579];return _0x3b02ef;};'use strict';var multer=require(_0x76c8('0x0'));var util=require('util');var path=require(_0x76c8('0x1'));var timeout=require(_0x76c8('0x2'));var express=require(_0x76c8('0x3'));var router=express[_0x76c8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76c8('0x5'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x76c8('0x6')]('/',auth['isAuthenticated'](),controller[_0x76c8('0x7')]);router[_0x76c8('0x6')](_0x76c8('0x8'),auth[_0x76c8('0x9')](),controller[_0x76c8('0xa')]);router[_0x76c8('0x6')](_0x76c8('0xb'),auth['isAuthenticated'](),controller[_0x76c8('0xc')]);router['get']('/:id/messages',auth[_0x76c8('0x9')](),controller[_0x76c8('0xd')]);router[_0x76c8('0x6')](_0x76c8('0xe'),auth[_0x76c8('0x9')](),controller[_0x76c8('0xf')]);router[_0x76c8('0x10')]('/',auth[_0x76c8('0x9')](),controller[_0x76c8('0x11')]);router[_0x76c8('0x10')](_0x76c8('0x12'),auth[_0x76c8('0x9')](),controller[_0x76c8('0x13')]);router[_0x76c8('0x10')](_0x76c8('0x14'),auth['isAuthenticated'](),interaction[_0x76c8('0x15')]('openchannel',_0x76c8('0x16')),controller[_0x76c8('0x17')]);router[_0x76c8('0x18')](_0x76c8('0xb'),auth[_0x76c8('0x9')](),interaction['tracked'](_0x76c8('0x19'),'openchannelinteraction:update'),controller[_0x76c8('0x1a')]);router['delete'](_0x76c8('0xb'),auth[_0x76c8('0x9')](),interaction[_0x76c8('0x15')](_0x76c8('0x19'),_0x76c8('0x1b')),controller[_0x76c8('0x1c')]);router['delete'](_0x76c8('0x14'),auth[_0x76c8('0x9')](),controller['removeTags']);module[_0x76c8('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 ac1f16f..e29fa6f 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 _0xadb3=['out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xadb3,0x97));var _0x3adb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xadb3[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x3adb('0x0'));module[_0x3adb('0x1')]={'closed':{'type':Sequelize[_0x3adb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3adb('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3adb('0x4')]},'threadId':{'type':Sequelize[_0x3adb('0x3')]},'externalUrl':{'type':Sequelize[_0x3adb('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3adb('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3adb('0x3')]}}; \ No newline at end of file +var _0x6937=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x26dfbf,_0x48ae23){var _0x148404=function(_0x368fd3){while(--_0x368fd3){_0x26dfbf['push'](_0x26dfbf['shift']());}};_0x148404(++_0x48ae23);}(_0x6937,0xc6));var _0x7693=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x6937[_0x74892f];return _0x10ee61;};'use strict';var Sequelize=require(_0x7693('0x0'));module[_0x7693('0x1')]={'closed':{'type':Sequelize[_0x7693('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7693('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7693('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x7693('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7693('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7693('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 2a2920a..2362401 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 _0x3a9a=['OpenchannelMessage','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','omit','color','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','get','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','closed','closedAt','disposition','threadId','Private','existsSync','createReadStream','basename','out','System','lastName','secret','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','OpenchannelInteraction','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','from','select','u.id','u.fullname','user_has_openchannel_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','params','rawAttributes','includeAll','options','create','body','describe','addMessage'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x3a9a,0x122));var _0xa3a9=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x3a9a[_0x1da527];return _0x40fc7c;};'use strict';var pdf=require(_0xa3a9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3a9('0x1'));var zipdir=require(_0xa3a9('0x2'));var jsonpatch=require(_0xa3a9('0x3'));var rp=require(_0xa3a9('0x4'));var moment=require(_0xa3a9('0x5'));var BPromise=require(_0xa3a9('0x6'));var Mustache=require('mustache');var util=require(_0xa3a9('0x7'));var path=require('path');var sox=require(_0xa3a9('0x8'));var csv=require('to-csv');var ejs=require(_0xa3a9('0x9'));var fs=require('fs');var _=require(_0xa3a9('0xa'));var squel=require(_0xa3a9('0xb'));var crypto=require(_0xa3a9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa3a9('0xd'));var toCsv=require(_0xa3a9('0xe'));var querystring=require(_0xa3a9('0xf'));var Papa=require('papaparse');var Redis=require(_0xa3a9('0x10'));var authService=require(_0xa3a9('0x11'));var qs=require(_0xa3a9('0x12'));var as=require(_0xa3a9('0x13'));var hardwareService=require(_0xa3a9('0x14'));var logger=require(_0xa3a9('0x15'))(_0xa3a9('0x16'));var utils=require('../../config/utils');var config=require(_0xa3a9('0x17'));var db=require(_0xa3a9('0x18'))['db'];config[_0xa3a9('0x19')]=_[_0xa3a9('0x1a')](config[_0xa3a9('0x19')],{'host':_0xa3a9('0x1b'),'port':0x18eb});var socket=require(_0xa3a9('0x1c'))(new Redis(config['redis']));require(_0xa3a9('0x1d'))[_0xa3a9('0x1e')](socket);function respondWithStatusCode(_0x119b06,_0x43c0fe){_0x43c0fe=_0x43c0fe||0xcc;return function(_0x35db61){if(_0x35db61){return _0x119b06[_0xa3a9('0x1f')](_0x43c0fe);}return _0x119b06[_0xa3a9('0x20')](_0x43c0fe)[_0xa3a9('0x21')]();};}function respondWithResult(_0x3fc2d4,_0x26a526){_0x26a526=_0x26a526||0xc8;return function(_0x38f708){if(_0x38f708){return _0x3fc2d4[_0xa3a9('0x20')](_0x26a526)[_0xa3a9('0x22')](_0x38f708);}};}function respondWithFilteredResult(_0x520c36,_0x174ded){return function(_0x5b5138){if(_0x5b5138){var _0x56d3f8=_0x5b5138[_0xa3a9('0x23')],_0x3cbb7b=_0x174ded[_0xa3a9('0x24')],_0x163f6e=_0x174ded[_0xa3a9('0x24')]+_0x174ded['limit'],_0x3d455d;if(_0x163f6e>=_0x56d3f8){_0x163f6e=_0x56d3f8;_0x3d455d=0xc8;}else{_0x3d455d=0xce;}_0x520c36['status'](_0x3d455d);return _0x520c36['set'](_0xa3a9('0x25'),_0x3cbb7b+'-'+_0x163f6e+'/'+_0x56d3f8)[_0xa3a9('0x22')](_0x5b5138);}return null;};}function patchUpdates(_0x4df82a){return function(_0xc3c871){try{jsonpatch[_0xa3a9('0x26')](_0xc3c871,_0x4df82a,!![]);}catch(_0x4055af){return BPromise[_0xa3a9('0x27')](_0x4055af);}return _0xc3c871['save']();};}function saveUpdates(_0x532c15,_0x25b7ae){return function(_0x43e751){if(_0x43e751){return _0x43e751[_0xa3a9('0x28')](_0x532c15)[_0xa3a9('0x29')](function(_0x416e79){return _0x416e79;});}return null;};}function removeEntity(_0x4ef9c1,_0xd31f52){return function(_0x2485e2){if(_0x2485e2){return _0x2485e2[_0xa3a9('0x2a')]()[_0xa3a9('0x29')](function(){_0x4ef9c1[_0xa3a9('0x20')](0xcc)[_0xa3a9('0x21')]();});}};}function handleEntityNotFound(_0x352abe,_0x427b9a){return function(_0x41ac07){if(!_0x41ac07){_0x352abe[_0xa3a9('0x1f')](0x194);}return _0x41ac07;};}function handleError(_0x5a4de8,_0x9af353){_0x9af353=_0x9af353||0x1f4;return function(_0x5e1f5e){logger['error'](_0x5e1f5e[_0xa3a9('0x2b')]);if(_0x5e1f5e['name']){delete _0x5e1f5e[_0xa3a9('0x2c')];}_0x5a4de8[_0xa3a9('0x20')](_0x9af353)['send'](_0x5e1f5e);};}function getInteractionUsers(_0x2a8428,_0x399718){return new BPromise(function(_0x5d3069,_0x39e492){try{if(_0x399718[_0x2a8428['id']]){_0x2a8428[_0xa3a9('0x2d')]=_[_0xa3a9('0x2e')](_0x399718[_0x2a8428['id']],function(_0x564e7e){return{'id':_0x564e7e['id'],'fullname':_0x564e7e[_0xa3a9('0x2f')]};});}}catch(_0x5ab637){_0x39e492(_0x5ab637);}_0x5d3069(_0x2a8428);});}function getInteractionTags(_0x587989,_0x4e2136){return new BPromise(function(_0x30df50,_0x31d549){try{if(_0x587989[_0xa3a9('0x30')]){_0x587989[_0xa3a9('0x31')]=[];_0x587989['TagIds']['split'](',')[_0xa3a9('0x32')](function(_0x1fe318){_0x587989[_0xa3a9('0x31')][_0xa3a9('0x33')](_0x4e2136[_0x1fe318]);});}delete _0x587989[_0xa3a9('0x30')];}catch(_0x8f1265){_0x31d549(_0x8f1265);}_0x30df50(_0x587989);});}function updateOpenchannelInteraction(_0x1eaec4,_0x572122,_0x2ab3c9){return new BPromise(function(_0x1efd23,_0xa968de){return getInteractionUsers(_0x1eaec4,_0x2ab3c9)[_0xa3a9('0x29')](function(_0x412329){return getInteractionTags(_0x412329,_0x572122);})[_0xa3a9('0x29')](function(_0x36d46a){_0x1efd23(_0x36d46a);})[_0xa3a9('0x34')](function(_0x28269e){_0xa968de(_0x28269e);});});}exports[_0xa3a9('0x35')]=function(_0x34337a,_0xb01f5e){var _0x4c5fd3={},_0x1a6e28={},_0x1681ef={'count':0x0,'rows':[]};var _0x5b091d=_[_0xa3a9('0x2e')](db[_0xa3a9('0x36')]['rawAttributes'],function(_0x5a05ae){return{'name':_0x5a05ae['fieldName'],'type':_0x5a05ae[_0xa3a9('0x37')][_0xa3a9('0x38')]};});_0x1a6e28['model']=_[_0xa3a9('0x2e')](_0x5b091d,_0xa3a9('0x2c'));_0x1a6e28[_0xa3a9('0x39')]=_[_0xa3a9('0x3a')](_0x34337a['query']);_0x1a6e28[_0xa3a9('0x3b')]=_[_0xa3a9('0x3c')](_0x1a6e28[_0xa3a9('0x3d')],_0x1a6e28[_0xa3a9('0x39')]);_0x4c5fd3[_0xa3a9('0x3e')]=_[_0xa3a9('0x3c')](_0x1a6e28[_0xa3a9('0x3d')],qs['fields'](_0x34337a['query'][_0xa3a9('0x3f')]));_0x4c5fd3['attributes']=_0x4c5fd3[_0xa3a9('0x3e')][_0xa3a9('0x40')]?_0x4c5fd3[_0xa3a9('0x3e')]:_0x1a6e28['model'];if(!_0x34337a['query'][_0xa3a9('0x41')](_0xa3a9('0x42'))){_0x4c5fd3[_0xa3a9('0x43')]=qs[_0xa3a9('0x43')](_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x43')]);_0x4c5fd3['offset']=qs[_0xa3a9('0x24')](_0x34337a[_0xa3a9('0x39')]['offset']);}_0x4c5fd3[_0xa3a9('0x44')]=qs[_0xa3a9('0x45')](_0x34337a['query']['sort']);_0x4c5fd3[_0xa3a9('0x46')]=qs[_0xa3a9('0x3b')](_[_0xa3a9('0x47')](_0x34337a['query'],_0x1a6e28[_0xa3a9('0x3b')]),_0x5b091d);var _0xe09690=[];var _0x5331d6=squel['select']()[_0xa3a9('0x48')]('id')[_0xa3a9('0x48')]('name')[_0xa3a9('0x48')]('color')[_0xa3a9('0x49')]('tools_tags');var _0x402d3e=squel[_0xa3a9('0x4a')]()[_0xa3a9('0x48')](_0xa3a9('0x4b'))[_0xa3a9('0x48')](_0xa3a9('0x4c'))['field']('ui.OpenchannelInteractionId')[_0xa3a9('0x49')](_0xa3a9('0x4d'),'ui')[_0xa3a9('0x4e')]('users','u','u.id\x20=\x20ui.UserId');var _0x2dd9dd=squel['select']()[_0xa3a9('0x49')]('openchannel_interactions','i')['left_join'](_0xa3a9('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa3a9('0x4e')](_0xa3a9('0x50'),'o',_0xa3a9('0x51'))[_0xa3a9('0x4e')](_0xa3a9('0x52'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xa3a9('0x4e')](_0xa3a9('0x53'),'me',_0xa3a9('0x54'))[_0xa3a9('0x4e')](_0xa3a9('0x55'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xa3a9('0x56'),'t',_0xa3a9('0x57'));var _0x14bdff=squel['expr']();var _0x1dbf44=[];var _0xed4831=squel[_0xa3a9('0x58')]();var _0x58881b;if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x59')]){_0x58881b=as[_0xa3a9('0x5a')](_0x34337a[_0xa3a9('0x39')]['search']);var _0x15c075=_0x58881b[_0xa3a9('0x5b')];for(var _0x34bfd7=0x0;_0x34bfd7<_0x58881b[_0xa3a9('0x5c')]['length'];_0x34bfd7++){var _0x239d69=_0x58881b['conditions'][_0x34bfd7];var _0x528f61='i';var _0x497311=_[_0xa3a9('0x5d')](_0x5b091d,[_0xa3a9('0x2c'),_0x239d69[_0xa3a9('0x48')]]);if(!_0x497311){switch(_0x239d69[_0xa3a9('0x48')]){case _0xa3a9('0x5e'):if(_0x239d69[_0xa3a9('0x5f')]==0x1){_0x2dd9dd[_0xa3a9('0x60')]('`'+_0x239d69['field']+'`\x20=\x200');}else{_0x2dd9dd[_0xa3a9('0x60')]('`'+_0x239d69[_0xa3a9('0x48')]+_0xa3a9('0x61'));}break;case _0xa3a9('0x62'):if(_0x239d69[_0xa3a9('0x63')]===_0xa3a9('0x64')){if(_0x239d69[_0xa3a9('0x5f')][_0xa3a9('0x65')]('\x20')[_0xa3a9('0x40')]>0x1){_0x14bdff[_0x15c075](_0xa3a9('0x66'),qs[_0xa3a9('0x67')](_0x239d69[_0xa3a9('0x5f')]),null);}else{var _0x1f6e5f='%'+_0x239d69['value']+'%';_0x14bdff[_0x15c075](_0xa3a9('0x68'),_0x1f6e5f,_0x1f6e5f,_0x1f6e5f);}}else{_0x497311=_[_0xa3a9('0x5d')](_0x5b091d,['name',_0xa3a9('0x69')]);_0x239d69[_0xa3a9('0x48')]=_0xa3a9('0x69');_0x159736=as[_0xa3a9('0x6a')](_0x528f61,_0x497311[_0xa3a9('0x37')],_0x239d69);_0x14bdff[_0x15c075](_0x159736['text'],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x6b')],_0x159736[_0xa3a9('0x5f')]['end']);}break;case _0xa3a9('0x6c'):var _0x5ede46=_0x239d69[_0xa3a9('0x5f')]['split'](',')[_0xa3a9('0x2e')](function(_0x5c37cc){return Number(_0x5c37cc);});_0x5ede46[_0xa3a9('0x32')](function(_0x341a01){_0xed4831['or'](_0xa3a9('0x6d'),'%,'+_0x341a01+',%');});_0x1dbf44=_[_0xa3a9('0x6e')](_0x1dbf44,_0x5ede46);break;case _0xa3a9('0x6f'):if(_0x239d69[_0xa3a9('0x63')]===_0xa3a9('0x64')){_0x14bdff[_0x15c075](_0xa3a9('0x70'),'%'+_0x239d69[_0xa3a9('0x5f')]+'%',null);}else{_0x497311=_[_0xa3a9('0x5d')](_0x5b091d,[_0xa3a9('0x2c'),_0xa3a9('0x71')]);_0x239d69[_0xa3a9('0x48')]=_0xa3a9('0x71');_0x159736=as[_0xa3a9('0x6a')](_0x528f61,_0x497311['type'],_0x239d69);_0x14bdff[_0x15c075](_0x159736[_0xa3a9('0x72')],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x6b')],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x21')]);}break;case'body':_0x159736=as[_0xa3a9('0x6a')]('me',null,_0x239d69);_0x14bdff[_0x15c075](_0x159736[_0xa3a9('0x72')],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x6b')],_0x159736[_0xa3a9('0x5f')][_0xa3a9('0x21')]);break;}}else{var _0x159736=as[_0xa3a9('0x6a')](_0x528f61,_0x497311[_0xa3a9('0x37')],_0x239d69);_0x14bdff[_0x15c075](_0x159736[_0xa3a9('0x72')],_0x159736[_0xa3a9('0x5f')]['start'],_0x159736[_0xa3a9('0x5f')]['end']);}}}else{var _0x264a3f=_(_0x34337a['query'])[_0xa3a9('0x3a')]()[_0xa3a9('0x2e')](function(_0x35d562){return _[_0xa3a9('0x73')](_0x5b091d,[_0xa3a9('0x2c'),_0x35d562])?_0x35d562:undefined;})[_0xa3a9('0x74')]()[_0xa3a9('0x5f')]();if(!_['isEmpty'](_0x264a3f)){_0x264a3f['forEach'](function(_0x2411e7){if(_0x2411e7===_0xa3a9('0x75')){_0x2dd9dd['where'](_0xa3a9('0x76'),[][_0xa3a9('0x77')](_0x34337a[_0xa3a9('0x39')][_0x2411e7]));}else if(_0x2411e7===_0xa3a9('0x78')){var _0x313aef=JSON[_0xa3a9('0x79')](_0x34337a[_0xa3a9('0x39')][_0x2411e7])[_0xa3a9('0x7a')];var _0x2500dc=JSON[_0xa3a9('0x79')](_0x34337a['query'][_0x2411e7])[_0xa3a9('0x7b')];_0x2dd9dd['where'](_0xa3a9('0x7c'),_0x313aef,_0x2500dc);}else{if(_0x34337a['query'][_0x2411e7]===_0xa3a9('0x7d')){_0x2dd9dd[_0xa3a9('0x46')]('i.'+_0x2411e7+_0xa3a9('0x7e'));}else{_0x2dd9dd[_0xa3a9('0x46')]('i.'+_0x2411e7+_0xa3a9('0x7f'),_0x34337a['query'][_0x2411e7]);}}});}if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x80')]){if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x80')]==0x1){_0x2dd9dd[_0xa3a9('0x60')](_0xa3a9('0x81'));}else{_0x2dd9dd[_0xa3a9('0x60')]('`unreadMessages`\x20>\x200');}}if(_0x34337a['query'][_0xa3a9('0x82')]){_0x1dbf44=_[_0xa3a9('0x83')](_0x34337a['query'][_0xa3a9('0x82')])?_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x82')]:new Array(_0x34337a['query']['tag']);_0x1dbf44['forEach'](function(_0x1ac91a){_0xed4831['or'](_0xa3a9('0x6d'),'%,'+_0x1ac91a+',%');});}if(_0x34337a['query'][_0xa3a9('0x84')]){var _0x407bb7=_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x84')][_0xa3a9('0x85')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xa3a9('0x86')](_0x407bb7)){_0x14bdff['or'](_0xa3a9('0x87'),_0x407bb7+'%');}else{_0x14bdff['or'](_0xa3a9('0x88'),qs[_0xa3a9('0x67')](_0x407bb7))['or']('i.from\x20LIKE\x20?',_0x407bb7+'%')['or'](_0xa3a9('0x89'),_0x407bb7+'%');}}}_0x2dd9dd['where'](_0x14bdff);_0x2dd9dd[_0xa3a9('0x8a')]('i.id');var _0x26257b={'type':db[_0xa3a9('0x8b')]['QueryTypes'][_0xa3a9('0x8c')],'raw':!![]};var _0x532feb=_0x2dd9dd[_0xa3a9('0x8d')]();_0x532feb[_0xa3a9('0x48')]('i.id');_0x532feb[_0xa3a9('0x48')](_0xa3a9('0x8e'),_0xa3a9('0x5e'));if(_0x4c5fd3[_0xa3a9('0x44')]){_0x4c5fd3['order'][_0xa3a9('0x32')](function(_0x45a90a){_0x2dd9dd[_0xa3a9('0x44')]('i.'+_0x45a90a[0x0],_0x45a90a[0x1]==='DESC'?![]:!![]);});}if(!_[_0xa3a9('0x8f')](_0x1dbf44)){_0x2dd9dd[_0xa3a9('0x60')](_0xed4831);_0x532feb[_0xa3a9('0x46')](_0xa3a9('0x90'),_0x1dbf44);}BPromise[_0xa3a9('0x91')]()['then'](function(){if(!_0x58881b){if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x75')]||_0x34337a[_0xa3a9('0x39')]['journey'])return;_0x532feb['where'](_0xa3a9('0x92'));_0x2dd9dd[_0xa3a9('0x46')](_0xa3a9('0x92'));return;}return _0x34337a['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xa3a9('0x29')](function(_0x45838c){if(_[_0xa3a9('0x8f')](_0x45838c)){_0x532feb[_0xa3a9('0x46')](_0xa3a9('0x93'));_0x2dd9dd['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x532feb[_0xa3a9('0x46')](_0xa3a9('0x76'),_['map'](_0x45838c,'id'));_0x2dd9dd[_0xa3a9('0x46')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xa3a9('0x2e')](_0x45838c,'id'));}});})[_0xa3a9('0x29')](function(){db[_0xa3a9('0x94')]['query'](_0x532feb['toString'](),_0x26257b)[_0xa3a9('0x29')](function(_0x2ab5d2){_0x1681ef[_0xa3a9('0x23')]=_0x2ab5d2['length'];if(_0x1681ef[_0xa3a9('0x23')]===0x0)return[];return db[_0xa3a9('0x94')][_0xa3a9('0x39')](_0x5331d6['toString'](),_0x26257b)[_0xa3a9('0x29')](function(_0x18082a){_0xe09690=_[_0xa3a9('0x95')](_0x18082a,'id');_0x26257b=_[_0xa3a9('0x96')](_0x26257b,{'model':db[_0xa3a9('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34337a[_0xa3a9('0x39')][_0xa3a9('0x3f')]){_0x4c5fd3[_0xa3a9('0x3e')]['forEach'](function(_0x13f22d){_0x2dd9dd[_0xa3a9('0x48')]('i.'+_0x13f22d);});}else{_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0x8e'),_0xa3a9('0x5e'));_0x2dd9dd[_0xa3a9('0x48')]('a.key',_0xa3a9('0x97'));_0x2dd9dd['field']('a.mandatoryDisposition',_0xa3a9('0x98'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0x99'));_0x2dd9dd['field'](_0xa3a9('0x9a'),'Contact.firstName');_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0x9b'),'Contact.lastName');_0x2dd9dd['field'](_0xa3a9('0x9c'),_0xa3a9('0x9d'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0x9e'),_0xa3a9('0x9f'));_0x2dd9dd['field'](_0xa3a9('0xa0'),_0xa3a9('0xa1'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0xa2'),_0xa3a9('0xa3'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0xa4'),'Owner.fullname');_0x2dd9dd[_0xa3a9('0x48')]('o.internal',_0xa3a9('0xa5'));_0x2dd9dd[_0xa3a9('0x48')](_0xa3a9('0xa6'),_0xa3a9('0x30'));}if(_0x4c5fd3[_0xa3a9('0x43')])_0x2dd9dd[_0xa3a9('0x43')](_0x4c5fd3['limit']);if(_0x4c5fd3[_0xa3a9('0x24')])_0x2dd9dd[_0xa3a9('0x24')](_0x4c5fd3[_0xa3a9('0x24')]);return db[_0xa3a9('0x94')][_0xa3a9('0x39')](_0x2dd9dd[_0xa3a9('0xa7')](),_0x26257b);})[_0xa3a9('0x29')](function(_0x3011eb){_0x402d3e[_0xa3a9('0x46')](_0xa3a9('0xa8'),_[_0xa3a9('0x2e')](_0x3011eb,'id'));return db['sequelize'][_0xa3a9('0x39')](_0x402d3e['toString'](),_0x26257b)[_0xa3a9('0x29')](function(_0x28e88d){var _0x13e73e=_[_0xa3a9('0xa9')](_0x28e88d,_0xa3a9('0xaa'));var _0x4149fe=[];_0x3011eb[_0xa3a9('0x32')](function(_0x37f529){_0x4149fe[_0xa3a9('0x33')](updateOpenchannelInteraction(_0x37f529,_0xe09690,_0x13e73e));});return BPromise[_0xa3a9('0xab')](_0x4149fe);});});})[_0xa3a9('0x29')](function(_0x49e2fc){_0x1681ef['rows']=_0x49e2fc;return _0x1681ef;})[_0xa3a9('0x29')](respondWithFilteredResult(_0xb01f5e,_0x4c5fd3));})[_0xa3a9('0x34')](handleError(_0xb01f5e,null));};exports['show']=function(_0x4b0dd9,_0x42ac28){var _0x5313f6={'raw':![],'where':{'id':_0x4b0dd9[_0xa3a9('0xac')]['id']}},_0x38d5f2={};_0x38d5f2[_0xa3a9('0x3d')]=_[_0xa3a9('0x3a')](db[_0xa3a9('0x36')][_0xa3a9('0xad')]);_0x38d5f2[_0xa3a9('0x39')]=_['keys'](_0x4b0dd9['query']);_0x38d5f2[_0xa3a9('0x3b')]=_['intersection'](_0x38d5f2[_0xa3a9('0x3d')],_0x38d5f2[_0xa3a9('0x39')]);_0x5313f6[_0xa3a9('0x3e')]=_[_0xa3a9('0x3c')](_0x38d5f2[_0xa3a9('0x3d')],qs[_0xa3a9('0x3f')](_0x4b0dd9['query'][_0xa3a9('0x3f')]));_0x5313f6['attributes']=_0x5313f6[_0xa3a9('0x3e')]['length']?_0x5313f6[_0xa3a9('0x3e')]:_0x38d5f2[_0xa3a9('0x3d')];if(_0x4b0dd9[_0xa3a9('0x39')][_0xa3a9('0xae')]){_0x5313f6['include']=[{'all':!![]}];}_0x5313f6=_[_0xa3a9('0x96')]({},_0x5313f6,_0x4b0dd9[_0xa3a9('0xaf')]);return db[_0xa3a9('0x36')][_0xa3a9('0x5d')](_0x5313f6)[_0xa3a9('0x29')](handleEntityNotFound(_0x42ac28,null))['then'](respondWithResult(_0x42ac28,null))[_0xa3a9('0x34')](handleError(_0x42ac28,null));};exports[_0xa3a9('0xb0')]=function(_0x56ec8e,_0x3457ca){return db[_0xa3a9('0x36')]['create'](_0x56ec8e['body'],{})[_0xa3a9('0x29')](respondWithResult(_0x3457ca,0xc9))['catch'](handleError(_0x3457ca,null));};exports['update']=function(_0x2b3607,_0x49dedd){if(_0x2b3607[_0xa3a9('0xb1')]['id']){delete _0x2b3607[_0xa3a9('0xb1')]['id'];}return db['OpenchannelInteraction'][_0xa3a9('0x5d')]({'where':{'id':_0x2b3607[_0xa3a9('0xac')]['id']}})['then'](handleEntityNotFound(_0x49dedd,null))['then'](saveUpdates(_0x2b3607[_0xa3a9('0xb1')],null))[_0xa3a9('0x29')](respondWithResult(_0x49dedd,null))[_0xa3a9('0x34')](handleError(_0x49dedd,null));};exports[_0xa3a9('0x2a')]=function(_0xadbc2b,_0x34a62d){return db[_0xa3a9('0x36')][_0xa3a9('0x5d')]({'where':{'id':_0xadbc2b[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x34a62d,null))['then'](removeEntity(_0x34a62d,null))['catch'](handleError(_0x34a62d,null));};exports[_0xa3a9('0xb2')]=function(_0xfd4ac1,_0x28887c){return db[_0xa3a9('0x36')][_0xa3a9('0xb2')]()[_0xa3a9('0x29')](respondWithResult(_0x28887c,null))['catch'](handleError(_0x28887c,null));};exports[_0xa3a9('0xb3')]=function(_0x3ece88,_0x2e0e16,_0x5d175b){return db[_0xa3a9('0xb4')][_0xa3a9('0x5d')]({'where':{'id':_0x3ece88[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x2e0e16,null))[_0xa3a9('0x29')](function(_0x2d1dcd){if(_0x2d1dcd){return _0x2d1dcd[_0xa3a9('0xb3')](_0x3ece88[_0xa3a9('0xb1')]['ids'],_['omit'](_0x3ece88['body'],[_0xa3a9('0xb5'),'id'])||{});}})[_0xa3a9('0x29')](respondWithResult(_0x2e0e16,null))[_0xa3a9('0x34')](handleError(_0x2e0e16,null));};exports[_0xa3a9('0xb6')]=function(_0x320575,_0x5b5d4b,_0x48fa0c){var _0x138afc={'raw':![],'where':{}};var _0x508076={};var _0x34283e={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xa3a9('0xb7')]({'where':{'id':_0x320575[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x5b5d4b,null))[_0xa3a9('0x29')](function(_0x5a772b){if(_0x5a772b){_0x508076[_0xa3a9('0x3d')]=_[_0xa3a9('0x3a')](db['OpenchannelMessage'][_0xa3a9('0xad')]);_0x508076['query']=_[_0xa3a9('0x3a')](_0x320575[_0xa3a9('0x39')]);_0x508076[_0xa3a9('0x3b')]=_[_0xa3a9('0x3c')](_0x508076[_0xa3a9('0x3d')],_0x508076['query']);_0x138afc[_0xa3a9('0x3e')]=_['intersection'](_0x508076[_0xa3a9('0x3d')],qs[_0xa3a9('0x3f')](_0x320575[_0xa3a9('0x39')][_0xa3a9('0x3f')]));_0x138afc[_0xa3a9('0x3e')]=_0x138afc[_0xa3a9('0x3e')][_0xa3a9('0x40')]?_0x138afc[_0xa3a9('0x3e')]:_0x508076[_0xa3a9('0x3d')];if(!_0x320575[_0xa3a9('0x39')][_0xa3a9('0x41')](_0xa3a9('0x42'))){_0x138afc[_0xa3a9('0x43')]=qs[_0xa3a9('0x43')](_0x320575[_0xa3a9('0x39')]['limit']);_0x138afc['offset']=qs['offset'](_0x320575[_0xa3a9('0x39')]['offset']);}_0x138afc[_0xa3a9('0x44')]=qs[_0xa3a9('0x45')](_0x320575[_0xa3a9('0x39')][_0xa3a9('0x45')]);_0x138afc[_0xa3a9('0x46')]=qs['filters'](_[_0xa3a9('0x47')](_0x320575[_0xa3a9('0x39')],_0x508076[_0xa3a9('0x3b')]));_0x138afc['where']['OpenchannelInteractionId']=_0x5a772b['id'];if(_0x320575['query'][_0xa3a9('0x84')]){_0x138afc[_0xa3a9('0x46')]=_['merge'](_0x138afc[_0xa3a9('0x46')],{'$or':_[_0xa3a9('0x2e')](_0x138afc[_0xa3a9('0x3e')],function(_0x1f3351){var _0x220d94={};_0x220d94[_0x1f3351]={'$like':'%'+_0x320575[_0xa3a9('0x39')][_0xa3a9('0x84')]+'%'};return _0x220d94;})});}if(_0x320575[_0xa3a9('0x39')][_0xa3a9('0x7a')]){var _0x368181=_0x320575[_0xa3a9('0x39')]['$gte'][_0xa3a9('0x65')](',');var _0x15bf08={};_0x15bf08[_0x368181[0x0]]={'$gte':moment(_0x368181[0x1])[_0xa3a9('0xb8')](_0xa3a9('0xb9'))};_0x138afc[_0xa3a9('0x46')]=_['merge'](_0x138afc['where'],_0x15bf08);}_0x138afc=_[_0xa3a9('0x96')]({},_0x138afc,_0x320575[_0xa3a9('0xaf')]);return db[_0xa3a9('0xb4')][_0xa3a9('0x23')]({'where':_0x138afc[_0xa3a9('0x46')]})[_0xa3a9('0x29')](function(_0x41f71f){_0x34283e[_0xa3a9('0x23')]=_0x41f71f;if(_0x320575[_0xa3a9('0x39')][_0xa3a9('0xae')]){_0x138afc[_0xa3a9('0xba')]=[{'all':!![]}];}return db[_0xa3a9('0xb4')][_0xa3a9('0xbb')](_0x138afc);})[_0xa3a9('0x29')](function(_0x4a8642){_0x34283e['rows']=_0x4a8642;return _0x34283e;});}})[_0xa3a9('0x29')](respondWithFilteredResult(_0x5b5d4b,_0x138afc))['catch'](handleError(_0x5b5d4b,null));};exports[_0xa3a9('0xbc')]=function(_0x5c41a9,_0x3a718a,_0x525b6f){return db[_0xa3a9('0x36')]['find']({'where':{'id':_0x5c41a9[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x3a718a,null))[_0xa3a9('0x29')](function(_0x4a1c7e){if(_0x4a1c7e){return _0x4a1c7e[_0xa3a9('0xbd')](_0x5c41a9['body'][_0xa3a9('0xb5')],_[_0xa3a9('0xbe')](_0x5c41a9[_0xa3a9('0xb1')],[_0xa3a9('0xb5'),'id'])||{})['spread'](function(){return db[_0xa3a9('0x6c')]['findAll']({'attributes':['id',_0xa3a9('0x2c'),_0xa3a9('0xbf')],'where':{'id':_0x5c41a9[_0xa3a9('0xb1')]['ids']}});})[_0xa3a9('0x29')](function(_0x18a8ba){socket['emit'](_0xa3a9('0xc0'),{'id':Number(_0x5c41a9['params']['id']),'tags':_0x18a8ba||[]});return{'id':Number(_0x5c41a9[_0xa3a9('0xac')]['id']),'tags':_0x18a8ba||[]};});}})[_0xa3a9('0x29')](respondWithResult(_0x3a718a,null))[_0xa3a9('0x34')](handleError(_0x3a718a,null));};exports[_0xa3a9('0xc1')]=function(_0x337905,_0x5ee177,_0x8547f4){return db[_0xa3a9('0x36')][_0xa3a9('0x5d')]({'where':{'id':_0x337905[_0xa3a9('0xac')]['id']}})[_0xa3a9('0x29')](handleEntityNotFound(_0x5ee177,null))['then'](function(_0x219a09){if(_0x219a09){return _0x219a09[_0xa3a9('0xc1')](_0x337905[_0xa3a9('0x39')]['ids']);}})[_0xa3a9('0x29')](respondWithStatusCode(_0x5ee177,null))[_0xa3a9('0x34')](handleError(_0x5ee177,null));};exports[_0xa3a9('0xc2')]=function(_0x2c1dc7,_0x3b441b){var _0x44a79e=moment()['unix']()[_0xa3a9('0xa7')]();var _0x184507=path[_0xa3a9('0xc3')](config[_0xa3a9('0xc4')],_0xa3a9('0xc5'),_0xa3a9('0xc6'),_0xa3a9('0xc7'));var _0x1590ee=path[_0xa3a9('0xc3')](config[_0xa3a9('0xc4')],_0xa3a9('0xc5'),'files',_0xa3a9('0xc8'));var _0x2c6f66=path[_0xa3a9('0xc3')](_0x184507,_0x44a79e);var _0x50a003=util[_0xa3a9('0xb8')](_0xa3a9('0xc9'),_0x2c1dc7[_0xa3a9('0xac')]['id'],_0x44a79e);var _0x1665cb=path[_0xa3a9('0xc3')](_0x184507,_0x50a003);var _0x30a828=[];_0x30a828[_0xa3a9('0x33')]({'model':db[_0xa3a9('0x6f')],'as':'User','attributes':['id',_0xa3a9('0x2f')],'raw':!![]});_0x30a828['push']({'model':db[_0xa3a9('0xca')],'as':_0xa3a9('0x62'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x2c1dc7[_0xa3a9('0x39')][_0xa3a9('0xc8')]){_0x30a828['push']({'model':db['Attachment'],'as':_0xa3a9('0xcb'),'raw':!![]});}var _0x561ce6=[{'model':db[_0xa3a9('0xb4')],'as':_0xa3a9('0xcc'),'attributes':['id',_0xa3a9('0xb1'),_0xa3a9('0x78'),_0xa3a9('0xcd'),'secret',_0xa3a9('0x80')],'include':_0x30a828}];_0x561ce6[_0xa3a9('0x33')]({'model':db[_0xa3a9('0xce')],'as':_0xa3a9('0xcf'),'attributes':['id','name']});_0x561ce6[_0xa3a9('0x33')]({'model':db[_0xa3a9('0x6f')],'as':_0xa3a9('0xd0'),'attributes':['id',_0xa3a9('0x2f')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2c1dc7[_0xa3a9('0xac')]['id']},'include':_0x561ce6})[_0xa3a9('0x29')](handleEntityNotFound(_0x3b441b,null))[_0xa3a9('0x29')](function(_0x226583){if(_0x226583){var _0x450c15=_0x226583[_0xa3a9('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x2c6f66);var _0x181086={'format':'A4','border':_0xa3a9('0xd2'),'header':{'height':_0xa3a9('0xd3'),'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':_0xa3a9('0xd4'),'contents':{'default':util[_0xa3a9('0xb8')](_0xa3a9('0xd5'),util['format'](_0xa3a9('0xd6'),'Openchannel',_0x450c15['id']),moment()[_0xa3a9('0xb8')](_0xa3a9('0xd7'))[_0xa3a9('0xa7')]())}}};var _0x5e62a0={'channel':'Openchannel','account':_0x450c15['Account']['name'],'agent':_0x450c15[_0xa3a9('0xd0')]?_0x450c15['Owner'][_0xa3a9('0x2f')]:'N.A.','createdAt':moment(_0x450c15['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa3a9('0xa7')](),'closedAt':_0x450c15[_0xa3a9('0xd8')]?moment(_0x450c15[_0xa3a9('0xd9')])[_0xa3a9('0xb8')](_0xa3a9('0xb9'))[_0xa3a9('0xa7')]():'','disposition':_0x450c15[_0xa3a9('0xda')],'visibility':_0x450c15[_0xa3a9('0xdb')]?'Public':_0xa3a9('0xdc'),'messages':_(_0x450c15[_0xa3a9('0xcc')])['filter']({'secret':![]})[_0xa3a9('0x2e')](function(_0xad45fc){if(_0xad45fc[_0xa3a9('0xcb')]){var _0xc343af=path[_0xa3a9('0xc3')](_0x1590ee,_0xad45fc['Attachment']['basename']);if(fs[_0xa3a9('0xdd')](_0xc343af)){fs[_0xa3a9('0xde')](_0xc343af)['pipe'](fs['createWriteStream'](path[_0xa3a9('0xc3')](_0x2c6f66,_0xad45fc[_0xa3a9('0xcb')][_0xa3a9('0xdf')])));}}return{'date':moment(_0xad45fc[_0xa3a9('0x78')])[_0xa3a9('0xb8')](_0xa3a9('0xb9'))[_0xa3a9('0xa7')](),'sender':_0xad45fc[_0xa3a9('0xcd')]===_0xa3a9('0xe0')?_0xad45fc['User']?_0xad45fc[_0xa3a9('0x6f')][_0xa3a9('0x2f')]:_0xa3a9('0xe1'):_0xad45fc['Contact']['firstName']+(_0xad45fc[_0xa3a9('0x62')][_0xa3a9('0xe2')]?'\x20'+_0xad45fc[_0xa3a9('0x62')]['lastName']:''),'body':_0xad45fc[_0xa3a9('0xcb')]?_0xad45fc[_0xa3a9('0xcb')][_0xa3a9('0xdf')]:_0xad45fc[_0xa3a9('0xb1')],'direction':_0xad45fc[_0xa3a9('0xcd')]==='out'?'A':'C','secret':_0xad45fc[_0xa3a9('0xe3')],'read':_0xad45fc[_0xa3a9('0x80')],'attachment':_0xad45fc[_0xa3a9('0xcb')]};})[_0xa3a9('0x5f')]()};return ejs['renderFile'](path[_0xa3a9('0xc3')](config[_0xa3a9('0xc4')],'server',_0xa3a9('0xe4'),_0xa3a9('0xe5')),{'interaction':_0x5e62a0})['then'](function(_0x595216){return new BPromise(function(_0x7b85e,_0x1d4549){pdf[_0xa3a9('0xb0')](_0x595216,_0x181086)[_0xa3a9('0xe6')](path[_0xa3a9('0xc3')](_0x2c6f66,_0xa3a9('0xe7')+_0x450c15['id']+'-'+_0x44a79e+_0xa3a9('0xe8')),function(_0x2fdf21,_0x3bb7c5){if(_0x2fdf21)return _0x1d4549(_0x2fdf21);_0x7b85e(_0x3bb7c5);});});})[_0xa3a9('0x29')](function(){return new BPromise(function(_0x123fc2,_0x194417){zipdir(_0x2c6f66,{'saveTo':_0x1665cb},function(_0xfa9445,_0x41c615){if(_0xfa9445)return _0x194417(_0xfa9445);return _0x123fc2(_0x41c615);});})['then'](function(){return new BPromise(function(_0x46c616,_0x43039c){rimraf(_0x2c6f66,function(_0x221a89){if(_0x221a89)_0x43039c(_0x221a89);return _0x46c616();});});})['then'](function(){return _0x3b441b[_0xa3a9('0xc2')](_0x1665cb,_0x50a003,function(_0x425f4f){if(_0x425f4f){console['log'](_0xa3a9('0xe9'),_0x425f4f);}else{fs[_0xa3a9('0xea')](_0x1665cb);}});});});}else{return _0x3b441b['sendStatus'](0xc8);}})['catch'](handleError(_0x3b441b,null));}; \ No newline at end of file +var _0x5697=['apply','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','OpenchannelInteraction','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','color','from','tools_tags','u.fullname','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','select','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','$substring','value','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','some','compact','OpenchannelAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','OpenchannelInteractionId','all','rows','show','params','includeAll','include','options','create','body','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Attachment','Messages','secret','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','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','System','direction','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','path','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','status','json','count','offset','limit'];(function(_0x43cba8,_0x1d9748){var _0x89176b=function(_0x15d25d){while(--_0x15d25d){_0x43cba8['push'](_0x43cba8['shift']());}};_0x89176b(++_0x1d9748);}(_0x5697,0x1b5));var _0x7569=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0x5697[_0x4a9beb];return _0x2d4c58;};'use strict';var pdf=require(_0x7569('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7569('0x1'));var zipdir=require(_0x7569('0x2'));var jsonpatch=require(_0x7569('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7569('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7569('0x5'));var squel=require(_0x7569('0x6'));var crypto=require(_0x7569('0x7'));var jsforce=require(_0x7569('0x8'));var deskjs=require(_0x7569('0x9'));var toCsv=require(_0x7569('0xa'));var querystring=require('querystring');var Papa=require(_0x7569('0xb'));var Redis=require('ioredis');var authService=require(_0x7569('0xc'));var qs=require(_0x7569('0xd'));var as=require(_0x7569('0xe'));var hardwareService=require(_0x7569('0xf'));var logger=require(_0x7569('0x10'))(_0x7569('0x11'));var utils=require(_0x7569('0x12'));var config=require(_0x7569('0x13'));var db=require(_0x7569('0x14'))['db'];config['redis']=_[_0x7569('0x15')](config[_0x7569('0x16')],{'host':_0x7569('0x17'),'port':0x18eb});var socket=require(_0x7569('0x18'))(new Redis(config[_0x7569('0x16')]));require(_0x7569('0x19'))['register'](socket);function respondWithStatusCode(_0x1ac382,_0x3d6e8c){_0x3d6e8c=_0x3d6e8c||0xcc;return function(_0x10af23){if(_0x10af23){return _0x1ac382[_0x7569('0x1a')](_0x3d6e8c);}return _0x1ac382['status'](_0x3d6e8c)[_0x7569('0x1b')]();};}function respondWithResult(_0x25299a,_0x507670){_0x507670=_0x507670||0xc8;return function(_0x4936e3){if(_0x4936e3){return _0x25299a[_0x7569('0x1c')](_0x507670)[_0x7569('0x1d')](_0x4936e3);}};}function respondWithFilteredResult(_0x533333,_0x30050f){return function(_0xf382ad){if(_0xf382ad){var _0x5c9875=_0xf382ad[_0x7569('0x1e')],_0x39a02d=_0x30050f[_0x7569('0x1f')],_0x12d83e=_0x30050f[_0x7569('0x1f')]+_0x30050f[_0x7569('0x20')],_0x2fee4d;if(_0x12d83e>=_0x5c9875){_0x12d83e=_0x5c9875;_0x2fee4d=0xc8;}else{_0x2fee4d=0xce;}_0x533333['status'](_0x2fee4d);return _0x533333['set']('Content-Range',_0x39a02d+'-'+_0x12d83e+'/'+_0x5c9875)[_0x7569('0x1d')](_0xf382ad);}return null;};}function patchUpdates(_0x4c36c9){return function(_0x303c22){try{jsonpatch[_0x7569('0x21')](_0x303c22,_0x4c36c9,!![]);}catch(_0x58aa33){return BPromise['reject'](_0x58aa33);}return _0x303c22[_0x7569('0x22')]();};}function saveUpdates(_0x5ea4f8,_0x4278d1){return function(_0x58a59f){if(_0x58a59f){return _0x58a59f[_0x7569('0x23')](_0x5ea4f8)[_0x7569('0x24')](function(_0xf2d6c0){return _0xf2d6c0;});}return null;};}function removeEntity(_0x2e1df7,_0x76e4b2){return function(_0x34af47){if(_0x34af47){return _0x34af47['destroy']()[_0x7569('0x24')](function(){_0x2e1df7[_0x7569('0x1c')](0xcc)[_0x7569('0x1b')]();});}};}function handleEntityNotFound(_0x3b8346,_0x34147b){return function(_0x37539d){if(!_0x37539d){_0x3b8346[_0x7569('0x1a')](0x194);}return _0x37539d;};}function handleError(_0x1820bd,_0x101702){_0x101702=_0x101702||0x1f4;return function(_0x1134b4){logger[_0x7569('0x25')](_0x1134b4[_0x7569('0x26')]);if(_0x1134b4[_0x7569('0x27')]){delete _0x1134b4[_0x7569('0x27')];}_0x1820bd['status'](_0x101702)[_0x7569('0x28')](_0x1134b4);};}function getInteractionUsers(_0x194349,_0x5d5e1e){return new BPromise(function(_0xdf5df9,_0x1c2a57){try{if(_0x5d5e1e[_0x194349['id']]){_0x194349[_0x7569('0x29')]=_[_0x7569('0x2a')](_0x5d5e1e[_0x194349['id']],function(_0x7ac8f9){return{'id':_0x7ac8f9['id'],'fullname':_0x7ac8f9[_0x7569('0x2b')]};});}}catch(_0x47c383){_0x1c2a57(_0x47c383);}_0xdf5df9(_0x194349);});}function getInteractionTags(_0x490441,_0x5f1ce4){return new BPromise(function(_0x196cd9,_0x1220a1){try{if(_0x490441[_0x7569('0x2c')]){_0x490441[_0x7569('0x2d')]=[];_0x490441[_0x7569('0x2c')][_0x7569('0x2e')](',')[_0x7569('0x2f')](function(_0x1ed915){_0x490441['Tags'][_0x7569('0x30')](_0x5f1ce4[_0x1ed915]);});}delete _0x490441[_0x7569('0x2c')];}catch(_0x5a4b24){_0x1220a1(_0x5a4b24);}_0x196cd9(_0x490441);});}function updateOpenchannelInteraction(_0x2f5310,_0x45bd57,_0xf92ff9){return new BPromise(function(_0x3994c9,_0x52cd1a){return getInteractionUsers(_0x2f5310,_0xf92ff9)[_0x7569('0x24')](function(_0x8e1d0c){return getInteractionTags(_0x8e1d0c,_0x45bd57);})[_0x7569('0x24')](function(_0x45037e){_0x3994c9(_0x45037e);})[_0x7569('0x31')](function(_0x452a74){_0x52cd1a(_0x452a74);});});}exports['index']=function(_0x4922d6,_0x4d1074){var _0x1ea1a5={},_0x2cee69={},_0x4e4181={'count':0x0,'rows':[]};var _0x4e8401=_[_0x7569('0x2a')](db[_0x7569('0x32')][_0x7569('0x33')],function(_0x47c24a){return{'name':_0x47c24a['fieldName'],'type':_0x47c24a[_0x7569('0x34')][_0x7569('0x35')]};});_0x2cee69[_0x7569('0x36')]=_[_0x7569('0x2a')](_0x4e8401,_0x7569('0x27'));_0x2cee69['query']=_[_0x7569('0x37')](_0x4922d6[_0x7569('0x38')]);_0x2cee69[_0x7569('0x39')]=_[_0x7569('0x3a')](_0x2cee69['model'],_0x2cee69[_0x7569('0x38')]);_0x1ea1a5[_0x7569('0x3b')]=_['intersection'](_0x2cee69['model'],qs['fields'](_0x4922d6[_0x7569('0x38')][_0x7569('0x3c')]));_0x1ea1a5[_0x7569('0x3b')]=_0x1ea1a5[_0x7569('0x3b')][_0x7569('0x3d')]?_0x1ea1a5[_0x7569('0x3b')]:_0x2cee69[_0x7569('0x36')];if(!_0x4922d6[_0x7569('0x38')][_0x7569('0x3e')]('nolimit')){_0x1ea1a5[_0x7569('0x20')]=qs['limit'](_0x4922d6[_0x7569('0x38')][_0x7569('0x20')]);_0x1ea1a5[_0x7569('0x1f')]=qs[_0x7569('0x1f')](_0x4922d6[_0x7569('0x38')][_0x7569('0x1f')]);}_0x1ea1a5[_0x7569('0x3f')]=qs[_0x7569('0x40')](_0x4922d6[_0x7569('0x38')]['sort']);_0x1ea1a5[_0x7569('0x41')]=qs[_0x7569('0x39')](_[_0x7569('0x42')](_0x4922d6[_0x7569('0x38')],_0x2cee69[_0x7569('0x39')]),_0x4e8401);var _0x3655e0=[];var _0x4013e1=squel['select']()[_0x7569('0x43')]('id')[_0x7569('0x43')]('name')['field'](_0x7569('0x44'))[_0x7569('0x45')](_0x7569('0x46'));var _0x15102d=squel['select']()[_0x7569('0x43')]('u.id')[_0x7569('0x43')](_0x7569('0x47'))[_0x7569('0x43')]('ui.OpenchannelInteractionId')['from'](_0x7569('0x48'),'ui')[_0x7569('0x49')]('users','u',_0x7569('0x4a'));var _0x440a00=squel[_0x7569('0x4b')]()['from']('openchannel_interactions','i')[_0x7569('0x49')]('cm_contacts','c',_0x7569('0x4c'))[_0x7569('0x49')](_0x7569('0x4d'),'o',_0x7569('0x4e'))[_0x7569('0x49')](_0x7569('0x4f'),'a',_0x7569('0x50'))[_0x7569('0x49')]('openchannel_messages','me',_0x7569('0x51'))[_0x7569('0x49')](_0x7569('0x52'),'it',_0x7569('0x53'))[_0x7569('0x49')](_0x7569('0x46'),'t',_0x7569('0x54'));var _0x2ef4d2=squel[_0x7569('0x55')]();var _0x1e6d93=[];var _0x5ddec=squel[_0x7569('0x55')]();var _0x562dad;if(_0x4922d6['query'][_0x7569('0x56')]){_0x562dad=as['parseSearch'](_0x4922d6['query']['search']);var _0x5ada5f=_0x562dad[_0x7569('0x57')];for(var _0x38db7c=0x0;_0x38db7c<_0x562dad['conditions']['length'];_0x38db7c++){var _0x3b3f4d=_0x562dad[_0x7569('0x58')][_0x38db7c];var _0x503811='i';var _0x3bb889=_['find'](_0x4e8401,[_0x7569('0x27'),_0x3b3f4d[_0x7569('0x43')]]);if(!_0x3bb889){switch(_0x3b3f4d[_0x7569('0x43')]){case _0x7569('0x59'):if(_0x3b3f4d['value']==0x1){_0x440a00[_0x7569('0x5a')]('`'+_0x3b3f4d[_0x7569('0x43')]+'`\x20=\x200');}else{_0x440a00[_0x7569('0x5a')]('`'+_0x3b3f4d['field']+_0x7569('0x5b'));}break;case _0x7569('0x5c'):if(_0x3b3f4d['operator']===_0x7569('0x5d')){if(_0x3b3f4d[_0x7569('0x5e')][_0x7569('0x2e')]('\x20')[_0x7569('0x3d')]>0x1){_0x2ef4d2[_0x5ada5f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3b3f4d['value']),null);}else{var _0x415e70='%'+_0x3b3f4d[_0x7569('0x5e')]+'%';_0x2ef4d2[_0x5ada5f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x415e70,_0x415e70,_0x415e70);}}else{_0x3bb889=_['find'](_0x4e8401,[_0x7569('0x27'),_0x7569('0x5f')]);_0x3b3f4d[_0x7569('0x43')]=_0x7569('0x5f');_0x18b03a=as['buildExpression'](_0x503811,_0x3bb889[_0x7569('0x34')],_0x3b3f4d);_0x2ef4d2[_0x5ada5f](_0x18b03a[_0x7569('0x60')],_0x18b03a[_0x7569('0x5e')][_0x7569('0x61')],_0x18b03a[_0x7569('0x5e')][_0x7569('0x1b')]);}break;case _0x7569('0x62'):var _0x2b407b=_0x3b3f4d['value']['split'](',')['map'](function(_0x30d57d){return Number(_0x30d57d);});_0x2b407b[_0x7569('0x2f')](function(_0x2d8579){_0x5ddec['or'](_0x7569('0x63'),'%,'+_0x2d8579+',%');});_0x1e6d93=_[_0x7569('0x64')](_0x1e6d93,_0x2b407b);break;case _0x7569('0x65'):if(_0x3b3f4d[_0x7569('0x66')]===_0x7569('0x5d')){_0x2ef4d2[_0x5ada5f](_0x7569('0x67'),'%'+_0x3b3f4d['value']+'%',null);}else{_0x3bb889=_[_0x7569('0x68')](_0x4e8401,['name','UserId']);_0x3b3f4d[_0x7569('0x43')]=_0x7569('0x69');_0x18b03a=as['buildExpression'](_0x503811,_0x3bb889[_0x7569('0x34')],_0x3b3f4d);_0x2ef4d2[_0x5ada5f](_0x18b03a['text'],_0x18b03a[_0x7569('0x5e')][_0x7569('0x61')],_0x18b03a[_0x7569('0x5e')][_0x7569('0x1b')]);}break;case'body':_0x18b03a=as[_0x7569('0x6a')]('me',null,_0x3b3f4d);_0x2ef4d2[_0x5ada5f](_0x18b03a['text'],_0x18b03a[_0x7569('0x5e')][_0x7569('0x61')],_0x18b03a[_0x7569('0x5e')][_0x7569('0x1b')]);break;}}else{var _0x18b03a=as['buildExpression'](_0x503811,_0x3bb889['type'],_0x3b3f4d);_0x2ef4d2[_0x5ada5f](_0x18b03a[_0x7569('0x60')],_0x18b03a['value']['start'],_0x18b03a[_0x7569('0x5e')]['end']);}}}else{var _0x5ebf7f=_(_0x4922d6[_0x7569('0x38')])[_0x7569('0x37')]()[_0x7569('0x2a')](function(_0x11649d){return _[_0x7569('0x6b')](_0x4e8401,['name',_0x11649d])?_0x11649d:undefined;})[_0x7569('0x6c')]()['value']();if(!_['isEmpty'](_0x5ebf7f)){_0x5ebf7f[_0x7569('0x2f')](function(_0x1d46f0){if(_0x1d46f0===_0x7569('0x6d')){_0x440a00['where']('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x4922d6['query'][_0x1d46f0]));}else if(_0x1d46f0===_0x7569('0x6e')){var _0x42bde6=JSON[_0x7569('0x6f')](_0x4922d6[_0x7569('0x38')][_0x1d46f0])[_0x7569('0x70')];var _0xe22771=JSON['parse'](_0x4922d6[_0x7569('0x38')][_0x1d46f0])[_0x7569('0x71')];_0x440a00[_0x7569('0x41')](_0x7569('0x72'),_0x42bde6,_0xe22771);}else{if(_0x4922d6[_0x7569('0x38')][_0x1d46f0]===_0x7569('0x73')){_0x440a00['where']('i.'+_0x1d46f0+'\x20IS\x20NULL');}else{_0x440a00[_0x7569('0x41')]('i.'+_0x1d46f0+_0x7569('0x74'),_0x4922d6['query'][_0x1d46f0]);}}});}if(_0x4922d6[_0x7569('0x38')][_0x7569('0x75')]){if(_0x4922d6[_0x7569('0x38')]['read']==0x1){_0x440a00[_0x7569('0x5a')]('`unreadMessages`\x20=\x200');}else{_0x440a00[_0x7569('0x5a')](_0x7569('0x76'));}}if(_0x4922d6[_0x7569('0x38')][_0x7569('0x77')]){_0x1e6d93=_['isArray'](_0x4922d6[_0x7569('0x38')][_0x7569('0x77')])?_0x4922d6[_0x7569('0x38')][_0x7569('0x77')]:new Array(_0x4922d6['query'][_0x7569('0x77')]);_0x1e6d93[_0x7569('0x2f')](function(_0x488da9){_0x5ddec['or'](_0x7569('0x63'),'%,'+_0x488da9+',%');});}if(_0x4922d6[_0x7569('0x38')][_0x7569('0x78')]){var _0x5061a2=_0x4922d6[_0x7569('0x38')][_0x7569('0x78')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x7569('0x79'));if(qs[_0x7569('0x7a')](_0x5061a2)){_0x2ef4d2['or'](_0x7569('0x7b'),_0x5061a2+'%');}else{_0x2ef4d2['or'](_0x7569('0x7c'),qs[_0x7569('0x7d')](_0x5061a2))['or'](_0x7569('0x7e'),_0x5061a2+'%')['or'](_0x7569('0x7f'),_0x5061a2+'%');}}}_0x440a00['where'](_0x2ef4d2);_0x440a00[_0x7569('0x80')](_0x7569('0x81'));var _0x439013={'type':db[_0x7569('0x82')][_0x7569('0x83')]['SELECT'],'raw':!![]};var _0x1c2f7a=_0x440a00['clone']();_0x1c2f7a['field']('i.id');_0x1c2f7a[_0x7569('0x43')](_0x7569('0x84'),_0x7569('0x59'));if(_0x1ea1a5[_0x7569('0x3f')]){_0x1ea1a5[_0x7569('0x3f')][_0x7569('0x2f')](function(_0x2ef8b2){_0x440a00[_0x7569('0x3f')]('i.'+_0x2ef8b2[0x0],_0x2ef8b2[0x1]===_0x7569('0x85')?![]:!![]);});}if(!_[_0x7569('0x86')](_0x1e6d93)){_0x440a00[_0x7569('0x5a')](_0x5ddec);_0x1c2f7a['where']('t.id\x20IN\x20?',_0x1e6d93);}BPromise['resolve']()[_0x7569('0x24')](function(){if(!_0x562dad){if(_0x4922d6[_0x7569('0x38')][_0x7569('0x6d')]||_0x4922d6[_0x7569('0x38')][_0x7569('0x87')])return;_0x1c2f7a['where'](_0x7569('0x88'));_0x440a00[_0x7569('0x41')](_0x7569('0x88'));return;}return _0x4922d6[_0x7569('0x89')][_0x7569('0x8a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x462656){if(_[_0x7569('0x86')](_0x462656)){_0x1c2f7a['where'](_0x7569('0x8b'));_0x440a00[_0x7569('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x1c2f7a[_0x7569('0x41')](_0x7569('0x8c'),_[_0x7569('0x2a')](_0x462656,'id'));_0x440a00[_0x7569('0x41')](_0x7569('0x8c'),_['map'](_0x462656,'id'));}});})[_0x7569('0x24')](function(){db[_0x7569('0x8d')]['query'](_0x1c2f7a[_0x7569('0x8e')](),_0x439013)['then'](function(_0x47b610){_0x4e4181[_0x7569('0x1e')]=_0x47b610[_0x7569('0x3d')];if(_0x4e4181['count']===0x0)return[];return db['sequelize'][_0x7569('0x38')](_0x4013e1[_0x7569('0x8e')](),_0x439013)[_0x7569('0x24')](function(_0x12e3af){_0x3655e0=_[_0x7569('0x8f')](_0x12e3af,'id');_0x439013=_[_0x7569('0x90')](_0x439013,{'model':db[_0x7569('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4922d6[_0x7569('0x38')][_0x7569('0x3c')]){_0x1ea1a5['attributes'][_0x7569('0x2f')](function(_0x4a3490){_0x440a00['field']('i.'+_0x4a3490);});}else{_0x440a00[_0x7569('0x43')](_0x7569('0x84'),_0x7569('0x59'));_0x440a00[_0x7569('0x43')](_0x7569('0x91'),_0x7569('0x92'));_0x440a00[_0x7569('0x43')](_0x7569('0x93'),_0x7569('0x94'));_0x440a00[_0x7569('0x43')](_0x7569('0x95'));_0x440a00['field'](_0x7569('0x96'),_0x7569('0x97'));_0x440a00[_0x7569('0x43')]('c.lastName',_0x7569('0x98'));_0x440a00[_0x7569('0x43')](_0x7569('0x99'),_0x7569('0x9a'));_0x440a00[_0x7569('0x43')]('c.phone',_0x7569('0x9b'));_0x440a00[_0x7569('0x43')](_0x7569('0x9c'),'Contact.mobile');_0x440a00[_0x7569('0x43')]('c.fax',_0x7569('0x9d'));_0x440a00['field'](_0x7569('0x9e'),_0x7569('0x9f'));_0x440a00[_0x7569('0x43')]('o.internal',_0x7569('0xa0'));_0x440a00['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1ea1a5['limit'])_0x440a00[_0x7569('0x20')](_0x1ea1a5['limit']);if(_0x1ea1a5['offset'])_0x440a00[_0x7569('0x1f')](_0x1ea1a5[_0x7569('0x1f')]);return db[_0x7569('0x8d')][_0x7569('0x38')](_0x440a00[_0x7569('0x8e')](),_0x439013);})[_0x7569('0x24')](function(_0x3e6c11){_0x15102d[_0x7569('0x41')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x7569('0x2a')](_0x3e6c11,'id'));return db[_0x7569('0x8d')][_0x7569('0x38')](_0x15102d[_0x7569('0x8e')](),_0x439013)[_0x7569('0x24')](function(_0x4165a3){var _0x418b6a=_['groupBy'](_0x4165a3,_0x7569('0xa1'));var _0x32f7d8=[];_0x3e6c11['forEach'](function(_0x2a7d8e){_0x32f7d8[_0x7569('0x30')](updateOpenchannelInteraction(_0x2a7d8e,_0x3655e0,_0x418b6a));});return BPromise[_0x7569('0xa2')](_0x32f7d8);});});})[_0x7569('0x24')](function(_0x38da78){_0x4e4181[_0x7569('0xa3')]=_0x38da78;return _0x4e4181;})[_0x7569('0x24')](respondWithFilteredResult(_0x4d1074,_0x1ea1a5));})[_0x7569('0x31')](handleError(_0x4d1074,null));};exports[_0x7569('0xa4')]=function(_0xab41a6,_0x44f4a0){var _0x327e70={'raw':![],'where':{'id':_0xab41a6[_0x7569('0xa5')]['id']}},_0x4d4bcb={};_0x4d4bcb[_0x7569('0x36')]=_['keys'](db[_0x7569('0x32')][_0x7569('0x33')]);_0x4d4bcb[_0x7569('0x38')]=_[_0x7569('0x37')](_0xab41a6[_0x7569('0x38')]);_0x4d4bcb[_0x7569('0x39')]=_[_0x7569('0x3a')](_0x4d4bcb[_0x7569('0x36')],_0x4d4bcb[_0x7569('0x38')]);_0x327e70[_0x7569('0x3b')]=_[_0x7569('0x3a')](_0x4d4bcb[_0x7569('0x36')],qs[_0x7569('0x3c')](_0xab41a6['query'][_0x7569('0x3c')]));_0x327e70[_0x7569('0x3b')]=_0x327e70['attributes'][_0x7569('0x3d')]?_0x327e70[_0x7569('0x3b')]:_0x4d4bcb[_0x7569('0x36')];if(_0xab41a6['query'][_0x7569('0xa6')]){_0x327e70[_0x7569('0xa7')]=[{'all':!![]}];}_0x327e70=_[_0x7569('0x90')]({},_0x327e70,_0xab41a6[_0x7569('0xa8')]);return db[_0x7569('0x32')][_0x7569('0x68')](_0x327e70)[_0x7569('0x24')](handleEntityNotFound(_0x44f4a0,null))[_0x7569('0x24')](respondWithResult(_0x44f4a0,null))[_0x7569('0x31')](handleError(_0x44f4a0,null));};exports[_0x7569('0xa9')]=function(_0x2673a7,_0x3d3f36){return db['OpenchannelInteraction'][_0x7569('0xa9')](_0x2673a7[_0x7569('0xaa')],{})[_0x7569('0x24')](respondWithResult(_0x3d3f36,0xc9))[_0x7569('0x31')](handleError(_0x3d3f36,null));};exports[_0x7569('0x23')]=function(_0x2f67a2,_0x4e5383){if(_0x2f67a2[_0x7569('0xaa')]['id']){delete _0x2f67a2['body']['id'];}return db[_0x7569('0x32')][_0x7569('0x68')]({'where':{'id':_0x2f67a2[_0x7569('0xa5')]['id']}})[_0x7569('0x24')](handleEntityNotFound(_0x4e5383,null))[_0x7569('0x24')](saveUpdates(_0x2f67a2[_0x7569('0xaa')],null))['then'](respondWithResult(_0x4e5383,null))['catch'](handleError(_0x4e5383,null));};exports[_0x7569('0xab')]=function(_0x22d6ab,_0x35027f){return db['OpenchannelInteraction'][_0x7569('0x68')]({'where':{'id':_0x22d6ab[_0x7569('0xa5')]['id']}})['then'](handleEntityNotFound(_0x35027f,null))['then'](removeEntity(_0x35027f,null))[_0x7569('0x31')](handleError(_0x35027f,null));};exports[_0x7569('0xac')]=function(_0x36ce26,_0x766cad){return db[_0x7569('0x32')][_0x7569('0xac')]()[_0x7569('0x24')](respondWithResult(_0x766cad,null))['catch'](handleError(_0x766cad,null));};exports[_0x7569('0xad')]=function(_0x11a7a0,_0x2b32ed,_0xd7839c){return db[_0x7569('0xae')][_0x7569('0x68')]({'where':{'id':_0x11a7a0[_0x7569('0xa5')]['id']}})[_0x7569('0x24')](handleEntityNotFound(_0x2b32ed,null))[_0x7569('0x24')](function(_0x30360e){if(_0x30360e){return _0x30360e[_0x7569('0xad')](_0x11a7a0['body'][_0x7569('0xaf')],_[_0x7569('0xb0')](_0x11a7a0[_0x7569('0xaa')],[_0x7569('0xaf'),'id'])||{});}})['then'](respondWithResult(_0x2b32ed,null))[_0x7569('0x31')](handleError(_0x2b32ed,null));};exports[_0x7569('0xb1')]=function(_0x1158ab,_0x160ee7,_0x236f60){var _0x391d2f={'raw':![],'where':{}};var _0x473ebd={};var _0x5aab7a={'count':0x0,'rows':[]};return db[_0x7569('0x32')][_0x7569('0xb2')]({'where':{'id':_0x1158ab[_0x7569('0xa5')]['id']}})[_0x7569('0x24')](handleEntityNotFound(_0x160ee7,null))[_0x7569('0x24')](function(_0x538fe8){if(_0x538fe8){_0x473ebd[_0x7569('0x36')]=_['keys'](db[_0x7569('0xae')][_0x7569('0x33')]);_0x473ebd['query']=_[_0x7569('0x37')](_0x1158ab[_0x7569('0x38')]);_0x473ebd[_0x7569('0x39')]=_[_0x7569('0x3a')](_0x473ebd[_0x7569('0x36')],_0x473ebd[_0x7569('0x38')]);_0x391d2f[_0x7569('0x3b')]=_[_0x7569('0x3a')](_0x473ebd[_0x7569('0x36')],qs[_0x7569('0x3c')](_0x1158ab['query'][_0x7569('0x3c')]));_0x391d2f[_0x7569('0x3b')]=_0x391d2f[_0x7569('0x3b')]['length']?_0x391d2f[_0x7569('0x3b')]:_0x473ebd[_0x7569('0x36')];if(!_0x1158ab['query'][_0x7569('0x3e')]('nolimit')){_0x391d2f[_0x7569('0x20')]=qs[_0x7569('0x20')](_0x1158ab[_0x7569('0x38')]['limit']);_0x391d2f[_0x7569('0x1f')]=qs[_0x7569('0x1f')](_0x1158ab[_0x7569('0x38')][_0x7569('0x1f')]);}_0x391d2f[_0x7569('0x3f')]=qs[_0x7569('0x40')](_0x1158ab['query'][_0x7569('0x40')]);_0x391d2f[_0x7569('0x41')]=qs[_0x7569('0x39')](_[_0x7569('0x42')](_0x1158ab[_0x7569('0x38')],_0x473ebd['filters']));_0x391d2f['where'][_0x7569('0xa1')]=_0x538fe8['id'];if(_0x1158ab['query'][_0x7569('0x78')]){_0x391d2f['where']=_[_0x7569('0x90')](_0x391d2f[_0x7569('0x41')],{'$or':_[_0x7569('0x2a')](_0x391d2f[_0x7569('0x3b')],function(_0x215faf){var _0x40b960={};_0x40b960[_0x215faf]={'$like':'%'+_0x1158ab[_0x7569('0x38')][_0x7569('0x78')]+'%'};return _0x40b960;})});}if(_0x1158ab['query'][_0x7569('0x70')]){var _0x2aef43=_0x1158ab['query'][_0x7569('0x70')]['split'](',');var _0x4f22e6={};_0x4f22e6[_0x2aef43[0x0]]={'$gte':moment(_0x2aef43[0x1])[_0x7569('0xb3')](_0x7569('0xb4'))};_0x391d2f[_0x7569('0x41')]=_[_0x7569('0x90')](_0x391d2f[_0x7569('0x41')],_0x4f22e6);}_0x391d2f=_[_0x7569('0x90')]({},_0x391d2f,_0x1158ab[_0x7569('0xa8')]);return db[_0x7569('0xae')][_0x7569('0x1e')]({'where':_0x391d2f[_0x7569('0x41')]})[_0x7569('0x24')](function(_0x29c111){_0x5aab7a[_0x7569('0x1e')]=_0x29c111;if(_0x1158ab[_0x7569('0x38')][_0x7569('0xa6')]){_0x391d2f[_0x7569('0xa7')]=[{'all':!![]}];}return db[_0x7569('0xae')]['findAll'](_0x391d2f);})['then'](function(_0x386a72){_0x5aab7a[_0x7569('0xa3')]=_0x386a72;return _0x5aab7a;});}})[_0x7569('0x24')](respondWithFilteredResult(_0x160ee7,_0x391d2f))[_0x7569('0x31')](handleError(_0x160ee7,null));};exports[_0x7569('0xb5')]=function(_0x1614e,_0x6ede32,_0x5a4166){return db['OpenchannelInteraction'][_0x7569('0x68')]({'where':{'id':_0x1614e[_0x7569('0xa5')]['id']}})['then'](handleEntityNotFound(_0x6ede32,null))['then'](function(_0x4efc70){if(_0x4efc70){return _0x4efc70[_0x7569('0xb6')](_0x1614e[_0x7569('0xaa')]['ids'],_[_0x7569('0xb0')](_0x1614e[_0x7569('0xaa')],[_0x7569('0xaf'),'id'])||{})[_0x7569('0xb7')](function(){return db['Tag'][_0x7569('0xb8')]({'attributes':['id',_0x7569('0x27'),'color'],'where':{'id':_0x1614e['body'][_0x7569('0xaf')]}});})['then'](function(_0x3146d8){socket[_0x7569('0xb9')](_0x7569('0xba'),{'id':Number(_0x1614e[_0x7569('0xa5')]['id']),'tags':_0x3146d8||[]});return{'id':Number(_0x1614e[_0x7569('0xa5')]['id']),'tags':_0x3146d8||[]};});}})[_0x7569('0x24')](respondWithResult(_0x6ede32,null))[_0x7569('0x31')](handleError(_0x6ede32,null));};exports[_0x7569('0xbb')]=function(_0x58fd15,_0x511182,_0x5ebc89){return db[_0x7569('0x32')]['find']({'where':{'id':_0x58fd15['params']['id']}})[_0x7569('0x24')](handleEntityNotFound(_0x511182,null))[_0x7569('0x24')](function(_0x488c26){if(_0x488c26){return _0x488c26[_0x7569('0xbb')](_0x58fd15[_0x7569('0x38')][_0x7569('0xaf')]);}})[_0x7569('0x24')](respondWithStatusCode(_0x511182,null))[_0x7569('0x31')](handleError(_0x511182,null));};exports[_0x7569('0xbc')]=function(_0x180e72,_0x229f7b){var _0x37de31=moment()[_0x7569('0xbd')]()['toString']();var _0x4ca76f=path[_0x7569('0xbe')](config[_0x7569('0xbf')],_0x7569('0xc0'),_0x7569('0xc1'),_0x7569('0xc2'));var _0x1ebfb7=path[_0x7569('0xbe')](config[_0x7569('0xbf')],_0x7569('0xc0'),_0x7569('0xc1'),_0x7569('0xc3'));var _0x3d0f26=path[_0x7569('0xbe')](_0x4ca76f,_0x37de31);var _0x11f408=util[_0x7569('0xb3')]('transcript-%d-%s.zip',_0x180e72[_0x7569('0xa5')]['id'],_0x37de31);var _0x865bc1=path[_0x7569('0xbe')](_0x4ca76f,_0x11f408);var _0x3212c9=[];_0x3212c9[_0x7569('0x30')]({'model':db[_0x7569('0x65')],'as':_0x7569('0x65'),'attributes':['id',_0x7569('0x2b')],'raw':!![]});_0x3212c9[_0x7569('0x30')]({'model':db[_0x7569('0xc4')],'as':_0x7569('0x5c'),'attributes':['id',_0x7569('0xc5'),_0x7569('0xc6')],'raw':!![]});if(_0x180e72['query'][_0x7569('0xc3')]){_0x3212c9[_0x7569('0x30')]({'model':db[_0x7569('0xc7')],'as':_0x7569('0xc7'),'raw':!![]});}var _0x4bb1c4=[{'model':db[_0x7569('0xae')],'as':_0x7569('0xc8'),'attributes':['id',_0x7569('0xaa'),'createdAt','direction',_0x7569('0xc9'),_0x7569('0x75')],'include':_0x3212c9}];_0x4bb1c4[_0x7569('0x30')]({'model':db['OpenchannelAccount'],'as':_0x7569('0xca'),'attributes':['id',_0x7569('0x27')]});_0x4bb1c4[_0x7569('0x30')]({'model':db[_0x7569('0x65')],'as':_0x7569('0xcb'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x7569('0x68')]({'where':{'id':_0x180e72[_0x7569('0xa5')]['id']},'include':_0x4bb1c4})[_0x7569('0x24')](handleEntityNotFound(_0x229f7b,null))[_0x7569('0x24')](function(_0x2579a3){if(_0x2579a3){var _0x34df92=_0x2579a3[_0x7569('0xcc')]({'plain':!![]});fs[_0x7569('0xcd')](_0x3d0f26);var _0x232b39={'format':'A4','border':_0x7569('0xce'),'header':{'height':_0x7569('0xcf'),'contents':{'first':_0x7569('0xd0')}},'footer':{'height':_0x7569('0xd1'),'contents':{'default':util[_0x7569('0xb3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x7569('0xd2'),_0x7569('0xd3'),_0x34df92['id']),moment()['format'](_0x7569('0xd4'))[_0x7569('0x8e')]())}}};var _0x21db38={'channel':_0x7569('0xd3'),'account':_0x34df92[_0x7569('0xca')][_0x7569('0x27')],'agent':_0x34df92[_0x7569('0xcb')]?_0x34df92[_0x7569('0xcb')]['fullname']:_0x7569('0xd5'),'createdAt':moment(_0x34df92[_0x7569('0x6e')])['format'](_0x7569('0xb4'))[_0x7569('0x8e')](),'closedAt':_0x34df92[_0x7569('0xd6')]?moment(_0x34df92[_0x7569('0xd7')])[_0x7569('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7569('0x8e')]():'','disposition':_0x34df92[_0x7569('0xd8')],'visibility':_0x34df92[_0x7569('0xd9')]?_0x7569('0xda'):_0x7569('0xdb'),'messages':_(_0x34df92[_0x7569('0xc8')])[_0x7569('0x78')]({'secret':![]})[_0x7569('0x2a')](function(_0x2f0450){if(_0x2f0450['Attachment']){var _0x207657=path[_0x7569('0xbe')](_0x1ebfb7,_0x2f0450[_0x7569('0xc7')][_0x7569('0xdc')]);if(fs[_0x7569('0xdd')](_0x207657)){fs[_0x7569('0xde')](_0x207657)[_0x7569('0xdf')](fs[_0x7569('0xe0')](path['join'](_0x3d0f26,_0x2f0450[_0x7569('0xc7')]['basename'])));}}return{'date':moment(_0x2f0450['createdAt'])['format'](_0x7569('0xb4'))[_0x7569('0x8e')](),'sender':_0x2f0450['direction']==='out'?_0x2f0450[_0x7569('0x65')]?_0x2f0450[_0x7569('0x65')][_0x7569('0x2b')]:_0x7569('0xe1'):_0x2f0450[_0x7569('0x5c')][_0x7569('0xc5')]+(_0x2f0450[_0x7569('0x5c')]['lastName']?'\x20'+_0x2f0450[_0x7569('0x5c')]['lastName']:''),'body':_0x2f0450[_0x7569('0xc7')]?_0x2f0450['Attachment'][_0x7569('0xdc')]:_0x2f0450[_0x7569('0xaa')],'direction':_0x2f0450[_0x7569('0xe2')]==='out'?'A':'C','secret':_0x2f0450[_0x7569('0xc9')],'read':_0x2f0450[_0x7569('0x75')],'attachment':_0x2f0450[_0x7569('0xc7')]};})[_0x7569('0x5e')]()};return ejs[_0x7569('0xe3')](path['join'](config[_0x7569('0xbf')],'server',_0x7569('0xe4'),_0x7569('0xe5')),{'interaction':_0x21db38})[_0x7569('0x24')](function(_0x1368fb){return new BPromise(function(_0x4db2de,_0x31d4be){pdf[_0x7569('0xa9')](_0x1368fb,_0x232b39)[_0x7569('0xe6')](path[_0x7569('0xbe')](_0x3d0f26,_0x7569('0xe7')+_0x34df92['id']+'-'+_0x37de31+_0x7569('0xe8')),function(_0x546529,_0x828b10){if(_0x546529)return _0x31d4be(_0x546529);_0x4db2de(_0x828b10);});});})['then'](function(){return new BPromise(function(_0x51aa44,_0x121239){zipdir(_0x3d0f26,{'saveTo':_0x865bc1},function(_0x4586c0,_0xf8f1e0){if(_0x4586c0)return _0x121239(_0x4586c0);return _0x51aa44(_0xf8f1e0);});})[_0x7569('0x24')](function(){return new BPromise(function(_0x2ab1c8,_0x55964c){rimraf(_0x3d0f26,function(_0xcd56ac){if(_0xcd56ac)_0x55964c(_0xcd56ac);return _0x2ab1c8();});});})['then'](function(){return _0x229f7b[_0x7569('0xbc')](_0x865bc1,_0x11f408,function(_0x4c4bfa){if(_0x4c4bfa){console[_0x7569('0xe9')](_0x7569('0xea'),_0x4c4bfa);}else{fs['unlinkSync'](_0x865bc1);}});});});}else{return _0x229f7b[_0x7569('0x1a')](0xc8);}})['catch'](handleError(_0x229f7b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 05c802b..0df2ccc 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 _0x03ac=['unreadMessages','length','emit','catch','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0x03ac,0x1c0));var _0xc03a=function(_0x1e2e8e,_0x43109a){_0x1e2e8e=_0x1e2e8e-0x0;var _0xff6b63=_0x03ac[_0x1e2e8e];return _0xff6b63;};'use strict';var EventEmitter=require(_0xc03a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xc03a('0x1')];var OpenchannelMessage=require(_0xc03a('0x2'))['db'][_0xc03a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc03a('0x4'),'afterUpdate':_0xc03a('0x5'),'afterDestroy':_0xc03a('0x6')};function emitEvent(_0x59fc9e){return function(_0x4327a1,_0x40a3cf,_0x472d53){_0x4327a1[_0xc03a('0x7')]({'attributes':['id'],'raw':!![]})[_0xc03a('0x8')](function(_0x25eda3){_0x4327a1[_0xc03a('0x9')](_0xc03a('0xa'),_0x25eda3['map'](function(_0x16546d){return{'id':_0x16546d['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4327a1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3e1b43){_0x4327a1[_0xc03a('0x9')](_0xc03a('0xb'),_0x3e1b43[_0xc03a('0xc')]);OpenchannelInteractionEvents[_0xc03a('0xd')](_0x59fc9e+':'+_0x4327a1['id'],_0x4327a1);OpenchannelInteractionEvents[_0xc03a('0xd')](_0x59fc9e,_0x4327a1);_0x472d53(null);})[_0xc03a('0xe')](_0x472d53(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xc03a('0xf')](e,emitEvent(event));}}module[_0xc03a('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd566=['hook','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','update','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x1d2938,_0x2ae8d4){var _0x2c5afd=function(_0x146f6e){while(--_0x146f6e){_0x1d2938['push'](_0x1d2938['shift']());}};_0x2c5afd(++_0x2ae8d4);}(_0xd566,0xc4));var _0x6d56=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd566[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x6d56('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x6d56('0x1')];var OpenchannelMessage=require(_0x6d56('0x2'))['db'][_0x6d56('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6d56('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d56('0x5'),'afterDestroy':'remove'};function emitEvent(_0x8821a2){return function(_0x247b35,_0x501ab4,_0xf39b41){_0x247b35['getUsers']({'attributes':['id'],'raw':!![]})[_0x6d56('0x6')](function(_0x9763db){_0x247b35[_0x6d56('0x7')]('Users',_0x9763db['map'](function(_0x1ad440){return{'id':_0x1ad440['id']};}));return OpenchannelMessage[_0x6d56('0x8')]({'where':{'OpenchannelInteractionId':_0x247b35['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6d56('0x6')](function(_0x111a65){_0x247b35[_0x6d56('0x7')](_0x6d56('0x9'),_0x111a65[_0x6d56('0xa')]);OpenchannelInteractionEvents[_0x6d56('0xb')](_0x8821a2+':'+_0x247b35['id'],_0x247b35);OpenchannelInteractionEvents['emit'](_0x8821a2,_0x247b35);_0xf39b41(null);})[_0x6d56('0xc')](_0xf39b41(null));};}for(var e in events){if(events[_0x6d56('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x6d56('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 27457f0..ecfe9aa 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 _0xdf13=['format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closedAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf13,0x1b4));var _0x3df1=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0xdf13[_0x507ac5];return _0x12c1bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3df1('0x0'))(_0x3df1('0x1'));var moment=require(_0x3df1('0x2'));var BPromise=require(_0x3df1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3df1('0x4'));var config=require('../../config/environment');var attributes=require(_0x3df1('0x5'));module[_0x3df1('0x6')]=function(_0x2dc1af,_0x26d273){return _0x2dc1af[_0x3df1('0x7')](_0x3df1('0x8'),attributes,{'tableName':_0x3df1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1875ff,_0x59ed97,_0x53b4ee){if(_0x1875ff[_0x3df1('0xa')]('closed')){_0x1875ff[_0x3df1('0xb')]=moment()[_0x3df1('0xc')](_0x3df1('0xd'));}_0x53b4ee(null,_0x1875ff);}}});}; \ No newline at end of file +var _0x0e8b=['changed','closedAt','format','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x4e0560,_0x2841c4){var _0x1b34df=function(_0x241842){while(--_0x241842){_0x4e0560['push'](_0x4e0560['shift']());}};_0x1b34df(++_0x2841c4);}(_0x0e8b,0x111));var _0xb0e8=function(_0x48352b,_0x53db91){_0x48352b=_0x48352b-0x0;var _0x2e95ff=_0x0e8b[_0x48352b];return _0x2e95ff;};'use strict';var _=require(_0xb0e8('0x0'));var util=require('util');var logger=require(_0xb0e8('0x1'))(_0xb0e8('0x2'));var moment=require(_0xb0e8('0x3'));var BPromise=require(_0xb0e8('0x4'));var rp=require(_0xb0e8('0x5'));var fs=require('fs');var path=require(_0xb0e8('0x6'));var rimraf=require('rimraf');var config=require(_0xb0e8('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xb0e8('0x8')]=function(_0x109340,_0x3e138f){return _0x109340[_0xb0e8('0x9')](_0xb0e8('0xa'),attributes,{'tableName':_0xb0e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa85040,_0x4dc029,_0x3866dc){if(_0xa85040[_0xb0e8('0xc')]('closed')){_0xa85040[_0xb0e8('0xd')]=moment()[_0xb0e8('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3866dc(null,_0xa85040);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 798c5ca..d3a782a 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 _0xa3ec=['OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','stringify','AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','./openchannelInteraction.socket','request','info'];(function(_0x5e59f2,_0x4d7f88){var _0x15de7b=function(_0x1babe1){while(--_0x1babe1){_0x5e59f2['push'](_0x5e59f2['shift']());}};_0x15de7b(++_0x4d7f88);}(_0xa3ec,0x193));var _0xca3e=function(_0x2ac882,_0x4d1788){_0x2ac882=_0x2ac882-0x0;var _0x5721ab=_0xa3ec[_0x2ac882];return _0x5721ab;};'use strict';var _=require(_0xca3e('0x0'));var util=require(_0xca3e('0x1'));var moment=require('moment');var BPromise=require(_0xca3e('0x2'));var rs=require(_0xca3e('0x3'));var fs=require('fs');var Redis=require(_0xca3e('0x4'));var db=require(_0xca3e('0x5'))['db'];var utils=require(_0xca3e('0x6'));var logger=require(_0xca3e('0x7'))('rpc');var config=require(_0xca3e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xca3e('0x9')]({'port':0x232a});config[_0xca3e('0xa')]=_[_0xca3e('0xb')](config[_0xca3e('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca3e('0xa')]));require(_0xca3e('0xc'))['register'](socket);function respondWithRpcPromise(_0x571ae3,_0x449c7b,_0x480dad){return new BPromise(function(_0x178b77,_0x2d6ca3){return client[_0xca3e('0xd')](_0x571ae3,_0x480dad)['then'](function(_0x121387){logger[_0xca3e('0xe')](_0xca3e('0xf'),_0x449c7b,'request\x20sent');logger[_0xca3e('0x10')](_0xca3e('0x11'),_0x449c7b,'request\x20sent',JSON['stringify'](_0x121387));if(_0x121387[_0xca3e('0x12')]){if(_0x121387[_0xca3e('0x12')][_0xca3e('0x13')]===0x1f4){logger[_0xca3e('0x12')](_0xca3e('0xf'),_0x449c7b,_0x121387['error'][_0xca3e('0x14')]);return _0x2d6ca3(_0x121387['error']['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x449c7b,_0x121387[_0xca3e('0x12')][_0xca3e('0x14')]);return _0x178b77(_0x121387[_0xca3e('0x12')][_0xca3e('0x14')]);}else{logger[_0xca3e('0xe')](_0xca3e('0xf'),_0x449c7b,'request\x20sent');_0x178b77(_0x121387[_0xca3e('0x15')][_0xca3e('0x14')]);}})[_0xca3e('0x16')](function(_0x56ade2){logger[_0xca3e('0x12')](_0xca3e('0xf'),_0x449c7b,_0x56ade2);_0x2d6ca3(_0x56ade2);});});}exports[_0xca3e('0x17')]=function(_0x2aee79){var _0x3dd0a8=this;return new Promise(function(_0x266a48,_0x1a45bb){return db[_0xca3e('0x18')][_0xca3e('0x19')](_0x2aee79[_0xca3e('0x1a')],{'raw':_0x2aee79[_0xca3e('0x1b')]?_0x2aee79[_0xca3e('0x1b')][_0xca3e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aee79[_0xca3e('0x1b')]?_0x2aee79[_0xca3e('0x1b')][_0xca3e('0x1d')]||null:null,'attributes':_0x2aee79[_0xca3e('0x1b')]?_0x2aee79['options']['attributes']||null:null,'limit':_0x2aee79['options']?_0x2aee79[_0xca3e('0x1b')][_0xca3e('0x1e')]||null:null})['then'](function(_0x3a4189){logger['info'](_0xca3e('0x17'),_0x2aee79);logger[_0xca3e('0x10')](_0xca3e('0x17'),_0x2aee79,JSON[_0xca3e('0x1f')](_0x3a4189));_0x266a48(_0x3a4189);})[_0xca3e('0x16')](function(_0x44eeec){logger[_0xca3e('0x12')](_0xca3e('0x17'),_0x44eeec[_0xca3e('0x14')],_0x2aee79);_0x1a45bb(_0x3dd0a8[_0xca3e('0x12')](0x1f4,_0x44eeec[_0xca3e('0x14')]));});});};exports[_0xca3e('0x20')]=function(_0x125b7b){return new Promise(function(_0x650952,_0xe6f9ea){return db[_0xca3e('0x18')]['find']({'where':_0x125b7b[_0xca3e('0x1b')]?_0x125b7b['options']['where']||null:null})['then'](function(_0x4af8f7){if(_0x4af8f7){return _0x4af8f7[_0xca3e('0x21')](_0x125b7b['body'][_0xca3e('0x22')],_[_0xca3e('0x23')](_0x125b7b['body'],[_0xca3e('0x22'),'id'])||{});}})[_0xca3e('0x24')](function(_0x39b9d5){logger['info']('AddTags',_0x125b7b);logger[_0xca3e('0x10')]('AddTags',_0x125b7b,JSON[_0xca3e('0x1f')](_0x39b9d5));_0x650952(_0x39b9d5);})[_0xca3e('0x16')](function(_0x144473){logger[_0xca3e('0x12')](_0xca3e('0x25'),_0x144473[_0xca3e('0x14')],_0x125b7b);_0xe6f9ea(_this[_0xca3e('0x12')](0x1f4,_0x144473['message']));});});}; \ No newline at end of file +var _0xa8e6=['client','redis','localhost','socket.io-emitter','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','attributes','limit','then','find','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0xa8e6,0x14c));var _0x6a8e=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0xa8e6[_0xfc0976];return _0x23579f;};'use strict';var _=require(_0x6a8e('0x0'));var util=require('util');var moment=require(_0x6a8e('0x1'));var BPromise=require('bluebird');var rs=require(_0x6a8e('0x2'));var fs=require('fs');var Redis=require(_0x6a8e('0x3'));var db=require(_0x6a8e('0x4'))['db'];var utils=require(_0x6a8e('0x5'));var logger=require(_0x6a8e('0x6'))(_0x6a8e('0x7'));var config=require(_0x6a8e('0x8'));var jayson=require(_0x6a8e('0x9'));var client=jayson[_0x6a8e('0xa')]['http']({'port':0x232a});config[_0x6a8e('0xb')]=_['defaults'](config[_0x6a8e('0xb')],{'host':_0x6a8e('0xc'),'port':0x18eb});var socket=require(_0x6a8e('0xd'))(new Redis(config[_0x6a8e('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x3ce72b,_0x500dee,_0x62be35){return new BPromise(function(_0xaafbc7,_0x158888){return client[_0x6a8e('0xe')](_0x3ce72b,_0x62be35)['then'](function(_0x5db6a3){logger[_0x6a8e('0xf')](_0x6a8e('0x10'),_0x500dee,_0x6a8e('0x11'));logger[_0x6a8e('0x12')](_0x6a8e('0x13'),_0x500dee,'request\x20sent',JSON[_0x6a8e('0x14')](_0x5db6a3));if(_0x5db6a3[_0x6a8e('0x15')]){if(_0x5db6a3['error'][_0x6a8e('0x16')]===0x1f4){logger[_0x6a8e('0x15')](_0x6a8e('0x10'),_0x500dee,_0x5db6a3['error'][_0x6a8e('0x17')]);return _0x158888(_0x5db6a3[_0x6a8e('0x15')][_0x6a8e('0x17')]);}logger[_0x6a8e('0x15')](_0x6a8e('0x10'),_0x500dee,_0x5db6a3['error'][_0x6a8e('0x17')]);return _0xaafbc7(_0x5db6a3[_0x6a8e('0x15')][_0x6a8e('0x17')]);}else{logger[_0x6a8e('0xf')](_0x6a8e('0x10'),_0x500dee,_0x6a8e('0x11'));_0xaafbc7(_0x5db6a3['result'][_0x6a8e('0x17')]);}})[_0x6a8e('0x18')](function(_0x11e3ee){logger[_0x6a8e('0x15')](_0x6a8e('0x10'),_0x500dee,_0x11e3ee);_0x158888(_0x11e3ee);});});}exports[_0x6a8e('0x19')]=function(_0x4bbc13){var _0x3774a8=this;return new Promise(function(_0x47db5f,_0x58b091){return db[_0x6a8e('0x1a')]['update'](_0x4bbc13[_0x6a8e('0x1b')],{'raw':_0x4bbc13[_0x6a8e('0x1c')]?_0x4bbc13[_0x6a8e('0x1c')][_0x6a8e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bbc13[_0x6a8e('0x1c')]?_0x4bbc13[_0x6a8e('0x1c')]['where']||null:null,'attributes':_0x4bbc13[_0x6a8e('0x1c')]?_0x4bbc13[_0x6a8e('0x1c')][_0x6a8e('0x1e')]||null:null,'limit':_0x4bbc13['options']?_0x4bbc13[_0x6a8e('0x1c')][_0x6a8e('0x1f')]||null:null})[_0x6a8e('0x20')](function(_0x3f0939){logger[_0x6a8e('0xf')](_0x6a8e('0x19'),_0x4bbc13);logger[_0x6a8e('0x12')]('UpdateOpenchannelInteraction',_0x4bbc13,JSON[_0x6a8e('0x14')](_0x3f0939));_0x47db5f(_0x3f0939);})[_0x6a8e('0x18')](function(_0x5a1d73){logger[_0x6a8e('0x15')](_0x6a8e('0x19'),_0x5a1d73['message'],_0x4bbc13);_0x58b091(_0x3774a8[_0x6a8e('0x15')](0x1f4,_0x5a1d73['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x204518){return new Promise(function(_0x1fb709,_0x1ac8ca){return db[_0x6a8e('0x1a')][_0x6a8e('0x21')]({'where':_0x204518[_0x6a8e('0x1c')]?_0x204518[_0x6a8e('0x1c')]['where']||null:null})[_0x6a8e('0x20')](function(_0x2aa995){if(_0x2aa995){return _0x2aa995['addTags'](_0x204518[_0x6a8e('0x1b')][_0x6a8e('0x22')],_[_0x6a8e('0x23')](_0x204518['body'],['ids','id'])||{});}})[_0x6a8e('0x24')](function(_0x15e21d){logger[_0x6a8e('0xf')](_0x6a8e('0x25'),_0x204518);logger[_0x6a8e('0x12')](_0x6a8e('0x25'),_0x204518,JSON[_0x6a8e('0x14')](_0x15e21d));_0x1fb709(_0x15e21d);})[_0x6a8e('0x18')](function(_0xde4a73){logger[_0x6a8e('0x15')](_0x6a8e('0x25'),_0xde4a73['message'],_0x204518);_0x1ac8ca(_this['error'](0x1f4,_0xde4a73['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 79f5aa9..d68c108 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 _0xe2cd=['register','openchannelInteraction:','save','emit'];(function(_0x3c6fae,_0x39f261){var _0x2ba9ab=function(_0x4e78ff){while(--_0x4e78ff){_0x3c6fae['push'](_0x3c6fae['shift']());}};_0x2ba9ab(++_0x39f261);}(_0xe2cd,0x76));var _0xde2c=function(_0x3353b6,_0x59c7b3){_0x3353b6=_0x3353b6-0x0;var _0x133fa1=_0xe2cd[_0x3353b6];return _0x133fa1;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xde2c('0x0'),'remove','update'];function createListener(_0x27ded7,_0x55f0b4){return function(_0x4771d7){_0x55f0b4[_0xde2c('0x1')](_0x27ded7,_0x4771d7);};}function removeListener(_0x2a9c4a,_0x37c98c){return function(){OpenchannelInteractionEvents['removeListener'](_0x2a9c4a,_0x37c98c);};}exports[_0xde2c('0x2')]=function(_0x140298){for(var _0x5c70d3=0x0,_0x3e5451=events['length'];_0x5c70d3<_0x3e5451;_0x5c70d3++){var _0x5d5dca=events[_0x5c70d3];var _0x2580ad=createListener(_0xde2c('0x3')+_0x5d5dca,_0x140298);OpenchannelInteractionEvents['on'](_0x5d5dca,_0x2580ad);}}; \ No newline at end of file +var _0xf747=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','register'];(function(_0x5473c9,_0xcb5b77){var _0x2630ea=function(_0x42d5aa){while(--_0x42d5aa){_0x5473c9['push'](_0x5473c9['shift']());}};_0x2630ea(++_0xcb5b77);}(_0xf747,0x12e));var _0x7f74=function(_0x2de0ad,_0x53005f){_0x2de0ad=_0x2de0ad-0x0;var _0x53e110=_0xf747[_0x2de0ad];return _0x53e110;};'use strict';var OpenchannelInteractionEvents=require(_0x7f74('0x0'));var events=[_0x7f74('0x1'),_0x7f74('0x2'),_0x7f74('0x3')];function createListener(_0x4e57cc,_0xb11843){return function(_0x4df3d3){_0xb11843[_0x7f74('0x4')](_0x4e57cc,_0x4df3d3);};}function removeListener(_0x2160b6,_0x4d7b3c){return function(){OpenchannelInteractionEvents['removeListener'](_0x2160b6,_0x4d7b3c);};}exports[_0x7f74('0x5')]=function(_0x137a0b){for(var _0x442009=0x0,_0x33ce95=events['length'];_0x442009<_0x33ce95;_0x442009++){var _0x2f8a9f=events[_0x442009];var _0x5dfa42=createListener(_0x7f74('0x6')+_0x2f8a9f,_0x137a0b);OpenchannelInteractionEvents['on'](_0x2f8a9f,_0x5dfa42);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 02e8a34..21e2771 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 _0xf726=['../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','get','describe','/:id','show','post','tracked','openchannel','create','/:id/accept','put','/:id/reject','reject','delete','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1b39bf,_0x2d9bb5){var _0x2548e7=function(_0x32d37b){while(--_0x32d37b){_0x1b39bf['push'](_0x1b39bf['shift']());}};_0x2548e7(++_0x2d9bb5);}(_0xf726,0xc1));var _0x6f72=function(_0x403eb7,_0x1fca8b){_0x403eb7=_0x403eb7-0x0;var _0x1b5bf4=_0xf726[_0x403eb7];return _0x1b5bf4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f72('0x0'));var timeout=require(_0x6f72('0x1'));var express=require(_0x6f72('0x2'));var router=express[_0x6f72('0x3')]();var auth=require(_0x6f72('0x4'));var interaction=require(_0x6f72('0x5'));var config=require('../../config/environment');var controller=require(_0x6f72('0x6'));router['get']('/',auth[_0x6f72('0x7')](),controller['index']);router[_0x6f72('0x8')]('/describe',auth[_0x6f72('0x7')](),controller[_0x6f72('0x9')]);router[_0x6f72('0x8')](_0x6f72('0xa'),auth[_0x6f72('0x7')](),controller[_0x6f72('0xb')]);router[_0x6f72('0xc')]('/',auth['isAuthenticated'](),interaction[_0x6f72('0xd')](_0x6f72('0xe'),'openchannelmessage:create'),controller[_0x6f72('0xf')]);router['put'](_0x6f72('0xa'),auth[_0x6f72('0x7')](),controller['update']);router['put'](_0x6f72('0x10'),auth['isAuthenticated'](),controller['accept']);router[_0x6f72('0x11')](_0x6f72('0x12'),auth[_0x6f72('0x7')](),controller[_0x6f72('0x13')]);router[_0x6f72('0x14')](_0x6f72('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f72('0x15')]=router; \ No newline at end of file +var _0x8812=['Router','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','show','tracked','openchannel','openchannelmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x7774bc,_0x50e512){var _0x1a40c8=function(_0x370263){while(--_0x370263){_0x7774bc['push'](_0x7774bc['shift']());}};_0x1a40c8(++_0x50e512);}(_0x8812,0x181));var _0x2881=function(_0x236880,_0x2aab32){_0x236880=_0x236880-0x0;var _0x1a275c=_0x8812[_0x236880];return _0x1a275c;};'use strict';var multer=require(_0x2881('0x0'));var util=require(_0x2881('0x1'));var path=require(_0x2881('0x2'));var timeout=require(_0x2881('0x3'));var express=require(_0x2881('0x4'));var router=express[_0x2881('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2881('0x6'));var config=require('../../config/environment');var controller=require(_0x2881('0x7'));router['get']('/',auth[_0x2881('0x8')](),controller[_0x2881('0x9')]);router[_0x2881('0xa')](_0x2881('0xb'),auth[_0x2881('0x8')](),controller[_0x2881('0xc')]);router[_0x2881('0xa')]('/:id',auth[_0x2881('0x8')](),controller[_0x2881('0xd')]);router['post']('/',auth[_0x2881('0x8')](),interaction[_0x2881('0xe')](_0x2881('0xf'),_0x2881('0x10')),controller[_0x2881('0x11')]);router[_0x2881('0x12')](_0x2881('0x13'),auth[_0x2881('0x8')](),controller['update']);router[_0x2881('0x12')](_0x2881('0x14'),auth[_0x2881('0x8')](),controller[_0x2881('0x15')]);router[_0x2881('0x12')](_0x2881('0x16'),auth['isAuthenticated'](),controller[_0x2881('0x17')]);router['delete'](_0x2881('0x13'),auth[_0x2881('0x8')](),controller[_0x2881('0x18')]);module[_0x2881('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c25ab26..e5faa74 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 _0x2f81=['DATE','sequelize','medium','BOOLEAN','ENUM'];(function(_0x3ab6cb,_0x591249){var _0x108ae5=function(_0x54be0c){while(--_0x54be0c){_0x3ab6cb['push'](_0x3ab6cb['shift']());}};_0x108ae5(++_0x591249);}(_0x2f81,0x146));var _0x12f8=function(_0x5aab0d,_0x5f328c){_0x5aab0d=_0x5aab0d-0x0;var _0x272b83=_0x2f81[_0x5aab0d];return _0x272b83;};'use strict';var Sequelize=require(_0x12f8('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x12f8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x12f8('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x12f8('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x12f8('0x4')]}}; \ No newline at end of file +var _0xf28c=['BOOLEAN','ENUM','out','sequelize','TEXT','medium'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0xf28c,0x183));var _0xcf28=function(_0x4e730d,_0x5dde25){_0x4e730d=_0x4e730d-0x0;var _0x3b6097=_0xf28c[_0x4e730d];return _0x3b6097;};'use strict';var Sequelize=require(_0xcf28('0x0'));module['exports']={'body':{'type':Sequelize[_0xcf28('0x1')](_0xcf28('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcf28('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf28('0x4')]('in',_0xcf28('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 7837957..9c92936 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 _0x4ae2=['EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','jayson/promise','http','client','test','Sequelize','ValidationError','request','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','update','then','destroy','stack','name','send','OpenchannelMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','include','rows','show','includeAll','find','body','params','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','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','event'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4ae2,0xff));var _0x24ae=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x4ae2[_0x28aea5];return _0x6a55f9;};'use strict';var pdf=require(_0x24ae('0x0'));var emlformat=require(_0x24ae('0x1'));var rimraf=require(_0x24ae('0x2'));var zipdir=require(_0x24ae('0x3'));var jsonpatch=require(_0x24ae('0x4'));var rp=require(_0x24ae('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x24ae('0x6'));var util=require(_0x24ae('0x7'));var path=require(_0x24ae('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x24ae('0x9'));var fs=require('fs');var _=require(_0x24ae('0xa'));var squel=require(_0x24ae('0xb'));var crypto=require(_0x24ae('0xc'));var jsforce=require(_0x24ae('0xd'));var deskjs=require(_0x24ae('0xe'));var toCsv=require(_0x24ae('0xf'));var querystring=require('querystring');var Papa=require(_0x24ae('0x10'));var Redis=require(_0x24ae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x24ae('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24ae('0x13'));var logger=require('../../config/logger')(_0x24ae('0x14'));var utils=require(_0x24ae('0x15'));var config=require(_0x24ae('0x16'));var db=require(_0x24ae('0x17'))['db'];config[_0x24ae('0x18')]=_[_0x24ae('0x19')](config[_0x24ae('0x18')],{'host':_0x24ae('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x24ae('0x1b'))['register'](socket);var jayson=require(_0x24ae('0x1c'));var client=jayson['client'][_0x24ae('0x1d')]({'port':0x232c});var client9002=jayson[_0x24ae('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x3462dc,_0x1ed6a2,_0x46e357){if(_0x46e357){var _0xe33bc9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe33bc9[_0x24ae('0x1f')](_0x1ed6a2)){return _0x3462dc;}else{throw new db[(_0x24ae('0x20'))][(_0x24ae('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 _0x3462dc;}}function respondWithRpcPromise(_0x384506,_0x1b9705,_0x28384e,_0x498b00){return new BPromise(function(_0x44fda3,_0x138603){var _0x2bf921=_0x498b00||client;return _0x2bf921[_0x24ae('0x22')](_0x384506,_0x28384e)['then'](function(_0x356f59){logger[_0x24ae('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b9705,'request\x20sent');logger[_0x24ae('0x24')](_0x24ae('0x25'),_0x1b9705,_0x24ae('0x26'),JSON[_0x24ae('0x27')](_0x356f59));if(_0x356f59['error']){if(_0x356f59[_0x24ae('0x28')][_0x24ae('0x29')]===0x1f4){logger[_0x24ae('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b9705,_0x356f59[_0x24ae('0x28')]['message']);return _0x138603(_0x356f59[_0x24ae('0x28')][_0x24ae('0x2a')]);}logger[_0x24ae('0x28')](_0x24ae('0x2b'),_0x1b9705,_0x356f59[_0x24ae('0x28')][_0x24ae('0x2a')]);return _0x44fda3(_0x356f59[_0x24ae('0x28')][_0x24ae('0x2a')]);}else{logger[_0x24ae('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b9705,_0x24ae('0x26'));_0x44fda3(_0x356f59[_0x24ae('0x2c')][_0x24ae('0x2a')]);}})[_0x24ae('0x2d')](function(_0x4c1002){logger[_0x24ae('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x1b9705,_0x4c1002);_0x138603(_0x4c1002);});});}function respondWithStatusCode(_0x273224,_0x3666a2){_0x3666a2=_0x3666a2||0xcc;return function(_0x1912c6){if(_0x1912c6){return _0x273224[_0x24ae('0x2e')](_0x3666a2);}return _0x273224[_0x24ae('0x2f')](_0x3666a2)[_0x24ae('0x30')]();};}function respondWithResult(_0x20fb21,_0xe11315){_0xe11315=_0xe11315||0xc8;return function(_0x55a429){if(_0x55a429){return _0x20fb21['status'](_0xe11315)['json'](_0x55a429);}};}function respondWithFilteredResult(_0x4ff81f,_0x24a09a){return function(_0x352e0e){if(_0x352e0e){var _0x34cf84=_0x352e0e[_0x24ae('0x31')],_0x150faa=_0x24a09a[_0x24ae('0x32')],_0x28b061=_0x24a09a[_0x24ae('0x32')]+_0x24a09a[_0x24ae('0x33')],_0x3f5961;if(_0x28b061>=_0x34cf84){_0x28b061=_0x34cf84;_0x3f5961=0xc8;}else{_0x3f5961=0xce;}_0x4ff81f['status'](_0x3f5961);return _0x4ff81f['set'](_0x24ae('0x34'),_0x150faa+'-'+_0x28b061+'/'+_0x34cf84)[_0x24ae('0x35')](_0x352e0e);}return null;};}function patchUpdates(_0x1e0a95){return function(_0x3e6cdb){try{jsonpatch['apply'](_0x3e6cdb,_0x1e0a95,!![]);}catch(_0x4e1cb9){return BPromise[_0x24ae('0x36')](_0x4e1cb9);}return _0x3e6cdb['save']();};}function saveUpdates(_0xc66706,_0x266df8){return function(_0xcff4e5){if(_0xcff4e5){return _0xcff4e5[_0x24ae('0x37')](_0xc66706)[_0x24ae('0x38')](function(_0x4185b0){return _0x4185b0;});}return null;};}function removeEntity(_0x4862a5,_0x23a5de){return function(_0x38694e){if(_0x38694e){return _0x38694e[_0x24ae('0x39')]()['then'](function(){_0x4862a5[_0x24ae('0x2f')](0xcc)[_0x24ae('0x30')]();});}};}function handleEntityNotFound(_0x17163d,_0x363be8){return function(_0x346960){if(!_0x346960){_0x17163d[_0x24ae('0x2e')](0x194);}return _0x346960;};}function handleError(_0x3051f9,_0x45caff){_0x45caff=_0x45caff||0x1f4;return function(_0x41b5f2){logger[_0x24ae('0x28')](_0x41b5f2[_0x24ae('0x3a')]);if(_0x41b5f2[_0x24ae('0x3b')]){delete _0x41b5f2[_0x24ae('0x3b')];}_0x3051f9['status'](_0x45caff)[_0x24ae('0x3c')](_0x41b5f2);};}exports['index']=function(_0x28feb7,_0x302662){var _0x361036={},_0x38cb26={},_0x2822b1={'count':0x0,'rows':[]};var _0x374ce1=_['map'](db[_0x24ae('0x3d')][_0x24ae('0x3e')],function(_0xf3141c){return{'name':_0xf3141c[_0x24ae('0x3f')],'type':_0xf3141c['type'][_0x24ae('0x40')]};});_0x38cb26[_0x24ae('0x41')]=_[_0x24ae('0x42')](_0x374ce1,'name');_0x38cb26[_0x24ae('0x43')]=_[_0x24ae('0x44')](_0x28feb7[_0x24ae('0x43')]);_0x38cb26[_0x24ae('0x45')]=_[_0x24ae('0x46')](_0x38cb26[_0x24ae('0x41')],_0x38cb26[_0x24ae('0x43')]);_0x361036[_0x24ae('0x47')]=_[_0x24ae('0x46')](_0x38cb26['model'],qs[_0x24ae('0x48')](_0x28feb7[_0x24ae('0x43')][_0x24ae('0x48')]));_0x361036[_0x24ae('0x47')]=_0x361036[_0x24ae('0x47')][_0x24ae('0x49')]?_0x361036[_0x24ae('0x47')]:_0x38cb26[_0x24ae('0x41')];if(!_0x28feb7[_0x24ae('0x43')]['hasOwnProperty'](_0x24ae('0x4a'))){_0x361036[_0x24ae('0x33')]=qs[_0x24ae('0x33')](_0x28feb7['query'][_0x24ae('0x33')]);_0x361036[_0x24ae('0x32')]=qs[_0x24ae('0x32')](_0x28feb7['query'][_0x24ae('0x32')]);}_0x361036[_0x24ae('0x4b')]=qs[_0x24ae('0x4c')](_0x28feb7[_0x24ae('0x43')][_0x24ae('0x4c')]);_0x361036[_0x24ae('0x4d')]=qs[_0x24ae('0x45')](_[_0x24ae('0x4e')](_0x28feb7[_0x24ae('0x43')],_0x38cb26[_0x24ae('0x45')]),_0x374ce1);if(_0x28feb7[_0x24ae('0x43')]['filter']){_0x361036[_0x24ae('0x4d')]=_[_0x24ae('0x4f')](_0x361036[_0x24ae('0x4d')],{'$or':_[_0x24ae('0x42')](_0x374ce1,function(_0x1dd1f3){if(_0x1dd1f3[_0x24ae('0x50')]!==_0x24ae('0x51')){var _0x29ccba={};_0x29ccba[_0x1dd1f3['name']]={'$like':'%'+_0x28feb7['query']['filter']+'%'};return _0x29ccba;}})});}_0x361036=_[_0x24ae('0x4f')]({},_0x361036,_0x28feb7[_0x24ae('0x52')]);var _0x237b70={'where':_0x361036[_0x24ae('0x4d')]};return db[_0x24ae('0x3d')][_0x24ae('0x31')](_0x237b70)[_0x24ae('0x38')](function(_0x584d9d){_0x2822b1[_0x24ae('0x31')]=_0x584d9d;if(_0x28feb7[_0x24ae('0x43')]['includeAll']){_0x361036[_0x24ae('0x53')]=[{'all':!![]}];}return db[_0x24ae('0x3d')]['findAll'](_0x361036);})[_0x24ae('0x38')](function(_0x432060){_0x2822b1[_0x24ae('0x54')]=_0x432060;return _0x2822b1;})[_0x24ae('0x38')](respondWithFilteredResult(_0x302662,_0x361036))[_0x24ae('0x2d')](handleError(_0x302662,null));};exports[_0x24ae('0x55')]=function(_0x5bb4c8,_0x17225b){var _0x128cb0={'raw':!![],'where':{'id':_0x5bb4c8['params']['id']}},_0xc80673={};_0xc80673['model']=_[_0x24ae('0x44')](db[_0x24ae('0x3d')]['rawAttributes']);_0xc80673['query']=_[_0x24ae('0x44')](_0x5bb4c8[_0x24ae('0x43')]);_0xc80673[_0x24ae('0x45')]=_['intersection'](_0xc80673[_0x24ae('0x41')],_0xc80673[_0x24ae('0x43')]);_0x128cb0[_0x24ae('0x47')]=_[_0x24ae('0x46')](_0xc80673[_0x24ae('0x41')],qs[_0x24ae('0x48')](_0x5bb4c8['query'][_0x24ae('0x48')]));_0x128cb0[_0x24ae('0x47')]=_0x128cb0[_0x24ae('0x47')]['length']?_0x128cb0[_0x24ae('0x47')]:_0xc80673['model'];if(_0x5bb4c8['query'][_0x24ae('0x56')]){_0x128cb0[_0x24ae('0x53')]=[{'all':!![]}];}_0x128cb0=_[_0x24ae('0x4f')]({},_0x128cb0,_0x5bb4c8['options']);return db[_0x24ae('0x3d')][_0x24ae('0x57')](_0x128cb0)[_0x24ae('0x38')](handleEntityNotFound(_0x17225b,null))[_0x24ae('0x38')](respondWithResult(_0x17225b,null))[_0x24ae('0x2d')](handleError(_0x17225b,null));};exports['create']=function(_0x5afd66,_0x12de37){return db['OpenchannelMessage']['create'](_0x5afd66['body'],{})[_0x24ae('0x38')](respondWithResult(_0x12de37,0xc9))[_0x24ae('0x2d')](handleError(_0x12de37,null));};exports[_0x24ae('0x37')]=function(_0x18226a,_0x44bfe0){if(_0x18226a['body']['id']){delete _0x18226a[_0x24ae('0x58')]['id'];}return db[_0x24ae('0x3d')]['find']({'where':{'id':_0x18226a[_0x24ae('0x59')]['id']}})['then'](handleEntityNotFound(_0x44bfe0,null))[_0x24ae('0x38')](saveUpdates(_0x18226a['body'],null))[_0x24ae('0x38')](respondWithResult(_0x44bfe0,null))[_0x24ae('0x2d')](handleError(_0x44bfe0,null));};exports[_0x24ae('0x39')]=function(_0x43e2ae,_0x1f763e){return db['OpenchannelMessage']['find']({'where':{'id':_0x43e2ae[_0x24ae('0x59')]['id']}})[_0x24ae('0x38')](handleEntityNotFound(_0x1f763e,null))[_0x24ae('0x38')](removeEntity(_0x1f763e,null))[_0x24ae('0x2d')](handleError(_0x1f763e,null));};exports['describe']=function(_0xfe1040,_0x4e4e97){return db[_0x24ae('0x3d')][_0x24ae('0x5a')]()[_0x24ae('0x38')](respondWithResult(_0x4e4e97,null))['catch'](handleError(_0x4e4e97,null));};var interaction_log=require(_0x24ae('0x5b'))(_0x24ae('0x5c'));exports[_0x24ae('0x5d')]=function(_0x114795,_0x12c091,_0xe54a4f){var _0x11294e={'channel':_0x24ae('0x5e')};if(_0x114795[_0x24ae('0x58')]['id']){delete _0x114795[_0x24ae('0x58')]['id'];}_0x114795['body'][_0x24ae('0x5f')]=!![];_0x114795[_0x24ae('0x58')][_0x24ae('0x60')]=moment()[_0x24ae('0x61')](_0x24ae('0x62'));_0x114795['body'][_0x24ae('0x63')]=_0x114795[_0x24ae('0x58')][_0x24ae('0x63')]||_0x114795[_0x24ae('0x64')]['id'];return db[_0x24ae('0x3d')][_0x24ae('0x57')]({'where':{'id':_0x114795[_0x24ae('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x24ae('0x65')}]})[_0x24ae('0x38')](handleEntityNotFound(_0x12c091,null))[_0x24ae('0x38')](saveUpdates(_0x114795['body'],null))[_0x24ae('0x38')](function(_0x2730a8){if(_0x2730a8){_0x11294e['message']=_0x2730a8[_0x24ae('0x66')]({'plain':!![]});return db[_0x24ae('0x67')][_0x24ae('0x57')]({'where':{'id':_0x2730a8[_0x24ae('0x68')]}});}return null;})[_0x24ae('0x38')](handleEntityNotFound(_0x12c091,null))[_0x24ae('0x38')](function(_0x31d0a){if(_0x31d0a){return _0x31d0a[_0x24ae('0x37')]({'UserId':_0x114795[_0x24ae('0x58')][_0x24ae('0x63')],'read1stAt':_[_0x24ae('0x69')](_0x31d0a[_0x24ae('0x6a')])?moment()[_0x24ae('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3027cd){if(_0x3027cd){_0x11294e[_0x24ae('0x6b')]=_0x3027cd[_0x24ae('0x66')]({'plain':!![]});interaction_log['info'](_0x24ae('0x6c'),_0x114795[_0x24ae('0x64')]['id'],_0x114795[_0x24ae('0x64')][_0x24ae('0x3b')],_0x114795[_0x24ae('0x64')][_0x24ae('0x6d')],_0x11294e[_0x24ae('0x6b')]['id'],_0x114795['body']?JSON[_0x24ae('0x27')](_0x114795[_0x24ae('0x58')]):_0x24ae('0x6e'));return respondWithRpcPromise(_0x24ae('0x6f'),_0x24ae('0x70'),_0x11294e);}return null;})[_0x24ae('0x38')](function(_0x17aca4){if(_0x17aca4){if(_0x114795[_0x24ae('0x58')][_0x24ae('0x71')]){_0x11294e[_0x24ae('0x2a')][_0x24ae('0x72')]=util[_0x24ae('0x61')](_0x24ae('0x73'),_0x114795[_0x24ae('0x64')][_0x24ae('0x3b')]);_0x11294e['message']['channel']=_0x11294e['channel'];_0x11294e[_0x24ae('0x2a')][_0x24ae('0x74')]=_0x24ae('0x5d');return respondWithRpcPromise(_0x24ae('0x75'),_0x24ae('0x75'),{'event':_0x24ae('0x76'),'message':_0x11294e[_0x24ae('0x2a')]},client9002)[_0x24ae('0x38')](function(){return _0x11294e;});}return _0x11294e;}return null;})[_0x24ae('0x38')](respondWithResult(_0x12c091,null))[_0x24ae('0x2d')](handleError(_0x12c091,null));};var interaction_log=require(_0x24ae('0x5b'))('openchannel-interactions');exports[_0x24ae('0x36')]=function(_0x53cdfb,_0x3c3bc7,_0x2d5c87){var _0xa33ec3={'agent':{},'channel':'openchannel'};if(_0x53cdfb[_0x24ae('0x58')]['id']){delete _0x53cdfb['body']['id'];}_0x53cdfb[_0x24ae('0x58')]['UserId']=_0x53cdfb[_0x24ae('0x58')][_0x24ae('0x63')]||_0x53cdfb[_0x24ae('0x64')]['id'];_0xa33ec3[_0x24ae('0x77')]['id']=_0x53cdfb[_0x24ae('0x58')][_0x24ae('0x63')];return db['OpenchannelMessage']['find']({'where':{'id':_0x53cdfb['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c3bc7,null))[_0x24ae('0x38')](function(_0x3e6605){if(_0x3e6605){_0xa33ec3['message']=_0x3e6605[_0x24ae('0x66')]({'plain':!![]});return db[_0x24ae('0x67')][_0x24ae('0x57')]({'where':{'id':_0x3e6605[_0x24ae('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x3c3bc7,null))['then'](function(_0x1c92a2){if(_0x1c92a2){_0xa33ec3[_0x24ae('0x6b')]=_0x1c92a2[_0x24ae('0x66')]({'plain':!![]});interaction_log['info'](_0x24ae('0x78'),_0x53cdfb[_0x24ae('0x64')]['id'],_0x53cdfb[_0x24ae('0x64')][_0x24ae('0x3b')],_0x53cdfb[_0x24ae('0x64')][_0x24ae('0x6d')],_0xa33ec3[_0x24ae('0x6b')]['id'],_0x53cdfb[_0x24ae('0x58')]?JSON[_0x24ae('0x27')](_0x53cdfb[_0x24ae('0x58')]):'null');return respondWithRpcPromise(_0x24ae('0x79'),_0x24ae('0x7a'),_0xa33ec3);}return null;})['then'](function(_0x4ce59e){if(_0x4ce59e){_0x4ce59e[_0x24ae('0x2a')][_0x24ae('0x72')]=util['format'](_0x24ae('0x73'),_0x53cdfb[_0x24ae('0x64')][_0x24ae('0x3b')]);_0x4ce59e[_0x24ae('0x2a')][_0x24ae('0x7b')]=_0xa33ec3[_0x24ae('0x7b')];_0x4ce59e[_0x24ae('0x2a')]['event']=_0x24ae('0x36');respondWithRpcPromise(_0x24ae('0x75'),'EventManager',{'event':'rejectmessage','message':_0x4ce59e[_0x24ae('0x2a')]},client9002);return _0xa33ec3;}return null;})[_0x24ae('0x38')](respondWithResult(_0x3c3bc7,null))['catch'](handleError(_0x3c3bc7,null));}; \ No newline at end of file +var _0x5163=['readAt','UserId','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','user','stringify','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','code','message','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','openchannel-interactions','accept','openchannel'];(function(_0x567f0e,_0x2be7a0){var _0x15aca8=function(_0x1e6ca6){while(--_0x1e6ca6){_0x567f0e['push'](_0x567f0e['shift']());}};_0x15aca8(++_0x2be7a0);}(_0x5163,0x96));var _0x3516=function(_0x7de0cb,_0x4dee18){_0x7de0cb=_0x7de0cb-0x0;var _0x271be6=_0x5163[_0x7de0cb];return _0x271be6;};'use strict';var pdf=require(_0x3516('0x0'));var emlformat=require(_0x3516('0x1'));var rimraf=require(_0x3516('0x2'));var zipdir=require(_0x3516('0x3'));var jsonpatch=require(_0x3516('0x4'));var rp=require(_0x3516('0x5'));var moment=require(_0x3516('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3516('0x7'));var util=require('util');var path=require(_0x3516('0x8'));var sox=require(_0x3516('0x9'));var csv=require(_0x3516('0xa'));var ejs=require(_0x3516('0xb'));var fs=require('fs');var _=require(_0x3516('0xc'));var squel=require(_0x3516('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3516('0xe'));var toCsv=require(_0x3516('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3516('0xf'));var authService=require(_0x3516('0x10'));var qs=require(_0x3516('0x11'));var as=require(_0x3516('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3516('0x13'))('api');var utils=require(_0x3516('0x14'));var config=require(_0x3516('0x15'));var db=require(_0x3516('0x16'))['db'];config['redis']=_[_0x3516('0x17')](config[_0x3516('0x18')],{'host':_0x3516('0x19'),'port':0x18eb});var socket=require(_0x3516('0x1a'))(new Redis(config[_0x3516('0x18')]));require('./openchannelMessage.socket')[_0x3516('0x1b')](socket);var jayson=require(_0x3516('0x1c'));var client=jayson[_0x3516('0x1d')][_0x3516('0x1e')]({'port':0x232c});var client9002=jayson[_0x3516('0x1d')][_0x3516('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x439e31,_0x4f4f5f,_0x411ecd){if(_0x411ecd){var _0x4b6a5f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b6a5f[_0x3516('0x1f')](_0x4f4f5f)){return _0x439e31;}else{throw new db['Sequelize'][(_0x3516('0x20'))](_0x3516('0x21'));}}else{return _0x439e31;}}function respondWithRpcPromise(_0x31b62b,_0x2329a8,_0x5782b3,_0x229df2){return new BPromise(function(_0x4ec30d,_0x26e0a7){var _0x656f01=_0x229df2||client;return _0x656f01[_0x3516('0x22')](_0x31b62b,_0x5782b3)[_0x3516('0x23')](function(_0xfda7ad){logger[_0x3516('0x24')](_0x3516('0x25'),_0x2329a8,_0x3516('0x26'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2329a8,_0x3516('0x26'),JSON['stringify'](_0xfda7ad));if(_0xfda7ad[_0x3516('0x27')]){if(_0xfda7ad['error'][_0x3516('0x28')]===0x1f4){logger['error'](_0x3516('0x25'),_0x2329a8,_0xfda7ad[_0x3516('0x27')][_0x3516('0x29')]);return _0x26e0a7(_0xfda7ad['error']['message']);}logger[_0x3516('0x27')](_0x3516('0x25'),_0x2329a8,_0xfda7ad[_0x3516('0x27')][_0x3516('0x29')]);return _0x4ec30d(_0xfda7ad['error'][_0x3516('0x29')]);}else{logger[_0x3516('0x24')](_0x3516('0x25'),_0x2329a8,'request\x20sent');_0x4ec30d(_0xfda7ad['result'][_0x3516('0x29')]);}})[_0x3516('0x2a')](function(_0x2a4e52){logger[_0x3516('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x2329a8,_0x2a4e52);_0x26e0a7(_0x2a4e52);});});}function respondWithStatusCode(_0x2babcb,_0x73eb7a){_0x73eb7a=_0x73eb7a||0xcc;return function(_0x5843af){if(_0x5843af){return _0x2babcb['sendStatus'](_0x73eb7a);}return _0x2babcb[_0x3516('0x2b')](_0x73eb7a)[_0x3516('0x2c')]();};}function respondWithResult(_0x2fa495,_0x1feca5){_0x1feca5=_0x1feca5||0xc8;return function(_0x3436b5){if(_0x3436b5){return _0x2fa495['status'](_0x1feca5)[_0x3516('0x2d')](_0x3436b5);}};}function respondWithFilteredResult(_0x2d2cf6,_0x5e1b42){return function(_0x52bcd9){if(_0x52bcd9){var _0x58c681=_0x52bcd9[_0x3516('0x2e')],_0x268467=_0x5e1b42[_0x3516('0x2f')],_0x52d96a=_0x5e1b42[_0x3516('0x2f')]+_0x5e1b42['limit'],_0x13f2a0;if(_0x52d96a>=_0x58c681){_0x52d96a=_0x58c681;_0x13f2a0=0xc8;}else{_0x13f2a0=0xce;}_0x2d2cf6[_0x3516('0x2b')](_0x13f2a0);return _0x2d2cf6[_0x3516('0x30')](_0x3516('0x31'),_0x268467+'-'+_0x52d96a+'/'+_0x58c681)[_0x3516('0x2d')](_0x52bcd9);}return null;};}function patchUpdates(_0x25c60d){return function(_0x40d0aa){try{jsonpatch[_0x3516('0x32')](_0x40d0aa,_0x25c60d,!![]);}catch(_0x59e9a0){return BPromise[_0x3516('0x33')](_0x59e9a0);}return _0x40d0aa[_0x3516('0x34')]();};}function saveUpdates(_0x54d21e,_0x3ea27e){return function(_0x217d4a){if(_0x217d4a){return _0x217d4a['update'](_0x54d21e)[_0x3516('0x23')](function(_0x56984f){return _0x56984f;});}return null;};}function removeEntity(_0x595e99,_0x2c49ed){return function(_0x5a3667){if(_0x5a3667){return _0x5a3667[_0x3516('0x35')]()[_0x3516('0x23')](function(){_0x595e99[_0x3516('0x2b')](0xcc)[_0x3516('0x2c')]();});}};}function handleEntityNotFound(_0x452ef1,_0x2482db){return function(_0x48b2aa){if(!_0x48b2aa){_0x452ef1[_0x3516('0x36')](0x194);}return _0x48b2aa;};}function handleError(_0x1abbba,_0x10f24c){_0x10f24c=_0x10f24c||0x1f4;return function(_0x45f88d){logger[_0x3516('0x27')](_0x45f88d[_0x3516('0x37')]);if(_0x45f88d['name']){delete _0x45f88d[_0x3516('0x38')];}_0x1abbba[_0x3516('0x2b')](_0x10f24c)[_0x3516('0x39')](_0x45f88d);};}exports[_0x3516('0x3a')]=function(_0x39e454,_0x2f796b){var _0x529bcc={},_0x4f486b={},_0x341f81={'count':0x0,'rows':[]};var _0x2a14e6=_[_0x3516('0x3b')](db['OpenchannelMessage'][_0x3516('0x3c')],function(_0x41a240){return{'name':_0x41a240['fieldName'],'type':_0x41a240[_0x3516('0x3d')][_0x3516('0x3e')]};});_0x4f486b['model']=_['map'](_0x2a14e6,_0x3516('0x38'));_0x4f486b['query']=_[_0x3516('0x3f')](_0x39e454[_0x3516('0x40')]);_0x4f486b[_0x3516('0x41')]=_[_0x3516('0x42')](_0x4f486b['model'],_0x4f486b['query']);_0x529bcc[_0x3516('0x43')]=_[_0x3516('0x42')](_0x4f486b[_0x3516('0x44')],qs[_0x3516('0x45')](_0x39e454[_0x3516('0x40')][_0x3516('0x45')]));_0x529bcc['attributes']=_0x529bcc[_0x3516('0x43')][_0x3516('0x46')]?_0x529bcc[_0x3516('0x43')]:_0x4f486b[_0x3516('0x44')];if(!_0x39e454[_0x3516('0x40')][_0x3516('0x47')](_0x3516('0x48'))){_0x529bcc[_0x3516('0x49')]=qs[_0x3516('0x49')](_0x39e454[_0x3516('0x40')][_0x3516('0x49')]);_0x529bcc[_0x3516('0x2f')]=qs[_0x3516('0x2f')](_0x39e454[_0x3516('0x40')]['offset']);}_0x529bcc['order']=qs['sort'](_0x39e454[_0x3516('0x40')][_0x3516('0x4a')]);_0x529bcc[_0x3516('0x4b')]=qs['filters'](_[_0x3516('0x4c')](_0x39e454[_0x3516('0x40')],_0x4f486b[_0x3516('0x41')]),_0x2a14e6);if(_0x39e454[_0x3516('0x40')][_0x3516('0x4d')]){_0x529bcc[_0x3516('0x4b')]=_[_0x3516('0x4e')](_0x529bcc[_0x3516('0x4b')],{'$or':_['map'](_0x2a14e6,function(_0x391b3a){if(_0x391b3a[_0x3516('0x3d')]!==_0x3516('0x4f')){var _0x3d5a64={};_0x3d5a64[_0x391b3a[_0x3516('0x38')]]={'$like':'%'+_0x39e454['query'][_0x3516('0x4d')]+'%'};return _0x3d5a64;}})});}_0x529bcc=_[_0x3516('0x4e')]({},_0x529bcc,_0x39e454[_0x3516('0x50')]);var _0x4ce815={'where':_0x529bcc[_0x3516('0x4b')]};return db[_0x3516('0x51')][_0x3516('0x2e')](_0x4ce815)[_0x3516('0x23')](function(_0x410733){_0x341f81[_0x3516('0x2e')]=_0x410733;if(_0x39e454[_0x3516('0x40')][_0x3516('0x52')]){_0x529bcc[_0x3516('0x53')]=[{'all':!![]}];}return db[_0x3516('0x51')][_0x3516('0x54')](_0x529bcc);})[_0x3516('0x23')](function(_0x1765d1){_0x341f81[_0x3516('0x55')]=_0x1765d1;return _0x341f81;})[_0x3516('0x23')](respondWithFilteredResult(_0x2f796b,_0x529bcc))[_0x3516('0x2a')](handleError(_0x2f796b,null));};exports[_0x3516('0x56')]=function(_0x20a209,_0x5a78ad){var _0x26d566={'raw':!![],'where':{'id':_0x20a209[_0x3516('0x57')]['id']}},_0x53dd12={};_0x53dd12[_0x3516('0x44')]=_[_0x3516('0x3f')](db[_0x3516('0x51')][_0x3516('0x3c')]);_0x53dd12[_0x3516('0x40')]=_[_0x3516('0x3f')](_0x20a209[_0x3516('0x40')]);_0x53dd12[_0x3516('0x41')]=_[_0x3516('0x42')](_0x53dd12[_0x3516('0x44')],_0x53dd12['query']);_0x26d566['attributes']=_[_0x3516('0x42')](_0x53dd12['model'],qs[_0x3516('0x45')](_0x20a209[_0x3516('0x40')][_0x3516('0x45')]));_0x26d566[_0x3516('0x43')]=_0x26d566[_0x3516('0x43')][_0x3516('0x46')]?_0x26d566[_0x3516('0x43')]:_0x53dd12['model'];if(_0x20a209[_0x3516('0x40')][_0x3516('0x52')]){_0x26d566[_0x3516('0x53')]=[{'all':!![]}];}_0x26d566=_[_0x3516('0x4e')]({},_0x26d566,_0x20a209[_0x3516('0x50')]);return db[_0x3516('0x51')][_0x3516('0x58')](_0x26d566)[_0x3516('0x23')](handleEntityNotFound(_0x5a78ad,null))[_0x3516('0x23')](respondWithResult(_0x5a78ad,null))[_0x3516('0x2a')](handleError(_0x5a78ad,null));};exports[_0x3516('0x59')]=function(_0x287a07,_0x15a6e5){return db[_0x3516('0x51')][_0x3516('0x59')](_0x287a07[_0x3516('0x5a')],{})[_0x3516('0x23')](respondWithResult(_0x15a6e5,0xc9))[_0x3516('0x2a')](handleError(_0x15a6e5,null));};exports[_0x3516('0x5b')]=function(_0x237c94,_0x53be30){if(_0x237c94['body']['id']){delete _0x237c94[_0x3516('0x5a')]['id'];}return db[_0x3516('0x51')]['find']({'where':{'id':_0x237c94[_0x3516('0x57')]['id']}})['then'](handleEntityNotFound(_0x53be30,null))[_0x3516('0x23')](saveUpdates(_0x237c94[_0x3516('0x5a')],null))['then'](respondWithResult(_0x53be30,null))[_0x3516('0x2a')](handleError(_0x53be30,null));};exports[_0x3516('0x35')]=function(_0x44fdc8,_0x1f6fbf){return db['OpenchannelMessage']['find']({'where':{'id':_0x44fdc8[_0x3516('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f6fbf,null))['then'](removeEntity(_0x1f6fbf,null))[_0x3516('0x2a')](handleError(_0x1f6fbf,null));};exports[_0x3516('0x5c')]=function(_0x7e7ac5,_0x33d3ca){return db[_0x3516('0x51')][_0x3516('0x5c')]()[_0x3516('0x23')](respondWithResult(_0x33d3ca,null))['catch'](handleError(_0x33d3ca,null));};var interaction_log=require('../../config/logger')(_0x3516('0x5d'));exports[_0x3516('0x5e')]=function(_0x188803,_0x3d8c20,_0x3b610e){var _0x1f5449={'channel':_0x3516('0x5f')};if(_0x188803[_0x3516('0x5a')]['id']){delete _0x188803['body']['id'];}_0x188803['body']['read']=!![];_0x188803[_0x3516('0x5a')][_0x3516('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x188803[_0x3516('0x5a')][_0x3516('0x61')]=_0x188803[_0x3516('0x5a')][_0x3516('0x61')]||_0x188803['user']['id'];return db[_0x3516('0x51')][_0x3516('0x58')]({'where':{'id':_0x188803[_0x3516('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x3516('0x62')],'as':'Contact'}]})[_0x3516('0x23')](handleEntityNotFound(_0x3d8c20,null))[_0x3516('0x23')](saveUpdates(_0x188803[_0x3516('0x5a')],null))[_0x3516('0x23')](function(_0x1a0456){if(_0x1a0456){_0x1f5449[_0x3516('0x29')]=_0x1a0456[_0x3516('0x63')]({'plain':!![]});return db[_0x3516('0x64')][_0x3516('0x58')]({'where':{'id':_0x1a0456[_0x3516('0x65')]}});}return null;})[_0x3516('0x23')](handleEntityNotFound(_0x3d8c20,null))[_0x3516('0x23')](function(_0x16a4f4){if(_0x16a4f4){return _0x16a4f4[_0x3516('0x5b')]({'UserId':_0x188803['body']['UserId'],'read1stAt':_[_0x3516('0x66')](_0x16a4f4[_0x3516('0x67')])?moment()[_0x3516('0x68')](_0x3516('0x69')):undefined});}return null;})[_0x3516('0x23')](function(_0x7c217e){if(_0x7c217e){_0x1f5449[_0x3516('0x6a')]=_0x7c217e['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x188803[_0x3516('0x6b')]['id'],_0x188803[_0x3516('0x6b')]['name'],_0x188803['user']['role'],_0x1f5449[_0x3516('0x6a')]['id'],_0x188803[_0x3516('0x5a')]?JSON[_0x3516('0x6c')](_0x188803[_0x3516('0x5a')]):_0x3516('0x6d'));return respondWithRpcPromise(_0x3516('0x6e'),_0x3516('0x6f'),_0x1f5449);}return null;})[_0x3516('0x23')](function(_0x9eb212){if(_0x9eb212){if(_0x188803['body'][_0x3516('0x70')]){_0x1f5449[_0x3516('0x29')][_0x3516('0x71')]=util['format']('SIP/%s',_0x188803['user'][_0x3516('0x38')]);_0x1f5449[_0x3516('0x29')][_0x3516('0x72')]=_0x1f5449[_0x3516('0x72')];_0x1f5449[_0x3516('0x29')][_0x3516('0x73')]=_0x3516('0x5e');return respondWithRpcPromise(_0x3516('0x74'),_0x3516('0x74'),{'event':_0x3516('0x75'),'message':_0x1f5449[_0x3516('0x29')]},client9002)[_0x3516('0x23')](function(){return _0x1f5449;});}return _0x1f5449;}return null;})[_0x3516('0x23')](respondWithResult(_0x3d8c20,null))[_0x3516('0x2a')](handleError(_0x3d8c20,null));};var interaction_log=require(_0x3516('0x13'))(_0x3516('0x5d'));exports[_0x3516('0x33')]=function(_0x1363a8,_0x255dfb,_0x33750a){var _0x5c0883={'agent':{},'channel':_0x3516('0x5f')};if(_0x1363a8['body']['id']){delete _0x1363a8[_0x3516('0x5a')]['id'];}_0x1363a8[_0x3516('0x5a')][_0x3516('0x61')]=_0x1363a8['body']['UserId']||_0x1363a8[_0x3516('0x6b')]['id'];_0x5c0883['agent']['id']=_0x1363a8[_0x3516('0x5a')][_0x3516('0x61')];return db[_0x3516('0x51')]['find']({'where':{'id':_0x1363a8[_0x3516('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x255dfb,null))[_0x3516('0x23')](function(_0x123df7){if(_0x123df7){_0x5c0883['message']=_0x123df7[_0x3516('0x63')]({'plain':!![]});return db[_0x3516('0x64')][_0x3516('0x58')]({'where':{'id':_0x123df7[_0x3516('0x65')]}});}return null;})[_0x3516('0x23')](handleEntityNotFound(_0x255dfb,null))[_0x3516('0x23')](function(_0x48fc31){if(_0x48fc31){_0x5c0883['interaction']=_0x48fc31['get']({'plain':!![]});interaction_log[_0x3516('0x24')](_0x3516('0x76'),_0x1363a8[_0x3516('0x6b')]['id'],_0x1363a8['user']['name'],_0x1363a8['user'][_0x3516('0x77')],_0x5c0883['interaction']['id'],_0x1363a8['body']?JSON[_0x3516('0x6c')](_0x1363a8[_0x3516('0x5a')]):_0x3516('0x6d'));return respondWithRpcPromise('RejectMessage',_0x3516('0x78'),_0x5c0883);}return null;})[_0x3516('0x23')](function(_0x46de35){if(_0x46de35){_0x46de35[_0x3516('0x29')][_0x3516('0x71')]=util[_0x3516('0x68')](_0x3516('0x79'),_0x1363a8[_0x3516('0x6b')][_0x3516('0x38')]);_0x46de35[_0x3516('0x29')][_0x3516('0x72')]=_0x5c0883[_0x3516('0x72')];_0x46de35[_0x3516('0x29')][_0x3516('0x73')]='reject';respondWithRpcPromise('EventManager',_0x3516('0x74'),{'event':_0x3516('0x7a'),'message':_0x46de35[_0x3516('0x29')]},client9002);return _0x5c0883;}return null;})[_0x3516('0x23')](respondWithResult(_0x255dfb,null))[_0x3516('0x2a')](handleError(_0x255dfb,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 11225c1..cf56e2a 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 _0xfc76=['hasOwnProperty','exports','events','OpenchannelMessage','setMaxListeners','save','remove','emit'];(function(_0x313883,_0x291b07){var _0x6544e6=function(_0x19bb38){while(--_0x19bb38){_0x313883['push'](_0x313883['shift']());}};_0x6544e6(++_0x291b07);}(_0xfc76,0x112));var _0x6fc7=function(_0x3cc977,_0x22a445){_0x3cc977=_0x3cc977-0x0;var _0x21a17f=_0xfc76[_0x3cc977];return _0x21a17f;};'use strict';var EventEmitter=require(_0x6fc7('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x6fc7('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6fc7('0x2')](0x0);var events={'afterCreate':_0x6fc7('0x3'),'afterUpdate':'update','afterDestroy':_0x6fc7('0x4')};function emitEvent(_0x195590){return function(_0x34fdda,_0xe9a03d,_0x371d85){OpenchannelMessageEvents[_0x6fc7('0x5')](_0x195590+':'+_0x34fdda['id'],_0x34fdda);OpenchannelMessageEvents[_0x6fc7('0x5')](_0x195590,_0x34fdda);_0x371d85(null);};}for(var e in events){if(events[_0x6fc7('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x6fc7('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x4d33=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4fc702,_0x590060){var _0x1357d3=function(_0x45a119){while(--_0x45a119){_0x4fc702['push'](_0x4fc702['shift']());}};_0x1357d3(++_0x590060);}(_0x4d33,0x1b0));var _0x34d3=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x4d33[_0x4792c8];return _0x35edb1;};'use strict';var EventEmitter=require(_0x34d3('0x0'));var OpenchannelMessage=require(_0x34d3('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x34d3('0x2'),'afterUpdate':_0x34d3('0x3'),'afterDestroy':_0x34d3('0x4')};function emitEvent(_0x4666ae){return function(_0x1abdbf,_0x41b864,_0x54cdae){OpenchannelMessageEvents[_0x34d3('0x5')](_0x4666ae+':'+_0x1abdbf['id'],_0x1abdbf);OpenchannelMessageEvents[_0x34d3('0x5')](_0x4666ae,_0x1abdbf);_0x54cdae(null);};}for(var e in events){if(events[_0x34d3('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x34d3('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 73412cd..19f76b3 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 _0x5089=['inspect','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','error','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch'];(function(_0x2cb3cd,_0x290f72){var _0x1b63cf=function(_0x39467a){while(--_0x39467a){_0x2cb3cd['push'](_0x2cb3cd['shift']());}};_0x1b63cf(++_0x290f72);}(_0x5089,0x1bb));var _0x9508=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x5089[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var logger=require('../../config/logger')(_0x9508('0x2'));var moment=require(_0x9508('0x3'));var BPromise=require(_0x9508('0x4'));var rp=require(_0x9508('0x5'));var fs=require('fs');var path=require(_0x9508('0x6'));var rimraf=require('rimraf');var config=require(_0x9508('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x9508('0x8')]=function(_0x4538dd,_0x257318){return _0x4538dd['define'](_0x9508('0x9'),attributes,{'tableName':_0x9508('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x9508('0xb')],'type':_0x9508('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f6720,_0x342ddd,_0x5c9dc9){var _0x424e6a=_0x4538dd[_0x9508('0xd')];var _0x852feb=_0x4f6720[_0x9508('0xe')]({'plain':!![]});if(_0x852feb[_0x9508('0xf')][_0x9508('0x10')]()==='in'||_0x852feb['direction'][_0x9508('0x10')]()==='out'&&!_0x852feb[_0x9508('0x11')]&&!_[_0x9508('0x12')](_0x852feb['UserId'])){_0x424e6a[_0x9508('0x13')][_0x9508('0x14')]({'where':{'id':_0x852feb[_0x9508('0x15')]}})[_0x9508('0x16')](function(_0x51ef92){if(_0x51ef92){_0x51ef92[_0x9508('0x17')]({'lastMsgAt':_0x852feb[_0x9508('0x18')],'lastMsgDirection':_0x852feb['direction'][_0x9508('0x10')]()});}})['catch'](function(_0x25d4d6){console[_0x9508('0x19')](_0x25d4d6);});}if(_0x852feb[_0x9508('0xf')]===_0x9508('0x1a')&&!_0x852feb[_0x9508('0x11')]){var _0x343802;_0x424e6a[_0x9508('0x1b')][_0x9508('0x1c')]()['then'](function(_0x22ba9c){return _0x424e6a[_0x9508('0x1d')][_0x9508('0x1e')]({'where':{'id':_0x852feb[_0x9508('0x1f')]},'include':[{'model':_0x424e6a[_0x9508('0x13')],'as':_0x9508('0x20'),'where':{'id':_0x852feb['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x424e6a['CmContact'],'as':_0x9508('0x21'),'attributes':_['keys'](_0x22ba9c)}]}]});})[_0x9508('0x16')](function(_0x4e9e9f){_0x343802=_0x4e9e9f[_0x9508('0xe')]({'plain':!![]});if(_0x343802&&_0x343802[_0x9508('0x22')]){logger[_0x9508('0x23')](_0x9508('0x24'),_0x9508('0x25'),util[_0x9508('0x26')](_0x9508('0x27'),_0x852feb['id'],_0x343802['replyUri']));if(_0x343802['Interactions']&&_0x343802[_0x9508('0x20')][_0x9508('0x28')]){_0x852feb[_0x9508('0x29')]=_[_0x9508('0x2a')](_0x343802[_0x9508('0x20')][0x0],_0x9508('0x21'));_0x852feb['Contact']=_0x343802['Interactions'][0x0][_0x9508('0x21')];}var _0x342ddd={'method':'POST','uri':encodeURI(_0x343802[_0x9508('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x342ddd['method']){case'GET':_0x342ddd['qs']=_0x852feb;break;case _0x9508('0x2b'):_0x342ddd[_0x9508('0xb')]=_0x852feb;break;}return rp(_0x342ddd)['then'](function(_0x49246b){logger[_0x9508('0x23')](_0x9508('0x24'),_0x9508('0x25'),util[_0x9508('0x26')](_0x9508('0x2c'),_0x852feb['id'],_0x343802[_0x9508('0x22')]));if(_0x49246b[_0x9508('0xb')][_0x9508('0x2d')]&&_0x49246b[_0x9508('0xb')][_0x9508('0x2d')]!=_0x852feb['Interaction'][_0x9508('0x2d')]){return _0x424e6a[_0x9508('0x13')][_0x9508('0x17')]({'threadId':_0x49246b['body'][_0x9508('0x2d')]},{'logging':!![],'where':{'id':_0x852feb[_0x9508('0x29')]['id']}});}else{return;}})['then'](function(){return _0x4f6720[_0x9508('0x17')]({'read':!![]});})[_0x9508('0x2e')](function(_0x5cbee3){logger[_0x9508('0x19')](_0x9508('0x24'),_0x9508('0x25'),util[_0x9508('0x2f')](_0x5cbee3,{'showHidden':![],'depth':null}));_0x5c9dc9();});}else{_0x5c9dc9();}})['finally'](function(){_0x5c9dc9();});}else{_0x5c9dc9();}}},'charset':'utf8mb4','collate':_0x9508('0x30')});}; \ No newline at end of file +var _0xce50=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','rimraf','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','error','out','secret','CmContact','then','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','omit','POST','GET','body','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally'];(function(_0x244914,_0x1108b3){var _0x5d9568=function(_0x130d10){while(--_0x130d10){_0x244914['push'](_0x244914['shift']());}};_0x5d9568(++_0x1108b3);}(_0xce50,0x1d8));var _0x0ce5=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xce50[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0x0ce5('0x0'));var logger=require(_0x0ce5('0x1'))(_0x0ce5('0x2'));var moment=require(_0x0ce5('0x3'));var BPromise=require(_0x0ce5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ce5('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x0ce5('0x6')]=function(_0x42fadd,_0x69892c){return _0x42fadd[_0x0ce5('0x7')]('OpenchannelMessage',attributes,{'tableName':_0x0ce5('0x8'),'paranoid':![],'indexes':[{'name':_0x0ce5('0x9'),'fields':['body'],'type':_0x0ce5('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55639f,_0x4475c9,_0x4ecdce){var _0x3ed31c=_0x42fadd[_0x0ce5('0xb')];var _0x5a3955=_0x55639f[_0x0ce5('0xc')]({'plain':!![]});if(_0x5a3955[_0x0ce5('0xd')][_0x0ce5('0xe')]()==='in'||_0x5a3955[_0x0ce5('0xd')][_0x0ce5('0xe')]()==='out'&&!_0x5a3955['secret']&&!_['isNil'](_0x5a3955[_0x0ce5('0xf')])){_0x3ed31c[_0x0ce5('0x10')][_0x0ce5('0x11')]({'where':{'id':_0x5a3955[_0x0ce5('0x12')]}})['then'](function(_0x85bbb){if(_0x85bbb){_0x85bbb[_0x0ce5('0x13')]({'lastMsgAt':_0x5a3955['createdAt'],'lastMsgDirection':_0x5a3955[_0x0ce5('0xd')]['toLowerCase']()});}})[_0x0ce5('0x14')](function(_0x1dd856){console[_0x0ce5('0x15')](_0x1dd856);});}if(_0x5a3955[_0x0ce5('0xd')]===_0x0ce5('0x16')&&!_0x5a3955[_0x0ce5('0x17')]){var _0x13486a;_0x3ed31c[_0x0ce5('0x18')]['describe']()[_0x0ce5('0x19')](function(_0x4292ce){return _0x3ed31c['OpenchannelAccount']['find']({'where':{'id':_0x5a3955[_0x0ce5('0x1a')]},'include':[{'model':_0x3ed31c['OpenchannelInteraction'],'as':_0x0ce5('0x1b'),'where':{'id':_0x5a3955[_0x0ce5('0x12')]},'limit':0x1,'include':[{'model':_0x3ed31c[_0x0ce5('0x18')],'as':_0x0ce5('0x1c'),'attributes':_[_0x0ce5('0x1d')](_0x4292ce)}]}]});})[_0x0ce5('0x19')](function(_0x57d9da){_0x13486a=_0x57d9da[_0x0ce5('0xc')]({'plain':!![]});if(_0x13486a&&_0x13486a[_0x0ce5('0x1e')]){logger[_0x0ce5('0x1f')](_0x0ce5('0x20'),'afterCreate',util[_0x0ce5('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5a3955['id'],_0x13486a[_0x0ce5('0x1e')]));if(_0x13486a[_0x0ce5('0x1b')]&&_0x13486a[_0x0ce5('0x1b')][_0x0ce5('0x22')]){_0x5a3955[_0x0ce5('0x23')]=_[_0x0ce5('0x24')](_0x13486a[_0x0ce5('0x1b')][0x0],_0x0ce5('0x1c'));_0x5a3955[_0x0ce5('0x1c')]=_0x13486a[_0x0ce5('0x1b')][0x0]['Contact'];}var _0x4475c9={'method':_0x0ce5('0x25'),'uri':encodeURI(_0x13486a['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4475c9['method']){case _0x0ce5('0x26'):_0x4475c9['qs']=_0x5a3955;break;case'POST':_0x4475c9[_0x0ce5('0x27')]=_0x5a3955;break;}return rp(_0x4475c9)[_0x0ce5('0x19')](function(_0x5bdf41){logger['info'](_0x0ce5('0x20'),_0x0ce5('0x28'),util['format'](_0x0ce5('0x29'),_0x5a3955['id'],_0x13486a[_0x0ce5('0x1e')]));if(_0x5bdf41[_0x0ce5('0x27')]['threadId']&&_0x5bdf41['body'][_0x0ce5('0x2a')]!=_0x5a3955[_0x0ce5('0x23')][_0x0ce5('0x2a')]){return _0x3ed31c[_0x0ce5('0x10')][_0x0ce5('0x13')]({'threadId':_0x5bdf41[_0x0ce5('0x27')][_0x0ce5('0x2a')]},{'logging':!![],'where':{'id':_0x5a3955[_0x0ce5('0x23')]['id']}});}else{return;}})[_0x0ce5('0x19')](function(){return _0x55639f[_0x0ce5('0x13')]({'read':!![]});})[_0x0ce5('0x14')](function(_0x2a94a5){logger[_0x0ce5('0x15')](_0x0ce5('0x20'),_0x0ce5('0x28'),util[_0x0ce5('0x2b')](_0x2a94a5,{'showHidden':![],'depth':null}));_0x4ecdce();});}else{_0x4ecdce();}})[_0x0ce5('0x2c')](function(){_0x4ecdce();});}else{_0x4ecdce();}}},'charset':_0x0ce5('0x2d'),'collate':_0x0ce5('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 0508933..d497d5e 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 _0xcefd=['CreateOpenchannelMessage','OpenchannelMessage','body','options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','request','info','OpenchannelMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch'];(function(_0x450958,_0x2c6887){var _0x1a974f=function(_0xcf6fe1){while(--_0xcf6fe1){_0x450958['push'](_0x450958['shift']());}};_0x1a974f(++_0x2c6887);}(_0xcefd,0x126));var _0xdcef=function(_0x5038e3,_0x29855b){_0x5038e3=_0x5038e3-0x0;var _0x593c8d=_0xcefd[_0x5038e3];return _0x593c8d;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var moment=require(_0xdcef('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcef('0x6'))(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdcef('0x9')][_0xdcef('0xa')]({'port':0x232a});config[_0xdcef('0xb')]=_[_0xdcef('0xc')](config['redis'],{'host':_0xdcef('0xd'),'port':0x18eb});var socket=require(_0xdcef('0xe'))(new Redis(config[_0xdcef('0xb')]));require(_0xdcef('0xf'))['register'](socket);function respondWithRpcPromise(_0x1946c9,_0x451606,_0x28ac35){return new BPromise(function(_0x37c1c3,_0x3fd234){return client[_0xdcef('0x10')](_0x1946c9,_0x28ac35)['then'](function(_0x4a2973){logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,'request\x20sent');logger[_0xdcef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x451606,'request\x20sent',JSON[_0xdcef('0x14')](_0x4a2973));if(_0x4a2973[_0xdcef('0x15')]){if(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x16')]===0x1f4){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);return _0x3fd234(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);}logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973['error'][_0xdcef('0x17')]);return _0x37c1c3(_0x4a2973['error'][_0xdcef('0x17')]);}else{logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,_0xdcef('0x18'));_0x37c1c3(_0x4a2973['result']['message']);}})[_0xdcef('0x19')](function(_0x19283a){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x19283a);_0x3fd234(_0x19283a);});});}exports[_0xdcef('0x1a')]=function(_0x465fed){var _0x43d0f1=this;return new Promise(function(_0x510d1e,_0x417de7){return db[_0xdcef('0x1b')]['create'](_0x465fed[_0xdcef('0x1c')],{'raw':_0x465fed[_0xdcef('0x1d')]?_0x465fed[_0xdcef('0x1d')][_0xdcef('0x1e')]===undefined?!![]:![]:!![]})[_0xdcef('0x1f')](function(_0x1082eb){logger[_0xdcef('0x11')](_0xdcef('0x1a'),_0x465fed);logger[_0xdcef('0x13')](_0xdcef('0x1a'),_0x465fed,JSON[_0xdcef('0x14')](_0x1082eb));_0x510d1e(_0x1082eb);})[_0xdcef('0x19')](function(_0x32d0ee){logger[_0xdcef('0x15')]('CreateOpenchannelMessage',_0x32d0ee[_0xdcef('0x17')],_0x465fed);_0x417de7(_0x43d0f1[_0xdcef('0x15')](0x1f4,_0x32d0ee[_0xdcef('0x17')]));});});}; \ No newline at end of file +var _0xffd6=['./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelMessage','create','options','raw','debug','CreateOpenchannelMessage','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0xace428,_0x42a542){var _0x2cf205=function(_0x2d93d4){while(--_0x2d93d4){_0xace428['push'](_0xace428['shift']());}};_0x2cf205(++_0x42a542);}(_0xffd6,0x97));var _0x6ffd=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0xffd6[_0x46428c];return _0x16a677;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ffd('0x3'));var db=require(_0x6ffd('0x4'))['db'];var utils=require(_0x6ffd('0x5'));var logger=require('../../config/logger')(_0x6ffd('0x6'));var config=require(_0x6ffd('0x7'));var jayson=require(_0x6ffd('0x8'));var client=jayson[_0x6ffd('0x9')]['http']({'port':0x232a});config[_0x6ffd('0xa')]=_[_0x6ffd('0xb')](config[_0x6ffd('0xa')],{'host':_0x6ffd('0xc'),'port':0x18eb});var socket=require(_0x6ffd('0xd'))(new Redis(config['redis']));require(_0x6ffd('0xe'))[_0x6ffd('0xf')](socket);function respondWithRpcPromise(_0x4e57f5,_0x469d0d,_0x38fc68){return new BPromise(function(_0x23f7f2,_0x3dda1e){return client[_0x6ffd('0x10')](_0x4e57f5,_0x38fc68)[_0x6ffd('0x11')](function(_0x836501){logger['info'](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));logger['debug'](_0x6ffd('0x14'),_0x469d0d,_0x6ffd('0x13'),JSON[_0x6ffd('0x15')](_0x836501));if(_0x836501[_0x6ffd('0x16')]){if(_0x836501['error'][_0x6ffd('0x17')]===0x1f4){logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501['error'][_0x6ffd('0x18')]);return _0x3dda1e(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}logger['error'](_0x6ffd('0x12'),_0x469d0d,_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);return _0x23f7f2(_0x836501[_0x6ffd('0x16')][_0x6ffd('0x18')]);}else{logger[_0x6ffd('0x19')](_0x6ffd('0x12'),_0x469d0d,_0x6ffd('0x13'));_0x23f7f2(_0x836501['result'][_0x6ffd('0x18')]);}})['catch'](function(_0x587d0b){logger[_0x6ffd('0x16')](_0x6ffd('0x12'),_0x469d0d,_0x587d0b);_0x3dda1e(_0x587d0b);});});}exports['CreateOpenchannelMessage']=function(_0x34c3c1){var _0x4612a3=this;return new Promise(function(_0x4eeaa2,_0x564a11){return db[_0x6ffd('0x1a')][_0x6ffd('0x1b')](_0x34c3c1['body'],{'raw':_0x34c3c1[_0x6ffd('0x1c')]?_0x34c3c1[_0x6ffd('0x1c')][_0x6ffd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3ba429){logger[_0x6ffd('0x19')]('CreateOpenchannelMessage',_0x34c3c1);logger[_0x6ffd('0x1e')](_0x6ffd('0x1f'),_0x34c3c1,JSON['stringify'](_0x3ba429));_0x4eeaa2(_0x3ba429);})[_0x6ffd('0x20')](function(_0x35ef16){logger[_0x6ffd('0x16')]('CreateOpenchannelMessage',_0x35ef16[_0x6ffd('0x18')],_0x34c3c1);_0x564a11(_0x4612a3[_0x6ffd('0x16')](0x1f4,_0x35ef16[_0x6ffd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3a2ce67..570b536 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(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_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 _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x1b0f87,_0xb78388){var _0x1041ca=function(_0x25ce0f){while(--_0x25ce0f){_0x1b0f87['push'](_0x1b0f87['shift']());}};_0x1041ca(++_0xb78388);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0xcb91[_0x4a96ca];return _0x2aed48;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6dd1d36..da25ffb 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 _0x038b=['show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','/:id','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x1dfce3,_0x491d21){var _0x127504=function(_0x3028cb){while(--_0x3028cb){_0x1dfce3['push'](_0x1dfce3['shift']());}};_0x127504(++_0x491d21);}(_0x038b,0x114));var _0xb038=function(_0x59a4e9,_0x4e4e3f){_0x59a4e9=_0x59a4e9-0x0;var _0x3c44d9=_0x038b[_0x59a4e9];return _0x3c44d9;};'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('./openchannelQueue.controller');router[_0xb038('0x6')]('/',auth[_0xb038('0x7')](),controller['index']);router['get'](_0xb038('0x8'),auth[_0xb038('0x7')](),controller[_0xb038('0x9')]);router['get']('/:id',auth[_0xb038('0x7')](),controller[_0xb038('0xa')]);router['get']('/:id/members',auth[_0xb038('0x7')](),controller[_0xb038('0xb')]);router['get'](_0xb038('0xc'),auth[_0xb038('0x7')](),controller[_0xb038('0xd')]);router[_0xb038('0x6')](_0xb038('0xe'),auth[_0xb038('0x7')](),controller[_0xb038('0xf')]);router[_0xb038('0x10')]('/',auth[_0xb038('0x7')](),controller[_0xb038('0x11')]);router[_0xb038('0x10')](_0xb038('0xc'),auth[_0xb038('0x7')](),controller[_0xb038('0x12')]);router[_0xb038('0x10')](_0xb038('0xe'),auth[_0xb038('0x7')](),controller['addAgents']);router[_0xb038('0x13')](_0xb038('0x14'),auth[_0xb038('0x7')](),controller[_0xb038('0x15')]);router[_0xb038('0x16')](_0xb038('0x14'),auth['isAuthenticated'](),controller[_0xb038('0x17')]);router[_0xb038('0x16')](_0xb038('0xc'),auth[_0xb038('0x7')](),controller['removeTeams']);router['delete'](_0xb038('0xe'),auth[_0xb038('0x7')](),controller[_0xb038('0x18')]);module[_0xb038('0x19')]=router; \ No newline at end of file +var _0x36b2=['/:id/teams','addTeams','/:id/users','update','delete','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getMembers','getTeams','post'];(function(_0x26bcf0,_0x11ebb7){var _0x3bf097=function(_0x5c9cd2){while(--_0x5c9cd2){_0x26bcf0['push'](_0x26bcf0['shift']());}};_0x3bf097(++_0x11ebb7);}(_0x36b2,0x6b));var _0x236b=function(_0x43f804,_0x12ca6c){_0x43f804=_0x43f804-0x0;var _0x35f5f8=_0x36b2[_0x43f804];return _0x35f5f8;};'use strict';var multer=require(_0x236b('0x0'));var util=require(_0x236b('0x1'));var path=require(_0x236b('0x2'));var timeout=require('connect-timeout');var express=require(_0x236b('0x3'));var router=express[_0x236b('0x4')]();var auth=require(_0x236b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x236b('0x6'));var controller=require(_0x236b('0x7'));router['get']('/',auth[_0x236b('0x8')](),controller[_0x236b('0x9')]);router[_0x236b('0xa')](_0x236b('0xb'),auth[_0x236b('0x8')](),controller[_0x236b('0xc')]);router['get'](_0x236b('0xd'),auth[_0x236b('0x8')](),controller[_0x236b('0xe')]);router[_0x236b('0xa')]('/:id/members',auth[_0x236b('0x8')](),controller[_0x236b('0xf')]);router[_0x236b('0xa')]('/:id/teams',auth[_0x236b('0x8')](),controller[_0x236b('0x10')]);router[_0x236b('0xa')]('/:id/users',auth[_0x236b('0x8')](),controller['getAgents']);router['post']('/',auth[_0x236b('0x8')](),controller['create']);router[_0x236b('0x11')](_0x236b('0x12'),auth[_0x236b('0x8')](),controller[_0x236b('0x13')]);router[_0x236b('0x11')](_0x236b('0x14'),auth[_0x236b('0x8')](),controller['addAgents']);router['put'](_0x236b('0xd'),auth[_0x236b('0x8')](),controller[_0x236b('0x15')]);router[_0x236b('0x16')](_0x236b('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x236b('0x16')]('/:id/teams',auth[_0x236b('0x8')](),controller[_0x236b('0x17')]);router['delete']('/:id/users',auth[_0x236b('0x8')](),controller['removeAgents']);module[_0x236b('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 6595df2..b9ee49e 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 _0x06ae=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xe06a('0x0')]={'name':{'type':Sequelize[_0xe06a('0x1')],'unique':_0xe06a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe06a('0x1')]},'timeout':{'type':Sequelize[_0xe06a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe06a('0x4')](_0xe06a('0x5'),_0xe06a('0x6'),_0xe06a('0x7'))}}; \ No newline at end of file +var _0x873e=['roundrobin','sequelize','exports','STRING','name'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x873e,0x141));var _0xe873=function(_0x407fe0,_0x4ac8d6){_0x407fe0=_0x407fe0-0x0;var _0x143229=_0x873e[_0x407fe0];return _0x143229;};'use strict';var Sequelize=require(_0xe873('0x0'));module[_0xe873('0x1')]={'name':{'type':Sequelize[_0xe873('0x2')],'unique':_0xe873('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe873('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xe873('0x4'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 57a228b..afff81b 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 _0x8250=['find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','getMembers','findOne','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','ids','Agents','online','voicePause','sequelize','transaction','addTeams','each','UserOpenchannelQueue','findOrCreate','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./openchannelQueue.socket','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','destroy','OpenchannelQueues','UserProfileResource','then','error','stack','name','send','OpenchannelQueue','rawAttributes','type','key','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','fields','length','include'];(function(_0x5226ec,_0x115d08){var _0x5c1101=function(_0xb271af){while(--_0xb271af){_0x5226ec['push'](_0x5226ec['shift']());}};_0x5c1101(++_0x115d08);}(_0x8250,0xc4));var _0x0825=function(_0x56ef93,_0x28687c){_0x56ef93=_0x56ef93-0x0;var _0x45e0e7=_0x8250[_0x56ef93];return _0x45e0e7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0825('0x0'));var rimraf=require(_0x0825('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0825('0x2'));var rp=require('request-promise');var moment=require(_0x0825('0x3'));var BPromise=require(_0x0825('0x4'));var Mustache=require(_0x0825('0x5'));var util=require(_0x0825('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0825('0x7'));var ejs=require(_0x0825('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0825('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0825('0xa'));var toCsv=require(_0x0825('0x7'));var querystring=require(_0x0825('0xb'));var Papa=require('papaparse');var Redis=require(_0x0825('0xc'));var authService=require(_0x0825('0xd'));var qs=require(_0x0825('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0825('0xf'));var logger=require(_0x0825('0x10'))(_0x0825('0x11'));var utils=require(_0x0825('0x12'));var config=require(_0x0825('0x13'));var db=require('../../mysqldb')['db'];config[_0x0825('0x14')]=_[_0x0825('0x15')](config[_0x0825('0x14')],{'host':_0x0825('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0825('0x14')]));require(_0x0825('0x17'))['register'](socket);function respondWithStatusCode(_0x23b311,_0x188202){_0x188202=_0x188202||0xcc;return function(_0x314c18){if(_0x314c18){return _0x23b311[_0x0825('0x18')](_0x188202);}return _0x23b311[_0x0825('0x19')](_0x188202)[_0x0825('0x1a')]();};}function respondWithResult(_0x5c3a88,_0x1eb0f4){_0x1eb0f4=_0x1eb0f4||0xc8;return function(_0x17a08f){if(_0x17a08f){return _0x5c3a88['status'](_0x1eb0f4)[_0x0825('0x1b')](_0x17a08f);}};}function respondWithFilteredResult(_0x23eeab,_0x1b1b9f){return function(_0x3d4f4f){if(_0x3d4f4f){var _0x2a5c7d=_0x3d4f4f['count'],_0x55132b=_0x1b1b9f[_0x0825('0x1c')],_0x1bed8a=_0x1b1b9f[_0x0825('0x1c')]+_0x1b1b9f['limit'],_0x150dc1;if(_0x1bed8a>=_0x2a5c7d){_0x1bed8a=_0x2a5c7d;_0x150dc1=0xc8;}else{_0x150dc1=0xce;}_0x23eeab['status'](_0x150dc1);return _0x23eeab['set'](_0x0825('0x1d'),_0x55132b+'-'+_0x1bed8a+'/'+_0x2a5c7d)[_0x0825('0x1b')](_0x3d4f4f);}return null;};}function patchUpdates(_0x1877e8){return function(_0x472583){try{jsonpatch[_0x0825('0x1e')](_0x472583,_0x1877e8,!![]);}catch(_0x54d848){return BPromise[_0x0825('0x1f')](_0x54d848);}return _0x472583[_0x0825('0x20')]();};}function saveUpdates(_0x1a7df2,_0x706d69){return function(_0x3aaffd){if(_0x3aaffd){return _0x3aaffd['update'](_0x1a7df2)['then'](function(_0x2506ad){return _0x2506ad;});}return null;};}function removeEntity(_0x471e66,_0x31b5f3){return function(_0x3906ae){if(_0x3906ae){return _0x3906ae[_0x0825('0x21')]()['then'](function(){var _0xb3affb=_0x3906ae['get']({'plain':!![]});var _0x535e06=_0x0825('0x22');return db[_0x0825('0x23')][_0x0825('0x21')]({'where':{'type':_0x535e06,'resourceId':_0xb3affb['id']}})[_0x0825('0x24')](function(){return _0x3906ae;});})[_0x0825('0x24')](function(){_0x471e66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x369bf6,_0x2edb42){return function(_0x3b10f4){if(!_0x3b10f4){_0x369bf6[_0x0825('0x18')](0x194);}return _0x3b10f4;};}function handleError(_0x38eaf9,_0xd4c714){_0xd4c714=_0xd4c714||0x1f4;return function(_0x86f42b){logger[_0x0825('0x25')](_0x86f42b[_0x0825('0x26')]);if(_0x86f42b[_0x0825('0x27')]){delete _0x86f42b[_0x0825('0x27')];}_0x38eaf9['status'](_0xd4c714)[_0x0825('0x28')](_0x86f42b);};}exports['index']=function(_0x4c50df,_0x1fc380){var _0x229126={},_0x1f2ca5={},_0x1e1b2b={'count':0x0,'rows':[]};var _0x3bac66=_['map'](db[_0x0825('0x29')][_0x0825('0x2a')],function(_0x57e91e){return{'name':_0x57e91e['fieldName'],'type':_0x57e91e[_0x0825('0x2b')][_0x0825('0x2c')]};});_0x1f2ca5[_0x0825('0x2d')]=_[_0x0825('0x2e')](_0x3bac66,_0x0825('0x27'));_0x1f2ca5[_0x0825('0x2f')]=_[_0x0825('0x30')](_0x4c50df[_0x0825('0x2f')]);_0x1f2ca5['filters']=_[_0x0825('0x31')](_0x1f2ca5[_0x0825('0x2d')],_0x1f2ca5['query']);_0x229126[_0x0825('0x32')]=_[_0x0825('0x31')](_0x1f2ca5[_0x0825('0x2d')],qs['fields'](_0x4c50df['query']['fields']));_0x229126[_0x0825('0x32')]=_0x229126[_0x0825('0x32')]['length']?_0x229126[_0x0825('0x32')]:_0x1f2ca5[_0x0825('0x2d')];if(!_0x4c50df[_0x0825('0x2f')][_0x0825('0x33')](_0x0825('0x34'))){_0x229126[_0x0825('0x35')]=qs[_0x0825('0x35')](_0x4c50df['query'][_0x0825('0x35')]);_0x229126[_0x0825('0x1c')]=qs['offset'](_0x4c50df[_0x0825('0x2f')][_0x0825('0x1c')]);}_0x229126['order']=qs[_0x0825('0x36')](_0x4c50df[_0x0825('0x2f')][_0x0825('0x36')]);_0x229126[_0x0825('0x37')]=qs['filters'](_[_0x0825('0x38')](_0x4c50df[_0x0825('0x2f')],_0x1f2ca5[_0x0825('0x39')]),_0x3bac66);if(_0x4c50df['query'][_0x0825('0x3a')]){_0x229126['where']=_[_0x0825('0x3b')](_0x229126[_0x0825('0x37')],{'$or':_[_0x0825('0x2e')](_0x3bac66,function(_0x2cbd04){if(_0x2cbd04[_0x0825('0x2b')]!==_0x0825('0x3c')){var _0x1ea1cf={};_0x1ea1cf[_0x2cbd04[_0x0825('0x27')]]={'$like':'%'+_0x4c50df[_0x0825('0x2f')]['filter']+'%'};return _0x1ea1cf;}})});}_0x229126=_[_0x0825('0x3b')]({},_0x229126,_0x4c50df[_0x0825('0x3d')]);var _0x131dab={'where':_0x229126[_0x0825('0x37')]};return db[_0x0825('0x29')][_0x0825('0x3e')](_0x131dab)[_0x0825('0x24')](function(_0x3b1ed0){_0x1e1b2b['count']=_0x3b1ed0;if(_0x4c50df[_0x0825('0x2f')][_0x0825('0x3f')]){_0x229126['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x0825('0x40')](_0x229126);})[_0x0825('0x24')](function(_0x31b3a7){_0x1e1b2b[_0x0825('0x41')]=_0x31b3a7;return _0x1e1b2b;})['then'](respondWithFilteredResult(_0x1fc380,_0x229126))[_0x0825('0x42')](handleError(_0x1fc380,null));};exports[_0x0825('0x43')]=function(_0x46f245,_0x298e84){var _0x5443e1={'raw':!![],'where':{'id':_0x46f245[_0x0825('0x44')]['id']}},_0x40fe76={};_0x40fe76[_0x0825('0x2d')]=_[_0x0825('0x30')](db['OpenchannelQueue'][_0x0825('0x2a')]);_0x40fe76[_0x0825('0x2f')]=_[_0x0825('0x30')](_0x46f245[_0x0825('0x2f')]);_0x40fe76[_0x0825('0x39')]=_[_0x0825('0x31')](_0x40fe76[_0x0825('0x2d')],_0x40fe76['query']);_0x5443e1['attributes']=_[_0x0825('0x31')](_0x40fe76[_0x0825('0x2d')],qs[_0x0825('0x45')](_0x46f245[_0x0825('0x2f')][_0x0825('0x45')]));_0x5443e1['attributes']=_0x5443e1[_0x0825('0x32')][_0x0825('0x46')]?_0x5443e1[_0x0825('0x32')]:_0x40fe76[_0x0825('0x2d')];if(_0x46f245['query'][_0x0825('0x3f')]){_0x5443e1[_0x0825('0x47')]=[{'all':!![]}];}_0x5443e1=_[_0x0825('0x3b')]({},_0x5443e1,_0x46f245[_0x0825('0x3d')]);return db[_0x0825('0x29')][_0x0825('0x48')](_0x5443e1)['then'](handleEntityNotFound(_0x298e84,null))[_0x0825('0x24')](respondWithResult(_0x298e84,null))['catch'](handleError(_0x298e84,null));};exports[_0x0825('0x49')]=function(_0x42679f,_0x5eee47){return db[_0x0825('0x29')][_0x0825('0x49')](_0x42679f[_0x0825('0x4a')],{})[_0x0825('0x24')](function(_0xf952cc){var _0x1870d4=_0x42679f[_0x0825('0x4b')][_0x0825('0x4c')]({'plain':!![]});if(!_0x1870d4)throw new Error(_0x0825('0x4d'));if(_0x1870d4[_0x0825('0x4e')]===_0x0825('0x4b')){var _0x9a7bc4=_0xf952cc[_0x0825('0x4c')]({'plain':!![]});var _0x333353=_0x0825('0x22');return db[_0x0825('0x4f')][_0x0825('0x48')]({'where':{'name':_0x333353,'userProfileId':_0x1870d4[_0x0825('0x50')]},'raw':!![]})[_0x0825('0x24')](function(_0x3d6a20){if(_0x3d6a20&&_0x3d6a20[_0x0825('0x51')]===0x0){return db[_0x0825('0x23')][_0x0825('0x49')]({'name':_0x9a7bc4[_0x0825('0x27')],'resourceId':_0x9a7bc4['id'],'type':_0x3d6a20['name'],'sectionId':_0x3d6a20['id']},{})[_0x0825('0x24')](function(){return _0xf952cc;});}else{return _0xf952cc;}})[_0x0825('0x42')](function(_0x5b847b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b847b);throw _0x5b847b;});}return _0xf952cc;})[_0x0825('0x24')](respondWithResult(_0x5eee47,0xc9))[_0x0825('0x42')](handleError(_0x5eee47,null));};exports[_0x0825('0x52')]=function(_0x400fa9,_0x3260fb){if(_0x400fa9[_0x0825('0x4a')]['id']){delete _0x400fa9['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x400fa9[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x3260fb,null))['then'](saveUpdates(_0x400fa9['body'],null))[_0x0825('0x24')](respondWithResult(_0x3260fb,null))[_0x0825('0x42')](handleError(_0x3260fb,null));};exports['destroy']=function(_0x4fecd5,_0x3a1889){return db[_0x0825('0x29')]['find']({'where':{'id':_0x4fecd5[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x3a1889,null))[_0x0825('0x24')](removeEntity(_0x3a1889,null))['catch'](handleError(_0x3a1889,null));};exports[_0x0825('0x53')]=function(_0x10503e,_0x57231e){return db['OpenchannelQueue'][_0x0825('0x53')]()[_0x0825('0x24')](respondWithResult(_0x57231e,null))[_0x0825('0x42')](handleError(_0x57231e,null));};exports[_0x0825('0x54')]=function(_0x845b25,_0x21f47b,_0x119cda){var _0x15073f={'raw':!![],'where':{}},_0x1252ce={},_0x2450ef;return db['OpenchannelQueue'][_0x0825('0x55')]({'where':{'id':_0x845b25[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x21f47b,null))[_0x0825('0x24')](function(_0x17831c){if(_0x17831c){_0x2450ef=_0x17831c['get']({'plain':!![]});_0x1252ce[_0x0825('0x2d')]=_[_0x0825('0x30')](db['UserOpenchannelQueue']['rawAttributes']);_0x1252ce[_0x0825('0x2f')]=_[_0x0825('0x30')](_0x845b25[_0x0825('0x2f')]);_0x1252ce['filters']=_[_0x0825('0x31')](_0x1252ce[_0x0825('0x2d')],_0x1252ce['query']);_0x15073f[_0x0825('0x32')]=_[_0x0825('0x31')](_0x1252ce[_0x0825('0x2d')],qs[_0x0825('0x45')](_0x845b25['query'][_0x0825('0x45')]));_0x15073f[_0x0825('0x32')]=_0x15073f[_0x0825('0x32')]['length']?_0x15073f[_0x0825('0x32')]:_0x1252ce[_0x0825('0x2d')];if(!_0x845b25[_0x0825('0x2f')][_0x0825('0x33')](_0x0825('0x34'))){_0x15073f[_0x0825('0x35')]=qs[_0x0825('0x35')](_0x845b25['query'][_0x0825('0x35')]);_0x15073f[_0x0825('0x1c')]=qs[_0x0825('0x1c')](_0x845b25[_0x0825('0x2f')][_0x0825('0x1c')]);}_0x15073f[_0x0825('0x56')]=qs[_0x0825('0x36')](_0x845b25[_0x0825('0x2f')]['sort']);_0x15073f['where']=qs[_0x0825('0x39')](_[_0x0825('0x38')](_0x845b25[_0x0825('0x2f')],_0x1252ce[_0x0825('0x39')]));_0x15073f[_0x0825('0x37')][_0x0825('0x57')]=_0x17831c['id'];if(_0x845b25[_0x0825('0x2f')][_0x0825('0x3a')]){_0x15073f[_0x0825('0x37')]=_[_0x0825('0x3b')](_0x15073f[_0x0825('0x37')],{'$or':_[_0x0825('0x2e')](_0x15073f[_0x0825('0x32')],function(_0x17703c){var _0x24a804={};_0x24a804[_0x17703c]={'$like':'%'+_0x845b25[_0x0825('0x2f')][_0x0825('0x3a')]+'%'};return _0x24a804;})});}_0x15073f=_['merge']({},_0x15073f,_0x845b25[_0x0825('0x3d')]);return db['UserOpenchannelQueue'][_0x0825('0x40')](_0x15073f);}})[_0x0825('0x24')](function(_0x5ccc8a){if(_0x5ccc8a){return db[_0x0825('0x58')][_0x0825('0x59')]({'where':{'id':_[_0x0825('0x2e')](_0x5ccc8a,_0x0825('0x5a')),'role':_0x0825('0x5b')},'attributes':['id',_0x0825('0x27'),_0x0825('0x5c'),_0x0825('0x5d'),_0x0825('0x5e')]});}})['then'](function(_0x1afaf4){if(_0x1afaf4){return{'count':_0x1afaf4['count'],'rows':_[_0x0825('0x2e')](_0x1afaf4[_0x0825('0x41')],function(_0x4b4991){return{'membername':_0x4b4991['name'],'UserId':_0x4b4991['id'],'queue_name':_0x2450ef[_0x0825('0x27')],'OpenchannelQueueId':_0x2450ef['id'],'interface':util[_0x0825('0x5f')](_0x0825('0x60'),'SIP',_0x4b4991['name']),'penalty':0x0,'paused':_0x4b4991[_0x0825('0x5c')],'createdAt':_0x4b4991[_0x0825('0x5e')],'updatedAt':_0x4b4991[_0x0825('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0825('0x24')](respondWithFilteredResult(_0x21f47b,_0x15073f))[_0x0825('0x42')](handleError(_0x21f47b,null));};exports[_0x0825('0x61')]=function(_0x1b28d6,_0x13efdf,_0x7ac588){var _0x4894c3={};var _0x339ec6={};var _0x197267;var _0x3c1c6c;return db[_0x0825('0x29')][_0x0825('0x55')]({'where':{'id':_0x1b28d6[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x13efdf,null))[_0x0825('0x24')](function(_0x125da7){if(_0x125da7){_0x197267=_0x125da7;_0x339ec6[_0x0825('0x2d')]=_['keys'](db[_0x0825('0x62')]['rawAttributes']);_0x339ec6[_0x0825('0x2f')]=_[_0x0825('0x30')](_0x1b28d6[_0x0825('0x2f')]);_0x339ec6[_0x0825('0x39')]=_['intersection'](_0x339ec6[_0x0825('0x2d')],_0x339ec6[_0x0825('0x2f')]);_0x4894c3[_0x0825('0x32')]=_[_0x0825('0x31')](_0x339ec6[_0x0825('0x2d')],qs[_0x0825('0x45')](_0x1b28d6[_0x0825('0x2f')][_0x0825('0x45')]));_0x4894c3[_0x0825('0x32')]=_0x4894c3['attributes'][_0x0825('0x46')]?_0x4894c3[_0x0825('0x32')]:_0x339ec6[_0x0825('0x2d')];_0x4894c3[_0x0825('0x56')]=qs[_0x0825('0x36')](_0x1b28d6['query'][_0x0825('0x36')]);_0x4894c3[_0x0825('0x37')]=qs[_0x0825('0x39')](_[_0x0825('0x38')](_0x1b28d6['query'],_0x339ec6[_0x0825('0x39')]));if(_0x1b28d6['query']['filter']){_0x4894c3[_0x0825('0x37')]=_[_0x0825('0x3b')](_0x4894c3[_0x0825('0x37')],{'$or':_[_0x0825('0x2e')](_0x4894c3[_0x0825('0x32')],function(_0x7d3977){var _0x286ae0={};_0x286ae0[_0x7d3977]={'$like':'%'+_0x1b28d6[_0x0825('0x2f')]['filter']+'%'};return _0x286ae0;})});}_0x4894c3=_[_0x0825('0x3b')]({},_0x4894c3,_0x1b28d6['options']);return _0x197267[_0x0825('0x61')](_0x4894c3);}})[_0x0825('0x24')](function(_0x4b051d){if(_0x4b051d){_0x3c1c6c=_0x4b051d[_0x0825('0x46')];if(!_0x1b28d6['query'][_0x0825('0x33')]('nolimit')){_0x4894c3[_0x0825('0x35')]=qs['limit'](_0x1b28d6[_0x0825('0x2f')][_0x0825('0x35')]);_0x4894c3[_0x0825('0x1c')]=qs[_0x0825('0x1c')](_0x1b28d6[_0x0825('0x2f')][_0x0825('0x1c')]);}return _0x197267[_0x0825('0x61')](_0x4894c3);}})[_0x0825('0x24')](function(_0xb1c38b){if(_0xb1c38b){return _0xb1c38b?{'count':_0x3c1c6c,'rows':_0xb1c38b}:null;}})[_0x0825('0x24')](respondWithResult(_0x13efdf,null))['catch'](handleError(_0x13efdf,null));};exports['addTeams']=function(_0x170f4f,_0x499d9d,_0x34a7c5){var _0x594e20=_0x170f4f['body'][_0x0825('0x63')];return db[_0x0825('0x62')][_0x0825('0x40')]({'where':{'id':_0x594e20},'attributes':['id'],'include':[{'model':db[_0x0825('0x58')],'as':_0x0825('0x64'),'attributes':['id','name',_0x0825('0x65'),_0x0825('0x66'),'interface'],'raw':!![]}]})['then'](function(_0x593bc5){if(_0x593bc5){var _0x21b90a=_['flatMap'](_0x593bc5,function(_0x38fe7c){var _0x41b8a7=_0x38fe7c[_0x0825('0x4c')]({'plain':!![]});return _0x41b8a7[_0x0825('0x64')];});return db[_0x0825('0x29')][_0x0825('0x48')]({'where':{'id':_0x170f4f[_0x0825('0x44')]['id']}})[_0x0825('0x24')](function(_0x2bf558){return db[_0x0825('0x67')][_0x0825('0x68')](function(_0x5f6804){return _0x2bf558[_0x0825('0x69')](_0x594e20,{'transaction':_0x5f6804})[_0x0825('0x24')](function(){return BPromise[_0x0825('0x6a')](_0x21b90a,function(_0x3c1fbd){return db[_0x0825('0x6b')][_0x0825('0x6c')]({'where':{'UserId':_0x3c1fbd['id'],'OpenchannelQueueId':_0x170f4f[_0x0825('0x44')]['id']},'transaction':_0x5f6804});});})['then'](function(){_0x21b90a['forEach'](function(_0x2822c8){socket[_0x0825('0x6d')](_0x0825('0x6e'),{'UserId':_0x2822c8['id'],'OpenchannelQueueId':_0x2bf558['id']});});});});});}})[_0x0825('0x24')](respondWithStatusCode(_0x499d9d,null))[_0x0825('0x42')](handleError(_0x499d9d,null));};exports['removeTeams']=function(_0x79811,_0xec23ce,_0x525493){return db[_0x0825('0x62')][_0x0825('0x40')]({'where':{'id':_0x79811[_0x0825('0x2f')][_0x0825('0x63')]},'attributes':['id'],'include':[{'model':db[_0x0825('0x58')],'as':_0x0825('0x64'),'attributes':['id'],'raw':!![]}]})[_0x0825('0x24')](handleEntityNotFound(_0xec23ce,null))['then'](function(_0x2ecc13){var _0x15b923=_[_0x0825('0x2e')](_0x2ecc13,'id');var _0x23eadb=[];var _0xb670c2=[];var _0x2cd6cd=squel[_0x0825('0x6f')]();_0x2cd6cd['field'](_0x0825('0x70'))[_0x0825('0x71')](_0x0825('0x72'),'tq')[_0x0825('0x73')](_0x0825('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0825('0x37')]('OpenchannelQueueId\x20=\x20?',_0x79811[_0x0825('0x44')]['id']);for(var _0x5c731b=0x0;_0x5c731b<_0x2ecc13[_0x0825('0x46')];_0x5c731b+=0x1){let _0x1a9133=_0x2ecc13[_0x5c731b];for(var _0x2ca08e=0x0;_0x2ca08e<_0x1a9133[_0x0825('0x64')][_0x0825('0x46')];_0x2ca08e+=0x1){let _0x2ed932=_0x1a9133['Agents'][_0x2ca08e];var _0x1ab35f=_0x2cd6cd['clone']();_0x1ab35f[_0x0825('0x37')](_0x0825('0x75'),_0x2ed932['id']);_0xb670c2[_0x0825('0x76')](db[_0x0825('0x67')][_0x0825('0x2f')](_0x1ab35f[_0x0825('0x77')](),{'type':db['sequelize'][_0x0825('0x78')][_0x0825('0x79')]})[_0x0825('0x24')](function(_0xeccbd4){if(_0xeccbd4[_0x0825('0x46')]===0x1){return _0x2ed932['id'];}else{var _0x41636d=_[_0x0825('0x7a')](_['map'](_0xeccbd4,_0x0825('0x7b')),function(_0xe998af){return _[_0x0825('0x7c')](_0x15b923,_0xe998af);});if(_0x41636d){return _0x2ed932['id'];}}}));}}return BPromise['all'](_0xb670c2)[_0x0825('0x24')](function(_0x1b488c){_0x23eadb=_(_0x23eadb)['union'](_0x1b488c)[_0x0825('0x7d')]()['value']();return db[_0x0825('0x29')][_0x0825('0x48')]({'where':{'id':_0x79811['params']['id']}})[_0x0825('0x24')](function(_0x3b5074){return db[_0x0825('0x67')][_0x0825('0x68')](function(_0x3b5bb4){return _0x3b5074['removeTeams'](_0x79811[_0x0825('0x2f')][_0x0825('0x63')],{'transaction':_0x3b5bb4})[_0x0825('0x24')](function(){if(!_[_0x0825('0x7e')](_0x23eadb)){return _0x3b5074[_0x0825('0x7f')](_0x23eadb,{'transaction':_0x3b5bb4});}})['then'](function(){_0x23eadb['forEach'](function(_0x4b17e7){socket['emit'](_0x0825('0x80'),{'UserId':_0x4b17e7,'OpenchannelQueueId':_0x3b5074['id']});});});});});});})[_0x0825('0x24')](respondWithStatusCode(_0xec23ce,null))[_0x0825('0x42')](handleError(_0xec23ce,null));};exports[_0x0825('0x81')]=function(_0x4ffba6,_0x4f9411,_0x3f3996){return db['OpenchannelQueue'][_0x0825('0x48')]({'where':{'id':_0x4ffba6[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x4f9411,null))[_0x0825('0x24')](function(_0x5a2371){if(_0x5a2371){return _0x5a2371['addAgents'](_0x4ffba6['body']['ids'],_[_0x0825('0x82')](_0x4ffba6[_0x0825('0x4a')],['ids','id'])||{})[_0x0825('0x83')](function(_0x18d674){for(var _0x4dca26=0x0;_0x4dca26<_0x4ffba6[_0x0825('0x4a')][_0x0825('0x63')][_0x0825('0x46')];_0x4dca26+=0x1){socket['emit'](_0x0825('0x6e'),{'UserId':_0x4ffba6[_0x0825('0x4a')][_0x0825('0x63')][_0x4dca26],'OpenchannelQueueId':_0x4ffba6['params']['id']});}return _0x18d674;});}})[_0x0825('0x24')](respondWithResult(_0x4f9411,null))['catch'](handleError(_0x4f9411,null));};exports[_0x0825('0x7f')]=function(_0x244520,_0x5cd017,_0x43ff6d){return db[_0x0825('0x29')][_0x0825('0x48')]({'where':{'id':_0x244520[_0x0825('0x44')]['id']}})['then'](handleEntityNotFound(_0x5cd017,null))[_0x0825('0x24')](function(_0x2f4f1c){if(_0x2f4f1c){return _0x2f4f1c[_0x0825('0x7f')](_0x244520[_0x0825('0x2f')]['ids'])[_0x0825('0x24')](function(){if(_[_0x0825('0x84')](_0x244520[_0x0825('0x2f')][_0x0825('0x63')])){for(var _0x4fb72b=0x0;_0x4fb72b<_0x244520[_0x0825('0x2f')][_0x0825('0x63')]['length'];_0x4fb72b+=0x1){socket[_0x0825('0x6d')](_0x0825('0x80'),{'UserId':Number(_0x244520[_0x0825('0x2f')]['ids'][_0x4fb72b]),'OpenchannelQueueId':Number(_0x244520[_0x0825('0x44')]['id'])});}}else{socket['emit'](_0x0825('0x80'),{'UserId':Number(_0x244520[_0x0825('0x2f')][_0x0825('0x63')]),'OpenchannelQueueId':Number(_0x244520[_0x0825('0x44')]['id'])});}});}})[_0x0825('0x24')](respondWithStatusCode(_0x5cd017,null))['catch'](handleError(_0x5cd017,null));};exports[_0x0825('0x85')]=function(_0xe380c6,_0x4990f1,_0xdbf245){var _0x178a69={};var _0x47260e={};var _0x1bb4a2;var _0x1ff15c;return db[_0x0825('0x29')]['findOne']({'where':{'id':_0xe380c6[_0x0825('0x44')]['id']}})[_0x0825('0x24')](handleEntityNotFound(_0x4990f1,null))['then'](function(_0xbfe7ab){if(_0xbfe7ab){_0x1bb4a2=_0xbfe7ab;_0x47260e[_0x0825('0x2d')]=_[_0x0825('0x30')](db[_0x0825('0x58')][_0x0825('0x2a')]);_0x47260e['query']=_['keys'](_0xe380c6[_0x0825('0x2f')]);_0x47260e[_0x0825('0x39')]=_[_0x0825('0x31')](_0x47260e[_0x0825('0x2d')],_0x47260e[_0x0825('0x2f')]);_0x178a69['attributes']=_['intersection'](_0x47260e[_0x0825('0x2d')],qs[_0x0825('0x45')](_0xe380c6['query'][_0x0825('0x45')]));_0x178a69[_0x0825('0x32')]=_0x178a69['attributes'][_0x0825('0x46')]?_0x178a69[_0x0825('0x32')]:_0x47260e[_0x0825('0x2d')];_0x178a69[_0x0825('0x56')]=qs[_0x0825('0x36')](_0xe380c6['query'][_0x0825('0x36')]);_0x178a69[_0x0825('0x37')]=qs[_0x0825('0x39')](_[_0x0825('0x38')](_0xe380c6[_0x0825('0x2f')],_0x47260e['filters']));if(_0xe380c6[_0x0825('0x2f')][_0x0825('0x3a')]){_0x178a69[_0x0825('0x37')]=_[_0x0825('0x3b')](_0x178a69['where'],{'$or':_[_0x0825('0x2e')](_0x178a69[_0x0825('0x32')],function(_0x411d1c){var _0x47e24b={};_0x47e24b[_0x411d1c]={'$like':'%'+_0xe380c6['query']['filter']+'%'};return _0x47e24b;})});}_0x178a69=_[_0x0825('0x3b')]({},_0x178a69,_0xe380c6[_0x0825('0x3d')]);return _0x1bb4a2[_0x0825('0x85')](_0x178a69);}})[_0x0825('0x24')](function(_0xc4dae5){if(_0xc4dae5){_0x1ff15c=_0xc4dae5[_0x0825('0x46')];if(!_0xe380c6['query'][_0x0825('0x33')](_0x0825('0x34'))){_0x178a69[_0x0825('0x35')]=qs[_0x0825('0x35')](_0xe380c6[_0x0825('0x2f')]['limit']);_0x178a69[_0x0825('0x1c')]=qs[_0x0825('0x1c')](_0xe380c6[_0x0825('0x2f')][_0x0825('0x1c')]);}return _0x1bb4a2['getAgents'](_0x178a69);}})[_0x0825('0x24')](function(_0x39b8a6){if(_0x39b8a6){return _0x39b8a6?{'count':_0x1ff15c,'rows':_0x39b8a6}:null;}})[_0x0825('0x24')](respondWithResult(_0x4990f1,null))[_0x0825('0x42')](handleError(_0x4990f1,null));}; \ No newline at end of file +var _0x9ffc=['getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','ids','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','emit','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','register','sendStatus','end','status','json','count','offset','set','reject','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','key','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe'];(function(_0x268f21,_0x211a4b){var _0x28a293=function(_0x1ea9ff){while(--_0x1ea9ff){_0x268f21['push'](_0x268f21['shift']());}};_0x28a293(++_0x211a4b);}(_0x9ffc,0xc0));var _0xc9ff=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x9ffc[_0x16771d];return _0x386f11;};'use strict';var pdf=require(_0xc9ff('0x0'));var emlformat=require(_0xc9ff('0x1'));var rimraf=require(_0xc9ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9ff('0x3'));var rp=require(_0xc9ff('0x4'));var moment=require(_0xc9ff('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc9ff('0x6'));var path=require(_0xc9ff('0x7'));var sox=require(_0xc9ff('0x8'));var csv=require(_0xc9ff('0x9'));var ejs=require(_0xc9ff('0xa'));var fs=require('fs');var _=require(_0xc9ff('0xb'));var squel=require(_0xc9ff('0xc'));var crypto=require(_0xc9ff('0xd'));var jsforce=require(_0xc9ff('0xe'));var deskjs=require(_0xc9ff('0xf'));var toCsv=require(_0xc9ff('0x9'));var querystring=require(_0xc9ff('0x10'));var Papa=require(_0xc9ff('0x11'));var Redis=require(_0xc9ff('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc9ff('0x13'));var as=require(_0xc9ff('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9ff('0x15'))(_0xc9ff('0x16'));var utils=require(_0xc9ff('0x17'));var config=require(_0xc9ff('0x18'));var db=require('../../mysqldb')['db'];config[_0xc9ff('0x19')]=_['defaults'](config[_0xc9ff('0x19')],{'host':_0xc9ff('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc9ff('0x19')]));require('./openchannelQueue.socket')[_0xc9ff('0x1b')](socket);function respondWithStatusCode(_0x41a93e,_0x4b9701){_0x4b9701=_0x4b9701||0xcc;return function(_0x4f8b90){if(_0x4f8b90){return _0x41a93e[_0xc9ff('0x1c')](_0x4b9701);}return _0x41a93e['status'](_0x4b9701)[_0xc9ff('0x1d')]();};}function respondWithResult(_0x258eb5,_0x57eca7){_0x57eca7=_0x57eca7||0xc8;return function(_0x5f0d03){if(_0x5f0d03){return _0x258eb5[_0xc9ff('0x1e')](_0x57eca7)[_0xc9ff('0x1f')](_0x5f0d03);}};}function respondWithFilteredResult(_0x21d7ce,_0x40cc66){return function(_0x36657b){if(_0x36657b){var _0x238f2e=_0x36657b[_0xc9ff('0x20')],_0x22085a=_0x40cc66['offset'],_0x48f8cc=_0x40cc66[_0xc9ff('0x21')]+_0x40cc66['limit'],_0x1f452d;if(_0x48f8cc>=_0x238f2e){_0x48f8cc=_0x238f2e;_0x1f452d=0xc8;}else{_0x1f452d=0xce;}_0x21d7ce[_0xc9ff('0x1e')](_0x1f452d);return _0x21d7ce[_0xc9ff('0x22')]('Content-Range',_0x22085a+'-'+_0x48f8cc+'/'+_0x238f2e)[_0xc9ff('0x1f')](_0x36657b);}return null;};}function patchUpdates(_0x1b3c94){return function(_0xc997a6){try{jsonpatch['apply'](_0xc997a6,_0x1b3c94,!![]);}catch(_0x1f7fc0){return BPromise[_0xc9ff('0x23')](_0x1f7fc0);}return _0xc997a6['save']();};}function saveUpdates(_0x5c038e,_0x104b8c){return function(_0x42fddf){if(_0x42fddf){return _0x42fddf[_0xc9ff('0x24')](_0x5c038e)[_0xc9ff('0x25')](function(_0x2a9e1a){return _0x2a9e1a;});}return null;};}function removeEntity(_0x1a182f,_0x486dd1){return function(_0x48f0db){if(_0x48f0db){return _0x48f0db[_0xc9ff('0x26')]()[_0xc9ff('0x25')](function(){var _0x4dfc5d=_0x48f0db[_0xc9ff('0x27')]({'plain':!![]});var _0x1b2d3c=_0xc9ff('0x28');return db[_0xc9ff('0x29')][_0xc9ff('0x26')]({'where':{'type':_0x1b2d3c,'resourceId':_0x4dfc5d['id']}})[_0xc9ff('0x25')](function(){return _0x48f0db;});})[_0xc9ff('0x25')](function(){_0x1a182f['status'](0xcc)[_0xc9ff('0x1d')]();});}};}function handleEntityNotFound(_0x1f89b6,_0x1bc3d2){return function(_0x50dd59){if(!_0x50dd59){_0x1f89b6['sendStatus'](0x194);}return _0x50dd59;};}function handleError(_0x493fcf,_0x3a7a28){_0x3a7a28=_0x3a7a28||0x1f4;return function(_0x494b65){logger[_0xc9ff('0x2a')](_0x494b65[_0xc9ff('0x2b')]);if(_0x494b65[_0xc9ff('0x2c')]){delete _0x494b65[_0xc9ff('0x2c')];}_0x493fcf[_0xc9ff('0x1e')](_0x3a7a28)['send'](_0x494b65);};}exports[_0xc9ff('0x2d')]=function(_0x97ebf3,_0x534df0){var _0x41f653={},_0x588796={},_0x412233={'count':0x0,'rows':[]};var _0x29d885=_[_0xc9ff('0x2e')](db[_0xc9ff('0x2f')][_0xc9ff('0x30')],function(_0x555874){return{'name':_0x555874[_0xc9ff('0x31')],'type':_0x555874['type'][_0xc9ff('0x32')]};});_0x588796['model']=_['map'](_0x29d885,_0xc9ff('0x2c'));_0x588796['query']=_[_0xc9ff('0x33')](_0x97ebf3[_0xc9ff('0x34')]);_0x588796['filters']=_[_0xc9ff('0x35')](_0x588796['model'],_0x588796[_0xc9ff('0x34')]);_0x41f653[_0xc9ff('0x36')]=_['intersection'](_0x588796[_0xc9ff('0x37')],qs['fields'](_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x38')]));_0x41f653[_0xc9ff('0x36')]=_0x41f653[_0xc9ff('0x36')]['length']?_0x41f653[_0xc9ff('0x36')]:_0x588796[_0xc9ff('0x37')];if(!_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x39')](_0xc9ff('0x3a'))){_0x41f653[_0xc9ff('0x3b')]=qs['limit'](_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x3b')]);_0x41f653[_0xc9ff('0x21')]=qs[_0xc9ff('0x21')](_0x97ebf3[_0xc9ff('0x34')]['offset']);}_0x41f653[_0xc9ff('0x3c')]=qs[_0xc9ff('0x3d')](_0x97ebf3['query'][_0xc9ff('0x3d')]);_0x41f653[_0xc9ff('0x3e')]=qs[_0xc9ff('0x3f')](_[_0xc9ff('0x40')](_0x97ebf3[_0xc9ff('0x34')],_0x588796['filters']),_0x29d885);if(_0x97ebf3[_0xc9ff('0x34')]['filter']){_0x41f653[_0xc9ff('0x3e')]=_[_0xc9ff('0x41')](_0x41f653['where'],{'$or':_[_0xc9ff('0x2e')](_0x29d885,function(_0x23f4c4){if(_0x23f4c4[_0xc9ff('0x42')]!==_0xc9ff('0x43')){var _0x348319={};_0x348319[_0x23f4c4[_0xc9ff('0x2c')]]={'$like':'%'+_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x44')]+'%'};return _0x348319;}})});}_0x41f653=_['merge']({},_0x41f653,_0x97ebf3[_0xc9ff('0x45')]);var _0x37bc6d={'where':_0x41f653[_0xc9ff('0x3e')]};return db['OpenchannelQueue'][_0xc9ff('0x20')](_0x37bc6d)['then'](function(_0x579f34){_0x412233[_0xc9ff('0x20')]=_0x579f34;if(_0x97ebf3[_0xc9ff('0x34')][_0xc9ff('0x46')]){_0x41f653['include']=[{'all':!![]}];}return db[_0xc9ff('0x2f')][_0xc9ff('0x47')](_0x41f653);})['then'](function(_0x41666d){_0x412233[_0xc9ff('0x48')]=_0x41666d;return _0x412233;})['then'](respondWithFilteredResult(_0x534df0,_0x41f653))['catch'](handleError(_0x534df0,null));};exports[_0xc9ff('0x49')]=function(_0x47239c,_0x316169){var _0x5811b5={'raw':!![],'where':{'id':_0x47239c[_0xc9ff('0x4a')]['id']}},_0x5a21a8={};_0x5a21a8[_0xc9ff('0x37')]=_[_0xc9ff('0x33')](db['OpenchannelQueue'][_0xc9ff('0x30')]);_0x5a21a8[_0xc9ff('0x34')]=_['keys'](_0x47239c[_0xc9ff('0x34')]);_0x5a21a8[_0xc9ff('0x3f')]=_[_0xc9ff('0x35')](_0x5a21a8[_0xc9ff('0x37')],_0x5a21a8[_0xc9ff('0x34')]);_0x5811b5['attributes']=_['intersection'](_0x5a21a8[_0xc9ff('0x37')],qs[_0xc9ff('0x38')](_0x47239c['query']['fields']));_0x5811b5['attributes']=_0x5811b5['attributes'][_0xc9ff('0x4b')]?_0x5811b5[_0xc9ff('0x36')]:_0x5a21a8[_0xc9ff('0x37')];if(_0x47239c[_0xc9ff('0x34')]['includeAll']){_0x5811b5['include']=[{'all':!![]}];}_0x5811b5=_[_0xc9ff('0x41')]({},_0x5811b5,_0x47239c['options']);return db[_0xc9ff('0x2f')][_0xc9ff('0x4c')](_0x5811b5)[_0xc9ff('0x25')](handleEntityNotFound(_0x316169,null))[_0xc9ff('0x25')](respondWithResult(_0x316169,null))[_0xc9ff('0x4d')](handleError(_0x316169,null));};exports['create']=function(_0x284626,_0x5add17){return db[_0xc9ff('0x2f')]['create'](_0x284626[_0xc9ff('0x4e')],{})['then'](function(_0x23e18d){var _0x530b10=_0x284626[_0xc9ff('0x4f')][_0xc9ff('0x27')]({'plain':!![]});if(!_0x530b10)throw new Error(_0xc9ff('0x50'));if(_0x530b10['role']==='user'){var _0x563b4d=_0x23e18d['get']({'plain':!![]});var _0x2bc116=_0xc9ff('0x28');return db[_0xc9ff('0x51')]['find']({'where':{'name':_0x2bc116,'userProfileId':_0x530b10[_0xc9ff('0x52')]},'raw':!![]})[_0xc9ff('0x25')](function(_0x12ca0f){if(_0x12ca0f&&_0x12ca0f['autoAssociation']===0x0){return db['UserProfileResource'][_0xc9ff('0x53')]({'name':_0x563b4d[_0xc9ff('0x2c')],'resourceId':_0x563b4d['id'],'type':_0x12ca0f[_0xc9ff('0x2c')],'sectionId':_0x12ca0f['id']},{})['then'](function(){return _0x23e18d;});}else{return _0x23e18d;}})[_0xc9ff('0x4d')](function(_0x7a0901){logger[_0xc9ff('0x2a')](_0xc9ff('0x54'),_0x7a0901);throw _0x7a0901;});}return _0x23e18d;})['then'](respondWithResult(_0x5add17,0xc9))[_0xc9ff('0x4d')](handleError(_0x5add17,null));};exports[_0xc9ff('0x24')]=function(_0x2a7f4d,_0x57d5da){if(_0x2a7f4d['body']['id']){delete _0x2a7f4d[_0xc9ff('0x4e')]['id'];}return db[_0xc9ff('0x2f')]['find']({'where':{'id':_0x2a7f4d[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x57d5da,null))[_0xc9ff('0x25')](saveUpdates(_0x2a7f4d[_0xc9ff('0x4e')],null))[_0xc9ff('0x25')](respondWithResult(_0x57d5da,null))[_0xc9ff('0x4d')](handleError(_0x57d5da,null));};exports[_0xc9ff('0x26')]=function(_0x2e55ef,_0x470089){return db[_0xc9ff('0x2f')]['find']({'where':{'id':_0x2e55ef[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x470089,null))['then'](removeEntity(_0x470089,null))[_0xc9ff('0x4d')](handleError(_0x470089,null));};exports[_0xc9ff('0x55')]=function(_0x4a1476,_0x2babc2){return db[_0xc9ff('0x2f')]['describe']()[_0xc9ff('0x25')](respondWithResult(_0x2babc2,null))[_0xc9ff('0x4d')](handleError(_0x2babc2,null));};exports[_0xc9ff('0x56')]=function(_0x2b9590,_0x3b2ba5,_0x36ac80){var _0x229d13={'raw':!![],'where':{}},_0x57a531={},_0x4e7fdb;return db['OpenchannelQueue'][_0xc9ff('0x57')]({'where':{'id':_0x2b9590[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x3b2ba5,null))['then'](function(_0x4d5a27){if(_0x4d5a27){_0x4e7fdb=_0x4d5a27[_0xc9ff('0x27')]({'plain':!![]});_0x57a531[_0xc9ff('0x37')]=_[_0xc9ff('0x33')](db[_0xc9ff('0x58')][_0xc9ff('0x30')]);_0x57a531[_0xc9ff('0x34')]=_[_0xc9ff('0x33')](_0x2b9590['query']);_0x57a531[_0xc9ff('0x3f')]=_[_0xc9ff('0x35')](_0x57a531['model'],_0x57a531[_0xc9ff('0x34')]);_0x229d13[_0xc9ff('0x36')]=_['intersection'](_0x57a531[_0xc9ff('0x37')],qs['fields'](_0x2b9590[_0xc9ff('0x34')]['fields']));_0x229d13[_0xc9ff('0x36')]=_0x229d13[_0xc9ff('0x36')]['length']?_0x229d13[_0xc9ff('0x36')]:_0x57a531[_0xc9ff('0x37')];if(!_0x2b9590[_0xc9ff('0x34')][_0xc9ff('0x39')](_0xc9ff('0x3a'))){_0x229d13[_0xc9ff('0x3b')]=qs[_0xc9ff('0x3b')](_0x2b9590[_0xc9ff('0x34')][_0xc9ff('0x3b')]);_0x229d13['offset']=qs['offset'](_0x2b9590[_0xc9ff('0x34')][_0xc9ff('0x21')]);}_0x229d13['order']=qs[_0xc9ff('0x3d')](_0x2b9590['query']['sort']);_0x229d13[_0xc9ff('0x3e')]=qs[_0xc9ff('0x3f')](_['pick'](_0x2b9590[_0xc9ff('0x34')],_0x57a531[_0xc9ff('0x3f')]));_0x229d13['where'][_0xc9ff('0x59')]=_0x4d5a27['id'];if(_0x2b9590[_0xc9ff('0x34')]['filter']){_0x229d13[_0xc9ff('0x3e')]=_[_0xc9ff('0x41')](_0x229d13[_0xc9ff('0x3e')],{'$or':_['map'](_0x229d13[_0xc9ff('0x36')],function(_0x42219c){var _0x2dc011={};_0x2dc011[_0x42219c]={'$like':'%'+_0x2b9590['query'][_0xc9ff('0x44')]+'%'};return _0x2dc011;})});}_0x229d13=_[_0xc9ff('0x41')]({},_0x229d13,_0x2b9590[_0xc9ff('0x45')]);return db[_0xc9ff('0x58')][_0xc9ff('0x47')](_0x229d13);}})[_0xc9ff('0x25')](function(_0x262f15){if(_0x262f15){return db[_0xc9ff('0x5a')][_0xc9ff('0x5b')]({'where':{'id':_[_0xc9ff('0x2e')](_0x262f15,_0xc9ff('0x5c')),'role':_0xc9ff('0x5d')},'attributes':['id','name',_0xc9ff('0x5e'),_0xc9ff('0x5f'),_0xc9ff('0x60')]});}})[_0xc9ff('0x25')](function(_0x6fc85f){if(_0x6fc85f){return{'count':_0x6fc85f[_0xc9ff('0x20')],'rows':_[_0xc9ff('0x2e')](_0x6fc85f[_0xc9ff('0x48')],function(_0x297af4){return{'membername':_0x297af4[_0xc9ff('0x2c')],'UserId':_0x297af4['id'],'queue_name':_0x4e7fdb[_0xc9ff('0x2c')],'OpenchannelQueueId':_0x4e7fdb['id'],'interface':util[_0xc9ff('0x61')]('%s/%s',_0xc9ff('0x62'),_0x297af4[_0xc9ff('0x2c')]),'penalty':0x0,'paused':_0x297af4[_0xc9ff('0x5e')],'createdAt':_0x297af4['createdAt'],'updatedAt':_0x297af4[_0xc9ff('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc9ff('0x25')](respondWithFilteredResult(_0x3b2ba5,_0x229d13))[_0xc9ff('0x4d')](handleError(_0x3b2ba5,null));};exports[_0xc9ff('0x63')]=function(_0xe4b2f4,_0xe96427,_0x2257e5){var _0x488ef1={};var _0x5d842f={};var _0x31fdcf;var _0x102442;return db[_0xc9ff('0x2f')]['findOne']({'where':{'id':_0xe4b2f4[_0xc9ff('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe96427,null))[_0xc9ff('0x25')](function(_0x2a47e7){if(_0x2a47e7){_0x31fdcf=_0x2a47e7;_0x5d842f[_0xc9ff('0x37')]=_[_0xc9ff('0x33')](db[_0xc9ff('0x64')][_0xc9ff('0x30')]);_0x5d842f['query']=_[_0xc9ff('0x33')](_0xe4b2f4[_0xc9ff('0x34')]);_0x5d842f['filters']=_[_0xc9ff('0x35')](_0x5d842f[_0xc9ff('0x37')],_0x5d842f[_0xc9ff('0x34')]);_0x488ef1['attributes']=_[_0xc9ff('0x35')](_0x5d842f['model'],qs[_0xc9ff('0x38')](_0xe4b2f4[_0xc9ff('0x34')]['fields']));_0x488ef1[_0xc9ff('0x36')]=_0x488ef1[_0xc9ff('0x36')][_0xc9ff('0x4b')]?_0x488ef1['attributes']:_0x5d842f[_0xc9ff('0x37')];_0x488ef1[_0xc9ff('0x3c')]=qs[_0xc9ff('0x3d')](_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x3d')]);_0x488ef1['where']=qs[_0xc9ff('0x3f')](_[_0xc9ff('0x40')](_0xe4b2f4['query'],_0x5d842f['filters']));if(_0xe4b2f4['query'][_0xc9ff('0x44')]){_0x488ef1['where']=_[_0xc9ff('0x41')](_0x488ef1[_0xc9ff('0x3e')],{'$or':_[_0xc9ff('0x2e')](_0x488ef1[_0xc9ff('0x36')],function(_0x524b80){var _0x327677={};_0x327677[_0x524b80]={'$like':'%'+_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x44')]+'%'};return _0x327677;})});}_0x488ef1=_[_0xc9ff('0x41')]({},_0x488ef1,_0xe4b2f4['options']);return _0x31fdcf[_0xc9ff('0x63')](_0x488ef1);}})['then'](function(_0x4dcd9a){if(_0x4dcd9a){_0x102442=_0x4dcd9a[_0xc9ff('0x4b')];if(!_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x39')]('nolimit')){_0x488ef1[_0xc9ff('0x3b')]=qs[_0xc9ff('0x3b')](_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x3b')]);_0x488ef1[_0xc9ff('0x21')]=qs[_0xc9ff('0x21')](_0xe4b2f4[_0xc9ff('0x34')][_0xc9ff('0x21')]);}return _0x31fdcf[_0xc9ff('0x63')](_0x488ef1);}})[_0xc9ff('0x25')](function(_0x5b7613){if(_0x5b7613){return _0x5b7613?{'count':_0x102442,'rows':_0x5b7613}:null;}})[_0xc9ff('0x25')](respondWithResult(_0xe96427,null))['catch'](handleError(_0xe96427,null));};exports[_0xc9ff('0x65')]=function(_0x9249f2,_0xddf3b,_0x21a720){var _0x52df33=_0x9249f2[_0xc9ff('0x4e')]['ids'];return db[_0xc9ff('0x64')][_0xc9ff('0x47')]({'where':{'id':_0x52df33},'attributes':['id'],'include':[{'model':db[_0xc9ff('0x5a')],'as':_0xc9ff('0x66'),'attributes':['id',_0xc9ff('0x2c'),'online',_0xc9ff('0x67'),_0xc9ff('0x68')],'raw':!![]}]})[_0xc9ff('0x25')](function(_0x2ce7ff){if(_0x2ce7ff){var _0x4b4e21=_['flatMap'](_0x2ce7ff,function(_0x3a7e70){var _0x1b6360=_0x3a7e70[_0xc9ff('0x27')]({'plain':!![]});return _0x1b6360[_0xc9ff('0x66')];});return db[_0xc9ff('0x2f')][_0xc9ff('0x4c')]({'where':{'id':_0x9249f2['params']['id']}})[_0xc9ff('0x25')](function(_0x2f76f2){return db[_0xc9ff('0x69')][_0xc9ff('0x6a')](function(_0x26a37e){return _0x2f76f2[_0xc9ff('0x65')](_0x52df33,{'transaction':_0x26a37e})[_0xc9ff('0x25')](function(){return BPromise[_0xc9ff('0x6b')](_0x4b4e21,function(_0xe4baea){return db[_0xc9ff('0x58')][_0xc9ff('0x6c')]({'where':{'UserId':_0xe4baea['id'],'OpenchannelQueueId':_0x9249f2[_0xc9ff('0x4a')]['id']},'transaction':_0x26a37e});});})[_0xc9ff('0x25')](function(){_0x4b4e21[_0xc9ff('0x6d')](function(_0x23776e){socket['emit'](_0xc9ff('0x6e'),{'UserId':_0x23776e['id'],'OpenchannelQueueId':_0x2f76f2['id']});});});});});}})[_0xc9ff('0x25')](respondWithStatusCode(_0xddf3b,null))[_0xc9ff('0x4d')](handleError(_0xddf3b,null));};exports[_0xc9ff('0x6f')]=function(_0x2871df,_0x32fda1,_0x1d8013){return db[_0xc9ff('0x64')]['findAll']({'where':{'id':_0x2871df['query'][_0xc9ff('0x70')]},'attributes':['id'],'include':[{'model':db[_0xc9ff('0x5a')],'as':_0xc9ff('0x66'),'attributes':['id'],'raw':!![]}]})[_0xc9ff('0x25')](handleEntityNotFound(_0x32fda1,null))[_0xc9ff('0x25')](function(_0x569c48){var _0x47a5de=_[_0xc9ff('0x2e')](_0x569c48,'id');var _0x461790=[];var _0x1126c2=[];var _0x3c5779=squel[_0xc9ff('0x71')]();_0x3c5779[_0xc9ff('0x72')]('tq.TeamId')[_0xc9ff('0x73')](_0xc9ff('0x74'),'tq')[_0xc9ff('0x75')](_0xc9ff('0x76'),'ut',_0xc9ff('0x77'))[_0xc9ff('0x3e')](_0xc9ff('0x78'),_0x2871df['params']['id']);for(var _0x1b2ccf=0x0;_0x1b2ccf<_0x569c48[_0xc9ff('0x4b')];_0x1b2ccf+=0x1){let _0x59ba94=_0x569c48[_0x1b2ccf];for(var _0x204b20=0x0;_0x204b20<_0x59ba94[_0xc9ff('0x66')][_0xc9ff('0x4b')];_0x204b20+=0x1){let _0x45edb1=_0x59ba94[_0xc9ff('0x66')][_0x204b20];var _0x4690d1=_0x3c5779[_0xc9ff('0x79')]();_0x4690d1[_0xc9ff('0x3e')]('ut.UserId\x20=\x20?',_0x45edb1['id']);_0x1126c2['push'](db['sequelize'][_0xc9ff('0x34')](_0x4690d1[_0xc9ff('0x7a')](),{'type':db[_0xc9ff('0x69')][_0xc9ff('0x7b')][_0xc9ff('0x7c')]})['then'](function(_0x43d3e6){if(_0x43d3e6['length']===0x1){return _0x45edb1['id'];}else{var _0x2d49f3=_[_0xc9ff('0x7d')](_[_0xc9ff('0x2e')](_0x43d3e6,_0xc9ff('0x7e')),function(_0x24f55d){return _['includes'](_0x47a5de,_0x24f55d);});if(_0x2d49f3){return _0x45edb1['id'];}}}));}}return BPromise[_0xc9ff('0x7f')](_0x1126c2)[_0xc9ff('0x25')](function(_0x587379){_0x461790=_(_0x461790)[_0xc9ff('0x80')](_0x587379)[_0xc9ff('0x81')]()['value']();return db[_0xc9ff('0x2f')][_0xc9ff('0x4c')]({'where':{'id':_0x2871df[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](function(_0x49db39){return db[_0xc9ff('0x69')][_0xc9ff('0x6a')](function(_0x2397d0){return _0x49db39[_0xc9ff('0x6f')](_0x2871df[_0xc9ff('0x34')]['ids'],{'transaction':_0x2397d0})[_0xc9ff('0x25')](function(){if(!_[_0xc9ff('0x82')](_0x461790)){return _0x49db39['removeAgents'](_0x461790,{'transaction':_0x2397d0});}})[_0xc9ff('0x25')](function(){_0x461790[_0xc9ff('0x6d')](function(_0x362269){socket[_0xc9ff('0x83')](_0xc9ff('0x84'),{'UserId':_0x362269,'OpenchannelQueueId':_0x49db39['id']});});});});});});})['then'](respondWithStatusCode(_0x32fda1,null))[_0xc9ff('0x4d')](handleError(_0x32fda1,null));};exports[_0xc9ff('0x85')]=function(_0x4a4e41,_0x4d5aba,_0x3e2580){return db[_0xc9ff('0x2f')][_0xc9ff('0x4c')]({'where':{'id':_0x4a4e41['params']['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x4d5aba,null))['then'](function(_0x312ff4){if(_0x312ff4){return _0x312ff4[_0xc9ff('0x85')](_0x4a4e41[_0xc9ff('0x4e')][_0xc9ff('0x70')],_[_0xc9ff('0x86')](_0x4a4e41[_0xc9ff('0x4e')],[_0xc9ff('0x70'),'id'])||{})[_0xc9ff('0x87')](function(_0x22f797){for(var _0x26467a=0x0;_0x26467a<_0x4a4e41['body']['ids'][_0xc9ff('0x4b')];_0x26467a+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x4a4e41[_0xc9ff('0x4e')][_0xc9ff('0x70')][_0x26467a],'OpenchannelQueueId':_0x4a4e41[_0xc9ff('0x4a')]['id']});}return _0x22f797;});}})[_0xc9ff('0x25')](respondWithResult(_0x4d5aba,null))[_0xc9ff('0x4d')](handleError(_0x4d5aba,null));};exports[_0xc9ff('0x88')]=function(_0x277caa,_0x131737,_0x1928d4){return db['OpenchannelQueue'][_0xc9ff('0x4c')]({'where':{'id':_0x277caa[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x131737,null))[_0xc9ff('0x25')](function(_0x26a7c0){if(_0x26a7c0){return _0x26a7c0['removeAgents'](_0x277caa[_0xc9ff('0x34')][_0xc9ff('0x70')])['then'](function(){if(_[_0xc9ff('0x89')](_0x277caa[_0xc9ff('0x34')]['ids'])){for(var _0xff3a18=0x0;_0xff3a18<_0x277caa[_0xc9ff('0x34')]['ids'][_0xc9ff('0x4b')];_0xff3a18+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x277caa[_0xc9ff('0x34')]['ids'][_0xff3a18]),'OpenchannelQueueId':Number(_0x277caa[_0xc9ff('0x4a')]['id'])});}}else{socket[_0xc9ff('0x83')](_0xc9ff('0x84'),{'UserId':Number(_0x277caa['query']['ids']),'OpenchannelQueueId':Number(_0x277caa['params']['id'])});}});}})[_0xc9ff('0x25')](respondWithStatusCode(_0x131737,null))[_0xc9ff('0x4d')](handleError(_0x131737,null));};exports[_0xc9ff('0x8a')]=function(_0x3f0249,_0x5d5976,_0x356faa){var _0x10e423={};var _0x4b7270={};var _0x22c53b;var _0x15f8ef;return db[_0xc9ff('0x2f')]['findOne']({'where':{'id':_0x3f0249[_0xc9ff('0x4a')]['id']}})[_0xc9ff('0x25')](handleEntityNotFound(_0x5d5976,null))['then'](function(_0x2bd7e7){if(_0x2bd7e7){_0x22c53b=_0x2bd7e7;_0x4b7270[_0xc9ff('0x37')]=_[_0xc9ff('0x33')](db[_0xc9ff('0x5a')][_0xc9ff('0x30')]);_0x4b7270[_0xc9ff('0x34')]=_[_0xc9ff('0x33')](_0x3f0249['query']);_0x4b7270[_0xc9ff('0x3f')]=_[_0xc9ff('0x35')](_0x4b7270['model'],_0x4b7270[_0xc9ff('0x34')]);_0x10e423[_0xc9ff('0x36')]=_[_0xc9ff('0x35')](_0x4b7270['model'],qs['fields'](_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x38')]));_0x10e423['attributes']=_0x10e423[_0xc9ff('0x36')][_0xc9ff('0x4b')]?_0x10e423[_0xc9ff('0x36')]:_0x4b7270[_0xc9ff('0x37')];_0x10e423['order']=qs[_0xc9ff('0x3d')](_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x3d')]);_0x10e423['where']=qs[_0xc9ff('0x3f')](_['pick'](_0x3f0249['query'],_0x4b7270[_0xc9ff('0x3f')]));if(_0x3f0249['query']['filter']){_0x10e423[_0xc9ff('0x3e')]=_[_0xc9ff('0x41')](_0x10e423[_0xc9ff('0x3e')],{'$or':_[_0xc9ff('0x2e')](_0x10e423['attributes'],function(_0x564fed){var _0x1e66aa={};_0x1e66aa[_0x564fed]={'$like':'%'+_0x3f0249[_0xc9ff('0x34')]['filter']+'%'};return _0x1e66aa;})});}_0x10e423=_['merge']({},_0x10e423,_0x3f0249[_0xc9ff('0x45')]);return _0x22c53b[_0xc9ff('0x8a')](_0x10e423);}})[_0xc9ff('0x25')](function(_0x499217){if(_0x499217){_0x15f8ef=_0x499217['length'];if(!_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x39')](_0xc9ff('0x3a'))){_0x10e423['limit']=qs['limit'](_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x3b')]);_0x10e423[_0xc9ff('0x21')]=qs['offset'](_0x3f0249[_0xc9ff('0x34')][_0xc9ff('0x21')]);}return _0x22c53b[_0xc9ff('0x8a')](_0x10e423);}})[_0xc9ff('0x25')](function(_0x31a050){if(_0x31a050){return _0x31a050?{'count':_0x15f8ef,'rows':_0x31a050}:null;}})['then'](respondWithResult(_0x5d5976,null))[_0xc9ff('0x4d')](handleError(_0x5d5976,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index da72ae4..cccbe6b 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 _0x74f6=['OpenchannelQueue','save','update','remove','emit','hook','../../mysqldb'];(function(_0x19cbcc,_0x44384e){var _0x44d405=function(_0x475354){while(--_0x475354){_0x19cbcc['push'](_0x19cbcc['shift']());}};_0x44d405(++_0x44384e);}(_0x74f6,0x102));var _0x674f=function(_0x8a8e00,_0x5daa2d){_0x8a8e00=_0x8a8e00-0x0;var _0x888bdd=_0x74f6[_0x8a8e00];return _0x888bdd;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x674f('0x0'))['db'][_0x674f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x674f('0x2'),'afterUpdate':_0x674f('0x3'),'afterDestroy':_0x674f('0x4')};function emitEvent(_0x313b7f){return function(_0x7efb51,_0x3f860d,_0x2d70f0){OpenchannelQueueEvents[_0x674f('0x5')](_0x313b7f+':'+_0x7efb51['id'],_0x7efb51);OpenchannelQueueEvents[_0x674f('0x5')](_0x313b7f,_0x7efb51);_0x2d70f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x674f('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x8575=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','remove'];(function(_0x5d2d9a,_0x28e9ee){var _0x3034da=function(_0x4bd362){while(--_0x4bd362){_0x5d2d9a['push'](_0x5d2d9a['shift']());}};_0x3034da(++_0x28e9ee);}(_0x8575,0x163));var _0x5857=function(_0x2c1bde,_0x318123){_0x2c1bde=_0x2c1bde-0x0;var _0x542efc=_0x8575[_0x2c1bde];return _0x542efc;};'use strict';var EventEmitter=require(_0x5857('0x0'));var OpenchannelQueue=require(_0x5857('0x1'))['db'][_0x5857('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5857('0x3'),'afterUpdate':'update','afterDestroy':_0x5857('0x4')};function emitEvent(_0x1c689b){return function(_0x4a8427,_0x3a93da,_0x26bd7a){OpenchannelQueueEvents[_0x5857('0x5')](_0x1c689b+':'+_0x4a8427['id'],_0x4a8427);OpenchannelQueueEvents[_0x5857('0x5')](_0x1c689b,_0x4a8427);_0x26bd7a(null);};}for(var e in events){if(events[_0x5857('0x6')](e)){var event=events[e];OpenchannelQueue[_0x5857('0x7')](e,emitEvent(event));}}module[_0x5857('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8af9942..8c18bac 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 _0x53ac=['moment','bluebird','path','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','util','../../config/logger','api'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x53ac,0x16f));var _0xc53a=function(_0x10e0c7,_0x2c288b){_0x10e0c7=_0x10e0c7-0x0;var _0x5e8083=_0x53ac[_0x10e0c7];return _0x5e8083;};'use strict';var _=require('lodash');var util=require(_0xc53a('0x0'));var logger=require(_0xc53a('0x1'))(_0xc53a('0x2'));var moment=require(_0xc53a('0x3'));var BPromise=require(_0xc53a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53a('0x5'));var rimraf=require('rimraf');var config=require(_0xc53a('0x6'));var attributes=require(_0xc53a('0x7'));module['exports']=function(_0x49f1e0,_0x57d3af){return _0x49f1e0[_0xc53a('0x8')](_0xc53a('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cfd=['OpenchannelQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./openchannelQueue.attributes','exports','define'];(function(_0x38c676,_0x54dd03){var _0x51e800=function(_0x314415){while(--_0x314415){_0x38c676['push'](_0x38c676['shift']());}};_0x51e800(++_0x54dd03);}(_0x5cfd,0x1a3));var _0xd5cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5cfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5cf('0x0'));var util=require(_0xd5cf('0x1'));var logger=require(_0xd5cf('0x2'))(_0xd5cf('0x3'));var moment=require(_0xd5cf('0x4'));var BPromise=require(_0xd5cf('0x5'));var rp=require(_0xd5cf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd5cf('0x7'));module[_0xd5cf('0x8')]=function(_0x3484f5,_0x1f29b2){return _0x3484f5[_0xd5cf('0x9')](_0xd5cf('0xa'),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 7bf1016..f6c0216 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 _0x3ea7=['jayson/promise','client','redis','defaults','localhost','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','find','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x3ea7,0x1cd));var _0x73ea=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0x3ea7[_0x3f6e26];return _0x474345;};'use strict';var _=require(_0x73ea('0x0'));var util=require('util');var moment=require(_0x73ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x73ea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73ea('0x3'))['db'];var utils=require(_0x73ea('0x4'));var logger=require('../../config/logger')(_0x73ea('0x5'));var config=require(_0x73ea('0x6'));var jayson=require(_0x73ea('0x7'));var client=jayson[_0x73ea('0x8')]['http']({'port':0x232a});config[_0x73ea('0x9')]=_[_0x73ea('0xa')](config[_0x73ea('0x9')],{'host':_0x73ea('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73ea('0x9')]));require(_0x73ea('0xc'))[_0x73ea('0xd')](socket);function respondWithRpcPromise(_0x4aab60,_0xfd1e6,_0x3c49be){return new BPromise(function(_0x1977ff,_0x25be58){return client['request'](_0x4aab60,_0x3c49be)[_0x73ea('0xe')](function(_0x4f6243){logger[_0x73ea('0xf')](_0x73ea('0x10'),_0xfd1e6,_0x73ea('0x11'));logger[_0x73ea('0x12')](_0x73ea('0x13'),_0xfd1e6,_0x73ea('0x11'),JSON[_0x73ea('0x14')](_0x4f6243));if(_0x4f6243['error']){if(_0x4f6243[_0x73ea('0x15')][_0x73ea('0x16')]===0x1f4){logger['error'](_0x73ea('0x10'),_0xfd1e6,_0x4f6243[_0x73ea('0x15')][_0x73ea('0x17')]);return _0x25be58(_0x4f6243[_0x73ea('0x15')]['message']);}logger[_0x73ea('0x15')](_0x73ea('0x10'),_0xfd1e6,_0x4f6243[_0x73ea('0x15')][_0x73ea('0x17')]);return _0x1977ff(_0x4f6243[_0x73ea('0x15')][_0x73ea('0x17')]);}else{logger[_0x73ea('0xf')](_0x73ea('0x10'),_0xfd1e6,_0x73ea('0x11'));_0x1977ff(_0x4f6243['result'][_0x73ea('0x17')]);}})['catch'](function(_0x3ddd6b){logger[_0x73ea('0x15')](_0x73ea('0x10'),_0xfd1e6,_0x3ddd6b);_0x25be58(_0x3ddd6b);});});}exports[_0x73ea('0x18')]=function(_0xd5a98){var _0x1195ee=this;return new Promise(function(_0x1ced5a,_0x848244){return db[_0x73ea('0x19')]['findAll']({'raw':_0xd5a98[_0x73ea('0x1a')]?_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1b')]===undefined?!![]:![]:!![],'where':_0xd5a98[_0x73ea('0x1a')]?_0xd5a98[_0x73ea('0x1a')]['where']||null:null,'attributes':_0xd5a98['options']?_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1c')]||null:null,'limit':_0xd5a98[_0x73ea('0x1a')]?_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1d')]||null:null,'include':_0xd5a98[_0x73ea('0x1a')]?_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1e')]?_[_0x73ea('0x1f')](_0xd5a98[_0x73ea('0x1a')][_0x73ea('0x1e')],function(_0x5d4b06){return{'model':db[_0x5d4b06['model']],'as':_0x5d4b06['as'],'attributes':_0x5d4b06[_0x73ea('0x1c')],'include':_0x5d4b06[_0x73ea('0x1e')]?_[_0x73ea('0x1f')](_0x5d4b06[_0x73ea('0x1e')],function(_0x4f714f){return{'model':db[_0x4f714f[_0x73ea('0x20')]],'as':_0x4f714f['as'],'attributes':_0x4f714f[_0x73ea('0x1c')],'include':_0x4f714f['include']?_[_0x73ea('0x1f')](_0x4f714f[_0x73ea('0x1e')],function(_0x2107cc){return{'model':db[_0x2107cc[_0x73ea('0x20')]],'as':_0x2107cc['as'],'attributes':_0x2107cc[_0x73ea('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59e6af){logger[_0x73ea('0xf')](_0x73ea('0x18'),_0xd5a98);logger[_0x73ea('0x12')](_0x73ea('0x18'),_0xd5a98,JSON[_0x73ea('0x14')](_0x59e6af));_0x1ced5a(_0x59e6af);})['catch'](function(_0x60f27f){logger[_0x73ea('0x15')](_0x73ea('0x18'),_0x60f27f[_0x73ea('0x17')],_0xd5a98);_0x848244(_0x1195ee[_0x73ea('0x15')](0x1f4,_0x60f27f[_0x73ea('0x17')]));});});};exports[_0x73ea('0x21')]=function(_0x3aff8c){var _0x14ddca=this;return new Promise(function(_0x149df0,_0x2c7da1){return db[_0x73ea('0x19')][_0x73ea('0x22')]({'raw':_0x3aff8c[_0x73ea('0x1a')]?_0x3aff8c['options'][_0x73ea('0x1b')]===undefined?!![]:![]:!![],'where':_0x3aff8c[_0x73ea('0x1a')]?_0x3aff8c[_0x73ea('0x1a')]['where']||null:null,'attributes':_0x3aff8c['options']?_0x3aff8c[_0x73ea('0x1a')]['attributes']||null:null,'include':_0x3aff8c['options']?_0x3aff8c[_0x73ea('0x1a')][_0x73ea('0x1e')]?_[_0x73ea('0x1f')](_0x3aff8c['options'][_0x73ea('0x1e')],function(_0x5f4202){return{'model':db[_0x5f4202['model']],'as':_0x5f4202['as'],'attributes':_0x5f4202[_0x73ea('0x1c')],'include':_0x5f4202[_0x73ea('0x1e')]?_['map'](_0x5f4202['include'],function(_0x17848b){return{'model':db[_0x17848b[_0x73ea('0x20')]],'as':_0x17848b['as'],'attributes':_0x17848b['attributes'],'include':_0x17848b[_0x73ea('0x1e')]?_[_0x73ea('0x1f')](_0x17848b['include'],function(_0x427f3c){return{'model':db[_0x427f3c[_0x73ea('0x20')]],'as':_0x427f3c['as'],'attributes':_0x427f3c[_0x73ea('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x73ea('0xe')](function(_0x1bedb6){logger[_0x73ea('0xf')](_0x73ea('0x21'),_0x3aff8c);logger[_0x73ea('0x12')](_0x73ea('0x21'),_0x3aff8c,JSON[_0x73ea('0x14')](_0x1bedb6));_0x149df0(_0x1bedb6);})[_0x73ea('0x23')](function(_0x4ef4b7){logger[_0x73ea('0x15')](_0x73ea('0x21'),_0x4ef4b7[_0x73ea('0x17')],_0x3aff8c);_0x2c7da1(_0x14ddca[_0x73ea('0x15')](0x1f4,_0x4ef4b7[_0x73ea('0x17')]));});});}; \ No newline at end of file +var _0x744b=['info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./openchannelQueue.socket','request','then'];(function(_0x362020,_0x3e5804){var _0x13356c=function(_0x1e915f){while(--_0x1e915f){_0x362020['push'](_0x362020['shift']());}};_0x13356c(++_0x3e5804);}(_0x744b,0x160));var _0xb744=function(_0x21ce03,_0x1baada){_0x21ce03=_0x21ce03-0x0;var _0x184974=_0x744b[_0x21ce03];return _0x184974;};'use strict';var _=require(_0xb744('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb744('0x1'));var rs=require(_0xb744('0x2'));var fs=require('fs');var Redis=require(_0xb744('0x3'));var db=require(_0xb744('0x4'))['db'];var utils=require(_0xb744('0x5'));var logger=require(_0xb744('0x6'))(_0xb744('0x7'));var config=require(_0xb744('0x8'));var jayson=require(_0xb744('0x9'));var client=jayson[_0xb744('0xa')]['http']({'port':0x232a});config[_0xb744('0xb')]=_[_0xb744('0xc')](config[_0xb744('0xb')],{'host':_0xb744('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb744('0xb')]));require(_0xb744('0xe'))['register'](socket);function respondWithRpcPromise(_0x390fc0,_0x3c66dc,_0x1195ea){return new BPromise(function(_0x31fbcd,_0x46389c){return client[_0xb744('0xf')](_0x390fc0,_0x1195ea)[_0xb744('0x10')](function(_0x5c39d){logger[_0xb744('0x11')](_0xb744('0x12'),_0x3c66dc,_0xb744('0x13'));logger[_0xb744('0x14')](_0xb744('0x15'),_0x3c66dc,_0xb744('0x13'),JSON[_0xb744('0x16')](_0x5c39d));if(_0x5c39d['error']){if(_0x5c39d[_0xb744('0x17')][_0xb744('0x18')]===0x1f4){logger[_0xb744('0x17')](_0xb744('0x12'),_0x3c66dc,_0x5c39d[_0xb744('0x17')][_0xb744('0x19')]);return _0x46389c(_0x5c39d[_0xb744('0x17')]['message']);}logger[_0xb744('0x17')](_0xb744('0x12'),_0x3c66dc,_0x5c39d[_0xb744('0x17')][_0xb744('0x19')]);return _0x31fbcd(_0x5c39d[_0xb744('0x17')][_0xb744('0x19')]);}else{logger[_0xb744('0x11')](_0xb744('0x12'),_0x3c66dc,_0xb744('0x13'));_0x31fbcd(_0x5c39d[_0xb744('0x1a')]['message']);}})[_0xb744('0x1b')](function(_0x4ce4da){logger[_0xb744('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x3c66dc,_0x4ce4da);_0x46389c(_0x4ce4da);});});}exports['GetOpenchannelQueue']=function(_0x5da425){var _0x510d58=this;return new Promise(function(_0x26d215,_0x5e28e1){return db[_0xb744('0x1c')][_0xb744('0x1d')]({'raw':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x1f')]===undefined?!![]:![]:!![],'where':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x20')]||null:null,'attributes':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x21')]||null:null,'limit':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x22')]||null:null,'include':_0x5da425[_0xb744('0x1e')]?_0x5da425[_0xb744('0x1e')][_0xb744('0x23')]?_[_0xb744('0x24')](_0x5da425[_0xb744('0x1e')][_0xb744('0x23')],function(_0x1dfbb3){return{'model':db[_0x1dfbb3[_0xb744('0x25')]],'as':_0x1dfbb3['as'],'attributes':_0x1dfbb3[_0xb744('0x21')],'include':_0x1dfbb3[_0xb744('0x23')]?_[_0xb744('0x24')](_0x1dfbb3[_0xb744('0x23')],function(_0x1b344e){return{'model':db[_0x1b344e[_0xb744('0x25')]],'as':_0x1b344e['as'],'attributes':_0x1b344e[_0xb744('0x21')],'include':_0x1b344e[_0xb744('0x23')]?_[_0xb744('0x24')](_0x1b344e[_0xb744('0x23')],function(_0x138380){return{'model':db[_0x138380[_0xb744('0x25')]],'as':_0x138380['as'],'attributes':_0x138380[_0xb744('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb744('0x10')](function(_0x1d4c1d){logger['info'](_0xb744('0x26'),_0x5da425);logger['debug'](_0xb744('0x26'),_0x5da425,JSON[_0xb744('0x16')](_0x1d4c1d));_0x26d215(_0x1d4c1d);})[_0xb744('0x1b')](function(_0x16976d){logger[_0xb744('0x17')]('GetOpenchannelQueue',_0x16976d[_0xb744('0x19')],_0x5da425);_0x5e28e1(_0x510d58['error'](0x1f4,_0x16976d[_0xb744('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x24886f){var _0x548bc5=this;return new Promise(function(_0x185e84,_0x67e1a){return db[_0xb744('0x1c')][_0xb744('0x27')]({'raw':_0x24886f[_0xb744('0x1e')]?_0x24886f[_0xb744('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x24886f['options']?_0x24886f[_0xb744('0x1e')]['where']||null:null,'attributes':_0x24886f['options']?_0x24886f[_0xb744('0x1e')][_0xb744('0x21')]||null:null,'include':_0x24886f[_0xb744('0x1e')]?_0x24886f['options'][_0xb744('0x23')]?_['map'](_0x24886f['options']['include'],function(_0xa7557e){return{'model':db[_0xa7557e[_0xb744('0x25')]],'as':_0xa7557e['as'],'attributes':_0xa7557e['attributes'],'include':_0xa7557e[_0xb744('0x23')]?_[_0xb744('0x24')](_0xa7557e[_0xb744('0x23')],function(_0x225f95){return{'model':db[_0x225f95['model']],'as':_0x225f95['as'],'attributes':_0x225f95['attributes'],'include':_0x225f95['include']?_[_0xb744('0x24')](_0x225f95[_0xb744('0x23')],function(_0x1d0ca5){return{'model':db[_0x1d0ca5[_0xb744('0x25')]],'as':_0x1d0ca5['as'],'attributes':_0x1d0ca5[_0xb744('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb744('0x10')](function(_0x381e0f){logger['info']('ShowOpenchannelQueue',_0x24886f);logger[_0xb744('0x14')](_0xb744('0x28'),_0x24886f,JSON[_0xb744('0x16')](_0x381e0f));_0x185e84(_0x381e0f);})[_0xb744('0x1b')](function(_0x293d91){logger[_0xb744('0x17')](_0xb744('0x28'),_0x293d91['message'],_0x24886f);_0x67e1a(_0x548bc5['error'](0x1f4,_0x293d91['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6e10bb5..c89cdf6 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 _0xaab7=['save','remove','update','emit','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xaab7,0xd8));var _0x7aab=function(_0x39405d,_0x3aba83){_0x39405d=_0x39405d-0x0;var _0x104590=_0xaab7[_0x39405d];return _0x104590;};'use strict';var OpenchannelQueueEvents=require(_0x7aab('0x0'));var events=[_0x7aab('0x1'),_0x7aab('0x2'),_0x7aab('0x3')];function createListener(_0x2c1c19,_0x58a1bc){return function(_0x5ae5bf){_0x58a1bc[_0x7aab('0x4')](_0x2c1c19,_0x5ae5bf);};}function removeListener(_0x26787f,_0x5738f7){return function(){OpenchannelQueueEvents['removeListener'](_0x26787f,_0x5738f7);};}exports[_0x7aab('0x5')]=function(_0x508da8){for(var _0x32248f=0x0,_0x3d8d01=events['length'];_0x32248f<_0x3d8d01;_0x32248f++){var _0x2299c5=events[_0x32248f];var _0x72a360=createListener(_0x7aab('0x6')+_0x2299c5,_0x508da8);OpenchannelQueueEvents['on'](_0x2299c5,_0x72a360);}}; \ No newline at end of file +var _0x82c0=['openchannelQueue:','./openchannelQueue.events','update','emit','removeListener','length'];(function(_0x3b7fb7,_0x30abbb){var _0x34da82=function(_0x1177ae){while(--_0x1177ae){_0x3b7fb7['push'](_0x3b7fb7['shift']());}};_0x34da82(++_0x30abbb);}(_0x82c0,0x73));var _0x082c=function(_0x4dfd7e,_0x198f79){_0x4dfd7e=_0x4dfd7e-0x0;var _0x36556f=_0x82c0[_0x4dfd7e];return _0x36556f;};'use strict';var OpenchannelQueueEvents=require(_0x082c('0x0'));var events=['save','remove',_0x082c('0x1')];function createListener(_0x4c5740,_0x2a8170){return function(_0x30e08e){_0x2a8170[_0x082c('0x2')](_0x4c5740,_0x30e08e);};}function removeListener(_0x37cf56,_0x289f6d){return function(){OpenchannelQueueEvents[_0x082c('0x3')](_0x37cf56,_0x289f6d);};}exports['register']=function(_0x997d5b){for(var _0x28aa64=0x0,_0x57912d=events[_0x082c('0x4')];_0x28aa64<_0x57912d;_0x28aa64++){var _0x39d449=events[_0x28aa64];var _0x55c4d9=createListener(_0x082c('0x5')+_0x39d449,_0x997d5b);OpenchannelQueueEvents['on'](_0x39d449,_0x55c4d9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 6f0d5b8..c9917f1 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 _0x2d2d=['/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','/describe','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2d2d,0x1f4));var _0xd2d2=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x2d2d[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require('multer');var util=require(_0xd2d2('0x0'));var path=require(_0xd2d2('0x1'));var timeout=require(_0xd2d2('0x2'));var express=require(_0xd2d2('0x3'));var router=express[_0xd2d2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd2d2('0x5'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0xd2d2('0x6')](),controller[_0xd2d2('0x7')]);router['get'](_0xd2d2('0x8'),auth[_0xd2d2('0x6')](),controller['describe']);router[_0xd2d2('0x9')](_0xd2d2('0xa'),auth[_0xd2d2('0x6')](),controller[_0xd2d2('0xb')]);router[_0xd2d2('0xc')]('/',auth[_0xd2d2('0x6')](),controller[_0xd2d2('0xd')]);router[_0xd2d2('0xe')](_0xd2d2('0xa'),auth[_0xd2d2('0x6')](),controller[_0xd2d2('0xf')]);router['delete'](_0xd2d2('0xa'),auth['isAuthenticated'](),controller[_0xd2d2('0x10')]);module['exports']=router; \ No newline at end of file +var _0x203c=['util','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','update','delete','exports','multer'];(function(_0x49d73a,_0x37ea42){var _0x1b05e1=function(_0x8ac987){while(--_0x8ac987){_0x49d73a['push'](_0x49d73a['shift']());}};_0x1b05e1(++_0x37ea42);}(_0x203c,0xa4));var _0xc203=function(_0x1be5a3,_0x1f80f2){_0x1be5a3=_0x1be5a3-0x0;var _0x53b728=_0x203c[_0x1be5a3];return _0x53b728;};'use strict';var multer=require(_0xc203('0x0'));var util=require(_0xc203('0x1'));var path=require('path');var timeout=require(_0xc203('0x2'));var express=require('express');var router=express[_0xc203('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc203('0x4'));var config=require(_0xc203('0x5'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0xc203('0x6')](),controller['index']);router[_0xc203('0x7')](_0xc203('0x8'),auth[_0xc203('0x6')](),controller[_0xc203('0x9')]);router[_0xc203('0x7')](_0xc203('0xa'),auth['isAuthenticated'](),controller[_0xc203('0xb')]);router['post']('/',auth[_0xc203('0x6')](),controller['create']);router['put'](_0xc203('0xa'),auth[_0xc203('0x6')](),controller[_0xc203('0xc')]);router[_0xc203('0xd')](_0xc203('0xa'),auth[_0xc203('0x6')](),controller['destroy']);module[_0xc203('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 26ec839..d9bba2e 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 _0x179f=['STRING','DATE','moment','sequelize','exports'];(function(_0x21adfd,_0x59e3ed){var _0x49909b=function(_0x497842){while(--_0x497842){_0x21adfd['push'](_0x21adfd['shift']());}};_0x49909b(++_0x59e3ed);}(_0x179f,0x1ec));var _0xf179=function(_0x3fd85b,_0x5dbe9f){_0x3fd85b=_0x3fd85b-0x0;var _0x1f8822=_0x179f[_0x3fd85b];return _0x1f8822;};'use strict';var moment=require(_0xf179('0x0'));var Sequelize=require(_0xf179('0x1'));module[_0xf179('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf179('0x3')]},'joinAt':{'type':Sequelize[_0xf179('0x4')]},'leaveAt':{'type':Sequelize[_0xf179('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf179('0x4')]},'reason':{'type':Sequelize[_0xf179('0x3')]}}; \ No newline at end of file +var _0x92ab=['STRING','DATE','moment','exports'];(function(_0x41446c,_0x54a35b){var _0x14203f=function(_0x137800){while(--_0x137800){_0x41446c['push'](_0x41446c['shift']());}};_0x14203f(++_0x54a35b);}(_0x92ab,0x1a6));var _0xb92a=function(_0x472872,_0x1cfdb7){_0x472872=_0x472872-0x0;var _0x47c1f2=_0x92ab[_0x472872];return _0x47c1f2;};'use strict';var moment=require(_0xb92a('0x0'));var Sequelize=require('sequelize');module[_0xb92a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb92a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb92a('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb92a('0x3')]},'reason':{'type':Sequelize[_0xb92a('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index c2dce17..cb1ed7d 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 _0x94d4=['type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','findAll','show','params','length','options','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../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','apply','reject','update','then','error','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName'];(function(_0x4d830c,_0x459112){var _0x5913a4=function(_0x559421){while(--_0x559421){_0x4d830c['push'](_0x4d830c['shift']());}};_0x5913a4(++_0x459112);}(_0x94d4,0xa5));var _0x494d=function(_0x4e8975,_0xabfb8b){_0x4e8975=_0x4e8975-0x0;var _0x437b49=_0x94d4[_0x4e8975];return _0x437b49;};'use strict';var pdf=require(_0x494d('0x0'));var emlformat=require(_0x494d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x494d('0x2'));var jsonpatch=require(_0x494d('0x3'));var rp=require(_0x494d('0x4'));var moment=require('moment');var BPromise=require(_0x494d('0x5'));var Mustache=require(_0x494d('0x6'));var util=require(_0x494d('0x7'));var path=require(_0x494d('0x8'));var sox=require(_0x494d('0x9'));var csv=require(_0x494d('0xa'));var ejs=require(_0x494d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x494d('0xc'));var deskjs=require(_0x494d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x494d('0xe'));var Redis=require(_0x494d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x494d('0x10'));var as=require(_0x494d('0x11'));var hardwareService=require(_0x494d('0x12'));var logger=require(_0x494d('0x13'))('api');var utils=require(_0x494d('0x14'));var config=require(_0x494d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50c3db,_0x56fc3a){_0x56fc3a=_0x56fc3a||0xcc;return function(_0x12ca37){if(_0x12ca37){return _0x50c3db[_0x494d('0x16')](_0x56fc3a);}return _0x50c3db[_0x494d('0x17')](_0x56fc3a)[_0x494d('0x18')]();};}function respondWithResult(_0x3bc5c9,_0x2c89c9){_0x2c89c9=_0x2c89c9||0xc8;return function(_0x2dc608){if(_0x2dc608){return _0x3bc5c9[_0x494d('0x17')](_0x2c89c9)[_0x494d('0x19')](_0x2dc608);}};}function respondWithFilteredResult(_0x441d77,_0x263405){return function(_0x5c2c67){if(_0x5c2c67){var _0x22f04f=_0x5c2c67[_0x494d('0x1a')],_0x215a65=_0x263405[_0x494d('0x1b')],_0x2a2917=_0x263405[_0x494d('0x1b')]+_0x263405[_0x494d('0x1c')],_0x3012e3;if(_0x2a2917>=_0x22f04f){_0x2a2917=_0x22f04f;_0x3012e3=0xc8;}else{_0x3012e3=0xce;}_0x441d77[_0x494d('0x17')](_0x3012e3);return _0x441d77[_0x494d('0x1d')](_0x494d('0x1e'),_0x215a65+'-'+_0x2a2917+'/'+_0x22f04f)[_0x494d('0x19')](_0x5c2c67);}return null;};}function patchUpdates(_0xb2fc39){return function(_0x23997d){try{jsonpatch[_0x494d('0x1f')](_0x23997d,_0xb2fc39,!![]);}catch(_0x3e4be3){return BPromise[_0x494d('0x20')](_0x3e4be3);}return _0x23997d['save']();};}function saveUpdates(_0x2be3b5,_0x172763){return function(_0xb7ed29){if(_0xb7ed29){return _0xb7ed29[_0x494d('0x21')](_0x2be3b5)['then'](function(_0x5ea684){return _0x5ea684;});}return null;};}function removeEntity(_0x3eaf7e,_0x15a532){return function(_0x56e992){if(_0x56e992){return _0x56e992['destroy']()[_0x494d('0x22')](function(){_0x3eaf7e['status'](0xcc)[_0x494d('0x18')]();});}};}function handleEntityNotFound(_0x52f26d,_0x2be6f0){return function(_0x29220e){if(!_0x29220e){_0x52f26d['sendStatus'](0x194);}return _0x29220e;};}function handleError(_0x2fdb5b,_0xc107f4){_0xc107f4=_0xc107f4||0x1f4;return function(_0x2ca20c){logger[_0x494d('0x23')](_0x2ca20c[_0x494d('0x24')]);if(_0x2ca20c['name']){delete _0x2ca20c[_0x494d('0x25')];}_0x2fdb5b[_0x494d('0x17')](_0xc107f4)['send'](_0x2ca20c);};}exports['index']=function(_0x180b0d,_0x43a3a5){var _0x37253a={},_0x2c025d={},_0xf466f={'count':0x0,'rows':[]};var _0x3a181b=_[_0x494d('0x26')](db[_0x494d('0x27')][_0x494d('0x28')],function(_0x2d9615){return{'name':_0x2d9615[_0x494d('0x29')],'type':_0x2d9615[_0x494d('0x2a')][_0x494d('0x2b')]};});_0x2c025d['model']=_[_0x494d('0x26')](_0x3a181b,_0x494d('0x25'));_0x2c025d[_0x494d('0x2c')]=_[_0x494d('0x2d')](_0x180b0d[_0x494d('0x2c')]);_0x2c025d[_0x494d('0x2e')]=_[_0x494d('0x2f')](_0x2c025d[_0x494d('0x30')],_0x2c025d[_0x494d('0x2c')]);_0x37253a[_0x494d('0x31')]=_['intersection'](_0x2c025d[_0x494d('0x30')],qs[_0x494d('0x32')](_0x180b0d['query'][_0x494d('0x32')]));_0x37253a[_0x494d('0x31')]=_0x37253a['attributes']['length']?_0x37253a[_0x494d('0x31')]:_0x2c025d['model'];if(!_0x180b0d[_0x494d('0x2c')][_0x494d('0x33')](_0x494d('0x34'))){_0x37253a[_0x494d('0x1c')]=qs['limit'](_0x180b0d['query'][_0x494d('0x1c')]);_0x37253a[_0x494d('0x1b')]=qs[_0x494d('0x1b')](_0x180b0d['query']['offset']);}_0x37253a[_0x494d('0x35')]=qs[_0x494d('0x36')](_0x180b0d['query'][_0x494d('0x36')]);_0x37253a[_0x494d('0x37')]=qs[_0x494d('0x2e')](_['pick'](_0x180b0d['query'],_0x2c025d['filters']),_0x3a181b);if(_0x180b0d[_0x494d('0x2c')]['filter']){_0x37253a['where']=_[_0x494d('0x38')](_0x37253a[_0x494d('0x37')],{'$or':_[_0x494d('0x26')](_0x3a181b,function(_0x3ac9fb){if(_0x3ac9fb[_0x494d('0x2a')]!=='VIRTUAL'){var _0x25aa0b={};_0x25aa0b[_0x3ac9fb[_0x494d('0x25')]]={'$like':'%'+_0x180b0d[_0x494d('0x2c')][_0x494d('0x39')]+'%'};return _0x25aa0b;}})});}_0x37253a=_[_0x494d('0x38')]({},_0x37253a,_0x180b0d['options']);var _0x2a8d3a={'where':_0x37253a[_0x494d('0x37')]};return db['OpenchannelQueueReport'][_0x494d('0x1a')](_0x2a8d3a)[_0x494d('0x22')](function(_0x28223f){_0xf466f['count']=_0x28223f;if(_0x180b0d[_0x494d('0x2c')][_0x494d('0x3a')]){_0x37253a['include']=[{'all':!![]}];}return db[_0x494d('0x27')][_0x494d('0x3b')](_0x37253a);})[_0x494d('0x22')](function(_0x554239){_0xf466f['rows']=_0x554239;return _0xf466f;})[_0x494d('0x22')](respondWithFilteredResult(_0x43a3a5,_0x37253a))['catch'](handleError(_0x43a3a5,null));};exports[_0x494d('0x3c')]=function(_0x3c1a8c,_0x201a93){var _0x5ce269={'raw':!![],'where':{'id':_0x3c1a8c[_0x494d('0x3d')]['id']}},_0x3a9a30={};_0x3a9a30['model']=_[_0x494d('0x2d')](db[_0x494d('0x27')]['rawAttributes']);_0x3a9a30[_0x494d('0x2c')]=_[_0x494d('0x2d')](_0x3c1a8c['query']);_0x3a9a30[_0x494d('0x2e')]=_[_0x494d('0x2f')](_0x3a9a30[_0x494d('0x30')],_0x3a9a30[_0x494d('0x2c')]);_0x5ce269['attributes']=_[_0x494d('0x2f')](_0x3a9a30[_0x494d('0x30')],qs[_0x494d('0x32')](_0x3c1a8c[_0x494d('0x2c')]['fields']));_0x5ce269['attributes']=_0x5ce269[_0x494d('0x31')][_0x494d('0x3e')]?_0x5ce269['attributes']:_0x3a9a30[_0x494d('0x30')];if(_0x3c1a8c[_0x494d('0x2c')][_0x494d('0x3a')]){_0x5ce269['include']=[{'all':!![]}];}_0x5ce269=_['merge']({},_0x5ce269,_0x3c1a8c[_0x494d('0x3f')]);return db[_0x494d('0x27')][_0x494d('0x40')](_0x5ce269)[_0x494d('0x22')](handleEntityNotFound(_0x201a93,null))[_0x494d('0x22')](respondWithResult(_0x201a93,null))[_0x494d('0x41')](handleError(_0x201a93,null));};exports[_0x494d('0x42')]=function(_0x3e34a8,_0x4155ac){return db[_0x494d('0x27')][_0x494d('0x42')](_0x3e34a8[_0x494d('0x43')],{})['then'](respondWithResult(_0x4155ac,0xc9))[_0x494d('0x41')](handleError(_0x4155ac,null));};exports[_0x494d('0x21')]=function(_0x184027,_0x284e64){if(_0x184027[_0x494d('0x43')]['id']){delete _0x184027[_0x494d('0x43')]['id'];}return db[_0x494d('0x27')][_0x494d('0x40')]({'where':{'id':_0x184027['params']['id']}})[_0x494d('0x22')](handleEntityNotFound(_0x284e64,null))[_0x494d('0x22')](saveUpdates(_0x184027[_0x494d('0x43')],null))[_0x494d('0x22')](respondWithResult(_0x284e64,null))[_0x494d('0x41')](handleError(_0x284e64,null));};exports['destroy']=function(_0x526bda,_0x261a92){return db['OpenchannelQueueReport'][_0x494d('0x40')]({'where':{'id':_0x526bda[_0x494d('0x3d')]['id']}})[_0x494d('0x22')](handleEntityNotFound(_0x261a92,null))[_0x494d('0x22')](removeEntity(_0x261a92,null))['catch'](handleError(_0x261a92,null));};exports[_0x494d('0x44')]=function(_0xbfb68,_0x529e3b){return db[_0x494d('0x27')][_0x494d('0x44')]()[_0x494d('0x22')](respondWithResult(_0x529e3b,null))[_0x494d('0x41')](handleError(_0x529e3b,null));}; \ No newline at end of file +var _0x964b=['apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','update','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range'];(function(_0xc17940,_0x2e38fa){var _0x4ef1c8=function(_0x188168){while(--_0x188168){_0xc17940['push'](_0xc17940['shift']());}};_0x4ef1c8(++_0x2e38fa);}(_0x964b,0x112));var _0xb964=function(_0xff2a3b,_0xb3d7a4){_0xff2a3b=_0xff2a3b-0x0;var _0x5a816d=_0x964b[_0xff2a3b];return _0x5a816d;};'use strict';var pdf=require(_0xb964('0x0'));var emlformat=require(_0xb964('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb964('0x2'));var jsonpatch=require(_0xb964('0x3'));var rp=require(_0xb964('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb964('0x5'));var util=require('util');var path=require(_0xb964('0x6'));var sox=require(_0xb964('0x7'));var csv=require(_0xb964('0x8'));var ejs=require(_0xb964('0x9'));var fs=require('fs');var _=require(_0xb964('0xa'));var squel=require(_0xb964('0xb'));var crypto=require(_0xb964('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb964('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb964('0xd'));var authService=require(_0xb964('0xe'));var qs=require(_0xb964('0xf'));var as=require(_0xb964('0x10'));var hardwareService=require(_0xb964('0x11'));var logger=require(_0xb964('0x12'))('api');var utils=require(_0xb964('0x13'));var config=require(_0xb964('0x14'));var db=require(_0xb964('0x15'))['db'];function respondWithStatusCode(_0x30c217,_0x4e7e0f){_0x4e7e0f=_0x4e7e0f||0xcc;return function(_0x2137db){if(_0x2137db){return _0x30c217['sendStatus'](_0x4e7e0f);}return _0x30c217['status'](_0x4e7e0f)[_0xb964('0x16')]();};}function respondWithResult(_0x256e02,_0xe111d2){_0xe111d2=_0xe111d2||0xc8;return function(_0x407f8c){if(_0x407f8c){return _0x256e02[_0xb964('0x17')](_0xe111d2)[_0xb964('0x18')](_0x407f8c);}};}function respondWithFilteredResult(_0x3d5baa,_0x59965c){return function(_0x3f507a){if(_0x3f507a){var _0x5a2ce4=_0x3f507a[_0xb964('0x19')],_0x538d2e=_0x59965c[_0xb964('0x1a')],_0xd775d5=_0x59965c[_0xb964('0x1a')]+_0x59965c[_0xb964('0x1b')],_0x19eb59;if(_0xd775d5>=_0x5a2ce4){_0xd775d5=_0x5a2ce4;_0x19eb59=0xc8;}else{_0x19eb59=0xce;}_0x3d5baa[_0xb964('0x17')](_0x19eb59);return _0x3d5baa[_0xb964('0x1c')](_0xb964('0x1d'),_0x538d2e+'-'+_0xd775d5+'/'+_0x5a2ce4)['json'](_0x3f507a);}return null;};}function patchUpdates(_0x54da04){return function(_0x49a066){try{jsonpatch[_0xb964('0x1e')](_0x49a066,_0x54da04,!![]);}catch(_0x42e78e){return BPromise[_0xb964('0x1f')](_0x42e78e);}return _0x49a066[_0xb964('0x20')]();};}function saveUpdates(_0x12056d,_0x5a49ac){return function(_0x52c497){if(_0x52c497){return _0x52c497['update'](_0x12056d)[_0xb964('0x21')](function(_0x457f43){return _0x457f43;});}return null;};}function removeEntity(_0x30d78f,_0x4e5160){return function(_0x3cc265){if(_0x3cc265){return _0x3cc265[_0xb964('0x22')]()[_0xb964('0x21')](function(){_0x30d78f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x114124,_0x5469c2){return function(_0x14dece){if(!_0x14dece){_0x114124[_0xb964('0x23')](0x194);}return _0x14dece;};}function handleError(_0x2b9b74,_0x446e1b){_0x446e1b=_0x446e1b||0x1f4;return function(_0x51257e){logger[_0xb964('0x24')](_0x51257e[_0xb964('0x25')]);if(_0x51257e[_0xb964('0x26')]){delete _0x51257e[_0xb964('0x26')];}_0x2b9b74[_0xb964('0x17')](_0x446e1b)[_0xb964('0x27')](_0x51257e);};}exports[_0xb964('0x28')]=function(_0x1626f2,_0x142f76){var _0x4d82e2={},_0x2b5b7d={},_0x273ca4={'count':0x0,'rows':[]};var _0x9e2530=_[_0xb964('0x29')](db[_0xb964('0x2a')][_0xb964('0x2b')],function(_0x20b89a){return{'name':_0x20b89a['fieldName'],'type':_0x20b89a[_0xb964('0x2c')][_0xb964('0x2d')]};});_0x2b5b7d[_0xb964('0x2e')]=_['map'](_0x9e2530,_0xb964('0x26'));_0x2b5b7d[_0xb964('0x2f')]=_[_0xb964('0x30')](_0x1626f2[_0xb964('0x2f')]);_0x2b5b7d[_0xb964('0x31')]=_[_0xb964('0x32')](_0x2b5b7d['model'],_0x2b5b7d['query']);_0x4d82e2[_0xb964('0x33')]=_[_0xb964('0x32')](_0x2b5b7d[_0xb964('0x2e')],qs[_0xb964('0x34')](_0x1626f2['query'][_0xb964('0x34')]));_0x4d82e2['attributes']=_0x4d82e2[_0xb964('0x33')][_0xb964('0x35')]?_0x4d82e2['attributes']:_0x2b5b7d['model'];if(!_0x1626f2[_0xb964('0x2f')][_0xb964('0x36')](_0xb964('0x37'))){_0x4d82e2[_0xb964('0x1b')]=qs[_0xb964('0x1b')](_0x1626f2[_0xb964('0x2f')]['limit']);_0x4d82e2['offset']=qs['offset'](_0x1626f2[_0xb964('0x2f')][_0xb964('0x1a')]);}_0x4d82e2[_0xb964('0x38')]=qs[_0xb964('0x39')](_0x1626f2[_0xb964('0x2f')][_0xb964('0x39')]);_0x4d82e2['where']=qs['filters'](_[_0xb964('0x3a')](_0x1626f2[_0xb964('0x2f')],_0x2b5b7d[_0xb964('0x31')]),_0x9e2530);if(_0x1626f2[_0xb964('0x2f')][_0xb964('0x3b')]){_0x4d82e2['where']=_[_0xb964('0x3c')](_0x4d82e2[_0xb964('0x3d')],{'$or':_[_0xb964('0x29')](_0x9e2530,function(_0x5f3244){if(_0x5f3244[_0xb964('0x2c')]!==_0xb964('0x3e')){var _0x4286c3={};_0x4286c3[_0x5f3244['name']]={'$like':'%'+_0x1626f2[_0xb964('0x2f')]['filter']+'%'};return _0x4286c3;}})});}_0x4d82e2=_[_0xb964('0x3c')]({},_0x4d82e2,_0x1626f2['options']);var _0xb0891={'where':_0x4d82e2[_0xb964('0x3d')]};return db['OpenchannelQueueReport']['count'](_0xb0891)[_0xb964('0x21')](function(_0x3f74fb){_0x273ca4[_0xb964('0x19')]=_0x3f74fb;if(_0x1626f2[_0xb964('0x2f')][_0xb964('0x3f')]){_0x4d82e2['include']=[{'all':!![]}];}return db[_0xb964('0x2a')][_0xb964('0x40')](_0x4d82e2);})[_0xb964('0x21')](function(_0x5e8208){_0x273ca4[_0xb964('0x41')]=_0x5e8208;return _0x273ca4;})[_0xb964('0x21')](respondWithFilteredResult(_0x142f76,_0x4d82e2))[_0xb964('0x42')](handleError(_0x142f76,null));};exports[_0xb964('0x43')]=function(_0x33cfd,_0x57b735){var _0xe962f9={'raw':!![],'where':{'id':_0x33cfd['params']['id']}},_0x1643e7={};_0x1643e7[_0xb964('0x2e')]=_[_0xb964('0x30')](db[_0xb964('0x2a')][_0xb964('0x2b')]);_0x1643e7['query']=_['keys'](_0x33cfd[_0xb964('0x2f')]);_0x1643e7[_0xb964('0x31')]=_[_0xb964('0x32')](_0x1643e7[_0xb964('0x2e')],_0x1643e7[_0xb964('0x2f')]);_0xe962f9[_0xb964('0x33')]=_[_0xb964('0x32')](_0x1643e7[_0xb964('0x2e')],qs['fields'](_0x33cfd[_0xb964('0x2f')]['fields']));_0xe962f9[_0xb964('0x33')]=_0xe962f9[_0xb964('0x33')][_0xb964('0x35')]?_0xe962f9['attributes']:_0x1643e7[_0xb964('0x2e')];if(_0x33cfd[_0xb964('0x2f')][_0xb964('0x3f')]){_0xe962f9[_0xb964('0x44')]=[{'all':!![]}];}_0xe962f9=_[_0xb964('0x3c')]({},_0xe962f9,_0x33cfd[_0xb964('0x45')]);return db[_0xb964('0x2a')][_0xb964('0x46')](_0xe962f9)[_0xb964('0x21')](handleEntityNotFound(_0x57b735,null))['then'](respondWithResult(_0x57b735,null))['catch'](handleError(_0x57b735,null));};exports['create']=function(_0x12c58f,_0xe4e024){return db['OpenchannelQueueReport'][_0xb964('0x47')](_0x12c58f[_0xb964('0x48')],{})['then'](respondWithResult(_0xe4e024,0xc9))['catch'](handleError(_0xe4e024,null));};exports[_0xb964('0x49')]=function(_0x429d9d,_0x562261){if(_0x429d9d[_0xb964('0x48')]['id']){delete _0x429d9d['body']['id'];}return db[_0xb964('0x2a')]['find']({'where':{'id':_0x429d9d[_0xb964('0x4a')]['id']}})[_0xb964('0x21')](handleEntityNotFound(_0x562261,null))[_0xb964('0x21')](saveUpdates(_0x429d9d[_0xb964('0x48')],null))[_0xb964('0x21')](respondWithResult(_0x562261,null))[_0xb964('0x42')](handleError(_0x562261,null));};exports[_0xb964('0x22')]=function(_0x266121,_0x591a20){return db[_0xb964('0x2a')][_0xb964('0x46')]({'where':{'id':_0x266121[_0xb964('0x4a')]['id']}})[_0xb964('0x21')](handleEntityNotFound(_0x591a20,null))['then'](removeEntity(_0x591a20,null))[_0xb964('0x42')](handleError(_0x591a20,null));};exports[_0xb964('0x4b')]=function(_0x1759bc,_0x23ebfa){return db[_0xb964('0x2a')][_0xb964('0x4b')]()[_0xb964('0x21')](respondWithResult(_0x23ebfa,null))[_0xb964('0x42')](handleError(_0x23ebfa,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 453364d..f012c61 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 _0x11b1=['lodash','moment','bluebird','request-promise','rimraf','./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid'];(function(_0x1c6f10,_0x5eed05){var _0x5a9683=function(_0x1ea102){while(--_0x1ea102){_0x1c6f10['push'](_0x1c6f10['shift']());}};_0x5a9683(++_0x5eed05);}(_0x11b1,0xfa));var _0x111b=function(_0x3e04f3,_0x18b199){_0x3e04f3=_0x3e04f3-0x0;var _0xe992ce=_0x11b1[_0x3e04f3];return _0xe992ce;};'use strict';var _=require(_0x111b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x111b('0x1'));var BPromise=require(_0x111b('0x2'));var rp=require(_0x111b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x111b('0x4'));var config=require('../../config/environment');var attributes=require(_0x111b('0x5'));module['exports']=function(_0x194cd5,_0x2e5260){return _0x194cd5[_0x111b('0x6')](_0x111b('0x7'),attributes,{'tableName':_0x111b('0x8'),'paranoid':![],'indexes':[{'name':_0x111b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa2a6=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueueReport.attributes'];(function(_0x413a9a,_0x54c68e){var _0x16bdb7=function(_0x298abd){while(--_0x298abd){_0x413a9a['push'](_0x413a9a['shift']());}};_0x16bdb7(++_0x54c68e);}(_0xa2a6,0xc8));var _0x6a2a=function(_0x5bc188,_0x2af445){_0x5bc188=_0x5bc188-0x0;var _0x662326=_0xa2a6[_0x5bc188];return _0x662326;};'use strict';var _=require(_0x6a2a('0x0'));var util=require(_0x6a2a('0x1'));var logger=require(_0x6a2a('0x2'))(_0x6a2a('0x3'));var moment=require(_0x6a2a('0x4'));var BPromise=require(_0x6a2a('0x5'));var rp=require(_0x6a2a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a2a('0x7'));var config=require(_0x6a2a('0x8'));var attributes=require(_0x6a2a('0x9'));module['exports']=function(_0x2e0241,_0xf853a9){return _0x2e0241[_0x6a2a('0xa')](_0x6a2a('0xb'),attributes,{'tableName':_0x6a2a('0xc'),'paranoid':![],'indexes':[{'name':_0x6a2a('0xd'),'fields':[_0x6a2a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1c880be..7abb9b2 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 _0xd906=['http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','then','catch','UpdateOpenchannelQueueReport','where','attributes','limit','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x38e136,_0x3936b5){var _0x4146fd=function(_0x1e5a58){while(--_0x1e5a58){_0x38e136['push'](_0x38e136['shift']());}};_0x4146fd(++_0x3936b5);}(_0xd906,0x6b));var _0x6d90=function(_0x4c9cb5,_0xcf85d4){_0x4c9cb5=_0x4c9cb5-0x0;var _0x20310b=_0xd906[_0x4c9cb5];return _0x20310b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d90('0x0'));var BPromise=require(_0x6d90('0x1'));var rs=require(_0x6d90('0x2'));var fs=require('fs');var Redis=require(_0x6d90('0x3'));var db=require(_0x6d90('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d90('0x5'))(_0x6d90('0x6'));var config=require(_0x6d90('0x7'));var jayson=require(_0x6d90('0x8'));var client=jayson['client'][_0x6d90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19eb61,_0xd120f6,_0x160c7d){return new BPromise(function(_0x219737,_0x5d0ed4){return client['request'](_0x19eb61,_0x160c7d)['then'](function(_0x41c0a3){logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));logger[_0x6d90('0xd')](_0x6d90('0xe'),_0xd120f6,_0x6d90('0xc'),JSON['stringify'](_0x41c0a3));if(_0x41c0a3[_0x6d90('0xf')]){if(_0x41c0a3['error'][_0x6d90('0x10')]===0x1f4){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);return _0x5d0ed4(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}logger[_0x6d90('0xf')](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')]['message']);return _0x219737(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}else{logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));_0x219737(_0x41c0a3['result'][_0x6d90('0x11')]);}})['catch'](function(_0x379439){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x379439);_0x5d0ed4(_0x379439);});});}exports[_0x6d90('0x12')]=function(_0x352736){var _0x3d37c6=this;return new Promise(function(_0x4e6682,_0x5dd53c){return db[_0x6d90('0x13')]['create'](_0x352736[_0x6d90('0x14')],{'raw':_0x352736[_0x6d90('0x15')]?_0x352736['options']['raw']===undefined?!![]:![]:!![]})[_0x6d90('0x16')](function(_0x2ca50e){logger[_0x6d90('0xa')]('CreateOpenchannelQueueReport',_0x352736);logger['debug']('CreateOpenchannelQueueReport',_0x352736,JSON['stringify'](_0x2ca50e));_0x4e6682(_0x2ca50e);})[_0x6d90('0x17')](function(_0x5703e6){logger[_0x6d90('0xf')](_0x6d90('0x12'),_0x5703e6[_0x6d90('0x11')],_0x352736);_0x5dd53c(_0x3d37c6[_0x6d90('0xf')](0x1f4,_0x5703e6[_0x6d90('0x11')]));});});};exports[_0x6d90('0x18')]=function(_0x3aef5b){var _0x43c927=this;return new Promise(function(_0x243a32,_0x3b62da){return db[_0x6d90('0x13')]['update'](_0x3aef5b[_0x6d90('0x14')],{'raw':_0x3aef5b[_0x6d90('0x15')]?_0x3aef5b[_0x6d90('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aef5b[_0x6d90('0x15')]?_0x3aef5b[_0x6d90('0x15')][_0x6d90('0x19')]||null:null,'attributes':_0x3aef5b[_0x6d90('0x15')]?_0x3aef5b[_0x6d90('0x15')][_0x6d90('0x1a')]||null:null,'limit':_0x3aef5b[_0x6d90('0x15')]?_0x3aef5b[_0x6d90('0x15')][_0x6d90('0x1b')]||null:null})[_0x6d90('0x16')](function(_0x5eea54){logger['info']('UpdateOpenchannelQueueReport',_0x3aef5b);logger[_0x6d90('0xd')]('UpdateOpenchannelQueueReport',_0x3aef5b,JSON[_0x6d90('0x1c')](_0x5eea54));_0x243a32(_0x5eea54);})[_0x6d90('0x17')](function(_0x148cf5){logger[_0x6d90('0xf')](_0x6d90('0x18'),_0x148cf5[_0x6d90('0x11')],_0x3aef5b);_0x3b62da(_0x43c927[_0x6d90('0xf')](0x1f4,_0x148cf5[_0x6d90('0x11')]));});});}; \ No newline at end of file +var _0x6ac2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','then','debug','UpdateOpenchannelQueueReport','update','raw','options','where','attributes','lodash','moment'];(function(_0x306c78,_0x4f2018){var _0x57a319=function(_0x1fdcbf){while(--_0x1fdcbf){_0x306c78['push'](_0x306c78['shift']());}};_0x57a319(++_0x4f2018);}(_0x6ac2,0x184));var _0x26ac=function(_0x511cbb,_0x1a52c0){_0x511cbb=_0x511cbb-0x0;var _0x43466f=_0x6ac2[_0x511cbb];return _0x43466f;};'use strict';var _=require(_0x26ac('0x0'));var util=require('util');var moment=require(_0x26ac('0x1'));var BPromise=require(_0x26ac('0x2'));var rs=require(_0x26ac('0x3'));var fs=require('fs');var Redis=require(_0x26ac('0x4'));var db=require(_0x26ac('0x5'))['db'];var utils=require(_0x26ac('0x6'));var logger=require('../../config/logger')(_0x26ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x26ac('0x8'));var client=jayson[_0x26ac('0x9')][_0x26ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x159ba6,_0x36389c,_0x444ca1){return new BPromise(function(_0x1906d0,_0xd8b1e5){return client['request'](_0x159ba6,_0x444ca1)['then'](function(_0x27ff15){logger[_0x26ac('0xb')](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));logger['debug'](_0x26ac('0xe'),_0x36389c,_0x26ac('0xd'),JSON[_0x26ac('0xf')](_0x27ff15));if(_0x27ff15[_0x26ac('0x10')]){if(_0x27ff15['error']['code']===0x1f4){logger[_0x26ac('0x10')](_0x26ac('0xc'),_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0xd8b1e5(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}logger[_0x26ac('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0x1906d0(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}else{logger['info'](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));_0x1906d0(_0x27ff15['result'][_0x26ac('0x11')]);}})[_0x26ac('0x12')](function(_0x3b7c5d){logger[_0x26ac('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x36389c,_0x3b7c5d);_0xd8b1e5(_0x3b7c5d);});});}exports[_0x26ac('0x13')]=function(_0xb03bbc){var _0x5cd737=this;return new Promise(function(_0x539eda,_0x111613){return db[_0x26ac('0x14')]['create'](_0xb03bbc[_0x26ac('0x15')],{'raw':_0xb03bbc['options']?_0xb03bbc['options']['raw']===undefined?!![]:![]:!![]})[_0x26ac('0x16')](function(_0x58ee68){logger[_0x26ac('0xb')](_0x26ac('0x13'),_0xb03bbc);logger[_0x26ac('0x17')](_0x26ac('0x13'),_0xb03bbc,JSON[_0x26ac('0xf')](_0x58ee68));_0x539eda(_0x58ee68);})[_0x26ac('0x12')](function(_0x21b6ab){logger[_0x26ac('0x10')](_0x26ac('0x13'),_0x21b6ab['message'],_0xb03bbc);_0x111613(_0x5cd737[_0x26ac('0x10')](0x1f4,_0x21b6ab[_0x26ac('0x11')]));});});};exports[_0x26ac('0x18')]=function(_0x1885f7){var _0x346001=this;return new Promise(function(_0x268200,_0x1074b5){return db[_0x26ac('0x14')][_0x26ac('0x19')](_0x1885f7[_0x26ac('0x15')],{'raw':_0x1885f7['options']?_0x1885f7['options'][_0x26ac('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1885f7['options']?_0x1885f7[_0x26ac('0x1b')][_0x26ac('0x1c')]||null:null,'attributes':_0x1885f7[_0x26ac('0x1b')]?_0x1885f7[_0x26ac('0x1b')][_0x26ac('0x1d')]||null:null,'limit':_0x1885f7[_0x26ac('0x1b')]?_0x1885f7['options']['limit']||null:null})[_0x26ac('0x16')](function(_0x3e2c4d){logger[_0x26ac('0xb')]('UpdateOpenchannelQueueReport',_0x1885f7);logger['debug'](_0x26ac('0x18'),_0x1885f7,JSON[_0x26ac('0xf')](_0x3e2c4d));_0x268200(_0x3e2c4d);})[_0x26ac('0x12')](function(_0x325818){logger['error']('UpdateOpenchannelQueueReport',_0x325818[_0x26ac('0x11')],_0x1885f7);_0x1074b5(_0x346001[_0x26ac('0x10')](0x1f4,_0x325818[_0x26ac('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 64378b9..280b40c 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(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x48c4ef,_0x319d44){var _0x435715=function(_0x925d50){while(--_0x925d50){_0x48c4ef['push'](_0x48c4ef['shift']());}};_0x435715(++_0x319d44);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 dc9dc40..594006c 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 _0x8d03=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x13661b,_0x48fb39){var _0x4b8e30=function(_0x35f657){while(--_0x35f657){_0x13661b['push'](_0x13661b['shift']());}};_0x4b8e30(++_0x48fb39);}(_0x8d03,0x122));var _0x38d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8d03[_0x397e5f];return _0x5302b8;};'use strict';var moment=require('moment');var Sequelize=require(_0x38d0('0x0'));module[_0x38d0('0x1')]={'uniqueid':{'type':Sequelize[_0x38d0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x38d0('0x3')]('account',_0x38d0('0x4'),_0x38d0('0x5')),'allowNull':![],'defaultValue':_0x38d0('0x5')},'transferredAt':{'type':Sequelize[_0x38d0('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x3014=['account','queue','DATE','NOW','sequelize','STRING','ENUM'];(function(_0x321387,_0x1c989d){var _0x541916=function(_0x38e737){while(--_0x38e737){_0x321387['push'](_0x321387['shift']());}};_0x541916(++_0x1c989d);}(_0x3014,0x17e));var _0x4301=function(_0x4a06f2,_0x50d27f){_0x4a06f2=_0x4a06f2-0x0;var _0x5a22da=_0x3014[_0x4a06f2];return _0x5a22da;};'use strict';var moment=require('moment');var Sequelize=require(_0x4301('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4301('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4301('0x2')](_0x4301('0x3'),'agent','queue'),'allowNull':![],'defaultValue':_0x4301('0x4')},'transferredAt':{'type':Sequelize[_0x4301('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x4301('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index bb47c2f..0e39180 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 _0xe8c8=['options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','ejs','lodash','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','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL'];(function(_0x5a58e1,_0x5cf833){var _0x1061d4=function(_0x54071d){while(--_0x54071d){_0x5a58e1['push'](_0x5a58e1['shift']());}};_0x1061d4(++_0x5cf833);}(_0xe8c8,0x13d));var _0x8e8c=function(_0x5e1c16,_0x279767){_0x5e1c16=_0x5e1c16-0x0;var _0x9ad669=_0xe8c8[_0x5e1c16];return _0x9ad669;};'use strict';var pdf=require(_0x8e8c('0x0'));var emlformat=require(_0x8e8c('0x1'));var rimraf=require(_0x8e8c('0x2'));var zipdir=require(_0x8e8c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e8c('0x4'));var moment=require(_0x8e8c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8e8c('0x6'));var path=require('path');var sox=require(_0x8e8c('0x7'));var csv=require('to-csv');var ejs=require(_0x8e8c('0x8'));var fs=require('fs');var _=require(_0x8e8c('0x9'));var squel=require('squel');var crypto=require(_0x8e8c('0xa'));var jsforce=require(_0x8e8c('0xb'));var deskjs=require(_0x8e8c('0xc'));var toCsv=require(_0x8e8c('0xd'));var querystring=require(_0x8e8c('0xe'));var Papa=require(_0x8e8c('0xf'));var Redis=require('ioredis');var authService=require(_0x8e8c('0x10'));var qs=require(_0x8e8c('0x11'));var as=require(_0x8e8c('0x12'));var hardwareService=require(_0x8e8c('0x13'));var logger=require(_0x8e8c('0x14'))(_0x8e8c('0x15'));var utils=require(_0x8e8c('0x16'));var config=require(_0x8e8c('0x17'));var db=require(_0x8e8c('0x18'))['db'];function respondWithStatusCode(_0x3b0a48,_0x375030){_0x375030=_0x375030||0xcc;return function(_0xe83374){if(_0xe83374){return _0x3b0a48[_0x8e8c('0x19')](_0x375030);}return _0x3b0a48['status'](_0x375030)[_0x8e8c('0x1a')]();};}function respondWithResult(_0x55fde3,_0x25b8bf){_0x25b8bf=_0x25b8bf||0xc8;return function(_0x465b08){if(_0x465b08){return _0x55fde3[_0x8e8c('0x1b')](_0x25b8bf)[_0x8e8c('0x1c')](_0x465b08);}};}function respondWithFilteredResult(_0x4d6e0c,_0x12cbbc){return function(_0x26400f){if(_0x26400f){var _0x4a3302=_0x26400f['count'],_0x2196d4=_0x12cbbc[_0x8e8c('0x1d')],_0x28dae5=_0x12cbbc[_0x8e8c('0x1d')]+_0x12cbbc[_0x8e8c('0x1e')],_0x1fe98e;if(_0x28dae5>=_0x4a3302){_0x28dae5=_0x4a3302;_0x1fe98e=0xc8;}else{_0x1fe98e=0xce;}_0x4d6e0c['status'](_0x1fe98e);return _0x4d6e0c[_0x8e8c('0x1f')](_0x8e8c('0x20'),_0x2196d4+'-'+_0x28dae5+'/'+_0x4a3302)['json'](_0x26400f);}return null;};}function patchUpdates(_0x2f8626){return function(_0x44d4f1){try{jsonpatch[_0x8e8c('0x21')](_0x44d4f1,_0x2f8626,!![]);}catch(_0x569a12){return BPromise[_0x8e8c('0x22')](_0x569a12);}return _0x44d4f1[_0x8e8c('0x23')]();};}function saveUpdates(_0x318a27,_0x1464fb){return function(_0x18d2a2){if(_0x18d2a2){return _0x18d2a2[_0x8e8c('0x24')](_0x318a27)[_0x8e8c('0x25')](function(_0x457aed){return _0x457aed;});}return null;};}function removeEntity(_0x35b956,_0x15dcff){return function(_0x431244){if(_0x431244){return _0x431244[_0x8e8c('0x26')]()[_0x8e8c('0x25')](function(){_0x35b956[_0x8e8c('0x1b')](0xcc)[_0x8e8c('0x1a')]();});}};}function handleEntityNotFound(_0x5123db,_0xe40b17){return function(_0x51ab94){if(!_0x51ab94){_0x5123db[_0x8e8c('0x19')](0x194);}return _0x51ab94;};}function handleError(_0x2d8d77,_0x5646d4){_0x5646d4=_0x5646d4||0x1f4;return function(_0x13efa3){logger[_0x8e8c('0x27')](_0x13efa3[_0x8e8c('0x28')]);if(_0x13efa3['name']){delete _0x13efa3['name'];}_0x2d8d77['status'](_0x5646d4)[_0x8e8c('0x29')](_0x13efa3);};}exports['index']=function(_0x398813,_0x3e8769){var _0x5494c3={},_0x4fa88={},_0x153202={'count':0x0,'rows':[]};var _0x2d2cc1=_['map'](db[_0x8e8c('0x2a')][_0x8e8c('0x2b')],function(_0x4d7dc5){return{'name':_0x4d7dc5[_0x8e8c('0x2c')],'type':_0x4d7dc5[_0x8e8c('0x2d')][_0x8e8c('0x2e')]};});_0x4fa88[_0x8e8c('0x2f')]=_[_0x8e8c('0x30')](_0x2d2cc1,_0x8e8c('0x31'));_0x4fa88[_0x8e8c('0x32')]=_[_0x8e8c('0x33')](_0x398813[_0x8e8c('0x32')]);_0x4fa88[_0x8e8c('0x34')]=_['intersection'](_0x4fa88[_0x8e8c('0x2f')],_0x4fa88[_0x8e8c('0x32')]);_0x5494c3[_0x8e8c('0x35')]=_['intersection'](_0x4fa88[_0x8e8c('0x2f')],qs[_0x8e8c('0x36')](_0x398813['query']['fields']));_0x5494c3[_0x8e8c('0x35')]=_0x5494c3[_0x8e8c('0x35')][_0x8e8c('0x37')]?_0x5494c3[_0x8e8c('0x35')]:_0x4fa88['model'];if(!_0x398813[_0x8e8c('0x32')][_0x8e8c('0x38')](_0x8e8c('0x39'))){_0x5494c3[_0x8e8c('0x1e')]=qs[_0x8e8c('0x1e')](_0x398813[_0x8e8c('0x32')][_0x8e8c('0x1e')]);_0x5494c3[_0x8e8c('0x1d')]=qs[_0x8e8c('0x1d')](_0x398813[_0x8e8c('0x32')]['offset']);}_0x5494c3['order']=qs[_0x8e8c('0x3a')](_0x398813[_0x8e8c('0x32')][_0x8e8c('0x3a')]);_0x5494c3[_0x8e8c('0x3b')]=qs[_0x8e8c('0x34')](_['pick'](_0x398813['query'],_0x4fa88['filters']),_0x2d2cc1);if(_0x398813[_0x8e8c('0x32')][_0x8e8c('0x3c')]){_0x5494c3[_0x8e8c('0x3b')]=_[_0x8e8c('0x3d')](_0x5494c3['where'],{'$or':_['map'](_0x2d2cc1,function(_0x29df88){if(_0x29df88[_0x8e8c('0x2d')]!==_0x8e8c('0x3e')){var _0x2512e5={};_0x2512e5[_0x29df88[_0x8e8c('0x31')]]={'$like':'%'+_0x398813['query'][_0x8e8c('0x3c')]+'%'};return _0x2512e5;}})});}_0x5494c3=_[_0x8e8c('0x3d')]({},_0x5494c3,_0x398813[_0x8e8c('0x3f')]);var _0x364104={'where':_0x5494c3[_0x8e8c('0x3b')]};return db['OpenchannelTransferReport'][_0x8e8c('0x40')](_0x364104)[_0x8e8c('0x25')](function(_0x2abe91){_0x153202[_0x8e8c('0x40')]=_0x2abe91;if(_0x398813[_0x8e8c('0x32')][_0x8e8c('0x41')]){_0x5494c3[_0x8e8c('0x42')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x8e8c('0x43')](_0x5494c3);})['then'](function(_0x2ed99e){_0x153202[_0x8e8c('0x44')]=_0x2ed99e;return _0x153202;})['then'](respondWithFilteredResult(_0x3e8769,_0x5494c3))[_0x8e8c('0x45')](handleError(_0x3e8769,null));};exports[_0x8e8c('0x46')]=function(_0x2bb9ba,_0x2ee611){var _0x1e57ff={'raw':!![],'where':{'id':_0x2bb9ba[_0x8e8c('0x47')]['id']}},_0x276e9b={};_0x276e9b[_0x8e8c('0x2f')]=_[_0x8e8c('0x33')](db[_0x8e8c('0x2a')][_0x8e8c('0x2b')]);_0x276e9b[_0x8e8c('0x32')]=_[_0x8e8c('0x33')](_0x2bb9ba[_0x8e8c('0x32')]);_0x276e9b[_0x8e8c('0x34')]=_['intersection'](_0x276e9b[_0x8e8c('0x2f')],_0x276e9b[_0x8e8c('0x32')]);_0x1e57ff[_0x8e8c('0x35')]=_['intersection'](_0x276e9b[_0x8e8c('0x2f')],qs[_0x8e8c('0x36')](_0x2bb9ba[_0x8e8c('0x32')][_0x8e8c('0x36')]));_0x1e57ff[_0x8e8c('0x35')]=_0x1e57ff[_0x8e8c('0x35')]['length']?_0x1e57ff[_0x8e8c('0x35')]:_0x276e9b[_0x8e8c('0x2f')];if(_0x2bb9ba[_0x8e8c('0x32')][_0x8e8c('0x41')]){_0x1e57ff['include']=[{'all':!![]}];}_0x1e57ff=_[_0x8e8c('0x3d')]({},_0x1e57ff,_0x2bb9ba[_0x8e8c('0x3f')]);return db['OpenchannelTransferReport'][_0x8e8c('0x48')](_0x1e57ff)[_0x8e8c('0x25')](handleEntityNotFound(_0x2ee611,null))[_0x8e8c('0x25')](respondWithResult(_0x2ee611,null))[_0x8e8c('0x45')](handleError(_0x2ee611,null));};exports[_0x8e8c('0x49')]=function(_0x5349e6,_0x9b6b6d){return db['OpenchannelTransferReport'][_0x8e8c('0x49')](_0x5349e6[_0x8e8c('0x4a')],{})[_0x8e8c('0x25')](respondWithResult(_0x9b6b6d,0xc9))[_0x8e8c('0x45')](handleError(_0x9b6b6d,null));};exports[_0x8e8c('0x24')]=function(_0x2f2c24,_0xae35cf){if(_0x2f2c24[_0x8e8c('0x4a')]['id']){delete _0x2f2c24[_0x8e8c('0x4a')]['id'];}return db['OpenchannelTransferReport'][_0x8e8c('0x48')]({'where':{'id':_0x2f2c24[_0x8e8c('0x47')]['id']}})['then'](handleEntityNotFound(_0xae35cf,null))[_0x8e8c('0x25')](saveUpdates(_0x2f2c24['body'],null))[_0x8e8c('0x25')](respondWithResult(_0xae35cf,null))[_0x8e8c('0x45')](handleError(_0xae35cf,null));};exports[_0x8e8c('0x26')]=function(_0x4c3f3e,_0x226039){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4c3f3e[_0x8e8c('0x47')]['id']}})[_0x8e8c('0x25')](handleEntityNotFound(_0x226039,null))[_0x8e8c('0x25')](removeEntity(_0x226039,null))[_0x8e8c('0x45')](handleError(_0x226039,null));};exports['describe']=function(_0x12c36d,_0x56645a){return db[_0x8e8c('0x2a')][_0x8e8c('0x4b')]()[_0x8e8c('0x25')](respondWithResult(_0x56645a,null))[_0x8e8c('0x45')](handleError(_0x56645a,null));}; \ No newline at end of file +var _0xdd28=['end','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status'];(function(_0x232584,_0x24bcd7){var _0x3a41c7=function(_0x384a11){while(--_0x384a11){_0x232584['push'](_0x232584['shift']());}};_0x3a41c7(++_0x24bcd7);}(_0xdd28,0x1eb));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8dd2('0x0'));var emlformat=require(_0x8dd2('0x1'));var rimraf=require(_0x8dd2('0x2'));var zipdir=require(_0x8dd2('0x3'));var jsonpatch=require(_0x8dd2('0x4'));var rp=require(_0x8dd2('0x5'));var moment=require(_0x8dd2('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8dd2('0x7'));var sox=require(_0x8dd2('0x8'));var csv=require('to-csv');var ejs=require(_0x8dd2('0x9'));var fs=require('fs');var _=require(_0x8dd2('0xa'));var squel=require(_0x8dd2('0xb'));var crypto=require(_0x8dd2('0xc'));var jsforce=require(_0x8dd2('0xd'));var deskjs=require(_0x8dd2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8dd2('0xf'));var Papa=require(_0x8dd2('0x10'));var Redis=require(_0x8dd2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8dd2('0x12'));var as=require(_0x8dd2('0x13'));var hardwareService=require(_0x8dd2('0x14'));var logger=require(_0x8dd2('0x15'))(_0x8dd2('0x16'));var utils=require(_0x8dd2('0x17'));var config=require(_0x8dd2('0x18'));var db=require(_0x8dd2('0x19'))['db'];function respondWithStatusCode(_0x4652f1,_0x2e7e7e){_0x2e7e7e=_0x2e7e7e||0xcc;return function(_0x480d1b){if(_0x480d1b){return _0x4652f1['sendStatus'](_0x2e7e7e);}return _0x4652f1[_0x8dd2('0x1a')](_0x2e7e7e)[_0x8dd2('0x1b')]();};}function respondWithResult(_0x399c85,_0x5530d6){_0x5530d6=_0x5530d6||0xc8;return function(_0x556c3e){if(_0x556c3e){return _0x399c85['status'](_0x5530d6)['json'](_0x556c3e);}};}function respondWithFilteredResult(_0x2d2476,_0x559baa){return function(_0x124b7c){if(_0x124b7c){var _0x285060=_0x124b7c[_0x8dd2('0x1c')],_0x1bed3d=_0x559baa[_0x8dd2('0x1d')],_0x28f1db=_0x559baa[_0x8dd2('0x1d')]+_0x559baa[_0x8dd2('0x1e')],_0x5a766c;if(_0x28f1db>=_0x285060){_0x28f1db=_0x285060;_0x5a766c=0xc8;}else{_0x5a766c=0xce;}_0x2d2476[_0x8dd2('0x1a')](_0x5a766c);return _0x2d2476[_0x8dd2('0x1f')](_0x8dd2('0x20'),_0x1bed3d+'-'+_0x28f1db+'/'+_0x285060)['json'](_0x124b7c);}return null;};}function patchUpdates(_0x4772d5){return function(_0x1d4684){try{jsonpatch['apply'](_0x1d4684,_0x4772d5,!![]);}catch(_0x5091c6){return BPromise[_0x8dd2('0x21')](_0x5091c6);}return _0x1d4684[_0x8dd2('0x22')]();};}function saveUpdates(_0x3f7f3f,_0xddf157){return function(_0x1b223c){if(_0x1b223c){return _0x1b223c['update'](_0x3f7f3f)[_0x8dd2('0x23')](function(_0x408d7f){return _0x408d7f;});}return null;};}function removeEntity(_0x3a92e1,_0x498ddf){return function(_0x57f54f){if(_0x57f54f){return _0x57f54f[_0x8dd2('0x24')]()[_0x8dd2('0x23')](function(){_0x3a92e1[_0x8dd2('0x1a')](0xcc)[_0x8dd2('0x1b')]();});}};}function handleEntityNotFound(_0x47bdc8,_0x2b48e5){return function(_0x302ebf){if(!_0x302ebf){_0x47bdc8[_0x8dd2('0x25')](0x194);}return _0x302ebf;};}function handleError(_0x31158e,_0x1ff907){_0x1ff907=_0x1ff907||0x1f4;return function(_0x535175){logger[_0x8dd2('0x26')](_0x535175[_0x8dd2('0x27')]);if(_0x535175['name']){delete _0x535175[_0x8dd2('0x28')];}_0x31158e[_0x8dd2('0x1a')](_0x1ff907)[_0x8dd2('0x29')](_0x535175);};}exports[_0x8dd2('0x2a')]=function(_0x4cc954,_0x4e6429){var _0x359fc7={},_0x42d8e3={},_0x455131={'count':0x0,'rows':[]};var _0x1f725c=_[_0x8dd2('0x2b')](db[_0x8dd2('0x2c')][_0x8dd2('0x2d')],function(_0x4dbe18){return{'name':_0x4dbe18['fieldName'],'type':_0x4dbe18['type']['key']};});_0x42d8e3[_0x8dd2('0x2e')]=_[_0x8dd2('0x2b')](_0x1f725c,_0x8dd2('0x28'));_0x42d8e3[_0x8dd2('0x2f')]=_['keys'](_0x4cc954['query']);_0x42d8e3['filters']=_[_0x8dd2('0x30')](_0x42d8e3[_0x8dd2('0x2e')],_0x42d8e3[_0x8dd2('0x2f')]);_0x359fc7['attributes']=_[_0x8dd2('0x30')](_0x42d8e3[_0x8dd2('0x2e')],qs[_0x8dd2('0x31')](_0x4cc954[_0x8dd2('0x2f')][_0x8dd2('0x31')]));_0x359fc7[_0x8dd2('0x32')]=_0x359fc7[_0x8dd2('0x32')]['length']?_0x359fc7['attributes']:_0x42d8e3[_0x8dd2('0x2e')];if(!_0x4cc954[_0x8dd2('0x2f')][_0x8dd2('0x33')](_0x8dd2('0x34'))){_0x359fc7[_0x8dd2('0x1e')]=qs[_0x8dd2('0x1e')](_0x4cc954[_0x8dd2('0x2f')]['limit']);_0x359fc7['offset']=qs[_0x8dd2('0x1d')](_0x4cc954[_0x8dd2('0x2f')]['offset']);}_0x359fc7['order']=qs[_0x8dd2('0x35')](_0x4cc954[_0x8dd2('0x2f')][_0x8dd2('0x35')]);_0x359fc7[_0x8dd2('0x36')]=qs['filters'](_[_0x8dd2('0x37')](_0x4cc954[_0x8dd2('0x2f')],_0x42d8e3[_0x8dd2('0x38')]),_0x1f725c);if(_0x4cc954['query']['filter']){_0x359fc7[_0x8dd2('0x36')]=_[_0x8dd2('0x39')](_0x359fc7[_0x8dd2('0x36')],{'$or':_[_0x8dd2('0x2b')](_0x1f725c,function(_0x4619d5){if(_0x4619d5[_0x8dd2('0x3a')]!==_0x8dd2('0x3b')){var _0x265e64={};_0x265e64[_0x4619d5[_0x8dd2('0x28')]]={'$like':'%'+_0x4cc954[_0x8dd2('0x2f')][_0x8dd2('0x3c')]+'%'};return _0x265e64;}})});}_0x359fc7=_[_0x8dd2('0x39')]({},_0x359fc7,_0x4cc954[_0x8dd2('0x3d')]);var _0x3b5726={'where':_0x359fc7[_0x8dd2('0x36')]};return db[_0x8dd2('0x2c')][_0x8dd2('0x1c')](_0x3b5726)['then'](function(_0x280564){_0x455131['count']=_0x280564;if(_0x4cc954['query'][_0x8dd2('0x3e')]){_0x359fc7[_0x8dd2('0x3f')]=[{'all':!![]}];}return db[_0x8dd2('0x2c')][_0x8dd2('0x40')](_0x359fc7);})[_0x8dd2('0x23')](function(_0xf55005){_0x455131['rows']=_0xf55005;return _0x455131;})[_0x8dd2('0x23')](respondWithFilteredResult(_0x4e6429,_0x359fc7))[_0x8dd2('0x41')](handleError(_0x4e6429,null));};exports[_0x8dd2('0x42')]=function(_0x1c0238,_0xa98ead){var _0x334a2d={'raw':!![],'where':{'id':_0x1c0238[_0x8dd2('0x43')]['id']}},_0x2480bf={};_0x2480bf[_0x8dd2('0x2e')]=_[_0x8dd2('0x44')](db[_0x8dd2('0x2c')][_0x8dd2('0x2d')]);_0x2480bf[_0x8dd2('0x2f')]=_['keys'](_0x1c0238[_0x8dd2('0x2f')]);_0x2480bf[_0x8dd2('0x38')]=_[_0x8dd2('0x30')](_0x2480bf[_0x8dd2('0x2e')],_0x2480bf[_0x8dd2('0x2f')]);_0x334a2d[_0x8dd2('0x32')]=_[_0x8dd2('0x30')](_0x2480bf[_0x8dd2('0x2e')],qs[_0x8dd2('0x31')](_0x1c0238[_0x8dd2('0x2f')][_0x8dd2('0x31')]));_0x334a2d['attributes']=_0x334a2d['attributes'][_0x8dd2('0x45')]?_0x334a2d['attributes']:_0x2480bf['model'];if(_0x1c0238[_0x8dd2('0x2f')][_0x8dd2('0x3e')]){_0x334a2d[_0x8dd2('0x3f')]=[{'all':!![]}];}_0x334a2d=_[_0x8dd2('0x39')]({},_0x334a2d,_0x1c0238[_0x8dd2('0x3d')]);return db['OpenchannelTransferReport'][_0x8dd2('0x46')](_0x334a2d)[_0x8dd2('0x23')](handleEntityNotFound(_0xa98ead,null))[_0x8dd2('0x23')](respondWithResult(_0xa98ead,null))[_0x8dd2('0x41')](handleError(_0xa98ead,null));};exports['create']=function(_0x3df299,_0x42096d){return db[_0x8dd2('0x2c')][_0x8dd2('0x47')](_0x3df299[_0x8dd2('0x48')],{})['then'](respondWithResult(_0x42096d,0xc9))[_0x8dd2('0x41')](handleError(_0x42096d,null));};exports['update']=function(_0x385c7d,_0x5563f4){if(_0x385c7d['body']['id']){delete _0x385c7d[_0x8dd2('0x48')]['id'];}return db[_0x8dd2('0x2c')][_0x8dd2('0x46')]({'where':{'id':_0x385c7d[_0x8dd2('0x43')]['id']}})[_0x8dd2('0x23')](handleEntityNotFound(_0x5563f4,null))[_0x8dd2('0x23')](saveUpdates(_0x385c7d[_0x8dd2('0x48')],null))[_0x8dd2('0x23')](respondWithResult(_0x5563f4,null))[_0x8dd2('0x41')](handleError(_0x5563f4,null));};exports[_0x8dd2('0x24')]=function(_0xb7a109,_0x4c5009){return db['OpenchannelTransferReport'][_0x8dd2('0x46')]({'where':{'id':_0xb7a109['params']['id']}})['then'](handleEntityNotFound(_0x4c5009,null))[_0x8dd2('0x23')](removeEntity(_0x4c5009,null))[_0x8dd2('0x41')](handleError(_0x4c5009,null));};exports[_0x8dd2('0x49')]=function(_0x567ebf,_0x5ce3a7){return db[_0x8dd2('0x2c')]['describe']()[_0x8dd2('0x23')](respondWithResult(_0x5ce3a7,null))[_0x8dd2('0x41')](handleError(_0x5ce3a7,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4a7abf0..6cda33b 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 _0xdb7e=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport'];(function(_0x350b36,_0x5c3f6a){var _0x3258e2=function(_0x405da9){while(--_0x405da9){_0x350b36['push'](_0x350b36['shift']());}};_0x3258e2(++_0x5c3f6a);}(_0xdb7e,0x11a));var _0xedb7=function(_0x571a11,_0x1007bf){_0x571a11=_0x571a11-0x0;var _0x2a39ea=_0xdb7e[_0x571a11];return _0x2a39ea;};'use strict';var _=require(_0xedb7('0x0'));var util=require(_0xedb7('0x1'));var logger=require(_0xedb7('0x2'))('api');var moment=require(_0xedb7('0x3'));var BPromise=require(_0xedb7('0x4'));var rp=require(_0xedb7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xedb7('0x6'));var config=require(_0xedb7('0x7'));var attributes=require(_0xedb7('0x8'));module[_0xedb7('0x9')]=function(_0xea2925,_0x153a3a){return _0xea2925[_0xedb7('0xa')](_0xedb7('0xb'),attributes,{'tableName':_0xedb7('0xc'),'paranoid':![],'indexes':[{'name':_0xedb7('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe928=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x185a62,_0x4c2d00){var _0x3e88bb=function(_0x7d6b1d){while(--_0x7d6b1d){_0x185a62['push'](_0x185a62['shift']());}};_0x3e88bb(++_0x4c2d00);}(_0xe928,0x145));var _0x8e92=function(_0x3979db,_0x27398b){_0x3979db=_0x3979db-0x0;var _0x1de1c3=_0xe928[_0x3979db];return _0x1de1c3;};'use strict';var _=require(_0x8e92('0x0'));var util=require(_0x8e92('0x1'));var logger=require(_0x8e92('0x2'))('api');var moment=require(_0x8e92('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e92('0x4'));var fs=require('fs');var path=require(_0x8e92('0x5'));var rimraf=require(_0x8e92('0x6'));var config=require(_0x8e92('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x8e92('0x8')]=function(_0x50cf8a,_0x2d938d){return _0x50cf8a[_0x8e92('0x9')](_0x8e92('0xa'),attributes,{'tableName':_0x8e92('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8e92('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 0d473d9..af7fc1e 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 _0x57c2=['error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x57c2,0x113));var _0x257c=function(_0x2011c3,_0x2ce439){_0x2011c3=_0x2011c3-0x0;var _0x363b12=_0x57c2[_0x2011c3];return _0x363b12;};'use strict';var _=require(_0x257c('0x0'));var util=require('util');var moment=require(_0x257c('0x1'));var BPromise=require(_0x257c('0x2'));var rs=require(_0x257c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x257c('0x4'))['db'];var utils=require(_0x257c('0x5'));var logger=require('../../config/logger')(_0x257c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x257c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dad00,_0x38326f,_0x5cfd3a){return new BPromise(function(_0x312f0a,_0x1f9b93){return client[_0x257c('0x8')](_0x5dad00,_0x5cfd3a)['then'](function(_0x503b61){logger['info'](_0x257c('0x9'),_0x38326f,_0x257c('0xa'));logger[_0x257c('0xb')](_0x257c('0xc'),_0x38326f,_0x257c('0xa'),JSON['stringify'](_0x503b61));if(_0x503b61[_0x257c('0xd')]){if(_0x503b61['error'][_0x257c('0xe')]===0x1f4){logger[_0x257c('0xd')](_0x257c('0x9'),_0x38326f,_0x503b61[_0x257c('0xd')]['message']);return _0x1f9b93(_0x503b61[_0x257c('0xd')][_0x257c('0xf')]);}logger['error'](_0x257c('0x9'),_0x38326f,_0x503b61[_0x257c('0xd')][_0x257c('0xf')]);return _0x312f0a(_0x503b61[_0x257c('0xd')][_0x257c('0xf')]);}else{logger[_0x257c('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38326f,_0x257c('0xa'));_0x312f0a(_0x503b61['result'][_0x257c('0xf')]);}})[_0x257c('0x11')](function(_0x19750d){logger[_0x257c('0xd')](_0x257c('0x9'),_0x38326f,_0x19750d);_0x1f9b93(_0x19750d);});});} \ No newline at end of file +var _0x74c3=['request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4c3349,_0x38feb8){var _0x5b596b=function(_0xad68b7){while(--_0xad68b7){_0x4c3349['push'](_0x4c3349['shift']());}};_0x5b596b(++_0x38feb8);}(_0x74c3,0x16c));var _0x374c=function(_0x229702,_0x40947d){_0x229702=_0x229702-0x0;var _0x1901af=_0x74c3[_0x229702];return _0x1901af;};'use strict';var _=require(_0x374c('0x0'));var util=require(_0x374c('0x1'));var moment=require('moment');var BPromise=require(_0x374c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x374c('0x3'));var logger=require(_0x374c('0x4'))(_0x374c('0x5'));var config=require(_0x374c('0x6'));var jayson=require(_0x374c('0x7'));var client=jayson[_0x374c('0x8')][_0x374c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e4b35,_0x521ead,_0x2370be){return new BPromise(function(_0xa9bfcf,_0x2051d9){return client[_0x374c('0xa')](_0x1e4b35,_0x2370be)[_0x374c('0xb')](function(_0x4b9411){logger['info'](_0x374c('0xc'),_0x521ead,'request\x20sent');logger[_0x374c('0xd')](_0x374c('0xe'),_0x521ead,_0x374c('0xf'),JSON[_0x374c('0x10')](_0x4b9411));if(_0x4b9411[_0x374c('0x11')]){if(_0x4b9411[_0x374c('0x11')]['code']===0x1f4){logger[_0x374c('0x11')](_0x374c('0xc'),_0x521ead,_0x4b9411[_0x374c('0x11')][_0x374c('0x12')]);return _0x2051d9(_0x4b9411[_0x374c('0x11')][_0x374c('0x12')]);}logger[_0x374c('0x11')](_0x374c('0xc'),_0x521ead,_0x4b9411[_0x374c('0x11')]['message']);return _0xa9bfcf(_0x4b9411[_0x374c('0x11')][_0x374c('0x12')]);}else{logger[_0x374c('0x13')](_0x374c('0xc'),_0x521ead,_0x374c('0xf'));_0xa9bfcf(_0x4b9411[_0x374c('0x14')][_0x374c('0x12')]);}})[_0x374c('0x15')](function(_0x1f7854){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x521ead,_0x1f7854);_0x2051d9(_0x1f7854);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index e9258e9..e5fa7f3 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 _0x3d95=['get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x5250ee,_0x46e3ed){var _0x83882a=function(_0x59566f){while(--_0x59566f){_0x5250ee['push'](_0x5250ee['shift']());}};_0x83882a(++_0x46e3ed);}(_0x3d95,0x82));var _0x53d9=function(_0x51759e,_0x45fcf8){_0x51759e=_0x51759e-0x0;var _0x384ec7=_0x3d95[_0x51759e];return _0x384ec7;};'use strict';var multer=require(_0x53d9('0x0'));var util=require(_0x53d9('0x1'));var path=require(_0x53d9('0x2'));var timeout=require(_0x53d9('0x3'));var express=require(_0x53d9('0x4'));var router=express[_0x53d9('0x5')]();var auth=require(_0x53d9('0x6'));var interaction=require(_0x53d9('0x7'));var config=require(_0x53d9('0x8'));var controller=require(_0x53d9('0x9'));router[_0x53d9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x53d9('0xa')](_0x53d9('0xb'),auth[_0x53d9('0xc')](),controller[_0x53d9('0xd')]);router[_0x53d9('0xe')]('/',auth[_0x53d9('0xc')](),controller[_0x53d9('0xf')]);router[_0x53d9('0x10')](_0x53d9('0xb'),auth[_0x53d9('0xc')](),controller[_0x53d9('0x11')]);router['delete']('/:id',auth[_0x53d9('0xc')](),controller[_0x53d9('0x12')]);module[_0x53d9('0x13')]=router; \ No newline at end of file +var _0xbc7c=['destroy','../../components/auth/service','../../components/interaction/service','./pause.controller','get','/:id','post','create','put','isAuthenticated'];(function(_0x466326,_0x254adc){var _0x54ed19=function(_0x55295f){while(--_0x55295f){_0x466326['push'](_0x466326['shift']());}};_0x54ed19(++_0x254adc);}(_0xbc7c,0x155));var _0xcbc7=function(_0xd4e6b4,_0x14394e){_0xd4e6b4=_0xd4e6b4-0x0;var _0x63f282=_0xbc7c[_0xd4e6b4];return _0x63f282;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xcbc7('0x0'));var interaction=require(_0xcbc7('0x1'));var config=require('../../config/environment');var controller=require(_0xcbc7('0x2'));router[_0xcbc7('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcbc7('0x3')](_0xcbc7('0x4'),auth['isAuthenticated'](),controller['show']);router[_0xcbc7('0x5')]('/',auth['isAuthenticated'](),controller[_0xcbc7('0x6')]);router[_0xcbc7('0x7')]('/:id',auth[_0xcbc7('0x8')](),controller['update']);router['delete'](_0xcbc7('0x4'),auth[_0xcbc7('0x8')](),controller[_0xcbc7('0x9')]);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 5e324b0..813236c 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 _0xabf6=['STRING','sequelize','exports'];(function(_0x4fbbfd,_0x40823a){var _0x1f761c=function(_0x404e7e){while(--_0x404e7e){_0x4fbbfd['push'](_0x4fbbfd['shift']());}};_0x1f761c(++_0x40823a);}(_0xabf6,0xb5));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6abf('0x0'));module[_0x6abf('0x1')]={'name':{'type':Sequelize[_0x6abf('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x6abf('0x2')]}}; \ No newline at end of file +var _0x9cca=['exports','name','STRING'];(function(_0x15d35c,_0x5ad523){var _0x1913fa=function(_0x388365){while(--_0x388365){_0x15d35c['push'](_0x15d35c['shift']());}};_0x1913fa(++_0x5ad523);}(_0x9cca,0x156));var _0xa9cc=function(_0xc8accf,_0x12b987){_0xc8accf=_0xc8accf-0x0;var _0x4364b7=_0x9cca[_0xc8accf];return _0x4364b7;};'use strict';var Sequelize=require('sequelize');module[_0xa9cc('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa9cc('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xa9cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 0d4b72a..9ab48dc 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 _0xf008=['attributes','length','nolimit','limit','order','sort','pick','where','VIRTUAL','merge','options','Pause','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','fields'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xf008,0x6b));var _0x8f00=function(_0x3b2769,_0x2f3e04){_0x3b2769=_0x3b2769-0x0;var _0x56ba95=_0xf008[_0x3b2769];return _0x56ba95;};'use strict';var pdf=require(_0x8f00('0x0'));var emlformat=require(_0x8f00('0x1'));var rimraf=require(_0x8f00('0x2'));var zipdir=require(_0x8f00('0x3'));var jsonpatch=require(_0x8f00('0x4'));var rp=require(_0x8f00('0x5'));var moment=require(_0x8f00('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8f00('0x7'));var util=require('util');var path=require(_0x8f00('0x8'));var sox=require(_0x8f00('0x9'));var csv=require(_0x8f00('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8f00('0xb'));var jsforce=require(_0x8f00('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8f00('0xa'));var querystring=require(_0x8f00('0xd'));var Papa=require(_0x8f00('0xe'));var Redis=require(_0x8f00('0xf'));var authService=require(_0x8f00('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8f00('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f00('0x12'));var utils=require('../../config/utils');var config=require(_0x8f00('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x168b48,_0x40b69d){_0x40b69d=_0x40b69d||0xcc;return function(_0x2d9e76){if(_0x2d9e76){return _0x168b48[_0x8f00('0x14')](_0x40b69d);}return _0x168b48[_0x8f00('0x15')](_0x40b69d)[_0x8f00('0x16')]();};}function respondWithResult(_0x50d9e8,_0x273c2e){_0x273c2e=_0x273c2e||0xc8;return function(_0x39e953){if(_0x39e953){return _0x50d9e8['status'](_0x273c2e)[_0x8f00('0x17')](_0x39e953);}};}function respondWithFilteredResult(_0x5df630,_0x254b5a){return function(_0x5f20ae){if(_0x5f20ae){var _0x4ecac2=_0x5f20ae[_0x8f00('0x18')],_0x3f2daf=_0x254b5a[_0x8f00('0x19')],_0x4a30db=_0x254b5a[_0x8f00('0x19')]+_0x254b5a['limit'],_0x24d02b;if(_0x4a30db>=_0x4ecac2){_0x4a30db=_0x4ecac2;_0x24d02b=0xc8;}else{_0x24d02b=0xce;}_0x5df630[_0x8f00('0x15')](_0x24d02b);return _0x5df630[_0x8f00('0x1a')](_0x8f00('0x1b'),_0x3f2daf+'-'+_0x4a30db+'/'+_0x4ecac2)['json'](_0x5f20ae);}return null;};}function patchUpdates(_0x2e4cad){return function(_0x5d99a0){try{jsonpatch[_0x8f00('0x1c')](_0x5d99a0,_0x2e4cad,!![]);}catch(_0x56b82c){return BPromise['reject'](_0x56b82c);}return _0x5d99a0[_0x8f00('0x1d')]();};}function saveUpdates(_0x4962f4,_0x47e5ad){return function(_0x25297f){if(_0x25297f){return _0x25297f[_0x8f00('0x1e')](_0x4962f4)[_0x8f00('0x1f')](function(_0x127a74){return _0x127a74;});}return null;};}function removeEntity(_0x34f6d7,_0x4ca955){return function(_0x4424ac){if(_0x4424ac){return _0x4424ac[_0x8f00('0x20')]()[_0x8f00('0x1f')](function(){var _0x306a0a=_0x4424ac[_0x8f00('0x21')]({'plain':!![]});var _0x58f1bf=_0x8f00('0x22');return db[_0x8f00('0x23')][_0x8f00('0x20')]({'where':{'type':_0x58f1bf,'resourceId':_0x306a0a['id']}})[_0x8f00('0x1f')](function(){return _0x4424ac;});})[_0x8f00('0x1f')](function(){_0x34f6d7[_0x8f00('0x15')](0xcc)[_0x8f00('0x16')]();});}};}function handleEntityNotFound(_0x1d0379,_0x1d873b){return function(_0x5b5543){if(!_0x5b5543){_0x1d0379[_0x8f00('0x14')](0x194);}return _0x5b5543;};}function handleError(_0x29c77c,_0x2a1bd5){_0x2a1bd5=_0x2a1bd5||0x1f4;return function(_0x17f851){logger[_0x8f00('0x24')](_0x17f851[_0x8f00('0x25')]);if(_0x17f851['name']){delete _0x17f851['name'];}_0x29c77c[_0x8f00('0x15')](_0x2a1bd5)['send'](_0x17f851);};}exports[_0x8f00('0x26')]=function(_0x59d3c0,_0x11273a){var _0x690a5={},_0x43bdbb={},_0x552665={'count':0x0,'rows':[]};var _0x210cad=_[_0x8f00('0x27')](db['Pause'][_0x8f00('0x28')],function(_0x59648e){return{'name':_0x59648e[_0x8f00('0x29')],'type':_0x59648e[_0x8f00('0x2a')][_0x8f00('0x2b')]};});_0x43bdbb['model']=_['map'](_0x210cad,_0x8f00('0x2c'));_0x43bdbb['query']=_[_0x8f00('0x2d')](_0x59d3c0[_0x8f00('0x2e')]);_0x43bdbb[_0x8f00('0x2f')]=_[_0x8f00('0x30')](_0x43bdbb[_0x8f00('0x31')],_0x43bdbb[_0x8f00('0x2e')]);_0x690a5['attributes']=_[_0x8f00('0x30')](_0x43bdbb['model'],qs[_0x8f00('0x32')](_0x59d3c0[_0x8f00('0x2e')][_0x8f00('0x32')]));_0x690a5[_0x8f00('0x33')]=_0x690a5[_0x8f00('0x33')][_0x8f00('0x34')]?_0x690a5[_0x8f00('0x33')]:_0x43bdbb['model'];if(!_0x59d3c0[_0x8f00('0x2e')]['hasOwnProperty'](_0x8f00('0x35'))){_0x690a5[_0x8f00('0x36')]=qs['limit'](_0x59d3c0['query'][_0x8f00('0x36')]);_0x690a5[_0x8f00('0x19')]=qs['offset'](_0x59d3c0[_0x8f00('0x2e')][_0x8f00('0x19')]);}_0x690a5[_0x8f00('0x37')]=qs[_0x8f00('0x38')](_0x59d3c0['query'][_0x8f00('0x38')]);_0x690a5['where']=qs['filters'](_[_0x8f00('0x39')](_0x59d3c0['query'],_0x43bdbb[_0x8f00('0x2f')]),_0x210cad);if(_0x59d3c0[_0x8f00('0x2e')]['filter']){_0x690a5[_0x8f00('0x3a')]=_['merge'](_0x690a5[_0x8f00('0x3a')],{'$or':_['map'](_0x210cad,function(_0x16ef4e){if(_0x16ef4e['type']!==_0x8f00('0x3b')){var _0x449a25={};_0x449a25[_0x16ef4e[_0x8f00('0x2c')]]={'$like':'%'+_0x59d3c0[_0x8f00('0x2e')]['filter']+'%'};return _0x449a25;}})});}_0x690a5=_[_0x8f00('0x3c')]({},_0x690a5,_0x59d3c0[_0x8f00('0x3d')]);var _0x3ab6a3={'where':_0x690a5['where']};return db[_0x8f00('0x3e')][_0x8f00('0x18')](_0x3ab6a3)[_0x8f00('0x1f')](function(_0x30aa7d){_0x552665['count']=_0x30aa7d;if(_0x59d3c0[_0x8f00('0x2e')][_0x8f00('0x3f')]){_0x690a5['include']=[{'all':!![]}];}return db[_0x8f00('0x3e')][_0x8f00('0x40')](_0x690a5);})[_0x8f00('0x1f')](function(_0x107df0){_0x552665[_0x8f00('0x41')]=_0x107df0;return _0x552665;})[_0x8f00('0x1f')](respondWithFilteredResult(_0x11273a,_0x690a5))[_0x8f00('0x42')](handleError(_0x11273a,null));};exports[_0x8f00('0x43')]=function(_0x1ca37a,_0x2f05d8){var _0xca0e8a={'raw':!![],'where':{'id':_0x1ca37a[_0x8f00('0x44')]['id']}},_0x14d018={};_0x14d018[_0x8f00('0x31')]=_[_0x8f00('0x2d')](db[_0x8f00('0x3e')][_0x8f00('0x28')]);_0x14d018[_0x8f00('0x2e')]=_[_0x8f00('0x2d')](_0x1ca37a[_0x8f00('0x2e')]);_0x14d018['filters']=_['intersection'](_0x14d018['model'],_0x14d018[_0x8f00('0x2e')]);_0xca0e8a['attributes']=_[_0x8f00('0x30')](_0x14d018[_0x8f00('0x31')],qs[_0x8f00('0x32')](_0x1ca37a['query'][_0x8f00('0x32')]));_0xca0e8a['attributes']=_0xca0e8a['attributes'][_0x8f00('0x34')]?_0xca0e8a['attributes']:_0x14d018[_0x8f00('0x31')];if(_0x1ca37a['query']['includeAll']){_0xca0e8a[_0x8f00('0x45')]=[{'all':!![]}];}_0xca0e8a=_[_0x8f00('0x3c')]({},_0xca0e8a,_0x1ca37a[_0x8f00('0x3d')]);return db[_0x8f00('0x3e')][_0x8f00('0x46')](_0xca0e8a)['then'](handleEntityNotFound(_0x2f05d8,null))[_0x8f00('0x1f')](respondWithResult(_0x2f05d8,null))[_0x8f00('0x42')](handleError(_0x2f05d8,null));};exports['create']=function(_0x5d94a3,_0x5e8100){return db['Pause'][_0x8f00('0x47')](_0x5d94a3[_0x8f00('0x48')],{})['then'](function(_0x546604){var _0x39f956=_0x5d94a3[_0x8f00('0x49')]['get']({'plain':!![]});if(!_0x39f956)throw new Error(_0x8f00('0x4a'));if(_0x39f956[_0x8f00('0x4b')]===_0x8f00('0x49')){var _0x185e9f=_0x546604['get']({'plain':!![]});var _0x27959f='Pauses';return db['UserProfileSection'][_0x8f00('0x46')]({'where':{'name':_0x27959f,'userProfileId':_0x39f956[_0x8f00('0x4c')]},'raw':!![]})['then'](function(_0x1da874){if(_0x1da874&&_0x1da874[_0x8f00('0x4d')]===0x0){return db['UserProfileResource'][_0x8f00('0x47')]({'name':_0x185e9f['name'],'resourceId':_0x185e9f['id'],'type':_0x1da874[_0x8f00('0x2c')],'sectionId':_0x1da874['id']},{})[_0x8f00('0x1f')](function(){return _0x546604;});}else{return _0x546604;}})[_0x8f00('0x42')](function(_0x3cd85e){logger[_0x8f00('0x24')](_0x8f00('0x4e'),_0x3cd85e);throw _0x3cd85e;});}return _0x546604;})[_0x8f00('0x1f')](respondWithResult(_0x5e8100,0xc9))['catch'](handleError(_0x5e8100,null));};exports[_0x8f00('0x1e')]=function(_0x416510,_0x29abf4){if(_0x416510[_0x8f00('0x48')]['id']){delete _0x416510[_0x8f00('0x48')]['id'];}return db[_0x8f00('0x3e')][_0x8f00('0x46')]({'where':{'id':_0x416510[_0x8f00('0x44')]['id']}})[_0x8f00('0x1f')](handleEntityNotFound(_0x29abf4,null))[_0x8f00('0x1f')](saveUpdates(_0x416510[_0x8f00('0x48')],null))[_0x8f00('0x1f')](respondWithResult(_0x29abf4,null))[_0x8f00('0x42')](handleError(_0x29abf4,null));};exports[_0x8f00('0x20')]=function(_0x1a41ef,_0x55ac9d){return db['Pause'][_0x8f00('0x46')]({'where':{'id':_0x1a41ef[_0x8f00('0x44')]['id']}})[_0x8f00('0x1f')](handleEntityNotFound(_0x55ac9d,null))[_0x8f00('0x1f')](removeEntity(_0x55ac9d,null))[_0x8f00('0x42')](handleError(_0x55ac9d,null));}; \ No newline at end of file +var _0x4536=['to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','UserProfileResource','name','send','index','map','Pause','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x134672,_0x84491e){var _0x4adf90=function(_0x371834){while(--_0x371834){_0x134672['push'](_0x134672['shift']());}};_0x4adf90(++_0x84491e);}(_0x4536,0x18a));var _0x6453=function(_0x5786f9,_0x59a148){_0x5786f9=_0x5786f9-0x0;var _0x22c3cf=_0x4536[_0x5786f9];return _0x22c3cf;};'use strict';var pdf=require(_0x6453('0x0'));var emlformat=require(_0x6453('0x1'));var rimraf=require(_0x6453('0x2'));var zipdir=require(_0x6453('0x3'));var jsonpatch=require(_0x6453('0x4'));var rp=require(_0x6453('0x5'));var moment=require(_0x6453('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6453('0x7'));var util=require(_0x6453('0x8'));var path=require(_0x6453('0x9'));var sox=require(_0x6453('0xa'));var csv=require(_0x6453('0xb'));var ejs=require(_0x6453('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6453('0xd'));var jsforce=require(_0x6453('0xe'));var deskjs=require(_0x6453('0xf'));var toCsv=require(_0x6453('0xb'));var querystring=require(_0x6453('0x10'));var Papa=require(_0x6453('0x11'));var Redis=require(_0x6453('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6453('0x13'))(_0x6453('0x14'));var utils=require(_0x6453('0x15'));var config=require(_0x6453('0x16'));var db=require(_0x6453('0x17'))['db'];function respondWithStatusCode(_0x9f9895,_0x295365){_0x295365=_0x295365||0xcc;return function(_0x4678af){if(_0x4678af){return _0x9f9895[_0x6453('0x18')](_0x295365);}return _0x9f9895['status'](_0x295365)[_0x6453('0x19')]();};}function respondWithResult(_0x52237c,_0x2505d5){_0x2505d5=_0x2505d5||0xc8;return function(_0x258494){if(_0x258494){return _0x52237c[_0x6453('0x1a')](_0x2505d5)[_0x6453('0x1b')](_0x258494);}};}function respondWithFilteredResult(_0x544054,_0x36f3d3){return function(_0x225fc8){if(_0x225fc8){var _0x44c20a=_0x225fc8[_0x6453('0x1c')],_0x566713=_0x36f3d3[_0x6453('0x1d')],_0x201db1=_0x36f3d3['offset']+_0x36f3d3[_0x6453('0x1e')],_0x43d0a4;if(_0x201db1>=_0x44c20a){_0x201db1=_0x44c20a;_0x43d0a4=0xc8;}else{_0x43d0a4=0xce;}_0x544054[_0x6453('0x1a')](_0x43d0a4);return _0x544054['set'](_0x6453('0x1f'),_0x566713+'-'+_0x201db1+'/'+_0x44c20a)['json'](_0x225fc8);}return null;};}function patchUpdates(_0x5265b9){return function(_0x47d886){try{jsonpatch[_0x6453('0x20')](_0x47d886,_0x5265b9,!![]);}catch(_0x1d503c){return BPromise[_0x6453('0x21')](_0x1d503c);}return _0x47d886['save']();};}function saveUpdates(_0x2fed84,_0x5130e1){return function(_0x2a25b4){if(_0x2a25b4){return _0x2a25b4[_0x6453('0x22')](_0x2fed84)[_0x6453('0x23')](function(_0x2367ad){return _0x2367ad;});}return null;};}function removeEntity(_0x14b1e9,_0x411563){return function(_0x5b32be){if(_0x5b32be){return _0x5b32be[_0x6453('0x24')]()[_0x6453('0x23')](function(){var _0xa1e8db=_0x5b32be['get']({'plain':!![]});var _0x4f978d='Pauses';return db[_0x6453('0x25')]['destroy']({'where':{'type':_0x4f978d,'resourceId':_0xa1e8db['id']}})[_0x6453('0x23')](function(){return _0x5b32be;});})[_0x6453('0x23')](function(){_0x14b1e9[_0x6453('0x1a')](0xcc)[_0x6453('0x19')]();});}};}function handleEntityNotFound(_0x3283c8,_0x2de9f3){return function(_0x291062){if(!_0x291062){_0x3283c8[_0x6453('0x18')](0x194);}return _0x291062;};}function handleError(_0x168c24,_0x2f0cec){_0x2f0cec=_0x2f0cec||0x1f4;return function(_0x2c6ebf){logger['error'](_0x2c6ebf['stack']);if(_0x2c6ebf[_0x6453('0x26')]){delete _0x2c6ebf[_0x6453('0x26')];}_0x168c24['status'](_0x2f0cec)[_0x6453('0x27')](_0x2c6ebf);};}exports[_0x6453('0x28')]=function(_0x48ad2e,_0x33afc1){var _0x1068ce={},_0x4e3002={},_0x523c51={'count':0x0,'rows':[]};var _0x569d92=_[_0x6453('0x29')](db[_0x6453('0x2a')]['rawAttributes'],function(_0x5e5762){return{'name':_0x5e5762[_0x6453('0x2b')],'type':_0x5e5762['type'][_0x6453('0x2c')]};});_0x4e3002['model']=_[_0x6453('0x29')](_0x569d92,_0x6453('0x26'));_0x4e3002[_0x6453('0x2d')]=_[_0x6453('0x2e')](_0x48ad2e[_0x6453('0x2d')]);_0x4e3002[_0x6453('0x2f')]=_['intersection'](_0x4e3002[_0x6453('0x30')],_0x4e3002[_0x6453('0x2d')]);_0x1068ce[_0x6453('0x31')]=_[_0x6453('0x32')](_0x4e3002['model'],qs[_0x6453('0x33')](_0x48ad2e[_0x6453('0x2d')]['fields']));_0x1068ce[_0x6453('0x31')]=_0x1068ce[_0x6453('0x31')][_0x6453('0x34')]?_0x1068ce[_0x6453('0x31')]:_0x4e3002['model'];if(!_0x48ad2e[_0x6453('0x2d')][_0x6453('0x35')](_0x6453('0x36'))){_0x1068ce[_0x6453('0x1e')]=qs['limit'](_0x48ad2e[_0x6453('0x2d')]['limit']);_0x1068ce['offset']=qs['offset'](_0x48ad2e['query']['offset']);}_0x1068ce[_0x6453('0x37')]=qs[_0x6453('0x38')](_0x48ad2e[_0x6453('0x2d')][_0x6453('0x38')]);_0x1068ce[_0x6453('0x39')]=qs[_0x6453('0x2f')](_['pick'](_0x48ad2e[_0x6453('0x2d')],_0x4e3002[_0x6453('0x2f')]),_0x569d92);if(_0x48ad2e['query']['filter']){_0x1068ce[_0x6453('0x39')]=_[_0x6453('0x3a')](_0x1068ce[_0x6453('0x39')],{'$or':_[_0x6453('0x29')](_0x569d92,function(_0x238e84){if(_0x238e84[_0x6453('0x3b')]!=='VIRTUAL'){var _0x581e31={};_0x581e31[_0x238e84[_0x6453('0x26')]]={'$like':'%'+_0x48ad2e['query']['filter']+'%'};return _0x581e31;}})});}_0x1068ce=_[_0x6453('0x3a')]({},_0x1068ce,_0x48ad2e['options']);var _0xa68578={'where':_0x1068ce['where']};return db['Pause']['count'](_0xa68578)[_0x6453('0x23')](function(_0x1f53c1){_0x523c51['count']=_0x1f53c1;if(_0x48ad2e[_0x6453('0x2d')][_0x6453('0x3c')]){_0x1068ce[_0x6453('0x3d')]=[{'all':!![]}];}return db[_0x6453('0x2a')][_0x6453('0x3e')](_0x1068ce);})[_0x6453('0x23')](function(_0x5c1400){_0x523c51['rows']=_0x5c1400;return _0x523c51;})['then'](respondWithFilteredResult(_0x33afc1,_0x1068ce))[_0x6453('0x3f')](handleError(_0x33afc1,null));};exports[_0x6453('0x40')]=function(_0x18eb6c,_0x417e39){var _0xa8f8f1={'raw':!![],'where':{'id':_0x18eb6c[_0x6453('0x41')]['id']}},_0x1ff7e2={};_0x1ff7e2['model']=_[_0x6453('0x2e')](db[_0x6453('0x2a')][_0x6453('0x42')]);_0x1ff7e2[_0x6453('0x2d')]=_[_0x6453('0x2e')](_0x18eb6c['query']);_0x1ff7e2['filters']=_[_0x6453('0x32')](_0x1ff7e2[_0x6453('0x30')],_0x1ff7e2[_0x6453('0x2d')]);_0xa8f8f1['attributes']=_['intersection'](_0x1ff7e2['model'],qs['fields'](_0x18eb6c[_0x6453('0x2d')]['fields']));_0xa8f8f1['attributes']=_0xa8f8f1['attributes'][_0x6453('0x34')]?_0xa8f8f1[_0x6453('0x31')]:_0x1ff7e2[_0x6453('0x30')];if(_0x18eb6c['query'][_0x6453('0x3c')]){_0xa8f8f1[_0x6453('0x3d')]=[{'all':!![]}];}_0xa8f8f1=_[_0x6453('0x3a')]({},_0xa8f8f1,_0x18eb6c[_0x6453('0x43')]);return db[_0x6453('0x2a')][_0x6453('0x44')](_0xa8f8f1)[_0x6453('0x23')](handleEntityNotFound(_0x417e39,null))[_0x6453('0x23')](respondWithResult(_0x417e39,null))[_0x6453('0x3f')](handleError(_0x417e39,null));};exports[_0x6453('0x45')]=function(_0xd59c98,_0x23d885){return db['Pause'][_0x6453('0x45')](_0xd59c98[_0x6453('0x46')],{})['then'](function(_0x4acfcc){var _0x1bdc6d=_0xd59c98[_0x6453('0x47')][_0x6453('0x48')]({'plain':!![]});if(!_0x1bdc6d)throw new Error(_0x6453('0x49'));if(_0x1bdc6d[_0x6453('0x4a')]===_0x6453('0x47')){var _0x3bff42=_0x4acfcc['get']({'plain':!![]});var _0x59bc4c=_0x6453('0x4b');return db[_0x6453('0x4c')]['find']({'where':{'name':_0x59bc4c,'userProfileId':_0x1bdc6d[_0x6453('0x4d')]},'raw':!![]})[_0x6453('0x23')](function(_0x3bfe34){if(_0x3bfe34&&_0x3bfe34[_0x6453('0x4e')]===0x0){return db[_0x6453('0x25')][_0x6453('0x45')]({'name':_0x3bff42[_0x6453('0x26')],'resourceId':_0x3bff42['id'],'type':_0x3bfe34['name'],'sectionId':_0x3bfe34['id']},{})[_0x6453('0x23')](function(){return _0x4acfcc;});}else{return _0x4acfcc;}})[_0x6453('0x3f')](function(_0x256db7){logger[_0x6453('0x4f')](_0x6453('0x50'),_0x256db7);throw _0x256db7;});}return _0x4acfcc;})[_0x6453('0x23')](respondWithResult(_0x23d885,0xc9))[_0x6453('0x3f')](handleError(_0x23d885,null));};exports[_0x6453('0x22')]=function(_0x12286f,_0x8b2942){if(_0x12286f[_0x6453('0x46')]['id']){delete _0x12286f[_0x6453('0x46')]['id'];}return db[_0x6453('0x2a')][_0x6453('0x44')]({'where':{'id':_0x12286f[_0x6453('0x41')]['id']}})['then'](handleEntityNotFound(_0x8b2942,null))[_0x6453('0x23')](saveUpdates(_0x12286f[_0x6453('0x46')],null))[_0x6453('0x23')](respondWithResult(_0x8b2942,null))[_0x6453('0x3f')](handleError(_0x8b2942,null));};exports['destroy']=function(_0x31ad59,_0x280b01){return db['Pause'][_0x6453('0x44')]({'where':{'id':_0x31ad59[_0x6453('0x41')]['id']}})[_0x6453('0x23')](handleEntityNotFound(_0x280b01,null))['then'](removeEntity(_0x280b01,null))[_0x6453('0x3f')](handleError(_0x280b01,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 45882a2..1cbe7d7 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 _0x6562=['tools_pauses','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x162c58,_0xc0b48b){var _0x328838=function(_0x33204e){while(--_0x33204e){_0x162c58['push'](_0x162c58['shift']());}};_0x328838(++_0xc0b48b);}(_0x6562,0x1ae));var _0x2656=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x6562[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0x2656('0x0'));var util=require(_0x2656('0x1'));var logger=require(_0x2656('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2656('0x3'));var rp=require(_0x2656('0x4'));var fs=require('fs');var path=require(_0x2656('0x5'));var rimraf=require(_0x2656('0x6'));var config=require(_0x2656('0x7'));var attributes=require(_0x2656('0x8'));module[_0x2656('0x9')]=function(_0x305cb4,_0x4ffbfc){return _0x305cb4[_0x2656('0xa')](_0x2656('0xb'),attributes,{'tableName':_0x2656('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ec3=['path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','moment','bluebird'];(function(_0x87d3ec,_0x387888){var _0x5f3f6f=function(_0x5492ac){while(--_0x5492ac){_0x87d3ec['push'](_0x87d3ec['shift']());}};_0x5f3f6f(++_0x387888);}(_0x1ec3,0xa4));var _0x31ec=function(_0x280d63,_0xb3c4be){_0x280d63=_0x280d63-0x0;var _0x5e88a1=_0x1ec3[_0x280d63];return _0x5e88a1;};'use strict';var _=require(_0x31ec('0x0'));var util=require(_0x31ec('0x1'));var logger=require(_0x31ec('0x2'))('api');var moment=require(_0x31ec('0x3'));var BPromise=require(_0x31ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31ec('0x5'));var rimraf=require(_0x31ec('0x6'));var config=require(_0x31ec('0x7'));var attributes=require(_0x31ec('0x8'));module[_0x31ec('0x9')]=function(_0x37ee08,_0x5a94f4){return _0x37ee08[_0x31ec('0xa')](_0x31ec('0xb'),attributes,{'tableName':_0x31ec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 16dc1d9..09b2754 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 _0xcb39=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','Pause,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','ShowPause','Pause','find','raw','options','where','attributes','include','map','model','catch','lodash','util'];(function(_0x4cad4a,_0x16f8eb){var _0x4851e0=function(_0x2a54fa){while(--_0x2a54fa){_0x4cad4a['push'](_0x4cad4a['shift']());}};_0x4851e0(++_0x16f8eb);}(_0xcb39,0x76));var _0x9cb3=function(_0x4afa19,_0x4440ef){_0x4afa19=_0x4afa19-0x0;var _0x2e6278=_0xcb39[_0x4afa19];return _0x2e6278;};'use strict';var _=require(_0x9cb3('0x0'));var util=require(_0x9cb3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9cb3('0x2'));var fs=require('fs');var Redis=require(_0x9cb3('0x3'));var db=require(_0x9cb3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9cb3('0x5'))('rpc');var config=require(_0x9cb3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9cb3('0x7')][_0x9cb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28e765,_0x36586b,_0x48f9d8){return new BPromise(function(_0x3be64d,_0x155af8){return client[_0x9cb3('0x9')](_0x28e765,_0x48f9d8)[_0x9cb3('0xa')](function(_0x2ce173){logger['info'](_0x9cb3('0xb'),_0x36586b,'request\x20sent');logger[_0x9cb3('0xc')]('Pause,\x20%s,\x20%s,\x20%s',_0x36586b,_0x9cb3('0xd'),JSON[_0x9cb3('0xe')](_0x2ce173));if(_0x2ce173[_0x9cb3('0xf')]){if(_0x2ce173[_0x9cb3('0xf')]['code']===0x1f4){logger[_0x9cb3('0xf')](_0x9cb3('0xb'),_0x36586b,_0x2ce173[_0x9cb3('0xf')]['message']);return _0x155af8(_0x2ce173['error'][_0x9cb3('0x10')]);}logger[_0x9cb3('0xf')]('Pause,\x20%s,\x20%s',_0x36586b,_0x2ce173[_0x9cb3('0xf')]['message']);return _0x3be64d(_0x2ce173[_0x9cb3('0xf')][_0x9cb3('0x10')]);}else{logger[_0x9cb3('0x11')](_0x9cb3('0xb'),_0x36586b,_0x9cb3('0xd'));_0x3be64d(_0x2ce173[_0x9cb3('0x12')][_0x9cb3('0x10')]);}})['catch'](function(_0x4eff4b){logger['error'](_0x9cb3('0xb'),_0x36586b,_0x4eff4b);_0x155af8(_0x4eff4b);});});}exports[_0x9cb3('0x13')]=function(_0x238227){var _0x3aa0a5=this;return new Promise(function(_0x57e039,_0x158754){return db[_0x9cb3('0x14')][_0x9cb3('0x15')]({'raw':_0x238227['options']?_0x238227['options'][_0x9cb3('0x16')]===undefined?!![]:![]:!![],'where':_0x238227['options']?_0x238227[_0x9cb3('0x17')][_0x9cb3('0x18')]||null:null,'attributes':_0x238227[_0x9cb3('0x17')]?_0x238227[_0x9cb3('0x17')][_0x9cb3('0x19')]||null:null,'include':_0x238227[_0x9cb3('0x17')]?_0x238227[_0x9cb3('0x17')][_0x9cb3('0x1a')]?_[_0x9cb3('0x1b')](_0x238227[_0x9cb3('0x17')][_0x9cb3('0x1a')],function(_0x5489bb){return{'model':db[_0x5489bb[_0x9cb3('0x1c')]],'as':_0x5489bb['as'],'attributes':_0x5489bb[_0x9cb3('0x19')],'include':_0x5489bb[_0x9cb3('0x1a')]?_[_0x9cb3('0x1b')](_0x5489bb[_0x9cb3('0x1a')],function(_0x45f6c1){return{'model':db[_0x45f6c1[_0x9cb3('0x1c')]],'as':_0x45f6c1['as'],'attributes':_0x45f6c1[_0x9cb3('0x19')],'include':_0x45f6c1[_0x9cb3('0x1a')]?_[_0x9cb3('0x1b')](_0x45f6c1[_0x9cb3('0x1a')],function(_0x31d83e){return{'model':db[_0x31d83e[_0x9cb3('0x1c')]],'as':_0x31d83e['as'],'attributes':_0x31d83e[_0x9cb3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9cb3('0xa')](function(_0x18bfd8){logger[_0x9cb3('0x11')]('ShowPause',_0x238227);logger[_0x9cb3('0xc')](_0x9cb3('0x13'),_0x238227,JSON[_0x9cb3('0xe')](_0x18bfd8));_0x57e039(_0x18bfd8);})[_0x9cb3('0x1d')](function(_0x5fc3a4){logger[_0x9cb3('0xf')](_0x9cb3('0x13'),_0x5fc3a4['message'],_0x238227);_0x158754(_0x3aa0a5['error'](0x1f4,_0x5fc3a4[_0x9cb3('0x10')]));});});}; \ No newline at end of file +var _0x9d58=['request','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowPause','options','where','include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x60fbb5,_0x373e91){var _0x4fad02=function(_0x3c41b6){while(--_0x3c41b6){_0x60fbb5['push'](_0x60fbb5['shift']());}};_0x4fad02(++_0x373e91);}(_0x9d58,0x179));var _0x89d5=function(_0x2095ed,_0x156cfb){_0x2095ed=_0x2095ed-0x0;var _0x22dbb0=_0x9d58[_0x2095ed];return _0x22dbb0;};'use strict';var _=require(_0x89d5('0x0'));var util=require('util');var moment=require(_0x89d5('0x1'));var BPromise=require(_0x89d5('0x2'));var rs=require(_0x89d5('0x3'));var fs=require('fs');var Redis=require(_0x89d5('0x4'));var db=require(_0x89d5('0x5'))['db'];var utils=require(_0x89d5('0x6'));var logger=require(_0x89d5('0x7'))(_0x89d5('0x8'));var config=require(_0x89d5('0x9'));var jayson=require(_0x89d5('0xa'));var client=jayson[_0x89d5('0xb')][_0x89d5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cdb88,_0x4c55e2,_0x55b054){return new BPromise(function(_0x57ca57,_0x14072b){return client[_0x89d5('0xd')](_0x2cdb88,_0x55b054)['then'](function(_0xf315de){logger[_0x89d5('0xe')](_0x89d5('0xf'),_0x4c55e2,_0x89d5('0x10'));logger[_0x89d5('0x11')]('Pause,\x20%s,\x20%s,\x20%s',_0x4c55e2,_0x89d5('0x10'),JSON[_0x89d5('0x12')](_0xf315de));if(_0xf315de['error']){if(_0xf315de[_0x89d5('0x13')][_0x89d5('0x14')]===0x1f4){logger[_0x89d5('0x13')]('Pause,\x20%s,\x20%s',_0x4c55e2,_0xf315de['error'][_0x89d5('0x15')]);return _0x14072b(_0xf315de[_0x89d5('0x13')]['message']);}logger[_0x89d5('0x13')](_0x89d5('0xf'),_0x4c55e2,_0xf315de['error'][_0x89d5('0x15')]);return _0x57ca57(_0xf315de['error'][_0x89d5('0x15')]);}else{logger['info'](_0x89d5('0xf'),_0x4c55e2,_0x89d5('0x10'));_0x57ca57(_0xf315de[_0x89d5('0x16')][_0x89d5('0x15')]);}})['catch'](function(_0x152516){logger[_0x89d5('0x13')]('Pause,\x20%s,\x20%s',_0x4c55e2,_0x152516);_0x14072b(_0x152516);});});}exports[_0x89d5('0x17')]=function(_0x20eb54){var _0x4ce0a8=this;return new Promise(function(_0x2c4045,_0x361323){return db['Pause']['find']({'raw':_0x20eb54['options']?_0x20eb54[_0x89d5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x20eb54[_0x89d5('0x18')]?_0x20eb54[_0x89d5('0x18')][_0x89d5('0x19')]||null:null,'attributes':_0x20eb54[_0x89d5('0x18')]?_0x20eb54[_0x89d5('0x18')]['attributes']||null:null,'include':_0x20eb54[_0x89d5('0x18')]?_0x20eb54[_0x89d5('0x18')][_0x89d5('0x1a')]?_['map'](_0x20eb54[_0x89d5('0x18')]['include'],function(_0x119405){return{'model':db[_0x119405[_0x89d5('0x1b')]],'as':_0x119405['as'],'attributes':_0x119405[_0x89d5('0x1c')],'include':_0x119405[_0x89d5('0x1a')]?_[_0x89d5('0x1d')](_0x119405[_0x89d5('0x1a')],function(_0xa16946){return{'model':db[_0xa16946[_0x89d5('0x1b')]],'as':_0xa16946['as'],'attributes':_0xa16946['attributes'],'include':_0xa16946[_0x89d5('0x1a')]?_['map'](_0xa16946['include'],function(_0x2c1955){return{'model':db[_0x2c1955[_0x89d5('0x1b')]],'as':_0x2c1955['as'],'attributes':_0x2c1955[_0x89d5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e15a9){logger[_0x89d5('0xe')](_0x89d5('0x17'),_0x20eb54);logger[_0x89d5('0x11')](_0x89d5('0x17'),_0x20eb54,JSON['stringify'](_0x2e15a9));_0x2c4045(_0x2e15a9);})['catch'](function(_0x1eca3e){logger[_0x89d5('0x13')]('ShowPause',_0x1eca3e['message'],_0x20eb54);_0x361323(_0x4ce0a8[_0x89d5('0x13')](0x1f4,_0x1eca3e[_0x89d5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index eac9f80..0deeea3 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 _0xc12b=['isAuthenticated','/webhook','/:id','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','upload','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get'];(function(_0x513997,_0x3a9d0c){var _0x4c88e3=function(_0x3fa8c4){while(--_0x3fa8c4){_0x513997['push'](_0x513997['shift']());}};_0x4c88e3(++_0x3a9d0c);}(_0xc12b,0x105));var _0xbc12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc12b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbc12('0x0'));var util=require('util');var path=require(_0xbc12('0x1'));var timeout=require(_0xbc12('0x2'));var express=require(_0xbc12('0x3'));var router=express[_0xbc12('0x4')]();var auth=require(_0xbc12('0x5'));var interaction=require(_0xbc12('0x6'));var config=require('../../config/environment');var controller=require(_0xbc12('0x7'));router[_0xbc12('0x8')]('/',auth[_0xbc12('0x9')](),controller['index']);router[_0xbc12('0x8')](_0xbc12('0xa'),controller['webhookGet']);router['get'](_0xbc12('0xb'),auth['isAuthenticated'](),controller[_0xbc12('0xc')]);router[_0xbc12('0x8')](_0xbc12('0xd'),auth[_0xbc12('0x9')](),controller[_0xbc12('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd0d583,_0x51974a,_0x1c93de){_0x1c93de(null,path[_0xbc12('0xf')](config['root'],_0xbc12('0x10')));},'filename':function(_0x3e5400,_0x35578f,_0x405cf2){_0x35578f[_0xbc12('0x11')]=_0x35578f['originalname'][_0xbc12('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x405cf2(null,util[_0xbc12('0x13')](_0xbc12('0x14'),path[_0xbc12('0x15')](_0x35578f[_0xbc12('0x11')],path['extname'](_0x35578f[_0xbc12('0x11')])),Date[_0xbc12('0x16')](),path[_0xbc12('0x17')](_0x35578f['originalname'])));}})});router[_0xbc12('0x18')]('/',upload['single']('file'),controller[_0xbc12('0x19')]);router[_0xbc12('0x18')](_0xbc12('0xa'),controller['webhookPost']);router[_0xbc12('0x1a')]('/:id',auth[_0xbc12('0x9')](),controller[_0xbc12('0x1b')]);router[_0xbc12('0x1c')]('/:id',auth[_0xbc12('0x9')](),controller[_0xbc12('0x1c')]);module[_0xbc12('0x1d')]=router; \ No newline at end of file +var _0xd7ee=['single','file','/webhook','webhookPost','put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','join','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post'];(function(_0x4d4141,_0x2cac76){var _0x4b4fe4=function(_0x49cc3a){while(--_0x49cc3a){_0x4d4141['push'](_0x4d4141['shift']());}};_0x4b4fe4(++_0x2cac76);}(_0xd7ee,0x1e8));var _0xed7e=function(_0x50fb34,_0x56b847){_0x50fb34=_0x50fb34-0x0;var _0x478797=_0xd7ee[_0x50fb34];return _0x478797;};'use strict';var multer=require('multer');var util=require(_0xed7e('0x0'));var path=require('path');var timeout=require(_0xed7e('0x1'));var express=require(_0xed7e('0x2'));var router=express[_0xed7e('0x3')]();var auth=require(_0xed7e('0x4'));var interaction=require(_0xed7e('0x5'));var config=require('../../config/environment');var controller=require(_0xed7e('0x6'));router[_0xed7e('0x7')]('/',auth[_0xed7e('0x8')](),controller[_0xed7e('0x9')]);router[_0xed7e('0x7')]('/webhook',controller[_0xed7e('0xa')]);router[_0xed7e('0x7')](_0xed7e('0xb'),auth[_0xed7e('0x8')](),controller[_0xed7e('0xc')]);router[_0xed7e('0x7')](_0xed7e('0xd'),auth[_0xed7e('0x8')](),controller[_0xed7e('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2db03b,_0x7cb88a,_0x379c72){_0x379c72(null,path[_0xed7e('0xf')](config['root'],_0xed7e('0x10')));},'filename':function(_0x4f89d3,_0x4c7538,_0x2d0823){_0x4c7538[_0xed7e('0x11')]=_0x4c7538[_0xed7e('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d0823(null,util[_0xed7e('0x12')](_0xed7e('0x13'),path[_0xed7e('0x14')](_0x4c7538['originalname'],path[_0xed7e('0x15')](_0x4c7538[_0xed7e('0x11')])),Date[_0xed7e('0x16')](),path[_0xed7e('0x15')](_0x4c7538[_0xed7e('0x11')])));}})});router[_0xed7e('0x17')]('/',upload[_0xed7e('0x18')](_0xed7e('0x19')),controller['upload']);router['post'](_0xed7e('0x1a'),controller[_0xed7e('0x1b')]);router[_0xed7e('0x1c')](_0xed7e('0xb'),auth[_0xed7e('0x8')](),controller[_0xed7e('0x1d')]);router[_0xed7e('0x1e')](_0xed7e('0xb'),auth[_0xed7e('0x8')](),controller[_0xed7e('0x1e')]);module[_0xed7e('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index ef063cb..63345ee 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 _0xe0f0=['always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly'];(function(_0x41a21c,_0x30ace9){var _0x24025c=function(_0x4cb178){while(--_0x4cb178){_0x41a21c['push'](_0x41a21c['shift']());}};_0x24025c(++_0x30ace9);}(_0xe0f0,0x9e));var _0x0e0f=function(_0x247c71,_0x2254e2){_0x247c71=_0x247c71-0x0;var _0x202a3c=_0xe0f0[_0x247c71];return _0x202a3c;};'use strict';var Sequelize=require(_0x0e0f('0x0'));module[_0x0e0f('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0e0f('0x2')](_0x0e0f('0x3'),_0x0e0f('0x4'))},'description':{'type':Sequelize[_0x0e0f('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x0e0f('0x6')],'comment':_0x0e0f('0x7')},'active':{'type':Sequelize[_0x0e0f('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x0e0f('0x2')](_0x0e0f('0x9'),_0x0e0f('0xa'),_0x0e0f('0xb'),'never'),'defaultValue':_0x0e0f('0xb'),'comment':_0x0e0f('0xc')},'icon':{'type':Sequelize[_0x0e0f('0x6')]},'adminUrl':{'type':Sequelize[_0x0e0f('0x6')]},'agentUrl':{'type':Sequelize[_0x0e0f('0x6')]},'scriptName':{'type':Sequelize[_0x0e0f('0x6')]},'scriptPath':{'type':Sequelize[_0x0e0f('0x6')]}}; \ No newline at end of file +var _0xd975=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','never'];(function(_0x492f33,_0x2b300d){var _0x377487=function(_0x4fd14e){while(--_0x4fd14e){_0x492f33['push'](_0x492f33['shift']());}};_0x377487(++_0x2b300d);}(_0xd975,0x8d));var _0x5d97=function(_0x755361,_0x5dd96c){_0x755361=_0x755361-0x0;var _0x1dbcc4=_0xd975[_0x755361];return _0x1dbcc4;};'use strict';var Sequelize=require(_0x5d97('0x0'));module[_0x5d97('0x1')]={'name':{'type':Sequelize[_0x5d97('0x2')]},'type':{'type':Sequelize[_0x5d97('0x3')](_0x5d97('0x4'),_0x5d97('0x5'))},'description':{'type':Sequelize[_0x5d97('0x6')]},'version':{'type':Sequelize[_0x5d97('0x6')]},'path':{'type':Sequelize[_0x5d97('0x2')],'comment':_0x5d97('0x7')},'active':{'type':Sequelize[_0x5d97('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x5d97('0x3')](_0x5d97('0x9'),_0x5d97('0xa'),_0x5d97('0xb'),_0x5d97('0xc')),'defaultValue':_0x5d97('0xb'),'comment':_0x5d97('0xd')},'icon':{'type':Sequelize[_0x5d97('0x2')]},'adminUrl':{'type':Sequelize[_0x5d97('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x5d97('0x2')]},'scriptPath':{'type':Sequelize[_0x5d97('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 34e9be1..ea47f74 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 _0x5db3=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Plugins','end','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','findAll','catch','params','find','download','join','root','server/files/plugins','format','basename','zip','code','ENOENT','error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileResource','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','port','hostname','encoding','method','%s%s','headers','content-length','content-type','statusCode','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','extract-zip','archiver','ioredis'];(function(_0x26b636,_0x255e53){var _0x21604a=function(_0xffae0a){while(--_0xffae0a){_0x26b636['push'](_0x26b636['shift']());}};_0x21604a(++_0x255e53);}(_0x5db3,0x1ee));var _0x35db=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x5db3[_0x243b59];return _0x3e1676;};'use strict';var pdf=require(_0x35db('0x0'));var emlformat=require(_0x35db('0x1'));var rimraf=require(_0x35db('0x2'));var zipdir=require(_0x35db('0x3'));var jsonpatch=require(_0x35db('0x4'));var rp=require(_0x35db('0x5'));var moment=require(_0x35db('0x6'));var BPromise=require(_0x35db('0x7'));var Mustache=require(_0x35db('0x8'));var util=require(_0x35db('0x9'));var path=require(_0x35db('0xa'));var sox=require(_0x35db('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35db('0xc'));var squel=require(_0x35db('0xd'));var crypto=require(_0x35db('0xe'));var jsforce=require(_0x35db('0xf'));var deskjs=require(_0x35db('0x10'));var toCsv=require(_0x35db('0x11'));var querystring=require('querystring');var Papa=require(_0x35db('0x12'));var extract=require(_0x35db('0x13'));var rimraf=require(_0x35db('0x2'));var archiver=require(_0x35db('0x14'));var Redis=require(_0x35db('0x15'));var authService=require(_0x35db('0x16'));var qs=require(_0x35db('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35db('0x18'))(_0x35db('0x19'));var utils=require(_0x35db('0x1a'));var config=require(_0x35db('0x1b'));var db=require(_0x35db('0x1c'))['db'];config['redis']=_[_0x35db('0x1d')](config['redis'],{'host':_0x35db('0x1e'),'port':0x18eb});var socket=require(_0x35db('0x1f'))(new Redis(config[_0x35db('0x20')]));require(_0x35db('0x21'))[_0x35db('0x22')](socket);function respondWithStatusCode(_0x2da0d5,_0x59274a){_0x59274a=_0x59274a||0xcc;return function(_0xab083c){if(_0xab083c){return _0x2da0d5[_0x35db('0x23')](_0x59274a);}return _0x2da0d5['status'](_0x59274a)['end']();};}function respondWithResult(_0x1ed81f,_0x2e09b6){_0x2e09b6=_0x2e09b6||0xc8;return function(_0x1cc0c4){if(_0x1cc0c4){return _0x1ed81f[_0x35db('0x24')](_0x2e09b6)[_0x35db('0x25')](_0x1cc0c4);}};}function respondWithFilteredResult(_0x4928aa,_0x2f5964){return function(_0x388202){if(_0x388202){var _0x237188=_0x388202[_0x35db('0x26')],_0x4affe5=_0x2f5964[_0x35db('0x27')],_0x411a25=_0x2f5964[_0x35db('0x27')]+_0x2f5964[_0x35db('0x28')],_0xc841b5;if(_0x411a25>=_0x237188){_0x411a25=_0x237188;_0xc841b5=0xc8;}else{_0xc841b5=0xce;}_0x4928aa['status'](_0xc841b5);return _0x4928aa[_0x35db('0x29')](_0x35db('0x2a'),_0x4affe5+'-'+_0x411a25+'/'+_0x237188)['json'](_0x388202);}return null;};}function patchUpdates(_0x43d705){return function(_0x41d337){try{jsonpatch[_0x35db('0x2b')](_0x41d337,_0x43d705,!![]);}catch(_0x58ec45){return BPromise[_0x35db('0x2c')](_0x58ec45);}return _0x41d337['save']();};}function saveUpdates(_0x5f4de4,_0x25db0f){return function(_0x1d33f3){if(_0x1d33f3){return _0x1d33f3[_0x35db('0x2d')](_0x5f4de4)[_0x35db('0x2e')](function(_0x1f48fb){return _0x1f48fb;});}return null;};}function removeEntity(_0x12b767,_0x5a9fcf){return function(_0x455937){if(_0x455937){return _0x455937[_0x35db('0x2f')]()[_0x35db('0x2e')](function(){var _0x86d603=_0x455937[_0x35db('0x30')]({'plain':!![]});var _0x2b5191=_0x35db('0x31');return db['UserProfileResource']['destroy']({'where':{'type':_0x2b5191,'resourceId':_0x86d603['id']}})[_0x35db('0x2e')](function(){return _0x455937;});})['then'](function(){_0x12b767[_0x35db('0x24')](0xcc)[_0x35db('0x32')]();});}};}function handleEntityNotFound(_0x9d0d2c,_0x19c47c){return function(_0x478d8b){if(!_0x478d8b){_0x9d0d2c[_0x35db('0x23')](0x194);}return _0x478d8b;};}function handleError(_0x505ebd,_0x3f9cc4){_0x3f9cc4=_0x3f9cc4||0x1f4;return function(_0x1e129a){logger['error'](_0x1e129a[_0x35db('0x33')]);if(_0x1e129a[_0x35db('0x34')]){delete _0x1e129a['name'];}_0x505ebd[_0x35db('0x24')](_0x3f9cc4)[_0x35db('0x35')](_0x1e129a);};}exports[_0x35db('0x36')]=function(_0x4a8a18,_0x41ab53){var _0x4d2edb={},_0xe446cf={},_0x4f25a6={'count':0x0,'rows':[]};var _0x13da53=_['map'](db[_0x35db('0x37')][_0x35db('0x38')],function(_0x57974b){return{'name':_0x57974b[_0x35db('0x39')],'type':_0x57974b[_0x35db('0x3a')][_0x35db('0x3b')]};});_0xe446cf['model']=_['map'](_0x13da53,'name');_0xe446cf[_0x35db('0x3c')]=_[_0x35db('0x3d')](_0x4a8a18[_0x35db('0x3c')]);_0xe446cf[_0x35db('0x3e')]=_[_0x35db('0x3f')](_0xe446cf['model'],_0xe446cf[_0x35db('0x3c')]);_0x4d2edb['attributes']=_[_0x35db('0x3f')](_0xe446cf[_0x35db('0x40')],qs[_0x35db('0x41')](_0x4a8a18[_0x35db('0x3c')][_0x35db('0x41')]));_0x4d2edb[_0x35db('0x42')]=_0x4d2edb['attributes'][_0x35db('0x43')]?_0x4d2edb[_0x35db('0x42')]:_0xe446cf['model'];if(!_0x4a8a18[_0x35db('0x3c')][_0x35db('0x44')](_0x35db('0x45'))){_0x4d2edb[_0x35db('0x28')]=qs[_0x35db('0x28')](_0x4a8a18[_0x35db('0x3c')][_0x35db('0x28')]);_0x4d2edb['offset']=qs[_0x35db('0x27')](_0x4a8a18[_0x35db('0x3c')][_0x35db('0x27')]);}_0x4d2edb[_0x35db('0x46')]=qs[_0x35db('0x47')](_0x4a8a18[_0x35db('0x3c')][_0x35db('0x47')]);_0x4d2edb[_0x35db('0x48')]=qs[_0x35db('0x3e')](_['pick'](_0x4a8a18[_0x35db('0x3c')],_0xe446cf[_0x35db('0x3e')]),_0x13da53);if(_0x4a8a18['query'][_0x35db('0x49')]){_0x4d2edb[_0x35db('0x48')]=_[_0x35db('0x4a')](_0x4d2edb[_0x35db('0x48')],{'$or':_[_0x35db('0x4b')](_0x13da53,function(_0x1b4cca){if(_0x1b4cca[_0x35db('0x3a')]!==_0x35db('0x4c')){var _0x52c2c0={};_0x52c2c0[_0x1b4cca['name']]={'$like':'%'+_0x4a8a18[_0x35db('0x3c')][_0x35db('0x49')]+'%'};return _0x52c2c0;}})});}_0x4d2edb=_[_0x35db('0x4a')]({},_0x4d2edb,_0x4a8a18[_0x35db('0x4d')]);var _0x284a77={'where':_0x4d2edb['where']};return db['Plugin'][_0x35db('0x26')](_0x284a77)[_0x35db('0x2e')](function(_0x5d20f0){_0x4f25a6[_0x35db('0x26')]=_0x5d20f0;if(_0x4a8a18[_0x35db('0x3c')][_0x35db('0x4e')]){_0x4d2edb['include']=[{'all':!![]}];}return db[_0x35db('0x37')][_0x35db('0x4f')](_0x4d2edb);})[_0x35db('0x2e')](function(_0x628dc1){_0x4f25a6['rows']=_0x628dc1;return _0x4f25a6;})['then'](respondWithFilteredResult(_0x41ab53,_0x4d2edb))[_0x35db('0x50')](handleError(_0x41ab53,null));};exports['show']=function(_0x4623d2,_0x416e97){var _0xf6f29b={'raw':!![],'where':{'id':_0x4623d2[_0x35db('0x51')]['id']}},_0x5c035a={};_0x5c035a['model']=_[_0x35db('0x3d')](db['Plugin'][_0x35db('0x38')]);_0x5c035a[_0x35db('0x3c')]=_['keys'](_0x4623d2[_0x35db('0x3c')]);_0x5c035a[_0x35db('0x3e')]=_[_0x35db('0x3f')](_0x5c035a[_0x35db('0x40')],_0x5c035a[_0x35db('0x3c')]);_0xf6f29b[_0x35db('0x42')]=_['intersection'](_0x5c035a[_0x35db('0x40')],qs[_0x35db('0x41')](_0x4623d2[_0x35db('0x3c')][_0x35db('0x41')]));_0xf6f29b[_0x35db('0x42')]=_0xf6f29b[_0x35db('0x42')][_0x35db('0x43')]?_0xf6f29b[_0x35db('0x42')]:_0x5c035a[_0x35db('0x40')];if(_0x4623d2[_0x35db('0x3c')][_0x35db('0x4e')]){_0xf6f29b['include']=[{'all':!![]}];}_0xf6f29b=_['merge']({},_0xf6f29b,_0x4623d2[_0x35db('0x4d')]);return db[_0x35db('0x37')][_0x35db('0x52')](_0xf6f29b)[_0x35db('0x2e')](handleEntityNotFound(_0x416e97,null))['then'](respondWithResult(_0x416e97,null))[_0x35db('0x50')](handleError(_0x416e97,null));};exports[_0x35db('0x53')]=function(_0x46d8e3,_0x193859,_0x1dc0e1){return db[_0x35db('0x37')][_0x35db('0x52')]({'where':{'id':_0x46d8e3['params']['id']},'attributes':[_0x35db('0x34'),'path'],'raw':!![]})[_0x35db('0x2e')](handleEntityNotFound(_0x193859,null))[_0x35db('0x2e')](function(_0xf1279a){if(_0xf1279a){var _0x5050e3=path[_0x35db('0x54')](config[_0x35db('0x55')],_0x35db('0x56'),util[_0x35db('0x57')]('%s.zip',path[_0x35db('0x58')](_0xf1279a[_0x35db('0xa')])));var _0x295f46=fs['createWriteStream'](_0x5050e3);var _0xb86e62=archiver(_0x35db('0x59'),{'zlib':{'level':0x9}});_0xb86e62['on']('warning',function(_0x5a6d57){if(_0x5a6d57[_0x35db('0x5a')]===_0x35db('0x5b')){logger[_0x35db('0x5c')](_0x5a6d57);}else{throw new db['Sequelize']['Error'](_0x35db('0x5d'));}});_0xb86e62['on'](_0x35db('0x5c'),function(_0x29c2c3){throw new db[(_0x35db('0x5e'))][(_0x35db('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xb86e62[_0x35db('0x60')](_0x295f46);_0xb86e62[_0x35db('0x61')](_0x35db('0x62'),{'cwd':path['join'](config['root'],_0x35db('0x56'),path[_0x35db('0x63')](_0xf1279a[_0x35db('0xa')])),'ignore':[path[_0x35db('0x54')](path[_0x35db('0x58')](_0xf1279a[_0x35db('0xa')]),_0x35db('0x64')),path[_0x35db('0x54')](path[_0x35db('0x58')](_0xf1279a[_0x35db('0xa')]),_0x35db('0x65'))],'nodir':!![]})[_0x35db('0x66')]();_0x295f46['on'](_0x35db('0x67'),function(){if(!fs[_0x35db('0x68')](_0x5050e3)){throw new db['Sequelize'][(_0x35db('0x5f'))]('Plugin\x20not\x20found');}return _0x193859[_0x35db('0x53')](_0x5050e3,util['format'](_0x35db('0x69'),path[_0x35db('0x58')](_0xf1279a[_0x35db('0xa')])),function(_0x15b971){if(_0x15b971){throw new db[(_0x35db('0x5e'))]['Error'](_0x35db('0x6a'));}fs['unlinkSync'](_0x5050e3);logger[_0x35db('0x6b')]('Download\x20completed');logger[_0x35db('0x6b')](_0x35db('0x6c'));});});}return null;})[_0x35db('0x50')](handleError(_0x193859,null));};exports['upload']=function(_0x516311,_0x123f35,_0x305b8b){var _0x20cd36=path[_0x35db('0x58')](_0x516311[_0x35db('0x6d')][_0x35db('0x6e')],path['extname'](_0x516311[_0x35db('0x6d')][_0x35db('0x6e')]));var _0x3570a4=path[_0x35db('0x54')](config[_0x35db('0x55')],_0x35db('0x56'),_0x516311[_0x35db('0x6d')][_0x35db('0x6e')]);var _0x5d9ed7=path[_0x35db('0x54')](config[_0x35db('0x55')],_0x35db('0x56'),_0x20cd36);logger[_0x35db('0x6b')](_0x35db('0x6f'),_0x3570a4);logger[_0x35db('0x6b')](_0x35db('0x70'),_0x5d9ed7);try{fs[_0x35db('0x71')](_0x3570a4,parseInt(_0x35db('0x72'),0x8));extract(_0x3570a4,{'dir':_0x5d9ed7},function(_0x265d74){if(_0x265d74){logger[_0x35db('0x5c')](_0x265d74);handleError(_0x265d74,!![]);};var _0x196676=fs[_0x35db('0x73')](_0x5d9ed7);if(_0x196676[_0x35db('0x43')]>0x1){removeReferences(_0x3570a4,_0x5d9ed7);logger[_0x35db('0x5c')](_0x35db('0x74'));return _0x305b8b(new Error(_0x35db('0x74')));}var _0x146b04=fs[_0x35db('0x75')](path['join'](_0x5d9ed7,_0x196676[0x0]));if(_0x146b04['isFile']()){removeReferences(_0x3570a4,_0x5d9ed7);logger[_0x35db('0x5c')](_0x35db('0x74'));return _0x305b8b(new Error(_0x35db('0x74')));}if(_0x146b04[_0x35db('0x76')]()){var _0x338ccc=fs[_0x35db('0x73')](path['join'](_0x5d9ed7,_0x196676[0x0]));if(_0x338ccc[_0x35db('0x43')]===0x0){removeReferences(_0x3570a4,_0x5d9ed7);logger[_0x35db('0x5c')](_0x35db('0x74'));return _0x305b8b(new Error(_0x35db('0x74')));}var _0x9111f7=_0x338ccc[_0x35db('0x77')](function(_0x4ad6fd){return _0x4ad6fd===_0x35db('0x78');});if(!_0x9111f7){return _0x305b8b(new Error(_0x35db('0x79')));}var _0x2765d5=fs[_0x35db('0x7a')](path[_0x35db('0x54')](_0x5d9ed7,_0x196676[0x0],_0x35db('0x78')));var _0x4ca549=JSON['parse'](_0x2765d5);if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x34')]){return _0x305b8b(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x3a')]){return _0x305b8b(new Error(_0x35db('0x7c')));}if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7d')]){return _0x305b8b(new Error(_0x35db('0x7e')));}if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7f')]){return _0x305b8b(new Error(_0x35db('0x80')));}if(_0x4ca549[_0x35db('0x3a')]==='html'){if('undefined'==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x81')]){return _0x305b8b(new Error(_0x35db('0x82')));}if('undefined'==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x81')]['admin']&&_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x81')][_0x35db('0x83')]){return _0x305b8b(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4ca549[_0x35db('0x3a')]===_0x35db('0x84')){if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x85')]){return _0x305b8b(new Error(_0x35db('0x86')));}if(_0x35db('0x7b')==typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x87')]){return _0x305b8b(new Error(_0x35db('0x88')));}}else{return _0x305b8b(new Error(_0x35db('0x89')));}var _0x48528f=_0x4ca549[_0x35db('0x34')];var _0x2ca2ed=_0x4ca549['description'];var _0x152484=_0x4ca549[_0x35db('0x3a')];var _0x4cf204=_0x4ca549['sidebar']?_0x4ca549[_0x35db('0x8a')]:_0x35db('0x8b');var _0x1dea79=_0x4ca549[_0x35db('0x8c')]?_0x4ca549[_0x35db('0x8c')]:_0x35db('0x8d');var _0x204613='';var _0x4d11e2='';var _0x2d6d11='';var _0x37df7e='';var _0x160604=_0x4ca549[_0x35db('0x7d')];if(_0x152484===_0x35db('0x8e')){if(_0x35db('0x7b')!=typeof _0x4ca549['parameters'][_0x35db('0x81')][_0x35db('0x8f')]){var _0x7ff33c=_0x4ca549['parameters']['views'][_0x35db('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x35db('0x90')](_0x7ff33c)){_0x204613=path[_0x35db('0x54')](_0x35db('0x91'),_0x20cd36,_0x196676[0x0],_0x7ff33c);}else{_0x204613=_0x7ff33c;}}else{logger['info'](_0x35db('0x92'));}if(_0x35db('0x7b')!=typeof _0x4ca549['parameters'][_0x35db('0x81')][_0x35db('0x83')]){var _0x18b768=_0x4ca549['parameters'][_0x35db('0x81')][_0x35db('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x35db('0x90')](_0x18b768)){_0x4d11e2=path['join']('plugins',_0x20cd36,_0x196676[0x0],_0x18b768);}else{_0x4d11e2=_0x18b768;}}else{logger[_0x35db('0x6b')](_0x35db('0x93'));}}else if(_0x152484===_0x35db('0x84')){_0x2d6d11=_0x4ca549[_0x35db('0x7f')][_0x35db('0x85')];_0x37df7e=_0x4ca549[_0x35db('0x7f')][_0x35db('0x87')];if(_0x35db('0x7b')!=typeof _0x4ca549[_0x35db('0x7f')]['views']){if(_0x35db('0x7b')!=typeof _0x4ca549[_0x35db('0x7f')]['views'][_0x35db('0x8f')]){var _0x7ff33c=_0x4ca549[_0x35db('0x7f')][_0x35db('0x81')][_0x35db('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x35db('0x90')](_0x7ff33c)){_0x204613=path[_0x35db('0x54')]('plugins',_0x20cd36,_0x196676[0x0],_0x7ff33c);}else{_0x204613=_0x7ff33c;}}if(_0x35db('0x7b')!=typeof _0x4ca549[_0x35db('0x7f')][_0x35db('0x81')][_0x35db('0x83')]){var _0x18b768=_0x4ca549[_0x35db('0x7f')]['views'][_0x35db('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x35db('0x90')](_0x18b768)){_0x4d11e2=path[_0x35db('0x54')](_0x35db('0x91'),_0x20cd36,_0x196676[0x0],_0x18b768);}else{_0x4d11e2=_0x18b768;}}}}var _0x40b0b1={'name':_0x48528f,'description':_0x2ca2ed,'path':path[_0x35db('0x54')](_0x20cd36,_0x196676[0x0]),'type':_0x152484,'sidebar':_0x4cf204,'icon':_0x1dea79,'adminUrl':_0x204613,'agentUrl':_0x4d11e2,'scriptName':_0x2d6d11,'scriptPath':_0x37df7e,'version':_0x160604};removeReferences(_0x3570a4,null);return db[_0x35db('0x37')][_0x35db('0x94')](_0x40b0b1)[_0x35db('0x2e')](function(_0x58fbc7){var _0x4bc968={'role':_0x516311[_0x35db('0x95')][_0x35db('0x96')],'userProfileId':_0x516311[_0x35db('0x95')][_0x35db('0x97')]};if(!_0x4bc968)throw new Error(_0x35db('0x98'));if(_0x4bc968['role']===_0x35db('0x99')){var _0x4f8fe7=_0x58fbc7['get']({'plain':!![]});return db['UserProfileSection'][_0x35db('0x52')]({'where':{'name':'Plugins','userProfileId':_0x4bc968[_0x35db('0x97')]},'raw':!![]})[_0x35db('0x2e')](function(_0x249c9e){if(_0x249c9e&&_0x249c9e['autoAssociation']===0x0){return db[_0x35db('0x9a')][_0x35db('0x94')]({'name':_0x4f8fe7[_0x35db('0x34')],'resourceId':_0x4f8fe7['id'],'type':_0x249c9e[_0x35db('0x34')],'sectionId':_0x249c9e['id']},{})['then'](function(){return _0x58fbc7;});}else{return _0x58fbc7;}})['catch'](function(_0x1e3dac){logger[_0x35db('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e3dac);throw _0x1e3dac;});}return _0x58fbc7;})['then'](respondWithResult(_0x123f35,null))['catch'](handleError(_0x123f35,null));}});}catch(_0x3655d6){_0x123f35[_0x35db('0x24')](0x1f4)[_0x35db('0x35')](_0x3655d6);}};function removeReferences(_0x301170,_0x3d0c48){try{if(_0x301170){fs[_0x35db('0x9b')](_0x301170);logger[_0x35db('0x6b')](_0x35db('0x9c'));}if(_0x3d0c48){rimraf(_0x3d0c48,function(){});logger[_0x35db('0x6b')](_0x35db('0x9d'));}}catch(_0x3097f4){logger['error'](_0x3097f4);}}exports[_0x35db('0x2d')]=function(_0x1f219f,_0x444526,_0x11b3e1){return db[_0x35db('0x37')][_0x35db('0x52')]({'where':{'id':_0x1f219f[_0x35db('0x51')]['id']}})['then'](handleEntityNotFound(_0x444526,null))[_0x35db('0x2e')](saveUpdates(_0x1f219f['body'],null))['then'](respondWithResult(_0x444526,null))[_0x35db('0x50')](handleError(_0x444526,null));};exports[_0x35db('0x9e')]=function(_0x1a1e5e,_0x9b3c25,_0x2a8467){return db[_0x35db('0x37')][_0x35db('0x52')]({'where':{'id':_0x1a1e5e[_0x35db('0x51')]['id']}})[_0x35db('0x2e')](function(_0x154a2f){if(_0x154a2f){return _0x154a2f[_0x35db('0x2f')]();}})[_0x35db('0x2e')](function(_0x3b32ea){rimraf(path[_0x35db('0x54')](config[_0x35db('0x55')],'server/files/plugins',path['dirname'](_0x3b32ea[_0x35db('0xa')])),function(){});return _0x3b32ea;})[_0x35db('0x2e')](handleEntityNotFound(_0x9b3c25,null))[_0x35db('0x2e')](respondWithStatusCode(_0x9b3c25,null))[_0x35db('0x50')](handleError(_0x9b3c25,null));};exports[_0x35db('0x9f')]=function(_0x50cd8b,_0x174e14,_0x5f2b50){return BPromise['resolve']()[_0x35db('0x2e')](function(){if(!_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x280883=_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa1')]?_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa1')]+':'+_0x50cd8b[_0x35db('0x3c')]['port']:'http://localhost:'+_0x50cd8b[_0x35db('0x3c')]['port'];var _0xfd7e24=_0x50cd8b['query'][_0x35db('0x25')]?_0x50cd8b[_0x35db('0x3c')][_0x35db('0x25')]:!![];var _0x387d59=_0x50cd8b[_0x35db('0x3c')][_0x35db('0xa2')]?_0x50cd8b['query']['encoding']:null;var _0x38c3f1={'method':_0x50cd8b[_0x35db('0xa3')],'uri':util[_0x35db('0x57')](_0x35db('0xa4'),_0x280883,_0x50cd8b['query'][_0x35db('0xa')]),'json':_0xfd7e24,'resolveWithFullResponse':!![],'encoding':_0x387d59,'qs':_0x50cd8b['query']};if(_0x50cd8b[_0x35db('0xa5')]){_0x38c3f1['headers']=_0x50cd8b[_0x35db('0xa5')];if(_0x38c3f1[_0x35db('0xa5')][_0x35db('0xa6')]){delete _0x38c3f1[_0x35db('0xa5')][_0x35db('0xa6')];}}if(_0x38c3f1[_0x35db('0xa5')]['content-type']){delete _0x38c3f1[_0x35db('0xa5')][_0x35db('0xa7')];}return rp(_0x38c3f1);})['then'](function(_0x521937){if(_0x521937){_0x174e14[_0x35db('0x29')](_0x521937[_0x35db('0xa5')]);logger[_0x35db('0x6b')](_0x521937[_0x35db('0x95')]);if(_['endsWith'](_0x50cd8b['query'][_0x35db('0xa')],_0x35db('0x53'))&&_0x521937[_0x35db('0xa8')]==0x1f4){return _0x174e14['sendStatus'](_0x521937['statusCode']);}else{return _0x174e14['status'](_0x521937['statusCode'])[_0x35db('0x35')](_0x521937[_0x35db('0x95')]);}}else{return _0x174e14[_0x35db('0x23')](0xc8);}})[_0x35db('0x50')](handleError(_0x174e14,null));};exports['webhookPost']=function(_0x313ff7,_0x571ece,_0x4c15e4){return BPromise[_0x35db('0xa9')]()[_0x35db('0x2e')](function(){if(!_0x313ff7['query'][_0x35db('0xa')]){throw new Error(_0x35db('0xaa'));}if(!_0x313ff7[_0x35db('0x3c')][_0x35db('0xa0')]){throw new Error(_0x35db('0xab'));}var _0x5010da=_0x313ff7['query'][_0x35db('0xa1')]?_0x313ff7[_0x35db('0x3c')][_0x35db('0xa1')]+':'+_0x313ff7[_0x35db('0x3c')][_0x35db('0xa0')]:'http://localhost:'+_0x313ff7[_0x35db('0x3c')]['port'];var _0x5161e0=_0x313ff7[_0x35db('0x3c')][_0x35db('0x25')]?_0x313ff7[_0x35db('0x3c')][_0x35db('0x25')]:!![];var _0x1a76c7=_0x313ff7[_0x35db('0x3c')][_0x35db('0xa2')]?_0x313ff7[_0x35db('0x3c')]['encoding']:null;var _0x1dae03={'method':_0x313ff7[_0x35db('0xa3')],'uri':util['format'](_0x35db('0xa4'),_0x5010da,_0x313ff7[_0x35db('0x3c')][_0x35db('0xa')]),'json':_0x5161e0,'resolveWithFullResponse':!![],'encoding':_0x1a76c7,'body':_0x313ff7[_0x35db('0x95')]};if(_0x313ff7['headers']){_0x1dae03[_0x35db('0xa5')]=_0x313ff7['headers'];if(_0x1dae03[_0x35db('0xa5')]['content-length']){delete _0x1dae03['headers'][_0x35db('0xa6')];}}if(_0x1dae03['headers']['content-type']){delete _0x1dae03[_0x35db('0xa5')][_0x35db('0xa7')];}return rp(_0x1dae03);})[_0x35db('0x2e')](function(_0xce0105){if(_0xce0105){_0x571ece['set'](_0xce0105[_0x35db('0xa5')]);logger[_0x35db('0x6b')](_0xce0105['body']);return _0x571ece['status'](_0xce0105['statusCode'])[_0x35db('0x35')](_0xce0105[_0x35db('0x95')]);}else{return _0x571ece[_0x35db('0x23')](0xc8);}})['catch'](handleError(_0x571ece,null));}; \ No newline at end of file +var _0xf765=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','Plugins','UserProfileResource','end','error','name','index','map','Plugin','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','options','includeAll','findAll','rows','include','find','download','params','path','join','%s.zip','basename','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','root','server/files/plugins','dirname','attachments/**/*','close','existsSync','Plugin\x20not\x20found','format','Error','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','admin','views','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','agent','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','scriptPath','create','body','role','userProfileId','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','statusCode','content-type','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf765,0x1e7));var _0x5f76=function(_0x216782,_0x1f15e9){_0x216782=_0x216782-0x0;var _0x35176e=_0xf765[_0x216782];return _0x35176e;};'use strict';var pdf=require(_0x5f76('0x0'));var emlformat=require(_0x5f76('0x1'));var rimraf=require(_0x5f76('0x2'));var zipdir=require(_0x5f76('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f76('0x4'));var moment=require(_0x5f76('0x5'));var BPromise=require(_0x5f76('0x6'));var Mustache=require(_0x5f76('0x7'));var util=require(_0x5f76('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x5f76('0x9'));var ejs=require(_0x5f76('0xa'));var fs=require('fs');var _=require(_0x5f76('0xb'));var squel=require(_0x5f76('0xc'));var crypto=require(_0x5f76('0xd'));var jsforce=require(_0x5f76('0xe'));var deskjs=require(_0x5f76('0xf'));var toCsv=require(_0x5f76('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x5f76('0x10'));var rimraf=require(_0x5f76('0x2'));var archiver=require(_0x5f76('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f76('0x12'));var as=require(_0x5f76('0x13'));var hardwareService=require(_0x5f76('0x14'));var logger=require(_0x5f76('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5f76('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5f76('0x17')](config[_0x5f76('0x18')],{'host':_0x5f76('0x19'),'port':0x18eb});var socket=require(_0x5f76('0x1a'))(new Redis(config[_0x5f76('0x18')]));require(_0x5f76('0x1b'))[_0x5f76('0x1c')](socket);function respondWithStatusCode(_0x2b0080,_0x30c474){_0x30c474=_0x30c474||0xcc;return function(_0x40c713){if(_0x40c713){return _0x2b0080[_0x5f76('0x1d')](_0x30c474);}return _0x2b0080[_0x5f76('0x1e')](_0x30c474)['end']();};}function respondWithResult(_0x1d2bf7,_0x1391ef){_0x1391ef=_0x1391ef||0xc8;return function(_0x19fc50){if(_0x19fc50){return _0x1d2bf7[_0x5f76('0x1e')](_0x1391ef)[_0x5f76('0x1f')](_0x19fc50);}};}function respondWithFilteredResult(_0x51e882,_0x1c12cd){return function(_0x16ea19){if(_0x16ea19){var _0x2418df=_0x16ea19[_0x5f76('0x20')],_0x4e7486=_0x1c12cd['offset'],_0x24953e=_0x1c12cd[_0x5f76('0x21')]+_0x1c12cd[_0x5f76('0x22')],_0xbd9385;if(_0x24953e>=_0x2418df){_0x24953e=_0x2418df;_0xbd9385=0xc8;}else{_0xbd9385=0xce;}_0x51e882[_0x5f76('0x1e')](_0xbd9385);return _0x51e882[_0x5f76('0x23')](_0x5f76('0x24'),_0x4e7486+'-'+_0x24953e+'/'+_0x2418df)[_0x5f76('0x1f')](_0x16ea19);}return null;};}function patchUpdates(_0x4405a2){return function(_0x1b2d52){try{jsonpatch[_0x5f76('0x25')](_0x1b2d52,_0x4405a2,!![]);}catch(_0x739aae){return BPromise[_0x5f76('0x26')](_0x739aae);}return _0x1b2d52[_0x5f76('0x27')]();};}function saveUpdates(_0x12e61c,_0x4df30c){return function(_0x57631e){if(_0x57631e){return _0x57631e['update'](_0x12e61c)[_0x5f76('0x28')](function(_0x1a58b7){return _0x1a58b7;});}return null;};}function removeEntity(_0x231937,_0x246a86){return function(_0x1259b3){if(_0x1259b3){return _0x1259b3['destroy']()[_0x5f76('0x28')](function(){var _0x4babcc=_0x1259b3[_0x5f76('0x29')]({'plain':!![]});var _0x42bfe7=_0x5f76('0x2a');return db[_0x5f76('0x2b')]['destroy']({'where':{'type':_0x42bfe7,'resourceId':_0x4babcc['id']}})['then'](function(){return _0x1259b3;});})[_0x5f76('0x28')](function(){_0x231937[_0x5f76('0x1e')](0xcc)[_0x5f76('0x2c')]();});}};}function handleEntityNotFound(_0x56e818,_0x1cad38){return function(_0x5e3c3e){if(!_0x5e3c3e){_0x56e818[_0x5f76('0x1d')](0x194);}return _0x5e3c3e;};}function handleError(_0x481160,_0x246307){_0x246307=_0x246307||0x1f4;return function(_0x11ed91){logger[_0x5f76('0x2d')](_0x11ed91['stack']);if(_0x11ed91[_0x5f76('0x2e')]){delete _0x11ed91['name'];}_0x481160['status'](_0x246307)['send'](_0x11ed91);};}exports[_0x5f76('0x2f')]=function(_0x107ab7,_0x254f37){var _0x1d0173={},_0x1f2681={},_0x5b5a46={'count':0x0,'rows':[]};var _0x598206=_[_0x5f76('0x30')](db[_0x5f76('0x31')][_0x5f76('0x32')],function(_0x195d70){return{'name':_0x195d70['fieldName'],'type':_0x195d70[_0x5f76('0x33')][_0x5f76('0x34')]};});_0x1f2681[_0x5f76('0x35')]=_['map'](_0x598206,'name');_0x1f2681[_0x5f76('0x36')]=_[_0x5f76('0x37')](_0x107ab7[_0x5f76('0x36')]);_0x1f2681['filters']=_[_0x5f76('0x38')](_0x1f2681[_0x5f76('0x35')],_0x1f2681['query']);_0x1d0173['attributes']=_['intersection'](_0x1f2681['model'],qs[_0x5f76('0x39')](_0x107ab7[_0x5f76('0x36')][_0x5f76('0x39')]));_0x1d0173[_0x5f76('0x3a')]=_0x1d0173['attributes'][_0x5f76('0x3b')]?_0x1d0173[_0x5f76('0x3a')]:_0x1f2681['model'];if(!_0x107ab7[_0x5f76('0x36')]['hasOwnProperty'](_0x5f76('0x3c'))){_0x1d0173[_0x5f76('0x22')]=qs[_0x5f76('0x22')](_0x107ab7[_0x5f76('0x36')][_0x5f76('0x22')]);_0x1d0173[_0x5f76('0x21')]=qs['offset'](_0x107ab7[_0x5f76('0x36')][_0x5f76('0x21')]);}_0x1d0173[_0x5f76('0x3d')]=qs[_0x5f76('0x3e')](_0x107ab7[_0x5f76('0x36')][_0x5f76('0x3e')]);_0x1d0173['where']=qs['filters'](_['pick'](_0x107ab7[_0x5f76('0x36')],_0x1f2681[_0x5f76('0x3f')]),_0x598206);if(_0x107ab7['query'][_0x5f76('0x40')]){_0x1d0173['where']=_['merge'](_0x1d0173[_0x5f76('0x41')],{'$or':_[_0x5f76('0x30')](_0x598206,function(_0x30533f){if(_0x30533f[_0x5f76('0x33')]!=='VIRTUAL'){var _0x1c44cd={};_0x1c44cd[_0x30533f[_0x5f76('0x2e')]]={'$like':'%'+_0x107ab7[_0x5f76('0x36')][_0x5f76('0x40')]+'%'};return _0x1c44cd;}})});}_0x1d0173=_['merge']({},_0x1d0173,_0x107ab7[_0x5f76('0x42')]);var _0x2350a4={'where':_0x1d0173[_0x5f76('0x41')]};return db['Plugin'][_0x5f76('0x20')](_0x2350a4)['then'](function(_0x33dd99){_0x5b5a46['count']=_0x33dd99;if(_0x107ab7['query'][_0x5f76('0x43')]){_0x1d0173['include']=[{'all':!![]}];}return db[_0x5f76('0x31')][_0x5f76('0x44')](_0x1d0173);})['then'](function(_0x297e36){_0x5b5a46[_0x5f76('0x45')]=_0x297e36;return _0x5b5a46;})[_0x5f76('0x28')](respondWithFilteredResult(_0x254f37,_0x1d0173))['catch'](handleError(_0x254f37,null));};exports['show']=function(_0x811930,_0x22cd4b){var _0x493ac0={'raw':!![],'where':{'id':_0x811930['params']['id']}},_0x45feae={};_0x45feae[_0x5f76('0x35')]=_[_0x5f76('0x37')](db[_0x5f76('0x31')][_0x5f76('0x32')]);_0x45feae[_0x5f76('0x36')]=_[_0x5f76('0x37')](_0x811930['query']);_0x45feae[_0x5f76('0x3f')]=_[_0x5f76('0x38')](_0x45feae[_0x5f76('0x35')],_0x45feae[_0x5f76('0x36')]);_0x493ac0[_0x5f76('0x3a')]=_['intersection'](_0x45feae['model'],qs['fields'](_0x811930[_0x5f76('0x36')][_0x5f76('0x39')]));_0x493ac0['attributes']=_0x493ac0['attributes'][_0x5f76('0x3b')]?_0x493ac0[_0x5f76('0x3a')]:_0x45feae[_0x5f76('0x35')];if(_0x811930[_0x5f76('0x36')][_0x5f76('0x43')]){_0x493ac0[_0x5f76('0x46')]=[{'all':!![]}];}_0x493ac0=_['merge']({},_0x493ac0,_0x811930[_0x5f76('0x42')]);return db['Plugin'][_0x5f76('0x47')](_0x493ac0)[_0x5f76('0x28')](handleEntityNotFound(_0x22cd4b,null))[_0x5f76('0x28')](respondWithResult(_0x22cd4b,null))['catch'](handleError(_0x22cd4b,null));};exports[_0x5f76('0x48')]=function(_0x1e12fd,_0x451af9,_0x129322){return db[_0x5f76('0x31')][_0x5f76('0x47')]({'where':{'id':_0x1e12fd[_0x5f76('0x49')]['id']},'attributes':['name',_0x5f76('0x4a')],'raw':!![]})[_0x5f76('0x28')](handleEntityNotFound(_0x451af9,null))['then'](function(_0xeba9b5){if(_0xeba9b5){var _0x668d44=path[_0x5f76('0x4b')](config['root'],'server/files/plugins',util['format'](_0x5f76('0x4c'),path[_0x5f76('0x4d')](_0xeba9b5[_0x5f76('0x4a')])));var _0xb669b0=fs['createWriteStream'](_0x668d44);var _0x3d2452=archiver('zip',{'zlib':{'level':0x9}});_0x3d2452['on'](_0x5f76('0x4e'),function(_0x37dca9){if(_0x37dca9[_0x5f76('0x4f')]===_0x5f76('0x50')){logger[_0x5f76('0x2d')](_0x37dca9);}else{throw new db['Sequelize']['Error'](_0x5f76('0x51'));}});_0x3d2452['on'](_0x5f76('0x2d'),function(_0x2b2f4b){throw new db[(_0x5f76('0x52'))]['Error'](_0x5f76('0x51'));});_0x3d2452['pipe'](_0xb669b0);_0x3d2452[_0x5f76('0x53')]('**/*',{'cwd':path['join'](config[_0x5f76('0x54')],_0x5f76('0x55'),path[_0x5f76('0x56')](_0xeba9b5['path'])),'ignore':[path[_0x5f76('0x4b')](path[_0x5f76('0x4d')](_0xeba9b5[_0x5f76('0x4a')]),'node_modules/**/*'),path[_0x5f76('0x4b')](path[_0x5f76('0x4d')](_0xeba9b5[_0x5f76('0x4a')]),_0x5f76('0x57'))],'nodir':!![]})['finalize']();_0xb669b0['on'](_0x5f76('0x58'),function(){if(!fs[_0x5f76('0x59')](_0x668d44)){throw new db['Sequelize']['Error'](_0x5f76('0x5a'));}return _0x451af9[_0x5f76('0x48')](_0x668d44,util[_0x5f76('0x5b')](_0x5f76('0x4c'),path[_0x5f76('0x4d')](_0xeba9b5[_0x5f76('0x4a')])),function(_0x947c70){if(_0x947c70){throw new db[(_0x5f76('0x52'))][(_0x5f76('0x5c'))](_0x5f76('0x5d'));}fs[_0x5f76('0x5e')](_0x668d44);logger[_0x5f76('0x5f')](_0x5f76('0x60'));logger[_0x5f76('0x5f')](_0x5f76('0x61'));});});}return null;})[_0x5f76('0x62')](handleError(_0x451af9,null));};exports[_0x5f76('0x63')]=function(_0x10f433,_0x472f34,_0x482fd0){var _0x307ffc=path[_0x5f76('0x4d')](_0x10f433[_0x5f76('0x64')][_0x5f76('0x65')],path[_0x5f76('0x66')](_0x10f433[_0x5f76('0x64')][_0x5f76('0x65')]));var _0x440375=path[_0x5f76('0x4b')](config['root'],'server/files/plugins',_0x10f433[_0x5f76('0x64')]['filename']);var _0x2c8fda=path[_0x5f76('0x4b')](config[_0x5f76('0x54')],_0x5f76('0x55'),_0x307ffc);logger[_0x5f76('0x5f')]('Plugin\x20upload\x20filepath:\x20%s',_0x440375);logger[_0x5f76('0x5f')](_0x5f76('0x67'),_0x2c8fda);try{fs['chmodSync'](_0x440375,parseInt(_0x5f76('0x68'),0x8));extract(_0x440375,{'dir':_0x2c8fda},function(_0x50b42d){if(_0x50b42d){logger[_0x5f76('0x2d')](_0x50b42d);handleError(_0x50b42d,!![]);};var _0x413ecb=fs['readdirSync'](_0x2c8fda);if(_0x413ecb[_0x5f76('0x3b')]>0x1){removeReferences(_0x440375,_0x2c8fda);logger['error']('Invalid\x20plugin\x20structure');return _0x482fd0(new Error(_0x5f76('0x69')));}var _0x4c3ed8=fs[_0x5f76('0x6a')](path[_0x5f76('0x4b')](_0x2c8fda,_0x413ecb[0x0]));if(_0x4c3ed8[_0x5f76('0x6b')]()){removeReferences(_0x440375,_0x2c8fda);logger[_0x5f76('0x2d')]('Invalid\x20plugin\x20structure');return _0x482fd0(new Error('Invalid\x20plugin\x20structure'));}if(_0x4c3ed8['isDirectory']()){var _0x3f3d1d=fs[_0x5f76('0x6c')](path['join'](_0x2c8fda,_0x413ecb[0x0]));if(_0x3f3d1d[_0x5f76('0x3b')]===0x0){removeReferences(_0x440375,_0x2c8fda);logger['error']('Invalid\x20plugin\x20structure');return _0x482fd0(new Error('Invalid\x20plugin\x20structure'));}var _0x1aedd1=_0x3f3d1d[_0x5f76('0x6d')](function(_0x36eae6){return _0x36eae6==='manifest.json';});if(!_0x1aedd1){return _0x482fd0(new Error(_0x5f76('0x6e')));}var _0x4f7672=fs[_0x5f76('0x6f')](path[_0x5f76('0x4b')](_0x2c8fda,_0x413ecb[0x0],_0x5f76('0x70')));var _0x385b38=JSON[_0x5f76('0x71')](_0x4f7672);if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x2e')]){return _0x482fd0(new Error(_0x5f76('0x73')));}if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x33')]){return _0x482fd0(new Error(_0x5f76('0x74')));}if(_0x5f76('0x72')==typeof _0x385b38['version']){return _0x482fd0(new Error(_0x5f76('0x75')));}if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')]){return _0x482fd0(new Error(_0x5f76('0x77')));}if(_0x385b38['type']===_0x5f76('0x78')){if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')]['views']){return _0x482fd0(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x385b38[_0x5f76('0x76')]['views'][_0x5f76('0x79')]&&_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]['agent']){return _0x482fd0(new Error(_0x5f76('0x7b')));}}else if(_0x385b38['type']==='script'){if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')]['scriptName']){return _0x482fd0(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x5f76('0x72')==typeof _0x385b38[_0x5f76('0x76')]['scriptPath']){return _0x482fd0(new Error(_0x5f76('0x7c')));}}else{return _0x482fd0(new Error(_0x5f76('0x7d')));}var _0x7990a7=_0x385b38[_0x5f76('0x2e')];var _0x1dab3a=_0x385b38[_0x5f76('0x7e')];var _0x37f59a=_0x385b38[_0x5f76('0x33')];var _0x5157a8=_0x385b38[_0x5f76('0x7f')]?_0x385b38[_0x5f76('0x7f')]:_0x5f76('0x80');var _0x32f630=_0x385b38[_0x5f76('0x81')]?_0x385b38[_0x5f76('0x81')]:_0x5f76('0x82');var _0x39efa1='';var _0x2d3645='';var _0x55563f='';var _0x5711d3='';var _0x17f3d1=_0x385b38[_0x5f76('0x83')];if(_0x37f59a===_0x5f76('0x78')){if(_0x5f76('0x72')!=typeof _0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')][_0x5f76('0x79')]){var _0x2702dd=_0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2702dd)){_0x39efa1=path['join']('plugins',_0x307ffc,_0x413ecb[0x0],_0x2702dd);}else{_0x39efa1=_0x2702dd;}}else{logger[_0x5f76('0x5f')](_0x5f76('0x84'));}if(_0x5f76('0x72')!=typeof _0x385b38['parameters']['views'][_0x5f76('0x85')]){var _0x297d9c=_0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')][_0x5f76('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x5f76('0x86')](_0x297d9c)){_0x2d3645=path['join'](_0x5f76('0x87'),_0x307ffc,_0x413ecb[0x0],_0x297d9c);}else{_0x2d3645=_0x297d9c;}}else{logger[_0x5f76('0x5f')](_0x5f76('0x88'));}}else if(_0x37f59a===_0x5f76('0x89')){_0x55563f=_0x385b38['parameters'][_0x5f76('0x8a')];_0x5711d3=_0x385b38['parameters'][_0x5f76('0x8b')];if(_0x5f76('0x72')!=typeof _0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]){if(_0x5f76('0x72')!=typeof _0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]['admin']){var _0x2702dd=_0x385b38[_0x5f76('0x76')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2702dd)){_0x39efa1=path['join']('plugins',_0x307ffc,_0x413ecb[0x0],_0x2702dd);}else{_0x39efa1=_0x2702dd;}}if(_0x5f76('0x72')!=typeof _0x385b38[_0x5f76('0x76')]['views']['agent']){var _0x297d9c=_0x385b38[_0x5f76('0x76')][_0x5f76('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x5f76('0x86')](_0x297d9c)){_0x2d3645=path[_0x5f76('0x4b')]('plugins',_0x307ffc,_0x413ecb[0x0],_0x297d9c);}else{_0x2d3645=_0x297d9c;}}}}var _0x2c6718={'name':_0x7990a7,'description':_0x1dab3a,'path':path[_0x5f76('0x4b')](_0x307ffc,_0x413ecb[0x0]),'type':_0x37f59a,'sidebar':_0x5157a8,'icon':_0x32f630,'adminUrl':_0x39efa1,'agentUrl':_0x2d3645,'scriptName':_0x55563f,'scriptPath':_0x5711d3,'version':_0x17f3d1};removeReferences(_0x440375,null);return db[_0x5f76('0x31')][_0x5f76('0x8c')](_0x2c6718)['then'](function(_0x5a9dd1){var _0x4a271c={'role':_0x10f433[_0x5f76('0x8d')][_0x5f76('0x8e')],'userProfileId':_0x10f433['body'][_0x5f76('0x8f')]};if(!_0x4a271c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a271c['role']===_0x5f76('0x90')){var _0x2a868d=_0x5a9dd1['get']({'plain':!![]});return db[_0x5f76('0x91')][_0x5f76('0x47')]({'where':{'name':_0x5f76('0x2a'),'userProfileId':_0x4a271c[_0x5f76('0x8f')]},'raw':!![]})[_0x5f76('0x28')](function(_0x2bb2af){if(_0x2bb2af&&_0x2bb2af['autoAssociation']===0x0){return db[_0x5f76('0x2b')][_0x5f76('0x8c')]({'name':_0x2a868d[_0x5f76('0x2e')],'resourceId':_0x2a868d['id'],'type':_0x2bb2af['name'],'sectionId':_0x2bb2af['id']},{})[_0x5f76('0x28')](function(){return _0x5a9dd1;});}else{return _0x5a9dd1;}})[_0x5f76('0x62')](function(_0x35bd43){logger[_0x5f76('0x2d')](_0x5f76('0x92'),_0x35bd43);throw _0x35bd43;});}return _0x5a9dd1;})[_0x5f76('0x28')](respondWithResult(_0x472f34,null))[_0x5f76('0x62')](handleError(_0x472f34,null));}});}catch(_0x32a269){_0x472f34[_0x5f76('0x1e')](0x1f4)[_0x5f76('0x93')](_0x32a269);}};function removeReferences(_0x333515,_0x2faa08){try{if(_0x333515){fs[_0x5f76('0x5e')](_0x333515);logger[_0x5f76('0x5f')](_0x5f76('0x94'));}if(_0x2faa08){rimraf(_0x2faa08,function(){});logger[_0x5f76('0x5f')](_0x5f76('0x95'));}}catch(_0x47d8c8){logger['error'](_0x47d8c8);}}exports['update']=function(_0x2c6a2a,_0x485de4,_0x1a1307){return db[_0x5f76('0x31')][_0x5f76('0x47')]({'where':{'id':_0x2c6a2a[_0x5f76('0x49')]['id']}})['then'](handleEntityNotFound(_0x485de4,null))[_0x5f76('0x28')](saveUpdates(_0x2c6a2a[_0x5f76('0x8d')],null))[_0x5f76('0x28')](respondWithResult(_0x485de4,null))[_0x5f76('0x62')](handleError(_0x485de4,null));};exports[_0x5f76('0x96')]=function(_0x57cb79,_0x59d8cc,_0x5e3a50){return db['Plugin'][_0x5f76('0x47')]({'where':{'id':_0x57cb79['params']['id']}})[_0x5f76('0x28')](function(_0x5d6a9a){if(_0x5d6a9a){return _0x5d6a9a['destroy']();}})[_0x5f76('0x28')](function(_0x6407c6){rimraf(path[_0x5f76('0x4b')](config[_0x5f76('0x54')],_0x5f76('0x55'),path[_0x5f76('0x56')](_0x6407c6[_0x5f76('0x4a')])),function(){});return _0x6407c6;})[_0x5f76('0x28')](handleEntityNotFound(_0x59d8cc,null))['then'](respondWithStatusCode(_0x59d8cc,null))['catch'](handleError(_0x59d8cc,null));};exports[_0x5f76('0x97')]=function(_0x1b51b6,_0x126990,_0x8b45f7){return BPromise[_0x5f76('0x98')]()[_0x5f76('0x28')](function(){if(!_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x4a')]){throw new Error(_0x5f76('0x99'));}if(!_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9a')]){throw new Error(_0x5f76('0x9b'));}var _0x11ce0e=_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9c')]?_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9c')]+':'+_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9a')]:_0x5f76('0x9d')+_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x9a')];var _0x149cd5=_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x1f')]?_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x1f')]:!![];var _0x31b598=_0x1b51b6['query']['encoding']?_0x1b51b6['query'][_0x5f76('0x9e')]:null;var _0x36dbf3={'method':_0x1b51b6[_0x5f76('0x9f')],'uri':util[_0x5f76('0x5b')]('%s%s',_0x11ce0e,_0x1b51b6['query'][_0x5f76('0x4a')]),'json':_0x149cd5,'resolveWithFullResponse':!![],'encoding':_0x31b598,'qs':_0x1b51b6['query']};if(_0x1b51b6[_0x5f76('0xa0')]){_0x36dbf3[_0x5f76('0xa0')]=_0x1b51b6['headers'];if(_0x36dbf3[_0x5f76('0xa0')]['content-length']){delete _0x36dbf3[_0x5f76('0xa0')][_0x5f76('0xa1')];}}if(_0x36dbf3['headers']['content-type']){delete _0x36dbf3['headers']['content-type'];}return rp(_0x36dbf3);})[_0x5f76('0x28')](function(_0x3323ff){if(_0x3323ff){_0x126990[_0x5f76('0x23')](_0x3323ff[_0x5f76('0xa0')]);logger[_0x5f76('0x5f')](_0x3323ff[_0x5f76('0x8d')]);if(_['endsWith'](_0x1b51b6[_0x5f76('0x36')][_0x5f76('0x4a')],_0x5f76('0x48'))&&_0x3323ff['statusCode']==0x1f4){return _0x126990[_0x5f76('0x1d')](_0x3323ff[_0x5f76('0xa2')]);}else{return _0x126990['status'](_0x3323ff[_0x5f76('0xa2')])[_0x5f76('0x93')](_0x3323ff[_0x5f76('0x8d')]);}}else{return _0x126990[_0x5f76('0x1d')](0xc8);}})['catch'](handleError(_0x126990,null));};exports['webhookPost']=function(_0x318127,_0x2e363a,_0x86afab){return BPromise['resolve']()[_0x5f76('0x28')](function(){if(!_0x318127[_0x5f76('0x36')][_0x5f76('0x4a')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x318127[_0x5f76('0x36')][_0x5f76('0x9a')]){throw new Error(_0x5f76('0x9b'));}var _0x7b58b=_0x318127[_0x5f76('0x36')][_0x5f76('0x9c')]?_0x318127[_0x5f76('0x36')][_0x5f76('0x9c')]+':'+_0x318127[_0x5f76('0x36')][_0x5f76('0x9a')]:_0x5f76('0x9d')+_0x318127[_0x5f76('0x36')][_0x5f76('0x9a')];var _0x45ff3f=_0x318127[_0x5f76('0x36')]['json']?_0x318127[_0x5f76('0x36')][_0x5f76('0x1f')]:!![];var _0x58e9f7=_0x318127['query'][_0x5f76('0x9e')]?_0x318127[_0x5f76('0x36')]['encoding']:null;var _0x295141={'method':_0x318127['method'],'uri':util[_0x5f76('0x5b')]('%s%s',_0x7b58b,_0x318127['query']['path']),'json':_0x45ff3f,'resolveWithFullResponse':!![],'encoding':_0x58e9f7,'body':_0x318127[_0x5f76('0x8d')]};if(_0x318127[_0x5f76('0xa0')]){_0x295141[_0x5f76('0xa0')]=_0x318127[_0x5f76('0xa0')];if(_0x295141['headers']['content-length']){delete _0x295141['headers'][_0x5f76('0xa1')];}}if(_0x295141['headers'][_0x5f76('0xa3')]){delete _0x295141[_0x5f76('0xa0')][_0x5f76('0xa3')];}return rp(_0x295141);})[_0x5f76('0x28')](function(_0x598f7c){if(_0x598f7c){_0x2e363a[_0x5f76('0x23')](_0x598f7c['headers']);logger[_0x5f76('0x5f')](_0x598f7c['body']);return _0x2e363a['status'](_0x598f7c[_0x5f76('0xa2')])[_0x5f76('0x93')](_0x598f7c['body']);}else{return _0x2e363a['sendStatus'](0xc8);}})[_0x5f76('0x62')](handleError(_0x2e363a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index eecc42b..b1da2db 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 _0x1eba=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','emit'];(function(_0x483f52,_0x8466d7){var _0x1b9605=function(_0x42eceb){while(--_0x42eceb){_0x483f52['push'](_0x483f52['shift']());}};_0x1b9605(++_0x8466d7);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x1eba[_0x218994];return _0x3f350b;};'use strict';var EventEmitter=require(_0xa1eb('0x0'));var Plugin=require(_0xa1eb('0x1'))['db'][_0xa1eb('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xa1eb('0x3')](0x0);var events={'afterCreate':_0xa1eb('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x205802){return function(_0x34be5a,_0x16a13a,_0xf9d704){PluginEvents[_0xa1eb('0x5')](_0x205802+':'+_0x34be5a['id'],_0x34be5a);PluginEvents[_0xa1eb('0x5')](_0x205802,_0x34be5a);_0xf9d704(null);};}for(var e in events){if(events[_0xa1eb('0x6')](e)){var event=events[e];Plugin[_0xa1eb('0x7')](e,emitEvent(event));}}module[_0xa1eb('0x8')]=PluginEvents; \ No newline at end of file +var _0x4b17=['Plugin','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4ffa7b,_0x39b58a){var _0xd7658c=function(_0x6cf44d){while(--_0x6cf44d){_0x4ffa7b['push'](_0x4ffa7b['shift']());}};_0xd7658c(++_0x39b58a);}(_0x4b17,0x10f));var _0x74b1=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x4b17[_0x44946b];return _0x249bc4;};'use strict';var EventEmitter=require(_0x74b1('0x0'));var Plugin=require('../../mysqldb')['db'][_0x74b1('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x74b1('0x2'),'afterUpdate':_0x74b1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x17689a){return function(_0x4f206f,_0x4fdea2,_0x7b3c36){PluginEvents[_0x74b1('0x4')](_0x17689a+':'+_0x4f206f['id'],_0x4f206f);PluginEvents[_0x74b1('0x4')](_0x17689a,_0x4f206f);_0x7b3c36(null);};}for(var e in events){if(events[_0x74b1('0x5')](e)){var event=events[e];Plugin[_0x74b1('0x6')](e,emitEvent(event));}}module[_0x74b1('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 3936632..6c498b9 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 _0x38e3=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','Plugin','plugins','lodash'];(function(_0x27653b,_0x360f5d){var _0x31a80e=function(_0x3eb8d5){while(--_0x3eb8d5){_0x27653b['push'](_0x27653b['shift']());}};_0x31a80e(++_0x360f5d);}(_0x38e3,0x107));var _0x338e=function(_0x4f6de9,_0x169839){_0x4f6de9=_0x4f6de9-0x0;var _0x24aaca=_0x38e3[_0x4f6de9];return _0x24aaca;};'use strict';var _=require(_0x338e('0x0'));var util=require(_0x338e('0x1'));var logger=require(_0x338e('0x2'))(_0x338e('0x3'));var moment=require('moment');var BPromise=require(_0x338e('0x4'));var rp=require(_0x338e('0x5'));var fs=require('fs');var path=require(_0x338e('0x6'));var rimraf=require(_0x338e('0x7'));var config=require('../../config/environment');var attributes=require(_0x338e('0x8'));module[_0x338e('0x9')]=function(_0x55d781,_0x148562){return _0x55d781['define'](_0x338e('0xa'),attributes,{'tableName':_0x338e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9f9=['./plugin.attributes','exports','lodash','util','api','request-promise','path','rimraf','../../config/environment'];(function(_0x891872,_0x76fc8e){var _0x5bacc9=function(_0x296967){while(--_0x296967){_0x891872['push'](_0x891872['shift']());}};_0x5bacc9(++_0x76fc8e);}(_0xc9f9,0x1f1));var _0x9c9f=function(_0x46c5fe,_0xc40513){_0x46c5fe=_0x46c5fe-0x0;var _0x294760=_0xc9f9[_0x46c5fe];return _0x294760;};'use strict';var _=require(_0x9c9f('0x0'));var util=require(_0x9c9f('0x1'));var logger=require('../../config/logger')(_0x9c9f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c9f('0x3'));var fs=require('fs');var path=require(_0x9c9f('0x4'));var rimraf=require(_0x9c9f('0x5'));var config=require(_0x9c9f('0x6'));var attributes=require(_0x9c9f('0x7'));module[_0x9c9f('0x8')]=function(_0x120dd7,_0xdb917b){return _0x120dd7['define']('Plugin',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 a2ca23f..705f79f 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 _0x76b7=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreatePlugin','Plugin','body','options','raw','debug','stringify','util','moment','bluebird','ioredis'];(function(_0x2c0c40,_0x29f6da){var _0x16b689=function(_0x15e592){while(--_0x15e592){_0x2c0c40['push'](_0x2c0c40['shift']());}};_0x16b689(++_0x29f6da);}(_0x76b7,0x80));var _0x776b=function(_0x442e0d,_0x4c325d){_0x442e0d=_0x442e0d-0x0;var _0xa809b6=_0x76b7[_0x442e0d];return _0xa809b6;};'use strict';var _=require('lodash');var util=require(_0x776b('0x0'));var moment=require(_0x776b('0x1'));var BPromise=require(_0x776b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x776b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x776b('0x4'));var logger=require(_0x776b('0x5'))(_0x776b('0x6'));var config=require(_0x776b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x776b('0x8')][_0x776b('0x9')]({'port':0x232a});config['redis']=_[_0x776b('0xa')](config['redis'],{'host':_0x776b('0xb'),'port':0x18eb});var socket=require(_0x776b('0xc'))(new Redis(config[_0x776b('0xd')]));require(_0x776b('0xe'))[_0x776b('0xf')](socket);function respondWithRpcPromise(_0x5bfd9b,_0x5c2487,_0x1d156a){return new BPromise(function(_0x419498,_0x48a4bf){return client['request'](_0x5bfd9b,_0x1d156a)[_0x776b('0x10')](function(_0x5a01a6){logger[_0x776b('0x11')](_0x776b('0x12'),_0x5c2487,'request\x20sent');logger['debug'](_0x776b('0x13'),_0x5c2487,_0x776b('0x14'),JSON['stringify'](_0x5a01a6));if(_0x5a01a6[_0x776b('0x15')]){if(_0x5a01a6['error'][_0x776b('0x16')]===0x1f4){logger[_0x776b('0x15')]('Plugin,\x20%s,\x20%s',_0x5c2487,_0x5a01a6[_0x776b('0x15')][_0x776b('0x17')]);return _0x48a4bf(_0x5a01a6[_0x776b('0x15')][_0x776b('0x17')]);}logger['error'](_0x776b('0x12'),_0x5c2487,_0x5a01a6[_0x776b('0x15')][_0x776b('0x17')]);return _0x419498(_0x5a01a6[_0x776b('0x15')][_0x776b('0x17')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x5c2487,_0x776b('0x14'));_0x419498(_0x5a01a6[_0x776b('0x18')][_0x776b('0x17')]);}})[_0x776b('0x19')](function(_0x2f3dab){logger['error'](_0x776b('0x12'),_0x5c2487,_0x2f3dab);_0x48a4bf(_0x2f3dab);});});}exports[_0x776b('0x1a')]=function(_0x535486){var _0x414355=this;return new Promise(function(_0x1fb8ea,_0x315f67){return db[_0x776b('0x1b')]['create'](_0x535486[_0x776b('0x1c')],{'raw':_0x535486[_0x776b('0x1d')]?_0x535486[_0x776b('0x1d')][_0x776b('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x163c33){logger[_0x776b('0x11')](_0x776b('0x1a'),_0x535486);logger[_0x776b('0x1f')](_0x776b('0x1a'),_0x535486,JSON[_0x776b('0x20')](_0x163c33));_0x1fb8ea(_0x163c33);})['catch'](function(_0x2a03ff){logger['error'](_0x776b('0x1a'),_0x2a03ff[_0x776b('0x17')],_0x535486);_0x315f67(_0x414355[_0x776b('0x15')](0x1f4,_0x2a03ff[_0x776b('0x17')]));});});}; \ No newline at end of file +var _0x4380=['stringify','error','message','catch','CreatePlugin','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4380,0x93));var _0x0438=function(_0x50b78f,_0x4d08dd){_0x50b78f=_0x50b78f-0x0;var _0x4b98a3=_0x4380[_0x50b78f];return _0x4b98a3;};'use strict';var _=require(_0x0438('0x0'));var util=require(_0x0438('0x1'));var moment=require(_0x0438('0x2'));var BPromise=require('bluebird');var rs=require(_0x0438('0x3'));var fs=require('fs');var Redis=require(_0x0438('0x4'));var db=require(_0x0438('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0438('0x6'));var config=require(_0x0438('0x7'));var jayson=require(_0x0438('0x8'));var client=jayson[_0x0438('0x9')]['http']({'port':0x232a});config[_0x0438('0xa')]=_[_0x0438('0xb')](config[_0x0438('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0438('0xc'))(new Redis(config['redis']));require(_0x0438('0xd'))[_0x0438('0xe')](socket);function respondWithRpcPromise(_0x313ed4,_0x2ed9f0,_0x4d0225){return new BPromise(function(_0x54d517,_0x6cc500){return client[_0x0438('0xf')](_0x313ed4,_0x4d0225)[_0x0438('0x10')](function(_0x3a898b){logger[_0x0438('0x11')](_0x0438('0x12'),_0x2ed9f0,_0x0438('0x13'));logger[_0x0438('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x2ed9f0,_0x0438('0x13'),JSON[_0x0438('0x15')](_0x3a898b));if(_0x3a898b[_0x0438('0x16')]){if(_0x3a898b[_0x0438('0x16')]['code']===0x1f4){logger[_0x0438('0x16')](_0x0438('0x12'),_0x2ed9f0,_0x3a898b['error'][_0x0438('0x17')]);return _0x6cc500(_0x3a898b[_0x0438('0x16')]['message']);}logger['error']('Plugin,\x20%s,\x20%s',_0x2ed9f0,_0x3a898b[_0x0438('0x16')][_0x0438('0x17')]);return _0x54d517(_0x3a898b[_0x0438('0x16')][_0x0438('0x17')]);}else{logger[_0x0438('0x11')](_0x0438('0x12'),_0x2ed9f0,'request\x20sent');_0x54d517(_0x3a898b['result'][_0x0438('0x17')]);}})[_0x0438('0x18')](function(_0x59ba67){logger[_0x0438('0x16')]('Plugin,\x20%s,\x20%s',_0x2ed9f0,_0x59ba67);_0x6cc500(_0x59ba67);});});}exports[_0x0438('0x19')]=function(_0x544422){var _0x4c3914=this;return new Promise(function(_0x15cd53,_0x398ace){return db['Plugin']['create'](_0x544422[_0x0438('0x1a')],{'raw':_0x544422[_0x0438('0x1b')]?_0x544422['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3d6fe6){logger[_0x0438('0x11')](_0x0438('0x19'),_0x544422);logger[_0x0438('0x14')]('CreatePlugin',_0x544422,JSON[_0x0438('0x15')](_0x3d6fe6));_0x15cd53(_0x3d6fe6);})[_0x0438('0x18')](function(_0xe78e7){logger['error'](_0x0438('0x19'),_0xe78e7['message'],_0x544422);_0x398ace(_0x4c3914[_0x0438('0x16')](0x1f4,_0xe78e7[_0x0438('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 224d685..8ef4835 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 _0x6743=['plugin:','./plugin.events','save','remove','update','emit','removeListener','register','length'];(function(_0x2426d6,_0x1ce8c2){var _0x2fbcb8=function(_0x7ede11){while(--_0x7ede11){_0x2426d6['push'](_0x2426d6['shift']());}};_0x2fbcb8(++_0x1ce8c2);}(_0x6743,0xd0));var _0x3674=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x6743[_0x6a0266];return _0x309e00;};'use strict';var PluginEvents=require(_0x3674('0x0'));var events=[_0x3674('0x1'),_0x3674('0x2'),_0x3674('0x3')];function createListener(_0xfe27aa,_0x99946b){return function(_0x188d96){_0x99946b[_0x3674('0x4')](_0xfe27aa,_0x188d96);};}function removeListener(_0xa75fc3,_0x4b813c){return function(){PluginEvents[_0x3674('0x5')](_0xa75fc3,_0x4b813c);};}exports[_0x3674('0x6')]=function(_0x389012){for(var _0x4b203f=0x0,_0x3673b5=events[_0x3674('0x7')];_0x4b203f<_0x3673b5;_0x4b203f++){var _0x46628=events[_0x4b203f];var _0xa634b2=createListener(_0x3674('0x8')+_0x46628,_0x389012);PluginEvents['on'](_0x46628,_0xa634b2);}}; \ No newline at end of file +var _0xb9c5=['save','update','emit','removeListener','register','plugin:'];(function(_0x9b0f0,_0x4a9e3d){var _0x226daa=function(_0x5391d3){while(--_0x5391d3){_0x9b0f0['push'](_0x9b0f0['shift']());}};_0x226daa(++_0x4a9e3d);}(_0xb9c5,0x90));var _0x5b9c=function(_0x195bc4,_0x1b0173){_0x195bc4=_0x195bc4-0x0;var _0x71ecdd=_0xb9c5[_0x195bc4];return _0x71ecdd;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x5b9c('0x0'),'remove',_0x5b9c('0x1')];function createListener(_0xc181d3,_0x56d7b0){return function(_0x813182){_0x56d7b0[_0x5b9c('0x2')](_0xc181d3,_0x813182);};}function removeListener(_0x3ef9fb,_0x33d6ae){return function(){PluginEvents[_0x5b9c('0x3')](_0x3ef9fb,_0x33d6ae);};}exports[_0x5b9c('0x4')]=function(_0x12b0e8){for(var _0x1d95c1=0x0,_0x1aeadf=events['length'];_0x1d95c1<_0x1aeadf;_0x1d95c1++){var _0x3a12c7=events[_0x1d95c1];var _0x202aaa=createListener(_0x5b9c('0x5')+_0x3a12c7,_0x12b0e8);PluginEvents['on'](_0x3a12c7,_0x202aaa);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 2bee05a..38445d3 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 _0xc3aa=['/:id','show','create','put','update','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','index'];(function(_0x10af78,_0x27fb9d){var _0x14573d=function(_0x22dadd){while(--_0x22dadd){_0x10af78['push'](_0x10af78['shift']());}};_0x14573d(++_0x27fb9d);}(_0xc3aa,0x18e));var _0xac3a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc3aa[_0x2be8c2];return _0x97f531;};'use strict';var express=require(_0xac3a('0x0'));var router=express[_0xac3a('0x1')]();var auth=require(_0xac3a('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0xac3a('0x3')](),controller[_0xac3a('0x4')]);router['get'](_0xac3a('0x5'),auth['isAuthenticated'](),controller[_0xac3a('0x6')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac3a('0x7')]);router[_0xac3a('0x8')](_0xac3a('0x5'),auth['isAuthenticated'](),controller[_0xac3a('0x9')]);router[_0xac3a('0xa')](_0xac3a('0x5'),auth[_0xac3a('0x3')](),controller[_0xac3a('0xb')]);module[_0xac3a('0xc')]=router; \ No newline at end of file +var _0x2d55=['../../components/auth/service','./pm2.controller','index','get','/:id','isAuthenticated','post','put','update','delete','exports','express'];(function(_0x36d57f,_0x2f9118){var _0x3f93fb=function(_0x567b58){while(--_0x567b58){_0x36d57f['push'](_0x36d57f['shift']());}};_0x3f93fb(++_0x2f9118);}(_0x2d55,0x8f));var _0x52d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d55[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x52d5('0x0'));var router=express['Router']();var auth=require(_0x52d5('0x1'));var controller=require(_0x52d5('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x52d5('0x3')]);router[_0x52d5('0x4')](_0x52d5('0x5'),auth[_0x52d5('0x6')](),controller['show']);router[_0x52d5('0x7')]('/',auth[_0x52d5('0x6')](),controller['create']);router[_0x52d5('0x8')](_0x52d5('0x5'),auth['isAuthenticated'](),controller[_0x52d5('0x9')]);router[_0x52d5('0xa')](_0x52d5('0x5'),auth['isAuthenticated'](),controller['destroy']);module[_0x52d5('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index beeebfa..cb8f94a 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 _0x270b=['delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','exec','bluebird','sendStatus','status','json','stack','name','npm\x20install','info','error','index','list','then','reject','express','motion2','length','show','params','catch','create','body','script','join','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','destroy'];(function(_0x4f698e,_0x17fcac){var _0x107668=function(_0x2d0e56){while(--_0x2d0e56){_0x4f698e['push'](_0x4f698e['shift']());}};_0x107668(++_0x17fcac);}(_0x270b,0x173));var _0xb270=function(_0x3090b9,_0x44b3e7){_0x3090b9=_0x3090b9-0x0;var _0x5ab367=_0x270b[_0x3090b9];return _0x5ab367;};'use strict';var _=require(_0xb270('0x0'));var pm2=require(_0xb270('0x1'));var logger=require(_0xb270('0x2'))('api');var path=require(_0xb270('0x3'));var exec=require('child_process')[_0xb270('0x4')];var BPromise=require(_0xb270('0x5'));function handleEntityNotFound(_0x4db732,_0x787652){return function(_0x44fbcd){if(!_0x44fbcd){_0x4db732[_0xb270('0x6')](0x194);;}return _0x44fbcd;};}function respondWithResult(_0x22be85,_0xcf3c55){_0xcf3c55=_0xcf3c55||0xc8;return function(_0x49d31c){if(_0x49d31c){return _0x22be85[_0xb270('0x7')](_0xcf3c55)[_0xb270('0x8')](_0x49d31c);}return null;};}function handleError(_0x14f362,_0x3d3723){_0x3d3723=_0x3d3723||0x1f4;return function(_0x2b94f1){logger['error'](_0x2b94f1[_0xb270('0x9')]);if(_0x2b94f1[_0xb270('0xa')]){delete _0x2b94f1['name'];}_0x14f362[_0xb270('0x7')](_0x3d3723)['send'](_0x2b94f1);};}function execChildProcess(){return new BPromise(function(_0x6a3b4b,_0x410fc0){exec(_0xb270('0xb'),function(_0x403e65,_0x4fbb9d,_0x2ecf20){logger[_0xb270('0xc')](_0x4fbb9d);logger[_0xb270('0xc')](_0x2ecf20);if(_0x403e65){logger[_0xb270('0xd')](_0x403e65);return _0x410fc0(_0x403e65);}return _0x6a3b4b(_0x4fbb9d);});});}exports[_0xb270('0xe')]=function(_0x5656d4,_0x4da5eb){return pm2[_0xb270('0xf')]()[_0xb270('0x10')](function(_0xe7eb22){if(_0xe7eb22){var _0x4c3dd1=_[_0xb270('0x11')](_0xe7eb22,function(_0x35f8d3){return _0x35f8d3[_0xb270('0xa')]===_0xb270('0x12')||_0x35f8d3['name']===_0xb270('0x13');});return{'rows':_0x4c3dd1,'count':_0x4c3dd1[_0xb270('0x14')]};}return null;})[_0xb270('0x10')](respondWithResult(_0x4da5eb,null))['catch'](handleError(_0x4da5eb,null));};exports[_0xb270('0x15')]=function(_0x1b1734,_0x15bde6){return pm2['describe'](_0x1b1734[_0xb270('0x16')]['id'])[_0xb270('0x10')](respondWithResult(_0x15bde6,null))['then'](handleEntityNotFound(_0x15bde6,null))[_0xb270('0x17')](handleError(_0x15bde6,null));};exports[_0xb270('0x18')]=function(_0x59bb0b,_0x4736ef){if(_0x59bb0b[_0xb270('0x19')][_0xb270('0xa')]&&_0x59bb0b['body'][_0xb270('0x1a')]){var _0x1da86b=path[_0xb270('0x1b')](__dirname,'../../files/plugins',_0x59bb0b[_0xb270('0x19')][_0xb270('0x1a')]);var _0x36384f=process[_0xb270('0x1c')]();process[_0xb270('0x1d')](path[_0xb270('0x1e')](_0x1da86b));return execChildProcess()[_0xb270('0x10')](function(_0x533a87){process[_0xb270('0x1d')](_0x36384f);return pm2[_0xb270('0x1f')]({'name':_0x59bb0b[_0xb270('0x19')][_0xb270('0xa')],'script':_0x1da86b});})['then'](function(_0x3eba40){pm2[_0xb270('0x20')]();return _0x3eba40[0x0];})[_0xb270('0x10')](respondWithResult(_0x4736ef,0xc9))[_0xb270('0x17')](handleError(_0x4736ef,null));}else{return _0x4736ef[_0xb270('0x7')](0x1f4)[_0xb270('0x21')]({'message':_0xb270('0x22')});}};exports[_0xb270('0x23')]=function(_0xa326eb,_0x33b07e){if(_0xa326eb[_0xb270('0x19')]['id']){delete _0xa326eb[_0xb270('0x19')]['id'];}var _0x1bbcb8={'online':_0xb270('0x24'),'stopped':_0xb270('0x25')};if(_0x1bbcb8['hasOwnProperty'](_0xa326eb[_0xb270('0x19')][_0xb270('0x7')])){return pm2[_0x1bbcb8[_0xa326eb[_0xb270('0x19')][_0xb270('0x7')]]](_0xa326eb[_0xb270('0x16')]['id'])['then'](respondWithResult(_0x33b07e,0xc8))[_0xb270('0x17')](handleError(_0x33b07e,null));}else{return _0x33b07e[_0xb270('0x7')](0x1f4)[_0xb270('0x21')]({'message':'Unknown\x20status'});}};exports[_0xb270('0x26')]=function(_0x51630d,_0x535470){if(_0x51630d['body']['id']){delete _0x51630d[_0xb270('0x19')]['id'];}if(_0x51630d[_0xb270('0x16')]['id']){return pm2[_0xb270('0x27')](_0x51630d[_0xb270('0x16')]['id'])[_0xb270('0x10')](function(_0x38949a){pm2[_0xb270('0x20')]();return _0x38949a[0x0];})[_0xb270('0x10')](respondWithResult(_0x535470,null))[_0xb270('0x17')](handleError(_0x535470,null));}else{return _0x535470[_0xb270('0x7')](0x1f4)[_0xb270('0x21')]({'message':_0xb270('0x28')});}}; \ No newline at end of file +var _0xae18=['length','catch','show','describe','params','then','create','body','script','join','cwd','chdir','dirname','start','dump','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','child_process','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','reject','motion2'];(function(_0x213eb6,_0x2bf899){var _0x23198c=function(_0x465f7f){while(--_0x465f7f){_0x213eb6['push'](_0x213eb6['shift']());}};_0x23198c(++_0x2bf899);}(_0xae18,0x14f));var _0x8ae1=function(_0x2a2b60,_0x26ff7a){_0x2a2b60=_0x2a2b60-0x0;var _0x316eab=_0xae18[_0x2a2b60];return _0x316eab;};'use strict';var _=require(_0x8ae1('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x8ae1('0x1'))(_0x8ae1('0x2'));var path=require('path');var exec=require(_0x8ae1('0x3'))['exec'];var BPromise=require(_0x8ae1('0x4'));function handleEntityNotFound(_0x89bc4,_0x44addb){return function(_0x191492){if(!_0x191492){_0x89bc4[_0x8ae1('0x5')](0x194);;}return _0x191492;};}function respondWithResult(_0x47e7e6,_0x1d9c8d){_0x1d9c8d=_0x1d9c8d||0xc8;return function(_0x4ba230){if(_0x4ba230){return _0x47e7e6[_0x8ae1('0x6')](_0x1d9c8d)[_0x8ae1('0x7')](_0x4ba230);}return null;};}function handleError(_0x2496e7,_0x5576a5){_0x5576a5=_0x5576a5||0x1f4;return function(_0x4d6ddf){logger[_0x8ae1('0x8')](_0x4d6ddf['stack']);if(_0x4d6ddf[_0x8ae1('0x9')]){delete _0x4d6ddf[_0x8ae1('0x9')];}_0x2496e7[_0x8ae1('0x6')](_0x5576a5)[_0x8ae1('0xa')](_0x4d6ddf);};}function execChildProcess(){return new BPromise(function(_0x1a7655,_0x46b76c){exec(_0x8ae1('0xb'),function(_0x5c5f52,_0x506f34,_0x342a05){logger[_0x8ae1('0xc')](_0x506f34);logger['info'](_0x342a05);if(_0x5c5f52){logger[_0x8ae1('0x8')](_0x5c5f52);return _0x46b76c(_0x5c5f52);}return _0x1a7655(_0x506f34);});});}exports['index']=function(_0x24f62e,_0x208405){return pm2[_0x8ae1('0xd')]()['then'](function(_0x38ed87){if(_0x38ed87){var _0x4afeda=_[_0x8ae1('0xe')](_0x38ed87,function(_0x7ccd04){return _0x7ccd04['name']==='express'||_0x7ccd04['name']===_0x8ae1('0xf');});return{'rows':_0x4afeda,'count':_0x4afeda[_0x8ae1('0x10')]};}return null;})['then'](respondWithResult(_0x208405,null))[_0x8ae1('0x11')](handleError(_0x208405,null));};exports[_0x8ae1('0x12')]=function(_0x4c0cc4,_0x36e76a){return pm2[_0x8ae1('0x13')](_0x4c0cc4[_0x8ae1('0x14')]['id'])[_0x8ae1('0x15')](respondWithResult(_0x36e76a,null))[_0x8ae1('0x15')](handleEntityNotFound(_0x36e76a,null))[_0x8ae1('0x11')](handleError(_0x36e76a,null));};exports[_0x8ae1('0x16')]=function(_0xb8476e,_0x4453eb){if(_0xb8476e[_0x8ae1('0x17')][_0x8ae1('0x9')]&&_0xb8476e[_0x8ae1('0x17')][_0x8ae1('0x18')]){var _0x1851a5=path[_0x8ae1('0x19')](__dirname,'../../files/plugins',_0xb8476e['body'][_0x8ae1('0x18')]);var _0x2d92b6=process[_0x8ae1('0x1a')]();process[_0x8ae1('0x1b')](path[_0x8ae1('0x1c')](_0x1851a5));return execChildProcess()[_0x8ae1('0x15')](function(_0x32703f){process[_0x8ae1('0x1b')](_0x2d92b6);return pm2[_0x8ae1('0x1d')]({'name':_0xb8476e[_0x8ae1('0x17')][_0x8ae1('0x9')],'script':_0x1851a5});})[_0x8ae1('0x15')](function(_0x49f17b){pm2[_0x8ae1('0x1e')]();return _0x49f17b[0x0];})[_0x8ae1('0x15')](respondWithResult(_0x4453eb,0xc9))[_0x8ae1('0x11')](handleError(_0x4453eb,null));}else{return _0x4453eb[_0x8ae1('0x6')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8ae1('0x1f')]=function(_0x581569,_0xcf33f2){if(_0x581569[_0x8ae1('0x17')]['id']){delete _0x581569[_0x8ae1('0x17')]['id'];}var _0x39e4d9={'online':_0x8ae1('0x20'),'stopped':_0x8ae1('0x21')};if(_0x39e4d9[_0x8ae1('0x22')](_0x581569[_0x8ae1('0x17')]['status'])){return pm2[_0x39e4d9[_0x581569[_0x8ae1('0x17')][_0x8ae1('0x6')]]](_0x581569[_0x8ae1('0x14')]['id'])[_0x8ae1('0x15')](respondWithResult(_0xcf33f2,0xc8))['catch'](handleError(_0xcf33f2,null));}else{return _0xcf33f2['status'](0x1f4)[_0x8ae1('0xa')]({'message':_0x8ae1('0x23')});}};exports[_0x8ae1('0x24')]=function(_0xbd32ae,_0x3f8c55){if(_0xbd32ae[_0x8ae1('0x17')]['id']){delete _0xbd32ae[_0x8ae1('0x17')]['id'];}if(_0xbd32ae['params']['id']){return pm2[_0x8ae1('0x25')](_0xbd32ae[_0x8ae1('0x14')]['id'])['then'](function(_0x219c96){pm2['dump']();return _0x219c96[0x0];})['then'](respondWithResult(_0x3f8c55,null))['catch'](handleError(_0x3f8c55,null));}else{return _0x3f8c55['status'](0x1f4)['send']({'message':_0x8ae1('0x26')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index e448a84..b69bbe4 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 _0xb78c=['express','../../components/auth/service','../../components/interaction/service','multer','path'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xb78c,0x1cf));var _0xcb78=function(_0x539ce2,_0x54efa0){_0x539ce2=_0x539ce2-0x0;var _0x1c85b0=_0xb78c[_0x539ce2];return _0x1c85b0;};'use strict';var multer=require(_0xcb78('0x0'));var util=require('util');var path=require(_0xcb78('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb78('0x2'));var router=express['Router']();var auth=require(_0xcb78('0x3'));var interaction=require(_0xcb78('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x36a5=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','Router'];(function(_0x2ca093,_0x47d8de){var _0x3cd548=function(_0x4f3016){while(--_0x4f3016){_0x2ca093['push'](_0x2ca093['shift']());}};_0x3cd548(++_0x47d8de);}(_0x36a5,0x190));var _0x536a=function(_0x410b31,_0x4780be){_0x410b31=_0x410b31-0x0;var _0x2d4e33=_0x36a5[_0x410b31];return _0x2d4e33;};'use strict';var multer=require(_0x536a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x536a('0x1')]();var auth=require(_0x536a('0x2'));var interaction=require(_0x536a('0x3'));var config=require(_0x536a('0x4'));module[_0x536a('0x5')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index eb7840e..4ff5e70 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 _0x83dd=['INTEGER','STRING','DATE','exports'];(function(_0x3d75d5,_0x41f0ac){var _0x3263d3=function(_0x1c7108){while(--_0x1c7108){_0x3d75d5['push'](_0x3d75d5['shift']());}};_0x3263d3(++_0x41f0ac);}(_0x83dd,0xdb));var _0xd83d=function(_0x230798,_0xabdd81){_0x230798=_0x230798-0x0;var _0x43a98d=_0x83dd[_0x230798];return _0x43a98d;};'use strict';var Sequelize=require('sequelize');module[_0xd83d('0x0')]={'state':{'type':Sequelize[_0xd83d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xd83d('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd83d('0x3')]},'responsetime':{'type':Sequelize[_0xd83d('0x3')]},'ringtime':{'type':Sequelize[_0xd83d('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd83d('0x2')]},'campaigntype':{'type':Sequelize[_0xd83d('0x2')]},'membername':{'type':Sequelize[_0xd83d('0x2')]}}; \ No newline at end of file +var _0x7e19=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x6af1b1,_0x4ccf9e){var _0x139dae=function(_0x409ebf){while(--_0x409ebf){_0x6af1b1['push'](_0x6af1b1['shift']());}};_0x139dae(++_0x4ccf9e);}(_0x7e19,0xa1));var _0x97e1=function(_0x5dd52e,_0x98ee28){_0x5dd52e=_0x5dd52e-0x0;var _0x4d2f78=_0x7e19[_0x5dd52e];return _0x4d2f78;};'use strict';var Sequelize=require(_0x97e1('0x0'));module[_0x97e1('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x97e1('0x2')]},'scheduledat':{'type':Sequelize[_0x97e1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x97e1('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x97e1('0x2')]},'campaigntype':{'type':Sequelize[_0x97e1('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0cf2517..91b1a4b 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 _0xae53=['rimraf','../../config/environment','exports','ReportAgentPreview','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0xae53,0xea));var _0x3ae5=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xae53[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x3ae5('0x0'));var util=require('util');var logger=require(_0x3ae5('0x1'))(_0x3ae5('0x2'));var moment=require(_0x3ae5('0x3'));var BPromise=require(_0x3ae5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ae5('0x5'));var rimraf=require(_0x3ae5('0x6'));var config=require(_0x3ae5('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0x3ae5('0x8')]=function(_0x25c4c0,_0x183569){return _0x25c4c0['define'](_0x3ae5('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f78=['bluebird','rimraf','../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9f78,0x1bf));var _0x89f7=function(_0xbcb6b4,_0x58980d){_0xbcb6b4=_0xbcb6b4-0x0;var _0x16a505=_0x9f78[_0xbcb6b4];return _0x16a505;};'use strict';var _=require(_0x89f7('0x0'));var util=require('util');var logger=require(_0x89f7('0x1'))(_0x89f7('0x2'));var moment=require(_0x89f7('0x3'));var BPromise=require(_0x89f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x89f7('0x5'));var config=require(_0x89f7('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x89f7('0x7')]=function(_0x453e4e,_0x25defd){return _0x453e4e[_0x89f7('0x8')](_0x89f7('0x9'),attributes,{'tableName':_0x89f7('0xa'),'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 e9abc1c..2c1e2b9 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 _0xe3ec=['raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ReportAgentPreview','create','body','options'];(function(_0x2f2e0e,_0x21a555){var _0xe1467c=function(_0x59e5b1){while(--_0x59e5b1){_0x2f2e0e['push'](_0x2f2e0e['shift']());}};_0xe1467c(++_0x21a555);}(_0xe3ec,0x122));var _0xce3e=function(_0x53f5eb,_0x585522){_0x53f5eb=_0x53f5eb-0x0;var _0x3a7230=_0xe3ec[_0x53f5eb];return _0x3a7230;};'use strict';var _=require(_0xce3e('0x0'));var util=require(_0xce3e('0x1'));var moment=require(_0xce3e('0x2'));var BPromise=require(_0xce3e('0x3'));var rs=require(_0xce3e('0x4'));var fs=require('fs');var Redis=require(_0xce3e('0x5'));var db=require(_0xce3e('0x6'))['db'];var utils=require(_0xce3e('0x7'));var logger=require(_0xce3e('0x8'))(_0xce3e('0x9'));var config=require(_0xce3e('0xa'));var jayson=require(_0xce3e('0xb'));var client=jayson[_0xce3e('0xc')][_0xce3e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x9a7507,_0x4c4245,_0xf40c2a){return new BPromise(function(_0x337b4f,_0x550dae){return client[_0xce3e('0xe')](_0x9a7507,_0xf40c2a)[_0xce3e('0xf')](function(_0x476cb1){logger[_0xce3e('0x10')](_0xce3e('0x11'),_0x4c4245,_0xce3e('0x12'));logger[_0xce3e('0x13')](_0xce3e('0x14'),_0x4c4245,_0xce3e('0x12'),JSON[_0xce3e('0x15')](_0x476cb1));if(_0x476cb1[_0xce3e('0x16')]){if(_0x476cb1[_0xce3e('0x16')]['code']===0x1f4){logger[_0xce3e('0x16')]('ReportAgentPreview,\x20%s,\x20%s',_0x4c4245,_0x476cb1['error'][_0xce3e('0x17')]);return _0x550dae(_0x476cb1[_0xce3e('0x16')][_0xce3e('0x17')]);}logger[_0xce3e('0x16')](_0xce3e('0x11'),_0x4c4245,_0x476cb1[_0xce3e('0x16')]['message']);return _0x337b4f(_0x476cb1['error'][_0xce3e('0x17')]);}else{logger[_0xce3e('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x4c4245,'request\x20sent');_0x337b4f(_0x476cb1[_0xce3e('0x18')][_0xce3e('0x17')]);}})[_0xce3e('0x19')](function(_0x3ca934){logger[_0xce3e('0x16')](_0xce3e('0x11'),_0x4c4245,_0x3ca934);_0x550dae(_0x3ca934);});});}exports['CreateReportAgentPreview']=function(_0x243bb0){var _0x373447=this;return new Promise(function(_0x13721a,_0x17ea96){return db[_0xce3e('0x1a')][_0xce3e('0x1b')](_0x243bb0[_0xce3e('0x1c')],{'raw':_0x243bb0['options']?_0x243bb0[_0xce3e('0x1d')][_0xce3e('0x1e')]===undefined?!![]:![]:!![]})[_0xce3e('0xf')](function(_0x219acf){logger[_0xce3e('0x10')](_0xce3e('0x1f'),_0x243bb0);logger['debug'](_0xce3e('0x1f'),_0x243bb0,JSON[_0xce3e('0x15')](_0x219acf));_0x13721a(_0x219acf);})[_0xce3e('0x19')](function(_0x1d10a8){logger['error'](_0xce3e('0x1f'),_0x1d10a8[_0xce3e('0x17')],_0x243bb0);_0x17ea96(_0x373447['error'](0x1f4,_0x1d10a8[_0xce3e('0x17')]));});});}; \ No newline at end of file +var _0xb6a5=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xb6a5,0x1c7));var _0x5b6a=function(_0x767aa3,_0x3b82b1){_0x767aa3=_0x767aa3-0x0;var _0x39bf0f=_0xb6a5[_0x767aa3];return _0x39bf0f;};'use strict';var _=require('lodash');var util=require(_0x5b6a('0x0'));var moment=require(_0x5b6a('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b6a('0x2'));var fs=require('fs');var Redis=require(_0x5b6a('0x3'));var db=require(_0x5b6a('0x4'))['db'];var utils=require(_0x5b6a('0x5'));var logger=require(_0x5b6a('0x6'))(_0x5b6a('0x7'));var config=require(_0x5b6a('0x8'));var jayson=require(_0x5b6a('0x9'));var client=jayson[_0x5b6a('0xa')][_0x5b6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e9ff0,_0x57fa31,_0x354fd3){return new BPromise(function(_0x1b2155,_0x465f2b){return client[_0x5b6a('0xc')](_0x1e9ff0,_0x354fd3)[_0x5b6a('0xd')](function(_0x223b52){logger[_0x5b6a('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x57fa31,_0x5b6a('0xf'));logger[_0x5b6a('0x10')](_0x5b6a('0x11'),_0x57fa31,_0x5b6a('0xf'),JSON[_0x5b6a('0x12')](_0x223b52));if(_0x223b52['error']){if(_0x223b52[_0x5b6a('0x13')]['code']===0x1f4){logger[_0x5b6a('0x13')](_0x5b6a('0x14'),_0x57fa31,_0x223b52[_0x5b6a('0x13')][_0x5b6a('0x15')]);return _0x465f2b(_0x223b52[_0x5b6a('0x13')][_0x5b6a('0x15')]);}logger[_0x5b6a('0x13')](_0x5b6a('0x14'),_0x57fa31,_0x223b52[_0x5b6a('0x13')][_0x5b6a('0x15')]);return _0x1b2155(_0x223b52[_0x5b6a('0x13')]['message']);}else{logger[_0x5b6a('0xe')](_0x5b6a('0x14'),_0x57fa31,_0x5b6a('0xf'));_0x1b2155(_0x223b52['result'][_0x5b6a('0x15')]);}})[_0x5b6a('0x16')](function(_0xd07dda){logger['error'](_0x5b6a('0x14'),_0x57fa31,_0xd07dda);_0x465f2b(_0xd07dda);});});}exports[_0x5b6a('0x17')]=function(_0x2df547){var _0x20b857=this;return new Promise(function(_0x25f957,_0x2ae170){return db[_0x5b6a('0x18')][_0x5b6a('0x19')](_0x2df547[_0x5b6a('0x1a')],{'raw':_0x2df547['options']?_0x2df547[_0x5b6a('0x1b')][_0x5b6a('0x1c')]===undefined?!![]:![]:!![]})[_0x5b6a('0xd')](function(_0x4dca84){logger[_0x5b6a('0xe')]('CreateReportAgentPreview',_0x2df547);logger['debug'](_0x5b6a('0x17'),_0x2df547,JSON['stringify'](_0x4dca84));_0x25f957(_0x4dca84);})['catch'](function(_0x4832ac){logger[_0x5b6a('0x13')](_0x5b6a('0x17'),_0x4832ac[_0x5b6a('0x15')],_0x2df547);_0x2ae170(_0x20b857[_0x5b6a('0x13')](0x1f4,_0x4832ac[_0x5b6a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d357365..e5ac92f 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 _0xa5af=['agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/whatsapp/queues','whatsappQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','/outbound/channels','put','/agents/:id/capacity'];(function(_0x2e714d,_0xc07a1d){var _0x2d0a0d=function(_0x39ec2a){while(--_0x39ec2a){_0x2e714d['push'](_0x2e714d['shift']());}};_0x2d0a0d(++_0xc07a1d);}(_0xa5af,0x1bc));var _0xfa5a=function(_0x49bbe3,_0x9dca2f){_0x49bbe3=_0x49bbe3-0x0;var _0x2dc15f=_0xa5af[_0x49bbe3];return _0x2dc15f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require('express');var router=express[_0xfa5a('0x0')]();var auth=require(_0xfa5a('0x1'));var controller=require(_0xfa5a('0x2'));router['get']('/voice/channels',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x4')]);router['get'](_0xfa5a('0x5'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x6')]);router[_0xfa5a('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0xfa5a('0x7')](_0xfa5a('0x8'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x9')]);router[_0xfa5a('0x7')](_0xfa5a('0xa'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0xb')]);router[_0xfa5a('0x7')](_0xfa5a('0xc'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0xd')]);router['get'](_0xfa5a('0xe'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0xf')]);router[_0xfa5a('0x7')]('/openchannel/queues',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x10')]);router['get']('/sms/queues',auth[_0xfa5a('0x3')](),controller['smsQueues']);router['get'](_0xfa5a('0x11'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x12')]);router[_0xfa5a('0x7')]('/fax/queues',auth[_0xfa5a('0x3')](),controller['faxQueues']);router[_0xfa5a('0x7')](_0xfa5a('0x13'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x14')]);router[_0xfa5a('0x7')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0xfa5a('0x15')]);router[_0xfa5a('0x7')]('/voice/queues/channels/:uniqueid',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x16')]);router[_0xfa5a('0x7')](_0xfa5a('0x17'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x18')]);router[_0xfa5a('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x19')]);router[_0xfa5a('0x7')](_0xfa5a('0x1a'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xfa5a('0x7')](_0xfa5a('0x1b'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x1c')]);router[_0xfa5a('0x7')](_0xfa5a('0x1d'),auth[_0xfa5a('0x3')](),controller['outboundChannels']);router[_0xfa5a('0x7')]('/agents',auth[_0xfa5a('0x3')](),controller['agents']);router[_0xfa5a('0x1e')](_0xfa5a('0x1f'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x20')]);router[_0xfa5a('0x7')](_0xfa5a('0x21'),auth['isAuthenticated'](),controller[_0xfa5a('0x22')]);router['get'](_0xfa5a('0x23'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x24')]);router[_0xfa5a('0x7')](_0xfa5a('0x25'),auth['isAuthenticated'](),controller['campaigns']);router[_0xfa5a('0x7')]('/fax/accounts',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x26')]);router[_0xfa5a('0x7')](_0xfa5a('0x27'),auth[_0xfa5a('0x3')](),controller['chatQueuesWaitingInteractions']);router[_0xfa5a('0x7')]('/mail/queues/waitinginteractions',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x28')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xfa5a('0x29')]);router[_0xfa5a('0x7')]('/sms/queues/waitinginteractions',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2a')]);router['get'](_0xfa5a('0x2b'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2c')]);router[_0xfa5a('0x7')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xfa5a('0x2d')]);router[_0xfa5a('0x2e')]('/mail/queues/:id/notify',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x30')));router[_0xfa5a('0x7')](_0xfa5a('0x31'),auth[_0xfa5a('0x3')](),controller['showMailQueues']);router['post'](_0xfa5a('0x32'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x33')));router['get'](_0xfa5a('0x34'),auth['isAuthenticated'](),controller[_0xfa5a('0x35')]);router[_0xfa5a('0x2e')]('/fax/queues/:id/notify',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x36')));router[_0xfa5a('0x7')](_0xfa5a('0x37'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x38')]);router[_0xfa5a('0x2e')](_0xfa5a('0x39'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router['get']('/openchannel/queues/:id',auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x3a')]);router[_0xfa5a('0x2e')](_0xfa5a('0x3b'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x3c')));router['post'](_0xfa5a('0x3d'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x2f')](_0xfa5a('0x3e')));router[_0xfa5a('0x7')](_0xfa5a('0x3f'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x40')]);router[_0xfa5a('0x7')](_0xfa5a('0x41'),auth[_0xfa5a('0x3')](),controller[_0xfa5a('0x42')]);router[_0xfa5a('0x2e')](_0xfa5a('0x43'),auth['isAuthenticated'](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x3c0c=['/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat'];(function(_0x15a01c,_0x46f3bf){var _0x335bcb=function(_0x52c106){while(--_0x52c106){_0x15a01c['push'](_0x15a01c['shift']());}};_0x335bcb(++_0x46f3bf);}(_0x3c0c,0x1a6));var _0xc3c0=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3c0c[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0xc3c0('0x0'));var util=require(_0xc3c0('0x1'));var path=require(_0xc3c0('0x2'));var express=require(_0xc3c0('0x3'));var router=express[_0xc3c0('0x4')]();var auth=require(_0xc3c0('0x5'));var controller=require('./rpc.controller');router[_0xc3c0('0x6')](_0xc3c0('0x7'),auth[_0xc3c0('0x8')](),controller['voiceChannels']);router[_0xc3c0('0x6')](_0xc3c0('0x9'),auth[_0xc3c0('0x8')](),controller['voiceChannelMixMonitor']);router['get'](_0xc3c0('0xa'),auth['isAuthenticated'](),controller[_0xc3c0('0xb')]);router[_0xc3c0('0x6')](_0xc3c0('0xc'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0xd')]);router[_0xc3c0('0x6')](_0xc3c0('0xe'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0xf')]);router[_0xc3c0('0x6')]('/mail/queues',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x10')]);router[_0xc3c0('0x6')]('/mail/accounts',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x11')]);router[_0xc3c0('0x6')](_0xc3c0('0x12'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x13')]);router['get'](_0xc3c0('0x14'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x15')]);router[_0xc3c0('0x6')]('/whatsapp/queues',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x16')]);router[_0xc3c0('0x6')](_0xc3c0('0x17'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x18')]);router[_0xc3c0('0x6')](_0xc3c0('0x19'),auth[_0xc3c0('0x8')](),controller['voiceQueuesPreview']);router[_0xc3c0('0x6')]('/voice/queues/channels',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x1a')]);router[_0xc3c0('0x6')]('/voice/queues/channels/:uniqueid',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x1b')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x1c')]);router[_0xc3c0('0x6')](_0xc3c0('0x1d'),auth['isAuthenticated'](),controller[_0xc3c0('0x1e')]);router[_0xc3c0('0x6')]('/voice/queues/:id',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x1f')]);router[_0xc3c0('0x6')](_0xc3c0('0x20'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x21')]);router[_0xc3c0('0x6')](_0xc3c0('0x22'),auth['isAuthenticated'](),controller[_0xc3c0('0x23')]);router[_0xc3c0('0x6')](_0xc3c0('0x24'),auth['isAuthenticated'](),controller[_0xc3c0('0x25')]);router['put']('/agents/:id/capacity',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x26')]);router[_0xc3c0('0x6')](_0xc3c0('0x27'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x28')]);router[_0xc3c0('0x6')](_0xc3c0('0x29'),auth['isAuthenticated'](),controller[_0xc3c0('0x2a')]);router[_0xc3c0('0x6')]('/campaigns',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x2b')]);router[_0xc3c0('0x6')](_0xc3c0('0x2c'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x2d')]);router[_0xc3c0('0x6')](_0xc3c0('0x2e'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x2f')]);router['get'](_0xc3c0('0x30'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x31')]);router[_0xc3c0('0x6')](_0xc3c0('0x32'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x33')]);router[_0xc3c0('0x6')]('/sms/queues/waitinginteractions',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x34')]);router[_0xc3c0('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x35')]);router['get'](_0xc3c0('0x36'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x37')]);router[_0xc3c0('0x38')](_0xc3c0('0x39'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3a')](_0xc3c0('0x3b')));router[_0xc3c0('0x6')](_0xc3c0('0x3c'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3d')]);router[_0xc3c0('0x38')](_0xc3c0('0x3e'),auth['isAuthenticated'](),controller[_0xc3c0('0x3a')](_0xc3c0('0x3f')));router[_0xc3c0('0x6')](_0xc3c0('0x40'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x41')]);router['post']('/fax/queues/:id/notify',auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3a')]('fax'));router['get'](_0xc3c0('0x42'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x43')]);router[_0xc3c0('0x38')](_0xc3c0('0x44'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3a')]('openchannel'));router[_0xc3c0('0x6')](_0xc3c0('0x45'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x46')]);router['post'](_0xc3c0('0x47'),auth['isAuthenticated'](),controller[_0xc3c0('0x3a')](_0xc3c0('0x48')));router[_0xc3c0('0x38')](_0xc3c0('0x49'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x3a')](_0xc3c0('0x4a')));router['get'](_0xc3c0('0x4b'),auth[_0xc3c0('0x8')](),controller[_0xc3c0('0x4c')]);router[_0xc3c0('0x6')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0xc3c0('0x4d')]);router['post'](_0xc3c0('0x4e'),auth['isAuthenticated'](),controller[_0xc3c0('0x4f')]);module[_0xc3c0('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 8cd4c97..d94a998 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 _0x8c54=['VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','body','interaction','user','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','interface','format','SIP/%s','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','InteractionId','QueueId','TransferReport','create','Start','agentNotify','User','Agent\x20not\x20found','queue','MessageId','*,*,*,*','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','error','message','catch','status','sendStatus','name','send','isNil','rows','find','voiceChannels','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview'];(function(_0x480916,_0x490863){var _0x44f48c=function(_0xbfbec1){while(--_0xbfbec1){_0x480916['push'](_0x480916['shift']());}};_0x44f48c(++_0x490863);}(_0x8c54,0xb8));var _0x48c5=function(_0x292928,_0x14dfa6){_0x292928=_0x292928-0x0;var _0x30d9b2=_0x8c54[_0x292928];return _0x30d9b2;};'use strict';var BPromise=require(_0x48c5('0x0'));var moment=require(_0x48c5('0x1'));var _=require(_0x48c5('0x2'));var util=require(_0x48c5('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x48c5('0x4'))(_0x48c5('0x5'));var jayson=require(_0x48c5('0x6'));var amiClient=jayson[_0x48c5('0x7')][_0x48c5('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0x48c5('0x8')]({'port':0x232b});var routingClient=jayson[_0x48c5('0x7')][_0x48c5('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x724cbb,_0x4485a8,_0x20fc4b){return new BPromise(function(_0x3e5361,_0x45ac10){var _0x1795bf=_0x20fc4b?_0x20fc4b:amiClient;return _0x1795bf[_0x48c5('0x9')](_0x724cbb,_0x4485a8)['then'](function(_0xb0dd6c){if(_0xb0dd6c['error']){if(_0xb0dd6c['error']['code']===0x1f4){return _0x45ac10(_0xb0dd6c[_0x48c5('0xa')][_0x48c5('0xb')]);}return _0x3e5361(_0xb0dd6c[_0x48c5('0xa')][_0x48c5('0xb')]);}else{_0x3e5361(_0xb0dd6c['result']);}})[_0x48c5('0xc')](function(_0x736e57){_0x45ac10(_0x736e57);});});}function respondWithResult(_0x46174d,_0x4bf31b){_0x4bf31b=_0x4bf31b||0xc8;return function(_0x30a8fb){if(_0x30a8fb){return _0x46174d[_0x48c5('0xd')](_0x4bf31b)['json'](_0x30a8fb);}return _0x46174d[_0x48c5('0xe')](0x194);};}function handleError(_0x46d4ef,_0x7417a9){_0x7417a9=_0x7417a9||0x1f4;return function(_0xfd1145){logger[_0x48c5('0xa')](_0xfd1145['stack']);if(_0xfd1145[_0x48c5('0xf')]){delete _0xfd1145[_0x48c5('0xf')];}_0x46d4ef['status'](_0x7417a9)[_0x48c5('0x10')](_0xfd1145);};}function findById(_0x525b39){return function(_0x14d446){if(!_['isNil'](_0x525b39)&&!_[_0x48c5('0x11')](_0x14d446)&&!_[_0x48c5('0x11')](_0x14d446[_0x48c5('0x12')])){return _[_0x48c5('0x13')](_0x14d446[_0x48c5('0x12')],function(_0x4cee6a){return _0x4cee6a['id']==_0x525b39;});}return null;};}exports[_0x48c5('0x14')]=function(_0x1e3435,_0x75f95a){return respondWithRpcPromise('VoiceChannels',_0x1e3435['query'])[_0x48c5('0x15')](respondWithResult(_0x75f95a,null))[_0x48c5('0xc')](handleError(_0x75f95a,null));};exports[_0x48c5('0x16')]=function(_0xab85d4,_0x3bba41){return respondWithRpcPromise(_0x48c5('0x17'),_[_0x48c5('0x18')](_0xab85d4[_0x48c5('0x19')],_0xab85d4['params']))[_0x48c5('0x15')](respondWithResult(_0x3bba41,null))['catch'](handleError(_0x3bba41,null));};exports['voiceChannelStopMixMonitor']=function(_0x2774a6,_0x7a7d3a){return respondWithRpcPromise(_0x48c5('0x1a'),_[_0x48c5('0x18')](_0x2774a6[_0x48c5('0x19')],_0x2774a6[_0x48c5('0x1b')]))[_0x48c5('0x15')](respondWithResult(_0x7a7d3a,null))[_0x48c5('0xc')](handleError(_0x7a7d3a,null));};exports[_0x48c5('0x1c')]=function(_0x299052,_0x42b1a5){return respondWithRpcPromise(_0x48c5('0x1d'),_0x299052['query'])[_0x48c5('0x15')](respondWithResult(_0x42b1a5,null))[_0x48c5('0xc')](handleError(_0x42b1a5,null));};exports['showVoiceQueues']=function(_0x3f741a,_0x2a9d50){return respondWithRpcPromise(_0x48c5('0x1d'),_0x3f741a[_0x48c5('0x19')])[_0x48c5('0x15')](findById(_0x3f741a[_0x48c5('0x1b')]['id']))['then'](respondWithResult(_0x2a9d50,null))['catch'](handleError(_0x2a9d50,null));};exports[_0x48c5('0x1e')]=function(_0x367e67,_0x5b68d2){return respondWithRpcPromise(_0x48c5('0x1f'),_[_0x48c5('0x18')](_0x367e67[_0x48c5('0x19')],_0x367e67[_0x48c5('0x1b')]))['then'](respondWithResult(_0x5b68d2,null))['catch'](handleError(_0x5b68d2,null));};exports['voiceQueuesChannels']=function(_0x30e021,_0x347d56){return respondWithRpcPromise(_0x48c5('0x20'),_0x30e021[_0x48c5('0x19')])[_0x48c5('0x15')](respondWithResult(_0x347d56,null))['catch'](handleError(_0x347d56,null));};exports['voiceQueuesChannel']=function(_0xf60077,_0x3f12e2){return respondWithRpcPromise(_0x48c5('0x21'),_[_0x48c5('0x18')](_0xf60077[_0x48c5('0x19')],_0xf60077[_0x48c5('0x1b')]))[_0x48c5('0x15')](respondWithResult(_0x3f12e2,null))[_0x48c5('0xc')](handleError(_0x3f12e2,null));};exports[_0x48c5('0x22')]=function(_0x3e91ee,_0x534bb1){return respondWithRpcPromise(_0x48c5('0x23'),_[_0x48c5('0x18')](_0x3e91ee[_0x48c5('0x19')],_0x3e91ee['params']))[_0x48c5('0x15')](respondWithResult(_0x534bb1,null))[_0x48c5('0xc')](handleError(_0x534bb1,null));};exports['voiceQueuesChannelRedirect']=function(_0xb8c860,_0x468067){return respondWithRpcPromise(_0x48c5('0x24'),_[_0x48c5('0x18')](_0xb8c860[_0x48c5('0x19')],_0xb8c860[_0x48c5('0x1b')]))[_0x48c5('0x15')](respondWithResult(_0x468067,null))['catch'](handleError(_0x468067,null));};exports[_0x48c5('0x25')]=function(_0x496521,_0x5303ba){return respondWithRpcPromise('Outbound',_0x496521[_0x48c5('0x19')])[_0x48c5('0x15')](respondWithResult(_0x5303ba,null))['catch'](handleError(_0x5303ba,null));};exports[_0x48c5('0x26')]=function(_0x353ede,_0x563bb2){return respondWithRpcPromise(_0x48c5('0x27'),_0x353ede['query'])[_0x48c5('0x15')](respondWithResult(_0x563bb2,null))[_0x48c5('0xc')](handleError(_0x563bb2,null));};exports[_0x48c5('0x28')]=function(_0x7d8dd8,_0x770525){var _0x55420b;return respondWithRpcPromise('Agents',_0x7d8dd8[_0x48c5('0x19')])[_0x48c5('0x15')](function(_0x227e51){_0x55420b=_0x227e51;return respondWithRpcPromise('Agents',_0x7d8dd8[_0x48c5('0x19')],routingClient);})[_0x48c5('0x15')](function(_0x59ec92){return _['merge']({},_0x59ec92,_0x55420b);})[_0x48c5('0x15')](respondWithResult(_0x770525,null))[_0x48c5('0xc')](handleError(_0x770525,null));};exports['agentCapacity']=function(_0x1bb5c7,_0x528f4a){if(_0x1bb5c7[_0x48c5('0x29')]&&_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')]&&_0x1bb5c7[_0x48c5('0x2b')]&&_0x1bb5c7[_0x48c5('0x2b')][_0x48c5('0xf')]){for(var _0x59a277 in _0x1bb5c7['body'][_0x48c5('0x2a')]){if(_0x1bb5c7['body'][_0x48c5('0x2a')]['hasOwnProperty'](_0x59a277)){db[_0x48c5('0x2c')][_0x48c5('0x2d')]({'where':{'channel':_0x59a277,'membername':_0x1bb5c7[_0x48c5('0x2b')][_0x48c5('0xf')],'type':_0x48c5('0x2e'),'exitAt':null,'uniqueid':_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')][_0x59a277]&&_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')][_0x59a277][_0x48c5('0x2f')]?{'$notIn':_0x1bb5c7['body']['interaction'][_0x59a277]}:{'$ne':null}}})[_0x48c5('0x15')](function(_0x3373e7){var _0x23943f=moment()['format'](_0x48c5('0x30'));for(var _0x11b13c=0x0,_0x484a8f=_0x3373e7[_0x48c5('0x2f')];_0x11b13c<_0x484a8f;_0x11b13c+=0x1){_0x3373e7[_0x11b13c]['updateAttributes']({'exitAt':_0x23943f});}});for(var _0x3d7484=0x0;_0x3d7484<_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')][_0x59a277][_0x48c5('0x2f')];_0x3d7484+=0x1){db[_0x48c5('0x2c')]['findOrCreate']({'where':{'channel':_0x59a277,'membername':_0x1bb5c7[_0x48c5('0x2b')][_0x48c5('0xf')],'type':_0x48c5('0x2e'),'uniqueid':_0x1bb5c7[_0x48c5('0x29')]['interaction'][_0x59a277][_0x3d7484],'exitAt':null},'defaults':{'channel':_0x59a277,'membername':_0x1bb5c7[_0x48c5('0x2b')]['name'],'interface':_[_0x48c5('0x11')](_0x1bb5c7['user'][_0x48c5('0x31')])?util[_0x48c5('0x32')](_0x48c5('0x33'),_0x1bb5c7['user'][_0x48c5('0xf')]):_0x1bb5c7['user'][_0x48c5('0x31')],'type':'INTERACTION','enterAt':moment()[_0x48c5('0x32')](_0x48c5('0x30')),'role':_0x48c5('0x34'),'internal':_0x1bb5c7[_0x48c5('0x2b')]['internal'],'uniqueid':_0x1bb5c7[_0x48c5('0x29')][_0x48c5('0x2a')][_0x59a277][_0x3d7484]}});}}}}return respondWithRpcPromise(_0x48c5('0x35'),{'id':_0x1bb5c7[_0x48c5('0x1b')]['id'],'capacity':_0x1bb5c7['body'][_0x48c5('0x36')]},routingClient)[_0x48c5('0x15')](respondWithResult(_0x528f4a,null))['catch'](handleError(_0x528f4a,null));};exports[_0x48c5('0x37')]=function(_0x596d9c,_0x1a5a6c){return respondWithRpcPromise(_0x48c5('0x38'),_0x596d9c['query'])[_0x48c5('0x15')](respondWithResult(_0x1a5a6c,null))['catch'](handleError(_0x1a5a6c,null));};exports[_0x48c5('0x39')]=function(_0x41cce3,_0x4c046c){return respondWithRpcPromise('Trunks',_0x41cce3['query'])[_0x48c5('0x15')](respondWithResult(_0x4c046c,null))[_0x48c5('0xc')](handleError(_0x4c046c,null));};exports[_0x48c5('0x3a')]=function(_0x2ae062,_0x37b9ef){return respondWithRpcPromise('Campaigns',_0x2ae062[_0x48c5('0x19')])[_0x48c5('0x15')](respondWithResult(_0x37b9ef,null))[_0x48c5('0xc')](handleError(_0x37b9ef,null));};exports[_0x48c5('0x3b')]=function(_0x42d723,_0x99b723){return respondWithRpcPromise(_0x48c5('0x3c'),_0x42d723[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x99b723,null))[_0x48c5('0xc')](handleError(_0x99b723,null));};exports[_0x48c5('0x3d')]=function(_0x42f476,_0x5704a1){return respondWithRpcPromise(_0x48c5('0x3c'),_0x42f476['query'],routingClient)[_0x48c5('0x15')](findById(_0x42f476[_0x48c5('0x1b')]['id']))['then'](respondWithResult(_0x5704a1,null))[_0x48c5('0xc')](handleError(_0x5704a1,null));};exports[_0x48c5('0x3e')]=function(_0x15c82a,_0x35d400){return respondWithRpcPromise(_0x48c5('0x3f'),_0x15c82a[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x35d400,null))[_0x48c5('0xc')](handleError(_0x35d400,null));};exports[_0x48c5('0x40')]=function(_0x1f27e8,_0xe6bf8b){return respondWithRpcPromise('MailQueues',_0x1f27e8[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](findById(_0x1f27e8[_0x48c5('0x1b')]['id']))['then'](respondWithResult(_0xe6bf8b,null))[_0x48c5('0xc')](handleError(_0xe6bf8b,null));};exports[_0x48c5('0x41')]=function(_0x13faff,_0x4c54ef){return respondWithRpcPromise(_0x48c5('0x42'),_0x13faff[_0x48c5('0x19')],mailClient)[_0x48c5('0x15')](respondWithResult(_0x4c54ef,null))[_0x48c5('0xc')](handleError(_0x4c54ef,null));};exports[_0x48c5('0x43')]=function(_0xd7e594,_0x11e607){return respondWithRpcPromise(_0x48c5('0x44'),_0xd7e594[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x11e607,null))[_0x48c5('0xc')](handleError(_0x11e607,null));};exports[_0x48c5('0x45')]=function(_0x5706c5,_0x5cd1bc){return respondWithRpcPromise(_0x48c5('0x44'),_0x5706c5['query'],routingClient)['then'](findById(_0x5706c5[_0x48c5('0x1b')]['id']))['then'](respondWithResult(_0x5cd1bc,null))[_0x48c5('0xc')](handleError(_0x5cd1bc,null));};exports[_0x48c5('0x46')]=function(_0x645a5b,_0x5d5966){return respondWithRpcPromise('SmsQueues',_0x645a5b[_0x48c5('0x19')],routingClient)['then'](respondWithResult(_0x5d5966,null))['catch'](handleError(_0x5d5966,null));};exports[_0x48c5('0x47')]=function(_0x5ee934,_0x5220ea){return respondWithRpcPromise('SmsQueues',_0x5ee934[_0x48c5('0x19')],routingClient)['then'](findById(_0x5ee934[_0x48c5('0x1b')]['id']))[_0x48c5('0x15')](respondWithResult(_0x5220ea,null))[_0x48c5('0xc')](handleError(_0x5220ea,null));};exports[_0x48c5('0x48')]=function(_0x3bde67,_0x145866){return respondWithRpcPromise(_0x48c5('0x49'),_0x3bde67[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x145866,null))[_0x48c5('0xc')](handleError(_0x145866,null));};exports['showWhatsappQueues']=function(_0x4ab599,_0x44bb43){return respondWithRpcPromise(_0x48c5('0x49'),_0x4ab599[_0x48c5('0x19')],routingClient)['then'](findById(_0x4ab599[_0x48c5('0x1b')]['id']))[_0x48c5('0x15')](respondWithResult(_0x44bb43,null))[_0x48c5('0xc')](handleError(_0x44bb43,null));};exports[_0x48c5('0x4a')]=function(_0x199cd6,_0x5e98c9){return respondWithRpcPromise(_0x48c5('0x4b'),_0x199cd6[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x5e98c9,null))['catch'](handleError(_0x5e98c9,null));};exports[_0x48c5('0x4c')]=function(_0x20af32,_0x53f810){return respondWithRpcPromise('FaxQueues',_0x20af32['query'],routingClient)[_0x48c5('0x15')](findById(_0x20af32[_0x48c5('0x1b')]['id']))[_0x48c5('0x15')](respondWithResult(_0x53f810,null))[_0x48c5('0xc')](handleError(_0x53f810,null));};exports[_0x48c5('0x4d')]=function(_0x5db078,_0x1fe421){return respondWithRpcPromise('FaxAccounts',_0x5db078[_0x48c5('0x19')])[_0x48c5('0x15')](respondWithResult(_0x1fe421,null))[_0x48c5('0xc')](handleError(_0x1fe421,null));};exports['chatQueuesWaitingInteractions']=function(_0x4f8b6f,_0x8f26c9){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4f8b6f['query'],routingClient)['then'](respondWithResult(_0x8f26c9,null))[_0x48c5('0xc')](handleError(_0x8f26c9,null));};exports[_0x48c5('0x4e')]=function(_0x350a38,_0x3200eb){return respondWithRpcPromise(_0x48c5('0x4f'),_0x350a38[_0x48c5('0x19')],routingClient)['then'](respondWithResult(_0x3200eb,null))[_0x48c5('0xc')](handleError(_0x3200eb,null));};exports[_0x48c5('0x50')]=function(_0x24d237,_0x42ad19){return respondWithRpcPromise(_0x48c5('0x51'),_0x24d237['query'],routingClient)[_0x48c5('0x15')](respondWithResult(_0x42ad19,null))['catch'](handleError(_0x42ad19,null));};exports[_0x48c5('0x52')]=function(_0x579137,_0x5723a3){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x579137['query'],routingClient)[_0x48c5('0x15')](respondWithResult(_0x5723a3,null))[_0x48c5('0xc')](handleError(_0x5723a3,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x39bccd,_0x48650a){return respondWithRpcPromise(_0x48c5('0x53'),_0x39bccd[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x48650a,null))[_0x48c5('0xc')](handleError(_0x48650a,null));};exports[_0x48c5('0x54')]=function(_0x1a1b4b,_0x32e0d8){return respondWithRpcPromise(_0x48c5('0x55'),_0x1a1b4b[_0x48c5('0x19')],routingClient)[_0x48c5('0x15')](respondWithResult(_0x32e0d8,null))[_0x48c5('0xc')](handleError(_0x32e0d8,null));};exports[_0x48c5('0x56')]=function(_0x2afe1a){return function(_0x10d335,_0xbf04d4){var _0x2ca3d5,_0x15323a;var _0x28c10c=_[_0x48c5('0x57')](_0x2afe1a);var _0x4970cb=_0x2afe1a===_0x48c5('0x58')?_0x48c5('0x59'):_0x48c5('0x5a');return db[_0x28c10c+'Queue'][_0x48c5('0x5b')]({'raw':!![],'where':{'id':_0x10d335[_0x48c5('0x1b')]['id']}})['then'](function(_0x333d65){if(_[_0x48c5('0x11')](_0x333d65)){throw new Error(_0x28c10c+_0x48c5('0x5c'));}_0x2ca3d5=_0x333d65;return db[_0x28c10c+'Message'][_0x48c5('0x5b')]({'where':{'id':_0x10d335[_0x48c5('0x29')][_0x48c5('0x5d')]},'include':[{'model':db[_0x28c10c+'Interaction'],'as':_0x48c5('0x5e')},{'model':db[_0x28c10c+_0x4970cb],'as':_0x48c5('0x5a')}]});})[_0x48c5('0x15')](function(_0x3714f6){if(_[_0x48c5('0x11')](_0x3714f6)){throw new Error(_0x28c10c+_0x48c5('0x5f'));}_0x15323a=_0x3714f6;return _0x3714f6[_0x48c5('0x60')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x110023={'uniqueid':_0x2afe1a+'.'+_0x15323a['id']+'.'+_0x15323a[_0x48c5('0x5e')]['id'],'FromUserId':_0x10d335[_0x48c5('0x2b')]['id'],'type':'queue'};_0x110023[_0x28c10c+'MessageId']=_0x15323a['id'];_0x110023[_0x28c10c+_0x48c5('0x61')]=_0x15323a[_0x48c5('0x5e')]['id'];_0x110023['From'+_0x28c10c+_0x4970cb+'Id']=_0x15323a[_0x48c5('0x5a')]['id'];_0x110023['To'+_0x28c10c+_0x48c5('0x62')]=_0x2ca3d5['id'];return db[_0x28c10c+_0x48c5('0x63')][_0x48c5('0x64')](_0x110023);})[_0x48c5('0x15')](function(){return respondWithRpcPromise(_0x48c5('0x65'),{'channel':_0x2afe1a,'interaction':_0x15323a['Interaction'],'message':_0x15323a,'account':_0x15323a[_0x48c5('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2ca3d5['name']+','+(_0x15323a[_0x48c5('0x5a')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0xbf04d4,null))[_0x48c5('0xc')](handleError(_0xbf04d4,null));};};exports[_0x48c5('0x66')]=function(_0x59b542,_0x19c7b7){var _0x3bfeea,_0x3c415a;if(_[_0x48c5('0x11')](_0x59b542[_0x48c5('0x29')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1c9ddd=_0x59b542['body']['channel'];var _0x1600b2=_['capitalize'](_0x1c9ddd);var _0x52e708=_0x1c9ddd===_0x48c5('0x58')?_0x48c5('0x59'):_0x48c5('0x5a');return db[_0x48c5('0x67')][_0x48c5('0x5b')]({'raw':!![],'where':{'id':_0x59b542['params']['id'],'role':_0x48c5('0x34')}})[_0x48c5('0x15')](function(_0x1a8038){if(_[_0x48c5('0x11')](_0x1a8038)){throw new Error(_0x48c5('0x68'));}_0x3bfeea=_0x1a8038;return db[_0x1600b2+'Message'][_0x48c5('0x5b')]({'where':{'id':_0x59b542[_0x48c5('0x29')][_0x48c5('0x5d')]},'include':[{'model':db[_0x1600b2+'Interaction'],'as':_0x48c5('0x5e')},{'model':db[_0x1600b2+_0x52e708],'as':_0x48c5('0x5a')}]});})[_0x48c5('0x15')](function(_0xbcd818){if(_[_0x48c5('0x11')](_0xbcd818)){throw new Error(_0x1600b2+_0x48c5('0x5f'));}_0x3c415a=_0xbcd818;return _0xbcd818[_0x48c5('0x60')]({'read':0x0,'readAt':null,'UserId':null});})[_0x48c5('0x15')](function(){var _0x1c94f1={'uniqueid':_0x1c9ddd+'.'+_0x3c415a['id']+'.'+_0x3c415a[_0x48c5('0x5e')]['id'],'FromUserId':_0x59b542['user']['id'],'type':_0x48c5('0x69'),'ToUserId':_0x3bfeea['id']};_0x1c94f1[_0x1600b2+_0x48c5('0x6a')]=_0x3c415a['id'];_0x1c94f1[_0x1600b2+'InteractionId']=_0x3c415a[_0x48c5('0x5e')]['id'];_0x1c94f1['From'+_0x1600b2+_0x52e708+'Id']=_0x3c415a[_0x48c5('0x5a')]['id'];return db[_0x1600b2+'TransferReport'][_0x48c5('0x64')](_0x1c94f1);})['then'](function(){return respondWithRpcPromise(_0x48c5('0x65'),{'channel':_0x1c9ddd,'interaction':_0x3c415a[_0x48c5('0x5e')],'message':_0x3c415a,'account':_0x3c415a['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x48c5('0x34'),'appdata':_0x3bfeea[_0x48c5('0xf')]+','+(_0x3c415a[_0x48c5('0x5a')]['agentTransferTimeout']||0x12c),'interval':_0x48c5('0x6b')}]},routingClient);})[_0x48c5('0x15')](respondWithResult(_0x19c7b7,null))['catch'](handleError(_0x19c7b7,null));}; \ No newline at end of file +var _0x7552=['MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','TransferReport','agentTransferTimeout','bluebird','moment','lodash','api','client','http','request','then','error','code','message','result','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','catch','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts'];(function(_0x39ef2c,_0x3feca6){var _0x42684e=function(_0x48ad17){while(--_0x48ad17){_0x39ef2c['push'](_0x39ef2c['shift']());}};_0x42684e(++_0x3feca6);}(_0x7552,0xab));var _0x2755=function(_0x255338,_0x227b66){_0x255338=_0x255338-0x0;var _0xc15ffa=_0x7552[_0x255338];return _0xc15ffa;};'use strict';var BPromise=require(_0x2755('0x0'));var moment=require(_0x2755('0x1'));var _=require(_0x2755('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x2755('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x2755('0x4')][_0x2755('0x5')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x2755('0x4')][_0x2755('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x5480b5,_0x3af4b0,_0x40077c){return new BPromise(function(_0x74a95a,_0x519c53){var _0x445410=_0x40077c?_0x40077c:amiClient;return _0x445410[_0x2755('0x6')](_0x5480b5,_0x3af4b0)[_0x2755('0x7')](function(_0x1c5d4d){if(_0x1c5d4d[_0x2755('0x8')]){if(_0x1c5d4d[_0x2755('0x8')][_0x2755('0x9')]===0x1f4){return _0x519c53(_0x1c5d4d[_0x2755('0x8')][_0x2755('0xa')]);}return _0x74a95a(_0x1c5d4d[_0x2755('0x8')][_0x2755('0xa')]);}else{_0x74a95a(_0x1c5d4d[_0x2755('0xb')]);}})['catch'](function(_0x3dc45f){_0x519c53(_0x3dc45f);});});}function respondWithResult(_0x3f82f0,_0x20445d){_0x20445d=_0x20445d||0xc8;return function(_0x3684d9){if(_0x3684d9){return _0x3f82f0[_0x2755('0xc')](_0x20445d)[_0x2755('0xd')](_0x3684d9);}return _0x3f82f0[_0x2755('0xe')](0x194);};}function handleError(_0x25ad42,_0x5f2b22){_0x5f2b22=_0x5f2b22||0x1f4;return function(_0x129eb1){logger['error'](_0x129eb1[_0x2755('0xf')]);if(_0x129eb1[_0x2755('0x10')]){delete _0x129eb1['name'];}_0x25ad42[_0x2755('0xc')](_0x5f2b22)[_0x2755('0x11')](_0x129eb1);};}function findById(_0x46b59b){return function(_0x296411){if(!_[_0x2755('0x12')](_0x46b59b)&&!_[_0x2755('0x12')](_0x296411)&&!_['isNil'](_0x296411[_0x2755('0x13')])){return _[_0x2755('0x14')](_0x296411[_0x2755('0x13')],function(_0x311c4e){return _0x311c4e['id']==_0x46b59b;});}return null;};}exports[_0x2755('0x15')]=function(_0x43415d,_0x191377){return respondWithRpcPromise(_0x2755('0x16'),_0x43415d[_0x2755('0x17')])['then'](respondWithResult(_0x191377,null))['catch'](handleError(_0x191377,null));};exports[_0x2755('0x18')]=function(_0x51f4cc,_0x3368cd){return respondWithRpcPromise(_0x2755('0x19'),_[_0x2755('0x1a')](_0x51f4cc[_0x2755('0x17')],_0x51f4cc[_0x2755('0x1b')]))[_0x2755('0x7')](respondWithResult(_0x3368cd,null))['catch'](handleError(_0x3368cd,null));};exports['voiceChannelStopMixMonitor']=function(_0x5ec1a1,_0x1e4fc8){return respondWithRpcPromise(_0x2755('0x1c'),_[_0x2755('0x1a')](_0x5ec1a1[_0x2755('0x17')],_0x5ec1a1[_0x2755('0x1b')]))[_0x2755('0x7')](respondWithResult(_0x1e4fc8,null))[_0x2755('0x1d')](handleError(_0x1e4fc8,null));};exports[_0x2755('0x1e')]=function(_0x484392,_0x2f659f){return respondWithRpcPromise(_0x2755('0x1f'),_0x484392['query'])[_0x2755('0x7')](respondWithResult(_0x2f659f,null))['catch'](handleError(_0x2f659f,null));};exports[_0x2755('0x20')]=function(_0x493376,_0x15e2e0){return respondWithRpcPromise(_0x2755('0x1f'),_0x493376[_0x2755('0x17')])[_0x2755('0x7')](findById(_0x493376[_0x2755('0x1b')]['id']))[_0x2755('0x7')](respondWithResult(_0x15e2e0,null))[_0x2755('0x1d')](handleError(_0x15e2e0,null));};exports[_0x2755('0x21')]=function(_0x2269b2,_0x4a7b60){return respondWithRpcPromise(_0x2755('0x22'),_['merge'](_0x2269b2[_0x2755('0x17')],_0x2269b2[_0x2755('0x1b')]))[_0x2755('0x7')](respondWithResult(_0x4a7b60,null))[_0x2755('0x1d')](handleError(_0x4a7b60,null));};exports[_0x2755('0x23')]=function(_0x50471d,_0x69df65){return respondWithRpcPromise(_0x2755('0x24'),_0x50471d[_0x2755('0x17')])['then'](respondWithResult(_0x69df65,null))[_0x2755('0x1d')](handleError(_0x69df65,null));};exports[_0x2755('0x25')]=function(_0x48f0e7,_0x501801){return respondWithRpcPromise(_0x2755('0x26'),_[_0x2755('0x1a')](_0x48f0e7[_0x2755('0x17')],_0x48f0e7['params']))[_0x2755('0x7')](respondWithResult(_0x501801,null))['catch'](handleError(_0x501801,null));};exports[_0x2755('0x27')]=function(_0x549309,_0xdac2f6){return respondWithRpcPromise(_0x2755('0x28'),_['merge'](_0x549309['query'],_0x549309['params']))[_0x2755('0x7')](respondWithResult(_0xdac2f6,null))[_0x2755('0x1d')](handleError(_0xdac2f6,null));};exports[_0x2755('0x29')]=function(_0xa43e3e,_0x5e5d8f){return respondWithRpcPromise(_0x2755('0x2a'),_[_0x2755('0x1a')](_0xa43e3e['query'],_0xa43e3e[_0x2755('0x1b')]))[_0x2755('0x7')](respondWithResult(_0x5e5d8f,null))[_0x2755('0x1d')](handleError(_0x5e5d8f,null));};exports['outbound']=function(_0x322c6d,_0x521053){return respondWithRpcPromise('Outbound',_0x322c6d[_0x2755('0x17')])['then'](respondWithResult(_0x521053,null))[_0x2755('0x1d')](handleError(_0x521053,null));};exports['outboundChannels']=function(_0x2a13ce,_0x64278d){return respondWithRpcPromise(_0x2755('0x2b'),_0x2a13ce[_0x2755('0x17')])['then'](respondWithResult(_0x64278d,null))[_0x2755('0x1d')](handleError(_0x64278d,null));};exports[_0x2755('0x2c')]=function(_0x477e45,_0x106599){var _0x3ecb66;return respondWithRpcPromise('Agents',_0x477e45[_0x2755('0x17')])[_0x2755('0x7')](function(_0x19a532){_0x3ecb66=_0x19a532;return respondWithRpcPromise(_0x2755('0x2d'),_0x477e45[_0x2755('0x17')],routingClient);})[_0x2755('0x7')](function(_0x398dc6){return _[_0x2755('0x1a')]({},_0x398dc6,_0x3ecb66);})[_0x2755('0x7')](respondWithResult(_0x106599,null))[_0x2755('0x1d')](handleError(_0x106599,null));};exports[_0x2755('0x2e')]=function(_0x26b877,_0x44771c){if(_0x26b877[_0x2755('0x2f')]&&_0x26b877[_0x2755('0x2f')]['interaction']&&_0x26b877[_0x2755('0x30')]&&_0x26b877[_0x2755('0x30')][_0x2755('0x10')]){for(var _0x22b42f in _0x26b877['body'][_0x2755('0x31')]){if(_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x2755('0x32')](_0x22b42f)){db[_0x2755('0x33')][_0x2755('0x34')]({'where':{'channel':_0x22b42f,'membername':_0x26b877[_0x2755('0x30')][_0x2755('0x10')],'type':_0x2755('0x35'),'exitAt':null,'uniqueid':_0x26b877['body'][_0x2755('0x31')][_0x22b42f]&&_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x22b42f][_0x2755('0x36')]?{'$notIn':_0x26b877[_0x2755('0x2f')]['interaction'][_0x22b42f]}:{'$ne':null}}})[_0x2755('0x7')](function(_0x47f16a){var _0x1f5bca=moment()[_0x2755('0x37')](_0x2755('0x38'));for(var _0xdadf8b=0x0,_0x5d38cb=_0x47f16a[_0x2755('0x36')];_0xdadf8b<_0x5d38cb;_0xdadf8b+=0x1){_0x47f16a[_0xdadf8b][_0x2755('0x39')]({'exitAt':_0x1f5bca});}});for(var _0x28ea16=0x0;_0x28ea16<_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x22b42f][_0x2755('0x36')];_0x28ea16+=0x1){db['MemberReport'][_0x2755('0x3a')]({'where':{'channel':_0x22b42f,'membername':_0x26b877[_0x2755('0x30')][_0x2755('0x10')],'type':_0x2755('0x35'),'uniqueid':_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x22b42f][_0x28ea16],'exitAt':null},'defaults':{'channel':_0x22b42f,'membername':_0x26b877[_0x2755('0x30')][_0x2755('0x10')],'interface':_[_0x2755('0x12')](_0x26b877[_0x2755('0x30')][_0x2755('0x3b')])?util[_0x2755('0x37')](_0x2755('0x3c'),_0x26b877[_0x2755('0x30')][_0x2755('0x10')]):_0x26b877[_0x2755('0x30')]['interface'],'type':'INTERACTION','enterAt':moment()[_0x2755('0x37')](_0x2755('0x38')),'role':_0x2755('0x3d'),'internal':_0x26b877['user'][_0x2755('0x3e')],'uniqueid':_0x26b877[_0x2755('0x2f')][_0x2755('0x31')][_0x22b42f][_0x28ea16]}});}}}}return respondWithRpcPromise(_0x2755('0x3f'),{'id':_0x26b877[_0x2755('0x1b')]['id'],'capacity':_0x26b877[_0x2755('0x2f')][_0x2755('0x40')]},routingClient)[_0x2755('0x7')](respondWithResult(_0x44771c,null))[_0x2755('0x1d')](handleError(_0x44771c,null));};exports[_0x2755('0x41')]=function(_0x305675,_0x4dcfff){return respondWithRpcPromise(_0x2755('0x42'),_0x305675[_0x2755('0x17')])[_0x2755('0x7')](respondWithResult(_0x4dcfff,null))['catch'](handleError(_0x4dcfff,null));};exports['trunks']=function(_0x20c780,_0x5c1908){return respondWithRpcPromise(_0x2755('0x43'),_0x20c780['query'])[_0x2755('0x7')](respondWithResult(_0x5c1908,null))[_0x2755('0x1d')](handleError(_0x5c1908,null));};exports[_0x2755('0x44')]=function(_0x6a2f61,_0x1067f3){return respondWithRpcPromise(_0x2755('0x45'),_0x6a2f61[_0x2755('0x17')])[_0x2755('0x7')](respondWithResult(_0x1067f3,null))[_0x2755('0x1d')](handleError(_0x1067f3,null));};exports['chatQueues']=function(_0x24d9df,_0x283fd5){return respondWithRpcPromise(_0x2755('0x46'),_0x24d9df['query'],routingClient)[_0x2755('0x7')](respondWithResult(_0x283fd5,null))[_0x2755('0x1d')](handleError(_0x283fd5,null));};exports[_0x2755('0x47')]=function(_0x1d22f3,_0x3910c8){return respondWithRpcPromise(_0x2755('0x46'),_0x1d22f3[_0x2755('0x17')],routingClient)['then'](findById(_0x1d22f3[_0x2755('0x1b')]['id']))[_0x2755('0x7')](respondWithResult(_0x3910c8,null))[_0x2755('0x1d')](handleError(_0x3910c8,null));};exports[_0x2755('0x48')]=function(_0x439df0,_0x5880ee){return respondWithRpcPromise(_0x2755('0x49'),_0x439df0[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x5880ee,null))[_0x2755('0x1d')](handleError(_0x5880ee,null));};exports['showMailQueues']=function(_0x1ba62b,_0x40b607){return respondWithRpcPromise('MailQueues',_0x1ba62b[_0x2755('0x17')],routingClient)[_0x2755('0x7')](findById(_0x1ba62b['params']['id']))[_0x2755('0x7')](respondWithResult(_0x40b607,null))['catch'](handleError(_0x40b607,null));};exports[_0x2755('0x4a')]=function(_0x563148,_0x3a01b0){return respondWithRpcPromise(_0x2755('0x4b'),_0x563148[_0x2755('0x17')],mailClient)[_0x2755('0x7')](respondWithResult(_0x3a01b0,null))[_0x2755('0x1d')](handleError(_0x3a01b0,null));};exports[_0x2755('0x4c')]=function(_0x59cae5,_0x2cc3d1){return respondWithRpcPromise(_0x2755('0x4d'),_0x59cae5[_0x2755('0x17')],routingClient)[_0x2755('0x7')](respondWithResult(_0x2cc3d1,null))[_0x2755('0x1d')](handleError(_0x2cc3d1,null));};exports['showOpenchannelQueues']=function(_0x16dd01,_0x172247){return respondWithRpcPromise(_0x2755('0x4d'),_0x16dd01['query'],routingClient)[_0x2755('0x7')](findById(_0x16dd01[_0x2755('0x1b')]['id']))[_0x2755('0x7')](respondWithResult(_0x172247,null))[_0x2755('0x1d')](handleError(_0x172247,null));};exports[_0x2755('0x4e')]=function(_0x563d15,_0x1c3af1){return respondWithRpcPromise(_0x2755('0x4f'),_0x563d15[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x1c3af1,null))[_0x2755('0x1d')](handleError(_0x1c3af1,null));};exports[_0x2755('0x50')]=function(_0x2fdcff,_0x2e560e){return respondWithRpcPromise(_0x2755('0x4f'),_0x2fdcff[_0x2755('0x17')],routingClient)['then'](findById(_0x2fdcff['params']['id']))[_0x2755('0x7')](respondWithResult(_0x2e560e,null))['catch'](handleError(_0x2e560e,null));};exports[_0x2755('0x51')]=function(_0xddd831,_0x149c73){return respondWithRpcPromise(_0x2755('0x52'),_0xddd831[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x149c73,null))[_0x2755('0x1d')](handleError(_0x149c73,null));};exports[_0x2755('0x53')]=function(_0x524420,_0x405d1f){return respondWithRpcPromise(_0x2755('0x52'),_0x524420[_0x2755('0x17')],routingClient)[_0x2755('0x7')](findById(_0x524420['params']['id']))[_0x2755('0x7')](respondWithResult(_0x405d1f,null))[_0x2755('0x1d')](handleError(_0x405d1f,null));};exports[_0x2755('0x54')]=function(_0x37a435,_0x1ddca9){return respondWithRpcPromise('FaxQueues',_0x37a435[_0x2755('0x17')],routingClient)[_0x2755('0x7')](respondWithResult(_0x1ddca9,null))[_0x2755('0x1d')](handleError(_0x1ddca9,null));};exports[_0x2755('0x55')]=function(_0xad7d0d,_0x45384e){return respondWithRpcPromise(_0x2755('0x56'),_0xad7d0d[_0x2755('0x17')],routingClient)[_0x2755('0x7')](findById(_0xad7d0d[_0x2755('0x1b')]['id']))['then'](respondWithResult(_0x45384e,null))[_0x2755('0x1d')](handleError(_0x45384e,null));};exports[_0x2755('0x57')]=function(_0x2cb6a1,_0x489710){return respondWithRpcPromise(_0x2755('0x58'),_0x2cb6a1[_0x2755('0x17')])[_0x2755('0x7')](respondWithResult(_0x489710,null))['catch'](handleError(_0x489710,null));};exports[_0x2755('0x59')]=function(_0x2e7251,_0x2ce664){return respondWithRpcPromise(_0x2755('0x5a'),_0x2e7251[_0x2755('0x17')],routingClient)[_0x2755('0x7')](respondWithResult(_0x2ce664,null))['catch'](handleError(_0x2ce664,null));};exports[_0x2755('0x5b')]=function(_0x3d9157,_0xe07a88){return respondWithRpcPromise(_0x2755('0x5c'),_0x3d9157[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0xe07a88,null))['catch'](handleError(_0xe07a88,null));};exports[_0x2755('0x5d')]=function(_0x886602,_0x384dce){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x886602['query'],routingClient)[_0x2755('0x7')](respondWithResult(_0x384dce,null))['catch'](handleError(_0x384dce,null));};exports[_0x2755('0x5e')]=function(_0x172bdd,_0x182edb){return respondWithRpcPromise(_0x2755('0x5f'),_0x172bdd[_0x2755('0x17')],routingClient)[_0x2755('0x7')](respondWithResult(_0x182edb,null))[_0x2755('0x1d')](handleError(_0x182edb,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3ead74,_0x5974d3){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3ead74[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x5974d3,null))[_0x2755('0x1d')](handleError(_0x5974d3,null));};exports[_0x2755('0x60')]=function(_0x1e90bd,_0x188003){return respondWithRpcPromise(_0x2755('0x61'),_0x1e90bd[_0x2755('0x17')],routingClient)['then'](respondWithResult(_0x188003,null))['catch'](handleError(_0x188003,null));};exports[_0x2755('0x62')]=function(_0x4df508){return function(_0x3d952c,_0x4164ba){var _0xe3771e,_0x12bc2d;var _0x4c4682=_[_0x2755('0x63')](_0x4df508);var _0x434e13=_0x4df508==='chat'?'Website':'Account';return db[_0x4c4682+_0x2755('0x64')][_0x2755('0x65')]({'raw':!![],'where':{'id':_0x3d952c['params']['id']}})['then'](function(_0x425a31){if(_[_0x2755('0x12')](_0x425a31)){throw new Error(_0x4c4682+_0x2755('0x66'));}_0xe3771e=_0x425a31;return db[_0x4c4682+_0x2755('0x67')][_0x2755('0x65')]({'where':{'id':_0x3d952c['body'][_0x2755('0x68')]},'include':[{'model':db[_0x4c4682+_0x2755('0x69')],'as':'Interaction'},{'model':db[_0x4c4682+_0x434e13],'as':_0x2755('0x6a')}]});})['then'](function(_0x1a9de3){if(_[_0x2755('0x12')](_0x1a9de3)){throw new Error(_0x4c4682+_0x2755('0x6b'));}_0x12bc2d=_0x1a9de3;return _0x1a9de3[_0x2755('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2755('0x7')](function(){var _0xba6432={'uniqueid':_0x4df508+'.'+_0x12bc2d['id']+'.'+_0x12bc2d[_0x2755('0x69')]['id'],'FromUserId':_0x3d952c[_0x2755('0x30')]['id'],'type':_0x2755('0x6d')};_0xba6432[_0x4c4682+_0x2755('0x6e')]=_0x12bc2d['id'];_0xba6432[_0x4c4682+_0x2755('0x6f')]=_0x12bc2d[_0x2755('0x69')]['id'];_0xba6432[_0x2755('0x70')+_0x4c4682+_0x434e13+'Id']=_0x12bc2d[_0x2755('0x6a')]['id'];_0xba6432['To'+_0x4c4682+_0x2755('0x71')]=_0xe3771e['id'];return db[_0x4c4682+'TransferReport'][_0x2755('0x72')](_0xba6432);})[_0x2755('0x7')](function(){return respondWithRpcPromise(_0x2755('0x73'),{'channel':_0x4df508,'interaction':_0x12bc2d[_0x2755('0x69')],'message':_0x12bc2d,'account':_0x12bc2d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x2755('0x6d'),'appdata':_0xe3771e[_0x2755('0x10')]+','+(_0x12bc2d[_0x2755('0x6a')]['queueTransferTimeout']||0x12c),'interval':_0x2755('0x74')}]},routingClient);})['then'](respondWithResult(_0x4164ba,null))['catch'](handleError(_0x4164ba,null));};};exports[_0x2755('0x75')]=function(_0x33854f,_0x23a7f0){var _0x405ccd,_0x4e82e6;if(_['isNil'](_0x33854f[_0x2755('0x2f')][_0x2755('0x76')])){throw new Error(_0x2755('0x77'));}var _0x560248=_0x33854f[_0x2755('0x2f')]['channel'];var _0xd2ec57=_[_0x2755('0x63')](_0x560248);var _0x35fb1b=_0x560248==='chat'?_0x2755('0x78'):'Account';return db['User'][_0x2755('0x65')]({'raw':!![],'where':{'id':_0x33854f[_0x2755('0x1b')]['id'],'role':_0x2755('0x3d')}})[_0x2755('0x7')](function(_0x4e3679){if(_['isNil'](_0x4e3679)){throw new Error('Agent\x20not\x20found');}_0x405ccd=_0x4e3679;return db[_0xd2ec57+_0x2755('0x67')][_0x2755('0x65')]({'where':{'id':_0x33854f['body']['messageId']},'include':[{'model':db[_0xd2ec57+_0x2755('0x69')],'as':_0x2755('0x69')},{'model':db[_0xd2ec57+_0x35fb1b],'as':_0x2755('0x6a')}]});})[_0x2755('0x7')](function(_0x561ff4){if(_[_0x2755('0x12')](_0x561ff4)){throw new Error(_0xd2ec57+'\x20Message\x20not\x20found');}_0x4e82e6=_0x561ff4;return _0x561ff4[_0x2755('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf16824={'uniqueid':_0x560248+'.'+_0x4e82e6['id']+'.'+_0x4e82e6['Interaction']['id'],'FromUserId':_0x33854f['user']['id'],'type':'queue','ToUserId':_0x405ccd['id']};_0xf16824[_0xd2ec57+_0x2755('0x6e')]=_0x4e82e6['id'];_0xf16824[_0xd2ec57+_0x2755('0x6f')]=_0x4e82e6['Interaction']['id'];_0xf16824[_0x2755('0x70')+_0xd2ec57+_0x35fb1b+'Id']=_0x4e82e6[_0x2755('0x6a')]['id'];return db[_0xd2ec57+_0x2755('0x79')]['create'](_0xf16824);})['then'](function(){return respondWithRpcPromise(_0x2755('0x73'),{'channel':_0x560248,'interaction':_0x4e82e6[_0x2755('0x69')],'message':_0x4e82e6,'account':_0x4e82e6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x2755('0x3d'),'appdata':_0x405ccd[_0x2755('0x10')]+','+(_0x4e82e6['Account'][_0x2755('0x7a')]||0x12c),'interval':_0x2755('0x74')}]},routingClient);})['then'](respondWithResult(_0x23a7f0,null))['catch'](handleError(_0x23a7f0,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 607d4a9..a7f1cc7 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 _0x056b=['run','create','put','update','delete','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id'];(function(_0x20a5df,_0x4e1567){var _0x2124e4=function(_0x174f7d){while(--_0x174f7d){_0x20a5df['push'](_0x20a5df['shift']());}};_0x2124e4(++_0x4e1567);}(_0x056b,0x66));var _0xb056=function(_0x158064,_0x1762ac){_0x158064=_0x158064-0x0;var _0x2e159b=_0x056b[_0x158064];return _0x2e159b;};'use strict';var multer=require('multer');var util=require(_0xb056('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb056('0x1')]();var auth=require(_0xb056('0x2'));var interaction=require(_0xb056('0x3'));var config=require(_0xb056('0x4'));var controller=require(_0xb056('0x5'));router[_0xb056('0x6')]('/',auth[_0xb056('0x7')](),controller[_0xb056('0x8')]);router[_0xb056('0x6')](_0xb056('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xb056('0x6')]('/:id/run',auth['isAuthenticated'](),controller[_0xb056('0xa')]);router['post']('/',auth[_0xb056('0x7')](),controller[_0xb056('0xb')]);router[_0xb056('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb056('0xd')]);router[_0xb056('0xe')](_0xb056('0x9'),auth[_0xb056('0x7')](),controller['destroy']);module[_0xb056('0xf')]=router; \ No newline at end of file +var _0x2739=['delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','create','/:id','update'];(function(_0x48f86f,_0x3bda2e){var _0x3dfd1c=function(_0x54610f){while(--_0x54610f){_0x48f86f['push'](_0x48f86f['shift']());}};_0x3dfd1c(++_0x3bda2e);}(_0x2739,0xca));var _0x9273=function(_0x2bfcba,_0x2f8562){_0x2bfcba=_0x2bfcba-0x0;var _0x18014c=_0x2739[_0x2bfcba];return _0x18014c;};'use strict';var multer=require(_0x9273('0x0'));var util=require(_0x9273('0x1'));var path=require(_0x9273('0x2'));var timeout=require(_0x9273('0x3'));var express=require('express');var router=express[_0x9273('0x4')]();var auth=require(_0x9273('0x5'));var interaction=require(_0x9273('0x6'));var config=require('../../config/environment');var controller=require(_0x9273('0x7'));router[_0x9273('0x8')]('/',auth[_0x9273('0x9')](),controller[_0x9273('0xa')]);router[_0x9273('0x8')]('/:id',auth[_0x9273('0x9')](),controller[_0x9273('0xb')]);router[_0x9273('0x8')](_0x9273('0xc'),auth[_0x9273('0x9')](),controller[_0x9273('0xd')]);router[_0x9273('0xe')]('/',auth[_0x9273('0x9')](),controller[_0x9273('0xf')]);router['put'](_0x9273('0x10'),auth[_0x9273('0x9')](),controller[_0x9273('0x11')]);router[_0x9273('0x12')](_0x9273('0x10'),auth[_0x9273('0x9')](),controller[_0x9273('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a780cd8..b7baa64 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 _0xf8af=['pdf','xlsx','custom','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','months','days','hours','minutes','csv'];(function(_0x23de45,_0x6bb3f0){var _0xd82bf0=function(_0x159797){while(--_0x159797){_0x23de45['push'](_0x23de45['shift']());}};_0xd82bf0(++_0x6bb3f0);}(_0xf8af,0x8b));var _0xff8a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf8af[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xff8a('0x0'));module['exports']={'name':{'type':Sequelize[_0xff8a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xff8a('0x1')]},'active':{'type':Sequelize[_0xff8a('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xff8a('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xff8a('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xff8a('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xff8a('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xff8a('0x5')]('years','quarters',_0xff8a('0x6'),'weeks',_0xff8a('0x7'),_0xff8a('0x8'),_0xff8a('0x9')),'allowNull':![],'defaultValue':_0xff8a('0x7')},'output':{'type':Sequelize[_0xff8a('0x5')](_0xff8a('0xa'),_0xff8a('0xb'),_0xff8a('0xc')),'allowNull':![],'defaultValue':_0xff8a('0xa')},'type':{'type':Sequelize[_0xff8a('0x5')](_0xff8a('0xd'),'default'),'allowNull':![],'defaultValue':_0xff8a('0xd')},'sendMail':{'type':Sequelize[_0xff8a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xff8a('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xff8a('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xff8a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x39c7=['csv','pdf','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months','weeks','minutes','days'];(function(_0x4c781d,_0x1da49b){var _0x3bd77d=function(_0x3ae237){while(--_0x3ae237){_0x4c781d['push'](_0x4c781d['shift']());}};_0x3bd77d(++_0x1da49b);}(_0x39c7,0x85));var _0x739c=function(_0x24dfa6,_0x6959fc){_0x24dfa6=_0x24dfa6-0x0;var _0x19f2bb=_0x39c7[_0x24dfa6];return _0x19f2bb;};'use strict';var Sequelize=require('sequelize');module[_0x739c('0x0')]={'name':{'type':Sequelize[_0x739c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x739c('0x1')]},'active':{'type':Sequelize[_0x739c('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x739c('0x1')],'allowNull':![],'defaultValue':_0x739c('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x739c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x739c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x739c('0x6')]('years','quarters',_0x739c('0x7'),_0x739c('0x8'),'days','hours',_0x739c('0x9')),'allowNull':![],'defaultValue':_0x739c('0xa')},'output':{'type':Sequelize['ENUM'](_0x739c('0xb'),_0x739c('0xc'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x739c('0x6')](_0x739c('0xd'),_0x739c('0xe')),'allowNull':![],'defaultValue':_0x739c('0xd')},'sendMail':{'type':Sequelize[_0x739c('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x739c('0x1')]},'cc':{'type':Sequelize[_0x739c('0xf')]},'bcc':{'type':Sequelize[_0x739c('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x739c('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 74ba272..d2174fe 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 _0x6438=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','json','count','offset','status','apply','reject','save','then','get','destroy','end','sendStatus','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','update','run'];(function(_0x5f2202,_0x387878){var _0x3bbc7b=function(_0x295ebb){while(--_0x295ebb){_0x5f2202['push'](_0x5f2202['shift']());}};_0x3bbc7b(++_0x387878);}(_0x6438,0x1e0));var _0x8643=function(_0x49ee71,_0x491e2b){_0x49ee71=_0x49ee71-0x0;var _0x569548=_0x6438[_0x49ee71];return _0x569548;};'use strict';var pdf=require(_0x8643('0x0'));var emlformat=require(_0x8643('0x1'));var rimraf=require(_0x8643('0x2'));var zipdir=require(_0x8643('0x3'));var jsonpatch=require(_0x8643('0x4'));var rp=require(_0x8643('0x5'));var moment=require('moment');var BPromise=require(_0x8643('0x6'));var Mustache=require(_0x8643('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8643('0x8'));var csv=require('to-csv');var ejs=require(_0x8643('0x9'));var fs=require('fs');var _=require(_0x8643('0xa'));var squel=require(_0x8643('0xb'));var crypto=require('crypto');var jsforce=require(_0x8643('0xc'));var deskjs=require(_0x8643('0xd'));var toCsv=require(_0x8643('0xe'));var querystring=require(_0x8643('0xf'));var Papa=require('papaparse');var Redis=require(_0x8643('0x10'));var authService=require(_0x8643('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8643('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8643('0x13'))('api');var utils=require(_0x8643('0x14'));var config=require('../../config/environment');var db=require(_0x8643('0x15'))['db'];function respondWithStatusCode(_0x4030a2,_0x4d919a){_0x4d919a=_0x4d919a||0xcc;return function(_0x1ac8b2){if(_0x1ac8b2){return _0x4030a2['sendStatus'](_0x4d919a);}return _0x4030a2['status'](_0x4d919a)['end']();};}function respondWithResult(_0x448c49,_0x3e1141){_0x3e1141=_0x3e1141||0xc8;return function(_0x59f1fc){if(_0x59f1fc){return _0x448c49['status'](_0x3e1141)[_0x8643('0x16')](_0x59f1fc);}};}function respondWithFilteredResult(_0x1df151,_0x482406){return function(_0x5c8b83){if(_0x5c8b83){var _0x39b758=_0x5c8b83[_0x8643('0x17')],_0x48ac0a=_0x482406[_0x8643('0x18')],_0x356151=_0x482406['offset']+_0x482406['limit'],_0x1bebf7;if(_0x356151>=_0x39b758){_0x356151=_0x39b758;_0x1bebf7=0xc8;}else{_0x1bebf7=0xce;}_0x1df151[_0x8643('0x19')](_0x1bebf7);return _0x1df151['set']('Content-Range',_0x48ac0a+'-'+_0x356151+'/'+_0x39b758)[_0x8643('0x16')](_0x5c8b83);}return null;};}function patchUpdates(_0x2c37c9){return function(_0x3dc56e){try{jsonpatch[_0x8643('0x1a')](_0x3dc56e,_0x2c37c9,!![]);}catch(_0xf59312){return BPromise[_0x8643('0x1b')](_0xf59312);}return _0x3dc56e[_0x8643('0x1c')]();};}function saveUpdates(_0x402165,_0x32d498){return function(_0x52a975){if(_0x52a975){return _0x52a975['update'](_0x402165)['then'](function(_0x427e5e){return _0x427e5e;});}return null;};}function removeEntity(_0x270160,_0x480807){return function(_0x5cbe1d){if(_0x5cbe1d){return _0x5cbe1d['destroy']()[_0x8643('0x1d')](function(){var _0x12054c=_0x5cbe1d[_0x8643('0x1e')]({'plain':!![]});var _0x30e3c4='Scheduler';return db['UserProfileResource'][_0x8643('0x1f')]({'where':{'type':_0x30e3c4,'resourceId':_0x12054c['id']}})[_0x8643('0x1d')](function(){return _0x5cbe1d;});})['then'](function(){_0x270160[_0x8643('0x19')](0xcc)[_0x8643('0x20')]();});}};}function handleEntityNotFound(_0x47e439,_0x5a5b25){return function(_0x74eb9d){if(!_0x74eb9d){_0x47e439[_0x8643('0x21')](0x194);}return _0x74eb9d;};}function handleError(_0x461640,_0x36e21b){_0x36e21b=_0x36e21b||0x1f4;return function(_0x392773){logger[_0x8643('0x22')](_0x392773[_0x8643('0x23')]);if(_0x392773[_0x8643('0x24')]){delete _0x392773[_0x8643('0x24')];}_0x461640[_0x8643('0x19')](_0x36e21b)[_0x8643('0x25')](_0x392773);};}exports[_0x8643('0x26')]=function(_0x57531d,_0xe74eee){var _0x200371={},_0xe3a3e7={},_0x226404={'count':0x0,'rows':[]};var _0x42e57c=_[_0x8643('0x27')](db[_0x8643('0x28')][_0x8643('0x29')],function(_0x4c52bb){return{'name':_0x4c52bb[_0x8643('0x2a')],'type':_0x4c52bb['type'][_0x8643('0x2b')]};});_0xe3a3e7[_0x8643('0x2c')]=_[_0x8643('0x27')](_0x42e57c,_0x8643('0x24'));_0xe3a3e7[_0x8643('0x2d')]=_['keys'](_0x57531d[_0x8643('0x2d')]);_0xe3a3e7[_0x8643('0x2e')]=_[_0x8643('0x2f')](_0xe3a3e7[_0x8643('0x2c')],_0xe3a3e7['query']);_0x200371[_0x8643('0x30')]=_[_0x8643('0x2f')](_0xe3a3e7['model'],qs['fields'](_0x57531d[_0x8643('0x2d')][_0x8643('0x31')]));_0x200371['attributes']=_0x200371['attributes'][_0x8643('0x32')]?_0x200371[_0x8643('0x30')]:_0xe3a3e7[_0x8643('0x2c')];if(!_0x57531d[_0x8643('0x2d')][_0x8643('0x33')]('nolimit')){_0x200371[_0x8643('0x34')]=qs[_0x8643('0x34')](_0x57531d[_0x8643('0x2d')]['limit']);_0x200371['offset']=qs[_0x8643('0x18')](_0x57531d['query'][_0x8643('0x18')]);}_0x200371[_0x8643('0x35')]=qs[_0x8643('0x36')](_0x57531d['query'][_0x8643('0x36')]);_0x200371[_0x8643('0x37')]=qs['filters'](_[_0x8643('0x38')](_0x57531d['query'],_0xe3a3e7[_0x8643('0x2e')]),_0x42e57c);if(_0x57531d['query'][_0x8643('0x39')]){_0x200371[_0x8643('0x37')]=_[_0x8643('0x3a')](_0x200371[_0x8643('0x37')],{'$or':_[_0x8643('0x27')](_0x42e57c,function(_0x43bb3f){if(_0x43bb3f[_0x8643('0x3b')]!=='VIRTUAL'){var _0x2edfde={};_0x2edfde[_0x43bb3f[_0x8643('0x24')]]={'$like':'%'+_0x57531d[_0x8643('0x2d')][_0x8643('0x39')]+'%'};return _0x2edfde;}})});}_0x200371=_[_0x8643('0x3a')]({},_0x200371,_0x57531d['options']);var _0x2426dd={'where':_0x200371[_0x8643('0x37')]};return db[_0x8643('0x28')]['count'](_0x2426dd)[_0x8643('0x1d')](function(_0x5c28c0){_0x226404['count']=_0x5c28c0;if(_0x57531d[_0x8643('0x2d')][_0x8643('0x3c')]){_0x200371[_0x8643('0x3d')]=[{'all':!![]}];}return db[_0x8643('0x28')]['findAll'](_0x200371);})[_0x8643('0x1d')](function(_0x4f11d5){_0x226404[_0x8643('0x3e')]=_0x4f11d5;return _0x226404;})[_0x8643('0x1d')](respondWithFilteredResult(_0xe74eee,_0x200371))[_0x8643('0x3f')](handleError(_0xe74eee,null));};exports[_0x8643('0x40')]=function(_0x49b809,_0x457811){var _0x18b8cf={'raw':![],'where':{'id':_0x49b809[_0x8643('0x41')]['id']}},_0x5d95c1={};_0x5d95c1[_0x8643('0x2c')]=_[_0x8643('0x42')](db[_0x8643('0x28')][_0x8643('0x29')]);_0x5d95c1[_0x8643('0x2d')]=_[_0x8643('0x42')](_0x49b809['query']);_0x5d95c1[_0x8643('0x2e')]=_[_0x8643('0x2f')](_0x5d95c1['model'],_0x5d95c1['query']);_0x18b8cf[_0x8643('0x30')]=_[_0x8643('0x2f')](_0x5d95c1[_0x8643('0x2c')],qs[_0x8643('0x31')](_0x49b809['query']['fields']));_0x18b8cf[_0x8643('0x30')]=_0x18b8cf[_0x8643('0x30')][_0x8643('0x32')]?_0x18b8cf[_0x8643('0x30')]:_0x5d95c1[_0x8643('0x2c')];if(_0x49b809[_0x8643('0x2d')][_0x8643('0x3c')]){_0x18b8cf['include']=[{'all':!![]}];}_0x18b8cf=_[_0x8643('0x3a')]({},_0x18b8cf,_0x49b809[_0x8643('0x43')]);return db[_0x8643('0x28')][_0x8643('0x44')](_0x18b8cf)[_0x8643('0x1d')](handleEntityNotFound(_0x457811,null))[_0x8643('0x1d')](respondWithResult(_0x457811,null))[_0x8643('0x3f')](handleError(_0x457811,null));};exports['create']=function(_0x1280df,_0x2f610c){return db['Schedule'][_0x8643('0x45')](_0x1280df[_0x8643('0x46')],{})[_0x8643('0x1d')](function(_0x4a3e60){var _0x1d07b9=_0x1280df[_0x8643('0x47')]['get']({'plain':!![]});if(!_0x1d07b9)throw new Error(_0x8643('0x48'));if(_0x1d07b9[_0x8643('0x49')]===_0x8643('0x47')){var _0x3462b5=_0x4a3e60[_0x8643('0x1e')]({'plain':!![]});var _0x499e75=_0x8643('0x4a');return db[_0x8643('0x4b')][_0x8643('0x44')]({'where':{'name':_0x499e75,'userProfileId':_0x1d07b9[_0x8643('0x4c')]},'raw':!![]})[_0x8643('0x1d')](function(_0x2b7f2e){if(_0x2b7f2e&&_0x2b7f2e[_0x8643('0x4d')]===0x0){return db['UserProfileResource'][_0x8643('0x45')]({'name':_0x3462b5['name'],'resourceId':_0x3462b5['id'],'type':_0x2b7f2e[_0x8643('0x24')],'sectionId':_0x2b7f2e['id']},{})[_0x8643('0x1d')](function(){return _0x4a3e60;});}else{return _0x4a3e60;}})[_0x8643('0x3f')](function(_0x13ad3b){logger[_0x8643('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13ad3b);throw _0x13ad3b;});}return _0x4a3e60;})[_0x8643('0x1d')](respondWithResult(_0x2f610c,0xc9))['catch'](handleError(_0x2f610c,null));};exports[_0x8643('0x4e')]=function(_0x411421,_0x5c0514){if(_0x411421[_0x8643('0x46')]['id']){delete _0x411421[_0x8643('0x46')]['id'];}return db['Schedule'][_0x8643('0x44')]({'where':{'id':_0x411421['params']['id']}})[_0x8643('0x1d')](handleEntityNotFound(_0x5c0514,null))['then'](saveUpdates(_0x411421[_0x8643('0x46')],null))[_0x8643('0x1d')](respondWithResult(_0x5c0514,null))['catch'](handleError(_0x5c0514,null));};exports[_0x8643('0x1f')]=function(_0x3206c5,_0xe87a74){return db['Schedule'][_0x8643('0x44')]({'where':{'id':_0x3206c5[_0x8643('0x41')]['id']}})[_0x8643('0x1d')](handleEntityNotFound(_0xe87a74,null))['then'](removeEntity(_0xe87a74,null))[_0x8643('0x3f')](handleError(_0xe87a74,null));};exports[_0x8643('0x4f')]=function(_0x3c7b12,_0x182d3f,_0x5e0718){var _0x1d3b1c=require('../../config/schedule');return db[_0x8643('0x28')][_0x8643('0x44')]({'where':{'id':_0x3c7b12[_0x8643('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x182d3f,null))['then'](function(){_0x1d3b1c[_0x8643('0x4f')](_0x3c7b12[_0x8643('0x41')]['id']);})[_0x8643('0x1d')](respondWithStatusCode(_0x182d3f,null))['catch'](handleError(_0x182d3f,null));}; \ No newline at end of file +var _0x5b3a=['intersection','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','merge','options','Schedule','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Scheduler','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes'];(function(_0x156854,_0x5b81b2){var _0x10b704=function(_0x4bf2cb){while(--_0x4bf2cb){_0x156854['push'](_0x156854['shift']());}};_0x10b704(++_0x5b81b2);}(_0x5b3a,0x6e));var _0xa5b3=function(_0x4c99be,_0x59be8f){_0x4c99be=_0x4c99be-0x0;var _0x4b51c5=_0x5b3a[_0x4c99be];return _0x4b51c5;};'use strict';var pdf=require(_0xa5b3('0x0'));var emlformat=require(_0xa5b3('0x1'));var rimraf=require(_0xa5b3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5b3('0x3'));var rp=require(_0xa5b3('0x4'));var moment=require(_0xa5b3('0x5'));var BPromise=require(_0xa5b3('0x6'));var Mustache=require(_0xa5b3('0x7'));var util=require(_0xa5b3('0x8'));var path=require(_0xa5b3('0x9'));var sox=require(_0xa5b3('0xa'));var csv=require(_0xa5b3('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa5b3('0xc'));var squel=require(_0xa5b3('0xd'));var crypto=require(_0xa5b3('0xe'));var jsforce=require(_0xa5b3('0xf'));var deskjs=require(_0xa5b3('0x10'));var toCsv=require(_0xa5b3('0xb'));var querystring=require('querystring');var Papa=require(_0xa5b3('0x11'));var Redis=require(_0xa5b3('0x12'));var authService=require(_0xa5b3('0x13'));var qs=require(_0xa5b3('0x14'));var as=require(_0xa5b3('0x15'));var hardwareService=require(_0xa5b3('0x16'));var logger=require(_0xa5b3('0x17'))(_0xa5b3('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa5b3('0x19'))['db'];function respondWithStatusCode(_0x523901,_0x30e315){_0x30e315=_0x30e315||0xcc;return function(_0x36ac58){if(_0x36ac58){return _0x523901[_0xa5b3('0x1a')](_0x30e315);}return _0x523901[_0xa5b3('0x1b')](_0x30e315)[_0xa5b3('0x1c')]();};}function respondWithResult(_0x24929c,_0x11c01a){_0x11c01a=_0x11c01a||0xc8;return function(_0x4d35c9){if(_0x4d35c9){return _0x24929c[_0xa5b3('0x1b')](_0x11c01a)[_0xa5b3('0x1d')](_0x4d35c9);}};}function respondWithFilteredResult(_0x49383d,_0x2ea9f8){return function(_0x3564e6){if(_0x3564e6){var _0x1dba75=_0x3564e6[_0xa5b3('0x1e')],_0x433e1b=_0x2ea9f8['offset'],_0x162689=_0x2ea9f8[_0xa5b3('0x1f')]+_0x2ea9f8[_0xa5b3('0x20')],_0x11ddf4;if(_0x162689>=_0x1dba75){_0x162689=_0x1dba75;_0x11ddf4=0xc8;}else{_0x11ddf4=0xce;}_0x49383d[_0xa5b3('0x1b')](_0x11ddf4);return _0x49383d[_0xa5b3('0x21')](_0xa5b3('0x22'),_0x433e1b+'-'+_0x162689+'/'+_0x1dba75)[_0xa5b3('0x1d')](_0x3564e6);}return null;};}function patchUpdates(_0x39c8d6){return function(_0x560d52){try{jsonpatch['apply'](_0x560d52,_0x39c8d6,!![]);}catch(_0x5de449){return BPromise['reject'](_0x5de449);}return _0x560d52[_0xa5b3('0x23')]();};}function saveUpdates(_0xd91852,_0x556aa9){return function(_0x2619e6){if(_0x2619e6){return _0x2619e6[_0xa5b3('0x24')](_0xd91852)[_0xa5b3('0x25')](function(_0x17a83d){return _0x17a83d;});}return null;};}function removeEntity(_0x520984,_0x150f45){return function(_0x5023dd){if(_0x5023dd){return _0x5023dd['destroy']()[_0xa5b3('0x25')](function(){var _0x1c63f9=_0x5023dd[_0xa5b3('0x26')]({'plain':!![]});var _0x1d21bd='Scheduler';return db[_0xa5b3('0x27')][_0xa5b3('0x28')]({'where':{'type':_0x1d21bd,'resourceId':_0x1c63f9['id']}})[_0xa5b3('0x25')](function(){return _0x5023dd;});})[_0xa5b3('0x25')](function(){_0x520984[_0xa5b3('0x1b')](0xcc)[_0xa5b3('0x1c')]();});}};}function handleEntityNotFound(_0x1248b0,_0x2749cd){return function(_0xed042d){if(!_0xed042d){_0x1248b0[_0xa5b3('0x1a')](0x194);}return _0xed042d;};}function handleError(_0x3cbe9a,_0x1d1fc2){_0x1d1fc2=_0x1d1fc2||0x1f4;return function(_0x191316){logger[_0xa5b3('0x29')](_0x191316[_0xa5b3('0x2a')]);if(_0x191316[_0xa5b3('0x2b')]){delete _0x191316[_0xa5b3('0x2b')];}_0x3cbe9a[_0xa5b3('0x1b')](_0x1d1fc2)[_0xa5b3('0x2c')](_0x191316);};}exports['index']=function(_0x453b6d,_0x1aef12){var _0x2b457e={},_0x2edb1a={},_0x10d153={'count':0x0,'rows':[]};var _0x440e90=_[_0xa5b3('0x2d')](db['Schedule'][_0xa5b3('0x2e')],function(_0x1bc84){return{'name':_0x1bc84['fieldName'],'type':_0x1bc84[_0xa5b3('0x2f')][_0xa5b3('0x30')]};});_0x2edb1a[_0xa5b3('0x31')]=_[_0xa5b3('0x2d')](_0x440e90,_0xa5b3('0x2b'));_0x2edb1a[_0xa5b3('0x32')]=_[_0xa5b3('0x33')](_0x453b6d[_0xa5b3('0x32')]);_0x2edb1a[_0xa5b3('0x34')]=_['intersection'](_0x2edb1a[_0xa5b3('0x31')],_0x2edb1a[_0xa5b3('0x32')]);_0x2b457e[_0xa5b3('0x35')]=_[_0xa5b3('0x36')](_0x2edb1a['model'],qs[_0xa5b3('0x37')](_0x453b6d[_0xa5b3('0x32')]['fields']));_0x2b457e[_0xa5b3('0x35')]=_0x2b457e[_0xa5b3('0x35')][_0xa5b3('0x38')]?_0x2b457e[_0xa5b3('0x35')]:_0x2edb1a[_0xa5b3('0x31')];if(!_0x453b6d[_0xa5b3('0x32')][_0xa5b3('0x39')]('nolimit')){_0x2b457e['limit']=qs[_0xa5b3('0x20')](_0x453b6d['query'][_0xa5b3('0x20')]);_0x2b457e[_0xa5b3('0x1f')]=qs[_0xa5b3('0x1f')](_0x453b6d[_0xa5b3('0x32')]['offset']);}_0x2b457e['order']=qs['sort'](_0x453b6d[_0xa5b3('0x32')][_0xa5b3('0x3a')]);_0x2b457e[_0xa5b3('0x3b')]=qs[_0xa5b3('0x34')](_[_0xa5b3('0x3c')](_0x453b6d[_0xa5b3('0x32')],_0x2edb1a[_0xa5b3('0x34')]),_0x440e90);if(_0x453b6d[_0xa5b3('0x32')]['filter']){_0x2b457e['where']=_['merge'](_0x2b457e[_0xa5b3('0x3b')],{'$or':_[_0xa5b3('0x2d')](_0x440e90,function(_0x34b507){if(_0x34b507[_0xa5b3('0x2f')]!==_0xa5b3('0x3d')){var _0x5e3fbf={};_0x5e3fbf[_0x34b507[_0xa5b3('0x2b')]]={'$like':'%'+_0x453b6d['query']['filter']+'%'};return _0x5e3fbf;}})});}_0x2b457e=_[_0xa5b3('0x3e')]({},_0x2b457e,_0x453b6d[_0xa5b3('0x3f')]);var _0xb572e9={'where':_0x2b457e['where']};return db[_0xa5b3('0x40')]['count'](_0xb572e9)['then'](function(_0xd0314e){_0x10d153[_0xa5b3('0x1e')]=_0xd0314e;if(_0x453b6d[_0xa5b3('0x32')][_0xa5b3('0x41')]){_0x2b457e['include']=[{'all':!![]}];}return db[_0xa5b3('0x40')][_0xa5b3('0x42')](_0x2b457e);})[_0xa5b3('0x25')](function(_0x59c6bf){_0x10d153[_0xa5b3('0x43')]=_0x59c6bf;return _0x10d153;})[_0xa5b3('0x25')](respondWithFilteredResult(_0x1aef12,_0x2b457e))['catch'](handleError(_0x1aef12,null));};exports[_0xa5b3('0x44')]=function(_0xba4d88,_0x289426){var _0x512980={'raw':![],'where':{'id':_0xba4d88[_0xa5b3('0x45')]['id']}},_0x3a4612={};_0x3a4612[_0xa5b3('0x31')]=_[_0xa5b3('0x33')](db['Schedule']['rawAttributes']);_0x3a4612[_0xa5b3('0x32')]=_[_0xa5b3('0x33')](_0xba4d88[_0xa5b3('0x32')]);_0x3a4612[_0xa5b3('0x34')]=_[_0xa5b3('0x36')](_0x3a4612['model'],_0x3a4612['query']);_0x512980[_0xa5b3('0x35')]=_[_0xa5b3('0x36')](_0x3a4612[_0xa5b3('0x31')],qs[_0xa5b3('0x37')](_0xba4d88[_0xa5b3('0x32')]['fields']));_0x512980[_0xa5b3('0x35')]=_0x512980[_0xa5b3('0x35')][_0xa5b3('0x38')]?_0x512980[_0xa5b3('0x35')]:_0x3a4612[_0xa5b3('0x31')];if(_0xba4d88[_0xa5b3('0x32')]['includeAll']){_0x512980[_0xa5b3('0x46')]=[{'all':!![]}];}_0x512980=_[_0xa5b3('0x3e')]({},_0x512980,_0xba4d88[_0xa5b3('0x3f')]);return db[_0xa5b3('0x40')][_0xa5b3('0x47')](_0x512980)['then'](handleEntityNotFound(_0x289426,null))[_0xa5b3('0x25')](respondWithResult(_0x289426,null))['catch'](handleError(_0x289426,null));};exports['create']=function(_0x5729e1,_0x4a866e){return db[_0xa5b3('0x40')][_0xa5b3('0x48')](_0x5729e1[_0xa5b3('0x49')],{})[_0xa5b3('0x25')](function(_0x5d66e1){var _0x2d8a7f=_0x5729e1[_0xa5b3('0x4a')][_0xa5b3('0x26')]({'plain':!![]});if(!_0x2d8a7f)throw new Error(_0xa5b3('0x4b'));if(_0x2d8a7f['role']==='user'){var _0x56a8df=_0x5d66e1['get']({'plain':!![]});var _0x35a068=_0xa5b3('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x35a068,'userProfileId':_0x2d8a7f[_0xa5b3('0x4d')]},'raw':!![]})['then'](function(_0x108d14){if(_0x108d14&&_0x108d14[_0xa5b3('0x4e')]===0x0){return db[_0xa5b3('0x27')][_0xa5b3('0x48')]({'name':_0x56a8df[_0xa5b3('0x2b')],'resourceId':_0x56a8df['id'],'type':_0x108d14[_0xa5b3('0x2b')],'sectionId':_0x108d14['id']},{})[_0xa5b3('0x25')](function(){return _0x5d66e1;});}else{return _0x5d66e1;}})['catch'](function(_0xd86210){logger[_0xa5b3('0x29')](_0xa5b3('0x4f'),_0xd86210);throw _0xd86210;});}return _0x5d66e1;})[_0xa5b3('0x25')](respondWithResult(_0x4a866e,0xc9))[_0xa5b3('0x50')](handleError(_0x4a866e,null));};exports[_0xa5b3('0x24')]=function(_0x3a1532,_0x5b9ae1){if(_0x3a1532['body']['id']){delete _0x3a1532[_0xa5b3('0x49')]['id'];}return db[_0xa5b3('0x40')][_0xa5b3('0x47')]({'where':{'id':_0x3a1532[_0xa5b3('0x45')]['id']}})[_0xa5b3('0x25')](handleEntityNotFound(_0x5b9ae1,null))['then'](saveUpdates(_0x3a1532['body'],null))[_0xa5b3('0x25')](respondWithResult(_0x5b9ae1,null))[_0xa5b3('0x50')](handleError(_0x5b9ae1,null));};exports[_0xa5b3('0x28')]=function(_0x4ed63d,_0x41d77a){return db[_0xa5b3('0x40')][_0xa5b3('0x47')]({'where':{'id':_0x4ed63d[_0xa5b3('0x45')]['id']}})[_0xa5b3('0x25')](handleEntityNotFound(_0x41d77a,null))['then'](removeEntity(_0x41d77a,null))['catch'](handleError(_0x41d77a,null));};exports[_0xa5b3('0x51')]=function(_0x8ec055,_0x1bbe29,_0x59c2e5){var _0x42c5c2=require('../../config/schedule');return db[_0xa5b3('0x40')][_0xa5b3('0x47')]({'where':{'id':_0x8ec055[_0xa5b3('0x45')]['id']},'raw':!![]})[_0xa5b3('0x25')](handleEntityNotFound(_0x1bbe29,null))[_0xa5b3('0x25')](function(){_0x42c5c2['run'](_0x8ec055[_0xa5b3('0x45')]['id']);})['then'](respondWithStatusCode(_0x1bbe29,null))[_0xa5b3('0x50')](handleError(_0x1bbe29,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1bf28e4..53c5271 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 _0x8ce0=['rimraf','../../config/environment','./schedule.attributes','define','Schedule','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x21b670,_0x55a7ae){var _0x1a7cb5=function(_0xf02806){while(--_0xf02806){_0x21b670['push'](_0x21b670['shift']());}};_0x1a7cb5(++_0x55a7ae);}(_0x8ce0,0x1a7));var _0x08ce=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8ce0[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x08ce('0x0'));var util=require(_0x08ce('0x1'));var logger=require(_0x08ce('0x2'))('api');var moment=require('moment');var BPromise=require(_0x08ce('0x3'));var rp=require(_0x08ce('0x4'));var fs=require('fs');var path=require(_0x08ce('0x5'));var rimraf=require(_0x08ce('0x6'));var config=require(_0x08ce('0x7'));var attributes=require(_0x08ce('0x8'));module['exports']=function(_0xd72abc,_0x540fc6){return _0xd72abc[_0x08ce('0x9')](_0x08ce('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e39=['define','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./schedule.attributes'];(function(_0x25508e,_0x350436){var _0x36c55a=function(_0x4ccf04){while(--_0x4ccf04){_0x25508e['push'](_0x25508e['shift']());}};_0x36c55a(++_0x350436);}(_0x4e39,0xdf));var _0x94e3=function(_0x110c54,_0xa3cfcb){_0x110c54=_0x110c54-0x0;var _0x58a348=_0x4e39[_0x110c54];return _0x58a348;};'use strict';var _=require('lodash');var util=require(_0x94e3('0x0'));var logger=require(_0x94e3('0x1'))(_0x94e3('0x2'));var moment=require(_0x94e3('0x3'));var BPromise=require(_0x94e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94e3('0x5'));var rimraf=require('rimraf');var config=require(_0x94e3('0x6'));var attributes=require(_0x94e3('0x7'));module['exports']=function(_0x579d00,_0x547767){return _0x579d00[_0x94e3('0x8')](_0x94e3('0x9'),attributes,{'tableName':_0x94e3('0xa'),'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 c9bbf88..013d80a 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 _0x8e41=['message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x35994e,_0x3968be){var _0x1dc2e=function(_0x5443ed){while(--_0x5443ed){_0x35994e['push'](_0x35994e['shift']());}};_0x1dc2e(++_0x3968be);}(_0x8e41,0x173));var _0x18e4=function(_0x7eee15,_0x3fe21a){_0x7eee15=_0x7eee15-0x0;var _0x7ad23=_0x8e41[_0x7eee15];return _0x7ad23;};'use strict';var _=require(_0x18e4('0x0'));var util=require(_0x18e4('0x1'));var moment=require(_0x18e4('0x2'));var BPromise=require('bluebird');var rs=require(_0x18e4('0x3'));var fs=require('fs');var Redis=require(_0x18e4('0x4'));var db=require(_0x18e4('0x5'))['db'];var utils=require(_0x18e4('0x6'));var logger=require(_0x18e4('0x7'))(_0x18e4('0x8'));var config=require(_0x18e4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x18e4('0xa')][_0x18e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4618a1,_0x40dfd2,_0x56ffed){return new BPromise(function(_0x4dcfaf,_0x59a038){return client[_0x18e4('0xc')](_0x4618a1,_0x56ffed)[_0x18e4('0xd')](function(_0x3c44be){logger['info'](_0x18e4('0xe'),_0x40dfd2,'request\x20sent');logger[_0x18e4('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x40dfd2,_0x18e4('0x10'),JSON[_0x18e4('0x11')](_0x3c44be));if(_0x3c44be[_0x18e4('0x12')]){if(_0x3c44be['error'][_0x18e4('0x13')]===0x1f4){logger[_0x18e4('0x12')]('Schedule,\x20%s,\x20%s',_0x40dfd2,_0x3c44be[_0x18e4('0x12')][_0x18e4('0x14')]);return _0x59a038(_0x3c44be['error'][_0x18e4('0x14')]);}logger[_0x18e4('0x12')]('Schedule,\x20%s,\x20%s',_0x40dfd2,_0x3c44be[_0x18e4('0x12')][_0x18e4('0x14')]);return _0x4dcfaf(_0x3c44be[_0x18e4('0x12')]['message']);}else{logger[_0x18e4('0x15')](_0x18e4('0xe'),_0x40dfd2,_0x18e4('0x10'));_0x4dcfaf(_0x3c44be[_0x18e4('0x16')][_0x18e4('0x14')]);}})['catch'](function(_0x2500e8){logger[_0x18e4('0x12')](_0x18e4('0xe'),_0x40dfd2,_0x2500e8);_0x59a038(_0x2500e8);});});} \ No newline at end of file +var _0xa74f=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x14c8ee,_0x34d4fb){var _0x51acc2=function(_0x4c1277){while(--_0x4c1277){_0x14c8ee['push'](_0x14c8ee['shift']());}};_0x51acc2(++_0x34d4fb);}(_0xa74f,0x1b2));var _0xfa74=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xa74f[_0x3cec8c];return _0x38032e;};'use strict';var _=require(_0xfa74('0x0'));var util=require(_0xfa74('0x1'));var moment=require('moment');var BPromise=require(_0xfa74('0x2'));var rs=require(_0xfa74('0x3'));var fs=require('fs');var Redis=require(_0xfa74('0x4'));var db=require(_0xfa74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa74('0x6'))(_0xfa74('0x7'));var config=require(_0xfa74('0x8'));var jayson=require(_0xfa74('0x9'));var client=jayson[_0xfa74('0xa')][_0xfa74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a8094,_0x1850be,_0x2d44fc){return new BPromise(function(_0x593e3b,_0x39e9a5){return client[_0xfa74('0xc')](_0x5a8094,_0x2d44fc)['then'](function(_0x1173bc){logger[_0xfa74('0xd')](_0xfa74('0xe'),_0x1850be,_0xfa74('0xf'));logger[_0xfa74('0x10')](_0xfa74('0x11'),_0x1850be,_0xfa74('0xf'),JSON[_0xfa74('0x12')](_0x1173bc));if(_0x1173bc['error']){if(_0x1173bc[_0xfa74('0x13')][_0xfa74('0x14')]===0x1f4){logger['error'](_0xfa74('0xe'),_0x1850be,_0x1173bc[_0xfa74('0x13')]['message']);return _0x39e9a5(_0x1173bc[_0xfa74('0x13')][_0xfa74('0x15')]);}logger[_0xfa74('0x13')]('Schedule,\x20%s,\x20%s',_0x1850be,_0x1173bc[_0xfa74('0x13')]['message']);return _0x593e3b(_0x1173bc[_0xfa74('0x13')][_0xfa74('0x15')]);}else{logger[_0xfa74('0xd')](_0xfa74('0xe'),_0x1850be,_0xfa74('0xf'));_0x593e3b(_0x1173bc[_0xfa74('0x16')][_0xfa74('0x15')]);}})[_0xfa74('0x17')](function(_0x1ae318){logger[_0xfa74('0x13')]('Schedule,\x20%s,\x20%s',_0x1850be,_0x1ae318);_0x39e9a5(_0x1ae318);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 3814c37..6ab02d6 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 _0xd27c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','put','delete','destroy','exports','multer','util','path'];(function(_0x15a3f6,_0x38bdeb){var _0x1948bc=function(_0x250a3a){while(--_0x250a3a){_0x15a3f6['push'](_0x15a3f6['shift']());}};_0x1948bc(++_0x38bdeb);}(_0xd27c,0xad));var _0xcd27=function(_0x212960,_0x520f14){_0x212960=_0x212960-0x0;var _0x4f5a8a=_0xd27c[_0x212960];return _0x4f5a8a;};'use strict';var multer=require(_0xcd27('0x0'));var util=require(_0xcd27('0x1'));var path=require(_0xcd27('0x2'));var timeout=require(_0xcd27('0x3'));var express=require(_0xcd27('0x4'));var router=express[_0xcd27('0x5')]();var auth=require(_0xcd27('0x6'));var interaction=require(_0xcd27('0x7'));var config=require(_0xcd27('0x8'));var controller=require('./screenRecording.controller');router[_0xcd27('0x9')]('/',auth[_0xcd27('0xa')](),controller[_0xcd27('0xb')]);router['get'](_0xcd27('0xc'),auth[_0xcd27('0xa')](),controller[_0xcd27('0xd')]);router[_0xcd27('0x9')](_0xcd27('0xe'),auth[_0xcd27('0xa')](),controller[_0xcd27('0xf')]);router[_0xcd27('0x9')]('/:id/download',auth[_0xcd27('0xa')](),controller[_0xcd27('0x10')]);router[_0xcd27('0x11')]('/',auth[_0xcd27('0xa')](),controller['create']);router[_0xcd27('0x12')](_0xcd27('0xe'),auth[_0xcd27('0xa')](),controller['update']);router[_0xcd27('0x13')]('/:id',auth[_0xcd27('0xa')](),controller[_0xcd27('0x14')]);module[_0xcd27('0x15')]=router; \ No newline at end of file +var _0x0a97=['./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id/download','post','create','/:id','update','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c3e16,_0x10874e){var _0x36e860=function(_0xdabd7){while(--_0xdabd7){_0x2c3e16['push'](_0x2c3e16['shift']());}};_0x36e860(++_0x10874e);}(_0x0a97,0x79));var _0x70a9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0a97[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x70a9('0x0'));var express=require('express');var router=express[_0x70a9('0x1')]();var auth=require(_0x70a9('0x2'));var interaction=require(_0x70a9('0x3'));var config=require(_0x70a9('0x4'));var controller=require(_0x70a9('0x5'));router[_0x70a9('0x6')]('/',auth[_0x70a9('0x7')](),controller[_0x70a9('0x8')]);router[_0x70a9('0x6')](_0x70a9('0x9'),auth[_0x70a9('0x7')](),controller[_0x70a9('0xa')]);router['get']('/:id',auth[_0x70a9('0x7')](),controller['show']);router[_0x70a9('0x6')](_0x70a9('0xb'),auth[_0x70a9('0x7')](),controller['download']);router[_0x70a9('0xc')]('/',auth[_0x70a9('0x7')](),controller[_0x70a9('0xd')]);router['put'](_0x70a9('0xe'),auth[_0x70a9('0x7')](),controller[_0x70a9('0xf')]);router['delete']('/:id',auth[_0x70a9('0x7')](),controller[_0x70a9('0x10')]);module[_0x70a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 9144537..960d868 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 _0x3e74=['path','../../config/environment','exports','value','getDataValue','STRING','replace','setDataValue','INTEGER','subtract','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize'];(function(_0x28810a,_0x274285){var _0x2f52d1=function(_0xc707c4){while(--_0xc707c4){_0x28810a['push'](_0x28810a['shift']());}};_0x2f52d1(++_0x274285);}(_0x3e74,0x175));var _0x43e7=function(_0x3c67da,_0x525094){_0x3c67da=_0x3c67da-0x0;var _0x5cca28=_0x3e74[_0x3c67da];return _0x5cca28;};'use strict';var Sequelize=require(_0x43e7('0x0'));var moment=require('moment');var path=require(_0x43e7('0x1'));var config=require(_0x43e7('0x2'));module[_0x43e7('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x43e7('0x4'))?path['extname'](this[_0x43e7('0x5')](_0x43e7('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x43e7('0x6')]},'channel':{'type':Sequelize[_0x43e7('0x6')]},'value':{'type':Sequelize[_0x43e7('0x6')],'set':function(_0x503698){var _0x45a0d1=_0x503698[_0x43e7('0x7')](/\\/g,'/');this[_0x43e7('0x8')](_0x43e7('0x4'),_0x45a0d1);}},'rating':{'type':Sequelize[_0x43e7('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x212c6c){this['setDataValue']('startedAt',moment()[_0x43e7('0xa')](_0x212c6c,'ms'));this[_0x43e7('0x8')]('closedAt',moment());this[_0x43e7('0x8')]('duration',_0x212c6c);}},'startedAt':{'type':Sequelize[_0x43e7('0xb')],'get':function(){return moment(this[_0x43e7('0x5')]('startedAt'))[_0x43e7('0xc')](_0x43e7('0xd'))[_0x43e7('0xe')]();}},'closedAt':{'type':Sequelize[_0x43e7('0xb')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x43e7('0xc')](_0x43e7('0xd'))[_0x43e7('0xe')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x43e7('0xf')))[_0x43e7('0xc')](_0x43e7('0xd'))[_0x43e7('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x43e7('0x10')))[_0x43e7('0xc')](_0x43e7('0xd'))['toString']();}}}; \ No newline at end of file +var _0xa630=['sequelize','moment','exports','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x447328,_0x3fcf4f){var _0x53450c=function(_0x5309b3){while(--_0x5309b3){_0x447328['push'](_0x447328['shift']());}};_0x53450c(++_0x3fcf4f);}(_0xa630,0xbe));var _0x0a63=function(_0x37aec4,_0x38975e){_0x37aec4=_0x37aec4-0x0;var _0x38bb4b=_0xa630[_0x37aec4];return _0x38bb4b;};'use strict';var Sequelize=require(_0x0a63('0x0'));var moment=require(_0x0a63('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x0a63('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a63('0x3')]('value')?path[_0x0a63('0x4')](this[_0x0a63('0x3')](_0x0a63('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x0a63('0x6')]},'channel':{'type':Sequelize[_0x0a63('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2760b0){var _0x3d5f0b=_0x2760b0[_0x0a63('0x7')](/\\/g,'/');this[_0x0a63('0x8')](_0x0a63('0x5'),_0x3d5f0b);}},'rating':{'type':Sequelize[_0x0a63('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x688acd){this[_0x0a63('0x8')](_0x0a63('0xa'),moment()[_0x0a63('0xb')](_0x688acd,'ms'));this[_0x0a63('0x8')](_0x0a63('0xc'),moment());this[_0x0a63('0x8')](_0x0a63('0xd'),_0x688acd);}},'startedAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this[_0x0a63('0x3')]('startedAt'))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'closedAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this['getDataValue'](_0x0a63('0xc')))['format'](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'createdAt':{'type':Sequelize[_0x0a63('0xe')],'get':function(){return moment(this[_0x0a63('0x3')](_0x0a63('0x12')))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a63('0x3')]('updatedAt'))[_0x0a63('0xf')](_0x0a63('0x10'))[_0x0a63('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 87fdc33..87f7f85 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 _0x446d=['isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','existsSync','info','File:\x20\x22','.cypher'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0x446d,0x126));var _0xd446=function(_0xcb48ca,_0x540ecb){_0xcb48ca=_0xcb48ca-0x0;var _0x37be10=_0x446d[_0xcb48ca];return _0x37be10;};'use strict';var pdf=require(_0xd446('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd446('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd446('0x2'));var rp=require(_0xd446('0x3'));var moment=require('moment');var BPromise=require(_0xd446('0x4'));var Mustache=require('mustache');var util=require(_0xd446('0x5'));var path=require(_0xd446('0x6'));var sox=require(_0xd446('0x7'));var csv=require(_0xd446('0x8'));var ejs=require(_0xd446('0x9'));var fs=require('fs');var _=require(_0xd446('0xa'));var squel=require(_0xd446('0xb'));var crypto=require('crypto');var jsforce=require(_0xd446('0xc'));var deskjs=require(_0xd446('0xd'));var toCsv=require(_0xd446('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd446('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd446('0xf'));var hardwareService=require(_0xd446('0x10'));var logger=require('../../config/logger')(_0xd446('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12fcec,_0x3fae22){_0x3fae22=_0x3fae22||0xcc;return function(_0x5d5e74){if(_0x5d5e74){return _0x12fcec[_0xd446('0x12')](_0x3fae22);}return _0x12fcec[_0xd446('0x13')](_0x3fae22)[_0xd446('0x14')]();};}function respondWithResult(_0x261443,_0x31d0c6){_0x31d0c6=_0x31d0c6||0xc8;return function(_0x42b388){if(_0x42b388){return _0x261443[_0xd446('0x13')](_0x31d0c6)[_0xd446('0x15')](_0x42b388);}};}function respondWithFilteredResult(_0x1b605e,_0x36483b){return function(_0x574e52){if(_0x574e52){var _0x56fbcb=_0x574e52[_0xd446('0x16')],_0x2ffbfd=_0x36483b['offset'],_0x53a76f=_0x36483b[_0xd446('0x17')]+_0x36483b[_0xd446('0x18')],_0x3dd24f;if(_0x53a76f>=_0x56fbcb){_0x53a76f=_0x56fbcb;_0x3dd24f=0xc8;}else{_0x3dd24f=0xce;}_0x1b605e[_0xd446('0x13')](_0x3dd24f);return _0x1b605e[_0xd446('0x19')]('Content-Range',_0x2ffbfd+'-'+_0x53a76f+'/'+_0x56fbcb)[_0xd446('0x15')](_0x574e52);}return null;};}function patchUpdates(_0x163cb3){return function(_0x41d301){try{jsonpatch['apply'](_0x41d301,_0x163cb3,!![]);}catch(_0x563423){return BPromise[_0xd446('0x1a')](_0x563423);}return _0x41d301['save']();};}function saveUpdates(_0x365d34,_0xc6b80d){return function(_0x494b20){if(_0x494b20){return _0x494b20[_0xd446('0x1b')](_0x365d34)[_0xd446('0x1c')](function(_0x5e0d1f){return _0x5e0d1f;});}return null;};}function removeEntity(_0x4171bf,_0x2cbdb0){return function(_0x3e1243){if(_0x3e1243){return _0x3e1243[_0xd446('0x1d')]()[_0xd446('0x1c')](function(){_0x4171bf[_0xd446('0x13')](0xcc)[_0xd446('0x14')]();});}};}function handleEntityNotFound(_0x3f96c8,_0x544e61){return function(_0x610c93){if(!_0x610c93){_0x3f96c8[_0xd446('0x12')](0x194);}return _0x610c93;};}function handleError(_0x3f775f,_0x157cde){_0x157cde=_0x157cde||0x1f4;return function(_0x4ee2c9){logger[_0xd446('0x1e')](_0x4ee2c9[_0xd446('0x1f')]);if(_0x4ee2c9[_0xd446('0x20')]){delete _0x4ee2c9[_0xd446('0x20')];}_0x3f775f[_0xd446('0x13')](_0x157cde)[_0xd446('0x21')](_0x4ee2c9);};}exports[_0xd446('0x22')]=function(_0x48e40d,_0x5a9ce6){var _0x3ac3c7={},_0xb43acf={},_0x5c84de={'count':0x0,'rows':[]};var _0x1f1287=_[_0xd446('0x23')](db[_0xd446('0x24')][_0xd446('0x25')],function(_0xec95cc){return{'name':_0xec95cc[_0xd446('0x26')],'type':_0xec95cc['type'][_0xd446('0x27')]};});_0xb43acf[_0xd446('0x28')]=_[_0xd446('0x29')](_['map'](_0x1f1287,'name'),[_0xd446('0x2a')]);_0xb43acf[_0xd446('0x2b')]=_['keys'](_0x48e40d[_0xd446('0x2b')]);_0xb43acf[_0xd446('0x2c')]=_[_0xd446('0x2d')](_0xb43acf['model'],_0xb43acf[_0xd446('0x2b')]);_0x3ac3c7['attributes']=_[_0xd446('0x2d')](_0xb43acf[_0xd446('0x28')],qs[_0xd446('0x2e')](_0x48e40d[_0xd446('0x2b')]['fields']));_0x3ac3c7[_0xd446('0x2f')]=_0x3ac3c7[_0xd446('0x2f')]['length']?_0x3ac3c7[_0xd446('0x2f')]:_0xb43acf[_0xd446('0x28')];if(!_0x48e40d[_0xd446('0x2b')]['hasOwnProperty'](_0xd446('0x30'))){_0x3ac3c7[_0xd446('0x18')]=qs[_0xd446('0x18')](_0x48e40d['query']['limit']);_0x3ac3c7[_0xd446('0x17')]=qs[_0xd446('0x17')](_0x48e40d[_0xd446('0x2b')]['offset']);}_0x3ac3c7[_0xd446('0x31')]=qs[_0xd446('0x32')](_0x48e40d[_0xd446('0x2b')][_0xd446('0x32')]);_0x3ac3c7[_0xd446('0x33')]=qs[_0xd446('0x2c')](_[_0xd446('0x34')](_0x48e40d[_0xd446('0x2b')],_0xb43acf[_0xd446('0x2c')]),_0x1f1287);if(_0x48e40d[_0xd446('0x2b')][_0xd446('0x35')]){_0x3ac3c7[_0xd446('0x33')]=_[_0xd446('0x36')](_0x3ac3c7['where'],{'$or':_['map'](_0x1f1287,function(_0x4c56d4){if(_0x4c56d4[_0xd446('0x37')]!==_0xd446('0x38')){var _0x2130c2={};_0x2130c2[_0x4c56d4[_0xd446('0x20')]]={'$like':'%'+_0x48e40d[_0xd446('0x2b')][_0xd446('0x35')]+'%'};return _0x2130c2;}})});}_0x3ac3c7=_[_0xd446('0x36')]({},_0x3ac3c7,_0x48e40d[_0xd446('0x39')]);var _0xc6fec7={'where':_0x3ac3c7[_0xd446('0x33')]};return db[_0xd446('0x24')][_0xd446('0x16')](_0xc6fec7)['then'](function(_0x4cba15){_0x5c84de[_0xd446('0x16')]=_0x4cba15;if(_0x48e40d[_0xd446('0x2b')][_0xd446('0x3a')]){_0x3ac3c7[_0xd446('0x3b')]=[{'all':!![]}];}return db['ScreenRecording'][_0xd446('0x3c')](_0x3ac3c7);})['then'](function(_0x23a5ef){_0x5c84de[_0xd446('0x3d')]=_0x23a5ef;return _0x5c84de;})[_0xd446('0x1c')](respondWithFilteredResult(_0x5a9ce6,_0x3ac3c7))[_0xd446('0x3e')](handleError(_0x5a9ce6,null));};exports[_0xd446('0x3f')]=function(_0x3667d3,_0x280265){var _0x5ce5da={'raw':![],'where':{'id':_0x3667d3[_0xd446('0x40')]['id']}},_0x2714f0={};_0x2714f0['model']=_['keys'](db[_0xd446('0x24')][_0xd446('0x25')]);_0x2714f0[_0xd446('0x2b')]=_[_0xd446('0x41')](_0x3667d3[_0xd446('0x2b')]);_0x2714f0[_0xd446('0x2c')]=_[_0xd446('0x2d')](_0x2714f0[_0xd446('0x28')],_0x2714f0[_0xd446('0x2b')]);_0x5ce5da[_0xd446('0x2f')]=_['intersection'](_0x2714f0[_0xd446('0x28')],qs[_0xd446('0x2e')](_0x3667d3['query'][_0xd446('0x2e')]));_0x5ce5da[_0xd446('0x2f')]=_0x5ce5da[_0xd446('0x2f')][_0xd446('0x42')]?_0x5ce5da[_0xd446('0x2f')]:_0x2714f0[_0xd446('0x28')];if(_0x3667d3[_0xd446('0x2b')]['includeAll']){_0x5ce5da[_0xd446('0x3b')]=[{'all':!![]}];}_0x5ce5da=_['merge']({},_0x5ce5da,_0x3667d3[_0xd446('0x39')]);return db[_0xd446('0x24')][_0xd446('0x43')](_0x5ce5da)['then'](handleEntityNotFound(_0x280265,null))[_0xd446('0x1c')](respondWithResult(_0x280265,null))[_0xd446('0x3e')](handleError(_0x280265,null));};exports[_0xd446('0x44')]=function(_0x3e4d08,_0x3fd1ac){return db[_0xd446('0x24')][_0xd446('0x44')](_0x3e4d08['body'],{})[_0xd446('0x1c')](respondWithResult(_0x3fd1ac,0xc9))[_0xd446('0x3e')](handleError(_0x3fd1ac,null));};exports[_0xd446('0x1b')]=function(_0x49e001,_0x4d0da3){if(_0x49e001[_0xd446('0x45')]['id']){delete _0x49e001['body']['id'];}delete _0x49e001[_0xd446('0x45')]['duration'];delete _0x49e001[_0xd446('0x45')]['createdAt'];delete _0x49e001[_0xd446('0x45')][_0xd446('0x46')];delete _0x49e001['body'][_0xd446('0x47')];return db[_0xd446('0x24')][_0xd446('0x43')]({'where':{'id':_0x49e001[_0xd446('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d0da3,null))['then'](saveUpdates(_0x49e001['body'],null))[_0xd446('0x1c')](respondWithResult(_0x4d0da3,null))['catch'](handleError(_0x4d0da3,null));};exports[_0xd446('0x48')]=function(_0x525a1f,_0x4b1296){return db['ScreenRecording'][_0xd446('0x48')]()['then'](respondWithResult(_0x4b1296,null))[_0xd446('0x3e')](handleError(_0x4b1296,null));};exports[_0xd446('0x49')]=function(_0x31b24d,_0x58e951,_0x123419){var _0x43f770=require(_0xd446('0x4a'));var _0x24a110=![];var _0x298c48={};if(_0x31b24d[_0xd446('0x2b')][_0xd446('0x37')]&&_0x31b24d[_0xd446('0x2b')]['type']==='uniqueid'){_0x298c48['uniqueid']=_0x31b24d[_0xd446('0x40')]['id'];}else{_0x298c48['id']=_0x31b24d[_0xd446('0x40')]['id'];}return db[_0xd446('0x24')][_0xd446('0x43')]({'where':_0x298c48,'attributes':['id','value'],'raw':!![]})[_0xd446('0x1c')](handleEntityNotFound(_0x58e951,null))[_0xd446('0x1c')](function(_0x3f19d1){if(_0x3f19d1){var _0x19abd4=path[_0xd446('0x4b')](config[_0xd446('0x4c')],_0xd446('0x4d'),_0x3f19d1[_0xd446('0x47')]);var _0x5ee448=util[_0xd446('0x2a')](_0xd446('0x4e'),_0x19abd4);if(fs['existsSync'](_0x5ee448)){_0x24a110=!![];return _0x43f770[_0xd446('0x4f')](_0x5ee448,_0x19abd4,config[_0xd446('0x50')]['recording'])[_0xd446('0x1c')](function(){return _0x3f19d1;});}return _0x3f19d1;}})[_0xd446('0x1c')](function(_0x7a88b5){if(_0x7a88b5){var _0x259130=path[_0xd446('0x4b')](config[_0xd446('0x4c')],_0xd446('0x4d'),_0x7a88b5[_0xd446('0x47')]);if(!fs['existsSync'](_0x259130)){throw new db[(_0xd446('0x51'))][(_0xd446('0x52'))]('ScreenRecording\x20not\x20found');}if(_0x7a88b5[_0xd446('0x53')]){return _0x58e951[_0xd446('0x49')](_0x259130,_0x7a88b5[_0xd446('0x53')]+path[_0xd446('0x54')](_0x259130),function(){if(_0x24a110){fs[_0xd446('0x55')](_0x259130);}});}else{return _0x58e951['download'](_0x259130,function(_0x555489){if(_0x24a110){fs['unlink'](_0x259130);}});}}})['catch'](function(_0x1114a5){if(_0x1114a5[_0xd446('0x56')]===_0xd446('0x57')){_0x58e951['status'](0x194)['send'](_0xd446('0x58'));}else{return handleError(_0x58e951,null);}});};exports[_0xd446('0x1d')]=function(_0x3ca0eb,_0x39c837){return db['ScreenRecording'][_0xd446('0x43')]({'where':{'id':_0x3ca0eb[_0xd446('0x40')]['id']}})['then'](function(_0xb8569f){if(!_0xb8569f)throw new ReferenceError('Entity\x20not\x20found');return _0xb8569f;})[_0xd446('0x1c')](function(_0xa72302){var _0x14829e=path[_0xd446('0x4b')](config[_0xd446('0x4c')],_0xd446('0x4d'),_0xa72302[_0xd446('0x47')]);logger['info'](_0xd446('0x59'),_0x14829e);if(!_['isNil'](_0xa72302[_0xd446('0x47')])&&fs[_0xd446('0x5a')](_0x14829e)){logger[_0xd446('0x5b')](_0xd446('0x5c')+_0x14829e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x14829e);}_0x14829e=_0x14829e+_0xd446('0x5d');if(!_[_0xd446('0x5e')](_0xa72302['value'])&&fs[_0xd446('0x5a')](_0x14829e)){logger[_0xd446('0x5b')](_0xd446('0x5c')+_0x14829e+_0xd446('0x5f'));fs[_0xd446('0x60')](_0x14829e);}return _0xa72302;})[_0xd446('0x1c')](function(_0x306fd2){if(!_0x306fd2)throw new InternalError();return _0x306fd2[_0xd446('0x1d')]();})[_0xd446('0x1c')](function(){_0x39c837[_0xd446('0x13')](0xcc)[_0xd446('0x14')]();})[_0xd446('0x3e')](handleError(_0x39c837,null));}; \ No newline at end of file +var _0x1b12=['secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','ScreenRecording','rawAttributes','type','model','differenceBy','format','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','keys','find','create','update','body','createdAt','closedAt','value','catch','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync'];(function(_0x3192c3,_0x550336){var _0x4e3932=function(_0x34c461){while(--_0x34c461){_0x3192c3['push'](_0x3192c3['shift']());}};_0x4e3932(++_0x550336);}(_0x1b12,0x1b6));var _0x21b1=function(_0x122975,_0xc962ef){_0x122975=_0x122975-0x0;var _0x3657db=_0x1b12[_0x122975];return _0x3657db;};'use strict';var pdf=require(_0x21b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x21b1('0x1'));var zipdir=require(_0x21b1('0x2'));var jsonpatch=require(_0x21b1('0x3'));var rp=require('request-promise');var moment=require(_0x21b1('0x4'));var BPromise=require(_0x21b1('0x5'));var Mustache=require(_0x21b1('0x6'));var util=require(_0x21b1('0x7'));var path=require('path');var sox=require(_0x21b1('0x8'));var csv=require(_0x21b1('0x9'));var ejs=require(_0x21b1('0xa'));var fs=require('fs');var _=require(_0x21b1('0xb'));var squel=require(_0x21b1('0xc'));var crypto=require(_0x21b1('0xd'));var jsforce=require(_0x21b1('0xe'));var deskjs=require(_0x21b1('0xf'));var toCsv=require(_0x21b1('0x9'));var querystring=require(_0x21b1('0x10'));var Papa=require(_0x21b1('0x11'));var Redis=require(_0x21b1('0x12'));var authService=require(_0x21b1('0x13'));var qs=require(_0x21b1('0x14'));var as=require(_0x21b1('0x15'));var hardwareService=require(_0x21b1('0x16'));var logger=require(_0x21b1('0x17'))(_0x21b1('0x18'));var utils=require('../../config/utils');var config=require(_0x21b1('0x19'));var db=require(_0x21b1('0x1a'))['db'];function respondWithStatusCode(_0x2b9bd2,_0x151d43){_0x151d43=_0x151d43||0xcc;return function(_0x18b50c){if(_0x18b50c){return _0x2b9bd2[_0x21b1('0x1b')](_0x151d43);}return _0x2b9bd2[_0x21b1('0x1c')](_0x151d43)[_0x21b1('0x1d')]();};}function respondWithResult(_0x4fc8e4,_0x381eef){_0x381eef=_0x381eef||0xc8;return function(_0x40ac0a){if(_0x40ac0a){return _0x4fc8e4[_0x21b1('0x1c')](_0x381eef)[_0x21b1('0x1e')](_0x40ac0a);}};}function respondWithFilteredResult(_0x277258,_0x5e1d04){return function(_0x364979){if(_0x364979){var _0x46a38e=_0x364979['count'],_0x5780dd=_0x5e1d04[_0x21b1('0x1f')],_0x32071d=_0x5e1d04['offset']+_0x5e1d04[_0x21b1('0x20')],_0x4da593;if(_0x32071d>=_0x46a38e){_0x32071d=_0x46a38e;_0x4da593=0xc8;}else{_0x4da593=0xce;}_0x277258[_0x21b1('0x1c')](_0x4da593);return _0x277258['set'](_0x21b1('0x21'),_0x5780dd+'-'+_0x32071d+'/'+_0x46a38e)[_0x21b1('0x1e')](_0x364979);}return null;};}function patchUpdates(_0x4f23ab){return function(_0xad99ed){try{jsonpatch[_0x21b1('0x22')](_0xad99ed,_0x4f23ab,!![]);}catch(_0x20c3cc){return BPromise[_0x21b1('0x23')](_0x20c3cc);}return _0xad99ed[_0x21b1('0x24')]();};}function saveUpdates(_0x31e224,_0x564be2){return function(_0x1ee34b){if(_0x1ee34b){return _0x1ee34b['update'](_0x31e224)[_0x21b1('0x25')](function(_0x59c1a6){return _0x59c1a6;});}return null;};}function removeEntity(_0x25db2b,_0x5c3174){return function(_0x5e1234){if(_0x5e1234){return _0x5e1234[_0x21b1('0x26')]()[_0x21b1('0x25')](function(){_0x25db2b[_0x21b1('0x1c')](0xcc)[_0x21b1('0x1d')]();});}};}function handleEntityNotFound(_0x317d64,_0x1c6486){return function(_0x3059f4){if(!_0x3059f4){_0x317d64[_0x21b1('0x1b')](0x194);}return _0x3059f4;};}function handleError(_0xaa460d,_0x3f86df){_0x3f86df=_0x3f86df||0x1f4;return function(_0x5337d1){logger['error'](_0x5337d1[_0x21b1('0x27')]);if(_0x5337d1['name']){delete _0x5337d1[_0x21b1('0x28')];}_0xaa460d[_0x21b1('0x1c')](_0x3f86df)['send'](_0x5337d1);};}exports[_0x21b1('0x29')]=function(_0x3e13e4,_0x21f67e){var _0x5b9e22={},_0x3c252d={},_0x172c9={'count':0x0,'rows':[]};var _0x2d7271=_[_0x21b1('0x2a')](db[_0x21b1('0x2b')][_0x21b1('0x2c')],function(_0x133349){return{'name':_0x133349['fieldName'],'type':_0x133349[_0x21b1('0x2d')]['key']};});_0x3c252d[_0x21b1('0x2e')]=_[_0x21b1('0x2f')](_[_0x21b1('0x2a')](_0x2d7271,'name'),[_0x21b1('0x30')]);_0x3c252d[_0x21b1('0x31')]=_['keys'](_0x3e13e4['query']);_0x3c252d[_0x21b1('0x32')]=_['intersection'](_0x3c252d[_0x21b1('0x2e')],_0x3c252d['query']);_0x5b9e22[_0x21b1('0x33')]=_[_0x21b1('0x34')](_0x3c252d[_0x21b1('0x2e')],qs[_0x21b1('0x35')](_0x3e13e4[_0x21b1('0x31')][_0x21b1('0x35')]));_0x5b9e22[_0x21b1('0x33')]=_0x5b9e22[_0x21b1('0x33')][_0x21b1('0x36')]?_0x5b9e22[_0x21b1('0x33')]:_0x3c252d[_0x21b1('0x2e')];if(!_0x3e13e4['query']['hasOwnProperty'](_0x21b1('0x37'))){_0x5b9e22['limit']=qs[_0x21b1('0x20')](_0x3e13e4[_0x21b1('0x31')][_0x21b1('0x20')]);_0x5b9e22[_0x21b1('0x1f')]=qs['offset'](_0x3e13e4[_0x21b1('0x31')]['offset']);}_0x5b9e22[_0x21b1('0x38')]=qs[_0x21b1('0x39')](_0x3e13e4['query']['sort']);_0x5b9e22['where']=qs['filters'](_[_0x21b1('0x3a')](_0x3e13e4['query'],_0x3c252d[_0x21b1('0x32')]),_0x2d7271);if(_0x3e13e4['query'][_0x21b1('0x3b')]){_0x5b9e22[_0x21b1('0x3c')]=_[_0x21b1('0x3d')](_0x5b9e22['where'],{'$or':_[_0x21b1('0x2a')](_0x2d7271,function(_0x244aa1){if(_0x244aa1[_0x21b1('0x2d')]!==_0x21b1('0x3e')){var _0x4f28b3={};_0x4f28b3[_0x244aa1['name']]={'$like':'%'+_0x3e13e4[_0x21b1('0x31')][_0x21b1('0x3b')]+'%'};return _0x4f28b3;}})});}_0x5b9e22=_[_0x21b1('0x3d')]({},_0x5b9e22,_0x3e13e4[_0x21b1('0x3f')]);var _0x6fd7d4={'where':_0x5b9e22[_0x21b1('0x3c')]};return db[_0x21b1('0x2b')][_0x21b1('0x40')](_0x6fd7d4)['then'](function(_0xadee76){_0x172c9[_0x21b1('0x40')]=_0xadee76;if(_0x3e13e4[_0x21b1('0x31')][_0x21b1('0x41')]){_0x5b9e22[_0x21b1('0x42')]=[{'all':!![]}];}return db[_0x21b1('0x2b')][_0x21b1('0x43')](_0x5b9e22);})[_0x21b1('0x25')](function(_0x1afd34){_0x172c9['rows']=_0x1afd34;return _0x172c9;})[_0x21b1('0x25')](respondWithFilteredResult(_0x21f67e,_0x5b9e22))['catch'](handleError(_0x21f67e,null));};exports[_0x21b1('0x44')]=function(_0x6a9e53,_0x246443){var _0x5905db={'raw':![],'where':{'id':_0x6a9e53[_0x21b1('0x45')]['id']}},_0x2ed78f={};_0x2ed78f['model']=_[_0x21b1('0x46')](db['ScreenRecording'][_0x21b1('0x2c')]);_0x2ed78f[_0x21b1('0x31')]=_[_0x21b1('0x46')](_0x6a9e53[_0x21b1('0x31')]);_0x2ed78f['filters']=_['intersection'](_0x2ed78f[_0x21b1('0x2e')],_0x2ed78f['query']);_0x5905db[_0x21b1('0x33')]=_[_0x21b1('0x34')](_0x2ed78f[_0x21b1('0x2e')],qs[_0x21b1('0x35')](_0x6a9e53['query'][_0x21b1('0x35')]));_0x5905db[_0x21b1('0x33')]=_0x5905db['attributes'][_0x21b1('0x36')]?_0x5905db['attributes']:_0x2ed78f[_0x21b1('0x2e')];if(_0x6a9e53[_0x21b1('0x31')][_0x21b1('0x41')]){_0x5905db[_0x21b1('0x42')]=[{'all':!![]}];}_0x5905db=_['merge']({},_0x5905db,_0x6a9e53[_0x21b1('0x3f')]);return db[_0x21b1('0x2b')][_0x21b1('0x47')](_0x5905db)[_0x21b1('0x25')](handleEntityNotFound(_0x246443,null))[_0x21b1('0x25')](respondWithResult(_0x246443,null))['catch'](handleError(_0x246443,null));};exports[_0x21b1('0x48')]=function(_0x36f6c5,_0x110032){return db[_0x21b1('0x2b')][_0x21b1('0x48')](_0x36f6c5['body'],{})[_0x21b1('0x25')](respondWithResult(_0x110032,0xc9))['catch'](handleError(_0x110032,null));};exports[_0x21b1('0x49')]=function(_0x4dfd80,_0x28f28c){if(_0x4dfd80[_0x21b1('0x4a')]['id']){delete _0x4dfd80[_0x21b1('0x4a')]['id'];}delete _0x4dfd80['body']['duration'];delete _0x4dfd80[_0x21b1('0x4a')][_0x21b1('0x4b')];delete _0x4dfd80[_0x21b1('0x4a')][_0x21b1('0x4c')];delete _0x4dfd80[_0x21b1('0x4a')][_0x21b1('0x4d')];return db['ScreenRecording'][_0x21b1('0x47')]({'where':{'id':_0x4dfd80[_0x21b1('0x45')]['id']}})['then'](handleEntityNotFound(_0x28f28c,null))[_0x21b1('0x25')](saveUpdates(_0x4dfd80[_0x21b1('0x4a')],null))[_0x21b1('0x25')](respondWithResult(_0x28f28c,null))[_0x21b1('0x4e')](handleError(_0x28f28c,null));};exports[_0x21b1('0x4f')]=function(_0x5ec93b,_0x4d64d9){return db[_0x21b1('0x2b')][_0x21b1('0x4f')]()['then'](respondWithResult(_0x4d64d9,null))['catch'](handleError(_0x4d64d9,null));};exports[_0x21b1('0x50')]=function(_0x258d07,_0x5e67e2,_0x36313c){var _0x5c1afc=require('../../components/encryptor');var _0x3e6a34=![];var _0xe70114={};if(_0x258d07[_0x21b1('0x31')]['type']&&_0x258d07[_0x21b1('0x31')][_0x21b1('0x2d')]===_0x21b1('0x51')){_0xe70114['uniqueid']=_0x258d07[_0x21b1('0x45')]['id'];}else{_0xe70114['id']=_0x258d07[_0x21b1('0x45')]['id'];}return db[_0x21b1('0x2b')][_0x21b1('0x47')]({'where':_0xe70114,'attributes':['id',_0x21b1('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x5e67e2,null))[_0x21b1('0x25')](function(_0x15cb60){if(_0x15cb60){var _0x3d5ab5=path[_0x21b1('0x52')](config[_0x21b1('0x53')],_0x21b1('0x54'),_0x15cb60[_0x21b1('0x4d')]);var _0xaf384f=util[_0x21b1('0x30')](_0x21b1('0x55'),_0x3d5ab5);if(fs[_0x21b1('0x56')](_0xaf384f)){_0x3e6a34=!![];return _0x5c1afc['decryptFile'](_0xaf384f,_0x3d5ab5,config[_0x21b1('0x57')][_0x21b1('0x58')])[_0x21b1('0x25')](function(){return _0x15cb60;});}return _0x15cb60;}})[_0x21b1('0x25')](function(_0x113810){if(_0x113810){var _0x4a2c50=path[_0x21b1('0x52')](config[_0x21b1('0x53')],_0x21b1('0x54'),_0x113810[_0x21b1('0x4d')]);if(!fs['existsSync'](_0x4a2c50)){throw new db[(_0x21b1('0x59'))][(_0x21b1('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x113810[_0x21b1('0x5b')]){return _0x5e67e2[_0x21b1('0x50')](_0x4a2c50,_0x113810[_0x21b1('0x5b')]+path[_0x21b1('0x5c')](_0x4a2c50),function(){if(_0x3e6a34){fs[_0x21b1('0x5d')](_0x4a2c50);}});}else{return _0x5e67e2[_0x21b1('0x50')](_0x4a2c50,function(_0x5c24e9){if(_0x3e6a34){fs[_0x21b1('0x5d')](_0x4a2c50);}});}}})[_0x21b1('0x4e')](function(_0x275ff0){if(_0x275ff0[_0x21b1('0x5e')]===_0x21b1('0x5f')){_0x5e67e2[_0x21b1('0x1c')](0x194)[_0x21b1('0x60')](_0x21b1('0x61'));}else{return handleError(_0x5e67e2,null);}});};exports['destroy']=function(_0x327deb,_0x49eaf5){return db[_0x21b1('0x2b')][_0x21b1('0x47')]({'where':{'id':_0x327deb[_0x21b1('0x45')]['id']}})[_0x21b1('0x25')](function(_0x5ac43c){if(!_0x5ac43c)throw new ReferenceError(_0x21b1('0x62'));return _0x5ac43c;})[_0x21b1('0x25')](function(_0x52d7c3){var _0x5db40f=path[_0x21b1('0x52')](config[_0x21b1('0x53')],_0x21b1('0x54'),_0x52d7c3[_0x21b1('0x4d')]);logger[_0x21b1('0x63')](_0x21b1('0x64'),_0x5db40f);if(!_['isNil'](_0x52d7c3[_0x21b1('0x4d')])&&fs[_0x21b1('0x56')](_0x5db40f)){logger[_0x21b1('0x63')](_0x21b1('0x65')+_0x5db40f+_0x21b1('0x66'));fs[_0x21b1('0x67')](_0x5db40f);}_0x5db40f=_0x5db40f+'.cypher';if(!_[_0x21b1('0x68')](_0x52d7c3[_0x21b1('0x4d')])&&fs[_0x21b1('0x56')](_0x5db40f)){logger[_0x21b1('0x63')]('File:\x20\x22'+_0x5db40f+_0x21b1('0x66'));fs[_0x21b1('0x67')](_0x5db40f);}return _0x52d7c3;})['then'](function(_0x487edf){if(!_0x487edf)throw new InternalError();return _0x487edf[_0x21b1('0x26')]();})[_0x21b1('0x25')](function(){_0x49eaf5[_0x21b1('0x1c')](0xcc)[_0x21b1('0x1d')]();})[_0x21b1('0x4e')](handleError(_0x49eaf5,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 8b66ed2..4ca8bbf 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 _0xb03e=['bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment'];(function(_0x7d1b89,_0x58faa5){var _0x435a5b=function(_0x358473){while(--_0x358473){_0x7d1b89['push'](_0x7d1b89['shift']());}};_0x435a5b(++_0x58faa5);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1e2334,_0x2967e5){_0x1e2334=_0x1e2334-0x0;var _0x465420=_0xb03e[_0x1e2334];return _0x465420;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[{'name':_0xeb03('0xe'),'fields':[_0xeb03('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x312f=['../../config/logger','api','moment','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x49e0e5,_0x1f1f6b){var _0x249c90=function(_0x2851ea){while(--_0x2851ea){_0x49e0e5['push'](_0x49e0e5['shift']());}};_0x249c90(++_0x1f1f6b);}(_0x312f,0x1ab));var _0xf312=function(_0x102b3c,_0xbdb3f9){_0x102b3c=_0x102b3c-0x0;var _0x5590cf=_0x312f[_0x102b3c];return _0x5590cf;};'use strict';var _=require(_0xf312('0x0'));var util=require(_0xf312('0x1'));var logger=require(_0xf312('0x2'))(_0xf312('0x3'));var moment=require(_0xf312('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf312('0x5'));var rimraf=require('rimraf');var config=require(_0xf312('0x6'));var attributes=require(_0xf312('0x7'));module[_0xf312('0x8')]=function(_0x389196,_0x16fc8f){return _0x389196[_0xf312('0x9')](_0xf312('0xa'),attributes,{'tableName':_0xf312('0xb'),'paranoid':![],'indexes':[{'name':_0xf312('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index b35be4b..092adf7 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(_0x80f018,_0x2aab0c){var _0x4e113a=function(_0x1999ab){while(--_0x1999ab){_0x80f018['push'](_0x80f018['shift']());}};_0x4e113a(++_0x2aab0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xc93818,_0xd7f145){var _0x3c6999=function(_0x3bd7ea){while(--_0x3bd7ea){_0xc93818['push'](_0xc93818['shift']());}};_0x3c6999(++_0xd7f145);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 5c093e9..da61296 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 _0xf549=['post','/:id/logo','single','file','addLogo','diskStorage','join','root','server/files/images/logos/','logologin','addLogoLogin','preferred','extname','addPreferred','favicon','addFavicon','/:id','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','format','%s%s','originalname'];(function(_0x4f53dc,_0x297f6a){var _0x1e8e9b=function(_0x337c3b){while(--_0x337c3b){_0x4f53dc['push'](_0x4f53dc['shift']());}};_0x1e8e9b(++_0x297f6a);}(_0xf549,0x1cf));var _0x9f54=function(_0xe1dbe4,_0x470e9d){_0xe1dbe4=_0xe1dbe4-0x0;var _0x547d48=_0xf549[_0xe1dbe4];return _0x547d48;};'use strict';var multer=require('multer');var util=require(_0x9f54('0x0'));var path=require(_0x9f54('0x1'));var timeout=require(_0x9f54('0x2'));var express=require(_0x9f54('0x3'));var router=express[_0x9f54('0x4')]();var auth=require(_0x9f54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f54('0x6'));var controller=require(_0x9f54('0x7'));router[_0x9f54('0x8')]('/',auth[_0x9f54('0x9')](),controller[_0x9f54('0xa')]);router['get']('/:id',controller['show']);router[_0x9f54('0x8')]('/:id/logo',controller['getLogo']);router[_0x9f54('0x8')](_0x9f54('0xb'),controller[_0x9f54('0xc')]);router[_0x9f54('0x8')](_0x9f54('0xd'),controller['gdpr']);router[_0x9f54('0x8')](_0x9f54('0xe'),controller['getPreferred']);router[_0x9f54('0x8')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb0c69c,_0x3e2eda,_0x15b387){_0x15b387(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x3f7ec8,_0x5b6447,_0x18886c){_0x18886c(null,util[_0x9f54('0xf')](_0x9f54('0x10'),'logo',path['extname'](_0x5b6447[_0x9f54('0x11')])));}})});router[_0x9f54('0x12')](_0x9f54('0x13'),upload[_0x9f54('0x14')](_0x9f54('0x15')),controller[_0x9f54('0x16')]);var upload=multer({'storage':multer[_0x9f54('0x17')]({'destination':function(_0x5a2c5a,_0x156b25,_0x21814b){_0x21814b(null,path[_0x9f54('0x18')](config[_0x9f54('0x19')],_0x9f54('0x1a')));},'filename':function(_0x5f135b,_0x283399,_0x4cbe00){_0x4cbe00(null,util[_0x9f54('0xf')](_0x9f54('0x10'),_0x9f54('0x1b'),path['extname'](_0x283399['originalname'])));}})});router[_0x9f54('0x12')]('/:id/logo_login',upload[_0x9f54('0x14')]('file'),controller[_0x9f54('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19f6d4,_0xa27799,_0x515347){_0x515347(null,path[_0x9f54('0x18')](config[_0x9f54('0x19')],_0x9f54('0x1a')));},'filename':function(_0x10ffd6,_0x1616ad,_0x3b35d3){_0x3b35d3(null,util[_0x9f54('0xf')]('%s%s',_0x9f54('0x1d'),path[_0x9f54('0x1e')](_0x1616ad[_0x9f54('0x11')])));}})});router[_0x9f54('0x12')](_0x9f54('0xe'),upload[_0x9f54('0x14')](_0x9f54('0x15')),controller[_0x9f54('0x1f')]);var upload=multer({'storage':multer[_0x9f54('0x17')]({'destination':function(_0x3043c8,_0x59502d,_0x4cc62e){_0x4cc62e(null,path[_0x9f54('0x18')](config[_0x9f54('0x19')],'server/files/images/logos/'));},'filename':function(_0x13ec03,_0x15e8c2,_0x37277d){_0x37277d(null,util['format'](_0x9f54('0x10'),_0x9f54('0x20'),path[_0x9f54('0x1e')](_0x15e8c2[_0x9f54('0x11')])));}})});router['post']('/:id/favicon',upload[_0x9f54('0x14')](_0x9f54('0x15')),controller[_0x9f54('0x21')]);router['put'](_0x9f54('0x22'),auth[_0x9f54('0x9')](),controller[_0x9f54('0x23')]);module[_0x9f54('0x24')]=router; \ No newline at end of file +var _0x4c07=['/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','post','single','file','addLogo','logologin','originalname','addLogoLogin','%s%s','preferred','favicon','/:id/favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/:id','show','/:id/logo','getLogo'];(function(_0x51fe5e,_0x4fa23d){var _0xd4f5a9=function(_0x24e971){while(--_0x24e971){_0x51fe5e['push'](_0x51fe5e['shift']());}};_0xd4f5a9(++_0x4fa23d);}(_0x4c07,0xfd));var _0x74c0=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x4c07[_0x4defd6];return _0x4c9276;};'use strict';var multer=require(_0x74c0('0x0'));var util=require(_0x74c0('0x1'));var path=require(_0x74c0('0x2'));var timeout=require(_0x74c0('0x3'));var express=require(_0x74c0('0x4'));var router=express[_0x74c0('0x5')]();var auth=require(_0x74c0('0x6'));var interaction=require(_0x74c0('0x7'));var config=require(_0x74c0('0x8'));var controller=require(_0x74c0('0x9'));router['get']('/',auth[_0x74c0('0xa')](),controller[_0x74c0('0xb')]);router[_0x74c0('0xc')](_0x74c0('0xd'),controller[_0x74c0('0xe')]);router[_0x74c0('0xc')](_0x74c0('0xf'),controller[_0x74c0('0x10')]);router[_0x74c0('0xc')](_0x74c0('0x11'),controller[_0x74c0('0x12')]);router['get'](_0x74c0('0x13'),controller['gdpr']);router['get'](_0x74c0('0x14'),controller[_0x74c0('0x15')]);router[_0x74c0('0xc')]('/:id/favicon',controller[_0x74c0('0x16')]);var upload=multer({'storage':multer[_0x74c0('0x17')]({'destination':function(_0x4f9764,_0x4e0966,_0x3d92ba){_0x3d92ba(null,path[_0x74c0('0x18')](config[_0x74c0('0x19')],_0x74c0('0x1a')));},'filename':function(_0x2085d8,_0xa652a0,_0x282bf5){_0x282bf5(null,util[_0x74c0('0x1b')]('%s%s',_0x74c0('0x1c'),path[_0x74c0('0x1d')](_0xa652a0['originalname'])));}})});router[_0x74c0('0x1e')](_0x74c0('0xf'),upload[_0x74c0('0x1f')](_0x74c0('0x20')),controller[_0x74c0('0x21')]);var upload=multer({'storage':multer[_0x74c0('0x17')]({'destination':function(_0x56ed1f,_0x50ea65,_0x438921){_0x438921(null,path[_0x74c0('0x18')](config[_0x74c0('0x19')],_0x74c0('0x1a')));},'filename':function(_0x226579,_0x4c33d2,_0x5a2b31){_0x5a2b31(null,util[_0x74c0('0x1b')]('%s%s',_0x74c0('0x22'),path['extname'](_0x4c33d2[_0x74c0('0x23')])));}})});router['post'](_0x74c0('0x11'),upload['single'](_0x74c0('0x20')),controller[_0x74c0('0x24')]);var upload=multer({'storage':multer[_0x74c0('0x17')]({'destination':function(_0x2fa66a,_0x54a833,_0x1a6364){_0x1a6364(null,path[_0x74c0('0x18')](config[_0x74c0('0x19')],_0x74c0('0x1a')));},'filename':function(_0x440fa5,_0x2fb569,_0x5dd264){_0x5dd264(null,util['format'](_0x74c0('0x25'),_0x74c0('0x26'),path[_0x74c0('0x1d')](_0x2fb569[_0x74c0('0x23')])));}})});router[_0x74c0('0x1e')]('/:id/preferred',upload[_0x74c0('0x1f')](_0x74c0('0x20')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c4620,_0x7d50bc,_0x1e5d14){_0x1e5d14(null,path['join'](config[_0x74c0('0x19')],_0x74c0('0x1a')));},'filename':function(_0x4050a0,_0x4072c4,_0xfc1256){_0xfc1256(null,util['format'](_0x74c0('0x25'),_0x74c0('0x27'),path['extname'](_0x4072c4[_0x74c0('0x23')])));}})});router[_0x74c0('0x1e')](_0x74c0('0x28'),upload['single'](_0x74c0('0x20')),controller[_0x74c0('0x29')]);router[_0x74c0('0x2a')](_0x74c0('0xd'),auth[_0x74c0('0xa')](),controller[_0x74c0('0x2b')]);module[_0x74c0('0x2c')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 1fad84b..5557819 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 _0xe415=['INTEGER','min_mailbox','STRING','BOOLEAN','sequelize','exports','min_internal'];(function(_0x53b1ab,_0x10af71){var _0x778622=function(_0x21a727){while(--_0x21a727){_0x53b1ab['push'](_0x53b1ab['shift']());}};_0x778622(++_0x10af71);}(_0xe415,0x107));var _0x5e41=function(_0x30b768,_0x5ea605){_0x30b768=_0x30b768-0x0;var _0x53cba3=_0xe415[_0x30b768];return _0x53cba3;};'use strict';var Sequelize=require(_0x5e41('0x0'));module[_0x5e41('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x5e41('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5e41('0x3')](0xb),'unique':_0x5e41('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x5e41('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5e41('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x5e41('0x5')]},'defaultLogo':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5e41('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5e41('0x5')]},'turnaddr':{'type':Sequelize[_0x5e41('0x5')]},'turnusername':{'type':Sequelize[_0x5e41('0x5')]},'turnpassword':{'type':Sequelize[_0x5e41('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5e41('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5e41('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5e41('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5e41('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5e41('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5e41('0x3')]},'transcribeRegion':{'type':Sequelize[_0x5e41('0x5')]},'sentiment':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5e41('0x3')]},'sentimentRegion':{'type':Sequelize[_0x5e41('0x5')]},'language':{'type':Sequelize[_0x5e41('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x5e41('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x3981=['exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize'];(function(_0x1e8842,_0x3f0d98){var _0x4be9f6=function(_0x3f9a21){while(--_0x3f9a21){_0x1e8842['push'](_0x1e8842['shift']());}};_0x4be9f6(++_0x3f0d98);}(_0x3981,0x19d));var _0x1398=function(_0x428f33,_0x3abba4){_0x428f33=_0x428f33-0x0;var _0x786c6b=_0x3981[_0x428f33];return _0x786c6b;};'use strict';var Sequelize=require(_0x1398('0x0'));module[_0x1398('0x1')]={'min_internal':{'type':Sequelize[_0x1398('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x1398('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1398('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1398('0x4')],'defaultValue':_0x1398('0x5')},'logo':{'type':Sequelize[_0x1398('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1398('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1398('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1398('0x4')]},'turnaddr':{'type':Sequelize[_0x1398('0x4')]},'turnusername':{'type':Sequelize[_0x1398('0x4')]},'turnpassword':{'type':Sequelize[_0x1398('0x4')]},'pageTitle':{'type':Sequelize[_0x1398('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1398('0x4')],'defaultValue':_0x1398('0x7')},'enableEmailPreview':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1398('0x4')],'defaultValue':_0x1398('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1398('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1398('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1398('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1398('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1398('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1398('0x2')]},'transcribeRegion':{'type':Sequelize[_0x1398('0x4')]},'sentiment':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1398('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1398('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1398('0x4')]},'bucket':{'type':Sequelize[_0x1398('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 487636f..1118214 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 _0x9b78=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','params','rawAttributes','include','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','default_loginLogo.svg','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','sendStatus','status','json','count','offset','limit','apply','reject','update','end','name','send','index','map','Setting','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x436728,_0x23fa62){var _0x30927e=function(_0x18c40e){while(--_0x18c40e){_0x436728['push'](_0x436728['shift']());}};_0x30927e(++_0x23fa62);}(_0x9b78,0x179));var _0x89b7=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x9b78[_0x503950];return _0x1657a9;};'use strict';var pdf=require(_0x89b7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x89b7('0x1'));var zipdir=require(_0x89b7('0x2'));var jsonpatch=require(_0x89b7('0x3'));var rp=require(_0x89b7('0x4'));var moment=require(_0x89b7('0x5'));var BPromise=require(_0x89b7('0x6'));var Mustache=require(_0x89b7('0x7'));var util=require(_0x89b7('0x8'));var path=require(_0x89b7('0x9'));var sox=require(_0x89b7('0xa'));var csv=require(_0x89b7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x89b7('0xc'));var squel=require(_0x89b7('0xd'));var crypto=require(_0x89b7('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x89b7('0xb'));var querystring=require(_0x89b7('0xf'));var Papa=require(_0x89b7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x89b7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x89b7('0x12'))(_0x89b7('0x13'));var utils=require('../../config/utils');var config=require(_0x89b7('0x14'));var db=require(_0x89b7('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x89b7('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x5c44f6,_0xa85289,_0xa27027){if(_0xa27027){var _0x2a9703=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a9703['test'](_0xa85289)){return _0x5c44f6;}else{throw new db['Sequelize'][(_0x89b7('0x17'))](_0x89b7('0x18'));}}else{return _0x5c44f6;}}function respondWithRpcPromise(_0x281dd3,_0x636abf,_0x136003,_0x343d70){return new BPromise(function(_0x1e9873,_0x15e2bf){var _0x1b1582=_0x343d70||client;return _0x1b1582[_0x89b7('0x19')](_0x281dd3,_0x136003)[_0x89b7('0x1a')](function(_0x45ec0e){logger[_0x89b7('0x1b')](_0x89b7('0x1c'),_0x636abf,_0x89b7('0x1d'));logger[_0x89b7('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x636abf,_0x89b7('0x1d'),JSON['stringify'](_0x45ec0e));if(_0x45ec0e[_0x89b7('0x1f')]){if(_0x45ec0e[_0x89b7('0x1f')][_0x89b7('0x20')]===0x1f4){logger[_0x89b7('0x1f')](_0x89b7('0x1c'),_0x636abf,_0x45ec0e['error']['message']);return _0x15e2bf(_0x45ec0e['error'][_0x89b7('0x21')]);}logger['error'](_0x89b7('0x1c'),_0x636abf,_0x45ec0e[_0x89b7('0x1f')][_0x89b7('0x21')]);return _0x1e9873(_0x45ec0e[_0x89b7('0x1f')]['message']);}else{logger[_0x89b7('0x1b')]('Setting,\x20%s,\x20%s',_0x636abf,_0x89b7('0x1d'));_0x1e9873(_0x45ec0e['result'][_0x89b7('0x21')]);}})['catch'](function(_0x54fd6f){logger[_0x89b7('0x1f')]('Setting,\x20%s,\x20%s',_0x636abf,_0x54fd6f);_0x15e2bf(_0x54fd6f);});});}function respondWithStatusCode(_0xc40e69,_0x138aa2){_0x138aa2=_0x138aa2||0xcc;return function(_0x4a38a5){if(_0x4a38a5){return _0xc40e69[_0x89b7('0x22')](_0x138aa2);}return _0xc40e69[_0x89b7('0x23')](_0x138aa2)['end']();};}function respondWithResult(_0x296a17,_0x4074bb){_0x4074bb=_0x4074bb||0xc8;return function(_0x477f14){if(_0x477f14){return _0x296a17['status'](_0x4074bb)[_0x89b7('0x24')](_0x477f14);}};}function respondWithFilteredResult(_0x23c7ba,_0xb98a96){return function(_0x1d163f){if(_0x1d163f){var _0x1d3fa5=_0x1d163f[_0x89b7('0x25')],_0x2b1fa4=_0xb98a96[_0x89b7('0x26')],_0x35cad9=_0xb98a96[_0x89b7('0x26')]+_0xb98a96[_0x89b7('0x27')],_0x51d6d5;if(_0x35cad9>=_0x1d3fa5){_0x35cad9=_0x1d3fa5;_0x51d6d5=0xc8;}else{_0x51d6d5=0xce;}_0x23c7ba[_0x89b7('0x23')](_0x51d6d5);return _0x23c7ba['set']('Content-Range',_0x2b1fa4+'-'+_0x35cad9+'/'+_0x1d3fa5)[_0x89b7('0x24')](_0x1d163f);}return null;};}function patchUpdates(_0x2d5415){return function(_0x58ce8b){try{jsonpatch[_0x89b7('0x28')](_0x58ce8b,_0x2d5415,!![]);}catch(_0xa422d7){return BPromise[_0x89b7('0x29')](_0xa422d7);}return _0x58ce8b['save']();};}function saveUpdates(_0xc7521b,_0x1d4f43){return function(_0x37049a){if(_0x37049a){return _0x37049a[_0x89b7('0x2a')](_0xc7521b)[_0x89b7('0x1a')](function(_0x1e221e){return _0x1e221e;});}return null;};}function removeEntity(_0x2d7e3c,_0x5909d9){return function(_0x227a6f){if(_0x227a6f){return _0x227a6f['destroy']()[_0x89b7('0x1a')](function(){_0x2d7e3c[_0x89b7('0x23')](0xcc)[_0x89b7('0x2b')]();});}};}function handleEntityNotFound(_0x355133,_0x4a9d46){return function(_0xb2c076){if(!_0xb2c076){_0x355133[_0x89b7('0x22')](0x194);}return _0xb2c076;};}function handleError(_0xf0f5d7,_0xca073a){_0xca073a=_0xca073a||0x1f4;return function(_0x3dd6ca){logger[_0x89b7('0x1f')](_0x3dd6ca['stack']);if(_0x3dd6ca[_0x89b7('0x2c')]){delete _0x3dd6ca[_0x89b7('0x2c')];}_0xf0f5d7[_0x89b7('0x23')](_0xca073a)[_0x89b7('0x2d')](_0x3dd6ca);};}exports[_0x89b7('0x2e')]=function(_0x21f32f,_0x3c9159){var _0x4f5136={},_0x4172fa={},_0x369d0f={'count':0x0,'rows':[]};var _0x5f4fe5=_[_0x89b7('0x2f')](db[_0x89b7('0x30')]['rawAttributes'],function(_0xe14254){return{'name':_0xe14254['fieldName'],'type':_0xe14254['type'][_0x89b7('0x31')]};});_0x4172fa[_0x89b7('0x32')]=_[_0x89b7('0x2f')](_0x5f4fe5,_0x89b7('0x2c'));_0x4172fa[_0x89b7('0x33')]=_[_0x89b7('0x34')](_0x21f32f['query']);_0x4172fa[_0x89b7('0x35')]=_[_0x89b7('0x36')](_0x4172fa[_0x89b7('0x32')],_0x4172fa['query']);_0x4f5136[_0x89b7('0x37')]=_['intersection'](_0x4172fa[_0x89b7('0x32')],qs[_0x89b7('0x38')](_0x21f32f['query']['fields']));_0x4f5136[_0x89b7('0x37')]=_0x4f5136[_0x89b7('0x37')][_0x89b7('0x39')]?_0x4f5136[_0x89b7('0x37')]:_0x4172fa[_0x89b7('0x32')];if(!_0x21f32f[_0x89b7('0x33')][_0x89b7('0x3a')](_0x89b7('0x3b'))){_0x4f5136[_0x89b7('0x27')]=qs[_0x89b7('0x27')](_0x21f32f[_0x89b7('0x33')][_0x89b7('0x27')]);_0x4f5136[_0x89b7('0x26')]=qs['offset'](_0x21f32f[_0x89b7('0x33')][_0x89b7('0x26')]);}_0x4f5136[_0x89b7('0x3c')]=qs[_0x89b7('0x3d')](_0x21f32f[_0x89b7('0x33')][_0x89b7('0x3d')]);_0x4f5136[_0x89b7('0x3e')]=qs[_0x89b7('0x35')](_['pick'](_0x21f32f[_0x89b7('0x33')],_0x4172fa['filters']),_0x5f4fe5);if(_0x21f32f[_0x89b7('0x33')][_0x89b7('0x3f')]){_0x4f5136[_0x89b7('0x3e')]=_[_0x89b7('0x40')](_0x4f5136['where'],{'$or':_[_0x89b7('0x2f')](_0x5f4fe5,function(_0x52bac2){if(_0x52bac2['type']!==_0x89b7('0x41')){var _0x57c1b4={};_0x57c1b4[_0x52bac2[_0x89b7('0x2c')]]={'$like':'%'+_0x21f32f[_0x89b7('0x33')]['filter']+'%'};return _0x57c1b4;}})});}_0x4f5136=_['merge']({},_0x4f5136,_0x21f32f[_0x89b7('0x42')]);var _0x592f20={'where':_0x4f5136['where']};return db[_0x89b7('0x30')][_0x89b7('0x25')](_0x592f20)[_0x89b7('0x1a')](function(_0x5b40fc){_0x369d0f[_0x89b7('0x25')]=_0x5b40fc;if(_0x21f32f['query']['includeAll']){_0x4f5136['include']=[{'all':!![]}];}return db[_0x89b7('0x30')]['findAll'](_0x4f5136);})[_0x89b7('0x1a')](function(_0x53bd5a){_0x369d0f[_0x89b7('0x43')]=_0x53bd5a;return _0x369d0f;})[_0x89b7('0x1a')](respondWithFilteredResult(_0x3c9159,_0x4f5136))[_0x89b7('0x44')](handleError(_0x3c9159,null));};exports[_0x89b7('0x45')]=function(_0xb25496,_0x4d6d75){var _0x10e359={'raw':![],'where':{'id':_0xb25496[_0x89b7('0x46')]['id']}},_0x5d3224={};_0x5d3224[_0x89b7('0x32')]=_[_0x89b7('0x34')](db[_0x89b7('0x30')][_0x89b7('0x47')]);_0x5d3224[_0x89b7('0x33')]=_['keys'](_0xb25496[_0x89b7('0x33')]);_0x5d3224[_0x89b7('0x35')]=_[_0x89b7('0x36')](_0x5d3224[_0x89b7('0x32')],_0x5d3224[_0x89b7('0x33')]);_0x10e359[_0x89b7('0x37')]=_[_0x89b7('0x36')](_0x5d3224[_0x89b7('0x32')],qs['fields'](_0xb25496[_0x89b7('0x33')]['fields']));_0x10e359[_0x89b7('0x37')]=_0x10e359[_0x89b7('0x37')][_0x89b7('0x39')]?_0x10e359['attributes']:_0x5d3224[_0x89b7('0x32')];if(_0xb25496[_0x89b7('0x33')]['includeAll']){_0x10e359[_0x89b7('0x48')]=[{'all':!![]}];}_0x10e359=_['merge']({},_0x10e359,_0xb25496[_0x89b7('0x42')]);return db['Setting'][_0x89b7('0x49')](_0x10e359)[_0x89b7('0x1a')](handleEntityNotFound(_0x4d6d75,null))[_0x89b7('0x1a')](respondWithResult(_0x4d6d75,null))[_0x89b7('0x44')](handleError(_0x4d6d75,null));};exports['update']=function(_0x5e67d7,_0x203eb9){if(_0x5e67d7[_0x89b7('0x4a')]['id']){delete _0x5e67d7[_0x89b7('0x4a')]['id'];}return db[_0x89b7('0x30')]['find']({'where':{'id':_0x5e67d7['params']['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0x203eb9,null))[_0x89b7('0x1a')](saveUpdates(_0x5e67d7[_0x89b7('0x4a')],null))[_0x89b7('0x1a')](respondWithResult(_0x203eb9,null))['catch'](handleError(_0x203eb9,null));};exports[_0x89b7('0x4b')]=function(_0x4ae136,_0x3b1b80,_0xc1017){if(_0x4ae136['file']&&_0x4ae136[_0x89b7('0x4c')][_0x89b7('0x4d')]){_0x4ae136[_0x89b7('0x4a')][_0x89b7('0x4e')]=_0x4ae136[_0x89b7('0x4c')][_0x89b7('0x4d')];}return db['Setting']['find']({'where':{'id':_0x4ae136[_0x89b7('0x46')]['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0x3b1b80,null))['then'](saveUpdates(_0x4ae136[_0x89b7('0x4a')],null))['then'](respondWithResult(_0x3b1b80,null))[_0x89b7('0x44')](handleError(_0x3b1b80,null));};exports[_0x89b7('0x4f')]=function(_0x37bd4f,_0x6dff9b,_0x33e0c3){if(_0x37bd4f[_0x89b7('0x4c')]&&_0x37bd4f[_0x89b7('0x4c')][_0x89b7('0x4d')]){_0x37bd4f[_0x89b7('0x4a')][_0x89b7('0x50')]=_0x37bd4f['file']['filename'];}return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0x37bd4f['params']['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0x6dff9b,null))[_0x89b7('0x1a')](saveUpdates(_0x37bd4f[_0x89b7('0x4a')],null))[_0x89b7('0x1a')](respondWithResult(_0x6dff9b,null))[_0x89b7('0x44')](handleError(_0x6dff9b,null));};var utilLicense=require(_0x89b7('0x51'));exports[_0x89b7('0x52')]=function(_0x46d865,_0x21bd0b,_0x49cb5b){var _0x3c53a7=_0x89b7('0x53');var _0x1fc123={'custom':![]};return utilLicense[_0x89b7('0x54')]()['then'](function(_0x1659a5){if(_0x1659a5){_0x1fc123=_0x1659a5;}return db['Setting'][_0x89b7('0x49')]({'where':{'id':_0x46d865[_0x89b7('0x46')]['id']},'attributes':[_0x89b7('0x4e'),_0x89b7('0x50'),_0x89b7('0x55'),_0x89b7('0x56'),_0x89b7('0x57'),_0x89b7('0x58'),_0x89b7('0x59'),_0x89b7('0x5a')],'raw':!![]});})[_0x89b7('0x1a')](handleEntityNotFound(_0x21bd0b,null))['then'](function(_0x7cebcf){if(_0x7cebcf){var _0x1b8cfc=_0x7cebcf[_0x89b7('0x4e')]&&fs[_0x89b7('0x5b')](path[_0x89b7('0x5c')](config['root'],_0x3c53a7,_[_0x89b7('0x5d')](_0x7cebcf['logo'])))?path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x3c53a7,_[_0x89b7('0x5d')](_0x7cebcf[_0x89b7('0x4e')])):path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x3c53a7,_[_0x89b7('0x5d')](_0x89b7('0x5f')));var _0x1d88f7=_0x89b7('0x60')+_[_0x89b7('0x61')](_0x89b7('0x4e'));if(_0x7cebcf[_0x1d88f7]||!_0x1fc123[_0x89b7('0x62')]){_0x1b8cfc=path['join'](config[_0x89b7('0x5e')],_0x3c53a7,_[_0x89b7('0x5d')](_0x89b7('0x5f')));}if(!fs[_0x89b7('0x5b')](_0x1b8cfc)){throw new db[(_0x89b7('0x63'))]['ValidationError'](_[_0x89b7('0x61')](_0x89b7('0x4e'))+_0x89b7('0x64'));}return _0x21bd0b[_0x89b7('0x65')](_0x1b8cfc);}})['catch'](handleError(_0x21bd0b,null));};var utilLicense=require(_0x89b7('0x51'));exports['getLogoLogin']=function(_0x32f608,_0x3c91e7,_0x570051){var _0x221bda='server/files/images/logos';var _0x453696={'custom':![]};return utilLicense[_0x89b7('0x54')]()[_0x89b7('0x1a')](function(_0x332833){if(_0x332833){_0x453696=_0x332833;}return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0x32f608[_0x89b7('0x46')]['id']},'attributes':['logo',_0x89b7('0x50'),_0x89b7('0x55'),_0x89b7('0x56'),'defaultLogo',_0x89b7('0x58'),'defaultPreferred',_0x89b7('0x5a')],'raw':!![]});})[_0x89b7('0x1a')](handleEntityNotFound(_0x3c91e7,null))[_0x89b7('0x1a')](function(_0xb885a6){if(_0xb885a6){var _0x3c898f=_0xb885a6[_0x89b7('0x50')]&&fs[_0x89b7('0x5b')](path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x221bda,_[_0x89b7('0x5d')](_0xb885a6[_0x89b7('0x50')])))?path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x221bda,_[_0x89b7('0x5d')](_0xb885a6['loginLogo'])):path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x221bda,_['toLower'](_0x89b7('0x66')));var _0x24f8df=_0x89b7('0x60')+_['upperFirst'](_0x89b7('0x50'));if(_0xb885a6[_0x24f8df]||!_0x453696[_0x89b7('0x62')]){_0x3c898f=path[_0x89b7('0x5c')](config['root'],_0x221bda,_[_0x89b7('0x5d')](_0x89b7('0x66')));}if(!fs[_0x89b7('0x5b')](_0x3c898f)){throw new db[(_0x89b7('0x63'))][(_0x89b7('0x17'))](_[_0x89b7('0x61')]('loginLogo')+_0x89b7('0x64'));}return _0x3c91e7[_0x89b7('0x65')](_0x3c898f);}})[_0x89b7('0x44')](handleError(_0x3c91e7,null));};exports[_0x89b7('0x67')]=function(_0xbaf847,_0x198cc5){return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0xbaf847[_0x89b7('0x46')]['id']},'attributes':[_0x89b7('0x68')]})['then'](respondWithResult(_0x198cc5,null))[_0x89b7('0x44')](handleError(_0x198cc5,null));};exports['addPreferred']=function(_0x2eb1ee,_0xca1c80,_0x43c185){if(_0x2eb1ee[_0x89b7('0x4c')]&&_0x2eb1ee['file']['filename']){_0x2eb1ee['body'][_0x89b7('0x55')]=_0x2eb1ee[_0x89b7('0x4c')]['filename'];}return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0x2eb1ee[_0x89b7('0x46')]['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0xca1c80,null))[_0x89b7('0x1a')](saveUpdates(_0x2eb1ee['body'],null))['then'](respondWithResult(_0xca1c80,null))['catch'](handleError(_0xca1c80,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x176b64,_0x4e5cb6,_0x17de67){var _0x9816e0=_0x89b7('0x53');var _0x346ac7={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2247c3){if(_0x2247c3){_0x346ac7=_0x2247c3;}return db[_0x89b7('0x30')]['find']({'where':{'id':_0x176b64[_0x89b7('0x46')]['id']},'attributes':[_0x89b7('0x4e'),_0x89b7('0x50'),_0x89b7('0x55'),_0x89b7('0x56'),_0x89b7('0x57'),_0x89b7('0x58'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x4e5cb6,null))['then'](function(_0x3873da){if(_0x3873da){var _0x413e60=_0x3873da[_0x89b7('0x55')]&&fs[_0x89b7('0x5b')](path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x9816e0,_[_0x89b7('0x5d')](_0x3873da[_0x89b7('0x55')])))?path[_0x89b7('0x5c')](config['root'],_0x9816e0,_['toLower'](_0x3873da['preferred'])):path['join'](config[_0x89b7('0x5e')],_0x9816e0,_[_0x89b7('0x5d')](_0x89b7('0x69')));var _0xf5e650=_0x89b7('0x60')+_[_0x89b7('0x61')](_0x89b7('0x55'));if(_0x3873da[_0xf5e650]||!_0x346ac7[_0x89b7('0x62')]||!_0x346ac7[_0x89b7('0x55')]){_0x413e60=path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x9816e0,_[_0x89b7('0x5d')](_0x89b7('0x69')));}if(!fs[_0x89b7('0x5b')](_0x413e60)){throw new db[(_0x89b7('0x63'))][(_0x89b7('0x17'))](_['upperFirst']('preferred')+_0x89b7('0x64'));}return _0x4e5cb6[_0x89b7('0x65')](_0x413e60);}})['catch'](handleError(_0x4e5cb6,null));};exports[_0x89b7('0x6a')]=function(_0x5091c5,_0x384e85,_0x536c8e){if(_0x5091c5['file']&&_0x5091c5['file']['filename']){_0x5091c5['body'][_0x89b7('0x56')]=_0x5091c5['file']['filename'];}return db[_0x89b7('0x30')][_0x89b7('0x49')]({'where':{'id':_0x5091c5[_0x89b7('0x46')]['id']}})[_0x89b7('0x1a')](handleEntityNotFound(_0x384e85,null))[_0x89b7('0x1a')](saveUpdates(_0x5091c5['body'],null))[_0x89b7('0x1a')](respondWithResult(_0x384e85,null))[_0x89b7('0x44')](handleError(_0x384e85,null));};var utilLicense=require(_0x89b7('0x51'));exports[_0x89b7('0x6b')]=function(_0x34b93b,_0x1bf0a2,_0x553163){var _0x16d10b=_0x89b7('0x53');var _0x3c6485={'custom':![]};return utilLicense[_0x89b7('0x54')]()[_0x89b7('0x1a')](function(_0xdd936b){if(_0xdd936b){_0x3c6485=_0xdd936b;}return db[_0x89b7('0x30')]['find']({'where':{'id':_0x34b93b[_0x89b7('0x46')]['id']},'attributes':[_0x89b7('0x4e'),'loginLogo',_0x89b7('0x55'),_0x89b7('0x56'),_0x89b7('0x57'),_0x89b7('0x58'),_0x89b7('0x59'),_0x89b7('0x5a')],'raw':!![]});})[_0x89b7('0x1a')](handleEntityNotFound(_0x1bf0a2,null))[_0x89b7('0x1a')](function(_0x20a8b9){if(_0x20a8b9){var _0x367020=_0x20a8b9[_0x89b7('0x56')]&&fs[_0x89b7('0x5b')](path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x16d10b,_[_0x89b7('0x5d')](_0x20a8b9['favicon'])))?path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x16d10b,_[_0x89b7('0x5d')](_0x20a8b9['favicon'])):path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x16d10b,_['toLower'](_0x89b7('0x6c')));var _0x40c40c=_0x89b7('0x60')+_[_0x89b7('0x61')](_0x89b7('0x56'));if(_0x20a8b9[_0x40c40c]||!_0x3c6485[_0x89b7('0x62')]){_0x367020=path[_0x89b7('0x5c')](config[_0x89b7('0x5e')],_0x16d10b,_[_0x89b7('0x5d')](_0x89b7('0x6c')));}if(!fs[_0x89b7('0x5b')](_0x367020)){throw new db['Sequelize'][(_0x89b7('0x17'))](_[_0x89b7('0x61')](_0x89b7('0x56'))+_0x89b7('0x64'));}return _0x1bf0a2[_0x89b7('0x65')](_0x367020);}})[_0x89b7('0x44')](handleError(_0x1bf0a2,null));}; \ No newline at end of file +var _0x48b0=['request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','map','merge','options','Setting','count','includeAll','include','findAll','rows','show','params','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','default','upperFirst','custom','default_logo.svg','Sequelize','\x20not\x20found','download','getLogoLogin','server/files/images/logos','favicon','toLower','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','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','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x44f2b8,_0x25309b){var _0x2e0726=function(_0x2b925f){while(--_0x2b925f){_0x44f2b8['push'](_0x44f2b8['shift']());}};_0x2e0726(++_0x25309b);}(_0x48b0,0x1cc));var _0x048b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48b0[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x048b('0x0'));var emlformat=require(_0x048b('0x1'));var rimraf=require(_0x048b('0x2'));var zipdir=require(_0x048b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x048b('0x4'));var BPromise=require(_0x048b('0x5'));var Mustache=require(_0x048b('0x6'));var util=require(_0x048b('0x7'));var path=require(_0x048b('0x8'));var sox=require(_0x048b('0x9'));var csv=require(_0x048b('0xa'));var ejs=require(_0x048b('0xb'));var fs=require('fs');var _=require(_0x048b('0xc'));var squel=require(_0x048b('0xd'));var crypto=require(_0x048b('0xe'));var jsforce=require(_0x048b('0xf'));var deskjs=require(_0x048b('0x10'));var toCsv=require(_0x048b('0xa'));var querystring=require(_0x048b('0x11'));var Papa=require(_0x048b('0x12'));var Redis=require(_0x048b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x048b('0x14'));var as=require(_0x048b('0x15'));var hardwareService=require(_0x048b('0x16'));var logger=require('../../config/logger')(_0x048b('0x17'));var utils=require('../../config/utils');var config=require(_0x048b('0x18'));var db=require(_0x048b('0x19'))['db'];var jayson=require(_0x048b('0x1a'));var client=jayson[_0x048b('0x1b')][_0x048b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x9a12fb,_0x596f1a,_0x4a2036){if(_0x4a2036){var _0x2a3956=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a3956[_0x048b('0x1d')](_0x596f1a)){return _0x9a12fb;}else{throw new db['Sequelize'][(_0x048b('0x1e'))](_0x048b('0x1f'));}}else{return _0x9a12fb;}}function respondWithRpcPromise(_0x4701c2,_0x1d96f1,_0x3f5632,_0x5e724a){return new BPromise(function(_0x20989e,_0x3e02e0){var _0x45ef81=_0x5e724a||client;return _0x45ef81[_0x048b('0x20')](_0x4701c2,_0x3f5632)[_0x048b('0x21')](function(_0x44d54c){logger['info'](_0x048b('0x22'),_0x1d96f1,_0x048b('0x23'));logger[_0x048b('0x24')](_0x048b('0x25'),_0x1d96f1,_0x048b('0x23'),JSON[_0x048b('0x26')](_0x44d54c));if(_0x44d54c['error']){if(_0x44d54c[_0x048b('0x27')][_0x048b('0x28')]===0x1f4){logger[_0x048b('0x27')](_0x048b('0x22'),_0x1d96f1,_0x44d54c['error'][_0x048b('0x29')]);return _0x3e02e0(_0x44d54c[_0x048b('0x27')][_0x048b('0x29')]);}logger['error']('Setting,\x20%s,\x20%s',_0x1d96f1,_0x44d54c[_0x048b('0x27')]['message']);return _0x20989e(_0x44d54c['error']['message']);}else{logger[_0x048b('0x2a')](_0x048b('0x22'),_0x1d96f1,_0x048b('0x23'));_0x20989e(_0x44d54c[_0x048b('0x2b')][_0x048b('0x29')]);}})[_0x048b('0x2c')](function(_0x50a037){logger[_0x048b('0x27')]('Setting,\x20%s,\x20%s',_0x1d96f1,_0x50a037);_0x3e02e0(_0x50a037);});});}function respondWithStatusCode(_0x422bc8,_0x39115d){_0x39115d=_0x39115d||0xcc;return function(_0x57bfc7){if(_0x57bfc7){return _0x422bc8[_0x048b('0x2d')](_0x39115d);}return _0x422bc8['status'](_0x39115d)['end']();};}function respondWithResult(_0x205049,_0x56d0f5){_0x56d0f5=_0x56d0f5||0xc8;return function(_0x23ee32){if(_0x23ee32){return _0x205049[_0x048b('0x2e')](_0x56d0f5)[_0x048b('0x2f')](_0x23ee32);}};}function respondWithFilteredResult(_0x4b9654,_0x465022){return function(_0x4cf1d3){if(_0x4cf1d3){var _0x10ce0b=_0x4cf1d3['count'],_0x31f020=_0x465022[_0x048b('0x30')],_0x1f830f=_0x465022[_0x048b('0x30')]+_0x465022[_0x048b('0x31')],_0x34e143;if(_0x1f830f>=_0x10ce0b){_0x1f830f=_0x10ce0b;_0x34e143=0xc8;}else{_0x34e143=0xce;}_0x4b9654[_0x048b('0x2e')](_0x34e143);return _0x4b9654['set'](_0x048b('0x32'),_0x31f020+'-'+_0x1f830f+'/'+_0x10ce0b)[_0x048b('0x2f')](_0x4cf1d3);}return null;};}function patchUpdates(_0x5e7517){return function(_0x21c529){try{jsonpatch[_0x048b('0x33')](_0x21c529,_0x5e7517,!![]);}catch(_0x3c386d){return BPromise[_0x048b('0x34')](_0x3c386d);}return _0x21c529[_0x048b('0x35')]();};}function saveUpdates(_0x526c9f,_0x4cf887){return function(_0x1b975b){if(_0x1b975b){return _0x1b975b[_0x048b('0x36')](_0x526c9f)[_0x048b('0x21')](function(_0xfdd99e){return _0xfdd99e;});}return null;};}function removeEntity(_0x740b1d,_0x289f56){return function(_0x534833){if(_0x534833){return _0x534833[_0x048b('0x37')]()['then'](function(){_0x740b1d[_0x048b('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ac4b,_0x4f17fa){return function(_0x188821){if(!_0x188821){_0x12ac4b[_0x048b('0x2d')](0x194);}return _0x188821;};}function handleError(_0x37f991,_0x1eba90){_0x1eba90=_0x1eba90||0x1f4;return function(_0x2d7074){logger[_0x048b('0x27')](_0x2d7074[_0x048b('0x38')]);if(_0x2d7074[_0x048b('0x39')]){delete _0x2d7074['name'];}_0x37f991[_0x048b('0x2e')](_0x1eba90)[_0x048b('0x3a')](_0x2d7074);};}exports['index']=function(_0x5dd465,_0x6564a5){var _0x4704f9={},_0x5790a7={},_0x3321eb={'count':0x0,'rows':[]};var _0x26d622=_['map'](db['Setting'][_0x048b('0x3b')],function(_0x13bac5){return{'name':_0x13bac5['fieldName'],'type':_0x13bac5[_0x048b('0x3c')][_0x048b('0x3d')]};});_0x5790a7[_0x048b('0x3e')]=_['map'](_0x26d622,_0x048b('0x39'));_0x5790a7[_0x048b('0x3f')]=_[_0x048b('0x40')](_0x5dd465[_0x048b('0x3f')]);_0x5790a7[_0x048b('0x41')]=_[_0x048b('0x42')](_0x5790a7['model'],_0x5790a7[_0x048b('0x3f')]);_0x4704f9[_0x048b('0x43')]=_[_0x048b('0x42')](_0x5790a7[_0x048b('0x3e')],qs[_0x048b('0x44')](_0x5dd465[_0x048b('0x3f')][_0x048b('0x44')]));_0x4704f9['attributes']=_0x4704f9['attributes'][_0x048b('0x45')]?_0x4704f9[_0x048b('0x43')]:_0x5790a7['model'];if(!_0x5dd465[_0x048b('0x3f')][_0x048b('0x46')]('nolimit')){_0x4704f9['limit']=qs[_0x048b('0x31')](_0x5dd465[_0x048b('0x3f')][_0x048b('0x31')]);_0x4704f9[_0x048b('0x30')]=qs['offset'](_0x5dd465['query'][_0x048b('0x30')]);}_0x4704f9['order']=qs[_0x048b('0x47')](_0x5dd465[_0x048b('0x3f')][_0x048b('0x47')]);_0x4704f9[_0x048b('0x48')]=qs['filters'](_[_0x048b('0x49')](_0x5dd465[_0x048b('0x3f')],_0x5790a7['filters']),_0x26d622);if(_0x5dd465[_0x048b('0x3f')][_0x048b('0x4a')]){_0x4704f9['where']=_['merge'](_0x4704f9[_0x048b('0x48')],{'$or':_[_0x048b('0x4b')](_0x26d622,function(_0x29f675){if(_0x29f675[_0x048b('0x3c')]!=='VIRTUAL'){var _0x24edce={};_0x24edce[_0x29f675[_0x048b('0x39')]]={'$like':'%'+_0x5dd465['query'][_0x048b('0x4a')]+'%'};return _0x24edce;}})});}_0x4704f9=_[_0x048b('0x4c')]({},_0x4704f9,_0x5dd465[_0x048b('0x4d')]);var _0x227904={'where':_0x4704f9[_0x048b('0x48')]};return db[_0x048b('0x4e')][_0x048b('0x4f')](_0x227904)[_0x048b('0x21')](function(_0x1ce394){_0x3321eb[_0x048b('0x4f')]=_0x1ce394;if(_0x5dd465['query'][_0x048b('0x50')]){_0x4704f9[_0x048b('0x51')]=[{'all':!![]}];}return db[_0x048b('0x4e')][_0x048b('0x52')](_0x4704f9);})[_0x048b('0x21')](function(_0x1a2801){_0x3321eb[_0x048b('0x53')]=_0x1a2801;return _0x3321eb;})[_0x048b('0x21')](respondWithFilteredResult(_0x6564a5,_0x4704f9))['catch'](handleError(_0x6564a5,null));};exports[_0x048b('0x54')]=function(_0x9aab1a,_0x3a5b47){var _0x1c29a6={'raw':![],'where':{'id':_0x9aab1a[_0x048b('0x55')]['id']}},_0x4f6504={};_0x4f6504[_0x048b('0x3e')]=_[_0x048b('0x40')](db[_0x048b('0x4e')][_0x048b('0x3b')]);_0x4f6504[_0x048b('0x3f')]=_[_0x048b('0x40')](_0x9aab1a[_0x048b('0x3f')]);_0x4f6504[_0x048b('0x41')]=_[_0x048b('0x42')](_0x4f6504[_0x048b('0x3e')],_0x4f6504['query']);_0x1c29a6[_0x048b('0x43')]=_[_0x048b('0x42')](_0x4f6504['model'],qs[_0x048b('0x44')](_0x9aab1a['query'][_0x048b('0x44')]));_0x1c29a6[_0x048b('0x43')]=_0x1c29a6[_0x048b('0x43')][_0x048b('0x45')]?_0x1c29a6[_0x048b('0x43')]:_0x4f6504[_0x048b('0x3e')];if(_0x9aab1a['query'][_0x048b('0x50')]){_0x1c29a6[_0x048b('0x51')]=[{'all':!![]}];}_0x1c29a6=_['merge']({},_0x1c29a6,_0x9aab1a[_0x048b('0x4d')]);return db['Setting'][_0x048b('0x56')](_0x1c29a6)['then'](handleEntityNotFound(_0x3a5b47,null))['then'](respondWithResult(_0x3a5b47,null))[_0x048b('0x2c')](handleError(_0x3a5b47,null));};exports[_0x048b('0x36')]=function(_0x158639,_0x3dd699){if(_0x158639['body']['id']){delete _0x158639[_0x048b('0x57')]['id'];}return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0x158639[_0x048b('0x55')]['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x3dd699,null))[_0x048b('0x21')](saveUpdates(_0x158639['body'],null))[_0x048b('0x21')](respondWithResult(_0x3dd699,null))[_0x048b('0x2c')](handleError(_0x3dd699,null));};exports[_0x048b('0x58')]=function(_0x39f8f6,_0x2e6f0c,_0x583c50){if(_0x39f8f6[_0x048b('0x59')]&&_0x39f8f6['file'][_0x048b('0x5a')]){_0x39f8f6[_0x048b('0x57')][_0x048b('0x5b')]=_0x39f8f6['file']['filename'];}return db['Setting'][_0x048b('0x56')]({'where':{'id':_0x39f8f6[_0x048b('0x55')]['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x2e6f0c,null))['then'](saveUpdates(_0x39f8f6[_0x048b('0x57')],null))[_0x048b('0x21')](respondWithResult(_0x2e6f0c,null))[_0x048b('0x2c')](handleError(_0x2e6f0c,null));};exports[_0x048b('0x5c')]=function(_0x716046,_0x36c8dc,_0x3315c9){if(_0x716046[_0x048b('0x59')]&&_0x716046[_0x048b('0x59')][_0x048b('0x5a')]){_0x716046[_0x048b('0x57')][_0x048b('0x5d')]=_0x716046[_0x048b('0x59')][_0x048b('0x5a')];}return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0x716046[_0x048b('0x55')]['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x36c8dc,null))[_0x048b('0x21')](saveUpdates(_0x716046['body'],null))[_0x048b('0x21')](respondWithResult(_0x36c8dc,null))[_0x048b('0x2c')](handleError(_0x36c8dc,null));};var utilLicense=require(_0x048b('0x5e'));exports['getLogo']=function(_0xc0eb90,_0x4bcd06,_0x275d89){var _0x8b6e2d='server/files/images/logos';var _0x183b6c={'custom':![]};return utilLicense[_0x048b('0x5f')]()[_0x048b('0x21')](function(_0x5763bc){if(_0x5763bc){_0x183b6c=_0x5763bc;}return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0xc0eb90[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x5b'),_0x048b('0x5d'),_0x048b('0x60'),'favicon',_0x048b('0x61'),_0x048b('0x62'),_0x048b('0x63'),_0x048b('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x4bcd06,null))[_0x048b('0x21')](function(_0x4cae59){if(_0x4cae59){var _0x2ff223=_0x4cae59[_0x048b('0x5b')]&&fs[_0x048b('0x65')](path[_0x048b('0x66')](config['root'],_0x8b6e2d,_['toLower'](_0x4cae59[_0x048b('0x5b')])))?path[_0x048b('0x66')](config[_0x048b('0x67')],_0x8b6e2d,_['toLower'](_0x4cae59[_0x048b('0x5b')])):path['join'](config['root'],_0x8b6e2d,_['toLower']('default_logo.svg'));var _0x6357a3=_0x048b('0x68')+_[_0x048b('0x69')]('logo');if(_0x4cae59[_0x6357a3]||!_0x183b6c[_0x048b('0x6a')]){_0x2ff223=path[_0x048b('0x66')](config[_0x048b('0x67')],_0x8b6e2d,_['toLower'](_0x048b('0x6b')));}if(!fs[_0x048b('0x65')](_0x2ff223)){throw new db[(_0x048b('0x6c'))]['ValidationError'](_[_0x048b('0x69')](_0x048b('0x5b'))+_0x048b('0x6d'));}return _0x4bcd06[_0x048b('0x6e')](_0x2ff223);}})['catch'](handleError(_0x4bcd06,null));};var utilLicense=require(_0x048b('0x5e'));exports[_0x048b('0x6f')]=function(_0x575c90,_0x467094,_0x308766){var _0x7dbc8f=_0x048b('0x70');var _0x19e508={'custom':![]};return utilLicense[_0x048b('0x5f')]()[_0x048b('0x21')](function(_0x56582a){if(_0x56582a){_0x19e508=_0x56582a;}return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0x575c90[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x5b'),'loginLogo',_0x048b('0x60'),_0x048b('0x71'),_0x048b('0x61'),'defaultLoginLogo',_0x048b('0x63'),_0x048b('0x64')],'raw':!![]});})[_0x048b('0x21')](handleEntityNotFound(_0x467094,null))[_0x048b('0x21')](function(_0x20308d){if(_0x20308d){var _0xbece4f=_0x20308d[_0x048b('0x5d')]&&fs['existsSync'](path['join'](config[_0x048b('0x67')],_0x7dbc8f,_[_0x048b('0x72')](_0x20308d['loginLogo'])))?path['join'](config['root'],_0x7dbc8f,_[_0x048b('0x72')](_0x20308d[_0x048b('0x5d')])):path['join'](config[_0x048b('0x67')],_0x7dbc8f,_[_0x048b('0x72')](_0x048b('0x73')));var _0x4c2066=_0x048b('0x68')+_[_0x048b('0x69')](_0x048b('0x5d'));if(_0x20308d[_0x4c2066]||!_0x19e508['custom']){_0xbece4f=path['join'](config[_0x048b('0x67')],_0x7dbc8f,_[_0x048b('0x72')](_0x048b('0x73')));}if(!fs[_0x048b('0x65')](_0xbece4f)){throw new db[(_0x048b('0x6c'))][(_0x048b('0x1e'))](_[_0x048b('0x69')](_0x048b('0x5d'))+_0x048b('0x6d'));}return _0x467094[_0x048b('0x6e')](_0xbece4f);}})[_0x048b('0x2c')](handleError(_0x467094,null));};exports[_0x048b('0x74')]=function(_0x138488,_0x99f462){return db[_0x048b('0x4e')][_0x048b('0x56')]({'where':{'id':_0x138488[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x75')]})[_0x048b('0x21')](respondWithResult(_0x99f462,null))[_0x048b('0x2c')](handleError(_0x99f462,null));};exports[_0x048b('0x76')]=function(_0xff09c8,_0x23c3ac,_0x25f1d2){if(_0xff09c8[_0x048b('0x59')]&&_0xff09c8[_0x048b('0x59')][_0x048b('0x5a')]){_0xff09c8[_0x048b('0x57')][_0x048b('0x60')]=_0xff09c8[_0x048b('0x59')]['filename'];}return db['Setting'][_0x048b('0x56')]({'where':{'id':_0xff09c8[_0x048b('0x55')]['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x23c3ac,null))[_0x048b('0x21')](saveUpdates(_0xff09c8[_0x048b('0x57')],null))[_0x048b('0x21')](respondWithResult(_0x23c3ac,null))[_0x048b('0x2c')](handleError(_0x23c3ac,null));};var utilLicense=require(_0x048b('0x5e'));exports[_0x048b('0x77')]=function(_0x5bb710,_0x40f1bb,_0x53d689){var _0x3de724=_0x048b('0x70');var _0x20727f={'custom':![]};return utilLicense[_0x048b('0x5f')]()[_0x048b('0x21')](function(_0x26dd4d){if(_0x26dd4d){_0x20727f=_0x26dd4d;}return db['Setting']['find']({'where':{'id':_0x5bb710[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x5b'),'loginLogo',_0x048b('0x60'),'favicon',_0x048b('0x61'),_0x048b('0x62'),_0x048b('0x63'),_0x048b('0x64')],'raw':!![]});})[_0x048b('0x21')](handleEntityNotFound(_0x40f1bb,null))[_0x048b('0x21')](function(_0x186977){if(_0x186977){var _0x45c8bc=_0x186977['preferred']&&fs[_0x048b('0x65')](path[_0x048b('0x66')](config['root'],_0x3de724,_['toLower'](_0x186977[_0x048b('0x60')])))?path[_0x048b('0x66')](config[_0x048b('0x67')],_0x3de724,_[_0x048b('0x72')](_0x186977[_0x048b('0x60')])):path[_0x048b('0x66')](config[_0x048b('0x67')],_0x3de724,_['toLower'](_0x048b('0x78')));var _0xd1f375=_0x048b('0x68')+_[_0x048b('0x69')](_0x048b('0x60'));if(_0x186977[_0xd1f375]||!_0x20727f[_0x048b('0x6a')]||!_0x20727f[_0x048b('0x60')]){_0x45c8bc=path['join'](config[_0x048b('0x67')],_0x3de724,_[_0x048b('0x72')](_0x048b('0x78')));}if(!fs[_0x048b('0x65')](_0x45c8bc)){throw new db[(_0x048b('0x6c'))][(_0x048b('0x1e'))](_[_0x048b('0x69')]('preferred')+_0x048b('0x6d'));}return _0x40f1bb[_0x048b('0x6e')](_0x45c8bc);}})[_0x048b('0x2c')](handleError(_0x40f1bb,null));};exports[_0x048b('0x79')]=function(_0x4e1cb5,_0x40623b,_0x51ede8){if(_0x4e1cb5[_0x048b('0x59')]&&_0x4e1cb5[_0x048b('0x59')]['filename']){_0x4e1cb5[_0x048b('0x57')][_0x048b('0x71')]=_0x4e1cb5[_0x048b('0x59')][_0x048b('0x5a')];}return db['Setting'][_0x048b('0x56')]({'where':{'id':_0x4e1cb5['params']['id']}})[_0x048b('0x21')](handleEntityNotFound(_0x40623b,null))['then'](saveUpdates(_0x4e1cb5[_0x048b('0x57')],null))[_0x048b('0x21')](respondWithResult(_0x40623b,null))[_0x048b('0x2c')](handleError(_0x40623b,null));};var utilLicense=require(_0x048b('0x5e'));exports['getFavicon']=function(_0x4d931e,_0x2261d2,_0x31b908){var _0x29e0dd='server/files/images/logos';var _0x22e4c5={'custom':![]};return utilLicense['getLicense']()[_0x048b('0x21')](function(_0x4b4977){if(_0x4b4977){_0x22e4c5=_0x4b4977;}return db['Setting']['find']({'where':{'id':_0x4d931e[_0x048b('0x55')]['id']},'attributes':[_0x048b('0x5b'),_0x048b('0x5d'),_0x048b('0x60'),'favicon',_0x048b('0x61'),_0x048b('0x62'),_0x048b('0x63'),_0x048b('0x64')],'raw':!![]});})[_0x048b('0x21')](handleEntityNotFound(_0x2261d2,null))[_0x048b('0x21')](function(_0x23a7a5){if(_0x23a7a5){var _0xcb1c80=_0x23a7a5[_0x048b('0x71')]&&fs[_0x048b('0x65')](path[_0x048b('0x66')](config[_0x048b('0x67')],_0x29e0dd,_[_0x048b('0x72')](_0x23a7a5[_0x048b('0x71')])))?path[_0x048b('0x66')](config[_0x048b('0x67')],_0x29e0dd,_[_0x048b('0x72')](_0x23a7a5[_0x048b('0x71')])):path['join'](config['root'],_0x29e0dd,_[_0x048b('0x72')](_0x048b('0x7a')));var _0x33b8b6='default'+_['upperFirst'](_0x048b('0x71'));if(_0x23a7a5[_0x33b8b6]||!_0x22e4c5[_0x048b('0x6a')]){_0xcb1c80=path[_0x048b('0x66')](config['root'],_0x29e0dd,_[_0x048b('0x72')](_0x048b('0x7a')));}if(!fs['existsSync'](_0xcb1c80)){throw new db['Sequelize'][(_0x048b('0x1e'))](_[_0x048b('0x69')](_0x048b('0x71'))+_0x048b('0x6d'));}return _0x2261d2[_0x048b('0x6e')](_0xcb1c80);}})[_0x048b('0x2c')](handleError(_0x2261d2,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8d5c0b2..cd96b28 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 _0xff2b=['exports','settings','api','moment','bluebird','rimraf','../../config/environment','./setting.attributes'];(function(_0x3434d7,_0x4d4eb0){var _0x51eebd=function(_0x37161c){while(--_0x37161c){_0x3434d7['push'](_0x3434d7['shift']());}};_0x51eebd(++_0x4d4eb0);}(_0xff2b,0x112));var _0xbff2=function(_0x43d42c,_0x463065){_0x43d42c=_0x43d42c-0x0;var _0x30bee9=_0xff2b[_0x43d42c];return _0x30bee9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbff2('0x0'));var moment=require(_0xbff2('0x1'));var BPromise=require(_0xbff2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbff2('0x3'));var config=require(_0xbff2('0x4'));var attributes=require(_0xbff2('0x5'));module[_0xbff2('0x6')]=function(_0x347259,_0x384c0b){return _0x347259['define']('Setting',attributes,{'tableName':_0xbff2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc71b=['settings','../../config/logger','bluebird','rimraf','../../config/environment','./setting.attributes','exports','define'];(function(_0x192b6c,_0x8f1c71){var _0x330017=function(_0x1d4d74){while(--_0x1d4d74){_0x192b6c['push'](_0x192b6c['shift']());}};_0x330017(++_0x8f1c71);}(_0xc71b,0x99));var _0xbc71=function(_0x5e987b,_0x3cd745){_0x5e987b=_0x5e987b-0x0;var _0x5ebaaf=_0xc71b[_0x5e987b];return _0x5ebaaf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbc71('0x0'))('api');var moment=require('moment');var BPromise=require(_0xbc71('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc71('0x2'));var config=require(_0xbc71('0x3'));var attributes=require(_0xbc71('0x4'));module[_0xbc71('0x5')]=function(_0x8269a6,_0x476ac0){return _0x8269a6[_0xbc71('0x6')]('Setting',attributes,{'tableName':_0xbc71('0x7'),'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 7f5b776..601e818 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 _0xadd1=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s'];(function(_0x22d7bb,_0x4c158e){var _0x40a737=function(_0xd85bab){while(--_0xd85bab){_0x22d7bb['push'](_0x22d7bb['shift']());}};_0x40a737(++_0x4c158e);}(_0xadd1,0x1e5));var _0x1add=function(_0x330a89,_0xa76f3e){_0x330a89=_0x330a89-0x0;var _0x5c45ca=_0xadd1[_0x330a89];return _0x5c45ca;};'use strict';var _=require(_0x1add('0x0'));var util=require('util');var moment=require(_0x1add('0x1'));var BPromise=require(_0x1add('0x2'));var rs=require(_0x1add('0x3'));var fs=require('fs');var Redis=require(_0x1add('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1add('0x5'));var logger=require(_0x1add('0x6'))('rpc');var config=require(_0x1add('0x7'));var jayson=require(_0x1add('0x8'));var client=jayson[_0x1add('0x9')][_0x1add('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa76400,_0x3a07bd,_0x407174){return new BPromise(function(_0x1db71c,_0x1aded1){return client[_0x1add('0xb')](_0xa76400,_0x407174)[_0x1add('0xc')](function(_0x3899a8){logger[_0x1add('0xd')]('Setting,\x20%s,\x20%s',_0x3a07bd,_0x1add('0xe'));logger[_0x1add('0xf')](_0x1add('0x10'),_0x3a07bd,_0x1add('0xe'),JSON[_0x1add('0x11')](_0x3899a8));if(_0x3899a8[_0x1add('0x12')]){if(_0x3899a8[_0x1add('0x12')][_0x1add('0x13')]===0x1f4){logger['error'](_0x1add('0x14'),_0x3a07bd,_0x3899a8[_0x1add('0x12')]['message']);return _0x1aded1(_0x3899a8[_0x1add('0x12')][_0x1add('0x15')]);}logger[_0x1add('0x12')](_0x1add('0x14'),_0x3a07bd,_0x3899a8['error']['message']);return _0x1db71c(_0x3899a8[_0x1add('0x12')][_0x1add('0x15')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x3a07bd,_0x1add('0xe'));_0x1db71c(_0x3899a8['result']['message']);}})[_0x1add('0x16')](function(_0x14d27){logger[_0x1add('0x12')](_0x1add('0x14'),_0x3a07bd,_0x14d27);_0x1aded1(_0x14d27);});});} \ No newline at end of file +var _0x3f77=['client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x841dd6,_0x32cb31){var _0x3dcdbf=function(_0x2d39fe){while(--_0x2d39fe){_0x841dd6['push'](_0x841dd6['shift']());}};_0x3dcdbf(++_0x32cb31);}(_0x3f77,0xaf));var _0x73f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f77[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73f7('0x0'));var BPromise=require(_0x73f7('0x1'));var rs=require(_0x73f7('0x2'));var fs=require('fs');var Redis=require(_0x73f7('0x3'));var db=require(_0x73f7('0x4'))['db'];var utils=require(_0x73f7('0x5'));var logger=require(_0x73f7('0x6'))('rpc');var config=require(_0x73f7('0x7'));var jayson=require(_0x73f7('0x8'));var client=jayson[_0x73f7('0x9')][_0x73f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x167b80,_0x3f115a,_0x1e3318){return new BPromise(function(_0x166414,_0x1feb7c){return client[_0x73f7('0xb')](_0x167b80,_0x1e3318)['then'](function(_0x344c75){logger[_0x73f7('0xc')](_0x73f7('0xd'),_0x3f115a,_0x73f7('0xe'));logger[_0x73f7('0xf')](_0x73f7('0x10'),_0x3f115a,'request\x20sent',JSON[_0x73f7('0x11')](_0x344c75));if(_0x344c75[_0x73f7('0x12')]){if(_0x344c75['error'][_0x73f7('0x13')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x3f115a,_0x344c75['error'][_0x73f7('0x14')]);return _0x1feb7c(_0x344c75['error'][_0x73f7('0x14')]);}logger[_0x73f7('0x12')](_0x73f7('0xd'),_0x3f115a,_0x344c75['error'][_0x73f7('0x14')]);return _0x166414(_0x344c75[_0x73f7('0x12')][_0x73f7('0x14')]);}else{logger[_0x73f7('0xc')]('Setting,\x20%s,\x20%s',_0x3f115a,_0x73f7('0xe'));_0x166414(_0x344c75[_0x73f7('0x15')][_0x73f7('0x14')]);}})[_0x73f7('0x16')](function(_0xc30dcb){logger['error'](_0x73f7('0xd'),_0x3f115a,_0xc30dcb);_0x1feb7c(_0xc30dcb);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index f1374e4..c83a281 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 _0x2b34=['status','addAgents','/:id','update','delete','/:id/canned_answers','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','addApplications','/:id/send','send'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x2b34,0x81));var _0x42b3=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0x2b34[_0x644560];return _0x41b76b;};'use strict';var multer=require('multer');var util=require(_0x42b3('0x0'));var path=require(_0x42b3('0x1'));var timeout=require(_0x42b3('0x2'));var express=require(_0x42b3('0x3'));var router=express[_0x42b3('0x4')]();var auth=require(_0x42b3('0x5'));var interaction=require(_0x42b3('0x6'));var config=require(_0x42b3('0x7'));var controller=require(_0x42b3('0x8'));router[_0x42b3('0x9')]('/',auth[_0x42b3('0xa')](),controller['index']);router[_0x42b3('0x9')](_0x42b3('0xb'),auth[_0x42b3('0xa')](),controller[_0x42b3('0xc')]);router[_0x42b3('0x9')]('/:id',auth[_0x42b3('0xa')](),controller[_0x42b3('0xd')]);router[_0x42b3('0x9')](_0x42b3('0xe'),auth[_0x42b3('0xa')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x42b3('0xf'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x10')]);router[_0x42b3('0x9')](_0x42b3('0x11'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x12')]);router[_0x42b3('0x9')](_0x42b3('0x13'),controller[_0x42b3('0x14')]);router[_0x42b3('0x9')](_0x42b3('0x15'),auth['isAuthenticated'](),controller[_0x42b3('0x16')]);router[_0x42b3('0x17')]('/',auth[_0x42b3('0xa')](),controller[_0x42b3('0x18')]);router['post'](_0x42b3('0xe'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x19')]);router[_0x42b3('0x17')]('/:id/canned_answers',auth[_0x42b3('0xa')](),controller[_0x42b3('0x1a')]);router[_0x42b3('0x17')](_0x42b3('0x1b'),controller['notify']);router[_0x42b3('0x17')](_0x42b3('0xf'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x1c')]);router[_0x42b3('0x17')](_0x42b3('0x1d'),auth['isAuthenticated'](),controller[_0x42b3('0x1e')]);router[_0x42b3('0x17')](_0x42b3('0x13'),controller[_0x42b3('0x1f')]);router[_0x42b3('0x17')](_0x42b3('0x15'),auth['isAuthenticated'](),controller[_0x42b3('0x20')]);router['put'](_0x42b3('0x21'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x22')]);router[_0x42b3('0x23')]('/:id',auth[_0x42b3('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x42b3('0x23')](_0x42b3('0x24'),auth[_0x42b3('0xa')](),controller[_0x42b3('0x25')]);router[_0x42b3('0x23')](_0x42b3('0x15'),auth['isAuthenticated'](),controller[_0x42b3('0x26')]);module[_0x42b3('0x27')]=router; \ No newline at end of file +var _0x828a=['delete','removeAnswers','removeAgents','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','post','/:id/notify','notify','/:id/send','status','addAgents','put','update'];(function(_0x532086,_0x2195d7){var _0x407586=function(_0x154ec5){while(--_0x154ec5){_0x532086['push'](_0x532086['shift']());}};_0x407586(++_0x2195d7);}(_0x828a,0x8f));var _0xa828=function(_0x836a5,_0x1a520f){_0x836a5=_0x836a5-0x0;var _0x6d25d4=_0x828a[_0x836a5];return _0x6d25d4;};'use strict';var multer=require(_0xa828('0x0'));var util=require('util');var path=require(_0xa828('0x1'));var timeout=require(_0xa828('0x2'));var express=require('express');var router=express[_0xa828('0x3')]();var auth=require(_0xa828('0x4'));var interaction=require(_0xa828('0x5'));var config=require(_0xa828('0x6'));var controller=require(_0xa828('0x7'));router[_0xa828('0x8')]('/',auth['isAuthenticated'](),controller[_0xa828('0x9')]);router[_0xa828('0x8')](_0xa828('0xa'),auth['isAuthenticated'](),controller[_0xa828('0xb')]);router[_0xa828('0x8')](_0xa828('0xc'),auth[_0xa828('0xd')](),controller[_0xa828('0xe')]);router[_0xa828('0x8')](_0xa828('0xf'),auth[_0xa828('0xd')](),controller['getDispositions']);router[_0xa828('0x8')](_0xa828('0x10'),auth['isAuthenticated'](),controller[_0xa828('0x11')]);router['get'](_0xa828('0x12'),auth[_0xa828('0xd')](),controller[_0xa828('0x13')]);router[_0xa828('0x8')](_0xa828('0x14'),auth[_0xa828('0xd')](),controller[_0xa828('0x15')]);router[_0xa828('0x8')](_0xa828('0x16'),controller['statusGet']);router[_0xa828('0x8')](_0xa828('0x17'),auth[_0xa828('0xd')](),controller['getAgents']);router[_0xa828('0x18')]('/',auth[_0xa828('0xd')](),controller['create']);router[_0xa828('0x18')](_0xa828('0xf'),auth[_0xa828('0xd')](),controller['addDisposition']);router[_0xa828('0x18')](_0xa828('0x10'),auth[_0xa828('0xd')](),controller['addAnswer']);router[_0xa828('0x18')](_0xa828('0x19'),controller[_0xa828('0x1a')]);router['post'](_0xa828('0x12'),auth[_0xa828('0xd')](),controller['addApplications']);router[_0xa828('0x18')](_0xa828('0x1b'),auth[_0xa828('0xd')](),controller['send']);router[_0xa828('0x18')](_0xa828('0x16'),controller[_0xa828('0x1c')]);router[_0xa828('0x18')](_0xa828('0x17'),auth[_0xa828('0xd')](),controller[_0xa828('0x1d')]);router[_0xa828('0x1e')](_0xa828('0xc'),auth[_0xa828('0xd')](),controller[_0xa828('0x1f')]);router['delete'](_0xa828('0xc'),auth[_0xa828('0xd')](),controller['destroy']);router[_0xa828('0x20')](_0xa828('0xf'),auth[_0xa828('0xd')](),controller['removeDispositions']);router[_0xa828('0x20')]('/:id/canned_answers',auth[_0xa828('0xd')](),controller[_0xa828('0x21')]);router[_0xa828('0x20')](_0xa828('0x17'),auth[_0xa828('0xd')](),controller[_0xa828('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 66674f1..6d939ca 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 _0x64ba=['name','generate','ENUM','twilio','skebby','clickatell','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x64ba,0xfd));var _0xa64b=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x64ba[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0xa64b('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa64b('0x1')],'unique':_0xa64b('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xa64b('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa64b('0x3')]();}},'phone':{'type':Sequelize[_0xa64b('0x1')]},'type':{'type':Sequelize[_0xa64b('0x4')](_0xa64b('0x5'),_0xa64b('0x6'),'connectel','clicksend','plivo',_0xa64b('0x7'),'csc','infobip',_0xa64b('0x8'))},'accountSid':{'type':Sequelize[_0xa64b('0x1')]},'authId':{'type':Sequelize[_0xa64b('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa64b('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa64b('0x1')]},'password':{'type':Sequelize[_0xa64b('0x1')]},'apiKey':{'type':Sequelize[_0xa64b('0x1')]},'senderString':{'type':Sequelize[_0xa64b('0x1')]},'deliveryReport':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![]},'description':{'type':Sequelize[_0xa64b('0x1')]},'notificationTemplate':{'type':Sequelize[_0xa64b('0xa')],'defaultValue':function(){return _0xa64b('0xb');}},'notificationSound':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa64b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa64b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa64b('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa64b('0xc')],'comment':_0xa64b('0xd')},'mandatoryDisposition':{'type':Sequelize[_0xa64b('0x9')],'defaultValue':![],'comment':_0xa64b('0xe'),'set':function(_0x1fe05e){if(!_0x1fe05e)this[_0xa64b('0xf')]('mandatoryDispositionPauseId',null);this[_0xa64b('0xf')](_0xa64b('0x10'),_0x1fe05e);}}}; \ No newline at end of file +var _0xb18c=['generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name'];(function(_0x21b2ed,_0xe06493){var _0x4033d8=function(_0x177324){while(--_0x177324){_0x21b2ed['push'](_0x21b2ed['shift']());}};_0x4033d8(++_0xe06493);}(_0xb18c,0xce));var _0xcb18=function(_0x234079,_0x494a11){_0x234079=_0x234079-0x0;var _0x54130b=_0xb18c[_0x234079];return _0x54130b;};'use strict';var Sequelize=require(_0xcb18('0x0'));var rs=require(_0xcb18('0x1'));module['exports']={'name':{'type':Sequelize[_0xcb18('0x2')],'unique':_0xcb18('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xcb18('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xcb18('0x2')],'defaultValue':function(){return rs[_0xcb18('0x4')]();}},'phone':{'type':Sequelize[_0xcb18('0x2')]},'type':{'type':Sequelize[_0xcb18('0x5')](_0xcb18('0x6'),_0xcb18('0x7'),'connectel',_0xcb18('0x8'),_0xcb18('0x9'),_0xcb18('0xa'),_0xcb18('0xb'),_0xcb18('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xcb18('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xcb18('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xcb18('0x2')]},'password':{'type':Sequelize[_0xcb18('0x2')]},'apiKey':{'type':Sequelize[_0xcb18('0x2')]},'senderString':{'type':Sequelize[_0xcb18('0x2')]},'deliveryReport':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xcb18('0xe')],'defaultValue':function(){return _0xcb18('0xf');}},'notificationSound':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcb18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcb18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcb18('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xcb18('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcb18('0x10')],'comment':_0xcb18('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xcb18('0xd')],'defaultValue':![],'comment':_0xcb18('0x12'),'set':function(_0x5a6e3c){if(!_0x5a6e3c)this[_0xcb18('0x13')](_0xcb18('0x14'),null);this[_0xcb18('0x13')]('mandatoryDisposition',_0x5a6e3c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a15e1e0..1d44723 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x2c3e78,_0x57aad1){var _0xd90a41=function(_0x583eee){while(--_0x583eee){_0x2c3e78['push'](_0x2c3e78['shift']());}};_0xd90a41(++_0x57aad1);}(_0x7a54,0x106));var _0x47a5=function(_0x277c77,_0x2232f2){_0x277c77=_0x277c77-0x0;var _0x1990ef=_0x7a54[_0x277c77];return _0x1990ef;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file +var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 86f03a6..34ffa87 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 _0xdc91=['events','../../mysqldb','SmsAccount','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2c24df,_0x2e46a3){var _0x309b15=function(_0x5d525b){while(--_0x5d525b){_0x2c24df['push'](_0x2c24df['shift']());}};_0x309b15(++_0x2e46a3);}(_0xdc91,0x172));var _0x1dc9=function(_0x519a1b,_0x2ed3a1){_0x519a1b=_0x519a1b-0x0;var _0x3c4b42=_0xdc91[_0x519a1b];return _0x3c4b42;};'use strict';var EventEmitter=require(_0x1dc9('0x0'));var SmsAccount=require(_0x1dc9('0x1'))['db'][_0x1dc9('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1dc9('0x3'),'afterUpdate':_0x1dc9('0x4'),'afterDestroy':_0x1dc9('0x5')};function emitEvent(_0x862f95){return function(_0x473c46,_0x2bfa89,_0x1ddb64){SmsAccountEvents[_0x1dc9('0x6')](_0x862f95+':'+_0x473c46['id'],_0x473c46);SmsAccountEvents['emit'](_0x862f95,_0x473c46);_0x1ddb64(null);};}for(var e in events){if(events[_0x1dc9('0x7')](e)){var event=events[e];SmsAccount[_0x1dc9('0x8')](e,emitEvent(event));}}module[_0x1dc9('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xfd1d=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x321b98,_0x4c7b2b){var _0x22948f=function(_0x12ac50){while(--_0x12ac50){_0x321b98['push'](_0x321b98['shift']());}};_0x22948f(++_0x4c7b2b);}(_0xfd1d,0x177));var _0xdfd1=function(_0x3cbaf3,_0x4ec303){_0x3cbaf3=_0x3cbaf3-0x0;var _0x25daeb=_0xfd1d[_0x3cbaf3];return _0x25daeb;};'use strict';var EventEmitter=require(_0xdfd1('0x0'));var SmsAccount=require(_0xdfd1('0x1'))['db'][_0xdfd1('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdfd1('0x3')](0x0);var events={'afterCreate':_0xdfd1('0x4'),'afterUpdate':_0xdfd1('0x5'),'afterDestroy':_0xdfd1('0x6')};function emitEvent(_0x2da7c4){return function(_0x5e1286,_0x2bd5ec,_0x33ebf0){SmsAccountEvents[_0xdfd1('0x7')](_0x2da7c4+':'+_0x5e1286['id'],_0x5e1286);SmsAccountEvents[_0xdfd1('0x7')](_0x2da7c4,_0x5e1286);_0x33ebf0(null);};}for(var e in events){if(events[_0xdfd1('0x8')](e)){var event=events[e];SmsAccount[_0xdfd1('0x9')](e,emitEvent(event));}}module[_0xdfd1('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 848eb5b..b14fafa 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x47218c,_0x2d6072){var _0x4ef22d=function(_0x5ebca5){while(--_0x5ebca5){_0x47218c['push'](_0x47218c['shift']());}};_0x4ef22d(++_0x2d6072);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x295d3a,_0x156b05){var _0x40be1a=function(_0x177dae){while(--_0x177dae){_0x295d3a['push'](_0x295d3a['shift']());}};_0x40be1a(++_0x156b05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 14fb2ab..56da553 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 _0x6b1c=['register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','find','options','where','attributes','model','include','map','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket'];(function(_0x1b80d5,_0x4caee5){var _0x108e44=function(_0x37f2a4){while(--_0x37f2a4){_0x1b80d5['push'](_0x1b80d5['shift']());}};_0x108e44(++_0x4caee5);}(_0x6b1c,0x120));var _0xc6b1=function(_0x21a95e,_0x4de45e){_0x21a95e=_0x21a95e-0x0;var _0x828e72=_0x6b1c[_0x21a95e];return _0x828e72;};'use strict';var _=require(_0xc6b1('0x0'));var util=require(_0xc6b1('0x1'));var moment=require(_0xc6b1('0x2'));var BPromise=require(_0xc6b1('0x3'));var rs=require(_0xc6b1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6b1('0x5'))['db'];var utils=require(_0xc6b1('0x6'));var logger=require(_0xc6b1('0x7'))('rpc');var config=require(_0xc6b1('0x8'));var jayson=require(_0xc6b1('0x9'));var client=jayson[_0xc6b1('0xa')]['http']({'port':0x232a});config[_0xc6b1('0xb')]=_[_0xc6b1('0xc')](config[_0xc6b1('0xb')],{'host':_0xc6b1('0xd'),'port':0x18eb});var socket=require(_0xc6b1('0xe'))(new Redis(config[_0xc6b1('0xb')]));require(_0xc6b1('0xf'))[_0xc6b1('0x10')](socket);function respondWithRpcPromise(_0x2e2fab,_0x46fa88,_0xd57247){return new BPromise(function(_0xf540e8,_0x217a3a){return client[_0xc6b1('0x11')](_0x2e2fab,_0xd57247)[_0xc6b1('0x12')](function(_0x41fb54){logger[_0xc6b1('0x13')](_0xc6b1('0x14'),_0x46fa88,_0xc6b1('0x15'));logger[_0xc6b1('0x16')](_0xc6b1('0x17'),_0x46fa88,'request\x20sent',JSON['stringify'](_0x41fb54));if(_0x41fb54['error']){if(_0x41fb54[_0xc6b1('0x18')][_0xc6b1('0x19')]===0x1f4){logger['error'](_0xc6b1('0x14'),_0x46fa88,_0x41fb54[_0xc6b1('0x18')][_0xc6b1('0x1a')]);return _0x217a3a(_0x41fb54[_0xc6b1('0x18')]['message']);}logger[_0xc6b1('0x18')](_0xc6b1('0x14'),_0x46fa88,_0x41fb54['error'][_0xc6b1('0x1a')]);return _0xf540e8(_0x41fb54[_0xc6b1('0x18')][_0xc6b1('0x1a')]);}else{logger['info'](_0xc6b1('0x14'),_0x46fa88,'request\x20sent');_0xf540e8(_0x41fb54[_0xc6b1('0x1b')][_0xc6b1('0x1a')]);}})[_0xc6b1('0x1c')](function(_0x15253b){logger['error'](_0xc6b1('0x14'),_0x46fa88,_0x15253b);_0x217a3a(_0x15253b);});});}exports[_0xc6b1('0x1d')]=function(_0x33deb1){var _0x12c8d9=this;return new Promise(function(_0x12a09b,_0x2624a6){return db['SmsAccount'][_0xc6b1('0x1e')]({'raw':_0x33deb1[_0xc6b1('0x1f')]?_0x33deb1[_0xc6b1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x33deb1[_0xc6b1('0x1f')]?_0x33deb1[_0xc6b1('0x1f')][_0xc6b1('0x20')]||null:null,'attributes':_0x33deb1[_0xc6b1('0x1f')]?_0x33deb1[_0xc6b1('0x1f')][_0xc6b1('0x21')]||null:null,'include':_0x33deb1[_0xc6b1('0x1f')]?_0x33deb1[_0xc6b1('0x1f')]['include']?_['map'](_0x33deb1[_0xc6b1('0x1f')]['include'],function(_0x187f1c){return{'model':db[_0x187f1c[_0xc6b1('0x22')]],'as':_0x187f1c['as'],'attributes':_0x187f1c['attributes'],'include':_0x187f1c['include']?_['map'](_0x187f1c[_0xc6b1('0x23')],function(_0xdfaa11){return{'model':db[_0xdfaa11[_0xc6b1('0x22')]],'as':_0xdfaa11['as'],'attributes':_0xdfaa11[_0xc6b1('0x21')],'include':_0xdfaa11[_0xc6b1('0x23')]?_[_0xc6b1('0x24')](_0xdfaa11[_0xc6b1('0x23')],function(_0x5876e2){return{'model':db[_0x5876e2[_0xc6b1('0x22')]],'as':_0x5876e2['as'],'attributes':_0x5876e2['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6b1('0x12')](function(_0x4033bd){logger[_0xc6b1('0x13')](_0xc6b1('0x1d'),_0x33deb1);logger[_0xc6b1('0x16')](_0xc6b1('0x1d'),_0x33deb1,JSON[_0xc6b1('0x25')](_0x4033bd));_0x12a09b(_0x4033bd);})[_0xc6b1('0x1c')](function(_0x2870b9){logger['error'](_0xc6b1('0x1d'),_0x2870b9[_0xc6b1('0x1a')],_0x33deb1);_0x2624a6(_0x12c8d9['error'](0x1f4,_0x2870b9[_0xc6b1('0x1a')]));});});}; \ No newline at end of file +var _0x335c=['defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','model','map','stringify','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x583b50,_0x230145){var _0x4538bf=function(_0x190c9b){while(--_0x190c9b){_0x583b50['push'](_0x583b50['shift']());}};_0x4538bf(++_0x230145);}(_0x335c,0x1b0));var _0xc335=function(_0x3ca96b,_0x34a069){_0x3ca96b=_0x3ca96b-0x0;var _0x4dbfd8=_0x335c[_0x3ca96b];return _0x4dbfd8;};'use strict';var _=require(_0xc335('0x0'));var util=require(_0xc335('0x1'));var moment=require(_0xc335('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc335('0x3'))['db'];var utils=require(_0xc335('0x4'));var logger=require(_0xc335('0x5'))(_0xc335('0x6'));var config=require(_0xc335('0x7'));var jayson=require(_0xc335('0x8'));var client=jayson[_0xc335('0x9')][_0xc335('0xa')]({'port':0x232a});config[_0xc335('0xb')]=_[_0xc335('0xc')](config['redis'],{'host':_0xc335('0xd'),'port':0x18eb});var socket=require(_0xc335('0xe'))(new Redis(config[_0xc335('0xb')]));require(_0xc335('0xf'))[_0xc335('0x10')](socket);function respondWithRpcPromise(_0x500176,_0x1c0288,_0x4489c9){return new BPromise(function(_0x15dd01,_0x1b24b5){return client[_0xc335('0x11')](_0x500176,_0x4489c9)[_0xc335('0x12')](function(_0x47da61){logger[_0xc335('0x13')](_0xc335('0x14'),_0x1c0288,_0xc335('0x15'));logger[_0xc335('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1c0288,'request\x20sent',JSON['stringify'](_0x47da61));if(_0x47da61['error']){if(_0x47da61[_0xc335('0x17')][_0xc335('0x18')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x1c0288,_0x47da61['error'][_0xc335('0x19')]);return _0x1b24b5(_0x47da61[_0xc335('0x17')]['message']);}logger[_0xc335('0x17')](_0xc335('0x14'),_0x1c0288,_0x47da61['error'][_0xc335('0x19')]);return _0x15dd01(_0x47da61[_0xc335('0x17')][_0xc335('0x19')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x1c0288,_0xc335('0x15'));_0x15dd01(_0x47da61[_0xc335('0x1a')][_0xc335('0x19')]);}})[_0xc335('0x1b')](function(_0x3274ef){logger[_0xc335('0x17')](_0xc335('0x14'),_0x1c0288,_0x3274ef);_0x1b24b5(_0x3274ef);});});}exports[_0xc335('0x1c')]=function(_0x3082d7){var _0x1644a3=this;return new Promise(function(_0x21ef9d,_0x46fb54){return db[_0xc335('0x1d')]['find']({'raw':_0x3082d7['options']?_0x3082d7[_0xc335('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3082d7[_0xc335('0x1e')]?_0x3082d7['options'][_0xc335('0x1f')]||null:null,'attributes':_0x3082d7['options']?_0x3082d7['options'][_0xc335('0x20')]||null:null,'include':_0x3082d7[_0xc335('0x1e')]?_0x3082d7['options'][_0xc335('0x21')]?_['map'](_0x3082d7[_0xc335('0x1e')][_0xc335('0x21')],function(_0x216ff2){return{'model':db[_0x216ff2[_0xc335('0x22')]],'as':_0x216ff2['as'],'attributes':_0x216ff2[_0xc335('0x20')],'include':_0x216ff2[_0xc335('0x21')]?_[_0xc335('0x23')](_0x216ff2[_0xc335('0x21')],function(_0x29f813){return{'model':db[_0x29f813[_0xc335('0x22')]],'as':_0x29f813['as'],'attributes':_0x29f813['attributes'],'include':_0x29f813[_0xc335('0x21')]?_['map'](_0x29f813[_0xc335('0x21')],function(_0x48ff41){return{'model':db[_0x48ff41['model']],'as':_0x48ff41['as'],'attributes':_0x48ff41[_0xc335('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc335('0x12')](function(_0x180a62){logger[_0xc335('0x13')]('ShowSmsAccount',_0x3082d7);logger[_0xc335('0x16')](_0xc335('0x1c'),_0x3082d7,JSON[_0xc335('0x24')](_0x180a62));_0x21ef9d(_0x180a62);})['catch'](function(_0x20478e){logger[_0xc335('0x17')](_0xc335('0x1c'),_0x20478e['message'],_0x3082d7);_0x46fb54(_0x1644a3['error'](0x1f4,_0x20478e[_0xc335('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0fbedd2..a70a559 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 _0xfd11=['save','remove','update','emit','removeListener','register','smsAccount:'];(function(_0x57966,_0x4982c7){var _0x4e78ec=function(_0x17f69f){while(--_0x17f69f){_0x57966['push'](_0x57966['shift']());}};_0x4e78ec(++_0x4982c7);}(_0xfd11,0xf5));var _0x1fd1=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0xfd11[_0x26d6d9];return _0x1b4875;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x1fd1('0x0'),_0x1fd1('0x1'),_0x1fd1('0x2')];function createListener(_0x5236ef,_0x228bcc){return function(_0x1efc7a){_0x228bcc[_0x1fd1('0x3')](_0x5236ef,_0x1efc7a);};}function removeListener(_0x3fc0dd,_0x7847a8){return function(){SmsAccountEvents[_0x1fd1('0x4')](_0x3fc0dd,_0x7847a8);};}exports[_0x1fd1('0x5')]=function(_0x5300cd){for(var _0x4d0856=0x0,_0x220c30=events['length'];_0x4d0856<_0x220c30;_0x4d0856++){var _0x3dad0e=events[_0x4d0856];var _0xd6930d=createListener(_0x1fd1('0x6')+_0x3dad0e,_0x5300cd);SmsAccountEvents['on'](_0x3dad0e,_0xd6930d);}}; \ No newline at end of file +var _0xdbc7=['update','emit','removeListener','register','length','./smsAccount.events','save','remove'];(function(_0x37378d,_0x3d27ed){var _0x685c2d=function(_0x11d809){while(--_0x11d809){_0x37378d['push'](_0x37378d['shift']());}};_0x685c2d(++_0x3d27ed);}(_0xdbc7,0x1c5));var _0x7dbc=function(_0x50c492,_0x5c1e67){_0x50c492=_0x50c492-0x0;var _0x3505a8=_0xdbc7[_0x50c492];return _0x3505a8;};'use strict';var SmsAccountEvents=require(_0x7dbc('0x0'));var events=[_0x7dbc('0x1'),_0x7dbc('0x2'),_0x7dbc('0x3')];function createListener(_0xf736ff,_0x57bca2){return function(_0x42121f){_0x57bca2[_0x7dbc('0x4')](_0xf736ff,_0x42121f);};}function removeListener(_0x43f504,_0x1e0d86){return function(){SmsAccountEvents[_0x7dbc('0x5')](_0x43f504,_0x1e0d86);};}exports[_0x7dbc('0x6')]=function(_0x321f4c){for(var _0x147978=0x0,_0x22b6dd=events[_0x7dbc('0x7')];_0x147978<_0x22b6dd;_0x147978++){var _0x1f994b=events[_0x147978];var _0x23edac=createListener('smsAccount:'+_0x1f994b,_0x321f4c);SmsAccountEvents['on'](_0x1f994b,_0x23edac);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index ebb537d..373f3bf 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 _0xf65c=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','update','delete','destroy'];(function(_0x3164c3,_0x20f0cb){var _0x2f29ab=function(_0x4171cc){while(--_0x4171cc){_0x3164c3['push'](_0x3164c3['shift']());}};_0x2f29ab(++_0x20f0cb);}(_0xf65c,0x141));var _0xcf65=function(_0x2f2ff4,_0x37e54f){_0x2f2ff4=_0x2f2ff4-0x0;var _0x3fcab4=_0xf65c[_0x2f2ff4];return _0x3fcab4;};'use strict';var multer=require(_0xcf65('0x0'));var util=require(_0xcf65('0x1'));var path=require(_0xcf65('0x2'));var timeout=require(_0xcf65('0x3'));var express=require(_0xcf65('0x4'));var router=express['Router']();var auth=require(_0xcf65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcf65('0x6'));var controller=require('./smsApplication.controller');router['get']('/',auth[_0xcf65('0x7')](),controller[_0xcf65('0x8')]);router[_0xcf65('0x9')](_0xcf65('0xa'),auth[_0xcf65('0x7')](),controller[_0xcf65('0xb')]);router['post']('/',auth[_0xcf65('0x7')](),controller['create']);router['put'](_0xcf65('0xa'),auth[_0xcf65('0x7')](),controller[_0xcf65('0xc')]);router[_0xcf65('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xcf65('0xe')]);module[_0xcf65('0xf')]=router; \ No newline at end of file +var _0x86d7=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','show','create','put','/:id','update','delete','destroy'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x86d7,0x144));var _0x786d=function(_0x384c96,_0x363897){_0x384c96=_0x384c96-0x0;var _0x145217=_0x86d7[_0x384c96];return _0x145217;};'use strict';var multer=require(_0x786d('0x0'));var util=require(_0x786d('0x1'));var path=require(_0x786d('0x2'));var timeout=require(_0x786d('0x3'));var express=require(_0x786d('0x4'));var router=express[_0x786d('0x5')]();var auth=require(_0x786d('0x6'));var interaction=require(_0x786d('0x7'));var config=require('../../config/environment');var controller=require(_0x786d('0x8'));router[_0x786d('0x9')]('/',auth[_0x786d('0xa')](),controller['index']);router[_0x786d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x786d('0xb')]);router['post']('/',auth[_0x786d('0xa')](),controller[_0x786d('0xc')]);router[_0x786d('0xd')](_0x786d('0xe'),auth['isAuthenticated'](),controller[_0x786d('0xf')]);router[_0x786d('0x10')](_0x786d('0xe'),auth[_0x786d('0xa')](),controller[_0x786d('0x11')]);module[_0x786d('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 44a8036..84037d5 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 _0xc22e=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xb0ef6,_0x53cd27){var _0x30a8ff=function(_0x1df3c3){while(--_0x1df3c3){_0xb0ef6['push'](_0xb0ef6['shift']());}};_0x30a8ff(++_0x53cd27);}(_0xc22e,0x81));var _0xec22=function(_0x17f01c,_0x5be5c7){_0x17f01c=_0x17f01c-0x0;var _0x2f3559=_0xc22e[_0x17f01c];return _0x2f3559;};'use strict';var Sequelize=require(_0xec22('0x0'));module[_0xec22('0x1')]={'priority':{'type':Sequelize[_0xec22('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xec22('0x3')],'allowNull':![],'defaultValue':_0xec22('0x4')},'appdata':{'type':Sequelize[_0xec22('0x5')]()},'description':{'type':Sequelize[_0xec22('0x3')]},'interval':{'type':Sequelize[_0xec22('0x3')],'defaultValue':_0xec22('0x6')}}; \ No newline at end of file +var _0x784b=['TEXT','sequelize','exports','STRING'];(function(_0x4337b4,_0x25732b){var _0x55da4e=function(_0x24562e){while(--_0x24562e){_0x4337b4['push'](_0x4337b4['shift']());}};_0x55da4e(++_0x25732b);}(_0x784b,0x149));var _0xb784=function(_0x44671c,_0x2a7436){_0x44671c=_0x44671c-0x0;var _0x5a61bc=_0x784b[_0x44671c];return _0x5a61bc;};'use strict';var Sequelize=require(_0xb784('0x0'));module[_0xb784('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb784('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb784('0x3')]()},'description':{'type':Sequelize[_0xb784('0x2')]},'interval':{'type':Sequelize[_0xb784('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index bb08320..48b9f28 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 _0xf4f4=['request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SmsApplication','includeAll','include','findAll','rows','catch','show','params','options','find','body','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4520a4,_0x18748a){_0x4520a4=_0x4520a4-0x0;var _0x2d5a9b=_0xf4f4[_0x4520a4];return _0x2d5a9b;};'use strict';var pdf=require(_0x4f4f('0x0'));var emlformat=require(_0x4f4f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4f4f('0x2'));var jsonpatch=require(_0x4f4f('0x3'));var rp=require(_0x4f4f('0x4'));var moment=require(_0x4f4f('0x5'));var BPromise=require(_0x4f4f('0x6'));var Mustache=require('mustache');var util=require(_0x4f4f('0x7'));var path=require('path');var sox=require(_0x4f4f('0x8'));var csv=require(_0x4f4f('0x9'));var ejs=require(_0x4f4f('0xa'));var fs=require('fs');var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var db=require(_0x4f4f('0x19'))['db'];function respondWithStatusCode(_0x35ee87,_0x1b54b0){_0x1b54b0=_0x1b54b0||0xcc;return function(_0x282031){if(_0x282031){return _0x35ee87[_0x4f4f('0x1a')](_0x1b54b0);}return _0x35ee87['status'](_0x1b54b0)[_0x4f4f('0x1b')]();};}function respondWithResult(_0x5e476d,_0x216ba8){_0x216ba8=_0x216ba8||0xc8;return function(_0xe7c2d5){if(_0xe7c2d5){return _0x5e476d[_0x4f4f('0x1c')](_0x216ba8)[_0x4f4f('0x1d')](_0xe7c2d5);}};}function respondWithFilteredResult(_0x4c849f,_0x19f2fd){return function(_0x4c68f4){if(_0x4c68f4){var _0x47ab66=_0x4c68f4[_0x4f4f('0x1e')],_0x58de77=_0x19f2fd[_0x4f4f('0x1f')],_0x422894=_0x19f2fd[_0x4f4f('0x1f')]+_0x19f2fd[_0x4f4f('0x20')],_0x8d65a2;if(_0x422894>=_0x47ab66){_0x422894=_0x47ab66;_0x8d65a2=0xc8;}else{_0x8d65a2=0xce;}_0x4c849f[_0x4f4f('0x1c')](_0x8d65a2);return _0x4c849f[_0x4f4f('0x21')](_0x4f4f('0x22'),_0x58de77+'-'+_0x422894+'/'+_0x47ab66)[_0x4f4f('0x1d')](_0x4c68f4);}return null;};}function patchUpdates(_0x32b549){return function(_0x43f43b){try{jsonpatch['apply'](_0x43f43b,_0x32b549,!![]);}catch(_0x93877a){return BPromise[_0x4f4f('0x23')](_0x93877a);}return _0x43f43b[_0x4f4f('0x24')]();};}function saveUpdates(_0x201c60,_0x302a79){return function(_0x460b4d){if(_0x460b4d){return _0x460b4d[_0x4f4f('0x25')](_0x201c60)[_0x4f4f('0x26')](function(_0x28f8ef){return _0x28f8ef;});}return null;};}function removeEntity(_0x2509a8,_0x469a1d){return function(_0x17832f){if(_0x17832f){return _0x17832f[_0x4f4f('0x27')]()[_0x4f4f('0x26')](function(){_0x2509a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x525529,_0x272125){return function(_0x43e661){if(!_0x43e661){_0x525529['sendStatus'](0x194);}return _0x43e661;};}function handleError(_0x3960ae,_0x15859c){_0x15859c=_0x15859c||0x1f4;return function(_0xcf19ac){logger[_0x4f4f('0x28')](_0xcf19ac[_0x4f4f('0x29')]);if(_0xcf19ac[_0x4f4f('0x2a')]){delete _0xcf19ac[_0x4f4f('0x2a')];}_0x3960ae['status'](_0x15859c)[_0x4f4f('0x2b')](_0xcf19ac);};}exports[_0x4f4f('0x2c')]=function(_0x18e718,_0x15c79c){var _0x18e864={},_0x4ad33d={},_0x23df57={'count':0x0,'rows':[]};var _0xaf3de1=_[_0x4f4f('0x2d')](db['SmsApplication']['rawAttributes'],function(_0x4c2490){return{'name':_0x4c2490[_0x4f4f('0x2e')],'type':_0x4c2490['type'][_0x4f4f('0x2f')]};});_0x4ad33d[_0x4f4f('0x30')]=_[_0x4f4f('0x2d')](_0xaf3de1,'name');_0x4ad33d[_0x4f4f('0x31')]=_[_0x4f4f('0x32')](_0x18e718['query']);_0x4ad33d[_0x4f4f('0x33')]=_[_0x4f4f('0x34')](_0x4ad33d[_0x4f4f('0x30')],_0x4ad33d['query']);_0x18e864[_0x4f4f('0x35')]=_[_0x4f4f('0x34')](_0x4ad33d['model'],qs['fields'](_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x36')]));_0x18e864[_0x4f4f('0x35')]=_0x18e864[_0x4f4f('0x35')][_0x4f4f('0x37')]?_0x18e864[_0x4f4f('0x35')]:_0x4ad33d[_0x4f4f('0x30')];if(!_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x38')](_0x4f4f('0x39'))){_0x18e864['limit']=qs['limit'](_0x18e718[_0x4f4f('0x31')]['limit']);_0x18e864[_0x4f4f('0x1f')]=qs[_0x4f4f('0x1f')](_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x1f')]);}_0x18e864[_0x4f4f('0x3a')]=qs[_0x4f4f('0x3b')](_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x3b')]);_0x18e864[_0x4f4f('0x3c')]=qs[_0x4f4f('0x33')](_[_0x4f4f('0x3d')](_0x18e718[_0x4f4f('0x31')],_0x4ad33d['filters']),_0xaf3de1);if(_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x3e')]){_0x18e864[_0x4f4f('0x3c')]=_[_0x4f4f('0x3f')](_0x18e864[_0x4f4f('0x3c')],{'$or':_[_0x4f4f('0x2d')](_0xaf3de1,function(_0x37eef8){if(_0x37eef8[_0x4f4f('0x40')]!==_0x4f4f('0x41')){var _0x510cd3={};_0x510cd3[_0x37eef8[_0x4f4f('0x2a')]]={'$like':'%'+_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x3e')]+'%'};return _0x510cd3;}})});}_0x18e864=_['merge']({},_0x18e864,_0x18e718['options']);var _0xc2bc33={'where':_0x18e864[_0x4f4f('0x3c')]};return db[_0x4f4f('0x42')][_0x4f4f('0x1e')](_0xc2bc33)[_0x4f4f('0x26')](function(_0xd7bbf4){_0x23df57[_0x4f4f('0x1e')]=_0xd7bbf4;if(_0x18e718[_0x4f4f('0x31')][_0x4f4f('0x43')]){_0x18e864[_0x4f4f('0x44')]=[{'all':!![]}];}return db[_0x4f4f('0x42')][_0x4f4f('0x45')](_0x18e864);})['then'](function(_0x4786e0){_0x23df57[_0x4f4f('0x46')]=_0x4786e0;return _0x23df57;})[_0x4f4f('0x26')](respondWithFilteredResult(_0x15c79c,_0x18e864))[_0x4f4f('0x47')](handleError(_0x15c79c,null));};exports[_0x4f4f('0x48')]=function(_0x598d65,_0x5c06a1){var _0x134710={'raw':!![],'where':{'id':_0x598d65[_0x4f4f('0x49')]['id']}},_0xa070ad={};_0xa070ad[_0x4f4f('0x30')]=_['keys'](db[_0x4f4f('0x42')]['rawAttributes']);_0xa070ad[_0x4f4f('0x31')]=_['keys'](_0x598d65['query']);_0xa070ad[_0x4f4f('0x33')]=_['intersection'](_0xa070ad[_0x4f4f('0x30')],_0xa070ad[_0x4f4f('0x31')]);_0x134710['attributes']=_[_0x4f4f('0x34')](_0xa070ad[_0x4f4f('0x30')],qs['fields'](_0x598d65[_0x4f4f('0x31')][_0x4f4f('0x36')]));_0x134710[_0x4f4f('0x35')]=_0x134710[_0x4f4f('0x35')][_0x4f4f('0x37')]?_0x134710[_0x4f4f('0x35')]:_0xa070ad[_0x4f4f('0x30')];if(_0x598d65[_0x4f4f('0x31')][_0x4f4f('0x43')]){_0x134710[_0x4f4f('0x44')]=[{'all':!![]}];}_0x134710=_[_0x4f4f('0x3f')]({},_0x134710,_0x598d65[_0x4f4f('0x4a')]);return db[_0x4f4f('0x42')][_0x4f4f('0x4b')](_0x134710)[_0x4f4f('0x26')](handleEntityNotFound(_0x5c06a1,null))['then'](respondWithResult(_0x5c06a1,null))[_0x4f4f('0x47')](handleError(_0x5c06a1,null));};exports['create']=function(_0x5a0063,_0x31349a){return db[_0x4f4f('0x42')]['create'](_0x5a0063[_0x4f4f('0x4c')],{})[_0x4f4f('0x26')](respondWithResult(_0x31349a,0xc9))[_0x4f4f('0x47')](handleError(_0x31349a,null));};exports[_0x4f4f('0x25')]=function(_0x222511,_0x545dd6){if(_0x222511[_0x4f4f('0x4c')]['id']){delete _0x222511[_0x4f4f('0x4c')]['id'];}return db[_0x4f4f('0x42')][_0x4f4f('0x4b')]({'where':{'id':_0x222511[_0x4f4f('0x49')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x545dd6,null))[_0x4f4f('0x26')](saveUpdates(_0x222511[_0x4f4f('0x4c')],null))[_0x4f4f('0x26')](respondWithResult(_0x545dd6,null))['catch'](handleError(_0x545dd6,null));};exports[_0x4f4f('0x27')]=function(_0xd3b763,_0x4b33a5){return db['SmsApplication']['find']({'where':{'id':_0xd3b763[_0x4f4f('0x49')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x4b33a5,null))[_0x4f4f('0x26')](removeEntity(_0x4b33a5,null))['catch'](handleError(_0x4b33a5,null));}; \ No newline at end of file +var _0xab40=['show','params','include','find','catch','create','body','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','update','destroy','name','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','offset','order','where','pick','filter','merge','map','VIRTUAL','options','SmsApplication','then','includeAll','findAll'];(function(_0x2fc54e,_0x402e5c){var _0x55d2b3=function(_0xa28e9c){while(--_0xa28e9c){_0x2fc54e['push'](_0x2fc54e['shift']());}};_0x55d2b3(++_0x402e5c);}(_0xab40,0xcd));var _0x0ab4=function(_0x5de62d,_0xa44a9){_0x5de62d=_0x5de62d-0x0;var _0x174133=_0xab40[_0x5de62d];return _0x174133;};'use strict';var pdf=require(_0x0ab4('0x0'));var emlformat=require(_0x0ab4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab4('0x2'));var moment=require(_0x0ab4('0x3'));var BPromise=require(_0x0ab4('0x4'));var Mustache=require(_0x0ab4('0x5'));var util=require(_0x0ab4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0ab4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0ab4('0x14'))['db'];function respondWithStatusCode(_0x4c21b0,_0x249dc3){_0x249dc3=_0x249dc3||0xcc;return function(_0x45e6fd){if(_0x45e6fd){return _0x4c21b0[_0x0ab4('0x15')](_0x249dc3);}return _0x4c21b0[_0x0ab4('0x16')](_0x249dc3)[_0x0ab4('0x17')]();};}function respondWithResult(_0x329104,_0x112162){_0x112162=_0x112162||0xc8;return function(_0x2cc644){if(_0x2cc644){return _0x329104[_0x0ab4('0x16')](_0x112162)[_0x0ab4('0x18')](_0x2cc644);}};}function respondWithFilteredResult(_0x216a17,_0x36d246){return function(_0x293e20){if(_0x293e20){var _0x45fad1=_0x293e20[_0x0ab4('0x19')],_0x2a83a8=_0x36d246['offset'],_0x2403db=_0x36d246['offset']+_0x36d246['limit'],_0x283b15;if(_0x2403db>=_0x45fad1){_0x2403db=_0x45fad1;_0x283b15=0xc8;}else{_0x283b15=0xce;}_0x216a17[_0x0ab4('0x16')](_0x283b15);return _0x216a17[_0x0ab4('0x1a')](_0x0ab4('0x1b'),_0x2a83a8+'-'+_0x2403db+'/'+_0x45fad1)['json'](_0x293e20);}return null;};}function patchUpdates(_0x1e3fe2){return function(_0x13ea9f){try{jsonpatch[_0x0ab4('0x1c')](_0x13ea9f,_0x1e3fe2,!![]);}catch(_0x31ee29){return BPromise['reject'](_0x31ee29);}return _0x13ea9f['save']();};}function saveUpdates(_0xdb0797,_0x5b1ed5){return function(_0x2b0e29){if(_0x2b0e29){return _0x2b0e29[_0x0ab4('0x1d')](_0xdb0797)['then'](function(_0xacd68e){return _0xacd68e;});}return null;};}function removeEntity(_0x430b89,_0x2c55b3){return function(_0x1d5c14){if(_0x1d5c14){return _0x1d5c14[_0x0ab4('0x1e')]()['then'](function(){_0x430b89['status'](0xcc)[_0x0ab4('0x17')]();});}};}function handleEntityNotFound(_0x14087f,_0x392afe){return function(_0x13c882){if(!_0x13c882){_0x14087f['sendStatus'](0x194);}return _0x13c882;};}function handleError(_0x42d2dd,_0x3caa9d){_0x3caa9d=_0x3caa9d||0x1f4;return function(_0x32b14a){logger['error'](_0x32b14a['stack']);if(_0x32b14a[_0x0ab4('0x1f')]){delete _0x32b14a[_0x0ab4('0x1f')];}_0x42d2dd[_0x0ab4('0x16')](_0x3caa9d)['send'](_0x32b14a);};}exports['index']=function(_0x49c72d,_0x19ecc6){var _0x5ba3a2={},_0x3bf844={},_0x3b4621={'count':0x0,'rows':[]};var _0x4f1aeb=_['map'](db['SmsApplication'][_0x0ab4('0x20')],function(_0x183bac){return{'name':_0x183bac[_0x0ab4('0x21')],'type':_0x183bac[_0x0ab4('0x22')][_0x0ab4('0x23')]};});_0x3bf844['model']=_['map'](_0x4f1aeb,'name');_0x3bf844[_0x0ab4('0x24')]=_[_0x0ab4('0x25')](_0x49c72d[_0x0ab4('0x24')]);_0x3bf844[_0x0ab4('0x26')]=_[_0x0ab4('0x27')](_0x3bf844['model'],_0x3bf844['query']);_0x5ba3a2[_0x0ab4('0x28')]=_[_0x0ab4('0x27')](_0x3bf844[_0x0ab4('0x29')],qs['fields'](_0x49c72d['query'][_0x0ab4('0x2a')]));_0x5ba3a2['attributes']=_0x5ba3a2[_0x0ab4('0x28')][_0x0ab4('0x2b')]?_0x5ba3a2[_0x0ab4('0x28')]:_0x3bf844[_0x0ab4('0x29')];if(!_0x49c72d[_0x0ab4('0x24')][_0x0ab4('0x2c')]('nolimit')){_0x5ba3a2[_0x0ab4('0x2d')]=qs[_0x0ab4('0x2d')](_0x49c72d[_0x0ab4('0x24')][_0x0ab4('0x2d')]);_0x5ba3a2['offset']=qs['offset'](_0x49c72d[_0x0ab4('0x24')][_0x0ab4('0x2e')]);}_0x5ba3a2[_0x0ab4('0x2f')]=qs['sort'](_0x49c72d['query']['sort']);_0x5ba3a2[_0x0ab4('0x30')]=qs[_0x0ab4('0x26')](_[_0x0ab4('0x31')](_0x49c72d['query'],_0x3bf844['filters']),_0x4f1aeb);if(_0x49c72d['query'][_0x0ab4('0x32')]){_0x5ba3a2[_0x0ab4('0x30')]=_[_0x0ab4('0x33')](_0x5ba3a2[_0x0ab4('0x30')],{'$or':_[_0x0ab4('0x34')](_0x4f1aeb,function(_0x70f561){if(_0x70f561[_0x0ab4('0x22')]!==_0x0ab4('0x35')){var _0x3ef580={};_0x3ef580[_0x70f561[_0x0ab4('0x1f')]]={'$like':'%'+_0x49c72d['query'][_0x0ab4('0x32')]+'%'};return _0x3ef580;}})});}_0x5ba3a2=_[_0x0ab4('0x33')]({},_0x5ba3a2,_0x49c72d[_0x0ab4('0x36')]);var _0x97d4ad={'where':_0x5ba3a2[_0x0ab4('0x30')]};return db[_0x0ab4('0x37')][_0x0ab4('0x19')](_0x97d4ad)[_0x0ab4('0x38')](function(_0x37b53b){_0x3b4621[_0x0ab4('0x19')]=_0x37b53b;if(_0x49c72d[_0x0ab4('0x24')][_0x0ab4('0x39')]){_0x5ba3a2['include']=[{'all':!![]}];}return db[_0x0ab4('0x37')][_0x0ab4('0x3a')](_0x5ba3a2);})[_0x0ab4('0x38')](function(_0x3acb8d){_0x3b4621['rows']=_0x3acb8d;return _0x3b4621;})[_0x0ab4('0x38')](respondWithFilteredResult(_0x19ecc6,_0x5ba3a2))['catch'](handleError(_0x19ecc6,null));};exports[_0x0ab4('0x3b')]=function(_0x454e3d,_0x248a58){var _0x245021={'raw':!![],'where':{'id':_0x454e3d[_0x0ab4('0x3c')]['id']}},_0xd2293={};_0xd2293['model']=_[_0x0ab4('0x25')](db[_0x0ab4('0x37')][_0x0ab4('0x20')]);_0xd2293['query']=_[_0x0ab4('0x25')](_0x454e3d[_0x0ab4('0x24')]);_0xd2293[_0x0ab4('0x26')]=_[_0x0ab4('0x27')](_0xd2293[_0x0ab4('0x29')],_0xd2293['query']);_0x245021['attributes']=_['intersection'](_0xd2293[_0x0ab4('0x29')],qs[_0x0ab4('0x2a')](_0x454e3d['query'][_0x0ab4('0x2a')]));_0x245021['attributes']=_0x245021[_0x0ab4('0x28')]['length']?_0x245021[_0x0ab4('0x28')]:_0xd2293[_0x0ab4('0x29')];if(_0x454e3d[_0x0ab4('0x24')][_0x0ab4('0x39')]){_0x245021[_0x0ab4('0x3d')]=[{'all':!![]}];}_0x245021=_[_0x0ab4('0x33')]({},_0x245021,_0x454e3d['options']);return db[_0x0ab4('0x37')][_0x0ab4('0x3e')](_0x245021)[_0x0ab4('0x38')](handleEntityNotFound(_0x248a58,null))[_0x0ab4('0x38')](respondWithResult(_0x248a58,null))[_0x0ab4('0x3f')](handleError(_0x248a58,null));};exports[_0x0ab4('0x40')]=function(_0x54c201,_0x9b2c74){return db['SmsApplication'][_0x0ab4('0x40')](_0x54c201[_0x0ab4('0x41')],{})[_0x0ab4('0x38')](respondWithResult(_0x9b2c74,0xc9))['catch'](handleError(_0x9b2c74,null));};exports[_0x0ab4('0x1d')]=function(_0x1fcc3b,_0x1ce096){if(_0x1fcc3b[_0x0ab4('0x41')]['id']){delete _0x1fcc3b[_0x0ab4('0x41')]['id'];}return db[_0x0ab4('0x37')]['find']({'where':{'id':_0x1fcc3b[_0x0ab4('0x3c')]['id']}})[_0x0ab4('0x38')](handleEntityNotFound(_0x1ce096,null))[_0x0ab4('0x38')](saveUpdates(_0x1fcc3b[_0x0ab4('0x41')],null))[_0x0ab4('0x38')](respondWithResult(_0x1ce096,null))[_0x0ab4('0x3f')](handleError(_0x1ce096,null));};exports[_0x0ab4('0x1e')]=function(_0x356bc9,_0x22402e){return db[_0x0ab4('0x37')][_0x0ab4('0x3e')]({'where':{'id':_0x356bc9[_0x0ab4('0x3c')]['id']}})[_0x0ab4('0x38')](handleEntityNotFound(_0x22402e,null))['then'](removeEntity(_0x22402e,null))[_0x0ab4('0x3f')](handleError(_0x22402e,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index e3c9ec5..3da187b 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 _0x5bbb=['exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','./smsApplication.attributes'];(function(_0x36c0c3,_0xa0edd3){var _0x5b7932=function(_0x156a91){while(--_0x156a91){_0x36c0c3['push'](_0x36c0c3['shift']());}};_0x5b7932(++_0xa0edd3);}(_0x5bbb,0x14a));var _0xb5bb=function(_0x21e248,_0x278933){_0x21e248=_0x21e248-0x0;var _0x5b611c=_0x5bbb[_0x21e248];return _0x5b611c;};'use strict';var _=require(_0xb5bb('0x0'));var util=require(_0xb5bb('0x1'));var logger=require(_0xb5bb('0x2'))(_0xb5bb('0x3'));var moment=require(_0xb5bb('0x4'));var BPromise=require('bluebird');var rp=require(_0xb5bb('0x5'));var fs=require('fs');var path=require(_0xb5bb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb5bb('0x7'));module[_0xb5bb('0x8')]=function(_0x41012d,_0x1a980d){return _0x41012d['define'](_0xb5bb('0x9'),attributes,{'tableName':_0xb5bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb5bb('0xb'),'collate':_0xb5bb('0xc')});}; \ No newline at end of file +var _0x93d2=['path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x53f74c,_0xd71010){var _0x467bc0=function(_0x58ab34){while(--_0x58ab34){_0x53f74c['push'](_0x53f74c['shift']());}};_0x467bc0(++_0xd71010);}(_0x93d2,0x1e9));var _0x293d=function(_0x452450,_0x40b419){_0x452450=_0x452450-0x0;var _0x448b19=_0x93d2[_0x452450];return _0x448b19;};'use strict';var _=require(_0x293d('0x0'));var util=require(_0x293d('0x1'));var logger=require(_0x293d('0x2'))(_0x293d('0x3'));var moment=require(_0x293d('0x4'));var BPromise=require(_0x293d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x293d('0x6'));var rimraf=require('rimraf');var config=require(_0x293d('0x7'));var attributes=require(_0x293d('0x8'));module[_0x293d('0x9')]=function(_0x239a98,_0x56b3a6){return _0x239a98[_0x293d('0xa')](_0x293d('0xb'),attributes,{'tableName':_0x293d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x293d('0xd'),'collate':_0x293d('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 6939e5e..19035c6 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 _0xf6d1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','lodash'];(function(_0x11f1d8,_0x2ea250){var _0x15db56=function(_0x4d856d){while(--_0x4d856d){_0x11f1d8['push'](_0x11f1d8['shift']());}};_0x15db56(++_0x2ea250);}(_0xf6d1,0x99));var _0x1f6d=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xf6d1[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var moment=require(_0x1f6d('0x2'));var BPromise=require(_0x1f6d('0x3'));var rs=require(_0x1f6d('0x4'));var fs=require('fs');var Redis=require(_0x1f6d('0x5'));var db=require(_0x1f6d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6d('0x7'))('rpc');var config=require(_0x1f6d('0x8'));var jayson=require(_0x1f6d('0x9'));var client=jayson[_0x1f6d('0xa')][_0x1f6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b90fb,_0x2f8fff,_0xf4dd78){return new BPromise(function(_0x234155,_0x21813f){return client[_0x1f6d('0xc')](_0x1b90fb,_0xf4dd78)[_0x1f6d('0xd')](function(_0x23f741){logger['info'](_0x1f6d('0xe'),_0x2f8fff,'request\x20sent');logger[_0x1f6d('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2f8fff,_0x1f6d('0x10'),JSON[_0x1f6d('0x11')](_0x23f741));if(_0x23f741[_0x1f6d('0x12')]){if(_0x23f741[_0x1f6d('0x12')]['code']===0x1f4){logger['error'](_0x1f6d('0xe'),_0x2f8fff,_0x23f741[_0x1f6d('0x12')][_0x1f6d('0x13')]);return _0x21813f(_0x23f741[_0x1f6d('0x12')][_0x1f6d('0x13')]);}logger[_0x1f6d('0x12')](_0x1f6d('0xe'),_0x2f8fff,_0x23f741[_0x1f6d('0x12')][_0x1f6d('0x13')]);return _0x234155(_0x23f741[_0x1f6d('0x12')]['message']);}else{logger[_0x1f6d('0x14')](_0x1f6d('0xe'),_0x2f8fff,_0x1f6d('0x10'));_0x234155(_0x23f741['result'][_0x1f6d('0x13')]);}})[_0x1f6d('0x15')](function(_0x58b375){logger[_0x1f6d('0x12')](_0x1f6d('0xe'),_0x2f8fff,_0x58b375);_0x21813f(_0x58b375);});});} \ No newline at end of file +var _0x2caf=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x520758,_0x5113b7){var _0x49b8c3=function(_0x5a3cd0){while(--_0x5a3cd0){_0x520758['push'](_0x520758['shift']());}};_0x49b8c3(++_0x5113b7);}(_0x2caf,0x6a));var _0xf2ca=function(_0x45c4f9,_0x49a7af){_0x45c4f9=_0x45c4f9-0x0;var _0x4c2a46=_0x2caf[_0x45c4f9];return _0x4c2a46;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf2ca('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2ca('0x1'));var db=require(_0xf2ca('0x2'))['db'];var utils=require(_0xf2ca('0x3'));var logger=require(_0xf2ca('0x4'))(_0xf2ca('0x5'));var config=require(_0xf2ca('0x6'));var jayson=require(_0xf2ca('0x7'));var client=jayson['client'][_0xf2ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4292b4,_0x16cabd,_0x57e3e8){return new BPromise(function(_0x4ea38c,_0x2fbb08){return client[_0xf2ca('0x9')](_0x4292b4,_0x57e3e8)[_0xf2ca('0xa')](function(_0x1cf4a0){logger[_0xf2ca('0xb')]('SmsApplication,\x20%s,\x20%s',_0x16cabd,_0xf2ca('0xc'));logger[_0xf2ca('0xd')](_0xf2ca('0xe'),_0x16cabd,_0xf2ca('0xc'),JSON[_0xf2ca('0xf')](_0x1cf4a0));if(_0x1cf4a0[_0xf2ca('0x10')]){if(_0x1cf4a0['error'][_0xf2ca('0x11')]===0x1f4){logger[_0xf2ca('0x10')]('SmsApplication,\x20%s,\x20%s',_0x16cabd,_0x1cf4a0[_0xf2ca('0x10')][_0xf2ca('0x12')]);return _0x2fbb08(_0x1cf4a0['error']['message']);}logger[_0xf2ca('0x10')]('SmsApplication,\x20%s,\x20%s',_0x16cabd,_0x1cf4a0[_0xf2ca('0x10')][_0xf2ca('0x12')]);return _0x4ea38c(_0x1cf4a0[_0xf2ca('0x10')][_0xf2ca('0x12')]);}else{logger[_0xf2ca('0xb')](_0xf2ca('0x13'),_0x16cabd,_0xf2ca('0xc'));_0x4ea38c(_0x1cf4a0['result'][_0xf2ca('0x12')]);}})['catch'](function(_0x2d12bb){logger['error'](_0xf2ca('0x13'),_0x16cabd,_0x2d12bb);_0x2fbb08(_0x2d12bb);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6f8ccfa..41d6d99 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 _0xf9ac=['multer','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','/:id','sms','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf9ac,0x87));var _0xcf9a=function(_0x28bc09,_0x5721c2){_0x28bc09=_0x28bc09-0x0;var _0x59cddb=_0xf9ac[_0x28bc09];return _0x59cddb;};'use strict';var multer=require(_0xcf9a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcf9a('0x1'));var express=require(_0xcf9a('0x2'));var router=express['Router']();var auth=require(_0xcf9a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcf9a('0x4'));var controller=require('./smsInteraction.controller');router['get']('/',auth[_0xcf9a('0x5')](),controller[_0xcf9a('0x6')]);router[_0xcf9a('0x7')](_0xcf9a('0x8'),auth['isAuthenticated'](),controller[_0xcf9a('0x9')]);router[_0xcf9a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xcf9a('0xa')]);router['get'](_0xcf9a('0xb'),auth['isAuthenticated'](),controller[_0xcf9a('0xc')]);router['get'](_0xcf9a('0xd'),auth[_0xcf9a('0x5')](),controller[_0xcf9a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xcf9a('0xf')](_0xcf9a('0xb'),auth['isAuthenticated'](),controller[_0xcf9a('0x10')]);router[_0xcf9a('0xf')](_0xcf9a('0x11'),auth['isAuthenticated'](),interaction[_0xcf9a('0x12')]('sms','smsinteraction:addtags'),controller['addTags']);router['put'](_0xcf9a('0x13'),auth[_0xcf9a('0x5')](),interaction[_0xcf9a('0x12')](_0xcf9a('0x14'),_0xcf9a('0x15')),controller[_0xcf9a('0x16')]);router[_0xcf9a('0x17')]('/:id',auth[_0xcf9a('0x5')](),interaction[_0xcf9a('0x12')]('sms',_0xcf9a('0x18')),controller['destroy']);router[_0xcf9a('0x17')]('/:id/tags',auth[_0xcf9a('0x5')](),controller[_0xcf9a('0x19')]);module[_0xcf9a('0x1a')]=router; \ No newline at end of file +var _0x565e=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','multer'];(function(_0x56066c,_0x1ebb36){var _0x59d6f0=function(_0x2088a7){while(--_0x2088a7){_0x56066c['push'](_0x56066c['shift']());}};_0x59d6f0(++_0x1ebb36);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe565('0x0'));var util=require('util');var path=require(_0xe565('0x1'));var timeout=require(_0xe565('0x2'));var express=require(_0xe565('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe565('0x4'));var config=require(_0xe565('0x5'));var controller=require(_0xe565('0x6'));router[_0xe565('0x7')]('/',auth[_0xe565('0x8')](),controller[_0xe565('0x9')]);router[_0xe565('0x7')](_0xe565('0xa'),auth[_0xe565('0x8')](),controller[_0xe565('0xb')]);router[_0xe565('0x7')](_0xe565('0xc'),auth[_0xe565('0x8')](),controller[_0xe565('0xd')]);router[_0xe565('0x7')](_0xe565('0xe'),auth['isAuthenticated'](),controller[_0xe565('0xf')]);router[_0xe565('0x7')](_0xe565('0x10'),auth['isAuthenticated'](),controller[_0xe565('0x11')]);router[_0xe565('0x12')]('/',auth[_0xe565('0x8')](),controller[_0xe565('0x13')]);router['post'](_0xe565('0xe'),auth['isAuthenticated'](),controller[_0xe565('0x14')]);router['post'](_0xe565('0x15'),auth[_0xe565('0x8')](),interaction[_0xe565('0x16')]('sms',_0xe565('0x17')),controller[_0xe565('0x18')]);router[_0xe565('0x19')](_0xe565('0xc'),auth['isAuthenticated'](),interaction[_0xe565('0x16')](_0xe565('0x1a'),_0xe565('0x1b')),controller[_0xe565('0x1c')]);router[_0xe565('0x1d')](_0xe565('0xc'),auth['isAuthenticated'](),interaction[_0xe565('0x16')](_0xe565('0x1a'),_0xe565('0x1e')),controller[_0xe565('0x1f')]);router['delete'](_0xe565('0x15'),auth[_0xe565('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 2104ed8..2940200 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x3541e4,_0x4dcf9a){var _0x3ca5d9=function(_0x3eaac2){while(--_0x3eaac2){_0x3541e4['push'](_0x3541e4['shift']());}};_0x3ca5d9(++_0x4dcf9a);}(_0x757a,0xde));var _0xa757=function(_0x5c99d1,_0x29fe8c){_0x5c99d1=_0x5c99d1-0x0;var _0x626f9=_0x757a[_0x5c99d1];return _0x626f9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe706=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x5362f2,_0x17a236){var _0x9c2059=function(_0x20a7a6){while(--_0x20a7a6){_0x5362f2['push'](_0x5362f2['shift']());}};_0x9c2059(++_0x17a236);}(_0xe706,0xa3));var _0x6e70=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xe706[_0x231dda];return _0x3f88cb;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize[_0x6e70('0x4')]},'note':{'type':Sequelize[_0x6e70('0x4')]},'phone':{'type':Sequelize[_0x6e70('0x4')]},'read1stAt':{'type':Sequelize[_0x6e70('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6e70('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('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 61452a4..795973a 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 _0x8ce3=['then','error','stack','name','send','map','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','users','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','params','includeAll','include','create','describe','addMessage','SmsMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','spread','smsInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','format','transcript-%d-%s.zip','User','fullname','firstName','lastName','Messages','direction','secret','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Sms','YYYY-MM-DD','Account','N.A.','closed','closedAt','disposition','out','System','renderFile','views','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','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','./smsInteraction.socket','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x8ce3,0xc3));var _0x38ce=function(_0x295df8,_0x1f9924){_0x295df8=_0x295df8-0x0;var _0x1c4b61=_0x8ce3[_0x295df8];return _0x1c4b61;};'use strict';var pdf=require(_0x38ce('0x0'));var emlformat=require(_0x38ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x38ce('0x2'));var jsonpatch=require(_0x38ce('0x3'));var rp=require(_0x38ce('0x4'));var moment=require(_0x38ce('0x5'));var BPromise=require(_0x38ce('0x6'));var Mustache=require(_0x38ce('0x7'));var util=require(_0x38ce('0x8'));var path=require(_0x38ce('0x9'));var sox=require('sox');var csv=require(_0x38ce('0xa'));var ejs=require(_0x38ce('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xa'));var querystring=require('querystring');var Papa=require(_0x38ce('0xf'));var Redis=require('ioredis');var authService=require(_0x38ce('0x10'));var qs=require(_0x38ce('0x11'));var as=require(_0x38ce('0x12'));var hardwareService=require(_0x38ce('0x13'));var logger=require(_0x38ce('0x14'))(_0x38ce('0x15'));var utils=require(_0x38ce('0x16'));var config=require(_0x38ce('0x17'));var db=require(_0x38ce('0x18'))['db'];config[_0x38ce('0x19')]=_[_0x38ce('0x1a')](config[_0x38ce('0x19')],{'host':_0x38ce('0x1b'),'port':0x18eb});var socket=require(_0x38ce('0x1c'))(new Redis(config[_0x38ce('0x19')]));require(_0x38ce('0x1d'))['register'](socket);function respondWithStatusCode(_0x48ba7c,_0x3c4d7f){_0x3c4d7f=_0x3c4d7f||0xcc;return function(_0x2aabd8){if(_0x2aabd8){return _0x48ba7c[_0x38ce('0x1e')](_0x3c4d7f);}return _0x48ba7c['status'](_0x3c4d7f)[_0x38ce('0x1f')]();};}function respondWithResult(_0x54fcd3,_0x2771ec){_0x2771ec=_0x2771ec||0xc8;return function(_0xe858f0){if(_0xe858f0){return _0x54fcd3['status'](_0x2771ec)[_0x38ce('0x20')](_0xe858f0);}};}function respondWithFilteredResult(_0x2dddc1,_0x1dfaba){return function(_0x51f670){if(_0x51f670){var _0xe4099a=_0x51f670[_0x38ce('0x21')],_0x2efd6f=_0x1dfaba[_0x38ce('0x22')],_0x3df527=_0x1dfaba[_0x38ce('0x22')]+_0x1dfaba['limit'],_0x311734;if(_0x3df527>=_0xe4099a){_0x3df527=_0xe4099a;_0x311734=0xc8;}else{_0x311734=0xce;}_0x2dddc1[_0x38ce('0x23')](_0x311734);return _0x2dddc1[_0x38ce('0x24')](_0x38ce('0x25'),_0x2efd6f+'-'+_0x3df527+'/'+_0xe4099a)[_0x38ce('0x20')](_0x51f670);}return null;};}function patchUpdates(_0x30b060){return function(_0x434c31){try{jsonpatch[_0x38ce('0x26')](_0x434c31,_0x30b060,!![]);}catch(_0x42ec06){return BPromise[_0x38ce('0x27')](_0x42ec06);}return _0x434c31[_0x38ce('0x28')]();};}function saveUpdates(_0x1aace7,_0x580cf3){return function(_0x1cc10b){if(_0x1cc10b){return _0x1cc10b[_0x38ce('0x29')](_0x1aace7)[_0x38ce('0x2a')](function(_0xcf5d9e){return _0xcf5d9e;});}return null;};}function removeEntity(_0x4a56b0,_0x2c85e6){return function(_0x1d192d){if(_0x1d192d){return _0x1d192d['destroy']()[_0x38ce('0x2a')](function(){_0x4a56b0[_0x38ce('0x23')](0xcc)[_0x38ce('0x1f')]();});}};}function handleEntityNotFound(_0x5b330c,_0x4a7e8e){return function(_0x3f3516){if(!_0x3f3516){_0x5b330c[_0x38ce('0x1e')](0x194);}return _0x3f3516;};}function handleError(_0x142d72,_0x21d4e7){_0x21d4e7=_0x21d4e7||0x1f4;return function(_0x264cf0){logger[_0x38ce('0x2b')](_0x264cf0[_0x38ce('0x2c')]);if(_0x264cf0[_0x38ce('0x2d')]){delete _0x264cf0[_0x38ce('0x2d')];}_0x142d72[_0x38ce('0x23')](_0x21d4e7)[_0x38ce('0x2e')](_0x264cf0);};}function getInteractionUsers(_0x381703,_0x50692a){return new BPromise(function(_0x1212dd,_0x1538a0){try{if(_0x50692a[_0x381703['id']]){_0x381703['Users']=_[_0x38ce('0x2f')](_0x50692a[_0x381703['id']],function(_0x3cbead){return{'id':_0x3cbead['id'],'fullname':_0x3cbead['fullname']};});}}catch(_0xd96d33){_0x1538a0(_0xd96d33);}_0x1212dd(_0x381703);});}function getInteractionTags(_0x282ee4,_0x568d94){return new BPromise(function(_0x28d775,_0x53f2c9){try{if(_0x282ee4[_0x38ce('0x30')]){_0x282ee4[_0x38ce('0x31')]=[];_0x282ee4[_0x38ce('0x30')][_0x38ce('0x32')](',')[_0x38ce('0x33')](function(_0x23019f){_0x282ee4[_0x38ce('0x31')][_0x38ce('0x34')](_0x568d94[_0x23019f]);});}delete _0x282ee4['TagIds'];}catch(_0x4e5bf6){_0x53f2c9(_0x4e5bf6);}_0x28d775(_0x282ee4);});}function updateSmsInteraction(_0x469b65,_0xc4dd0f,_0x3cba20){return new BPromise(function(_0x34cb97,_0x3fe430){return getInteractionUsers(_0x469b65,_0x3cba20)['then'](function(_0x23208f){return getInteractionTags(_0x23208f,_0xc4dd0f);})[_0x38ce('0x2a')](function(_0x37f696){_0x34cb97(_0x37f696);})[_0x38ce('0x35')](function(_0x3a4895){_0x3fe430(_0x3a4895);});});}exports[_0x38ce('0x36')]=function(_0x3d7f64,_0x54050a){var _0x2297e5={},_0x73cbd2={},_0x5b8c69={'count':0x0,'rows':[]};var _0x3069aa=_[_0x38ce('0x2f')](db[_0x38ce('0x37')][_0x38ce('0x38')],function(_0x1eb47e){return{'name':_0x1eb47e[_0x38ce('0x39')],'type':_0x1eb47e[_0x38ce('0x3a')][_0x38ce('0x3b')]};});_0x73cbd2['model']=_[_0x38ce('0x2f')](_0x3069aa,_0x38ce('0x2d'));_0x73cbd2[_0x38ce('0x3c')]=_[_0x38ce('0x3d')](_0x3d7f64['query']);_0x73cbd2[_0x38ce('0x3e')]=_['intersection'](_0x73cbd2[_0x38ce('0x3f')],_0x73cbd2[_0x38ce('0x3c')]);_0x2297e5[_0x38ce('0x40')]=_[_0x38ce('0x41')](_0x73cbd2[_0x38ce('0x3f')],qs[_0x38ce('0x42')](_0x3d7f64['query'][_0x38ce('0x42')]));_0x2297e5['attributes']=_0x2297e5[_0x38ce('0x40')][_0x38ce('0x43')]?_0x2297e5[_0x38ce('0x40')]:_0x73cbd2[_0x38ce('0x3f')];if(!_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x44')]('nolimit')){_0x2297e5[_0x38ce('0x45')]=qs[_0x38ce('0x45')](_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x45')]);_0x2297e5[_0x38ce('0x22')]=qs[_0x38ce('0x22')](_0x3d7f64['query']['offset']);}_0x2297e5[_0x38ce('0x46')]=qs[_0x38ce('0x47')](_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x47')]);_0x2297e5[_0x38ce('0x48')]=qs[_0x38ce('0x3e')](_[_0x38ce('0x49')](_0x3d7f64['query'],_0x73cbd2[_0x38ce('0x3e')]),_0x3069aa);var _0x30cfe3=[];var _0x5a689b=squel[_0x38ce('0x4a')]()[_0x38ce('0x4b')]('id')[_0x38ce('0x4b')]('name')[_0x38ce('0x4b')](_0x38ce('0x4c'))[_0x38ce('0x4d')](_0x38ce('0x4e'));var _0x24cf78=squel[_0x38ce('0x4a')]()['field'](_0x38ce('0x4f'))[_0x38ce('0x4b')](_0x38ce('0x50'))[_0x38ce('0x4b')](_0x38ce('0x51'))[_0x38ce('0x4d')]('user_has_sms_interactions','ui')[_0x38ce('0x52')](_0x38ce('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x502430=squel['select']()[_0x38ce('0x4d')](_0x38ce('0x54'),'i')['left_join']('cm_contacts','c',_0x38ce('0x55'))['left_join'](_0x38ce('0x53'),'o','o.id\x20=\x20i.UserId')[_0x38ce('0x52')](_0x38ce('0x56'),'a','a.id\x20=\x20i.SmsAccountId')[_0x38ce('0x52')](_0x38ce('0x57'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x38ce('0x52')](_0x38ce('0x58'),'it',_0x38ce('0x59'))[_0x38ce('0x52')](_0x38ce('0x4e'),'t',_0x38ce('0x5a'));var _0x58cc6f=squel[_0x38ce('0x5b')]();var _0x1d25b2=[];var _0x53bbc3=squel[_0x38ce('0x5b')]();var _0x316eec;if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x5c')]){_0x316eec=as[_0x38ce('0x5d')](_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x5c')]);var _0x5f2e8d=_0x316eec[_0x38ce('0x5e')];for(var _0x34a118=0x0;_0x34a118<_0x316eec[_0x38ce('0x5f')][_0x38ce('0x43')];_0x34a118++){var _0x2264f9=_0x316eec[_0x38ce('0x5f')][_0x34a118];var _0x5f145d='i';var _0x50c3b8=_[_0x38ce('0x60')](_0x3069aa,[_0x38ce('0x2d'),_0x2264f9[_0x38ce('0x4b')]]);if(!_0x50c3b8){switch(_0x2264f9[_0x38ce('0x4b')]){case _0x38ce('0x61'):if(_0x2264f9[_0x38ce('0x62')]==0x1){_0x502430['having']('`'+_0x2264f9['field']+_0x38ce('0x63'));}else{_0x502430['having']('`'+_0x2264f9['field']+_0x38ce('0x64'));}break;case _0x38ce('0x65'):if(_0x2264f9[_0x38ce('0x66')]===_0x38ce('0x67')){if(_0x2264f9[_0x38ce('0x62')]['split']('\x20')[_0x38ce('0x43')]>0x1){_0x58cc6f[_0x5f2e8d](_0x38ce('0x68'),qs[_0x38ce('0x69')](_0x2264f9[_0x38ce('0x62')]),null);}else{var _0x6b381f='%'+_0x2264f9[_0x38ce('0x62')]+'%';_0x58cc6f[_0x5f2e8d](_0x38ce('0x6a'),_0x6b381f,_0x6b381f,_0x6b381f);}}else{_0x50c3b8=_[_0x38ce('0x60')](_0x3069aa,[_0x38ce('0x2d'),_0x38ce('0x6b')]);_0x2264f9[_0x38ce('0x4b')]='ContactId';_0x51adaa=as['buildExpression'](_0x5f145d,_0x50c3b8[_0x38ce('0x3a')],_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa[_0x38ce('0x6c')],_0x51adaa[_0x38ce('0x62')][_0x38ce('0x6d')],_0x51adaa['value'][_0x38ce('0x1f')]);}break;case _0x38ce('0x6e'):var _0x3b4e47=_0x2264f9[_0x38ce('0x62')][_0x38ce('0x32')](',')[_0x38ce('0x2f')](function(_0x1534ca){return Number(_0x1534ca);});_0x3b4e47['forEach'](function(_0x7f2eea){_0x53bbc3['or'](_0x38ce('0x6f'),'%,'+_0x7f2eea+',%');});_0x1d25b2=_['union'](_0x1d25b2,_0x3b4e47);break;case'User':if(_0x2264f9[_0x38ce('0x66')]===_0x38ce('0x67')){_0x58cc6f[_0x5f2e8d](_0x38ce('0x70'),'%'+_0x2264f9['value']+'%',null);}else{_0x50c3b8=_['find'](_0x3069aa,[_0x38ce('0x2d'),'UserId']);_0x2264f9[_0x38ce('0x4b')]=_0x38ce('0x71');_0x51adaa=as[_0x38ce('0x72')](_0x5f145d,_0x50c3b8[_0x38ce('0x3a')],_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa['text'],_0x51adaa[_0x38ce('0x62')][_0x38ce('0x6d')],_0x51adaa[_0x38ce('0x62')]['end']);}break;case _0x38ce('0x73'):_0x51adaa=as[_0x38ce('0x72')]('me',null,_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa[_0x38ce('0x6c')],_0x51adaa['value'][_0x38ce('0x6d')],_0x51adaa['value'][_0x38ce('0x1f')]);break;}}else{var _0x51adaa=as[_0x38ce('0x72')](_0x5f145d,_0x50c3b8[_0x38ce('0x3a')],_0x2264f9);_0x58cc6f[_0x5f2e8d](_0x51adaa[_0x38ce('0x6c')],_0x51adaa[_0x38ce('0x62')]['start'],_0x51adaa[_0x38ce('0x62')][_0x38ce('0x1f')]);}}}else{var _0x425002=_(_0x3d7f64[_0x38ce('0x3c')])[_0x38ce('0x3d')]()[_0x38ce('0x2f')](function(_0x5b8fb5){return _[_0x38ce('0x74')](_0x3069aa,['name',_0x5b8fb5])?_0x5b8fb5:undefined;})[_0x38ce('0x75')]()[_0x38ce('0x62')]();if(!_[_0x38ce('0x76')](_0x425002)){_0x425002[_0x38ce('0x33')](function(_0x32290f){if(_0x32290f===_0x38ce('0x77')){_0x502430[_0x38ce('0x48')](_0x38ce('0x78'),[]['concat'](_0x3d7f64[_0x38ce('0x3c')][_0x32290f]));}else if(_0x32290f===_0x38ce('0x79')){var _0x204e91=JSON[_0x38ce('0x7a')](_0x3d7f64[_0x38ce('0x3c')][_0x32290f])[_0x38ce('0x7b')];var _0x3122da=JSON[_0x38ce('0x7a')](_0x3d7f64[_0x38ce('0x3c')][_0x32290f])[_0x38ce('0x7c')];_0x502430[_0x38ce('0x48')](_0x38ce('0x7d'),_0x204e91,_0x3122da);}else{if(_0x3d7f64[_0x38ce('0x3c')][_0x32290f]===_0x38ce('0x7e')){_0x502430[_0x38ce('0x48')]('i.'+_0x32290f+_0x38ce('0x7f'));}else{_0x502430[_0x38ce('0x48')]('i.'+_0x32290f+_0x38ce('0x80'),_0x3d7f64[_0x38ce('0x3c')][_0x32290f]);}}});}if(_0x3d7f64[_0x38ce('0x3c')]['read']){if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x81')]==0x1){_0x502430[_0x38ce('0x82')]('`unreadMessages`\x20=\x200');}else{_0x502430['having'](_0x38ce('0x83'));}}if(_0x3d7f64[_0x38ce('0x3c')]['tag']){_0x1d25b2=_[_0x38ce('0x84')](_0x3d7f64[_0x38ce('0x3c')]['tag'])?_0x3d7f64['query'][_0x38ce('0x85')]:new Array(_0x3d7f64[_0x38ce('0x3c')]['tag']);_0x1d25b2[_0x38ce('0x33')](function(_0x2732ac){_0x53bbc3['or'](_0x38ce('0x6f'),'%,'+_0x2732ac+',%');});}if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x86')]){var _0x163d35=_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x86')]['replace']('\x5c','\x5c\x5c')[_0x38ce('0x87')]('\x27\x27',_0x38ce('0x88'));if(qs[_0x38ce('0x89')](_0x163d35)){_0x58cc6f['or'](_0x38ce('0x8a'),_0x163d35+'%')['or'](_0x38ce('0x8b'),_0x163d35+'%');}else{_0x58cc6f['or'](_0x38ce('0x8c'),qs[_0x38ce('0x69')](_0x163d35))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x163d35+'%');}}}_0x502430['where'](_0x58cc6f);_0x502430['group'](_0x38ce('0x8d'));var _0x384671={'type':db[_0x38ce('0x8e')][_0x38ce('0x8f')][_0x38ce('0x90')],'raw':!![]};var _0x26ca11=_0x502430[_0x38ce('0x91')]();_0x26ca11['field'](_0x38ce('0x8d'));_0x26ca11['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x2297e5[_0x38ce('0x46')]){_0x2297e5[_0x38ce('0x46')][_0x38ce('0x33')](function(_0x585fe0){_0x502430[_0x38ce('0x46')]('i.'+_0x585fe0[0x0],_0x585fe0[0x1]===_0x38ce('0x92')?![]:!![]);});}if(!_[_0x38ce('0x76')](_0x1d25b2)){_0x502430[_0x38ce('0x82')](_0x53bbc3);_0x26ca11[_0x38ce('0x48')]('t.id\x20IN\x20?',_0x1d25b2);}BPromise[_0x38ce('0x93')]()['then'](function(){if(!_0x316eec){if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x77')]||_0x3d7f64['query'][_0x38ce('0x94')])return;_0x26ca11[_0x38ce('0x48')](_0x38ce('0x95'));_0x502430[_0x38ce('0x48')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d7f64['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x4961b8){if(_['isEmpty'](_0x4961b8)){_0x26ca11[_0x38ce('0x48')](_0x38ce('0x96'));_0x502430[_0x38ce('0x48')](_0x38ce('0x96'));}else{_0x26ca11['where'](_0x38ce('0x78'),_[_0x38ce('0x2f')](_0x4961b8,'id'));_0x502430['where'](_0x38ce('0x78'),_[_0x38ce('0x2f')](_0x4961b8,'id'));}});})[_0x38ce('0x2a')](function(){db[_0x38ce('0x97')][_0x38ce('0x3c')](_0x26ca11[_0x38ce('0x98')](),_0x384671)[_0x38ce('0x2a')](function(_0x386b51){_0x5b8c69[_0x38ce('0x21')]=_0x386b51['length'];if(_0x5b8c69[_0x38ce('0x21')]===0x0)return[];return db[_0x38ce('0x97')][_0x38ce('0x3c')](_0x5a689b['toString'](),_0x384671)['then'](function(_0x4fa65f){_0x30cfe3=_[_0x38ce('0x99')](_0x4fa65f,'id');_0x384671=_[_0x38ce('0x9a')](_0x384671,{'model':db[_0x38ce('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d7f64[_0x38ce('0x3c')][_0x38ce('0x42')]){_0x2297e5[_0x38ce('0x40')][_0x38ce('0x33')](function(_0x345ba4){_0x502430[_0x38ce('0x4b')]('i.'+_0x345ba4);});}else{_0x502430[_0x38ce('0x4b')](_0x38ce('0x9b'),_0x38ce('0x61'));_0x502430[_0x38ce('0x4b')](_0x38ce('0x9c'),_0x38ce('0x9d'));_0x502430[_0x38ce('0x4b')](_0x38ce('0x9e'),_0x38ce('0x9f'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xa0'));_0x502430['field'](_0x38ce('0xa1'),_0x38ce('0xa2'));_0x502430[_0x38ce('0x4b')]('c.lastName',_0x38ce('0xa3'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xa4'),_0x38ce('0xa5'));_0x502430['field'](_0x38ce('0xa6'),_0x38ce('0xa7'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xa8'),'Contact.mobile');_0x502430[_0x38ce('0x4b')](_0x38ce('0xa9'),_0x38ce('0xaa'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xab'),_0x38ce('0xac'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xad'),_0x38ce('0xae'));_0x502430[_0x38ce('0x4b')](_0x38ce('0xaf'),_0x38ce('0x30'));}if(_0x2297e5['limit'])_0x502430[_0x38ce('0x45')](_0x2297e5[_0x38ce('0x45')]);if(_0x2297e5[_0x38ce('0x22')])_0x502430[_0x38ce('0x22')](_0x2297e5[_0x38ce('0x22')]);return db['sequelize']['query'](_0x502430[_0x38ce('0x98')](),_0x384671);})['then'](function(_0xed7dcc){_0x24cf78[_0x38ce('0x48')]('ui.SmsInteractionId\x20IN\x20?',_[_0x38ce('0x2f')](_0xed7dcc,'id'));return db[_0x38ce('0x97')]['query'](_0x24cf78[_0x38ce('0x98')](),_0x384671)[_0x38ce('0x2a')](function(_0x20db5f){var _0x3dc4e5=_[_0x38ce('0xb0')](_0x20db5f,_0x38ce('0xb1'));var _0x5b6014=[];_0xed7dcc[_0x38ce('0x33')](function(_0x2077ca){_0x5b6014['push'](updateSmsInteraction(_0x2077ca,_0x30cfe3,_0x3dc4e5));});return BPromise['all'](_0x5b6014);});});})[_0x38ce('0x2a')](function(_0x576530){_0x5b8c69[_0x38ce('0xb2')]=_0x576530;return _0x5b8c69;})[_0x38ce('0x2a')](respondWithFilteredResult(_0x54050a,_0x2297e5));})[_0x38ce('0x35')](handleError(_0x54050a,null));};exports[_0x38ce('0xb3')]=function(_0x1eab01,_0x20e6a4){var _0x46f224={'raw':![],'where':{'id':_0x1eab01[_0x38ce('0xb4')]['id']}},_0x4df3d5={};_0x4df3d5[_0x38ce('0x3f')]=_[_0x38ce('0x3d')](db['SmsInteraction'][_0x38ce('0x38')]);_0x4df3d5['query']=_[_0x38ce('0x3d')](_0x1eab01[_0x38ce('0x3c')]);_0x4df3d5['filters']=_['intersection'](_0x4df3d5[_0x38ce('0x3f')],_0x4df3d5['query']);_0x46f224[_0x38ce('0x40')]=_[_0x38ce('0x41')](_0x4df3d5[_0x38ce('0x3f')],qs[_0x38ce('0x42')](_0x1eab01[_0x38ce('0x3c')]['fields']));_0x46f224[_0x38ce('0x40')]=_0x46f224[_0x38ce('0x40')][_0x38ce('0x43')]?_0x46f224['attributes']:_0x4df3d5['model'];if(_0x1eab01[_0x38ce('0x3c')][_0x38ce('0xb5')]){_0x46f224[_0x38ce('0xb6')]=[{'all':!![]}];}_0x46f224=_[_0x38ce('0x9a')]({},_0x46f224,_0x1eab01['options']);return db[_0x38ce('0x37')][_0x38ce('0x60')](_0x46f224)[_0x38ce('0x2a')](handleEntityNotFound(_0x20e6a4,null))[_0x38ce('0x2a')](respondWithResult(_0x20e6a4,null))['catch'](handleError(_0x20e6a4,null));};exports[_0x38ce('0xb7')]=function(_0x27fd03,_0x5d61ab){return db[_0x38ce('0x37')]['create'](_0x27fd03[_0x38ce('0x73')],{})['then'](respondWithResult(_0x5d61ab,0xc9))[_0x38ce('0x35')](handleError(_0x5d61ab,null));};exports[_0x38ce('0x29')]=function(_0x53d474,_0x192b69){if(_0x53d474['body']['id']){delete _0x53d474[_0x38ce('0x73')]['id'];}return db[_0x38ce('0x37')]['find']({'where':{'id':_0x53d474[_0x38ce('0xb4')]['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0x192b69,null))['then'](saveUpdates(_0x53d474['body'],null))[_0x38ce('0x2a')](respondWithResult(_0x192b69,null))['catch'](handleError(_0x192b69,null));};exports['destroy']=function(_0x354543,_0x4390bc){return db[_0x38ce('0x37')]['find']({'where':{'id':_0x354543[_0x38ce('0xb4')]['id']}})['then'](handleEntityNotFound(_0x4390bc,null))['then'](removeEntity(_0x4390bc,null))['catch'](handleError(_0x4390bc,null));};exports[_0x38ce('0xb8')]=function(_0x4f1c7e,_0x33dafc){return db[_0x38ce('0x37')][_0x38ce('0xb8')]()[_0x38ce('0x2a')](respondWithResult(_0x33dafc,null))['catch'](handleError(_0x33dafc,null));};exports[_0x38ce('0xb9')]=function(_0x2ef91e,_0xdca2f3,_0x3c98ae){return db[_0x38ce('0xba')][_0x38ce('0x60')]({'where':{'id':_0x2ef91e['params']['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0xdca2f3,null))['then'](function(_0x454596){if(_0x454596){return _0x454596[_0x38ce('0xb9')](_0x2ef91e[_0x38ce('0x73')][_0x38ce('0xbb')],_[_0x38ce('0xbc')](_0x2ef91e[_0x38ce('0x73')],[_0x38ce('0xbb'),'id'])||{});}})['then'](respondWithResult(_0xdca2f3,null))[_0x38ce('0x35')](handleError(_0xdca2f3,null));};exports[_0x38ce('0xbd')]=function(_0x4f2542,_0x32c0dd,_0x31ddf7){var _0x57ca62={'raw':![],'where':{}};var _0x14811b={};var _0x20f9bf={'count':0x0,'rows':[]};return db[_0x38ce('0x37')]['findOne']({'where':{'id':_0x4f2542[_0x38ce('0xb4')]['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0x32c0dd,null))['then'](function(_0x2faf1e){if(_0x2faf1e){_0x14811b['model']=_[_0x38ce('0x3d')](db['SmsMessage'][_0x38ce('0x38')]);_0x14811b[_0x38ce('0x3c')]=_['keys'](_0x4f2542[_0x38ce('0x3c')]);_0x14811b[_0x38ce('0x3e')]=_[_0x38ce('0x41')](_0x14811b[_0x38ce('0x3f')],_0x14811b['query']);_0x57ca62[_0x38ce('0x40')]=_['intersection'](_0x14811b[_0x38ce('0x3f')],qs[_0x38ce('0x42')](_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x42')]));_0x57ca62[_0x38ce('0x40')]=_0x57ca62[_0x38ce('0x40')][_0x38ce('0x43')]?_0x57ca62['attributes']:_0x14811b[_0x38ce('0x3f')];if(!_0x4f2542['query'][_0x38ce('0x44')](_0x38ce('0xbe'))){_0x57ca62[_0x38ce('0x45')]=qs['limit'](_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x45')]);_0x57ca62[_0x38ce('0x22')]=qs[_0x38ce('0x22')](_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x22')]);}_0x57ca62[_0x38ce('0x46')]=qs[_0x38ce('0x47')](_0x4f2542[_0x38ce('0x3c')]['sort']);_0x57ca62[_0x38ce('0x48')]=qs[_0x38ce('0x3e')](_[_0x38ce('0x49')](_0x4f2542[_0x38ce('0x3c')],_0x14811b[_0x38ce('0x3e')]));_0x57ca62['where'][_0x38ce('0xb1')]=_0x2faf1e['id'];if(_0x4f2542['query'][_0x38ce('0x86')]){_0x57ca62['where']=_[_0x38ce('0x9a')](_0x57ca62[_0x38ce('0x48')],{'$or':_[_0x38ce('0x2f')](_0x57ca62[_0x38ce('0x40')],function(_0x2b67af){var _0x283d90={};_0x283d90[_0x2b67af]={'$like':'%'+_0x4f2542['query'][_0x38ce('0x86')]+'%'};return _0x283d90;})});}if(_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x7b')]){var _0x569641=_0x4f2542[_0x38ce('0x3c')][_0x38ce('0x7b')][_0x38ce('0x32')](',');var _0x2a8203={};_0x2a8203[_0x569641[0x0]]={'$gte':moment(_0x569641[0x1])['format'](_0x38ce('0xbf'))};_0x57ca62['where']=_[_0x38ce('0x9a')](_0x57ca62[_0x38ce('0x48')],_0x2a8203);}_0x57ca62=_[_0x38ce('0x9a')]({},_0x57ca62,_0x4f2542[_0x38ce('0xc0')]);return db[_0x38ce('0xba')]['count']({'where':_0x57ca62[_0x38ce('0x48')]})[_0x38ce('0x2a')](function(_0x3da4c7){_0x20f9bf['count']=_0x3da4c7;if(_0x4f2542[_0x38ce('0x3c')][_0x38ce('0xb5')]){_0x57ca62['include']=[{'all':!![]}];}return db['SmsMessage'][_0x38ce('0xc1')](_0x57ca62);})[_0x38ce('0x2a')](function(_0x3d8dec){_0x20f9bf[_0x38ce('0xb2')]=_0x3d8dec;return _0x20f9bf;});}})['then'](respondWithFilteredResult(_0x32c0dd,_0x57ca62))[_0x38ce('0x35')](handleError(_0x32c0dd,null));};exports['addTags']=function(_0x4b0a3b,_0x37572e,_0x420457){return db[_0x38ce('0x37')][_0x38ce('0x60')]({'where':{'id':_0x4b0a3b['params']['id']}})['then'](handleEntityNotFound(_0x37572e,null))[_0x38ce('0x2a')](function(_0x162f5d){if(_0x162f5d){return _0x162f5d[_0x38ce('0xc2')](_0x4b0a3b[_0x38ce('0x73')]['ids'],_['omit'](_0x4b0a3b[_0x38ce('0x73')],[_0x38ce('0xbb'),'id'])||{})[_0x38ce('0xc3')](function(){return db[_0x38ce('0x6e')][_0x38ce('0xc1')]({'attributes':['id',_0x38ce('0x2d'),_0x38ce('0x4c')],'where':{'id':_0x4b0a3b[_0x38ce('0x73')]['ids']}});})[_0x38ce('0x2a')](function(_0x1c0372){socket['emit'](_0x38ce('0xc4'),{'id':Number(_0x4b0a3b[_0x38ce('0xb4')]['id']),'tags':_0x1c0372||[]});return{'id':Number(_0x4b0a3b[_0x38ce('0xb4')]['id']),'tags':_0x1c0372||[]};});}})[_0x38ce('0x2a')](respondWithResult(_0x37572e,null))['catch'](handleError(_0x37572e,null));};exports['removeTags']=function(_0x4a528f,_0x167030,_0x5af247){return db['SmsInteraction'][_0x38ce('0x60')]({'where':{'id':_0x4a528f[_0x38ce('0xb4')]['id']}})[_0x38ce('0x2a')](handleEntityNotFound(_0x167030,null))[_0x38ce('0x2a')](function(_0x302600){if(_0x302600){return _0x302600[_0x38ce('0xc5')](_0x4a528f[_0x38ce('0x3c')][_0x38ce('0xbb')]);}})['then'](respondWithStatusCode(_0x167030,null))[_0x38ce('0x35')](handleError(_0x167030,null));};exports[_0x38ce('0xc6')]=function(_0x1042a4,_0x2f843b){var _0x1e976f=moment()[_0x38ce('0xc7')]()['toString']();var _0x1be555=path[_0x38ce('0xc8')](config['root'],_0x38ce('0xc9'),'files',_0x38ce('0xca'));var _0x45680c=path[_0x38ce('0xc8')](config[_0x38ce('0xcb')],_0x38ce('0xc9'),_0x38ce('0xcc'),_0x38ce('0xcd'));var _0x4439b2=path['join'](_0x1be555,_0x1e976f);var _0xeec46=util[_0x38ce('0xce')](_0x38ce('0xcf'),_0x1042a4[_0x38ce('0xb4')]['id'],_0x1e976f);var _0x25072b=path['join'](_0x1be555,_0xeec46);var _0x2f8251=[];_0x2f8251[_0x38ce('0x34')]({'model':db[_0x38ce('0xd0')],'as':'User','attributes':['id',_0x38ce('0xd1')],'raw':!![]});_0x2f8251['push']({'model':db['CmContact'],'as':_0x38ce('0x65'),'attributes':['id',_0x38ce('0xd2'),_0x38ce('0xd3')],'raw':!![]});var _0x27f880=[{'model':db[_0x38ce('0xba')],'as':_0x38ce('0xd4'),'attributes':['id',_0x38ce('0x73'),_0x38ce('0x79'),_0x38ce('0xd5'),_0x38ce('0xd6'),'read'],'include':_0x2f8251}];_0x27f880[_0x38ce('0x34')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x27f880[_0x38ce('0x34')]({'model':db[_0x38ce('0xd0')],'as':_0x38ce('0xd7'),'attributes':['id',_0x38ce('0xd1')]});return db[_0x38ce('0x37')]['find']({'where':{'id':_0x1042a4[_0x38ce('0xb4')]['id']},'include':_0x27f880})['then'](handleEntityNotFound(_0x2f843b,null))['then'](function(_0x599fa7){if(_0x599fa7){var _0x279799=_0x599fa7[_0x38ce('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x4439b2);var _0x2686f2={'format':'A4','border':_0x38ce('0xd9'),'header':{'height':_0x38ce('0xda'),'contents':{'first':_0x38ce('0xdb')}},'footer':{'height':_0x38ce('0xdc'),'contents':{'default':util[_0x38ce('0xce')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x38ce('0xdd'),_0x38ce('0xde'),_0x279799['id']),moment()[_0x38ce('0xce')](_0x38ce('0xdf'))['toString']())}}};var _0x461da3={'channel':_0x38ce('0xde'),'account':_0x279799[_0x38ce('0xe0')]['name'],'agent':_0x279799[_0x38ce('0xd7')]?_0x279799['Owner'][_0x38ce('0xd1')]:_0x38ce('0xe1'),'createdAt':moment(_0x279799['createdAt'])['format'](_0x38ce('0xbf'))[_0x38ce('0x98')](),'closedAt':_0x279799[_0x38ce('0xe2')]?moment(_0x279799[_0x38ce('0xe3')])[_0x38ce('0xce')](_0x38ce('0xbf'))[_0x38ce('0x98')]():'','disposition':_0x279799[_0x38ce('0xe4')],'messages':_(_0x279799[_0x38ce('0xd4')])[_0x38ce('0x86')]({'secret':![]})['map'](function(_0x5bb7e5){return{'date':moment(_0x5bb7e5[_0x38ce('0x79')])[_0x38ce('0xce')](_0x38ce('0xbf'))[_0x38ce('0x98')](),'sender':_0x5bb7e5[_0x38ce('0xd5')]===_0x38ce('0xe5')?_0x5bb7e5[_0x38ce('0xd0')]?_0x5bb7e5[_0x38ce('0xd0')][_0x38ce('0xd1')]:_0x38ce('0xe6'):_0x5bb7e5['Contact'][_0x38ce('0xd2')]+(_0x5bb7e5[_0x38ce('0x65')][_0x38ce('0xd3')]?'\x20'+_0x5bb7e5['Contact'][_0x38ce('0xd3')]:''),'body':_0x5bb7e5[_0x38ce('0x73')],'direction':_0x5bb7e5[_0x38ce('0xd5')]===_0x38ce('0xe5')?'A':'C','secret':_0x5bb7e5['secret'],'read':_0x5bb7e5['read']};})['value']()};return ejs[_0x38ce('0xe7')](path[_0x38ce('0xc8')](config[_0x38ce('0xcb')],'server',_0x38ce('0xe8'),'downloadInteraction.html'),{'interaction':_0x461da3})[_0x38ce('0x2a')](function(_0xd94aeb){return new BPromise(function(_0x27dde5,_0x169908){pdf[_0x38ce('0xb7')](_0xd94aeb,_0x2686f2)['toFile'](path[_0x38ce('0xc8')](_0x4439b2,'transcript-'+_0x279799['id']+'-'+_0x1e976f+_0x38ce('0xe9')),function(_0x292bb6,_0x317bf0){if(_0x292bb6)return _0x169908(_0x292bb6);_0x27dde5(_0x317bf0);});});})['then'](function(){return new BPromise(function(_0x4c6b80,_0x55050e){zipdir(_0x4439b2,{'saveTo':_0x25072b},function(_0x2bc199,_0x3d6817){if(_0x2bc199)return _0x55050e(_0x2bc199);return _0x4c6b80(_0x3d6817);});})[_0x38ce('0x2a')](function(){return new BPromise(function(_0x436315,_0x293123){rimraf(_0x4439b2,function(_0x182abc){if(_0x182abc)_0x293123(_0x182abc);return _0x436315();});});})[_0x38ce('0x2a')](function(){return _0x2f843b[_0x38ce('0xc6')](_0x25072b,_0xeec46,function(_0x585c9f){if(_0x585c9f){console[_0x38ce('0xea')](_0x38ce('0xeb'),_0x585c9f);}else{fs[_0x38ce('0xec')](_0x25072b);}});});});}else{return _0x2f843b['sendStatus'](0xc8);}})[_0x38ce('0x35')](handleError(_0x2f843b,null));}; \ No newline at end of file +var _0x41bb=['reject','save','update','then','destroy','stack','name','send','Users','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','from','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','map','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','isEmpty','SmsAccountId','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','toString','count','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','include','options','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','join','server','tmp','files','attachments','format','fullname','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','apply'];(function(_0x13e2df,_0x376a54){var _0x2d7086=function(_0x1264f4){while(--_0x1264f4){_0x13e2df['push'](_0x13e2df['shift']());}};_0x2d7086(++_0x376a54);}(_0x41bb,0xc5));var _0xb41b=function(_0x32559d,_0x341473){_0x32559d=_0x32559d-0x0;var _0x466cf9=_0x41bb[_0x32559d];return _0x466cf9;};'use strict';var pdf=require(_0xb41b('0x0'));var emlformat=require(_0xb41b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb41b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb41b('0x3'));var moment=require(_0xb41b('0x4'));var BPromise=require(_0xb41b('0x5'));var Mustache=require(_0xb41b('0x6'));var util=require('util');var path=require(_0xb41b('0x7'));var sox=require(_0xb41b('0x8'));var csv=require(_0xb41b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0xa'));var jsforce=require(_0xb41b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb41b('0x9'));var querystring=require(_0xb41b('0xc'));var Papa=require(_0xb41b('0xd'));var Redis=require(_0xb41b('0xe'));var authService=require(_0xb41b('0xf'));var qs=require(_0xb41b('0x10'));var as=require(_0xb41b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb41b('0x12'))('api');var utils=require(_0xb41b('0x13'));var config=require(_0xb41b('0x14'));var db=require(_0xb41b('0x15'))['db'];config[_0xb41b('0x16')]=_[_0xb41b('0x17')](config['redis'],{'host':_0xb41b('0x18'),'port':0x18eb});var socket=require(_0xb41b('0x19'))(new Redis(config[_0xb41b('0x16')]));require(_0xb41b('0x1a'))[_0xb41b('0x1b')](socket);function respondWithStatusCode(_0x4e8603,_0x4e7f11){_0x4e7f11=_0x4e7f11||0xcc;return function(_0x55e507){if(_0x55e507){return _0x4e8603[_0xb41b('0x1c')](_0x4e7f11);}return _0x4e8603[_0xb41b('0x1d')](_0x4e7f11)[_0xb41b('0x1e')]();};}function respondWithResult(_0x338920,_0x29ea51){_0x29ea51=_0x29ea51||0xc8;return function(_0x54591e){if(_0x54591e){return _0x338920[_0xb41b('0x1d')](_0x29ea51)[_0xb41b('0x1f')](_0x54591e);}};}function respondWithFilteredResult(_0x401dd9,_0xcf0728){return function(_0x43f4ea){if(_0x43f4ea){var _0x47154d=_0x43f4ea['count'],_0x198783=_0xcf0728[_0xb41b('0x20')],_0x5df8c2=_0xcf0728['offset']+_0xcf0728[_0xb41b('0x21')],_0x4b3580;if(_0x5df8c2>=_0x47154d){_0x5df8c2=_0x47154d;_0x4b3580=0xc8;}else{_0x4b3580=0xce;}_0x401dd9[_0xb41b('0x1d')](_0x4b3580);return _0x401dd9[_0xb41b('0x22')]('Content-Range',_0x198783+'-'+_0x5df8c2+'/'+_0x47154d)['json'](_0x43f4ea);}return null;};}function patchUpdates(_0x1a1386){return function(_0x3b6ffb){try{jsonpatch[_0xb41b('0x23')](_0x3b6ffb,_0x1a1386,!![]);}catch(_0x2373f4){return BPromise[_0xb41b('0x24')](_0x2373f4);}return _0x3b6ffb[_0xb41b('0x25')]();};}function saveUpdates(_0x4c73da,_0x58f149){return function(_0x2b436f){if(_0x2b436f){return _0x2b436f[_0xb41b('0x26')](_0x4c73da)[_0xb41b('0x27')](function(_0x583741){return _0x583741;});}return null;};}function removeEntity(_0x14e9c8,_0x2441d6){return function(_0x546101){if(_0x546101){return _0x546101[_0xb41b('0x28')]()[_0xb41b('0x27')](function(){_0x14e9c8['status'](0xcc)[_0xb41b('0x1e')]();});}};}function handleEntityNotFound(_0x4a7992,_0x2d0f27){return function(_0x4c6a91){if(!_0x4c6a91){_0x4a7992['sendStatus'](0x194);}return _0x4c6a91;};}function handleError(_0x3af2c,_0x4265b8){_0x4265b8=_0x4265b8||0x1f4;return function(_0x583099){logger['error'](_0x583099[_0xb41b('0x29')]);if(_0x583099[_0xb41b('0x2a')]){delete _0x583099[_0xb41b('0x2a')];}_0x3af2c[_0xb41b('0x1d')](_0x4265b8)[_0xb41b('0x2b')](_0x583099);};}function getInteractionUsers(_0x181cbd,_0x253efb){return new BPromise(function(_0x545395,_0x26ef96){try{if(_0x253efb[_0x181cbd['id']]){_0x181cbd[_0xb41b('0x2c')]=_['map'](_0x253efb[_0x181cbd['id']],function(_0xe64568){return{'id':_0xe64568['id'],'fullname':_0xe64568['fullname']};});}}catch(_0x38277f){_0x26ef96(_0x38277f);}_0x545395(_0x181cbd);});}function getInteractionTags(_0x31d4cd,_0x597a35){return new BPromise(function(_0x23a6ed,_0x4a95e7){try{if(_0x31d4cd[_0xb41b('0x2d')]){_0x31d4cd[_0xb41b('0x2e')]=[];_0x31d4cd['TagIds'][_0xb41b('0x2f')](',')[_0xb41b('0x30')](function(_0x14c2e7){_0x31d4cd[_0xb41b('0x2e')][_0xb41b('0x31')](_0x597a35[_0x14c2e7]);});}delete _0x31d4cd[_0xb41b('0x2d')];}catch(_0x157048){_0x4a95e7(_0x157048);}_0x23a6ed(_0x31d4cd);});}function updateSmsInteraction(_0x3de167,_0x29ad07,_0x4464d6){return new BPromise(function(_0x4c3585,_0x976d56){return getInteractionUsers(_0x3de167,_0x4464d6)['then'](function(_0x4cb8ee){return getInteractionTags(_0x4cb8ee,_0x29ad07);})[_0xb41b('0x27')](function(_0x192ceb){_0x4c3585(_0x192ceb);})[_0xb41b('0x32')](function(_0x18e70e){_0x976d56(_0x18e70e);});});}exports[_0xb41b('0x33')]=function(_0xe204e4,_0x1de31b){var _0x197197={},_0x1e2b1e={},_0x1d3e90={'count':0x0,'rows':[]};var _0x3a06a0=_['map'](db[_0xb41b('0x34')][_0xb41b('0x35')],function(_0x2f95b9){return{'name':_0x2f95b9[_0xb41b('0x36')],'type':_0x2f95b9[_0xb41b('0x37')][_0xb41b('0x38')]};});_0x1e2b1e['model']=_['map'](_0x3a06a0,_0xb41b('0x2a'));_0x1e2b1e[_0xb41b('0x39')]=_['keys'](_0xe204e4[_0xb41b('0x39')]);_0x1e2b1e[_0xb41b('0x3a')]=_[_0xb41b('0x3b')](_0x1e2b1e[_0xb41b('0x3c')],_0x1e2b1e[_0xb41b('0x39')]);_0x197197['attributes']=_[_0xb41b('0x3b')](_0x1e2b1e['model'],qs[_0xb41b('0x3d')](_0xe204e4[_0xb41b('0x39')][_0xb41b('0x3d')]));_0x197197[_0xb41b('0x3e')]=_0x197197[_0xb41b('0x3e')][_0xb41b('0x3f')]?_0x197197[_0xb41b('0x3e')]:_0x1e2b1e[_0xb41b('0x3c')];if(!_0xe204e4[_0xb41b('0x39')]['hasOwnProperty']('nolimit')){_0x197197['limit']=qs[_0xb41b('0x21')](_0xe204e4['query']['limit']);_0x197197[_0xb41b('0x20')]=qs['offset'](_0xe204e4[_0xb41b('0x39')][_0xb41b('0x20')]);}_0x197197[_0xb41b('0x40')]=qs[_0xb41b('0x41')](_0xe204e4[_0xb41b('0x39')][_0xb41b('0x41')]);_0x197197[_0xb41b('0x42')]=qs['filters'](_[_0xb41b('0x43')](_0xe204e4[_0xb41b('0x39')],_0x1e2b1e[_0xb41b('0x3a')]),_0x3a06a0);var _0x174d6c=[];var _0x47bab5=squel[_0xb41b('0x44')]()['field']('id')[_0xb41b('0x45')](_0xb41b('0x2a'))[_0xb41b('0x45')]('color')['from'](_0xb41b('0x46'));var _0x28ea6f=squel[_0xb41b('0x44')]()[_0xb41b('0x45')](_0xb41b('0x47'))[_0xb41b('0x45')](_0xb41b('0x48'))['field']('ui.SmsInteractionId')[_0xb41b('0x49')]('user_has_sms_interactions','ui')[_0xb41b('0x4a')]('users','u',_0xb41b('0x4b'));var _0x4973a7=squel[_0xb41b('0x44')]()['from'](_0xb41b('0x4c'),'i')[_0xb41b('0x4a')](_0xb41b('0x4d'),'c',_0xb41b('0x4e'))['left_join'](_0xb41b('0x4f'),'o',_0xb41b('0x50'))['left_join'](_0xb41b('0x51'),'a','a.id\x20=\x20i.SmsAccountId')['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0xb41b('0x4a')](_0xb41b('0x52'),'it',_0xb41b('0x53'))[_0xb41b('0x4a')](_0xb41b('0x46'),'t',_0xb41b('0x54'));var _0x34d076=squel[_0xb41b('0x55')]();var _0x1913b4=[];var _0x226031=squel[_0xb41b('0x55')]();var _0x38886a;if(_0xe204e4[_0xb41b('0x39')][_0xb41b('0x56')]){_0x38886a=as[_0xb41b('0x57')](_0xe204e4[_0xb41b('0x39')]['search']);var _0x2398f8=_0x38886a['sqlOperator'];for(var _0x4a7aa3=0x0;_0x4a7aa3<_0x38886a[_0xb41b('0x58')][_0xb41b('0x3f')];_0x4a7aa3++){var _0x2c6fc2=_0x38886a[_0xb41b('0x58')][_0x4a7aa3];var _0xb599eb='i';var _0x309bc1=_[_0xb41b('0x59')](_0x3a06a0,[_0xb41b('0x2a'),_0x2c6fc2[_0xb41b('0x45')]]);if(!_0x309bc1){switch(_0x2c6fc2[_0xb41b('0x45')]){case _0xb41b('0x5a'):if(_0x2c6fc2[_0xb41b('0x5b')]==0x1){_0x4973a7[_0xb41b('0x5c')]('`'+_0x2c6fc2[_0xb41b('0x45')]+_0xb41b('0x5d'));}else{_0x4973a7[_0xb41b('0x5c')]('`'+_0x2c6fc2[_0xb41b('0x45')]+_0xb41b('0x5e'));}break;case _0xb41b('0x5f'):if(_0x2c6fc2[_0xb41b('0x60')]===_0xb41b('0x61')){if(_0x2c6fc2['value'][_0xb41b('0x2f')]('\x20')['length']>0x1){_0x34d076[_0x2398f8](_0xb41b('0x62'),qs[_0xb41b('0x63')](_0x2c6fc2[_0xb41b('0x5b')]),null);}else{var _0x29df34='%'+_0x2c6fc2[_0xb41b('0x5b')]+'%';_0x34d076[_0x2398f8](_0xb41b('0x64'),_0x29df34,_0x29df34,_0x29df34);}}else{_0x309bc1=_[_0xb41b('0x59')](_0x3a06a0,['name',_0xb41b('0x65')]);_0x2c6fc2[_0xb41b('0x45')]=_0xb41b('0x65');_0x9bae17=as['buildExpression'](_0xb599eb,_0x309bc1[_0xb41b('0x37')],_0x2c6fc2);_0x34d076[_0x2398f8](_0x9bae17[_0xb41b('0x66')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x67')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x1e')]);}break;case _0xb41b('0x68'):var _0x540763=_0x2c6fc2['value'][_0xb41b('0x2f')](',')[_0xb41b('0x69')](function(_0x50d28c){return Number(_0x50d28c);});_0x540763[_0xb41b('0x30')](function(_0x285099){_0x226031['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x285099+',%');});_0x1913b4=_[_0xb41b('0x6a')](_0x1913b4,_0x540763);break;case _0xb41b('0x6b'):if(_0x2c6fc2[_0xb41b('0x60')]===_0xb41b('0x61')){_0x34d076[_0x2398f8](_0xb41b('0x6c'),'%'+_0x2c6fc2[_0xb41b('0x5b')]+'%',null);}else{_0x309bc1=_[_0xb41b('0x59')](_0x3a06a0,[_0xb41b('0x2a'),_0xb41b('0x6d')]);_0x2c6fc2[_0xb41b('0x45')]='UserId';_0x9bae17=as[_0xb41b('0x6e')](_0xb599eb,_0x309bc1[_0xb41b('0x37')],_0x2c6fc2);_0x34d076[_0x2398f8](_0x9bae17['text'],_0x9bae17['value'][_0xb41b('0x67')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x1e')]);}break;case'body':_0x9bae17=as[_0xb41b('0x6e')]('me',null,_0x2c6fc2);_0x34d076[_0x2398f8](_0x9bae17[_0xb41b('0x66')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x67')],_0x9bae17[_0xb41b('0x5b')][_0xb41b('0x1e')]);break;}}else{var _0x9bae17=as[_0xb41b('0x6e')](_0xb599eb,_0x309bc1[_0xb41b('0x37')],_0x2c6fc2);_0x34d076[_0x2398f8](_0x9bae17[_0xb41b('0x66')],_0x9bae17['value'][_0xb41b('0x67')],_0x9bae17[_0xb41b('0x5b')]['end']);}}}else{var _0x2a46ff=_(_0xe204e4[_0xb41b('0x39')])[_0xb41b('0x6f')]()['map'](function(_0x23b64e){return _[_0xb41b('0x70')](_0x3a06a0,[_0xb41b('0x2a'),_0x23b64e])?_0x23b64e:undefined;})[_0xb41b('0x71')]()[_0xb41b('0x5b')]();if(!_[_0xb41b('0x72')](_0x2a46ff)){_0x2a46ff[_0xb41b('0x30')](function(_0x4367ee){if(_0x4367ee===_0xb41b('0x73')){_0x4973a7[_0xb41b('0x42')]('i.SmsAccountId\x20IN\x20?',[]['concat'](_0xe204e4['query'][_0x4367ee]));}else if(_0x4367ee==='createdAt'){var _0x273b89=JSON[_0xb41b('0x74')](_0xe204e4[_0xb41b('0x39')][_0x4367ee])[_0xb41b('0x75')];var _0x46eed9=JSON[_0xb41b('0x74')](_0xe204e4['query'][_0x4367ee])[_0xb41b('0x76')];_0x4973a7['where'](_0xb41b('0x77'),_0x273b89,_0x46eed9);}else{if(_0xe204e4['query'][_0x4367ee]===_0xb41b('0x78')){_0x4973a7['where']('i.'+_0x4367ee+_0xb41b('0x79'));}else{_0x4973a7[_0xb41b('0x42')]('i.'+_0x4367ee+'\x20=\x20?',_0xe204e4[_0xb41b('0x39')][_0x4367ee]);}}});}if(_0xe204e4[_0xb41b('0x39')][_0xb41b('0x7a')]){if(_0xe204e4[_0xb41b('0x39')][_0xb41b('0x7a')]==0x1){_0x4973a7[_0xb41b('0x5c')](_0xb41b('0x7b'));}else{_0x4973a7['having'](_0xb41b('0x7c'));}}if(_0xe204e4['query'][_0xb41b('0x7d')]){_0x1913b4=_[_0xb41b('0x7e')](_0xe204e4[_0xb41b('0x39')]['tag'])?_0xe204e4['query']['tag']:new Array(_0xe204e4['query'][_0xb41b('0x7d')]);_0x1913b4[_0xb41b('0x30')](function(_0x3523ca){_0x226031['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3523ca+',%');});}if(_0xe204e4['query'][_0xb41b('0x7f')]){var _0x339c04=_0xe204e4[_0xb41b('0x39')][_0xb41b('0x7f')][_0xb41b('0x80')]('\x5c','\x5c\x5c')[_0xb41b('0x80')]('\x27\x27',_0xb41b('0x81'));if(qs['isNumeric'](_0x339c04)){_0x34d076['or']('i.id\x20LIKE\x20?',_0x339c04+'%')['or'](_0xb41b('0x82'),_0x339c04+'%');}else{_0x34d076['or'](_0xb41b('0x83'),qs['getFullTextValue'](_0x339c04))['or'](_0xb41b('0x84'),_0x339c04+'%');}}}_0x4973a7['where'](_0x34d076);_0x4973a7[_0xb41b('0x85')](_0xb41b('0x86'));var _0x5b2022={'type':db[_0xb41b('0x87')][_0xb41b('0x88')]['SELECT'],'raw':!![]};var _0x585d7c=_0x4973a7[_0xb41b('0x89')]();_0x585d7c[_0xb41b('0x45')]('i.id');_0x585d7c[_0xb41b('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb41b('0x5a'));if(_0x197197[_0xb41b('0x40')]){_0x197197['order']['forEach'](function(_0x468899){_0x4973a7[_0xb41b('0x40')]('i.'+_0x468899[0x0],_0x468899[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb41b('0x72')](_0x1913b4)){_0x4973a7[_0xb41b('0x5c')](_0x226031);_0x585d7c[_0xb41b('0x42')]('t.id\x20IN\x20?',_0x1913b4);}BPromise[_0xb41b('0x8a')]()['then'](function(){if(!_0x38886a){if(_0xe204e4['query'][_0xb41b('0x73')]||_0xe204e4[_0xb41b('0x39')][_0xb41b('0x8b')])return;_0x585d7c[_0xb41b('0x42')](_0xb41b('0x8c'));_0x4973a7[_0xb41b('0x42')](_0xb41b('0x8c'));return;}return _0xe204e4[_0xb41b('0x8d')][_0xb41b('0x8e')]({'attributes':['id'],'raw':!![]})[_0xb41b('0x27')](function(_0x2a10ca){if(_[_0xb41b('0x72')](_0x2a10ca)){_0x585d7c[_0xb41b('0x42')]('i.SmsAccountId\x20IS\x20NULL');_0x4973a7[_0xb41b('0x42')](_0xb41b('0x8f'));}else{_0x585d7c[_0xb41b('0x42')](_0xb41b('0x90'),_[_0xb41b('0x69')](_0x2a10ca,'id'));_0x4973a7[_0xb41b('0x42')](_0xb41b('0x90'),_[_0xb41b('0x69')](_0x2a10ca,'id'));}});})['then'](function(){db['sequelize'][_0xb41b('0x39')](_0x585d7c[_0xb41b('0x91')](),_0x5b2022)[_0xb41b('0x27')](function(_0x5af045){_0x1d3e90[_0xb41b('0x92')]=_0x5af045[_0xb41b('0x3f')];if(_0x1d3e90['count']===0x0)return[];return db[_0xb41b('0x93')][_0xb41b('0x39')](_0x47bab5['toString'](),_0x5b2022)[_0xb41b('0x27')](function(_0x3874d9){_0x174d6c=_[_0xb41b('0x94')](_0x3874d9,'id');_0x5b2022=_[_0xb41b('0x95')](_0x5b2022,{'model':db[_0xb41b('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe204e4[_0xb41b('0x39')][_0xb41b('0x3d')]){_0x197197[_0xb41b('0x3e')][_0xb41b('0x30')](function(_0x5d0535){_0x4973a7['field']('i.'+_0x5d0535);});}else{_0x4973a7[_0xb41b('0x45')](_0xb41b('0x96'),_0xb41b('0x5a'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0x97'),_0xb41b('0x98'));_0x4973a7['field'](_0xb41b('0x99'),_0xb41b('0x9a'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0x9b'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0x9c'),_0xb41b('0x9d'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0x9e'),_0xb41b('0x9f'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0xa0'),_0xb41b('0xa1'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0xa2'),_0xb41b('0xa3'));_0x4973a7['field']('c.mobile','Contact.mobile');_0x4973a7[_0xb41b('0x45')]('c.fax',_0xb41b('0xa4'));_0x4973a7[_0xb41b('0x45')]('o.fullname',_0xb41b('0xa5'));_0x4973a7[_0xb41b('0x45')](_0xb41b('0xa6'),_0xb41b('0xa7'));_0x4973a7[_0xb41b('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb41b('0x2d'));}if(_0x197197[_0xb41b('0x21')])_0x4973a7['limit'](_0x197197['limit']);if(_0x197197[_0xb41b('0x20')])_0x4973a7[_0xb41b('0x20')](_0x197197['offset']);return db[_0xb41b('0x93')][_0xb41b('0x39')](_0x4973a7[_0xb41b('0x91')](),_0x5b2022);})['then'](function(_0x546d2a){_0x28ea6f[_0xb41b('0x42')](_0xb41b('0xa8'),_['map'](_0x546d2a,'id'));return db[_0xb41b('0x93')][_0xb41b('0x39')](_0x28ea6f[_0xb41b('0x91')](),_0x5b2022)['then'](function(_0xb0c791){var _0x205664=_[_0xb41b('0xa9')](_0xb0c791,_0xb41b('0xaa'));var _0x261ca0=[];_0x546d2a[_0xb41b('0x30')](function(_0x33aa9d){_0x261ca0[_0xb41b('0x31')](updateSmsInteraction(_0x33aa9d,_0x174d6c,_0x205664));});return BPromise[_0xb41b('0xab')](_0x261ca0);});});})['then'](function(_0x1f9ca0){_0x1d3e90[_0xb41b('0xac')]=_0x1f9ca0;return _0x1d3e90;})['then'](respondWithFilteredResult(_0x1de31b,_0x197197));})[_0xb41b('0x32')](handleError(_0x1de31b,null));};exports['show']=function(_0x12ffa4,_0x5c421e){var _0x2e3441={'raw':![],'where':{'id':_0x12ffa4[_0xb41b('0xad')]['id']}},_0xccf8d1={};_0xccf8d1[_0xb41b('0x3c')]=_[_0xb41b('0x6f')](db[_0xb41b('0x34')][_0xb41b('0x35')]);_0xccf8d1[_0xb41b('0x39')]=_[_0xb41b('0x6f')](_0x12ffa4['query']);_0xccf8d1[_0xb41b('0x3a')]=_[_0xb41b('0x3b')](_0xccf8d1[_0xb41b('0x3c')],_0xccf8d1[_0xb41b('0x39')]);_0x2e3441['attributes']=_[_0xb41b('0x3b')](_0xccf8d1['model'],qs['fields'](_0x12ffa4[_0xb41b('0x39')][_0xb41b('0x3d')]));_0x2e3441['attributes']=_0x2e3441[_0xb41b('0x3e')][_0xb41b('0x3f')]?_0x2e3441['attributes']:_0xccf8d1[_0xb41b('0x3c')];if(_0x12ffa4['query']['includeAll']){_0x2e3441[_0xb41b('0xae')]=[{'all':!![]}];}_0x2e3441=_[_0xb41b('0x95')]({},_0x2e3441,_0x12ffa4[_0xb41b('0xaf')]);return db[_0xb41b('0x34')]['find'](_0x2e3441)[_0xb41b('0x27')](handleEntityNotFound(_0x5c421e,null))[_0xb41b('0x27')](respondWithResult(_0x5c421e,null))[_0xb41b('0x32')](handleError(_0x5c421e,null));};exports[_0xb41b('0xb0')]=function(_0x513894,_0x14229a){return db[_0xb41b('0x34')][_0xb41b('0xb0')](_0x513894[_0xb41b('0xb1')],{})[_0xb41b('0x27')](respondWithResult(_0x14229a,0xc9))[_0xb41b('0x32')](handleError(_0x14229a,null));};exports[_0xb41b('0x26')]=function(_0x3a5740,_0x538179){if(_0x3a5740[_0xb41b('0xb1')]['id']){delete _0x3a5740[_0xb41b('0xb1')]['id'];}return db[_0xb41b('0x34')][_0xb41b('0x59')]({'where':{'id':_0x3a5740[_0xb41b('0xad')]['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x538179,null))[_0xb41b('0x27')](saveUpdates(_0x3a5740[_0xb41b('0xb1')],null))['then'](respondWithResult(_0x538179,null))[_0xb41b('0x32')](handleError(_0x538179,null));};exports[_0xb41b('0x28')]=function(_0x5881cb,_0x426b65){return db[_0xb41b('0x34')]['find']({'where':{'id':_0x5881cb[_0xb41b('0xad')]['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x426b65,null))[_0xb41b('0x27')](removeEntity(_0x426b65,null))[_0xb41b('0x32')](handleError(_0x426b65,null));};exports[_0xb41b('0xb2')]=function(_0x7066e9,_0x2722cb){return db[_0xb41b('0x34')][_0xb41b('0xb2')]()[_0xb41b('0x27')](respondWithResult(_0x2722cb,null))['catch'](handleError(_0x2722cb,null));};exports[_0xb41b('0xb3')]=function(_0x289057,_0x20ebbb,_0x34d06f){return db['SmsMessage'][_0xb41b('0x59')]({'where':{'id':_0x289057[_0xb41b('0xad')]['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x20ebbb,null))[_0xb41b('0x27')](function(_0x3719b7){if(_0x3719b7){return _0x3719b7[_0xb41b('0xb3')](_0x289057['body'][_0xb41b('0xb4')],_[_0xb41b('0xb5')](_0x289057[_0xb41b('0xb1')],['ids','id'])||{});}})[_0xb41b('0x27')](respondWithResult(_0x20ebbb,null))[_0xb41b('0x32')](handleError(_0x20ebbb,null));};exports[_0xb41b('0xb6')]=function(_0x79d1f5,_0x1db78a,_0x304cfe){var _0x24a75a={'raw':![],'where':{}};var _0xda4444={};var _0xb149a3={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb41b('0xb7')]({'where':{'id':_0x79d1f5['params']['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x1db78a,null))[_0xb41b('0x27')](function(_0x45da0a){if(_0x45da0a){_0xda4444[_0xb41b('0x3c')]=_[_0xb41b('0x6f')](db[_0xb41b('0xb8')][_0xb41b('0x35')]);_0xda4444[_0xb41b('0x39')]=_['keys'](_0x79d1f5[_0xb41b('0x39')]);_0xda4444[_0xb41b('0x3a')]=_[_0xb41b('0x3b')](_0xda4444['model'],_0xda4444['query']);_0x24a75a['attributes']=_[_0xb41b('0x3b')](_0xda4444[_0xb41b('0x3c')],qs[_0xb41b('0x3d')](_0x79d1f5[_0xb41b('0x39')]['fields']));_0x24a75a[_0xb41b('0x3e')]=_0x24a75a[_0xb41b('0x3e')][_0xb41b('0x3f')]?_0x24a75a[_0xb41b('0x3e')]:_0xda4444[_0xb41b('0x3c')];if(!_0x79d1f5[_0xb41b('0x39')][_0xb41b('0xb9')](_0xb41b('0xba'))){_0x24a75a[_0xb41b('0x21')]=qs[_0xb41b('0x21')](_0x79d1f5[_0xb41b('0x39')]['limit']);_0x24a75a['offset']=qs[_0xb41b('0x20')](_0x79d1f5['query'][_0xb41b('0x20')]);}_0x24a75a[_0xb41b('0x40')]=qs[_0xb41b('0x41')](_0x79d1f5[_0xb41b('0x39')][_0xb41b('0x41')]);_0x24a75a[_0xb41b('0x42')]=qs['filters'](_['pick'](_0x79d1f5[_0xb41b('0x39')],_0xda4444[_0xb41b('0x3a')]));_0x24a75a[_0xb41b('0x42')][_0xb41b('0xaa')]=_0x45da0a['id'];if(_0x79d1f5['query']['filter']){_0x24a75a[_0xb41b('0x42')]=_[_0xb41b('0x95')](_0x24a75a[_0xb41b('0x42')],{'$or':_[_0xb41b('0x69')](_0x24a75a[_0xb41b('0x3e')],function(_0x1d55c3){var _0x1ff912={};_0x1ff912[_0x1d55c3]={'$like':'%'+_0x79d1f5[_0xb41b('0x39')][_0xb41b('0x7f')]+'%'};return _0x1ff912;})});}if(_0x79d1f5[_0xb41b('0x39')][_0xb41b('0x75')]){var _0x55cfc8=_0x79d1f5[_0xb41b('0x39')][_0xb41b('0x75')][_0xb41b('0x2f')](',');var _0x3cf3ac={};_0x3cf3ac[_0x55cfc8[0x0]]={'$gte':moment(_0x55cfc8[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x24a75a[_0xb41b('0x42')]=_['merge'](_0x24a75a[_0xb41b('0x42')],_0x3cf3ac);}_0x24a75a=_['merge']({},_0x24a75a,_0x79d1f5['options']);return db[_0xb41b('0xb8')][_0xb41b('0x92')]({'where':_0x24a75a[_0xb41b('0x42')]})[_0xb41b('0x27')](function(_0x3437ed){_0xb149a3[_0xb41b('0x92')]=_0x3437ed;if(_0x79d1f5['query']['includeAll']){_0x24a75a[_0xb41b('0xae')]=[{'all':!![]}];}return db[_0xb41b('0xb8')][_0xb41b('0xbb')](_0x24a75a);})[_0xb41b('0x27')](function(_0x5813ba){_0xb149a3[_0xb41b('0xac')]=_0x5813ba;return _0xb149a3;});}})[_0xb41b('0x27')](respondWithFilteredResult(_0x1db78a,_0x24a75a))[_0xb41b('0x32')](handleError(_0x1db78a,null));};exports[_0xb41b('0xbc')]=function(_0x49394a,_0x3c3101,_0x4e7646){return db[_0xb41b('0x34')]['find']({'where':{'id':_0x49394a[_0xb41b('0xad')]['id']}})['then'](handleEntityNotFound(_0x3c3101,null))[_0xb41b('0x27')](function(_0x5d64c0){if(_0x5d64c0){return _0x5d64c0[_0xb41b('0xbd')](_0x49394a[_0xb41b('0xb1')]['ids'],_['omit'](_0x49394a[_0xb41b('0xb1')],[_0xb41b('0xb4'),'id'])||{})[_0xb41b('0xbe')](function(){return db['Tag']['findAll']({'attributes':['id',_0xb41b('0x2a'),_0xb41b('0xbf')],'where':{'id':_0x49394a[_0xb41b('0xb1')][_0xb41b('0xb4')]}});})['then'](function(_0x357d62){socket[_0xb41b('0xc0')](_0xb41b('0xc1'),{'id':Number(_0x49394a[_0xb41b('0xad')]['id']),'tags':_0x357d62||[]});return{'id':Number(_0x49394a[_0xb41b('0xad')]['id']),'tags':_0x357d62||[]};});}})['then'](respondWithResult(_0x3c3101,null))[_0xb41b('0x32')](handleError(_0x3c3101,null));};exports['removeTags']=function(_0x3e99ab,_0x425830,_0x40e2fa){return db[_0xb41b('0x34')]['find']({'where':{'id':_0x3e99ab[_0xb41b('0xad')]['id']}})[_0xb41b('0x27')](handleEntityNotFound(_0x425830,null))[_0xb41b('0x27')](function(_0x44837c){if(_0x44837c){return _0x44837c[_0xb41b('0xc2')](_0x3e99ab[_0xb41b('0x39')][_0xb41b('0xb4')]);}})['then'](respondWithStatusCode(_0x425830,null))[_0xb41b('0x32')](handleError(_0x425830,null));};exports['download']=function(_0x4a1a38,_0x468d70){var _0x402e3e=moment()['unix']()[_0xb41b('0x91')]();var _0x1a315d=path[_0xb41b('0xc3')](config['root'],_0xb41b('0xc4'),'files',_0xb41b('0xc5'));var _0x4d4b14=path['join'](config['root'],_0xb41b('0xc4'),_0xb41b('0xc6'),_0xb41b('0xc7'));var _0x40989c=path[_0xb41b('0xc3')](_0x1a315d,_0x402e3e);var _0x828ef4=util[_0xb41b('0xc8')]('transcript-%d-%s.zip',_0x4a1a38[_0xb41b('0xad')]['id'],_0x402e3e);var _0x1910a2=path[_0xb41b('0xc3')](_0x1a315d,_0x828ef4);var _0x22ad90=[];_0x22ad90[_0xb41b('0x31')]({'model':db[_0xb41b('0x6b')],'as':_0xb41b('0x6b'),'attributes':['id',_0xb41b('0xc9')],'raw':!![]});_0x22ad90[_0xb41b('0x31')]({'model':db['CmContact'],'as':_0xb41b('0x5f'),'attributes':['id',_0xb41b('0xca'),_0xb41b('0xcb')],'raw':!![]});var _0x29b332=[{'model':db[_0xb41b('0xb8')],'as':_0xb41b('0xcc'),'attributes':['id',_0xb41b('0xb1'),_0xb41b('0xcd'),_0xb41b('0xce'),_0xb41b('0xcf'),_0xb41b('0x7a')],'include':_0x22ad90}];_0x29b332[_0xb41b('0x31')]({'model':db[_0xb41b('0xd0')],'as':_0xb41b('0xd1'),'attributes':['id',_0xb41b('0x2a')]});_0x29b332['push']({'model':db[_0xb41b('0x6b')],'as':'Owner','attributes':['id',_0xb41b('0xc9')]});return db[_0xb41b('0x34')]['find']({'where':{'id':_0x4a1a38[_0xb41b('0xad')]['id']},'include':_0x29b332})[_0xb41b('0x27')](handleEntityNotFound(_0x468d70,null))['then'](function(_0x5d22b2){if(_0x5d22b2){var _0x4965ee=_0x5d22b2[_0xb41b('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x40989c);var _0x112f68={'format':'A4','border':_0xb41b('0xd3'),'header':{'height':_0xb41b('0xd4'),'contents':{'first':_0xb41b('0xd5')}},'footer':{'height':_0xb41b('0xd6'),'contents':{'default':util['format'](_0xb41b('0xd7'),util[_0xb41b('0xc8')](_0xb41b('0xd8'),_0xb41b('0xd9'),_0x4965ee['id']),moment()[_0xb41b('0xc8')](_0xb41b('0xda'))[_0xb41b('0x91')]())}}};var _0x330c7a={'channel':'Sms','account':_0x4965ee[_0xb41b('0xd1')][_0xb41b('0x2a')],'agent':_0x4965ee['Owner']?_0x4965ee['Owner'][_0xb41b('0xc9')]:'N.A.','createdAt':moment(_0x4965ee[_0xb41b('0xcd')])[_0xb41b('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb41b('0x91')](),'closedAt':_0x4965ee[_0xb41b('0xdb')]?moment(_0x4965ee[_0xb41b('0xdc')])[_0xb41b('0xc8')](_0xb41b('0xdd'))[_0xb41b('0x91')]():'','disposition':_0x4965ee[_0xb41b('0xde')],'messages':_(_0x4965ee[_0xb41b('0xcc')])['filter']({'secret':![]})[_0xb41b('0x69')](function(_0xb5844b){return{'date':moment(_0xb5844b['createdAt'])['format'](_0xb41b('0xdd'))[_0xb41b('0x91')](),'sender':_0xb5844b[_0xb41b('0xce')]==='out'?_0xb5844b[_0xb41b('0x6b')]?_0xb5844b['User'][_0xb41b('0xc9')]:_0xb41b('0xdf'):_0xb5844b[_0xb41b('0x5f')][_0xb41b('0xca')]+(_0xb5844b[_0xb41b('0x5f')][_0xb41b('0xcb')]?'\x20'+_0xb5844b[_0xb41b('0x5f')][_0xb41b('0xcb')]:''),'body':_0xb5844b['body'],'direction':_0xb5844b[_0xb41b('0xce')]===_0xb41b('0xe0')?'A':'C','secret':_0xb5844b[_0xb41b('0xcf')],'read':_0xb5844b['read']};})[_0xb41b('0x5b')]()};return ejs[_0xb41b('0xe1')](path[_0xb41b('0xc3')](config['root'],_0xb41b('0xc4'),_0xb41b('0xe2'),_0xb41b('0xe3')),{'interaction':_0x330c7a})[_0xb41b('0x27')](function(_0xb10d8e){return new BPromise(function(_0x44f7e7,_0x2f2975){pdf['create'](_0xb10d8e,_0x112f68)[_0xb41b('0xe4')](path[_0xb41b('0xc3')](_0x40989c,_0xb41b('0xe5')+_0x4965ee['id']+'-'+_0x402e3e+_0xb41b('0xe6')),function(_0x586367,_0x4b5475){if(_0x586367)return _0x2f2975(_0x586367);_0x44f7e7(_0x4b5475);});});})[_0xb41b('0x27')](function(){return new BPromise(function(_0xfb125d,_0x1ce7f8){zipdir(_0x40989c,{'saveTo':_0x1910a2},function(_0x183210,_0x30029d){if(_0x183210)return _0x1ce7f8(_0x183210);return _0xfb125d(_0x30029d);});})[_0xb41b('0x27')](function(){return new BPromise(function(_0x13471a,_0x158978){rimraf(_0x40989c,function(_0x45ae7a){if(_0x45ae7a)_0x158978(_0x45ae7a);return _0x13471a();});});})[_0xb41b('0x27')](function(){return _0x468d70['download'](_0x1910a2,_0x828ef4,function(_0x3ab5ee){if(_0x3ab5ee){console[_0xb41b('0xe7')]('err',_0x3ab5ee);}else{fs[_0xb41b('0xe8')](_0x1910a2);}});});});}else{return _0x468d70[_0xb41b('0x1c')](0xc8);}})[_0xb41b('0x32')](handleError(_0x468d70,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 908a621..e3e9643 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 _0xaa7c=['remove','then','Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x4f53f2,_0x3b9532){var _0x51aecb=function(_0xef0ef5){while(--_0xef0ef5){_0x4f53f2['push'](_0x4f53f2['shift']());}};_0x51aecb(++_0x3b9532);}(_0xaa7c,0x1ec));var _0xcaa7=function(_0x54ac96,_0x3ed0a9){_0x54ac96=_0x54ac96-0x0;var _0x1f7ee5=_0xaa7c[_0x54ac96];return _0x1f7ee5;};'use strict';var EventEmitter=require(_0xcaa7('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xcaa7('0x1')](0x0);var events={'afterCreate':_0xcaa7('0x2'),'afterUpdate':'update','afterDestroy':_0xcaa7('0x3')};function emitEvent(_0xc85ba0){return function(_0x3e1543,_0x17d8cf,_0x27e610){_0x3e1543['getUsers']({'attributes':['id'],'raw':!![]})[_0xcaa7('0x4')](function(_0x5bd940){_0x3e1543['setDataValue'](_0xcaa7('0x5'),_0x5bd940[_0xcaa7('0x6')](function(_0x4e74c5){return{'id':_0x4e74c5['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3e1543['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcaa7('0x4')](function(_0x1de70a){_0x3e1543[_0xcaa7('0x7')](_0xcaa7('0x8'),_0x1de70a[_0xcaa7('0x9')]);SmsInteractionEvents['emit'](_0xc85ba0+':'+_0x3e1543['id'],_0x3e1543);SmsInteractionEvents[_0xcaa7('0xa')](_0xc85ba0,_0x3e1543);_0x27e610(null);})[_0xcaa7('0xb')](_0x27e610(null));};}for(var e in events){if(events[_0xcaa7('0xc')](e)){var event=events[e];SmsInteraction[_0xcaa7('0xd')](e,emitEvent(event));}}module[_0xcaa7('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x1dcc=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction'];(function(_0x5d6327,_0x2a61fe){var _0x402c86=function(_0x4b0276){while(--_0x4b0276){_0x5d6327['push'](_0x5d6327['shift']());}};_0x402c86(++_0x2a61fe);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x3b8142,_0x44e052){_0x3b8142=_0x3b8142-0x0;var _0x1564cb=_0x1dcc[_0x3b8142];return _0x1564cb;};'use strict';var EventEmitter=require(_0xc1dc('0x0'));var SmsInteraction=require(_0xc1dc('0x1'))['db'][_0xc1dc('0x2')];var SmsMessage=require(_0xc1dc('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc1dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1dc('0x4'),'afterDestroy':_0xc1dc('0x5')};function emitEvent(_0x2a8ff9){return function(_0x5deaf7,_0x4ad50f,_0x1e57ba){_0x5deaf7[_0xc1dc('0x6')]({'attributes':['id'],'raw':!![]})[_0xc1dc('0x7')](function(_0x4dab41){_0x5deaf7[_0xc1dc('0x8')](_0xc1dc('0x9'),_0x4dab41['map'](function(_0x6aad09){return{'id':_0x6aad09['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x5deaf7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc1dc('0x7')](function(_0x49ef48){_0x5deaf7[_0xc1dc('0x8')](_0xc1dc('0xa'),_0x49ef48[_0xc1dc('0xb')]);SmsInteractionEvents[_0xc1dc('0xc')](_0x2a8ff9+':'+_0x5deaf7['id'],_0x5deaf7);SmsInteractionEvents[_0xc1dc('0xc')](_0x2a8ff9,_0x5deaf7);_0x1e57ba(null);})[_0xc1dc('0xd')](_0x1e57ba(null));};}for(var e in events){if(events[_0xc1dc('0xe')](e)){var event=events[e];SmsInteraction[_0xc1dc('0xf')](e,emitEvent(event));}}module[_0xc1dc('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index cdd4a50..b13dc91 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 _0xd0ee=['request-promise','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird'];(function(_0x4fd6d5,_0x5161e3){var _0x34ada6=function(_0x325479){while(--_0x325479){_0x4fd6d5['push'](_0x4fd6d5['shift']());}};_0x34ada6(++_0x5161e3);}(_0xd0ee,0x12f));var _0xed0e=function(_0x2858af,_0x16e49b){_0x2858af=_0x2858af-0x0;var _0x3aaa45=_0xd0ee[_0x2858af];return _0x3aaa45;};'use strict';var _=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var logger=require(_0xed0e('0x2'))(_0xed0e('0x3'));var moment=require('moment');var BPromise=require(_0xed0e('0x4'));var rp=require(_0xed0e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xed0e('0x6'));var attributes=require(_0xed0e('0x7'));module[_0xed0e('0x8')]=function(_0x326947,_0x39e4ca){return _0x326947['define'](_0xed0e('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x295a00,_0x3015cd,_0x7f85fb){if(_0x295a00['changed']('closed')){_0x295a00['closedAt']=moment()['format'](_0xed0e('0xa'));}_0x7f85fb(null,_0x295a00);}}});}; \ No newline at end of file +var _0x3b83=['api','moment','bluebird','request-promise','../../config/environment','./smsInteraction.attributes','exports','define','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger'];(function(_0x48d3a1,_0x539d3){var _0x94b27a=function(_0x3345a5){while(--_0x3345a5){_0x48d3a1['push'](_0x48d3a1['shift']());}};_0x94b27a(++_0x539d3);}(_0x3b83,0x83));var _0x33b8=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x3b83[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x33b8('0x0'))(_0x33b8('0x1'));var moment=require(_0x33b8('0x2'));var BPromise=require(_0x33b8('0x3'));var rp=require(_0x33b8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x33b8('0x5'));var attributes=require(_0x33b8('0x6'));module[_0x33b8('0x7')]=function(_0x41e374,_0xb46f5a){return _0x41e374[_0x33b8('0x8')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ca55,_0x26c071,_0x26fe26){if(_0x43ca55['changed'](_0x33b8('0x9'))){_0x43ca55[_0x33b8('0xa')]=moment()['format'](_0x33b8('0xb'));}_0x26fe26(null,_0x43ca55);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 4b2950a..aa16d31 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 _0xfcac=['request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','SmsInteraction','update','options','raw','where','limit','UpdateSmsInteraction','stringify','find','then','body','ids','omit','AddTags','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xfcac,0x1a9));var _0xcfca=function(_0x1d998c,_0x39a46c){_0x1d998c=_0x1d998c-0x0;var _0x1ca8d1=_0xfcac[_0x1d998c];return _0x1ca8d1;};'use strict';var _=require(_0xcfca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcfca('0x1'));var rs=require(_0xcfca('0x2'));var fs=require('fs');var Redis=require(_0xcfca('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfca('0x4'));var logger=require(_0xcfca('0x5'))(_0xcfca('0x6'));var config=require(_0xcfca('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfca('0x8')]({'port':0x232a});config[_0xcfca('0x9')]=_[_0xcfca('0xa')](config[_0xcfca('0x9')],{'host':_0xcfca('0xb'),'port':0x18eb});var socket=require(_0xcfca('0xc'))(new Redis(config[_0xcfca('0x9')]));require(_0xcfca('0xd'))[_0xcfca('0xe')](socket);function respondWithRpcPromise(_0x5432e2,_0x42878e,_0x26c0fa){return new BPromise(function(_0x2069ee,_0x4d2c81){return client[_0xcfca('0xf')](_0x5432e2,_0x26c0fa)['then'](function(_0xefc658){logger[_0xcfca('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x42878e,_0xcfca('0x11'));logger[_0xcfca('0x12')](_0xcfca('0x13'),_0x42878e,_0xcfca('0x11'),JSON['stringify'](_0xefc658));if(_0xefc658['error']){if(_0xefc658[_0xcfca('0x14')][_0xcfca('0x15')]===0x1f4){logger[_0xcfca('0x14')](_0xcfca('0x16'),_0x42878e,_0xefc658['error']['message']);return _0x4d2c81(_0xefc658[_0xcfca('0x14')][_0xcfca('0x17')]);}logger[_0xcfca('0x14')](_0xcfca('0x16'),_0x42878e,_0xefc658[_0xcfca('0x14')][_0xcfca('0x17')]);return _0x2069ee(_0xefc658[_0xcfca('0x14')]['message']);}else{logger[_0xcfca('0x10')](_0xcfca('0x16'),_0x42878e,_0xcfca('0x11'));_0x2069ee(_0xefc658[_0xcfca('0x18')][_0xcfca('0x17')]);}})[_0xcfca('0x19')](function(_0x10c505){logger[_0xcfca('0x14')](_0xcfca('0x16'),_0x42878e,_0x10c505);_0x4d2c81(_0x10c505);});});}exports['UpdateSmsInteraction']=function(_0x5a13a9){var _0xbf0607=this;return new Promise(function(_0x3096e3,_0x55c933){return db[_0xcfca('0x1a')][_0xcfca('0x1b')](_0x5a13a9['body'],{'raw':_0x5a13a9['options']?_0x5a13a9[_0xcfca('0x1c')][_0xcfca('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a13a9[_0xcfca('0x1c')]?_0x5a13a9[_0xcfca('0x1c')][_0xcfca('0x1e')]||null:null,'attributes':_0x5a13a9[_0xcfca('0x1c')]?_0x5a13a9[_0xcfca('0x1c')]['attributes']||null:null,'limit':_0x5a13a9['options']?_0x5a13a9[_0xcfca('0x1c')][_0xcfca('0x1f')]||null:null})['then'](function(_0x3784b7){logger['info']('UpdateSmsInteraction',_0x5a13a9);logger[_0xcfca('0x12')](_0xcfca('0x20'),_0x5a13a9,JSON[_0xcfca('0x21')](_0x3784b7));_0x3096e3(_0x3784b7);})[_0xcfca('0x19')](function(_0x1b6a93){logger['error'](_0xcfca('0x20'),_0x1b6a93['message'],_0x5a13a9);_0x55c933(_0xbf0607['error'](0x1f4,_0x1b6a93[_0xcfca('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1a2980){return new Promise(function(_0x1df92e,_0x3c2669){return db[_0xcfca('0x1a')][_0xcfca('0x22')]({'where':_0x1a2980[_0xcfca('0x1c')]?_0x1a2980['options'][_0xcfca('0x1e')]||null:null})[_0xcfca('0x23')](function(_0x48dae7){if(_0x48dae7){return _0x48dae7['addTags'](_0x1a2980[_0xcfca('0x24')][_0xcfca('0x25')],_[_0xcfca('0x26')](_0x1a2980[_0xcfca('0x24')],['ids','id'])||{});}})['spread'](function(_0x3fc722){logger[_0xcfca('0x10')](_0xcfca('0x27'),_0x1a2980);logger[_0xcfca('0x12')](_0xcfca('0x27'),_0x1a2980,JSON[_0xcfca('0x21')](_0x3fc722));_0x1df92e(_0x3fc722);})[_0xcfca('0x19')](function(_0x4795dc){logger[_0xcfca('0x14')](_0xcfca('0x27'),_0x4795dc[_0xcfca('0x17')],_0x1a2980);_0x3c2669(_this[_0xcfca('0x14')](0x1f4,_0x4795dc[_0xcfca('0x17')]));});});}; \ No newline at end of file +var _0x0145=['request\x20sent','stringify','error','message','catch','SmsInteraction','options','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','body','ids','omit','lodash','util','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x30a191,_0x38b23b){var _0xf6f720=function(_0x127ac0){while(--_0x127ac0){_0x30a191['push'](_0x30a191['shift']());}};_0xf6f720(++_0x38b23b);}(_0x0145,0x179));var _0x5014=function(_0x5d884a,_0x2b0448){_0x5d884a=_0x5d884a-0x0;var _0x38f211=_0x0145[_0x5d884a];return _0x38f211;};'use strict';var _=require(_0x5014('0x0'));var util=require(_0x5014('0x1'));var moment=require(_0x5014('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5014('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5014('0x4'))('rpc');var config=require(_0x5014('0x5'));var jayson=require(_0x5014('0x6'));var client=jayson[_0x5014('0x7')][_0x5014('0x8')]({'port':0x232a});config['redis']=_[_0x5014('0x9')](config[_0x5014('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5014('0xb'))(new Redis(config[_0x5014('0xa')]));require('./smsInteraction.socket')[_0x5014('0xc')](socket);function respondWithRpcPromise(_0x3e64a9,_0x13280a,_0x6cd9f8){return new BPromise(function(_0x4a4a9a,_0x2ed9fd){return client[_0x5014('0xd')](_0x3e64a9,_0x6cd9f8)[_0x5014('0xe')](function(_0x3d9541){logger[_0x5014('0xf')](_0x5014('0x10'),_0x13280a,'request\x20sent');logger[_0x5014('0x11')](_0x5014('0x12'),_0x13280a,_0x5014('0x13'),JSON[_0x5014('0x14')](_0x3d9541));if(_0x3d9541[_0x5014('0x15')]){if(_0x3d9541[_0x5014('0x15')]['code']===0x1f4){logger[_0x5014('0x15')](_0x5014('0x10'),_0x13280a,_0x3d9541[_0x5014('0x15')]['message']);return _0x2ed9fd(_0x3d9541['error'][_0x5014('0x16')]);}logger[_0x5014('0x15')](_0x5014('0x10'),_0x13280a,_0x3d9541[_0x5014('0x15')]['message']);return _0x4a4a9a(_0x3d9541[_0x5014('0x15')][_0x5014('0x16')]);}else{logger['info'](_0x5014('0x10'),_0x13280a,_0x5014('0x13'));_0x4a4a9a(_0x3d9541['result'][_0x5014('0x16')]);}})[_0x5014('0x17')](function(_0x2629ce){logger[_0x5014('0x15')](_0x5014('0x10'),_0x13280a,_0x2629ce);_0x2ed9fd(_0x2629ce);});});}exports['UpdateSmsInteraction']=function(_0x2b91fa){var _0x5bef4a=this;return new Promise(function(_0x2348d0,_0x2e171d){return db[_0x5014('0x18')]['update'](_0x2b91fa['body'],{'raw':_0x2b91fa[_0x5014('0x19')]?_0x2b91fa[_0x5014('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b91fa[_0x5014('0x19')]?_0x2b91fa[_0x5014('0x19')][_0x5014('0x1a')]||null:null,'attributes':_0x2b91fa[_0x5014('0x19')]?_0x2b91fa[_0x5014('0x19')][_0x5014('0x1b')]||null:null,'limit':_0x2b91fa['options']?_0x2b91fa[_0x5014('0x19')][_0x5014('0x1c')]||null:null})[_0x5014('0xe')](function(_0x3c07bb){logger[_0x5014('0xf')](_0x5014('0x1d'),_0x2b91fa);logger[_0x5014('0x11')]('UpdateSmsInteraction',_0x2b91fa,JSON['stringify'](_0x3c07bb));_0x2348d0(_0x3c07bb);})[_0x5014('0x17')](function(_0x26abf0){logger[_0x5014('0x15')](_0x5014('0x1d'),_0x26abf0[_0x5014('0x16')],_0x2b91fa);_0x2e171d(_0x5bef4a[_0x5014('0x15')](0x1f4,_0x26abf0[_0x5014('0x16')]));});});};exports[_0x5014('0x1e')]=function(_0x3c29e6){return new Promise(function(_0x4f7c27,_0x2169d5){return db[_0x5014('0x18')][_0x5014('0x1f')]({'where':_0x3c29e6[_0x5014('0x19')]?_0x3c29e6[_0x5014('0x19')]['where']||null:null})['then'](function(_0x5abb3a){if(_0x5abb3a){return _0x5abb3a[_0x5014('0x20')](_0x3c29e6[_0x5014('0x21')][_0x5014('0x22')],_[_0x5014('0x23')](_0x3c29e6['body'],[_0x5014('0x22'),'id'])||{});}})['spread'](function(_0x435b11){logger['info']('AddTags',_0x3c29e6);logger['debug']('AddTags',_0x3c29e6,JSON['stringify'](_0x435b11));_0x4f7c27(_0x435b11);})[_0x5014('0x17')](function(_0x50422c){logger[_0x5014('0x15')]('AddTags',_0x50422c[_0x5014('0x16')],_0x3c29e6);_0x2169d5(_this['error'](0x1f4,_0x50422c[_0x5014('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 09de08e..a4fb363 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0xfe0696,_0xd59e08){var _0x5b515f=function(_0x294ba8){while(--_0x294ba8){_0xfe0696['push'](_0xfe0696['shift']());}};_0x5b515f(++_0xd59e08);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0x0b0e[_0x4ed37d];return _0x4fb2c5;};'use strict';var SmsInteractionEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){SmsInteractionEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0xd8b0=['save','emit','./smsInteraction.events'];(function(_0x4d6aae,_0x5172ef){var _0x565b10=function(_0x182144){while(--_0x182144){_0x4d6aae['push'](_0x4d6aae['shift']());}};_0x565b10(++_0x5172ef);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var SmsInteractionEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){SmsInteractionEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('smsInteraction:'+_0x413284,_0x3f8b6f);SmsInteractionEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9bf1b0b..6cb645f 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 _0x1b19=['sms','create','/:id/status','status','put','update','/:id/accept','accept','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','index','get','/describe','isAuthenticated','/:id','show','post'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x1b19,0x129));var _0x91b1=function(_0x4c1726,_0xb73af5){_0x4c1726=_0x4c1726-0x0;var _0x3acdae=_0x1b19[_0x4c1726];return _0x3acdae;};'use strict';var multer=require(_0x91b1('0x0'));var util=require(_0x91b1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x91b1('0x2'));var router=express[_0x91b1('0x3')]();var auth=require(_0x91b1('0x4'));var interaction=require(_0x91b1('0x5'));var config=require(_0x91b1('0x6'));var controller=require(_0x91b1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x91b1('0x8')]);router[_0x91b1('0x9')](_0x91b1('0xa'),auth[_0x91b1('0xb')](),controller['describe']);router[_0x91b1('0x9')](_0x91b1('0xc'),auth['isAuthenticated'](),controller[_0x91b1('0xd')]);router[_0x91b1('0xe')]('/',auth[_0x91b1('0xb')](),interaction['tracked'](_0x91b1('0xf'),'smsmessage:create'),controller[_0x91b1('0x10')]);router['post'](_0x91b1('0x11'),controller[_0x91b1('0x12')]);router[_0x91b1('0x13')](_0x91b1('0xc'),auth[_0x91b1('0xb')](),controller[_0x91b1('0x14')]);router[_0x91b1('0x13')](_0x91b1('0x15'),auth['isAuthenticated'](),controller[_0x91b1('0x16')]);router[_0x91b1('0x13')]('/:id/reject',auth[_0x91b1('0xb')](),controller['reject']);router[_0x91b1('0x17')](_0x91b1('0xc'),auth[_0x91b1('0xb')](),controller[_0x91b1('0x18')]);module[_0x91b1('0x19')]=router; \ No newline at end of file +var _0xc29b=['post','tracked','sms','smsmessage:create','create','status','put','/:id','/:id/accept','accept','/:id/reject','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','/describe','show'];(function(_0x27401d,_0x47e9e8){var _0x276df=function(_0xdf078d){while(--_0xdf078d){_0x27401d['push'](_0x27401d['shift']());}};_0x276df(++_0x47e9e8);}(_0xc29b,0x165));var _0xbc29=function(_0x448a1b,_0x325388){_0x448a1b=_0x448a1b-0x0;var _0x195dc1=_0xc29b[_0x448a1b];return _0x195dc1;};'use strict';var multer=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc29('0x2'));var router=express[_0xbc29('0x3')]();var auth=require(_0xbc29('0x4'));var interaction=require(_0xbc29('0x5'));var config=require('../../config/environment');var controller=require(_0xbc29('0x6'));router[_0xbc29('0x7')]('/',auth[_0xbc29('0x8')](),controller['index']);router[_0xbc29('0x7')](_0xbc29('0x9'),auth[_0xbc29('0x8')](),controller['describe']);router['get']('/:id',auth[_0xbc29('0x8')](),controller[_0xbc29('0xa')]);router[_0xbc29('0xb')]('/',auth[_0xbc29('0x8')](),interaction[_0xbc29('0xc')](_0xbc29('0xd'),_0xbc29('0xe')),controller[_0xbc29('0xf')]);router['post']('/:id/status',controller[_0xbc29('0x10')]);router[_0xbc29('0x11')](_0xbc29('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xbc29('0x11')](_0xbc29('0x13'),auth[_0xbc29('0x8')](),controller[_0xbc29('0x14')]);router[_0xbc29('0x11')](_0xbc29('0x15'),auth[_0xbc29('0x8')](),controller['reject']);router['delete'](_0xbc29('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xbc29('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index a25ea9e..e0e5dda 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 _0x2b95=['STRING','DATE','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x54fc4d,_0x38a6e6){var _0x2df06c=function(_0x4467b6){while(--_0x4467b6){_0x54fc4d['push'](_0x54fc4d['shift']());}};_0x2df06c(++_0x38a6e6);}(_0x2b95,0x159));var _0x52b9=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x2b95[_0x57d13b];return _0x467696;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x52b9('0x0')](_0x52b9('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x52b9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x52b9('0x3')]('in',_0x52b9('0x4')),'defaultValue':_0x52b9('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x52b9('0x5')](0xbe)},'phone':{'type':Sequelize[_0x52b9('0x5')]},'readAt':{'type':Sequelize[_0x52b9('0x6')]},'secret':{'type':Sequelize[_0x52b9('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf6c1=['medium','ENUM','out','STRING','BOOLEAN','sequelize'];(function(_0x467ee9,_0x555315){var _0x13504d=function(_0x59e04a){while(--_0x59e04a){_0x467ee9['push'](_0x467ee9['shift']());}};_0x13504d(++_0x555315);}(_0xf6c1,0x149));var _0x1f6c=function(_0x2f0ce7,_0x3b4e01){_0x2f0ce7=_0x2f0ce7-0x0;var _0x75436e=_0xf6c1[_0x2f0ce7];return _0x75436e;};'use strict';var Sequelize=require(_0x1f6c('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1f6c('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f6c('0x2')]('in',_0x1f6c('0x3')),'defaultValue':_0x1f6c('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1f6c('0x4')](0xbe)},'phone':{'type':Sequelize[_0x1f6c('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1f6c('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index eb8806a..7ec2321 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 _0xc2da=['RejectMessage','SmsAccount','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','request','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','stack','name','send','index','map','SmsMessage','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','then','rows','show','params','rawAttributes','find','create','body','destroy','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','SmsInteraction','SmsInteractionId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc2da,0x124));var _0xac2d=function(_0x5cedbc,_0x48fc4d){_0x5cedbc=_0x5cedbc-0x0;var _0x5d73a0=_0xc2da[_0x5cedbc];return _0x5d73a0;};'use strict';var pdf=require(_0xac2d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xac2d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac2d('0x2'));var rp=require('request-promise');var moment=require(_0xac2d('0x3'));var BPromise=require(_0xac2d('0x4'));var Mustache=require(_0xac2d('0x5'));var util=require(_0xac2d('0x6'));var path=require(_0xac2d('0x7'));var sox=require(_0xac2d('0x8'));var csv=require(_0xac2d('0x9'));var ejs=require(_0xac2d('0xa'));var fs=require('fs');var _=require(_0xac2d('0xb'));var squel=require(_0xac2d('0xc'));var crypto=require(_0xac2d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac2d('0x9'));var querystring=require('querystring');var Papa=require(_0xac2d('0xe'));var Redis=require(_0xac2d('0xf'));var authService=require(_0xac2d('0x10'));var qs=require(_0xac2d('0x11'));var as=require(_0xac2d('0x12'));var hardwareService=require(_0xac2d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xac2d('0x14'));var config=require(_0xac2d('0x15'));var db=require(_0xac2d('0x16'))['db'];config[_0xac2d('0x17')]=_['defaults'](config[_0xac2d('0x17')],{'host':_0xac2d('0x18'),'port':0x18eb});var socket=require(_0xac2d('0x19'))(new Redis(config[_0xac2d('0x17')]));require(_0xac2d('0x1a'))[_0xac2d('0x1b')](socket);var jayson=require(_0xac2d('0x1c'));var client=jayson[_0xac2d('0x1d')][_0xac2d('0x1e')]({'port':0x232c});var client9002=jayson[_0xac2d('0x1d')][_0xac2d('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x33d014,_0x74853a,_0x2d92b5){if(_0x2d92b5){var _0x324978=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x324978['test'](_0x74853a)){return _0x33d014;}else{throw new db[(_0xac2d('0x1f'))][(_0xac2d('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x33d014;}}function respondWithRpcPromise(_0x453113,_0xed956b,_0x1d8e9f,_0x4d34fa){return new BPromise(function(_0x45c12b,_0x5da81c){var _0x20266d=_0x4d34fa||client;return _0x20266d[_0xac2d('0x21')](_0x453113,_0x1d8e9f)['then'](function(_0x23ed75){logger['info']('SmsMessage,\x20%s,\x20%s',_0xed956b,'request\x20sent');logger['debug'](_0xac2d('0x22'),_0xed956b,_0xac2d('0x23'),JSON[_0xac2d('0x24')](_0x23ed75));if(_0x23ed75[_0xac2d('0x25')]){if(_0x23ed75[_0xac2d('0x25')][_0xac2d('0x26')]===0x1f4){logger[_0xac2d('0x25')](_0xac2d('0x27'),_0xed956b,_0x23ed75[_0xac2d('0x25')][_0xac2d('0x28')]);return _0x5da81c(_0x23ed75[_0xac2d('0x25')][_0xac2d('0x28')]);}logger[_0xac2d('0x25')](_0xac2d('0x27'),_0xed956b,_0x23ed75[_0xac2d('0x25')][_0xac2d('0x28')]);return _0x45c12b(_0x23ed75[_0xac2d('0x25')][_0xac2d('0x28')]);}else{logger[_0xac2d('0x29')]('SmsMessage,\x20%s,\x20%s',_0xed956b,_0xac2d('0x23'));_0x45c12b(_0x23ed75[_0xac2d('0x2a')][_0xac2d('0x28')]);}})[_0xac2d('0x2b')](function(_0x563f19){logger['error'](_0xac2d('0x27'),_0xed956b,_0x563f19);_0x5da81c(_0x563f19);});});}function respondWithStatusCode(_0x1c69f1,_0x2ad9b1){_0x2ad9b1=_0x2ad9b1||0xcc;return function(_0x8c3390){if(_0x8c3390){return _0x1c69f1[_0xac2d('0x2c')](_0x2ad9b1);}return _0x1c69f1[_0xac2d('0x2d')](_0x2ad9b1)[_0xac2d('0x2e')]();};}function respondWithResult(_0x42aa82,_0x2ac875){_0x2ac875=_0x2ac875||0xc8;return function(_0x530149){if(_0x530149){return _0x42aa82['status'](_0x2ac875)[_0xac2d('0x2f')](_0x530149);}};}function respondWithFilteredResult(_0xe3670d,_0x3f1094){return function(_0x44b9d0){if(_0x44b9d0){var _0x15776b=_0x44b9d0['count'],_0x49d63f=_0x3f1094[_0xac2d('0x30')],_0x778407=_0x3f1094[_0xac2d('0x30')]+_0x3f1094[_0xac2d('0x31')],_0x37f7ad;if(_0x778407>=_0x15776b){_0x778407=_0x15776b;_0x37f7ad=0xc8;}else{_0x37f7ad=0xce;}_0xe3670d[_0xac2d('0x2d')](_0x37f7ad);return _0xe3670d['set'](_0xac2d('0x32'),_0x49d63f+'-'+_0x778407+'/'+_0x15776b)['json'](_0x44b9d0);}return null;};}function patchUpdates(_0x1ff4a6){return function(_0x4185f2){try{jsonpatch['apply'](_0x4185f2,_0x1ff4a6,!![]);}catch(_0x8402a7){return BPromise[_0xac2d('0x33')](_0x8402a7);}return _0x4185f2[_0xac2d('0x34')]();};}function saveUpdates(_0x1d9da4,_0x2e6733){return function(_0x4eac98){if(_0x4eac98){return _0x4eac98[_0xac2d('0x35')](_0x1d9da4)['then'](function(_0x2d2a36){return _0x2d2a36;});}return null;};}function removeEntity(_0x4bb473,_0x337905){return function(_0x4b16bd){if(_0x4b16bd){return _0x4b16bd['destroy']()['then'](function(){_0x4bb473[_0xac2d('0x2d')](0xcc)[_0xac2d('0x2e')]();});}};}function handleEntityNotFound(_0x24ce3c,_0x1f91f4){return function(_0x3c0533){if(!_0x3c0533){_0x24ce3c[_0xac2d('0x2c')](0x194);}return _0x3c0533;};}function handleError(_0x2144ee,_0x5406a7){_0x5406a7=_0x5406a7||0x1f4;return function(_0xdbc61f){logger[_0xac2d('0x25')](_0xdbc61f[_0xac2d('0x36')]);if(_0xdbc61f[_0xac2d('0x37')]){delete _0xdbc61f[_0xac2d('0x37')];}_0x2144ee['status'](_0x5406a7)[_0xac2d('0x38')](_0xdbc61f);};}exports[_0xac2d('0x39')]=function(_0x2a5723,_0x1e7577){var _0x1ce9ad={},_0x43aa06={},_0x18ca80={'count':0x0,'rows':[]};var _0x3cf517=_[_0xac2d('0x3a')](db[_0xac2d('0x3b')]['rawAttributes'],function(_0x1642ce){return{'name':_0x1642ce['fieldName'],'type':_0x1642ce[_0xac2d('0x3c')][_0xac2d('0x3d')]};});_0x43aa06[_0xac2d('0x3e')]=_[_0xac2d('0x3a')](_0x3cf517,_0xac2d('0x37'));_0x43aa06['query']=_[_0xac2d('0x3f')](_0x2a5723[_0xac2d('0x40')]);_0x43aa06[_0xac2d('0x41')]=_[_0xac2d('0x42')](_0x43aa06[_0xac2d('0x3e')],_0x43aa06['query']);_0x1ce9ad['attributes']=_['intersection'](_0x43aa06[_0xac2d('0x3e')],qs[_0xac2d('0x43')](_0x2a5723[_0xac2d('0x40')][_0xac2d('0x43')]));_0x1ce9ad[_0xac2d('0x44')]=_0x1ce9ad['attributes'][_0xac2d('0x45')]?_0x1ce9ad[_0xac2d('0x44')]:_0x43aa06['model'];if(!_0x2a5723[_0xac2d('0x40')][_0xac2d('0x46')](_0xac2d('0x47'))){_0x1ce9ad[_0xac2d('0x31')]=qs[_0xac2d('0x31')](_0x2a5723['query'][_0xac2d('0x31')]);_0x1ce9ad[_0xac2d('0x30')]=qs[_0xac2d('0x30')](_0x2a5723[_0xac2d('0x40')]['offset']);}_0x1ce9ad['order']=qs[_0xac2d('0x48')](_0x2a5723['query'][_0xac2d('0x48')]);_0x1ce9ad[_0xac2d('0x49')]=qs['filters'](_['pick'](_0x2a5723[_0xac2d('0x40')],_0x43aa06['filters']),_0x3cf517);if(_0x2a5723['query']['filter']){_0x1ce9ad[_0xac2d('0x49')]=_[_0xac2d('0x4a')](_0x1ce9ad[_0xac2d('0x49')],{'$or':_['map'](_0x3cf517,function(_0x32c260){if(_0x32c260['type']!==_0xac2d('0x4b')){var _0xd18bcb={};_0xd18bcb[_0x32c260['name']]={'$like':'%'+_0x2a5723[_0xac2d('0x40')][_0xac2d('0x4c')]+'%'};return _0xd18bcb;}})});}_0x1ce9ad=_[_0xac2d('0x4a')]({},_0x1ce9ad,_0x2a5723[_0xac2d('0x4d')]);var _0x1c7ab9={'where':_0x1ce9ad['where']};return db[_0xac2d('0x3b')][_0xac2d('0x4e')](_0x1c7ab9)['then'](function(_0x850268){_0x18ca80['count']=_0x850268;if(_0x2a5723['query'][_0xac2d('0x4f')]){_0x1ce9ad[_0xac2d('0x50')]=[{'all':!![]}];}return db['SmsMessage'][_0xac2d('0x51')](_0x1ce9ad);})[_0xac2d('0x52')](function(_0x29935b){_0x18ca80[_0xac2d('0x53')]=_0x29935b;return _0x18ca80;})[_0xac2d('0x52')](respondWithFilteredResult(_0x1e7577,_0x1ce9ad))[_0xac2d('0x2b')](handleError(_0x1e7577,null));};exports[_0xac2d('0x54')]=function(_0x57bf66,_0x1975fb){var _0x2df040={'raw':!![],'where':{'id':_0x57bf66[_0xac2d('0x55')]['id']}},_0x4f2a37={};_0x4f2a37[_0xac2d('0x3e')]=_[_0xac2d('0x3f')](db[_0xac2d('0x3b')][_0xac2d('0x56')]);_0x4f2a37['query']=_[_0xac2d('0x3f')](_0x57bf66['query']);_0x4f2a37['filters']=_[_0xac2d('0x42')](_0x4f2a37['model'],_0x4f2a37[_0xac2d('0x40')]);_0x2df040[_0xac2d('0x44')]=_[_0xac2d('0x42')](_0x4f2a37[_0xac2d('0x3e')],qs[_0xac2d('0x43')](_0x57bf66[_0xac2d('0x40')]['fields']));_0x2df040['attributes']=_0x2df040[_0xac2d('0x44')][_0xac2d('0x45')]?_0x2df040[_0xac2d('0x44')]:_0x4f2a37[_0xac2d('0x3e')];if(_0x57bf66['query'][_0xac2d('0x4f')]){_0x2df040[_0xac2d('0x50')]=[{'all':!![]}];}_0x2df040=_[_0xac2d('0x4a')]({},_0x2df040,_0x57bf66['options']);return db[_0xac2d('0x3b')][_0xac2d('0x57')](_0x2df040)[_0xac2d('0x52')](handleEntityNotFound(_0x1975fb,null))[_0xac2d('0x52')](respondWithResult(_0x1975fb,null))['catch'](handleError(_0x1975fb,null));};exports[_0xac2d('0x58')]=function(_0x2d6b2,_0xdd4505){return db['SmsMessage'][_0xac2d('0x58')](_0x2d6b2['body'],{})[_0xac2d('0x52')](respondWithResult(_0xdd4505,0xc9))[_0xac2d('0x2b')](handleError(_0xdd4505,null));};exports['update']=function(_0x244bdd,_0x281566){if(_0x244bdd[_0xac2d('0x59')]['id']){delete _0x244bdd[_0xac2d('0x59')]['id'];}return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0x244bdd['params']['id']}})['then'](handleEntityNotFound(_0x281566,null))[_0xac2d('0x52')](saveUpdates(_0x244bdd[_0xac2d('0x59')],null))[_0xac2d('0x52')](respondWithResult(_0x281566,null))[_0xac2d('0x2b')](handleError(_0x281566,null));};exports[_0xac2d('0x5a')]=function(_0x13ffff,_0x5bcf45){return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0x13ffff[_0xac2d('0x55')]['id']}})[_0xac2d('0x52')](handleEntityNotFound(_0x5bcf45,null))[_0xac2d('0x52')](removeEntity(_0x5bcf45,null))[_0xac2d('0x2b')](handleError(_0x5bcf45,null));};exports[_0xac2d('0x5b')]=function(_0x343002,_0x188746){return db['SmsMessage'][_0xac2d('0x5b')]()[_0xac2d('0x52')](respondWithResult(_0x188746,null))[_0xac2d('0x2b')](handleError(_0x188746,null));};var interaction_log=require(_0xac2d('0x5c'))(_0xac2d('0x5d'));exports[_0xac2d('0x5e')]=function(_0x2eab04,_0x108102,_0x5e7c06){var _0x540af1={'channel':_0xac2d('0x5f')};if(_0x2eab04[_0xac2d('0x59')]['id']){delete _0x2eab04[_0xac2d('0x59')]['id'];}_0x2eab04[_0xac2d('0x59')][_0xac2d('0x60')]=!![];_0x2eab04[_0xac2d('0x59')][_0xac2d('0x61')]=moment()[_0xac2d('0x62')](_0xac2d('0x63'));_0x2eab04[_0xac2d('0x59')]['UserId']=_0x2eab04[_0xac2d('0x59')][_0xac2d('0x64')]||_0x2eab04['user']['id'];return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0x2eab04['params']['id'],'UserId':null},'include':[{'model':db[_0xac2d('0x65')],'as':_0xac2d('0x66')}]})[_0xac2d('0x52')](handleEntityNotFound(_0x108102,null))[_0xac2d('0x52')](saveUpdates(_0x2eab04['body'],null))['then'](function(_0x5130c0){if(_0x5130c0){_0x540af1[_0xac2d('0x28')]=_0x5130c0['get']({'plain':!![]});return db[_0xac2d('0x67')][_0xac2d('0x57')]({'where':{'id':_0x5130c0[_0xac2d('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x108102,null))['then'](function(_0x21907b){if(_0x21907b){return _0x21907b[_0xac2d('0x35')]({'UserId':_0x2eab04[_0xac2d('0x59')][_0xac2d('0x64')],'read1stAt':_[_0xac2d('0x69')](_0x21907b['read1stAt'])?moment()['format'](_0xac2d('0x63')):undefined});}return null;})['then'](function(_0x53450e){if(_0x53450e){_0x540af1[_0xac2d('0x6a')]=_0x53450e[_0xac2d('0x6b')]({'plain':!![]});interaction_log[_0xac2d('0x29')](_0xac2d('0x6c'),_0x2eab04[_0xac2d('0x6d')]['id'],_0x2eab04[_0xac2d('0x6d')][_0xac2d('0x37')],_0x2eab04[_0xac2d('0x6d')][_0xac2d('0x6e')],_0x540af1[_0xac2d('0x6a')]['id'],_0x2eab04[_0xac2d('0x59')]?JSON['stringify'](_0x2eab04['body']):_0xac2d('0x6f'));return respondWithRpcPromise(_0xac2d('0x70'),_0xac2d('0x71'),_0x540af1);}return null;})[_0xac2d('0x52')](function(_0x5d7f26){if(_0x5d7f26){if(_0x2eab04[_0xac2d('0x59')][_0xac2d('0x72')]){_0x540af1[_0xac2d('0x28')][_0xac2d('0x73')]=util['format'](_0xac2d('0x74'),_0x2eab04[_0xac2d('0x6d')][_0xac2d('0x37')]);_0x540af1[_0xac2d('0x28')][_0xac2d('0x75')]=_0x540af1[_0xac2d('0x75')];_0x540af1[_0xac2d('0x28')][_0xac2d('0x76')]=_0xac2d('0x5e');return respondWithRpcPromise(_0xac2d('0x77'),'EventManager',{'event':_0xac2d('0x78'),'message':_0x540af1[_0xac2d('0x28')]},client9002)[_0xac2d('0x52')](function(){return _0x540af1;});}return _0x540af1;}return null;})[_0xac2d('0x52')](respondWithResult(_0x108102,null))['catch'](handleError(_0x108102,null));};var interaction_log=require(_0xac2d('0x5c'))(_0xac2d('0x5d'));exports[_0xac2d('0x33')]=function(_0xec4bf0,_0x2898c4,_0x667e82){var _0xdbbd92={'agent':{},'channel':'sms'};if(_0xec4bf0[_0xac2d('0x59')]['id']){delete _0xec4bf0[_0xac2d('0x59')]['id'];}_0xec4bf0[_0xac2d('0x59')]['UserId']=_0xec4bf0[_0xac2d('0x59')][_0xac2d('0x64')]||_0xec4bf0[_0xac2d('0x6d')]['id'];_0xdbbd92[_0xac2d('0x79')]['id']=_0xec4bf0['body'][_0xac2d('0x64')];return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0xec4bf0[_0xac2d('0x55')]['id'],'UserId':null}})[_0xac2d('0x52')](handleEntityNotFound(_0x2898c4,null))[_0xac2d('0x52')](function(_0xe1ea34){if(_0xe1ea34){_0xdbbd92[_0xac2d('0x28')]=_0xe1ea34['get']({'plain':!![]});return db['SmsInteraction'][_0xac2d('0x57')]({'where':{'id':_0xe1ea34[_0xac2d('0x68')]}});}return null;})[_0xac2d('0x52')](handleEntityNotFound(_0x2898c4,null))[_0xac2d('0x52')](function(_0x4ebde2){if(_0x4ebde2){_0xdbbd92[_0xac2d('0x6a')]=_0x4ebde2[_0xac2d('0x6b')]({'plain':!![]});interaction_log[_0xac2d('0x29')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xec4bf0[_0xac2d('0x6d')]['id'],_0xec4bf0['user']['name'],_0xec4bf0['user'][_0xac2d('0x6e')],_0xdbbd92[_0xac2d('0x6a')]['id'],_0xec4bf0['body']?JSON['stringify'](_0xec4bf0[_0xac2d('0x59')]):_0xac2d('0x6f'));return respondWithRpcPromise(_0xac2d('0x7a'),'rejectMessage',_0xdbbd92);}return null;})[_0xac2d('0x52')](function(_0x388536){if(_0x388536){_0x388536['message']['interface']=util[_0xac2d('0x62')](_0xac2d('0x74'),_0xec4bf0[_0xac2d('0x6d')]['name']);_0x388536[_0xac2d('0x28')]['channel']=_0xdbbd92[_0xac2d('0x75')];_0x388536['message'][_0xac2d('0x76')]='reject';respondWithRpcPromise(_0xac2d('0x77'),'EventManager',{'event':'rejectmessage','message':_0x388536[_0xac2d('0x28')]},client9002);return _0xdbbd92;}return null;})[_0xac2d('0x52')](respondWithResult(_0x2898c4,null))[_0xac2d('0x2b')](handleError(_0x2898c4,null));};exports[_0xac2d('0x2d')]=function(_0x5e099f,_0xf77b1d,_0x1e802f){if(_0x5e099f['body']['id']){delete _0x5e099f['body']['id'];}var _0x346499;return db[_0xac2d('0x3b')][_0xac2d('0x57')]({'where':{'id':_0x5e099f[_0xac2d('0x55')]['id']}})['then'](handleEntityNotFound(_0xf77b1d,null))[_0xac2d('0x52')](function(_0x280fe9){if(_0x280fe9){_0x346499=_0x280fe9;return db[_0xac2d('0x7b')][_0xac2d('0x57')]({'where':{'id':_0x280fe9['SmsAccountId']}});}})['then'](handleEntityNotFound(_0xf77b1d,null))['then'](function(_0x5840f9){if(_0x5840f9){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xac2d('0x2d'),'received\x20delivery\x20report\x20from',_0x5840f9[_0xac2d('0x3c')],util[_0xac2d('0x7c')](_0x5e099f['body'],{'showHidden':![],'depth':null}));switch(_0x5840f9[_0xac2d('0x3c')]){case _0xac2d('0x7d'):if(_0x5e099f[_0xac2d('0x59')]['MessageSid']&&_0x5e099f[_0xac2d('0x59')][_0xac2d('0x7e')]===_0x346499[_0xac2d('0x7f')]){return _0x346499[_0xac2d('0x35')]({'read':!![]});}else{logger[_0xac2d('0x25')](_0xac2d('0x80'),_0xac2d('0x2d'),_0xac2d('0x7d'),util[_0xac2d('0x7c')](_0x5e099f[_0xac2d('0x59')],{'showHidden':![],'depth':null}));}break;case _0xac2d('0x81'):if(_0x5e099f[_0xac2d('0x59')][_0xac2d('0x82')]&&_0x5e099f[_0xac2d('0x59')][_0xac2d('0x82')]===_0x346499['messageId']&&_[_0xac2d('0x83')]([_0xac2d('0x84'),_0xac2d('0x85')],_0x5e099f[_0xac2d('0x59')][_0xac2d('0x86')])>=0x0){return _0x346499[_0xac2d('0x35')]({'read':!![]});}else{logger[_0xac2d('0x25')](_0xac2d('0x80'),_0xac2d('0x2d'),'plivio',util['inspect'](_0x5e099f[_0xac2d('0x59')],{'showHidden':![],'depth':null}));}break;case _0xac2d('0x87'):var _0x403a8f=_0x5e099f[_0xac2d('0x59')][_0xac2d('0x88')][0x0];if(_0x403a8f[_0xac2d('0x2d')][_0xac2d('0x89')]==='DELIVERED'){return _0x346499[_0xac2d('0x35')]({'read':!![]});}else{logger[_0xac2d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util[_0xac2d('0x7c')](_0x5e099f[_0xac2d('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x346499;}})['then'](respondWithResult(_0xf77b1d,null))[_0xac2d('0x2b')](handleError(_0xf77b1d,null));}; \ No newline at end of file +var _0x9bc3=['read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','reject','SmsAccount','SmsAccountId','inspect','twilio','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','Status','results','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','show','keys','fields','options','find','create','body','params','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','isNil'];(function(_0x4abef5,_0x10e42a){var _0x35eeeb=function(_0x534f9b){while(--_0x534f9b){_0x4abef5['push'](_0x4abef5['shift']());}};_0x35eeeb(++_0x10e42a);}(_0x9bc3,0x137));var _0x39bc=function(_0xa3114,_0x2576d5){_0xa3114=_0xa3114-0x0;var _0x1d414d=_0x9bc3[_0xa3114];return _0x1d414d;};'use strict';var pdf=require(_0x39bc('0x0'));var emlformat=require(_0x39bc('0x1'));var rimraf=require(_0x39bc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39bc('0x3'));var rp=require(_0x39bc('0x4'));var moment=require(_0x39bc('0x5'));var BPromise=require(_0x39bc('0x6'));var Mustache=require('mustache');var util=require(_0x39bc('0x7'));var path=require(_0x39bc('0x8'));var sox=require(_0x39bc('0x9'));var csv=require(_0x39bc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x39bc('0xb'));var squel=require(_0x39bc('0xc'));var crypto=require(_0x39bc('0xd'));var jsforce=require(_0x39bc('0xe'));var deskjs=require(_0x39bc('0xf'));var toCsv=require(_0x39bc('0xa'));var querystring=require(_0x39bc('0x10'));var Papa=require(_0x39bc('0x11'));var Redis=require('ioredis');var authService=require(_0x39bc('0x12'));var qs=require(_0x39bc('0x13'));var as=require(_0x39bc('0x14'));var hardwareService=require(_0x39bc('0x15'));var logger=require(_0x39bc('0x16'))(_0x39bc('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x39bc('0x18'))['db'];config[_0x39bc('0x19')]=_['defaults'](config[_0x39bc('0x19')],{'host':_0x39bc('0x1a'),'port':0x18eb});var socket=require(_0x39bc('0x1b'))(new Redis(config['redis']));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x39bc('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x39bc('0x1d')][_0x39bc('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5c63df,_0x546753,_0x413400){if(_0x413400){var _0x47528f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47528f[_0x39bc('0x1f')](_0x546753)){return _0x5c63df;}else{throw new db['Sequelize'][(_0x39bc('0x20'))](_0x39bc('0x21'));}}else{return _0x5c63df;}}function respondWithRpcPromise(_0x4495a0,_0x1e121f,_0x3064c1,_0x3f13c8){return new BPromise(function(_0x311923,_0x486757){var _0x1de936=_0x3f13c8||client;return _0x1de936[_0x39bc('0x22')](_0x4495a0,_0x3064c1)[_0x39bc('0x23')](function(_0x65ee0e){logger['info'](_0x39bc('0x24'),_0x1e121f,'request\x20sent');logger[_0x39bc('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1e121f,_0x39bc('0x26'),JSON[_0x39bc('0x27')](_0x65ee0e));if(_0x65ee0e[_0x39bc('0x28')]){if(_0x65ee0e[_0x39bc('0x28')][_0x39bc('0x29')]===0x1f4){logger['error'](_0x39bc('0x24'),_0x1e121f,_0x65ee0e[_0x39bc('0x28')]['message']);return _0x486757(_0x65ee0e[_0x39bc('0x28')][_0x39bc('0x2a')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x1e121f,_0x65ee0e[_0x39bc('0x28')][_0x39bc('0x2a')]);return _0x311923(_0x65ee0e['error'][_0x39bc('0x2a')]);}else{logger[_0x39bc('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x1e121f,'request\x20sent');_0x311923(_0x65ee0e['result'][_0x39bc('0x2a')]);}})[_0x39bc('0x2c')](function(_0x2ca4de){logger[_0x39bc('0x28')](_0x39bc('0x24'),_0x1e121f,_0x2ca4de);_0x486757(_0x2ca4de);});});}function respondWithStatusCode(_0x581148,_0x1a6d5b){_0x1a6d5b=_0x1a6d5b||0xcc;return function(_0x20ba97){if(_0x20ba97){return _0x581148[_0x39bc('0x2d')](_0x1a6d5b);}return _0x581148[_0x39bc('0x2e')](_0x1a6d5b)[_0x39bc('0x2f')]();};}function respondWithResult(_0x2f732b,_0x2a13bc){_0x2a13bc=_0x2a13bc||0xc8;return function(_0x41a85c){if(_0x41a85c){return _0x2f732b[_0x39bc('0x2e')](_0x2a13bc)[_0x39bc('0x30')](_0x41a85c);}};}function respondWithFilteredResult(_0x390a13,_0x4266b2){return function(_0x1c1d3f){if(_0x1c1d3f){var _0x1cba19=_0x1c1d3f[_0x39bc('0x31')],_0x2313d6=_0x4266b2['offset'],_0xd2694d=_0x4266b2[_0x39bc('0x32')]+_0x4266b2[_0x39bc('0x33')],_0x5239ea;if(_0xd2694d>=_0x1cba19){_0xd2694d=_0x1cba19;_0x5239ea=0xc8;}else{_0x5239ea=0xce;}_0x390a13[_0x39bc('0x2e')](_0x5239ea);return _0x390a13[_0x39bc('0x34')]('Content-Range',_0x2313d6+'-'+_0xd2694d+'/'+_0x1cba19)[_0x39bc('0x30')](_0x1c1d3f);}return null;};}function patchUpdates(_0x39d70a){return function(_0xf4beec){try{jsonpatch['apply'](_0xf4beec,_0x39d70a,!![]);}catch(_0x2fe76f){return BPromise['reject'](_0x2fe76f);}return _0xf4beec[_0x39bc('0x35')]();};}function saveUpdates(_0x22412a,_0xa9118b){return function(_0x31060e){if(_0x31060e){return _0x31060e[_0x39bc('0x36')](_0x22412a)[_0x39bc('0x23')](function(_0x2d00dd){return _0x2d00dd;});}return null;};}function removeEntity(_0x24f179,_0x12bbe4){return function(_0xe27a3f){if(_0xe27a3f){return _0xe27a3f[_0x39bc('0x37')]()[_0x39bc('0x23')](function(){_0x24f179[_0x39bc('0x2e')](0xcc)[_0x39bc('0x2f')]();});}};}function handleEntityNotFound(_0x84667c,_0x6c84d2){return function(_0xd26d07){if(!_0xd26d07){_0x84667c['sendStatus'](0x194);}return _0xd26d07;};}function handleError(_0x4a1ac6,_0x1b639c){_0x1b639c=_0x1b639c||0x1f4;return function(_0x194eb9){logger['error'](_0x194eb9[_0x39bc('0x38')]);if(_0x194eb9[_0x39bc('0x39')]){delete _0x194eb9['name'];}_0x4a1ac6[_0x39bc('0x2e')](_0x1b639c)[_0x39bc('0x3a')](_0x194eb9);};}exports[_0x39bc('0x3b')]=function(_0x4cbac7,_0x57e2c0){var _0x56a6e6={},_0x41f483={},_0x339a4b={'count':0x0,'rows':[]};var _0x3fe0a0=_[_0x39bc('0x3c')](db[_0x39bc('0x3d')][_0x39bc('0x3e')],function(_0x5796c3){return{'name':_0x5796c3[_0x39bc('0x3f')],'type':_0x5796c3[_0x39bc('0x40')]['key']};});_0x41f483[_0x39bc('0x41')]=_[_0x39bc('0x3c')](_0x3fe0a0,_0x39bc('0x39'));_0x41f483[_0x39bc('0x42')]=_['keys'](_0x4cbac7['query']);_0x41f483[_0x39bc('0x43')]=_[_0x39bc('0x44')](_0x41f483[_0x39bc('0x41')],_0x41f483[_0x39bc('0x42')]);_0x56a6e6[_0x39bc('0x45')]=_[_0x39bc('0x44')](_0x41f483['model'],qs['fields'](_0x4cbac7[_0x39bc('0x42')]['fields']));_0x56a6e6[_0x39bc('0x45')]=_0x56a6e6['attributes'][_0x39bc('0x46')]?_0x56a6e6[_0x39bc('0x45')]:_0x41f483[_0x39bc('0x41')];if(!_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x47')](_0x39bc('0x48'))){_0x56a6e6['limit']=qs['limit'](_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x33')]);_0x56a6e6[_0x39bc('0x32')]=qs[_0x39bc('0x32')](_0x4cbac7[_0x39bc('0x42')]['offset']);}_0x56a6e6[_0x39bc('0x49')]=qs[_0x39bc('0x4a')](_0x4cbac7['query'][_0x39bc('0x4a')]);_0x56a6e6[_0x39bc('0x4b')]=qs['filters'](_['pick'](_0x4cbac7[_0x39bc('0x42')],_0x41f483[_0x39bc('0x43')]),_0x3fe0a0);if(_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x4c')]){_0x56a6e6[_0x39bc('0x4b')]=_[_0x39bc('0x4d')](_0x56a6e6[_0x39bc('0x4b')],{'$or':_[_0x39bc('0x3c')](_0x3fe0a0,function(_0x8b306f){if(_0x8b306f[_0x39bc('0x40')]!==_0x39bc('0x4e')){var _0x44acfb={};_0x44acfb[_0x8b306f['name']]={'$like':'%'+_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x4c')]+'%'};return _0x44acfb;}})});}_0x56a6e6=_[_0x39bc('0x4d')]({},_0x56a6e6,_0x4cbac7['options']);var _0x450e49={'where':_0x56a6e6[_0x39bc('0x4b')]};return db['SmsMessage'][_0x39bc('0x31')](_0x450e49)[_0x39bc('0x23')](function(_0x1a2b0c){_0x339a4b[_0x39bc('0x31')]=_0x1a2b0c;if(_0x4cbac7[_0x39bc('0x42')][_0x39bc('0x4f')]){_0x56a6e6[_0x39bc('0x50')]=[{'all':!![]}];}return db[_0x39bc('0x3d')]['findAll'](_0x56a6e6);})[_0x39bc('0x23')](function(_0x8311e8){_0x339a4b[_0x39bc('0x51')]=_0x8311e8;return _0x339a4b;})['then'](respondWithFilteredResult(_0x57e2c0,_0x56a6e6))[_0x39bc('0x2c')](handleError(_0x57e2c0,null));};exports[_0x39bc('0x52')]=function(_0x5deb07,_0x23a13c){var _0x15d55d={'raw':!![],'where':{'id':_0x5deb07['params']['id']}},_0x5daabf={};_0x5daabf['model']=_[_0x39bc('0x53')](db['SmsMessage'][_0x39bc('0x3e')]);_0x5daabf[_0x39bc('0x42')]=_[_0x39bc('0x53')](_0x5deb07[_0x39bc('0x42')]);_0x5daabf[_0x39bc('0x43')]=_[_0x39bc('0x44')](_0x5daabf[_0x39bc('0x41')],_0x5daabf[_0x39bc('0x42')]);_0x15d55d[_0x39bc('0x45')]=_[_0x39bc('0x44')](_0x5daabf['model'],qs[_0x39bc('0x54')](_0x5deb07['query'][_0x39bc('0x54')]));_0x15d55d[_0x39bc('0x45')]=_0x15d55d['attributes'][_0x39bc('0x46')]?_0x15d55d[_0x39bc('0x45')]:_0x5daabf[_0x39bc('0x41')];if(_0x5deb07[_0x39bc('0x42')][_0x39bc('0x4f')]){_0x15d55d['include']=[{'all':!![]}];}_0x15d55d=_[_0x39bc('0x4d')]({},_0x15d55d,_0x5deb07[_0x39bc('0x55')]);return db[_0x39bc('0x3d')][_0x39bc('0x56')](_0x15d55d)[_0x39bc('0x23')](handleEntityNotFound(_0x23a13c,null))[_0x39bc('0x23')](respondWithResult(_0x23a13c,null))[_0x39bc('0x2c')](handleError(_0x23a13c,null));};exports[_0x39bc('0x57')]=function(_0x448a59,_0x32f392){return db['SmsMessage'][_0x39bc('0x57')](_0x448a59[_0x39bc('0x58')],{})['then'](respondWithResult(_0x32f392,0xc9))[_0x39bc('0x2c')](handleError(_0x32f392,null));};exports[_0x39bc('0x36')]=function(_0x2e5a42,_0x2d123c){if(_0x2e5a42[_0x39bc('0x58')]['id']){delete _0x2e5a42[_0x39bc('0x58')]['id'];}return db[_0x39bc('0x3d')][_0x39bc('0x56')]({'where':{'id':_0x2e5a42[_0x39bc('0x59')]['id']}})['then'](handleEntityNotFound(_0x2d123c,null))[_0x39bc('0x23')](saveUpdates(_0x2e5a42[_0x39bc('0x58')],null))[_0x39bc('0x23')](respondWithResult(_0x2d123c,null))[_0x39bc('0x2c')](handleError(_0x2d123c,null));};exports[_0x39bc('0x37')]=function(_0x429801,_0x2d7483){return db[_0x39bc('0x3d')]['find']({'where':{'id':_0x429801[_0x39bc('0x59')]['id']}})[_0x39bc('0x23')](handleEntityNotFound(_0x2d7483,null))[_0x39bc('0x23')](removeEntity(_0x2d7483,null))['catch'](handleError(_0x2d7483,null));};exports[_0x39bc('0x5a')]=function(_0x36675c,_0xe79197){return db['SmsMessage'][_0x39bc('0x5a')]()[_0x39bc('0x23')](respondWithResult(_0xe79197,null))[_0x39bc('0x2c')](handleError(_0xe79197,null));};var interaction_log=require('../../config/logger')(_0x39bc('0x5b'));exports[_0x39bc('0x5c')]=function(_0x55ecb9,_0x22a530,_0x52bad9){var _0x3b238c={'channel':_0x39bc('0x5d')};if(_0x55ecb9[_0x39bc('0x58')]['id']){delete _0x55ecb9[_0x39bc('0x58')]['id'];}_0x55ecb9['body']['read']=!![];_0x55ecb9[_0x39bc('0x58')][_0x39bc('0x5e')]=moment()[_0x39bc('0x5f')](_0x39bc('0x60'));_0x55ecb9[_0x39bc('0x58')][_0x39bc('0x61')]=_0x55ecb9[_0x39bc('0x58')][_0x39bc('0x61')]||_0x55ecb9[_0x39bc('0x62')]['id'];return db['SmsMessage'][_0x39bc('0x56')]({'where':{'id':_0x55ecb9[_0x39bc('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x39bc('0x63')],'as':_0x39bc('0x64')}]})[_0x39bc('0x23')](handleEntityNotFound(_0x22a530,null))[_0x39bc('0x23')](saveUpdates(_0x55ecb9['body'],null))['then'](function(_0x309c04){if(_0x309c04){_0x3b238c[_0x39bc('0x2a')]=_0x309c04[_0x39bc('0x65')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x309c04['SmsInteractionId']}});}return null;})[_0x39bc('0x23')](handleEntityNotFound(_0x22a530,null))[_0x39bc('0x23')](function(_0x57bc96){if(_0x57bc96){return _0x57bc96[_0x39bc('0x36')]({'UserId':_0x55ecb9[_0x39bc('0x58')][_0x39bc('0x61')],'read1stAt':_[_0x39bc('0x66')](_0x57bc96[_0x39bc('0x67')])?moment()[_0x39bc('0x5f')](_0x39bc('0x60')):undefined});}return null;})[_0x39bc('0x23')](function(_0x52b5f2){if(_0x52b5f2){_0x3b238c[_0x39bc('0x68')]=_0x52b5f2[_0x39bc('0x65')]({'plain':!![]});interaction_log[_0x39bc('0x2b')](_0x39bc('0x69'),_0x55ecb9[_0x39bc('0x62')]['id'],_0x55ecb9[_0x39bc('0x62')][_0x39bc('0x39')],_0x55ecb9[_0x39bc('0x62')][_0x39bc('0x6a')],_0x3b238c['interaction']['id'],_0x55ecb9[_0x39bc('0x58')]?JSON[_0x39bc('0x27')](_0x55ecb9['body']):_0x39bc('0x6b'));return respondWithRpcPromise(_0x39bc('0x6c'),_0x39bc('0x6d'),_0x3b238c);}return null;})[_0x39bc('0x23')](function(_0x2d51f5){if(_0x2d51f5){if(_0x55ecb9['body'][_0x39bc('0x6e')]){_0x3b238c[_0x39bc('0x2a')][_0x39bc('0x6f')]=util[_0x39bc('0x5f')](_0x39bc('0x70'),_0x55ecb9['user'][_0x39bc('0x39')]);_0x3b238c[_0x39bc('0x2a')][_0x39bc('0x71')]=_0x3b238c[_0x39bc('0x71')];_0x3b238c[_0x39bc('0x2a')][_0x39bc('0x72')]='accept';return respondWithRpcPromise('EventManager',_0x39bc('0x73'),{'event':_0x39bc('0x74'),'message':_0x3b238c[_0x39bc('0x2a')]},client9002)[_0x39bc('0x23')](function(){return _0x3b238c;});}return _0x3b238c;}return null;})[_0x39bc('0x23')](respondWithResult(_0x22a530,null))[_0x39bc('0x2c')](handleError(_0x22a530,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports['reject']=function(_0x56b3b3,_0x41d08e,_0x20f4cf){var _0x5f09ea={'agent':{},'channel':'sms'};if(_0x56b3b3['body']['id']){delete _0x56b3b3['body']['id'];}_0x56b3b3[_0x39bc('0x58')][_0x39bc('0x61')]=_0x56b3b3[_0x39bc('0x58')][_0x39bc('0x61')]||_0x56b3b3['user']['id'];_0x5f09ea[_0x39bc('0x75')]['id']=_0x56b3b3['body'][_0x39bc('0x61')];return db['SmsMessage']['find']({'where':{'id':_0x56b3b3['params']['id'],'UserId':null}})[_0x39bc('0x23')](handleEntityNotFound(_0x41d08e,null))[_0x39bc('0x23')](function(_0x18d15c){if(_0x18d15c){_0x5f09ea['message']=_0x18d15c[_0x39bc('0x65')]({'plain':!![]});return db[_0x39bc('0x76')][_0x39bc('0x56')]({'where':{'id':_0x18d15c[_0x39bc('0x77')]}});}return null;})[_0x39bc('0x23')](handleEntityNotFound(_0x41d08e,null))[_0x39bc('0x23')](function(_0x3a0b99){if(_0x3a0b99){_0x5f09ea[_0x39bc('0x68')]=_0x3a0b99['get']({'plain':!![]});interaction_log['info'](_0x39bc('0x78'),_0x56b3b3[_0x39bc('0x62')]['id'],_0x56b3b3[_0x39bc('0x62')][_0x39bc('0x39')],_0x56b3b3['user'][_0x39bc('0x6a')],_0x5f09ea[_0x39bc('0x68')]['id'],_0x56b3b3['body']?JSON['stringify'](_0x56b3b3[_0x39bc('0x58')]):_0x39bc('0x6b'));return respondWithRpcPromise('RejectMessage',_0x39bc('0x79'),_0x5f09ea);}return null;})['then'](function(_0x55c89b){if(_0x55c89b){_0x55c89b[_0x39bc('0x2a')]['interface']=util[_0x39bc('0x5f')](_0x39bc('0x70'),_0x56b3b3[_0x39bc('0x62')][_0x39bc('0x39')]);_0x55c89b[_0x39bc('0x2a')][_0x39bc('0x71')]=_0x5f09ea['channel'];_0x55c89b[_0x39bc('0x2a')][_0x39bc('0x72')]=_0x39bc('0x7a');respondWithRpcPromise(_0x39bc('0x73'),'EventManager',{'event':'rejectmessage','message':_0x55c89b[_0x39bc('0x2a')]},client9002);return _0x5f09ea;}return null;})[_0x39bc('0x23')](respondWithResult(_0x41d08e,null))[_0x39bc('0x2c')](handleError(_0x41d08e,null));};exports[_0x39bc('0x2e')]=function(_0x52de27,_0x4eddad,_0x2d9c9b){if(_0x52de27[_0x39bc('0x58')]['id']){delete _0x52de27[_0x39bc('0x58')]['id'];}var _0x9eeee4;return db[_0x39bc('0x3d')][_0x39bc('0x56')]({'where':{'id':_0x52de27[_0x39bc('0x59')]['id']}})['then'](handleEntityNotFound(_0x4eddad,null))['then'](function(_0x2d07d5){if(_0x2d07d5){_0x9eeee4=_0x2d07d5;return db[_0x39bc('0x7b')][_0x39bc('0x56')]({'where':{'id':_0x2d07d5[_0x39bc('0x7c')]}});}})[_0x39bc('0x23')](handleEntityNotFound(_0x4eddad,null))[_0x39bc('0x23')](function(_0x20e540){if(_0x20e540){logger[_0x39bc('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x20e540[_0x39bc('0x40')],util[_0x39bc('0x7d')](_0x52de27[_0x39bc('0x58')],{'showHidden':![],'depth':null}));switch(_0x20e540[_0x39bc('0x40')]){case _0x39bc('0x7e'):if(_0x52de27[_0x39bc('0x58')]['MessageSid']&&_0x52de27['body']['MessageSid']===_0x9eeee4['messageId']){return _0x9eeee4[_0x39bc('0x36')]({'read':!![]});}else{logger['error'](_0x39bc('0x7f'),_0x39bc('0x2e'),_0x39bc('0x7e'),util[_0x39bc('0x7d')](_0x52de27[_0x39bc('0x58')],{'showHidden':![],'depth':null}));}break;case _0x39bc('0x80'):if(_0x52de27['body']['MessageUUID']&&_0x52de27[_0x39bc('0x58')][_0x39bc('0x81')]===_0x9eeee4[_0x39bc('0x82')]&&_[_0x39bc('0x83')]([_0x39bc('0x84'),'delivered'],_0x52de27[_0x39bc('0x58')][_0x39bc('0x85')])>=0x0){return _0x9eeee4[_0x39bc('0x36')]({'read':!![]});}else{logger[_0x39bc('0x28')](_0x39bc('0x7f'),_0x39bc('0x2e'),'plivio',util[_0x39bc('0x7d')](_0x52de27[_0x39bc('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4ac76e=_0x52de27[_0x39bc('0x58')][_0x39bc('0x86')][0x0];if(_0x4ac76e['status'][_0x39bc('0x87')]===_0x39bc('0x88')){return _0x9eeee4['update']({'read':!![]});}else{logger[_0x39bc('0x28')](_0x39bc('0x7f'),'status',_0x39bc('0x89'),util[_0x39bc('0x7d')](_0x52de27['body'],{'showHidden':![],'depth':null}));}break;}return _0x9eeee4;}})[_0x39bc('0x23')](respondWithResult(_0x4eddad,null))[_0x39bc('0x2c')](handleError(_0x4eddad,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index dd1a4bd..1951f4f 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 _0x1107=['../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','hook','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1107,0x7d));var _0x7110=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1107[_0x4cf98e];return _0x1623ac;};'use strict';var EventEmitter=require(_0x7110('0x0'));var SmsMessage=require(_0x7110('0x1'))['db'][_0x7110('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7110('0x3')](0x0);var events={'afterCreate':_0x7110('0x4'),'afterUpdate':_0x7110('0x5'),'afterDestroy':_0x7110('0x6')};function emitEvent(_0x463857){return function(_0x4c9b20,_0x590064,_0x5c790b){SmsMessageEvents['emit'](_0x463857+':'+_0x4c9b20['id'],_0x4c9b20);SmsMessageEvents['emit'](_0x463857,_0x4c9b20);_0x5c790b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7110('0x7')](e,emitEvent(event));}}module[_0x7110('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xd40e=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x51b241,_0x187fab){var _0x16a3a7=function(_0x5f1b23){while(--_0x5f1b23){_0x51b241['push'](_0x51b241['shift']());}};_0x16a3a7(++_0x187fab);}(_0xd40e,0x155));var _0xed40=function(_0x3c1312,_0x45bfdb){_0x3c1312=_0x3c1312-0x0;var _0x5b4831=_0xd40e[_0x3c1312];return _0x5b4831;};'use strict';var EventEmitter=require(_0xed40('0x0'));var SmsMessage=require(_0xed40('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xed40('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xed40('0x3'),'afterDestroy':_0xed40('0x4')};function emitEvent(_0x11afc3){return function(_0x3d3c73,_0x3fb3d2,_0x14020f){SmsMessageEvents[_0xed40('0x5')](_0x11afc3+':'+_0x3d3c73['id'],_0x3d3c73);SmsMessageEvents['emit'](_0x11afc3,_0x3d3c73);_0x14020f(null);};}for(var e in events){if(events[_0xed40('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xed40('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2037300..afe318f 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 _0x4f98=['SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','senderString','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','remote','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','sort','createHash','digest','signature=','GET','/external/get/send.php?','keys','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','out','SmsAccount','SmsAccountId','type','twilio','authToken','accountSid','messages','phone','/api/sms/messages/','token','sid','error'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x4f98,0xc1));var _0x84f9=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x4f98[_0xcfeda9];return _0x4826c7;};'use strict';var _=require(_0x84f9('0x0'));var util=require(_0x84f9('0x1'));var logger=require(_0x84f9('0x2'))(_0x84f9('0x3'));var moment=require(_0x84f9('0x4'));var BPromise=require(_0x84f9('0x5'));var rp=require(_0x84f9('0x6'));var fs=require('fs');var path=require(_0x84f9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x84f9('0x8'));module['exports']=function(_0x137dbe,_0x3ad165){return _0x137dbe[_0x84f9('0x9')](_0x84f9('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x84f9('0xb'),'fields':[_0x84f9('0xb')]},{'name':_0x84f9('0xc'),'fields':[_0x84f9('0xd')],'type':_0x84f9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19ba13,_0x50ce54,_0x1ca981){var _0x4f8d89=_0x137dbe[_0x84f9('0xf')];var _0x1ad4a2=_0x19ba13['get']({'plain':!![]});if(_0x1ad4a2[_0x84f9('0x10')][_0x84f9('0x11')]()==='in'||_0x1ad4a2[_0x84f9('0x10')]['toLowerCase']()==='out'&&!_0x1ad4a2[_0x84f9('0x12')]&&!_[_0x84f9('0x13')](_0x1ad4a2['UserId'])){_0x4f8d89[_0x84f9('0x14')]['findOne']({'where':{'id':_0x1ad4a2[_0x84f9('0x15')]}})[_0x84f9('0x16')](function(_0x508d01){if(_0x508d01){_0x508d01[_0x84f9('0x17')]({'lastMsgAt':_0x1ad4a2[_0x84f9('0x18')],'lastMsgDirection':_0x1ad4a2[_0x84f9('0x10')]['toLowerCase']()});}})[_0x84f9('0x19')](function(_0x1a3ece){console['error'](_0x1a3ece);});}if(_0x1ad4a2[_0x84f9('0x10')]===_0x84f9('0x1a')&&!_0x1ad4a2[_0x84f9('0x12')]){var _0xbcde4;_0x4f8d89[_0x84f9('0x1b')]['find']({'where':{'id':_0x1ad4a2[_0x84f9('0x1c')]},'raw':!![]})[_0x84f9('0x16')](function(_0x32012c){_0xbcde4=_0x32012c;if(_0xbcde4&&_0xbcde4[_0x84f9('0x1d')]){switch(_0xbcde4[_0x84f9('0x1d')]){case'twilio':var _0x1c4e8c=require(_0x84f9('0x1e'));if(_0xbcde4['accountSid']&&_0xbcde4[_0x84f9('0x1f')]&&_0xbcde4['phone']){var _0x57de34=new _0x1c4e8c(_0xbcde4[_0x84f9('0x20')],_0xbcde4[_0x84f9('0x1f')]);_0x57de34[_0x84f9('0x21')]['create']({'body':_0x1ad4a2[_0x84f9('0xd')],'to':_0x1ad4a2['phone'],'from':_0xbcde4[_0x84f9('0x22')],'statusCallback':_0xbcde4['remote']+_0x84f9('0x23')+_0x1ad4a2['id']+'/status?token='+_0xbcde4[_0x84f9('0x24')]})[_0x84f9('0x16')](function(_0x134a2e){if(_0x134a2e['sid']){return _0x19ba13['update']({'messageId':_0x134a2e[_0x84f9('0x25')]});}})[_0x84f9('0x19')](function(_0x1bc7a9){logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x1e'),util[_0x84f9('0x29')](_0x1bc7a9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x1e'),_0x84f9('0x2a'));}break;case _0x84f9('0x2b'):var _0x208495=_0x84f9('0x2c');if(_0xbcde4[_0x84f9('0x2d')]&&_0xbcde4[_0x84f9('0x2e')]){var _0x1b8dd6={'recipient':[_0x1ad4a2[_0x84f9('0x22')]],'message':_0x1ad4a2['body'],'message_type':_0xbcde4[_0x84f9('0x2f')]};if(_0xbcde4[_0x84f9('0x2f')]&&_0xbcde4[_0x84f9('0x2f')]!=='SI'){_0x1b8dd6[_0x84f9('0x30')]=_0xbcde4['phone'];}var _0x3e30f8={'url':_0x208495+'login?username='+_0xbcde4['username']+_0x84f9('0x31')+_0xbcde4[_0x84f9('0x2e')],'method':'GET'};rp(_0x3e30f8)[_0x84f9('0x16')](function(_0x3faae0){var _0x45b531=_0x3faae0['split'](';');var _0x11003f={'user_key':_0x45b531[0x0],'session_key':_0x45b531[0x1]};_0x3e30f8={'url':_0x208495+_0x84f9('0x32'),'method':_0x84f9('0x33'),'headers':{'user_key':_0x11003f['user_key'],'Session_key':_0x11003f[_0x84f9('0x34')]},'json':!![],'body':_0x1b8dd6};return rp(_0x3e30f8);})[_0x84f9('0x16')](function(_0x4c873b){if(_0x4c873b[_0x84f9('0x35')]>=0x1){var _0x34c697={'messageId':_0x4c873b[_0x84f9('0x36')]};if(_0xbcde4[_0x84f9('0x2f')]!=='GP'||!_0xbcde4[_0x84f9('0x37')]){_0x34c697[_0x84f9('0x38')]=!![];}return _0x19ba13[_0x84f9('0x17')](_0x34c697);}else{return logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),'skebby',util[_0x84f9('0x29')](_0x4c873b,{'showHidden':![],'depth':null}));}})[_0x84f9('0x19')](function(_0x27f4f9){return logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x2b'),util[_0x84f9('0x29')](_0x27f4f9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x2b'),_0x84f9('0x39'));}break;case'connectel':if(_0xbcde4['authToken']){var _0x55798d={'recipient':_0x1ad4a2[_0x84f9('0x22')],'message':_0x1ad4a2[_0x84f9('0xd')],'sender':_0xbcde4['senderString']||_0xbcde4[_0x84f9('0x22')],'authorization':_0xbcde4[_0x84f9('0x1f')]};var _0x50ce54={'method':_0x84f9('0x33'),'uri':_0x84f9('0x3a'),'body':_0x55798d,'json':!![]};rp(_0x50ce54)[_0x84f9('0x16')](function(_0x25f6a0){var _0x597f8f={'messageId':_0x25f6a0[_0x84f9('0x3b')]};if(!_0xbcde4[_0x84f9('0x37')]){_0x597f8f['read']=!![];}return _0x19ba13[_0x84f9('0x17')](_0x597f8f);})['catch'](function(_0x3f6613){logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x84f9('0x3c'),util[_0x84f9('0x29')](_0x3f6613,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x3c'),_0x84f9('0x3d'));}break;case _0x84f9('0x3e'):if(_0xbcde4[_0x84f9('0x2d')]&&_0xbcde4[_0x84f9('0x2e')]){var _0x55798d={'messages':[{'source':'xCALLY\x20Motion','to':_0x1ad4a2[_0x84f9('0x22')],'body':_0x1ad4a2['body'],'from':_0xbcde4[_0x84f9('0x3f')]||_0xbcde4[_0x84f9('0x22')]}]};var _0x15cc37=util[_0x84f9('0x40')](_0x84f9('0x41'),_0xbcde4[_0x84f9('0x2d')],_0xbcde4[_0x84f9('0x2e')]);var _0x50ce54={'method':_0x84f9('0x33'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x55798d,'headers':{'Authorization':util['format'](_0x84f9('0x42'),new Buffer(_0x15cc37)[_0x84f9('0x43')](_0x84f9('0x44')))},'json':!![]};rp(_0x50ce54)['then'](function(_0x46aac2){if(_0x46aac2[_0x84f9('0x45')]>=0xc8&&_0x46aac2[_0x84f9('0x45')]<=0xce){if(_0x46aac2[_0x84f9('0x46')]&&_0x46aac2['data']['queued_count']>0x0){var _0x3d523c=_[_0x84f9('0x47')](_0x46aac2['data'][_0x84f9('0x21')]);var _0x369892={'messageId':_0x3d523c[_0x84f9('0x48')]};if(!_0xbcde4[_0x84f9('0x37')]){_0x369892[_0x84f9('0x38')]=!![];}return _0x19ba13['update'](_0x369892);}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x49'),util[_0x84f9('0x29')](_0x46aac2,{'showHidden':![],'depth':null}));}}else{logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x49'),util[_0x84f9('0x29')](_0x46aac2,{'showHidden':![],'depth':null}));}})[_0x84f9('0x19')](function(_0x1f1b7d){logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x49'),util[_0x84f9('0x29')](_0x1f1b7d,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x49'),_0x84f9('0x39'));}break;case _0x84f9('0x4a'):if(_0xbcde4[_0x84f9('0x4b')]&&_0xbcde4[_0x84f9('0x1f')]){var _0x55798d={'dst':_0x1ad4a2[_0x84f9('0x22')],'text':_0x1ad4a2[_0x84f9('0xd')],'src':_0xbcde4[_0x84f9('0x3f')]||_0xbcde4['phone'],'url':_0xbcde4[_0x84f9('0x4c')]+'/api/sms/messages/'+_0x1ad4a2['id']+_0x84f9('0x4d')+_0xbcde4[_0x84f9('0x24')]};var _0x15cc37=util[_0x84f9('0x40')]('%s:%s',_0xbcde4['authId'],_0xbcde4['authToken']);var _0x50ce54={'method':'POST','uri':util[_0x84f9('0x40')](_0x84f9('0x4e'),_0xbcde4[_0x84f9('0x4b')]),'body':_0x55798d,'headers':{'Authorization':util[_0x84f9('0x40')](_0x84f9('0x42'),new Buffer(_0x15cc37)[_0x84f9('0x43')](_0x84f9('0x44')))},'json':!![]};rp(_0x50ce54)[_0x84f9('0x16')](function(_0x5eff26){var _0x233d38={'messageId':_0x5eff26[_0x84f9('0x4f')][0x0]};return _0x19ba13[_0x84f9('0x17')](_0x233d38);})[_0x84f9('0x19')](function(_0x12f30e){logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x84f9('0x4a'),util[_0x84f9('0x29')](_0x12f30e,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x4a'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x84f9('0x50'):if(_0xbcde4[_0x84f9('0x2d')]&&_0xbcde4[_0x84f9('0x2e')]){if(_0xbcde4['baseUrl']){var _0x55755a={'method':_0x84f9('0x33'),'uri':_0xbcde4[_0x84f9('0x51')]+_0x84f9('0x52'),'body':{'username':_0xbcde4[_0x84f9('0x2d')],'password':_0xbcde4[_0x84f9('0x2e')]},'json':!![]};return rp(_0x55755a)['then'](function(_0x3d61df){var _0x1ef3d1={'method':_0x84f9('0x33'),'uri':_0xbcde4['baseUrl']+_0x84f9('0x53'),'body':{'messages':[{'from':_0xbcde4[_0x84f9('0x22')],'destinations':[{'to':_0x1ad4a2[_0x84f9('0x22')]}],'text':_0x1ad4a2[_0x84f9('0xd')],'notifyUrl':_0xbcde4['remote']+_0x84f9('0x23')+_0x1ad4a2['id']+'/status?token='+_0xbcde4[_0x84f9('0x24')],'notifyContentType':_0x84f9('0x54'),'callbackData':_0xbcde4[_0x84f9('0x22')]+';'+_0x1ad4a2[_0x84f9('0xd')]}]},'headers':{'Authorization':_0x84f9('0x55')+_0x3d61df[_0x84f9('0x24')]},'json':!![]};return rp(_0x1ef3d1)[_0x84f9('0x16')](function(_0x380da0){if(_0x380da0['messages']){var _0x1942d8={'messageId':_0x380da0[_0x84f9('0x21')][0x0]['messageId']};if(!_0xbcde4[_0x84f9('0x37')]){_0x1942d8[_0x84f9('0x38')]=!![];}return _0x19ba13[_0x84f9('0x17')](_0x1942d8);}else{return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x50'),util[_0x84f9('0x29')](_0x380da0,{'showHidden':![],'depth':null}));}});})[_0x84f9('0x19')](function(_0x27b57a){return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x50'),util[_0x84f9('0x29')](_0x27b57a,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x50'),_0x84f9('0x56'));}}else{logger[_0x84f9('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x84f9('0x28'),_0x84f9('0x50'),_0x84f9('0x39'));}break;case _0x84f9('0x57'):var _0x563d16=require(_0x84f9('0x58'));if(_0xbcde4[_0x84f9('0x59')]){var _0x4df613={};_0x4df613[_0x84f9('0x5a')]=_0xbcde4['username'];_0x4df613['phone']=_0x1ad4a2[_0x84f9('0x22')];_0x4df613[_0x84f9('0x30')]=_0xbcde4[_0x84f9('0x22')];_0x4df613[_0x84f9('0x5b')]=_0x1ad4a2['body'];_0x4df613['timestamp']=+new Date();var _0x386882='';var _0x3248b4='';var _0x333d20=Object['keys'](_0x4df613);_0x333d20[_0x84f9('0x5c')]();for(var _0x59e0ce=0x0;_0x59e0ce<_0x333d20['length'];_0x59e0ce++){if(_0x386882!=''){_0x386882+='&';}_0x386882+=_0x333d20[_0x59e0ce]+'='+encodeURIComponent(_0x4df613[_0x333d20[_0x59e0ce]]);_0x3248b4+=_0x4df613[_0x333d20[_0x59e0ce]];}_0x3248b4+=_0xbcde4[_0x84f9('0x59')];_0x3248b4=_0x563d16[_0x84f9('0x5d')]('md5')[_0x84f9('0x17')](_0x3248b4)[_0x84f9('0x5e')]('hex');if(_0x386882!==''){_0x386882+='&';}_0x386882+=_0x84f9('0x5f')+_0x3248b4;var _0x3e30f8={'method':_0x84f9('0x60'),'uri':_0xbcde4[_0x84f9('0x51')]+_0x84f9('0x61')+_0x386882,'json':!![]};return rp(_0x3e30f8)[_0x84f9('0x16')](function(_0x42f55e){var _0x17ee51=Object[_0x84f9('0x62')](_0x42f55e);if(_0x42f55e[_0x17ee51[0x0]]['error']&&parseInt(_0x42f55e[_0x17ee51[0x0]][_0x84f9('0x26')])===0x0){var _0x23aeb7={'messageId':_0x42f55e[_0x17ee51[0x0]]['id_sms']};if(!_0xbcde4['deliveryReport']){_0x23aeb7['read']=!![];}return _0x19ba13[_0x84f9('0x17')](_0x23aeb7);}else{return logger[_0x84f9('0x26')](_0x84f9('0x27'),'afterCreate',_0x84f9('0x57'),util['inspect'](_0x42f55e[_0x84f9('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4deee3){return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x57'),util[_0x84f9('0x29')](_0x4deee3,{'showHidden':![],'depth':null}));});}else{logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x57'),_0x84f9('0x63'));}break;case _0x84f9('0x64'):if(_0xbcde4[_0x84f9('0x59')]){var _0x24ab29={'method':'POST','uri':_0x84f9('0x65'),'headers':{'Authorization':_0xbcde4[_0x84f9('0x59')]},'body':{'content':_0x1ad4a2[_0x84f9('0xd')],'to':[_0x1ad4a2[_0x84f9('0x22')]],'from':_0xbcde4[_0x84f9('0x22')],'binary':![],'clientMessageId':_0x84f9('0x66'),'charset':_0x84f9('0x67')},'json':!![]};rp(_0x24ab29)[_0x84f9('0x16')](function(_0x414eff){if(!_0x414eff[_0x84f9('0x26')]){var _0x131ed1={'messageId':_0x414eff[_0x84f9('0x21')][0x0][_0x84f9('0x68')]};if(!_0xbcde4['deliveryReport']){_0x131ed1[_0x84f9('0x38')]=!![];}return _0x19ba13[_0x84f9('0x17')](_0x131ed1);}else{return logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x64'),util[_0x84f9('0x29')](_0x414eff[_0x84f9('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x39ac23){return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x64'),util[_0x84f9('0x29')](_0x39ac23,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x84f9('0x27'),_0x84f9('0x28'),'clickatell',_0x84f9('0x63'));}break;case _0x84f9('0x69'):if(_0xbcde4['apiKey']){var _0x6a567={};var _0x3e30f8={'method':'POST','uri':_0x84f9('0x6a'),'headers':{'Authorization':_0x84f9('0x6b')+_0xbcde4[_0x84f9('0x59')],'Content-Type':_0x84f9('0x54')},'body':{'from':_0xbcde4[_0x84f9('0x22')],'to':_0x1ad4a2[_0x84f9('0x22')],'text':_0x1ad4a2[_0x84f9('0xd')]},'json':!![]};return rp(_0x3e30f8)[_0x84f9('0x16')](function(_0x102c06){if(_0x102c06[_0x84f9('0x6c')]==0xca){_0x6a567[_0x84f9('0x6d')]=_0x102c06;var _0x3165da={'method':_0x84f9('0x33'),'uri':_0x84f9('0x6e'),'headers':{'Authorization':_0x84f9('0x6b')+_0xbcde4[_0x84f9('0x59')],'Content-Type':_0x84f9('0x54')},'body':{'refid':_0x6a567['message']['refid']},'json':!![]};return rp(_0x3165da)[_0x84f9('0x16')](function(_0x3386cc){_0x6a567[_0x84f9('0x6f')]=_0x3386cc;var _0x11d68c={'messageId':_0x6a567['message'][_0x84f9('0x70')],'read':!![]};return _0x19ba13[_0x84f9('0x17')](_0x11d68c);});}else{return logger[_0x84f9('0x26')](_0x84f9('0x27'),_0x84f9('0x28'),_0x84f9('0x69'),util[_0x84f9('0x29')](_0x102c06,{'showHidden':![],'depth':null}));}})[_0x84f9('0x19')](function(_0x3c3aca){return logger[_0x84f9('0x26')](_0x84f9('0x27'),'afterCreate',_0x84f9('0x69'),util[_0x84f9('0x29')](_0x3c3aca,{'showHidden':![],'depth':null}));});}else{return logger[_0x84f9('0x26')](_0x84f9('0x27'),'afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0x84f9('0x71')](function(){_0x1ca981();});}else{_0x1ca981();}}},'charset':_0x84f9('0x72'),'collate':_0x84f9('0x73')});}; \ No newline at end of file +var _0xdd91=['baseUrl','/auth/1/session','/api/sms/messages/','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','sort','length','createHash','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','error','SmsAccountId','type','twilio','accountSid','phone','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','user_key','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','authToken','senderString','POST','https://smsapi.connectel.se/api/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip'];(function(_0x136852,_0x313cd0){var _0x49fb3b=function(_0x2f9e14){while(--_0x2f9e14){_0x136852['push'](_0x136852['shift']());}};_0x49fb3b(++_0x313cd0);}(_0xdd91,0x188));var _0x1dd9=function(_0x342616,_0x4ea22c){_0x342616=_0x342616-0x0;var _0x5c1cdb=_0xdd91[_0x342616];return _0x5c1cdb;};'use strict';var _=require(_0x1dd9('0x0'));var util=require(_0x1dd9('0x1'));var logger=require(_0x1dd9('0x2'))(_0x1dd9('0x3'));var moment=require(_0x1dd9('0x4'));var BPromise=require('bluebird');var rp=require(_0x1dd9('0x5'));var fs=require('fs');var path=require(_0x1dd9('0x6'));var rimraf=require(_0x1dd9('0x7'));var config=require(_0x1dd9('0x8'));var attributes=require(_0x1dd9('0x9'));module[_0x1dd9('0xa')]=function(_0x287443,_0x46159d){return _0x287443[_0x1dd9('0xb')]('SmsMessage',attributes,{'tableName':_0x1dd9('0xc'),'paranoid':![],'indexes':[{'name':_0x1dd9('0xd'),'fields':[_0x1dd9('0xd')]},{'name':'fti_sms_messages','fields':[_0x1dd9('0xe')],'type':_0x1dd9('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41bae0,_0x2a797c,_0x242ff9){var _0x2ec890=_0x287443[_0x1dd9('0x10')];var _0x31f50b=_0x41bae0['get']({'plain':!![]});if(_0x31f50b[_0x1dd9('0x11')][_0x1dd9('0x12')]()==='in'||_0x31f50b[_0x1dd9('0x11')][_0x1dd9('0x12')]()===_0x1dd9('0x13')&&!_0x31f50b[_0x1dd9('0x14')]&&!_[_0x1dd9('0x15')](_0x31f50b[_0x1dd9('0x16')])){_0x2ec890[_0x1dd9('0x17')][_0x1dd9('0x18')]({'where':{'id':_0x31f50b['SmsInteractionId']}})[_0x1dd9('0x19')](function(_0x12967d){if(_0x12967d){_0x12967d[_0x1dd9('0x1a')]({'lastMsgAt':_0x31f50b[_0x1dd9('0x1b')],'lastMsgDirection':_0x31f50b[_0x1dd9('0x11')][_0x1dd9('0x12')]()});}})[_0x1dd9('0x1c')](function(_0x12552){console[_0x1dd9('0x1d')](_0x12552);});}if(_0x31f50b[_0x1dd9('0x11')]==='out'&&!_0x31f50b[_0x1dd9('0x14')]){var _0x59a63a;_0x2ec890['SmsAccount']['find']({'where':{'id':_0x31f50b[_0x1dd9('0x1e')]},'raw':!![]})[_0x1dd9('0x19')](function(_0x53576c){_0x59a63a=_0x53576c;if(_0x59a63a&&_0x59a63a[_0x1dd9('0x1f')]){switch(_0x59a63a[_0x1dd9('0x1f')]){case _0x1dd9('0x20'):var _0xcb2c11=require(_0x1dd9('0x20'));if(_0x59a63a[_0x1dd9('0x21')]&&_0x59a63a['authToken']&&_0x59a63a[_0x1dd9('0x22')]){var _0x3dca45=new _0xcb2c11(_0x59a63a[_0x1dd9('0x21')],_0x59a63a['authToken']);_0x3dca45[_0x1dd9('0x23')][_0x1dd9('0x24')]({'body':_0x31f50b[_0x1dd9('0xe')],'to':_0x31f50b[_0x1dd9('0x22')],'from':_0x59a63a[_0x1dd9('0x22')],'statusCallback':_0x59a63a[_0x1dd9('0x25')]+'/api/sms/messages/'+_0x31f50b['id']+_0x1dd9('0x26')+_0x59a63a[_0x1dd9('0x27')]})[_0x1dd9('0x19')](function(_0x40a6c8){if(_0x40a6c8[_0x1dd9('0x28')]){return _0x41bae0[_0x1dd9('0x1a')]({'messageId':_0x40a6c8[_0x1dd9('0x28')]});}})['catch'](function(_0x256cde){logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x20'),util[_0x1dd9('0x2b')](_0x256cde,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x20'),_0x1dd9('0x2c'));}break;case'skebby':var _0x2c9824=_0x1dd9('0x2d');if(_0x59a63a[_0x1dd9('0x2e')]&&_0x59a63a[_0x1dd9('0x2f')]){var _0x38f16a={'recipient':[_0x31f50b[_0x1dd9('0x22')]],'message':_0x31f50b[_0x1dd9('0xe')],'message_type':_0x59a63a['smsMethod']};if(_0x59a63a[_0x1dd9('0x30')]&&_0x59a63a[_0x1dd9('0x30')]!=='SI'){_0x38f16a[_0x1dd9('0x31')]=_0x59a63a[_0x1dd9('0x22')];}var _0x3931ed={'url':_0x2c9824+_0x1dd9('0x32')+_0x59a63a[_0x1dd9('0x2e')]+_0x1dd9('0x33')+_0x59a63a[_0x1dd9('0x2f')],'method':_0x1dd9('0x34')};rp(_0x3931ed)[_0x1dd9('0x19')](function(_0x59fb81){var _0x198404=_0x59fb81['split'](';');var _0x4c970d={'user_key':_0x198404[0x0],'session_key':_0x198404[0x1]};_0x3931ed={'url':_0x2c9824+_0x1dd9('0x35'),'method':'POST','headers':{'user_key':_0x4c970d[_0x1dd9('0x36')],'Session_key':_0x4c970d['session_key']},'json':!![],'body':_0x38f16a};return rp(_0x3931ed);})['then'](function(_0x2d313b){if(_0x2d313b['total_sent']>=0x1){var _0x50503a={'messageId':_0x2d313b[_0x1dd9('0x37')]};if(_0x59a63a[_0x1dd9('0x30')]!=='GP'||!_0x59a63a[_0x1dd9('0x38')]){_0x50503a['read']=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x50503a);}else{return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1dd9('0x39'),util[_0x1dd9('0x2b')](_0x2d313b,{'showHidden':![],'depth':null}));}})[_0x1dd9('0x1c')](function(_0x54680e){return logger['error'](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x39'),util['inspect'](_0x54680e,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x39'),_0x1dd9('0x3a'));}break;case'connectel':if(_0x59a63a[_0x1dd9('0x3b')]){var _0x358796={'recipient':_0x31f50b['phone'],'message':_0x31f50b[_0x1dd9('0xe')],'sender':_0x59a63a[_0x1dd9('0x3c')]||_0x59a63a['phone'],'authorization':_0x59a63a[_0x1dd9('0x3b')]};var _0x2a797c={'method':_0x1dd9('0x3d'),'uri':_0x1dd9('0x3e'),'body':_0x358796,'json':!![]};rp(_0x2a797c)[_0x1dd9('0x19')](function(_0x12672c){var _0x586181={'messageId':_0x12672c[_0x1dd9('0x3f')]};if(!_0x59a63a[_0x1dd9('0x38')]){_0x586181[_0x1dd9('0x40')]=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x586181);})[_0x1dd9('0x1c')](function(_0x1f5b23){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),'connectel',util[_0x1dd9('0x2b')](_0x1f5b23,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),'connectel',_0x1dd9('0x41'));}break;case _0x1dd9('0x42'):if(_0x59a63a[_0x1dd9('0x2e')]&&_0x59a63a['password']){var _0x358796={'messages':[{'source':_0x1dd9('0x43'),'to':_0x31f50b[_0x1dd9('0x22')],'body':_0x31f50b[_0x1dd9('0xe')],'from':_0x59a63a[_0x1dd9('0x3c')]||_0x59a63a[_0x1dd9('0x22')]}]};var _0x31510f=util[_0x1dd9('0x44')](_0x1dd9('0x45'),_0x59a63a[_0x1dd9('0x2e')],_0x59a63a[_0x1dd9('0x2f')]);var _0x2a797c={'method':'POST','uri':_0x1dd9('0x46'),'body':_0x358796,'headers':{'Authorization':util[_0x1dd9('0x44')](_0x1dd9('0x47'),new Buffer(_0x31510f)[_0x1dd9('0x48')]('base64'))},'json':!![]};rp(_0x2a797c)[_0x1dd9('0x19')](function(_0x26c267){if(_0x26c267[_0x1dd9('0x49')]>=0xc8&&_0x26c267['http_code']<=0xce){if(_0x26c267['data']&&_0x26c267[_0x1dd9('0x4a')][_0x1dd9('0x4b')]>0x0){var _0x41c892=_['head'](_0x26c267[_0x1dd9('0x4a')][_0x1dd9('0x23')]);var _0x3f8d0f={'messageId':_0x41c892[_0x1dd9('0x4c')]};if(!_0x59a63a[_0x1dd9('0x38')]){_0x3f8d0f['read']=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x3f8d0f);}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4d'),util['inspect'](_0x26c267,{'showHidden':![],'depth':null}));}}else{logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),_0x1dd9('0x4d'),util['inspect'](_0x26c267,{'showHidden':![],'depth':null}));}})[_0x1dd9('0x1c')](function(_0x7c6abf){logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4d'),util[_0x1dd9('0x2b')](_0x7c6abf,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4d'),_0x1dd9('0x3a'));}break;case _0x1dd9('0x4e'):if(_0x59a63a[_0x1dd9('0x4f')]&&_0x59a63a[_0x1dd9('0x3b')]){var _0x358796={'dst':_0x31f50b[_0x1dd9('0x22')],'text':_0x31f50b['body'],'src':_0x59a63a[_0x1dd9('0x3c')]||_0x59a63a[_0x1dd9('0x22')],'url':_0x59a63a['remote']+'/api/sms/messages/'+_0x31f50b['id']+_0x1dd9('0x26')+_0x59a63a[_0x1dd9('0x27')]};var _0x31510f=util[_0x1dd9('0x44')](_0x1dd9('0x45'),_0x59a63a[_0x1dd9('0x4f')],_0x59a63a[_0x1dd9('0x3b')]);var _0x2a797c={'method':_0x1dd9('0x3d'),'uri':util['format'](_0x1dd9('0x50'),_0x59a63a[_0x1dd9('0x4f')]),'body':_0x358796,'headers':{'Authorization':util[_0x1dd9('0x44')](_0x1dd9('0x47'),new Buffer(_0x31510f)[_0x1dd9('0x48')](_0x1dd9('0x51')))},'json':!![]};rp(_0x2a797c)[_0x1dd9('0x19')](function(_0x4250b1){var _0x4bbd3a={'messageId':_0x4250b1[_0x1dd9('0x52')][0x0]};return _0x41bae0['update'](_0x4bbd3a);})[_0x1dd9('0x1c')](function(_0x4b4260){logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4e'),util['inspect'](_0x4b4260,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x1dd9('0x53'):if(_0x59a63a['username']&&_0x59a63a['password']){if(_0x59a63a[_0x1dd9('0x54')]){var _0x14c73f={'method':_0x1dd9('0x3d'),'uri':_0x59a63a['baseUrl']+_0x1dd9('0x55'),'body':{'username':_0x59a63a[_0x1dd9('0x2e')],'password':_0x59a63a[_0x1dd9('0x2f')]},'json':!![]};return rp(_0x14c73f)[_0x1dd9('0x19')](function(_0xe15fc5){var _0x5c5a1f={'method':_0x1dd9('0x3d'),'uri':_0x59a63a[_0x1dd9('0x54')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x59a63a['phone'],'destinations':[{'to':_0x31f50b['phone']}],'text':_0x31f50b[_0x1dd9('0xe')],'notifyUrl':_0x59a63a[_0x1dd9('0x25')]+_0x1dd9('0x56')+_0x31f50b['id']+_0x1dd9('0x26')+_0x59a63a[_0x1dd9('0x27')],'notifyContentType':_0x1dd9('0x57'),'callbackData':_0x59a63a['phone']+';'+_0x31f50b[_0x1dd9('0xe')]}]},'headers':{'Authorization':_0x1dd9('0x58')+_0xe15fc5[_0x1dd9('0x27')]},'json':!![]};return rp(_0x5c5a1f)[_0x1dd9('0x19')](function(_0x4c0a22){if(_0x4c0a22[_0x1dd9('0x23')]){var _0x15f15b={'messageId':_0x4c0a22[_0x1dd9('0x23')][0x0][_0x1dd9('0xd')]};if(!_0x59a63a['deliveryReport']){_0x15f15b[_0x1dd9('0x40')]=!![];}return _0x41bae0['update'](_0x15f15b);}else{return logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),'infobip',util[_0x1dd9('0x2b')](_0x4c0a22,{'showHidden':![],'depth':null}));}});})[_0x1dd9('0x1c')](function(_0x1dce89){return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),_0x1dd9('0x53'),util[_0x1dd9('0x2b')](_0x1dce89,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),'infobip',_0x1dd9('0x59'));}}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x53'),_0x1dd9('0x3a'));}break;case _0x1dd9('0x5a'):var _0x4b9c10=require(_0x1dd9('0x5b'));if(_0x59a63a[_0x1dd9('0x5c')]){var _0x47eb03={};_0x47eb03['login']=_0x59a63a[_0x1dd9('0x2e')];_0x47eb03[_0x1dd9('0x22')]=_0x31f50b[_0x1dd9('0x22')];_0x47eb03[_0x1dd9('0x31')]=_0x59a63a[_0x1dd9('0x22')];_0x47eb03[_0x1dd9('0x5d')]=_0x31f50b[_0x1dd9('0xe')];_0x47eb03['timestamp']=+new Date();var _0x285467='';var _0x4e39fd='';var _0x2ff8fd=Object[_0x1dd9('0x5e')](_0x47eb03);_0x2ff8fd[_0x1dd9('0x5f')]();for(var _0x4724ed=0x0;_0x4724ed<_0x2ff8fd[_0x1dd9('0x60')];_0x4724ed++){if(_0x285467!=''){_0x285467+='&';}_0x285467+=_0x2ff8fd[_0x4724ed]+'='+encodeURIComponent(_0x47eb03[_0x2ff8fd[_0x4724ed]]);_0x4e39fd+=_0x47eb03[_0x2ff8fd[_0x4724ed]];}_0x4e39fd+=_0x59a63a['apiKey'];_0x4e39fd=_0x4b9c10[_0x1dd9('0x61')]('md5')[_0x1dd9('0x1a')](_0x4e39fd)[_0x1dd9('0x62')](_0x1dd9('0x63'));if(_0x285467!==''){_0x285467+='&';}_0x285467+=_0x1dd9('0x64')+_0x4e39fd;var _0x3931ed={'method':_0x1dd9('0x34'),'uri':_0x59a63a['baseUrl']+_0x1dd9('0x65')+_0x285467,'json':!![]};return rp(_0x3931ed)[_0x1dd9('0x19')](function(_0x392af1){var _0x4a07b2=Object[_0x1dd9('0x5e')](_0x392af1);if(_0x392af1[_0x4a07b2[0x0]][_0x1dd9('0x1d')]&&parseInt(_0x392af1[_0x4a07b2[0x0]][_0x1dd9('0x1d')])===0x0){var _0x2f9655={'messageId':_0x392af1[_0x4a07b2[0x0]][_0x1dd9('0x66')]};if(!_0x59a63a[_0x1dd9('0x38')]){_0x2f9655[_0x1dd9('0x40')]=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x2f9655);}else{return logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x5a'),util['inspect'](_0x392af1[_0x1dd9('0x1d')],{'showHidden':![],'depth':null}));}})[_0x1dd9('0x1c')](function(_0x50887f){return logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x5a'),util['inspect'](_0x50887f,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x5a'),_0x1dd9('0x67'));}break;case _0x1dd9('0x68'):if(_0x59a63a[_0x1dd9('0x5c')]){var _0x5edc8d={'method':_0x1dd9('0x3d'),'uri':_0x1dd9('0x69'),'headers':{'Authorization':_0x59a63a['apiKey']},'body':{'content':_0x31f50b['body'],'to':[_0x31f50b[_0x1dd9('0x22')]],'from':_0x59a63a[_0x1dd9('0x22')],'binary':![],'clientMessageId':_0x1dd9('0x6a'),'charset':_0x1dd9('0x6b')},'json':!![]};rp(_0x5edc8d)['then'](function(_0x4c0c38){if(!_0x4c0c38[_0x1dd9('0x1d')]){var _0x3e7cc6={'messageId':_0x4c0c38[_0x1dd9('0x23')][0x0]['apiMessageId']};if(!_0x59a63a[_0x1dd9('0x38')]){_0x3e7cc6[_0x1dd9('0x40')]=!![];}return _0x41bae0[_0x1dd9('0x1a')](_0x3e7cc6);}else{return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),_0x1dd9('0x68'),util[_0x1dd9('0x2b')](_0x4c0c38[_0x1dd9('0x1d')],{'showHidden':![],'depth':null}));}})[_0x1dd9('0x1c')](function(_0x54b1b1){return logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),'clickatell',util[_0x1dd9('0x2b')](_0x54b1b1,{'showHidden':![],'depth':null}));});}else{logger[_0x1dd9('0x1d')](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x68'),_0x1dd9('0x67'));}break;case _0x1dd9('0x6c'):if(_0x59a63a[_0x1dd9('0x5c')]){var _0xb19424={};var _0x3931ed={'method':_0x1dd9('0x3d'),'uri':_0x1dd9('0x6d'),'headers':{'Authorization':_0x1dd9('0x6e')+_0x59a63a[_0x1dd9('0x5c')],'Content-Type':_0x1dd9('0x57')},'body':{'from':_0x59a63a[_0x1dd9('0x22')],'to':_0x31f50b[_0x1dd9('0x22')],'text':_0x31f50b[_0x1dd9('0xe')]},'json':!![]};return rp(_0x3931ed)['then'](function(_0x299f09){if(_0x299f09['code']==0xca){_0xb19424[_0x1dd9('0x6f')]=_0x299f09;var _0x31d50c={'method':_0x1dd9('0x3d'),'uri':_0x1dd9('0x70'),'headers':{'Authorization':_0x1dd9('0x6e')+_0x59a63a['apiKey'],'Content-Type':_0x1dd9('0x57')},'body':{'refid':_0xb19424['message'][_0x1dd9('0x71')]},'json':!![]};return rp(_0x31d50c)['then'](function(_0x6efe1e){_0xb19424[_0x1dd9('0x72')]=_0x6efe1e;var _0xe0a59c={'messageId':_0xb19424[_0x1dd9('0x6f')]['refid'],'read':!![]};return _0x41bae0[_0x1dd9('0x1a')](_0xe0a59c);});}else{return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),'intelepeer',util['inspect'](_0x299f09,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2fb91d){return logger[_0x1dd9('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1dd9('0x2a'),_0x1dd9('0x6c'),util['inspect'](_0x2fb91d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x1dd9('0x29'),_0x1dd9('0x2a'),_0x1dd9('0x6c'),_0x1dd9('0x73'));}break;}}})[_0x1dd9('0x74')](function(){_0x242ff9();});}else{_0x242ff9();}}},'charset':_0x1dd9('0x75'),'collate':_0x1dd9('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2c3b78d..4b3a6e5 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 _0x4fc2=['message','info','result','catch','CreateSmsMessage','SmsMessage','body','options','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x4fc2,0x111));var _0x24fc=function(_0x42f036,_0x5e6443){_0x42f036=_0x42f036-0x0;var _0xcda4b=_0x4fc2[_0x42f036];return _0xcda4b;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});config['redis']=_[_0x24fc('0xb')](config[_0x24fc('0xc')],{'host':_0x24fc('0xd'),'port':0x18eb});var socket=require(_0x24fc('0xe'))(new Redis(config[_0x24fc('0xc')]));require(_0x24fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x44caca,_0x1819a5,_0x1a4462){return new BPromise(function(_0x133438,_0x24998d){return client[_0x24fc('0x10')](_0x44caca,_0x1a4462)[_0x24fc('0x11')](function(_0x9a1673){logger['info'](_0x24fc('0x12'),_0x1819a5,_0x24fc('0x13'));logger['debug'](_0x24fc('0x14'),_0x1819a5,_0x24fc('0x13'),JSON[_0x24fc('0x15')](_0x9a1673));if(_0x9a1673[_0x24fc('0x16')]){if(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x17')]===0x1f4){logger['error'](_0x24fc('0x12'),_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x24998d(_0x9a1673[_0x24fc('0x16')]['message']);}logger[_0x24fc('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1819a5,_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);return _0x133438(_0x9a1673[_0x24fc('0x16')][_0x24fc('0x18')]);}else{logger[_0x24fc('0x19')]('SmsMessage,\x20%s,\x20%s',_0x1819a5,_0x24fc('0x13'));_0x133438(_0x9a1673[_0x24fc('0x1a')][_0x24fc('0x18')]);}})[_0x24fc('0x1b')](function(_0x4c5a43){logger[_0x24fc('0x16')](_0x24fc('0x12'),_0x1819a5,_0x4c5a43);_0x24998d(_0x4c5a43);});});}exports[_0x24fc('0x1c')]=function(_0x5b0516){var _0x32a57d=this;return new Promise(function(_0x36a771,_0xbf1d6b){return db[_0x24fc('0x1d')]['create'](_0x5b0516[_0x24fc('0x1e')],{'raw':_0x5b0516['options']?_0x5b0516[_0x24fc('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x24fc('0x11')](function(_0x44c121){logger[_0x24fc('0x19')]('CreateSmsMessage',_0x5b0516);logger[_0x24fc('0x20')]('CreateSmsMessage',_0x5b0516,JSON[_0x24fc('0x15')](_0x44c121));_0x36a771(_0x44c121);})[_0x24fc('0x1b')](function(_0x36a9b4){logger[_0x24fc('0x16')](_0x24fc('0x1c'),_0x36a9b4[_0x24fc('0x18')],_0x5b0516);_0xbf1d6b(_0x32a57d[_0x24fc('0x16')](0x1f4,_0x36a9b4[_0x24fc('0x18')]));});});}; \ No newline at end of file +var _0x66fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify'];(function(_0x4e7c03,_0x29ffcf){var _0x5510d3=function(_0xe60000){while(--_0xe60000){_0x4e7c03['push'](_0x4e7c03['shift']());}};_0x5510d3(++_0x29ffcf);}(_0x66fa,0x117));var _0xa66f=function(_0xbfaba2,_0x1e8ea2){_0xbfaba2=_0xbfaba2-0x0;var _0x491bfe=_0x66fa[_0xbfaba2];return _0x491bfe;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});config[_0xa66f('0xb')]=_[_0xa66f('0xc')](config[_0xa66f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0xd'))(new Redis(config['redis']));require(_0xa66f('0xe'))['register'](socket);function respondWithRpcPromise(_0x101e10,_0x53ca76,_0x52d802){return new BPromise(function(_0x55e6dc,_0x1e1997){return client[_0xa66f('0xf')](_0x101e10,_0x52d802)['then'](function(_0x14d31e){logger['info'](_0xa66f('0x10'),_0x53ca76,'request\x20sent');logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x53ca76,_0xa66f('0x13'),JSON['stringify'](_0x14d31e));if(_0x14d31e['error']){if(_0x14d31e[_0xa66f('0x14')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);return _0x1e1997(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}logger[_0xa66f('0x14')]('SmsMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e['error'][_0xa66f('0x15')]);return _0x55e6dc(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}else{logger[_0xa66f('0x16')]('SmsMessage,\x20%s,\x20%s',_0x53ca76,_0xa66f('0x13'));_0x55e6dc(_0x14d31e['result']['message']);}})[_0xa66f('0x17')](function(_0x413e80){logger[_0xa66f('0x14')](_0xa66f('0x10'),_0x53ca76,_0x413e80);_0x1e1997(_0x413e80);});});}exports[_0xa66f('0x18')]=function(_0x408bc7){var _0x251f60=this;return new Promise(function(_0x150291,_0x2033a4){return db[_0xa66f('0x19')][_0xa66f('0x1a')](_0x408bc7[_0xa66f('0x1b')],{'raw':_0x408bc7[_0xa66f('0x1c')]?_0x408bc7[_0xa66f('0x1c')][_0xa66f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x27f570){logger[_0xa66f('0x16')](_0xa66f('0x18'),_0x408bc7);logger[_0xa66f('0x11')]('CreateSmsMessage',_0x408bc7,JSON[_0xa66f('0x1e')](_0x27f570));_0x150291(_0x27f570);})[_0xa66f('0x17')](function(_0x209f4d){logger[_0xa66f('0x14')]('CreateSmsMessage',_0x209f4d['message'],_0x408bc7);_0x2033a4(_0x251f60[_0xa66f('0x14')](0x1f4,_0x209f4d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 806ea9b..fa0b6b4 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 _0xad63=['emit','removeListener','save'];(function(_0x1a5946,_0x426991){var _0x25e9d5=function(_0x44e1ce){while(--_0x44e1ce){_0x1a5946['push'](_0x1a5946['shift']());}};_0x25e9d5(++_0x426991);}(_0xad63,0x158));var _0x3ad6=function(_0x4e3f02,_0x598f48){_0x4e3f02=_0x4e3f02-0x0;var _0x500f69=_0xad63[_0x4e3f02];return _0x500f69;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x3ad6('0x0'),'remove','update'];function createListener(_0x3b52f3,_0x7f1d5b){return function(_0x217835){_0x7f1d5b[_0x3ad6('0x1')](_0x3b52f3,_0x217835);};}function removeListener(_0x3dd1a0,_0x16c31f){return function(){SmsMessageEvents[_0x3ad6('0x2')](_0x3dd1a0,_0x16c31f);};}exports['register']=function(_0x1f7979){for(var _0x272e90=0x0,_0x563cb9=events['length'];_0x272e90<_0x563cb9;_0x272e90++){var _0x5eea7a=events[_0x272e90];var _0x2da484=createListener('smsMessage:'+_0x5eea7a,_0x1f7979);SmsMessageEvents['on'](_0x5eea7a,_0x2da484);}}; \ No newline at end of file +var _0x2123=['./smsMessage.events','save','remove','update','emit','removeListener','length','smsMessage:'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x2123,0x188));var _0x3212=function(_0x47a37c,_0x5e3e52){_0x47a37c=_0x47a37c-0x0;var _0x22d62d=_0x2123[_0x47a37c];return _0x22d62d;};'use strict';var SmsMessageEvents=require(_0x3212('0x0'));var events=[_0x3212('0x1'),_0x3212('0x2'),_0x3212('0x3')];function createListener(_0x1cf79a,_0x1bd709){return function(_0x37fbb2){_0x1bd709[_0x3212('0x4')](_0x1cf79a,_0x37fbb2);};}function removeListener(_0x51eb06,_0x485c2e){return function(){SmsMessageEvents[_0x3212('0x5')](_0x51eb06,_0x485c2e);};}exports['register']=function(_0x2e4d72){for(var _0x438830=0x0,_0xc6f1b4=events[_0x3212('0x6')];_0x438830<_0xc6f1b4;_0x438830++){var _0x42d953=events[_0x438830];var _0x14e13a=createListener(_0x3212('0x7')+_0x42d953,_0x2e4d72);SmsMessageEvents['on'](_0x42d953,_0x14e13a);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8bb91a5..de5b983 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 _0x9fd4=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x53576e,_0x1e9802){var _0x4c14c7=function(_0x2bdce8){while(--_0x2bdce8){_0x53576e['push'](_0x53576e['shift']());}};_0x4c14c7(++_0x1e9802);}(_0x9fd4,0x16c));var _0x49fd=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x9fd4[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require(_0x49fd('0x3'));var express=require(_0x49fd('0x4'));var router=express[_0x49fd('0x5')]();var auth=require(_0x49fd('0x6'));var interaction=require(_0x49fd('0x7'));var config=require(_0x49fd('0x8'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x49fd('0x9')](),controller[_0x49fd('0xa')]);router[_0x49fd('0xb')](_0x49fd('0xc'),auth['isAuthenticated'](),controller[_0x49fd('0xd')]);router[_0x49fd('0xb')](_0x49fd('0xe'),auth[_0x49fd('0x9')](),controller[_0x49fd('0xf')]);router['get'](_0x49fd('0x10'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x11')]);router[_0x49fd('0xb')](_0x49fd('0x12'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x13')]);router['get'](_0x49fd('0x14'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x15')]);router[_0x49fd('0x16')]('/',auth[_0x49fd('0x9')](),controller[_0x49fd('0x17')]);router[_0x49fd('0x16')](_0x49fd('0x12'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x18')]);router[_0x49fd('0x16')](_0x49fd('0x14'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x19')]);router[_0x49fd('0x1a')](_0x49fd('0xe'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x1b')]);router[_0x49fd('0x1c')](_0x49fd('0xe'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x1d')]);router[_0x49fd('0x1c')](_0x49fd('0x12'),auth[_0x49fd('0x9')](),controller[_0x49fd('0x1e')]);router['delete'](_0x49fd('0x14'),auth[_0x49fd('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4148=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x1a0564,_0x50e720){var _0x5dbd66=function(_0x2093ea){while(--_0x2093ea){_0x1a0564['push'](_0x1a0564['shift']());}};_0x5dbd66(++_0x50e720);}(_0x4148,0xc6));var _0x8414=function(_0x5e6fe1,_0x8f80ad){_0x5e6fe1=_0x5e6fe1-0x0;var _0x5a6018=_0x4148[_0x5e6fe1];return _0x5a6018;};'use strict';var multer=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var path=require(_0x8414('0x2'));var timeout=require(_0x8414('0x3'));var express=require(_0x8414('0x4'));var router=express['Router']();var auth=require(_0x8414('0x5'));var interaction=require(_0x8414('0x6'));var config=require(_0x8414('0x7'));var controller=require(_0x8414('0x8'));router['get']('/',auth[_0x8414('0x9')](),controller['index']);router[_0x8414('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x8414('0xb')]);router[_0x8414('0xa')](_0x8414('0xc'),auth[_0x8414('0x9')](),controller[_0x8414('0xd')]);router[_0x8414('0xa')](_0x8414('0xe'),auth[_0x8414('0x9')](),controller[_0x8414('0xf')]);router[_0x8414('0xa')](_0x8414('0x10'),auth['isAuthenticated'](),controller[_0x8414('0x11')]);router['get'](_0x8414('0x12'),auth[_0x8414('0x9')](),controller[_0x8414('0x13')]);router[_0x8414('0x14')]('/',auth['isAuthenticated'](),controller[_0x8414('0x15')]);router['post'](_0x8414('0x10'),auth[_0x8414('0x9')](),controller[_0x8414('0x16')]);router['post'](_0x8414('0x12'),auth[_0x8414('0x9')](),controller[_0x8414('0x17')]);router['put']('/:id',auth[_0x8414('0x9')](),controller[_0x8414('0x18')]);router[_0x8414('0x19')](_0x8414('0xc'),auth['isAuthenticated'](),controller[_0x8414('0x1a')]);router[_0x8414('0x19')](_0x8414('0x10'),auth[_0x8414('0x9')](),controller['removeTeams']);router['delete'](_0x8414('0x12'),auth['isAuthenticated'](),controller[_0x8414('0x1b')]);module[_0x8414('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index c0a751b..40dab13 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 _0xb2fc=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x522e98,_0x44cc17){var _0x3243aa=function(_0x5cb86c){while(--_0x5cb86c){_0x522e98['push'](_0x522e98['shift']());}};_0x3243aa(++_0x44cc17);}(_0xb2fc,0x1e1));var _0xcb2f=function(_0x1a5c15,_0x10cbc6){_0x1a5c15=_0x1a5c15-0x0;var _0x446dae=_0xb2fc[_0x1a5c15];return _0x446dae;};'use strict';var Sequelize=require(_0xcb2f('0x0'));module['exports']={'name':{'type':Sequelize[_0xcb2f('0x1')],'unique':_0xcb2f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcb2f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcb2f('0x4'),_0xcb2f('0x5'),_0xcb2f('0x6'))}}; \ No newline at end of file +var _0x2bec=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x469ed3,_0x3c1e7b){var _0x11dff4=function(_0x113f1e){while(--_0x113f1e){_0x469ed3['push'](_0x469ed3['shift']());}};_0x11dff4(++_0x3c1e7b);}(_0x2bec,0xf8));var _0xc2be=function(_0x31fe77,_0x46bdd2){_0x31fe77=_0x31fe77-0x0;var _0x31cf72=_0x2bec[_0x31fe77];return _0x31cf72;};'use strict';var Sequelize=require(_0xc2be('0x0'));module[_0xc2be('0x1')]={'name':{'type':Sequelize[_0xc2be('0x2')],'unique':_0xc2be('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc2be('0x4')](_0xc2be('0x5'),'beepall',_0xc2be('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4de72e1..ff02932 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 _0x6d49=['find','userProfileId','autoAssociation','update','describe','getMembers','UserSmsQueue','pick','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','getTeams','findOne','Team','ids','Agents','online','interface','flatMap','sequelize','transaction','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','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','type','VIRTUAL','options','includeAll','findAll','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6d49,0x158));var _0x96d4=function(_0x497ef0,_0x599204){_0x497ef0=_0x497ef0-0x0;var _0x295b11=_0x6d49[_0x497ef0];return _0x295b11;};'use strict';var pdf=require(_0x96d4('0x0'));var emlformat=require(_0x96d4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x96d4('0x2'));var rp=require(_0x96d4('0x3'));var moment=require(_0x96d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96d4('0x5'));var util=require(_0x96d4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x96d4('0x7'));var ejs=require(_0x96d4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x96d4('0x9'));var crypto=require(_0x96d4('0xa'));var jsforce=require(_0x96d4('0xb'));var deskjs=require(_0x96d4('0xc'));var toCsv=require(_0x96d4('0x7'));var querystring=require(_0x96d4('0xd'));var Papa=require(_0x96d4('0xe'));var Redis=require(_0x96d4('0xf'));var authService=require(_0x96d4('0x10'));var qs=require(_0x96d4('0x11'));var as=require(_0x96d4('0x12'));var hardwareService=require(_0x96d4('0x13'));var logger=require(_0x96d4('0x14'))(_0x96d4('0x15'));var utils=require(_0x96d4('0x16'));var config=require(_0x96d4('0x17'));var db=require(_0x96d4('0x18'))['db'];config[_0x96d4('0x19')]=_[_0x96d4('0x1a')](config[_0x96d4('0x19')],{'host':_0x96d4('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96d4('0x19')]));require(_0x96d4('0x1c'))[_0x96d4('0x1d')](socket);function respondWithStatusCode(_0x4e17c4,_0x48469d){_0x48469d=_0x48469d||0xcc;return function(_0x42ca41){if(_0x42ca41){return _0x4e17c4[_0x96d4('0x1e')](_0x48469d);}return _0x4e17c4[_0x96d4('0x1f')](_0x48469d)[_0x96d4('0x20')]();};}function respondWithResult(_0x5e0637,_0x17f70d){_0x17f70d=_0x17f70d||0xc8;return function(_0x48e9b2){if(_0x48e9b2){return _0x5e0637[_0x96d4('0x1f')](_0x17f70d)[_0x96d4('0x21')](_0x48e9b2);}};}function respondWithFilteredResult(_0x122433,_0x59cdf3){return function(_0x306ac2){if(_0x306ac2){var _0x3c4ef0=_0x306ac2[_0x96d4('0x22')],_0x3089a7=_0x59cdf3[_0x96d4('0x23')],_0x19e813=_0x59cdf3[_0x96d4('0x23')]+_0x59cdf3[_0x96d4('0x24')],_0x35af19;if(_0x19e813>=_0x3c4ef0){_0x19e813=_0x3c4ef0;_0x35af19=0xc8;}else{_0x35af19=0xce;}_0x122433[_0x96d4('0x1f')](_0x35af19);return _0x122433[_0x96d4('0x25')](_0x96d4('0x26'),_0x3089a7+'-'+_0x19e813+'/'+_0x3c4ef0)[_0x96d4('0x21')](_0x306ac2);}return null;};}function patchUpdates(_0x42aa87){return function(_0x1f69e5){try{jsonpatch[_0x96d4('0x27')](_0x1f69e5,_0x42aa87,!![]);}catch(_0x8348c3){return BPromise[_0x96d4('0x28')](_0x8348c3);}return _0x1f69e5[_0x96d4('0x29')]();};}function saveUpdates(_0x34cd59,_0x194c63){return function(_0x28e5b6){if(_0x28e5b6){return _0x28e5b6['update'](_0x34cd59)[_0x96d4('0x2a')](function(_0x28f626){return _0x28f626;});}return null;};}function removeEntity(_0x16c010,_0x49cdc4){return function(_0x15ea65){if(_0x15ea65){return _0x15ea65['destroy']()[_0x96d4('0x2a')](function(){var _0x529bbf=_0x15ea65[_0x96d4('0x2b')]({'plain':!![]});var _0x1aaf4c=_0x96d4('0x2c');return db[_0x96d4('0x2d')][_0x96d4('0x2e')]({'where':{'type':_0x1aaf4c,'resourceId':_0x529bbf['id']}})[_0x96d4('0x2a')](function(){return _0x15ea65;});})[_0x96d4('0x2a')](function(){_0x16c010['status'](0xcc)[_0x96d4('0x20')]();});}};}function handleEntityNotFound(_0x2deb26,_0x178e02){return function(_0x2af63b){if(!_0x2af63b){_0x2deb26[_0x96d4('0x1e')](0x194);}return _0x2af63b;};}function handleError(_0x522421,_0x3d3f12){_0x3d3f12=_0x3d3f12||0x1f4;return function(_0x8dd025){logger[_0x96d4('0x2f')](_0x8dd025[_0x96d4('0x30')]);if(_0x8dd025['name']){delete _0x8dd025[_0x96d4('0x31')];}_0x522421[_0x96d4('0x1f')](_0x3d3f12)[_0x96d4('0x32')](_0x8dd025);};}exports[_0x96d4('0x33')]=function(_0x304baa,_0x24e118){var _0xad7143={},_0x4839c5={},_0x4de365={'count':0x0,'rows':[]};var _0x48cc2d=_['map'](db[_0x96d4('0x34')][_0x96d4('0x35')],function(_0x2d50ff){return{'name':_0x2d50ff[_0x96d4('0x36')],'type':_0x2d50ff['type'][_0x96d4('0x37')]};});_0x4839c5[_0x96d4('0x38')]=_['map'](_0x48cc2d,_0x96d4('0x31'));_0x4839c5[_0x96d4('0x39')]=_['keys'](_0x304baa[_0x96d4('0x39')]);_0x4839c5[_0x96d4('0x3a')]=_['intersection'](_0x4839c5[_0x96d4('0x38')],_0x4839c5['query']);_0xad7143[_0x96d4('0x3b')]=_[_0x96d4('0x3c')](_0x4839c5[_0x96d4('0x38')],qs[_0x96d4('0x3d')](_0x304baa[_0x96d4('0x39')][_0x96d4('0x3d')]));_0xad7143[_0x96d4('0x3b')]=_0xad7143['attributes'][_0x96d4('0x3e')]?_0xad7143[_0x96d4('0x3b')]:_0x4839c5[_0x96d4('0x38')];if(!_0x304baa[_0x96d4('0x39')][_0x96d4('0x3f')](_0x96d4('0x40'))){_0xad7143[_0x96d4('0x24')]=qs[_0x96d4('0x24')](_0x304baa['query']['limit']);_0xad7143['offset']=qs[_0x96d4('0x23')](_0x304baa[_0x96d4('0x39')][_0x96d4('0x23')]);}_0xad7143[_0x96d4('0x41')]=qs[_0x96d4('0x42')](_0x304baa['query']['sort']);_0xad7143['where']=qs[_0x96d4('0x3a')](_['pick'](_0x304baa['query'],_0x4839c5[_0x96d4('0x3a')]),_0x48cc2d);if(_0x304baa[_0x96d4('0x39')][_0x96d4('0x43')]){_0xad7143[_0x96d4('0x44')]=_[_0x96d4('0x45')](_0xad7143[_0x96d4('0x44')],{'$or':_[_0x96d4('0x46')](_0x48cc2d,function(_0xe4996){if(_0xe4996[_0x96d4('0x47')]!==_0x96d4('0x48')){var _0x1b89f6={};_0x1b89f6[_0xe4996[_0x96d4('0x31')]]={'$like':'%'+_0x304baa[_0x96d4('0x39')][_0x96d4('0x43')]+'%'};return _0x1b89f6;}})});}_0xad7143=_[_0x96d4('0x45')]({},_0xad7143,_0x304baa[_0x96d4('0x49')]);var _0x264e14={'where':_0xad7143[_0x96d4('0x44')]};return db['SmsQueue']['count'](_0x264e14)[_0x96d4('0x2a')](function(_0x1ff2f8){_0x4de365[_0x96d4('0x22')]=_0x1ff2f8;if(_0x304baa[_0x96d4('0x39')][_0x96d4('0x4a')]){_0xad7143['include']=[{'all':!![]}];}return db[_0x96d4('0x34')][_0x96d4('0x4b')](_0xad7143);})['then'](function(_0x130718){_0x4de365['rows']=_0x130718;return _0x4de365;})[_0x96d4('0x2a')](respondWithFilteredResult(_0x24e118,_0xad7143))[_0x96d4('0x4c')](handleError(_0x24e118,null));};exports['show']=function(_0x161344,_0x228d34){var _0xc3e54={'raw':!![],'where':{'id':_0x161344[_0x96d4('0x4d')]['id']}},_0x2030da={};_0x2030da[_0x96d4('0x38')]=_[_0x96d4('0x4e')](db[_0x96d4('0x34')][_0x96d4('0x35')]);_0x2030da[_0x96d4('0x39')]=_[_0x96d4('0x4e')](_0x161344[_0x96d4('0x39')]);_0x2030da[_0x96d4('0x3a')]=_[_0x96d4('0x3c')](_0x2030da[_0x96d4('0x38')],_0x2030da[_0x96d4('0x39')]);_0xc3e54[_0x96d4('0x3b')]=_[_0x96d4('0x3c')](_0x2030da[_0x96d4('0x38')],qs[_0x96d4('0x3d')](_0x161344[_0x96d4('0x39')][_0x96d4('0x3d')]));_0xc3e54[_0x96d4('0x3b')]=_0xc3e54[_0x96d4('0x3b')]['length']?_0xc3e54[_0x96d4('0x3b')]:_0x2030da[_0x96d4('0x38')];if(_0x161344[_0x96d4('0x39')][_0x96d4('0x4a')]){_0xc3e54['include']=[{'all':!![]}];}_0xc3e54=_['merge']({},_0xc3e54,_0x161344[_0x96d4('0x49')]);return db[_0x96d4('0x34')]['find'](_0xc3e54)[_0x96d4('0x2a')](handleEntityNotFound(_0x228d34,null))['then'](respondWithResult(_0x228d34,null))[_0x96d4('0x4c')](handleError(_0x228d34,null));};exports[_0x96d4('0x4f')]=function(_0x3ab6ee,_0x381048){return db['SmsQueue']['create'](_0x3ab6ee[_0x96d4('0x50')],{})[_0x96d4('0x2a')](function(_0x4d0099){var _0x2e755f=_0x3ab6ee[_0x96d4('0x51')][_0x96d4('0x2b')]({'plain':!![]});if(!_0x2e755f)throw new Error(_0x96d4('0x52'));if(_0x2e755f[_0x96d4('0x53')]==='user'){var _0x23a02b=_0x4d0099[_0x96d4('0x2b')]({'plain':!![]});var _0x5910bb=_0x96d4('0x2c');return db[_0x96d4('0x54')][_0x96d4('0x55')]({'where':{'name':_0x5910bb,'userProfileId':_0x2e755f[_0x96d4('0x56')]},'raw':!![]})[_0x96d4('0x2a')](function(_0x214368){if(_0x214368&&_0x214368[_0x96d4('0x57')]===0x0){return db[_0x96d4('0x2d')]['create']({'name':_0x23a02b[_0x96d4('0x31')],'resourceId':_0x23a02b['id'],'type':_0x214368[_0x96d4('0x31')],'sectionId':_0x214368['id']},{})['then'](function(){return _0x4d0099;});}else{return _0x4d0099;}})[_0x96d4('0x4c')](function(_0x2898c6){logger[_0x96d4('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2898c6);throw _0x2898c6;});}return _0x4d0099;})[_0x96d4('0x2a')](respondWithResult(_0x381048,0xc9))[_0x96d4('0x4c')](handleError(_0x381048,null));};exports[_0x96d4('0x58')]=function(_0x207775,_0x486f42){if(_0x207775[_0x96d4('0x50')]['id']){delete _0x207775['body']['id'];}return db[_0x96d4('0x34')]['find']({'where':{'id':_0x207775[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](handleEntityNotFound(_0x486f42,null))[_0x96d4('0x2a')](saveUpdates(_0x207775[_0x96d4('0x50')],null))['then'](respondWithResult(_0x486f42,null))[_0x96d4('0x4c')](handleError(_0x486f42,null));};exports[_0x96d4('0x2e')]=function(_0x3d2c86,_0x53f0e3){return db[_0x96d4('0x34')][_0x96d4('0x55')]({'where':{'id':_0x3d2c86[_0x96d4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x53f0e3,null))['then'](removeEntity(_0x53f0e3,null))[_0x96d4('0x4c')](handleError(_0x53f0e3,null));};exports[_0x96d4('0x59')]=function(_0x281e81,_0x2a6599){return db[_0x96d4('0x34')][_0x96d4('0x59')]()[_0x96d4('0x2a')](respondWithResult(_0x2a6599,null))[_0x96d4('0x4c')](handleError(_0x2a6599,null));};exports[_0x96d4('0x5a')]=function(_0xf2520c,_0x5612b3,_0x11e074){var _0xcfcfd1={'raw':!![],'where':{}},_0x4471de={},_0x260c45;return db['SmsQueue']['findOne']({'where':{'id':_0xf2520c[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](handleEntityNotFound(_0x5612b3,null))['then'](function(_0x2889c9){if(_0x2889c9){_0x260c45=_0x2889c9[_0x96d4('0x2b')]({'plain':!![]});_0x4471de[_0x96d4('0x38')]=_['keys'](db[_0x96d4('0x5b')][_0x96d4('0x35')]);_0x4471de['query']=_[_0x96d4('0x4e')](_0xf2520c[_0x96d4('0x39')]);_0x4471de[_0x96d4('0x3a')]=_[_0x96d4('0x3c')](_0x4471de[_0x96d4('0x38')],_0x4471de[_0x96d4('0x39')]);_0xcfcfd1[_0x96d4('0x3b')]=_[_0x96d4('0x3c')](_0x4471de['model'],qs['fields'](_0xf2520c[_0x96d4('0x39')][_0x96d4('0x3d')]));_0xcfcfd1[_0x96d4('0x3b')]=_0xcfcfd1['attributes'][_0x96d4('0x3e')]?_0xcfcfd1['attributes']:_0x4471de[_0x96d4('0x38')];if(!_0xf2520c[_0x96d4('0x39')][_0x96d4('0x3f')](_0x96d4('0x40'))){_0xcfcfd1['limit']=qs[_0x96d4('0x24')](_0xf2520c['query'][_0x96d4('0x24')]);_0xcfcfd1[_0x96d4('0x23')]=qs[_0x96d4('0x23')](_0xf2520c[_0x96d4('0x39')][_0x96d4('0x23')]);}_0xcfcfd1['order']=qs[_0x96d4('0x42')](_0xf2520c[_0x96d4('0x39')][_0x96d4('0x42')]);_0xcfcfd1['where']=qs[_0x96d4('0x3a')](_[_0x96d4('0x5c')](_0xf2520c[_0x96d4('0x39')],_0x4471de[_0x96d4('0x3a')]));_0xcfcfd1['where']['SmsQueueId']=_0x2889c9['id'];if(_0xf2520c[_0x96d4('0x39')]['filter']){_0xcfcfd1[_0x96d4('0x44')]=_[_0x96d4('0x45')](_0xcfcfd1['where'],{'$or':_[_0x96d4('0x46')](_0xcfcfd1[_0x96d4('0x3b')],function(_0x34b4dd){var _0x2becef={};_0x2becef[_0x34b4dd]={'$like':'%'+_0xf2520c['query'][_0x96d4('0x43')]+'%'};return _0x2becef;})});}_0xcfcfd1=_[_0x96d4('0x45')]({},_0xcfcfd1,_0xf2520c['options']);return db['UserSmsQueue'][_0x96d4('0x4b')](_0xcfcfd1);}})['then'](function(_0x1a2a1e){if(_0x1a2a1e){return db[_0x96d4('0x5d')][_0x96d4('0x5e')]({'where':{'id':_['map'](_0x1a2a1e,_0x96d4('0x5f')),'role':_0x96d4('0x60')},'attributes':['id',_0x96d4('0x31'),_0x96d4('0x61'),_0x96d4('0x62'),_0x96d4('0x63')]});}})[_0x96d4('0x2a')](function(_0x4cc549){if(_0x4cc549){return{'count':_0x4cc549[_0x96d4('0x22')],'rows':_['map'](_0x4cc549['rows'],function(_0x51788b){return{'membername':_0x51788b['name'],'UserId':_0x51788b['id'],'queue_name':_0x260c45[_0x96d4('0x31')],'SmsQueueId':_0x260c45['id'],'interface':util['format'](_0x96d4('0x64'),'SIP',_0x51788b[_0x96d4('0x31')]),'penalty':0x0,'paused':_0x51788b[_0x96d4('0x61')],'createdAt':_0x51788b[_0x96d4('0x63')],'updatedAt':_0x51788b[_0x96d4('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5612b3,_0xcfcfd1))['catch'](handleError(_0x5612b3,null));};exports[_0x96d4('0x65')]=function(_0x526f5e,_0x227f14,_0x8f9e88){var _0x4f5006={};var _0x54f446={};var _0x1905e3;var _0x2a9c10;return db[_0x96d4('0x34')][_0x96d4('0x66')]({'where':{'id':_0x526f5e[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](handleEntityNotFound(_0x227f14,null))[_0x96d4('0x2a')](function(_0x5830d8){if(_0x5830d8){_0x1905e3=_0x5830d8;_0x54f446[_0x96d4('0x38')]=_[_0x96d4('0x4e')](db[_0x96d4('0x67')]['rawAttributes']);_0x54f446[_0x96d4('0x39')]=_[_0x96d4('0x4e')](_0x526f5e['query']);_0x54f446['filters']=_['intersection'](_0x54f446[_0x96d4('0x38')],_0x54f446[_0x96d4('0x39')]);_0x4f5006[_0x96d4('0x3b')]=_[_0x96d4('0x3c')](_0x54f446[_0x96d4('0x38')],qs[_0x96d4('0x3d')](_0x526f5e[_0x96d4('0x39')][_0x96d4('0x3d')]));_0x4f5006[_0x96d4('0x3b')]=_0x4f5006[_0x96d4('0x3b')]['length']?_0x4f5006[_0x96d4('0x3b')]:_0x54f446['model'];_0x4f5006['order']=qs['sort'](_0x526f5e['query']['sort']);_0x4f5006['where']=qs['filters'](_['pick'](_0x526f5e[_0x96d4('0x39')],_0x54f446['filters']));if(_0x526f5e[_0x96d4('0x39')][_0x96d4('0x43')]){_0x4f5006['where']=_[_0x96d4('0x45')](_0x4f5006[_0x96d4('0x44')],{'$or':_[_0x96d4('0x46')](_0x4f5006[_0x96d4('0x3b')],function(_0x5e7d52){var _0x2880e5={};_0x2880e5[_0x5e7d52]={'$like':'%'+_0x526f5e['query']['filter']+'%'};return _0x2880e5;})});}_0x4f5006=_['merge']({},_0x4f5006,_0x526f5e[_0x96d4('0x49')]);return _0x1905e3[_0x96d4('0x65')](_0x4f5006);}})[_0x96d4('0x2a')](function(_0x6ca9c5){if(_0x6ca9c5){_0x2a9c10=_0x6ca9c5[_0x96d4('0x3e')];if(!_0x526f5e[_0x96d4('0x39')][_0x96d4('0x3f')](_0x96d4('0x40'))){_0x4f5006['limit']=qs[_0x96d4('0x24')](_0x526f5e[_0x96d4('0x39')][_0x96d4('0x24')]);_0x4f5006['offset']=qs[_0x96d4('0x23')](_0x526f5e['query']['offset']);}return _0x1905e3[_0x96d4('0x65')](_0x4f5006);}})['then'](function(_0x175816){if(_0x175816){return _0x175816?{'count':_0x2a9c10,'rows':_0x175816}:null;}})[_0x96d4('0x2a')](respondWithResult(_0x227f14,null))['catch'](handleError(_0x227f14,null));};exports['addTeams']=function(_0x162682,_0x50ce0c,_0x4f6d88){var _0x1a227b=_0x162682[_0x96d4('0x50')][_0x96d4('0x68')];return db['Team']['findAll']({'where':{'id':_0x1a227b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x96d4('0x69'),'attributes':['id',_0x96d4('0x31'),_0x96d4('0x6a'),'voicePause',_0x96d4('0x6b')],'raw':!![]}]})['then'](function(_0x4fc696){if(_0x4fc696){var _0x59015c=_[_0x96d4('0x6c')](_0x4fc696,function(_0x258158){var _0x848b2e=_0x258158[_0x96d4('0x2b')]({'plain':!![]});return _0x848b2e[_0x96d4('0x69')];});return db['SmsQueue'][_0x96d4('0x55')]({'where':{'id':_0x162682['params']['id']}})[_0x96d4('0x2a')](function(_0x30fcda){return db[_0x96d4('0x6d')][_0x96d4('0x6e')](function(_0x5070fa){return _0x30fcda['addTeams'](_0x1a227b,{'transaction':_0x5070fa})['then'](function(){return BPromise[_0x96d4('0x6f')](_0x59015c,function(_0x4dd2a7){return db[_0x96d4('0x5b')][_0x96d4('0x70')]({'where':{'UserId':_0x4dd2a7['id'],'SmsQueueId':_0x162682['params']['id']},'transaction':_0x5070fa});});})[_0x96d4('0x2a')](function(){_0x59015c['forEach'](function(_0x4625ba){socket[_0x96d4('0x71')](_0x96d4('0x72'),{'UserId':_0x4625ba['id'],'SmsQueueId':_0x30fcda['id']});});});});});}})[_0x96d4('0x2a')](respondWithStatusCode(_0x50ce0c,null))[_0x96d4('0x4c')](handleError(_0x50ce0c,null));};exports[_0x96d4('0x73')]=function(_0x4e581b,_0x12e517,_0x5e0c37){return db[_0x96d4('0x67')][_0x96d4('0x4b')]({'where':{'id':_0x4e581b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x96d4('0x5d')],'as':_0x96d4('0x69'),'attributes':['id'],'raw':!![]}]})[_0x96d4('0x2a')](handleEntityNotFound(_0x12e517,null))[_0x96d4('0x2a')](function(_0x274931){var _0x15e2de=_[_0x96d4('0x46')](_0x274931,'id');var _0x1f775b=[];var _0x9d1a95=[];var _0x3b6171=squel[_0x96d4('0x74')]();_0x3b6171[_0x96d4('0x75')](_0x96d4('0x76'))[_0x96d4('0x77')](_0x96d4('0x78'),'tq')[_0x96d4('0x79')](_0x96d4('0x7a'),'ut',_0x96d4('0x7b'))[_0x96d4('0x44')](_0x96d4('0x7c'),_0x4e581b[_0x96d4('0x4d')]['id']);for(var _0x81736c=0x0;_0x81736c<_0x274931[_0x96d4('0x3e')];_0x81736c+=0x1){let _0x2354b2=_0x274931[_0x81736c];for(var _0x401fca=0x0;_0x401fca<_0x2354b2[_0x96d4('0x69')]['length'];_0x401fca+=0x1){let _0x41a45d=_0x2354b2[_0x96d4('0x69')][_0x401fca];var _0x23ec84=_0x3b6171['clone']();_0x23ec84[_0x96d4('0x44')](_0x96d4('0x7d'),_0x41a45d['id']);_0x9d1a95[_0x96d4('0x7e')](db['sequelize'][_0x96d4('0x39')](_0x23ec84[_0x96d4('0x7f')](),{'type':db[_0x96d4('0x6d')]['QueryTypes'][_0x96d4('0x80')]})[_0x96d4('0x2a')](function(_0x460c02){if(_0x460c02[_0x96d4('0x3e')]===0x1){return _0x41a45d['id'];}else{var _0x5e5fd9=_['every'](_['map'](_0x460c02,_0x96d4('0x81')),function(_0x275009){return _[_0x96d4('0x82')](_0x15e2de,_0x275009);});if(_0x5e5fd9){return _0x41a45d['id'];}}}));}}return BPromise[_0x96d4('0x83')](_0x9d1a95)[_0x96d4('0x2a')](function(_0x34d6ea){_0x1f775b=_(_0x1f775b)[_0x96d4('0x84')](_0x34d6ea)[_0x96d4('0x85')]()[_0x96d4('0x86')]();return db[_0x96d4('0x34')][_0x96d4('0x55')]({'where':{'id':_0x4e581b[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](function(_0xbad903){return db[_0x96d4('0x6d')]['transaction'](function(_0x417612){return _0xbad903[_0x96d4('0x73')](_0x4e581b[_0x96d4('0x39')][_0x96d4('0x68')],{'transaction':_0x417612})[_0x96d4('0x2a')](function(){if(!_[_0x96d4('0x87')](_0x1f775b)){return _0xbad903[_0x96d4('0x88')](_0x1f775b,{'transaction':_0x417612});}})[_0x96d4('0x2a')](function(){_0x1f775b[_0x96d4('0x89')](function(_0x5a6f48){socket[_0x96d4('0x71')](_0x96d4('0x8a'),{'UserId':_0x5a6f48,'SmsQueueId':_0xbad903['id']});});});});});});})[_0x96d4('0x2a')](respondWithStatusCode(_0x12e517,null))[_0x96d4('0x4c')](handleError(_0x12e517,null));};exports[_0x96d4('0x8b')]=function(_0x557dd4,_0x2a9ae0,_0x11b983){return db[_0x96d4('0x34')][_0x96d4('0x55')]({'where':{'id':_0x557dd4['params']['id']}})['then'](handleEntityNotFound(_0x2a9ae0,null))[_0x96d4('0x2a')](function(_0x28b7eb){if(_0x28b7eb){return _0x28b7eb[_0x96d4('0x8b')](_0x557dd4['body'][_0x96d4('0x68')],_['omit'](_0x557dd4[_0x96d4('0x50')],[_0x96d4('0x68'),'id'])||{})[_0x96d4('0x8c')](function(_0x37972c){for(var _0x4daa23=0x0;_0x4daa23<_0x557dd4[_0x96d4('0x50')][_0x96d4('0x68')][_0x96d4('0x3e')];_0x4daa23+=0x1){socket['emit'](_0x96d4('0x72'),{'UserId':_0x557dd4[_0x96d4('0x50')][_0x96d4('0x68')][_0x4daa23],'SmsQueueId':_0x557dd4['params']['id']});}return _0x37972c;});}})[_0x96d4('0x2a')](respondWithResult(_0x2a9ae0,null))['catch'](handleError(_0x2a9ae0,null));};exports['removeAgents']=function(_0xae98f3,_0x2bddd6,_0x46190f){return db[_0x96d4('0x34')][_0x96d4('0x55')]({'where':{'id':_0xae98f3[_0x96d4('0x4d')]['id']}})[_0x96d4('0x2a')](handleEntityNotFound(_0x2bddd6,null))['then'](function(_0x4dacec){if(_0x4dacec){return _0x4dacec[_0x96d4('0x88')](_0xae98f3['query']['ids'])[_0x96d4('0x2a')](function(){if(_[_0x96d4('0x8d')](_0xae98f3[_0x96d4('0x39')]['ids'])){for(var _0x16620e=0x0;_0x16620e<_0xae98f3['query'][_0x96d4('0x68')][_0x96d4('0x3e')];_0x16620e+=0x1){socket[_0x96d4('0x71')](_0x96d4('0x8a'),{'UserId':Number(_0xae98f3[_0x96d4('0x39')][_0x96d4('0x68')][_0x16620e]),'SmsQueueId':Number(_0xae98f3[_0x96d4('0x4d')]['id'])});}}else{socket['emit'](_0x96d4('0x8a'),{'UserId':Number(_0xae98f3['query'][_0x96d4('0x68')]),'SmsQueueId':Number(_0xae98f3[_0x96d4('0x4d')]['id'])});}});}})[_0x96d4('0x2a')](respondWithStatusCode(_0x2bddd6,null))[_0x96d4('0x4c')](handleError(_0x2bddd6,null));};exports[_0x96d4('0x8e')]=function(_0x352005,_0xb45d87,_0x99aca3){var _0xd62ecf={};var _0x210adf={};var _0x9d9dd3;var _0x2829cc;return db[_0x96d4('0x34')][_0x96d4('0x66')]({'where':{'id':_0x352005['params']['id']}})['then'](handleEntityNotFound(_0xb45d87,null))[_0x96d4('0x2a')](function(_0x9783bb){if(_0x9783bb){_0x9d9dd3=_0x9783bb;_0x210adf['model']=_[_0x96d4('0x4e')](db[_0x96d4('0x5d')][_0x96d4('0x35')]);_0x210adf[_0x96d4('0x39')]=_[_0x96d4('0x4e')](_0x352005[_0x96d4('0x39')]);_0x210adf['filters']=_[_0x96d4('0x3c')](_0x210adf['model'],_0x210adf[_0x96d4('0x39')]);_0xd62ecf['attributes']=_[_0x96d4('0x3c')](_0x210adf['model'],qs['fields'](_0x352005[_0x96d4('0x39')][_0x96d4('0x3d')]));_0xd62ecf[_0x96d4('0x3b')]=_0xd62ecf[_0x96d4('0x3b')][_0x96d4('0x3e')]?_0xd62ecf['attributes']:_0x210adf[_0x96d4('0x38')];_0xd62ecf[_0x96d4('0x41')]=qs['sort'](_0x352005[_0x96d4('0x39')]['sort']);_0xd62ecf[_0x96d4('0x44')]=qs[_0x96d4('0x3a')](_['pick'](_0x352005['query'],_0x210adf[_0x96d4('0x3a')]));if(_0x352005[_0x96d4('0x39')][_0x96d4('0x43')]){_0xd62ecf[_0x96d4('0x44')]=_[_0x96d4('0x45')](_0xd62ecf[_0x96d4('0x44')],{'$or':_['map'](_0xd62ecf[_0x96d4('0x3b')],function(_0x52516d){var _0x6265af={};_0x6265af[_0x52516d]={'$like':'%'+_0x352005[_0x96d4('0x39')][_0x96d4('0x43')]+'%'};return _0x6265af;})});}_0xd62ecf=_[_0x96d4('0x45')]({},_0xd62ecf,_0x352005[_0x96d4('0x49')]);return _0x9d9dd3['getAgents'](_0xd62ecf);}})[_0x96d4('0x2a')](function(_0x1f5faa){if(_0x1f5faa){_0x2829cc=_0x1f5faa[_0x96d4('0x3e')];if(!_0x352005[_0x96d4('0x39')][_0x96d4('0x3f')]('nolimit')){_0xd62ecf[_0x96d4('0x24')]=qs[_0x96d4('0x24')](_0x352005[_0x96d4('0x39')][_0x96d4('0x24')]);_0xd62ecf[_0x96d4('0x23')]=qs['offset'](_0x352005['query'][_0x96d4('0x23')]);}return _0x9d9dd3[_0x96d4('0x8e')](_0xd62ecf);}})[_0x96d4('0x2a')](function(_0x10c79b){if(_0x10c79b){return _0x10c79b?{'count':_0x2829cc,'rows':_0x10c79b}:null;}})[_0x96d4('0x2a')](respondWithResult(_0xb45d87,null))['catch'](handleError(_0xb45d87,null));}; \ No newline at end of file +var _0x37e0=['findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','union','compact','value','removeTeams','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','count','set','apply','reject','save','then','destroy','get','SmsQueues','UserProfileResource','end','error','stack','name','send','rawAttributes','fieldName','type','query','filters','model','fields','attributes','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SmsQueue','includeAll','include','findAll','show','params','keys','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','rows','%s/%s','getTeams','findOne','nolimit','addTeams','ids','Agents','online','flatMap','sequelize','transaction','each'];(function(_0x1bc7ac,_0x1eed0e){var _0x5a35d7=function(_0x1496c6){while(--_0x1496c6){_0x1bc7ac['push'](_0x1bc7ac['shift']());}};_0x5a35d7(++_0x1eed0e);}(_0x37e0,0x135));var _0x037e=function(_0x39b6a4,_0x4c715a){_0x39b6a4=_0x39b6a4-0x0;var _0x12c896=_0x37e0[_0x39b6a4];return _0x12c896;};'use strict';var pdf=require(_0x037e('0x0'));var emlformat=require(_0x037e('0x1'));var rimraf=require(_0x037e('0x2'));var zipdir=require(_0x037e('0x3'));var jsonpatch=require(_0x037e('0x4'));var rp=require(_0x037e('0x5'));var moment=require(_0x037e('0x6'));var BPromise=require(_0x037e('0x7'));var Mustache=require(_0x037e('0x8'));var util=require(_0x037e('0x9'));var path=require(_0x037e('0xa'));var sox=require(_0x037e('0xb'));var csv=require(_0x037e('0xc'));var ejs=require(_0x037e('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x037e('0xe'));var crypto=require('crypto');var jsforce=require(_0x037e('0xf'));var deskjs=require(_0x037e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x037e('0x11'));var Papa=require(_0x037e('0x12'));var Redis=require(_0x037e('0x13'));var authService=require(_0x037e('0x14'));var qs=require(_0x037e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x037e('0x16'));var logger=require(_0x037e('0x17'))('api');var utils=require(_0x037e('0x18'));var config=require(_0x037e('0x19'));var db=require(_0x037e('0x1a'))['db'];config[_0x037e('0x1b')]=_[_0x037e('0x1c')](config['redis'],{'host':_0x037e('0x1d'),'port':0x18eb});var socket=require(_0x037e('0x1e'))(new Redis(config['redis']));require(_0x037e('0x1f'))[_0x037e('0x20')](socket);function respondWithStatusCode(_0xffefc6,_0x3b626f){_0x3b626f=_0x3b626f||0xcc;return function(_0x354604){if(_0x354604){return _0xffefc6[_0x037e('0x21')](_0x3b626f);}return _0xffefc6['status'](_0x3b626f)['end']();};}function respondWithResult(_0x248362,_0xbf13e6){_0xbf13e6=_0xbf13e6||0xc8;return function(_0x2bf68f){if(_0x2bf68f){return _0x248362[_0x037e('0x22')](_0xbf13e6)[_0x037e('0x23')](_0x2bf68f);}};}function respondWithFilteredResult(_0x809e02,_0x1caf34){return function(_0x210835){if(_0x210835){var _0x4d64b8=_0x210835[_0x037e('0x24')],_0x468c5c=_0x1caf34['offset'],_0x39938e=_0x1caf34['offset']+_0x1caf34['limit'],_0x3d5742;if(_0x39938e>=_0x4d64b8){_0x39938e=_0x4d64b8;_0x3d5742=0xc8;}else{_0x3d5742=0xce;}_0x809e02[_0x037e('0x22')](_0x3d5742);return _0x809e02[_0x037e('0x25')]('Content-Range',_0x468c5c+'-'+_0x39938e+'/'+_0x4d64b8)['json'](_0x210835);}return null;};}function patchUpdates(_0x3e7420){return function(_0x5e767d){try{jsonpatch[_0x037e('0x26')](_0x5e767d,_0x3e7420,!![]);}catch(_0x19f235){return BPromise[_0x037e('0x27')](_0x19f235);}return _0x5e767d[_0x037e('0x28')]();};}function saveUpdates(_0x2a82c4,_0x5239c6){return function(_0xb99258){if(_0xb99258){return _0xb99258['update'](_0x2a82c4)[_0x037e('0x29')](function(_0x1a31f3){return _0x1a31f3;});}return null;};}function removeEntity(_0x519cac,_0x32a8cc){return function(_0x2b84f3){if(_0x2b84f3){return _0x2b84f3[_0x037e('0x2a')]()[_0x037e('0x29')](function(){var _0x2aad18=_0x2b84f3[_0x037e('0x2b')]({'plain':!![]});var _0x28b27d=_0x037e('0x2c');return db[_0x037e('0x2d')]['destroy']({'where':{'type':_0x28b27d,'resourceId':_0x2aad18['id']}})[_0x037e('0x29')](function(){return _0x2b84f3;});})[_0x037e('0x29')](function(){_0x519cac['status'](0xcc)[_0x037e('0x2e')]();});}};}function handleEntityNotFound(_0x2f2883,_0x408c98){return function(_0x170747){if(!_0x170747){_0x2f2883[_0x037e('0x21')](0x194);}return _0x170747;};}function handleError(_0x41b2d3,_0x2af168){_0x2af168=_0x2af168||0x1f4;return function(_0x2e1d94){logger[_0x037e('0x2f')](_0x2e1d94[_0x037e('0x30')]);if(_0x2e1d94[_0x037e('0x31')]){delete _0x2e1d94[_0x037e('0x31')];}_0x41b2d3['status'](_0x2af168)[_0x037e('0x32')](_0x2e1d94);};}exports['index']=function(_0x59aa76,_0x127d80){var _0x561372={},_0x1ffaca={},_0x5a4295={'count':0x0,'rows':[]};var _0x1893d1=_['map'](db['SmsQueue'][_0x037e('0x33')],function(_0x22aa69){return{'name':_0x22aa69[_0x037e('0x34')],'type':_0x22aa69[_0x037e('0x35')]['key']};});_0x1ffaca['model']=_['map'](_0x1893d1,_0x037e('0x31'));_0x1ffaca[_0x037e('0x36')]=_['keys'](_0x59aa76[_0x037e('0x36')]);_0x1ffaca[_0x037e('0x37')]=_['intersection'](_0x1ffaca[_0x037e('0x38')],_0x1ffaca['query']);_0x561372['attributes']=_['intersection'](_0x1ffaca[_0x037e('0x38')],qs[_0x037e('0x39')](_0x59aa76[_0x037e('0x36')][_0x037e('0x39')]));_0x561372[_0x037e('0x3a')]=_0x561372[_0x037e('0x3a')][_0x037e('0x3b')]?_0x561372[_0x037e('0x3a')]:_0x1ffaca[_0x037e('0x38')];if(!_0x59aa76[_0x037e('0x36')][_0x037e('0x3c')]('nolimit')){_0x561372[_0x037e('0x3d')]=qs['limit'](_0x59aa76['query']['limit']);_0x561372[_0x037e('0x3e')]=qs[_0x037e('0x3e')](_0x59aa76[_0x037e('0x36')][_0x037e('0x3e')]);}_0x561372[_0x037e('0x3f')]=qs[_0x037e('0x40')](_0x59aa76[_0x037e('0x36')][_0x037e('0x40')]);_0x561372[_0x037e('0x41')]=qs[_0x037e('0x37')](_[_0x037e('0x42')](_0x59aa76['query'],_0x1ffaca[_0x037e('0x37')]),_0x1893d1);if(_0x59aa76[_0x037e('0x36')][_0x037e('0x43')]){_0x561372[_0x037e('0x41')]=_[_0x037e('0x44')](_0x561372[_0x037e('0x41')],{'$or':_[_0x037e('0x45')](_0x1893d1,function(_0x523097){if(_0x523097[_0x037e('0x35')]!==_0x037e('0x46')){var _0x20e988={};_0x20e988[_0x523097[_0x037e('0x31')]]={'$like':'%'+_0x59aa76[_0x037e('0x36')]['filter']+'%'};return _0x20e988;}})});}_0x561372=_['merge']({},_0x561372,_0x59aa76[_0x037e('0x47')]);var _0x2b34ae={'where':_0x561372['where']};return db[_0x037e('0x48')][_0x037e('0x24')](_0x2b34ae)['then'](function(_0x254a42){_0x5a4295[_0x037e('0x24')]=_0x254a42;if(_0x59aa76[_0x037e('0x36')][_0x037e('0x49')]){_0x561372[_0x037e('0x4a')]=[{'all':!![]}];}return db['SmsQueue'][_0x037e('0x4b')](_0x561372);})[_0x037e('0x29')](function(_0x169e52){_0x5a4295['rows']=_0x169e52;return _0x5a4295;})[_0x037e('0x29')](respondWithFilteredResult(_0x127d80,_0x561372))['catch'](handleError(_0x127d80,null));};exports[_0x037e('0x4c')]=function(_0x404e4a,_0x1bc0b9){var _0x8ec183={'raw':!![],'where':{'id':_0x404e4a[_0x037e('0x4d')]['id']}},_0x5b8053={};_0x5b8053['model']=_[_0x037e('0x4e')](db['SmsQueue'][_0x037e('0x33')]);_0x5b8053['query']=_['keys'](_0x404e4a[_0x037e('0x36')]);_0x5b8053['filters']=_['intersection'](_0x5b8053[_0x037e('0x38')],_0x5b8053[_0x037e('0x36')]);_0x8ec183[_0x037e('0x3a')]=_[_0x037e('0x4f')](_0x5b8053[_0x037e('0x38')],qs[_0x037e('0x39')](_0x404e4a[_0x037e('0x36')]['fields']));_0x8ec183['attributes']=_0x8ec183['attributes']['length']?_0x8ec183[_0x037e('0x3a')]:_0x5b8053['model'];if(_0x404e4a[_0x037e('0x36')][_0x037e('0x49')]){_0x8ec183[_0x037e('0x4a')]=[{'all':!![]}];}_0x8ec183=_[_0x037e('0x44')]({},_0x8ec183,_0x404e4a[_0x037e('0x47')]);return db[_0x037e('0x48')][_0x037e('0x50')](_0x8ec183)['then'](handleEntityNotFound(_0x1bc0b9,null))[_0x037e('0x29')](respondWithResult(_0x1bc0b9,null))[_0x037e('0x51')](handleError(_0x1bc0b9,null));};exports[_0x037e('0x52')]=function(_0x6e7526,_0x564114){return db[_0x037e('0x48')][_0x037e('0x52')](_0x6e7526[_0x037e('0x53')],{})['then'](function(_0x3f7ffd){var _0x2a0fcf=_0x6e7526[_0x037e('0x54')][_0x037e('0x2b')]({'plain':!![]});if(!_0x2a0fcf)throw new Error(_0x037e('0x55'));if(_0x2a0fcf['role']===_0x037e('0x54')){var _0x1157e8=_0x3f7ffd[_0x037e('0x2b')]({'plain':!![]});var _0x18f5b4=_0x037e('0x2c');return db[_0x037e('0x56')][_0x037e('0x50')]({'where':{'name':_0x18f5b4,'userProfileId':_0x2a0fcf['userProfileId']},'raw':!![]})['then'](function(_0x3def3e){if(_0x3def3e&&_0x3def3e[_0x037e('0x57')]===0x0){return db[_0x037e('0x2d')][_0x037e('0x52')]({'name':_0x1157e8[_0x037e('0x31')],'resourceId':_0x1157e8['id'],'type':_0x3def3e[_0x037e('0x31')],'sectionId':_0x3def3e['id']},{})[_0x037e('0x29')](function(){return _0x3f7ffd;});}else{return _0x3f7ffd;}})[_0x037e('0x51')](function(_0x48f339){logger['error'](_0x037e('0x58'),_0x48f339);throw _0x48f339;});}return _0x3f7ffd;})['then'](respondWithResult(_0x564114,0xc9))[_0x037e('0x51')](handleError(_0x564114,null));};exports['update']=function(_0x2476de,_0xd6145d){if(_0x2476de[_0x037e('0x53')]['id']){delete _0x2476de[_0x037e('0x53')]['id'];}return db[_0x037e('0x48')]['find']({'where':{'id':_0x2476de['params']['id']}})['then'](handleEntityNotFound(_0xd6145d,null))[_0x037e('0x29')](saveUpdates(_0x2476de['body'],null))[_0x037e('0x29')](respondWithResult(_0xd6145d,null))[_0x037e('0x51')](handleError(_0xd6145d,null));};exports[_0x037e('0x2a')]=function(_0x3176ec,_0x4f5f6b){return db['SmsQueue'][_0x037e('0x50')]({'where':{'id':_0x3176ec[_0x037e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4f5f6b,null))[_0x037e('0x29')](removeEntity(_0x4f5f6b,null))[_0x037e('0x51')](handleError(_0x4f5f6b,null));};exports['describe']=function(_0x89c51,_0x3da998){return db['SmsQueue'][_0x037e('0x59')]()[_0x037e('0x29')](respondWithResult(_0x3da998,null))[_0x037e('0x51')](handleError(_0x3da998,null));};exports[_0x037e('0x5a')]=function(_0x3a7975,_0x2960d7,_0x35c41c){var _0x31692a={'raw':!![],'where':{}},_0xad0dd6={},_0x6c111;return db[_0x037e('0x48')]['findOne']({'where':{'id':_0x3a7975['params']['id']}})[_0x037e('0x29')](handleEntityNotFound(_0x2960d7,null))[_0x037e('0x29')](function(_0x16f346){if(_0x16f346){_0x6c111=_0x16f346['get']({'plain':!![]});_0xad0dd6[_0x037e('0x38')]=_[_0x037e('0x4e')](db['UserSmsQueue'][_0x037e('0x33')]);_0xad0dd6['query']=_[_0x037e('0x4e')](_0x3a7975[_0x037e('0x36')]);_0xad0dd6[_0x037e('0x37')]=_[_0x037e('0x4f')](_0xad0dd6[_0x037e('0x38')],_0xad0dd6['query']);_0x31692a['attributes']=_[_0x037e('0x4f')](_0xad0dd6[_0x037e('0x38')],qs[_0x037e('0x39')](_0x3a7975[_0x037e('0x36')][_0x037e('0x39')]));_0x31692a[_0x037e('0x3a')]=_0x31692a[_0x037e('0x3a')][_0x037e('0x3b')]?_0x31692a[_0x037e('0x3a')]:_0xad0dd6[_0x037e('0x38')];if(!_0x3a7975['query'][_0x037e('0x3c')]('nolimit')){_0x31692a[_0x037e('0x3d')]=qs[_0x037e('0x3d')](_0x3a7975['query'][_0x037e('0x3d')]);_0x31692a[_0x037e('0x3e')]=qs[_0x037e('0x3e')](_0x3a7975[_0x037e('0x36')]['offset']);}_0x31692a[_0x037e('0x3f')]=qs['sort'](_0x3a7975[_0x037e('0x36')][_0x037e('0x40')]);_0x31692a[_0x037e('0x41')]=qs['filters'](_[_0x037e('0x42')](_0x3a7975[_0x037e('0x36')],_0xad0dd6['filters']));_0x31692a['where']['SmsQueueId']=_0x16f346['id'];if(_0x3a7975[_0x037e('0x36')][_0x037e('0x43')]){_0x31692a['where']=_[_0x037e('0x44')](_0x31692a[_0x037e('0x41')],{'$or':_[_0x037e('0x45')](_0x31692a['attributes'],function(_0x43ade2){var _0x423948={};_0x423948[_0x43ade2]={'$like':'%'+_0x3a7975[_0x037e('0x36')][_0x037e('0x43')]+'%'};return _0x423948;})});}_0x31692a=_['merge']({},_0x31692a,_0x3a7975[_0x037e('0x47')]);return db[_0x037e('0x5b')][_0x037e('0x4b')](_0x31692a);}})['then'](function(_0x1f3867){if(_0x1f3867){return db[_0x037e('0x5c')][_0x037e('0x5d')]({'where':{'id':_[_0x037e('0x45')](_0x1f3867,'UserId'),'role':_0x037e('0x5e')},'attributes':['id',_0x037e('0x31'),_0x037e('0x5f'),_0x037e('0x60'),_0x037e('0x61')]});}})[_0x037e('0x29')](function(_0x3f86f2){if(_0x3f86f2){return{'count':_0x3f86f2[_0x037e('0x24')],'rows':_[_0x037e('0x45')](_0x3f86f2[_0x037e('0x62')],function(_0xbc0403){return{'membername':_0xbc0403[_0x037e('0x31')],'UserId':_0xbc0403['id'],'queue_name':_0x6c111[_0x037e('0x31')],'SmsQueueId':_0x6c111['id'],'interface':util['format'](_0x037e('0x63'),'SIP',_0xbc0403[_0x037e('0x31')]),'penalty':0x0,'paused':_0xbc0403[_0x037e('0x5f')],'createdAt':_0xbc0403['createdAt'],'updatedAt':_0xbc0403[_0x037e('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2960d7,_0x31692a))[_0x037e('0x51')](handleError(_0x2960d7,null));};exports[_0x037e('0x64')]=function(_0x54d5b0,_0x1fdaf3,_0x1f4bd9){var _0x5cc38a={};var _0x28a078={};var _0x412b3b;var _0x36a598;return db[_0x037e('0x48')][_0x037e('0x65')]({'where':{'id':_0x54d5b0[_0x037e('0x4d')]['id']}})[_0x037e('0x29')](handleEntityNotFound(_0x1fdaf3,null))[_0x037e('0x29')](function(_0x13a54d){if(_0x13a54d){_0x412b3b=_0x13a54d;_0x28a078['model']=_[_0x037e('0x4e')](db['Team'][_0x037e('0x33')]);_0x28a078[_0x037e('0x36')]=_[_0x037e('0x4e')](_0x54d5b0[_0x037e('0x36')]);_0x28a078[_0x037e('0x37')]=_[_0x037e('0x4f')](_0x28a078[_0x037e('0x38')],_0x28a078[_0x037e('0x36')]);_0x5cc38a[_0x037e('0x3a')]=_[_0x037e('0x4f')](_0x28a078[_0x037e('0x38')],qs[_0x037e('0x39')](_0x54d5b0['query']['fields']));_0x5cc38a[_0x037e('0x3a')]=_0x5cc38a[_0x037e('0x3a')][_0x037e('0x3b')]?_0x5cc38a[_0x037e('0x3a')]:_0x28a078[_0x037e('0x38')];_0x5cc38a['order']=qs[_0x037e('0x40')](_0x54d5b0[_0x037e('0x36')][_0x037e('0x40')]);_0x5cc38a[_0x037e('0x41')]=qs[_0x037e('0x37')](_[_0x037e('0x42')](_0x54d5b0[_0x037e('0x36')],_0x28a078[_0x037e('0x37')]));if(_0x54d5b0['query'][_0x037e('0x43')]){_0x5cc38a[_0x037e('0x41')]=_[_0x037e('0x44')](_0x5cc38a[_0x037e('0x41')],{'$or':_[_0x037e('0x45')](_0x5cc38a[_0x037e('0x3a')],function(_0xfca900){var _0x9275c5={};_0x9275c5[_0xfca900]={'$like':'%'+_0x54d5b0[_0x037e('0x36')][_0x037e('0x43')]+'%'};return _0x9275c5;})});}_0x5cc38a=_[_0x037e('0x44')]({},_0x5cc38a,_0x54d5b0[_0x037e('0x47')]);return _0x412b3b[_0x037e('0x64')](_0x5cc38a);}})[_0x037e('0x29')](function(_0x21fb9e){if(_0x21fb9e){_0x36a598=_0x21fb9e['length'];if(!_0x54d5b0[_0x037e('0x36')][_0x037e('0x3c')](_0x037e('0x66'))){_0x5cc38a[_0x037e('0x3d')]=qs['limit'](_0x54d5b0['query']['limit']);_0x5cc38a[_0x037e('0x3e')]=qs['offset'](_0x54d5b0['query'][_0x037e('0x3e')]);}return _0x412b3b[_0x037e('0x64')](_0x5cc38a);}})[_0x037e('0x29')](function(_0x227b01){if(_0x227b01){return _0x227b01?{'count':_0x36a598,'rows':_0x227b01}:null;}})['then'](respondWithResult(_0x1fdaf3,null))[_0x037e('0x51')](handleError(_0x1fdaf3,null));};exports[_0x037e('0x67')]=function(_0x1d15f3,_0x308018,_0x20ff9f){var _0x2beaa4=_0x1d15f3['body'][_0x037e('0x68')];return db['Team'][_0x037e('0x4b')]({'where':{'id':_0x2beaa4},'attributes':['id'],'include':[{'model':db[_0x037e('0x5c')],'as':_0x037e('0x69'),'attributes':['id',_0x037e('0x31'),_0x037e('0x6a'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x5cae88){if(_0x5cae88){var _0x31a0f6=_[_0x037e('0x6b')](_0x5cae88,function(_0x265629){var _0x4e6e26=_0x265629[_0x037e('0x2b')]({'plain':!![]});return _0x4e6e26['Agents'];});return db[_0x037e('0x48')][_0x037e('0x50')]({'where':{'id':_0x1d15f3[_0x037e('0x4d')]['id']}})['then'](function(_0x16b193){return db[_0x037e('0x6c')][_0x037e('0x6d')](function(_0x41d06b){return _0x16b193[_0x037e('0x67')](_0x2beaa4,{'transaction':_0x41d06b})[_0x037e('0x29')](function(){return BPromise[_0x037e('0x6e')](_0x31a0f6,function(_0x496d29){return db[_0x037e('0x5b')][_0x037e('0x6f')]({'where':{'UserId':_0x496d29['id'],'SmsQueueId':_0x1d15f3['params']['id']},'transaction':_0x41d06b});});})['then'](function(){_0x31a0f6[_0x037e('0x70')](function(_0x4bc637){socket[_0x037e('0x71')](_0x037e('0x72'),{'UserId':_0x4bc637['id'],'SmsQueueId':_0x16b193['id']});});});});});}})[_0x037e('0x29')](respondWithStatusCode(_0x308018,null))[_0x037e('0x51')](handleError(_0x308018,null));};exports['removeTeams']=function(_0x277eb6,_0x22043b,_0x864ad6){return db['Team'][_0x037e('0x4b')]({'where':{'id':_0x277eb6[_0x037e('0x36')][_0x037e('0x68')]},'attributes':['id'],'include':[{'model':db[_0x037e('0x5c')],'as':_0x037e('0x69'),'attributes':['id'],'raw':!![]}]})[_0x037e('0x29')](handleEntityNotFound(_0x22043b,null))[_0x037e('0x29')](function(_0x4c317c){var _0x550375=_[_0x037e('0x45')](_0x4c317c,'id');var _0x275dec=[];var _0x2f1ebd=[];var _0xed9945=squel[_0x037e('0x73')]();_0xed9945[_0x037e('0x74')](_0x037e('0x75'))[_0x037e('0x76')](_0x037e('0x77'),'tq')[_0x037e('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x037e('0x41')](_0x037e('0x79'),_0x277eb6[_0x037e('0x4d')]['id']);for(var _0x25e3e5=0x0;_0x25e3e5<_0x4c317c[_0x037e('0x3b')];_0x25e3e5+=0x1){let _0x1a9c50=_0x4c317c[_0x25e3e5];for(var _0x3f3644=0x0;_0x3f3644<_0x1a9c50[_0x037e('0x69')][_0x037e('0x3b')];_0x3f3644+=0x1){let _0xbceee7=_0x1a9c50[_0x037e('0x69')][_0x3f3644];var _0x3ac4a0=_0xed9945[_0x037e('0x7a')]();_0x3ac4a0[_0x037e('0x41')](_0x037e('0x7b'),_0xbceee7['id']);_0x2f1ebd[_0x037e('0x7c')](db[_0x037e('0x6c')]['query'](_0x3ac4a0['toString'](),{'type':db[_0x037e('0x6c')][_0x037e('0x7d')][_0x037e('0x7e')]})[_0x037e('0x29')](function(_0x58ee7c){if(_0x58ee7c[_0x037e('0x3b')]===0x1){return _0xbceee7['id'];}else{var _0x211d93=_['every'](_[_0x037e('0x45')](_0x58ee7c,'TeamId'),function(_0x3d7143){return _[_0x037e('0x7f')](_0x550375,_0x3d7143);});if(_0x211d93){return _0xbceee7['id'];}}}));}}return BPromise[_0x037e('0x80')](_0x2f1ebd)['then'](function(_0x2d65c5){_0x275dec=_(_0x275dec)[_0x037e('0x81')](_0x2d65c5)[_0x037e('0x82')]()[_0x037e('0x83')]();return db['SmsQueue']['find']({'where':{'id':_0x277eb6['params']['id']}})['then'](function(_0x959aec){return db[_0x037e('0x6c')][_0x037e('0x6d')](function(_0x3231f8){return _0x959aec[_0x037e('0x84')](_0x277eb6[_0x037e('0x36')][_0x037e('0x68')],{'transaction':_0x3231f8})['then'](function(){if(!_[_0x037e('0x85')](_0x275dec)){return _0x959aec['removeAgents'](_0x275dec,{'transaction':_0x3231f8});}})['then'](function(){_0x275dec[_0x037e('0x70')](function(_0x1723af){socket[_0x037e('0x71')](_0x037e('0x86'),{'UserId':_0x1723af,'SmsQueueId':_0x959aec['id']});});});});});});})[_0x037e('0x29')](respondWithStatusCode(_0x22043b,null))['catch'](handleError(_0x22043b,null));};exports['addAgents']=function(_0x1bfdc1,_0x25716c,_0x2ef5d1){return db[_0x037e('0x48')][_0x037e('0x50')]({'where':{'id':_0x1bfdc1[_0x037e('0x4d')]['id']}})[_0x037e('0x29')](handleEntityNotFound(_0x25716c,null))[_0x037e('0x29')](function(_0x2460ad){if(_0x2460ad){return _0x2460ad[_0x037e('0x87')](_0x1bfdc1[_0x037e('0x53')][_0x037e('0x68')],_[_0x037e('0x88')](_0x1bfdc1[_0x037e('0x53')],[_0x037e('0x68'),'id'])||{})[_0x037e('0x89')](function(_0x57ee84){for(var _0x246219=0x0;_0x246219<_0x1bfdc1[_0x037e('0x53')][_0x037e('0x68')][_0x037e('0x3b')];_0x246219+=0x1){socket['emit'](_0x037e('0x72'),{'UserId':_0x1bfdc1[_0x037e('0x53')][_0x037e('0x68')][_0x246219],'SmsQueueId':_0x1bfdc1['params']['id']});}return _0x57ee84;});}})['then'](respondWithResult(_0x25716c,null))[_0x037e('0x51')](handleError(_0x25716c,null));};exports[_0x037e('0x8a')]=function(_0x1bb1d1,_0x58e8a8,_0x2e1286){return db[_0x037e('0x48')][_0x037e('0x50')]({'where':{'id':_0x1bb1d1[_0x037e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x58e8a8,null))[_0x037e('0x29')](function(_0x527a55){if(_0x527a55){return _0x527a55[_0x037e('0x8a')](_0x1bb1d1[_0x037e('0x36')][_0x037e('0x68')])[_0x037e('0x29')](function(){if(_['isArray'](_0x1bb1d1[_0x037e('0x36')]['ids'])){for(var _0x46057d=0x0;_0x46057d<_0x1bb1d1[_0x037e('0x36')]['ids'][_0x037e('0x3b')];_0x46057d+=0x1){socket['emit'](_0x037e('0x86'),{'UserId':Number(_0x1bb1d1['query']['ids'][_0x46057d]),'SmsQueueId':Number(_0x1bb1d1[_0x037e('0x4d')]['id'])});}}else{socket[_0x037e('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x1bb1d1[_0x037e('0x36')][_0x037e('0x68')]),'SmsQueueId':Number(_0x1bb1d1['params']['id'])});}});}})[_0x037e('0x29')](respondWithStatusCode(_0x58e8a8,null))['catch'](handleError(_0x58e8a8,null));};exports[_0x037e('0x8b')]=function(_0x225750,_0x2f2a36,_0x300db2){var _0x40256e={};var _0x5b762c={};var _0x56d7f3;var _0x391379;return db[_0x037e('0x48')]['findOne']({'where':{'id':_0x225750[_0x037e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f2a36,null))[_0x037e('0x29')](function(_0x5d3298){if(_0x5d3298){_0x56d7f3=_0x5d3298;_0x5b762c[_0x037e('0x38')]=_[_0x037e('0x4e')](db[_0x037e('0x5c')][_0x037e('0x33')]);_0x5b762c[_0x037e('0x36')]=_[_0x037e('0x4e')](_0x225750[_0x037e('0x36')]);_0x5b762c[_0x037e('0x37')]=_['intersection'](_0x5b762c[_0x037e('0x38')],_0x5b762c['query']);_0x40256e[_0x037e('0x3a')]=_[_0x037e('0x4f')](_0x5b762c[_0x037e('0x38')],qs[_0x037e('0x39')](_0x225750[_0x037e('0x36')][_0x037e('0x39')]));_0x40256e['attributes']=_0x40256e[_0x037e('0x3a')][_0x037e('0x3b')]?_0x40256e[_0x037e('0x3a')]:_0x5b762c[_0x037e('0x38')];_0x40256e[_0x037e('0x3f')]=qs[_0x037e('0x40')](_0x225750['query']['sort']);_0x40256e[_0x037e('0x41')]=qs[_0x037e('0x37')](_[_0x037e('0x42')](_0x225750[_0x037e('0x36')],_0x5b762c[_0x037e('0x37')]));if(_0x225750['query'][_0x037e('0x43')]){_0x40256e[_0x037e('0x41')]=_[_0x037e('0x44')](_0x40256e['where'],{'$or':_[_0x037e('0x45')](_0x40256e[_0x037e('0x3a')],function(_0x5cfd60){var _0x28a8ef={};_0x28a8ef[_0x5cfd60]={'$like':'%'+_0x225750[_0x037e('0x36')][_0x037e('0x43')]+'%'};return _0x28a8ef;})});}_0x40256e=_[_0x037e('0x44')]({},_0x40256e,_0x225750[_0x037e('0x47')]);return _0x56d7f3['getAgents'](_0x40256e);}})[_0x037e('0x29')](function(_0x57a0ec){if(_0x57a0ec){_0x391379=_0x57a0ec['length'];if(!_0x225750[_0x037e('0x36')][_0x037e('0x3c')](_0x037e('0x66'))){_0x40256e[_0x037e('0x3d')]=qs['limit'](_0x225750[_0x037e('0x36')][_0x037e('0x3d')]);_0x40256e[_0x037e('0x3e')]=qs[_0x037e('0x3e')](_0x225750[_0x037e('0x36')][_0x037e('0x3e')]);}return _0x56d7f3['getAgents'](_0x40256e);}})[_0x037e('0x29')](function(_0x4f9ed2){if(_0x4f9ed2){return _0x4f9ed2?{'count':_0x391379,'rows':_0x4f9ed2}:null;}})[_0x037e('0x29')](respondWithResult(_0x2f2a36,null))[_0x037e('0x51')](handleError(_0x2f2a36,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index bcacef0..bfc2327 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 _0xc8cc=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x483567,_0xe3b4ca){var _0x34cbd6=function(_0x509004){while(--_0x509004){_0x483567['push'](_0x483567['shift']());}};_0x34cbd6(++_0xe3b4ca);}(_0xc8cc,0x8f));var _0xcc8c=function(_0x388bfa,_0x1f518c){_0x388bfa=_0x388bfa-0x0;var _0x11d6a6=_0xc8cc[_0x388bfa];return _0x11d6a6;};'use strict';var EventEmitter=require(_0xcc8c('0x0'));var SmsQueue=require(_0xcc8c('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xcc8c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc8c('0x3'),'afterDestroy':_0xcc8c('0x4')};function emitEvent(_0x291e72){return function(_0x4b79ce,_0x321ee9,_0x4c96d8){SmsQueueEvents[_0xcc8c('0x5')](_0x291e72+':'+_0x4b79ce['id'],_0x4b79ce);SmsQueueEvents[_0xcc8c('0x5')](_0x291e72,_0x4b79ce);_0x4c96d8(null);};}for(var e in events){if(events[_0xcc8c('0x6')](e)){var event=events[e];SmsQueue[_0xcc8c('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x76e1=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x530103,_0x255d2e){var _0x104d42=function(_0x100de7){while(--_0x100de7){_0x530103['push'](_0x530103['shift']());}};_0x104d42(++_0x255d2e);}(_0x76e1,0xb1));var _0x176e=function(_0x4cb2,_0x48eef2){_0x4cb2=_0x4cb2-0x0;var _0x59c9f0=_0x76e1[_0x4cb2];return _0x59c9f0;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x176e('0x0'))['db'][_0x176e('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x176e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x176e('0x3'),'afterDestroy':_0x176e('0x4')};function emitEvent(_0x150f98){return function(_0x2fc79d,_0x253f19,_0x5e1642){SmsQueueEvents['emit'](_0x150f98+':'+_0x2fc79d['id'],_0x2fc79d);SmsQueueEvents[_0x176e('0x5')](_0x150f98,_0x2fc79d);_0x5e1642(null);};}for(var e in events){if(events[_0x176e('0x6')](e)){var event=events[e];SmsQueue[_0x176e('0x7')](e,emitEvent(event));}}module[_0x176e('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 7b2a10b..ec8d97a 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 _0xa98d=['moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsQueue','sms_queues','lodash','../../config/logger'];(function(_0x58dc87,_0x3f22d1){var _0xb8ec8=function(_0x2a9429){while(--_0x2a9429){_0x58dc87['push'](_0x58dc87['shift']());}};_0xb8ec8(++_0x3f22d1);}(_0xa98d,0xa3));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xda98('0x0'));var util=require('util');var logger=require(_0xda98('0x1'))('api');var moment=require(_0xda98('0x2'));var BPromise=require(_0xda98('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda98('0x4'));var rimraf=require(_0xda98('0x5'));var config=require(_0xda98('0x6'));var attributes=require('./smsQueue.attributes');module[_0xda98('0x7')]=function(_0x39acbf,_0x218e43){return _0x39acbf[_0xda98('0x8')](_0xda98('0x9'),attributes,{'tableName':_0xda98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e9f=['moment','path','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e9f,0x116));var _0xf0e9=function(_0x43fdfd,_0x2fe21b){_0x43fdfd=_0x43fdfd-0x0;var _0x49aab1=_0x0e9f[_0x43fdfd];return _0x49aab1;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf0e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0e9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0e9('0x4'));module[_0xf0e9('0x5')]=function(_0x59ac7e,_0x2322dc){return _0x59ac7e['define'](_0xf0e9('0x6'),attributes,{'tableName':_0xf0e9('0x7'),'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 b49bdda..502ab1a 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 _0x4b56=['code','message','info','result','catch','SmsQueue','findAll','options','raw','where','attributes','include','map','model','GetSmsQueue','find','lodash','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x4b56,0x19c));var _0x64b5=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x4b56[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x64b5('0x0'));var util=require('util');var moment=require(_0x64b5('0x1'));var BPromise=require(_0x64b5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64b5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x64b5('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64b5('0x5'));var client=jayson[_0x64b5('0x6')]['http']({'port':0x232a});config[_0x64b5('0x7')]=_[_0x64b5('0x8')](config[_0x64b5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x64b5('0x9'))(new Redis(config['redis']));require(_0x64b5('0xa'))[_0x64b5('0xb')](socket);function respondWithRpcPromise(_0x3a7e21,_0x550d3a,_0x5a900e){return new BPromise(function(_0x4ca2d6,_0x4fd6ad){return client[_0x64b5('0xc')](_0x3a7e21,_0x5a900e)[_0x64b5('0xd')](function(_0x538ab1){logger['info'](_0x64b5('0xe'),_0x550d3a,_0x64b5('0xf'));logger[_0x64b5('0x10')](_0x64b5('0x11'),_0x550d3a,_0x64b5('0xf'),JSON[_0x64b5('0x12')](_0x538ab1));if(_0x538ab1[_0x64b5('0x13')]){if(_0x538ab1[_0x64b5('0x13')][_0x64b5('0x14')]===0x1f4){logger[_0x64b5('0x13')]('SmsQueue,\x20%s,\x20%s',_0x550d3a,_0x538ab1[_0x64b5('0x13')][_0x64b5('0x15')]);return _0x4fd6ad(_0x538ab1[_0x64b5('0x13')][_0x64b5('0x15')]);}logger['error'](_0x64b5('0xe'),_0x550d3a,_0x538ab1[_0x64b5('0x13')][_0x64b5('0x15')]);return _0x4ca2d6(_0x538ab1[_0x64b5('0x13')][_0x64b5('0x15')]);}else{logger[_0x64b5('0x16')](_0x64b5('0xe'),_0x550d3a,_0x64b5('0xf'));_0x4ca2d6(_0x538ab1[_0x64b5('0x17')][_0x64b5('0x15')]);}})[_0x64b5('0x18')](function(_0x65185a){logger[_0x64b5('0x13')]('SmsQueue,\x20%s,\x20%s',_0x550d3a,_0x65185a);_0x4fd6ad(_0x65185a);});});}exports['GetSmsQueue']=function(_0x15b8fe){var _0x1e9cda=this;return new Promise(function(_0x233169,_0x2361ed){return db[_0x64b5('0x19')][_0x64b5('0x1a')]({'raw':_0x15b8fe['options']?_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1c')]===undefined?!![]:![]:!![],'where':_0x15b8fe['options']?_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1d')]||null:null,'attributes':_0x15b8fe[_0x64b5('0x1b')]?_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1e')]||null:null,'limit':_0x15b8fe[_0x64b5('0x1b')]?_0x15b8fe['options']['limit']||null:null,'include':_0x15b8fe[_0x64b5('0x1b')]?_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1f')]?_[_0x64b5('0x20')](_0x15b8fe[_0x64b5('0x1b')][_0x64b5('0x1f')],function(_0x3878e2){return{'model':db[_0x3878e2[_0x64b5('0x21')]],'as':_0x3878e2['as'],'attributes':_0x3878e2[_0x64b5('0x1e')],'include':_0x3878e2[_0x64b5('0x1f')]?_[_0x64b5('0x20')](_0x3878e2['include'],function(_0x14f162){return{'model':db[_0x14f162[_0x64b5('0x21')]],'as':_0x14f162['as'],'attributes':_0x14f162[_0x64b5('0x1e')],'include':_0x14f162[_0x64b5('0x1f')]?_[_0x64b5('0x20')](_0x14f162[_0x64b5('0x1f')],function(_0x1b2bd8){return{'model':db[_0x1b2bd8[_0x64b5('0x21')]],'as':_0x1b2bd8['as'],'attributes':_0x1b2bd8[_0x64b5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47608e){logger[_0x64b5('0x16')](_0x64b5('0x22'),_0x15b8fe);logger['debug']('GetSmsQueue',_0x15b8fe,JSON['stringify'](_0x47608e));_0x233169(_0x47608e);})[_0x64b5('0x18')](function(_0x3c9470){logger['error'](_0x64b5('0x22'),_0x3c9470[_0x64b5('0x15')],_0x15b8fe);_0x2361ed(_0x1e9cda[_0x64b5('0x13')](0x1f4,_0x3c9470['message']));});});};exports['ShowSmsQueue']=function(_0x2f490d){var _0x2885d8=this;return new Promise(function(_0x424db6,_0xc63aeb){return db[_0x64b5('0x19')][_0x64b5('0x23')]({'raw':_0x2f490d[_0x64b5('0x1b')]?_0x2f490d['options'][_0x64b5('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f490d['options']?_0x2f490d['options'][_0x64b5('0x1d')]||null:null,'attributes':_0x2f490d[_0x64b5('0x1b')]?_0x2f490d['options'][_0x64b5('0x1e')]||null:null,'include':_0x2f490d['options']?_0x2f490d[_0x64b5('0x1b')][_0x64b5('0x1f')]?_['map'](_0x2f490d[_0x64b5('0x1b')][_0x64b5('0x1f')],function(_0x3c8529){return{'model':db[_0x3c8529['model']],'as':_0x3c8529['as'],'attributes':_0x3c8529['attributes'],'include':_0x3c8529['include']?_['map'](_0x3c8529[_0x64b5('0x1f')],function(_0x1e0b62){return{'model':db[_0x1e0b62[_0x64b5('0x21')]],'as':_0x1e0b62['as'],'attributes':_0x1e0b62[_0x64b5('0x1e')],'include':_0x1e0b62['include']?_[_0x64b5('0x20')](_0x1e0b62[_0x64b5('0x1f')],function(_0x58bb14){return{'model':db[_0x58bb14[_0x64b5('0x21')]],'as':_0x58bb14['as'],'attributes':_0x58bb14['attributes']};}):[]};}):[]};}):[]:[]})[_0x64b5('0xd')](function(_0x404704){logger[_0x64b5('0x16')]('ShowSmsQueue',_0x2f490d);logger[_0x64b5('0x10')]('ShowSmsQueue',_0x2f490d,JSON[_0x64b5('0x12')](_0x404704));_0x424db6(_0x404704);})[_0x64b5('0x18')](function(_0xebab1){logger[_0x64b5('0x13')]('ShowSmsQueue',_0xebab1[_0x64b5('0x15')],_0x2f490d);_0xc63aeb(_0x2885d8[_0x64b5('0x13')](0x1f4,_0xebab1[_0x64b5('0x15')]));});});}; \ No newline at end of file +var _0x9a4f=['request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','SmsQueue,\x20%s,\x20%s','error','message','result','GetSmsQueue','options','raw','where','limit','include','map','attributes','model','catch','find','ShowSmsQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x9a4f,0x93));var _0xf9a4=function(_0x36de4f,_0x350d30){_0x36de4f=_0x36de4f-0x0;var _0x1a91c2=_0x9a4f[_0x36de4f];return _0x1a91c2;};'use strict';var _=require(_0xf9a4('0x0'));var util=require(_0xf9a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf9a4('0x2'));var fs=require('fs');var Redis=require(_0xf9a4('0x3'));var db=require(_0xf9a4('0x4'))['db'];var utils=require(_0xf9a4('0x5'));var logger=require(_0xf9a4('0x6'))(_0xf9a4('0x7'));var config=require(_0xf9a4('0x8'));var jayson=require(_0xf9a4('0x9'));var client=jayson[_0xf9a4('0xa')][_0xf9a4('0xb')]({'port':0x232a});config[_0xf9a4('0xc')]=_['defaults'](config[_0xf9a4('0xc')],{'host':_0xf9a4('0xd'),'port':0x18eb});var socket=require(_0xf9a4('0xe'))(new Redis(config['redis']));require(_0xf9a4('0xf'))[_0xf9a4('0x10')](socket);function respondWithRpcPromise(_0x224d01,_0x455642,_0x23b60e){return new BPromise(function(_0x58b51f,_0x3a5e83){return client[_0xf9a4('0x11')](_0x224d01,_0x23b60e)[_0xf9a4('0x12')](function(_0x40535c){logger[_0xf9a4('0x13')]('SmsQueue,\x20%s,\x20%s',_0x455642,_0xf9a4('0x14'));logger[_0xf9a4('0x15')](_0xf9a4('0x16'),_0x455642,_0xf9a4('0x14'),JSON[_0xf9a4('0x17')](_0x40535c));if(_0x40535c['error']){if(_0x40535c['error'][_0xf9a4('0x18')]===0x1f4){logger['error'](_0xf9a4('0x19'),_0x455642,_0x40535c[_0xf9a4('0x1a')][_0xf9a4('0x1b')]);return _0x3a5e83(_0x40535c[_0xf9a4('0x1a')][_0xf9a4('0x1b')]);}logger['error'](_0xf9a4('0x19'),_0x455642,_0x40535c['error'][_0xf9a4('0x1b')]);return _0x58b51f(_0x40535c[_0xf9a4('0x1a')][_0xf9a4('0x1b')]);}else{logger[_0xf9a4('0x13')](_0xf9a4('0x19'),_0x455642,_0xf9a4('0x14'));_0x58b51f(_0x40535c[_0xf9a4('0x1c')]['message']);}})['catch'](function(_0x4cc2af){logger[_0xf9a4('0x1a')](_0xf9a4('0x19'),_0x455642,_0x4cc2af);_0x3a5e83(_0x4cc2af);});});}exports[_0xf9a4('0x1d')]=function(_0x49c5f7){var _0x2e6526=this;return new Promise(function(_0x2fd6cb,_0x200c44){return db['SmsQueue']['findAll']({'raw':_0x49c5f7['options']?_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x1f')]===undefined?!![]:![]:!![],'where':_0x49c5f7[_0xf9a4('0x1e')]?_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x20')]||null:null,'attributes':_0x49c5f7[_0xf9a4('0x1e')]?_0x49c5f7[_0xf9a4('0x1e')]['attributes']||null:null,'limit':_0x49c5f7[_0xf9a4('0x1e')]?_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x21')]||null:null,'include':_0x49c5f7[_0xf9a4('0x1e')]?_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x22')]?_[_0xf9a4('0x23')](_0x49c5f7[_0xf9a4('0x1e')][_0xf9a4('0x22')],function(_0x128a86){return{'model':db[_0x128a86['model']],'as':_0x128a86['as'],'attributes':_0x128a86[_0xf9a4('0x24')],'include':_0x128a86[_0xf9a4('0x22')]?_[_0xf9a4('0x23')](_0x128a86[_0xf9a4('0x22')],function(_0x513a9a){return{'model':db[_0x513a9a[_0xf9a4('0x25')]],'as':_0x513a9a['as'],'attributes':_0x513a9a[_0xf9a4('0x24')],'include':_0x513a9a[_0xf9a4('0x22')]?_['map'](_0x513a9a[_0xf9a4('0x22')],function(_0x593c1d){return{'model':db[_0x593c1d['model']],'as':_0x593c1d['as'],'attributes':_0x593c1d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9a4('0x12')](function(_0x56ea52){logger[_0xf9a4('0x13')](_0xf9a4('0x1d'),_0x49c5f7);logger[_0xf9a4('0x15')]('GetSmsQueue',_0x49c5f7,JSON[_0xf9a4('0x17')](_0x56ea52));_0x2fd6cb(_0x56ea52);})[_0xf9a4('0x26')](function(_0x247951){logger[_0xf9a4('0x1a')](_0xf9a4('0x1d'),_0x247951[_0xf9a4('0x1b')],_0x49c5f7);_0x200c44(_0x2e6526[_0xf9a4('0x1a')](0x1f4,_0x247951[_0xf9a4('0x1b')]));});});};exports['ShowSmsQueue']=function(_0x3269b6){var _0x10b8f8=this;return new Promise(function(_0x454ee8,_0x4c6008){return db['SmsQueue'][_0xf9a4('0x27')]({'raw':_0x3269b6[_0xf9a4('0x1e')]?_0x3269b6[_0xf9a4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3269b6['options']?_0x3269b6[_0xf9a4('0x1e')][_0xf9a4('0x20')]||null:null,'attributes':_0x3269b6[_0xf9a4('0x1e')]?_0x3269b6['options'][_0xf9a4('0x24')]||null:null,'include':_0x3269b6[_0xf9a4('0x1e')]?_0x3269b6[_0xf9a4('0x1e')][_0xf9a4('0x22')]?_[_0xf9a4('0x23')](_0x3269b6['options'][_0xf9a4('0x22')],function(_0x5234f7){return{'model':db[_0x5234f7[_0xf9a4('0x25')]],'as':_0x5234f7['as'],'attributes':_0x5234f7[_0xf9a4('0x24')],'include':_0x5234f7[_0xf9a4('0x22')]?_[_0xf9a4('0x23')](_0x5234f7['include'],function(_0x3e2593){return{'model':db[_0x3e2593['model']],'as':_0x3e2593['as'],'attributes':_0x3e2593['attributes'],'include':_0x3e2593['include']?_[_0xf9a4('0x23')](_0x3e2593[_0xf9a4('0x22')],function(_0x1de2ab){return{'model':db[_0x1de2ab[_0xf9a4('0x25')]],'as':_0x1de2ab['as'],'attributes':_0x1de2ab[_0xf9a4('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf9a4('0x12')](function(_0x454f6a){logger['info'](_0xf9a4('0x28'),_0x3269b6);logger['debug']('ShowSmsQueue',_0x3269b6,JSON[_0xf9a4('0x17')](_0x454f6a));_0x454ee8(_0x454f6a);})['catch'](function(_0x3edd7d){logger['error'](_0xf9a4('0x28'),_0x3edd7d[_0xf9a4('0x1b')],_0x3269b6);_0x4c6008(_0x10b8f8[_0xf9a4('0x1a')](0x1f4,_0x3edd7d[_0xf9a4('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e299c37..6a1fd71 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 _0xe248=['./smsQueue.events','save','remove','update','emit','removeListener','register','length','smsQueue:'];(function(_0x22dd2b,_0x3b116a){var _0x2c816c=function(_0x4f2765){while(--_0x4f2765){_0x22dd2b['push'](_0x22dd2b['shift']());}};_0x2c816c(++_0x3b116a);}(_0xe248,0x1b0));var _0x8e24=function(_0x138eb3,_0x13396c){_0x138eb3=_0x138eb3-0x0;var _0x5706f9=_0xe248[_0x138eb3];return _0x5706f9;};'use strict';var SmsQueueEvents=require(_0x8e24('0x0'));var events=[_0x8e24('0x1'),_0x8e24('0x2'),_0x8e24('0x3')];function createListener(_0x3f23cc,_0x2a7b6b){return function(_0x2c4912){_0x2a7b6b[_0x8e24('0x4')](_0x3f23cc,_0x2c4912);};}function removeListener(_0x2229f2,_0x598451){return function(){SmsQueueEvents[_0x8e24('0x5')](_0x2229f2,_0x598451);};}exports[_0x8e24('0x6')]=function(_0xc43139){for(var _0x4c7da1=0x0,_0x54cd04=events[_0x8e24('0x7')];_0x4c7da1<_0x54cd04;_0x4c7da1++){var _0x466313=events[_0x4c7da1];var _0x1081b1=createListener(_0x8e24('0x8')+_0x466313,_0xc43139);SmsQueueEvents['on'](_0x466313,_0x1081b1);}}; \ No newline at end of file +var _0x548a=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x54c3c5,_0x1c1bae){var _0x191b03=function(_0x5e95c9){while(--_0x5e95c9){_0x54c3c5['push'](_0x54c3c5['shift']());}};_0x191b03(++_0x1c1bae);}(_0x548a,0x173));var _0xa548=function(_0x5c82c1,_0x577293){_0x5c82c1=_0x5c82c1-0x0;var _0x22034d=_0x548a[_0x5c82c1];return _0x22034d;};'use strict';var SmsQueueEvents=require(_0xa548('0x0'));var events=[_0xa548('0x1'),_0xa548('0x2'),_0xa548('0x3')];function createListener(_0x27b5e4,_0x3dcc31){return function(_0x41fe98){_0x3dcc31[_0xa548('0x4')](_0x27b5e4,_0x41fe98);};}function removeListener(_0x24ef21,_0x2ce5da){return function(){SmsQueueEvents['removeListener'](_0x24ef21,_0x2ce5da);};}exports[_0xa548('0x5')]=function(_0x38ce5d){for(var _0x1f9b03=0x0,_0x495d37=events[_0xa548('0x6')];_0x1f9b03<_0x495d37;_0x1f9b03++){var _0x46d71a=events[_0x1f9b03];var _0x5d02be=createListener(_0xa548('0x7')+_0x46d71a,_0x38ce5d);SmsQueueEvents['on'](_0x46d71a,_0x5d02be);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 9b14a2b..79546f8 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 _0xd246=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x36886d,_0xff9165){var _0x1815b7=function(_0x3ca328){while(--_0x3ca328){_0x36886d['push'](_0x36886d['shift']());}};_0x1815b7(++_0xff9165);}(_0xd246,0x1c1));var _0x6d24=function(_0x1988b0,_0x1fa6a0){_0x1988b0=_0x1988b0-0x0;var _0x1240b2=_0xd246[_0x1988b0];return _0x1240b2;};'use strict';var multer=require(_0x6d24('0x0'));var util=require(_0x6d24('0x1'));var path=require(_0x6d24('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d24('0x3')]();var auth=require(_0x6d24('0x4'));var interaction=require(_0x6d24('0x5'));var config=require(_0x6d24('0x6'));var controller=require('./smsQueueReport.controller');router[_0x6d24('0x7')]('/',auth[_0x6d24('0x8')](),controller[_0x6d24('0x9')]);router[_0x6d24('0x7')]('/describe',auth[_0x6d24('0x8')](),controller[_0x6d24('0xa')]);router[_0x6d24('0x7')](_0x6d24('0xb'),auth[_0x6d24('0x8')](),controller[_0x6d24('0xc')]);router[_0x6d24('0xd')]('/',auth[_0x6d24('0x8')](),controller[_0x6d24('0xe')]);router['put']('/:id',auth[_0x6d24('0x8')](),controller['update']);router[_0x6d24('0xf')](_0x6d24('0xb'),auth[_0x6d24('0x8')](),controller[_0x6d24('0x10')]);module[_0x6d24('0x11')]=router; \ No newline at end of file +var _0xe35f=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x160b12,_0x46d66c){var _0x2959f7=function(_0x18a76b){while(--_0x18a76b){_0x160b12['push'](_0x160b12['shift']());}};_0x2959f7(++_0x46d66c);}(_0xe35f,0x140));var _0xfe35=function(_0x2af6d3,_0x28899d){_0x2af6d3=_0x2af6d3-0x0;var _0x42a02f=_0xe35f[_0x2af6d3];return _0x42a02f;};'use strict';var multer=require(_0xfe35('0x0'));var util=require('util');var path=require(_0xfe35('0x1'));var timeout=require(_0xfe35('0x2'));var express=require('express');var router=express[_0xfe35('0x3')]();var auth=require(_0xfe35('0x4'));var interaction=require(_0xfe35('0x5'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xfe35('0x6')]('/',auth[_0xfe35('0x7')](),controller[_0xfe35('0x8')]);router[_0xfe35('0x6')](_0xfe35('0x9'),auth['isAuthenticated'](),controller[_0xfe35('0xa')]);router[_0xfe35('0x6')](_0xfe35('0xb'),auth[_0xfe35('0x7')](),controller[_0xfe35('0xc')]);router['post']('/',auth[_0xfe35('0x7')](),controller[_0xfe35('0xd')]);router[_0xfe35('0xe')](_0xfe35('0xb'),auth['isAuthenticated'](),controller[_0xfe35('0xf')]);router['delete'](_0xfe35('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 9710ec0..aad5094 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 _0x2aed=['DATE','moment','exports','STRING'];(function(_0x18d4b2,_0x3060ea){var _0xa5aca1=function(_0x458c68){while(--_0x458c68){_0x18d4b2['push'](_0x18d4b2['shift']());}};_0xa5aca1(++_0x3060ea);}(_0x2aed,0x8d));var _0xd2ae=function(_0x28a84a,_0x366493){_0x28a84a=_0x28a84a-0x0;var _0x2bfb0c=_0x2aed[_0x28a84a];return _0x2bfb0c;};'use strict';var moment=require(_0xd2ae('0x0'));var Sequelize=require('sequelize');module[_0xd2ae('0x1')]={'uniqueid':{'type':Sequelize[_0xd2ae('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd2ae('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd2ae('0x3')]},'acceptAt':{'type':Sequelize[_0xd2ae('0x3')]},'exitAt':{'type':Sequelize[_0xd2ae('0x3')]},'reason':{'type':Sequelize[_0xd2ae('0x2')]}}; \ No newline at end of file +var _0x2e9b=['STRING','DATE','moment','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2e9b,0x1c4));var _0xb2e9=function(_0x2165ad,_0x4323f9){_0x2165ad=_0x2165ad-0x0;var _0x2624ca=_0x2e9b[_0x2165ad];return _0x2624ca;};'use strict';var moment=require(_0xb2e9('0x0'));var Sequelize=require(_0xb2e9('0x1'));module[_0xb2e9('0x2')]={'uniqueid':{'type':Sequelize[_0xb2e9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xb2e9('0x3')]},'joinAt':{'type':Sequelize[_0xb2e9('0x4')]},'leaveAt':{'type':Sequelize[_0xb2e9('0x4')]},'acceptAt':{'type':Sequelize[_0xb2e9('0x4')]},'exitAt':{'type':Sequelize[_0xb2e9('0x4')]},'reason':{'type':Sequelize[_0xb2e9('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 96ea334..5769b0b 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 _0x3e74=['save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','limit','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','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','sendStatus','count','offset','status','set','Content-Range','json','apply','reject'];(function(_0x627e34,_0x55ec3c){var _0x4c1e75=function(_0x565768){while(--_0x565768){_0x627e34['push'](_0x627e34['shift']());}};_0x4c1e75(++_0x55ec3c);}(_0x3e74,0x175));var _0x43e7=function(_0x37e680,_0x218c18){_0x37e680=_0x37e680-0x0;var _0x4ea103=_0x3e74[_0x37e680];return _0x4ea103;};'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'];function respondWithStatusCode(_0x3eb206,_0xc960ea){_0xc960ea=_0xc960ea||0xcc;return function(_0x2718d3){if(_0x2718d3){return _0x3eb206[_0x43e7('0x14')](_0xc960ea);}return _0x3eb206['status'](_0xc960ea)['end']();};}function respondWithResult(_0x2fcb36,_0x21fdd3){_0x21fdd3=_0x21fdd3||0xc8;return function(_0x44b0bd){if(_0x44b0bd){return _0x2fcb36['status'](_0x21fdd3)['json'](_0x44b0bd);}};}function respondWithFilteredResult(_0x16849c,_0x14c146){return function(_0x203378){if(_0x203378){var _0x328445=_0x203378[_0x43e7('0x15')],_0x4de324=_0x14c146[_0x43e7('0x16')],_0x5c4eaa=_0x14c146['offset']+_0x14c146['limit'],_0xdf16c;if(_0x5c4eaa>=_0x328445){_0x5c4eaa=_0x328445;_0xdf16c=0xc8;}else{_0xdf16c=0xce;}_0x16849c[_0x43e7('0x17')](_0xdf16c);return _0x16849c[_0x43e7('0x18')](_0x43e7('0x19'),_0x4de324+'-'+_0x5c4eaa+'/'+_0x328445)[_0x43e7('0x1a')](_0x203378);}return null;};}function patchUpdates(_0x3776f5){return function(_0x1f24fb){try{jsonpatch[_0x43e7('0x1b')](_0x1f24fb,_0x3776f5,!![]);}catch(_0x1441ef){return BPromise[_0x43e7('0x1c')](_0x1441ef);}return _0x1f24fb[_0x43e7('0x1d')]();};}function saveUpdates(_0x191dd5,_0x177ee1){return function(_0x4b5d64){if(_0x4b5d64){return _0x4b5d64[_0x43e7('0x1e')](_0x191dd5)[_0x43e7('0x1f')](function(_0x4b386b){return _0x4b386b;});}return null;};}function removeEntity(_0x2898b5,_0x3e281e){return function(_0x3945bb){if(_0x3945bb){return _0x3945bb[_0x43e7('0x20')]()[_0x43e7('0x1f')](function(){_0x2898b5[_0x43e7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x454359,_0x4eea52){return function(_0x4c9df3){if(!_0x4c9df3){_0x454359[_0x43e7('0x14')](0x194);}return _0x4c9df3;};}function handleError(_0x43f4ff,_0x4b2b9f){_0x4b2b9f=_0x4b2b9f||0x1f4;return function(_0x1f0673){logger['error'](_0x1f0673[_0x43e7('0x21')]);if(_0x1f0673['name']){delete _0x1f0673[_0x43e7('0x22')];}_0x43f4ff[_0x43e7('0x17')](_0x4b2b9f)[_0x43e7('0x23')](_0x1f0673);};}exports[_0x43e7('0x24')]=function(_0x51f4d7,_0x52b7b3){var _0x805b54={},_0x501551={},_0x2dd5f={'count':0x0,'rows':[]};var _0x40dc8f=_[_0x43e7('0x25')](db[_0x43e7('0x26')]['rawAttributes'],function(_0x33a1a5){return{'name':_0x33a1a5[_0x43e7('0x27')],'type':_0x33a1a5[_0x43e7('0x28')][_0x43e7('0x29')]};});_0x501551[_0x43e7('0x2a')]=_[_0x43e7('0x25')](_0x40dc8f,_0x43e7('0x22'));_0x501551[_0x43e7('0x2b')]=_[_0x43e7('0x2c')](_0x51f4d7[_0x43e7('0x2b')]);_0x501551[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],_0x501551[_0x43e7('0x2b')]);_0x805b54['attributes']=_[_0x43e7('0x2e')](_0x501551[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x2f')]));_0x805b54['attributes']=_0x805b54[_0x43e7('0x30')][_0x43e7('0x31')]?_0x805b54[_0x43e7('0x30')]:_0x501551[_0x43e7('0x2a')];if(!_0x51f4d7['query']['hasOwnProperty']('nolimit')){_0x805b54[_0x43e7('0x32')]=qs[_0x43e7('0x32')](_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x32')]);_0x805b54[_0x43e7('0x16')]=qs[_0x43e7('0x16')](_0x51f4d7['query']['offset']);}_0x805b54['order']=qs['sort'](_0x51f4d7['query']['sort']);_0x805b54['where']=qs[_0x43e7('0x2d')](_['pick'](_0x51f4d7[_0x43e7('0x2b')],_0x501551[_0x43e7('0x2d')]),_0x40dc8f);if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]){_0x805b54[_0x43e7('0x34')]=_[_0x43e7('0x35')](_0x805b54[_0x43e7('0x34')],{'$or':_['map'](_0x40dc8f,function(_0x5332d9){if(_0x5332d9['type']!==_0x43e7('0x36')){var _0xfe70e9={};_0xfe70e9[_0x5332d9[_0x43e7('0x22')]]={'$like':'%'+_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x33')]+'%'};return _0xfe70e9;}})});}_0x805b54=_[_0x43e7('0x35')]({},_0x805b54,_0x51f4d7[_0x43e7('0x37')]);var _0x2ffd43={'where':_0x805b54['where']};return db[_0x43e7('0x26')][_0x43e7('0x15')](_0x2ffd43)['then'](function(_0x2d54c1){_0x2dd5f['count']=_0x2d54c1;if(_0x51f4d7[_0x43e7('0x2b')][_0x43e7('0x38')]){_0x805b54[_0x43e7('0x39')]=[{'all':!![]}];}return db[_0x43e7('0x26')][_0x43e7('0x3a')](_0x805b54);})[_0x43e7('0x1f')](function(_0x5e731b){_0x2dd5f['rows']=_0x5e731b;return _0x2dd5f;})[_0x43e7('0x1f')](respondWithFilteredResult(_0x52b7b3,_0x805b54))[_0x43e7('0x3b')](handleError(_0x52b7b3,null));};exports[_0x43e7('0x3c')]=function(_0xc8ffa5,_0x127d77){var _0x4a4a85={'raw':!![],'where':{'id':_0xc8ffa5[_0x43e7('0x3d')]['id']}},_0x32a451={};_0x32a451['model']=_[_0x43e7('0x2c')](db['SmsQueueReport'][_0x43e7('0x3e')]);_0x32a451['query']=_[_0x43e7('0x2c')](_0xc8ffa5[_0x43e7('0x2b')]);_0x32a451[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_0x32a451['model'],_0x32a451['query']);_0x4a4a85[_0x43e7('0x30')]=_[_0x43e7('0x2e')](_0x32a451[_0x43e7('0x2a')],qs[_0x43e7('0x2f')](_0xc8ffa5['query']['fields']));_0x4a4a85['attributes']=_0x4a4a85[_0x43e7('0x30')]['length']?_0x4a4a85[_0x43e7('0x30')]:_0x32a451['model'];if(_0xc8ffa5['query'][_0x43e7('0x38')]){_0x4a4a85['include']=[{'all':!![]}];}_0x4a4a85=_[_0x43e7('0x35')]({},_0x4a4a85,_0xc8ffa5[_0x43e7('0x37')]);return db[_0x43e7('0x26')][_0x43e7('0x3f')](_0x4a4a85)['then'](handleEntityNotFound(_0x127d77,null))[_0x43e7('0x1f')](respondWithResult(_0x127d77,null))[_0x43e7('0x3b')](handleError(_0x127d77,null));};exports[_0x43e7('0x40')]=function(_0x1fd277,_0x296dc8){return db[_0x43e7('0x26')]['create'](_0x1fd277['body'],{})[_0x43e7('0x1f')](respondWithResult(_0x296dc8,0xc9))[_0x43e7('0x3b')](handleError(_0x296dc8,null));};exports[_0x43e7('0x1e')]=function(_0x4c00a8,_0x5c1c18){if(_0x4c00a8['body']['id']){delete _0x4c00a8[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x26')]['find']({'where':{'id':_0x4c00a8[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0x5c1c18,null))[_0x43e7('0x1f')](saveUpdates(_0x4c00a8['body'],null))['then'](respondWithResult(_0x5c1c18,null))['catch'](handleError(_0x5c1c18,null));};exports['destroy']=function(_0x214e7e,_0xe955fc){return db['SmsQueueReport'][_0x43e7('0x3f')]({'where':{'id':_0x214e7e[_0x43e7('0x3d')]['id']}})[_0x43e7('0x1f')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x1f')](removeEntity(_0xe955fc,null))['catch'](handleError(_0xe955fc,null));};exports[_0x43e7('0x42')]=function(_0x483f20,_0x4bebd4){return db[_0x43e7('0x26')][_0x43e7('0x42')]()[_0x43e7('0x1f')](respondWithResult(_0x4bebd4,null))[_0x43e7('0x3b')](handleError(_0x4bebd4,null));}; \ No newline at end of file +var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x561432,_0x21ec65){var _0x3485b6=function(_0x3e022f){while(--_0x3e022f){_0x561432['push'](_0x561432['shift']());}};_0x3485b6(++_0x21ec65);}(_0x814b,0x1a2));var _0xb814=function(_0x161ac3,_0x142e49){_0x161ac3=_0x161ac3-0x0;var _0x3bb837=_0x814b[_0x161ac3];return _0x3bb837;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 09d531a..59a2e6c 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 _0x8dd2=['path','rimraf','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0xf16650,_0x13397f){var _0x1b1abb=function(_0x1a4ab4){while(--_0x1a4ab4){_0xf16650['push'](_0xf16650['shift']());}};_0x1b1abb(++_0x13397f);}(_0x8dd2,0x15a));var _0x28dd=function(_0x285d29,_0x52c639){_0x285d29=_0x285d29-0x0;var _0x202256=_0x8dd2[_0x285d29];return _0x202256;};'use strict';var _=require(_0x28dd('0x0'));var util=require('util');var logger=require(_0x28dd('0x1'))(_0x28dd('0x2'));var moment=require(_0x28dd('0x3'));var BPromise=require(_0x28dd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x28dd('0x5'));var rimraf=require(_0x28dd('0x6'));var config=require('../../config/environment');var attributes=require(_0x28dd('0x7'));module[_0x28dd('0x8')]=function(_0x57db5c,_0x3a024b){return _0x57db5c[_0x28dd('0x9')](_0x28dd('0xa'),attributes,{'tableName':_0x28dd('0xb'),'paranoid':![],'indexes':[{'name':_0x28dd('0xc'),'fields':[_0x28dd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8e0=['exports','define','SmsQueueReport','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0xc8e0,0x1e4));var _0x0c8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc8e0[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x0c8e('0x0'));var util=require(_0x0c8e('0x1'));var logger=require('../../config/logger')(_0x0c8e('0x2'));var moment=require(_0x0c8e('0x3'));var BPromise=require(_0x0c8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c8e('0x5'));var rimraf=require(_0x0c8e('0x6'));var config=require(_0x0c8e('0x7'));var attributes=require('./smsQueueReport.attributes');module[_0x0c8e('0x8')]=function(_0x27cecd,_0x5f2909){return _0x27cecd[_0x0c8e('0x9')](_0x0c8e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x0c8e('0xb'),'fields':[_0x0c8e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 223e6bf..6e8aa60 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 _0xeae1=['randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','where','limit','UpdateSmsQueueReport','util','bluebird'];(function(_0x37cebe,_0x5be2e4){var _0x3275e9=function(_0x3bced2){while(--_0x3bced2){_0x37cebe['push'](_0x37cebe['shift']());}};_0x3275e9(++_0x5be2e4);}(_0xeae1,0x1de));var _0x1eae=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xeae1[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var util=require(_0x1eae('0x0'));var moment=require('moment');var BPromise=require(_0x1eae('0x1'));var rs=require(_0x1eae('0x2'));var fs=require('fs');var Redis=require(_0x1eae('0x3'));var db=require(_0x1eae('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1eae('0x5'));var config=require('../../config/environment');var jayson=require(_0x1eae('0x6'));var client=jayson[_0x1eae('0x7')][_0x1eae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x387af2,_0x3e68f6,_0x4cb523){return new BPromise(function(_0x4d35ad,_0x440bbe){return client[_0x1eae('0x9')](_0x387af2,_0x4cb523)[_0x1eae('0xa')](function(_0x4c532f){logger['info'](_0x1eae('0xb'),_0x3e68f6,_0x1eae('0xc'));logger[_0x1eae('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3e68f6,'request\x20sent',JSON[_0x1eae('0xe')](_0x4c532f));if(_0x4c532f[_0x1eae('0xf')]){if(_0x4c532f[_0x1eae('0xf')][_0x1eae('0x10')]===0x1f4){logger[_0x1eae('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x3e68f6,_0x4c532f[_0x1eae('0xf')][_0x1eae('0x11')]);return _0x440bbe(_0x4c532f[_0x1eae('0xf')][_0x1eae('0x11')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x3e68f6,_0x4c532f[_0x1eae('0xf')]['message']);return _0x4d35ad(_0x4c532f[_0x1eae('0xf')][_0x1eae('0x11')]);}else{logger[_0x1eae('0x12')](_0x1eae('0xb'),_0x3e68f6,'request\x20sent');_0x4d35ad(_0x4c532f[_0x1eae('0x13')]['message']);}})[_0x1eae('0x14')](function(_0x4dc02c){logger[_0x1eae('0xf')](_0x1eae('0xb'),_0x3e68f6,_0x4dc02c);_0x440bbe(_0x4dc02c);});});}exports[_0x1eae('0x15')]=function(_0x190736){var _0x4b6c31=this;return new Promise(function(_0x564295,_0x4cfcb1){return db[_0x1eae('0x16')][_0x1eae('0x17')](_0x190736[_0x1eae('0x18')],{'raw':_0x190736['options']?_0x190736[_0x1eae('0x19')][_0x1eae('0x1a')]===undefined?!![]:![]:!![]})[_0x1eae('0xa')](function(_0x432cc6){logger[_0x1eae('0x12')]('CreateSmsQueueReport',_0x190736);logger[_0x1eae('0xd')](_0x1eae('0x15'),_0x190736,JSON['stringify'](_0x432cc6));_0x564295(_0x432cc6);})[_0x1eae('0x14')](function(_0x2d52b0){logger[_0x1eae('0xf')](_0x1eae('0x15'),_0x2d52b0[_0x1eae('0x11')],_0x190736);_0x4cfcb1(_0x4b6c31[_0x1eae('0xf')](0x1f4,_0x2d52b0['message']));});});};exports['UpdateSmsQueueReport']=function(_0x3b2e2e){var _0x4cc4ae=this;return new Promise(function(_0xe446e8,_0x1d190c){return db[_0x1eae('0x16')]['update'](_0x3b2e2e[_0x1eae('0x18')],{'raw':_0x3b2e2e[_0x1eae('0x19')]?_0x3b2e2e['options'][_0x1eae('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b2e2e['options']?_0x3b2e2e[_0x1eae('0x19')][_0x1eae('0x1b')]||null:null,'attributes':_0x3b2e2e[_0x1eae('0x19')]?_0x3b2e2e[_0x1eae('0x19')]['attributes']||null:null,'limit':_0x3b2e2e['options']?_0x3b2e2e['options'][_0x1eae('0x1c')]||null:null})[_0x1eae('0xa')](function(_0x3dff7b){logger[_0x1eae('0x12')](_0x1eae('0x1d'),_0x3b2e2e);logger[_0x1eae('0xd')]('UpdateSmsQueueReport',_0x3b2e2e,JSON[_0x1eae('0xe')](_0x3dff7b));_0xe446e8(_0x3dff7b);})['catch'](function(_0x507c66){logger['error'](_0x1eae('0x1d'),_0x507c66[_0x1eae('0x11')],_0x3b2e2e);_0x1d190c(_0x4cc4ae[_0x1eae('0xf')](0x1f4,_0x507c66[_0x1eae('0x11')]));});});}; \ No newline at end of file +var _0x6be8=['moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSmsQueueReport','create','body','options','raw','update','where','UpdateSmsQueueReport','lodash'];(function(_0x38b86f,_0x4b3582){var _0x163974=function(_0x188793){while(--_0x188793){_0x38b86f['push'](_0x38b86f['shift']());}};_0x163974(++_0x4b3582);}(_0x6be8,0x128));var _0x86be=function(_0x193b01,_0x2f9ac6){_0x193b01=_0x193b01-0x0;var _0x531e06=_0x6be8[_0x193b01];return _0x531e06;};'use strict';var _=require(_0x86be('0x0'));var util=require('util');var moment=require(_0x86be('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86be('0x2'))['db'];var utils=require(_0x86be('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x86be('0x4'));var jayson=require(_0x86be('0x5'));var client=jayson[_0x86be('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39d34e,_0x1de9a1,_0xb0f1ea){return new BPromise(function(_0x3010d2,_0x54c9b6){return client[_0x86be('0x7')](_0x39d34e,_0xb0f1ea)[_0x86be('0x8')](function(_0x545c7b){logger['info'](_0x86be('0x9'),_0x1de9a1,_0x86be('0xa'));logger[_0x86be('0xb')](_0x86be('0xc'),_0x1de9a1,_0x86be('0xa'),JSON[_0x86be('0xd')](_0x545c7b));if(_0x545c7b[_0x86be('0xe')]){if(_0x545c7b[_0x86be('0xe')]['code']===0x1f4){logger[_0x86be('0xe')](_0x86be('0x9'),_0x1de9a1,_0x545c7b[_0x86be('0xe')][_0x86be('0xf')]);return _0x54c9b6(_0x545c7b[_0x86be('0xe')][_0x86be('0xf')]);}logger[_0x86be('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x1de9a1,_0x545c7b[_0x86be('0xe')][_0x86be('0xf')]);return _0x3010d2(_0x545c7b[_0x86be('0xe')]['message']);}else{logger[_0x86be('0x10')](_0x86be('0x9'),_0x1de9a1,_0x86be('0xa'));_0x3010d2(_0x545c7b[_0x86be('0x11')][_0x86be('0xf')]);}})[_0x86be('0x12')](function(_0x536fdc){logger[_0x86be('0xe')](_0x86be('0x9'),_0x1de9a1,_0x536fdc);_0x54c9b6(_0x536fdc);});});}exports[_0x86be('0x13')]=function(_0x158c4d){var _0x47d50e=this;return new Promise(function(_0x121a99,_0x597e73){return db['SmsQueueReport'][_0x86be('0x14')](_0x158c4d[_0x86be('0x15')],{'raw':_0x158c4d[_0x86be('0x16')]?_0x158c4d[_0x86be('0x16')][_0x86be('0x17')]===undefined?!![]:![]:!![]})[_0x86be('0x8')](function(_0x424c87){logger[_0x86be('0x10')]('CreateSmsQueueReport',_0x158c4d);logger[_0x86be('0xb')](_0x86be('0x13'),_0x158c4d,JSON[_0x86be('0xd')](_0x424c87));_0x121a99(_0x424c87);})[_0x86be('0x12')](function(_0xa3ce7f){logger[_0x86be('0xe')](_0x86be('0x13'),_0xa3ce7f[_0x86be('0xf')],_0x158c4d);_0x597e73(_0x47d50e['error'](0x1f4,_0xa3ce7f[_0x86be('0xf')]));});});};exports['UpdateSmsQueueReport']=function(_0x3f0069){var _0x45d125=this;return new Promise(function(_0x17e6cb,_0x5e1b85){return db['SmsQueueReport'][_0x86be('0x18')](_0x3f0069[_0x86be('0x15')],{'raw':_0x3f0069[_0x86be('0x16')]?_0x3f0069[_0x86be('0x16')][_0x86be('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f0069[_0x86be('0x16')]?_0x3f0069[_0x86be('0x16')][_0x86be('0x19')]||null:null,'attributes':_0x3f0069[_0x86be('0x16')]?_0x3f0069[_0x86be('0x16')]['attributes']||null:null,'limit':_0x3f0069[_0x86be('0x16')]?_0x3f0069[_0x86be('0x16')]['limit']||null:null})['then'](function(_0x27ec65){logger['info'](_0x86be('0x1a'),_0x3f0069);logger[_0x86be('0xb')](_0x86be('0x1a'),_0x3f0069,JSON[_0x86be('0xd')](_0x27ec65));_0x17e6cb(_0x27ec65);})[_0x86be('0x12')](function(_0x5e1362){logger['error'](_0x86be('0x1a'),_0x5e1362[_0x86be('0xf')],_0x3f0069);_0x5e1b85(_0x45d125[_0x86be('0xe')](0x1f4,_0x5e1362['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 78640f8..df6d6f6 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 _0x6e6c=['get','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','/describe'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc6e6('0x4'));var config=require('../../config/environment');var controller=require(_0xc6e6('0x5'));router['get']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0x7')]);router['get'](_0xc6e6('0x8'),auth[_0xc6e6('0x6')](),controller['describe']);router[_0xc6e6('0x9')](_0xc6e6('0xa'),auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['post']('/',auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0xa'),auth[_0xc6e6('0x6')](),controller[_0xc6e6('0xe')]);router[_0xc6e6('0xf')](_0xc6e6('0xa'),auth[_0xc6e6('0x6')](),controller['destroy']);module[_0xc6e6('0x10')]=router; \ No newline at end of file +var _0x13f6=['post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','index','/:id','isAuthenticated','show'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x13f6,0x124));var _0x613f=function(_0x3243f9,_0x56a64b){_0x3243f9=_0x3243f9-0x0;var _0x3553f7=_0x13f6[_0x3243f9];return _0x3553f7;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var auth=require(_0x613f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x613f('0x5'));var controller=require(_0x613f('0x6'));router[_0x613f('0x7')]('/',auth['isAuthenticated'](),controller[_0x613f('0x8')]);router[_0x613f('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x613f('0x9'),auth[_0x613f('0xa')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/',auth['isAuthenticated'](),controller[_0x613f('0xd')]);router[_0x613f('0xe')](_0x613f('0x9'),auth['isAuthenticated'](),controller[_0x613f('0xf')]);router[_0x613f('0x10')](_0x613f('0x9'),auth['isAuthenticated'](),controller[_0x613f('0x11')]);module[_0x613f('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1e0fb42..7270476 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 _0x2895=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0xd77e22,_0x810874){var _0x4aef0f=function(_0x5e8582){while(--_0x5e8582){_0xd77e22['push'](_0xd77e22['shift']());}};_0x4aef0f(++_0x810874);}(_0x2895,0x198));var _0x5289=function(_0x3c16fa,_0x255c10){_0x3c16fa=_0x3c16fa-0x0;var _0x2f329a=_0x2895[_0x3c16fa];return _0x2f329a;};'use strict';var moment=require(_0x5289('0x0'));var Sequelize=require(_0x5289('0x1'));module[_0x5289('0x2')]={'uniqueid':{'type':Sequelize[_0x5289('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5289('0x4')](_0x5289('0x5'),_0x5289('0x6'),_0x5289('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x5289('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x5289('0x9')]}}; \ No newline at end of file +var _0xb405=['sequelize','exports','ENUM','account','agent','queue','DATE','NOW'];(function(_0x5f51d2,_0x4f0133){var _0x24bf08=function(_0x25e6b5){while(--_0x25e6b5){_0x5f51d2['push'](_0x5f51d2['shift']());}};_0x24bf08(++_0x4f0133);}(_0xb405,0x188));var _0x5b40=function(_0xf0884,_0x436054){_0xf0884=_0xf0884-0x0;var _0x1be9a8=_0xb405[_0xf0884];return _0x1be9a8;};'use strict';var moment=require('moment');var Sequelize=require(_0x5b40('0x0'));module[_0x5b40('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5b40('0x2')](_0x5b40('0x3'),_0x5b40('0x4'),_0x5b40('0x5')),'allowNull':![],'defaultValue':_0x5b40('0x5')},'transferredAt':{'type':Sequelize[_0x5b40('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x5b40('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index fea1da1..295ff3f 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 _0xa9e0=['merge','options','include','findAll','catch','params','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL'];(function(_0xfeca92,_0x42379b){var _0xdce620=function(_0xf7a8de){while(--_0xf7a8de){_0xfeca92['push'](_0xfeca92['shift']());}};_0xdce620(++_0x42379b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));};exports[_0x0a9e('0x45')]=function(_0x3fe430,_0x4f7240){return db['SmsTransferReport']['describe']()[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,null))[_0x0a9e('0x3f')](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x28fbca,_0x1df23d){var _0x9d69d3=function(_0x3e11e3){while(--_0x3e11e3){_0x28fbca['push'](_0x28fbca['shift']());}};_0x9d69d3(++_0x1df23d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['SmsTransferReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['SmsTransferReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index a581088..bd757b8 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 _0xa99c=['bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xa99c,0x15a));var _0xca99=function(_0x3949bd,_0x21356c){_0x3949bd=_0x3949bd-0x0;var _0x5003b7=_0xa99c[_0x3949bd];return _0x5003b7;};'use strict';var _=require(_0xca99('0x0'));var util=require(_0xca99('0x1'));var logger=require('../../config/logger')(_0xca99('0x2'));var moment=require(_0xca99('0x3'));var BPromise=require(_0xca99('0x4'));var rp=require(_0xca99('0x5'));var fs=require('fs');var path=require(_0xca99('0x6'));var rimraf=require('rimraf');var config=require(_0xca99('0x7'));var attributes=require(_0xca99('0x8'));module[_0xca99('0x9')]=function(_0x559665,_0x243187){return _0x559665[_0xca99('0xa')](_0xca99('0xb'),attributes,{'tableName':_0xca99('0xc'),'paranoid':![],'indexes':[{'name':_0xca99('0xd'),'fields':[_0xca99('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5ee=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x14f0a5,_0x1703e7){var _0x33eb9e=function(_0x4ca530){while(--_0x4ca530){_0x14f0a5['push'](_0x14f0a5['shift']());}};_0x33eb9e(++_0x1703e7);}(_0xa5ee,0x1a8));var _0xea5e=function(_0x162a06,_0x3094d7){_0x162a06=_0x162a06-0x0;var _0x32447b=_0xa5ee[_0x162a06];return _0x32447b;};'use strict';var _=require(_0xea5e('0x0'));var util=require(_0xea5e('0x1'));var logger=require(_0xea5e('0x2'))('api');var moment=require(_0xea5e('0x3'));var BPromise=require(_0xea5e('0x4'));var rp=require(_0xea5e('0x5'));var fs=require('fs');var path=require(_0xea5e('0x6'));var rimraf=require(_0xea5e('0x7'));var config=require(_0xea5e('0x8'));var attributes=require(_0xea5e('0x9'));module['exports']=function(_0x5e043c,_0x39d3fc){return _0x5e043c[_0xea5e('0xa')](_0xea5e('0xb'),attributes,{'tableName':_0xea5e('0xc'),'paranoid':![],'indexes':[{'name':_0xea5e('0xd'),'fields':[_0xea5e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 9504dfa..0f4cbe3 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 _0x9309=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9309,0x13b));var _0x9930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9309[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9930('0x0'));var util=require(_0x9930('0x1'));var moment=require(_0x9930('0x2'));var BPromise=require(_0x9930('0x3'));var rs=require(_0x9930('0x4'));var fs=require('fs');var Redis=require(_0x9930('0x5'));var db=require(_0x9930('0x6'))['db'];var utils=require(_0x9930('0x7'));var logger=require(_0x9930('0x8'))(_0x9930('0x9'));var config=require(_0x9930('0xa'));var jayson=require(_0x9930('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13d10f,_0x2ce40d,_0x2fbf39){return new BPromise(function(_0xbc0764,_0x4ccf98){return client[_0x9930('0xc')](_0x13d10f,_0x2fbf39)[_0x9930('0xd')](function(_0x3a95e5){logger[_0x9930('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x2ce40d,'request\x20sent');logger['debug'](_0x9930('0xf'),_0x2ce40d,_0x9930('0x10'),JSON[_0x9930('0x11')](_0x3a95e5));if(_0x3a95e5[_0x9930('0x12')]){if(_0x3a95e5[_0x9930('0x12')][_0x9930('0x13')]===0x1f4){logger[_0x9930('0x12')](_0x9930('0x14'),_0x2ce40d,_0x3a95e5['error'][_0x9930('0x15')]);return _0x4ccf98(_0x3a95e5[_0x9930('0x12')][_0x9930('0x15')]);}logger[_0x9930('0x12')](_0x9930('0x14'),_0x2ce40d,_0x3a95e5[_0x9930('0x12')]['message']);return _0xbc0764(_0x3a95e5['error'][_0x9930('0x15')]);}else{logger[_0x9930('0xe')](_0x9930('0x14'),_0x2ce40d,_0x9930('0x10'));_0xbc0764(_0x3a95e5[_0x9930('0x16')][_0x9930('0x15')]);}})[_0x9930('0x17')](function(_0xfe3900){logger[_0x9930('0x12')](_0x9930('0x14'),_0x2ce40d,_0xfe3900);_0x4ccf98(_0xfe3900);});});} \ No newline at end of file +var _0xc9d4=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x283c87,_0x545688){var _0xde4143=function(_0x187b8d){while(--_0x187b8d){_0x283c87['push'](_0x283c87['shift']());}};_0xde4143(++_0x545688);}(_0xc9d4,0x1c9));var _0x4c9d=function(_0x136e04,_0xe65b6b){_0x136e04=_0x136e04-0x0;var _0x52bfe2=_0xc9d4[_0x136e04];return _0x52bfe2;};'use strict';var _=require(_0x4c9d('0x0'));var util=require(_0x4c9d('0x1'));var moment=require(_0x4c9d('0x2'));var BPromise=require(_0x4c9d('0x3'));var rs=require(_0x4c9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c9d('0x5'))['db'];var utils=require(_0x4c9d('0x6'));var logger=require(_0x4c9d('0x7'))(_0x4c9d('0x8'));var config=require(_0x4c9d('0x9'));var jayson=require(_0x4c9d('0xa'));var client=jayson[_0x4c9d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10e13e,_0xbcfcc0,_0x409f83){return new BPromise(function(_0x3af4dc,_0x5284f7){return client[_0x4c9d('0xc')](_0x10e13e,_0x409f83)[_0x4c9d('0xd')](function(_0x2a64d1){logger['info'](_0x4c9d('0xe'),_0xbcfcc0,_0x4c9d('0xf'));logger[_0x4c9d('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xbcfcc0,'request\x20sent',JSON[_0x4c9d('0x11')](_0x2a64d1));if(_0x2a64d1[_0x4c9d('0x12')]){if(_0x2a64d1[_0x4c9d('0x12')]['code']===0x1f4){logger[_0x4c9d('0x12')](_0x4c9d('0xe'),_0xbcfcc0,_0x2a64d1[_0x4c9d('0x12')][_0x4c9d('0x13')]);return _0x5284f7(_0x2a64d1[_0x4c9d('0x12')][_0x4c9d('0x13')]);}logger[_0x4c9d('0x12')](_0x4c9d('0xe'),_0xbcfcc0,_0x2a64d1['error'][_0x4c9d('0x13')]);return _0x3af4dc(_0x2a64d1[_0x4c9d('0x12')][_0x4c9d('0x13')]);}else{logger[_0x4c9d('0x14')](_0x4c9d('0xe'),_0xbcfcc0,_0x4c9d('0xf'));_0x3af4dc(_0x2a64d1[_0x4c9d('0x15')]['message']);}})[_0x4c9d('0x16')](function(_0x305bd2){logger[_0x4c9d('0x12')](_0x4c9d('0xe'),_0xbcfcc0,_0x305bd2);_0x5284f7(_0x305bd2);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index ad65668..3235cd7 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 _0xc0fb=['create','put','/:id','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc0fb,0xa6));var _0xbc0f=function(_0x1d6937,_0x20904b){_0x1d6937=_0x1d6937-0x0;var _0x35b5a4=_0xc0fb[_0x1d6937];return _0x35b5a4;};'use strict';var multer=require(_0xbc0f('0x0'));var util=require(_0xbc0f('0x1'));var path=require(_0xbc0f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbc0f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbc0f('0x4'));var config=require(_0xbc0f('0x5'));var controller=require(_0xbc0f('0x6'));router[_0xbc0f('0x7')]('/',auth[_0xbc0f('0x8')](),controller['index']);router[_0xbc0f('0x7')]('/:id',auth[_0xbc0f('0x8')](),controller[_0xbc0f('0x9')]);router['get'](_0xbc0f('0xa'),auth['isAuthenticated'](),controller[_0xbc0f('0xb')]);var upload=multer({'storage':multer[_0xbc0f('0xc')]({'destination':function(_0x235a37,_0xe2b208,_0x570c12){_0x570c12(null,path[_0xbc0f('0xd')](config[_0xbc0f('0xe')],_0xbc0f('0xf')));},'filename':function(_0x3c2403,_0x27eb6c,_0x5246dc){_0x27eb6c[_0xbc0f('0x10')]=_0x27eb6c['originalname'][_0xbc0f('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5246dc(null,util[_0xbc0f('0x12')](_0xbc0f('0x13'),path[_0xbc0f('0x14')](_0x27eb6c['originalname'],path[_0xbc0f('0x15')](_0x27eb6c[_0xbc0f('0x10')])),Date[_0xbc0f('0x16')](),path['extname'](_0x27eb6c[_0xbc0f('0x10')])));}})});router[_0xbc0f('0x17')]('/',upload[_0xbc0f('0x18')](_0xbc0f('0x19')),controller[_0xbc0f('0x1a')]);router[_0xbc0f('0x1b')](_0xbc0f('0x1c'),auth[_0xbc0f('0x8')](),controller[_0xbc0f('0x1d')]);router[_0xbc0f('0x1e')]('/:id',auth[_0xbc0f('0x8')](),controller['delete']);module[_0xbc0f('0x1f')]=router; \ No newline at end of file +var _0x5bb8=['download','diskStorage','root','originalname','replace','format','%s-%s%s','extname','now','create','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bb8,0x15d));var _0x85bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5bb8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x85bb('0x0'));var util=require('util');var path=require(_0x85bb('0x1'));var timeout=require(_0x85bb('0x2'));var express=require('express');var router=express[_0x85bb('0x3')]();var auth=require(_0x85bb('0x4'));var interaction=require(_0x85bb('0x5'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x85bb('0x6')]('/',auth[_0x85bb('0x7')](),controller[_0x85bb('0x8')]);router[_0x85bb('0x6')](_0x85bb('0x9'),auth[_0x85bb('0x7')](),controller[_0x85bb('0xa')]);router[_0x85bb('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x85bb('0xb')]);var upload=multer({'storage':multer[_0x85bb('0xc')]({'destination':function(_0x354973,_0x3a4f22,_0x463bf7){_0x463bf7(null,path['join'](config[_0x85bb('0xd')],'server/files/sounds/original/'));},'filename':function(_0x56bfdd,_0x78b0e5,_0x50537a){_0x78b0e5[_0x85bb('0xe')]=_0x78b0e5['originalname'][_0x85bb('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x50537a(null,util[_0x85bb('0x10')](_0x85bb('0x11'),path['basename'](_0x78b0e5[_0x85bb('0xe')],path[_0x85bb('0x12')](_0x78b0e5[_0x85bb('0xe')])),Date[_0x85bb('0x13')](),path[_0x85bb('0x12')](_0x78b0e5[_0x85bb('0xe')])));}})});router['post']('/',upload['single']('file'),controller[_0x85bb('0x14')]);router['put'](_0x85bb('0x9'),auth[_0x85bb('0x7')](),controller[_0x85bb('0x15')]);router[_0x85bb('0x16')](_0x85bb('0x9'),auth[_0x85bb('0x7')](),controller['delete']);module[_0x85bb('0x17')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 16beebe..3c59efa 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 _0x0e5f=['sequelize','exports','STRING','name','INTEGER','BIGINT'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x0e5f,0x1f2));var _0xf0e5=function(_0x1e8ba8,_0x3c6f20){_0x1e8ba8=_0x1e8ba8-0x0;var _0x57df43=_0x0e5f[_0x1e8ba8];return _0x57df43;};'use strict';var Sequelize=require(_0xf0e5('0x0'));module[_0xf0e5('0x1')]={'name':{'type':Sequelize[_0xf0e5('0x2')],'unique':_0xf0e5('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf0e5('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf0e5('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xf0e5('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xf0e5('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xf0e5('0x5')]},'converted_channelCount':{'type':Sequelize[_0xf0e5('0x4')]},'converted_bitRate':{'type':Sequelize[_0xf0e5('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1860=['INTEGER','exports','STRING','FLOAT','BIGINT'];(function(_0x139845,_0x7b8d0e){var _0x549c8f=function(_0x4d7078){while(--_0x4d7078){_0x139845['push'](_0x139845['shift']());}};_0x549c8f(++_0x7b8d0e);}(_0x1860,0xe2));var _0x0186=function(_0x4337f8,_0x36c050){_0x4337f8=_0x4337f8-0x0;var _0x2ec301=_0x1860[_0x4337f8];return _0x2ec301;};'use strict';var Sequelize=require('sequelize');module[_0x0186('0x0')]={'name':{'type':Sequelize[_0x0186('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x0186('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x0186('0x1')]},'original_format':{'type':Sequelize[_0x0186('0x1')]},'original_duration':{'type':Sequelize[_0x0186('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x0186('0x3')]},'original_sampleRate':{'type':Sequelize[_0x0186('0x4')]},'converted_format':{'type':Sequelize[_0x0186('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x0186('0x3')]},'converted_channelCount':{'type':Sequelize[_0x0186('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x0186('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index a902bde..67ebe58 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 _0x0428=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Sounds','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','rows','catch','show','length','find','params','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','unlinkSync','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0428,0xed));var _0x8042=function(_0x2eaed1,_0x18a888){_0x2eaed1=_0x2eaed1-0x0;var _0x2bd6b5=_0x0428[_0x2eaed1];return _0x2bd6b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8042('0x0'));var rimraf=require(_0x8042('0x1'));var zipdir=require(_0x8042('0x2'));var jsonpatch=require(_0x8042('0x3'));var rp=require(_0x8042('0x4'));var moment=require(_0x8042('0x5'));var BPromise=require(_0x8042('0x6'));var Mustache=require(_0x8042('0x7'));var util=require(_0x8042('0x8'));var path=require(_0x8042('0x9'));var sox=require(_0x8042('0xa'));var csv=require(_0x8042('0xb'));var ejs=require(_0x8042('0xc'));var fs=require('fs');var _=require(_0x8042('0xd'));var squel=require(_0x8042('0xe'));var crypto=require('crypto');var jsforce=require(_0x8042('0xf'));var deskjs=require(_0x8042('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8042('0x11'));var Papa=require(_0x8042('0x12'));var Redis=require(_0x8042('0x13'));var authService=require(_0x8042('0x14'));var qs=require(_0x8042('0x15'));var as=require(_0x8042('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8042('0x17'));var config=require(_0x8042('0x18'));var db=require(_0x8042('0x19'))['db'];function respondWithStatusCode(_0x4815af,_0x3f3f5b){_0x3f3f5b=_0x3f3f5b||0xcc;return function(_0x408b6b){if(_0x408b6b){return _0x4815af[_0x8042('0x1a')](_0x3f3f5b);}return _0x4815af['status'](_0x3f3f5b)[_0x8042('0x1b')]();};}function respondWithResult(_0x5566f,_0x2b8240){_0x2b8240=_0x2b8240||0xc8;return function(_0x3e7dd9){if(_0x3e7dd9){return _0x5566f[_0x8042('0x1c')](_0x2b8240)[_0x8042('0x1d')](_0x3e7dd9);}};}function respondWithFilteredResult(_0x5196e0,_0x1dedd8){return function(_0x50e9dd){if(_0x50e9dd){var _0x28dcd8=_0x50e9dd[_0x8042('0x1e')],_0x380c0f=_0x1dedd8[_0x8042('0x1f')],_0x22cd2a=_0x1dedd8[_0x8042('0x1f')]+_0x1dedd8['limit'],_0x37cc2a;if(_0x22cd2a>=_0x28dcd8){_0x22cd2a=_0x28dcd8;_0x37cc2a=0xc8;}else{_0x37cc2a=0xce;}_0x5196e0[_0x8042('0x1c')](_0x37cc2a);return _0x5196e0[_0x8042('0x20')](_0x8042('0x21'),_0x380c0f+'-'+_0x22cd2a+'/'+_0x28dcd8)[_0x8042('0x1d')](_0x50e9dd);}return null;};}function patchUpdates(_0x141724){return function(_0xed5e30){try{jsonpatch[_0x8042('0x22')](_0xed5e30,_0x141724,!![]);}catch(_0x1c8da8){return BPromise[_0x8042('0x23')](_0x1c8da8);}return _0xed5e30[_0x8042('0x24')]();};}function saveUpdates(_0x307df7,_0x2b4b22){return function(_0x1cfae6){if(_0x1cfae6){return _0x1cfae6['update'](_0x307df7)[_0x8042('0x25')](function(_0x4958a6){return _0x4958a6;});}return null;};}function removeEntity(_0x287490,_0x5c3a74){return function(_0x2e827a){if(_0x2e827a){return _0x2e827a[_0x8042('0x26')]()[_0x8042('0x25')](function(){var _0x29e5f1=_0x2e827a[_0x8042('0x27')]({'plain':!![]});var _0x4fd53e=_0x8042('0x28');return db[_0x8042('0x29')][_0x8042('0x26')]({'where':{'type':_0x4fd53e,'resourceId':_0x29e5f1['id']}})[_0x8042('0x25')](function(){return _0x2e827a;});})['then'](function(){_0x287490[_0x8042('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59394c,_0x33a9c9){return function(_0x1f7dd7){if(!_0x1f7dd7){_0x59394c[_0x8042('0x1a')](0x194);}return _0x1f7dd7;};}function handleError(_0x20da36,_0x296b27){_0x296b27=_0x296b27||0x1f4;return function(_0x312fcd){logger['error'](_0x312fcd['stack']);if(_0x312fcd[_0x8042('0x2a')]){delete _0x312fcd[_0x8042('0x2a')];}_0x20da36[_0x8042('0x1c')](_0x296b27)[_0x8042('0x2b')](_0x312fcd);};}exports[_0x8042('0x2c')]=function(_0x337000,_0x677810){var _0x66096={},_0x8aeca1={},_0x504165={'count':0x0,'rows':[]};var _0x3a0ae7=_[_0x8042('0x2d')](db['Sound'][_0x8042('0x2e')],function(_0x53586a){return{'name':_0x53586a[_0x8042('0x2f')],'type':_0x53586a[_0x8042('0x30')][_0x8042('0x31')]};});_0x8aeca1[_0x8042('0x32')]=_[_0x8042('0x2d')](_0x3a0ae7,_0x8042('0x2a'));_0x8aeca1[_0x8042('0x33')]=_[_0x8042('0x34')](_0x337000[_0x8042('0x33')]);_0x8aeca1[_0x8042('0x35')]=_[_0x8042('0x36')](_0x8aeca1[_0x8042('0x32')],_0x8aeca1[_0x8042('0x33')]);_0x66096[_0x8042('0x37')]=_[_0x8042('0x36')](_0x8aeca1[_0x8042('0x32')],qs['fields'](_0x337000[_0x8042('0x33')][_0x8042('0x38')]));_0x66096[_0x8042('0x37')]=_0x66096[_0x8042('0x37')]['length']?_0x66096[_0x8042('0x37')]:_0x8aeca1['model'];if(!_0x337000[_0x8042('0x33')]['hasOwnProperty'](_0x8042('0x39'))){_0x66096[_0x8042('0x3a')]=qs[_0x8042('0x3a')](_0x337000[_0x8042('0x33')][_0x8042('0x3a')]);_0x66096['offset']=qs['offset'](_0x337000[_0x8042('0x33')][_0x8042('0x1f')]);}_0x66096['order']=qs[_0x8042('0x3b')](_0x337000[_0x8042('0x33')][_0x8042('0x3b')]);_0x66096[_0x8042('0x3c')]=qs['filters'](_[_0x8042('0x3d')](_0x337000['query'],_0x8aeca1[_0x8042('0x35')]),_0x3a0ae7);if(_0x337000[_0x8042('0x33')][_0x8042('0x3e')]){_0x66096[_0x8042('0x3c')]=_[_0x8042('0x3f')](_0x66096['where'],{'$or':_['map'](_0x3a0ae7,function(_0x110f9b){if(_0x110f9b[_0x8042('0x30')]!==_0x8042('0x40')){var _0x960cef={};_0x960cef[_0x110f9b[_0x8042('0x2a')]]={'$like':'%'+_0x337000[_0x8042('0x33')][_0x8042('0x3e')]+'%'};return _0x960cef;}})});}_0x66096=_[_0x8042('0x3f')]({},_0x66096,_0x337000[_0x8042('0x41')]);var _0x371120={'where':_0x66096['where']};return db[_0x8042('0x42')]['count'](_0x371120)[_0x8042('0x25')](function(_0x5a835e){_0x504165[_0x8042('0x1e')]=_0x5a835e;if(_0x337000[_0x8042('0x33')][_0x8042('0x43')]){_0x66096[_0x8042('0x44')]=[{'all':!![]}];}return db['Sound'][_0x8042('0x45')](_0x66096);})[_0x8042('0x25')](function(_0x456363){_0x504165[_0x8042('0x46')]=_0x456363;return _0x504165;})[_0x8042('0x25')](respondWithFilteredResult(_0x677810,_0x66096))[_0x8042('0x47')](handleError(_0x677810,null));};exports[_0x8042('0x48')]=function(_0x47e15c,_0x29f03f){var _0x311084={'raw':!![],'where':{'id':_0x47e15c['params']['id']}},_0x2c007f={};_0x2c007f['model']=_[_0x8042('0x34')](db[_0x8042('0x42')][_0x8042('0x2e')]);_0x2c007f[_0x8042('0x33')]=_[_0x8042('0x34')](_0x47e15c[_0x8042('0x33')]);_0x2c007f[_0x8042('0x35')]=_['intersection'](_0x2c007f[_0x8042('0x32')],_0x2c007f['query']);_0x311084['attributes']=_[_0x8042('0x36')](_0x2c007f[_0x8042('0x32')],qs[_0x8042('0x38')](_0x47e15c[_0x8042('0x33')]['fields']));_0x311084[_0x8042('0x37')]=_0x311084[_0x8042('0x37')][_0x8042('0x49')]?_0x311084[_0x8042('0x37')]:_0x2c007f[_0x8042('0x32')];if(_0x47e15c[_0x8042('0x33')][_0x8042('0x43')]){_0x311084['include']=[{'all':!![]}];}_0x311084=_[_0x8042('0x3f')]({},_0x311084,_0x47e15c['options']);return db[_0x8042('0x42')]['find'](_0x311084)[_0x8042('0x25')](handleEntityNotFound(_0x29f03f,null))[_0x8042('0x25')](respondWithResult(_0x29f03f,null))[_0x8042('0x47')](handleError(_0x29f03f,null));};exports['download']=function(_0x328519,_0x29cdc6,_0x30370c){return db[_0x8042('0x42')][_0x8042('0x4a')]({'where':{'id':_0x328519[_0x8042('0x4b')]['id']},'attributes':[_0x8042('0x2a'),_0x8042('0x4c'),_0x8042('0x4d')],'raw':!![]})[_0x8042('0x25')](handleEntityNotFound(_0x29cdc6,null))[_0x8042('0x25')](function(_0x355135){if(_0x355135){if(!fs[_0x8042('0x4e')](path[_0x8042('0x4f')](config['root'],_0x8042('0x50'),_0x355135[_0x8042('0x4c')]+'.'+_0x355135['converted_format']))){throw new db[(_0x8042('0x51'))][(_0x8042('0x52'))](_0x8042('0x53'));}return _0x29cdc6[_0x8042('0x54')](path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x50'),util[_0x8042('0x56')](_0x8042('0x57'),_0x355135[_0x8042('0x4c')],_0x355135[_0x8042('0x4d')])),util[_0x8042('0x56')](_0x8042('0x57'),_0x355135[_0x8042('0x2a')],_0x355135['converted_format']));}return null;})[_0x8042('0x47')](handleError(_0x29cdc6,null));};exports['create']=function(_0x1158c7,_0x9b94a5,_0x4c0714){var _0x3944a1={'name':path[_0x8042('0x58')](_0x1158c7[_0x8042('0x59')]['originalname'],path['extname'](_0x1158c7['file'][_0x8042('0x5a')])),'save_name':path['basename'](_0x1158c7['file'][_0x8042('0x5b')],path[_0x8042('0x5c')](_0x1158c7[_0x8042('0x59')][_0x8042('0x5b')])),'original_format':path[_0x8042('0x5c')](_0x1158c7[_0x8042('0x59')]['originalname'])[_0x8042('0x5d')](0x1),'converted_format':_0x8042('0x5e')};var _0x1cbfb2=path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x5f'),_0x1158c7[_0x8042('0x59')]['filename']);var _0x2a8beb=path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x50'),util[_0x8042('0x56')]('%s.%s',path[_0x8042('0x58')](_0x1158c7[_0x8042('0x59')][_0x8042('0x5b')],path['extname'](_0x1158c7[_0x8042('0x59')]['filename'])),_0x3944a1[_0x8042('0x4d')]));logger[_0x8042('0x60')](_0x8042('0x61'),_0x1cbfb2);logger[_0x8042('0x60')](_0x8042('0x62'),_0x2a8beb);try{fs[_0x8042('0x63')](_0x1cbfb2,parseInt(_0x8042('0x64'),0x8));var _0x16b111=sox['transcode'](_0x1cbfb2,_0x2a8beb,{'sampleRate':0x1f40,'format':_0x8042('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x16b111['on'](_0x8042('0x65'),function(_0x18a9a9){fs['unlinkSync'](_0x1cbfb2);_0x9b94a5[_0x8042('0x1c')](0x1f4)[_0x8042('0x2b')](_0x18a9a9);});_0x16b111['on'](_0x8042('0x66'),function(_0x3ae2cf){_0x3944a1['original_duration']=isNaN(_0x3ae2cf['duration'])?null:_0x3ae2cf[_0x8042('0x67')]*0x3e8;_0x3944a1['original_sampleCount']=isNaN(_0x3ae2cf[_0x8042('0x68')])?null:_0x3ae2cf[_0x8042('0x68')];_0x3944a1[_0x8042('0x69')]=isNaN(_0x3ae2cf['channelCount'])?null:_0x3ae2cf[_0x8042('0x6a')];_0x3944a1[_0x8042('0x6b')]=isNaN(_0x3ae2cf[_0x8042('0x6c')])?null:_0x3ae2cf['bitRate'];_0x3944a1[_0x8042('0x6d')]=isNaN(_0x3ae2cf[_0x8042('0x6e')])?null:_0x3ae2cf[_0x8042('0x6e')];});_0x16b111['on'](_0x8042('0x6f'),function(_0x275738){_0x3944a1[_0x8042('0x70')]=isNaN(_0x275738[_0x8042('0x67')])?null:_0x275738['duration']*0x3e8;_0x3944a1[_0x8042('0x71')]=isNaN(_0x275738[_0x8042('0x68')])?null:_0x275738[_0x8042('0x68')];_0x3944a1[_0x8042('0x72')]=isNaN(_0x275738[_0x8042('0x6a')])?null:_0x275738[_0x8042('0x6a')];_0x3944a1[_0x8042('0x73')]=isNaN(_0x275738[_0x8042('0x6c')])?null:_0x275738[_0x8042('0x6c')];_0x3944a1[_0x8042('0x74')]=isNaN(_0x275738[_0x8042('0x6e')])?null:_0x275738[_0x8042('0x6e')];});_0x16b111['on']('end',function(){fs[_0x8042('0x63')](_0x2a8beb,parseInt(_0x8042('0x64'),0x8));return db[_0x8042('0x42')]['create'](_0x3944a1)[_0x8042('0x25')](function(_0x1465a4){var _0x35541b={'role':_0x1158c7[_0x8042('0x75')][_0x8042('0x76')],'userProfileId':_0x1158c7[_0x8042('0x75')][_0x8042('0x77')]};if(!_0x35541b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35541b[_0x8042('0x76')]===_0x8042('0x78')){var _0x157888=_0x1465a4[_0x8042('0x27')]({'plain':!![]});return db[_0x8042('0x79')][_0x8042('0x4a')]({'where':{'name':_0x8042('0x28'),'userProfileId':_0x35541b[_0x8042('0x77')]},'raw':!![]})[_0x8042('0x25')](function(_0x68c747){if(_0x68c747&&_0x68c747[_0x8042('0x7a')]===0x0){return db[_0x8042('0x29')]['create']({'name':_0x157888['name'],'resourceId':_0x157888['id'],'type':_0x68c747[_0x8042('0x2a')],'sectionId':_0x68c747['id']},{})[_0x8042('0x25')](function(){return _0x1465a4;});}else{return _0x1465a4;}})[_0x8042('0x47')](function(_0x5e71f8){logger[_0x8042('0x65')](_0x8042('0x7b'),_0x5e71f8);throw _0x5e71f8;});}return _0x1465a4;})[_0x8042('0x25')](respondWithResult(_0x9b94a5,null))[_0x8042('0x47')](handleError(_0x9b94a5,null));});_0x16b111[_0x8042('0x7c')]();}catch(_0x512489){_0x9b94a5['status'](0x1f4)[_0x8042('0x2b')](_0x512489);}};exports[_0x8042('0x7d')]=function(_0x2fd40f,_0x19e273,_0x47b512){return db[_0x8042('0x42')][_0x8042('0x4a')]({'where':{'id':_0x2fd40f[_0x8042('0x4b')]['id']}})[_0x8042('0x25')](handleEntityNotFound(_0x19e273,null))['then'](saveUpdates(_[_0x8042('0x3d')](_0x2fd40f[_0x8042('0x75')],[_0x8042('0x2a'),_0x8042('0x7e')]),null))[_0x8042('0x25')](respondWithResult(_0x19e273,null))[_0x8042('0x47')](handleError(_0x19e273,null));};exports[_0x8042('0x7f')]=function(_0x4d10f1,_0x48bee5,_0xa58f41){return db['Sound'][_0x8042('0x4a')]({'where':{'id':_0x4d10f1[_0x8042('0x4b')]['id']}})[_0x8042('0x25')](function(_0x2dd2df){if(_0x2dd2df){return _0x2dd2df[_0x8042('0x26')]();}})[_0x8042('0x25')](function(_0x674855){var _0x3259c4=path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x5f'),util['format']('%s.%s',_0x674855[_0x8042('0x4c')],_0x674855[_0x8042('0x80')]));var _0x506723=path[_0x8042('0x4f')](config[_0x8042('0x55')],_0x8042('0x50'),util[_0x8042('0x56')]('%s.%s',_0x674855[_0x8042('0x4c')],_0x674855[_0x8042('0x4d')]));fs[_0x8042('0x81')](_0x3259c4);fs[_0x8042('0x81')](_0x506723);return _0x674855;})[_0x8042('0x25')](function(_0x8d5b0d){if(_0x8d5b0d){return _0x48bee5[_0x8042('0x1c')](0xcc)[_0x8042('0x1b')]();}})['then'](handleEntityNotFound(_0x48bee5,null))['catch'](handleError(_0x48bee5,null));}; \ No newline at end of file +var _0x48b1=['create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','wav','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format'];(function(_0x189d3c,_0x5efebf){var _0x485959=function(_0x1161da){while(--_0x1161da){_0x189d3c['push'](_0x189d3c['shift']());}};_0x485959(++_0x5efebf);}(_0x48b1,0x197));var _0x148b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48b1[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x148b('0x0'));var jsonpatch=require(_0x148b('0x1'));var rp=require(_0x148b('0x2'));var moment=require(_0x148b('0x3'));var BPromise=require(_0x148b('0x4'));var Mustache=require(_0x148b('0x5'));var util=require(_0x148b('0x6'));var path=require(_0x148b('0x7'));var sox=require(_0x148b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x148b('0x9'));var squel=require(_0x148b('0xa'));var crypto=require(_0x148b('0xb'));var jsforce=require(_0x148b('0xc'));var deskjs=require(_0x148b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x148b('0xe'));var Papa=require('papaparse');var Redis=require(_0x148b('0xf'));var authService=require(_0x148b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x148b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x148b('0x12'));var utils=require(_0x148b('0x13'));var config=require(_0x148b('0x14'));var db=require(_0x148b('0x15'))['db'];function respondWithStatusCode(_0x42b719,_0x4b6ecb){_0x4b6ecb=_0x4b6ecb||0xcc;return function(_0x43c99d){if(_0x43c99d){return _0x42b719[_0x148b('0x16')](_0x4b6ecb);}return _0x42b719[_0x148b('0x17')](_0x4b6ecb)[_0x148b('0x18')]();};}function respondWithResult(_0x2ba0e6,_0x48f12b){_0x48f12b=_0x48f12b||0xc8;return function(_0x3f9a4b){if(_0x3f9a4b){return _0x2ba0e6[_0x148b('0x17')](_0x48f12b)[_0x148b('0x19')](_0x3f9a4b);}};}function respondWithFilteredResult(_0x15b2f1,_0x2ecaf2){return function(_0x16c4b6){if(_0x16c4b6){var _0x2b91d7=_0x16c4b6[_0x148b('0x1a')],_0x3852c9=_0x2ecaf2[_0x148b('0x1b')],_0x230f88=_0x2ecaf2['offset']+_0x2ecaf2[_0x148b('0x1c')],_0x4a33f1;if(_0x230f88>=_0x2b91d7){_0x230f88=_0x2b91d7;_0x4a33f1=0xc8;}else{_0x4a33f1=0xce;}_0x15b2f1['status'](_0x4a33f1);return _0x15b2f1['set']('Content-Range',_0x3852c9+'-'+_0x230f88+'/'+_0x2b91d7)[_0x148b('0x19')](_0x16c4b6);}return null;};}function patchUpdates(_0x2caa90){return function(_0x4b0938){try{jsonpatch[_0x148b('0x1d')](_0x4b0938,_0x2caa90,!![]);}catch(_0x454157){return BPromise['reject'](_0x454157);}return _0x4b0938['save']();};}function saveUpdates(_0x46209a,_0x1781f0){return function(_0x442cdc){if(_0x442cdc){return _0x442cdc[_0x148b('0x1e')](_0x46209a)[_0x148b('0x1f')](function(_0x3b48d2){return _0x3b48d2;});}return null;};}function removeEntity(_0x1fc2f8,_0x264d57){return function(_0x49cd84){if(_0x49cd84){return _0x49cd84[_0x148b('0x20')]()['then'](function(){var _0x269f23=_0x49cd84[_0x148b('0x21')]({'plain':!![]});var _0x4b7f15=_0x148b('0x22');return db[_0x148b('0x23')][_0x148b('0x20')]({'where':{'type':_0x4b7f15,'resourceId':_0x269f23['id']}})[_0x148b('0x1f')](function(){return _0x49cd84;});})[_0x148b('0x1f')](function(){_0x1fc2f8[_0x148b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31cf16,_0x41aca4){return function(_0x26a107){if(!_0x26a107){_0x31cf16[_0x148b('0x16')](0x194);}return _0x26a107;};}function handleError(_0x65b099,_0x164604){_0x164604=_0x164604||0x1f4;return function(_0x350d70){logger[_0x148b('0x24')](_0x350d70[_0x148b('0x25')]);if(_0x350d70[_0x148b('0x26')]){delete _0x350d70['name'];}_0x65b099[_0x148b('0x17')](_0x164604)[_0x148b('0x27')](_0x350d70);};}exports[_0x148b('0x28')]=function(_0x1c8dec,_0x3fef40){var _0x1e9dc9={},_0x499280={},_0x1cb1ca={'count':0x0,'rows':[]};var _0xa5a711=_[_0x148b('0x29')](db[_0x148b('0x2a')][_0x148b('0x2b')],function(_0x3f8ab0){return{'name':_0x3f8ab0[_0x148b('0x2c')],'type':_0x3f8ab0['type'][_0x148b('0x2d')]};});_0x499280[_0x148b('0x2e')]=_['map'](_0xa5a711,_0x148b('0x26'));_0x499280[_0x148b('0x2f')]=_['keys'](_0x1c8dec['query']);_0x499280[_0x148b('0x30')]=_['intersection'](_0x499280[_0x148b('0x2e')],_0x499280['query']);_0x1e9dc9[_0x148b('0x31')]=_[_0x148b('0x32')](_0x499280[_0x148b('0x2e')],qs[_0x148b('0x33')](_0x1c8dec[_0x148b('0x2f')][_0x148b('0x33')]));_0x1e9dc9[_0x148b('0x31')]=_0x1e9dc9[_0x148b('0x31')][_0x148b('0x34')]?_0x1e9dc9[_0x148b('0x31')]:_0x499280['model'];if(!_0x1c8dec[_0x148b('0x2f')][_0x148b('0x35')](_0x148b('0x36'))){_0x1e9dc9[_0x148b('0x1c')]=qs[_0x148b('0x1c')](_0x1c8dec[_0x148b('0x2f')]['limit']);_0x1e9dc9[_0x148b('0x1b')]=qs['offset'](_0x1c8dec[_0x148b('0x2f')][_0x148b('0x1b')]);}_0x1e9dc9['order']=qs[_0x148b('0x37')](_0x1c8dec[_0x148b('0x2f')][_0x148b('0x37')]);_0x1e9dc9[_0x148b('0x38')]=qs[_0x148b('0x30')](_[_0x148b('0x39')](_0x1c8dec[_0x148b('0x2f')],_0x499280[_0x148b('0x30')]),_0xa5a711);if(_0x1c8dec[_0x148b('0x2f')][_0x148b('0x3a')]){_0x1e9dc9[_0x148b('0x38')]=_[_0x148b('0x3b')](_0x1e9dc9[_0x148b('0x38')],{'$or':_[_0x148b('0x29')](_0xa5a711,function(_0x378aec){if(_0x378aec[_0x148b('0x3c')]!==_0x148b('0x3d')){var _0x8b780c={};_0x8b780c[_0x378aec[_0x148b('0x26')]]={'$like':'%'+_0x1c8dec['query'][_0x148b('0x3a')]+'%'};return _0x8b780c;}})});}_0x1e9dc9=_[_0x148b('0x3b')]({},_0x1e9dc9,_0x1c8dec['options']);var _0x59d0fb={'where':_0x1e9dc9[_0x148b('0x38')]};return db[_0x148b('0x2a')]['count'](_0x59d0fb)[_0x148b('0x1f')](function(_0x3c1d53){_0x1cb1ca[_0x148b('0x1a')]=_0x3c1d53;if(_0x1c8dec[_0x148b('0x2f')][_0x148b('0x3e')]){_0x1e9dc9[_0x148b('0x3f')]=[{'all':!![]}];}return db[_0x148b('0x2a')]['findAll'](_0x1e9dc9);})[_0x148b('0x1f')](function(_0x4a2eed){_0x1cb1ca[_0x148b('0x40')]=_0x4a2eed;return _0x1cb1ca;})[_0x148b('0x1f')](respondWithFilteredResult(_0x3fef40,_0x1e9dc9))[_0x148b('0x41')](handleError(_0x3fef40,null));};exports[_0x148b('0x42')]=function(_0x187cc3,_0x52e7c0){var _0x1828f9={'raw':!![],'where':{'id':_0x187cc3[_0x148b('0x43')]['id']}},_0x29e81d={};_0x29e81d[_0x148b('0x2e')]=_[_0x148b('0x44')](db[_0x148b('0x2a')][_0x148b('0x2b')]);_0x29e81d[_0x148b('0x2f')]=_[_0x148b('0x44')](_0x187cc3[_0x148b('0x2f')]);_0x29e81d['filters']=_['intersection'](_0x29e81d['model'],_0x29e81d[_0x148b('0x2f')]);_0x1828f9[_0x148b('0x31')]=_[_0x148b('0x32')](_0x29e81d[_0x148b('0x2e')],qs['fields'](_0x187cc3[_0x148b('0x2f')]['fields']));_0x1828f9[_0x148b('0x31')]=_0x1828f9[_0x148b('0x31')][_0x148b('0x34')]?_0x1828f9['attributes']:_0x29e81d[_0x148b('0x2e')];if(_0x187cc3[_0x148b('0x2f')][_0x148b('0x3e')]){_0x1828f9['include']=[{'all':!![]}];}_0x1828f9=_[_0x148b('0x3b')]({},_0x1828f9,_0x187cc3[_0x148b('0x45')]);return db[_0x148b('0x2a')][_0x148b('0x46')](_0x1828f9)[_0x148b('0x1f')](handleEntityNotFound(_0x52e7c0,null))[_0x148b('0x1f')](respondWithResult(_0x52e7c0,null))['catch'](handleError(_0x52e7c0,null));};exports[_0x148b('0x47')]=function(_0x38a06a,_0x299b85,_0x412205){return db[_0x148b('0x2a')][_0x148b('0x46')]({'where':{'id':_0x38a06a['params']['id']},'attributes':[_0x148b('0x26'),_0x148b('0x48'),_0x148b('0x49')],'raw':!![]})[_0x148b('0x1f')](handleEntityNotFound(_0x299b85,null))[_0x148b('0x1f')](function(_0x15d177){if(_0x15d177){if(!fs[_0x148b('0x4a')](path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x4d'),_0x15d177[_0x148b('0x48')]+'.'+_0x15d177['converted_format']))){throw new db[(_0x148b('0x4e'))]['ValidationError'](_0x148b('0x4f'));}return _0x299b85['download'](path[_0x148b('0x4b')](config[_0x148b('0x4c')],'server/files/sounds/converted',util['format']('%s.%s',_0x15d177['save_name'],_0x15d177[_0x148b('0x49')])),util[_0x148b('0x50')]('%s.%s',_0x15d177[_0x148b('0x26')],_0x15d177[_0x148b('0x49')]));}return null;})[_0x148b('0x41')](handleError(_0x299b85,null));};exports[_0x148b('0x51')]=function(_0xab8f37,_0x34662e,_0x25c101){var _0x229a5d={'name':path[_0x148b('0x52')](_0xab8f37[_0x148b('0x53')][_0x148b('0x54')],path[_0x148b('0x55')](_0xab8f37[_0x148b('0x53')][_0x148b('0x54')])),'save_name':path[_0x148b('0x52')](_0xab8f37[_0x148b('0x53')][_0x148b('0x56')],path[_0x148b('0x55')](_0xab8f37[_0x148b('0x53')][_0x148b('0x56')])),'original_format':path[_0x148b('0x55')](_0xab8f37['file'][_0x148b('0x54')])[_0x148b('0x57')](0x1),'converted_format':'wav'};var _0x3cd204=path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x58'),_0xab8f37['file'][_0x148b('0x56')]);var _0x123abe=path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x4d'),util['format'](_0x148b('0x59'),path[_0x148b('0x52')](_0xab8f37[_0x148b('0x53')][_0x148b('0x56')],path[_0x148b('0x55')](_0xab8f37[_0x148b('0x53')]['filename'])),_0x229a5d['converted_format']));logger[_0x148b('0x5a')](_0x148b('0x5b'),_0x3cd204);logger[_0x148b('0x5a')](_0x148b('0x5c'),_0x123abe);try{fs[_0x148b('0x5d')](_0x3cd204,parseInt('0777',0x8));var _0x2b1b6c=sox['transcode'](_0x3cd204,_0x123abe,{'sampleRate':0x1f40,'format':_0x148b('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2b1b6c['on'](_0x148b('0x24'),function(_0x16dbc4){fs[_0x148b('0x5f')](_0x3cd204);_0x34662e['status'](0x1f4)['send'](_0x16dbc4);});_0x2b1b6c['on'](_0x148b('0x60'),function(_0x5b44cc){_0x229a5d['original_duration']=isNaN(_0x5b44cc['duration'])?null:_0x5b44cc[_0x148b('0x61')]*0x3e8;_0x229a5d[_0x148b('0x62')]=isNaN(_0x5b44cc[_0x148b('0x63')])?null:_0x5b44cc[_0x148b('0x63')];_0x229a5d[_0x148b('0x64')]=isNaN(_0x5b44cc[_0x148b('0x65')])?null:_0x5b44cc[_0x148b('0x65')];_0x229a5d['original_bitRate']=isNaN(_0x5b44cc[_0x148b('0x66')])?null:_0x5b44cc[_0x148b('0x66')];_0x229a5d[_0x148b('0x67')]=isNaN(_0x5b44cc[_0x148b('0x68')])?null:_0x5b44cc['sampleRate'];});_0x2b1b6c['on'](_0x148b('0x69'),function(_0x55a3bf){_0x229a5d[_0x148b('0x6a')]=isNaN(_0x55a3bf['duration'])?null:_0x55a3bf[_0x148b('0x61')]*0x3e8;_0x229a5d[_0x148b('0x6b')]=isNaN(_0x55a3bf[_0x148b('0x63')])?null:_0x55a3bf['sampleCount'];_0x229a5d[_0x148b('0x6c')]=isNaN(_0x55a3bf[_0x148b('0x65')])?null:_0x55a3bf[_0x148b('0x65')];_0x229a5d[_0x148b('0x6d')]=isNaN(_0x55a3bf[_0x148b('0x66')])?null:_0x55a3bf[_0x148b('0x66')];_0x229a5d[_0x148b('0x6e')]=isNaN(_0x55a3bf[_0x148b('0x68')])?null:_0x55a3bf['sampleRate'];});_0x2b1b6c['on'](_0x148b('0x18'),function(){fs[_0x148b('0x5d')](_0x123abe,parseInt(_0x148b('0x6f'),0x8));return db[_0x148b('0x2a')][_0x148b('0x51')](_0x229a5d)[_0x148b('0x1f')](function(_0x382949){var _0x5b3362={'role':_0xab8f37[_0x148b('0x70')][_0x148b('0x71')],'userProfileId':_0xab8f37[_0x148b('0x70')]['userProfileId']};if(!_0x5b3362)throw new Error(_0x148b('0x72'));if(_0x5b3362[_0x148b('0x71')]===_0x148b('0x73')){var _0x49e4d0=_0x382949['get']({'plain':!![]});return db[_0x148b('0x74')]['find']({'where':{'name':_0x148b('0x22'),'userProfileId':_0x5b3362['userProfileId']},'raw':!![]})[_0x148b('0x1f')](function(_0x4eecc0){if(_0x4eecc0&&_0x4eecc0['autoAssociation']===0x0){return db[_0x148b('0x23')]['create']({'name':_0x49e4d0['name'],'resourceId':_0x49e4d0['id'],'type':_0x4eecc0['name'],'sectionId':_0x4eecc0['id']},{})[_0x148b('0x1f')](function(){return _0x382949;});}else{return _0x382949;}})[_0x148b('0x41')](function(_0x12fc4e){logger['error'](_0x148b('0x75'),_0x12fc4e);throw _0x12fc4e;});}return _0x382949;})[_0x148b('0x1f')](respondWithResult(_0x34662e,null))[_0x148b('0x41')](handleError(_0x34662e,null));});_0x2b1b6c[_0x148b('0x76')]();}catch(_0x397558){_0x34662e[_0x148b('0x17')](0x1f4)['send'](_0x397558);}};exports[_0x148b('0x1e')]=function(_0x6929a9,_0x178404,_0x2ae014){return db['Sound'][_0x148b('0x46')]({'where':{'id':_0x6929a9['params']['id']}})[_0x148b('0x1f')](handleEntityNotFound(_0x178404,null))[_0x148b('0x1f')](saveUpdates(_[_0x148b('0x39')](_0x6929a9['body'],['name',_0x148b('0x77')]),null))['then'](respondWithResult(_0x178404,null))[_0x148b('0x41')](handleError(_0x178404,null));};exports[_0x148b('0x78')]=function(_0x30a3aa,_0x1c49d6,_0xab9f5){return db[_0x148b('0x2a')][_0x148b('0x46')]({'where':{'id':_0x30a3aa['params']['id']}})['then'](function(_0x57bc34){if(_0x57bc34){return _0x57bc34['destroy']();}})[_0x148b('0x1f')](function(_0x8be212){var _0x287725=path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x58'),util['format']('%s.%s',_0x8be212[_0x148b('0x48')],_0x8be212[_0x148b('0x79')]));var _0x3987f8=path[_0x148b('0x4b')](config[_0x148b('0x4c')],_0x148b('0x4d'),util[_0x148b('0x50')](_0x148b('0x59'),_0x8be212[_0x148b('0x48')],_0x8be212['converted_format']));fs[_0x148b('0x5f')](_0x287725);fs['unlinkSync'](_0x3987f8);return _0x8be212;})[_0x148b('0x1f')](function(_0x5c682a){if(_0x5c682a){return _0x1c49d6[_0x148b('0x17')](0xcc)['end']();}})[_0x148b('0x1f')](handleEntityNotFound(_0x1c49d6,null))[_0x148b('0x41')](handleError(_0x1c49d6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 98cb410..b2178ff 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 _0x32d1=['Sound','lodash','../../config/logger','api','moment','request-promise','path','exports','define'];(function(_0x3d7cfe,_0x1f86c8){var _0x58dda0=function(_0x15789c){while(--_0x15789c){_0x3d7cfe['push'](_0x3d7cfe['shift']());}};_0x58dda0(++_0x1f86c8);}(_0x32d1,0xc7));var _0x132d=function(_0x1bf8f5,_0x28f62c){_0x1bf8f5=_0x1bf8f5-0x0;var _0x36a54e=_0x32d1[_0x1bf8f5];return _0x36a54e;};'use strict';var _=require(_0x132d('0x0'));var util=require('util');var logger=require(_0x132d('0x1'))(_0x132d('0x2'));var moment=require(_0x132d('0x3'));var BPromise=require('bluebird');var rp=require(_0x132d('0x4'));var fs=require('fs');var path=require(_0x132d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x132d('0x6')]=function(_0x58c71d,_0x49296c){return _0x58c71d[_0x132d('0x7')](_0x132d('0x8'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb40=['request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0x52dbe7,_0x7bd74a){var _0x1166d=function(_0x1ea3c7){while(--_0x1ea3c7){_0x52dbe7['push'](_0x52dbe7['shift']());}};_0x1166d(++_0x7bd74a);}(_0xdb40,0xee));var _0x0db4=function(_0x404afb,_0x6e2ab2){_0x404afb=_0x404afb-0x0;var _0x19b697=_0xdb40[_0x404afb];return _0x19b697;};'use strict';var _=require(_0x0db4('0x0'));var util=require('util');var logger=require(_0x0db4('0x1'))(_0x0db4('0x2'));var moment=require(_0x0db4('0x3'));var BPromise=require('bluebird');var rp=require(_0x0db4('0x4'));var fs=require('fs');var path=require(_0x0db4('0x5'));var rimraf=require(_0x0db4('0x6'));var config=require(_0x0db4('0x7'));var attributes=require(_0x0db4('0x8'));module[_0x0db4('0x9')]=function(_0x26c250,_0x315108){return _0x26c250['define']('Sound',attributes,{'tableName':_0x0db4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 78229f7..4927de4 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 _0x9f95=['request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x28d3f2,_0x49138a){var _0x58dd17=function(_0x5b7881){while(--_0x5b7881){_0x28d3f2['push'](_0x28d3f2['shift']());}};_0x58dd17(++_0x49138a);}(_0x9f95,0x1e3));var _0x59f9=function(_0x4cfd78,_0x52355e){_0x4cfd78=_0x4cfd78-0x0;var _0xf4a95a=_0x9f95[_0x4cfd78];return _0xf4a95a;};'use strict';var _=require(_0x59f9('0x0'));var util=require(_0x59f9('0x1'));var moment=require(_0x59f9('0x2'));var BPromise=require(_0x59f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59f9('0x4'));var db=require(_0x59f9('0x5'))['db'];var utils=require(_0x59f9('0x6'));var logger=require(_0x59f9('0x7'))(_0x59f9('0x8'));var config=require(_0x59f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x59f9('0xa')][_0x59f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423c15,_0x21eb42,_0x3f0eee){return new BPromise(function(_0x479501,_0x2d38d2){return client[_0x59f9('0xc')](_0x423c15,_0x3f0eee)[_0x59f9('0xd')](function(_0x1dc943){logger[_0x59f9('0xe')](_0x59f9('0xf'),_0x21eb42,'request\x20sent');logger[_0x59f9('0x10')](_0x59f9('0x11'),_0x21eb42,_0x59f9('0x12'),JSON[_0x59f9('0x13')](_0x1dc943));if(_0x1dc943[_0x59f9('0x14')]){if(_0x1dc943['error'][_0x59f9('0x15')]===0x1f4){logger['error'](_0x59f9('0xf'),_0x21eb42,_0x1dc943[_0x59f9('0x14')][_0x59f9('0x16')]);return _0x2d38d2(_0x1dc943[_0x59f9('0x14')]['message']);}logger[_0x59f9('0x14')](_0x59f9('0xf'),_0x21eb42,_0x1dc943[_0x59f9('0x14')][_0x59f9('0x16')]);return _0x479501(_0x1dc943[_0x59f9('0x14')][_0x59f9('0x16')]);}else{logger[_0x59f9('0xe')](_0x59f9('0xf'),_0x21eb42,_0x59f9('0x12'));_0x479501(_0x1dc943[_0x59f9('0x17')][_0x59f9('0x16')]);}})[_0x59f9('0x18')](function(_0xd9f489){logger[_0x59f9('0x14')](_0x59f9('0xf'),_0x21eb42,_0xd9f489);_0x2d38d2(_0xd9f489);});});}exports[_0x59f9('0x19')]=function(_0x5f524){var _0x2394c3=this;return new Promise(function(_0x378dc9,_0x4ba902){return db[_0x59f9('0x1a')]['find']({'raw':_0x5f524[_0x59f9('0x1b')]?_0x5f524[_0x59f9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5f524[_0x59f9('0x1b')]?_0x5f524[_0x59f9('0x1b')][_0x59f9('0x1c')]||null:null,'attributes':_0x5f524[_0x59f9('0x1b')]?_0x5f524[_0x59f9('0x1b')][_0x59f9('0x1d')]||null:null,'include':_0x5f524[_0x59f9('0x1b')]?_0x5f524[_0x59f9('0x1b')][_0x59f9('0x1e')]?_[_0x59f9('0x1f')](_0x5f524[_0x59f9('0x1b')][_0x59f9('0x1e')],function(_0x21a0ea){return{'model':db[_0x21a0ea[_0x59f9('0x20')]],'as':_0x21a0ea['as'],'attributes':_0x21a0ea[_0x59f9('0x1d')],'include':_0x21a0ea[_0x59f9('0x1e')]?_[_0x59f9('0x1f')](_0x21a0ea[_0x59f9('0x1e')],function(_0x40fd2e){return{'model':db[_0x40fd2e[_0x59f9('0x20')]],'as':_0x40fd2e['as'],'attributes':_0x40fd2e[_0x59f9('0x1d')],'include':_0x40fd2e['include']?_[_0x59f9('0x1f')](_0x40fd2e['include'],function(_0x1f6015){return{'model':db[_0x1f6015[_0x59f9('0x20')]],'as':_0x1f6015['as'],'attributes':_0x1f6015['attributes']};}):[]};}):[]};}):[]:[]})[_0x59f9('0xd')](function(_0x4e81fe){logger[_0x59f9('0xe')](_0x59f9('0x19'),_0x5f524);logger[_0x59f9('0x10')]('ShowSound',_0x5f524,JSON[_0x59f9('0x13')](_0x4e81fe));_0x378dc9(_0x4e81fe);})[_0x59f9('0x18')](function(_0x5cd6f2){logger[_0x59f9('0x14')](_0x59f9('0x19'),_0x5cd6f2[_0x59f9('0x16')],_0x5f524);_0x4ba902(_0x2394c3['error'](0x1f4,_0x5cd6f2['message']));});});}; \ No newline at end of file +var _0xdd23=['http','request','then','debug','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','ShowSound','find','options','where','include','map','model','attributes','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x59e333,_0x49d09c){var _0x3465c0=function(_0x53d722){while(--_0x53d722){_0x59e333['push'](_0x59e333['shift']());}};_0x3465c0(++_0x49d09c);}(_0xdd23,0x95));var _0x3dd2=function(_0x56e0b6,_0x3fdb97){_0x56e0b6=_0x56e0b6-0x0;var _0x42e9c5=_0xdd23[_0x56e0b6];return _0x42e9c5;};'use strict';var _=require(_0x3dd2('0x0'));var util=require('util');var moment=require(_0x3dd2('0x1'));var BPromise=require(_0x3dd2('0x2'));var rs=require(_0x3dd2('0x3'));var fs=require('fs');var Redis=require(_0x3dd2('0x4'));var db=require(_0x3dd2('0x5'))['db'];var utils=require(_0x3dd2('0x6'));var logger=require('../../config/logger')(_0x3dd2('0x7'));var config=require(_0x3dd2('0x8'));var jayson=require(_0x3dd2('0x9'));var client=jayson[_0x3dd2('0xa')][_0x3dd2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4733a0,_0x15c4f8,_0x110888){return new BPromise(function(_0x51a596,_0x4b04a1){return client[_0x3dd2('0xc')](_0x4733a0,_0x110888)[_0x3dd2('0xd')](function(_0xef1df2){logger['info']('Sound,\x20%s,\x20%s',_0x15c4f8,'request\x20sent');logger[_0x3dd2('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x15c4f8,_0x3dd2('0xf'),JSON[_0x3dd2('0x10')](_0xef1df2));if(_0xef1df2[_0x3dd2('0x11')]){if(_0xef1df2[_0x3dd2('0x11')][_0x3dd2('0x12')]===0x1f4){logger['error'](_0x3dd2('0x13'),_0x15c4f8,_0xef1df2[_0x3dd2('0x11')][_0x3dd2('0x14')]);return _0x4b04a1(_0xef1df2['error'][_0x3dd2('0x14')]);}logger[_0x3dd2('0x11')](_0x3dd2('0x13'),_0x15c4f8,_0xef1df2[_0x3dd2('0x11')][_0x3dd2('0x14')]);return _0x51a596(_0xef1df2[_0x3dd2('0x11')][_0x3dd2('0x14')]);}else{logger[_0x3dd2('0x15')]('Sound,\x20%s,\x20%s',_0x15c4f8,_0x3dd2('0xf'));_0x51a596(_0xef1df2[_0x3dd2('0x16')][_0x3dd2('0x14')]);}})['catch'](function(_0x31b709){logger[_0x3dd2('0x11')]('Sound,\x20%s,\x20%s',_0x15c4f8,_0x31b709);_0x4b04a1(_0x31b709);});});}exports[_0x3dd2('0x17')]=function(_0x18f518){var _0x354495=this;return new Promise(function(_0x2345a7,_0x20d432){return db['Sound'][_0x3dd2('0x18')]({'raw':_0x18f518['options']?_0x18f518['options']['raw']===undefined?!![]:![]:!![],'where':_0x18f518[_0x3dd2('0x19')]?_0x18f518[_0x3dd2('0x19')][_0x3dd2('0x1a')]||null:null,'attributes':_0x18f518[_0x3dd2('0x19')]?_0x18f518[_0x3dd2('0x19')]['attributes']||null:null,'include':_0x18f518[_0x3dd2('0x19')]?_0x18f518[_0x3dd2('0x19')][_0x3dd2('0x1b')]?_[_0x3dd2('0x1c')](_0x18f518[_0x3dd2('0x19')][_0x3dd2('0x1b')],function(_0x418703){return{'model':db[_0x418703[_0x3dd2('0x1d')]],'as':_0x418703['as'],'attributes':_0x418703['attributes'],'include':_0x418703['include']?_[_0x3dd2('0x1c')](_0x418703[_0x3dd2('0x1b')],function(_0x28098d){return{'model':db[_0x28098d['model']],'as':_0x28098d['as'],'attributes':_0x28098d[_0x3dd2('0x1e')],'include':_0x28098d[_0x3dd2('0x1b')]?_[_0x3dd2('0x1c')](_0x28098d['include'],function(_0x7089b4){return{'model':db[_0x7089b4[_0x3dd2('0x1d')]],'as':_0x7089b4['as'],'attributes':_0x7089b4[_0x3dd2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3dd2('0xd')](function(_0x10a78f){logger['info'](_0x3dd2('0x17'),_0x18f518);logger[_0x3dd2('0xe')](_0x3dd2('0x17'),_0x18f518,JSON[_0x3dd2('0x10')](_0x10a78f));_0x2345a7(_0x10a78f);})[_0x3dd2('0x1f')](function(_0x5a253f){logger[_0x3dd2('0x11')](_0x3dd2('0x17'),_0x5a253f[_0x3dd2('0x14')],_0x18f518);_0x20d432(_0x354495['error'](0x1f4,_0x5a253f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index c91bb4d..25e278a 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 _0x9ab9=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x654cfc,_0x4b9dc7){var _0x20a072=function(_0x2e63b1){while(--_0x2e63b1){_0x654cfc['push'](_0x654cfc['shift']());}};_0x20a072(++_0x4b9dc7);}(_0x9ab9,0x1cb));var _0x99ab=function(_0x20926f,_0x179176){_0x20926f=_0x20926f-0x0;var _0x5c260e=_0x9ab9[_0x20926f];return _0x5c260e;};'use strict';var multer=require(_0x99ab('0x0'));var util=require(_0x99ab('0x1'));var path=require(_0x99ab('0x2'));var timeout=require(_0x99ab('0x3'));var express=require(_0x99ab('0x4'));var router=express[_0x99ab('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x99ab('0x6'));var controller=require(_0x99ab('0x7'));router[_0x99ab('0x8')]('/',auth[_0x99ab('0x9')](),controller[_0x99ab('0xa')]);router[_0x99ab('0x8')](_0x99ab('0xb'),auth[_0x99ab('0x9')](),controller[_0x99ab('0xc')]);router[_0x99ab('0xd')]('/',auth['isAuthenticated'](),controller[_0x99ab('0xe')]);router[_0x99ab('0xf')](_0x99ab('0xb'),auth['isAuthenticated'](),controller[_0x99ab('0x10')]);router[_0x99ab('0x11')](_0x99ab('0xb'),auth[_0x99ab('0x9')](),controller[_0x99ab('0x12')]);module['exports']=router; \ No newline at end of file +var _0x30cc=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','create','put','delete','destroy','exports'];(function(_0x39a826,_0x48f7b3){var _0x56fa63=function(_0x4cae40){while(--_0x4cae40){_0x39a826['push'](_0x39a826['shift']());}};_0x56fa63(++_0x48f7b3);}(_0x30cc,0xd1));var _0xc30c=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x30cc[_0x5b740b];return _0x6f8f4e;};'use strict';var multer=require(_0xc30c('0x0'));var util=require(_0xc30c('0x1'));var path=require(_0xc30c('0x2'));var timeout=require(_0xc30c('0x3'));var express=require(_0xc30c('0x4'));var router=express[_0xc30c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc30c('0x6'));var config=require(_0xc30c('0x7'));var controller=require(_0xc30c('0x8'));router['get']('/',auth[_0xc30c('0x9')](),controller[_0xc30c('0xa')]);router[_0xc30c('0xb')](_0xc30c('0xc'),auth[_0xc30c('0x9')](),controller[_0xc30c('0xd')]);router['post']('/',auth[_0xc30c('0x9')](),controller[_0xc30c('0xe')]);router[_0xc30c('0xf')](_0xc30c('0xc'),auth[_0xc30c('0x9')](),controller['update']);router[_0xc30c('0x10')]('/:id',auth[_0xc30c('0x9')](),controller[_0xc30c('0x11')]);module[_0xc30c('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index cbe973d..19df63e 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 _0x91db=['STRING','medium','ENUM','out','exports'];(function(_0x3a113d,_0x1ea01b){var _0x578db6=function(_0x1924f1){while(--_0x1924f1){_0x3a113d['push'](_0x3a113d['shift']());}};_0x578db6(++_0x1ea01b);}(_0x91db,0xc2));var _0xb91d=function(_0x18934a,_0x1c2b84){_0x18934a=_0x18934a-0x0;var _0x5c731f=_0x91db[_0x18934a];return _0x5c731f;};'use strict';var Sequelize=require('sequelize');module[_0xb91d('0x0')]={'uniqueid':{'type':Sequelize[_0xb91d('0x1')]},'body':{'type':Sequelize['TEXT'](_0xb91d('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xb91d('0x3')]('in',_0xb91d('0x4')),'defaultValue':_0xb91d('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0xaca2=['ENUM','STRING'];(function(_0x3cb529,_0x3c3657){var _0x436c3c=function(_0x20e43b){while(--_0x20e43b){_0x3cb529['push'](_0x3cb529['shift']());}};_0x436c3c(++_0x3c3657);}(_0xaca2,0x1a3));var _0x2aca=function(_0x49b984,_0x387c83){_0x49b984=_0x49b984-0x0;var _0x49d1e0=_0xaca2[_0x49b984];return _0x49d1e0;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x2aca('0x0')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x2aca('0x1')]('in','out'),'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 39cd197..afd592d 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 _0x5fad=['body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','SquareMessage','count','includeAll','include','findAll','catch','show','params','find','create'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0x5fad,0xd0));var _0xd5fa=function(_0x22d300,_0x23c213){_0x22d300=_0x22d300-0x0;var _0x4d2a92=_0x5fad[_0x22d300];return _0x4d2a92;};'use strict';var pdf=require(_0xd5fa('0x0'));var emlformat=require(_0xd5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd5fa('0x2'));var jsonpatch=require(_0xd5fa('0x3'));var rp=require(_0xd5fa('0x4'));var moment=require(_0xd5fa('0x5'));var BPromise=require(_0xd5fa('0x6'));var Mustache=require(_0xd5fa('0x7'));var util=require('util');var path=require('path');var sox=require(_0xd5fa('0x8'));var csv=require(_0xd5fa('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd5fa('0xa'));var squel=require(_0xd5fa('0xb'));var crypto=require('crypto');var jsforce=require(_0xd5fa('0xc'));var deskjs=require(_0xd5fa('0xd'));var toCsv=require(_0xd5fa('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd5fa('0xe'));var authService=require(_0xd5fa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd5fa('0x10'));var hardwareService=require(_0xd5fa('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xd5fa('0x12'));var config=require(_0xd5fa('0x13'));var db=require(_0xd5fa('0x14'))['db'];function respondWithStatusCode(_0x20f8bb,_0x36d0db){_0x36d0db=_0x36d0db||0xcc;return function(_0x44665d){if(_0x44665d){return _0x20f8bb['sendStatus'](_0x36d0db);}return _0x20f8bb[_0xd5fa('0x15')](_0x36d0db)[_0xd5fa('0x16')]();};}function respondWithResult(_0x16f210,_0x2dfaf0){_0x2dfaf0=_0x2dfaf0||0xc8;return function(_0x384a7c){if(_0x384a7c){return _0x16f210[_0xd5fa('0x15')](_0x2dfaf0)['json'](_0x384a7c);}};}function respondWithFilteredResult(_0x5a22e5,_0x2ea4b2){return function(_0x2337a0){if(_0x2337a0){var _0xf64996=_0x2337a0['count'],_0x1e52c9=_0x2ea4b2[_0xd5fa('0x17')],_0xa18b64=_0x2ea4b2[_0xd5fa('0x17')]+_0x2ea4b2['limit'],_0x551053;if(_0xa18b64>=_0xf64996){_0xa18b64=_0xf64996;_0x551053=0xc8;}else{_0x551053=0xce;}_0x5a22e5['status'](_0x551053);return _0x5a22e5['set'](_0xd5fa('0x18'),_0x1e52c9+'-'+_0xa18b64+'/'+_0xf64996)[_0xd5fa('0x19')](_0x2337a0);}return null;};}function patchUpdates(_0x31a453){return function(_0x4415b6){try{jsonpatch[_0xd5fa('0x1a')](_0x4415b6,_0x31a453,!![]);}catch(_0x2a3ea0){return BPromise[_0xd5fa('0x1b')](_0x2a3ea0);}return _0x4415b6[_0xd5fa('0x1c')]();};}function saveUpdates(_0x5a7119,_0x197705){return function(_0x23fd1e){if(_0x23fd1e){return _0x23fd1e[_0xd5fa('0x1d')](_0x5a7119)[_0xd5fa('0x1e')](function(_0x1f1201){return _0x1f1201;});}return null;};}function removeEntity(_0xe2e783,_0x94371f){return function(_0x4b5af7){if(_0x4b5af7){return _0x4b5af7[_0xd5fa('0x1f')]()[_0xd5fa('0x1e')](function(){_0xe2e783['status'](0xcc)[_0xd5fa('0x16')]();});}};}function handleEntityNotFound(_0x1faad6,_0x56ffb9){return function(_0x2405ed){if(!_0x2405ed){_0x1faad6[_0xd5fa('0x20')](0x194);}return _0x2405ed;};}function handleError(_0x3b9301,_0x12fb72){_0x12fb72=_0x12fb72||0x1f4;return function(_0x3f8059){logger['error'](_0x3f8059['stack']);if(_0x3f8059[_0xd5fa('0x21')]){delete _0x3f8059[_0xd5fa('0x21')];}_0x3b9301[_0xd5fa('0x15')](_0x12fb72)[_0xd5fa('0x22')](_0x3f8059);};}exports[_0xd5fa('0x23')]=function(_0x2a303f,_0x59b414){var _0x33fe29={},_0x566fe0={},_0x5cce41={'count':0x0,'rows':[]};var _0x9435b7=_[_0xd5fa('0x24')](db['SquareMessage'][_0xd5fa('0x25')],function(_0xc326ca){return{'name':_0xc326ca[_0xd5fa('0x26')],'type':_0xc326ca[_0xd5fa('0x27')]['key']};});_0x566fe0[_0xd5fa('0x28')]=_['map'](_0x9435b7,_0xd5fa('0x21'));_0x566fe0['query']=_['keys'](_0x2a303f[_0xd5fa('0x29')]);_0x566fe0[_0xd5fa('0x2a')]=_['intersection'](_0x566fe0[_0xd5fa('0x28')],_0x566fe0[_0xd5fa('0x29')]);_0x33fe29[_0xd5fa('0x2b')]=_[_0xd5fa('0x2c')](_0x566fe0[_0xd5fa('0x28')],qs[_0xd5fa('0x2d')](_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x2d')]));_0x33fe29[_0xd5fa('0x2b')]=_0x33fe29['attributes'][_0xd5fa('0x2e')]?_0x33fe29[_0xd5fa('0x2b')]:_0x566fe0[_0xd5fa('0x28')];if(!_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x2f')](_0xd5fa('0x30'))){_0x33fe29['limit']=qs[_0xd5fa('0x31')](_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x31')]);_0x33fe29[_0xd5fa('0x17')]=qs[_0xd5fa('0x17')](_0x2a303f['query'][_0xd5fa('0x17')]);}_0x33fe29[_0xd5fa('0x32')]=qs['sort'](_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x33')]);_0x33fe29[_0xd5fa('0x34')]=qs[_0xd5fa('0x2a')](_[_0xd5fa('0x35')](_0x2a303f[_0xd5fa('0x29')],_0x566fe0['filters']),_0x9435b7);if(_0x2a303f[_0xd5fa('0x29')]['filter']){_0x33fe29[_0xd5fa('0x34')]=_['merge'](_0x33fe29['where'],{'$or':_[_0xd5fa('0x24')](_0x9435b7,function(_0x36961a){if(_0x36961a['type']!==_0xd5fa('0x36')){var _0x1d6539={};_0x1d6539[_0x36961a['name']]={'$like':'%'+_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x37')]+'%'};return _0x1d6539;}})});}_0x33fe29=_[_0xd5fa('0x38')]({},_0x33fe29,_0x2a303f[_0xd5fa('0x39')]);var _0xf5e5f5={'where':_0x33fe29['where']};return db[_0xd5fa('0x3a')][_0xd5fa('0x3b')](_0xf5e5f5)[_0xd5fa('0x1e')](function(_0x320ab0){_0x5cce41[_0xd5fa('0x3b')]=_0x320ab0;if(_0x2a303f[_0xd5fa('0x29')][_0xd5fa('0x3c')]){_0x33fe29[_0xd5fa('0x3d')]=[{'all':!![]}];}return db[_0xd5fa('0x3a')][_0xd5fa('0x3e')](_0x33fe29);})['then'](function(_0xae23c5){_0x5cce41['rows']=_0xae23c5;return _0x5cce41;})[_0xd5fa('0x1e')](respondWithFilteredResult(_0x59b414,_0x33fe29))[_0xd5fa('0x3f')](handleError(_0x59b414,null));};exports[_0xd5fa('0x40')]=function(_0x2c7975,_0x3b154c){var _0x10e0e6={'raw':!![],'where':{'id':_0x2c7975[_0xd5fa('0x41')]['id']}},_0x2096ac={};_0x2096ac[_0xd5fa('0x28')]=_['keys'](db[_0xd5fa('0x3a')]['rawAttributes']);_0x2096ac['query']=_['keys'](_0x2c7975[_0xd5fa('0x29')]);_0x2096ac[_0xd5fa('0x2a')]=_[_0xd5fa('0x2c')](_0x2096ac[_0xd5fa('0x28')],_0x2096ac[_0xd5fa('0x29')]);_0x10e0e6[_0xd5fa('0x2b')]=_[_0xd5fa('0x2c')](_0x2096ac['model'],qs[_0xd5fa('0x2d')](_0x2c7975[_0xd5fa('0x29')][_0xd5fa('0x2d')]));_0x10e0e6[_0xd5fa('0x2b')]=_0x10e0e6[_0xd5fa('0x2b')]['length']?_0x10e0e6[_0xd5fa('0x2b')]:_0x2096ac[_0xd5fa('0x28')];if(_0x2c7975[_0xd5fa('0x29')][_0xd5fa('0x3c')]){_0x10e0e6[_0xd5fa('0x3d')]=[{'all':!![]}];}_0x10e0e6=_['merge']({},_0x10e0e6,_0x2c7975[_0xd5fa('0x39')]);return db[_0xd5fa('0x3a')][_0xd5fa('0x42')](_0x10e0e6)['then'](handleEntityNotFound(_0x3b154c,null))[_0xd5fa('0x1e')](respondWithResult(_0x3b154c,null))[_0xd5fa('0x3f')](handleError(_0x3b154c,null));};exports[_0xd5fa('0x43')]=function(_0x4bf6c7,_0x204b43){return db[_0xd5fa('0x3a')]['create'](_0x4bf6c7['body'],{})[_0xd5fa('0x1e')](respondWithResult(_0x204b43,0xc9))[_0xd5fa('0x3f')](handleError(_0x204b43,null));};exports[_0xd5fa('0x1d')]=function(_0x2ea897,_0x462afa){if(_0x2ea897[_0xd5fa('0x44')]['id']){delete _0x2ea897[_0xd5fa('0x44')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x2ea897[_0xd5fa('0x41')]['id']}})['then'](handleEntityNotFound(_0x462afa,null))[_0xd5fa('0x1e')](saveUpdates(_0x2ea897[_0xd5fa('0x44')],null))['then'](respondWithResult(_0x462afa,null))[_0xd5fa('0x3f')](handleError(_0x462afa,null));};exports[_0xd5fa('0x1f')]=function(_0x7bf451,_0x9698db){return db[_0xd5fa('0x3a')][_0xd5fa('0x42')]({'where':{'id':_0x7bf451[_0xd5fa('0x41')]['id']}})[_0xd5fa('0x1e')](handleEntityNotFound(_0x9698db,null))[_0xd5fa('0x1e')](removeEntity(_0x9698db,null))[_0xd5fa('0x3f')](handleError(_0x9698db,null));}; \ No newline at end of file +var _0xaba0=['set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','SquareMessage','findAll','rows','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x9e61e3,_0x4fc7f4){var _0x468493=function(_0x4d864b){while(--_0x4d864b){_0x9e61e3['push'](_0x9e61e3['shift']());}};_0x468493(++_0x4fc7f4);}(_0xaba0,0x1c8));var _0x0aba=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaba0[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0aba('0x0'));var rimraf=require(_0x0aba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0aba('0x2'));var rp=require(_0x0aba('0x3'));var moment=require(_0x0aba('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0aba('0x5'));var path=require(_0x0aba('0x6'));var sox=require(_0x0aba('0x7'));var csv=require(_0x0aba('0x8'));var ejs=require(_0x0aba('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0aba('0xa'));var jsforce=require(_0x0aba('0xb'));var deskjs=require(_0x0aba('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0aba('0xd'));var Papa=require(_0x0aba('0xe'));var Redis=require(_0x0aba('0xf'));var authService=require(_0x0aba('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0aba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0aba('0x12'));var utils=require('../../config/utils');var config=require(_0x0aba('0x13'));var db=require(_0x0aba('0x14'))['db'];function respondWithStatusCode(_0x35b8e5,_0x32736f){_0x32736f=_0x32736f||0xcc;return function(_0x9ca293){if(_0x9ca293){return _0x35b8e5[_0x0aba('0x15')](_0x32736f);}return _0x35b8e5[_0x0aba('0x16')](_0x32736f)[_0x0aba('0x17')]();};}function respondWithResult(_0x68600e,_0x3b0698){_0x3b0698=_0x3b0698||0xc8;return function(_0x35d21e){if(_0x35d21e){return _0x68600e[_0x0aba('0x16')](_0x3b0698)[_0x0aba('0x18')](_0x35d21e);}};}function respondWithFilteredResult(_0x54ec85,_0x188d00){return function(_0x314dc6){if(_0x314dc6){var _0x4b3d1d=_0x314dc6['count'],_0x570d01=_0x188d00[_0x0aba('0x19')],_0x33e06e=_0x188d00[_0x0aba('0x19')]+_0x188d00[_0x0aba('0x1a')],_0x46a17b;if(_0x33e06e>=_0x4b3d1d){_0x33e06e=_0x4b3d1d;_0x46a17b=0xc8;}else{_0x46a17b=0xce;}_0x54ec85[_0x0aba('0x16')](_0x46a17b);return _0x54ec85[_0x0aba('0x1b')](_0x0aba('0x1c'),_0x570d01+'-'+_0x33e06e+'/'+_0x4b3d1d)[_0x0aba('0x18')](_0x314dc6);}return null;};}function patchUpdates(_0x5893d1){return function(_0xed7946){try{jsonpatch['apply'](_0xed7946,_0x5893d1,!![]);}catch(_0xfeaa10){return BPromise[_0x0aba('0x1d')](_0xfeaa10);}return _0xed7946[_0x0aba('0x1e')]();};}function saveUpdates(_0xbd6202,_0x45a545){return function(_0x10856b){if(_0x10856b){return _0x10856b[_0x0aba('0x1f')](_0xbd6202)[_0x0aba('0x20')](function(_0x36d70c){return _0x36d70c;});}return null;};}function removeEntity(_0x1aa266,_0x412c1b){return function(_0x38a4d6){if(_0x38a4d6){return _0x38a4d6['destroy']()[_0x0aba('0x20')](function(){_0x1aa266['status'](0xcc)[_0x0aba('0x17')]();});}};}function handleEntityNotFound(_0x176897,_0x43d7ce){return function(_0x3de3a6){if(!_0x3de3a6){_0x176897[_0x0aba('0x15')](0x194);}return _0x3de3a6;};}function handleError(_0xade436,_0xd0e91d){_0xd0e91d=_0xd0e91d||0x1f4;return function(_0x406619){logger[_0x0aba('0x21')](_0x406619[_0x0aba('0x22')]);if(_0x406619[_0x0aba('0x23')]){delete _0x406619[_0x0aba('0x23')];}_0xade436[_0x0aba('0x16')](_0xd0e91d)[_0x0aba('0x24')](_0x406619);};}exports[_0x0aba('0x25')]=function(_0x4fec3b,_0x4de2a7){var _0x2324e5={},_0xb34cc3={},_0x262d68={'count':0x0,'rows':[]};var _0x283c30=_[_0x0aba('0x26')](db['SquareMessage'][_0x0aba('0x27')],function(_0x55e45a){return{'name':_0x55e45a[_0x0aba('0x28')],'type':_0x55e45a[_0x0aba('0x29')][_0x0aba('0x2a')]};});_0xb34cc3[_0x0aba('0x2b')]=_[_0x0aba('0x26')](_0x283c30,_0x0aba('0x23'));_0xb34cc3['query']=_[_0x0aba('0x2c')](_0x4fec3b[_0x0aba('0x2d')]);_0xb34cc3['filters']=_[_0x0aba('0x2e')](_0xb34cc3[_0x0aba('0x2b')],_0xb34cc3[_0x0aba('0x2d')]);_0x2324e5[_0x0aba('0x2f')]=_[_0x0aba('0x2e')](_0xb34cc3[_0x0aba('0x2b')],qs[_0x0aba('0x30')](_0x4fec3b['query'][_0x0aba('0x30')]));_0x2324e5['attributes']=_0x2324e5[_0x0aba('0x2f')][_0x0aba('0x31')]?_0x2324e5[_0x0aba('0x2f')]:_0xb34cc3[_0x0aba('0x2b')];if(!_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x32')]('nolimit')){_0x2324e5[_0x0aba('0x1a')]=qs['limit'](_0x4fec3b[_0x0aba('0x2d')]['limit']);_0x2324e5[_0x0aba('0x19')]=qs['offset'](_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x19')]);}_0x2324e5['order']=qs[_0x0aba('0x33')](_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x33')]);_0x2324e5[_0x0aba('0x34')]=qs['filters'](_[_0x0aba('0x35')](_0x4fec3b[_0x0aba('0x2d')],_0xb34cc3['filters']),_0x283c30);if(_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x36')]){_0x2324e5[_0x0aba('0x34')]=_['merge'](_0x2324e5[_0x0aba('0x34')],{'$or':_[_0x0aba('0x26')](_0x283c30,function(_0x1b1a16){if(_0x1b1a16[_0x0aba('0x29')]!==_0x0aba('0x37')){var _0x4d2996={};_0x4d2996[_0x1b1a16[_0x0aba('0x23')]]={'$like':'%'+_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x36')]+'%'};return _0x4d2996;}})});}_0x2324e5=_[_0x0aba('0x38')]({},_0x2324e5,_0x4fec3b[_0x0aba('0x39')]);var _0xb9374={'where':_0x2324e5[_0x0aba('0x34')]};return db['SquareMessage'][_0x0aba('0x3a')](_0xb9374)['then'](function(_0x181d93){_0x262d68[_0x0aba('0x3a')]=_0x181d93;if(_0x4fec3b[_0x0aba('0x2d')][_0x0aba('0x3b')]){_0x2324e5[_0x0aba('0x3c')]=[{'all':!![]}];}return db[_0x0aba('0x3d')][_0x0aba('0x3e')](_0x2324e5);})[_0x0aba('0x20')](function(_0x4d610c){_0x262d68[_0x0aba('0x3f')]=_0x4d610c;return _0x262d68;})[_0x0aba('0x20')](respondWithFilteredResult(_0x4de2a7,_0x2324e5))[_0x0aba('0x40')](handleError(_0x4de2a7,null));};exports['show']=function(_0x4570e4,_0x3c8ec4){var _0x428a1e={'raw':!![],'where':{'id':_0x4570e4[_0x0aba('0x41')]['id']}},_0x252d41={};_0x252d41['model']=_[_0x0aba('0x2c')](db[_0x0aba('0x3d')]['rawAttributes']);_0x252d41[_0x0aba('0x2d')]=_['keys'](_0x4570e4['query']);_0x252d41['filters']=_['intersection'](_0x252d41['model'],_0x252d41['query']);_0x428a1e[_0x0aba('0x2f')]=_[_0x0aba('0x2e')](_0x252d41[_0x0aba('0x2b')],qs[_0x0aba('0x30')](_0x4570e4[_0x0aba('0x2d')]['fields']));_0x428a1e[_0x0aba('0x2f')]=_0x428a1e[_0x0aba('0x2f')][_0x0aba('0x31')]?_0x428a1e[_0x0aba('0x2f')]:_0x252d41['model'];if(_0x4570e4[_0x0aba('0x2d')]['includeAll']){_0x428a1e[_0x0aba('0x3c')]=[{'all':!![]}];}_0x428a1e=_[_0x0aba('0x38')]({},_0x428a1e,_0x4570e4[_0x0aba('0x39')]);return db[_0x0aba('0x3d')][_0x0aba('0x42')](_0x428a1e)['then'](handleEntityNotFound(_0x3c8ec4,null))['then'](respondWithResult(_0x3c8ec4,null))[_0x0aba('0x40')](handleError(_0x3c8ec4,null));};exports[_0x0aba('0x43')]=function(_0x1f9614,_0x2b97d0){return db[_0x0aba('0x3d')]['create'](_0x1f9614['body'],{})[_0x0aba('0x20')](respondWithResult(_0x2b97d0,0xc9))['catch'](handleError(_0x2b97d0,null));};exports[_0x0aba('0x1f')]=function(_0x4e0778,_0x5600da){if(_0x4e0778['body']['id']){delete _0x4e0778[_0x0aba('0x44')]['id'];}return db[_0x0aba('0x3d')][_0x0aba('0x42')]({'where':{'id':_0x4e0778[_0x0aba('0x41')]['id']}})['then'](handleEntityNotFound(_0x5600da,null))[_0x0aba('0x20')](saveUpdates(_0x4e0778['body'],null))['then'](respondWithResult(_0x5600da,null))[_0x0aba('0x40')](handleError(_0x5600da,null));};exports['destroy']=function(_0x40cd21,_0x6fe954){return db['SquareMessage'][_0x0aba('0x42')]({'where':{'id':_0x40cd21[_0x0aba('0x41')]['id']}})['then'](handleEntityNotFound(_0x6fe954,null))['then'](removeEntity(_0x6fe954,null))['catch'](handleError(_0x6fe954,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6f5bf87..a5b12a8 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 _0x31f0=['./squareMessage.attributes','define','square_messages','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2847ec,_0x123650){var _0x504b67=function(_0x5448d4){while(--_0x5448d4){_0x2847ec['push'](_0x2847ec['shift']());}};_0x504b67(++_0x123650);}(_0x31f0,0xb7));var _0x031f=function(_0x5ef6af,_0x534c46){_0x5ef6af=_0x5ef6af-0x0;var _0x3c1b5c=_0x31f0[_0x5ef6af];return _0x3c1b5c;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('SquareMessage',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger'];(function(_0x16771d,_0x224c60){var _0x386f11=function(_0x3d7a87){while(--_0x3d7a87){_0x16771d['push'](_0x16771d['shift']());}};_0x386f11(++_0x224c60);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5268ad,_0x57dc01){_0x5268ad=_0x5268ad-0x0;var _0x1f2be4=_0xc6ac[_0x5268ad];return _0x1f2be4;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'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 49b0ffc..b42bbf2 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 _0x446c=['http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x37a516,_0x9a71bb){var _0x5ca4c9=function(_0xcd8711){while(--_0xcd8711){_0x37a516['push'](_0x37a516['shift']());}};_0x5ca4c9(++_0x9a71bb);}(_0x446c,0x156));var _0xc446=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0x446c[_0x290694];return _0x5a0f2e;};'use strict';var _=require(_0xc446('0x0'));var util=require(_0xc446('0x1'));var moment=require(_0xc446('0x2'));var BPromise=require(_0xc446('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc446('0x4'));var db=require(_0xc446('0x5'))['db'];var utils=require(_0xc446('0x6'));var logger=require('../../config/logger')(_0xc446('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc446('0x8')][_0xc446('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578895,_0x549fac,_0x2eea75){return new BPromise(function(_0x3e9e70,_0x1ddeaf){return client[_0xc446('0xa')](_0x578895,_0x2eea75)[_0xc446('0xb')](function(_0x4a2a80){logger[_0xc446('0xc')](_0xc446('0xd'),_0x549fac,_0xc446('0xe'));logger[_0xc446('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x549fac,_0xc446('0xe'),JSON[_0xc446('0x10')](_0x4a2a80));if(_0x4a2a80[_0xc446('0x11')]){if(_0x4a2a80[_0xc446('0x11')][_0xc446('0x12')]===0x1f4){logger[_0xc446('0x11')](_0xc446('0xd'),_0x549fac,_0x4a2a80[_0xc446('0x11')][_0xc446('0x13')]);return _0x1ddeaf(_0x4a2a80[_0xc446('0x11')][_0xc446('0x13')]);}logger[_0xc446('0x11')](_0xc446('0xd'),_0x549fac,_0x4a2a80[_0xc446('0x11')][_0xc446('0x13')]);return _0x3e9e70(_0x4a2a80[_0xc446('0x11')][_0xc446('0x13')]);}else{logger[_0xc446('0xc')](_0xc446('0xd'),_0x549fac,'request\x20sent');_0x3e9e70(_0x4a2a80[_0xc446('0x14')][_0xc446('0x13')]);}})[_0xc446('0x15')](function(_0x4690c5){logger[_0xc446('0x11')](_0xc446('0xd'),_0x549fac,_0x4690c5);_0x1ddeaf(_0x4690c5);});});}exports[_0xc446('0x16')]=function(_0x30038f){var _0x16f337=this;return new Promise(function(_0x606af1,_0x51fa01){return db[_0xc446('0x17')][_0xc446('0x18')](_0x30038f['body'],{'raw':_0x30038f[_0xc446('0x19')]?_0x30038f[_0xc446('0x19')][_0xc446('0x1a')]===undefined?!![]:![]:!![]})[_0xc446('0xb')](function(_0x409a8e){logger[_0xc446('0xc')](_0xc446('0x16'),_0x30038f);logger[_0xc446('0xf')](_0xc446('0x16'),_0x30038f,JSON[_0xc446('0x10')](_0x409a8e));_0x606af1(_0x409a8e);})['catch'](function(_0x35aedc){logger[_0xc446('0x11')](_0xc446('0x16'),_0x35aedc[_0xc446('0x13')],_0x30038f);_0x51fa01(_0x16f337[_0xc446('0x11')](0x1f4,_0x35aedc[_0xc446('0x13')]));});});}; \ No newline at end of file +var _0x9fe7=['SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x9fe7,0x1df));var _0x79fe=function(_0x16b683,_0x1de3db){_0x16b683=_0x16b683-0x0;var _0x25c35c=_0x9fe7[_0x16b683];return _0x25c35c;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var moment=require('moment');var BPromise=require(_0x79fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79fe('0x3'));var db=require(_0x79fe('0x4'))['db'];var utils=require(_0x79fe('0x5'));var logger=require('../../config/logger')(_0x79fe('0x6'));var config=require(_0x79fe('0x7'));var jayson=require(_0x79fe('0x8'));var client=jayson['client'][_0x79fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5aef,_0x2ba246,_0x4c8314){return new BPromise(function(_0x24faa0,_0x264323){return client[_0x79fe('0xa')](_0x2a5aef,_0x4c8314)[_0x79fe('0xb')](function(_0xafc7cd){logger['info'](_0x79fe('0xc'),_0x2ba246,_0x79fe('0xd'));logger['debug'](_0x79fe('0xe'),_0x2ba246,_0x79fe('0xd'),JSON[_0x79fe('0xf')](_0xafc7cd));if(_0xafc7cd[_0x79fe('0x10')]){if(_0xafc7cd['error'][_0x79fe('0x11')]===0x1f4){logger[_0x79fe('0x10')](_0x79fe('0xc'),_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x264323(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}logger[_0x79fe('0x10')]('SquareMessage,\x20%s,\x20%s',_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x24faa0(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}else{logger[_0x79fe('0x13')](_0x79fe('0xc'),_0x2ba246,'request\x20sent');_0x24faa0(_0xafc7cd[_0x79fe('0x14')][_0x79fe('0x12')]);}})[_0x79fe('0x15')](function(_0x5f0af3){logger['error'](_0x79fe('0xc'),_0x2ba246,_0x5f0af3);_0x264323(_0x5f0af3);});});}exports[_0x79fe('0x16')]=function(_0x39be95){var _0x40a549=this;return new Promise(function(_0x536641,_0x5e2f0b){return db[_0x79fe('0x17')][_0x79fe('0x18')](_0x39be95[_0x79fe('0x19')],{'raw':_0x39be95['options']?_0x39be95[_0x79fe('0x1a')][_0x79fe('0x1b')]===undefined?!![]:![]:!![]})[_0x79fe('0xb')](function(_0x4c7062){logger[_0x79fe('0x13')]('CreateSquareMessage',_0x39be95);logger[_0x79fe('0x1c')](_0x79fe('0x16'),_0x39be95,JSON[_0x79fe('0xf')](_0x4c7062));_0x536641(_0x4c7062);})[_0x79fe('0x15')](function(_0x1ac8d7){logger[_0x79fe('0x10')]('CreateSquareMessage',_0x1ac8d7['message'],_0x39be95);_0x5e2f0b(_0x40a549[_0x79fe('0x10')](0x1f4,_0x1ac8d7['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 37cd390..9fd7e56 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 _0xd4f7=['isAuthenticated','/:id','get','/:id/test','15s','test','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x279294,_0x45231d){var _0x43df63=function(_0x4fa3ce){while(--_0x4fa3ce){_0x279294['push'](_0x279294['shift']());}};_0x43df63(++_0x45231d);}(_0xd4f7,0x11d));var _0x7d4f=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xd4f7[_0x4c1ec2];return _0x3f6f1c;};'use strict';var multer=require('multer');var util=require(_0x7d4f('0x0'));var path=require(_0x7d4f('0x1'));var timeout=require(_0x7d4f('0x2'));var express=require(_0x7d4f('0x3'));var router=express[_0x7d4f('0x4')]();var auth=require(_0x7d4f('0x5'));var interaction=require(_0x7d4f('0x6'));var config=require(_0x7d4f('0x7'));var controller=require(_0x7d4f('0x8'));router['get']('/',auth[_0x7d4f('0x9')](),controller['index']);router['get'](_0x7d4f('0xa'),auth[_0x7d4f('0x9')](),controller['show']);router[_0x7d4f('0xb')](_0x7d4f('0xc'),auth[_0x7d4f('0x9')](),timeout(_0x7d4f('0xd')),controller[_0x7d4f('0xe')]);router[_0x7d4f('0xf')]('/',auth[_0x7d4f('0x9')](),controller[_0x7d4f('0x10')]);router[_0x7d4f('0x11')](_0x7d4f('0xa'),auth[_0x7d4f('0x9')](),controller[_0x7d4f('0x12')]);router[_0x7d4f('0x13')](_0x7d4f('0xa'),auth[_0x7d4f('0x9')](),controller[_0x7d4f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4e14=['Router','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','post','create','put','update','delete','multer','util','path','connect-timeout','express'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x4e14,0x10c));var _0x44e1=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x4e14[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x44e1('0x0'));var util=require(_0x44e1('0x1'));var path=require(_0x44e1('0x2'));var timeout=require(_0x44e1('0x3'));var express=require(_0x44e1('0x4'));var router=express[_0x44e1('0x5')]();var auth=require(_0x44e1('0x6'));var interaction=require(_0x44e1('0x7'));var config=require('../../config/environment');var controller=require(_0x44e1('0x8'));router[_0x44e1('0x9')]('/',auth[_0x44e1('0xa')](),controller['index']);router['get'](_0x44e1('0xb'),auth[_0x44e1('0xa')](),controller[_0x44e1('0xc')]);router['get'](_0x44e1('0xd'),auth[_0x44e1('0xa')](),timeout(_0x44e1('0xe')),controller[_0x44e1('0xf')]);router[_0x44e1('0x10')]('/',auth['isAuthenticated'](),controller[_0x44e1('0x11')]);router[_0x44e1('0x12')](_0x44e1('0xb'),auth[_0x44e1('0xa')](),controller[_0x44e1('0x13')]);router[_0x44e1('0x14')](_0x44e1('0xb'),auth[_0x44e1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8a2f5b8..945d8f8 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 _0x5ddf=['sequelize','exports','STRING'];(function(_0x151452,_0x4c13bb){var _0xe79264=function(_0x4d098a){while(--_0x4d098a){_0x151452['push'](_0x151452['shift']());}};_0xe79264(++_0x4c13bb);}(_0x5ddf,0x150));var _0xf5dd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5ddf[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xf5dd('0x0'));module[_0xf5dd('0x1')]={'name':{'type':Sequelize[_0xf5dd('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5dd('0x2')]}}; \ No newline at end of file +var _0x8c32=['name','exports','STRING'];(function(_0x116fe4,_0x3a71d7){var _0x26b378=function(_0x35e6d6){while(--_0x35e6d6){_0x116fe4['push'](_0x116fe4['shift']());}};_0x26b378(++_0x3a71d7);}(_0x8c32,0x6a));var _0x28c3=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x8c32[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');module[_0x28c3('0x0')]={'name':{'type':Sequelize[_0x28c3('0x1')],'unique':_0x28c3('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x28c3('0x1')]},'description':{'type':Sequelize[_0x28c3('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 1b85fa3..3c7cfc0 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 _0xcf8d=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','catch','show','params','SquareOdbc','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation'];(function(_0x433c1e,_0x16780a){var _0xa86681=function(_0x30bb29){while(--_0x30bb29){_0x433c1e['push'](_0x433c1e['shift']());}};_0xa86681(++_0x16780a);}(_0xcf8d,0x1f0));var _0xdcf8=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xcf8d[_0x9c2427];return _0x51984f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdcf8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcf8('0x1'));var jsonpatch=require(_0xdcf8('0x2'));var rp=require(_0xdcf8('0x3'));var moment=require('moment');var BPromise=require(_0xdcf8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdcf8('0x5'));var sox=require(_0xdcf8('0x6'));var csv=require(_0xdcf8('0x7'));var ejs=require(_0xdcf8('0x8'));var fs=require('fs');var _=require(_0xdcf8('0x9'));var squel=require(_0xdcf8('0xa'));var crypto=require(_0xdcf8('0xb'));var jsforce=require(_0xdcf8('0xc'));var deskjs=require(_0xdcf8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdcf8('0xe'));var Papa=require(_0xdcf8('0xf'));var Redis=require(_0xdcf8('0x10'));var authService=require(_0xdcf8('0x11'));var qs=require(_0xdcf8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdcf8('0x13'));var logger=require(_0xdcf8('0x14'))(_0xdcf8('0x15'));var utils=require('../../config/utils');var config=require(_0xdcf8('0x16'));var db=require(_0xdcf8('0x17'))['db'];function respondWithStatusCode(_0x1ef73f,_0x21b8a6){_0x21b8a6=_0x21b8a6||0xcc;return function(_0x473fb6){if(_0x473fb6){return _0x1ef73f[_0xdcf8('0x18')](_0x21b8a6);}return _0x1ef73f[_0xdcf8('0x19')](_0x21b8a6)[_0xdcf8('0x1a')]();};}function respondWithResult(_0x25719d,_0x55d426){_0x55d426=_0x55d426||0xc8;return function(_0x571770){if(_0x571770){return _0x25719d[_0xdcf8('0x19')](_0x55d426)[_0xdcf8('0x1b')](_0x571770);}};}function respondWithFilteredResult(_0x1cadbe,_0x367371){return function(_0x4c0733){if(_0x4c0733){var _0x478cf5=_0x4c0733[_0xdcf8('0x1c')],_0x29a76f=_0x367371[_0xdcf8('0x1d')],_0xdced19=_0x367371[_0xdcf8('0x1d')]+_0x367371['limit'],_0x3faa9b;if(_0xdced19>=_0x478cf5){_0xdced19=_0x478cf5;_0x3faa9b=0xc8;}else{_0x3faa9b=0xce;}_0x1cadbe[_0xdcf8('0x19')](_0x3faa9b);return _0x1cadbe['set'](_0xdcf8('0x1e'),_0x29a76f+'-'+_0xdced19+'/'+_0x478cf5)[_0xdcf8('0x1b')](_0x4c0733);}return null;};}function patchUpdates(_0x1b3fdd){return function(_0x2d255e){try{jsonpatch[_0xdcf8('0x1f')](_0x2d255e,_0x1b3fdd,!![]);}catch(_0x884832){return BPromise['reject'](_0x884832);}return _0x2d255e['save']();};}function saveUpdates(_0x3e9d35,_0x4d8eda){return function(_0xe914f2){if(_0xe914f2){return _0xe914f2[_0xdcf8('0x20')](_0x3e9d35)[_0xdcf8('0x21')](function(_0x5a6d2f){return _0x5a6d2f;});}return null;};}function removeEntity(_0x1df55f,_0x5b71b3){return function(_0x1c33a3){if(_0x1c33a3){return _0x1c33a3['destroy']()[_0xdcf8('0x21')](function(){var _0x4da3ed=_0x1c33a3['get']({'plain':!![]});var _0x16b735=_0xdcf8('0x22');return db[_0xdcf8('0x23')][_0xdcf8('0x24')]({'where':{'type':_0x16b735,'resourceId':_0x4da3ed['id']}})['then'](function(){return _0x1c33a3;});})['then'](function(){_0x1df55f[_0xdcf8('0x19')](0xcc)[_0xdcf8('0x1a')]();});}};}function handleEntityNotFound(_0x35db4c,_0x5928e6){return function(_0x30e7de){if(!_0x30e7de){_0x35db4c[_0xdcf8('0x18')](0x194);}return _0x30e7de;};}function handleError(_0x156e9f,_0x2b2175){_0x2b2175=_0x2b2175||0x1f4;return function(_0x522258){logger[_0xdcf8('0x25')](_0x522258[_0xdcf8('0x26')]);if(_0x522258[_0xdcf8('0x27')]){delete _0x522258[_0xdcf8('0x27')];}_0x156e9f[_0xdcf8('0x19')](_0x2b2175)[_0xdcf8('0x28')](_0x522258);};}exports[_0xdcf8('0x29')]=function(_0x4b8a59,_0x5d3572){var _0x1e58cb={},_0x3307b5={},_0x3dc355={'count':0x0,'rows':[]};var _0x300c93=_[_0xdcf8('0x2a')](db['SquareOdbc'][_0xdcf8('0x2b')],function(_0x1559db){return{'name':_0x1559db['fieldName'],'type':_0x1559db['type']['key']};});_0x3307b5[_0xdcf8('0x2c')]=_['map'](_0x300c93,_0xdcf8('0x27'));_0x3307b5['query']=_[_0xdcf8('0x2d')](_0x4b8a59[_0xdcf8('0x2e')]);_0x3307b5[_0xdcf8('0x2f')]=_[_0xdcf8('0x30')](_0x3307b5[_0xdcf8('0x2c')],_0x3307b5['query']);_0x1e58cb['attributes']=_['intersection'](_0x3307b5[_0xdcf8('0x2c')],qs[_0xdcf8('0x31')](_0x4b8a59[_0xdcf8('0x2e')][_0xdcf8('0x31')]));_0x1e58cb[_0xdcf8('0x32')]=_0x1e58cb[_0xdcf8('0x32')][_0xdcf8('0x33')]?_0x1e58cb['attributes']:_0x3307b5[_0xdcf8('0x2c')];if(!_0x4b8a59['query']['hasOwnProperty'](_0xdcf8('0x34'))){_0x1e58cb[_0xdcf8('0x35')]=qs[_0xdcf8('0x35')](_0x4b8a59['query'][_0xdcf8('0x35')]);_0x1e58cb[_0xdcf8('0x1d')]=qs[_0xdcf8('0x1d')](_0x4b8a59[_0xdcf8('0x2e')][_0xdcf8('0x1d')]);}_0x1e58cb[_0xdcf8('0x36')]=qs[_0xdcf8('0x37')](_0x4b8a59[_0xdcf8('0x2e')][_0xdcf8('0x37')]);_0x1e58cb[_0xdcf8('0x38')]=qs[_0xdcf8('0x2f')](_[_0xdcf8('0x39')](_0x4b8a59[_0xdcf8('0x2e')],_0x3307b5[_0xdcf8('0x2f')]),_0x300c93);if(_0x4b8a59[_0xdcf8('0x2e')]['filter']){_0x1e58cb[_0xdcf8('0x38')]=_['merge'](_0x1e58cb[_0xdcf8('0x38')],{'$or':_[_0xdcf8('0x2a')](_0x300c93,function(_0x5ea5d2){if(_0x5ea5d2[_0xdcf8('0x3a')]!=='VIRTUAL'){var _0x13f91b={};_0x13f91b[_0x5ea5d2[_0xdcf8('0x27')]]={'$like':'%'+_0x4b8a59['query'][_0xdcf8('0x3b')]+'%'};return _0x13f91b;}})});}_0x1e58cb=_[_0xdcf8('0x3c')]({},_0x1e58cb,_0x4b8a59[_0xdcf8('0x3d')]);var _0x144afc={'where':_0x1e58cb['where']};return db['SquareOdbc'][_0xdcf8('0x1c')](_0x144afc)[_0xdcf8('0x21')](function(_0x3ba2ac){_0x3dc355[_0xdcf8('0x1c')]=_0x3ba2ac;if(_0x4b8a59[_0xdcf8('0x2e')][_0xdcf8('0x3e')]){_0x1e58cb[_0xdcf8('0x3f')]=[{'all':!![]}];}return db['SquareOdbc'][_0xdcf8('0x40')](_0x1e58cb);})['then'](function(_0x21f24b){_0x3dc355['rows']=_0x21f24b;return _0x3dc355;})[_0xdcf8('0x21')](respondWithFilteredResult(_0x5d3572,_0x1e58cb))[_0xdcf8('0x41')](handleError(_0x5d3572,null));};exports[_0xdcf8('0x42')]=function(_0x139c66,_0x39129c){var _0x4ca6f6={'raw':!![],'where':{'id':_0x139c66[_0xdcf8('0x43')]['id']}},_0x271311={};_0x271311['model']=_['keys'](db[_0xdcf8('0x44')][_0xdcf8('0x2b')]);_0x271311[_0xdcf8('0x2e')]=_[_0xdcf8('0x2d')](_0x139c66[_0xdcf8('0x2e')]);_0x271311[_0xdcf8('0x2f')]=_[_0xdcf8('0x30')](_0x271311['model'],_0x271311[_0xdcf8('0x2e')]);_0x4ca6f6['attributes']=_[_0xdcf8('0x30')](_0x271311[_0xdcf8('0x2c')],qs[_0xdcf8('0x31')](_0x139c66[_0xdcf8('0x2e')][_0xdcf8('0x31')]));_0x4ca6f6[_0xdcf8('0x32')]=_0x4ca6f6[_0xdcf8('0x32')][_0xdcf8('0x33')]?_0x4ca6f6['attributes']:_0x271311[_0xdcf8('0x2c')];if(_0x139c66[_0xdcf8('0x2e')]['includeAll']){_0x4ca6f6['include']=[{'all':!![]}];}_0x4ca6f6=_[_0xdcf8('0x3c')]({},_0x4ca6f6,_0x139c66[_0xdcf8('0x3d')]);return db['SquareOdbc'][_0xdcf8('0x45')](_0x4ca6f6)[_0xdcf8('0x21')](handleEntityNotFound(_0x39129c,null))[_0xdcf8('0x21')](respondWithResult(_0x39129c,null))[_0xdcf8('0x41')](handleError(_0x39129c,null));};exports[_0xdcf8('0x46')]=function(_0x24df97,_0x1126aa){return db[_0xdcf8('0x44')]['create'](_0x24df97[_0xdcf8('0x47')],{})[_0xdcf8('0x21')](function(_0x72a3e7){var _0x361e7c=_0x24df97['user'][_0xdcf8('0x48')]({'plain':!![]});if(!_0x361e7c)throw new Error(_0xdcf8('0x49'));if(_0x361e7c[_0xdcf8('0x4a')]===_0xdcf8('0x4b')){var _0x39096b=_0x72a3e7[_0xdcf8('0x48')]({'plain':!![]});var _0x49d8a8='ODBC';return db['UserProfileSection'][_0xdcf8('0x45')]({'where':{'name':_0x49d8a8,'userProfileId':_0x361e7c[_0xdcf8('0x4c')]},'raw':!![]})[_0xdcf8('0x21')](function(_0x4ea565){if(_0x4ea565&&_0x4ea565[_0xdcf8('0x4d')]===0x0){return db[_0xdcf8('0x23')][_0xdcf8('0x46')]({'name':_0x39096b[_0xdcf8('0x27')],'resourceId':_0x39096b['id'],'type':_0x4ea565[_0xdcf8('0x27')],'sectionId':_0x4ea565['id']},{})[_0xdcf8('0x21')](function(){return _0x72a3e7;});}else{return _0x72a3e7;}})[_0xdcf8('0x41')](function(_0x35c708){logger[_0xdcf8('0x25')](_0xdcf8('0x4e'),_0x35c708);throw _0x35c708;});}return _0x72a3e7;})[_0xdcf8('0x21')](respondWithResult(_0x1126aa,0xc9))[_0xdcf8('0x41')](handleError(_0x1126aa,null));};exports['update']=function(_0x19a713,_0xe0259b){if(_0x19a713[_0xdcf8('0x47')]['id']){delete _0x19a713[_0xdcf8('0x47')]['id'];}return db[_0xdcf8('0x44')][_0xdcf8('0x45')]({'where':{'id':_0x19a713[_0xdcf8('0x43')]['id']}})['then'](handleEntityNotFound(_0xe0259b,null))[_0xdcf8('0x21')](saveUpdates(_0x19a713[_0xdcf8('0x47')],null))[_0xdcf8('0x21')](respondWithResult(_0xe0259b,null))['catch'](handleError(_0xe0259b,null));};exports[_0xdcf8('0x24')]=function(_0x14c2df,_0x4aad6d){return db[_0xdcf8('0x44')][_0xdcf8('0x45')]({'where':{'id':_0x14c2df[_0xdcf8('0x43')]['id']}})[_0xdcf8('0x21')](handleEntityNotFound(_0x4aad6d,null))[_0xdcf8('0x21')](removeEntity(_0x4aad6d,null))[_0xdcf8('0x41')](handleError(_0x4aad6d,null));};exports['test']=function(_0x47d5a5,_0x237877,_0xa03857){var _0x31a747;return db[_0xdcf8('0x44')][_0xdcf8('0x45')]({'where':{'id':_0x47d5a5[_0xdcf8('0x43')]['id']},'attributes':['id',_0xdcf8('0x4f')]})['then'](handleEntityNotFound(_0x237877,null))[_0xdcf8('0x21')](function(_0x258fa8){if(_0x258fa8){var _0x5a078c=require('odbc')();_0x5a078c[_0xdcf8('0x50')](_0x258fa8[_0xdcf8('0x4f')]);_0x5a078c[_0xdcf8('0x51')]();return _0x258fa8;}})[_0xdcf8('0x21')](respondWithResult(_0x237877,null))['catch'](handleError(_0x237877,null));}; \ No newline at end of file +var _0x64fb=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','then','destroy','get','ODBC','UserProfileResource','name','send','index','map','rawAttributes','key','keys','filters','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','SquareOdbc','count','includeAll','include','findAll','catch','show','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x64fb,0xff));var _0xb64f=function(_0x5bc3c8,_0x1ff774){_0x5bc3c8=_0x5bc3c8-0x0;var _0x142c18=_0x64fb[_0x5bc3c8];return _0x142c18;};'use strict';var pdf=require(_0xb64f('0x0'));var emlformat=require(_0xb64f('0x1'));var rimraf=require(_0xb64f('0x2'));var zipdir=require(_0xb64f('0x3'));var jsonpatch=require(_0xb64f('0x4'));var rp=require(_0xb64f('0x5'));var moment=require(_0xb64f('0x6'));var BPromise=require(_0xb64f('0x7'));var Mustache=require(_0xb64f('0x8'));var util=require(_0xb64f('0x9'));var path=require(_0xb64f('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb64f('0xb'));var fs=require('fs');var _=require(_0xb64f('0xc'));var squel=require('squel');var crypto=require(_0xb64f('0xd'));var jsforce=require(_0xb64f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb64f('0xf'));var Redis=require(_0xb64f('0x10'));var authService=require(_0xb64f('0x11'));var qs=require(_0xb64f('0x12'));var as=require(_0xb64f('0x13'));var hardwareService=require(_0xb64f('0x14'));var logger=require(_0xb64f('0x15'))(_0xb64f('0x16'));var utils=require('../../config/utils');var config=require(_0xb64f('0x17'));var db=require(_0xb64f('0x18'))['db'];function respondWithStatusCode(_0x182832,_0x3d113d){_0x3d113d=_0x3d113d||0xcc;return function(_0x2b1f95){if(_0x2b1f95){return _0x182832[_0xb64f('0x19')](_0x3d113d);}return _0x182832['status'](_0x3d113d)[_0xb64f('0x1a')]();};}function respondWithResult(_0xdcef03,_0x22b50b){_0x22b50b=_0x22b50b||0xc8;return function(_0x37a969){if(_0x37a969){return _0xdcef03[_0xb64f('0x1b')](_0x22b50b)[_0xb64f('0x1c')](_0x37a969);}};}function respondWithFilteredResult(_0x5b302c,_0x19c87d){return function(_0x1f57f5){if(_0x1f57f5){var _0x32cc2e=_0x1f57f5['count'],_0x4954ee=_0x19c87d[_0xb64f('0x1d')],_0x2c5daa=_0x19c87d[_0xb64f('0x1d')]+_0x19c87d[_0xb64f('0x1e')],_0x36d8b7;if(_0x2c5daa>=_0x32cc2e){_0x2c5daa=_0x32cc2e;_0x36d8b7=0xc8;}else{_0x36d8b7=0xce;}_0x5b302c[_0xb64f('0x1b')](_0x36d8b7);return _0x5b302c[_0xb64f('0x1f')](_0xb64f('0x20'),_0x4954ee+'-'+_0x2c5daa+'/'+_0x32cc2e)[_0xb64f('0x1c')](_0x1f57f5);}return null;};}function patchUpdates(_0x10a6cd){return function(_0x4587a4){try{jsonpatch[_0xb64f('0x21')](_0x4587a4,_0x10a6cd,!![]);}catch(_0x4b8de4){return BPromise['reject'](_0x4b8de4);}return _0x4587a4[_0xb64f('0x22')]();};}function saveUpdates(_0x55cfdb,_0x4634ec){return function(_0x5b8f40){if(_0x5b8f40){return _0x5b8f40['update'](_0x55cfdb)[_0xb64f('0x23')](function(_0x213987){return _0x213987;});}return null;};}function removeEntity(_0x2a679e,_0x138da8){return function(_0x14187b){if(_0x14187b){return _0x14187b[_0xb64f('0x24')]()[_0xb64f('0x23')](function(){var _0x3985cb=_0x14187b[_0xb64f('0x25')]({'plain':!![]});var _0x4ebbbb=_0xb64f('0x26');return db[_0xb64f('0x27')]['destroy']({'where':{'type':_0x4ebbbb,'resourceId':_0x3985cb['id']}})['then'](function(){return _0x14187b;});})[_0xb64f('0x23')](function(){_0x2a679e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43ce13,_0x5e5170){return function(_0x15f1b7){if(!_0x15f1b7){_0x43ce13[_0xb64f('0x19')](0x194);}return _0x15f1b7;};}function handleError(_0x575c7f,_0x4976da){_0x4976da=_0x4976da||0x1f4;return function(_0x41c911){logger['error'](_0x41c911['stack']);if(_0x41c911['name']){delete _0x41c911[_0xb64f('0x28')];}_0x575c7f['status'](_0x4976da)[_0xb64f('0x29')](_0x41c911);};}exports[_0xb64f('0x2a')]=function(_0x592f61,_0x3cfc22){var _0x4961e8={},_0x117b32={},_0x46887a={'count':0x0,'rows':[]};var _0x287a76=_[_0xb64f('0x2b')](db['SquareOdbc'][_0xb64f('0x2c')],function(_0x3f7a67){return{'name':_0x3f7a67['fieldName'],'type':_0x3f7a67['type'][_0xb64f('0x2d')]};});_0x117b32['model']=_[_0xb64f('0x2b')](_0x287a76,_0xb64f('0x28'));_0x117b32['query']=_[_0xb64f('0x2e')](_0x592f61['query']);_0x117b32[_0xb64f('0x2f')]=_['intersection'](_0x117b32['model'],_0x117b32[_0xb64f('0x30')]);_0x4961e8['attributes']=_['intersection'](_0x117b32[_0xb64f('0x31')],qs[_0xb64f('0x32')](_0x592f61[_0xb64f('0x30')][_0xb64f('0x32')]));_0x4961e8['attributes']=_0x4961e8[_0xb64f('0x33')][_0xb64f('0x34')]?_0x4961e8[_0xb64f('0x33')]:_0x117b32[_0xb64f('0x31')];if(!_0x592f61[_0xb64f('0x30')][_0xb64f('0x35')](_0xb64f('0x36'))){_0x4961e8[_0xb64f('0x1e')]=qs['limit'](_0x592f61['query'][_0xb64f('0x1e')]);_0x4961e8[_0xb64f('0x1d')]=qs['offset'](_0x592f61[_0xb64f('0x30')][_0xb64f('0x1d')]);}_0x4961e8[_0xb64f('0x37')]=qs[_0xb64f('0x38')](_0x592f61[_0xb64f('0x30')][_0xb64f('0x38')]);_0x4961e8[_0xb64f('0x39')]=qs[_0xb64f('0x2f')](_[_0xb64f('0x3a')](_0x592f61['query'],_0x117b32['filters']),_0x287a76);if(_0x592f61[_0xb64f('0x30')]['filter']){_0x4961e8[_0xb64f('0x39')]=_[_0xb64f('0x3b')](_0x4961e8[_0xb64f('0x39')],{'$or':_['map'](_0x287a76,function(_0x59998){if(_0x59998[_0xb64f('0x3c')]!=='VIRTUAL'){var _0x442235={};_0x442235[_0x59998[_0xb64f('0x28')]]={'$like':'%'+_0x592f61[_0xb64f('0x30')][_0xb64f('0x3d')]+'%'};return _0x442235;}})});}_0x4961e8=_[_0xb64f('0x3b')]({},_0x4961e8,_0x592f61[_0xb64f('0x3e')]);var _0x45c870={'where':_0x4961e8[_0xb64f('0x39')]};return db[_0xb64f('0x3f')][_0xb64f('0x40')](_0x45c870)[_0xb64f('0x23')](function(_0x672d96){_0x46887a[_0xb64f('0x40')]=_0x672d96;if(_0x592f61['query'][_0xb64f('0x41')]){_0x4961e8[_0xb64f('0x42')]=[{'all':!![]}];}return db['SquareOdbc'][_0xb64f('0x43')](_0x4961e8);})[_0xb64f('0x23')](function(_0x2bce85){_0x46887a['rows']=_0x2bce85;return _0x46887a;})[_0xb64f('0x23')](respondWithFilteredResult(_0x3cfc22,_0x4961e8))[_0xb64f('0x44')](handleError(_0x3cfc22,null));};exports[_0xb64f('0x45')]=function(_0x1cce07,_0x418565){var _0xe38521={'raw':!![],'where':{'id':_0x1cce07[_0xb64f('0x46')]['id']}},_0x5321b8={};_0x5321b8[_0xb64f('0x31')]=_[_0xb64f('0x2e')](db[_0xb64f('0x3f')]['rawAttributes']);_0x5321b8[_0xb64f('0x30')]=_['keys'](_0x1cce07[_0xb64f('0x30')]);_0x5321b8[_0xb64f('0x2f')]=_['intersection'](_0x5321b8[_0xb64f('0x31')],_0x5321b8[_0xb64f('0x30')]);_0xe38521[_0xb64f('0x33')]=_[_0xb64f('0x47')](_0x5321b8[_0xb64f('0x31')],qs[_0xb64f('0x32')](_0x1cce07['query'][_0xb64f('0x32')]));_0xe38521[_0xb64f('0x33')]=_0xe38521[_0xb64f('0x33')][_0xb64f('0x34')]?_0xe38521[_0xb64f('0x33')]:_0x5321b8[_0xb64f('0x31')];if(_0x1cce07[_0xb64f('0x30')]['includeAll']){_0xe38521['include']=[{'all':!![]}];}_0xe38521=_[_0xb64f('0x3b')]({},_0xe38521,_0x1cce07[_0xb64f('0x3e')]);return db[_0xb64f('0x3f')][_0xb64f('0x48')](_0xe38521)[_0xb64f('0x23')](handleEntityNotFound(_0x418565,null))[_0xb64f('0x23')](respondWithResult(_0x418565,null))[_0xb64f('0x44')](handleError(_0x418565,null));};exports[_0xb64f('0x49')]=function(_0x507405,_0x3e6df5){return db[_0xb64f('0x3f')]['create'](_0x507405['body'],{})[_0xb64f('0x23')](function(_0xa5f609){var _0x18ab56=_0x507405[_0xb64f('0x4a')][_0xb64f('0x25')]({'plain':!![]});if(!_0x18ab56)throw new Error(_0xb64f('0x4b'));if(_0x18ab56[_0xb64f('0x4c')]===_0xb64f('0x4a')){var _0x4b29f5=_0xa5f609[_0xb64f('0x25')]({'plain':!![]});var _0x56d883=_0xb64f('0x26');return db[_0xb64f('0x4d')][_0xb64f('0x48')]({'where':{'name':_0x56d883,'userProfileId':_0x18ab56['userProfileId']},'raw':!![]})[_0xb64f('0x23')](function(_0x403d3f){if(_0x403d3f&&_0x403d3f[_0xb64f('0x4e')]===0x0){return db[_0xb64f('0x27')][_0xb64f('0x49')]({'name':_0x4b29f5[_0xb64f('0x28')],'resourceId':_0x4b29f5['id'],'type':_0x403d3f['name'],'sectionId':_0x403d3f['id']},{})[_0xb64f('0x23')](function(){return _0xa5f609;});}else{return _0xa5f609;}})[_0xb64f('0x44')](function(_0x1a1299){logger[_0xb64f('0x4f')](_0xb64f('0x50'),_0x1a1299);throw _0x1a1299;});}return _0xa5f609;})['then'](respondWithResult(_0x3e6df5,0xc9))[_0xb64f('0x44')](handleError(_0x3e6df5,null));};exports['update']=function(_0x4af9e4,_0x1089df){if(_0x4af9e4[_0xb64f('0x51')]['id']){delete _0x4af9e4[_0xb64f('0x51')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x4af9e4[_0xb64f('0x46')]['id']}})[_0xb64f('0x23')](handleEntityNotFound(_0x1089df,null))[_0xb64f('0x23')](saveUpdates(_0x4af9e4['body'],null))[_0xb64f('0x23')](respondWithResult(_0x1089df,null))[_0xb64f('0x44')](handleError(_0x1089df,null));};exports[_0xb64f('0x24')]=function(_0x5282b8,_0xfc68bc){return db[_0xb64f('0x3f')][_0xb64f('0x48')]({'where':{'id':_0x5282b8[_0xb64f('0x46')]['id']}})[_0xb64f('0x23')](handleEntityNotFound(_0xfc68bc,null))[_0xb64f('0x23')](removeEntity(_0xfc68bc,null))[_0xb64f('0x44')](handleError(_0xfc68bc,null));};exports[_0xb64f('0x52')]=function(_0x337210,_0x4c26b2,_0xc8834a){var _0x5e50d8;return db[_0xb64f('0x3f')][_0xb64f('0x48')]({'where':{'id':_0x337210['params']['id']},'attributes':['id',_0xb64f('0x53')]})[_0xb64f('0x23')](handleEntityNotFound(_0x4c26b2,null))[_0xb64f('0x23')](function(_0x2bb83c){if(_0x2bb83c){var _0x13c6b5=require(_0xb64f('0x54'))();_0x13c6b5['openSync'](_0x2bb83c[_0xb64f('0x53')]);_0x13c6b5[_0xb64f('0x55')]();return _0x2bb83c;}})[_0xb64f('0x23')](respondWithResult(_0x4c26b2,null))['catch'](handleError(_0x4c26b2,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 90a808d..1d4dd7d 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 _0x2a3f=['./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x30d6f2,_0x1a205d){var _0x19700c=function(_0x4ae9fb){while(--_0x4ae9fb){_0x30d6f2['push'](_0x30d6f2['shift']());}};_0x19700c(++_0x1a205d);}(_0x2a3f,0x126));var _0xf2a3=function(_0x479650,_0x2bee99){_0x479650=_0x479650-0x0;var _0x26b288=_0x2a3f[_0x479650];return _0x26b288;};'use strict';var _=require(_0xf2a3('0x0'));var util=require('util');var logger=require(_0xf2a3('0x1'))(_0xf2a3('0x2'));var moment=require('moment');var BPromise=require(_0xf2a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2a3('0x4'));var rimraf=require(_0xf2a3('0x5'));var config=require('../../config/environment');var attributes=require(_0xf2a3('0x6'));module[_0xf2a3('0x7')]=function(_0x7c2b69,_0x164c20){return _0x7c2b69['define'](_0xf2a3('0x8'),attributes,{'tableName':_0xf2a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77fa=['SquareOdbc','square_odbc','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x421f4a,_0x4734b3){var _0x4751c1=function(_0x200654){while(--_0x200654){_0x421f4a['push'](_0x421f4a['shift']());}};_0x4751c1(++_0x4734b3);}(_0x77fa,0x1ee));var _0xa77f=function(_0x595fce,_0x21c512){_0x595fce=_0x595fce-0x0;var _0x18e06f=_0x77fa[_0x595fce];return _0x18e06f;};'use strict';var _=require(_0xa77f('0x0'));var util=require('util');var logger=require(_0xa77f('0x1'))('api');var moment=require(_0xa77f('0x2'));var BPromise=require('bluebird');var rp=require(_0xa77f('0x3'));var fs=require('fs');var path=require(_0xa77f('0x4'));var rimraf=require(_0xa77f('0x5'));var config=require(_0xa77f('0x6'));var attributes=require(_0xa77f('0x7'));module[_0xa77f('0x8')]=function(_0x119d46,_0x642af1){return _0x119d46[_0xa77f('0x9')](_0xa77f('0xa'),attributes,{'tableName':_0xa77f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 145bf6b..f646982 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x45f6cb,_0x531af6){var _0x5b7f93=function(_0x1296ba){while(--_0x1296ba){_0x45f6cb['push'](_0x45f6cb['shift']());}};_0x5b7f93(++_0x531af6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x5fc3[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _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(_0x1efb29,_0x41cd3b){var _0xae79e9=function(_0x59c502){while(--_0x59c502){_0x1efb29['push'](_0x1efb29['shift']());}};_0xae79e9(++_0x41cd3b);}(_0x008c,0x188));var _0xc008=function(_0x48f8c4,_0x4e3dba){_0x48f8c4=_0x48f8c4-0x0;var _0x118849=_0x008c[_0x48f8c4];return _0x118849;};'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 4c3972b..68e0ceb 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 _0xbee3=['destroy','removeUsers','exports','util','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','/:id','show','get','/:id/users','getUsers','create','post','addUsers','update','delete'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0xbee3,0xd5));var _0x3bee=function(_0x30e675,_0x4eebc7){_0x30e675=_0x30e675-0x0;var _0x258b27=_0xbee3[_0x30e675];return _0x258b27;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3bee('0x3'));var config=require(_0x3bee('0x4'));var controller=require(_0x3bee('0x5'));router['get']('/',auth[_0x3bee('0x6')](),controller[_0x3bee('0x7')]);router['get'](_0x3bee('0x8'),auth[_0x3bee('0x6')](),controller[_0x3bee('0x9')]);router[_0x3bee('0xa')](_0x3bee('0xb'),auth[_0x3bee('0x6')](),controller[_0x3bee('0xc')]);router['post']('/',auth[_0x3bee('0x6')](),controller[_0x3bee('0xd')]);router[_0x3bee('0xe')](_0x3bee('0xb'),auth[_0x3bee('0x6')](),controller[_0x3bee('0xf')]);router['put'](_0x3bee('0x8'),auth['isAuthenticated'](),controller[_0x3bee('0x10')]);router[_0x3bee('0x11')](_0x3bee('0x8'),auth[_0x3bee('0x6')](),controller[_0x3bee('0x12')]);router[_0x3bee('0x11')](_0x3bee('0xb'),auth['isAuthenticated'](),controller[_0x3bee('0x13')]);module[_0x3bee('0x14')]=router; \ No newline at end of file +var _0xf7b4=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','post','addUsers','put','destroy','delete','removeUsers','exports','multer','connect-timeout','express','../../components/interaction/service'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xf7b4,0x152));var _0x4f7b=function(_0x522eb8,_0xaf0729){_0x522eb8=_0x522eb8-0x0;var _0x32b68a=_0xf7b4[_0x522eb8];return _0x32b68a;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4f7b('0x3'));var config=require(_0x4f7b('0x4'));var controller=require(_0x4f7b('0x5'));router[_0x4f7b('0x6')]('/',auth[_0x4f7b('0x7')](),controller[_0x4f7b('0x8')]);router[_0x4f7b('0x6')](_0x4f7b('0x9'),auth[_0x4f7b('0x7')](),controller[_0x4f7b('0xa')]);router[_0x4f7b('0x6')](_0x4f7b('0xb'),auth[_0x4f7b('0x7')](),controller['getUsers']);router[_0x4f7b('0xc')]('/',auth[_0x4f7b('0x7')](),controller['create']);router[_0x4f7b('0xc')](_0x4f7b('0xb'),auth[_0x4f7b('0x7')](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0xe')]('/:id',auth[_0x4f7b('0x7')](),controller['update']);router['delete'](_0x4f7b('0x9'),auth[_0x4f7b('0x7')](),controller[_0x4f7b('0xf')]);router[_0x4f7b('0x10')]('/:id/users',auth[_0x4f7b('0x7')](),controller[_0x4f7b('0x11')]);module[_0x4f7b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index d120e2d..409e3c6 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 _0xf515=['exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0xf515,0xcb));var _0x5f51=function(_0x4eb9e5,_0x5b7e95){_0x4eb9e5=_0x4eb9e5-0x0;var _0x355e2f=_0xf515[_0x4eb9e5];return _0x355e2f;};'use strict';var Sequelize=require(_0x5f51('0x0'));module[_0x5f51('0x1')]={'name':{'type':Sequelize[_0x5f51('0x2')],'unique':_0x5f51('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x5f51('0x4')]},'preproduction':{'type':Sequelize[_0x5f51('0x5')](_0x5f51('0x6')),'get':function(){if(this[_0x5f51('0x7')](_0x5f51('0x8'))){return this[_0x5f51('0x7')](_0x5f51('0x8'))[_0x5f51('0x9')](_0x5f51('0xa'));}}},'production':{'type':Sequelize[_0x5f51('0x5')]('long'),'get':function(){if(this['getDataValue'](_0x5f51('0xb'))){return this[_0x5f51('0x7')]('production')[_0x5f51('0x9')](_0x5f51('0xa'));}}}}; \ No newline at end of file +var _0xeada=['STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize','exports'];(function(_0x3e8214,_0x563177){var _0x17e4ae=function(_0x82560f){while(--_0x82560f){_0x3e8214['push'](_0x3e8214['shift']());}};_0x17e4ae(++_0x563177);}(_0xeada,0x76));var _0xaead=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeada[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaead('0x0'));module[_0xaead('0x1')]={'name':{'type':Sequelize[_0xaead('0x2')],'unique':_0xaead('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xaead('0x4')]},'preproduction':{'type':Sequelize[_0xaead('0x5')](_0xaead('0x6')),'get':function(){if(this[_0xaead('0x7')](_0xaead('0x8'))){return this[_0xaead('0x7')](_0xaead('0x8'))[_0xaead('0x9')](_0xaead('0xa'));}}},'production':{'type':Sequelize[_0xaead('0x5')](_0xaead('0x6')),'get':function(){if(this[_0xaead('0x7')](_0xaead('0xb'))){return this[_0xaead('0x7')]('production')['toString'](_0xaead('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index e24bc25..08dec6f 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 _0xf874=['util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','SquareProject','findAll','rows','catch','show','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xf874,0x1dd));var _0x4f87=function(_0x28679a,_0x4221d2){_0x28679a=_0x28679a-0x0;var _0x2edea6=_0xf874[_0x28679a];return _0x2edea6;};'use strict';var pdf=require(_0x4f87('0x0'));var emlformat=require(_0x4f87('0x1'));var rimraf=require(_0x4f87('0x2'));var zipdir=require(_0x4f87('0x3'));var jsonpatch=require(_0x4f87('0x4'));var rp=require(_0x4f87('0x5'));var moment=require(_0x4f87('0x6'));var BPromise=require(_0x4f87('0x7'));var Mustache=require('mustache');var util=require(_0x4f87('0x8'));var path=require(_0x4f87('0x9'));var sox=require(_0x4f87('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f87('0xb'));var squel=require(_0x4f87('0xc'));var crypto=require(_0x4f87('0xd'));var jsforce=require(_0x4f87('0xe'));var deskjs=require(_0x4f87('0xf'));var toCsv=require(_0x4f87('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4f87('0x11'));var authService=require(_0x4f87('0x12'));var qs=require(_0x4f87('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f87('0x14'))('api');var utils=require(_0x4f87('0x15'));var config=require(_0x4f87('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4f87('0x17')](config[_0x4f87('0x18')],{'host':_0x4f87('0x19'),'port':0x18eb});var socket=require(_0x4f87('0x1a'))(new Redis(config[_0x4f87('0x18')]));require(_0x4f87('0x1b'))['register'](socket);function respondWithStatusCode(_0x15d586,_0x4ae348){_0x4ae348=_0x4ae348||0xcc;return function(_0x4eada5){if(_0x4eada5){return _0x15d586[_0x4f87('0x1c')](_0x4ae348);}return _0x15d586[_0x4f87('0x1d')](_0x4ae348)[_0x4f87('0x1e')]();};}function respondWithResult(_0x2c2c48,_0x3ab717){_0x3ab717=_0x3ab717||0xc8;return function(_0x450661){if(_0x450661){return _0x2c2c48[_0x4f87('0x1d')](_0x3ab717)[_0x4f87('0x1f')](_0x450661);}};}function respondWithFilteredResult(_0x5301b3,_0x546973){return function(_0x11ae04){if(_0x11ae04){var _0x8c683b=_0x11ae04[_0x4f87('0x20')],_0x3441dc=_0x546973['offset'],_0x1506c4=_0x546973[_0x4f87('0x21')]+_0x546973[_0x4f87('0x22')],_0x3aaf67;if(_0x1506c4>=_0x8c683b){_0x1506c4=_0x8c683b;_0x3aaf67=0xc8;}else{_0x3aaf67=0xce;}_0x5301b3[_0x4f87('0x1d')](_0x3aaf67);return _0x5301b3[_0x4f87('0x23')](_0x4f87('0x24'),_0x3441dc+'-'+_0x1506c4+'/'+_0x8c683b)[_0x4f87('0x1f')](_0x11ae04);}return null;};}function patchUpdates(_0x58a606){return function(_0x5dbc9e){try{jsonpatch['apply'](_0x5dbc9e,_0x58a606,!![]);}catch(_0x10d875){return BPromise['reject'](_0x10d875);}return _0x5dbc9e[_0x4f87('0x25')]();};}function saveUpdates(_0x32d869,_0x589fa3){return function(_0x5875f7){if(_0x5875f7){return _0x5875f7[_0x4f87('0x26')](_0x32d869)[_0x4f87('0x27')](function(_0x34a6bc){return _0x34a6bc;});}return null;};}function removeEntity(_0xe2f977,_0x49ee5e){return function(_0xa31c10){if(_0xa31c10){return _0xa31c10[_0x4f87('0x28')]()[_0x4f87('0x27')](function(){var _0xaf40e7=_0xa31c10[_0x4f87('0x29')]({'plain':!![]});var _0x1f659a='SquareProjects';return db['UserProfileResource'][_0x4f87('0x28')]({'where':{'type':_0x1f659a,'resourceId':_0xaf40e7['id']}})['then'](function(){return _0xa31c10;});})[_0x4f87('0x27')](function(){_0xe2f977['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a625,_0x304348){return function(_0x381fba){if(!_0x381fba){_0x45a625[_0x4f87('0x1c')](0x194);}return _0x381fba;};}function handleError(_0x4e670e,_0x5ea42b){_0x5ea42b=_0x5ea42b||0x1f4;return function(_0x219dd0){logger[_0x4f87('0x2a')](_0x219dd0[_0x4f87('0x2b')]);if(_0x219dd0[_0x4f87('0x2c')]){delete _0x219dd0[_0x4f87('0x2c')];}_0x4e670e[_0x4f87('0x1d')](_0x5ea42b)[_0x4f87('0x2d')](_0x219dd0);};}exports[_0x4f87('0x2e')]=function(_0x131494,_0x108206){var _0x284233={},_0x39d782={},_0xa1f2e1={'count':0x0,'rows':[]};var _0x46777f=_['map'](db['SquareProject'][_0x4f87('0x2f')],function(_0x42c574){return{'name':_0x42c574[_0x4f87('0x30')],'type':_0x42c574['type'][_0x4f87('0x31')]};});_0x39d782[_0x4f87('0x32')]=_['map'](_0x46777f,'name');_0x39d782[_0x4f87('0x33')]=_[_0x4f87('0x34')](_0x131494[_0x4f87('0x33')]);_0x39d782[_0x4f87('0x35')]=_['intersection'](_0x39d782['model'],_0x39d782['query']);_0x284233[_0x4f87('0x36')]=_[_0x4f87('0x37')](_0x39d782[_0x4f87('0x32')],qs[_0x4f87('0x38')](_0x131494['query'][_0x4f87('0x38')]));_0x284233[_0x4f87('0x36')]=_0x284233[_0x4f87('0x36')][_0x4f87('0x39')]?_0x284233['attributes']:_0x39d782[_0x4f87('0x32')];if(!_0x131494[_0x4f87('0x33')]['hasOwnProperty']('nolimit')){_0x284233[_0x4f87('0x22')]=qs[_0x4f87('0x22')](_0x131494['query'][_0x4f87('0x22')]);_0x284233[_0x4f87('0x21')]=qs['offset'](_0x131494[_0x4f87('0x33')][_0x4f87('0x21')]);}_0x284233[_0x4f87('0x3a')]=qs[_0x4f87('0x3b')](_0x131494[_0x4f87('0x33')]['sort']);_0x284233[_0x4f87('0x3c')]=qs[_0x4f87('0x35')](_[_0x4f87('0x3d')](_0x131494[_0x4f87('0x33')],_0x39d782[_0x4f87('0x35')]),_0x46777f);if(_0x131494[_0x4f87('0x33')]['filter']){_0x284233['where']=_[_0x4f87('0x3e')](_0x284233[_0x4f87('0x3c')],{'$or':_[_0x4f87('0x3f')](_0x46777f,function(_0x593cf2){if(_0x593cf2['type']!==_0x4f87('0x40')){var _0x3b522e={};_0x3b522e[_0x593cf2[_0x4f87('0x2c')]]={'$like':'%'+_0x131494[_0x4f87('0x33')][_0x4f87('0x41')]+'%'};return _0x3b522e;}})});}_0x284233=_[_0x4f87('0x3e')]({},_0x284233,_0x131494[_0x4f87('0x42')]);var _0x1e3c0b={'where':_0x284233['where']};return db['SquareProject']['count'](_0x1e3c0b)['then'](function(_0x2f3435){_0xa1f2e1[_0x4f87('0x20')]=_0x2f3435;if(_0x131494[_0x4f87('0x33')][_0x4f87('0x43')]){_0x284233['include']=[{'all':!![]}];}return db[_0x4f87('0x44')][_0x4f87('0x45')](_0x284233);})[_0x4f87('0x27')](function(_0x527269){_0xa1f2e1[_0x4f87('0x46')]=_0x527269;return _0xa1f2e1;})[_0x4f87('0x27')](respondWithFilteredResult(_0x108206,_0x284233))[_0x4f87('0x47')](handleError(_0x108206,null));};exports[_0x4f87('0x48')]=function(_0x31ddec,_0x569baf){var _0x2a901f={'raw':![],'where':{'id':_0x31ddec['params']['id']}},_0x255f44={};_0x255f44[_0x4f87('0x32')]=_[_0x4f87('0x34')](db['SquareProject'][_0x4f87('0x2f')]);_0x255f44[_0x4f87('0x33')]=_[_0x4f87('0x34')](_0x31ddec[_0x4f87('0x33')]);_0x255f44[_0x4f87('0x35')]=_[_0x4f87('0x37')](_0x255f44['model'],_0x255f44[_0x4f87('0x33')]);_0x2a901f['attributes']=_[_0x4f87('0x37')](_0x255f44[_0x4f87('0x32')],qs[_0x4f87('0x38')](_0x31ddec[_0x4f87('0x33')][_0x4f87('0x38')]));_0x2a901f[_0x4f87('0x36')]=_0x2a901f[_0x4f87('0x36')][_0x4f87('0x39')]?_0x2a901f[_0x4f87('0x36')]:_0x255f44['model'];if(_0x31ddec['query'][_0x4f87('0x43')]){_0x2a901f[_0x4f87('0x49')]=[{'all':!![]}];}_0x2a901f=_['merge']({},_0x2a901f,_0x31ddec[_0x4f87('0x42')]);return db[_0x4f87('0x44')]['find'](_0x2a901f)['then'](handleEntityNotFound(_0x569baf,null))[_0x4f87('0x27')](respondWithResult(_0x569baf,null))[_0x4f87('0x47')](handleError(_0x569baf,null));};exports[_0x4f87('0x4a')]=function(_0x1e2676,_0x1cf8c5){return db[_0x4f87('0x44')]['create'](_0x1e2676[_0x4f87('0x4b')],{})['then'](function(_0x17e5a0){var _0x455557=_0x1e2676['user'][_0x4f87('0x29')]({'plain':!![]});if(!_0x455557)throw new Error(_0x4f87('0x4c'));if(_0x455557[_0x4f87('0x4d')]===_0x4f87('0x4e')){var _0x3ccd39=_0x17e5a0[_0x4f87('0x29')]({'plain':!![]});var _0xebb5eb=_0x4f87('0x4f');return db[_0x4f87('0x50')]['find']({'where':{'name':_0xebb5eb,'userProfileId':_0x455557[_0x4f87('0x51')]},'raw':!![]})[_0x4f87('0x27')](function(_0x22bbfa){if(_0x22bbfa&&_0x22bbfa[_0x4f87('0x52')]===0x0){return db[_0x4f87('0x53')][_0x4f87('0x4a')]({'name':_0x3ccd39['name'],'resourceId':_0x3ccd39['id'],'type':_0x22bbfa['name'],'sectionId':_0x22bbfa['id']},{})['then'](function(){return _0x17e5a0;});}else{return _0x17e5a0;}})[_0x4f87('0x47')](function(_0x469246){logger[_0x4f87('0x2a')](_0x4f87('0x54'),_0x469246);throw _0x469246;});}return _0x17e5a0;})['then'](respondWithResult(_0x1cf8c5,0xc9))[_0x4f87('0x47')](handleError(_0x1cf8c5,null));};exports['update']=function(_0x4215cb,_0x5cabb8){if(_0x4215cb[_0x4f87('0x4b')]['id']){delete _0x4215cb[_0x4f87('0x4b')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x4215cb[_0x4f87('0x55')]['id']}})[_0x4f87('0x27')](handleEntityNotFound(_0x5cabb8,null))['then'](saveUpdates(_0x4215cb[_0x4f87('0x4b')],null))[_0x4f87('0x27')](respondWithResult(_0x5cabb8,null))[_0x4f87('0x47')](handleError(_0x5cabb8,null));};exports[_0x4f87('0x28')]=function(_0x66b9f0,_0x11ab06){return db['SquareProject'][_0x4f87('0x56')]({'where':{'id':_0x66b9f0[_0x4f87('0x55')]['id']}})[_0x4f87('0x27')](handleEntityNotFound(_0x11ab06,null))[_0x4f87('0x27')](removeEntity(_0x11ab06,null))[_0x4f87('0x47')](handleError(_0x11ab06,null));};exports[_0x4f87('0x57')]=function(_0x201561,_0x290c83,_0x4576e7){return db[_0x4f87('0x44')][_0x4f87('0x56')]({'where':{'id':_0x201561[_0x4f87('0x55')]['id']}})['then'](handleEntityNotFound(_0x290c83,null))[_0x4f87('0x27')](function(_0x2bea65){if(_0x2bea65){return _0x2bea65[_0x4f87('0x57')](_0x201561['body'][_0x4f87('0x58')],_['omit'](_0x201561[_0x4f87('0x4b')],[_0x4f87('0x58'),'id'])||{});}})['then'](respondWithResult(_0x290c83,null))[_0x4f87('0x47')](handleError(_0x290c83,null));};exports[_0x4f87('0x59')]=function(_0xcc2141,_0x12af39,_0x5b7868){return db['SquareProject'][_0x4f87('0x56')]({'where':{'id':_0xcc2141[_0x4f87('0x55')]['id']}})[_0x4f87('0x27')](handleEntityNotFound(_0x12af39,null))[_0x4f87('0x27')](function(_0x2d12a9){if(_0x2d12a9){return _0x2d12a9['removeUsers'](_0xcc2141[_0x4f87('0x33')][_0x4f87('0x58')])[_0x4f87('0x27')](function(){if(_[_0x4f87('0x5a')](_0xcc2141[_0x4f87('0x33')][_0x4f87('0x58')])){for(var _0x1d6d7c=0x0;_0x1d6d7c<_0xcc2141['query']['ids'][_0x4f87('0x39')];_0x1d6d7c+=0x1){socket[_0x4f87('0x5b')](_0x4f87('0x5c'),{'UserId':Number(_0xcc2141[_0x4f87('0x33')][_0x4f87('0x58')][_0x1d6d7c]),'SquareProjectId':Number(_0xcc2141[_0x4f87('0x55')]['id'])});}}else{socket[_0x4f87('0x5b')](_0x4f87('0x5c'),{'UserId':Number(_0xcc2141['query'][_0x4f87('0x58')]),'SquareProjectId':Number(_0xcc2141[_0x4f87('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x12af39,null))[_0x4f87('0x47')](handleError(_0x12af39,null));};exports[_0x4f87('0x5d')]=function(_0x314578,_0x5a1903,_0x1ed052){var _0x1def6b={};var _0x21e417={};var _0xa739c0;var _0x2cd726;return db['SquareProject']['findOne']({'where':{'id':_0x314578[_0x4f87('0x55')]['id']}})[_0x4f87('0x27')](handleEntityNotFound(_0x5a1903,null))['then'](function(_0x7dcde){if(_0x7dcde){_0xa739c0=_0x7dcde;_0x21e417[_0x4f87('0x32')]=_['keys'](db[_0x4f87('0x5e')][_0x4f87('0x2f')]);_0x21e417[_0x4f87('0x33')]=_[_0x4f87('0x34')](_0x314578['query']);_0x21e417[_0x4f87('0x35')]=_[_0x4f87('0x37')](_0x21e417[_0x4f87('0x32')],_0x21e417['query']);_0x1def6b['attributes']=_[_0x4f87('0x37')](_0x21e417[_0x4f87('0x32')],qs[_0x4f87('0x38')](_0x314578['query']['fields']));_0x1def6b[_0x4f87('0x36')]=_0x1def6b[_0x4f87('0x36')][_0x4f87('0x39')]?_0x1def6b[_0x4f87('0x36')]:_0x21e417['model'];_0x1def6b[_0x4f87('0x3a')]=qs[_0x4f87('0x3b')](_0x314578[_0x4f87('0x33')][_0x4f87('0x3b')]);_0x1def6b[_0x4f87('0x3c')]=qs[_0x4f87('0x35')](_[_0x4f87('0x3d')](_0x314578[_0x4f87('0x33')],_0x21e417[_0x4f87('0x35')]));if(_0x314578[_0x4f87('0x33')][_0x4f87('0x41')]){_0x1def6b[_0x4f87('0x3c')]=_[_0x4f87('0x3e')](_0x1def6b[_0x4f87('0x3c')],{'$or':_[_0x4f87('0x3f')](_0x1def6b[_0x4f87('0x36')],function(_0x44c79a){var _0x585dbf={};_0x585dbf[_0x44c79a]={'$like':'%'+_0x314578[_0x4f87('0x33')]['filter']+'%'};return _0x585dbf;})});}_0x1def6b=_[_0x4f87('0x3e')]({},_0x1def6b,_0x314578[_0x4f87('0x42')]);return _0xa739c0[_0x4f87('0x5d')](_0x1def6b);}})[_0x4f87('0x27')](function(_0xbe9277){if(_0xbe9277){_0x2cd726=_0xbe9277[_0x4f87('0x39')];if(!_0x314578['query'][_0x4f87('0x5f')](_0x4f87('0x60'))){_0x1def6b[_0x4f87('0x22')]=qs['limit'](_0x314578['query']['limit']);_0x1def6b[_0x4f87('0x21')]=qs['offset'](_0x314578[_0x4f87('0x33')][_0x4f87('0x21')]);}return _0xa739c0[_0x4f87('0x5d')](_0x1def6b);}})[_0x4f87('0x27')](function(_0x10e0bf){if(_0x10e0bf){return _0x10e0bf?{'count':_0x2cd726,'rows':_0x10e0bf}:null;}})[_0x4f87('0x27')](respondWithResult(_0x5a1903,null))[_0x4f87('0x47')](handleError(_0x5a1903,null));}; \ No newline at end of file +var _0x13a8=['../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','then','destroy','get','SquareProjects','UserProfileResource','stack','name','index','map','SquareProject','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','removeUsers','isArray','userSquareProject:remove','getUsers','findOne','order','sort','pick','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x76afcc,_0x22f653){var _0x1a1cae=function(_0x5983d0){while(--_0x5983d0){_0x76afcc['push'](_0x76afcc['shift']());}};_0x1a1cae(++_0x22f653);}(_0x13a8,0xa3));var _0x813a=function(_0x28f2e6,_0x1d1fb7){_0x28f2e6=_0x28f2e6-0x0;var _0x2e16f6=_0x13a8[_0x28f2e6];return _0x2e16f6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x813a('0x0'));var rimraf=require(_0x813a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x813a('0x2'));var moment=require(_0x813a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x813a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x813a('0x5'));var csv=require(_0x813a('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x813a('0x7'));var squel=require(_0x813a('0x8'));var crypto=require('crypto');var jsforce=require(_0x813a('0x9'));var deskjs=require(_0x813a('0xa'));var toCsv=require(_0x813a('0x6'));var querystring=require(_0x813a('0xb'));var Papa=require(_0x813a('0xc'));var Redis=require(_0x813a('0xd'));var authService=require(_0x813a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x813a('0xf'));var hardwareService=require(_0x813a('0x10'));var logger=require(_0x813a('0x11'))('api');var utils=require(_0x813a('0x12'));var config=require(_0x813a('0x13'));var db=require(_0x813a('0x14'))['db'];config['redis']=_[_0x813a('0x15')](config[_0x813a('0x16')],{'host':_0x813a('0x17'),'port':0x18eb});var socket=require(_0x813a('0x18'))(new Redis(config[_0x813a('0x16')]));require(_0x813a('0x19'))[_0x813a('0x1a')](socket);function respondWithStatusCode(_0x1891aa,_0x5905a3){_0x5905a3=_0x5905a3||0xcc;return function(_0x417ce){if(_0x417ce){return _0x1891aa[_0x813a('0x1b')](_0x5905a3);}return _0x1891aa[_0x813a('0x1c')](_0x5905a3)[_0x813a('0x1d')]();};}function respondWithResult(_0x531f43,_0x33a08f){_0x33a08f=_0x33a08f||0xc8;return function(_0x36ff65){if(_0x36ff65){return _0x531f43[_0x813a('0x1c')](_0x33a08f)['json'](_0x36ff65);}};}function respondWithFilteredResult(_0x5c37a1,_0x487560){return function(_0x4066c3){if(_0x4066c3){var _0x52b08b=_0x4066c3[_0x813a('0x1e')],_0x11160a=_0x487560[_0x813a('0x1f')],_0x2ecaf6=_0x487560[_0x813a('0x1f')]+_0x487560[_0x813a('0x20')],_0x588317;if(_0x2ecaf6>=_0x52b08b){_0x2ecaf6=_0x52b08b;_0x588317=0xc8;}else{_0x588317=0xce;}_0x5c37a1[_0x813a('0x1c')](_0x588317);return _0x5c37a1[_0x813a('0x21')](_0x813a('0x22'),_0x11160a+'-'+_0x2ecaf6+'/'+_0x52b08b)[_0x813a('0x23')](_0x4066c3);}return null;};}function patchUpdates(_0x20bf79){return function(_0x50fd03){try{jsonpatch['apply'](_0x50fd03,_0x20bf79,!![]);}catch(_0x5619a7){return BPromise['reject'](_0x5619a7);}return _0x50fd03[_0x813a('0x24')]();};}function saveUpdates(_0x4140de,_0x16bb71){return function(_0x557d01){if(_0x557d01){return _0x557d01['update'](_0x4140de)[_0x813a('0x25')](function(_0x1f3dfa){return _0x1f3dfa;});}return null;};}function removeEntity(_0x30412e,_0x2198d4){return function(_0x9a1f76){if(_0x9a1f76){return _0x9a1f76[_0x813a('0x26')]()[_0x813a('0x25')](function(){var _0x388651=_0x9a1f76[_0x813a('0x27')]({'plain':!![]});var _0x13a268=_0x813a('0x28');return db[_0x813a('0x29')][_0x813a('0x26')]({'where':{'type':_0x13a268,'resourceId':_0x388651['id']}})[_0x813a('0x25')](function(){return _0x9a1f76;});})[_0x813a('0x25')](function(){_0x30412e[_0x813a('0x1c')](0xcc)[_0x813a('0x1d')]();});}};}function handleEntityNotFound(_0x2f1c4b,_0x291a09){return function(_0x188185){if(!_0x188185){_0x2f1c4b['sendStatus'](0x194);}return _0x188185;};}function handleError(_0x1c59d3,_0x183c2d){_0x183c2d=_0x183c2d||0x1f4;return function(_0x571fa7){logger['error'](_0x571fa7[_0x813a('0x2a')]);if(_0x571fa7[_0x813a('0x2b')]){delete _0x571fa7[_0x813a('0x2b')];}_0x1c59d3['status'](_0x183c2d)['send'](_0x571fa7);};}exports[_0x813a('0x2c')]=function(_0x2e0fee,_0x2abbde){var _0x5bc36d={},_0x27c06a={},_0x283ccc={'count':0x0,'rows':[]};var _0x200bef=_[_0x813a('0x2d')](db[_0x813a('0x2e')][_0x813a('0x2f')],function(_0x29af67){return{'name':_0x29af67['fieldName'],'type':_0x29af67[_0x813a('0x30')][_0x813a('0x31')]};});_0x27c06a['model']=_['map'](_0x200bef,_0x813a('0x2b'));_0x27c06a[_0x813a('0x32')]=_[_0x813a('0x33')](_0x2e0fee[_0x813a('0x32')]);_0x27c06a[_0x813a('0x34')]=_[_0x813a('0x35')](_0x27c06a['model'],_0x27c06a['query']);_0x5bc36d[_0x813a('0x36')]=_[_0x813a('0x35')](_0x27c06a[_0x813a('0x37')],qs[_0x813a('0x38')](_0x2e0fee[_0x813a('0x32')][_0x813a('0x38')]));_0x5bc36d[_0x813a('0x36')]=_0x5bc36d[_0x813a('0x36')][_0x813a('0x39')]?_0x5bc36d['attributes']:_0x27c06a[_0x813a('0x37')];if(!_0x2e0fee['query'][_0x813a('0x3a')](_0x813a('0x3b'))){_0x5bc36d[_0x813a('0x20')]=qs['limit'](_0x2e0fee[_0x813a('0x32')][_0x813a('0x20')]);_0x5bc36d[_0x813a('0x1f')]=qs[_0x813a('0x1f')](_0x2e0fee['query']['offset']);}_0x5bc36d['order']=qs['sort'](_0x2e0fee[_0x813a('0x32')]['sort']);_0x5bc36d[_0x813a('0x3c')]=qs['filters'](_['pick'](_0x2e0fee['query'],_0x27c06a[_0x813a('0x34')]),_0x200bef);if(_0x2e0fee['query'][_0x813a('0x3d')]){_0x5bc36d[_0x813a('0x3c')]=_[_0x813a('0x3e')](_0x5bc36d[_0x813a('0x3c')],{'$or':_[_0x813a('0x2d')](_0x200bef,function(_0x5e3e9f){if(_0x5e3e9f[_0x813a('0x30')]!==_0x813a('0x3f')){var _0xee290a={};_0xee290a[_0x5e3e9f[_0x813a('0x2b')]]={'$like':'%'+_0x2e0fee[_0x813a('0x32')][_0x813a('0x3d')]+'%'};return _0xee290a;}})});}_0x5bc36d=_['merge']({},_0x5bc36d,_0x2e0fee['options']);var _0x3dc048={'where':_0x5bc36d[_0x813a('0x3c')]};return db['SquareProject'][_0x813a('0x1e')](_0x3dc048)[_0x813a('0x25')](function(_0x4c13fb){_0x283ccc['count']=_0x4c13fb;if(_0x2e0fee['query'][_0x813a('0x40')]){_0x5bc36d['include']=[{'all':!![]}];}return db[_0x813a('0x2e')][_0x813a('0x41')](_0x5bc36d);})['then'](function(_0x24cf9c){_0x283ccc[_0x813a('0x42')]=_0x24cf9c;return _0x283ccc;})[_0x813a('0x25')](respondWithFilteredResult(_0x2abbde,_0x5bc36d))[_0x813a('0x43')](handleError(_0x2abbde,null));};exports['show']=function(_0x124dc8,_0x340b4c){var _0x402b8f={'raw':![],'where':{'id':_0x124dc8[_0x813a('0x44')]['id']}},_0x266ccd={};_0x266ccd['model']=_[_0x813a('0x33')](db[_0x813a('0x2e')][_0x813a('0x2f')]);_0x266ccd[_0x813a('0x32')]=_[_0x813a('0x33')](_0x124dc8['query']);_0x266ccd[_0x813a('0x34')]=_[_0x813a('0x35')](_0x266ccd[_0x813a('0x37')],_0x266ccd[_0x813a('0x32')]);_0x402b8f[_0x813a('0x36')]=_[_0x813a('0x35')](_0x266ccd[_0x813a('0x37')],qs[_0x813a('0x38')](_0x124dc8[_0x813a('0x32')][_0x813a('0x38')]));_0x402b8f[_0x813a('0x36')]=_0x402b8f['attributes'][_0x813a('0x39')]?_0x402b8f[_0x813a('0x36')]:_0x266ccd[_0x813a('0x37')];if(_0x124dc8[_0x813a('0x32')]['includeAll']){_0x402b8f[_0x813a('0x45')]=[{'all':!![]}];}_0x402b8f=_[_0x813a('0x3e')]({},_0x402b8f,_0x124dc8[_0x813a('0x46')]);return db[_0x813a('0x2e')][_0x813a('0x47')](_0x402b8f)['then'](handleEntityNotFound(_0x340b4c,null))[_0x813a('0x25')](respondWithResult(_0x340b4c,null))[_0x813a('0x43')](handleError(_0x340b4c,null));};exports[_0x813a('0x48')]=function(_0x4adc9d,_0x28b947){return db['SquareProject'][_0x813a('0x48')](_0x4adc9d[_0x813a('0x49')],{})[_0x813a('0x25')](function(_0x2563bc){var _0x3c3b06=_0x4adc9d[_0x813a('0x4a')]['get']({'plain':!![]});if(!_0x3c3b06)throw new Error(_0x813a('0x4b'));if(_0x3c3b06[_0x813a('0x4c')]===_0x813a('0x4a')){var _0x37d165=_0x2563bc[_0x813a('0x27')]({'plain':!![]});var _0x1316f7=_0x813a('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1316f7,'userProfileId':_0x3c3b06['userProfileId']},'raw':!![]})[_0x813a('0x25')](function(_0x243af7){if(_0x243af7&&_0x243af7[_0x813a('0x4d')]===0x0){return db[_0x813a('0x29')][_0x813a('0x48')]({'name':_0x37d165[_0x813a('0x2b')],'resourceId':_0x37d165['id'],'type':_0x243af7[_0x813a('0x2b')],'sectionId':_0x243af7['id']},{})['then'](function(){return _0x2563bc;});}else{return _0x2563bc;}})['catch'](function(_0x1e50a2){logger[_0x813a('0x4e')](_0x813a('0x4f'),_0x1e50a2);throw _0x1e50a2;});}return _0x2563bc;})[_0x813a('0x25')](respondWithResult(_0x28b947,0xc9))[_0x813a('0x43')](handleError(_0x28b947,null));};exports[_0x813a('0x50')]=function(_0x58dcb7,_0x202ba0){if(_0x58dcb7[_0x813a('0x49')]['id']){delete _0x58dcb7['body']['id'];}return db[_0x813a('0x2e')][_0x813a('0x47')]({'where':{'id':_0x58dcb7['params']['id']}})[_0x813a('0x25')](handleEntityNotFound(_0x202ba0,null))[_0x813a('0x25')](saveUpdates(_0x58dcb7[_0x813a('0x49')],null))[_0x813a('0x25')](respondWithResult(_0x202ba0,null))[_0x813a('0x43')](handleError(_0x202ba0,null));};exports[_0x813a('0x26')]=function(_0x83fc5e,_0x593f43){return db[_0x813a('0x2e')]['find']({'where':{'id':_0x83fc5e[_0x813a('0x44')]['id']}})[_0x813a('0x25')](handleEntityNotFound(_0x593f43,null))[_0x813a('0x25')](removeEntity(_0x593f43,null))[_0x813a('0x43')](handleError(_0x593f43,null));};exports[_0x813a('0x51')]=function(_0x902fdc,_0x2fbc61,_0x1ea50d){return db['SquareProject'][_0x813a('0x47')]({'where':{'id':_0x902fdc[_0x813a('0x44')]['id']}})['then'](handleEntityNotFound(_0x2fbc61,null))['then'](function(_0x682661){if(_0x682661){return _0x682661[_0x813a('0x51')](_0x902fdc[_0x813a('0x49')][_0x813a('0x52')],_['omit'](_0x902fdc[_0x813a('0x49')],[_0x813a('0x52'),'id'])||{});}})[_0x813a('0x25')](respondWithResult(_0x2fbc61,null))['catch'](handleError(_0x2fbc61,null));};exports[_0x813a('0x53')]=function(_0x79d92e,_0x17eb4d,_0x3882e9){return db[_0x813a('0x2e')][_0x813a('0x47')]({'where':{'id':_0x79d92e[_0x813a('0x44')]['id']}})[_0x813a('0x25')](handleEntityNotFound(_0x17eb4d,null))[_0x813a('0x25')](function(_0x15f6c5){if(_0x15f6c5){return _0x15f6c5[_0x813a('0x53')](_0x79d92e[_0x813a('0x32')][_0x813a('0x52')])[_0x813a('0x25')](function(){if(_[_0x813a('0x54')](_0x79d92e[_0x813a('0x32')]['ids'])){for(var _0x4ec4e3=0x0;_0x4ec4e3<_0x79d92e[_0x813a('0x32')][_0x813a('0x52')][_0x813a('0x39')];_0x4ec4e3+=0x1){socket['emit'](_0x813a('0x55'),{'UserId':Number(_0x79d92e[_0x813a('0x32')][_0x813a('0x52')][_0x4ec4e3]),'SquareProjectId':Number(_0x79d92e[_0x813a('0x44')]['id'])});}}else{socket['emit'](_0x813a('0x55'),{'UserId':Number(_0x79d92e[_0x813a('0x32')][_0x813a('0x52')]),'SquareProjectId':Number(_0x79d92e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x17eb4d,null))[_0x813a('0x43')](handleError(_0x17eb4d,null));};exports[_0x813a('0x56')]=function(_0x302bfe,_0x583258,_0x4f6605){var _0x5edb74={};var _0xd45f5d={};var _0x2cc3b7;var _0x4cc65e;return db[_0x813a('0x2e')][_0x813a('0x57')]({'where':{'id':_0x302bfe[_0x813a('0x44')]['id']}})[_0x813a('0x25')](handleEntityNotFound(_0x583258,null))['then'](function(_0x5dbbff){if(_0x5dbbff){_0x2cc3b7=_0x5dbbff;_0xd45f5d[_0x813a('0x37')]=_['keys'](db['User'][_0x813a('0x2f')]);_0xd45f5d['query']=_[_0x813a('0x33')](_0x302bfe['query']);_0xd45f5d[_0x813a('0x34')]=_[_0x813a('0x35')](_0xd45f5d[_0x813a('0x37')],_0xd45f5d[_0x813a('0x32')]);_0x5edb74[_0x813a('0x36')]=_[_0x813a('0x35')](_0xd45f5d[_0x813a('0x37')],qs[_0x813a('0x38')](_0x302bfe[_0x813a('0x32')]['fields']));_0x5edb74['attributes']=_0x5edb74[_0x813a('0x36')][_0x813a('0x39')]?_0x5edb74[_0x813a('0x36')]:_0xd45f5d['model'];_0x5edb74[_0x813a('0x58')]=qs[_0x813a('0x59')](_0x302bfe[_0x813a('0x32')][_0x813a('0x59')]);_0x5edb74[_0x813a('0x3c')]=qs[_0x813a('0x34')](_[_0x813a('0x5a')](_0x302bfe['query'],_0xd45f5d[_0x813a('0x34')]));if(_0x302bfe[_0x813a('0x32')][_0x813a('0x3d')]){_0x5edb74[_0x813a('0x3c')]=_['merge'](_0x5edb74[_0x813a('0x3c')],{'$or':_['map'](_0x5edb74['attributes'],function(_0x341bad){var _0x50d36e={};_0x50d36e[_0x341bad]={'$like':'%'+_0x302bfe[_0x813a('0x32')][_0x813a('0x3d')]+'%'};return _0x50d36e;})});}_0x5edb74=_[_0x813a('0x3e')]({},_0x5edb74,_0x302bfe[_0x813a('0x46')]);return _0x2cc3b7['getUsers'](_0x5edb74);}})['then'](function(_0x2edbdb){if(_0x2edbdb){_0x4cc65e=_0x2edbdb['length'];if(!_0x302bfe[_0x813a('0x32')][_0x813a('0x3a')](_0x813a('0x3b'))){_0x5edb74[_0x813a('0x20')]=qs[_0x813a('0x20')](_0x302bfe[_0x813a('0x32')][_0x813a('0x20')]);_0x5edb74['offset']=qs['offset'](_0x302bfe[_0x813a('0x32')][_0x813a('0x1f')]);}return _0x2cc3b7['getUsers'](_0x5edb74);}})['then'](function(_0x4533fc){if(_0x4533fc){return _0x4533fc?{'count':_0x4cc65e,'rows':_0x4533fc}:null;}})[_0x813a('0x25')](respondWithResult(_0x583258,null))[_0x813a('0x43')](handleError(_0x583258,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a89d3ce..e212d8d 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 _0x9f94=['exports','events','../../mysqldb','SquareProject','update','remove','emit','hasOwnProperty','hook'];(function(_0x33ef98,_0x5ed445){var _0x19d2d1=function(_0x343da0){while(--_0x343da0){_0x33ef98['push'](_0x33ef98['shift']());}};_0x19d2d1(++_0x5ed445);}(_0x9f94,0x1e7));var _0x49f9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9f94[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x49f9('0x0'));var SquareProject=require(_0x49f9('0x1'))['db'][_0x49f9('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x49f9('0x3'),'afterDestroy':_0x49f9('0x4')};function emitEvent(_0xb643ef){return function(_0x375856,_0x18492d,_0x483eed){SquareProjectEvents[_0x49f9('0x5')](_0xb643ef+':'+_0x375856['id'],_0x375856);SquareProjectEvents[_0x49f9('0x5')](_0xb643ef,_0x375856);_0x483eed(null);};}for(var e in events){if(events[_0x49f9('0x6')](e)){var event=events[e];SquareProject[_0x49f9('0x7')](e,emitEvent(event));}}module[_0x49f9('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xcafb=['update','remove','emit','exports','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcafb,0x16c));var _0xbcaf=function(_0x38512d,_0xfe6fc3){_0x38512d=_0x38512d-0x0;var _0x2a8ec8=_0xcafb[_0x38512d];return _0x2a8ec8;};'use strict';var EventEmitter=require(_0xbcaf('0x0'));var SquareProject=require(_0xbcaf('0x1'))['db'][_0xbcaf('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbcaf('0x3')](0x0);var events={'afterCreate':_0xbcaf('0x4'),'afterUpdate':_0xbcaf('0x5'),'afterDestroy':_0xbcaf('0x6')};function emitEvent(_0x3bc156){return function(_0x154ce3,_0x1f6b2f,_0x55ee36){SquareProjectEvents[_0xbcaf('0x7')](_0x3bc156+':'+_0x154ce3['id'],_0x154ce3);SquareProjectEvents[_0xbcaf('0x7')](_0x3bc156,_0x154ce3);_0x55ee36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xbcaf('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 487e520..dc102ba 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 _0x0b0e=['path','rimraf','../../config/environment','./squareProject.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x47a6b6,_0x3118ed){var _0xfaf92d=function(_0x56958d){while(--_0x56958d){_0x47a6b6['push'](_0x47a6b6['shift']());}};_0xfaf92d(++_0x3118ed);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1233d2,_0x5416f4){_0x1233d2=_0x1233d2-0x0;var _0x22759e=_0x0b0e[_0x1233d2];return _0x22759e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareProject','square_projects','lodash','util'];(function(_0x18341e,_0x382e64){var _0x33d786=function(_0x41e06b){while(--_0x41e06b){_0x18341e['push'](_0x18341e['shift']());}};_0x33d786(++_0x382e64);}(_0xdb28,0x106));var _0x8db2=function(_0x3a5d82,_0x3c5f96){_0x3a5d82=_0x3a5d82-0x0;var _0x2faa9c=_0xdb28[_0x3a5d82];return _0x2faa9c;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./squareProject.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b4ff00c..43508ef 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 _0x0c2f=['where','attributes','include','map','model','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject','find','options','raw'];(function(_0x561bf3,_0x3a6436){var _0x5ea5ac=function(_0x29a565){while(--_0x29a565){_0x561bf3['push'](_0x561bf3['shift']());}};_0x5ea5ac(++_0x3a6436);}(_0x0c2f,0x1be));var _0xf0c2=function(_0x57062a,_0x123026){_0x57062a=_0x57062a-0x0;var _0xa178da=_0x0c2f[_0x57062a];return _0xa178da;};'use strict';var _=require(_0xf0c2('0x0'));var util=require(_0xf0c2('0x1'));var moment=require(_0xf0c2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0c2('0x3'));var db=require(_0xf0c2('0x4'))['db'];var utils=require(_0xf0c2('0x5'));var logger=require(_0xf0c2('0x6'))(_0xf0c2('0x7'));var config=require(_0xf0c2('0x8'));var jayson=require(_0xf0c2('0x9'));var client=jayson[_0xf0c2('0xa')][_0xf0c2('0xb')]({'port':0x232a});config[_0xf0c2('0xc')]=_[_0xf0c2('0xd')](config[_0xf0c2('0xc')],{'host':_0xf0c2('0xe'),'port':0x18eb});var socket=require(_0xf0c2('0xf'))(new Redis(config[_0xf0c2('0xc')]));require('./squareProject.socket')[_0xf0c2('0x10')](socket);function respondWithRpcPromise(_0x172a16,_0x98b1f1,_0x12c6f1){return new BPromise(function(_0x1b6f74,_0x52cee4){return client[_0xf0c2('0x11')](_0x172a16,_0x12c6f1)[_0xf0c2('0x12')](function(_0xff6d12){logger[_0xf0c2('0x13')]('SquareProject,\x20%s,\x20%s',_0x98b1f1,'request\x20sent');logger[_0xf0c2('0x14')](_0xf0c2('0x15'),_0x98b1f1,_0xf0c2('0x16'),JSON['stringify'](_0xff6d12));if(_0xff6d12[_0xf0c2('0x17')]){if(_0xff6d12['error'][_0xf0c2('0x18')]===0x1f4){logger[_0xf0c2('0x17')](_0xf0c2('0x19'),_0x98b1f1,_0xff6d12[_0xf0c2('0x17')]['message']);return _0x52cee4(_0xff6d12[_0xf0c2('0x17')][_0xf0c2('0x1a')]);}logger[_0xf0c2('0x17')]('SquareProject,\x20%s,\x20%s',_0x98b1f1,_0xff6d12[_0xf0c2('0x17')]['message']);return _0x1b6f74(_0xff6d12[_0xf0c2('0x17')][_0xf0c2('0x1a')]);}else{logger[_0xf0c2('0x13')](_0xf0c2('0x19'),_0x98b1f1,'request\x20sent');_0x1b6f74(_0xff6d12[_0xf0c2('0x1b')][_0xf0c2('0x1a')]);}})[_0xf0c2('0x1c')](function(_0x21d5b7){logger['error'](_0xf0c2('0x19'),_0x98b1f1,_0x21d5b7);_0x52cee4(_0x21d5b7);});});}exports[_0xf0c2('0x1d')]=function(_0x50f299){var _0x493081=this;return new Promise(function(_0x151a54,_0x221286){return db[_0xf0c2('0x1e')][_0xf0c2('0x1f')]({'raw':_0x50f299[_0xf0c2('0x20')]?_0x50f299[_0xf0c2('0x20')][_0xf0c2('0x21')]===undefined?!![]:![]:!![],'where':_0x50f299[_0xf0c2('0x20')]?_0x50f299[_0xf0c2('0x20')][_0xf0c2('0x22')]||null:null,'attributes':_0x50f299[_0xf0c2('0x20')]?_0x50f299[_0xf0c2('0x20')][_0xf0c2('0x23')]||null:null,'include':_0x50f299[_0xf0c2('0x20')]?_0x50f299[_0xf0c2('0x20')][_0xf0c2('0x24')]?_[_0xf0c2('0x25')](_0x50f299['options'][_0xf0c2('0x24')],function(_0x2b6dd7){return{'model':db[_0x2b6dd7[_0xf0c2('0x26')]],'as':_0x2b6dd7['as'],'attributes':_0x2b6dd7[_0xf0c2('0x23')],'include':_0x2b6dd7['include']?_[_0xf0c2('0x25')](_0x2b6dd7[_0xf0c2('0x24')],function(_0x56bb79){return{'model':db[_0x56bb79['model']],'as':_0x56bb79['as'],'attributes':_0x56bb79[_0xf0c2('0x23')],'include':_0x56bb79['include']?_[_0xf0c2('0x25')](_0x56bb79[_0xf0c2('0x24')],function(_0x59d77d){return{'model':db[_0x59d77d[_0xf0c2('0x26')]],'as':_0x59d77d['as'],'attributes':_0x59d77d[_0xf0c2('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd74938){logger[_0xf0c2('0x13')](_0xf0c2('0x1d'),_0x50f299);logger[_0xf0c2('0x14')](_0xf0c2('0x1d'),_0x50f299,JSON[_0xf0c2('0x27')](_0xd74938));_0x151a54(_0xd74938);})[_0xf0c2('0x1c')](function(_0x217b99){logger[_0xf0c2('0x17')](_0xf0c2('0x1d'),_0x217b99[_0xf0c2('0x1a')],_0x50f299);_0x221286(_0x493081[_0xf0c2('0x17')](0x1f4,_0x217b99[_0xf0c2('0x1a')]));});});}; \ No newline at end of file +var _0x69f6=['stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s'];(function(_0x201ff4,_0x54c34e){var _0x493821=function(_0x2f1f18){while(--_0x2f1f18){_0x201ff4['push'](_0x201ff4['shift']());}};_0x493821(++_0x54c34e);}(_0x69f6,0x177));var _0x669f=function(_0x1e1026,_0x549bfd){_0x1e1026=_0x1e1026-0x0;var _0x3dfd47=_0x69f6[_0x1e1026];return _0x3dfd47;};'use strict';var _=require(_0x669f('0x0'));var util=require(_0x669f('0x1'));var moment=require(_0x669f('0x2'));var BPromise=require('bluebird');var rs=require(_0x669f('0x3'));var fs=require('fs');var Redis=require(_0x669f('0x4'));var db=require(_0x669f('0x5'))['db'];var utils=require(_0x669f('0x6'));var logger=require('../../config/logger')(_0x669f('0x7'));var config=require(_0x669f('0x8'));var jayson=require(_0x669f('0x9'));var client=jayson['client'][_0x669f('0xa')]({'port':0x232a});config[_0x669f('0xb')]=_['defaults'](config[_0x669f('0xb')],{'host':_0x669f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x669f('0xb')]));require(_0x669f('0xd'))[_0x669f('0xe')](socket);function respondWithRpcPromise(_0x25b8b1,_0x3d5a50,_0x78b807){return new BPromise(function(_0x1134e3,_0x2400f8){return client[_0x669f('0xf')](_0x25b8b1,_0x78b807)['then'](function(_0x4efbda){logger[_0x669f('0x10')](_0x669f('0x11'),_0x3d5a50,_0x669f('0x12'));logger[_0x669f('0x13')](_0x669f('0x14'),_0x3d5a50,_0x669f('0x12'),JSON[_0x669f('0x15')](_0x4efbda));if(_0x4efbda[_0x669f('0x16')]){if(_0x4efbda[_0x669f('0x16')][_0x669f('0x17')]===0x1f4){logger[_0x669f('0x16')]('SquareProject,\x20%s,\x20%s',_0x3d5a50,_0x4efbda['error']['message']);return _0x2400f8(_0x4efbda['error'][_0x669f('0x18')]);}logger[_0x669f('0x16')](_0x669f('0x11'),_0x3d5a50,_0x4efbda[_0x669f('0x16')][_0x669f('0x18')]);return _0x1134e3(_0x4efbda[_0x669f('0x16')]['message']);}else{logger[_0x669f('0x10')]('SquareProject,\x20%s,\x20%s',_0x3d5a50,'request\x20sent');_0x1134e3(_0x4efbda[_0x669f('0x19')][_0x669f('0x18')]);}})[_0x669f('0x1a')](function(_0x1591c3){logger['error'](_0x669f('0x11'),_0x3d5a50,_0x1591c3);_0x2400f8(_0x1591c3);});});}exports[_0x669f('0x1b')]=function(_0x3fb9ca){var _0x39d9e2=this;return new Promise(function(_0x523f8f,_0x27fca5){return db[_0x669f('0x1c')][_0x669f('0x1d')]({'raw':_0x3fb9ca['options']?_0x3fb9ca[_0x669f('0x1e')][_0x669f('0x1f')]===undefined?!![]:![]:!![],'where':_0x3fb9ca[_0x669f('0x1e')]?_0x3fb9ca[_0x669f('0x1e')]['where']||null:null,'attributes':_0x3fb9ca['options']?_0x3fb9ca['options'][_0x669f('0x20')]||null:null,'include':_0x3fb9ca[_0x669f('0x1e')]?_0x3fb9ca[_0x669f('0x1e')][_0x669f('0x21')]?_[_0x669f('0x22')](_0x3fb9ca['options']['include'],function(_0x2ffb93){return{'model':db[_0x2ffb93['model']],'as':_0x2ffb93['as'],'attributes':_0x2ffb93[_0x669f('0x20')],'include':_0x2ffb93['include']?_[_0x669f('0x22')](_0x2ffb93[_0x669f('0x21')],function(_0x3c49f2){return{'model':db[_0x3c49f2[_0x669f('0x23')]],'as':_0x3c49f2['as'],'attributes':_0x3c49f2['attributes'],'include':_0x3c49f2[_0x669f('0x21')]?_['map'](_0x3c49f2[_0x669f('0x21')],function(_0x5b33d8){return{'model':db[_0x5b33d8[_0x669f('0x23')]],'as':_0x5b33d8['as'],'attributes':_0x5b33d8[_0x669f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x220b83){logger[_0x669f('0x10')](_0x669f('0x1b'),_0x3fb9ca);logger[_0x669f('0x13')]('ShowSquareProject',_0x3fb9ca,JSON['stringify'](_0x220b83));_0x523f8f(_0x220b83);})[_0x669f('0x1a')](function(_0x5f2f80){logger[_0x669f('0x16')](_0x669f('0x1b'),_0x5f2f80[_0x669f('0x18')],_0x3fb9ca);_0x27fca5(_0x39d9e2['error'](0x1f4,_0x5f2f80['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 6e11ae0..40d62e8 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 _0xe3da=['length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x26053b,_0x4947c5){var _0x8b1471=function(_0x5ef424){while(--_0x5ef424){_0x26053b['push'](_0x26053b['shift']());}};_0x8b1471(++_0x4947c5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var SquareProjectEvents=require(_0xae3d('0x0'));var events=[_0xae3d('0x1'),_0xae3d('0x2'),_0xae3d('0x3')];function createListener(_0x2bba92,_0x190f0d){return function(_0x109dca){_0x190f0d[_0xae3d('0x4')](_0x2bba92,_0x109dca);};}function removeListener(_0xb2dfd3,_0x22bacf){return function(){SquareProjectEvents[_0xae3d('0x5')](_0xb2dfd3,_0x22bacf);};}exports[_0xae3d('0x6')]=function(_0xa9a1a){for(var _0xa54808=0x0,_0x476579=events[_0xae3d('0x7')];_0xa54808<_0x476579;_0xa54808++){var _0x583b98=events[_0xa54808];var _0x2a5c45=createListener(_0xae3d('0x8')+_0x583b98,_0xa9a1a);SquareProjectEvents['on'](_0x583b98,_0x2a5c45);}}; \ No newline at end of file +var _0xadb5=['update','emit','register','length','squareProject:','save'];(function(_0x230e37,_0x2b416c){var _0x4266d1=function(_0x4be00d){while(--_0x4be00d){_0x230e37['push'](_0x230e37['shift']());}};_0x4266d1(++_0x2b416c);}(_0xadb5,0xad));var _0x5adb=function(_0xd07679,_0x29bdf1){_0xd07679=_0xd07679-0x0;var _0x5b4ed0=_0xadb5[_0xd07679];return _0x5b4ed0;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){SquareProjectEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);SquareProjectEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 039311b..22f809f 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 _0x8957=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','/:id/download','download','post','create','put','/:id/delete','destroy','exports','multer','util'];(function(_0x5b89bb,_0x2c7298){var _0x5f41d1=function(_0xc0de81){while(--_0xc0de81){_0x5b89bb['push'](_0x5b89bb['shift']());}};_0x5f41d1(++_0x2c7298);}(_0x8957,0xf5));var _0x7895=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7895('0x0'));var util=require(_0x7895('0x1'));var path=require(_0x7895('0x2'));var timeout=require(_0x7895('0x3'));var express=require(_0x7895('0x4'));var router=express[_0x7895('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7895('0x6'));var config=require(_0x7895('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0x7895('0x8')](),controller[_0x7895('0x9')]);router['get'](_0x7895('0xa'),auth[_0x7895('0x8')](),controller['show']);router['get'](_0x7895('0xb'),auth[_0x7895('0x8')](),controller[_0x7895('0xc')]);router[_0x7895('0xd')]('/',auth[_0x7895('0x8')](),controller[_0x7895('0xe')]);router[_0x7895('0xf')](_0x7895('0xa'),auth[_0x7895('0x8')](),controller['update']);router['delete'](_0x7895('0x10'),auth[_0x7895('0x8')](),controller[_0x7895('0x11')]);module[_0x7895('0x12')]=router; \ No newline at end of file +var _0x5f5d=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','download','post','create','/:id','update','delete','/:id/delete','destroy','exports','multer','util','path'];(function(_0x7b1a9e,_0x2784d0){var _0x2f6709=function(_0x148d5f){while(--_0x148d5f){_0x7b1a9e['push'](_0x7b1a9e['shift']());}};_0x2f6709(++_0x2784d0);}(_0x5f5d,0x75));var _0xd5f5=function(_0x2fa47f,_0x77acc8){_0x2fa47f=_0x2fa47f-0x0;var _0x13d706=_0x5f5d[_0x2fa47f];return _0x13d706;};'use strict';var multer=require(_0xd5f5('0x0'));var util=require(_0xd5f5('0x1'));var path=require(_0xd5f5('0x2'));var timeout=require(_0xd5f5('0x3'));var express=require(_0xd5f5('0x4'));var router=express['Router']();var auth=require(_0xd5f5('0x5'));var interaction=require(_0xd5f5('0x6'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0xd5f5('0x7')]('/',auth[_0xd5f5('0x8')](),controller[_0xd5f5('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd5f5('0xa')]);router[_0xd5f5('0x7')]('/:id/download',auth[_0xd5f5('0x8')](),controller[_0xd5f5('0xb')]);router[_0xd5f5('0xc')]('/',auth['isAuthenticated'](),controller[_0xd5f5('0xd')]);router['put'](_0xd5f5('0xe'),auth['isAuthenticated'](),controller[_0xd5f5('0xf')]);router[_0xd5f5('0x10')](_0xd5f5('0x11'),auth[_0xd5f5('0x8')](),controller[_0xd5f5('0x12')]);module[_0xd5f5('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index eb9fddd..bb2fd1a 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 _0xa729=['STRING','VIRTUAL','substring','lastIndexOf','sequelize','exports'];(function(_0x56eacb,_0x2c5f66){var _0x1b7ee9=function(_0x285236){while(--_0x285236){_0x56eacb['push'](_0x56eacb['shift']());}};_0x1b7ee9(++_0x2c5f66);}(_0xa729,0x160));var _0x9a72=function(_0x4e0772,_0x3acd20){_0x4e0772=_0x4e0772-0x0;var _0x1e91d7=_0xa729[_0x4e0772];return _0x1e91d7;};'use strict';var Sequelize=require(_0x9a72('0x0'));module[_0x9a72('0x1')]={'uniqueid':{'type':Sequelize[_0x9a72('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9a72('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9a72('0x2')]},'accountcode':{'type':Sequelize[_0x9a72('0x2')]},'dnid':{'type':Sequelize[_0x9a72('0x2')]},'projectName':{'type':Sequelize[_0x9a72('0x2')]},'saveName':{'type':Sequelize[_0x9a72('0x2')]},'filename':{'type':Sequelize[_0x9a72('0x2')]},'savePath':{'type':Sequelize[_0x9a72('0x2')]},'format':{'type':Sequelize[_0x9a72('0x3')],'get':function(){var _0x5671c9='';var _0x55f567=this['getDataValue']('savePath');if(_0x55f567){_0x5671c9=_0x55f567[_0x9a72('0x4')](_0x55f567[_0x9a72('0x5')]('.'));}return _0x5671c9;}}}; \ No newline at end of file +var _0xbf44=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x398b3d,_0x2f497e){var _0x20b1cf=function(_0x23a3ea){while(--_0x23a3ea){_0x398b3d['push'](_0x398b3d['shift']());}};_0x20b1cf(++_0x2f497e);}(_0xbf44,0xa0));var _0x4bf4=function(_0x8f52c7,_0x10f91c){_0x8f52c7=_0x8f52c7-0x0;var _0x48bb92=_0xbf44[_0x8f52c7];return _0x48bb92;};'use strict';var Sequelize=require(_0x4bf4('0x0'));module[_0x4bf4('0x1')]={'uniqueid':{'type':Sequelize[_0x4bf4('0x2')]},'callerid':{'type':Sequelize[_0x4bf4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4bf4('0x2')]},'extension':{'type':Sequelize[_0x4bf4('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x4bf4('0x2')]},'saveName':{'type':Sequelize[_0x4bf4('0x2')]},'filename':{'type':Sequelize[_0x4bf4('0x2')]},'savePath':{'type':Sequelize[_0x4bf4('0x2')]},'format':{'type':Sequelize[_0x4bf4('0x3')],'get':function(){var _0x655adf='';var _0x5389ac=this[_0x4bf4('0x4')](_0x4bf4('0x5'));if(_0x5389ac){_0x655adf=_0x5389ac[_0x4bf4('0x6')](_0x5389ac['lastIndexOf']('.'));}return _0x655adf;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 6a4b4ec..a14bd69 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 _0x86e6=['where','pick','filter','merge','options','includeAll','include','catch','show','length','find','create','update','body','params','download','../../components/encryptor','filename','%s.cypher','existsSync','decryptFile','savePath','Sequelize','ValidationError','unlink','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0x86e6,0x82));var _0x686e=function(_0x2750d0,_0xd8d5ea){_0x2750d0=_0x2750d0-0x0;var _0x17f60c=_0x86e6[_0x2750d0];return _0x17f60c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x686e('0x0'));var rimraf=require(_0x686e('0x1'));var zipdir=require(_0x686e('0x2'));var jsonpatch=require(_0x686e('0x3'));var rp=require(_0x686e('0x4'));var moment=require(_0x686e('0x5'));var BPromise=require(_0x686e('0x6'));var Mustache=require('mustache');var util=require(_0x686e('0x7'));var path=require(_0x686e('0x8'));var sox=require(_0x686e('0x9'));var csv=require(_0x686e('0xa'));var ejs=require(_0x686e('0xb'));var fs=require('fs');var _=require(_0x686e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x686e('0xd'));var toCsv=require(_0x686e('0xa'));var querystring=require(_0x686e('0xe'));var Papa=require(_0x686e('0xf'));var Redis=require(_0x686e('0x10'));var authService=require(_0x686e('0x11'));var qs=require(_0x686e('0x12'));var as=require(_0x686e('0x13'));var hardwareService=require(_0x686e('0x14'));var logger=require(_0x686e('0x15'))(_0x686e('0x16'));var utils=require(_0x686e('0x17'));var config=require(_0x686e('0x18'));var db=require(_0x686e('0x19'))['db'];function respondWithStatusCode(_0x164565,_0x7f741c){_0x7f741c=_0x7f741c||0xcc;return function(_0x3279e1){if(_0x3279e1){return _0x164565[_0x686e('0x1a')](_0x7f741c);}return _0x164565['status'](_0x7f741c)[_0x686e('0x1b')]();};}function respondWithResult(_0x1e0536,_0x5ccfc0){_0x5ccfc0=_0x5ccfc0||0xc8;return function(_0x3fc656){if(_0x3fc656){return _0x1e0536[_0x686e('0x1c')](_0x5ccfc0)[_0x686e('0x1d')](_0x3fc656);}};}function respondWithFilteredResult(_0x38b719,_0x48b794){return function(_0x20ca0b){if(_0x20ca0b){var _0x36bca8=_0x20ca0b[_0x686e('0x1e')],_0x3a55fa=_0x48b794[_0x686e('0x1f')],_0x4f23a5=_0x48b794[_0x686e('0x1f')]+_0x48b794[_0x686e('0x20')],_0xa1e30c;if(_0x4f23a5>=_0x36bca8){_0x4f23a5=_0x36bca8;_0xa1e30c=0xc8;}else{_0xa1e30c=0xce;}_0x38b719[_0x686e('0x1c')](_0xa1e30c);return _0x38b719[_0x686e('0x21')](_0x686e('0x22'),_0x3a55fa+'-'+_0x4f23a5+'/'+_0x36bca8)[_0x686e('0x1d')](_0x20ca0b);}return null;};}function patchUpdates(_0x4e31ac){return function(_0x62c268){try{jsonpatch['apply'](_0x62c268,_0x4e31ac,!![]);}catch(_0x4f22bd){return BPromise[_0x686e('0x23')](_0x4f22bd);}return _0x62c268[_0x686e('0x24')]();};}function saveUpdates(_0x1c974a,_0x39d82b){return function(_0x34869f){if(_0x34869f){return _0x34869f['update'](_0x1c974a)[_0x686e('0x25')](function(_0x574152){return _0x574152;});}return null;};}function removeEntity(_0x5d17d2,_0x2f1a10){return function(_0x2a9917){if(_0x2a9917){return _0x2a9917[_0x686e('0x26')]()['then'](function(){_0x5d17d2[_0x686e('0x1c')](0xcc)[_0x686e('0x1b')]();});}};}function handleEntityNotFound(_0x11dc9f,_0x5cb9c8){return function(_0x3fa3cc){if(!_0x3fa3cc){_0x11dc9f[_0x686e('0x1a')](0x194);}return _0x3fa3cc;};}function handleError(_0x374366,_0x11e4aa){_0x11e4aa=_0x11e4aa||0x1f4;return function(_0x5b2f1b){logger[_0x686e('0x27')](_0x5b2f1b[_0x686e('0x28')]);if(_0x5b2f1b[_0x686e('0x29')]){delete _0x5b2f1b[_0x686e('0x29')];}_0x374366[_0x686e('0x1c')](_0x11e4aa)[_0x686e('0x2a')](_0x5b2f1b);};}exports[_0x686e('0x2b')]=function(_0xe13068,_0x4d1689){var _0x3d55e1={},_0x416bbb={},_0x520601={'count':0x0,'rows':[]};var _0x2b55ba=_[_0x686e('0x2c')](db[_0x686e('0x2d')][_0x686e('0x2e')],function(_0x1858f){return{'name':_0x1858f[_0x686e('0x2f')],'type':_0x1858f[_0x686e('0x30')]['key']};});_0x416bbb['model']=_[_0x686e('0x2c')](_0x2b55ba,_0x686e('0x29'));_0x416bbb[_0x686e('0x31')]=_[_0x686e('0x32')](_0xe13068[_0x686e('0x31')]);_0x416bbb[_0x686e('0x33')]=_[_0x686e('0x34')](_0x416bbb[_0x686e('0x35')],_0x416bbb[_0x686e('0x31')]);_0x3d55e1[_0x686e('0x36')]=_[_0x686e('0x34')](_0x416bbb[_0x686e('0x35')],qs[_0x686e('0x37')](_0xe13068[_0x686e('0x31')][_0x686e('0x37')]));_0x3d55e1[_0x686e('0x36')]=_0x3d55e1[_0x686e('0x36')]['length']?_0x3d55e1[_0x686e('0x36')]:_0x416bbb[_0x686e('0x35')];if(!_0xe13068[_0x686e('0x31')][_0x686e('0x38')](_0x686e('0x39'))){_0x3d55e1['limit']=qs[_0x686e('0x20')](_0xe13068['query'][_0x686e('0x20')]);_0x3d55e1[_0x686e('0x1f')]=qs[_0x686e('0x1f')](_0xe13068[_0x686e('0x31')]['offset']);}_0x3d55e1[_0x686e('0x3a')]=qs[_0x686e('0x3b')](_0xe13068[_0x686e('0x31')][_0x686e('0x3b')]);_0x3d55e1[_0x686e('0x3c')]=qs['filters'](_[_0x686e('0x3d')](_0xe13068[_0x686e('0x31')],_0x416bbb[_0x686e('0x33')]),_0x2b55ba);if(_0xe13068[_0x686e('0x31')][_0x686e('0x3e')]){_0x3d55e1[_0x686e('0x3c')]=_[_0x686e('0x3f')](_0x3d55e1[_0x686e('0x3c')],{'$or':_['map'](_0x2b55ba,function(_0x44bf85){if(_0x44bf85['type']!=='VIRTUAL'){var _0x4c6dc7={};_0x4c6dc7[_0x44bf85[_0x686e('0x29')]]={'$like':'%'+_0xe13068['query'][_0x686e('0x3e')]+'%'};return _0x4c6dc7;}})});}_0x3d55e1=_[_0x686e('0x3f')]({},_0x3d55e1,_0xe13068[_0x686e('0x40')]);var _0x2b8ac3={'where':_0x3d55e1[_0x686e('0x3c')]};return db['SquareRecording'][_0x686e('0x1e')](_0x2b8ac3)['then'](function(_0x51007a){_0x520601[_0x686e('0x1e')]=_0x51007a;if(_0xe13068['query'][_0x686e('0x41')]){_0x3d55e1[_0x686e('0x42')]=[{'all':!![]}];}return db[_0x686e('0x2d')]['findAll'](_0x3d55e1);})[_0x686e('0x25')](function(_0x24d8b1){_0x520601['rows']=_0x24d8b1;return _0x520601;})[_0x686e('0x25')](respondWithFilteredResult(_0x4d1689,_0x3d55e1))[_0x686e('0x43')](handleError(_0x4d1689,null));};exports[_0x686e('0x44')]=function(_0x1bf13b,_0x298b0c){var _0x21c783={'raw':!![],'where':{'id':_0x1bf13b['params']['id']}},_0x7ba9a0={};_0x7ba9a0[_0x686e('0x35')]=_['keys'](db[_0x686e('0x2d')][_0x686e('0x2e')]);_0x7ba9a0[_0x686e('0x31')]=_[_0x686e('0x32')](_0x1bf13b[_0x686e('0x31')]);_0x7ba9a0[_0x686e('0x33')]=_['intersection'](_0x7ba9a0[_0x686e('0x35')],_0x7ba9a0['query']);_0x21c783[_0x686e('0x36')]=_[_0x686e('0x34')](_0x7ba9a0['model'],qs[_0x686e('0x37')](_0x1bf13b[_0x686e('0x31')][_0x686e('0x37')]));_0x21c783[_0x686e('0x36')]=_0x21c783[_0x686e('0x36')][_0x686e('0x45')]?_0x21c783['attributes']:_0x7ba9a0[_0x686e('0x35')];if(_0x1bf13b[_0x686e('0x31')][_0x686e('0x41')]){_0x21c783[_0x686e('0x42')]=[{'all':!![]}];}_0x21c783=_[_0x686e('0x3f')]({},_0x21c783,_0x1bf13b[_0x686e('0x40')]);return db[_0x686e('0x2d')][_0x686e('0x46')](_0x21c783)['then'](handleEntityNotFound(_0x298b0c,null))[_0x686e('0x25')](respondWithResult(_0x298b0c,null))[_0x686e('0x43')](handleError(_0x298b0c,null));};exports['create']=function(_0x5d0c17,_0x110c84){return db[_0x686e('0x2d')][_0x686e('0x47')](_0x5d0c17['body'],{})[_0x686e('0x25')](respondWithResult(_0x110c84,0xc9))[_0x686e('0x43')](handleError(_0x110c84,null));};exports[_0x686e('0x48')]=function(_0x421f92,_0x21290d){if(_0x421f92[_0x686e('0x49')]['id']){delete _0x421f92[_0x686e('0x49')]['id'];}return db[_0x686e('0x2d')][_0x686e('0x46')]({'where':{'id':_0x421f92[_0x686e('0x4a')]['id']}})[_0x686e('0x25')](handleEntityNotFound(_0x21290d,null))[_0x686e('0x25')](saveUpdates(_0x421f92['body'],null))[_0x686e('0x25')](respondWithResult(_0x21290d,null))['catch'](handleError(_0x21290d,null));};exports[_0x686e('0x4b')]=function(_0x21c13e,_0x4f3838,_0xa21303){var _0x290b9d=require(_0x686e('0x4c'));var _0x1c81d7=![];var _0x320e5a={};if(_0x21c13e['query'][_0x686e('0x30')]&&_0x21c13e['query'][_0x686e('0x30')]==='uniqueid'){_0x320e5a['uniqueid']=_0x21c13e[_0x686e('0x4a')]['id'];}else{_0x320e5a['id']=_0x21c13e['params']['id'];}return db[_0x686e('0x2d')]['find']({'where':_0x320e5a,'attributes':['id','savePath',_0x686e('0x4d')],'raw':!![]})[_0x686e('0x25')](handleEntityNotFound(_0x4f3838,null))[_0x686e('0x25')](function(_0x2b4489){if(_0x2b4489){var _0x3c9407=_0x2b4489['savePath'];var _0x313d4f=util['format'](_0x686e('0x4e'),_0x3c9407);if(fs[_0x686e('0x4f')](_0x313d4f)){_0x1c81d7=!![];return _0x290b9d[_0x686e('0x50')](_0x313d4f,_0x3c9407,config['secrets']['recording'])[_0x686e('0x25')](function(){return _0x2b4489;});}return _0x2b4489;}})[_0x686e('0x25')](function(_0x2540f0){if(_0x2540f0){var _0x5ada2f=_0x2540f0[_0x686e('0x51')];if(!fs[_0x686e('0x4f')](_0x5ada2f)){throw new db[(_0x686e('0x52'))][(_0x686e('0x53'))]('SquareRecording\x20not\x20found');}if(_0x2540f0['filename']){return _0x4f3838['download'](_0x5ada2f,_0x2540f0[_0x686e('0x4d')]+path['extname'](_0x5ada2f),function(){if(_0x1c81d7){fs[_0x686e('0x54')](_0x5ada2f);}});}else{return _0x4f3838['download'](_0x5ada2f,function(_0x6cb04a){if(_0x1c81d7){fs[_0x686e('0x54')](_0x5ada2f);}});}}})[_0x686e('0x43')](function(_0x972273){if(_0x972273[_0x686e('0x55')]===_0x686e('0x56')){_0x4f3838[_0x686e('0x1c')](0x194)[_0x686e('0x2a')](_0x686e('0x57'));}else{return handleError(_0x4f3838,null);}});};exports[_0x686e('0x26')]=function(_0x67fa66,_0x253941){return db[_0x686e('0x2d')][_0x686e('0x46')]({'where':{'id':_0x67fa66[_0x686e('0x4a')]['id']}})[_0x686e('0x25')](function(_0x35e959){if(!_0x35e959)throw new ReferenceError(_0x686e('0x58'));return _0x35e959;})['then'](function(_0x598108){var _0x71e991=_0x598108[_0x686e('0x51')];logger[_0x686e('0x59')](_0x686e('0x5a'),_0x71e991);if(!_[_0x686e('0x5b')](_0x598108[_0x686e('0x51')])&&fs['existsSync'](_0x71e991)){logger[_0x686e('0x59')](_0x686e('0x5c')+_0x71e991+_0x686e('0x5d'));fs['unlinkSync'](_0x71e991);}_0x71e991=_0x71e991+'.cypher';if(!_[_0x686e('0x5b')](_0x598108[_0x686e('0x51')])&&fs['existsSync'](_0x71e991)){logger['info'](_0x686e('0x5c')+_0x71e991+_0x686e('0x5d'));fs[_0x686e('0x5e')](_0x71e991);}return _0x598108;})[_0x686e('0x25')](function(_0x39eb57){if(!_0x39eb57)throw new InternalError();return _0x39eb57[_0x686e('0x26')]();})['then'](function(){_0x253941[_0x686e('0x1c')](0xcc)[_0x686e('0x1b')]();})[_0x686e('0x43')](handleError(_0x253941,null));}; \ No newline at end of file +var _0xc7bf=['catch','show','length','include','find','create','body','params','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','info','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','set','reject','update','then','destroy','sendStatus','error','stack','name','send','SquareRecording','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','merge','rows'];(function(_0x3d9ba3,_0x48ad4e){var _0x20ee18=function(_0x2b18e2){while(--_0x2b18e2){_0x3d9ba3['push'](_0x3d9ba3['shift']());}};_0x20ee18(++_0x48ad4e);}(_0xc7bf,0x186));var _0xfc7b=function(_0x18bd45,_0x429dd2){_0x18bd45=_0x18bd45-0x0;var _0x110441=_0xc7bf[_0x18bd45];return _0x110441;};'use strict';var pdf=require(_0xfc7b('0x0'));var emlformat=require(_0xfc7b('0x1'));var rimraf=require(_0xfc7b('0x2'));var zipdir=require(_0xfc7b('0x3'));var jsonpatch=require(_0xfc7b('0x4'));var rp=require('request-promise');var moment=require(_0xfc7b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfc7b('0x6'));var util=require(_0xfc7b('0x7'));var path=require(_0xfc7b('0x8'));var sox=require(_0xfc7b('0x9'));var csv=require(_0xfc7b('0xa'));var ejs=require(_0xfc7b('0xb'));var fs=require('fs');var _=require(_0xfc7b('0xc'));var squel=require(_0xfc7b('0xd'));var crypto=require('crypto');var jsforce=require(_0xfc7b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc7b('0xf'));var Papa=require(_0xfc7b('0x10'));var Redis=require(_0xfc7b('0x11'));var authService=require(_0xfc7b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc7b('0x13'));var hardwareService=require(_0xfc7b('0x14'));var logger=require(_0xfc7b('0x15'))(_0xfc7b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfc7b('0x17'))['db'];function respondWithStatusCode(_0x12de12,_0x301f4c){_0x301f4c=_0x301f4c||0xcc;return function(_0xbf8780){if(_0xbf8780){return _0x12de12['sendStatus'](_0x301f4c);}return _0x12de12[_0xfc7b('0x18')](_0x301f4c)[_0xfc7b('0x19')]();};}function respondWithResult(_0x39bec4,_0x4a6fb1){_0x4a6fb1=_0x4a6fb1||0xc8;return function(_0x4e504d){if(_0x4e504d){return _0x39bec4[_0xfc7b('0x18')](_0x4a6fb1)[_0xfc7b('0x1a')](_0x4e504d);}};}function respondWithFilteredResult(_0xed5d1f,_0x46ece8){return function(_0x3d5c69){if(_0x3d5c69){var _0xec5fe=_0x3d5c69[_0xfc7b('0x1b')],_0x50c8f2=_0x46ece8[_0xfc7b('0x1c')],_0x27adb0=_0x46ece8[_0xfc7b('0x1c')]+_0x46ece8['limit'],_0x922677;if(_0x27adb0>=_0xec5fe){_0x27adb0=_0xec5fe;_0x922677=0xc8;}else{_0x922677=0xce;}_0xed5d1f[_0xfc7b('0x18')](_0x922677);return _0xed5d1f[_0xfc7b('0x1d')]('Content-Range',_0x50c8f2+'-'+_0x27adb0+'/'+_0xec5fe)['json'](_0x3d5c69);}return null;};}function patchUpdates(_0x3be15e){return function(_0x526745){try{jsonpatch['apply'](_0x526745,_0x3be15e,!![]);}catch(_0x2f1a2f){return BPromise[_0xfc7b('0x1e')](_0x2f1a2f);}return _0x526745['save']();};}function saveUpdates(_0x5f10ca,_0x2599db){return function(_0x2720b7){if(_0x2720b7){return _0x2720b7[_0xfc7b('0x1f')](_0x5f10ca)[_0xfc7b('0x20')](function(_0x3945d1){return _0x3945d1;});}return null;};}function removeEntity(_0x1b4905,_0x102516){return function(_0x238c09){if(_0x238c09){return _0x238c09[_0xfc7b('0x21')]()['then'](function(){_0x1b4905[_0xfc7b('0x18')](0xcc)[_0xfc7b('0x19')]();});}};}function handleEntityNotFound(_0x2009fa,_0x23d484){return function(_0x2a905b){if(!_0x2a905b){_0x2009fa[_0xfc7b('0x22')](0x194);}return _0x2a905b;};}function handleError(_0xa2ce82,_0x57e7ae){_0x57e7ae=_0x57e7ae||0x1f4;return function(_0x10855a){logger[_0xfc7b('0x23')](_0x10855a[_0xfc7b('0x24')]);if(_0x10855a['name']){delete _0x10855a[_0xfc7b('0x25')];}_0xa2ce82['status'](_0x57e7ae)[_0xfc7b('0x26')](_0x10855a);};}exports['index']=function(_0x2254b5,_0x863fa){var _0x2c139c={},_0x4e0db3={},_0x5d70ac={'count':0x0,'rows':[]};var _0x13e4ee=_['map'](db[_0xfc7b('0x27')][_0xfc7b('0x28')],function(_0x4f88ce){return{'name':_0x4f88ce[_0xfc7b('0x29')],'type':_0x4f88ce[_0xfc7b('0x2a')][_0xfc7b('0x2b')]};});_0x4e0db3[_0xfc7b('0x2c')]=_[_0xfc7b('0x2d')](_0x13e4ee,_0xfc7b('0x25'));_0x4e0db3['query']=_[_0xfc7b('0x2e')](_0x2254b5[_0xfc7b('0x2f')]);_0x4e0db3[_0xfc7b('0x30')]=_[_0xfc7b('0x31')](_0x4e0db3[_0xfc7b('0x2c')],_0x4e0db3[_0xfc7b('0x2f')]);_0x2c139c[_0xfc7b('0x32')]=_[_0xfc7b('0x31')](_0x4e0db3[_0xfc7b('0x2c')],qs[_0xfc7b('0x33')](_0x2254b5['query'][_0xfc7b('0x33')]));_0x2c139c[_0xfc7b('0x32')]=_0x2c139c['attributes']['length']?_0x2c139c['attributes']:_0x4e0db3[_0xfc7b('0x2c')];if(!_0x2254b5[_0xfc7b('0x2f')][_0xfc7b('0x34')](_0xfc7b('0x35'))){_0x2c139c['limit']=qs[_0xfc7b('0x36')](_0x2254b5['query'][_0xfc7b('0x36')]);_0x2c139c[_0xfc7b('0x1c')]=qs[_0xfc7b('0x1c')](_0x2254b5[_0xfc7b('0x2f')][_0xfc7b('0x1c')]);}_0x2c139c[_0xfc7b('0x37')]=qs['sort'](_0x2254b5[_0xfc7b('0x2f')]['sort']);_0x2c139c[_0xfc7b('0x38')]=qs[_0xfc7b('0x30')](_[_0xfc7b('0x39')](_0x2254b5[_0xfc7b('0x2f')],_0x4e0db3['filters']),_0x13e4ee);if(_0x2254b5[_0xfc7b('0x2f')]['filter']){_0x2c139c[_0xfc7b('0x38')]=_[_0xfc7b('0x3a')](_0x2c139c[_0xfc7b('0x38')],{'$or':_[_0xfc7b('0x2d')](_0x13e4ee,function(_0x5407f0){if(_0x5407f0[_0xfc7b('0x2a')]!=='VIRTUAL'){var _0x11219d={};_0x11219d[_0x5407f0['name']]={'$like':'%'+_0x2254b5[_0xfc7b('0x2f')]['filter']+'%'};return _0x11219d;}})});}_0x2c139c=_['merge']({},_0x2c139c,_0x2254b5['options']);var _0x45c8b5={'where':_0x2c139c[_0xfc7b('0x38')]};return db[_0xfc7b('0x27')][_0xfc7b('0x1b')](_0x45c8b5)[_0xfc7b('0x20')](function(_0x54aa18){_0x5d70ac[_0xfc7b('0x1b')]=_0x54aa18;if(_0x2254b5[_0xfc7b('0x2f')]['includeAll']){_0x2c139c['include']=[{'all':!![]}];}return db[_0xfc7b('0x27')]['findAll'](_0x2c139c);})['then'](function(_0x34e392){_0x5d70ac[_0xfc7b('0x3b')]=_0x34e392;return _0x5d70ac;})[_0xfc7b('0x20')](respondWithFilteredResult(_0x863fa,_0x2c139c))[_0xfc7b('0x3c')](handleError(_0x863fa,null));};exports[_0xfc7b('0x3d')]=function(_0x270107,_0x19519d){var _0x4c30c7={'raw':!![],'where':{'id':_0x270107['params']['id']}},_0x2878d4={};_0x2878d4[_0xfc7b('0x2c')]=_[_0xfc7b('0x2e')](db[_0xfc7b('0x27')][_0xfc7b('0x28')]);_0x2878d4[_0xfc7b('0x2f')]=_[_0xfc7b('0x2e')](_0x270107[_0xfc7b('0x2f')]);_0x2878d4['filters']=_['intersection'](_0x2878d4['model'],_0x2878d4[_0xfc7b('0x2f')]);_0x4c30c7['attributes']=_[_0xfc7b('0x31')](_0x2878d4[_0xfc7b('0x2c')],qs[_0xfc7b('0x33')](_0x270107[_0xfc7b('0x2f')][_0xfc7b('0x33')]));_0x4c30c7['attributes']=_0x4c30c7['attributes'][_0xfc7b('0x3e')]?_0x4c30c7[_0xfc7b('0x32')]:_0x2878d4[_0xfc7b('0x2c')];if(_0x270107['query']['includeAll']){_0x4c30c7[_0xfc7b('0x3f')]=[{'all':!![]}];}_0x4c30c7=_[_0xfc7b('0x3a')]({},_0x4c30c7,_0x270107['options']);return db[_0xfc7b('0x27')][_0xfc7b('0x40')](_0x4c30c7)[_0xfc7b('0x20')](handleEntityNotFound(_0x19519d,null))[_0xfc7b('0x20')](respondWithResult(_0x19519d,null))[_0xfc7b('0x3c')](handleError(_0x19519d,null));};exports[_0xfc7b('0x41')]=function(_0x187d8a,_0x2f9d5c){return db[_0xfc7b('0x27')][_0xfc7b('0x41')](_0x187d8a[_0xfc7b('0x42')],{})[_0xfc7b('0x20')](respondWithResult(_0x2f9d5c,0xc9))[_0xfc7b('0x3c')](handleError(_0x2f9d5c,null));};exports[_0xfc7b('0x1f')]=function(_0x321873,_0x3a1004){if(_0x321873['body']['id']){delete _0x321873[_0xfc7b('0x42')]['id'];}return db[_0xfc7b('0x27')][_0xfc7b('0x40')]({'where':{'id':_0x321873[_0xfc7b('0x43')]['id']}})[_0xfc7b('0x20')](handleEntityNotFound(_0x3a1004,null))[_0xfc7b('0x20')](saveUpdates(_0x321873[_0xfc7b('0x42')],null))[_0xfc7b('0x20')](respondWithResult(_0x3a1004,null))[_0xfc7b('0x3c')](handleError(_0x3a1004,null));};exports[_0xfc7b('0x44')]=function(_0x419bf2,_0x3316dd,_0x2e0d76){var _0x3a77b7=require(_0xfc7b('0x45'));var _0x5af122=![];var _0x17ed79={};if(_0x419bf2['query'][_0xfc7b('0x2a')]&&_0x419bf2[_0xfc7b('0x2f')]['type']===_0xfc7b('0x46')){_0x17ed79[_0xfc7b('0x46')]=_0x419bf2[_0xfc7b('0x43')]['id'];}else{_0x17ed79['id']=_0x419bf2[_0xfc7b('0x43')]['id'];}return db[_0xfc7b('0x27')][_0xfc7b('0x40')]({'where':_0x17ed79,'attributes':['id','savePath',_0xfc7b('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x3316dd,null))[_0xfc7b('0x20')](function(_0x414fc7){if(_0x414fc7){var _0x196958=_0x414fc7[_0xfc7b('0x48')];var _0x16b03d=util['format'](_0xfc7b('0x49'),_0x196958);if(fs[_0xfc7b('0x4a')](_0x16b03d)){_0x5af122=!![];return _0x3a77b7[_0xfc7b('0x4b')](_0x16b03d,_0x196958,config['secrets'][_0xfc7b('0x4c')])['then'](function(){return _0x414fc7;});}return _0x414fc7;}})[_0xfc7b('0x20')](function(_0x437c42){if(_0x437c42){var _0x141498=_0x437c42['savePath'];if(!fs['existsSync'](_0x141498)){throw new db[(_0xfc7b('0x4d'))][(_0xfc7b('0x4e'))](_0xfc7b('0x4f'));}if(_0x437c42[_0xfc7b('0x47')]){return _0x3316dd[_0xfc7b('0x44')](_0x141498,_0x437c42[_0xfc7b('0x47')]+path[_0xfc7b('0x50')](_0x141498),function(){if(_0x5af122){fs[_0xfc7b('0x51')](_0x141498);}});}else{return _0x3316dd[_0xfc7b('0x44')](_0x141498,function(_0x3caed1){if(_0x5af122){fs[_0xfc7b('0x51')](_0x141498);}});}}})[_0xfc7b('0x3c')](function(_0x4a615e){if(_0x4a615e[_0xfc7b('0x52')]===_0xfc7b('0x4f')){_0x3316dd[_0xfc7b('0x18')](0x194)[_0xfc7b('0x26')](_0xfc7b('0x53'));}else{return handleError(_0x3316dd,null);}});};exports[_0xfc7b('0x21')]=function(_0x1079df,_0x537454){return db[_0xfc7b('0x27')][_0xfc7b('0x40')]({'where':{'id':_0x1079df[_0xfc7b('0x43')]['id']}})[_0xfc7b('0x20')](function(_0x2446ef){if(!_0x2446ef)throw new ReferenceError('Entity\x20not\x20found');return _0x2446ef;})['then'](function(_0x55c9ad){var _0x315b95=_0x55c9ad[_0xfc7b('0x48')];logger['info'](_0xfc7b('0x54'),_0x315b95);if(!_['isNil'](_0x55c9ad[_0xfc7b('0x48')])&&fs[_0xfc7b('0x4a')](_0x315b95)){logger['info'](_0xfc7b('0x55')+_0x315b95+_0xfc7b('0x56'));fs[_0xfc7b('0x57')](_0x315b95);}_0x315b95=_0x315b95+'.cypher';if(!_[_0xfc7b('0x58')](_0x55c9ad['savePath'])&&fs['existsSync'](_0x315b95)){logger[_0xfc7b('0x59')](_0xfc7b('0x55')+_0x315b95+_0xfc7b('0x56'));fs['unlinkSync'](_0x315b95);}return _0x55c9ad;})['then'](function(_0x551435){if(!_0x551435)throw new InternalError();return _0x551435[_0xfc7b('0x21')]();})[_0xfc7b('0x20')](function(){_0x537454[_0xfc7b('0x18')](0xcc)[_0xfc7b('0x19')]();})['catch'](handleError(_0x537454,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 55446e1..7cac815 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 _0x6f75=['square_recordings','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording'];(function(_0x15669d,_0x1f73da){var _0x16d102=function(_0x25e0cb){while(--_0x25e0cb){_0x15669d['push'](_0x15669d['shift']());}};_0x16d102(++_0x1f73da);}(_0x6f75,0xd2));var _0x56f7=function(_0x41424e,_0x5eca0f){_0x41424e=_0x41424e-0x0;var _0x217b49=_0x6f75[_0x41424e];return _0x217b49;};'use strict';var _=require('lodash');var util=require(_0x56f7('0x0'));var logger=require(_0x56f7('0x1'))(_0x56f7('0x2'));var moment=require(_0x56f7('0x3'));var BPromise=require(_0x56f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x56f7('0x5'));var config=require(_0x56f7('0x6'));var attributes=require(_0x56f7('0x7'));module[_0x56f7('0x8')]=function(_0x245a86,_0x2d85d5){return _0x245a86['define'](_0x56f7('0x9'),attributes,{'tableName':_0x56f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43e7=['exports','SquareRecording','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes'];(function(_0x19ad66,_0x54731b){var _0x1607b9=function(_0x1ac187){while(--_0x1ac187){_0x19ad66['push'](_0x19ad66['shift']());}};_0x1607b9(++_0x54731b);}(_0x43e7,0x1b2));var _0x743e=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x43e7[_0x374ada];return _0x449ed8;};'use strict';var _=require(_0x743e('0x0'));var util=require(_0x743e('0x1'));var logger=require(_0x743e('0x2'))(_0x743e('0x3'));var moment=require(_0x743e('0x4'));var BPromise=require(_0x743e('0x5'));var rp=require(_0x743e('0x6'));var fs=require('fs');var path=require(_0x743e('0x7'));var rimraf=require('rimraf');var config=require(_0x743e('0x8'));var attributes=require(_0x743e('0x9'));module[_0x743e('0xa')]=function(_0xfb57be,_0x5ef224){return _0xfb57be['define'](_0x743e('0xb'),attributes,{'tableName':'square_recordings','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 f682bf2..4f68c14 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 _0xb7e0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','then','CreateSquareRecording','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2312e9,_0x4bfc73){var _0x390832=function(_0x4ee284){while(--_0x4ee284){_0x2312e9['push'](_0x2312e9['shift']());}};_0x390832(++_0x4bfc73);}(_0xb7e0,0x119));var _0x0b7e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb7e0[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x0b7e('0x0'));var util=require('util');var moment=require(_0x0b7e('0x1'));var BPromise=require(_0x0b7e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b7e('0x3'));var db=require(_0x0b7e('0x4'))['db'];var utils=require(_0x0b7e('0x5'));var logger=require(_0x0b7e('0x6'))(_0x0b7e('0x7'));var config=require(_0x0b7e('0x8'));var jayson=require(_0x0b7e('0x9'));var client=jayson[_0x0b7e('0xa')][_0x0b7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x590636,_0x46f83b,_0x452db4){return new BPromise(function(_0x5ef3b7,_0x3e4522){return client['request'](_0x590636,_0x452db4)['then'](function(_0x14a4ed){logger[_0x0b7e('0xc')](_0x0b7e('0xd'),_0x46f83b,_0x0b7e('0xe'));logger[_0x0b7e('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x46f83b,_0x0b7e('0xe'),JSON[_0x0b7e('0x10')](_0x14a4ed));if(_0x14a4ed[_0x0b7e('0x11')]){if(_0x14a4ed[_0x0b7e('0x11')][_0x0b7e('0x12')]===0x1f4){logger[_0x0b7e('0x11')]('SquareRecording,\x20%s,\x20%s',_0x46f83b,_0x14a4ed[_0x0b7e('0x11')][_0x0b7e('0x13')]);return _0x3e4522(_0x14a4ed[_0x0b7e('0x11')][_0x0b7e('0x13')]);}logger[_0x0b7e('0x11')]('SquareRecording,\x20%s,\x20%s',_0x46f83b,_0x14a4ed[_0x0b7e('0x11')]['message']);return _0x5ef3b7(_0x14a4ed['error'][_0x0b7e('0x13')]);}else{logger[_0x0b7e('0xc')](_0x0b7e('0xd'),_0x46f83b,_0x0b7e('0xe'));_0x5ef3b7(_0x14a4ed[_0x0b7e('0x14')]['message']);}})[_0x0b7e('0x15')](function(_0x2e67aa){logger[_0x0b7e('0x11')]('SquareRecording,\x20%s,\x20%s',_0x46f83b,_0x2e67aa);_0x3e4522(_0x2e67aa);});});}exports['CreateSquareRecording']=function(_0x1ce17b){var _0x4df331=this;return new Promise(function(_0x2d00f5,_0x2325ff){return db['SquareRecording']['create'](_0x1ce17b['body'],{'raw':_0x1ce17b[_0x0b7e('0x16')]?_0x1ce17b['options'][_0x0b7e('0x17')]===undefined?!![]:![]:!![]})[_0x0b7e('0x18')](function(_0x175d05){logger[_0x0b7e('0xc')]('CreateSquareRecording',_0x1ce17b);logger[_0x0b7e('0xf')]('CreateSquareRecording',_0x1ce17b,JSON['stringify'](_0x175d05));_0x2d00f5(_0x175d05);})[_0x0b7e('0x15')](function(_0x4c63bd){logger['error'](_0x0b7e('0x19'),_0x4c63bd[_0x0b7e('0x13')],_0x1ce17b);_0x2325ff(_0x4df331['error'](0x1f4,_0x4c63bd[_0x0b7e('0x13')]));});});}; \ No newline at end of file +var _0x7e48=['client','http','request','then','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','info','result','catch','create','body','options','CreateSquareRecording','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x33b36e,_0x34853b){var _0x512fd8=function(_0xae973c){while(--_0xae973c){_0x33b36e['push'](_0x33b36e['shift']());}};_0x512fd8(++_0x34853b);}(_0x7e48,0x135));var _0x87e4=function(_0x1273b6,_0x11259e){_0x1273b6=_0x1273b6-0x0;var _0x1b037a=_0x7e48[_0x1273b6];return _0x1b037a;};'use strict';var _=require(_0x87e4('0x0'));var util=require(_0x87e4('0x1'));var moment=require('moment');var BPromise=require(_0x87e4('0x2'));var rs=require(_0x87e4('0x3'));var fs=require('fs');var Redis=require(_0x87e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87e4('0x5'));var logger=require(_0x87e4('0x6'))(_0x87e4('0x7'));var config=require(_0x87e4('0x8'));var jayson=require(_0x87e4('0x9'));var client=jayson[_0x87e4('0xa')][_0x87e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3604ef,_0x1ab579,_0x155de4){return new BPromise(function(_0x292737,_0x179f05){return client[_0x87e4('0xc')](_0x3604ef,_0x155de4)[_0x87e4('0xd')](function(_0x4c5aab){logger['info']('SquareRecording,\x20%s,\x20%s',_0x1ab579,_0x87e4('0xe'));logger['debug'](_0x87e4('0xf'),_0x1ab579,_0x87e4('0xe'),JSON[_0x87e4('0x10')](_0x4c5aab));if(_0x4c5aab[_0x87e4('0x11')]){if(_0x4c5aab[_0x87e4('0x11')][_0x87e4('0x12')]===0x1f4){logger[_0x87e4('0x11')](_0x87e4('0x13'),_0x1ab579,_0x4c5aab[_0x87e4('0x11')][_0x87e4('0x14')]);return _0x179f05(_0x4c5aab['error']['message']);}logger[_0x87e4('0x11')](_0x87e4('0x13'),_0x1ab579,_0x4c5aab['error']['message']);return _0x292737(_0x4c5aab[_0x87e4('0x11')][_0x87e4('0x14')]);}else{logger[_0x87e4('0x15')](_0x87e4('0x13'),_0x1ab579,'request\x20sent');_0x292737(_0x4c5aab[_0x87e4('0x16')][_0x87e4('0x14')]);}})[_0x87e4('0x17')](function(_0xa691e3){logger[_0x87e4('0x11')](_0x87e4('0x13'),_0x1ab579,_0xa691e3);_0x179f05(_0xa691e3);});});}exports['CreateSquareRecording']=function(_0x37c4b1){var _0x51d632=this;return new Promise(function(_0xe92622,_0x4905ea){return db['SquareRecording'][_0x87e4('0x18')](_0x37c4b1[_0x87e4('0x19')],{'raw':_0x37c4b1['options']?_0x37c4b1[_0x87e4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x87e4('0xd')](function(_0x4c1967){logger[_0x87e4('0x15')](_0x87e4('0x1b'),_0x37c4b1);logger[_0x87e4('0x1c')]('CreateSquareRecording',_0x37c4b1,JSON[_0x87e4('0x10')](_0x4c1967));_0xe92622(_0x4c1967);})[_0x87e4('0x17')](function(_0x37a6c2){logger[_0x87e4('0x11')](_0x87e4('0x1b'),_0x37a6c2[_0x87e4('0x14')],_0x37c4b1);_0x4905ea(_0x51d632[_0x87e4('0x11')](0x1f4,_0x37a6c2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 8a1c2f3..6976e00 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 _0xfa5e=['index','/describe','/:id','show','post','put','update','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated'];(function(_0x5661e2,_0x3ac219){var _0x4333a7=function(_0x19c591){while(--_0x19c591){_0x5661e2['push'](_0x5661e2['shift']());}};_0x4333a7(++_0x3ac219);}(_0xfa5e,0xcf));var _0xefa5=function(_0x392190,_0x2b917d){_0x392190=_0x392190-0x0;var _0x1b90f0=_0xfa5e[_0x392190];return _0x1b90f0;};'use strict';var multer=require(_0xefa5('0x0'));var util=require(_0xefa5('0x1'));var path=require(_0xefa5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xefa5('0x3'));var interaction=require(_0xefa5('0x4'));var config=require(_0xefa5('0x5'));var controller=require(_0xefa5('0x6'));router[_0xefa5('0x7')]('/',auth[_0xefa5('0x8')](),controller[_0xefa5('0x9')]);router[_0xefa5('0x7')](_0xefa5('0xa'),auth[_0xefa5('0x8')](),controller['describe']);router[_0xefa5('0x7')](_0xefa5('0xb'),auth[_0xefa5('0x8')](),controller[_0xefa5('0xc')]);router[_0xefa5('0xd')]('/',auth[_0xefa5('0x8')](),controller['create']);router[_0xefa5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xefa5('0xf')]);router[_0xefa5('0x10')](_0xefa5('0xb'),auth[_0xefa5('0x8')](),controller['destroy']);module[_0xefa5('0x11')]=router; \ No newline at end of file +var _0x954d=['connect-timeout','express','Router','../../config/environment','./squareReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x156cbc,_0x4fcc20){var _0x30f727=function(_0x556685){while(--_0x556685){_0x156cbc['push'](_0x156cbc['shift']());}};_0x30f727(++_0x4fcc20);}(_0x954d,0xd9));var _0xd954=function(_0xf67a90,_0x2eb2f3){_0xf67a90=_0xf67a90-0x0;var _0x648b2=_0x954d[_0xf67a90];return _0x648b2;};'use strict';var multer=require(_0xd954('0x0'));var util=require(_0xd954('0x1'));var path=require(_0xd954('0x2'));var timeout=require(_0xd954('0x3'));var express=require(_0xd954('0x4'));var router=express[_0xd954('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd954('0x6'));var controller=require(_0xd954('0x7'));router[_0xd954('0x8')]('/',auth[_0xd954('0x9')](),controller[_0xd954('0xa')]);router[_0xd954('0x8')]('/describe',auth[_0xd954('0x9')](),controller[_0xd954('0xb')]);router[_0xd954('0x8')](_0xd954('0xc'),auth[_0xd954('0x9')](),controller[_0xd954('0xd')]);router['post']('/',auth[_0xd954('0x9')](),controller[_0xd954('0xe')]);router[_0xd954('0xf')](_0xd954('0xc'),auth[_0xd954('0x9')](),controller[_0xd954('0x10')]);router[_0xd954('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd954('0x12')]);module[_0xd954('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index cae019f..3e5cd1d 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 _0xcb78=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x32e33a,_0x4f0946){var _0x3cdeeb=function(_0x59555f){while(--_0x59555f){_0x32e33a['push'](_0x32e33a['shift']());}};_0x3cdeeb(++_0x4f0946);}(_0xcb78,0x137));var _0x8cb7=function(_0x6be627,_0x463257){_0x6be627=_0x6be627-0x0;var _0x3d1d4d=_0xcb78[_0x6be627];return _0x3d1d4d;};'use strict';var Sequelize=require(_0x8cb7('0x0'));module[_0x8cb7('0x1')]={'network':{'type':Sequelize[_0x8cb7('0x2')]},'network_script':{'type':Sequelize[_0x8cb7('0x2')]},'request':{'type':Sequelize[_0x8cb7('0x2')]},'channel':{'type':Sequelize[_0x8cb7('0x2')]},'language':{'type':Sequelize[_0x8cb7('0x2')]},'type':{'type':Sequelize[_0x8cb7('0x2')]},'uniqueid':{'type':Sequelize[_0x8cb7('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8cb7('0x2')]},'calleridname':{'type':Sequelize[_0x8cb7('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x8cb7('0x2')]},'callingtns':{'type':Sequelize[_0x8cb7('0x2')]},'dnid':{'type':Sequelize[_0x8cb7('0x2')]},'rdnis':{'type':Sequelize[_0x8cb7('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8cb7('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x8cb7('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x8cb7('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8cb7('0x3')]},'leaveAt':{'type':Sequelize[_0x8cb7('0x3')]},'bot':{'type':Sequelize[_0x8cb7('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x9db0=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x309f71,_0x3a56ff){var _0x1f9bf4=function(_0x5b9024){while(--_0x5b9024){_0x309f71['push'](_0x309f71['shift']());}};_0x1f9bf4(++_0x3a56ff);}(_0x9db0,0xa0));var _0x09db=function(_0x191026,_0x6dde39){_0x191026=_0x191026-0x0;var _0x2301fb=_0x9db0[_0x191026];return _0x2301fb;};'use strict';var Sequelize=require(_0x09db('0x0'));module[_0x09db('0x1')]={'network':{'type':Sequelize[_0x09db('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x09db('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x09db('0x2')]},'type':{'type':Sequelize[_0x09db('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x09db('0x2')]},'callerid':{'type':Sequelize[_0x09db('0x2')]},'calleridname':{'type':Sequelize[_0x09db('0x2')]},'callingpres':{'type':Sequelize[_0x09db('0x2')]},'callingani2':{'type':Sequelize[_0x09db('0x2')]},'callington':{'type':Sequelize[_0x09db('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x09db('0x2')]},'context':{'type':Sequelize[_0x09db('0x2')]},'extension':{'type':Sequelize[_0x09db('0x2')]},'priority':{'type':Sequelize[_0x09db('0x2')]},'enhanced':{'type':Sequelize[_0x09db('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x09db('0x2')]},'project_name':{'type':Sequelize[_0x09db('0x2')]},'joinAt':{'type':Sequelize[_0x09db('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x09db('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 1f58a45..489fe0e 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 _0x9e91=['length','nolimit','order','sort','pick','filter','where','merge','map','options','includeAll','include','SquareReport','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','error','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x9e91,0x197));var _0x19e9=function(_0x20cfb6,_0x16d69e){_0x20cfb6=_0x20cfb6-0x0;var _0x2ea53a=_0x9e91[_0x20cfb6];return _0x2ea53a;};'use strict';var pdf=require(_0x19e9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x19e9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19e9('0x2'));var rp=require(_0x19e9('0x3'));var moment=require(_0x19e9('0x4'));var BPromise=require(_0x19e9('0x5'));var Mustache=require(_0x19e9('0x6'));var util=require(_0x19e9('0x7'));var path=require(_0x19e9('0x8'));var sox=require(_0x19e9('0x9'));var csv=require(_0x19e9('0xa'));var ejs=require(_0x19e9('0xb'));var fs=require('fs');var _=require(_0x19e9('0xc'));var squel=require(_0x19e9('0xd'));var crypto=require(_0x19e9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x19e9('0xf'));var toCsv=require(_0x19e9('0xa'));var querystring=require(_0x19e9('0x10'));var Papa=require(_0x19e9('0x11'));var Redis=require(_0x19e9('0x12'));var authService=require(_0x19e9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x19e9('0x14'));var hardwareService=require(_0x19e9('0x15'));var logger=require(_0x19e9('0x16'))(_0x19e9('0x17'));var utils=require(_0x19e9('0x18'));var config=require(_0x19e9('0x19'));var db=require(_0x19e9('0x1a'))['db'];function respondWithStatusCode(_0x2e22e7,_0x3d7fe4){_0x3d7fe4=_0x3d7fe4||0xcc;return function(_0x168177){if(_0x168177){return _0x2e22e7[_0x19e9('0x1b')](_0x3d7fe4);}return _0x2e22e7[_0x19e9('0x1c')](_0x3d7fe4)['end']();};}function respondWithResult(_0x4b74cd,_0x2d0351){_0x2d0351=_0x2d0351||0xc8;return function(_0x42637f){if(_0x42637f){return _0x4b74cd[_0x19e9('0x1c')](_0x2d0351)[_0x19e9('0x1d')](_0x42637f);}};}function respondWithFilteredResult(_0x20a069,_0x1bd276){return function(_0x45ce7d){if(_0x45ce7d){var _0x5105a3=_0x45ce7d[_0x19e9('0x1e')],_0x547046=_0x1bd276[_0x19e9('0x1f')],_0x598899=_0x1bd276[_0x19e9('0x1f')]+_0x1bd276[_0x19e9('0x20')],_0x193b9c;if(_0x598899>=_0x5105a3){_0x598899=_0x5105a3;_0x193b9c=0xc8;}else{_0x193b9c=0xce;}_0x20a069[_0x19e9('0x1c')](_0x193b9c);return _0x20a069[_0x19e9('0x21')]('Content-Range',_0x547046+'-'+_0x598899+'/'+_0x5105a3)[_0x19e9('0x1d')](_0x45ce7d);}return null;};}function patchUpdates(_0x3e9361){return function(_0x778973){try{jsonpatch[_0x19e9('0x22')](_0x778973,_0x3e9361,!![]);}catch(_0x7c785f){return BPromise[_0x19e9('0x23')](_0x7c785f);}return _0x778973['save']();};}function saveUpdates(_0x15b3c5,_0x1420c7){return function(_0x277bb1){if(_0x277bb1){return _0x277bb1[_0x19e9('0x24')](_0x15b3c5)[_0x19e9('0x25')](function(_0x4a5034){return _0x4a5034;});}return null;};}function removeEntity(_0x361d11,_0x5e050e){return function(_0x123303){if(_0x123303){return _0x123303[_0x19e9('0x26')]()[_0x19e9('0x25')](function(){_0x361d11['status'](0xcc)[_0x19e9('0x27')]();});}};}function handleEntityNotFound(_0x19ae4e,_0x27cdac){return function(_0x57125a){if(!_0x57125a){_0x19ae4e['sendStatus'](0x194);}return _0x57125a;};}function handleError(_0x424275,_0x13aaf6){_0x13aaf6=_0x13aaf6||0x1f4;return function(_0xce7ddd){logger[_0x19e9('0x28')](_0xce7ddd['stack']);if(_0xce7ddd[_0x19e9('0x29')]){delete _0xce7ddd[_0x19e9('0x29')];}_0x424275[_0x19e9('0x1c')](_0x13aaf6)[_0x19e9('0x2a')](_0xce7ddd);};}exports[_0x19e9('0x2b')]=function(_0x236b0d,_0xff3cf8){var _0x4237d2={},_0x29bed3={},_0x4d2a23={'count':0x0,'rows':[]};var _0x17b01a=_['map'](db['SquareReport'][_0x19e9('0x2c')],function(_0x3f4e58){return{'name':_0x3f4e58[_0x19e9('0x2d')],'type':_0x3f4e58[_0x19e9('0x2e')][_0x19e9('0x2f')]};});_0x29bed3[_0x19e9('0x30')]=_['map'](_0x17b01a,_0x19e9('0x29'));_0x29bed3[_0x19e9('0x31')]=_[_0x19e9('0x32')](_0x236b0d[_0x19e9('0x31')]);_0x29bed3[_0x19e9('0x33')]=_[_0x19e9('0x34')](_0x29bed3['model'],_0x29bed3[_0x19e9('0x31')]);_0x4237d2[_0x19e9('0x35')]=_[_0x19e9('0x34')](_0x29bed3[_0x19e9('0x30')],qs[_0x19e9('0x36')](_0x236b0d[_0x19e9('0x31')][_0x19e9('0x36')]));_0x4237d2[_0x19e9('0x35')]=_0x4237d2['attributes'][_0x19e9('0x37')]?_0x4237d2['attributes']:_0x29bed3[_0x19e9('0x30')];if(!_0x236b0d[_0x19e9('0x31')]['hasOwnProperty'](_0x19e9('0x38'))){_0x4237d2[_0x19e9('0x20')]=qs[_0x19e9('0x20')](_0x236b0d['query'][_0x19e9('0x20')]);_0x4237d2[_0x19e9('0x1f')]=qs[_0x19e9('0x1f')](_0x236b0d['query'][_0x19e9('0x1f')]);}_0x4237d2[_0x19e9('0x39')]=qs[_0x19e9('0x3a')](_0x236b0d[_0x19e9('0x31')][_0x19e9('0x3a')]);_0x4237d2['where']=qs[_0x19e9('0x33')](_[_0x19e9('0x3b')](_0x236b0d[_0x19e9('0x31')],_0x29bed3['filters']),_0x17b01a);if(_0x236b0d[_0x19e9('0x31')][_0x19e9('0x3c')]){_0x4237d2[_0x19e9('0x3d')]=_[_0x19e9('0x3e')](_0x4237d2['where'],{'$or':_[_0x19e9('0x3f')](_0x17b01a,function(_0x3fbc42){if(_0x3fbc42[_0x19e9('0x2e')]!=='VIRTUAL'){var _0x2edfc7={};_0x2edfc7[_0x3fbc42[_0x19e9('0x29')]]={'$like':'%'+_0x236b0d[_0x19e9('0x31')][_0x19e9('0x3c')]+'%'};return _0x2edfc7;}})});}_0x4237d2=_[_0x19e9('0x3e')]({},_0x4237d2,_0x236b0d[_0x19e9('0x40')]);var _0x49ae83={'where':_0x4237d2['where']};return db['SquareReport'][_0x19e9('0x1e')](_0x49ae83)[_0x19e9('0x25')](function(_0xf23bf3){_0x4d2a23['count']=_0xf23bf3;if(_0x236b0d[_0x19e9('0x31')][_0x19e9('0x41')]){_0x4237d2[_0x19e9('0x42')]=[{'all':!![]}];}return db[_0x19e9('0x43')][_0x19e9('0x44')](_0x4237d2);})[_0x19e9('0x25')](function(_0xe344ba){_0x4d2a23[_0x19e9('0x45')]=_0xe344ba;return _0x4d2a23;})[_0x19e9('0x25')](respondWithFilteredResult(_0xff3cf8,_0x4237d2))[_0x19e9('0x46')](handleError(_0xff3cf8,null));};exports[_0x19e9('0x47')]=function(_0x4e4e04,_0x5d5cc0){var _0xeb29c0={'raw':!![],'where':{'id':_0x4e4e04[_0x19e9('0x48')]['id']}},_0x34bbce={};_0x34bbce['model']=_[_0x19e9('0x32')](db[_0x19e9('0x43')][_0x19e9('0x2c')]);_0x34bbce[_0x19e9('0x31')]=_[_0x19e9('0x32')](_0x4e4e04['query']);_0x34bbce['filters']=_['intersection'](_0x34bbce[_0x19e9('0x30')],_0x34bbce[_0x19e9('0x31')]);_0xeb29c0[_0x19e9('0x35')]=_[_0x19e9('0x34')](_0x34bbce[_0x19e9('0x30')],qs[_0x19e9('0x36')](_0x4e4e04[_0x19e9('0x31')]['fields']));_0xeb29c0[_0x19e9('0x35')]=_0xeb29c0[_0x19e9('0x35')]['length']?_0xeb29c0['attributes']:_0x34bbce[_0x19e9('0x30')];if(_0x4e4e04['query'][_0x19e9('0x41')]){_0xeb29c0[_0x19e9('0x42')]=[{'all':!![]}];}_0xeb29c0=_[_0x19e9('0x3e')]({},_0xeb29c0,_0x4e4e04[_0x19e9('0x40')]);return db[_0x19e9('0x43')][_0x19e9('0x49')](_0xeb29c0)['then'](handleEntityNotFound(_0x5d5cc0,null))[_0x19e9('0x25')](respondWithResult(_0x5d5cc0,null))[_0x19e9('0x46')](handleError(_0x5d5cc0,null));};exports['create']=function(_0x6d4a2c,_0x5a4884){return db[_0x19e9('0x43')][_0x19e9('0x4a')](_0x6d4a2c[_0x19e9('0x4b')],{})['then'](respondWithResult(_0x5a4884,0xc9))['catch'](handleError(_0x5a4884,null));};exports['update']=function(_0x1c098c,_0x55b651){if(_0x1c098c[_0x19e9('0x4b')]['id']){delete _0x1c098c[_0x19e9('0x4b')]['id'];}return db['SquareReport'][_0x19e9('0x49')]({'where':{'id':_0x1c098c[_0x19e9('0x48')]['id']}})[_0x19e9('0x25')](handleEntityNotFound(_0x55b651,null))[_0x19e9('0x25')](saveUpdates(_0x1c098c[_0x19e9('0x4b')],null))[_0x19e9('0x25')](respondWithResult(_0x55b651,null))[_0x19e9('0x46')](handleError(_0x55b651,null));};exports[_0x19e9('0x26')]=function(_0x39953d,_0x3ac70d){return db['SquareReport'][_0x19e9('0x49')]({'where':{'id':_0x39953d['params']['id']}})['then'](handleEntityNotFound(_0x3ac70d,null))[_0x19e9('0x25')](removeEntity(_0x3ac70d,null))[_0x19e9('0x46')](handleError(_0x3ac70d,null));};exports[_0x19e9('0x4c')]=function(_0x5670a4,_0x4fd75b){return db[_0x19e9('0x43')]['describe']()[_0x19e9('0x25')](respondWithResult(_0x4fd75b,null))[_0x19e9('0x46')](handleError(_0x4fd75b,null));}; \ No newline at end of file +var _0xcf24=['path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','SquareReport','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x3503e5,_0x490a96){var _0x2059fa=function(_0x6e735f){while(--_0x6e735f){_0x3503e5['push'](_0x3503e5['shift']());}};_0x2059fa(++_0x490a96);}(_0xcf24,0x92));var _0x4cf2=function(_0x3cf9a8,_0x3b907e){_0x3cf9a8=_0x3cf9a8-0x0;var _0x2a2096=_0xcf24[_0x3cf9a8];return _0x2a2096;};'use strict';var pdf=require(_0x4cf2('0x0'));var emlformat=require(_0x4cf2('0x1'));var rimraf=require(_0x4cf2('0x2'));var zipdir=require(_0x4cf2('0x3'));var jsonpatch=require(_0x4cf2('0x4'));var rp=require(_0x4cf2('0x5'));var moment=require(_0x4cf2('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4cf2('0x7'));var util=require('util');var path=require(_0x4cf2('0x8'));var sox=require(_0x4cf2('0x9'));var csv=require(_0x4cf2('0xa'));var ejs=require(_0x4cf2('0xb'));var fs=require('fs');var _=require(_0x4cf2('0xc'));var squel=require('squel');var crypto=require(_0x4cf2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4cf2('0xe'));var toCsv=require(_0x4cf2('0xa'));var querystring=require(_0x4cf2('0xf'));var Papa=require(_0x4cf2('0x10'));var Redis=require('ioredis');var authService=require(_0x4cf2('0x11'));var qs=require(_0x4cf2('0x12'));var as=require(_0x4cf2('0x13'));var hardwareService=require(_0x4cf2('0x14'));var logger=require(_0x4cf2('0x15'))(_0x4cf2('0x16'));var utils=require(_0x4cf2('0x17'));var config=require(_0x4cf2('0x18'));var db=require(_0x4cf2('0x19'))['db'];function respondWithStatusCode(_0x44e8e1,_0x34074d){_0x34074d=_0x34074d||0xcc;return function(_0x45fe42){if(_0x45fe42){return _0x44e8e1[_0x4cf2('0x1a')](_0x34074d);}return _0x44e8e1[_0x4cf2('0x1b')](_0x34074d)[_0x4cf2('0x1c')]();};}function respondWithResult(_0x41cc02,_0x418ec8){_0x418ec8=_0x418ec8||0xc8;return function(_0x132cc4){if(_0x132cc4){return _0x41cc02['status'](_0x418ec8)[_0x4cf2('0x1d')](_0x132cc4);}};}function respondWithFilteredResult(_0x5693a2,_0x2f4bb7){return function(_0x3a5e22){if(_0x3a5e22){var _0x1d276b=_0x3a5e22[_0x4cf2('0x1e')],_0x31983b=_0x2f4bb7[_0x4cf2('0x1f')],_0x3d1d0f=_0x2f4bb7[_0x4cf2('0x1f')]+_0x2f4bb7[_0x4cf2('0x20')],_0x5f0e1f;if(_0x3d1d0f>=_0x1d276b){_0x3d1d0f=_0x1d276b;_0x5f0e1f=0xc8;}else{_0x5f0e1f=0xce;}_0x5693a2['status'](_0x5f0e1f);return _0x5693a2[_0x4cf2('0x21')]('Content-Range',_0x31983b+'-'+_0x3d1d0f+'/'+_0x1d276b)['json'](_0x3a5e22);}return null;};}function patchUpdates(_0x324d45){return function(_0x37cfad){try{jsonpatch[_0x4cf2('0x22')](_0x37cfad,_0x324d45,!![]);}catch(_0x3818c4){return BPromise[_0x4cf2('0x23')](_0x3818c4);}return _0x37cfad[_0x4cf2('0x24')]();};}function saveUpdates(_0x54ed65,_0x44338d){return function(_0x2c1722){if(_0x2c1722){return _0x2c1722[_0x4cf2('0x25')](_0x54ed65)[_0x4cf2('0x26')](function(_0x3921d5){return _0x3921d5;});}return null;};}function removeEntity(_0x176e36,_0x27de57){return function(_0x42cdc7){if(_0x42cdc7){return _0x42cdc7['destroy']()[_0x4cf2('0x26')](function(){_0x176e36[_0x4cf2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x552d3c,_0x2e1ba2){return function(_0x192c44){if(!_0x192c44){_0x552d3c[_0x4cf2('0x1a')](0x194);}return _0x192c44;};}function handleError(_0x7e0349,_0x90e247){_0x90e247=_0x90e247||0x1f4;return function(_0x52e9be){logger[_0x4cf2('0x27')](_0x52e9be[_0x4cf2('0x28')]);if(_0x52e9be[_0x4cf2('0x29')]){delete _0x52e9be['name'];}_0x7e0349['status'](_0x90e247)[_0x4cf2('0x2a')](_0x52e9be);};}exports[_0x4cf2('0x2b')]=function(_0x2fdcb6,_0x5ba3d9){var _0x11b974={},_0x2a48da={},_0x4eb2b0={'count':0x0,'rows':[]};var _0x2a24b0=_[_0x4cf2('0x2c')](db['SquareReport'][_0x4cf2('0x2d')],function(_0x55d77f){return{'name':_0x55d77f['fieldName'],'type':_0x55d77f[_0x4cf2('0x2e')]['key']};});_0x2a48da[_0x4cf2('0x2f')]=_['map'](_0x2a24b0,_0x4cf2('0x29'));_0x2a48da['query']=_[_0x4cf2('0x30')](_0x2fdcb6[_0x4cf2('0x31')]);_0x2a48da['filters']=_[_0x4cf2('0x32')](_0x2a48da[_0x4cf2('0x2f')],_0x2a48da[_0x4cf2('0x31')]);_0x11b974[_0x4cf2('0x33')]=_[_0x4cf2('0x32')](_0x2a48da[_0x4cf2('0x2f')],qs[_0x4cf2('0x34')](_0x2fdcb6[_0x4cf2('0x31')]['fields']));_0x11b974[_0x4cf2('0x33')]=_0x11b974[_0x4cf2('0x33')][_0x4cf2('0x35')]?_0x11b974[_0x4cf2('0x33')]:_0x2a48da[_0x4cf2('0x2f')];if(!_0x2fdcb6['query'][_0x4cf2('0x36')](_0x4cf2('0x37'))){_0x11b974[_0x4cf2('0x20')]=qs['limit'](_0x2fdcb6[_0x4cf2('0x31')][_0x4cf2('0x20')]);_0x11b974[_0x4cf2('0x1f')]=qs[_0x4cf2('0x1f')](_0x2fdcb6[_0x4cf2('0x31')][_0x4cf2('0x1f')]);}_0x11b974[_0x4cf2('0x38')]=qs[_0x4cf2('0x39')](_0x2fdcb6[_0x4cf2('0x31')]['sort']);_0x11b974['where']=qs[_0x4cf2('0x3a')](_[_0x4cf2('0x3b')](_0x2fdcb6[_0x4cf2('0x31')],_0x2a48da[_0x4cf2('0x3a')]),_0x2a24b0);if(_0x2fdcb6[_0x4cf2('0x31')][_0x4cf2('0x3c')]){_0x11b974[_0x4cf2('0x3d')]=_[_0x4cf2('0x3e')](_0x11b974[_0x4cf2('0x3d')],{'$or':_[_0x4cf2('0x2c')](_0x2a24b0,function(_0x57db73){if(_0x57db73['type']!=='VIRTUAL'){var _0x3dac59={};_0x3dac59[_0x57db73[_0x4cf2('0x29')]]={'$like':'%'+_0x2fdcb6[_0x4cf2('0x31')]['filter']+'%'};return _0x3dac59;}})});}_0x11b974=_['merge']({},_0x11b974,_0x2fdcb6[_0x4cf2('0x3f')]);var _0x535eb8={'where':_0x11b974[_0x4cf2('0x3d')]};return db[_0x4cf2('0x40')][_0x4cf2('0x1e')](_0x535eb8)[_0x4cf2('0x26')](function(_0xd6e19d){_0x4eb2b0[_0x4cf2('0x1e')]=_0xd6e19d;if(_0x2fdcb6['query']['includeAll']){_0x11b974[_0x4cf2('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0x4cf2('0x42')](_0x11b974);})['then'](function(_0x24998f){_0x4eb2b0[_0x4cf2('0x43')]=_0x24998f;return _0x4eb2b0;})[_0x4cf2('0x26')](respondWithFilteredResult(_0x5ba3d9,_0x11b974))[_0x4cf2('0x44')](handleError(_0x5ba3d9,null));};exports[_0x4cf2('0x45')]=function(_0x384dee,_0x8fe2ae){var _0xea2915={'raw':!![],'where':{'id':_0x384dee[_0x4cf2('0x46')]['id']}},_0x42807f={};_0x42807f[_0x4cf2('0x2f')]=_[_0x4cf2('0x30')](db[_0x4cf2('0x40')]['rawAttributes']);_0x42807f[_0x4cf2('0x31')]=_[_0x4cf2('0x30')](_0x384dee[_0x4cf2('0x31')]);_0x42807f[_0x4cf2('0x3a')]=_[_0x4cf2('0x32')](_0x42807f[_0x4cf2('0x2f')],_0x42807f[_0x4cf2('0x31')]);_0xea2915['attributes']=_['intersection'](_0x42807f[_0x4cf2('0x2f')],qs[_0x4cf2('0x34')](_0x384dee[_0x4cf2('0x31')]['fields']));_0xea2915[_0x4cf2('0x33')]=_0xea2915[_0x4cf2('0x33')][_0x4cf2('0x35')]?_0xea2915[_0x4cf2('0x33')]:_0x42807f[_0x4cf2('0x2f')];if(_0x384dee[_0x4cf2('0x31')][_0x4cf2('0x47')]){_0xea2915['include']=[{'all':!![]}];}_0xea2915=_[_0x4cf2('0x3e')]({},_0xea2915,_0x384dee[_0x4cf2('0x3f')]);return db[_0x4cf2('0x40')]['find'](_0xea2915)['then'](handleEntityNotFound(_0x8fe2ae,null))[_0x4cf2('0x26')](respondWithResult(_0x8fe2ae,null))[_0x4cf2('0x44')](handleError(_0x8fe2ae,null));};exports['create']=function(_0x58984c,_0x81aabf){return db['SquareReport'][_0x4cf2('0x48')](_0x58984c[_0x4cf2('0x49')],{})[_0x4cf2('0x26')](respondWithResult(_0x81aabf,0xc9))[_0x4cf2('0x44')](handleError(_0x81aabf,null));};exports[_0x4cf2('0x25')]=function(_0x549115,_0x2ac53d){if(_0x549115[_0x4cf2('0x49')]['id']){delete _0x549115[_0x4cf2('0x49')]['id'];}return db[_0x4cf2('0x40')][_0x4cf2('0x4a')]({'where':{'id':_0x549115[_0x4cf2('0x46')]['id']}})[_0x4cf2('0x26')](handleEntityNotFound(_0x2ac53d,null))[_0x4cf2('0x26')](saveUpdates(_0x549115[_0x4cf2('0x49')],null))['then'](respondWithResult(_0x2ac53d,null))[_0x4cf2('0x44')](handleError(_0x2ac53d,null));};exports[_0x4cf2('0x4b')]=function(_0x1ab3cf,_0x125037){return db[_0x4cf2('0x40')]['find']({'where':{'id':_0x1ab3cf[_0x4cf2('0x46')]['id']}})[_0x4cf2('0x26')](handleEntityNotFound(_0x125037,null))[_0x4cf2('0x26')](removeEntity(_0x125037,null))[_0x4cf2('0x44')](handleError(_0x125037,null));};exports[_0x4cf2('0x4c')]=function(_0x159680,_0xf28fb5){return db[_0x4cf2('0x40')][_0x4cf2('0x4c')]()[_0x4cf2('0x26')](respondWithResult(_0xf28fb5,null))[_0x4cf2('0x44')](handleError(_0xf28fb5,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b8b1f93..3e91f4d 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 _0x26c0=['leaveAt','util','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','report_square','uid_pname','project_name'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x26c0,0x105));var _0x026c=function(_0x46dfbe,_0x2d44ad){_0x46dfbe=_0x46dfbe-0x0;var _0x488a4e=_0x26c0[_0x46dfbe];return _0x488a4e;};'use strict';var _=require('lodash');var util=require(_0x026c('0x0'));var logger=require('../../config/logger')(_0x026c('0x1'));var moment=require(_0x026c('0x2'));var BPromise=require(_0x026c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x026c('0x4'));var rimraf=require(_0x026c('0x5'));var config=require(_0x026c('0x6'));var attributes=require(_0x026c('0x7'));module[_0x026c('0x8')]=function(_0x2470bd,_0x5ed9e3){return _0x2470bd['define']('SquareReport',attributes,{'tableName':_0x026c('0x9'),'paranoid':![],'indexes':[{'name':_0x026c('0xa'),'fields':['uniqueid',_0x026c('0xb')]},{'name':_0x026c('0xc'),'fields':[_0x026c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x513a=['rimraf','define','report_square','leaveAt','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x44865b,_0x1730f0){var _0x5d8362=function(_0x36b776){while(--_0x36b776){_0x44865b['push'](_0x44865b['shift']());}};_0x5d8362(++_0x1730f0);}(_0x513a,0x1e4));var _0xa513=function(_0x5c7107,_0x3c9e3a){_0x5c7107=_0x5c7107-0x0;var _0x52d2cb=_0x513a[_0x5c7107];return _0x52d2cb;};'use strict';var _=require(_0xa513('0x0'));var util=require(_0xa513('0x1'));var logger=require(_0xa513('0x2'))('api');var moment=require(_0xa513('0x3'));var BPromise=require('bluebird');var rp=require(_0xa513('0x4'));var fs=require('fs');var path=require(_0xa513('0x5'));var rimraf=require(_0xa513('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module['exports']=function(_0x2c80a1,_0x20dbcf){return _0x2c80a1[_0xa513('0x7')]('SquareReport',attributes,{'tableName':_0xa513('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid','project_name']},{'name':'leaveAt','fields':[_0xa513('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index ac432d8..1123a57 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 _0x2320=['CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x2dd19a,_0x211dd8){var _0x3c853d=function(_0x5f04a0){while(--_0x5f04a0){_0x2dd19a['push'](_0x2dd19a['shift']());}};_0x3c853d(++_0x211dd8);}(_0x2320,0xf2));var _0x0232=function(_0x2102e6,_0x500300){_0x2102e6=_0x2102e6-0x0;var _0x9dc46e=_0x2320[_0x2102e6];return _0x9dc46e;};'use strict';var _=require('lodash');var util=require(_0x0232('0x0'));var moment=require(_0x0232('0x1'));var BPromise=require(_0x0232('0x2'));var rs=require(_0x0232('0x3'));var fs=require('fs');var Redis=require(_0x0232('0x4'));var db=require(_0x0232('0x5'))['db'];var utils=require(_0x0232('0x6'));var logger=require(_0x0232('0x7'))(_0x0232('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0232('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eea8b,_0x5b64ca,_0x1384f1){return new BPromise(function(_0x40866b,_0x1d0d7c){return client['request'](_0x4eea8b,_0x1384f1)[_0x0232('0xa')](function(_0x1e4a12){logger['info']('SquareReport,\x20%s,\x20%s',_0x5b64ca,_0x0232('0xb'));logger[_0x0232('0xc')](_0x0232('0xd'),_0x5b64ca,_0x0232('0xb'),JSON[_0x0232('0xe')](_0x1e4a12));if(_0x1e4a12[_0x0232('0xf')]){if(_0x1e4a12[_0x0232('0xf')][_0x0232('0x10')]===0x1f4){logger[_0x0232('0xf')](_0x0232('0x11'),_0x5b64ca,_0x1e4a12[_0x0232('0xf')][_0x0232('0x12')]);return _0x1d0d7c(_0x1e4a12['error'][_0x0232('0x12')]);}logger[_0x0232('0xf')](_0x0232('0x11'),_0x5b64ca,_0x1e4a12[_0x0232('0xf')]['message']);return _0x40866b(_0x1e4a12[_0x0232('0xf')][_0x0232('0x12')]);}else{logger[_0x0232('0x13')](_0x0232('0x11'),_0x5b64ca,'request\x20sent');_0x40866b(_0x1e4a12[_0x0232('0x14')][_0x0232('0x12')]);}})[_0x0232('0x15')](function(_0x49ff9b){logger[_0x0232('0xf')]('SquareReport,\x20%s,\x20%s',_0x5b64ca,_0x49ff9b);_0x1d0d7c(_0x49ff9b);});});}exports[_0x0232('0x16')]=function(_0x3410d8){var _0x1c6be2=this;return new Promise(function(_0x36a02b,_0x59bc12){return db['SquareReport'][_0x0232('0x17')](_0x3410d8[_0x0232('0x18')],{'raw':_0x3410d8[_0x0232('0x19')]?_0x3410d8[_0x0232('0x19')][_0x0232('0x1a')]===undefined?!![]:![]:!![]})[_0x0232('0xa')](function(_0x2bc20b){logger['info'](_0x0232('0x16'),_0x3410d8);logger[_0x0232('0xc')](_0x0232('0x16'),_0x3410d8,JSON[_0x0232('0xe')](_0x2bc20b));_0x36a02b(_0x2bc20b);})[_0x0232('0x15')](function(_0x1dcc5d){logger['error']('CreateSquareReport',_0x1dcc5d[_0x0232('0x12')],_0x3410d8);_0x59bc12(_0x1c6be2['error'](0x1f4,_0x1dcc5d[_0x0232('0x12')]));});});};exports[_0x0232('0x1b')]=function(_0x3739af){var _0x18635f=this;return new Promise(function(_0x2d7c9e,_0x1301a8){return db[_0x0232('0x1c')][_0x0232('0x1d')](_0x3739af[_0x0232('0x18')],{'raw':_0x3739af['options']?_0x3739af[_0x0232('0x19')][_0x0232('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3739af[_0x0232('0x19')]?_0x3739af[_0x0232('0x19')][_0x0232('0x1e')]||null:null,'attributes':_0x3739af['options']?_0x3739af[_0x0232('0x19')][_0x0232('0x1f')]||null:null,'limit':_0x3739af[_0x0232('0x19')]?_0x3739af[_0x0232('0x19')][_0x0232('0x20')]||null:null})[_0x0232('0xa')](function(_0x51d5f2){logger[_0x0232('0x13')]('UpdateSquareReport',_0x3739af);logger[_0x0232('0xc')]('UpdateSquareReport',_0x3739af,JSON[_0x0232('0xe')](_0x51d5f2));_0x2d7c9e(_0x51d5f2);})[_0x0232('0x15')](function(_0xc1c2aa){logger[_0x0232('0xf')](_0x0232('0x1b'),_0xc1c2aa[_0x0232('0x12')],_0x3739af);_0x1301a8(_0x18635f[_0x0232('0xf')](0x1f4,_0xc1c2aa[_0x0232('0x12')]));});});}; \ No newline at end of file +var _0xfce6=['catch','SquareReport','create','body','options','raw','then','CreateSquareReport','stringify','UpdateSquareReport','update','where','attributes','lodash','util','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xfce6,0x143));var _0x6fce=function(_0x502784,_0x12a1b0){_0x502784=_0x502784-0x0;var _0x5657f0=_0xfce6[_0x502784];return _0x5657f0;};'use strict';var _=require(_0x6fce('0x0'));var util=require(_0x6fce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6fce('0x2'));var fs=require('fs');var Redis=require(_0x6fce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fce('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6fce('0x5'));var jayson=require(_0x6fce('0x6'));var client=jayson[_0x6fce('0x7')][_0x6fce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d36ca,_0x3a2c9b,_0x22c175){return new BPromise(function(_0x316238,_0x1630f7){return client[_0x6fce('0x9')](_0x2d36ca,_0x22c175)['then'](function(_0xa62c21){logger[_0x6fce('0xa')](_0x6fce('0xb'),_0x3a2c9b,_0x6fce('0xc'));logger[_0x6fce('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x3a2c9b,_0x6fce('0xc'),JSON['stringify'](_0xa62c21));if(_0xa62c21[_0x6fce('0xe')]){if(_0xa62c21[_0x6fce('0xe')][_0x6fce('0xf')]===0x1f4){logger[_0x6fce('0xe')](_0x6fce('0xb'),_0x3a2c9b,_0xa62c21[_0x6fce('0xe')][_0x6fce('0x10')]);return _0x1630f7(_0xa62c21[_0x6fce('0xe')][_0x6fce('0x10')]);}logger[_0x6fce('0xe')](_0x6fce('0xb'),_0x3a2c9b,_0xa62c21[_0x6fce('0xe')][_0x6fce('0x10')]);return _0x316238(_0xa62c21['error']['message']);}else{logger[_0x6fce('0xa')](_0x6fce('0xb'),_0x3a2c9b,_0x6fce('0xc'));_0x316238(_0xa62c21[_0x6fce('0x11')][_0x6fce('0x10')]);}})[_0x6fce('0x12')](function(_0x2ebeaf){logger['error']('SquareReport,\x20%s,\x20%s',_0x3a2c9b,_0x2ebeaf);_0x1630f7(_0x2ebeaf);});});}exports['CreateSquareReport']=function(_0x261fa5){var _0x483a37=this;return new Promise(function(_0x5bda19,_0x41a933){return db[_0x6fce('0x13')][_0x6fce('0x14')](_0x261fa5[_0x6fce('0x15')],{'raw':_0x261fa5[_0x6fce('0x16')]?_0x261fa5[_0x6fce('0x16')][_0x6fce('0x17')]===undefined?!![]:![]:!![]})[_0x6fce('0x18')](function(_0x2e0ce1){logger['info'](_0x6fce('0x19'),_0x261fa5);logger[_0x6fce('0xd')](_0x6fce('0x19'),_0x261fa5,JSON[_0x6fce('0x1a')](_0x2e0ce1));_0x5bda19(_0x2e0ce1);})['catch'](function(_0x295f17){logger[_0x6fce('0xe')](_0x6fce('0x19'),_0x295f17[_0x6fce('0x10')],_0x261fa5);_0x41a933(_0x483a37[_0x6fce('0xe')](0x1f4,_0x295f17[_0x6fce('0x10')]));});});};exports[_0x6fce('0x1b')]=function(_0x10a65b){var _0x21fa3f=this;return new Promise(function(_0x5aff80,_0x468c0a){return db[_0x6fce('0x13')][_0x6fce('0x1c')](_0x10a65b[_0x6fce('0x15')],{'raw':_0x10a65b[_0x6fce('0x16')]?_0x10a65b[_0x6fce('0x16')][_0x6fce('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10a65b[_0x6fce('0x16')]?_0x10a65b['options'][_0x6fce('0x1d')]||null:null,'attributes':_0x10a65b[_0x6fce('0x16')]?_0x10a65b[_0x6fce('0x16')][_0x6fce('0x1e')]||null:null,'limit':_0x10a65b[_0x6fce('0x16')]?_0x10a65b['options']['limit']||null:null})[_0x6fce('0x18')](function(_0xe25752){logger[_0x6fce('0xa')]('UpdateSquareReport',_0x10a65b);logger[_0x6fce('0xd')]('UpdateSquareReport',_0x10a65b,JSON[_0x6fce('0x1a')](_0xe25752));_0x5aff80(_0xe25752);})[_0x6fce('0x12')](function(_0x4ef32b){logger[_0x6fce('0xe')](_0x6fce('0x1b'),_0x4ef32b[_0x6fce('0x10')],_0x10a65b);_0x468c0a(_0x21fa3f[_0x6fce('0xe')](0x1f4,_0x4ef32b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 70e253c..3c7e7c8 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(_0x391779,_0x1fbd79){var _0x104f1e=function(_0x220fd7){while(--_0x220fd7){_0x391779['push'](_0x391779['shift']());}};_0x104f1e(++_0x1fbd79);}(_0x5f2f,0x73));var _0xf5f2=function(_0x71e9e4,_0x2b8f91){_0x71e9e4=_0x71e9e4-0x0;var _0x44f29d=_0x5f2f[_0x71e9e4];return _0x44f29d;};'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 _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(_0x4d0527,_0x40e7b9){var _0x37f03e=function(_0x1b51e6){while(--_0x1b51e6){_0x4d0527['push'](_0x4d0527['shift']());}};_0x37f03e(++_0x40e7b9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5438b6,_0x446306){_0x5438b6=_0x5438b6-0x0;var _0x4680fa=_0x5f2f[_0x5438b6];return _0x4680fa;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index bb76717..c3120fa 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 _0x6795=['STRING','TEXT','sequelize','exports'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x6795,0x106));var _0x5679=function(_0x1a8dc7,_0x2835f1){_0x1a8dc7=_0x1a8dc7-0x0;var _0x306cf0=_0x6795[_0x1a8dc7];return _0x306cf0;};'use strict';var Sequelize=require(_0x5679('0x0'));module[_0x5679('0x1')]={'uniqueid':{'type':Sequelize[_0x5679('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x5679('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5679('0x2')]}}; \ No newline at end of file +var _0xcaaf=['exports','STRING','TEXT'];(function(_0x1b6318,_0x5761fd){var _0x573968=function(_0x2b47fd){while(--_0x2b47fd){_0x1b6318['push'](_0x1b6318['shift']());}};_0x573968(++_0x5761fd);}(_0xcaaf,0x129));var _0xfcaa=function(_0x36e0e,_0x50a25c){_0x36e0e=_0x36e0e-0x0;var _0x5a0f02=_0xcaaf[_0x36e0e];return _0x5a0f02;};'use strict';var Sequelize=require('sequelize');module[_0xfcaa('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xfcaa('0x1')]},'data':{'type':Sequelize[_0xfcaa('0x2')]},'project_name':{'type':Sequelize[_0xfcaa('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 06704bb..0e6142b 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 _0xd2cc=['stack','name','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','error'];(function(_0x31e876,_0x1c42ef){var _0x59d945=function(_0x4cf41d){while(--_0x4cf41d){_0x31e876['push'](_0x31e876['shift']());}};_0x59d945(++_0x1c42ef);}(_0xd2cc,0x107));var _0xcd2c=function(_0x3405bc,_0x478030){_0x3405bc=_0x3405bc-0x0;var _0xb1a44=_0xd2cc[_0x3405bc];return _0xb1a44;};'use strict';var pdf=require(_0xcd2c('0x0'));var emlformat=require(_0xcd2c('0x1'));var rimraf=require(_0xcd2c('0x2'));var zipdir=require(_0xcd2c('0x3'));var jsonpatch=require(_0xcd2c('0x4'));var rp=require(_0xcd2c('0x5'));var moment=require(_0xcd2c('0x6'));var BPromise=require(_0xcd2c('0x7'));var Mustache=require(_0xcd2c('0x8'));var util=require(_0xcd2c('0x9'));var path=require('path');var sox=require(_0xcd2c('0xa'));var csv=require('to-csv');var ejs=require(_0xcd2c('0xb'));var fs=require('fs');var _=require(_0xcd2c('0xc'));var squel=require(_0xcd2c('0xd'));var crypto=require(_0xcd2c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcd2c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcd2c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd2c('0x11'));var as=require(_0xcd2c('0x12'));var hardwareService=require(_0xcd2c('0x13'));var logger=require(_0xcd2c('0x14'))(_0xcd2c('0x15'));var utils=require('../../config/utils');var config=require(_0xcd2c('0x16'));var db=require(_0xcd2c('0x17'))['db'];function respondWithStatusCode(_0x32849a,_0x95ae34){_0x95ae34=_0x95ae34||0xcc;return function(_0x412e74){if(_0x412e74){return _0x32849a[_0xcd2c('0x18')](_0x95ae34);}return _0x32849a[_0xcd2c('0x19')](_0x95ae34)['end']();};}function respondWithResult(_0x3f99e7,_0x455e7d){_0x455e7d=_0x455e7d||0xc8;return function(_0x1d7aac){if(_0x1d7aac){return _0x3f99e7[_0xcd2c('0x19')](_0x455e7d)[_0xcd2c('0x1a')](_0x1d7aac);}};}function respondWithFilteredResult(_0x2de767,_0x599c90){return function(_0x5721db){if(_0x5721db){var _0xab996c=_0x5721db[_0xcd2c('0x1b')],_0x541729=_0x599c90[_0xcd2c('0x1c')],_0x71621a=_0x599c90[_0xcd2c('0x1c')]+_0x599c90['limit'],_0x5c52e7;if(_0x71621a>=_0xab996c){_0x71621a=_0xab996c;_0x5c52e7=0xc8;}else{_0x5c52e7=0xce;}_0x2de767[_0xcd2c('0x19')](_0x5c52e7);return _0x2de767[_0xcd2c('0x1d')](_0xcd2c('0x1e'),_0x541729+'-'+_0x71621a+'/'+_0xab996c)[_0xcd2c('0x1a')](_0x5721db);}return null;};}function patchUpdates(_0x178273){return function(_0x538cf1){try{jsonpatch[_0xcd2c('0x1f')](_0x538cf1,_0x178273,!![]);}catch(_0x1bd387){return BPromise[_0xcd2c('0x20')](_0x1bd387);}return _0x538cf1[_0xcd2c('0x21')]();};}function saveUpdates(_0x37ab7d,_0x5d8361){return function(_0x18aace){if(_0x18aace){return _0x18aace[_0xcd2c('0x22')](_0x37ab7d)[_0xcd2c('0x23')](function(_0x1ad456){return _0x1ad456;});}return null;};}function removeEntity(_0x5d8ca4,_0x5e7fcc){return function(_0x154f62){if(_0x154f62){return _0x154f62['destroy']()['then'](function(){_0x5d8ca4[_0xcd2c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321bdd,_0x8b8516){return function(_0x2b42af){if(!_0x2b42af){_0x321bdd[_0xcd2c('0x18')](0x194);}return _0x2b42af;};}function handleError(_0x158eb7,_0x37ce75){_0x37ce75=_0x37ce75||0x1f4;return function(_0x3ba5e9){logger[_0xcd2c('0x24')](_0x3ba5e9[_0xcd2c('0x25')]);if(_0x3ba5e9[_0xcd2c('0x26')]){delete _0x3ba5e9['name'];}_0x158eb7[_0xcd2c('0x19')](_0x37ce75)['send'](_0x3ba5e9);};}exports[_0xcd2c('0x27')]=function(_0x4381f3,_0x3b8d6b){var _0x1bf530={},_0x5475b8={},_0xe8ad68={'count':0x0,'rows':[]};var _0x4b24ba=_['map'](db[_0xcd2c('0x28')][_0xcd2c('0x29')],function(_0x15eadb){return{'name':_0x15eadb[_0xcd2c('0x2a')],'type':_0x15eadb[_0xcd2c('0x2b')][_0xcd2c('0x2c')]};});_0x5475b8[_0xcd2c('0x2d')]=_[_0xcd2c('0x2e')](_0x4b24ba,_0xcd2c('0x26'));_0x5475b8[_0xcd2c('0x2f')]=_['keys'](_0x4381f3[_0xcd2c('0x2f')]);_0x5475b8[_0xcd2c('0x30')]=_['intersection'](_0x5475b8[_0xcd2c('0x2d')],_0x5475b8['query']);_0x1bf530[_0xcd2c('0x31')]=_[_0xcd2c('0x32')](_0x5475b8[_0xcd2c('0x2d')],qs[_0xcd2c('0x33')](_0x4381f3['query'][_0xcd2c('0x33')]));_0x1bf530[_0xcd2c('0x31')]=_0x1bf530[_0xcd2c('0x31')][_0xcd2c('0x34')]?_0x1bf530['attributes']:_0x5475b8[_0xcd2c('0x2d')];if(!_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x35')]('nolimit')){_0x1bf530[_0xcd2c('0x36')]=qs['limit'](_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x36')]);_0x1bf530[_0xcd2c('0x1c')]=qs['offset'](_0x4381f3['query'][_0xcd2c('0x1c')]);}_0x1bf530[_0xcd2c('0x37')]=qs[_0xcd2c('0x38')](_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x38')]);_0x1bf530[_0xcd2c('0x39')]=qs[_0xcd2c('0x30')](_[_0xcd2c('0x3a')](_0x4381f3['query'],_0x5475b8[_0xcd2c('0x30')]),_0x4b24ba);if(_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x3b')]){_0x1bf530[_0xcd2c('0x39')]=_['merge'](_0x1bf530[_0xcd2c('0x39')],{'$or':_[_0xcd2c('0x2e')](_0x4b24ba,function(_0x4579f3){if(_0x4579f3[_0xcd2c('0x2b')]!=='VIRTUAL'){var _0x38fee8={};_0x38fee8[_0x4579f3['name']]={'$like':'%'+_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x3b')]+'%'};return _0x38fee8;}})});}_0x1bf530=_[_0xcd2c('0x3c')]({},_0x1bf530,_0x4381f3['options']);var _0x451e07={'where':_0x1bf530[_0xcd2c('0x39')]};return db['SquareDetailsReport'][_0xcd2c('0x1b')](_0x451e07)[_0xcd2c('0x23')](function(_0x3d2eb6){_0xe8ad68[_0xcd2c('0x1b')]=_0x3d2eb6;if(_0x4381f3[_0xcd2c('0x2f')][_0xcd2c('0x3d')]){_0x1bf530[_0xcd2c('0x3e')]=[{'all':!![]}];}return db[_0xcd2c('0x28')][_0xcd2c('0x3f')](_0x1bf530);})[_0xcd2c('0x23')](function(_0x5bf24d){_0xe8ad68[_0xcd2c('0x40')]=_0x5bf24d;return _0xe8ad68;})[_0xcd2c('0x23')](respondWithFilteredResult(_0x3b8d6b,_0x1bf530))[_0xcd2c('0x41')](handleError(_0x3b8d6b,null));};exports[_0xcd2c('0x42')]=function(_0x10a33d,_0x35eafe){var _0x119be8={'raw':!![],'where':{'id':_0x10a33d['params']['id']}},_0x48d236={};_0x48d236['model']=_[_0xcd2c('0x43')](db[_0xcd2c('0x28')][_0xcd2c('0x29')]);_0x48d236[_0xcd2c('0x2f')]=_[_0xcd2c('0x43')](_0x10a33d[_0xcd2c('0x2f')]);_0x48d236['filters']=_[_0xcd2c('0x32')](_0x48d236[_0xcd2c('0x2d')],_0x48d236[_0xcd2c('0x2f')]);_0x119be8['attributes']=_['intersection'](_0x48d236[_0xcd2c('0x2d')],qs[_0xcd2c('0x33')](_0x10a33d[_0xcd2c('0x2f')]['fields']));_0x119be8['attributes']=_0x119be8[_0xcd2c('0x31')][_0xcd2c('0x34')]?_0x119be8[_0xcd2c('0x31')]:_0x48d236['model'];if(_0x10a33d['query'][_0xcd2c('0x3d')]){_0x119be8[_0xcd2c('0x3e')]=[{'all':!![]}];}_0x119be8=_[_0xcd2c('0x3c')]({},_0x119be8,_0x10a33d[_0xcd2c('0x44')]);return db['SquareDetailsReport'][_0xcd2c('0x45')](_0x119be8)[_0xcd2c('0x23')](handleEntityNotFound(_0x35eafe,null))['then'](respondWithResult(_0x35eafe,null))[_0xcd2c('0x41')](handleError(_0x35eafe,null));};exports['create']=function(_0x2c4805,_0x499cdb){return db[_0xcd2c('0x28')][_0xcd2c('0x46')](_0x2c4805[_0xcd2c('0x47')],{})[_0xcd2c('0x23')](respondWithResult(_0x499cdb,0xc9))[_0xcd2c('0x41')](handleError(_0x499cdb,null));};exports[_0xcd2c('0x22')]=function(_0x556326,_0x15a6a9){if(_0x556326[_0xcd2c('0x47')]['id']){delete _0x556326[_0xcd2c('0x47')]['id'];}return db[_0xcd2c('0x28')][_0xcd2c('0x45')]({'where':{'id':_0x556326[_0xcd2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x15a6a9,null))[_0xcd2c('0x23')](saveUpdates(_0x556326[_0xcd2c('0x47')],null))[_0xcd2c('0x23')](respondWithResult(_0x15a6a9,null))[_0xcd2c('0x41')](handleError(_0x15a6a9,null));};exports[_0xcd2c('0x49')]=function(_0x5620d0,_0x3b47df){return db[_0xcd2c('0x28')][_0xcd2c('0x45')]({'where':{'id':_0x5620d0[_0xcd2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b47df,null))['then'](removeEntity(_0x3b47df,null))[_0xcd2c('0x41')](handleError(_0x3b47df,null));};exports['describe']=function(_0x4c05fa,_0x51984c){return db['SquareDetailsReport'][_0xcd2c('0x4a')]()[_0xcd2c('0x23')](respondWithResult(_0x51984c,null))[_0xcd2c('0x41')](handleError(_0x51984c,null));}; \ No newline at end of file +var _0x6b10=['error','name','send','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','rawAttributes','length','options','catch','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then'];(function(_0x276d5c,_0x1c171e){var _0x1d5997=function(_0x33e6c3){while(--_0x33e6c3){_0x276d5c['push'](_0x276d5c['shift']());}};_0x1d5997(++_0x1c171e);}(_0x6b10,0x1ee));var _0x06b1=function(_0x1384c0,_0x3f628e){_0x1384c0=_0x1384c0-0x0;var _0x4c85f3=_0x6b10[_0x1384c0];return _0x4c85f3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x06b1('0x0'));var zipdir=require(_0x06b1('0x1'));var jsonpatch=require(_0x06b1('0x2'));var rp=require(_0x06b1('0x3'));var moment=require(_0x06b1('0x4'));var BPromise=require(_0x06b1('0x5'));var Mustache=require(_0x06b1('0x6'));var util=require(_0x06b1('0x7'));var path=require(_0x06b1('0x8'));var sox=require(_0x06b1('0x9'));var csv=require(_0x06b1('0xa'));var ejs=require(_0x06b1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x06b1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x06b1('0xd'));var toCsv=require(_0x06b1('0xa'));var querystring=require(_0x06b1('0xe'));var Papa=require('papaparse');var Redis=require(_0x06b1('0xf'));var authService=require(_0x06b1('0x10'));var qs=require(_0x06b1('0x11'));var as=require(_0x06b1('0x12'));var hardwareService=require(_0x06b1('0x13'));var logger=require(_0x06b1('0x14'))(_0x06b1('0x15'));var utils=require(_0x06b1('0x16'));var config=require(_0x06b1('0x17'));var db=require(_0x06b1('0x18'))['db'];function respondWithStatusCode(_0x2bb07f,_0x24ce06){_0x24ce06=_0x24ce06||0xcc;return function(_0x5a730c){if(_0x5a730c){return _0x2bb07f[_0x06b1('0x19')](_0x24ce06);}return _0x2bb07f[_0x06b1('0x1a')](_0x24ce06)[_0x06b1('0x1b')]();};}function respondWithResult(_0x465b51,_0x217de2){_0x217de2=_0x217de2||0xc8;return function(_0x190f9b){if(_0x190f9b){return _0x465b51[_0x06b1('0x1a')](_0x217de2)['json'](_0x190f9b);}};}function respondWithFilteredResult(_0x1e5b9a,_0x693536){return function(_0x257a69){if(_0x257a69){var _0x17b4cc=_0x257a69[_0x06b1('0x1c')],_0x303554=_0x693536[_0x06b1('0x1d')],_0x1f1c87=_0x693536[_0x06b1('0x1d')]+_0x693536[_0x06b1('0x1e')],_0xa66c01;if(_0x1f1c87>=_0x17b4cc){_0x1f1c87=_0x17b4cc;_0xa66c01=0xc8;}else{_0xa66c01=0xce;}_0x1e5b9a[_0x06b1('0x1a')](_0xa66c01);return _0x1e5b9a[_0x06b1('0x1f')](_0x06b1('0x20'),_0x303554+'-'+_0x1f1c87+'/'+_0x17b4cc)[_0x06b1('0x21')](_0x257a69);}return null;};}function patchUpdates(_0x531260){return function(_0x316f7b){try{jsonpatch['apply'](_0x316f7b,_0x531260,!![]);}catch(_0x2eb421){return BPromise[_0x06b1('0x22')](_0x2eb421);}return _0x316f7b[_0x06b1('0x23')]();};}function saveUpdates(_0x578c36,_0xbdfc03){return function(_0x214dde){if(_0x214dde){return _0x214dde[_0x06b1('0x24')](_0x578c36)[_0x06b1('0x25')](function(_0x3bd849){return _0x3bd849;});}return null;};}function removeEntity(_0x509d7a,_0x3987e6){return function(_0x5b4ad5){if(_0x5b4ad5){return _0x5b4ad5['destroy']()[_0x06b1('0x25')](function(){_0x509d7a['status'](0xcc)[_0x06b1('0x1b')]();});}};}function handleEntityNotFound(_0x155d2a,_0x36c72c){return function(_0x4e3b62){if(!_0x4e3b62){_0x155d2a[_0x06b1('0x19')](0x194);}return _0x4e3b62;};}function handleError(_0xb5e249,_0x320cb5){_0x320cb5=_0x320cb5||0x1f4;return function(_0x1553b0){logger[_0x06b1('0x26')](_0x1553b0['stack']);if(_0x1553b0[_0x06b1('0x27')]){delete _0x1553b0[_0x06b1('0x27')];}_0xb5e249[_0x06b1('0x1a')](_0x320cb5)[_0x06b1('0x28')](_0x1553b0);};}exports['index']=function(_0x4d839c,_0x130e1f){var _0x5d9ee6={},_0x572556={},_0x36a2f7={'count':0x0,'rows':[]};var _0x57dcc5=_[_0x06b1('0x29')](db[_0x06b1('0x2a')]['rawAttributes'],function(_0x125e82){return{'name':_0x125e82[_0x06b1('0x2b')],'type':_0x125e82[_0x06b1('0x2c')][_0x06b1('0x2d')]};});_0x572556[_0x06b1('0x2e')]=_['map'](_0x57dcc5,_0x06b1('0x27'));_0x572556[_0x06b1('0x2f')]=_[_0x06b1('0x30')](_0x4d839c[_0x06b1('0x2f')]);_0x572556[_0x06b1('0x31')]=_[_0x06b1('0x32')](_0x572556[_0x06b1('0x2e')],_0x572556[_0x06b1('0x2f')]);_0x5d9ee6['attributes']=_[_0x06b1('0x32')](_0x572556['model'],qs[_0x06b1('0x33')](_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x33')]));_0x5d9ee6[_0x06b1('0x34')]=_0x5d9ee6[_0x06b1('0x34')]['length']?_0x5d9ee6[_0x06b1('0x34')]:_0x572556[_0x06b1('0x2e')];if(!_0x4d839c['query']['hasOwnProperty'](_0x06b1('0x35'))){_0x5d9ee6[_0x06b1('0x1e')]=qs[_0x06b1('0x1e')](_0x4d839c['query'][_0x06b1('0x1e')]);_0x5d9ee6[_0x06b1('0x1d')]=qs[_0x06b1('0x1d')](_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x1d')]);}_0x5d9ee6[_0x06b1('0x36')]=qs[_0x06b1('0x37')](_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x37')]);_0x5d9ee6[_0x06b1('0x38')]=qs[_0x06b1('0x31')](_[_0x06b1('0x39')](_0x4d839c[_0x06b1('0x2f')],_0x572556['filters']),_0x57dcc5);if(_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x3a')]){_0x5d9ee6[_0x06b1('0x38')]=_['merge'](_0x5d9ee6['where'],{'$or':_[_0x06b1('0x29')](_0x57dcc5,function(_0x42f2af){if(_0x42f2af['type']!==_0x06b1('0x3b')){var _0x5f1827={};_0x5f1827[_0x42f2af[_0x06b1('0x27')]]={'$like':'%'+_0x4d839c[_0x06b1('0x2f')]['filter']+'%'};return _0x5f1827;}})});}_0x5d9ee6=_[_0x06b1('0x3c')]({},_0x5d9ee6,_0x4d839c['options']);var _0x3eaa5f={'where':_0x5d9ee6['where']};return db[_0x06b1('0x2a')][_0x06b1('0x1c')](_0x3eaa5f)[_0x06b1('0x25')](function(_0x5cbbdc){_0x36a2f7[_0x06b1('0x1c')]=_0x5cbbdc;if(_0x4d839c[_0x06b1('0x2f')][_0x06b1('0x3d')]){_0x5d9ee6[_0x06b1('0x3e')]=[{'all':!![]}];}return db[_0x06b1('0x2a')][_0x06b1('0x3f')](_0x5d9ee6);})['then'](function(_0x3aed9f){_0x36a2f7[_0x06b1('0x40')]=_0x3aed9f;return _0x36a2f7;})[_0x06b1('0x25')](respondWithFilteredResult(_0x130e1f,_0x5d9ee6))['catch'](handleError(_0x130e1f,null));};exports[_0x06b1('0x41')]=function(_0x5e5293,_0x27175e){var _0x3daa9d={'raw':!![],'where':{'id':_0x5e5293[_0x06b1('0x42')]['id']}},_0x22204f={};_0x22204f[_0x06b1('0x2e')]=_[_0x06b1('0x30')](db[_0x06b1('0x2a')][_0x06b1('0x43')]);_0x22204f[_0x06b1('0x2f')]=_[_0x06b1('0x30')](_0x5e5293[_0x06b1('0x2f')]);_0x22204f[_0x06b1('0x31')]=_[_0x06b1('0x32')](_0x22204f[_0x06b1('0x2e')],_0x22204f[_0x06b1('0x2f')]);_0x3daa9d['attributes']=_['intersection'](_0x22204f[_0x06b1('0x2e')],qs[_0x06b1('0x33')](_0x5e5293[_0x06b1('0x2f')][_0x06b1('0x33')]));_0x3daa9d[_0x06b1('0x34')]=_0x3daa9d['attributes'][_0x06b1('0x44')]?_0x3daa9d[_0x06b1('0x34')]:_0x22204f[_0x06b1('0x2e')];if(_0x5e5293['query'][_0x06b1('0x3d')]){_0x3daa9d[_0x06b1('0x3e')]=[{'all':!![]}];}_0x3daa9d=_[_0x06b1('0x3c')]({},_0x3daa9d,_0x5e5293[_0x06b1('0x45')]);return db[_0x06b1('0x2a')]['find'](_0x3daa9d)[_0x06b1('0x25')](handleEntityNotFound(_0x27175e,null))[_0x06b1('0x25')](respondWithResult(_0x27175e,null))[_0x06b1('0x46')](handleError(_0x27175e,null));};exports[_0x06b1('0x47')]=function(_0x124544,_0x6fb3b0){return db['SquareDetailsReport'][_0x06b1('0x47')](_0x124544['body'],{})[_0x06b1('0x25')](respondWithResult(_0x6fb3b0,0xc9))[_0x06b1('0x46')](handleError(_0x6fb3b0,null));};exports[_0x06b1('0x24')]=function(_0x15b633,_0x482810){if(_0x15b633[_0x06b1('0x48')]['id']){delete _0x15b633['body']['id'];}return db['SquareDetailsReport'][_0x06b1('0x49')]({'where':{'id':_0x15b633[_0x06b1('0x42')]['id']}})[_0x06b1('0x25')](handleEntityNotFound(_0x482810,null))['then'](saveUpdates(_0x15b633[_0x06b1('0x48')],null))[_0x06b1('0x25')](respondWithResult(_0x482810,null))['catch'](handleError(_0x482810,null));};exports[_0x06b1('0x4a')]=function(_0x4cbf01,_0x2c714e){return db[_0x06b1('0x2a')]['find']({'where':{'id':_0x4cbf01[_0x06b1('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c714e,null))[_0x06b1('0x25')](removeEntity(_0x2c714e,null))[_0x06b1('0x46')](handleError(_0x2c714e,null));};exports[_0x06b1('0x4b')]=function(_0x7a876,_0x59c3ae){return db['SquareDetailsReport']['describe']()[_0x06b1('0x25')](respondWithResult(_0x59c3ae,null))[_0x06b1('0x46')](handleError(_0x59c3ae,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index f335d0f..31c224e 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 _0xdd98=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash'];(function(_0x4fa723,_0x4565e0){var _0x1f6279=function(_0x19e11a){while(--_0x19e11a){_0x4fa723['push'](_0x4fa723['shift']());}};_0x1f6279(++_0x4565e0);}(_0xdd98,0x1eb));var _0x8dd9=function(_0x30ebbc,_0x481b0f){_0x30ebbc=_0x30ebbc-0x0;var _0x2fd850=_0xdd98[_0x30ebbc];return _0x2fd850;};'use strict';var _=require(_0x8dd9('0x0'));var util=require(_0x8dd9('0x1'));var logger=require(_0x8dd9('0x2'))('api');var moment=require(_0x8dd9('0x3'));var BPromise=require('bluebird');var rp=require(_0x8dd9('0x4'));var fs=require('fs');var path=require(_0x8dd9('0x5'));var rimraf=require(_0x8dd9('0x6'));var config=require(_0x8dd9('0x7'));var attributes=require(_0x8dd9('0x8'));module[_0x8dd9('0x9')]=function(_0xfd4f2c,_0x345650){return _0xfd4f2c['define'](_0x8dd9('0xa'),attributes,{'tableName':_0x8dd9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa734=['SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','define'];(function(_0x4c0c84,_0x320c5d){var _0x4e61dd=function(_0x27077e){while(--_0x27077e){_0x4c0c84['push'](_0x4c0c84['shift']());}};_0x4e61dd(++_0x320c5d);}(_0xa734,0x13a));var _0x4a73=function(_0x1eebc5,_0x3f23c4){_0x1eebc5=_0x1eebc5-0x0;var _0x5815ee=_0xa734[_0x1eebc5];return _0x5815ee;};'use strict';var _=require(_0x4a73('0x0'));var util=require('util');var logger=require(_0x4a73('0x1'))(_0x4a73('0x2'));var moment=require(_0x4a73('0x3'));var BPromise=require(_0x4a73('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a73('0x5'));var rimraf=require(_0x4a73('0x6'));var config=require(_0x4a73('0x7'));var attributes=require(_0x4a73('0x8'));module['exports']=function(_0x4ed2e0,_0xd40a73){return _0x4ed2e0[_0x4a73('0x9')](_0x4a73('0xa'),attributes,{'tableName':_0x4a73('0xb'),'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 471f147..70b78d1 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 _0x7586=['then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateSquareDetailsReport','create','body','options','raw','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x54daf6,_0xcacf2b){var _0x11798d=function(_0x3f3efd){while(--_0x3f3efd){_0x54daf6['push'](_0x54daf6['shift']());}};_0x11798d(++_0xcacf2b);}(_0x7586,0x78));var _0x6758=function(_0x41d364,_0xdfdc1a){_0x41d364=_0x41d364-0x0;var _0x5ace98=_0x7586[_0x41d364];return _0x5ace98;};'use strict';var _=require(_0x6758('0x0'));var util=require('util');var moment=require(_0x6758('0x1'));var BPromise=require('bluebird');var rs=require(_0x6758('0x2'));var fs=require('fs');var Redis=require(_0x6758('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6758('0x4'));var logger=require(_0x6758('0x5'))(_0x6758('0x6'));var config=require('../../config/environment');var jayson=require(_0x6758('0x7'));var client=jayson[_0x6758('0x8')][_0x6758('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56eba9,_0xdc5e90,_0x21e82f){return new BPromise(function(_0x322a6d,_0x45305d){return client['request'](_0x56eba9,_0x21e82f)[_0x6758('0xa')](function(_0x37cadd){logger[_0x6758('0xb')](_0x6758('0xc'),_0xdc5e90,'request\x20sent');logger[_0x6758('0xd')](_0x6758('0xe'),_0xdc5e90,'request\x20sent',JSON[_0x6758('0xf')](_0x37cadd));if(_0x37cadd[_0x6758('0x10')]){if(_0x37cadd[_0x6758('0x10')][_0x6758('0x11')]===0x1f4){logger[_0x6758('0x10')](_0x6758('0xc'),_0xdc5e90,_0x37cadd[_0x6758('0x10')][_0x6758('0x12')]);return _0x45305d(_0x37cadd[_0x6758('0x10')][_0x6758('0x12')]);}logger[_0x6758('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0xdc5e90,_0x37cadd[_0x6758('0x10')][_0x6758('0x12')]);return _0x322a6d(_0x37cadd[_0x6758('0x10')]['message']);}else{logger[_0x6758('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0xdc5e90,_0x6758('0x13'));_0x322a6d(_0x37cadd[_0x6758('0x14')][_0x6758('0x12')]);}})['catch'](function(_0x1b8299){logger[_0x6758('0x10')](_0x6758('0xc'),_0xdc5e90,_0x1b8299);_0x45305d(_0x1b8299);});});}exports[_0x6758('0x15')]=function(_0x5b49f8){var _0x25bc2b=this;return new Promise(function(_0x114032,_0x40a20e){return db['SquareDetailsReport'][_0x6758('0x16')](_0x5b49f8[_0x6758('0x17')],{'raw':_0x5b49f8[_0x6758('0x18')]?_0x5b49f8[_0x6758('0x18')][_0x6758('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4db42c){logger[_0x6758('0xb')](_0x6758('0x15'),_0x5b49f8);logger[_0x6758('0xd')](_0x6758('0x15'),_0x5b49f8,JSON[_0x6758('0xf')](_0x4db42c));_0x114032(_0x4db42c);})['catch'](function(_0x2c701d){logger[_0x6758('0x10')](_0x6758('0x15'),_0x2c701d['message'],_0x5b49f8);_0x40a20e(_0x25bc2b[_0x6758('0x10')](0x1f4,_0x2c701d[_0x6758('0x12')]));});});}; \ No newline at end of file +var _0xb5aa=['message','result','CreateSquareDetailsReport','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xb5aa,0x119));var _0xab5a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xb5aa[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xab5a('0x0'));var util=require(_0xab5a('0x1'));var moment=require(_0xab5a('0x2'));var BPromise=require('bluebird');var rs=require(_0xab5a('0x3'));var fs=require('fs');var Redis=require(_0xab5a('0x4'));var db=require(_0xab5a('0x5'))['db'];var utils=require(_0xab5a('0x6'));var logger=require(_0xab5a('0x7'))(_0xab5a('0x8'));var config=require(_0xab5a('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x207ea6,_0x4d7056,_0x15b761){return new BPromise(function(_0x4c251d,_0x4a4a36){return client['request'](_0x207ea6,_0x15b761)[_0xab5a('0xa')](function(_0x38ea97){logger[_0xab5a('0xb')](_0xab5a('0xc'),_0x4d7056,'request\x20sent');logger[_0xab5a('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x4d7056,_0xab5a('0xe'),JSON[_0xab5a('0xf')](_0x38ea97));if(_0x38ea97[_0xab5a('0x10')]){if(_0x38ea97[_0xab5a('0x10')][_0xab5a('0x11')]===0x1f4){logger[_0xab5a('0x10')](_0xab5a('0xc'),_0x4d7056,_0x38ea97['error']['message']);return _0x4a4a36(_0x38ea97[_0xab5a('0x10')]['message']);}logger[_0xab5a('0x10')](_0xab5a('0xc'),_0x4d7056,_0x38ea97[_0xab5a('0x10')]['message']);return _0x4c251d(_0x38ea97[_0xab5a('0x10')][_0xab5a('0x12')]);}else{logger[_0xab5a('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x4d7056,_0xab5a('0xe'));_0x4c251d(_0x38ea97[_0xab5a('0x13')][_0xab5a('0x12')]);}})['catch'](function(_0x513a24){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4d7056,_0x513a24);_0x4a4a36(_0x513a24);});});}exports[_0xab5a('0x14')]=function(_0x8c1574){var _0x43b5c0=this;return new Promise(function(_0x32f79f,_0x23eef2){return db['SquareDetailsReport']['create'](_0x8c1574[_0xab5a('0x15')],{'raw':_0x8c1574[_0xab5a('0x16')]?_0x8c1574['options']['raw']===undefined?!![]:![]:!![]})[_0xab5a('0xa')](function(_0xd413cd){logger[_0xab5a('0xb')](_0xab5a('0x14'),_0x8c1574);logger[_0xab5a('0xd')](_0xab5a('0x14'),_0x8c1574,JSON['stringify'](_0xd413cd));_0x32f79f(_0xd413cd);})['catch'](function(_0x2e1697){logger['error']('CreateSquareDetailsReport',_0x2e1697[_0xab5a('0x12')],_0x8c1574);_0x23eef2(_0x43b5c0[_0xab5a('0x10')](0x1f4,_0x2e1697[_0xab5a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1f0b1b0..c1f2f8c 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 _0x9749=['../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','express','Router'];(function(_0x4b8ecc,_0x4cd01c){var _0x48c1b9=function(_0x308aa3){while(--_0x308aa3){_0x4b8ecc['push'](_0x4b8ecc['shift']());}};_0x48c1b9(++_0x4cd01c);}(_0x9749,0xde));var _0x9974=function(_0xdb64e1,_0x3bea0c){_0xdb64e1=_0xdb64e1-0x0;var _0x5d00ae=_0x9749[_0xdb64e1];return _0x5d00ae;};'use strict';var express=require(_0x9974('0x0'));var router=express[_0x9974('0x1')]();var auth=require(_0x9974('0x2'));var controller=require(_0x9974('0x3'));router[_0x9974('0x4')]('/',auth['isAuthenticated'](),controller[_0x9974('0x5')]);router['get'](_0x9974('0x6'),auth[_0x9974('0x7')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0xb28d=['exports','express','Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x33e114,_0x77cc5a){var _0x17e9b6=function(_0xd1cb2f){while(--_0xd1cb2f){_0x33e114['push'](_0x33e114['shift']());}};_0x17e9b6(++_0x77cc5a);}(_0xb28d,0xbf));var _0xdb28=function(_0x129046,_0x519448){_0x129046=_0x129046-0x0;var _0x4d06d9=_0xb28d[_0x129046];return _0x4d06d9;};'use strict';var express=require(_0xdb28('0x0'));var router=express[_0xdb28('0x1')]();var auth=require(_0xdb28('0x2'));var controller=require(_0xdb28('0x3'));router[_0xdb28('0x4')]('/',auth['isAuthenticated'](),controller[_0xdb28('0x5')]);router[_0xdb28('0x4')](_0xdb28('0x6'),auth[_0xdb28('0x7')](),controller[_0xdb28('0x8')]);module[_0xdb28('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 6f629ed..35e8741 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 _0x8bcc=['child_process','exec','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','index','getAllData','then','status','json','catch','killProcess','components/import/cm','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0x8bcc,0x82));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var info=require('systeminformation');var exec=require(_0xc8bc('0x0'))[_0xc8bc('0x1')];var logger=require('../../config/logger')(_0xc8bc('0x2'));var util=require(_0xc8bc('0x3'));var BPromise=require(_0xc8bc('0x4'));var _=require(_0xc8bc('0x5'));function handleError(_0x1dbc13,_0x35e0b5,_0x377e2f){_0x35e0b5=_0x35e0b5||0x1f4;return function(_0x36f56e){logger['error'](_0xc8bc('0x6'),_0x377e2f,_0x35e0b5,util[_0xc8bc('0x7')](_0x36f56e,{'showHidden':![],'depth':null}));delete _0x36f56e['name'];_0x1dbc13['status'](_0x35e0b5)['send'](_0x36f56e);};}exports[_0xc8bc('0x8')]=function(_0x286148,_0x20fa6a){return info[_0xc8bc('0x9')]()[_0xc8bc('0xa')](function(_0x6e66e3){return _0x20fa6a[_0xc8bc('0xb')](0xc8)[_0xc8bc('0xc')](_0x6e66e3);})[_0xc8bc('0xd')](function(_0x591ba5){return _0x20fa6a[_0xc8bc('0xb')](0x1f4)[_0xc8bc('0xc')](_0x591ba5);});};exports[_0xc8bc('0xe')]=function(_0x20393f,_0x3e6d5c){var _0x543fe6=[_0xc8bc('0xf')];return new BPromise(function(_0xaf1186,_0xa80a7c){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x20393f[_0xc8bc('0x10')][_0xc8bc('0x11')]),function(_0x543425,_0x945e3d,_0xe88b9b){if(_0x543425){return _0xa80a7c(_0x543425);}return _0xaf1186(_0x945e3d);});})['then'](function(_0x5a598f){var _0x216343=![];var _0x381eab=_0x5a598f[_0xc8bc('0x12')](/\n/);for(var _0x4b8b61=0x0,_0x1cc757=_0x543fe6[_0xc8bc('0x13')];_0x4b8b61<_0x1cc757,_0x216343===![];_0x4b8b61+=0x1){if(_0x5a598f[_0xc8bc('0x14')](_0x543fe6[_0x4b8b61])>=0x0){_0x216343=!![];}}if(!_0x216343){throw new Error(util[_0xc8bc('0x15')](_0xc8bc('0x16'),_0x20393f['params'][_0xc8bc('0x11')]));}process[_0xc8bc('0x17')](_0x20393f[_0xc8bc('0x10')][_0xc8bc('0x11')],_0xc8bc('0x18'));return _0x3e6d5c[_0xc8bc('0xb')](0xc8)[_0xc8bc('0xc')]({'message':util[_0xc8bc('0x15')](_0xc8bc('0x19'),_0x20393f['params'][_0xc8bc('0x11')])});})[_0xc8bc('0xd')](handleError(_0x3e6d5c,null,_0xc8bc('0xe')));}; \ No newline at end of file +var _0xd2f5=['exec','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','then','json','catch','killProcess','components/import/cm','format','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','systeminformation'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xd2f5,0x144));var _0x5d2f=function(_0x2499c1,_0x4407df){_0x2499c1=_0x2499c1-0x0;var _0x38cdc4=_0xd2f5[_0x2499c1];return _0x38cdc4;};'use strict';var info=require(_0x5d2f('0x0'));var exec=require('child_process')[_0x5d2f('0x1')];var logger=require('../../config/logger')(_0x5d2f('0x2'));var util=require('util');var BPromise=require(_0x5d2f('0x3'));var _=require(_0x5d2f('0x4'));function handleError(_0x102911,_0xc7102b,_0x439434){_0xc7102b=_0xc7102b||0x1f4;return function(_0x3cda2a){logger[_0x5d2f('0x5')](_0x5d2f('0x6'),_0x439434,_0xc7102b,util['inspect'](_0x3cda2a,{'showHidden':![],'depth':null}));delete _0x3cda2a[_0x5d2f('0x7')];_0x102911[_0x5d2f('0x8')](_0xc7102b)[_0x5d2f('0x9')](_0x3cda2a);};}exports[_0x5d2f('0xa')]=function(_0x31b789,_0xb7b530){return info['getAllData']()[_0x5d2f('0xb')](function(_0xcd29b4){return _0xb7b530['status'](0xc8)[_0x5d2f('0xc')](_0xcd29b4);})[_0x5d2f('0xd')](function(_0x2a74a2){return _0xb7b530['status'](0x1f4)[_0x5d2f('0xc')](_0x2a74a2);});};exports[_0x5d2f('0xe')]=function(_0x439475,_0x5d07f4){var _0x510eb5=[_0x5d2f('0xf')];return new BPromise(function(_0x4bc97f,_0x293e95){return exec(util[_0x5d2f('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x439475[_0x5d2f('0x11')]['pid']),function(_0x6ce2d1,_0x158375,_0x309985){if(_0x6ce2d1){return _0x293e95(_0x6ce2d1);}return _0x4bc97f(_0x158375);});})['then'](function(_0x6d7c6c){var _0x39a7d5=![];var _0x1ca388=_0x6d7c6c[_0x5d2f('0x12')](/\n/);for(var _0x1536ee=0x0,_0x5796f6=_0x510eb5[_0x5d2f('0x13')];_0x1536ee<_0x5796f6,_0x39a7d5===![];_0x1536ee+=0x1){if(_0x6d7c6c[_0x5d2f('0x14')](_0x510eb5[_0x1536ee])>=0x0){_0x39a7d5=!![];}}if(!_0x39a7d5){throw new Error(util[_0x5d2f('0x10')](_0x5d2f('0x15'),_0x439475['params'][_0x5d2f('0x16')]));}process[_0x5d2f('0x17')](_0x439475[_0x5d2f('0x11')][_0x5d2f('0x16')],_0x5d2f('0x18'));return _0x5d07f4[_0x5d2f('0x8')](0xc8)[_0x5d2f('0xc')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x439475['params'][_0x5d2f('0x16')])});})[_0x5d2f('0xd')](handleError(_0x5d07f4,null,_0x5d2f('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1c95309..e6124d6 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 _0x91a7=['show','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0x5d5ba7,_0x35c34c){var _0x145641=function(_0x2e4955){while(--_0x2e4955){_0x5d5ba7['push'](_0x5d5ba7['shift']());}};_0x145641(++_0x35c34c);}(_0x91a7,0xe7));var _0x791a=function(_0xddb854,_0x24e109){_0xddb854=_0xddb854-0x0;var _0x598620=_0x91a7[_0xddb854];return _0x598620;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x791a('0x4'));var config=require('../../config/environment');var controller=require('./tag.controller');router[_0x791a('0x5')]('/',auth[_0x791a('0x6')](),controller['index']);router[_0x791a('0x5')]('/:id',auth[_0x791a('0x6')](),controller[_0x791a('0x7')]);router['post']('/',auth[_0x791a('0x6')](),controller[_0x791a('0x8')]);router[_0x791a('0x9')](_0x791a('0xa'),auth[_0x791a('0x6')](),controller['update']);router[_0x791a('0xb')](_0x791a('0xa'),auth['isAuthenticated'](),controller[_0x791a('0xc')]);module[_0x791a('0xd')]=router; \ No newline at end of file +var _0x0a9a=['get','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','index'];(function(_0x4ae9a6,_0x30b6fb){var _0x347a21=function(_0x4566ce){while(--_0x4566ce){_0x4ae9a6['push'](_0x4ae9a6['shift']());}};_0x347a21(++_0x30b6fb);}(_0x0a9a,0x183));var _0xa0a9=function(_0x5c8ae8,_0x5e5591){_0x5c8ae8=_0x5c8ae8-0x0;var _0x41cd26=_0x0a9a[_0x5c8ae8];return _0x41cd26;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xc')]);router[_0xa0a9('0xd')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);router[_0xa0a9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x10')]);module[_0xa0a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 214409d..66405ce 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 _0x0abf=['name','sequelize','STRING'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0ab('0x1')],'unique':_0xf0ab('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xf0ab('0x1')]}}; \ No newline at end of file +var _0xd8b0=['STRING','sequelize','exports','#0091EA'];(function(_0xa04daf,_0x25e602){var _0x3f7fa6=function(_0x41b149){while(--_0x41b149){_0xa04daf['push'](_0xa04daf['shift']());}};_0x3f7fa6(++_0x25e602);}(_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')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x2')},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fba4106..fa31766 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 _0x8da4=['attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','includeAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0x8da4,0x1ab));var _0x48da=function(_0x50d567,_0x2be785){_0x50d567=_0x50d567-0x0;var _0x2e3d8f=_0x8da4[_0x50d567];return _0x2e3d8f;};'use strict';var pdf=require(_0x48da('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x48da('0x1'));var jsonpatch=require(_0x48da('0x2'));var rp=require(_0x48da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x48da('0x4'));var util=require(_0x48da('0x5'));var path=require(_0x48da('0x6'));var sox=require(_0x48da('0x7'));var csv=require('to-csv');var ejs=require(_0x48da('0x8'));var fs=require('fs');var _=require(_0x48da('0x9'));var squel=require(_0x48da('0xa'));var crypto=require(_0x48da('0xb'));var jsforce=require(_0x48da('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x48da('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x48da('0xe'));var authService=require(_0x48da('0xf'));var qs=require(_0x48da('0x10'));var as=require(_0x48da('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48da('0x12'))(_0x48da('0x13'));var utils=require(_0x48da('0x14'));var config=require(_0x48da('0x15'));var db=require(_0x48da('0x16'))['db'];function respondWithStatusCode(_0x4a2f32,_0x4e35f4){_0x4e35f4=_0x4e35f4||0xcc;return function(_0x24f46f){if(_0x24f46f){return _0x4a2f32[_0x48da('0x17')](_0x4e35f4);}return _0x4a2f32[_0x48da('0x18')](_0x4e35f4)[_0x48da('0x19')]();};}function respondWithResult(_0x3d0aea,_0x8c56cc){_0x8c56cc=_0x8c56cc||0xc8;return function(_0x3ac4b3){if(_0x3ac4b3){return _0x3d0aea['status'](_0x8c56cc)[_0x48da('0x1a')](_0x3ac4b3);}};}function respondWithFilteredResult(_0xc21393,_0x3d0616){return function(_0x47f453){if(_0x47f453){var _0x505abb=_0x47f453[_0x48da('0x1b')],_0x3d496b=_0x3d0616[_0x48da('0x1c')],_0x117345=_0x3d0616[_0x48da('0x1c')]+_0x3d0616['limit'],_0x15c150;if(_0x117345>=_0x505abb){_0x117345=_0x505abb;_0x15c150=0xc8;}else{_0x15c150=0xce;}_0xc21393[_0x48da('0x18')](_0x15c150);return _0xc21393[_0x48da('0x1d')]('Content-Range',_0x3d496b+'-'+_0x117345+'/'+_0x505abb)[_0x48da('0x1a')](_0x47f453);}return null;};}function patchUpdates(_0x1802c3){return function(_0x5b5259){try{jsonpatch['apply'](_0x5b5259,_0x1802c3,!![]);}catch(_0x1757c3){return BPromise[_0x48da('0x1e')](_0x1757c3);}return _0x5b5259[_0x48da('0x1f')]();};}function saveUpdates(_0x8c323e,_0x429d1d){return function(_0x3a43ba){if(_0x3a43ba){return _0x3a43ba['update'](_0x8c323e)[_0x48da('0x20')](function(_0x2465c3){return _0x2465c3;});}return null;};}function removeEntity(_0x64c4cb,_0x5a850f){return function(_0x5d025c){if(_0x5d025c){return _0x5d025c[_0x48da('0x21')]()[_0x48da('0x20')](function(){var _0x4f587e=_0x5d025c[_0x48da('0x22')]({'plain':!![]});var _0x284cae=_0x48da('0x23');return db[_0x48da('0x24')][_0x48da('0x21')]({'where':{'type':_0x284cae,'resourceId':_0x4f587e['id']}})[_0x48da('0x20')](function(){return _0x5d025c;});})[_0x48da('0x20')](function(){_0x64c4cb['status'](0xcc)[_0x48da('0x19')]();});}};}function handleEntityNotFound(_0x3487d1,_0x391b07){return function(_0x1322ad){if(!_0x1322ad){_0x3487d1[_0x48da('0x17')](0x194);}return _0x1322ad;};}function handleError(_0x29e899,_0x18d13c){_0x18d13c=_0x18d13c||0x1f4;return function(_0x23d641){logger[_0x48da('0x25')](_0x23d641[_0x48da('0x26')]);if(_0x23d641[_0x48da('0x27')]){delete _0x23d641[_0x48da('0x27')];}_0x29e899['status'](_0x18d13c)[_0x48da('0x28')](_0x23d641);};}exports[_0x48da('0x29')]=function(_0x5c50be,_0x2a307c){var _0x4d476b={},_0x4be378={},_0x3508b4={'count':0x0,'rows':[]};var _0x428975=_['map'](db[_0x48da('0x2a')][_0x48da('0x2b')],function(_0x30c5ca){return{'name':_0x30c5ca[_0x48da('0x2c')],'type':_0x30c5ca[_0x48da('0x2d')][_0x48da('0x2e')]};});_0x4be378[_0x48da('0x2f')]=_[_0x48da('0x30')](_0x428975,_0x48da('0x27'));_0x4be378['query']=_[_0x48da('0x31')](_0x5c50be['query']);_0x4be378[_0x48da('0x32')]=_[_0x48da('0x33')](_0x4be378[_0x48da('0x2f')],_0x4be378[_0x48da('0x34')]);_0x4d476b[_0x48da('0x35')]=_['intersection'](_0x4be378[_0x48da('0x2f')],qs[_0x48da('0x36')](_0x5c50be['query'][_0x48da('0x36')]));_0x4d476b[_0x48da('0x35')]=_0x4d476b[_0x48da('0x35')]['length']?_0x4d476b[_0x48da('0x35')]:_0x4be378[_0x48da('0x2f')];if(!_0x5c50be['query'][_0x48da('0x37')](_0x48da('0x38'))){_0x4d476b[_0x48da('0x39')]=qs['limit'](_0x5c50be[_0x48da('0x34')][_0x48da('0x39')]);_0x4d476b[_0x48da('0x1c')]=qs[_0x48da('0x1c')](_0x5c50be['query']['offset']);}_0x4d476b['order']=qs[_0x48da('0x3a')](_0x5c50be['query']['sort']);_0x4d476b[_0x48da('0x3b')]=qs[_0x48da('0x32')](_[_0x48da('0x3c')](_0x5c50be[_0x48da('0x34')],_0x4be378['filters']),_0x428975);if(_0x5c50be['query'][_0x48da('0x3d')]){_0x4d476b['where']=_[_0x48da('0x3e')](_0x4d476b[_0x48da('0x3b')],{'$or':_['map'](_0x428975,function(_0xe91e6d){if(_0xe91e6d[_0x48da('0x2d')]!=='VIRTUAL'){var _0xbc855c={};_0xbc855c[_0xe91e6d[_0x48da('0x27')]]={'$like':'%'+_0x5c50be[_0x48da('0x34')]['filter']+'%'};return _0xbc855c;}})});}_0x4d476b=_['merge']({},_0x4d476b,_0x5c50be['options']);var _0x3d80a1={'where':_0x4d476b[_0x48da('0x3b')]};return db[_0x48da('0x2a')]['count'](_0x3d80a1)['then'](function(_0x2d216d){_0x3508b4[_0x48da('0x1b')]=_0x2d216d;if(_0x5c50be[_0x48da('0x34')][_0x48da('0x3f')]){_0x4d476b['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x4d476b);})['then'](function(_0x3ea669){_0x3508b4[_0x48da('0x40')]=_0x3ea669;return _0x3508b4;})[_0x48da('0x20')](respondWithFilteredResult(_0x2a307c,_0x4d476b))[_0x48da('0x41')](handleError(_0x2a307c,null));};exports[_0x48da('0x42')]=function(_0x51d087,_0x1100de){var _0x402d13={'raw':!![],'where':{'id':_0x51d087[_0x48da('0x43')]['id']}},_0xa56e7b={};_0xa56e7b[_0x48da('0x2f')]=_['keys'](db[_0x48da('0x2a')][_0x48da('0x2b')]);_0xa56e7b['query']=_['keys'](_0x51d087['query']);_0xa56e7b[_0x48da('0x32')]=_['intersection'](_0xa56e7b[_0x48da('0x2f')],_0xa56e7b['query']);_0x402d13[_0x48da('0x35')]=_[_0x48da('0x33')](_0xa56e7b['model'],qs[_0x48da('0x36')](_0x51d087[_0x48da('0x34')][_0x48da('0x36')]));_0x402d13[_0x48da('0x35')]=_0x402d13[_0x48da('0x35')]['length']?_0x402d13[_0x48da('0x35')]:_0xa56e7b[_0x48da('0x2f')];if(_0x51d087[_0x48da('0x34')][_0x48da('0x3f')]){_0x402d13['include']=[{'all':!![]}];}_0x402d13=_['merge']({},_0x402d13,_0x51d087[_0x48da('0x44')]);return db[_0x48da('0x2a')][_0x48da('0x45')](_0x402d13)[_0x48da('0x20')](handleEntityNotFound(_0x1100de,null))['then'](respondWithResult(_0x1100de,null))[_0x48da('0x41')](handleError(_0x1100de,null));};exports[_0x48da('0x46')]=function(_0x3cfcb9,_0xc784e6){return db[_0x48da('0x2a')][_0x48da('0x46')](_0x3cfcb9[_0x48da('0x47')],{})[_0x48da('0x20')](function(_0x23a7d7){var _0x131a1e=_0x3cfcb9[_0x48da('0x48')]['get']({'plain':!![]});if(!_0x131a1e)throw new Error(_0x48da('0x49'));if(_0x131a1e[_0x48da('0x4a')]===_0x48da('0x48')){var _0x365c07=_0x23a7d7[_0x48da('0x22')]({'plain':!![]});var _0x471079=_0x48da('0x23');return db[_0x48da('0x4b')][_0x48da('0x45')]({'where':{'name':_0x471079,'userProfileId':_0x131a1e[_0x48da('0x4c')]},'raw':!![]})[_0x48da('0x20')](function(_0x1dfff3){if(_0x1dfff3&&_0x1dfff3[_0x48da('0x4d')]===0x0){return db[_0x48da('0x24')][_0x48da('0x46')]({'name':_0x365c07[_0x48da('0x27')],'resourceId':_0x365c07['id'],'type':_0x1dfff3[_0x48da('0x27')],'sectionId':_0x1dfff3['id']},{})['then'](function(){return _0x23a7d7;});}else{return _0x23a7d7;}})[_0x48da('0x41')](function(_0x56ca7b){logger['error'](_0x48da('0x4e'),_0x56ca7b);throw _0x56ca7b;});}return _0x23a7d7;})['then'](respondWithResult(_0xc784e6,0xc9))[_0x48da('0x41')](handleError(_0xc784e6,null));};exports[_0x48da('0x4f')]=function(_0x46d57e,_0x10b244){if(_0x46d57e[_0x48da('0x47')]['id']){delete _0x46d57e[_0x48da('0x47')]['id'];}return db['Tag'][_0x48da('0x45')]({'where':{'id':_0x46d57e[_0x48da('0x43')]['id']}})[_0x48da('0x20')](handleEntityNotFound(_0x10b244,null))[_0x48da('0x20')](saveUpdates(_0x46d57e['body'],null))[_0x48da('0x20')](respondWithResult(_0x10b244,null))[_0x48da('0x41')](handleError(_0x10b244,null));};exports[_0x48da('0x21')]=function(_0x4c730d,_0x52db87){return db['Tag']['find']({'where':{'id':_0x4c730d[_0x48da('0x43')]['id']}})[_0x48da('0x20')](handleEntityNotFound(_0x52db87,null))[_0x48da('0x20')](removeEntity(_0x52db87,null))['catch'](handleError(_0x52db87,null));}; \ No newline at end of file +var _0x2bc3=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','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','count','offset','limit','set','reject','save','update','then','destroy','Tags','UserProfileResource','stack','name','send','Tag','type','model','query','filters','intersection','attributes','fields'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x2bc3,0xb4));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x32bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32bc('0x1'));var jsonpatch=require(_0x32bc('0x2'));var rp=require(_0x32bc('0x3'));var moment=require('moment');var BPromise=require(_0x32bc('0x4'));var Mustache=require(_0x32bc('0x5'));var util=require(_0x32bc('0x6'));var path=require(_0x32bc('0x7'));var sox=require(_0x32bc('0x8'));var csv=require('to-csv');var ejs=require(_0x32bc('0x9'));var fs=require('fs');var _=require(_0x32bc('0xa'));var squel=require(_0x32bc('0xb'));var crypto=require(_0x32bc('0xc'));var jsforce=require(_0x32bc('0xd'));var deskjs=require(_0x32bc('0xe'));var toCsv=require(_0x32bc('0xf'));var querystring=require('querystring');var Papa=require(_0x32bc('0x10'));var Redis=require(_0x32bc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x32bc('0x12'));var as=require(_0x32bc('0x13'));var hardwareService=require(_0x32bc('0x14'));var logger=require(_0x32bc('0x15'))('api');var utils=require(_0x32bc('0x16'));var config=require(_0x32bc('0x17'));var db=require(_0x32bc('0x18'))['db'];function respondWithStatusCode(_0x57a28b,_0x3037ea){_0x3037ea=_0x3037ea||0xcc;return function(_0x51e367){if(_0x51e367){return _0x57a28b[_0x32bc('0x19')](_0x3037ea);}return _0x57a28b[_0x32bc('0x1a')](_0x3037ea)[_0x32bc('0x1b')]();};}function respondWithResult(_0xcbc8df,_0x2a3fdc){_0x2a3fdc=_0x2a3fdc||0xc8;return function(_0x4d9f2b){if(_0x4d9f2b){return _0xcbc8df[_0x32bc('0x1a')](_0x2a3fdc)[_0x32bc('0x1c')](_0x4d9f2b);}};}function respondWithFilteredResult(_0x5dc9e1,_0x5d0f13){return function(_0x5c266f){if(_0x5c266f){var _0x558713=_0x5c266f[_0x32bc('0x1d')],_0x4dd117=_0x5d0f13['offset'],_0x57623f=_0x5d0f13[_0x32bc('0x1e')]+_0x5d0f13[_0x32bc('0x1f')],_0x3ad328;if(_0x57623f>=_0x558713){_0x57623f=_0x558713;_0x3ad328=0xc8;}else{_0x3ad328=0xce;}_0x5dc9e1['status'](_0x3ad328);return _0x5dc9e1[_0x32bc('0x20')]('Content-Range',_0x4dd117+'-'+_0x57623f+'/'+_0x558713)[_0x32bc('0x1c')](_0x5c266f);}return null;};}function patchUpdates(_0x4e5080){return function(_0x56ee6f){try{jsonpatch['apply'](_0x56ee6f,_0x4e5080,!![]);}catch(_0x33b708){return BPromise[_0x32bc('0x21')](_0x33b708);}return _0x56ee6f[_0x32bc('0x22')]();};}function saveUpdates(_0x402d7e,_0x5c48eb){return function(_0x48c79c){if(_0x48c79c){return _0x48c79c[_0x32bc('0x23')](_0x402d7e)[_0x32bc('0x24')](function(_0x41a4b4){return _0x41a4b4;});}return null;};}function removeEntity(_0x118283,_0x3b89fa){return function(_0x39c9d5){if(_0x39c9d5){return _0x39c9d5[_0x32bc('0x25')]()[_0x32bc('0x24')](function(){var _0x1d62ef=_0x39c9d5['get']({'plain':!![]});var _0x2e314c=_0x32bc('0x26');return db[_0x32bc('0x27')][_0x32bc('0x25')]({'where':{'type':_0x2e314c,'resourceId':_0x1d62ef['id']}})['then'](function(){return _0x39c9d5;});})['then'](function(){_0x118283[_0x32bc('0x1a')](0xcc)[_0x32bc('0x1b')]();});}};}function handleEntityNotFound(_0x33541e,_0x491259){return function(_0x2829de){if(!_0x2829de){_0x33541e[_0x32bc('0x19')](0x194);}return _0x2829de;};}function handleError(_0x466ffb,_0x567168){_0x567168=_0x567168||0x1f4;return function(_0x88935b){logger['error'](_0x88935b[_0x32bc('0x28')]);if(_0x88935b[_0x32bc('0x29')]){delete _0x88935b[_0x32bc('0x29')];}_0x466ffb['status'](_0x567168)[_0x32bc('0x2a')](_0x88935b);};}exports['index']=function(_0x3e6c55,_0x37c354){var _0x48cb3f={},_0x214dd3={},_0x3bb663={'count':0x0,'rows':[]};var _0x157f3d=_['map'](db[_0x32bc('0x2b')]['rawAttributes'],function(_0x21a071){return{'name':_0x21a071['fieldName'],'type':_0x21a071[_0x32bc('0x2c')]['key']};});_0x214dd3[_0x32bc('0x2d')]=_['map'](_0x157f3d,'name');_0x214dd3['query']=_['keys'](_0x3e6c55[_0x32bc('0x2e')]);_0x214dd3[_0x32bc('0x2f')]=_[_0x32bc('0x30')](_0x214dd3['model'],_0x214dd3[_0x32bc('0x2e')]);_0x48cb3f[_0x32bc('0x31')]=_[_0x32bc('0x30')](_0x214dd3[_0x32bc('0x2d')],qs['fields'](_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x32')]));_0x48cb3f[_0x32bc('0x31')]=_0x48cb3f[_0x32bc('0x31')][_0x32bc('0x33')]?_0x48cb3f[_0x32bc('0x31')]:_0x214dd3[_0x32bc('0x2d')];if(!_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x34')](_0x32bc('0x35'))){_0x48cb3f[_0x32bc('0x1f')]=qs[_0x32bc('0x1f')](_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x1f')]);_0x48cb3f[_0x32bc('0x1e')]=qs[_0x32bc('0x1e')](_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x1e')]);}_0x48cb3f[_0x32bc('0x36')]=qs[_0x32bc('0x37')](_0x3e6c55['query'][_0x32bc('0x37')]);_0x48cb3f[_0x32bc('0x38')]=qs[_0x32bc('0x2f')](_[_0x32bc('0x39')](_0x3e6c55[_0x32bc('0x2e')],_0x214dd3['filters']),_0x157f3d);if(_0x3e6c55['query'][_0x32bc('0x3a')]){_0x48cb3f[_0x32bc('0x38')]=_[_0x32bc('0x3b')](_0x48cb3f['where'],{'$or':_[_0x32bc('0x3c')](_0x157f3d,function(_0x415c02){if(_0x415c02[_0x32bc('0x2c')]!=='VIRTUAL'){var _0x4553ac={};_0x4553ac[_0x415c02[_0x32bc('0x29')]]={'$like':'%'+_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x3a')]+'%'};return _0x4553ac;}})});}_0x48cb3f=_['merge']({},_0x48cb3f,_0x3e6c55['options']);var _0x41adc8={'where':_0x48cb3f['where']};return db[_0x32bc('0x2b')]['count'](_0x41adc8)[_0x32bc('0x24')](function(_0x460596){_0x3bb663[_0x32bc('0x1d')]=_0x460596;if(_0x3e6c55[_0x32bc('0x2e')][_0x32bc('0x3d')]){_0x48cb3f['include']=[{'all':!![]}];}return db[_0x32bc('0x2b')][_0x32bc('0x3e')](_0x48cb3f);})[_0x32bc('0x24')](function(_0x47731d){_0x3bb663[_0x32bc('0x3f')]=_0x47731d;return _0x3bb663;})[_0x32bc('0x24')](respondWithFilteredResult(_0x37c354,_0x48cb3f))[_0x32bc('0x40')](handleError(_0x37c354,null));};exports[_0x32bc('0x41')]=function(_0x342362,_0x1df6e9){var _0x4c9396={'raw':!![],'where':{'id':_0x342362[_0x32bc('0x42')]['id']}},_0x1d066f={};_0x1d066f['model']=_['keys'](db[_0x32bc('0x2b')]['rawAttributes']);_0x1d066f[_0x32bc('0x2e')]=_['keys'](_0x342362['query']);_0x1d066f[_0x32bc('0x2f')]=_[_0x32bc('0x30')](_0x1d066f['model'],_0x1d066f['query']);_0x4c9396[_0x32bc('0x31')]=_['intersection'](_0x1d066f[_0x32bc('0x2d')],qs[_0x32bc('0x32')](_0x342362[_0x32bc('0x2e')][_0x32bc('0x32')]));_0x4c9396['attributes']=_0x4c9396[_0x32bc('0x31')]['length']?_0x4c9396[_0x32bc('0x31')]:_0x1d066f[_0x32bc('0x2d')];if(_0x342362[_0x32bc('0x2e')]['includeAll']){_0x4c9396[_0x32bc('0x43')]=[{'all':!![]}];}_0x4c9396=_[_0x32bc('0x3b')]({},_0x4c9396,_0x342362[_0x32bc('0x44')]);return db[_0x32bc('0x2b')][_0x32bc('0x45')](_0x4c9396)[_0x32bc('0x24')](handleEntityNotFound(_0x1df6e9,null))[_0x32bc('0x24')](respondWithResult(_0x1df6e9,null))['catch'](handleError(_0x1df6e9,null));};exports[_0x32bc('0x46')]=function(_0x4abdf7,_0x5854a7){return db['Tag']['create'](_0x4abdf7['body'],{})[_0x32bc('0x24')](function(_0x1fd15d){var _0x5dfd86=_0x4abdf7[_0x32bc('0x47')][_0x32bc('0x48')]({'plain':!![]});if(!_0x5dfd86)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dfd86['role']===_0x32bc('0x47')){var _0x42b96e=_0x1fd15d['get']({'plain':!![]});var _0x4167c2=_0x32bc('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x4167c2,'userProfileId':_0x5dfd86[_0x32bc('0x49')]},'raw':!![]})['then'](function(_0xe8eaf9){if(_0xe8eaf9&&_0xe8eaf9[_0x32bc('0x4a')]===0x0){return db['UserProfileResource'][_0x32bc('0x46')]({'name':_0x42b96e['name'],'resourceId':_0x42b96e['id'],'type':_0xe8eaf9[_0x32bc('0x29')],'sectionId':_0xe8eaf9['id']},{})[_0x32bc('0x24')](function(){return _0x1fd15d;});}else{return _0x1fd15d;}})[_0x32bc('0x40')](function(_0x189be9){logger['error'](_0x32bc('0x4b'),_0x189be9);throw _0x189be9;});}return _0x1fd15d;})[_0x32bc('0x24')](respondWithResult(_0x5854a7,0xc9))[_0x32bc('0x40')](handleError(_0x5854a7,null));};exports[_0x32bc('0x23')]=function(_0x3c0760,_0x1c8e6f){if(_0x3c0760['body']['id']){delete _0x3c0760[_0x32bc('0x4c')]['id'];}return db[_0x32bc('0x2b')]['find']({'where':{'id':_0x3c0760['params']['id']}})[_0x32bc('0x24')](handleEntityNotFound(_0x1c8e6f,null))[_0x32bc('0x24')](saveUpdates(_0x3c0760[_0x32bc('0x4c')],null))[_0x32bc('0x24')](respondWithResult(_0x1c8e6f,null))['catch'](handleError(_0x1c8e6f,null));};exports[_0x32bc('0x25')]=function(_0x1ea16c,_0x5bcad9){return db['Tag'][_0x32bc('0x45')]({'where':{'id':_0x1ea16c[_0x32bc('0x42')]['id']}})[_0x32bc('0x24')](handleEntityNotFound(_0x5bcad9,null))[_0x32bc('0x24')](removeEntity(_0x5bcad9,null))[_0x32bc('0x40')](handleError(_0x5bcad9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ac662f7..ea1123b 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 _0x19a0=['exports','Tag','tools_tags','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0xf2f9e7,_0x5a528b){var _0x217a45=function(_0x1f4617){while(--_0x1f4617){_0xf2f9e7['push'](_0xf2f9e7['shift']());}};_0x217a45(++_0x5a528b);}(_0x19a0,0x1b1));var _0x019a=function(_0x2e5468,_0x78d3a){_0x2e5468=_0x2e5468-0x0;var _0x1f292e=_0x19a0[_0x2e5468];return _0x1f292e;};'use strict';var _=require(_0x019a('0x0'));var util=require(_0x019a('0x1'));var logger=require(_0x019a('0x2'))('api');var moment=require(_0x019a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x019a('0x4'));var rimraf=require(_0x019a('0x5'));var config=require(_0x019a('0x6'));var attributes=require('./tag.attributes');module[_0x019a('0x7')]=function(_0x50939b,_0x388ad3){return _0x50939b['define'](_0x019a('0x8'),attributes,{'tableName':_0x019a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6300=['bluebird','request-promise','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','api'];(function(_0x2e3987,_0x38fc25){var _0x22f461=function(_0x199992){while(--_0x199992){_0x2e3987['push'](_0x2e3987['shift']());}};_0x22f461(++_0x38fc25);}(_0x6300,0x1ae));var _0x0630=function(_0x3786dc,_0x22814c){_0x3786dc=_0x3786dc-0x0;var _0x50cc06=_0x6300[_0x3786dc];return _0x50cc06;};'use strict';var _=require(_0x0630('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0630('0x1'));var moment=require('moment');var BPromise=require(_0x0630('0x2'));var rp=require(_0x0630('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0630('0x4'));var attributes=require(_0x0630('0x5'));module['exports']=function(_0x4513c9,_0x4ec6a9){return _0x4513c9[_0x0630('0x6')](_0x0630('0x7'),attributes,{'tableName':_0x0630('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 72ede2d..259525d 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x2c9d22,_0x28f65a){var _0x160346=function(_0x14e429){while(--_0x14e429){_0x2c9d22['push'](_0x2c9d22['shift']());}};_0x160346(++_0x28f65a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x5ff3=['message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','Tag,\x20%s,\x20%s'];(function(_0x2c588b,_0x479b65){var _0x4676ce=function(_0x47da2f){while(--_0x47da2f){_0x2c588b['push'](_0x2c588b['shift']());}};_0x4676ce(++_0x479b65);}(_0x5ff3,0x17d));var _0x35ff=function(_0x419d0b,_0x3d1f29){_0x419d0b=_0x419d0b-0x0;var _0x28c8a0=_0x5ff3[_0x419d0b];return _0x28c8a0;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('Tag,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f317d49..aac36a9 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 _0x6a88=['removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','update','delete','destroy','removeQueues'];(function(_0x29a4c2,_0x473cde){var _0x204a96=function(_0x9be6fe){while(--_0x9be6fe){_0x29a4c2['push'](_0x29a4c2['shift']());}};_0x204a96(++_0x473cde);}(_0x6a88,0x1bc));var _0x86a8=function(_0x4b332a,_0x5ec2db){_0x4b332a=_0x4b332a-0x0;var _0x115a04=_0x6a88[_0x4b332a];return _0x115a04;};'use strict';var multer=require('multer');var util=require(_0x86a8('0x0'));var path=require('path');var timeout=require(_0x86a8('0x1'));var express=require(_0x86a8('0x2'));var router=express[_0x86a8('0x3')]();var auth=require(_0x86a8('0x4'));var interaction=require(_0x86a8('0x5'));var config=require(_0x86a8('0x6'));var controller=require(_0x86a8('0x7'));router[_0x86a8('0x8')]('/',auth[_0x86a8('0x9')](),controller[_0x86a8('0xa')]);router['get'](_0x86a8('0xb'),auth[_0x86a8('0x9')](),controller['show']);router[_0x86a8('0x8')](_0x86a8('0xc'),auth[_0x86a8('0x9')](),controller[_0x86a8('0xd')]);router[_0x86a8('0x8')](_0x86a8('0xe'),auth[_0x86a8('0x9')](),controller[_0x86a8('0xf')]);router[_0x86a8('0x10')]('/',auth[_0x86a8('0x9')](),controller[_0x86a8('0x11')]);router[_0x86a8('0x10')](_0x86a8('0xc'),auth[_0x86a8('0x9')](),controller[_0x86a8('0x12')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x86a8('0x13')]);router['put'](_0x86a8('0xb'),auth[_0x86a8('0x9')](),controller[_0x86a8('0x14')]);router[_0x86a8('0x15')](_0x86a8('0xb'),auth[_0x86a8('0x9')](),controller[_0x86a8('0x16')]);router[_0x86a8('0x15')]('/:id/queues',auth['isAuthenticated'](),controller[_0x86a8('0x17')]);router[_0x86a8('0x15')](_0x86a8('0xe'),auth[_0x86a8('0x9')](),controller[_0x86a8('0x18')]);module[_0x86a8('0x19')]=router; \ No newline at end of file +var _0x7ac9=['/:id/queues','getAgents','create','post','addQueues','/:id/users','addAgents','put','update','delete','removeQueues','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./team.controller','get','isAuthenticated','show'];(function(_0x1071a4,_0x4f668c){var _0x3da743=function(_0x13b080){while(--_0x13b080){_0x1071a4['push'](_0x1071a4['shift']());}};_0x3da743(++_0x4f668c);}(_0x7ac9,0xfd));var _0x97ac=function(_0x48cbc7,_0x3d15e6){_0x48cbc7=_0x48cbc7-0x0;var _0x52ebe4=_0x7ac9[_0x48cbc7];return _0x52ebe4;};'use strict';var multer=require(_0x97ac('0x0'));var util=require(_0x97ac('0x1'));var path=require(_0x97ac('0x2'));var timeout=require(_0x97ac('0x3'));var express=require('express');var router=express[_0x97ac('0x4')]();var auth=require(_0x97ac('0x5'));var interaction=require(_0x97ac('0x6'));var config=require('../../config/environment');var controller=require(_0x97ac('0x7'));router[_0x97ac('0x8')]('/',auth[_0x97ac('0x9')](),controller['index']);router[_0x97ac('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x97ac('0xa')]);router[_0x97ac('0x8')](_0x97ac('0xb'),auth[_0x97ac('0x9')](),controller['getQueues']);router[_0x97ac('0x8')]('/:id/users',auth[_0x97ac('0x9')](),controller[_0x97ac('0xc')]);router['post']('/',auth[_0x97ac('0x9')](),controller[_0x97ac('0xd')]);router[_0x97ac('0xe')](_0x97ac('0xb'),auth[_0x97ac('0x9')](),controller[_0x97ac('0xf')]);router[_0x97ac('0xe')](_0x97ac('0x10'),auth[_0x97ac('0x9')](),controller[_0x97ac('0x11')]);router[_0x97ac('0x12')]('/:id',auth[_0x97ac('0x9')](),controller[_0x97ac('0x13')]);router[_0x97ac('0x14')]('/:id',auth[_0x97ac('0x9')](),controller['destroy']);router[_0x97ac('0x14')]('/:id/queues',auth[_0x97ac('0x9')](),controller[_0x97ac('0x15')]);router[_0x97ac('0x14')]('/:id/users',auth[_0x97ac('0x9')](),controller[_0x97ac('0x16')]);module[_0x97ac('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 7eaca07..a0fbb56 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 _0xcaa2=['STRING','sequelize','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xcaa2,0xe5));var _0x2caa=function(_0x2ae2bc,_0x177514){_0x2ae2bc=_0x2ae2bc-0x0;var _0x53c290=_0xcaa2[_0x2ae2bc];return _0x53c290;};'use strict';var Sequelize=require(_0x2caa('0x0'));module[_0x2caa('0x1')]={'name':{'type':Sequelize[_0x2caa('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfa2c=['STRING','name','sequelize','exports'];(function(_0x153762,_0xad5864){var _0x548f8c=function(_0x33ab7a){while(--_0x33ab7a){_0x153762['push'](_0x153762['shift']());}};_0x548f8c(++_0xad5864);}(_0xfa2c,0xb6));var _0xcfa2=function(_0x331db5,_0x2cefd4){_0x331db5=_0x331db5-0x0;var _0x5b6d8f=_0xfa2c[_0x331db5];return _0x5b6d8f;};'use strict';var Sequelize=require(_0xcfa2('0x0'));module[_0xcfa2('0x1')]={'name':{'type':Sequelize[_0xcfa2('0x2')],'allowNull':![],'unique':_0xcfa2('0x3')},'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 ec6c73c..116f40b 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 _0x32cd=['getAgents','pick','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Teams','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','type','VIRTUAL','options','include','Team','findAll','rows','show','params','keys','includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Openchannel','Whatsapp','each','User','online','voicePause','filter','UserVoiceQueueRt','isNil','interface','format','SIP/%s','omit','spread','emit','removeAgents','voice','chat','mail','sms','fax','openchannel','whatsapp','userTeam:remove'];(function(_0x25980c,_0x188482){var _0x453695=function(_0x2851ee){while(--_0x2851ee){_0x25980c['push'](_0x25980c['shift']());}};_0x453695(++_0x188482);}(_0x32cd,0x89));var _0xd32c=function(_0x32376b,_0x8afd6f){_0x32376b=_0x32376b-0x0;var _0xb1371e=_0x32cd[_0x32376b];return _0xb1371e;};'use strict';var pdf=require(_0xd32c('0x0'));var emlformat=require(_0xd32c('0x1'));var rimraf=require(_0xd32c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd32c('0x3'));var rp=require(_0xd32c('0x4'));var moment=require(_0xd32c('0x5'));var BPromise=require(_0xd32c('0x6'));var Mustache=require(_0xd32c('0x7'));var util=require(_0xd32c('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd32c('0x9'));var fs=require('fs');var _=require(_0xd32c('0xa'));var squel=require(_0xd32c('0xb'));var crypto=require('crypto');var jsforce=require(_0xd32c('0xc'));var deskjs=require(_0xd32c('0xd'));var toCsv=require(_0xd32c('0xe'));var querystring=require(_0xd32c('0xf'));var Papa=require('papaparse');var Redis=require(_0xd32c('0x10'));var authService=require(_0xd32c('0x11'));var qs=require(_0xd32c('0x12'));var as=require(_0xd32c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd32c('0x14'));var utils=require(_0xd32c('0x15'));var config=require(_0xd32c('0x16'));var db=require(_0xd32c('0x17'))['db'];config[_0xd32c('0x18')]=_['defaults'](config[_0xd32c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xd32c('0x19'))(new Redis(config[_0xd32c('0x18')]));require(_0xd32c('0x1a'))[_0xd32c('0x1b')](socket);function respondWithStatusCode(_0x2bd531,_0x4346e6){_0x4346e6=_0x4346e6||0xcc;return function(_0x5dc571){if(_0x5dc571){return _0x2bd531[_0xd32c('0x1c')](_0x4346e6);}return _0x2bd531[_0xd32c('0x1d')](_0x4346e6)[_0xd32c('0x1e')]();};}function respondWithResult(_0x3ae13e,_0x1ed1a9){_0x1ed1a9=_0x1ed1a9||0xc8;return function(_0x490585){if(_0x490585){return _0x3ae13e[_0xd32c('0x1d')](_0x1ed1a9)[_0xd32c('0x1f')](_0x490585);}};}function respondWithFilteredResult(_0x2cbbb6,_0x2e1b9c){return function(_0x559acd){if(_0x559acd){var _0xbb462a=_0x559acd[_0xd32c('0x20')],_0x56faa9=_0x2e1b9c[_0xd32c('0x21')],_0x949983=_0x2e1b9c[_0xd32c('0x21')]+_0x2e1b9c[_0xd32c('0x22')],_0x2ef543;if(_0x949983>=_0xbb462a){_0x949983=_0xbb462a;_0x2ef543=0xc8;}else{_0x2ef543=0xce;}_0x2cbbb6['status'](_0x2ef543);return _0x2cbbb6[_0xd32c('0x23')](_0xd32c('0x24'),_0x56faa9+'-'+_0x949983+'/'+_0xbb462a)[_0xd32c('0x1f')](_0x559acd);}return null;};}function patchUpdates(_0x49c30d){return function(_0x488e33){try{jsonpatch[_0xd32c('0x25')](_0x488e33,_0x49c30d,!![]);}catch(_0x2da50a){return BPromise[_0xd32c('0x26')](_0x2da50a);}return _0x488e33[_0xd32c('0x27')]();};}function saveUpdates(_0x52ed47,_0x8aa402){return function(_0x31c501){if(_0x31c501){return _0x31c501[_0xd32c('0x28')](_0x52ed47)[_0xd32c('0x29')](function(_0x19293a){return _0x19293a;});}return null;};}function removeEntity(_0xf385cd,_0x47bcd7){return function(_0xd091d){if(_0xd091d){return _0xd091d[_0xd32c('0x2a')]()[_0xd32c('0x29')](function(){var _0x4b2d84=_0xd091d['get']({'plain':!![]});var _0x770547=_0xd32c('0x2b');return db[_0xd32c('0x2c')][_0xd32c('0x2a')]({'where':{'type':_0x770547,'resourceId':_0x4b2d84['id']}})[_0xd32c('0x29')](function(){return _0xd091d;});})[_0xd32c('0x29')](function(){_0xf385cd[_0xd32c('0x1d')](0xcc)[_0xd32c('0x1e')]();});}};}function handleEntityNotFound(_0x1bc89d,_0x33e8d1){return function(_0x2f6314){if(!_0x2f6314){_0x1bc89d[_0xd32c('0x1c')](0x194);}return _0x2f6314;};}function handleError(_0x42fbef,_0x5a02c8){_0x5a02c8=_0x5a02c8||0x1f4;return function(_0x37e9a9){logger['error'](_0x37e9a9[_0xd32c('0x2d')]);if(_0x37e9a9[_0xd32c('0x2e')]){delete _0x37e9a9[_0xd32c('0x2e')];}_0x42fbef['status'](_0x5a02c8)['send'](_0x37e9a9);};}exports[_0xd32c('0x2f')]=function(_0xcee075,_0x5cd404){var _0x2813aa={},_0x381910={},_0x4dafa2={'count':0x0,'rows':[]};var _0x2cd802=_[_0xd32c('0x30')](db['Team'][_0xd32c('0x31')],function(_0x3ae5f8){return{'name':_0x3ae5f8[_0xd32c('0x32')],'type':_0x3ae5f8['type'][_0xd32c('0x33')]};});_0x381910[_0xd32c('0x34')]=_[_0xd32c('0x30')](_0x2cd802,'name');_0x381910[_0xd32c('0x35')]=_['keys'](_0xcee075[_0xd32c('0x35')]);_0x381910[_0xd32c('0x36')]=_[_0xd32c('0x37')](_0x381910[_0xd32c('0x34')],_0x381910[_0xd32c('0x35')]);_0x2813aa['attributes']=_[_0xd32c('0x37')](_0x381910[_0xd32c('0x34')],qs[_0xd32c('0x38')](_0xcee075[_0xd32c('0x35')][_0xd32c('0x38')]));_0x2813aa[_0xd32c('0x39')]=_0x2813aa[_0xd32c('0x39')][_0xd32c('0x3a')]?_0x2813aa[_0xd32c('0x39')]:_0x381910[_0xd32c('0x34')];if(!_0xcee075[_0xd32c('0x35')]['hasOwnProperty'](_0xd32c('0x3b'))){_0x2813aa[_0xd32c('0x22')]=qs[_0xd32c('0x22')](_0xcee075[_0xd32c('0x35')]['limit']);_0x2813aa[_0xd32c('0x21')]=qs[_0xd32c('0x21')](_0xcee075['query'][_0xd32c('0x21')]);}_0x2813aa[_0xd32c('0x3c')]=qs[_0xd32c('0x3d')](_0xcee075[_0xd32c('0x35')][_0xd32c('0x3d')]);_0x2813aa[_0xd32c('0x3e')]=qs[_0xd32c('0x36')](_['pick'](_0xcee075[_0xd32c('0x35')],_0x381910[_0xd32c('0x36')]),_0x2cd802);if(_0xcee075[_0xd32c('0x35')]['filter']){_0x2813aa['where']=_['merge'](_0x2813aa[_0xd32c('0x3e')],{'$or':_['map'](_0x2cd802,function(_0x4540f4){if(_0x4540f4[_0xd32c('0x3f')]!==_0xd32c('0x40')){var _0x785f76={};_0x785f76[_0x4540f4['name']]={'$like':'%'+_0xcee075[_0xd32c('0x35')]['filter']+'%'};return _0x785f76;}})});}_0x2813aa=_['merge']({},_0x2813aa,_0xcee075[_0xd32c('0x41')]);var _0x167c5a={'where':_0x2813aa[_0xd32c('0x3e')]};return db['Team'][_0xd32c('0x20')](_0x167c5a)['then'](function(_0x303fb9){_0x4dafa2[_0xd32c('0x20')]=_0x303fb9;if(_0xcee075[_0xd32c('0x35')]['includeAll']){_0x2813aa[_0xd32c('0x42')]=[{'all':!![]}];}return db[_0xd32c('0x43')][_0xd32c('0x44')](_0x2813aa);})[_0xd32c('0x29')](function(_0x18fe5b){_0x4dafa2[_0xd32c('0x45')]=_0x18fe5b;return _0x4dafa2;})[_0xd32c('0x29')](respondWithFilteredResult(_0x5cd404,_0x2813aa))['catch'](handleError(_0x5cd404,null));};exports[_0xd32c('0x46')]=function(_0x575ca5,_0x478a65){var _0x20a1a3={'raw':![],'where':{'id':_0x575ca5[_0xd32c('0x47')]['id']}},_0x56ab83={};_0x56ab83[_0xd32c('0x34')]=_[_0xd32c('0x48')](db['Team']['rawAttributes']);_0x56ab83[_0xd32c('0x35')]=_[_0xd32c('0x48')](_0x575ca5[_0xd32c('0x35')]);_0x56ab83[_0xd32c('0x36')]=_[_0xd32c('0x37')](_0x56ab83[_0xd32c('0x34')],_0x56ab83[_0xd32c('0x35')]);_0x20a1a3[_0xd32c('0x39')]=_['intersection'](_0x56ab83[_0xd32c('0x34')],qs['fields'](_0x575ca5[_0xd32c('0x35')]['fields']));_0x20a1a3[_0xd32c('0x39')]=_0x20a1a3[_0xd32c('0x39')][_0xd32c('0x3a')]?_0x20a1a3[_0xd32c('0x39')]:_0x56ab83[_0xd32c('0x34')];if(_0x575ca5[_0xd32c('0x35')][_0xd32c('0x49')]){_0x20a1a3[_0xd32c('0x42')]=[{'all':!![]}];}_0x20a1a3=_[_0xd32c('0x4a')]({},_0x20a1a3,_0x575ca5[_0xd32c('0x41')]);return db[_0xd32c('0x43')][_0xd32c('0x4b')](_0x20a1a3)[_0xd32c('0x29')](handleEntityNotFound(_0x478a65,null))[_0xd32c('0x29')](respondWithResult(_0x478a65,null))['catch'](handleError(_0x478a65,null));};exports[_0xd32c('0x4c')]=function(_0x41ffdd,_0x1fa722){return db['Team']['create'](_0x41ffdd[_0xd32c('0x4d')],{})[_0xd32c('0x29')](function(_0x140b9e){var _0x434dce=_0x41ffdd[_0xd32c('0x4e')][_0xd32c('0x4f')]({'plain':!![]});if(!_0x434dce)throw new Error(_0xd32c('0x50'));if(_0x434dce[_0xd32c('0x51')]===_0xd32c('0x4e')){var _0x1ccb3d=_0x140b9e[_0xd32c('0x4f')]({'plain':!![]});var _0x527703=_0xd32c('0x2b');return db[_0xd32c('0x52')][_0xd32c('0x4b')]({'where':{'name':_0x527703,'userProfileId':_0x434dce[_0xd32c('0x53')]},'raw':!![]})[_0xd32c('0x29')](function(_0x3b2080){if(_0x3b2080&&_0x3b2080[_0xd32c('0x54')]===0x0){return db[_0xd32c('0x2c')][_0xd32c('0x4c')]({'name':_0x1ccb3d[_0xd32c('0x2e')],'resourceId':_0x1ccb3d['id'],'type':_0x3b2080[_0xd32c('0x2e')],'sectionId':_0x3b2080['id']},{})[_0xd32c('0x29')](function(){return _0x140b9e;});}else{return _0x140b9e;}})[_0xd32c('0x55')](function(_0x3e3e19){logger[_0xd32c('0x56')](_0xd32c('0x57'),_0x3e3e19);throw _0x3e3e19;});}return _0x140b9e;})[_0xd32c('0x29')](respondWithResult(_0x1fa722,0xc9))[_0xd32c('0x55')](handleError(_0x1fa722,null));};exports['update']=function(_0x5a6e69,_0xca290d){if(_0x5a6e69[_0xd32c('0x4d')]['id']){delete _0x5a6e69[_0xd32c('0x4d')]['id'];}return db[_0xd32c('0x43')][_0xd32c('0x4b')]({'where':{'id':_0x5a6e69[_0xd32c('0x47')]['id']}})[_0xd32c('0x29')](handleEntityNotFound(_0xca290d,null))['then'](saveUpdates(_0x5a6e69[_0xd32c('0x4d')],null))['then'](respondWithResult(_0xca290d,null))[_0xd32c('0x55')](handleError(_0xca290d,null));};exports['destroy']=function(_0xf1edd9,_0x485917){return db[_0xd32c('0x43')]['find']({'where':{'id':_0xf1edd9['params']['id']}})[_0xd32c('0x29')](handleEntityNotFound(_0x485917,null))[_0xd32c('0x29')](removeEntity(_0x485917,null))[_0xd32c('0x55')](handleError(_0x485917,null));};exports['getQueues']=function(_0x4fbd66,_0x22d22c,_0x1db8bc){return db['Team'][_0xd32c('0x58')]({'where':{'id':_0x4fbd66[_0xd32c('0x47')]['id']}})['then'](handleEntityNotFound(_0x22d22c,null))[_0xd32c('0x29')](function(_0x5e9e99){if(!_0x4fbd66['query'][_0xd32c('0x59')]||!utils[_0xd32c('0x5a')](_0x4fbd66['query']['channel'])){throw new db[(_0xd32c('0x5b'))][(_0xd32c('0x5c'))](_0xd32c('0x5d'));}var _0x4bfc7d={};var _0x96bc95={};_0x96bc95[_0xd32c('0x34')]=_[_0xd32c('0x48')](db[_[_0xd32c('0x5e')](_0x4fbd66['query'][_0xd32c('0x59')][_0xd32c('0x5f')]())+_0xd32c('0x60')][_0xd32c('0x31')]);_0x96bc95[_0xd32c('0x35')]=_[_0xd32c('0x48')](_0x4fbd66[_0xd32c('0x35')]);_0x96bc95[_0xd32c('0x36')]=_[_0xd32c('0x37')](_0x96bc95[_0xd32c('0x34')],_0x96bc95[_0xd32c('0x35')]);_0x4bfc7d[_0xd32c('0x39')]=_[_0xd32c('0x37')](_0x96bc95[_0xd32c('0x34')],qs[_0xd32c('0x38')](_0x4fbd66[_0xd32c('0x35')][_0xd32c('0x38')]));_0x4bfc7d[_0xd32c('0x39')]=_0x4bfc7d[_0xd32c('0x39')][_0xd32c('0x3a')]?_0x4bfc7d[_0xd32c('0x39')]:_0x96bc95[_0xd32c('0x34')];_0x4bfc7d[_0xd32c('0x22')]=qs['limit'](_0x4fbd66[_0xd32c('0x35')]['limit']);_0x4bfc7d[_0xd32c('0x21')]=qs[_0xd32c('0x21')](_0x4fbd66[_0xd32c('0x35')][_0xd32c('0x21')]);_0x4bfc7d[_0xd32c('0x3c')]=qs['sort'](_0x4fbd66[_0xd32c('0x35')][_0xd32c('0x3d')]);_0x4bfc7d[_0xd32c('0x3e')]=qs[_0xd32c('0x36')](_['pick'](_0x4fbd66[_0xd32c('0x35')],_0x96bc95['filters']));_0x4bfc7d=_[_0xd32c('0x4a')]({},_0x4bfc7d,_0x4fbd66[_0xd32c('0x41')]);return _0x5e9e99[_0xd32c('0x4f')+_['capitalize'](_0x4fbd66[_0xd32c('0x35')][_0xd32c('0x59')][_0xd32c('0x5f')]())+'Queues'](_0x4bfc7d);})['then'](respondWithResult(_0x22d22c,null))['catch'](handleError(_0x22d22c,null));};exports[_0xd32c('0x61')]=function(_0xacffba,_0x1f491a,_0x378ccf){return db[_0xd32c('0x43')][_0xd32c('0x58')]({'where':{'id':_0xacffba['params']['id']}})[_0xd32c('0x29')](function(_0x3ae773){if(_0x3ae773){if(!_0xacffba[_0xd32c('0x4d')][_0xd32c('0x59')]||!utils[_0xd32c('0x5a')](_0xacffba[_0xd32c('0x4d')][_0xd32c('0x59')])){throw new db[(_0xd32c('0x5b'))][(_0xd32c('0x5c'))](_0xd32c('0x5d'));}return _0x3ae773[_0xd32c('0x62')+_[_0xd32c('0x5e')](_0xacffba[_0xd32c('0x4d')][_0xd32c('0x59')]['toLowerCase']())+_0xd32c('0x63')](_0xacffba['body'][_0xd32c('0x64')]);}return null;})[_0xd32c('0x29')](handleEntityNotFound(_0x1f491a,null))['then'](respondWithStatusCode(_0x1f491a,null))[_0xd32c('0x55')](handleError(_0x1f491a,null));};exports[_0xd32c('0x65')]=function(_0x3a5a1d,_0x30246d,_0x79f37c){return db[_0xd32c('0x43')]['findOne']({'where':{'id':_0x3a5a1d[_0xd32c('0x47')]['id']}})[_0xd32c('0x29')](function(_0x80397d){if(_0x80397d){if(!_0x3a5a1d['query'][_0xd32c('0x59')]||!utils[_0xd32c('0x5a')](_0x3a5a1d['query']['channel'])){throw new db['Sequelize'][(_0xd32c('0x5c'))](_0xd32c('0x5d'));}return _0x80397d[_0xd32c('0x66')+_[_0xd32c('0x5e')](_0x3a5a1d[_0xd32c('0x35')][_0xd32c('0x59')][_0xd32c('0x5f')]())+_0xd32c('0x63')](_0x3a5a1d[_0xd32c('0x35')][_0xd32c('0x64')]);}return null;})[_0xd32c('0x29')](handleEntityNotFound(_0x30246d,null))[_0xd32c('0x29')](respondWithStatusCode(_0x30246d,null))[_0xd32c('0x55')](handleError(_0x30246d,null));};exports[_0xd32c('0x67')]=function(_0x11cb38,_0x399d53,_0x41eabe){return db[_0xd32c('0x43')]['find']({'where':{'id':_0x11cb38[_0xd32c('0x47')]['id']}})['then'](handleEntityNotFound(_0x399d53,null))['then'](function(_0x394c08){if(_0x394c08){var _0x24b057=[_0xd32c('0x68'),_0xd32c('0x69'),_0xd32c('0x6a'),'Sms','Fax',_0xd32c('0x6b'),_0xd32c('0x6c')];return BPromise['each'](_0x24b057,function(_0x59f649){return _0x394c08[_0xd32c('0x4f')+_0x59f649+_0xd32c('0x63')]({'attributes':['id',_0xd32c('0x2e')]})[_0xd32c('0x29')](function(_0x24cdc0){return BPromise[_0xd32c('0x6d')](_0x24cdc0,function(_0x1491dc){return _0x1491dc[_0xd32c('0x67')](_0x11cb38['body'][_0xd32c('0x64')])[_0xd32c('0x29')](function(){if(_0x59f649==='Voice'){return db[_0xd32c('0x6e')][_0xd32c('0x44')]({'where':{'id':_0x11cb38[_0xd32c('0x4d')][_0xd32c('0x64')]},'attributes':['id','name',_0xd32c('0x6f'),_0xd32c('0x70'),'interface'],'raw':!![]})[_0xd32c('0x29')](function(_0x355bc0){return BPromise[_0xd32c('0x6d')](_[_0xd32c('0x71')](_0x355bc0,{'online':0x1}),function(_0x5b3324){return db[_0xd32c('0x72')]['upsert']({'membername':_0x5b3324[_0xd32c('0x2e')],'UserId':_0x5b3324['id'],'queue_name':_0x1491dc[_0xd32c('0x2e')],'VoiceQueueId':_0x1491dc['id'],'interface':_[_0xd32c('0x73')](_0x5b3324[_0xd32c('0x74')])?util[_0xd32c('0x75')](_0xd32c('0x76'),_0x5b3324[_0xd32c('0x2e')]):_0x5b3324[_0xd32c('0x74')],'paused':_0x5b3324[_0xd32c('0x70')]||![],'penalty':0x0});});});}});});})[_0xd32c('0x29')](function(){return _0x394c08;});})['then'](function(){return _0x394c08;});}})[_0xd32c('0x29')](function(_0xdf89ed){if(_0xdf89ed){return _0xdf89ed[_0xd32c('0x67')](_0x11cb38[_0xd32c('0x4d')]['ids'],_[_0xd32c('0x77')](_0x11cb38[_0xd32c('0x4d')],[_0xd32c('0x64'),'id'])||{})[_0xd32c('0x78')](function(_0x5d4e96){for(var _0x557ff1=0x0;_0x557ff1<_0x11cb38[_0xd32c('0x4d')][_0xd32c('0x64')][_0xd32c('0x3a')];_0x557ff1+=0x1){socket[_0xd32c('0x79')]('userTeam:save',{'UserId':_0x11cb38[_0xd32c('0x4d')]['ids'][_0x557ff1],'TeamId':_0x11cb38[_0xd32c('0x47')]['id']});}return _0x5d4e96;});}})[_0xd32c('0x29')](respondWithResult(_0x399d53,null))['catch'](handleError(_0x399d53,null));};exports[_0xd32c('0x7a')]=function(_0x469f33,_0x34370a,_0x20ccfb){return db[_0xd32c('0x43')][_0xd32c('0x4b')]({'where':{'id':_0x469f33['params']['id']}})[_0xd32c('0x29')](handleEntityNotFound(_0x34370a,null))['then'](function(_0x149181){if(_0x149181){return BPromise[_0xd32c('0x6d')]([_0xd32c('0x7b'),_0xd32c('0x7c'),_0xd32c('0x7d'),_0xd32c('0x7e'),_0xd32c('0x7f'),_0xd32c('0x80'),_0xd32c('0x81')],function(_0x6c62a6){return _0x149181[_0xd32c('0x4f')+_[_0xd32c('0x5e')](_0x6c62a6)+_0xd32c('0x63')]({'attributes':['id',_0xd32c('0x2e')]})[_0xd32c('0x29')](function(_0x870ad){return BPromise[_0xd32c('0x6d')](_0x870ad,function(_0x1c31c5){return _0x1c31c5['removeAgents'](_0x469f33[_0xd32c('0x35')]['ids'])['then'](function(){if(_0x6c62a6===_0xd32c('0x7b')){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x1c31c5['id'],'UserId':_0x469f33[_0xd32c('0x35')][_0xd32c('0x64')]}});}});});})[_0xd32c('0x29')](function(){return _0x149181;});})[_0xd32c('0x29')](function(){return _0x149181;});}})[_0xd32c('0x29')](function(_0x2434cb){if(_0x2434cb){return _0x2434cb['removeAgents'](_0x469f33['query'][_0xd32c('0x64')])[_0xd32c('0x29')](function(){if(_['isArray'](_0x469f33[_0xd32c('0x35')]['ids'])){for(var _0x539a05=0x0;_0x539a05<_0x469f33[_0xd32c('0x35')]['ids'][_0xd32c('0x3a')];_0x539a05+=0x1){socket[_0xd32c('0x79')](_0xd32c('0x82'),{'UserId':Number(_0x469f33[_0xd32c('0x35')][_0xd32c('0x64')][_0x539a05]),'TeamId':Number(_0x469f33[_0xd32c('0x47')]['id'])});}}else{socket[_0xd32c('0x79')]('userTeam:remove',{'UserId':Number(_0x469f33['query'][_0xd32c('0x64')]),'TeamId':Number(_0x469f33[_0xd32c('0x47')]['id'])});}});}})[_0xd32c('0x29')](respondWithStatusCode(_0x34370a,null))[_0xd32c('0x55')](handleError(_0x34370a,null));};exports[_0xd32c('0x83')]=function(_0x68a5f4,_0x10adfa,_0x577b3e){var _0x53bc76={};var _0x15f39d={};var _0x189f76;var _0x1b2de8;return db['Team'][_0xd32c('0x58')]({'where':{'id':_0x68a5f4['params']['id']}})[_0xd32c('0x29')](handleEntityNotFound(_0x10adfa,null))['then'](function(_0x297fd3){if(_0x297fd3){_0x189f76=_0x297fd3;_0x15f39d[_0xd32c('0x34')]=_[_0xd32c('0x48')](db[_0xd32c('0x6e')][_0xd32c('0x31')]);_0x15f39d[_0xd32c('0x35')]=_[_0xd32c('0x48')](_0x68a5f4[_0xd32c('0x35')]);_0x15f39d[_0xd32c('0x36')]=_[_0xd32c('0x37')](_0x15f39d[_0xd32c('0x34')],_0x15f39d[_0xd32c('0x35')]);_0x53bc76[_0xd32c('0x39')]=_[_0xd32c('0x37')](_0x15f39d['model'],qs[_0xd32c('0x38')](_0x68a5f4[_0xd32c('0x35')][_0xd32c('0x38')]));_0x53bc76['attributes']=_0x53bc76[_0xd32c('0x39')][_0xd32c('0x3a')]?_0x53bc76[_0xd32c('0x39')]:_0x15f39d[_0xd32c('0x34')];_0x53bc76[_0xd32c('0x3c')]=qs[_0xd32c('0x3d')](_0x68a5f4[_0xd32c('0x35')][_0xd32c('0x3d')]);_0x53bc76['where']=qs['filters'](_[_0xd32c('0x84')](_0x68a5f4[_0xd32c('0x35')],_0x15f39d['filters']));if(_0x68a5f4[_0xd32c('0x35')]['filter']){_0x53bc76[_0xd32c('0x3e')]=_[_0xd32c('0x4a')](_0x53bc76['where'],{'$or':_[_0xd32c('0x30')](_0x53bc76[_0xd32c('0x39')],function(_0x3d88f5){var _0x2fb71c={};_0x2fb71c[_0x3d88f5]={'$like':'%'+_0x68a5f4[_0xd32c('0x35')]['filter']+'%'};return _0x2fb71c;})});}_0x53bc76=_['merge']({},_0x53bc76,_0x68a5f4[_0xd32c('0x41')]);return _0x189f76[_0xd32c('0x83')](_0x53bc76);}})[_0xd32c('0x29')](function(_0x39b711){if(_0x39b711){_0x1b2de8=_0x39b711['length'];if(!_0x68a5f4[_0xd32c('0x35')][_0xd32c('0x85')](_0xd32c('0x3b'))){_0x53bc76['limit']=qs[_0xd32c('0x22')](_0x68a5f4['query'][_0xd32c('0x22')]);_0x53bc76[_0xd32c('0x21')]=qs[_0xd32c('0x21')](_0x68a5f4[_0xd32c('0x35')][_0xd32c('0x21')]);}return _0x189f76[_0xd32c('0x83')](_0x53bc76);}})[_0xd32c('0x29')](function(_0x474fba){if(_0x474fba){return _0x474fba?{'count':_0x1b2de8,'rows':_0x474fba}:null;}})[_0xd32c('0x29')](respondWithResult(_0x10adfa,null))[_0xd32c('0x55')](handleError(_0x10adfa,null));}; \ No newline at end of file +var _0x66c7=['ids','removeQueues','remove','addAgents','Voice','Chat','Sms','Fax','each','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','voice','sms','openchannel','whatsapp','isArray','userTeam:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','show','params','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','getQueues','findOne','isValidChannel','ValidationError','capitalize','Queue','channel','toLowerCase','Queues','addQueues','Sequelize','Unknown\x20channel','add'];(function(_0x4c060b,_0x4c5e75){var _0x5b9790=function(_0x32e525){while(--_0x32e525){_0x4c060b['push'](_0x4c060b['shift']());}};_0x5b9790(++_0x4c5e75);}(_0x66c7,0x19d));var _0x766c=function(_0x1ac12c,_0x43fad2){_0x1ac12c=_0x1ac12c-0x0;var _0x4b2bce=_0x66c7[_0x1ac12c];return _0x4b2bce;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x766c('0x0'));var zipdir=require(_0x766c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x766c('0x2'));var moment=require(_0x766c('0x3'));var BPromise=require(_0x766c('0x4'));var Mustache=require(_0x766c('0x5'));var util=require(_0x766c('0x6'));var path=require('path');var sox=require(_0x766c('0x7'));var csv=require('to-csv');var ejs=require(_0x766c('0x8'));var fs=require('fs');var _=require(_0x766c('0x9'));var squel=require(_0x766c('0xa'));var crypto=require(_0x766c('0xb'));var jsforce=require(_0x766c('0xc'));var deskjs=require(_0x766c('0xd'));var toCsv=require(_0x766c('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x766c('0xf'));var qs=require(_0x766c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x766c('0x11'))(_0x766c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x766c('0x13'))['db'];config[_0x766c('0x14')]=_[_0x766c('0x15')](config[_0x766c('0x14')],{'host':_0x766c('0x16'),'port':0x18eb});var socket=require(_0x766c('0x17'))(new Redis(config['redis']));require('./team.socket')[_0x766c('0x18')](socket);function respondWithStatusCode(_0x58c690,_0x5a813a){_0x5a813a=_0x5a813a||0xcc;return function(_0x4551a1){if(_0x4551a1){return _0x58c690[_0x766c('0x19')](_0x5a813a);}return _0x58c690[_0x766c('0x1a')](_0x5a813a)[_0x766c('0x1b')]();};}function respondWithResult(_0x5e792f,_0x21baed){_0x21baed=_0x21baed||0xc8;return function(_0x231dc8){if(_0x231dc8){return _0x5e792f[_0x766c('0x1a')](_0x21baed)[_0x766c('0x1c')](_0x231dc8);}};}function respondWithFilteredResult(_0x12c6a4,_0xf21d2c){return function(_0x5e1084){if(_0x5e1084){var _0x472703=_0x5e1084[_0x766c('0x1d')],_0x428d0e=_0xf21d2c[_0x766c('0x1e')],_0x2f0ceb=_0xf21d2c[_0x766c('0x1e')]+_0xf21d2c['limit'],_0x2e7495;if(_0x2f0ceb>=_0x472703){_0x2f0ceb=_0x472703;_0x2e7495=0xc8;}else{_0x2e7495=0xce;}_0x12c6a4[_0x766c('0x1a')](_0x2e7495);return _0x12c6a4[_0x766c('0x1f')]('Content-Range',_0x428d0e+'-'+_0x2f0ceb+'/'+_0x472703)[_0x766c('0x1c')](_0x5e1084);}return null;};}function patchUpdates(_0x3503ca){return function(_0x380a19){try{jsonpatch[_0x766c('0x20')](_0x380a19,_0x3503ca,!![]);}catch(_0x56c45f){return BPromise[_0x766c('0x21')](_0x56c45f);}return _0x380a19[_0x766c('0x22')]();};}function saveUpdates(_0x13bb9c,_0x5ea412){return function(_0x4cc436){if(_0x4cc436){return _0x4cc436[_0x766c('0x23')](_0x13bb9c)[_0x766c('0x24')](function(_0x3c6f64){return _0x3c6f64;});}return null;};}function removeEntity(_0x3f931a,_0x4c2841){return function(_0x5ac649){if(_0x5ac649){return _0x5ac649[_0x766c('0x25')]()[_0x766c('0x24')](function(){var _0x4b63c6=_0x5ac649[_0x766c('0x26')]({'plain':!![]});var _0x5626ab=_0x766c('0x27');return db[_0x766c('0x28')]['destroy']({'where':{'type':_0x5626ab,'resourceId':_0x4b63c6['id']}})[_0x766c('0x24')](function(){return _0x5ac649;});})[_0x766c('0x24')](function(){_0x3f931a['status'](0xcc)[_0x766c('0x1b')]();});}};}function handleEntityNotFound(_0x2add8b,_0xf4500){return function(_0x39ba91){if(!_0x39ba91){_0x2add8b[_0x766c('0x19')](0x194);}return _0x39ba91;};}function handleError(_0x3dd030,_0x50e749){_0x50e749=_0x50e749||0x1f4;return function(_0x2bd28c){logger[_0x766c('0x29')](_0x2bd28c[_0x766c('0x2a')]);if(_0x2bd28c[_0x766c('0x2b')]){delete _0x2bd28c['name'];}_0x3dd030[_0x766c('0x1a')](_0x50e749)[_0x766c('0x2c')](_0x2bd28c);};}exports[_0x766c('0x2d')]=function(_0x5bf1f2,_0x52e99c){var _0x56c705={},_0x32665d={},_0x4a52e6={'count':0x0,'rows':[]};var _0x30c0b3=_[_0x766c('0x2e')](db[_0x766c('0x2f')][_0x766c('0x30')],function(_0x247e8e){return{'name':_0x247e8e['fieldName'],'type':_0x247e8e[_0x766c('0x31')][_0x766c('0x32')]};});_0x32665d[_0x766c('0x33')]=_[_0x766c('0x2e')](_0x30c0b3,_0x766c('0x2b'));_0x32665d[_0x766c('0x34')]=_[_0x766c('0x35')](_0x5bf1f2[_0x766c('0x34')]);_0x32665d[_0x766c('0x36')]=_[_0x766c('0x37')](_0x32665d[_0x766c('0x33')],_0x32665d[_0x766c('0x34')]);_0x56c705['attributes']=_[_0x766c('0x37')](_0x32665d[_0x766c('0x33')],qs['fields'](_0x5bf1f2[_0x766c('0x34')][_0x766c('0x38')]));_0x56c705[_0x766c('0x39')]=_0x56c705[_0x766c('0x39')][_0x766c('0x3a')]?_0x56c705['attributes']:_0x32665d[_0x766c('0x33')];if(!_0x5bf1f2[_0x766c('0x34')][_0x766c('0x3b')](_0x766c('0x3c'))){_0x56c705[_0x766c('0x3d')]=qs[_0x766c('0x3d')](_0x5bf1f2['query'][_0x766c('0x3d')]);_0x56c705['offset']=qs[_0x766c('0x1e')](_0x5bf1f2[_0x766c('0x34')][_0x766c('0x1e')]);}_0x56c705[_0x766c('0x3e')]=qs[_0x766c('0x3f')](_0x5bf1f2[_0x766c('0x34')][_0x766c('0x3f')]);_0x56c705['where']=qs[_0x766c('0x36')](_[_0x766c('0x40')](_0x5bf1f2[_0x766c('0x34')],_0x32665d[_0x766c('0x36')]),_0x30c0b3);if(_0x5bf1f2[_0x766c('0x34')][_0x766c('0x41')]){_0x56c705[_0x766c('0x42')]=_[_0x766c('0x43')](_0x56c705[_0x766c('0x42')],{'$or':_['map'](_0x30c0b3,function(_0x27231d){if(_0x27231d['type']!==_0x766c('0x44')){var _0x40f03a={};_0x40f03a[_0x27231d['name']]={'$like':'%'+_0x5bf1f2['query'][_0x766c('0x41')]+'%'};return _0x40f03a;}})});}_0x56c705=_[_0x766c('0x43')]({},_0x56c705,_0x5bf1f2[_0x766c('0x45')]);var _0x5f24f0={'where':_0x56c705[_0x766c('0x42')]};return db[_0x766c('0x2f')][_0x766c('0x1d')](_0x5f24f0)[_0x766c('0x24')](function(_0x32f711){_0x4a52e6[_0x766c('0x1d')]=_0x32f711;if(_0x5bf1f2[_0x766c('0x34')]['includeAll']){_0x56c705['include']=[{'all':!![]}];}return db[_0x766c('0x2f')][_0x766c('0x46')](_0x56c705);})[_0x766c('0x24')](function(_0x153714){_0x4a52e6['rows']=_0x153714;return _0x4a52e6;})[_0x766c('0x24')](respondWithFilteredResult(_0x52e99c,_0x56c705))['catch'](handleError(_0x52e99c,null));};exports[_0x766c('0x47')]=function(_0x3daae8,_0x241de6){var _0xe433b6={'raw':![],'where':{'id':_0x3daae8[_0x766c('0x48')]['id']}},_0x465bd0={};_0x465bd0[_0x766c('0x33')]=_['keys'](db['Team']['rawAttributes']);_0x465bd0[_0x766c('0x34')]=_[_0x766c('0x35')](_0x3daae8['query']);_0x465bd0['filters']=_[_0x766c('0x37')](_0x465bd0[_0x766c('0x33')],_0x465bd0[_0x766c('0x34')]);_0xe433b6[_0x766c('0x39')]=_[_0x766c('0x37')](_0x465bd0[_0x766c('0x33')],qs[_0x766c('0x38')](_0x3daae8[_0x766c('0x34')]['fields']));_0xe433b6[_0x766c('0x39')]=_0xe433b6[_0x766c('0x39')][_0x766c('0x3a')]?_0xe433b6['attributes']:_0x465bd0[_0x766c('0x33')];if(_0x3daae8[_0x766c('0x34')][_0x766c('0x49')]){_0xe433b6[_0x766c('0x4a')]=[{'all':!![]}];}_0xe433b6=_[_0x766c('0x43')]({},_0xe433b6,_0x3daae8[_0x766c('0x45')]);return db[_0x766c('0x2f')][_0x766c('0x4b')](_0xe433b6)[_0x766c('0x24')](handleEntityNotFound(_0x241de6,null))[_0x766c('0x24')](respondWithResult(_0x241de6,null))['catch'](handleError(_0x241de6,null));};exports[_0x766c('0x4c')]=function(_0xff6de4,_0x4777a5){return db[_0x766c('0x2f')][_0x766c('0x4c')](_0xff6de4['body'],{})[_0x766c('0x24')](function(_0x411460){var _0xe1dac2=_0xff6de4[_0x766c('0x4d')][_0x766c('0x26')]({'plain':!![]});if(!_0xe1dac2)throw new Error(_0x766c('0x4e'));if(_0xe1dac2[_0x766c('0x4f')]===_0x766c('0x4d')){var _0x4e32a7=_0x411460['get']({'plain':!![]});var _0x2fbb83=_0x766c('0x27');return db[_0x766c('0x50')][_0x766c('0x4b')]({'where':{'name':_0x2fbb83,'userProfileId':_0xe1dac2[_0x766c('0x51')]},'raw':!![]})['then'](function(_0x99a433){if(_0x99a433&&_0x99a433[_0x766c('0x52')]===0x0){return db[_0x766c('0x28')][_0x766c('0x4c')]({'name':_0x4e32a7[_0x766c('0x2b')],'resourceId':_0x4e32a7['id'],'type':_0x99a433[_0x766c('0x2b')],'sectionId':_0x99a433['id']},{})[_0x766c('0x24')](function(){return _0x411460;});}else{return _0x411460;}})['catch'](function(_0x555d41){logger[_0x766c('0x29')](_0x766c('0x53'),_0x555d41);throw _0x555d41;});}return _0x411460;})['then'](respondWithResult(_0x4777a5,0xc9))[_0x766c('0x54')](handleError(_0x4777a5,null));};exports[_0x766c('0x23')]=function(_0x4b71cb,_0x3fff4d){if(_0x4b71cb['body']['id']){delete _0x4b71cb[_0x766c('0x55')]['id'];}return db[_0x766c('0x2f')][_0x766c('0x4b')]({'where':{'id':_0x4b71cb[_0x766c('0x48')]['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x3fff4d,null))['then'](saveUpdates(_0x4b71cb[_0x766c('0x55')],null))[_0x766c('0x24')](respondWithResult(_0x3fff4d,null))['catch'](handleError(_0x3fff4d,null));};exports[_0x766c('0x25')]=function(_0x490d78,_0x595f6a){return db['Team']['find']({'where':{'id':_0x490d78[_0x766c('0x48')]['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x595f6a,null))['then'](removeEntity(_0x595f6a,null))[_0x766c('0x54')](handleError(_0x595f6a,null));};exports[_0x766c('0x56')]=function(_0x191bc7,_0x505fe7,_0x3c21d1){return db[_0x766c('0x2f')][_0x766c('0x57')]({'where':{'id':_0x191bc7['params']['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x505fe7,null))[_0x766c('0x24')](function(_0x1b17a1){if(!_0x191bc7['query']['channel']||!utils[_0x766c('0x58')](_0x191bc7[_0x766c('0x34')]['channel'])){throw new db['Sequelize'][(_0x766c('0x59'))]('Unknown\x20channel');}var _0x252e76={};var _0x5dc9f5={};_0x5dc9f5[_0x766c('0x33')]=_[_0x766c('0x35')](db[_[_0x766c('0x5a')](_0x191bc7[_0x766c('0x34')]['channel']['toLowerCase']())+_0x766c('0x5b')]['rawAttributes']);_0x5dc9f5[_0x766c('0x34')]=_[_0x766c('0x35')](_0x191bc7['query']);_0x5dc9f5[_0x766c('0x36')]=_[_0x766c('0x37')](_0x5dc9f5[_0x766c('0x33')],_0x5dc9f5[_0x766c('0x34')]);_0x252e76[_0x766c('0x39')]=_[_0x766c('0x37')](_0x5dc9f5['model'],qs[_0x766c('0x38')](_0x191bc7[_0x766c('0x34')][_0x766c('0x38')]));_0x252e76[_0x766c('0x39')]=_0x252e76['attributes'][_0x766c('0x3a')]?_0x252e76[_0x766c('0x39')]:_0x5dc9f5[_0x766c('0x33')];_0x252e76[_0x766c('0x3d')]=qs[_0x766c('0x3d')](_0x191bc7[_0x766c('0x34')][_0x766c('0x3d')]);_0x252e76[_0x766c('0x1e')]=qs['offset'](_0x191bc7['query']['offset']);_0x252e76['order']=qs[_0x766c('0x3f')](_0x191bc7[_0x766c('0x34')][_0x766c('0x3f')]);_0x252e76[_0x766c('0x42')]=qs[_0x766c('0x36')](_[_0x766c('0x40')](_0x191bc7[_0x766c('0x34')],_0x5dc9f5[_0x766c('0x36')]));_0x252e76=_[_0x766c('0x43')]({},_0x252e76,_0x191bc7[_0x766c('0x45')]);return _0x1b17a1[_0x766c('0x26')+_[_0x766c('0x5a')](_0x191bc7[_0x766c('0x34')][_0x766c('0x5c')][_0x766c('0x5d')]())+_0x766c('0x5e')](_0x252e76);})['then'](respondWithResult(_0x505fe7,null))[_0x766c('0x54')](handleError(_0x505fe7,null));};exports[_0x766c('0x5f')]=function(_0x22c52c,_0x16d521,_0x56392c){return db[_0x766c('0x2f')][_0x766c('0x57')]({'where':{'id':_0x22c52c[_0x766c('0x48')]['id']}})['then'](function(_0x30647b){if(_0x30647b){if(!_0x22c52c['body'][_0x766c('0x5c')]||!utils[_0x766c('0x58')](_0x22c52c[_0x766c('0x55')][_0x766c('0x5c')])){throw new db[(_0x766c('0x60'))][(_0x766c('0x59'))](_0x766c('0x61'));}return _0x30647b[_0x766c('0x62')+_[_0x766c('0x5a')](_0x22c52c[_0x766c('0x55')][_0x766c('0x5c')][_0x766c('0x5d')]())+_0x766c('0x5e')](_0x22c52c[_0x766c('0x55')][_0x766c('0x63')]);}return null;})[_0x766c('0x24')](handleEntityNotFound(_0x16d521,null))[_0x766c('0x24')](respondWithStatusCode(_0x16d521,null))[_0x766c('0x54')](handleError(_0x16d521,null));};exports[_0x766c('0x64')]=function(_0x13c745,_0x217135,_0x5bbca8){return db[_0x766c('0x2f')][_0x766c('0x57')]({'where':{'id':_0x13c745[_0x766c('0x48')]['id']}})[_0x766c('0x24')](function(_0x5d6814){if(_0x5d6814){if(!_0x13c745[_0x766c('0x34')][_0x766c('0x5c')]||!utils['isValidChannel'](_0x13c745[_0x766c('0x34')]['channel'])){throw new db[(_0x766c('0x60'))][(_0x766c('0x59'))](_0x766c('0x61'));}return _0x5d6814[_0x766c('0x65')+_[_0x766c('0x5a')](_0x13c745[_0x766c('0x34')]['channel'][_0x766c('0x5d')]())+_0x766c('0x5e')](_0x13c745[_0x766c('0x34')]['ids']);}return null;})[_0x766c('0x24')](handleEntityNotFound(_0x217135,null))['then'](respondWithStatusCode(_0x217135,null))[_0x766c('0x54')](handleError(_0x217135,null));};exports[_0x766c('0x66')]=function(_0x4d157a,_0x33b914,_0x215da1){return db[_0x766c('0x2f')][_0x766c('0x4b')]({'where':{'id':_0x4d157a[_0x766c('0x48')]['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x33b914,null))['then'](function(_0x47b5f0){if(_0x47b5f0){var _0x50a393=[_0x766c('0x67'),_0x766c('0x68'),'Mail',_0x766c('0x69'),_0x766c('0x6a'),'Openchannel','Whatsapp'];return BPromise[_0x766c('0x6b')](_0x50a393,function(_0x592ba1){return _0x47b5f0['get'+_0x592ba1+'Queues']({'attributes':['id','name']})[_0x766c('0x24')](function(_0x4e8644){return BPromise[_0x766c('0x6b')](_0x4e8644,function(_0x2440f4){return _0x2440f4['addAgents'](_0x4d157a[_0x766c('0x55')][_0x766c('0x63')])[_0x766c('0x24')](function(){if(_0x592ba1===_0x766c('0x67')){return db['User'][_0x766c('0x46')]({'where':{'id':_0x4d157a[_0x766c('0x55')][_0x766c('0x63')]},'attributes':['id',_0x766c('0x2b'),_0x766c('0x6c'),_0x766c('0x6d'),_0x766c('0x6e')],'raw':!![]})[_0x766c('0x24')](function(_0x3cbf4a){return BPromise['each'](_['filter'](_0x3cbf4a,{'online':0x1}),function(_0x1e934a){return db[_0x766c('0x6f')][_0x766c('0x70')]({'membername':_0x1e934a[_0x766c('0x2b')],'UserId':_0x1e934a['id'],'queue_name':_0x2440f4[_0x766c('0x2b')],'VoiceQueueId':_0x2440f4['id'],'interface':_[_0x766c('0x71')](_0x1e934a[_0x766c('0x6e')])?util[_0x766c('0x72')](_0x766c('0x73'),_0x1e934a[_0x766c('0x2b')]):_0x1e934a[_0x766c('0x6e')],'paused':_0x1e934a['voicePause']||![],'penalty':0x0});});});}});});})[_0x766c('0x24')](function(){return _0x47b5f0;});})[_0x766c('0x24')](function(){return _0x47b5f0;});}})['then'](function(_0xad7e03){if(_0xad7e03){return _0xad7e03[_0x766c('0x66')](_0x4d157a[_0x766c('0x55')][_0x766c('0x63')],_[_0x766c('0x74')](_0x4d157a['body'],['ids','id'])||{})[_0x766c('0x75')](function(_0x4ba25f){for(var _0x436774=0x0;_0x436774<_0x4d157a[_0x766c('0x55')][_0x766c('0x63')][_0x766c('0x3a')];_0x436774+=0x1){socket[_0x766c('0x76')](_0x766c('0x77'),{'UserId':_0x4d157a[_0x766c('0x55')][_0x766c('0x63')][_0x436774],'TeamId':_0x4d157a[_0x766c('0x48')]['id']});}return _0x4ba25f;});}})['then'](respondWithResult(_0x33b914,null))[_0x766c('0x54')](handleError(_0x33b914,null));};exports[_0x766c('0x78')]=function(_0x34ca8c,_0x594b68,_0x5abab6){return db[_0x766c('0x2f')][_0x766c('0x4b')]({'where':{'id':_0x34ca8c[_0x766c('0x48')]['id']}})['then'](handleEntityNotFound(_0x594b68,null))[_0x766c('0x24')](function(_0xd00b6f){if(_0xd00b6f){return BPromise[_0x766c('0x6b')]([_0x766c('0x79'),'chat','mail',_0x766c('0x7a'),'fax',_0x766c('0x7b'),_0x766c('0x7c')],function(_0x59f641){return _0xd00b6f[_0x766c('0x26')+_[_0x766c('0x5a')](_0x59f641)+_0x766c('0x5e')]({'attributes':['id',_0x766c('0x2b')]})[_0x766c('0x24')](function(_0x3b22d6){return BPromise[_0x766c('0x6b')](_0x3b22d6,function(_0x50cd74){return _0x50cd74[_0x766c('0x78')](_0x34ca8c['query'][_0x766c('0x63')])['then'](function(){if(_0x59f641===_0x766c('0x79')){return db[_0x766c('0x6f')]['destroy']({'where':{'VoiceQueueId':_0x50cd74['id'],'UserId':_0x34ca8c[_0x766c('0x34')][_0x766c('0x63')]}});}});});})['then'](function(){return _0xd00b6f;});})['then'](function(){return _0xd00b6f;});}})[_0x766c('0x24')](function(_0x8e761b){if(_0x8e761b){return _0x8e761b['removeAgents'](_0x34ca8c['query'][_0x766c('0x63')])[_0x766c('0x24')](function(){if(_[_0x766c('0x7d')](_0x34ca8c[_0x766c('0x34')][_0x766c('0x63')])){for(var _0x1057ac=0x0;_0x1057ac<_0x34ca8c[_0x766c('0x34')]['ids'][_0x766c('0x3a')];_0x1057ac+=0x1){socket[_0x766c('0x76')]('userTeam:remove',{'UserId':Number(_0x34ca8c['query'][_0x766c('0x63')][_0x1057ac]),'TeamId':Number(_0x34ca8c[_0x766c('0x48')]['id'])});}}else{socket[_0x766c('0x76')](_0x766c('0x7e'),{'UserId':Number(_0x34ca8c[_0x766c('0x34')]['ids']),'TeamId':Number(_0x34ca8c[_0x766c('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x594b68,null))[_0x766c('0x54')](handleError(_0x594b68,null));};exports[_0x766c('0x7f')]=function(_0x3cc406,_0x462f17,_0x1ea44d){var _0x297d40={};var _0x5c941c={};var _0x3635a5;var _0x4f6b0e;return db[_0x766c('0x2f')][_0x766c('0x57')]({'where':{'id':_0x3cc406[_0x766c('0x48')]['id']}})[_0x766c('0x24')](handleEntityNotFound(_0x462f17,null))['then'](function(_0x141eef){if(_0x141eef){_0x3635a5=_0x141eef;_0x5c941c[_0x766c('0x33')]=_[_0x766c('0x35')](db['User'][_0x766c('0x30')]);_0x5c941c[_0x766c('0x34')]=_[_0x766c('0x35')](_0x3cc406['query']);_0x5c941c[_0x766c('0x36')]=_[_0x766c('0x37')](_0x5c941c[_0x766c('0x33')],_0x5c941c[_0x766c('0x34')]);_0x297d40[_0x766c('0x39')]=_['intersection'](_0x5c941c['model'],qs['fields'](_0x3cc406[_0x766c('0x34')][_0x766c('0x38')]));_0x297d40[_0x766c('0x39')]=_0x297d40['attributes']['length']?_0x297d40[_0x766c('0x39')]:_0x5c941c[_0x766c('0x33')];_0x297d40[_0x766c('0x3e')]=qs[_0x766c('0x3f')](_0x3cc406['query']['sort']);_0x297d40[_0x766c('0x42')]=qs[_0x766c('0x36')](_[_0x766c('0x40')](_0x3cc406['query'],_0x5c941c[_0x766c('0x36')]));if(_0x3cc406[_0x766c('0x34')][_0x766c('0x41')]){_0x297d40[_0x766c('0x42')]=_[_0x766c('0x43')](_0x297d40['where'],{'$or':_[_0x766c('0x2e')](_0x297d40[_0x766c('0x39')],function(_0x4972d9){var _0x1e80e1={};_0x1e80e1[_0x4972d9]={'$like':'%'+_0x3cc406['query'][_0x766c('0x41')]+'%'};return _0x1e80e1;})});}_0x297d40=_['merge']({},_0x297d40,_0x3cc406[_0x766c('0x45')]);return _0x3635a5[_0x766c('0x7f')](_0x297d40);}})['then'](function(_0x1f0123){if(_0x1f0123){_0x4f6b0e=_0x1f0123[_0x766c('0x3a')];if(!_0x3cc406[_0x766c('0x34')]['hasOwnProperty'](_0x766c('0x3c'))){_0x297d40[_0x766c('0x3d')]=qs['limit'](_0x3cc406[_0x766c('0x34')][_0x766c('0x3d')]);_0x297d40[_0x766c('0x1e')]=qs[_0x766c('0x1e')](_0x3cc406[_0x766c('0x34')]['offset']);}return _0x3635a5[_0x766c('0x7f')](_0x297d40);}})['then'](function(_0x2b6bb2){if(_0x2b6bb2){return _0x2b6bb2?{'count':_0x4f6b0e,'rows':_0x2b6bb2}:null;}})[_0x766c('0x24')](respondWithResult(_0x462f17,null))[_0x766c('0x54')](handleError(_0x462f17,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 266f369..fa01f2a 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 _0x95e0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x28f1c9,_0x24934e){var _0x36567d=function(_0x1404bb){while(--_0x1404bb){_0x28f1c9['push'](_0x28f1c9['shift']());}};_0x36567d(++_0x24934e);}(_0x95e0,0xa6));var _0x095e=function(_0xca355e,_0x414d18){_0xca355e=_0xca355e-0x0;var _0x35114d=_0x95e0[_0xca355e];return _0x35114d;};'use strict';var EventEmitter=require(_0x095e('0x0'));var Team=require(_0x095e('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x095e('0x2'),'afterUpdate':_0x095e('0x3'),'afterDestroy':_0x095e('0x4')};function emitEvent(_0x44e198){return function(_0x534f35,_0x3d1657,_0x170627){TeamEvents[_0x095e('0x5')](_0x44e198+':'+_0x534f35['id'],_0x534f35);TeamEvents[_0x095e('0x5')](_0x44e198,_0x534f35);_0x170627(null);};}for(var e in events){if(events[_0x095e('0x6')](e)){var event=events[e];Team[_0x095e('0x7')](e,emitEvent(event));}}module[_0x095e('0x8')]=TeamEvents; \ No newline at end of file +var _0x4eeb=['emit','exports','events','Team','save','update','remove'];(function(_0x3e275a,_0x5003c5){var _0x5b1db6=function(_0x4f22ff){while(--_0x4f22ff){_0x3e275a['push'](_0x3e275a['shift']());}};_0x5b1db6(++_0x5003c5);}(_0x4eeb,0xfe));var _0xb4ee=function(_0xec1513,_0x2486f5){_0xec1513=_0xec1513-0x0;var _0x110167=_0x4eeb[_0xec1513];return _0x110167;};'use strict';var EventEmitter=require(_0xb4ee('0x0'));var Team=require('../../mysqldb')['db'][_0xb4ee('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb4ee('0x2'),'afterUpdate':_0xb4ee('0x3'),'afterDestroy':_0xb4ee('0x4')};function emitEvent(_0x1bdf07){return function(_0x5b14d5,_0x467089,_0xd434b3){TeamEvents['emit'](_0x1bdf07+':'+_0x5b14d5['id'],_0x5b14d5);TeamEvents[_0xb4ee('0x5')](_0x1bdf07,_0x5b14d5);_0xd434b3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xb4ee('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2b0c611..f5146e3 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 _0x518d=['define','lodash','util','moment','request-promise','path','./team.attributes','exports'];(function(_0x4b83f9,_0x5a8dc5){var _0x46c4d1=function(_0x2aeb1f){while(--_0x2aeb1f){_0x4b83f9['push'](_0x4b83f9['shift']());}};_0x46c4d1(++_0x5a8dc5);}(_0x518d,0x141));var _0xd518=function(_0x2d7892,_0x41e176){_0x2d7892=_0x2d7892-0x0;var _0x8ad21c=_0x518d[_0x2d7892];return _0x8ad21c;};'use strict';var _=require(_0xd518('0x0'));var util=require(_0xd518('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd518('0x2'));var BPromise=require('bluebird');var rp=require(_0xd518('0x3'));var fs=require('fs');var path=require(_0xd518('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd518('0x5'));module[_0xd518('0x6')]=function(_0x19c1e2,_0x40627c){return _0x19c1e2[_0xd518('0x7')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8031=['define','Team','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports'];(function(_0x47a8c8,_0x3e16ec){var _0x92b07d=function(_0x38324c){while(--_0x38324c){_0x47a8c8['push'](_0x47a8c8['shift']());}};_0x92b07d(++_0x3e16ec);}(_0x8031,0xc5));var _0x1803=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x8031[_0x172747];return _0x509692;};'use strict';var _=require(_0x1803('0x0'));var util=require(_0x1803('0x1'));var logger=require('../../config/logger')(_0x1803('0x2'));var moment=require(_0x1803('0x3'));var BPromise=require(_0x1803('0x4'));var rp=require(_0x1803('0x5'));var fs=require('fs');var path=require(_0x1803('0x6'));var rimraf=require(_0x1803('0x7'));var config=require(_0x1803('0x8'));var attributes=require(_0x1803('0x9'));module[_0x1803('0xa')]=function(_0x828a75,_0x3abe34){return _0x828a75[_0x1803('0xb')](_0x1803('0xc'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index def4542..bbd0571 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 _0x9462=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird'];(function(_0x108cdf,_0x4d7ad4){var _0x2ed007=function(_0x50f119){while(--_0x50f119){_0x108cdf['push'](_0x108cdf['shift']());}};_0x2ed007(++_0x4d7ad4);}(_0x9462,0x127));var _0x2946=function(_0x257dda,_0x3bbea5){_0x257dda=_0x257dda-0x0;var _0x3c77ab=_0x9462[_0x257dda];return _0x3c77ab;};'use strict';var _=require(_0x2946('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2946('0x1'));var rs=require(_0x2946('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2946('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2946('0x4'))(_0x2946('0x5'));var config=require(_0x2946('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2946('0x7')][_0x2946('0x8')]({'port':0x232a});config[_0x2946('0x9')]=_[_0x2946('0xa')](config[_0x2946('0x9')],{'host':_0x2946('0xb'),'port':0x18eb});var socket=require(_0x2946('0xc'))(new Redis(config[_0x2946('0x9')]));require(_0x2946('0xd'))[_0x2946('0xe')](socket);function respondWithRpcPromise(_0x518bd8,_0x10150c,_0x1c282e){return new BPromise(function(_0x583a5a,_0x2605a4){return client[_0x2946('0xf')](_0x518bd8,_0x1c282e)[_0x2946('0x10')](function(_0x4d7cf9){logger['info'](_0x2946('0x11'),_0x10150c,_0x2946('0x12'));logger[_0x2946('0x13')](_0x2946('0x14'),_0x10150c,_0x2946('0x12'),JSON[_0x2946('0x15')](_0x4d7cf9));if(_0x4d7cf9[_0x2946('0x16')]){if(_0x4d7cf9[_0x2946('0x16')][_0x2946('0x17')]===0x1f4){logger[_0x2946('0x16')](_0x2946('0x11'),_0x10150c,_0x4d7cf9[_0x2946('0x16')][_0x2946('0x18')]);return _0x2605a4(_0x4d7cf9[_0x2946('0x16')][_0x2946('0x18')]);}logger[_0x2946('0x16')](_0x2946('0x11'),_0x10150c,_0x4d7cf9[_0x2946('0x16')][_0x2946('0x18')]);return _0x583a5a(_0x4d7cf9[_0x2946('0x16')]['message']);}else{logger[_0x2946('0x19')]('Team,\x20%s,\x20%s',_0x10150c,_0x2946('0x12'));_0x583a5a(_0x4d7cf9['result']['message']);}})[_0x2946('0x1a')](function(_0x453bae){logger[_0x2946('0x16')]('Team,\x20%s,\x20%s',_0x10150c,_0x453bae);_0x2605a4(_0x453bae);});});} \ No newline at end of file +var _0x3313=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','request','then','info','debug','request\x20sent','error','Team,\x20%s,\x20%s'];(function(_0x12c9c7,_0x5882c3){var _0x27af58=function(_0x20670a){while(--_0x20670a){_0x12c9c7['push'](_0x12c9c7['shift']());}};_0x27af58(++_0x5882c3);}(_0x3313,0x1ac));var _0x3331=function(_0x10c6e2,_0x2c22da){_0x10c6e2=_0x10c6e2-0x0;var _0x3e6bd8=_0x3313[_0x10c6e2];return _0x3e6bd8;};'use strict';var _=require(_0x3331('0x0'));var util=require(_0x3331('0x1'));var moment=require(_0x3331('0x2'));var BPromise=require(_0x3331('0x3'));var rs=require(_0x3331('0x4'));var fs=require('fs');var Redis=require(_0x3331('0x5'));var db=require(_0x3331('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3331('0x7'))(_0x3331('0x8'));var config=require(_0x3331('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3331('0xa')][_0x3331('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3331('0xc'),'port':0x18eb});var socket=require(_0x3331('0xd'))(new Redis(config[_0x3331('0xe')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x398109,_0x4d7935,_0x45bf61){return new BPromise(function(_0x33b3c9,_0x1437ee){return client[_0x3331('0xf')](_0x398109,_0x45bf61)[_0x3331('0x10')](function(_0xabbd81){logger[_0x3331('0x11')]('Team,\x20%s,\x20%s',_0x4d7935,'request\x20sent');logger[_0x3331('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x4d7935,_0x3331('0x13'),JSON['stringify'](_0xabbd81));if(_0xabbd81[_0x3331('0x14')]){if(_0xabbd81['error']['code']===0x1f4){logger[_0x3331('0x14')](_0x3331('0x15'),_0x4d7935,_0xabbd81[_0x3331('0x14')][_0x3331('0x16')]);return _0x1437ee(_0xabbd81['error'][_0x3331('0x16')]);}logger['error'](_0x3331('0x15'),_0x4d7935,_0xabbd81['error'][_0x3331('0x16')]);return _0x33b3c9(_0xabbd81[_0x3331('0x14')][_0x3331('0x16')]);}else{logger[_0x3331('0x11')]('Team,\x20%s,\x20%s',_0x4d7935,_0x3331('0x13'));_0x33b3c9(_0xabbd81[_0x3331('0x17')]['message']);}})[_0x3331('0x18')](function(_0x351d84){logger['error']('Team,\x20%s,\x20%s',_0x4d7935,_0x351d84);_0x1437ee(_0x351d84);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5037dac..bbe2a51 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 _0x4672=['length','team:','./team.events','remove','update','emit','removeListener'];(function(_0x5852f3,_0x35dbb7){var _0x463142=function(_0x28c1eb){while(--_0x28c1eb){_0x5852f3['push'](_0x5852f3['shift']());}};_0x463142(++_0x35dbb7);}(_0x4672,0x18a));var _0x2467=function(_0xd71ff9,_0x36cd21){_0xd71ff9=_0xd71ff9-0x0;var _0x2834ef=_0x4672[_0xd71ff9];return _0x2834ef;};'use strict';var TeamEvents=require(_0x2467('0x0'));var events=['save',_0x2467('0x1'),_0x2467('0x2')];function createListener(_0x57972f,_0x3d4246){return function(_0x56aa2b){_0x3d4246[_0x2467('0x3')](_0x57972f,_0x56aa2b);};}function removeListener(_0x228e2f,_0x1368f7){return function(){TeamEvents[_0x2467('0x4')](_0x228e2f,_0x1368f7);};}exports['register']=function(_0x19e085){for(var _0x48674e=0x0,_0x741c4d=events[_0x2467('0x5')];_0x48674e<_0x741c4d;_0x48674e++){var _0x1e91f3=events[_0x48674e];var _0x19e43a=createListener(_0x2467('0x6')+_0x1e91f3,_0x19e085);TeamEvents['on'](_0x1e91f3,_0x19e43a);}}; \ No newline at end of file +var _0xa46e=['./team.events','save','update','emit','register','team:'];(function(_0x426df2,_0x1df2dd){var _0x5ab5bd=function(_0x173abd){while(--_0x173abd){_0x426df2['push'](_0x426df2['shift']());}};_0x5ab5bd(++_0x1df2dd);}(_0xa46e,0x8a));var _0xea46=function(_0x2f0057,_0x448b27){_0x2f0057=_0x2f0057-0x0;var _0x17f2c3=_0xa46e[_0x2f0057];return _0x17f2c3;};'use strict';var TeamEvents=require(_0xea46('0x0'));var events=[_0xea46('0x1'),'remove',_0xea46('0x2')];function createListener(_0x2f69cc,_0x12deba){return function(_0x4cc9a2){_0x12deba[_0xea46('0x3')](_0x2f69cc,_0x4cc9a2);};}function removeListener(_0x4b6e4a,_0x3a2209){return function(){TeamEvents['removeListener'](_0x4b6e4a,_0x3a2209);};}exports[_0xea46('0x4')]=function(_0x528404){for(var _0x10bee5=0x0,_0x3dc26f=events['length'];_0x10bee5<_0x3dc26f;_0x10bee5++){var _0x2d1b30=events[_0x10bee5];var _0x42771a=createListener(_0xea46('0x5')+_0x2d1b30,_0x528404);TeamEvents['on'](_0x2d1b30,_0x42771a);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8703c1f..7b2f456 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 _0x6aef=['get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x1e9980,_0x37fd4c){var _0x5921b8=function(_0x1c07b8){while(--_0x1c07b8){_0x1e9980['push'](_0x1e9980['shift']());}};_0x5921b8(++_0x37fd4c);}(_0x6aef,0x65));var _0xf6ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aef[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xf6ae('0x0'));var path=require('path');var timeout=require(_0xf6ae('0x1'));var express=require(_0xf6ae('0x2'));var router=express['Router']();var auth=require(_0xf6ae('0x3'));var interaction=require(_0xf6ae('0x4'));var config=require(_0xf6ae('0x5'));var controller=require(_0xf6ae('0x6'));router[_0xf6ae('0x7')]('/',auth[_0xf6ae('0x8')](),controller[_0xf6ae('0x9')]);router[_0xf6ae('0x7')](_0xf6ae('0xa'),auth[_0xf6ae('0x8')](),controller[_0xf6ae('0xb')]);router[_0xf6ae('0xc')]('/',auth[_0xf6ae('0x8')](),controller['create']);router[_0xf6ae('0xd')]('/:id',auth[_0xf6ae('0x8')](),controller[_0xf6ae('0xe')]);router[_0xf6ae('0xf')](_0xf6ae('0xa'),auth[_0xf6ae('0x8')](),controller[_0xf6ae('0x10')]);module[_0xf6ae('0x11')]=router; \ No newline at end of file +var _0x9e12=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4621c7,_0x3258dd){var _0xeb2801=function(_0x486494){while(--_0x486494){_0x4621c7['push'](_0x4621c7['shift']());}};_0xeb2801(++_0x3258dd);}(_0x9e12,0x14a));var _0x29e1=function(_0x214915,_0x57669b){_0x214915=_0x214915-0x0;var _0xad30f9=_0x9e12[_0x214915];return _0xad30f9;};'use strict';var multer=require(_0x29e1('0x0'));var util=require(_0x29e1('0x1'));var path=require(_0x29e1('0x2'));var timeout=require(_0x29e1('0x3'));var express=require(_0x29e1('0x4'));var router=express[_0x29e1('0x5')]();var auth=require(_0x29e1('0x6'));var interaction=require(_0x29e1('0x7'));var config=require(_0x29e1('0x8'));var controller=require('./template.controller');router[_0x29e1('0x9')]('/',auth[_0x29e1('0xa')](),controller['index']);router[_0x29e1('0x9')]('/:id',auth[_0x29e1('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x29e1('0xb')]);router[_0x29e1('0xc')](_0x29e1('0xd'),auth[_0x29e1('0xa')](),controller['update']);router['delete'](_0x29e1('0xd'),auth['isAuthenticated'](),controller[_0x29e1('0xe')]);module[_0x29e1('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 9655c35..f8384cb 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 _0xa957=['exports','STRING','TEXT'];(function(_0x480470,_0x36f644){var _0x4360a0=function(_0x32a63f){while(--_0x32a63f){_0x480470['push'](_0x480470['shift']());}};_0x4360a0(++_0x36f644);}(_0xa957,0x111));var _0x7a95=function(_0x25681c,_0x34ec93){_0x25681c=_0x25681c-0x0;var _0x383a4a=_0xa957[_0x25681c];return _0x383a4a;};'use strict';var Sequelize=require('sequelize');module[_0x7a95('0x0')]={'name':{'type':Sequelize[_0x7a95('0x1')]},'description':{'type':Sequelize[_0x7a95('0x1')]},'html':{'type':Sequelize[_0x7a95('0x2')]}}; \ No newline at end of file +var _0x5b2a=['sequelize','exports','STRING','TEXT'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x5b2a,0x124));var _0xa5b2=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x5b2a[_0x50bf5a];return _0x4ddc1d;};'use strict';var Sequelize=require(_0xa5b2('0x0'));module[_0xa5b2('0x1')]={'name':{'type':Sequelize[_0xa5b2('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xa5b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 324c427..339e6ab 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 _0x0c40=['Content-Range','apply','save','update','then','destroy','Templates','UserProfileResource','error','stack','name','send','index','map','Template','type','model','query','intersection','attributes','fields','nolimit','limit','order','sort','filters','pick','filter','merge','VIRTUAL','where','findAll','catch','show','keys','rawAttributes','includeAll','include','body','user','get','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','end','status','count','offset'];(function(_0x511e52,_0x3990f0){var _0x168590=function(_0x4fa1b2){while(--_0x4fa1b2){_0x511e52['push'](_0x511e52['shift']());}};_0x168590(++_0x3990f0);}(_0x0c40,0x10e));var _0x00c4=function(_0x48ecd2,_0x481ad3){_0x48ecd2=_0x48ecd2-0x0;var _0x5a4457=_0x0c40[_0x48ecd2];return _0x5a4457;};'use strict';var pdf=require(_0x00c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x00c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00c4('0x2'));var rp=require(_0x00c4('0x3'));var moment=require(_0x00c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x00c4('0x5'));var util=require(_0x00c4('0x6'));var path=require('path');var sox=require(_0x00c4('0x7'));var csv=require(_0x00c4('0x8'));var ejs=require(_0x00c4('0x9'));var fs=require('fs');var _=require(_0x00c4('0xa'));var squel=require(_0x00c4('0xb'));var crypto=require(_0x00c4('0xc'));var jsforce=require(_0x00c4('0xd'));var deskjs=require(_0x00c4('0xe'));var toCsv=require(_0x00c4('0x8'));var querystring=require('querystring');var Papa=require(_0x00c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x00c4('0x10'));var as=require(_0x00c4('0x11'));var hardwareService=require(_0x00c4('0x12'));var logger=require('../../config/logger')(_0x00c4('0x13'));var utils=require(_0x00c4('0x14'));var config=require(_0x00c4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cc0b8,_0x13c407){_0x13c407=_0x13c407||0xcc;return function(_0x113bd1){if(_0x113bd1){return _0x1cc0b8['sendStatus'](_0x13c407);}return _0x1cc0b8['status'](_0x13c407)[_0x00c4('0x16')]();};}function respondWithResult(_0x478ecb,_0x4172c3){_0x4172c3=_0x4172c3||0xc8;return function(_0x2c24b3){if(_0x2c24b3){return _0x478ecb[_0x00c4('0x17')](_0x4172c3)['json'](_0x2c24b3);}};}function respondWithFilteredResult(_0x3f1343,_0x3e9c1e){return function(_0x145b69){if(_0x145b69){var _0x2b73cc=_0x145b69[_0x00c4('0x18')],_0x2376b3=_0x3e9c1e[_0x00c4('0x19')],_0x254c99=_0x3e9c1e[_0x00c4('0x19')]+_0x3e9c1e['limit'],_0x27757d;if(_0x254c99>=_0x2b73cc){_0x254c99=_0x2b73cc;_0x27757d=0xc8;}else{_0x27757d=0xce;}_0x3f1343[_0x00c4('0x17')](_0x27757d);return _0x3f1343['set'](_0x00c4('0x1a'),_0x2376b3+'-'+_0x254c99+'/'+_0x2b73cc)['json'](_0x145b69);}return null;};}function patchUpdates(_0x48183f){return function(_0x446dc5){try{jsonpatch[_0x00c4('0x1b')](_0x446dc5,_0x48183f,!![]);}catch(_0x5c7c93){return BPromise['reject'](_0x5c7c93);}return _0x446dc5[_0x00c4('0x1c')]();};}function saveUpdates(_0x5c900f,_0x5cb7e9){return function(_0x160b18){if(_0x160b18){return _0x160b18[_0x00c4('0x1d')](_0x5c900f)[_0x00c4('0x1e')](function(_0x557307){return _0x557307;});}return null;};}function removeEntity(_0x11536e,_0x4933e0){return function(_0x380a1e){if(_0x380a1e){return _0x380a1e[_0x00c4('0x1f')]()['then'](function(){var _0x1e8862=_0x380a1e['get']({'plain':!![]});var _0xf0a9a4=_0x00c4('0x20');return db[_0x00c4('0x21')][_0x00c4('0x1f')]({'where':{'type':_0xf0a9a4,'resourceId':_0x1e8862['id']}})[_0x00c4('0x1e')](function(){return _0x380a1e;});})[_0x00c4('0x1e')](function(){_0x11536e[_0x00c4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16fe78,_0x38b0c9){return function(_0x127018){if(!_0x127018){_0x16fe78['sendStatus'](0x194);}return _0x127018;};}function handleError(_0x2bddee,_0x1be000){_0x1be000=_0x1be000||0x1f4;return function(_0x4c6120){logger[_0x00c4('0x22')](_0x4c6120[_0x00c4('0x23')]);if(_0x4c6120[_0x00c4('0x24')]){delete _0x4c6120['name'];}_0x2bddee[_0x00c4('0x17')](_0x1be000)[_0x00c4('0x25')](_0x4c6120);};}exports[_0x00c4('0x26')]=function(_0x148f67,_0x248a3b){var _0x16a160={},_0x46e98b={},_0x2d65db={'count':0x0,'rows':[]};var _0x39b629=_[_0x00c4('0x27')](db[_0x00c4('0x28')]['rawAttributes'],function(_0x40e8c1){return{'name':_0x40e8c1['fieldName'],'type':_0x40e8c1[_0x00c4('0x29')]['key']};});_0x46e98b[_0x00c4('0x2a')]=_['map'](_0x39b629,_0x00c4('0x24'));_0x46e98b['query']=_['keys'](_0x148f67[_0x00c4('0x2b')]);_0x46e98b['filters']=_[_0x00c4('0x2c')](_0x46e98b[_0x00c4('0x2a')],_0x46e98b[_0x00c4('0x2b')]);_0x16a160[_0x00c4('0x2d')]=_[_0x00c4('0x2c')](_0x46e98b['model'],qs[_0x00c4('0x2e')](_0x148f67[_0x00c4('0x2b')][_0x00c4('0x2e')]));_0x16a160['attributes']=_0x16a160[_0x00c4('0x2d')]['length']?_0x16a160['attributes']:_0x46e98b[_0x00c4('0x2a')];if(!_0x148f67[_0x00c4('0x2b')]['hasOwnProperty'](_0x00c4('0x2f'))){_0x16a160[_0x00c4('0x30')]=qs['limit'](_0x148f67[_0x00c4('0x2b')][_0x00c4('0x30')]);_0x16a160[_0x00c4('0x19')]=qs[_0x00c4('0x19')](_0x148f67[_0x00c4('0x2b')][_0x00c4('0x19')]);}_0x16a160[_0x00c4('0x31')]=qs[_0x00c4('0x32')](_0x148f67['query']['sort']);_0x16a160['where']=qs[_0x00c4('0x33')](_[_0x00c4('0x34')](_0x148f67['query'],_0x46e98b[_0x00c4('0x33')]),_0x39b629);if(_0x148f67[_0x00c4('0x2b')][_0x00c4('0x35')]){_0x16a160['where']=_[_0x00c4('0x36')](_0x16a160['where'],{'$or':_[_0x00c4('0x27')](_0x39b629,function(_0x18bd19){if(_0x18bd19[_0x00c4('0x29')]!==_0x00c4('0x37')){var _0x290b51={};_0x290b51[_0x18bd19[_0x00c4('0x24')]]={'$like':'%'+_0x148f67[_0x00c4('0x2b')][_0x00c4('0x35')]+'%'};return _0x290b51;}})});}_0x16a160=_['merge']({},_0x16a160,_0x148f67['options']);var _0x2737bc={'where':_0x16a160[_0x00c4('0x38')]};return db[_0x00c4('0x28')][_0x00c4('0x18')](_0x2737bc)['then'](function(_0x1fa3e0){_0x2d65db[_0x00c4('0x18')]=_0x1fa3e0;if(_0x148f67[_0x00c4('0x2b')]['includeAll']){_0x16a160['include']=[{'all':!![]}];}return db['Template'][_0x00c4('0x39')](_0x16a160);})[_0x00c4('0x1e')](function(_0x1a97ab){_0x2d65db['rows']=_0x1a97ab;return _0x2d65db;})['then'](respondWithFilteredResult(_0x248a3b,_0x16a160))[_0x00c4('0x3a')](handleError(_0x248a3b,null));};exports[_0x00c4('0x3b')]=function(_0x132da2,_0x3bdbfb){var _0xa69629={'raw':!![],'where':{'id':_0x132da2['params']['id']}},_0x6ff7d3={};_0x6ff7d3['model']=_[_0x00c4('0x3c')](db[_0x00c4('0x28')][_0x00c4('0x3d')]);_0x6ff7d3['query']=_[_0x00c4('0x3c')](_0x132da2[_0x00c4('0x2b')]);_0x6ff7d3[_0x00c4('0x33')]=_['intersection'](_0x6ff7d3[_0x00c4('0x2a')],_0x6ff7d3[_0x00c4('0x2b')]);_0xa69629[_0x00c4('0x2d')]=_['intersection'](_0x6ff7d3[_0x00c4('0x2a')],qs[_0x00c4('0x2e')](_0x132da2[_0x00c4('0x2b')]['fields']));_0xa69629[_0x00c4('0x2d')]=_0xa69629['attributes']['length']?_0xa69629[_0x00c4('0x2d')]:_0x6ff7d3['model'];if(_0x132da2[_0x00c4('0x2b')][_0x00c4('0x3e')]){_0xa69629[_0x00c4('0x3f')]=[{'all':!![]}];}_0xa69629=_[_0x00c4('0x36')]({},_0xa69629,_0x132da2['options']);return db['Template']['find'](_0xa69629)[_0x00c4('0x1e')](handleEntityNotFound(_0x3bdbfb,null))[_0x00c4('0x1e')](respondWithResult(_0x3bdbfb,null))['catch'](handleError(_0x3bdbfb,null));};exports['create']=function(_0x493400,_0x1f7b7b){return db['Template']['create'](_0x493400[_0x00c4('0x40')],{})[_0x00c4('0x1e')](function(_0x363d82){var _0x1676c8=_0x493400[_0x00c4('0x41')]['get']({'plain':!![]});if(!_0x1676c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1676c8['role']===_0x00c4('0x41')){var _0x2f7761=_0x363d82[_0x00c4('0x42')]({'plain':!![]});var _0x58a295='Templates';return db[_0x00c4('0x43')]['find']({'where':{'name':_0x58a295,'userProfileId':_0x1676c8[_0x00c4('0x44')]},'raw':!![]})['then'](function(_0x54c81b){if(_0x54c81b&&_0x54c81b[_0x00c4('0x45')]===0x0){return db[_0x00c4('0x21')][_0x00c4('0x46')]({'name':_0x2f7761['name'],'resourceId':_0x2f7761['id'],'type':_0x54c81b[_0x00c4('0x24')],'sectionId':_0x54c81b['id']},{})[_0x00c4('0x1e')](function(){return _0x363d82;});}else{return _0x363d82;}})[_0x00c4('0x3a')](function(_0x20a235){logger[_0x00c4('0x22')](_0x00c4('0x47'),_0x20a235);throw _0x20a235;});}return _0x363d82;})['then'](respondWithResult(_0x1f7b7b,0xc9))['catch'](handleError(_0x1f7b7b,null));};exports[_0x00c4('0x1d')]=function(_0x5cd19b,_0xab4b13){if(_0x5cd19b[_0x00c4('0x40')]['id']){delete _0x5cd19b[_0x00c4('0x40')]['id'];}return db[_0x00c4('0x28')][_0x00c4('0x48')]({'where':{'id':_0x5cd19b[_0x00c4('0x49')]['id']}})[_0x00c4('0x1e')](handleEntityNotFound(_0xab4b13,null))[_0x00c4('0x1e')](saveUpdates(_0x5cd19b[_0x00c4('0x40')],null))[_0x00c4('0x1e')](respondWithResult(_0xab4b13,null))[_0x00c4('0x3a')](handleError(_0xab4b13,null));};exports[_0x00c4('0x1f')]=function(_0x1e5ec2,_0x16c133){return db[_0x00c4('0x28')]['find']({'where':{'id':_0x1e5ec2[_0x00c4('0x49')]['id']}})[_0x00c4('0x1e')](handleEntityNotFound(_0x16c133,null))[_0x00c4('0x1e')](removeEntity(_0x16c133,null))[_0x00c4('0x3a')](handleError(_0x16c133,null));}; \ No newline at end of file +var _0x952a=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','name','send','index','Template','rawAttributes','fieldName','model','keys','query','filters','intersection'];(function(_0x86d76f,_0x198b26){var _0x332d3d=function(_0x49785e){while(--_0x49785e){_0x86d76f['push'](_0x86d76f['shift']());}};_0x332d3d(++_0x198b26);}(_0x952a,0x16d));var _0xa952=function(_0x45ac27,_0x3d634a){_0x45ac27=_0x45ac27-0x0;var _0x1577aa=_0x952a[_0x45ac27];return _0x1577aa;};'use strict';var pdf=require(_0xa952('0x0'));var emlformat=require(_0xa952('0x1'));var rimraf=require(_0xa952('0x2'));var zipdir=require(_0xa952('0x3'));var jsonpatch=require(_0xa952('0x4'));var rp=require(_0xa952('0x5'));var moment=require(_0xa952('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa952('0x7'));var util=require(_0xa952('0x8'));var path=require(_0xa952('0x9'));var sox=require('sox');var csv=require(_0xa952('0xa'));var ejs=require(_0xa952('0xb'));var fs=require('fs');var _=require(_0xa952('0xc'));var squel=require(_0xa952('0xd'));var crypto=require(_0xa952('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa952('0xf'));var toCsv=require(_0xa952('0xa'));var querystring=require(_0xa952('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa952('0x11'));var qs=require(_0xa952('0x12'));var as=require(_0xa952('0x13'));var hardwareService=require(_0xa952('0x14'));var logger=require(_0xa952('0x15'))(_0xa952('0x16'));var utils=require(_0xa952('0x17'));var config=require(_0xa952('0x18'));var db=require(_0xa952('0x19'))['db'];function respondWithStatusCode(_0x1d7c4c,_0x3033a3){_0x3033a3=_0x3033a3||0xcc;return function(_0xb5c8b1){if(_0xb5c8b1){return _0x1d7c4c[_0xa952('0x1a')](_0x3033a3);}return _0x1d7c4c['status'](_0x3033a3)[_0xa952('0x1b')]();};}function respondWithResult(_0x3c8f7c,_0x11c7d2){_0x11c7d2=_0x11c7d2||0xc8;return function(_0x30211e){if(_0x30211e){return _0x3c8f7c[_0xa952('0x1c')](_0x11c7d2)['json'](_0x30211e);}};}function respondWithFilteredResult(_0x295c35,_0x4a0177){return function(_0x54ddf2){if(_0x54ddf2){var _0x49a8c0=_0x54ddf2[_0xa952('0x1d')],_0x236c69=_0x4a0177[_0xa952('0x1e')],_0x117bee=_0x4a0177[_0xa952('0x1e')]+_0x4a0177[_0xa952('0x1f')],_0x369db1;if(_0x117bee>=_0x49a8c0){_0x117bee=_0x49a8c0;_0x369db1=0xc8;}else{_0x369db1=0xce;}_0x295c35['status'](_0x369db1);return _0x295c35['set'](_0xa952('0x20'),_0x236c69+'-'+_0x117bee+'/'+_0x49a8c0)[_0xa952('0x21')](_0x54ddf2);}return null;};}function patchUpdates(_0x52c9ee){return function(_0x2f8d6e){try{jsonpatch[_0xa952('0x22')](_0x2f8d6e,_0x52c9ee,!![]);}catch(_0x416a21){return BPromise[_0xa952('0x23')](_0x416a21);}return _0x2f8d6e[_0xa952('0x24')]();};}function saveUpdates(_0x477184,_0x28033d){return function(_0x33ef7c){if(_0x33ef7c){return _0x33ef7c[_0xa952('0x25')](_0x477184)[_0xa952('0x26')](function(_0x33ef08){return _0x33ef08;});}return null;};}function removeEntity(_0x384531,_0xf4dcc0){return function(_0x4355bc){if(_0x4355bc){return _0x4355bc[_0xa952('0x27')]()[_0xa952('0x26')](function(){var _0x241eff=_0x4355bc[_0xa952('0x28')]({'plain':!![]});var _0x5a8f45=_0xa952('0x29');return db[_0xa952('0x2a')][_0xa952('0x27')]({'where':{'type':_0x5a8f45,'resourceId':_0x241eff['id']}})['then'](function(){return _0x4355bc;});})[_0xa952('0x26')](function(){_0x384531[_0xa952('0x1c')](0xcc)[_0xa952('0x1b')]();});}};}function handleEntityNotFound(_0x41947e,_0x1d3906){return function(_0x2e5b69){if(!_0x2e5b69){_0x41947e['sendStatus'](0x194);}return _0x2e5b69;};}function handleError(_0x16ed4f,_0x3ffae8){_0x3ffae8=_0x3ffae8||0x1f4;return function(_0x37b012){logger[_0xa952('0x2b')](_0x37b012['stack']);if(_0x37b012[_0xa952('0x2c')]){delete _0x37b012[_0xa952('0x2c')];}_0x16ed4f['status'](_0x3ffae8)[_0xa952('0x2d')](_0x37b012);};}exports[_0xa952('0x2e')]=function(_0x2a7877,_0x540a68){var _0x1d1f1d={},_0x1fef67={},_0xa6e07b={'count':0x0,'rows':[]};var _0x25a017=_['map'](db[_0xa952('0x2f')][_0xa952('0x30')],function(_0x3da2c7){return{'name':_0x3da2c7[_0xa952('0x31')],'type':_0x3da2c7['type']['key']};});_0x1fef67[_0xa952('0x32')]=_['map'](_0x25a017,_0xa952('0x2c'));_0x1fef67['query']=_[_0xa952('0x33')](_0x2a7877[_0xa952('0x34')]);_0x1fef67[_0xa952('0x35')]=_[_0xa952('0x36')](_0x1fef67[_0xa952('0x32')],_0x1fef67['query']);_0x1d1f1d[_0xa952('0x37')]=_[_0xa952('0x36')](_0x1fef67[_0xa952('0x32')],qs[_0xa952('0x38')](_0x2a7877[_0xa952('0x34')][_0xa952('0x38')]));_0x1d1f1d[_0xa952('0x37')]=_0x1d1f1d[_0xa952('0x37')][_0xa952('0x39')]?_0x1d1f1d[_0xa952('0x37')]:_0x1fef67[_0xa952('0x32')];if(!_0x2a7877[_0xa952('0x34')][_0xa952('0x3a')](_0xa952('0x3b'))){_0x1d1f1d[_0xa952('0x1f')]=qs[_0xa952('0x1f')](_0x2a7877[_0xa952('0x34')][_0xa952('0x1f')]);_0x1d1f1d[_0xa952('0x1e')]=qs[_0xa952('0x1e')](_0x2a7877[_0xa952('0x34')][_0xa952('0x1e')]);}_0x1d1f1d[_0xa952('0x3c')]=qs['sort'](_0x2a7877['query'][_0xa952('0x3d')]);_0x1d1f1d[_0xa952('0x3e')]=qs['filters'](_[_0xa952('0x3f')](_0x2a7877[_0xa952('0x34')],_0x1fef67[_0xa952('0x35')]),_0x25a017);if(_0x2a7877[_0xa952('0x34')][_0xa952('0x40')]){_0x1d1f1d['where']=_[_0xa952('0x41')](_0x1d1f1d['where'],{'$or':_[_0xa952('0x42')](_0x25a017,function(_0x475011){if(_0x475011[_0xa952('0x43')]!==_0xa952('0x44')){var _0x1054a6={};_0x1054a6[_0x475011['name']]={'$like':'%'+_0x2a7877[_0xa952('0x34')][_0xa952('0x40')]+'%'};return _0x1054a6;}})});}_0x1d1f1d=_[_0xa952('0x41')]({},_0x1d1f1d,_0x2a7877[_0xa952('0x45')]);var _0x2a99bf={'where':_0x1d1f1d[_0xa952('0x3e')]};return db[_0xa952('0x2f')][_0xa952('0x1d')](_0x2a99bf)[_0xa952('0x26')](function(_0x157f1e){_0xa6e07b[_0xa952('0x1d')]=_0x157f1e;if(_0x2a7877[_0xa952('0x34')]['includeAll']){_0x1d1f1d[_0xa952('0x46')]=[{'all':!![]}];}return db[_0xa952('0x2f')][_0xa952('0x47')](_0x1d1f1d);})[_0xa952('0x26')](function(_0x45573d){_0xa6e07b[_0xa952('0x48')]=_0x45573d;return _0xa6e07b;})['then'](respondWithFilteredResult(_0x540a68,_0x1d1f1d))[_0xa952('0x49')](handleError(_0x540a68,null));};exports['show']=function(_0x5763ef,_0x773bfb){var _0x1e739e={'raw':!![],'where':{'id':_0x5763ef[_0xa952('0x4a')]['id']}},_0x11fae7={};_0x11fae7[_0xa952('0x32')]=_[_0xa952('0x33')](db['Template'][_0xa952('0x30')]);_0x11fae7['query']=_[_0xa952('0x33')](_0x5763ef[_0xa952('0x34')]);_0x11fae7['filters']=_[_0xa952('0x36')](_0x11fae7[_0xa952('0x32')],_0x11fae7[_0xa952('0x34')]);_0x1e739e[_0xa952('0x37')]=_[_0xa952('0x36')](_0x11fae7['model'],qs['fields'](_0x5763ef['query'][_0xa952('0x38')]));_0x1e739e['attributes']=_0x1e739e[_0xa952('0x37')][_0xa952('0x39')]?_0x1e739e['attributes']:_0x11fae7[_0xa952('0x32')];if(_0x5763ef[_0xa952('0x34')][_0xa952('0x4b')]){_0x1e739e[_0xa952('0x46')]=[{'all':!![]}];}_0x1e739e=_[_0xa952('0x41')]({},_0x1e739e,_0x5763ef[_0xa952('0x45')]);return db[_0xa952('0x2f')][_0xa952('0x4c')](_0x1e739e)[_0xa952('0x26')](handleEntityNotFound(_0x773bfb,null))['then'](respondWithResult(_0x773bfb,null))[_0xa952('0x49')](handleError(_0x773bfb,null));};exports['create']=function(_0x596109,_0x2bf993){return db[_0xa952('0x2f')][_0xa952('0x4d')](_0x596109['body'],{})['then'](function(_0xecb7d5){var _0x28bdcc=_0x596109[_0xa952('0x4e')][_0xa952('0x28')]({'plain':!![]});if(!_0x28bdcc)throw new Error(_0xa952('0x4f'));if(_0x28bdcc[_0xa952('0x50')]===_0xa952('0x4e')){var _0x22baec=_0xecb7d5[_0xa952('0x28')]({'plain':!![]});var _0x424434=_0xa952('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x424434,'userProfileId':_0x28bdcc[_0xa952('0x51')]},'raw':!![]})[_0xa952('0x26')](function(_0x1893c9){if(_0x1893c9&&_0x1893c9['autoAssociation']===0x0){return db['UserProfileResource'][_0xa952('0x4d')]({'name':_0x22baec[_0xa952('0x2c')],'resourceId':_0x22baec['id'],'type':_0x1893c9[_0xa952('0x2c')],'sectionId':_0x1893c9['id']},{})[_0xa952('0x26')](function(){return _0xecb7d5;});}else{return _0xecb7d5;}})['catch'](function(_0x50fe9f){logger[_0xa952('0x2b')](_0xa952('0x52'),_0x50fe9f);throw _0x50fe9f;});}return _0xecb7d5;})[_0xa952('0x26')](respondWithResult(_0x2bf993,0xc9))[_0xa952('0x49')](handleError(_0x2bf993,null));};exports['update']=function(_0x687812,_0x9be3dd){if(_0x687812[_0xa952('0x53')]['id']){delete _0x687812[_0xa952('0x53')]['id'];}return db[_0xa952('0x2f')][_0xa952('0x4c')]({'where':{'id':_0x687812['params']['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x9be3dd,null))['then'](saveUpdates(_0x687812[_0xa952('0x53')],null))[_0xa952('0x26')](respondWithResult(_0x9be3dd,null))['catch'](handleError(_0x9be3dd,null));};exports[_0xa952('0x27')]=function(_0x2e024c,_0x3b45f2){return db[_0xa952('0x2f')][_0xa952('0x4c')]({'where':{'id':_0x2e024c[_0xa952('0x4a')]['id']}})[_0xa952('0x26')](handleEntityNotFound(_0x3b45f2,null))[_0xa952('0x26')](removeEntity(_0x3b45f2,null))['catch'](handleError(_0x3b45f2,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e126d88..302ac8d 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 _0xc748=['rimraf','./template.attributes','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3086e3,_0x42bab4){var _0x46369a=function(_0x17c8c6){while(--_0x17c8c6){_0x3086e3['push'](_0x3086e3['shift']());}};_0x46369a(++_0x42bab4);}(_0xc748,0x13a));var _0x8c74=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xc748[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require(_0x8c74('0x0'));var logger=require(_0x8c74('0x1'))(_0x8c74('0x2'));var moment=require(_0x8c74('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c74('0x4'));var fs=require('fs');var path=require(_0x8c74('0x5'));var rimraf=require(_0x8c74('0x6'));var config=require('../../config/environment');var attributes=require(_0x8c74('0x7'));module['exports']=function(_0x5ace59,_0x187800){return _0x5ace59['define']('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95eb=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x95eb,0x1cc));var _0xb95e=function(_0x3adf83,_0x41fd7e){_0x3adf83=_0x3adf83-0x0;var _0x4cb2be=_0x95eb[_0x3adf83];return _0x4cb2be;};'use strict';var _=require(_0xb95e('0x0'));var util=require(_0xb95e('0x1'));var logger=require(_0xb95e('0x2'))(_0xb95e('0x3'));var moment=require(_0xb95e('0x4'));var BPromise=require('bluebird');var rp=require(_0xb95e('0x5'));var fs=require('fs');var path=require(_0xb95e('0x6'));var rimraf=require(_0xb95e('0x7'));var config=require(_0xb95e('0x8'));var attributes=require(_0xb95e('0x9'));module[_0xb95e('0xa')]=function(_0x37fd7b,_0x2a95cc){return _0x37fd7b[_0xb95e('0xb')](_0xb95e('0xc'),attributes,{'tableName':_0xb95e('0xd'),'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 957617c..eb0955b 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 _0x7095=['error','Template,\x20%s,\x20%s','message','catch','options','include','map','model','attributes','info','GetTemplate','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7095,0xb3));var _0x5709=function(_0x22ae4f,_0x2837f6){_0x22ae4f=_0x22ae4f-0x0;var _0x27e200=_0x7095[_0x22ae4f];return _0x27e200;};'use strict';var _=require(_0x5709('0x0'));var util=require(_0x5709('0x1'));var moment=require('moment');var BPromise=require(_0x5709('0x2'));var rs=require(_0x5709('0x3'));var fs=require('fs');var Redis=require(_0x5709('0x4'));var db=require(_0x5709('0x5'))['db'];var utils=require(_0x5709('0x6'));var logger=require(_0x5709('0x7'))(_0x5709('0x8'));var config=require(_0x5709('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5709('0xa')][_0x5709('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfc627,_0x90e6c1,_0x56f635){return new BPromise(function(_0x24f551,_0x3ee5fb){return client[_0x5709('0xc')](_0xfc627,_0x56f635)[_0x5709('0xd')](function(_0x2fe3ba){logger['info']('Template,\x20%s,\x20%s',_0x90e6c1,_0x5709('0xe'));logger[_0x5709('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x90e6c1,'request\x20sent',JSON[_0x5709('0x10')](_0x2fe3ba));if(_0x2fe3ba[_0x5709('0x11')]){if(_0x2fe3ba['error']['code']===0x1f4){logger['error'](_0x5709('0x12'),_0x90e6c1,_0x2fe3ba['error'][_0x5709('0x13')]);return _0x3ee5fb(_0x2fe3ba[_0x5709('0x11')]['message']);}logger[_0x5709('0x11')](_0x5709('0x12'),_0x90e6c1,_0x2fe3ba[_0x5709('0x11')]['message']);return _0x24f551(_0x2fe3ba[_0x5709('0x11')][_0x5709('0x13')]);}else{logger['info'](_0x5709('0x12'),_0x90e6c1,_0x5709('0xe'));_0x24f551(_0x2fe3ba['result'][_0x5709('0x13')]);}})[_0x5709('0x14')](function(_0x453b54){logger[_0x5709('0x11')](_0x5709('0x12'),_0x90e6c1,_0x453b54);_0x3ee5fb(_0x453b54);});});}exports['GetTemplate']=function(_0x35d255){var _0x8b3974=this;return new Promise(function(_0x360493,_0x2d3eaa){return db['Template']['findAll']({'raw':_0x35d255[_0x5709('0x15')]?_0x35d255[_0x5709('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x35d255['options']?_0x35d255[_0x5709('0x15')]['where']||null:null,'attributes':_0x35d255[_0x5709('0x15')]?_0x35d255['options']['attributes']||null:null,'limit':_0x35d255[_0x5709('0x15')]?_0x35d255[_0x5709('0x15')]['limit']||null:null,'include':_0x35d255[_0x5709('0x15')]?_0x35d255['options'][_0x5709('0x16')]?_[_0x5709('0x17')](_0x35d255[_0x5709('0x15')][_0x5709('0x16')],function(_0x33f5bf){return{'model':db[_0x33f5bf[_0x5709('0x18')]],'as':_0x33f5bf['as'],'attributes':_0x33f5bf[_0x5709('0x19')],'include':_0x33f5bf[_0x5709('0x16')]?_[_0x5709('0x17')](_0x33f5bf[_0x5709('0x16')],function(_0x404296){return{'model':db[_0x404296['model']],'as':_0x404296['as'],'attributes':_0x404296[_0x5709('0x19')],'include':_0x404296['include']?_[_0x5709('0x17')](_0x404296[_0x5709('0x16')],function(_0x84fdd1){return{'model':db[_0x84fdd1[_0x5709('0x18')]],'as':_0x84fdd1['as'],'attributes':_0x84fdd1[_0x5709('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5709('0xd')](function(_0x1954f1){logger[_0x5709('0x1a')](_0x5709('0x1b'),_0x35d255);logger['debug'](_0x5709('0x1b'),_0x35d255,JSON[_0x5709('0x10')](_0x1954f1));_0x360493(_0x1954f1);})[_0x5709('0x14')](function(_0x3afa52){logger[_0x5709('0x11')](_0x5709('0x1b'),_0x3afa52[_0x5709('0x13')],_0x35d255);_0x2d3eaa(_0x8b3974[_0x5709('0x11')](0x1f4,_0x3afa52[_0x5709('0x13')]));});});}; \ No newline at end of file +var _0x1378=['where','attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Template,\x20%s,\x20%s','GetTemplate','findAll','options'];(function(_0x5de7a5,_0x23948a){var _0x41e57b=function(_0x4b348e){while(--_0x4b348e){_0x5de7a5['push'](_0x5de7a5['shift']());}};_0x41e57b(++_0x23948a);}(_0x1378,0x11e));var _0x8137=function(_0x10d242,_0x1db5e0){_0x10d242=_0x10d242-0x0;var _0x5a2257=_0x1378[_0x10d242];return _0x5a2257;};'use strict';var _=require(_0x8137('0x0'));var util=require(_0x8137('0x1'));var moment=require(_0x8137('0x2'));var BPromise=require(_0x8137('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8137('0x4'));var db=require(_0x8137('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8137('0x6'))(_0x8137('0x7'));var config=require(_0x8137('0x8'));var jayson=require(_0x8137('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48fbc4,_0x3edb50,_0x38f0fd){return new BPromise(function(_0x5152dd,_0x553c1a){return client['request'](_0x48fbc4,_0x38f0fd)[_0x8137('0xa')](function(_0x427a48){logger[_0x8137('0xb')]('Template,\x20%s,\x20%s',_0x3edb50,'request\x20sent');logger['debug'](_0x8137('0xc'),_0x3edb50,_0x8137('0xd'),JSON[_0x8137('0xe')](_0x427a48));if(_0x427a48[_0x8137('0xf')]){if(_0x427a48[_0x8137('0xf')][_0x8137('0x10')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x3edb50,_0x427a48[_0x8137('0xf')][_0x8137('0x11')]);return _0x553c1a(_0x427a48['error']['message']);}logger['error']('Template,\x20%s,\x20%s',_0x3edb50,_0x427a48['error'][_0x8137('0x11')]);return _0x5152dd(_0x427a48['error']['message']);}else{logger[_0x8137('0xb')]('Template,\x20%s,\x20%s',_0x3edb50,_0x8137('0xd'));_0x5152dd(_0x427a48[_0x8137('0x12')]['message']);}})[_0x8137('0x13')](function(_0x42fa0e){logger[_0x8137('0xf')](_0x8137('0x14'),_0x3edb50,_0x42fa0e);_0x553c1a(_0x42fa0e);});});}exports[_0x8137('0x15')]=function(_0x21d47b){var _0x7436c8=this;return new Promise(function(_0x5648b1,_0x47b0f2){return db['Template'][_0x8137('0x16')]({'raw':_0x21d47b[_0x8137('0x17')]?_0x21d47b[_0x8137('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x21d47b[_0x8137('0x17')]?_0x21d47b[_0x8137('0x17')][_0x8137('0x18')]||null:null,'attributes':_0x21d47b['options']?_0x21d47b['options'][_0x8137('0x19')]||null:null,'limit':_0x21d47b[_0x8137('0x17')]?_0x21d47b[_0x8137('0x17')][_0x8137('0x1a')]||null:null,'include':_0x21d47b['options']?_0x21d47b[_0x8137('0x17')][_0x8137('0x1b')]?_[_0x8137('0x1c')](_0x21d47b[_0x8137('0x17')][_0x8137('0x1b')],function(_0x1d2a92){return{'model':db[_0x1d2a92['model']],'as':_0x1d2a92['as'],'attributes':_0x1d2a92[_0x8137('0x19')],'include':_0x1d2a92[_0x8137('0x1b')]?_[_0x8137('0x1c')](_0x1d2a92['include'],function(_0x28702f){return{'model':db[_0x28702f['model']],'as':_0x28702f['as'],'attributes':_0x28702f[_0x8137('0x19')],'include':_0x28702f[_0x8137('0x1b')]?_[_0x8137('0x1c')](_0x28702f[_0x8137('0x1b')],function(_0x59eb3f){return{'model':db[_0x59eb3f[_0x8137('0x1d')]],'as':_0x59eb3f['as'],'attributes':_0x59eb3f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8137('0xa')](function(_0xae0983){logger[_0x8137('0xb')](_0x8137('0x15'),_0x21d47b);logger[_0x8137('0x1e')](_0x8137('0x15'),_0x21d47b,JSON['stringify'](_0xae0983));_0x5648b1(_0xae0983);})[_0x8137('0x13')](function(_0x3afa0e){logger['error'](_0x8137('0x15'),_0x3afa0e[_0x8137('0x11')],_0x21d47b);_0x47b0f2(_0x7436c8[_0x8137('0xf')](0x1f4,_0x3afa0e[_0x8137('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 11ecdcf..97efff8 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 _0xa2b9=['destroy','exports','multer','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAction','update','delete'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa2b9,0x8e));var _0x9a2b=function(_0x3966a3,_0x1fd1a2){_0x3966a3=_0x3966a3-0x0;var _0x482dc7=_0xa2b9[_0x3966a3];return _0x482dc7;};'use strict';var multer=require(_0x9a2b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9a2b('0x1'));var express=require(_0x9a2b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a2b('0x3'));var controller=require('./trigger.controller');router[_0x9a2b('0x4')]('/',auth[_0x9a2b('0x5')](),controller[_0x9a2b('0x6')]);router['get'](_0x9a2b('0x7'),auth[_0x9a2b('0x5')](),controller[_0x9a2b('0x8')]);router[_0x9a2b('0x4')](_0x9a2b('0x9'),auth[_0x9a2b('0x5')](),controller['getAllConditions']);router['get'](_0x9a2b('0xa'),auth[_0x9a2b('0x5')](),controller[_0x9a2b('0xb')]);router[_0x9a2b('0x4')](_0x9a2b('0xc'),auth[_0x9a2b('0x5')](),controller['getActions']);router['post']('/',auth[_0x9a2b('0x5')](),controller[_0x9a2b('0xd')]);router[_0x9a2b('0xe')]('/:id/all_conditions',auth[_0x9a2b('0x5')](),controller['addAllCondition']);router[_0x9a2b('0xe')](_0x9a2b('0xa'),auth[_0x9a2b('0x5')](),controller['addAnyCondition']);router[_0x9a2b('0xe')]('/:id/actions',auth[_0x9a2b('0x5')](),controller[_0x9a2b('0xf')]);router['put'](_0x9a2b('0x7'),auth['isAuthenticated'](),controller[_0x9a2b('0x10')]);router[_0x9a2b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9a2b('0x12')]);module[_0x9a2b('0x13')]=router; \ No newline at end of file +var _0x8782=['../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','getActions','post','addAllCondition','/:id/actions','addAction','/:id','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x420f45,_0x82ba43){var _0x115f02=function(_0x1f2638){while(--_0x1f2638){_0x420f45['push'](_0x420f45['shift']());}};_0x115f02(++_0x82ba43);}(_0x8782,0x16b));var _0x2878=function(_0x8af78f,_0x496b38){_0x8af78f=_0x8af78f-0x0;var _0x119bec=_0x8782[_0x8af78f];return _0x119bec;};'use strict';var multer=require('multer');var util=require(_0x2878('0x0'));var path=require(_0x2878('0x1'));var timeout=require(_0x2878('0x2'));var express=require(_0x2878('0x3'));var router=express[_0x2878('0x4')]();var auth=require(_0x2878('0x5'));var interaction=require(_0x2878('0x6'));var config=require('../../config/environment');var controller=require(_0x2878('0x7'));router[_0x2878('0x8')]('/',auth[_0x2878('0x9')](),controller[_0x2878('0xa')]);router[_0x2878('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2878('0xb')]);router[_0x2878('0x8')](_0x2878('0xc'),auth[_0x2878('0x9')](),controller['getAllConditions']);router[_0x2878('0x8')](_0x2878('0xd'),auth['isAuthenticated'](),controller[_0x2878('0xe')]);router[_0x2878('0x8')]('/:id/actions',auth[_0x2878('0x9')](),controller[_0x2878('0xf')]);router['post']('/',auth[_0x2878('0x9')](),controller['create']);router[_0x2878('0x10')]('/:id/all_conditions',auth[_0x2878('0x9')](),controller[_0x2878('0x11')]);router[_0x2878('0x10')](_0x2878('0xd'),auth[_0x2878('0x9')](),controller['addAnyCondition']);router['post'](_0x2878('0x12'),auth['isAuthenticated'](),controller[_0x2878('0x13')]);router['put'](_0x2878('0x14'),auth[_0x2878('0x9')](),controller['update']);router[_0x2878('0x15')](_0x2878('0x14'),auth[_0x2878('0x9')](),controller['destroy']);module[_0x2878('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ea909c6..aab1d1a 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 _0x021a=['STRING','BOOLEAN','exports'];(function(_0x59c294,_0x546ef3){var _0x330ccf=function(_0xe41bd6){while(--_0xe41bd6){_0x59c294['push'](_0x59c294['shift']());}};_0x330ccf(++_0x546ef3);}(_0x021a,0x16d));var _0xa021=function(_0x2cdd4d,_0x394c2f){_0x2cdd4d=_0x2cdd4d-0x0;var _0x55cbc8=_0x021a[_0x2cdd4d];return _0x55cbc8;};'use strict';var Sequelize=require('sequelize');module[_0xa021('0x0')]={'name':{'type':Sequelize[_0xa021('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa021('0x1')]},'status':{'type':Sequelize[_0xa021('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7c92=['STRING','sequelize','exports'];(function(_0x58d6c2,_0x205acb){var _0x5a192e=function(_0xc0c251){while(--_0xc0c251){_0x58d6c2['push'](_0x58d6c2['shift']());}};_0x5a192e(++_0x205acb);}(_0x7c92,0x121));var _0x27c9=function(_0x441a79,_0x18187b){_0x441a79=_0x441a79-0x0;var _0x445d98=_0x7c92[_0x441a79];return _0x445d98;};'use strict';var Sequelize=require(_0x27c9('0x0'));module[_0x27c9('0x1')]={'name':{'type':Sequelize[_0x27c9('0x2')]},'channel':{'type':Sequelize[_0x27c9('0x2')]},'description':{'type':Sequelize[_0x27c9('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 87bb848..45e577c 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 _0xbbba=['Triggers','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','options','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','Trigger','fieldName','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','count','includeAll','include','findAll','show','params','rawAttributes','length','create','user','get','role'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xbbba,0x1f2));var _0xabbb=function(_0x414ff1,_0xf0462b){_0x414ff1=_0x414ff1-0x0;var _0x29c53f=_0xbbba[_0x414ff1];return _0x29c53f;};'use strict';var pdf=require(_0xabbb('0x0'));var emlformat=require(_0xabbb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xabbb('0x2'));var jsonpatch=require(_0xabbb('0x3'));var rp=require(_0xabbb('0x4'));var moment=require(_0xabbb('0x5'));var BPromise=require(_0xabbb('0x6'));var Mustache=require('mustache');var util=require(_0xabbb('0x7'));var path=require(_0xabbb('0x8'));var sox=require(_0xabbb('0x9'));var csv=require(_0xabbb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xabbb('0xb'));var squel=require(_0xabbb('0xc'));var crypto=require(_0xabbb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xabbb('0xe'));var toCsv=require(_0xabbb('0xa'));var querystring=require(_0xabbb('0xf'));var Papa=require(_0xabbb('0x10'));var Redis=require(_0xabbb('0x11'));var authService=require(_0xabbb('0x12'));var qs=require(_0xabbb('0x13'));var as=require(_0xabbb('0x14'));var hardwareService=require(_0xabbb('0x15'));var logger=require(_0xabbb('0x16'))(_0xabbb('0x17'));var utils=require(_0xabbb('0x18'));var config=require(_0xabbb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x880e33,_0x4d5ef8){_0x4d5ef8=_0x4d5ef8||0xcc;return function(_0x240855){if(_0x240855){return _0x880e33[_0xabbb('0x1a')](_0x4d5ef8);}return _0x880e33[_0xabbb('0x1b')](_0x4d5ef8)[_0xabbb('0x1c')]();};}function respondWithResult(_0x4bf26e,_0x129387){_0x129387=_0x129387||0xc8;return function(_0xa99f03){if(_0xa99f03){return _0x4bf26e['status'](_0x129387)[_0xabbb('0x1d')](_0xa99f03);}};}function respondWithFilteredResult(_0x3a7153,_0x5b2254){return function(_0x34e665){if(_0x34e665){var _0x27e4d6=_0x34e665['count'],_0x31078b=_0x5b2254[_0xabbb('0x1e')],_0x1780e5=_0x5b2254[_0xabbb('0x1e')]+_0x5b2254[_0xabbb('0x1f')],_0x515312;if(_0x1780e5>=_0x27e4d6){_0x1780e5=_0x27e4d6;_0x515312=0xc8;}else{_0x515312=0xce;}_0x3a7153['status'](_0x515312);return _0x3a7153[_0xabbb('0x20')](_0xabbb('0x21'),_0x31078b+'-'+_0x1780e5+'/'+_0x27e4d6)[_0xabbb('0x1d')](_0x34e665);}return null;};}function patchUpdates(_0x3438ca){return function(_0x1886e8){try{jsonpatch[_0xabbb('0x22')](_0x1886e8,_0x3438ca,!![]);}catch(_0x5e66c1){return BPromise[_0xabbb('0x23')](_0x5e66c1);}return _0x1886e8[_0xabbb('0x24')]();};}function saveUpdates(_0x4ea6a1,_0x3cfd49){return function(_0x419e9b){if(_0x419e9b){return _0x419e9b[_0xabbb('0x25')](_0x4ea6a1)[_0xabbb('0x26')](function(_0x3e490a){return _0x3e490a;});}return null;};}function removeEntity(_0x3fbcaf,_0x293b26){return function(_0x50d215){if(_0x50d215){return _0x50d215[_0xabbb('0x27')]()['then'](function(){var _0x3fdb06=_0x50d215['get']({'plain':!![]});var _0x19cefb='Triggers';return db[_0xabbb('0x28')][_0xabbb('0x27')]({'where':{'type':_0x19cefb,'resourceId':_0x3fdb06['id']}})['then'](function(){return _0x50d215;});})[_0xabbb('0x26')](function(){_0x3fbcaf[_0xabbb('0x1b')](0xcc)[_0xabbb('0x1c')]();});}};}function handleEntityNotFound(_0x356682,_0x577881){return function(_0x2c92f0){if(!_0x2c92f0){_0x356682[_0xabbb('0x1a')](0x194);}return _0x2c92f0;};}function handleError(_0x72b83e,_0xdba5b7){_0xdba5b7=_0xdba5b7||0x1f4;return function(_0x5af9db){logger[_0xabbb('0x29')](_0x5af9db[_0xabbb('0x2a')]);if(_0x5af9db[_0xabbb('0x2b')]){delete _0x5af9db[_0xabbb('0x2b')];}_0x72b83e[_0xabbb('0x1b')](_0xdba5b7)[_0xabbb('0x2c')](_0x5af9db);};}exports['index']=function(_0x2cc8bb,_0x3c226a){var _0x1937bf={},_0x40ec87={},_0x4a0cdb={'count':0x0,'rows':[]};var _0xc4bdd9=_[_0xabbb('0x2d')](db[_0xabbb('0x2e')]['rawAttributes'],function(_0x4faf30){return{'name':_0x4faf30[_0xabbb('0x2f')],'type':_0x4faf30['type'][_0xabbb('0x30')]};});_0x40ec87['model']=_[_0xabbb('0x2d')](_0xc4bdd9,_0xabbb('0x2b'));_0x40ec87[_0xabbb('0x31')]=_[_0xabbb('0x32')](_0x2cc8bb[_0xabbb('0x31')]);_0x40ec87[_0xabbb('0x33')]=_[_0xabbb('0x34')](_0x40ec87['model'],_0x40ec87['query']);_0x1937bf[_0xabbb('0x35')]=_[_0xabbb('0x34')](_0x40ec87['model'],qs[_0xabbb('0x36')](_0x2cc8bb['query'][_0xabbb('0x36')]));_0x1937bf[_0xabbb('0x35')]=_0x1937bf[_0xabbb('0x35')]['length']?_0x1937bf[_0xabbb('0x35')]:_0x40ec87[_0xabbb('0x37')];if(!_0x2cc8bb['query'][_0xabbb('0x38')](_0xabbb('0x39'))){_0x1937bf[_0xabbb('0x1f')]=qs[_0xabbb('0x1f')](_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x1f')]);_0x1937bf[_0xabbb('0x1e')]=qs[_0xabbb('0x1e')](_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x1e')]);}_0x1937bf[_0xabbb('0x3a')]=qs[_0xabbb('0x3b')](_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x3b')]);_0x1937bf[_0xabbb('0x3c')]=qs[_0xabbb('0x33')](_[_0xabbb('0x3d')](_0x2cc8bb[_0xabbb('0x31')],_0x40ec87[_0xabbb('0x33')]),_0xc4bdd9);if(_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x3e')]){_0x1937bf['where']=_['merge'](_0x1937bf[_0xabbb('0x3c')],{'$or':_[_0xabbb('0x2d')](_0xc4bdd9,function(_0x4666d9){if(_0x4666d9[_0xabbb('0x3f')]!==_0xabbb('0x40')){var _0x27f735={};_0x27f735[_0x4666d9['name']]={'$like':'%'+_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x3e')]+'%'};return _0x27f735;}})});}_0x1937bf=_[_0xabbb('0x41')]({},_0x1937bf,_0x2cc8bb['options']);var _0x209d1b={'where':_0x1937bf[_0xabbb('0x3c')]};return db['Trigger'][_0xabbb('0x42')](_0x209d1b)['then'](function(_0x29d54b){_0x4a0cdb['count']=_0x29d54b;if(_0x2cc8bb[_0xabbb('0x31')][_0xabbb('0x43')]){_0x1937bf[_0xabbb('0x44')]=[{'all':!![]}];}return db['Trigger'][_0xabbb('0x45')](_0x1937bf);})[_0xabbb('0x26')](function(_0x568eae){_0x4a0cdb['rows']=_0x568eae;return _0x4a0cdb;})['then'](respondWithFilteredResult(_0x3c226a,_0x1937bf))['catch'](handleError(_0x3c226a,null));};exports[_0xabbb('0x46')]=function(_0xd061f8,_0xc0311){var _0x579c99={'raw':![],'where':{'id':_0xd061f8[_0xabbb('0x47')]['id']}},_0x25c596={};_0x25c596['model']=_['keys'](db[_0xabbb('0x2e')][_0xabbb('0x48')]);_0x25c596[_0xabbb('0x31')]=_[_0xabbb('0x32')](_0xd061f8['query']);_0x25c596['filters']=_[_0xabbb('0x34')](_0x25c596[_0xabbb('0x37')],_0x25c596[_0xabbb('0x31')]);_0x579c99[_0xabbb('0x35')]=_['intersection'](_0x25c596[_0xabbb('0x37')],qs[_0xabbb('0x36')](_0xd061f8[_0xabbb('0x31')][_0xabbb('0x36')]));_0x579c99[_0xabbb('0x35')]=_0x579c99[_0xabbb('0x35')][_0xabbb('0x49')]?_0x579c99['attributes']:_0x25c596[_0xabbb('0x37')];if(_0xd061f8[_0xabbb('0x31')]['includeAll']){_0x579c99[_0xabbb('0x44')]=[{'all':!![]}];}_0x579c99=_[_0xabbb('0x41')]({},_0x579c99,_0xd061f8['options']);return db['Trigger']['find'](_0x579c99)[_0xabbb('0x26')](handleEntityNotFound(_0xc0311,null))[_0xabbb('0x26')](respondWithResult(_0xc0311,null))['catch'](handleError(_0xc0311,null));};exports[_0xabbb('0x4a')]=function(_0x1611e8,_0x5c5e3b){return db['Trigger'][_0xabbb('0x4a')](_0x1611e8['body'],{})[_0xabbb('0x26')](function(_0x1bfdca){var _0x456786=_0x1611e8[_0xabbb('0x4b')][_0xabbb('0x4c')]({'plain':!![]});if(!_0x456786)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x456786[_0xabbb('0x4d')]===_0xabbb('0x4b')){var _0x3d1ee2=_0x1bfdca['get']({'plain':!![]});var _0x4db4bd=_0xabbb('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x4db4bd,'userProfileId':_0x456786[_0xabbb('0x4f')]},'raw':!![]})[_0xabbb('0x26')](function(_0x3984c5){if(_0x3984c5&&_0x3984c5[_0xabbb('0x50')]===0x0){return db['UserProfileResource'][_0xabbb('0x4a')]({'name':_0x3d1ee2[_0xabbb('0x2b')],'resourceId':_0x3d1ee2['id'],'type':_0x3984c5[_0xabbb('0x2b')],'sectionId':_0x3984c5['id']},{})['then'](function(){return _0x1bfdca;});}else{return _0x1bfdca;}})[_0xabbb('0x51')](function(_0xc93b86){logger[_0xabbb('0x29')](_0xabbb('0x52'),_0xc93b86);throw _0xc93b86;});}return _0x1bfdca;})['then'](respondWithResult(_0x5c5e3b,0xc9))[_0xabbb('0x51')](handleError(_0x5c5e3b,null));};exports[_0xabbb('0x25')]=function(_0x400857,_0x4c858a){if(_0x400857[_0xabbb('0x53')]['id']){delete _0x400857[_0xabbb('0x53')]['id'];}return db[_0xabbb('0x2e')][_0xabbb('0x54')]({'where':{'id':_0x400857['params']['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x4c858a,null))[_0xabbb('0x26')](saveUpdates(_0x400857[_0xabbb('0x53')],null))[_0xabbb('0x26')](respondWithResult(_0x4c858a,null))[_0xabbb('0x51')](handleError(_0x4c858a,null));};exports[_0xabbb('0x27')]=function(_0x46d994,_0x1e53f2){return db[_0xabbb('0x2e')][_0xabbb('0x54')]({'where':{'id':_0x46d994['params']['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x1e53f2,null))[_0xabbb('0x26')](removeEntity(_0x1e53f2,null))['catch'](handleError(_0x1e53f2,null));};exports[_0xabbb('0x55')]=function(_0x2447d5,_0x2a54bb,_0xc88ed3){if(_0x2447d5['body']['id']){delete _0x2447d5[_0xabbb('0x53')]['id'];}return db[_0xabbb('0x2e')][_0xabbb('0x54')]({'where':{'id':_0x2447d5[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x2a54bb,null))['then'](function(_0x297a3c){if(_0x297a3c){_0x2447d5['body']['TriggerAllId']=_0x297a3c['id'];return db[_0xabbb('0x56')][_0xabbb('0x4a')](_0x2447d5['body']);}})[_0xabbb('0x26')](respondWithResult(_0x2a54bb,null))['catch'](handleError(_0x2a54bb,null));};exports[_0xabbb('0x57')]=function(_0x18475b,_0x417564,_0x1fb381){if(_0x18475b[_0xabbb('0x53')]['id']){delete _0x18475b['body']['id'];}return db['Trigger'][_0xabbb('0x54')]({'where':{'id':_0x18475b[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x417564,null))[_0xabbb('0x26')](function(_0x1ea654){if(_0x1ea654){_0x18475b[_0xabbb('0x53')]['TriggerAnyId']=_0x1ea654['id'];return db[_0xabbb('0x56')][_0xabbb('0x4a')](_0x18475b[_0xabbb('0x53')]);}})['then'](respondWithResult(_0x417564,null))[_0xabbb('0x51')](handleError(_0x417564,null));};exports[_0xabbb('0x58')]=function(_0x29add6,_0x1cd107,_0x542476){var _0x539deb={};var _0x486da7={};var _0x4bd43a;var _0x1fe6fc;return db['Trigger'][_0xabbb('0x59')]({'where':{'id':_0x29add6[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x1cd107,null))[_0xabbb('0x26')](function(_0x4e807b){if(_0x4e807b){_0x4bd43a=_0x4e807b;_0x486da7['model']=_[_0xabbb('0x32')](db[_0xabbb('0x56')][_0xabbb('0x48')]);_0x486da7['query']=_['keys'](_0x29add6['query']);_0x486da7[_0xabbb('0x33')]=_[_0xabbb('0x34')](_0x486da7['model'],_0x486da7['query']);_0x539deb[_0xabbb('0x35')]=_[_0xabbb('0x34')](_0x486da7[_0xabbb('0x37')],qs[_0xabbb('0x36')](_0x29add6['query'][_0xabbb('0x36')]));_0x539deb[_0xabbb('0x35')]=_0x539deb[_0xabbb('0x35')]['length']?_0x539deb[_0xabbb('0x35')]:_0x486da7['model'];_0x539deb['order']=qs[_0xabbb('0x3b')](_0x29add6[_0xabbb('0x31')][_0xabbb('0x3b')]);_0x539deb['where']=qs[_0xabbb('0x33')](_[_0xabbb('0x3d')](_0x29add6['query'],_0x486da7['filters']));if(_0x29add6['query'][_0xabbb('0x3e')]){_0x539deb[_0xabbb('0x3c')]=_[_0xabbb('0x41')](_0x539deb[_0xabbb('0x3c')],{'$or':_['map'](_0x539deb[_0xabbb('0x35')],function(_0xe7108f){var _0x1ebf0a={};_0x1ebf0a[_0xe7108f]={'$like':'%'+_0x29add6['query']['filter']+'%'};return _0x1ebf0a;})});}_0x539deb=_[_0xabbb('0x41')]({},_0x539deb,_0x29add6[_0xabbb('0x5a')]);return _0x4bd43a['getAllConditions'](_0x539deb);}})[_0xabbb('0x26')](function(_0x579bfb){if(_0x579bfb){_0x1fe6fc=_0x579bfb[_0xabbb('0x49')];if(!_0x29add6[_0xabbb('0x31')][_0xabbb('0x38')](_0xabbb('0x39'))){_0x539deb[_0xabbb('0x1f')]=qs[_0xabbb('0x1f')](_0x29add6['query'][_0xabbb('0x1f')]);_0x539deb['offset']=qs['offset'](_0x29add6['query'][_0xabbb('0x1e')]);}return _0x4bd43a[_0xabbb('0x58')](_0x539deb);}})[_0xabbb('0x26')](function(_0x21658f){if(_0x21658f){return _0x21658f?{'count':_0x1fe6fc,'rows':_0x21658f}:null;}})[_0xabbb('0x26')](respondWithResult(_0x1cd107,null))[_0xabbb('0x51')](handleError(_0x1cd107,null));};exports[_0xabbb('0x5b')]=function(_0x785fab,_0x332eac,_0x5b84af){var _0xa2e871={};var _0x367d9c={};var _0x175d14;var _0x53da56;return db[_0xabbb('0x2e')][_0xabbb('0x59')]({'where':{'id':_0x785fab[_0xabbb('0x47')]['id']}})['then'](handleEntityNotFound(_0x332eac,null))[_0xabbb('0x26')](function(_0x5e2bcf){if(_0x5e2bcf){_0x175d14=_0x5e2bcf;_0x367d9c[_0xabbb('0x37')]=_[_0xabbb('0x32')](db[_0xabbb('0x56')][_0xabbb('0x48')]);_0x367d9c[_0xabbb('0x31')]=_[_0xabbb('0x32')](_0x785fab['query']);_0x367d9c[_0xabbb('0x33')]=_[_0xabbb('0x34')](_0x367d9c['model'],_0x367d9c['query']);_0xa2e871[_0xabbb('0x35')]=_['intersection'](_0x367d9c[_0xabbb('0x37')],qs[_0xabbb('0x36')](_0x785fab[_0xabbb('0x31')][_0xabbb('0x36')]));_0xa2e871[_0xabbb('0x35')]=_0xa2e871[_0xabbb('0x35')][_0xabbb('0x49')]?_0xa2e871[_0xabbb('0x35')]:_0x367d9c[_0xabbb('0x37')];_0xa2e871[_0xabbb('0x3a')]=qs[_0xabbb('0x3b')](_0x785fab['query'][_0xabbb('0x3b')]);_0xa2e871[_0xabbb('0x3c')]=qs[_0xabbb('0x33')](_[_0xabbb('0x3d')](_0x785fab['query'],_0x367d9c[_0xabbb('0x33')]));if(_0x785fab[_0xabbb('0x31')][_0xabbb('0x3e')]){_0xa2e871[_0xabbb('0x3c')]=_[_0xabbb('0x41')](_0xa2e871[_0xabbb('0x3c')],{'$or':_['map'](_0xa2e871['attributes'],function(_0x254b2b){var _0xd0bb95={};_0xd0bb95[_0x254b2b]={'$like':'%'+_0x785fab[_0xabbb('0x31')][_0xabbb('0x3e')]+'%'};return _0xd0bb95;})});}_0xa2e871=_[_0xabbb('0x41')]({},_0xa2e871,_0x785fab[_0xabbb('0x5a')]);return _0x175d14['getAnyConditions'](_0xa2e871);}})[_0xabbb('0x26')](function(_0x461472){if(_0x461472){_0x53da56=_0x461472[_0xabbb('0x49')];if(!_0x785fab[_0xabbb('0x31')]['hasOwnProperty'](_0xabbb('0x39'))){_0xa2e871[_0xabbb('0x1f')]=qs[_0xabbb('0x1f')](_0x785fab[_0xabbb('0x31')]['limit']);_0xa2e871[_0xabbb('0x1e')]=qs[_0xabbb('0x1e')](_0x785fab[_0xabbb('0x31')]['offset']);}return _0x175d14[_0xabbb('0x5b')](_0xa2e871);}})[_0xabbb('0x26')](function(_0x1671d4){if(_0x1671d4){return _0x1671d4?{'count':_0x53da56,'rows':_0x1671d4}:null;}})['then'](respondWithResult(_0x332eac,null))[_0xabbb('0x51')](handleError(_0x332eac,null));};exports[_0xabbb('0x5c')]=function(_0x4dde8f,_0x3d6708,_0x29d729){if(_0x4dde8f[_0xabbb('0x53')]['id']){delete _0x4dde8f['body']['id'];}return db[_0xabbb('0x2e')][_0xabbb('0x54')]({'where':{'id':_0x4dde8f[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0x3d6708,null))['then'](function(_0x376a5a){if(_0x376a5a){_0x4dde8f[_0xabbb('0x53')][_0xabbb('0x5d')]=_0x376a5a['id'];return db[_0xabbb('0x5e')][_0xabbb('0x4a')](_0x4dde8f['body']);}})[_0xabbb('0x26')](respondWithResult(_0x3d6708,null))[_0xabbb('0x51')](handleError(_0x3d6708,null));};exports['getActions']=function(_0x4f8efc,_0xf9fcfb,_0x2be3ab){var _0x242d2a={};var _0x5b296d={};var _0x39990d;var _0x3941e4;return db['Trigger']['findOne']({'where':{'id':_0x4f8efc[_0xabbb('0x47')]['id']}})[_0xabbb('0x26')](handleEntityNotFound(_0xf9fcfb,null))[_0xabbb('0x26')](function(_0x378d51){if(_0x378d51){_0x39990d=_0x378d51;_0x5b296d[_0xabbb('0x37')]=_[_0xabbb('0x32')](db[_0xabbb('0x5e')][_0xabbb('0x48')]);_0x5b296d[_0xabbb('0x31')]=_[_0xabbb('0x32')](_0x4f8efc['query']);_0x5b296d[_0xabbb('0x33')]=_[_0xabbb('0x34')](_0x5b296d[_0xabbb('0x37')],_0x5b296d['query']);_0x242d2a['attributes']=_[_0xabbb('0x34')](_0x5b296d[_0xabbb('0x37')],qs[_0xabbb('0x36')](_0x4f8efc[_0xabbb('0x31')][_0xabbb('0x36')]));_0x242d2a[_0xabbb('0x35')]=_0x242d2a[_0xabbb('0x35')]['length']?_0x242d2a[_0xabbb('0x35')]:_0x5b296d[_0xabbb('0x37')];_0x242d2a[_0xabbb('0x3a')]=qs[_0xabbb('0x3b')](_0x4f8efc[_0xabbb('0x31')]['sort']);_0x242d2a[_0xabbb('0x3c')]=qs[_0xabbb('0x33')](_[_0xabbb('0x3d')](_0x4f8efc[_0xabbb('0x31')],_0x5b296d[_0xabbb('0x33')]));if(_0x4f8efc[_0xabbb('0x31')]['filter']){_0x242d2a[_0xabbb('0x3c')]=_[_0xabbb('0x41')](_0x242d2a[_0xabbb('0x3c')],{'$or':_[_0xabbb('0x2d')](_0x242d2a[_0xabbb('0x35')],function(_0x3f8315){var _0x2f5fa2={};_0x2f5fa2[_0x3f8315]={'$like':'%'+_0x4f8efc[_0xabbb('0x31')][_0xabbb('0x3e')]+'%'};return _0x2f5fa2;})});}_0x242d2a=_[_0xabbb('0x41')]({},_0x242d2a,_0x4f8efc[_0xabbb('0x5a')]);return _0x39990d[_0xabbb('0x5f')](_0x242d2a);}})[_0xabbb('0x26')](function(_0x3c5968){if(_0x3c5968){_0x3941e4=_0x3c5968[_0xabbb('0x49')];if(!_0x4f8efc['query']['hasOwnProperty'](_0xabbb('0x39'))){_0x242d2a[_0xabbb('0x1f')]=qs['limit'](_0x4f8efc[_0xabbb('0x31')][_0xabbb('0x1f')]);_0x242d2a[_0xabbb('0x1e')]=qs[_0xabbb('0x1e')](_0x4f8efc[_0xabbb('0x31')][_0xabbb('0x1e')]);}return _0x39990d[_0xabbb('0x5f')](_0x242d2a);}})[_0xabbb('0x26')](function(_0x1dd3e5){if(_0x1dd3e5){return _0x1dd3e5?{'count':_0x3941e4,'rows':_0x1dd3e5}:null;}})['then'](respondWithResult(_0xf9fcfb,null))[_0xabbb('0x51')](handleError(_0xf9fcfb,null));}; \ No newline at end of file +var _0xf88f=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','pick','getAnyConditions','addAction','Action','getActions','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Triggers','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','show','params','include','find','catch','create','user','userProfileId','autoAssociation'];(function(_0x2e7191,_0x18238d){var _0x19d688=function(_0x279613){while(--_0x279613){_0x2e7191['push'](_0x2e7191['shift']());}};_0x19d688(++_0x18238d);}(_0xf88f,0xc4));var _0xff88=function(_0x3926c5,_0x189b50){_0x3926c5=_0x3926c5-0x0;var _0x14a6c9=_0xf88f[_0x3926c5];return _0x14a6c9;};'use strict';var pdf=require(_0xff88('0x0'));var emlformat=require(_0xff88('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xff88('0x2'));var moment=require(_0xff88('0x3'));var BPromise=require(_0xff88('0x4'));var Mustache=require(_0xff88('0x5'));var util=require(_0xff88('0x6'));var path=require(_0xff88('0x7'));var sox=require(_0xff88('0x8'));var csv=require('to-csv');var ejs=require(_0xff88('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xff88('0xa'));var jsforce=require(_0xff88('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xff88('0xc'));var querystring=require(_0xff88('0xd'));var Papa=require(_0xff88('0xe'));var Redis=require('ioredis');var authService=require(_0xff88('0xf'));var qs=require(_0xff88('0x10'));var as=require(_0xff88('0x11'));var hardwareService=require(_0xff88('0x12'));var logger=require(_0xff88('0x13'))('api');var utils=require(_0xff88('0x14'));var config=require(_0xff88('0x15'));var db=require(_0xff88('0x16'))['db'];function respondWithStatusCode(_0x183c30,_0x367e01){_0x367e01=_0x367e01||0xcc;return function(_0x33658c){if(_0x33658c){return _0x183c30['sendStatus'](_0x367e01);}return _0x183c30['status'](_0x367e01)[_0xff88('0x17')]();};}function respondWithResult(_0x32081d,_0x5918f0){_0x5918f0=_0x5918f0||0xc8;return function(_0x3d653b){if(_0x3d653b){return _0x32081d[_0xff88('0x18')](_0x5918f0)['json'](_0x3d653b);}};}function respondWithFilteredResult(_0x27ca79,_0x1d15bd){return function(_0xe16090){if(_0xe16090){var _0x2b7775=_0xe16090[_0xff88('0x19')],_0x406b42=_0x1d15bd[_0xff88('0x1a')],_0x548b3e=_0x1d15bd[_0xff88('0x1a')]+_0x1d15bd['limit'],_0x1dd1e4;if(_0x548b3e>=_0x2b7775){_0x548b3e=_0x2b7775;_0x1dd1e4=0xc8;}else{_0x1dd1e4=0xce;}_0x27ca79[_0xff88('0x18')](_0x1dd1e4);return _0x27ca79[_0xff88('0x1b')](_0xff88('0x1c'),_0x406b42+'-'+_0x548b3e+'/'+_0x2b7775)[_0xff88('0x1d')](_0xe16090);}return null;};}function patchUpdates(_0x1f8e94){return function(_0x1d012a){try{jsonpatch[_0xff88('0x1e')](_0x1d012a,_0x1f8e94,!![]);}catch(_0x519d86){return BPromise[_0xff88('0x1f')](_0x519d86);}return _0x1d012a[_0xff88('0x20')]();};}function saveUpdates(_0x49b8ec,_0xaf73f1){return function(_0x1d3a83){if(_0x1d3a83){return _0x1d3a83[_0xff88('0x21')](_0x49b8ec)[_0xff88('0x22')](function(_0x70593a){return _0x70593a;});}return null;};}function removeEntity(_0x3c7f72,_0x4caf8c){return function(_0x2ac223){if(_0x2ac223){return _0x2ac223[_0xff88('0x23')]()['then'](function(){var _0x4b8ffe=_0x2ac223[_0xff88('0x24')]({'plain':!![]});var _0x304355=_0xff88('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x304355,'resourceId':_0x4b8ffe['id']}})[_0xff88('0x22')](function(){return _0x2ac223;});})[_0xff88('0x22')](function(){_0x3c7f72[_0xff88('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x137881,_0x17104c){return function(_0x2c3167){if(!_0x2c3167){_0x137881[_0xff88('0x26')](0x194);}return _0x2c3167;};}function handleError(_0x4047ad,_0x5cbd84){_0x5cbd84=_0x5cbd84||0x1f4;return function(_0x30dd78){logger[_0xff88('0x27')](_0x30dd78[_0xff88('0x28')]);if(_0x30dd78['name']){delete _0x30dd78[_0xff88('0x29')];}_0x4047ad[_0xff88('0x18')](_0x5cbd84)[_0xff88('0x2a')](_0x30dd78);};}exports[_0xff88('0x2b')]=function(_0x4229d5,_0x240c02){var _0x1d70b7={},_0x5e7902={},_0x531ee3={'count':0x0,'rows':[]};var _0x3d9a6d=_[_0xff88('0x2c')](db[_0xff88('0x2d')][_0xff88('0x2e')],function(_0x4a6984){return{'name':_0x4a6984[_0xff88('0x2f')],'type':_0x4a6984[_0xff88('0x30')]['key']};});_0x5e7902[_0xff88('0x31')]=_['map'](_0x3d9a6d,_0xff88('0x29'));_0x5e7902[_0xff88('0x32')]=_[_0xff88('0x33')](_0x4229d5[_0xff88('0x32')]);_0x5e7902['filters']=_['intersection'](_0x5e7902[_0xff88('0x31')],_0x5e7902[_0xff88('0x32')]);_0x1d70b7[_0xff88('0x34')]=_[_0xff88('0x35')](_0x5e7902['model'],qs[_0xff88('0x36')](_0x4229d5[_0xff88('0x32')][_0xff88('0x36')]));_0x1d70b7[_0xff88('0x34')]=_0x1d70b7[_0xff88('0x34')][_0xff88('0x37')]?_0x1d70b7[_0xff88('0x34')]:_0x5e7902[_0xff88('0x31')];if(!_0x4229d5['query'][_0xff88('0x38')](_0xff88('0x39'))){_0x1d70b7['limit']=qs[_0xff88('0x3a')](_0x4229d5['query'][_0xff88('0x3a')]);_0x1d70b7[_0xff88('0x1a')]=qs['offset'](_0x4229d5['query'][_0xff88('0x1a')]);}_0x1d70b7[_0xff88('0x3b')]=qs[_0xff88('0x3c')](_0x4229d5[_0xff88('0x32')][_0xff88('0x3c')]);_0x1d70b7[_0xff88('0x3d')]=qs[_0xff88('0x3e')](_['pick'](_0x4229d5[_0xff88('0x32')],_0x5e7902[_0xff88('0x3e')]),_0x3d9a6d);if(_0x4229d5[_0xff88('0x32')][_0xff88('0x3f')]){_0x1d70b7[_0xff88('0x3d')]=_[_0xff88('0x40')](_0x1d70b7[_0xff88('0x3d')],{'$or':_[_0xff88('0x2c')](_0x3d9a6d,function(_0x75f661){if(_0x75f661[_0xff88('0x30')]!==_0xff88('0x41')){var _0x304737={};_0x304737[_0x75f661[_0xff88('0x29')]]={'$like':'%'+_0x4229d5[_0xff88('0x32')][_0xff88('0x3f')]+'%'};return _0x304737;}})});}_0x1d70b7=_['merge']({},_0x1d70b7,_0x4229d5[_0xff88('0x42')]);var _0x76da85={'where':_0x1d70b7[_0xff88('0x3d')]};return db[_0xff88('0x2d')][_0xff88('0x19')](_0x76da85)['then'](function(_0xe5aa2b){_0x531ee3['count']=_0xe5aa2b;if(_0x4229d5['query'][_0xff88('0x43')]){_0x1d70b7['include']=[{'all':!![]}];}return db[_0xff88('0x2d')]['findAll'](_0x1d70b7);})['then'](function(_0x695da6){_0x531ee3['rows']=_0x695da6;return _0x531ee3;})[_0xff88('0x22')](respondWithFilteredResult(_0x240c02,_0x1d70b7))['catch'](handleError(_0x240c02,null));};exports[_0xff88('0x44')]=function(_0x45b21f,_0xbd28){var _0x51ed27={'raw':![],'where':{'id':_0x45b21f[_0xff88('0x45')]['id']}},_0x2536a8={};_0x2536a8[_0xff88('0x31')]=_[_0xff88('0x33')](db[_0xff88('0x2d')][_0xff88('0x2e')]);_0x2536a8[_0xff88('0x32')]=_[_0xff88('0x33')](_0x45b21f[_0xff88('0x32')]);_0x2536a8[_0xff88('0x3e')]=_[_0xff88('0x35')](_0x2536a8[_0xff88('0x31')],_0x2536a8[_0xff88('0x32')]);_0x51ed27[_0xff88('0x34')]=_[_0xff88('0x35')](_0x2536a8[_0xff88('0x31')],qs['fields'](_0x45b21f[_0xff88('0x32')][_0xff88('0x36')]));_0x51ed27[_0xff88('0x34')]=_0x51ed27[_0xff88('0x34')][_0xff88('0x37')]?_0x51ed27[_0xff88('0x34')]:_0x2536a8[_0xff88('0x31')];if(_0x45b21f[_0xff88('0x32')][_0xff88('0x43')]){_0x51ed27[_0xff88('0x46')]=[{'all':!![]}];}_0x51ed27=_[_0xff88('0x40')]({},_0x51ed27,_0x45b21f[_0xff88('0x42')]);return db['Trigger'][_0xff88('0x47')](_0x51ed27)[_0xff88('0x22')](handleEntityNotFound(_0xbd28,null))[_0xff88('0x22')](respondWithResult(_0xbd28,null))[_0xff88('0x48')](handleError(_0xbd28,null));};exports['create']=function(_0x39c0e2,_0x90ebe7){return db[_0xff88('0x2d')][_0xff88('0x49')](_0x39c0e2['body'],{})[_0xff88('0x22')](function(_0x30fe03){var _0x5442ab=_0x39c0e2[_0xff88('0x4a')][_0xff88('0x24')]({'plain':!![]});if(!_0x5442ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5442ab['role']===_0xff88('0x4a')){var _0x2b032b=_0x30fe03[_0xff88('0x24')]({'plain':!![]});var _0xdb0385=_0xff88('0x25');return db['UserProfileSection'][_0xff88('0x47')]({'where':{'name':_0xdb0385,'userProfileId':_0x5442ab[_0xff88('0x4b')]},'raw':!![]})[_0xff88('0x22')](function(_0x341ce1){if(_0x341ce1&&_0x341ce1[_0xff88('0x4c')]===0x0){return db[_0xff88('0x4d')][_0xff88('0x49')]({'name':_0x2b032b[_0xff88('0x29')],'resourceId':_0x2b032b['id'],'type':_0x341ce1[_0xff88('0x29')],'sectionId':_0x341ce1['id']},{})[_0xff88('0x22')](function(){return _0x30fe03;});}else{return _0x30fe03;}})[_0xff88('0x48')](function(_0x2560a2){logger['error'](_0xff88('0x4e'),_0x2560a2);throw _0x2560a2;});}return _0x30fe03;})['then'](respondWithResult(_0x90ebe7,0xc9))['catch'](handleError(_0x90ebe7,null));};exports[_0xff88('0x21')]=function(_0x84a06f,_0x1ee835){if(_0x84a06f[_0xff88('0x4f')]['id']){delete _0x84a06f[_0xff88('0x4f')]['id'];}return db[_0xff88('0x2d')][_0xff88('0x47')]({'where':{'id':_0x84a06f[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x1ee835,null))[_0xff88('0x22')](saveUpdates(_0x84a06f['body'],null))['then'](respondWithResult(_0x1ee835,null))[_0xff88('0x48')](handleError(_0x1ee835,null));};exports[_0xff88('0x23')]=function(_0xad2f53,_0xf57c85){return db['Trigger'][_0xff88('0x47')]({'where':{'id':_0xad2f53[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0xf57c85,null))[_0xff88('0x22')](removeEntity(_0xf57c85,null))[_0xff88('0x48')](handleError(_0xf57c85,null));};exports[_0xff88('0x50')]=function(_0x101a78,_0x4f405d,_0x3d6505){if(_0x101a78['body']['id']){delete _0x101a78[_0xff88('0x4f')]['id'];}return db[_0xff88('0x2d')][_0xff88('0x47')]({'where':{'id':_0x101a78[_0xff88('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f405d,null))[_0xff88('0x22')](function(_0x5c3cc8){if(_0x5c3cc8){_0x101a78[_0xff88('0x4f')]['TriggerAllId']=_0x5c3cc8['id'];return db['Condition'][_0xff88('0x49')](_0x101a78[_0xff88('0x4f')]);}})[_0xff88('0x22')](respondWithResult(_0x4f405d,null))[_0xff88('0x48')](handleError(_0x4f405d,null));};exports[_0xff88('0x51')]=function(_0x42decb,_0x4a60e3,_0x525120){if(_0x42decb['body']['id']){delete _0x42decb[_0xff88('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x42decb[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x4a60e3,null))['then'](function(_0x42ce91){if(_0x42ce91){_0x42decb[_0xff88('0x4f')][_0xff88('0x52')]=_0x42ce91['id'];return db[_0xff88('0x53')][_0xff88('0x49')](_0x42decb[_0xff88('0x4f')]);}})[_0xff88('0x22')](respondWithResult(_0x4a60e3,null))[_0xff88('0x48')](handleError(_0x4a60e3,null));};exports[_0xff88('0x54')]=function(_0xa32522,_0x26632d,_0x50b938){var _0x16c849={};var _0x5d405c={};var _0x45afeb;var _0x48514a;return db[_0xff88('0x2d')][_0xff88('0x55')]({'where':{'id':_0xa32522[_0xff88('0x45')]['id']}})['then'](handleEntityNotFound(_0x26632d,null))[_0xff88('0x22')](function(_0x3fc9fe){if(_0x3fc9fe){_0x45afeb=_0x3fc9fe;_0x5d405c[_0xff88('0x31')]=_[_0xff88('0x33')](db['Condition'][_0xff88('0x2e')]);_0x5d405c[_0xff88('0x32')]=_[_0xff88('0x33')](_0xa32522[_0xff88('0x32')]);_0x5d405c[_0xff88('0x3e')]=_['intersection'](_0x5d405c[_0xff88('0x31')],_0x5d405c[_0xff88('0x32')]);_0x16c849['attributes']=_[_0xff88('0x35')](_0x5d405c[_0xff88('0x31')],qs[_0xff88('0x36')](_0xa32522[_0xff88('0x32')][_0xff88('0x36')]));_0x16c849['attributes']=_0x16c849['attributes'][_0xff88('0x37')]?_0x16c849[_0xff88('0x34')]:_0x5d405c[_0xff88('0x31')];_0x16c849[_0xff88('0x3b')]=qs[_0xff88('0x3c')](_0xa32522['query'][_0xff88('0x3c')]);_0x16c849[_0xff88('0x3d')]=qs[_0xff88('0x3e')](_[_0xff88('0x56')](_0xa32522[_0xff88('0x32')],_0x5d405c[_0xff88('0x3e')]));if(_0xa32522[_0xff88('0x32')]['filter']){_0x16c849[_0xff88('0x3d')]=_[_0xff88('0x40')](_0x16c849['where'],{'$or':_[_0xff88('0x2c')](_0x16c849[_0xff88('0x34')],function(_0x4b36a8){var _0x114e81={};_0x114e81[_0x4b36a8]={'$like':'%'+_0xa32522[_0xff88('0x32')][_0xff88('0x3f')]+'%'};return _0x114e81;})});}_0x16c849=_[_0xff88('0x40')]({},_0x16c849,_0xa32522[_0xff88('0x42')]);return _0x45afeb[_0xff88('0x54')](_0x16c849);}})[_0xff88('0x22')](function(_0x4469d6){if(_0x4469d6){_0x48514a=_0x4469d6['length'];if(!_0xa32522[_0xff88('0x32')][_0xff88('0x38')](_0xff88('0x39'))){_0x16c849['limit']=qs[_0xff88('0x3a')](_0xa32522[_0xff88('0x32')][_0xff88('0x3a')]);_0x16c849[_0xff88('0x1a')]=qs['offset'](_0xa32522[_0xff88('0x32')][_0xff88('0x1a')]);}return _0x45afeb[_0xff88('0x54')](_0x16c849);}})['then'](function(_0x1ca4b1){if(_0x1ca4b1){return _0x1ca4b1?{'count':_0x48514a,'rows':_0x1ca4b1}:null;}})['then'](respondWithResult(_0x26632d,null))[_0xff88('0x48')](handleError(_0x26632d,null));};exports['getAnyConditions']=function(_0x20f89e,_0x5ad8c8,_0x222831){var _0x18e808={};var _0x206f85={};var _0x35cbb4;var _0x5e6ccb;return db[_0xff88('0x2d')]['findOne']({'where':{'id':_0x20f89e[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x5ad8c8,null))['then'](function(_0x1aeed7){if(_0x1aeed7){_0x35cbb4=_0x1aeed7;_0x206f85[_0xff88('0x31')]=_[_0xff88('0x33')](db[_0xff88('0x53')][_0xff88('0x2e')]);_0x206f85['query']=_[_0xff88('0x33')](_0x20f89e[_0xff88('0x32')]);_0x206f85['filters']=_[_0xff88('0x35')](_0x206f85[_0xff88('0x31')],_0x206f85[_0xff88('0x32')]);_0x18e808[_0xff88('0x34')]=_[_0xff88('0x35')](_0x206f85[_0xff88('0x31')],qs[_0xff88('0x36')](_0x20f89e[_0xff88('0x32')][_0xff88('0x36')]));_0x18e808['attributes']=_0x18e808[_0xff88('0x34')][_0xff88('0x37')]?_0x18e808[_0xff88('0x34')]:_0x206f85[_0xff88('0x31')];_0x18e808['order']=qs[_0xff88('0x3c')](_0x20f89e[_0xff88('0x32')][_0xff88('0x3c')]);_0x18e808[_0xff88('0x3d')]=qs[_0xff88('0x3e')](_[_0xff88('0x56')](_0x20f89e[_0xff88('0x32')],_0x206f85[_0xff88('0x3e')]));if(_0x20f89e[_0xff88('0x32')][_0xff88('0x3f')]){_0x18e808['where']=_[_0xff88('0x40')](_0x18e808['where'],{'$or':_[_0xff88('0x2c')](_0x18e808[_0xff88('0x34')],function(_0x3d2a07){var _0x3676e6={};_0x3676e6[_0x3d2a07]={'$like':'%'+_0x20f89e[_0xff88('0x32')]['filter']+'%'};return _0x3676e6;})});}_0x18e808=_[_0xff88('0x40')]({},_0x18e808,_0x20f89e['options']);return _0x35cbb4[_0xff88('0x57')](_0x18e808);}})[_0xff88('0x22')](function(_0x15c964){if(_0x15c964){_0x5e6ccb=_0x15c964['length'];if(!_0x20f89e['query'][_0xff88('0x38')](_0xff88('0x39'))){_0x18e808['limit']=qs[_0xff88('0x3a')](_0x20f89e[_0xff88('0x32')][_0xff88('0x3a')]);_0x18e808['offset']=qs[_0xff88('0x1a')](_0x20f89e[_0xff88('0x32')][_0xff88('0x1a')]);}return _0x35cbb4[_0xff88('0x57')](_0x18e808);}})[_0xff88('0x22')](function(_0x3b4859){if(_0x3b4859){return _0x3b4859?{'count':_0x5e6ccb,'rows':_0x3b4859}:null;}})[_0xff88('0x22')](respondWithResult(_0x5ad8c8,null))[_0xff88('0x48')](handleError(_0x5ad8c8,null));};exports[_0xff88('0x58')]=function(_0x593d02,_0x5182f3,_0x7d14f8){if(_0x593d02[_0xff88('0x4f')]['id']){delete _0x593d02[_0xff88('0x4f')]['id'];}return db[_0xff88('0x2d')][_0xff88('0x47')]({'where':{'id':_0x593d02[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x5182f3,null))[_0xff88('0x22')](function(_0x4c9065){if(_0x4c9065){_0x593d02['body']['TriggerId']=_0x4c9065['id'];return db[_0xff88('0x59')][_0xff88('0x49')](_0x593d02['body']);}})[_0xff88('0x22')](respondWithResult(_0x5182f3,null))[_0xff88('0x48')](handleError(_0x5182f3,null));};exports[_0xff88('0x5a')]=function(_0x1517d4,_0x10ca1,_0x2690ed){var _0x185d62={};var _0x13944a={};var _0x419ff3;var _0x36af3e;return db[_0xff88('0x2d')]['findOne']({'where':{'id':_0x1517d4[_0xff88('0x45')]['id']}})[_0xff88('0x22')](handleEntityNotFound(_0x10ca1,null))['then'](function(_0x1c83a9){if(_0x1c83a9){_0x419ff3=_0x1c83a9;_0x13944a[_0xff88('0x31')]=_[_0xff88('0x33')](db[_0xff88('0x59')][_0xff88('0x2e')]);_0x13944a[_0xff88('0x32')]=_[_0xff88('0x33')](_0x1517d4[_0xff88('0x32')]);_0x13944a[_0xff88('0x3e')]=_[_0xff88('0x35')](_0x13944a[_0xff88('0x31')],_0x13944a['query']);_0x185d62[_0xff88('0x34')]=_[_0xff88('0x35')](_0x13944a[_0xff88('0x31')],qs['fields'](_0x1517d4[_0xff88('0x32')][_0xff88('0x36')]));_0x185d62[_0xff88('0x34')]=_0x185d62[_0xff88('0x34')][_0xff88('0x37')]?_0x185d62['attributes']:_0x13944a[_0xff88('0x31')];_0x185d62[_0xff88('0x3b')]=qs[_0xff88('0x3c')](_0x1517d4[_0xff88('0x32')][_0xff88('0x3c')]);_0x185d62[_0xff88('0x3d')]=qs['filters'](_[_0xff88('0x56')](_0x1517d4[_0xff88('0x32')],_0x13944a[_0xff88('0x3e')]));if(_0x1517d4[_0xff88('0x32')][_0xff88('0x3f')]){_0x185d62[_0xff88('0x3d')]=_[_0xff88('0x40')](_0x185d62[_0xff88('0x3d')],{'$or':_[_0xff88('0x2c')](_0x185d62['attributes'],function(_0x1155f4){var _0x57296f={};_0x57296f[_0x1155f4]={'$like':'%'+_0x1517d4[_0xff88('0x32')][_0xff88('0x3f')]+'%'};return _0x57296f;})});}_0x185d62=_[_0xff88('0x40')]({},_0x185d62,_0x1517d4[_0xff88('0x42')]);return _0x419ff3[_0xff88('0x5a')](_0x185d62);}})[_0xff88('0x22')](function(_0x1231c6){if(_0x1231c6){_0x36af3e=_0x1231c6[_0xff88('0x37')];if(!_0x1517d4['query']['hasOwnProperty']('nolimit')){_0x185d62[_0xff88('0x3a')]=qs[_0xff88('0x3a')](_0x1517d4['query'][_0xff88('0x3a')]);_0x185d62[_0xff88('0x1a')]=qs[_0xff88('0x1a')](_0x1517d4[_0xff88('0x32')][_0xff88('0x1a')]);}return _0x419ff3[_0xff88('0x5a')](_0x185d62);}})[_0xff88('0x22')](function(_0x53f7c7){if(_0x53f7c7){return _0x53f7c7?{'count':_0x36af3e,'rows':_0x53f7c7}:null;}})[_0xff88('0x22')](respondWithResult(_0x10ca1,null))['catch'](handleError(_0x10ca1,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 5b38483..69413fa 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','tools_triggers'];(function(_0xe6a3ab,_0x1dc2e5){var _0x33688e=function(_0x62c36e){while(--_0x62c36e){_0xe6a3ab['push'](_0xe6a3ab['shift']());}};_0x33688e(++_0x1dc2e5);}(_0x1261,0x144));var _0x1126=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x1261[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('Trigger',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','util','api','moment'];(function(_0x1c4aa3,_0x5514ef){var _0x1a27d6=function(_0x2a5b9d){while(--_0x2a5b9d){_0x1c4aa3['push'](_0x1c4aa3['shift']());}};_0x1a27d6(++_0x5514ef);}(_0xadb5,0xad));var _0x5adb=function(_0x5639d2,_0x2e585c){_0x5639d2=_0x5639d2-0x0;var _0x6dbd5c=_0xadb5[_0x5639d2];return _0x6dbd5c;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./trigger.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index c27d865..2b00f9b 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 _0x757a=['stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','ShowTrigger','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x37290d,_0x44a198){var _0x8b9862=function(_0x38a723){while(--_0x38a723){_0x37290d['push'](_0x37290d['shift']());}};_0x8b9862(++_0x44a198);}(_0x757a,0xde));var _0xa757=function(_0x4fc319,_0x2c7034){_0x4fc319=_0x4fc319-0x0;var _0x167e54=_0x757a[_0x4fc319];return _0x167e54;};'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']('Trigger,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trigger,\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']('GetTrigger',_0x4d9f58);logger['debug']('GetTrigger',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrigger',_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 _0xa5fa=['jayson/promise','client','http','request','info','debug','stringify','error','code','Trigger,\x20%s,\x20%s','message','request\x20sent','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','then','ShowTrigger','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x25acac,_0x1411ad){var _0x30f276=function(_0x4c7460){while(--_0x4c7460){_0x25acac['push'](_0x25acac['shift']());}};_0x30f276(++_0x1411ad);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x5f0c2e,_0x33309f){_0x5f0c2e=_0x5f0c2e-0x0;var _0x1c2dda=_0xa5fa[_0x5f0c2e];return _0x1c2dda;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('Trigger,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')]({'raw':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'limit':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')]['limit']||null:null,'include':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f['options'][_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x3d874f['options'][_0xaa5f('0x1d')],function(_0x1032ce){return{'model':db[_0x1032ce['model']],'as':_0x1032ce['as'],'attributes':_0x1032ce[_0xaa5f('0x1c')],'include':_0x1032ce[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1032ce[_0xaa5f('0x1d')],function(_0x1f66c0){return{'model':db[_0x1f66c0[_0xaa5f('0x1f')]],'as':_0x1f66c0['as'],'attributes':_0x1f66c0[_0xaa5f('0x1c')],'include':_0x1f66c0[_0xaa5f('0x1d')]?_['map'](_0x1f66c0[_0xaa5f('0x1d')],function(_0x3a66e8){return{'model':db[_0x3a66e8[_0xaa5f('0x1f')]],'as':_0x3a66e8['as'],'attributes':_0x3a66e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x269209){logger[_0xaa5f('0xc')]('GetTrigger',_0x3d874f);logger[_0xaa5f('0xd')]('GetTrigger',_0x3d874f,JSON['stringify'](_0x269209));_0x1019e8(_0x269209);})[_0xaa5f('0x15')](function(_0x50998f){logger[_0xaa5f('0xf')]('GetTrigger',_0x50998f['message'],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x50998f[_0xaa5f('0x12')]));});});};exports['ShowTrigger']=function(_0x310828){var _0xc0bb03=this;return new Promise(function(_0x555876,_0x58f608){return db[_0xaa5f('0x17')]['find']({'raw':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x310828['options']?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'include':_0x310828['options']?_0x310828['options']['include']?_['map'](_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1d')],function(_0x2a6015){return{'model':db[_0x2a6015[_0xaa5f('0x1f')]],'as':_0x2a6015['as'],'attributes':_0x2a6015[_0xaa5f('0x1c')],'include':_0x2a6015[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x2a6015['include'],function(_0x1ab07f){return{'model':db[_0x1ab07f[_0xaa5f('0x1f')]],'as':_0x1ab07f['as'],'attributes':_0x1ab07f[_0xaa5f('0x1c')],'include':_0x1ab07f[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1ab07f[_0xaa5f('0x1d')],function(_0x49442c){return{'model':db[_0x49442c[_0xaa5f('0x1f')]],'as':_0x49442c['as'],'attributes':_0x49442c[_0xaa5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x2ac0f8){logger[_0xaa5f('0xc')]('ShowTrigger',_0x310828);logger['debug'](_0xaa5f('0x21'),_0x310828,JSON[_0xaa5f('0xe')](_0x2ac0f8));_0x555876(_0x2ac0f8);})[_0xaa5f('0x15')](function(_0x964105){logger['error'](_0xaa5f('0x21'),_0x964105[_0xaa5f('0x12')],_0x310828);_0x58f608(_0xc0bb03[_0xaa5f('0xf')](0x1f4,_0x964105[_0xaa5f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 89747d7..bba2f04 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 _0x0a9a=['clone','post','create','put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','/:id/clone'];(function(_0x2c69a1,_0x201903){var _0x24bb91=function(_0x3131ac){while(--_0x3131ac){_0x2c69a1['push'](_0x2c69a1['shift']());}};_0x24bb91(++_0x201903);}(_0x0a9a,0x183));var _0xa0a9=function(_0x115e18,_0xb17e8d){_0x115e18=_0x115e18-0x0;var _0x2ceab5=_0x0a9a[_0x115e18];return _0x2ceab5;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['post'](_0xa0a9('0xc'),auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xd')]);router[_0xa0a9('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0a9('0xf')]);router[_0xa0a9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x11')]);router[_0xa0a9('0x12')]('/:id',auth[_0xa0a9('0x7')](),controller['destroy']);module[_0xa0a9('0x13')]=router; \ No newline at end of file +var _0xd2ea=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0xd2ea,0x15f));var _0xad2e=function(_0x555fb7,_0x4d894e){_0x555fb7=_0x555fb7-0x0;var _0x9348f1=_0xd2ea[_0x555fb7];return _0x9348f1;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var auth=require(_0xad2e('0x5'));var interaction=require(_0xad2e('0x6'));var config=require(_0xad2e('0x7'));var controller=require(_0xad2e('0x8'));router[_0xad2e('0x9')]('/',auth[_0xad2e('0xa')](),controller[_0xad2e('0xb')]);router['get'](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller[_0xad2e('0xd')]);router['post'](_0xad2e('0xe'),auth[_0xad2e('0xa')](),controller['clone']);router[_0xad2e('0xf')]('/',auth['isAuthenticated'](),controller[_0xad2e('0x10')]);router[_0xad2e('0x11')](_0xad2e('0xc'),auth[_0xad2e('0xa')](),controller['update']);router[_0xad2e('0x12')]('/:id',auth[_0xad2e('0xa')](),controller[_0xad2e('0x13')]);module[_0xad2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 1dcfa4f..577c647 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 _0xee62=['transport','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join'];(function(_0x4a9b0e,_0x13ae85){var _0x4e83a9=function(_0x597fa4){while(--_0x597fa4){_0x4a9b0e['push'](_0x4a9b0e['shift']());}};_0x4e83a9(++_0x13ae85);}(_0xee62,0x12c));var _0x2ee6=function(_0xe82fdc,_0x542530){_0xe82fdc=_0xe82fdc-0x0;var _0x266382=_0xee62[_0xe82fdc];return _0x266382;};'use strict';var Sequelize=require(_0x2ee6('0x0'));module[_0x2ee6('0x1')]={'name':{'type':Sequelize[_0x2ee6('0x2')],'allowNull':![],'unique':_0x2ee6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2ee6('0x4'),_0x2ee6('0x5'),_0x2ee6('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2ee6('0x7')},'callingpres':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x9'),_0x2ee6('0xa'),_0x2ee6('0xb'),'ALLOWED','PROHIB_NOT_SCREENED',_0x2ee6('0xc'),_0x2ee6('0xd'),_0x2ee6('0xe'))},'deny':{'type':Sequelize[_0x2ee6('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x2ee6('0x2')]},'md5secret':{'type':Sequelize[_0x2ee6('0x2')]},'remotesecret':{'type':Sequelize[_0x2ee6('0x2')]},'transport':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':_0x2ee6('0xf'),'set':function(_0x55f0c8){this[_0x2ee6('0x10')]('transport',_0x55f0c8?_0x55f0c8[_0x2ee6('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x2ee6('0x12'))?this[_0x2ee6('0x13')](_0x2ee6('0x12'))[_0x2ee6('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x2ee6('0x15'),_0x2ee6('0x16'),_0x2ee6('0x17'),_0x2ee6('0x18'),_0x2ee6('0x19')),'defaultValue':_0x2ee6('0x15')},'directmedia':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no',_0x2ee6('0x1b'),_0x2ee6('0x1c'),_0x2ee6('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2ee6('0x2')]},'directmediadeny':{'type':Sequelize[_0x2ee6('0x2')]},'nat':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':_0x2ee6('0x1e'),'set':function(_0x3d6f84){this['setDataValue'](_0x2ee6('0x1f'),_0x3d6f84?_0x3d6f84[_0x2ee6('0x11')](','):null);},'get':function(){return this[_0x2ee6('0x13')](_0x2ee6('0x1f'))?this[_0x2ee6('0x13')]('nat')[_0x2ee6('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x2ee6('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2ee6('0x2')]},'pickupgroup':{'type':Sequelize[_0x2ee6('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2ee6('0x2')]},'language':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2ee6('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2ee6('0x20')},'allow':{'type':Sequelize[_0x2ee6('0x2')],'allowNull':![],'defaultValue':_0x2ee6('0x21'),'set':function(_0x3536d5){this[_0x2ee6('0x10')](_0x2ee6('0x22'),_0x3536d5?_0x3536d5[_0x2ee6('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x2ee6('0x22'))?this[_0x2ee6('0x13')](_0x2ee6('0x22'))[_0x2ee6('0x14')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'insecure':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':_0x2ee6('0x23'),'set':function(_0x1a4f11){this[_0x2ee6('0x10')](_0x2ee6('0x24'),_0x1a4f11?_0x1a4f11[_0x2ee6('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x2ee6('0x24'))?this[_0x2ee6('0x13')](_0x2ee6('0x24'))[_0x2ee6('0x14')](','):null;},'comment':_0x2ee6('0x25')},'trustrpid':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no',_0x2ee6('0x26'))},'promiscredir':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x2ee6('0x2')]},'callerid':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':_0x2ee6('0x27')},'amaflags':{'type':Sequelize[_0x2ee6('0x2')]},'callcounter':{'type':Sequelize[_0x2ee6('0x8')]('yes','no'),'defaultValue':_0x2ee6('0x1a')},'busylevel':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0x2ee6('0x8')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x2ee6('0x8')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x2ee6('0x2')]},'template':{'type':Sequelize[_0x2ee6('0x2')]},'videosupport':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no',_0x2ee6('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x2ee6('0x2')]},'session_timers':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x2a'),_0x2ee6('0x2b'),_0x2ee6('0x2c'))},'session_expires':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2ee6('0x2d'),_0x2ee6('0x2e')),'defaultValue':_0x2ee6('0x2e')},'t38pt_usertpsource':{'type':Sequelize[_0x2ee6('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x2ee6('0x2')]},'port':{'type':Sequelize[_0x2ee6('0x28')](0x5)},'qualify':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':_0x2ee6('0x1a')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x2ee6('0x2')]},'defaultuser':{'type':Sequelize[_0x2ee6('0x2')]},'rtptimeout':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2ee6('0x2')]},'callbackextension':{'type':Sequelize[_0x2ee6('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x2ee6('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2ee6('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2ee6('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2ee6('0x2')]},'maxforwards':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'encryption':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x2ee6('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2ee6('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2ee6('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2ee6('0x2')]},'dtlscapath':{'type':Sequelize[_0x2ee6('0x2')]},'dtlssetup':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x2f'),_0x2ee6('0x30'),_0x2ee6('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2ee6('0x2')]},'recordofffeature':{'type':Sequelize[_0x2ee6('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x2ee6('0x8')](_0x2ee6('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x2ee6('0x2')]},'mohinterpret':{'type':Sequelize[_0x2ee6('0x2')]},'mohsuggest':{'type':Sequelize[_0x2ee6('0x2')]},'parkinglot':{'type':Sequelize[_0x2ee6('0x2')]},'description':{'type':Sequelize[_0x2ee6('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2ee6('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0x2ee6('0x1a'),'no',_0x2ee6('0x1b'),_0x2ee6('0x1c'),_0x2ee6('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2ee6('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2ee6('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2ee6('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x036e=['friend','user','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update,nonat','sequelize','exports','STRING','ENUM'];(function(_0x16cc69,_0x49b16d){var _0x2e65c8=function(_0x21fd8b){while(--_0x21fd8b){_0x16cc69['push'](_0x16cc69['shift']());}};_0x2e65c8(++_0x49b16d);}(_0x036e,0x128));var _0xe036=function(_0x3a71c3,_0x3ddcf4){_0x3a71c3=_0x3a71c3-0x0;var _0x41f2ee=_0x036e[_0x3a71c3];return _0x41f2ee;};'use strict';var Sequelize=require(_0xe036('0x0'));module[_0xe036('0x1')]={'name':{'type':Sequelize[_0xe036('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x4'),_0xe036('0x5'),_0xe036('0x6')),'allowNull':![],'defaultValue':_0xe036('0x4')},'context':{'type':Sequelize[_0xe036('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xe036('0x3')]('ALLOWED_NOT_SCREENED',_0xe036('0x7'),_0xe036('0x8'),_0xe036('0x9'),_0xe036('0xa'),_0xe036('0xb'),_0xe036('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xe036('0x2')]},'permit':{'type':Sequelize[_0xe036('0x2')]},'secret':{'type':Sequelize[_0xe036('0x2')]},'md5secret':{'type':Sequelize[_0xe036('0x2')]},'remotesecret':{'type':Sequelize[_0xe036('0x2')]},'transport':{'type':Sequelize[_0xe036('0x2')],'defaultValue':_0xe036('0xd'),'set':function(_0x1040c3){this[_0xe036('0xe')](_0xe036('0xf'),_0x1040c3?_0x1040c3[_0xe036('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xe036('0xf'))?this[_0xe036('0x11')](_0xe036('0xf'))[_0xe036('0x12')](','):null;},'comment':_0xe036('0x13')},'dtmfmode':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x14'),_0xe036('0x15'),_0xe036('0x16'),_0xe036('0x17'),'auto'),'defaultValue':_0xe036('0x14')},'directmedia':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no','nonat',_0xe036('0x19'),_0xe036('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe036('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe036('0x2')]},'directmediadeny':{'type':Sequelize[_0xe036('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xe036('0x1b'),'set':function(_0x424260){this['setDataValue']('nat',_0x424260?_0x424260[_0xe036('0x10')](','):null);},'get':function(){return this[_0xe036('0x11')](_0xe036('0x1c'))?this[_0xe036('0x11')](_0xe036('0x1c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe036('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe036('0x2')]},'pickupgroup':{'type':Sequelize[_0xe036('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xe036('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe036('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe036('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe036('0x1d'),'set':function(_0x1be3d5){this[_0xe036('0xe')](_0xe036('0x1e'),_0x1be3d5?_0x1be3d5[_0xe036('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xe036('0x11')](_0xe036('0x1e'))?this[_0xe036('0x11')](_0xe036('0x1e'))['split'](';'):null;},'comment':_0xe036('0x1f')},'autoframing':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xe036('0x20'),'set':function(_0x3ff500){this[_0xe036('0xe')]('insecure',_0x3ff500?_0x3ff500['join'](','):null);},'get':function(){return this[_0xe036('0x11')](_0xe036('0x21'))?this['getDataValue'](_0xe036('0x21'))[_0xe036('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe036('0x3')]('yes','no',_0xe036('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no')},'accountcode':{'type':Sequelize[_0xe036('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xe036('0x24')},'amaflags':{'type':Sequelize[_0xe036('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no'),'defaultValue':_0xe036('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xe036('0x2')]},'template':{'type':Sequelize[_0xe036('0x2')]},'videosupport':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no',_0xe036('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe036('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x26'),'refuse',_0xe036('0x27'))},'session_expires':{'type':Sequelize[_0xe036('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xe036('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xe036('0x3')]('uac',_0xe036('0x28')),'defaultValue':_0xe036('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0xe036('0x2')]},'regexten':{'type':Sequelize[_0xe036('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xe036('0x2')]},'port':{'type':Sequelize[_0xe036('0x23')](0x5)},'qualify':{'type':Sequelize[_0xe036('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xe036('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xe036('0x2')]},'defaultuser':{'type':Sequelize[_0xe036('0x2')]},'rtptimeout':{'type':Sequelize[_0xe036('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe036('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe036('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no',_0xe036('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe036('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xe036('0x23')](0xb)},'timerb':{'type':Sequelize[_0xe036('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe036('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xe036('0x2')]},'contactdeny':{'type':Sequelize[_0xe036('0x2')]},'contactacl':{'type':Sequelize[_0xe036('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xe036('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'force_avp':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0xe036('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xe036('0x3')]('yes','no',_0xe036('0x2a'),_0xe036('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xe036('0x2')]},'dtlscipher':{'type':Sequelize[_0xe036('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xe036('0x2')]},'dtlssetup':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x2c'),_0xe036('0x2d'),_0xe036('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe036('0x2')]},'usereqphone':{'type':Sequelize[_0xe036('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe036('0x2')]},'recordofffeature':{'type':Sequelize[_0xe036('0x2')]},'call_limit':{'type':Sequelize[_0xe036('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no')},'vmexten':{'type':Sequelize[_0xe036('0x2')]},'mohinterpret':{'type':Sequelize[_0xe036('0x2')]},'mohsuggest':{'type':Sequelize[_0xe036('0x2')]},'parkinglot':{'type':Sequelize[_0xe036('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xe036('0x2f')},'canreinvite':{'type':Sequelize[_0xe036('0x3')](_0xe036('0x18'),'no',_0xe036('0x30'),_0xe036('0x19'),_0xe036('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xe036('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe036('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 8ed6622..61af428 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 _0x8227=['ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','apply','save','destroy','Trunks','UserProfileResource','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','Trunk','includeAll','include','findAll','rows','show','params','options','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','readFileSync','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x506e5d,_0x5a8473){var _0x458646=function(_0x2a9219){while(--_0x2a9219){_0x506e5d['push'](_0x506e5d['shift']());}};_0x458646(++_0x5a8473);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7822('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7822('0x1'));var jsonpatch=require(_0x7822('0x2'));var rp=require(_0x7822('0x3'));var moment=require(_0x7822('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7822('0x5'));var util=require(_0x7822('0x6'));var path=require(_0x7822('0x7'));var sox=require(_0x7822('0x8'));var csv=require(_0x7822('0x9'));var ejs=require(_0x7822('0xa'));var fs=require('fs');var _=require(_0x7822('0xb'));var squel=require(_0x7822('0xc'));var crypto=require('crypto');var jsforce=require(_0x7822('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7822('0x9'));var querystring=require(_0x7822('0xe'));var Papa=require(_0x7822('0xf'));var Redis=require(_0x7822('0x10'));var authService=require(_0x7822('0x11'));var qs=require(_0x7822('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7822('0x13'))('api');var utils=require(_0x7822('0x14'));var config=require(_0x7822('0x15'));var db=require(_0x7822('0x16'))['db'];var jayson=require(_0x7822('0x17'));var client=jayson[_0x7822('0x18')][_0x7822('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5e4623,_0x58f462,_0xb0b5c){if(_0xb0b5c){var _0x10703c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10703c['test'](_0x58f462)){return _0x5e4623;}else{throw new db[(_0x7822('0x1a'))][(_0x7822('0x1b'))](_0x7822('0x1c'));}}else{return _0x5e4623;}}function respondWithRpcPromise(_0x438b8d,_0x411d99,_0x5c13de,_0x4a8b06){return new BPromise(function(_0x154c49,_0x228381){var _0x65b961=_0x4a8b06||client;return _0x65b961[_0x7822('0x1d')](_0x438b8d,_0x5c13de)[_0x7822('0x1e')](function(_0x9ec4ee){logger[_0x7822('0x1f')](_0x7822('0x20'),_0x411d99,_0x7822('0x21'));logger[_0x7822('0x22')](_0x7822('0x23'),_0x411d99,_0x7822('0x21'),JSON[_0x7822('0x24')](_0x9ec4ee));if(_0x9ec4ee[_0x7822('0x25')]){if(_0x9ec4ee[_0x7822('0x25')][_0x7822('0x26')]===0x1f4){logger['error'](_0x7822('0x20'),_0x411d99,_0x9ec4ee[_0x7822('0x25')][_0x7822('0x27')]);return _0x228381(_0x9ec4ee[_0x7822('0x25')][_0x7822('0x27')]);}logger['error'](_0x7822('0x20'),_0x411d99,_0x9ec4ee['error']['message']);return _0x154c49(_0x9ec4ee[_0x7822('0x25')][_0x7822('0x27')]);}else{logger[_0x7822('0x1f')](_0x7822('0x20'),_0x411d99,'request\x20sent');_0x154c49(_0x9ec4ee['result'][_0x7822('0x27')]);}})[_0x7822('0x28')](function(_0x12e581){logger['error'](_0x7822('0x20'),_0x411d99,_0x12e581);_0x228381(_0x12e581);});});}function respondWithStatusCode(_0x202c97,_0x47c424){_0x47c424=_0x47c424||0xcc;return function(_0x4bbcae){if(_0x4bbcae){return _0x202c97[_0x7822('0x29')](_0x47c424);}return _0x202c97[_0x7822('0x2a')](_0x47c424)['end']();};}function respondWithResult(_0x20bc5a,_0xef55f2){_0xef55f2=_0xef55f2||0xc8;return function(_0x30d46d){if(_0x30d46d){return _0x20bc5a[_0x7822('0x2a')](_0xef55f2)[_0x7822('0x2b')](_0x30d46d);}};}function respondWithFilteredResult(_0x324258,_0x54aa99){return function(_0x2dd015){if(_0x2dd015){var _0x190cb2=_0x2dd015[_0x7822('0x2c')],_0x19173e=_0x54aa99[_0x7822('0x2d')],_0x8ce726=_0x54aa99[_0x7822('0x2d')]+_0x54aa99[_0x7822('0x2e')],_0x3df5ff;if(_0x8ce726>=_0x190cb2){_0x8ce726=_0x190cb2;_0x3df5ff=0xc8;}else{_0x3df5ff=0xce;}_0x324258['status'](_0x3df5ff);return _0x324258['set']('Content-Range',_0x19173e+'-'+_0x8ce726+'/'+_0x190cb2)[_0x7822('0x2b')](_0x2dd015);}return null;};}function patchUpdates(_0x2fe314){return function(_0x53e41a){try{jsonpatch[_0x7822('0x2f')](_0x53e41a,_0x2fe314,!![]);}catch(_0x1b072f){return BPromise['reject'](_0x1b072f);}return _0x53e41a[_0x7822('0x30')]();};}function saveUpdates(_0xe6e88,_0x11c9c4){return function(_0x56b2fb){if(_0x56b2fb){return _0x56b2fb['update'](_0xe6e88)[_0x7822('0x1e')](function(_0x48b1df){return _0x48b1df;});}return null;};}function removeEntity(_0x4792f5,_0x22357a){return function(_0x54544b){if(_0x54544b){return _0x54544b[_0x7822('0x31')]()[_0x7822('0x1e')](function(){var _0x188702=_0x54544b['get']({'plain':!![]});var _0x37a9c8=_0x7822('0x32');return db[_0x7822('0x33')][_0x7822('0x31')]({'where':{'type':_0x37a9c8,'resourceId':_0x188702['id']}})[_0x7822('0x1e')](function(){return _0x54544b;});})[_0x7822('0x1e')](function(){_0x4792f5[_0x7822('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2b1f,_0x2746fb){return function(_0x1d9ef8){if(!_0x1d9ef8){_0x1c2b1f[_0x7822('0x29')](0x194);}return _0x1d9ef8;};}function handleError(_0x4481c0,_0x47b3bf){_0x47b3bf=_0x47b3bf||0x1f4;return function(_0x5cf6a3){logger[_0x7822('0x25')](_0x5cf6a3['stack']);if(_0x5cf6a3[_0x7822('0x34')]){delete _0x5cf6a3[_0x7822('0x34')];}_0x4481c0[_0x7822('0x2a')](_0x47b3bf)[_0x7822('0x35')](_0x5cf6a3);};}exports['index']=function(_0x569434,_0x1dceac){var _0x33f4ab={},_0x5a6cf0={},_0x7399f5={'count':0x0,'rows':[]};var _0x44fced=_['map'](db['Trunk'][_0x7822('0x36')],function(_0x41d628){return{'name':_0x41d628[_0x7822('0x37')],'type':_0x41d628['type'][_0x7822('0x38')]};});_0x5a6cf0[_0x7822('0x39')]=_[_0x7822('0x3a')](_0x44fced,_0x7822('0x34'));_0x5a6cf0[_0x7822('0x3b')]=_[_0x7822('0x3c')](_0x569434['query']);_0x5a6cf0[_0x7822('0x3d')]=_[_0x7822('0x3e')](_0x5a6cf0[_0x7822('0x39')],_0x5a6cf0[_0x7822('0x3b')]);_0x33f4ab[_0x7822('0x3f')]=_['intersection'](_0x5a6cf0[_0x7822('0x39')],qs[_0x7822('0x40')](_0x569434[_0x7822('0x3b')][_0x7822('0x40')]));_0x33f4ab['attributes']=_0x33f4ab[_0x7822('0x3f')][_0x7822('0x41')]?_0x33f4ab['attributes']:_0x5a6cf0[_0x7822('0x39')];if(!_0x569434[_0x7822('0x3b')][_0x7822('0x42')](_0x7822('0x43'))){_0x33f4ab[_0x7822('0x2e')]=qs[_0x7822('0x2e')](_0x569434['query'][_0x7822('0x2e')]);_0x33f4ab[_0x7822('0x2d')]=qs['offset'](_0x569434[_0x7822('0x3b')]['offset']);}_0x33f4ab[_0x7822('0x44')]=qs[_0x7822('0x45')](_0x569434[_0x7822('0x3b')][_0x7822('0x45')]);_0x33f4ab[_0x7822('0x46')]=qs[_0x7822('0x3d')](_[_0x7822('0x47')](_0x569434[_0x7822('0x3b')],_0x5a6cf0[_0x7822('0x3d')]),_0x44fced);if(_0x569434['query']['filter']){_0x33f4ab[_0x7822('0x46')]=_['merge'](_0x33f4ab['where'],{'$or':_[_0x7822('0x3a')](_0x44fced,function(_0xf82992){if(_0xf82992[_0x7822('0x48')]!==_0x7822('0x49')){var _0x384061={};_0x384061[_0xf82992[_0x7822('0x34')]]={'$like':'%'+_0x569434[_0x7822('0x3b')][_0x7822('0x4a')]+'%'};return _0x384061;}})});}_0x33f4ab=_[_0x7822('0x4b')]({},_0x33f4ab,_0x569434['options']);var _0x39c79c={'where':_0x33f4ab[_0x7822('0x46')]};return db[_0x7822('0x4c')][_0x7822('0x2c')](_0x39c79c)[_0x7822('0x1e')](function(_0x3c1707){_0x7399f5['count']=_0x3c1707;if(_0x569434[_0x7822('0x3b')][_0x7822('0x4d')]){_0x33f4ab[_0x7822('0x4e')]=[{'all':!![]}];}return db[_0x7822('0x4c')][_0x7822('0x4f')](_0x33f4ab);})[_0x7822('0x1e')](function(_0x34c682){_0x7399f5[_0x7822('0x50')]=_0x34c682;return _0x7399f5;})['then'](respondWithFilteredResult(_0x1dceac,_0x33f4ab))['catch'](handleError(_0x1dceac,null));};exports[_0x7822('0x51')]=function(_0x5010f1,_0x1452b2){var _0x415a11={'raw':![],'where':{'id':_0x5010f1[_0x7822('0x52')]['id']}},_0x41809b={};_0x41809b['model']=_[_0x7822('0x3c')](db[_0x7822('0x4c')][_0x7822('0x36')]);_0x41809b['query']=_[_0x7822('0x3c')](_0x5010f1[_0x7822('0x3b')]);_0x41809b[_0x7822('0x3d')]=_[_0x7822('0x3e')](_0x41809b['model'],_0x41809b['query']);_0x415a11['attributes']=_[_0x7822('0x3e')](_0x41809b[_0x7822('0x39')],qs[_0x7822('0x40')](_0x5010f1[_0x7822('0x3b')][_0x7822('0x40')]));_0x415a11['attributes']=_0x415a11[_0x7822('0x3f')][_0x7822('0x41')]?_0x415a11[_0x7822('0x3f')]:_0x41809b[_0x7822('0x39')];if(_0x5010f1[_0x7822('0x3b')][_0x7822('0x4d')]){_0x415a11[_0x7822('0x4e')]=[{'all':!![]}];}_0x415a11=_[_0x7822('0x4b')]({},_0x415a11,_0x5010f1[_0x7822('0x53')]);return db[_0x7822('0x4c')][_0x7822('0x54')](_0x415a11)[_0x7822('0x1e')](handleEntityNotFound(_0x1452b2,null))['then'](respondWithResult(_0x1452b2,null))['catch'](handleError(_0x1452b2,null));};exports['clone']=function(_0x2f4723,_0x19a673){var _0x4803dd={'where':{'id':_0x2f4723[_0x7822('0x52')]['id']}},_0x351951={};_0x351951[_0x7822('0x39')]=_[_0x7822('0x3c')](db[_0x7822('0x4c')][_0x7822('0x36')]);_0x4803dd['attributes']=_[_0x7822('0x3e')](_0x351951[_0x7822('0x39')],qs[_0x7822('0x40')](_0x2f4723['query'][_0x7822('0x40')]));_0x4803dd[_0x7822('0x3f')]=_0x4803dd['attributes'][_0x7822('0x41')]?_0x4803dd[_0x7822('0x3f')]:_0x351951['model'];if(_0x2f4723[_0x7822('0x3b')][_0x7822('0x4d')]){_0x4803dd[_0x7822('0x4e')]=[{'all':!![]}];}_0x4803dd=_[_0x7822('0x4b')]({},_0x4803dd,_0x2f4723[_0x7822('0x53')]);return db[_0x7822('0x4c')][_0x7822('0x54')](_0x4803dd)[_0x7822('0x1e')](handleEntityNotFound(_0x19a673,null))[_0x7822('0x1e')](function(_0x4ffcd3){if(_0x4ffcd3){var _0x1aca64=_0x4ffcd3[_0x7822('0x55')]({'plain':!![]});_0x1aca64=qs[_0x7822('0x56')](_0x1aca64,['id',_0x7822('0x57'),_0x7822('0x58')]);_0x2f4723[_0x7822('0x59')]=_['omit'](_0x2f4723[_0x7822('0x59')],['id','createdAt',_0x7822('0x58')]);return db[_0x7822('0x4c')][_0x7822('0x5a')](_[_0x7822('0x4b')](_0x1aca64,_0x2f4723[_0x7822('0x59')]),{'include':_0x2f4723[_0x7822('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0x7822('0x1e')](function(_0x112727){var _0x280c65=_0x2f4723[_0x7822('0x5b')]['get']({'plain':!![]});if(!_0x280c65)throw new Error(_0x7822('0x5c'));if(_0x280c65[_0x7822('0x5d')]===_0x7822('0x5b')){var _0x3faaea=_0x112727[_0x7822('0x55')]({'plain':!![]});var _0x50be76=_0x7822('0x32');return db[_0x7822('0x5e')][_0x7822('0x54')]({'where':{'name':_0x50be76,'userProfileId':_0x280c65[_0x7822('0x5f')]},'raw':!![]})[_0x7822('0x1e')](function(_0x540a8a){if(_0x540a8a&&_0x540a8a[_0x7822('0x60')]===0x0){return db[_0x7822('0x33')][_0x7822('0x5a')]({'name':_0x3faaea[_0x7822('0x34')],'resourceId':_0x3faaea['id'],'type':_0x540a8a[_0x7822('0x34')],'sectionId':_0x540a8a['id']},{})[_0x7822('0x1e')](function(){return _0x112727;});}else{return _0x112727;}})[_0x7822('0x28')](function(_0x402950){logger[_0x7822('0x25')](_0x7822('0x61'),_0x402950);throw _0x402950;});}return _0x112727;});}})[_0x7822('0x1e')](respondWithResult(_0x19a673,0xc9))[_0x7822('0x28')](handleError(_0x19a673,null));};exports['create']=function(_0x4b3186,_0x2e1b20,_0x653181){var _0x41bf9a;return db[_0x7822('0x4c')][_0x7822('0x5a')](_0x4b3186[_0x7822('0x59')],{'raw':!![]})[_0x7822('0x1e')](function(_0xaf30a){_0x41bf9a=_0xaf30a;return db[_0x7822('0x4c')][_0x7822('0x4f')]({'raw':!![]});})[_0x7822('0x1e')](function(_0x17d51f){var _0x56bf33=fs['readFileSync'](path[_0x7822('0x62')](config[_0x7822('0x63')],'server/files/templates/trunk.ejs'),'utf8');var _0x3f4a72=fs[_0x7822('0x64')](path['join'](config['root'],_0x7822('0x65')),_0x7822('0x66'));var _0x30f0f7=ejs[_0x7822('0x67')](_0x56bf33,{'trunks':_0x17d51f||[]});fs['writeFileSync'](_0x7822('0x68'),_0x30f0f7);if(_0x41bf9a[_0x7822('0x69')]){var _0x25c7e2=ejs[_0x7822('0x67')](_0x3f4a72,{'trunks':_0x17d51f||[]});fs[_0x7822('0x6a')](_0x7822('0x6b'),_0x25c7e2);}})[_0x7822('0x1e')](function(){return respondWithRpcPromise(_0x7822('0x6c'),_0x7822('0x5a'),{'module':_0x7822('0x6d')});})['then'](function(){var _0x4b8aad=_0x4b3186[_0x7822('0x5b')][_0x7822('0x55')]({'plain':!![]});if(!_0x4b8aad)throw new Error(_0x7822('0x5c'));if(_0x4b8aad[_0x7822('0x5d')]===_0x7822('0x5b')){var _0x2ee80e=_0x41bf9a[_0x7822('0x55')]({'plain':!![]});return db[_0x7822('0x5e')][_0x7822('0x54')]({'where':{'name':_0x7822('0x32'),'userProfileId':_0x4b8aad[_0x7822('0x5f')]},'raw':!![]})['then'](function(_0x1001bd){if(_0x1001bd&&_0x1001bd[_0x7822('0x60')]===0x0){return db['UserProfileResource'][_0x7822('0x5a')]({'name':_0x2ee80e['name'],'resourceId':_0x2ee80e['id'],'type':_0x1001bd['name'],'sectionId':_0x1001bd['id']},{})[_0x7822('0x1e')](function(){return _0x41bf9a;});}else{return _0x41bf9a;}})[_0x7822('0x28')](function(_0x2bbf57){logger[_0x7822('0x25')](_0x7822('0x61'),_0x2bbf57);throw _0x2bbf57;});}return _0x41bf9a;})[_0x7822('0x1e')](respondWithResult(_0x2e1b20,0xc9))[_0x7822('0x28')](handleError(_0x2e1b20,null));};exports[_0x7822('0x6e')]=function(_0x3d6342,_0x56d6b8,_0x5d74b6){var _0xff3812;return db['Trunk']['find']({'where':{'id':_0x3d6342[_0x7822('0x52')]['id']}})[_0x7822('0x1e')](handleEntityNotFound(_0x56d6b8,null))[_0x7822('0x1e')](saveUpdates(_0x3d6342[_0x7822('0x59')],null))[_0x7822('0x1e')](function(_0x1eb6f0){if(_0x1eb6f0){_0xff3812=_0x1eb6f0;return db[_0x7822('0x4c')][_0x7822('0x4f')]({'raw':!![]});}})['then'](function(_0x5103ed){if(_0x5103ed){var _0x5d2b19=fs[_0x7822('0x64')](path[_0x7822('0x62')](config['root'],_0x7822('0x6f')),_0x7822('0x66'));var _0x3a3ae1=fs[_0x7822('0x64')](path['join'](config[_0x7822('0x63')],_0x7822('0x65')),'utf8');var _0x530484=ejs[_0x7822('0x67')](_0x5d2b19,{'trunks':_0x5103ed||[]});fs[_0x7822('0x6a')](_0x7822('0x68'),_0x530484);var _0x13f536=ejs[_0x7822('0x67')](_0x3a3ae1,{'trunks':_0x5103ed||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x13f536);return respondWithRpcPromise(_0x7822('0x6c'),_0x7822('0x6e'),{'module':_0x7822('0x6d')});}return null;})[_0x7822('0x1e')](function(_0x5d770b){if(_0x5d770b){return _0xff3812;}})['then'](respondWithResult(_0x56d6b8,null))[_0x7822('0x28')](handleError(_0x56d6b8,null));};exports[_0x7822('0x31')]=function(_0x5c9f6e,_0x548ad5,_0x1cc540){var _0x654da7;return db[_0x7822('0x4c')][_0x7822('0x54')]({'where':{'id':_0x5c9f6e['params']['id']}})[_0x7822('0x1e')](handleEntityNotFound(_0x548ad5,null))[_0x7822('0x1e')](removeEntity(_0x548ad5,null))[_0x7822('0x1e')](function(){return db[_0x7822('0x4c')][_0x7822('0x4f')]({'raw':!![]});})['then'](function(_0x141e31){var _0x20e7a0=fs[_0x7822('0x64')](path[_0x7822('0x62')](config[_0x7822('0x63')],_0x7822('0x6f')),_0x7822('0x66'));var _0x4eb624=fs[_0x7822('0x64')](path[_0x7822('0x62')](config[_0x7822('0x63')],_0x7822('0x65')),_0x7822('0x66'));var _0x249d1b=ejs['render'](_0x20e7a0,{'trunks':_0x141e31});var _0x24692a=ejs['render'](_0x4eb624,{'trunks':_0x141e31});fs['writeFileSync'](_0x7822('0x68'),_0x249d1b);fs['writeFileSync'](_0x7822('0x6b'),_0x24692a);return respondWithRpcPromise(_0x7822('0x6c'),_0x7822('0x31'),{'module':_0x7822('0x6d')});})[_0x7822('0x28')](handleError(_0x548ad5,null));}; \ No newline at end of file +var _0xf7b4=['render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','join','server/files/templates/registry.ejs','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','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','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','key','keys','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','merge','options','Trunk','includeAll','include','findAll','rows','catch','show','params','length','find','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','utf8'];(function(_0x58649b,_0x22c03b){var _0x423588=function(_0x3e2b83){while(--_0x3e2b83){_0x58649b['push'](_0x58649b['shift']());}};_0x423588(++_0x22c03b);}(_0xf7b4,0x152));var _0x4f7b=function(_0xba9332,_0x4b4a65){_0xba9332=_0xba9332-0x0;var _0x4ef1ba=_0xf7b4[_0xba9332];return _0x4ef1ba;};'use strict';var pdf=require(_0x4f7b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f7b('0x1'));var jsonpatch=require(_0x4f7b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4f7b('0x3'));var Mustache=require(_0x4f7b('0x4'));var util=require(_0x4f7b('0x5'));var path=require(_0x4f7b('0x6'));var sox=require(_0x4f7b('0x7'));var csv=require(_0x4f7b('0x8'));var ejs=require(_0x4f7b('0x9'));var fs=require('fs');var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x8'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x4f7b('0x17')][_0x4f7b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x3c55e1,_0x41a050,_0x4f7c2b){if(_0x4f7c2b){var _0x889894=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x889894[_0x4f7b('0x19')](_0x41a050)){return _0x3c55e1;}else{throw new db[(_0x4f7b('0x1a'))][(_0x4f7b('0x1b'))](_0x4f7b('0x1c'));}}else{return _0x3c55e1;}}function respondWithRpcPromise(_0x330de9,_0x40ecb0,_0x2437cc,_0x260667){return new BPromise(function(_0x29fdd5,_0x1a28b8){var _0x1e7afc=_0x260667||client;return _0x1e7afc['request'](_0x330de9,_0x2437cc)[_0x4f7b('0x1d')](function(_0x496322){logger['info'](_0x4f7b('0x1e'),_0x40ecb0,_0x4f7b('0x1f'));logger['debug'](_0x4f7b('0x20'),_0x40ecb0,_0x4f7b('0x1f'),JSON[_0x4f7b('0x21')](_0x496322));if(_0x496322[_0x4f7b('0x22')]){if(_0x496322['error'][_0x4f7b('0x23')]===0x1f4){logger['error'](_0x4f7b('0x1e'),_0x40ecb0,_0x496322[_0x4f7b('0x22')][_0x4f7b('0x24')]);return _0x1a28b8(_0x496322[_0x4f7b('0x22')][_0x4f7b('0x24')]);}logger[_0x4f7b('0x22')](_0x4f7b('0x1e'),_0x40ecb0,_0x496322[_0x4f7b('0x22')][_0x4f7b('0x24')]);return _0x29fdd5(_0x496322['error'][_0x4f7b('0x24')]);}else{logger[_0x4f7b('0x25')](_0x4f7b('0x1e'),_0x40ecb0,'request\x20sent');_0x29fdd5(_0x496322[_0x4f7b('0x26')][_0x4f7b('0x24')]);}})['catch'](function(_0x15dbec){logger['error'](_0x4f7b('0x1e'),_0x40ecb0,_0x15dbec);_0x1a28b8(_0x15dbec);});});}function respondWithStatusCode(_0x2429be,_0x23c820){_0x23c820=_0x23c820||0xcc;return function(_0x278c41){if(_0x278c41){return _0x2429be[_0x4f7b('0x27')](_0x23c820);}return _0x2429be[_0x4f7b('0x28')](_0x23c820)[_0x4f7b('0x29')]();};}function respondWithResult(_0x3ad769,_0x4ec9a3){_0x4ec9a3=_0x4ec9a3||0xc8;return function(_0x6c9626){if(_0x6c9626){return _0x3ad769[_0x4f7b('0x28')](_0x4ec9a3)[_0x4f7b('0x2a')](_0x6c9626);}};}function respondWithFilteredResult(_0x5c6c3e,_0x19da29){return function(_0x336739){if(_0x336739){var _0x1db684=_0x336739[_0x4f7b('0x2b')],_0x3a56ff=_0x19da29[_0x4f7b('0x2c')],_0x1ccce0=_0x19da29[_0x4f7b('0x2c')]+_0x19da29['limit'],_0x4ebffa;if(_0x1ccce0>=_0x1db684){_0x1ccce0=_0x1db684;_0x4ebffa=0xc8;}else{_0x4ebffa=0xce;}_0x5c6c3e[_0x4f7b('0x28')](_0x4ebffa);return _0x5c6c3e['set']('Content-Range',_0x3a56ff+'-'+_0x1ccce0+'/'+_0x1db684)[_0x4f7b('0x2a')](_0x336739);}return null;};}function patchUpdates(_0x52a5b1){return function(_0x1aad4b){try{jsonpatch[_0x4f7b('0x2d')](_0x1aad4b,_0x52a5b1,!![]);}catch(_0x22f489){return BPromise[_0x4f7b('0x2e')](_0x22f489);}return _0x1aad4b[_0x4f7b('0x2f')]();};}function saveUpdates(_0x4e5862,_0x13a113){return function(_0x179372){if(_0x179372){return _0x179372[_0x4f7b('0x30')](_0x4e5862)[_0x4f7b('0x1d')](function(_0x1c133d){return _0x1c133d;});}return null;};}function removeEntity(_0x8d3266,_0x3e7fb4){return function(_0x121923){if(_0x121923){return _0x121923[_0x4f7b('0x31')]()[_0x4f7b('0x1d')](function(){var _0x32e039=_0x121923[_0x4f7b('0x32')]({'plain':!![]});var _0x35f1ed=_0x4f7b('0x33');return db[_0x4f7b('0x34')][_0x4f7b('0x31')]({'where':{'type':_0x35f1ed,'resourceId':_0x32e039['id']}})['then'](function(){return _0x121923;});})[_0x4f7b('0x1d')](function(){_0x8d3266['status'](0xcc)[_0x4f7b('0x29')]();});}};}function handleEntityNotFound(_0x4005ad,_0x579ad4){return function(_0xa28dab){if(!_0xa28dab){_0x4005ad[_0x4f7b('0x27')](0x194);}return _0xa28dab;};}function handleError(_0x1347b6,_0x584b25){_0x584b25=_0x584b25||0x1f4;return function(_0x38b463){logger[_0x4f7b('0x22')](_0x38b463[_0x4f7b('0x35')]);if(_0x38b463[_0x4f7b('0x36')]){delete _0x38b463[_0x4f7b('0x36')];}_0x1347b6[_0x4f7b('0x28')](_0x584b25)[_0x4f7b('0x37')](_0x38b463);};}exports['index']=function(_0x90b979,_0x486187){var _0x26fe5b={},_0x14d1f3={},_0xa9143c={'count':0x0,'rows':[]};var _0x593ec2=_[_0x4f7b('0x38')](db['Trunk'][_0x4f7b('0x39')],function(_0x16d554){return{'name':_0x16d554['fieldName'],'type':_0x16d554['type'][_0x4f7b('0x3a')]};});_0x14d1f3['model']=_[_0x4f7b('0x38')](_0x593ec2,_0x4f7b('0x36'));_0x14d1f3['query']=_[_0x4f7b('0x3b')](_0x90b979['query']);_0x14d1f3['filters']=_['intersection'](_0x14d1f3[_0x4f7b('0x3c')],_0x14d1f3[_0x4f7b('0x3d')]);_0x26fe5b[_0x4f7b('0x3e')]=_[_0x4f7b('0x3f')](_0x14d1f3['model'],qs[_0x4f7b('0x40')](_0x90b979['query'][_0x4f7b('0x40')]));_0x26fe5b['attributes']=_0x26fe5b[_0x4f7b('0x3e')]['length']?_0x26fe5b[_0x4f7b('0x3e')]:_0x14d1f3[_0x4f7b('0x3c')];if(!_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x41')](_0x4f7b('0x42'))){_0x26fe5b[_0x4f7b('0x43')]=qs[_0x4f7b('0x43')](_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x43')]);_0x26fe5b[_0x4f7b('0x2c')]=qs[_0x4f7b('0x2c')](_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x2c')]);}_0x26fe5b[_0x4f7b('0x44')]=qs[_0x4f7b('0x45')](_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x45')]);_0x26fe5b[_0x4f7b('0x46')]=qs['filters'](_['pick'](_0x90b979[_0x4f7b('0x3d')],_0x14d1f3[_0x4f7b('0x47')]),_0x593ec2);if(_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x48')]){_0x26fe5b['where']=_['merge'](_0x26fe5b[_0x4f7b('0x46')],{'$or':_[_0x4f7b('0x38')](_0x593ec2,function(_0x242bde){if(_0x242bde[_0x4f7b('0x49')]!=='VIRTUAL'){var _0x4ceea1={};_0x4ceea1[_0x242bde[_0x4f7b('0x36')]]={'$like':'%'+_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x48')]+'%'};return _0x4ceea1;}})});}_0x26fe5b=_[_0x4f7b('0x4a')]({},_0x26fe5b,_0x90b979[_0x4f7b('0x4b')]);var _0x4a3fe1={'where':_0x26fe5b[_0x4f7b('0x46')]};return db[_0x4f7b('0x4c')][_0x4f7b('0x2b')](_0x4a3fe1)['then'](function(_0x6c659c){_0xa9143c[_0x4f7b('0x2b')]=_0x6c659c;if(_0x90b979[_0x4f7b('0x3d')][_0x4f7b('0x4d')]){_0x26fe5b[_0x4f7b('0x4e')]=[{'all':!![]}];}return db[_0x4f7b('0x4c')][_0x4f7b('0x4f')](_0x26fe5b);})[_0x4f7b('0x1d')](function(_0x2630ec){_0xa9143c[_0x4f7b('0x50')]=_0x2630ec;return _0xa9143c;})['then'](respondWithFilteredResult(_0x486187,_0x26fe5b))[_0x4f7b('0x51')](handleError(_0x486187,null));};exports[_0x4f7b('0x52')]=function(_0x148da8,_0x5003f1){var _0x16eaef={'raw':![],'where':{'id':_0x148da8[_0x4f7b('0x53')]['id']}},_0x3faadf={};_0x3faadf[_0x4f7b('0x3c')]=_[_0x4f7b('0x3b')](db[_0x4f7b('0x4c')][_0x4f7b('0x39')]);_0x3faadf[_0x4f7b('0x3d')]=_[_0x4f7b('0x3b')](_0x148da8[_0x4f7b('0x3d')]);_0x3faadf['filters']=_[_0x4f7b('0x3f')](_0x3faadf[_0x4f7b('0x3c')],_0x3faadf[_0x4f7b('0x3d')]);_0x16eaef['attributes']=_[_0x4f7b('0x3f')](_0x3faadf[_0x4f7b('0x3c')],qs[_0x4f7b('0x40')](_0x148da8[_0x4f7b('0x3d')][_0x4f7b('0x40')]));_0x16eaef[_0x4f7b('0x3e')]=_0x16eaef['attributes'][_0x4f7b('0x54')]?_0x16eaef[_0x4f7b('0x3e')]:_0x3faadf[_0x4f7b('0x3c')];if(_0x148da8['query'][_0x4f7b('0x4d')]){_0x16eaef[_0x4f7b('0x4e')]=[{'all':!![]}];}_0x16eaef=_[_0x4f7b('0x4a')]({},_0x16eaef,_0x148da8[_0x4f7b('0x4b')]);return db[_0x4f7b('0x4c')][_0x4f7b('0x55')](_0x16eaef)['then'](handleEntityNotFound(_0x5003f1,null))[_0x4f7b('0x1d')](respondWithResult(_0x5003f1,null))['catch'](handleError(_0x5003f1,null));};exports['clone']=function(_0x5aef6e,_0x21e852){var _0x3dfade={'where':{'id':_0x5aef6e['params']['id']}},_0x27b2e1={};_0x27b2e1['model']=_[_0x4f7b('0x3b')](db[_0x4f7b('0x4c')]['rawAttributes']);_0x3dfade[_0x4f7b('0x3e')]=_[_0x4f7b('0x3f')](_0x27b2e1[_0x4f7b('0x3c')],qs[_0x4f7b('0x40')](_0x5aef6e['query'][_0x4f7b('0x40')]));_0x3dfade[_0x4f7b('0x3e')]=_0x3dfade[_0x4f7b('0x3e')][_0x4f7b('0x54')]?_0x3dfade[_0x4f7b('0x3e')]:_0x27b2e1[_0x4f7b('0x3c')];if(_0x5aef6e[_0x4f7b('0x3d')]['includeAll']){_0x3dfade['include']=[{'all':!![]}];}_0x3dfade=_['merge']({},_0x3dfade,_0x5aef6e[_0x4f7b('0x4b')]);return db['Trunk']['find'](_0x3dfade)['then'](handleEntityNotFound(_0x21e852,null))['then'](function(_0x4a35d1){if(_0x4a35d1){var _0x2715b5=_0x4a35d1[_0x4f7b('0x32')]({'plain':!![]});_0x2715b5=qs[_0x4f7b('0x56')](_0x2715b5,['id',_0x4f7b('0x57'),_0x4f7b('0x58')]);_0x5aef6e[_0x4f7b('0x59')]=_[_0x4f7b('0x56')](_0x5aef6e[_0x4f7b('0x59')],['id',_0x4f7b('0x57'),_0x4f7b('0x58')]);return db[_0x4f7b('0x4c')][_0x4f7b('0x5a')](_[_0x4f7b('0x4a')](_0x2715b5,_0x5aef6e[_0x4f7b('0x59')]),{'include':_0x5aef6e[_0x4f7b('0x3d')][_0x4f7b('0x4d')]?[{'all':!![]}]:undefined})[_0x4f7b('0x1d')](function(_0x548735){var _0x1b1a72=_0x5aef6e[_0x4f7b('0x5b')][_0x4f7b('0x32')]({'plain':!![]});if(!_0x1b1a72)throw new Error(_0x4f7b('0x5c'));if(_0x1b1a72[_0x4f7b('0x5d')]==='user'){var _0x4b9f3a=_0x548735[_0x4f7b('0x32')]({'plain':!![]});var _0x5a2b3d=_0x4f7b('0x33');return db[_0x4f7b('0x5e')][_0x4f7b('0x55')]({'where':{'name':_0x5a2b3d,'userProfileId':_0x1b1a72[_0x4f7b('0x5f')]},'raw':!![]})['then'](function(_0x27ac22){if(_0x27ac22&&_0x27ac22[_0x4f7b('0x60')]===0x0){return db[_0x4f7b('0x34')]['create']({'name':_0x4b9f3a['name'],'resourceId':_0x4b9f3a['id'],'type':_0x27ac22['name'],'sectionId':_0x27ac22['id']},{})[_0x4f7b('0x1d')](function(){return _0x548735;});}else{return _0x548735;}})['catch'](function(_0x49ff77){logger['error'](_0x4f7b('0x61'),_0x49ff77);throw _0x49ff77;});}return _0x548735;});}})[_0x4f7b('0x1d')](respondWithResult(_0x21e852,0xc9))[_0x4f7b('0x51')](handleError(_0x21e852,null));};exports['create']=function(_0x6be571,_0x3fd55a,_0x56b3c7){var _0x57874c;return db[_0x4f7b('0x4c')][_0x4f7b('0x5a')](_0x6be571[_0x4f7b('0x59')],{'raw':!![]})[_0x4f7b('0x1d')](function(_0x51ff0c){_0x57874c=_0x51ff0c;return db[_0x4f7b('0x4c')][_0x4f7b('0x4f')]({'raw':!![]});})[_0x4f7b('0x1d')](function(_0x2cb5f1){var _0x2ac8db=fs[_0x4f7b('0x62')](path['join'](config[_0x4f7b('0x63')],_0x4f7b('0x64')),_0x4f7b('0x65'));var _0x220f21=fs[_0x4f7b('0x62')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x4f7b('0x65'));var _0x306057=ejs[_0x4f7b('0x66')](_0x2ac8db,{'trunks':_0x2cb5f1||[]});fs[_0x4f7b('0x67')](_0x4f7b('0x68'),_0x306057);if(_0x57874c['registry']){var _0x960913=ejs[_0x4f7b('0x66')](_0x220f21,{'trunks':_0x2cb5f1||[]});fs[_0x4f7b('0x67')](_0x4f7b('0x69'),_0x960913);}})[_0x4f7b('0x1d')](function(){return respondWithRpcPromise(_0x4f7b('0x6a'),_0x4f7b('0x5a'),{'module':_0x4f7b('0x6b')});})[_0x4f7b('0x1d')](function(){var _0x6e6ba3=_0x6be571[_0x4f7b('0x5b')][_0x4f7b('0x32')]({'plain':!![]});if(!_0x6e6ba3)throw new Error(_0x4f7b('0x5c'));if(_0x6e6ba3[_0x4f7b('0x5d')]===_0x4f7b('0x5b')){var _0x33f3a0=_0x57874c[_0x4f7b('0x32')]({'plain':!![]});return db[_0x4f7b('0x5e')]['find']({'where':{'name':'Trunks','userProfileId':_0x6e6ba3[_0x4f7b('0x5f')]},'raw':!![]})[_0x4f7b('0x1d')](function(_0x38de9f){if(_0x38de9f&&_0x38de9f[_0x4f7b('0x60')]===0x0){return db['UserProfileResource'][_0x4f7b('0x5a')]({'name':_0x33f3a0[_0x4f7b('0x36')],'resourceId':_0x33f3a0['id'],'type':_0x38de9f[_0x4f7b('0x36')],'sectionId':_0x38de9f['id']},{})[_0x4f7b('0x1d')](function(){return _0x57874c;});}else{return _0x57874c;}})[_0x4f7b('0x51')](function(_0x378587){logger[_0x4f7b('0x22')](_0x4f7b('0x61'),_0x378587);throw _0x378587;});}return _0x57874c;})[_0x4f7b('0x1d')](respondWithResult(_0x3fd55a,0xc9))[_0x4f7b('0x51')](handleError(_0x3fd55a,null));};exports[_0x4f7b('0x30')]=function(_0x15fc22,_0x26b5cb,_0x278d72){var _0x121e19;return db['Trunk'][_0x4f7b('0x55')]({'where':{'id':_0x15fc22[_0x4f7b('0x53')]['id']}})['then'](handleEntityNotFound(_0x26b5cb,null))['then'](saveUpdates(_0x15fc22[_0x4f7b('0x59')],null))[_0x4f7b('0x1d')](function(_0x3d25a6){if(_0x3d25a6){_0x121e19=_0x3d25a6;return db[_0x4f7b('0x4c')][_0x4f7b('0x4f')]({'raw':!![]});}})[_0x4f7b('0x1d')](function(_0x1f7692){if(_0x1f7692){var _0x48d9c6=fs['readFileSync'](path[_0x4f7b('0x6c')](config[_0x4f7b('0x63')],_0x4f7b('0x64')),_0x4f7b('0x65'));var _0x52997f=fs[_0x4f7b('0x62')](path[_0x4f7b('0x6c')](config['root'],_0x4f7b('0x6d')),_0x4f7b('0x65'));var _0x50aabe=ejs['render'](_0x48d9c6,{'trunks':_0x1f7692||[]});fs[_0x4f7b('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x50aabe);var _0x58d04a=ejs['render'](_0x52997f,{'trunks':_0x1f7692||[]});fs[_0x4f7b('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x58d04a);return respondWithRpcPromise(_0x4f7b('0x6a'),_0x4f7b('0x30'),{'module':_0x4f7b('0x6b')});}return null;})[_0x4f7b('0x1d')](function(_0x19d106){if(_0x19d106){return _0x121e19;}})[_0x4f7b('0x1d')](respondWithResult(_0x26b5cb,null))[_0x4f7b('0x51')](handleError(_0x26b5cb,null));};exports[_0x4f7b('0x31')]=function(_0x39799b,_0x4da13f,_0x476637){var _0x35c3cb;return db[_0x4f7b('0x4c')][_0x4f7b('0x55')]({'where':{'id':_0x39799b[_0x4f7b('0x53')]['id']}})[_0x4f7b('0x1d')](handleEntityNotFound(_0x4da13f,null))[_0x4f7b('0x1d')](removeEntity(_0x4da13f,null))[_0x4f7b('0x1d')](function(){return db['Trunk'][_0x4f7b('0x4f')]({'raw':!![]});})[_0x4f7b('0x1d')](function(_0xfc5752){var _0x4d9ed4=fs[_0x4f7b('0x62')](path['join'](config[_0x4f7b('0x63')],_0x4f7b('0x64')),'utf8');var _0x5d4c37=fs[_0x4f7b('0x62')](path['join'](config[_0x4f7b('0x63')],'server/files/templates/registry.ejs'),_0x4f7b('0x65'));var _0x170a12=ejs[_0x4f7b('0x66')](_0x4d9ed4,{'trunks':_0xfc5752});var _0x4ece3a=ejs[_0x4f7b('0x66')](_0x5d4c37,{'trunks':_0xfc5752});fs['writeFileSync'](_0x4f7b('0x68'),_0x170a12);fs[_0x4f7b('0x67')](_0x4f7b('0x69'),_0x4ece3a);return respondWithRpcPromise(_0x4f7b('0x6a'),_0x4f7b('0x31'),{'module':_0x4f7b('0x6b')});})[_0x4f7b('0x51')](handleError(_0x4da13f,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 590aa2f..a3efd98 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 _0x3ceb=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5226bc,_0x38bf1d){var _0x244ca4=function(_0x25de9b){while(--_0x25de9b){_0x5226bc['push'](_0x5226bc['shift']());}};_0x244ca4(++_0x38bf1d);}(_0x3ceb,0x131));var _0xb3ce=function(_0x1cbcec,_0x33c001){_0x1cbcec=_0x1cbcec-0x0;var _0x54c8ca=_0x3ceb[_0x1cbcec];return _0x54c8ca;};'use strict';var _=require(_0xb3ce('0x0'));var util=require(_0xb3ce('0x1'));var logger=require(_0xb3ce('0x2'))(_0xb3ce('0x3'));var moment=require('moment');var BPromise=require(_0xb3ce('0x4'));var rp=require(_0xb3ce('0x5'));var fs=require('fs');var path=require(_0xb3ce('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3ce('0x7'));module[_0xb3ce('0x8')]=function(_0x7891b2,_0x3abbe3){return _0x7891b2[_0xb3ce('0x9')](_0xb3ce('0xa'),attributes,{'tableName':_0xb3ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x947c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api'];(function(_0x48aaca,_0x140945){var _0xac5ed9=function(_0x180b19){while(--_0x180b19){_0x48aaca['push'](_0x48aaca['shift']());}};_0xac5ed9(++_0x140945);}(_0x947c,0x1aa));var _0xc947=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x947c[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0xc947('0x0'));var util=require('util');var logger=require(_0xc947('0x1'))(_0xc947('0x2'));var moment=require(_0xc947('0x3'));var BPromise=require(_0xc947('0x4'));var rp=require(_0xc947('0x5'));var fs=require('fs');var path=require(_0xc947('0x6'));var rimraf=require(_0xc947('0x7'));var config=require(_0xc947('0x8'));var attributes=require(_0xc947('0x9'));module[_0xc947('0xa')]=function(_0x30c477,_0x1a8d99){return _0x30c477['define'](_0xc947('0xb'),attributes,{'tableName':_0xc947('0xc'),'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 49ef9bc..91811cc 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 _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x211a02,_0x3b5362){var _0x13d91c=function(_0x559b49){while(--_0x559b49){_0x211a02['push'](_0x211a02['shift']());}};_0x13d91c(++_0x3b5362);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x16ecad,_0x205047){var _0x313ff7=function(_0x58b16a){while(--_0x58b16a){_0x16ecad['push'](_0x16ecad['shift']());}};_0x313ff7(++_0x205047);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'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')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 058a63d..ffb0a43 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 _0xf70c=['addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','removeApiKey','exports','util','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/:id','show','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','/create_many','bulkCreate','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','/:id/avatar','addAvatar','login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts'];(function(_0x5b68ae,_0x376e32){var _0x337c85=function(_0x4954e8){while(--_0x4954e8){_0x5b68ae['push'](_0x5b68ae['shift']());}};_0x337c85(++_0x376e32);}(_0xf70c,0x17e));var _0xcf70=function(_0x5b8e16,_0x3268c6){_0x5b8e16=_0x5b8e16-0x0;var _0x2144e8=_0xf70c[_0x5b8e16];return _0x2144e8;};'use strict';var multer=require('multer');var util=require(_0xcf70('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf70('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xcf70('0x2'));var config=require(_0xcf70('0x3'));var controller=require(_0xcf70('0x4'));router['get']('/',auth[_0xcf70('0x5')](),controller[_0xcf70('0x6')]);router[_0xcf70('0x7')](_0xcf70('0x8'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x9')]);router[_0xcf70('0x7')](_0xcf70('0xa'),auth[_0xcf70('0x5')](),controller[_0xcf70('0xb')]);router[_0xcf70('0x7')](_0xcf70('0xc'),auth[_0xcf70('0x5')](),controller[_0xcf70('0xd')]);router[_0xcf70('0x7')]('/:id/avatar',controller['getAvatar']);router[_0xcf70('0x7')](_0xcf70('0xe'),auth[_0xcf70('0x5')](),controller[_0xcf70('0xf')]);router[_0xcf70('0x7')](_0xcf70('0x10'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x11')]);router[_0xcf70('0x7')](_0xcf70('0x12'),auth[_0xcf70('0x5')](),controller['getVoiceQueuesRt']);router['get']('/:id/groups',auth[_0xcf70('0x5')](),controller[_0xcf70('0x13')]);router[_0xcf70('0x7')](_0xcf70('0x14'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x15')]);router[_0xcf70('0x7')](_0xcf70('0x16'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x17')]);router[_0xcf70('0x7')](_0xcf70('0x18'),auth['isAuthenticated'](),controller[_0xcf70('0x19')]);router[_0xcf70('0x7')](_0xcf70('0x1a'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x1b')]);router['get'](_0xcf70('0x1c'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x1d')]);router[_0xcf70('0x7')](_0xcf70('0x1e'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x1f')]);router[_0xcf70('0x7')](_0xcf70('0x20'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x21')]);router[_0xcf70('0x7')](_0xcf70('0x22'),auth['isAuthenticated'](),controller[_0xcf70('0x23')]);router[_0xcf70('0x7')](_0xcf70('0x24'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x25')]);router[_0xcf70('0x7')](_0xcf70('0x26'),auth[_0xcf70('0x5')](),controller['getLists']);router['get'](_0xcf70('0x27'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x28')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0xcf70('0x29')]);router[_0xcf70('0x7')](_0xcf70('0x2a'),auth['isAuthenticated'](),controller[_0xcf70('0x2b')]);router[_0xcf70('0x7')]('/:id/mail_accounts',auth[_0xcf70('0x5')](),controller['getMailAccounts']);router[_0xcf70('0x7')](_0xcf70('0x2c'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xcf70('0x2d')]);router['get'](_0xcf70('0x2e'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x2f')]);router[_0xcf70('0x7')](_0xcf70('0x30'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x31')]);router[_0xcf70('0x7')](_0xcf70('0x32'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x33')]);router[_0xcf70('0x7')](_0xcf70('0x34'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x35')]);router[_0xcf70('0x7')]('/:id/api_key',auth[_0xcf70('0x5')](),controller['getApiKey']);router[_0xcf70('0x36')](_0xcf70('0x37'),auth['isAuthenticated'](),controller[_0xcf70('0x38')]);router[_0xcf70('0x36')](_0xcf70('0xe'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x39')]);router[_0xcf70('0x36')]('/',auth[_0xcf70('0x5')](),controller[_0xcf70('0x3a')]);router[_0xcf70('0x36')](_0xcf70('0x10'),auth['isAuthenticated'](),controller[_0xcf70('0x3b')]);var upload=multer({'storage':multer[_0xcf70('0x3c')]({'destination':function(_0x486a03,_0x481623,_0x3f62cb){_0x3f62cb(null,path[_0xcf70('0x3d')](config[_0xcf70('0x3e')],_0xcf70('0x3f')));},'filename':function(_0x3582be,_0x12d12e,_0x1eccc6){_0x1eccc6(null,util['format'](_0xcf70('0x40'),Date[_0xcf70('0x41')](),_0x12d12e[_0xcf70('0x42')]));}})});router[_0xcf70('0x36')](_0xcf70('0x43'),upload['single']('file'),controller[_0xcf70('0x44')]);router[_0xcf70('0x36')]('/:id/login',auth['isAuthenticated'](),controller[_0xcf70('0x45')]);router[_0xcf70('0x36')](_0xcf70('0x46'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x47')]);router[_0xcf70('0x36')]('/:id/pause',auth[_0xcf70('0x5')](),controller[_0xcf70('0x48')]);router[_0xcf70('0x36')](_0xcf70('0x49'),auth[_0xcf70('0x5')](),controller['unpause']);router['post']('/:id/teams',auth[_0xcf70('0x5')](),controller[_0xcf70('0x4a')]);router[_0xcf70('0x36')](_0xcf70('0x4b'),auth['isAuthenticated'](),controller[_0xcf70('0x4c')]);router['post'](_0xcf70('0x4d'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x4e')]);router[_0xcf70('0x36')](_0xcf70('0x4f'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x50')]);router[_0xcf70('0x36')]('/:id/sms_interactions',auth[_0xcf70('0x5')](),controller[_0xcf70('0x51')]);router[_0xcf70('0x36')]('/:id/openchannel_interactions',auth[_0xcf70('0x5')](),controller[_0xcf70('0x52')]);router[_0xcf70('0x36')](_0xcf70('0x53'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x54')]);router[_0xcf70('0x36')]('/:id/fax_accounts',auth[_0xcf70('0x5')](),controller['addFaxAccounts']);router[_0xcf70('0x36')](_0xcf70('0x55'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x56')]);router[_0xcf70('0x36')](_0xcf70('0x2c'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x57')]);router[_0xcf70('0x36')](_0xcf70('0x58'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x59')]);router['post'](_0xcf70('0x2e'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x5a')]);router[_0xcf70('0x36')](_0xcf70('0x30'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x5b')]);router[_0xcf70('0x36')](_0xcf70('0x32'),auth['isAuthenticated'](),controller[_0xcf70('0x5c')]);router[_0xcf70('0x36')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xcf70('0x5d')]);router['put']('/:id',auth[_0xcf70('0x5')](),controller[_0xcf70('0x5e')]);router[_0xcf70('0x5f')](_0xcf70('0x60'),auth['isAuthenticated'](),controller[_0xcf70('0x61')]);router[_0xcf70('0x62')]('/:id/queues',auth[_0xcf70('0x5')](),controller[_0xcf70('0x63')]);router['delete'](_0xcf70('0x24'),auth[_0xcf70('0x5')](),controller['removeTeams']);router[_0xcf70('0x62')]('/:id',auth[_0xcf70('0x5')](),controller[_0xcf70('0x64')]);router[_0xcf70('0x62')](_0xcf70('0x4b'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x65')]);router[_0xcf70('0x62')]('/:id/mail_interactions',auth[_0xcf70('0x5')](),controller[_0xcf70('0x66')]);router[_0xcf70('0x62')](_0xcf70('0x4f'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x67')]);router[_0xcf70('0x62')](_0xcf70('0x68'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x69')]);router[_0xcf70('0x62')](_0xcf70('0x6a'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x6b')]);router[_0xcf70('0x62')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xcf70('0x6c')]);router['delete'](_0xcf70('0x2a'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x6d')]);router['delete'](_0xcf70('0x55'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x6e')]);router[_0xcf70('0x62')](_0xcf70('0x2c'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x6f')]);router[_0xcf70('0x62')](_0xcf70('0x58'),auth[_0xcf70('0x5')](),controller['removeSmsAccounts']);router[_0xcf70('0x62')](_0xcf70('0x2e'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x70')]);router[_0xcf70('0x62')](_0xcf70('0x30'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x71')]);router['delete']('/:id/square_projects',auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0xcf70('0x62')](_0xcf70('0x72'),auth[_0xcf70('0x5')](),controller[_0xcf70('0x73')]);module[_0xcf70('0x74')]=router; \ No newline at end of file +var _0x12ec=['/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','update','put','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','bulkCreate','addContacts','create','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions'];(function(_0x13c577,_0x2d3ef7){var _0x542bd8=function(_0x155f83){while(--_0x155f83){_0x13c577['push'](_0x13c577['shift']());}};_0x542bd8(++_0x2d3ef7);}(_0x12ec,0x1e4));var _0xc12e=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x12ec[_0x5e6cb8];return _0x3faeb3;};'use strict';var multer=require(_0xc12e('0x0'));var util=require(_0xc12e('0x1'));var path=require(_0xc12e('0x2'));var timeout=require(_0xc12e('0x3'));var express=require(_0xc12e('0x4'));var router=express[_0xc12e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc12e('0x6'));var config=require(_0xc12e('0x7'));var controller=require(_0xc12e('0x8'));router[_0xc12e('0x9')]('/',auth[_0xc12e('0xa')](),controller[_0xc12e('0xb')]);router['get'](_0xc12e('0xc'),auth[_0xc12e('0xa')](),controller['describe']);router[_0xc12e('0x9')](_0xc12e('0xd'),auth['isAuthenticated'](),controller[_0xc12e('0xe')]);router['get'](_0xc12e('0xf'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x10')]);router[_0xc12e('0x9')]('/:id/avatar',controller[_0xc12e('0x11')]);router[_0xc12e('0x9')](_0xc12e('0x12'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x13')]);router[_0xc12e('0x9')](_0xc12e('0x14'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x15')]);router['get'](_0xc12e('0x16'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x17')]);router['get'](_0xc12e('0x18'),auth[_0xc12e('0xa')](),controller['getGroups']);router[_0xc12e('0x9')]('/:id/recordings',auth[_0xc12e('0xa')](),controller[_0xc12e('0x19')]);router[_0xc12e('0x9')](_0xc12e('0x1a'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x1b')]);router[_0xc12e('0x9')](_0xc12e('0x1c'),auth[_0xc12e('0xa')](),controller['getChatInteractions']);router[_0xc12e('0x9')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0xc12e('0x1d'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x1e')]);router[_0xc12e('0x9')](_0xc12e('0x1f'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x20')]);router['get'](_0xc12e('0x21'),auth['isAuthenticated'](),controller[_0xc12e('0x22')]);router[_0xc12e('0x9')](_0xc12e('0x23'),auth[_0xc12e('0xa')](),controller['getWhatsappInteractions']);router['get'](_0xc12e('0x24'),auth['isAuthenticated'](),controller[_0xc12e('0x25')]);router[_0xc12e('0x9')](_0xc12e('0x26'),auth['isAuthenticated'](),controller['getLists']);router[_0xc12e('0x9')](_0xc12e('0x27'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x28')]);router['get'](_0xc12e('0x29'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x2a')]);router[_0xc12e('0x9')](_0xc12e('0x2b'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x2c')]);router[_0xc12e('0x9')](_0xc12e('0x2d'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x2e')]);router[_0xc12e('0x9')]('/:id/openchannel_accounts',auth[_0xc12e('0xa')](),controller['getOpenchannelAccounts']);router['get'](_0xc12e('0x2f'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x30')]);router[_0xc12e('0x9')](_0xc12e('0x31'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x32')]);router[_0xc12e('0x9')]('/:id/whatsapp_accounts',auth[_0xc12e('0xa')](),controller['getWhatsappAccounts']);router[_0xc12e('0x9')](_0xc12e('0x33'),auth[_0xc12e('0xa')](),controller['getSquareProjects']);router[_0xc12e('0x9')](_0xc12e('0x34'),auth['isAuthenticated'](),controller[_0xc12e('0x35')]);router['get'](_0xc12e('0x36'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x37')]);router[_0xc12e('0x38')]('/create_many',auth['isAuthenticated'](),controller[_0xc12e('0x39')]);router[_0xc12e('0x38')]('/:id/contacts',auth[_0xc12e('0xa')](),controller[_0xc12e('0x3a')]);router['post']('/',auth[_0xc12e('0xa')](),controller[_0xc12e('0x3b')]);router[_0xc12e('0x38')]('/:id/queues',auth[_0xc12e('0xa')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x152f43,_0x731708,_0x38f270){_0x38f270(null,path[_0xc12e('0x3c')](config[_0xc12e('0x3d')],_0xc12e('0x3e')));},'filename':function(_0x66161d,_0x33bfbd,_0x9985de){_0x9985de(null,util[_0xc12e('0x3f')](_0xc12e('0x40'),Date[_0xc12e('0x41')](),_0x33bfbd[_0xc12e('0x42')]));}})});router[_0xc12e('0x38')](_0xc12e('0x43'),upload[_0xc12e('0x44')](_0xc12e('0x45')),controller['addAvatar']);router[_0xc12e('0x38')](_0xc12e('0x46'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x47')]);router[_0xc12e('0x38')](_0xc12e('0x48'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x49')]);router[_0xc12e('0x38')](_0xc12e('0x4a'),auth[_0xc12e('0xa')](),controller['pause']);router[_0xc12e('0x38')](_0xc12e('0x4b'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x4c')]);router[_0xc12e('0x38')](_0xc12e('0x24'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x4d')]);router[_0xc12e('0x38')]('/:id/chat_interactions',auth[_0xc12e('0xa')](),controller[_0xc12e('0x4e')]);router['post'](_0xc12e('0x4f'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x50')]);router['post'](_0xc12e('0x51'),auth['isAuthenticated'](),controller[_0xc12e('0x52')]);router[_0xc12e('0x38')](_0xc12e('0x53'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x54')]);router['post'](_0xc12e('0x55'),auth['isAuthenticated'](),controller[_0xc12e('0x56')]);router[_0xc12e('0x38')](_0xc12e('0x57'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x58')]);router[_0xc12e('0x38')](_0xc12e('0x2b'),auth[_0xc12e('0xa')](),controller['addFaxAccounts']);router[_0xc12e('0x38')](_0xc12e('0x2d'),auth['isAuthenticated'](),controller[_0xc12e('0x59')]);router['post'](_0xc12e('0x5a'),auth['isAuthenticated'](),controller[_0xc12e('0x5b')]);router[_0xc12e('0x38')](_0xc12e('0x2f'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x5c')]);router[_0xc12e('0x38')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xc12e('0x5d')]);router[_0xc12e('0x38')](_0xc12e('0x5e'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x5f')]);router[_0xc12e('0x38')](_0xc12e('0x33'),auth[_0xc12e('0xa')](),controller['addSquareProjects']);router['post']('/:id/api_key',auth[_0xc12e('0xa')](),controller[_0xc12e('0x60')]);router['put'](_0xc12e('0xf'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x61')]);router[_0xc12e('0x62')]('/:id/password',auth['isAuthenticated'](),controller[_0xc12e('0x63')]);router[_0xc12e('0x64')](_0xc12e('0x14'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x65')]);router[_0xc12e('0x64')](_0xc12e('0x24'),auth[_0xc12e('0xa')](),controller['removeTeams']);router[_0xc12e('0x64')](_0xc12e('0xf'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x66')]);router[_0xc12e('0x64')](_0xc12e('0x67'),auth['isAuthenticated'](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0xc12e('0xa')](),controller[_0xc12e('0x68')]);router[_0xc12e('0x64')](_0xc12e('0x51'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x69')]);router[_0xc12e('0x64')](_0xc12e('0x53'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x6a')]);router[_0xc12e('0x64')](_0xc12e('0x55'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xc12e('0x64')](_0xc12e('0x57'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x6b')]);router[_0xc12e('0x64')](_0xc12e('0x2b'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x6c')]);router[_0xc12e('0x64')](_0xc12e('0x2d'),auth[_0xc12e('0xa')](),controller['removeMailAccounts']);router[_0xc12e('0x64')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xc12e('0x64')](_0xc12e('0x2f'),auth['isAuthenticated'](),controller[_0xc12e('0x6d')]);router['delete']('/:id/chat_websites',auth[_0xc12e('0xa')](),controller['removeChatWebsites']);router['delete'](_0xc12e('0x5e'),auth[_0xc12e('0xa')](),controller[_0xc12e('0x6e')]);router[_0xc12e('0x64')]('/:id/square_projects',auth[_0xc12e('0xa')](),controller[_0xc12e('0x6f')]);router[_0xc12e('0x64')]('/:id/api_key',auth[_0xc12e('0xa')](),controller['removeApiKey']);module[_0xc12e('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 4d71c0a..bdf3df9 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 _0x1c1b=['active','actpass','showWebBar','isArray','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','icesupport','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','getDataValue','internal','email','ENUM','admin','user','agent','telephone','INTEGER','callerid','format','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate'];(function(_0x32436e,_0x1cfe36){var _0x34b29d=function(_0x37ca56){while(--_0x37ca56){_0x32436e['push'](_0x32436e['shift']());}};_0x34b29d(++_0x1cfe36);}(_0x1c1b,0x1e2));var _0xb1c1=function(_0x5061c9,_0x525996){_0x5061c9=_0x5061c9-0x0;var _0x1770f9=_0x1c1b[_0x5061c9];return _0x1770f9;};'use strict';var Sequelize=require(_0xb1c1('0x0'));var moment=require(_0xb1c1('0x1'));var util=require(_0xb1c1('0x2'));var _=require(_0xb1c1('0x3'));module[_0xb1c1('0x4')]={'name':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'unique':_0xb1c1('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x28bbb3){this[_0xb1c1('0x7')](_0xb1c1('0x6'),_0x28bbb3);this['setDataValue'](_0xb1c1('0x8'),_0x28bbb3);},'comment':_0xb1c1('0x9')},'fullname':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'set':function(_0x4cd851){this[_0xb1c1('0x7')](_0xb1c1('0xa'),_0x4cd851);this[_0xb1c1('0x7')]('callerid',util['format']('\x22%s\x22\x20<%s>',_0x4cd851,this[_0xb1c1('0xb')](_0xb1c1('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'unique':_0xb1c1('0xd'),'validate':{'isEmail':!![]},'set':function(_0x191b81){if(_0x191b81){this['setDataValue']('email',_0x191b81['toLowerCase']());}}},'role':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0xf'),_0xb1c1('0x10'),_0xb1c1('0x11'),_0xb1c1('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb1c1('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':![],'unique':_0xb1c1('0xc'),'set':function(_0xa33d95){this['setDataValue']('internal',_0xa33d95);this[_0xb1c1('0x7')]('accountcode',_0xa33d95);this[_0xb1c1('0x7')](_0xb1c1('0x14'),util[_0xb1c1('0x15')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0xb1c1('0xa')),_0xa33d95));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb1c1('0x5')]},'mobile':{'type':Sequelize[_0xb1c1('0x5')]},'address':{'type':Sequelize[_0xb1c1('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xb1c1('0x5')]},'city':{'type':Sequelize[_0xb1c1('0x5')]},'country':{'type':Sequelize[_0xb1c1('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xb1c1('0x17')]},'chatCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb1c1('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb1c1('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x18')},'ipaddr':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xb1c1('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x19'),_0xb1c1('0x10'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x1a')},'callingpres':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x1b'),_0xb1c1('0x1c'),_0xb1c1('0x1d'),_0xb1c1('0x1e'),_0xb1c1('0x1f'),'PROHIB_PASSED_SCREEN',_0xb1c1('0x20'),_0xb1c1('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x22'),'set':function(_0x345adf){this['setDataValue'](_0xb1c1('0x23'),_0x345adf?_0x345adf['join'](','):null);},'get':function(){return this['getDataValue'](_0xb1c1('0x23'))?this[_0xb1c1('0xb')](_0xb1c1('0x23'))['split'](','):null;},'comment':_0xb1c1('0x24')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xb1c1('0x25'),_0xb1c1('0x26'),_0xb1c1('0x27'),_0xb1c1('0x28')),'allowNull':!![],'defaultValue':_0xb1c1('0x29')},'directmedia':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no',_0xb1c1('0x2b'),_0xb1c1('0x2c'),_0xb1c1('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x2e'),'set':function(_0x3b51fc){this[_0xb1c1('0x7')](_0xb1c1('0x2f'),_0x3b51fc?_0x3b51fc[_0xb1c1('0x30')](','):null);},'get':function(){return this[_0xb1c1('0xb')](_0xb1c1('0x2f'))?this['getDataValue'](_0xb1c1('0x2f'))[_0xb1c1('0x31')](','):null;},'comment':_0xb1c1('0x32')},'callgroup':{'type':Sequelize[_0xb1c1('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xb1c1('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xb1c1('0x5')]},'language':{'type':Sequelize[_0xb1c1('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb1c1('0x5')]},'disallow':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'defaultValue':_0xb1c1('0x33')},'allow':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x7a12c5){this[_0xb1c1('0x7')](_0xb1c1('0x34'),_0x7a12c5?_0x7a12c5[_0xb1c1('0x30')](';'):_0xb1c1('0x35'));},'get':function(){return this[_0xb1c1('0xb')](_0xb1c1('0x34'))?this[_0xb1c1('0xb')](_0xb1c1('0x34'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'set':function(_0x5bafd8){this[_0xb1c1('0x7')](_0xb1c1('0x36'),_0x5bafd8?_0x5bafd8[_0xb1c1('0x30')](','):null);},'get':function(){return this['getDataValue'](_0xb1c1('0x36'))?this['getDataValue']('insecure')[_0xb1c1('0x31')](','):null;},'comment':_0xb1c1('0x37')},'trustrpid':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb1c1('0xe')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![],'defaultValue':_0xb1c1('0x38')},'amaflags':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0xb1c1('0x2a')},'busylevel':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x39'),_0xb1c1('0x3a'),_0xb1c1('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xb1c1('0x3c'),_0xb1c1('0x3d')),'allowNull':!![],'defaultValue':_0xb1c1('0x3d')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0xb1c1('0x2a')},'keepalive':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xb1c1('0x3e'),_0xb1c1('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb1c1('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x40'),'passive',_0xb1c1('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb1c1('0xe')](_0xb1c1('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb1c1('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no',_0xb1c1('0x2b'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb1c1('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xb1c1('0x17')]},'showWebBar':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0,'set':function(_0x1dca34){this[_0xb1c1('0x7')](_0xb1c1('0x42'),_0x1dca34);var _0x4da700=this['get']({'plain':!![]});switch(_0x1dca34){case 0x0:case 0x1:var _0x3d39a8=_0x4da700[_0xb1c1('0x23')]?_[_0xb1c1('0x43')](_0x4da700[_0xb1c1('0x23')])?_0x4da700[_0xb1c1('0x23')][_0xb1c1('0x30')]():_0x4da700[_0xb1c1('0x23')]:_0xb1c1('0x22');if(_0x3d39a8==='wss'){_0x3d39a8=_0xb1c1('0x22');}this[_0xb1c1('0x7')](_0xb1c1('0x23'),_0x3d39a8);this[_0xb1c1('0x7')](_0xb1c1('0x44'),'no');this[_0xb1c1('0x7')](_0xb1c1('0x45'),null);this[_0xb1c1('0x7')](_0xb1c1('0x46'),null);this[_0xb1c1('0x7')]('icesupport',null);this[_0xb1c1('0x7')](_0xb1c1('0x47'),null);this[_0xb1c1('0x7')](_0xb1c1('0x48'),null);this[_0xb1c1('0x7')](_0xb1c1('0x49'),null);this[_0xb1c1('0x7')](_0xb1c1('0x4a'),null);this[_0xb1c1('0x7')](_0xb1c1('0x4b'),null);this[_0xb1c1('0x7')](_0xb1c1('0x4c'),'no');break;case 0x2:this[_0xb1c1('0x7')](_0xb1c1('0x23'),_0xb1c1('0x4d'));this[_0xb1c1('0x7')](_0xb1c1('0x44'),'yes');this['setDataValue'](_0xb1c1('0x45'),_0xb1c1('0x2a'));this[_0xb1c1('0x7')](_0xb1c1('0x46'),'yes');this[_0xb1c1('0x7')](_0xb1c1('0x4e'),'yes');this[_0xb1c1('0x7')]('dtlsenable','yes');this[_0xb1c1('0x7')]('dtlsverify','no');this[_0xb1c1('0x7')](_0xb1c1('0x49'),_0xb1c1('0x41'));this[_0xb1c1('0x7')](_0xb1c1('0x4a'),_0x4da700[_0xb1c1('0x4a')]||_0xb1c1('0x4f'));this['setDataValue']('dtlsprivatekey',_0x4da700[_0xb1c1('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0xb1c1('0x7')](_0xb1c1('0x4c'),_0xb1c1('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xb1c1('0x50')],'set':function(_0x596f5e){this[_0xb1c1('0x7')](_0xb1c1('0x51'),_0x596f5e?_0x596f5e[_0xb1c1('0x30')](','):[]);},'get':function(){return this[_0xb1c1('0xb')](_0xb1c1('0x51'))?_[_0xb1c1('0x52')](this['getDataValue'](_0xb1c1('0x51'))[_0xb1c1('0x31')](','),function(_0x4ceafa){return parseInt(_0x4ceafa,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb1c1('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb1c1('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb1c1('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xb1c1('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb1c1('0x5')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb1c1('0x53')],'get':function(){return this[_0xb1c1('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0xb1c1('0xb')](_0xb1c1('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb1c1('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb1c1('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4006ad){if(typeof _0x4006ad==='string'){var _0x8178bc=_0x4006ad==='1'?!![]:_0x4006ad==='0'?![]:_0x4006ad===_0xb1c1('0x55')?!![]:_0x4006ad===_0xb1c1('0x56')?![]:![];this[_0xb1c1('0x7')](_0xb1c1('0x57'),_0x8178bc);}else{this[_0xb1c1('0x7')]('screenrecording',_0x4006ad);}}},'blocked':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![],'set':function(_0x4249a7){this[_0xb1c1('0x7')](_0xb1c1('0x58'),_0x4249a7);if(_0x4249a7===!![]){this[_0xb1c1('0x7')](_0xb1c1('0x59'),moment());this[_0xb1c1('0x7')](_0xb1c1('0x5a'),0x0);}else{this[_0xb1c1('0x7')](_0xb1c1('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0xb1c1('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xb1c1('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb1c1('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0x619e=['rtcp_mux','icesupport','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','telephone','local','BOOLEAN','DATE','INTEGER','dynamic','peer','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','join','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','uas','fingerprint','certificate','active','passive','actpass','update','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x619e,0x67));var _0xe619=function(_0x17aa7a,_0x2be8e4){_0x17aa7a=_0x17aa7a-0x0;var _0x2321f8=_0x619e[_0x17aa7a];return _0x2321f8;};'use strict';var Sequelize=require(_0xe619('0x0'));var moment=require(_0xe619('0x1'));var util=require('util');var _=require(_0xe619('0x2'));module[_0xe619('0x3')]={'name':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'unique':_0xe619('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4a8a2f){this[_0xe619('0x6')](_0xe619('0x5'),_0x4a8a2f);this[_0xe619('0x6')](_0xe619('0x7'),_0x4a8a2f);},'comment':_0xe619('0x8')},'fullname':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'set':function(_0x496c72){this[_0xe619('0x6')](_0xe619('0x9'),_0x496c72);this[_0xe619('0x6')](_0xe619('0xa'),util[_0xe619('0xb')](_0xe619('0xc'),_0x496c72,this[_0xe619('0xd')](_0xe619('0xe'))));}},'alias':{'type':Sequelize[_0xe619('0x4')]},'email':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'unique':_0xe619('0xf'),'validate':{'isEmail':!![]},'set':function(_0x52ac59){if(_0x52ac59){this['setDataValue']('email',_0x52ac59['toLowerCase']());}}},'role':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x11'),_0xe619('0x12'),_0xe619('0x13'),_0xe619('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xe619('0x4')],'defaultValue':_0xe619('0x15')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0xfbf61b){this['setDataValue'](_0xe619('0xe'),_0xfbf61b);this[_0xe619('0x6')]('accountcode',_0xfbf61b);this['setDataValue']('callerid',util[_0xe619('0xb')](_0xe619('0xc'),this[_0xe619('0xd')](_0xe619('0x9')),_0xfbf61b));}},'salt':{'type':Sequelize[_0xe619('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xe619('0x4')]},'address':{'type':Sequelize[_0xe619('0x4')]},'zipcode':{'type':Sequelize[_0xe619('0x4')]},'userpic':{'type':Sequelize[_0xe619('0x4')]},'city':{'type':Sequelize[_0xe619('0x4')]},'country':{'type':Sequelize[_0xe619('0x4')]},'online':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xe619('0x17')]},'voicePause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xe619('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xe619('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xe619('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xe619('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xe619('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':_0xe619('0x19')},'ipaddr':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xe619('0x10')]('friend','user',_0xe619('0x1a')),'allowNull':!![],'defaultValue':_0xe619('0x1b')},'context':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':_0xe619('0x1c')},'callingpres':{'type':Sequelize[_0xe619('0x10')]('ALLOWED_NOT_SCREENED',_0xe619('0x1d'),'ALLOWED_FAILED_SCREEN',_0xe619('0x1e'),_0xe619('0x1f'),'PROHIB_PASSED_SCREEN',_0xe619('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':_0xe619('0x21'),'set':function(_0x1e4cd7){this['setDataValue'](_0xe619('0x22'),_0x1e4cd7?_0x1e4cd7['join'](','):null);},'get':function(){return this[_0xe619('0xd')]('transport')?this['getDataValue']('transport')[_0xe619('0x23')](','):null;},'comment':_0xe619('0x24')},'dtmfmode':{'type':Sequelize['ENUM'](_0xe619('0x25'),_0xe619('0x26'),_0xe619('0x27'),_0xe619('0x28'),_0xe619('0x29')),'allowNull':!![],'defaultValue':_0xe619('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0xe619('0x2a'),'no',_0xe619('0x2b'),'update',_0xe619('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':_0xe619('0x2d'),'set':function(_0x217ca5){this[_0xe619('0x6')](_0xe619('0x2e'),_0x217ca5?_0x217ca5[_0xe619('0x2f')](','):null);},'get':function(){return this[_0xe619('0xd')]('nat')?this[_0xe619('0xd')](_0xe619('0x2e'))[_0xe619('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xe619('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xe619('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xe619('0x4')]},'language':{'type':Sequelize[_0xe619('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe619('0x4')]},'disallow':{'type':Sequelize[_0xe619('0x4')],'allowNull':![],'defaultValue':_0xe619('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe619('0x31'),'set':function(_0xcd6bd1){this[_0xe619('0x6')](_0xe619('0x32'),_0xcd6bd1?_0xcd6bd1['join'](';'):_0xe619('0x31'));},'get':function(){return this['getDataValue'](_0xe619('0x32'))?this['getDataValue']('allow')[_0xe619('0x23')](';'):null;},'comment':_0xe619('0x33')},'autoframing':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'set':function(_0x256083){this['setDataValue']('insecure',_0x256083?_0x256083[_0xe619('0x2f')](','):null);},'get':function(){return this[_0xe619('0xd')](_0xe619('0x34'))?this[_0xe619('0xd')](_0xe619('0x34'))[_0xe619('0x23')](','):null;},'comment':_0xe619('0x35')},'trustrpid':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no',_0xe619('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xe619('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0xe619('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xe619('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no',_0xe619('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x38'),_0xe619('0x39'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xe619('0x10')]('uac',_0xe619('0x3a')),'allowNull':!![],'defaultValue':_0xe619('0x3a')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xe619('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0xe619('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xe619('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no',_0xe619('0x3b'),_0xe619('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xe619('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe619('0x3d'),_0xe619('0x3e'),_0xe619('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xe619('0x10')](_0xe619('0x2a'),'no','nonat',_0xe619('0x40'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xe619('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xe619('0x17')]},'showWebBar':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0,'set':function(_0x2facb4){this[_0xe619('0x6')](_0xe619('0x41'),_0x2facb4);var _0x38b8b8=this[_0xe619('0x42')]({'plain':!![]});switch(_0x2facb4){case 0x0:case 0x1:var _0x1a495d=_0x38b8b8[_0xe619('0x22')]?_[_0xe619('0x43')](_0x38b8b8[_0xe619('0x22')])?_0x38b8b8['transport'][_0xe619('0x2f')]():_0x38b8b8['transport']:_0xe619('0x21');if(_0x1a495d===_0xe619('0x44')){_0x1a495d=_0xe619('0x21');}this[_0xe619('0x6')]('transport',_0x1a495d);this[_0xe619('0x6')](_0xe619('0x45'),'no');this[_0xe619('0x6')](_0xe619('0x46'),null);this[_0xe619('0x6')](_0xe619('0x47'),null);this[_0xe619('0x6')]('icesupport',null);this[_0xe619('0x6')](_0xe619('0x48'),null);this[_0xe619('0x6')](_0xe619('0x49'),null);this[_0xe619('0x6')](_0xe619('0x4a'),null);this[_0xe619('0x6')](_0xe619('0x4b'),null);this[_0xe619('0x6')](_0xe619('0x4c'),null);this[_0xe619('0x6')](_0xe619('0x4d'),'no');break;case 0x2:this[_0xe619('0x6')](_0xe619('0x22'),'wss');this[_0xe619('0x6')](_0xe619('0x45'),'yes');this[_0xe619('0x6')](_0xe619('0x46'),_0xe619('0x2a'));this[_0xe619('0x6')](_0xe619('0x47'),_0xe619('0x2a'));this[_0xe619('0x6')](_0xe619('0x4e'),'yes');this[_0xe619('0x6')](_0xe619('0x48'),'yes');this[_0xe619('0x6')](_0xe619('0x49'),'no');this[_0xe619('0x6')](_0xe619('0x4a'),_0xe619('0x3f'));this[_0xe619('0x6')]('dtlscertfile',_0x38b8b8['dtlscertfile']||_0xe619('0x4f'));this[_0xe619('0x6')](_0xe619('0x4c'),_0x38b8b8[_0xe619('0x4c')]||_0xe619('0x50'));this[_0xe619('0x6')](_0xe619('0x4d'),_0xe619('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x414e42){this[_0xe619('0x6')](_0xe619('0x51'),_0x414e42?_0x414e42[_0xe619('0x2f')](','):[]);},'get':function(){return this['getDataValue'](_0xe619('0x51'))?_[_0xe619('0x52')](this[_0xe619('0xd')]('permissions')[_0xe619('0x23')](','),function(_0x26203d){return parseInt(_0x26203d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xe619('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xe619('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xe619('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xe619('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xe619('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xe619('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xe619('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xe619('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize[_0xe619('0x17')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xe619('0x53')],'get':function(){return this[_0xe619('0xd')](_0xe619('0x54'))?this[_0xe619('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xe619('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xe619('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![],'set':function(_0x45642e){if(typeof _0x45642e===_0xe619('0x55')){var _0x5ce44c=_0x45642e==='1'?!![]:_0x45642e==='0'?![]:_0x45642e==='true'?!![]:_0x45642e==='false'?![]:![];this[_0xe619('0x6')]('screenrecording',_0x5ce44c);}else{this['setDataValue'](_0xe619('0x56'),_0x45642e);}}},'blocked':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![],'set':function(_0x596819){this[_0xe619('0x6')](_0xe619('0x57'),_0x596819);if(_0x596819===!![]){this['setDataValue'](_0xe619('0x58'),moment());this[_0xe619('0x6')](_0xe619('0x59'),0x0);}else{this[_0xe619('0x6')](_0xe619('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xe619('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 15d2660..c645268 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 _0x7d31=['openchannelPause','smsPause','lastPauseAt','manual','mail','chat','fax','whatsapp','openchannel','set','%s%s','Pause','getTeams','Team','addTeams','omit','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','setDataValue','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','Openchannel','flatten','Voice','Queue:save','removeTeams','transaction','getDataValue','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','removeSquareProjects','getScheduledCalls','$and','$gt','$lt','$eq','$not','$between','$notBetween','$in','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','CmHopper','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','jayson/promise','test','request','then','User,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','get','Users','user','Agents','agent','Telephones','telephone','ignore','map','value','role','find','name','UserProfileResource','sendStatus','stack','send','index','rawAttributes','differenceBy','keys','filters','intersection','query','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','sequelize','col','options','User','includeAll','findAll','rows','params','password','include','bulkCreate','body','describe','addContacts','ids','admin','../../config/license/util','getLicense','telephones','users','isNil','License\x20limit\x20reached','count\x20%s:\x20%s','create','Setting','findById','min_internal','max','internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','VoiceMail','fullname','email','permissions','102','103','113','110','104','105','106','107','108','100','111','114','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','findOne','securePassword','oldPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Sequelize','ValidationError','Wrong\x20credentials','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','emit','VoiceQueue','online','push','format','SIP/%s','each','removeQueues','channel','remove','Queues','Queue:remove','voice','UserVoiceQueueRt','addAvatar','userpic','filename','getAvatar','join','root','download','server/files/images/','getContacts','CmContact','order','CmList','List','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','UserId','VoiceRecording','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','connection','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','LOGIN','device','PAUSE','concat','isMiddleware','logout','forEach','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause'];(function(_0x17e8ca,_0xab783){var _0x5bf7fe=function(_0x392b22){while(--_0x392b22){_0x17e8ca['push'](_0x17e8ca['shift']());}};_0x5bf7fe(++_0xab783);}(_0x7d31,0x1e4));var _0x17d3=function(_0x300c82,_0x2e94c0){_0x300c82=_0x300c82-0x0;var _0x1b47fa=_0x7d31[_0x300c82];return _0x1b47fa;};'use strict';var pdf=require(_0x17d3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x17d3('0x1'));var zipdir=require(_0x17d3('0x2'));var jsonpatch=require(_0x17d3('0x3'));var rp=require('request-promise');var moment=require(_0x17d3('0x4'));var BPromise=require(_0x17d3('0x5'));var Mustache=require(_0x17d3('0x6'));var util=require(_0x17d3('0x7'));var path=require(_0x17d3('0x8'));var sox=require(_0x17d3('0x9'));var csv=require(_0x17d3('0xa'));var ejs=require(_0x17d3('0xb'));var fs=require('fs');var _=require(_0x17d3('0xc'));var squel=require(_0x17d3('0xd'));var crypto=require('crypto');var jsforce=require(_0x17d3('0xe'));var deskjs=require(_0x17d3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x17d3('0x10'));var Papa=require(_0x17d3('0x11'));var Redis=require(_0x17d3('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x17d3('0x13'));var hardwareService=require(_0x17d3('0x14'));var logger=require(_0x17d3('0x15'))(_0x17d3('0x16'));var utils=require(_0x17d3('0x17'));var config=require(_0x17d3('0x18'));var db=require(_0x17d3('0x19'))['db'];config[_0x17d3('0x1a')]=_[_0x17d3('0x1b')](config[_0x17d3('0x1a')],{'host':_0x17d3('0x1c'),'port':0x18eb});var socket=require(_0x17d3('0x1d'))(new Redis(config[_0x17d3('0x1a')]));require(_0x17d3('0x1e'))['register'](socket);var jayson=require(_0x17d3('0x1f'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x5c7050,_0x32a77a,_0x520dfa){if(_0x520dfa){var _0x1ab537=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ab537[_0x17d3('0x20')](_0x32a77a)){return _0x5c7050;}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 _0x5c7050;}}function respondWithRpcPromise(_0x215e5e,_0x2b1015,_0x16d8d9,_0x430e3e){return new BPromise(function(_0x10f45f,_0x41d1d9){var _0x127f65=_0x430e3e||client;return _0x127f65[_0x17d3('0x21')](_0x215e5e,_0x16d8d9)[_0x17d3('0x22')](function(_0x1035d1){logger['info'](_0x17d3('0x23'),_0x2b1015,'request\x20sent');logger[_0x17d3('0x24')]('User,\x20%s,\x20%s,\x20%s',_0x2b1015,'request\x20sent',JSON[_0x17d3('0x25')](_0x1035d1));if(_0x1035d1['error']){if(_0x1035d1[_0x17d3('0x26')][_0x17d3('0x27')]===0x1f4){logger[_0x17d3('0x26')](_0x17d3('0x23'),_0x2b1015,_0x1035d1[_0x17d3('0x26')][_0x17d3('0x28')]);return _0x41d1d9(_0x1035d1['error'][_0x17d3('0x28')]);}logger[_0x17d3('0x26')](_0x17d3('0x23'),_0x2b1015,_0x1035d1['error'][_0x17d3('0x28')]);return _0x10f45f(_0x1035d1[_0x17d3('0x26')][_0x17d3('0x28')]);}else{logger[_0x17d3('0x29')](_0x17d3('0x23'),_0x2b1015,_0x17d3('0x2a'));_0x10f45f(_0x1035d1[_0x17d3('0x2b')][_0x17d3('0x28')]);}})[_0x17d3('0x2c')](function(_0x182b21){logger[_0x17d3('0x26')](_0x17d3('0x23'),_0x2b1015,_0x182b21);_0x41d1d9(_0x182b21);});});}function respondWithStatusCode(_0x2d0f14,_0x1b6e42){_0x1b6e42=_0x1b6e42||0xcc;return function(_0x3297b5){if(_0x3297b5){return _0x2d0f14['sendStatus'](_0x1b6e42);}return _0x2d0f14['status'](_0x1b6e42)[_0x17d3('0x2d')]();};}function respondWithResult(_0x31285e,_0xe95d36){_0xe95d36=_0xe95d36||0xc8;return function(_0x5de58d){if(_0x5de58d){return _0x31285e[_0x17d3('0x2e')](_0xe95d36)[_0x17d3('0x2f')](_0x5de58d);}};}function respondWithFilteredResult(_0x2e937f,_0x353e18){return function(_0x2f892a){if(_0x2f892a){var _0x24ad64=_0x2f892a[_0x17d3('0x30')],_0xac36df=_0x353e18[_0x17d3('0x31')],_0x1d7c12=_0x353e18[_0x17d3('0x31')]+_0x353e18[_0x17d3('0x32')],_0x66e375;if(_0x1d7c12>=_0x24ad64){_0x1d7c12=_0x24ad64;_0x66e375=0xc8;}else{_0x66e375=0xce;}_0x2e937f[_0x17d3('0x2e')](_0x66e375);return _0x2e937f['set'](_0x17d3('0x33'),_0xac36df+'-'+_0x1d7c12+'/'+_0x24ad64)[_0x17d3('0x2f')](_0x2f892a);}return null;};}function patchUpdates(_0x5905bc){return function(_0x9ebb6e){try{jsonpatch[_0x17d3('0x34')](_0x9ebb6e,_0x5905bc,!![]);}catch(_0x3c79fd){return BPromise[_0x17d3('0x35')](_0x3c79fd);}return _0x9ebb6e[_0x17d3('0x36')]();};}function saveUpdates(_0x222679,_0x57f523){return function(_0x1dfae7){if(_0x1dfae7){return _0x1dfae7[_0x17d3('0x37')](_0x222679)['then'](function(_0x1e7060){return _0x1e7060;});}return null;};}function removeEntity(_0x23f3cb,_0x202433){return function(_0x49ca39){if(_0x49ca39){return _0x49ca39[_0x17d3('0x38')]()['then'](function(){var _0x38401e=_0x49ca39[_0x17d3('0x39')]({'plain':!![]});var _0x273dfe=[{'name':_0x17d3('0x3a'),'value':_0x17d3('0x3b'),'ignore':!![]},{'name':_0x17d3('0x3c'),'value':_0x17d3('0x3d'),'ignore':![]},{'name':_0x17d3('0x3e'),'value':_0x17d3('0x3f'),'ignore':![]}];var _0x45f8d2=_(_0x273dfe)['filter'](_0x17d3('0x40'))[_0x17d3('0x41')](_0x17d3('0x42'))[_0x17d3('0x42')]();if(_['includes'](_0x45f8d2,_0x38401e[_0x17d3('0x43')])){return;}var _0x1b89bf=_[_0x17d3('0x44')](_0x273dfe,[_0x17d3('0x42'),_0x38401e[_0x17d3('0x43')]])[_0x17d3('0x45')];return db[_0x17d3('0x46')][_0x17d3('0x38')]({'where':{'type':_0x1b89bf,'resourceId':_0x38401e['id']}})[_0x17d3('0x22')](function(){return _0x49ca39;});})[_0x17d3('0x22')](function(){_0x23f3cb[_0x17d3('0x2e')](0xcc)[_0x17d3('0x2d')]();});}};}function handleEntityNotFound(_0xa09e22,_0x4ee417){return function(_0x50eb18){if(!_0x50eb18){_0xa09e22[_0x17d3('0x47')](0x194);}return _0x50eb18;};}function handleError(_0x5e8cde,_0xcec95f){_0xcec95f=_0xcec95f||0x1f4;return function(_0x146fa8){logger['error'](_0x146fa8[_0x17d3('0x48')]);if(_0x146fa8[_0x17d3('0x45')]){delete _0x146fa8['name'];}_0x5e8cde[_0x17d3('0x2e')](_0xcec95f)[_0x17d3('0x49')](_0x146fa8);};}exports[_0x17d3('0x4a')]=function(_0x4c5a76,_0x2f2661){var _0x518e29={},_0x463776={},_0x35b177={'count':0x0,'rows':[]};var _0x4b6e04=_['map'](db['User'][_0x17d3('0x4b')],function(_0x43b6d3){return{'name':_0x43b6d3['fieldName'],'type':_0x43b6d3['type']['key']};});_0x463776['model']=_[_0x17d3('0x4c')](_[_0x17d3('0x41')](_0x4b6e04,_0x17d3('0x45')),['password','salt']);_0x463776['query']=_[_0x17d3('0x4d')](_0x4c5a76['query']);_0x463776[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x463776['model'],_0x463776[_0x17d3('0x50')]);_0x518e29['attributes']=_[_0x17d3('0x4f')](_0x463776[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x52')]));_0x518e29[_0x17d3('0x53')]=_0x518e29['attributes'][_0x17d3('0x54')]?_0x518e29[_0x17d3('0x53')]:_0x463776[_0x17d3('0x51')];if(!_0x4c5a76['query'][_0x17d3('0x55')](_0x17d3('0x56'))){_0x518e29[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x32')]);_0x518e29[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x31')]);}_0x518e29['order']=qs[_0x17d3('0x57')](_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x57')]);_0x518e29['where']=qs['filters'](_[_0x17d3('0x58')](_0x4c5a76[_0x17d3('0x50')],_0x463776[_0x17d3('0x4e')]),_0x4b6e04);if(_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x59')]){_0x518e29[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x518e29[_0x17d3('0x5a')],{'$or':_[_0x17d3('0x41')](_0x4b6e04,function(_0x47d70a){if(_0x47d70a[_0x17d3('0x5c')]!==_0x17d3('0x5d')){return db['sequelize']['where'](db['sequelize']['fn']('lower',db[_0x17d3('0x5e')][_0x17d3('0x5f')](_0x47d70a[_0x17d3('0x45')])),{'$like':db[_0x17d3('0x5e')]['fn']('lower','%'+_0x4c5a76['query'][_0x17d3('0x59')]+'%')});}})});}_0x518e29=_[_0x17d3('0x5b')]({},_0x518e29,_0x4c5a76[_0x17d3('0x60')]);var _0xd58d1c={'where':_0x518e29[_0x17d3('0x5a')]};return db[_0x17d3('0x61')][_0x17d3('0x30')](_0xd58d1c)['then'](function(_0xf9e35){_0x35b177[_0x17d3('0x30')]=_0xf9e35;if(_0x4c5a76[_0x17d3('0x50')][_0x17d3('0x62')]){_0x518e29['include']=[{'all':!![]}];}return db[_0x17d3('0x61')][_0x17d3('0x63')](_0x518e29);})[_0x17d3('0x22')](function(_0xeda3a8){_0x35b177[_0x17d3('0x64')]=_0xeda3a8;return _0x35b177;})[_0x17d3('0x22')](respondWithFilteredResult(_0x2f2661,_0x518e29))[_0x17d3('0x2c')](handleError(_0x2f2661,null));};exports['show']=function(_0x3c0734,_0xf36bfe){var _0x135b7f={'raw':![],'where':{'id':_0x3c0734[_0x17d3('0x65')]['id']}},_0x43df8={};_0x43df8['model']=_[_0x17d3('0x4c')](_[_0x17d3('0x4d')](db[_0x17d3('0x61')][_0x17d3('0x4b')]),[_0x17d3('0x66'),'salt']);_0x43df8[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x3c0734[_0x17d3('0x50')]);_0x43df8[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x43df8[_0x17d3('0x51')],_0x43df8[_0x17d3('0x50')]);_0x135b7f[_0x17d3('0x53')]=_['intersection'](_0x43df8[_0x17d3('0x51')],qs['fields'](_0x3c0734[_0x17d3('0x50')][_0x17d3('0x52')]));_0x135b7f[_0x17d3('0x53')]=_0x135b7f['attributes']['length']?_0x135b7f['attributes']:_0x43df8['model'];if(_0x3c0734[_0x17d3('0x50')][_0x17d3('0x62')]){_0x135b7f[_0x17d3('0x67')]=[{'all':!![]}];}_0x135b7f=_[_0x17d3('0x5b')]({},_0x135b7f,_0x3c0734['options']);return db[_0x17d3('0x61')][_0x17d3('0x44')](_0x135b7f)[_0x17d3('0x22')](handleEntityNotFound(_0xf36bfe,null))['then'](respondWithResult(_0xf36bfe,null))[_0x17d3('0x2c')](handleError(_0xf36bfe,null));};exports[_0x17d3('0x68')]=function(_0x1efb76,_0x1ad8a6){return db[_0x17d3('0x61')][_0x17d3('0x68')](_0x1efb76[_0x17d3('0x69')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1ad8a6,0xc9))[_0x17d3('0x2c')](handleError(_0x1ad8a6,null));};exports[_0x17d3('0x37')]=function(_0x4c49a4,_0x2680e4){if(_0x4c49a4['body']['id']){delete _0x4c49a4[_0x17d3('0x69')]['id'];}delete _0x4c49a4[_0x17d3('0x69')][_0x17d3('0x43')];return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x4c49a4['params']['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x2680e4,null))[_0x17d3('0x22')](saveUpdates(_0x4c49a4['body'],null))['then'](respondWithResult(_0x2680e4,null))[_0x17d3('0x2c')](handleError(_0x2680e4,null));};exports[_0x17d3('0x6a')]=function(_0xedb038,_0x4cea69){return db[_0x17d3('0x61')][_0x17d3('0x6a')]()[_0x17d3('0x22')](respondWithResult(_0x4cea69,null))[_0x17d3('0x2c')](handleError(_0x4cea69,null));};exports[_0x17d3('0x6b')]=function(_0x472826,_0xa4dc63,_0x30b54b){return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x472826[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0xa4dc63,null))['then'](function(_0x34c8d2){if(_0x34c8d2){return _0x34c8d2[_0x17d3('0x6b')](_0x472826[_0x17d3('0x69')]['ids'],_['omit'](_0x472826[_0x17d3('0x69')],[_0x17d3('0x6c'),'id'])||{});}})[_0x17d3('0x22')](respondWithResult(_0xa4dc63,null))[_0x17d3('0x2c')](handleError(_0xa4dc63,null));};var getLicense=function(_0x3b1624){return new BPromise(function(_0x53d609,_0x293403){var _0x39080b=0x0;_0x3b1624[_0x17d3('0x69')][_0x17d3('0x43')]===_0x17d3('0x3d')&&_0x53d609('agent\x20role');return db[_0x17d3('0x61')]['count']({'where':{'$or':[{'role':_0x3b1624['body'][_0x17d3('0x43')]===_0x17d3('0x3f')?'telephone':[_0x17d3('0x6d'),_0x17d3('0x3b')]}]}})[_0x17d3('0x22')](function(_0x22b8a8){_0x39080b=_0x22b8a8;return require(_0x17d3('0x6e'))[_0x17d3('0x6f')]();})[_0x17d3('0x22')](function(_0x573e0f){var _0x1058b1=_0x3b1624[_0x17d3('0x69')]['role']===_0x17d3('0x3f')?_0x17d3('0x70'):_0x17d3('0x71');if(!_[_0x17d3('0x72')](_0x573e0f[_0x1058b1])&&_0x39080b>=_0x573e0f[_0x1058b1]){return _0x293403({'message':_0x17d3('0x73')});}return _0x53d609(util['format'](_0x17d3('0x74'),_0x1058b1,_0x39080b));})['catch'](function(_0x41dca8){return _0x293403(_0x41dca8);});});};exports[_0x17d3('0x75')]=function(_0x16869d,_0x99106){return getLicense(_0x16869d)['then'](function(_0x5ef94d){if(!_0x16869d[_0x17d3('0x69')]['internal']){var _0x521bd6;return db[_0x17d3('0x76')][_0x17d3('0x77')](0x1)[_0x17d3('0x22')](function(_0x5213ad){return checkPasswordPattern(_0x5213ad,_0x16869d[_0x17d3('0x69')]['password'],_0x5213ad['securePassword']);})['then'](function(_0x51af9a){_0x521bd6=_0x51af9a[_0x17d3('0x78')];return db[_0x17d3('0x61')][_0x17d3('0x79')](_0x17d3('0x7a'));})['then'](function(_0x2b43f5){if(_[_0x17d3('0x72')](_0x2b43f5)){if(_0x521bd6){_0x16869d['body'][_0x17d3('0x7a')]=_0x521bd6;}else{_0x16869d['body'][_0x17d3('0x7a')]=0x1;}}else{if(_[_0x17d3('0x72')](_0x521bd6)||_0x521bd6==_0x2b43f5){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x2b43f5+0x1;}else if(_0x521bd6>_0x2b43f5){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x521bd6;}else{return db[_0x17d3('0x5e')][_0x17d3('0x50')](_0x17d3('0x7b'),{'type':db[_0x17d3('0x5e')][_0x17d3('0x7c')][_0x17d3('0x7d')]})[_0x17d3('0x22')](function(_0x2f2bbb){if(_0x2f2bbb&&_0x2f2bbb['length']){for(var _0x5f1d3d=0x0,_0x2628e3=_0x2f2bbb[_0x17d3('0x54')];_0x5f1d3d<_0x2628e3&&_['isNil'](_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]);_0x5f1d3d++){if(_0x521bd6<=_0x2f2bbb[_0x5f1d3d][_0x17d3('0x7e')]){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x2f2bbb[_0x5f1d3d][_0x17d3('0x7e')];}else if(_0x521bd6>_0x2f2bbb[_0x5f1d3d][_0x17d3('0x7e')]&&_0x521bd6<=_0x2f2bbb[_0x5f1d3d]['to']){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x521bd6;}}}if(_['isNil'](_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')])){_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')]=_0x2b43f5+0x1;}});}}});}})[_0x17d3('0x22')](function(){if(_0x16869d[_0x17d3('0x69')]['voicemail']){_0x16869d[_0x17d3('0x69')]['mailbox']=_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')];_0x16869d['body'][_0x17d3('0x7f')]={'mailbox':_0x16869d[_0x17d3('0x69')][_0x17d3('0x7a')],'password':_0x16869d[_0x17d3('0x69')]['password'],'fullname':_0x16869d[_0x17d3('0x69')][_0x17d3('0x80')],'email':_0x16869d[_0x17d3('0x69')][_0x17d3('0x81')]};}if(_0x16869d[_0x17d3('0x69')]&&_0x16869d[_0x17d3('0x69')]['role']==='agent'){if(!_0x16869d['body']['permissions']){_0x16869d[_0x17d3('0x69')][_0x17d3('0x82')]=['101',_0x17d3('0x83'),_0x17d3('0x84'),_0x17d3('0x85'),_0x17d3('0x86'),_0x17d3('0x87'),_0x17d3('0x88'),_0x17d3('0x89'),_0x17d3('0x8a'),_0x17d3('0x8b'),'109',_0x17d3('0x8c'),_0x17d3('0x8d'),_0x17d3('0x8e')];}}return db['User']['create'](_0x16869d['body'],{'include':[{'model':db[_0x17d3('0x7f')],'as':_0x17d3('0x7f')}]});})[_0x17d3('0x22')](function(_0xa631d9){if(_0x16869d[_0x17d3('0x69')]['role']==='user')return _0xa631d9;var _0xa44436=_0x16869d['user'][_0x17d3('0x39')]({'plain':!![]});if(!_0xa44436)throw new Error(_0x17d3('0x8f'));if(_0xa44436['role']===_0x17d3('0x3b')){var _0x471352=_0xa631d9['get']({'plain':!![]});var _0x170a93=[{'name':_0x17d3('0x3c'),'value':_0x17d3('0x3d')},{'name':'Telephones','value':_0x17d3('0x3f')}];var _0x52d77a=_['find'](_0x170a93,[_0x17d3('0x42'),_0x471352[_0x17d3('0x43')]])[_0x17d3('0x45')];return db[_0x17d3('0x90')][_0x17d3('0x44')]({'where':{'name':_0x52d77a,'userProfileId':_0xa44436[_0x17d3('0x91')]},'raw':!![]})[_0x17d3('0x22')](function(_0x3013f7){if(_0x3013f7&&_0x3013f7['autoAssociation']===0x0){return db['UserProfileResource'][_0x17d3('0x75')]({'name':_0x471352[_0x17d3('0x45')],'resourceId':_0x471352['id'],'type':_0x3013f7[_0x17d3('0x45')],'sectionId':_0x3013f7['id']},{})['then'](function(){return _0xa631d9;});}else{return _0xa631d9;}})['catch'](function(_0x1080dd){logger[_0x17d3('0x26')](_0x17d3('0x92'),_0x1080dd);throw _0x1080dd;});}return _0xa631d9;})[_0x17d3('0x22')](respondWithResult(_0x99106,0xc9))[_0x17d3('0x2c')](handleError(_0x99106,null));};exports[_0x17d3('0x93')]=function(_0x212862,_0x3a657a,_0x4e0eb7){var _0x17db04=![];if(_0x212862[_0x17d3('0x69')]['id']){delete _0x212862[_0x17d3('0x69')]['id'];}return db[_0x17d3('0x76')][_0x17d3('0x94')]({'attributes':['id',_0x17d3('0x95')]})[_0x17d3('0x22')](function(_0x4e934a){_0x17db04=_0x4e934a[_0x17d3('0x95')];return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x212862['params']['id']}});})[_0x17d3('0x22')](function(_0x39898b){if(_0x39898b){if(_0x39898b['id']==_0x212862[_0x17d3('0x3b')]['id']){if(!_0x212862[_0x17d3('0x69')][_0x17d3('0x96')]||!_0x212862[_0x17d3('0x69')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x17d3('0x97'));}if(!_0x39898b[_0x17d3('0x98')](_0x212862['body'][_0x17d3('0x96')])){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))](_0x17d3('0x9b'));}if(_0x212862[_0x17d3('0x69')]['oldPassword']==_0x212862[_0x17d3('0x69')][_0x17d3('0x9c')]){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x39898b;}else if(_0x212862['user']['role']==_0x17d3('0x6d')){if(!_0x212862[_0x17d3('0x69')][_0x17d3('0x9c')]){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))](_0x17d3('0x9d'));}return _0x39898b;}else if(_0x212862[_0x17d3('0x3b')]['role']==_0x17d3('0x3b')){if(!_0x212862[_0x17d3('0x69')]['newPassword']){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x39898b[_0x17d3('0x43')]!='agent'){throw new db[(_0x17d3('0x99'))]['ValidationError'](_0x17d3('0x9e'));}return _0x39898b;}else{throw new db['Sequelize']['ValidationError']('Unauthorized');}}return null;})['then'](handleEntityNotFound(_0x3a657a,null))['then'](function(_0x3d4056){return checkPasswordPattern(_0x3d4056,_0x212862[_0x17d3('0x69')]['newPassword'],_0x17db04);})['then'](saveUpdates({'password':_0x212862['body'][_0x17d3('0x9c')],'passwordResetAt':_0x212862[_0x17d3('0x3b')]['id']==_0x212862[_0x17d3('0x65')]['id']?moment():null},null))[_0x17d3('0x22')](respondWithResult(_0x3a657a,null))[_0x17d3('0x2c')](handleError(_0x3a657a,null));};exports[_0x17d3('0x9f')]=function(_0x5d651a,_0x1e26c4,_0x34ee02){var _0x3ce02f=_0x5d651a[_0x17d3('0x69')]['channel'];return db['User']['find']({'where':{'id':_0x5d651a[_0x17d3('0x65')]['id']},'attributes':['id','name',_0x17d3('0x43'),'online',_0x17d3('0xa0'),_0x17d3('0xa1'),_0x17d3('0xa2')]})[_0x17d3('0x22')](handleEntityNotFound(_0x1e26c4,null))[_0x17d3('0x22')](function(_0x35e5ac){if(_0x35e5ac){if(!utils[_0x17d3('0xa3')](_0x3ce02f)){throw new db[(_0x17d3('0x99'))]['ValidationError'](_0x17d3('0xa4'));}return _0x35e5ac[_0x17d3('0xa5')+_[_0x17d3('0xa6')](_0x3ce02f[_0x17d3('0xa7')]())+'Queues'](_0x5d651a['body'][_0x17d3('0x6c')],{'penalty':_0x5d651a['body'][_0x17d3('0xa8')]||0x0})[_0x17d3('0xa9')](function(_0x4333ba){for(var _0x33b48a=0x0;_0x33b48a<_0x5d651a['body'][_0x17d3('0x6c')][_0x17d3('0x54')];_0x33b48a+=0x1){var _0x598954={'UserId':_0x5d651a['params']['id']};_0x598954[_[_0x17d3('0xa6')](_0x3ce02f[_0x17d3('0xa7')]())+_0x17d3('0xaa')]=_0x5d651a[_0x17d3('0x69')]['ids'][_0x33b48a];socket[_0x17d3('0xab')](_0x17d3('0x3b')+_[_0x17d3('0xa6')](_0x3ce02f[_0x17d3('0xa7')]())+'Queue:save',_0x598954);}return _0x4333ba;})['then'](function(){if(_0x3ce02f==='voice'){return db[_0x17d3('0xac')][_0x17d3('0x63')]({'where':{'id':_0x5d651a[_0x17d3('0x69')][_0x17d3('0x6c')]||[]},'raw':!![],'attributes':['id',_0x17d3('0x45')]});}})[_0x17d3('0x22')](function(_0x32fb0c){var _0x393583=_0x35e5ac[_0x17d3('0x39')]({'plain':!![]});var _0x572777=[];if(_0x3ce02f==='voice'&&_0x393583[_0x17d3('0x43')]===_0x17d3('0x3d')&&_0x393583[_0x17d3('0xad')]){for(var _0x2cab66=0x0;_0x2cab66<_0x32fb0c[_0x17d3('0x54')];_0x2cab66+=0x1){_0x572777[_0x17d3('0xae')]({'membername':_0x393583[_0x17d3('0x45')],'UserId':_0x393583['id'],'queue_name':_0x32fb0c[_0x2cab66][_0x17d3('0x45')],'VoiceQueueId':_0x32fb0c[_0x2cab66]['id'],'interface':_['isNil'](_0x393583['interface'])?util[_0x17d3('0xaf')](_0x17d3('0xb0'),_0x393583[_0x17d3('0x45')]):_0x393583[_0x17d3('0xa2')],'paused':_0x393583[_0x17d3('0xa1')]||![],'penalty':_0x5d651a[_0x17d3('0x69')][_0x17d3('0xa8')]||0x0});}return BPromise[_0x17d3('0xb1')](_0x572777,function(_0x1e8490){return db['UserVoiceQueueRt']['upsert'](_0x1e8490);});}return _0x35e5ac;});}})['then'](respondWithStatusCode(_0x1e26c4,null))[_0x17d3('0x2c')](handleError(_0x1e26c4,null));};exports[_0x17d3('0xb2')]=function(_0x3f5eb2,_0x54da57,_0x52467c){var _0x211ca6;return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x3f5eb2[_0x17d3('0x65')]['id']},'attributes':['id',_0x17d3('0x45'),_0x17d3('0x43')]})['then'](handleEntityNotFound(_0x54da57,null))[_0x17d3('0x22')](function(_0x10c5c3){if(_0x10c5c3){_0x211ca6=_0x10c5c3;if(!_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0xb3')]||!utils[_0x17d3('0xa3')](_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0xb3')])){throw new db['Sequelize'][(_0x17d3('0x9a'))](_0x17d3('0xa4'));}return _0x10c5c3[_0x17d3('0xb4')+_['capitalize'](_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0xb3')][_0x17d3('0xa7')]())+_0x17d3('0xb5')](_0x3f5eb2['query'][_0x17d3('0x6c')]);}})['then'](function(_0x435536){for(var _0x2ca112=0x0;_0x2ca112<_0x3f5eb2['query'][_0x17d3('0x6c')][_0x17d3('0x54')];_0x2ca112+=0x1){var _0x31679a={'UserId':_0x3f5eb2[_0x17d3('0x65')]['id']};_0x31679a[_['capitalize'](_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0xb3')][_0x17d3('0xa7')]())+_0x17d3('0xaa')]=_0x3f5eb2[_0x17d3('0x50')]['ids'][_0x2ca112];socket[_0x17d3('0xab')](_0x17d3('0x3b')+_[_0x17d3('0xa6')](_0x3f5eb2['query'][_0x17d3('0xb3')][_0x17d3('0xa7')]())+_0x17d3('0xb6'),_0x31679a);}return _0x435536;})[_0x17d3('0x22')](function(){if(_0x3f5eb2[_0x17d3('0x50')]['channel']===_0x17d3('0xb7')){return db[_0x17d3('0xb8')][_0x17d3('0x38')]({'where':{'UserId':_0x3f5eb2['params']['id'],'VoiceQueueId':_0x3f5eb2[_0x17d3('0x50')][_0x17d3('0x6c')]},'individualHooks':!![]})[_0x17d3('0x22')](function(){return _0x211ca6;});}return _0x211ca6;})[_0x17d3('0x22')](respondWithStatusCode(_0x54da57,null))[_0x17d3('0x2c')](handleError(_0x54da57,null));};exports[_0x17d3('0xb9')]=function(_0x1850d3,_0x123526,_0x18b806){_0x1850d3['body'][_0x17d3('0xba')]=_0x1850d3['file'][_0x17d3('0xbb')];return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x1850d3[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x123526,null))[_0x17d3('0x22')](saveUpdates(_0x1850d3[_0x17d3('0x69')],null))[_0x17d3('0x22')](respondWithResult(_0x123526,null))[_0x17d3('0x2c')](handleError(_0x123526,null));};exports[_0x17d3('0xbc')]=function(_0x1cde94,_0x1daa08,_0x1bde46){var _0x57370b=path[_0x17d3('0xbd')](config[_0x17d3('0xbe')],'server/files/images/logos/default_profile.png');return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x1cde94[_0x17d3('0x65')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x1daa08,null))[_0x17d3('0x22')](function(_0x486822){if(_0x486822){if(_[_0x17d3('0x72')](_0x486822[_0x17d3('0xba')])){return _0x1daa08[_0x17d3('0xbf')](_0x57370b);}else{if(!fs['existsSync'](path[_0x17d3('0xbd')](config[_0x17d3('0xbe')],_0x17d3('0xc0'),_0x486822[_0x17d3('0xba')]))){return _0x1daa08[_0x17d3('0xbf')](_0x57370b);}return _0x1daa08[_0x17d3('0xbf')](path['join'](config[_0x17d3('0xbe')],_0x17d3('0xc0'),_0x486822[_0x17d3('0xba')]));}}})[_0x17d3('0x2c')](handleError(_0x1daa08,null));};exports[_0x17d3('0xc1')]=function(_0x2e8fcc,_0x36a47b,_0x410014){var _0xeeb008={};var _0x4e154e={};var _0x8491b4;var _0x6e098a;return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x2e8fcc[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x36a47b,null))[_0x17d3('0x22')](function(_0x5da1b4){if(_0x5da1b4){_0x8491b4=_0x5da1b4;_0x4e154e[_0x17d3('0x51')]=_[_0x17d3('0x4d')](db[_0x17d3('0xc2')][_0x17d3('0x4b')]);_0x4e154e['query']=_[_0x17d3('0x4d')](_0x2e8fcc[_0x17d3('0x50')]);_0x4e154e[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x4e154e['model'],_0x4e154e[_0x17d3('0x50')]);_0xeeb008[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x4e154e[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x2e8fcc['query'][_0x17d3('0x52')]));_0xeeb008[_0x17d3('0x53')]=_0xeeb008[_0x17d3('0x53')][_0x17d3('0x54')]?_0xeeb008[_0x17d3('0x53')]:_0x4e154e['model'];_0xeeb008[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x57')]);_0xeeb008[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x2e8fcc[_0x17d3('0x50')],_0x4e154e[_0x17d3('0x4e')]));if(_0x2e8fcc['query'][_0x17d3('0x59')]){_0xeeb008[_0x17d3('0x5a')]=_['merge'](_0xeeb008['where'],{'$or':_['map'](_0xeeb008[_0x17d3('0x53')],function(_0x581b3d){var _0x26079e={};_0x26079e[_0x581b3d]={'$like':'%'+_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x26079e;})});}_0xeeb008=_['merge']({},_0xeeb008,_0x2e8fcc[_0x17d3('0x60')]);return _0x8491b4[_0x17d3('0xc1')](_0xeeb008);}})[_0x17d3('0x22')](function(_0x496c72){if(_0x496c72){_0x6e098a=_0x496c72['length'];if(_0x2e8fcc['query']['hasOwnProperty'](_0x17d3('0x62'))){_0xeeb008[_0x17d3('0x67')]=[{'model':db[_0x17d3('0xc4')],'as':_0x17d3('0xc5'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x17d3('0x45'),_0x17d3('0xc6')],'where':_0x2e8fcc['query'][_0x17d3('0xc7')]?{'id':_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0xc7')]}:undefined,'required':_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0xc7')]?!![]:![]}];}if(!_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x55')]('nolimit')){_0xeeb008[_0x17d3('0x32')]=qs['limit'](_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x32')]);_0xeeb008[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x2e8fcc[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x8491b4['getContacts'](_0xeeb008);}})[_0x17d3('0x22')](function(_0x2b80fb){if(_0x2b80fb){return _0x2b80fb?{'count':_0x6e098a,'rows':_0x2b80fb}:null;}})[_0x17d3('0x22')](respondWithResult(_0x36a47b,null))[_0x17d3('0x2c')](handleError(_0x36a47b,null));};exports[_0x17d3('0xc8')]=function(_0x14aa31,_0x57e9bc,_0x5591fa){var _0x28e993;var _0x417b70;var _0x4d4982={};var _0x372571;return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x14aa31['params']['id']},'attributes':['id',_0x17d3('0x45'),'role']})[_0x17d3('0x22')](handleEntityNotFound(_0x57e9bc,null))[_0x17d3('0x22')](function(_0x4570cf){if(!utils[_0x17d3('0xa3')](_0x14aa31['query'][_0x17d3('0xb3')])){throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))](_0x17d3('0xa4'));}_0x28e993=_0x4570cf;var _0x4c8b0c={};_0x4c8b0c['model']=_[_0x17d3('0x4d')](db[_[_0x17d3('0xa6')](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+'Queue'][_0x17d3('0x4b')]);_0x4c8b0c[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x14aa31[_0x17d3('0x50')]);_0x4c8b0c[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x4c8b0c[_0x17d3('0x51')],_0x4c8b0c[_0x17d3('0x50')]);_0x4d4982[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x4c8b0c[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x14aa31['query'][_0x17d3('0x52')]));_0x4d4982[_0x17d3('0x53')]=_0x4d4982[_0x17d3('0x53')][_0x17d3('0x54')]?_0x4d4982[_0x17d3('0x53')]:_0x4c8b0c['model'];_0x4d4982['order']=qs['sort'](_0x14aa31[_0x17d3('0x50')][_0x17d3('0x57')]);_0x4d4982[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_['pick'](_0x14aa31[_0x17d3('0x50')],_0x4c8b0c[_0x17d3('0x4e')]));if(_0x14aa31['query'][_0x17d3('0x59')]){_0x4d4982[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x4d4982['where'],{'$or':_[_0x17d3('0x41')](_0x4d4982['attributes'],function(_0x408e97){var _0x1724f5={};_0x1724f5[_0x408e97]={'$like':'%'+_0x14aa31['query'][_0x17d3('0x59')]+'%'};return _0x1724f5;})});}_0x4d4982=_[_0x17d3('0x5b')]({},_0x4d4982,_0x14aa31[_0x17d3('0x60')]);switch(_0x28e993[_0x17d3('0x43')]){case'admin':return db[_['capitalize'](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+_0x17d3('0xc9')][_0x17d3('0x63')](_0x4d4982);case _0x17d3('0x3b'):case _0x17d3('0x3d'):return _0x28e993[_0x17d3('0x39')+_['capitalize'](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+_0x17d3('0xb5')](_0x4d4982);default:throw new db[(_0x17d3('0x99'))]['ValidationError'](_0x17d3('0xca'));}})[_0x17d3('0x22')](function(_0x458d42){_0x372571=_0x458d42[_0x17d3('0x54')];if(!_0x14aa31[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x4d4982['limit']=qs[_0x17d3('0x32')](_0x14aa31[_0x17d3('0x50')][_0x17d3('0x32')]);_0x4d4982['offset']=qs['offset'](_0x14aa31[_0x17d3('0x50')][_0x17d3('0x31')]);}switch(_0x28e993[_0x17d3('0x43')]){case _0x17d3('0x6d'):return db[_[_0x17d3('0xa6')](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+_0x17d3('0xc9')][_0x17d3('0x63')](_0x4d4982);case _0x17d3('0x3b'):case _0x17d3('0x3d'):return _0x28e993[_0x17d3('0x39')+_[_0x17d3('0xa6')](_0x14aa31[_0x17d3('0x50')][_0x17d3('0xb3')])+_0x17d3('0xb5')](_0x4d4982);}})[_0x17d3('0x22')](function(_0x16d0e2){return{'count':_0x372571,'rows':_0x16d0e2};})[_0x17d3('0x22')](respondWithResult(_0x57e9bc,null))['catch'](handleError(_0x57e9bc,null));};exports['getVoiceQueuesRt']=function(_0xe29fb4,_0x114e6e,_0x3cab52){var _0x572fe2={};var _0x2ea167={};var _0x39cb7a;var _0xc540a5;return db['User'][_0x17d3('0x94')]({'where':{'id':_0xe29fb4[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x114e6e,null))['then'](function(_0x3235d0){if(_0x3235d0){_0x39cb7a=_0x3235d0;_0x2ea167['model']=_[_0x17d3('0x4d')](db[_0x17d3('0xb8')][_0x17d3('0x4b')]);_0x2ea167[_0x17d3('0x50')]=_['keys'](_0xe29fb4[_0x17d3('0x50')]);_0x2ea167[_0x17d3('0x4e')]=_['intersection'](_0x2ea167[_0x17d3('0x51')],_0x2ea167[_0x17d3('0x50')]);_0x572fe2[_0x17d3('0x53')]=_['intersection'](_0x2ea167[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0xe29fb4['query'][_0x17d3('0x52')]));_0x572fe2[_0x17d3('0x53')]=_0x572fe2[_0x17d3('0x53')][_0x17d3('0x54')]?_0x572fe2['attributes']:_0x2ea167[_0x17d3('0x51')];_0x572fe2[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0xe29fb4[_0x17d3('0x50')]['sort']);_0x572fe2[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0xe29fb4['query'],_0x2ea167['filters']));if(_0xe29fb4['query'][_0x17d3('0x59')]){_0x572fe2[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x572fe2['where'],{'$or':_[_0x17d3('0x41')](_0x572fe2[_0x17d3('0x53')],function(_0x3f7ccf){var _0x2e5631={};_0x2e5631[_0x3f7ccf]={'$like':'%'+_0xe29fb4['query']['filter']+'%'};return _0x2e5631;})});}_0x572fe2=_[_0x17d3('0x5b')]({},_0x572fe2,_0xe29fb4[_0x17d3('0x60')]);return _0x39cb7a[_0x17d3('0xcb')](_0x572fe2);}})[_0x17d3('0x22')](function(_0x2da750){if(_0x2da750){_0xc540a5=_0x2da750[_0x17d3('0x54')];if(!_0xe29fb4[_0x17d3('0x50')]['hasOwnProperty'](_0x17d3('0x56'))){_0x572fe2[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0xe29fb4[_0x17d3('0x50')][_0x17d3('0x32')]);_0x572fe2[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0xe29fb4[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x39cb7a[_0x17d3('0xcb')](_0x572fe2);}})[_0x17d3('0x22')](function(_0x3dc68c){if(_0x3dc68c){return _0x3dc68c?{'count':_0xc540a5,'rows':_0x3dc68c}:null;}})['then'](respondWithResult(_0x114e6e,null))[_0x17d3('0x2c')](handleError(_0x114e6e,null));};exports['getGroups']=function(_0x5ad128,_0x2c3738,_0x163a33){var _0x528d98={};var _0x13e62e={};var _0x4faaac;var _0x2adc66;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x5ad128[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x2c3738,null))[_0x17d3('0x22')](function(_0x596554){if(_0x596554){_0x4faaac=_0x596554;_0x13e62e['model']=_[_0x17d3('0x4d')](db['ChatGroup'][_0x17d3('0x4b')]);_0x13e62e[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x5ad128[_0x17d3('0x50')]);_0x13e62e[_0x17d3('0x4e')]=_['intersection'](_0x13e62e['model'],_0x13e62e[_0x17d3('0x50')]);_0x528d98[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x13e62e[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x5ad128[_0x17d3('0x50')][_0x17d3('0x52')]));_0x528d98[_0x17d3('0x53')]=_0x528d98[_0x17d3('0x53')][_0x17d3('0x54')]?_0x528d98['attributes']:_0x13e62e['model'];_0x528d98['order']=qs[_0x17d3('0x57')](_0x5ad128[_0x17d3('0x50')][_0x17d3('0x57')]);_0x528d98[_0x17d3('0x5a')]=qs['filters'](_[_0x17d3('0x58')](_0x5ad128[_0x17d3('0x50')],_0x13e62e[_0x17d3('0x4e')]));if(_0x5ad128['query'][_0x17d3('0x59')]){_0x528d98[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x528d98[_0x17d3('0x5a')],{'$or':_['map'](_0x528d98['attributes'],function(_0x2e3cda){var _0x10f29c={};_0x10f29c[_0x2e3cda]={'$like':'%'+_0x5ad128[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x10f29c;})});}_0x528d98=_[_0x17d3('0x5b')]({},_0x528d98,_0x5ad128[_0x17d3('0x60')]);return _0x4faaac[_0x17d3('0xcc')](_0x528d98);}})[_0x17d3('0x22')](function(_0x4fc825){if(_0x4fc825){_0x2adc66=_0x4fc825[_0x17d3('0x54')];if(!_0x5ad128[_0x17d3('0x50')][_0x17d3('0x55')]('nolimit')){_0x528d98[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x5ad128[_0x17d3('0x50')][_0x17d3('0x32')]);_0x528d98['offset']=qs['offset'](_0x5ad128[_0x17d3('0x50')]['offset']);}return _0x4faaac[_0x17d3('0xcc')](_0x528d98);}})[_0x17d3('0x22')](function(_0x11f619){if(_0x11f619){return _0x11f619?{'count':_0x2adc66,'rows':_0x11f619}:null;}})[_0x17d3('0x22')](respondWithResult(_0x2c3738,null))['catch'](handleError(_0x2c3738,null));};exports[_0x17d3('0xcd')]=function(_0x59388f,_0x5708e2,_0x5a1ab5){var _0x543371={'raw':!![],'where':{}};var _0x5f79d0={};var _0x165244={'count':0x0,'rows':[]};return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x59388f[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x5708e2,null))[_0x17d3('0x22')](function(_0x22b9b6){if(_0x22b9b6){_0x5f79d0[_0x17d3('0x51')]=_[_0x17d3('0x4d')](db['VoiceRecording'][_0x17d3('0x4b')]);_0x5f79d0[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x59388f[_0x17d3('0x50')]);_0x5f79d0[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x5f79d0['model'],_0x5f79d0[_0x17d3('0x50')]);_0x543371[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x5f79d0[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x59388f['query'][_0x17d3('0x52')]));_0x543371[_0x17d3('0x53')]=_0x543371[_0x17d3('0x53')][_0x17d3('0x54')]?_0x543371[_0x17d3('0x53')]:_0x5f79d0['model'];if(!_0x59388f['query'][_0x17d3('0x55')](_0x17d3('0x56'))){_0x543371[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x59388f['query']['limit']);_0x543371[_0x17d3('0x31')]=qs['offset'](_0x59388f[_0x17d3('0x50')]['offset']);}_0x543371['order']=qs[_0x17d3('0x57')](_0x59388f['query'][_0x17d3('0x57')]);_0x543371[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x59388f[_0x17d3('0x50')],_0x5f79d0[_0x17d3('0x4e')]));_0x543371['where'][_0x17d3('0xce')]=_0x22b9b6['id'];if(_0x59388f[_0x17d3('0x50')][_0x17d3('0x59')]){_0x543371[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x543371[_0x17d3('0x5a')],{'$or':_['map'](_0x543371[_0x17d3('0x53')],function(_0x259be5){var _0x48b97d={};_0x48b97d[_0x259be5]={'$like':'%'+_0x59388f[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x48b97d;})});}_0x543371=_[_0x17d3('0x5b')]({},_0x543371,_0x59388f[_0x17d3('0x60')]);return db[_0x17d3('0xcf')][_0x17d3('0x30')]({'where':_0x543371[_0x17d3('0x5a')]})['then'](function(_0x5c346b){_0x165244[_0x17d3('0x30')]=_0x5c346b;if(_0x59388f['query'][_0x17d3('0x62')]){_0x543371[_0x17d3('0x67')]=[{'all':!![]}];}return db[_0x17d3('0xcf')][_0x17d3('0x63')](_0x543371);})['then'](function(_0xe383ef){_0x165244['rows']=_0xe383ef;return _0x165244;});}})[_0x17d3('0x22')](respondWithFilteredResult(_0x5708e2,_0x543371))[_0x17d3('0x2c')](handleError(_0x5708e2,null));};exports['getScreenRecordings']=function(_0x2ae667,_0x5b8f7e,_0x3e8d3e){var _0x2fe020={'raw':!![],'where':{}};var _0x39ea22={};var _0xae1988={'count':0x0,'rows':[]};return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x2ae667[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x5b8f7e,null))[_0x17d3('0x22')](function(_0x5ef08a){if(_0x5ef08a){_0x39ea22['model']=_[_0x17d3('0x4d')](db[_0x17d3('0xd0')][_0x17d3('0x4b')]);_0x39ea22[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x2ae667[_0x17d3('0x50')]);_0x39ea22[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x39ea22[_0x17d3('0x51')],_0x39ea22[_0x17d3('0x50')]);_0x2fe020[_0x17d3('0x53')]=_['intersection'](_0x39ea22[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x2ae667['query'][_0x17d3('0x52')]));_0x2fe020[_0x17d3('0x53')]=_0x2fe020[_0x17d3('0x53')]['length']?_0x2fe020['attributes']:_0x39ea22[_0x17d3('0x51')];if(!_0x2ae667[_0x17d3('0x50')][_0x17d3('0x55')]('nolimit')){_0x2fe020[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x2ae667['query'][_0x17d3('0x32')]);_0x2fe020['offset']=qs[_0x17d3('0x31')](_0x2ae667['query']['offset']);}_0x2fe020['order']=qs[_0x17d3('0x57')](_0x2ae667[_0x17d3('0x50')][_0x17d3('0x57')]);_0x2fe020[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x2ae667[_0x17d3('0x50')],_0x39ea22[_0x17d3('0x4e')]));_0x2fe020[_0x17d3('0x5a')][_0x17d3('0xce')]=_0x5ef08a['id'];if(_0x2ae667['query'][_0x17d3('0x59')]){_0x2fe020['where']=_['merge'](_0x2fe020[_0x17d3('0x5a')],{'$or':_['map'](_0x2fe020[_0x17d3('0x53')],function(_0x5e43f4){var _0x2327b={};_0x2327b[_0x5e43f4]={'$like':'%'+_0x2ae667[_0x17d3('0x50')]['filter']+'%'};return _0x2327b;})});}_0x2fe020=_[_0x17d3('0x5b')]({},_0x2fe020,_0x2ae667[_0x17d3('0x60')]);return db[_0x17d3('0xd0')][_0x17d3('0x30')]({'where':_0x2fe020['where']})[_0x17d3('0x22')](function(_0x3bbd9c){_0xae1988['count']=_0x3bbd9c;if(_0x2ae667[_0x17d3('0x50')][_0x17d3('0x62')]){_0x2fe020[_0x17d3('0x67')]=[{'all':!![]}];}return db['ScreenRecording'][_0x17d3('0x63')](_0x2fe020);})[_0x17d3('0x22')](function(_0x35a234){_0xae1988[_0x17d3('0x64')]=_0x35a234;return _0xae1988;});}})['then'](respondWithFilteredResult(_0x5b8f7e,_0x2fe020))[_0x17d3('0x2c')](handleError(_0x5b8f7e,null));};exports['getChatInteractions']=function(_0x30b5ac,_0x471b3f,_0x569f63){var _0x3ac26b={};var _0x374d2={};var _0x4604cf;var _0xaee36b;return db['User'][_0x17d3('0x94')]({'where':{'id':_0x30b5ac[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x471b3f,null))[_0x17d3('0x22')](function(_0x2247ad){if(_0x2247ad){_0x4604cf=_0x2247ad;_0x374d2['model']=_[_0x17d3('0x4d')](db['ChatInteraction'][_0x17d3('0x4b')]);_0x374d2['query']=_['keys'](_0x30b5ac[_0x17d3('0x50')]);_0x374d2['filters']=_[_0x17d3('0x4f')](_0x374d2[_0x17d3('0x51')],_0x374d2[_0x17d3('0x50')]);_0x3ac26b[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x374d2[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x52')]));_0x3ac26b[_0x17d3('0x53')]=_0x3ac26b[_0x17d3('0x53')]['length']?_0x3ac26b[_0x17d3('0x53')]:_0x374d2[_0x17d3('0x51')];_0x3ac26b[_0x17d3('0xc3')]=qs['sort'](_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x57')]);_0x3ac26b[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_['pick'](_0x30b5ac[_0x17d3('0x50')],_0x374d2['filters']));if(_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x59')]){_0x3ac26b[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x3ac26b[_0x17d3('0x5a')],{'$or':_['map'](_0x3ac26b[_0x17d3('0x53')],function(_0xeba50c){var _0x4def64={};_0x4def64[_0xeba50c]={'$like':'%'+_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x4def64;})});}_0x3ac26b=_[_0x17d3('0x5b')]({},_0x3ac26b,_0x30b5ac[_0x17d3('0x60')]);return _0x4604cf['getChatInteractions'](_0x3ac26b);}})[_0x17d3('0x22')](function(_0x9253f6){if(_0x9253f6){_0xaee36b=_0x9253f6[_0x17d3('0x54')];if(!_0x30b5ac['query']['hasOwnProperty'](_0x17d3('0x56'))){_0x3ac26b[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x32')]);_0x3ac26b[_0x17d3('0x31')]=qs['offset'](_0x30b5ac[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x4604cf[_0x17d3('0xd1')](_0x3ac26b);}})[_0x17d3('0x22')](function(_0x577c98){if(_0x577c98){return _0x577c98?{'count':_0xaee36b,'rows':_0x577c98}:null;}})['then'](respondWithResult(_0x471b3f,null))['catch'](handleError(_0x471b3f,null));};exports['getOpenchannelInteractions']=function(_0x3a2ff6,_0x67a705,_0x19fe96){var _0x26b448={};var _0x1cdc5b={};var _0x52d6f4;var _0x5a2af1;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x3a2ff6[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x67a705,null))[_0x17d3('0x22')](function(_0x1bc5b7){if(_0x1bc5b7){_0x52d6f4=_0x1bc5b7;_0x1cdc5b[_0x17d3('0x51')]=_['keys'](db['OpenchannelInteraction'][_0x17d3('0x4b')]);_0x1cdc5b[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x3a2ff6[_0x17d3('0x50')]);_0x1cdc5b[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x1cdc5b['model'],_0x1cdc5b['query']);_0x26b448['attributes']=_[_0x17d3('0x4f')](_0x1cdc5b['model'],qs['fields'](_0x3a2ff6['query'][_0x17d3('0x52')]));_0x26b448[_0x17d3('0x53')]=_0x26b448[_0x17d3('0x53')][_0x17d3('0x54')]?_0x26b448['attributes']:_0x1cdc5b[_0x17d3('0x51')];_0x26b448[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x3a2ff6[_0x17d3('0x50')][_0x17d3('0x57')]);_0x26b448[_0x17d3('0x5a')]=qs['filters'](_['pick'](_0x3a2ff6['query'],_0x1cdc5b[_0x17d3('0x4e')]));if(_0x3a2ff6[_0x17d3('0x50')][_0x17d3('0x59')]){_0x26b448[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x26b448['where'],{'$or':_[_0x17d3('0x41')](_0x26b448['attributes'],function(_0x30266e){var _0x4a7287={};_0x4a7287[_0x30266e]={'$like':'%'+_0x3a2ff6['query'][_0x17d3('0x59')]+'%'};return _0x4a7287;})});}_0x26b448=_[_0x17d3('0x5b')]({},_0x26b448,_0x3a2ff6[_0x17d3('0x60')]);return _0x52d6f4[_0x17d3('0xd2')](_0x26b448);}})['then'](function(_0x2c2b8f){if(_0x2c2b8f){_0x5a2af1=_0x2c2b8f[_0x17d3('0x54')];if(!_0x3a2ff6['query'][_0x17d3('0x55')]('nolimit')){_0x26b448[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x3a2ff6['query'][_0x17d3('0x32')]);_0x26b448['offset']=qs['offset'](_0x3a2ff6[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x52d6f4[_0x17d3('0xd2')](_0x26b448);}})['then'](function(_0x39aba3){if(_0x39aba3){return _0x39aba3?{'count':_0x5a2af1,'rows':_0x39aba3}:null;}})[_0x17d3('0x22')](respondWithResult(_0x67a705,null))['catch'](handleError(_0x67a705,null));};exports[_0x17d3('0xd3')]=function(_0x47f512,_0x37057d,_0xaeb0b7){var _0x275209={'raw':!![],'where':{}};var _0x2c6ae6={};var _0x13e3b1={'count':0x0,'rows':[]};return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x47f512[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x37057d,null))[_0x17d3('0x22')](function(_0x40a2ae){if(_0x40a2ae){_0x2c6ae6['model']=_[_0x17d3('0x4d')](db['MailInteraction']['rawAttributes']);_0x2c6ae6[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x47f512[_0x17d3('0x50')]);_0x2c6ae6[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x2c6ae6[_0x17d3('0x51')],_0x2c6ae6[_0x17d3('0x50')]);_0x275209[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x2c6ae6['model'],qs[_0x17d3('0x52')](_0x47f512[_0x17d3('0x50')][_0x17d3('0x52')]));_0x275209['attributes']=_0x275209[_0x17d3('0x53')]['length']?_0x275209[_0x17d3('0x53')]:_0x2c6ae6[_0x17d3('0x51')];if(!_0x47f512[_0x17d3('0x50')]['hasOwnProperty'](_0x17d3('0x56'))){_0x275209[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x47f512[_0x17d3('0x50')][_0x17d3('0x32')]);_0x275209['offset']=qs['offset'](_0x47f512[_0x17d3('0x50')][_0x17d3('0x31')]);}_0x275209[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x47f512['query'][_0x17d3('0x57')]);_0x275209[_0x17d3('0x5a')]=qs['filters'](_[_0x17d3('0x58')](_0x47f512['query'],_0x2c6ae6['filters']));_0x275209[_0x17d3('0x5a')][_0x17d3('0xce')]=_0x40a2ae['id'];if(_0x47f512['query']['filter']){_0x275209['where']=_[_0x17d3('0x5b')](_0x275209[_0x17d3('0x5a')],{'$or':_['map'](_0x275209[_0x17d3('0x53')],function(_0x2dd6d2){var _0x4f4162={};_0x4f4162[_0x2dd6d2]={'$like':'%'+_0x47f512[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x4f4162;})});}_0x275209=_[_0x17d3('0x5b')]({},_0x275209,_0x47f512[_0x17d3('0x60')]);return db['MailInteraction'][_0x17d3('0x30')]({'where':_0x275209['where']})[_0x17d3('0x22')](function(_0x369f58){_0x13e3b1[_0x17d3('0x30')]=_0x369f58;if(_0x47f512[_0x17d3('0x50')][_0x17d3('0x62')]){_0x275209[_0x17d3('0x67')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x275209);})[_0x17d3('0x22')](function(_0x3e3d2a){_0x13e3b1['rows']=_0x3e3d2a;return _0x13e3b1;});}})[_0x17d3('0x22')](respondWithFilteredResult(_0x37057d,_0x275209))['catch'](handleError(_0x37057d,null));};exports[_0x17d3('0xd4')]=function(_0x4081ba,_0xef569f,_0x60500d){var _0x5734f9={};var _0xbcf92a={};var _0x4a6b1d;var _0x5c3e50;return db[_0x17d3('0x61')]['findOne']({'where':{'id':_0x4081ba[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0xef569f,null))[_0x17d3('0x22')](function(_0x1e4657){if(_0x1e4657){_0x4a6b1d=_0x1e4657;_0xbcf92a['model']=_[_0x17d3('0x4d')](db['SmsInteraction'][_0x17d3('0x4b')]);_0xbcf92a[_0x17d3('0x50')]=_['keys'](_0x4081ba['query']);_0xbcf92a[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0xbcf92a['model'],_0xbcf92a['query']);_0x5734f9[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0xbcf92a[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x4081ba[_0x17d3('0x50')][_0x17d3('0x52')]));_0x5734f9[_0x17d3('0x53')]=_0x5734f9['attributes'][_0x17d3('0x54')]?_0x5734f9[_0x17d3('0x53')]:_0xbcf92a[_0x17d3('0x51')];_0x5734f9[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x4081ba[_0x17d3('0x50')]['sort']);_0x5734f9[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x4081ba['query'],_0xbcf92a[_0x17d3('0x4e')]));if(_0x4081ba[_0x17d3('0x50')]['filter']){_0x5734f9[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x5734f9[_0x17d3('0x5a')],{'$or':_[_0x17d3('0x41')](_0x5734f9[_0x17d3('0x53')],function(_0xc07681){var _0x11efaf={};_0x11efaf[_0xc07681]={'$like':'%'+_0x4081ba[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x11efaf;})});}_0x5734f9=_[_0x17d3('0x5b')]({},_0x5734f9,_0x4081ba['options']);return _0x4a6b1d[_0x17d3('0xd4')](_0x5734f9);}})['then'](function(_0x631cc6){if(_0x631cc6){_0x5c3e50=_0x631cc6[_0x17d3('0x54')];if(!_0x4081ba[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x5734f9[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x4081ba[_0x17d3('0x50')][_0x17d3('0x32')]);_0x5734f9[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x4081ba['query'][_0x17d3('0x31')]);}return _0x4a6b1d['getSmsInteractions'](_0x5734f9);}})['then'](function(_0x2949ad){if(_0x2949ad){return _0x2949ad?{'count':_0x5c3e50,'rows':_0x2949ad}:null;}})['then'](respondWithResult(_0xef569f,null))[_0x17d3('0x2c')](handleError(_0xef569f,null));};exports[_0x17d3('0xd5')]=function(_0x3c3ed8,_0x146cba,_0xa43960){var _0x241722={};var _0x50f77f={};var _0x5909ea;var _0x10fac3;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x3c3ed8[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x146cba,null))[_0x17d3('0x22')](function(_0x4f8e45){if(_0x4f8e45){_0x5909ea=_0x4f8e45;_0x50f77f[_0x17d3('0x51')]=_['keys'](db[_0x17d3('0xd6')][_0x17d3('0x4b')]);_0x50f77f[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x3c3ed8[_0x17d3('0x50')]);_0x50f77f[_0x17d3('0x4e')]=_['intersection'](_0x50f77f[_0x17d3('0x51')],_0x50f77f[_0x17d3('0x50')]);_0x241722[_0x17d3('0x53')]=_['intersection'](_0x50f77f['model'],qs[_0x17d3('0x52')](_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x52')]));_0x241722[_0x17d3('0x53')]=_0x241722[_0x17d3('0x53')][_0x17d3('0x54')]?_0x241722[_0x17d3('0x53')]:_0x50f77f[_0x17d3('0x51')];_0x241722['order']=qs[_0x17d3('0x57')](_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x57')]);_0x241722['where']=qs[_0x17d3('0x4e')](_['pick'](_0x3c3ed8[_0x17d3('0x50')],_0x50f77f[_0x17d3('0x4e')]));if(_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x59')]){_0x241722[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x241722[_0x17d3('0x5a')],{'$or':_[_0x17d3('0x41')](_0x241722['attributes'],function(_0x6a9896){var _0xf13191={};_0xf13191[_0x6a9896]={'$like':'%'+_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0xf13191;})});}_0x241722=_[_0x17d3('0x5b')]({},_0x241722,_0x3c3ed8['options']);return _0x5909ea[_0x17d3('0xd5')](_0x241722);}})[_0x17d3('0x22')](function(_0x2a39e5){if(_0x2a39e5){_0x10fac3=_0x2a39e5['length'];if(!_0x3c3ed8[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x241722[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x3c3ed8['query'][_0x17d3('0x32')]);_0x241722[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x3c3ed8['query'][_0x17d3('0x31')]);}return _0x5909ea['getFaxInteractions'](_0x241722);}})[_0x17d3('0x22')](function(_0x23a544){if(_0x23a544){return _0x23a544?{'count':_0x10fac3,'rows':_0x23a544}:null;}})['then'](respondWithResult(_0x146cba,null))['catch'](handleError(_0x146cba,null));};exports['getWhatsappInteractions']=function(_0xaab73e,_0x33c2b2,_0x49be9d){var _0x243e31={};var _0x276561={};var _0x56701a;var _0x24a0f9;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0xaab73e['params']['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x33c2b2,null))[_0x17d3('0x22')](function(_0x491ddb){if(_0x491ddb){_0x56701a=_0x491ddb;_0x276561['model']=_[_0x17d3('0x4d')](db[_0x17d3('0xd7')]['rawAttributes']);_0x276561[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0xaab73e[_0x17d3('0x50')]);_0x276561['filters']=_[_0x17d3('0x4f')](_0x276561[_0x17d3('0x51')],_0x276561['query']);_0x243e31[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x276561['model'],qs[_0x17d3('0x52')](_0xaab73e[_0x17d3('0x50')][_0x17d3('0x52')]));_0x243e31['attributes']=_0x243e31['attributes']['length']?_0x243e31[_0x17d3('0x53')]:_0x276561['model'];_0x243e31[_0x17d3('0xc3')]=qs['sort'](_0xaab73e[_0x17d3('0x50')]['sort']);_0x243e31['where']=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0xaab73e[_0x17d3('0x50')],_0x276561[_0x17d3('0x4e')]));if(_0xaab73e[_0x17d3('0x50')][_0x17d3('0x59')]){_0x243e31[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x243e31[_0x17d3('0x5a')],{'$or':_[_0x17d3('0x41')](_0x243e31[_0x17d3('0x53')],function(_0x4cc806){var _0xae8341={};_0xae8341[_0x4cc806]={'$like':'%'+_0xaab73e[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0xae8341;})});}_0x243e31=_[_0x17d3('0x5b')]({},_0x243e31,_0xaab73e[_0x17d3('0x60')]);return _0x56701a[_0x17d3('0xd8')](_0x243e31);}})['then'](function(_0x16a6b2){if(_0x16a6b2){_0x24a0f9=_0x16a6b2[_0x17d3('0x54')];if(!_0xaab73e[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x243e31[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0xaab73e['query'][_0x17d3('0x32')]);_0x243e31[_0x17d3('0x31')]=qs['offset'](_0xaab73e[_0x17d3('0x50')]['offset']);}return _0x56701a[_0x17d3('0xd8')](_0x243e31);}})[_0x17d3('0x22')](function(_0x3afe7a){if(_0x3afe7a){return _0x3afe7a?{'count':_0x24a0f9,'rows':_0x3afe7a}:null;}})['then'](respondWithResult(_0x33c2b2,null))[_0x17d3('0x2c')](handleError(_0x33c2b2,null));};exports[_0x17d3('0xd9')]=function(_0xeb460f,_0x2173fc,_0x2ce401){var _0x562d08;var _0x1e8e88;var _0xb47249;var _0x456a48=!_[_0x17d3('0x72')](_0xeb460f['params']['id'])?_0xeb460f['params']['id']:!_['isNil'](_0xeb460f[_0x17d3('0x3b')]['id'])?_0xeb460f[_0x17d3('0x3b')]['id']:null;return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x456a48,'role':{'$or':[_0x17d3('0x6d'),_0x17d3('0x3b'),'agent']}},'attributes':['id',_0x17d3('0x45'),_0x17d3('0xda'),'mobile',_0x17d3('0x43'),_0x17d3('0x7a'),_0x17d3('0xa0')]})[_0x17d3('0x22')](function(_0x8ffb32){if(_0x8ffb32){if(_0x8ffb32[_0x17d3('0x43')]===_0x17d3('0x3d')){_0x562d08=_0x8ffb32;if(_0xeb460f[_0x17d3('0x69')][_0x17d3('0xa2')]){_0xb47249=util[_0x17d3('0xaf')](_0x17d3('0xdb'),_0x562d08[_0xeb460f['body']['interface']]);}else if(_0xeb460f[_0x17d3('0x69')][_0x17d3('0xdc')]){_0xb47249=util[_0x17d3('0xaf')](_0x17d3('0xb0'),_0xeb460f[_0x17d3('0x69')][_0x17d3('0xdc')]);}else{_0xb47249=util[_0x17d3('0xaf')]('SIP/%s',_0x562d08[_0x17d3('0x45')]);}socket['to'](util['format'](_0x17d3('0xdd'),_0x562d08['name']))[_0x17d3('0xab')](_0x17d3('0xde'),{'ip':_0xeb460f[_0x17d3('0xdf')][_0x17d3('0xe0')]||_0xeb460f['connection'][_0x17d3('0xe1')]||_0xeb460f['socket'][_0x17d3('0xe1')]||_0xeb460f[_0x17d3('0xe2')][_0x17d3('0xe3')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x17d3('0x38')]({'where':{'membername':_0x562d08[_0x17d3('0x45')]},'individualHooks':!![]});}}else{throw new db[(_0x17d3('0x99'))][(_0x17d3('0x9a'))](_0x17d3('0xe4'));}})[_0x17d3('0x22')](function(){if(_0x562d08){return _0x562d08[_0x17d3('0xe5')]({'raw':!![]});}})['then'](function(_0x3ffbc3){if(_0x562d08){var _0x58ac1e=[];if(_0x3ffbc3){_0x1e8e88=_0x3ffbc3;if(_0x1e8e88['length']){for(var _0x5c2abf=0x0;_0x5c2abf<_0x1e8e88[_0x17d3('0x54')];_0x5c2abf++){_0x58ac1e[_0x17d3('0xae')]({'membername':_0x562d08[_0x17d3('0x45')],'UserId':_0x562d08['id'],'queue_name':_0x1e8e88[_0x5c2abf][_0x17d3('0x45')],'VoiceQueueId':_0x1e8e88[_0x5c2abf]['id'],'interface':_0xb47249,'paused':_0x562d08['loginInPause']||![],'penalty':_0x1e8e88[_0x5c2abf][_0x17d3('0xe6')]||0x0});}return BPromise[_0x17d3('0xb1')](_0x58ac1e,function(_0x31fbad){return db['UserVoiceQueueRt'][_0x17d3('0xe7')](_0x31fbad);});}}}})[_0x17d3('0x22')](function(){if(_0x562d08){return db[_0x17d3('0xe8')][_0x17d3('0x63')]({'where':{'membername':_0x562d08['name'],'exitAt':null}});}})['then'](function(_0x4d119b){if(_0x562d08){var _0xeb1a17=[];_0x4d119b['forEach'](function(_0x58ba6e){_0xeb1a17[_0x17d3('0xae')](_0x58ba6e[_0x17d3('0x37')]({'exitAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9'))}));});return BPromise[_0x17d3('0xea')](_0xeb1a17);}})['then'](function(){if(_0x562d08){var _0x4c7740=[];var _0x4ab00b=[];var _0x5c1277=utils[_0x17d3('0xeb')]();var _0x1ba714={'membername':_0x562d08[_0x17d3('0x45')],'interface':_0xb47249,'enterAt':moment()[_0x17d3('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x562d08[_0x17d3('0x43')],'internal':_0x562d08['internal']};_0x5c1277['forEach'](function(_0x134193){_0x4c7740['push'](_[_0x17d3('0x5b')]({'channel':_0x134193,'type':_0x17d3('0xec'),'data1':_0xeb460f[_0x17d3('0x69')][_0x17d3('0xed')],'data2':_0xb47249},_0x1ba714));if(_0x562d08[_0x17d3('0xa0')]){_0x4ab00b[_0x17d3('0xae')](_[_0x17d3('0x5b')]({'channel':_0x134193,'type':_0x17d3('0xee'),'data1':'LOGININPAUSE'},_0x1ba714));}});return db['MemberReport'][_0x17d3('0x68')](_0x4c7740[_0x17d3('0xef')](_0x4ab00b),{'individualHooks':!![]});}})[_0x17d3('0x22')](function(){if(_0x562d08){return _0x562d08[_0x17d3('0x37')]({'online':!![],'lastLoginAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'voicePause':_0x562d08['loginInPause']||![],'mailPause':_0x562d08[_0x17d3('0xa0')]||![],'chatPause':_0x562d08[_0x17d3('0xa0')]||![],'faxPause':_0x562d08[_0x17d3('0xa0')]||![],'smsPause':_0x562d08[_0x17d3('0xa0')]||![],'openchannelPause':_0x562d08['loginInPause']||![],'whatsappPause':_0x562d08[_0x17d3('0xa0')]||![],'pauseType':_0x562d08[_0x17d3('0xa0')]?'LOGININPAUSE':null,'interface':_0xb47249,'lastPauseAt':moment()['format'](_0x17d3('0xe9'))});}})[_0x17d3('0x22')](function(_0x44cc23){if(_0xeb460f[_0x17d3('0xf0')]){return _0x2ce401();}else{return BPromise['resolve'](_0x44cc23)[_0x17d3('0x22')](respondWithResult(_0x2173fc,null));}})[_0x17d3('0x2c')](handleError(_0x2173fc,null));};exports[_0x17d3('0xf1')]=function(_0x372465,_0x3358ce,_0x3fa8c4){var _0x3a482a;return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x372465[_0x17d3('0x65')]['id'],'role':'agent'},'attributes':['id',_0x17d3('0x45'),_0x17d3('0x43')]})['then'](handleEntityNotFound(_0x3358ce,null))[_0x17d3('0x22')](function(_0x5b7dff){if(_0x5b7dff){_0x3a482a=_0x5b7dff;return db[_0x17d3('0xb8')][_0x17d3('0x38')]({'where':{'membername':_0x3a482a[_0x17d3('0x45')]},'individualHooks':!![]});}})[_0x17d3('0x22')](function(){return db[_0x17d3('0xe8')][_0x17d3('0x63')]({'where':{'membername':_0x3a482a[_0x17d3('0x45')],'exitAt':null}});})[_0x17d3('0x22')](function(_0x560ff6){var _0x2b5253=[];_0x560ff6[_0x17d3('0xf2')](function(_0x5d0e70){_0x2b5253[_0x17d3('0xae')](_0x5d0e70[_0x17d3('0x37')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x17d3('0xea')](_0x2b5253);})[_0x17d3('0x22')](function(){return _0x3a482a[_0x17d3('0x37')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x17d3('0x22')](respondWithResult(_0x3358ce,null))[_0x17d3('0x2c')](handleError(_0x3358ce,null));};exports[_0x17d3('0xf3')]=function(_0x5b9b54,_0x5e9ce8,_0x4ae8a0){var _0x294955;return db[_0x17d3('0xb8')][_0x17d3('0x37')]({'paused':0x1},{'where':{'UserId':_0x5b9b54[_0x17d3('0x65')]['id']},'individualHooks':!![]})[_0x17d3('0x22')](function(){return db[_0x17d3('0x61')][_0x17d3('0x44')]({'where':{'id':_0x5b9b54[_0x17d3('0x65')]['id'],'role':_0x17d3('0x3d')},'attributes':['id',_0x17d3('0x45'),_0x17d3('0x43'),_0x17d3('0x7a'),_0x17d3('0xa2')]});})['then'](handleEntityNotFound(_0x5e9ce8,null))[_0x17d3('0x22')](function(_0x565d3e){if(_0x565d3e){_0x294955=_0x565d3e;return respondWithRpcPromise(_0x17d3('0xf4'),_0x17d3('0xf3'),{'id':_0x294955['id'],'name':_0x294955[_0x17d3('0x45')],'pause':!![]});}})[_0x17d3('0x22')](function(){if(_0x294955){return db[_0x17d3('0xe8')][_0x17d3('0x63')]({'where':{'membername':_0x294955[_0x17d3('0x45')],'type':_0x17d3('0xee'),'exitAt':null}});}})[_0x17d3('0x22')](function(_0x29d72c){if(_0x29d72c[_0x17d3('0x54')]){var _0x2e22ac=moment()[_0x17d3('0xaf')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1a1a75=0x0,_0x2a714a=_0x29d72c['length'];_0x1a1a75<_0x2a714a;_0x1a1a75++){_0x29d72c[_0x1a1a75][_0x17d3('0xf5')]({'exitAt':_0x2e22ac});}}})['then'](function(){var _0x5d8753=[];var _0x1578ac=utils[_0x17d3('0xeb')]();_0x1578ac[_0x17d3('0xf2')](function(_0x437ef1){_0x5d8753[_0x17d3('0xae')]({'channel':_0x437ef1,'membername':_0x294955[_0x17d3('0x45')],'interface':_[_0x17d3('0x72')](_0x294955[_0x17d3('0xa2')])?util[_0x17d3('0xaf')](_0x17d3('0xb0'),_0x294955[_0x17d3('0x45')]):_0x294955[_0x17d3('0xa2')],'type':_0x17d3('0xee'),'enterAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'data1':_0x5b9b54[_0x17d3('0x69')][_0x17d3('0x5c')]||_0x17d3('0xf6'),'role':_0x294955[_0x17d3('0x43')],'internal':_0x294955[_0x17d3('0x7a')]});});return db[_0x17d3('0xe8')][_0x17d3('0x68')](_0x5d8753,{'individualHooks':!![]});})[_0x17d3('0x22')](function(){return _0x294955[_0x17d3('0x37')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5b9b54[_0x17d3('0x69')]['type']||_0x17d3('0xf6'),'lastPauseAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9'))});})[_0x17d3('0x22')](respondWithResult(_0x5e9ce8,null))['catch'](handleError(_0x5e9ce8,null));};exports[_0x17d3('0xf7')]=function(_0x4c3420,_0x412e52,_0x572388){var _0xb20911;return db[_0x17d3('0x61')]['find']({'where':{'id':_0x4c3420[_0x17d3('0x65')]['id']},'attributes':['id',_0x17d3('0x45'),'role',_0x17d3('0xa1'),_0x17d3('0xf8'),'chatPause',_0x17d3('0xf9'),_0x17d3('0xfa'),_0x17d3('0xfb'),'whatsapppause','pauseType',_0x17d3('0xfc')]})[_0x17d3('0x22')](handleEntityNotFound(_0x412e52,null))[_0x17d3('0x22')](function(_0x9706f2){if(_0x9706f2){_0xb20911=_0x9706f2;if(_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')]&&!utils['isValidChannel'](_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')])){throw new db['Sequelize'][(_0x17d3('0x9a'))](_0x17d3('0xa4'));}switch(_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')]){case'voice':return respondWithRpcPromise(_0x17d3('0xf4'),_0x17d3('0xf7'),{'id':_0xb20911['id'],'name':_0xb20911['name'],'pause':![]})['then'](function(){return db[_0x17d3('0xb8')][_0x17d3('0x37')]({'paused':0x0},{'where':{'UserId':_0xb20911['id']},'individualHooks':!![]});})[_0x17d3('0x22')](function(){return db[_0x17d3('0xe8')][_0x17d3('0x44')]({'where':{'channel':_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')],'membername':_0xb20911[_0x17d3('0x45')],'type':_0x17d3('0xee'),'exitAt':null}});})['then'](function(_0xce4923){if(_0xce4923){return _0xce4923[_0x17d3('0x37')]({'exitAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'data2':_0x17d3('0xfd')},{'individualHooks':!![]});}return null;})[_0x17d3('0x22')](function(){return _0xb20911['update']({'voicePause':![]});});case _0x17d3('0xfe'):case _0x17d3('0xff'):case _0x17d3('0x100'):case'sms':case _0x17d3('0x101'):case _0x17d3('0x102'):return db[_0x17d3('0xe8')][_0x17d3('0x44')]({'where':{'channel':_0x4c3420['body'][_0x17d3('0xb3')],'membername':_0xb20911[_0x17d3('0x45')],'type':_0x17d3('0xee'),'exitAt':null}})[_0x17d3('0x22')](function(_0x119c5b){if(_0x119c5b){return _0x119c5b[_0x17d3('0x37')]({'exitAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'data2':_0x17d3('0xfd')},{'individualHooks':!![]});}return null;})[_0x17d3('0x22')](function(){var _0x263b8f={};_[_0x17d3('0x103')](_0x263b8f,util[_0x17d3('0xaf')](_0x17d3('0x104'),_0x4c3420[_0x17d3('0x69')][_0x17d3('0xb3')],_0x17d3('0x105')),![]);return _0xb20911[_0x17d3('0x37')](_0x263b8f);});default:return respondWithRpcPromise(_0x17d3('0xf4'),_0x17d3('0xf7'),{'id':_0xb20911['id'],'name':_0xb20911[_0x17d3('0x45')],'pause':![]})[_0x17d3('0x22')](function(){return db[_0x17d3('0xb8')][_0x17d3('0x37')]({'paused':0x0},{'where':{'UserId':_0xb20911['id']}});})[_0x17d3('0x22')](function(){return db[_0x17d3('0xe8')][_0x17d3('0x63')]({'where':{'membername':_0xb20911[_0x17d3('0x45')],'type':_0x17d3('0xee'),'exitAt':null}});})[_0x17d3('0x22')](function(_0x46c91a){var _0x5ba804=[];_0x46c91a[_0x17d3('0xf2')](function(_0x2678ca){_0x5ba804['push'](_0x2678ca[_0x17d3('0x37')]({'exitAt':moment()[_0x17d3('0xaf')](_0x17d3('0xe9')),'data2':_0x17d3('0xfd')}));});return BPromise['all'](_0x5ba804);})[_0x17d3('0x22')](function(){return _0xb20911[_0x17d3('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x412e52,null))[_0x17d3('0x2c')](handleError(_0x412e52,null));};exports[_0x17d3('0x106')]=function(_0x4d7b7b,_0x5ec27e,_0x1b1c5f){var _0x3214a4={};var _0x13ef4e={};var _0x12456a;var _0x3ab9e1;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x4d7b7b[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x5ec27e,null))[_0x17d3('0x22')](function(_0x175f3a){if(_0x175f3a){_0x12456a=_0x175f3a;_0x13ef4e[_0x17d3('0x51')]=_[_0x17d3('0x4d')](db[_0x17d3('0x107')][_0x17d3('0x4b')]);_0x13ef4e[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x4d7b7b[_0x17d3('0x50')]);_0x13ef4e[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x13ef4e[_0x17d3('0x51')],_0x13ef4e[_0x17d3('0x50')]);_0x3214a4[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x13ef4e[_0x17d3('0x51')],qs['fields'](_0x4d7b7b['query'][_0x17d3('0x52')]));_0x3214a4[_0x17d3('0x53')]=_0x3214a4[_0x17d3('0x53')][_0x17d3('0x54')]?_0x3214a4[_0x17d3('0x53')]:_0x13ef4e['model'];_0x3214a4['order']=qs[_0x17d3('0x57')](_0x4d7b7b[_0x17d3('0x50')]['sort']);_0x3214a4['where']=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x4d7b7b['query'],_0x13ef4e[_0x17d3('0x4e')]));if(_0x4d7b7b[_0x17d3('0x50')][_0x17d3('0x59')]){_0x3214a4[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x3214a4[_0x17d3('0x5a')],{'$or':_['map'](_0x3214a4[_0x17d3('0x53')],function(_0x1758cc){var _0x1d9c65={};_0x1d9c65[_0x1758cc]={'$like':'%'+_0x4d7b7b[_0x17d3('0x50')]['filter']+'%'};return _0x1d9c65;})});}_0x3214a4=_[_0x17d3('0x5b')]({},_0x3214a4,_0x4d7b7b[_0x17d3('0x60')]);return _0x12456a[_0x17d3('0x106')](_0x3214a4);}})[_0x17d3('0x22')](function(_0x119d7f){if(_0x119d7f){_0x3ab9e1=_0x119d7f[_0x17d3('0x54')];if(!_0x4d7b7b['query'][_0x17d3('0x55')](_0x17d3('0x56'))){_0x3214a4[_0x17d3('0x32')]=qs[_0x17d3('0x32')](_0x4d7b7b[_0x17d3('0x50')][_0x17d3('0x32')]);_0x3214a4[_0x17d3('0x31')]=qs[_0x17d3('0x31')](_0x4d7b7b[_0x17d3('0x50')][_0x17d3('0x31')]);}return _0x12456a['getTeams'](_0x3214a4);}})[_0x17d3('0x22')](function(_0x4b8ca8){if(_0x4b8ca8){return _0x4b8ca8?{'count':_0x3ab9e1,'rows':_0x4b8ca8}:null;}})[_0x17d3('0x22')](respondWithResult(_0x5ec27e,null))[_0x17d3('0x2c')](handleError(_0x5ec27e,null));};exports['addTeams']=function(_0x2efa36,_0xbc144e){return db[_0x17d3('0x61')]['find']({'where':{'id':_0x2efa36[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0xbc144e,null))[_0x17d3('0x22')](function(_0x10b0ac){if(_0x10b0ac){var _0x1e2f90=_0x10b0ac[_0x17d3('0x39')]({'plain':!![]});return _0x10b0ac[_0x17d3('0x108')](_0x2efa36[_0x17d3('0x69')]['ids'],_[_0x17d3('0x109')](_0x2efa36[_0x17d3('0x69')],[_0x17d3('0x6c'),'id'])||{})['then'](function(){for(var _0xe892e8=0x0;_0xe892e8<_0x2efa36[_0x17d3('0x69')]['ids'][_0x17d3('0x54')];_0xe892e8++){var _0x42a9a7=[];db['Team'][_0x17d3('0x94')]({'where':{'id':_0x2efa36[_0x17d3('0x69')]['ids'][_0xe892e8]}})[_0x17d3('0x22')](function(_0x2bf6ed){_0x42a9a7['push'](_0x2bf6ed['getVoiceQueues']()[_0x17d3('0x22')](function(_0x5826cd){for(var _0x2e4d00=0x0;_0x2e4d00<_0x5826cd[_0x17d3('0x54')];_0x2e4d00++){_0x5826cd[_0x2e4d00]['setDataValue'](_0x17d3('0xb3'),'Voice');}return _0x5826cd;}));_0x42a9a7[_0x17d3('0xae')](_0x2bf6ed[_0x17d3('0x10a')]()[_0x17d3('0x22')](function(_0x396533){for(var _0x5657d5=0x0;_0x5657d5<_0x396533[_0x17d3('0x54')];_0x5657d5++){_0x396533[_0x5657d5]['setDataValue'](_0x17d3('0xb3'),_0x17d3('0x10b'));}return _0x396533;}));_0x42a9a7[_0x17d3('0xae')](_0x2bf6ed[_0x17d3('0x10c')]()['then'](function(_0x3a0bf3){for(var _0x50ba0d=0x0;_0x50ba0d<_0x3a0bf3[_0x17d3('0x54')];_0x50ba0d++){_0x3a0bf3[_0x50ba0d]['setDataValue']('channel',_0x17d3('0x10d'));}return _0x3a0bf3;}));_0x42a9a7['push'](_0x2bf6ed[_0x17d3('0x10e')]()[_0x17d3('0x22')](function(_0xa45dfe){for(var _0x3aec34=0x0;_0x3aec34<_0xa45dfe['length'];_0x3aec34++){_0xa45dfe[_0x3aec34][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x110'));}return _0xa45dfe;}));_0x42a9a7['push'](_0x2bf6ed[_0x17d3('0x111')]()[_0x17d3('0x22')](function(_0x10c75e){for(var _0x442257=0x0;_0x442257<_0x10c75e[_0x17d3('0x54')];_0x442257++){_0x10c75e[_0x442257][_0x17d3('0x10f')]('channel',_0x17d3('0x112'));}return _0x10c75e;}));_0x42a9a7[_0x17d3('0xae')](_0x2bf6ed['getFaxQueues']()[_0x17d3('0x22')](function(_0x1926eb){for(var _0x42897a=0x0;_0x42897a<_0x1926eb[_0x17d3('0x54')];_0x42897a++){_0x1926eb[_0x42897a][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x113'));}return _0x1926eb;}));_0x42a9a7[_0x17d3('0xae')](_0x2bf6ed[_0x17d3('0x114')]()[_0x17d3('0x22')](function(_0x293df7){for(var _0x4dcb5c=0x0;_0x4dcb5c<_0x293df7[_0x17d3('0x54')];_0x4dcb5c++){_0x293df7[_0x4dcb5c]['setDataValue'](_0x17d3('0xb3'),_0x17d3('0x115'));}return _0x293df7;}));return BPromise['all'](_0x42a9a7);})['then'](function(_0x3794f2){var _0x5aa6bf=_[_0x17d3('0x116')](_0x3794f2);_0x42a9a7=[];return db[_0x17d3('0x5e')]['transaction'](function(_0x351e45){for(var _0x32a750=0x0;_0x32a750<_0x5aa6bf[_0x17d3('0x54')];_0x32a750++){_0x42a9a7['push'](_0x5aa6bf[_0x32a750]['addAgent'](_0x1e2f90['id']),{'transaction':_0x351e45});}return BPromise[_0x17d3('0xea')](_0x42a9a7)[_0x17d3('0x22')](function(){if(_0x1e2f90[_0x17d3('0xad')]){return BPromise[_0x17d3('0xb1')](_[_0x17d3('0x59')](_0x5aa6bf,function(_0x150265){return _0x150265['getDataValue']('channel')===_0x17d3('0x117');}),function(_0x36d4d7){return db[_0x17d3('0xb8')]['upsert']({'membername':_0x1e2f90[_0x17d3('0x45')],'UserId':_0x1e2f90['id'],'queue_name':_0x36d4d7[_0x17d3('0x45')],'VoiceQueueId':_0x36d4d7['id'],'interface':_['isNil'](_0x1e2f90[_0x17d3('0xa2')])?util['format']('SIP/%s',_0x1e2f90[_0x17d3('0x45')]):_0x1e2f90[_0x17d3('0xa2')],'paused':_0x1e2f90['voicePause']||![],'penalty':_0x1e2f90['penalty']},{'transaction':_0x351e45});});}else{return;}})['then'](function(){for(var _0x4557f1=0x0;_0x4557f1<_0x5aa6bf['length'];_0x4557f1++){var _0x48d201=_0x5aa6bf[_0x4557f1]['getDataValue']('channel');var _0x5ecfc4=_0x48d201+'QueueId';socket['emit'](_0x17d3('0x3b')+_0x48d201+_0x17d3('0x118'),{'UserId':_0x1e2f90['id'],['queueField']:_0x5aa6bf[_0x4557f1]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xbc144e,null))[_0x17d3('0x2c')](handleError(_0xbc144e,null));};exports[_0x17d3('0x119')]=function(_0x10525a,_0x24e6d6){return db['User'][_0x17d3('0x94')]({'where':{'id':_0x10525a[_0x17d3('0x65')]['id']}})['then'](handleEntityNotFound(_0x24e6d6,null))[_0x17d3('0x22')](function(_0x5cc649){if(_0x5cc649){var _0xe86b73=_0x5cc649[_0x17d3('0x39')]({'plain':!![]});var _0x497e71=_0x10525a[_0x17d3('0x50')][_0x17d3('0x6c')];return _0x5cc649['removeTeams'](_0x497e71)[_0x17d3('0x22')](function(){for(var _0x2ff0ab=0x0;_0x2ff0ab<_0x497e71[_0x17d3('0x54')];_0x2ff0ab++){var _0x12bb3b=[];db[_0x17d3('0x107')][_0x17d3('0x94')]({'where':{'id':_0x497e71[_0x2ff0ab]}})[_0x17d3('0x22')](function(_0x264f87){_0x12bb3b['push'](_0x264f87[_0x17d3('0xe5')]()['then'](function(_0x1ec9fc){for(var _0x1d7862=0x0;_0x1d7862<_0x1ec9fc['length'];_0x1d7862++){_0x1ec9fc[_0x1d7862][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x117'));}return _0x1ec9fc;}));_0x12bb3b[_0x17d3('0xae')](_0x264f87['getChatQueues']()[_0x17d3('0x22')](function(_0x2736c0){for(var _0x14d544=0x0;_0x14d544<_0x2736c0[_0x17d3('0x54')];_0x14d544++){_0x2736c0[_0x14d544]['setDataValue']('channel',_0x17d3('0x10b'));}return _0x2736c0;}));_0x12bb3b['push'](_0x264f87[_0x17d3('0x10c')]()['then'](function(_0x22baaa){for(var _0x58a876=0x0;_0x58a876<_0x22baaa[_0x17d3('0x54')];_0x58a876++){_0x22baaa[_0x58a876][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x10d'));}return _0x22baaa;}));_0x12bb3b[_0x17d3('0xae')](_0x264f87[_0x17d3('0x10e')]()['then'](function(_0x5632f0){for(var _0xaf524f=0x0;_0xaf524f<_0x5632f0['length'];_0xaf524f++){_0x5632f0[_0xaf524f][_0x17d3('0x10f')](_0x17d3('0xb3'),'Sms');}return _0x5632f0;}));_0x12bb3b[_0x17d3('0xae')](_0x264f87['getWhatsappQueues']()['then'](function(_0x361fbf){for(var _0x30c720=0x0;_0x30c720<_0x361fbf[_0x17d3('0x54')];_0x30c720++){_0x361fbf[_0x30c720][_0x17d3('0x10f')]('channel','Whatsapp');}return _0x361fbf;}));_0x12bb3b['push'](_0x264f87['getFaxQueues']()['then'](function(_0x44b471){for(var _0x4ea2cd=0x0;_0x4ea2cd<_0x44b471['length'];_0x4ea2cd++){_0x44b471[_0x4ea2cd][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x113'));}return _0x44b471;}));_0x12bb3b['push'](_0x264f87[_0x17d3('0x114')]()[_0x17d3('0x22')](function(_0x749667){for(var _0x35a73b=0x0;_0x35a73b<_0x749667[_0x17d3('0x54')];_0x35a73b++){_0x749667[_0x35a73b][_0x17d3('0x10f')](_0x17d3('0xb3'),_0x17d3('0x115'));}return _0x749667;}));return BPromise[_0x17d3('0xea')](_0x12bb3b);})[_0x17d3('0x22')](function(_0x4dd4ca){var _0x2e94ef=_['flatten'](_0x4dd4ca);_0x12bb3b=[];return db[_0x17d3('0x5e')][_0x17d3('0x11a')](function(_0x399d8f){for(var _0x460b15=0x0;_0x460b15<_0x2e94ef['length'];_0x460b15++){_0x12bb3b[_0x17d3('0xae')](_0x2e94ef[_0x460b15]['removeAgent'](_0xe86b73['id']),{'transaction':_0x399d8f});}return BPromise['all'](_0x12bb3b)[_0x17d3('0x22')](function(){if(_0xe86b73[_0x17d3('0xad')]){return BPromise['each'](_[_0x17d3('0x59')](_0x2e94ef,function(_0x4e1db9){return _0x4e1db9[_0x17d3('0x11b')](_0x17d3('0xb3'))==='Voice';}),function(_0x3bc607){return db[_0x17d3('0xb8')][_0x17d3('0x38')]({'where':{'VoiceQueueId':_0x3bc607['id'],'UserId':_0xe86b73['id']},'transaction':_0x399d8f});});}else{return;}})[_0x17d3('0x22')](function(){for(var _0x582296=0x0;_0x582296<_0x2e94ef['length'];_0x582296++){var _0x520296=_0x2e94ef[_0x582296][_0x17d3('0x11b')](_0x17d3('0xb3'));var _0x3cbbd6=_0x520296+_0x17d3('0xaa');socket[_0x17d3('0xab')](_0x17d3('0x3b')+_0x520296+_0x17d3('0xb6'),{'UserId':_0xe86b73['id'],['queueField']:_0x2e94ef[_0x582296]['id']});}});});});}});}})[_0x17d3('0x22')](respondWithStatusCode(_0x24e6d6,null))[_0x17d3('0x2c')](handleError(_0x24e6d6,null));};exports[_0x17d3('0x11c')]=function(_0x55b7b1,_0x1d5908,_0x38fcf4){var _0x4ca2a9={};var _0x5d0152={};var _0x3f3370;var _0x26562d;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x55b7b1[_0x17d3('0x65')]['id']}})[_0x17d3('0x22')](handleEntityNotFound(_0x1d5908,null))[_0x17d3('0x22')](function(_0x3befaa){if(_0x3befaa){_0x3f3370=_0x3befaa;_0x5d0152[_0x17d3('0x51')]=_[_0x17d3('0x4d')](db[_0x17d3('0xc4')][_0x17d3('0x4b')]);_0x5d0152[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x55b7b1[_0x17d3('0x50')]);_0x5d0152[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x5d0152[_0x17d3('0x51')],_0x5d0152[_0x17d3('0x50')]);_0x4ca2a9[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x5d0152['model'],qs['fields'](_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x52')]));_0x4ca2a9[_0x17d3('0x53')]=_0x4ca2a9[_0x17d3('0x53')][_0x17d3('0x54')]?_0x4ca2a9[_0x17d3('0x53')]:_0x5d0152[_0x17d3('0x51')];_0x4ca2a9['order']=qs[_0x17d3('0x57')](_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x57')]);_0x4ca2a9[_0x17d3('0x5a')]=qs[_0x17d3('0x4e')](_[_0x17d3('0x58')](_0x55b7b1[_0x17d3('0x50')],_0x5d0152[_0x17d3('0x4e')]));if(_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x59')]){_0x4ca2a9[_0x17d3('0x5a')]=_['merge'](_0x4ca2a9['where'],{'$or':_[_0x17d3('0x41')](_0x4ca2a9['attributes'],function(_0x492cb4){var _0x27e357={};_0x27e357[_0x492cb4]={'$like':'%'+_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x27e357;})});}_0x4ca2a9=_['merge']({},_0x4ca2a9,_0x55b7b1[_0x17d3('0x60')]);return _0x3f3370[_0x17d3('0x11c')](_0x4ca2a9);}})[_0x17d3('0x22')](function(_0x1b2584){if(_0x1b2584){_0x26562d=_0x1b2584[_0x17d3('0x54')];if(!_0x55b7b1[_0x17d3('0x50')][_0x17d3('0x55')](_0x17d3('0x56'))){_0x4ca2a9['limit']=qs['limit'](_0x55b7b1[_0x17d3('0x50')]['limit']);_0x4ca2a9['offset']=qs['offset'](_0x55b7b1[_0x17d3('0x50')]['offset']);}return _0x3f3370[_0x17d3('0x11c')](_0x4ca2a9);}})['then'](function(_0x8d8711){if(_0x8d8711){return _0x8d8711?{'count':_0x26562d,'rows':_0x8d8711}:null;}})[_0x17d3('0x22')](respondWithResult(_0x1d5908,null))['catch'](handleError(_0x1d5908,null));};exports[_0x17d3('0x11d')]=function(_0x58ce97,_0x29f0e5,_0x51534d){var _0x2779b5={};var _0x348dcf={};var _0x3488e7;var _0x5c13b3;return db[_0x17d3('0x61')][_0x17d3('0x94')]({'where':{'id':_0x58ce97['params']['id']}})['then'](handleEntityNotFound(_0x29f0e5,null))['then'](function(_0x387564){if(_0x387564){_0x3488e7=_0x387564;_0x348dcf['model']=_['keys'](db[_0x17d3('0x61')][_0x17d3('0x4b')]);_0x348dcf[_0x17d3('0x50')]=_[_0x17d3('0x4d')](_0x58ce97[_0x17d3('0x50')]);_0x348dcf[_0x17d3('0x4e')]=_[_0x17d3('0x4f')](_0x348dcf[_0x17d3('0x51')],_0x348dcf[_0x17d3('0x50')]);_0x2779b5[_0x17d3('0x53')]=_[_0x17d3('0x4f')](_0x348dcf[_0x17d3('0x51')],qs[_0x17d3('0x52')](_0x58ce97['query'][_0x17d3('0x52')]));_0x2779b5[_0x17d3('0x53')]=_0x2779b5[_0x17d3('0x53')][_0x17d3('0x54')]?_0x2779b5[_0x17d3('0x53')]:_0x348dcf[_0x17d3('0x51')];_0x2779b5[_0x17d3('0xc3')]=qs[_0x17d3('0x57')](_0x58ce97['query'][_0x17d3('0x57')]);_0x2779b5[_0x17d3('0x5a')]=qs['filters'](_[_0x17d3('0x58')](_0x58ce97[_0x17d3('0x50')],_0x348dcf[_0x17d3('0x4e')]));if(_0x58ce97[_0x17d3('0x50')][_0x17d3('0x59')]){_0x2779b5[_0x17d3('0x5a')]=_[_0x17d3('0x5b')](_0x2779b5[_0x17d3('0x5a')],{'$or':_['map'](_0x2779b5[_0x17d3('0x53')],function(_0x34b29d){var _0x6943a4={};_0x6943a4[_0x34b29d]={'$like':'%'+_0x58ce97[_0x17d3('0x50')][_0x17d3('0x59')]+'%'};return _0x6943a4;})});}_0x2779b5['model']=db[_0x17d3('0x61')];_0x2779b5['as']=_0x17d3('0x3c');_0x2779b5=_[_0x17d3('0x5b')]({},_0x2779b5,_0x58ce97[_0x17d3('0x60')]);return _0x3488e7[_0x17d3('0xe5')]({'include':[_0x2779b5]});}})['then'](function(_0x2cfbe9){if(_0x2cfbe9){var _0x439fcc={},_0x2d87fe=[],_0x29b171=0x0;for(var _0x118bdc=0x0;_0x118bdc<_0x2cfbe9[_0x17d3('0x54')];_0x118bdc+=0x1){for(var _0x103451=0x0,_0x5410cc;_0x103451<_0x2cfbe9[_0x118bdc]['Agents'][_0x17d3('0x54')];_0x103451+=0x1){_0x5410cc=_0x2cfbe9[_0x118bdc][_0x17d3('0x3c')][_0x103451]['get']({'plain':!![]});_0x439fcc[_0x5410cc['id']]=_0x5410cc;}}_0x439fcc=_[_0x17d3('0x11e')](_0x439fcc);for(var _0x5c4ed3=qs['offset'](_0x58ce97[_0x17d3('0x50')][_0x17d3('0x31')]);_0x5c4ed3<_0x439fcc['length']&&_0x2d87fe[_0x17d3('0x54')]=_0x141128){_0x2b5e4c=_0x141128;_0x2130a0=0xc8;}else{_0x2130a0=0xce;}_0x2152cb[_0x9459('0x30')](_0x2130a0);return _0x2152cb[_0x9459('0x35')](_0x9459('0x36'),_0x6c0635+'-'+_0x2b5e4c+'/'+_0x141128)[_0x9459('0x31')](_0x4752b7);}return null;};}function patchUpdates(_0x2fad9c){return function(_0x1186dc){try{jsonpatch[_0x9459('0x37')](_0x1186dc,_0x2fad9c,!![]);}catch(_0x2b96a9){return BPromise[_0x9459('0x38')](_0x2b96a9);}return _0x1186dc[_0x9459('0x39')]();};}function saveUpdates(_0x1b0506,_0x2be7b1){return function(_0x59d974){if(_0x59d974){return _0x59d974[_0x9459('0x3a')](_0x1b0506)[_0x9459('0x24')](function(_0x3e9174){return _0x3e9174;});}return null;};}function removeEntity(_0x5a62af,_0x1c723f){return function(_0x2db47a){if(_0x2db47a){return _0x2db47a['destroy']()['then'](function(){var _0x403b25=_0x2db47a[_0x9459('0x3b')]({'plain':!![]});var _0x249ae7=[{'name':_0x9459('0x3c'),'value':_0x9459('0x3d'),'ignore':!![]},{'name':_0x9459('0x3e'),'value':_0x9459('0x3f'),'ignore':![]},{'name':'Telephones','value':_0x9459('0x40'),'ignore':![]}];var _0x4886d6=_(_0x249ae7)[_0x9459('0x41')](_0x9459('0x42'))[_0x9459('0x43')](_0x9459('0x44'))['value']();if(_[_0x9459('0x45')](_0x4886d6,_0x403b25[_0x9459('0x46')])){return;}var _0x47731c=_['find'](_0x249ae7,['value',_0x403b25[_0x9459('0x46')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x47731c,'resourceId':_0x403b25['id']}})['then'](function(){return _0x2db47a;});})[_0x9459('0x24')](function(){_0x5a62af[_0x9459('0x30')](0xcc)[_0x9459('0x47')]();});}};}function handleEntityNotFound(_0x1ccf64,_0x52c6f0){return function(_0x2be6ed){if(!_0x2be6ed){_0x1ccf64['sendStatus'](0x194);}return _0x2be6ed;};}function handleError(_0x21ebe8,_0xc03ed4){_0xc03ed4=_0xc03ed4||0x1f4;return function(_0x281342){logger['error'](_0x281342[_0x9459('0x48')]);if(_0x281342[_0x9459('0x49')]){delete _0x281342['name'];}_0x21ebe8[_0x9459('0x30')](_0xc03ed4)[_0x9459('0x4a')](_0x281342);};}exports[_0x9459('0x4b')]=function(_0x4f1602,_0x23a33f){var _0x3c95f4={},_0x395ede={},_0x5cf721={'count':0x0,'rows':[]};var _0x2d7f4a=_[_0x9459('0x43')](db['User']['rawAttributes'],function(_0x3f06fc){return{'name':_0x3f06fc[_0x9459('0x4c')],'type':_0x3f06fc[_0x9459('0x4d')][_0x9459('0x4e')]};});_0x395ede[_0x9459('0x4f')]=_['differenceBy'](_[_0x9459('0x43')](_0x2d7f4a,'name'),[_0x9459('0x50'),'salt']);_0x395ede[_0x9459('0x51')]=_[_0x9459('0x52')](_0x4f1602[_0x9459('0x51')]);_0x395ede[_0x9459('0x53')]=_['intersection'](_0x395ede['model'],_0x395ede['query']);_0x3c95f4[_0x9459('0x54')]=_[_0x9459('0x55')](_0x395ede[_0x9459('0x4f')],qs['fields'](_0x4f1602[_0x9459('0x51')][_0x9459('0x56')]));_0x3c95f4[_0x9459('0x54')]=_0x3c95f4[_0x9459('0x54')][_0x9459('0x57')]?_0x3c95f4['attributes']:_0x395ede[_0x9459('0x4f')];if(!_0x4f1602[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x3c95f4['limit']=qs[_0x9459('0x34')](_0x4f1602[_0x9459('0x51')][_0x9459('0x34')]);_0x3c95f4[_0x9459('0x33')]=qs['offset'](_0x4f1602[_0x9459('0x51')]['offset']);}_0x3c95f4[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x4f1602[_0x9459('0x51')][_0x9459('0x5b')]);_0x3c95f4[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x4f1602['query'],_0x395ede['filters']),_0x2d7f4a);if(_0x4f1602[_0x9459('0x51')][_0x9459('0x41')]){_0x3c95f4[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x3c95f4['where'],{'$or':_[_0x9459('0x43')](_0x2d7f4a,function(_0x1c52db){if(_0x1c52db[_0x9459('0x4d')]!==_0x9459('0x5f')){return db[_0x9459('0x60')]['where'](db['sequelize']['fn'](_0x9459('0x61'),db[_0x9459('0x60')][_0x9459('0x62')](_0x1c52db[_0x9459('0x49')])),{'$like':db[_0x9459('0x60')]['fn'](_0x9459('0x61'),'%'+_0x4f1602['query'][_0x9459('0x41')]+'%')});}})});}_0x3c95f4=_[_0x9459('0x5e')]({},_0x3c95f4,_0x4f1602[_0x9459('0x63')]);var _0x1ec1a3={'where':_0x3c95f4['where']};return db[_0x9459('0x64')][_0x9459('0x32')](_0x1ec1a3)['then'](function(_0x35c9ae){_0x5cf721[_0x9459('0x32')]=_0x35c9ae;if(_0x4f1602[_0x9459('0x51')]['includeAll']){_0x3c95f4['include']=[{'all':!![]}];}return db[_0x9459('0x64')][_0x9459('0x65')](_0x3c95f4);})[_0x9459('0x24')](function(_0x6773f1){_0x5cf721['rows']=_0x6773f1;return _0x5cf721;})['then'](respondWithFilteredResult(_0x23a33f,_0x3c95f4))['catch'](handleError(_0x23a33f,null));};exports[_0x9459('0x66')]=function(_0x166c21,_0x3de915){var _0x7fb6fe={'raw':![],'where':{'id':_0x166c21['params']['id']}},_0x1266a4={};_0x1266a4[_0x9459('0x4f')]=_[_0x9459('0x67')](_[_0x9459('0x52')](db[_0x9459('0x64')][_0x9459('0x68')]),[_0x9459('0x50'),'salt']);_0x1266a4[_0x9459('0x51')]=_[_0x9459('0x52')](_0x166c21[_0x9459('0x51')]);_0x1266a4[_0x9459('0x53')]=_[_0x9459('0x55')](_0x1266a4[_0x9459('0x4f')],_0x1266a4['query']);_0x7fb6fe[_0x9459('0x54')]=_[_0x9459('0x55')](_0x1266a4[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x166c21[_0x9459('0x51')][_0x9459('0x56')]));_0x7fb6fe[_0x9459('0x54')]=_0x7fb6fe[_0x9459('0x54')]['length']?_0x7fb6fe[_0x9459('0x54')]:_0x1266a4[_0x9459('0x4f')];if(_0x166c21[_0x9459('0x51')]['includeAll']){_0x7fb6fe['include']=[{'all':!![]}];}_0x7fb6fe=_[_0x9459('0x5e')]({},_0x7fb6fe,_0x166c21[_0x9459('0x63')]);return db[_0x9459('0x64')][_0x9459('0x69')](_0x7fb6fe)[_0x9459('0x24')](handleEntityNotFound(_0x3de915,null))[_0x9459('0x24')](respondWithResult(_0x3de915,null))['catch'](handleError(_0x3de915,null));};exports['bulkCreate']=function(_0x50d284,_0x187c0c){return db[_0x9459('0x64')][_0x9459('0x6a')](_0x50d284[_0x9459('0x6b')],{'raw':![],'individualHooks':!![]})[_0x9459('0x24')](respondWithResult(_0x187c0c,0xc9))[_0x9459('0x6c')](handleError(_0x187c0c,null));};exports[_0x9459('0x3a')]=function(_0x52c93a,_0x2f4b5d){if(_0x52c93a[_0x9459('0x6b')]['id']){delete _0x52c93a[_0x9459('0x6b')]['id'];}delete _0x52c93a[_0x9459('0x6b')][_0x9459('0x46')];return db['User'][_0x9459('0x69')]({'where':{'id':_0x52c93a[_0x9459('0x6d')]['id']}})['then'](handleEntityNotFound(_0x2f4b5d,null))['then'](saveUpdates(_0x52c93a[_0x9459('0x6b')],null))[_0x9459('0x24')](respondWithResult(_0x2f4b5d,null))['catch'](handleError(_0x2f4b5d,null));};exports[_0x9459('0x6e')]=function(_0x4759a4,_0x2a1910){return db[_0x9459('0x64')][_0x9459('0x6e')]()[_0x9459('0x24')](respondWithResult(_0x2a1910,null))[_0x9459('0x6c')](handleError(_0x2a1910,null));};exports[_0x9459('0x6f')]=function(_0x1abc5d,_0xb44e38,_0x4b7087){return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x1abc5d[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0xb44e38,null))[_0x9459('0x24')](function(_0x280154){if(_0x280154){return _0x280154['addContacts'](_0x1abc5d['body'][_0x9459('0x70')],_[_0x9459('0x71')](_0x1abc5d['body'],[_0x9459('0x70'),'id'])||{});}})[_0x9459('0x24')](respondWithResult(_0xb44e38,null))[_0x9459('0x6c')](handleError(_0xb44e38,null));};var getLicense=function(_0x38a7cf){return new BPromise(function(_0x4be579,_0xed4ff9){var _0x14ad05=0x0;_0x38a7cf[_0x9459('0x6b')][_0x9459('0x46')]===_0x9459('0x3f')&&_0x4be579(_0x9459('0x72'));return db[_0x9459('0x64')][_0x9459('0x32')]({'where':{'$or':[{'role':_0x38a7cf[_0x9459('0x6b')]['role']===_0x9459('0x40')?_0x9459('0x40'):[_0x9459('0x73'),_0x9459('0x3d')]}]}})[_0x9459('0x24')](function(_0x59481c){_0x14ad05=_0x59481c;return require(_0x9459('0x74'))[_0x9459('0x75')]();})[_0x9459('0x24')](function(_0x225619){var _0x291775=_0x38a7cf[_0x9459('0x6b')][_0x9459('0x46')]===_0x9459('0x40')?_0x9459('0x76'):_0x9459('0x77');if(!_[_0x9459('0x78')](_0x225619[_0x291775])&&_0x14ad05>=_0x225619[_0x291775]){return _0xed4ff9({'message':_0x9459('0x79')});}return _0x4be579(util[_0x9459('0x7a')](_0x9459('0x7b'),_0x291775,_0x14ad05));})['catch'](function(_0x428796){return _0xed4ff9(_0x428796);});});};exports['create']=function(_0x8c0af4,_0x46ca1c){return getLicense(_0x8c0af4)['then'](function(_0x46e117){if(!_0x8c0af4[_0x9459('0x6b')]['internal']){var _0x56af9b;return db[_0x9459('0x7c')]['findById'](0x1)['then'](function(_0x431673){return checkPasswordPattern(_0x431673,_0x8c0af4[_0x9459('0x6b')][_0x9459('0x50')],_0x431673[_0x9459('0x7d')]);})[_0x9459('0x24')](function(_0x38d640){_0x56af9b=_0x38d640[_0x9459('0x7e')];return db['User'][_0x9459('0x7f')](_0x9459('0x80'));})['then'](function(_0x11d5c5){if(_[_0x9459('0x78')](_0x11d5c5)){if(_0x56af9b){_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')]=_0x56af9b;}else{_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')]=0x1;}}else{if(_['isNil'](_0x56af9b)||_0x56af9b==_0x11d5c5){_0x8c0af4[_0x9459('0x6b')]['internal']=_0x11d5c5+0x1;}else if(_0x56af9b>_0x11d5c5){_0x8c0af4[_0x9459('0x6b')]['internal']=_0x56af9b;}else{return db['sequelize'][_0x9459('0x51')](_0x9459('0x81'),{'type':db[_0x9459('0x60')]['QueryTypes']['SELECT']})['then'](function(_0x665c8a){if(_0x665c8a&&_0x665c8a[_0x9459('0x57')]){for(var _0x320310=0x0,_0xe491f3=_0x665c8a['length'];_0x320310<_0xe491f3&&_[_0x9459('0x78')](_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')]);_0x320310++){if(_0x56af9b<=_0x665c8a[_0x320310]['from']){_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')]=_0x665c8a[_0x320310]['from'];}else if(_0x56af9b>_0x665c8a[_0x320310][_0x9459('0x82')]&&_0x56af9b<=_0x665c8a[_0x320310]['to']){_0x8c0af4[_0x9459('0x6b')]['internal']=_0x56af9b;}}}if(_[_0x9459('0x78')](_0x8c0af4['body']['internal'])){_0x8c0af4[_0x9459('0x6b')]['internal']=_0x11d5c5+0x1;}});}}});}})[_0x9459('0x24')](function(){if(_0x8c0af4[_0x9459('0x6b')][_0x9459('0x83')]){_0x8c0af4[_0x9459('0x6b')][_0x9459('0x84')]=_0x8c0af4[_0x9459('0x6b')][_0x9459('0x80')];_0x8c0af4[_0x9459('0x6b')][_0x9459('0x85')]={'mailbox':_0x8c0af4[_0x9459('0x6b')]['internal'],'password':_0x8c0af4[_0x9459('0x6b')]['password'],'fullname':_0x8c0af4[_0x9459('0x6b')]['fullname'],'email':_0x8c0af4[_0x9459('0x6b')][_0x9459('0x86')]};}if(_0x8c0af4[_0x9459('0x6b')]&&_0x8c0af4[_0x9459('0x6b')]['role']===_0x9459('0x3f')){if(!_0x8c0af4['body'][_0x9459('0x87')]){_0x8c0af4[_0x9459('0x6b')][_0x9459('0x87')]=['101',_0x9459('0x88'),_0x9459('0x89'),'113',_0x9459('0x8a'),_0x9459('0x8b'),'105','106','107','108',_0x9459('0x8c'),'100',_0x9459('0x8d'),_0x9459('0x8e')];}}return db[_0x9459('0x64')][_0x9459('0x8f')](_0x8c0af4['body'],{'include':[{'model':db[_0x9459('0x85')],'as':_0x9459('0x85')}]});})[_0x9459('0x24')](function(_0x2abeaf){if(_0x8c0af4['body'][_0x9459('0x46')]===_0x9459('0x3d'))return _0x2abeaf;var _0x2ef4b9=_0x8c0af4[_0x9459('0x3d')][_0x9459('0x3b')]({'plain':!![]});if(!_0x2ef4b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ef4b9[_0x9459('0x46')]===_0x9459('0x3d')){var _0x41047e=_0x2abeaf['get']({'plain':!![]});var _0x5bf559=[{'name':_0x9459('0x3e'),'value':_0x9459('0x3f')},{'name':_0x9459('0x90'),'value':_0x9459('0x40')}];var _0x11dc92=_[_0x9459('0x69')](_0x5bf559,['value',_0x41047e[_0x9459('0x46')]])['name'];return db[_0x9459('0x91')][_0x9459('0x69')]({'where':{'name':_0x11dc92,'userProfileId':_0x2ef4b9['userProfileId']},'raw':!![]})[_0x9459('0x24')](function(_0x34125a){if(_0x34125a&&_0x34125a[_0x9459('0x92')]===0x0){return db[_0x9459('0x93')]['create']({'name':_0x41047e[_0x9459('0x49')],'resourceId':_0x41047e['id'],'type':_0x34125a[_0x9459('0x49')],'sectionId':_0x34125a['id']},{})[_0x9459('0x24')](function(){return _0x2abeaf;});}else{return _0x2abeaf;}})[_0x9459('0x6c')](function(_0x5775dd){logger[_0x9459('0x2c')](_0x9459('0x94'),_0x5775dd);throw _0x5775dd;});}return _0x2abeaf;})['then'](respondWithResult(_0x46ca1c,0xc9))[_0x9459('0x6c')](handleError(_0x46ca1c,null));};exports[_0x9459('0x95')]=function(_0x48130d,_0x57c91e,_0x6184fc){var _0x489ecd=![];if(_0x48130d[_0x9459('0x6b')]['id']){delete _0x48130d[_0x9459('0x6b')]['id'];}return db['Setting']['findOne']({'attributes':['id',_0x9459('0x7d')]})[_0x9459('0x24')](function(_0x2773e5){_0x489ecd=_0x2773e5[_0x9459('0x7d')];return db[_0x9459('0x64')]['find']({'where':{'id':_0x48130d[_0x9459('0x6d')]['id']}});})['then'](function(_0x18136d){if(_0x18136d){if(_0x18136d['id']==_0x48130d[_0x9459('0x3d')]['id']){if(!_0x48130d[_0x9459('0x6b')][_0x9459('0x96')]||!_0x48130d[_0x9459('0x6b')][_0x9459('0x97')]){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))](_0x9459('0x98'));}if(!_0x18136d['authenticate'](_0x48130d[_0x9459('0x6b')]['oldPassword'])){throw new db['Sequelize']['ValidationError'](_0x9459('0x99'));}if(_0x48130d[_0x9459('0x6b')][_0x9459('0x96')]==_0x48130d[_0x9459('0x6b')][_0x9459('0x97')]){throw new db['Sequelize'][(_0x9459('0x22'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x18136d;}else if(_0x48130d['user'][_0x9459('0x46')]==_0x9459('0x73')){if(!_0x48130d[_0x9459('0x6b')][_0x9459('0x97')]){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))](_0x9459('0x9a'));}return _0x18136d;}else if(_0x48130d[_0x9459('0x3d')][_0x9459('0x46')]==_0x9459('0x3d')){if(!_0x48130d['body'][_0x9459('0x97')]){throw new db['Sequelize'][(_0x9459('0x22'))](_0x9459('0x9a'));}if(_0x18136d[_0x9459('0x46')]!=_0x9459('0x3f')){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))]('Unauthorized');}return _0x18136d;}else{throw new db['Sequelize'][(_0x9459('0x22'))](_0x9459('0x9b'));}}return null;})[_0x9459('0x24')](handleEntityNotFound(_0x57c91e,null))[_0x9459('0x24')](function(_0xb07de4){return checkPasswordPattern(_0xb07de4,_0x48130d[_0x9459('0x6b')]['newPassword'],_0x489ecd);})['then'](saveUpdates({'password':_0x48130d[_0x9459('0x6b')][_0x9459('0x97')],'passwordResetAt':_0x48130d[_0x9459('0x3d')]['id']==_0x48130d[_0x9459('0x6d')]['id']?moment():null},null))[_0x9459('0x24')](respondWithResult(_0x57c91e,null))[_0x9459('0x6c')](handleError(_0x57c91e,null));};exports[_0x9459('0x9c')]=function(_0x5d30a9,_0x391118,_0xb5d3e2){var _0x2f5fa6=_0x5d30a9[_0x9459('0x6b')][_0x9459('0x9d')];return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x5d30a9[_0x9459('0x6d')]['id']},'attributes':['id',_0x9459('0x49'),_0x9459('0x46'),_0x9459('0x9e'),_0x9459('0x9f'),_0x9459('0xa0'),_0x9459('0xa1')]})[_0x9459('0x24')](handleEntityNotFound(_0x391118,null))[_0x9459('0x24')](function(_0x1d620d){if(_0x1d620d){if(!utils[_0x9459('0xa2')](_0x2f5fa6)){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))]('Unknown\x20channel');}return _0x1d620d[_0x9459('0xa3')+_[_0x9459('0xa4')](_0x2f5fa6[_0x9459('0xa5')]())+'Queues'](_0x5d30a9['body'][_0x9459('0x70')],{'penalty':_0x5d30a9[_0x9459('0x6b')][_0x9459('0xa6')]||0x0})['spread'](function(_0x49d31d){for(var _0x33be85=0x0;_0x33be85<_0x5d30a9[_0x9459('0x6b')][_0x9459('0x70')][_0x9459('0x57')];_0x33be85+=0x1){var _0x77e3ff={'UserId':_0x5d30a9[_0x9459('0x6d')]['id']};_0x77e3ff[_[_0x9459('0xa4')](_0x2f5fa6[_0x9459('0xa5')]())+_0x9459('0xa7')]=_0x5d30a9['body']['ids'][_0x33be85];socket[_0x9459('0xa8')]('user'+_['capitalize'](_0x2f5fa6['toLowerCase']())+'Queue:save',_0x77e3ff);}return _0x49d31d;})[_0x9459('0x24')](function(){if(_0x2f5fa6===_0x9459('0xa9')){return db['VoiceQueue'][_0x9459('0x65')]({'where':{'id':_0x5d30a9['body']['ids']||[]},'raw':!![],'attributes':['id',_0x9459('0x49')]});}})['then'](function(_0x5d8434){var _0x52aaa7=_0x1d620d[_0x9459('0x3b')]({'plain':!![]});var _0x223f20=[];if(_0x2f5fa6===_0x9459('0xa9')&&_0x52aaa7[_0x9459('0x46')]===_0x9459('0x3f')&&_0x52aaa7[_0x9459('0x9e')]){for(var _0x3fb171=0x0;_0x3fb171<_0x5d8434['length'];_0x3fb171+=0x1){_0x223f20[_0x9459('0xaa')]({'membername':_0x52aaa7[_0x9459('0x49')],'UserId':_0x52aaa7['id'],'queue_name':_0x5d8434[_0x3fb171][_0x9459('0x49')],'VoiceQueueId':_0x5d8434[_0x3fb171]['id'],'interface':_['isNil'](_0x52aaa7['interface'])?util[_0x9459('0x7a')]('SIP/%s',_0x52aaa7[_0x9459('0x49')]):_0x52aaa7['interface'],'paused':_0x52aaa7['voicePause']||![],'penalty':_0x5d30a9[_0x9459('0x6b')][_0x9459('0xa6')]||0x0});}return BPromise['each'](_0x223f20,function(_0x5d944a){return db[_0x9459('0xab')]['upsert'](_0x5d944a);});}return _0x1d620d;});}})['then'](respondWithStatusCode(_0x391118,null))[_0x9459('0x6c')](handleError(_0x391118,null));};exports[_0x9459('0xac')]=function(_0x19e3f5,_0x26e6d3,_0x324655){var _0x34db9a;return db['User'][_0x9459('0x69')]({'where':{'id':_0x19e3f5[_0x9459('0x6d')]['id']},'attributes':['id',_0x9459('0x49'),_0x9459('0x46')]})[_0x9459('0x24')](handleEntityNotFound(_0x26e6d3,null))['then'](function(_0xf8c930){if(_0xf8c930){_0x34db9a=_0xf8c930;if(!_0x19e3f5['query'][_0x9459('0x9d')]||!utils[_0x9459('0xa2')](_0x19e3f5[_0x9459('0x51')][_0x9459('0x9d')])){throw new db['Sequelize'][(_0x9459('0x22'))](_0x9459('0xad'));}return _0xf8c930[_0x9459('0xae')+_['capitalize'](_0x19e3f5['query'][_0x9459('0x9d')][_0x9459('0xa5')]())+_0x9459('0xaf')](_0x19e3f5['query']['ids']);}})[_0x9459('0x24')](function(_0x5bc55c){for(var _0x5d1163=0x0;_0x5d1163<_0x19e3f5[_0x9459('0x51')][_0x9459('0x70')][_0x9459('0x57')];_0x5d1163+=0x1){var _0x2d1214={'UserId':_0x19e3f5[_0x9459('0x6d')]['id']};_0x2d1214[_[_0x9459('0xa4')](_0x19e3f5[_0x9459('0x51')][_0x9459('0x9d')][_0x9459('0xa5')]())+_0x9459('0xa7')]=_0x19e3f5[_0x9459('0x51')][_0x9459('0x70')][_0x5d1163];socket[_0x9459('0xa8')]('user'+_[_0x9459('0xa4')](_0x19e3f5['query'][_0x9459('0x9d')][_0x9459('0xa5')]())+_0x9459('0xb0'),_0x2d1214);}return _0x5bc55c;})[_0x9459('0x24')](function(){if(_0x19e3f5[_0x9459('0x51')]['channel']===_0x9459('0xa9')){return db[_0x9459('0xab')][_0x9459('0xb1')]({'where':{'UserId':_0x19e3f5[_0x9459('0x6d')]['id'],'VoiceQueueId':_0x19e3f5[_0x9459('0x51')]['ids']},'individualHooks':!![]})['then'](function(){return _0x34db9a;});}return _0x34db9a;})[_0x9459('0x24')](respondWithStatusCode(_0x26e6d3,null))['catch'](handleError(_0x26e6d3,null));};exports[_0x9459('0xb2')]=function(_0xfd1060,_0x7a6d1e,_0x240d65){_0xfd1060[_0x9459('0x6b')][_0x9459('0xb3')]=_0xfd1060[_0x9459('0xb4')][_0x9459('0xb5')];return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0xfd1060[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x7a6d1e,null))['then'](saveUpdates(_0xfd1060[_0x9459('0x6b')],null))[_0x9459('0x24')](respondWithResult(_0x7a6d1e,null))[_0x9459('0x6c')](handleError(_0x7a6d1e,null));};exports[_0x9459('0xb6')]=function(_0x32caea,_0x313d15,_0x5329c6){var _0x6315f0=path[_0x9459('0xb7')](config['root'],_0x9459('0xb8'));return db['User']['find']({'where':{'id':_0x32caea[_0x9459('0x6d')]['id']},'attributes':['id',_0x9459('0xb3')],'raw':!![]})[_0x9459('0x24')](handleEntityNotFound(_0x313d15,null))['then'](function(_0x154f13){if(_0x154f13){if(_['isNil'](_0x154f13[_0x9459('0xb3')])){return _0x313d15[_0x9459('0xb9')](_0x6315f0);}else{if(!fs['existsSync'](path[_0x9459('0xb7')](config[_0x9459('0xba')],_0x9459('0xbb'),_0x154f13[_0x9459('0xb3')]))){return _0x313d15['download'](_0x6315f0);}return _0x313d15[_0x9459('0xb9')](path[_0x9459('0xb7')](config[_0x9459('0xba')],_0x9459('0xbb'),_0x154f13[_0x9459('0xb3')]));}}})[_0x9459('0x6c')](handleError(_0x313d15,null));};exports[_0x9459('0xbc')]=function(_0x29ad0a,_0x23ff3f,_0x286650){var _0x5047fd={};var _0x5f56d4={};var _0x29828e;var _0x2d0b38;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x29ad0a[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x23ff3f,null))['then'](function(_0x4633fb){if(_0x4633fb){_0x29828e=_0x4633fb;_0x5f56d4[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xbe')][_0x9459('0x68')]);_0x5f56d4[_0x9459('0x51')]=_['keys'](_0x29ad0a['query']);_0x5f56d4[_0x9459('0x53')]=_['intersection'](_0x5f56d4[_0x9459('0x4f')],_0x5f56d4[_0x9459('0x51')]);_0x5047fd['attributes']=_[_0x9459('0x55')](_0x5f56d4[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x29ad0a[_0x9459('0x51')][_0x9459('0x56')]));_0x5047fd[_0x9459('0x54')]=_0x5047fd['attributes'][_0x9459('0x57')]?_0x5047fd['attributes']:_0x5f56d4[_0x9459('0x4f')];_0x5047fd[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x29ad0a[_0x9459('0x51')][_0x9459('0x5b')]);_0x5047fd[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x29ad0a['query'],_0x5f56d4[_0x9459('0x53')]));if(_0x29ad0a[_0x9459('0x51')][_0x9459('0x41')]){_0x5047fd['where']=_[_0x9459('0x5e')](_0x5047fd[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x5047fd[_0x9459('0x54')],function(_0x154d00){var _0x10c144={};_0x10c144[_0x154d00]={'$like':'%'+_0x29ad0a[_0x9459('0x51')]['filter']+'%'};return _0x10c144;})});}_0x5047fd=_['merge']({},_0x5047fd,_0x29ad0a[_0x9459('0x63')]);return _0x29828e[_0x9459('0xbc')](_0x5047fd);}})[_0x9459('0x24')](function(_0x47f1bb){if(_0x47f1bb){_0x2d0b38=_0x47f1bb['length'];if(_0x29ad0a['query'][_0x9459('0x58')]('includeAll')){_0x5047fd[_0x9459('0xbf')]=[{'model':db[_0x9459('0xc0')],'as':_0x9459('0xc1'),'required':![]},{'model':db[_0x9459('0xc2')],'as':_0x9459('0xc3'),'attributes':['id',_0x9459('0x49'),_0x9459('0xc4')],'where':_0x29ad0a['query'][_0x9459('0xc5')]?{'id':_0x29ad0a[_0x9459('0x51')][_0x9459('0xc5')]}:undefined,'required':_0x29ad0a['query'][_0x9459('0xc5')]?!![]:![]}];}if(!_0x29ad0a[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x5047fd['limit']=qs[_0x9459('0x34')](_0x29ad0a['query'][_0x9459('0x34')]);_0x5047fd[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x29ad0a['query']['offset']);}return _0x29828e[_0x9459('0xbc')](_0x5047fd);}})[_0x9459('0x24')](function(_0x281813){if(_0x281813){return _0x281813?{'count':_0x2d0b38,'rows':_0x281813}:null;}})[_0x9459('0x24')](respondWithResult(_0x23ff3f,null))[_0x9459('0x6c')](handleError(_0x23ff3f,null));};exports[_0x9459('0xc6')]=function(_0x170f70,_0x332e7d,_0x1d9d45){var _0x988cb5;var _0x2d30ff;var _0x362e9e={};var _0x47ad4b;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x170f70[_0x9459('0x6d')]['id']},'attributes':['id',_0x9459('0x49'),'role']})[_0x9459('0x24')](handleEntityNotFound(_0x332e7d,null))['then'](function(_0x55cb15){if(!utils[_0x9459('0xa2')](_0x170f70[_0x9459('0x51')]['channel'])){throw new db[(_0x9459('0x21'))][(_0x9459('0x22'))]('Unknown\x20channel');}_0x988cb5=_0x55cb15;var _0x14ae9d={};_0x14ae9d[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_[_0x9459('0xa4')](_0x170f70[_0x9459('0x51')][_0x9459('0x9d')])+_0x9459('0xc7')][_0x9459('0x68')]);_0x14ae9d['query']=_[_0x9459('0x52')](_0x170f70['query']);_0x14ae9d[_0x9459('0x53')]=_[_0x9459('0x55')](_0x14ae9d[_0x9459('0x4f')],_0x14ae9d[_0x9459('0x51')]);_0x362e9e[_0x9459('0x54')]=_[_0x9459('0x55')](_0x14ae9d[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x170f70[_0x9459('0x51')]['fields']));_0x362e9e[_0x9459('0x54')]=_0x362e9e[_0x9459('0x54')][_0x9459('0x57')]?_0x362e9e[_0x9459('0x54')]:_0x14ae9d[_0x9459('0x4f')];_0x362e9e[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x170f70[_0x9459('0x51')]['sort']);_0x362e9e[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x170f70[_0x9459('0x51')],_0x14ae9d['filters']));if(_0x170f70['query'][_0x9459('0x41')]){_0x362e9e[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x362e9e['where'],{'$or':_[_0x9459('0x43')](_0x362e9e[_0x9459('0x54')],function(_0x8ca2ca){var _0xc1b669={};_0xc1b669[_0x8ca2ca]={'$like':'%'+_0x170f70[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0xc1b669;})});}_0x362e9e=_[_0x9459('0x5e')]({},_0x362e9e,_0x170f70[_0x9459('0x63')]);switch(_0x988cb5[_0x9459('0x46')]){case'admin':return db[_[_0x9459('0xa4')](_0x170f70['query'][_0x9459('0x9d')])+_0x9459('0xc7')]['findAll'](_0x362e9e);case _0x9459('0x3d'):case'agent':return _0x988cb5[_0x9459('0x3b')+_[_0x9459('0xa4')](_0x170f70[_0x9459('0x51')][_0x9459('0x9d')])+_0x9459('0xaf')](_0x362e9e);default:throw new db[(_0x9459('0x21'))]['ValidationError'](_0x9459('0xc8'));}})[_0x9459('0x24')](function(_0xc27a58){_0x47ad4b=_0xc27a58[_0x9459('0x57')];if(!_0x170f70[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x362e9e[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x170f70['query']['limit']);_0x362e9e[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x170f70[_0x9459('0x51')][_0x9459('0x33')]);}switch(_0x988cb5[_0x9459('0x46')]){case _0x9459('0x73'):return db[_[_0x9459('0xa4')](_0x170f70[_0x9459('0x51')][_0x9459('0x9d')])+_0x9459('0xc7')][_0x9459('0x65')](_0x362e9e);case _0x9459('0x3d'):case _0x9459('0x3f'):return _0x988cb5[_0x9459('0x3b')+_['capitalize'](_0x170f70[_0x9459('0x51')][_0x9459('0x9d')])+_0x9459('0xaf')](_0x362e9e);}})[_0x9459('0x24')](function(_0x43f9d1){return{'count':_0x47ad4b,'rows':_0x43f9d1};})[_0x9459('0x24')](respondWithResult(_0x332e7d,null))[_0x9459('0x6c')](handleError(_0x332e7d,null));};exports['getVoiceQueuesRt']=function(_0x512d50,_0x2a7305,_0x577dd1){var _0x1cffe0={};var _0x5c1d3b={};var _0xd15611;var _0x162280;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x512d50[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x2a7305,null))[_0x9459('0x24')](function(_0x5806c5){if(_0x5806c5){_0xd15611=_0x5806c5;_0x5c1d3b[_0x9459('0x4f')]=_[_0x9459('0x52')](db['UserVoiceQueueRt'][_0x9459('0x68')]);_0x5c1d3b['query']=_[_0x9459('0x52')](_0x512d50[_0x9459('0x51')]);_0x5c1d3b[_0x9459('0x53')]=_[_0x9459('0x55')](_0x5c1d3b[_0x9459('0x4f')],_0x5c1d3b['query']);_0x1cffe0[_0x9459('0x54')]=_['intersection'](_0x5c1d3b[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x512d50['query'][_0x9459('0x56')]));_0x1cffe0[_0x9459('0x54')]=_0x1cffe0[_0x9459('0x54')][_0x9459('0x57')]?_0x1cffe0[_0x9459('0x54')]:_0x5c1d3b[_0x9459('0x4f')];_0x1cffe0['order']=qs[_0x9459('0x5b')](_0x512d50[_0x9459('0x51')][_0x9459('0x5b')]);_0x1cffe0[_0x9459('0x5c')]=qs['filters'](_['pick'](_0x512d50['query'],_0x5c1d3b[_0x9459('0x53')]));if(_0x512d50[_0x9459('0x51')][_0x9459('0x41')]){_0x1cffe0[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x1cffe0[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x1cffe0[_0x9459('0x54')],function(_0x235ab0){var _0x145719={};_0x145719[_0x235ab0]={'$like':'%'+_0x512d50[_0x9459('0x51')]['filter']+'%'};return _0x145719;})});}_0x1cffe0=_[_0x9459('0x5e')]({},_0x1cffe0,_0x512d50[_0x9459('0x63')]);return _0xd15611['getVoiceQueuesRt'](_0x1cffe0);}})[_0x9459('0x24')](function(_0x5c3e82){if(_0x5c3e82){_0x162280=_0x5c3e82[_0x9459('0x57')];if(!_0x512d50[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x1cffe0[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x512d50['query'][_0x9459('0x34')]);_0x1cffe0[_0x9459('0x33')]=qs['offset'](_0x512d50['query'][_0x9459('0x33')]);}return _0xd15611['getVoiceQueuesRt'](_0x1cffe0);}})['then'](function(_0x4af322){if(_0x4af322){return _0x4af322?{'count':_0x162280,'rows':_0x4af322}:null;}})[_0x9459('0x24')](respondWithResult(_0x2a7305,null))[_0x9459('0x6c')](handleError(_0x2a7305,null));};exports[_0x9459('0xc9')]=function(_0x301bb6,_0x125f51,_0x373bf2){var _0x2288b5={};var _0x15c2c5={};var _0x532397;var _0x3ed3b3;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x301bb6['params']['id']}})['then'](handleEntityNotFound(_0x125f51,null))[_0x9459('0x24')](function(_0x4c071d){if(_0x4c071d){_0x532397=_0x4c071d;_0x15c2c5[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xca')][_0x9459('0x68')]);_0x15c2c5['query']=_[_0x9459('0x52')](_0x301bb6[_0x9459('0x51')]);_0x15c2c5[_0x9459('0x53')]=_['intersection'](_0x15c2c5[_0x9459('0x4f')],_0x15c2c5[_0x9459('0x51')]);_0x2288b5[_0x9459('0x54')]=_[_0x9459('0x55')](_0x15c2c5[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x301bb6[_0x9459('0x51')][_0x9459('0x56')]));_0x2288b5['attributes']=_0x2288b5[_0x9459('0x54')][_0x9459('0x57')]?_0x2288b5['attributes']:_0x15c2c5[_0x9459('0x4f')];_0x2288b5[_0x9459('0x5a')]=qs['sort'](_0x301bb6[_0x9459('0x51')][_0x9459('0x5b')]);_0x2288b5[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x301bb6['query'],_0x15c2c5[_0x9459('0x53')]));if(_0x301bb6['query'][_0x9459('0x41')]){_0x2288b5[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x2288b5[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x2288b5[_0x9459('0x54')],function(_0x1c74cd){var _0x3bffb9={};_0x3bffb9[_0x1c74cd]={'$like':'%'+_0x301bb6[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x3bffb9;})});}_0x2288b5=_['merge']({},_0x2288b5,_0x301bb6[_0x9459('0x63')]);return _0x532397[_0x9459('0xc9')](_0x2288b5);}})['then'](function(_0x207cba){if(_0x207cba){_0x3ed3b3=_0x207cba['length'];if(!_0x301bb6[_0x9459('0x51')][_0x9459('0x58')]('nolimit')){_0x2288b5['limit']=qs[_0x9459('0x34')](_0x301bb6[_0x9459('0x51')][_0x9459('0x34')]);_0x2288b5[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x301bb6[_0x9459('0x51')][_0x9459('0x33')]);}return _0x532397[_0x9459('0xc9')](_0x2288b5);}})[_0x9459('0x24')](function(_0x3d49b2){if(_0x3d49b2){return _0x3d49b2?{'count':_0x3ed3b3,'rows':_0x3d49b2}:null;}})[_0x9459('0x24')](respondWithResult(_0x125f51,null))[_0x9459('0x6c')](handleError(_0x125f51,null));};exports[_0x9459('0xcb')]=function(_0x5563e5,_0x408d68,_0x4cc8fe){var _0x1aeb2d={'raw':!![],'where':{}};var _0x116e73={};var _0x316c1e={'count':0x0,'rows':[]};return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x5563e5[_0x9459('0x6d')]['id']}})['then'](handleEntityNotFound(_0x408d68,null))[_0x9459('0x24')](function(_0x52a0d6){if(_0x52a0d6){_0x116e73[_0x9459('0x4f')]=_['keys'](db['VoiceRecording'][_0x9459('0x68')]);_0x116e73[_0x9459('0x51')]=_[_0x9459('0x52')](_0x5563e5[_0x9459('0x51')]);_0x116e73['filters']=_[_0x9459('0x55')](_0x116e73[_0x9459('0x4f')],_0x116e73['query']);_0x1aeb2d[_0x9459('0x54')]=_[_0x9459('0x55')](_0x116e73[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x5563e5['query']['fields']));_0x1aeb2d['attributes']=_0x1aeb2d[_0x9459('0x54')][_0x9459('0x57')]?_0x1aeb2d[_0x9459('0x54')]:_0x116e73[_0x9459('0x4f')];if(!_0x5563e5[_0x9459('0x51')]['hasOwnProperty'](_0x9459('0x59'))){_0x1aeb2d['limit']=qs[_0x9459('0x34')](_0x5563e5[_0x9459('0x51')][_0x9459('0x34')]);_0x1aeb2d[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x5563e5[_0x9459('0x51')][_0x9459('0x33')]);}_0x1aeb2d['order']=qs[_0x9459('0x5b')](_0x5563e5[_0x9459('0x51')]['sort']);_0x1aeb2d[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x5563e5['query'],_0x116e73['filters']));_0x1aeb2d['where'][_0x9459('0xcc')]=_0x52a0d6['id'];if(_0x5563e5['query'][_0x9459('0x41')]){_0x1aeb2d['where']=_[_0x9459('0x5e')](_0x1aeb2d[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x1aeb2d['attributes'],function(_0x28d3b9){var _0x276e5b={};_0x276e5b[_0x28d3b9]={'$like':'%'+_0x5563e5[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x276e5b;})});}_0x1aeb2d=_['merge']({},_0x1aeb2d,_0x5563e5[_0x9459('0x63')]);return db[_0x9459('0xcd')][_0x9459('0x32')]({'where':_0x1aeb2d[_0x9459('0x5c')]})[_0x9459('0x24')](function(_0x45cf7b){_0x316c1e[_0x9459('0x32')]=_0x45cf7b;if(_0x5563e5[_0x9459('0x51')][_0x9459('0xce')]){_0x1aeb2d['include']=[{'all':!![]}];}return db[_0x9459('0xcd')]['findAll'](_0x1aeb2d);})[_0x9459('0x24')](function(_0x13d533){_0x316c1e[_0x9459('0xcf')]=_0x13d533;return _0x316c1e;});}})[_0x9459('0x24')](respondWithFilteredResult(_0x408d68,_0x1aeb2d))[_0x9459('0x6c')](handleError(_0x408d68,null));};exports[_0x9459('0xd0')]=function(_0x1a9f5a,_0x43a906,_0x224613){var _0x3f17ff={'raw':!![],'where':{}};var _0x526a2b={};var _0x23175b={'count':0x0,'rows':[]};return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x1a9f5a[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x43a906,null))['then'](function(_0x554d37){if(_0x554d37){_0x526a2b[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xd1')]['rawAttributes']);_0x526a2b['query']=_[_0x9459('0x52')](_0x1a9f5a['query']);_0x526a2b[_0x9459('0x53')]=_[_0x9459('0x55')](_0x526a2b[_0x9459('0x4f')],_0x526a2b[_0x9459('0x51')]);_0x3f17ff[_0x9459('0x54')]=_[_0x9459('0x55')](_0x526a2b[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x1a9f5a[_0x9459('0x51')][_0x9459('0x56')]));_0x3f17ff[_0x9459('0x54')]=_0x3f17ff[_0x9459('0x54')][_0x9459('0x57')]?_0x3f17ff[_0x9459('0x54')]:_0x526a2b[_0x9459('0x4f')];if(!_0x1a9f5a[_0x9459('0x51')][_0x9459('0x58')]('nolimit')){_0x3f17ff['limit']=qs[_0x9459('0x34')](_0x1a9f5a[_0x9459('0x51')][_0x9459('0x34')]);_0x3f17ff['offset']=qs[_0x9459('0x33')](_0x1a9f5a[_0x9459('0x51')][_0x9459('0x33')]);}_0x3f17ff[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x1a9f5a[_0x9459('0x51')][_0x9459('0x5b')]);_0x3f17ff[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x1a9f5a[_0x9459('0x51')],_0x526a2b[_0x9459('0x53')]));_0x3f17ff['where'][_0x9459('0xcc')]=_0x554d37['id'];if(_0x1a9f5a[_0x9459('0x51')][_0x9459('0x41')]){_0x3f17ff['where']=_[_0x9459('0x5e')](_0x3f17ff[_0x9459('0x5c')],{'$or':_['map'](_0x3f17ff[_0x9459('0x54')],function(_0x49ab9a){var _0x3ecab8={};_0x3ecab8[_0x49ab9a]={'$like':'%'+_0x1a9f5a[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x3ecab8;})});}_0x3f17ff=_['merge']({},_0x3f17ff,_0x1a9f5a[_0x9459('0x63')]);return db['ScreenRecording'][_0x9459('0x32')]({'where':_0x3f17ff[_0x9459('0x5c')]})[_0x9459('0x24')](function(_0x340819){_0x23175b[_0x9459('0x32')]=_0x340819;if(_0x1a9f5a[_0x9459('0x51')][_0x9459('0xce')]){_0x3f17ff[_0x9459('0xbf')]=[{'all':!![]}];}return db[_0x9459('0xd1')]['findAll'](_0x3f17ff);})['then'](function(_0x528261){_0x23175b[_0x9459('0xcf')]=_0x528261;return _0x23175b;});}})[_0x9459('0x24')](respondWithFilteredResult(_0x43a906,_0x3f17ff))['catch'](handleError(_0x43a906,null));};exports['getChatInteractions']=function(_0x12412b,_0x17aae9,_0x17fb76){var _0x32031e={};var _0x236614={};var _0x219c40;var _0x5e6f62;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x12412b[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x17aae9,null))[_0x9459('0x24')](function(_0x509160){if(_0x509160){_0x219c40=_0x509160;_0x236614[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xd2')]['rawAttributes']);_0x236614[_0x9459('0x51')]=_[_0x9459('0x52')](_0x12412b['query']);_0x236614[_0x9459('0x53')]=_['intersection'](_0x236614['model'],_0x236614[_0x9459('0x51')]);_0x32031e[_0x9459('0x54')]=_[_0x9459('0x55')](_0x236614[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x12412b[_0x9459('0x51')][_0x9459('0x56')]));_0x32031e[_0x9459('0x54')]=_0x32031e[_0x9459('0x54')][_0x9459('0x57')]?_0x32031e['attributes']:_0x236614[_0x9459('0x4f')];_0x32031e['order']=qs[_0x9459('0x5b')](_0x12412b[_0x9459('0x51')][_0x9459('0x5b')]);_0x32031e[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x12412b['query'],_0x236614[_0x9459('0x53')]));if(_0x12412b[_0x9459('0x51')][_0x9459('0x41')]){_0x32031e[_0x9459('0x5c')]=_['merge'](_0x32031e[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x32031e[_0x9459('0x54')],function(_0x3d410d){var _0x448bfa={};_0x448bfa[_0x3d410d]={'$like':'%'+_0x12412b[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x448bfa;})});}_0x32031e=_[_0x9459('0x5e')]({},_0x32031e,_0x12412b['options']);return _0x219c40[_0x9459('0xd3')](_0x32031e);}})[_0x9459('0x24')](function(_0x3022ed){if(_0x3022ed){_0x5e6f62=_0x3022ed[_0x9459('0x57')];if(!_0x12412b[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x32031e['limit']=qs[_0x9459('0x34')](_0x12412b[_0x9459('0x51')][_0x9459('0x34')]);_0x32031e[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x12412b[_0x9459('0x51')][_0x9459('0x33')]);}return _0x219c40['getChatInteractions'](_0x32031e);}})[_0x9459('0x24')](function(_0xe6512){if(_0xe6512){return _0xe6512?{'count':_0x5e6f62,'rows':_0xe6512}:null;}})['then'](respondWithResult(_0x17aae9,null))[_0x9459('0x6c')](handleError(_0x17aae9,null));};exports[_0x9459('0xd4')]=function(_0x3badcc,_0x1c0fbd,_0x7eb6eb){var _0x4ac664={};var _0xcdd1b2={};var _0x1195c4;var _0x1399a3;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x3badcc[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x1c0fbd,null))['then'](function(_0x5bb638){if(_0x5bb638){_0x1195c4=_0x5bb638;_0xcdd1b2[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xd5')]['rawAttributes']);_0xcdd1b2[_0x9459('0x51')]=_[_0x9459('0x52')](_0x3badcc[_0x9459('0x51')]);_0xcdd1b2[_0x9459('0x53')]=_[_0x9459('0x55')](_0xcdd1b2['model'],_0xcdd1b2['query']);_0x4ac664['attributes']=_['intersection'](_0xcdd1b2['model'],qs[_0x9459('0x56')](_0x3badcc[_0x9459('0x51')][_0x9459('0x56')]));_0x4ac664[_0x9459('0x54')]=_0x4ac664[_0x9459('0x54')][_0x9459('0x57')]?_0x4ac664[_0x9459('0x54')]:_0xcdd1b2['model'];_0x4ac664['order']=qs[_0x9459('0x5b')](_0x3badcc['query'][_0x9459('0x5b')]);_0x4ac664['where']=qs['filters'](_['pick'](_0x3badcc[_0x9459('0x51')],_0xcdd1b2[_0x9459('0x53')]));if(_0x3badcc[_0x9459('0x51')][_0x9459('0x41')]){_0x4ac664[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x4ac664['where'],{'$or':_[_0x9459('0x43')](_0x4ac664[_0x9459('0x54')],function(_0x4578a1){var _0x5a75d3={};_0x5a75d3[_0x4578a1]={'$like':'%'+_0x3badcc[_0x9459('0x51')]['filter']+'%'};return _0x5a75d3;})});}_0x4ac664=_[_0x9459('0x5e')]({},_0x4ac664,_0x3badcc[_0x9459('0x63')]);return _0x1195c4['getOpenchannelInteractions'](_0x4ac664);}})[_0x9459('0x24')](function(_0x4f1eb3){if(_0x4f1eb3){_0x1399a3=_0x4f1eb3[_0x9459('0x57')];if(!_0x3badcc[_0x9459('0x51')]['hasOwnProperty']('nolimit')){_0x4ac664['limit']=qs[_0x9459('0x34')](_0x3badcc['query']['limit']);_0x4ac664['offset']=qs[_0x9459('0x33')](_0x3badcc[_0x9459('0x51')][_0x9459('0x33')]);}return _0x1195c4['getOpenchannelInteractions'](_0x4ac664);}})[_0x9459('0x24')](function(_0x53fe26){if(_0x53fe26){return _0x53fe26?{'count':_0x1399a3,'rows':_0x53fe26}:null;}})['then'](respondWithResult(_0x1c0fbd,null))[_0x9459('0x6c')](handleError(_0x1c0fbd,null));};exports['getMailInteractions']=function(_0x4747ff,_0x540c39,_0x1aa7e2){var _0x150a80={'raw':!![],'where':{}};var _0x290e9e={};var _0x3b9ec7={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x4747ff[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x540c39,null))[_0x9459('0x24')](function(_0x5ba99f){if(_0x5ba99f){_0x290e9e[_0x9459('0x4f')]=_[_0x9459('0x52')](db['MailInteraction'][_0x9459('0x68')]);_0x290e9e['query']=_[_0x9459('0x52')](_0x4747ff['query']);_0x290e9e[_0x9459('0x53')]=_['intersection'](_0x290e9e[_0x9459('0x4f')],_0x290e9e[_0x9459('0x51')]);_0x150a80['attributes']=_[_0x9459('0x55')](_0x290e9e[_0x9459('0x4f')],qs['fields'](_0x4747ff[_0x9459('0x51')]['fields']));_0x150a80[_0x9459('0x54')]=_0x150a80['attributes'][_0x9459('0x57')]?_0x150a80[_0x9459('0x54')]:_0x290e9e[_0x9459('0x4f')];if(!_0x4747ff[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x150a80[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x4747ff[_0x9459('0x51')][_0x9459('0x34')]);_0x150a80['offset']=qs['offset'](_0x4747ff['query'][_0x9459('0x33')]);}_0x150a80[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x4747ff['query'][_0x9459('0x5b')]);_0x150a80[_0x9459('0x5c')]=qs['filters'](_['pick'](_0x4747ff[_0x9459('0x51')],_0x290e9e[_0x9459('0x53')]));_0x150a80['where'][_0x9459('0xcc')]=_0x5ba99f['id'];if(_0x4747ff[_0x9459('0x51')][_0x9459('0x41')]){_0x150a80[_0x9459('0x5c')]=_['merge'](_0x150a80[_0x9459('0x5c')],{'$or':_['map'](_0x150a80[_0x9459('0x54')],function(_0x2fe602){var _0x2b063d={};_0x2b063d[_0x2fe602]={'$like':'%'+_0x4747ff[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x2b063d;})});}_0x150a80=_[_0x9459('0x5e')]({},_0x150a80,_0x4747ff['options']);return db[_0x9459('0xd6')]['count']({'where':_0x150a80['where']})['then'](function(_0x4ed550){_0x3b9ec7[_0x9459('0x32')]=_0x4ed550;if(_0x4747ff[_0x9459('0x51')]['includeAll']){_0x150a80[_0x9459('0xbf')]=[{'all':!![]}];}return db[_0x9459('0xd6')][_0x9459('0x65')](_0x150a80);})[_0x9459('0x24')](function(_0x53a15e){_0x3b9ec7[_0x9459('0xcf')]=_0x53a15e;return _0x3b9ec7;});}})[_0x9459('0x24')](respondWithFilteredResult(_0x540c39,_0x150a80))[_0x9459('0x6c')](handleError(_0x540c39,null));};exports[_0x9459('0xd7')]=function(_0x2e8985,_0x39d900,_0x1128ce){var _0x8fdc39={};var _0x368d85={};var _0x548eb1;var _0x187cf3;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x2e8985[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x39d900,null))[_0x9459('0x24')](function(_0x2b4b12){if(_0x2b4b12){_0x548eb1=_0x2b4b12;_0x368d85['model']=_[_0x9459('0x52')](db[_0x9459('0xd8')][_0x9459('0x68')]);_0x368d85['query']=_[_0x9459('0x52')](_0x2e8985[_0x9459('0x51')]);_0x368d85[_0x9459('0x53')]=_[_0x9459('0x55')](_0x368d85['model'],_0x368d85[_0x9459('0x51')]);_0x8fdc39[_0x9459('0x54')]=_[_0x9459('0x55')](_0x368d85[_0x9459('0x4f')],qs['fields'](_0x2e8985[_0x9459('0x51')][_0x9459('0x56')]));_0x8fdc39['attributes']=_0x8fdc39[_0x9459('0x54')][_0x9459('0x57')]?_0x8fdc39['attributes']:_0x368d85['model'];_0x8fdc39[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x2e8985[_0x9459('0x51')][_0x9459('0x5b')]);_0x8fdc39[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x2e8985[_0x9459('0x51')],_0x368d85[_0x9459('0x53')]));if(_0x2e8985[_0x9459('0x51')][_0x9459('0x41')]){_0x8fdc39['where']=_[_0x9459('0x5e')](_0x8fdc39[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x8fdc39['attributes'],function(_0x1b23ff){var _0x347908={};_0x347908[_0x1b23ff]={'$like':'%'+_0x2e8985[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x347908;})});}_0x8fdc39=_[_0x9459('0x5e')]({},_0x8fdc39,_0x2e8985['options']);return _0x548eb1[_0x9459('0xd7')](_0x8fdc39);}})[_0x9459('0x24')](function(_0x3da69e){if(_0x3da69e){_0x187cf3=_0x3da69e['length'];if(!_0x2e8985[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x8fdc39[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x2e8985[_0x9459('0x51')]['limit']);_0x8fdc39[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x2e8985['query']['offset']);}return _0x548eb1[_0x9459('0xd7')](_0x8fdc39);}})[_0x9459('0x24')](function(_0x4fd84a){if(_0x4fd84a){return _0x4fd84a?{'count':_0x187cf3,'rows':_0x4fd84a}:null;}})[_0x9459('0x24')](respondWithResult(_0x39d900,null))[_0x9459('0x6c')](handleError(_0x39d900,null));};exports[_0x9459('0xd9')]=function(_0x3ae1cc,_0x3ce225,_0x559020){var _0x3ca348={};var _0x54007a={};var _0x4e768f;var _0x1c1ba5;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x3ae1cc['params']['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x3ce225,null))['then'](function(_0x3de22a){if(_0x3de22a){_0x4e768f=_0x3de22a;_0x54007a[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xda')][_0x9459('0x68')]);_0x54007a[_0x9459('0x51')]=_['keys'](_0x3ae1cc[_0x9459('0x51')]);_0x54007a[_0x9459('0x53')]=_[_0x9459('0x55')](_0x54007a[_0x9459('0x4f')],_0x54007a[_0x9459('0x51')]);_0x3ca348[_0x9459('0x54')]=_[_0x9459('0x55')](_0x54007a[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x3ae1cc[_0x9459('0x51')][_0x9459('0x56')]));_0x3ca348[_0x9459('0x54')]=_0x3ca348['attributes'][_0x9459('0x57')]?_0x3ca348[_0x9459('0x54')]:_0x54007a['model'];_0x3ca348[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x3ae1cc[_0x9459('0x51')]['sort']);_0x3ca348[_0x9459('0x5c')]=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x3ae1cc[_0x9459('0x51')],_0x54007a[_0x9459('0x53')]));if(_0x3ae1cc[_0x9459('0x51')]['filter']){_0x3ca348[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x3ca348['where'],{'$or':_['map'](_0x3ca348['attributes'],function(_0x16adc2){var _0x2298fa={};_0x2298fa[_0x16adc2]={'$like':'%'+_0x3ae1cc[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x2298fa;})});}_0x3ca348=_[_0x9459('0x5e')]({},_0x3ca348,_0x3ae1cc['options']);return _0x4e768f[_0x9459('0xd9')](_0x3ca348);}})[_0x9459('0x24')](function(_0x122edf){if(_0x122edf){_0x1c1ba5=_0x122edf[_0x9459('0x57')];if(!_0x3ae1cc[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x3ca348[_0x9459('0x34')]=qs['limit'](_0x3ae1cc[_0x9459('0x51')]['limit']);_0x3ca348['offset']=qs['offset'](_0x3ae1cc[_0x9459('0x51')][_0x9459('0x33')]);}return _0x4e768f[_0x9459('0xd9')](_0x3ca348);}})[_0x9459('0x24')](function(_0x518537){if(_0x518537){return _0x518537?{'count':_0x1c1ba5,'rows':_0x518537}:null;}})['then'](respondWithResult(_0x3ce225,null))[_0x9459('0x6c')](handleError(_0x3ce225,null));};exports[_0x9459('0xdb')]=function(_0x50fe59,_0x1e8780,_0x44ea46){var _0x164391={};var _0x346715={};var _0x304c81;var _0x30425a;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x50fe59[_0x9459('0x6d')]['id']}})['then'](handleEntityNotFound(_0x1e8780,null))[_0x9459('0x24')](function(_0x2d8c2f){if(_0x2d8c2f){_0x304c81=_0x2d8c2f;_0x346715[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xdc')][_0x9459('0x68')]);_0x346715[_0x9459('0x51')]=_['keys'](_0x50fe59[_0x9459('0x51')]);_0x346715['filters']=_[_0x9459('0x55')](_0x346715[_0x9459('0x4f')],_0x346715[_0x9459('0x51')]);_0x164391['attributes']=_[_0x9459('0x55')](_0x346715[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x50fe59[_0x9459('0x51')]['fields']));_0x164391[_0x9459('0x54')]=_0x164391[_0x9459('0x54')][_0x9459('0x57')]?_0x164391[_0x9459('0x54')]:_0x346715[_0x9459('0x4f')];_0x164391[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x50fe59['query'][_0x9459('0x5b')]);_0x164391[_0x9459('0x5c')]=qs['filters'](_['pick'](_0x50fe59[_0x9459('0x51')],_0x346715[_0x9459('0x53')]));if(_0x50fe59[_0x9459('0x51')]['filter']){_0x164391[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0x164391['where'],{'$or':_[_0x9459('0x43')](_0x164391['attributes'],function(_0x585e91){var _0x408fa0={};_0x408fa0[_0x585e91]={'$like':'%'+_0x50fe59['query']['filter']+'%'};return _0x408fa0;})});}_0x164391=_[_0x9459('0x5e')]({},_0x164391,_0x50fe59[_0x9459('0x63')]);return _0x304c81[_0x9459('0xdb')](_0x164391);}})[_0x9459('0x24')](function(_0x4e6cc0){if(_0x4e6cc0){_0x30425a=_0x4e6cc0[_0x9459('0x57')];if(!_0x50fe59[_0x9459('0x51')][_0x9459('0x58')](_0x9459('0x59'))){_0x164391['limit']=qs['limit'](_0x50fe59[_0x9459('0x51')][_0x9459('0x34')]);_0x164391[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x50fe59[_0x9459('0x51')][_0x9459('0x33')]);}return _0x304c81[_0x9459('0xdb')](_0x164391);}})[_0x9459('0x24')](function(_0x7cd2ac){if(_0x7cd2ac){return _0x7cd2ac?{'count':_0x30425a,'rows':_0x7cd2ac}:null;}})[_0x9459('0x24')](respondWithResult(_0x1e8780,null))[_0x9459('0x6c')](handleError(_0x1e8780,null));};exports[_0x9459('0xdd')]=function(_0x17d657,_0xb6fb69,_0x18cc12){var _0x6a4268;var _0x3fddfc;var _0x56a663;var _0x53e256=!_[_0x9459('0x78')](_0x17d657[_0x9459('0x6d')]['id'])?_0x17d657[_0x9459('0x6d')]['id']:!_[_0x9459('0x78')](_0x17d657[_0x9459('0x3d')]['id'])?_0x17d657[_0x9459('0x3d')]['id']:null;return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x53e256,'role':{'$or':[_0x9459('0x73'),_0x9459('0x3d'),_0x9459('0x3f')]}},'attributes':['id','name','phone',_0x9459('0xde'),_0x9459('0x46'),_0x9459('0x80'),'loginInPause']})[_0x9459('0x24')](function(_0x3226e4){if(_0x3226e4){if(_0x3226e4['role']===_0x9459('0x3f')){_0x6a4268=_0x3226e4;if(_0x17d657[_0x9459('0x6b')]['interface']){_0x56a663=util['format']('LOCAL/%s@from-sip/n',_0x6a4268[_0x17d657[_0x9459('0x6b')][_0x9459('0xa1')]]);}else if(_0x17d657[_0x9459('0x6b')][_0x9459('0xdf')]){_0x56a663=util[_0x9459('0x7a')](_0x9459('0xe0'),_0x17d657['body']['intrf']);}else{_0x56a663=util[_0x9459('0x7a')](_0x9459('0xe0'),_0x6a4268[_0x9459('0x49')]);}socket['to'](util[_0x9459('0x7a')](_0x9459('0xe1'),_0x6a4268['name']))['emit'](_0x9459('0xe2'),{'ip':_0x17d657[_0x9459('0xe3')][_0x9459('0xe4')]||_0x17d657[_0x9459('0xe5')][_0x9459('0xe6')]||_0x17d657[_0x9459('0xe7')][_0x9459('0xe6')]||_0x17d657[_0x9459('0xe5')][_0x9459('0xe7')][_0x9459('0xe6')]});return db[_0x9459('0xab')]['destroy']({'where':{'membername':_0x6a4268['name']},'individualHooks':!![]});}}else{throw new db[(_0x9459('0x21'))]['ValidationError'](_0x9459('0xe8'));}})[_0x9459('0x24')](function(){if(_0x6a4268){return _0x6a4268[_0x9459('0xe9')]({'raw':!![]});}})[_0x9459('0x24')](function(_0x3df229){if(_0x6a4268){var _0x4386dd=[];if(_0x3df229){_0x3fddfc=_0x3df229;if(_0x3fddfc[_0x9459('0x57')]){for(var _0x1e94b7=0x0;_0x1e94b7<_0x3fddfc[_0x9459('0x57')];_0x1e94b7++){_0x4386dd[_0x9459('0xaa')]({'membername':_0x6a4268[_0x9459('0x49')],'UserId':_0x6a4268['id'],'queue_name':_0x3fddfc[_0x1e94b7][_0x9459('0x49')],'VoiceQueueId':_0x3fddfc[_0x1e94b7]['id'],'interface':_0x56a663,'paused':_0x6a4268[_0x9459('0x9f')]||![],'penalty':_0x3fddfc[_0x1e94b7][_0x9459('0xea')]||0x0});}return BPromise[_0x9459('0xeb')](_0x4386dd,function(_0x3475d1){return db['UserVoiceQueueRt'][_0x9459('0xec')](_0x3475d1);});}}}})[_0x9459('0x24')](function(){if(_0x6a4268){return db[_0x9459('0xed')][_0x9459('0x65')]({'where':{'membername':_0x6a4268[_0x9459('0x49')],'exitAt':null}});}})[_0x9459('0x24')](function(_0x53025b){if(_0x6a4268){var _0x3ea4dc=[];_0x53025b[_0x9459('0xee')](function(_0x350e74){_0x3ea4dc[_0x9459('0xaa')](_0x350e74[_0x9459('0x3a')]({'exitAt':moment()[_0x9459('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9459('0xef')](_0x3ea4dc);}})[_0x9459('0x24')](function(){if(_0x6a4268){var _0x24c159=[];var _0x57f24e=[];var _0x33549a=utils[_0x9459('0xf0')]();var _0x5e15a6={'membername':_0x6a4268[_0x9459('0x49')],'interface':_0x56a663,'enterAt':moment()[_0x9459('0x7a')](_0x9459('0xf1')),'role':_0x6a4268[_0x9459('0x46')],'internal':_0x6a4268[_0x9459('0x80')]};_0x33549a[_0x9459('0xee')](function(_0xdaf3a1){_0x24c159[_0x9459('0xaa')](_[_0x9459('0x5e')]({'channel':_0xdaf3a1,'type':_0x9459('0xf2'),'data1':_0x17d657[_0x9459('0x6b')][_0x9459('0xf3')],'data2':_0x56a663},_0x5e15a6));if(_0x6a4268[_0x9459('0x9f')]){_0x57f24e['push'](_[_0x9459('0x5e')]({'channel':_0xdaf3a1,'type':_0x9459('0xf4'),'data1':'LOGININPAUSE'},_0x5e15a6));}});return db[_0x9459('0xed')]['bulkCreate'](_0x24c159[_0x9459('0xf5')](_0x57f24e),{'individualHooks':!![]});}})[_0x9459('0x24')](function(){if(_0x6a4268){return _0x6a4268[_0x9459('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x9459('0x7a')](_0x9459('0xf1')),'voicePause':_0x6a4268[_0x9459('0x9f')]||![],'mailPause':_0x6a4268[_0x9459('0x9f')]||![],'chatPause':_0x6a4268['loginInPause']||![],'faxPause':_0x6a4268['loginInPause']||![],'smsPause':_0x6a4268[_0x9459('0x9f')]||![],'openchannelPause':_0x6a4268['loginInPause']||![],'whatsappPause':_0x6a4268[_0x9459('0x9f')]||![],'pauseType':_0x6a4268[_0x9459('0x9f')]?_0x9459('0xf6'):null,'interface':_0x56a663,'lastPauseAt':moment()[_0x9459('0x7a')](_0x9459('0xf1'))});}})[_0x9459('0x24')](function(_0x565496){if(_0x17d657[_0x9459('0xf7')]){return _0x18cc12();}else{return BPromise[_0x9459('0xf8')](_0x565496)[_0x9459('0x24')](respondWithResult(_0xb6fb69,null));}})[_0x9459('0x6c')](handleError(_0xb6fb69,null));};exports[_0x9459('0xf9')]=function(_0x58d03b,_0x2014ce,_0x3177c5){var _0x51e25b;return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x58d03b[_0x9459('0x6d')]['id'],'role':_0x9459('0x3f')},'attributes':['id',_0x9459('0x49'),_0x9459('0x46')]})[_0x9459('0x24')](handleEntityNotFound(_0x2014ce,null))[_0x9459('0x24')](function(_0x5bf58d){if(_0x5bf58d){_0x51e25b=_0x5bf58d;return db[_0x9459('0xab')][_0x9459('0xb1')]({'where':{'membername':_0x51e25b[_0x9459('0x49')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x51e25b[_0x9459('0x49')],'exitAt':null}});})[_0x9459('0x24')](function(_0x37c124){var _0x472044=[];_0x37c124[_0x9459('0xee')](function(_0x21e89a){_0x472044[_0x9459('0xaa')](_0x21e89a[_0x9459('0x3a')]({'exitAt':moment()[_0x9459('0x7a')](_0x9459('0xf1'))}));});return BPromise[_0x9459('0xef')](_0x472044);})[_0x9459('0x24')](function(){return _0x51e25b['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9459('0x24')](respondWithResult(_0x2014ce,null))[_0x9459('0x6c')](handleError(_0x2014ce,null));};exports[_0x9459('0xfa')]=function(_0x10d56a,_0x5e21f1,_0x17008f){var _0x7608e4;return db[_0x9459('0xab')][_0x9459('0x3a')]({'paused':0x1},{'where':{'UserId':_0x10d56a['params']['id']},'individualHooks':!![]})[_0x9459('0x24')](function(){return db[_0x9459('0x64')]['find']({'where':{'id':_0x10d56a['params']['id'],'role':_0x9459('0x3f')},'attributes':['id',_0x9459('0x49'),_0x9459('0x46'),_0x9459('0x80'),_0x9459('0xa1')]});})['then'](handleEntityNotFound(_0x5e21f1,null))['then'](function(_0x597780){if(_0x597780){_0x7608e4=_0x597780;return respondWithRpcPromise('QueuePause',_0x9459('0xfa'),{'id':_0x7608e4['id'],'name':_0x7608e4[_0x9459('0x49')],'pause':!![]});}})[_0x9459('0x24')](function(){if(_0x7608e4){return db['MemberReport'][_0x9459('0x65')]({'where':{'membername':_0x7608e4[_0x9459('0x49')],'type':_0x9459('0xf4'),'exitAt':null}});}})[_0x9459('0x24')](function(_0x5a6e88){if(_0x5a6e88[_0x9459('0x57')]){var _0x21226e=moment()['format'](_0x9459('0xf1'));for(var _0x5110f0=0x0,_0x274820=_0x5a6e88[_0x9459('0x57')];_0x5110f0<_0x274820;_0x5110f0++){_0x5a6e88[_0x5110f0][_0x9459('0xfb')]({'exitAt':_0x21226e});}}})[_0x9459('0x24')](function(){var _0x41d944=[];var _0x4863bb=utils['getChannels']();_0x4863bb[_0x9459('0xee')](function(_0x1262f0){_0x41d944[_0x9459('0xaa')]({'channel':_0x1262f0,'membername':_0x7608e4[_0x9459('0x49')],'interface':_['isNil'](_0x7608e4[_0x9459('0xa1')])?util['format'](_0x9459('0xe0'),_0x7608e4[_0x9459('0x49')]):_0x7608e4[_0x9459('0xa1')],'type':'PAUSE','enterAt':moment()[_0x9459('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x10d56a[_0x9459('0x6b')][_0x9459('0x4d')]||_0x9459('0xfc'),'role':_0x7608e4[_0x9459('0x46')],'internal':_0x7608e4[_0x9459('0x80')]});});return db[_0x9459('0xed')][_0x9459('0x6a')](_0x41d944,{'individualHooks':!![]});})[_0x9459('0x24')](function(){return _0x7608e4['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x10d56a[_0x9459('0x6b')]['type']||_0x9459('0xfc'),'lastPauseAt':moment()[_0x9459('0x7a')](_0x9459('0xf1'))});})[_0x9459('0x24')](respondWithResult(_0x5e21f1,null))[_0x9459('0x6c')](handleError(_0x5e21f1,null));};exports[_0x9459('0xfd')]=function(_0x4904c5,_0x1d4716,_0x5ba8c1){var _0xeebcaa;return db[_0x9459('0x64')][_0x9459('0x69')]({'where':{'id':_0x4904c5['params']['id']},'attributes':['id',_0x9459('0x49'),'role',_0x9459('0xa0'),_0x9459('0xfe'),_0x9459('0xff'),_0x9459('0x100'),_0x9459('0x101'),'smsPause',_0x9459('0x102'),_0x9459('0x103'),_0x9459('0x104')]})[_0x9459('0x24')](handleEntityNotFound(_0x1d4716,null))['then'](function(_0x4f0b79){if(_0x4f0b79){_0xeebcaa=_0x4f0b79;if(_0x4904c5[_0x9459('0x6b')][_0x9459('0x9d')]&&!utils[_0x9459('0xa2')](_0x4904c5[_0x9459('0x6b')][_0x9459('0x9d')])){throw new db[(_0x9459('0x21'))]['ValidationError']('Unknown\x20channel');}switch(_0x4904c5[_0x9459('0x6b')]['channel']){case _0x9459('0xa9'):return respondWithRpcPromise(_0x9459('0x105'),'unpause',{'id':_0xeebcaa['id'],'name':_0xeebcaa[_0x9459('0x49')],'pause':![]})['then'](function(){return db[_0x9459('0xab')][_0x9459('0x3a')]({'paused':0x0},{'where':{'UserId':_0xeebcaa['id']},'individualHooks':!![]});})['then'](function(){return db[_0x9459('0xed')]['find']({'where':{'channel':_0x4904c5[_0x9459('0x6b')]['channel'],'membername':_0xeebcaa[_0x9459('0x49')],'type':_0x9459('0xf4'),'exitAt':null}});})['then'](function(_0x12b8ee){if(_0x12b8ee){return _0x12b8ee[_0x9459('0x3a')]({'exitAt':moment()[_0x9459('0x7a')](_0x9459('0xf1')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x9459('0x24')](function(){return _0xeebcaa['update']({'voicePause':![]});});case'mail':case'chat':case _0x9459('0x106'):case _0x9459('0x107'):case _0x9459('0x108'):case'openchannel':return db[_0x9459('0xed')][_0x9459('0x69')]({'where':{'channel':_0x4904c5[_0x9459('0x6b')][_0x9459('0x9d')],'membername':_0xeebcaa[_0x9459('0x49')],'type':_0x9459('0xf4'),'exitAt':null}})['then'](function(_0x17c40c){if(_0x17c40c){return _0x17c40c['update']({'exitAt':moment()['format'](_0x9459('0xf1')),'data2':_0x9459('0x109')},{'individualHooks':!![]});}return null;})[_0x9459('0x24')](function(){var _0x2f1b33={};_[_0x9459('0x35')](_0x2f1b33,util['format'](_0x9459('0x10a'),_0x4904c5[_0x9459('0x6b')][_0x9459('0x9d')],_0x9459('0x10b')),![]);return _0xeebcaa['update'](_0x2f1b33);});default:return respondWithRpcPromise(_0x9459('0x105'),'unpause',{'id':_0xeebcaa['id'],'name':_0xeebcaa[_0x9459('0x49')],'pause':![]})[_0x9459('0x24')](function(){return db[_0x9459('0xab')]['update']({'paused':0x0},{'where':{'UserId':_0xeebcaa['id']}});})[_0x9459('0x24')](function(){return db[_0x9459('0xed')]['findAll']({'where':{'membername':_0xeebcaa['name'],'type':_0x9459('0xf4'),'exitAt':null}});})[_0x9459('0x24')](function(_0x411542){var _0x359ddd=[];_0x411542[_0x9459('0xee')](function(_0x39225a){_0x359ddd[_0x9459('0xaa')](_0x39225a[_0x9459('0x3a')]({'exitAt':moment()[_0x9459('0x7a')](_0x9459('0xf1')),'data2':'manual'}));});return BPromise[_0x9459('0xef')](_0x359ddd);})[_0x9459('0x24')](function(){return _0xeebcaa[_0x9459('0x3a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x1d4716,null))[_0x9459('0x6c')](handleError(_0x1d4716,null));};exports[_0x9459('0x10c')]=function(_0x2f7e79,_0x5f1bd4,_0xfad01a){var _0xfa7609={};var _0x1007c1={};var _0x1bed60;var _0x9133c5;return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x2f7e79[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x5f1bd4,null))[_0x9459('0x24')](function(_0x2838e1){if(_0x2838e1){_0x1bed60=_0x2838e1;_0x1007c1[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0x10d')][_0x9459('0x68')]);_0x1007c1[_0x9459('0x51')]=_[_0x9459('0x52')](_0x2f7e79['query']);_0x1007c1[_0x9459('0x53')]=_[_0x9459('0x55')](_0x1007c1['model'],_0x1007c1['query']);_0xfa7609['attributes']=_[_0x9459('0x55')](_0x1007c1['model'],qs[_0x9459('0x56')](_0x2f7e79[_0x9459('0x51')][_0x9459('0x56')]));_0xfa7609['attributes']=_0xfa7609[_0x9459('0x54')][_0x9459('0x57')]?_0xfa7609['attributes']:_0x1007c1[_0x9459('0x4f')];_0xfa7609[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x2f7e79[_0x9459('0x51')][_0x9459('0x5b')]);_0xfa7609[_0x9459('0x5c')]=qs['filters'](_[_0x9459('0x5d')](_0x2f7e79[_0x9459('0x51')],_0x1007c1[_0x9459('0x53')]));if(_0x2f7e79[_0x9459('0x51')][_0x9459('0x41')]){_0xfa7609[_0x9459('0x5c')]=_['merge'](_0xfa7609['where'],{'$or':_[_0x9459('0x43')](_0xfa7609[_0x9459('0x54')],function(_0xd5942a){var _0x4239c6={};_0x4239c6[_0xd5942a]={'$like':'%'+_0x2f7e79['query'][_0x9459('0x41')]+'%'};return _0x4239c6;})});}_0xfa7609=_['merge']({},_0xfa7609,_0x2f7e79[_0x9459('0x63')]);return _0x1bed60[_0x9459('0x10c')](_0xfa7609);}})[_0x9459('0x24')](function(_0x49ac2c){if(_0x49ac2c){_0x9133c5=_0x49ac2c[_0x9459('0x57')];if(!_0x2f7e79['query'][_0x9459('0x58')](_0x9459('0x59'))){_0xfa7609['limit']=qs[_0x9459('0x34')](_0x2f7e79['query'][_0x9459('0x34')]);_0xfa7609[_0x9459('0x33')]=qs[_0x9459('0x33')](_0x2f7e79[_0x9459('0x51')]['offset']);}return _0x1bed60[_0x9459('0x10c')](_0xfa7609);}})['then'](function(_0x5efe8a){if(_0x5efe8a){return _0x5efe8a?{'count':_0x9133c5,'rows':_0x5efe8a}:null;}})[_0x9459('0x24')](respondWithResult(_0x5f1bd4,null))[_0x9459('0x6c')](handleError(_0x5f1bd4,null));};exports[_0x9459('0x10e')]=function(_0xa9a345,_0x3ab7b4){return db['User'][_0x9459('0x69')]({'where':{'id':_0xa9a345['params']['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x3ab7b4,null))[_0x9459('0x24')](function(_0x290bec){if(_0x290bec){var _0x211e4f=_0x290bec['get']({'plain':!![]});return _0x290bec[_0x9459('0x10e')](_0xa9a345[_0x9459('0x6b')][_0x9459('0x70')],_[_0x9459('0x71')](_0xa9a345[_0x9459('0x6b')],[_0x9459('0x70'),'id'])||{})[_0x9459('0x24')](function(){for(var _0x381694=0x0;_0x381694<_0xa9a345[_0x9459('0x6b')][_0x9459('0x70')][_0x9459('0x57')];_0x381694++){var _0x565cc5=[];db[_0x9459('0x10d')][_0x9459('0xbd')]({'where':{'id':_0xa9a345[_0x9459('0x6b')]['ids'][_0x381694]}})[_0x9459('0x24')](function(_0x26cf36){_0x565cc5[_0x9459('0xaa')](_0x26cf36[_0x9459('0xe9')]()[_0x9459('0x24')](function(_0x344fc3){for(var _0x29ea4f=0x0;_0x29ea4f<_0x344fc3[_0x9459('0x57')];_0x29ea4f++){_0x344fc3[_0x29ea4f][_0x9459('0x10f')](_0x9459('0x9d'),_0x9459('0x110'));}return _0x344fc3;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36[_0x9459('0x111')]()[_0x9459('0x24')](function(_0x5529a7){for(var _0x2dcafd=0x0;_0x2dcafd<_0x5529a7[_0x9459('0x57')];_0x2dcafd++){_0x5529a7[_0x2dcafd]['setDataValue']('channel',_0x9459('0x112'));}return _0x5529a7;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36['getMailQueues']()['then'](function(_0x2e114a){for(var _0x39e3d2=0x0;_0x39e3d2<_0x2e114a[_0x9459('0x57')];_0x39e3d2++){_0x2e114a[_0x39e3d2][_0x9459('0x10f')]('channel',_0x9459('0x113'));}return _0x2e114a;}));_0x565cc5['push'](_0x26cf36[_0x9459('0x114')]()['then'](function(_0x2041fb){for(var _0x504451=0x0;_0x504451<_0x2041fb[_0x9459('0x57')];_0x504451++){_0x2041fb[_0x504451][_0x9459('0x10f')](_0x9459('0x9d'),'Sms');}return _0x2041fb;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36[_0x9459('0x115')]()[_0x9459('0x24')](function(_0x4017ff){for(var _0x2b1dca=0x0;_0x2b1dca<_0x4017ff[_0x9459('0x57')];_0x2b1dca++){_0x4017ff[_0x2b1dca]['setDataValue']('channel',_0x9459('0x116'));}return _0x4017ff;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36['getFaxQueues']()['then'](function(_0x40f207){for(var _0x7d70a1=0x0;_0x7d70a1<_0x40f207[_0x9459('0x57')];_0x7d70a1++){_0x40f207[_0x7d70a1][_0x9459('0x10f')](_0x9459('0x9d'),_0x9459('0x117'));}return _0x40f207;}));_0x565cc5[_0x9459('0xaa')](_0x26cf36[_0x9459('0x118')]()[_0x9459('0x24')](function(_0x16b6b6){for(var _0x4cafb7=0x0;_0x4cafb7<_0x16b6b6[_0x9459('0x57')];_0x4cafb7++){_0x16b6b6[_0x4cafb7]['setDataValue'](_0x9459('0x9d'),_0x9459('0x119'));}return _0x16b6b6;}));return BPromise['all'](_0x565cc5);})[_0x9459('0x24')](function(_0x212586){var _0x30cab3=_['flatten'](_0x212586);_0x565cc5=[];return db[_0x9459('0x60')][_0x9459('0x11a')](function(_0x264fbd){for(var _0x2039b9=0x0;_0x2039b9<_0x30cab3['length'];_0x2039b9++){_0x565cc5[_0x9459('0xaa')](_0x30cab3[_0x2039b9][_0x9459('0x11b')](_0x211e4f['id']),{'transaction':_0x264fbd});}return BPromise[_0x9459('0xef')](_0x565cc5)[_0x9459('0x24')](function(){if(_0x211e4f[_0x9459('0x9e')]){return BPromise[_0x9459('0xeb')](_[_0x9459('0x41')](_0x30cab3,function(_0x2ec926){return _0x2ec926['getDataValue'](_0x9459('0x9d'))===_0x9459('0x110');}),function(_0x3a63d4){return db[_0x9459('0xab')][_0x9459('0xec')]({'membername':_0x211e4f[_0x9459('0x49')],'UserId':_0x211e4f['id'],'queue_name':_0x3a63d4['name'],'VoiceQueueId':_0x3a63d4['id'],'interface':_[_0x9459('0x78')](_0x211e4f[_0x9459('0xa1')])?util[_0x9459('0x7a')](_0x9459('0xe0'),_0x211e4f[_0x9459('0x49')]):_0x211e4f[_0x9459('0xa1')],'paused':_0x211e4f['voicePause']||![],'penalty':_0x211e4f[_0x9459('0xa6')]},{'transaction':_0x264fbd});});}else{return;}})[_0x9459('0x24')](function(){for(var _0x1e802b=0x0;_0x1e802b<_0x30cab3[_0x9459('0x57')];_0x1e802b++){var _0x2cfdb0=_0x30cab3[_0x1e802b]['getDataValue'](_0x9459('0x9d'));var _0x18f82a=_0x2cfdb0+_0x9459('0xa7');socket[_0x9459('0xa8')](_0x9459('0x3d')+_0x2cfdb0+'Queue:save',{'UserId':_0x211e4f['id'],['queueField']:_0x30cab3[_0x1e802b]['id']});}});});});}});}})[_0x9459('0x24')](respondWithStatusCode(_0x3ab7b4,null))[_0x9459('0x6c')](handleError(_0x3ab7b4,null));};exports[_0x9459('0x11c')]=function(_0x254aa,_0xc58493){return db[_0x9459('0x64')][_0x9459('0xbd')]({'where':{'id':_0x254aa[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0xc58493,null))['then'](function(_0xafcb60){if(_0xafcb60){var _0x1fc0d5=_0xafcb60[_0x9459('0x3b')]({'plain':!![]});var _0x33c8c4=_0x254aa[_0x9459('0x51')]['ids'];return _0xafcb60[_0x9459('0x11c')](_0x33c8c4)[_0x9459('0x24')](function(){for(var _0x4652aa=0x0;_0x4652aa<_0x33c8c4[_0x9459('0x57')];_0x4652aa++){var _0x5639e4=[];db[_0x9459('0x10d')][_0x9459('0xbd')]({'where':{'id':_0x33c8c4[_0x4652aa]}})[_0x9459('0x24')](function(_0x1aeb2e){_0x5639e4[_0x9459('0xaa')](_0x1aeb2e['getVoiceQueues']()[_0x9459('0x24')](function(_0x29a0f0){for(var _0x4e2b75=0x0;_0x4e2b75<_0x29a0f0[_0x9459('0x57')];_0x4e2b75++){_0x29a0f0[_0x4e2b75][_0x9459('0x10f')](_0x9459('0x9d'),'Voice');}return _0x29a0f0;}));_0x5639e4['push'](_0x1aeb2e[_0x9459('0x111')]()['then'](function(_0xf9f56c){for(var _0x55e0a3=0x0;_0x55e0a3<_0xf9f56c[_0x9459('0x57')];_0x55e0a3++){_0xf9f56c[_0x55e0a3]['setDataValue'](_0x9459('0x9d'),_0x9459('0x112'));}return _0xf9f56c;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e['getMailQueues']()['then'](function(_0x3a8eb){for(var _0x251771=0x0;_0x251771<_0x3a8eb['length'];_0x251771++){_0x3a8eb[_0x251771][_0x9459('0x10f')](_0x9459('0x9d'),_0x9459('0x113'));}return _0x3a8eb;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e[_0x9459('0x114')]()[_0x9459('0x24')](function(_0x3c8513){for(var _0x5a21d5=0x0;_0x5a21d5<_0x3c8513['length'];_0x5a21d5++){_0x3c8513[_0x5a21d5][_0x9459('0x10f')](_0x9459('0x9d'),_0x9459('0x11d'));}return _0x3c8513;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e['getWhatsappQueues']()[_0x9459('0x24')](function(_0x2c3b11){for(var _0x16dc92=0x0;_0x16dc92<_0x2c3b11[_0x9459('0x57')];_0x16dc92++){_0x2c3b11[_0x16dc92]['setDataValue'](_0x9459('0x9d'),_0x9459('0x116'));}return _0x2c3b11;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e[_0x9459('0x11e')]()[_0x9459('0x24')](function(_0x49e27c){for(var _0x152aa4=0x0;_0x152aa4<_0x49e27c[_0x9459('0x57')];_0x152aa4++){_0x49e27c[_0x152aa4]['setDataValue'](_0x9459('0x9d'),_0x9459('0x117'));}return _0x49e27c;}));_0x5639e4[_0x9459('0xaa')](_0x1aeb2e['getOpenchannelQueues']()[_0x9459('0x24')](function(_0x6b16c9){for(var _0x396674=0x0;_0x396674<_0x6b16c9['length'];_0x396674++){_0x6b16c9[_0x396674]['setDataValue'](_0x9459('0x9d'),'Openchannel');}return _0x6b16c9;}));return BPromise[_0x9459('0xef')](_0x5639e4);})[_0x9459('0x24')](function(_0x2b5b8c){var _0x43f7f0=_[_0x9459('0x11f')](_0x2b5b8c);_0x5639e4=[];return db[_0x9459('0x60')][_0x9459('0x11a')](function(_0x568134){for(var _0x131753=0x0;_0x131753<_0x43f7f0[_0x9459('0x57')];_0x131753++){_0x5639e4[_0x9459('0xaa')](_0x43f7f0[_0x131753][_0x9459('0x120')](_0x1fc0d5['id']),{'transaction':_0x568134});}return BPromise['all'](_0x5639e4)[_0x9459('0x24')](function(){if(_0x1fc0d5[_0x9459('0x9e')]){return BPromise['each'](_[_0x9459('0x41')](_0x43f7f0,function(_0x1bc1a6){return _0x1bc1a6[_0x9459('0x121')](_0x9459('0x9d'))===_0x9459('0x110');}),function(_0x231a54){return db[_0x9459('0xab')][_0x9459('0xb1')]({'where':{'VoiceQueueId':_0x231a54['id'],'UserId':_0x1fc0d5['id']},'transaction':_0x568134});});}else{return;}})[_0x9459('0x24')](function(){for(var _0x11a3f2=0x0;_0x11a3f2<_0x43f7f0[_0x9459('0x57')];_0x11a3f2++){var _0x3f9b97=_0x43f7f0[_0x11a3f2][_0x9459('0x121')](_0x9459('0x9d'));var _0x4ab411=_0x3f9b97+_0x9459('0xa7');socket[_0x9459('0xa8')](_0x9459('0x3d')+_0x3f9b97+_0x9459('0xb0'),{'UserId':_0x1fc0d5['id'],['queueField']:_0x43f7f0[_0x11a3f2]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xc58493,null))[_0x9459('0x6c')](handleError(_0xc58493,null));};exports[_0x9459('0x122')]=function(_0x11be21,_0x21600e,_0x2d29ac){var _0x390b95={};var _0x39f0fa={};var _0x25276b;var _0x1b9502;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x11be21[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x21600e,null))[_0x9459('0x24')](function(_0x135562){if(_0x135562){_0x25276b=_0x135562;_0x39f0fa[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0xc0')][_0x9459('0x68')]);_0x39f0fa[_0x9459('0x51')]=_[_0x9459('0x52')](_0x11be21['query']);_0x39f0fa[_0x9459('0x53')]=_[_0x9459('0x55')](_0x39f0fa[_0x9459('0x4f')],_0x39f0fa[_0x9459('0x51')]);_0x390b95[_0x9459('0x54')]=_[_0x9459('0x55')](_0x39f0fa[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x11be21['query'][_0x9459('0x56')]));_0x390b95[_0x9459('0x54')]=_0x390b95[_0x9459('0x54')][_0x9459('0x57')]?_0x390b95[_0x9459('0x54')]:_0x39f0fa['model'];_0x390b95[_0x9459('0x5a')]=qs[_0x9459('0x5b')](_0x11be21[_0x9459('0x51')][_0x9459('0x5b')]);_0x390b95['where']=qs[_0x9459('0x53')](_[_0x9459('0x5d')](_0x11be21[_0x9459('0x51')],_0x39f0fa['filters']));if(_0x11be21[_0x9459('0x51')][_0x9459('0x41')]){_0x390b95[_0x9459('0x5c')]=_['merge'](_0x390b95[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0x390b95['attributes'],function(_0x46da51){var _0x2ecf59={};_0x2ecf59[_0x46da51]={'$like':'%'+_0x11be21[_0x9459('0x51')][_0x9459('0x41')]+'%'};return _0x2ecf59;})});}_0x390b95=_[_0x9459('0x5e')]({},_0x390b95,_0x11be21[_0x9459('0x63')]);return _0x25276b['getLists'](_0x390b95);}})[_0x9459('0x24')](function(_0x41fc34){if(_0x41fc34){_0x1b9502=_0x41fc34[_0x9459('0x57')];if(!_0x11be21['query']['hasOwnProperty'](_0x9459('0x59'))){_0x390b95[_0x9459('0x34')]=qs[_0x9459('0x34')](_0x11be21[_0x9459('0x51')][_0x9459('0x34')]);_0x390b95['offset']=qs[_0x9459('0x33')](_0x11be21[_0x9459('0x51')][_0x9459('0x33')]);}return _0x25276b['getLists'](_0x390b95);}})[_0x9459('0x24')](function(_0x35eb6f){if(_0x35eb6f){return _0x35eb6f?{'count':_0x1b9502,'rows':_0x35eb6f}:null;}})[_0x9459('0x24')](respondWithResult(_0x21600e,null))[_0x9459('0x6c')](handleError(_0x21600e,null));};exports[_0x9459('0x123')]=function(_0x3fa4e9,_0x4aa827,_0x349786){var _0xb9ab0f={};var _0x247678={};var _0x4b9dc3;var _0x103e42;return db['User'][_0x9459('0xbd')]({'where':{'id':_0x3fa4e9[_0x9459('0x6d')]['id']}})[_0x9459('0x24')](handleEntityNotFound(_0x4aa827,null))[_0x9459('0x24')](function(_0x44f842){if(_0x44f842){_0x4b9dc3=_0x44f842;_0x247678[_0x9459('0x4f')]=_[_0x9459('0x52')](db[_0x9459('0x64')]['rawAttributes']);_0x247678[_0x9459('0x51')]=_[_0x9459('0x52')](_0x3fa4e9[_0x9459('0x51')]);_0x247678[_0x9459('0x53')]=_[_0x9459('0x55')](_0x247678[_0x9459('0x4f')],_0x247678[_0x9459('0x51')]);_0xb9ab0f['attributes']=_[_0x9459('0x55')](_0x247678[_0x9459('0x4f')],qs[_0x9459('0x56')](_0x3fa4e9['query'][_0x9459('0x56')]));_0xb9ab0f[_0x9459('0x54')]=_0xb9ab0f[_0x9459('0x54')][_0x9459('0x57')]?_0xb9ab0f['attributes']:_0x247678[_0x9459('0x4f')];_0xb9ab0f['order']=qs[_0x9459('0x5b')](_0x3fa4e9[_0x9459('0x51')][_0x9459('0x5b')]);_0xb9ab0f['where']=qs['filters'](_['pick'](_0x3fa4e9[_0x9459('0x51')],_0x247678['filters']));if(_0x3fa4e9[_0x9459('0x51')]['filter']){_0xb9ab0f[_0x9459('0x5c')]=_[_0x9459('0x5e')](_0xb9ab0f[_0x9459('0x5c')],{'$or':_[_0x9459('0x43')](_0xb9ab0f[_0x9459('0x54')],function(_0x2f9f68){var _0x20df22={};_0x20df22[_0x2f9f68]={'$like':'%'+_0x3fa4e9['query'][_0x9459('0x41')]+'%'};return _0x20df22;})});}_0xb9ab0f[_0x9459('0x4f')]=db[_0x9459('0x64')];_0xb9ab0f['as']=_0x9459('0x3e');_0xb9ab0f=_[_0x9459('0x5e')]({},_0xb9ab0f,_0x3fa4e9[_0x9459('0x63')]);return _0x4b9dc3[_0x9459('0xe9')]({'include':[_0xb9ab0f]});}})['then'](function(_0x16ae6e){if(_0x16ae6e){var _0xd4fc7b={},_0x1474b6=[],_0x4c1d8f=0x0;for(var _0xfa815=0x0;_0xfa815<_0x16ae6e[_0x9459('0x57')];_0xfa815+=0x1){for(var _0xc6a54e=0x0,_0xcff861;_0xc6a54e<_0x16ae6e[_0xfa815]['Agents'][_0x9459('0x57')];_0xc6a54e+=0x1){_0xcff861=_0x16ae6e[_0xfa815][_0x9459('0x3e')][_0xc6a54e]['get']({'plain':!![]});_0xd4fc7b[_0xcff861['id']]=_0xcff861;}}_0xd4fc7b=_[_0x9459('0x124')](_0xd4fc7b);for(var _0x3e10e1=qs['offset'](_0x3fa4e9['query'][_0x9459('0x33')]);_0x3e10e1<_0xd4fc7b['length']&&_0x1474b6['length']=_0x574ca8[_0x5900('0x4f')]){throw new Error(_0x5900('0x50'));}})['then'](function(){if(_0x5a8f0b){return db[_0x5900('0x2b')][_0x5900('0x51')]({'where':{'membername':_0x5a8f0b[_0x5900('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x5a8f0b){return _0x5a8f0b['getVoiceQueues']({'raw':!![]});}})[_0x5900('0x23')](function(_0x48ccc4){if(_0x5a8f0b){if(_0x48ccc4){var _0x404571=[];_0x5c797f=_0x48ccc4;if(_0x5c797f[_0x5900('0x4b')]){for(var _0x4e9dc4=0x0;_0x4e9dc4<_0x5c797f[_0x5900('0x4b')];_0x4e9dc4++){_0x404571[_0x5900('0x48')](db[_0x5900('0x2b')]['upsert']({'membername':_0x5a8f0b[_0x5900('0x27')],'UserId':_0x5a8f0b['id'],'queue_name':_0x5c797f[_0x4e9dc4]['name'],'VoiceQueueId':_0x5c797f[_0x4e9dc4]['id'],'interface':_0x23f1f4,'paused':_0x5a8f0b['loginInPause']||![],'penalty':_0x5c797f[_0x4e9dc4][_0x5900('0x52')]||0x0}));}return BPromise[_0x5900('0x49')](_0x404571);}}}})[_0x5900('0x23')](function(){if(_0x5a8f0b){return db[_0x5900('0x2c')][_0x5900('0x1a')]({'where':{'membername':_0x5a8f0b[_0x5900('0x27')],'exitAt':null}});}})[_0x5900('0x23')](function(_0x5283aa){if(_0x5a8f0b){if(_0x5283aa&&_0x5283aa[_0x5900('0x4b')]){var _0x43ece7=[];_0x5283aa['forEach'](function(_0x52cbb8){_0x43ece7[_0x5900('0x48')](_0x52cbb8[_0x5900('0x3a')]({'exitAt':moment()['format'](_0x5900('0x2f'))}));});return BPromise['all'](_0x43ece7);}}})[_0x5900('0x23')](function(_0xb64cd4){if(_0x5a8f0b){var _0x53a566=[];var _0x155f82=[];var _0x558cec=utils[_0x5900('0x31')]();var _0x1e9bf4={'membername':_0x5a8f0b[_0x5900('0x27')],'interface':_0x23f1f4,'enterAt':moment()['format'](_0x5900('0x2f')),'role':_0x5a8f0b[_0x5900('0x28')],'internal':_0x5a8f0b['internal']};_0x558cec[_0x5900('0x32')](function(_0x137855){_0x53a566[_0x5900('0x48')](_[_0x5900('0x53')]({'channel':_0x137855,'type':_0x5900('0x54'),'data1':_0x5900('0x55'),'data2':_0x23f1f4},_0x1e9bf4));if(_0x5a8f0b[_0x5900('0x56')]){_0x155f82[_0x5900('0x48')](_[_0x5900('0x53')]({'channel':_0x137855,'type':_0x5900('0x2d'),'data1':_0x5900('0x57')},_0x1e9bf4));}});return db[_0x5900('0x2c')][_0x5900('0x39')](_0x53a566[_0x5900('0x58')](_0x155f82),{'individualHooks':!![]});}})['then'](function(){if(_0x5a8f0b){return _0x5a8f0b[_0x5900('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x5900('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5a8f0b[_0x5900('0x56')]||![],'mailPause':_0x5a8f0b[_0x5900('0x56')]||![],'chatPause':_0x5a8f0b[_0x5900('0x56')]||![],'faxPause':_0x5a8f0b[_0x5900('0x56')]||![],'smsPause':_0x5a8f0b[_0x5900('0x56')]||![],'openchannelPause':_0x5a8f0b[_0x5900('0x56')]||![],'pauseType':_0x5a8f0b[_0x5900('0x56')]?_0x5900('0x57'):null,'lastPauseAt':moment()[_0x5900('0x2e')](_0x5900('0x2f')),'interface':_0x23f1f4});}})[_0x5900('0x23')](function(_0x326f9f){_0x2adf2d(_0x326f9f);})[_0x5900('0x24')](function(_0x222c4d){_0x565d1f(_0x551e74[_0x5900('0x14')](0x1f4,_0x222c4d[_0x5900('0x16')]));});});}; \ No newline at end of file +var _0x3fd8=['voice','system','mail','chat','fax','sms','set','%s%s','Pause','push','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetUser','User','findAll','options','raw','where','attributes','include','map','model','ShowUser','find','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','findOne','isValidChannel','Unknown\x20channel','channel'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x3fd8,0x138));var _0x83fd=function(_0x5dee7d,_0x47eb60){_0x5dee7d=_0x5dee7d-0x0;var _0x3ec9ea=_0x3fd8[_0x5dee7d];return _0x3ec9ea;};'use strict';var _=require(_0x83fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x83fd('0x1'));var rs=require(_0x83fd('0x2'));var fs=require('fs');var Redis=require(_0x83fd('0x3'));var db=require(_0x83fd('0x4'))['db'];var utils=require(_0x83fd('0x5'));var logger=require('../../config/logger')(_0x83fd('0x6'));var config=require(_0x83fd('0x7'));var jayson=require(_0x83fd('0x8'));var client=jayson[_0x83fd('0x9')][_0x83fd('0xa')]({'port':0x232a});config[_0x83fd('0xb')]=_[_0x83fd('0xc')](config[_0x83fd('0xb')],{'host':_0x83fd('0xd'),'port':0x18eb});var socket=require(_0x83fd('0xe'))(new Redis(config[_0x83fd('0xb')]));require(_0x83fd('0xf'))[_0x83fd('0x10')](socket);function respondWithRpcPromise(_0xffb425,_0x47d4c6,_0x3ac85e){return new BPromise(function(_0x374d72,_0x1be422){return client[_0x83fd('0x11')](_0xffb425,_0x3ac85e)[_0x83fd('0x12')](function(_0x1f5c5f){logger[_0x83fd('0x13')](_0x83fd('0x14'),_0x47d4c6,_0x83fd('0x15'));logger[_0x83fd('0x16')](_0x83fd('0x17'),_0x47d4c6,_0x83fd('0x15'),JSON['stringify'](_0x1f5c5f));if(_0x1f5c5f[_0x83fd('0x18')]){if(_0x1f5c5f[_0x83fd('0x18')][_0x83fd('0x19')]===0x1f4){logger['error'](_0x83fd('0x14'),_0x47d4c6,_0x1f5c5f[_0x83fd('0x18')][_0x83fd('0x1a')]);return _0x1be422(_0x1f5c5f[_0x83fd('0x18')][_0x83fd('0x1a')]);}logger['error'](_0x83fd('0x14'),_0x47d4c6,_0x1f5c5f[_0x83fd('0x18')][_0x83fd('0x1a')]);return _0x374d72(_0x1f5c5f['error'][_0x83fd('0x1a')]);}else{logger[_0x83fd('0x13')](_0x83fd('0x14'),_0x47d4c6,_0x83fd('0x15'));_0x374d72(_0x1f5c5f[_0x83fd('0x1b')]['message']);}})[_0x83fd('0x1c')](function(_0x920dd0){logger[_0x83fd('0x18')](_0x83fd('0x14'),_0x47d4c6,_0x920dd0);_0x1be422(_0x920dd0);});});}exports[_0x83fd('0x1d')]=function(_0x45b5b1){var _0x3484d3=this;return new Promise(function(_0x2406f2,_0x40ad96){return db[_0x83fd('0x1e')][_0x83fd('0x1f')]({'raw':_0x45b5b1[_0x83fd('0x20')]?_0x45b5b1['options'][_0x83fd('0x21')]===undefined?!![]:![]:!![],'where':_0x45b5b1[_0x83fd('0x20')]?_0x45b5b1[_0x83fd('0x20')][_0x83fd('0x22')]||null:null,'attributes':_0x45b5b1[_0x83fd('0x20')]?_0x45b5b1[_0x83fd('0x20')][_0x83fd('0x23')]||null:null,'limit':_0x45b5b1[_0x83fd('0x20')]?_0x45b5b1['options']['limit']||null:null,'include':_0x45b5b1[_0x83fd('0x20')]?_0x45b5b1['options'][_0x83fd('0x24')]?_[_0x83fd('0x25')](_0x45b5b1[_0x83fd('0x20')]['include'],function(_0x1e27b9){return{'model':db[_0x1e27b9[_0x83fd('0x26')]],'as':_0x1e27b9['as'],'attributes':_0x1e27b9[_0x83fd('0x23')],'include':_0x1e27b9[_0x83fd('0x24')]?_[_0x83fd('0x25')](_0x1e27b9['include'],function(_0x4cedfe){return{'model':db[_0x4cedfe[_0x83fd('0x26')]],'as':_0x4cedfe['as'],'attributes':_0x4cedfe[_0x83fd('0x23')],'include':_0x4cedfe[_0x83fd('0x24')]?_[_0x83fd('0x25')](_0x4cedfe[_0x83fd('0x24')],function(_0x4e0fb0){return{'model':db[_0x4e0fb0[_0x83fd('0x26')]],'as':_0x4e0fb0['as'],'attributes':_0x4e0fb0[_0x83fd('0x23')]};}):[]};}):[]};}):[]:[]})[_0x83fd('0x12')](function(_0xf437e6){logger[_0x83fd('0x13')](_0x83fd('0x1d'),_0x45b5b1);logger[_0x83fd('0x16')](_0x83fd('0x1d'),_0x45b5b1,JSON['stringify'](_0xf437e6));_0x2406f2(_0xf437e6);})['catch'](function(_0x395970){logger[_0x83fd('0x18')](_0x83fd('0x1d'),_0x395970[_0x83fd('0x1a')],_0x45b5b1);_0x40ad96(_0x3484d3[_0x83fd('0x18')](0x1f4,_0x395970[_0x83fd('0x1a')]));});});};exports['ShowUser']=function(_0x1d916e){var _0xab69fc=this;return new Promise(function(_0x24b28e,_0x258d73){return db[_0x83fd('0x1e')]['find']({'raw':_0x1d916e[_0x83fd('0x20')]?_0x1d916e['options'][_0x83fd('0x21')]===undefined?!![]:![]:!![],'where':_0x1d916e[_0x83fd('0x20')]?_0x1d916e['options'][_0x83fd('0x22')]||null:null,'attributes':_0x1d916e['options']?_0x1d916e[_0x83fd('0x20')]['attributes']||null:null,'include':_0x1d916e['options']?_0x1d916e[_0x83fd('0x20')][_0x83fd('0x24')]?_['map'](_0x1d916e['options'][_0x83fd('0x24')],function(_0x173646){return{'model':db[_0x173646[_0x83fd('0x26')]],'as':_0x173646['as'],'attributes':_0x173646['attributes'],'include':_0x173646[_0x83fd('0x24')]?_['map'](_0x173646[_0x83fd('0x24')],function(_0x43dc11){return{'model':db[_0x43dc11[_0x83fd('0x26')]],'as':_0x43dc11['as'],'attributes':_0x43dc11['attributes'],'include':_0x43dc11['include']?_[_0x83fd('0x25')](_0x43dc11['include'],function(_0x2e7b0b){return{'model':db[_0x2e7b0b[_0x83fd('0x26')]],'as':_0x2e7b0b['as'],'attributes':_0x2e7b0b[_0x83fd('0x23')]};}):[]};}):[]};}):[]:[]})[_0x83fd('0x12')](function(_0x5b9b50){logger[_0x83fd('0x13')]('ShowUser',_0x1d916e);logger[_0x83fd('0x16')](_0x83fd('0x27'),_0x1d916e,JSON['stringify'](_0x5b9b50));_0x24b28e(_0x5b9b50);})[_0x83fd('0x1c')](function(_0x422a8d){logger[_0x83fd('0x18')]('ShowUser',_0x422a8d[_0x83fd('0x1a')],_0x1d916e);_0x258d73(_0xab69fc[_0x83fd('0x18')](0x1f4,_0x422a8d[_0x83fd('0x1a')]));});});};exports['PauseUser']=function(_0x572463){var _0x51a769=this;return new Promise(function(_0x535b20,_0x44aa52){var _0x120488;return db['User'][_0x83fd('0x28')]({'where':_0x572463['options'][_0x83fd('0x22')]||{},'attributes':['id',_0x83fd('0x29'),_0x83fd('0x2a'),_0x83fd('0x2b'),_0x83fd('0x2c')]})[_0x83fd('0x12')](function(_0x35067e){if(_0x35067e){_0x120488=_0x35067e;return db[_0x83fd('0x2d')][_0x83fd('0x2e')]({'paused':0x1},{'where':{'UserId':_0x120488['id']},'individualHooks':!![]});}})[_0x83fd('0x12')](function(){if(_0x120488){return db[_0x83fd('0x2f')][_0x83fd('0x1f')]({'where':{'membername':_0x120488[_0x83fd('0x29')],'type':_0x83fd('0x30'),'exitAt':null}});}})[_0x83fd('0x12')](function(_0x4d20c6){if(_0x120488){if(_0x4d20c6&&_0x4d20c6['length']){var _0x653169=moment()[_0x83fd('0x31')](_0x83fd('0x32'));for(var _0x5d81c0=0x0,_0x2358ba=_0x4d20c6[_0x83fd('0x33')];_0x5d81c0<_0x2358ba;_0x5d81c0++){_0x4d20c6[_0x5d81c0][_0x83fd('0x34')]({'exitAt':_0x653169});}}}})[_0x83fd('0x12')](function(){if(_0x120488){var _0x600880=[];var _0x48299a=utils[_0x83fd('0x35')]();_0x48299a[_0x83fd('0x36')](function(_0x4f0f68){_0x600880['push']({'channel':_0x4f0f68,'membername':_0x120488[_0x83fd('0x29')],'interface':_[_0x83fd('0x37')](_0x120488[_0x83fd('0x2c')])?util[_0x83fd('0x31')](_0x83fd('0x38'),_0x120488[_0x83fd('0x29')]):_0x120488[_0x83fd('0x2c')],'type':_0x83fd('0x30'),'enterAt':moment()[_0x83fd('0x31')](_0x83fd('0x32')),'data1':_0x572463[_0x83fd('0x39')][_0x83fd('0x3a')]||_0x83fd('0x3b'),'role':_0x120488[_0x83fd('0x2a')],'internal':_0x120488[_0x83fd('0x2b')],'uniqueid':_0x572463[_0x83fd('0x39')]['uniqueid']||null});});return db[_0x83fd('0x2f')]['bulkCreate'](_0x600880,{'individualHooks':!![]});}})[_0x83fd('0x12')](function(){if(_0x120488){return _0x120488[_0x83fd('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x572463[_0x83fd('0x39')][_0x83fd('0x3a')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x83fd('0x31')](_0x83fd('0x32'))});}})['then'](function(_0x5b970b){_0x535b20(_0x5b970b);})['catch'](function(_0x201675){_0x44aa52(_0x51a769[_0x83fd('0x18')](0x1f4,_0x201675[_0x83fd('0x1a')]));});});};exports['UnpauseUser']=function(_0x15a668){var _0x3f57e7=this;return new Promise(function(_0x1a3ebe,_0x3d8466){var _0x1e391a;return db[_0x83fd('0x1e')][_0x83fd('0x3c')]({'where':_0x15a668[_0x83fd('0x20')][_0x83fd('0x22')]||{},'attributes':['id',_0x83fd('0x29')]})[_0x83fd('0x12')](function(_0x2e8b22){if(_0x2e8b22){_0x1e391a=_0x2e8b22;if(_0x15a668[_0x83fd('0x39')]['channel']&&!utils[_0x83fd('0x3d')](_0x15a668[_0x83fd('0x39')]['channel'])){throw new Error(_0x83fd('0x3e'));}switch(_0x15a668['body'][_0x83fd('0x3f')]){case _0x83fd('0x40'):return db[_0x83fd('0x2d')][_0x83fd('0x2e')]({'paused':0x0},{'where':{'UserId':_0x1e391a['id']}})[_0x83fd('0x12')](function(){return db[_0x83fd('0x2f')]['find']({'where':{'channel':_0x15a668['body'][_0x83fd('0x3f')],'membername':_0x1e391a[_0x83fd('0x29')],'type':_0x83fd('0x30'),'exitAt':null}});})[_0x83fd('0x12')](function(_0x58417e){if(_0x58417e){return _0x58417e[_0x83fd('0x2e')]({'exitAt':moment()[_0x83fd('0x31')](_0x83fd('0x32')),'data2':_0x83fd('0x41')},{'individualHooks':!![]});}return null;})[_0x83fd('0x12')](function(){return _0x1e391a['update']({'voicePause':![]});});case _0x83fd('0x42'):case _0x83fd('0x43'):case _0x83fd('0x44'):case _0x83fd('0x45'):case'openchannel':return db[_0x83fd('0x2f')][_0x83fd('0x28')]({'where':{'channel':_0x15a668[_0x83fd('0x39')][_0x83fd('0x3f')],'membername':_0x1e391a[_0x83fd('0x29')],'type':_0x83fd('0x30'),'exitAt':null}})[_0x83fd('0x12')](function(_0x17537c){return _0x17537c['update']({'exitAt':moment()[_0x83fd('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x83fd('0x41')},{'individualHooks':!![]});})[_0x83fd('0x12')](function(){var _0x5360ec={};_[_0x83fd('0x46')](_0x5360ec,util[_0x83fd('0x31')](_0x83fd('0x47'),_0x15a668[_0x83fd('0x39')][_0x83fd('0x3f')],_0x83fd('0x48')),![]);return _0x1e391a['update'](_0x5360ec);});default:return db['UserVoiceQueueRt'][_0x83fd('0x2e')]({'paused':0x0},{'where':{'UserId':_0x1e391a['id']}})[_0x83fd('0x12')](function(){return db[_0x83fd('0x2f')]['findAll']({'where':{'membername':_0x1e391a['name'],'type':'PAUSE','exitAt':null}});})['then'](function(_0x41514a){var _0x2b5eb6=[];_0x41514a[_0x83fd('0x36')](function(_0x52043b){_0x2b5eb6[_0x83fd('0x49')](_0x52043b['update']({'exitAt':moment()[_0x83fd('0x31')](_0x83fd('0x32')),'data2':_0x83fd('0x41')}));});return BPromise[_0x83fd('0x4a')](_0x2b5eb6);})[_0x83fd('0x12')](function(){return _0x1e391a[_0x83fd('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x83fd('0x12')](function(_0x34a86c){_0x1a3ebe(_0x34a86c);})['catch'](function(_0x29bfe5){_0x3d8466(_0x3f57e7[_0x83fd('0x18')](0x1f4,_0x29bfe5['message']));});});};exports[_0x83fd('0x4b')]=function(_0x416230){var _0x337cc4=this;return new Promise(function(_0x4bb08d,_0x155928){var _0xf06b00;return db[_0x83fd('0x1e')][_0x83fd('0x3c')]({'where':_0x416230[_0x83fd('0x20')]['where']||{},'attributes':['id','name']})['then'](function(_0x1bf5b9){if(_0x1bf5b9){_0xf06b00=_0x1bf5b9;return db[_0x83fd('0x2d')][_0x83fd('0x4c')]({'where':{'membername':_0xf06b00['name']},'individualHooks':!![]});}})[_0x83fd('0x12')](function(){if(_0xf06b00){return db['MemberReport'][_0x83fd('0x1f')]({'where':{'membername':_0xf06b00['name'],'exitAt':null}});}})['then'](function(_0x2d2716){if(_0xf06b00){if(_0x2d2716&&_0x2d2716['length']){var _0x5cde87=[];_0x2d2716['forEach'](function(_0x88153f){_0x5cde87[_0x83fd('0x49')](_0x88153f[_0x83fd('0x2e')]({'exitAt':moment()['format'](_0x83fd('0x32'))}));});return BPromise[_0x83fd('0x4a')](_0x5cde87);}}})[_0x83fd('0x12')](function(){if(_0xf06b00){return _0xf06b00[_0x83fd('0x2e')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x83fd('0x12')](function(_0x11ff76){_0x4bb08d(_0x11ff76);})[_0x83fd('0x1c')](function(_0x39ddc0){_0x155928(_0x337cc4[_0x83fd('0x18')](0x1f4,_0x39ddc0[_0x83fd('0x1a')]));});});};exports[_0x83fd('0x4d')]=function(_0x521aab){var _0x3032aa=this;return new Promise(function(_0x3c9fe6,_0x3360c7){var _0x52695c;var _0x2d450c;var _0x831adc;var _0x12dc18;return db[_0x83fd('0x1e')][_0x83fd('0x3c')]({'where':_0x521aab['options'][_0x83fd('0x22')]||{},'attributes':['id',_0x83fd('0x29'),_0x83fd('0x2a'),_0x83fd('0x4e'),_0x83fd('0x4f'),_0x83fd('0x2b'),_0x83fd('0x50'),_0x83fd('0x2c')]})[_0x83fd('0x12')](function(_0x111685){if(_0x111685){_0x52695c=_0x111685;_0x12dc18=_0x521aab[_0x83fd('0x39')][_0x83fd('0x2c')]?_0x521aab['body'][_0x83fd('0x2c')]:util['format']('SIP/%s',_0x52695c[_0x83fd('0x29')]);return db['User'][_0x83fd('0x51')]({'where':{'role':_0x83fd('0x52'),'online':!![],'id':{'$ne':_0x52695c['id']}}});}})['then'](function(_0x27a93a){if(_0x27a93a){_0x831adc=_0x27a93a;return require(_0x83fd('0x53'))[_0x83fd('0x54')]();}})[_0x83fd('0x12')](function(_0x532fc2){if(_0x532fc2&&_0x532fc2[_0x83fd('0x55')]&&_0x831adc>=_0x532fc2[_0x83fd('0x55')]){throw new Error(_0x83fd('0x56'));}})['then'](function(){if(_0x52695c){return db['UserVoiceQueueRt'][_0x83fd('0x4c')]({'where':{'membername':_0x52695c[_0x83fd('0x29')]},'individualHooks':!![]});}})[_0x83fd('0x12')](function(){if(_0x52695c){return _0x52695c[_0x83fd('0x57')]({'raw':!![]});}})[_0x83fd('0x12')](function(_0x432691){if(_0x52695c){if(_0x432691){var _0x5a0fce=[];_0x2d450c=_0x432691;if(_0x2d450c[_0x83fd('0x33')]){for(var _0x5bc1f4=0x0;_0x5bc1f4<_0x2d450c['length'];_0x5bc1f4++){_0x5a0fce[_0x83fd('0x49')](db[_0x83fd('0x2d')][_0x83fd('0x58')]({'membername':_0x52695c[_0x83fd('0x29')],'UserId':_0x52695c['id'],'queue_name':_0x2d450c[_0x5bc1f4][_0x83fd('0x29')],'VoiceQueueId':_0x2d450c[_0x5bc1f4]['id'],'interface':_0x12dc18,'paused':_0x52695c[_0x83fd('0x50')]||![],'penalty':_0x2d450c[_0x5bc1f4]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x83fd('0x4a')](_0x5a0fce);}}}})[_0x83fd('0x12')](function(){if(_0x52695c){return db[_0x83fd('0x2f')][_0x83fd('0x1f')]({'where':{'membername':_0x52695c[_0x83fd('0x29')],'exitAt':null}});}})[_0x83fd('0x12')](function(_0x5c4715){if(_0x52695c){if(_0x5c4715&&_0x5c4715[_0x83fd('0x33')]){var _0x20fae6=[];_0x5c4715[_0x83fd('0x36')](function(_0x5b9881){_0x20fae6[_0x83fd('0x49')](_0x5b9881[_0x83fd('0x2e')]({'exitAt':moment()[_0x83fd('0x31')](_0x83fd('0x32'))}));});return BPromise['all'](_0x20fae6);}}})['then'](function(_0x1098a5){if(_0x52695c){var _0x4a58be=[];var _0x356bb2=[];var _0x2c7dab=utils[_0x83fd('0x35')]();var _0x396e54={'membername':_0x52695c[_0x83fd('0x29')],'interface':_0x12dc18,'enterAt':moment()['format'](_0x83fd('0x32')),'role':_0x52695c['role'],'internal':_0x52695c[_0x83fd('0x2b')]};_0x2c7dab[_0x83fd('0x36')](function(_0x151b61){_0x4a58be[_0x83fd('0x49')](_[_0x83fd('0x59')]({'channel':_0x151b61,'type':_0x83fd('0x5a'),'data1':_0x83fd('0x5b'),'data2':_0x12dc18},_0x396e54));if(_0x52695c[_0x83fd('0x50')]){_0x356bb2[_0x83fd('0x49')](_['merge']({'channel':_0x151b61,'type':_0x83fd('0x30'),'data1':_0x83fd('0x5c')},_0x396e54));}});return db[_0x83fd('0x2f')]['bulkCreate'](_0x4a58be[_0x83fd('0x5d')](_0x356bb2),{'individualHooks':!![]});}})[_0x83fd('0x12')](function(){if(_0x52695c){return _0x52695c[_0x83fd('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x83fd('0x31')](_0x83fd('0x32')),'voicePause':_0x52695c['loginInPause']||![],'mailPause':_0x52695c[_0x83fd('0x50')]||![],'chatPause':_0x52695c['loginInPause']||![],'faxPause':_0x52695c[_0x83fd('0x50')]||![],'smsPause':_0x52695c['loginInPause']||![],'openchannelPause':_0x52695c[_0x83fd('0x50')]||![],'pauseType':_0x52695c[_0x83fd('0x50')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x83fd('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x12dc18});}})[_0x83fd('0x12')](function(_0x4a480e){_0x3c9fe6(_0x4a480e);})[_0x83fd('0x1c')](function(_0x2d3a89){_0x3360c7(_0x3032aa['error'](0x1f4,_0x2d3a89[_0x83fd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d1efe12..fa073b5 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 _0xcb29=['user:','./user.events','save','remove','update','emit','removeListener','register'];(function(_0x2706bb,_0x148079){var _0xef24d2=function(_0x58bab8){while(--_0x58bab8){_0x2706bb['push'](_0x2706bb['shift']());}};_0xef24d2(++_0x148079);}(_0xcb29,0xa9));var _0x9cb2=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xcb29[_0x39c734];return _0xb2a2f9;};'use strict';var UserEvents=require(_0x9cb2('0x0'));var events=[_0x9cb2('0x1'),_0x9cb2('0x2'),_0x9cb2('0x3')];function createListener(_0x23d86a,_0x3730f3){return function(_0x49e910){_0x3730f3[_0x9cb2('0x4')](_0x23d86a,_0x49e910);};}function removeListener(_0x2bcff0,_0x594749){return function(){UserEvents[_0x9cb2('0x5')](_0x2bcff0,_0x594749);};}exports[_0x9cb2('0x6')]=function(_0x2fff7b){for(var _0x44352b=0x0,_0x149139=events['length'];_0x44352b<_0x149139;_0x44352b++){var _0x57a0d4=events[_0x44352b];var _0x23b5ac=createListener(_0x9cb2('0x7')+_0x57a0d4,_0x2fff7b);UserEvents['on'](_0x57a0d4,_0x23b5ac);}}; \ No newline at end of file +var _0x2c0e=['./user.events','update','emit','removeListener','register','user:'];(function(_0x529419,_0x248ca3){var _0x1f554e=function(_0x34e528){while(--_0x34e528){_0x529419['push'](_0x529419['shift']());}};_0x1f554e(++_0x248ca3);}(_0x2c0e,0xd8));var _0xe2c0=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x2c0e[_0x328534];return _0x2796c0;};'use strict';var UserEvents=require(_0xe2c0('0x0'));var events=['save','remove',_0xe2c0('0x1')];function createListener(_0x55e37b,_0xdf0490){return function(_0x491235){_0xdf0490[_0xe2c0('0x2')](_0x55e37b,_0x491235);};}function removeListener(_0x52d074,_0x38aab3){return function(){UserEvents[_0xe2c0('0x3')](_0x52d074,_0x38aab3);};}exports[_0xe2c0('0x4')]=function(_0x5d65fa){for(var _0x93fcb8=0x0,_0x3fca13=events['length'];_0x93fcb8<_0x3fca13;_0x93fcb8++){var _0x44e666=events[_0x93fcb8];var _0x1a33f8=createListener(_0xe2c0('0x5')+_0x44e666,_0x5d65fa);UserEvents['on'](_0x44e666,_0x1a33f8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 83dbe45..fa147f2 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 _0xc11d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0x814988,_0x49cc27){var _0x336703=function(_0x15272c){while(--_0x15272c){_0x814988['push'](_0x814988['shift']());}};_0x336703(++_0x49cc27);}(_0xc11d,0x163));var _0xdc11=function(_0x5e0544,_0x4c7fa5){_0x5e0544=_0x5e0544-0x0;var _0xf1bb8a=_0xc11d[_0x5e0544];return _0xf1bb8a;};'use strict';var multer=require(_0xdc11('0x0'));var util=require(_0xdc11('0x1'));var path=require(_0xdc11('0x2'));var timeout=require(_0xdc11('0x3'));var express=require(_0xdc11('0x4'));var router=express[_0xdc11('0x5')]();var auth=require(_0xdc11('0x6'));var interaction=require(_0xdc11('0x7'));var config=require(_0xdc11('0x8'));module['exports']=router; \ No newline at end of file +var _0x47e8=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x2c51a7,_0x2339a2){var _0x15e5d2=function(_0x1b4051){while(--_0x1b4051){_0x2c51a7['push'](_0x2c51a7['shift']());}};_0x15e5d2(++_0x2339a2);}(_0x47e8,0xf4));var _0x847e=function(_0x586c70,_0x4a8cb3){_0x586c70=_0x586c70-0x0;var _0x26db79=_0x47e8[_0x586c70];return _0x26db79;};'use strict';var multer=require(_0x847e('0x0'));var util=require(_0x847e('0x1'));var path=require(_0x847e('0x2'));var timeout=require(_0x847e('0x3'));var express=require(_0x847e('0x4'));var router=express['Router']();var auth=require(_0x847e('0x5'));var interaction=require(_0x847e('0x6'));var config=require(_0x847e('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 53a8cc7..82f9b00 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4b1945,_0x48a2bb){var _0x996004=function(_0xaf6276){while(--_0xaf6276){_0x4b1945['push'](_0x4b1945['shift']());}};_0x996004(++_0x48a2bb);}(_0xe706,0xa3));var _0x6e70=function(_0x57746e,_0x45093f){_0x57746e=_0x57746e-0x0;var _0x5caeaa=_0xe706[_0x57746e];return _0x5caeaa;};'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(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 35ad69b..3475b75 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 _0xe08b=['path','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe08b,0xb0));var _0xbe08=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xe08b[_0x295314];return _0x584b0c;};'use strict';var _=require(_0xbe08('0x0'));var util=require(_0xbe08('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbe08('0x2'));var rp=require(_0xbe08('0x3'));var fs=require('fs');var path=require(_0xbe08('0x4'));var rimraf=require(_0xbe08('0x5'));var config=require('../../config/environment');var attributes=require(_0xbe08('0x6'));module['exports']=function(_0x3ae9d7,_0x50aeba){return _0x3ae9d7[_0xbe08('0x7')](_0xbe08('0x8'),attributes,{'tableName':_0xbe08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bd5=['rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','moment','request-promise','path'];(function(_0x3377a4,_0x5c89d1){var _0x1f24fb=function(_0x5f22f6){while(--_0x5f22f6){_0x3377a4['push'](_0x3377a4['shift']());}};_0x1f24fb(++_0x5c89d1);}(_0x9bd5,0xab));var _0x59bd=function(_0x38bd0e,_0x4cc124){_0x38bd0e=_0x38bd0e-0x0;var _0x3d273e=_0x9bd5[_0x38bd0e];return _0x3d273e;};'use strict';var _=require(_0x59bd('0x0'));var util=require(_0x59bd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x59bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x59bd('0x3'));var fs=require('fs');var path=require(_0x59bd('0x4'));var rimraf=require(_0x59bd('0x5'));var config=require(_0x59bd('0x6'));var attributes=require('./userChatQueue.attributes');module[_0x59bd('0x7')]=function(_0x3865e0,_0x34c961){return _0x3865e0[_0x59bd('0x8')](_0x59bd('0x9'),attributes,{'tableName':_0x59bd('0xa'),'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 10195ce..3699883 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 _0x964f=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x3319f8,_0x3bb8db){var _0x3d4fe7=function(_0x3e2b32){while(--_0x3e2b32){_0x3319f8['push'](_0x3319f8['shift']());}};_0x3d4fe7(++_0x3bb8db);}(_0x964f,0x156));var _0xf964=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x964f[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xf964('0x0'));var moment=require(_0xf964('0x1'));var BPromise=require(_0xf964('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf964('0x3'));var db=require(_0xf964('0x4'))['db'];var utils=require(_0xf964('0x5'));var logger=require('../../config/logger')(_0xf964('0x6'));var config=require(_0xf964('0x7'));var jayson=require(_0xf964('0x8'));var client=jayson[_0xf964('0x9')][_0xf964('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e334,_0x29ac9b,_0x4cee06){return new BPromise(function(_0x1b1106,_0x3ce526){return client[_0xf964('0xb')](_0x32e334,_0x4cee06)[_0xf964('0xc')](function(_0x247a5e){logger['info'](_0xf964('0xd'),_0x29ac9b,_0xf964('0xe'));logger[_0xf964('0xf')](_0xf964('0x10'),_0x29ac9b,_0xf964('0xe'),JSON['stringify'](_0x247a5e));if(_0x247a5e[_0xf964('0x11')]){if(_0x247a5e[_0xf964('0x11')][_0xf964('0x12')]===0x1f4){logger[_0xf964('0x11')](_0xf964('0xd'),_0x29ac9b,_0x247a5e['error']['message']);return _0x3ce526(_0x247a5e['error']['message']);}logger[_0xf964('0x11')](_0xf964('0xd'),_0x29ac9b,_0x247a5e[_0xf964('0x11')]['message']);return _0x1b1106(_0x247a5e[_0xf964('0x11')][_0xf964('0x13')]);}else{logger[_0xf964('0x14')](_0xf964('0xd'),_0x29ac9b,_0xf964('0xe'));_0x1b1106(_0x247a5e[_0xf964('0x15')]['message']);}})[_0xf964('0x16')](function(_0x531fbe){logger[_0xf964('0x11')](_0xf964('0xd'),_0x29ac9b,_0x531fbe);_0x3ce526(_0x531fbe);});});} \ No newline at end of file +var _0x85f0=['message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','UserChatQueue,\x20%s,\x20%s'];(function(_0x1977c2,_0x19446a){var _0x1f591c=function(_0x33d69d){while(--_0x33d69d){_0x1977c2['push'](_0x1977c2['shift']());}};_0x1f591c(++_0x19446a);}(_0x85f0,0x137));var _0x085f=function(_0x2b45b5,_0x474458){_0x2b45b5=_0x2b45b5-0x0;var _0x1d9c06=_0x85f0[_0x2b45b5];return _0x1d9c06;};'use strict';var _=require(_0x085f('0x0'));var util=require('util');var moment=require(_0x085f('0x1'));var BPromise=require(_0x085f('0x2'));var rs=require(_0x085f('0x3'));var fs=require('fs');var Redis=require(_0x085f('0x4'));var db=require(_0x085f('0x5'))['db'];var utils=require(_0x085f('0x6'));var logger=require(_0x085f('0x7'))(_0x085f('0x8'));var config=require(_0x085f('0x9'));var jayson=require(_0x085f('0xa'));var client=jayson[_0x085f('0xb')][_0x085f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ce52b,_0x53e358,_0x5ebc68){return new BPromise(function(_0x23ea92,_0x369d3c){return client[_0x085f('0xd')](_0x4ce52b,_0x5ebc68)['then'](function(_0x451bc6){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x53e358,_0x085f('0xe'));logger[_0x085f('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x53e358,'request\x20sent',JSON[_0x085f('0x10')](_0x451bc6));if(_0x451bc6[_0x085f('0x11')]){if(_0x451bc6[_0x085f('0x11')]['code']===0x1f4){logger[_0x085f('0x11')](_0x085f('0x12'),_0x53e358,_0x451bc6[_0x085f('0x11')][_0x085f('0x13')]);return _0x369d3c(_0x451bc6[_0x085f('0x11')][_0x085f('0x13')]);}logger[_0x085f('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x53e358,_0x451bc6[_0x085f('0x11')][_0x085f('0x13')]);return _0x23ea92(_0x451bc6['error'][_0x085f('0x13')]);}else{logger[_0x085f('0x14')](_0x085f('0x12'),_0x53e358,_0x085f('0xe'));_0x23ea92(_0x451bc6[_0x085f('0x15')][_0x085f('0x13')]);}})['catch'](function(_0x7f73f8){logger[_0x085f('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x53e358,_0x7f73f8);_0x369d3c(_0x7f73f8);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index a750785..96dde1a 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 _0x3df6=['connect-timeout','Router','../../config/environment','exports','multer','util','path'];(function(_0x50c15c,_0x5610ea){var _0x57502b=function(_0x412ff9){while(--_0x412ff9){_0x50c15c['push'](_0x50c15c['shift']());}};_0x57502b(++_0x5610ea);}(_0x3df6,0x131));var _0x63df=function(_0x24273c,_0x4e152b){_0x24273c=_0x24273c-0x0;var _0x5edde1=_0x3df6[_0x24273c];return _0x5edde1;};'use strict';var multer=require(_0x63df('0x0'));var util=require(_0x63df('0x1'));var path=require(_0x63df('0x2'));var timeout=require(_0x63df('0x3'));var express=require('express');var router=express[_0x63df('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x63df('0x5'));module[_0x63df('0x6')]=router; \ No newline at end of file +var _0x6296=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x26bb56,_0x5de187){var _0x5688e4=function(_0x1a2f74){while(--_0x1a2f74){_0x26bb56['push'](_0x26bb56['shift']());}};_0x5688e4(++_0x5de187);}(_0x6296,0x169));var _0x6629=function(_0x45fad3,_0x35058){_0x45fad3=_0x45fad3-0x0;var _0x5a9e3f=_0x6296[_0x45fad3];return _0x5a9e3f;};'use strict';var multer=require(_0x6629('0x0'));var util=require('util');var path=require(_0x6629('0x1'));var timeout=require(_0x6629('0x2'));var express=require(_0x6629('0x3'));var router=express[_0x6629('0x4')]();var auth=require(_0x6629('0x5'));var interaction=require(_0x6629('0x6'));var config=require(_0x6629('0x7'));module[_0x6629('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 6c319bb..507b163 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 _0x6e6c=['exports','INTEGER','STRING','sequelize'];(function(_0x13a1f4,_0x50619e){var _0x40e0df=function(_0x577fed){while(--_0x577fed){_0x13a1f4['push'](_0x13a1f4['shift']());}};_0x40e0df(++_0x50619e);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc6e6('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc6e6('0x3')]}}; \ No newline at end of file +var _0x93e9=['sequelize','exports','INTEGER','STRING'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x93e9,0xcc));var _0x993e=function(_0x5bb3f8,_0x5f3bcb){_0x5bb3f8=_0x5bb3f8-0x0;var _0x332911=_0x93e9[_0x5bb3f8];return _0x332911;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'penalty':{'type':Sequelize[_0x993e('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x993e('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x993e('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4053b28..3ea5729 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ddb2,_0x386ec3){_0x3ddb2=_0x3ddb2-0x0;var _0x41cc1f=_0xb10b[_0x3ddb2];return _0x41cc1f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment'];(function(_0x36e7c0,_0x1e143d){var _0x1ba956=function(_0x143ea0){while(--_0x143ea0){_0x36e7c0['push'](_0x36e7c0['shift']());}};_0x1ba956(++_0x1e143d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x565154,_0x189d5e){_0x565154=_0x565154-0x0;var _0x593821=_0x5f2f[_0x565154];return _0x593821;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 84c4901..21f1361 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 _0xfac7=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x598932,_0x34dc46){var _0x5f4142=function(_0x30b091){while(--_0x30b091){_0x598932['push'](_0x598932['shift']());}};_0x5f4142(++_0x34dc46);}(_0xfac7,0x1c9));var _0x7fac=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0xfac7[_0x24f326];return _0x488e2d;};'use strict';var _=require(_0x7fac('0x0'));var util=require(_0x7fac('0x1'));var moment=require(_0x7fac('0x2'));var BPromise=require(_0x7fac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fac('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7fac('0x5'))('rpc');var config=require(_0x7fac('0x6'));var jayson=require(_0x7fac('0x7'));var client=jayson[_0x7fac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x565449,_0x487da8,_0x175a48){return new BPromise(function(_0x40d351,_0x16d52c){return client[_0x7fac('0x9')](_0x565449,_0x175a48)[_0x7fac('0xa')](function(_0x1fc666){logger[_0x7fac('0xb')](_0x7fac('0xc'),_0x487da8,_0x7fac('0xd'));logger[_0x7fac('0xe')](_0x7fac('0xf'),_0x487da8,_0x7fac('0xd'),JSON['stringify'](_0x1fc666));if(_0x1fc666[_0x7fac('0x10')]){if(_0x1fc666[_0x7fac('0x10')][_0x7fac('0x11')]===0x1f4){logger[_0x7fac('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x487da8,_0x1fc666[_0x7fac('0x10')]['message']);return _0x16d52c(_0x1fc666['error'][_0x7fac('0x12')]);}logger['error'](_0x7fac('0xc'),_0x487da8,_0x1fc666['error'][_0x7fac('0x12')]);return _0x40d351(_0x1fc666['error'][_0x7fac('0x12')]);}else{logger[_0x7fac('0xb')](_0x7fac('0xc'),_0x487da8,'request\x20sent');_0x40d351(_0x1fc666[_0x7fac('0x13')][_0x7fac('0x12')]);}})[_0x7fac('0x14')](function(_0x2a0255){logger[_0x7fac('0x10')](_0x7fac('0xc'),_0x487da8,_0x2a0255);_0x16d52c(_0x2a0255);});});} \ No newline at end of file +var _0x9370=['error','code','UserFaxQueue,\x20%s,\x20%s','message','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x138745,_0x2bfc09){var _0x5c2d89=function(_0x2cbd5a){while(--_0x2cbd5a){_0x138745['push'](_0x138745['shift']());}};_0x5c2d89(++_0x2bfc09);}(_0x9370,0x158));var _0x0937=function(_0x29316e,_0x581de7){_0x29316e=_0x29316e-0x0;var _0xa7edf3=_0x9370[_0x29316e];return _0xa7edf3;};'use strict';var _=require('lodash');var util=require(_0x0937('0x0'));var moment=require('moment');var BPromise=require(_0x0937('0x1'));var rs=require(_0x0937('0x2'));var fs=require('fs');var Redis=require(_0x0937('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0937('0x4'));var logger=require(_0x0937('0x5'))(_0x0937('0x6'));var config=require(_0x0937('0x7'));var jayson=require(_0x0937('0x8'));var client=jayson[_0x0937('0x9')][_0x0937('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2102b4,_0x2b1766,_0x238cb0){return new BPromise(function(_0xa2eec9,_0xc03188){return client[_0x0937('0xb')](_0x2102b4,_0x238cb0)[_0x0937('0xc')](function(_0x311e7c){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x2b1766,_0x0937('0xd'));logger['debug'](_0x0937('0xe'),_0x2b1766,_0x0937('0xd'),JSON[_0x0937('0xf')](_0x311e7c));if(_0x311e7c[_0x0937('0x10')]){if(_0x311e7c[_0x0937('0x10')][_0x0937('0x11')]===0x1f4){logger[_0x0937('0x10')](_0x0937('0x12'),_0x2b1766,_0x311e7c['error']['message']);return _0xc03188(_0x311e7c[_0x0937('0x10')]['message']);}logger[_0x0937('0x10')](_0x0937('0x12'),_0x2b1766,_0x311e7c[_0x0937('0x10')][_0x0937('0x13')]);return _0xa2eec9(_0x311e7c['error'][_0x0937('0x13')]);}else{logger['info'](_0x0937('0x12'),_0x2b1766,_0x0937('0xd'));_0xa2eec9(_0x311e7c['result']['message']);}})['catch'](function(_0x4dfcd6){logger['error'](_0x0937('0x12'),_0x2b1766,_0x4dfcd6);_0xc03188(_0x4dfcd6);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 5ee084e..86c434c 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 _0xe3f1=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x301ce1,_0x4ed4e2){var _0x4baf55=function(_0x2d7789){while(--_0x2d7789){_0x301ce1['push'](_0x301ce1['shift']());}};_0x4baf55(++_0x4ed4e2);}(_0xe3f1,0xd3));var _0x1e3f=function(_0x38bc45,_0x29fcd2){_0x38bc45=_0x38bc45-0x0;var _0x2a756a=_0xe3f1[_0x38bc45];return _0x2a756a;};'use strict';var multer=require(_0x1e3f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1e3f('0x1'));var express=require(_0x1e3f('0x2'));var router=express[_0x1e3f('0x3')]();var auth=require(_0x1e3f('0x4'));var interaction=require(_0x1e3f('0x5'));var config=require('../../config/environment');module[_0x1e3f('0x6')]=router; \ No newline at end of file +var _0xd680=['exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x1bdc52,_0x4876a9){var _0xdf3fa3=function(_0x2a3ba4){while(--_0x2a3ba4){_0x1bdc52['push'](_0x1bdc52['shift']());}};_0xdf3fa3(++_0x4876a9);}(_0xd680,0xaf));var _0x0d68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd680[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0d68('0x0'));var util=require('util');var path=require(_0x0d68('0x1'));var timeout=require(_0x0d68('0x2'));var express=require(_0x0d68('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0d68('0x4'));var config=require('../../config/environment');module[_0x0d68('0x5')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 8065ca5..e7b2e08 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x5bb1fa,_0x4989aa){var _0xba07d=function(_0x1576f0){while(--_0x1576f0){_0x5bb1fa['push'](_0x5bb1fa['shift']());}};_0xba07d(++_0x4989aa);}(_0xe706,0xa3));var _0x6e70=function(_0x5172a3,_0x1a1e39){_0x5172a3=_0x5172a3-0x0;var _0x50c69b=_0xe706[_0x5172a3];return _0x50c69b;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index b151f7d..650d914 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4fd255,_0x4e67c9){var _0x55c6cb=function(_0x2ed981){while(--_0x2ed981){_0x4fd255['push'](_0x4fd255['shift']());}};_0x55c6cb(++_0x4e67c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x22a092,_0x186476){var _0x1103c4=function(_0x3a459e){while(--_0x3a459e){_0x22a092['push'](_0x22a092['shift']());}};_0x1103c4(++_0x186476);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 00a90cf..5cff5a7 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 _0x2eb2=['request','then','info','request\x20sent','error','UserMailQueue,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x592704,_0x521b4d){var _0x1083fe=function(_0x2963c0){while(--_0x2963c0){_0x592704['push'](_0x592704['shift']());}};_0x1083fe(++_0x521b4d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x2eb2[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file +var _0x565f=['error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x34572e,_0x570e0a){var _0x267176=function(_0x3a9c46){while(--_0x3a9c46){_0x34572e['push'](_0x34572e['shift']());}};_0x267176(++_0x570e0a);}(_0x565f,0x68));var _0xf565=function(_0x5ca734,_0x41b241){_0x5ca734=_0x5ca734-0x0;var _0x473116=_0x565f[_0x5ca734];return _0x473116;};'use strict';var _=require('lodash');var util=require(_0xf565('0x0'));var moment=require(_0xf565('0x1'));var BPromise=require(_0xf565('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf565('0x3'));var db=require(_0xf565('0x4'))['db'];var utils=require(_0xf565('0x5'));var logger=require(_0xf565('0x6'))(_0xf565('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf565('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cc0ea,_0x2d3b27,_0x45db1b){return new BPromise(function(_0x43b686,_0x55685c){return client[_0xf565('0x9')](_0x4cc0ea,_0x45db1b)['then'](function(_0x35377e){logger['info'](_0xf565('0xa'),_0x2d3b27,_0xf565('0xb'));logger[_0xf565('0xc')](_0xf565('0xd'),_0x2d3b27,_0xf565('0xb'),JSON[_0xf565('0xe')](_0x35377e));if(_0x35377e['error']){if(_0x35377e['error'][_0xf565('0xf')]===0x1f4){logger[_0xf565('0x10')](_0xf565('0xa'),_0x2d3b27,_0x35377e[_0xf565('0x10')][_0xf565('0x11')]);return _0x55685c(_0x35377e[_0xf565('0x10')][_0xf565('0x11')]);}logger[_0xf565('0x10')](_0xf565('0xa'),_0x2d3b27,_0x35377e[_0xf565('0x10')]['message']);return _0x43b686(_0x35377e[_0xf565('0x10')][_0xf565('0x11')]);}else{logger['info'](_0xf565('0xa'),_0x2d3b27,_0xf565('0xb'));_0x43b686(_0x35377e[_0xf565('0x12')][_0xf565('0x11')]);}})[_0xf565('0x13')](function(_0x509ff4){logger[_0xf565('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x2d3b27,_0x509ff4);_0x55685c(_0x509ff4);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 5d713e2..544ff7c 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 _0x0b15=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x365a9a,_0x2ed4a9){var _0xff0e4=function(_0x353b9d){while(--_0x353b9d){_0x365a9a['push'](_0x365a9a['shift']());}};_0xff0e4(++_0x2ed4a9);}(_0x0b15,0x1a2));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x50b1('0x0'));var util=require(_0x50b1('0x1'));var path=require(_0x50b1('0x2'));var timeout=require(_0x50b1('0x3'));var express=require(_0x50b1('0x4'));var router=express[_0x50b1('0x5')]();var auth=require(_0x50b1('0x6'));var interaction=require(_0x50b1('0x7'));var config=require(_0x50b1('0x8'));module[_0x50b1('0x9')]=router; \ No newline at end of file +var _0x0a6f=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x5da324,_0x554ea8){var _0x3daef3=function(_0x4e3488){while(--_0x4e3488){_0x5da324['push'](_0x5da324['shift']());}};_0x3daef3(++_0x554ea8);}(_0x0a6f,0xea));var _0xf0a6=function(_0x4beb7a,_0x246983){_0x4beb7a=_0x4beb7a-0x0;var _0x50c7dd=_0x0a6f[_0x4beb7a];return _0x50c7dd;};'use strict';var multer=require('multer');var util=require(_0xf0a6('0x0'));var path=require(_0xf0a6('0x1'));var timeout=require(_0xf0a6('0x2'));var express=require(_0xf0a6('0x3'));var router=express[_0xf0a6('0x4')]();var auth=require(_0xf0a6('0x5'));var interaction=require(_0xf0a6('0x6'));var config=require(_0xf0a6('0x7'));module[_0xf0a6('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 f2d04de..e5dd54d 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x486dc0,_0x2b4a6f){var _0xd786b1=function(_0x5b422b){while(--_0x5b422b){_0x486dc0['push'](_0x486dc0['shift']());}};_0xd786b1(++_0x2b4a6f);}(_0xe706,0xa3));var _0x6e70=function(_0x54822d,_0xe2a19f){_0x54822d=_0x54822d-0x0;var _0x2f688e=_0xe706[_0x54822d];return _0x2f688e;};'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(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 7d69617..eefd1f5 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 _0xfd00=['moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','api'];(function(_0x4b99d6,_0x4ac49e){var _0x3c5b15=function(_0x34ef85){while(--_0x34ef85){_0x4b99d6['push'](_0x4b99d6['shift']());}};_0x3c5b15(++_0x4ac49e);}(_0xfd00,0xfa));var _0x0fd0=function(_0x33350a,_0x4bd328){_0x33350a=_0x33350a-0x0;var _0x1739b2=_0xfd00[_0x33350a];return _0x1739b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0fd0('0x0'))(_0x0fd0('0x1'));var moment=require(_0x0fd0('0x2'));var BPromise=require(_0x0fd0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fd0('0x4'));var rimraf=require(_0x0fd0('0x5'));var config=require(_0x0fd0('0x6'));var attributes=require(_0x0fd0('0x7'));module[_0x0fd0('0x8')]=function(_0x3f49cc,_0x7919eb){return _0x3f49cc[_0x0fd0('0x9')](_0x0fd0('0xa'),attributes,{'tableName':_0x0fd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x673f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x673f,0x77));var _0xf673=function(_0x2a8079,_0x1ebafd){_0x2a8079=_0x2a8079-0x0;var _0x25e337=_0x673f[_0x2a8079];return _0x25e337;};'use strict';var _=require('lodash');var util=require(_0xf673('0x0'));var logger=require('../../config/logger')(_0xf673('0x1'));var moment=require(_0xf673('0x2'));var BPromise=require(_0xf673('0x3'));var rp=require(_0xf673('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf673('0x5'));var config=require(_0xf673('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xf673('0x7')]=function(_0x3fd386,_0x4020de){return _0x3fd386[_0xf673('0x8')](_0xf673('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 0aec0b8..5ccc9cd 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 _0x0fb8=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19b320,_0x17c4f9){var _0x509fab=function(_0x4362de){while(--_0x4362de){_0x19b320['push'](_0x19b320['shift']());}};_0x509fab(++_0x17c4f9);}(_0x0fb8,0x1d5));var _0x80fb=function(_0x289479,_0x4c742a){_0x289479=_0x289479-0x0;var _0x35fd61=_0x0fb8[_0x289479];return _0x35fd61;};'use strict';var _=require('lodash');var util=require(_0x80fb('0x0'));var moment=require(_0x80fb('0x1'));var BPromise=require(_0x80fb('0x2'));var rs=require(_0x80fb('0x3'));var fs=require('fs');var Redis=require(_0x80fb('0x4'));var db=require(_0x80fb('0x5'))['db'];var utils=require(_0x80fb('0x6'));var logger=require(_0x80fb('0x7'))('rpc');var config=require(_0x80fb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x80fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47875c,_0x1a2f30,_0xa03161){return new BPromise(function(_0x338f84,_0x5c3a8b){return client['request'](_0x47875c,_0xa03161)[_0x80fb('0xa')](function(_0x5c5753){logger[_0x80fb('0xb')](_0x80fb('0xc'),_0x1a2f30,_0x80fb('0xd'));logger[_0x80fb('0xe')](_0x80fb('0xf'),_0x1a2f30,_0x80fb('0xd'),JSON[_0x80fb('0x10')](_0x5c5753));if(_0x5c5753[_0x80fb('0x11')]){if(_0x5c5753[_0x80fb('0x11')][_0x80fb('0x12')]===0x1f4){logger[_0x80fb('0x11')](_0x80fb('0xc'),_0x1a2f30,_0x5c5753[_0x80fb('0x11')][_0x80fb('0x13')]);return _0x5c3a8b(_0x5c5753[_0x80fb('0x11')][_0x80fb('0x13')]);}logger[_0x80fb('0x11')](_0x80fb('0xc'),_0x1a2f30,_0x5c5753[_0x80fb('0x11')]['message']);return _0x338f84(_0x5c5753['error'][_0x80fb('0x13')]);}else{logger['info'](_0x80fb('0xc'),_0x1a2f30,_0x80fb('0xd'));_0x338f84(_0x5c5753[_0x80fb('0x14')][_0x80fb('0x13')]);}})[_0x80fb('0x15')](function(_0x3db79a){logger[_0x80fb('0x11')](_0x80fb('0xc'),_0x1a2f30,_0x3db79a);_0x5c3a8b(_0x3db79a);});});} \ No newline at end of file +var _0x3438=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3438,0x76));var _0x8343=function(_0x2c6065,_0x45c931){_0x2c6065=_0x2c6065-0x0;var _0x2e17e0=_0x3438[_0x2c6065];return _0x2e17e0;};'use strict';var _=require(_0x8343('0x0'));var util=require(_0x8343('0x1'));var moment=require(_0x8343('0x2'));var BPromise=require(_0x8343('0x3'));var rs=require(_0x8343('0x4'));var fs=require('fs');var Redis=require(_0x8343('0x5'));var db=require(_0x8343('0x6'))['db'];var utils=require(_0x8343('0x7'));var logger=require(_0x8343('0x8'))('rpc');var config=require(_0x8343('0x9'));var jayson=require(_0x8343('0xa'));var client=jayson[_0x8343('0xb')][_0x8343('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54d201,_0x3778ce,_0x1a908f){return new BPromise(function(_0x4107a4,_0x2053f5){return client[_0x8343('0xd')](_0x54d201,_0x1a908f)[_0x8343('0xe')](function(_0x4e47be){logger[_0x8343('0xf')](_0x8343('0x10'),_0x3778ce,_0x8343('0x11'));logger['debug'](_0x8343('0x12'),_0x3778ce,_0x8343('0x11'),JSON[_0x8343('0x13')](_0x4e47be));if(_0x4e47be[_0x8343('0x14')]){if(_0x4e47be['error'][_0x8343('0x15')]===0x1f4){logger['error'](_0x8343('0x10'),_0x3778ce,_0x4e47be[_0x8343('0x14')][_0x8343('0x16')]);return _0x2053f5(_0x4e47be['error'][_0x8343('0x16')]);}logger[_0x8343('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3778ce,_0x4e47be[_0x8343('0x14')][_0x8343('0x16')]);return _0x4107a4(_0x4e47be[_0x8343('0x14')]['message']);}else{logger[_0x8343('0xf')](_0x8343('0x10'),_0x3778ce,'request\x20sent');_0x4107a4(_0x4e47be[_0x8343('0x17')][_0x8343('0x16')]);}})[_0x8343('0x18')](function(_0x40de1d){logger[_0x8343('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3778ce,_0x40de1d);_0x2053f5(_0x40de1d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 94795b4..74bff3d 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 _0x1981=['/:id/clone','clone','/:id/sections','addSections','addResources','put','delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','create','post'];(function(_0x3e9030,_0x16c384){var _0x526b49=function(_0x3228fe){while(--_0x3228fe){_0x3e9030['push'](_0x3e9030['shift']());}};_0x526b49(++_0x16c384);}(_0x1981,0xf3));var _0x1198=function(_0x40b2ed,_0x2b1765){_0x40b2ed=_0x40b2ed-0x0;var _0x18397d=_0x1981[_0x40b2ed];return _0x18397d;};'use strict';var multer=require(_0x1198('0x0'));var util=require('util');var path=require(_0x1198('0x1'));var timeout=require(_0x1198('0x2'));var express=require('express');var router=express[_0x1198('0x3')]();var auth=require(_0x1198('0x4'));var interaction=require(_0x1198('0x5'));var config=require(_0x1198('0x6'));var controller=require('./userProfile.controller');router[_0x1198('0x7')]('/',auth[_0x1198('0x8')](),controller[_0x1198('0x9')]);router[_0x1198('0x7')](_0x1198('0xa'),auth['isAuthenticated'](),controller[_0x1198('0xb')]);router[_0x1198('0x7')](_0x1198('0xc'),auth['isAuthenticated'](),controller[_0x1198('0xd')]);router[_0x1198('0x7')]('/:id/sections',auth[_0x1198('0x8')](),controller[_0x1198('0xe')]);router[_0x1198('0x7')](_0x1198('0xf'),auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x1198('0x8')](),controller[_0x1198('0x10')]);router[_0x1198('0x11')](_0x1198('0x12'),auth[_0x1198('0x8')](),controller[_0x1198('0x13')]);router[_0x1198('0x11')](_0x1198('0x14'),auth[_0x1198('0x8')](),controller[_0x1198('0x15')]);router[_0x1198('0x11')](_0x1198('0xf'),auth[_0x1198('0x8')](),controller[_0x1198('0x16')]);router[_0x1198('0x17')]('/:id',auth[_0x1198('0x8')](),controller['update']);router[_0x1198('0x18')](_0x1198('0xc'),auth[_0x1198('0x8')](),controller[_0x1198('0x19')]);router[_0x1198('0x18')](_0x1198('0x14'),auth[_0x1198('0x8')](),controller[_0x1198('0x1a')]);router[_0x1198('0x18')]('/:id/resources',auth[_0x1198('0x8')](),controller[_0x1198('0x1b')]);module[_0x1198('0x1c')]=router; \ No newline at end of file +var _0xfe23=['update','delete','destroy','removeSections','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','isAuthenticated','describe','/:id/sections','getSections','/:id/resources','getResources','create','/:id/clone','post','addResources','/:id'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xfe23,0x19a));var _0x3fe2=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xfe23[_0x33032e];return _0x13316b;};'use strict';var multer=require('multer');var util=require(_0x3fe2('0x0'));var path=require(_0x3fe2('0x1'));var timeout=require(_0x3fe2('0x2'));var express=require(_0x3fe2('0x3'));var router=express[_0x3fe2('0x4')]();var auth=require(_0x3fe2('0x5'));var interaction=require(_0x3fe2('0x6'));var config=require(_0x3fe2('0x7'));var controller=require(_0x3fe2('0x8'));router[_0x3fe2('0x9')]('/',auth['isAuthenticated'](),controller[_0x3fe2('0xa')]);router[_0x3fe2('0x9')]('/describe',auth[_0x3fe2('0xb')](),controller[_0x3fe2('0xc')]);router[_0x3fe2('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3fe2('0x9')](_0x3fe2('0xd'),auth['isAuthenticated'](),controller[_0x3fe2('0xe')]);router[_0x3fe2('0x9')](_0x3fe2('0xf'),auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x10')]);router['post']('/',auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x11')]);router['post'](_0x3fe2('0x12'),auth['isAuthenticated'](),controller['clone']);router['post']('/:id/sections',auth[_0x3fe2('0xb')](),controller['addSections']);router[_0x3fe2('0x13')](_0x3fe2('0xf'),auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x14')]);router['put'](_0x3fe2('0x15'),auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x16')]);router[_0x3fe2('0x17')]('/:id',auth[_0x3fe2('0xb')](),controller[_0x3fe2('0x18')]);router['delete'](_0x3fe2('0xd'),auth['isAuthenticated'](),controller[_0x3fe2('0x19')]);router[_0x3fe2('0x17')](_0x3fe2('0xf'),auth['isAuthenticated'](),controller['removeResources']);module[_0x3fe2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index f84c730..076c257 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 _0x1f93=['getDataValue','split','sequelize','name','STRING','setDataValue','crudPermissions','join'];(function(_0x630b91,_0x466bcb){var _0x3e16bc=function(_0x57c878){while(--_0x57c878){_0x630b91['push'](_0x630b91['shift']());}};_0x3e16bc(++_0x466bcb);}(_0x1f93,0x112));var _0x31f9=function(_0x2403b0,_0x53207c){_0x2403b0=_0x2403b0-0x0;var _0x2a6db7=_0x1f93[_0x2403b0];return _0x2a6db7;};'use strict';var Sequelize=require(_0x31f9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x31f9('0x1')},'crudPermissions':{'type':Sequelize[_0x31f9('0x2')],'set':function(_0x1a0726){this[_0x31f9('0x3')](_0x31f9('0x4'),_0x1a0726?_0x1a0726[_0x31f9('0x5')](''):[]);},'get':function(){return this[_0x31f9('0x6')]('crudPermissions')?this['getDataValue'](_0x31f9('0x4'))[_0x31f9('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x31f9('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xfde3=['exports','STRING','name','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x103cd1,_0x51ea6b){var _0x3e3bfc=function(_0x381bd6){while(--_0x381bd6){_0x103cd1['push'](_0x103cd1['shift']());}};_0x3e3bfc(++_0x51ea6b);}(_0xfde3,0x19f));var _0x3fde=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfde3[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x3fde('0x0'));module[_0x3fde('0x1')]={'name':{'type':Sequelize[_0x3fde('0x2')],'allowNull':![],'unique':_0x3fde('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1a82bc){this[_0x3fde('0x4')](_0x3fde('0x5'),_0x1a82bc?_0x1a82bc['join'](''):[]);},'get':function(){return this[_0x3fde('0x6')]('crudPermissions')?this['getDataValue'](_0x3fde('0x5'))[_0x3fde('0x7')](''):[];},'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 bd9e153..0a2b8c6 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 _0x67f7=['mergeResources','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','childModel','key','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','tag','ThroughTags','color','value','toLowerCase','squareprojects','SquareProject','odbc','SquareRecording','SquareProjects','JscriptyProject','contacts','Lists','ListId','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Interval','pauses','Pause','scheduler','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','Plugin','extractedreports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','UserProfile','rawAttributes','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','clone','get','createdAt','updatedAt','crudPermissions','omit','sequelize','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','addSections','transaction','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','getResources','section','undefined','Sequelize'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0x67f7,0x16d));var _0x767f=function(_0x1ac27e,_0x95a2f6){_0x1ac27e=_0x1ac27e-0x0;var _0x59e9ff=_0x67f7[_0x1ac27e];return _0x59e9ff;};'use strict';var pdf=require(_0x767f('0x0'));var emlformat=require(_0x767f('0x1'));var rimraf=require(_0x767f('0x2'));var zipdir=require(_0x767f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x767f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x767f('0x5'));var util=require(_0x767f('0x6'));var path=require(_0x767f('0x7'));var sox=require(_0x767f('0x8'));var csv=require('to-csv');var ejs=require(_0x767f('0x9'));var fs=require('fs');var _=require(_0x767f('0xa'));var squel=require(_0x767f('0xb'));var crypto=require(_0x767f('0xc'));var jsforce=require(_0x767f('0xd'));var deskjs=require(_0x767f('0xe'));var toCsv=require(_0x767f('0xf'));var querystring=require('querystring');var Papa=require(_0x767f('0x10'));var Redis=require(_0x767f('0x11'));var authService=require(_0x767f('0x12'));var qs=require(_0x767f('0x13'));var as=require(_0x767f('0x14'));var hardwareService=require(_0x767f('0x15'));var logger=require(_0x767f('0x16'))(_0x767f('0x17'));var utils=require(_0x767f('0x18'));var config=require(_0x767f('0x19'));var db=require(_0x767f('0x1a'))['db'];config[_0x767f('0x1b')]=_['defaults'](config[_0x767f('0x1b')],{'host':_0x767f('0x1c'),'port':0x18eb});var socket=require(_0x767f('0x1d'))(new Redis(config[_0x767f('0x1b')]));require(_0x767f('0x1e'))['register'](socket);function respondWithStatusCode(_0x2c1f37,_0x4919b2){_0x4919b2=_0x4919b2||0xcc;return function(_0x31c64b){if(_0x31c64b){return _0x2c1f37[_0x767f('0x1f')](_0x4919b2);}return _0x2c1f37[_0x767f('0x20')](_0x4919b2)[_0x767f('0x21')]();};}function respondWithResult(_0x43a3c5,_0x62fde0){_0x62fde0=_0x62fde0||0xc8;return function(_0x74dc13){if(_0x74dc13){return _0x43a3c5[_0x767f('0x20')](_0x62fde0)[_0x767f('0x22')](_0x74dc13);}};}function respondWithFilteredResult(_0x202227,_0xa739b0){return function(_0x234078){if(_0x234078){var _0x28f18b=_0x234078['count'],_0x7d6945=_0xa739b0[_0x767f('0x23')],_0x54ba9d=_0xa739b0[_0x767f('0x23')]+_0xa739b0[_0x767f('0x24')],_0x4585cf;if(_0x54ba9d>=_0x28f18b){_0x54ba9d=_0x28f18b;_0x4585cf=0xc8;}else{_0x4585cf=0xce;}_0x202227['status'](_0x4585cf);return _0x202227[_0x767f('0x25')](_0x767f('0x26'),_0x7d6945+'-'+_0x54ba9d+'/'+_0x28f18b)[_0x767f('0x22')](_0x234078);}return null;};}function patchUpdates(_0x1687b2){return function(_0x50d876){try{jsonpatch[_0x767f('0x27')](_0x50d876,_0x1687b2,!![]);}catch(_0x155d07){return BPromise[_0x767f('0x28')](_0x155d07);}return _0x50d876['save']();};}function saveUpdates(_0x5012c3,_0x38344a){return function(_0x4fee58){if(_0x4fee58){return _0x4fee58[_0x767f('0x29')](_0x5012c3)['then'](function(_0x5c6d48){return _0x5c6d48;});}return null;};}function removeEntity(_0x57d9d5,_0x51a2bc){return function(_0x12f4e7){if(_0x12f4e7){return _0x12f4e7[_0x767f('0x2a')]()[_0x767f('0x2b')](function(){_0x57d9d5['status'](0xcc)[_0x767f('0x21')]();});}};}function handleEntityNotFound(_0x1b5735,_0x165778){return function(_0x1c6aab){if(!_0x1c6aab){_0x1b5735[_0x767f('0x1f')](0x194);}return _0x1c6aab;};}function handleError(_0x44aa5e,_0x3d5dce){_0x3d5dce=_0x3d5dce||0x1f4;return function(_0x3deec3){logger[_0x767f('0x2c')](_0x3deec3[_0x767f('0x2d')]);if(_0x3deec3[_0x767f('0x2e')]){delete _0x3deec3['name'];}_0x44aa5e[_0x767f('0x20')](_0x3d5dce)[_0x767f('0x2f')](_0x3deec3);};}exports[_0x767f('0x30')]=function(_0x3286e6,_0x30b59d){var _0x36ad64={},_0x1e5518={},_0xf722a9={'count':0x0,'rows':[]};var _0x178282=_['map'](db[_0x767f('0x31')][_0x767f('0x32')],function(_0x2feafc){return{'name':_0x2feafc['fieldName'],'type':_0x2feafc['type']['key']};});_0x1e5518[_0x767f('0x33')]=_[_0x767f('0x34')](_0x178282,_0x767f('0x2e'));_0x1e5518[_0x767f('0x35')]=_['keys'](_0x3286e6[_0x767f('0x35')]);_0x1e5518[_0x767f('0x36')]=_[_0x767f('0x37')](_0x1e5518[_0x767f('0x33')],_0x1e5518[_0x767f('0x35')]);_0x36ad64[_0x767f('0x38')]=_[_0x767f('0x37')](_0x1e5518[_0x767f('0x33')],qs[_0x767f('0x39')](_0x3286e6[_0x767f('0x35')][_0x767f('0x39')]));_0x36ad64['attributes']=_0x36ad64[_0x767f('0x38')]['length']?_0x36ad64[_0x767f('0x38')]:_0x1e5518['model'];if(!_0x3286e6['query'][_0x767f('0x3a')](_0x767f('0x3b'))){_0x36ad64[_0x767f('0x24')]=qs['limit'](_0x3286e6[_0x767f('0x35')][_0x767f('0x24')]);_0x36ad64['offset']=qs[_0x767f('0x23')](_0x3286e6['query']['offset']);}_0x36ad64['order']=qs['sort'](_0x3286e6[_0x767f('0x35')][_0x767f('0x3c')]);_0x36ad64[_0x767f('0x3d')]=qs['filters'](_[_0x767f('0x3e')](_0x3286e6[_0x767f('0x35')],_0x1e5518[_0x767f('0x36')]),_0x178282);if(_0x3286e6[_0x767f('0x35')][_0x767f('0x3f')]){_0x36ad64[_0x767f('0x3d')]=_[_0x767f('0x40')](_0x36ad64[_0x767f('0x3d')],{'$or':_[_0x767f('0x34')](_0x178282,function(_0xb9911f){if(_0xb9911f[_0x767f('0x41')]!=='VIRTUAL'){var _0x55d539={};_0x55d539[_0xb9911f[_0x767f('0x2e')]]={'$like':'%'+_0x3286e6[_0x767f('0x35')]['filter']+'%'};return _0x55d539;}})});}_0x36ad64=_[_0x767f('0x40')]({},_0x36ad64,_0x3286e6[_0x767f('0x42')]);var _0x10e30d={'where':_0x36ad64['where']};return db[_0x767f('0x31')][_0x767f('0x43')](_0x10e30d)['then'](function(_0x69f7ab){_0xf722a9[_0x767f('0x43')]=_0x69f7ab;if(_0x3286e6[_0x767f('0x35')][_0x767f('0x44')]){_0x36ad64[_0x767f('0x45')]=[{'all':!![]}];}return db[_0x767f('0x31')][_0x767f('0x46')](_0x36ad64);})[_0x767f('0x2b')](function(_0x22ca03){_0xf722a9[_0x767f('0x47')]=_0x22ca03;return _0xf722a9;})['then'](respondWithFilteredResult(_0x30b59d,_0x36ad64))[_0x767f('0x48')](handleError(_0x30b59d,null));};exports['show']=function(_0x41328b,_0x27d20c){var _0x2f1e6b={'raw':![],'where':{'id':_0x41328b[_0x767f('0x49')]['id']}},_0x9ff7ad={};_0x9ff7ad['model']=_['keys'](db[_0x767f('0x31')]['rawAttributes']);_0x9ff7ad[_0x767f('0x35')]=_[_0x767f('0x4a')](_0x41328b[_0x767f('0x35')]);_0x9ff7ad[_0x767f('0x36')]=_[_0x767f('0x37')](_0x9ff7ad['model'],_0x9ff7ad[_0x767f('0x35')]);_0x2f1e6b[_0x767f('0x38')]=_['intersection'](_0x9ff7ad[_0x767f('0x33')],qs[_0x767f('0x39')](_0x41328b[_0x767f('0x35')][_0x767f('0x39')]));_0x2f1e6b[_0x767f('0x38')]=_0x2f1e6b[_0x767f('0x38')][_0x767f('0x4b')]?_0x2f1e6b[_0x767f('0x38')]:_0x9ff7ad[_0x767f('0x33')];if(_0x41328b[_0x767f('0x35')][_0x767f('0x44')]){_0x2f1e6b[_0x767f('0x45')]=[{'all':!![]}];}_0x2f1e6b=_['merge']({},_0x2f1e6b,_0x41328b[_0x767f('0x42')]);return db['UserProfile'][_0x767f('0x4c')](_0x2f1e6b)[_0x767f('0x2b')](handleEntityNotFound(_0x27d20c,null))['then'](respondWithResult(_0x27d20c,null))['catch'](handleError(_0x27d20c,null));};exports[_0x767f('0x4d')]=function(_0x30b319,_0x51f003){return db[_0x767f('0x31')][_0x767f('0x4d')](_0x30b319[_0x767f('0x4e')],{})[_0x767f('0x2b')](respondWithResult(_0x51f003,0xc9))[_0x767f('0x48')](handleError(_0x51f003,null));};exports[_0x767f('0x4f')]=function(_0x3726b9,_0x2989a6){var _0x3d77d9={'where':{'id':_0x3726b9[_0x767f('0x49')]['id']}},_0xbd4a39={};_0xbd4a39[_0x767f('0x33')]=_['keys'](db['UserProfile'][_0x767f('0x32')]);_0x3d77d9[_0x767f('0x38')]=_[_0x767f('0x37')](_0xbd4a39[_0x767f('0x33')],qs[_0x767f('0x39')](_0x3726b9[_0x767f('0x35')][_0x767f('0x39')]));_0x3d77d9[_0x767f('0x38')]=_0x3d77d9[_0x767f('0x38')][_0x767f('0x4b')]?_0x3d77d9[_0x767f('0x38')]:_0xbd4a39[_0x767f('0x33')];if(_0x3726b9[_0x767f('0x35')][_0x767f('0x44')]){_0x3d77d9[_0x767f('0x45')]=[{'all':!![]}];}_0x3d77d9=_[_0x767f('0x40')]({},_0x3d77d9,_0x3726b9['options']);return db[_0x767f('0x31')][_0x767f('0x4c')](_0x3d77d9)[_0x767f('0x2b')](handleEntityNotFound(_0x2989a6,null))['then'](function(_0x1fce49){if(_0x1fce49){var _0x45c30d=_0x1fce49[_0x767f('0x50')]({'plain':!![]});_0x45c30d=qs['omit'](_0x45c30d,['id',_0x767f('0x51'),_0x767f('0x52'),_0x767f('0x53')]);_0x3726b9[_0x767f('0x4e')]=_[_0x767f('0x54')](_0x3726b9[_0x767f('0x4e')],['id','createdAt',_0x767f('0x52')]);return db[_0x767f('0x55')]['transaction'](function(_0x219a76){return db[_0x767f('0x31')][_0x767f('0x4d')](_[_0x767f('0x40')](_0x45c30d,_0x3726b9[_0x767f('0x4e')]),{'include':_0x3726b9[_0x767f('0x35')][_0x767f('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x219a76})['then'](function(_0xb38b3c){var _0x5905bd=_0xb38b3c[_0x767f('0x50')]({'plain':!![]});return db[_0x767f('0x56')][_0x767f('0x46')]({'where':{'userProfileId':_0x3726b9[_0x767f('0x49')]['id']},'raw':!![]})['then'](function(_0x2511a8){if(_0x2511a8){return BPromise[_0x767f('0x57')](_0x2511a8,function(_0x30d9e5){return new BPromise(function(_0x4ca347,_0xb345b6){if(_0x30d9e5['autoAssociation']===null||_0x30d9e5[_0x767f('0x58')]===0x1)_0x4ca347(null);return db['UserProfileResource'][_0x767f('0x46')]({'where':{'sectionId':_0x30d9e5['id']},'raw':!![]})['then'](function(_0x28c299){var _0x4c99f7=_[_0x767f('0x34')](_0x28c299,function(_0xa86782){return qs[_0x767f('0x54')](_0xa86782,['id',_0x767f('0x51'),'updatedAt',_0x767f('0x59')]);});_0x4ca347(_0x4c99f7);})['catch'](function(_0x2b6987){_0xb345b6(_0x2b6987);});})[_0x767f('0x2b')](function(_0x16f65d){var _0x1d88ca=qs['omit'](_0x30d9e5,['id','createdAt',_0x767f('0x52')]);_0x1d88ca[_0x767f('0x5a')]=_0x5905bd['id'];if(_0x16f65d)_0x1d88ca[_0x767f('0x5b')]=_0x16f65d;return _0x1d88ca;})['then'](function(_0x179379){return db[_0x767f('0x56')][_0x767f('0x4d')](_0x179379,{'include':[{'model':db[_0x767f('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x219a76});});})['then'](function(){return _0x5905bd;});}});});});}})[_0x767f('0x2b')](respondWithResult(_0x2989a6,0xc9))[_0x767f('0x48')](handleError(_0x2989a6,null));};exports[_0x767f('0x29')]=function(_0xfce106,_0x324d4e){if(_0xfce106['body']['id']){delete _0xfce106[_0x767f('0x4e')]['id'];}return db[_0x767f('0x31')][_0x767f('0x4c')]({'where':{'id':_0xfce106[_0x767f('0x49')]['id']}})[_0x767f('0x2b')](handleEntityNotFound(_0x324d4e,null))[_0x767f('0x2b')](saveUpdates(_0xfce106[_0x767f('0x4e')],null))[_0x767f('0x2b')](respondWithResult(_0x324d4e,null))[_0x767f('0x48')](handleError(_0x324d4e,null));};exports[_0x767f('0x2a')]=function(_0x3f9d5c,_0x3cd052){return db[_0x767f('0x31')]['find']({'where':{'id':_0x3f9d5c[_0x767f('0x49')]['id']}})[_0x767f('0x2b')](handleEntityNotFound(_0x3cd052,null))['then'](removeEntity(_0x3cd052,null))[_0x767f('0x48')](handleError(_0x3cd052,null));};exports['describe']=function(_0x3cc91f,_0x11cc06){return db[_0x767f('0x31')]['describe']()[_0x767f('0x2b')](respondWithResult(_0x11cc06,null))['catch'](handleError(_0x11cc06,null));};exports[_0x767f('0x5d')]=function(_0x2580cf,_0x2a0f03){var _0x459c36=_0x2580cf[_0x767f('0x4e')];return db[_0x767f('0x31')][_0x767f('0x4c')]({'where':{'id':_0x2580cf['params']['id']}})['then'](handleEntityNotFound(_0x2a0f03,null))[_0x767f('0x2b')](function(_0x32df2a){if(_0x32df2a){return db[_0x767f('0x55')][_0x767f('0x5e')](function(_0x12679b){return db[_0x767f('0x56')]['destroy']({'where':{'userProfileId':_0x2580cf['params']['id'],'sectionId':_['map'](_0x459c36,function(_0x111292){return _0x111292['sectionId'];})},'transaction':_0x12679b})['then'](function(){var _0x28b998=_[_0x767f('0x34')](_0x459c36,function(_0x1b34e8){_0x1b34e8['userProfileId']=_0x2580cf[_0x767f('0x49')]['id'];return _0x1b34e8;});var _0x3ecdd5=[];return BPromise['each'](_0x28b998,function(_0x34b628){return db['UserProfileSection'][_0x767f('0x4d')](_0x34b628,{'include':[{'model':db[_0x767f('0x5c')],'as':_0x767f('0x5b')}],'raw':!![],'transaction':_0x12679b})[_0x767f('0x2b')](function(_0xcdaa94){_0x3ecdd5[_0x767f('0x5f')](_0xcdaa94[_0x767f('0x50')]({'plain':!![]}));});})[_0x767f('0x2b')](function(){return _0x3ecdd5;});});});}})[_0x767f('0x2b')](function(_0xe75908){return _0xe75908;})[_0x767f('0x2b')](respondWithResult(_0x2a0f03,null))[_0x767f('0x48')](handleError(_0x2a0f03,null));};exports[_0x767f('0x60')]=function(_0x1d058f,_0x4883df){var _0xa69325;return db[_0x767f('0x31')][_0x767f('0x4c')]({'where':{'id':_0x1d058f[_0x767f('0x49')]['id']},'attributes':['id',_0x767f('0x2e')]})[_0x767f('0x2b')](handleEntityNotFound(_0x4883df,null))[_0x767f('0x2b')](function(_0x2ee2f8){if(_0x2ee2f8){_0xa69325=_0x2ee2f8;return db[_0x767f('0x56')][_0x767f('0x2a')]({'where':{'userProfileId':_0x1d058f[_0x767f('0x49')]['id'],'sectionId':_0x1d058f[_0x767f('0x35')][_0x767f('0x61')]}});}})[_0x767f('0x2b')](function(){return _0xa69325;})[_0x767f('0x2b')](respondWithStatusCode(_0x4883df,null))['catch'](handleError(_0x4883df,null));};exports[_0x767f('0x62')]=function(_0x395ede,_0x28706f){var _0x111c2b=[];var _0x1a7d47=[];return db[_0x767f('0x56')]['findAll']({'where':{'userProfileId':_0x395ede[_0x767f('0x49')]['id']},'raw':!![]})[_0x767f('0x2b')](function(_0x5a0c5d){_0x111c2b=_[_0x767f('0x3f')](_0x5a0c5d,function(_0x4faa02){return _0x4faa02[_0x767f('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x4faa02[_0x767f('0x59')]);});if(!_[_0x767f('0x64')](_0x111c2b)){return _[_0x767f('0x34')](_0x111c2b,function(_0x2227e5){return _0x2227e5[_0x767f('0x59')];});}else{return;}})[_0x767f('0x2b')](function(_0x16827c){if(_0x16827c)_0x1a7d47=_0x16827c;if(_[_0x767f('0x65')](_0x1a7d47,0x64)){var _0x1cde26=_[_0x767f('0x4c')](_0x111c2b,{'sectionId':0x64});return hasDefaultDashboard(_0x1cde26)[_0x767f('0x2b')](function(_0x5c0334){return _['map'](_0x111c2b,function(_0x5725c2){if(_0x5725c2[_0x767f('0x59')]===0x64){_0x5725c2[_0x767f('0x66')]=_0x5c0334;}return _0x5725c2;});});}else{return;}})['then'](function(_0x433520){if(_0x433520)_0x111c2b=_0x433520;if(_[_0x767f('0x65')](_0x1a7d47,0x3eb)){var _0x55ac87=_[_0x767f('0x4c')](_0x111c2b,{'sectionId':0x3eb});return getCustomDashboards(_0x55ac87)[_0x767f('0x2b')](function(_0x57800f){return _[_0x767f('0x34')](_0x111c2b,function(_0x49ad08){if(_0x55ac87[_0x767f('0x63')]){if(_0x49ad08[_0x767f('0x59')]===0x3eb){_0x49ad08[_0x767f('0x66')]=_0x57800f;}}else{if(_0x49ad08['sectionId']===0x64){_0x49ad08[_0x767f('0x66')]=_0x57800f;}}return _0x49ad08;});});}else{return;}})['then'](function(_0x43a039){if(_0x43a039)_0x111c2b=_0x43a039;if(_[_0x767f('0x65')](_0x1a7d47,0x709)){var _0x26ed6c=_[_0x767f('0x4c')](_0x111c2b,{'sectionId':0x709});return getPlugins(_0x26ed6c)[_0x767f('0x2b')](function(_0x5a7123){if(_0x26ed6c['enabled']){return _[_0x767f('0x34')](_0x111c2b,function(_0x233697){if(_0x233697[_0x767f('0x59')]===0x709){_0x233697[_0x767f('0x66')]=_0x5a7123;}return _0x233697;});}else{var _0x4b775a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5a7123};var _0x3880e3=_[_0x767f('0x34')](_0x111c2b);_0x3880e3[_0x767f('0x5f')](_0x4b775a);return _0x3880e3;}});}else{return;}})[_0x767f('0x2b')](function(_0x22e6e7){if(_0x22e6e7)_0x111c2b=_0x22e6e7;return _[_0x767f('0x3f')](_0x111c2b,[_0x767f('0x63'),0x1]);})['then'](respondWithResult(_0x28706f,null))[_0x767f('0x48')](handleError(_0x28706f,null));};function hasDefaultDashboard(_0x544259){var _0x3f0c10=[0x65];return new BPromise(function(_0x24a0fe,_0x316ff7){try{if(_0x544259[_0x767f('0x58')]){_0x24a0fe(_0x3f0c10);}else{return db[_0x767f('0x5c')][_0x767f('0x67')]({'where':{'sectionId':_0x544259['id']},'raw':!![]})[_0x767f('0x2b')](function(_0x4f5b57){_0x4f5b57?_0x24a0fe(_0x3f0c10):_0x24a0fe();});}}catch(_0x36eb4c){_0x316ff7(_0x36eb4c);}});}function getCustomDashboards(_0x4548d3){var _0x1d6c21=[];return new BPromise(function(_0x1af68e,_0xb21ea6){try{if(_0x4548d3['autoAssociation']){return db[_0x767f('0x68')][_0x767f('0x46')]({'raw':!![]})[_0x767f('0x2b')](function(_0x492efa){_0x492efa[_0x767f('0x69')](function(_0x2d762a){_0x1d6c21[_0x767f('0x5f')](_0x2d762a['id']+0x1869f);});_0x1af68e(_0x1d6c21);});}else{return db[_0x767f('0x5c')]['findAll']({'where':{'sectionId':_0x4548d3['id']},'raw':!![]})[_0x767f('0x2b')](function(_0x5eab4d){_0x5eab4d[_0x767f('0x69')](function(_0x47abda){_0x1d6c21[_0x767f('0x5f')](_0x47abda[_0x767f('0x6a')]+0x1869f);});_0x1af68e(_0x1d6c21);});}}catch(_0x4a661f){_0xb21ea6(_0x4a661f);}});}function getPlugins(_0xf3f66){var _0x100d27=[];return new BPromise(function(_0x56aee2,_0xd79a2d){try{if(_0xf3f66[_0x767f('0x58')]){return db['Plugin'][_0x767f('0x46')]({'raw':!![]})[_0x767f('0x2b')](function(_0x3dda19){_0x3dda19[_0x767f('0x69')](function(_0x52b1c8){_0x100d27[_0x767f('0x5f')](_0x52b1c8['id']+0x15b38);});_0x56aee2(_0x100d27);});}else{return db[_0x767f('0x5c')][_0x767f('0x46')]({'where':{'sectionId':_0xf3f66['id']},'raw':!![]})[_0x767f('0x2b')](function(_0xed67ef){_0xed67ef['forEach'](function(_0x6b694e){_0x100d27[_0x767f('0x5f')](_0x6b694e[_0x767f('0x6a')]+0x15b38);});_0x56aee2(_0x100d27);});}}catch(_0x251d5f){_0xd79a2d(_0x251d5f);}});}exports['addResources']=function(_0x120c19,_0x100907){return db[_0x767f('0x31')][_0x767f('0x4c')]({'where':{'id':_0x120c19[_0x767f('0x49')]['id']}})[_0x767f('0x2b')](handleEntityNotFound(_0x100907,null))[_0x767f('0x2b')](function(_0x49765f){if(_0x49765f){return db['sequelize'][_0x767f('0x5e')](function(_0x5caa22){return db[_0x767f('0x56')][_0x767f('0x46')]({'where':{'userProfileId':_0x120c19[_0x767f('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x767f('0x2b')](function(_0x3d2e75){if(_0x3d2e75){return db[_0x767f('0x56')][_0x767f('0x2a')]({'where':{'userProfileId':_0x120c19[_0x767f('0x49')]['id'],'id':_[_0x767f('0x34')](_0x3d2e75,function(_0x167438){return _0x167438['id'];})},'transaction':_0x5caa22});}})[_0x767f('0x2b')](function(_0x476592){var _0x2a11d1=_[_0x767f('0x34')](_0x120c19[_0x767f('0x4e')],function(_0xb786c7){_0xb786c7[_0x767f('0x5a')]=_0x120c19[_0x767f('0x49')]['id'];return _0xb786c7;});return db['UserProfileSection'][_0x767f('0x6b')](_0x2a11d1,{'raw':!![],'transaction':_0x5caa22});})['then'](function(_0x22c5ba){var _0xb2de3=_[_0x767f('0x3f')](_[_0x767f('0x34')](_0x22c5ba,function(_0x4f0206){return _0x4f0206[_0x767f('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0xb2de3){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x120c19[_0x767f('0x49')]['id'],'sectionId':_[_0x767f('0x34')](_0xb2de3,function(_0x11d510){return _0x11d510['sectionId'];})},'attributes':['id',_0x767f('0x59')],'raw':!![]})[_0x767f('0x2b')](function(_0x3acb87){var _0x592cc3=_['map'](_0x120c19[_0x767f('0x4e')],function(_0x1a0695){_0x1a0695[_0x767f('0x5a')]=_0x120c19['params']['id'];return _0x1a0695;});return db[_0x767f('0x5c')][_0x767f('0x6b')](_0x592cc3,{'raw':!![],'transaction':_0x5caa22});});}})[_0x767f('0x48')](handleError(_0x100907,null));});}})[_0x767f('0x2b')](function(_0x390a9c){var _0x5bc74b=_[_0x767f('0x34')](_0x390a9c,function(_0x481171){return _0x481171[_0x767f('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x100907,null))[_0x767f('0x48')](handleError(_0x100907,null));};exports[_0x767f('0x6c')]=function(_0x239eb7,_0x21dd8e,_0x21fb8f){return db[_0x767f('0x31')]['find']({'where':{'id':_0x239eb7[_0x767f('0x49')]['id']}})['then'](handleEntityNotFound(_0x21dd8e,null))[_0x767f('0x2b')](function(_0x624dc6){if(_0x624dc6){return _0x624dc6[_0x767f('0x6c')](_0x239eb7[_0x767f('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x21dd8e,null))['catch'](handleError(_0x21dd8e,null));};exports[_0x767f('0x6d')]=function(_0x35378b,_0x52e6dd){var _0x3f6e4c={'raw':![],'where':{}};var _0x929bfd={};var _0x286106={'count':0x0,'rows':[]};var _0x4faaa5=_0x35378b[_0x767f('0x35')][_0x767f('0x6e')];if(typeof _0x4faaa5===_0x767f('0x6f')){throw new db[(_0x767f('0x70'))]['ValidationError']('Unknown\x20section');}var _0x329d0f=_0x35378b['query'][_0x767f('0x71')]||![];var _0x524bfb=getQueryModels(_0x4faaa5,_0x329d0f);if(typeof _0x524bfb['childModel']===_0x767f('0x6f')){throw new db['Sequelize'][(_0x767f('0x72'))](_0x767f('0x73')+_0x4faaa5+'\x27');}var _0x6f2561=[];if(!_[_0x767f('0x64')](_0x524bfb[_0x767f('0x74')])){_0x6f2561=_0x524bfb[_0x767f('0x74')];}else{_0x6f2561=[{'name':_0x4faaa5}];}return db[_0x767f('0x31')][_0x767f('0x67')]({'where':{'id':_0x35378b[_0x767f('0x49')]['id']}})['then'](handleEntityNotFound(_0x52e6dd,null))[_0x767f('0x2b')](function(_0x5b52b4){if(_0x5b52b4){var _0x291772=[];for(var _0x582a2e=0x0;_0x582a2e<_0x6f2561[_0x767f('0x4b')];_0x582a2e++){_0x291772[_0x767f('0x5f')](db['UserProfileSection'][_0x767f('0x67')]({'where':{'userProfileId':_0x5b52b4['id'],'name':_0x6f2561[_0x582a2e][_0x767f('0x2e')]},'raw':!![]}));}return BPromise[_0x767f('0x75')](_0x291772);}})[_0x767f('0x2b')](function(_0x111e9b){var _0x21bbf6=_[_0x767f('0x3f')](_0x111e9b,function(_0x14dd46){return _0x14dd46?_0x14dd46:undefined;});var _0x14f5d6=_[_0x767f('0x3f')](_0x6f2561,[_0x767f('0x76'),!![]]);var _0x121bc7=_['isEmpty'](_0x21bbf6)&&_['isEmpty'](_0x14f5d6)?null:_['union'](_0x14f5d6,_0x21bbf6);if(_0x121bc7){var _0x3914d2=[];for(var _0x50b4cf=0x0;_0x50b4cf<_0x121bc7[_0x767f('0x4b')];_0x50b4cf++){var _0x331b6f=_['find'](_0x6f2561,function(_0x134e12){return _0x121bc7[_0x50b4cf]?_0x134e12[_0x767f('0x2e')]===_0x121bc7[_0x50b4cf][_0x767f('0x2e')]:null;});if(_0x331b6f){if(_0x121bc7[_0x50b4cf][_0x767f('0x76')]){_0x3914d2['push'](getAllResources(_0x524bfb[_0x767f('0x77')],_0x121bc7[_0x50b4cf]));}else{if(!_0x121bc7[_0x50b4cf][_0x767f('0x58')]){_0x3914d2[_0x767f('0x5f')](getAllowedResources(_0x331b6f,_0x121bc7[_0x50b4cf],_0x524bfb['childModel']));}else{if(_0x331b6f['model']){_0x3914d2[_0x767f('0x5f')](getAllFilteredResources(_0x331b6f,_0x121bc7[_0x50b4cf]));}}}}}return BPromise[_0x767f('0x75')](_0x3914d2);}else{return null;}})[_0x767f('0x2b')](function(_0xe92111){var _0x215bec=_0xe92111;var _0x4d3192=null;if(_0x215bec){_0x4d3192=_0x215bec['length']===0x1?_0x215bec[0x0]:null;}if(_0x4d3192||_0x215bec){var _0x4ad902=db[_0x524bfb[_0x767f('0x77')]][_0x767f('0x32')];_0x929bfd[_0x767f('0x33')]=_[_0x767f('0x4a')](_0x4ad902);_0x929bfd[_0x767f('0x35')]=_['keys'](_0x35378b[_0x767f('0x35')]);_0x929bfd[_0x767f('0x36')]=_['intersection'](_0x929bfd[_0x767f('0x33')],_0x929bfd[_0x767f('0x35')]);_0x3f6e4c[_0x767f('0x38')]=_[_0x767f('0x37')](_0x929bfd[_0x767f('0x33')],qs['fields'](_0x35378b[_0x767f('0x35')][_0x767f('0x39')]));_0x3f6e4c[_0x767f('0x38')]=_0x3f6e4c[_0x767f('0x38')][_0x767f('0x4b')]?_0x3f6e4c[_0x767f('0x38')]:_0x929bfd[_0x767f('0x33')];if(!_0x35378b['query'][_0x767f('0x3a')](_0x767f('0x3b'))){_0x3f6e4c['limit']=qs[_0x767f('0x24')](_0x35378b['query'][_0x767f('0x24')]);_0x3f6e4c[_0x767f('0x23')]=qs['offset'](_0x35378b[_0x767f('0x35')][_0x767f('0x23')]);}_0x3f6e4c['order']=qs[_0x767f('0x3c')](_0x35378b['query'][_0x767f('0x3c')]);_0x3f6e4c[_0x767f('0x3d')]=qs[_0x767f('0x36')](_[_0x767f('0x3e')](_0x35378b['query'],_0x929bfd[_0x767f('0x36')]));if(_0x35378b['query']['filter']){_0x3f6e4c['where']=_[_0x767f('0x40')](_0x3f6e4c['where'],{'$or':_[_0x767f('0x34')](_0x4ad902,function(_0x12a2af){if(_0x12a2af[_0x767f('0x41')][_0x767f('0x78')]!==_0x767f('0x79')){var _0x54d5d3={};_0x54d5d3[_0x12a2af[_0x767f('0x7a')]]={'$like':'%'+_0x35378b[_0x767f('0x35')][_0x767f('0x3f')]+'%'};return _0x54d5d3;}})});}var _0x478e31=[];if(_0x4d3192){var _0x9f159d=_['find'](_0x6f2561,['name',_0x4d3192[_0x767f('0x2e')]]);if(_0x9f159d[_0x767f('0x7a')]){var _0xd0a570={};if(_0x524bfb[_0x767f('0x77')]===_0x767f('0x7b')){_0xd0a570[_0x9f159d[_0x767f('0x7c')]]=_[_0x767f('0x34')](_0x4d3192[_0x767f('0x7d')],'id');}else{_0xd0a570[_0x9f159d[_0x767f('0x7c')]]=_0x4d3192[_0x767f('0x7d')];}_0x478e31['push'](_0xd0a570);}else{_0x3f6e4c[_0x767f('0x3d')]['id']=_0x4d3192[_0x767f('0x7d')];}}else{for(var _0x38ac60=0x0;_0x38ac60<_0x215bec[_0x767f('0x4b')];_0x38ac60++){var _0x9f159d=_[_0x767f('0x4c')](_0x6f2561,['name',_0x215bec[_0x38ac60][_0x767f('0x2e')]]);if(_0x9f159d['field']){var _0xd0a570={};_0xd0a570[_0x9f159d['foreignKey']]=_0x215bec[_0x38ac60][_0x767f('0x7d')];_0x478e31[_0x767f('0x5f')](_0xd0a570);}else{if(!_0x3f6e4c['where']['id'])_0x3f6e4c[_0x767f('0x3d')]['id']=[];_0x215bec[_0x38ac60][_0x767f('0x7d')]['forEach'](function(_0x4b5008){_0x3f6e4c[_0x767f('0x3d')]['id']['push'](_0x4b5008);});}}}if(!_['isEmpty'](_0x478e31)){_0x3f6e4c[_0x767f('0x3d')]=_[_0x767f('0x40')](_0x3f6e4c[_0x767f('0x3d')],{'$and':{'$or':_0x478e31}});}_0x3f6e4c=_[_0x767f('0x40')]({},_0x3f6e4c,_0x35378b[_0x767f('0x42')]);if(_0x4d3192&&!_0x4d3192[_0x767f('0x58')]&&_0x524bfb[_0x767f('0x77')]===_0x767f('0x7b')){if(_0x35378b['query']['includeAll']){_0x3f6e4c[_0x767f('0x45')]=[{'all':!![]}];}return db[_0x524bfb[_0x767f('0x77')]][_0x767f('0x46')](_0x3f6e4c)[_0x767f('0x2b')](function(_0x199887){var _0x207a89=[];_0x199887[_0x767f('0x69')](function(_0x326243){var _0x48abcb;switch(_0x326243[_0x767f('0x7e')]){case _0x767f('0x7f'):_0x48abcb=_['find'](_0x4d3192['associatedResources'],function(_0x5b7b56){return _0x5b7b56['id']===_0x326243[_0x767f('0x80')]&&_0x5b7b56['type']===_0x767f('0x81');});break;case _0x767f('0x82'):_0x48abcb=_[_0x767f('0x4c')](_0x4d3192['associatedResources'],function(_0x64666c){return _0x64666c['id']===_0x326243['reportId']&&_0x64666c[_0x767f('0x41')]===_0x767f('0x83');});break;}if(_0x48abcb)_0x207a89[_0x767f('0x5f')](_0x326243);});_0x286106[_0x767f('0x43')]=_0x207a89['length'];_0x286106['rows']=_0x207a89;return _0x286106;});}else{return db[_0x524bfb[_0x767f('0x77')]][_0x767f('0x43')]({'where':_0x3f6e4c[_0x767f('0x3d')]})[_0x767f('0x2b')](function(_0x1ba70b){_0x286106['count']=_0x1ba70b;if(_0x35378b[_0x767f('0x35')]['includeAll']){if(_0x524bfb['childModel']===_0x767f('0x84')){_0x3f6e4c['include']=[{'model':db[_0x767f('0x85')],'as':'Tags','attributes':['id',_0x767f('0x2e'),'color'],'required':_0x35378b[_0x767f('0x35')][_0x767f('0x86')]?!![]:![]},{'model':db[_0x767f('0x85')],'as':_0x767f('0x87'),'attributes':['id','name',_0x767f('0x88')],'through':_0x35378b[_0x767f('0x35')][_0x767f('0x86')]?{'attributes':[],'where':{'TagId':_0x35378b[_0x767f('0x35')][_0x767f('0x86')]||undefined}}:{},'required':_0x35378b[_0x767f('0x35')]['tag']?!![]:![]}];}else{_0x3f6e4c[_0x767f('0x45')]=[{'all':!![]}];}}return db[_0x524bfb['childModel']][_0x767f('0x46')](_0x3f6e4c);})[_0x767f('0x2b')](function(_0xe76aae){_0x286106[_0x767f('0x47')]=_0xe76aae;return _0x286106;});}}else{return _0x286106;}})[_0x767f('0x2b')](respondWithFilteredResult(_0x52e6dd,_0x3f6e4c))[_0x767f('0x48')](handleError(_0x52e6dd,null));};function getAllResources(_0x216a84,_0x35627d){return new BPromise(function(_0x128848,_0x2f43cd){if(_0x35627d){var _0x320a46=_0x35627d['filter']?{[_0x35627d[_0x767f('0x3f')][_0x767f('0x7a')]]:_0x35627d[_0x767f('0x3f')]['value']}:undefined;return db[_0x216a84][_0x767f('0x46')]({'where':_0x320a46,'raw':!![]})[_0x767f('0x2b')](function(_0x28deba){_0x35627d[_0x767f('0x7d')]=_[_0x767f('0x34')](_0x28deba,'id');_0x128848(_0x35627d);})['catch'](function(_0x111ad3){_0x2f43cd(_0x111ad3);});}else{_0x128848(null);}});}function getAllFilteredResources(_0x2373e6,_0x5b4a23){return new BPromise(function(_0x24ff8a,_0x330ae2){var _0x5aa35d=_0x2373e6[_0x767f('0x3f')]?{[_0x2373e6[_0x767f('0x3f')][_0x767f('0x7a')]]:_0x2373e6['filter'][_0x767f('0x89')]}:undefined;return db[_0x2373e6[_0x767f('0x33')]][_0x767f('0x46')]({'where':_0x5aa35d,'raw':!![]})[_0x767f('0x2b')](function(_0x321263){_0x5b4a23[_0x767f('0x7d')]=_[_0x767f('0x34')](_0x321263,function(_0x48040c){return _0x48040c['name'];});_0x24ff8a(_0x5b4a23);})[_0x767f('0x48')](function(_0x5c3217){_0x330ae2(_0x5c3217);});});}function getAllowedResources(_0x325539,_0x27b570,_0x4876b9){return new BPromise(function(_0x933f46,_0x4f0b3c){if(_0x27b570){return db[_0x767f('0x5c')][_0x767f('0x46')]({'where':{'sectionId':_0x27b570['id']},'raw':!![]})['then'](function(_0xe77446){if(_0x325539['field']&&_0x325539[_0x767f('0x7a')]!=='id'){_0x27b570['associatedResources']=_[_0x767f('0x34')](_0xe77446,function(_0x30b5b9){return _0x30b5b9[_0x325539[_0x767f('0x7a')]];});}else{if(_0x4876b9==='AnalyticExtractedReport'){_0x27b570['associatedResources']=_[_0x767f('0x34')](_0xe77446,function(_0x5b264e){return{'id':_0x5b264e[_0x767f('0x6a')],'type':_0x5b264e[_0x767f('0x41')]};});}else{_0x27b570[_0x767f('0x7d')]=_[_0x767f('0x34')](_0xe77446,function(_0xecc6c9){return _0xecc6c9[_0x767f('0x6a')];});}}_0x933f46(_0x27b570);})[_0x767f('0x48')](function(_0x48ad0d){_0x4f0b3c(_0x48ad0d);});}else{_0x933f46(null);}});}function getQueryModels(_0x2e5b01,_0x3fd777){var _0x2ba25c=_0x2e5b01[_0x767f('0x8a')]();var _0x3a5ecc={'childModel':undefined,'parentSections':[]};switch(_0x2ba25c){case _0x767f('0x8b'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x8c');break;case _0x767f('0x8d'):_0x3a5ecc['childModel']='SquareOdbc';break;case'squarerecordings':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x8e');_0x3a5ecc[_0x767f('0x74')]=[{'name':_0x767f('0x8f'),'field':_0x767f('0x2e'),'foreignKey':'projectName'}];break;case'projects':_0x3a5ecc['childModel']=_0x767f('0x90');break;case _0x767f('0x91'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x84');_0x3a5ecc['parentSections']=[{'name':_0x767f('0x92'),'field':'id','foreignKey':_0x767f('0x93')}];break;case'lists':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x94');break;case'companies':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x95');break;case _0x767f('0x96'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x97');break;case _0x767f('0x98'):_0x3a5ecc[_0x767f('0x77')]='ChatQueue';break;case _0x767f('0x99'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x9a');break;case _0x767f('0x9b'):_0x3a5ecc['childModel']=_0x767f('0x9c');break;case'faxaccounts':_0x3a5ecc[_0x767f('0x77')]='FaxAccount';break;case'inboundroutes':case _0x767f('0x9d'):case'outboundroutes':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x9e');break;case _0x767f('0x9f'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xa0');break;case _0x767f('0xa1'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xa2');break;case _0x767f('0xa3'):_0x3a5ecc['childModel']=_0x767f('0xa4');_0x3a5ecc[_0x767f('0x74')]=[{'name':_0x767f('0xa5'),'field':_0x767f('0x2e'),'foreignKey':_0x767f('0xa6'),'model':_0x767f('0xa7'),'filter':{'field':_0x767f('0xa8'),'value':[_0x767f('0xa9')]}},{'name':_0x767f('0xaa'),'field':_0x767f('0x2e'),'foreignKey':_0x767f('0xa6'),'model':'User','filter':{'field':'role','value':['telephone']}},{'name':'VoiceQueues','field':_0x767f('0x2e'),'foreignKey':_0x767f('0xab'),'model':_0x767f('0xac'),'filter':{'field':_0x767f('0x41'),'value':[_0x767f('0xad')]}},{'name':_0x767f('0xae'),'field':_0x767f('0x2e'),'foreignKey':_0x767f('0xab'),'model':'VoiceQueue','filter':{'field':_0x767f('0x41'),'value':[_0x767f('0xaf')]}}];break;case _0x767f('0xb0'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xb1');break;case _0x767f('0xb2'):_0x3a5ecc['childModel']=_0x767f('0xb3');break;case _0x767f('0xb4'):_0x3a5ecc['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xb5');break;case _0x767f('0xb6'):_0x3a5ecc[_0x767f('0x77')]='MailQueue';break;case _0x767f('0xb7'):_0x3a5ecc['childModel']='MailAccount';break;case _0x767f('0xb8'):_0x3a5ecc['childModel']=_0x767f('0xb9');break;case _0x767f('0xba'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xbb');break;case _0x767f('0xbc'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xbd');break;case _0x767f('0xbe'):_0x3a5ecc['childModel']=_0x767f('0xbf');break;case _0x767f('0xc0'):_0x3a5ecc['childModel']=_0x767f('0xc1');break;case _0x767f('0xc2'):_0x3a5ecc['childModel']=_0x767f('0xc3');break;case _0x767f('0xc4'):_0x3a5ecc['childModel']=_0x767f('0xc5');break;case'teams':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xc6');break;case _0x767f('0xc7'):case _0x767f('0xc8'):_0x3a5ecc[_0x767f('0x77')]='VoiceQueue';if(_0x3fd777){_0x3a5ecc[_0x767f('0x74')]=[{'name':_0x767f('0xc9')},{'name':_0x767f('0xae')}];}break;case _0x767f('0xca'):case _0x767f('0xcb'):case'telephones':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xa7');if(_0x3fd777){_0x3a5ecc[_0x767f('0x74')]=[{'name':_0x767f('0xcc'),'filter':{'field':_0x767f('0xa8'),'value':[_0x767f('0xcd'),_0x767f('0xce')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x767f('0xcf'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xd0');break;case'salesforceaccounts':_0x3a5ecc['childModel']=_0x767f('0xd1');break;case _0x767f('0xd2'):_0x3a5ecc['childModel']=_0x767f('0xd3');break;case _0x767f('0xd4'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xd5');break;case'deskaccounts':_0x3a5ecc['childModel']=_0x767f('0xd6');break;case _0x767f('0xd7'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xd8');break;case _0x767f('0xd9'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xa7');break;case _0x767f('0xda'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xdb');break;case _0x767f('0xdc'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xdd');break;case'customdashboards':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x68');break;case'intervals':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xde');break;case _0x767f('0xdf'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xe0');break;case _0x767f('0xe1'):_0x3a5ecc[_0x767f('0x77')]='Schedule';break;case _0x767f('0xe2'):_0x3a5ecc['childModel']=_0x767f('0xe3');break;case _0x767f('0xe4'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x85');break;case _0x767f('0xe5'):_0x3a5ecc['childModel']=_0x767f('0xe6');break;case _0x767f('0xe7'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xe8');break;case _0x767f('0xe9'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xea');break;case'variables':_0x3a5ecc[_0x767f('0x77')]='Variable';break;case'plugins':_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xeb');break;case _0x767f('0xec'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0x7b');_0x3a5ecc[_0x767f('0x74')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x767f('0xed'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xee');break;case _0x767f('0xc4'):_0x3a5ecc[_0x767f('0x77')]=_0x767f('0xc5');break;default:return _0x3a5ecc;}return _0x3a5ecc;} \ No newline at end of file +var _0xcb1f=['CustomReports','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','User','telephone','VoiceQueues','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','QueueCampaigns','telephones','Users','admin','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Template','triggers','Trigger','Trunk','variables','plugins','extractedreports','Reports','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','clone','find','get','omit','updatedAt','crudPermissions','body','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','addSections','removeSections','ids','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','undefined','Sequelize','mergeResources','ValidationError','parentSections','all','ignore','childModel','order','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcb1f,0x6e));var _0xfcb1=function(_0x3628cd,_0x48ebb6){_0x3628cd=_0x3628cd-0x0;var _0x3fbade=_0xcb1f[_0x3628cd];return _0x3fbade;};'use strict';var pdf=require(_0xfcb1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfcb1('0x1'));var zipdir=require(_0xfcb1('0x2'));var jsonpatch=require(_0xfcb1('0x3'));var rp=require(_0xfcb1('0x4'));var moment=require('moment');var BPromise=require(_0xfcb1('0x5'));var Mustache=require(_0xfcb1('0x6'));var util=require('util');var path=require(_0xfcb1('0x7'));var sox=require(_0xfcb1('0x8'));var csv=require(_0xfcb1('0x9'));var ejs=require(_0xfcb1('0xa'));var fs=require('fs');var _=require(_0xfcb1('0xb'));var squel=require(_0xfcb1('0xc'));var crypto=require(_0xfcb1('0xd'));var jsforce=require(_0xfcb1('0xe'));var deskjs=require(_0xfcb1('0xf'));var toCsv=require(_0xfcb1('0x9'));var querystring=require('querystring');var Papa=require(_0xfcb1('0x10'));var Redis=require(_0xfcb1('0x11'));var authService=require(_0xfcb1('0x12'));var qs=require(_0xfcb1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcb1('0x14'))(_0xfcb1('0x15'));var utils=require(_0xfcb1('0x16'));var config=require('../../config/environment');var db=require(_0xfcb1('0x17'))['db'];config[_0xfcb1('0x18')]=_['defaults'](config[_0xfcb1('0x18')],{'host':_0xfcb1('0x19'),'port':0x18eb});var socket=require(_0xfcb1('0x1a'))(new Redis(config[_0xfcb1('0x18')]));require(_0xfcb1('0x1b'))[_0xfcb1('0x1c')](socket);function respondWithStatusCode(_0x31fec6,_0x31081a){_0x31081a=_0x31081a||0xcc;return function(_0x4be5b3){if(_0x4be5b3){return _0x31fec6[_0xfcb1('0x1d')](_0x31081a);}return _0x31fec6[_0xfcb1('0x1e')](_0x31081a)['end']();};}function respondWithResult(_0x44475d,_0x32a9e1){_0x32a9e1=_0x32a9e1||0xc8;return function(_0x1c6048){if(_0x1c6048){return _0x44475d[_0xfcb1('0x1e')](_0x32a9e1)[_0xfcb1('0x1f')](_0x1c6048);}};}function respondWithFilteredResult(_0x2eece8,_0x472dd2){return function(_0x1d6f3b){if(_0x1d6f3b){var _0x41980a=_0x1d6f3b[_0xfcb1('0x20')],_0xd6c879=_0x472dd2['offset'],_0x1067d7=_0x472dd2['offset']+_0x472dd2['limit'],_0xf06059;if(_0x1067d7>=_0x41980a){_0x1067d7=_0x41980a;_0xf06059=0xc8;}else{_0xf06059=0xce;}_0x2eece8['status'](_0xf06059);return _0x2eece8[_0xfcb1('0x21')]('Content-Range',_0xd6c879+'-'+_0x1067d7+'/'+_0x41980a)[_0xfcb1('0x1f')](_0x1d6f3b);}return null;};}function patchUpdates(_0xcd42bf){return function(_0x518c29){try{jsonpatch[_0xfcb1('0x22')](_0x518c29,_0xcd42bf,!![]);}catch(_0x432388){return BPromise[_0xfcb1('0x23')](_0x432388);}return _0x518c29[_0xfcb1('0x24')]();};}function saveUpdates(_0x1753ab,_0x1c552c){return function(_0x15efc1){if(_0x15efc1){return _0x15efc1[_0xfcb1('0x25')](_0x1753ab)[_0xfcb1('0x26')](function(_0x4b862e){return _0x4b862e;});}return null;};}function removeEntity(_0x1e4327,_0x441beb){return function(_0x200656){if(_0x200656){return _0x200656[_0xfcb1('0x27')]()[_0xfcb1('0x26')](function(){_0x1e4327[_0xfcb1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ccf6f,_0x3590ad){return function(_0x1e706b){if(!_0x1e706b){_0x2ccf6f['sendStatus'](0x194);}return _0x1e706b;};}function handleError(_0x48bd8b,_0x1d2805){_0x1d2805=_0x1d2805||0x1f4;return function(_0xb4c5c3){logger[_0xfcb1('0x28')](_0xb4c5c3[_0xfcb1('0x29')]);if(_0xb4c5c3['name']){delete _0xb4c5c3[_0xfcb1('0x2a')];}_0x48bd8b[_0xfcb1('0x1e')](_0x1d2805)[_0xfcb1('0x2b')](_0xb4c5c3);};}exports[_0xfcb1('0x2c')]=function(_0x23d2e8,_0x4a0157){var _0x540e8a={},_0x57f795={},_0x3c095c={'count':0x0,'rows':[]};var _0x27dd5f=_['map'](db[_0xfcb1('0x2d')][_0xfcb1('0x2e')],function(_0x6f6e83){return{'name':_0x6f6e83[_0xfcb1('0x2f')],'type':_0x6f6e83[_0xfcb1('0x30')][_0xfcb1('0x31')]};});_0x57f795[_0xfcb1('0x32')]=_[_0xfcb1('0x33')](_0x27dd5f,_0xfcb1('0x2a'));_0x57f795['query']=_[_0xfcb1('0x34')](_0x23d2e8['query']);_0x57f795['filters']=_[_0xfcb1('0x35')](_0x57f795[_0xfcb1('0x32')],_0x57f795[_0xfcb1('0x36')]);_0x540e8a[_0xfcb1('0x37')]=_['intersection'](_0x57f795[_0xfcb1('0x32')],qs[_0xfcb1('0x38')](_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x38')]));_0x540e8a[_0xfcb1('0x37')]=_0x540e8a[_0xfcb1('0x37')][_0xfcb1('0x39')]?_0x540e8a['attributes']:_0x57f795[_0xfcb1('0x32')];if(!_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x3a')](_0xfcb1('0x3b'))){_0x540e8a[_0xfcb1('0x3c')]=qs[_0xfcb1('0x3c')](_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x3c')]);_0x540e8a[_0xfcb1('0x3d')]=qs[_0xfcb1('0x3d')](_0x23d2e8['query'][_0xfcb1('0x3d')]);}_0x540e8a['order']=qs[_0xfcb1('0x3e')](_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x3e')]);_0x540e8a[_0xfcb1('0x3f')]=qs[_0xfcb1('0x40')](_[_0xfcb1('0x41')](_0x23d2e8['query'],_0x57f795['filters']),_0x27dd5f);if(_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x42')]){_0x540e8a[_0xfcb1('0x3f')]=_[_0xfcb1('0x43')](_0x540e8a[_0xfcb1('0x3f')],{'$or':_[_0xfcb1('0x33')](_0x27dd5f,function(_0x5c3fde){if(_0x5c3fde[_0xfcb1('0x30')]!==_0xfcb1('0x44')){var _0x9bcf89={};_0x9bcf89[_0x5c3fde['name']]={'$like':'%'+_0x23d2e8['query'][_0xfcb1('0x42')]+'%'};return _0x9bcf89;}})});}_0x540e8a=_['merge']({},_0x540e8a,_0x23d2e8[_0xfcb1('0x45')]);var _0x2e3629={'where':_0x540e8a[_0xfcb1('0x3f')]};return db[_0xfcb1('0x2d')]['count'](_0x2e3629)['then'](function(_0x4cd716){_0x3c095c[_0xfcb1('0x20')]=_0x4cd716;if(_0x23d2e8[_0xfcb1('0x36')][_0xfcb1('0x46')]){_0x540e8a[_0xfcb1('0x47')]=[{'all':!![]}];}return db[_0xfcb1('0x2d')][_0xfcb1('0x48')](_0x540e8a);})[_0xfcb1('0x26')](function(_0x1134f2){_0x3c095c['rows']=_0x1134f2;return _0x3c095c;})[_0xfcb1('0x26')](respondWithFilteredResult(_0x4a0157,_0x540e8a))[_0xfcb1('0x49')](handleError(_0x4a0157,null));};exports[_0xfcb1('0x4a')]=function(_0x218b85,_0x12f933){var _0x5d2e44={'raw':![],'where':{'id':_0x218b85[_0xfcb1('0x4b')]['id']}},_0x1947f4={};_0x1947f4[_0xfcb1('0x32')]=_[_0xfcb1('0x34')](db[_0xfcb1('0x2d')]['rawAttributes']);_0x1947f4[_0xfcb1('0x36')]=_[_0xfcb1('0x34')](_0x218b85['query']);_0x1947f4[_0xfcb1('0x40')]=_[_0xfcb1('0x35')](_0x1947f4[_0xfcb1('0x32')],_0x1947f4[_0xfcb1('0x36')]);_0x5d2e44[_0xfcb1('0x37')]=_['intersection'](_0x1947f4[_0xfcb1('0x32')],qs['fields'](_0x218b85['query'][_0xfcb1('0x38')]));_0x5d2e44['attributes']=_0x5d2e44['attributes']['length']?_0x5d2e44[_0xfcb1('0x37')]:_0x1947f4[_0xfcb1('0x32')];if(_0x218b85[_0xfcb1('0x36')][_0xfcb1('0x46')]){_0x5d2e44[_0xfcb1('0x47')]=[{'all':!![]}];}_0x5d2e44=_[_0xfcb1('0x43')]({},_0x5d2e44,_0x218b85[_0xfcb1('0x45')]);return db[_0xfcb1('0x2d')]['find'](_0x5d2e44)['then'](handleEntityNotFound(_0x12f933,null))[_0xfcb1('0x26')](respondWithResult(_0x12f933,null))['catch'](handleError(_0x12f933,null));};exports[_0xfcb1('0x4c')]=function(_0xfecbdf,_0x2c76c7){return db[_0xfcb1('0x2d')]['create'](_0xfecbdf['body'],{})[_0xfcb1('0x26')](respondWithResult(_0x2c76c7,0xc9))['catch'](handleError(_0x2c76c7,null));};exports[_0xfcb1('0x4d')]=function(_0x5e86ef,_0x3aa0f5){var _0xa8526b={'where':{'id':_0x5e86ef['params']['id']}},_0x50c945={};_0x50c945[_0xfcb1('0x32')]=_[_0xfcb1('0x34')](db[_0xfcb1('0x2d')][_0xfcb1('0x2e')]);_0xa8526b['attributes']=_['intersection'](_0x50c945['model'],qs['fields'](_0x5e86ef['query'][_0xfcb1('0x38')]));_0xa8526b['attributes']=_0xa8526b[_0xfcb1('0x37')]['length']?_0xa8526b[_0xfcb1('0x37')]:_0x50c945['model'];if(_0x5e86ef[_0xfcb1('0x36')][_0xfcb1('0x46')]){_0xa8526b[_0xfcb1('0x47')]=[{'all':!![]}];}_0xa8526b=_[_0xfcb1('0x43')]({},_0xa8526b,_0x5e86ef[_0xfcb1('0x45')]);return db['UserProfile'][_0xfcb1('0x4e')](_0xa8526b)[_0xfcb1('0x26')](handleEntityNotFound(_0x3aa0f5,null))[_0xfcb1('0x26')](function(_0x2df9df){if(_0x2df9df){var _0x454e33=_0x2df9df[_0xfcb1('0x4f')]({'plain':!![]});_0x454e33=qs[_0xfcb1('0x50')](_0x454e33,['id','createdAt',_0xfcb1('0x51'),_0xfcb1('0x52')]);_0x5e86ef[_0xfcb1('0x53')]=_[_0xfcb1('0x50')](_0x5e86ef[_0xfcb1('0x53')],['id',_0xfcb1('0x54'),'updatedAt']);return db[_0xfcb1('0x55')][_0xfcb1('0x56')](function(_0x3b4c9c){return db['UserProfile'][_0xfcb1('0x4c')](_['merge'](_0x454e33,_0x5e86ef[_0xfcb1('0x53')]),{'include':_0x5e86ef[_0xfcb1('0x36')][_0xfcb1('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x3b4c9c})['then'](function(_0x2bd793){var _0x2b4b59=_0x2bd793[_0xfcb1('0x4f')]({'plain':!![]});return db[_0xfcb1('0x57')][_0xfcb1('0x48')]({'where':{'userProfileId':_0x5e86ef[_0xfcb1('0x4b')]['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x7a8bda){if(_0x7a8bda){return BPromise['each'](_0x7a8bda,function(_0x415ad2){return new BPromise(function(_0x4363ef,_0x5e1626){if(_0x415ad2['autoAssociation']===null||_0x415ad2[_0xfcb1('0x58')]===0x1)_0x4363ef(null);return db[_0xfcb1('0x59')][_0xfcb1('0x48')]({'where':{'sectionId':_0x415ad2['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x4313ed){var _0x23a801=_[_0xfcb1('0x33')](_0x4313ed,function(_0x485dee){return qs[_0xfcb1('0x50')](_0x485dee,['id','createdAt','updatedAt',_0xfcb1('0x5a')]);});_0x4363ef(_0x23a801);})[_0xfcb1('0x49')](function(_0xbf386f){_0x5e1626(_0xbf386f);});})[_0xfcb1('0x26')](function(_0x1142f0){var _0x44554f=qs[_0xfcb1('0x50')](_0x415ad2,['id',_0xfcb1('0x54'),_0xfcb1('0x51')]);_0x44554f[_0xfcb1('0x5b')]=_0x2b4b59['id'];if(_0x1142f0)_0x44554f[_0xfcb1('0x5c')]=_0x1142f0;return _0x44554f;})['then'](function(_0x270839){return db[_0xfcb1('0x57')]['create'](_0x270839,{'include':[{'model':db[_0xfcb1('0x59')],'as':_0xfcb1('0x5c')}],'raw':!![],'transaction':_0x3b4c9c});});})[_0xfcb1('0x26')](function(){return _0x2b4b59;});}});});});}})[_0xfcb1('0x26')](respondWithResult(_0x3aa0f5,0xc9))['catch'](handleError(_0x3aa0f5,null));};exports['update']=function(_0x459bee,_0x3c4060){if(_0x459bee[_0xfcb1('0x53')]['id']){delete _0x459bee[_0xfcb1('0x53')]['id'];}return db[_0xfcb1('0x2d')]['find']({'where':{'id':_0x459bee[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x3c4060,null))[_0xfcb1('0x26')](saveUpdates(_0x459bee['body'],null))[_0xfcb1('0x26')](respondWithResult(_0x3c4060,null))[_0xfcb1('0x49')](handleError(_0x3c4060,null));};exports['destroy']=function(_0x534bc,_0x493907){return db[_0xfcb1('0x2d')]['find']({'where':{'id':_0x534bc['params']['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x493907,null))['then'](removeEntity(_0x493907,null))['catch'](handleError(_0x493907,null));};exports['describe']=function(_0x3e30b3,_0x1084f1){return db[_0xfcb1('0x2d')]['describe']()[_0xfcb1('0x26')](respondWithResult(_0x1084f1,null))[_0xfcb1('0x49')](handleError(_0x1084f1,null));};exports[_0xfcb1('0x5d')]=function(_0x57e858,_0x12db63){var _0x5d60ad=_0x57e858['body'];return db['UserProfile'][_0xfcb1('0x4e')]({'where':{'id':_0x57e858[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x12db63,null))['then'](function(_0x1c5603){if(_0x1c5603){return db[_0xfcb1('0x55')][_0xfcb1('0x56')](function(_0x19cfd1){return db[_0xfcb1('0x57')]['destroy']({'where':{'userProfileId':_0x57e858[_0xfcb1('0x4b')]['id'],'sectionId':_[_0xfcb1('0x33')](_0x5d60ad,function(_0x5cf67f){return _0x5cf67f[_0xfcb1('0x5a')];})},'transaction':_0x19cfd1})['then'](function(){var _0x272b1e=_['map'](_0x5d60ad,function(_0x5dfb7e){_0x5dfb7e[_0xfcb1('0x5b')]=_0x57e858[_0xfcb1('0x4b')]['id'];return _0x5dfb7e;});var _0x580f54=[];return BPromise['each'](_0x272b1e,function(_0x2553ef){return db[_0xfcb1('0x57')][_0xfcb1('0x4c')](_0x2553ef,{'include':[{'model':db[_0xfcb1('0x59')],'as':_0xfcb1('0x5c')}],'raw':!![],'transaction':_0x19cfd1})[_0xfcb1('0x26')](function(_0x3dade6){_0x580f54['push'](_0x3dade6['get']({'plain':!![]}));});})['then'](function(){return _0x580f54;});});});}})['then'](function(_0x2e6ce8){return _0x2e6ce8;})[_0xfcb1('0x26')](respondWithResult(_0x12db63,null))['catch'](handleError(_0x12db63,null));};exports[_0xfcb1('0x5e')]=function(_0x5f024b,_0x185d52){var _0x3d84ee;return db[_0xfcb1('0x2d')]['find']({'where':{'id':_0x5f024b[_0xfcb1('0x4b')]['id']},'attributes':['id',_0xfcb1('0x2a')]})[_0xfcb1('0x26')](handleEntityNotFound(_0x185d52,null))[_0xfcb1('0x26')](function(_0x1b17e1){if(_0x1b17e1){_0x3d84ee=_0x1b17e1;return db[_0xfcb1('0x57')]['destroy']({'where':{'userProfileId':_0x5f024b[_0xfcb1('0x4b')]['id'],'sectionId':_0x5f024b[_0xfcb1('0x36')][_0xfcb1('0x5f')]}});}})[_0xfcb1('0x26')](function(){return _0x3d84ee;})[_0xfcb1('0x26')](respondWithStatusCode(_0x185d52,null))[_0xfcb1('0x49')](handleError(_0x185d52,null));};exports['getSections']=function(_0x4346e2,_0x216da0){var _0x14f1dc=[];var _0x48edf0=[];return db[_0xfcb1('0x57')][_0xfcb1('0x48')]({'where':{'userProfileId':_0x4346e2[_0xfcb1('0x4b')]['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x5cb1b0){_0x14f1dc=_[_0xfcb1('0x42')](_0x5cb1b0,function(_0x5a8688){return _0x5a8688[_0xfcb1('0x60')]===0x1||_[_0xfcb1('0x61')]([0x3eb,0x709],_0x5a8688[_0xfcb1('0x5a')]);});if(!_[_0xfcb1('0x62')](_0x14f1dc)){return _[_0xfcb1('0x33')](_0x14f1dc,function(_0x150346){return _0x150346['sectionId'];});}else{return;}})[_0xfcb1('0x26')](function(_0x3edc90){if(_0x3edc90)_0x48edf0=_0x3edc90;if(_['includes'](_0x48edf0,0x64)){var _0x394159=_['find'](_0x14f1dc,{'sectionId':0x64});return hasDefaultDashboard(_0x394159)[_0xfcb1('0x26')](function(_0x159f9e){return _[_0xfcb1('0x33')](_0x14f1dc,function(_0x494f56){if(_0x494f56['sectionId']===0x64){_0x494f56[_0xfcb1('0x63')]=_0x159f9e;}return _0x494f56;});});}else{return;}})[_0xfcb1('0x26')](function(_0x5d8414){if(_0x5d8414)_0x14f1dc=_0x5d8414;if(_['includes'](_0x48edf0,0x3eb)){var _0x188371=_[_0xfcb1('0x4e')](_0x14f1dc,{'sectionId':0x3eb});return getCustomDashboards(_0x188371)[_0xfcb1('0x26')](function(_0x4c4b34){return _[_0xfcb1('0x33')](_0x14f1dc,function(_0x12de77){if(_0x188371[_0xfcb1('0x60')]){if(_0x12de77[_0xfcb1('0x5a')]===0x3eb){_0x12de77[_0xfcb1('0x63')]=_0x4c4b34;}}else{if(_0x12de77['sectionId']===0x64){_0x12de77['subsections']=_0x4c4b34;}}return _0x12de77;});});}else{return;}})[_0xfcb1('0x26')](function(_0x104efc){if(_0x104efc)_0x14f1dc=_0x104efc;if(_[_0xfcb1('0x61')](_0x48edf0,0x709)){var _0x267c34=_[_0xfcb1('0x4e')](_0x14f1dc,{'sectionId':0x709});return getPlugins(_0x267c34)[_0xfcb1('0x26')](function(_0xca58c3){if(_0x267c34[_0xfcb1('0x60')]){return _['map'](_0x14f1dc,function(_0x4123c8){if(_0x4123c8['sectionId']===0x709){_0x4123c8[_0xfcb1('0x63')]=_0xca58c3;}return _0x4123c8;});}else{var _0x2013ea={'sectionId':0x76c,'enabled':0x1,'subsections':_0xca58c3};var _0x24d5ff=_[_0xfcb1('0x33')](_0x14f1dc);_0x24d5ff[_0xfcb1('0x64')](_0x2013ea);return _0x24d5ff;}});}else{return;}})[_0xfcb1('0x26')](function(_0x3bb803){if(_0x3bb803)_0x14f1dc=_0x3bb803;return _[_0xfcb1('0x42')](_0x14f1dc,[_0xfcb1('0x60'),0x1]);})[_0xfcb1('0x26')](respondWithResult(_0x216da0,null))['catch'](handleError(_0x216da0,null));};function hasDefaultDashboard(_0x599ca7){var _0x5aa77c=[0x65];return new BPromise(function(_0x2478e2,_0x2d260d){try{if(_0x599ca7['autoAssociation']){_0x2478e2(_0x5aa77c);}else{return db[_0xfcb1('0x59')][_0xfcb1('0x65')]({'where':{'sectionId':_0x599ca7['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x4fdce8){_0x4fdce8?_0x2478e2(_0x5aa77c):_0x2478e2();});}}catch(_0x2bdea2){_0x2d260d(_0x2bdea2);}});}function getCustomDashboards(_0x1a91f0){var _0x1f1a12=[];return new BPromise(function(_0x337275,_0x386422){try{if(_0x1a91f0['autoAssociation']){return db[_0xfcb1('0x66')][_0xfcb1('0x48')]({'raw':!![]})[_0xfcb1('0x26')](function(_0x2df70c){_0x2df70c[_0xfcb1('0x67')](function(_0x5cc495){_0x1f1a12[_0xfcb1('0x64')](_0x5cc495['id']+0x1869f);});_0x337275(_0x1f1a12);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1a91f0['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x107d64){_0x107d64[_0xfcb1('0x67')](function(_0xedbe8f){_0x1f1a12['push'](_0xedbe8f['resourceId']+0x1869f);});_0x337275(_0x1f1a12);});}}catch(_0x485356){_0x386422(_0x485356);}});}function getPlugins(_0x349b58){var _0x5c3374=[];return new BPromise(function(_0x233ffd,_0x545d29){try{if(_0x349b58[_0xfcb1('0x58')]){return db[_0xfcb1('0x68')][_0xfcb1('0x48')]({'raw':!![]})[_0xfcb1('0x26')](function(_0x469c8e){_0x469c8e[_0xfcb1('0x67')](function(_0x5c21af){_0x5c3374[_0xfcb1('0x64')](_0x5c21af['id']+0x15b38);});_0x233ffd(_0x5c3374);});}else{return db[_0xfcb1('0x59')][_0xfcb1('0x48')]({'where':{'sectionId':_0x349b58['id']},'raw':!![]})['then'](function(_0x1878ab){_0x1878ab[_0xfcb1('0x67')](function(_0x1f3ea3){_0x5c3374['push'](_0x1f3ea3[_0xfcb1('0x69')]+0x15b38);});_0x233ffd(_0x5c3374);});}}catch(_0x3127da){_0x545d29(_0x3127da);}});}exports[_0xfcb1('0x6a')]=function(_0x3d30e3,_0x3c5942){return db[_0xfcb1('0x2d')]['find']({'where':{'id':_0x3d30e3[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x3c5942,null))[_0xfcb1('0x26')](function(_0x8b4430){if(_0x8b4430){return db[_0xfcb1('0x55')]['transaction'](function(_0x38cf1f){return db[_0xfcb1('0x57')][_0xfcb1('0x48')]({'where':{'userProfileId':_0x3d30e3['params']['id']},'attributes':['id'],'raw':!![]})[_0xfcb1('0x26')](function(_0x4e06b5){if(_0x4e06b5){return db[_0xfcb1('0x57')][_0xfcb1('0x27')]({'where':{'userProfileId':_0x3d30e3[_0xfcb1('0x4b')]['id'],'id':_[_0xfcb1('0x33')](_0x4e06b5,function(_0x3d1371){return _0x3d1371['id'];})},'transaction':_0x38cf1f});}})[_0xfcb1('0x26')](function(_0x5c370b){var _0x524a71=_[_0xfcb1('0x33')](_0x3d30e3[_0xfcb1('0x53')],function(_0x21efc4){_0x21efc4['userProfileId']=_0x3d30e3[_0xfcb1('0x4b')]['id'];return _0x21efc4;});return db[_0xfcb1('0x57')]['bulkCreate'](_0x524a71,{'raw':!![],'transaction':_0x38cf1f});})[_0xfcb1('0x26')](function(_0x178090){var _0x339780=_[_0xfcb1('0x42')](_[_0xfcb1('0x33')](_0x178090,function(_0x41613e){return _0x41613e[_0xfcb1('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x339780){return db[_0xfcb1('0x57')][_0xfcb1('0x48')]({'where':{'userProfileId':_0x3d30e3[_0xfcb1('0x4b')]['id'],'sectionId':_[_0xfcb1('0x33')](_0x339780,function(_0x3521ae){return _0x3521ae[_0xfcb1('0x5a')];})},'attributes':['id',_0xfcb1('0x5a')],'raw':!![]})[_0xfcb1('0x26')](function(_0xdf34e9){var _0x29528f=_[_0xfcb1('0x33')](_0x3d30e3[_0xfcb1('0x53')],function(_0x5ad887){_0x5ad887['userProfileId']=_0x3d30e3[_0xfcb1('0x4b')]['id'];return _0x5ad887;});return db['UserProfileResource'][_0xfcb1('0x6b')](_0x29528f,{'raw':!![],'transaction':_0x38cf1f});});}})[_0xfcb1('0x49')](handleError(_0x3c5942,null));});}})[_0xfcb1('0x26')](function(_0x52f645){var _0x4f87d1=_[_0xfcb1('0x33')](_0x52f645,function(_0x7a600c){return _0x7a600c[_0xfcb1('0x4f')]({'plain':!![]});});})[_0xfcb1('0x26')](respondWithResult(_0x3c5942,null))['catch'](handleError(_0x3c5942,null));};exports[_0xfcb1('0x6c')]=function(_0x227b20,_0xe55774,_0x24e722){return db['UserProfile'][_0xfcb1('0x4e')]({'where':{'id':_0x227b20[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0xe55774,null))['then'](function(_0x36bbde){if(_0x36bbde){return _0x36bbde[_0xfcb1('0x6c')](_0x227b20[_0xfcb1('0x36')][_0xfcb1('0x5f')]);}})[_0xfcb1('0x26')](respondWithStatusCode(_0xe55774,null))[_0xfcb1('0x49')](handleError(_0xe55774,null));};exports[_0xfcb1('0x6d')]=function(_0x2989b7,_0x5502e9){var _0x5387a6={'raw':![],'where':{}};var _0x1032d6={};var _0x4b8910={'count':0x0,'rows':[]};var _0x2461b6=_0x2989b7['query']['section'];if(typeof _0x2461b6===_0xfcb1('0x6e')){throw new db[(_0xfcb1('0x6f'))]['ValidationError']('Unknown\x20section');}var _0x343ec9=_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x70')]||![];var _0x420903=getQueryModels(_0x2461b6,_0x343ec9);if(typeof _0x420903['childModel']===_0xfcb1('0x6e')){throw new db[(_0xfcb1('0x6f'))][(_0xfcb1('0x71'))]('Invalid\x20section\x20\x27'+_0x2461b6+'\x27');}var _0x3a03c5=[];if(!_['isEmpty'](_0x420903[_0xfcb1('0x72')])){_0x3a03c5=_0x420903[_0xfcb1('0x72')];}else{_0x3a03c5=[{'name':_0x2461b6}];}return db['UserProfile']['findOne']({'where':{'id':_0x2989b7[_0xfcb1('0x4b')]['id']}})[_0xfcb1('0x26')](handleEntityNotFound(_0x5502e9,null))[_0xfcb1('0x26')](function(_0xc0d23d){if(_0xc0d23d){var _0x3c05f2=[];for(var _0x4e9927=0x0;_0x4e9927<_0x3a03c5[_0xfcb1('0x39')];_0x4e9927++){_0x3c05f2['push'](db[_0xfcb1('0x57')][_0xfcb1('0x65')]({'where':{'userProfileId':_0xc0d23d['id'],'name':_0x3a03c5[_0x4e9927][_0xfcb1('0x2a')]},'raw':!![]}));}return BPromise[_0xfcb1('0x73')](_0x3c05f2);}})[_0xfcb1('0x26')](function(_0xb693b3){var _0x580b5a=_[_0xfcb1('0x42')](_0xb693b3,function(_0x2b1a41){return _0x2b1a41?_0x2b1a41:undefined;});var _0x2c834a=_[_0xfcb1('0x42')](_0x3a03c5,[_0xfcb1('0x74'),!![]]);var _0x57d56e=_[_0xfcb1('0x62')](_0x580b5a)&&_['isEmpty'](_0x2c834a)?null:_['union'](_0x2c834a,_0x580b5a);if(_0x57d56e){var _0x34430b=[];for(var _0x1d3248=0x0;_0x1d3248<_0x57d56e[_0xfcb1('0x39')];_0x1d3248++){var _0x28506b=_['find'](_0x3a03c5,function(_0x19544d){return _0x57d56e[_0x1d3248]?_0x19544d[_0xfcb1('0x2a')]===_0x57d56e[_0x1d3248][_0xfcb1('0x2a')]:null;});if(_0x28506b){if(_0x57d56e[_0x1d3248]['ignore']){_0x34430b['push'](getAllResources(_0x420903[_0xfcb1('0x75')],_0x57d56e[_0x1d3248]));}else{if(!_0x57d56e[_0x1d3248][_0xfcb1('0x58')]){_0x34430b['push'](getAllowedResources(_0x28506b,_0x57d56e[_0x1d3248],_0x420903['childModel']));}else{if(_0x28506b[_0xfcb1('0x32')]){_0x34430b[_0xfcb1('0x64')](getAllFilteredResources(_0x28506b,_0x57d56e[_0x1d3248]));}}}}}return BPromise[_0xfcb1('0x73')](_0x34430b);}else{return null;}})[_0xfcb1('0x26')](function(_0x46fb1e){var _0x5d2797=_0x46fb1e;var _0x31e01a=null;if(_0x5d2797){_0x31e01a=_0x5d2797[_0xfcb1('0x39')]===0x1?_0x5d2797[0x0]:null;}if(_0x31e01a||_0x5d2797){var _0x458e26=db[_0x420903[_0xfcb1('0x75')]]['rawAttributes'];_0x1032d6[_0xfcb1('0x32')]=_[_0xfcb1('0x34')](_0x458e26);_0x1032d6[_0xfcb1('0x36')]=_[_0xfcb1('0x34')](_0x2989b7[_0xfcb1('0x36')]);_0x1032d6['filters']=_[_0xfcb1('0x35')](_0x1032d6[_0xfcb1('0x32')],_0x1032d6['query']);_0x5387a6[_0xfcb1('0x37')]=_[_0xfcb1('0x35')](_0x1032d6[_0xfcb1('0x32')],qs[_0xfcb1('0x38')](_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x38')]));_0x5387a6[_0xfcb1('0x37')]=_0x5387a6['attributes'][_0xfcb1('0x39')]?_0x5387a6[_0xfcb1('0x37')]:_0x1032d6[_0xfcb1('0x32')];if(!_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x3a')](_0xfcb1('0x3b'))){_0x5387a6['limit']=qs[_0xfcb1('0x3c')](_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x3c')]);_0x5387a6[_0xfcb1('0x3d')]=qs['offset'](_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x3d')]);}_0x5387a6[_0xfcb1('0x76')]=qs[_0xfcb1('0x3e')](_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x3e')]);_0x5387a6[_0xfcb1('0x3f')]=qs[_0xfcb1('0x40')](_[_0xfcb1('0x41')](_0x2989b7[_0xfcb1('0x36')],_0x1032d6['filters']));if(_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x42')]){_0x5387a6[_0xfcb1('0x3f')]=_[_0xfcb1('0x43')](_0x5387a6['where'],{'$or':_[_0xfcb1('0x33')](_0x458e26,function(_0x59ee13){if(_0x59ee13[_0xfcb1('0x30')][_0xfcb1('0x31')]!==_0xfcb1('0x44')){var _0x4c69cf={};_0x4c69cf[_0x59ee13['field']]={'$like':'%'+_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x42')]+'%'};return _0x4c69cf;}})});}var _0x50f3ad=[];if(_0x31e01a){var _0x48febb=_[_0xfcb1('0x4e')](_0x3a03c5,[_0xfcb1('0x2a'),_0x31e01a[_0xfcb1('0x2a')]]);if(_0x48febb[_0xfcb1('0x77')]){var _0x3eecf8={};if(_0x420903[_0xfcb1('0x75')]===_0xfcb1('0x78')){_0x3eecf8[_0x48febb[_0xfcb1('0x79')]]=_['map'](_0x31e01a['associatedResources'],'id');}else{_0x3eecf8[_0x48febb[_0xfcb1('0x79')]]=_0x31e01a[_0xfcb1('0x7a')];}_0x50f3ad[_0xfcb1('0x64')](_0x3eecf8);}else{_0x5387a6[_0xfcb1('0x3f')]['id']=_0x31e01a[_0xfcb1('0x7a')];}}else{for(var _0x3c21de=0x0;_0x3c21de<_0x5d2797[_0xfcb1('0x39')];_0x3c21de++){var _0x48febb=_[_0xfcb1('0x4e')](_0x3a03c5,[_0xfcb1('0x2a'),_0x5d2797[_0x3c21de][_0xfcb1('0x2a')]]);if(_0x48febb[_0xfcb1('0x77')]){var _0x3eecf8={};_0x3eecf8[_0x48febb[_0xfcb1('0x79')]]=_0x5d2797[_0x3c21de][_0xfcb1('0x7a')];_0x50f3ad['push'](_0x3eecf8);}else{if(!_0x5387a6[_0xfcb1('0x3f')]['id'])_0x5387a6[_0xfcb1('0x3f')]['id']=[];_0x5d2797[_0x3c21de][_0xfcb1('0x7a')][_0xfcb1('0x67')](function(_0x147b72){_0x5387a6[_0xfcb1('0x3f')]['id']['push'](_0x147b72);});}}}if(!_[_0xfcb1('0x62')](_0x50f3ad)){_0x5387a6[_0xfcb1('0x3f')]=_[_0xfcb1('0x43')](_0x5387a6[_0xfcb1('0x3f')],{'$and':{'$or':_0x50f3ad}});}_0x5387a6=_[_0xfcb1('0x43')]({},_0x5387a6,_0x2989b7[_0xfcb1('0x45')]);if(_0x31e01a&&!_0x31e01a['autoAssociation']&&_0x420903[_0xfcb1('0x75')]===_0xfcb1('0x78')){if(_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x46')]){_0x5387a6['include']=[{'all':!![]}];}return db[_0x420903[_0xfcb1('0x75')]][_0xfcb1('0x48')](_0x5387a6)[_0xfcb1('0x26')](function(_0x2e0a8f){var _0x4b0886=[];_0x2e0a8f[_0xfcb1('0x67')](function(_0xcb3ce0){var _0x299ed4;switch(_0xcb3ce0[_0xfcb1('0x7b')]){case _0xfcb1('0x7c'):_0x299ed4=_[_0xfcb1('0x4e')](_0x31e01a['associatedResources'],function(_0x1c9f54){return _0x1c9f54['id']===_0xcb3ce0[_0xfcb1('0x7d')]&&_0x1c9f54[_0xfcb1('0x30')]===_0xfcb1('0x7e');});break;case _0xfcb1('0x7f'):_0x299ed4=_[_0xfcb1('0x4e')](_0x31e01a[_0xfcb1('0x7a')],function(_0x4a31de){return _0x4a31de['id']===_0xcb3ce0[_0xfcb1('0x7d')]&&_0x4a31de[_0xfcb1('0x30')]===_0xfcb1('0x80');});break;}if(_0x299ed4)_0x4b0886[_0xfcb1('0x64')](_0xcb3ce0);});_0x4b8910[_0xfcb1('0x20')]=_0x4b0886[_0xfcb1('0x39')];_0x4b8910[_0xfcb1('0x81')]=_0x4b0886;return _0x4b8910;});}else{return db[_0x420903[_0xfcb1('0x75')]][_0xfcb1('0x20')]({'where':_0x5387a6['where']})[_0xfcb1('0x26')](function(_0x53cd32){_0x4b8910[_0xfcb1('0x20')]=_0x53cd32;if(_0x2989b7[_0xfcb1('0x36')]['includeAll']){if(_0x420903[_0xfcb1('0x75')]===_0xfcb1('0x82')){_0x5387a6[_0xfcb1('0x47')]=[{'model':db[_0xfcb1('0x83')],'as':_0xfcb1('0x84'),'attributes':['id',_0xfcb1('0x2a'),_0xfcb1('0x85')],'required':_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x86')]?!![]:![]},{'model':db['Tag'],'as':_0xfcb1('0x87'),'attributes':['id',_0xfcb1('0x2a'),_0xfcb1('0x85')],'through':_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x86')]?{'attributes':[],'where':{'TagId':_0x2989b7[_0xfcb1('0x36')][_0xfcb1('0x86')]||undefined}}:{},'required':_0x2989b7['query'][_0xfcb1('0x86')]?!![]:![]}];}else{_0x5387a6[_0xfcb1('0x47')]=[{'all':!![]}];}}return db[_0x420903[_0xfcb1('0x75')]][_0xfcb1('0x48')](_0x5387a6);})[_0xfcb1('0x26')](function(_0x4e6289){_0x4b8910[_0xfcb1('0x81')]=_0x4e6289;return _0x4b8910;});}}else{return _0x4b8910;}})[_0xfcb1('0x26')](respondWithFilteredResult(_0x5502e9,_0x5387a6))[_0xfcb1('0x49')](handleError(_0x5502e9,null));};function getAllResources(_0x2189b5,_0x4fe38a){return new BPromise(function(_0x3ca73f,_0x3505bc){if(_0x4fe38a){var _0x432f41=_0x4fe38a[_0xfcb1('0x42')]?{[_0x4fe38a[_0xfcb1('0x42')]['field']]:_0x4fe38a[_0xfcb1('0x42')][_0xfcb1('0x88')]}:undefined;return db[_0x2189b5][_0xfcb1('0x48')]({'where':_0x432f41,'raw':!![]})[_0xfcb1('0x26')](function(_0x569179){_0x4fe38a['associatedResources']=_[_0xfcb1('0x33')](_0x569179,'id');_0x3ca73f(_0x4fe38a);})[_0xfcb1('0x49')](function(_0x519178){_0x3505bc(_0x519178);});}else{_0x3ca73f(null);}});}function getAllFilteredResources(_0x3799f2,_0x1fe7a9){return new BPromise(function(_0x127a65,_0x27bdf4){var _0xfe7c9=_0x3799f2[_0xfcb1('0x42')]?{[_0x3799f2['filter'][_0xfcb1('0x77')]]:_0x3799f2[_0xfcb1('0x42')][_0xfcb1('0x88')]}:undefined;return db[_0x3799f2[_0xfcb1('0x32')]]['findAll']({'where':_0xfe7c9,'raw':!![]})[_0xfcb1('0x26')](function(_0x128675){_0x1fe7a9[_0xfcb1('0x7a')]=_[_0xfcb1('0x33')](_0x128675,function(_0xfdee88){return _0xfdee88[_0xfcb1('0x2a')];});_0x127a65(_0x1fe7a9);})[_0xfcb1('0x49')](function(_0x9c08d9){_0x27bdf4(_0x9c08d9);});});}function getAllowedResources(_0x835805,_0x3cfe02,_0x26923f){return new BPromise(function(_0x378570,_0x277625){if(_0x3cfe02){return db[_0xfcb1('0x59')]['findAll']({'where':{'sectionId':_0x3cfe02['id']},'raw':!![]})[_0xfcb1('0x26')](function(_0x528b77){if(_0x835805['field']&&_0x835805[_0xfcb1('0x77')]!=='id'){_0x3cfe02['associatedResources']=_[_0xfcb1('0x33')](_0x528b77,function(_0xa71ec){return _0xa71ec[_0x835805[_0xfcb1('0x77')]];});}else{if(_0x26923f===_0xfcb1('0x78')){_0x3cfe02[_0xfcb1('0x7a')]=_[_0xfcb1('0x33')](_0x528b77,function(_0x36f9c5){return{'id':_0x36f9c5[_0xfcb1('0x69')],'type':_0x36f9c5['type']};});}else{_0x3cfe02[_0xfcb1('0x7a')]=_[_0xfcb1('0x33')](_0x528b77,function(_0x395ae7){return _0x395ae7[_0xfcb1('0x69')];});}}_0x378570(_0x3cfe02);})[_0xfcb1('0x49')](function(_0x4a8f36){_0x277625(_0x4a8f36);});}else{_0x378570(null);}});}function getQueryModels(_0x16a2ad,_0x1f373e){var _0x1df5ef=_0x16a2ad[_0xfcb1('0x89')]();var _0x237eb9={'childModel':undefined,'parentSections':[]};switch(_0x1df5ef){case'squareprojects':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x8a');break;case _0xfcb1('0x8b'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x8c');break;case _0xfcb1('0x8d'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x8e');_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0x8f'),'field':'name','foreignKey':'projectName'}];break;case _0xfcb1('0x90'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x91');break;case'contacts':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x82');_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0x92'),'field':'id','foreignKey':_0xfcb1('0x93')}];break;case _0xfcb1('0x94'):_0x237eb9['childModel']=_0xfcb1('0x95');break;case _0xfcb1('0x96'):_0x237eb9[_0xfcb1('0x75')]='CmCompany';break;case'globalcustomfields':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x97');break;case _0xfcb1('0x98'):_0x237eb9['childModel']=_0xfcb1('0x99');break;case _0xfcb1('0x9a'):_0x237eb9[_0xfcb1('0x75')]='ChatWebsite';break;case _0xfcb1('0x9b'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x9c');break;case _0xfcb1('0x9d'):_0x237eb9[_0xfcb1('0x75')]='FaxAccount';break;case _0xfcb1('0x9e'):case _0xfcb1('0x9f'):case _0xfcb1('0xa0'):_0x237eb9[_0xfcb1('0x75')]='VoiceExtension';break;case _0xfcb1('0xa1'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xa2');break;case _0xfcb1('0xa3'):_0x237eb9['childModel']=_0xfcb1('0xa4');break;case _0xfcb1('0xa5'):_0x237eb9['childModel']=_0xfcb1('0xa6');_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0xa7'),'field':_0xfcb1('0x2a'),'foreignKey':_0xfcb1('0xa8'),'model':'User','filter':{'field':_0xfcb1('0xa9'),'value':[_0xfcb1('0xaa')]}},{'name':'Telephones','field':_0xfcb1('0x2a'),'foreignKey':'membername','model':_0xfcb1('0xab'),'filter':{'field':_0xfcb1('0xa9'),'value':[_0xfcb1('0xac')]}},{'name':_0xfcb1('0xad'),'field':_0xfcb1('0x2a'),'foreignKey':_0xfcb1('0xae'),'model':_0xfcb1('0xaf'),'filter':{'field':'type','value':['inbound']}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xfcb1('0xae'),'model':_0xfcb1('0xaf'),'filter':{'field':_0xfcb1('0x30'),'value':[_0xfcb1('0xb0')]}}];break;case _0xfcb1('0xb1'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xb2');break;case _0xfcb1('0xb3'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xb4');break;case _0xfcb1('0xb5'):_0x237eb9['childModel']=_0xfcb1('0xb6');break;case _0xfcb1('0xb7'):_0x237eb9['childModel']='Campaign';break;case'mailqueues':_0x237eb9['childModel']=_0xfcb1('0xb8');break;case _0xfcb1('0xb9'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xba');break;case'mailsubstatuses':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xbb');break;case _0xfcb1('0xbc'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xbd');break;case _0xfcb1('0xbe'):_0x237eb9[_0xfcb1('0x75')]='OpenchannelAccount';break;case _0xfcb1('0xbf'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xc0');break;case _0xfcb1('0xc1'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xc2');break;case _0xfcb1('0xc3'):_0x237eb9['childModel']=_0xfcb1('0xc4');break;case _0xfcb1('0xc5'):_0x237eb9['childModel']=_0xfcb1('0xc6');break;case _0xfcb1('0xc7'):_0x237eb9[_0xfcb1('0x75')]='Team';break;case'voicequeues':case _0xfcb1('0xc8'):_0x237eb9[_0xfcb1('0x75')]='VoiceQueue';if(_0x1f373e){_0x237eb9[_0xfcb1('0x72')]=[{'name':'VoiceQueues'},{'name':_0xfcb1('0xc9')}];}break;case'users':case'agents':case _0xfcb1('0xca'):_0x237eb9['childModel']=_0xfcb1('0xab');if(_0x1f373e){_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0xcb'),'filter':{'field':'role','value':[_0xfcb1('0xcc'),'user']},'ignore':!![]},{'name':_0xfcb1('0xa7')},{'name':_0xfcb1('0xcd')}];}break;case _0xfcb1('0xce'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xcf');break;case _0xfcb1('0xd0'):_0x237eb9['childModel']=_0xfcb1('0xd1');break;case _0xfcb1('0xd2'):_0x237eb9[_0xfcb1('0x75')]='FreshdeskAccount';break;case _0xfcb1('0xd3'):_0x237eb9['childModel']='SugarcrmAccount';break;case _0xfcb1('0xd4'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xd5');break;case _0xfcb1('0xd6'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xd7');break;case _0xfcb1('0xd8'):_0x237eb9['childModel']=_0xfcb1('0xab');break;case _0xfcb1('0xd9'):_0x237eb9['childModel']=_0xfcb1('0xda');break;case _0xfcb1('0xdb'):_0x237eb9['childModel']=_0xfcb1('0xdc');break;case'customdashboards':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x66');break;case _0xfcb1('0xdd'):_0x237eb9[_0xfcb1('0x75')]='Interval';break;case _0xfcb1('0xde'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xdf');break;case _0xfcb1('0xe0'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xe1');break;case _0xfcb1('0xe2'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xe3');break;case _0xfcb1('0xe4'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x83');break;case'templates':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xe5');break;case _0xfcb1('0xe6'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xe7');break;case'trunks':_0x237eb9['childModel']=_0xfcb1('0xe8');break;case _0xfcb1('0xe9'):_0x237eb9[_0xfcb1('0x75')]='Variable';break;case _0xfcb1('0xea'):_0x237eb9[_0xfcb1('0x75')]='Plugin';break;case _0xfcb1('0xeb'):_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0x78');_0x237eb9[_0xfcb1('0x72')]=[{'name':_0xfcb1('0xec'),'field':'id','foreignKey':_0xfcb1('0x7d')}];break;case'metrics':_0x237eb9[_0xfcb1('0x75')]=_0xfcb1('0xed');break;case _0xfcb1('0xc5'):_0x237eb9['childModel']=_0xfcb1('0xc6');break;default:return _0x237eb9;}return _0x237eb9;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 73d3981..bbe338b 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 _0x297c=['remove','emit','hook','exports','events','UserProfile','setMaxListeners','save','update'];(function(_0x3b2b6a,_0x172d8e){var _0xb7f2a=function(_0x35d08f){while(--_0x35d08f){_0x3b2b6a['push'](_0x3b2b6a['shift']());}};_0xb7f2a(++_0x172d8e);}(_0x297c,0xe5));var _0xc297=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x297c[_0x18cd5b];return _0x5eaa52;};'use strict';var EventEmitter=require(_0xc297('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xc297('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xc297('0x2')](0x0);var events={'afterCreate':_0xc297('0x3'),'afterUpdate':_0xc297('0x4'),'afterDestroy':_0xc297('0x5')};function emitEvent(_0x21eb4d){return function(_0x1fc262,_0x2fdfd3,_0x7da889){UserProfileEvents[_0xc297('0x6')](_0x21eb4d+':'+_0x1fc262['id'],_0x1fc262);UserProfileEvents['emit'](_0x21eb4d,_0x1fc262);_0x7da889(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xc297('0x7')](e,emitEvent(event));}}module[_0xc297('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x36cd=['../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x36cd,0x112));var _0xd36c=function(_0x44cc74,_0x426cda){_0x44cc74=_0x44cc74-0x0;var _0x8761b4=_0x36cd[_0x44cc74];return _0x8761b4;};'use strict';var EventEmitter=require(_0xd36c('0x0'));var UserProfile=require(_0xd36c('0x1'))['db'][_0xd36c('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd36c('0x3')](0x0);var events={'afterCreate':_0xd36c('0x4'),'afterUpdate':_0xd36c('0x5'),'afterDestroy':_0xd36c('0x6')};function emitEvent(_0x42fa5a){return function(_0x3eb36b,_0x2a936d,_0x47bd19){UserProfileEvents['emit'](_0x42fa5a+':'+_0x3eb36b['id'],_0x3eb36b);UserProfileEvents[_0xd36c('0x7')](_0x42fa5a,_0x3eb36b);_0x47bd19(null);};}for(var e in events){if(events[_0xd36c('0x8')](e)){var event=events[e];UserProfile[_0xd36c('0x9')](e,emitEvent(event));}}module[_0xd36c('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 95c0950..ca7c2f9 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 _0xf9c5=['define','UserProfile','user_profiles','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userProfile.attributes','exports'];(function(_0x1e22a4,_0x1dba54){var _0x8e8535=function(_0x10ddd2){while(--_0x10ddd2){_0x1e22a4['push'](_0x1e22a4['shift']());}};_0x8e8535(++_0x1dba54);}(_0xf9c5,0xb9));var _0x5f9c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf9c5[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x5f9c('0x0'));var util=require(_0x5f9c('0x1'));var logger=require('../../config/logger')(_0x5f9c('0x2'));var moment=require(_0x5f9c('0x3'));var BPromise=require(_0x5f9c('0x4'));var rp=require(_0x5f9c('0x5'));var fs=require('fs');var path=require(_0x5f9c('0x6'));var rimraf=require('rimraf');var config=require(_0x5f9c('0x7'));var attributes=require(_0x5f9c('0x8'));module[_0x5f9c('0x9')]=function(_0x169b60,_0x170bc0){return _0x169b60[_0x5f9c('0xa')](_0x5f9c('0xb'),attributes,{'tableName':_0x5f9c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x756d=['user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfile.attributes','exports','define'];(function(_0x1772e7,_0x3be1fa){var _0x1c475e=function(_0x1ab8e7){while(--_0x1ab8e7){_0x1772e7['push'](_0x1772e7['shift']());}};_0x1c475e(++_0x3be1fa);}(_0x756d,0x112));var _0xd756=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x756d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd756('0x0'));var util=require(_0xd756('0x1'));var logger=require(_0xd756('0x2'))(_0xd756('0x3'));var moment=require(_0xd756('0x4'));var BPromise=require(_0xd756('0x5'));var rp=require(_0xd756('0x6'));var fs=require('fs');var path=require(_0xd756('0x7'));var rimraf=require('rimraf');var config=require(_0xd756('0x8'));var attributes=require(_0xd756('0x9'));module[_0xd756('0xa')]=function(_0x42ad5c,_0x637ffb){return _0x42ad5c[_0xd756('0xb')]('UserProfile',attributes,{'tableName':_0xd756('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index a5cc030..3153284 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 _0xeda8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xeda8,0x104));var _0x8eda=function(_0x2baa81,_0x4789cb){_0x2baa81=_0x2baa81-0x0;var _0x427f8f=_0xeda8[_0x2baa81];return _0x427f8f;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});config[_0x8eda('0xd')]=_['defaults'](config[_0x8eda('0xd')],{'host':_0x8eda('0xe'),'port':0x18eb});var socket=require(_0x8eda('0xf'))(new Redis(config[_0x8eda('0xd')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x488849,_0x4fbf0a,_0xe69181){return new BPromise(function(_0x2d3739,_0x41442d){return client['request'](_0x488849,_0xe69181)[_0x8eda('0x10')](function(_0x5a80ca){logger[_0x8eda('0x11')](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));logger[_0x8eda('0x14')](_0x8eda('0x15'),_0x4fbf0a,_0x8eda('0x13'),JSON[_0x8eda('0x16')](_0x5a80ca));if(_0x5a80ca[_0x8eda('0x17')]){if(_0x5a80ca['error']['code']===0x1f4){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x41442d(_0x5a80ca[_0x8eda('0x17')][_0x8eda('0x18')]);}logger['error'](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x2d3739(_0x5a80ca['error'][_0x8eda('0x18')]);}else{logger['info'](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));_0x2d3739(_0x5a80ca['result']['message']);}})[_0x8eda('0x19')](function(_0x1b7e94){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x1b7e94);_0x41442d(_0x1b7e94);});});} \ No newline at end of file +var _0xeda8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xeda8,0x104));var _0x8eda=function(_0x1c05f0,_0x1f03ca){_0x1c05f0=_0x1c05f0-0x0;var _0x438425=_0xeda8[_0x1c05f0];return _0x438425;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});config[_0x8eda('0xd')]=_['defaults'](config[_0x8eda('0xd')],{'host':_0x8eda('0xe'),'port':0x18eb});var socket=require(_0x8eda('0xf'))(new Redis(config[_0x8eda('0xd')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x488849,_0x4fbf0a,_0xe69181){return new BPromise(function(_0x2d3739,_0x41442d){return client['request'](_0x488849,_0xe69181)[_0x8eda('0x10')](function(_0x5a80ca){logger[_0x8eda('0x11')](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));logger[_0x8eda('0x14')](_0x8eda('0x15'),_0x4fbf0a,_0x8eda('0x13'),JSON[_0x8eda('0x16')](_0x5a80ca));if(_0x5a80ca[_0x8eda('0x17')]){if(_0x5a80ca['error']['code']===0x1f4){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x41442d(_0x5a80ca[_0x8eda('0x17')][_0x8eda('0x18')]);}logger['error'](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x2d3739(_0x5a80ca['error'][_0x8eda('0x18')]);}else{logger['info'](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));_0x2d3739(_0x5a80ca['result']['message']);}})[_0x8eda('0x19')](function(_0x1b7e94){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x1b7e94);_0x41442d(_0x1b7e94);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e0eaf36..853d879 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 _0xfdd5=['./userProfile.events','save','remove','emit','removeListener','length','userProfile:'];(function(_0x5901b9,_0x3c3829){var _0x43cd20=function(_0x17a3bd){while(--_0x17a3bd){_0x5901b9['push'](_0x5901b9['shift']());}};_0x43cd20(++_0x3c3829);}(_0xfdd5,0xee));var _0x5fdd=function(_0x13e8b1,_0x3300a1){_0x13e8b1=_0x13e8b1-0x0;var _0x5d2409=_0xfdd5[_0x13e8b1];return _0x5d2409;};'use strict';var UserProfileEvents=require(_0x5fdd('0x0'));var events=[_0x5fdd('0x1'),_0x5fdd('0x2'),'update'];function createListener(_0xf96b6b,_0x5ef167){return function(_0x24e0ac){_0x5ef167[_0x5fdd('0x3')](_0xf96b6b,_0x24e0ac);};}function removeListener(_0x1a0253,_0xb40f74){return function(){UserProfileEvents[_0x5fdd('0x4')](_0x1a0253,_0xb40f74);};}exports['register']=function(_0x178389){for(var _0x1b0915=0x0,_0x28d6a1=events[_0x5fdd('0x5')];_0x1b0915<_0x28d6a1;_0x1b0915++){var _0x2b90e6=events[_0x1b0915];var _0xdd22d5=createListener(_0x5fdd('0x6')+_0x2b90e6,_0x178389);UserProfileEvents['on'](_0x2b90e6,_0xdd22d5);}}; \ No newline at end of file +var _0xbc80=['./userProfile.events','remove','register','length'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xbc80,0x180));var _0x0bc8=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xbc80[_0x344a3f];return _0x264712;};'use strict';var UserProfileEvents=require(_0x0bc8('0x0'));var events=['save',_0x0bc8('0x1'),'update'];function createListener(_0x307218,_0x269b39){return function(_0x5b4389){_0x269b39['emit'](_0x307218,_0x5b4389);};}function removeListener(_0x419186,_0xbf28a4){return function(){UserProfileEvents['removeListener'](_0x419186,_0xbf28a4);};}exports[_0x0bc8('0x2')]=function(_0x3dfeb0){for(var _0x88cd5f=0x0,_0x53f757=events[_0x0bc8('0x3')];_0x88cd5f<_0x53f757;_0x88cd5f++){var _0x35a367=events[_0x88cd5f];var _0x20d78d=createListener('userProfile:'+_0x35a367,_0x3dfeb0);UserProfileEvents['on'](_0x35a367,_0x20d78d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 79d34d7..da1242a 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 _0x7e37=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy'];(function(_0x3bd37a,_0x4a5ec3){var _0x1c9134=function(_0x392176){while(--_0x392176){_0x3bd37a['push'](_0x3bd37a['shift']());}};_0x1c9134(++_0x4a5ec3);}(_0x7e37,0xf3));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x77e3('0x0'));var util=require(_0x77e3('0x1'));var path=require(_0x77e3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77e3('0x3')]();var auth=require(_0x77e3('0x4'));var interaction=require(_0x77e3('0x5'));var config=require(_0x77e3('0x6'));var controller=require(_0x77e3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x77e3('0x8')]);router[_0x77e3('0x9')](_0x77e3('0xa'),auth[_0x77e3('0xb')](),controller[_0x77e3('0xc')]);router[_0x77e3('0x9')]('/:id',auth[_0x77e3('0xb')](),controller[_0x77e3('0xd')]);router[_0x77e3('0xe')]('/',auth['isAuthenticated'](),controller[_0x77e3('0xf')]);router[_0x77e3('0x10')](_0x77e3('0x11'),auth[_0x77e3('0xb')](),controller[_0x77e3('0x12')]);router[_0x77e3('0x13')](_0x77e3('0x11'),auth['isAuthenticated'](),controller[_0x77e3('0x14')]);module[_0x77e3('0x15')]=router; \ No newline at end of file +var _0x3e05=['put','/:id','update','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3e05,0x64));var _0x53e0=function(_0x393575,_0x18ec1f){_0x393575=_0x393575-0x0;var _0x358396=_0x3e05[_0x393575];return _0x358396;};'use strict';var multer=require('multer');var util=require(_0x53e0('0x0'));var path=require(_0x53e0('0x1'));var timeout=require(_0x53e0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x53e0('0x3'));var interaction=require(_0x53e0('0x4'));var config=require(_0x53e0('0x5'));var controller=require(_0x53e0('0x6'));router[_0x53e0('0x7')]('/',auth[_0x53e0('0x8')](),controller[_0x53e0('0x9')]);router[_0x53e0('0x7')](_0x53e0('0xa'),auth[_0x53e0('0x8')](),controller['describe']);router[_0x53e0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x53e0('0xb')]);router[_0x53e0('0xc')]('/',auth[_0x53e0('0x8')](),controller[_0x53e0('0xd')]);router[_0x53e0('0xe')](_0x53e0('0xf'),auth[_0x53e0('0x8')](),controller[_0x53e0('0x10')]);router['delete'](_0x53e0('0xf'),auth[_0x53e0('0x8')](),controller[_0x53e0('0x11')]);module[_0x53e0('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 22a3ce9..5936fa2 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 _0xa93e=['STRING','sequelize','exports','INTEGER'];(function(_0x4ce9ac,_0xa01374){var _0x1d132a=function(_0x4c1498){while(--_0x4c1498){_0x4ce9ac['push'](_0x4ce9ac['shift']());}};_0x1d132a(++_0xa01374);}(_0xa93e,0x109));var _0xea93=function(_0x5ee58a,_0xdd4a44){_0x5ee58a=_0x5ee58a-0x0;var _0x29bbe6=_0xa93e[_0x5ee58a];return _0x29bbe6;};'use strict';var Sequelize=require(_0xea93('0x0'));module[_0xea93('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xea93('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xea93('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x6a5f=['sequelize','exports','INTEGER'];(function(_0x3cdba4,_0x38853d){var _0x5b35bc=function(_0x3d77e7){while(--_0x3d77e7){_0x3cdba4['push'](_0x3cdba4['shift']());}};_0x5b35bc(++_0x38853d);}(_0x6a5f,0x81));var _0xf6a5=function(_0x44d797,_0x276017){_0x44d797=_0x44d797-0x0;var _0x4005c2=_0x6a5f[_0x44d797];return _0x4005c2;};'use strict';var Sequelize=require(_0xf6a5('0x0'));module[_0xf6a5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xf6a5('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 7f68af5..00d66dc 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 _0xdb94=['type','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','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','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','where','filters','filter','merge'];(function(_0x59631f,_0x178e26){var _0x1746be=function(_0x308ddf){while(--_0x308ddf){_0x59631f['push'](_0x59631f['shift']());}};_0x1746be(++_0x178e26);}(_0xdb94,0xe5));var _0x4db9=function(_0x589750,_0x5efe1a){_0x589750=_0x589750-0x0;var _0x49b7ab=_0xdb94[_0x589750];return _0x49b7ab;};'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(){_0x29b4ff['status'](0xcc)[_0x4db9('0x1a')]();});}};}function handleEntityNotFound(_0x3f4931,_0x4419af){return function(_0x402898){if(!_0x402898){_0x3f4931['sendStatus'](0x194);}return _0x402898;};}function handleError(_0xe3dbe,_0x506cc9){_0x506cc9=_0x506cc9||0x1f4;return function(_0x1cf805){logger[_0x4db9('0x25')](_0x1cf805[_0x4db9('0x26')]);if(_0x1cf805[_0x4db9('0x27')]){delete _0x1cf805[_0x4db9('0x27')];}_0xe3dbe[_0x4db9('0x19')](_0x506cc9)[_0x4db9('0x28')](_0x1cf805);};}exports['index']=function(_0x5f59be,_0x1b2647){var _0x5ce6cc={},_0x910137={},_0x2653be={'count':0x0,'rows':[]};var _0x38d5e2=_[_0x4db9('0x29')](db[_0x4db9('0x2a')][_0x4db9('0x2b')],function(_0x1d0dc2){return{'name':_0x1d0dc2[_0x4db9('0x2c')],'type':_0x1d0dc2['type'][_0x4db9('0x2d')]};});_0x910137['model']=_[_0x4db9('0x29')](_0x38d5e2,_0x4db9('0x27'));_0x910137[_0x4db9('0x2e')]=_[_0x4db9('0x2f')](_0x5f59be[_0x4db9('0x2e')]);_0x910137['filters']=_[_0x4db9('0x30')](_0x910137[_0x4db9('0x31')],_0x910137[_0x4db9('0x2e')]);_0x5ce6cc[_0x4db9('0x32')]=_['intersection'](_0x910137['model'],qs[_0x4db9('0x33')](_0x5f59be[_0x4db9('0x2e')]['fields']));_0x5ce6cc['attributes']=_0x5ce6cc[_0x4db9('0x32')]['length']?_0x5ce6cc['attributes']:_0x910137[_0x4db9('0x31')];if(!_0x5f59be[_0x4db9('0x2e')]['hasOwnProperty'](_0x4db9('0x34'))){_0x5ce6cc[_0x4db9('0x1e')]=qs[_0x4db9('0x1e')](_0x5f59be[_0x4db9('0x2e')]['limit']);_0x5ce6cc[_0x4db9('0x1d')]=qs['offset'](_0x5f59be['query']['offset']);}_0x5ce6cc[_0x4db9('0x35')]=qs[_0x4db9('0x36')](_0x5f59be['query'][_0x4db9('0x36')]);_0x5ce6cc[_0x4db9('0x37')]=qs['filters'](_['pick'](_0x5f59be['query'],_0x910137[_0x4db9('0x38')]),_0x38d5e2);if(_0x5f59be['query'][_0x4db9('0x39')]){_0x5ce6cc['where']=_[_0x4db9('0x3a')](_0x5ce6cc[_0x4db9('0x37')],{'$or':_[_0x4db9('0x29')](_0x38d5e2,function(_0x10ccbc){if(_0x10ccbc[_0x4db9('0x3b')]!=='VIRTUAL'){var _0x1cf917={};_0x1cf917[_0x10ccbc['name']]={'$like':'%'+_0x5f59be[_0x4db9('0x2e')][_0x4db9('0x39')]+'%'};return _0x1cf917;}})});}_0x5ce6cc=_[_0x4db9('0x3a')]({},_0x5ce6cc,_0x5f59be[_0x4db9('0x3c')]);var _0x146850={'where':_0x5ce6cc[_0x4db9('0x37')]};return db['UserProfileResource'][_0x4db9('0x1c')](_0x146850)[_0x4db9('0x23')](function(_0x5ba7df){_0x2653be['count']=_0x5ba7df;if(_0x5f59be[_0x4db9('0x2e')][_0x4db9('0x3d')]){_0x5ce6cc[_0x4db9('0x3e')]=[{'all':!![]}];}return db[_0x4db9('0x2a')][_0x4db9('0x3f')](_0x5ce6cc);})[_0x4db9('0x23')](function(_0x1a9fe7){_0x2653be[_0x4db9('0x40')]=_0x1a9fe7;return _0x2653be;})[_0x4db9('0x23')](respondWithFilteredResult(_0x1b2647,_0x5ce6cc))[_0x4db9('0x41')](handleError(_0x1b2647,null));};exports[_0x4db9('0x42')]=function(_0x3254d1,_0x489967){var _0x2716d6={'raw':![],'where':{'id':_0x3254d1[_0x4db9('0x43')]['id']}},_0x4a2121={};_0x4a2121[_0x4db9('0x31')]=_['keys'](db['UserProfileResource'][_0x4db9('0x2b')]);_0x4a2121[_0x4db9('0x2e')]=_[_0x4db9('0x2f')](_0x3254d1['query']);_0x4a2121[_0x4db9('0x38')]=_['intersection'](_0x4a2121[_0x4db9('0x31')],_0x4a2121[_0x4db9('0x2e')]);_0x2716d6[_0x4db9('0x32')]=_[_0x4db9('0x30')](_0x4a2121[_0x4db9('0x31')],qs['fields'](_0x3254d1[_0x4db9('0x2e')][_0x4db9('0x33')]));_0x2716d6[_0x4db9('0x32')]=_0x2716d6[_0x4db9('0x32')][_0x4db9('0x44')]?_0x2716d6['attributes']:_0x4a2121[_0x4db9('0x31')];if(_0x3254d1[_0x4db9('0x2e')][_0x4db9('0x3d')]){_0x2716d6[_0x4db9('0x3e')]=[{'all':!![]}];}_0x2716d6=_[_0x4db9('0x3a')]({},_0x2716d6,_0x3254d1[_0x4db9('0x3c')]);return db[_0x4db9('0x2a')][_0x4db9('0x45')](_0x2716d6)[_0x4db9('0x23')](handleEntityNotFound(_0x489967,null))['then'](respondWithResult(_0x489967,null))[_0x4db9('0x41')](handleError(_0x489967,null));};exports['create']=function(_0x53f3bb,_0x21d18d){return db[_0x4db9('0x2a')]['create'](_0x53f3bb['body'],{})[_0x4db9('0x23')](respondWithResult(_0x21d18d,0xc9))[_0x4db9('0x41')](handleError(_0x21d18d,null));};exports[_0x4db9('0x22')]=function(_0x7f0aac,_0x2c2c17){if(_0x7f0aac[_0x4db9('0x46')]['id']){delete _0x7f0aac[_0x4db9('0x46')]['id'];}return db[_0x4db9('0x2a')][_0x4db9('0x45')]({'where':{'id':_0x7f0aac[_0x4db9('0x43')]['id']}})[_0x4db9('0x23')](handleEntityNotFound(_0x2c2c17,null))['then'](saveUpdates(_0x7f0aac[_0x4db9('0x46')],null))[_0x4db9('0x23')](respondWithResult(_0x2c2c17,null))['catch'](handleError(_0x2c2c17,null));};exports[_0x4db9('0x24')]=function(_0x5a461d,_0x26ae1a){return db[_0x4db9('0x2a')][_0x4db9('0x45')]({'where':{'id':_0x5a461d[_0x4db9('0x43')]['id']}})[_0x4db9('0x23')](handleEntityNotFound(_0x26ae1a,null))[_0x4db9('0x23')](removeEntity(_0x26ae1a,null))[_0x4db9('0x41')](handleError(_0x26ae1a,null));};exports[_0x4db9('0x47')]=function(_0x2f77f9,_0x30aa0a){return db[_0x4db9('0x2a')][_0x4db9('0x47')]()[_0x4db9('0x23')](respondWithResult(_0x30aa0a,null))['catch'](handleError(_0x30aa0a,null));}; \ No newline at end of file +var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','intersection','options','catch','create','body','find','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x466468,_0x4c4af4){var _0x44756c=function(_0x2b1196){while(--_0x2b1196){_0x466468['push'](_0x466468['shift']());}};_0x44756c(++_0x4c4af4);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0x24ca[_0x4b1032];return _0x5a1d55;};'use strict';var pdf=require(_0xa24c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa24c('0x1'));var zipdir=require(_0xa24c('0x2'));var jsonpatch=require(_0xa24c('0x3'));var rp=require('request-promise');var moment=require(_0xa24c('0x4'));var BPromise=require(_0xa24c('0x5'));var Mustache=require(_0xa24c('0x6'));var util=require(_0xa24c('0x7'));var path=require(_0xa24c('0x8'));var sox=require(_0xa24c('0x9'));var csv=require(_0xa24c('0xa'));var ejs=require(_0xa24c('0xb'));var fs=require('fs');var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0xa'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43bcd3,_0x11090c){_0x11090c=_0x11090c||0xcc;return function(_0xcee4fe){if(_0xcee4fe){return _0x43bcd3[_0xa24c('0x1a')](_0x11090c);}return _0x43bcd3['status'](_0x11090c)[_0xa24c('0x1b')]();};}function respondWithResult(_0x3c23fc,_0x26ff28){_0x26ff28=_0x26ff28||0xc8;return function(_0x2fcd8b){if(_0x2fcd8b){return _0x3c23fc[_0xa24c('0x1c')](_0x26ff28)[_0xa24c('0x1d')](_0x2fcd8b);}};}function respondWithFilteredResult(_0x448275,_0x5d4727){return function(_0x47a063){if(_0x47a063){var _0xb80781=_0x47a063[_0xa24c('0x1e')],_0x87aa90=_0x5d4727[_0xa24c('0x1f')],_0x49ce53=_0x5d4727['offset']+_0x5d4727[_0xa24c('0x20')],_0x5babb5;if(_0x49ce53>=_0xb80781){_0x49ce53=_0xb80781;_0x5babb5=0xc8;}else{_0x5babb5=0xce;}_0x448275['status'](_0x5babb5);return _0x448275[_0xa24c('0x21')](_0xa24c('0x22'),_0x87aa90+'-'+_0x49ce53+'/'+_0xb80781)[_0xa24c('0x1d')](_0x47a063);}return null;};}function patchUpdates(_0xefdbd9){return function(_0x4ff97c){try{jsonpatch[_0xa24c('0x23')](_0x4ff97c,_0xefdbd9,!![]);}catch(_0x18b7e0){return BPromise[_0xa24c('0x24')](_0x18b7e0);}return _0x4ff97c['save']();};}function saveUpdates(_0x48a768,_0x506424){return function(_0x4cd77e){if(_0x4cd77e){return _0x4cd77e[_0xa24c('0x25')](_0x48a768)[_0xa24c('0x26')](function(_0x26e9c3){return _0x26e9c3;});}return null;};}function removeEntity(_0x180297,_0x51a275){return function(_0x30ec21){if(_0x30ec21){return _0x30ec21['destroy']()[_0xa24c('0x26')](function(){_0x180297[_0xa24c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(!_0x43a0c0){_0x346ee8[_0xa24c('0x1a')](0x194);}return _0x43a0c0;};}function handleError(_0x14cc65,_0x47e0eb){_0x47e0eb=_0x47e0eb||0x1f4;return function(_0xec9167){logger['error'](_0xec9167[_0xa24c('0x27')]);if(_0xec9167[_0xa24c('0x28')]){delete _0xec9167[_0xa24c('0x28')];}_0x14cc65['status'](_0x47e0eb)[_0xa24c('0x29')](_0xec9167);};}exports[_0xa24c('0x2a')]=function(_0x14fd5a,_0x314121){var _0x11e4e0={},_0x3ad0e6={},_0x39609a={'count':0x0,'rows':[]};var _0x5b23f4=_[_0xa24c('0x2b')](db[_0xa24c('0x2c')][_0xa24c('0x2d')],function(_0x12dbdc){return{'name':_0x12dbdc['fieldName'],'type':_0x12dbdc[_0xa24c('0x2e')][_0xa24c('0x2f')]};});_0x3ad0e6[_0xa24c('0x30')]=_['map'](_0x5b23f4,_0xa24c('0x28'));_0x3ad0e6[_0xa24c('0x31')]=_[_0xa24c('0x32')](_0x14fd5a['query']);_0x3ad0e6[_0xa24c('0x33')]=_['intersection'](_0x3ad0e6[_0xa24c('0x30')],_0x3ad0e6[_0xa24c('0x31')]);_0x11e4e0[_0xa24c('0x34')]=_['intersection'](_0x3ad0e6[_0xa24c('0x30')],qs[_0xa24c('0x35')](_0x14fd5a[_0xa24c('0x31')]['fields']));_0x11e4e0[_0xa24c('0x34')]=_0x11e4e0['attributes'][_0xa24c('0x36')]?_0x11e4e0[_0xa24c('0x34')]:_0x3ad0e6['model'];if(!_0x14fd5a['query'][_0xa24c('0x37')](_0xa24c('0x38'))){_0x11e4e0[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x20')]);_0x11e4e0[_0xa24c('0x1f')]=qs['offset'](_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x1f')]);}_0x11e4e0[_0xa24c('0x39')]=qs[_0xa24c('0x3a')](_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x3a')]);_0x11e4e0[_0xa24c('0x3b')]=qs[_0xa24c('0x33')](_[_0xa24c('0x3c')](_0x14fd5a[_0xa24c('0x31')],_0x3ad0e6['filters']),_0x5b23f4);if(_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x3d')]){_0x11e4e0[_0xa24c('0x3b')]=_[_0xa24c('0x3e')](_0x11e4e0['where'],{'$or':_['map'](_0x5b23f4,function(_0x19a65f){if(_0x19a65f['type']!==_0xa24c('0x3f')){var _0x13f272={};_0x13f272[_0x19a65f[_0xa24c('0x28')]]={'$like':'%'+_0x14fd5a[_0xa24c('0x31')][_0xa24c('0x3d')]+'%'};return _0x13f272;}})});}_0x11e4e0=_['merge']({},_0x11e4e0,_0x14fd5a['options']);var _0x3121e={'where':_0x11e4e0[_0xa24c('0x3b')]};return db[_0xa24c('0x2c')][_0xa24c('0x1e')](_0x3121e)[_0xa24c('0x26')](function(_0x472912){_0x39609a['count']=_0x472912;if(_0x14fd5a['query'][_0xa24c('0x40')]){_0x11e4e0[_0xa24c('0x41')]=[{'all':!![]}];}return db[_0xa24c('0x2c')][_0xa24c('0x42')](_0x11e4e0);})[_0xa24c('0x26')](function(_0x4c5b7e){_0x39609a[_0xa24c('0x43')]=_0x4c5b7e;return _0x39609a;})[_0xa24c('0x26')](respondWithFilteredResult(_0x314121,_0x11e4e0))['catch'](handleError(_0x314121,null));};exports['show']=function(_0xba7407,_0x44f6ae){var _0x231eea={'raw':![],'where':{'id':_0xba7407['params']['id']}},_0x537849={};_0x537849[_0xa24c('0x30')]=_[_0xa24c('0x32')](db[_0xa24c('0x2c')][_0xa24c('0x2d')]);_0x537849[_0xa24c('0x31')]=_[_0xa24c('0x32')](_0xba7407[_0xa24c('0x31')]);_0x537849[_0xa24c('0x33')]=_['intersection'](_0x537849['model'],_0x537849[_0xa24c('0x31')]);_0x231eea[_0xa24c('0x34')]=_[_0xa24c('0x44')](_0x537849['model'],qs[_0xa24c('0x35')](_0xba7407[_0xa24c('0x31')][_0xa24c('0x35')]));_0x231eea[_0xa24c('0x34')]=_0x231eea[_0xa24c('0x34')][_0xa24c('0x36')]?_0x231eea[_0xa24c('0x34')]:_0x537849[_0xa24c('0x30')];if(_0xba7407[_0xa24c('0x31')][_0xa24c('0x40')]){_0x231eea['include']=[{'all':!![]}];}_0x231eea=_[_0xa24c('0x3e')]({},_0x231eea,_0xba7407[_0xa24c('0x45')]);return db[_0xa24c('0x2c')]['find'](_0x231eea)[_0xa24c('0x26')](handleEntityNotFound(_0x44f6ae,null))[_0xa24c('0x26')](respondWithResult(_0x44f6ae,null))[_0xa24c('0x46')](handleError(_0x44f6ae,null));};exports[_0xa24c('0x47')]=function(_0x3918a6,_0x16d340){return db[_0xa24c('0x2c')][_0xa24c('0x47')](_0x3918a6[_0xa24c('0x48')],{})[_0xa24c('0x26')](respondWithResult(_0x16d340,0xc9))[_0xa24c('0x46')](handleError(_0x16d340,null));};exports['update']=function(_0x29a84d,_0x96b977){if(_0x29a84d[_0xa24c('0x48')]['id']){delete _0x29a84d[_0xa24c('0x48')]['id'];}return db[_0xa24c('0x2c')][_0xa24c('0x49')]({'where':{'id':_0x29a84d[_0xa24c('0x4a')]['id']}})[_0xa24c('0x26')](handleEntityNotFound(_0x96b977,null))[_0xa24c('0x26')](saveUpdates(_0x29a84d['body'],null))['then'](respondWithResult(_0x96b977,null))[_0xa24c('0x46')](handleError(_0x96b977,null));};exports['destroy']=function(_0xc078ef,_0x1f436c){return db['UserProfileResource'][_0xa24c('0x49')]({'where':{'id':_0xc078ef[_0xa24c('0x4a')]['id']}})[_0xa24c('0x26')](handleEntityNotFound(_0x1f436c,null))['then'](removeEntity(_0x1f436c,null))['catch'](handleError(_0x1f436c,null));};exports[_0xa24c('0x4b')]=function(_0x5ba726,_0x4769a1){return db[_0xa24c('0x2c')][_0xa24c('0x4b')]()[_0xa24c('0x26')](respondWithResult(_0x4769a1,null))[_0xa24c('0x46')](handleError(_0x4769a1,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index dc9b628..7eae37c 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 _0xd8b0=['request-promise','path','rimraf','../../config/environment','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util','bluebird'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_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('./userProfileResource.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserProfileResource',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['resourceId',_0x0d8b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x878f=['rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x7550b2,_0xb765da){var _0x412744=function(_0x23b420){while(--_0x23b420){_0x7550b2['push'](_0x7550b2['shift']());}};_0x412744(++_0xb765da);}(_0x878f,0x173));var _0xf878=function(_0x5e8b95,_0x2ae446){_0x5e8b95=_0x5e8b95-0x0;var _0x43fe06=_0x878f[_0x5e8b95];return _0x43fe06;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0xf878('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 db09f3c..582006d 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 _0x9d85=['stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x27668f,_0x585edf){var _0x364100=function(_0x393eea){while(--_0x393eea){_0x27668f['push'](_0x27668f['shift']());}};_0x364100(++_0x585edf);}(_0x9d85,0x1a7));var _0x59d8=function(_0x406bb9,_0x11e58f){_0x406bb9=_0x406bb9-0x0;var _0x98bce1=_0x9d85[_0x406bb9];return _0x98bce1;};'use strict';var _=require(_0x59d8('0x0'));var util=require('util');var moment=require(_0x59d8('0x1'));var BPromise=require(_0x59d8('0x2'));var rs=require(_0x59d8('0x3'));var fs=require('fs');var Redis=require(_0x59d8('0x4'));var db=require(_0x59d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x59d8('0x6'));var config=require(_0x59d8('0x7'));var jayson=require(_0x59d8('0x8'));var client=jayson['client'][_0x59d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31e523,_0x52f60f,_0xd7a7c3){return new BPromise(function(_0x354ab9,_0x2e1c08){return client[_0x59d8('0xa')](_0x31e523,_0xd7a7c3)[_0x59d8('0xb')](function(_0x45fda9){logger[_0x59d8('0xc')](_0x59d8('0xd'),_0x52f60f,_0x59d8('0xe'));logger[_0x59d8('0xf')](_0x59d8('0x10'),_0x52f60f,_0x59d8('0xe'),JSON[_0x59d8('0x11')](_0x45fda9));if(_0x45fda9['error']){if(_0x45fda9[_0x59d8('0x12')][_0x59d8('0x13')]===0x1f4){logger[_0x59d8('0x12')](_0x59d8('0xd'),_0x52f60f,_0x45fda9[_0x59d8('0x12')][_0x59d8('0x14')]);return _0x2e1c08(_0x45fda9[_0x59d8('0x12')][_0x59d8('0x14')]);}logger[_0x59d8('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x52f60f,_0x45fda9[_0x59d8('0x12')][_0x59d8('0x14')]);return _0x354ab9(_0x45fda9['error'][_0x59d8('0x14')]);}else{logger[_0x59d8('0xc')](_0x59d8('0xd'),_0x52f60f,_0x59d8('0xe'));_0x354ab9(_0x45fda9['result'][_0x59d8('0x14')]);}})[_0x59d8('0x15')](function(_0xd80992){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x52f60f,_0xd80992);_0x2e1c08(_0xd80992);});});} \ No newline at end of file +var _0xae7a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x260e11,_0x81e165){var _0x317605=function(_0x369ba2){while(--_0x369ba2){_0x260e11['push'](_0x260e11['shift']());}};_0x317605(++_0x81e165);}(_0xae7a,0x98));var _0xaae7=function(_0x242f4d,_0x5ee66c){_0x242f4d=_0x242f4d-0x0;var _0x281b98=_0xae7a[_0x242f4d];return _0x281b98;};'use strict';var _=require('lodash');var util=require(_0xaae7('0x0'));var moment=require(_0xaae7('0x1'));var BPromise=require(_0xaae7('0x2'));var rs=require(_0xaae7('0x3'));var fs=require('fs');var Redis=require(_0xaae7('0x4'));var db=require(_0xaae7('0x5'))['db'];var utils=require(_0xaae7('0x6'));var logger=require(_0xaae7('0x7'))('rpc');var config=require(_0xaae7('0x8'));var jayson=require(_0xaae7('0x9'));var client=jayson['client'][_0xaae7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d0d71,_0x16c0e2,_0x328a02){return new BPromise(function(_0x3c9236,_0x1dbe98){return client[_0xaae7('0xb')](_0x1d0d71,_0x328a02)['then'](function(_0x5d2194){logger[_0xaae7('0xc')](_0xaae7('0xd'),_0x16c0e2,_0xaae7('0xe'));logger[_0xaae7('0xf')](_0xaae7('0x10'),_0x16c0e2,_0xaae7('0xe'),JSON[_0xaae7('0x11')](_0x5d2194));if(_0x5d2194[_0xaae7('0x12')]){if(_0x5d2194[_0xaae7('0x12')][_0xaae7('0x13')]===0x1f4){logger['error'](_0xaae7('0xd'),_0x16c0e2,_0x5d2194['error']['message']);return _0x1dbe98(_0x5d2194[_0xaae7('0x12')][_0xaae7('0x14')]);}logger[_0xaae7('0x12')](_0xaae7('0xd'),_0x16c0e2,_0x5d2194[_0xaae7('0x12')]['message']);return _0x3c9236(_0x5d2194['error']['message']);}else{logger[_0xaae7('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x16c0e2,'request\x20sent');_0x3c9236(_0x5d2194['result'][_0xaae7('0x14')]);}})[_0xaae7('0x15')](function(_0x6d1773){logger[_0xaae7('0x12')](_0xaae7('0xd'),_0x16c0e2,_0x6d1773);_0x1dbe98(_0x6d1773);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 11ee422..621a1cc 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 _0x7aa2=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','util'];(function(_0x51efbc,_0x8e401a){var _0x5e0d85=function(_0xe9d8fa){while(--_0xe9d8fa){_0x51efbc['push'](_0x51efbc['shift']());}};_0x5e0d85(++_0x8e401a);}(_0x7aa2,0x132));var _0x27aa=function(_0xdbfe3,_0x4ebddd){_0xdbfe3=_0xdbfe3-0x0;var _0x3454b0=_0x7aa2[_0xdbfe3];return _0x3454b0;};'use strict';var multer=require(_0x27aa('0x0'));var util=require(_0x27aa('0x1'));var path=require(_0x27aa('0x2'));var timeout=require(_0x27aa('0x3'));var express=require(_0x27aa('0x4'));var router=express[_0x27aa('0x5')]();var auth=require(_0x27aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x27aa('0x7'));var controller=require(_0x27aa('0x8'));router[_0x27aa('0x9')]('/',auth['isAuthenticated'](),controller[_0x27aa('0xa')]);router[_0x27aa('0x9')](_0x27aa('0xb'),auth[_0x27aa('0xc')](),controller[_0x27aa('0xd')]);router[_0x27aa('0x9')]('/:id',auth[_0x27aa('0xc')](),controller[_0x27aa('0xe')]);router[_0x27aa('0xf')]('/',auth[_0x27aa('0xc')](),controller[_0x27aa('0x10')]);router[_0x27aa('0x11')](_0x27aa('0x12'),auth['isAuthenticated'](),controller[_0x27aa('0x13')]);router[_0x27aa('0x14')]('/:id',auth[_0x27aa('0xc')](),controller[_0x27aa('0x15')]);module['exports']=router; \ No newline at end of file +var _0x842a=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','put'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x842a,0x181));var _0xa842=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x842a[_0x5a60ce];return _0x393e5e;};'use strict';var multer=require(_0xa842('0x0'));var util=require(_0xa842('0x1'));var path=require(_0xa842('0x2'));var timeout=require(_0xa842('0x3'));var express=require(_0xa842('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa842('0x5'));var config=require(_0xa842('0x6'));var controller=require(_0xa842('0x7'));router[_0xa842('0x8')]('/',auth[_0xa842('0x9')](),controller[_0xa842('0xa')]);router[_0xa842('0x8')](_0xa842('0xb'),auth['isAuthenticated'](),controller[_0xa842('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa842('0xd')]);router['post']('/',auth[_0xa842('0x9')](),controller['create']);router[_0xa842('0xe')](_0xa842('0xf'),auth[_0xa842('0x9')](),controller[_0xa842('0x10')]);router[_0xa842('0x11')]('/:id',auth[_0xa842('0x9')](),controller[_0xa842('0x12')]);module[_0xa842('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 21df3b4..0b5baad 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 _0x7b6f=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x394d13,_0x5adb71){var _0x4e4178=function(_0xf4f1d5){while(--_0xf4f1d5){_0x394d13['push'](_0x394d13['shift']());}};_0x4e4178(++_0x5adb71);}(_0x7b6f,0x6c));var _0xf7b6=function(_0x297220,_0x49bec5){_0x297220=_0x297220-0x0;var _0x532a3e=_0x7b6f[_0x297220];return _0x532a3e;};'use strict';var Sequelize=require(_0xf7b6('0x0'));module['exports']={'name':{'type':Sequelize[_0xf7b6('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xf7b6('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf7b6('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xf7b6('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf7b6('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xf7b6('0x1')],'set':function(_0x5105eb){this[_0xf7b6('0x4')](_0xf7b6('0x5'),_0x5105eb?_0x5105eb[_0xf7b6('0x6')](''):[]);},'get':function(){return this[_0xf7b6('0x7')](_0xf7b6('0x5'))?this[_0xf7b6('0x7')](_0xf7b6('0x5'))[_0xf7b6('0x8')](''):[];}}}; \ No newline at end of file +var _0x78d8=['setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x78d8,0x15c));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x878d('0x0')]={'name':{'type':Sequelize[_0x878d('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x878d('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x45ee75){this[_0x878d('0x2')](_0x878d('0x3'),_0x45ee75?_0x45ee75[_0x878d('0x4')](''):[]);},'get':function(){return this[_0x878d('0x5')](_0x878d('0x3'))?this[_0x878d('0x5')](_0x878d('0x3'))[_0x878d('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c892431..f493ab0 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 _0x88b4=['order','sort','where','pick','filter','VIRTUAL','merge','options','UserProfileSection','count','includeAll','include','catch','params','intersection','length','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','limit','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','offset'];(function(_0x1da140,_0x16683e){var _0x16461f=function(_0x439b09){while(--_0x439b09){_0x1da140['push'](_0x1da140['shift']());}};_0x16461f(++_0x16683e);}(_0x88b4,0xa8));var _0x488b=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x88b4[_0x468b0f];return _0x3e74d9;};'use strict';var pdf=require(_0x488b('0x0'));var emlformat=require(_0x488b('0x1'));var rimraf=require(_0x488b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x488b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x488b('0x4'));var Mustache=require(_0x488b('0x5'));var util=require(_0x488b('0x6'));var path=require(_0x488b('0x7'));var sox=require(_0x488b('0x8'));var csv=require(_0x488b('0x9'));var ejs=require(_0x488b('0xa'));var fs=require('fs');var _=require(_0x488b('0xb'));var squel=require(_0x488b('0xc'));var crypto=require(_0x488b('0xd'));var jsforce=require(_0x488b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x488b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x488b('0x10'));var qs=require(_0x488b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x488b('0x12'));var logger=require(_0x488b('0x13'))(_0x488b('0x14'));var utils=require(_0x488b('0x15'));var config=require(_0x488b('0x16'));var db=require(_0x488b('0x17'))['db'];function respondWithStatusCode(_0x2bb39a,_0x2744bf){_0x2744bf=_0x2744bf||0xcc;return function(_0x46d7cb){if(_0x46d7cb){return _0x2bb39a[_0x488b('0x18')](_0x2744bf);}return _0x2bb39a[_0x488b('0x19')](_0x2744bf)['end']();};}function respondWithResult(_0x2ec5bc,_0x1700bc){_0x1700bc=_0x1700bc||0xc8;return function(_0x198f46){if(_0x198f46){return _0x2ec5bc[_0x488b('0x19')](_0x1700bc)['json'](_0x198f46);}};}function respondWithFilteredResult(_0x3cfd90,_0x26797d){return function(_0x555be4){if(_0x555be4){var _0x5d189c=_0x555be4['count'],_0x5f390b=_0x26797d['offset'],_0x2d6e71=_0x26797d['offset']+_0x26797d[_0x488b('0x1a')],_0x4a33b3;if(_0x2d6e71>=_0x5d189c){_0x2d6e71=_0x5d189c;_0x4a33b3=0xc8;}else{_0x4a33b3=0xce;}_0x3cfd90[_0x488b('0x19')](_0x4a33b3);return _0x3cfd90[_0x488b('0x1b')](_0x488b('0x1c'),_0x5f390b+'-'+_0x2d6e71+'/'+_0x5d189c)[_0x488b('0x1d')](_0x555be4);}return null;};}function patchUpdates(_0x4f6edb){return function(_0x54c68d){try{jsonpatch[_0x488b('0x1e')](_0x54c68d,_0x4f6edb,!![]);}catch(_0x21894f){return BPromise['reject'](_0x21894f);}return _0x54c68d[_0x488b('0x1f')]();};}function saveUpdates(_0x341a17,_0x2193d7){return function(_0x20b584){if(_0x20b584){return _0x20b584[_0x488b('0x20')](_0x341a17)['then'](function(_0x17f239){return _0x17f239;});}return null;};}function removeEntity(_0x4ec8d8,_0x235075){return function(_0x2aec09){if(_0x2aec09){return _0x2aec09[_0x488b('0x21')]()[_0x488b('0x22')](function(){_0x4ec8d8[_0x488b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57c0d5,_0x56a145){return function(_0x364b88){if(!_0x364b88){_0x57c0d5[_0x488b('0x18')](0x194);}return _0x364b88;};}function handleError(_0x1297d5,_0x18b626){_0x18b626=_0x18b626||0x1f4;return function(_0x3ab91d){logger[_0x488b('0x23')](_0x3ab91d[_0x488b('0x24')]);if(_0x3ab91d[_0x488b('0x25')]){delete _0x3ab91d[_0x488b('0x25')];}_0x1297d5[_0x488b('0x19')](_0x18b626)[_0x488b('0x26')](_0x3ab91d);};}exports[_0x488b('0x27')]=function(_0x2be593,_0x2a71ba){var _0x4c57e5={},_0x3d0cd3={},_0x337b7b={'count':0x0,'rows':[]};var _0x186fea=_['map'](db['UserProfileSection'][_0x488b('0x28')],function(_0x8f36f1){return{'name':_0x8f36f1[_0x488b('0x29')],'type':_0x8f36f1[_0x488b('0x2a')][_0x488b('0x2b')]};});_0x3d0cd3[_0x488b('0x2c')]=_[_0x488b('0x2d')](_0x186fea,'name');_0x3d0cd3[_0x488b('0x2e')]=_[_0x488b('0x2f')](_0x2be593[_0x488b('0x2e')]);_0x3d0cd3[_0x488b('0x30')]=_['intersection'](_0x3d0cd3['model'],_0x3d0cd3['query']);_0x4c57e5[_0x488b('0x31')]=_['intersection'](_0x3d0cd3[_0x488b('0x2c')],qs[_0x488b('0x32')](_0x2be593[_0x488b('0x2e')][_0x488b('0x32')]));_0x4c57e5[_0x488b('0x31')]=_0x4c57e5[_0x488b('0x31')]['length']?_0x4c57e5[_0x488b('0x31')]:_0x3d0cd3['model'];if(!_0x2be593[_0x488b('0x2e')][_0x488b('0x33')](_0x488b('0x34'))){_0x4c57e5[_0x488b('0x1a')]=qs[_0x488b('0x1a')](_0x2be593[_0x488b('0x2e')][_0x488b('0x1a')]);_0x4c57e5[_0x488b('0x35')]=qs[_0x488b('0x35')](_0x2be593[_0x488b('0x2e')][_0x488b('0x35')]);}_0x4c57e5[_0x488b('0x36')]=qs[_0x488b('0x37')](_0x2be593[_0x488b('0x2e')][_0x488b('0x37')]);_0x4c57e5[_0x488b('0x38')]=qs['filters'](_[_0x488b('0x39')](_0x2be593['query'],_0x3d0cd3[_0x488b('0x30')]),_0x186fea);if(_0x2be593['query'][_0x488b('0x3a')]){_0x4c57e5[_0x488b('0x38')]=_['merge'](_0x4c57e5['where'],{'$or':_[_0x488b('0x2d')](_0x186fea,function(_0x39d694){if(_0x39d694[_0x488b('0x2a')]!==_0x488b('0x3b')){var _0x4b5b8a={};_0x4b5b8a[_0x39d694[_0x488b('0x25')]]={'$like':'%'+_0x2be593[_0x488b('0x2e')][_0x488b('0x3a')]+'%'};return _0x4b5b8a;}})});}_0x4c57e5=_[_0x488b('0x3c')]({},_0x4c57e5,_0x2be593[_0x488b('0x3d')]);var _0x40bd4c={'where':_0x4c57e5[_0x488b('0x38')]};return db[_0x488b('0x3e')][_0x488b('0x3f')](_0x40bd4c)[_0x488b('0x22')](function(_0x2f82a6){_0x337b7b[_0x488b('0x3f')]=_0x2f82a6;if(_0x2be593[_0x488b('0x2e')][_0x488b('0x40')]){_0x4c57e5[_0x488b('0x41')]=[{'all':!![]}];}return db[_0x488b('0x3e')]['findAll'](_0x4c57e5);})['then'](function(_0x4fee4c){_0x337b7b['rows']=_0x4fee4c;return _0x337b7b;})[_0x488b('0x22')](respondWithFilteredResult(_0x2a71ba,_0x4c57e5))[_0x488b('0x42')](handleError(_0x2a71ba,null));};exports['show']=function(_0x7a164e,_0x99a9f6){var _0x89749c={'raw':![],'where':{'id':_0x7a164e[_0x488b('0x43')]['id']}},_0x4945e9={};_0x4945e9[_0x488b('0x2c')]=_['keys'](db[_0x488b('0x3e')][_0x488b('0x28')]);_0x4945e9['query']=_[_0x488b('0x2f')](_0x7a164e[_0x488b('0x2e')]);_0x4945e9[_0x488b('0x30')]=_[_0x488b('0x44')](_0x4945e9[_0x488b('0x2c')],_0x4945e9[_0x488b('0x2e')]);_0x89749c[_0x488b('0x31')]=_[_0x488b('0x44')](_0x4945e9[_0x488b('0x2c')],qs[_0x488b('0x32')](_0x7a164e[_0x488b('0x2e')]['fields']));_0x89749c['attributes']=_0x89749c[_0x488b('0x31')][_0x488b('0x45')]?_0x89749c[_0x488b('0x31')]:_0x4945e9[_0x488b('0x2c')];if(_0x7a164e[_0x488b('0x2e')][_0x488b('0x40')]){_0x89749c[_0x488b('0x41')]=[{'all':!![]}];}_0x89749c=_['merge']({},_0x89749c,_0x7a164e[_0x488b('0x3d')]);return db['UserProfileSection'][_0x488b('0x46')](_0x89749c)[_0x488b('0x22')](handleEntityNotFound(_0x99a9f6,null))[_0x488b('0x22')](respondWithResult(_0x99a9f6,null))[_0x488b('0x42')](handleError(_0x99a9f6,null));};exports[_0x488b('0x47')]=function(_0x502f36,_0x1f3ac8){return db['UserProfileSection'][_0x488b('0x47')](_0x502f36[_0x488b('0x48')],{})[_0x488b('0x22')](respondWithResult(_0x1f3ac8,0xc9))[_0x488b('0x42')](handleError(_0x1f3ac8,null));};exports[_0x488b('0x20')]=function(_0x2836c8,_0x43755d){if(_0x2836c8[_0x488b('0x48')]['id']){delete _0x2836c8[_0x488b('0x48')]['id'];}return db[_0x488b('0x3e')][_0x488b('0x46')]({'where':{'id':_0x2836c8[_0x488b('0x43')]['id']}})[_0x488b('0x22')](handleEntityNotFound(_0x43755d,null))['then'](saveUpdates(_0x2836c8['body'],null))[_0x488b('0x22')](respondWithResult(_0x43755d,null))[_0x488b('0x42')](handleError(_0x43755d,null));};exports[_0x488b('0x21')]=function(_0x1b955b,_0x35dd3d){return db[_0x488b('0x3e')][_0x488b('0x46')]({'where':{'id':_0x1b955b[_0x488b('0x43')]['id']}})[_0x488b('0x22')](handleEntityNotFound(_0x35dd3d,null))[_0x488b('0x22')](removeEntity(_0x35dd3d,null))[_0x488b('0x42')](handleError(_0x35dd3d,null));};exports['describe']=function(_0x5dee48,_0x26f6c1){return db['UserProfileSection'][_0x488b('0x49')]()[_0x488b('0x22')](respondWithResult(_0x26f6c1,null))['catch'](handleError(_0x26f6c1,null));}; \ No newline at end of file +var _0x13c0=['offset','limit','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','map','UserProfileSection','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','update','body','destroy','params','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count'];(function(_0x5c805a,_0xcdbdbc){var _0x13e151=function(_0x29828a){while(--_0x29828a){_0x5c805a['push'](_0x5c805a['shift']());}};_0x13e151(++_0xcdbdbc);}(_0x13c0,0x79));var _0x013c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x13c0[_0x3ab9ee];return _0x82ee88;};'use strict';var pdf=require(_0x013c('0x0'));var emlformat=require(_0x013c('0x1'));var rimraf=require(_0x013c('0x2'));var zipdir=require(_0x013c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x013c('0x4'));var Mustache=require(_0x013c('0x5'));var util=require(_0x013c('0x6'));var path=require(_0x013c('0x7'));var sox=require(_0x013c('0x8'));var csv=require(_0x013c('0x9'));var ejs=require(_0x013c('0xa'));var fs=require('fs');var _=require(_0x013c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x013c('0xc'));var toCsv=require(_0x013c('0x9'));var querystring=require('querystring');var Papa=require(_0x013c('0xd'));var Redis=require(_0x013c('0xe'));var authService=require(_0x013c('0xf'));var qs=require(_0x013c('0x10'));var as=require(_0x013c('0x11'));var hardwareService=require(_0x013c('0x12'));var logger=require(_0x013c('0x13'))(_0x013c('0x14'));var utils=require(_0x013c('0x15'));var config=require(_0x013c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54aba0,_0xce456f){_0xce456f=_0xce456f||0xcc;return function(_0x4631c5){if(_0x4631c5){return _0x54aba0[_0x013c('0x17')](_0xce456f);}return _0x54aba0[_0x013c('0x18')](_0xce456f)['end']();};}function respondWithResult(_0x29c12f,_0x2313de){_0x2313de=_0x2313de||0xc8;return function(_0xcfe81a){if(_0xcfe81a){return _0x29c12f[_0x013c('0x18')](_0x2313de)[_0x013c('0x19')](_0xcfe81a);}};}function respondWithFilteredResult(_0x57f017,_0x307f34){return function(_0x1c2e11){if(_0x1c2e11){var _0x84244=_0x1c2e11[_0x013c('0x1a')],_0x92c3ca=_0x307f34[_0x013c('0x1b')],_0x1a5e16=_0x307f34[_0x013c('0x1b')]+_0x307f34[_0x013c('0x1c')],_0x1038d6;if(_0x1a5e16>=_0x84244){_0x1a5e16=_0x84244;_0x1038d6=0xc8;}else{_0x1038d6=0xce;}_0x57f017[_0x013c('0x18')](_0x1038d6);return _0x57f017[_0x013c('0x1d')](_0x013c('0x1e'),_0x92c3ca+'-'+_0x1a5e16+'/'+_0x84244)['json'](_0x1c2e11);}return null;};}function patchUpdates(_0x59bcbe){return function(_0x42d0a1){try{jsonpatch[_0x013c('0x1f')](_0x42d0a1,_0x59bcbe,!![]);}catch(_0x5752bd){return BPromise[_0x013c('0x20')](_0x5752bd);}return _0x42d0a1[_0x013c('0x21')]();};}function saveUpdates(_0x29c141,_0x38bac2){return function(_0xb87452){if(_0xb87452){return _0xb87452['update'](_0x29c141)[_0x013c('0x22')](function(_0x336022){return _0x336022;});}return null;};}function removeEntity(_0x48e6af,_0x1df9d2){return function(_0x82f9f1){if(_0x82f9f1){return _0x82f9f1['destroy']()['then'](function(){_0x48e6af[_0x013c('0x18')](0xcc)[_0x013c('0x23')]();});}};}function handleEntityNotFound(_0x2509f4,_0x447c0b){return function(_0x20aff2){if(!_0x20aff2){_0x2509f4[_0x013c('0x17')](0x194);}return _0x20aff2;};}function handleError(_0x186677,_0x1b9bdc){_0x1b9bdc=_0x1b9bdc||0x1f4;return function(_0x4ffb6d){logger[_0x013c('0x24')](_0x4ffb6d[_0x013c('0x25')]);if(_0x4ffb6d[_0x013c('0x26')]){delete _0x4ffb6d[_0x013c('0x26')];}_0x186677[_0x013c('0x18')](_0x1b9bdc)[_0x013c('0x27')](_0x4ffb6d);};}exports['index']=function(_0xc1e719,_0xd85349){var _0x21c86e={},_0x5f251b={},_0xa74f05={'count':0x0,'rows':[]};var _0x4f062f=_[_0x013c('0x28')](db[_0x013c('0x29')]['rawAttributes'],function(_0x353cb7){return{'name':_0x353cb7[_0x013c('0x2a')],'type':_0x353cb7[_0x013c('0x2b')][_0x013c('0x2c')]};});_0x5f251b[_0x013c('0x2d')]=_[_0x013c('0x28')](_0x4f062f,_0x013c('0x26'));_0x5f251b[_0x013c('0x2e')]=_[_0x013c('0x2f')](_0xc1e719[_0x013c('0x2e')]);_0x5f251b['filters']=_[_0x013c('0x30')](_0x5f251b[_0x013c('0x2d')],_0x5f251b[_0x013c('0x2e')]);_0x21c86e[_0x013c('0x31')]=_[_0x013c('0x30')](_0x5f251b['model'],qs[_0x013c('0x32')](_0xc1e719[_0x013c('0x2e')][_0x013c('0x32')]));_0x21c86e[_0x013c('0x31')]=_0x21c86e['attributes']['length']?_0x21c86e['attributes']:_0x5f251b[_0x013c('0x2d')];if(!_0xc1e719[_0x013c('0x2e')][_0x013c('0x33')](_0x013c('0x34'))){_0x21c86e[_0x013c('0x1c')]=qs[_0x013c('0x1c')](_0xc1e719[_0x013c('0x2e')][_0x013c('0x1c')]);_0x21c86e[_0x013c('0x1b')]=qs[_0x013c('0x1b')](_0xc1e719[_0x013c('0x2e')][_0x013c('0x1b')]);}_0x21c86e['order']=qs['sort'](_0xc1e719[_0x013c('0x2e')][_0x013c('0x35')]);_0x21c86e[_0x013c('0x36')]=qs[_0x013c('0x37')](_['pick'](_0xc1e719[_0x013c('0x2e')],_0x5f251b[_0x013c('0x37')]),_0x4f062f);if(_0xc1e719[_0x013c('0x2e')][_0x013c('0x38')]){_0x21c86e['where']=_[_0x013c('0x39')](_0x21c86e[_0x013c('0x36')],{'$or':_['map'](_0x4f062f,function(_0x1ddc7c){if(_0x1ddc7c['type']!==_0x013c('0x3a')){var _0x2ff0bb={};_0x2ff0bb[_0x1ddc7c[_0x013c('0x26')]]={'$like':'%'+_0xc1e719[_0x013c('0x2e')]['filter']+'%'};return _0x2ff0bb;}})});}_0x21c86e=_[_0x013c('0x39')]({},_0x21c86e,_0xc1e719[_0x013c('0x3b')]);var _0x391f1f={'where':_0x21c86e[_0x013c('0x36')]};return db[_0x013c('0x29')][_0x013c('0x1a')](_0x391f1f)[_0x013c('0x22')](function(_0x4408a4){_0xa74f05[_0x013c('0x1a')]=_0x4408a4;if(_0xc1e719['query'][_0x013c('0x3c')]){_0x21c86e[_0x013c('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0x013c('0x3e')](_0x21c86e);})[_0x013c('0x22')](function(_0x5c7863){_0xa74f05[_0x013c('0x3f')]=_0x5c7863;return _0xa74f05;})[_0x013c('0x22')](respondWithFilteredResult(_0xd85349,_0x21c86e))[_0x013c('0x40')](handleError(_0xd85349,null));};exports[_0x013c('0x41')]=function(_0x11a0b4,_0x5eb1db){var _0x3d0ffd={'raw':![],'where':{'id':_0x11a0b4['params']['id']}},_0x4ea6c3={};_0x4ea6c3['model']=_['keys'](db[_0x013c('0x29')][_0x013c('0x42')]);_0x4ea6c3[_0x013c('0x2e')]=_['keys'](_0x11a0b4[_0x013c('0x2e')]);_0x4ea6c3[_0x013c('0x37')]=_[_0x013c('0x30')](_0x4ea6c3[_0x013c('0x2d')],_0x4ea6c3[_0x013c('0x2e')]);_0x3d0ffd['attributes']=_[_0x013c('0x30')](_0x4ea6c3[_0x013c('0x2d')],qs['fields'](_0x11a0b4['query']['fields']));_0x3d0ffd['attributes']=_0x3d0ffd[_0x013c('0x31')][_0x013c('0x43')]?_0x3d0ffd['attributes']:_0x4ea6c3[_0x013c('0x2d')];if(_0x11a0b4[_0x013c('0x2e')]['includeAll']){_0x3d0ffd[_0x013c('0x3d')]=[{'all':!![]}];}_0x3d0ffd=_[_0x013c('0x39')]({},_0x3d0ffd,_0x11a0b4[_0x013c('0x3b')]);return db[_0x013c('0x29')][_0x013c('0x44')](_0x3d0ffd)[_0x013c('0x22')](handleEntityNotFound(_0x5eb1db,null))[_0x013c('0x22')](respondWithResult(_0x5eb1db,null))[_0x013c('0x40')](handleError(_0x5eb1db,null));};exports['create']=function(_0x242eac,_0x499f0d){return db[_0x013c('0x29')]['create'](_0x242eac['body'],{})[_0x013c('0x22')](respondWithResult(_0x499f0d,0xc9))['catch'](handleError(_0x499f0d,null));};exports[_0x013c('0x45')]=function(_0x35f81,_0x3352c3){if(_0x35f81[_0x013c('0x46')]['id']){delete _0x35f81['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x35f81['params']['id']}})[_0x013c('0x22')](handleEntityNotFound(_0x3352c3,null))['then'](saveUpdates(_0x35f81[_0x013c('0x46')],null))[_0x013c('0x22')](respondWithResult(_0x3352c3,null))[_0x013c('0x40')](handleError(_0x3352c3,null));};exports[_0x013c('0x47')]=function(_0x104a68,_0x2e99db){return db[_0x013c('0x29')][_0x013c('0x44')]({'where':{'id':_0x104a68[_0x013c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e99db,null))[_0x013c('0x22')](removeEntity(_0x2e99db,null))['catch'](handleError(_0x2e99db,null));};exports['describe']=function(_0x12236a,_0x5f2b11){return db['UserProfileSection'][_0x013c('0x49')]()[_0x013c('0x22')](respondWithResult(_0x5f2b11,null))['catch'](handleError(_0x5f2b11,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 5c5b163..25de824 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 _0xff5d=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection'];(function(_0x1084af,_0x3c1eb2){var _0xe61732=function(_0x1daf63){while(--_0x1daf63){_0x1084af['push'](_0x1084af['shift']());}};_0xe61732(++_0x3c1eb2);}(_0xff5d,0xf4));var _0xdff5=function(_0x3e0913,_0x28e7a7){_0x3e0913=_0x3e0913-0x0;var _0x457825=_0xff5d[_0x3e0913];return _0x457825;};'use strict';var _=require(_0xdff5('0x0'));var util=require(_0xdff5('0x1'));var logger=require('../../config/logger')(_0xdff5('0x2'));var moment=require(_0xdff5('0x3'));var BPromise=require(_0xdff5('0x4'));var rp=require(_0xdff5('0x5'));var fs=require('fs');var path=require(_0xdff5('0x6'));var rimraf=require(_0xdff5('0x7'));var config=require(_0xdff5('0x8'));var attributes=require(_0xdff5('0x9'));module[_0xdff5('0xa')]=function(_0x454bb4,_0x3e5946){return _0x454bb4['define'](_0xdff5('0xb'),attributes,{'tableName':_0xdff5('0xc'),'paranoid':![],'indexes':[{'name':_0xdff5('0xd'),'fields':[_0xdff5('0xe'),_0xdff5('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3142=['sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3142,0x10f));var _0x2314=function(_0x2242a1,_0x38f44d){_0x2242a1=_0x2242a1-0x0;var _0x2c298b=_0x3142[_0x2242a1];return _0x2c298b;};'use strict';var _=require(_0x2314('0x0'));var util=require('util');var logger=require(_0x2314('0x1'))(_0x2314('0x2'));var moment=require(_0x2314('0x3'));var BPromise=require(_0x2314('0x4'));var rp=require(_0x2314('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2314('0x6'));var config=require(_0x2314('0x7'));var attributes=require(_0x2314('0x8'));module[_0x2314('0x9')]=function(_0x1d65c2,_0x546515){return _0x1d65c2[_0x2314('0xa')](_0x2314('0xb'),attributes,{'tableName':_0x2314('0xc'),'paranoid':![],'indexes':[{'name':_0x2314('0xd'),'fields':[_0x2314('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 4330580..87674ec 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 _0x7f86=['rpc','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x54caf4,_0x129baa){var _0x4b7650=function(_0x29233d){while(--_0x29233d){_0x54caf4['push'](_0x54caf4['shift']());}};_0x4b7650(++_0x129baa);}(_0x7f86,0xea));var _0x67f8=function(_0x26c4c5,_0x493d6d){_0x26c4c5=_0x26c4c5-0x0;var _0x23152b=_0x7f86[_0x26c4c5];return _0x23152b;};'use strict';var _=require(_0x67f8('0x0'));var util=require(_0x67f8('0x1'));var moment=require(_0x67f8('0x2'));var BPromise=require(_0x67f8('0x3'));var rs=require(_0x67f8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67f8('0x5'))['db'];var utils=require(_0x67f8('0x6'));var logger=require(_0x67f8('0x7'))(_0x67f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x67f8('0x9'));var client=jayson[_0x67f8('0xa')][_0x67f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d8d1a,_0x4eb036,_0x8bf433){return new BPromise(function(_0xe4b2f1,_0xfc0abf){return client[_0x67f8('0xc')](_0x5d8d1a,_0x8bf433)['then'](function(_0x3601c0){logger[_0x67f8('0xd')](_0x67f8('0xe'),_0x4eb036,_0x67f8('0xf'));logger[_0x67f8('0x10')](_0x67f8('0x11'),_0x4eb036,'request\x20sent',JSON[_0x67f8('0x12')](_0x3601c0));if(_0x3601c0['error']){if(_0x3601c0['error']['code']===0x1f4){logger[_0x67f8('0x13')](_0x67f8('0xe'),_0x4eb036,_0x3601c0[_0x67f8('0x13')]['message']);return _0xfc0abf(_0x3601c0[_0x67f8('0x13')][_0x67f8('0x14')]);}logger[_0x67f8('0x13')](_0x67f8('0xe'),_0x4eb036,_0x3601c0[_0x67f8('0x13')][_0x67f8('0x14')]);return _0xe4b2f1(_0x3601c0[_0x67f8('0x13')]['message']);}else{logger['info'](_0x67f8('0xe'),_0x4eb036,_0x67f8('0xf'));_0xe4b2f1(_0x3601c0[_0x67f8('0x15')][_0x67f8('0x14')]);}})['catch'](function(_0x33ed8f){logger[_0x67f8('0x13')](_0x67f8('0xe'),_0x4eb036,_0x33ed8f);_0xfc0abf(_0x33ed8f);});});} \ No newline at end of file +var _0xd70b=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserProfileSection,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xd70b,0x17b));var _0xbd70=function(_0x40ff3b,_0x238af7){_0x40ff3b=_0x40ff3b-0x0;var _0x3ccf4f=_0xd70b[_0x40ff3b];return _0x3ccf4f;};'use strict';var _=require(_0xbd70('0x0'));var util=require(_0xbd70('0x1'));var moment=require(_0xbd70('0x2'));var BPromise=require(_0xbd70('0x3'));var rs=require(_0xbd70('0x4'));var fs=require('fs');var Redis=require(_0xbd70('0x5'));var db=require(_0xbd70('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd70('0x7'))(_0xbd70('0x8'));var config=require(_0xbd70('0x9'));var jayson=require(_0xbd70('0xa'));var client=jayson[_0xbd70('0xb')][_0xbd70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b90c0,_0x103d00,_0x51344d){return new BPromise(function(_0x25bca8,_0x1c414c){return client[_0xbd70('0xd')](_0x4b90c0,_0x51344d)['then'](function(_0x488578){logger[_0xbd70('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x103d00,'request\x20sent');logger[_0xbd70('0xf')](_0xbd70('0x10'),_0x103d00,_0xbd70('0x11'),JSON[_0xbd70('0x12')](_0x488578));if(_0x488578[_0xbd70('0x13')]){if(_0x488578[_0xbd70('0x13')]['code']===0x1f4){logger[_0xbd70('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x103d00,_0x488578[_0xbd70('0x13')][_0xbd70('0x14')]);return _0x1c414c(_0x488578[_0xbd70('0x13')]['message']);}logger['error'](_0xbd70('0x15'),_0x103d00,_0x488578[_0xbd70('0x13')][_0xbd70('0x14')]);return _0x25bca8(_0x488578[_0xbd70('0x13')][_0xbd70('0x14')]);}else{logger[_0xbd70('0xe')](_0xbd70('0x15'),_0x103d00,'request\x20sent');_0x25bca8(_0x488578[_0xbd70('0x16')][_0xbd70('0x14')]);}})[_0xbd70('0x17')](function(_0x1f41d9){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x103d00,_0x1f41d9);_0x1c414c(_0x1f41d9);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 05ae491..a8cf1ae 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 _0x7e8a=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e8a,0x1b2));var _0xa7e8=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x7e8a[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0xa7e8('0x0'));var util=require(_0xa7e8('0x1'));var path=require(_0xa7e8('0x2'));var timeout=require(_0xa7e8('0x3'));var express=require(_0xa7e8('0x4'));var router=express[_0xa7e8('0x5')]();var auth=require(_0xa7e8('0x6'));var interaction=require(_0xa7e8('0x7'));var config=require('../../config/environment');module[_0xa7e8('0x8')]=router; \ No newline at end of file +var _0x8fde=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','express'];(function(_0x1df11b,_0x456d05){var _0x2e4504=function(_0x12a9da){while(--_0x12a9da){_0x1df11b['push'](_0x1df11b['shift']());}};_0x2e4504(++_0x456d05);}(_0x8fde,0x1ac));var _0xe8fd=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x8fde[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xe8fd('0x0'));var util=require(_0xe8fd('0x1'));var path=require(_0xe8fd('0x2'));var timeout=require('connect-timeout');var express=require(_0xe8fd('0x3'));var router=express[_0xe8fd('0x4')]();var auth=require(_0xe8fd('0x5'));var interaction=require(_0xe8fd('0x6'));var config=require(_0xe8fd('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index bd4ebde..1ea3be0 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x5325c0,_0x2d411f){var _0x14e031=function(_0x5e5262){while(--_0x5e5262){_0x5325c0['push'](_0x5325c0['shift']());}};_0x14e031(++_0x2d411f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x2a8444,_0xb5ee31){var _0x53c724=function(_0xf67066){while(--_0xf67066){_0x2a8444['push'](_0x2a8444['shift']());}};_0x53c724(++_0xb5ee31);}(_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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 5eaf230..22ab7bf 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 _0xa588=['exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x571609,_0x18ea2c){var _0x13840a=function(_0x53fd92){while(--_0x53fd92){_0x571609['push'](_0x571609['shift']());}};_0x13840a(++_0x18ea2c);}(_0xa588,0xe1));var _0x8a58=function(_0xdf9b3c,_0xb472f0){_0xdf9b3c=_0xdf9b3c-0x0;var _0x5d7d6b=_0xa588[_0xdf9b3c];return _0x5d7d6b;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var logger=require(_0x8a58('0x1'))(_0x8a58('0x2'));var moment=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var rp=require(_0x8a58('0x5'));var fs=require('fs');var path=require(_0x8a58('0x6'));var rimraf=require(_0x8a58('0x7'));var config=require(_0x8a58('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x8a58('0x9')]=function(_0x408a4a,_0x448366){return _0x408a4a[_0x8a58('0xa')](_0x8a58('0xb'),attributes,{'tableName':_0x8a58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0825=['../../config/environment','./userSmsQueue.attributes','exports','user_has_sms_queues','lodash','util','moment','bluebird','path','rimraf'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x0825,0x1e4));var _0x5082=function(_0x18d3aa,_0x3da5b3){_0x18d3aa=_0x18d3aa-0x0;var _0x215d9b=_0x0825[_0x18d3aa];return _0x215d9b;};'use strict';var _=require(_0x5082('0x0'));var util=require(_0x5082('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5082('0x2'));var BPromise=require(_0x5082('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5082('0x4'));var rimraf=require(_0x5082('0x5'));var config=require(_0x5082('0x6'));var attributes=require(_0x5082('0x7'));module[_0x5082('0x8')]=function(_0x297cda,_0x5a119b){return _0x297cda['define']('UserSmsQueue',attributes,{'tableName':_0x5082('0x9'),'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 ee7d45c..4df6f41 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 _0x6031=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserSmsQueue,\x20%s,\x20%s','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x6031,0x1d3));var _0x1603=function(_0x3ad0ed,_0x1bb71c){_0x3ad0ed=_0x3ad0ed-0x0;var _0x6849c7=_0x6031[_0x3ad0ed];return _0x6849c7;};'use strict';var _=require(_0x1603('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1603('0x1'));var db=require(_0x1603('0x2'))['db'];var utils=require(_0x1603('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x1603('0x4'));var jayson=require(_0x1603('0x5'));var client=jayson[_0x1603('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ce0ef,_0x6c0ff8,_0x4f1523){return new BPromise(function(_0x4f3ec0,_0x59b873){return client['request'](_0x5ce0ef,_0x4f1523)[_0x1603('0x7')](function(_0x3dd7b0){logger[_0x1603('0x8')]('UserSmsQueue,\x20%s,\x20%s',_0x6c0ff8,_0x1603('0x9'));logger[_0x1603('0xa')](_0x1603('0xb'),_0x6c0ff8,_0x1603('0x9'),JSON[_0x1603('0xc')](_0x3dd7b0));if(_0x3dd7b0[_0x1603('0xd')]){if(_0x3dd7b0[_0x1603('0xd')]['code']===0x1f4){logger[_0x1603('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x6c0ff8,_0x3dd7b0[_0x1603('0xd')]['message']);return _0x59b873(_0x3dd7b0[_0x1603('0xd')][_0x1603('0xe')]);}logger[_0x1603('0xd')](_0x1603('0xf'),_0x6c0ff8,_0x3dd7b0[_0x1603('0xd')][_0x1603('0xe')]);return _0x4f3ec0(_0x3dd7b0['error'][_0x1603('0xe')]);}else{logger['info'](_0x1603('0xf'),_0x6c0ff8,_0x1603('0x9'));_0x4f3ec0(_0x3dd7b0['result'][_0x1603('0xe')]);}})[_0x1603('0x10')](function(_0x1e15df){logger[_0x1603('0xd')](_0x1603('0xf'),_0x6c0ff8,_0x1e15df);_0x59b873(_0x1e15df);});});} \ No newline at end of file +var _0x273d=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring'];(function(_0x189c0c,_0x3c8aff){var _0x533076=function(_0x4c9439){while(--_0x4c9439){_0x189c0c['push'](_0x189c0c['shift']());}};_0x533076(++_0x3c8aff);}(_0x273d,0x13e));var _0xd273=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x273d[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xd273('0x0'));var moment=require(_0xd273('0x1'));var BPromise=require(_0xd273('0x2'));var rs=require(_0xd273('0x3'));var fs=require('fs');var Redis=require(_0xd273('0x4'));var db=require(_0xd273('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd273('0x6'))(_0xd273('0x7'));var config=require(_0xd273('0x8'));var jayson=require(_0xd273('0x9'));var client=jayson[_0xd273('0xa')][_0xd273('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x578122,_0x346d70,_0x1880d7){return new BPromise(function(_0xeda96b,_0xf2f73e){return client[_0xd273('0xc')](_0x578122,_0x1880d7)['then'](function(_0x577b30){logger['info'](_0xd273('0xd'),_0x346d70,'request\x20sent');logger[_0xd273('0xe')](_0xd273('0xf'),_0x346d70,'request\x20sent',JSON['stringify'](_0x577b30));if(_0x577b30[_0xd273('0x10')]){if(_0x577b30[_0xd273('0x10')][_0xd273('0x11')]===0x1f4){logger[_0xd273('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x346d70,_0x577b30[_0xd273('0x10')][_0xd273('0x12')]);return _0xf2f73e(_0x577b30[_0xd273('0x10')]['message']);}logger[_0xd273('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x346d70,_0x577b30[_0xd273('0x10')][_0xd273('0x12')]);return _0xeda96b(_0x577b30[_0xd273('0x10')][_0xd273('0x12')]);}else{logger[_0xd273('0x13')](_0xd273('0xd'),_0x346d70,_0xd273('0x14'));_0xeda96b(_0x577b30[_0xd273('0x15')][_0xd273('0x12')]);}})[_0xd273('0x16')](function(_0x407e98){logger[_0xd273('0x10')](_0xd273('0xd'),_0x346d70,_0x407e98);_0xf2f73e(_0x407e98);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index e0e431a..5e39b0c 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 _0x450c=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x11883b,_0x21c6af){var _0x169e65=function(_0x44aefd){while(--_0x44aefd){_0x11883b['push'](_0x11883b['shift']());}};_0x169e65(++_0x21c6af);}(_0x450c,0x130));var _0xc450=function(_0x22e7c4,_0x1a2942){_0x22e7c4=_0x22e7c4-0x0;var _0xc91e03=_0x450c[_0x22e7c4];return _0xc91e03;};'use strict';var multer=require(_0xc450('0x0'));var util=require(_0xc450('0x1'));var path=require(_0xc450('0x2'));var timeout=require('connect-timeout');var express=require(_0xc450('0x3'));var router=express[_0xc450('0x4')]();var auth=require(_0xc450('0x5'));var interaction=require(_0xc450('0x6'));var config=require(_0xc450('0x7'));module[_0xc450('0x8')]=router; \ No newline at end of file +var _0x9815=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x5df4e7,_0x1a5f97){var _0x2523d7=function(_0x1fe885){while(--_0x1fe885){_0x5df4e7['push'](_0x5df4e7['shift']());}};_0x2523d7(++_0x1a5f97);}(_0x9815,0x1d0));var _0x5981=function(_0x25f1e7,_0x2a220f){_0x25f1e7=_0x25f1e7-0x0;var _0x51c086=_0x9815[_0x25f1e7];return _0x51c086;};'use strict';var multer=require(_0x5981('0x0'));var util=require(_0x5981('0x1'));var path=require(_0x5981('0x2'));var timeout=require(_0x5981('0x3'));var express=require(_0x5981('0x4'));var router=express['Router']();var auth=require(_0x5981('0x5'));var interaction=require(_0x5981('0x6'));var config=require(_0x5981('0x7'));module[_0x5981('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2575c2d..7ae078b 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(_0x3ee5df,_0x583073){var _0x446d24=function(_0x12e54e){while(--_0x12e54e){_0x3ee5df['push'](_0x3ee5df['shift']());}};_0x446d24(++_0x583073);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x1b86ae,_0x4296a8){var _0x10c097=function(_0x3b772f){while(--_0x3b772f){_0x1b86ae['push'](_0x1b86ae['shift']());}};_0x10c097(++_0x4296a8);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a5755,_0x17f587){_0x2a5755=_0x2a5755-0x0;var _0x1700da=_0xb10b[_0x2a5755];return _0x1700da;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 6f797d0..a8d50a0 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 _0x4b25=['define','user_has_voice_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x566474,_0x497a56){var _0x5f187f=function(_0x3c94b6){while(--_0x3c94b6){_0x566474['push'](_0x566474['shift']());}};_0x5f187f(++_0x497a56);}(_0x4b25,0x9e));var _0x54b2=function(_0x18b37a,_0x2c1fd2){_0x18b37a=_0x18b37a-0x0;var _0x2217c8=_0x4b25[_0x18b37a];return _0x2217c8;};'use strict';var _=require(_0x54b2('0x0'));var util=require(_0x54b2('0x1'));var logger=require('../../config/logger')(_0x54b2('0x2'));var moment=require(_0x54b2('0x3'));var BPromise=require(_0x54b2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54b2('0x5'));var rimraf=require(_0x54b2('0x6'));var config=require(_0x54b2('0x7'));var attributes=require(_0x54b2('0x8'));module[_0x54b2('0x9')]=function(_0x345e91,_0x5c9bf4){return _0x345e91[_0x54b2('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x54b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe47=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define'];(function(_0x597d52,_0x470643){var _0x1e831f=function(_0x20f393){while(--_0x20f393){_0x597d52['push'](_0x597d52['shift']());}};_0x1e831f(++_0x470643);}(_0xfe47,0xe5));var _0x7fe4=function(_0x4495b6,_0x1660d5){_0x4495b6=_0x4495b6-0x0;var _0x2ff893=_0xfe47[_0x4495b6];return _0x2ff893;};'use strict';var _=require(_0x7fe4('0x0'));var util=require(_0x7fe4('0x1'));var logger=require(_0x7fe4('0x2'))(_0x7fe4('0x3'));var moment=require(_0x7fe4('0x4'));var BPromise=require('bluebird');var rp=require(_0x7fe4('0x5'));var fs=require('fs');var path=require(_0x7fe4('0x6'));var rimraf=require(_0x7fe4('0x7'));var config=require(_0x7fe4('0x8'));var attributes=require(_0x7fe4('0x9'));module['exports']=function(_0x4079be,_0x33c3c0){return _0x4079be[_0x7fe4('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x7fe4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 0d9ec3d..c9bf647 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 _0xa728=['UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa728,0x64));var _0x8a72=function(_0x22e94e,_0x4f748e){_0x22e94e=_0x22e94e-0x0;var _0x5deac7=_0xa728[_0x22e94e];return _0x5deac7;};'use strict';var _=require(_0x8a72('0x0'));var util=require(_0x8a72('0x1'));var moment=require(_0x8a72('0x2'));var BPromise=require(_0x8a72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a72('0x4'));var db=require(_0x8a72('0x5'))['db'];var utils=require(_0x8a72('0x6'));var logger=require(_0x8a72('0x7'))(_0x8a72('0x8'));var config=require(_0x8a72('0x9'));var jayson=require(_0x8a72('0xa'));var client=jayson[_0x8a72('0xb')][_0x8a72('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe872f4,_0x30b529,_0x4d77f6){return new BPromise(function(_0x1adf0c,_0x36ecc7){return client[_0x8a72('0xd')](_0xe872f4,_0x4d77f6)['then'](function(_0x5bd953){logger[_0x8a72('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x30b529,_0x8a72('0xf'));logger[_0x8a72('0x10')](_0x8a72('0x11'),_0x30b529,'request\x20sent',JSON[_0x8a72('0x12')](_0x5bd953));if(_0x5bd953['error']){if(_0x5bd953['error']['code']===0x1f4){logger[_0x8a72('0x13')](_0x8a72('0x14'),_0x30b529,_0x5bd953['error'][_0x8a72('0x15')]);return _0x36ecc7(_0x5bd953[_0x8a72('0x13')][_0x8a72('0x15')]);}logger[_0x8a72('0x13')](_0x8a72('0x14'),_0x30b529,_0x5bd953['error'][_0x8a72('0x15')]);return _0x1adf0c(_0x5bd953[_0x8a72('0x13')]['message']);}else{logger[_0x8a72('0xe')](_0x8a72('0x14'),_0x30b529,_0x8a72('0xf'));_0x1adf0c(_0x5bd953[_0x8a72('0x16')][_0x8a72('0x15')]);}})[_0x8a72('0x17')](function(_0x189c22){logger['error'](_0x8a72('0x14'),_0x30b529,_0x189c22);_0x36ecc7(_0x189c22);});});} \ No newline at end of file +var _0x4f01=['then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x4f01,0x1d9));var _0x14f0=function(_0x57118e,_0x23e1c4){_0x57118e=_0x57118e-0x0;var _0x24ea06=_0x4f01[_0x57118e];return _0x24ea06;};'use strict';var _=require(_0x14f0('0x0'));var util=require(_0x14f0('0x1'));var moment=require(_0x14f0('0x2'));var BPromise=require(_0x14f0('0x3'));var rs=require(_0x14f0('0x4'));var fs=require('fs');var Redis=require(_0x14f0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x14f0('0x6'))(_0x14f0('0x7'));var config=require(_0x14f0('0x8'));var jayson=require(_0x14f0('0x9'));var client=jayson[_0x14f0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d4663,_0x478fc9,_0x322610){return new BPromise(function(_0x332f5a,_0x33349a){return client['request'](_0x3d4663,_0x322610)[_0x14f0('0xb')](function(_0x496ed6){logger[_0x14f0('0xc')](_0x14f0('0xd'),_0x478fc9,_0x14f0('0xe'));logger['debug'](_0x14f0('0xf'),_0x478fc9,_0x14f0('0xe'),JSON[_0x14f0('0x10')](_0x496ed6));if(_0x496ed6['error']){if(_0x496ed6[_0x14f0('0x11')][_0x14f0('0x12')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x478fc9,_0x496ed6[_0x14f0('0x11')][_0x14f0('0x13')]);return _0x33349a(_0x496ed6[_0x14f0('0x11')][_0x14f0('0x13')]);}logger[_0x14f0('0x11')](_0x14f0('0xd'),_0x478fc9,_0x496ed6['error'][_0x14f0('0x13')]);return _0x332f5a(_0x496ed6[_0x14f0('0x11')]['message']);}else{logger[_0x14f0('0xc')](_0x14f0('0xd'),_0x478fc9,_0x14f0('0xe'));_0x332f5a(_0x496ed6[_0x14f0('0x14')][_0x14f0('0x13')]);}})[_0x14f0('0x15')](function(_0x4f96d4){logger[_0x14f0('0x11')](_0x14f0('0xd'),_0x478fc9,_0x4f96d4);_0x33349a(_0x4f96d4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6b5612f..22d7c04 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 _0xd95d=['express','../../components/auth/service','exports','multer','path','connect-timeout'];(function(_0x327765,_0x11a5dd){var _0x5285a6=function(_0x56091b){while(--_0x56091b){_0x327765['push'](_0x327765['shift']());}};_0x5285a6(++_0x11a5dd);}(_0xd95d,0x159));var _0xdd95=function(_0x3611f2,_0x4ef70c){_0x3611f2=_0x3611f2-0x0;var _0x3d6c0c=_0xd95d[_0x3611f2];return _0x3d6c0c;};'use strict';var multer=require(_0xdd95('0x0'));var util=require('util');var path=require(_0xdd95('0x1'));var timeout=require(_0xdd95('0x2'));var express=require(_0xdd95('0x3'));var router=express['Router']();var auth=require(_0xdd95('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xdd95('0x5')]=router; \ No newline at end of file +var _0xbe37=['exports','multer','express','Router','../../components/auth/service'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xbe37,0x105));var _0x7be3=function(_0xbe651e,_0x2f400a){_0xbe651e=_0xbe651e-0x0;var _0x314524=_0xbe37[_0xbe651e];return _0x314524;};'use strict';var multer=require(_0x7be3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7be3('0x1'));var router=express[_0x7be3('0x2')]();var auth=require(_0x7be3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x7be3('0x4')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 72c4e8e..ce443d5 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 _0x48c0=['exports','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x3d1026,_0x5f0251){var _0x4a9f2a=function(_0x1a97cf){while(--_0x1a97cf){_0x3d1026['push'](_0x3d1026['shift']());}};_0x4a9f2a(++_0x5f0251);}(_0x48c0,0x18b));var _0x048c=function(_0x44e329,_0x4187b9){_0x44e329=_0x44e329-0x0;var _0x238822=_0x48c0[_0x44e329];return _0x238822;};'use strict';var Sequelize=require(_0x048c('0x0'));module[_0x048c('0x1')]={'uniqueid':{'type':Sequelize[_0x048c('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x048c('0x3')],'allowNull':![],'comment':_0x048c('0x4')},'UserId':{'type':Sequelize[_0x048c('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x048c('0x3')],'allowNull':![],'unique':_0x048c('0x5'),'comment':_0x048c('0x4')},'VoiceQueueId':{'type':Sequelize[_0x048c('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x048c('0x5'),'comment':_0x048c('0x4')},'penalty':{'type':Sequelize[_0x048c('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xe6c4=['STRING','exports','Required\x20by\x20Asterisk','INTEGER','queue_interface'];(function(_0x3ba6d0,_0x51ac99){var _0x1a3e77=function(_0x5c3129){while(--_0x5c3129){_0x3ba6d0['push'](_0x3ba6d0['shift']());}};_0x1a3e77(++_0x51ac99);}(_0xe6c4,0x123));var _0x4e6c=function(_0x37ba4c,_0x2beb84){_0x37ba4c=_0x37ba4c-0x0;var _0x633b57=_0xe6c4[_0x37ba4c];return _0x633b57;};'use strict';var Sequelize=require('sequelize');module[_0x4e6c('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4e6c('0x1')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x4e6c('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4e6c('0x3'),'comment':_0x4e6c('0x1')},'VoiceQueueId':{'type':Sequelize[_0x4e6c('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x4e6c('0x4')],'allowNull':![],'unique':_0x4e6c('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x4e6c('0x2')](0xb),'defaultValue':0x0,'comment':_0x4e6c('0x1')},'paused':{'type':Sequelize[_0x4e6c('0x2')](0xb),'defaultValue':0x0,'comment':_0x4e6c('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 32ae695..0342acd 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 _0x8985=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x8985,0xe8));var _0x5898=function(_0x3fde1f,_0x2fe5c7){_0x3fde1f=_0x3fde1f-0x0;var _0x46e413=_0x8985[_0x3fde1f];return _0x46e413;};'use strict';var EventEmitter=require(_0x5898('0x0'));var UserVoiceQueueRt=require(_0x5898('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5898('0x2')](0x0);var events={'afterCreate':_0x5898('0x3'),'afterUpdate':_0x5898('0x4'),'afterDestroy':_0x5898('0x5')};function emitEvent(_0xe9e1b2){return function(_0x3b20b0,_0x272222,_0x100094){UserVoiceQueueRtEvents['emit'](_0xe9e1b2+':'+_0x3b20b0['id'],_0x3b20b0);UserVoiceQueueRtEvents[_0x5898('0x6')](_0xe9e1b2,_0x3b20b0);_0x100094(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5898('0x7')](e,emitEvent(event));}}module[_0x5898('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3e75=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x55754e,_0x286388){var _0x2e9948=function(_0x1eaeff){while(--_0x1eaeff){_0x55754e['push'](_0x55754e['shift']());}};_0x2e9948(++_0x286388);}(_0x3e75,0x1d0));var _0x53e7=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x3e75[_0x5be795];return _0x4e8a3b;};'use strict';var EventEmitter=require(_0x53e7('0x0'));var UserVoiceQueueRt=require(_0x53e7('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x53e7('0x2')](0x0);var events={'afterCreate':_0x53e7('0x3'),'afterUpdate':_0x53e7('0x4'),'afterDestroy':_0x53e7('0x5')};function emitEvent(_0x29c6a3){return function(_0x3ce4c3,_0x43869b,_0xede4f7){UserVoiceQueueRtEvents[_0x53e7('0x6')](_0x29c6a3+':'+_0x3ce4c3['id'],_0x3ce4c3);UserVoiceQueueRtEvents[_0x53e7('0x6')](_0x29c6a3,_0x3ce4c3);_0xede4f7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x53e7('0x7')](e,emitEvent(event));}}module[_0x53e7('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8735efc..38ffc84 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 _0x3c79=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x3c79,0x1c5));var _0x93c7=function(_0x1a5c42,_0x407c0b){_0x1a5c42=_0x1a5c42-0x0;var _0x175861=_0x3c79[_0x1a5c42];return _0x175861;};'use strict';var _=require(_0x93c7('0x0'));var util=require(_0x93c7('0x1'));var logger=require(_0x93c7('0x2'))(_0x93c7('0x3'));var moment=require(_0x93c7('0x4'));var BPromise=require(_0x93c7('0x5'));var rp=require(_0x93c7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x93c7('0x7'));var attributes=require(_0x93c7('0x8'));module[_0x93c7('0x9')]=function(_0x5f19e3,_0x28fca9){return _0x5f19e3[_0x93c7('0xa')](_0x93c7('0xb'),attributes,{'tableName':_0x93c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6a7=['rimraf','../../config/environment','exports','UserVoiceQueueRt','user_has_voice_queues_rt','util','api','moment','request-promise','path'];(function(_0x20fff9,_0x230a25){var _0x179b59=function(_0x8011a0){while(--_0x8011a0){_0x20fff9['push'](_0x20fff9['shift']());}};_0x179b59(++_0x230a25);}(_0xc6a7,0x73));var _0x7c6a=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xc6a7[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0x7c6a('0x0'));var logger=require('../../config/logger')(_0x7c6a('0x1'));var moment=require(_0x7c6a('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c6a('0x3'));var fs=require('fs');var path=require(_0x7c6a('0x4'));var rimraf=require(_0x7c6a('0x5'));var config=require(_0x7c6a('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x7c6a('0x7')]=function(_0x356fc6,_0x3889e4){return _0x356fc6['define'](_0x7c6a('0x8'),attributes,{'tableName':_0x7c6a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 16a3d92..141669b 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 _0xd3cc=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','then','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3cc,0x11d));var _0xcd3c=function(_0x2f8a2d,_0x14e926){_0x2f8a2d=_0x2f8a2d-0x0;var _0x4be556=_0xd3cc[_0x2f8a2d];return _0x4be556;};'use strict';var _=require(_0xcd3c('0x0'));var util=require(_0xcd3c('0x1'));var moment=require(_0xcd3c('0x2'));var BPromise=require(_0xcd3c('0x3'));var rs=require(_0xcd3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd3c('0x5'))['db'];var utils=require(_0xcd3c('0x6'));var logger=require('../../config/logger')(_0xcd3c('0x7'));var config=require(_0xcd3c('0x8'));var jayson=require(_0xcd3c('0x9'));var client=jayson[_0xcd3c('0xa')][_0xcd3c('0xb')]({'port':0x232a});config[_0xcd3c('0xc')]=_['defaults'](config[_0xcd3c('0xc')],{'host':_0xcd3c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd3c('0xc')]));require(_0xcd3c('0xe'))[_0xcd3c('0xf')](socket);function respondWithRpcPromise(_0x398ad0,_0x198700,_0x151a7a){return new BPromise(function(_0x44069f,_0x3ddbc3){return client[_0xcd3c('0x10')](_0x398ad0,_0x151a7a)['then'](function(_0x333325){logger[_0xcd3c('0x11')](_0xcd3c('0x12'),_0x198700,_0xcd3c('0x13'));logger[_0xcd3c('0x14')](_0xcd3c('0x15'),_0x198700,'request\x20sent',JSON[_0xcd3c('0x16')](_0x333325));if(_0x333325[_0xcd3c('0x17')]){if(_0x333325[_0xcd3c('0x17')]['code']===0x1f4){logger[_0xcd3c('0x17')](_0xcd3c('0x12'),_0x198700,_0x333325[_0xcd3c('0x17')][_0xcd3c('0x18')]);return _0x3ddbc3(_0x333325[_0xcd3c('0x17')][_0xcd3c('0x18')]);}logger[_0xcd3c('0x17')](_0xcd3c('0x12'),_0x198700,_0x333325[_0xcd3c('0x17')][_0xcd3c('0x18')]);return _0x44069f(_0x333325[_0xcd3c('0x17')][_0xcd3c('0x18')]);}else{logger[_0xcd3c('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x198700,_0xcd3c('0x13'));_0x44069f(_0x333325[_0xcd3c('0x19')][_0xcd3c('0x18')]);}})['catch'](function(_0x5cdd92){logger[_0xcd3c('0x17')](_0xcd3c('0x12'),_0x198700,_0x5cdd92);_0x3ddbc3(_0x5cdd92);});});}exports[_0xcd3c('0x1a')]=function(_0x492a58){var _0x39e0f7=this;return new Promise(function(_0xd83364,_0x46130e){return db[_0xcd3c('0x1b')][_0xcd3c('0x1c')]({'raw':_0x492a58[_0xcd3c('0x1d')]?_0x492a58[_0xcd3c('0x1d')][_0xcd3c('0x1e')]===undefined?!![]:![]:!![],'where':_0x492a58['options']?_0x492a58['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xcd3c('0x1f'),db[_0xcd3c('0x20')]['fn']('IF',db[_0xcd3c('0x20')]['literal'](_0xcd3c('0x21')))),'outboundQueuePauses']]})[_0xcd3c('0x22')](function(_0x48f33b){logger[_0xcd3c('0x11')](_0xcd3c('0x1a'),_0x492a58);logger[_0xcd3c('0x14')](_0xcd3c('0x1a'),_0x492a58,JSON['stringify'](_0x48f33b));_0xd83364(_0x48f33b);})[_0xcd3c('0x23')](function(_0x4dd833){logger[_0xcd3c('0x17')](_0xcd3c('0x1a'),_0x4dd833[_0xcd3c('0x18')],_0x492a58);_0x46130e(_0x39e0f7['error'](0x1f4,_0x4dd833[_0xcd3c('0x18')]));});});}; \ No newline at end of file +var _0x342f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','UserVoiceQueueRt','options','raw','sequelize','COUNT','literal','outboundQueuePauses','GetVoiceQueueRtPauses'];(function(_0x2b290d,_0x8bd129){var _0x4ac75c=function(_0x298f6e){while(--_0x298f6e){_0x2b290d['push'](_0x2b290d['shift']());}};_0x4ac75c(++_0x8bd129);}(_0x342f,0x1a2));var _0xf342=function(_0x3ee9b2,_0xa090bb){_0x3ee9b2=_0x3ee9b2-0x0;var _0x51ac3e=_0x342f[_0x3ee9b2];return _0x51ac3e;};'use strict';var _=require(_0xf342('0x0'));var util=require(_0xf342('0x1'));var moment=require(_0xf342('0x2'));var BPromise=require(_0xf342('0x3'));var rs=require(_0xf342('0x4'));var fs=require('fs');var Redis=require(_0xf342('0x5'));var db=require(_0xf342('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf342('0x7'));var config=require(_0xf342('0x8'));var jayson=require(_0xf342('0x9'));var client=jayson[_0xf342('0xa')][_0xf342('0xb')]({'port':0x232a});config[_0xf342('0xc')]=_[_0xf342('0xd')](config[_0xf342('0xc')],{'host':_0xf342('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf342('0xc')]));require(_0xf342('0xf'))[_0xf342('0x10')](socket);function respondWithRpcPromise(_0x3ca460,_0x3615ae,_0x18d268){return new BPromise(function(_0x540f96,_0x124036){return client[_0xf342('0x11')](_0x3ca460,_0x18d268)[_0xf342('0x12')](function(_0x3251dc){logger[_0xf342('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3615ae,_0xf342('0x14'));logger[_0xf342('0x15')](_0xf342('0x16'),_0x3615ae,_0xf342('0x14'),JSON[_0xf342('0x17')](_0x3251dc));if(_0x3251dc[_0xf342('0x18')]){if(_0x3251dc['error'][_0xf342('0x19')]===0x1f4){logger[_0xf342('0x18')](_0xf342('0x1a'),_0x3615ae,_0x3251dc[_0xf342('0x18')][_0xf342('0x1b')]);return _0x124036(_0x3251dc[_0xf342('0x18')][_0xf342('0x1b')]);}logger[_0xf342('0x18')](_0xf342('0x1a'),_0x3615ae,_0x3251dc['error'][_0xf342('0x1b')]);return _0x540f96(_0x3251dc[_0xf342('0x18')]['message']);}else{logger[_0xf342('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3615ae,_0xf342('0x14'));_0x540f96(_0x3251dc[_0xf342('0x1c')]['message']);}})[_0xf342('0x1d')](function(_0x2d58f8){logger[_0xf342('0x18')](_0xf342('0x1a'),_0x3615ae,_0x2d58f8);_0x124036(_0x2d58f8);});});}exports['GetVoiceQueueRtPauses']=function(_0x50a80b){var _0x1862db=this;return new Promise(function(_0xee65cd,_0x2f7950){return db[_0xf342('0x1e')]['findAll']({'raw':_0x50a80b['options']?_0x50a80b[_0xf342('0x1f')][_0xf342('0x20')]===undefined?!![]:![]:!![],'where':_0x50a80b['options']?_0x50a80b['options']['where']||null:null,'attributes':[[db[_0xf342('0x21')]['fn'](_0xf342('0x22'),db[_0xf342('0x21')]['fn']('IF',db[_0xf342('0x21')][_0xf342('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0xf342('0x24')]]})[_0xf342('0x12')](function(_0x1d6cc4){logger[_0xf342('0x13')](_0xf342('0x25'),_0x50a80b);logger[_0xf342('0x15')](_0xf342('0x25'),_0x50a80b,JSON[_0xf342('0x17')](_0x1d6cc4));_0xee65cd(_0x1d6cc4);})[_0xf342('0x1d')](function(_0x5d3425){logger['error'](_0xf342('0x25'),_0x5d3425[_0xf342('0x1b')],_0x50a80b);_0x2f7950(_0x1862db[_0xf342('0x18')](0x1f4,_0x5d3425[_0xf342('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index bd39c80..f50f83c 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 _0xd9dc=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','length','userVoiceQueueRt:'];(function(_0x2bf22d,_0x179e7a){var _0x324ad7=function(_0xa0f187){while(--_0xa0f187){_0x2bf22d['push'](_0x2bf22d['shift']());}};_0x324ad7(++_0x179e7a);}(_0xd9dc,0x130));var _0xcd9d=function(_0x265793,_0x1184c5){_0x265793=_0x265793-0x0;var _0x1fbad1=_0xd9dc[_0x265793];return _0x1fbad1;};'use strict';var UserVoiceQueueRtEvents=require(_0xcd9d('0x0'));var events=[_0xcd9d('0x1'),_0xcd9d('0x2'),_0xcd9d('0x3')];function createListener(_0x40f1e0,_0x306753){return function(_0x1962c9){_0x306753[_0xcd9d('0x4')](_0x40f1e0,_0x1962c9);};}function removeListener(_0x115a53,_0x923a70){return function(){UserVoiceQueueRtEvents[_0xcd9d('0x5')](_0x115a53,_0x923a70);};}exports['register']=function(_0x4298cd){for(var _0x4967e1=0x0,_0x303ecb=events[_0xcd9d('0x6')];_0x4967e1<_0x303ecb;_0x4967e1++){var _0x3733ff=events[_0x4967e1];var _0x53bf94=createListener(_0xcd9d('0x7')+_0x3733ff,_0x4298cd);UserVoiceQueueRtEvents['on'](_0x3733ff,_0x53bf94);}}; \ No newline at end of file +var _0x5bdf=['length','userVoiceQueueRt:','remove','register'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5bdf,0x1be));var _0xf5bd=function(_0x52bb05,_0x2ad46a){_0x52bb05=_0x52bb05-0x0;var _0x58f528=_0x5bdf[_0x52bb05];return _0x58f528;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0xf5bd('0x0'),'update'];function createListener(_0xd97038,_0x36e8fd){return function(_0x81a1b7){_0x36e8fd['emit'](_0xd97038,_0x81a1b7);};}function removeListener(_0x4cbbd5,_0x34935b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4cbbd5,_0x34935b);};}exports[_0xf5bd('0x1')]=function(_0x5069bc){for(var _0x31965b=0x0,_0x25858b=events[_0xf5bd('0x2')];_0x31965b<_0x25858b;_0x31965b++){var _0x437c93=events[_0x31965b];var _0x4fa0a9=createListener(_0xf5bd('0x3')+_0x437c93,_0x5069bc);UserVoiceQueueRtEvents['on'](_0x437c93,_0x4fa0a9);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index cf0c9cb..41189c5 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 _0x3596=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','path','connect-timeout'];(function(_0x2e7d24,_0x4cfa1c){var _0x30285d=function(_0x421b46){while(--_0x421b46){_0x2e7d24['push'](_0x2e7d24['shift']());}};_0x30285d(++_0x4cfa1c);}(_0x3596,0xd6));var _0x6359=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x3596[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6359('0x0'));var timeout=require(_0x6359('0x1'));var express=require(_0x6359('0x2'));var router=express[_0x6359('0x3')]();var auth=require(_0x6359('0x4'));var interaction=require(_0x6359('0x5'));var config=require(_0x6359('0x6'));module[_0x6359('0x7')]=router; \ No newline at end of file +var _0xa4f1=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x47856a,_0x1ad7a0){var _0x1edd96=function(_0x4da7f3){while(--_0x4da7f3){_0x47856a['push'](_0x47856a['shift']());}};_0x1edd96(++_0x1ad7a0);}(_0xa4f1,0x1a8));var _0x1a4f=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xa4f1[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0x1a4f('0x0'));var util=require('util');var path=require(_0x1a4f('0x1'));var timeout=require(_0x1a4f('0x2'));var express=require(_0x1a4f('0x3'));var router=express[_0x1a4f('0x4')]();var auth=require(_0x1a4f('0x5'));var interaction=require(_0x1a4f('0x6'));var config=require(_0x1a4f('0x7'));module[_0x1a4f('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index d1dbfcc..755d826 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x204c82,_0x5bd73e){var _0x2c7553=function(_0x123b61){while(--_0x123b61){_0x204c82['push'](_0x204c82['shift']());}};_0x2c7553(++_0x5bd73e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index da7fafb..a699330 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 _0xb76e=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x498211,_0x1acae3){var _0x45d639=function(_0x18ef22){while(--_0x18ef22){_0x498211['push'](_0x498211['shift']());}};_0x45d639(++_0x1acae3);}(_0xb76e,0x85));var _0xeb76=function(_0xe7e134,_0x290de6){_0xe7e134=_0xe7e134-0x0;var _0x57fe21=_0xb76e[_0xe7e134];return _0x57fe21;};'use strict';var _=require(_0xeb76('0x0'));var util=require(_0xeb76('0x1'));var logger=require(_0xeb76('0x2'))('api');var moment=require(_0xeb76('0x3'));var BPromise=require(_0xeb76('0x4'));var rp=require(_0xeb76('0x5'));var fs=require('fs');var path=require(_0xeb76('0x6'));var rimraf=require(_0xeb76('0x7'));var config=require(_0xeb76('0x8'));var attributes=require(_0xeb76('0x9'));module[_0xeb76('0xa')]=function(_0x361c20,_0x219303){return _0x361c20[_0xeb76('0xb')](_0xeb76('0xc'),attributes,{'tableName':_0xeb76('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9929=['bluebird','path','rimraf','./userWhatsappQueue.attributes','define','util','moment'];(function(_0x9f9816,_0x579b0e){var _0x40a913=function(_0x5340c4){while(--_0x5340c4){_0x9f9816['push'](_0x9f9816['shift']());}};_0x40a913(++_0x579b0e);}(_0x9929,0x75));var _0x9992=function(_0x5f1e02,_0x3df6ea){_0x5f1e02=_0x5f1e02-0x0;var _0x5ab4d1=_0x9929[_0x5f1e02];return _0x5ab4d1;};'use strict';var _=require('lodash');var util=require(_0x9992('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9992('0x1'));var BPromise=require(_0x9992('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9992('0x3'));var rimraf=require(_0x9992('0x4'));var config=require('../../config/environment');var attributes=require(_0x9992('0x5'));module['exports']=function(_0x267b68,_0x59b753){return _0x267b68[_0x9992('0x6')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 95649a3..70e64c2 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(_0x2ec4b7,_0x46f8b8){var _0x14916f=function(_0x542814){while(--_0x542814){_0x2ec4b7['push'](_0x2ec4b7['shift']());}};_0x14916f(++_0x46f8b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f42bd,_0x481f3b){var _0xa1bb06=function(_0x3c6955){while(--_0x3c6955){_0x1f42bd['push'](_0x1f42bd['shift']());}};_0xa1bb06(++_0x481f3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 0d19e26..e429056 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 _0x449f=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index'];(function(_0x16390c,_0x33a0b4){var _0x1140c1=function(_0x1400f4){while(--_0x1400f4){_0x16390c['push'](_0x16390c['shift']());}};_0x1140c1(++_0x33a0b4);}(_0x449f,0xb2));var _0xf449=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x449f[_0x1f7201];return _0x289fd2;};'use strict';var multer=require(_0xf449('0x0'));var util=require(_0xf449('0x1'));var path=require(_0xf449('0x2'));var timeout=require(_0xf449('0x3'));var express=require(_0xf449('0x4'));var router=express[_0xf449('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./variable.controller');router[_0xf449('0x6')]('/',auth[_0xf449('0x7')](),controller[_0xf449('0x8')]);router['get'](_0xf449('0x9'),auth[_0xf449('0x7')](),controller[_0xf449('0xa')]);router[_0xf449('0xb')]('/',auth[_0xf449('0x7')](),controller[_0xf449('0xc')]);router[_0xf449('0xd')](_0xf449('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xf449('0xe')]('/:id',auth[_0xf449('0x7')](),controller[_0xf449('0xf')]);module[_0xf449('0x10')]=router; \ No newline at end of file +var _0x73cb=['express','./variable.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','destroy','exports','path','connect-timeout'];(function(_0x1bb38b,_0x491c7c){var _0x54afa5=function(_0x26353d){while(--_0x26353d){_0x1bb38b['push'](_0x1bb38b['shift']());}};_0x54afa5(++_0x491c7c);}(_0x73cb,0x1ed));var _0xb73c=function(_0x55f0e9,_0x329863){_0x55f0e9=_0x55f0e9-0x0;var _0x2c38eb=_0x73cb[_0x55f0e9];return _0x2c38eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb73c('0x0'));var timeout=require(_0xb73c('0x1'));var express=require(_0xb73c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb73c('0x3'));router['get']('/',auth[_0xb73c('0x4')](),controller[_0xb73c('0x5')]);router[_0xb73c('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xb73c('0x7')]);router[_0xb73c('0x8')]('/',auth[_0xb73c('0x4')](),controller[_0xb73c('0x9')]);router[_0xb73c('0xa')](_0xb73c('0xb'),auth[_0xb73c('0x4')](),controller['update']);router[_0xb73c('0xc')](_0xb73c('0xb'),auth[_0xb73c('0x4')](),controller[_0xb73c('0xd')]);module[_0xb73c('0xe')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index b56c830..859717d 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 _0x6843=['sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6843,0x140));var _0x3684=function(_0x3c448e,_0x17ff6e){_0x3c448e=_0x3c448e-0x0;var _0x25a9e8=_0x6843[_0x3c448e];return _0x25a9e8;};'use strict';var Sequelize=require(_0x3684('0x0'));module[_0x3684('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x243a=['sequelize','exports','STRING','name'];(function(_0x4b032b,_0xc99963){var _0x31d941=function(_0x13cd99){while(--_0x13cd99){_0x4b032b['push'](_0x4b032b['shift']());}};_0x31d941(++_0xc99963);}(_0x243a,0x80));var _0xa243=function(_0x2da21b,_0x432a6e){_0x2da21b=_0x2da21b-0x0;var _0x1a917f=_0x243a[_0x2da21b];return _0x1a917f;};'use strict';var Sequelize=require(_0xa243('0x0'));module[_0xa243('0x1')]={'name':{'type':Sequelize[_0xa243('0x2')],'unique':_0xa243('0x3'),'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 d41de58..493b5ef 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 _0x571a=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','end','error','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','role'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x571a,0xf6));var _0xa571=function(_0x1a9e2b,_0x8e5550){_0x1a9e2b=_0x1a9e2b-0x0;var _0x435919=_0x571a[_0x1a9e2b];return _0x435919;};'use strict';var pdf=require(_0xa571('0x0'));var emlformat=require(_0xa571('0x1'));var rimraf=require(_0xa571('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa571('0x3'));var moment=require(_0xa571('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa571('0x5'));var util=require(_0xa571('0x6'));var path=require('path');var sox=require(_0xa571('0x7'));var csv=require(_0xa571('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa571('0x9'));var crypto=require(_0xa571('0xa'));var jsforce=require(_0xa571('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa571('0x8'));var querystring=require('querystring');var Papa=require(_0xa571('0xc'));var Redis=require(_0xa571('0xd'));var authService=require(_0xa571('0xe'));var qs=require(_0xa571('0xf'));var as=require(_0xa571('0x10'));var hardwareService=require(_0xa571('0x11'));var logger=require('../../config/logger')(_0xa571('0x12'));var utils=require(_0xa571('0x13'));var config=require(_0xa571('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2303c8,_0x5e1259){_0x5e1259=_0x5e1259||0xcc;return function(_0x53c829){if(_0x53c829){return _0x2303c8[_0xa571('0x15')](_0x5e1259);}return _0x2303c8[_0xa571('0x16')](_0x5e1259)['end']();};}function respondWithResult(_0xdf035c,_0x322388){_0x322388=_0x322388||0xc8;return function(_0x4f5704){if(_0x4f5704){return _0xdf035c[_0xa571('0x16')](_0x322388)[_0xa571('0x17')](_0x4f5704);}};}function respondWithFilteredResult(_0x1d9b1b,_0x36b230){return function(_0x27c46d){if(_0x27c46d){var _0x4fc53b=_0x27c46d[_0xa571('0x18')],_0x3597ab=_0x36b230[_0xa571('0x19')],_0xb3afc1=_0x36b230[_0xa571('0x19')]+_0x36b230[_0xa571('0x1a')],_0x5802a5;if(_0xb3afc1>=_0x4fc53b){_0xb3afc1=_0x4fc53b;_0x5802a5=0xc8;}else{_0x5802a5=0xce;}_0x1d9b1b[_0xa571('0x16')](_0x5802a5);return _0x1d9b1b[_0xa571('0x1b')](_0xa571('0x1c'),_0x3597ab+'-'+_0xb3afc1+'/'+_0x4fc53b)[_0xa571('0x17')](_0x27c46d);}return null;};}function patchUpdates(_0x2d7fcb){return function(_0x201d33){try{jsonpatch[_0xa571('0x1d')](_0x201d33,_0x2d7fcb,!![]);}catch(_0x13652b){return BPromise[_0xa571('0x1e')](_0x13652b);}return _0x201d33[_0xa571('0x1f')]();};}function saveUpdates(_0x1d3bf4,_0x503bcc){return function(_0x5e6267){if(_0x5e6267){return _0x5e6267[_0xa571('0x20')](_0x1d3bf4)[_0xa571('0x21')](function(_0x2615ba){return _0x2615ba;});}return null;};}function removeEntity(_0x49ab8a,_0x7b8101){return function(_0x20679b){if(_0x20679b){return _0x20679b[_0xa571('0x22')]()[_0xa571('0x21')](function(){var _0x225e47=_0x20679b[_0xa571('0x23')]({'plain':!![]});var _0x11c0d9=_0xa571('0x24');return db[_0xa571('0x25')][_0xa571('0x22')]({'where':{'type':_0x11c0d9,'resourceId':_0x225e47['id']}})[_0xa571('0x21')](function(){return _0x20679b;});})[_0xa571('0x21')](function(){_0x49ab8a['status'](0xcc)[_0xa571('0x26')]();});}};}function handleEntityNotFound(_0x427ed7,_0x480a13){return function(_0x2eb3f2){if(!_0x2eb3f2){_0x427ed7['sendStatus'](0x194);}return _0x2eb3f2;};}function handleError(_0x5aad2d,_0x52ba26){_0x52ba26=_0x52ba26||0x1f4;return function(_0x2a9680){logger[_0xa571('0x27')](_0x2a9680['stack']);if(_0x2a9680[_0xa571('0x28')]){delete _0x2a9680['name'];}_0x5aad2d[_0xa571('0x16')](_0x52ba26)[_0xa571('0x29')](_0x2a9680);};}exports[_0xa571('0x2a')]=function(_0x1a42e9,_0x24d9b0){var _0x3d3522={},_0xac40da={},_0x14bf55={'count':0x0,'rows':[]};var _0x5aedd5=_[_0xa571('0x2b')](db[_0xa571('0x2c')][_0xa571('0x2d')],function(_0x4a10d4){return{'name':_0x4a10d4[_0xa571('0x2e')],'type':_0x4a10d4[_0xa571('0x2f')][_0xa571('0x30')]};});_0xac40da[_0xa571('0x31')]=_['map'](_0x5aedd5,'name');_0xac40da['query']=_[_0xa571('0x32')](_0x1a42e9[_0xa571('0x33')]);_0xac40da[_0xa571('0x34')]=_[_0xa571('0x35')](_0xac40da[_0xa571('0x31')],_0xac40da[_0xa571('0x33')]);_0x3d3522['attributes']=_[_0xa571('0x35')](_0xac40da['model'],qs['fields'](_0x1a42e9[_0xa571('0x33')][_0xa571('0x36')]));_0x3d3522[_0xa571('0x37')]=_0x3d3522[_0xa571('0x37')][_0xa571('0x38')]?_0x3d3522[_0xa571('0x37')]:_0xac40da[_0xa571('0x31')];if(!_0x1a42e9[_0xa571('0x33')][_0xa571('0x39')](_0xa571('0x3a'))){_0x3d3522[_0xa571('0x1a')]=qs[_0xa571('0x1a')](_0x1a42e9['query']['limit']);_0x3d3522[_0xa571('0x19')]=qs['offset'](_0x1a42e9[_0xa571('0x33')][_0xa571('0x19')]);}_0x3d3522[_0xa571('0x3b')]=qs[_0xa571('0x3c')](_0x1a42e9[_0xa571('0x33')]['sort']);_0x3d3522[_0xa571('0x3d')]=qs[_0xa571('0x34')](_[_0xa571('0x3e')](_0x1a42e9[_0xa571('0x33')],_0xac40da['filters']),_0x5aedd5);if(_0x1a42e9[_0xa571('0x33')][_0xa571('0x3f')]){_0x3d3522[_0xa571('0x3d')]=_[_0xa571('0x40')](_0x3d3522[_0xa571('0x3d')],{'$or':_['map'](_0x5aedd5,function(_0x1bba96){if(_0x1bba96[_0xa571('0x2f')]!=='VIRTUAL'){var _0x5d823b={};_0x5d823b[_0x1bba96['name']]={'$like':'%'+_0x1a42e9['query'][_0xa571('0x3f')]+'%'};return _0x5d823b;}})});}_0x3d3522=_[_0xa571('0x40')]({},_0x3d3522,_0x1a42e9['options']);var _0x1ad343={'where':_0x3d3522[_0xa571('0x3d')]};return db['Variable'][_0xa571('0x18')](_0x1ad343)[_0xa571('0x21')](function(_0xd303cb){_0x14bf55[_0xa571('0x18')]=_0xd303cb;if(_0x1a42e9['query']['includeAll']){_0x3d3522[_0xa571('0x41')]=[{'all':!![]}];}return db[_0xa571('0x2c')][_0xa571('0x42')](_0x3d3522);})[_0xa571('0x21')](function(_0x1fc421){_0x14bf55[_0xa571('0x43')]=_0x1fc421;return _0x14bf55;})['then'](respondWithFilteredResult(_0x24d9b0,_0x3d3522))[_0xa571('0x44')](handleError(_0x24d9b0,null));};exports[_0xa571('0x45')]=function(_0x25d85f,_0x5bcbc4){var _0xf9dc64={'raw':!![],'where':{'id':_0x25d85f[_0xa571('0x46')]['id']}},_0xd53024={};_0xd53024[_0xa571('0x31')]=_['keys'](db[_0xa571('0x2c')]['rawAttributes']);_0xd53024['query']=_[_0xa571('0x32')](_0x25d85f[_0xa571('0x33')]);_0xd53024[_0xa571('0x34')]=_[_0xa571('0x35')](_0xd53024[_0xa571('0x31')],_0xd53024[_0xa571('0x33')]);_0xf9dc64[_0xa571('0x37')]=_[_0xa571('0x35')](_0xd53024[_0xa571('0x31')],qs[_0xa571('0x36')](_0x25d85f[_0xa571('0x33')]['fields']));_0xf9dc64[_0xa571('0x37')]=_0xf9dc64['attributes'][_0xa571('0x38')]?_0xf9dc64['attributes']:_0xd53024['model'];if(_0x25d85f[_0xa571('0x33')][_0xa571('0x47')]){_0xf9dc64['include']=[{'all':!![]}];}_0xf9dc64=_[_0xa571('0x40')]({},_0xf9dc64,_0x25d85f[_0xa571('0x48')]);return db[_0xa571('0x2c')][_0xa571('0x49')](_0xf9dc64)['then'](handleEntityNotFound(_0x5bcbc4,null))['then'](respondWithResult(_0x5bcbc4,null))[_0xa571('0x44')](handleError(_0x5bcbc4,null));};exports[_0xa571('0x4a')]=function(_0x5b652c,_0x52ac69){return db[_0xa571('0x2c')]['create'](_0x5b652c[_0xa571('0x4b')],{})[_0xa571('0x21')](function(_0x1fd71d){var _0x42c265=_0x5b652c[_0xa571('0x4c')][_0xa571('0x23')]({'plain':!![]});if(!_0x42c265)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42c265[_0xa571('0x4d')]==='user'){var _0x131178=_0x1fd71d[_0xa571('0x23')]({'plain':!![]});var _0x3e75c7='Variables';return db[_0xa571('0x4e')]['find']({'where':{'name':_0x3e75c7,'userProfileId':_0x42c265['userProfileId']},'raw':!![]})[_0xa571('0x21')](function(_0x279d72){if(_0x279d72&&_0x279d72[_0xa571('0x4f')]===0x0){return db[_0xa571('0x25')][_0xa571('0x4a')]({'name':_0x131178['name'],'resourceId':_0x131178['id'],'type':_0x279d72[_0xa571('0x28')],'sectionId':_0x279d72['id']},{})[_0xa571('0x21')](function(){return _0x1fd71d;});}else{return _0x1fd71d;}})[_0xa571('0x44')](function(_0x4671e3){logger['error'](_0xa571('0x50'),_0x4671e3);throw _0x4671e3;});}return _0x1fd71d;})[_0xa571('0x21')](respondWithResult(_0x52ac69,0xc9))[_0xa571('0x44')](handleError(_0x52ac69,null));};exports[_0xa571('0x20')]=function(_0x1348e9,_0x5635f3){if(_0x1348e9[_0xa571('0x4b')]['id']){delete _0x1348e9['body']['id'];}return db[_0xa571('0x2c')][_0xa571('0x49')]({'where':{'id':_0x1348e9[_0xa571('0x46')]['id']}})['then'](handleEntityNotFound(_0x5635f3,null))['then'](saveUpdates(_0x1348e9[_0xa571('0x4b')],null))[_0xa571('0x21')](respondWithResult(_0x5635f3,null))['catch'](handleError(_0x5635f3,null));};exports[_0xa571('0x22')]=function(_0x59e82b,_0x48eee4){return db[_0xa571('0x2c')]['find']({'where':{'id':_0x59e82b[_0xa571('0x46')]['id']}})['then'](handleEntityNotFound(_0x48eee4,null))[_0xa571('0x21')](removeEntity(_0x48eee4,null))[_0xa571('0x44')](handleError(_0x48eee4,null));}; \ No newline at end of file +var _0xdb01=['Variables','UserProfileResource','error','stack','name','send','Variable','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','rows','catch','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get'];(function(_0x2a3428,_0x4522d5){var _0x29f234=function(_0x407bdf){while(--_0x407bdf){_0x2a3428['push'](_0x2a3428['shift']());}};_0x29f234(++_0x4522d5);}(_0xdb01,0x16d));var _0x1db0=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0xdb01[_0x284a61];return _0x220e3c;};'use strict';var pdf=require(_0x1db0('0x0'));var emlformat=require(_0x1db0('0x1'));var rimraf=require(_0x1db0('0x2'));var zipdir=require(_0x1db0('0x3'));var jsonpatch=require(_0x1db0('0x4'));var rp=require(_0x1db0('0x5'));var moment=require('moment');var BPromise=require(_0x1db0('0x6'));var Mustache=require(_0x1db0('0x7'));var util=require(_0x1db0('0x8'));var path=require(_0x1db0('0x9'));var sox=require(_0x1db0('0xa'));var csv=require(_0x1db0('0xb'));var ejs=require(_0x1db0('0xc'));var fs=require('fs');var _=require(_0x1db0('0xd'));var squel=require(_0x1db0('0xe'));var crypto=require('crypto');var jsforce=require(_0x1db0('0xf'));var deskjs=require(_0x1db0('0x10'));var toCsv=require(_0x1db0('0xb'));var querystring=require(_0x1db0('0x11'));var Papa=require('papaparse');var Redis=require(_0x1db0('0x12'));var authService=require(_0x1db0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1db0('0x14'));var hardwareService=require(_0x1db0('0x15'));var logger=require(_0x1db0('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1db0('0x17'));var db=require(_0x1db0('0x18'))['db'];function respondWithStatusCode(_0x494a8a,_0x1816cf){_0x1816cf=_0x1816cf||0xcc;return function(_0xceb832){if(_0xceb832){return _0x494a8a[_0x1db0('0x19')](_0x1816cf);}return _0x494a8a[_0x1db0('0x1a')](_0x1816cf)[_0x1db0('0x1b')]();};}function respondWithResult(_0x2d587b,_0xae1b82){_0xae1b82=_0xae1b82||0xc8;return function(_0x30442c){if(_0x30442c){return _0x2d587b['status'](_0xae1b82)[_0x1db0('0x1c')](_0x30442c);}};}function respondWithFilteredResult(_0x389b74,_0x18404f){return function(_0x10fcf7){if(_0x10fcf7){var _0x15b289=_0x10fcf7[_0x1db0('0x1d')],_0x1e2a72=_0x18404f[_0x1db0('0x1e')],_0x2a6c44=_0x18404f[_0x1db0('0x1e')]+_0x18404f[_0x1db0('0x1f')],_0x5c242f;if(_0x2a6c44>=_0x15b289){_0x2a6c44=_0x15b289;_0x5c242f=0xc8;}else{_0x5c242f=0xce;}_0x389b74[_0x1db0('0x1a')](_0x5c242f);return _0x389b74[_0x1db0('0x20')](_0x1db0('0x21'),_0x1e2a72+'-'+_0x2a6c44+'/'+_0x15b289)[_0x1db0('0x1c')](_0x10fcf7);}return null;};}function patchUpdates(_0x5df51a){return function(_0x36af22){try{jsonpatch['apply'](_0x36af22,_0x5df51a,!![]);}catch(_0x4c396d){return BPromise[_0x1db0('0x22')](_0x4c396d);}return _0x36af22[_0x1db0('0x23')]();};}function saveUpdates(_0x4841fd,_0x326a02){return function(_0x1222ad){if(_0x1222ad){return _0x1222ad[_0x1db0('0x24')](_0x4841fd)['then'](function(_0x2cb7a7){return _0x2cb7a7;});}return null;};}function removeEntity(_0x10c837,_0x3297c1){return function(_0x1f29d5){if(_0x1f29d5){return _0x1f29d5[_0x1db0('0x25')]()[_0x1db0('0x26')](function(){var _0x264687=_0x1f29d5[_0x1db0('0x27')]({'plain':!![]});var _0xc1e27a=_0x1db0('0x28');return db[_0x1db0('0x29')][_0x1db0('0x25')]({'where':{'type':_0xc1e27a,'resourceId':_0x264687['id']}})['then'](function(){return _0x1f29d5;});})['then'](function(){_0x10c837[_0x1db0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c894,_0x4ab10a){return function(_0x3ebb47){if(!_0x3ebb47){_0x50c894[_0x1db0('0x19')](0x194);}return _0x3ebb47;};}function handleError(_0x3bbd04,_0x5ed1a4){_0x5ed1a4=_0x5ed1a4||0x1f4;return function(_0xfc3eef){logger[_0x1db0('0x2a')](_0xfc3eef[_0x1db0('0x2b')]);if(_0xfc3eef['name']){delete _0xfc3eef[_0x1db0('0x2c')];}_0x3bbd04['status'](_0x5ed1a4)[_0x1db0('0x2d')](_0xfc3eef);};}exports['index']=function(_0x19dc82,_0x1d0166){var _0x18d784={},_0x22e453={},_0x128a1a={'count':0x0,'rows':[]};var _0x5f2486=_['map'](db[_0x1db0('0x2e')][_0x1db0('0x2f')],function(_0x39a8a6){return{'name':_0x39a8a6[_0x1db0('0x30')],'type':_0x39a8a6['type'][_0x1db0('0x31')]};});_0x22e453[_0x1db0('0x32')]=_['map'](_0x5f2486,_0x1db0('0x2c'));_0x22e453[_0x1db0('0x33')]=_[_0x1db0('0x34')](_0x19dc82['query']);_0x22e453[_0x1db0('0x35')]=_[_0x1db0('0x36')](_0x22e453[_0x1db0('0x32')],_0x22e453['query']);_0x18d784[_0x1db0('0x37')]=_[_0x1db0('0x36')](_0x22e453[_0x1db0('0x32')],qs[_0x1db0('0x38')](_0x19dc82[_0x1db0('0x33')]['fields']));_0x18d784['attributes']=_0x18d784[_0x1db0('0x37')][_0x1db0('0x39')]?_0x18d784['attributes']:_0x22e453['model'];if(!_0x19dc82[_0x1db0('0x33')][_0x1db0('0x3a')]('nolimit')){_0x18d784[_0x1db0('0x1f')]=qs[_0x1db0('0x1f')](_0x19dc82[_0x1db0('0x33')][_0x1db0('0x1f')]);_0x18d784[_0x1db0('0x1e')]=qs[_0x1db0('0x1e')](_0x19dc82['query'][_0x1db0('0x1e')]);}_0x18d784[_0x1db0('0x3b')]=qs[_0x1db0('0x3c')](_0x19dc82[_0x1db0('0x33')][_0x1db0('0x3c')]);_0x18d784[_0x1db0('0x3d')]=qs[_0x1db0('0x35')](_[_0x1db0('0x3e')](_0x19dc82[_0x1db0('0x33')],_0x22e453[_0x1db0('0x35')]),_0x5f2486);if(_0x19dc82[_0x1db0('0x33')][_0x1db0('0x3f')]){_0x18d784[_0x1db0('0x3d')]=_[_0x1db0('0x40')](_0x18d784[_0x1db0('0x3d')],{'$or':_[_0x1db0('0x41')](_0x5f2486,function(_0x52f527){if(_0x52f527[_0x1db0('0x42')]!==_0x1db0('0x43')){var _0x1e555c={};_0x1e555c[_0x52f527[_0x1db0('0x2c')]]={'$like':'%'+_0x19dc82[_0x1db0('0x33')]['filter']+'%'};return _0x1e555c;}})});}_0x18d784=_[_0x1db0('0x40')]({},_0x18d784,_0x19dc82[_0x1db0('0x44')]);var _0x23481a={'where':_0x18d784[_0x1db0('0x3d')]};return db['Variable']['count'](_0x23481a)[_0x1db0('0x26')](function(_0x23cc6d){_0x128a1a[_0x1db0('0x1d')]=_0x23cc6d;if(_0x19dc82[_0x1db0('0x33')]['includeAll']){_0x18d784['include']=[{'all':!![]}];}return db[_0x1db0('0x2e')]['findAll'](_0x18d784);})[_0x1db0('0x26')](function(_0x25e647){_0x128a1a[_0x1db0('0x45')]=_0x25e647;return _0x128a1a;})[_0x1db0('0x26')](respondWithFilteredResult(_0x1d0166,_0x18d784))[_0x1db0('0x46')](handleError(_0x1d0166,null));};exports['show']=function(_0x3cb461,_0x29ea0a){var _0x51c9c2={'raw':!![],'where':{'id':_0x3cb461[_0x1db0('0x47')]['id']}},_0xbfc997={};_0xbfc997[_0x1db0('0x32')]=_[_0x1db0('0x34')](db[_0x1db0('0x2e')]['rawAttributes']);_0xbfc997[_0x1db0('0x33')]=_[_0x1db0('0x34')](_0x3cb461[_0x1db0('0x33')]);_0xbfc997['filters']=_[_0x1db0('0x36')](_0xbfc997[_0x1db0('0x32')],_0xbfc997[_0x1db0('0x33')]);_0x51c9c2[_0x1db0('0x37')]=_['intersection'](_0xbfc997[_0x1db0('0x32')],qs['fields'](_0x3cb461[_0x1db0('0x33')]['fields']));_0x51c9c2[_0x1db0('0x37')]=_0x51c9c2[_0x1db0('0x37')]['length']?_0x51c9c2[_0x1db0('0x37')]:_0xbfc997[_0x1db0('0x32')];if(_0x3cb461['query'][_0x1db0('0x48')]){_0x51c9c2[_0x1db0('0x49')]=[{'all':!![]}];}_0x51c9c2=_[_0x1db0('0x40')]({},_0x51c9c2,_0x3cb461[_0x1db0('0x44')]);return db[_0x1db0('0x2e')]['find'](_0x51c9c2)['then'](handleEntityNotFound(_0x29ea0a,null))[_0x1db0('0x26')](respondWithResult(_0x29ea0a,null))[_0x1db0('0x46')](handleError(_0x29ea0a,null));};exports[_0x1db0('0x4a')]=function(_0x1d4c04,_0xf08cb9){return db[_0x1db0('0x2e')]['create'](_0x1d4c04[_0x1db0('0x4b')],{})[_0x1db0('0x26')](function(_0x269d7e){var _0x3e6385=_0x1d4c04[_0x1db0('0x4c')][_0x1db0('0x27')]({'plain':!![]});if(!_0x3e6385)throw new Error(_0x1db0('0x4d'));if(_0x3e6385['role']===_0x1db0('0x4c')){var _0x1d46fc=_0x269d7e[_0x1db0('0x27')]({'plain':!![]});var _0x281b53=_0x1db0('0x28');return db[_0x1db0('0x4e')][_0x1db0('0x4f')]({'where':{'name':_0x281b53,'userProfileId':_0x3e6385['userProfileId']},'raw':!![]})[_0x1db0('0x26')](function(_0x5d064a){if(_0x5d064a&&_0x5d064a[_0x1db0('0x50')]===0x0){return db[_0x1db0('0x29')]['create']({'name':_0x1d46fc['name'],'resourceId':_0x1d46fc['id'],'type':_0x5d064a[_0x1db0('0x2c')],'sectionId':_0x5d064a['id']},{})[_0x1db0('0x26')](function(){return _0x269d7e;});}else{return _0x269d7e;}})[_0x1db0('0x46')](function(_0x1ea329){logger[_0x1db0('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ea329);throw _0x1ea329;});}return _0x269d7e;})[_0x1db0('0x26')](respondWithResult(_0xf08cb9,0xc9))[_0x1db0('0x46')](handleError(_0xf08cb9,null));};exports[_0x1db0('0x24')]=function(_0x4edba6,_0x2e4d8e){if(_0x4edba6['body']['id']){delete _0x4edba6[_0x1db0('0x4b')]['id'];}return db[_0x1db0('0x2e')][_0x1db0('0x4f')]({'where':{'id':_0x4edba6[_0x1db0('0x47')]['id']}})[_0x1db0('0x26')](handleEntityNotFound(_0x2e4d8e,null))[_0x1db0('0x26')](saveUpdates(_0x4edba6[_0x1db0('0x4b')],null))[_0x1db0('0x26')](respondWithResult(_0x2e4d8e,null))[_0x1db0('0x46')](handleError(_0x2e4d8e,null));};exports['destroy']=function(_0x577eb1,_0x4629fa){return db[_0x1db0('0x2e')][_0x1db0('0x4f')]({'where':{'id':_0x577eb1['params']['id']}})[_0x1db0('0x26')](handleEntityNotFound(_0x4629fa,null))[_0x1db0('0x26')](removeEntity(_0x4629fa,null))[_0x1db0('0x46')](handleError(_0x4629fa,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 1cac437..779aed4 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 _0x474b=['rimraf','../../config/environment','exports','Variable','tools_variables','lodash','util','../../config/logger','api','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x474b,0x177));var _0xb474=function(_0x3034bd,_0x35e5bc){_0x3034bd=_0x3034bd-0x0;var _0x58ace1=_0x474b[_0x3034bd];return _0x58ace1;};'use strict';var _=require(_0xb474('0x0'));var util=require(_0xb474('0x1'));var logger=require(_0xb474('0x2'))(_0xb474('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb474('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb474('0x5'));var config=require(_0xb474('0x6'));var attributes=require('./variable.attributes');module[_0xb474('0x7')]=function(_0x43334a,_0x462560){return _0x43334a['define'](_0xb474('0x8'),attributes,{'tableName':_0xb474('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee5c=['tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable'];(function(_0x30d741,_0xdf9600){var _0x252b78=function(_0x1c1f0c){while(--_0x1c1f0c){_0x30d741['push'](_0x30d741['shift']());}};_0x252b78(++_0xdf9600);}(_0xee5c,0xb7));var _0xcee5=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xee5c[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0xcee5('0x0'));var util=require(_0xcee5('0x1'));var logger=require(_0xcee5('0x2'))(_0xcee5('0x3'));var moment=require('moment');var BPromise=require(_0xcee5('0x4'));var rp=require(_0xcee5('0x5'));var fs=require('fs');var path=require(_0xcee5('0x6'));var rimraf=require(_0xcee5('0x7'));var config=require(_0xcee5('0x8'));var attributes=require(_0xcee5('0x9'));module[_0xcee5('0xa')]=function(_0x30fd77,_0x103c3e){return _0x30fd77[_0xcee5('0xb')](_0xcee5('0xc'),attributes,{'tableName':_0xcee5('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 80da235..0ee8b64 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 _0x8a30=['where','include','map','model','attributes','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowVariable','Variable','find','options','raw'];(function(_0x467c4a,_0x4c50cc){var _0x4a5f7e=function(_0x1f3952){while(--_0x1f3952){_0x467c4a['push'](_0x467c4a['shift']());}};_0x4a5f7e(++_0x4c50cc);}(_0x8a30,0x1e6));var _0x08a3=function(_0x39e97f,_0x2ed5bc){_0x39e97f=_0x39e97f-0x0;var _0x28d55c=_0x8a30[_0x39e97f];return _0x28d55c;};'use strict';var _=require(_0x08a3('0x0'));var util=require(_0x08a3('0x1'));var moment=require('moment');var BPromise=require(_0x08a3('0x2'));var rs=require(_0x08a3('0x3'));var fs=require('fs');var Redis=require(_0x08a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x08a3('0x5'));var logger=require(_0x08a3('0x6'))(_0x08a3('0x7'));var config=require(_0x08a3('0x8'));var jayson=require(_0x08a3('0x9'));var client=jayson['client'][_0x08a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x108a7d,_0x216457,_0x3772c4){return new BPromise(function(_0x41346a,_0x341fee){return client['request'](_0x108a7d,_0x3772c4)[_0x08a3('0xb')](function(_0x182ec9){logger[_0x08a3('0xc')](_0x08a3('0xd'),_0x216457,_0x08a3('0xe'));logger[_0x08a3('0xf')](_0x08a3('0x10'),_0x216457,_0x08a3('0xe'),JSON[_0x08a3('0x11')](_0x182ec9));if(_0x182ec9[_0x08a3('0x12')]){if(_0x182ec9[_0x08a3('0x12')][_0x08a3('0x13')]===0x1f4){logger[_0x08a3('0x12')](_0x08a3('0xd'),_0x216457,_0x182ec9[_0x08a3('0x12')][_0x08a3('0x14')]);return _0x341fee(_0x182ec9[_0x08a3('0x12')]['message']);}logger['error'](_0x08a3('0xd'),_0x216457,_0x182ec9[_0x08a3('0x12')][_0x08a3('0x14')]);return _0x41346a(_0x182ec9[_0x08a3('0x12')][_0x08a3('0x14')]);}else{logger[_0x08a3('0xc')](_0x08a3('0xd'),_0x216457,_0x08a3('0xe'));_0x41346a(_0x182ec9['result'][_0x08a3('0x14')]);}})['catch'](function(_0xa3a0b2){logger[_0x08a3('0x12')](_0x08a3('0xd'),_0x216457,_0xa3a0b2);_0x341fee(_0xa3a0b2);});});}exports[_0x08a3('0x15')]=function(_0x4f345a){var _0x479360=this;return new Promise(function(_0x322db2,_0x4ba63f){return db[_0x08a3('0x16')][_0x08a3('0x17')]({'raw':_0x4f345a[_0x08a3('0x18')]?_0x4f345a[_0x08a3('0x18')][_0x08a3('0x19')]===undefined?!![]:![]:!![],'where':_0x4f345a['options']?_0x4f345a[_0x08a3('0x18')][_0x08a3('0x1a')]||null:null,'attributes':_0x4f345a[_0x08a3('0x18')]?_0x4f345a[_0x08a3('0x18')]['attributes']||null:null,'include':_0x4f345a[_0x08a3('0x18')]?_0x4f345a[_0x08a3('0x18')][_0x08a3('0x1b')]?_[_0x08a3('0x1c')](_0x4f345a[_0x08a3('0x18')]['include'],function(_0x4bfb06){return{'model':db[_0x4bfb06[_0x08a3('0x1d')]],'as':_0x4bfb06['as'],'attributes':_0x4bfb06['attributes'],'include':_0x4bfb06[_0x08a3('0x1b')]?_[_0x08a3('0x1c')](_0x4bfb06[_0x08a3('0x1b')],function(_0x1bd66d){return{'model':db[_0x1bd66d[_0x08a3('0x1d')]],'as':_0x1bd66d['as'],'attributes':_0x1bd66d[_0x08a3('0x1e')],'include':_0x1bd66d['include']?_[_0x08a3('0x1c')](_0x1bd66d[_0x08a3('0x1b')],function(_0x10f131){return{'model':db[_0x10f131['model']],'as':_0x10f131['as'],'attributes':_0x10f131['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xdf9d25){logger[_0x08a3('0xc')](_0x08a3('0x15'),_0x4f345a);logger[_0x08a3('0xf')](_0x08a3('0x15'),_0x4f345a,JSON['stringify'](_0xdf9d25));_0x322db2(_0xdf9d25);})[_0x08a3('0x1f')](function(_0x440d7f){logger[_0x08a3('0x12')](_0x08a3('0x15'),_0x440d7f[_0x08a3('0x14')],_0x4f345a);_0x4ba63f(_0x479360['error'](0x1f4,_0x440d7f['message']));});});}; \ No newline at end of file +var _0x1e94=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Variable','options','where','attributes','include','map','model','ShowVariable','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1e94,0x102));var _0x41e9=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x1e94[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0x41e9('0x0'));var util=require(_0x41e9('0x1'));var moment=require(_0x41e9('0x2'));var BPromise=require(_0x41e9('0x3'));var rs=require(_0x41e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41e9('0x5'))['db'];var utils=require(_0x41e9('0x6'));var logger=require(_0x41e9('0x7'))(_0x41e9('0x8'));var config=require(_0x41e9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41e9('0xa')][_0x41e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e539b,_0x2bc87d,_0x17665c){return new BPromise(function(_0x2ae304,_0x4d2db9){return client[_0x41e9('0xc')](_0x5e539b,_0x17665c)[_0x41e9('0xd')](function(_0x169b71){logger[_0x41e9('0xe')](_0x41e9('0xf'),_0x2bc87d,_0x41e9('0x10'));logger[_0x41e9('0x11')](_0x41e9('0x12'),_0x2bc87d,_0x41e9('0x10'),JSON[_0x41e9('0x13')](_0x169b71));if(_0x169b71[_0x41e9('0x14')]){if(_0x169b71[_0x41e9('0x14')][_0x41e9('0x15')]===0x1f4){logger['error'](_0x41e9('0xf'),_0x2bc87d,_0x169b71['error']['message']);return _0x4d2db9(_0x169b71[_0x41e9('0x14')]['message']);}logger['error'](_0x41e9('0xf'),_0x2bc87d,_0x169b71[_0x41e9('0x14')][_0x41e9('0x16')]);return _0x2ae304(_0x169b71['error'][_0x41e9('0x16')]);}else{logger[_0x41e9('0xe')](_0x41e9('0xf'),_0x2bc87d,_0x41e9('0x10'));_0x2ae304(_0x169b71[_0x41e9('0x17')][_0x41e9('0x16')]);}})['catch'](function(_0x417994){logger[_0x41e9('0x14')](_0x41e9('0xf'),_0x2bc87d,_0x417994);_0x4d2db9(_0x417994);});});}exports['ShowVariable']=function(_0x14acda){var _0x496b5b=this;return new Promise(function(_0x178277,_0x14ecaa){return db[_0x41e9('0x18')]['find']({'raw':_0x14acda[_0x41e9('0x19')]?_0x14acda[_0x41e9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x14acda[_0x41e9('0x19')]?_0x14acda[_0x41e9('0x19')][_0x41e9('0x1a')]||null:null,'attributes':_0x14acda['options']?_0x14acda[_0x41e9('0x19')][_0x41e9('0x1b')]||null:null,'include':_0x14acda[_0x41e9('0x19')]?_0x14acda[_0x41e9('0x19')][_0x41e9('0x1c')]?_[_0x41e9('0x1d')](_0x14acda[_0x41e9('0x19')][_0x41e9('0x1c')],function(_0x27f5ab){return{'model':db[_0x27f5ab[_0x41e9('0x1e')]],'as':_0x27f5ab['as'],'attributes':_0x27f5ab[_0x41e9('0x1b')],'include':_0x27f5ab[_0x41e9('0x1c')]?_[_0x41e9('0x1d')](_0x27f5ab['include'],function(_0x134602){return{'model':db[_0x134602[_0x41e9('0x1e')]],'as':_0x134602['as'],'attributes':_0x134602[_0x41e9('0x1b')],'include':_0x134602[_0x41e9('0x1c')]?_[_0x41e9('0x1d')](_0x134602[_0x41e9('0x1c')],function(_0x57a8d5){return{'model':db[_0x57a8d5[_0x41e9('0x1e')]],'as':_0x57a8d5['as'],'attributes':_0x57a8d5[_0x41e9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x41e9('0xd')](function(_0x5e0bc5){logger[_0x41e9('0xe')](_0x41e9('0x1f'),_0x14acda);logger[_0x41e9('0x11')](_0x41e9('0x1f'),_0x14acda,JSON[_0x41e9('0x13')](_0x5e0bc5));_0x178277(_0x5e0bc5);})[_0x41e9('0x20')](function(_0x52fc39){logger[_0x41e9('0x14')](_0x41e9('0x1f'),_0x52fc39[_0x41e9('0x16')],_0x14acda);_0x14ecaa(_0x496b5b[_0x41e9('0x14')](0x1f4,_0x52fc39[_0x41e9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b540819..f5a83d7 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 _0x6467=['express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations'];(function(_0x30a8ee,_0x2ffb71){var _0x337657=function(_0x418bc8){while(--_0x418bc8){_0x30a8ee['push'](_0x30a8ee['shift']());}};_0x337657(++_0x2ffb71);}(_0x6467,0x110));var _0x7646=function(_0x420de5,_0x37b9a3){_0x420de5=_0x420de5-0x0;var _0xc06fd9=_0x6467[_0x420de5];return _0xc06fd9;};'use strict';var express=require(_0x7646('0x0'));var router=express[_0x7646('0x1')]();var auth=require(_0x7646('0x2'));var controller=require(_0x7646('0x3'));router[_0x7646('0x4')]('/',controller['index']);router['get'](_0x7646('0x5'),auth[_0x7646('0x6')](),auth[_0x7646('0x7')](),controller[_0x7646('0x8')]);router[_0x7646('0x4')](_0x7646('0x9'),auth[_0x7646('0x6')](),auth[_0x7646('0x7')](),controller[_0x7646('0xa')]);router['get'](_0x7646('0xb'),auth[_0x7646('0x6')](),auth[_0x7646('0x7')](),controller[_0x7646('0xc')]);router[_0x7646('0x4')](_0x7646('0xd'),auth[_0x7646('0x6')](),controller[_0x7646('0xe')]);router[_0x7646('0x4')](_0x7646('0xf'),controller['migrations']);module['exports']=router; \ No newline at end of file +var _0xa3ec=['/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','index','get','isAuthenticated','canUpdate','fetch'];(function(_0x544f04,_0x3ad158){var _0x2f200e=function(_0x5c980c){while(--_0x5c980c){_0x544f04['push'](_0x544f04['shift']());}};_0x2f200e(++_0x3ad158);}(_0xa3ec,0x195));var _0xca3e=function(_0x27c1e3,_0x413cf3){_0x27c1e3=_0x27c1e3-0x0;var _0x2ad841=_0xa3ec[_0x27c1e3];return _0x2ad841;};'use strict';var express=require(_0xca3e('0x0'));var router=express[_0xca3e('0x1')]();var auth=require(_0xca3e('0x2'));var controller=require(_0xca3e('0x3'));router['get']('/',controller[_0xca3e('0x4')]);router[_0xca3e('0x5')]('/fetch',auth[_0xca3e('0x6')](),auth[_0xca3e('0x7')](),controller[_0xca3e('0x8')]);router[_0xca3e('0x5')](_0xca3e('0x9'),auth[_0xca3e('0x6')](),auth[_0xca3e('0x7')](),controller[_0xca3e('0xa')]);router['get'](_0xca3e('0xb'),auth['isAuthenticated'](),auth[_0xca3e('0x7')](),controller[_0xca3e('0xc')]);router[_0xca3e('0x5')](_0xca3e('0xd'),auth[_0xca3e('0x6')](),controller[_0xca3e('0xe')]);router[_0xca3e('0x5')](_0xca3e('0xf'),controller[_0xca3e('0x10')]);module[_0xca3e('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 6ad142b..26f83ad 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 _0x6fc2=['error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.js','push','length','sort','Migration','sequelize','getQueryInterface','constructor','server','map','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','../../config/environment','../../config/pm2','update','simple-git','root','index','query','fetch','tags','latest','exports','2.0.0','status','json','origin','master'];(function(_0x2ccbc0,_0x36bae4){var _0x43469a=function(_0x1c769e){while(--_0x1c769e){_0x2ccbc0['push'](_0x2ccbc0['shift']());}};_0x43469a(++_0x36bae4);}(_0x6fc2,0x117));var _0x26fc=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6fc2[_0x27af45];return _0x18df21;};'use strict';var Umzug=require(_0x26fc('0x0'));var path=require(_0x26fc('0x1'));var fs=require('fs');var _=require(_0x26fc('0x2'));var pkginfo=require('pkginfo')(module,_0x26fc('0x3'));var compareVersions=require(_0x26fc('0x4'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x26fc('0x5'));var pm2=require(_0x26fc('0x6'));var logger=require('../../config/logger')(_0x26fc('0x7'));var git=require(_0x26fc('0x8'))(config[_0x26fc('0x9')]);exports[_0x26fc('0xa')]=function(_0x5c87f2,_0x23c15a){var _0x5616eb={'current':module['exports'][_0x26fc('0x3')],'phonebar':0x2};if(_0x5c87f2[_0x26fc('0xb')]&&_0x5c87f2[_0x26fc('0xb')]['latest']){return git[_0x26fc('0xc')]()[_0x26fc('0xd')](function(_0x23171d,_0x1fe47f){_0x5616eb[_0x26fc('0xe')]=(_0x23171d?module[_0x26fc('0xf')][_0x26fc('0x3')]:_0x1fe47f[_0x26fc('0xe')])||_0x26fc('0x10');return _0x23c15a[_0x26fc('0x11')](0xc8)[_0x26fc('0x12')](_0x5616eb);});}else{return _0x23c15a[_0x26fc('0x11')](0xc8)[_0x26fc('0x12')](_0x5616eb);}};exports[_0x26fc('0xc')]=function(_0x1c7f2c,_0x178667){return git['fetch']([_0x26fc('0x13'),_0x26fc('0x14')],function(_0x1f1903){if(_0x1f1903){logger[_0x26fc('0x15')](_0x1f1903);return _0x178667[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x1f1903);}logger[_0x26fc('0x16')](_0x26fc('0x17'));return _0x178667[_0x26fc('0x11')](0xc8)['json']({'output':_0x26fc('0x18')});});};exports['reset']=function(_0x2da252,_0x3507b1){return git[_0x26fc('0x19')]([_0x26fc('0x1a'),'FETCH_HEAD'],function(_0x463117){if(_0x463117){logger[_0x26fc('0x15')](_0x463117);return _0x3507b1[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x463117);}logger[_0x26fc('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3507b1['status'](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x4fa549,_0x2339ad){exec('npm\x20install\x20--production',function(_0x2fb061,_0x1b05d1,_0x562c00){logger[_0x26fc('0x16')](_0x1b05d1);logger[_0x26fc('0x16')](_0x562c00);if(_0x2fb061){logger[_0x26fc('0x15')](_0x2fb061);return _0x2339ad[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x2fb061);}return _0x2339ad[_0x26fc('0x11')](0xc8)['json']({'output':_0x1b05d1});});};exports[_0x26fc('0x1b')]=function(_0x435d72,_0x1a9313){return pm2[_0x26fc('0x1b')](_0x26fc('0x1c'))[_0x26fc('0x1d')](function(_0x430a98){logger['info'](_0x26fc('0x1e'),_0x430a98);return _0x1a9313[_0x26fc('0x11')](0xc8)[_0x26fc('0x12')]({'output':_0x26fc('0x1f')});})[_0x26fc('0x20')](function(_0x12ecb7){logger['error'](_0x12ecb7);return _0x1a9313[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x12ecb7);});};exports[_0x26fc('0x21')]=function(_0x32088c,_0x2bde13){var _0x14ecff=fs[_0x26fc('0x22')](path[_0x26fc('0x23')](config['root'],'server','migrations'));var _0x297e53=[];for(var _0x4b7ee4=0x0;_0x4b7ee4<_0x14ecff['length'];_0x4b7ee4++){var _0x20e995=_0x14ecff[_0x4b7ee4][_0x26fc('0x24')](_0x26fc('0x25'),'');if(compareVersions(module[_0x26fc('0xf')][_0x26fc('0x3')],_0x20e995)===-0x1){_0x297e53[_0x26fc('0x26')](_0x20e995);}}if(_0x297e53[_0x26fc('0x27')]){var _0x1661cd=_0x297e53[_0x26fc('0x28')](compareVersions);var _0x2466ab=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x26fc('0x29')],'modelName':_0x26fc('0x29'),'columnName':_0x26fc('0x3')},'migrations':{'params':[db[_0x26fc('0x2a')][_0x26fc('0x2b')](),db[_0x26fc('0x2a')][_0x26fc('0x2c')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x26fc('0x23')](config['root'],_0x26fc('0x2d'),_0x26fc('0x21')),'pattern':/\.js$/}});_0x2466ab['up']({'migrations':_[_0x26fc('0x2e')](_0x1661cd,function(_0x324e43){return _0x324e43+_0x26fc('0x25');})})['then'](function(){return _0x2bde13[_0x26fc('0x11')](0xc8)[_0x26fc('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x26fc('0xf')]['version']+_0x26fc('0x2f')+_[_0x26fc('0x30')](_0x1661cd),'migrations':_[_0x26fc('0x23')](_0x1661cd)});})[_0x26fc('0x20')](function(_0x39b202){if(_0x39b202 instanceof db[_0x26fc('0x2a')]['UniqueConstraintError']){return _0x2bde13['status'](0xc8)[_0x26fc('0x12')]({'output':_0x26fc('0x31')});}else{return _0x2bde13[_0x26fc('0x11')](0x1f4)[_0x26fc('0x12')](_0x39b202);}});}else{return _0x2bde13['status'](0xc8)[_0x26fc('0x12')]({'output':_0x26fc('0x31')});}}; \ No newline at end of file +var _0xf643=['getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','sequelize','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','length','replace','push'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xf643,0x122));var _0x3f64=function(_0x55c2a5,_0x3ab35b){_0x55c2a5=_0x55c2a5-0x0;var _0x177d1d=_0xf643[_0x55c2a5];return _0x177d1d;};'use strict';var Umzug=require(_0x3f64('0x0'));var path=require(_0x3f64('0x1'));var fs=require('fs');var _=require(_0x3f64('0x2'));var pkginfo=require(_0x3f64('0x3'))(module,'version');var compareVersions=require(_0x3f64('0x4'));var exec=require(_0x3f64('0x5'))['exec'];var db=require(_0x3f64('0x6'))['db'];var config=require(_0x3f64('0x7'));var pm2=require(_0x3f64('0x8'));var logger=require(_0x3f64('0x9'))(_0x3f64('0xa'));var git=require(_0x3f64('0xb'))(config[_0x3f64('0xc')]);exports[_0x3f64('0xd')]=function(_0x40b245,_0x2a7c90){var _0x219dcb={'current':module[_0x3f64('0xe')][_0x3f64('0xf')],'phonebar':0x2};if(_0x40b245[_0x3f64('0x10')]&&_0x40b245[_0x3f64('0x10')]['latest']){return git[_0x3f64('0x11')]()[_0x3f64('0x12')](function(_0x8aa885,_0x506f2a){_0x219dcb[_0x3f64('0x13')]=(_0x8aa885?module[_0x3f64('0xe')][_0x3f64('0xf')]:_0x506f2a[_0x3f64('0x13')])||_0x3f64('0x14');return _0x2a7c90[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')](_0x219dcb);});}else{return _0x2a7c90[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')](_0x219dcb);}};exports[_0x3f64('0x11')]=function(_0x4b77e1,_0x3165b6){return git['fetch']([_0x3f64('0x17'),_0x3f64('0x18')],function(_0x3fb0bd){if(_0x3fb0bd){logger[_0x3f64('0x19')](_0x3fb0bd);return _0x3165b6['status'](0x1f4)[_0x3f64('0x16')](_0x3fb0bd);}logger[_0x3f64('0x1a')](_0x3f64('0x1b'));return _0x3165b6[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x1c')});});};exports[_0x3f64('0x1d')]=function(_0x5ac514,_0xbcf1aa){return git[_0x3f64('0x1d')]([_0x3f64('0x1e'),'FETCH_HEAD'],function(_0x628b59){if(_0x628b59){logger['error'](_0x628b59);return _0xbcf1aa['status'](0x1f4)[_0x3f64('0x16')](_0x628b59);}logger[_0x3f64('0x1a')](_0x3f64('0x1f'));return _0xbcf1aa['status'](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x20')});});};exports[_0x3f64('0x21')]=function(_0x5f5507,_0x16b3fd){exec(_0x3f64('0x22'),function(_0x4c725c,_0xc72655,_0x3faf46){logger['info'](_0xc72655);logger['info'](_0x3faf46);if(_0x4c725c){logger['error'](_0x4c725c);return _0x16b3fd[_0x3f64('0x15')](0x1f4)[_0x3f64('0x16')](_0x4c725c);}return _0x16b3fd[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0xc72655});});};exports[_0x3f64('0x23')]=function(_0x48be0c,_0x222097){return pm2[_0x3f64('0x23')](_0x3f64('0x24'))[_0x3f64('0x25')](function(_0x383780){logger[_0x3f64('0x1a')](_0x3f64('0x26'),_0x383780);return _0x222097[_0x3f64('0x15')](0xc8)['json']({'output':_0x3f64('0x27')});})['catch'](function(_0x473b46){logger[_0x3f64('0x19')](_0x473b46);return _0x222097[_0x3f64('0x15')](0x1f4)[_0x3f64('0x16')](_0x473b46);});};exports[_0x3f64('0x28')]=function(_0x307efc,_0x286b2a){var _0x1bcefe=fs[_0x3f64('0x29')](path[_0x3f64('0x2a')](config['root'],'server',_0x3f64('0x28')));var _0x5a03a8=[];for(var _0x34e8cc=0x0;_0x34e8cc<_0x1bcefe[_0x3f64('0x2b')];_0x34e8cc++){var _0x211da2=_0x1bcefe[_0x34e8cc][_0x3f64('0x2c')]('.js','');if(compareVersions(module['exports'][_0x3f64('0xf')],_0x211da2)===-0x1){_0x5a03a8[_0x3f64('0x2d')](_0x211da2);}}if(_0x5a03a8[_0x3f64('0x2b')]){var _0x2a2579=_0x5a03a8['sort'](compareVersions);var _0x1ee952=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x3f64('0xf')},'migrations':{'params':[db['sequelize'][_0x3f64('0x2e')](),db['sequelize'][_0x3f64('0x2f')],function(){throw new Error(_0x3f64('0x30'));}],'path':path[_0x3f64('0x2a')](config[_0x3f64('0xc')],'server',_0x3f64('0x28')),'pattern':/\.js$/}});_0x1ee952['up']({'migrations':_[_0x3f64('0x31')](_0x2a2579,function(_0x2fe6b5){return _0x2fe6b5+'.js';})})['then'](function(){return _0x286b2a[_0x3f64('0x15')](0xc8)['json']({'output':_0x3f64('0x32')+module[_0x3f64('0xe')][_0x3f64('0xf')]+'\x20to\x20'+_[_0x3f64('0x33')](_0x2a2579),'migrations':_[_0x3f64('0x2a')](_0x2a2579)});})[_0x3f64('0x34')](function(_0x4210c6){if(_0x4210c6 instanceof db[_0x3f64('0x35')][_0x3f64('0x36')]){return _0x286b2a[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x37')});}else{return _0x286b2a[_0x3f64('0x15')](0x1f4)[_0x3f64('0x16')](_0x4210c6);}});}else{return _0x286b2a[_0x3f64('0x15')](0xc8)[_0x3f64('0x16')]({'output':_0x3f64('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d1a2b91..28299e2 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 _0xa21f=['delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','update'];(function(_0xe78d3,_0x805b82){var _0x53dbe0=function(_0x52aa66){while(--_0x52aa66){_0xe78d3['push'](_0xe78d3['shift']());}};_0x53dbe0(++_0x805b82);}(_0xa21f,0x1b3));var _0xfa21=function(_0x5378ef,_0x5abb1c){_0x5378ef=_0x5378ef-0x0;var _0x9095cb=_0xa21f[_0x5378ef];return _0x9095cb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfa21('0x0'));var express=require(_0xfa21('0x1'));var router=express[_0xfa21('0x2')]();var auth=require(_0xfa21('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfa21('0x4'));var controller=require('./voiceAgentReport.controller');router[_0xfa21('0x5')]('/',auth[_0xfa21('0x6')](),controller[_0xfa21('0x7')]);router[_0xfa21('0x5')]('/describe',auth[_0xfa21('0x6')](),controller[_0xfa21('0x8')]);router[_0xfa21('0x5')](_0xfa21('0x9'),auth[_0xfa21('0x6')](),controller['show']);router[_0xfa21('0xa')]('/',auth[_0xfa21('0x6')](),controller[_0xfa21('0xb')]);router['put'](_0xfa21('0x9'),auth[_0xfa21('0x6')](),controller[_0xfa21('0xc')]);router[_0xfa21('0xd')]('/:id',auth[_0xfa21('0x6')](),controller[_0xfa21('0xe')]);module[_0xfa21('0xf')]=router; \ No newline at end of file +var _0x8761=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x3eb9fb,_0x284cb6){var _0x5a5e11=function(_0x43db05){while(--_0x43db05){_0x3eb9fb['push'](_0x3eb9fb['shift']());}};_0x5a5e11(++_0x284cb6);}(_0x8761,0xf5));var _0x1876=function(_0xc780db,_0x480155){_0xc780db=_0xc780db-0x0;var _0x3d5621=_0x8761[_0xc780db];return _0x3d5621;};'use strict';var multer=require('multer');var util=require(_0x1876('0x0'));var path=require(_0x1876('0x1'));var timeout=require(_0x1876('0x2'));var express=require('express');var router=express[_0x1876('0x3')]();var auth=require(_0x1876('0x4'));var interaction=require(_0x1876('0x5'));var config=require('../../config/environment');var controller=require(_0x1876('0x6'));router[_0x1876('0x7')]('/',auth[_0x1876('0x8')](),controller['index']);router[_0x1876('0x7')](_0x1876('0x9'),auth[_0x1876('0x8')](),controller[_0x1876('0xa')]);router[_0x1876('0x7')](_0x1876('0xb'),auth['isAuthenticated'](),controller[_0x1876('0xc')]);router[_0x1876('0xd')]('/',auth[_0x1876('0x8')](),controller[_0x1876('0xe')]);router[_0x1876('0xf')](_0x1876('0xb'),auth[_0x1876('0x8')](),controller[_0x1876('0x10')]);router[_0x1876('0x11')](_0x1876('0xb'),auth[_0x1876('0x8')](),controller[_0x1876('0x12')]);module[_0x1876('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 0f30379..581b893 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 _0xe14b=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x31cdf3,_0x4f2183){var _0x5623f8=function(_0x4377bc){while(--_0x4377bc){_0x31cdf3['push'](_0x31cdf3['shift']());}};_0x5623f8(++_0x4f2183);}(_0xe14b,0x93));var _0xbe14=function(_0x518bdd,_0x8a8199){_0x518bdd=_0x518bdd-0x0;var _0x2f5202=_0xe14b[_0x518bdd];return _0x2f5202;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xbe14('0x2')]},'calleridname':{'type':Sequelize[_0xbe14('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbe14('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xbe14('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xbe14('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xbe14('0x3')]},'agentdumpAt':{'type':Sequelize[_0xbe14('0x3')]},'holdtime':{'type':Sequelize[_0xbe14('0x4')]},'agentcomplete':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbe14('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbe14('0x4')]},'reason':{'type':Sequelize[_0xbe14('0x2')]},'lastevent':{'type':Sequelize[_0xbe14('0x2')]},'channel':{'type':Sequelize[_0xbe14('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbe14('0x2')]},'connectedlinename':{'type':Sequelize[_0xbe14('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbe14('0x2')]},'context':{'type':Sequelize[_0xbe14('0x2')]},'exten':{'type':Sequelize[_0xbe14('0x2')]},'priority':{'type':Sequelize[_0xbe14('0x2')]},'destchannel':{'type':Sequelize[_0xbe14('0x2')]},'destchannelstate':{'type':Sequelize[_0xbe14('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xbe14('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbe14('0x2')]},'destcalleridname':{'type':Sequelize[_0xbe14('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xbe14('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xbe14('0x2')]},'destlanguage':{'type':Sequelize[_0xbe14('0x2')]},'destaccountcode':{'type':Sequelize[_0xbe14('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xbe14('0x2')]},'destuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xbe14('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbe14('0x2')],'comment':_0xbe14('0x6')},'transferexten':{'type':Sequelize[_0xbe14('0x2')]},'transferuniqueid':{'type':Sequelize[_0xbe14('0x2')]},'agententerreason':{'type':Sequelize[_0xbe14('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeda8=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xeda8,0x104));var _0x8eda=function(_0x16501d,_0x4b1665){_0x16501d=_0x16501d-0x0;var _0x99ce16=_0xeda8[_0x16501d];return _0x99ce16;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8eda('0x2')]},'calleridnum':{'type':Sequelize[_0x8eda('0x2')]},'calleridname':{'type':Sequelize[_0x8eda('0x2')]},'queue':{'type':Sequelize[_0x8eda('0x2')]},'interface':{'type':Sequelize[_0x8eda('0x2')]},'membername':{'type':Sequelize[_0x8eda('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8eda('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8eda('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8eda('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x8eda('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8eda('0x3')]},'holdtime':{'type':Sequelize[_0x8eda('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8eda('0x4')]},'agentacw':{'type':Sequelize[_0x8eda('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x8eda('0x4')]},'channelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8eda('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x8eda('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8eda('0x2')]},'exten':{'type':Sequelize[_0x8eda('0x2')]},'priority':{'type':Sequelize[_0x8eda('0x2')]},'destchannel':{'type':Sequelize[_0x8eda('0x2')]},'destchannelstate':{'type':Sequelize[_0x8eda('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8eda('0x2')]},'destcalleridname':{'type':Sequelize[_0x8eda('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8eda('0x2')]},'destaccountcode':{'type':Sequelize[_0x8eda('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8eda('0x2')]},'destpriority':{'type':Sequelize[_0x8eda('0x2')]},'destuniqueid':{'type':Sequelize[_0x8eda('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x8eda('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8eda('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x8eda('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x8eda('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 1a657d6..d17bd68 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 _0x9d72=['model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','params','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','json','count','offset','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key'];(function(_0x655485,_0x3c8573){var _0x1071f5=function(_0x25c5c6){while(--_0x25c5c6){_0x655485['push'](_0x655485['shift']());}};_0x1071f5(++_0x3c8573);}(_0x9d72,0x1ca));var _0x29d7=function(_0x56adfc,_0x4e5c0d){_0x56adfc=_0x56adfc-0x0;var _0x3064cf=_0x9d72[_0x56adfc];return _0x3064cf;};'use strict';var pdf=require(_0x29d7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x29d7('0x1'));var zipdir=require(_0x29d7('0x2'));var jsonpatch=require(_0x29d7('0x3'));var rp=require(_0x29d7('0x4'));var moment=require('moment');var BPromise=require(_0x29d7('0x5'));var Mustache=require('mustache');var util=require(_0x29d7('0x6'));var path=require(_0x29d7('0x7'));var sox=require(_0x29d7('0x8'));var csv=require(_0x29d7('0x9'));var ejs=require(_0x29d7('0xa'));var fs=require('fs');var _=require(_0x29d7('0xb'));var squel=require(_0x29d7('0xc'));var crypto=require(_0x29d7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x29d7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x29d7('0xf'));var Papa=require(_0x29d7('0x10'));var Redis=require(_0x29d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x29d7('0x12'));var as=require(_0x29d7('0x13'));var hardwareService=require(_0x29d7('0x14'));var logger=require('../../config/logger')(_0x29d7('0x15'));var utils=require(_0x29d7('0x16'));var config=require('../../config/environment');var db=require(_0x29d7('0x17'))['db'];function respondWithStatusCode(_0x30d6b3,_0x485732){_0x485732=_0x485732||0xcc;return function(_0x37fcd8){if(_0x37fcd8){return _0x30d6b3['sendStatus'](_0x485732);}return _0x30d6b3['status'](_0x485732)['end']();};}function respondWithResult(_0x242f10,_0x5bbaac){_0x5bbaac=_0x5bbaac||0xc8;return function(_0x508a29){if(_0x508a29){return _0x242f10[_0x29d7('0x18')](_0x5bbaac)[_0x29d7('0x19')](_0x508a29);}};}function respondWithFilteredResult(_0x5f3ae1,_0x31bc9b){return function(_0x526cc0){if(_0x526cc0){var _0x4f22ba=_0x526cc0[_0x29d7('0x1a')],_0x1877ca=_0x31bc9b[_0x29d7('0x1b')],_0x4b9d75=_0x31bc9b[_0x29d7('0x1b')]+_0x31bc9b['limit'],_0x4477ed;if(_0x4b9d75>=_0x4f22ba){_0x4b9d75=_0x4f22ba;_0x4477ed=0xc8;}else{_0x4477ed=0xce;}_0x5f3ae1[_0x29d7('0x18')](_0x4477ed);return _0x5f3ae1['set'](_0x29d7('0x1c'),_0x1877ca+'-'+_0x4b9d75+'/'+_0x4f22ba)[_0x29d7('0x19')](_0x526cc0);}return null;};}function patchUpdates(_0x363ab6){return function(_0x53dd7c){try{jsonpatch['apply'](_0x53dd7c,_0x363ab6,!![]);}catch(_0x10877e){return BPromise[_0x29d7('0x1d')](_0x10877e);}return _0x53dd7c[_0x29d7('0x1e')]();};}function saveUpdates(_0xa9a59f,_0x7ad32c){return function(_0x4a393c){if(_0x4a393c){return _0x4a393c[_0x29d7('0x1f')](_0xa9a59f)['then'](function(_0x1117da){return _0x1117da;});}return null;};}function removeEntity(_0x2b719d,_0x4dcc2a){return function(_0x2663cf){if(_0x2663cf){return _0x2663cf['destroy']()[_0x29d7('0x20')](function(){_0x2b719d['status'](0xcc)[_0x29d7('0x21')]();});}};}function handleEntityNotFound(_0x51de95,_0x535865){return function(_0x1e23bb){if(!_0x1e23bb){_0x51de95[_0x29d7('0x22')](0x194);}return _0x1e23bb;};}function handleError(_0x3ea1bf,_0x1e2080){_0x1e2080=_0x1e2080||0x1f4;return function(_0x2a5221){logger[_0x29d7('0x23')](_0x2a5221[_0x29d7('0x24')]);if(_0x2a5221[_0x29d7('0x25')]){delete _0x2a5221[_0x29d7('0x25')];}_0x3ea1bf['status'](_0x1e2080)[_0x29d7('0x26')](_0x2a5221);};}exports[_0x29d7('0x27')]=function(_0x3f937b,_0x4daa6d){var _0x4026ab={},_0x19b1ec={},_0x48348d={'count':0x0,'rows':[]};var _0x364e58=_[_0x29d7('0x28')](db[_0x29d7('0x29')][_0x29d7('0x2a')],function(_0x25b66b){return{'name':_0x25b66b[_0x29d7('0x2b')],'type':_0x25b66b[_0x29d7('0x2c')][_0x29d7('0x2d')]};});_0x19b1ec[_0x29d7('0x2e')]=_[_0x29d7('0x28')](_0x364e58,_0x29d7('0x25'));_0x19b1ec['query']=_[_0x29d7('0x2f')](_0x3f937b['query']);_0x19b1ec[_0x29d7('0x30')]=_['intersection'](_0x19b1ec[_0x29d7('0x2e')],_0x19b1ec[_0x29d7('0x31')]);_0x4026ab[_0x29d7('0x32')]=_[_0x29d7('0x33')](_0x19b1ec[_0x29d7('0x2e')],qs[_0x29d7('0x34')](_0x3f937b[_0x29d7('0x31')][_0x29d7('0x34')]));_0x4026ab[_0x29d7('0x32')]=_0x4026ab[_0x29d7('0x32')][_0x29d7('0x35')]?_0x4026ab['attributes']:_0x19b1ec[_0x29d7('0x2e')];if(!_0x3f937b[_0x29d7('0x31')][_0x29d7('0x36')](_0x29d7('0x37'))){_0x4026ab[_0x29d7('0x38')]=qs['limit'](_0x3f937b['query'][_0x29d7('0x38')]);_0x4026ab[_0x29d7('0x1b')]=qs['offset'](_0x3f937b['query'][_0x29d7('0x1b')]);}_0x4026ab[_0x29d7('0x39')]=qs[_0x29d7('0x3a')](_0x3f937b['query'][_0x29d7('0x3a')]);_0x4026ab[_0x29d7('0x3b')]=qs[_0x29d7('0x30')](_['pick'](_0x3f937b['query'],_0x19b1ec[_0x29d7('0x30')]),_0x364e58);if(_0x3f937b['query'][_0x29d7('0x3c')]){_0x4026ab[_0x29d7('0x3b')]=_[_0x29d7('0x3d')](_0x4026ab['where'],{'$or':_[_0x29d7('0x28')](_0x364e58,function(_0x37ddf9){if(_0x37ddf9['type']!=='VIRTUAL'){var _0x178e61={};_0x178e61[_0x37ddf9[_0x29d7('0x25')]]={'$like':'%'+_0x3f937b[_0x29d7('0x31')]['filter']+'%'};return _0x178e61;}})});}_0x4026ab=_[_0x29d7('0x3d')]({},_0x4026ab,_0x3f937b['options']);var _0x5978da={'where':_0x4026ab[_0x29d7('0x3b')]};return db['VoiceAgentReport'][_0x29d7('0x1a')](_0x5978da)[_0x29d7('0x20')](function(_0x29b81d){_0x48348d[_0x29d7('0x1a')]=_0x29b81d;if(_0x3f937b[_0x29d7('0x31')][_0x29d7('0x3e')]){_0x4026ab['include']=[{'all':!![]}];}return db[_0x29d7('0x29')][_0x29d7('0x3f')](_0x4026ab);})[_0x29d7('0x20')](function(_0x2ba14a){_0x48348d[_0x29d7('0x40')]=_0x2ba14a;return _0x48348d;})[_0x29d7('0x20')](respondWithFilteredResult(_0x4daa6d,_0x4026ab))[_0x29d7('0x41')](handleError(_0x4daa6d,null));};exports['show']=function(_0x50a000,_0x5c3135){var _0x101c05={'raw':![],'where':{'id':_0x50a000[_0x29d7('0x42')]['id']}},_0x398ffb={};_0x398ffb[_0x29d7('0x2e')]=_['keys'](db[_0x29d7('0x29')][_0x29d7('0x2a')]);_0x398ffb[_0x29d7('0x31')]=_[_0x29d7('0x2f')](_0x50a000['query']);_0x398ffb[_0x29d7('0x30')]=_['intersection'](_0x398ffb[_0x29d7('0x2e')],_0x398ffb[_0x29d7('0x31')]);_0x101c05[_0x29d7('0x32')]=_[_0x29d7('0x33')](_0x398ffb[_0x29d7('0x2e')],qs[_0x29d7('0x34')](_0x50a000[_0x29d7('0x31')][_0x29d7('0x34')]));_0x101c05[_0x29d7('0x32')]=_0x101c05[_0x29d7('0x32')][_0x29d7('0x35')]?_0x101c05[_0x29d7('0x32')]:_0x398ffb['model'];if(_0x50a000[_0x29d7('0x31')][_0x29d7('0x3e')]){_0x101c05['include']=[{'all':!![]}];}_0x101c05=_['merge']({},_0x101c05,_0x50a000[_0x29d7('0x43')]);return db[_0x29d7('0x29')][_0x29d7('0x44')](_0x101c05)[_0x29d7('0x20')](handleEntityNotFound(_0x5c3135,null))['then'](respondWithResult(_0x5c3135,null))[_0x29d7('0x41')](handleError(_0x5c3135,null));};exports[_0x29d7('0x45')]=function(_0x264769,_0x2826c4){return db[_0x29d7('0x29')][_0x29d7('0x45')](_0x264769[_0x29d7('0x46')],{})[_0x29d7('0x20')](respondWithResult(_0x2826c4,0xc9))[_0x29d7('0x41')](handleError(_0x2826c4,null));};exports['update']=function(_0x28ba18,_0x1d16dc){if(_0x28ba18[_0x29d7('0x46')]['id']){delete _0x28ba18[_0x29d7('0x46')]['id'];}return db[_0x29d7('0x29')][_0x29d7('0x44')]({'where':{'id':_0x28ba18[_0x29d7('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d16dc,null))[_0x29d7('0x20')](saveUpdates(_0x28ba18['body'],null))[_0x29d7('0x20')](respondWithResult(_0x1d16dc,null))[_0x29d7('0x41')](handleError(_0x1d16dc,null));};exports['destroy']=function(_0x4024bb,_0x57c967){return db['VoiceAgentReport'][_0x29d7('0x44')]({'where':{'id':_0x4024bb['params']['id']}})['then'](handleEntityNotFound(_0x57c967,null))['then'](removeEntity(_0x57c967,null))[_0x29d7('0x41')](handleError(_0x57c967,null));};exports[_0x29d7('0x47')]=function(_0x10cb71,_0x38699b){return db[_0x29d7('0x29')][_0x29d7('0x47')]()[_0x29d7('0x20')](respondWithResult(_0x38699b,null))['catch'](handleError(_0x38699b,null));}; \ No newline at end of file +var _0x5426=['limit','set','Content-Range','apply','then','destroy','error','stack','name','send','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','keys','filters','includeAll','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x43090c,_0x3c9956){var _0x4f1b4d=function(_0x2f0d1d){while(--_0x2f0d1d){_0x43090c['push'](_0x43090c['shift']());}};_0x4f1b4d(++_0x3c9956);}(_0x5426,0x102));var _0x6542=function(_0x57133f,_0x241a29){_0x57133f=_0x57133f-0x0;var _0x310cf7=_0x5426[_0x57133f];return _0x310cf7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6542('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6542('0x1'));var rp=require(_0x6542('0x2'));var moment=require('moment');var BPromise=require(_0x6542('0x3'));var Mustache=require(_0x6542('0x4'));var util=require(_0x6542('0x5'));var path=require(_0x6542('0x6'));var sox=require('sox');var csv=require(_0x6542('0x7'));var ejs=require(_0x6542('0x8'));var fs=require('fs');var _=require(_0x6542('0x9'));var squel=require(_0x6542('0xa'));var crypto=require(_0x6542('0xb'));var jsforce=require(_0x6542('0xc'));var deskjs=require(_0x6542('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6542('0xe'));var Papa=require(_0x6542('0xf'));var Redis=require(_0x6542('0x10'));var authService=require(_0x6542('0x11'));var qs=require(_0x6542('0x12'));var as=require(_0x6542('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6542('0x14'))('api');var utils=require(_0x6542('0x15'));var config=require(_0x6542('0x16'));var db=require(_0x6542('0x17'))['db'];function respondWithStatusCode(_0x474b37,_0x44c6a3){_0x44c6a3=_0x44c6a3||0xcc;return function(_0x1538c3){if(_0x1538c3){return _0x474b37[_0x6542('0x18')](_0x44c6a3);}return _0x474b37[_0x6542('0x19')](_0x44c6a3)[_0x6542('0x1a')]();};}function respondWithResult(_0x280111,_0x160cd2){_0x160cd2=_0x160cd2||0xc8;return function(_0x4b795c){if(_0x4b795c){return _0x280111['status'](_0x160cd2)[_0x6542('0x1b')](_0x4b795c);}};}function respondWithFilteredResult(_0x1a4e85,_0x3bcb88){return function(_0x420222){if(_0x420222){var _0x40e3e8=_0x420222[_0x6542('0x1c')],_0x45952d=_0x3bcb88['offset'],_0x21ad82=_0x3bcb88[_0x6542('0x1d')]+_0x3bcb88[_0x6542('0x1e')],_0x45d137;if(_0x21ad82>=_0x40e3e8){_0x21ad82=_0x40e3e8;_0x45d137=0xc8;}else{_0x45d137=0xce;}_0x1a4e85[_0x6542('0x19')](_0x45d137);return _0x1a4e85[_0x6542('0x1f')](_0x6542('0x20'),_0x45952d+'-'+_0x21ad82+'/'+_0x40e3e8)[_0x6542('0x1b')](_0x420222);}return null;};}function patchUpdates(_0x5c7843){return function(_0x4feab0){try{jsonpatch[_0x6542('0x21')](_0x4feab0,_0x5c7843,!![]);}catch(_0x1ad2c3){return BPromise['reject'](_0x1ad2c3);}return _0x4feab0['save']();};}function saveUpdates(_0x49c03d,_0x564bde){return function(_0x3a15b){if(_0x3a15b){return _0x3a15b['update'](_0x49c03d)[_0x6542('0x22')](function(_0xae2287){return _0xae2287;});}return null;};}function removeEntity(_0x527dec,_0x3aa9ec){return function(_0x248c9d){if(_0x248c9d){return _0x248c9d[_0x6542('0x23')]()[_0x6542('0x22')](function(){_0x527dec[_0x6542('0x19')](0xcc)[_0x6542('0x1a')]();});}};}function handleEntityNotFound(_0x5b445d,_0x48ed3e){return function(_0x4d1095){if(!_0x4d1095){_0x5b445d['sendStatus'](0x194);}return _0x4d1095;};}function handleError(_0x1acb4f,_0x4a705d){_0x4a705d=_0x4a705d||0x1f4;return function(_0xb7d39f){logger[_0x6542('0x24')](_0xb7d39f[_0x6542('0x25')]);if(_0xb7d39f[_0x6542('0x26')]){delete _0xb7d39f[_0x6542('0x26')];}_0x1acb4f[_0x6542('0x19')](_0x4a705d)[_0x6542('0x27')](_0xb7d39f);};}exports['index']=function(_0x371ac4,_0x3b44fa){var _0x5ee6fe={},_0x215a89={},_0x494ab3={'count':0x0,'rows':[]};var _0x1d4738=_[_0x6542('0x28')](db[_0x6542('0x29')][_0x6542('0x2a')],function(_0x44777c){return{'name':_0x44777c[_0x6542('0x2b')],'type':_0x44777c[_0x6542('0x2c')][_0x6542('0x2d')]};});_0x215a89[_0x6542('0x2e')]=_[_0x6542('0x28')](_0x1d4738,'name');_0x215a89[_0x6542('0x2f')]=_['keys'](_0x371ac4[_0x6542('0x2f')]);_0x215a89['filters']=_[_0x6542('0x30')](_0x215a89[_0x6542('0x2e')],_0x215a89[_0x6542('0x2f')]);_0x5ee6fe[_0x6542('0x31')]=_[_0x6542('0x30')](_0x215a89[_0x6542('0x2e')],qs[_0x6542('0x32')](_0x371ac4[_0x6542('0x2f')][_0x6542('0x32')]));_0x5ee6fe[_0x6542('0x31')]=_0x5ee6fe[_0x6542('0x31')][_0x6542('0x33')]?_0x5ee6fe[_0x6542('0x31')]:_0x215a89[_0x6542('0x2e')];if(!_0x371ac4[_0x6542('0x2f')]['hasOwnProperty'](_0x6542('0x34'))){_0x5ee6fe[_0x6542('0x1e')]=qs['limit'](_0x371ac4['query'][_0x6542('0x1e')]);_0x5ee6fe[_0x6542('0x1d')]=qs[_0x6542('0x1d')](_0x371ac4[_0x6542('0x2f')][_0x6542('0x1d')]);}_0x5ee6fe[_0x6542('0x35')]=qs[_0x6542('0x36')](_0x371ac4[_0x6542('0x2f')][_0x6542('0x36')]);_0x5ee6fe[_0x6542('0x37')]=qs['filters'](_['pick'](_0x371ac4['query'],_0x215a89['filters']),_0x1d4738);if(_0x371ac4['query'][_0x6542('0x38')]){_0x5ee6fe['where']=_['merge'](_0x5ee6fe[_0x6542('0x37')],{'$or':_[_0x6542('0x28')](_0x1d4738,function(_0x5ee731){if(_0x5ee731['type']!=='VIRTUAL'){var _0x4d406d={};_0x4d406d[_0x5ee731['name']]={'$like':'%'+_0x371ac4[_0x6542('0x2f')]['filter']+'%'};return _0x4d406d;}})});}_0x5ee6fe=_[_0x6542('0x39')]({},_0x5ee6fe,_0x371ac4[_0x6542('0x3a')]);var _0x45cb78={'where':_0x5ee6fe[_0x6542('0x37')]};return db[_0x6542('0x29')]['count'](_0x45cb78)[_0x6542('0x22')](function(_0x15b67a){_0x494ab3[_0x6542('0x1c')]=_0x15b67a;if(_0x371ac4[_0x6542('0x2f')]['includeAll']){_0x5ee6fe[_0x6542('0x3b')]=[{'all':!![]}];}return db[_0x6542('0x29')][_0x6542('0x3c')](_0x5ee6fe);})[_0x6542('0x22')](function(_0x208530){_0x494ab3[_0x6542('0x3d')]=_0x208530;return _0x494ab3;})['then'](respondWithFilteredResult(_0x3b44fa,_0x5ee6fe))[_0x6542('0x3e')](handleError(_0x3b44fa,null));};exports[_0x6542('0x3f')]=function(_0x4dab8a,_0x38e094){var _0x4429de={'raw':![],'where':{'id':_0x4dab8a['params']['id']}},_0x52b1d2={};_0x52b1d2[_0x6542('0x2e')]=_['keys'](db[_0x6542('0x29')][_0x6542('0x2a')]);_0x52b1d2[_0x6542('0x2f')]=_[_0x6542('0x40')](_0x4dab8a['query']);_0x52b1d2[_0x6542('0x41')]=_[_0x6542('0x30')](_0x52b1d2['model'],_0x52b1d2[_0x6542('0x2f')]);_0x4429de[_0x6542('0x31')]=_[_0x6542('0x30')](_0x52b1d2[_0x6542('0x2e')],qs[_0x6542('0x32')](_0x4dab8a[_0x6542('0x2f')][_0x6542('0x32')]));_0x4429de[_0x6542('0x31')]=_0x4429de[_0x6542('0x31')][_0x6542('0x33')]?_0x4429de[_0x6542('0x31')]:_0x52b1d2[_0x6542('0x2e')];if(_0x4dab8a['query'][_0x6542('0x42')]){_0x4429de[_0x6542('0x3b')]=[{'all':!![]}];}_0x4429de=_[_0x6542('0x39')]({},_0x4429de,_0x4dab8a[_0x6542('0x3a')]);return db[_0x6542('0x29')][_0x6542('0x43')](_0x4429de)[_0x6542('0x22')](handleEntityNotFound(_0x38e094,null))[_0x6542('0x22')](respondWithResult(_0x38e094,null))[_0x6542('0x3e')](handleError(_0x38e094,null));};exports[_0x6542('0x44')]=function(_0x35aee2,_0x14571d){return db['VoiceAgentReport']['create'](_0x35aee2['body'],{})[_0x6542('0x22')](respondWithResult(_0x14571d,0xc9))[_0x6542('0x3e')](handleError(_0x14571d,null));};exports['update']=function(_0x1a5c4f,_0x1195ea){if(_0x1a5c4f['body']['id']){delete _0x1a5c4f[_0x6542('0x45')]['id'];}return db[_0x6542('0x29')][_0x6542('0x43')]({'where':{'id':_0x1a5c4f[_0x6542('0x46')]['id']}})[_0x6542('0x22')](handleEntityNotFound(_0x1195ea,null))[_0x6542('0x22')](saveUpdates(_0x1a5c4f[_0x6542('0x45')],null))[_0x6542('0x22')](respondWithResult(_0x1195ea,null))['catch'](handleError(_0x1195ea,null));};exports[_0x6542('0x23')]=function(_0x14f2dc,_0x44aae7){return db[_0x6542('0x29')][_0x6542('0x43')]({'where':{'id':_0x14f2dc[_0x6542('0x46')]['id']}})['then'](handleEntityNotFound(_0x44aae7,null))[_0x6542('0x22')](removeEntity(_0x44aae7,null))[_0x6542('0x3e')](handleError(_0x44aae7,null));};exports['describe']=function(_0x3b7970,_0x34fbc5){return db['VoiceAgentReport'][_0x6542('0x47')]()[_0x6542('0x22')](respondWithResult(_0x34fbc5,null))[_0x6542('0x3e')](handleError(_0x34fbc5,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 2cb459f..3b948e9 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 _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x34e8,0x12c));var _0x834e=function(_0x21db1c,_0x23fb08){_0x21db1c=_0x21db1c-0x0;var _0x153933=_0x34e8[_0x21db1c];return _0x153933;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'fields':[_0x834e('0xd'),_0x834e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbb2f2d,_0x5753f8){var _0x44ccdf=function(_0x2f657f){while(--_0x2f657f){_0xbb2f2d['push'](_0xbb2f2d['shift']());}};_0x44ccdf(++_0x5753f8);}(_0xedd9,0xfc));var _0x9edd=function(_0x3c153c,_0x289c25){_0x3c153c=_0x3c153c-0x0;var _0x2ab7b5=_0xedd9[_0x3c153c];return _0x2ab7b5;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x9edd('0xb'),_0x9edd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 273e33e..0e18d14 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 _0x621e=['stringify','code','error','message','VoiceAgentReport,\x20%s,\x20%s','result','CreateVoiceAgentReport','create','body','options','raw','then','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug'];(function(_0x392dc2,_0x47c3f3){var _0x14150f=function(_0x9f305a){while(--_0x9f305a){_0x392dc2['push'](_0x392dc2['shift']());}};_0x14150f(++_0x47c3f3);}(_0x621e,0xde));var _0xe621=function(_0x1cc02d,_0x3de19e){_0x1cc02d=_0x1cc02d-0x0;var _0x145423=_0x621e[_0x1cc02d];return _0x145423;};'use strict';var _=require(_0xe621('0x0'));var util=require(_0xe621('0x1'));var moment=require(_0xe621('0x2'));var BPromise=require(_0xe621('0x3'));var rs=require(_0xe621('0x4'));var fs=require('fs');var Redis=require(_0xe621('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe621('0x6'));var logger=require(_0xe621('0x7'))(_0xe621('0x8'));var config=require(_0xe621('0x9'));var jayson=require(_0xe621('0xa'));var client=jayson['client'][_0xe621('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49b86c,_0x2e4529,_0x330c8c){return new BPromise(function(_0x51d881,_0x43b666){return client[_0xe621('0xc')](_0x49b86c,_0x330c8c)['then'](function(_0x2eaa69){logger[_0xe621('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x2e4529,_0xe621('0xe'));logger[_0xe621('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x2e4529,_0xe621('0xe'),JSON[_0xe621('0x10')](_0x2eaa69));if(_0x2eaa69['error']){if(_0x2eaa69['error'][_0xe621('0x11')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x2e4529,_0x2eaa69[_0xe621('0x12')][_0xe621('0x13')]);return _0x43b666(_0x2eaa69[_0xe621('0x12')][_0xe621('0x13')]);}logger[_0xe621('0x12')](_0xe621('0x14'),_0x2e4529,_0x2eaa69[_0xe621('0x12')]['message']);return _0x51d881(_0x2eaa69[_0xe621('0x12')][_0xe621('0x13')]);}else{logger['info'](_0xe621('0x14'),_0x2e4529,_0xe621('0xe'));_0x51d881(_0x2eaa69[_0xe621('0x15')][_0xe621('0x13')]);}})['catch'](function(_0x61e850){logger[_0xe621('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x2e4529,_0x61e850);_0x43b666(_0x61e850);});});}exports[_0xe621('0x16')]=function(_0x4d630b){var _0x333089=this;return new Promise(function(_0xdbfa7b,_0x43df36){return db['VoiceAgentReport'][_0xe621('0x17')](_0x4d630b[_0xe621('0x18')],{'raw':_0x4d630b[_0xe621('0x19')]?_0x4d630b[_0xe621('0x19')][_0xe621('0x1a')]===undefined?!![]:![]:!![]})[_0xe621('0x1b')](function(_0x4de99f){logger[_0xe621('0xd')](_0xe621('0x16'),_0x4d630b);logger[_0xe621('0xf')]('CreateVoiceAgentReport',_0x4d630b,JSON[_0xe621('0x10')](_0x4de99f));_0xdbfa7b(_0x4de99f);})[_0xe621('0x1c')](function(_0x379efd){logger[_0xe621('0x12')](_0xe621('0x16'),_0x379efd[_0xe621('0x13')],_0x4d630b);_0x43df36(_0x333089['error'](0x1f4,_0x379efd[_0xe621('0x13')]));});});};exports[_0xe621('0x1d')]=function(_0x2b566b){var _0x70aba5=this;return new Promise(function(_0x40c4ba,_0x32aef2){return db[_0xe621('0x1e')][_0xe621('0x1f')](_0x2b566b[_0xe621('0x18')],{'raw':_0x2b566b[_0xe621('0x19')]?_0x2b566b[_0xe621('0x19')][_0xe621('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b566b[_0xe621('0x19')]?_0x2b566b[_0xe621('0x19')][_0xe621('0x20')]||null:null,'attributes':_0x2b566b[_0xe621('0x19')]?_0x2b566b[_0xe621('0x19')][_0xe621('0x21')]||null:null,'limit':_0x2b566b[_0xe621('0x19')]?_0x2b566b[_0xe621('0x19')]['limit']||null:null})['then'](function(_0x137ead){logger[_0xe621('0xd')](_0xe621('0x1d'),_0x2b566b);logger['debug'](_0xe621('0x1d'),_0x2b566b,JSON[_0xe621('0x10')](_0x137ead));_0x40c4ba(_0x137ead);})[_0xe621('0x1c')](function(_0x34eb97){logger[_0xe621('0x12')](_0xe621('0x1d'),_0x34eb97[_0xe621('0x13')],_0x2b566b);_0x32aef2(_0x70aba5[_0xe621('0x12')](0x1f4,_0x34eb97[_0xe621('0x13')]));});});}; \ No newline at end of file +var _0xb1e5=['UpdateVoiceAgentReport','VoiceAgentReport','where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateVoiceAgentReport'];(function(_0x19f2d5,_0x5893f2){var _0x5e8c46=function(_0x2f07ed){while(--_0x2f07ed){_0x19f2d5['push'](_0x19f2d5['shift']());}};_0x5e8c46(++_0x5893f2);}(_0xb1e5,0xcb));var _0x5b1e=function(_0x342d7d,_0x1e758d){_0x342d7d=_0x342d7d-0x0;var _0x2e59b0=_0xb1e5[_0x342d7d];return _0x2e59b0;};'use strict';var _=require(_0x5b1e('0x0'));var util=require(_0x5b1e('0x1'));var moment=require('moment');var BPromise=require(_0x5b1e('0x2'));var rs=require(_0x5b1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b1e('0x5'))(_0x5b1e('0x6'));var config=require(_0x5b1e('0x7'));var jayson=require(_0x5b1e('0x8'));var client=jayson['client'][_0x5b1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b7661,_0x19fb90,_0x4316a0){return new BPromise(function(_0x3152a9,_0x15edc8){return client[_0x5b1e('0xa')](_0x3b7661,_0x4316a0)[_0x5b1e('0xb')](function(_0x16efd0){logger[_0x5b1e('0xc')](_0x5b1e('0xd'),_0x19fb90,_0x5b1e('0xe'));logger[_0x5b1e('0xf')](_0x5b1e('0x10'),_0x19fb90,_0x5b1e('0xe'),JSON[_0x5b1e('0x11')](_0x16efd0));if(_0x16efd0[_0x5b1e('0x12')]){if(_0x16efd0['error'][_0x5b1e('0x13')]===0x1f4){logger[_0x5b1e('0x12')](_0x5b1e('0xd'),_0x19fb90,_0x16efd0[_0x5b1e('0x12')][_0x5b1e('0x14')]);return _0x15edc8(_0x16efd0[_0x5b1e('0x12')][_0x5b1e('0x14')]);}logger[_0x5b1e('0x12')](_0x5b1e('0xd'),_0x19fb90,_0x16efd0[_0x5b1e('0x12')][_0x5b1e('0x14')]);return _0x3152a9(_0x16efd0[_0x5b1e('0x12')]['message']);}else{logger[_0x5b1e('0xc')](_0x5b1e('0xd'),_0x19fb90,_0x5b1e('0xe'));_0x3152a9(_0x16efd0[_0x5b1e('0x15')][_0x5b1e('0x14')]);}})[_0x5b1e('0x16')](function(_0x17cb68){logger[_0x5b1e('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x19fb90,_0x17cb68);_0x15edc8(_0x17cb68);});});}exports['CreateVoiceAgentReport']=function(_0x1cf438){var _0x13793b=this;return new Promise(function(_0x48e6e1,_0x4edeb5){return db['VoiceAgentReport'][_0x5b1e('0x17')](_0x1cf438[_0x5b1e('0x18')],{'raw':_0x1cf438[_0x5b1e('0x19')]?_0x1cf438[_0x5b1e('0x19')][_0x5b1e('0x1a')]===undefined?!![]:![]:!![]})[_0x5b1e('0xb')](function(_0x128e65){logger[_0x5b1e('0xc')]('CreateVoiceAgentReport',_0x1cf438);logger[_0x5b1e('0xf')](_0x5b1e('0x1b'),_0x1cf438,JSON['stringify'](_0x128e65));_0x48e6e1(_0x128e65);})['catch'](function(_0x1696bb){logger[_0x5b1e('0x12')](_0x5b1e('0x1b'),_0x1696bb[_0x5b1e('0x14')],_0x1cf438);_0x4edeb5(_0x13793b[_0x5b1e('0x12')](0x1f4,_0x1696bb[_0x5b1e('0x14')]));});});};exports[_0x5b1e('0x1c')]=function(_0x18cf9a){var _0x1ba289=this;return new Promise(function(_0x2d873d,_0x4d33cb){return db[_0x5b1e('0x1d')]['update'](_0x18cf9a[_0x5b1e('0x18')],{'raw':_0x18cf9a[_0x5b1e('0x19')]?_0x18cf9a[_0x5b1e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18cf9a['options']?_0x18cf9a['options'][_0x5b1e('0x1e')]||null:null,'attributes':_0x18cf9a[_0x5b1e('0x19')]?_0x18cf9a['options'][_0x5b1e('0x1f')]||null:null,'limit':_0x18cf9a[_0x5b1e('0x19')]?_0x18cf9a[_0x5b1e('0x19')][_0x5b1e('0x20')]||null:null})['then'](function(_0x35ce41){logger[_0x5b1e('0xc')]('UpdateVoiceAgentReport',_0x18cf9a);logger[_0x5b1e('0xf')](_0x5b1e('0x1c'),_0x18cf9a,JSON[_0x5b1e('0x11')](_0x35ce41));_0x2d873d(_0x35ce41);})[_0x5b1e('0x16')](function(_0x945c0b){logger[_0x5b1e('0x12')](_0x5b1e('0x1c'),_0x945c0b[_0x5b1e('0x14')],_0x18cf9a);_0x4d33cb(_0x1ba289[_0x5b1e('0x12')](0x1f4,_0x945c0b[_0x5b1e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 320d94d..fc76860 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 _0x3a21=['Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a21,0x128));var _0x13a2=function(_0x39ba00,_0x369bfb){_0x39ba00=_0x39ba00-0x0;var _0x50488=_0x3a21[_0x39ba00];return _0x50488;};'use strict';var multer=require(_0x13a2('0x0'));var util=require(_0x13a2('0x1'));var path=require(_0x13a2('0x2'));var timeout=require(_0x13a2('0x3'));var express=require('express');var router=express[_0x13a2('0x4')]();var auth=require(_0x13a2('0x5'));var interaction=require(_0x13a2('0x6'));var config=require('../../config/environment');var controller=require(_0x13a2('0x7'));router[_0x13a2('0x8')]('/',auth[_0x13a2('0x9')](),controller['index']);router[_0x13a2('0x8')](_0x13a2('0xa'),auth['isAuthenticated'](),controller[_0x13a2('0xb')]);router[_0x13a2('0x8')](_0x13a2('0xc'),auth['isAuthenticated'](),controller[_0x13a2('0xd')]);router['post']('/',auth[_0x13a2('0x9')](),controller[_0x13a2('0xe')]);router[_0x13a2('0xf')]('/:id',auth[_0x13a2('0x9')](),controller[_0x13a2('0x10')]);router[_0x13a2('0x11')](_0x13a2('0xc'),auth[_0x13a2('0x9')](),controller[_0x13a2('0x12')]);module[_0x13a2('0x13')]=router; \ No newline at end of file +var _0x85fb=['../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path','express'];(function(_0x334d51,_0x20000f){var _0x33adf3=function(_0x51290a){while(--_0x51290a){_0x334d51['push'](_0x334d51['shift']());}};_0x33adf3(++_0x20000f);}(_0x85fb,0x11e));var _0xb85f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x85fb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb85f('0x0'));var util=require('util');var path=require(_0xb85f('0x1'));var timeout=require('connect-timeout');var express=require(_0xb85f('0x2'));var router=express['Router']();var auth=require(_0xb85f('0x3'));var interaction=require(_0xb85f('0x4'));var config=require('../../config/environment');var controller=require(_0xb85f('0x5'));router[_0xb85f('0x6')]('/',auth[_0xb85f('0x7')](),controller[_0xb85f('0x8')]);router[_0xb85f('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb85f('0x6')](_0xb85f('0x9'),auth['isAuthenticated'](),controller[_0xb85f('0xa')]);router[_0xb85f('0xb')]('/',auth[_0xb85f('0x7')](),controller[_0xb85f('0xc')]);router[_0xb85f('0xd')](_0xb85f('0x9'),auth[_0xb85f('0x7')](),controller[_0xb85f('0xe')]);router['delete'](_0xb85f('0x9'),auth['isAuthenticated'](),controller[_0xb85f('0xf')]);module[_0xb85f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6ebaf98..b759a57 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(_0x5b41b0,_0x291edf){var _0x2dc004=function(_0x43ab9b){while(--_0x43ab9b){_0x5b41b0['push'](_0x5b41b0['shift']());}};_0x2dc004(++_0x291edf);}(_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(_0x208ffe,_0x5b5236){var _0x35bb40=function(_0x572869){while(--_0x572869){_0x208ffe['push'](_0x208ffe['shift']());}};_0x35bb40(++_0x5b5236);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 4ae1a1a..5e809f3 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 _0xcebb=['intersection','attributes','fields','length','nolimit','limit','order','sort','where','merge','filter','options','include','fullname','alias','User','findAll','rows','catch','show','params','keys','includeAll','find','create','describe','body','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x309251,_0x59a3d3){var _0x3c6e84=function(_0x2c535){while(--_0x2c535){_0x309251['push'](_0x309251['shift']());}};_0x3c6e84(++_0x59a3d3);}(_0xcebb,0xfa));var _0xbceb=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xcebb[_0x2e4e19];return _0x9ba20b;};'use strict';var pdf=require(_0xbceb('0x0'));var emlformat=require(_0xbceb('0x1'));var rimraf=require(_0xbceb('0x2'));var zipdir=require(_0xbceb('0x3'));var jsonpatch=require(_0xbceb('0x4'));var rp=require(_0xbceb('0x5'));var moment=require('moment');var BPromise=require(_0xbceb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbceb('0x7'));var sox=require(_0xbceb('0x8'));var csv=require(_0xbceb('0x9'));var ejs=require(_0xbceb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbceb('0xb'));var jsforce=require(_0xbceb('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbceb('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbceb('0xe'));var qs=require(_0xbceb('0xf'));var as=require(_0xbceb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbceb('0x11'))(_0xbceb('0x12'));var utils=require('../../config/utils');var config=require(_0xbceb('0x13'));var db=require(_0xbceb('0x14'))['db'];function respondWithStatusCode(_0x4a667b,_0x368be7){_0x368be7=_0x368be7||0xcc;return function(_0x2b3aa9){if(_0x2b3aa9){return _0x4a667b['sendStatus'](_0x368be7);}return _0x4a667b[_0xbceb('0x15')](_0x368be7)[_0xbceb('0x16')]();};}function respondWithResult(_0x18ec03,_0x16268a){_0x16268a=_0x16268a||0xc8;return function(_0x35620d){if(_0x35620d){return _0x18ec03['status'](_0x16268a)['json'](_0x35620d);}};}function respondWithFilteredResult(_0x406491,_0x1f990b){return function(_0x4b3272){if(_0x4b3272){var _0x401244=_0x4b3272[_0xbceb('0x17')],_0x26b198=_0x1f990b[_0xbceb('0x18')],_0x2a602a=_0x1f990b[_0xbceb('0x18')]+_0x1f990b['limit'],_0x1ca2fb;if(_0x2a602a>=_0x401244){_0x2a602a=_0x401244;_0x1ca2fb=0xc8;}else{_0x1ca2fb=0xce;}_0x406491[_0xbceb('0x15')](_0x1ca2fb);return _0x406491[_0xbceb('0x19')](_0xbceb('0x1a'),_0x26b198+'-'+_0x2a602a+'/'+_0x401244)['json'](_0x4b3272);}return null;};}function patchUpdates(_0x304a1c){return function(_0x2e0e87){try{jsonpatch[_0xbceb('0x1b')](_0x2e0e87,_0x304a1c,!![]);}catch(_0x3d384f){return BPromise[_0xbceb('0x1c')](_0x3d384f);}return _0x2e0e87['save']();};}function saveUpdates(_0xfaccbf,_0x59f026){return function(_0x5c4b4c){if(_0x5c4b4c){return _0x5c4b4c[_0xbceb('0x1d')](_0xfaccbf)['then'](function(_0x5204ca){return _0x5204ca;});}return null;};}function removeEntity(_0x131112,_0x2c0ef7){return function(_0x551a7a){if(_0x551a7a){return _0x551a7a[_0xbceb('0x1e')]()[_0xbceb('0x1f')](function(){_0x131112[_0xbceb('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4449b5,_0x35695f){return function(_0x325483){if(!_0x325483){_0x4449b5[_0xbceb('0x20')](0x194);}return _0x325483;};}function handleError(_0x1a5475,_0x34aeba){_0x34aeba=_0x34aeba||0x1f4;return function(_0x1eea6b){logger[_0xbceb('0x21')](_0x1eea6b[_0xbceb('0x22')]);if(_0x1eea6b[_0xbceb('0x23')]){delete _0x1eea6b['name'];}_0x1a5475['status'](_0x34aeba)[_0xbceb('0x24')](_0x1eea6b);};}exports[_0xbceb('0x25')]=function(_0x924d5c,_0x34d634){var _0x1dab5f={},_0x49abb7={},_0x173205={'count':0x0,'rows':[]};var _0x204d0e=_['map'](db[_0xbceb('0x26')][_0xbceb('0x27')],function(_0x36685b){return{'name':_0x36685b[_0xbceb('0x28')],'type':_0x36685b[_0xbceb('0x29')][_0xbceb('0x2a')]};});_0x49abb7[_0xbceb('0x2b')]=_['map'](_0x204d0e,_0xbceb('0x23'));_0x49abb7[_0xbceb('0x2c')]=_['keys'](_0x924d5c[_0xbceb('0x2c')]);_0x49abb7[_0xbceb('0x2d')]=_[_0xbceb('0x2e')](_0x49abb7[_0xbceb('0x2b')],_0x49abb7['query']);_0x1dab5f[_0xbceb('0x2f')]=_[_0xbceb('0x2e')](_0x49abb7[_0xbceb('0x2b')],qs[_0xbceb('0x30')](_0x924d5c[_0xbceb('0x2c')][_0xbceb('0x30')]));_0x1dab5f[_0xbceb('0x2f')]=_0x1dab5f[_0xbceb('0x2f')][_0xbceb('0x31')]?_0x1dab5f[_0xbceb('0x2f')]:_0x49abb7[_0xbceb('0x2b')];if(!_0x924d5c['query']['hasOwnProperty'](_0xbceb('0x32'))){_0x1dab5f[_0xbceb('0x33')]=qs[_0xbceb('0x33')](_0x924d5c[_0xbceb('0x2c')][_0xbceb('0x33')]);_0x1dab5f[_0xbceb('0x18')]=qs[_0xbceb('0x18')](_0x924d5c['query'][_0xbceb('0x18')]);}_0x1dab5f[_0xbceb('0x34')]=qs[_0xbceb('0x35')](_0x924d5c[_0xbceb('0x2c')][_0xbceb('0x35')]);_0x1dab5f['where']=qs[_0xbceb('0x2d')](_['pick'](_0x924d5c[_0xbceb('0x2c')],_0x49abb7['filters']),_0x204d0e);if(_0x924d5c[_0xbceb('0x2c')]['filter']){_0x1dab5f[_0xbceb('0x36')]=_[_0xbceb('0x37')](_0x1dab5f[_0xbceb('0x36')],{'$or':_['map'](_0x204d0e,function(_0x351a68){if(_0x351a68['type']!=='VIRTUAL'){var _0x4e865b={};_0x4e865b[_0x351a68['name']]={'$like':'%'+_0x924d5c[_0xbceb('0x2c')][_0xbceb('0x38')]+'%'};return _0x4e865b;}})});}_0x1dab5f=_[_0xbceb('0x37')]({},_0x1dab5f,_0x924d5c[_0xbceb('0x39')]);var _0x56b7fe={'where':_0x1dab5f[_0xbceb('0x36')]};return db['VoiceCallReport'][_0xbceb('0x17')](_0x56b7fe)[_0xbceb('0x1f')](function(_0x3092e7){_0x173205[_0xbceb('0x17')]=_0x3092e7;if(_0x924d5c[_0xbceb('0x2c')]['includeAll']){_0x1dab5f[_0xbceb('0x3a')]=[{'attributes':['id',_0xbceb('0x23'),_0xbceb('0x3b'),_0xbceb('0x3c')],'model':db[_0xbceb('0x3d')],'as':_0xbceb('0x3d')}];}return db[_0xbceb('0x26')][_0xbceb('0x3e')](_0x1dab5f);})[_0xbceb('0x1f')](function(_0xc51eef){_0x173205[_0xbceb('0x3f')]=_0xc51eef;return _0x173205;})[_0xbceb('0x1f')](respondWithFilteredResult(_0x34d634,_0x1dab5f))[_0xbceb('0x40')](handleError(_0x34d634,null));};exports[_0xbceb('0x41')]=function(_0x49e8ec,_0x168e53){var _0x2d4767={'raw':!![],'where':{'id':_0x49e8ec[_0xbceb('0x42')]['id']}},_0x166bd0={};_0x166bd0['model']=_[_0xbceb('0x43')](db[_0xbceb('0x26')]['rawAttributes']);_0x166bd0[_0xbceb('0x2c')]=_[_0xbceb('0x43')](_0x49e8ec[_0xbceb('0x2c')]);_0x166bd0['filters']=_['intersection'](_0x166bd0[_0xbceb('0x2b')],_0x166bd0['query']);_0x2d4767[_0xbceb('0x2f')]=_[_0xbceb('0x2e')](_0x166bd0[_0xbceb('0x2b')],qs['fields'](_0x49e8ec[_0xbceb('0x2c')][_0xbceb('0x30')]));_0x2d4767[_0xbceb('0x2f')]=_0x2d4767[_0xbceb('0x2f')][_0xbceb('0x31')]?_0x2d4767[_0xbceb('0x2f')]:_0x166bd0['model'];if(_0x49e8ec['query'][_0xbceb('0x44')]){_0x2d4767['include']=[{'all':!![]}];}_0x2d4767=_[_0xbceb('0x37')]({},_0x2d4767,_0x49e8ec['options']);return db[_0xbceb('0x26')][_0xbceb('0x45')](_0x2d4767)[_0xbceb('0x1f')](handleEntityNotFound(_0x168e53,null))[_0xbceb('0x1f')](respondWithResult(_0x168e53,null))[_0xbceb('0x40')](handleError(_0x168e53,null));};exports[_0xbceb('0x46')]=function(_0x2051c4,_0xcfba8a){return db['VoiceCallReport'][_0xbceb('0x46')](_0x2051c4['body'],{})[_0xbceb('0x1f')](respondWithResult(_0xcfba8a,0xc9))[_0xbceb('0x40')](handleError(_0xcfba8a,null));};exports[_0xbceb('0x1e')]=function(_0x3b8985,_0xd0b175){return db[_0xbceb('0x26')][_0xbceb('0x45')]({'where':{'id':_0x3b8985[_0xbceb('0x42')]['id']}})[_0xbceb('0x1f')](handleEntityNotFound(_0xd0b175,null))[_0xbceb('0x1f')](removeEntity(_0xd0b175,null))[_0xbceb('0x40')](handleError(_0xd0b175,null));};exports[_0xbceb('0x47')]=function(_0x12ad28,_0x245f62){return db[_0xbceb('0x26')][_0xbceb('0x47')]()[_0xbceb('0x1f')](respondWithResult(_0x245f62,null))['catch'](handleError(_0x245f62,null));};exports[_0xbceb('0x1d')]=function(_0x513898,_0x3f3940){if(_0x513898[_0xbceb('0x48')][_0xbceb('0x49')]){delete _0x513898[_0xbceb('0x48')][_0xbceb('0x49')];}return db[_0xbceb('0x26')]['find']({'where':{'uniqueid':_0x513898[_0xbceb('0x42')]['id'],'UserId':{'$or':[null,_0x513898['user']['id']]}}})[_0xbceb('0x1f')](handleEntityNotFound(_0x3f3940,null))[_0xbceb('0x1f')](saveUpdates(_0x513898[_0xbceb('0x48')],null))['then'](respondWithResult(_0x3f3940,null))[_0xbceb('0x40')](handleError(_0x3f3940,null));}; \ No newline at end of file +var _0xc1d3=['rows','catch','show','params','keys','include','options','find','create','body','destroy','describe','update','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','apply','reject','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','merge','VoiceCallReport','fullname','User'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0xc1d3,0x143));var _0x3c1d=function(_0x24c8bf,_0xb71663){_0x24c8bf=_0x24c8bf-0x0;var _0x451e91=_0xc1d3[_0x24c8bf];return _0x451e91;};'use strict';var pdf=require(_0x3c1d('0x0'));var emlformat=require(_0x3c1d('0x1'));var rimraf=require(_0x3c1d('0x2'));var zipdir=require(_0x3c1d('0x3'));var jsonpatch=require(_0x3c1d('0x4'));var rp=require(_0x3c1d('0x5'));var moment=require(_0x3c1d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3c1d('0x7'));var util=require(_0x3c1d('0x8'));var path=require(_0x3c1d('0x9'));var sox=require(_0x3c1d('0xa'));var csv=require(_0x3c1d('0xb'));var ejs=require(_0x3c1d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c1d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c1d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3c1d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c1d('0x10'));var as=require(_0x3c1d('0x11'));var hardwareService=require(_0x3c1d('0x12'));var logger=require('../../config/logger')(_0x3c1d('0x13'));var utils=require(_0x3c1d('0x14'));var config=require(_0x3c1d('0x15'));var db=require(_0x3c1d('0x16'))['db'];function respondWithStatusCode(_0x2d965d,_0x5086bf){_0x5086bf=_0x5086bf||0xcc;return function(_0x321a1d){if(_0x321a1d){return _0x2d965d[_0x3c1d('0x17')](_0x5086bf);}return _0x2d965d[_0x3c1d('0x18')](_0x5086bf)[_0x3c1d('0x19')]();};}function respondWithResult(_0x26a0a9,_0x2ef11a){_0x2ef11a=_0x2ef11a||0xc8;return function(_0x33b1ff){if(_0x33b1ff){return _0x26a0a9[_0x3c1d('0x18')](_0x2ef11a)[_0x3c1d('0x1a')](_0x33b1ff);}};}function respondWithFilteredResult(_0x591e76,_0x5924db){return function(_0x2713b1){if(_0x2713b1){var _0x2dadd0=_0x2713b1[_0x3c1d('0x1b')],_0x18326a=_0x5924db['offset'],_0x56a5b9=_0x5924db['offset']+_0x5924db[_0x3c1d('0x1c')],_0x1e8a28;if(_0x56a5b9>=_0x2dadd0){_0x56a5b9=_0x2dadd0;_0x1e8a28=0xc8;}else{_0x1e8a28=0xce;}_0x591e76[_0x3c1d('0x18')](_0x1e8a28);return _0x591e76[_0x3c1d('0x1d')]('Content-Range',_0x18326a+'-'+_0x56a5b9+'/'+_0x2dadd0)[_0x3c1d('0x1a')](_0x2713b1);}return null;};}function patchUpdates(_0x553cbf){return function(_0x156095){try{jsonpatch[_0x3c1d('0x1e')](_0x156095,_0x553cbf,!![]);}catch(_0x30864d){return BPromise[_0x3c1d('0x1f')](_0x30864d);}return _0x156095['save']();};}function saveUpdates(_0x3ead9f,_0x235e97){return function(_0x71d1d6){if(_0x71d1d6){return _0x71d1d6['update'](_0x3ead9f)[_0x3c1d('0x20')](function(_0x5209ee){return _0x5209ee;});}return null;};}function removeEntity(_0x29ef1c,_0x118d49){return function(_0x5ef7b7){if(_0x5ef7b7){return _0x5ef7b7['destroy']()[_0x3c1d('0x20')](function(){_0x29ef1c[_0x3c1d('0x18')](0xcc)[_0x3c1d('0x19')]();});}};}function handleEntityNotFound(_0x41f1f0,_0x50112){return function(_0x7d24ae){if(!_0x7d24ae){_0x41f1f0['sendStatus'](0x194);}return _0x7d24ae;};}function handleError(_0x537e6b,_0x490993){_0x490993=_0x490993||0x1f4;return function(_0x167c5f){logger[_0x3c1d('0x21')](_0x167c5f[_0x3c1d('0x22')]);if(_0x167c5f['name']){delete _0x167c5f[_0x3c1d('0x23')];}_0x537e6b[_0x3c1d('0x18')](_0x490993)['send'](_0x167c5f);};}exports[_0x3c1d('0x24')]=function(_0x436cea,_0x6171dd){var _0x90b7e2={},_0x5752dc={},_0x2f0f78={'count':0x0,'rows':[]};var _0x3d3c40=_[_0x3c1d('0x25')](db['VoiceCallReport'][_0x3c1d('0x26')],function(_0xa76fee){return{'name':_0xa76fee[_0x3c1d('0x27')],'type':_0xa76fee[_0x3c1d('0x28')][_0x3c1d('0x29')]};});_0x5752dc[_0x3c1d('0x2a')]=_[_0x3c1d('0x25')](_0x3d3c40,'name');_0x5752dc[_0x3c1d('0x2b')]=_['keys'](_0x436cea[_0x3c1d('0x2b')]);_0x5752dc[_0x3c1d('0x2c')]=_[_0x3c1d('0x2d')](_0x5752dc[_0x3c1d('0x2a')],_0x5752dc['query']);_0x90b7e2[_0x3c1d('0x2e')]=_['intersection'](_0x5752dc[_0x3c1d('0x2a')],qs[_0x3c1d('0x2f')](_0x436cea[_0x3c1d('0x2b')][_0x3c1d('0x2f')]));_0x90b7e2['attributes']=_0x90b7e2['attributes'][_0x3c1d('0x30')]?_0x90b7e2['attributes']:_0x5752dc['model'];if(!_0x436cea[_0x3c1d('0x2b')][_0x3c1d('0x31')](_0x3c1d('0x32'))){_0x90b7e2[_0x3c1d('0x1c')]=qs[_0x3c1d('0x1c')](_0x436cea['query']['limit']);_0x90b7e2[_0x3c1d('0x33')]=qs['offset'](_0x436cea['query']['offset']);}_0x90b7e2[_0x3c1d('0x34')]=qs[_0x3c1d('0x35')](_0x436cea[_0x3c1d('0x2b')][_0x3c1d('0x35')]);_0x90b7e2[_0x3c1d('0x36')]=qs['filters'](_[_0x3c1d('0x37')](_0x436cea['query'],_0x5752dc[_0x3c1d('0x2c')]),_0x3d3c40);if(_0x436cea[_0x3c1d('0x2b')]['filter']){_0x90b7e2[_0x3c1d('0x36')]=_['merge'](_0x90b7e2[_0x3c1d('0x36')],{'$or':_[_0x3c1d('0x25')](_0x3d3c40,function(_0x1be2c2){if(_0x1be2c2[_0x3c1d('0x28')]!==_0x3c1d('0x38')){var _0x5c9b4a={};_0x5c9b4a[_0x1be2c2['name']]={'$like':'%'+_0x436cea[_0x3c1d('0x2b')][_0x3c1d('0x39')]+'%'};return _0x5c9b4a;}})});}_0x90b7e2=_[_0x3c1d('0x3a')]({},_0x90b7e2,_0x436cea['options']);var _0x45f07a={'where':_0x90b7e2[_0x3c1d('0x36')]};return db[_0x3c1d('0x3b')][_0x3c1d('0x1b')](_0x45f07a)[_0x3c1d('0x20')](function(_0xf8bba9){_0x2f0f78[_0x3c1d('0x1b')]=_0xf8bba9;if(_0x436cea['query']['includeAll']){_0x90b7e2['include']=[{'attributes':['id','name',_0x3c1d('0x3c'),'alias'],'model':db[_0x3c1d('0x3d')],'as':_0x3c1d('0x3d')}];}return db['VoiceCallReport']['findAll'](_0x90b7e2);})[_0x3c1d('0x20')](function(_0x3fec00){_0x2f0f78[_0x3c1d('0x3e')]=_0x3fec00;return _0x2f0f78;})[_0x3c1d('0x20')](respondWithFilteredResult(_0x6171dd,_0x90b7e2))[_0x3c1d('0x3f')](handleError(_0x6171dd,null));};exports[_0x3c1d('0x40')]=function(_0x6c1338,_0x5b3de6){var _0x1c7f8d={'raw':!![],'where':{'id':_0x6c1338[_0x3c1d('0x41')]['id']}},_0x463806={};_0x463806[_0x3c1d('0x2a')]=_[_0x3c1d('0x42')](db[_0x3c1d('0x3b')]['rawAttributes']);_0x463806[_0x3c1d('0x2b')]=_[_0x3c1d('0x42')](_0x6c1338[_0x3c1d('0x2b')]);_0x463806['filters']=_[_0x3c1d('0x2d')](_0x463806[_0x3c1d('0x2a')],_0x463806['query']);_0x1c7f8d[_0x3c1d('0x2e')]=_[_0x3c1d('0x2d')](_0x463806[_0x3c1d('0x2a')],qs[_0x3c1d('0x2f')](_0x6c1338[_0x3c1d('0x2b')][_0x3c1d('0x2f')]));_0x1c7f8d['attributes']=_0x1c7f8d[_0x3c1d('0x2e')][_0x3c1d('0x30')]?_0x1c7f8d['attributes']:_0x463806[_0x3c1d('0x2a')];if(_0x6c1338['query']['includeAll']){_0x1c7f8d[_0x3c1d('0x43')]=[{'all':!![]}];}_0x1c7f8d=_['merge']({},_0x1c7f8d,_0x6c1338[_0x3c1d('0x44')]);return db[_0x3c1d('0x3b')][_0x3c1d('0x45')](_0x1c7f8d)['then'](handleEntityNotFound(_0x5b3de6,null))[_0x3c1d('0x20')](respondWithResult(_0x5b3de6,null))[_0x3c1d('0x3f')](handleError(_0x5b3de6,null));};exports[_0x3c1d('0x46')]=function(_0x128ff2,_0x5c681c){return db[_0x3c1d('0x3b')]['create'](_0x128ff2[_0x3c1d('0x47')],{})['then'](respondWithResult(_0x5c681c,0xc9))[_0x3c1d('0x3f')](handleError(_0x5c681c,null));};exports[_0x3c1d('0x48')]=function(_0x47b675,_0x2aa914){return db[_0x3c1d('0x3b')]['find']({'where':{'id':_0x47b675['params']['id']}})[_0x3c1d('0x20')](handleEntityNotFound(_0x2aa914,null))[_0x3c1d('0x20')](removeEntity(_0x2aa914,null))[_0x3c1d('0x3f')](handleError(_0x2aa914,null));};exports[_0x3c1d('0x49')]=function(_0x9cc374,_0x37b4fe){return db['VoiceCallReport']['describe']()[_0x3c1d('0x20')](respondWithResult(_0x37b4fe,null))[_0x3c1d('0x3f')](handleError(_0x37b4fe,null));};exports[_0x3c1d('0x4a')]=function(_0x16640c,_0x4d4793){if(_0x16640c[_0x3c1d('0x47')][_0x3c1d('0x4b')]){delete _0x16640c[_0x3c1d('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0x3c1d('0x45')]({'where':{'uniqueid':_0x16640c[_0x3c1d('0x41')]['id'],'UserId':{'$or':[null,_0x16640c[_0x3c1d('0x4c')]['id']]}}})[_0x3c1d('0x20')](handleEntityNotFound(_0x4d4793,null))[_0x3c1d('0x20')](saveUpdates(_0x16640c[_0x3c1d('0x47')],null))['then'](respondWithResult(_0x4d4793,null))['catch'](handleError(_0x4d4793,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index bf7497f..c00c70d 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 _0x6006=['request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','uniqueid','lodash','util','bluebird'];(function(_0x20cfe7,_0x2360ef){var _0x4ff88a=function(_0x12a8fd){while(--_0x12a8fd){_0x20cfe7['push'](_0x20cfe7['shift']());}};_0x4ff88a(++_0x2360ef);}(_0x6006,0x16f));var _0x6600=function(_0x57224f,_0x98e44a){_0x57224f=_0x57224f-0x0;var _0x3b83a8=_0x6006[_0x57224f];return _0x3b83a8;};'use strict';var _=require(_0x6600('0x0'));var util=require(_0x6600('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6600('0x2'));var rp=require(_0x6600('0x3'));var fs=require('fs');var path=require(_0x6600('0x4'));var rimraf=require(_0x6600('0x5'));var config=require('../../config/environment');var attributes=require(_0x6600('0x6'));module[_0x6600('0x7')]=function(_0x2d35d0,_0x1a1ea1){return _0x2d35d0[_0x6600('0x8')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6600('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe87=['bluebird','path','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util'];(function(_0x218d3f,_0x32e8ea){var _0x5726e5=function(_0x1dcda6){while(--_0x1dcda6){_0x218d3f['push'](_0x218d3f['shift']());}};_0x5726e5(++_0x32e8ea);}(_0xbe87,0x1b6));var _0x7be8=function(_0x118026,_0x4f114b){_0x118026=_0x118026-0x0;var _0x54b1d9=_0xbe87[_0x118026];return _0x54b1d9;};'use strict';var _=require(_0x7be8('0x0'));var util=require(_0x7be8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7be8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7be8('0x3'));var rimraf=require('rimraf');var config=require(_0x7be8('0x4'));var attributes=require(_0x7be8('0x5'));module[_0x7be8('0x6')]=function(_0x4db262,_0x530485){return _0x4db262[_0x7be8('0x7')](_0x7be8('0x8'),attributes,{'tableName':_0x7be8('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 501ce16..f3b2581 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 _0x51eb=['request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','options','raw','where','attributes','include','model','map','catch','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x424a87,_0xac702c){var _0x4d22eb=function(_0xc32dec){while(--_0xc32dec){_0x424a87['push'](_0x424a87['shift']());}};_0x4d22eb(++_0xac702c);}(_0x51eb,0x14b));var _0xb51e=function(_0x282b54,_0x316738){_0x282b54=_0x282b54-0x0;var _0x3bd3e9=_0x51eb[_0x282b54];return _0x3bd3e9;};'use strict';var _=require(_0xb51e('0x0'));var util=require(_0xb51e('0x1'));var moment=require(_0xb51e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb51e('0x3'))['db'];var utils=require(_0xb51e('0x4'));var logger=require(_0xb51e('0x5'))(_0xb51e('0x6'));var config=require(_0xb51e('0x7'));var jayson=require(_0xb51e('0x8'));var client=jayson[_0xb51e('0x9')][_0xb51e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d59dc,_0x3a497f,_0x4014c2){return new BPromise(function(_0x35cd4f,_0x54743a){return client[_0xb51e('0xb')](_0x4d59dc,_0x4014c2)[_0xb51e('0xc')](function(_0x78ea3f){logger[_0xb51e('0xd')](_0xb51e('0xe'),_0x3a497f,_0xb51e('0xf'));logger[_0xb51e('0x10')](_0xb51e('0x11'),_0x3a497f,_0xb51e('0xf'),JSON[_0xb51e('0x12')](_0x78ea3f));if(_0x78ea3f[_0xb51e('0x13')]){if(_0x78ea3f[_0xb51e('0x13')][_0xb51e('0x14')]===0x1f4){logger[_0xb51e('0x13')](_0xb51e('0xe'),_0x3a497f,_0x78ea3f['error']['message']);return _0x54743a(_0x78ea3f[_0xb51e('0x13')][_0xb51e('0x15')]);}logger[_0xb51e('0x13')](_0xb51e('0xe'),_0x3a497f,_0x78ea3f['error'][_0xb51e('0x15')]);return _0x35cd4f(_0x78ea3f[_0xb51e('0x13')][_0xb51e('0x15')]);}else{logger[_0xb51e('0xd')](_0xb51e('0xe'),_0x3a497f,_0xb51e('0xf'));_0x35cd4f(_0x78ea3f[_0xb51e('0x16')][_0xb51e('0x15')]);}})['catch'](function(_0xc3238){logger[_0xb51e('0x13')](_0xb51e('0xe'),_0x3a497f,_0xc3238);_0x54743a(_0xc3238);});});}exports[_0xb51e('0x17')]=function(_0x3a2520){var _0x3d52a4=this;return new Promise(function(_0x30d7be,_0x2160a1){return db['VoiceCallReport']['findAll']({'raw':_0x3a2520[_0xb51e('0x18')]?_0x3a2520[_0xb51e('0x18')][_0xb51e('0x19')]===undefined?!![]:![]:!![],'where':_0x3a2520[_0xb51e('0x18')]?_0x3a2520[_0xb51e('0x18')][_0xb51e('0x1a')]||null:null,'attributes':_0x3a2520['options']?_0x3a2520['options'][_0xb51e('0x1b')]||null:null,'limit':_0x3a2520[_0xb51e('0x18')]?_0x3a2520[_0xb51e('0x18')]['limit']||null:null,'include':_0x3a2520[_0xb51e('0x18')]?_0x3a2520['options'][_0xb51e('0x1c')]?_['map'](_0x3a2520[_0xb51e('0x18')]['include'],function(_0x4c11b0){return{'model':db[_0x4c11b0[_0xb51e('0x1d')]],'as':_0x4c11b0['as'],'attributes':_0x4c11b0['attributes'],'include':_0x4c11b0[_0xb51e('0x1c')]?_[_0xb51e('0x1e')](_0x4c11b0[_0xb51e('0x1c')],function(_0x4f9fda){return{'model':db[_0x4f9fda[_0xb51e('0x1d')]],'as':_0x4f9fda['as'],'attributes':_0x4f9fda[_0xb51e('0x1b')],'include':_0x4f9fda[_0xb51e('0x1c')]?_[_0xb51e('0x1e')](_0x4f9fda['include'],function(_0xde839b){return{'model':db[_0xde839b[_0xb51e('0x1d')]],'as':_0xde839b['as'],'attributes':_0xde839b[_0xb51e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb51e('0xc')](function(_0x4eb3b2){logger['info']('GetVoiceCallReport',_0x3a2520);logger[_0xb51e('0x10')](_0xb51e('0x17'),_0x3a2520,JSON[_0xb51e('0x12')](_0x4eb3b2));_0x30d7be(_0x4eb3b2);})[_0xb51e('0x1f')](function(_0x3c6767){logger[_0xb51e('0x13')](_0xb51e('0x17'),_0x3c6767['message'],_0x3a2520);_0x2160a1(_0x3d52a4['error'](0x1f4,_0x3c6767['message']));});});};exports[_0xb51e('0x20')]=function(_0x3e8cb7){var _0x5201f=this;return new Promise(function(_0x3e64b6,_0x365d7e){return db[_0xb51e('0x21')][_0xb51e('0x22')](_0x3e8cb7[_0xb51e('0x23')],{'raw':_0x3e8cb7[_0xb51e('0x18')]?_0x3e8cb7['options']['raw']===undefined?!![]:![]:!![]})[_0xb51e('0xc')](function(_0x2032c0){logger[_0xb51e('0xd')]('CreateVoiceCallReport',_0x3e8cb7);logger['debug']('CreateVoiceCallReport',_0x3e8cb7,JSON[_0xb51e('0x12')](_0x2032c0));_0x3e64b6(_0x2032c0);})[_0xb51e('0x1f')](function(_0xbd2b71){logger['error'](_0xb51e('0x20'),_0xbd2b71[_0xb51e('0x15')],_0x3e8cb7);_0x365d7e(_0x5201f[_0xb51e('0x13')](0x1f4,_0xbd2b71[_0xb51e('0x15')]));});});};exports[_0xb51e('0x24')]=function(_0x1235df){var _0x1836a8=this;return new Promise(function(_0x169bd0,_0x3aab0a){return db[_0xb51e('0x21')][_0xb51e('0x25')](_0x1235df[_0xb51e('0x23')],{'raw':_0x1235df[_0xb51e('0x18')]?_0x1235df[_0xb51e('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1235df[_0xb51e('0x18')]?_0x1235df[_0xb51e('0x18')]['where']||null:null,'attributes':_0x1235df['options']?_0x1235df[_0xb51e('0x18')][_0xb51e('0x1b')]||null:null,'limit':_0x1235df[_0xb51e('0x18')]?_0x1235df['options']['limit']||null:null})[_0xb51e('0xc')](function(_0x2b6ab8){logger[_0xb51e('0xd')](_0xb51e('0x24'),_0x1235df);logger[_0xb51e('0x10')](_0xb51e('0x24'),_0x1235df,JSON['stringify'](_0x2b6ab8));_0x169bd0(_0x2b6ab8);})[_0xb51e('0x1f')](function(_0x2a6b88){logger[_0xb51e('0x13')]('UpdateVoiceCallReport',_0x2a6b88[_0xb51e('0x15')],_0x1235df);_0x3aab0a(_0x1836a8[_0xb51e('0x13')](0x1f4,_0x2a6b88['message']));});});}; \ No newline at end of file +var _0x7066=['rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','attributes','limit','include','map','model','debug','create','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x98459f,_0x4dfb55){var _0x128f94=function(_0xe6315c){while(--_0xe6315c){_0x98459f['push'](_0x98459f['shift']());}};_0x128f94(++_0x4dfb55);}(_0x7066,0x68));var _0x6706=function(_0x5d06bd,_0x47e43c){_0x5d06bd=_0x5d06bd-0x0;var _0x11735b=_0x7066[_0x5d06bd];return _0x11735b;};'use strict';var _=require(_0x6706('0x0'));var util=require(_0x6706('0x1'));var moment=require(_0x6706('0x2'));var BPromise=require(_0x6706('0x3'));var rs=require(_0x6706('0x4'));var fs=require('fs');var Redis=require(_0x6706('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6706('0x6'));var logger=require('../../config/logger')(_0x6706('0x7'));var config=require(_0x6706('0x8'));var jayson=require(_0x6706('0x9'));var client=jayson[_0x6706('0xa')][_0x6706('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x629576,_0x288237,_0x2e5221){return new BPromise(function(_0x55eb32,_0x180b8f){return client[_0x6706('0xc')](_0x629576,_0x2e5221)[_0x6706('0xd')](function(_0x121d93){logger['info'](_0x6706('0xe'),_0x288237,_0x6706('0xf'));logger['debug'](_0x6706('0x10'),_0x288237,'request\x20sent',JSON[_0x6706('0x11')](_0x121d93));if(_0x121d93[_0x6706('0x12')]){if(_0x121d93[_0x6706('0x12')]['code']===0x1f4){logger['error'](_0x6706('0xe'),_0x288237,_0x121d93[_0x6706('0x12')][_0x6706('0x13')]);return _0x180b8f(_0x121d93[_0x6706('0x12')][_0x6706('0x13')]);}logger[_0x6706('0x12')](_0x6706('0xe'),_0x288237,_0x121d93[_0x6706('0x12')]['message']);return _0x55eb32(_0x121d93[_0x6706('0x12')][_0x6706('0x13')]);}else{logger[_0x6706('0x14')](_0x6706('0xe'),_0x288237,_0x6706('0xf'));_0x55eb32(_0x121d93[_0x6706('0x15')][_0x6706('0x13')]);}})[_0x6706('0x16')](function(_0x5471e5){logger[_0x6706('0x12')](_0x6706('0xe'),_0x288237,_0x5471e5);_0x180b8f(_0x5471e5);});});}exports[_0x6706('0x17')]=function(_0x58ceeb){var _0x227490=this;return new Promise(function(_0x4d8789,_0x25b26f){return db[_0x6706('0x18')]['findAll']({'raw':_0x58ceeb['options']?_0x58ceeb[_0x6706('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x58ceeb[_0x6706('0x19')]?_0x58ceeb['options']['where']||null:null,'attributes':_0x58ceeb[_0x6706('0x19')]?_0x58ceeb[_0x6706('0x19')][_0x6706('0x1a')]||null:null,'limit':_0x58ceeb[_0x6706('0x19')]?_0x58ceeb[_0x6706('0x19')][_0x6706('0x1b')]||null:null,'include':_0x58ceeb[_0x6706('0x19')]?_0x58ceeb[_0x6706('0x19')][_0x6706('0x1c')]?_[_0x6706('0x1d')](_0x58ceeb['options'][_0x6706('0x1c')],function(_0x2dcbc5){return{'model':db[_0x2dcbc5[_0x6706('0x1e')]],'as':_0x2dcbc5['as'],'attributes':_0x2dcbc5['attributes'],'include':_0x2dcbc5[_0x6706('0x1c')]?_[_0x6706('0x1d')](_0x2dcbc5[_0x6706('0x1c')],function(_0x54ab75){return{'model':db[_0x54ab75['model']],'as':_0x54ab75['as'],'attributes':_0x54ab75[_0x6706('0x1a')],'include':_0x54ab75['include']?_['map'](_0x54ab75['include'],function(_0x3240a2){return{'model':db[_0x3240a2[_0x6706('0x1e')]],'as':_0x3240a2['as'],'attributes':_0x3240a2[_0x6706('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6706('0xd')](function(_0x16b9b0){logger['info']('GetVoiceCallReport',_0x58ceeb);logger[_0x6706('0x1f')]('GetVoiceCallReport',_0x58ceeb,JSON[_0x6706('0x11')](_0x16b9b0));_0x4d8789(_0x16b9b0);})[_0x6706('0x16')](function(_0x33c397){logger[_0x6706('0x12')](_0x6706('0x17'),_0x33c397['message'],_0x58ceeb);_0x25b26f(_0x227490[_0x6706('0x12')](0x1f4,_0x33c397[_0x6706('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x5d5967){var _0x135728=this;return new Promise(function(_0x177786,_0x451246){return db[_0x6706('0x18')][_0x6706('0x20')](_0x5d5967[_0x6706('0x21')],{'raw':_0x5d5967['options']?_0x5d5967['options'][_0x6706('0x22')]===undefined?!![]:![]:!![]})[_0x6706('0xd')](function(_0x45b54f){logger[_0x6706('0x14')](_0x6706('0x23'),_0x5d5967);logger[_0x6706('0x1f')](_0x6706('0x23'),_0x5d5967,JSON['stringify'](_0x45b54f));_0x177786(_0x45b54f);})[_0x6706('0x16')](function(_0x438a3d){logger[_0x6706('0x12')]('CreateVoiceCallReport',_0x438a3d['message'],_0x5d5967);_0x451246(_0x135728[_0x6706('0x12')](0x1f4,_0x438a3d[_0x6706('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x7a2ea3){var _0x4b844d=this;return new Promise(function(_0x20b49d,_0x314178){return db[_0x6706('0x18')]['update'](_0x7a2ea3['body'],{'raw':_0x7a2ea3[_0x6706('0x19')]?_0x7a2ea3[_0x6706('0x19')][_0x6706('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7a2ea3[_0x6706('0x19')]?_0x7a2ea3[_0x6706('0x19')]['where']||null:null,'attributes':_0x7a2ea3['options']?_0x7a2ea3[_0x6706('0x19')][_0x6706('0x1a')]||null:null,'limit':_0x7a2ea3[_0x6706('0x19')]?_0x7a2ea3[_0x6706('0x19')][_0x6706('0x1b')]||null:null})[_0x6706('0xd')](function(_0x210058){logger[_0x6706('0x14')](_0x6706('0x24'),_0x7a2ea3);logger[_0x6706('0x1f')](_0x6706('0x24'),_0x7a2ea3,JSON[_0x6706('0x11')](_0x210058));_0x20b49d(_0x210058);})[_0x6706('0x16')](function(_0x56202a){logger[_0x6706('0x12')](_0x6706('0x24'),_0x56202a['message'],_0x7a2ea3);_0x314178(_0x4b844d[_0x6706('0x12')](0x1f4,_0x56202a[_0x6706('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 57e34cd..31e6751 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 _0xd9c8=['post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated'];(function(_0x29d705,_0x516c4c){var _0x3c4627=function(_0x2ad887){while(--_0x2ad887){_0x29d705['push'](_0x29d705['shift']());}};_0x3c4627(++_0x516c4c);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd9c8[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var path=require('path');var timeout=require(_0x8d9c('0x2'));var express=require(_0x8d9c('0x3'));var router=express[_0x8d9c('0x4')]();var auth=require(_0x8d9c('0x5'));var interaction=require(_0x8d9c('0x6'));var config=require(_0x8d9c('0x7'));var controller=require(_0x8d9c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8d9c('0x9')](_0x8d9c('0xa'),auth[_0x8d9c('0xb')](),controller['show']);router[_0x8d9c('0xc')]('/',auth[_0x8d9c('0xb')](),controller[_0x8d9c('0xd')]);router[_0x8d9c('0xe')](_0x8d9c('0xa'),auth[_0x8d9c('0xb')](),controller[_0x8d9c('0xf')]);router[_0x8d9c('0x10')]('/:id',auth[_0x8d9c('0xb')](),controller['destroy']);module[_0x8d9c('0x11')]=router; \ No newline at end of file +var _0xd2e3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path','express'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xd2e3,0x1e3));var _0x3d2e=function(_0x4da7cc,_0x57fbaa){_0x4da7cc=_0x4da7cc-0x0;var _0x233d81=_0xd2e3[_0x4da7cc];return _0x233d81;};'use strict';var multer=require(_0x3d2e('0x0'));var util=require('util');var path=require(_0x3d2e('0x1'));var timeout=require('connect-timeout');var express=require(_0x3d2e('0x2'));var router=express[_0x3d2e('0x3')]();var auth=require(_0x3d2e('0x4'));var interaction=require(_0x3d2e('0x5'));var config=require(_0x3d2e('0x6'));var controller=require(_0x3d2e('0x7'));router[_0x3d2e('0x8')]('/',auth[_0x3d2e('0x9')](),controller[_0x3d2e('0xa')]);router['get'](_0x3d2e('0xb'),auth[_0x3d2e('0x9')](),controller['show']);router[_0x3d2e('0xc')]('/',auth[_0x3d2e('0x9')](),controller[_0x3d2e('0xd')]);router[_0x3d2e('0xe')](_0x3d2e('0xb'),auth['isAuthenticated'](),controller[_0x3d2e('0xf')]);router[_0x3d2e('0x10')](_0x3d2e('0xb'),auth[_0x3d2e('0x9')](),controller['destroy']);module[_0x3d2e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 448ff60..14bc4cc 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 _0xdf3e=['exports','STRING','name','getDataValue','options','BOOLEAN'];(function(_0x2d3711,_0x43d60d){var _0x477858=function(_0x4ffb1c){while(--_0x4ffb1c){_0x2d3711['push'](_0x2d3711['shift']());}};_0x477858(++_0x43d60d);}(_0xdf3e,0x72));var _0xedf3=function(_0x2886ff,_0x11e08f){_0x2886ff=_0x2886ff-0x0;var _0x19f515=_0xdf3e[_0x2886ff];return _0x19f515;};'use strict';var Sequelize=require('sequelize');module[_0xedf3('0x0')]={'name':{'type':Sequelize[_0xedf3('0x1')]},'prefix':{'type':Sequelize[_0xedf3('0x1')],'unique':_0xedf3('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xedf3('0x1')],'set':function(_0x3c84b5){this['setDataValue']('options',_0x3c84b5?_0x3c84b5['join'](''):[]);},'get':function(){return this[_0xedf3('0x3')](_0xedf3('0x4'))?this[_0xedf3('0x3')]('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xedf3('0x1')]},'record':{'type':Sequelize[_0xedf3('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xedf3('0x1')]}}; \ No newline at end of file +var _0x806f=['sequelize','exports','STRING','name','setDataValue','options','getDataValue','split','BOOLEAN'];(function(_0x511c38,_0x12071b){var _0x3120a4=function(_0x2e9259){while(--_0x2e9259){_0x511c38['push'](_0x511c38['shift']());}};_0x3120a4(++_0x12071b);}(_0x806f,0x13b));var _0xf806=function(_0x53f35,_0x2cfc69){_0x53f35=_0x53f35-0x0;var _0x38da4c=_0x806f[_0x53f35];return _0x38da4c;};'use strict';var Sequelize=require(_0xf806('0x0'));module[_0xf806('0x1')]={'name':{'type':Sequelize[_0xf806('0x2')]},'prefix':{'type':Sequelize[_0xf806('0x2')],'unique':_0xf806('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xf806('0x2')],'set':function(_0x564e42){this[_0xf806('0x4')](_0xf806('0x5'),_0x564e42?_0x564e42['join'](''):[]);},'get':function(){return this[_0xf806('0x6')](_0xf806('0x5'))?this[_0xf806('0x6')](_0xf806('0x5'))[_0xf806('0x7')](''):[];}},'auth':{'type':Sequelize[_0xf806('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xf806('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf806('0x2')]},'description':{'type':Sequelize[_0xf806('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8b6fcdf..69f3a1a 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 _0xe925=['VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type'];(function(_0x44a970,_0x2b9f20){var _0x71c8e0=function(_0xd7d3c5){while(--_0xd7d3c5){_0x44a970['push'](_0x44a970['shift']());}};_0x71c8e0(++_0x2b9f20);}(_0xe925,0x111));var _0x5e92=function(_0x2ed90a,_0x41e450){_0x2ed90a=_0x2ed90a-0x0;var _0x3b7481=_0xe925[_0x2ed90a];return _0x3b7481;};'use strict';var pdf=require(_0x5e92('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5e92('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5e92('0x2'));var moment=require(_0x5e92('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5e92('0x4'));var util=require(_0x5e92('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5e92('0x6'));var ejs=require(_0x5e92('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5e92('0x8'));var crypto=require(_0x5e92('0x9'));var jsforce=require(_0x5e92('0xa'));var deskjs=require(_0x5e92('0xb'));var toCsv=require(_0x5e92('0x6'));var querystring=require(_0x5e92('0xc'));var Papa=require(_0x5e92('0xd'));var Redis=require(_0x5e92('0xe'));var authService=require(_0x5e92('0xf'));var qs=require(_0x5e92('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e92('0x11'));var logger=require(_0x5e92('0x12'))('api');var utils=require(_0x5e92('0x13'));var config=require(_0x5e92('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9db9f,_0xc84529){_0xc84529=_0xc84529||0xcc;return function(_0x542eb0){if(_0x542eb0){return _0x9db9f[_0x5e92('0x15')](_0xc84529);}return _0x9db9f[_0x5e92('0x16')](_0xc84529)[_0x5e92('0x17')]();};}function respondWithResult(_0x1e9219,_0x3c0d76){_0x3c0d76=_0x3c0d76||0xc8;return function(_0x19ce52){if(_0x19ce52){return _0x1e9219['status'](_0x3c0d76)['json'](_0x19ce52);}};}function respondWithFilteredResult(_0x3615b0,_0x3de705){return function(_0x11bb6f){if(_0x11bb6f){var _0x231565=_0x11bb6f[_0x5e92('0x18')],_0x373723=_0x3de705[_0x5e92('0x19')],_0x213ea8=_0x3de705[_0x5e92('0x19')]+_0x3de705['limit'],_0x51150c;if(_0x213ea8>=_0x231565){_0x213ea8=_0x231565;_0x51150c=0xc8;}else{_0x51150c=0xce;}_0x3615b0['status'](_0x51150c);return _0x3615b0[_0x5e92('0x1a')](_0x5e92('0x1b'),_0x373723+'-'+_0x213ea8+'/'+_0x231565)[_0x5e92('0x1c')](_0x11bb6f);}return null;};}function patchUpdates(_0x12765a){return function(_0x372e2d){try{jsonpatch[_0x5e92('0x1d')](_0x372e2d,_0x12765a,!![]);}catch(_0x264127){return BPromise[_0x5e92('0x1e')](_0x264127);}return _0x372e2d[_0x5e92('0x1f')]();};}function saveUpdates(_0x2b972e,_0xf0ac3e){return function(_0x166489){if(_0x166489){return _0x166489[_0x5e92('0x20')](_0x2b972e)[_0x5e92('0x21')](function(_0x54e5cd){return _0x54e5cd;});}return null;};}function removeEntity(_0x4b14eb,_0x1c6504){return function(_0x510ce2){if(_0x510ce2){return _0x510ce2[_0x5e92('0x22')]()[_0x5e92('0x21')](function(){var _0x43df91=_0x510ce2[_0x5e92('0x23')]({'plain':!![]});var _0x2a9523='ChanSpies';return db[_0x5e92('0x24')][_0x5e92('0x22')]({'where':{'type':_0x2a9523,'resourceId':_0x43df91['id']}})[_0x5e92('0x21')](function(){return _0x510ce2;});})[_0x5e92('0x21')](function(){_0x4b14eb['status'](0xcc)[_0x5e92('0x17')]();});}};}function handleEntityNotFound(_0x555308,_0x38417d){return function(_0x461e5f){if(!_0x461e5f){_0x555308[_0x5e92('0x15')](0x194);}return _0x461e5f;};}function handleError(_0x24559a,_0x1fe9a9){_0x1fe9a9=_0x1fe9a9||0x1f4;return function(_0x3225b8){logger[_0x5e92('0x25')](_0x3225b8[_0x5e92('0x26')]);if(_0x3225b8[_0x5e92('0x27')]){delete _0x3225b8[_0x5e92('0x27')];}_0x24559a[_0x5e92('0x16')](_0x1fe9a9)[_0x5e92('0x28')](_0x3225b8);};}exports[_0x5e92('0x29')]=function(_0x5326f5,_0x4b7cba){var _0x55842e={},_0x5e1b5e={},_0x223b72={'count':0x0,'rows':[]};var _0x288ca9=_[_0x5e92('0x2a')](db[_0x5e92('0x2b')]['rawAttributes'],function(_0x1f9e42){return{'name':_0x1f9e42[_0x5e92('0x2c')],'type':_0x1f9e42['type'][_0x5e92('0x2d')]};});_0x5e1b5e['model']=_['map'](_0x288ca9,_0x5e92('0x27'));_0x5e1b5e[_0x5e92('0x2e')]=_['keys'](_0x5326f5['query']);_0x5e1b5e[_0x5e92('0x2f')]=_[_0x5e92('0x30')](_0x5e1b5e['model'],_0x5e1b5e[_0x5e92('0x2e')]);_0x55842e[_0x5e92('0x31')]=_['intersection'](_0x5e1b5e[_0x5e92('0x32')],qs[_0x5e92('0x33')](_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x33')]));_0x55842e[_0x5e92('0x31')]=_0x55842e[_0x5e92('0x31')][_0x5e92('0x34')]?_0x55842e[_0x5e92('0x31')]:_0x5e1b5e[_0x5e92('0x32')];if(!_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x35')](_0x5e92('0x36'))){_0x55842e[_0x5e92('0x37')]=qs[_0x5e92('0x37')](_0x5326f5[_0x5e92('0x2e')]['limit']);_0x55842e['offset']=qs[_0x5e92('0x19')](_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x19')]);}_0x55842e[_0x5e92('0x38')]=qs[_0x5e92('0x39')](_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x39')]);_0x55842e[_0x5e92('0x3a')]=qs['filters'](_[_0x5e92('0x3b')](_0x5326f5['query'],_0x5e1b5e[_0x5e92('0x2f')]),_0x288ca9);if(_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x3c')]){_0x55842e[_0x5e92('0x3a')]=_[_0x5e92('0x3d')](_0x55842e[_0x5e92('0x3a')],{'$or':_[_0x5e92('0x2a')](_0x288ca9,function(_0xd40682){if(_0xd40682[_0x5e92('0x3e')]!==_0x5e92('0x3f')){var _0x54e01c={};_0x54e01c[_0xd40682['name']]={'$like':'%'+_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x3c')]+'%'};return _0x54e01c;}})});}_0x55842e=_[_0x5e92('0x3d')]({},_0x55842e,_0x5326f5[_0x5e92('0x40')]);var _0x397917={'where':_0x55842e[_0x5e92('0x3a')]};return db[_0x5e92('0x2b')]['count'](_0x397917)['then'](function(_0x295671){_0x223b72[_0x5e92('0x18')]=_0x295671;if(_0x5326f5[_0x5e92('0x2e')][_0x5e92('0x41')]){_0x55842e[_0x5e92('0x42')]=[{'all':!![]}];}return db[_0x5e92('0x2b')][_0x5e92('0x43')](_0x55842e);})['then'](function(_0x1fb209){_0x223b72[_0x5e92('0x44')]=_0x1fb209;return _0x223b72;})['then'](respondWithFilteredResult(_0x4b7cba,_0x55842e))['catch'](handleError(_0x4b7cba,null));};exports[_0x5e92('0x45')]=function(_0x547c90,_0x4eecde){var _0x18e560={'raw':![],'where':{'id':_0x547c90['params']['id']}},_0x2cdb51={};_0x2cdb51[_0x5e92('0x32')]=_[_0x5e92('0x46')](db[_0x5e92('0x2b')]['rawAttributes']);_0x2cdb51['query']=_[_0x5e92('0x46')](_0x547c90[_0x5e92('0x2e')]);_0x2cdb51[_0x5e92('0x2f')]=_['intersection'](_0x2cdb51[_0x5e92('0x32')],_0x2cdb51[_0x5e92('0x2e')]);_0x18e560[_0x5e92('0x31')]=_['intersection'](_0x2cdb51['model'],qs['fields'](_0x547c90[_0x5e92('0x2e')][_0x5e92('0x33')]));_0x18e560[_0x5e92('0x31')]=_0x18e560[_0x5e92('0x31')][_0x5e92('0x34')]?_0x18e560[_0x5e92('0x31')]:_0x2cdb51['model'];if(_0x547c90[_0x5e92('0x2e')]['includeAll']){_0x18e560[_0x5e92('0x42')]=[{'all':!![]}];}_0x18e560=_[_0x5e92('0x3d')]({},_0x18e560,_0x547c90['options']);return db['VoiceChanSpy'][_0x5e92('0x47')](_0x18e560)['then'](handleEntityNotFound(_0x4eecde,null))[_0x5e92('0x21')](respondWithResult(_0x4eecde,null))['catch'](handleError(_0x4eecde,null));};exports[_0x5e92('0x48')]=function(_0x4326a6,_0x2337f8){return db[_0x5e92('0x2b')][_0x5e92('0x48')](_0x4326a6[_0x5e92('0x49')],{})[_0x5e92('0x21')](function(_0x3228df){var _0x4f03ac=_0x4326a6['user']['get']({'plain':!![]});if(!_0x4f03ac)throw new Error(_0x5e92('0x4a'));if(_0x4f03ac[_0x5e92('0x4b')]===_0x5e92('0x4c')){var _0x1513da=_0x3228df[_0x5e92('0x23')]({'plain':!![]});var _0x51dadd=_0x5e92('0x4d');return db[_0x5e92('0x4e')][_0x5e92('0x47')]({'where':{'name':_0x51dadd,'userProfileId':_0x4f03ac[_0x5e92('0x4f')]},'raw':!![]})[_0x5e92('0x21')](function(_0x383bf1){if(_0x383bf1&&_0x383bf1[_0x5e92('0x50')]===0x0){return db[_0x5e92('0x24')]['create']({'name':_0x1513da[_0x5e92('0x27')],'resourceId':_0x1513da['id'],'type':_0x383bf1[_0x5e92('0x27')],'sectionId':_0x383bf1['id']},{})[_0x5e92('0x21')](function(){return _0x3228df;});}else{return _0x3228df;}})[_0x5e92('0x51')](function(_0x3b97a6){logger[_0x5e92('0x25')](_0x5e92('0x52'),_0x3b97a6);throw _0x3b97a6;});}return _0x3228df;})[_0x5e92('0x21')](respondWithResult(_0x2337f8,0xc9))[_0x5e92('0x51')](handleError(_0x2337f8,null));};exports[_0x5e92('0x20')]=function(_0x295c34,_0x49a43){if(_0x295c34[_0x5e92('0x49')]['id']){delete _0x295c34[_0x5e92('0x49')]['id'];}return db[_0x5e92('0x2b')]['find']({'where':{'id':_0x295c34[_0x5e92('0x53')]['id']}})[_0x5e92('0x21')](handleEntityNotFound(_0x49a43,null))[_0x5e92('0x21')](saveUpdates(_0x295c34[_0x5e92('0x49')],null))['then'](respondWithResult(_0x49a43,null))['catch'](handleError(_0x49a43,null));};exports[_0x5e92('0x22')]=function(_0x5b5ee5,_0x38b5f0){return db['VoiceChanSpy'][_0x5e92('0x47')]({'where':{'id':_0x5b5ee5[_0x5e92('0x53')]['id']}})[_0x5e92('0x21')](handleEntityNotFound(_0x38b5f0,null))[_0x5e92('0x21')](removeEntity(_0x38b5f0,null))[_0x5e92('0x51')](handleError(_0x38b5f0,null));}; \ No newline at end of file +var _0xcc60=['catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0xcc60,0x1e9));var _0x0cc6=function(_0x4812dd,_0x38e4db){_0x4812dd=_0x4812dd-0x0;var _0x5bade8=_0xcc60[_0x4812dd];return _0x5bade8;};'use strict';var pdf=require(_0x0cc6('0x0'));var emlformat=require(_0x0cc6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0cc6('0x2'));var jsonpatch=require(_0x0cc6('0x3'));var rp=require('request-promise');var moment=require(_0x0cc6('0x4'));var BPromise=require(_0x0cc6('0x5'));var Mustache=require(_0x0cc6('0x6'));var util=require('util');var path=require(_0x0cc6('0x7'));var sox=require(_0x0cc6('0x8'));var csv=require(_0x0cc6('0x9'));var ejs=require(_0x0cc6('0xa'));var fs=require('fs');var _=require(_0x0cc6('0xb'));var squel=require(_0x0cc6('0xc'));var crypto=require('crypto');var jsforce=require(_0x0cc6('0xd'));var deskjs=require(_0x0cc6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0cc6('0xf'));var Papa=require(_0x0cc6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0cc6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cc6('0x12'));var logger=require('../../config/logger')(_0x0cc6('0x13'));var utils=require(_0x0cc6('0x14'));var config=require(_0x0cc6('0x15'));var db=require(_0x0cc6('0x16'))['db'];function respondWithStatusCode(_0x1aebde,_0xac471e){_0xac471e=_0xac471e||0xcc;return function(_0x106139){if(_0x106139){return _0x1aebde['sendStatus'](_0xac471e);}return _0x1aebde[_0x0cc6('0x17')](_0xac471e)['end']();};}function respondWithResult(_0x11850c,_0x5cefc8){_0x5cefc8=_0x5cefc8||0xc8;return function(_0x1b1811){if(_0x1b1811){return _0x11850c[_0x0cc6('0x17')](_0x5cefc8)[_0x0cc6('0x18')](_0x1b1811);}};}function respondWithFilteredResult(_0x3bc201,_0x1f615b){return function(_0x5cccab){if(_0x5cccab){var _0x21c530=_0x5cccab[_0x0cc6('0x19')],_0xa8227=_0x1f615b[_0x0cc6('0x1a')],_0x42e44a=_0x1f615b[_0x0cc6('0x1a')]+_0x1f615b[_0x0cc6('0x1b')],_0x42978f;if(_0x42e44a>=_0x21c530){_0x42e44a=_0x21c530;_0x42978f=0xc8;}else{_0x42978f=0xce;}_0x3bc201[_0x0cc6('0x17')](_0x42978f);return _0x3bc201['set'](_0x0cc6('0x1c'),_0xa8227+'-'+_0x42e44a+'/'+_0x21c530)[_0x0cc6('0x18')](_0x5cccab);}return null;};}function patchUpdates(_0x53079a){return function(_0x4b4d72){try{jsonpatch['apply'](_0x4b4d72,_0x53079a,!![]);}catch(_0xb9c381){return BPromise[_0x0cc6('0x1d')](_0xb9c381);}return _0x4b4d72[_0x0cc6('0x1e')]();};}function saveUpdates(_0x115203,_0x314e97){return function(_0x35d30c){if(_0x35d30c){return _0x35d30c[_0x0cc6('0x1f')](_0x115203)[_0x0cc6('0x20')](function(_0x1a45f8){return _0x1a45f8;});}return null;};}function removeEntity(_0x218b01,_0x59f447){return function(_0x1aa191){if(_0x1aa191){return _0x1aa191[_0x0cc6('0x21')]()[_0x0cc6('0x20')](function(){var _0x446e70=_0x1aa191[_0x0cc6('0x22')]({'plain':!![]});var _0x1e1d1e='ChanSpies';return db[_0x0cc6('0x23')][_0x0cc6('0x21')]({'where':{'type':_0x1e1d1e,'resourceId':_0x446e70['id']}})[_0x0cc6('0x20')](function(){return _0x1aa191;});})[_0x0cc6('0x20')](function(){_0x218b01[_0x0cc6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3643e6,_0x4d5482){return function(_0x11b75f){if(!_0x11b75f){_0x3643e6[_0x0cc6('0x24')](0x194);}return _0x11b75f;};}function handleError(_0x12d2a2,_0x4b60e){_0x4b60e=_0x4b60e||0x1f4;return function(_0xa28892){logger[_0x0cc6('0x25')](_0xa28892['stack']);if(_0xa28892['name']){delete _0xa28892[_0x0cc6('0x26')];}_0x12d2a2[_0x0cc6('0x17')](_0x4b60e)[_0x0cc6('0x27')](_0xa28892);};}exports[_0x0cc6('0x28')]=function(_0x327325,_0x3ef60d){var _0x457ef6={},_0x5c10f3={},_0x46decf={'count':0x0,'rows':[]};var _0x26f7e9=_[_0x0cc6('0x29')](db[_0x0cc6('0x2a')]['rawAttributes'],function(_0x750bd4){return{'name':_0x750bd4[_0x0cc6('0x2b')],'type':_0x750bd4[_0x0cc6('0x2c')][_0x0cc6('0x2d')]};});_0x5c10f3[_0x0cc6('0x2e')]=_[_0x0cc6('0x29')](_0x26f7e9,_0x0cc6('0x26'));_0x5c10f3[_0x0cc6('0x2f')]=_[_0x0cc6('0x30')](_0x327325[_0x0cc6('0x2f')]);_0x5c10f3[_0x0cc6('0x31')]=_[_0x0cc6('0x32')](_0x5c10f3[_0x0cc6('0x2e')],_0x5c10f3[_0x0cc6('0x2f')]);_0x457ef6[_0x0cc6('0x33')]=_['intersection'](_0x5c10f3[_0x0cc6('0x2e')],qs['fields'](_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x34')]));_0x457ef6[_0x0cc6('0x33')]=_0x457ef6[_0x0cc6('0x33')]['length']?_0x457ef6[_0x0cc6('0x33')]:_0x5c10f3['model'];if(!_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x35')]('nolimit')){_0x457ef6[_0x0cc6('0x1b')]=qs[_0x0cc6('0x1b')](_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x1b')]);_0x457ef6['offset']=qs[_0x0cc6('0x1a')](_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x1a')]);}_0x457ef6['order']=qs[_0x0cc6('0x36')](_0x327325['query'][_0x0cc6('0x36')]);_0x457ef6['where']=qs['filters'](_[_0x0cc6('0x37')](_0x327325['query'],_0x5c10f3[_0x0cc6('0x31')]),_0x26f7e9);if(_0x327325['query'][_0x0cc6('0x38')]){_0x457ef6[_0x0cc6('0x39')]=_[_0x0cc6('0x3a')](_0x457ef6[_0x0cc6('0x39')],{'$or':_[_0x0cc6('0x29')](_0x26f7e9,function(_0x180db6){if(_0x180db6[_0x0cc6('0x2c')]!==_0x0cc6('0x3b')){var _0x2bfc76={};_0x2bfc76[_0x180db6[_0x0cc6('0x26')]]={'$like':'%'+_0x327325[_0x0cc6('0x2f')][_0x0cc6('0x38')]+'%'};return _0x2bfc76;}})});}_0x457ef6=_['merge']({},_0x457ef6,_0x327325[_0x0cc6('0x3c')]);var _0x39fffd={'where':_0x457ef6['where']};return db['VoiceChanSpy'][_0x0cc6('0x19')](_0x39fffd)[_0x0cc6('0x20')](function(_0xe95b3f){_0x46decf[_0x0cc6('0x19')]=_0xe95b3f;if(_0x327325[_0x0cc6('0x2f')]['includeAll']){_0x457ef6[_0x0cc6('0x3d')]=[{'all':!![]}];}return db[_0x0cc6('0x2a')][_0x0cc6('0x3e')](_0x457ef6);})[_0x0cc6('0x20')](function(_0x576e8f){_0x46decf[_0x0cc6('0x3f')]=_0x576e8f;return _0x46decf;})[_0x0cc6('0x20')](respondWithFilteredResult(_0x3ef60d,_0x457ef6))[_0x0cc6('0x40')](handleError(_0x3ef60d,null));};exports[_0x0cc6('0x41')]=function(_0x1260d8,_0xfa91b6){var _0x2a7e25={'raw':![],'where':{'id':_0x1260d8[_0x0cc6('0x42')]['id']}},_0x4aca8b={};_0x4aca8b[_0x0cc6('0x2e')]=_['keys'](db[_0x0cc6('0x2a')][_0x0cc6('0x43')]);_0x4aca8b[_0x0cc6('0x2f')]=_[_0x0cc6('0x30')](_0x1260d8['query']);_0x4aca8b[_0x0cc6('0x31')]=_[_0x0cc6('0x32')](_0x4aca8b[_0x0cc6('0x2e')],_0x4aca8b[_0x0cc6('0x2f')]);_0x2a7e25['attributes']=_[_0x0cc6('0x32')](_0x4aca8b[_0x0cc6('0x2e')],qs[_0x0cc6('0x34')](_0x1260d8[_0x0cc6('0x2f')]['fields']));_0x2a7e25[_0x0cc6('0x33')]=_0x2a7e25[_0x0cc6('0x33')]['length']?_0x2a7e25[_0x0cc6('0x33')]:_0x4aca8b[_0x0cc6('0x2e')];if(_0x1260d8[_0x0cc6('0x2f')][_0x0cc6('0x44')]){_0x2a7e25[_0x0cc6('0x3d')]=[{'all':!![]}];}_0x2a7e25=_[_0x0cc6('0x3a')]({},_0x2a7e25,_0x1260d8[_0x0cc6('0x3c')]);return db[_0x0cc6('0x2a')][_0x0cc6('0x45')](_0x2a7e25)[_0x0cc6('0x20')](handleEntityNotFound(_0xfa91b6,null))[_0x0cc6('0x20')](respondWithResult(_0xfa91b6,null))[_0x0cc6('0x40')](handleError(_0xfa91b6,null));};exports[_0x0cc6('0x46')]=function(_0x276653,_0x304264){return db[_0x0cc6('0x2a')]['create'](_0x276653[_0x0cc6('0x47')],{})[_0x0cc6('0x20')](function(_0x17b4cd){var _0x4fd254=_0x276653[_0x0cc6('0x48')][_0x0cc6('0x22')]({'plain':!![]});if(!_0x4fd254)throw new Error(_0x0cc6('0x49'));if(_0x4fd254[_0x0cc6('0x4a')]===_0x0cc6('0x48')){var _0x3bb31d=_0x17b4cd[_0x0cc6('0x22')]({'plain':!![]});var _0x41c9cd=_0x0cc6('0x4b');return db['UserProfileSection'][_0x0cc6('0x45')]({'where':{'name':_0x41c9cd,'userProfileId':_0x4fd254[_0x0cc6('0x4c')]},'raw':!![]})[_0x0cc6('0x20')](function(_0x37aa26){if(_0x37aa26&&_0x37aa26[_0x0cc6('0x4d')]===0x0){return db[_0x0cc6('0x23')]['create']({'name':_0x3bb31d[_0x0cc6('0x26')],'resourceId':_0x3bb31d['id'],'type':_0x37aa26[_0x0cc6('0x26')],'sectionId':_0x37aa26['id']},{})[_0x0cc6('0x20')](function(){return _0x17b4cd;});}else{return _0x17b4cd;}})[_0x0cc6('0x40')](function(_0x265880){logger[_0x0cc6('0x25')](_0x0cc6('0x4e'),_0x265880);throw _0x265880;});}return _0x17b4cd;})['then'](respondWithResult(_0x304264,0xc9))[_0x0cc6('0x40')](handleError(_0x304264,null));};exports[_0x0cc6('0x1f')]=function(_0x16cafb,_0x241331){if(_0x16cafb[_0x0cc6('0x47')]['id']){delete _0x16cafb['body']['id'];}return db['VoiceChanSpy'][_0x0cc6('0x45')]({'where':{'id':_0x16cafb['params']['id']}})[_0x0cc6('0x20')](handleEntityNotFound(_0x241331,null))[_0x0cc6('0x20')](saveUpdates(_0x16cafb[_0x0cc6('0x47')],null))['then'](respondWithResult(_0x241331,null))[_0x0cc6('0x40')](handleError(_0x241331,null));};exports[_0x0cc6('0x21')]=function(_0xc38d5c,_0x374734){return db[_0x0cc6('0x2a')][_0x0cc6('0x45')]({'where':{'id':_0xc38d5c[_0x0cc6('0x42')]['id']}})[_0x0cc6('0x20')](handleEntityNotFound(_0x374734,null))['then'](removeEntity(_0x374734,null))['catch'](handleError(_0x374734,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9e41781..d5807e4 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 _0xac4a=['auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','concat','internal','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','then','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','prefix','push','merge','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x1ce71c,_0x1f2369){var _0x38c215=function(_0x2777b7){while(--_0x2777b7){_0x1ce71c['push'](_0x1ce71c['shift']());}};_0x38c215(++_0x1f2369);}(_0xac4a,0x13f));var _0xaac4=function(_0x2cdd4c,_0x580c06){_0x2cdd4c=_0x2cdd4c-0x0;var _0xbc21c0=_0xac4a[_0x2cdd4c];return _0xbc21c0;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var BPromise=require(_0xaac4('0x2'));var attributes=require(_0xaac4('0x3'));var getUserApplications=function(_0x38f4f4,_0x1dc251,_0x5aeb7d){var _0x58626e=0x1;var _0x2af0f6=[];var _0x2a5762={'context':_0x1dc251[_0xaac4('0x4')]||'from-sip','exten':util[_0xaac4('0x5')]('%s%s',_0x38f4f4[_0xaac4('0x6')],_0x5aeb7d),'type':'system','isApp':![],'ChanSpyId':_0x38f4f4['id'],'UserId':_0x1dc251['id']};_0x2af0f6[_0xaac4('0x7')](_[_0xaac4('0x8')]({'app':'Set','appdata':util['format'](_0xaac4('0x9'),'chanspy'),'priority':_0x58626e++},_0x2a5762));if(_0x38f4f4[_0xaac4('0xa')]){_0x2af0f6['push'](_['merge']({'app':_0xaac4('0xb'),'appdata':util[_0xaac4('0x5')](_0xaac4('0xc'),_0x38f4f4[_0xaac4('0xd')]),'priority':_0x58626e++},_0x2a5762));}if(_0x38f4f4[_0xaac4('0xe')]){_0x2af0f6['push'](_['merge']({'app':_0xaac4('0xf'),'appdata':_0x38f4f4[_0xaac4('0x10')],'priority':_0x58626e++},_0x2a5762));}_0x2af0f6[_0xaac4('0x7')](_['merge']({'app':_0xaac4('0x11'),'appdata':util[_0xaac4('0x5')]('SIP/%s,%s',_0x1dc251[_0xaac4('0x12')],_0x38f4f4[_0xaac4('0x13')]?_0x38f4f4[_0xaac4('0x13')][_0xaac4('0x14')](''):''),'priority':_0x58626e++},_0x2a5762));if(_0x38f4f4[_0xaac4('0xa')]){_0x2af0f6[_0xaac4('0x7')](_[_0xaac4('0x8')]({'app':_0xaac4('0x15'),'priority':_0x58626e++},_0x2a5762));}return _0x2af0f6;};var getChanSpyApplications=function(_0x233278,_0xb8466e){var _0x35bc32=[];for(var _0x1766c2=0x0,_0x3f643c=0x1;_0x1766c2<_0xb8466e['length'];_0x1766c2++,_0x3f643c=0x1){_0x35bc32=_0x35bc32[_0xaac4('0x16')](getUserApplications(_0x233278,_0xb8466e[_0x1766c2],_0xb8466e[_0x1766c2]['internal']));if(_0xb8466e[_0x1766c2][_0xaac4('0x17')]!=_0xb8466e[_0x1766c2]['name']){_0x35bc32=_0x35bc32[_0xaac4('0x16')](getUserApplications(_0x233278,_0xb8466e[_0x1766c2],_0xb8466e[_0x1766c2][_0xaac4('0x12')]));}}return _0x35bc32;};var getChanSpyPromise=function(_0xa22b76,_0x271bcb){return new BPromise(function(_0x3cbcb1,_0x2f3deb){return _0xa22b76[_0xaac4('0x18')][_0xaac4('0x19')]({'attributes':['id',_0xaac4('0x12'),'internal'],'where':{'role':_0xaac4('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x3303f1){if(_0x3303f1){return _0x3cbcb1(getChanSpyApplications(_0x271bcb,_0x3303f1));}return _0x3cbcb1([]);})[_0xaac4('0x1b')](function(_0x43625c){_0x2f3deb(_0x43625c);});});};module[_0xaac4('0x1c')]=function(_0x17140f,_0x383a8c){var _0x590905=_0x17140f[_0xaac4('0x1d')];return _0x17140f[_0xaac4('0x1e')](_0xaac4('0x1f'),attributes,{'tableName':_0xaac4('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dd059,_0x2dcc59,_0xb2577b){return getChanSpyPromise(_0x590905,_0x3dd059)['then'](function(_0x24186b){if(_0x24186b&&_0x24186b['length']){return _0x590905['VoiceExtension']['bulkCreate'](_0x24186b);}})['then'](function(){_0xb2577b();})[_0xaac4('0x1b')](function(_0x17d25f){_0xb2577b(_0x17d25f);});},'afterUpdate':function(_0x22cda2,_0xe93120,_0x3c1445){return _0x590905[_0xaac4('0x21')][_0xaac4('0x22')]({'where':{'ChanSpyId':_0x22cda2['id']}})[_0xaac4('0x23')](function(){return getChanSpyPromise(_0x590905,_0x22cda2);})[_0xaac4('0x23')](function(_0x386c9b){if(_0x386c9b&&_0x386c9b['length']){return _0x590905[_0xaac4('0x21')][_0xaac4('0x24')](_0x386c9b);}})[_0xaac4('0x23')](function(){_0x3c1445();})[_0xaac4('0x1b')](function(_0x669b34){_0x3c1445(_0x669b34);});},'afterDestroy':function(_0x442b87,_0x5e469a,_0xcf6c1){return _0x590905['VoiceExtension'][_0xaac4('0x22')]({'where':{'ChanSpyId':_0x442b87['id']}})[_0xaac4('0x23')](function(){_0xcf6c1();})[_0xaac4('0x1b')](function(_0x2aaa68){_0xcf6c1(_0x2aaa68);});}}});}; \ No newline at end of file +var _0x9b5b=['catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','then','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','push','Set','CDR(type)=%s','record','merge','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0x9b5b,0x7f));var _0xb9b5=function(_0x445140,_0x5b5b99){_0x445140=_0x445140-0x0;var _0x25ce78=_0x9b5b[_0x445140];return _0x25ce78;};'use strict';var _=require(_0xb9b5('0x0'));var util=require(_0xb9b5('0x1'));var BPromise=require(_0xb9b5('0x2'));var attributes=require(_0xb9b5('0x3'));var getUserApplications=function(_0x295b93,_0x172064,_0x19208c){var _0xf3dd29=0x1;var _0x6c5d19=[];var _0x575d3a={'context':_0x172064[_0xb9b5('0x4')]||_0xb9b5('0x5'),'exten':util[_0xb9b5('0x6')]('%s%s',_0x295b93['prefix'],_0x19208c),'type':'system','isApp':![],'ChanSpyId':_0x295b93['id'],'UserId':_0x172064['id']};_0x6c5d19[_0xb9b5('0x7')](_['merge']({'app':_0xb9b5('0x8'),'appdata':util[_0xb9b5('0x6')](_0xb9b5('0x9'),'chanspy'),'priority':_0xf3dd29++},_0x575d3a));if(_0x295b93[_0xb9b5('0xa')]){_0x6c5d19['push'](_[_0xb9b5('0xb')]({'app':_0xb9b5('0xc'),'appdata':util[_0xb9b5('0x6')](_0xb9b5('0xd'),_0x295b93['recordingFormat']),'priority':_0xf3dd29++},_0x575d3a));}if(_0x295b93[_0xb9b5('0xe')]){_0x6c5d19[_0xb9b5('0x7')](_[_0xb9b5('0xb')]({'app':_0xb9b5('0xf'),'appdata':_0x295b93[_0xb9b5('0x10')],'priority':_0xf3dd29++},_0x575d3a));}_0x6c5d19[_0xb9b5('0x7')](_[_0xb9b5('0xb')]({'app':_0xb9b5('0x11'),'appdata':util[_0xb9b5('0x6')](_0xb9b5('0x12'),_0x172064['name'],_0x295b93['options']?_0x295b93[_0xb9b5('0x13')][_0xb9b5('0x14')](''):''),'priority':_0xf3dd29++},_0x575d3a));if(_0x295b93[_0xb9b5('0xa')]){_0x6c5d19[_0xb9b5('0x7')](_[_0xb9b5('0xb')]({'app':_0xb9b5('0x15'),'priority':_0xf3dd29++},_0x575d3a));}return _0x6c5d19;};var getChanSpyApplications=function(_0x1a452b,_0x3c89c0){var _0x1dc8c2=[];for(var _0x1e7064=0x0,_0x54f33e=0x1;_0x1e7064<_0x3c89c0[_0xb9b5('0x16')];_0x1e7064++,_0x54f33e=0x1){_0x1dc8c2=_0x1dc8c2[_0xb9b5('0x17')](getUserApplications(_0x1a452b,_0x3c89c0[_0x1e7064],_0x3c89c0[_0x1e7064][_0xb9b5('0x18')]));if(_0x3c89c0[_0x1e7064][_0xb9b5('0x18')]!=_0x3c89c0[_0x1e7064][_0xb9b5('0x19')]){_0x1dc8c2=_0x1dc8c2['concat'](getUserApplications(_0x1a452b,_0x3c89c0[_0x1e7064],_0x3c89c0[_0x1e7064][_0xb9b5('0x19')]));}}return _0x1dc8c2;};var getChanSpyPromise=function(_0x7ab648,_0x2c2893){return new BPromise(function(_0x1dc0a8,_0x3dbacd){return _0x7ab648[_0xb9b5('0x1a')][_0xb9b5('0x1b')]({'attributes':['id',_0xb9b5('0x19'),'internal'],'where':{'role':_0xb9b5('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x394310){if(_0x394310){return _0x1dc0a8(getChanSpyApplications(_0x2c2893,_0x394310));}return _0x1dc0a8([]);})[_0xb9b5('0x1d')](function(_0x1bbf62){_0x3dbacd(_0x1bbf62);});});};module[_0xb9b5('0x1e')]=function(_0x1d55cd,_0xd1a22c){var _0x33af2a=_0x1d55cd[_0xb9b5('0x1f')];return _0x1d55cd[_0xb9b5('0x20')](_0xb9b5('0x21'),attributes,{'tableName':_0xb9b5('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bb50c,_0x5f0ce4,_0x3239f8){return getChanSpyPromise(_0x33af2a,_0x5bb50c)['then'](function(_0x10bdca){if(_0x10bdca&&_0x10bdca[_0xb9b5('0x16')]){return _0x33af2a[_0xb9b5('0x23')][_0xb9b5('0x24')](_0x10bdca);}})[_0xb9b5('0x25')](function(){_0x3239f8();})[_0xb9b5('0x1d')](function(_0x1df9bd){_0x3239f8(_0x1df9bd);});},'afterUpdate':function(_0x3865ec,_0x42d908,_0x38f07a){return _0x33af2a[_0xb9b5('0x23')][_0xb9b5('0x26')]({'where':{'ChanSpyId':_0x3865ec['id']}})[_0xb9b5('0x25')](function(){return getChanSpyPromise(_0x33af2a,_0x3865ec);})['then'](function(_0x54869a){if(_0x54869a&&_0x54869a[_0xb9b5('0x16')]){return _0x33af2a[_0xb9b5('0x23')][_0xb9b5('0x24')](_0x54869a);}})[_0xb9b5('0x25')](function(){_0x38f07a();})[_0xb9b5('0x1d')](function(_0x1259c2){_0x38f07a(_0x1259c2);});},'afterDestroy':function(_0x16e6fa,_0x2e8d0e,_0x49d657){return _0x33af2a['VoiceExtension'][_0xb9b5('0x26')]({'where':{'ChanSpyId':_0x16e6fa['id']}})[_0xb9b5('0x25')](function(){_0x49d657();})[_0xb9b5('0x1d')](function(_0x2612a1){_0x49d657(_0x2612a1);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f3875c6..4894c53 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 _0xf268=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird'];(function(_0x186f69,_0x5def7c){var _0x23acec=function(_0x6e476c){while(--_0x6e476c){_0x186f69['push'](_0x186f69['shift']());}};_0x23acec(++_0x5def7c);}(_0xf268,0x123));var _0x8f26=function(_0x44d902,_0x376b4e){_0x44d902=_0x44d902-0x0;var _0x27aa72=_0xf268[_0x44d902];return _0x27aa72;};'use strict';var _=require(_0x8f26('0x0'));var util=require(_0x8f26('0x1'));var moment=require('moment');var BPromise=require(_0x8f26('0x2'));var rs=require(_0x8f26('0x3'));var fs=require('fs');var Redis=require(_0x8f26('0x4'));var db=require(_0x8f26('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f26('0x6'))(_0x8f26('0x7'));var config=require('../../config/environment');var jayson=require(_0x8f26('0x8'));var client=jayson['client'][_0x8f26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c75c0,_0x55b045,_0x39228c){return new BPromise(function(_0x5aa41e,_0x407cab){return client[_0x8f26('0xa')](_0x4c75c0,_0x39228c)[_0x8f26('0xb')](function(_0x3448d8){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x55b045,_0x8f26('0xc'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x55b045,_0x8f26('0xc'),JSON[_0x8f26('0xd')](_0x3448d8));if(_0x3448d8[_0x8f26('0xe')]){if(_0x3448d8[_0x8f26('0xe')][_0x8f26('0xf')]===0x1f4){logger[_0x8f26('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x55b045,_0x3448d8[_0x8f26('0xe')][_0x8f26('0x10')]);return _0x407cab(_0x3448d8[_0x8f26('0xe')][_0x8f26('0x10')]);}logger[_0x8f26('0xe')](_0x8f26('0x11'),_0x55b045,_0x3448d8['error']['message']);return _0x5aa41e(_0x3448d8[_0x8f26('0xe')]['message']);}else{logger[_0x8f26('0x12')](_0x8f26('0x11'),_0x55b045,'request\x20sent');_0x5aa41e(_0x3448d8[_0x8f26('0x13')][_0x8f26('0x10')]);}})[_0x8f26('0x14')](function(_0x329bd7){logger[_0x8f26('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x55b045,_0x329bd7);_0x407cab(_0x329bd7);});});} \ No newline at end of file +var _0x1deb=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x1deb,0xeb));var _0xb1de=function(_0x3547af,_0x1e4445){_0x3547af=_0x3547af-0x0;var _0x52de78=_0x1deb[_0x3547af];return _0x52de78;};'use strict';var _=require(_0xb1de('0x0'));var util=require(_0xb1de('0x1'));var moment=require(_0xb1de('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1de('0x3'));var fs=require('fs');var Redis=require(_0xb1de('0x4'));var db=require(_0xb1de('0x5'))['db'];var utils=require(_0xb1de('0x6'));var logger=require(_0xb1de('0x7'))(_0xb1de('0x8'));var config=require(_0xb1de('0x9'));var jayson=require(_0xb1de('0xa'));var client=jayson[_0xb1de('0xb')][_0xb1de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcbf39c,_0x3a37cf,_0x4ff7cc){return new BPromise(function(_0x42a73f,_0x274f4){return client['request'](_0xcbf39c,_0x4ff7cc)[_0xb1de('0xd')](function(_0x1fb1a4){logger[_0xb1de('0xe')](_0xb1de('0xf'),_0x3a37cf,'request\x20sent');logger[_0xb1de('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3a37cf,_0xb1de('0x11'),JSON[_0xb1de('0x12')](_0x1fb1a4));if(_0x1fb1a4[_0xb1de('0x13')]){if(_0x1fb1a4['error']['code']===0x1f4){logger[_0xb1de('0x13')](_0xb1de('0xf'),_0x3a37cf,_0x1fb1a4[_0xb1de('0x13')][_0xb1de('0x14')]);return _0x274f4(_0x1fb1a4[_0xb1de('0x13')]['message']);}logger['error'](_0xb1de('0xf'),_0x3a37cf,_0x1fb1a4['error']['message']);return _0x42a73f(_0x1fb1a4[_0xb1de('0x13')][_0xb1de('0x14')]);}else{logger[_0xb1de('0xe')](_0xb1de('0xf'),_0x3a37cf,_0xb1de('0x11'));_0x42a73f(_0x1fb1a4[_0xb1de('0x15')]['message']);}})[_0xb1de('0x16')](function(_0x3a1e2c){logger['error'](_0xb1de('0xf'),_0x3a37cf,_0x3a1e2c);_0x274f4(_0x3a1e2c);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 130f716..d444159 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 _0x8599=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id'];(function(_0x5ec8be,_0x1280c5){var _0x5a4ff2=function(_0x57fe6e){while(--_0x57fe6e){_0x5ec8be['push'](_0x5ec8be['shift']());}};_0x5a4ff2(++_0x1280c5);}(_0x8599,0xbc));var _0x9859=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8599[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9859('0x0'));var util=require(_0x9859('0x1'));var path=require(_0x9859('0x2'));var timeout=require(_0x9859('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9859('0x4'));var interaction=require(_0x9859('0x5'));var config=require(_0x9859('0x6'));var controller=require(_0x9859('0x7'));router[_0x9859('0x8')]('/',auth[_0x9859('0x9')](),controller[_0x9859('0xa')]);router['get'](_0x9859('0xb'),auth[_0x9859('0x9')](),controller[_0x9859('0xc')]);router[_0x9859('0xd')]('/',auth['isAuthenticated'](),controller[_0x9859('0xe')]);router[_0x9859('0xf')]('/:id',auth[_0x9859('0x9')](),controller[_0x9859('0x10')]);router[_0x9859('0x11')](_0x9859('0xb'),auth[_0x9859('0x9')](),controller[_0x9859('0x12')]);module[_0x9859('0x13')]=router; \ No newline at end of file +var _0x4976=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4976,0x110));var _0x6497=function(_0xb0fb2e,_0x191466){_0xb0fb2e=_0xb0fb2e-0x0;var _0x3c90a4=_0x4976[_0xb0fb2e];return _0x3c90a4;};'use strict';var multer=require('multer');var util=require(_0x6497('0x0'));var path=require(_0x6497('0x1'));var timeout=require('connect-timeout');var express=require(_0x6497('0x2'));var router=express[_0x6497('0x3')]();var auth=require(_0x6497('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6497('0x5'));var controller=require(_0x6497('0x6'));router[_0x6497('0x7')]('/',auth[_0x6497('0x8')](),controller[_0x6497('0x9')]);router['get'](_0x6497('0xa'),auth[_0x6497('0x8')](),controller[_0x6497('0xb')]);router[_0x6497('0xc')]('/',auth[_0x6497('0x8')](),controller[_0x6497('0xd')]);router[_0x6497('0xe')](_0x6497('0xa'),auth['isAuthenticated'](),controller[_0x6497('0xf')]);router[_0x6497('0x10')](_0x6497('0xa'),auth[_0x6497('0x8')](),controller[_0x6497('0x11')]);module[_0x6497('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 6c679e0..8481953 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['BOOLEAN','STRING','name'];(function(_0x5497ef,_0x54ae44){var _0x136100=function(_0x516382){while(--_0x516382){_0x5497ef['push'](_0x5497ef['shift']());}};_0x136100(++_0x54ae44);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x5b9f15,_0x16270b){var _0x49ceab=function(_0x132808){while(--_0x132808){_0x5b9f15['push'](_0x5b9f15['shift']());}};_0x49ceab(++_0x16270b);}(_0x34e8,0x12c));var _0x834e=function(_0x2165e6,_0x149f89){_0x2165e6=_0x2165e6-0x0;var _0x4ec5af=_0x34e8[_0x2165e6];return _0x4ec5af;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 05fb327..399a428 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 _0x55ca=['ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','name','index','map','VoiceContext','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','render','chan_sip.so','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x423724,_0x1357d6){var _0x2e960e=function(_0x3d4e6f){while(--_0x3d4e6f){_0x423724['push'](_0x423724['shift']());}};_0x2e960e(++_0x1357d6);}(_0x55ca,0x126));var _0xa55c=function(_0x5ae350,_0x24edc7){_0x5ae350=_0x5ae350-0x0;var _0x4e3073=_0x55ca[_0x5ae350];return _0x4e3073;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var db=require(_0xa55c('0x16'))['db'];var jayson=require(_0xa55c('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2a35be,_0x576044,_0x5a3672){if(_0x5a3672){var _0x59ea8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59ea8d[_0xa55c('0x18')](_0x576044)){return _0x2a35be;}else{throw new db[(_0xa55c('0x19'))][(_0xa55c('0x1a'))](_0xa55c('0x1b'));}}else{return _0x2a35be;}}function respondWithRpcPromise(_0x458480,_0x247e77,_0x4e0b2f,_0x3ccf65){return new BPromise(function(_0x3dcf4f,_0x25934f){var _0x31e10d=_0x3ccf65||client;return _0x31e10d[_0xa55c('0x1c')](_0x458480,_0x4e0b2f)[_0xa55c('0x1d')](function(_0x51590e){logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x247e77,'request\x20sent');logger[_0xa55c('0x20')](_0xa55c('0x21'),_0x247e77,_0xa55c('0x22'),JSON[_0xa55c('0x23')](_0x51590e));if(_0x51590e[_0xa55c('0x24')]){if(_0x51590e[_0xa55c('0x24')]['code']===0x1f4){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x25934f(_0x51590e['error'][_0xa55c('0x25')]);}logger[_0xa55c('0x24')]('VoiceContext,\x20%s,\x20%s',_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x3dcf4f(_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);}else{logger[_0xa55c('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x247e77,_0xa55c('0x22'));_0x3dcf4f(_0x51590e['result']['message']);}})['catch'](function(_0x19ae88){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x19ae88);_0x25934f(_0x19ae88);});});}function respondWithStatusCode(_0x190757,_0x3f64de){_0x3f64de=_0x3f64de||0xcc;return function(_0xf0e574){if(_0xf0e574){return _0x190757[_0xa55c('0x26')](_0x3f64de);}return _0x190757[_0xa55c('0x27')](_0x3f64de)[_0xa55c('0x28')]();};}function respondWithResult(_0x11e7f7,_0x192df2){_0x192df2=_0x192df2||0xc8;return function(_0x3cd152){if(_0x3cd152){return _0x11e7f7[_0xa55c('0x27')](_0x192df2)['json'](_0x3cd152);}};}function respondWithFilteredResult(_0x430d55,_0x28814f){return function(_0x1c9f6b){if(_0x1c9f6b){var _0x906caa=_0x1c9f6b[_0xa55c('0x29')],_0x5d940d=_0x28814f[_0xa55c('0x2a')],_0x1377b0=_0x28814f[_0xa55c('0x2a')]+_0x28814f[_0xa55c('0x2b')],_0x22f6b6;if(_0x1377b0>=_0x906caa){_0x1377b0=_0x906caa;_0x22f6b6=0xc8;}else{_0x22f6b6=0xce;}_0x430d55['status'](_0x22f6b6);return _0x430d55[_0xa55c('0x2c')]('Content-Range',_0x5d940d+'-'+_0x1377b0+'/'+_0x906caa)[_0xa55c('0x2d')](_0x1c9f6b);}return null;};}function patchUpdates(_0x1d730b){return function(_0x1cc53e){try{jsonpatch[_0xa55c('0x2e')](_0x1cc53e,_0x1d730b,!![]);}catch(_0x4d8416){return BPromise[_0xa55c('0x2f')](_0x4d8416);}return _0x1cc53e[_0xa55c('0x30')]();};}function saveUpdates(_0x331e58,_0x20da31){return function(_0x10f4b7){if(_0x10f4b7){return _0x10f4b7[_0xa55c('0x31')](_0x331e58)[_0xa55c('0x1d')](function(_0x24d44d){return _0x24d44d;});}return null;};}function removeEntity(_0x2808e9,_0xcbaf2e){return function(_0x197099){if(_0x197099){return _0x197099['destroy']()['then'](function(){var _0x4146f3=_0x197099[_0xa55c('0x32')]({'plain':!![]});var _0x4932d0=_0xa55c('0x33');return db[_0xa55c('0x34')][_0xa55c('0x35')]({'where':{'type':_0x4932d0,'resourceId':_0x4146f3['id']}})[_0xa55c('0x1d')](function(){return _0x197099;});})[_0xa55c('0x1d')](function(){_0x2808e9[_0xa55c('0x27')](0xcc)[_0xa55c('0x28')]();});}};}function handleEntityNotFound(_0x222d4b,_0x3959e3){return function(_0x53590c){if(!_0x53590c){_0x222d4b['sendStatus'](0x194);}return _0x53590c;};}function handleError(_0x4b23d3,_0x3fd75f){_0x3fd75f=_0x3fd75f||0x1f4;return function(_0x18e00e){logger[_0xa55c('0x24')](_0x18e00e['stack']);if(_0x18e00e[_0xa55c('0x36')]){delete _0x18e00e['name'];}_0x4b23d3[_0xa55c('0x27')](_0x3fd75f)['send'](_0x18e00e);};}exports[_0xa55c('0x37')]=function(_0x39267c,_0x3c0ec1){var _0x4d3eb5={},_0x7c4a47={},_0x30f23b={'count':0x0,'rows':[]};var _0x47e93c=_[_0xa55c('0x38')](db[_0xa55c('0x39')]['rawAttributes'],function(_0x529ff8){return{'name':_0x529ff8[_0xa55c('0x3a')],'type':_0x529ff8['type'][_0xa55c('0x3b')]};});_0x7c4a47[_0xa55c('0x3c')]=_['map'](_0x47e93c,'name');_0x7c4a47['query']=_['keys'](_0x39267c[_0xa55c('0x3d')]);_0x7c4a47[_0xa55c('0x3e')]=_[_0xa55c('0x3f')](_0x7c4a47[_0xa55c('0x3c')],_0x7c4a47[_0xa55c('0x3d')]);_0x4d3eb5['attributes']=_[_0xa55c('0x3f')](_0x7c4a47[_0xa55c('0x3c')],qs[_0xa55c('0x40')](_0x39267c[_0xa55c('0x3d')][_0xa55c('0x40')]));_0x4d3eb5[_0xa55c('0x41')]=_0x4d3eb5['attributes'][_0xa55c('0x42')]?_0x4d3eb5['attributes']:_0x7c4a47['model'];if(!_0x39267c[_0xa55c('0x3d')][_0xa55c('0x43')]('nolimit')){_0x4d3eb5[_0xa55c('0x2b')]=qs['limit'](_0x39267c['query'][_0xa55c('0x2b')]);_0x4d3eb5[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x39267c['query'][_0xa55c('0x2a')]);}_0x4d3eb5[_0xa55c('0x44')]=qs['sort'](_0x39267c[_0xa55c('0x3d')]['sort']);_0x4d3eb5[_0xa55c('0x45')]=qs[_0xa55c('0x3e')](_['pick'](_0x39267c[_0xa55c('0x3d')],_0x7c4a47[_0xa55c('0x3e')]),_0x47e93c);if(_0x39267c['query'][_0xa55c('0x46')]){_0x4d3eb5[_0xa55c('0x45')]=_[_0xa55c('0x47')](_0x4d3eb5['where'],{'$or':_[_0xa55c('0x38')](_0x47e93c,function(_0x582901){if(_0x582901[_0xa55c('0x48')]!==_0xa55c('0x49')){var _0x451269={};_0x451269[_0x582901['name']]={'$like':'%'+_0x39267c[_0xa55c('0x3d')][_0xa55c('0x46')]+'%'};return _0x451269;}})});}_0x4d3eb5=_['merge']({},_0x4d3eb5,_0x39267c[_0xa55c('0x4a')]);var _0x931907={'where':_0x4d3eb5['where']};return db[_0xa55c('0x39')][_0xa55c('0x29')](_0x931907)['then'](function(_0x46f839){_0x30f23b[_0xa55c('0x29')]=_0x46f839;if(_0x39267c[_0xa55c('0x3d')][_0xa55c('0x4b')]){_0x4d3eb5['include']=[{'all':!![]}];}return db[_0xa55c('0x39')]['findAll'](_0x4d3eb5);})[_0xa55c('0x1d')](function(_0x213100){_0x30f23b[_0xa55c('0x4c')]=_0x213100;return _0x30f23b;})['then'](respondWithFilteredResult(_0x3c0ec1,_0x4d3eb5))[_0xa55c('0x4d')](handleError(_0x3c0ec1,null));};exports[_0xa55c('0x4e')]=function(_0x574fe9,_0x5be06){var _0x34de95={'raw':![],'where':{'id':_0x574fe9[_0xa55c('0x4f')]['id']}},_0x3822b7={};_0x3822b7[_0xa55c('0x3c')]=_[_0xa55c('0x50')](db[_0xa55c('0x39')][_0xa55c('0x51')]);_0x3822b7[_0xa55c('0x3d')]=_[_0xa55c('0x50')](_0x574fe9['query']);_0x3822b7[_0xa55c('0x3e')]=_[_0xa55c('0x3f')](_0x3822b7[_0xa55c('0x3c')],_0x3822b7['query']);_0x34de95[_0xa55c('0x41')]=_[_0xa55c('0x3f')](_0x3822b7['model'],qs[_0xa55c('0x40')](_0x574fe9['query'][_0xa55c('0x40')]));_0x34de95[_0xa55c('0x41')]=_0x34de95[_0xa55c('0x41')][_0xa55c('0x42')]?_0x34de95[_0xa55c('0x41')]:_0x3822b7['model'];if(_0x574fe9[_0xa55c('0x3d')][_0xa55c('0x4b')]){_0x34de95['include']=[{'all':!![]}];}_0x34de95=_[_0xa55c('0x47')]({},_0x34de95,_0x574fe9[_0xa55c('0x4a')]);return db[_0xa55c('0x39')][_0xa55c('0x52')](_0x34de95)['then'](handleEntityNotFound(_0x5be06,null))['then'](respondWithResult(_0x5be06,null))[_0xa55c('0x4d')](handleError(_0x5be06,null));};exports[_0xa55c('0x53')]=function(_0x3ca5b8,_0x44ac57,_0x54cbde){var _0x30c0c9;return db['VoiceContext'][_0xa55c('0x53')](_0x3ca5b8[_0xa55c('0x54')],{'raw':!![]})[_0xa55c('0x1d')](function(_0x2ccfb1){_0x30c0c9=_0x2ccfb1;return db[_0xa55c('0x39')]['findAll']({'raw':!![]});})[_0xa55c('0x1d')](function(_0x54f776){var _0x23f67f=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],_0xa55c('0x58')),_0xa55c('0x59'));var _0x5d14e0=ejs['render'](_0x23f67f,{'contexts':_0x54f776||[]});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x5d14e0);})[_0xa55c('0x1d')](function(){return respondWithRpcPromise(_0xa55c('0x5c'),_0xa55c('0x53'),{'module':'chan_sip.so'});})[_0xa55c('0x1d')](function(){var _0x3cd40d=_0x3ca5b8[_0xa55c('0x5d')][_0xa55c('0x32')]({'plain':!![]});if(!_0x3cd40d)throw new Error(_0xa55c('0x5e'));if(_0x3cd40d['role']===_0xa55c('0x5d')){var _0x21725b=_0x30c0c9[_0xa55c('0x32')]({'plain':!![]});return db[_0xa55c('0x5f')][_0xa55c('0x52')]({'where':{'name':'Contexts','userProfileId':_0x3cd40d[_0xa55c('0x60')]},'raw':!![]})['then'](function(_0x2e482a){if(_0x2e482a&&_0x2e482a['autoAssociation']===0x0){return db[_0xa55c('0x34')]['create']({'name':_0x21725b[_0xa55c('0x36')],'resourceId':_0x21725b['id'],'type':_0x2e482a[_0xa55c('0x36')],'sectionId':_0x2e482a['id']},{})[_0xa55c('0x1d')](function(){return _0x30c0c9;});}else{return _0x30c0c9;}})[_0xa55c('0x4d')](function(_0x4cb38c){logger[_0xa55c('0x24')](_0xa55c('0x61'),_0x4cb38c);throw _0x4cb38c;});}return _0x30c0c9;})[_0xa55c('0x1d')](respondWithResult(_0x44ac57,0xc9))[_0xa55c('0x4d')](handleError(_0x44ac57,null));};exports[_0xa55c('0x31')]=function(_0x51c736,_0x150a07,_0x311bb9){var _0x4ef914;return db[_0xa55c('0x39')][_0xa55c('0x52')]({'where':{'id':_0x51c736[_0xa55c('0x4f')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x150a07,null))[_0xa55c('0x1d')](saveUpdates(_0x51c736[_0xa55c('0x54')],null))[_0xa55c('0x1d')](function(_0x202191){if(_0x202191){_0x4ef914=_0x202191;return db['VoiceContext'][_0xa55c('0x62')]({'raw':!![]});}})[_0xa55c('0x1d')](function(_0x39861f){var _0xd309a9=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],_0xa55c('0x58')),_0xa55c('0x59'));var _0x4a08ca=ejs[_0xa55c('0x63')](_0xd309a9,{'contexts':_0x39861f||[]});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x4a08ca);})[_0xa55c('0x1d')](function(){return respondWithRpcPromise(_0xa55c('0x5c'),_0xa55c('0x31'),{'module':_0xa55c('0x64')});})[_0xa55c('0x1d')](function(){return _0x4ef914;})[_0xa55c('0x1d')](respondWithResult(_0x150a07,null))[_0xa55c('0x4d')](handleError(_0x150a07,null));};exports[_0xa55c('0x35')]=function(_0x5c598a,_0xe42233,_0x531eee){var _0x1228a4;return db[_0xa55c('0x39')][_0xa55c('0x52')]({'where':{'id':_0x5c598a['params']['id']}})['then'](handleEntityNotFound(_0xe42233,null))[_0xa55c('0x1d')](removeEntity(_0xe42233,null))[_0xa55c('0x1d')](function(){return db[_0xa55c('0x39')][_0xa55c('0x62')]({'raw':!![]});})['then'](function(_0x149cb9){var _0xd02251=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x3f7fca=ejs[_0xa55c('0x63')](_0xd02251,{'contexts':_0x149cb9});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x3f7fca);return respondWithRpcPromise(_0xa55c('0x5c'),'destroy',{'module':_0xa55c('0x64')});})[_0xa55c('0x4d')](handleError(_0xe42233,null));}; \ No newline at end of file +var _0x3e74=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\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','get','Contexts','UserProfileResource','destroy','stack','name','send','map','VoiceContext','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','includeAll','findAll','show','params','include','find','create','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','server/files/templates/context.ejs','chan_sip.so','render','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'];(function(_0x37f1b9,_0x4d667d){var _0x3efb87=function(_0x517bcb){while(--_0x517bcb){_0x37f1b9['push'](_0x37f1b9['shift']());}};_0x3efb87(++_0x4d667d);}(_0x3e74,0x175));var _0x43e7=function(_0x23f2ea,_0x4e8a98){_0x23f2ea=_0x23f2ea-0x0;var _0x177d54=_0x3e74[_0x23f2ea];return _0x177d54;};'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')]('VoiceContext,\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(){var _0x5e203f=_0x3f280d[_0x43e7('0x31')]({'plain':!![]});var _0xbe6e28=_0x43e7('0x32');return db[_0x43e7('0x33')][_0x43e7('0x34')]({'where':{'type':_0xbe6e28,'resourceId':_0x5e203f['id']}})[_0x43e7('0x1a')](function(){return _0x3f280d;});})['then'](function(){_0x49b83d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e5b2,_0x4e8e86){return function(_0x564f0e){if(!_0x564f0e){_0x59e5b2['sendStatus'](0x194);}return _0x564f0e;};}function handleError(_0x14d888,_0x49cda6){_0x49cda6=_0x49cda6||0x1f4;return function(_0x2b4bfd){logger[_0x43e7('0x20')](_0x2b4bfd[_0x43e7('0x35')]);if(_0x2b4bfd[_0x43e7('0x36')]){delete _0x2b4bfd[_0x43e7('0x36')];}_0x14d888[_0x43e7('0x26')](_0x49cda6)[_0x43e7('0x37')](_0x2b4bfd);};}exports['index']=function(_0x5332d9,_0x5d84f4){var _0xfa0474={},_0xfe70e9={},_0x199ff6={'count':0x0,'rows':[]};var _0x16cdba=_[_0x43e7('0x38')](db[_0x43e7('0x39')][_0x43e7('0x3a')],function(_0x2ffd43){return{'name':_0x2ffd43['fieldName'],'type':_0x2ffd43[_0x43e7('0x3b')][_0x43e7('0x3c')]};});_0xfe70e9['model']=_[_0x43e7('0x38')](_0x16cdba,'name');_0xfe70e9[_0x43e7('0x3d')]=_[_0x43e7('0x3e')](_0x5332d9[_0x43e7('0x3d')]);_0xfe70e9[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],_0xfe70e9['query']);_0xfa0474['attributes']=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x42')]));_0xfa0474['attributes']=_0xfa0474[_0x43e7('0x43')][_0x43e7('0x44')]?_0xfa0474['attributes']:_0xfe70e9[_0x43e7('0x41')];if(!_0x5332d9['query'][_0x43e7('0x45')]('nolimit')){_0xfa0474[_0x43e7('0x2a')]=qs[_0x43e7('0x2a')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x2a')]);_0xfa0474['offset']=qs['offset'](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x29')]);}_0xfa0474[_0x43e7('0x46')]=qs[_0x43e7('0x47')](_0x5332d9['query']['sort']);_0xfa0474['where']=qs[_0x43e7('0x3f')](_['pick'](_0x5332d9[_0x43e7('0x3d')],_0xfe70e9['filters']),_0x16cdba);if(_0x5332d9['query'][_0x43e7('0x48')]){_0xfa0474['where']=_[_0x43e7('0x49')](_0xfa0474[_0x43e7('0x4a')],{'$or':_[_0x43e7('0x38')](_0x16cdba,function(_0x99b9e1){if(_0x99b9e1['type']!==_0x43e7('0x4b')){var _0x2b9046={};_0x2b9046[_0x99b9e1[_0x43e7('0x36')]]={'$like':'%'+_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x48')]+'%'};return _0x2b9046;}})});}_0xfa0474=_[_0x43e7('0x49')]({},_0xfa0474,_0x5332d9['options']);var _0x4930a2={'where':_0xfa0474[_0x43e7('0x4a')]};return db[_0x43e7('0x39')][_0x43e7('0x28')](_0x4930a2)['then'](function(_0x5c1c18){_0x199ff6['count']=_0x5c1c18;if(_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0xfa0474['include']=[{'all':!![]}];}return db[_0x43e7('0x39')][_0x43e7('0x4d')](_0xfa0474);})[_0x43e7('0x1a')](function(_0x560329){_0x199ff6['rows']=_0x560329;return _0x199ff6;})['then'](respondWithFilteredResult(_0x5d84f4,_0xfa0474))['catch'](handleError(_0x5d84f4,null));};exports[_0x43e7('0x4e')]=function(_0xe955fc,_0x52fea5){var _0x23e7cb={'raw':![],'where':{'id':_0xe955fc[_0x43e7('0x4f')]['id']}},_0x82d32f={};_0x82d32f[_0x43e7('0x41')]=_['keys'](db[_0x43e7('0x39')]['rawAttributes']);_0x82d32f['query']=_[_0x43e7('0x3e')](_0xe955fc[_0x43e7('0x3d')]);_0x82d32f[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],_0x82d32f[_0x43e7('0x3d')]);_0x23e7cb[_0x43e7('0x43')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0xe955fc['query'][_0x43e7('0x42')]));_0x23e7cb[_0x43e7('0x43')]=_0x23e7cb['attributes'][_0x43e7('0x44')]?_0x23e7cb['attributes']:_0x82d32f[_0x43e7('0x41')];if(_0xe955fc[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0x23e7cb[_0x43e7('0x50')]=[{'all':!![]}];}_0x23e7cb=_[_0x43e7('0x49')]({},_0x23e7cb,_0xe955fc['options']);return db['VoiceContext'][_0x43e7('0x51')](_0x23e7cb)[_0x43e7('0x1a')](handleEntityNotFound(_0x52fea5,null))[_0x43e7('0x1a')](respondWithResult(_0x52fea5,null))[_0x43e7('0x24')](handleError(_0x52fea5,null));};exports[_0x43e7('0x52')]=function(_0x25bb44,_0xa47464,_0x44f8a0){var _0x26d86c;return db[_0x43e7('0x39')][_0x43e7('0x52')](_0x25bb44['body'],{'raw':!![]})[_0x43e7('0x1a')](function(_0x2da2f3){_0x26d86c=_0x2da2f3;return db['VoiceContext'][_0x43e7('0x4d')]({'raw':!![]});})[_0x43e7('0x1a')](function(_0x2d0052){var _0x558d54=fs['readFileSync'](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x54506d=ejs['render'](_0x558d54,{'contexts':_0x2d0052||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x54506d);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x52'),{'module':'chan_sip.so'});})[_0x43e7('0x1a')](function(){var _0xdb9fbe=_0x25bb44['user'][_0x43e7('0x31')]({'plain':!![]});if(!_0xdb9fbe)throw new Error(_0x43e7('0x59'));if(_0xdb9fbe[_0x43e7('0x5a')]==='user'){var _0x5a4c95=_0x26d86c['get']({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x51')]({'where':{'name':_0x43e7('0x32'),'userProfileId':_0xdb9fbe[_0x43e7('0x5c')]},'raw':!![]})['then'](function(_0x5a50fc){if(_0x5a50fc&&_0x5a50fc[_0x43e7('0x5d')]===0x0){return db[_0x43e7('0x33')][_0x43e7('0x52')]({'name':_0x5a4c95[_0x43e7('0x36')],'resourceId':_0x5a4c95['id'],'type':_0x5a50fc['name'],'sectionId':_0x5a50fc['id']},{})[_0x43e7('0x1a')](function(){return _0x26d86c;});}else{return _0x26d86c;}})[_0x43e7('0x24')](function(_0x23595c){logger[_0x43e7('0x20')](_0x43e7('0x5e'),_0x23595c);throw _0x23595c;});}return _0x26d86c;})[_0x43e7('0x1a')](respondWithResult(_0xa47464,0xc9))[_0x43e7('0x24')](handleError(_0xa47464,null));};exports[_0x43e7('0x30')]=function(_0x406155,_0x381208,_0x252f00){var _0x57fdfe;return db['VoiceContext'][_0x43e7('0x51')]({'where':{'id':_0x406155['params']['id']}})['then'](handleEntityNotFound(_0x381208,null))['then'](saveUpdates(_0x406155[_0x43e7('0x5f')],null))[_0x43e7('0x1a')](function(_0x5d7b37){if(_0x5d7b37){_0x57fdfe=_0x5d7b37;return db[_0x43e7('0x39')][_0x43e7('0x4d')]({'raw':!![]});}})[_0x43e7('0x1a')](function(_0x537a53){var _0x2b7406=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],_0x43e7('0x61')),_0x43e7('0x55'));var _0x1e02fa=ejs['render'](_0x2b7406,{'contexts':_0x537a53||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x1e02fa);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x43e7('0x62')});})['then'](function(){return _0x57fdfe;})['then'](respondWithResult(_0x381208,null))[_0x43e7('0x24')](handleError(_0x381208,null));};exports[_0x43e7('0x34')]=function(_0x5b5833,_0x88c7f,_0x28b21d){var _0x1e2fed;return db[_0x43e7('0x39')][_0x43e7('0x51')]({'where':{'id':_0x5b5833[_0x43e7('0x4f')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x88c7f,null))['then'](removeEntity(_0x88c7f,null))[_0x43e7('0x1a')](function(){return db[_0x43e7('0x39')]['findAll']({'raw':!![]});})[_0x43e7('0x1a')](function(_0x5c2c5f){var _0x26ee52=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x2646c2=ejs[_0x43e7('0x63')](_0x26ee52,{'contexts':_0x5c2c5f});fs['writeFileSync'](_0x43e7('0x57'),_0x2646c2);return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x34'),{'module':_0x43e7('0x62')});})[_0x43e7('0x24')](handleError(_0x88c7f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 795f082..3eb714a 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3a89ce,_0x15f9da){var _0x1cacc6=function(_0x5ec551){while(--_0x5ec551){_0x3a89ce['push'](_0x3a89ce['shift']());}};_0x1cacc6(++_0x15f9da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 4ab6e05..5477270 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 _0xc026=['debug','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent'];(function(_0x47cb15,_0x30289e){var _0xa62dbe=function(_0x3250ff){while(--_0x3250ff){_0x47cb15['push'](_0x47cb15['shift']());}};_0xa62dbe(++_0x30289e);}(_0xc026,0x111));var _0x6c02=function(_0x3ac035,_0x40f232){_0x3ac035=_0x3ac035-0x0;var _0x4f9c43=_0xc026[_0x3ac035];return _0x4f9c43;};'use strict';var _=require('lodash');var util=require(_0x6c02('0x0'));var moment=require(_0x6c02('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c02('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c02('0x3'))['db'];var utils=require(_0x6c02('0x4'));var logger=require(_0x6c02('0x5'))(_0x6c02('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6c02('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc39db0,_0x42976c,_0x10c8de){return new BPromise(function(_0x28ab72,_0x1458c3){return client[_0x6c02('0x8')](_0xc39db0,_0x10c8de)['then'](function(_0x4198f3){logger[_0x6c02('0x9')](_0x6c02('0xa'),_0x42976c,_0x6c02('0xb'));logger[_0x6c02('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x42976c,_0x6c02('0xb'),JSON[_0x6c02('0xd')](_0x4198f3));if(_0x4198f3['error']){if(_0x4198f3[_0x6c02('0xe')][_0x6c02('0xf')]===0x1f4){logger[_0x6c02('0xe')](_0x6c02('0xa'),_0x42976c,_0x4198f3[_0x6c02('0xe')]['message']);return _0x1458c3(_0x4198f3['error']['message']);}logger[_0x6c02('0xe')]('VoiceContext,\x20%s,\x20%s',_0x42976c,_0x4198f3[_0x6c02('0xe')][_0x6c02('0x10')]);return _0x28ab72(_0x4198f3[_0x6c02('0xe')][_0x6c02('0x10')]);}else{logger[_0x6c02('0x9')]('VoiceContext,\x20%s,\x20%s',_0x42976c,_0x6c02('0xb'));_0x28ab72(_0x4198f3[_0x6c02('0x11')][_0x6c02('0x10')]);}})[_0x6c02('0x12')](function(_0x443192){logger[_0x6c02('0xe')](_0x6c02('0xa'),_0x42976c,_0x443192);_0x1458c3(_0x443192);});});} \ No newline at end of file +var _0x6de8=['rpc','../../config/environment','jayson/promise','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1f12cf,_0x5aef63){var _0x26227a=function(_0x3110ef){while(--_0x3110ef){_0x1f12cf['push'](_0x1f12cf['shift']());}};_0x26227a(++_0x5aef63);}(_0x6de8,0x126));var _0x86de=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x6de8[_0x3a607e];return _0x37b106;};'use strict';var _=require('lodash');var util=require(_0x86de('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x86de('0x1'));var fs=require('fs');var Redis=require(_0x86de('0x2'));var db=require(_0x86de('0x3'))['db'];var utils=require(_0x86de('0x4'));var logger=require(_0x86de('0x5'))(_0x86de('0x6'));var config=require(_0x86de('0x7'));var jayson=require(_0x86de('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4663c9,_0x54eb9d,_0x5039b3){return new BPromise(function(_0x131456,_0x53862f){return client[_0x86de('0x9')](_0x4663c9,_0x5039b3)[_0x86de('0xa')](function(_0x3cc2dd){logger['info'](_0x86de('0xb'),_0x54eb9d,'request\x20sent');logger[_0x86de('0xc')](_0x86de('0xd'),_0x54eb9d,_0x86de('0xe'),JSON[_0x86de('0xf')](_0x3cc2dd));if(_0x3cc2dd[_0x86de('0x10')]){if(_0x3cc2dd[_0x86de('0x10')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x54eb9d,_0x3cc2dd[_0x86de('0x10')][_0x86de('0x11')]);return _0x53862f(_0x3cc2dd['error'][_0x86de('0x11')]);}logger[_0x86de('0x10')](_0x86de('0xb'),_0x54eb9d,_0x3cc2dd[_0x86de('0x10')][_0x86de('0x11')]);return _0x131456(_0x3cc2dd[_0x86de('0x10')]['message']);}else{logger['info'](_0x86de('0xb'),_0x54eb9d,_0x86de('0xe'));_0x131456(_0x3cc2dd[_0x86de('0x12')][_0x86de('0x11')]);}})[_0x86de('0x13')](function(_0x8c04b1){logger['error'](_0x86de('0xb'),_0x54eb9d,_0x8c04b1);_0x53862f(_0x8c04b1);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index ea52845..c83d6f9 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 _0x399c=['./voiceDialReport.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23c2a1,_0x4e8bb6){var _0x49896f=function(_0x49d387){while(--_0x49d387){_0x23c2a1['push'](_0x23c2a1['shift']());}};_0x49896f(++_0x4e8bb6);}(_0x399c,0x7c));var _0xc399=function(_0x3cdbe0,_0x14e477){_0x3cdbe0=_0x3cdbe0-0x0;var _0x151269=_0x399c[_0x3cdbe0];return _0x151269;};'use strict';var multer=require(_0xc399('0x0'));var util=require(_0xc399('0x1'));var path=require(_0xc399('0x2'));var timeout=require(_0xc399('0x3'));var express=require(_0xc399('0x4'));var router=express[_0xc399('0x5')]();var auth=require(_0xc399('0x6'));var interaction=require(_0xc399('0x7'));var config=require(_0xc399('0x8'));var controller=require(_0xc399('0x9'));router[_0xc399('0xa')]('/',auth[_0xc399('0xb')](),controller['index']);router[_0xc399('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc399('0xa')](_0xc399('0xc'),auth[_0xc399('0xb')](),controller[_0xc399('0xd')]);router[_0xc399('0xe')]('/',auth[_0xc399('0xb')](),controller[_0xc399('0xf')]);router['put']('/:id',auth[_0xc399('0xb')](),controller[_0xc399('0x10')]);router[_0xc399('0x11')](_0xc399('0xc'),auth[_0xc399('0xb')](),controller[_0xc399('0x12')]);module['exports']=router; \ No newline at end of file +var _0x6caf=['exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0xa115c0,_0x50ce1b){var _0x4bc842=function(_0x348250){while(--_0x348250){_0xa115c0['push'](_0xa115c0['shift']());}};_0x4bc842(++_0x50ce1b);}(_0x6caf,0x17d));var _0xf6ca=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x6caf[_0x18abd2];return _0x1dcad6;};'use strict';var multer=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var path=require('path');var timeout=require(_0xf6ca('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf6ca('0x3'));var interaction=require(_0xf6ca('0x4'));var config=require(_0xf6ca('0x5'));var controller=require(_0xf6ca('0x6'));router[_0xf6ca('0x7')]('/',auth[_0xf6ca('0x8')](),controller[_0xf6ca('0x9')]);router[_0xf6ca('0x7')]('/describe',auth[_0xf6ca('0x8')](),controller[_0xf6ca('0xa')]);router['get'](_0xf6ca('0xb'),auth[_0xf6ca('0x8')](),controller[_0xf6ca('0xc')]);router[_0xf6ca('0xd')]('/',auth['isAuthenticated'](),controller[_0xf6ca('0xe')]);router[_0xf6ca('0xf')](_0xf6ca('0xb'),auth['isAuthenticated'](),controller[_0xf6ca('0x10')]);router[_0xf6ca('0x11')](_0xf6ca('0xb'),auth[_0xf6ca('0x8')](),controller['destroy']);module[_0xf6ca('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 65085d1..7de4aac 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 _0x61f2=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0x61f2,0xbb));var _0x261f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f2[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x261f('0x0'));module[_0x261f('0x1')]={'privilege':{'type':Sequelize[_0x261f('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x261f('0x3')]},'channelstatedesc':{'type':Sequelize[_0x261f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x261f('0x2')]},'connectedlinename':{'type':Sequelize[_0x261f('0x2')]},'language':{'type':Sequelize[_0x261f('0x2')]},'accountcode':{'type':Sequelize[_0x261f('0x2')]},'context':{'type':Sequelize[_0x261f('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x261f('0x3')]},'uniqueid':{'type':Sequelize[_0x261f('0x2')]},'linkedid':{'type':Sequelize[_0x261f('0x2')]},'destchannel':{'type':Sequelize[_0x261f('0x2')]},'destchannelstate':{'type':Sequelize[_0x261f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x261f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x261f('0x2')]},'destcalleridname':{'type':Sequelize[_0x261f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x261f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x261f('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x261f('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x261f('0x2')]},'destpriority':{'type':Sequelize[_0x261f('0x3')]},'destuniqueid':{'type':Sequelize[_0x261f('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x261f('0x4')]},'answertime':{'type':Sequelize[_0x261f('0x4')]},'endtime':{'type':Sequelize[_0x261f('0x4')]},'lastevent':{'type':Sequelize[_0x261f('0x2')],'comment':_0x261f('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x261f('0x3')]},'holdtime':{'type':Sequelize[_0x261f('0x3')]},'billableseconds':{'type':Sequelize[_0x261f('0x3')]}}; \ No newline at end of file +var _0x8ae5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3cf1dc,_0x1d3274){var _0xb97c58=function(_0x1460d7){while(--_0x1460d7){_0x3cf1dc['push'](_0x3cf1dc['shift']());}};_0xb97c58(++_0x1d3274);}(_0x8ae5,0x73));var _0x58ae=function(_0x457501,_0x9eacca){_0x457501=_0x457501-0x0;var _0x47ab95=_0x8ae5[_0x457501];return _0x47ab95;};'use strict';var Sequelize=require(_0x58ae('0x0'));module[_0x58ae('0x1')]={'privilege':{'type':Sequelize[_0x58ae('0x2')]},'channel':{'type':Sequelize[_0x58ae('0x2')]},'channelstate':{'type':Sequelize[_0x58ae('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x58ae('0x2')]},'connectedlinenum':{'type':Sequelize[_0x58ae('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x58ae('0x2')]},'accountcode':{'type':Sequelize[_0x58ae('0x2')]},'context':{'type':Sequelize[_0x58ae('0x2')]},'exten':{'type':Sequelize[_0x58ae('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x58ae('0x2')]},'linkedid':{'type':Sequelize[_0x58ae('0x2')]},'destchannel':{'type':Sequelize[_0x58ae('0x2')]},'destchannelstate':{'type':Sequelize[_0x58ae('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x58ae('0x2')]},'destcalleridnum':{'type':Sequelize[_0x58ae('0x2')]},'destcalleridname':{'type':Sequelize[_0x58ae('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x58ae('0x2')]},'destlanguage':{'type':Sequelize[_0x58ae('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x58ae('0x2')]},'destexten':{'type':Sequelize[_0x58ae('0x2')]},'destpriority':{'type':Sequelize[_0x58ae('0x3')]},'destuniqueid':{'type':Sequelize[_0x58ae('0x2')]},'destlinkedid':{'type':Sequelize[_0x58ae('0x2')]},'dialstring':{'type':Sequelize[_0x58ae('0x2')]},'dialstatus':{'type':Sequelize[_0x58ae('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x58ae('0x4')]},'endtime':{'type':Sequelize[_0x58ae('0x4')]},'lastevent':{'type':Sequelize[_0x58ae('0x2')],'comment':_0x58ae('0x5')},'routeId':{'type':Sequelize[_0x58ae('0x3')]},'duration':{'type':Sequelize[_0x58ae('0x3')]},'holdtime':{'type':Sequelize[_0x58ae('0x3')]},'billableseconds':{'type':Sequelize[_0x58ae('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 333f7a3..109f8c6 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 _0x2a3a=['show','params','length','includeAll','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','name','send','map','VoiceDialReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','type','options','include','findAll','rows','catch'];(function(_0x15984e,_0x419d99){var _0x17428c=function(_0x472fae){while(--_0x472fae){_0x15984e['push'](_0x15984e['shift']());}};_0x17428c(++_0x419d99);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x343083,_0x1f88da){_0x343083=_0x343083-0x0;var _0x28560b=_0x2a3a[_0x343083];return _0x28560b;};'use strict';var pdf=require(_0xa2a3('0x0'));var emlformat=require(_0xa2a3('0x1'));var rimraf=require(_0xa2a3('0x2'));var zipdir=require(_0xa2a3('0x3'));var jsonpatch=require(_0xa2a3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa2a3('0x5'));var Mustache=require(_0xa2a3('0x6'));var util=require(_0xa2a3('0x7'));var path=require(_0xa2a3('0x8'));var sox=require(_0xa2a3('0x9'));var csv=require(_0xa2a3('0xa'));var ejs=require(_0xa2a3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa2a3('0xc'));var crypto=require(_0xa2a3('0xd'));var jsforce=require(_0xa2a3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa2a3('0xf'));var Redis=require(_0xa2a3('0x10'));var authService=require(_0xa2a3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa2a3('0x12'));var hardwareService=require(_0xa2a3('0x13'));var logger=require(_0xa2a3('0x14'))(_0xa2a3('0x15'));var utils=require(_0xa2a3('0x16'));var config=require('../../config/environment');var db=require(_0xa2a3('0x17'))['db'];function respondWithStatusCode(_0x49870e,_0x80ac46){_0x80ac46=_0x80ac46||0xcc;return function(_0x3cf976){if(_0x3cf976){return _0x49870e['sendStatus'](_0x80ac46);}return _0x49870e[_0xa2a3('0x18')](_0x80ac46)[_0xa2a3('0x19')]();};}function respondWithResult(_0x2030c9,_0x45da20){_0x45da20=_0x45da20||0xc8;return function(_0x3ebb1b){if(_0x3ebb1b){return _0x2030c9[_0xa2a3('0x18')](_0x45da20)[_0xa2a3('0x1a')](_0x3ebb1b);}};}function respondWithFilteredResult(_0x4e21e5,_0xe91715){return function(_0x481505){if(_0x481505){var _0x507ff7=_0x481505[_0xa2a3('0x1b')],_0x3debd2=_0xe91715[_0xa2a3('0x1c')],_0x239716=_0xe91715['offset']+_0xe91715[_0xa2a3('0x1d')],_0x19c3c5;if(_0x239716>=_0x507ff7){_0x239716=_0x507ff7;_0x19c3c5=0xc8;}else{_0x19c3c5=0xce;}_0x4e21e5[_0xa2a3('0x18')](_0x19c3c5);return _0x4e21e5[_0xa2a3('0x1e')](_0xa2a3('0x1f'),_0x3debd2+'-'+_0x239716+'/'+_0x507ff7)[_0xa2a3('0x1a')](_0x481505);}return null;};}function patchUpdates(_0x4f4494){return function(_0x258d57){try{jsonpatch[_0xa2a3('0x20')](_0x258d57,_0x4f4494,!![]);}catch(_0x3d2231){return BPromise[_0xa2a3('0x21')](_0x3d2231);}return _0x258d57['save']();};}function saveUpdates(_0x40a787,_0x13bf25){return function(_0x1e36b6){if(_0x1e36b6){return _0x1e36b6['update'](_0x40a787)[_0xa2a3('0x22')](function(_0x487a20){return _0x487a20;});}return null;};}function removeEntity(_0x2d8478,_0x10ddae){return function(_0x37330c){if(_0x37330c){return _0x37330c[_0xa2a3('0x23')]()[_0xa2a3('0x22')](function(){_0x2d8478[_0xa2a3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x419d77,_0x164c13){return function(_0x203644){if(!_0x203644){_0x419d77[_0xa2a3('0x24')](0x194);}return _0x203644;};}function handleError(_0x120e1a,_0x42086f){_0x42086f=_0x42086f||0x1f4;return function(_0x414d74){logger[_0xa2a3('0x25')](_0x414d74['stack']);if(_0x414d74[_0xa2a3('0x26')]){delete _0x414d74['name'];}_0x120e1a[_0xa2a3('0x18')](_0x42086f)[_0xa2a3('0x27')](_0x414d74);};}exports['index']=function(_0x347824,_0x2edd1e){var _0xddf7cb={},_0x350d43={},_0x16d5c0={'count':0x0,'rows':[]};var _0x2cb498=_[_0xa2a3('0x28')](db[_0xa2a3('0x29')][_0xa2a3('0x2a')],function(_0x26c058){return{'name':_0x26c058[_0xa2a3('0x2b')],'type':_0x26c058['type'][_0xa2a3('0x2c')]};});_0x350d43['model']=_[_0xa2a3('0x28')](_0x2cb498,_0xa2a3('0x26'));_0x350d43[_0xa2a3('0x2d')]=_[_0xa2a3('0x2e')](_0x347824[_0xa2a3('0x2d')]);_0x350d43[_0xa2a3('0x2f')]=_[_0xa2a3('0x30')](_0x350d43[_0xa2a3('0x31')],_0x350d43[_0xa2a3('0x2d')]);_0xddf7cb['attributes']=_[_0xa2a3('0x30')](_0x350d43['model'],qs[_0xa2a3('0x32')](_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x32')]));_0xddf7cb['attributes']=_0xddf7cb[_0xa2a3('0x33')]['length']?_0xddf7cb[_0xa2a3('0x33')]:_0x350d43['model'];if(!_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x34')]('nolimit')){_0xddf7cb['limit']=qs[_0xa2a3('0x1d')](_0x347824['query'][_0xa2a3('0x1d')]);_0xddf7cb[_0xa2a3('0x1c')]=qs['offset'](_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x1c')]);}_0xddf7cb[_0xa2a3('0x35')]=qs['sort'](_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x36')]);_0xddf7cb[_0xa2a3('0x37')]=qs['filters'](_['pick'](_0x347824[_0xa2a3('0x2d')],_0x350d43[_0xa2a3('0x2f')]),_0x2cb498);if(_0x347824[_0xa2a3('0x2d')][_0xa2a3('0x38')]){_0xddf7cb[_0xa2a3('0x37')]=_[_0xa2a3('0x39')](_0xddf7cb['where'],{'$or':_[_0xa2a3('0x28')](_0x2cb498,function(_0x193cf2){if(_0x193cf2[_0xa2a3('0x3a')]!=='VIRTUAL'){var _0x12a674={};_0x12a674[_0x193cf2['name']]={'$like':'%'+_0x347824[_0xa2a3('0x2d')]['filter']+'%'};return _0x12a674;}})});}_0xddf7cb=_[_0xa2a3('0x39')]({},_0xddf7cb,_0x347824[_0xa2a3('0x3b')]);var _0x78b28e={'where':_0xddf7cb[_0xa2a3('0x37')]};return db[_0xa2a3('0x29')][_0xa2a3('0x1b')](_0x78b28e)[_0xa2a3('0x22')](function(_0x488323){_0x16d5c0[_0xa2a3('0x1b')]=_0x488323;if(_0x347824['query']['includeAll']){_0xddf7cb[_0xa2a3('0x3c')]=[{'all':!![]}];}return db[_0xa2a3('0x29')][_0xa2a3('0x3d')](_0xddf7cb);})[_0xa2a3('0x22')](function(_0x2599cf){_0x16d5c0[_0xa2a3('0x3e')]=_0x2599cf;return _0x16d5c0;})[_0xa2a3('0x22')](respondWithFilteredResult(_0x2edd1e,_0xddf7cb))[_0xa2a3('0x3f')](handleError(_0x2edd1e,null));};exports[_0xa2a3('0x40')]=function(_0x13e28a,_0x584229){var _0x2e74c7={'raw':!![],'where':{'id':_0x13e28a[_0xa2a3('0x41')]['id']}},_0x228f79={};_0x228f79[_0xa2a3('0x31')]=_[_0xa2a3('0x2e')](db[_0xa2a3('0x29')][_0xa2a3('0x2a')]);_0x228f79[_0xa2a3('0x2d')]=_['keys'](_0x13e28a[_0xa2a3('0x2d')]);_0x228f79[_0xa2a3('0x2f')]=_[_0xa2a3('0x30')](_0x228f79[_0xa2a3('0x31')],_0x228f79['query']);_0x2e74c7[_0xa2a3('0x33')]=_[_0xa2a3('0x30')](_0x228f79[_0xa2a3('0x31')],qs[_0xa2a3('0x32')](_0x13e28a[_0xa2a3('0x2d')][_0xa2a3('0x32')]));_0x2e74c7[_0xa2a3('0x33')]=_0x2e74c7[_0xa2a3('0x33')][_0xa2a3('0x42')]?_0x2e74c7[_0xa2a3('0x33')]:_0x228f79[_0xa2a3('0x31')];if(_0x13e28a['query'][_0xa2a3('0x43')]){_0x2e74c7[_0xa2a3('0x3c')]=[{'all':!![]}];}_0x2e74c7=_['merge']({},_0x2e74c7,_0x13e28a[_0xa2a3('0x3b')]);return db[_0xa2a3('0x29')][_0xa2a3('0x44')](_0x2e74c7)[_0xa2a3('0x22')](handleEntityNotFound(_0x584229,null))[_0xa2a3('0x22')](respondWithResult(_0x584229,null))[_0xa2a3('0x3f')](handleError(_0x584229,null));};exports[_0xa2a3('0x45')]=function(_0x191525,_0x4c3534){return db[_0xa2a3('0x29')][_0xa2a3('0x45')](_0x191525[_0xa2a3('0x46')],{})['then'](respondWithResult(_0x4c3534,0xc9))['catch'](handleError(_0x4c3534,null));};exports[_0xa2a3('0x47')]=function(_0x1d40a5,_0x52586c){if(_0x1d40a5['body']['id']){delete _0x1d40a5[_0xa2a3('0x46')]['id'];}return db[_0xa2a3('0x29')][_0xa2a3('0x44')]({'where':{'id':_0x1d40a5[_0xa2a3('0x41')]['id']}})[_0xa2a3('0x22')](handleEntityNotFound(_0x52586c,null))[_0xa2a3('0x22')](saveUpdates(_0x1d40a5['body'],null))[_0xa2a3('0x22')](respondWithResult(_0x52586c,null))['catch'](handleError(_0x52586c,null));};exports['destroy']=function(_0x462f30,_0x5754ea){return db[_0xa2a3('0x29')][_0xa2a3('0x44')]({'where':{'id':_0x462f30[_0xa2a3('0x41')]['id']}})['then'](handleEntityNotFound(_0x5754ea,null))[_0xa2a3('0x22')](removeEntity(_0x5754ea,null))[_0xa2a3('0x3f')](handleError(_0x5754ea,null));};exports[_0xa2a3('0x48')]=function(_0x305e27,_0x5475f3){return db[_0xa2a3('0x29')][_0xa2a3('0x48')]()[_0xa2a3('0x22')](respondWithResult(_0x5475f3,null))[_0xa2a3('0x3f')](handleError(_0x5475f3,null));}; \ No newline at end of file +var _0xec6b=['order','sort','filters','pick','filter','where','map','type','merge','options','include','findAll','catch','show','params','find','create','body','update','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','then','end','sendStatus','stack','name','index','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0xec6b,0x129));var _0xbec6=function(_0x2a5241,_0x23ad00){_0x2a5241=_0x2a5241-0x0;var _0xa36a0a=_0xec6b[_0x2a5241];return _0xa36a0a;};'use strict';var pdf=require(_0xbec6('0x0'));var emlformat=require(_0xbec6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbec6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbec6('0x3'));var moment=require('moment');var BPromise=require(_0xbec6('0x4'));var Mustache=require(_0xbec6('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbec6('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbec6('0x7'));var toCsv=require(_0xbec6('0x8'));var querystring=require(_0xbec6('0x9'));var Papa=require(_0xbec6('0xa'));var Redis=require(_0xbec6('0xb'));var authService=require(_0xbec6('0xc'));var qs=require(_0xbec6('0xd'));var as=require(_0xbec6('0xe'));var hardwareService=require(_0xbec6('0xf'));var logger=require(_0xbec6('0x10'))(_0xbec6('0x11'));var utils=require(_0xbec6('0x12'));var config=require('../../config/environment');var db=require(_0xbec6('0x13'))['db'];function respondWithStatusCode(_0x4a28bf,_0x27cb5c){_0x27cb5c=_0x27cb5c||0xcc;return function(_0x204245){if(_0x204245){return _0x4a28bf['sendStatus'](_0x27cb5c);}return _0x4a28bf[_0xbec6('0x14')](_0x27cb5c)['end']();};}function respondWithResult(_0x3f0bf2,_0x5b88b4){_0x5b88b4=_0x5b88b4||0xc8;return function(_0x335972){if(_0x335972){return _0x3f0bf2['status'](_0x5b88b4)[_0xbec6('0x15')](_0x335972);}};}function respondWithFilteredResult(_0xe54bd,_0x276e74){return function(_0x169cee){if(_0x169cee){var _0x52b5f3=_0x169cee[_0xbec6('0x16')],_0x15461c=_0x276e74[_0xbec6('0x17')],_0x4b70b3=_0x276e74[_0xbec6('0x17')]+_0x276e74[_0xbec6('0x18')],_0x786c76;if(_0x4b70b3>=_0x52b5f3){_0x4b70b3=_0x52b5f3;_0x786c76=0xc8;}else{_0x786c76=0xce;}_0xe54bd['status'](_0x786c76);return _0xe54bd[_0xbec6('0x19')](_0xbec6('0x1a'),_0x15461c+'-'+_0x4b70b3+'/'+_0x52b5f3)['json'](_0x169cee);}return null;};}function patchUpdates(_0x440234){return function(_0x3853c6){try{jsonpatch[_0xbec6('0x1b')](_0x3853c6,_0x440234,!![]);}catch(_0x13ab13){return BPromise['reject'](_0x13ab13);}return _0x3853c6[_0xbec6('0x1c')]();};}function saveUpdates(_0x1b5003,_0x1ee928){return function(_0x26529c){if(_0x26529c){return _0x26529c['update'](_0x1b5003)[_0xbec6('0x1d')](function(_0x2bbf14){return _0x2bbf14;});}return null;};}function removeEntity(_0x132439,_0x5835db){return function(_0x3163c0){if(_0x3163c0){return _0x3163c0['destroy']()[_0xbec6('0x1d')](function(){_0x132439[_0xbec6('0x14')](0xcc)[_0xbec6('0x1e')]();});}};}function handleEntityNotFound(_0x404d91,_0x1d882a){return function(_0x44574e){if(!_0x44574e){_0x404d91[_0xbec6('0x1f')](0x194);}return _0x44574e;};}function handleError(_0x435f80,_0x4048ea){_0x4048ea=_0x4048ea||0x1f4;return function(_0x1adda5){logger['error'](_0x1adda5[_0xbec6('0x20')]);if(_0x1adda5[_0xbec6('0x21')]){delete _0x1adda5['name'];}_0x435f80[_0xbec6('0x14')](_0x4048ea)['send'](_0x1adda5);};}exports[_0xbec6('0x22')]=function(_0x3da858,_0x218039){var _0x3dfa27={},_0x450b5f={},_0x216ae3={'count':0x0,'rows':[]};var _0x3c92ae=_['map'](db[_0xbec6('0x23')][_0xbec6('0x24')],function(_0x3ef4da){return{'name':_0x3ef4da[_0xbec6('0x25')],'type':_0x3ef4da['type'][_0xbec6('0x26')]};});_0x450b5f[_0xbec6('0x27')]=_['map'](_0x3c92ae,_0xbec6('0x21'));_0x450b5f[_0xbec6('0x28')]=_[_0xbec6('0x29')](_0x3da858[_0xbec6('0x28')]);_0x450b5f['filters']=_[_0xbec6('0x2a')](_0x450b5f['model'],_0x450b5f[_0xbec6('0x28')]);_0x3dfa27['attributes']=_['intersection'](_0x450b5f[_0xbec6('0x27')],qs[_0xbec6('0x2b')](_0x3da858['query']['fields']));_0x3dfa27[_0xbec6('0x2c')]=_0x3dfa27[_0xbec6('0x2c')][_0xbec6('0x2d')]?_0x3dfa27[_0xbec6('0x2c')]:_0x450b5f[_0xbec6('0x27')];if(!_0x3da858['query'][_0xbec6('0x2e')](_0xbec6('0x2f'))){_0x3dfa27[_0xbec6('0x18')]=qs['limit'](_0x3da858[_0xbec6('0x28')][_0xbec6('0x18')]);_0x3dfa27[_0xbec6('0x17')]=qs[_0xbec6('0x17')](_0x3da858['query'][_0xbec6('0x17')]);}_0x3dfa27[_0xbec6('0x30')]=qs[_0xbec6('0x31')](_0x3da858[_0xbec6('0x28')][_0xbec6('0x31')]);_0x3dfa27['where']=qs[_0xbec6('0x32')](_[_0xbec6('0x33')](_0x3da858['query'],_0x450b5f[_0xbec6('0x32')]),_0x3c92ae);if(_0x3da858['query'][_0xbec6('0x34')]){_0x3dfa27[_0xbec6('0x35')]=_['merge'](_0x3dfa27[_0xbec6('0x35')],{'$or':_[_0xbec6('0x36')](_0x3c92ae,function(_0xec6e5b){if(_0xec6e5b[_0xbec6('0x37')]!=='VIRTUAL'){var _0x4b1951={};_0x4b1951[_0xec6e5b[_0xbec6('0x21')]]={'$like':'%'+_0x3da858[_0xbec6('0x28')][_0xbec6('0x34')]+'%'};return _0x4b1951;}})});}_0x3dfa27=_[_0xbec6('0x38')]({},_0x3dfa27,_0x3da858[_0xbec6('0x39')]);var _0x5addda={'where':_0x3dfa27[_0xbec6('0x35')]};return db[_0xbec6('0x23')][_0xbec6('0x16')](_0x5addda)[_0xbec6('0x1d')](function(_0x2a5224){_0x216ae3['count']=_0x2a5224;if(_0x3da858[_0xbec6('0x28')]['includeAll']){_0x3dfa27[_0xbec6('0x3a')]=[{'all':!![]}];}return db[_0xbec6('0x23')][_0xbec6('0x3b')](_0x3dfa27);})[_0xbec6('0x1d')](function(_0xb1b4a9){_0x216ae3['rows']=_0xb1b4a9;return _0x216ae3;})[_0xbec6('0x1d')](respondWithFilteredResult(_0x218039,_0x3dfa27))[_0xbec6('0x3c')](handleError(_0x218039,null));};exports[_0xbec6('0x3d')]=function(_0x1b2057,_0x3c2297){var _0x102c47={'raw':!![],'where':{'id':_0x1b2057[_0xbec6('0x3e')]['id']}},_0x4013d2={};_0x4013d2[_0xbec6('0x27')]=_[_0xbec6('0x29')](db[_0xbec6('0x23')]['rawAttributes']);_0x4013d2[_0xbec6('0x28')]=_[_0xbec6('0x29')](_0x1b2057[_0xbec6('0x28')]);_0x4013d2[_0xbec6('0x32')]=_[_0xbec6('0x2a')](_0x4013d2['model'],_0x4013d2['query']);_0x102c47['attributes']=_[_0xbec6('0x2a')](_0x4013d2['model'],qs['fields'](_0x1b2057[_0xbec6('0x28')][_0xbec6('0x2b')]));_0x102c47[_0xbec6('0x2c')]=_0x102c47[_0xbec6('0x2c')]['length']?_0x102c47[_0xbec6('0x2c')]:_0x4013d2[_0xbec6('0x27')];if(_0x1b2057['query']['includeAll']){_0x102c47['include']=[{'all':!![]}];}_0x102c47=_[_0xbec6('0x38')]({},_0x102c47,_0x1b2057[_0xbec6('0x39')]);return db[_0xbec6('0x23')][_0xbec6('0x3f')](_0x102c47)['then'](handleEntityNotFound(_0x3c2297,null))['then'](respondWithResult(_0x3c2297,null))[_0xbec6('0x3c')](handleError(_0x3c2297,null));};exports[_0xbec6('0x40')]=function(_0x20dad2,_0x5f2a5e){return db[_0xbec6('0x23')][_0xbec6('0x40')](_0x20dad2[_0xbec6('0x41')],{})['then'](respondWithResult(_0x5f2a5e,0xc9))['catch'](handleError(_0x5f2a5e,null));};exports[_0xbec6('0x42')]=function(_0x239a23,_0xebe2fe){if(_0x239a23['body']['id']){delete _0x239a23[_0xbec6('0x41')]['id'];}return db[_0xbec6('0x23')][_0xbec6('0x3f')]({'where':{'id':_0x239a23[_0xbec6('0x3e')]['id']}})[_0xbec6('0x1d')](handleEntityNotFound(_0xebe2fe,null))['then'](saveUpdates(_0x239a23['body'],null))['then'](respondWithResult(_0xebe2fe,null))['catch'](handleError(_0xebe2fe,null));};exports[_0xbec6('0x43')]=function(_0x78db93,_0x3cd36f){return db[_0xbec6('0x23')][_0xbec6('0x3f')]({'where':{'id':_0x78db93['params']['id']}})[_0xbec6('0x1d')](handleEntityNotFound(_0x3cd36f,null))[_0xbec6('0x1d')](removeEntity(_0x3cd36f,null))['catch'](handleError(_0x3cd36f,null));};exports[_0xbec6('0x44')]=function(_0x13f02b,_0x42b9e8){return db['VoiceDialReport'][_0xbec6('0x44')]()['then'](respondWithResult(_0x42b9e8,null))[_0xbec6('0x3c')](handleError(_0x42b9e8,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0b170fe..6d50c2f 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 _0xe262=['uniqueid','lodash','api','moment','bluebird','request-promise','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x2783e9,_0x1c55f4){var _0x35f85e=function(_0x5606eb){while(--_0x5606eb){_0x2783e9['push'](_0x2783e9['shift']());}};_0x35f85e(++_0x1c55f4);}(_0xe262,0x1d5));var _0x2e26=function(_0x147b8a,_0x2a12c5){_0x147b8a=_0x147b8a-0x0;var _0xf842f=_0xe262[_0x147b8a];return _0xf842f;};'use strict';var _=require(_0x2e26('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2e26('0x1'));var moment=require(_0x2e26('0x2'));var BPromise=require(_0x2e26('0x3'));var rp=require(_0x2e26('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e26('0x5'));var config=require('../../config/environment');var attributes=require(_0x2e26('0x6'));module[_0x2e26('0x7')]=function(_0x343043,_0x3ec8a8){return _0x343043[_0x2e26('0x8')](_0x2e26('0x9'),attributes,{'tableName':_0x2e26('0xa'),'paranoid':![],'indexes':[{'fields':[_0x2e26('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x06e1=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid','../../config/logger','moment'];(function(_0x8e64ac,_0xb3a3a4){var _0x20005c=function(_0xa711d0){while(--_0xa711d0){_0x8e64ac['push'](_0x8e64ac['shift']());}};_0x20005c(++_0xb3a3a4);}(_0x06e1,0x76));var _0x106e=function(_0x34bb5d,_0x5bac4e){_0x34bb5d=_0x34bb5d-0x0;var _0x5cd2d2=_0x06e1[_0x34bb5d];return _0x5cd2d2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x106e('0x0'))('api');var moment=require(_0x106e('0x1'));var BPromise=require('bluebird');var rp=require(_0x106e('0x2'));var fs=require('fs');var path=require(_0x106e('0x3'));var rimraf=require(_0x106e('0x4'));var config=require(_0x106e('0x5'));var attributes=require(_0x106e('0x6'));module['exports']=function(_0x16c6e9,_0x93c581){return _0x16c6e9['define'](_0x106e('0x7'),attributes,{'tableName':_0x106e('0x8'),'paranoid':![],'indexes':[{'fields':[_0x106e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index e86167e..c69c2f7 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 _0x0f9f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','body','options','raw','CreateVoiceDialReport','VoiceDialReport','update','UpdateVoiceDialReport','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0xd8b89f,_0x6312f4){_0xd8b89f=_0xd8b89f-0x0;var _0x3c6e90=_0x0f9f[_0xd8b89f];return _0x3c6e90;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));var BPromise=require(_0xf0f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f9('0x3'));var db=require(_0xf0f9('0x4'))['db'];var utils=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var config=require(_0xf0f9('0x8'));var jayson=require(_0xf0f9('0x9'));var client=jayson[_0xf0f9('0xa')][_0xf0f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45694e,_0x51a0ed,_0x448cf5){return new BPromise(function(_0x294b42,_0x5d1753){return client[_0xf0f9('0xc')](_0x45694e,_0x448cf5)[_0xf0f9('0xd')](function(_0x2d72c9){logger['info'](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));logger[_0xf0f9('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x51a0ed,'request\x20sent',JSON[_0xf0f9('0x11')](_0x2d72c9));if(_0x2d72c9[_0xf0f9('0x12')]){if(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x13')]===0x1f4){logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x5d1753(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x294b42(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}else{logger[_0xf0f9('0x15')](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));_0x294b42(_0x2d72c9[_0xf0f9('0x16')][_0xf0f9('0x14')]);}})[_0xf0f9('0x17')](function(_0x677b32){logger[_0xf0f9('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x51a0ed,_0x677b32);_0x5d1753(_0x677b32);});});}exports['CreateVoiceDialReport']=function(_0x350a48){var _0x3227cf=this;return new Promise(function(_0x4c4e17,_0x178e16){return db['VoiceDialReport']['create'](_0x350a48[_0xf0f9('0x18')],{'raw':_0x350a48[_0xf0f9('0x19')]?_0x350a48[_0xf0f9('0x19')][_0xf0f9('0x1a')]===undefined?!![]:![]:!![]})[_0xf0f9('0xd')](function(_0x4ed9ff){logger['info']('CreateVoiceDialReport',_0x350a48);logger[_0xf0f9('0x10')](_0xf0f9('0x1b'),_0x350a48,JSON[_0xf0f9('0x11')](_0x4ed9ff));_0x4c4e17(_0x4ed9ff);})['catch'](function(_0x4a8726){logger[_0xf0f9('0x12')]('CreateVoiceDialReport',_0x4a8726[_0xf0f9('0x14')],_0x350a48);_0x178e16(_0x3227cf[_0xf0f9('0x12')](0x1f4,_0x4a8726[_0xf0f9('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x33dfca){var _0x1061ca=this;return new Promise(function(_0xa4f459,_0x49a2dd){return db[_0xf0f9('0x1c')][_0xf0f9('0x1d')](_0x33dfca[_0xf0f9('0x18')],{'raw':_0x33dfca[_0xf0f9('0x19')]?_0x33dfca[_0xf0f9('0x19')][_0xf0f9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33dfca['options']?_0x33dfca[_0xf0f9('0x19')]['where']||null:null,'attributes':_0x33dfca[_0xf0f9('0x19')]?_0x33dfca[_0xf0f9('0x19')]['attributes']||null:null,'limit':_0x33dfca['options']?_0x33dfca[_0xf0f9('0x19')]['limit']||null:null})[_0xf0f9('0xd')](function(_0x3f236e){logger[_0xf0f9('0x15')](_0xf0f9('0x1e'),_0x33dfca);logger[_0xf0f9('0x10')](_0xf0f9('0x1e'),_0x33dfca,JSON[_0xf0f9('0x11')](_0x3f236e));_0xa4f459(_0x3f236e);})[_0xf0f9('0x17')](function(_0x37c093){logger['error'](_0xf0f9('0x1e'),_0x37c093[_0xf0f9('0x14')],_0x33dfca);_0x49a2dd(_0x1061ca['error'](0x1f4,_0x37c093['message']));});});}; \ No newline at end of file +var _0x00bb=['../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VoiceDialReport','body','options','then','CreateVoiceDialReport','update','raw','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','randomstring'];(function(_0x18fb2a,_0x3a3142){var _0x32a9db=function(_0x3d57ee){while(--_0x3d57ee){_0x18fb2a['push'](_0x18fb2a['shift']());}};_0x32a9db(++_0x3a3142);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});}exports['CreateVoiceDialReport']=function(_0x2a7231){var _0x599347=this;return new Promise(function(_0x415f91,_0x5aa9a0){return db[_0xb00b('0x12')]['create'](_0x2a7231[_0xb00b('0x13')],{'raw':_0x2a7231[_0xb00b('0x14')]?_0x2a7231['options']['raw']===undefined?!![]:![]:!![]})[_0xb00b('0x15')](function(_0x4a334b){logger[_0xb00b('0x9')](_0xb00b('0x16'),_0x2a7231);logger[_0xb00b('0xc')](_0xb00b('0x16'),_0x2a7231,JSON['stringify'](_0x4a334b));_0x415f91(_0x4a334b);})[_0xb00b('0x11')](function(_0x4df284){logger[_0xb00b('0xf')](_0xb00b('0x16'),_0x4df284['message'],_0x2a7231);_0x5aa9a0(_0x599347[_0xb00b('0xf')](0x1f4,_0x4df284[_0xb00b('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x3ab3cc){var _0x1f04d3=this;return new Promise(function(_0x5568bb,_0x44efe5){return db[_0xb00b('0x12')][_0xb00b('0x17')](_0x3ab3cc[_0xb00b('0x13')],{'raw':_0x3ab3cc['options']?_0x3ab3cc['options'][_0xb00b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ab3cc['options']?_0x3ab3cc['options']['where']||null:null,'attributes':_0x3ab3cc[_0xb00b('0x14')]?_0x3ab3cc[_0xb00b('0x14')][_0xb00b('0x19')]||null:null,'limit':_0x3ab3cc[_0xb00b('0x14')]?_0x3ab3cc[_0xb00b('0x14')][_0xb00b('0x1a')]||null:null})[_0xb00b('0x15')](function(_0x4a8d2b){logger[_0xb00b('0x9')]('UpdateVoiceDialReport',_0x3ab3cc);logger[_0xb00b('0xc')](_0xb00b('0x1b'),_0x3ab3cc,JSON[_0xb00b('0xe')](_0x4a8d2b));_0x5568bb(_0x4a8d2b);})['catch'](function(_0x2fc11a){logger[_0xb00b('0xf')](_0xb00b('0x1b'),_0x2fc11a[_0xb00b('0x10')],_0x3ab3cc);_0x44efe5(_0x1f04d3[_0xb00b('0xf')](0x1f4,_0x2fc11a[_0xb00b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ae71bc0..5451691 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 _0xbd79=['./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xbd79,0x1af));var _0x9bd7=function(_0x5aee17,_0x7859ca){_0x5aee17=_0x5aee17-0x0;var _0x1c4ba=_0xbd79[_0x5aee17];return _0x1c4ba;};'use strict';var multer=require(_0x9bd7('0x0'));var util=require(_0x9bd7('0x1'));var path=require(_0x9bd7('0x2'));var timeout=require(_0x9bd7('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9bd7('0x4'));var interaction=require(_0x9bd7('0x5'));var config=require('../../config/environment');var controller=require(_0x9bd7('0x6'));router[_0x9bd7('0x7')]('/',auth[_0x9bd7('0x8')](),controller[_0x9bd7('0x9')]);router['get'](_0x9bd7('0xa'),auth[_0x9bd7('0x8')](),controller['show']);router[_0x9bd7('0xb')]('/',auth[_0x9bd7('0x8')](),controller[_0x9bd7('0xc')]);router[_0x9bd7('0xb')](_0x9bd7('0xd'),auth[_0x9bd7('0x8')](),controller[_0x9bd7('0xe')]);router[_0x9bd7('0xf')]('/:id',auth[_0x9bd7('0x8')](),controller[_0x9bd7('0x10')]);router['delete'](_0x9bd7('0xa'),auth[_0x9bd7('0x8')](),controller[_0x9bd7('0x11')]);module[_0x9bd7('0x12')]=router; \ No newline at end of file +var _0xbd33=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0xbd33,0x155));var _0x3bd3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd33[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3bd3('0x0'));var util=require('util');var path=require(_0x3bd3('0x1'));var timeout=require('connect-timeout');var express=require(_0x3bd3('0x2'));var router=express[_0x3bd3('0x3')]();var auth=require(_0x3bd3('0x4'));var interaction=require(_0x3bd3('0x5'));var config=require('../../config/environment');var controller=require(_0x3bd3('0x6'));router[_0x3bd3('0x7')]('/',auth[_0x3bd3('0x8')](),controller['index']);router['get'](_0x3bd3('0x9'),auth[_0x3bd3('0x8')](),controller[_0x3bd3('0xa')]);router[_0x3bd3('0xb')]('/',auth['isAuthenticated'](),controller[_0x3bd3('0xc')]);router['post'](_0x3bd3('0xd'),auth[_0x3bd3('0x8')](),controller[_0x3bd3('0xe')]);router[_0x3bd3('0xf')](_0x3bd3('0x9'),auth[_0x3bd3('0x8')](),controller[_0x3bd3('0x10')]);router[_0x3bd3('0x11')](_0x3bd3('0x9'),auth[_0x3bd3('0x8')](),controller[_0x3bd3('0x12')]);module[_0x3bd3('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 21735e0..44f9769 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(_0x3aad93,_0x57e40e){var _0x5b181a=function(_0x4c8386){while(--_0x4c8386){_0x3aad93['push'](_0x3aad93['shift']());}};_0x5b181a(++_0x57e40e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x501fd6,_0x25c9d4){var _0x5aeb89=function(_0x10caa7){while(--_0x10caa7){_0x501fd6['push'](_0x501fd6['shift']());}};_0x5aeb89(++_0x25c9d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 ae82c27..8fba076 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 _0x7a54=['then','get','inbound','outbound','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','error','name','index','VoiceExtension','rawAttributes','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','rows','catch','show','params','keys','includeAll','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','UserProfileSection','userProfileId','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x7a54,0x106));var _0x47a5=function(_0x1bf128,_0x4e61f2){_0x1bf128=_0x1bf128-0x0;var _0x4a365c=_0x7a54[_0x1bf128];return _0x4a365c;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){var _0x129ce5=_0x28747d[_0x47a5('0x27')]({'plain':!![]});var _0x50bf17=[{'name':'InboundRoutes','value':_0x47a5('0x28'),'ignore':![]},{'name':'OutboundRoutes','value':_0x47a5('0x29'),'ignore':![]},{'name':'InternalRoutes','value':_0x47a5('0x2a'),'ignore':![]}];var _0x378208=_(_0x50bf17)[_0x47a5('0x2b')](_0x47a5('0x2c'))[_0x47a5('0x2d')](_0x47a5('0x2e'))[_0x47a5('0x2e')]();if(_[_0x47a5('0x2f')](_0x378208,_0x129ce5[_0x47a5('0x30')])){return;}var _0x361bfa=_[_0x47a5('0x31')](_0x50bf17,[_0x47a5('0x2e'),_0x129ce5[_0x47a5('0x30')]])['name'];return db[_0x47a5('0x32')]['destroy']({'where':{'type':_0x361bfa,'resourceId':_0x129ce5['id']}})[_0x47a5('0x26')](function(){return _0x28747d;});})[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256650,_0x625952){return function(_0x39b50b){if(!_0x39b50b){_0x256650[_0x47a5('0x1a')](0x194);}return _0x39b50b;};}function handleError(_0x51cc81,_0x50d875){_0x50d875=_0x50d875||0x1f4;return function(_0x6f9a12){logger[_0x47a5('0x33')](_0x6f9a12['stack']);if(_0x6f9a12['name']){delete _0x6f9a12[_0x47a5('0x34')];}_0x51cc81[_0x47a5('0x1c')](_0x50d875)['send'](_0x6f9a12);};}exports[_0x47a5('0x35')]=function(_0x53119b,_0x122ed6){var _0xd972c={},_0x5c5162={},_0x4843c0={'count':0x0,'rows':[]};var _0x274e34=_['map'](db[_0x47a5('0x36')][_0x47a5('0x37')],function(_0xf269a8){return{'name':_0xf269a8['fieldName'],'type':_0xf269a8[_0x47a5('0x30')]['key']};});_0x5c5162['model']=_[_0x47a5('0x2d')](_0x274e34,'name');_0x5c5162[_0x47a5('0x38')]=_['keys'](_0x53119b[_0x47a5('0x38')]);_0x5c5162[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5c5162[_0x47a5('0x3b')],_0x5c5162[_0x47a5('0x38')]);_0xd972c[_0x47a5('0x3c')]=_[_0x47a5('0x3a')](_0x5c5162[_0x47a5('0x3b')],qs[_0x47a5('0x3d')](_0x53119b['query'][_0x47a5('0x3d')]));_0xd972c[_0x47a5('0x3c')]=_0xd972c['attributes'][_0x47a5('0x3e')]?_0xd972c[_0x47a5('0x3c')]:_0x5c5162[_0x47a5('0x3b')];if(!_0x53119b['query'][_0x47a5('0x3f')](_0x47a5('0x40'))){_0xd972c['limit']=qs[_0x47a5('0x1f')](_0x53119b[_0x47a5('0x38')]['limit']);_0xd972c['offset']=qs['offset'](_0x53119b[_0x47a5('0x38')]['offset']);}_0xd972c[_0x47a5('0x41')]=qs[_0x47a5('0x42')](_0x53119b[_0x47a5('0x38')][_0x47a5('0x42')]);_0xd972c[_0x47a5('0x43')]=qs[_0x47a5('0x39')](_[_0x47a5('0x44')](_0x53119b[_0x47a5('0x38')],_0x5c5162[_0x47a5('0x39')]),_0x274e34);if(_0x53119b[_0x47a5('0x38')][_0x47a5('0x2b')]){_0xd972c[_0x47a5('0x43')]=_[_0x47a5('0x45')](_0xd972c['where'],{'$or':_[_0x47a5('0x2d')](_0x274e34,function(_0x1c36fa){if(_0x1c36fa[_0x47a5('0x30')]!==_0x47a5('0x46')){var _0x586f4f={};_0x586f4f[_0x1c36fa[_0x47a5('0x34')]]={'$like':'%'+_0x53119b['query']['filter']+'%'};return _0x586f4f;}})});}_0xd972c=_['merge']({},_0xd972c,_0x53119b['options']);var _0x27dd5d={'where':_0xd972c['where']};return db[_0x47a5('0x36')][_0x47a5('0x1d')](_0x27dd5d)[_0x47a5('0x26')](function(_0x494526){_0x4843c0[_0x47a5('0x1d')]=_0x494526;if(_0x53119b[_0x47a5('0x38')]['includeAll']){_0xd972c['include']=[{'all':!![]}];}return db[_0x47a5('0x36')]['findAll'](_0xd972c);})[_0x47a5('0x26')](function(_0x4703b2){_0x4843c0[_0x47a5('0x47')]=_0x4703b2;return _0x4843c0;})[_0x47a5('0x26')](respondWithFilteredResult(_0x122ed6,_0xd972c))[_0x47a5('0x48')](handleError(_0x122ed6,null));};exports[_0x47a5('0x49')]=function(_0x434227,_0x17cc42){var _0xac9c15={'raw':![],'where':{'id':_0x434227[_0x47a5('0x4a')]['id']}},_0x162fa0={};_0x162fa0[_0x47a5('0x3b')]=_[_0x47a5('0x4b')](db[_0x47a5('0x36')][_0x47a5('0x37')]);_0x162fa0[_0x47a5('0x38')]=_['keys'](_0x434227[_0x47a5('0x38')]);_0x162fa0[_0x47a5('0x39')]=_['intersection'](_0x162fa0['model'],_0x162fa0[_0x47a5('0x38')]);_0xac9c15['attributes']=_[_0x47a5('0x3a')](_0x162fa0[_0x47a5('0x3b')],qs['fields'](_0x434227['query'][_0x47a5('0x3d')]));_0xac9c15['attributes']=_0xac9c15[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0xac9c15[_0x47a5('0x3c')]:_0x162fa0[_0x47a5('0x3b')];if(_0x434227[_0x47a5('0x38')][_0x47a5('0x4c')]){_0xac9c15[_0x47a5('0x4d')]=[{'all':!![]}];}_0xac9c15=_['merge']({},_0xac9c15,_0x434227['options']);return db[_0x47a5('0x36')][_0x47a5('0x31')](_0xac9c15)[_0x47a5('0x26')](handleEntityNotFound(_0x17cc42,null))[_0x47a5('0x26')](respondWithResult(_0x17cc42,null))[_0x47a5('0x48')](handleError(_0x17cc42,null));};exports[_0x47a5('0x25')]=function(_0x249de5,_0x492cf7){return db[_0x47a5('0x36')][_0x47a5('0x31')]({'where':{'id':_0x249de5[_0x47a5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x492cf7,null))[_0x47a5('0x26')](removeEntity(_0x492cf7,null))['catch'](handleError(_0x492cf7,null));};exports[_0x47a5('0x4e')]=function(_0xe31817,_0x46e90b){if(_0xe31817[_0x47a5('0x4f')]['type']===_0x47a5('0x29')&&!_[_0x47a5('0x50')](_0xe31817[_0x47a5('0x4f')][_0x47a5('0x51')],'_')){_0xe31817[_0x47a5('0x4f')][_0x47a5('0x51')]='_'[_0x47a5('0x52')](_0xe31817['body'][_0x47a5('0x51')]);}return db[_0x47a5('0x36')][_0x47a5('0x4e')](_0xe31817[_0x47a5('0x4f')],{'raw':![]})[_0x47a5('0x26')](function(_0x1ab0bf){var _0x572233=_0xe31817[_0x47a5('0x53')][_0x47a5('0x27')]({'plain':!![]});if(!_0x572233)throw new Error(_0x47a5('0x54'));if(_0x572233['role']===_0x47a5('0x53')){var _0x3c78b7=_0x1ab0bf[_0x47a5('0x27')]({'plain':!![]});var _0x5d8d4a=[{'name':'InboundRoutes','value':_0x47a5('0x28')},{'name':_0x47a5('0x55'),'value':'outbound'},{'name':'InternalRoutes','value':_0x47a5('0x2a')}];var _0x4d6a82=_[_0x47a5('0x31')](_0x5d8d4a,['value',_0x3c78b7['type']])[_0x47a5('0x34')];return db[_0x47a5('0x56')]['find']({'where':{'name':_0x4d6a82,'userProfileId':_0x572233[_0x47a5('0x57')]},'raw':!![]})[_0x47a5('0x26')](function(_0x4b706a){if(_0x4b706a&&_0x4b706a['autoAssociation']===0x0){return db[_0x47a5('0x32')][_0x47a5('0x4e')]({'name':_0x3c78b7[_0x47a5('0x34')],'resourceId':_0x3c78b7['id'],'type':_0x4b706a[_0x47a5('0x34')],'sectionId':_0x4b706a['id']},{})['then'](function(){return _0x1ab0bf;});}else{return _0x1ab0bf;}})[_0x47a5('0x48')](function(_0x2b4255){logger[_0x47a5('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4255);throw _0x2b4255;});}return _0x1ab0bf;})[_0x47a5('0x26')](respondWithResult(_0x46e90b,0xc9))['catch'](handleError(_0x46e90b,null));};exports[_0x47a5('0x24')]=function(_0x470da6,_0x943a15){if(_0x470da6[_0x47a5('0x4f')]['id']){delete _0x470da6[_0x47a5('0x4f')]['id'];}return db['VoiceExtension'][_0x47a5('0x31')]({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))['then'](function(_0x4f8564){if(_0x4f8564){return db[_0x47a5('0x36')][_0x47a5('0x24')](_[_0x47a5('0x44')](_0x470da6['body'],['exten',_0x47a5('0x58'),_0x47a5('0x59'),_0x47a5('0x5a'),_0x47a5('0x5b'),_0x47a5('0x5c')]),{'where':{'context':_0x4f8564['context'],'exten':_0x4f8564[_0x47a5('0x51')]},'individualHooks':!![]})['then'](function(_0x22c886){return _0x22c886;});}return null;})[_0x47a5('0x26')](respondWithStatusCode(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports[_0x47a5('0x5d')]=function(_0x345104,_0x132854,_0x3e8274){return db[_0x47a5('0x36')][_0x47a5('0x5e')]({'where':{'id':_0x345104[_0x47a5('0x4a')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x132854,null))['then'](function(_0x2dcc3b){if(_0x2dcc3b){return db[_0x47a5('0x5f')][_0x47a5('0x60')](function(_0x26e7fc){return db[_0x47a5('0x36')]['destroy']({'where':{'VoiceExtensionId':_0x345104[_0x47a5('0x4a')]['id']},'transaction':_0x26e7fc})[_0x47a5('0x26')](function(_0x1224bc){var _0x144aaa=_[_0x47a5('0x2d')](_0x345104[_0x47a5('0x4f')],function(_0x453191){_0x453191[_0x47a5('0x61')]=_0x345104[_0x47a5('0x4a')]['id'];return _0x453191;});return db[_0x47a5('0x36')][_0x47a5('0x62')](_0x144aaa,{'transaction':_0x26e7fc});});})[_0x47a5('0x26')](function(){return db[_0x47a5('0x36')][_0x47a5('0x63')]({'where':{'isApp':!![],'VoiceExtensionId':_0x345104[_0x47a5('0x4a')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x47a5('0x26')](respondWithResult(_0x132854,null))[_0x47a5('0x48')](handleError(_0x132854,null));}; \ No newline at end of file +var _0xef0f=['hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','params','include','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','count','offset','limit','set','Content-Range','reject','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0xbb8bdf,_0x4a78aa){var _0x14660b=function(_0x40fee6){while(--_0x40fee6){_0xbb8bdf['push'](_0xbb8bdf['shift']());}};_0x14660b(++_0x4a78aa);}(_0xef0f,0x168));var _0xfef0=function(_0x5aba58,_0x446d7d){_0x5aba58=_0x5aba58-0x0;var _0x4024eb=_0xef0f[_0x5aba58];return _0x4024eb;};'use strict';var pdf=require(_0xfef0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfef0('0x1'));var zipdir=require(_0xfef0('0x2'));var jsonpatch=require(_0xfef0('0x3'));var rp=require('request-promise');var moment=require(_0xfef0('0x4'));var BPromise=require(_0xfef0('0x5'));var Mustache=require(_0xfef0('0x6'));var util=require('util');var path=require(_0xfef0('0x7'));var sox=require(_0xfef0('0x8'));var csv=require(_0xfef0('0x9'));var ejs=require(_0xfef0('0xa'));var fs=require('fs');var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x9'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var db=require(_0xfef0('0x19'))['db'];config[_0xfef0('0x1a')]=_['defaults'](config[_0xfef0('0x1a')],{'host':_0xfef0('0x1b'),'port':0x18eb});var socket=require(_0xfef0('0x1c'))(new Redis(config[_0xfef0('0x1a')]));require(_0xfef0('0x1d'))[_0xfef0('0x1e')](socket);function respondWithStatusCode(_0xa9f040,_0x573ae7){_0x573ae7=_0x573ae7||0xcc;return function(_0x3d1f02){if(_0x3d1f02){return _0xa9f040['sendStatus'](_0x573ae7);}return _0xa9f040['status'](_0x573ae7)['end']();};}function respondWithResult(_0x118b8d,_0x284b6d){_0x284b6d=_0x284b6d||0xc8;return function(_0x3510a7){if(_0x3510a7){return _0x118b8d[_0xfef0('0x1f')](_0x284b6d)[_0xfef0('0x20')](_0x3510a7);}};}function respondWithFilteredResult(_0x3f9a6c,_0x155833){return function(_0x2887e6){if(_0x2887e6){var _0x581459=_0x2887e6[_0xfef0('0x21')],_0xd60678=_0x155833[_0xfef0('0x22')],_0x1642cd=_0x155833['offset']+_0x155833[_0xfef0('0x23')],_0x1577fa;if(_0x1642cd>=_0x581459){_0x1642cd=_0x581459;_0x1577fa=0xc8;}else{_0x1577fa=0xce;}_0x3f9a6c['status'](_0x1577fa);return _0x3f9a6c[_0xfef0('0x24')](_0xfef0('0x25'),_0xd60678+'-'+_0x1642cd+'/'+_0x581459)[_0xfef0('0x20')](_0x2887e6);}return null;};}function patchUpdates(_0x48408a){return function(_0x2be956){try{jsonpatch['apply'](_0x2be956,_0x48408a,!![]);}catch(_0x4074b7){return BPromise[_0xfef0('0x26')](_0x4074b7);}return _0x2be956['save']();};}function saveUpdates(_0x4897af,_0x4b8b22){return function(_0x19fde8){if(_0x19fde8){return _0x19fde8['update'](_0x4897af)[_0xfef0('0x27')](function(_0x46b34a){return _0x46b34a;});}return null;};}function removeEntity(_0x1a8d66,_0x4483f2){return function(_0x249fe4){if(_0x249fe4){return _0x249fe4[_0xfef0('0x28')]()['then'](function(){var _0x4ac8c5=_0x249fe4[_0xfef0('0x29')]({'plain':!![]});var _0x1ffaa4=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b'),'ignore':![]},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d'),'ignore':![]},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f'),'ignore':![]}];var _0x391279=_(_0x1ffaa4)['filter'](_0xfef0('0x30'))[_0xfef0('0x31')](_0xfef0('0x32'))[_0xfef0('0x32')]();if(_[_0xfef0('0x33')](_0x391279,_0x4ac8c5[_0xfef0('0x34')])){return;}var _0x3e3c4c=_[_0xfef0('0x35')](_0x1ffaa4,[_0xfef0('0x32'),_0x4ac8c5[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x37')]['destroy']({'where':{'type':_0x3e3c4c,'resourceId':_0x4ac8c5['id']}})[_0xfef0('0x27')](function(){return _0x249fe4;});})['then'](function(){_0x1a8d66['status'](0xcc)[_0xfef0('0x38')]();});}};}function handleEntityNotFound(_0x2ae54a,_0x4a481d){return function(_0x4bbdba){if(!_0x4bbdba){_0x2ae54a['sendStatus'](0x194);}return _0x4bbdba;};}function handleError(_0x4f65cd,_0x4cce8a){_0x4cce8a=_0x4cce8a||0x1f4;return function(_0x417535){logger[_0xfef0('0x39')](_0x417535[_0xfef0('0x3a')]);if(_0x417535['name']){delete _0x417535['name'];}_0x4f65cd['status'](_0x4cce8a)[_0xfef0('0x3b')](_0x417535);};}exports['index']=function(_0x215032,_0x3783f9){var _0x1b9f39={},_0x4a2773={},_0x3cad13={'count':0x0,'rows':[]};var _0x4c3a0f=_[_0xfef0('0x31')](db[_0xfef0('0x3c')][_0xfef0('0x3d')],function(_0xe5188e){return{'name':_0xe5188e[_0xfef0('0x3e')],'type':_0xe5188e[_0xfef0('0x34')][_0xfef0('0x3f')]};});_0x4a2773[_0xfef0('0x40')]=_['map'](_0x4c3a0f,_0xfef0('0x36'));_0x4a2773[_0xfef0('0x41')]=_[_0xfef0('0x42')](_0x215032[_0xfef0('0x41')]);_0x4a2773[_0xfef0('0x43')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],_0x4a2773[_0xfef0('0x41')]);_0x1b9f39[_0xfef0('0x45')]=_[_0xfef0('0x44')](_0x4a2773[_0xfef0('0x40')],qs[_0xfef0('0x46')](_0x215032[_0xfef0('0x41')]['fields']));_0x1b9f39[_0xfef0('0x45')]=_0x1b9f39['attributes'][_0xfef0('0x47')]?_0x1b9f39[_0xfef0('0x45')]:_0x4a2773[_0xfef0('0x40')];if(!_0x215032['query'][_0xfef0('0x48')](_0xfef0('0x49'))){_0x1b9f39[_0xfef0('0x23')]=qs['limit'](_0x215032[_0xfef0('0x41')][_0xfef0('0x23')]);_0x1b9f39[_0xfef0('0x22')]=qs['offset'](_0x215032[_0xfef0('0x41')]['offset']);}_0x1b9f39['order']=qs[_0xfef0('0x4a')](_0x215032['query']['sort']);_0x1b9f39[_0xfef0('0x4b')]=qs[_0xfef0('0x43')](_[_0xfef0('0x4c')](_0x215032[_0xfef0('0x41')],_0x4a2773[_0xfef0('0x43')]),_0x4c3a0f);if(_0x215032[_0xfef0('0x41')]['filter']){_0x1b9f39[_0xfef0('0x4b')]=_[_0xfef0('0x4d')](_0x1b9f39['where'],{'$or':_['map'](_0x4c3a0f,function(_0x1d554e){if(_0x1d554e['type']!==_0xfef0('0x4e')){var _0x22c940={};_0x22c940[_0x1d554e[_0xfef0('0x36')]]={'$like':'%'+_0x215032[_0xfef0('0x41')][_0xfef0('0x4f')]+'%'};return _0x22c940;}})});}_0x1b9f39=_[_0xfef0('0x4d')]({},_0x1b9f39,_0x215032[_0xfef0('0x50')]);var _0x15b4a6={'where':_0x1b9f39['where']};return db[_0xfef0('0x3c')]['count'](_0x15b4a6)['then'](function(_0x18c656){_0x3cad13[_0xfef0('0x21')]=_0x18c656;if(_0x215032['query'][_0xfef0('0x51')]){_0x1b9f39['include']=[{'all':!![]}];}return db[_0xfef0('0x3c')][_0xfef0('0x52')](_0x1b9f39);})[_0xfef0('0x27')](function(_0x115e64){_0x3cad13['rows']=_0x115e64;return _0x3cad13;})[_0xfef0('0x27')](respondWithFilteredResult(_0x3783f9,_0x1b9f39))[_0xfef0('0x53')](handleError(_0x3783f9,null));};exports['show']=function(_0x4cafd1,_0x392607){var _0x4f3231={'raw':![],'where':{'id':_0x4cafd1[_0xfef0('0x54')]['id']}},_0x32392a={};_0x32392a[_0xfef0('0x40')]=_[_0xfef0('0x42')](db[_0xfef0('0x3c')][_0xfef0('0x3d')]);_0x32392a['query']=_[_0xfef0('0x42')](_0x4cafd1['query']);_0x32392a['filters']=_[_0xfef0('0x44')](_0x32392a[_0xfef0('0x40')],_0x32392a[_0xfef0('0x41')]);_0x4f3231['attributes']=_[_0xfef0('0x44')](_0x32392a['model'],qs['fields'](_0x4cafd1['query'][_0xfef0('0x46')]));_0x4f3231[_0xfef0('0x45')]=_0x4f3231[_0xfef0('0x45')][_0xfef0('0x47')]?_0x4f3231[_0xfef0('0x45')]:_0x32392a[_0xfef0('0x40')];if(_0x4cafd1[_0xfef0('0x41')][_0xfef0('0x51')]){_0x4f3231[_0xfef0('0x55')]=[{'all':!![]}];}_0x4f3231=_['merge']({},_0x4f3231,_0x4cafd1['options']);return db[_0xfef0('0x3c')][_0xfef0('0x35')](_0x4f3231)[_0xfef0('0x27')](handleEntityNotFound(_0x392607,null))[_0xfef0('0x27')](respondWithResult(_0x392607,null))[_0xfef0('0x53')](handleError(_0x392607,null));};exports[_0xfef0('0x28')]=function(_0x1ec15d,_0x20b647){return db['VoiceExtension'][_0xfef0('0x35')]({'where':{'id':_0x1ec15d[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0x20b647,null))[_0xfef0('0x27')](removeEntity(_0x20b647,null))[_0xfef0('0x53')](handleError(_0x20b647,null));};exports['create']=function(_0x5b3592,_0x523763){if(_0x5b3592[_0xfef0('0x56')][_0xfef0('0x34')]===_0xfef0('0x2d')&&!_[_0xfef0('0x57')](_0x5b3592['body'][_0xfef0('0x58')],'_')){_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]='_'[_0xfef0('0x59')](_0x5b3592[_0xfef0('0x56')][_0xfef0('0x58')]);}return db[_0xfef0('0x3c')]['create'](_0x5b3592[_0xfef0('0x56')],{'raw':![]})[_0xfef0('0x27')](function(_0x47f17a){var _0x291f3f=_0x5b3592['user'][_0xfef0('0x29')]({'plain':!![]});if(!_0x291f3f)throw new Error(_0xfef0('0x5a'));if(_0x291f3f['role']===_0xfef0('0x5b')){var _0x49ec3c=_0x47f17a['get']({'plain':!![]});var _0x4812c7=[{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b')},{'name':_0xfef0('0x2c'),'value':_0xfef0('0x2d')},{'name':_0xfef0('0x2e'),'value':_0xfef0('0x2f')}];var _0x5b5664=_[_0xfef0('0x35')](_0x4812c7,[_0xfef0('0x32'),_0x49ec3c[_0xfef0('0x34')]])[_0xfef0('0x36')];return db[_0xfef0('0x5c')]['find']({'where':{'name':_0x5b5664,'userProfileId':_0x291f3f[_0xfef0('0x5d')]},'raw':!![]})['then'](function(_0x135653){if(_0x135653&&_0x135653['autoAssociation']===0x0){return db[_0xfef0('0x37')][_0xfef0('0x5e')]({'name':_0x49ec3c[_0xfef0('0x36')],'resourceId':_0x49ec3c['id'],'type':_0x135653[_0xfef0('0x36')],'sectionId':_0x135653['id']},{})[_0xfef0('0x27')](function(){return _0x47f17a;});}else{return _0x47f17a;}})['catch'](function(_0x2abdb7){logger['error'](_0xfef0('0x5f'),_0x2abdb7);throw _0x2abdb7;});}return _0x47f17a;})[_0xfef0('0x27')](respondWithResult(_0x523763,0xc9))['catch'](handleError(_0x523763,null));};exports[_0xfef0('0x60')]=function(_0x3c5640,_0xd6de4d){if(_0x3c5640[_0xfef0('0x56')]['id']){delete _0x3c5640[_0xfef0('0x56')]['id'];}return db[_0xfef0('0x3c')][_0xfef0('0x35')]({'where':{'id':_0x3c5640[_0xfef0('0x54')]['id']}})[_0xfef0('0x27')](handleEntityNotFound(_0xd6de4d,null))[_0xfef0('0x27')](function(_0x2acb4e){if(_0x2acb4e){return db[_0xfef0('0x3c')]['update'](_[_0xfef0('0x4c')](_0x3c5640[_0xfef0('0x56')],[_0xfef0('0x58'),_0xfef0('0x61'),_0xfef0('0x62'),'recordingFormat',_0xfef0('0x63'),_0xfef0('0x64')]),{'where':{'context':_0x2acb4e[_0xfef0('0x61')],'exten':_0x2acb4e[_0xfef0('0x58')]},'individualHooks':!![]})[_0xfef0('0x27')](function(_0x1765e2){return _0x1765e2;});}return null;})[_0xfef0('0x27')](respondWithStatusCode(_0xd6de4d,null))[_0xfef0('0x53')](handleError(_0xd6de4d,null));};exports[_0xfef0('0x65')]=function(_0x3f26d9,_0x4f7ad3,_0x100c6a){return db['VoiceExtension'][_0xfef0('0x66')]({'where':{'id':_0x3f26d9[_0xfef0('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f7ad3,null))[_0xfef0('0x27')](function(_0x20c2ec){if(_0x20c2ec){return db[_0xfef0('0x67')][_0xfef0('0x68')](function(_0x1e0ad5){return db['VoiceExtension'][_0xfef0('0x28')]({'where':{'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'transaction':_0x1e0ad5})[_0xfef0('0x27')](function(_0x4f0737){var _0x117b74=_[_0xfef0('0x31')](_0x3f26d9[_0xfef0('0x56')],function(_0x6f759a){_0x6f759a[_0xfef0('0x69')]=_0x3f26d9[_0xfef0('0x54')]['id'];return _0x6f759a;});return db[_0xfef0('0x3c')]['bulkCreate'](_0x117b74,{'transaction':_0x1e0ad5});});})[_0xfef0('0x27')](function(){return db[_0xfef0('0x3c')][_0xfef0('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3f26d9[_0xfef0('0x54')]['id']},'order':_0xfef0('0x6b')});});}})[_0xfef0('0x27')](respondWithResult(_0x4f7ad3,null))['catch'](handleError(_0x4f7ad3,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a6d28b9..573d3d8 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 _0x0d0a=['hook','exports','../../mysqldb','save','remove','emit'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x0d0a,0xda));var _0xa0d0=function(_0x58c67a,_0x1fdf49){_0x58c67a=_0x58c67a-0x0;var _0x2ada00=_0x0d0a[_0x58c67a];return _0x2ada00;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xa0d0('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa0d0('0x1'),'afterUpdate':'update','afterDestroy':_0xa0d0('0x2')};function emitEvent(_0xd07aa9){return function(_0x336927,_0xd15ffc,_0x17e2f5){VoiceExtensionEvents['emit'](_0xd07aa9+':'+_0x336927['id'],_0x336927);VoiceExtensionEvents[_0xa0d0('0x3')](_0xd07aa9,_0x336927);_0x17e2f5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xa0d0('0x4')](e,emitEvent(event));}}module[_0xa0d0('0x5')]=VoiceExtensionEvents; \ No newline at end of file +var _0xe98f=['save','update','emit','hasOwnProperty','exports','events','VoiceExtension'];(function(_0x5f35e2,_0x20105a){var _0x2d93fa=function(_0x4d0ee3){while(--_0x4d0ee3){_0x5f35e2['push'](_0x5f35e2['shift']());}};_0x2d93fa(++_0x20105a);}(_0xe98f,0xde));var _0xfe98=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe98f[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0xfe98('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xfe98('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe98('0x2'),'afterUpdate':_0xfe98('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4f19ea){return function(_0x4047fa,_0x5efd60,_0xabc73f){VoiceExtensionEvents[_0xfe98('0x4')](_0x4f19ea+':'+_0x4047fa['id'],_0x4047fa);VoiceExtensionEvents['emit'](_0x4f19ea,_0x4047fa);_0xabc73f(null);};}for(var e in events){if(events[_0xfe98('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xfe98('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index da5816c..e7147ae 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','VoiceExtension','voice_extensions','util','api','moment'];(function(_0x416dd0,_0x14a79e){var _0x447f78=function(_0x5daefb){while(--_0x5daefb){_0x416dd0['push'](_0x416dd0['shift']());}};_0x447f78(++_0x14a79e);}(_0xadb5,0xad));var _0x5adb=function(_0x3ff7ec,_0x45f2b1){_0x3ff7ec=_0x3ff7ec-0x0;var _0xd817b6=_0xadb5[_0x3ff7ec];return _0xd817b6;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./voiceExtension.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','util'];(function(_0x13bf70,_0x1d6a0b){var _0x2d1e30=function(_0x42e490){while(--_0x42e490){_0x13bf70['push'](_0x13bf70['shift']());}};_0x2d1e30(++_0x1d6a0b);}(_0x7a54,0x106));var _0x47a5=function(_0x1cfb3d,_0x4be288){_0x1cfb3d=_0x1cfb3d-0x0;var _0x1804bc=_0x7a54[_0x1cfb3d];return _0x1804bc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c8c98f4..d6bbdf4 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 _0xc244=['client','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x49d392,_0x2a3071){var _0x195e32=function(_0x4d755a){while(--_0x4d755a){_0x49d392['push'](_0x49d392['shift']());}};_0x195e32(++_0x2a3071);}(_0xc244,0x88));var _0x4c24=function(_0xc85173,_0x4a3205){_0xc85173=_0xc85173-0x0;var _0x108400=_0xc244[_0xc85173];return _0x108400;};'use strict';var _=require(_0x4c24('0x0'));var util=require('util');var moment=require(_0x4c24('0x1'));var BPromise=require(_0x4c24('0x2'));var rs=require(_0x4c24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c24('0x4'))['db'];var utils=require(_0x4c24('0x5'));var logger=require('../../config/logger')(_0x4c24('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c24('0x7'));var client=jayson[_0x4c24('0x8')]['http']({'port':0x232a});config[_0x4c24('0x9')]=_['defaults'](config[_0x4c24('0x9')],{'host':_0x4c24('0xa'),'port':0x18eb});var socket=require(_0x4c24('0xb'))(new Redis(config[_0x4c24('0x9')]));require(_0x4c24('0xc'))[_0x4c24('0xd')](socket);function respondWithRpcPromise(_0x1852ac,_0x5414be,_0xe02baa){return new BPromise(function(_0x19c88b,_0xd9921){return client[_0x4c24('0xe')](_0x1852ac,_0xe02baa)[_0x4c24('0xf')](function(_0x26ae8a){logger[_0x4c24('0x10')](_0x4c24('0x11'),_0x5414be,_0x4c24('0x12'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x5414be,_0x4c24('0x12'),JSON[_0x4c24('0x13')](_0x26ae8a));if(_0x26ae8a[_0x4c24('0x14')]){if(_0x26ae8a[_0x4c24('0x14')][_0x4c24('0x15')]===0x1f4){logger[_0x4c24('0x14')](_0x4c24('0x11'),_0x5414be,_0x26ae8a[_0x4c24('0x14')][_0x4c24('0x16')]);return _0xd9921(_0x26ae8a[_0x4c24('0x14')][_0x4c24('0x16')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5414be,_0x26ae8a[_0x4c24('0x14')][_0x4c24('0x16')]);return _0x19c88b(_0x26ae8a['error'][_0x4c24('0x16')]);}else{logger['info'](_0x4c24('0x11'),_0x5414be,_0x4c24('0x12'));_0x19c88b(_0x26ae8a[_0x4c24('0x17')][_0x4c24('0x16')]);}})['catch'](function(_0x31171f){logger[_0x4c24('0x14')](_0x4c24('0x11'),_0x5414be,_0x31171f);_0xd9921(_0x31171f);});});}exports[_0x4c24('0x18')]=function(_0x5ec49a){var _0x32d15d=this;return new Promise(function(_0x612027,_0x5ad14c){return db[_0x4c24('0x19')][_0x4c24('0x1a')]({'raw':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a[_0x4c24('0x1b')][_0x4c24('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a['options'][_0x4c24('0x1d')]||null:null,'attributes':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a[_0x4c24('0x1b')][_0x4c24('0x1e')]||null:null,'limit':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a['options'][_0x4c24('0x1f')]||null:null,'include':_0x5ec49a[_0x4c24('0x1b')]?_0x5ec49a[_0x4c24('0x1b')][_0x4c24('0x20')]?_[_0x4c24('0x21')](_0x5ec49a[_0x4c24('0x1b')][_0x4c24('0x20')],function(_0x19fcd0){return{'model':db[_0x19fcd0['model']],'as':_0x19fcd0['as'],'attributes':_0x19fcd0[_0x4c24('0x1e')],'include':_0x19fcd0[_0x4c24('0x20')]?_[_0x4c24('0x21')](_0x19fcd0[_0x4c24('0x20')],function(_0x297b24){return{'model':db[_0x297b24['model']],'as':_0x297b24['as'],'attributes':_0x297b24[_0x4c24('0x1e')],'include':_0x297b24[_0x4c24('0x20')]?_[_0x4c24('0x21')](_0x297b24['include'],function(_0x11388e){return{'model':db[_0x11388e['model']],'as':_0x11388e['as'],'attributes':_0x11388e['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c24('0xf')](function(_0xb2b170){logger['info'](_0x4c24('0x18'),_0x5ec49a);logger[_0x4c24('0x22')]('GetVoiceExtension',_0x5ec49a,JSON[_0x4c24('0x13')](_0xb2b170));_0x612027(_0xb2b170);})[_0x4c24('0x23')](function(_0x5defc9){logger[_0x4c24('0x14')](_0x4c24('0x18'),_0x5defc9[_0x4c24('0x16')],_0x5ec49a);_0x5ad14c(_0x32d15d[_0x4c24('0x14')](0x1f4,_0x5defc9[_0x4c24('0x16')]));});});}; \ No newline at end of file +var _0xcbd1=['catch','GetVoiceExtension','findAll','options','where','attributes','limit','include','map','model','debug','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x1805ce,_0x565a64){var _0x344d75=function(_0x1ec743){while(--_0x1ec743){_0x1805ce['push'](_0x1805ce['shift']());}};_0x344d75(++_0x565a64);}(_0xcbd1,0x90));var _0x1cbd=function(_0x4d2411,_0x4f1439){_0x4d2411=_0x4d2411-0x0;var _0x39cf0c=_0xcbd1[_0x4d2411];return _0x39cf0c;};'use strict';var _=require(_0x1cbd('0x0'));var util=require('util');var moment=require(_0x1cbd('0x1'));var BPromise=require(_0x1cbd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1cbd('0x3'))['db'];var utils=require(_0x1cbd('0x4'));var logger=require(_0x1cbd('0x5'))(_0x1cbd('0x6'));var config=require('../../config/environment');var jayson=require(_0x1cbd('0x7'));var client=jayson['client'][_0x1cbd('0x8')]({'port':0x232a});config['redis']=_[_0x1cbd('0x9')](config[_0x1cbd('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1cbd('0xb'))['register'](socket);function respondWithRpcPromise(_0x2ea7a6,_0xe76944,_0x436291){return new BPromise(function(_0x336f3f,_0x406d56){return client[_0x1cbd('0xc')](_0x2ea7a6,_0x436291)[_0x1cbd('0xd')](function(_0x752999){logger[_0x1cbd('0xe')](_0x1cbd('0xf'),_0xe76944,_0x1cbd('0x10'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xe76944,_0x1cbd('0x10'),JSON['stringify'](_0x752999));if(_0x752999[_0x1cbd('0x11')]){if(_0x752999[_0x1cbd('0x11')][_0x1cbd('0x12')]===0x1f4){logger[_0x1cbd('0x11')]('VoiceExtension,\x20%s,\x20%s',_0xe76944,_0x752999[_0x1cbd('0x11')]['message']);return _0x406d56(_0x752999[_0x1cbd('0x11')][_0x1cbd('0x13')]);}logger[_0x1cbd('0x11')](_0x1cbd('0xf'),_0xe76944,_0x752999['error'][_0x1cbd('0x13')]);return _0x336f3f(_0x752999[_0x1cbd('0x11')]['message']);}else{logger[_0x1cbd('0xe')](_0x1cbd('0xf'),_0xe76944,_0x1cbd('0x10'));_0x336f3f(_0x752999[_0x1cbd('0x14')]['message']);}})[_0x1cbd('0x15')](function(_0x334a95){logger['error'](_0x1cbd('0xf'),_0xe76944,_0x334a95);_0x406d56(_0x334a95);});});}exports[_0x1cbd('0x16')]=function(_0x275f0f){var _0x30aab5=this;return new Promise(function(_0x4da57c,_0x197d0c){return db['VoiceExtension'][_0x1cbd('0x17')]({'raw':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f[_0x1cbd('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f[_0x1cbd('0x18')][_0x1cbd('0x19')]||null:null,'attributes':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f[_0x1cbd('0x18')][_0x1cbd('0x1a')]||null:null,'limit':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f[_0x1cbd('0x18')][_0x1cbd('0x1b')]||null:null,'include':_0x275f0f[_0x1cbd('0x18')]?_0x275f0f['options'][_0x1cbd('0x1c')]?_[_0x1cbd('0x1d')](_0x275f0f[_0x1cbd('0x18')][_0x1cbd('0x1c')],function(_0x41a7b5){return{'model':db[_0x41a7b5['model']],'as':_0x41a7b5['as'],'attributes':_0x41a7b5['attributes'],'include':_0x41a7b5['include']?_[_0x1cbd('0x1d')](_0x41a7b5[_0x1cbd('0x1c')],function(_0x5203a1){return{'model':db[_0x5203a1[_0x1cbd('0x1e')]],'as':_0x5203a1['as'],'attributes':_0x5203a1[_0x1cbd('0x1a')],'include':_0x5203a1['include']?_[_0x1cbd('0x1d')](_0x5203a1[_0x1cbd('0x1c')],function(_0x53e134){return{'model':db[_0x53e134[_0x1cbd('0x1e')]],'as':_0x53e134['as'],'attributes':_0x53e134[_0x1cbd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1cbd('0xd')](function(_0x43f7cc){logger[_0x1cbd('0xe')]('GetVoiceExtension',_0x275f0f);logger[_0x1cbd('0x1f')]('GetVoiceExtension',_0x275f0f,JSON[_0x1cbd('0x20')](_0x43f7cc));_0x4da57c(_0x43f7cc);})[_0x1cbd('0x15')](function(_0x560839){logger[_0x1cbd('0x11')](_0x1cbd('0x16'),_0x560839[_0x1cbd('0x13')],_0x275f0f);_0x197d0c(_0x30aab5[_0x1cbd('0x11')](0x1f4,_0x560839[_0x1cbd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 10455c7..173e089 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 _0xd769=['register','length','./voiceExtension.events','save','remove','update','removeListener'];(function(_0x2d4e41,_0x1f1b7f){var _0x31f398=function(_0x49636d){while(--_0x49636d){_0x2d4e41['push'](_0x2d4e41['shift']());}};_0x31f398(++_0x1f1b7f);}(_0xd769,0x1ad));var _0x9d76=function(_0x5f3da8,_0x4eb6ea){_0x5f3da8=_0x5f3da8-0x0;var _0x4eaf62=_0xd769[_0x5f3da8];return _0x4eaf62;};'use strict';var VoiceExtensionEvents=require(_0x9d76('0x0'));var events=[_0x9d76('0x1'),_0x9d76('0x2'),_0x9d76('0x3')];function createListener(_0xed08b9,_0x2dcbdd){return function(_0x57f957){_0x2dcbdd['emit'](_0xed08b9,_0x57f957);};}function removeListener(_0x5ef62c,_0x45202d){return function(){VoiceExtensionEvents[_0x9d76('0x4')](_0x5ef62c,_0x45202d);};}exports[_0x9d76('0x5')]=function(_0x3fc24b){for(var _0x49fb1e=0x0,_0x307d7d=events[_0x9d76('0x6')];_0x49fb1e<_0x307d7d;_0x49fb1e++){var _0x510082=events[_0x49fb1e];var _0x4ca89c=createListener('voiceExtension:'+_0x510082,_0x3fc24b);VoiceExtensionEvents['on'](_0x510082,_0x4ca89c);}}; \ No newline at end of file +var _0xa0c4=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xa0c4,0xed));var _0x4a0c=function(_0x6e7d28,_0x79af88){_0x6e7d28=_0x6e7d28-0x0;var _0x57a1d9=_0xa0c4[_0x6e7d28];return _0x57a1d9;};'use strict';var VoiceExtensionEvents=require(_0x4a0c('0x0'));var events=['save',_0x4a0c('0x1'),'update'];function createListener(_0x34357e,_0x2e95df){return function(_0x33c722){_0x2e95df[_0x4a0c('0x2')](_0x34357e,_0x33c722);};}function removeListener(_0x430d48,_0x4901bd){return function(){VoiceExtensionEvents[_0x4a0c('0x3')](_0x430d48,_0x4901bd);};}exports[_0x4a0c('0x4')]=function(_0x19ad40){for(var _0x58e817=0x0,_0x139212=events[_0x4a0c('0x5')];_0x58e817<_0x139212;_0x58e817++){var _0x364530=events[_0x58e817];var _0x45639a=createListener(_0x4a0c('0x6')+_0x364530,_0x19ad40);VoiceExtensionEvents['on'](_0x364530,_0x45639a);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 35722a9..71ff6f5 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 _0xf04f=['exports','util','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','post','create','put','/:id','update','delete'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0xf04f,0xb5));var _0xff04=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf04f[_0x46698a];return _0x356db0;};'use strict';var multer=require('multer');var util=require(_0xff04('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff04('0x1')]();var auth=require(_0xff04('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xff04('0x3'));var controller=require(_0xff04('0x4'));router[_0xff04('0x5')]('/',auth[_0xff04('0x6')](),controller[_0xff04('0x7')]);router['get']('/:id',auth[_0xff04('0x6')](),controller[_0xff04('0x8')]);router[_0xff04('0x5')](_0xff04('0x9'),auth['isAuthenticated'](),controller[_0xff04('0xa')]);router[_0xff04('0xb')]('/',auth['isAuthenticated'](),controller[_0xff04('0xc')]);router[_0xff04('0xd')](_0xff04('0xe'),auth[_0xff04('0x6')](),controller[_0xff04('0xf')]);router[_0xff04('0x10')](_0xff04('0xe'),auth[_0xff04('0x6')](),controller['destroy']);module[_0xff04('0x11')]=router; \ No newline at end of file +var _0x5d13=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','exports','util','path'];(function(_0x540315,_0x5e4286){var _0x45b752=function(_0x42f23e){while(--_0x42f23e){_0x540315['push'](_0x540315['shift']());}};_0x45b752(++_0x5e4286);}(_0x5d13,0x1b7));var _0x35d1=function(_0x37ddf0,_0x5c55de){_0x37ddf0=_0x37ddf0-0x0;var _0x47ebcc=_0x5d13[_0x37ddf0];return _0x47ebcc;};'use strict';var multer=require('multer');var util=require(_0x35d1('0x0'));var path=require(_0x35d1('0x1'));var timeout=require(_0x35d1('0x2'));var express=require(_0x35d1('0x3'));var router=express['Router']();var auth=require(_0x35d1('0x4'));var interaction=require(_0x35d1('0x5'));var config=require(_0x35d1('0x6'));var controller=require(_0x35d1('0x7'));router[_0x35d1('0x8')]('/',auth[_0x35d1('0x9')](),controller[_0x35d1('0xa')]);router[_0x35d1('0x8')](_0x35d1('0xb'),auth['isAuthenticated'](),controller[_0x35d1('0xc')]);router[_0x35d1('0x8')](_0x35d1('0xd'),auth[_0x35d1('0x9')](),controller[_0x35d1('0xe')]);router[_0x35d1('0xf')]('/',auth[_0x35d1('0x9')](),controller[_0x35d1('0x10')]);router['put'](_0x35d1('0xb'),auth['isAuthenticated'](),controller[_0x35d1('0x11')]);router[_0x35d1('0x12')](_0x35d1('0xb'),auth['isAuthenticated'](),controller[_0x35d1('0x13')]);module[_0x35d1('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9f7d45b..ddd02f8 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 _0x4cf8=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue'];(function(_0x3b1602,_0x165349){var _0x50103d=function(_0x271f2f){while(--_0x271f2f){_0x3b1602['push'](_0x3b1602['shift']());}};_0x50103d(++_0x165349);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x4cf8[_0x671369];return _0x33f2b4;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'customer_id':{'type':Sequelize[_0x84cf('0x2')]},'context':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':_0x84cf('0x3'),'unique':_0x84cf('0x4')},'mailbox':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':'','allowNull':![],'unique':_0x84cf('0x4')},'password':{'type':Sequelize[_0x84cf('0x2')]},'fullname':{'type':Sequelize[_0x84cf('0x2')]},'email':{'type':Sequelize[_0x84cf('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2c613d){this['setDataValue']('email',typeof _0x2c613d===_0x84cf('0x5')&&_0x2c613d['trim']()?_0x2c613d[_0x84cf('0x6')]():null);}},'pager':{'type':Sequelize[_0x84cf('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x84cf('0x7')},'attach':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x84cf('0x2')]},'review':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x84cf('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x84cf('0xb')},'emailsubject':{'type':Sequelize[_0x84cf('0x2')]},'emailbody':{'type':Sequelize[_0x84cf('0x2')]},'maxsecs':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x84cf('0xd')],'get':function(){return this[_0x84cf('0xe')]('fullname')+'\x20-\x20'+this[_0x84cf('0xe')](_0x84cf('0xf'));}}}; \ No newline at end of file +var _0x8603=['exports','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x25f8e8,_0x519d8e){var _0x1df02c=function(_0x1bee7b){while(--_0x1bee7b){_0x25f8e8['push'](_0x25f8e8['shift']());}};_0x1df02c(++_0x519d8e);}(_0x8603,0x190));var _0x3860=function(_0x3c01e2,_0x204612){_0x3c01e2=_0x3c01e2-0x0;var _0x162c4c=_0x8603[_0x3c01e2];return _0x162c4c;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'customer_id':{'type':Sequelize[_0x3860('0x1')]},'context':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3860('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3860('0x2')},'password':{'type':Sequelize[_0x3860('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3860('0x1')],'validate':{'isEmail':!![]},'set':function(_0x56f8c5){this[_0x3860('0x3')](_0x3860('0x4'),typeof _0x56f8c5===_0x3860('0x5')&&_0x56f8c5[_0x3860('0x6')]()?_0x56f8c5[_0x3860('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3860('0x1')]},'callback':{'type':Sequelize[_0x3860('0x1')]},'review':{'type':Sequelize['ENUM'](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3860('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3860('0x7')]('yes','no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3860('0x7')](_0x3860('0x8'),'no'),'defaultValue':_0x3860('0x8'),'allowNull':![]},'stamp':{'type':_0x3860('0xa')},'emailsubject':{'type':Sequelize[_0x3860('0x1')]},'emailbody':{'type':Sequelize[_0x3860('0x1')]},'maxsecs':{'type':Sequelize[_0x3860('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3860('0xc')](_0x3860('0xd'))+_0x3860('0xe')+this['getDataValue'](_0x3860('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index aea8a81..b25f7a0 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 _0x1cd3=['intersection','fields','length','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filter','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','findOne','VoiceMailMessage','pick','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','limit','Content-Range','json','apply','reject','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x8884aa,_0x5102c2){var _0x1f8a0f=function(_0x55d250){while(--_0x55d250){_0x8884aa['push'](_0x8884aa['shift']());}};_0x1f8a0f(++_0x5102c2);}(_0x1cd3,0xc9));var _0x31cd=function(_0x2f9a3f,_0x4bd09f){_0x2f9a3f=_0x2f9a3f-0x0;var _0x2735ab=_0x1cd3[_0x2f9a3f];return _0x2735ab;};'use strict';var pdf=require(_0x31cd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x31cd('0x1'));var zipdir=require(_0x31cd('0x2'));var jsonpatch=require(_0x31cd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x31cd('0x4'));var Mustache=require(_0x31cd('0x5'));var util=require('util');var path=require(_0x31cd('0x6'));var sox=require('sox');var csv=require(_0x31cd('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x31cd('0x8'));var squel=require(_0x31cd('0x9'));var crypto=require('crypto');var jsforce=require(_0x31cd('0xa'));var deskjs=require(_0x31cd('0xb'));var toCsv=require('to-csv');var querystring=require(_0x31cd('0xc'));var Papa=require('papaparse');var Redis=require(_0x31cd('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x31cd('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31cd('0xf'))(_0x31cd('0x10'));var utils=require(_0x31cd('0x11'));var config=require(_0x31cd('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39789d,_0xa347d6){_0xa347d6=_0xa347d6||0xcc;return function(_0x1a807f){if(_0x1a807f){return _0x39789d[_0x31cd('0x13')](_0xa347d6);}return _0x39789d[_0x31cd('0x14')](_0xa347d6)[_0x31cd('0x15')]();};}function respondWithResult(_0x2e8224,_0x4ac316){_0x4ac316=_0x4ac316||0xc8;return function(_0x3aacf1){if(_0x3aacf1){return _0x2e8224[_0x31cd('0x14')](_0x4ac316)['json'](_0x3aacf1);}};}function respondWithFilteredResult(_0x2dfca4,_0x16540d){return function(_0x52b992){if(_0x52b992){var _0x3641e2=_0x52b992['count'],_0x52cc8b=_0x16540d['offset'],_0x21d638=_0x16540d['offset']+_0x16540d[_0x31cd('0x16')],_0x339bb8;if(_0x21d638>=_0x3641e2){_0x21d638=_0x3641e2;_0x339bb8=0xc8;}else{_0x339bb8=0xce;}_0x2dfca4[_0x31cd('0x14')](_0x339bb8);return _0x2dfca4['set'](_0x31cd('0x17'),_0x52cc8b+'-'+_0x21d638+'/'+_0x3641e2)[_0x31cd('0x18')](_0x52b992);}return null;};}function patchUpdates(_0x456b9d){return function(_0x4f0331){try{jsonpatch[_0x31cd('0x19')](_0x4f0331,_0x456b9d,!![]);}catch(_0xd853b5){return BPromise[_0x31cd('0x1a')](_0xd853b5);}return _0x4f0331['save']();};}function saveUpdates(_0x3b0980,_0x2b6808){return function(_0x47bbc2){if(_0x47bbc2){return _0x47bbc2[_0x31cd('0x1b')](_0x3b0980)[_0x31cd('0x1c')](function(_0x4c0269){return _0x4c0269;});}return null;};}function removeEntity(_0x11fd5,_0x2b7a76){return function(_0xcdfc6a){if(_0xcdfc6a){return _0xcdfc6a[_0x31cd('0x1d')]()[_0x31cd('0x1c')](function(){var _0x42fc74=_0xcdfc6a[_0x31cd('0x1e')]({'plain':!![]});var _0x2d86ec=_0x31cd('0x1f');return db[_0x31cd('0x20')][_0x31cd('0x1d')]({'where':{'type':_0x2d86ec,'resourceId':_0x42fc74['id']}})[_0x31cd('0x1c')](function(){return _0xcdfc6a;});})['then'](function(){_0x11fd5['status'](0xcc)[_0x31cd('0x15')]();});}};}function handleEntityNotFound(_0x45eda5,_0x118ede){return function(_0x34fd02){if(!_0x34fd02){_0x45eda5[_0x31cd('0x13')](0x194);}return _0x34fd02;};}function handleError(_0x14732a,_0x35c898){_0x35c898=_0x35c898||0x1f4;return function(_0x4231df){logger[_0x31cd('0x21')](_0x4231df[_0x31cd('0x22')]);if(_0x4231df[_0x31cd('0x23')]){delete _0x4231df[_0x31cd('0x23')];}_0x14732a[_0x31cd('0x14')](_0x35c898)[_0x31cd('0x24')](_0x4231df);};}exports[_0x31cd('0x25')]=function(_0x3d5b46,_0x1a1d9f){var _0x5ac5f6={},_0x395d84={},_0x32abd5={'count':0x0,'rows':[]};var _0x3294e8=_[_0x31cd('0x26')](db[_0x31cd('0x27')][_0x31cd('0x28')],function(_0x657462){return{'name':_0x657462[_0x31cd('0x29')],'type':_0x657462[_0x31cd('0x2a')][_0x31cd('0x2b')]};});_0x395d84[_0x31cd('0x2c')]=_['map'](_0x3294e8,'name');_0x395d84[_0x31cd('0x2d')]=_[_0x31cd('0x2e')](_0x3d5b46[_0x31cd('0x2d')]);_0x395d84[_0x31cd('0x2f')]=_[_0x31cd('0x30')](_0x395d84[_0x31cd('0x2c')],_0x395d84[_0x31cd('0x2d')]);_0x5ac5f6['attributes']=_[_0x31cd('0x30')](_0x395d84[_0x31cd('0x2c')],qs[_0x31cd('0x31')](_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x31')]));_0x5ac5f6['attributes']=_0x5ac5f6['attributes'][_0x31cd('0x32')]?_0x5ac5f6[_0x31cd('0x33')]:_0x395d84['model'];if(!_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x34')](_0x31cd('0x35'))){_0x5ac5f6['limit']=qs[_0x31cd('0x16')](_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x16')]);_0x5ac5f6['offset']=qs['offset'](_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x36')]);}_0x5ac5f6[_0x31cd('0x37')]=qs[_0x31cd('0x38')](_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x38')]);_0x5ac5f6[_0x31cd('0x39')]=qs['filters'](_['pick'](_0x3d5b46[_0x31cd('0x2d')],_0x395d84[_0x31cd('0x2f')]),_0x3294e8);if(_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x3a')]){_0x5ac5f6[_0x31cd('0x39')]=_['merge'](_0x5ac5f6[_0x31cd('0x39')],{'$or':_[_0x31cd('0x26')](_0x3294e8,function(_0x217875){if(_0x217875['type']!==_0x31cd('0x3b')){var _0x4a8e11={};_0x4a8e11[_0x217875['name']]={'$like':'%'+_0x3d5b46[_0x31cd('0x2d')][_0x31cd('0x3a')]+'%'};return _0x4a8e11;}})});}_0x5ac5f6=_['merge']({},_0x5ac5f6,_0x3d5b46[_0x31cd('0x3c')]);var _0x83597d={'where':_0x5ac5f6[_0x31cd('0x39')]};return db[_0x31cd('0x27')][_0x31cd('0x3d')](_0x83597d)['then'](function(_0x2ef9d3){_0x32abd5[_0x31cd('0x3d')]=_0x2ef9d3;if(_0x3d5b46['query'][_0x31cd('0x3e')]){_0x5ac5f6[_0x31cd('0x3f')]=[{'all':!![]}];}return db[_0x31cd('0x27')][_0x31cd('0x40')](_0x5ac5f6);})['then'](function(_0x2b7cf1){_0x32abd5[_0x31cd('0x41')]=_0x2b7cf1;return _0x32abd5;})[_0x31cd('0x1c')](respondWithFilteredResult(_0x1a1d9f,_0x5ac5f6))[_0x31cd('0x42')](handleError(_0x1a1d9f,null));};exports[_0x31cd('0x43')]=function(_0x6e29e3,_0x4175bc){var _0x842a8c={'raw':!![],'where':{'id':_0x6e29e3[_0x31cd('0x44')]['id']}},_0x3374c1={};_0x3374c1[_0x31cd('0x2c')]=_[_0x31cd('0x2e')](db['VoiceMail']['rawAttributes']);_0x3374c1[_0x31cd('0x2d')]=_['keys'](_0x6e29e3[_0x31cd('0x2d')]);_0x3374c1[_0x31cd('0x2f')]=_[_0x31cd('0x30')](_0x3374c1[_0x31cd('0x2c')],_0x3374c1[_0x31cd('0x2d')]);_0x842a8c[_0x31cd('0x33')]=_[_0x31cd('0x30')](_0x3374c1['model'],qs[_0x31cd('0x31')](_0x6e29e3[_0x31cd('0x2d')][_0x31cd('0x31')]));_0x842a8c[_0x31cd('0x33')]=_0x842a8c[_0x31cd('0x33')][_0x31cd('0x32')]?_0x842a8c[_0x31cd('0x33')]:_0x3374c1[_0x31cd('0x2c')];if(_0x6e29e3[_0x31cd('0x2d')][_0x31cd('0x3e')]){_0x842a8c[_0x31cd('0x3f')]=[{'all':!![]}];}_0x842a8c=_[_0x31cd('0x45')]({},_0x842a8c,_0x6e29e3[_0x31cd('0x3c')]);return db[_0x31cd('0x27')][_0x31cd('0x46')](_0x842a8c)['then'](handleEntityNotFound(_0x4175bc,null))[_0x31cd('0x1c')](respondWithResult(_0x4175bc,null))[_0x31cd('0x42')](handleError(_0x4175bc,null));};exports['create']=function(_0x2fa0a1,_0x136175){return db[_0x31cd('0x27')][_0x31cd('0x47')](_0x2fa0a1['body'],{})[_0x31cd('0x1c')](function(_0x2cab58){var _0x2437e8=_0x2fa0a1[_0x31cd('0x48')][_0x31cd('0x1e')]({'plain':!![]});if(!_0x2437e8)throw new Error(_0x31cd('0x49'));if(_0x2437e8[_0x31cd('0x4a')]===_0x31cd('0x48')){var _0x4af2e8=_0x2cab58['get']({'plain':!![]});var _0x4bec21=_0x31cd('0x1f');return db[_0x31cd('0x4b')][_0x31cd('0x46')]({'where':{'name':_0x4bec21,'userProfileId':_0x2437e8[_0x31cd('0x4c')]},'raw':!![]})[_0x31cd('0x1c')](function(_0x3c2f4e){if(_0x3c2f4e&&_0x3c2f4e[_0x31cd('0x4d')]===0x0){return db[_0x31cd('0x20')][_0x31cd('0x47')]({'name':_0x4af2e8[_0x31cd('0x23')],'resourceId':_0x4af2e8['id'],'type':_0x3c2f4e['name'],'sectionId':_0x3c2f4e['id']},{})[_0x31cd('0x1c')](function(){return _0x2cab58;});}else{return _0x2cab58;}})[_0x31cd('0x42')](function(_0x5a36de){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a36de);throw _0x5a36de;});}return _0x2cab58;})['then'](respondWithResult(_0x136175,0xc9))[_0x31cd('0x42')](handleError(_0x136175,null));};exports[_0x31cd('0x1b')]=function(_0x5e0ef2,_0xb36bc5){if(_0x5e0ef2['body']['id']){delete _0x5e0ef2[_0x31cd('0x4e')]['id'];}return db[_0x31cd('0x27')][_0x31cd('0x46')]({'where':{'id':_0x5e0ef2['params']['id']}})['then'](handleEntityNotFound(_0xb36bc5,null))[_0x31cd('0x1c')](saveUpdates(_0x5e0ef2[_0x31cd('0x4e')],null))[_0x31cd('0x1c')](respondWithResult(_0xb36bc5,null))[_0x31cd('0x42')](handleError(_0xb36bc5,null));};exports[_0x31cd('0x1d')]=function(_0x3fc2ff,_0x38114e){return db[_0x31cd('0x27')][_0x31cd('0x46')]({'where':{'id':_0x3fc2ff[_0x31cd('0x44')]['id']}})[_0x31cd('0x1c')](handleEntityNotFound(_0x38114e,null))[_0x31cd('0x1c')](removeEntity(_0x38114e,null))[_0x31cd('0x42')](handleError(_0x38114e,null));};exports['getMessages']=function(_0x37980b,_0x964c37,_0x44e3db){return db[_0x31cd('0x27')][_0x31cd('0x4f')]({'where':{'id':_0x37980b[_0x31cd('0x44')]['id']}})['then'](handleEntityNotFound(_0x964c37,null))['then'](function(_0x81b19e){var _0x2f5839;var _0x3449cc={},_0x4ceafa={};_0x4ceafa['model']=_[_0x31cd('0x2e')](db[_0x31cd('0x50')][_0x31cd('0x28')]);_0x4ceafa[_0x31cd('0x2d')]=_['keys'](_0x37980b[_0x31cd('0x2d')]);_0x4ceafa['filters']=_[_0x31cd('0x30')](_0x4ceafa[_0x31cd('0x2c')],_0x4ceafa['query']);_0x3449cc[_0x31cd('0x33')]=_['intersection'](_0x4ceafa['model'],qs['fields'](_0x37980b[_0x31cd('0x2d')][_0x31cd('0x31')]));_0x3449cc[_0x31cd('0x33')]=_0x3449cc['attributes'][_0x31cd('0x32')]?_0x3449cc[_0x31cd('0x33')]:_0x4ceafa['model'];if(!_0x37980b[_0x31cd('0x2d')][_0x31cd('0x34')](_0x31cd('0x35'))){_0x3449cc['limit']=qs[_0x31cd('0x16')](_0x37980b[_0x31cd('0x2d')][_0x31cd('0x16')]);_0x3449cc['offset']=qs[_0x31cd('0x36')](_0x37980b[_0x31cd('0x2d')][_0x31cd('0x36')]);}_0x3449cc[_0x31cd('0x37')]=qs[_0x31cd('0x38')](_0x37980b[_0x31cd('0x2d')][_0x31cd('0x38')]);_0x3449cc[_0x31cd('0x39')]=qs[_0x31cd('0x2f')](_[_0x31cd('0x51')](_0x37980b[_0x31cd('0x2d')],_0x4ceafa[_0x31cd('0x2f')]));if(_0x37980b[_0x31cd('0x2d')]['filter']){_0x3449cc[_0x31cd('0x39')]=_['merge'](_0x3449cc[_0x31cd('0x39')],{'$or':_[_0x31cd('0x26')](_0x3449cc[_0x31cd('0x33')],function(_0x3395ed){var _0x5e6297={};_0x5e6297[_0x3395ed]={'$like':'%'+_0x37980b[_0x31cd('0x2d')][_0x31cd('0x3a')]+'%'};return _0x5e6297;})});}_0x3449cc['where']=_['merge'](_0x3449cc[_0x31cd('0x39')],{'mailboxuser':_0x81b19e['mailbox']});_0x3449cc=_[_0x31cd('0x45')]({},_0x3449cc,_0x37980b[_0x31cd('0x3c')]);return db[_0x31cd('0x50')][_0x31cd('0x52')](_0x3449cc)[_0x31cd('0x1c')](respondWithFilteredResult(_0x964c37,_0x3449cc));})[_0x31cd('0x42')](handleError(_0x964c37,null));}; \ No newline at end of file +var _0xcf2c=['options','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','getMessages','findOne','pick','filter','mailbox','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','VoiceMail','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL'];(function(_0x34e4a0,_0x1fd446){var _0x3ead3e=function(_0x47adec){while(--_0x47adec){_0x34e4a0['push'](_0x34e4a0['shift']());}};_0x3ead3e(++_0x1fd446);}(_0xcf2c,0x121));var _0xccf2=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0xcf2c[_0xc69f39];return _0x93be41;};'use strict';var pdf=require(_0xccf2('0x0'));var emlformat=require(_0xccf2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xccf2('0x2'));var jsonpatch=require(_0xccf2('0x3'));var rp=require(_0xccf2('0x4'));var moment=require('moment');var BPromise=require(_0xccf2('0x5'));var Mustache=require(_0xccf2('0x6'));var util=require('util');var path=require(_0xccf2('0x7'));var sox=require(_0xccf2('0x8'));var csv=require(_0xccf2('0x9'));var ejs=require(_0xccf2('0xa'));var fs=require('fs');var _=require(_0xccf2('0xb'));var squel=require(_0xccf2('0xc'));var crypto=require('crypto');var jsforce=require(_0xccf2('0xd'));var deskjs=require(_0xccf2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xccf2('0xf'));var Papa=require(_0xccf2('0x10'));var Redis=require(_0xccf2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xccf2('0x12'));var as=require(_0xccf2('0x13'));var hardwareService=require(_0xccf2('0x14'));var logger=require(_0xccf2('0x15'))(_0xccf2('0x16'));var utils=require(_0xccf2('0x17'));var config=require(_0xccf2('0x18'));var db=require(_0xccf2('0x19'))['db'];function respondWithStatusCode(_0x370495,_0x35b1b9){_0x35b1b9=_0x35b1b9||0xcc;return function(_0x178f54){if(_0x178f54){return _0x370495[_0xccf2('0x1a')](_0x35b1b9);}return _0x370495[_0xccf2('0x1b')](_0x35b1b9)['end']();};}function respondWithResult(_0x1007fc,_0x161107){_0x161107=_0x161107||0xc8;return function(_0x12d016){if(_0x12d016){return _0x1007fc[_0xccf2('0x1b')](_0x161107)[_0xccf2('0x1c')](_0x12d016);}};}function respondWithFilteredResult(_0x35f417,_0x56152e){return function(_0x5453c1){if(_0x5453c1){var _0x53598e=_0x5453c1['count'],_0x12bcb2=_0x56152e[_0xccf2('0x1d')],_0x11d685=_0x56152e[_0xccf2('0x1d')]+_0x56152e[_0xccf2('0x1e')],_0x175b28;if(_0x11d685>=_0x53598e){_0x11d685=_0x53598e;_0x175b28=0xc8;}else{_0x175b28=0xce;}_0x35f417[_0xccf2('0x1b')](_0x175b28);return _0x35f417[_0xccf2('0x1f')](_0xccf2('0x20'),_0x12bcb2+'-'+_0x11d685+'/'+_0x53598e)[_0xccf2('0x1c')](_0x5453c1);}return null;};}function patchUpdates(_0x3dd0dc){return function(_0x124b06){try{jsonpatch['apply'](_0x124b06,_0x3dd0dc,!![]);}catch(_0x50f63a){return BPromise['reject'](_0x50f63a);}return _0x124b06[_0xccf2('0x21')]();};}function saveUpdates(_0x68948a,_0x23b16e){return function(_0x1d61a6){if(_0x1d61a6){return _0x1d61a6['update'](_0x68948a)[_0xccf2('0x22')](function(_0x43212c){return _0x43212c;});}return null;};}function removeEntity(_0x185822,_0x26e98c){return function(_0x2e3944){if(_0x2e3944){return _0x2e3944[_0xccf2('0x23')]()[_0xccf2('0x22')](function(){var _0x3959c5=_0x2e3944[_0xccf2('0x24')]({'plain':!![]});var _0x5da64a=_0xccf2('0x25');return db[_0xccf2('0x26')][_0xccf2('0x23')]({'where':{'type':_0x5da64a,'resourceId':_0x3959c5['id']}})[_0xccf2('0x22')](function(){return _0x2e3944;});})[_0xccf2('0x22')](function(){_0x185822[_0xccf2('0x1b')](0xcc)[_0xccf2('0x27')]();});}};}function handleEntityNotFound(_0x5807d0,_0x4524fe){return function(_0xaaca03){if(!_0xaaca03){_0x5807d0[_0xccf2('0x1a')](0x194);}return _0xaaca03;};}function handleError(_0x53dac6,_0x17a490){_0x17a490=_0x17a490||0x1f4;return function(_0x17fb15){logger[_0xccf2('0x28')](_0x17fb15['stack']);if(_0x17fb15[_0xccf2('0x29')]){delete _0x17fb15[_0xccf2('0x29')];}_0x53dac6[_0xccf2('0x1b')](_0x17a490)[_0xccf2('0x2a')](_0x17fb15);};}exports[_0xccf2('0x2b')]=function(_0x56ab04,_0x1e9447){var _0x5b77f6={},_0x1405d7={},_0x21b2c1={'count':0x0,'rows':[]};var _0x39e234=_['map'](db[_0xccf2('0x2c')]['rawAttributes'],function(_0x51ffd2){return{'name':_0x51ffd2[_0xccf2('0x2d')],'type':_0x51ffd2[_0xccf2('0x2e')][_0xccf2('0x2f')]};});_0x1405d7['model']=_[_0xccf2('0x30')](_0x39e234,_0xccf2('0x29'));_0x1405d7[_0xccf2('0x31')]=_[_0xccf2('0x32')](_0x56ab04['query']);_0x1405d7[_0xccf2('0x33')]=_['intersection'](_0x1405d7[_0xccf2('0x34')],_0x1405d7['query']);_0x5b77f6[_0xccf2('0x35')]=_[_0xccf2('0x36')](_0x1405d7[_0xccf2('0x34')],qs['fields'](_0x56ab04[_0xccf2('0x31')][_0xccf2('0x37')]));_0x5b77f6[_0xccf2('0x35')]=_0x5b77f6[_0xccf2('0x35')][_0xccf2('0x38')]?_0x5b77f6[_0xccf2('0x35')]:_0x1405d7['model'];if(!_0x56ab04[_0xccf2('0x31')][_0xccf2('0x39')]('nolimit')){_0x5b77f6[_0xccf2('0x1e')]=qs[_0xccf2('0x1e')](_0x56ab04[_0xccf2('0x31')]['limit']);_0x5b77f6['offset']=qs[_0xccf2('0x1d')](_0x56ab04[_0xccf2('0x31')][_0xccf2('0x1d')]);}_0x5b77f6[_0xccf2('0x3a')]=qs[_0xccf2('0x3b')](_0x56ab04['query'][_0xccf2('0x3b')]);_0x5b77f6[_0xccf2('0x3c')]=qs[_0xccf2('0x33')](_['pick'](_0x56ab04[_0xccf2('0x31')],_0x1405d7['filters']),_0x39e234);if(_0x56ab04[_0xccf2('0x31')]['filter']){_0x5b77f6[_0xccf2('0x3c')]=_[_0xccf2('0x3d')](_0x5b77f6[_0xccf2('0x3c')],{'$or':_[_0xccf2('0x30')](_0x39e234,function(_0x125ec9){if(_0x125ec9[_0xccf2('0x2e')]!==_0xccf2('0x3e')){var _0x50becc={};_0x50becc[_0x125ec9[_0xccf2('0x29')]]={'$like':'%'+_0x56ab04[_0xccf2('0x31')]['filter']+'%'};return _0x50becc;}})});}_0x5b77f6=_[_0xccf2('0x3d')]({},_0x5b77f6,_0x56ab04[_0xccf2('0x3f')]);var _0x16e0a6={'where':_0x5b77f6[_0xccf2('0x3c')]};return db[_0xccf2('0x2c')][_0xccf2('0x40')](_0x16e0a6)[_0xccf2('0x22')](function(_0x5b7fcd){_0x21b2c1[_0xccf2('0x40')]=_0x5b7fcd;if(_0x56ab04[_0xccf2('0x31')]['includeAll']){_0x5b77f6[_0xccf2('0x41')]=[{'all':!![]}];}return db[_0xccf2('0x2c')][_0xccf2('0x42')](_0x5b77f6);})[_0xccf2('0x22')](function(_0x3b1eb7){_0x21b2c1[_0xccf2('0x43')]=_0x3b1eb7;return _0x21b2c1;})[_0xccf2('0x22')](respondWithFilteredResult(_0x1e9447,_0x5b77f6))[_0xccf2('0x44')](handleError(_0x1e9447,null));};exports[_0xccf2('0x45')]=function(_0x9afeef,_0x3c75a1){var _0x3fd2d6={'raw':!![],'where':{'id':_0x9afeef[_0xccf2('0x46')]['id']}},_0x554aa3={};_0x554aa3[_0xccf2('0x34')]=_[_0xccf2('0x32')](db['VoiceMail'][_0xccf2('0x47')]);_0x554aa3[_0xccf2('0x31')]=_['keys'](_0x9afeef[_0xccf2('0x31')]);_0x554aa3['filters']=_[_0xccf2('0x36')](_0x554aa3[_0xccf2('0x34')],_0x554aa3['query']);_0x3fd2d6[_0xccf2('0x35')]=_[_0xccf2('0x36')](_0x554aa3['model'],qs[_0xccf2('0x37')](_0x9afeef[_0xccf2('0x31')][_0xccf2('0x37')]));_0x3fd2d6[_0xccf2('0x35')]=_0x3fd2d6['attributes'][_0xccf2('0x38')]?_0x3fd2d6[_0xccf2('0x35')]:_0x554aa3[_0xccf2('0x34')];if(_0x9afeef['query'][_0xccf2('0x48')]){_0x3fd2d6[_0xccf2('0x41')]=[{'all':!![]}];}_0x3fd2d6=_[_0xccf2('0x3d')]({},_0x3fd2d6,_0x9afeef['options']);return db[_0xccf2('0x2c')][_0xccf2('0x49')](_0x3fd2d6)['then'](handleEntityNotFound(_0x3c75a1,null))[_0xccf2('0x22')](respondWithResult(_0x3c75a1,null))['catch'](handleError(_0x3c75a1,null));};exports['create']=function(_0x3ef565,_0x33af90){return db[_0xccf2('0x2c')][_0xccf2('0x4a')](_0x3ef565[_0xccf2('0x4b')],{})[_0xccf2('0x22')](function(_0x21662f){var _0x1cf5ce=_0x3ef565[_0xccf2('0x4c')][_0xccf2('0x24')]({'plain':!![]});if(!_0x1cf5ce)throw new Error(_0xccf2('0x4d'));if(_0x1cf5ce['role']===_0xccf2('0x4c')){var _0x34788a=_0x21662f[_0xccf2('0x24')]({'plain':!![]});var _0x573079=_0xccf2('0x25');return db['UserProfileSection'][_0xccf2('0x49')]({'where':{'name':_0x573079,'userProfileId':_0x1cf5ce[_0xccf2('0x4e')]},'raw':!![]})[_0xccf2('0x22')](function(_0x5f9ff1){if(_0x5f9ff1&&_0x5f9ff1[_0xccf2('0x4f')]===0x0){return db['UserProfileResource'][_0xccf2('0x4a')]({'name':_0x34788a[_0xccf2('0x29')],'resourceId':_0x34788a['id'],'type':_0x5f9ff1[_0xccf2('0x29')],'sectionId':_0x5f9ff1['id']},{})[_0xccf2('0x22')](function(){return _0x21662f;});}else{return _0x21662f;}})[_0xccf2('0x44')](function(_0x56df4e){logger[_0xccf2('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56df4e);throw _0x56df4e;});}return _0x21662f;})['then'](respondWithResult(_0x33af90,0xc9))[_0xccf2('0x44')](handleError(_0x33af90,null));};exports[_0xccf2('0x50')]=function(_0x8fa4d7,_0x3057da){if(_0x8fa4d7['body']['id']){delete _0x8fa4d7[_0xccf2('0x4b')]['id'];}return db[_0xccf2('0x2c')][_0xccf2('0x49')]({'where':{'id':_0x8fa4d7['params']['id']}})[_0xccf2('0x22')](handleEntityNotFound(_0x3057da,null))[_0xccf2('0x22')](saveUpdates(_0x8fa4d7[_0xccf2('0x4b')],null))[_0xccf2('0x22')](respondWithResult(_0x3057da,null))[_0xccf2('0x44')](handleError(_0x3057da,null));};exports[_0xccf2('0x23')]=function(_0x597c40,_0x413a84){return db[_0xccf2('0x2c')][_0xccf2('0x49')]({'where':{'id':_0x597c40[_0xccf2('0x46')]['id']}})[_0xccf2('0x22')](handleEntityNotFound(_0x413a84,null))['then'](removeEntity(_0x413a84,null))[_0xccf2('0x44')](handleError(_0x413a84,null));};exports[_0xccf2('0x51')]=function(_0x1142f6,_0x2f5d12,_0x1324cb){return db[_0xccf2('0x2c')][_0xccf2('0x52')]({'where':{'id':_0x1142f6['params']['id']}})[_0xccf2('0x22')](handleEntityNotFound(_0x2f5d12,null))[_0xccf2('0x22')](function(_0x4c63b2){var _0x1b8331;var _0xaeb96={},_0x4e1da3={};_0x4e1da3[_0xccf2('0x34')]=_['keys'](db['VoiceMailMessage'][_0xccf2('0x47')]);_0x4e1da3['query']=_[_0xccf2('0x32')](_0x1142f6[_0xccf2('0x31')]);_0x4e1da3['filters']=_[_0xccf2('0x36')](_0x4e1da3[_0xccf2('0x34')],_0x4e1da3[_0xccf2('0x31')]);_0xaeb96[_0xccf2('0x35')]=_['intersection'](_0x4e1da3[_0xccf2('0x34')],qs['fields'](_0x1142f6['query'][_0xccf2('0x37')]));_0xaeb96['attributes']=_0xaeb96['attributes'][_0xccf2('0x38')]?_0xaeb96[_0xccf2('0x35')]:_0x4e1da3[_0xccf2('0x34')];if(!_0x1142f6[_0xccf2('0x31')][_0xccf2('0x39')]('nolimit')){_0xaeb96[_0xccf2('0x1e')]=qs[_0xccf2('0x1e')](_0x1142f6[_0xccf2('0x31')][_0xccf2('0x1e')]);_0xaeb96[_0xccf2('0x1d')]=qs[_0xccf2('0x1d')](_0x1142f6[_0xccf2('0x31')]['offset']);}_0xaeb96[_0xccf2('0x3a')]=qs['sort'](_0x1142f6[_0xccf2('0x31')]['sort']);_0xaeb96[_0xccf2('0x3c')]=qs[_0xccf2('0x33')](_[_0xccf2('0x53')](_0x1142f6[_0xccf2('0x31')],_0x4e1da3[_0xccf2('0x33')]));if(_0x1142f6[_0xccf2('0x31')][_0xccf2('0x54')]){_0xaeb96['where']=_[_0xccf2('0x3d')](_0xaeb96[_0xccf2('0x3c')],{'$or':_[_0xccf2('0x30')](_0xaeb96[_0xccf2('0x35')],function(_0x25dcc6){var _0x18cd0c={};_0x18cd0c[_0x25dcc6]={'$like':'%'+_0x1142f6[_0xccf2('0x31')][_0xccf2('0x54')]+'%'};return _0x18cd0c;})});}_0xaeb96['where']=_['merge'](_0xaeb96[_0xccf2('0x3c')],{'mailboxuser':_0x4c63b2[_0xccf2('0x55')]});_0xaeb96=_['merge']({},_0xaeb96,_0x1142f6[_0xccf2('0x3f')]);return db[_0xccf2('0x56')][_0xccf2('0x57')](_0xaeb96)['then'](respondWithFilteredResult(_0x2f5d12,_0xaeb96));})[_0xccf2('0x44')](handleError(_0x2f5d12,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d3d0f3f..3989147 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 _0x5e74=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail','mailbox_context','mailbox','lodash','util'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x5e74,0xc1));var _0x45e7=function(_0x30345a,_0x2575ed){_0x30345a=_0x30345a-0x0;var _0x1eb8b2=_0x5e74[_0x30345a];return _0x1eb8b2;};'use strict';var _=require(_0x45e7('0x0'));var util=require(_0x45e7('0x1'));var logger=require(_0x45e7('0x2'))(_0x45e7('0x3'));var moment=require(_0x45e7('0x4'));var BPromise=require(_0x45e7('0x5'));var rp=require(_0x45e7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45e7('0x7'));var config=require(_0x45e7('0x8'));var attributes=require(_0x45e7('0x9'));module['exports']=function(_0x82c29c,_0x3a2527){return _0x82c29c['define'](_0x45e7('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x45e7('0xb'),'fields':[_0x45e7('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2dfb=['rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','moment','bluebird','request-promise','path'];(function(_0x506380,_0x4cc05e){var _0x2d7d52=function(_0x5a7c5f){while(--_0x5a7c5f){_0x506380['push'](_0x506380['shift']());}};_0x2d7d52(++_0x4cc05e);}(_0x2dfb,0x171));var _0xb2df=function(_0x347aa9,_0x4052dc){_0x347aa9=_0x347aa9-0x0;var _0x2954f6=_0x2dfb[_0x347aa9];return _0x2954f6;};'use strict';var _=require(_0xb2df('0x0'));var util=require(_0xb2df('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb2df('0x2'));var BPromise=require(_0xb2df('0x3'));var rp=require(_0xb2df('0x4'));var fs=require('fs');var path=require(_0xb2df('0x5'));var rimraf=require(_0xb2df('0x6'));var config=require(_0xb2df('0x7'));var attributes=require('./voiceMail.attributes');module[_0xb2df('0x8')]=function(_0x428cc5,_0xa56a34){return _0x428cc5[_0xb2df('0x9')](_0xb2df('0xa'),attributes,{'tableName':_0xb2df('0xb'),'paranoid':![],'indexes':[{'name':_0xb2df('0xc'),'fields':[_0xb2df('0xd'),_0xb2df('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 68d70f3..8f4b50b 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 _0x9005=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4d9ca0,_0x2e8a06){var _0x5cfe93=function(_0x40f0c6){while(--_0x40f0c6){_0x4d9ca0['push'](_0x4d9ca0['shift']());}};_0x5cfe93(++_0x2e8a06);}(_0x9005,0x72));var _0x5900=function(_0x498e17,_0x4ab0ee){_0x498e17=_0x498e17-0x0;var _0x73957b=_0x9005[_0x498e17];return _0x73957b;};'use strict';var _=require(_0x5900('0x0'));var util=require(_0x5900('0x1'));var moment=require('moment');var BPromise=require(_0x5900('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5900('0x3'));var db=require(_0x5900('0x4'))['db'];var utils=require(_0x5900('0x5'));var logger=require(_0x5900('0x6'))('rpc');var config=require(_0x5900('0x7'));var jayson=require(_0x5900('0x8'));var client=jayson[_0x5900('0x9')][_0x5900('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x80f801,_0x28aee5,_0x2f58ce){return new BPromise(function(_0x1b45fb,_0x38470f){return client['request'](_0x80f801,_0x2f58ce)[_0x5900('0xb')](function(_0x171ddb){logger['info'](_0x5900('0xc'),_0x28aee5,_0x5900('0xd'));logger[_0x5900('0xe')](_0x5900('0xf'),_0x28aee5,'request\x20sent',JSON[_0x5900('0x10')](_0x171ddb));if(_0x171ddb[_0x5900('0x11')]){if(_0x171ddb[_0x5900('0x11')][_0x5900('0x12')]===0x1f4){logger['error'](_0x5900('0xc'),_0x28aee5,_0x171ddb[_0x5900('0x11')]['message']);return _0x38470f(_0x171ddb[_0x5900('0x11')][_0x5900('0x13')]);}logger[_0x5900('0x11')](_0x5900('0xc'),_0x28aee5,_0x171ddb['error'][_0x5900('0x13')]);return _0x1b45fb(_0x171ddb['error'][_0x5900('0x13')]);}else{logger[_0x5900('0x14')](_0x5900('0xc'),_0x28aee5,_0x5900('0xd'));_0x1b45fb(_0x171ddb[_0x5900('0x15')]['message']);}})[_0x5900('0x16')](function(_0x55a9d7){logger[_0x5900('0x11')]('VoiceMail,\x20%s,\x20%s',_0x28aee5,_0x55a9d7);_0x38470f(_0x55a9d7);});});} \ No newline at end of file +var _0x591f=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','bluebird'];(function(_0x35de35,_0x550728){var _0x74089=function(_0x240098){while(--_0x240098){_0x35de35['push'](_0x35de35['shift']());}};_0x74089(++_0x550728);}(_0x591f,0x1d2));var _0xf591=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x591f[_0x355ce8];return _0x1db8b8;};'use strict';var _=require(_0xf591('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf591('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf591('0x2'));var db=require(_0xf591('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf591('0x4'))(_0xf591('0x5'));var config=require(_0xf591('0x6'));var jayson=require(_0xf591('0x7'));var client=jayson[_0xf591('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x278deb,_0x55fa30,_0x3a69df){return new BPromise(function(_0x439745,_0x157203){return client[_0xf591('0x9')](_0x278deb,_0x3a69df)[_0xf591('0xa')](function(_0x306f79){logger[_0xf591('0xb')](_0xf591('0xc'),_0x55fa30,_0xf591('0xd'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x55fa30,'request\x20sent',JSON[_0xf591('0xe')](_0x306f79));if(_0x306f79[_0xf591('0xf')]){if(_0x306f79[_0xf591('0xf')][_0xf591('0x10')]===0x1f4){logger[_0xf591('0xf')]('VoiceMail,\x20%s,\x20%s',_0x55fa30,_0x306f79[_0xf591('0xf')]['message']);return _0x157203(_0x306f79['error'][_0xf591('0x11')]);}logger[_0xf591('0xf')](_0xf591('0xc'),_0x55fa30,_0x306f79[_0xf591('0xf')]['message']);return _0x439745(_0x306f79['error'][_0xf591('0x11')]);}else{logger[_0xf591('0xb')](_0xf591('0xc'),_0x55fa30,_0xf591('0xd'));_0x439745(_0x306f79['result'][_0xf591('0x11')]);}})['catch'](function(_0x4b49ab){logger['error'](_0xf591('0xc'),_0x55fa30,_0x4b49ab);_0x157203(_0x4b49ab);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8160c18..3a4d7c0 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 _0x4819=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x51f9bf,_0x24d5b7){var _0x2986e3=function(_0x1fcc2f){while(--_0x1fcc2f){_0x51f9bf['push'](_0x51f9bf['shift']());}};_0x2986e3(++_0x24d5b7);}(_0x4819,0xcd));var _0x9481=function(_0x56d1ed,_0x237e84){_0x56d1ed=_0x56d1ed-0x0;var _0x1b282b=_0x4819[_0x56d1ed];return _0x1b282b;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0x9')](_0x9481('0xd'),auth[_0x9481('0xb')](),controller['download']);router[_0x9481('0xe')]('/',auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['put'](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);router[_0x9481('0x12')](_0x9481('0x10'),auth[_0x9481('0xb')](),controller[_0x9481('0x13')]);module[_0x9481('0x14')]=router; \ No newline at end of file +var _0xf494=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x4b0b17,_0x1bb70f){var _0x670de5=function(_0x2e7163){while(--_0x2e7163){_0x4b0b17['push'](_0x4b0b17['shift']());}};_0x670de5(++_0x1bb70f);}(_0xf494,0x1c6));var _0x4f49=function(_0x4b78ae,_0x2b474f){_0x4b78ae=_0x4b78ae-0x0;var _0x4ae393=_0xf494[_0x4b78ae];return _0x4ae393;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0x9')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);router['delete'](_0x4f49('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f49('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b2fea96..cf13797 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 _0x3736=['getDataValue','INTEGER','STRING','BLOB','long','sequelize','exports','VIRTUAL'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3736,0x1bd));var _0x6373=function(_0x1e3daa,_0x2d1211){_0x1e3daa=_0x1e3daa-0x0;var _0x563a1f=_0x3736[_0x1e3daa];return _0x563a1f;};'use strict';var Sequelize=require(_0x6373('0x0'));module[_0x6373('0x1')]={'name':{'type':Sequelize[_0x6373('0x2')],'get':function(_0xb72f93){return this[_0x6373('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x6373('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x6373('0x6')](_0x6373('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6373('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x9ba2=['TIMESTAMP','exports','STRING','long'];(function(_0x18b25f,_0x211d30){var _0x5795ff=function(_0x2db9c7){while(--_0x2db9c7){_0x18b25f['push'](_0x18b25f['shift']());}};_0x5795ff(++_0x211d30);}(_0x9ba2,0xed));var _0x29ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ba2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x29ba('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x289be3){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'context':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'callerid':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'origtime':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'duration':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x29ba('0x2')),'defaultValue':null},'flag':{'type':Sequelize[_0x29ba('0x1')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x29ba('0x3'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5825497..783677e 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 _0x9434=['intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters'];(function(_0x503197,_0x425026){var _0xc2557c=function(_0x176366){while(--_0x176366){_0x503197['push'](_0x503197['shift']());}};_0xc2557c(++_0x425026);}(_0x9434,0x168));var _0x4943=function(_0x3d6f24,_0x1aefdb){_0x3d6f24=_0x3d6f24-0x0;var _0xb656d2=_0x9434[_0x3d6f24];return _0xb656d2;};'use strict';var pdf=require(_0x4943('0x0'));var emlformat=require(_0x4943('0x1'));var rimraf=require(_0x4943('0x2'));var zipdir=require(_0x4943('0x3'));var jsonpatch=require(_0x4943('0x4'));var rp=require(_0x4943('0x5'));var moment=require('moment');var BPromise=require(_0x4943('0x6'));var Mustache=require(_0x4943('0x7'));var util=require('util');var path=require(_0x4943('0x8'));var sox=require(_0x4943('0x9'));var csv=require('to-csv');var ejs=require(_0x4943('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4943('0xb'));var jsforce=require(_0x4943('0xc'));var deskjs=require(_0x4943('0xd'));var toCsv=require(_0x4943('0xe'));var querystring=require(_0x4943('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4943('0x10'));var qs=require(_0x4943('0x11'));var as=require(_0x4943('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4943('0x13'))(_0x4943('0x14'));var utils=require('../../config/utils');var config=require(_0x4943('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x590f41,_0x943461){_0x943461=_0x943461||0xcc;return function(_0x1e95be){if(_0x1e95be){return _0x590f41[_0x4943('0x16')](_0x943461);}return _0x590f41[_0x4943('0x17')](_0x943461)[_0x4943('0x18')]();};}function respondWithResult(_0x24bdd7,_0x4077f1){_0x4077f1=_0x4077f1||0xc8;return function(_0x524c8a){if(_0x524c8a){return _0x24bdd7[_0x4943('0x17')](_0x4077f1)[_0x4943('0x19')](_0x524c8a);}};}function respondWithFilteredResult(_0x2ae9b5,_0x13d758){return function(_0x37c843){if(_0x37c843){var _0x39b4e3=_0x37c843[_0x4943('0x1a')],_0x4b075e=_0x13d758['offset'],_0x26b707=_0x13d758['offset']+_0x13d758[_0x4943('0x1b')],_0x407485;if(_0x26b707>=_0x39b4e3){_0x26b707=_0x39b4e3;_0x407485=0xc8;}else{_0x407485=0xce;}_0x2ae9b5['status'](_0x407485);return _0x2ae9b5[_0x4943('0x1c')](_0x4943('0x1d'),_0x4b075e+'-'+_0x26b707+'/'+_0x39b4e3)['json'](_0x37c843);}return null;};}function patchUpdates(_0x156c8c){return function(_0x12c0c4){try{jsonpatch[_0x4943('0x1e')](_0x12c0c4,_0x156c8c,!![]);}catch(_0x494bef){return BPromise[_0x4943('0x1f')](_0x494bef);}return _0x12c0c4['save']();};}function saveUpdates(_0x2833ed,_0x52fa3b){return function(_0x258079){if(_0x258079){return _0x258079[_0x4943('0x20')](_0x2833ed)[_0x4943('0x21')](function(_0x44bbe4){return _0x44bbe4;});}return null;};}function removeEntity(_0x508c36,_0x1ceb6f){return function(_0x205eb2){if(_0x205eb2){return _0x205eb2[_0x4943('0x22')]()[_0x4943('0x21')](function(){_0x508c36[_0x4943('0x17')](0xcc)[_0x4943('0x18')]();});}};}function handleEntityNotFound(_0x793d18,_0x340077){return function(_0x5dd061){if(!_0x5dd061){_0x793d18['sendStatus'](0x194);}return _0x5dd061;};}function handleError(_0x315c7f,_0x127a53){_0x127a53=_0x127a53||0x1f4;return function(_0x426543){logger['error'](_0x426543[_0x4943('0x23')]);if(_0x426543[_0x4943('0x24')]){delete _0x426543['name'];}_0x315c7f[_0x4943('0x17')](_0x127a53)[_0x4943('0x25')](_0x426543);};}exports[_0x4943('0x26')]=function(_0x24e6e1,_0x35f393){var _0x16eba6={},_0x307478={},_0x169ced={'count':0x0,'rows':[]};var _0x3c1c15=_[_0x4943('0x27')](db[_0x4943('0x28')][_0x4943('0x29')],function(_0xa71fec){return{'name':_0xa71fec[_0x4943('0x2a')],'type':_0xa71fec[_0x4943('0x2b')][_0x4943('0x2c')]};});_0x307478[_0x4943('0x2d')]=_[_0x4943('0x2e')](_['map'](_0x3c1c15,_0x4943('0x24')),['name']);_0x307478[_0x4943('0x2f')]=_[_0x4943('0x30')](_0x24e6e1[_0x4943('0x2f')]);_0x307478[_0x4943('0x31')]=_[_0x4943('0x32')](_0x307478[_0x4943('0x2d')],_0x307478[_0x4943('0x2f')]);_0x16eba6[_0x4943('0x33')]=_['intersection'](_0x307478[_0x4943('0x2d')],qs[_0x4943('0x34')](_0x24e6e1['query'][_0x4943('0x34')]));_0x16eba6[_0x4943('0x33')]=_0x16eba6['attributes'][_0x4943('0x35')]?_0x16eba6[_0x4943('0x33')]:_0x307478[_0x4943('0x2d')];if(!_0x24e6e1['query'][_0x4943('0x36')](_0x4943('0x37'))){_0x16eba6[_0x4943('0x1b')]=qs[_0x4943('0x1b')](_0x24e6e1[_0x4943('0x2f')]['limit']);_0x16eba6[_0x4943('0x38')]=qs[_0x4943('0x38')](_0x24e6e1[_0x4943('0x2f')][_0x4943('0x38')]);}_0x16eba6[_0x4943('0x39')]=qs[_0x4943('0x3a')](_0x24e6e1[_0x4943('0x2f')][_0x4943('0x3a')]);_0x16eba6[_0x4943('0x3b')]=qs[_0x4943('0x31')](_[_0x4943('0x3c')](_0x24e6e1['query'],_0x307478[_0x4943('0x31')]),_0x3c1c15);if(_0x24e6e1[_0x4943('0x2f')][_0x4943('0x3d')]){_0x16eba6[_0x4943('0x3b')]=_[_0x4943('0x3e')](_0x16eba6['where'],{'$or':_['map'](_0x3c1c15,function(_0x4ac894){if(_0x4ac894[_0x4943('0x2b')]!==_0x4943('0x3f')){var _0x5876f6={};_0x5876f6[_0x4ac894[_0x4943('0x24')]]={'$like':'%'+_0x24e6e1['query'][_0x4943('0x3d')]+'%'};return _0x5876f6;}})});}_0x16eba6=_[_0x4943('0x3e')]({},_0x16eba6,_0x24e6e1[_0x4943('0x40')]);var _0x3d49d5={'where':_0x16eba6[_0x4943('0x3b')]};return db[_0x4943('0x28')][_0x4943('0x1a')](_0x3d49d5)[_0x4943('0x21')](function(_0x41eaff){_0x169ced[_0x4943('0x1a')]=_0x41eaff;if(_0x24e6e1[_0x4943('0x2f')][_0x4943('0x41')]){_0x16eba6[_0x4943('0x42')]=[{'all':!![]}];}return db[_0x4943('0x28')][_0x4943('0x43')](_0x16eba6);})[_0x4943('0x21')](function(_0xbe0e00){_0x169ced[_0x4943('0x44')]=_0xbe0e00;return _0x169ced;})[_0x4943('0x21')](respondWithFilteredResult(_0x35f393,_0x16eba6))[_0x4943('0x45')](handleError(_0x35f393,null));};exports[_0x4943('0x46')]=function(_0x11ee4a,_0x44f32a){var _0x32785c={'raw':!![],'where':{'id':_0x11ee4a[_0x4943('0x47')]['id']}},_0x32e4c1={};_0x32e4c1[_0x4943('0x2d')]=_['keys'](db[_0x4943('0x28')][_0x4943('0x29')]);_0x32e4c1['query']=_['keys'](_0x11ee4a[_0x4943('0x2f')]);_0x32e4c1['filters']=_[_0x4943('0x32')](_0x32e4c1['model'],_0x32e4c1[_0x4943('0x2f')]);_0x32785c['attributes']=_[_0x4943('0x32')](_0x32e4c1['model'],qs[_0x4943('0x34')](_0x11ee4a[_0x4943('0x2f')][_0x4943('0x34')]));_0x32785c['attributes']=_0x32785c['attributes'][_0x4943('0x35')]?_0x32785c['attributes']:_0x32e4c1[_0x4943('0x2d')];if(_0x11ee4a['query'][_0x4943('0x41')]){_0x32785c[_0x4943('0x42')]=[{'all':!![]}];}_0x32785c=_[_0x4943('0x3e')]({},_0x32785c,_0x11ee4a[_0x4943('0x40')]);return db['VoiceMailMessage']['find'](_0x32785c)[_0x4943('0x21')](handleEntityNotFound(_0x44f32a,null))['then'](respondWithResult(_0x44f32a,null))['catch'](handleError(_0x44f32a,null));};exports[_0x4943('0x48')]=function(_0x457821,_0xd5e1b3){return db[_0x4943('0x28')][_0x4943('0x48')](_0x457821[_0x4943('0x49')],{})[_0x4943('0x21')](respondWithResult(_0xd5e1b3,0xc9))['catch'](handleError(_0xd5e1b3,null));};exports[_0x4943('0x20')]=function(_0x10aa6a,_0x55ce10){if(_0x10aa6a[_0x4943('0x49')]['id']){delete _0x10aa6a[_0x4943('0x49')]['id'];}return db[_0x4943('0x28')]['find']({'where':{'id':_0x10aa6a[_0x4943('0x47')]['id']}})[_0x4943('0x21')](handleEntityNotFound(_0x55ce10,null))['then'](saveUpdates(_0x10aa6a[_0x4943('0x49')],null))[_0x4943('0x21')](respondWithResult(_0x55ce10,null))['catch'](handleError(_0x55ce10,null));};exports[_0x4943('0x22')]=function(_0x346a6d,_0x289af4){return db['VoiceMailMessage'][_0x4943('0x4a')]({'where':{'id':_0x346a6d['params']['id']}})['then'](handleEntityNotFound(_0x289af4,null))[_0x4943('0x21')](removeEntity(_0x289af4,null))[_0x4943('0x45')](handleError(_0x289af4,null));};exports[_0x4943('0x4b')]=function(_0x5bca66,_0x582156,_0x4d9968){return db[_0x4943('0x28')]['find']({'where':{'id':_0x5bca66['params']['id']},'attributes':['id',_0x4943('0x4c'),'msg_id']})['then'](handleEntityNotFound(_0x582156,null))['then'](function(_0x40e75f){if(_0x40e75f){if(!_0x40e75f[_0x4943('0x4c')]){throw new db[(_0x4943('0x4d'))]['ValidationError'](_0x4943('0x4e'));}var _0x2d8c47={'Content-Type':_0x4943('0x4f'),'Content-Disposition':'attachment'};if(_0x40e75f[_0x4943('0x50')]){_0x2d8c47[_0x4943('0x51')]='attachment;\x20filename=\x22'+_0x40e75f['msg_id']+'.wav\x22';}_0x582156['set'](_0x2d8c47);return _0x582156[_0x4943('0x25')](new Buffer(_0x40e75f[_0x4943('0x4c')]));}})[_0x4943('0x45')](handleError(_0x582156,null));}; \ No newline at end of file +var _0xf4eb=['filter','where','merge','includeAll','findAll','rows','catch','params','length','include','options','find','create','body','download','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','set','html-pdf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','VoiceMailMessage','rawAttributes','type','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort'];(function(_0x5e478b,_0x35e449){var _0x39a83d=function(_0x516dec){while(--_0x516dec){_0x5e478b['push'](_0x5e478b['shift']());}};_0x39a83d(++_0x35e449);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5e5e7c,_0x2cb10f){_0x5e5e7c=_0x5e5e7c-0x0;var _0x57f929=_0xf4eb[_0x5e5e7c];return _0x57f929;};'use strict';var pdf=require(_0xbf4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4e('0x2'));var util=require(_0xbf4e('0x3'));var path=require(_0xbf4e('0x4'));var sox=require(_0xbf4e('0x5'));var csv=require(_0xbf4e('0x6'));var ejs=require(_0xbf4e('0x7'));var fs=require('fs');var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x6'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var db=require(_0xbf4e('0x12'))['db'];function respondWithStatusCode(_0x54a96e,_0x17fd01){_0x17fd01=_0x17fd01||0xcc;return function(_0x5a3035){if(_0x5a3035){return _0x54a96e['sendStatus'](_0x17fd01);}return _0x54a96e[_0xbf4e('0x13')](_0x17fd01)[_0xbf4e('0x14')]();};}function respondWithResult(_0x1e029b,_0x302841){_0x302841=_0x302841||0xc8;return function(_0x3b74bd){if(_0x3b74bd){return _0x1e029b[_0xbf4e('0x13')](_0x302841)['json'](_0x3b74bd);}};}function respondWithFilteredResult(_0x59fb15,_0x180432){return function(_0x1735ae){if(_0x1735ae){var _0x28fc6b=_0x1735ae[_0xbf4e('0x15')],_0x542909=_0x180432[_0xbf4e('0x16')],_0x14110b=_0x180432['offset']+_0x180432[_0xbf4e('0x17')],_0x2c292c;if(_0x14110b>=_0x28fc6b){_0x14110b=_0x28fc6b;_0x2c292c=0xc8;}else{_0x2c292c=0xce;}_0x59fb15['status'](_0x2c292c);return _0x59fb15['set']('Content-Range',_0x542909+'-'+_0x14110b+'/'+_0x28fc6b)['json'](_0x1735ae);}return null;};}function patchUpdates(_0x35992b){return function(_0x1ca73c){try{jsonpatch[_0xbf4e('0x18')](_0x1ca73c,_0x35992b,!![]);}catch(_0x4d9c2a){return BPromise['reject'](_0x4d9c2a);}return _0x1ca73c[_0xbf4e('0x19')]();};}function saveUpdates(_0x9a46ee,_0x3be138){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b[_0xbf4e('0x1a')](_0x9a46ee)[_0xbf4e('0x1b')](function(_0x415963){return _0x415963;});}return null;};}function removeEntity(_0x3d642a,_0xd09e12){return function(_0x376832){if(_0x376832){return _0x376832[_0xbf4e('0x1c')]()['then'](function(){_0x3d642a[_0xbf4e('0x13')](0xcc)[_0xbf4e('0x14')]();});}};}function handleEntityNotFound(_0x51648c,_0x31e3f5){return function(_0x30994d){if(!_0x30994d){_0x51648c[_0xbf4e('0x1d')](0x194);}return _0x30994d;};}function handleError(_0x1bda8b,_0x3a5d72){_0x3a5d72=_0x3a5d72||0x1f4;return function(_0x4a0243){logger[_0xbf4e('0x1e')](_0x4a0243[_0xbf4e('0x1f')]);if(_0x4a0243[_0xbf4e('0x20')]){delete _0x4a0243['name'];}_0x1bda8b[_0xbf4e('0x13')](_0x3a5d72)['send'](_0x4a0243);};}exports['index']=function(_0x2bfccf,_0x5a0a9b){var _0x38c923={},_0x315df3={},_0x4021a9={'count':0x0,'rows':[]};var _0x41f918=_['map'](db[_0xbf4e('0x21')][_0xbf4e('0x22')],function(_0x43879d){return{'name':_0x43879d['fieldName'],'type':_0x43879d[_0xbf4e('0x23')]['key']};});_0x315df3[_0xbf4e('0x24')]=_[_0xbf4e('0x25')](_[_0xbf4e('0x26')](_0x41f918,'name'),[_0xbf4e('0x20')]);_0x315df3[_0xbf4e('0x27')]=_[_0xbf4e('0x28')](_0x2bfccf[_0xbf4e('0x27')]);_0x315df3[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x315df3['model'],_0x315df3[_0xbf4e('0x27')]);_0x38c923[_0xbf4e('0x2b')]=_['intersection'](_0x315df3[_0xbf4e('0x24')],qs[_0xbf4e('0x2c')](_0x2bfccf['query'][_0xbf4e('0x2c')]));_0x38c923['attributes']=_0x38c923[_0xbf4e('0x2b')]['length']?_0x38c923[_0xbf4e('0x2b')]:_0x315df3[_0xbf4e('0x24')];if(!_0x2bfccf[_0xbf4e('0x27')]['hasOwnProperty'](_0xbf4e('0x2d'))){_0x38c923[_0xbf4e('0x17')]=qs[_0xbf4e('0x17')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x17')]);_0x38c923[_0xbf4e('0x16')]=qs['offset'](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x16')]);}_0x38c923[_0xbf4e('0x2e')]=qs[_0xbf4e('0x2f')](_0x2bfccf[_0xbf4e('0x27')]['sort']);_0x38c923['where']=qs['filters'](_['pick'](_0x2bfccf[_0xbf4e('0x27')],_0x315df3[_0xbf4e('0x29')]),_0x41f918);if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x30')]){_0x38c923[_0xbf4e('0x31')]=_[_0xbf4e('0x32')](_0x38c923[_0xbf4e('0x31')],{'$or':_[_0xbf4e('0x26')](_0x41f918,function(_0x1f36aa){if(_0x1f36aa['type']!=='VIRTUAL'){var _0x303fd8={};_0x303fd8[_0x1f36aa[_0xbf4e('0x20')]]={'$like':'%'+_0x2bfccf[_0xbf4e('0x27')]['filter']+'%'};return _0x303fd8;}})});}_0x38c923=_[_0xbf4e('0x32')]({},_0x38c923,_0x2bfccf['options']);var _0x370d90={'where':_0x38c923[_0xbf4e('0x31')]};return db[_0xbf4e('0x21')][_0xbf4e('0x15')](_0x370d90)['then'](function(_0x31d8dc){_0x4021a9[_0xbf4e('0x15')]=_0x31d8dc;if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x33')]){_0x38c923['include']=[{'all':!![]}];}return db[_0xbf4e('0x21')][_0xbf4e('0x34')](_0x38c923);})[_0xbf4e('0x1b')](function(_0x29fe9d){_0x4021a9[_0xbf4e('0x35')]=_0x29fe9d;return _0x4021a9;})[_0xbf4e('0x1b')](respondWithFilteredResult(_0x5a0a9b,_0x38c923))[_0xbf4e('0x36')](handleError(_0x5a0a9b,null));};exports['show']=function(_0x176166,_0x7b3a94){var _0x518400={'raw':!![],'where':{'id':_0x176166[_0xbf4e('0x37')]['id']}},_0x47d6f2={};_0x47d6f2[_0xbf4e('0x24')]=_['keys'](db['VoiceMailMessage'][_0xbf4e('0x22')]);_0x47d6f2[_0xbf4e('0x27')]=_[_0xbf4e('0x28')](_0x176166[_0xbf4e('0x27')]);_0x47d6f2[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x47d6f2['model'],_0x47d6f2[_0xbf4e('0x27')]);_0x518400[_0xbf4e('0x2b')]=_['intersection'](_0x47d6f2['model'],qs['fields'](_0x176166['query'][_0xbf4e('0x2c')]));_0x518400['attributes']=_0x518400[_0xbf4e('0x2b')][_0xbf4e('0x38')]?_0x518400['attributes']:_0x47d6f2['model'];if(_0x176166[_0xbf4e('0x27')][_0xbf4e('0x33')]){_0x518400[_0xbf4e('0x39')]=[{'all':!![]}];}_0x518400=_[_0xbf4e('0x32')]({},_0x518400,_0x176166[_0xbf4e('0x3a')]);return db['VoiceMailMessage'][_0xbf4e('0x3b')](_0x518400)[_0xbf4e('0x1b')](handleEntityNotFound(_0x7b3a94,null))[_0xbf4e('0x1b')](respondWithResult(_0x7b3a94,null))[_0xbf4e('0x36')](handleError(_0x7b3a94,null));};exports[_0xbf4e('0x3c')]=function(_0x1bc421,_0x4060c7){return db[_0xbf4e('0x21')]['create'](_0x1bc421[_0xbf4e('0x3d')],{})[_0xbf4e('0x1b')](respondWithResult(_0x4060c7,0xc9))[_0xbf4e('0x36')](handleError(_0x4060c7,null));};exports[_0xbf4e('0x1a')]=function(_0x9bc1fe,_0x1198e8){if(_0x9bc1fe[_0xbf4e('0x3d')]['id']){delete _0x9bc1fe[_0xbf4e('0x3d')]['id'];}return db[_0xbf4e('0x21')][_0xbf4e('0x3b')]({'where':{'id':_0x9bc1fe[_0xbf4e('0x37')]['id']}})[_0xbf4e('0x1b')](handleEntityNotFound(_0x1198e8,null))[_0xbf4e('0x1b')](saveUpdates(_0x9bc1fe[_0xbf4e('0x3d')],null))[_0xbf4e('0x1b')](respondWithResult(_0x1198e8,null))[_0xbf4e('0x36')](handleError(_0x1198e8,null));};exports[_0xbf4e('0x1c')]=function(_0x5492bf,_0x22d8ef){return db[_0xbf4e('0x21')][_0xbf4e('0x3b')]({'where':{'id':_0x5492bf['params']['id']}})[_0xbf4e('0x1b')](handleEntityNotFound(_0x22d8ef,null))['then'](removeEntity(_0x22d8ef,null))['catch'](handleError(_0x22d8ef,null));};exports[_0xbf4e('0x3e')]=function(_0x200393,_0x4d32b3,_0x22e73b){return db[_0xbf4e('0x21')][_0xbf4e('0x3b')]({'where':{'id':_0x200393[_0xbf4e('0x37')]['id']},'attributes':['id',_0xbf4e('0x3f'),_0xbf4e('0x40')]})[_0xbf4e('0x1b')](handleEntityNotFound(_0x4d32b3,null))[_0xbf4e('0x1b')](function(_0x3cd61b){if(_0x3cd61b){if(!_0x3cd61b[_0xbf4e('0x3f')]){throw new db[(_0xbf4e('0x41'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0xad8934={'Content-Type':_0xbf4e('0x42'),'Content-Disposition':_0xbf4e('0x43')};if(_0x3cd61b['msg_id']){_0xad8934[_0xbf4e('0x44')]=_0xbf4e('0x45')+_0x3cd61b['msg_id']+'.wav\x22';}_0x4d32b3[_0xbf4e('0x46')](_0xad8934);return _0x4d32b3['send'](new Buffer(_0x3cd61b['recording']));}})[_0xbf4e('0x36')](handleError(_0x4d32b3,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f7f7e26..c83a0c7 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 _0x1beb=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0xbc22a3,_0x5e295c){var _0x141b85=function(_0x2dba61){while(--_0x2dba61){_0xbc22a3['push'](_0xbc22a3['shift']());}};_0x141b85(++_0x5e295c);}(_0x1beb,0x165));var _0xb1be=function(_0xd66922,_0x54da93){_0xd66922=_0xd66922-0x0;var _0xe23243=_0x1beb[_0xd66922];return _0xe23243;};'use strict';var _=require(_0xb1be('0x0'));var util=require(_0xb1be('0x1'));var logger=require('../../config/logger')(_0xb1be('0x2'));var moment=require(_0xb1be('0x3'));var BPromise=require(_0xb1be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1be('0x5'));var rimraf=require(_0xb1be('0x6'));var config=require('../../config/environment');var attributes=require(_0xb1be('0x7'));module[_0xb1be('0x8')]=function(_0x116394,_0xe36555){return _0x116394[_0xb1be('0x9')](_0xb1be('0xa'),attributes,{'tableName':_0xb1be('0xb'),'paranoid':![],'indexes':[{'name':_0xb1be('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x1619=['request-promise','rimraf','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','../../config/logger','moment','bluebird'];(function(_0x167a65,_0xa502d4){var _0x2e6e10=function(_0x2ba5f8){while(--_0x2ba5f8){_0x167a65['push'](_0x167a65['shift']());}};_0x2e6e10(++_0xa502d4);}(_0x1619,0x189));var _0x9161=function(_0x371d87,_0x147fab){_0x371d87=_0x371d87-0x0;var _0x31100e=_0x1619[_0x371d87];return _0x31100e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9161('0x0'))('api');var moment=require(_0x9161('0x1'));var BPromise=require(_0x9161('0x2'));var rp=require(_0x9161('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9161('0x4'));var config=require('../../config/environment');var attributes=require(_0x9161('0x5'));module['exports']=function(_0x50ed78,_0x1b006d){return _0x50ed78[_0x9161('0x6')]('VoiceMailMessage',attributes,{'tableName':_0x9161('0x7'),'paranoid':![],'indexes':[{'name':_0x9161('0x8'),'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 c283c5e..3f63cbd 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash'];(function(_0x562da6,_0x40c67c){var _0x4eec62=function(_0x50f694){while(--_0x50f694){_0x562da6['push'](_0x562da6['shift']());}};_0x4eec62(++_0x40c67c);}(_0x66fa,0x117));var _0xa66f=function(_0x3f8571,_0x33fe42){_0x3f8571=_0x3f8571-0x0;var _0x4fb83e=_0x66fa[_0x3f8571];return _0x4fb83e;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +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(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x1967,0x173));var _0x7196=function(_0x1e3248,_0x150ed2){_0x1e3248=_0x1e3248-0x0;var _0x20bfc1=_0x1967[_0x1e3248];return _0x20bfc1;};'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 diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 81ef087..742a51d 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 _0x98c3=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','/:id/sounds','isAuthenticated','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0x98c3,0xab));var _0x398c=function(_0x259e66,_0x11c49f){_0x259e66=_0x259e66-0x0;var _0x10e8ca=_0x98c3[_0x259e66];return _0x10e8ca;};'use strict';var multer=require(_0x398c('0x0'));var util=require(_0x398c('0x1'));var path=require(_0x398c('0x2'));var timeout=require(_0x398c('0x3'));var express=require(_0x398c('0x4'));var router=express[_0x398c('0x5')]();var auth=require(_0x398c('0x6'));var interaction=require(_0x398c('0x7'));var config=require(_0x398c('0x8'));var controller=require(_0x398c('0x9'));router[_0x398c('0xa')]('/',auth['isAuthenticated'](),controller[_0x398c('0xb')]);router['get'](_0x398c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x398c('0xa')](_0x398c('0xd'),auth[_0x398c('0xe')](),controller['getSounds']);router[_0x398c('0xf')]('/',auth[_0x398c('0xe')](),controller[_0x398c('0x10')]);router[_0x398c('0xf')](_0x398c('0xd'),auth[_0x398c('0xe')](),controller[_0x398c('0x11')]);router[_0x398c('0x12')]('/:id',auth[_0x398c('0xe')](),controller[_0x398c('0x13')]);router[_0x398c('0x14')]('/:id',auth[_0x398c('0xe')](),controller[_0x398c('0x15')]);router[_0x398c('0x14')](_0x398c('0x16'),auth['isAuthenticated'](),controller[_0x398c('0x17')]);module[_0x398c('0x18')]=router; \ No newline at end of file +var _0xd198=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','/:id/sounds','post','addSound','put','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3a3b29,_0x54ec1e){var _0x34d909=function(_0x3c4f0b){while(--_0x3c4f0b){_0x3a3b29['push'](_0x3a3b29['shift']());}};_0x34d909(++_0x54ec1e);}(_0xd198,0x7e));var _0x8d19=function(_0xb28d42,_0x36eeaf){_0xb28d42=_0xb28d42-0x0;var _0x496af2=_0xd198[_0xb28d42];return _0x496af2;};'use strict';var multer=require(_0x8d19('0x0'));var util=require(_0x8d19('0x1'));var path=require('path');var timeout=require(_0x8d19('0x2'));var express=require(_0x8d19('0x3'));var router=express[_0x8d19('0x4')]();var auth=require(_0x8d19('0x5'));var interaction=require(_0x8d19('0x6'));var config=require(_0x8d19('0x7'));var controller=require(_0x8d19('0x8'));router['get']('/',auth[_0x8d19('0x9')](),controller[_0x8d19('0xa')]);router[_0x8d19('0xb')](_0x8d19('0xc'),auth[_0x8d19('0x9')](),controller['show']);router[_0x8d19('0xb')](_0x8d19('0xd'),auth[_0x8d19('0x9')](),controller['getSounds']);router[_0x8d19('0xe')]('/',auth[_0x8d19('0x9')](),controller['create']);router[_0x8d19('0xe')](_0x8d19('0xd'),auth['isAuthenticated'](),controller[_0x8d19('0xf')]);router[_0x8d19('0x10')](_0x8d19('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8d19('0x11')](_0x8d19('0xc'),auth['isAuthenticated'](),controller[_0x8d19('0x12')]);router[_0x8d19('0x11')](_0x8d19('0x13'),auth[_0x8d19('0x9')](),controller[_0x8d19('0x14')]);module[_0x8d19('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d3fe92c..706fbd5 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 _0xdf7a=['mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf7a,0x18b));var _0xadf7=function(_0x131712,_0x2ed068){_0x131712=_0x131712-0x0;var _0x292b97=_0xdf7a[_0x131712];return _0x292b97;};'use strict';var Sequelize=require(_0xadf7('0x0'));module[_0xadf7('0x1')]={'name':{'type':Sequelize[_0xadf7('0x2')],'allowNull':![],'unique':_0xadf7('0x3')},'mode':{'type':Sequelize[_0xadf7('0x4')]('custom','files',_0xadf7('0x5'),_0xadf7('0x6'),_0xadf7('0x7'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xadf7('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xadf7('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xadf7('0x2')],'allowNull':!![],'defaultValue':_0xadf7('0x8')},'format':{'type':Sequelize[_0xadf7('0x2')],'allowNull':!![]},'stamp':{'type':_0xadf7('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbb69=['exports','name','ENUM','custom','files','mp3nb','quietmp3nb','STRING','alpha','TIMESTAMP','sequelize'];(function(_0x25c9c8,_0x194c44){var _0x21cb3e=function(_0x40c9ad){while(--_0x40c9ad){_0x25c9c8['push'](_0x25c9c8['shift']());}};_0x21cb3e(++_0x194c44);}(_0xbb69,0xba));var _0x9bb6=function(_0x3125dc,_0x28ee6d){_0x3125dc=_0x3125dc-0x0;var _0x1a0738=_0xbb69[_0x3125dc];return _0x1a0738;};'use strict';var Sequelize=require(_0x9bb6('0x0'));module[_0x9bb6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9bb6('0x2')},'mode':{'type':Sequelize[_0x9bb6('0x3')](_0x9bb6('0x4'),_0x9bb6('0x5'),_0x9bb6('0x6'),_0x9bb6('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x9bb6('0x5')},'directory':{'type':Sequelize[_0x9bb6('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x9bb6('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9bb6('0x8')],'allowNull':!![],'defaultValue':_0x9bb6('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x9bb6('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 942fc43..12007ca 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x64e803,_0x373f26){var _0x14a7dc=function(_0x156787){while(--_0x156787){_0x64e803['push'](_0x64e803['shift']());}};_0x14a7dc(++_0x373f26);}(_0xb10b,0x12a));var _0xbb10=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0xb10b[_0xf4d05];return _0x47c971;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file +var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x4ab787,_0xda251a){var _0x5061d9=function(_0x4f85ce){while(--_0x4f85ce){_0x4ab787['push'](_0x4ab787['shift']());}};_0x5061d9(++_0xda251a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b9e13,_0x3cdc73){_0x3b9e13=_0x3b9e13-0x0;var _0x4ea299=_0xb10b[_0x3b9e13];return _0x4ea299;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 8f59d59..dbbc917 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 _0x50e8=['define','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xbf1fbd,_0x10939a){var _0x17f0e4=function(_0x431e4d){while(--_0x431e4d){_0xbf1fbd['push'](_0xbf1fbd['shift']());}};_0x17f0e4(++_0x10939a);}(_0x50e8,0x91));var _0x850e=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x50e8[_0x187d80];return _0x498a77;};'use strict';var _=require(_0x850e('0x0'));var util=require(_0x850e('0x1'));var logger=require(_0x850e('0x2'))(_0x850e('0x3'));var moment=require(_0x850e('0x4'));var BPromise=require(_0x850e('0x5'));var rp=require(_0x850e('0x6'));var fs=require('fs');var path=require(_0x850e('0x7'));var rimraf=require(_0x850e('0x8'));var config=require(_0x850e('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x850e('0xa')]=function(_0x56605b,_0x29d993){return _0x56605b[_0x850e('0xb')](_0x850e('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4d1=['rimraf','../../config/environment','define','voice_musiconhold','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xd4d1,0x86));var _0x1d4d=function(_0x4d6581,_0x2609be){_0x4d6581=_0x4d6581-0x0;var _0x43c4aa=_0xd4d1[_0x4d6581];return _0x43c4aa;};'use strict';var _=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d4d('0x2'));var BPromise=require(_0x1d4d('0x3'));var rp=require(_0x1d4d('0x4'));var fs=require('fs');var path=require(_0x1d4d('0x5'));var rimraf=require(_0x1d4d('0x6'));var config=require(_0x1d4d('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x1278db,_0x43d04f){return _0x1278db[_0x1d4d('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x1d4d('0x9'),'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 7de2914..590c239 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 _0x3631=['request\x20sent','stringify','error','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3631,0x109));var _0x1363=function(_0x16bc92,_0x1b0935){_0x16bc92=_0x16bc92-0x0;var _0x27a2d2=_0x3631[_0x16bc92];return _0x27a2d2;};'use strict';var _=require('lodash');var util=require(_0x1363('0x0'));var moment=require(_0x1363('0x1'));var BPromise=require('bluebird');var rs=require(_0x1363('0x2'));var fs=require('fs');var Redis=require(_0x1363('0x3'));var db=require(_0x1363('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1363('0x5'))(_0x1363('0x6'));var config=require(_0x1363('0x7'));var jayson=require(_0x1363('0x8'));var client=jayson[_0x1363('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a1c1d,_0x459e90,_0x1ac0a9){return new BPromise(function(_0x1417e9,_0x299c70){return client[_0x1363('0xa')](_0x5a1c1d,_0x1ac0a9)['then'](function(_0x3665c7){logger[_0x1363('0xb')](_0x1363('0xc'),_0x459e90,'request\x20sent');logger[_0x1363('0xd')](_0x1363('0xe'),_0x459e90,_0x1363('0xf'),JSON[_0x1363('0x10')](_0x3665c7));if(_0x3665c7['error']){if(_0x3665c7[_0x1363('0x11')]['code']===0x1f4){logger[_0x1363('0x11')](_0x1363('0xc'),_0x459e90,_0x3665c7[_0x1363('0x11')][_0x1363('0x12')]);return _0x299c70(_0x3665c7[_0x1363('0x11')]['message']);}logger['error'](_0x1363('0xc'),_0x459e90,_0x3665c7[_0x1363('0x11')][_0x1363('0x12')]);return _0x1417e9(_0x3665c7[_0x1363('0x11')][_0x1363('0x12')]);}else{logger[_0x1363('0xb')](_0x1363('0xc'),_0x459e90,'request\x20sent');_0x1417e9(_0x3665c7[_0x1363('0x13')][_0x1363('0x12')]);}})['catch'](function(_0x125252){logger[_0x1363('0x11')](_0x1363('0xc'),_0x459e90,_0x125252);_0x299c70(_0x125252);});});} \ No newline at end of file +var _0x43b9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','message','info','util'];(function(_0x46eef5,_0x542bb8){var _0x2789fe=function(_0x5889ec){while(--_0x5889ec){_0x46eef5['push'](_0x46eef5['shift']());}};_0x2789fe(++_0x542bb8);}(_0x43b9,0x167));var _0x943b=function(_0x46b3f7,_0x37fb7d){_0x46b3f7=_0x46b3f7-0x0;var _0xfe5722=_0x43b9[_0x46b3f7];return _0xfe5722;};'use strict';var _=require('lodash');var util=require(_0x943b('0x0'));var moment=require(_0x943b('0x1'));var BPromise=require(_0x943b('0x2'));var rs=require(_0x943b('0x3'));var fs=require('fs');var Redis=require(_0x943b('0x4'));var db=require(_0x943b('0x5'))['db'];var utils=require(_0x943b('0x6'));var logger=require(_0x943b('0x7'))(_0x943b('0x8'));var config=require(_0x943b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x943b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17a676,_0x26bc15,_0x1c3734){return new BPromise(function(_0x452218,_0x5ea924){return client[_0x943b('0xb')](_0x17a676,_0x1c3734)[_0x943b('0xc')](function(_0x43c420){logger['info'](_0x943b('0xd'),_0x26bc15,_0x943b('0xe'));logger[_0x943b('0xf')](_0x943b('0x10'),_0x26bc15,_0x943b('0xe'),JSON['stringify'](_0x43c420));if(_0x43c420[_0x943b('0x11')]){if(_0x43c420[_0x943b('0x11')]['code']===0x1f4){logger[_0x943b('0x11')](_0x943b('0xd'),_0x26bc15,_0x43c420[_0x943b('0x11')][_0x943b('0x12')]);return _0x5ea924(_0x43c420[_0x943b('0x11')][_0x943b('0x12')]);}logger['error'](_0x943b('0xd'),_0x26bc15,_0x43c420[_0x943b('0x11')][_0x943b('0x12')]);return _0x452218(_0x43c420[_0x943b('0x11')][_0x943b('0x12')]);}else{logger[_0x943b('0x13')](_0x943b('0xd'),_0x26bc15,_0x943b('0xe'));_0x452218(_0x43c420['result'][_0x943b('0x12')]);}})['catch'](function(_0x95755a){logger['error'](_0x943b('0xd'),_0x26bc15,_0x95755a);_0x5ea924(_0x95755a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3ffc19b..f0517d9 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 _0x3d4f=['path','connect-timeout','express','Router','../../components/interaction/service','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','show','post','create','/:id/users','addAgents','put','/:id','update','delete','destroy','multer','util'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0x3d4f,0x9f));var _0xf3d4=function(_0x3de6c1,_0x4cb097){_0x3de6c1=_0x3de6c1-0x0;var _0x4453c8=_0x3d4f[_0x3de6c1];return _0x4453c8;};'use strict';var multer=require(_0xf3d4('0x0'));var util=require(_0xf3d4('0x1'));var path=require(_0xf3d4('0x2'));var timeout=require(_0xf3d4('0x3'));var express=require(_0xf3d4('0x4'));var router=express[_0xf3d4('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf3d4('0x6'));var config=require('../../config/environment');var controller=require(_0xf3d4('0x7'));router[_0xf3d4('0x8')]('/',auth['isAuthenticated'](),controller[_0xf3d4('0x9')]);router['get'](_0xf3d4('0xa'),auth[_0xf3d4('0xb')](),controller[_0xf3d4('0xc')]);router[_0xf3d4('0x8')]('/:id',auth[_0xf3d4('0xb')](),controller[_0xf3d4('0xd')]);router[_0xf3d4('0x8')]('/:id/users',auth[_0xf3d4('0xb')](),controller['getAgents']);router[_0xf3d4('0xe')]('/',auth[_0xf3d4('0xb')](),controller[_0xf3d4('0xf')]);router[_0xf3d4('0xe')](_0xf3d4('0x10'),auth[_0xf3d4('0xb')](),controller[_0xf3d4('0x11')]);router[_0xf3d4('0x12')](_0xf3d4('0x13'),auth[_0xf3d4('0xb')](),controller[_0xf3d4('0x14')]);router[_0xf3d4('0x15')](_0xf3d4('0x13'),auth[_0xf3d4('0xb')](),controller[_0xf3d4('0x16')]);router[_0xf3d4('0x15')](_0xf3d4('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf278=['destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','show','/:id/users','getAgents','post','addAgents','put','update','delete','/:id'];(function(_0x12c2e3,_0x2ad60b){var _0x198154=function(_0x31f785){while(--_0x31f785){_0x12c2e3['push'](_0x12c2e3['shift']());}};_0x198154(++_0x2ad60b);}(_0xf278,0xc8));var _0x8f27=function(_0x3c5e45,_0x5a9916){_0x3c5e45=_0x3c5e45-0x0;var _0x2cecea=_0xf278[_0x3c5e45];return _0x2cecea;};'use strict';var multer=require(_0x8f27('0x0'));var util=require(_0x8f27('0x1'));var path=require(_0x8f27('0x2'));var timeout=require(_0x8f27('0x3'));var express=require('express');var router=express[_0x8f27('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f27('0x5'));var config=require(_0x8f27('0x6'));var controller=require(_0x8f27('0x7'));router[_0x8f27('0x8')]('/',auth[_0x8f27('0x9')](),controller['index']);router[_0x8f27('0x8')](_0x8f27('0xa'),auth[_0x8f27('0x9')](),controller['describe']);router[_0x8f27('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8f27('0xb')]);router[_0x8f27('0x8')](_0x8f27('0xc'),auth[_0x8f27('0x9')](),controller[_0x8f27('0xd')]);router[_0x8f27('0xe')]('/',auth[_0x8f27('0x9')](),controller['create']);router['post'](_0x8f27('0xc'),auth[_0x8f27('0x9')](),controller[_0x8f27('0xf')]);router[_0x8f27('0x10')]('/:id',auth[_0x8f27('0x9')](),controller[_0x8f27('0x11')]);router[_0x8f27('0x12')](_0x8f27('0x13'),auth[_0x8f27('0x9')](),controller[_0x8f27('0x14')]);router[_0x8f27('0x12')](_0x8f27('0xc'),auth[_0x8f27('0x9')](),controller[_0x8f27('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 734aaf1..6406b4d 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 _0x9b8c=['INTEGER','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0x9b8c,0x16f));var _0xc9b8=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0x9b8c[_0x21ecc8];return _0x510c1d;};'use strict';var Sequelize=require(_0xc9b8('0x0'));module[_0xc9b8('0x1')]={'name':{'type':Sequelize[_0xc9b8('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xc9b8('0x3')],'get':function(_0x301299){return'system-'+this[_0xc9b8('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0xc9b8('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xc9b8('0x5')]}}; \ No newline at end of file +var _0xcab1=['name','VIRTUAL','getDataValue','INTEGER','exports','STRING'];(function(_0x3d8f92,_0x14017a){var _0x1e7b44=function(_0x461047){while(--_0x461047){_0x3d8f92['push'](_0x3d8f92['shift']());}};_0x1e7b44(++_0x14017a);}(_0xcab1,0x166));var _0x1cab=function(_0x15ab51,_0x938ad){_0x15ab51=_0x15ab51-0x0;var _0x36c7e4=_0xcab1[_0x15ab51];return _0x36c7e4;};'use strict';var Sequelize=require('sequelize');module[_0x1cab('0x0')]={'name':{'type':Sequelize[_0x1cab('0x1')],'allowNull':![],'unique':_0x1cab('0x2')},'prefix':{'type':Sequelize[_0x1cab('0x3')],'get':function(_0x177210){return'system-'+this[_0x1cab('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x1cab('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x1cab('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c36a8e4..b75e96c 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 _0x6d79=['offset','limit','reject','save','update','then','destroy','get','VoicePrefixes','end','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','transaction','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Set','CDR(prefix)=','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','count'];(function(_0x402223,_0x212f03){var _0x5928b7=function(_0x520196){while(--_0x520196){_0x402223['push'](_0x402223['shift']());}};_0x5928b7(++_0x212f03);}(_0x6d79,0x159));var _0x96d7=function(_0x390cc8,_0x2b3972){_0x390cc8=_0x390cc8-0x0;var _0x12c6b7=_0x6d79[_0x390cc8];return _0x12c6b7;};'use strict';var pdf=require(_0x96d7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x96d7('0x1'));var jsonpatch=require(_0x96d7('0x2'));var rp=require('request-promise');var moment=require(_0x96d7('0x3'));var BPromise=require(_0x96d7('0x4'));var Mustache=require(_0x96d7('0x5'));var util=require(_0x96d7('0x6'));var path=require(_0x96d7('0x7'));var sox=require(_0x96d7('0x8'));var csv=require(_0x96d7('0x9'));var ejs=require(_0x96d7('0xa'));var fs=require('fs');var _=require(_0x96d7('0xb'));var squel=require(_0x96d7('0xc'));var crypto=require('crypto');var jsforce=require(_0x96d7('0xd'));var deskjs=require(_0x96d7('0xe'));var toCsv=require(_0x96d7('0x9'));var querystring=require(_0x96d7('0xf'));var Papa=require(_0x96d7('0x10'));var Redis=require(_0x96d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x96d7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x96d7('0x13'))(_0x96d7('0x14'));var utils=require(_0x96d7('0x15'));var config=require(_0x96d7('0x16'));var db=require(_0x96d7('0x17'))['db'];config['redis']=_[_0x96d7('0x18')](config[_0x96d7('0x19')],{'host':_0x96d7('0x1a'),'port':0x18eb});var socket=require(_0x96d7('0x1b'))(new Redis(config[_0x96d7('0x19')]));require(_0x96d7('0x1c'))[_0x96d7('0x1d')](socket);function respondWithStatusCode(_0x232a4e,_0x2e975a){_0x2e975a=_0x2e975a||0xcc;return function(_0x438be3){if(_0x438be3){return _0x232a4e[_0x96d7('0x1e')](_0x2e975a);}return _0x232a4e['status'](_0x2e975a)['end']();};}function respondWithResult(_0x5c13e7,_0xd29419){_0xd29419=_0xd29419||0xc8;return function(_0x2b875f){if(_0x2b875f){return _0x5c13e7[_0x96d7('0x1f')](_0xd29419)['json'](_0x2b875f);}};}function respondWithFilteredResult(_0x19efe5,_0x57dece){return function(_0x3ad357){if(_0x3ad357){var _0x1db141=_0x3ad357[_0x96d7('0x20')],_0x85e7d8=_0x57dece[_0x96d7('0x21')],_0x12ad80=_0x57dece['offset']+_0x57dece[_0x96d7('0x22')],_0x5a5816;if(_0x12ad80>=_0x1db141){_0x12ad80=_0x1db141;_0x5a5816=0xc8;}else{_0x5a5816=0xce;}_0x19efe5[_0x96d7('0x1f')](_0x5a5816);return _0x19efe5['set']('Content-Range',_0x85e7d8+'-'+_0x12ad80+'/'+_0x1db141)['json'](_0x3ad357);}return null;};}function patchUpdates(_0x524117){return function(_0x96618c){try{jsonpatch['apply'](_0x96618c,_0x524117,!![]);}catch(_0x181f9d){return BPromise[_0x96d7('0x23')](_0x181f9d);}return _0x96618c[_0x96d7('0x24')]();};}function saveUpdates(_0x5c488a,_0x4ed80c){return function(_0x4c4145){if(_0x4c4145){return _0x4c4145[_0x96d7('0x25')](_0x5c488a)[_0x96d7('0x26')](function(_0x1d6731){return _0x1d6731;});}return null;};}function removeEntity(_0x5c98c4,_0x1613f5){return function(_0x1c4e01){if(_0x1c4e01){return _0x1c4e01[_0x96d7('0x27')]()[_0x96d7('0x26')](function(){var _0x50c183=_0x1c4e01[_0x96d7('0x28')]({'plain':!![]});var _0x462595=_0x96d7('0x29');return db['UserProfileResource'][_0x96d7('0x27')]({'where':{'type':_0x462595,'resourceId':_0x50c183['id']}})[_0x96d7('0x26')](function(){return _0x1c4e01;});})[_0x96d7('0x26')](function(){_0x5c98c4[_0x96d7('0x1f')](0xcc)[_0x96d7('0x2a')]();});}};}function handleEntityNotFound(_0x32ed83,_0x39434b){return function(_0x238567){if(!_0x238567){_0x32ed83[_0x96d7('0x1e')](0x194);}return _0x238567;};}function handleError(_0x1b4bef,_0x12f644){_0x12f644=_0x12f644||0x1f4;return function(_0x935141){logger[_0x96d7('0x2b')](_0x935141[_0x96d7('0x2c')]);if(_0x935141[_0x96d7('0x2d')]){delete _0x935141[_0x96d7('0x2d')];}_0x1b4bef[_0x96d7('0x1f')](_0x12f644)[_0x96d7('0x2e')](_0x935141);};}exports[_0x96d7('0x2f')]=function(_0x50ac41,_0x3c73d1){var _0x1ea7fc={},_0x2fe515={},_0x21a441={'count':0x0,'rows':[]};var _0x10fb4c=_['map'](db[_0x96d7('0x30')][_0x96d7('0x31')],function(_0x564b39){return{'name':_0x564b39[_0x96d7('0x32')],'type':_0x564b39[_0x96d7('0x33')]['key']};});_0x2fe515[_0x96d7('0x34')]=_[_0x96d7('0x35')](_0x10fb4c,'name');_0x2fe515[_0x96d7('0x36')]=_[_0x96d7('0x37')](_0x50ac41[_0x96d7('0x36')]);_0x2fe515[_0x96d7('0x38')]=_[_0x96d7('0x39')](_0x2fe515[_0x96d7('0x34')],_0x2fe515['query']);_0x1ea7fc['attributes']=_[_0x96d7('0x39')](_0x2fe515[_0x96d7('0x34')],qs['fields'](_0x50ac41[_0x96d7('0x36')][_0x96d7('0x3a')]));_0x1ea7fc['attributes']=_0x1ea7fc[_0x96d7('0x3b')][_0x96d7('0x3c')]?_0x1ea7fc[_0x96d7('0x3b')]:_0x2fe515[_0x96d7('0x34')];if(!_0x50ac41['query'][_0x96d7('0x3d')](_0x96d7('0x3e'))){_0x1ea7fc[_0x96d7('0x22')]=qs['limit'](_0x50ac41[_0x96d7('0x36')]['limit']);_0x1ea7fc['offset']=qs['offset'](_0x50ac41[_0x96d7('0x36')][_0x96d7('0x21')]);}_0x1ea7fc[_0x96d7('0x3f')]=qs[_0x96d7('0x40')](_0x50ac41[_0x96d7('0x36')][_0x96d7('0x40')]);_0x1ea7fc[_0x96d7('0x41')]=qs[_0x96d7('0x38')](_[_0x96d7('0x42')](_0x50ac41['query'],_0x2fe515[_0x96d7('0x38')]),_0x10fb4c);if(_0x50ac41[_0x96d7('0x36')][_0x96d7('0x43')]){_0x1ea7fc[_0x96d7('0x41')]=_[_0x96d7('0x44')](_0x1ea7fc[_0x96d7('0x41')],{'$or':_[_0x96d7('0x35')](_0x10fb4c,function(_0x5963d1){if(_0x5963d1[_0x96d7('0x33')]!==_0x96d7('0x45')){var _0x3f9bb4={};_0x3f9bb4[_0x5963d1['name']]={'$like':'%'+_0x50ac41[_0x96d7('0x36')][_0x96d7('0x43')]+'%'};return _0x3f9bb4;}})});}_0x1ea7fc=_[_0x96d7('0x44')]({},_0x1ea7fc,_0x50ac41[_0x96d7('0x46')]);var _0x3e1180={'where':_0x1ea7fc[_0x96d7('0x41')]};return db[_0x96d7('0x30')]['count'](_0x3e1180)[_0x96d7('0x26')](function(_0x866196){_0x21a441[_0x96d7('0x20')]=_0x866196;if(_0x50ac41[_0x96d7('0x36')][_0x96d7('0x47')]){_0x1ea7fc[_0x96d7('0x48')]=[{'all':!![]}];}return db[_0x96d7('0x30')][_0x96d7('0x49')](_0x1ea7fc);})['then'](function(_0x399a35){_0x21a441[_0x96d7('0x4a')]=_0x399a35;return _0x21a441;})['then'](respondWithFilteredResult(_0x3c73d1,_0x1ea7fc))[_0x96d7('0x4b')](handleError(_0x3c73d1,null));};exports[_0x96d7('0x4c')]=function(_0x43a345,_0x4f93f7){var _0x3a2f29={'raw':![],'where':{'id':_0x43a345[_0x96d7('0x4d')]['id']}},_0x34232e={};_0x34232e[_0x96d7('0x34')]=_[_0x96d7('0x37')](db[_0x96d7('0x30')]['rawAttributes']);_0x34232e[_0x96d7('0x36')]=_[_0x96d7('0x37')](_0x43a345[_0x96d7('0x36')]);_0x34232e[_0x96d7('0x38')]=_[_0x96d7('0x39')](_0x34232e[_0x96d7('0x34')],_0x34232e[_0x96d7('0x36')]);_0x3a2f29[_0x96d7('0x3b')]=_[_0x96d7('0x39')](_0x34232e[_0x96d7('0x34')],qs[_0x96d7('0x3a')](_0x43a345[_0x96d7('0x36')][_0x96d7('0x3a')]));_0x3a2f29[_0x96d7('0x3b')]=_0x3a2f29[_0x96d7('0x3b')][_0x96d7('0x3c')]?_0x3a2f29[_0x96d7('0x3b')]:_0x34232e[_0x96d7('0x34')];if(_0x43a345[_0x96d7('0x36')][_0x96d7('0x47')]){_0x3a2f29[_0x96d7('0x48')]=[{'all':!![]}];}_0x3a2f29=_[_0x96d7('0x44')]({},_0x3a2f29,_0x43a345[_0x96d7('0x46')]);return db[_0x96d7('0x30')][_0x96d7('0x4e')](_0x3a2f29)[_0x96d7('0x26')](handleEntityNotFound(_0x4f93f7,null))[_0x96d7('0x26')](respondWithResult(_0x4f93f7,null))[_0x96d7('0x4b')](handleError(_0x4f93f7,null));};exports[_0x96d7('0x27')]=function(_0x569967,_0x8f4be2){return db['VoicePrefix'][_0x96d7('0x4e')]({'where':{'id':_0x569967[_0x96d7('0x4d')]['id']}})[_0x96d7('0x26')](handleEntityNotFound(_0x8f4be2,null))[_0x96d7('0x26')](removeEntity(_0x8f4be2,null))[_0x96d7('0x4b')](handleError(_0x8f4be2,null));};exports['describe']=function(_0x119d3b,_0x2cf529){return db[_0x96d7('0x30')][_0x96d7('0x4f')]()[_0x96d7('0x26')](respondWithResult(_0x2cf529,null))[_0x96d7('0x4b')](handleError(_0x2cf529,null));};exports['create']=function(_0x3b8e7e,_0x2eb944){var _0x5b9dda;return db['sequelize'][_0x96d7('0x50')](function(_0x25f57e){return db[_0x96d7('0x30')][_0x96d7('0x51')](_0x3b8e7e[_0x96d7('0x52')],{'transaction':_0x25f57e})[_0x96d7('0x26')](function(_0x242138){_0x5b9dda=_0x242138[_0x96d7('0x28')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x5b9dda[_0x96d7('0x53')]},'raw':!![]})[_0x96d7('0x26')](function(_0xed94d){return createVoicePrefixExtensions(_0x5b9dda,_0xed94d,_0x25f57e);});});})[_0x96d7('0x26')](function(){var _0x255e36=_0x3b8e7e[_0x96d7('0x54')][_0x96d7('0x28')]({'plain':!![]});if(!_0x255e36)throw new Error(_0x96d7('0x55'));if(_0x255e36[_0x96d7('0x56')]==='user'){var _0x3806da=_0x5b9dda;return db[_0x96d7('0x57')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x255e36['userProfileId']},'raw':!![]})[_0x96d7('0x26')](function(_0x2f12c3){if(_0x2f12c3&&_0x2f12c3[_0x96d7('0x58')]===0x0){return db['UserProfileResource'][_0x96d7('0x51')]({'name':_0x3806da[_0x96d7('0x2d')],'resourceId':_0x3806da['id'],'type':_0x2f12c3[_0x96d7('0x2d')],'sectionId':_0x2f12c3['id']},{})['then'](function(){return _0x5b9dda;});}else{return _0x5b9dda;}})['catch'](function(_0x114e79){logger[_0x96d7('0x2b')](_0x96d7('0x59'),_0x114e79);throw _0x114e79;});}return _0x5b9dda;})[_0x96d7('0x26')](respondWithResult(_0x2eb944,null))[_0x96d7('0x4b')](handleError(_0x2eb944,null));};function Extension(_0x585a28,_0x467008,_0x5cca8f,_0x5bce6d){this[_0x96d7('0x5a')]=_0x96d7('0x5b');this[_0x96d7('0x5c')]=_0x585a28;this['app']=_0x5cca8f;this[_0x96d7('0x33')]=_0x96d7('0x5d');this[_0x96d7('0x5e')]=_0x96d7('0x5f');this[_0x96d7('0x60')]=_0x467008;this[_0x96d7('0x61')]=_0x5bce6d;}function createVoicePrefixExtensions(_0x30cb7f,_0xe04928,_0x367876){return new BPromise(function(_0x2baafb,_0x4b6250){var _0x2d0690=new Extension(formatPrefixName(_0x30cb7f[_0x96d7('0x62')]),0x1,_0x96d7('0x63'),_0x96d7('0x64'));_0x2d0690[_0x96d7('0x65')]=_0x30cb7f['id'];return db[_0x96d7('0x66')][_0x96d7('0x51')](_0x2d0690,{'transaction':_0x367876})['then'](function(_0x462bcf){var _0x59f19f=_0x462bcf['get']({'plain':!![]});var _0x390867=_[_0x96d7('0x35')](addVoicePrefixExtensions(_0x30cb7f,_0xe04928),function(_0x23fc4d){_0x23fc4d['VoiceExtensionId']=_0x59f19f['id'];_0x23fc4d[_0x96d7('0x65')]=_0x30cb7f['id'];return _0x23fc4d;});return db[_0x96d7('0x66')][_0x96d7('0x67')](_0x390867,{'transaction':_0x367876})[_0x96d7('0x26')](function(_0x8d91db){if(!_0x8d91db){return _0x4b6250('Extensions\x20creation\x20failed');}else{return _0x2baafb(_0x8d91db);}})[_0x96d7('0x4b')](function(_0x530d48){return _0x4b6250(_0x530d48);});});;});};function addVoicePrefixExtensions(_0x592d94,_0x5dea9c){var _0x5a6780=[];var _0x3b71cc=formatPrefixName(_0x592d94[_0x96d7('0x62')]);_0x5a6780['push'](new Extension(_0x3b71cc,0x2,_0x96d7('0x68'),_0x96d7('0x69')+_0x592d94['name']));if(_0x592d94['callerIdAll']){_0x5a6780[_0x96d7('0x6a')](new Extension(_0x3b71cc,0x3,_0x96d7('0x68'),_0x96d7('0x6b')+_0x592d94['callerIdAll']));}else{_0x5a6780[_0x96d7('0x6a')](new Extension(_0x3b71cc,0x3,_0x96d7('0x63'),_0x96d7('0x6c')));}_0x5a6780[_0x96d7('0x6a')](new Extension(_0x3b71cc,0x4,_0x96d7('0x6d'),_0x5dea9c['context']+','+_0x96d7('0x6e')+(0x8+_0x592d94[_0x96d7('0x2d')]['length'])+'}'+','+0x1));return _0x5a6780;}function formatPrefixName(_0x535aa9){var _0x1c6eab='_';for(var _0x26b427=0x0;_0x26b427<_0x535aa9[_0x96d7('0x3c')];_0x26b427++){if(_0x535aa9[_0x96d7('0x6f')](_0x26b427)=='-'){_0x1c6eab+=_0x535aa9[_0x96d7('0x6f')](_0x26b427);}else{_0x1c6eab+='['+_0x535aa9['charAt'](_0x26b427)+']';}}_0x1c6eab+='.';return _0x1c6eab;}exports[_0x96d7('0x25')]=function(_0xcfa2f4,_0x145ccc,_0x14d52f){var _0x221696=_0xcfa2f4[_0x96d7('0x52')];_0x221696[_0x96d7('0x62')]=_0x96d7('0x70')+_0x221696[_0x96d7('0x2d')]+'-';return db[_0x96d7('0x71')][_0x96d7('0x50')](function(_0x56e2a1){return db[_0x96d7('0x30')]['update'](_0x221696,{'where':{'id':_0x221696['id']},'transaction':_0x56e2a1})[_0x96d7('0x26')](function(){return db[_0x96d7('0x66')][_0x96d7('0x27')]({'where':{'VoicePrefixId':_0x221696['id']},'transaction':_0x56e2a1})[_0x96d7('0x26')](function(){return db[_0x96d7('0x66')][_0x96d7('0x4e')]({'where':{'id':_0x221696['VoiceExtensionId']},'raw':!![]})[_0x96d7('0x26')](function(_0x5275cf){return createVoicePrefixExtensions(_0x221696,_0x5275cf,_0x56e2a1);});});});})[_0x96d7('0x26')](function(){return db[_0x96d7('0x30')][_0x96d7('0x72')](_0x221696['id']);})[_0x96d7('0x26')](respondWithResult(_0x145ccc,null))[_0x96d7('0x4b')](handleError(_0x145ccc,null));};exports['addAgents']=function(_0x1f7ac7,_0x46a214,_0x16f20b){return db[_0x96d7('0x30')][_0x96d7('0x4e')]({'where':{'id':_0x1f7ac7[_0x96d7('0x4d')]['id']}})[_0x96d7('0x26')](handleEntityNotFound(_0x46a214,null))[_0x96d7('0x26')](function(_0x240b8e){if(_0x240b8e){return _0x240b8e[_0x96d7('0x73')](_0x1f7ac7['body'][_0x96d7('0x74')],_[_0x96d7('0x75')](_0x1f7ac7[_0x96d7('0x52')],[_0x96d7('0x74'),'id'])||{})[_0x96d7('0x76')](function(_0x528268){for(var _0x85d142=0x0;_0x85d142<_0x1f7ac7[_0x96d7('0x52')]['ids']['length'];_0x85d142+=0x1){socket[_0x96d7('0x77')](_0x96d7('0x78'),{'UserId':_0x1f7ac7[_0x96d7('0x52')][_0x96d7('0x74')][_0x85d142],'VoicePrefixId':_0x1f7ac7[_0x96d7('0x4d')]['id']});}return _0x528268;});}})['then'](respondWithResult(_0x46a214,null))[_0x96d7('0x4b')](handleError(_0x46a214,null));};exports[_0x96d7('0x79')]=function(_0x519be4,_0x477b89,_0x5a10d1){return db[_0x96d7('0x30')]['find']({'where':{'id':_0x519be4[_0x96d7('0x4d')]['id']}})[_0x96d7('0x26')](handleEntityNotFound(_0x477b89,null))['then'](function(_0x440870){if(_0x440870){return _0x440870[_0x96d7('0x79')](_0x519be4[_0x96d7('0x36')][_0x96d7('0x74')])['then'](function(){if(_['isArray'](_0x519be4[_0x96d7('0x36')][_0x96d7('0x74')])){for(var _0xc21d4a=0x0;_0xc21d4a<_0x519be4[_0x96d7('0x36')][_0x96d7('0x74')]['length'];_0xc21d4a+=0x1){socket[_0x96d7('0x77')](_0x96d7('0x7a'),{'UserId':Number(_0x519be4[_0x96d7('0x36')][_0x96d7('0x74')][_0xc21d4a]),'VoicePrefixId':Number(_0x519be4[_0x96d7('0x4d')]['id'])});}}else{socket[_0x96d7('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x519be4['query'][_0x96d7('0x74')]),'VoicePrefixId':Number(_0x519be4[_0x96d7('0x4d')]['id'])});}});}})[_0x96d7('0x26')](respondWithStatusCode(_0x477b89,null))[_0x96d7('0x4b')](handleError(_0x477b89,null));};exports[_0x96d7('0x7b')]=function(_0x337751,_0x198aec,_0x55ce8b){var _0x4503e2={};var _0xb2df55={};var _0x5be318;var _0x59e582;return db[_0x96d7('0x30')][_0x96d7('0x7c')]({'where':{'id':_0x337751[_0x96d7('0x4d')]['id']}})[_0x96d7('0x26')](handleEntityNotFound(_0x198aec,null))[_0x96d7('0x26')](function(_0x264393){if(_0x264393){_0x5be318=_0x264393;_0xb2df55[_0x96d7('0x34')]=_[_0x96d7('0x37')](db[_0x96d7('0x7d')][_0x96d7('0x31')]);_0xb2df55[_0x96d7('0x36')]=_['keys'](_0x337751[_0x96d7('0x36')]);_0xb2df55[_0x96d7('0x38')]=_['intersection'](_0xb2df55[_0x96d7('0x34')],_0xb2df55[_0x96d7('0x36')]);_0x4503e2['attributes']=_[_0x96d7('0x39')](_0xb2df55[_0x96d7('0x34')],qs[_0x96d7('0x3a')](_0x337751[_0x96d7('0x36')][_0x96d7('0x3a')]));_0x4503e2['attributes']=_0x4503e2[_0x96d7('0x3b')]['length']?_0x4503e2[_0x96d7('0x3b')]:_0xb2df55[_0x96d7('0x34')];_0x4503e2[_0x96d7('0x3f')]=qs[_0x96d7('0x40')](_0x337751[_0x96d7('0x36')][_0x96d7('0x40')]);_0x4503e2['where']=qs['filters'](_[_0x96d7('0x42')](_0x337751[_0x96d7('0x36')],_0xb2df55[_0x96d7('0x38')]));if(_0x337751[_0x96d7('0x36')][_0x96d7('0x43')]){_0x4503e2['where']=_[_0x96d7('0x44')](_0x4503e2[_0x96d7('0x41')],{'$or':_[_0x96d7('0x35')](_0x4503e2['attributes'],function(_0x237a57){var _0x128ca={};_0x128ca[_0x237a57]={'$like':'%'+_0x337751[_0x96d7('0x36')][_0x96d7('0x43')]+'%'};return _0x128ca;})});}_0x4503e2=_[_0x96d7('0x44')]({},_0x4503e2,_0x337751['options']);return _0x5be318[_0x96d7('0x7b')](_0x4503e2);}})[_0x96d7('0x26')](function(_0x49dc65){if(_0x49dc65){_0x59e582=_0x49dc65[_0x96d7('0x3c')];if(!_0x337751[_0x96d7('0x36')][_0x96d7('0x3d')]('nolimit')){_0x4503e2['limit']=qs['limit'](_0x337751[_0x96d7('0x36')][_0x96d7('0x22')]);_0x4503e2['offset']=qs[_0x96d7('0x21')](_0x337751['query'][_0x96d7('0x21')]);}return _0x5be318[_0x96d7('0x7b')](_0x4503e2);}})[_0x96d7('0x26')](function(_0x94a6d0){if(_0x94a6d0){return _0x94a6d0?{'count':_0x59e582,'rows':_0x94a6d0}:null;}})['then'](respondWithResult(_0x198aec,null))[_0x96d7('0x4b')](handleError(_0x198aec,null));}; \ No newline at end of file +var _0x79ea=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','includeAll','include','VoicePrefix','findAll','rows','catch','show','options','find','params','describe','sequelize','transaction','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','system-','findById','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','end','error','stack','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection'];(function(_0x1d72d0,_0x89db32){var _0x234ae9=function(_0x4ae372){while(--_0x4ae372){_0x1d72d0['push'](_0x1d72d0['shift']());}};_0x234ae9(++_0x89db32);}(_0x79ea,0x13a));var _0xa79e=function(_0x11c6b8,_0x5b2d7b){_0x11c6b8=_0x11c6b8-0x0;var _0x38b38f=_0x79ea[_0x11c6b8];return _0x38b38f;};'use strict';var pdf=require(_0xa79e('0x0'));var emlformat=require(_0xa79e('0x1'));var rimraf=require(_0xa79e('0x2'));var zipdir=require(_0xa79e('0x3'));var jsonpatch=require(_0xa79e('0x4'));var rp=require('request-promise');var moment=require(_0xa79e('0x5'));var BPromise=require(_0xa79e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa79e('0x7'));var csv=require(_0xa79e('0x8'));var ejs=require(_0xa79e('0x9'));var fs=require('fs');var _=require(_0xa79e('0xa'));var squel=require(_0xa79e('0xb'));var crypto=require('crypto');var jsforce=require(_0xa79e('0xc'));var deskjs=require(_0xa79e('0xd'));var toCsv=require(_0xa79e('0x8'));var querystring=require(_0xa79e('0xe'));var Papa=require(_0xa79e('0xf'));var Redis=require(_0xa79e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa79e('0x11'));var as=require(_0xa79e('0x12'));var hardwareService=require(_0xa79e('0x13'));var logger=require(_0xa79e('0x14'))('api');var utils=require(_0xa79e('0x15'));var config=require(_0xa79e('0x16'));var db=require(_0xa79e('0x17'))['db'];config[_0xa79e('0x18')]=_[_0xa79e('0x19')](config[_0xa79e('0x18')],{'host':_0xa79e('0x1a'),'port':0x18eb});var socket=require(_0xa79e('0x1b'))(new Redis(config[_0xa79e('0x18')]));require(_0xa79e('0x1c'))[_0xa79e('0x1d')](socket);function respondWithStatusCode(_0x2d4e43,_0xa11d49){_0xa11d49=_0xa11d49||0xcc;return function(_0xb1344e){if(_0xb1344e){return _0x2d4e43[_0xa79e('0x1e')](_0xa11d49);}return _0x2d4e43['status'](_0xa11d49)['end']();};}function respondWithResult(_0x56fadc,_0x261e1a){_0x261e1a=_0x261e1a||0xc8;return function(_0x3533c6){if(_0x3533c6){return _0x56fadc[_0xa79e('0x1f')](_0x261e1a)[_0xa79e('0x20')](_0x3533c6);}};}function respondWithFilteredResult(_0x3ccda0,_0x2d9a39){return function(_0x1d98e5){if(_0x1d98e5){var _0x18e7aa=_0x1d98e5[_0xa79e('0x21')],_0x58d7a0=_0x2d9a39[_0xa79e('0x22')],_0x3798fe=_0x2d9a39[_0xa79e('0x22')]+_0x2d9a39[_0xa79e('0x23')],_0x660fca;if(_0x3798fe>=_0x18e7aa){_0x3798fe=_0x18e7aa;_0x660fca=0xc8;}else{_0x660fca=0xce;}_0x3ccda0[_0xa79e('0x1f')](_0x660fca);return _0x3ccda0[_0xa79e('0x24')](_0xa79e('0x25'),_0x58d7a0+'-'+_0x3798fe+'/'+_0x18e7aa)[_0xa79e('0x20')](_0x1d98e5);}return null;};}function patchUpdates(_0x23174){return function(_0x3ab852){try{jsonpatch[_0xa79e('0x26')](_0x3ab852,_0x23174,!![]);}catch(_0x265c22){return BPromise[_0xa79e('0x27')](_0x265c22);}return _0x3ab852[_0xa79e('0x28')]();};}function saveUpdates(_0x344942,_0x1ac2be){return function(_0x2a636e){if(_0x2a636e){return _0x2a636e[_0xa79e('0x29')](_0x344942)[_0xa79e('0x2a')](function(_0x444102){return _0x444102;});}return null;};}function removeEntity(_0x1ac1b3,_0x45f4d1){return function(_0x1965fb){if(_0x1965fb){return _0x1965fb[_0xa79e('0x2b')]()['then'](function(){var _0x4e7582=_0x1965fb[_0xa79e('0x2c')]({'plain':!![]});var _0x5c3261=_0xa79e('0x2d');return db['UserProfileResource'][_0xa79e('0x2b')]({'where':{'type':_0x5c3261,'resourceId':_0x4e7582['id']}})[_0xa79e('0x2a')](function(){return _0x1965fb;});})['then'](function(){_0x1ac1b3[_0xa79e('0x1f')](0xcc)[_0xa79e('0x2e')]();});}};}function handleEntityNotFound(_0x3de7a2,_0x7040d4){return function(_0x5ebf42){if(!_0x5ebf42){_0x3de7a2[_0xa79e('0x1e')](0x194);}return _0x5ebf42;};}function handleError(_0x3acda5,_0x1a27db){_0x1a27db=_0x1a27db||0x1f4;return function(_0x161555){logger[_0xa79e('0x2f')](_0x161555[_0xa79e('0x30')]);if(_0x161555['name']){delete _0x161555['name'];}_0x3acda5[_0xa79e('0x1f')](_0x1a27db)[_0xa79e('0x31')](_0x161555);};}exports[_0xa79e('0x32')]=function(_0x15c3b0,_0x46bd2f){var _0x57bd62={},_0x2e42fc={},_0x2064ee={'count':0x0,'rows':[]};var _0x51379d=_[_0xa79e('0x33')](db['VoicePrefix'][_0xa79e('0x34')],function(_0x22088e){return{'name':_0x22088e[_0xa79e('0x35')],'type':_0x22088e[_0xa79e('0x36')]['key']};});_0x2e42fc[_0xa79e('0x37')]=_[_0xa79e('0x33')](_0x51379d,'name');_0x2e42fc[_0xa79e('0x38')]=_[_0xa79e('0x39')](_0x15c3b0[_0xa79e('0x38')]);_0x2e42fc[_0xa79e('0x3a')]=_['intersection'](_0x2e42fc[_0xa79e('0x37')],_0x2e42fc['query']);_0x57bd62[_0xa79e('0x3b')]=_[_0xa79e('0x3c')](_0x2e42fc[_0xa79e('0x37')],qs[_0xa79e('0x3d')](_0x15c3b0['query'][_0xa79e('0x3d')]));_0x57bd62['attributes']=_0x57bd62[_0xa79e('0x3b')][_0xa79e('0x3e')]?_0x57bd62[_0xa79e('0x3b')]:_0x2e42fc[_0xa79e('0x37')];if(!_0x15c3b0['query'][_0xa79e('0x3f')](_0xa79e('0x40'))){_0x57bd62[_0xa79e('0x23')]=qs['limit'](_0x15c3b0[_0xa79e('0x38')]['limit']);_0x57bd62[_0xa79e('0x22')]=qs['offset'](_0x15c3b0['query'][_0xa79e('0x22')]);}_0x57bd62[_0xa79e('0x41')]=qs[_0xa79e('0x42')](_0x15c3b0['query'][_0xa79e('0x42')]);_0x57bd62[_0xa79e('0x43')]=qs[_0xa79e('0x3a')](_['pick'](_0x15c3b0['query'],_0x2e42fc['filters']),_0x51379d);if(_0x15c3b0['query'][_0xa79e('0x44')]){_0x57bd62[_0xa79e('0x43')]=_[_0xa79e('0x45')](_0x57bd62[_0xa79e('0x43')],{'$or':_['map'](_0x51379d,function(_0x32aff6){if(_0x32aff6[_0xa79e('0x36')]!==_0xa79e('0x46')){var _0x38895c={};_0x38895c[_0x32aff6[_0xa79e('0x47')]]={'$like':'%'+_0x15c3b0[_0xa79e('0x38')]['filter']+'%'};return _0x38895c;}})});}_0x57bd62=_['merge']({},_0x57bd62,_0x15c3b0['options']);var _0x1d32b5={'where':_0x57bd62[_0xa79e('0x43')]};return db['VoicePrefix'][_0xa79e('0x21')](_0x1d32b5)[_0xa79e('0x2a')](function(_0xb4c81e){_0x2064ee[_0xa79e('0x21')]=_0xb4c81e;if(_0x15c3b0[_0xa79e('0x38')][_0xa79e('0x48')]){_0x57bd62[_0xa79e('0x49')]=[{'all':!![]}];}return db[_0xa79e('0x4a')][_0xa79e('0x4b')](_0x57bd62);})[_0xa79e('0x2a')](function(_0x43c302){_0x2064ee[_0xa79e('0x4c')]=_0x43c302;return _0x2064ee;})[_0xa79e('0x2a')](respondWithFilteredResult(_0x46bd2f,_0x57bd62))[_0xa79e('0x4d')](handleError(_0x46bd2f,null));};exports[_0xa79e('0x4e')]=function(_0x4de663,_0xb16ffd){var _0x3a6c30={'raw':![],'where':{'id':_0x4de663['params']['id']}},_0x4ca517={};_0x4ca517[_0xa79e('0x37')]=_[_0xa79e('0x39')](db[_0xa79e('0x4a')]['rawAttributes']);_0x4ca517[_0xa79e('0x38')]=_[_0xa79e('0x39')](_0x4de663['query']);_0x4ca517[_0xa79e('0x3a')]=_[_0xa79e('0x3c')](_0x4ca517[_0xa79e('0x37')],_0x4ca517[_0xa79e('0x38')]);_0x3a6c30['attributes']=_[_0xa79e('0x3c')](_0x4ca517[_0xa79e('0x37')],qs[_0xa79e('0x3d')](_0x4de663['query']['fields']));_0x3a6c30['attributes']=_0x3a6c30[_0xa79e('0x3b')][_0xa79e('0x3e')]?_0x3a6c30[_0xa79e('0x3b')]:_0x4ca517[_0xa79e('0x37')];if(_0x4de663[_0xa79e('0x38')][_0xa79e('0x48')]){_0x3a6c30[_0xa79e('0x49')]=[{'all':!![]}];}_0x3a6c30=_['merge']({},_0x3a6c30,_0x4de663[_0xa79e('0x4f')]);return db[_0xa79e('0x4a')][_0xa79e('0x50')](_0x3a6c30)[_0xa79e('0x2a')](handleEntityNotFound(_0xb16ffd,null))[_0xa79e('0x2a')](respondWithResult(_0xb16ffd,null))[_0xa79e('0x4d')](handleError(_0xb16ffd,null));};exports[_0xa79e('0x2b')]=function(_0x58979a,_0x3636b1){return db[_0xa79e('0x4a')]['find']({'where':{'id':_0x58979a[_0xa79e('0x51')]['id']}})[_0xa79e('0x2a')](handleEntityNotFound(_0x3636b1,null))['then'](removeEntity(_0x3636b1,null))['catch'](handleError(_0x3636b1,null));};exports[_0xa79e('0x52')]=function(_0xcf06c2,_0x17f936){return db[_0xa79e('0x4a')]['describe']()[_0xa79e('0x2a')](respondWithResult(_0x17f936,null))[_0xa79e('0x4d')](handleError(_0x17f936,null));};exports['create']=function(_0x20910d,_0x4ae605){var _0x54f3ef;return db[_0xa79e('0x53')][_0xa79e('0x54')](function(_0x9916f8){return db[_0xa79e('0x4a')][_0xa79e('0x55')](_0x20910d[_0xa79e('0x56')],{'transaction':_0x9916f8})[_0xa79e('0x2a')](function(_0x353e5d){_0x54f3ef=_0x353e5d[_0xa79e('0x2c')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x54f3ef[_0xa79e('0x57')]},'raw':!![]})[_0xa79e('0x2a')](function(_0x2c570a){return createVoicePrefixExtensions(_0x54f3ef,_0x2c570a,_0x9916f8);});});})[_0xa79e('0x2a')](function(){var _0x56ca70=_0x20910d[_0xa79e('0x58')]['get']({'plain':!![]});if(!_0x56ca70)throw new Error(_0xa79e('0x59'));if(_0x56ca70[_0xa79e('0x5a')]===_0xa79e('0x58')){var _0x476a42=_0x54f3ef;return db['UserProfileSection'][_0xa79e('0x50')]({'where':{'name':_0xa79e('0x2d'),'userProfileId':_0x56ca70[_0xa79e('0x5b')]},'raw':!![]})[_0xa79e('0x2a')](function(_0x328657){if(_0x328657&&_0x328657[_0xa79e('0x5c')]===0x0){return db[_0xa79e('0x5d')]['create']({'name':_0x476a42[_0xa79e('0x47')],'resourceId':_0x476a42['id'],'type':_0x328657['name'],'sectionId':_0x328657['id']},{})[_0xa79e('0x2a')](function(){return _0x54f3ef;});}else{return _0x54f3ef;}})['catch'](function(_0x322973){logger['error'](_0xa79e('0x5e'),_0x322973);throw _0x322973;});}return _0x54f3ef;})[_0xa79e('0x2a')](respondWithResult(_0x4ae605,null))[_0xa79e('0x4d')](handleError(_0x4ae605,null));};function Extension(_0x47bebc,_0x9e546c,_0x5f1f77,_0x47fef5){this[_0xa79e('0x5f')]=_0xa79e('0x60');this[_0xa79e('0x61')]=_0x47bebc;this[_0xa79e('0x62')]=_0x5f1f77;this['type']='system';this['description']=_0xa79e('0x63');this[_0xa79e('0x64')]=_0x9e546c;this[_0xa79e('0x65')]=_0x47fef5;}function createVoicePrefixExtensions(_0x3abf50,_0x477b63,_0x2ca1ed){return new BPromise(function(_0x36922f,_0x4ad74a){var _0x1cf6f1=new Extension(formatPrefixName(_0x3abf50[_0xa79e('0x66')]),0x1,_0xa79e('0x67'),'Voice\x20Prefix');_0x1cf6f1['VoicePrefixId']=_0x3abf50['id'];return db['VoiceExtension'][_0xa79e('0x55')](_0x1cf6f1,{'transaction':_0x2ca1ed})[_0xa79e('0x2a')](function(_0x2ad22c){var _0x54631b=_0x2ad22c[_0xa79e('0x2c')]({'plain':!![]});var _0x474a4a=_[_0xa79e('0x33')](addVoicePrefixExtensions(_0x3abf50,_0x477b63),function(_0x356a8c){_0x356a8c[_0xa79e('0x57')]=_0x54631b['id'];_0x356a8c[_0xa79e('0x68')]=_0x3abf50['id'];return _0x356a8c;});return db[_0xa79e('0x69')]['bulkCreate'](_0x474a4a,{'transaction':_0x2ca1ed})[_0xa79e('0x2a')](function(_0x5d2c53){if(!_0x5d2c53){return _0x4ad74a(_0xa79e('0x6a'));}else{return _0x36922f(_0x5d2c53);}})[_0xa79e('0x4d')](function(_0x4b1802){return _0x4ad74a(_0x4b1802);});});;});};function addVoicePrefixExtensions(_0x2ba055,_0x6c7f3a){var _0x5d1362=[];var _0x23c0d6=formatPrefixName(_0x2ba055['prefix']);_0x5d1362[_0xa79e('0x6b')](new Extension(_0x23c0d6,0x2,'Set',_0xa79e('0x6c')+_0x2ba055[_0xa79e('0x47')]));if(_0x2ba055['callerIdAll']){_0x5d1362[_0xa79e('0x6b')](new Extension(_0x23c0d6,0x3,_0xa79e('0x6d'),_0xa79e('0x6e')+_0x2ba055[_0xa79e('0x6f')]));}else{_0x5d1362[_0xa79e('0x6b')](new Extension(_0x23c0d6,0x3,_0xa79e('0x67'),'No\x20callerid\x20available'));}_0x5d1362['push'](new Extension(_0x23c0d6,0x4,'goto',_0x6c7f3a[_0xa79e('0x5f')]+','+_0xa79e('0x70')+(0x8+_0x2ba055['name'][_0xa79e('0x3e')])+'}'+','+0x1));return _0x5d1362;}function formatPrefixName(_0x2f2fd9){var _0x24ff99='_';for(var _0x196fc1=0x0;_0x196fc1<_0x2f2fd9['length'];_0x196fc1++){if(_0x2f2fd9['charAt'](_0x196fc1)=='-'){_0x24ff99+=_0x2f2fd9[_0xa79e('0x71')](_0x196fc1);}else{_0x24ff99+='['+_0x2f2fd9[_0xa79e('0x71')](_0x196fc1)+']';}}_0x24ff99+='.';return _0x24ff99;}exports['update']=function(_0x5b705c,_0x1432be,_0x572980){var _0x34a1d0=_0x5b705c[_0xa79e('0x56')];_0x34a1d0[_0xa79e('0x66')]=_0xa79e('0x72')+_0x34a1d0[_0xa79e('0x47')]+'-';return db[_0xa79e('0x53')][_0xa79e('0x54')](function(_0x463f4f){return db[_0xa79e('0x4a')][_0xa79e('0x29')](_0x34a1d0,{'where':{'id':_0x34a1d0['id']},'transaction':_0x463f4f})[_0xa79e('0x2a')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x34a1d0['id']},'transaction':_0x463f4f})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x34a1d0[_0xa79e('0x57')]},'raw':!![]})[_0xa79e('0x2a')](function(_0x4b8e1b){return createVoicePrefixExtensions(_0x34a1d0,_0x4b8e1b,_0x463f4f);});});});})[_0xa79e('0x2a')](function(){return db[_0xa79e('0x4a')][_0xa79e('0x73')](_0x34a1d0['id']);})[_0xa79e('0x2a')](respondWithResult(_0x1432be,null))[_0xa79e('0x4d')](handleError(_0x1432be,null));};exports['addAgents']=function(_0x56c3e6,_0x3420bd,_0x2e7f67){return db['VoicePrefix'][_0xa79e('0x50')]({'where':{'id':_0x56c3e6[_0xa79e('0x51')]['id']}})[_0xa79e('0x2a')](handleEntityNotFound(_0x3420bd,null))[_0xa79e('0x2a')](function(_0x3b5f13){if(_0x3b5f13){return _0x3b5f13['addAgents'](_0x56c3e6[_0xa79e('0x56')][_0xa79e('0x74')],_[_0xa79e('0x75')](_0x56c3e6[_0xa79e('0x56')],[_0xa79e('0x74'),'id'])||{})[_0xa79e('0x76')](function(_0x3d3ff2){for(var _0x4fb16f=0x0;_0x4fb16f<_0x56c3e6[_0xa79e('0x56')][_0xa79e('0x74')][_0xa79e('0x3e')];_0x4fb16f+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x56c3e6[_0xa79e('0x56')][_0xa79e('0x74')][_0x4fb16f],'VoicePrefixId':_0x56c3e6[_0xa79e('0x51')]['id']});}return _0x3d3ff2;});}})['then'](respondWithResult(_0x3420bd,null))['catch'](handleError(_0x3420bd,null));};exports[_0xa79e('0x77')]=function(_0x55babd,_0x53e253,_0x263966){return db[_0xa79e('0x4a')][_0xa79e('0x50')]({'where':{'id':_0x55babd[_0xa79e('0x51')]['id']}})[_0xa79e('0x2a')](handleEntityNotFound(_0x53e253,null))[_0xa79e('0x2a')](function(_0x36c8fc){if(_0x36c8fc){return _0x36c8fc[_0xa79e('0x77')](_0x55babd[_0xa79e('0x38')][_0xa79e('0x74')])[_0xa79e('0x2a')](function(){if(_[_0xa79e('0x78')](_0x55babd[_0xa79e('0x38')][_0xa79e('0x74')])){for(var _0x2ede57=0x0;_0x2ede57<_0x55babd['query'][_0xa79e('0x74')]['length'];_0x2ede57+=0x1){socket[_0xa79e('0x79')](_0xa79e('0x7a'),{'UserId':Number(_0x55babd[_0xa79e('0x38')][_0xa79e('0x74')][_0x2ede57]),'VoicePrefixId':Number(_0x55babd[_0xa79e('0x51')]['id'])});}}else{socket[_0xa79e('0x79')](_0xa79e('0x7a'),{'UserId':Number(_0x55babd[_0xa79e('0x38')][_0xa79e('0x74')]),'VoicePrefixId':Number(_0x55babd[_0xa79e('0x51')]['id'])});}});}})[_0xa79e('0x2a')](respondWithStatusCode(_0x53e253,null))['catch'](handleError(_0x53e253,null));};exports[_0xa79e('0x7b')]=function(_0x4aadb3,_0x5cd0b2,_0x852d3c){var _0x4401a6={};var _0x1a73cd={};var _0x37f00e;var _0x9ddcf6;return db[_0xa79e('0x4a')][_0xa79e('0x7c')]({'where':{'id':_0x4aadb3[_0xa79e('0x51')]['id']}})[_0xa79e('0x2a')](handleEntityNotFound(_0x5cd0b2,null))[_0xa79e('0x2a')](function(_0x55ed20){if(_0x55ed20){_0x37f00e=_0x55ed20;_0x1a73cd[_0xa79e('0x37')]=_[_0xa79e('0x39')](db['User'][_0xa79e('0x34')]);_0x1a73cd[_0xa79e('0x38')]=_['keys'](_0x4aadb3[_0xa79e('0x38')]);_0x1a73cd[_0xa79e('0x3a')]=_[_0xa79e('0x3c')](_0x1a73cd[_0xa79e('0x37')],_0x1a73cd[_0xa79e('0x38')]);_0x4401a6['attributes']=_[_0xa79e('0x3c')](_0x1a73cd['model'],qs[_0xa79e('0x3d')](_0x4aadb3[_0xa79e('0x38')][_0xa79e('0x3d')]));_0x4401a6[_0xa79e('0x3b')]=_0x4401a6[_0xa79e('0x3b')][_0xa79e('0x3e')]?_0x4401a6[_0xa79e('0x3b')]:_0x1a73cd[_0xa79e('0x37')];_0x4401a6[_0xa79e('0x41')]=qs[_0xa79e('0x42')](_0x4aadb3[_0xa79e('0x38')][_0xa79e('0x42')]);_0x4401a6[_0xa79e('0x43')]=qs[_0xa79e('0x3a')](_['pick'](_0x4aadb3['query'],_0x1a73cd[_0xa79e('0x3a')]));if(_0x4aadb3[_0xa79e('0x38')]['filter']){_0x4401a6[_0xa79e('0x43')]=_['merge'](_0x4401a6[_0xa79e('0x43')],{'$or':_[_0xa79e('0x33')](_0x4401a6[_0xa79e('0x3b')],function(_0xbc788e){var _0x3c3777={};_0x3c3777[_0xbc788e]={'$like':'%'+_0x4aadb3[_0xa79e('0x38')][_0xa79e('0x44')]+'%'};return _0x3c3777;})});}_0x4401a6=_[_0xa79e('0x45')]({},_0x4401a6,_0x4aadb3[_0xa79e('0x4f')]);return _0x37f00e[_0xa79e('0x7b')](_0x4401a6);}})['then'](function(_0x4dd953){if(_0x4dd953){_0x9ddcf6=_0x4dd953['length'];if(!_0x4aadb3[_0xa79e('0x38')]['hasOwnProperty']('nolimit')){_0x4401a6[_0xa79e('0x23')]=qs[_0xa79e('0x23')](_0x4aadb3[_0xa79e('0x38')]['limit']);_0x4401a6[_0xa79e('0x22')]=qs[_0xa79e('0x22')](_0x4aadb3[_0xa79e('0x38')]['offset']);}return _0x37f00e[_0xa79e('0x7b')](_0x4401a6);}})[_0xa79e('0x2a')](function(_0x2c1c5e){if(_0x2c1c5e){return _0x2c1c5e?{'count':_0x9ddcf6,'rows':_0x2c1c5e}:null;}})[_0xa79e('0x2a')](respondWithResult(_0x5cd0b2,null))['catch'](handleError(_0x5cd0b2,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 84ff6e2..d19a32d 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 _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x5964b2,_0x35b4cd){var _0x3dea9b=function(_0x3dab50){while(--_0x3dab50){_0x5964b2['push'](_0x5964b2['shift']());}};_0x3dea9b(++_0x35b4cd);}(_0x70e0,0x17b));var _0x070e=function(_0x5df8e8,_0x122cd1){_0x5df8e8=_0x5df8e8-0x0;var _0x3e9b96=_0x70e0[_0x5df8e8];return _0x3e9b96;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xedd9,0xfc));var _0x9edd=function(_0x116255,_0x1bb57b){_0x116255=_0x116255-0x0;var _0x5cfb32=_0xedd9[_0x116255];return _0x5cfb32;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 10f4ecd..79c8713 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 _0x9b51=['bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','voice_prefixes','lodash','util','../../config/logger','moment'];(function(_0x5f35c5,_0x48949c){var _0x5e5d64=function(_0x3e968f){while(--_0x3e968f){_0x5f35c5['push'](_0x5f35c5['shift']());}};_0x5e5d64(++_0x48949c);}(_0x9b51,0x167));var _0x19b5=function(_0x34954b,_0x525aec){_0x34954b=_0x34954b-0x0;var _0x245230=_0x9b51[_0x34954b];return _0x245230;};'use strict';var _=require(_0x19b5('0x0'));var util=require(_0x19b5('0x1'));var logger=require(_0x19b5('0x2'))('api');var moment=require(_0x19b5('0x3'));var BPromise=require(_0x19b5('0x4'));var rp=require(_0x19b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19b5('0x6'));var config=require(_0x19b5('0x7'));var attributes=require(_0x19b5('0x8'));module[_0x19b5('0x9')]=function(_0x5ef7c8,_0x165e92){return _0x5ef7c8['define']('VoicePrefix',attributes,{'tableName':_0x19b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb808=['../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb808,0x7b));var _0x8b80=function(_0x2efaa3,_0x35f359){_0x2efaa3=_0x2efaa3-0x0;var _0x24f34c=_0xb808[_0x2efaa3];return _0x24f34c;};'use strict';var _=require(_0x8b80('0x0'));var util=require(_0x8b80('0x1'));var logger=require(_0x8b80('0x2'))(_0x8b80('0x3'));var moment=require(_0x8b80('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b80('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b80('0x6'));var config=require(_0x8b80('0x7'));var attributes=require(_0x8b80('0x8'));module[_0x8b80('0x9')]=function(_0x496642,_0x803b26){return _0x496642[_0x8b80('0xa')](_0x8b80('0xb'),attributes,{'tableName':_0x8b80('0xc'),'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 c8c0521..cb1c3e9 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 _0xaf5a=['./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xaf5a,0x71));var _0xaaf5=function(_0x3789b9,_0x5c2f00){_0x3789b9=_0x3789b9-0x0;var _0x4d020d=_0xaf5a[_0x3789b9];return _0x4d020d;};'use strict';var _=require('lodash');var util=require(_0xaaf5('0x0'));var moment=require(_0xaaf5('0x1'));var BPromise=require('bluebird');var rs=require(_0xaaf5('0x2'));var fs=require('fs');var Redis=require(_0xaaf5('0x3'));var db=require(_0xaaf5('0x4'))['db'];var utils=require(_0xaaf5('0x5'));var logger=require('../../config/logger')(_0xaaf5('0x6'));var config=require('../../config/environment');var jayson=require(_0xaaf5('0x7'));var client=jayson[_0xaaf5('0x8')][_0xaaf5('0x9')]({'port':0x232a});config[_0xaaf5('0xa')]=_['defaults'](config[_0xaaf5('0xa')],{'host':_0xaaf5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaaf5('0xa')]));require(_0xaaf5('0xc'))[_0xaaf5('0xd')](socket);function respondWithRpcPromise(_0x33a477,_0x311c8f,_0x517503){return new BPromise(function(_0xdad35b,_0x2b0c4d){return client['request'](_0x33a477,_0x517503)[_0xaaf5('0xe')](function(_0x356908){logger['info'](_0xaaf5('0xf'),_0x311c8f,_0xaaf5('0x10'));logger[_0xaaf5('0x11')](_0xaaf5('0x12'),_0x311c8f,_0xaaf5('0x10'),JSON[_0xaaf5('0x13')](_0x356908));if(_0x356908[_0xaaf5('0x14')]){if(_0x356908[_0xaaf5('0x14')]['code']===0x1f4){logger['error'](_0xaaf5('0xf'),_0x311c8f,_0x356908[_0xaaf5('0x14')][_0xaaf5('0x15')]);return _0x2b0c4d(_0x356908[_0xaaf5('0x14')][_0xaaf5('0x15')]);}logger[_0xaaf5('0x14')](_0xaaf5('0xf'),_0x311c8f,_0x356908[_0xaaf5('0x14')][_0xaaf5('0x15')]);return _0xdad35b(_0x356908[_0xaaf5('0x14')][_0xaaf5('0x15')]);}else{logger[_0xaaf5('0x16')](_0xaaf5('0xf'),_0x311c8f,'request\x20sent');_0xdad35b(_0x356908[_0xaaf5('0x17')][_0xaaf5('0x15')]);}})[_0xaaf5('0x18')](function(_0x1d56d5){logger[_0xaaf5('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x311c8f,_0x1d56d5);_0x2b0c4d(_0x1d56d5);});});} \ No newline at end of file +var _0xad71=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','then'];(function(_0x2c6992,_0x5bf3ce){var _0x3361db=function(_0x4192a4){while(--_0x4192a4){_0x2c6992['push'](_0x2c6992['shift']());}};_0x3361db(++_0x5bf3ce);}(_0xad71,0x126));var _0x1ad7=function(_0x1d6cf0,_0x400647){_0x1d6cf0=_0x1d6cf0-0x0;var _0x4c19cd=_0xad71[_0x1d6cf0];return _0x4c19cd;};'use strict';var _=require(_0x1ad7('0x0'));var util=require('util');var moment=require(_0x1ad7('0x1'));var BPromise=require(_0x1ad7('0x2'));var rs=require(_0x1ad7('0x3'));var fs=require('fs');var Redis=require(_0x1ad7('0x4'));var db=require(_0x1ad7('0x5'))['db'];var utils=require(_0x1ad7('0x6'));var logger=require('../../config/logger')(_0x1ad7('0x7'));var config=require(_0x1ad7('0x8'));var jayson=require(_0x1ad7('0x9'));var client=jayson[_0x1ad7('0xa')][_0x1ad7('0xb')]({'port':0x232a});config[_0x1ad7('0xc')]=_[_0x1ad7('0xd')](config['redis'],{'host':_0x1ad7('0xe'),'port':0x18eb});var socket=require(_0x1ad7('0xf'))(new Redis(config['redis']));require(_0x1ad7('0x10'))['register'](socket);function respondWithRpcPromise(_0x54bc8c,_0x7388e9,_0x9bba3c){return new BPromise(function(_0x324b6d,_0x2420f7){return client['request'](_0x54bc8c,_0x9bba3c)[_0x1ad7('0x11')](function(_0xb6291b){logger[_0x1ad7('0x12')](_0x1ad7('0x13'),_0x7388e9,_0x1ad7('0x14'));logger['debug'](_0x1ad7('0x15'),_0x7388e9,_0x1ad7('0x14'),JSON['stringify'](_0xb6291b));if(_0xb6291b[_0x1ad7('0x16')]){if(_0xb6291b[_0x1ad7('0x16')][_0x1ad7('0x17')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x7388e9,_0xb6291b['error'][_0x1ad7('0x18')]);return _0x2420f7(_0xb6291b[_0x1ad7('0x16')]['message']);}logger[_0x1ad7('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x7388e9,_0xb6291b['error'][_0x1ad7('0x18')]);return _0x324b6d(_0xb6291b[_0x1ad7('0x16')][_0x1ad7('0x18')]);}else{logger[_0x1ad7('0x12')](_0x1ad7('0x13'),_0x7388e9,_0x1ad7('0x14'));_0x324b6d(_0xb6291b[_0x1ad7('0x19')][_0x1ad7('0x18')]);}})['catch'](function(_0x18f75d){logger['error'](_0x1ad7('0x13'),_0x7388e9,_0x18f75d);_0x2420f7(_0x18f75d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4cc9bdf..698193b 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 _0xcfc2=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x14951e,_0x2b33f4){var _0x3583fa=function(_0x407bb2){while(--_0x407bb2){_0x14951e['push'](_0x14951e['shift']());}};_0x3583fa(++_0x2b33f4);}(_0xcfc2,0x163));var _0x2cfc=function(_0x138af8,_0x403891){_0x138af8=_0x138af8-0x0;var _0x203f72=_0xcfc2[_0x138af8];return _0x203f72;};'use strict';var VoicePrefixEvents=require(_0x2cfc('0x0'));var events=[_0x2cfc('0x1'),_0x2cfc('0x2'),_0x2cfc('0x3')];function createListener(_0x3bc37d,_0x2417f5){return function(_0x41b50d){_0x2417f5[_0x2cfc('0x4')](_0x3bc37d,_0x41b50d);};}function removeListener(_0x440367,_0x309c75){return function(){VoicePrefixEvents[_0x2cfc('0x5')](_0x440367,_0x309c75);};}exports[_0x2cfc('0x6')]=function(_0x751a2b){for(var _0x55fe84=0x0,_0x447cd1=events[_0x2cfc('0x7')];_0x55fe84<_0x447cd1;_0x55fe84++){var _0xaa0203=events[_0x55fe84];var _0x1973df=createListener(_0x2cfc('0x8')+_0xaa0203,_0x751a2b);VoicePrefixEvents['on'](_0xaa0203,_0x1973df);}}; \ No newline at end of file +var _0x41c0=['removeListener','register','./voicePrefix.events','remove','update','emit'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x41c0,0x140));var _0x041c=function(_0x4ce960,_0x4258e9){_0x4ce960=_0x4ce960-0x0;var _0x43a9d1=_0x41c0[_0x4ce960];return _0x43a9d1;};'use strict';var VoicePrefixEvents=require(_0x041c('0x0'));var events=['save',_0x041c('0x1'),_0x041c('0x2')];function createListener(_0x1cc831,_0x211b12){return function(_0x41b4de){_0x211b12[_0x041c('0x3')](_0x1cc831,_0x41b4de);};}function removeListener(_0x575cb3,_0x43d1bd){return function(){VoicePrefixEvents[_0x041c('0x4')](_0x575cb3,_0x43d1bd);};}exports[_0x041c('0x5')]=function(_0x125381){for(var _0x2750a2=0x0,_0xdf28a9=events['length'];_0x2750a2<_0xdf28a9;_0x2750a2++){var _0x3c4e56=events[_0x2750a2];var _0x55b818=createListener('voicePrefix:'+_0x3c4e56,_0x125381);VoicePrefixEvents['on'](_0x3c4e56,_0x55b818);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index b29ebb0..bbecfe2 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 _0xd4ba=['clone','/:id/teams','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','destroy','delete','removeTeams','removeAgents','/:id/lists','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id/hoppers','isAuthenticated','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getTeams','/:id/users','getAgents','getMembers','getLists','/:id/blacklists','getBlackLists','post','/:id/clone'];(function(_0x1113d9,_0x1d58f4){var _0x490060=function(_0x1d2005){while(--_0x1d2005){_0x1113d9['push'](_0x1113d9['shift']());}};_0x490060(++_0x1d58f4);}(_0xd4ba,0x1c7));var _0xad4b=function(_0x40cfcb,_0x321b60){_0x40cfcb=_0x40cfcb-0x0;var _0x8e698=_0xd4ba[_0x40cfcb];return _0x8e698;};'use strict';var multer=require(_0xad4b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xad4b('0x1'));var express=require(_0xad4b('0x2'));var router=express[_0xad4b('0x3')]();var auth=require(_0xad4b('0x4'));var interaction=require(_0xad4b('0x5'));var config=require(_0xad4b('0x6'));var controller=require('./voiceQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xad4b('0x7')]);router[_0xad4b('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xad4b('0x8')](_0xad4b('0x9'),auth[_0xad4b('0xa')](),controller['getHoppers']);router['get'](_0xad4b('0xb'),auth[_0xad4b('0xa')](),controller[_0xad4b('0xc')]);router[_0xad4b('0x8')](_0xad4b('0xd'),auth[_0xad4b('0xa')](),controller[_0xad4b('0xe')]);router[_0xad4b('0x8')](_0xad4b('0xf'),auth[_0xad4b('0xa')](),controller['getHopperBlacks']);router[_0xad4b('0x8')]('/:id/teams',auth[_0xad4b('0xa')](),controller[_0xad4b('0x10')]);router[_0xad4b('0x8')](_0xad4b('0x11'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x12')]);router[_0xad4b('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xad4b('0x13')]);router[_0xad4b('0x8')]('/:id/lists',auth[_0xad4b('0xa')](),controller[_0xad4b('0x14')]);router[_0xad4b('0x8')](_0xad4b('0x15'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x16')]);router[_0xad4b('0x17')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xad4b('0x18'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x19')]);router[_0xad4b('0x17')](_0xad4b('0x1a'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x1b')]);router['post'](_0xad4b('0x11'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x1c')]);router[_0xad4b('0x17')]('/:id/lists',auth[_0xad4b('0xa')](),controller[_0xad4b('0x1d')]);router[_0xad4b('0x17')]('/:id/blacklists',auth[_0xad4b('0xa')](),controller[_0xad4b('0x1e')]);router[_0xad4b('0x1f')](_0xad4b('0x20'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x21')]);router['delete']('/:id',auth[_0xad4b('0xa')](),controller[_0xad4b('0x22')]);router[_0xad4b('0x23')]('/:id/teams',auth[_0xad4b('0xa')](),controller[_0xad4b('0x24')]);router[_0xad4b('0x23')](_0xad4b('0x11'),auth[_0xad4b('0xa')](),controller[_0xad4b('0x25')]);router[_0xad4b('0x23')](_0xad4b('0x26'),auth['isAuthenticated'](),controller['removeLists']);router[_0xad4b('0x23')](_0xad4b('0x15'),auth[_0xad4b('0xa')](),controller['removeBlackLists']);module[_0xad4b('0x27')]=router; \ No newline at end of file +var _0x54c5=['/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','/:id/members','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','addBlackLists','put','update','delete','destroy','removeTeams','removeLists','removeBlackLists','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x54c5,0x1f0));var _0x554c=function(_0x235446,_0x40ff49){_0x235446=_0x235446-0x0;var _0x13aae1=_0x54c5[_0x235446];return _0x13aae1;};'use strict';var multer=require(_0x554c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x554c('0x1'));var router=express[_0x554c('0x2')]();var auth=require(_0x554c('0x3'));var interaction=require(_0x554c('0x4'));var config=require(_0x554c('0x5'));var controller=require('./voiceQueue.controller');router[_0x554c('0x6')]('/',auth['isAuthenticated'](),controller[_0x554c('0x7')]);router['get'](_0x554c('0x8'),auth[_0x554c('0x9')](),controller['show']);router['get'](_0x554c('0xa'),auth['isAuthenticated'](),controller[_0x554c('0xb')]);router[_0x554c('0x6')](_0x554c('0xc'),auth[_0x554c('0x9')](),controller['getHopperHistories']);router['get'](_0x554c('0xd'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x554c('0xe'),auth[_0x554c('0x9')](),controller[_0x554c('0xf')]);router[_0x554c('0x6')](_0x554c('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x554c('0x6')](_0x554c('0x11'),auth[_0x554c('0x9')](),controller['getAgents']);router[_0x554c('0x6')](_0x554c('0x12'),auth[_0x554c('0x9')](),controller['getMembers']);router[_0x554c('0x6')](_0x554c('0x13'),auth['isAuthenticated'](),controller['getLists']);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x554c('0x14')]);router[_0x554c('0x15')]('/',auth['isAuthenticated'](),controller[_0x554c('0x16')]);router['post'](_0x554c('0x17'),auth[_0x554c('0x9')](),controller[_0x554c('0x18')]);router[_0x554c('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x554c('0x19')]);router[_0x554c('0x15')](_0x554c('0x11'),auth[_0x554c('0x9')](),controller[_0x554c('0x1a')]);router[_0x554c('0x15')](_0x554c('0x13'),auth['isAuthenticated'](),controller['addLists']);router[_0x554c('0x15')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x554c('0x1b')]);router[_0x554c('0x1c')](_0x554c('0x8'),auth[_0x554c('0x9')](),controller[_0x554c('0x1d')]);router[_0x554c('0x1e')](_0x554c('0x8'),auth[_0x554c('0x9')](),controller[_0x554c('0x1f')]);router[_0x554c('0x1e')](_0x554c('0x10'),auth[_0x554c('0x9')](),controller[_0x554c('0x20')]);router[_0x554c('0x1e')](_0x554c('0x11'),auth[_0x554c('0x9')](),controller['removeAgents']);router['delete'](_0x554c('0x13'),auth['isAuthenticated'](),controller[_0x554c('0x21')]);router['delete']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x554c('0x22')]);module[_0x554c('0x23')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 8cfc516..76a409f 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(_0x477b74,_0x28657a){var _0x43cc4f=function(_0x33f74e){while(--_0x33f74e){_0x477b74['push'](_0x477b74['shift']());}};_0x43cc4f(++_0x28657a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x1c1bbb,_0x38a0b8){var _0x2e667c=function(_0x154180){while(--_0x154180){_0x1c1bbb['push'](_0x1c1bbb['shift']());}};_0x2e667c(++_0x38a0b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 a965a4e..139a1e2 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 _0xab42=['ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','value','includes','type','name','UserProfileResource','error','index','map','VoiceQueue','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','params','find','create','body','role','user','inbound','userProfileId','autoAssociation','includeAll','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','rawAttributes','VoiceQueueId','CmHopper','findAll','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams'];(function(_0x4e1c3c,_0x2a8084){var _0x1c7150=function(_0x56daac){while(--_0x56daac){_0x4e1c3c['push'](_0x4e1c3c['shift']());}};_0x1c7150(++_0x2a8084);}(_0xab42,0x1a9));var _0x2ab4=function(_0x5f0096,_0x491e98){_0x5f0096=_0x5f0096-0x0;var _0x1e6b6b=_0xab42[_0x5f0096];return _0x1e6b6b;};'use strict';var pdf=require(_0x2ab4('0x0'));var emlformat=require(_0x2ab4('0x1'));var rimraf=require(_0x2ab4('0x2'));var zipdir=require(_0x2ab4('0x3'));var jsonpatch=require(_0x2ab4('0x4'));var rp=require(_0x2ab4('0x5'));var moment=require(_0x2ab4('0x6'));var BPromise=require(_0x2ab4('0x7'));var Mustache=require(_0x2ab4('0x8'));var util=require(_0x2ab4('0x9'));var path=require(_0x2ab4('0xa'));var sox=require(_0x2ab4('0xb'));var csv=require(_0x2ab4('0xc'));var ejs=require(_0x2ab4('0xd'));var fs=require('fs');var _=require(_0x2ab4('0xe'));var squel=require(_0x2ab4('0xf'));var crypto=require(_0x2ab4('0x10'));var jsforce=require(_0x2ab4('0x11'));var deskjs=require(_0x2ab4('0x12'));var toCsv=require('to-csv');var querystring=require(_0x2ab4('0x13'));var Papa=require(_0x2ab4('0x14'));var Redis=require('ioredis');var authService=require(_0x2ab4('0x15'));var qs=require(_0x2ab4('0x16'));var as=require(_0x2ab4('0x17'));var hardwareService=require(_0x2ab4('0x18'));var logger=require(_0x2ab4('0x19'))(_0x2ab4('0x1a'));var utils=require(_0x2ab4('0x1b'));var config=require('../../config/environment');var db=require(_0x2ab4('0x1c'))['db'];config['redis']=_[_0x2ab4('0x1d')](config[_0x2ab4('0x1e')],{'host':_0x2ab4('0x1f'),'port':0x18eb});var socket=require(_0x2ab4('0x20'))(new Redis(config['redis']));require(_0x2ab4('0x21'))['register'](socket);function respondWithStatusCode(_0x2c312b,_0x5d1298){_0x5d1298=_0x5d1298||0xcc;return function(_0x23824e){if(_0x23824e){return _0x2c312b[_0x2ab4('0x22')](_0x5d1298);}return _0x2c312b['status'](_0x5d1298)[_0x2ab4('0x23')]();};}function respondWithResult(_0x36f5cf,_0x36e459){_0x36e459=_0x36e459||0xc8;return function(_0x47eac7){if(_0x47eac7){return _0x36f5cf['status'](_0x36e459)[_0x2ab4('0x24')](_0x47eac7);}};}function respondWithFilteredResult(_0x1d821f,_0x1a523e){return function(_0x18f2cb){if(_0x18f2cb){var _0x1edcf2=_0x18f2cb[_0x2ab4('0x25')],_0x41ae97=_0x1a523e[_0x2ab4('0x26')],_0x53988d=_0x1a523e[_0x2ab4('0x26')]+_0x1a523e[_0x2ab4('0x27')],_0x39f548;if(_0x53988d>=_0x1edcf2){_0x53988d=_0x1edcf2;_0x39f548=0xc8;}else{_0x39f548=0xce;}_0x1d821f[_0x2ab4('0x28')](_0x39f548);return _0x1d821f[_0x2ab4('0x29')](_0x2ab4('0x2a'),_0x41ae97+'-'+_0x53988d+'/'+_0x1edcf2)[_0x2ab4('0x24')](_0x18f2cb);}return null;};}function patchUpdates(_0x4bcedf){return function(_0x4bf4a7){try{jsonpatch[_0x2ab4('0x2b')](_0x4bf4a7,_0x4bcedf,!![]);}catch(_0x4bfb54){return BPromise['reject'](_0x4bfb54);}return _0x4bf4a7['save']();};}function saveUpdates(_0x4af220,_0x454e4a){return function(_0x52d50e){if(_0x52d50e){return _0x52d50e['update'](_0x4af220)[_0x2ab4('0x2c')](function(_0x70bf64){return _0x70bf64;});}return null;};}function removeEntity(_0x40c852,_0x3a0ba9){return function(_0x469809){if(_0x469809){return _0x469809[_0x2ab4('0x2d')]()['then'](function(){var _0x39b1ad=_0x469809[_0x2ab4('0x2e')]({'plain':!![]});var _0x4a74a7=[{'name':_0x2ab4('0x2f'),'value':'inbound','ignore':![]},{'name':_0x2ab4('0x30'),'value':_0x2ab4('0x31'),'ignore':![]}];var _0xfe1236=_(_0x4a74a7)[_0x2ab4('0x32')](_0x2ab4('0x33'))['map'](_0x2ab4('0x34'))[_0x2ab4('0x34')]();if(_[_0x2ab4('0x35')](_0xfe1236,_0x39b1ad[_0x2ab4('0x36')])){return;}var _0x27421d=_['find'](_0x4a74a7,[_0x2ab4('0x34'),_0x39b1ad[_0x2ab4('0x36')]])[_0x2ab4('0x37')];return db[_0x2ab4('0x38')][_0x2ab4('0x2d')]({'where':{'type':_0x27421d,'resourceId':_0x39b1ad['id']}})['then'](function(){return _0x469809;});})['then'](function(){_0x40c852[_0x2ab4('0x28')](0xcc)[_0x2ab4('0x23')]();});}};}function handleEntityNotFound(_0x17e068,_0x171085){return function(_0x55aae8){if(!_0x55aae8){_0x17e068[_0x2ab4('0x22')](0x194);}return _0x55aae8;};}function handleError(_0x12c99d,_0xa2b793){_0xa2b793=_0xa2b793||0x1f4;return function(_0x5157a1){logger[_0x2ab4('0x39')](_0x5157a1['stack']);if(_0x5157a1[_0x2ab4('0x37')]){delete _0x5157a1[_0x2ab4('0x37')];}_0x12c99d[_0x2ab4('0x28')](_0xa2b793)['send'](_0x5157a1);};}exports[_0x2ab4('0x3a')]=function(_0x2cee4e,_0x23e675){var _0x5e57bd={},_0x54950c={},_0x48b877={'count':0x0,'rows':[]};var _0x434e0c=_[_0x2ab4('0x3b')](db[_0x2ab4('0x3c')]['rawAttributes'],function(_0x5c4894){return{'name':_0x5c4894[_0x2ab4('0x3d')],'type':_0x5c4894[_0x2ab4('0x36')]['key']};});_0x54950c[_0x2ab4('0x3e')]=_[_0x2ab4('0x3b')](_0x434e0c,_0x2ab4('0x37'));_0x54950c[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x2cee4e['query']);_0x54950c[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x54950c[_0x2ab4('0x3e')],_0x54950c[_0x2ab4('0x3f')]);_0x5e57bd[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x54950c['model'],qs[_0x2ab4('0x44')](_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x5e57bd['attributes']=_0x5e57bd['attributes'][_0x2ab4('0x45')]?_0x5e57bd[_0x2ab4('0x43')]:_0x54950c[_0x2ab4('0x3e')];if(!_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x5e57bd['limit']=qs['limit'](_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x5e57bd[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x2cee4e['query'][_0x2ab4('0x26')]);}_0x5e57bd[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x5e57bd[_0x2ab4('0x4a')]=qs[_0x2ab4('0x41')](_[_0x2ab4('0x4b')](_0x2cee4e[_0x2ab4('0x3f')],_0x54950c['filters']),_0x434e0c);if(_0x2cee4e['query'][_0x2ab4('0x32')]){_0x5e57bd['where']=_[_0x2ab4('0x4c')](_0x5e57bd[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x434e0c,function(_0xaf2942){if(_0xaf2942[_0x2ab4('0x36')]!==_0x2ab4('0x4d')){var _0x1942a7={};_0x1942a7[_0xaf2942['name']]={'$like':'%'+_0x2cee4e[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x1942a7;}})});}_0x5e57bd=_[_0x2ab4('0x4c')]({},_0x5e57bd,_0x2cee4e[_0x2ab4('0x4e')]);var _0xdec9db={'where':_0x5e57bd[_0x2ab4('0x4a')]};return db[_0x2ab4('0x3c')][_0x2ab4('0x25')](_0xdec9db)[_0x2ab4('0x2c')](function(_0x12b0f4){_0x48b877[_0x2ab4('0x25')]=_0x12b0f4;if(_0x2cee4e[_0x2ab4('0x3f')]['includeAll']){_0x5e57bd[_0x2ab4('0x4f')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x5e57bd);})[_0x2ab4('0x2c')](function(_0x36864d){_0x48b877['rows']=_0x36864d;return _0x48b877;})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x23e675,_0x5e57bd))[_0x2ab4('0x50')](handleError(_0x23e675,null));};exports[_0x2ab4('0x51')]=function(_0x33be56,_0x3f9514){var _0x1dd929={'raw':![],'where':{'id':_0x33be56[_0x2ab4('0x52')]['id']}},_0x497dda={};_0x497dda[_0x2ab4('0x3e')]=_['keys'](db[_0x2ab4('0x3c')]['rawAttributes']);_0x497dda['query']=_[_0x2ab4('0x40')](_0x33be56[_0x2ab4('0x3f')]);_0x497dda[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x497dda[_0x2ab4('0x3e')],_0x497dda[_0x2ab4('0x3f')]);_0x1dd929[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x497dda['model'],qs[_0x2ab4('0x44')](_0x33be56[_0x2ab4('0x3f')]['fields']));_0x1dd929[_0x2ab4('0x43')]=_0x1dd929[_0x2ab4('0x43')]['length']?_0x1dd929[_0x2ab4('0x43')]:_0x497dda[_0x2ab4('0x3e')];if(_0x33be56['query']['includeAll']){_0x1dd929['include']=[{'all':!![]}];}_0x1dd929=_['merge']({},_0x1dd929,_0x33be56['options']);return db[_0x2ab4('0x3c')][_0x2ab4('0x53')](_0x1dd929)[_0x2ab4('0x2c')](handleEntityNotFound(_0x3f9514,null))['then'](respondWithResult(_0x3f9514,null))[_0x2ab4('0x50')](handleError(_0x3f9514,null));};exports[_0x2ab4('0x54')]=function(_0x5da972,_0x55cd77){return db[_0x2ab4('0x3c')][_0x2ab4('0x54')](_0x5da972[_0x2ab4('0x55')],{})['then'](function(_0x2ec573){var _0x9a241c=_0x5da972['user'][_0x2ab4('0x2e')]({'plain':!![]});if(!_0x9a241c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9a241c[_0x2ab4('0x56')]===_0x2ab4('0x57')){var _0x405fed=_0x2ec573['get']({'plain':!![]});var _0x33fa3f=[{'name':_0x2ab4('0x2f'),'value':_0x2ab4('0x58')},{'name':_0x2ab4('0x30'),'value':_0x2ab4('0x31')}];var _0x9e807e=_[_0x2ab4('0x53')](_0x33fa3f,[_0x2ab4('0x34'),_0x405fed[_0x2ab4('0x36')]])['name'];return db['UserProfileSection'][_0x2ab4('0x53')]({'where':{'name':_0x9e807e,'userProfileId':_0x9a241c[_0x2ab4('0x59')]},'raw':!![]})['then'](function(_0x417b8b){if(_0x417b8b&&_0x417b8b[_0x2ab4('0x5a')]===0x0){return db[_0x2ab4('0x38')]['create']({'name':_0x405fed[_0x2ab4('0x37')],'resourceId':_0x405fed['id'],'type':_0x417b8b[_0x2ab4('0x37')],'sectionId':_0x417b8b['id']},{})['then'](function(){return _0x2ec573;});}else{return _0x2ec573;}})[_0x2ab4('0x50')](function(_0x21289f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21289f);throw _0x21289f;});}return _0x2ec573;})[_0x2ab4('0x2c')](respondWithResult(_0x55cd77,0xc9))[_0x2ab4('0x50')](handleError(_0x55cd77,null));};exports['clone']=function(_0x1e8654,_0x380067){var _0x1f21a1={'where':{'id':_0x1e8654[_0x2ab4('0x52')]['id']}},_0x3901c9={};_0x3901c9[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x3c')]['rawAttributes']);_0x1f21a1['attributes']=_[_0x2ab4('0x42')](_0x3901c9[_0x2ab4('0x3e')],qs[_0x2ab4('0x44')](_0x1e8654[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x1f21a1['attributes']=_0x1f21a1[_0x2ab4('0x43')]['length']?_0x1f21a1[_0x2ab4('0x43')]:_0x3901c9[_0x2ab4('0x3e')];if(_0x1e8654[_0x2ab4('0x3f')][_0x2ab4('0x5b')]){_0x1f21a1['include']=[{'all':!![]}];}_0x1f21a1=_[_0x2ab4('0x4c')]({},_0x1f21a1,_0x1e8654[_0x2ab4('0x4e')]);return db[_0x2ab4('0x3c')]['find'](_0x1f21a1)['then'](handleEntityNotFound(_0x380067,null))[_0x2ab4('0x2c')](function(_0xbcae70){if(_0xbcae70){var _0x83a2f0=_0xbcae70[_0x2ab4('0x2e')]({'plain':!![]});_0x83a2f0=qs[_0x2ab4('0x5c')](_0x83a2f0,['id',_0x2ab4('0x5d'),_0x2ab4('0x5e')]);_0x1e8654[_0x2ab4('0x55')]=_[_0x2ab4('0x5c')](_0x1e8654[_0x2ab4('0x55')],['id',_0x2ab4('0x5d'),'updatedAt']);return db[_0x2ab4('0x3c')]['create'](_[_0x2ab4('0x4c')](_0x83a2f0,_0x1e8654['body']),{'include':_0x1e8654[_0x2ab4('0x3f')][_0x2ab4('0x5b')]?[{'all':!![]}]:undefined})[_0x2ab4('0x2c')](function(_0x3abd00){var _0x1c7993=_0x1e8654[_0x2ab4('0x57')][_0x2ab4('0x2e')]({'plain':!![]});if(!_0x1c7993)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c7993[_0x2ab4('0x56')]===_0x2ab4('0x57')){var _0x130ade=_0x3abd00[_0x2ab4('0x2e')]({'plain':!![]});var _0x491e81=[{'name':_0x2ab4('0x2f'),'value':_0x2ab4('0x58')},{'name':'QueueCampaigns','value':_0x2ab4('0x31')}];var _0x5c6c4b=_[_0x2ab4('0x53')](_0x491e81,['value',_0x130ade[_0x2ab4('0x36')]])[_0x2ab4('0x37')];return db[_0x2ab4('0x5f')][_0x2ab4('0x53')]({'where':{'name':_0x5c6c4b,'userProfileId':_0x1c7993[_0x2ab4('0x59')]},'raw':!![]})[_0x2ab4('0x2c')](function(_0xce4652){if(_0xce4652&&_0xce4652[_0x2ab4('0x5a')]===0x0){return db[_0x2ab4('0x38')][_0x2ab4('0x54')]({'name':_0x130ade['name'],'resourceId':_0x130ade['id'],'type':_0xce4652[_0x2ab4('0x37')],'sectionId':_0xce4652['id']},{})['then'](function(){return _0x3abd00;});}else{return _0x3abd00;}})[_0x2ab4('0x50')](function(_0x568e6b){logger[_0x2ab4('0x39')](_0x2ab4('0x60'),_0x568e6b);throw _0x568e6b;});}return _0x3abd00;});}})['then'](respondWithResult(_0x380067,0xc9))[_0x2ab4('0x50')](handleError(_0x380067,null));};exports[_0x2ab4('0x61')]=function(_0x558688,_0x5d4ec6){if(_0x558688[_0x2ab4('0x55')]['id']){delete _0x558688[_0x2ab4('0x55')]['id'];}return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x558688[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d4ec6,null))[_0x2ab4('0x2c')](saveUpdates(_0x558688[_0x2ab4('0x55')],null))[_0x2ab4('0x2c')](respondWithResult(_0x5d4ec6,null))[_0x2ab4('0x50')](handleError(_0x5d4ec6,null));};exports['destroy']=function(_0x5ad131,_0x467d3e){return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x5ad131[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x467d3e,null))[_0x2ab4('0x2c')](removeEntity(_0x467d3e,null))[_0x2ab4('0x50')](handleError(_0x467d3e,null));};exports['getHoppers']=function(_0x163863,_0x509c14,_0x51712a){var _0x1bcc98={'raw':![],'where':{}};var _0x3f7998={};var _0x4b7c16={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2ab4('0x62')]({'where':{'id':_0x163863[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x509c14,null))[_0x2ab4('0x2c')](function(_0x1f0206){if(_0x1f0206){_0x3f7998[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db['CmHopper'][_0x2ab4('0x63')]);_0x3f7998['query']=_[_0x2ab4('0x40')](_0x163863['query']);_0x3f7998[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x3f7998[_0x2ab4('0x3e')],_0x3f7998[_0x2ab4('0x3f')]);_0x1bcc98[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x3f7998[_0x2ab4('0x3e')],qs['fields'](_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x1bcc98[_0x2ab4('0x43')]=_0x1bcc98[_0x2ab4('0x43')][_0x2ab4('0x45')]?_0x1bcc98[_0x2ab4('0x43')]:_0x3f7998[_0x2ab4('0x3e')];if(!_0x163863['query'][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x1bcc98['limit']=qs[_0x2ab4('0x27')](_0x163863['query'][_0x2ab4('0x27')]);_0x1bcc98[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}_0x1bcc98[_0x2ab4('0x48')]=qs['sort'](_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x1bcc98[_0x2ab4('0x4a')]=qs[_0x2ab4('0x41')](_[_0x2ab4('0x4b')](_0x163863['query'],_0x3f7998[_0x2ab4('0x41')]));_0x1bcc98[_0x2ab4('0x4a')][_0x2ab4('0x64')]=_0x1f0206['id'];if(_0x163863[_0x2ab4('0x3f')]['filter']){_0x1bcc98[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x1bcc98[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x1bcc98[_0x2ab4('0x43')],function(_0xbfbcb1){var _0x496073={};_0x496073[_0xbfbcb1]={'$like':'%'+_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x496073;})});}_0x1bcc98=_[_0x2ab4('0x4c')]({},_0x1bcc98,_0x163863[_0x2ab4('0x4e')]);return db['CmHopper'][_0x2ab4('0x25')]({'where':_0x1bcc98['where']})[_0x2ab4('0x2c')](function(_0x52e0ab){_0x4b7c16[_0x2ab4('0x25')]=_0x52e0ab;if(_0x163863[_0x2ab4('0x3f')][_0x2ab4('0x5b')]){_0x1bcc98[_0x2ab4('0x4f')]=[{'all':!![]}];}return db[_0x2ab4('0x65')][_0x2ab4('0x66')](_0x1bcc98);})[_0x2ab4('0x2c')](function(_0x151233){_0x4b7c16['rows']=_0x151233;return _0x4b7c16;});}})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x509c14,_0x1bcc98))[_0x2ab4('0x50')](handleError(_0x509c14,null));};exports['getHopperHistories']=function(_0x361656,_0x354eea,_0x436b28){var _0x349bd9={'raw':!![],'where':{}};var _0x58ff4b={};var _0x28121d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2ab4('0x62')]({'where':{'id':_0x361656['params']['id']}})['then'](handleEntityNotFound(_0x354eea,null))[_0x2ab4('0x2c')](function(_0x17c2ba){if(_0x17c2ba){_0x58ff4b[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x67')][_0x2ab4('0x63')]);_0x58ff4b[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x361656['query']);_0x58ff4b[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x58ff4b[_0x2ab4('0x3e')],_0x58ff4b[_0x2ab4('0x3f')]);_0x349bd9[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x58ff4b[_0x2ab4('0x3e')],qs[_0x2ab4('0x44')](_0x361656[_0x2ab4('0x3f')]['fields']));_0x349bd9[_0x2ab4('0x43')]=_0x349bd9[_0x2ab4('0x43')]['length']?_0x349bd9[_0x2ab4('0x43')]:_0x58ff4b[_0x2ab4('0x3e')];if(!_0x361656[_0x2ab4('0x3f')][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x349bd9['limit']=qs[_0x2ab4('0x27')](_0x361656[_0x2ab4('0x3f')]['limit']);_0x349bd9[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x361656[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}_0x349bd9[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x361656['query'][_0x2ab4('0x49')]);_0x349bd9['where']=qs['filters'](_[_0x2ab4('0x4b')](_0x361656['query'],_0x58ff4b[_0x2ab4('0x41')]));_0x349bd9[_0x2ab4('0x4a')][_0x2ab4('0x64')]=_0x17c2ba['id'];if(_0x361656[_0x2ab4('0x3f')][_0x2ab4('0x32')]){_0x349bd9[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x349bd9[_0x2ab4('0x4a')],{'$or':_['map'](_0x349bd9[_0x2ab4('0x43')],function(_0x256f8c){var _0x1510f8={};_0x1510f8[_0x256f8c]={'$like':'%'+_0x361656[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x1510f8;})});}_0x349bd9=_['merge']({},_0x349bd9,_0x361656[_0x2ab4('0x4e')]);return db['CmHopperHistory'][_0x2ab4('0x25')]({'where':_0x349bd9[_0x2ab4('0x4a')]})[_0x2ab4('0x2c')](function(_0x1165d2){_0x28121d[_0x2ab4('0x25')]=_0x1165d2;if(_0x361656['query'][_0x2ab4('0x5b')]){_0x349bd9['include']=[{'all':!![]}];}return db[_0x2ab4('0x67')]['findAll'](_0x349bd9);})[_0x2ab4('0x2c')](function(_0x2f2e85){_0x28121d[_0x2ab4('0x68')]=_0x2f2e85;return _0x28121d;});}})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x354eea,_0x349bd9))['catch'](handleError(_0x354eea,null));};exports[_0x2ab4('0x69')]=function(_0xfc586c,_0x213689,_0x8abc10){var _0x2f0c75={'raw':!![],'where':{}};var _0x52a3dc={};var _0x2b3ab4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2ab4('0x62')]({'where':{'id':_0xfc586c['params']['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x213689,null))[_0x2ab4('0x2c')](function(_0x2df457){if(_0x2df457){_0x52a3dc[_0x2ab4('0x3e')]=_['keys'](db[_0x2ab4('0x6a')][_0x2ab4('0x63')]);_0x52a3dc[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0xfc586c[_0x2ab4('0x3f')]);_0x52a3dc['filters']=_['intersection'](_0x52a3dc[_0x2ab4('0x3e')],_0x52a3dc['query']);_0x2f0c75[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x52a3dc[_0x2ab4('0x3e')],qs['fields'](_0xfc586c['query'][_0x2ab4('0x44')]));_0x2f0c75[_0x2ab4('0x43')]=_0x2f0c75[_0x2ab4('0x43')]['length']?_0x2f0c75[_0x2ab4('0x43')]:_0x52a3dc['model'];if(!_0xfc586c['query']['hasOwnProperty'](_0x2ab4('0x47'))){_0x2f0c75['limit']=qs[_0x2ab4('0x27')](_0xfc586c[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x2f0c75[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0xfc586c['query'][_0x2ab4('0x26')]);}_0x2f0c75[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0xfc586c[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x2f0c75[_0x2ab4('0x4a')]=qs['filters'](_['pick'](_0xfc586c['query'],_0x52a3dc[_0x2ab4('0x41')]));_0x2f0c75[_0x2ab4('0x4a')][_0x2ab4('0x64')]=_0x2df457['id'];if(_0xfc586c[_0x2ab4('0x3f')][_0x2ab4('0x32')]){_0x2f0c75['where']=_[_0x2ab4('0x4c')](_0x2f0c75['where'],{'$or':_[_0x2ab4('0x3b')](_0x2f0c75[_0x2ab4('0x43')],function(_0x5af654){var _0x211ea3={};_0x211ea3[_0x5af654]={'$like':'%'+_0xfc586c[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x211ea3;})});}_0x2f0c75=_[_0x2ab4('0x4c')]({},_0x2f0c75,_0xfc586c[_0x2ab4('0x4e')]);return db[_0x2ab4('0x6a')][_0x2ab4('0x25')]({'where':_0x2f0c75[_0x2ab4('0x4a')]})['then'](function(_0x4adfbd){_0x2b3ab4['count']=_0x4adfbd;if(_0xfc586c[_0x2ab4('0x3f')]['includeAll']){_0x2f0c75[_0x2ab4('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x2ab4('0x66')](_0x2f0c75);})['then'](function(_0x5672e0){_0x2b3ab4['rows']=_0x5672e0;return _0x2b3ab4;});}})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x213689,_0x2f0c75))[_0x2ab4('0x50')](handleError(_0x213689,null));};exports[_0x2ab4('0x6b')]=function(_0x5136e1,_0x185c6a,_0x4c9566){var _0x1acc13={'raw':!![],'where':{}};var _0x41ff30={};var _0x5d451e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2ab4('0x62')]({'where':{'id':_0x5136e1[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x185c6a,null))['then'](function(_0x56bc69){if(_0x56bc69){_0x41ff30[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x6c')][_0x2ab4('0x63')]);_0x41ff30[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x5136e1[_0x2ab4('0x3f')]);_0x41ff30[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x41ff30[_0x2ab4('0x3e')],_0x41ff30[_0x2ab4('0x3f')]);_0x1acc13[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x41ff30[_0x2ab4('0x3e')],qs[_0x2ab4('0x44')](_0x5136e1[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x1acc13[_0x2ab4('0x43')]=_0x1acc13['attributes'][_0x2ab4('0x45')]?_0x1acc13['attributes']:_0x41ff30[_0x2ab4('0x3e')];if(!_0x5136e1['query'][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x1acc13[_0x2ab4('0x27')]=qs[_0x2ab4('0x27')](_0x5136e1[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x1acc13[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x5136e1[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}_0x1acc13['order']=qs['sort'](_0x5136e1[_0x2ab4('0x3f')]['sort']);_0x1acc13['where']=qs[_0x2ab4('0x41')](_['pick'](_0x5136e1[_0x2ab4('0x3f')],_0x41ff30['filters']));_0x1acc13[_0x2ab4('0x4a')][_0x2ab4('0x64')]=_0x56bc69['id'];if(_0x5136e1[_0x2ab4('0x3f')]['filter']){_0x1acc13[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x1acc13[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x1acc13[_0x2ab4('0x43')],function(_0x1e5589){var _0x3ec31d={};_0x3ec31d[_0x1e5589]={'$like':'%'+_0x5136e1[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x3ec31d;})});}_0x1acc13=_[_0x2ab4('0x4c')]({},_0x1acc13,_0x5136e1['options']);return db[_0x2ab4('0x6c')][_0x2ab4('0x25')]({'where':_0x1acc13[_0x2ab4('0x4a')]})[_0x2ab4('0x2c')](function(_0xec040f){_0x5d451e[_0x2ab4('0x25')]=_0xec040f;if(_0x5136e1['query']['includeAll']){_0x1acc13[_0x2ab4('0x4f')]=[{'all':!![]}];}return db[_0x2ab4('0x6c')][_0x2ab4('0x66')](_0x1acc13);})[_0x2ab4('0x2c')](function(_0x1f3b4f){_0x5d451e[_0x2ab4('0x68')]=_0x1f3b4f;return _0x5d451e;});}})[_0x2ab4('0x2c')](respondWithFilteredResult(_0x185c6a,_0x1acc13))[_0x2ab4('0x50')](handleError(_0x185c6a,null));};exports[_0x2ab4('0x6d')]=function(_0x413e14,_0x277efd,_0x76c6a3){var _0x289631={};var _0x1af76d={};var _0x2ddc2d;var _0x4d30c7;return db[_0x2ab4('0x3c')][_0x2ab4('0x62')]({'where':{'id':_0x413e14['params']['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x277efd,null))['then'](function(_0x112a61){if(_0x112a61){_0x2ddc2d=_0x112a61;_0x1af76d[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x6e')][_0x2ab4('0x63')]);_0x1af76d[_0x2ab4('0x3f')]=_['keys'](_0x413e14[_0x2ab4('0x3f')]);_0x1af76d[_0x2ab4('0x41')]=_['intersection'](_0x1af76d[_0x2ab4('0x3e')],_0x1af76d['query']);_0x289631[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x1af76d[_0x2ab4('0x3e')],qs['fields'](_0x413e14[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x289631['attributes']=_0x289631[_0x2ab4('0x43')][_0x2ab4('0x45')]?_0x289631['attributes']:_0x1af76d['model'];_0x289631[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x413e14['query'][_0x2ab4('0x49')]);_0x289631[_0x2ab4('0x4a')]=qs['filters'](_[_0x2ab4('0x4b')](_0x413e14['query'],_0x1af76d[_0x2ab4('0x41')]));if(_0x413e14['query'][_0x2ab4('0x32')]){_0x289631[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x289631['where'],{'$or':_['map'](_0x289631[_0x2ab4('0x43')],function(_0x492639){var _0x2437d7={};_0x2437d7[_0x492639]={'$like':'%'+_0x413e14[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x2437d7;})});}_0x289631=_[_0x2ab4('0x4c')]({},_0x289631,_0x413e14[_0x2ab4('0x4e')]);return _0x2ddc2d[_0x2ab4('0x6d')](_0x289631);}})[_0x2ab4('0x2c')](function(_0x1958b6){if(_0x1958b6){_0x4d30c7=_0x1958b6[_0x2ab4('0x45')];if(!_0x413e14[_0x2ab4('0x3f')]['hasOwnProperty']('nolimit')){_0x289631[_0x2ab4('0x27')]=qs['limit'](_0x413e14['query'][_0x2ab4('0x27')]);_0x289631[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x413e14[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}return _0x2ddc2d[_0x2ab4('0x6d')](_0x289631);}})[_0x2ab4('0x2c')](function(_0x3925c1){if(_0x3925c1){return _0x3925c1?{'count':_0x4d30c7,'rows':_0x3925c1}:null;}})[_0x2ab4('0x2c')](respondWithResult(_0x277efd,null))[_0x2ab4('0x50')](handleError(_0x277efd,null));};exports['addTeams']=function(_0x45d3ee,_0x2a097e,_0x32eaa1){var _0x15ac9a=_0x45d3ee[_0x2ab4('0x55')][_0x2ab4('0x6f')];var _0x2a4857=_[_0x2ab4('0x3b')](_0x15ac9a,'id');return db[_0x2ab4('0x6e')][_0x2ab4('0x66')]({'where':{'id':_0x2a4857},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2ab4('0x70'),'attributes':['id',_0x2ab4('0x37'),'online',_0x2ab4('0x71'),_0x2ab4('0x72')],'raw':!![]}]})[_0x2ab4('0x2c')](function(_0x5265ba){if(_0x5265ba){var _0xa94569=_[_0x2ab4('0x73')](_0x5265ba,function(_0x14c38f){var _0x319ac8=_0x14c38f[_0x2ab4('0x2e')]({'plain':!![]});_0x319ac8[_0x2ab4('0x70')][_0x2ab4('0x74')](function(_0x32c546){_0x32c546[_0x2ab4('0x75')]=_['find'](_0x15ac9a,{'id':_0x319ac8['id']})[_0x2ab4('0x75')];});return _0x319ac8[_0x2ab4('0x70')];});return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x45d3ee['params']['id']}})['then'](function(_0x10f5fe){return db[_0x2ab4('0x76')][_0x2ab4('0x77')](function(_0x1bf83d){return _0x10f5fe['addTeams'](_0x2a4857,{'transaction':_0x1bf83d})[_0x2ab4('0x2c')](function(){return BPromise[_0x2ab4('0x78')](_0xa94569,function(_0x3f8548){return db[_0x2ab4('0x79')][_0x2ab4('0x7a')]({'where':{'UserId':_0x3f8548['id'],'VoiceQueueId':_0x45d3ee[_0x2ab4('0x52')]['id']},'defaults':{'penalty':_0x3f8548[_0x2ab4('0x75')]},'transaction':_0x1bf83d});});})[_0x2ab4('0x2c')](function(){return BPromise[_0x2ab4('0x78')](_['filter'](_0xa94569,{'online':!![]}),function(_0x20aeb3){return db[_0x2ab4('0x7b')][_0x2ab4('0x7c')]({'membername':_0x20aeb3[_0x2ab4('0x37')],'UserId':_0x20aeb3['id'],'queue_name':_0x10f5fe[_0x2ab4('0x37')],'VoiceQueueId':_0x10f5fe['id'],'interface':_[_0x2ab4('0x7d')](_0x20aeb3[_0x2ab4('0x72')])?util[_0x2ab4('0x7e')](_0x2ab4('0x7f'),_0x20aeb3[_0x2ab4('0x37')]):_0x20aeb3['interface'],'paused':_0x20aeb3[_0x2ab4('0x71')]||![],'penalty':_0x20aeb3[_0x2ab4('0x75')]},{'transaction':_0x1bf83d});});})[_0x2ab4('0x2c')](function(){_0xa94569['forEach'](function(_0x31b1e2){socket[_0x2ab4('0x80')](_0x2ab4('0x81'),{'UserId':_0x31b1e2['id'],'VoiceQueueId':_0x10f5fe['id']});});});});});}})['then'](respondWithStatusCode(_0x2a097e,null))['catch'](handleError(_0x2a097e,null));};exports[_0x2ab4('0x82')]=function(_0x4ffce2,_0x230165,_0x5b635a){return db[_0x2ab4('0x6e')][_0x2ab4('0x66')]({'where':{'id':_0x4ffce2[_0x2ab4('0x3f')][_0x2ab4('0x83')]},'attributes':['id'],'include':[{'model':db[_0x2ab4('0x84')],'as':_0x2ab4('0x70'),'attributes':['id'],'raw':!![]}]})[_0x2ab4('0x2c')](handleEntityNotFound(_0x230165,null))[_0x2ab4('0x2c')](function(_0x2ab5c5){var _0x29adeb=_[_0x2ab4('0x3b')](_0x2ab5c5,'id');var _0x5c2ef6=[];var _0x2c3286=[];var _0x564115=squel[_0x2ab4('0x85')]();_0x564115[_0x2ab4('0x86')](_0x2ab4('0x87'))[_0x2ab4('0x88')](_0x2ab4('0x89'),'tq')['join'](_0x2ab4('0x8a'),'ut',_0x2ab4('0x8b'))[_0x2ab4('0x4a')](_0x2ab4('0x8c'),_0x4ffce2[_0x2ab4('0x52')]['id']);for(var _0x17f918=0x0;_0x17f918<_0x2ab5c5[_0x2ab4('0x45')];_0x17f918+=0x1){let _0x549f38=_0x2ab5c5[_0x17f918];for(var _0x59d512=0x0;_0x59d512<_0x549f38['Agents'][_0x2ab4('0x45')];_0x59d512+=0x1){let _0x1ddc76=_0x549f38['Agents'][_0x59d512];var _0x3883d1=_0x564115[_0x2ab4('0x8d')]();_0x3883d1['where'](_0x2ab4('0x8e'),_0x1ddc76['id']);_0x2c3286[_0x2ab4('0x8f')](db[_0x2ab4('0x76')][_0x2ab4('0x3f')](_0x3883d1[_0x2ab4('0x90')](),{'type':db[_0x2ab4('0x76')][_0x2ab4('0x91')]['SELECT']})['then'](function(_0x1760d3){if(_0x1760d3['length']===0x1){return _0x1ddc76['id'];}else{var _0x47e85d=_[_0x2ab4('0x92')](_['map'](_0x1760d3,_0x2ab4('0x93')),function(_0x4b7adc){return _['includes'](_0x29adeb,_0x4b7adc);});if(_0x47e85d){return _0x1ddc76['id'];}}}));}}return BPromise[_0x2ab4('0x94')](_0x2c3286)[_0x2ab4('0x2c')](function(_0xbdeb7){_0x5c2ef6=_(_0x5c2ef6)['union'](_0xbdeb7)[_0x2ab4('0x95')]()[_0x2ab4('0x34')]();return db['VoiceQueue'][_0x2ab4('0x53')]({'where':{'id':_0x4ffce2['params']['id']}})[_0x2ab4('0x2c')](function(_0x3349b6){return db['sequelize'][_0x2ab4('0x77')](function(_0xc5a2fc){return _0x3349b6[_0x2ab4('0x82')](_0x4ffce2[_0x2ab4('0x3f')]['ids'],{'transaction':_0xc5a2fc})['then'](function(){if(!_[_0x2ab4('0x96')](_0x5c2ef6)){return _0x3349b6[_0x2ab4('0x97')](_0x5c2ef6,{'transaction':_0xc5a2fc})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4ffce2[_0x2ab4('0x52')]['id'],'UserId':_0x5c2ef6},'transaction':_0xc5a2fc});});}})[_0x2ab4('0x2c')](function(){_0x5c2ef6[_0x2ab4('0x74')](function(_0x331bcf){socket[_0x2ab4('0x80')](_0x2ab4('0x98'),{'UserId':_0x331bcf,'VoiceQueueId':_0x3349b6['id']});});});});});});})[_0x2ab4('0x2c')](respondWithStatusCode(_0x230165,null))[_0x2ab4('0x50')](handleError(_0x230165,null));};exports[_0x2ab4('0x99')]=function(_0x5572d9,_0x3d7b98,_0x1b68e2){var _0x59904d,_0x4aef2b;return db[_0x2ab4('0x3c')]['find']({'where':{'id':_0x5572d9[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x3d7b98,null))[_0x2ab4('0x2c')](function(_0x370e4b){if(_0x370e4b){_0x4aef2b=_0x370e4b;return _0x370e4b[_0x2ab4('0x99')](_0x5572d9[_0x2ab4('0x55')][_0x2ab4('0x83')],_['omit'](_0x5572d9['body'],[_0x2ab4('0x83'),'id'])||{})[_0x2ab4('0x9a')](function(_0x35fbd1){for(var _0x3d646a=0x0;_0x3d646a<_0x5572d9[_0x2ab4('0x55')][_0x2ab4('0x83')][_0x2ab4('0x45')];_0x3d646a+=0x1){socket[_0x2ab4('0x80')](_0x2ab4('0x81'),{'UserId':_0x5572d9[_0x2ab4('0x55')][_0x2ab4('0x83')][_0x3d646a],'VoiceQueueId':_0x5572d9[_0x2ab4('0x52')]['id']});}return _0x35fbd1;});}})[_0x2ab4('0x2c')](function(_0x453ea9){_0x59904d=_0x453ea9||[];if(_0x4aef2b){return db[_0x2ab4('0x84')]['findAll']({'where':{'id':_0x5572d9['body'][_0x2ab4('0x83')]},'attributes':['id',_0x2ab4('0x37'),_0x2ab4('0x9b'),_0x2ab4('0x71'),_0x2ab4('0x72')],'raw':!![]});}})[_0x2ab4('0x2c')](function(_0x21426d){if(!_[_0x2ab4('0x96')](_0x21426d)){var _0x3ab261=[];for(var _0x4edcf6=0x0;_0x4edcf6<_0x21426d[_0x2ab4('0x45')];_0x4edcf6++){if(_0x21426d[_0x4edcf6][_0x2ab4('0x9b')]){_0x3ab261[_0x2ab4('0x8f')](db[_0x2ab4('0x7b')]['upsert']({'membername':_0x21426d[_0x4edcf6]['name'],'UserId':_0x21426d[_0x4edcf6]['id'],'queue_name':_0x4aef2b[_0x2ab4('0x37')],'VoiceQueueId':_0x4aef2b['id'],'interface':_[_0x2ab4('0x7d')](_0x21426d[_0x4edcf6][_0x2ab4('0x72')])?util[_0x2ab4('0x7e')](_0x2ab4('0x7f'),_0x21426d[_0x4edcf6][_0x2ab4('0x37')]):_0x21426d[_0x4edcf6][_0x2ab4('0x72')],'paused':_0x21426d[_0x4edcf6][_0x2ab4('0x71')]||![],'penalty':_0x5572d9[_0x2ab4('0x55')]['penalty']||0x0}));}}return BPromise['all'](_0x3ab261);}})[_0x2ab4('0x2c')](function(){return _0x59904d;})['then'](respondWithResult(_0x3d7b98,null))[_0x2ab4('0x50')](handleError(_0x3d7b98,null));};exports[_0x2ab4('0x97')]=function(_0xaa591e,_0xe2dfd2,_0x4f82d1){return db[_0x2ab4('0x3c')]['find']({'where':{'id':_0xaa591e[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0xe2dfd2,null))[_0x2ab4('0x2c')](function(_0x18e78d){if(_0x18e78d){return _0x18e78d['removeAgents'](_0xaa591e[_0x2ab4('0x3f')][_0x2ab4('0x83')])['then'](function(){if(_[_0x2ab4('0x9c')](_0xaa591e[_0x2ab4('0x3f')][_0x2ab4('0x83')])){for(var _0x4222c9=0x0;_0x4222c9<_0xaa591e['query']['ids'][_0x2ab4('0x45')];_0x4222c9+=0x1){socket[_0x2ab4('0x80')](_0x2ab4('0x98'),{'UserId':Number(_0xaa591e[_0x2ab4('0x3f')][_0x2ab4('0x83')][_0x4222c9]),'VoiceQueueId':Number(_0xaa591e['params']['id'])});}}else{socket[_0x2ab4('0x80')](_0x2ab4('0x98'),{'UserId':Number(_0xaa591e['query'][_0x2ab4('0x83')]),'VoiceQueueId':Number(_0xaa591e[_0x2ab4('0x52')]['id'])});}});}})[_0x2ab4('0x2c')](function(_0x555233){return db['UserVoiceQueueRt'][_0x2ab4('0x2d')]({'where':{'VoiceQueueId':_0xaa591e[_0x2ab4('0x52')]['id'],'UserId':_0xaa591e[_0x2ab4('0x3f')]['ids']}})[_0x2ab4('0x2c')](function(){return _0x555233;});})['then'](respondWithStatusCode(_0xe2dfd2,null))[_0x2ab4('0x50')](handleError(_0xe2dfd2,null));};exports[_0x2ab4('0x9d')]=function(_0x722499,_0x129425,_0x3782b2){var _0x2bf565={};var _0x1ddc5a={};var _0x5028a3;var _0x38321e;return db['VoiceQueue']['findOne']({'where':{'id':_0x722499[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x129425,null))[_0x2ab4('0x2c')](function(_0x56e688){if(_0x56e688){_0x5028a3=_0x56e688;_0x1ddc5a[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x84')][_0x2ab4('0x63')]);_0x1ddc5a[_0x2ab4('0x3f')]=_['keys'](_0x722499[_0x2ab4('0x3f')]);_0x1ddc5a[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x1ddc5a[_0x2ab4('0x3e')],_0x1ddc5a[_0x2ab4('0x3f')]);_0x2bf565[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x1ddc5a['model'],qs[_0x2ab4('0x44')](_0x722499['query'][_0x2ab4('0x44')]));_0x2bf565[_0x2ab4('0x43')]=_0x2bf565['attributes'][_0x2ab4('0x45')]?_0x2bf565[_0x2ab4('0x43')]:_0x1ddc5a['model'];_0x2bf565[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x722499[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x2bf565['where']=qs['filters'](_['pick'](_0x722499[_0x2ab4('0x3f')],_0x1ddc5a[_0x2ab4('0x41')]));if(_0x722499[_0x2ab4('0x3f')][_0x2ab4('0x32')]){_0x2bf565[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x2bf565[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x2bf565['attributes'],function(_0x283668){var _0x184351={};_0x184351[_0x283668]={'$like':'%'+_0x722499['query'][_0x2ab4('0x32')]+'%'};return _0x184351;})});}_0x2bf565=_[_0x2ab4('0x4c')]({},_0x2bf565,_0x722499[_0x2ab4('0x4e')]);return _0x5028a3[_0x2ab4('0x9d')](_0x2bf565);}})[_0x2ab4('0x2c')](function(_0x10b78e){if(_0x10b78e){_0x38321e=_0x10b78e[_0x2ab4('0x45')];if(!_0x722499[_0x2ab4('0x3f')][_0x2ab4('0x46')]('nolimit')){_0x2bf565[_0x2ab4('0x27')]=qs['limit'](_0x722499[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x2bf565[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x722499[_0x2ab4('0x3f')]['offset']);}return _0x5028a3[_0x2ab4('0x9d')](_0x2bf565);}})[_0x2ab4('0x2c')](function(_0x49aeae){if(_0x49aeae){return _0x49aeae?{'count':_0x38321e,'rows':_0x49aeae}:null;}})[_0x2ab4('0x2c')](respondWithResult(_0x129425,null))['catch'](handleError(_0x129425,null));};exports['getMembers']=function(_0x27ecbb,_0x4deb2d,_0x3e92bc){var _0x21c3c1={};var _0x363ba0={};var _0x3c7824;var _0x2bd277;return db[_0x2ab4('0x3c')]['findOne']({'where':{'id':_0x27ecbb[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x4deb2d,null))[_0x2ab4('0x2c')](function(_0x43e3e2){if(_0x43e3e2){_0x3c7824=_0x43e3e2;_0x363ba0[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0x7b')][_0x2ab4('0x63')]);_0x363ba0[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x27ecbb[_0x2ab4('0x3f')]);_0x363ba0[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x363ba0[_0x2ab4('0x3e')],_0x363ba0[_0x2ab4('0x3f')]);_0x21c3c1[_0x2ab4('0x43')]=_['intersection'](_0x363ba0[_0x2ab4('0x3e')],qs[_0x2ab4('0x44')](_0x27ecbb[_0x2ab4('0x3f')][_0x2ab4('0x44')]));_0x21c3c1[_0x2ab4('0x43')]=_0x21c3c1[_0x2ab4('0x43')][_0x2ab4('0x45')]?_0x21c3c1[_0x2ab4('0x43')]:_0x363ba0[_0x2ab4('0x3e')];_0x21c3c1['order']=qs['sort'](_0x27ecbb[_0x2ab4('0x3f')][_0x2ab4('0x49')]);_0x21c3c1['where']=qs['filters'](_['pick'](_0x27ecbb[_0x2ab4('0x3f')],_0x363ba0['filters']));if(_0x27ecbb['query'][_0x2ab4('0x32')]){_0x21c3c1[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x21c3c1[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x21c3c1['attributes'],function(_0x393d60){var _0x463ee3={};_0x463ee3[_0x393d60]={'$like':'%'+_0x27ecbb[_0x2ab4('0x3f')][_0x2ab4('0x32')]+'%'};return _0x463ee3;})});}_0x21c3c1=_[_0x2ab4('0x4c')]({},_0x21c3c1,_0x27ecbb['options']);return _0x3c7824[_0x2ab4('0x9e')](_0x21c3c1);}})[_0x2ab4('0x2c')](function(_0x4acab6){if(_0x4acab6){_0x2bd277=_0x4acab6['length'];if(!_0x27ecbb['query'][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x21c3c1['limit']=qs[_0x2ab4('0x27')](_0x27ecbb[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x21c3c1[_0x2ab4('0x26')]=qs['offset'](_0x27ecbb['query'][_0x2ab4('0x26')]);}return _0x3c7824[_0x2ab4('0x9e')](_0x21c3c1);}})[_0x2ab4('0x2c')](function(_0x5a214b){return _0x5a214b?{'count':_0x2bd277,'rows':_0x5a214b}:null;})[_0x2ab4('0x2c')](respondWithResult(_0x4deb2d,null))[_0x2ab4('0x50')](handleError(_0x4deb2d,null));};exports[_0x2ab4('0x9f')]=function(_0x82ba2c,_0x4fa717,_0x3b92fa){var _0x12b613={};var _0xefc301={};var _0x20847c;var _0x258ee2;return db[_0x2ab4('0x3c')][_0x2ab4('0x62')]({'where':{'id':_0x82ba2c[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x4fa717,null))[_0x2ab4('0x2c')](function(_0x379cf7){if(_0x379cf7){_0x20847c=_0x379cf7;_0xefc301[_0x2ab4('0x3e')]=_[_0x2ab4('0x40')](db[_0x2ab4('0xa0')]['rawAttributes']);_0xefc301[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x82ba2c[_0x2ab4('0x3f')]);_0xefc301[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0xefc301['model'],_0xefc301[_0x2ab4('0x3f')]);_0x12b613[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0xefc301['model'],qs[_0x2ab4('0x44')](_0x82ba2c['query'][_0x2ab4('0x44')]));_0x12b613[_0x2ab4('0x43')]=_0x12b613['attributes'][_0x2ab4('0x45')]?_0x12b613['attributes']:_0xefc301[_0x2ab4('0x3e')];_0x12b613['order']=qs['sort'](_0x82ba2c['query'][_0x2ab4('0x49')]);_0x12b613[_0x2ab4('0x4a')]=qs[_0x2ab4('0x41')](_[_0x2ab4('0x4b')](_0x82ba2c[_0x2ab4('0x3f')],_0xefc301['filters']));if(_0x82ba2c['query'][_0x2ab4('0x32')]){_0x12b613[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x12b613[_0x2ab4('0x4a')],{'$or':_[_0x2ab4('0x3b')](_0x12b613[_0x2ab4('0x43')],function(_0x58df35){var _0x188462={};_0x188462[_0x58df35]={'$like':'%'+_0x82ba2c[_0x2ab4('0x3f')]['filter']+'%'};return _0x188462;})});}_0x12b613=_['merge']({},_0x12b613,_0x82ba2c[_0x2ab4('0x4e')]);return _0x20847c[_0x2ab4('0x9f')](_0x12b613);}})['then'](function(_0x163443){if(_0x163443){_0x258ee2=_0x163443[_0x2ab4('0x45')];if(!_0x82ba2c[_0x2ab4('0x3f')][_0x2ab4('0x46')](_0x2ab4('0x47'))){_0x12b613[_0x2ab4('0x27')]=qs[_0x2ab4('0x27')](_0x82ba2c['query'][_0x2ab4('0x27')]);_0x12b613[_0x2ab4('0x26')]=qs['offset'](_0x82ba2c[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}return _0x20847c[_0x2ab4('0x9f')](_0x12b613);}})['then'](function(_0x3c9360){if(_0x3c9360){return _0x3c9360?{'count':_0x258ee2,'rows':_0x3c9360}:null;}})['then'](respondWithResult(_0x4fa717,null))[_0x2ab4('0x50')](handleError(_0x4fa717,null));};exports[_0x2ab4('0xa1')]=function(_0x1bf20f,_0x2b4e91,_0xfba9){var _0x4fa1bb,_0x1a27ba;return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x1bf20f[_0x2ab4('0x52')]['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x2b4e91,null))[_0x2ab4('0x2c')](function(_0x1be7bf){if(_0x1be7bf){_0x1a27ba=_0x1be7bf;return _0x1be7bf[_0x2ab4('0xa1')](_0x1bf20f[_0x2ab4('0x55')]['ids'],_[_0x2ab4('0x5c')](_0x1bf20f[_0x2ab4('0x55')],['ids','id'])||{});}return null;})[_0x2ab4('0x9a')](function(_0x5321ec){var _0x3783e6;_0x4fa1bb=_0x5321ec||[];var _0x562189=[];if(_0x5321ec){for(var _0x7d006c=0x0;_0x7d006c<_0x5321ec['length'];_0x7d006c+=0x1){var _0x4bb859=_0x5321ec[_0x7d006c]['get']({'plain':!![]});_0x1a27ba[_0x2ab4('0xa2')]=_0x1bf20f[_0x2ab4('0x55')][_0x2ab4('0xa2')]?_0x1bf20f[_0x2ab4('0x55')]['dialCheckDuplicateType']:_0x1a27ba[_0x2ab4('0xa2')];switch(_0x1a27ba['dialCheckDuplicateType']){case _0x2ab4('0xa3'):_0x3783e6=squel[_0x2ab4('0xa4')]()['into'](_0x2ab4('0xa5'))['fromQuery']([_0x2ab4('0xa6'),_0x2ab4('0xa7'),_0x2ab4('0xa8'),_0x2ab4('0xa9'),_0x2ab4('0x64'),_0x2ab4('0x5d'),_0x2ab4('0x5e')],squel[_0x2ab4('0x85')]()[_0x2ab4('0x86')]('phone',_0x2ab4('0xa6'))[_0x2ab4('0x86')]('NOW()','scheduledAt')[_0x2ab4('0x86')]('id',_0x2ab4('0xa8'))[_0x2ab4('0x86')](_0x4bb859[_0x2ab4('0xaa')]['toString'](),_0x2ab4('0xa9'))[_0x2ab4('0x86')](_0x1bf20f['params']['id']['toString'](),_0x2ab4('0x64'))['field'](_0x2ab4('0xab'),'createdAt')[_0x2ab4('0x86')](_0x2ab4('0xab'),_0x2ab4('0x5e'))[_0x2ab4('0x88')](_0x2ab4('0xac'))['where'](_0x2ab4('0xad'))[_0x2ab4('0x4a')](_0x2ab4('0xae'),_0x4bb859['CmListId']['toString']())[_0x2ab4('0x4a')](_0x2ab4('0xaf'))[_0x2ab4('0x4a')](_0x2ab4('0xb0'),squel['select']()[_0x2ab4('0x86')](_0x2ab4('0xb1'))[_0x2ab4('0x88')](_0x2ab4('0xb2'))['where'](_0x2ab4('0x8c'),_0x1bf20f[_0x2ab4('0x52')]['id'][_0x2ab4('0x90')]()))[_0x2ab4('0x4a')](_0x2ab4('0xb0'),squel[_0x2ab4('0x85')]()[_0x2ab4('0x86')](_0x2ab4('0xb3'))[_0x2ab4('0x88')](_0x2ab4('0xa5'))['where'](_0x2ab4('0x8c'),_0x1bf20f[_0x2ab4('0x52')]['id']['toString']())))[_0x2ab4('0x90')]();break;case _0x2ab4('0xb4'):_0x3783e6=squel['insert']()[_0x2ab4('0xb5')](_0x2ab4('0xa5'))['fromQuery']([_0x2ab4('0xa6'),_0x2ab4('0xa7'),'ContactId',_0x2ab4('0xa9'),'VoiceQueueId',_0x2ab4('0x5d'),_0x2ab4('0x5e')],squel[_0x2ab4('0x85')]()['field'](_0x2ab4('0xa6'),'phone')['field'](_0x2ab4('0xab'),_0x2ab4('0xa7'))[_0x2ab4('0x86')]('id',_0x2ab4('0xa8'))['field'](_0x4bb859[_0x2ab4('0xaa')][_0x2ab4('0x90')](),'ListId')['field'](_0x1bf20f[_0x2ab4('0x52')]['id']['toString'](),_0x2ab4('0x64'))[_0x2ab4('0x86')](_0x2ab4('0xab'),'createdAt')[_0x2ab4('0x86')](_0x2ab4('0xab'),_0x2ab4('0x5e'))[_0x2ab4('0x88')](_0x2ab4('0xac'))[_0x2ab4('0x4a')](_0x2ab4('0xad'))[_0x2ab4('0x4a')](_0x2ab4('0xae'),_0x4bb859[_0x2ab4('0xaa')][_0x2ab4('0x90')]())[_0x2ab4('0x4a')](_0x2ab4('0xaf'))[_0x2ab4('0x4a')](_0x2ab4('0xb0'),squel['select']()[_0x2ab4('0x86')](_0x2ab4('0xb3'))['from'](_0x2ab4('0xa5'))[_0x2ab4('0x4a')]('VoiceQueueId\x20=\x20?',_0x1bf20f[_0x2ab4('0x52')]['id'][_0x2ab4('0x90')]())))[_0x2ab4('0x90')]();break;default:_0x3783e6=squel['insert']()[_0x2ab4('0xb5')]('cm_hopper')[_0x2ab4('0xb6')]([_0x2ab4('0xa6'),_0x2ab4('0xa7'),'ContactId',_0x2ab4('0xa9'),_0x2ab4('0x64'),_0x2ab4('0x5d'),_0x2ab4('0x5e')],squel[_0x2ab4('0x85')]()[_0x2ab4('0x86')](_0x2ab4('0xa6'),_0x2ab4('0xa6'))['field'](_0x2ab4('0xab'),'scheduledAt')['field']('id','ContactId')[_0x2ab4('0x86')](_0x4bb859['CmListId'][_0x2ab4('0x90')](),_0x2ab4('0xa9'))[_0x2ab4('0x86')](_0x1bf20f['params']['id'][_0x2ab4('0x90')](),_0x2ab4('0x64'))[_0x2ab4('0x86')](_0x2ab4('0xab'),_0x2ab4('0x5d'))['field'](_0x2ab4('0xab'),_0x2ab4('0x5e'))[_0x2ab4('0x88')](_0x2ab4('0xac'))['where'](_0x2ab4('0xad'))['where'](_0x2ab4('0xae'),_0x4bb859[_0x2ab4('0xaa')]['toString']())['where'](_0x2ab4('0xaf')))[_0x2ab4('0x90')]();}_0x562189[_0x2ab4('0x8f')](db[_0x2ab4('0x76')]['query'](_0x3783e6));}return BPromise['all'](_0x562189);}})['then'](function(){return _0x4fa1bb;})[_0x2ab4('0x2c')](respondWithResult(_0x2b4e91,null))[_0x2ab4('0x50')](handleError(_0x2b4e91,null));};exports[_0x2ab4('0xb7')]=function(_0x21400f,_0x100294,_0x1df750){return db[_0x2ab4('0x3c')][_0x2ab4('0x53')]({'where':{'id':_0x21400f['params']['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x100294,null))[_0x2ab4('0x2c')](function(_0x23261e){if(_0x23261e){return _0x23261e['removeLists'](_0x21400f[_0x2ab4('0x3f')][_0x2ab4('0x83')]);}})[_0x2ab4('0x2c')](function(_0x51f999){if(_0x51f999){return db[_0x2ab4('0x65')][_0x2ab4('0x2d')]({'where':{'ListId':_0x21400f[_0x2ab4('0x3f')][_0x2ab4('0x83')],'VoiceQueueId':_0x21400f[_0x2ab4('0x52')]['id']}})['then'](function(){return _0x51f999;});}})[_0x2ab4('0x2c')](respondWithStatusCode(_0x100294,null))[_0x2ab4('0x50')](handleError(_0x100294,null));};exports['getBlackLists']=function(_0x536b35,_0x1fd6c0,_0x4afdde){var _0x5f2577={};var _0x575c08={};var _0x55eec0;var _0x1e1c0b;return db[_0x2ab4('0x3c')][_0x2ab4('0x62')]({'where':{'id':_0x536b35[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x1fd6c0,null))[_0x2ab4('0x2c')](function(_0x5de286){if(_0x5de286){_0x55eec0=_0x5de286;_0x575c08['model']=_[_0x2ab4('0x40')](db['CmList']['rawAttributes']);_0x575c08[_0x2ab4('0x3f')]=_[_0x2ab4('0x40')](_0x536b35[_0x2ab4('0x3f')]);_0x575c08[_0x2ab4('0x41')]=_[_0x2ab4('0x42')](_0x575c08['model'],_0x575c08[_0x2ab4('0x3f')]);_0x5f2577[_0x2ab4('0x43')]=_[_0x2ab4('0x42')](_0x575c08[_0x2ab4('0x3e')],qs['fields'](_0x536b35['query'][_0x2ab4('0x44')]));_0x5f2577[_0x2ab4('0x43')]=_0x5f2577[_0x2ab4('0x43')][_0x2ab4('0x45')]?_0x5f2577[_0x2ab4('0x43')]:_0x575c08['model'];_0x5f2577[_0x2ab4('0x48')]=qs[_0x2ab4('0x49')](_0x536b35['query'][_0x2ab4('0x49')]);_0x5f2577[_0x2ab4('0x4a')]=qs[_0x2ab4('0x41')](_[_0x2ab4('0x4b')](_0x536b35[_0x2ab4('0x3f')],_0x575c08[_0x2ab4('0x41')]));if(_0x536b35[_0x2ab4('0x3f')][_0x2ab4('0x32')]){_0x5f2577[_0x2ab4('0x4a')]=_[_0x2ab4('0x4c')](_0x5f2577['where'],{'$or':_[_0x2ab4('0x3b')](_0x5f2577[_0x2ab4('0x43')],function(_0x4a9c54){var _0x1e0253={};_0x1e0253[_0x4a9c54]={'$like':'%'+_0x536b35['query'][_0x2ab4('0x32')]+'%'};return _0x1e0253;})});}_0x5f2577=_[_0x2ab4('0x4c')]({},_0x5f2577,_0x536b35['options']);return _0x55eec0[_0x2ab4('0xb8')](_0x5f2577);}})['then'](function(_0x2efb55){if(_0x2efb55){_0x1e1c0b=_0x2efb55[_0x2ab4('0x45')];if(!_0x536b35[_0x2ab4('0x3f')]['hasOwnProperty']('nolimit')){_0x5f2577[_0x2ab4('0x27')]=qs[_0x2ab4('0x27')](_0x536b35[_0x2ab4('0x3f')][_0x2ab4('0x27')]);_0x5f2577[_0x2ab4('0x26')]=qs[_0x2ab4('0x26')](_0x536b35[_0x2ab4('0x3f')][_0x2ab4('0x26')]);}return _0x55eec0['getBlackLists'](_0x5f2577);}})[_0x2ab4('0x2c')](function(_0x27fa62){if(_0x27fa62){return _0x27fa62?{'count':_0x1e1c0b,'rows':_0x27fa62}:null;}})['then'](respondWithResult(_0x1fd6c0,null))[_0x2ab4('0x50')](handleError(_0x1fd6c0,null));};exports[_0x2ab4('0xb9')]=function(_0xabf80c,_0xf45c3f,_0x1e547d){var _0x133b87,_0x1bcf83;return db[_0x2ab4('0x3c')]['find']({'where':{'id':_0xabf80c[_0x2ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0xf45c3f,null))['then'](function(_0x5b8e90){if(_0x5b8e90){_0x1bcf83=_0x5b8e90;return _0x5b8e90['addBlackLists'](_0xabf80c['body'][_0x2ab4('0x83')],_[_0x2ab4('0x5c')](_0xabf80c['body'],['ids','id'])||{});}return null;})[_0x2ab4('0x9a')](function(_0x25d6ce){var _0x2e1916;_0x133b87=_0x25d6ce||[];var _0x14a531=[];if(_0x25d6ce){for(var _0x9ab206=0x0;_0x9ab206<_0x25d6ce[_0x2ab4('0x45')];_0x9ab206+=0x1){var _0x197159=_0x25d6ce[_0x9ab206]['get']({'plain':!![]});_0x2e1916=squel['insert']()[_0x2ab4('0xb5')](_0x2ab4('0xba'))[_0x2ab4('0xb6')]([_0x2ab4('0xa6'),_0x2ab4('0xa8'),_0x2ab4('0xa9'),_0x2ab4('0x64'),'createdAt','updatedAt'],squel[_0x2ab4('0x85')]()[_0x2ab4('0x86')](_0x2ab4('0xa6'),_0x2ab4('0xa6'))['field']('id',_0x2ab4('0xa8'))[_0x2ab4('0x86')](_0x197159[_0x2ab4('0xaa')][_0x2ab4('0x90')](),'ListId')[_0x2ab4('0x86')](_0xabf80c[_0x2ab4('0x52')]['id'][_0x2ab4('0x90')](),_0x2ab4('0x64'))[_0x2ab4('0x86')]('NOW()',_0x2ab4('0x5d'))[_0x2ab4('0x86')]('NOW()',_0x2ab4('0x5e'))['from'](_0x2ab4('0xac'))[_0x2ab4('0x4a')]('deletedAt\x20IS\x20NULL')[_0x2ab4('0x4a')]('ListId\x20=\x20?',_0x197159['CmListId']['toString']())[_0x2ab4('0x4a')](_0x2ab4('0xaf')))[_0x2ab4('0x90')]();_0x14a531[_0x2ab4('0x8f')](db[_0x2ab4('0x76')][_0x2ab4('0x3f')](_0x2e1916));}return BPromise[_0x2ab4('0x94')](_0x14a531);}})[_0x2ab4('0x2c')](function(){return _0x133b87;})['then'](respondWithResult(_0xf45c3f,null))[_0x2ab4('0x50')](handleError(_0xf45c3f,null));};exports[_0x2ab4('0xbb')]=function(_0x5297ad,_0x3ce039,_0x32b863){return db['VoiceQueue'][_0x2ab4('0x53')]({'where':{'id':_0x5297ad['params']['id']}})[_0x2ab4('0x2c')](handleEntityNotFound(_0x3ce039,null))[_0x2ab4('0x2c')](function(_0x2efa0d){if(_0x2efa0d){return _0x2efa0d[_0x2ab4('0xbb')](_0x5297ad['query']['ids']);}})[_0x2ab4('0x2c')](function(_0x39cd8b){if(_0x39cd8b){return db[_0x2ab4('0x6c')]['destroy']({'where':{'ListId':_0x5297ad[_0x2ab4('0x3f')][_0x2ab4('0x83')],'VoiceQueueId':_0x5297ad['params']['id']}})['then'](function(){return _0x39cd8b;});}})['then'](respondWithStatusCode(_0x3ce039,null))[_0x2ab4('0x50')](handleError(_0x3ce039,null));}; \ No newline at end of file +var _0xf62e=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./voiceQueue.socket','register','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','get','VoiceQueues','inbound','outbound','ignore','value','includes','type','find','UserProfileResource','error','stack','name','send','index','map','VoiceQueue','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','findAll','rows','show','params','keys','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','pick','filter','getHopperHistories','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','forEach','each','UserVoiceQueue','findOrCreate','penalty','UserVoiceQueueRt','upsert','SIP/%s','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','sequelize','every','TeamId','all','transaction','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','ids','spread','push','isNil','format','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','fromQuery','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x1a4e2e,_0x4366d9){var _0x327401=function(_0x21e5f3){while(--_0x21e5f3){_0x1a4e2e['push'](_0x1a4e2e['shift']());}};_0x327401(++_0x4366d9);}(_0xf62e,0x160));var _0xef62=function(_0x5e6954,_0x2d755c){_0x5e6954=_0x5e6954-0x0;var _0x261f97=_0xf62e[_0x5e6954];return _0x261f97;};'use strict';var pdf=require(_0xef62('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xef62('0x1'));var zipdir=require(_0xef62('0x2'));var jsonpatch=require(_0xef62('0x3'));var rp=require(_0xef62('0x4'));var moment=require('moment');var BPromise=require(_0xef62('0x5'));var Mustache=require(_0xef62('0x6'));var util=require(_0xef62('0x7'));var path=require(_0xef62('0x8'));var sox=require(_0xef62('0x9'));var csv=require(_0xef62('0xa'));var ejs=require(_0xef62('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xef62('0xc'));var crypto=require(_0xef62('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xef62('0xe'));var toCsv=require(_0xef62('0xa'));var querystring=require(_0xef62('0xf'));var Papa=require(_0xef62('0x10'));var Redis=require(_0xef62('0x11'));var authService=require(_0xef62('0x12'));var qs=require(_0xef62('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xef62('0x14'));var utils=require('../../config/utils');var config=require(_0xef62('0x15'));var db=require(_0xef62('0x16'))['db'];config[_0xef62('0x17')]=_['defaults'](config['redis'],{'host':_0xef62('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xef62('0x17')]));require(_0xef62('0x19'))[_0xef62('0x1a')](socket);function respondWithStatusCode(_0x1308d6,_0x3889d4){_0x3889d4=_0x3889d4||0xcc;return function(_0x20824a){if(_0x20824a){return _0x1308d6['sendStatus'](_0x3889d4);}return _0x1308d6[_0xef62('0x1b')](_0x3889d4)[_0xef62('0x1c')]();};}function respondWithResult(_0x5cb33c,_0x5d5949){_0x5d5949=_0x5d5949||0xc8;return function(_0x3766a4){if(_0x3766a4){return _0x5cb33c['status'](_0x5d5949)[_0xef62('0x1d')](_0x3766a4);}};}function respondWithFilteredResult(_0x18b447,_0x3d28bc){return function(_0x1e52f3){if(_0x1e52f3){var _0x5e0852=_0x1e52f3[_0xef62('0x1e')],_0x379c2e=_0x3d28bc['offset'],_0x5e9fc3=_0x3d28bc[_0xef62('0x1f')]+_0x3d28bc[_0xef62('0x20')],_0x3a5be9;if(_0x5e9fc3>=_0x5e0852){_0x5e9fc3=_0x5e0852;_0x3a5be9=0xc8;}else{_0x3a5be9=0xce;}_0x18b447[_0xef62('0x1b')](_0x3a5be9);return _0x18b447[_0xef62('0x21')]('Content-Range',_0x379c2e+'-'+_0x5e9fc3+'/'+_0x5e0852)[_0xef62('0x1d')](_0x1e52f3);}return null;};}function patchUpdates(_0x52c0ba){return function(_0x5935ac){try{jsonpatch[_0xef62('0x22')](_0x5935ac,_0x52c0ba,!![]);}catch(_0x4bcf14){return BPromise[_0xef62('0x23')](_0x4bcf14);}return _0x5935ac['save']();};}function saveUpdates(_0x2c7143,_0x51cea0){return function(_0x53d03a){if(_0x53d03a){return _0x53d03a[_0xef62('0x24')](_0x2c7143)[_0xef62('0x25')](function(_0x204c33){return _0x204c33;});}return null;};}function removeEntity(_0x503cb4,_0x4906ea){return function(_0x299474){if(_0x299474){return _0x299474[_0xef62('0x26')]()['then'](function(){var _0x3f69f9=_0x299474[_0xef62('0x27')]({'plain':!![]});var _0x15350e=[{'name':_0xef62('0x28'),'value':_0xef62('0x29'),'ignore':![]},{'name':'QueueCampaigns','value':_0xef62('0x2a'),'ignore':![]}];var _0x2f346d=_(_0x15350e)['filter'](_0xef62('0x2b'))['map'](_0xef62('0x2c'))['value']();if(_[_0xef62('0x2d')](_0x2f346d,_0x3f69f9[_0xef62('0x2e')])){return;}var _0x504f49=_[_0xef62('0x2f')](_0x15350e,['value',_0x3f69f9[_0xef62('0x2e')]])['name'];return db[_0xef62('0x30')][_0xef62('0x26')]({'where':{'type':_0x504f49,'resourceId':_0x3f69f9['id']}})[_0xef62('0x25')](function(){return _0x299474;});})[_0xef62('0x25')](function(){_0x503cb4['status'](0xcc)[_0xef62('0x1c')]();});}};}function handleEntityNotFound(_0x414c87,_0x3371e7){return function(_0x6c6d53){if(!_0x6c6d53){_0x414c87['sendStatus'](0x194);}return _0x6c6d53;};}function handleError(_0x1e6437,_0x4f83e0){_0x4f83e0=_0x4f83e0||0x1f4;return function(_0x96cdb){logger[_0xef62('0x31')](_0x96cdb[_0xef62('0x32')]);if(_0x96cdb[_0xef62('0x33')]){delete _0x96cdb[_0xef62('0x33')];}_0x1e6437['status'](_0x4f83e0)[_0xef62('0x34')](_0x96cdb);};}exports[_0xef62('0x35')]=function(_0x3c8dcd,_0x1d187c){var _0x4a02c1={},_0x2547be={},_0x55b7e9={'count':0x0,'rows':[]};var _0x406239=_[_0xef62('0x36')](db[_0xef62('0x37')][_0xef62('0x38')],function(_0x26d1c1){return{'name':_0x26d1c1['fieldName'],'type':_0x26d1c1[_0xef62('0x2e')]['key']};});_0x2547be[_0xef62('0x39')]=_['map'](_0x406239,_0xef62('0x33'));_0x2547be[_0xef62('0x3a')]=_['keys'](_0x3c8dcd[_0xef62('0x3a')]);_0x2547be[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x2547be[_0xef62('0x39')],_0x2547be[_0xef62('0x3a')]);_0x4a02c1[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x2547be[_0xef62('0x39')],qs[_0xef62('0x3e')](_0x3c8dcd[_0xef62('0x3a')][_0xef62('0x3e')]));_0x4a02c1[_0xef62('0x3d')]=_0x4a02c1[_0xef62('0x3d')][_0xef62('0x3f')]?_0x4a02c1[_0xef62('0x3d')]:_0x2547be[_0xef62('0x39')];if(!_0x3c8dcd['query'][_0xef62('0x40')](_0xef62('0x41'))){_0x4a02c1['limit']=qs[_0xef62('0x20')](_0x3c8dcd['query']['limit']);_0x4a02c1[_0xef62('0x1f')]=qs[_0xef62('0x1f')](_0x3c8dcd[_0xef62('0x3a')]['offset']);}_0x4a02c1[_0xef62('0x42')]=qs[_0xef62('0x43')](_0x3c8dcd[_0xef62('0x3a')][_0xef62('0x43')]);_0x4a02c1[_0xef62('0x44')]=qs[_0xef62('0x3b')](_['pick'](_0x3c8dcd[_0xef62('0x3a')],_0x2547be[_0xef62('0x3b')]),_0x406239);if(_0x3c8dcd[_0xef62('0x3a')]['filter']){_0x4a02c1['where']=_['merge'](_0x4a02c1['where'],{'$or':_[_0xef62('0x36')](_0x406239,function(_0x18df54){if(_0x18df54['type']!==_0xef62('0x45')){var _0x399a39={};_0x399a39[_0x18df54['name']]={'$like':'%'+_0x3c8dcd['query']['filter']+'%'};return _0x399a39;}})});}_0x4a02c1=_[_0xef62('0x46')]({},_0x4a02c1,_0x3c8dcd[_0xef62('0x47')]);var _0x5363bf={'where':_0x4a02c1[_0xef62('0x44')]};return db[_0xef62('0x37')]['count'](_0x5363bf)[_0xef62('0x25')](function(_0x29a555){_0x55b7e9[_0xef62('0x1e')]=_0x29a555;if(_0x3c8dcd[_0xef62('0x3a')]['includeAll']){_0x4a02c1['include']=[{'all':!![]}];}return db[_0xef62('0x37')][_0xef62('0x48')](_0x4a02c1);})[_0xef62('0x25')](function(_0x562b8d){_0x55b7e9[_0xef62('0x49')]=_0x562b8d;return _0x55b7e9;})[_0xef62('0x25')](respondWithFilteredResult(_0x1d187c,_0x4a02c1))['catch'](handleError(_0x1d187c,null));};exports[_0xef62('0x4a')]=function(_0x1a0291,_0x2131aa){var _0x30d643={'raw':![],'where':{'id':_0x1a0291[_0xef62('0x4b')]['id']}},_0x592b63={};_0x592b63['model']=_[_0xef62('0x4c')](db[_0xef62('0x37')][_0xef62('0x38')]);_0x592b63['query']=_[_0xef62('0x4c')](_0x1a0291[_0xef62('0x3a')]);_0x592b63[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x592b63[_0xef62('0x39')],_0x592b63[_0xef62('0x3a')]);_0x30d643[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x592b63['model'],qs[_0xef62('0x3e')](_0x1a0291[_0xef62('0x3a')][_0xef62('0x3e')]));_0x30d643[_0xef62('0x3d')]=_0x30d643[_0xef62('0x3d')][_0xef62('0x3f')]?_0x30d643[_0xef62('0x3d')]:_0x592b63[_0xef62('0x39')];if(_0x1a0291[_0xef62('0x3a')]['includeAll']){_0x30d643[_0xef62('0x4d')]=[{'all':!![]}];}_0x30d643=_[_0xef62('0x46')]({},_0x30d643,_0x1a0291['options']);return db['VoiceQueue'][_0xef62('0x2f')](_0x30d643)[_0xef62('0x25')](handleEntityNotFound(_0x2131aa,null))['then'](respondWithResult(_0x2131aa,null))[_0xef62('0x4e')](handleError(_0x2131aa,null));};exports[_0xef62('0x4f')]=function(_0x32512a,_0x5eee07){return db[_0xef62('0x37')][_0xef62('0x4f')](_0x32512a[_0xef62('0x50')],{})['then'](function(_0x5f0efd){var _0x2280e6=_0x32512a[_0xef62('0x51')][_0xef62('0x27')]({'plain':!![]});if(!_0x2280e6)throw new Error(_0xef62('0x52'));if(_0x2280e6[_0xef62('0x53')]===_0xef62('0x51')){var _0x338a81=_0x5f0efd[_0xef62('0x27')]({'plain':!![]});var _0x10f0cd=[{'name':_0xef62('0x28'),'value':_0xef62('0x29')},{'name':_0xef62('0x54'),'value':_0xef62('0x2a')}];var _0x92994b=_['find'](_0x10f0cd,['value',_0x338a81[_0xef62('0x2e')]])['name'];return db['UserProfileSection'][_0xef62('0x2f')]({'where':{'name':_0x92994b,'userProfileId':_0x2280e6[_0xef62('0x55')]},'raw':!![]})['then'](function(_0xb63a65){if(_0xb63a65&&_0xb63a65[_0xef62('0x56')]===0x0){return db[_0xef62('0x30')]['create']({'name':_0x338a81[_0xef62('0x33')],'resourceId':_0x338a81['id'],'type':_0xb63a65[_0xef62('0x33')],'sectionId':_0xb63a65['id']},{})[_0xef62('0x25')](function(){return _0x5f0efd;});}else{return _0x5f0efd;}})[_0xef62('0x4e')](function(_0x40d823){logger[_0xef62('0x31')](_0xef62('0x57'),_0x40d823);throw _0x40d823;});}return _0x5f0efd;})[_0xef62('0x25')](respondWithResult(_0x5eee07,0xc9))[_0xef62('0x4e')](handleError(_0x5eee07,null));};exports['clone']=function(_0x1e2af8,_0x4df3f6){var _0x4e60e3={'where':{'id':_0x1e2af8[_0xef62('0x4b')]['id']}},_0x3d73d0={};_0x3d73d0[_0xef62('0x39')]=_['keys'](db[_0xef62('0x37')][_0xef62('0x38')]);_0x4e60e3[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x3d73d0[_0xef62('0x39')],qs['fields'](_0x1e2af8[_0xef62('0x3a')][_0xef62('0x3e')]));_0x4e60e3[_0xef62('0x3d')]=_0x4e60e3[_0xef62('0x3d')]['length']?_0x4e60e3[_0xef62('0x3d')]:_0x3d73d0[_0xef62('0x39')];if(_0x1e2af8[_0xef62('0x3a')][_0xef62('0x58')]){_0x4e60e3[_0xef62('0x4d')]=[{'all':!![]}];}_0x4e60e3=_[_0xef62('0x46')]({},_0x4e60e3,_0x1e2af8[_0xef62('0x47')]);return db[_0xef62('0x37')][_0xef62('0x2f')](_0x4e60e3)[_0xef62('0x25')](handleEntityNotFound(_0x4df3f6,null))[_0xef62('0x25')](function(_0x3835dc){if(_0x3835dc){var _0x430eba=_0x3835dc[_0xef62('0x27')]({'plain':!![]});_0x430eba=qs[_0xef62('0x59')](_0x430eba,['id',_0xef62('0x5a'),'updatedAt']);_0x1e2af8[_0xef62('0x50')]=_[_0xef62('0x59')](_0x1e2af8[_0xef62('0x50')],['id',_0xef62('0x5a'),_0xef62('0x5b')]);return db[_0xef62('0x37')][_0xef62('0x4f')](_['merge'](_0x430eba,_0x1e2af8[_0xef62('0x50')]),{'include':_0x1e2af8[_0xef62('0x3a')][_0xef62('0x58')]?[{'all':!![]}]:undefined})['then'](function(_0x193d07){var _0xec5ddc=_0x1e2af8[_0xef62('0x51')]['get']({'plain':!![]});if(!_0xec5ddc)throw new Error(_0xef62('0x52'));if(_0xec5ddc[_0xef62('0x53')]===_0xef62('0x51')){var _0xf3a26b=_0x193d07[_0xef62('0x27')]({'plain':!![]});var _0x356466=[{'name':'VoiceQueues','value':_0xef62('0x29')},{'name':_0xef62('0x54'),'value':_0xef62('0x2a')}];var _0x291602=_[_0xef62('0x2f')](_0x356466,[_0xef62('0x2c'),_0xf3a26b['type']])[_0xef62('0x33')];return db[_0xef62('0x5c')][_0xef62('0x2f')]({'where':{'name':_0x291602,'userProfileId':_0xec5ddc['userProfileId']},'raw':!![]})['then'](function(_0x1cb7cb){if(_0x1cb7cb&&_0x1cb7cb[_0xef62('0x56')]===0x0){return db[_0xef62('0x30')][_0xef62('0x4f')]({'name':_0xf3a26b[_0xef62('0x33')],'resourceId':_0xf3a26b['id'],'type':_0x1cb7cb['name'],'sectionId':_0x1cb7cb['id']},{})[_0xef62('0x25')](function(){return _0x193d07;});}else{return _0x193d07;}})['catch'](function(_0x17ed3e){logger[_0xef62('0x31')](_0xef62('0x57'),_0x17ed3e);throw _0x17ed3e;});}return _0x193d07;});}})[_0xef62('0x25')](respondWithResult(_0x4df3f6,0xc9))['catch'](handleError(_0x4df3f6,null));};exports[_0xef62('0x24')]=function(_0xea323,_0x4a0dff){if(_0xea323[_0xef62('0x50')]['id']){delete _0xea323[_0xef62('0x50')]['id'];}return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0xea323[_0xef62('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a0dff,null))['then'](saveUpdates(_0xea323[_0xef62('0x50')],null))[_0xef62('0x25')](respondWithResult(_0x4a0dff,null))[_0xef62('0x4e')](handleError(_0x4a0dff,null));};exports[_0xef62('0x26')]=function(_0x152361,_0x53bbbf){return db['VoiceQueue']['find']({'where':{'id':_0x152361[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x53bbbf,null))[_0xef62('0x25')](removeEntity(_0x53bbbf,null))['catch'](handleError(_0x53bbbf,null));};exports[_0xef62('0x5d')]=function(_0x13712c,_0x5c4e8b,_0x30b398){var _0x29cd41={'raw':![],'where':{}};var _0x5385c5={};var _0x1f3bf1={'count':0x0,'rows':[]};return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x13712c['params']['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x5c4e8b,null))[_0xef62('0x25')](function(_0x5ea957){if(_0x5ea957){_0x5385c5[_0xef62('0x39')]=_[_0xef62('0x4c')](db[_0xef62('0x5f')]['rawAttributes']);_0x5385c5['query']=_['keys'](_0x13712c[_0xef62('0x3a')]);_0x5385c5['filters']=_[_0xef62('0x3c')](_0x5385c5[_0xef62('0x39')],_0x5385c5[_0xef62('0x3a')]);_0x29cd41[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x5385c5['model'],qs[_0xef62('0x3e')](_0x13712c[_0xef62('0x3a')][_0xef62('0x3e')]));_0x29cd41[_0xef62('0x3d')]=_0x29cd41['attributes']['length']?_0x29cd41[_0xef62('0x3d')]:_0x5385c5[_0xef62('0x39')];if(!_0x13712c[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x29cd41[_0xef62('0x20')]=qs[_0xef62('0x20')](_0x13712c[_0xef62('0x3a')]['limit']);_0x29cd41['offset']=qs['offset'](_0x13712c[_0xef62('0x3a')][_0xef62('0x1f')]);}_0x29cd41[_0xef62('0x42')]=qs['sort'](_0x13712c[_0xef62('0x3a')][_0xef62('0x43')]);_0x29cd41[_0xef62('0x44')]=qs[_0xef62('0x3b')](_[_0xef62('0x60')](_0x13712c[_0xef62('0x3a')],_0x5385c5[_0xef62('0x3b')]));_0x29cd41[_0xef62('0x44')]['VoiceQueueId']=_0x5ea957['id'];if(_0x13712c['query'][_0xef62('0x61')]){_0x29cd41[_0xef62('0x44')]=_[_0xef62('0x46')](_0x29cd41['where'],{'$or':_[_0xef62('0x36')](_0x29cd41['attributes'],function(_0x3e05ab){var _0x5962b3={};_0x5962b3[_0x3e05ab]={'$like':'%'+_0x13712c[_0xef62('0x3a')]['filter']+'%'};return _0x5962b3;})});}_0x29cd41=_[_0xef62('0x46')]({},_0x29cd41,_0x13712c[_0xef62('0x47')]);return db['CmHopper'][_0xef62('0x1e')]({'where':_0x29cd41['where']})[_0xef62('0x25')](function(_0x5ebd43){_0x1f3bf1['count']=_0x5ebd43;if(_0x13712c[_0xef62('0x3a')]['includeAll']){_0x29cd41['include']=[{'all':!![]}];}return db[_0xef62('0x5f')][_0xef62('0x48')](_0x29cd41);})[_0xef62('0x25')](function(_0xcab651){_0x1f3bf1[_0xef62('0x49')]=_0xcab651;return _0x1f3bf1;});}})[_0xef62('0x25')](respondWithFilteredResult(_0x5c4e8b,_0x29cd41))[_0xef62('0x4e')](handleError(_0x5c4e8b,null));};exports[_0xef62('0x62')]=function(_0x563753,_0x3c5063,_0x4a0f24){var _0x2bff4f={'raw':!![],'where':{}};var _0x2f1998={};var _0x19481a={'count':0x0,'rows':[]};return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x563753[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x3c5063,null))[_0xef62('0x25')](function(_0x2e5c9c){if(_0x2e5c9c){_0x2f1998[_0xef62('0x39')]=_[_0xef62('0x4c')](db['CmHopperHistory'][_0xef62('0x38')]);_0x2f1998[_0xef62('0x3a')]=_[_0xef62('0x4c')](_0x563753['query']);_0x2f1998[_0xef62('0x3b')]=_['intersection'](_0x2f1998['model'],_0x2f1998[_0xef62('0x3a')]);_0x2bff4f[_0xef62('0x3d')]=_['intersection'](_0x2f1998[_0xef62('0x39')],qs['fields'](_0x563753[_0xef62('0x3a')][_0xef62('0x3e')]));_0x2bff4f[_0xef62('0x3d')]=_0x2bff4f['attributes']['length']?_0x2bff4f['attributes']:_0x2f1998[_0xef62('0x39')];if(!_0x563753[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x2bff4f['limit']=qs[_0xef62('0x20')](_0x563753[_0xef62('0x3a')][_0xef62('0x20')]);_0x2bff4f[_0xef62('0x1f')]=qs[_0xef62('0x1f')](_0x563753[_0xef62('0x3a')][_0xef62('0x1f')]);}_0x2bff4f[_0xef62('0x42')]=qs[_0xef62('0x43')](_0x563753[_0xef62('0x3a')]['sort']);_0x2bff4f[_0xef62('0x44')]=qs[_0xef62('0x3b')](_['pick'](_0x563753['query'],_0x2f1998['filters']));_0x2bff4f['where'][_0xef62('0x63')]=_0x2e5c9c['id'];if(_0x563753['query'][_0xef62('0x61')]){_0x2bff4f[_0xef62('0x44')]=_[_0xef62('0x46')](_0x2bff4f[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x2bff4f[_0xef62('0x3d')],function(_0x550365){var _0x9bb25={};_0x9bb25[_0x550365]={'$like':'%'+_0x563753[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x9bb25;})});}_0x2bff4f=_['merge']({},_0x2bff4f,_0x563753[_0xef62('0x47')]);return db['CmHopperHistory'][_0xef62('0x1e')]({'where':_0x2bff4f[_0xef62('0x44')]})[_0xef62('0x25')](function(_0x5ae0e6){_0x19481a['count']=_0x5ae0e6;if(_0x563753[_0xef62('0x3a')][_0xef62('0x58')]){_0x2bff4f['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xef62('0x48')](_0x2bff4f);})[_0xef62('0x25')](function(_0x4c306e){_0x19481a['rows']=_0x4c306e;return _0x19481a;});}})['then'](respondWithFilteredResult(_0x3c5063,_0x2bff4f))[_0xef62('0x4e')](handleError(_0x3c5063,null));};exports[_0xef62('0x64')]=function(_0x14ae6d,_0x2e2ae9,_0x15ba8c){var _0x5d3e12={'raw':!![],'where':{}};var _0x3e2d58={};var _0x5b603a={'count':0x0,'rows':[]};return db[_0xef62('0x37')]['findOne']({'where':{'id':_0x14ae6d[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x2e2ae9,null))[_0xef62('0x25')](function(_0x2ebc31){if(_0x2ebc31){_0x3e2d58[_0xef62('0x39')]=_[_0xef62('0x4c')](db[_0xef62('0x65')]['rawAttributes']);_0x3e2d58['query']=_['keys'](_0x14ae6d['query']);_0x3e2d58['filters']=_[_0xef62('0x3c')](_0x3e2d58[_0xef62('0x39')],_0x3e2d58['query']);_0x5d3e12['attributes']=_[_0xef62('0x3c')](_0x3e2d58[_0xef62('0x39')],qs[_0xef62('0x3e')](_0x14ae6d[_0xef62('0x3a')][_0xef62('0x3e')]));_0x5d3e12[_0xef62('0x3d')]=_0x5d3e12[_0xef62('0x3d')][_0xef62('0x3f')]?_0x5d3e12[_0xef62('0x3d')]:_0x3e2d58[_0xef62('0x39')];if(!_0x14ae6d[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x5d3e12[_0xef62('0x20')]=qs[_0xef62('0x20')](_0x14ae6d[_0xef62('0x3a')][_0xef62('0x20')]);_0x5d3e12[_0xef62('0x1f')]=qs['offset'](_0x14ae6d[_0xef62('0x3a')][_0xef62('0x1f')]);}_0x5d3e12[_0xef62('0x42')]=qs[_0xef62('0x43')](_0x14ae6d['query'][_0xef62('0x43')]);_0x5d3e12[_0xef62('0x44')]=qs[_0xef62('0x3b')](_[_0xef62('0x60')](_0x14ae6d[_0xef62('0x3a')],_0x3e2d58[_0xef62('0x3b')]));_0x5d3e12['where'][_0xef62('0x63')]=_0x2ebc31['id'];if(_0x14ae6d['query'][_0xef62('0x61')]){_0x5d3e12['where']=_[_0xef62('0x46')](_0x5d3e12[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x5d3e12[_0xef62('0x3d')],function(_0x1d0c5e){var _0x1bc1ad={};_0x1bc1ad[_0x1d0c5e]={'$like':'%'+_0x14ae6d['query'][_0xef62('0x61')]+'%'};return _0x1bc1ad;})});}_0x5d3e12=_[_0xef62('0x46')]({},_0x5d3e12,_0x14ae6d['options']);return db[_0xef62('0x65')]['count']({'where':_0x5d3e12[_0xef62('0x44')]})[_0xef62('0x25')](function(_0x564127){_0x5b603a[_0xef62('0x1e')]=_0x564127;if(_0x14ae6d['query'][_0xef62('0x58')]){_0x5d3e12[_0xef62('0x4d')]=[{'all':!![]}];}return db[_0xef62('0x65')][_0xef62('0x48')](_0x5d3e12);})[_0xef62('0x25')](function(_0x432173){_0x5b603a['rows']=_0x432173;return _0x5b603a;});}})['then'](respondWithFilteredResult(_0x2e2ae9,_0x5d3e12))[_0xef62('0x4e')](handleError(_0x2e2ae9,null));};exports[_0xef62('0x66')]=function(_0x1c5f2,_0x5b0571,_0xc824e8){var _0x2e0f5d={'raw':!![],'where':{}};var _0x2ace8e={};var _0x2a4ace={'count':0x0,'rows':[]};return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x1c5f2['params']['id']}})['then'](handleEntityNotFound(_0x5b0571,null))[_0xef62('0x25')](function(_0x305641){if(_0x305641){_0x2ace8e[_0xef62('0x39')]=_[_0xef62('0x4c')](db['CmHopperBlack']['rawAttributes']);_0x2ace8e[_0xef62('0x3a')]=_[_0xef62('0x4c')](_0x1c5f2[_0xef62('0x3a')]);_0x2ace8e[_0xef62('0x3b')]=_['intersection'](_0x2ace8e[_0xef62('0x39')],_0x2ace8e[_0xef62('0x3a')]);_0x2e0f5d[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x2ace8e['model'],qs[_0xef62('0x3e')](_0x1c5f2['query'][_0xef62('0x3e')]));_0x2e0f5d['attributes']=_0x2e0f5d[_0xef62('0x3d')][_0xef62('0x3f')]?_0x2e0f5d[_0xef62('0x3d')]:_0x2ace8e[_0xef62('0x39')];if(!_0x1c5f2[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x2e0f5d[_0xef62('0x20')]=qs[_0xef62('0x20')](_0x1c5f2[_0xef62('0x3a')][_0xef62('0x20')]);_0x2e0f5d[_0xef62('0x1f')]=qs['offset'](_0x1c5f2[_0xef62('0x3a')]['offset']);}_0x2e0f5d[_0xef62('0x42')]=qs['sort'](_0x1c5f2[_0xef62('0x3a')][_0xef62('0x43')]);_0x2e0f5d[_0xef62('0x44')]=qs[_0xef62('0x3b')](_['pick'](_0x1c5f2[_0xef62('0x3a')],_0x2ace8e[_0xef62('0x3b')]));_0x2e0f5d[_0xef62('0x44')][_0xef62('0x63')]=_0x305641['id'];if(_0x1c5f2[_0xef62('0x3a')][_0xef62('0x61')]){_0x2e0f5d[_0xef62('0x44')]=_[_0xef62('0x46')](_0x2e0f5d[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x2e0f5d[_0xef62('0x3d')],function(_0x533025){var _0x10e911={};_0x10e911[_0x533025]={'$like':'%'+_0x1c5f2['query'][_0xef62('0x61')]+'%'};return _0x10e911;})});}_0x2e0f5d=_[_0xef62('0x46')]({},_0x2e0f5d,_0x1c5f2[_0xef62('0x47')]);return db['CmHopperBlack'][_0xef62('0x1e')]({'where':_0x2e0f5d['where']})['then'](function(_0x3ebe77){_0x2a4ace[_0xef62('0x1e')]=_0x3ebe77;if(_0x1c5f2[_0xef62('0x3a')][_0xef62('0x58')]){_0x2e0f5d[_0xef62('0x4d')]=[{'all':!![]}];}return db[_0xef62('0x67')]['findAll'](_0x2e0f5d);})[_0xef62('0x25')](function(_0x56792c){_0x2a4ace[_0xef62('0x49')]=_0x56792c;return _0x2a4ace;});}})[_0xef62('0x25')](respondWithFilteredResult(_0x5b0571,_0x2e0f5d))['catch'](handleError(_0x5b0571,null));};exports[_0xef62('0x68')]=function(_0x2847d8,_0x2085ab,_0x11684b){var _0x433dfa={};var _0x23a8f0={};var _0x2d0163;var _0x39abcd;return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x2847d8[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x2085ab,null))['then'](function(_0x4815f2){if(_0x4815f2){_0x2d0163=_0x4815f2;_0x23a8f0['model']=_[_0xef62('0x4c')](db['Team'][_0xef62('0x38')]);_0x23a8f0['query']=_[_0xef62('0x4c')](_0x2847d8['query']);_0x23a8f0[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x23a8f0[_0xef62('0x39')],_0x23a8f0[_0xef62('0x3a')]);_0x433dfa[_0xef62('0x3d')]=_['intersection'](_0x23a8f0['model'],qs[_0xef62('0x3e')](_0x2847d8[_0xef62('0x3a')][_0xef62('0x3e')]));_0x433dfa[_0xef62('0x3d')]=_0x433dfa[_0xef62('0x3d')][_0xef62('0x3f')]?_0x433dfa[_0xef62('0x3d')]:_0x23a8f0[_0xef62('0x39')];_0x433dfa[_0xef62('0x42')]=qs['sort'](_0x2847d8['query']['sort']);_0x433dfa['where']=qs[_0xef62('0x3b')](_[_0xef62('0x60')](_0x2847d8[_0xef62('0x3a')],_0x23a8f0[_0xef62('0x3b')]));if(_0x2847d8[_0xef62('0x3a')][_0xef62('0x61')]){_0x433dfa[_0xef62('0x44')]=_['merge'](_0x433dfa[_0xef62('0x44')],{'$or':_['map'](_0x433dfa[_0xef62('0x3d')],function(_0x20a6e1){var _0x639255={};_0x639255[_0x20a6e1]={'$like':'%'+_0x2847d8[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x639255;})});}_0x433dfa=_['merge']({},_0x433dfa,_0x2847d8[_0xef62('0x47')]);return _0x2d0163[_0xef62('0x68')](_0x433dfa);}})[_0xef62('0x25')](function(_0x349b44){if(_0x349b44){_0x39abcd=_0x349b44['length'];if(!_0x2847d8[_0xef62('0x3a')]['hasOwnProperty'](_0xef62('0x41'))){_0x433dfa[_0xef62('0x20')]=qs['limit'](_0x2847d8[_0xef62('0x3a')][_0xef62('0x20')]);_0x433dfa['offset']=qs[_0xef62('0x1f')](_0x2847d8[_0xef62('0x3a')][_0xef62('0x1f')]);}return _0x2d0163[_0xef62('0x68')](_0x433dfa);}})[_0xef62('0x25')](function(_0x1367bf){if(_0x1367bf){return _0x1367bf?{'count':_0x39abcd,'rows':_0x1367bf}:null;}})['then'](respondWithResult(_0x2085ab,null))[_0xef62('0x4e')](handleError(_0x2085ab,null));};exports[_0xef62('0x69')]=function(_0x12d93c,_0x472f23,_0x50432c){var _0x743b37=_0x12d93c[_0xef62('0x50')]['teams'];var _0x5f53f3=_[_0xef62('0x36')](_0x743b37,'id');return db[_0xef62('0x6a')][_0xef62('0x48')]({'where':{'id':_0x5f53f3},'attributes':['id'],'include':[{'model':db[_0xef62('0x6b')],'as':_0xef62('0x6c'),'attributes':['id',_0xef62('0x33'),_0xef62('0x6d'),_0xef62('0x6e'),_0xef62('0x6f')],'raw':!![]}]})[_0xef62('0x25')](function(_0x59237e){if(_0x59237e){var _0x12b509=_['flatMap'](_0x59237e,function(_0x141170){var _0x4cc571=_0x141170[_0xef62('0x27')]({'plain':!![]});_0x4cc571[_0xef62('0x6c')][_0xef62('0x70')](function(_0x161d20){_0x161d20['penalty']=_['find'](_0x743b37,{'id':_0x4cc571['id']})['penalty'];});return _0x4cc571[_0xef62('0x6c')];});return db['VoiceQueue']['find']({'where':{'id':_0x12d93c[_0xef62('0x4b')]['id']}})['then'](function(_0x34feb7){return db['sequelize']['transaction'](function(_0x4546fb){return _0x34feb7[_0xef62('0x69')](_0x5f53f3,{'transaction':_0x4546fb})[_0xef62('0x25')](function(){return BPromise[_0xef62('0x71')](_0x12b509,function(_0x57f565){return db[_0xef62('0x72')][_0xef62('0x73')]({'where':{'UserId':_0x57f565['id'],'VoiceQueueId':_0x12d93c[_0xef62('0x4b')]['id']},'defaults':{'penalty':_0x57f565[_0xef62('0x74')]},'transaction':_0x4546fb});});})['then'](function(){return BPromise['each'](_['filter'](_0x12b509,{'online':!![]}),function(_0x232bb5){return db[_0xef62('0x75')][_0xef62('0x76')]({'membername':_0x232bb5['name'],'UserId':_0x232bb5['id'],'queue_name':_0x34feb7['name'],'VoiceQueueId':_0x34feb7['id'],'interface':_['isNil'](_0x232bb5[_0xef62('0x6f')])?util['format'](_0xef62('0x77'),_0x232bb5[_0xef62('0x33')]):_0x232bb5['interface'],'paused':_0x232bb5[_0xef62('0x6e')]||![],'penalty':_0x232bb5['penalty']},{'transaction':_0x4546fb});});})[_0xef62('0x25')](function(){_0x12b509[_0xef62('0x70')](function(_0x281d41){socket['emit'](_0xef62('0x78'),{'UserId':_0x281d41['id'],'VoiceQueueId':_0x34feb7['id']});});});});});}})[_0xef62('0x25')](respondWithStatusCode(_0x472f23,null))[_0xef62('0x4e')](handleError(_0x472f23,null));};exports[_0xef62('0x79')]=function(_0x53a5c4,_0x298c75,_0x383eb2){return db[_0xef62('0x6a')][_0xef62('0x48')]({'where':{'id':_0x53a5c4['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xef62('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xef62('0x25')](handleEntityNotFound(_0x298c75,null))[_0xef62('0x25')](function(_0x1cb4f4){var _0x28e3ac=_[_0xef62('0x36')](_0x1cb4f4,'id');var _0x4ce345=[];var _0x1ef8ee=[];var _0x5b5877=squel[_0xef62('0x7a')]();_0x5b5877[_0xef62('0x7b')](_0xef62('0x7c'))[_0xef62('0x7d')](_0xef62('0x7e'),'tq')[_0xef62('0x7f')](_0xef62('0x80'),'ut',_0xef62('0x81'))[_0xef62('0x44')]('VoiceQueueId\x20=\x20?',_0x53a5c4[_0xef62('0x4b')]['id']);for(var _0x548694=0x0;_0x548694<_0x1cb4f4['length'];_0x548694+=0x1){let _0x2c9d39=_0x1cb4f4[_0x548694];for(var _0x2adff7=0x0;_0x2adff7<_0x2c9d39[_0xef62('0x6c')]['length'];_0x2adff7+=0x1){let _0x3605bb=_0x2c9d39['Agents'][_0x2adff7];var _0x3cd525=_0x5b5877[_0xef62('0x82')]();_0x3cd525['where']('ut.UserId\x20=\x20?',_0x3605bb['id']);_0x1ef8ee['push'](db['sequelize']['query'](_0x3cd525[_0xef62('0x83')](),{'type':db[_0xef62('0x84')]['QueryTypes']['SELECT']})[_0xef62('0x25')](function(_0xee14eb){if(_0xee14eb[_0xef62('0x3f')]===0x1){return _0x3605bb['id'];}else{var _0x5c20a3=_[_0xef62('0x85')](_[_0xef62('0x36')](_0xee14eb,_0xef62('0x86')),function(_0x44cc6a){return _[_0xef62('0x2d')](_0x28e3ac,_0x44cc6a);});if(_0x5c20a3){return _0x3605bb['id'];}}}));}}return BPromise[_0xef62('0x87')](_0x1ef8ee)['then'](function(_0x4d60b8){_0x4ce345=_(_0x4ce345)['union'](_0x4d60b8)['compact']()[_0xef62('0x2c')]();return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0x53a5c4[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](function(_0x18203b){return db[_0xef62('0x84')][_0xef62('0x88')](function(_0x588099){return _0x18203b['removeTeams'](_0x53a5c4[_0xef62('0x3a')]['ids'],{'transaction':_0x588099})['then'](function(){if(!_[_0xef62('0x89')](_0x4ce345)){return _0x18203b[_0xef62('0x8a')](_0x4ce345,{'transaction':_0x588099})[_0xef62('0x25')](function(){return db[_0xef62('0x75')][_0xef62('0x26')]({'where':{'VoiceQueueId':_0x53a5c4[_0xef62('0x4b')]['id'],'UserId':_0x4ce345},'transaction':_0x588099});});}})[_0xef62('0x25')](function(){_0x4ce345[_0xef62('0x70')](function(_0xf48ca4){socket[_0xef62('0x8b')](_0xef62('0x8c'),{'UserId':_0xf48ca4,'VoiceQueueId':_0x18203b['id']});});});});});});})[_0xef62('0x25')](respondWithStatusCode(_0x298c75,null))['catch'](handleError(_0x298c75,null));};exports[_0xef62('0x8d')]=function(_0x2d2ccf,_0x45cc4c,_0x532c02){var _0x45f2d8,_0x467fb9;return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0x2d2ccf[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x45cc4c,null))['then'](function(_0x251258){if(_0x251258){_0x467fb9=_0x251258;return _0x251258[_0xef62('0x8d')](_0x2d2ccf['body'][_0xef62('0x8e')],_[_0xef62('0x59')](_0x2d2ccf[_0xef62('0x50')],[_0xef62('0x8e'),'id'])||{})[_0xef62('0x8f')](function(_0xdc29b9){for(var _0x5d2589=0x0;_0x5d2589<_0x2d2ccf[_0xef62('0x50')][_0xef62('0x8e')][_0xef62('0x3f')];_0x5d2589+=0x1){socket[_0xef62('0x8b')](_0xef62('0x78'),{'UserId':_0x2d2ccf[_0xef62('0x50')][_0xef62('0x8e')][_0x5d2589],'VoiceQueueId':_0x2d2ccf[_0xef62('0x4b')]['id']});}return _0xdc29b9;});}})[_0xef62('0x25')](function(_0x5ee1c4){_0x45f2d8=_0x5ee1c4||[];if(_0x467fb9){return db[_0xef62('0x6b')][_0xef62('0x48')]({'where':{'id':_0x2d2ccf[_0xef62('0x50')][_0xef62('0x8e')]},'attributes':['id',_0xef62('0x33'),_0xef62('0x6d'),_0xef62('0x6e'),_0xef62('0x6f')],'raw':!![]});}})[_0xef62('0x25')](function(_0x219915){if(!_[_0xef62('0x89')](_0x219915)){var _0x4e31f9=[];for(var _0xdca8e0=0x0;_0xdca8e0<_0x219915[_0xef62('0x3f')];_0xdca8e0++){if(_0x219915[_0xdca8e0][_0xef62('0x6d')]){_0x4e31f9[_0xef62('0x90')](db[_0xef62('0x75')]['upsert']({'membername':_0x219915[_0xdca8e0][_0xef62('0x33')],'UserId':_0x219915[_0xdca8e0]['id'],'queue_name':_0x467fb9[_0xef62('0x33')],'VoiceQueueId':_0x467fb9['id'],'interface':_[_0xef62('0x91')](_0x219915[_0xdca8e0][_0xef62('0x6f')])?util[_0xef62('0x92')](_0xef62('0x77'),_0x219915[_0xdca8e0]['name']):_0x219915[_0xdca8e0][_0xef62('0x6f')],'paused':_0x219915[_0xdca8e0][_0xef62('0x6e')]||![],'penalty':_0x2d2ccf[_0xef62('0x50')]['penalty']||0x0}));}}return BPromise[_0xef62('0x87')](_0x4e31f9);}})['then'](function(){return _0x45f2d8;})[_0xef62('0x25')](respondWithResult(_0x45cc4c,null))['catch'](handleError(_0x45cc4c,null));};exports[_0xef62('0x8a')]=function(_0x7604f,_0x49f1a7,_0x326ffa){return db[_0xef62('0x37')]['find']({'where':{'id':_0x7604f[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x49f1a7,null))[_0xef62('0x25')](function(_0x2e0ba8){if(_0x2e0ba8){return _0x2e0ba8[_0xef62('0x8a')](_0x7604f[_0xef62('0x3a')][_0xef62('0x8e')])[_0xef62('0x25')](function(){if(_[_0xef62('0x93')](_0x7604f['query'][_0xef62('0x8e')])){for(var _0x5bbe6c=0x0;_0x5bbe6c<_0x7604f[_0xef62('0x3a')][_0xef62('0x8e')][_0xef62('0x3f')];_0x5bbe6c+=0x1){socket[_0xef62('0x8b')](_0xef62('0x8c'),{'UserId':Number(_0x7604f['query'][_0xef62('0x8e')][_0x5bbe6c]),'VoiceQueueId':Number(_0x7604f[_0xef62('0x4b')]['id'])});}}else{socket['emit'](_0xef62('0x8c'),{'UserId':Number(_0x7604f[_0xef62('0x3a')][_0xef62('0x8e')]),'VoiceQueueId':Number(_0x7604f[_0xef62('0x4b')]['id'])});}});}})['then'](function(_0x25a7df){return db[_0xef62('0x75')][_0xef62('0x26')]({'where':{'VoiceQueueId':_0x7604f[_0xef62('0x4b')]['id'],'UserId':_0x7604f['query'][_0xef62('0x8e')]}})[_0xef62('0x25')](function(){return _0x25a7df;});})[_0xef62('0x25')](respondWithStatusCode(_0x49f1a7,null))[_0xef62('0x4e')](handleError(_0x49f1a7,null));};exports['getAgents']=function(_0x4ab32f,_0x513a85,_0xe0370e){var _0x4284e1={};var _0x5d1b55={};var _0x40dfcf;var _0x56f874;return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x4ab32f[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x513a85,null))[_0xef62('0x25')](function(_0x126b9c){if(_0x126b9c){_0x40dfcf=_0x126b9c;_0x5d1b55[_0xef62('0x39')]=_[_0xef62('0x4c')](db[_0xef62('0x6b')][_0xef62('0x38')]);_0x5d1b55['query']=_[_0xef62('0x4c')](_0x4ab32f[_0xef62('0x3a')]);_0x5d1b55[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x5d1b55['model'],_0x5d1b55[_0xef62('0x3a')]);_0x4284e1[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x5d1b55[_0xef62('0x39')],qs[_0xef62('0x3e')](_0x4ab32f['query'][_0xef62('0x3e')]));_0x4284e1[_0xef62('0x3d')]=_0x4284e1[_0xef62('0x3d')][_0xef62('0x3f')]?_0x4284e1[_0xef62('0x3d')]:_0x5d1b55['model'];_0x4284e1['order']=qs[_0xef62('0x43')](_0x4ab32f[_0xef62('0x3a')][_0xef62('0x43')]);_0x4284e1[_0xef62('0x44')]=qs[_0xef62('0x3b')](_[_0xef62('0x60')](_0x4ab32f['query'],_0x5d1b55[_0xef62('0x3b')]));if(_0x4ab32f['query'][_0xef62('0x61')]){_0x4284e1['where']=_[_0xef62('0x46')](_0x4284e1[_0xef62('0x44')],{'$or':_['map'](_0x4284e1['attributes'],function(_0xfaa1a9){var _0x40f9d2={};_0x40f9d2[_0xfaa1a9]={'$like':'%'+_0x4ab32f[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x40f9d2;})});}_0x4284e1=_['merge']({},_0x4284e1,_0x4ab32f[_0xef62('0x47')]);return _0x40dfcf[_0xef62('0x94')](_0x4284e1);}})[_0xef62('0x25')](function(_0x5d29d5){if(_0x5d29d5){_0x56f874=_0x5d29d5['length'];if(!_0x4ab32f['query'][_0xef62('0x40')](_0xef62('0x41'))){_0x4284e1[_0xef62('0x20')]=qs['limit'](_0x4ab32f[_0xef62('0x3a')][_0xef62('0x20')]);_0x4284e1['offset']=qs[_0xef62('0x1f')](_0x4ab32f['query'][_0xef62('0x1f')]);}return _0x40dfcf[_0xef62('0x94')](_0x4284e1);}})[_0xef62('0x25')](function(_0xc5e8bc){if(_0xc5e8bc){return _0xc5e8bc?{'count':_0x56f874,'rows':_0xc5e8bc}:null;}})[_0xef62('0x25')](respondWithResult(_0x513a85,null))[_0xef62('0x4e')](handleError(_0x513a85,null));};exports[_0xef62('0x95')]=function(_0x4bc5b7,_0x295739,_0x168606){var _0x156d17={};var _0x100310={};var _0x10c037;var _0x2ff310;return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x4bc5b7[_0xef62('0x4b')]['id']}})['then'](handleEntityNotFound(_0x295739,null))['then'](function(_0x3895fa){if(_0x3895fa){_0x10c037=_0x3895fa;_0x100310['model']=_[_0xef62('0x4c')](db[_0xef62('0x75')]['rawAttributes']);_0x100310['query']=_['keys'](_0x4bc5b7[_0xef62('0x3a')]);_0x100310[_0xef62('0x3b')]=_[_0xef62('0x3c')](_0x100310['model'],_0x100310['query']);_0x156d17['attributes']=_['intersection'](_0x100310['model'],qs[_0xef62('0x3e')](_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x3e')]));_0x156d17[_0xef62('0x3d')]=_0x156d17[_0xef62('0x3d')][_0xef62('0x3f')]?_0x156d17['attributes']:_0x100310[_0xef62('0x39')];_0x156d17[_0xef62('0x42')]=qs[_0xef62('0x43')](_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x43')]);_0x156d17['where']=qs['filters'](_[_0xef62('0x60')](_0x4bc5b7[_0xef62('0x3a')],_0x100310[_0xef62('0x3b')]));if(_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x61')]){_0x156d17[_0xef62('0x44')]=_[_0xef62('0x46')](_0x156d17[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x156d17[_0xef62('0x3d')],function(_0x327322){var _0x452c1c={};_0x452c1c[_0x327322]={'$like':'%'+_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x452c1c;})});}_0x156d17=_[_0xef62('0x46')]({},_0x156d17,_0x4bc5b7[_0xef62('0x47')]);return _0x10c037['getMembers'](_0x156d17);}})[_0xef62('0x25')](function(_0x4f1210){if(_0x4f1210){_0x2ff310=_0x4f1210['length'];if(!_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x40')]('nolimit')){_0x156d17[_0xef62('0x20')]=qs['limit'](_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x20')]);_0x156d17[_0xef62('0x1f')]=qs[_0xef62('0x1f')](_0x4bc5b7[_0xef62('0x3a')][_0xef62('0x1f')]);}return _0x10c037['getMembers'](_0x156d17);}})[_0xef62('0x25')](function(_0x53813e){return _0x53813e?{'count':_0x2ff310,'rows':_0x53813e}:null;})[_0xef62('0x25')](respondWithResult(_0x295739,null))['catch'](handleError(_0x295739,null));};exports[_0xef62('0x96')]=function(_0x763833,_0xffbe0e,_0xcee3f4){var _0x4a9b03={};var _0x494a45={};var _0x48058e;var _0x4e0f00;return db[_0xef62('0x37')][_0xef62('0x5e')]({'where':{'id':_0x763833[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0xffbe0e,null))[_0xef62('0x25')](function(_0x75a3c4){if(_0x75a3c4){_0x48058e=_0x75a3c4;_0x494a45[_0xef62('0x39')]=_['keys'](db['CmList'][_0xef62('0x38')]);_0x494a45[_0xef62('0x3a')]=_[_0xef62('0x4c')](_0x763833['query']);_0x494a45[_0xef62('0x3b')]=_['intersection'](_0x494a45[_0xef62('0x39')],_0x494a45[_0xef62('0x3a')]);_0x4a9b03[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x494a45[_0xef62('0x39')],qs['fields'](_0x763833['query'][_0xef62('0x3e')]));_0x4a9b03[_0xef62('0x3d')]=_0x4a9b03[_0xef62('0x3d')][_0xef62('0x3f')]?_0x4a9b03[_0xef62('0x3d')]:_0x494a45[_0xef62('0x39')];_0x4a9b03['order']=qs[_0xef62('0x43')](_0x763833['query'][_0xef62('0x43')]);_0x4a9b03[_0xef62('0x44')]=qs['filters'](_['pick'](_0x763833['query'],_0x494a45[_0xef62('0x3b')]));if(_0x763833[_0xef62('0x3a')]['filter']){_0x4a9b03[_0xef62('0x44')]=_[_0xef62('0x46')](_0x4a9b03[_0xef62('0x44')],{'$or':_[_0xef62('0x36')](_0x4a9b03[_0xef62('0x3d')],function(_0x8ac54c){var _0x1e45cd={};_0x1e45cd[_0x8ac54c]={'$like':'%'+_0x763833['query'][_0xef62('0x61')]+'%'};return _0x1e45cd;})});}_0x4a9b03=_[_0xef62('0x46')]({},_0x4a9b03,_0x763833[_0xef62('0x47')]);return _0x48058e[_0xef62('0x96')](_0x4a9b03);}})['then'](function(_0x24670b){if(_0x24670b){_0x4e0f00=_0x24670b['length'];if(!_0x763833[_0xef62('0x3a')][_0xef62('0x40')](_0xef62('0x41'))){_0x4a9b03['limit']=qs['limit'](_0x763833[_0xef62('0x3a')][_0xef62('0x20')]);_0x4a9b03[_0xef62('0x1f')]=qs[_0xef62('0x1f')](_0x763833[_0xef62('0x3a')][_0xef62('0x1f')]);}return _0x48058e[_0xef62('0x96')](_0x4a9b03);}})[_0xef62('0x25')](function(_0x4d9103){if(_0x4d9103){return _0x4d9103?{'count':_0x4e0f00,'rows':_0x4d9103}:null;}})[_0xef62('0x25')](respondWithResult(_0xffbe0e,null))[_0xef62('0x4e')](handleError(_0xffbe0e,null));};exports[_0xef62('0x97')]=function(_0x58f43a,_0x45d5bb,_0x5e6d78){var _0x265bc1,_0x6cfb14;return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0x58f43a['params']['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x45d5bb,null))[_0xef62('0x25')](function(_0x1275a9){if(_0x1275a9){_0x6cfb14=_0x1275a9;return _0x1275a9[_0xef62('0x97')](_0x58f43a[_0xef62('0x50')][_0xef62('0x8e')],_[_0xef62('0x59')](_0x58f43a[_0xef62('0x50')],[_0xef62('0x8e'),'id'])||{});}return null;})[_0xef62('0x8f')](function(_0x251f48){var _0x1ed140;_0x265bc1=_0x251f48||[];var _0x5ba628=[];if(_0x251f48){for(var _0x4f0bc1=0x0;_0x4f0bc1<_0x251f48['length'];_0x4f0bc1+=0x1){var _0x1ce4e7=_0x251f48[_0x4f0bc1]['get']({'plain':!![]});_0x6cfb14[_0xef62('0x98')]=_0x58f43a[_0xef62('0x50')][_0xef62('0x98')]?_0x58f43a['body'][_0xef62('0x98')]:_0x6cfb14[_0xef62('0x98')];switch(_0x6cfb14[_0xef62('0x98')]){case _0xef62('0x99'):_0x1ed140=squel[_0xef62('0x9a')]()[_0xef62('0x9b')](_0xef62('0x9c'))['fromQuery']([_0xef62('0x9d'),_0xef62('0x9e'),_0xef62('0x9f'),_0xef62('0xa0'),_0xef62('0x63'),_0xef62('0x5a'),_0xef62('0x5b')],squel[_0xef62('0x7a')]()[_0xef62('0x7b')](_0xef62('0x9d'),_0xef62('0x9d'))['field'](_0xef62('0xa1'),'scheduledAt')['field']('id',_0xef62('0x9f'))[_0xef62('0x7b')](_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')](),_0xef62('0xa0'))[_0xef62('0x7b')](_0x58f43a[_0xef62('0x4b')]['id'][_0xef62('0x83')](),_0xef62('0x63'))['field']('NOW()',_0xef62('0x5a'))[_0xef62('0x7b')](_0xef62('0xa1'),_0xef62('0x5b'))['from'](_0xef62('0xa3'))[_0xef62('0x44')](_0xef62('0xa4'))[_0xef62('0x44')]('ListId\x20=\x20?',_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')]())[_0xef62('0x44')](_0xef62('0xa5'))['where'](_0xef62('0xa6'),squel[_0xef62('0x7a')]()[_0xef62('0x7b')]('COALESCE(calleridnum,\x27\x27)')[_0xef62('0x7d')](_0xef62('0xa7'))['where']('VoiceQueueId\x20=\x20?',_0x58f43a['params']['id']['toString']()))[_0xef62('0x44')](_0xef62('0xa6'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xef62('0x7d')](_0xef62('0x9c'))[_0xef62('0x44')](_0xef62('0xa8'),_0x58f43a['params']['id'][_0xef62('0x83')]())))['toString']();break;case'onlyIfOpen':_0x1ed140=squel['insert']()[_0xef62('0x9b')](_0xef62('0x9c'))['fromQuery'](['phone',_0xef62('0x9e'),'ContactId',_0xef62('0xa0'),'VoiceQueueId',_0xef62('0x5a'),_0xef62('0x5b')],squel[_0xef62('0x7a')]()[_0xef62('0x7b')]('phone','phone')[_0xef62('0x7b')]('NOW()','scheduledAt')[_0xef62('0x7b')]('id','ContactId')[_0xef62('0x7b')](_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')](),_0xef62('0xa0'))['field'](_0x58f43a[_0xef62('0x4b')]['id'][_0xef62('0x83')](),_0xef62('0x63'))[_0xef62('0x7b')]('NOW()',_0xef62('0x5a'))[_0xef62('0x7b')](_0xef62('0xa1'),_0xef62('0x5b'))[_0xef62('0x7d')](_0xef62('0xa3'))[_0xef62('0x44')](_0xef62('0xa4'))[_0xef62('0x44')](_0xef62('0xa9'),_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')]())[_0xef62('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xef62('0x44')](_0xef62('0xa6'),squel[_0xef62('0x7a')]()[_0xef62('0x7b')](_0xef62('0xaa'))['from'](_0xef62('0x9c'))[_0xef62('0x44')](_0xef62('0xa8'),_0x58f43a[_0xef62('0x4b')]['id'][_0xef62('0x83')]())))['toString']();break;default:_0x1ed140=squel[_0xef62('0x9a')]()['into'](_0xef62('0x9c'))[_0xef62('0xab')]([_0xef62('0x9d'),'scheduledAt','ContactId','ListId',_0xef62('0x63'),_0xef62('0x5a'),_0xef62('0x5b')],squel['select']()[_0xef62('0x7b')](_0xef62('0x9d'),_0xef62('0x9d'))[_0xef62('0x7b')]('NOW()',_0xef62('0x9e'))[_0xef62('0x7b')]('id',_0xef62('0x9f'))[_0xef62('0x7b')](_0x1ce4e7[_0xef62('0xa2')]['toString'](),_0xef62('0xa0'))[_0xef62('0x7b')](_0x58f43a[_0xef62('0x4b')]['id'][_0xef62('0x83')](),_0xef62('0x63'))[_0xef62('0x7b')]('NOW()',_0xef62('0x5a'))[_0xef62('0x7b')]('NOW()','updatedAt')[_0xef62('0x7d')](_0xef62('0xa3'))[_0xef62('0x44')](_0xef62('0xa4'))[_0xef62('0x44')]('ListId\x20=\x20?',_0x1ce4e7[_0xef62('0xa2')][_0xef62('0x83')]())[_0xef62('0x44')](_0xef62('0xa5')))[_0xef62('0x83')]();}_0x5ba628[_0xef62('0x90')](db[_0xef62('0x84')][_0xef62('0x3a')](_0x1ed140));}return BPromise[_0xef62('0x87')](_0x5ba628);}})[_0xef62('0x25')](function(){return _0x265bc1;})['then'](respondWithResult(_0x45d5bb,null))[_0xef62('0x4e')](handleError(_0x45d5bb,null));};exports[_0xef62('0xac')]=function(_0x4aaf8b,_0x256b3f,_0x4b7203){return db[_0xef62('0x37')]['find']({'where':{'id':_0x4aaf8b[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x256b3f,null))[_0xef62('0x25')](function(_0x152efe){if(_0x152efe){return _0x152efe[_0xef62('0xac')](_0x4aaf8b['query']['ids']);}})[_0xef62('0x25')](function(_0x52cba4){if(_0x52cba4){return db[_0xef62('0x5f')][_0xef62('0x26')]({'where':{'ListId':_0x4aaf8b[_0xef62('0x3a')][_0xef62('0x8e')],'VoiceQueueId':_0x4aaf8b[_0xef62('0x4b')]['id']}})['then'](function(){return _0x52cba4;});}})[_0xef62('0x25')](respondWithStatusCode(_0x256b3f,null))[_0xef62('0x4e')](handleError(_0x256b3f,null));};exports[_0xef62('0xad')]=function(_0xcc07ef,_0x497942,_0x41cf4f){var _0x3b3922={};var _0x2a215e={};var _0x17d487;var _0x1d86d3;return db['VoiceQueue'][_0xef62('0x5e')]({'where':{'id':_0xcc07ef[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x497942,null))[_0xef62('0x25')](function(_0x1b7114){if(_0x1b7114){_0x17d487=_0x1b7114;_0x2a215e['model']=_['keys'](db[_0xef62('0xae')][_0xef62('0x38')]);_0x2a215e['query']=_['keys'](_0xcc07ef['query']);_0x2a215e['filters']=_[_0xef62('0x3c')](_0x2a215e[_0xef62('0x39')],_0x2a215e[_0xef62('0x3a')]);_0x3b3922[_0xef62('0x3d')]=_[_0xef62('0x3c')](_0x2a215e[_0xef62('0x39')],qs[_0xef62('0x3e')](_0xcc07ef[_0xef62('0x3a')]['fields']));_0x3b3922[_0xef62('0x3d')]=_0x3b3922[_0xef62('0x3d')][_0xef62('0x3f')]?_0x3b3922['attributes']:_0x2a215e[_0xef62('0x39')];_0x3b3922[_0xef62('0x42')]=qs[_0xef62('0x43')](_0xcc07ef[_0xef62('0x3a')][_0xef62('0x43')]);_0x3b3922[_0xef62('0x44')]=qs[_0xef62('0x3b')](_['pick'](_0xcc07ef[_0xef62('0x3a')],_0x2a215e[_0xef62('0x3b')]));if(_0xcc07ef['query']['filter']){_0x3b3922[_0xef62('0x44')]=_[_0xef62('0x46')](_0x3b3922['where'],{'$or':_[_0xef62('0x36')](_0x3b3922['attributes'],function(_0x439894){var _0x353e34={};_0x353e34[_0x439894]={'$like':'%'+_0xcc07ef[_0xef62('0x3a')][_0xef62('0x61')]+'%'};return _0x353e34;})});}_0x3b3922=_[_0xef62('0x46')]({},_0x3b3922,_0xcc07ef['options']);return _0x17d487['getBlackLists'](_0x3b3922);}})[_0xef62('0x25')](function(_0x2a1e5a){if(_0x2a1e5a){_0x1d86d3=_0x2a1e5a[_0xef62('0x3f')];if(!_0xcc07ef[_0xef62('0x3a')][_0xef62('0x40')]('nolimit')){_0x3b3922[_0xef62('0x20')]=qs['limit'](_0xcc07ef['query'][_0xef62('0x20')]);_0x3b3922['offset']=qs['offset'](_0xcc07ef[_0xef62('0x3a')][_0xef62('0x1f')]);}return _0x17d487[_0xef62('0xad')](_0x3b3922);}})[_0xef62('0x25')](function(_0x1877a6){if(_0x1877a6){return _0x1877a6?{'count':_0x1d86d3,'rows':_0x1877a6}:null;}})[_0xef62('0x25')](respondWithResult(_0x497942,null))[_0xef62('0x4e')](handleError(_0x497942,null));};exports[_0xef62('0xaf')]=function(_0x26c1e4,_0x3ae933,_0x57bd1e){var _0x57c2c9,_0x4f28fe;return db[_0xef62('0x37')][_0xef62('0x2f')]({'where':{'id':_0x26c1e4[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](handleEntityNotFound(_0x3ae933,null))[_0xef62('0x25')](function(_0x524fa1){if(_0x524fa1){_0x4f28fe=_0x524fa1;return _0x524fa1[_0xef62('0xaf')](_0x26c1e4[_0xef62('0x50')]['ids'],_['omit'](_0x26c1e4[_0xef62('0x50')],[_0xef62('0x8e'),'id'])||{});}return null;})[_0xef62('0x8f')](function(_0x293f9a){var _0x2be90f;_0x57c2c9=_0x293f9a||[];var _0xea9cb6=[];if(_0x293f9a){for(var _0x431fe5=0x0;_0x431fe5<_0x293f9a['length'];_0x431fe5+=0x1){var _0x1329aa=_0x293f9a[_0x431fe5][_0xef62('0x27')]({'plain':!![]});_0x2be90f=squel[_0xef62('0x9a')]()[_0xef62('0x9b')](_0xef62('0xb0'))[_0xef62('0xab')]([_0xef62('0x9d'),_0xef62('0x9f'),_0xef62('0xa0'),'VoiceQueueId','createdAt',_0xef62('0x5b')],squel[_0xef62('0x7a')]()[_0xef62('0x7b')](_0xef62('0x9d'),_0xef62('0x9d'))['field']('id',_0xef62('0x9f'))[_0xef62('0x7b')](_0x1329aa[_0xef62('0xa2')][_0xef62('0x83')](),_0xef62('0xa0'))[_0xef62('0x7b')](_0x26c1e4[_0xef62('0x4b')]['id'][_0xef62('0x83')](),_0xef62('0x63'))[_0xef62('0x7b')](_0xef62('0xa1'),'createdAt')[_0xef62('0x7b')]('NOW()','updatedAt')[_0xef62('0x7d')](_0xef62('0xa3'))[_0xef62('0x44')](_0xef62('0xa4'))[_0xef62('0x44')](_0xef62('0xa9'),_0x1329aa['CmListId'][_0xef62('0x83')]())[_0xef62('0x44')](_0xef62('0xa5')))['toString']();_0xea9cb6['push'](db[_0xef62('0x84')][_0xef62('0x3a')](_0x2be90f));}return BPromise[_0xef62('0x87')](_0xea9cb6);}})[_0xef62('0x25')](function(){return _0x57c2c9;})['then'](respondWithResult(_0x3ae933,null))[_0xef62('0x4e')](handleError(_0x3ae933,null));};exports['removeBlackLists']=function(_0xe5aee8,_0x57676e,_0x54407f){return db['VoiceQueue']['find']({'where':{'id':_0xe5aee8[_0xef62('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57676e,null))[_0xef62('0x25')](function(_0x4d793b){if(_0x4d793b){return _0x4d793b[_0xef62('0xb1')](_0xe5aee8['query'][_0xef62('0x8e')]);}})[_0xef62('0x25')](function(_0x22bced){if(_0x22bced){return db[_0xef62('0x67')][_0xef62('0x26')]({'where':{'ListId':_0xe5aee8[_0xef62('0x3a')][_0xef62('0x8e')],'VoiceQueueId':_0xe5aee8[_0xef62('0x4b')]['id']}})[_0xef62('0x25')](function(){return _0x22bced;});}})['then'](respondWithStatusCode(_0x57676e,null))[_0xef62('0x4e')](handleError(_0x57676e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index b0eedc1..f15c118 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 _0x8448=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit'];(function(_0x3de728,_0x418639){var _0x1299b7=function(_0x31409e){while(--_0x31409e){_0x3de728['push'](_0x3de728['shift']());}};_0x1299b7(++_0x418639);}(_0x8448,0x126));var _0x8844=function(_0x3457b4,_0x4cd8f9){_0x3457b4=_0x3457b4-0x0;var _0xaa8fa9=_0x8448[_0x3457b4];return _0xaa8fa9;};'use strict';var EventEmitter=require(_0x8844('0x0'));var VoiceQueue=require(_0x8844('0x1'))['db'][_0x8844('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8844('0x3')](0x0);var events={'afterCreate':_0x8844('0x4'),'afterUpdate':'update','afterDestroy':_0x8844('0x5')};function emitEvent(_0x275c7a){return function(_0x365efd,_0xfe7214,_0x191e04){VoiceQueueEvents[_0x8844('0x6')](_0x275c7a+':'+_0x365efd['id'],_0x365efd);VoiceQueueEvents[_0x8844('0x6')](_0x275c7a,_0x365efd);_0x191e04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x8430=['VoiceQueue','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2024af,_0x188afc){var _0x593b94=function(_0x44a030){while(--_0x44a030){_0x2024af['push'](_0x2024af['shift']());}};_0x593b94(++_0x188afc);}(_0x8430,0xce));var _0x0843=function(_0xf23ae0,_0x13041f){_0xf23ae0=_0xf23ae0-0x0;var _0x441c81=_0x8430[_0xf23ae0];return _0x441c81;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x0843('0x0'))['db'][_0x0843('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0843('0x2'),'afterUpdate':_0x0843('0x3'),'afterDestroy':_0x0843('0x4')};function emitEvent(_0x2b63db){return function(_0x574bc0,_0x62f07c,_0x200f01){VoiceQueueEvents['emit'](_0x2b63db+':'+_0x574bc0['id'],_0x574bc0);VoiceQueueEvents[_0x0843('0x5')](_0x2b63db,_0x574bc0);_0x200f01(null);};}for(var e in events){if(events[_0x0843('0x6')](e)){var event=events[e];VoiceQueue[_0x0843('0x7')](e,emitEvent(event));}}module[_0x0843('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 85f4f65..9f477eb 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 _0xcc06=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash'];(function(_0x17ede9,_0x27d731){var _0x35b71d=function(_0x30f681){while(--_0x30f681){_0x17ede9['push'](_0x17ede9['shift']());}};_0x35b71d(++_0x27d731);}(_0xcc06,0x117));var _0x6cc0=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xcc06[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x6cc0('0x0'));var util=require('util');var logger=require(_0x6cc0('0x1'))(_0x6cc0('0x2'));var moment=require(_0x6cc0('0x3'));var BPromise=require(_0x6cc0('0x4'));var rp=require(_0x6cc0('0x5'));var fs=require('fs');var path=require(_0x6cc0('0x6'));var rimraf=require(_0x6cc0('0x7'));var config=require(_0x6cc0('0x8'));var attributes=require(_0x6cc0('0x9'));module[_0x6cc0('0xa')]=function(_0x2558af,_0x225717){return _0x2558af[_0x6cc0('0xb')](_0x6cc0('0xc'),attributes,{'tableName':_0x6cc0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cfa=['define','VoiceQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x9cfa,0xce));var _0xa9cf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9cfa[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xa9cf('0x0'));var logger=require(_0xa9cf('0x1'))(_0xa9cf('0x2'));var moment=require(_0xa9cf('0x3'));var BPromise=require(_0xa9cf('0x4'));var rp=require(_0xa9cf('0x5'));var fs=require('fs');var path=require(_0xa9cf('0x6'));var rimraf=require(_0xa9cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xa9cf('0x8'));module[_0xa9cf('0x9')]=function(_0x3f52f9,_0x2c0c20){return _0x3f52f9[_0xa9cf('0xa')](_0xa9cf('0xb'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 52063d1..67f34bb 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 _0x7aa5=['where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','map','include','model','ShowVoiceQueue','find'];(function(_0x872dfa,_0x4ff880){var _0xc3de9c=function(_0x1f6deb){while(--_0x1f6deb){_0x872dfa['push'](_0x872dfa['shift']());}};_0xc3de9c(++_0x4ff880);}(_0x7aa5,0x10b));var _0x57aa=function(_0x222e2d,_0x4cff0c){_0x222e2d=_0x222e2d-0x0;var _0x3dbbac=_0x7aa5[_0x222e2d];return _0x3dbbac;};'use strict';var _=require(_0x57aa('0x0'));var util=require(_0x57aa('0x1'));var moment=require('moment');var BPromise=require(_0x57aa('0x2'));var rs=require(_0x57aa('0x3'));var fs=require('fs');var Redis=require(_0x57aa('0x4'));var db=require(_0x57aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x57aa('0x6'))(_0x57aa('0x7'));var config=require('../../config/environment');var jayson=require(_0x57aa('0x8'));var client=jayson[_0x57aa('0x9')]['http']({'port':0x232a});config[_0x57aa('0xa')]=_[_0x57aa('0xb')](config[_0x57aa('0xa')],{'host':_0x57aa('0xc'),'port':0x18eb});var socket=require(_0x57aa('0xd'))(new Redis(config[_0x57aa('0xa')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x256766,_0x10f859,_0x23c43e){return new BPromise(function(_0x77465,_0x4c969f){return client[_0x57aa('0xe')](_0x256766,_0x23c43e)[_0x57aa('0xf')](function(_0x5f1c16){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x10f859,_0x57aa('0x10'));logger[_0x57aa('0x11')](_0x57aa('0x12'),_0x10f859,'request\x20sent',JSON[_0x57aa('0x13')](_0x5f1c16));if(_0x5f1c16[_0x57aa('0x14')]){if(_0x5f1c16[_0x57aa('0x14')][_0x57aa('0x15')]===0x1f4){logger[_0x57aa('0x14')](_0x57aa('0x16'),_0x10f859,_0x5f1c16[_0x57aa('0x14')][_0x57aa('0x17')]);return _0x4c969f(_0x5f1c16[_0x57aa('0x14')]['message']);}logger[_0x57aa('0x14')](_0x57aa('0x16'),_0x10f859,_0x5f1c16['error'][_0x57aa('0x17')]);return _0x77465(_0x5f1c16[_0x57aa('0x14')][_0x57aa('0x17')]);}else{logger[_0x57aa('0x18')](_0x57aa('0x16'),_0x10f859,_0x57aa('0x10'));_0x77465(_0x5f1c16['result'][_0x57aa('0x17')]);}})['catch'](function(_0x299f5b){logger[_0x57aa('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x10f859,_0x299f5b);_0x4c969f(_0x299f5b);});});}exports[_0x57aa('0x19')]=function(_0x347649){var _0x1d1d42=this;return new Promise(function(_0x4781f3,_0xa86852){return db[_0x57aa('0x1a')][_0x57aa('0x1b')]({'raw':_0x347649[_0x57aa('0x1c')]?_0x347649['options'][_0x57aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x347649[_0x57aa('0x1c')]?_0x347649[_0x57aa('0x1c')]['where']||null:null,'attributes':_0x347649['options']?_0x347649[_0x57aa('0x1c')][_0x57aa('0x1e')]||null:null,'limit':_0x347649['options']?_0x347649[_0x57aa('0x1c')][_0x57aa('0x1f')]||null:null,'include':_0x347649[_0x57aa('0x1c')]?_0x347649[_0x57aa('0x1c')]['include']?_[_0x57aa('0x20')](_0x347649[_0x57aa('0x1c')][_0x57aa('0x21')],function(_0x4406e9){return{'model':db[_0x4406e9[_0x57aa('0x22')]],'as':_0x4406e9['as'],'attributes':_0x4406e9[_0x57aa('0x1e')],'include':_0x4406e9[_0x57aa('0x21')]?_[_0x57aa('0x20')](_0x4406e9[_0x57aa('0x21')],function(_0x4b00cd){return{'model':db[_0x4b00cd['model']],'as':_0x4b00cd['as'],'attributes':_0x4b00cd[_0x57aa('0x1e')],'include':_0x4b00cd['include']?_[_0x57aa('0x20')](_0x4b00cd[_0x57aa('0x21')],function(_0x220e7e){return{'model':db[_0x220e7e[_0x57aa('0x22')]],'as':_0x220e7e['as'],'attributes':_0x220e7e[_0x57aa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x57aa('0xf')](function(_0x262118){logger[_0x57aa('0x18')](_0x57aa('0x19'),_0x347649);logger[_0x57aa('0x11')](_0x57aa('0x19'),_0x347649,JSON[_0x57aa('0x13')](_0x262118));_0x4781f3(_0x262118);})['catch'](function(_0x87759d){logger['error'](_0x57aa('0x19'),_0x87759d[_0x57aa('0x17')],_0x347649);_0xa86852(_0x1d1d42[_0x57aa('0x14')](0x1f4,_0x87759d['message']));});});};exports[_0x57aa('0x23')]=function(_0x28a4fc){var _0x3bf9d1=this;return new Promise(function(_0x34fea6,_0x488893){return db[_0x57aa('0x1a')][_0x57aa('0x24')]({'raw':_0x28a4fc[_0x57aa('0x1c')]?_0x28a4fc[_0x57aa('0x1c')][_0x57aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x28a4fc[_0x57aa('0x1c')]?_0x28a4fc[_0x57aa('0x1c')][_0x57aa('0x25')]||null:null,'attributes':_0x28a4fc[_0x57aa('0x1c')]?_0x28a4fc[_0x57aa('0x1c')][_0x57aa('0x1e')]||null:null,'include':_0x28a4fc[_0x57aa('0x1c')]?_0x28a4fc[_0x57aa('0x1c')][_0x57aa('0x21')]?_[_0x57aa('0x20')](_0x28a4fc['options'][_0x57aa('0x21')],function(_0x40784e){return{'model':db[_0x40784e[_0x57aa('0x22')]],'as':_0x40784e['as'],'attributes':_0x40784e[_0x57aa('0x1e')],'include':_0x40784e[_0x57aa('0x21')]?_[_0x57aa('0x20')](_0x40784e[_0x57aa('0x21')],function(_0x13a533){return{'model':db[_0x13a533[_0x57aa('0x22')]],'as':_0x13a533['as'],'attributes':_0x13a533['attributes'],'include':_0x13a533[_0x57aa('0x21')]?_[_0x57aa('0x20')](_0x13a533['include'],function(_0x36407f){return{'model':db[_0x36407f[_0x57aa('0x22')]],'as':_0x36407f['as'],'attributes':_0x36407f[_0x57aa('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x57aa('0xf')](function(_0x273e98){logger[_0x57aa('0x18')](_0x57aa('0x23'),_0x28a4fc);logger[_0x57aa('0x11')](_0x57aa('0x23'),_0x28a4fc,JSON[_0x57aa('0x13')](_0x273e98));_0x34fea6(_0x273e98);})['catch'](function(_0x3fa8e4){logger[_0x57aa('0x14')](_0x57aa('0x23'),_0x3fa8e4[_0x57aa('0x17')],_0x28a4fc);_0x488893(_0x3bf9d1['error'](0x1f4,_0x3fa8e4[_0x57aa('0x17')]));});});}; \ No newline at end of file +var _0x5ebb=['limit','include','map','model','attributes','then','catch','ShowVoiceQueue','stringify','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','GetVoiceQueue','VoiceQueue','findAll','raw','options'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x5ebb,0x144));var _0xb5eb=function(_0x407131,_0x1bac9e){_0x407131=_0x407131-0x0;var _0xf60c74=_0x5ebb[_0x407131];return _0xf60c74;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb5eb('0x0'));var BPromise=require(_0xb5eb('0x1'));var rs=require(_0xb5eb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5eb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5eb('0x4'))('rpc');var config=require(_0xb5eb('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb5eb('0x6')][_0xb5eb('0x7')]({'port':0x232a});config[_0xb5eb('0x8')]=_[_0xb5eb('0x9')](config['redis'],{'host':_0xb5eb('0xa'),'port':0x18eb});var socket=require(_0xb5eb('0xb'))(new Redis(config[_0xb5eb('0x8')]));require(_0xb5eb('0xc'))['register'](socket);function respondWithRpcPromise(_0x194ae9,_0xe25d18,_0x518bb6){return new BPromise(function(_0x2526b5,_0x4bb814){return client['request'](_0x194ae9,_0x518bb6)['then'](function(_0x2665fb){logger['info'](_0xb5eb('0xd'),_0xe25d18,_0xb5eb('0xe'));logger[_0xb5eb('0xf')](_0xb5eb('0x10'),_0xe25d18,_0xb5eb('0xe'),JSON['stringify'](_0x2665fb));if(_0x2665fb[_0xb5eb('0x11')]){if(_0x2665fb['error'][_0xb5eb('0x12')]===0x1f4){logger[_0xb5eb('0x11')](_0xb5eb('0xd'),_0xe25d18,_0x2665fb[_0xb5eb('0x11')]['message']);return _0x4bb814(_0x2665fb['error'][_0xb5eb('0x13')]);}logger[_0xb5eb('0x11')]('VoiceQueue,\x20%s,\x20%s',_0xe25d18,_0x2665fb[_0xb5eb('0x11')][_0xb5eb('0x13')]);return _0x2526b5(_0x2665fb[_0xb5eb('0x11')][_0xb5eb('0x13')]);}else{logger[_0xb5eb('0x14')](_0xb5eb('0xd'),_0xe25d18,'request\x20sent');_0x2526b5(_0x2665fb['result'][_0xb5eb('0x13')]);}})['catch'](function(_0x3a2132){logger[_0xb5eb('0x11')](_0xb5eb('0xd'),_0xe25d18,_0x3a2132);_0x4bb814(_0x3a2132);});});}exports[_0xb5eb('0x15')]=function(_0x3c9a72){var _0x253ac9=this;return new Promise(function(_0x65d6a3,_0x4e8d71){return db[_0xb5eb('0x16')][_0xb5eb('0x17')]({'raw':_0x3c9a72['options']?_0x3c9a72['options'][_0xb5eb('0x18')]===undefined?!![]:![]:!![],'where':_0x3c9a72[_0xb5eb('0x19')]?_0x3c9a72[_0xb5eb('0x19')]['where']||null:null,'attributes':_0x3c9a72[_0xb5eb('0x19')]?_0x3c9a72[_0xb5eb('0x19')]['attributes']||null:null,'limit':_0x3c9a72[_0xb5eb('0x19')]?_0x3c9a72[_0xb5eb('0x19')][_0xb5eb('0x1a')]||null:null,'include':_0x3c9a72[_0xb5eb('0x19')]?_0x3c9a72[_0xb5eb('0x19')][_0xb5eb('0x1b')]?_[_0xb5eb('0x1c')](_0x3c9a72[_0xb5eb('0x19')][_0xb5eb('0x1b')],function(_0x3cd787){return{'model':db[_0x3cd787[_0xb5eb('0x1d')]],'as':_0x3cd787['as'],'attributes':_0x3cd787[_0xb5eb('0x1e')],'include':_0x3cd787[_0xb5eb('0x1b')]?_['map'](_0x3cd787[_0xb5eb('0x1b')],function(_0x230ccc){return{'model':db[_0x230ccc[_0xb5eb('0x1d')]],'as':_0x230ccc['as'],'attributes':_0x230ccc[_0xb5eb('0x1e')],'include':_0x230ccc[_0xb5eb('0x1b')]?_['map'](_0x230ccc['include'],function(_0x33a1e0){return{'model':db[_0x33a1e0[_0xb5eb('0x1d')]],'as':_0x33a1e0['as'],'attributes':_0x33a1e0[_0xb5eb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5eb('0x1f')](function(_0x2a9d29){logger[_0xb5eb('0x14')]('GetVoiceQueue',_0x3c9a72);logger[_0xb5eb('0xf')](_0xb5eb('0x15'),_0x3c9a72,JSON['stringify'](_0x2a9d29));_0x65d6a3(_0x2a9d29);})[_0xb5eb('0x20')](function(_0x38f230){logger[_0xb5eb('0x11')](_0xb5eb('0x15'),_0x38f230['message'],_0x3c9a72);_0x4e8d71(_0x253ac9[_0xb5eb('0x11')](0x1f4,_0x38f230[_0xb5eb('0x13')]));});});};exports[_0xb5eb('0x21')]=function(_0x49d5e6){var _0x35c5eb=this;return new Promise(function(_0x546b21,_0x5c841f){return db['VoiceQueue']['find']({'raw':_0x49d5e6['options']?_0x49d5e6[_0xb5eb('0x19')][_0xb5eb('0x18')]===undefined?!![]:![]:!![],'where':_0x49d5e6[_0xb5eb('0x19')]?_0x49d5e6[_0xb5eb('0x19')]['where']||null:null,'attributes':_0x49d5e6[_0xb5eb('0x19')]?_0x49d5e6[_0xb5eb('0x19')][_0xb5eb('0x1e')]||null:null,'include':_0x49d5e6[_0xb5eb('0x19')]?_0x49d5e6['options']['include']?_['map'](_0x49d5e6[_0xb5eb('0x19')][_0xb5eb('0x1b')],function(_0x66f0f0){return{'model':db[_0x66f0f0[_0xb5eb('0x1d')]],'as':_0x66f0f0['as'],'attributes':_0x66f0f0[_0xb5eb('0x1e')],'include':_0x66f0f0[_0xb5eb('0x1b')]?_[_0xb5eb('0x1c')](_0x66f0f0[_0xb5eb('0x1b')],function(_0x38c96d){return{'model':db[_0x38c96d['model']],'as':_0x38c96d['as'],'attributes':_0x38c96d['attributes'],'include':_0x38c96d['include']?_[_0xb5eb('0x1c')](_0x38c96d[_0xb5eb('0x1b')],function(_0x315855){return{'model':db[_0x315855[_0xb5eb('0x1d')]],'as':_0x315855['as'],'attributes':_0x315855[_0xb5eb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5eb('0x1f')](function(_0x16e564){logger[_0xb5eb('0x14')]('ShowVoiceQueue',_0x49d5e6);logger[_0xb5eb('0xf')](_0xb5eb('0x21'),_0x49d5e6,JSON[_0xb5eb('0x22')](_0x16e564));_0x546b21(_0x16e564);})[_0xb5eb('0x20')](function(_0x1539e0){logger['error'](_0xb5eb('0x21'),_0x1539e0[_0xb5eb('0x13')],_0x49d5e6);_0x5c841f(_0x35c5eb[_0xb5eb('0x11')](0x1f4,_0x1539e0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 1b91fc2..86e4c97 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 _0x1543=['remove','update','removeListener','register','length','./voiceQueue.events','save'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x1543,0x1c5));var _0x3154=function(_0x15e450,_0xedaefc){_0x15e450=_0x15e450-0x0;var _0x55ed61=_0x1543[_0x15e450];return _0x55ed61;};'use strict';var VoiceQueueEvents=require(_0x3154('0x0'));var events=[_0x3154('0x1'),_0x3154('0x2'),_0x3154('0x3')];function createListener(_0x32a740,_0x3841cb){return function(_0xda6c70){_0x3841cb['emit'](_0x32a740,_0xda6c70);};}function removeListener(_0x2306a0,_0x33ccfd){return function(){VoiceQueueEvents[_0x3154('0x4')](_0x2306a0,_0x33ccfd);};}exports[_0x3154('0x5')]=function(_0x37c77d){for(var _0x331b37=0x0,_0xa8b04a=events[_0x3154('0x6')];_0x331b37<_0xa8b04a;_0x331b37++){var _0x3fe198=events[_0x331b37];var _0xcb65f7=createListener('voiceQueue:'+_0x3fe198,_0x37c77d);VoiceQueueEvents['on'](_0x3fe198,_0xcb65f7);}}; \ No newline at end of file +var _0x7c47=['removeListener','voiceQueue:','./voiceQueue.events','remove','update','emit'];(function(_0x564aee,_0x242538){var _0x1004d8=function(_0x2bc910){while(--_0x2bc910){_0x564aee['push'](_0x564aee['shift']());}};_0x1004d8(++_0x242538);}(_0x7c47,0x1b8));var _0x77c4=function(_0xd91e67,_0x3e9e03){_0xd91e67=_0xd91e67-0x0;var _0x2397db=_0x7c47[_0xd91e67];return _0x2397db;};'use strict';var VoiceQueueEvents=require(_0x77c4('0x0'));var events=['save',_0x77c4('0x1'),_0x77c4('0x2')];function createListener(_0x2fd40f,_0x1fe002){return function(_0x676edf){_0x1fe002[_0x77c4('0x3')](_0x2fd40f,_0x676edf);};}function removeListener(_0x1b6f5d,_0x4eb03f){return function(){VoiceQueueEvents[_0x77c4('0x4')](_0x1b6f5d,_0x4eb03f);};}exports['register']=function(_0x58f8e6){for(var _0x204030=0x0,_0x440887=events['length'];_0x204030<_0x440887;_0x204030++){var _0x2ca0f9=events[_0x204030];var _0x3ce6b1=createListener(_0x77c4('0x5')+_0x2ca0f9,_0x58f8e6);VoiceQueueEvents['on'](_0x2ca0f9,_0x3ce6b1);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 6005785..b2d3994 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 _0x1115=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe','/index','getVoiceQueuesReport','show','put','/:id','update','delete','destroy','exports','util','path'];(function(_0x4b84ae,_0x26f981){var _0x3325f8=function(_0x242b05){while(--_0x242b05){_0x4b84ae['push'](_0x4b84ae['shift']());}};_0x3325f8(++_0x26f981);}(_0x1115,0x1b6));var _0x5111=function(_0x19cd5a,_0xc3525c){_0x19cd5a=_0x19cd5a-0x0;var _0x237fa6=_0x1115[_0x19cd5a];return _0x237fa6;};'use strict';var multer=require('multer');var util=require(_0x5111('0x0'));var path=require(_0x5111('0x1'));var timeout=require(_0x5111('0x2'));var express=require(_0x5111('0x3'));var router=express[_0x5111('0x4')]();var auth=require(_0x5111('0x5'));var interaction=require(_0x5111('0x6'));var config=require(_0x5111('0x7'));var controller=require(_0x5111('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5111('0x9')]);router[_0x5111('0xa')]('/describe',auth[_0x5111('0xb')](),controller[_0x5111('0xc')]);router['get'](_0x5111('0xd'),auth['isAuthenticated'](),controller[_0x5111('0xe')]);router[_0x5111('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5111('0xf')]);router['post']('/',auth[_0x5111('0xb')](),controller['create']);router[_0x5111('0x10')](_0x5111('0x11'),auth[_0x5111('0xb')](),controller[_0x5111('0x12')]);router[_0x5111('0x13')](_0x5111('0x11'),auth[_0x5111('0xb')](),controller[_0x5111('0x14')]);module[_0x5111('0x15')]=router; \ No newline at end of file +var _0xf494=['./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','/:id','show','create','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14c41b,_0x34ee9e){var _0xa3f91c=function(_0x1dda68){while(--_0x1dda68){_0x14c41b['push'](_0x14c41b['shift']());}};_0xa3f91c(++_0x34ee9e);}(_0xf494,0x1c6));var _0x4f49=function(_0x42e94d,_0x2355e5){_0x42e94d=_0x42e94d-0x0;var _0x5b18c5=_0xf494[_0x42e94d];return _0x5b18c5;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x4f49('0x9')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0x9')](_0x4f49('0xf'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router['post']('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4f49('0x12')](_0x4f49('0xf'),auth['isAuthenticated'](),controller[_0x4f49('0x13')]);module[_0x4f49('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 475ae76..9db4f86 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 _0x5527=['format','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5527,0x13f));var _0x7552=function(_0x4e94bf,_0x1e19a6){_0x4e94bf=_0x4e94bf-0x0;var _0x54bc9f=_0x5527[_0x4e94bf];return _0x54bc9f;};'use strict';var Sequelize=require(_0x7552('0x0'));var moment=require(_0x7552('0x1'));module[_0x7552('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7552('0x3')]},'calleridname':{'type':Sequelize[_0x7552('0x3')]},'queue':{'type':Sequelize[_0x7552('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x7552('0x4')],'set':function(_0x20202b){var _0x2f9b59=moment(_0x20202b);var _0x1f8ffa=moment(this[_0x7552('0x5')]('queuecallerjoinAt'))[_0x7552('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x39f9c7=_0x2f9b59['diff'](_0x1f8ffa,_0x7552('0x7'));this[_0x7552('0x8')]('queuecallerleaveAt',_0x20202b);this[_0x7552('0x8')](_0x7552('0x9'),_0x39f9c7||null);}},'position':{'type':Sequelize[_0x7552('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x7552('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7552('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x7552('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7552('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7552('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x7552('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x7552('0xa')]},'channel':{'type':Sequelize[_0x7552('0x3')]},'connectedlinenum':{'type':Sequelize[_0x7552('0x3')]},'connectedlinename':{'type':Sequelize[_0x7552('0x3')]},'accountcode':{'type':Sequelize[_0x7552('0x3')]},'context':{'type':Sequelize[_0x7552('0x3')]},'exten':{'type':Sequelize[_0x7552('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x7552('0xa')]},'mohtime':{'type':Sequelize[_0x7552('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7552('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7552('0x3')]},'transfer':{'type':Sequelize[_0x7552('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7552('0x3')],'comment':_0x7552('0xc')},'transferexten':{'type':Sequelize[_0x7552('0x3')]},'transferuniqueid':{'type':Sequelize[_0x7552('0x3')]},'disposition':{'type':Sequelize[_0x7552('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6e2a=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue'];(function(_0x77fbf8,_0x31cf3f){var _0x2df250=function(_0x24b65f){while(--_0x24b65f){_0x77fbf8['push'](_0x77fbf8['shift']());}};_0x2df250(++_0x31cf3f);}(_0x6e2a,0xfa));var _0xa6e2=function(_0x387f01,_0x59628a){_0x387f01=_0x387f01-0x0;var _0x4214e5=_0x6e2a[_0x387f01];return _0x4214e5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa6e2('0x0'));module[_0xa6e2('0x1')]={'type':{'type':Sequelize[_0xa6e2('0x2')]},'uniqueid':{'type':Sequelize[_0xa6e2('0x2')]},'calleridnum':{'type':Sequelize[_0xa6e2('0x2')]},'calleridname':{'type':Sequelize[_0xa6e2('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xa6e2('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xa6e2('0x3')],'set':function(_0x499c45){var _0x5ee36f=moment(_0x499c45);var _0x5a2e57=moment(this[_0xa6e2('0x4')]('queuecallerjoinAt'))[_0xa6e2('0x5')](_0xa6e2('0x6'));var _0x4fda21=_0x5ee36f[_0xa6e2('0x7')](_0x5a2e57,_0xa6e2('0x8'));this['setDataValue'](_0xa6e2('0x9'),_0x499c45);this['setDataValue'](_0xa6e2('0xa'),_0x4fda21||null);}},'position':{'type':Sequelize[_0xa6e2('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa6e2('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa6e2('0x3')]},'queuecallerexit':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa6e2('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xa6e2('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xa6e2('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa6e2('0x2')]},'connectedlinename':{'type':Sequelize[_0xa6e2('0x2')]},'accountcode':{'type':Sequelize[_0xa6e2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa6e2('0x2')]},'priority':{'type':Sequelize[_0xa6e2('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa6e2('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa6e2('0x2')]},'transfer':{'type':Sequelize[_0xa6e2('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa6e2('0x2')],'comment':_0xa6e2('0xe')},'transferexten':{'type':Sequelize[_0xa6e2('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa6e2('0x2')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xa6e2('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 7aac6ae..eb7b540 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file +var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e0ed179..6f3519b 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 _0xc6d1=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x3502fd,_0xa33fcd){var _0x2a4c3d=function(_0x30d932){while(--_0x30d932){_0x3502fd['push'](_0x3502fd['shift']());}};_0x2a4c3d(++_0xa33fcd);}(_0xc6d1,0x1a1));var _0x1c6d=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xc6d1[_0x4b2863];return _0x567d67;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x1c6d('0x0'))['db'][_0x1c6d('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1c6d('0x2')](0x0);var events={'afterCreate':_0x1c6d('0x3'),'afterUpdate':_0x1c6d('0x4'),'afterDestroy':_0x1c6d('0x5')};function emitEvent(_0x2754b1){return function(_0x3f0cf5,_0x18accb,_0x39eb9c){VoiceQueueReportEvents['emit'](_0x2754b1+':'+_0x3f0cf5['id'],_0x3f0cf5);VoiceQueueReportEvents['emit'](_0x2754b1,_0x3f0cf5);_0x39eb9c(null);};}for(var e in events){if(events[_0x1c6d('0x6')](e)){var event=events[e];VoiceQueueReport[_0x1c6d('0x7')](e,emitEvent(event));}}module[_0x1c6d('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x53ca=['exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x53ca,0x15f));var _0xa53c=function(_0x171bbd,_0x5e202c){_0x171bbd=_0x171bbd-0x0;var _0x40f393=_0x53ca[_0x171bbd];return _0x40f393;};'use strict';var EventEmitter=require(_0xa53c('0x0'));var VoiceQueueReport=require(_0xa53c('0x1'))['db'][_0xa53c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa53c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa53c('0x4'),'afterDestroy':_0xa53c('0x5')};function emitEvent(_0x4e7232){return function(_0x575f9d,_0x3dc44e,_0x1e0018){VoiceQueueReportEvents[_0xa53c('0x6')](_0x4e7232+':'+_0x575f9d['id'],_0x575f9d);VoiceQueueReportEvents[_0xa53c('0x6')](_0x4e7232,_0x575f9d);_0x1e0018(null);};}for(var e in events){if(events[_0xa53c('0x7')](e)){var event=events[e];VoiceQueueReport[_0xa53c('0x8')](e,emitEvent(event));}}module[_0xa53c('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 4556f68..f83ead9 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 _0xb715=['rimraf','../../config/environment','report_queue','uniqueid','calleridnum','util','api','moment','request-promise'];(function(_0x529059,_0x294a33){var _0x156bc2=function(_0x9bc770){while(--_0x9bc770){_0x529059['push'](_0x529059['shift']());}};_0x156bc2(++_0x294a33);}(_0xb715,0x16d));var _0x5b71=function(_0x320a59,_0x2ece25){_0x320a59=_0x320a59-0x0;var _0x1cf207=_0xb715[_0x320a59];return _0x1cf207;};'use strict';var _=require('lodash');var util=require(_0x5b71('0x0'));var logger=require('../../config/logger')(_0x5b71('0x1'));var moment=require(_0x5b71('0x2'));var BPromise=require('bluebird');var rp=require(_0x5b71('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b71('0x4'));var config=require(_0x5b71('0x5'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x887674,_0x2a2950){return _0x887674['define']('VoiceQueueReport',attributes,{'tableName':_0x5b71('0x6'),'paranoid':![],'indexes':[{'fields':[_0x5b71('0x7')]},{'fields':[_0x5b71('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x889e=['api','path','rimraf','VoiceQueueReport','report_queue','uniqueid','calleridnum','util'];(function(_0x4af26f,_0x4d65aa){var _0x39ccd4=function(_0x32e550){while(--_0x32e550){_0x4af26f['push'](_0x4af26f['shift']());}};_0x39ccd4(++_0x4d65aa);}(_0x889e,0xe7));var _0xe889=function(_0x4c7df6,_0x12ccbc){_0x4c7df6=_0x4c7df6-0x0;var _0x2ec1d6=_0x889e[_0x4c7df6];return _0x2ec1d6;};'use strict';var _=require('lodash');var util=require(_0xe889('0x0'));var logger=require('../../config/logger')(_0xe889('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe889('0x2'));var rimraf=require(_0xe889('0x3'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x34d365,_0x57505d){return _0x34d365['define'](_0xe889('0x4'),attributes,{'tableName':_0xe889('0x5'),'paranoid':![],'indexes':[{'fields':[_0xe889('0x6')]},{'fields':[_0xe889('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 8614544..ae071b2 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 _0x8f29=['info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','map','model','debug','catch','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./voiceQueueReport.socket','register','request','then'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x8f29,0x1a5));var _0x98f2=function(_0x4b8f1e,_0xe5acdc){_0x4b8f1e=_0x4b8f1e-0x0;var _0x852451=_0x8f29[_0x4b8f1e];return _0x852451;};'use strict';var _=require(_0x98f2('0x0'));var util=require('util');var moment=require(_0x98f2('0x1'));var BPromise=require(_0x98f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98f2('0x3'));var db=require(_0x98f2('0x4'))['db'];var utils=require(_0x98f2('0x5'));var logger=require(_0x98f2('0x6'))(_0x98f2('0x7'));var config=require(_0x98f2('0x8'));var jayson=require(_0x98f2('0x9'));var client=jayson[_0x98f2('0xa')][_0x98f2('0xb')]({'port':0x232a});config['redis']=_[_0x98f2('0xc')](config[_0x98f2('0xd')],{'host':_0x98f2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x98f2('0xf'))[_0x98f2('0x10')](socket);function respondWithRpcPromise(_0x143aec,_0x252e15,_0x533fc8){return new BPromise(function(_0x5ae9b4,_0x43b9f0){return client[_0x98f2('0x11')](_0x143aec,_0x533fc8)[_0x98f2('0x12')](function(_0x2b4f3a){logger[_0x98f2('0x13')](_0x98f2('0x14'),_0x252e15,_0x98f2('0x15'));logger['debug'](_0x98f2('0x16'),_0x252e15,_0x98f2('0x15'),JSON[_0x98f2('0x17')](_0x2b4f3a));if(_0x2b4f3a[_0x98f2('0x18')]){if(_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x19')]===0x1f4){logger[_0x98f2('0x18')](_0x98f2('0x14'),_0x252e15,_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x1a')]);return _0x43b9f0(_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x1a')]);}logger['error'](_0x98f2('0x14'),_0x252e15,_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x1a')]);return _0x5ae9b4(_0x2b4f3a[_0x98f2('0x18')][_0x98f2('0x1a')]);}else{logger[_0x98f2('0x13')](_0x98f2('0x14'),_0x252e15,'request\x20sent');_0x5ae9b4(_0x2b4f3a['result'][_0x98f2('0x1a')]);}})['catch'](function(_0x45a8ec){logger[_0x98f2('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x252e15,_0x45a8ec);_0x43b9f0(_0x45a8ec);});});}exports[_0x98f2('0x1b')]=function(_0x3808ed){var _0x5bf884=this;return new Promise(function(_0x23dd04,_0x46649a){return db[_0x98f2('0x1c')]['findAll']({'raw':_0x3808ed[_0x98f2('0x1d')]?_0x3808ed[_0x98f2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3808ed['options']?_0x3808ed['options'][_0x98f2('0x1e')]||null:null,'attributes':_0x3808ed[_0x98f2('0x1d')]?_0x3808ed[_0x98f2('0x1d')][_0x98f2('0x1f')]||null:null,'limit':_0x3808ed[_0x98f2('0x1d')]?_0x3808ed['options'][_0x98f2('0x20')]||null:null,'include':_0x3808ed[_0x98f2('0x1d')]?_0x3808ed[_0x98f2('0x1d')][_0x98f2('0x21')]?_[_0x98f2('0x22')](_0x3808ed[_0x98f2('0x1d')][_0x98f2('0x21')],function(_0x45faf7){return{'model':db[_0x45faf7[_0x98f2('0x23')]],'as':_0x45faf7['as'],'attributes':_0x45faf7[_0x98f2('0x1f')],'include':_0x45faf7[_0x98f2('0x21')]?_['map'](_0x45faf7['include'],function(_0x4fe190){return{'model':db[_0x4fe190[_0x98f2('0x23')]],'as':_0x4fe190['as'],'attributes':_0x4fe190[_0x98f2('0x1f')],'include':_0x4fe190['include']?_[_0x98f2('0x22')](_0x4fe190[_0x98f2('0x21')],function(_0x53e64f){return{'model':db[_0x53e64f[_0x98f2('0x23')]],'as':_0x53e64f['as'],'attributes':_0x53e64f['attributes']};}):[]};}):[]};}):[]:[]})[_0x98f2('0x12')](function(_0x4451d9){logger[_0x98f2('0x13')](_0x98f2('0x1b'),_0x3808ed);logger[_0x98f2('0x24')](_0x98f2('0x1b'),_0x3808ed,JSON['stringify'](_0x4451d9));_0x23dd04(_0x4451d9);})[_0x98f2('0x25')](function(_0x40394a){logger[_0x98f2('0x18')](_0x98f2('0x1b'),_0x40394a['message'],_0x3808ed);_0x46649a(_0x5bf884[_0x98f2('0x18')](0x1f4,_0x40394a[_0x98f2('0x1a')]));});});};exports[_0x98f2('0x26')]=function(_0x201a2d){var _0xec50fa=this;return new Promise(function(_0x512446,_0x2fdf84){return db[_0x98f2('0x1c')][_0x98f2('0x27')](_0x201a2d[_0x98f2('0x28')],{'raw':_0x201a2d[_0x98f2('0x1d')]?_0x201a2d[_0x98f2('0x1d')][_0x98f2('0x29')]===undefined?!![]:![]:!![]})[_0x98f2('0x12')](function(_0x180fc0){logger[_0x98f2('0x13')](_0x98f2('0x26'),_0x201a2d);logger[_0x98f2('0x24')](_0x98f2('0x26'),_0x201a2d,JSON[_0x98f2('0x17')](_0x180fc0));_0x512446(_0x180fc0);})['catch'](function(_0x200473){logger[_0x98f2('0x18')]('CreateVoiceQueueReport',_0x200473[_0x98f2('0x1a')],_0x201a2d);_0x2fdf84(_0xec50fa[_0x98f2('0x18')](0x1f4,_0x200473['message']));});});};exports[_0x98f2('0x2a')]=function(_0x2a61ef){var _0x3ed327=this;return new Promise(function(_0x3c5454,_0x22164b){return db[_0x98f2('0x1c')][_0x98f2('0x2b')](_0x2a61ef[_0x98f2('0x28')],{'raw':_0x2a61ef[_0x98f2('0x1d')]?_0x2a61ef[_0x98f2('0x1d')][_0x98f2('0x29')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a61ef[_0x98f2('0x1d')]?_0x2a61ef[_0x98f2('0x1d')][_0x98f2('0x1e')]||null:null,'attributes':_0x2a61ef[_0x98f2('0x1d')]?_0x2a61ef[_0x98f2('0x1d')][_0x98f2('0x1f')]||null:null,'limit':_0x2a61ef['options']?_0x2a61ef[_0x98f2('0x1d')]['limit']||null:null})['then'](function(_0xde44db){logger[_0x98f2('0x13')]('UpdateVoiceQueueReport',_0x2a61ef);logger['debug'](_0x98f2('0x2a'),_0x2a61ef,JSON['stringify'](_0xde44db));_0x3c5454(_0xde44db);})[_0x98f2('0x25')](function(_0x5475cc){logger[_0x98f2('0x18')](_0x98f2('0x2a'),_0x5475cc[_0x98f2('0x1a')],_0x2a61ef);_0x22164b(_0x3ed327[_0x98f2('0x18')](0x1f4,_0x5475cc[_0x98f2('0x1a')]));});});}; \ No newline at end of file +var _0x2f96=['create','UpdateVoiceQueueReport','body','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','then','CreateVoiceQueueReport','VoiceQueueReport'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0x2f96,0x1dc));var _0x62f9=function(_0x5e2d28,_0x17ee5e){_0x5e2d28=_0x5e2d28-0x0;var _0x5e20aa=_0x2f96[_0x5e2d28];return _0x5e20aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x62f9('0x0'));var BPromise=require(_0x62f9('0x1'));var rs=require(_0x62f9('0x2'));var fs=require('fs');var Redis=require(_0x62f9('0x3'));var db=require(_0x62f9('0x4'))['db'];var utils=require(_0x62f9('0x5'));var logger=require(_0x62f9('0x6'))(_0x62f9('0x7'));var config=require(_0x62f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x62f9('0x9')]['http']({'port':0x232a});config[_0x62f9('0xa')]=_[_0x62f9('0xb')](config[_0x62f9('0xa')],{'host':_0x62f9('0xc'),'port':0x18eb});var socket=require(_0x62f9('0xd'))(new Redis(config[_0x62f9('0xa')]));require(_0x62f9('0xe'))[_0x62f9('0xf')](socket);function respondWithRpcPromise(_0xe7bcbe,_0x37dbec,_0x15d0bd){return new BPromise(function(_0x46e2dc,_0xa9b3f){return client[_0x62f9('0x10')](_0xe7bcbe,_0x15d0bd)['then'](function(_0x2c8280){logger[_0x62f9('0x11')](_0x62f9('0x12'),_0x37dbec,'request\x20sent');logger[_0x62f9('0x13')](_0x62f9('0x14'),_0x37dbec,'request\x20sent',JSON[_0x62f9('0x15')](_0x2c8280));if(_0x2c8280[_0x62f9('0x16')]){if(_0x2c8280[_0x62f9('0x16')]['code']===0x1f4){logger[_0x62f9('0x16')](_0x62f9('0x12'),_0x37dbec,_0x2c8280[_0x62f9('0x16')][_0x62f9('0x17')]);return _0xa9b3f(_0x2c8280['error'][_0x62f9('0x17')]);}logger[_0x62f9('0x16')](_0x62f9('0x12'),_0x37dbec,_0x2c8280[_0x62f9('0x16')][_0x62f9('0x17')]);return _0x46e2dc(_0x2c8280[_0x62f9('0x16')][_0x62f9('0x17')]);}else{logger[_0x62f9('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x37dbec,_0x62f9('0x18'));_0x46e2dc(_0x2c8280[_0x62f9('0x19')][_0x62f9('0x17')]);}})[_0x62f9('0x1a')](function(_0x2a90bb){logger[_0x62f9('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x37dbec,_0x2a90bb);_0xa9b3f(_0x2a90bb);});});}exports[_0x62f9('0x1b')]=function(_0x5f517b){var _0x2bb6c6=this;return new Promise(function(_0x4ed798,_0x14f12b){return db['VoiceQueueReport'][_0x62f9('0x1c')]({'raw':_0x5f517b[_0x62f9('0x1d')]?_0x5f517b[_0x62f9('0x1d')][_0x62f9('0x1e')]===undefined?!![]:![]:!![],'where':_0x5f517b[_0x62f9('0x1d')]?_0x5f517b[_0x62f9('0x1d')][_0x62f9('0x1f')]||null:null,'attributes':_0x5f517b[_0x62f9('0x1d')]?_0x5f517b[_0x62f9('0x1d')][_0x62f9('0x20')]||null:null,'limit':_0x5f517b[_0x62f9('0x1d')]?_0x5f517b[_0x62f9('0x1d')][_0x62f9('0x21')]||null:null,'include':_0x5f517b['options']?_0x5f517b['options'][_0x62f9('0x22')]?_['map'](_0x5f517b['options'][_0x62f9('0x22')],function(_0x9b3188){return{'model':db[_0x9b3188[_0x62f9('0x23')]],'as':_0x9b3188['as'],'attributes':_0x9b3188[_0x62f9('0x20')],'include':_0x9b3188[_0x62f9('0x22')]?_[_0x62f9('0x24')](_0x9b3188[_0x62f9('0x22')],function(_0x376274){return{'model':db[_0x376274[_0x62f9('0x23')]],'as':_0x376274['as'],'attributes':_0x376274[_0x62f9('0x20')],'include':_0x376274[_0x62f9('0x22')]?_[_0x62f9('0x24')](_0x376274[_0x62f9('0x22')],function(_0x1aa9cd){return{'model':db[_0x1aa9cd[_0x62f9('0x23')]],'as':_0x1aa9cd['as'],'attributes':_0x1aa9cd[_0x62f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x62f9('0x25')](function(_0x1dfa05){logger[_0x62f9('0x11')](_0x62f9('0x1b'),_0x5f517b);logger[_0x62f9('0x13')]('GetVoiceQueueReport',_0x5f517b,JSON['stringify'](_0x1dfa05));_0x4ed798(_0x1dfa05);})[_0x62f9('0x1a')](function(_0x49c6cb){logger[_0x62f9('0x16')](_0x62f9('0x1b'),_0x49c6cb['message'],_0x5f517b);_0x14f12b(_0x2bb6c6[_0x62f9('0x16')](0x1f4,_0x49c6cb['message']));});});};exports[_0x62f9('0x26')]=function(_0xf91bc5){var _0x202141=this;return new Promise(function(_0x286803,_0x19ace2){return db[_0x62f9('0x27')][_0x62f9('0x28')](_0xf91bc5['body'],{'raw':_0xf91bc5[_0x62f9('0x1d')]?_0xf91bc5[_0x62f9('0x1d')][_0x62f9('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4be5c8){logger[_0x62f9('0x11')](_0x62f9('0x26'),_0xf91bc5);logger[_0x62f9('0x13')](_0x62f9('0x26'),_0xf91bc5,JSON[_0x62f9('0x15')](_0x4be5c8));_0x286803(_0x4be5c8);})[_0x62f9('0x1a')](function(_0x12af2e){logger[_0x62f9('0x16')](_0x62f9('0x26'),_0x12af2e[_0x62f9('0x17')],_0xf91bc5);_0x19ace2(_0x202141[_0x62f9('0x16')](0x1f4,_0x12af2e['message']));});});};exports[_0x62f9('0x29')]=function(_0x51d804){var _0x4dfd29=this;return new Promise(function(_0x5823d1,_0x41cdae){return db[_0x62f9('0x27')]['update'](_0x51d804[_0x62f9('0x2a')],{'raw':_0x51d804[_0x62f9('0x1d')]?_0x51d804['options'][_0x62f9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d804[_0x62f9('0x1d')]?_0x51d804[_0x62f9('0x1d')][_0x62f9('0x1f')]||null:null,'attributes':_0x51d804[_0x62f9('0x1d')]?_0x51d804['options'][_0x62f9('0x20')]||null:null,'limit':_0x51d804['options']?_0x51d804[_0x62f9('0x1d')][_0x62f9('0x21')]||null:null})[_0x62f9('0x25')](function(_0x2764f0){logger[_0x62f9('0x11')]('UpdateVoiceQueueReport',_0x51d804);logger['debug'](_0x62f9('0x29'),_0x51d804,JSON[_0x62f9('0x15')](_0x2764f0));_0x5823d1(_0x2764f0);})['catch'](function(_0x2c622b){logger[_0x62f9('0x16')](_0x62f9('0x29'),_0x2c622b[_0x62f9('0x17')],_0x51d804);_0x41cdae(_0x4dfd29[_0x62f9('0x16')](0x1f4,_0x2c622b[_0x62f9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index be92980..67ab58b 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 _0x9b46=['register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x21d36e,_0x5dc096){var _0x4cc307=function(_0x4ae995){while(--_0x4ae995){_0x21d36e['push'](_0x21d36e['shift']());}};_0x4cc307(++_0x5dc096);}(_0x9b46,0xea));var _0x69b4=function(_0x31a650,_0x556865){_0x31a650=_0x31a650-0x0;var _0x1a840e=_0x9b46[_0x31a650];return _0x1a840e;};'use strict';var VoiceQueueReportEvents=require(_0x69b4('0x0'));var events=[_0x69b4('0x1'),_0x69b4('0x2'),_0x69b4('0x3')];function createListener(_0x2c8ff1,_0x33a8ca){return function(_0x3a7d09){_0x33a8ca[_0x69b4('0x4')](_0x2c8ff1,_0x3a7d09);};}function removeListener(_0x5d49fc,_0x283ebc){return function(){VoiceQueueReportEvents[_0x69b4('0x5')](_0x5d49fc,_0x283ebc);};}exports[_0x69b4('0x6')]=function(_0x779dc8){for(var _0x487d4d=0x0,_0x53c366=events['length'];_0x487d4d<_0x53c366;_0x487d4d++){var _0x21f4b1=events[_0x487d4d];var _0x3fcd8e=createListener(_0x69b4('0x7')+_0x21f4b1,_0x779dc8);VoiceQueueReportEvents['on'](_0x21f4b1,_0x3fcd8e);}}; \ No newline at end of file +var _0xff49=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xff49,0xba));var _0x9ff4=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xff49[_0x1da527];return _0x40fc7c;};'use strict';var VoiceQueueReportEvents=require(_0x9ff4('0x0'));var events=[_0x9ff4('0x1'),_0x9ff4('0x2'),_0x9ff4('0x3')];function createListener(_0x71ce47,_0x47ea38){return function(_0x3ad3fd){_0x47ea38[_0x9ff4('0x4')](_0x71ce47,_0x3ad3fd);};}function removeListener(_0x5a158a,_0x2c463d){return function(){VoiceQueueReportEvents[_0x9ff4('0x5')](_0x5a158a,_0x2c463d);};}exports[_0x9ff4('0x6')]=function(_0x57273c){for(var _0x8ce1c6=0x0,_0x2f9362=events[_0x9ff4('0x7')];_0x8ce1c6<_0x2f9362;_0x8ce1c6++){var _0x6e7bd5=events[_0x8ce1c6];var _0x4a506e=createListener(_0x9ff4('0x8')+_0x6e7bd5,_0x57273c);VoiceQueueReportEvents['on'](_0x6e7bd5,_0x4a506e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ff14102..2916818 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 _0xb41e=['get','isAuthenticated','index','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller'];(function(_0x535636,_0x424d47){var _0x3a2f7a=function(_0x39e107){while(--_0x39e107){_0x535636['push'](_0x535636['shift']());}};_0x3a2f7a(++_0x424d47);}(_0xb41e,0x1f0));var _0xeb41=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0xb41e[_0x1a1b6e];return _0x571e2c;};'use strict';var multer=require(_0xeb41('0x0'));var util=require('util');var path=require(_0xeb41('0x1'));var timeout=require(_0xeb41('0x2'));var express=require(_0xeb41('0x3'));var router=express[_0xeb41('0x4')]();var auth=require(_0xeb41('0x5'));var interaction=require(_0xeb41('0x6'));var config=require('../../config/environment');var controller=require(_0xeb41('0x7'));router[_0xeb41('0x8')]('/',auth[_0xeb41('0x9')](),controller[_0xeb41('0xa')]);router[_0xeb41('0x8')]('/:id',auth[_0xeb41('0x9')](),controller['show']);router[_0xeb41('0xb')]('/',auth[_0xeb41('0x9')](),controller[_0xeb41('0xc')]);router[_0xeb41('0xd')]('/:id',auth[_0xeb41('0x9')](),controller[_0xeb41('0xe')]);router[_0xeb41('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xeb41('0x10')]);module[_0xeb41('0x11')]=router; \ No newline at end of file +var _0xf794=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','put','exports'];(function(_0x509f50,_0x17d3f1){var _0x2cc56a=function(_0x161a9e){while(--_0x161a9e){_0x509f50['push'](_0x509f50['shift']());}};_0x2cc56a(++_0x17d3f1);}(_0xf794,0x150));var _0x4f79=function(_0x169f9f,_0x305b64){_0x169f9f=_0x169f9f-0x0;var _0x5b28a6=_0xf794[_0x169f9f];return _0x5b28a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4f79('0x0'));var timeout=require(_0x4f79('0x1'));var express=require(_0x4f79('0x2'));var router=express['Router']();var auth=require(_0x4f79('0x3'));var interaction=require(_0x4f79('0x4'));var config=require(_0x4f79('0x5'));var controller=require(_0x4f79('0x6'));router[_0x4f79('0x7')]('/',auth[_0x4f79('0x8')](),controller['index']);router[_0x4f79('0x7')](_0x4f79('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x4f79('0x8')](),controller['create']);router[_0x4f79('0xa')](_0x4f79('0x9'),auth[_0x4f79('0x8')](),controller['update']);router['delete'](_0x4f79('0x9'),auth[_0x4f79('0x8')](),controller['destroy']);module[_0x4f79('0xb')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index fdd1b8d..19c5f65 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 _0x9506=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x2e8763,_0x2dd77a){var _0x3e2f44=function(_0x18bfc9){while(--_0x18bfc9){_0x2e8763['push'](_0x2e8763['shift']());}};_0x3e2f44(++_0x2dd77a);}(_0x9506,0xa9));var _0x6950=function(_0x5ada40,_0x41803a){_0x5ada40=_0x5ada40-0x0;var _0x3dfb05=_0x9506[_0x5ada40];return _0x3dfb05;};'use strict';var Sequelize=require(_0x6950('0x0'));var moment=require(_0x6950('0x1'));module[_0x6950('0x2')]={'time':{'type':Sequelize[_0x6950('0x3')]},'callid':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6950('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6950('0x4')],'allowNull':![],'defaultValue':moment()[_0x6950('0x5')](_0x6950('0x6'))}}; \ No newline at end of file +var _0x8099=['exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0xd35854,_0x50e8e2){var _0x69c515=function(_0x3e1c3d){while(--_0x3e1c3d){_0xd35854['push'](_0xd35854['shift']());}};_0x69c515(++_0x50e8e2);}(_0x8099,0xb3));var _0x9809=function(_0x5f9dcf,_0x5eefda){_0x5f9dcf=_0x5f9dcf-0x0;var _0x1f69f8=_0x8099[_0x5f9dcf];return _0x1f69f8;};'use strict';var Sequelize=require(_0x9809('0x0'));var moment=require('moment');module[_0x9809('0x1')]={'time':{'type':Sequelize[_0x9809('0x2')]},'callid':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9809('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x9809('0x3')](_0x9809('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 793c94e..2dd215f 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x7b6ffe,_0x2bc84a){var _0x3822d0=function(_0x382b3d){while(--_0x382b3d){_0x7b6ffe['push'](_0x7b6ffe['shift']());}};_0x3822d0(++_0x2bc84a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5e48fd,_0xb0671f){var _0x27d122=function(_0xd04492){while(--_0xd04492){_0x5e48fd['push'](_0x5e48fd['shift']());}};_0x27d122(++_0xb0671f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6ab059a..fa5cee4 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 _0x3f8a=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1376cf,_0x5407dc){var _0x5bbeae=function(_0x79bce9){while(--_0x79bce9){_0x1376cf['push'](_0x1376cf['shift']());}};_0x5bbeae(++_0x5407dc);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xb51660,_0x453a1f){_0xb51660=_0xb51660-0x0;var _0x287b35=_0x3f8a[_0xb51660];return _0x287b35;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[{'name':_0xa3f8('0xe'),'fields':[_0xa3f8('0xf'),_0xa3f8('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0xbff5=['request-promise','rimraf','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3c3b81,_0x49871a){var _0x242d23=function(_0x183729){while(--_0x183729){_0x3c3b81['push'](_0x3c3b81['shift']());}};_0x242d23(++_0x49871a);}(_0xbff5,0x1bc));var _0x5bff=function(_0x4588a7,_0x17af7c){_0x4588a7=_0x4588a7-0x0;var _0x8e89ba=_0xbff5[_0x4588a7];return _0x8e89ba;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var logger=require(_0x5bff('0x2'))(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var rp=require(_0x5bff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bff('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x5bff('0x8')]=function(_0x1d8650,_0x151add){return _0x1d8650[_0x5bff('0x9')](_0x5bff('0xa'),attributes,{'tableName':_0x5bff('0xb'),'paranoid':![],'indexes':[{'name':_0x5bff('0xc'),'fields':[_0x5bff('0xd'),_0x5bff('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a91230f..0d0f018 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 _0xb921=['info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5c0163,_0x1fab63){var _0x3b9541=function(_0x3ebf4f){while(--_0x3ebf4f){_0x5c0163['push'](_0x5c0163['shift']());}};_0x3b9541(++_0x1fab63);}(_0xb921,0x16a));var _0x1b92=function(_0x5f22f8,_0x36500d){_0x5f22f8=_0x5f22f8-0x0;var _0xff89ad=_0xb921[_0x5f22f8];return _0xff89ad;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a6282,_0x7973df,_0x352406){return new BPromise(function(_0x1545f9,_0x64a3ed){return client[_0x1b92('0xc')](_0x8a6282,_0x352406)[_0x1b92('0xd')](function(_0x4567ab){logger['info'](_0x1b92('0xe'),_0x7973df,_0x1b92('0xf'));logger[_0x1b92('0x10')](_0x1b92('0x11'),_0x7973df,_0x1b92('0xf'),JSON[_0x1b92('0x12')](_0x4567ab));if(_0x4567ab[_0x1b92('0x13')]){if(_0x4567ab['error'][_0x1b92('0x14')]===0x1f4){logger[_0x1b92('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x7973df,_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);return _0x64a3ed(_0x4567ab[_0x1b92('0x13')][_0x1b92('0x15')]);}logger[_0x1b92('0x13')](_0x1b92('0xe'),_0x7973df,_0x4567ab[_0x1b92('0x13')]['message']);return _0x1545f9(_0x4567ab[_0x1b92('0x13')]['message']);}else{logger[_0x1b92('0x16')]('VoiceQueuesLog,\x20%s,\x20%s',_0x7973df,_0x1b92('0xf'));_0x1545f9(_0x4567ab['result'][_0x1b92('0x15')]);}})[_0x1b92('0x17')](function(_0x688aef){logger['error'](_0x1b92('0xe'),_0x7973df,_0x688aef);_0x64a3ed(_0x688aef);});});} \ No newline at end of file +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(_0x2fc8ea,_0x2ec5a7){var _0x3b679e=function(_0x3613b7){while(--_0x3613b7){_0x2fc8ea['push'](_0x2fc8ea['shift']());}};_0x3b679e(++_0x2ec5a7);}(_0xa45c,0x6d));var _0xca45=function(_0x192140,_0x17cef2){_0x192140=_0x192140-0x0;var _0x505d67=_0xa45c[_0x192140];return _0x505d67;};'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 diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index db8d59b..dd92fae 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x511a87,_0xa77c7){var _0x586bdd=function(_0x2b4e17){while(--_0x2b4e17){_0x511a87['push'](_0x511a87['shift']());}};_0x586bdd(++_0xa77c7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x254be3,_0x3baf49){var _0x2f3361=function(_0x1d867c){while(--_0x1d867c){_0x254be3['push'](_0x254be3['shift']());}};_0x2f3361(++_0x3baf49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 81abfb1..153c890 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 _0x7eea=['exports','VIRTUAL','getDataValue','value','STRING','setDataValue','channel','split','TEXT','FLOAT','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','sequelize','moment'];(function(_0x591896,_0x386bac){var _0x5eaa48=function(_0x10ca6a){while(--_0x10ca6a){_0x591896['push'](_0x591896['shift']());}};_0x5eaa48(++_0x386bac);}(_0x7eea,0xce));var _0xa7ee=function(_0x49df2d,_0x1a5ce8){_0x49df2d=_0x49df2d-0x0;var _0x47a263=_0x7eea[_0x49df2d];return _0x47a263;};'use strict';var Sequelize=require(_0xa7ee('0x0'));var moment=require(_0xa7ee('0x1'));var path=require('path');module[_0xa7ee('0x2')]={'format':{'type':Sequelize[_0xa7ee('0x3')],'get':function(){return this[_0xa7ee('0x4')](_0xa7ee('0x5'))?path['extname'](this[_0xa7ee('0x4')](_0xa7ee('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa7ee('0x6')],'set':function(_0x5af976){if(_0x5af976){this[_0xa7ee('0x7')](_0xa7ee('0x8'),_0x5af976);this['setDataValue']('membername',_0x5af976[_0xa7ee('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xa7ee('0x6')]},'calleridnum':{'type':Sequelize[_0xa7ee('0x6')]},'calleridname':{'type':Sequelize[_0xa7ee('0x6')]},'connectedlinenum':{'type':Sequelize[_0xa7ee('0x6')]},'connectedlinename':{'type':Sequelize[_0xa7ee('0x6')]},'accountcode':{'type':Sequelize[_0xa7ee('0x6')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa7ee('0x6')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xa7ee('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0xa7ee('0x6')]},'transcribeStatus':{'type':Sequelize[_0xa7ee('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0xa7ee('0xa')]},'sentiment':{'type':Sequelize[_0xa7ee('0x6')]},'sPositive':{'type':Sequelize[_0xa7ee('0xb')]},'sNegative':{'type':Sequelize[_0xa7ee('0xb')]},'sNeutral':{'type':Sequelize[_0xa7ee('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xa7ee('0xc')],'get':function(){return moment(this[_0xa7ee('0x4')](_0xa7ee('0xd')))[_0xa7ee('0xe')](_0xa7ee('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0xa7ee('0xc')],'get':function(){return moment(this[_0xa7ee('0x4')]('updatedAt'))[_0xa7ee('0xe')](_0xa7ee('0xf'))['toString']();}}}; \ No newline at end of file +var _0x5246=['format','toString','DATE','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','path','exports','VIRTUAL','value','extname','getDataValue','STRING','channel','membername','split','TEXT','NEW','FLOAT','createdAt'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0x5246,0x195));var _0x6524=function(_0x5b34b2,_0xae69b0){_0x5b34b2=_0x5b34b2-0x0;var _0x2fe78b=_0x5246[_0x5b34b2];return _0x2fe78b;};'use strict';var Sequelize=require(_0x6524('0x0'));var moment=require('moment');var path=require(_0x6524('0x1'));module[_0x6524('0x2')]={'format':{'type':Sequelize[_0x6524('0x3')],'get':function(){return this['getDataValue'](_0x6524('0x4'))?path[_0x6524('0x5')](this[_0x6524('0x6')](_0x6524('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x6524('0x7')]},'channel':{'type':Sequelize[_0x6524('0x7')],'set':function(_0x5ee797){if(_0x5ee797){this['setDataValue'](_0x6524('0x8'),_0x5ee797);this['setDataValue'](_0x6524('0x9'),_0x5ee797[_0x6524('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x6524('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6524('0x7')]},'connectedlinenum':{'type':Sequelize[_0x6524('0x7')]},'connectedlinename':{'type':Sequelize[_0x6524('0x7')]},'accountcode':{'type':Sequelize[_0x6524('0x7')]},'context':{'type':Sequelize[_0x6524('0x7')]},'exten':{'type':Sequelize[_0x6524('0x7')]},'value':{'type':Sequelize[_0x6524('0x7')]},'type':{'type':Sequelize[_0x6524('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x6524('0x7')]},'userDisposition':{'type':Sequelize[_0x6524('0x7')]},'location':{'type':Sequelize[_0x6524('0xb')]},'transcribeName':{'type':Sequelize[_0x6524('0x7')]},'transcribeStatus':{'type':Sequelize[_0x6524('0x7')],'defaultValue':_0x6524('0xc')},'fileUri':{'type':Sequelize[_0x6524('0xb')]},'fileText':{'type':Sequelize[_0x6524('0xb')]},'failureReason':{'type':Sequelize[_0x6524('0xb')]},'sentiment':{'type':Sequelize[_0x6524('0x7')]},'sPositive':{'type':Sequelize[_0x6524('0xd')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x6524('0xd')]},'sMixed':{'type':Sequelize[_0x6524('0xd')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6524('0x6')](_0x6524('0xe')))[_0x6524('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x6524('0x10')]();}},'updatedAt':{'type':Sequelize[_0x6524('0x11')],'get':function(){return moment(this[_0x6524('0x6')](_0x6524('0x12')))[_0x6524('0xf')](_0x6524('0x13'))[_0x6524('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 416f816..690c732 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 _0xb121=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','save','destroy','then','name','VoiceRecording','rawAttributes','fieldName','model','map','format','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','download','../../components/encryptor','value','%s.cypher','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','sequelize','MD5','col','token','uniqueid','push','existsSync','ValidationError','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJob','runTranscribe','findOne','transcribe','transcribeRegion','language','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xd6d78b,_0x2a1ff2){var _0xa45a6e=function(_0xf6d04d){while(--_0xf6d04d){_0xd6d78b['push'](_0xd6d78b['shift']());}};_0xa45a6e(++_0x2a1ff2);}(_0xb121,0x81));var _0x1b12=function(_0x1832f1,_0x53e248){_0x1832f1=_0x1832f1-0x0;var _0x34acad=_0xb121[_0x1832f1];return _0x34acad;};'use strict';var pdf=require(_0x1b12('0x0'));var emlformat=require(_0x1b12('0x1'));var rimraf=require(_0x1b12('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b12('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1b12('0x4'));var Mustache=require(_0x1b12('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1b12('0x6'));var csv=require(_0x1b12('0x7'));var ejs=require(_0x1b12('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b12('0x9'));var deskjs=require(_0x1b12('0xa'));var toCsv=require(_0x1b12('0x7'));var querystring=require(_0x1b12('0xb'));var Papa=require(_0x1b12('0xc'));var AWS=require('aws-sdk');var uuidv4=require(_0x1b12('0xd'));var Redis=require('ioredis');var authService=require(_0x1b12('0xe'));var qs=require(_0x1b12('0xf'));var as=require(_0x1b12('0x10'));var hardwareService=require(_0x1b12('0x11'));var logger=require(_0x1b12('0x12'))(_0x1b12('0x13'));var utils=require(_0x1b12('0x14'));var config=require(_0x1b12('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe87cfd,_0x28abb0){_0x28abb0=_0x28abb0||0xcc;return function(_0x2e5edb){if(_0x2e5edb){return _0xe87cfd[_0x1b12('0x16')](_0x28abb0);}return _0xe87cfd[_0x1b12('0x17')](_0x28abb0)[_0x1b12('0x18')]();};}function respondWithResult(_0x4c987,_0x50e243){_0x50e243=_0x50e243||0xc8;return function(_0x20269c){if(_0x20269c){return _0x4c987['status'](_0x50e243)[_0x1b12('0x19')](_0x20269c);}};}function respondWithFilteredResult(_0x508344,_0x3e50bb){return function(_0x48a19c){if(_0x48a19c){var _0x3c2e47=_0x48a19c[_0x1b12('0x1a')],_0x58d01f=_0x3e50bb[_0x1b12('0x1b')],_0xfa82ca=_0x3e50bb[_0x1b12('0x1b')]+_0x3e50bb['limit'],_0x1a6848;if(_0xfa82ca>=_0x3c2e47){_0xfa82ca=_0x3c2e47;_0x1a6848=0xc8;}else{_0x1a6848=0xce;}_0x508344['status'](_0x1a6848);return _0x508344[_0x1b12('0x1c')](_0x1b12('0x1d'),_0x58d01f+'-'+_0xfa82ca+'/'+_0x3c2e47)[_0x1b12('0x19')](_0x48a19c);}return null;};}function patchUpdates(_0x299bc3){return function(_0x1a84df){try{jsonpatch['apply'](_0x1a84df,_0x299bc3,!![]);}catch(_0x1990e9){return BPromise['reject'](_0x1990e9);}return _0x1a84df[_0x1b12('0x1e')]();};}function saveUpdates(_0x5dd493,_0xfd8a4d){return function(_0x4ba6eb){if(_0x4ba6eb){return _0x4ba6eb['update'](_0x5dd493)['then'](function(_0x58cde9){return _0x58cde9;});}return null;};}function removeEntity(_0x4b797e,_0x48bf67){return function(_0x3600bf){if(_0x3600bf){return _0x3600bf[_0x1b12('0x1f')]()[_0x1b12('0x20')](function(){_0x4b797e[_0x1b12('0x17')](0xcc)[_0x1b12('0x18')]();});}};}function handleEntityNotFound(_0xf8c87f,_0x3d45b7){return function(_0x59de5c){if(!_0x59de5c){_0xf8c87f[_0x1b12('0x16')](0x194);}return _0x59de5c;};}function handleError(_0x26d97d,_0x4b7c05){_0x4b7c05=_0x4b7c05||0x1f4;return function(_0x2a3c6b){logger['error'](_0x2a3c6b['stack']);if(_0x2a3c6b['name']){delete _0x2a3c6b[_0x1b12('0x21')];}_0x26d97d[_0x1b12('0x17')](_0x4b7c05)['send'](_0x2a3c6b);};}exports['index']=function(_0x12cd73,_0x1a1d60){var _0x4979a6={},_0x49355e={},_0xd50e40={'count':0x0,'rows':[]};var _0x439bfe=_['map'](db[_0x1b12('0x22')][_0x1b12('0x23')],function(_0x46d6f4){return{'name':_0x46d6f4[_0x1b12('0x24')],'type':_0x46d6f4['type']['key']};});_0x49355e[_0x1b12('0x25')]=_['differenceBy'](_[_0x1b12('0x26')](_0x439bfe,_0x1b12('0x21')),[_0x1b12('0x27')]);_0x49355e[_0x1b12('0x28')]=_[_0x1b12('0x29')](_0x12cd73['query']);_0x49355e[_0x1b12('0x2a')]=_[_0x1b12('0x2b')](_0x49355e[_0x1b12('0x25')],_0x49355e['query']);_0x4979a6[_0x1b12('0x2c')]=_[_0x1b12('0x2b')](_0x49355e[_0x1b12('0x25')],qs['fields'](_0x12cd73[_0x1b12('0x28')][_0x1b12('0x2d')]));_0x4979a6['attributes']=_0x4979a6['attributes'][_0x1b12('0x2e')]?_0x4979a6[_0x1b12('0x2c')]:_0x49355e[_0x1b12('0x25')];if(!_0x12cd73[_0x1b12('0x28')]['hasOwnProperty'](_0x1b12('0x2f'))){_0x4979a6[_0x1b12('0x30')]=qs[_0x1b12('0x30')](_0x12cd73[_0x1b12('0x28')]['limit']);_0x4979a6[_0x1b12('0x1b')]=qs[_0x1b12('0x1b')](_0x12cd73[_0x1b12('0x28')][_0x1b12('0x1b')]);}_0x4979a6[_0x1b12('0x31')]=qs[_0x1b12('0x32')](_0x12cd73[_0x1b12('0x28')][_0x1b12('0x32')]);_0x4979a6[_0x1b12('0x33')]=qs['filters'](_[_0x1b12('0x34')](_0x12cd73[_0x1b12('0x28')],_0x49355e[_0x1b12('0x2a')]),_0x439bfe);if(_0x12cd73[_0x1b12('0x28')][_0x1b12('0x35')]){_0x4979a6['where']=_[_0x1b12('0x36')](_0x4979a6[_0x1b12('0x33')],{'$or':_[_0x1b12('0x26')](_0x439bfe,function(_0x5b4baf){if(_0x5b4baf[_0x1b12('0x37')]!==_0x1b12('0x38')){var _0x2073b8={};_0x2073b8[_0x5b4baf[_0x1b12('0x21')]]={'$like':'%'+_0x12cd73[_0x1b12('0x28')][_0x1b12('0x35')]+'%'};return _0x2073b8;}})});}_0x4979a6=_[_0x1b12('0x36')]({},_0x4979a6,_0x12cd73[_0x1b12('0x39')]);var _0x123e26={'where':_0x4979a6[_0x1b12('0x33')]};return db[_0x1b12('0x22')][_0x1b12('0x1a')](_0x123e26)[_0x1b12('0x20')](function(_0x33b6b0){_0xd50e40[_0x1b12('0x1a')]=_0x33b6b0;if(_0x12cd73[_0x1b12('0x28')][_0x1b12('0x3a')]){_0x4979a6[_0x1b12('0x3b')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1b12('0x3c')](_0x4979a6);})[_0x1b12('0x20')](function(_0x4b3fae){_0xd50e40[_0x1b12('0x3d')]=_0x4b3fae;return _0xd50e40;})[_0x1b12('0x20')](respondWithFilteredResult(_0x1a1d60,_0x4979a6))[_0x1b12('0x3e')](handleError(_0x1a1d60,null));};exports[_0x1b12('0x3f')]=function(_0x58fd0a,_0x24f102){var _0x5efd3d={'raw':![],'where':{'id':_0x58fd0a[_0x1b12('0x40')]['id']}},_0x30a8bf={};_0x30a8bf['model']=_['keys'](db[_0x1b12('0x22')][_0x1b12('0x23')]);_0x30a8bf['query']=_[_0x1b12('0x29')](_0x58fd0a[_0x1b12('0x28')]);_0x30a8bf[_0x1b12('0x2a')]=_[_0x1b12('0x2b')](_0x30a8bf['model'],_0x30a8bf[_0x1b12('0x28')]);_0x5efd3d[_0x1b12('0x2c')]=_[_0x1b12('0x2b')](_0x30a8bf[_0x1b12('0x25')],qs['fields'](_0x58fd0a[_0x1b12('0x28')][_0x1b12('0x2d')]));_0x5efd3d['attributes']=_0x5efd3d['attributes'][_0x1b12('0x2e')]?_0x5efd3d['attributes']:_0x30a8bf['model'];if(_0x58fd0a[_0x1b12('0x28')][_0x1b12('0x3a')]){_0x5efd3d[_0x1b12('0x3b')]=[{'all':!![]}];}_0x5efd3d=_['merge']({},_0x5efd3d,_0x58fd0a[_0x1b12('0x39')]);return db[_0x1b12('0x22')]['find'](_0x5efd3d)[_0x1b12('0x20')](handleEntityNotFound(_0x24f102,null))[_0x1b12('0x20')](respondWithResult(_0x24f102,null))[_0x1b12('0x3e')](handleError(_0x24f102,null));};exports['create']=function(_0x45d76f,_0x4ace43){return db[_0x1b12('0x22')][_0x1b12('0x41')](_0x45d76f[_0x1b12('0x42')],{})[_0x1b12('0x20')](respondWithResult(_0x4ace43,0xc9))[_0x1b12('0x3e')](handleError(_0x4ace43,null));};exports[_0x1b12('0x43')]=function(_0xfe226d,_0x15a3cc){if(_0xfe226d[_0x1b12('0x42')]['id']){delete _0xfe226d['body']['id'];}return db[_0x1b12('0x22')][_0x1b12('0x44')]({'where':{'id':_0xfe226d['params']['id']}})[_0x1b12('0x20')](handleEntityNotFound(_0x15a3cc,null))[_0x1b12('0x20')](saveUpdates(_0xfe226d[_0x1b12('0x42')],null))[_0x1b12('0x20')](respondWithResult(_0x15a3cc,null))[_0x1b12('0x3e')](handleError(_0x15a3cc,null));};exports[_0x1b12('0x45')]=function(_0x391560,_0x1783be){return db['VoiceRecording'][_0x1b12('0x45')]()['then'](respondWithResult(_0x1783be,null))[_0x1b12('0x3e')](handleError(_0x1783be,null));};exports[_0x1b12('0x46')]=function(_0x1d2795,_0x4ad284,_0x1ea3c4){var _0x483dce=require(_0x1b12('0x47'));var _0x4e5a2d=![];var _0x2e7a1a={};if(_0x1d2795[_0x1b12('0x28')]['type']&&_0x1d2795[_0x1b12('0x28')][_0x1b12('0x37')]==='uniqueid'){_0x2e7a1a['uniqueid']=_0x1d2795['params']['id'];}else{_0x2e7a1a['id']=_0x1d2795[_0x1b12('0x40')]['id'];}return db['VoiceRecording'][_0x1b12('0x44')]({'where':_0x2e7a1a,'attributes':['id',_0x1b12('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x4ad284,null))['then'](function(_0x2a0cff){if(_0x2a0cff){var _0xb7b4df=_0x2a0cff['value'];var _0x5977e9=util[_0x1b12('0x27')](_0x1b12('0x49'),_0xb7b4df);if(fs['existsSync'](_0x5977e9)){_0x4e5a2d=!![];return _0x483dce[_0x1b12('0x4a')](_0x5977e9,_0xb7b4df,config[_0x1b12('0x4b')][_0x1b12('0x4c')])['then'](function(){return _0x2a0cff;});}return _0x2a0cff;}})[_0x1b12('0x20')](function(_0x5eceb1){if(_0x5eceb1){var _0x5ea96b=_0x5eceb1[_0x1b12('0x48')];if(!fs['existsSync'](_0x5ea96b)){throw new db[(_0x1b12('0x4d'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x5eceb1[_0x1b12('0x4e')]){return _0x4ad284[_0x1b12('0x46')](_0x5ea96b,_0x5eceb1[_0x1b12('0x4e')]+path[_0x1b12('0x4f')](_0x5ea96b),function(){if(_0x4e5a2d){fs[_0x1b12('0x50')](_0x5ea96b);}});}else{return _0x4ad284[_0x1b12('0x46')](_0x5ea96b,function(_0x588855){if(_0x4e5a2d){fs['unlink'](_0x5ea96b);}});}}})[_0x1b12('0x3e')](function(_0x2f035b){if(_0x2f035b['message']===_0x1b12('0x51')){_0x4ad284[_0x1b12('0x17')](0x194)[_0x1b12('0x52')](_0x1b12('0x53'));}else{return handleError(_0x4ad284,null);}});};exports[_0x1b12('0x54')]=function(_0x32e300,_0x235ca8,_0x189228){var _0x1e09eb=require(_0x1b12('0x47'));var _0x5e109b=![];var _0x2ee7b6={'$and':[db[_0x1b12('0x55')]['where'](db[_0x1b12('0x55')]['fn'](_0x1b12('0x56'),db[_0x1b12('0x55')][_0x1b12('0x57')]('uniqueid')),_0x32e300[_0x1b12('0x28')][_0x1b12('0x58')])]};if(_0x32e300[_0x1b12('0x28')]['type']&&_0x32e300['query']['type']===_0x1b12('0x59')){_0x2ee7b6['$and'][_0x1b12('0x5a')]({'uniqueid':_0x32e300[_0x1b12('0x40')]['id']});}else{_0x2ee7b6['$and'][_0x1b12('0x5a')]({'id':_0x32e300['params']['id']});}return db[_0x1b12('0x22')][_0x1b12('0x44')]({'where':_0x2ee7b6,'attributes':['id','value'],'raw':!![]})[_0x1b12('0x20')](handleEntityNotFound(_0x235ca8,null))[_0x1b12('0x20')](function(_0x331d9b){if(_0x331d9b){var _0x44c64d=util[_0x1b12('0x27')](_0x1b12('0x49'),_0x331d9b[_0x1b12('0x48')]);if(fs['existsSync'](_0x44c64d)){_0x5e109b=!![];return _0x1e09eb[_0x1b12('0x4a')](_0x44c64d,_0x331d9b['value'],config[_0x1b12('0x4b')][_0x1b12('0x4c')])[_0x1b12('0x20')](function(){return _0x331d9b;});}return _0x331d9b;}})[_0x1b12('0x20')](function(_0x2765fa){if(_0x2765fa){if(!fs[_0x1b12('0x5b')](_0x2765fa[_0x1b12('0x48')])){throw new db[(_0x1b12('0x4d'))][(_0x1b12('0x5c'))](_0x1b12('0x51'));}if(_0x2765fa[_0x1b12('0x4e')]){return _0x235ca8['download'](_0x2765fa[_0x1b12('0x48')],_0x2765fa[_0x1b12('0x4e')]+path[_0x1b12('0x4f')](_0x2765fa['value']),function(){if(_0x5e109b){fs['unlink'](_0x2765fa['value']);}});}else{return _0x235ca8[_0x1b12('0x46')](_0x2765fa[_0x1b12('0x48')],function(_0x2a19f3){if(_0x5e109b){fs[_0x1b12('0x50')](_0x2765fa[_0x1b12('0x48')]);}});}}})[_0x1b12('0x3e')](handleError(_0x235ca8,null));};exports['destroy']=function(_0x1e42f1,_0x2ff519){return db[_0x1b12('0x22')]['find']({'where':{'id':_0x1e42f1[_0x1b12('0x40')]['id']}})[_0x1b12('0x20')](function(_0x57ec10){if(!_0x57ec10)throw new ReferenceError(_0x1b12('0x5d'));return _0x57ec10;})['then'](function(_0x42713c){var _0x4db1f4=_0x42713c[_0x1b12('0x48')];logger[_0x1b12('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x4db1f4);if(!_[_0x1b12('0x5f')](_0x42713c['value'])&&fs[_0x1b12('0x5b')](_0x4db1f4)){logger[_0x1b12('0x5e')](_0x1b12('0x60')+_0x4db1f4+_0x1b12('0x61'));fs[_0x1b12('0x62')](_0x4db1f4);}_0x4db1f4=_0x4db1f4+'.cypher';if(!_[_0x1b12('0x5f')](_0x42713c[_0x1b12('0x48')])&&fs[_0x1b12('0x5b')](_0x4db1f4)){logger['info'](_0x1b12('0x60')+_0x4db1f4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1b12('0x62')](_0x4db1f4);}return _0x42713c;})['then'](function(_0x4df541){if(!_0x4df541)throw new InternalError();return _0x4df541[_0x1b12('0x1f')]();})['then'](function(){_0x2ff519['status'](0xcc)[_0x1b12('0x18')]();})['catch'](handleError(_0x2ff519,null));};function getBucketslist(_0x354ae2,_0x216760,_0x5b21bf){return new Promise(function(_0x3e8eb8,_0x174339){var _0x5a5e6e=new AWS['S3']({'accessKeyId':_0x216760,'secretAccessKey':_0x354ae2,'region':_0x5b21bf});_0x5a5e6e[_0x1b12('0x63')]({},function(_0x3d83f0,_0x3007e4){if(_0x3d83f0){return _0x174339(_0x3d83f0);}else{return _0x3e8eb8(_0x3007e4);}});});}function createBucket(_0x4089eb,_0x36a8bb,_0x46c6ef,_0x5162b4){return new Promise(function(_0x323f85,_0x45e8c4){var _0x253122=new AWS['S3']({'accessKeyId':_0x36a8bb,'secretAccessKey':_0x4089eb,'region':_0x46c6ef});_0x253122[_0x1b12('0x64')]({'Bucket':_0x5162b4},function(_0x248443,_0x279ad5){if(_0x248443){return _0x45e8c4(_0x248443);}else{return _0x323f85(_0x279ad5);}});});}function uploadFile(_0x45eaa7,_0x2ca934,_0x4ba6dc,_0x35b057,_0xdebbb2,_0x5b62ad){return new Promise(function(_0x35b22e,_0x251eea){var _0x2c7f48=new AWS['S3']({'accessKeyId':_0x2ca934,'secretAccessKey':_0x45eaa7,'region':_0x4ba6dc});_0x2c7f48[_0x1b12('0x65')]({'Bucket':_0x35b057,'Key':_0xdebbb2,'Body':_0x5b62ad},function(_0x20a01a,_0xd4d053){if(_0x20a01a){return _0x251eea(_0x20a01a);}else{return _0x35b22e(_0xd4d053);}});});}function startTranscribe(_0x21e9ca,_0x41cc73,_0x585d49,_0x4c1f66,_0x452695,_0x1a5ead){return new Promise(function(_0x1d245d,_0x1306cb){var _0x284967=new AWS[(_0x1b12('0x66'))]({'accessKeyId':_0x41cc73,'secretAccessKey':_0x21e9ca,'region':_0x585d49});_0x284967[_0x1b12('0x67')]({'TranscriptionJobName':_0x4c1f66,'LanguageCode':_0x452695,'Media':{'MediaFileUri':_0x1a5ead}},function(_0x106f73,_0x1de7b7){if(_0x106f73){return _0x1306cb(_0x106f73);}else{return _0x1d245d(_0x1de7b7);}});});}function transcribe(_0x268003,_0xe5fe08,_0x3e1999,_0x1c09cf,_0x9f472f,_0x5635bc,_0x5a617e){return new Promise(function(_0x5c736e,_0x2d74e1){var _0x293042={};logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x68'),_0x268003,_0x9f472f));return uploadFile(_0xe5fe08,_0x3e1999,_0x1c09cf,_0x9f472f,path[_0x1b12('0x69')](_0x5635bc),fs[_0x1b12('0x6a')](_0x5635bc))[_0x1b12('0x20')](function(_0x5f974c){logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x6b'),_0x268003,_0x9f472f,_0x5f974c['Location']));_0x293042[_0x1b12('0x6c')]=_0x5f974c[_0x1b12('0x6d')];_0x293042[_0x1b12('0x6e')]=_0x5f974c[_0x1b12('0x6f')];logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x70'),_0x268003));return startTranscribe(_0xe5fe08,_0x3e1999,_0x1c09cf,uuidv4(),_0x5a617e,_0x5f974c[_0x1b12('0x6f')]);})[_0x1b12('0x20')](function(_0x257f3d){logger['info'](util[_0x1b12('0x27')](_0x1b12('0x71'),_0x268003,_0x257f3d['TranscriptionJob']['TranscriptionJobName']));_0x293042[_0x1b12('0x72')]=_0x257f3d['TranscriptionJob'][_0x1b12('0x73')];_0x293042[_0x1b12('0x74')]=_0x257f3d[_0x1b12('0x75')]['TranscriptionJobStatus'];return _0x5c736e(_0x293042);})[_0x1b12('0x3e')](function(_0x43678e){return _0x2d74e1(_0x43678e);});});}exports[_0x1b12('0x76')]=function(_0x4b99d8,_0x1c951f,_0x3a6ccb){var _0x28af43;var _0x52cce8;var _0x15e8d9;var _0x3b9679=require('../../components/encryptor');return db[_0x1b12('0x22')][_0x1b12('0x77')]({'where':{'id':_0x4b99d8[_0x1b12('0x40')]['id']}})[_0x1b12('0x20')](function(_0x3f0419){if(_0x3f0419){var _0x13fe99=util['format'](_0x1b12('0x49'),_0x3f0419[_0x1b12('0x48')]);if(fs[_0x1b12('0x5b')](_0x13fe99)){cypher=!![];return _0x3b9679[_0x1b12('0x4a')](_0x13fe99,_0x3f0419[_0x1b12('0x48')],config[_0x1b12('0x4b')][_0x1b12('0x4c')])[_0x1b12('0x20')](function(){return _0x3f0419;});}return _0x3f0419;}})[_0x1b12('0x20')](function(_0x7bcd20){if(!_0x7bcd20){throw new db[(_0x1b12('0x4d'))][(_0x1b12('0x5c'))]('Voice\x20Recording\x20not\x20found');}_0x52cce8=_0x7bcd20;return db['Setting'][_0x1b12('0x77')]({'where':{'id':0x1}});})[_0x1b12('0x20')](handleEntityNotFound(_0x1c951f,null))[_0x1b12('0x20')](function(_0x22b378){if(_0x22b378){_0x28af43=_0x22b378;if(!_0x28af43[_0x1b12('0x78')]||!_0x28af43['transcribeAccountId']||!_0x28af43[_0x1b12('0x79')]||!_0x28af43[_0x1b12('0x7a')]||!_0x28af43[_0x1b12('0x6c')]){throw new db[(_0x1b12('0x4d'))][(_0x1b12('0x5c'))]('Transcribe\x20not\x20configured');}if(_0x4b99d8['body']['runSentiment']&&(!_0x28af43[_0x1b12('0x7b')]||!_0x28af43[_0x1b12('0x7c')]||!_0x28af43[_0x1b12('0x7d')]||!_0x28af43['language']||!_0x28af43[_0x1b12('0x6c')])){throw new db[(_0x1b12('0x4d'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x1b12('0x7e')]['findOne']({'where':{'id':_0x28af43['transcribeAccountId']}});}})[_0x1b12('0x20')](function(_0x5d2b38){if(!_0x5d2b38){throw new db[(_0x1b12('0x4d'))]['ValidationError'](_0x1b12('0x7f'));}if(!_0x5d2b38['data1']||!_0x5d2b38[_0x1b12('0x80')]){throw new db[(_0x1b12('0x4d'))]['ValidationError'](_0x1b12('0x81'));}_0x15e8d9=_0x5d2b38;return getBucketslist(_0x15e8d9['data1'],_0x15e8d9['data2'],_0x28af43['transcribeRegion']);})['then'](function(_0x2182ce){if(_0x2182ce&&_0x2182ce['Buckets']){var _0x52608a=_[_0x1b12('0x44')](_0x2182ce[_0x1b12('0x82')],function(_0x3f0f23){return _0x3f0f23[_0x1b12('0x83')]===_0x28af43[_0x1b12('0x6c')];});if(!_0x52608a){logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x84'),_0x4b99d8[_0x1b12('0x40')]['id'],_0x28af43[_0x1b12('0x6c')]));return createBucket(_0x15e8d9[_0x1b12('0x85')],_0x15e8d9['data2'],_0x28af43['transcribeRegion'],_0x28af43[_0x1b12('0x6c')]);}logger['info'](util[_0x1b12('0x27')](_0x1b12('0x86'),_0x4b99d8[_0x1b12('0x40')]['id'],_0x28af43['bucket']));return;}})[_0x1b12('0x20')](function(_0x3e0165){if(_0x52cce8['transcribeStatus']===_0x1b12('0x87')){return transcribe(_0x4b99d8[_0x1b12('0x40')]['id'],_0x15e8d9[_0x1b12('0x85')],_0x15e8d9[_0x1b12('0x80')],_0x28af43['transcribeRegion'],_0x28af43['bucket'],_0x52cce8[_0x1b12('0x48')],_0x28af43[_0x1b12('0x7a')]);}else{logger[_0x1b12('0x5e')](util[_0x1b12('0x27')](_0x1b12('0x88'),_0x4b99d8[_0x1b12('0x40')]['id']));return{'transcribeStatus':_0x1b12('0x89')};}})[_0x1b12('0x20')](function(_0x5675a9){if(_0x5675a9){_0x5675a9[_0x1b12('0x8a')]=_0x4b99d8['body']['runSentiment'];return _0x52cce8['updateAttributes'](_0x5675a9);}})['then'](respondWithResult(_0x1c951f,null))[_0x1b12('0x3e')](handleError(_0x1c951f,null));};function writeFile(_0x409851,_0x49444a){return new Promise(function(_0x20341d,_0x33d9fa){fs[_0x1b12('0x8b')](_0x49444a,_0x409851,function(_0x31da22,_0x515f2b){if(_0x31da22){return _0x33d9fa(_0x31da22);}else{return _0x20341d(_0x515f2b);}});});}exports[_0x1b12('0x8c')]=function(_0x2afbd4,_0x2e67d2,_0x4ce96d){return db[_0x1b12('0x22')][_0x1b12('0x77')]({'where':{'id':_0x2afbd4['params']['id']}})[_0x1b12('0x20')](handleEntityNotFound(_0x2e67d2))[_0x1b12('0x20')](function(_0x293b1a){if(_0x293b1a&&_0x293b1a[_0x1b12('0x8d')]){var _0x152849=_0x293b1a['fileText'];var _0x27d189=config[_0x1b12('0x8e')]+_0x1b12('0x8f')+_0x293b1a['id']+_0x1b12('0x90');if(fs[_0x1b12('0x5b')](_0x27d189)){return _0x27d189;}return writeFile(_0x152849,_0x27d189)['then'](function(){return _0x27d189;});}else{throw new db['Sequelize'][(_0x1b12('0x5c'))](_0x1b12('0x91'));}})[_0x1b12('0x20')](function(_0x57fe5b){return _0x2e67d2['download'](_0x57fe5b);})[_0x1b12('0x3e')](handleError(_0x2e67d2));}; \ No newline at end of file +var _0xbd0d=['squel','crypto','jsforce','desk.js','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','keys','filters','intersection','model','query','attributes','fields','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','sequelize','MD5','token','$and','push','format','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','end','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','data2','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x353a5e,_0x5c261d){var _0x1320b4=function(_0x21ec21){while(--_0x21ec21){_0x353a5e['push'](_0x353a5e['shift']());}};_0x1320b4(++_0x5c261d);}(_0xbd0d,0x126));var _0xdbd0=function(_0x69d003,_0x391e32){_0x69d003=_0x69d003-0x0;var _0x55aec7=_0xbd0d[_0x69d003];return _0x55aec7;};'use strict';var pdf=require(_0xdbd0('0x0'));var emlformat=require(_0xdbd0('0x1'));var rimraf=require(_0xdbd0('0x2'));var zipdir=require(_0xdbd0('0x3'));var jsonpatch=require(_0xdbd0('0x4'));var rp=require(_0xdbd0('0x5'));var moment=require(_0xdbd0('0x6'));var BPromise=require(_0xdbd0('0x7'));var Mustache=require(_0xdbd0('0x8'));var util=require(_0xdbd0('0x9'));var path=require(_0xdbd0('0xa'));var sox=require('sox');var csv=require(_0xdbd0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdbd0('0xc'));var crypto=require(_0xdbd0('0xd'));var jsforce=require(_0xdbd0('0xe'));var deskjs=require(_0xdbd0('0xf'));var toCsv=require(_0xdbd0('0xb'));var querystring=require('querystring');var Papa=require(_0xdbd0('0x10'));var AWS=require(_0xdbd0('0x11'));var uuidv4=require('uuid/v4');var Redis=require(_0xdbd0('0x12'));var authService=require(_0xdbd0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdbd0('0x14'));var hardwareService=require(_0xdbd0('0x15'));var logger=require('../../config/logger')(_0xdbd0('0x16'));var utils=require('../../config/utils');var config=require(_0xdbd0('0x17'));var db=require(_0xdbd0('0x18'))['db'];function respondWithStatusCode(_0x21e7b0,_0x5363ef){_0x5363ef=_0x5363ef||0xcc;return function(_0x3ac55d){if(_0x3ac55d){return _0x21e7b0[_0xdbd0('0x19')](_0x5363ef);}return _0x21e7b0[_0xdbd0('0x1a')](_0x5363ef)['end']();};}function respondWithResult(_0x79b743,_0x4e3fa6){_0x4e3fa6=_0x4e3fa6||0xc8;return function(_0x3884ea){if(_0x3884ea){return _0x79b743[_0xdbd0('0x1a')](_0x4e3fa6)['json'](_0x3884ea);}};}function respondWithFilteredResult(_0x582ecb,_0x4babdd){return function(_0x550124){if(_0x550124){var _0xc83858=_0x550124[_0xdbd0('0x1b')],_0x2a9af1=_0x4babdd[_0xdbd0('0x1c')],_0x16bb4c=_0x4babdd[_0xdbd0('0x1c')]+_0x4babdd[_0xdbd0('0x1d')],_0x5779ed;if(_0x16bb4c>=_0xc83858){_0x16bb4c=_0xc83858;_0x5779ed=0xc8;}else{_0x5779ed=0xce;}_0x582ecb[_0xdbd0('0x1a')](_0x5779ed);return _0x582ecb[_0xdbd0('0x1e')](_0xdbd0('0x1f'),_0x2a9af1+'-'+_0x16bb4c+'/'+_0xc83858)[_0xdbd0('0x20')](_0x550124);}return null;};}function patchUpdates(_0x59e2e7){return function(_0x401901){try{jsonpatch[_0xdbd0('0x21')](_0x401901,_0x59e2e7,!![]);}catch(_0x72b57c){return BPromise[_0xdbd0('0x22')](_0x72b57c);}return _0x401901[_0xdbd0('0x23')]();};}function saveUpdates(_0x2bf5d7,_0x4c4110){return function(_0x4aecd7){if(_0x4aecd7){return _0x4aecd7[_0xdbd0('0x24')](_0x2bf5d7)[_0xdbd0('0x25')](function(_0x4571a5){return _0x4571a5;});}return null;};}function removeEntity(_0x3e317f,_0x5bf008){return function(_0x4e4328){if(_0x4e4328){return _0x4e4328[_0xdbd0('0x26')]()[_0xdbd0('0x25')](function(){_0x3e317f[_0xdbd0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a815,_0x1a42ce){return function(_0x2c8e94){if(!_0x2c8e94){_0x47a815[_0xdbd0('0x19')](0x194);}return _0x2c8e94;};}function handleError(_0x1d14c5,_0x2318c){_0x2318c=_0x2318c||0x1f4;return function(_0x589673){logger[_0xdbd0('0x27')](_0x589673[_0xdbd0('0x28')]);if(_0x589673[_0xdbd0('0x29')]){delete _0x589673[_0xdbd0('0x29')];}_0x1d14c5['status'](_0x2318c)[_0xdbd0('0x2a')](_0x589673);};}exports['index']=function(_0x2190c3,_0x384e65){var _0x24e6dc={},_0x345c3f={},_0x340e06={'count':0x0,'rows':[]};var _0x19a767=_[_0xdbd0('0x2b')](db[_0xdbd0('0x2c')][_0xdbd0('0x2d')],function(_0x3a4998){return{'name':_0x3a4998[_0xdbd0('0x2e')],'type':_0x3a4998[_0xdbd0('0x2f')][_0xdbd0('0x30')]};});_0x345c3f['model']=_[_0xdbd0('0x31')](_[_0xdbd0('0x2b')](_0x19a767,_0xdbd0('0x29')),['format']);_0x345c3f['query']=_[_0xdbd0('0x32')](_0x2190c3['query']);_0x345c3f[_0xdbd0('0x33')]=_[_0xdbd0('0x34')](_0x345c3f[_0xdbd0('0x35')],_0x345c3f[_0xdbd0('0x36')]);_0x24e6dc[_0xdbd0('0x37')]=_[_0xdbd0('0x34')](_0x345c3f['model'],qs[_0xdbd0('0x38')](_0x2190c3[_0xdbd0('0x36')]['fields']));_0x24e6dc[_0xdbd0('0x37')]=_0x24e6dc[_0xdbd0('0x37')]['length']?_0x24e6dc[_0xdbd0('0x37')]:_0x345c3f[_0xdbd0('0x35')];if(!_0x2190c3[_0xdbd0('0x36')]['hasOwnProperty']('nolimit')){_0x24e6dc[_0xdbd0('0x1d')]=qs[_0xdbd0('0x1d')](_0x2190c3[_0xdbd0('0x36')][_0xdbd0('0x1d')]);_0x24e6dc[_0xdbd0('0x1c')]=qs[_0xdbd0('0x1c')](_0x2190c3[_0xdbd0('0x36')][_0xdbd0('0x1c')]);}_0x24e6dc[_0xdbd0('0x39')]=qs[_0xdbd0('0x3a')](_0x2190c3[_0xdbd0('0x36')][_0xdbd0('0x3a')]);_0x24e6dc[_0xdbd0('0x3b')]=qs['filters'](_['pick'](_0x2190c3[_0xdbd0('0x36')],_0x345c3f['filters']),_0x19a767);if(_0x2190c3['query'][_0xdbd0('0x3c')]){_0x24e6dc[_0xdbd0('0x3b')]=_['merge'](_0x24e6dc['where'],{'$or':_[_0xdbd0('0x2b')](_0x19a767,function(_0x37cbb9){if(_0x37cbb9[_0xdbd0('0x2f')]!==_0xdbd0('0x3d')){var _0x58ba05={};_0x58ba05[_0x37cbb9['name']]={'$like':'%'+_0x2190c3['query'][_0xdbd0('0x3c')]+'%'};return _0x58ba05;}})});}_0x24e6dc=_['merge']({},_0x24e6dc,_0x2190c3[_0xdbd0('0x3e')]);var _0x2f78b5={'where':_0x24e6dc[_0xdbd0('0x3b')]};return db['VoiceRecording'][_0xdbd0('0x1b')](_0x2f78b5)[_0xdbd0('0x25')](function(_0x27f6ae){_0x340e06['count']=_0x27f6ae;if(_0x2190c3[_0xdbd0('0x36')][_0xdbd0('0x3f')]){_0x24e6dc[_0xdbd0('0x40')]=[{'all':!![]}];}return db[_0xdbd0('0x2c')][_0xdbd0('0x41')](_0x24e6dc);})[_0xdbd0('0x25')](function(_0x290c1a){_0x340e06[_0xdbd0('0x42')]=_0x290c1a;return _0x340e06;})[_0xdbd0('0x25')](respondWithFilteredResult(_0x384e65,_0x24e6dc))[_0xdbd0('0x43')](handleError(_0x384e65,null));};exports[_0xdbd0('0x44')]=function(_0x3fd4d5,_0x585cb4){var _0x2d2992={'raw':![],'where':{'id':_0x3fd4d5['params']['id']}},_0x142203={};_0x142203[_0xdbd0('0x35')]=_[_0xdbd0('0x32')](db[_0xdbd0('0x2c')][_0xdbd0('0x2d')]);_0x142203['query']=_[_0xdbd0('0x32')](_0x3fd4d5['query']);_0x142203[_0xdbd0('0x33')]=_[_0xdbd0('0x34')](_0x142203[_0xdbd0('0x35')],_0x142203[_0xdbd0('0x36')]);_0x2d2992['attributes']=_[_0xdbd0('0x34')](_0x142203[_0xdbd0('0x35')],qs[_0xdbd0('0x38')](_0x3fd4d5['query'][_0xdbd0('0x38')]));_0x2d2992[_0xdbd0('0x37')]=_0x2d2992['attributes'][_0xdbd0('0x45')]?_0x2d2992[_0xdbd0('0x37')]:_0x142203[_0xdbd0('0x35')];if(_0x3fd4d5[_0xdbd0('0x36')][_0xdbd0('0x3f')]){_0x2d2992[_0xdbd0('0x40')]=[{'all':!![]}];}_0x2d2992=_[_0xdbd0('0x46')]({},_0x2d2992,_0x3fd4d5[_0xdbd0('0x3e')]);return db[_0xdbd0('0x2c')][_0xdbd0('0x47')](_0x2d2992)[_0xdbd0('0x25')](handleEntityNotFound(_0x585cb4,null))[_0xdbd0('0x25')](respondWithResult(_0x585cb4,null))[_0xdbd0('0x43')](handleError(_0x585cb4,null));};exports[_0xdbd0('0x48')]=function(_0x56f570,_0x5e31d2){return db[_0xdbd0('0x2c')][_0xdbd0('0x48')](_0x56f570['body'],{})['then'](respondWithResult(_0x5e31d2,0xc9))[_0xdbd0('0x43')](handleError(_0x5e31d2,null));};exports[_0xdbd0('0x24')]=function(_0x481e93,_0x53bc4d){if(_0x481e93['body']['id']){delete _0x481e93[_0xdbd0('0x49')]['id'];}return db[_0xdbd0('0x2c')][_0xdbd0('0x47')]({'where':{'id':_0x481e93[_0xdbd0('0x4a')]['id']}})[_0xdbd0('0x25')](handleEntityNotFound(_0x53bc4d,null))[_0xdbd0('0x25')](saveUpdates(_0x481e93[_0xdbd0('0x49')],null))[_0xdbd0('0x25')](respondWithResult(_0x53bc4d,null))[_0xdbd0('0x43')](handleError(_0x53bc4d,null));};exports[_0xdbd0('0x4b')]=function(_0x6ee86d,_0x795905){return db[_0xdbd0('0x2c')][_0xdbd0('0x4b')]()[_0xdbd0('0x25')](respondWithResult(_0x795905,null))[_0xdbd0('0x43')](handleError(_0x795905,null));};exports[_0xdbd0('0x4c')]=function(_0x444299,_0x3663c5,_0x7c490c){var _0x3c8980=require(_0xdbd0('0x4d'));var _0x2f87e0=![];var _0x241bdc={};if(_0x444299[_0xdbd0('0x36')][_0xdbd0('0x2f')]&&_0x444299['query'][_0xdbd0('0x2f')]===_0xdbd0('0x4e')){_0x241bdc[_0xdbd0('0x4e')]=_0x444299[_0xdbd0('0x4a')]['id'];}else{_0x241bdc['id']=_0x444299[_0xdbd0('0x4a')]['id'];}return db[_0xdbd0('0x2c')][_0xdbd0('0x47')]({'where':_0x241bdc,'attributes':['id',_0xdbd0('0x4f')],'raw':!![]})[_0xdbd0('0x25')](handleEntityNotFound(_0x3663c5,null))[_0xdbd0('0x25')](function(_0x17eef6){if(_0x17eef6){var _0x53c69c=_0x17eef6[_0xdbd0('0x4f')];var _0x29eee9=util['format'](_0xdbd0('0x50'),_0x53c69c);if(fs[_0xdbd0('0x51')](_0x29eee9)){_0x2f87e0=!![];return _0x3c8980[_0xdbd0('0x52')](_0x29eee9,_0x53c69c,config[_0xdbd0('0x53')][_0xdbd0('0x54')])[_0xdbd0('0x25')](function(){return _0x17eef6;});}return _0x17eef6;}})[_0xdbd0('0x25')](function(_0x5d4f4d){if(_0x5d4f4d){var _0x1573a2=_0x5d4f4d[_0xdbd0('0x4f')];if(!fs['existsSync'](_0x1573a2)){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))](_0xdbd0('0x57'));}if(_0x5d4f4d[_0xdbd0('0x58')]){return _0x3663c5[_0xdbd0('0x4c')](_0x1573a2,_0x5d4f4d[_0xdbd0('0x58')]+path[_0xdbd0('0x59')](_0x1573a2),function(){if(_0x2f87e0){fs[_0xdbd0('0x5a')](_0x1573a2);}});}else{return _0x3663c5['download'](_0x1573a2,function(_0x4b7850){if(_0x2f87e0){fs['unlink'](_0x1573a2);}});}}})['catch'](function(_0x4e45c4){if(_0x4e45c4['message']==='VoiceRecording\x20not\x20found'){_0x3663c5['status'](0x194)['send'](_0xdbd0('0x5b'));}else{return handleError(_0x3663c5,null);}});};exports['downloads']=function(_0x5920a8,_0x568258,_0x50b4b4){var _0x35e7fe=require(_0xdbd0('0x4d'));var _0x512552=![];var _0xa8cb39={'$and':[db['sequelize'][_0xdbd0('0x3b')](db[_0xdbd0('0x5c')]['fn'](_0xdbd0('0x5d'),db[_0xdbd0('0x5c')]['col']('uniqueid')),_0x5920a8[_0xdbd0('0x36')][_0xdbd0('0x5e')])]};if(_0x5920a8[_0xdbd0('0x36')]['type']&&_0x5920a8['query'][_0xdbd0('0x2f')]==='uniqueid'){_0xa8cb39[_0xdbd0('0x5f')][_0xdbd0('0x60')]({'uniqueid':_0x5920a8[_0xdbd0('0x4a')]['id']});}else{_0xa8cb39[_0xdbd0('0x5f')][_0xdbd0('0x60')]({'id':_0x5920a8[_0xdbd0('0x4a')]['id']});}return db['VoiceRecording'][_0xdbd0('0x47')]({'where':_0xa8cb39,'attributes':['id',_0xdbd0('0x4f')],'raw':!![]})[_0xdbd0('0x25')](handleEntityNotFound(_0x568258,null))[_0xdbd0('0x25')](function(_0x3edb1b){if(_0x3edb1b){var _0x14d16e=util[_0xdbd0('0x61')](_0xdbd0('0x50'),_0x3edb1b['value']);if(fs['existsSync'](_0x14d16e)){_0x512552=!![];return _0x35e7fe[_0xdbd0('0x52')](_0x14d16e,_0x3edb1b['value'],config['secrets'][_0xdbd0('0x54')])['then'](function(){return _0x3edb1b;});}return _0x3edb1b;}})[_0xdbd0('0x25')](function(_0x5ccf74){if(_0x5ccf74){if(!fs[_0xdbd0('0x51')](_0x5ccf74[_0xdbd0('0x4f')])){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))](_0xdbd0('0x57'));}if(_0x5ccf74[_0xdbd0('0x58')]){return _0x568258[_0xdbd0('0x4c')](_0x5ccf74[_0xdbd0('0x4f')],_0x5ccf74[_0xdbd0('0x58')]+path['extname'](_0x5ccf74[_0xdbd0('0x4f')]),function(){if(_0x512552){fs[_0xdbd0('0x5a')](_0x5ccf74[_0xdbd0('0x4f')]);}});}else{return _0x568258[_0xdbd0('0x4c')](_0x5ccf74['value'],function(_0x2f7952){if(_0x512552){fs['unlink'](_0x5ccf74[_0xdbd0('0x4f')]);}});}}})[_0xdbd0('0x43')](handleError(_0x568258,null));};exports[_0xdbd0('0x26')]=function(_0x549e68,_0xa2a7){return db['VoiceRecording'][_0xdbd0('0x47')]({'where':{'id':_0x549e68[_0xdbd0('0x4a')]['id']}})['then'](function(_0x79d5fe){if(!_0x79d5fe)throw new ReferenceError(_0xdbd0('0x62'));return _0x79d5fe;})['then'](function(_0x2484ff){var _0x50e169=_0x2484ff['value'];logger[_0xdbd0('0x63')](_0xdbd0('0x64'),_0x50e169);if(!_[_0xdbd0('0x65')](_0x2484ff[_0xdbd0('0x4f')])&&fs[_0xdbd0('0x51')](_0x50e169)){logger['info'](_0xdbd0('0x66')+_0x50e169+_0xdbd0('0x67'));fs['unlinkSync'](_0x50e169);}_0x50e169=_0x50e169+_0xdbd0('0x68');if(!_[_0xdbd0('0x65')](_0x2484ff[_0xdbd0('0x4f')])&&fs[_0xdbd0('0x51')](_0x50e169)){logger['info'](_0xdbd0('0x66')+_0x50e169+_0xdbd0('0x67'));fs[_0xdbd0('0x69')](_0x50e169);}return _0x2484ff;})[_0xdbd0('0x25')](function(_0x5c280e){if(!_0x5c280e)throw new InternalError();return _0x5c280e[_0xdbd0('0x26')]();})[_0xdbd0('0x25')](function(){_0xa2a7[_0xdbd0('0x1a')](0xcc)[_0xdbd0('0x6a')]();})['catch'](handleError(_0xa2a7,null));};function getBucketslist(_0x3c7d39,_0x2a8390,_0xddcc33){return new Promise(function(_0x48fc23,_0x5f2ff7){var _0x258fa1=new AWS['S3']({'accessKeyId':_0x2a8390,'secretAccessKey':_0x3c7d39,'region':_0xddcc33});_0x258fa1[_0xdbd0('0x6b')]({},function(_0x3f48aa,_0x375ee9){if(_0x3f48aa){return _0x5f2ff7(_0x3f48aa);}else{return _0x48fc23(_0x375ee9);}});});}function createBucket(_0x5c94c4,_0x10a4c8,_0x1681b3,_0x357273){return new Promise(function(_0x5500dc,_0x17b998){var _0x3c908d=new AWS['S3']({'accessKeyId':_0x10a4c8,'secretAccessKey':_0x5c94c4,'region':_0x1681b3});_0x3c908d[_0xdbd0('0x6c')]({'Bucket':_0x357273},function(_0x19bbec,_0x1a7f3c){if(_0x19bbec){return _0x17b998(_0x19bbec);}else{return _0x5500dc(_0x1a7f3c);}});});}function uploadFile(_0x1e3997,_0x6bd6f2,_0x223842,_0x52b64e,_0x18ab0f,_0x3d0d79){return new Promise(function(_0xcac2f4,_0x5738c7){var _0x39c725=new AWS['S3']({'accessKeyId':_0x6bd6f2,'secretAccessKey':_0x1e3997,'region':_0x223842});_0x39c725[_0xdbd0('0x6d')]({'Bucket':_0x52b64e,'Key':_0x18ab0f,'Body':_0x3d0d79},function(_0x2f14b8,_0xe9dcf3){if(_0x2f14b8){return _0x5738c7(_0x2f14b8);}else{return _0xcac2f4(_0xe9dcf3);}});});}function startTranscribe(_0x3c3732,_0x2722ab,_0x3c49d8,_0x30a3e5,_0x132735,_0x299a00){return new Promise(function(_0x9f2d9d,_0x2577e6){var _0x277b2e=new AWS[(_0xdbd0('0x6e'))]({'accessKeyId':_0x2722ab,'secretAccessKey':_0x3c3732,'region':_0x3c49d8});_0x277b2e['startTranscriptionJob']({'TranscriptionJobName':_0x30a3e5,'LanguageCode':_0x132735,'Media':{'MediaFileUri':_0x299a00}},function(_0x4ab82f,_0x3c6e76){if(_0x4ab82f){return _0x2577e6(_0x4ab82f);}else{return _0x9f2d9d(_0x3c6e76);}});});}function transcribe(_0x2a21e4,_0xff1633,_0x40d45b,_0x30f602,_0x4ff8f9,_0x194dd4,_0x3010ec){return new Promise(function(_0xa9b261,_0x3ca69d){var _0x2984ff={};logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')](_0xdbd0('0x6f'),_0x2a21e4,_0x4ff8f9));return uploadFile(_0xff1633,_0x40d45b,_0x30f602,_0x4ff8f9,path[_0xdbd0('0x70')](_0x194dd4),fs[_0xdbd0('0x71')](_0x194dd4))[_0xdbd0('0x25')](function(_0x42a47b){logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x2a21e4,_0x4ff8f9,_0x42a47b[_0xdbd0('0x72')]));_0x2984ff['bucket']=_0x42a47b[_0xdbd0('0x73')];_0x2984ff[_0xdbd0('0x74')]=_0x42a47b[_0xdbd0('0x72')];logger[_0xdbd0('0x63')](util['format'](_0xdbd0('0x75'),_0x2a21e4));return startTranscribe(_0xff1633,_0x40d45b,_0x30f602,uuidv4(),_0x3010ec,_0x42a47b['Location']);})[_0xdbd0('0x25')](function(_0x46a073){logger['info'](util[_0xdbd0('0x61')](_0xdbd0('0x76'),_0x2a21e4,_0x46a073[_0xdbd0('0x77')][_0xdbd0('0x78')]));_0x2984ff[_0xdbd0('0x79')]=_0x46a073[_0xdbd0('0x77')][_0xdbd0('0x78')];_0x2984ff[_0xdbd0('0x7a')]=_0x46a073[_0xdbd0('0x77')][_0xdbd0('0x7b')];return _0xa9b261(_0x2984ff);})[_0xdbd0('0x43')](function(_0x51c64e){return _0x3ca69d(_0x51c64e);});});}exports['runTranscribe']=function(_0x45fc57,_0x501149,_0x5a7318){var _0x27d848;var _0x4fbeae;var _0x50b9cf;var _0x2731aa=require('../../components/encryptor');return db[_0xdbd0('0x2c')][_0xdbd0('0x7c')]({'where':{'id':_0x45fc57[_0xdbd0('0x4a')]['id']}})['then'](function(_0x62ee78){if(_0x62ee78){var _0x41032e=util[_0xdbd0('0x61')](_0xdbd0('0x50'),_0x62ee78[_0xdbd0('0x4f')]);if(fs['existsSync'](_0x41032e)){cypher=!![];return _0x2731aa[_0xdbd0('0x52')](_0x41032e,_0x62ee78[_0xdbd0('0x4f')],config[_0xdbd0('0x53')]['recording'])['then'](function(){return _0x62ee78;});}return _0x62ee78;}})[_0xdbd0('0x25')](function(_0x36d26f){if(!_0x36d26f){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))](_0xdbd0('0x7d'));}_0x4fbeae=_0x36d26f;return db[_0xdbd0('0x7e')][_0xdbd0('0x7c')]({'where':{'id':0x1}});})[_0xdbd0('0x25')](handleEntityNotFound(_0x501149,null))[_0xdbd0('0x25')](function(_0x332189){if(_0x332189){_0x27d848=_0x332189;if(!_0x27d848[_0xdbd0('0x7f')]||!_0x27d848[_0xdbd0('0x80')]||!_0x27d848[_0xdbd0('0x81')]||!_0x27d848[_0xdbd0('0x82')]||!_0x27d848[_0xdbd0('0x83')]){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))]('Transcribe\x20not\x20configured');}if(_0x45fc57['body'][_0xdbd0('0x84')]&&(!_0x27d848[_0xdbd0('0x85')]||!_0x27d848[_0xdbd0('0x86')]||!_0x27d848[_0xdbd0('0x87')]||!_0x27d848['language']||!_0x27d848[_0xdbd0('0x83')])){throw new db[(_0xdbd0('0x55'))]['ValidationError'](_0xdbd0('0x88'));}return db[_0xdbd0('0x89')][_0xdbd0('0x7c')]({'where':{'id':_0x27d848[_0xdbd0('0x80')]}});}})['then'](function(_0x3c47ef){if(!_0x3c47ef){throw new db[(_0xdbd0('0x55'))]['ValidationError'](_0xdbd0('0x8a'));}if(!_0x3c47ef[_0xdbd0('0x8b')]||!_0x3c47ef['data2']){throw new db[(_0xdbd0('0x55'))][(_0xdbd0('0x56'))](_0xdbd0('0x8c'));}_0x50b9cf=_0x3c47ef;return getBucketslist(_0x50b9cf['data1'],_0x50b9cf['data2'],_0x27d848['transcribeRegion']);})[_0xdbd0('0x25')](function(_0x561210){if(_0x561210&&_0x561210['Buckets']){var _0x3bb478=_[_0xdbd0('0x47')](_0x561210[_0xdbd0('0x8d')],function(_0x31b548){return _0x31b548['Name']===_0x27d848[_0xdbd0('0x83')];});if(!_0x3bb478){logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x45fc57['params']['id'],_0x27d848[_0xdbd0('0x83')]));return createBucket(_0x50b9cf[_0xdbd0('0x8b')],_0x50b9cf['data2'],_0x27d848[_0xdbd0('0x81')],_0x27d848[_0xdbd0('0x83')]);}logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')](_0xdbd0('0x8e'),_0x45fc57[_0xdbd0('0x4a')]['id'],_0x27d848[_0xdbd0('0x83')]));return;}})[_0xdbd0('0x25')](function(_0x51ace7){if(_0x4fbeae[_0xdbd0('0x7a')]===_0xdbd0('0x8f')){return transcribe(_0x45fc57[_0xdbd0('0x4a')]['id'],_0x50b9cf[_0xdbd0('0x8b')],_0x50b9cf[_0xdbd0('0x90')],_0x27d848[_0xdbd0('0x81')],_0x27d848[_0xdbd0('0x83')],_0x4fbeae['value'],_0x27d848[_0xdbd0('0x82')]);}else{logger[_0xdbd0('0x63')](util[_0xdbd0('0x61')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x45fc57['params']['id']));return{'transcribeStatus':_0xdbd0('0x91')};}})[_0xdbd0('0x25')](function(_0x2d96db){if(_0x2d96db){_0x2d96db[_0xdbd0('0x92')]=_0x45fc57[_0xdbd0('0x49')][_0xdbd0('0x84')];return _0x4fbeae[_0xdbd0('0x93')](_0x2d96db);}})[_0xdbd0('0x25')](respondWithResult(_0x501149,null))[_0xdbd0('0x43')](handleError(_0x501149,null));};function writeFile(_0x3435af,_0x2a1774){return new Promise(function(_0x254306,_0x430834){fs[_0xdbd0('0x94')](_0x2a1774,_0x3435af,function(_0x1e656f,_0x38b1e9){if(_0x1e656f){return _0x430834(_0x1e656f);}else{return _0x254306(_0x38b1e9);}});});}exports['downloadTranscribe']=function(_0x1005e4,_0x214d00,_0x1aee2b){return db['VoiceRecording']['findOne']({'where':{'id':_0x1005e4['params']['id']}})[_0xdbd0('0x25')](handleEntityNotFound(_0x214d00))[_0xdbd0('0x25')](function(_0x282584){if(_0x282584&&_0x282584[_0xdbd0('0x95')]){var _0x48204f=_0x282584[_0xdbd0('0x95')];var _0x375944=config[_0xdbd0('0x96')]+'/server/files/transcribes/transcribe_'+_0x282584['id']+_0xdbd0('0x97');if(fs[_0xdbd0('0x51')](_0x375944)){return _0x375944;}return writeFile(_0x48204f,_0x375944)[_0xdbd0('0x25')](function(){return _0x375944;});}else{throw new db['Sequelize'][(_0xdbd0('0x56'))](_0xdbd0('0x98'));}})['then'](function(_0x3374a4){return _0x214d00[_0xdbd0('0x4c')](_0x3374a4);})['catch'](handleError(_0x214d00));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3bb1b12..f9c64a3 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 _0x2eb2=['request-promise','rimraf','exports','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x2eb2,0x19f));var _0x22eb=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x2eb2[_0x40bffc];return _0x3007e9;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./voiceRecording.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[{'name':_0x22eb('0xb'),'fields':[_0x22eb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0eeb=['voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceRecording.attributes','exports','define'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0eeb[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require(_0xb0ee('0x4'));var BPromise=require(_0xb0ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x209dda,_0x453fa4){return _0x209dda[_0xb0ee('0xa')]('VoiceRecording',attributes,{'tableName':_0xb0ee('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb0ee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 6cfc731..0301e86 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(_0x891b81,_0xfbb107){var _0x585932=function(_0x18e04d){while(--_0x18e04d){_0x891b81['push'](_0x891b81['shift']());}};_0x585932(++_0xfbb107);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x24403d,_0x94ebf1){var _0x3fabf3=function(_0x39b1a9){while(--_0x39b1a9){_0x24403d['push'](_0x24403d['shift']());}};_0x3fabf3(++_0x94ebf1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 cf0e562..24f0c4c 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 _0x1623=['../../components/interaction/service','get','index','isAuthenticated','show','post','create','put','/:id','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x46e235,_0xfa7407){var _0x157437=function(_0x56c4b0){while(--_0x56c4b0){_0x46e235['push'](_0x46e235['shift']());}};_0x157437(++_0xfa7407);}(_0x1623,0xab));var _0x3162=function(_0x3fadda,_0x5e2fd5){_0x3fadda=_0x3fadda-0x0;var _0x11217f=_0x1623[_0x3fadda];return _0x11217f;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var auth=require(_0x3162('0x4'));var interaction=require(_0x3162('0x5'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x3162('0x6')]('/',auth['isAuthenticated'](),controller[_0x3162('0x7')]);router[_0x3162('0x6')]('/:id',auth[_0x3162('0x8')](),controller[_0x3162('0x9')]);router[_0x3162('0xa')]('/',auth[_0x3162('0x8')](),controller[_0x3162('0xb')]);router[_0x3162('0xc')](_0x3162('0xd'),auth[_0x3162('0x8')](),controller['update']);router['delete'](_0x3162('0xd'),auth[_0x3162('0x8')](),controller[_0x3162('0xe')]);module[_0x3162('0xf')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','show','update','/:id','exports','multer','util','path','express'];(function(_0x2b145c,_0x5e021b){var _0x3f766b=function(_0x3536dd){while(--_0x3536dd){_0x2b145c['push'](_0x2b145c['shift']());}};_0x3f766b(++_0x5e021b);}(_0x7a54,0x106));var _0x47a5=function(_0x1f84ba,_0x1ee706){_0x1f84ba=_0x1f84ba-0x0;var _0x1e578f=_0x7a54[_0x1f84ba];return _0x1e578f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['post']('/',auth[_0x47a5('0x9')](),controller['create']);router['put']('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xb')]);router['delete'](_0x47a5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index c50deb0..46715a8 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 _0x20e0=['STRING','Yes','sequelize','exports','ENUM','blind','attended'];(function(_0x397082,_0x26da28){var _0x7b1b02=function(_0x1dffb0){while(--_0x1dffb0){_0x397082['push'](_0x397082['shift']());}};_0x7b1b02(++_0x26da28);}(_0x20e0,0x128));var _0x020e=function(_0x4e19c8,_0x491ed4){_0x4e19c8=_0x4e19c8-0x0;var _0x1bc635=_0x20e0[_0x4e19c8];return _0x1bc635;};'use strict';var Sequelize=require(_0x020e('0x0'));var moment=require('moment');module[_0x020e('0x1')]={'type':{'type':Sequelize[_0x020e('0x2')](_0x020e('0x3'),_0x020e('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x020e('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x020e('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x020e('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x020e('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x020e('0x5')]},'transfereechannel':{'type':Sequelize[_0x020e('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x020e('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x020e('0x5')]},'transfereecontext':{'type':Sequelize[_0x020e('0x5')]},'transfereeexten':{'type':Sequelize[_0x020e('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x020e('0x5')]},'isexternal':{'type':Sequelize[_0x020e('0x2')](_0x020e('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x020e('0x5')]}}; \ No newline at end of file +var _0xb418=['sequelize','moment','exports','ENUM','blind','STRING','Yes'];(function(_0x550bc8,_0x4e3932){var _0x4c0a4c=function(_0x466749){while(--_0x466749){_0x550bc8['push'](_0x550bc8['shift']());}};_0x4c0a4c(++_0x4e3932);}(_0xb418,0x11f));var _0x8b41=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xb418[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0x8b41('0x0'));var moment=require(_0x8b41('0x1'));module[_0x8b41('0x2')]={'type':{'type':Sequelize[_0x8b41('0x3')](_0x8b41('0x4'),'attended')},'result':{'type':Sequelize[_0x8b41('0x5')]},'transfererchannel':{'type':Sequelize[_0x8b41('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8b41('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x8b41('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x8b41('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x8b41('0x5')]},'transfereechannel':{'type':Sequelize[_0x8b41('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8b41('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8b41('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8b41('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8b41('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x8b41('0x5')]},'transfereecontext':{'type':Sequelize[_0x8b41('0x5')]},'transfereeexten':{'type':Sequelize[_0x8b41('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8b41('0x5')]},'isexternal':{'type':Sequelize[_0x8b41('0x3')](_0x8b41('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8b41('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index a9d1496..9dc9736 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 _0xd6a2=['length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','VIRTUAL','merge','options','include','findAll','rows','show','includeAll','catch','create','body','find','destroy','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x457e92,_0x3b624b){var _0x4fc1b8=function(_0x35d064){while(--_0x35d064){_0x457e92['push'](_0x457e92['shift']());}};_0x4fc1b8(++_0x3b624b);}(_0xd6a2,0xad));var _0x2d6a=function(_0x3fb026,_0x20bdd9){_0x3fb026=_0x3fb026-0x0;var _0x5d019a=_0xd6a2[_0x3fb026];return _0x5d019a;};'use strict';var pdf=require(_0x2d6a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2d6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6a('0x2'));var rp=require(_0x2d6a('0x3'));var moment=require(_0x2d6a('0x4'));var BPromise=require(_0x2d6a('0x5'));var Mustache=require(_0x2d6a('0x6'));var util=require(_0x2d6a('0x7'));var path=require(_0x2d6a('0x8'));var sox=require(_0x2d6a('0x9'));var csv=require('to-csv');var ejs=require(_0x2d6a('0xa'));var fs=require('fs');var _=require(_0x2d6a('0xb'));var squel=require('squel');var crypto=require(_0x2d6a('0xc'));var jsforce=require(_0x2d6a('0xd'));var deskjs=require(_0x2d6a('0xe'));var toCsv=require(_0x2d6a('0xf'));var querystring=require(_0x2d6a('0x10'));var Papa=require('papaparse');var Redis=require(_0x2d6a('0x11'));var authService=require(_0x2d6a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2d6a('0x13'));var hardwareService=require(_0x2d6a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2d6a('0x15'));var config=require(_0x2d6a('0x16'));var db=require(_0x2d6a('0x17'))['db'];function respondWithStatusCode(_0x4cce60,_0x21e88d){_0x21e88d=_0x21e88d||0xcc;return function(_0x33dcec){if(_0x33dcec){return _0x4cce60['sendStatus'](_0x21e88d);}return _0x4cce60[_0x2d6a('0x18')](_0x21e88d)[_0x2d6a('0x19')]();};}function respondWithResult(_0x198d25,_0x22f520){_0x22f520=_0x22f520||0xc8;return function(_0x1fa72d){if(_0x1fa72d){return _0x198d25[_0x2d6a('0x18')](_0x22f520)[_0x2d6a('0x1a')](_0x1fa72d);}};}function respondWithFilteredResult(_0x5be0ad,_0x14f273){return function(_0x4a2ce2){if(_0x4a2ce2){var _0x23fe29=_0x4a2ce2[_0x2d6a('0x1b')],_0x3d081b=_0x14f273[_0x2d6a('0x1c')],_0x1c8873=_0x14f273[_0x2d6a('0x1c')]+_0x14f273['limit'],_0x3999a3;if(_0x1c8873>=_0x23fe29){_0x1c8873=_0x23fe29;_0x3999a3=0xc8;}else{_0x3999a3=0xce;}_0x5be0ad[_0x2d6a('0x18')](_0x3999a3);return _0x5be0ad[_0x2d6a('0x1d')](_0x2d6a('0x1e'),_0x3d081b+'-'+_0x1c8873+'/'+_0x23fe29)[_0x2d6a('0x1a')](_0x4a2ce2);}return null;};}function patchUpdates(_0x305b1f){return function(_0x4c0bea){try{jsonpatch[_0x2d6a('0x1f')](_0x4c0bea,_0x305b1f,!![]);}catch(_0x282f9f){return BPromise[_0x2d6a('0x20')](_0x282f9f);}return _0x4c0bea[_0x2d6a('0x21')]();};}function saveUpdates(_0x17e354,_0x4456c0){return function(_0x40375e){if(_0x40375e){return _0x40375e[_0x2d6a('0x22')](_0x17e354)['then'](function(_0x281e48){return _0x281e48;});}return null;};}function removeEntity(_0x1ceb9e,_0x558bab){return function(_0x110960){if(_0x110960){return _0x110960['destroy']()[_0x2d6a('0x23')](function(){_0x1ceb9e[_0x2d6a('0x18')](0xcc)[_0x2d6a('0x19')]();});}};}function handleEntityNotFound(_0x3e1cb4,_0x542e6e){return function(_0x45da30){if(!_0x45da30){_0x3e1cb4['sendStatus'](0x194);}return _0x45da30;};}function handleError(_0x4348c3,_0x3bc9a9){_0x3bc9a9=_0x3bc9a9||0x1f4;return function(_0x1bd62e){logger[_0x2d6a('0x24')](_0x1bd62e[_0x2d6a('0x25')]);if(_0x1bd62e['name']){delete _0x1bd62e[_0x2d6a('0x26')];}_0x4348c3[_0x2d6a('0x18')](_0x3bc9a9)['send'](_0x1bd62e);};}exports[_0x2d6a('0x27')]=function(_0x1aeb62,_0x160865){var _0x224379={},_0x46dab4={},_0x34dcde={'count':0x0,'rows':[]};var _0x2512cb=_[_0x2d6a('0x28')](db[_0x2d6a('0x29')][_0x2d6a('0x2a')],function(_0x126c0c){return{'name':_0x126c0c[_0x2d6a('0x2b')],'type':_0x126c0c[_0x2d6a('0x2c')][_0x2d6a('0x2d')]};});_0x46dab4[_0x2d6a('0x2e')]=_[_0x2d6a('0x28')](_0x2512cb,'name');_0x46dab4[_0x2d6a('0x2f')]=_[_0x2d6a('0x30')](_0x1aeb62['query']);_0x46dab4['filters']=_[_0x2d6a('0x31')](_0x46dab4[_0x2d6a('0x2e')],_0x46dab4[_0x2d6a('0x2f')]);_0x224379[_0x2d6a('0x32')]=_[_0x2d6a('0x31')](_0x46dab4[_0x2d6a('0x2e')],qs[_0x2d6a('0x33')](_0x1aeb62['query'][_0x2d6a('0x33')]));_0x224379[_0x2d6a('0x32')]=_0x224379[_0x2d6a('0x32')][_0x2d6a('0x34')]?_0x224379[_0x2d6a('0x32')]:_0x46dab4[_0x2d6a('0x2e')];if(!_0x1aeb62['query'][_0x2d6a('0x35')](_0x2d6a('0x36'))){_0x224379[_0x2d6a('0x37')]=qs[_0x2d6a('0x37')](_0x1aeb62[_0x2d6a('0x2f')][_0x2d6a('0x37')]);_0x224379[_0x2d6a('0x1c')]=qs['offset'](_0x1aeb62['query'][_0x2d6a('0x1c')]);}_0x224379[_0x2d6a('0x38')]=qs[_0x2d6a('0x39')](_0x1aeb62['query'][_0x2d6a('0x39')]);_0x224379['where']=qs[_0x2d6a('0x3a')](_['pick'](_0x1aeb62[_0x2d6a('0x2f')],_0x46dab4[_0x2d6a('0x3a')]),_0x2512cb);if(_0x1aeb62[_0x2d6a('0x2f')][_0x2d6a('0x3b')]){_0x224379[_0x2d6a('0x3c')]=_['merge'](_0x224379['where'],{'$or':_[_0x2d6a('0x28')](_0x2512cb,function(_0xd85ce8){if(_0xd85ce8['type']!==_0x2d6a('0x3d')){var _0x53363b={};_0x53363b[_0xd85ce8[_0x2d6a('0x26')]]={'$like':'%'+_0x1aeb62[_0x2d6a('0x2f')][_0x2d6a('0x3b')]+'%'};return _0x53363b;}})});}_0x224379=_[_0x2d6a('0x3e')]({},_0x224379,_0x1aeb62[_0x2d6a('0x3f')]);var _0x1977f6={'where':_0x224379['where']};return db[_0x2d6a('0x29')][_0x2d6a('0x1b')](_0x1977f6)[_0x2d6a('0x23')](function(_0x120351){_0x34dcde[_0x2d6a('0x1b')]=_0x120351;if(_0x1aeb62[_0x2d6a('0x2f')]['includeAll']){_0x224379[_0x2d6a('0x40')]=[{'all':!![]}];}return db[_0x2d6a('0x29')][_0x2d6a('0x41')](_0x224379);})[_0x2d6a('0x23')](function(_0x38f4ba){_0x34dcde[_0x2d6a('0x42')]=_0x38f4ba;return _0x34dcde;})[_0x2d6a('0x23')](respondWithFilteredResult(_0x160865,_0x224379))['catch'](handleError(_0x160865,null));};exports[_0x2d6a('0x43')]=function(_0x147cd6,_0x4b1361){var _0x7a1d92={'raw':!![],'where':{'id':_0x147cd6['params']['id']}},_0x10d2a2={};_0x10d2a2[_0x2d6a('0x2e')]=_[_0x2d6a('0x30')](db[_0x2d6a('0x29')]['rawAttributes']);_0x10d2a2[_0x2d6a('0x2f')]=_['keys'](_0x147cd6[_0x2d6a('0x2f')]);_0x10d2a2[_0x2d6a('0x3a')]=_['intersection'](_0x10d2a2[_0x2d6a('0x2e')],_0x10d2a2[_0x2d6a('0x2f')]);_0x7a1d92[_0x2d6a('0x32')]=_[_0x2d6a('0x31')](_0x10d2a2[_0x2d6a('0x2e')],qs['fields'](_0x147cd6[_0x2d6a('0x2f')]['fields']));_0x7a1d92[_0x2d6a('0x32')]=_0x7a1d92['attributes'][_0x2d6a('0x34')]?_0x7a1d92[_0x2d6a('0x32')]:_0x10d2a2[_0x2d6a('0x2e')];if(_0x147cd6[_0x2d6a('0x2f')][_0x2d6a('0x44')]){_0x7a1d92[_0x2d6a('0x40')]=[{'all':!![]}];}_0x7a1d92=_[_0x2d6a('0x3e')]({},_0x7a1d92,_0x147cd6[_0x2d6a('0x3f')]);return db[_0x2d6a('0x29')]['find'](_0x7a1d92)['then'](handleEntityNotFound(_0x4b1361,null))['then'](respondWithResult(_0x4b1361,null))[_0x2d6a('0x45')](handleError(_0x4b1361,null));};exports[_0x2d6a('0x46')]=function(_0x33e04c,_0x306a1e){return db['VoiceTransferReport'][_0x2d6a('0x46')](_0x33e04c['body'],{})['then'](respondWithResult(_0x306a1e,0xc9))['catch'](handleError(_0x306a1e,null));};exports[_0x2d6a('0x22')]=function(_0x4ba698,_0x531043){if(_0x4ba698[_0x2d6a('0x47')]['id']){delete _0x4ba698[_0x2d6a('0x47')]['id'];}return db[_0x2d6a('0x29')][_0x2d6a('0x48')]({'where':{'id':_0x4ba698['params']['id']}})[_0x2d6a('0x23')](handleEntityNotFound(_0x531043,null))[_0x2d6a('0x23')](saveUpdates(_0x4ba698['body'],null))['then'](respondWithResult(_0x531043,null))[_0x2d6a('0x45')](handleError(_0x531043,null));};exports[_0x2d6a('0x49')]=function(_0x18f8e2,_0x1d6622){return db[_0x2d6a('0x29')][_0x2d6a('0x48')]({'where':{'id':_0x18f8e2[_0x2d6a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d6622,null))[_0x2d6a('0x23')](removeEntity(_0x1d6622,null))['catch'](handleError(_0x1d6622,null));}; \ No newline at end of file +var _0xb97c=['reject','save','update','then','destroy','sendStatus','error','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','set','Content-Range','apply'];(function(_0x5c86f8,_0x584d10){var _0x161119=function(_0x3e5415){while(--_0x3e5415){_0x5c86f8['push'](_0x5c86f8['shift']());}};_0x161119(++_0x584d10);}(_0xb97c,0x72));var _0xcb97=function(_0x5cf900,_0x54e3d3){_0x5cf900=_0x5cf900-0x0;var _0x478b4c=_0xb97c[_0x5cf900];return _0x478b4c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcb97('0x0'));var rimraf=require(_0xcb97('0x1'));var zipdir=require(_0xcb97('0x2'));var jsonpatch=require(_0xcb97('0x3'));var rp=require(_0xcb97('0x4'));var moment=require(_0xcb97('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb97('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcb97('0x7'));var ejs=require(_0xcb97('0x8'));var fs=require('fs');var _=require(_0xcb97('0x9'));var squel=require(_0xcb97('0xa'));var crypto=require(_0xcb97('0xb'));var jsforce=require(_0xcb97('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb97('0x7'));var querystring=require(_0xcb97('0xd'));var Papa=require(_0xcb97('0xe'));var Redis=require(_0xcb97('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb97('0x10'));var hardwareService=require(_0xcb97('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xcb97('0x12'));var config=require(_0xcb97('0x13'));var db=require(_0xcb97('0x14'))['db'];function respondWithStatusCode(_0x5702fb,_0x15724b){_0x15724b=_0x15724b||0xcc;return function(_0x1e23c9){if(_0x1e23c9){return _0x5702fb['sendStatus'](_0x15724b);}return _0x5702fb['status'](_0x15724b)[_0xcb97('0x15')]();};}function respondWithResult(_0xb79f1d,_0x1814cb){_0x1814cb=_0x1814cb||0xc8;return function(_0x56a7b4){if(_0x56a7b4){return _0xb79f1d[_0xcb97('0x16')](_0x1814cb)[_0xcb97('0x17')](_0x56a7b4);}};}function respondWithFilteredResult(_0x15f383,_0x148dec){return function(_0x4defdc){if(_0x4defdc){var _0x3770a8=_0x4defdc[_0xcb97('0x18')],_0x36d337=_0x148dec['offset'],_0x550c72=_0x148dec['offset']+_0x148dec['limit'],_0x19851e;if(_0x550c72>=_0x3770a8){_0x550c72=_0x3770a8;_0x19851e=0xc8;}else{_0x19851e=0xce;}_0x15f383[_0xcb97('0x16')](_0x19851e);return _0x15f383[_0xcb97('0x19')](_0xcb97('0x1a'),_0x36d337+'-'+_0x550c72+'/'+_0x3770a8)[_0xcb97('0x17')](_0x4defdc);}return null;};}function patchUpdates(_0x3a3d10){return function(_0x12dfeb){try{jsonpatch[_0xcb97('0x1b')](_0x12dfeb,_0x3a3d10,!![]);}catch(_0x5f0bf9){return BPromise[_0xcb97('0x1c')](_0x5f0bf9);}return _0x12dfeb[_0xcb97('0x1d')]();};}function saveUpdates(_0x79f6c0,_0x666a2e){return function(_0x1cbb2e){if(_0x1cbb2e){return _0x1cbb2e[_0xcb97('0x1e')](_0x79f6c0)[_0xcb97('0x1f')](function(_0x497310){return _0x497310;});}return null;};}function removeEntity(_0x4ae6b4,_0x2289ca){return function(_0xacd7ed){if(_0xacd7ed){return _0xacd7ed[_0xcb97('0x20')]()[_0xcb97('0x1f')](function(){_0x4ae6b4[_0xcb97('0x16')](0xcc)[_0xcb97('0x15')]();});}};}function handleEntityNotFound(_0x472b2f,_0x4f223e){return function(_0x2110f7){if(!_0x2110f7){_0x472b2f[_0xcb97('0x21')](0x194);}return _0x2110f7;};}function handleError(_0x497807,_0x4138ef){_0x4138ef=_0x4138ef||0x1f4;return function(_0x3ec01d){logger[_0xcb97('0x22')](_0x3ec01d['stack']);if(_0x3ec01d[_0xcb97('0x23')]){delete _0x3ec01d[_0xcb97('0x23')];}_0x497807['status'](_0x4138ef)[_0xcb97('0x24')](_0x3ec01d);};}exports['index']=function(_0x5db9be,_0x63a25e){var _0xc9befd={},_0x1d535a={},_0x24e989={'count':0x0,'rows':[]};var _0x3900f9=_[_0xcb97('0x25')](db[_0xcb97('0x26')][_0xcb97('0x27')],function(_0x6ea8c5){return{'name':_0x6ea8c5[_0xcb97('0x28')],'type':_0x6ea8c5[_0xcb97('0x29')][_0xcb97('0x2a')]};});_0x1d535a[_0xcb97('0x2b')]=_[_0xcb97('0x25')](_0x3900f9,'name');_0x1d535a[_0xcb97('0x2c')]=_[_0xcb97('0x2d')](_0x5db9be[_0xcb97('0x2c')]);_0x1d535a[_0xcb97('0x2e')]=_[_0xcb97('0x2f')](_0x1d535a[_0xcb97('0x2b')],_0x1d535a[_0xcb97('0x2c')]);_0xc9befd[_0xcb97('0x30')]=_[_0xcb97('0x2f')](_0x1d535a['model'],qs['fields'](_0x5db9be[_0xcb97('0x2c')][_0xcb97('0x31')]));_0xc9befd['attributes']=_0xc9befd[_0xcb97('0x30')][_0xcb97('0x32')]?_0xc9befd[_0xcb97('0x30')]:_0x1d535a[_0xcb97('0x2b')];if(!_0x5db9be['query'][_0xcb97('0x33')](_0xcb97('0x34'))){_0xc9befd[_0xcb97('0x35')]=qs['limit'](_0x5db9be['query'][_0xcb97('0x35')]);_0xc9befd[_0xcb97('0x36')]=qs[_0xcb97('0x36')](_0x5db9be[_0xcb97('0x2c')][_0xcb97('0x36')]);}_0xc9befd['order']=qs[_0xcb97('0x37')](_0x5db9be[_0xcb97('0x2c')]['sort']);_0xc9befd[_0xcb97('0x38')]=qs[_0xcb97('0x2e')](_[_0xcb97('0x39')](_0x5db9be[_0xcb97('0x2c')],_0x1d535a['filters']),_0x3900f9);if(_0x5db9be['query'][_0xcb97('0x3a')]){_0xc9befd['where']=_[_0xcb97('0x3b')](_0xc9befd[_0xcb97('0x38')],{'$or':_['map'](_0x3900f9,function(_0x929db8){if(_0x929db8['type']!==_0xcb97('0x3c')){var _0x3a2750={};_0x3a2750[_0x929db8[_0xcb97('0x23')]]={'$like':'%'+_0x5db9be['query']['filter']+'%'};return _0x3a2750;}})});}_0xc9befd=_[_0xcb97('0x3b')]({},_0xc9befd,_0x5db9be['options']);var _0x3bf152={'where':_0xc9befd[_0xcb97('0x38')]};return db[_0xcb97('0x26')][_0xcb97('0x18')](_0x3bf152)[_0xcb97('0x1f')](function(_0xe45d3d){_0x24e989['count']=_0xe45d3d;if(_0x5db9be[_0xcb97('0x2c')][_0xcb97('0x3d')]){_0xc9befd['include']=[{'all':!![]}];}return db[_0xcb97('0x26')][_0xcb97('0x3e')](_0xc9befd);})['then'](function(_0x53cf01){_0x24e989['rows']=_0x53cf01;return _0x24e989;})[_0xcb97('0x1f')](respondWithFilteredResult(_0x63a25e,_0xc9befd))[_0xcb97('0x3f')](handleError(_0x63a25e,null));};exports[_0xcb97('0x40')]=function(_0x5f55bb,_0x5f3bbf){var _0x4e7300={'raw':!![],'where':{'id':_0x5f55bb[_0xcb97('0x41')]['id']}},_0x14014b={};_0x14014b[_0xcb97('0x2b')]=_[_0xcb97('0x2d')](db[_0xcb97('0x26')][_0xcb97('0x27')]);_0x14014b['query']=_[_0xcb97('0x2d')](_0x5f55bb[_0xcb97('0x2c')]);_0x14014b[_0xcb97('0x2e')]=_[_0xcb97('0x2f')](_0x14014b[_0xcb97('0x2b')],_0x14014b[_0xcb97('0x2c')]);_0x4e7300['attributes']=_[_0xcb97('0x2f')](_0x14014b[_0xcb97('0x2b')],qs['fields'](_0x5f55bb[_0xcb97('0x2c')][_0xcb97('0x31')]));_0x4e7300['attributes']=_0x4e7300[_0xcb97('0x30')][_0xcb97('0x32')]?_0x4e7300[_0xcb97('0x30')]:_0x14014b['model'];if(_0x5f55bb[_0xcb97('0x2c')][_0xcb97('0x3d')]){_0x4e7300[_0xcb97('0x42')]=[{'all':!![]}];}_0x4e7300=_['merge']({},_0x4e7300,_0x5f55bb[_0xcb97('0x43')]);return db[_0xcb97('0x26')][_0xcb97('0x44')](_0x4e7300)[_0xcb97('0x1f')](handleEntityNotFound(_0x5f3bbf,null))[_0xcb97('0x1f')](respondWithResult(_0x5f3bbf,null))[_0xcb97('0x3f')](handleError(_0x5f3bbf,null));};exports[_0xcb97('0x45')]=function(_0x4ff23d,_0x544b8e){return db[_0xcb97('0x26')][_0xcb97('0x45')](_0x4ff23d[_0xcb97('0x46')],{})[_0xcb97('0x1f')](respondWithResult(_0x544b8e,0xc9))[_0xcb97('0x3f')](handleError(_0x544b8e,null));};exports['update']=function(_0x46b33b,_0x5f180d){if(_0x46b33b[_0xcb97('0x46')]['id']){delete _0x46b33b[_0xcb97('0x46')]['id'];}return db[_0xcb97('0x26')][_0xcb97('0x44')]({'where':{'id':_0x46b33b[_0xcb97('0x41')]['id']}})[_0xcb97('0x1f')](handleEntityNotFound(_0x5f180d,null))[_0xcb97('0x1f')](saveUpdates(_0x46b33b[_0xcb97('0x46')],null))[_0xcb97('0x1f')](respondWithResult(_0x5f180d,null))['catch'](handleError(_0x5f180d,null));};exports[_0xcb97('0x20')]=function(_0x35794e,_0x11d755){return db[_0xcb97('0x26')][_0xcb97('0x44')]({'where':{'id':_0x35794e[_0xcb97('0x41')]['id']}})[_0xcb97('0x1f')](handleEntityNotFound(_0x11d755,null))[_0xcb97('0x1f')](removeEntity(_0x11d755,null))[_0xcb97('0x3f')](handleError(_0x11d755,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index eb886a9..b2f0f3f 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 _0x9e60=['bluebird','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','moment'];(function(_0x3c14ec,_0xa850e9){var _0x12a2ff=function(_0x387165){while(--_0x387165){_0x3c14ec['push'](_0x3c14ec['shift']());}};_0x12a2ff(++_0xa850e9);}(_0x9e60,0x1dc));var _0x09e6=function(_0x4b64b1,_0x48e6ab){_0x4b64b1=_0x4b64b1-0x0;var _0x407a2f=_0x9e60[_0x4b64b1];return _0x407a2f;};'use strict';var _=require(_0x09e6('0x0'));var util=require(_0x09e6('0x1'));var logger=require(_0x09e6('0x2'))('api');var moment=require(_0x09e6('0x3'));var BPromise=require(_0x09e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09e6('0x5'));var rimraf=require('rimraf');var config=require(_0x09e6('0x6'));var attributes=require(_0x09e6('0x7'));module[_0x09e6('0x8')]=function(_0x4acd8f,_0x14f2d0){return _0x4acd8f[_0x09e6('0x9')](_0x09e6('0xa'),attributes,{'tableName':_0x09e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeb0=['./voiceTransferReport.attributes','exports','VoiceTransferReport','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbeb0,0x135));var _0x0beb=function(_0x29a1e8,_0x1d5571){_0x29a1e8=_0x29a1e8-0x0;var _0x200c2a=_0xbeb0[_0x29a1e8];return _0x200c2a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0beb('0x0'))('api');var moment=require('moment');var BPromise=require(_0x0beb('0x1'));var rp=require(_0x0beb('0x2'));var fs=require('fs');var path=require(_0x0beb('0x3'));var rimraf=require(_0x0beb('0x4'));var config=require(_0x0beb('0x5'));var attributes=require(_0x0beb('0x6'));module[_0x0beb('0x7')]=function(_0x45eef4,_0x257c49){return _0x45eef4['define'](_0x0beb('0x8'),attributes,{'tableName':'report_call_transfer','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 03fd8b8..a49c6c6 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 _0xd12e=['rpc','../../config/environment','jayson/promise','client','info','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','VoiceTransferReport,\x20%s,\x20%s','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x451901,_0x22758d){var _0x58d959=function(_0x5eb22a){while(--_0x5eb22a){_0x451901['push'](_0x451901['shift']());}};_0x58d959(++_0x22758d);}(_0xd12e,0x1b8));var _0xed12=function(_0x3fd500,_0x47f5ef){_0x3fd500=_0x3fd500-0x0;var _0xe9d738=_0xd12e[_0x3fd500];return _0xe9d738;};'use strict';var _=require('lodash');var util=require(_0xed12('0x0'));var moment=require(_0xed12('0x1'));var BPromise=require(_0xed12('0x2'));var rs=require(_0xed12('0x3'));var fs=require('fs');var Redis=require(_0xed12('0x4'));var db=require(_0xed12('0x5'))['db'];var utils=require(_0xed12('0x6'));var logger=require(_0xed12('0x7'))(_0xed12('0x8'));var config=require(_0xed12('0x9'));var jayson=require(_0xed12('0xa'));var client=jayson[_0xed12('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x566cea,_0xc1e80b,_0x59a934){return new BPromise(function(_0x5ee693,_0x10f602){return client['request'](_0x566cea,_0x59a934)['then'](function(_0x58b944){logger[_0xed12('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0xc1e80b,_0xed12('0xd'));logger['debug'](_0xed12('0xe'),_0xc1e80b,'request\x20sent',JSON['stringify'](_0x58b944));if(_0x58b944[_0xed12('0xf')]){if(_0x58b944[_0xed12('0xf')]['code']===0x1f4){logger[_0xed12('0xf')](_0xed12('0x10'),_0xc1e80b,_0x58b944[_0xed12('0xf')][_0xed12('0x11')]);return _0x10f602(_0x58b944[_0xed12('0xf')][_0xed12('0x11')]);}logger[_0xed12('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xc1e80b,_0x58b944[_0xed12('0xf')][_0xed12('0x11')]);return _0x5ee693(_0x58b944['error'][_0xed12('0x11')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0xc1e80b,_0xed12('0xd'));_0x5ee693(_0x58b944['result'][_0xed12('0x11')]);}})[_0xed12('0x12')](function(_0x1b343e){logger['error'](_0xed12('0x10'),_0xc1e80b,_0x1b343e);_0x10f602(_0x1b343e);});});}exports[_0xed12('0x13')]=function(_0x4eaea7){var _0x30092d=this;return new Promise(function(_0x43f764,_0x19fc27){return db[_0xed12('0x14')][_0xed12('0x15')](_0x4eaea7[_0xed12('0x16')],{'raw':_0x4eaea7[_0xed12('0x17')]?_0x4eaea7['options'][_0xed12('0x18')]===undefined?!![]:![]:!![]})[_0xed12('0x19')](function(_0x2a9e28){logger[_0xed12('0xc')](_0xed12('0x13'),_0x4eaea7);logger[_0xed12('0x1a')](_0xed12('0x13'),_0x4eaea7,JSON[_0xed12('0x1b')](_0x2a9e28));_0x43f764(_0x2a9e28);})[_0xed12('0x12')](function(_0x51c65d){logger[_0xed12('0xf')](_0xed12('0x13'),_0x51c65d[_0xed12('0x11')],_0x4eaea7);_0x19fc27(_0x30092d[_0xed12('0xf')](0x1f4,_0x51c65d['message']));});});}; \ No newline at end of file +var _0xc2ef=['client','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x265276,_0x323341){var _0x24f28b=function(_0x1c6b58){while(--_0x1c6b58){_0x265276['push'](_0x265276['shift']());}};_0x24f28b(++_0x323341);}(_0xc2ef,0x12b));var _0xfc2e=function(_0x416bc9,_0x5cfa48){_0x416bc9=_0x416bc9-0x0;var _0x495edd=_0xc2ef[_0x416bc9];return _0x495edd;};'use strict';var _=require('lodash');var util=require(_0xfc2e('0x0'));var moment=require(_0xfc2e('0x1'));var BPromise=require(_0xfc2e('0x2'));var rs=require(_0xfc2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc2e('0x4'))['db'];var utils=require(_0xfc2e('0x5'));var logger=require(_0xfc2e('0x6'))(_0xfc2e('0x7'));var config=require(_0xfc2e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfc2e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55c5f4,_0x38e71c,_0x252ffc){return new BPromise(function(_0x16fdee,_0x476166){return client[_0xfc2e('0xa')](_0x55c5f4,_0x252ffc)[_0xfc2e('0xb')](function(_0x2c8d73){logger[_0xfc2e('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x38e71c,_0xfc2e('0xd'));logger[_0xfc2e('0xe')](_0xfc2e('0xf'),_0x38e71c,_0xfc2e('0xd'),JSON[_0xfc2e('0x10')](_0x2c8d73));if(_0x2c8d73[_0xfc2e('0x11')]){if(_0x2c8d73[_0xfc2e('0x11')]['code']===0x1f4){logger['error'](_0xfc2e('0x12'),_0x38e71c,_0x2c8d73[_0xfc2e('0x11')][_0xfc2e('0x13')]);return _0x476166(_0x2c8d73[_0xfc2e('0x11')][_0xfc2e('0x13')]);}logger['error'](_0xfc2e('0x12'),_0x38e71c,_0x2c8d73['error'][_0xfc2e('0x13')]);return _0x16fdee(_0x2c8d73[_0xfc2e('0x11')]['message']);}else{logger[_0xfc2e('0xc')](_0xfc2e('0x12'),_0x38e71c,_0xfc2e('0xd'));_0x16fdee(_0x2c8d73[_0xfc2e('0x14')][_0xfc2e('0x13')]);}})[_0xfc2e('0x15')](function(_0x37d77c){logger['error'](_0xfc2e('0x12'),_0x38e71c,_0x37d77c);_0x476166(_0x37d77c);});});}exports['CreateVoiceTransferReport']=function(_0x5c73b7){var _0x1f39bd=this;return new Promise(function(_0x2c0fef,_0x1cab13){return db[_0xfc2e('0x16')][_0xfc2e('0x17')](_0x5c73b7[_0xfc2e('0x18')],{'raw':_0x5c73b7['options']?_0x5c73b7[_0xfc2e('0x19')][_0xfc2e('0x1a')]===undefined?!![]:![]:!![]})[_0xfc2e('0xb')](function(_0xbbd9d1){logger['info'](_0xfc2e('0x1b'),_0x5c73b7);logger[_0xfc2e('0xe')]('CreateVoiceTransferReport',_0x5c73b7,JSON[_0xfc2e('0x10')](_0xbbd9d1));_0x2c0fef(_0xbbd9d1);})[_0xfc2e('0x15')](function(_0x117e12){logger[_0xfc2e('0x11')](_0xfc2e('0x1b'),_0x117e12[_0xfc2e('0x13')],_0x5c73b7);_0x1cab13(_0x1f39bd[_0xfc2e('0x11')](0x1f4,_0x117e12[_0xfc2e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 3cfdefb..cbc7a8c 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 _0xd0d5=['/transfer','transfer','exports','/originate','isAuthenticated','canUpdate','/hangup','hangup','/answer','answer','post','hold','/unhold','unhold'];(function(_0x4ce080,_0x4a7661){var _0x2269c1=function(_0xd1b86d){while(--_0xd1b86d){_0x4ce080['push'](_0x4ce080['shift']());}};_0x2269c1(++_0x4a7661);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x14c4bd,_0x135cdb){_0x14c4bd=_0x14c4bd-0x0;var _0x34e78e=_0xd0d5[_0x14c4bd];return _0x34e78e;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0x5d0d('0x0'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller['originate']);router['post'](_0x5d0d('0x3'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller[_0x5d0d('0x4')]);router['post'](_0x5d0d('0x5'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller[_0x5d0d('0x6')]);router[_0x5d0d('0x7')]('/hold',auth[_0x5d0d('0x1')](),auth['canUpdate'](),controller[_0x5d0d('0x8')]);router[_0x5d0d('0x7')](_0x5d0d('0x9'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller[_0x5d0d('0xa')]);router[_0x5d0d('0x7')]('/calls',auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller['calls']);router['post'](_0x5d0d('0xb'),auth[_0x5d0d('0x1')](),auth[_0x5d0d('0x2')](),controller[_0x5d0d('0xc')]);module[_0x5d0d('0xd')]=router; \ No newline at end of file +var _0xb544=['../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','answer','hold','/unhold','/calls','calls','exports'];(function(_0x7d9ebd,_0x45ecfc){var _0x195672=function(_0x4c13cd){while(--_0x4c13cd){_0x7d9ebd['push'](_0x7d9ebd['shift']());}};_0x195672(++_0x45ecfc);}(_0xb544,0xd0));var _0x4b54=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xb544[_0x5c2e3e];return _0x53f64a;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4b54('0x0'));var controller=require(_0x4b54('0x1'));router[_0x4b54('0x2')](_0x4b54('0x3'),auth[_0x4b54('0x4')](),auth[_0x4b54('0x5')](),controller[_0x4b54('0x6')]);router[_0x4b54('0x2')]('/hangup',auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router[_0x4b54('0x2')]('/answer',auth[_0x4b54('0x4')](),auth['canUpdate'](),controller[_0x4b54('0x7')]);router[_0x4b54('0x2')]('/hold',auth[_0x4b54('0x4')](),auth[_0x4b54('0x5')](),controller[_0x4b54('0x8')]);router[_0x4b54('0x2')](_0x4b54('0x9'),auth[_0x4b54('0x4')](),auth[_0x4b54('0x5')](),controller['unhold']);router[_0x4b54('0x2')](_0x4b54('0xa'),auth[_0x4b54('0x4')](),auth['canUpdate'](),controller[_0x4b54('0xb')]);router[_0x4b54('0x2')]('/transfer',auth[_0x4b54('0x4')](),auth[_0x4b54('0x5')](),controller['transfer']);module[_0x4b54('0xc')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index f6c4ca9..0d004ea 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 _0x9362=['format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','calls','calls\x20fired:','rows','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','jayson/promise','client','../../config/logger','ioredis','redis','defaults','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','error','stack','name','send','then','code','result','catch','User','findOne','VoiceChannels','all','filter','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','status','json','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','userId'];(function(_0x4e215b,_0x597fbc){var _0x56d77a=function(_0x349d7d){while(--_0x349d7d){_0x4e215b['push'](_0x4e215b['shift']());}};_0x56d77a(++_0x597fbc);}(_0x9362,0x169));var _0x2936=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9362[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0x2936('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x2936('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x2936('0x2'));var BPromise=require(_0x2936('0x3'));var jayson=require(_0x2936('0x4'));var amiClient=jayson[_0x2936('0x5')]['http']({'port':0x232a});var logger=require(_0x2936('0x6'))('webbarapi');var Redis=require(_0x2936('0x7'));config[_0x2936('0x8')]=_[_0x2936('0x9')](config[_0x2936('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2936('0x8')]));var Schema=require(_0x2936('0xa'));var originateValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x2936('0xc'),'required':[!![],_0x2936('0xd')]},'callerId':{'type':_0x2936('0xc')},'callbackUrl':{'type':_0x2936('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2936('0xe')]},'sessionId':{'type':_0x2936('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],_0x2936('0xe')]},'sessionId':{'type':_0x2936('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],_0x2936('0xe')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x2936('0xc'),'required':[!![],_0x2936('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2936('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],_0x2936('0xe')]},'sessionId':{'type':_0x2936('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2936('0xb'),'required':[!![],_0x2936('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x9fe85f,_0x31f440,_0x448b44){logger[_0x2936('0x10')](_0x9fe85f,_0x31f440,JSON[_0x2936('0x11')](_0x448b44));io['to'](_0x9fe85f)['emit'](_0x31f440,_0x448b44);}function handleError(_0x2a544e){return function(_0x51e948){console['log']('handleError:',_0x51e948,_0x51e948 instanceof RangeError);logger[_0x2936('0x12')](_0x51e948[_0x2936('0x13')]);if(_0x51e948 instanceof RangeError){if(_0x51e948[_0x2936('0x14')]){delete _0x51e948[_0x2936('0x14')];}_0x2a544e['status'](0x194)[_0x2936('0x15')](_0x51e948);}else{if(_0x51e948[_0x2936('0x14')]){delete _0x51e948[_0x2936('0x14')];}_0x2a544e['status'](0x1f4)[_0x2936('0x15')](_0x51e948);}};}function checkError(){return function(_0x4b5b46){if(!_0x4b5b46){throw new RangeError('NotFound');}return _0x4b5b46;};}function respondWithRpcPromise(_0x4d4976,_0x253ae3){return new BPromise(function(_0x81c228,_0x57110b){var _0x1c35ed=amiClient;return _0x1c35ed['request'](_0x4d4976,_0x253ae3)[_0x2936('0x16')](function(_0x280844){if(_0x280844[_0x2936('0x12')]){if(_0x280844[_0x2936('0x12')][_0x2936('0x17')]===0x1f4){return _0x57110b(_0x280844[_0x2936('0x12')]['message']);}return _0x81c228(_0x280844['error']['message']);}else{_0x81c228(_0x280844[_0x2936('0x18')]);}})[_0x2936('0x19')](function(_0x1c225a){_0x57110b(_0x1c225a);});});}function getAgent(_0x4f70b7){return db[_0x2936('0x1a')][_0x2936('0x1b')]({'where':{'id':_0x4f70b7,'role':'agent'}})[_0x2936('0x16')](checkError());}function getAgentCheckSession(_0x32b12c,_0x3687e9){return new BPromise(function(_0x2463bc,_0xca20e8){var _0x3bca1d=respondWithRpcPromise(_0x2936('0x1c'));var _0x15cf4e=getAgent(_0x32b12c);Promise[_0x2936('0x1d')]([_0x3bca1d,_0x15cf4e])[_0x2936('0x16')](function(_0x49aa57){var _0x19f81d=_0x49aa57[0x0];var _0x4fd4db=_0x49aa57[0x1];var _0x2164d6=_[_0x2936('0x1e')](_0x19f81d['rows'],function(_0xbef786){return _0xbef786['UserId']==_0x4fd4db['id']&&_0xbef786[_0x2936('0x1f')]==_0x3687e9;});if(_0x2164d6[_0x2936('0x20')]==0x1){_0x2463bc(_0x4fd4db);}else{_0xca20e8(new RangeError(_0x2936('0x21')+_0x3687e9+_0x2936('0x22')));}});});}exports[_0x2936('0x23')]=function(_0x27e847,_0x392ff2){logger['info'](_0x2936('0x24'),_0x27e847[_0x2936('0x25')]);var _0x12c523=originateValidation[_0x2936('0xa')](_0x27e847[_0x2936('0x25')]);if(_0x12c523[_0x2936('0x20')]>0x0){return _0x392ff2[_0x2936('0x26')](0x190)[_0x2936('0x27')](_0x12c523);}var _0x5bba65=_0x27e847[_0x2936('0x25')]['userId'];var _0x41ac4e=_0x27e847[_0x2936('0x25')]['callNumber'];var _0x47eb7b=_0x27e847[_0x2936('0x25')][_0x2936('0x28')];var _0x425dc4=_0x27e847[_0x2936('0x25')][_0x2936('0x29')];return getAgent(_0x5bba65)[_0x2936('0x16')](function(_0x1bd80a){logger[_0x2936('0x10')](_0x2936('0x2a'),_0x1bd80a['name']);emit(util['format'](_0x2936('0x2b'),_0x1bd80a[_0x2936('0x14')]),_0x2936('0x2c'),{'callNumber':_0x41ac4e,'callerId':_0x47eb7b,'callbackUrl':_0x425dc4});return _0x392ff2['status'](0xc8)[_0x2936('0x27')]({'error':![],'message':_0x2936('0x2d')});})[_0x2936('0x19')](handleError(_0x392ff2));};exports['hangup']=function(_0x3c39c4,_0x2868a5){logger[_0x2936('0x10')]('hangup\x20fired:',_0x3c39c4['body']);var _0x23f3a6=hangupValidation[_0x2936('0xa')](_0x3c39c4['body']);if(_0x23f3a6[_0x2936('0x20')]>0x0){return _0x2868a5[_0x2936('0x26')](0x190)[_0x2936('0x27')](_0x23f3a6);}var _0x38620f=_0x3c39c4[_0x2936('0x25')][_0x2936('0x2e')];var _0x419dbd=_0x3c39c4['body'][_0x2936('0x1f')];return getAgent(_0x38620f)[_0x2936('0x16')](function(_0x212e74){logger[_0x2936('0x10')](_0x2936('0x2a'),_0x212e74[_0x2936('0x14')]);emit(util[_0x2936('0x2f')](_0x2936('0x2b'),_0x212e74[_0x2936('0x14')]),_0x2936('0x30'),{'sessionId':_0x419dbd});return _0x2868a5[_0x2936('0x26')](0xc8)[_0x2936('0x27')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x2868a5));};exports[_0x2936('0x31')]=function(_0xd66fa5,_0x35dcb9){logger['info'](_0x2936('0x32'),_0xd66fa5['body']);var _0x472665=answerValidation[_0x2936('0xa')](_0xd66fa5[_0x2936('0x25')]);if(_0x472665[_0x2936('0x20')]>0x0){return _0x35dcb9[_0x2936('0x26')](0x190)['json'](_0x472665);}var _0x44a166=_0xd66fa5[_0x2936('0x25')]['userId'];var _0x5d7807=_0xd66fa5[_0x2936('0x25')][_0x2936('0x1f')];return getAgent(_0x44a166)[_0x2936('0x16')](function(_0xeb8042){logger[_0x2936('0x10')](_0x2936('0x2a'),_0xeb8042[_0x2936('0x14')]);emit(util['format'](_0x2936('0x2b'),_0xeb8042[_0x2936('0x14')]),_0x2936('0x33'),{'sessionId':_0x5d7807});return _0x35dcb9[_0x2936('0x26')](0xc8)['json']({'error':![],'message':_0x2936('0x34')});})['catch'](handleError(_0x35dcb9));};exports[_0x2936('0x35')]=function(_0x173472,_0x16ade3){logger[_0x2936('0x10')]('hold\x20fired:',_0x173472[_0x2936('0x25')]);var _0x2bebab=holdValidation[_0x2936('0xa')](_0x173472[_0x2936('0x25')]);if(_0x2bebab[_0x2936('0x20')]>0x0){return _0x16ade3['status'](0x190)[_0x2936('0x27')](_0x2bebab);}var _0x29c964=_0x173472[_0x2936('0x25')][_0x2936('0x2e')];var _0x3d83b7=_0x173472[_0x2936('0x25')][_0x2936('0x1f')];return getAgent(_0x29c964)[_0x2936('0x16')](function(_0x52496e){logger[_0x2936('0x10')]('entityFound:',_0x52496e[_0x2936('0x14')]);emit(util[_0x2936('0x2f')]('user:%s',_0x52496e[_0x2936('0x14')]),_0x2936('0x36'),{'sessionId':_0x3d83b7});return _0x16ade3[_0x2936('0x26')](0xc8)['json']({'error':![],'message':_0x2936('0x37')});})[_0x2936('0x19')](handleError(_0x16ade3));};exports['unhold']=function(_0x212538,_0x157ec8){logger[_0x2936('0x10')]('unhold\x20fired:',_0x212538[_0x2936('0x25')]);var _0x2cfca8=unholdValidation[_0x2936('0xa')](_0x212538[_0x2936('0x25')]);if(_0x2cfca8[_0x2936('0x20')]>0x0){return _0x157ec8['status'](0x190)[_0x2936('0x27')](_0x2cfca8);}var _0x51d124=_0x212538[_0x2936('0x25')][_0x2936('0x2e')];var _0x4ff53b=_0x212538['body'][_0x2936('0x1f')];return getAgent(_0x51d124)[_0x2936('0x16')](function(_0x4d8cfb){logger[_0x2936('0x10')](_0x2936('0x2a'),_0x4d8cfb[_0x2936('0x14')]);emit(util[_0x2936('0x2f')](_0x2936('0x2b'),_0x4d8cfb[_0x2936('0x14')]),'webbar:unhold',{'sessionId':_0x4ff53b});return _0x157ec8[_0x2936('0x26')](0xc8)[_0x2936('0x27')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x157ec8));};exports[_0x2936('0x38')]=function(_0xd188f1,_0x30dfc7){logger['info'](_0x2936('0x39'),_0x30dfc7[_0x2936('0x25')]);var _0x1179ae=callsValidation[_0x2936('0xa')](_0xd188f1[_0x2936('0x25')]);if(_0x1179ae[_0x2936('0x20')]>0x0){return _0x30dfc7[_0x2936('0x26')](0x190)['json'](_0x1179ae);}var _0x72433b=_0xd188f1['body'][_0x2936('0x2e')];var _0x29fc4a=respondWithRpcPromise(_0x2936('0x1c'));var _0x6f6274=getAgent(_0x72433b);return Promise['all']([_0x29fc4a,_0x6f6274])[_0x2936('0x16')](function(_0x282e26){var _0x37ccf3=_0x282e26[0x0];var _0x2f5c0f=_0x282e26[0x1];var _0x36a239=_[_0x2936('0x1e')](_0x37ccf3[_0x2936('0x3a')],function(_0x3e41e2){return _0x3e41e2[_0x2936('0x3b')]==_0x2f5c0f['id'];});return _0x30dfc7['status'](0xc8)['json']({'count':_0x36a239[_0x2936('0x20')],'rows':_0x36a239});})[_0x2936('0x19')](handleError(_0x30dfc7));};exports[_0x2936('0x3c')]=function(_0x25e9f2,_0x3d5b31){logger[_0x2936('0x10')](_0x2936('0x3d'),_0x25e9f2[_0x2936('0x25')]);var _0x5af069=conferenceValidation[_0x2936('0xa')](_0x25e9f2[_0x2936('0x25')]);if(_0x5af069[_0x2936('0x20')]>0x0){return _0x3d5b31[_0x2936('0x26')](0x190)[_0x2936('0x27')](_0x5af069);}var _0x1757cc=_0x25e9f2[_0x2936('0x25')]['userId'];return getAgent(_0x1757cc)[_0x2936('0x16')](function(_0xe111bf){logger[_0x2936('0x10')](_0x2936('0x2a'),_0xe111bf[_0x2936('0x14')]);emit(util[_0x2936('0x2f')](_0x2936('0x2b'),_0xe111bf[_0x2936('0x14')]),'webbar:conference');return _0x3d5b31[_0x2936('0x26')](0xc8)[_0x2936('0x27')]({'error':![],'message':_0x2936('0x3e')});})[_0x2936('0x19')](handleError(_0x3d5b31));};exports[_0x2936('0x3f')]=function(_0x1339c2,_0x5f2729){logger[_0x2936('0x10')](_0x2936('0x40'),_0x1339c2[_0x2936('0x25')]);var _0x1b1030=transferValidation['validate'](_0x1339c2[_0x2936('0x25')]);if(_0x1b1030[_0x2936('0x20')]>0x0){return _0x5f2729[_0x2936('0x26')](0x190)['json'](_0x1b1030);}var _0xc45c14=_0x1339c2[_0x2936('0x25')][_0x2936('0x2e')];var _0xacb62d=_0x1339c2[_0x2936('0x25')][_0x2936('0x1f')];var _0xb2b74e=_0x1339c2['body'][_0x2936('0x41')];return getAgent(_0xc45c14)[_0x2936('0x16')](function(_0x30ed8c){logger[_0x2936('0x10')](_0x2936('0x2a'),_0x30ed8c['name']);emit(util[_0x2936('0x2f')](_0x2936('0x2b'),_0x30ed8c[_0x2936('0x14')]),_0x2936('0x42'),{'sessionId':_0xacb62d,'transferNumber':_0xb2b74e});return _0x5f2729[_0x2936('0x26')](0xc8)[_0x2936('0x27')]({'error':![],'message':_0x2936('0x43')});})['catch'](handleError(_0x5f2729));}; \ No newline at end of file +var _0x12c9=['NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callbackUrl','format','user:%s','webbar:originate','hangup','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','client','http','webbarapi','ioredis','defaults','redis','localhost','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','stack','name','status','send'];(function(_0x504c88,_0x1c3016){var _0xb5611e=function(_0x2beaf8){while(--_0x2beaf8){_0x504c88['push'](_0x504c88['shift']());}};_0xb5611e(++_0x1c3016);}(_0x12c9,0x10e));var _0x912c=function(_0x5087cf,_0x10b5a9){_0x5087cf=_0x5087cf-0x0;var _0x3a160f=_0x12c9[_0x5087cf];return _0x3a160f;};'use strict';var path=require(_0x912c('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x912c('0x1'))['db'];var config=require(_0x912c('0x2'));var util=require(_0x912c('0x3'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0x912c('0x4')][_0x912c('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x912c('0x6'));var Redis=require(_0x912c('0x7'));config['redis']=_[_0x912c('0x8')](config[_0x912c('0x9')],{'host':_0x912c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x912c('0xb'));var originateValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x912c('0xd'),'required':[!![],_0x912c('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],_0x912c('0xf')]},'sessionId':{'type':_0x912c('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x912c('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x912c('0xd'),'required':[!![],_0x912c('0x10')]},'transferNumber':{'type':_0x912c('0xd'),'required':[!![],_0x912c('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x912c('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],_0x912c('0xf')]},'sessionId':{'type':_0x912c('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],_0x912c('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x912c('0xc'),'required':[!![],_0x912c('0xf')]}});function emit(_0x361d2b,_0x54caf3,_0x3c6031){logger[_0x912c('0x12')](_0x361d2b,_0x54caf3,JSON[_0x912c('0x13')](_0x3c6031));io['to'](_0x361d2b)['emit'](_0x54caf3,_0x3c6031);}function handleError(_0x2ec379){return function(_0x284684){console[_0x912c('0x14')]('handleError:',_0x284684,_0x284684 instanceof RangeError);logger[_0x912c('0x15')](_0x284684[_0x912c('0x16')]);if(_0x284684 instanceof RangeError){if(_0x284684['name']){delete _0x284684[_0x912c('0x17')];}_0x2ec379[_0x912c('0x18')](0x194)[_0x912c('0x19')](_0x284684);}else{if(_0x284684[_0x912c('0x17')]){delete _0x284684[_0x912c('0x17')];}_0x2ec379[_0x912c('0x18')](0x1f4)[_0x912c('0x19')](_0x284684);}};}function checkError(){return function(_0x19e7d8){if(!_0x19e7d8){throw new RangeError(_0x912c('0x1a'));}return _0x19e7d8;};}function respondWithRpcPromise(_0x566ea6,_0x5640b9){return new BPromise(function(_0x3f0ee8,_0x5c7e4c){var _0x4d834d=amiClient;return _0x4d834d[_0x912c('0x1b')](_0x566ea6,_0x5640b9)[_0x912c('0x1c')](function(_0x4f0461){if(_0x4f0461[_0x912c('0x15')]){if(_0x4f0461[_0x912c('0x15')][_0x912c('0x1d')]===0x1f4){return _0x5c7e4c(_0x4f0461[_0x912c('0x15')]['message']);}return _0x3f0ee8(_0x4f0461[_0x912c('0x15')][_0x912c('0x1e')]);}else{_0x3f0ee8(_0x4f0461[_0x912c('0x1f')]);}})[_0x912c('0x20')](function(_0x1174e2){_0x5c7e4c(_0x1174e2);});});}function getAgent(_0x216e4d){return db[_0x912c('0x21')][_0x912c('0x22')]({'where':{'id':_0x216e4d,'role':_0x912c('0x23')}})[_0x912c('0x1c')](checkError());}function getAgentCheckSession(_0x14422b,_0x4b3334){return new BPromise(function(_0x5c5d73,_0x275980){var _0xebbd58=respondWithRpcPromise(_0x912c('0x24'));var _0x161088=getAgent(_0x14422b);Promise[_0x912c('0x25')]([_0xebbd58,_0x161088])[_0x912c('0x1c')](function(_0x110639){var _0x47bc0e=_0x110639[0x0];var _0x2fd7b5=_0x110639[0x1];var _0x3baca9=_[_0x912c('0x26')](_0x47bc0e[_0x912c('0x27')],function(_0x50e447){return _0x50e447[_0x912c('0x28')]==_0x2fd7b5['id']&&_0x50e447[_0x912c('0x29')]==_0x4b3334;});if(_0x3baca9[_0x912c('0x2a')]==0x1){_0x5c5d73(_0x2fd7b5);}else{_0x275980(new RangeError('sessionId\x20'+_0x4b3334+_0x912c('0x2b')));}});});}exports[_0x912c('0x2c')]=function(_0xab5957,_0x54df3b){logger[_0x912c('0x12')](_0x912c('0x2d'),_0xab5957[_0x912c('0x2e')]);var _0x4ef410=originateValidation['validate'](_0xab5957['body']);if(_0x4ef410[_0x912c('0x2a')]>0x0){return _0x54df3b[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x4ef410);}var _0x4f81a5=_0xab5957[_0x912c('0x2e')][_0x912c('0x30')];var _0xac916a=_0xab5957[_0x912c('0x2e')]['callNumber'];var _0x46374e=_0xab5957[_0x912c('0x2e')]['callerId'];var _0x1cc699=_0xab5957[_0x912c('0x2e')][_0x912c('0x31')];return getAgent(_0x4f81a5)[_0x912c('0x1c')](function(_0x49c27d){logger[_0x912c('0x12')]('entityFound:',_0x49c27d[_0x912c('0x17')]);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x49c27d[_0x912c('0x17')]),_0x912c('0x34'),{'callNumber':_0xac916a,'callerId':_0x46374e,'callbackUrl':_0x1cc699});return _0x54df3b[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x54df3b));};exports[_0x912c('0x35')]=function(_0x46e27f,_0x11448b){logger[_0x912c('0x12')]('hangup\x20fired:',_0x46e27f[_0x912c('0x2e')]);var _0x333e32=hangupValidation['validate'](_0x46e27f[_0x912c('0x2e')]);if(_0x333e32['length']>0x0){return _0x11448b[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x333e32);}var _0xa6e2ac=_0x46e27f[_0x912c('0x2e')]['userId'];var _0x155282=_0x46e27f[_0x912c('0x2e')][_0x912c('0x29')];return getAgent(_0xa6e2ac)['then'](function(_0x248578){logger[_0x912c('0x12')](_0x912c('0x36'),_0x248578[_0x912c('0x17')]);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x248578[_0x912c('0x17')]),_0x912c('0x37'),{'sessionId':_0x155282});return _0x11448b[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':_0x912c('0x38')});})['catch'](handleError(_0x11448b));};exports[_0x912c('0x39')]=function(_0x2efb97,_0x5bdae7){logger[_0x912c('0x12')](_0x912c('0x3a'),_0x2efb97['body']);var _0xa2bea4=answerValidation[_0x912c('0xb')](_0x2efb97[_0x912c('0x2e')]);if(_0xa2bea4[_0x912c('0x2a')]>0x0){return _0x5bdae7[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0xa2bea4);}var _0x29954d=_0x2efb97['body'][_0x912c('0x30')];var _0x5cfbc8=_0x2efb97[_0x912c('0x2e')]['sessionId'];return getAgent(_0x29954d)['then'](function(_0x43c556){logger[_0x912c('0x12')](_0x912c('0x36'),_0x43c556[_0x912c('0x17')]);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x43c556[_0x912c('0x17')]),'webbar:answer',{'sessionId':_0x5cfbc8});return _0x5bdae7[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':_0x912c('0x3b')});})['catch'](handleError(_0x5bdae7));};exports[_0x912c('0x3c')]=function(_0x81c142,_0x129025){logger['info']('hold\x20fired:',_0x81c142[_0x912c('0x2e')]);var _0x42482c=holdValidation[_0x912c('0xb')](_0x81c142[_0x912c('0x2e')]);if(_0x42482c['length']>0x0){return _0x129025[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x42482c);}var _0x25769c=_0x81c142[_0x912c('0x2e')][_0x912c('0x30')];var _0x5e69ff=_0x81c142['body'][_0x912c('0x29')];return getAgent(_0x25769c)['then'](function(_0x515477){logger['info']('entityFound:',_0x515477[_0x912c('0x17')]);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x515477['name']),'webbar:hold',{'sessionId':_0x5e69ff});return _0x129025[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':_0x912c('0x3d')});})['catch'](handleError(_0x129025));};exports[_0x912c('0x3e')]=function(_0x402877,_0x12f114){logger[_0x912c('0x12')](_0x912c('0x3f'),_0x402877[_0x912c('0x2e')]);var _0x1e5105=unholdValidation[_0x912c('0xb')](_0x402877[_0x912c('0x2e')]);if(_0x1e5105[_0x912c('0x2a')]>0x0){return _0x12f114[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x1e5105);}var _0x20e3e3=_0x402877[_0x912c('0x2e')][_0x912c('0x30')];var _0x19c88b=_0x402877[_0x912c('0x2e')][_0x912c('0x29')];return getAgent(_0x20e3e3)[_0x912c('0x1c')](function(_0x2b0186){logger[_0x912c('0x12')](_0x912c('0x36'),_0x2b0186[_0x912c('0x17')]);emit(util[_0x912c('0x32')]('user:%s',_0x2b0186['name']),_0x912c('0x40'),{'sessionId':_0x19c88b});return _0x12f114[_0x912c('0x18')](0xc8)[_0x912c('0x2f')]({'error':![],'message':_0x912c('0x41')});})[_0x912c('0x20')](handleError(_0x12f114));};exports[_0x912c('0x42')]=function(_0x5986ee,_0x56f576){logger[_0x912c('0x12')]('calls\x20fired:',_0x56f576['body']);var _0x248614=callsValidation[_0x912c('0xb')](_0x5986ee['body']);if(_0x248614['length']>0x0){return _0x56f576['status'](0x190)[_0x912c('0x2f')](_0x248614);}var _0x1543a9=_0x5986ee['body'][_0x912c('0x30')];var _0xd4cb07=respondWithRpcPromise(_0x912c('0x24'));var _0x1edab9=getAgent(_0x1543a9);return Promise[_0x912c('0x25')]([_0xd4cb07,_0x1edab9])['then'](function(_0x3f409e){var _0x1e94b4=_0x3f409e[0x0];var _0x1590ac=_0x3f409e[0x1];var _0x8a48d1=_['filter'](_0x1e94b4[_0x912c('0x27')],function(_0x58af3e){return _0x58af3e[_0x912c('0x28')]==_0x1590ac['id'];});return _0x56f576['status'](0xc8)[_0x912c('0x2f')]({'count':_0x8a48d1[_0x912c('0x2a')],'rows':_0x8a48d1});})[_0x912c('0x20')](handleError(_0x56f576));};exports[_0x912c('0x43')]=function(_0x5b2662,_0x373df5){logger[_0x912c('0x12')](_0x912c('0x44'),_0x5b2662[_0x912c('0x2e')]);var _0x2cf332=conferenceValidation[_0x912c('0xb')](_0x5b2662[_0x912c('0x2e')]);if(_0x2cf332['length']>0x0){return _0x373df5[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x2cf332);}var _0xefdc56=_0x5b2662['body'][_0x912c('0x30')];return getAgent(_0xefdc56)[_0x912c('0x1c')](function(_0x3e2b44){logger[_0x912c('0x12')](_0x912c('0x36'),_0x3e2b44[_0x912c('0x17')]);emit(util[_0x912c('0x32')]('user:%s',_0x3e2b44[_0x912c('0x17')]),_0x912c('0x45'));return _0x373df5[_0x912c('0x18')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x912c('0x20')](handleError(_0x373df5));};exports[_0x912c('0x46')]=function(_0x1b82cf,_0x336b76){logger[_0x912c('0x12')](_0x912c('0x47'),_0x1b82cf[_0x912c('0x2e')]);var _0x45118b=transferValidation[_0x912c('0xb')](_0x1b82cf[_0x912c('0x2e')]);if(_0x45118b[_0x912c('0x2a')]>0x0){return _0x336b76[_0x912c('0x18')](0x190)[_0x912c('0x2f')](_0x45118b);}var _0x447ea0=_0x1b82cf[_0x912c('0x2e')][_0x912c('0x30')];var _0x4ccf2d=_0x1b82cf[_0x912c('0x2e')][_0x912c('0x29')];var _0x50df99=_0x1b82cf[_0x912c('0x2e')][_0x912c('0x48')];return getAgent(_0x447ea0)[_0x912c('0x1c')](function(_0x3408b){logger[_0x912c('0x12')](_0x912c('0x36'),_0x3408b['name']);emit(util[_0x912c('0x32')](_0x912c('0x33'),_0x3408b[_0x912c('0x17')]),'webbar:transfer',{'sessionId':_0x4ccf2d,'transferNumber':_0x50df99});return _0x336b76[_0x912c('0x18')](0xc8)['json']({'error':![],'message':_0x912c('0x49')});})['catch'](handleError(_0x336b76));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 7e4e5ed..fb224f1 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 _0x2c37=['getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','express','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x5069ed,_0x383431){var _0x2924ec=function(_0x5b16d8){while(--_0x5b16d8){_0x5069ed['push'](_0x5069ed['shift']());}};_0x2924ec(++_0x383431);}(_0x2c37,0x175));var _0x72c3=function(_0x209e53,_0x24257e){_0x209e53=_0x209e53-0x0;var _0x1186b9=_0x2c37[_0x209e53];return _0x1186b9;};'use strict';var multer=require('multer');var util=require(_0x72c3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x72c3('0x1'));var router=express['Router']();var auth=require(_0x72c3('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x72c3('0x3'));var controller=require(_0x72c3('0x4'));router[_0x72c3('0x5')]('/',auth[_0x72c3('0x6')](),controller['index']);router[_0x72c3('0x5')](_0x72c3('0x7'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x8')]);router[_0x72c3('0x5')](_0x72c3('0x9'),auth[_0x72c3('0x6')](),controller[_0x72c3('0xa')]);router[_0x72c3('0x5')](_0x72c3('0xb'),auth['isAuthenticated'](),controller[_0x72c3('0xc')]);router[_0x72c3('0x5')](_0x72c3('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x72c3('0x5')](_0x72c3('0xe'),auth['isAuthenticated'](),controller[_0x72c3('0xf')]);router[_0x72c3('0x5')](_0x72c3('0x10'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x11')]);router[_0x72c3('0x12')]('/',auth[_0x72c3('0x6')](),controller[_0x72c3('0x13')]);router[_0x72c3('0x12')](_0x72c3('0xb'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x14')]);router[_0x72c3('0x12')](_0x72c3('0xd'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x15')]);router[_0x72c3('0x12')](_0x72c3('0xe'),auth['isAuthenticated'](),controller[_0x72c3('0x16')]);router[_0x72c3('0x12')](_0x72c3('0x10'),auth['isAuthenticated'](),controller[_0x72c3('0x17')]);router['post'](_0x72c3('0x18'),controller[_0x72c3('0x19')]);router['post'](_0x72c3('0x1a'),auth[_0x72c3('0x6')](),controller['send']);router[_0x72c3('0x1b')](_0x72c3('0x9'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x1c')]);router[_0x72c3('0x1d')](_0x72c3('0x9'),auth['isAuthenticated'](),controller[_0x72c3('0x1e')]);router[_0x72c3('0x1d')](_0x72c3('0xb'),auth[_0x72c3('0x6')](),controller[_0x72c3('0x1f')]);router[_0x72c3('0x1d')]('/:id/canned_answers',auth[_0x72c3('0x6')](),controller[_0x72c3('0x20')]);router[_0x72c3('0x1d')]('/:id/users',auth[_0x72c3('0x6')](),controller[_0x72c3('0x21')]);module[_0x72c3('0x22')]=router; \ No newline at end of file +var _0x3781=['../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents','/:id/send','send','delete','/:id','destroy','removeDispositions','removeAnswers','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4da493,_0x15e45a){var _0x33e403=function(_0x11dfd3){while(--_0x11dfd3){_0x4da493['push'](_0x4da493['shift']());}};_0x33e403(++_0x15e45a);}(_0x3781,0x79));var _0x1378=function(_0x2fb19b,_0x19acbd){_0x2fb19b=_0x2fb19b-0x0;var _0x3f6666=_0x3781[_0x2fb19b];return _0x3f6666;};'use strict';var multer=require(_0x1378('0x0'));var util=require(_0x1378('0x1'));var path=require(_0x1378('0x2'));var timeout=require('connect-timeout');var express=require(_0x1378('0x3'));var router=express[_0x1378('0x4')]();var auth=require(_0x1378('0x5'));var interaction=require(_0x1378('0x6'));var config=require(_0x1378('0x7'));var controller=require(_0x1378('0x8'));router[_0x1378('0x9')]('/',auth[_0x1378('0xa')](),controller[_0x1378('0xb')]);router[_0x1378('0x9')](_0x1378('0xc'),auth[_0x1378('0xa')](),controller[_0x1378('0xd')]);router[_0x1378('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1378('0xe')]);router[_0x1378('0x9')](_0x1378('0xf'),auth[_0x1378('0xa')](),controller['getDispositions']);router[_0x1378('0x9')](_0x1378('0x10'),auth[_0x1378('0xa')](),controller[_0x1378('0x11')]);router[_0x1378('0x9')](_0x1378('0x12'),auth[_0x1378('0xa')](),controller['getAgents']);router['get'](_0x1378('0x13'),auth[_0x1378('0xa')](),controller[_0x1378('0x14')]);router[_0x1378('0x15')]('/',auth[_0x1378('0xa')](),controller['create']);router[_0x1378('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1378('0x16')]);router[_0x1378('0x15')](_0x1378('0x10'),auth[_0x1378('0xa')](),controller[_0x1378('0x17')]);router['post']('/:id/users',auth[_0x1378('0xa')](),controller[_0x1378('0x18')]);router[_0x1378('0x15')](_0x1378('0x13'),auth[_0x1378('0xa')](),controller['addApplications']);router[_0x1378('0x15')]('/:id/notify',controller['notify']);router[_0x1378('0x15')](_0x1378('0x19'),auth['isAuthenticated'](),controller[_0x1378('0x1a')]);router['put']('/:id',auth[_0x1378('0xa')](),controller['update']);router[_0x1378('0x1b')](_0x1378('0x1c'),auth[_0x1378('0xa')](),controller[_0x1378('0x1d')]);router[_0x1378('0x1b')](_0x1378('0xf'),auth['isAuthenticated'](),controller[_0x1378('0x1e')]);router[_0x1378('0x1b')](_0x1378('0x10'),auth[_0x1378('0xa')](),controller[_0x1378('0x1f')]);router['delete'](_0x1378('0x12'),auth[_0x1378('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 7c5c973..9512729 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 _0x2736=['sequelize','randomstring','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x35cf88,_0x39d23e){var _0xe91b2d=function(_0x40bd12){while(--_0x40bd12){_0x35cf88['push'](_0x35cf88['shift']());}};_0xe91b2d(++_0x39d23e);}(_0x2736,0xe0));var _0x6273=function(_0x259cad,_0x3dae11){_0x259cad=_0x259cad-0x0;var _0x4e6a68=_0x2736[_0x259cad];return _0x4e6a68;};'use strict';var Sequelize=require(_0x6273('0x0'));var rs=require(_0x6273('0x1'));module['exports']={'name':{'type':Sequelize[_0x6273('0x2')],'unique':_0x6273('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6273('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6273('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6273('0x4')]();}},'phone':{'type':Sequelize[_0x6273('0x2')]},'type':{'type':Sequelize[_0x6273('0x5')](_0x6273('0x6'))},'accountSid':{'type':Sequelize[_0x6273('0x2')]},'authToken':{'type':Sequelize[_0x6273('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6273('0x7')],'defaultValue':function(){return _0x6273('0x8');}},'notificationSound':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6273('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6273('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6273('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6273('0xa')],'comment':_0x6273('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x6273('0x9')],'defaultValue':![],'comment':_0x6273('0xc'),'set':function(_0x1cbe5b){if(!_0x1cbe5b){this['setDataValue'](_0x6273('0xd'),null);}this[_0x6273('0xe')](_0x6273('0xf'),_0x1cbe5b);}},'description':{'type':Sequelize[_0x6273('0x2')]}}; \ No newline at end of file +var _0xf441=['generate','twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','name','STRING'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xf441,0xa4));var _0x1f44=function(_0x5ac2ff,_0xc342de){_0x5ac2ff=_0x5ac2ff-0x0;var _0x152512=_0xf441[_0x5ac2ff];return _0x152512;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1f44('0x0'));module[_0x1f44('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1f44('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x1f44('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1f44('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1f44('0x3')],'defaultValue':function(){return rs[_0x1f44('0x4')]();}},'phone':{'type':Sequelize[_0x1f44('0x3')]},'type':{'type':Sequelize['ENUM'](_0x1f44('0x5'))},'accountSid':{'type':Sequelize[_0x1f44('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1f44('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f44('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1f44('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1f44('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f44('0x7')],'comment':_0x1f44('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1f44('0x9'),'set':function(_0x338427){if(!_0x338427){this[_0x1f44('0xa')](_0x1f44('0xb'),null);}this[_0x1f44('0xa')]('mandatoryDisposition',_0x338427);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 594a25f..819ed4a 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 _0xb62e=['filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','applications','orderBy','account','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','Body','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','omit','Contacts','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./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','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','get','stack','name','send','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','model','map','query','keys'];(function(_0x3ab2e2,_0x5bf6cb){var _0x365fe8=function(_0x40401b){while(--_0x40401b){_0x3ab2e2['push'](_0x3ab2e2['shift']());}};_0x365fe8(++_0x5bf6cb);}(_0xb62e,0x1de));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var as=require(_0xeb62('0x13'));var hardwareService=require(_0xeb62('0x14'));var logger=require(_0xeb62('0x15'))(_0xeb62('0x16'));var utils=require(_0xeb62('0x17'));var config=require(_0xeb62('0x18'));var db=require(_0xeb62('0x19'))['db'];config['redis']=_[_0xeb62('0x1a')](config[_0xeb62('0x1b')],{'host':_0xeb62('0x1c'),'port':0x18eb});var socket=require(_0xeb62('0x1d'))(new Redis(config['redis']));require(_0xeb62('0x1e'))[_0xeb62('0x1f')](socket);var jayson=require(_0xeb62('0x20'));var client=jayson['client'][_0xeb62('0x21')]({'port':0x232c});function checkPasswordPattern(_0x195837,_0x2fd4c7,_0x4ce9fa){if(_0x4ce9fa){var _0x1f6a1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f6a1f[_0xeb62('0x22')](_0x2fd4c7)){return _0x195837;}else{throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))](_0xeb62('0x25'));}}else{return _0x195837;}}function respondWithRpcPromise(_0x370474,_0x1fb460,_0x1324d7,_0x39b138){return new BPromise(function(_0x27fd84,_0x27efc8){var _0x11d516=_0x39b138||client;return _0x11d516[_0xeb62('0x26')](_0x370474,_0x1324d7)['then'](function(_0x38c5e4){logger[_0xeb62('0x27')](_0xeb62('0x28'),_0x1fb460,_0xeb62('0x29'));logger[_0xeb62('0x2a')](_0xeb62('0x2b'),_0x1fb460,_0xeb62('0x29'),JSON['stringify'](_0x38c5e4));if(_0x38c5e4['error']){if(_0x38c5e4[_0xeb62('0x2c')][_0xeb62('0x2d')]===0x1f4){logger[_0xeb62('0x2c')](_0xeb62('0x28'),_0x1fb460,_0x38c5e4[_0xeb62('0x2c')]['message']);return _0x27efc8(_0x38c5e4['error'][_0xeb62('0x2e')]);}logger[_0xeb62('0x2c')](_0xeb62('0x28'),_0x1fb460,_0x38c5e4[_0xeb62('0x2c')]['message']);return _0x27fd84(_0x38c5e4['error'][_0xeb62('0x2e')]);}else{logger['info'](_0xeb62('0x28'),_0x1fb460,'request\x20sent');_0x27fd84(_0x38c5e4[_0xeb62('0x2f')]['message']);}})[_0xeb62('0x30')](function(_0x6bfbbc){logger[_0xeb62('0x2c')]('WhatsappAccount,\x20%s,\x20%s',_0x1fb460,_0x6bfbbc);_0x27efc8(_0x6bfbbc);});});}function respondWithStatusCode(_0x3ef784,_0x3ae031){_0x3ae031=_0x3ae031||0xcc;return function(_0x5222f4){if(_0x5222f4){return _0x3ef784[_0xeb62('0x31')](_0x3ae031);}return _0x3ef784[_0xeb62('0x32')](_0x3ae031)[_0xeb62('0x33')]();};}function respondWithResult(_0x511202,_0x192517){_0x192517=_0x192517||0xc8;return function(_0x1616ee){if(_0x1616ee){return _0x511202['status'](_0x192517)[_0xeb62('0x34')](_0x1616ee);}};}function respondWithFilteredResult(_0x2b51b2,_0x2c967c){return function(_0x2c308c){if(_0x2c308c){var _0x235448=_0x2c308c[_0xeb62('0x35')],_0x5195bf=_0x2c967c[_0xeb62('0x36')],_0x4b58af=_0x2c967c[_0xeb62('0x36')]+_0x2c967c[_0xeb62('0x37')],_0x1248bb;if(_0x4b58af>=_0x235448){_0x4b58af=_0x235448;_0x1248bb=0xc8;}else{_0x1248bb=0xce;}_0x2b51b2[_0xeb62('0x32')](_0x1248bb);return _0x2b51b2[_0xeb62('0x38')]('Content-Range',_0x5195bf+'-'+_0x4b58af+'/'+_0x235448)[_0xeb62('0x34')](_0x2c308c);}return null;};}function patchUpdates(_0x47a94b){return function(_0x555db1){try{jsonpatch[_0xeb62('0x39')](_0x555db1,_0x47a94b,!![]);}catch(_0x286455){return BPromise['reject'](_0x286455);}return _0x555db1[_0xeb62('0x3a')]();};}function saveUpdates(_0x4bcfce,_0x1c2195){return function(_0xc0d2e4){if(_0xc0d2e4){return _0xc0d2e4['update'](_0x4bcfce)[_0xeb62('0x3b')](function(_0xe2589){return _0xe2589;});}return null;};}function removeEntity(_0x5914c9,_0x1b3a60){return function(_0x2a8087){if(_0x2a8087){return _0x2a8087[_0xeb62('0x3c')]()[_0xeb62('0x3b')](function(){var _0x513dd8=_0x2a8087[_0xeb62('0x3d')]({'plain':!![]});var _0x43685b='WhatsappAccounts';return db['UserProfileResource'][_0xeb62('0x3c')]({'where':{'type':_0x43685b,'resourceId':_0x513dd8['id']}})[_0xeb62('0x3b')](function(){return _0x2a8087;});})['then'](function(){_0x5914c9[_0xeb62('0x32')](0xcc)[_0xeb62('0x33')]();});}};}function handleEntityNotFound(_0x11eadb,_0x1f839a){return function(_0x21f604){if(!_0x21f604){_0x11eadb[_0xeb62('0x31')](0x194);}return _0x21f604;};}function handleError(_0x40106b,_0x4b22c8){_0x4b22c8=_0x4b22c8||0x1f4;return function(_0x54ea4b){logger[_0xeb62('0x2c')](_0x54ea4b[_0xeb62('0x3e')]);if(_0x54ea4b[_0xeb62('0x3f')]){delete _0x54ea4b[_0xeb62('0x3f')];}_0x40106b['status'](_0x4b22c8)[_0xeb62('0x40')](_0x54ea4b);};}exports['index']=function(_0x20fd7a,_0x1a007b){var _0x2dac2f={'include':[{'model':db[_0xeb62('0x41')],'as':_0xeb62('0x42')}]},_0x136c5a={},_0x1b133e={'count':0x0,'rows':[]};var _0x40e3a0=_['map'](db[_0xeb62('0x43')][_0xeb62('0x44')],function(_0x429fe4){return{'name':_0x429fe4[_0xeb62('0x45')],'type':_0x429fe4['type']['key']};});_0x136c5a[_0xeb62('0x46')]=_[_0xeb62('0x47')](_0x40e3a0,'name');_0x136c5a[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x20fd7a['query']);_0x136c5a[_0xeb62('0x4a')]=_['intersection'](_0x136c5a[_0xeb62('0x46')],_0x136c5a['query']);_0x2dac2f[_0xeb62('0x4b')]=_['intersection'](_0x136c5a[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x20fd7a[_0xeb62('0x48')]['fields']));_0x2dac2f['attributes']=_0x2dac2f[_0xeb62('0x4b')][_0xeb62('0x4d')]?_0x2dac2f[_0xeb62('0x4b')]:_0x136c5a[_0xeb62('0x46')];if(!_0x20fd7a[_0xeb62('0x48')]['hasOwnProperty'](_0xeb62('0x4e'))){_0x2dac2f['limit']=qs[_0xeb62('0x37')](_0x20fd7a['query'][_0xeb62('0x37')]);_0x2dac2f['offset']=qs[_0xeb62('0x36')](_0x20fd7a['query'][_0xeb62('0x36')]);}_0x2dac2f[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x20fd7a[_0xeb62('0x48')][_0xeb62('0x50')]);_0x2dac2f[_0xeb62('0x51')]=qs['filters'](_[_0xeb62('0x52')](_0x20fd7a[_0xeb62('0x48')],_0x136c5a['filters']),_0x40e3a0);if(_0x20fd7a['query']['filter']){_0x2dac2f['where']=_[_0xeb62('0x53')](_0x2dac2f[_0xeb62('0x51')],{'$or':_['map'](_0x40e3a0,function(_0x2fa41c){if(_0x2fa41c[_0xeb62('0x54')]!==_0xeb62('0x55')){var _0x16e262={};_0x16e262[_0x2fa41c[_0xeb62('0x3f')]]={'$like':'%'+_0x20fd7a['query'][_0xeb62('0x56')]+'%'};return _0x16e262;}})});}_0x2dac2f=_['merge']({},_0x2dac2f,_0x20fd7a[_0xeb62('0x57')]);var _0x2cf2b5={'where':_0x2dac2f[_0xeb62('0x51')]};return db[_0xeb62('0x43')][_0xeb62('0x35')](_0x2cf2b5)[_0xeb62('0x3b')](function(_0x321e55){_0x1b133e[_0xeb62('0x35')]=_0x321e55;if(_0x20fd7a[_0xeb62('0x48')][_0xeb62('0x58')]){_0x2dac2f[_0xeb62('0x59')]=[{'all':!![]}];}return db[_0xeb62('0x43')]['findAll'](_0x2dac2f);})[_0xeb62('0x3b')](function(_0x50bfec){_0x1b133e['rows']=_0x50bfec;return _0x1b133e;})[_0xeb62('0x3b')](respondWithFilteredResult(_0x1a007b,_0x2dac2f))[_0xeb62('0x30')](handleError(_0x1a007b,null));};exports['show']=function(_0x373505,_0x462760){var _0x5c8cb5={'raw':![],'where':{'id':_0x373505[_0xeb62('0x5a')]['id']},'include':[{'model':db[_0xeb62('0x41')],'as':_0xeb62('0x42')}]},_0x11297d={};_0x11297d[_0xeb62('0x46')]=_[_0xeb62('0x49')](db[_0xeb62('0x43')][_0xeb62('0x44')]);_0x11297d['query']=_[_0xeb62('0x49')](_0x373505['query']);_0x11297d[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x11297d[_0xeb62('0x46')],_0x11297d[_0xeb62('0x48')]);_0x5c8cb5[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x11297d[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x373505['query']['fields']));_0x5c8cb5['attributes']=_0x5c8cb5['attributes'][_0xeb62('0x4d')]?_0x5c8cb5['attributes']:_0x11297d[_0xeb62('0x46')];if(_0x373505['query'][_0xeb62('0x58')]){_0x5c8cb5[_0xeb62('0x59')]=[{'all':!![]}];}_0x5c8cb5=_[_0xeb62('0x53')]({},_0x5c8cb5,_0x373505['options']);return db[_0xeb62('0x43')][_0xeb62('0x5c')](_0x5c8cb5)['then'](handleEntityNotFound(_0x462760,null))[_0xeb62('0x3b')](respondWithResult(_0x462760,null))[_0xeb62('0x30')](handleError(_0x462760,null));};exports[_0xeb62('0x5d')]=function(_0x366312,_0x55370c){return db[_0xeb62('0x43')][_0xeb62('0x5d')](_0x366312['body'],{})[_0xeb62('0x3b')](function(_0x5d1415){var _0x10b1ef=_0x366312[_0xeb62('0x5e')][_0xeb62('0x3d')]({'plain':!![]});if(!_0x10b1ef)throw new Error(_0xeb62('0x5f'));if(_0x10b1ef[_0xeb62('0x60')]===_0xeb62('0x5e')){var _0x222d0c=_0x5d1415[_0xeb62('0x3d')]({'plain':!![]});var _0x130153=_0xeb62('0x61');return db[_0xeb62('0x62')][_0xeb62('0x5c')]({'where':{'name':_0x130153,'userProfileId':_0x10b1ef[_0xeb62('0x63')]},'raw':!![]})[_0xeb62('0x3b')](function(_0x5873c1){if(_0x5873c1&&_0x5873c1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x222d0c[_0xeb62('0x3f')],'resourceId':_0x222d0c['id'],'type':_0x5873c1['name'],'sectionId':_0x5873c1['id']},{})[_0xeb62('0x3b')](function(){return _0x5d1415;});}else{return _0x5d1415;}})[_0xeb62('0x30')](function(_0x5b8c4){logger[_0xeb62('0x2c')](_0xeb62('0x64'),_0x5b8c4);throw _0x5b8c4;});}return _0x5d1415;})[_0xeb62('0x3b')](respondWithResult(_0x55370c,0xc9))[_0xeb62('0x30')](handleError(_0x55370c,null));};exports[_0xeb62('0x65')]=function(_0x349916,_0x447e01){if(_0x349916['body']['id']){delete _0x349916[_0xeb62('0x66')]['id'];}return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x349916[_0xeb62('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xeb62('0x42')}]})[_0xeb62('0x3b')](handleEntityNotFound(_0x447e01,null))[_0xeb62('0x3b')](saveUpdates(_0x349916[_0xeb62('0x66')],null))[_0xeb62('0x3b')](respondWithResult(_0x447e01,null))[_0xeb62('0x30')](handleError(_0x447e01,null));};exports[_0xeb62('0x3c')]=function(_0x42af99,_0x2e1fb8){return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x42af99['params']['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x2e1fb8,null))[_0xeb62('0x3b')](removeEntity(_0x2e1fb8,null))[_0xeb62('0x30')](handleError(_0x2e1fb8,null));};exports[_0xeb62('0x67')]=function(_0x250294,_0x4363c2){return db[_0xeb62('0x43')][_0xeb62('0x67')]()[_0xeb62('0x3b')](respondWithResult(_0x4363c2,null))[_0xeb62('0x30')](handleError(_0x4363c2,null));};exports['addDisposition']=function(_0x106b8d,_0xedf007,_0xd96bbc){if(_0x106b8d[_0xeb62('0x66')]['id']){delete _0x106b8d['body']['id'];}return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x106b8d[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0xedf007,null))[_0xeb62('0x3b')](function(_0x32642f){if(_0x32642f){_0x106b8d['body'][_0xeb62('0x68')]=_0x32642f['id'];return db[_0xeb62('0x69')][_0xeb62('0x5d')](_0x106b8d[_0xeb62('0x66')]);}})[_0xeb62('0x3b')](respondWithResult(_0xedf007,null))[_0xeb62('0x30')](handleError(_0xedf007,null));};exports[_0xeb62('0x6a')]=function(_0x313d33,_0x233715,_0xf16846){var _0x1c3cb0={'raw':![],'where':{}};var _0x1bf4f2={};var _0x1cbf33={'count':0x0,'rows':[]};return db[_0xeb62('0x43')][_0xeb62('0x6b')]({'where':{'id':_0x313d33[_0xeb62('0x5a')]['id']}})['then'](handleEntityNotFound(_0x233715,null))[_0xeb62('0x3b')](function(_0x5cca51){if(_0x5cca51){_0x1bf4f2[_0xeb62('0x46')]=_[_0xeb62('0x49')](db['Disposition'][_0xeb62('0x44')]);_0x1bf4f2[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x313d33[_0xeb62('0x48')]);_0x1bf4f2[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x1bf4f2[_0xeb62('0x46')],_0x1bf4f2[_0xeb62('0x48')]);_0x1c3cb0[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x1bf4f2[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x313d33[_0xeb62('0x48')]['fields']));_0x1c3cb0[_0xeb62('0x4b')]=_0x1c3cb0[_0xeb62('0x4b')]['length']?_0x1c3cb0[_0xeb62('0x4b')]:_0x1bf4f2['model'];if(!_0x313d33[_0xeb62('0x48')][_0xeb62('0x6c')](_0xeb62('0x4e'))){_0x1c3cb0[_0xeb62('0x37')]=qs[_0xeb62('0x37')](_0x313d33[_0xeb62('0x48')]['limit']);_0x1c3cb0[_0xeb62('0x36')]=qs['offset'](_0x313d33[_0xeb62('0x48')][_0xeb62('0x36')]);}_0x1c3cb0[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x313d33[_0xeb62('0x48')]['sort']);_0x1c3cb0[_0xeb62('0x51')]=qs[_0xeb62('0x4a')](_[_0xeb62('0x52')](_0x313d33['query'],_0x1bf4f2[_0xeb62('0x4a')]));_0x1c3cb0[_0xeb62('0x51')][_0xeb62('0x68')]=_0x5cca51['id'];if(_0x313d33[_0xeb62('0x48')][_0xeb62('0x56')]){_0x1c3cb0[_0xeb62('0x51')]=_['merge'](_0x1c3cb0['where'],{'$or':_['map'](_0x1c3cb0['attributes'],function(_0x5bf6f6){var _0x1f8c00={};_0x1f8c00[_0x5bf6f6]={'$like':'%'+_0x313d33[_0xeb62('0x48')][_0xeb62('0x56')]+'%'};return _0x1f8c00;})});}_0x1c3cb0=_[_0xeb62('0x53')]({},_0x1c3cb0,_0x313d33[_0xeb62('0x57')]);return db[_0xeb62('0x69')][_0xeb62('0x35')]({'where':_0x1c3cb0[_0xeb62('0x51')]})[_0xeb62('0x3b')](function(_0x2c6bb3){_0x1cbf33[_0xeb62('0x35')]=_0x2c6bb3;if(_0x313d33[_0xeb62('0x48')]['includeAll']){_0x1c3cb0[_0xeb62('0x59')]=[{'all':!![]}];}return db[_0xeb62('0x69')][_0xeb62('0x6d')](_0x1c3cb0);})[_0xeb62('0x3b')](function(_0x25106d){_0x1cbf33[_0xeb62('0x6e')]=_0x25106d;return _0x1cbf33;});}})[_0xeb62('0x3b')](respondWithFilteredResult(_0x233715,_0x1c3cb0))[_0xeb62('0x30')](handleError(_0x233715,null));};exports[_0xeb62('0x6f')]=function(_0x33b16b,_0x124847,_0x17beef){return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x33b16b[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x124847,null))[_0xeb62('0x3b')](function(_0x2f5f2f){if(_0x2f5f2f){return _0x2f5f2f['removeDispositions'](_0x33b16b[_0xeb62('0x48')]['ids']);}})[_0xeb62('0x3b')](respondWithStatusCode(_0x124847,null))[_0xeb62('0x30')](handleError(_0x124847,null));};exports['addAnswer']=function(_0x1d909f,_0x4e3c6c,_0x51e954){if(_0x1d909f[_0xeb62('0x66')]['id']){delete _0x1d909f[_0xeb62('0x66')]['id'];}return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x1d909f['params']['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x4e3c6c,null))[_0xeb62('0x3b')](function(_0x4ca889){if(_0x4ca889){_0x1d909f[_0xeb62('0x66')][_0xeb62('0x68')]=_0x4ca889['id'];return db[_0xeb62('0x70')][_0xeb62('0x5d')](_0x1d909f[_0xeb62('0x66')]);}})[_0xeb62('0x3b')](respondWithResult(_0x4e3c6c,null))[_0xeb62('0x30')](handleError(_0x4e3c6c,null));};exports[_0xeb62('0x71')]=function(_0x59740f,_0x32ae8e,_0x2e57b2){var _0x5b1bfc={'raw':![],'where':{}};var _0x3c6de8={};var _0x5c83b8={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xeb62('0x6b')]({'where':{'id':_0x59740f[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x32ae8e,null))[_0xeb62('0x3b')](function(_0x25a646){if(_0x25a646){_0x3c6de8['model']=_[_0xeb62('0x49')](db[_0xeb62('0x70')][_0xeb62('0x44')]);_0x3c6de8[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x59740f[_0xeb62('0x48')]);_0x3c6de8[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x3c6de8['model'],_0x3c6de8['query']);_0x5b1bfc[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x3c6de8[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x59740f['query'][_0xeb62('0x4c')]));_0x5b1bfc['attributes']=_0x5b1bfc['attributes'][_0xeb62('0x4d')]?_0x5b1bfc[_0xeb62('0x4b')]:_0x3c6de8['model'];if(!_0x59740f[_0xeb62('0x48')]['hasOwnProperty'](_0xeb62('0x4e'))){_0x5b1bfc[_0xeb62('0x37')]=qs[_0xeb62('0x37')](_0x59740f['query']['limit']);_0x5b1bfc[_0xeb62('0x36')]=qs[_0xeb62('0x36')](_0x59740f[_0xeb62('0x48')]['offset']);}_0x5b1bfc[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x59740f[_0xeb62('0x48')][_0xeb62('0x50')]);_0x5b1bfc[_0xeb62('0x51')]=qs[_0xeb62('0x4a')](_['pick'](_0x59740f['query'],_0x3c6de8['filters']));_0x5b1bfc[_0xeb62('0x51')]['WhatsappAccountId']=_0x25a646['id'];if(_0x59740f['query'][_0xeb62('0x56')]){_0x5b1bfc['where']=_['merge'](_0x5b1bfc['where'],{'$or':_[_0xeb62('0x47')](_0x5b1bfc['attributes'],function(_0x2c9fe5){var _0x169b13={};_0x169b13[_0x2c9fe5]={'$like':'%'+_0x59740f[_0xeb62('0x48')][_0xeb62('0x56')]+'%'};return _0x169b13;})});}_0x5b1bfc=_[_0xeb62('0x53')]({},_0x5b1bfc,_0x59740f[_0xeb62('0x57')]);return db[_0xeb62('0x70')]['count']({'where':_0x5b1bfc['where']})[_0xeb62('0x3b')](function(_0x4037c9){_0x5c83b8[_0xeb62('0x35')]=_0x4037c9;if(_0x59740f[_0xeb62('0x48')][_0xeb62('0x58')]){_0x5b1bfc['include']=[{'all':!![]}];}return db[_0xeb62('0x70')][_0xeb62('0x6d')](_0x5b1bfc);})[_0xeb62('0x3b')](function(_0x4790e4){_0x5c83b8[_0xeb62('0x6e')]=_0x4790e4;return _0x5c83b8;});}})['then'](respondWithFilteredResult(_0x32ae8e,_0x5b1bfc))[_0xeb62('0x30')](handleError(_0x32ae8e,null));};exports[_0xeb62('0x72')]=function(_0x4ff08a,_0x50cb9a,_0x2efd4a){return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x4ff08a[_0xeb62('0x5a')]['id']}})['then'](handleEntityNotFound(_0x50cb9a,null))[_0xeb62('0x3b')](function(_0x19e57f){if(_0x19e57f){return _0x19e57f['removeAnswers'](_0x4ff08a['query'][_0xeb62('0x73')]);}})[_0xeb62('0x3b')](respondWithStatusCode(_0x50cb9a,null))[_0xeb62('0x30')](handleError(_0x50cb9a,null));};exports[_0xeb62('0x74')]=function(_0x396185,_0x3ce2da,_0x1a2427){return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x396185[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x3ce2da,null))[_0xeb62('0x3b')](function(_0x135565){if(_0x135565){return _0x135565[_0xeb62('0x74')](_0x396185[_0xeb62('0x66')][_0xeb62('0x73')],_['omit'](_0x396185[_0xeb62('0x66')],[_0xeb62('0x73'),'id'])||{})[_0xeb62('0x75')](function(_0x122478){for(var _0x3cfa34=0x0;_0x3cfa34<_0x396185['body']['ids'][_0xeb62('0x4d')];_0x3cfa34+=0x1){socket[_0xeb62('0x76')](_0xeb62('0x77'),{'UserId':_0x396185[_0xeb62('0x66')]['ids'][_0x3cfa34],'WhatsappAccountId':_0x396185[_0xeb62('0x5a')]['id']});}return _0x122478;});}})['then'](respondWithResult(_0x3ce2da,null))[_0xeb62('0x30')](handleError(_0x3ce2da,null));};exports[_0xeb62('0x78')]=function(_0x3409db,_0x13f8e2,_0x1fa174){return db['WhatsappAccount'][_0xeb62('0x5c')]({'where':{'id':_0x3409db[_0xeb62('0x5a')]['id']}})['then'](handleEntityNotFound(_0x13f8e2,null))[_0xeb62('0x3b')](function(_0x5357fe){if(_0x5357fe){return _0x5357fe[_0xeb62('0x78')](_0x3409db[_0xeb62('0x48')][_0xeb62('0x73')])[_0xeb62('0x3b')](function(){if(_[_0xeb62('0x79')](_0x3409db[_0xeb62('0x48')]['ids'])){for(var _0x506aaa=0x0;_0x506aaa<_0x3409db[_0xeb62('0x48')][_0xeb62('0x73')][_0xeb62('0x4d')];_0x506aaa+=0x1){socket[_0xeb62('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x3409db['query'][_0xeb62('0x73')][_0x506aaa]),'WhatsappAccountId':Number(_0x3409db['params']['id'])});}}else{socket[_0xeb62('0x76')](_0xeb62('0x7a'),{'UserId':Number(_0x3409db[_0xeb62('0x48')]['ids']),'WhatsappAccountId':Number(_0x3409db[_0xeb62('0x5a')]['id'])});}});}})[_0xeb62('0x3b')](respondWithStatusCode(_0x13f8e2,null))[_0xeb62('0x30')](handleError(_0x13f8e2,null));};exports[_0xeb62('0x7b')]=function(_0x37da44,_0x10731b,_0x369e59){var _0xb6826b={};var _0x4e25ac={};var _0x499b00;var _0x3fa8cf;return db[_0xeb62('0x43')][_0xeb62('0x6b')]({'where':{'id':_0x37da44['params']['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x10731b,null))[_0xeb62('0x3b')](function(_0xf3b5ac){if(_0xf3b5ac){_0x499b00=_0xf3b5ac;_0x4e25ac[_0xeb62('0x46')]=_[_0xeb62('0x49')](db['User'][_0xeb62('0x44')]);_0x4e25ac[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x37da44[_0xeb62('0x48')]);_0x4e25ac[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x4e25ac[_0xeb62('0x46')],_0x4e25ac[_0xeb62('0x48')]);_0xb6826b[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x4e25ac['model'],qs[_0xeb62('0x4c')](_0x37da44[_0xeb62('0x48')]['fields']));_0xb6826b['attributes']=_0xb6826b[_0xeb62('0x4b')][_0xeb62('0x4d')]?_0xb6826b[_0xeb62('0x4b')]:_0x4e25ac[_0xeb62('0x46')];_0xb6826b[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x37da44[_0xeb62('0x48')][_0xeb62('0x50')]);_0xb6826b[_0xeb62('0x51')]=qs['filters'](_['pick'](_0x37da44[_0xeb62('0x48')],_0x4e25ac[_0xeb62('0x4a')]));if(_0x37da44['query']['filter']){_0xb6826b[_0xeb62('0x51')]=_[_0xeb62('0x53')](_0xb6826b[_0xeb62('0x51')],{'$or':_['map'](_0xb6826b['attributes'],function(_0x17aeb5){var _0x57007e={};_0x57007e[_0x17aeb5]={'$like':'%'+_0x37da44[_0xeb62('0x48')][_0xeb62('0x56')]+'%'};return _0x57007e;})});}_0xb6826b=_[_0xeb62('0x53')]({},_0xb6826b,_0x37da44['options']);return _0x499b00['getAgents'](_0xb6826b);}})['then'](function(_0x198f63){if(_0x198f63){_0x3fa8cf=_0x198f63[_0xeb62('0x4d')];if(!_0x37da44[_0xeb62('0x48')][_0xeb62('0x6c')]('nolimit')){_0xb6826b[_0xeb62('0x37')]=qs[_0xeb62('0x37')](_0x37da44[_0xeb62('0x48')][_0xeb62('0x37')]);_0xb6826b[_0xeb62('0x36')]=qs[_0xeb62('0x36')](_0x37da44[_0xeb62('0x48')][_0xeb62('0x36')]);}return _0x499b00['getAgents'](_0xb6826b);}})[_0xeb62('0x3b')](function(_0x110a00){if(_0x110a00){return _0x110a00?{'count':_0x3fa8cf,'rows':_0x110a00}:null;}})[_0xeb62('0x3b')](respondWithResult(_0x10731b,null))[_0xeb62('0x30')](handleError(_0x10731b,null));};exports['addApplications']=function(_0x60237b,_0x1f84f0,_0x497cea){return db[_0xeb62('0x43')][_0xeb62('0x6b')]({'where':{'id':_0x60237b[_0xeb62('0x5a')]['id']}})[_0xeb62('0x3b')](handleEntityNotFound(_0x1f84f0,null))[_0xeb62('0x3b')](function(_0x4653b6){if(_0x4653b6){return db[_0xeb62('0x7c')]['transaction'](function(_0x247bed){return db['WhatsappApplication'][_0xeb62('0x3c')]({'where':{'WhatsappAccountId':_0x60237b[_0xeb62('0x5a')]['id']},'transaction':_0x247bed})[_0xeb62('0x3b')](function(_0x4f8597){var _0x4b4358=_[_0xeb62('0x47')](_0x60237b[_0xeb62('0x66')],function(_0x2e27a5){_0x2e27a5[_0xeb62('0x68')]=_0x60237b[_0xeb62('0x5a')]['id'];return _0x2e27a5;});return db[_0xeb62('0x7d')][_0xeb62('0x7e')](_0x4b4358,{'transaction':_0x247bed});});})[_0xeb62('0x3b')](function(){return db[_0xeb62('0x7d')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x60237b[_0xeb62('0x5a')]['id']},'order':_0xeb62('0x7f')});});}})[_0xeb62('0x3b')](respondWithResult(_0x1f84f0,null))[_0xeb62('0x30')](handleError(_0x1f84f0,null));};exports[_0xeb62('0x80')]=function(_0x4dc827,_0x36a455,_0x47f64b){var _0x185d14={};var _0x2d2b3c={};var _0x129fbc;var _0x2814d2;return db['WhatsappAccount']['findOne']({'where':{'id':_0x4dc827['params']['id']}})['then'](handleEntityNotFound(_0x36a455,null))[_0xeb62('0x3b')](function(_0x5933a1){if(_0x5933a1){_0x129fbc=_0x5933a1;_0x2d2b3c[_0xeb62('0x46')]=_[_0xeb62('0x49')](db[_0xeb62('0x7d')][_0xeb62('0x44')]);_0x2d2b3c[_0xeb62('0x48')]=_[_0xeb62('0x49')](_0x4dc827[_0xeb62('0x48')]);_0x2d2b3c[_0xeb62('0x4a')]=_[_0xeb62('0x5b')](_0x2d2b3c[_0xeb62('0x46')],_0x2d2b3c['query']);_0x185d14[_0xeb62('0x4b')]=_[_0xeb62('0x5b')](_0x2d2b3c[_0xeb62('0x46')],qs[_0xeb62('0x4c')](_0x4dc827[_0xeb62('0x48')][_0xeb62('0x4c')]));_0x185d14[_0xeb62('0x4b')]=_0x185d14[_0xeb62('0x4b')][_0xeb62('0x4d')]?_0x185d14['attributes']:_0x2d2b3c[_0xeb62('0x46')];_0x185d14[_0xeb62('0x4f')]=qs[_0xeb62('0x50')](_0x4dc827['query'][_0xeb62('0x50')]);_0x185d14['where']=qs[_0xeb62('0x4a')](_[_0xeb62('0x52')](_0x4dc827['query'],_0x2d2b3c[_0xeb62('0x4a')]));if(_0x4dc827['query'][_0xeb62('0x56')]){_0x185d14[_0xeb62('0x51')]=_[_0xeb62('0x53')](_0x185d14[_0xeb62('0x51')],{'$or':_[_0xeb62('0x47')](_0x185d14[_0xeb62('0x4b')],function(_0x38e8ab){var _0xc183c7={};_0xc183c7[_0x38e8ab]={'$like':'%'+_0x4dc827[_0xeb62('0x48')][_0xeb62('0x56')]+'%'};return _0xc183c7;})});}_0x185d14=_['merge']({},_0x185d14,_0x4dc827[_0xeb62('0x57')]);return _0x129fbc[_0xeb62('0x80')](_0x185d14);}})[_0xeb62('0x3b')](function(_0x4bb3cd){if(_0x4bb3cd){_0x2814d2=_0x4bb3cd[_0xeb62('0x4d')];if(!_0x4dc827['query']['hasOwnProperty']('nolimit')){_0x185d14['limit']=qs[_0xeb62('0x37')](_0x4dc827[_0xeb62('0x48')]['limit']);_0x185d14[_0xeb62('0x36')]=qs[_0xeb62('0x36')](_0x4dc827[_0xeb62('0x48')][_0xeb62('0x36')]);}return _0x129fbc[_0xeb62('0x80')](_0x185d14);}})[_0xeb62('0x3b')](function(_0xe5fbf){if(_0xe5fbf){return _0xe5fbf?{'count':_0x2814d2,'rows':_0xe5fbf}:null;}})[_0xeb62('0x3b')](respondWithResult(_0x36a455,null))[_0xeb62('0x30')](handleError(_0x36a455,null));};exports[_0xeb62('0x81')]=function(_0x15aa4e,_0x51146f,_0xc8c0dd){var _0x4c56a2={'channel':_0xeb62('0x82')};var _0xd33486=[];var _0x2750a9=[];var _0x4f045a={};return db[_0xeb62('0x43')][_0xeb62('0x5c')]({'where':{'id':_0x15aa4e[_0xeb62('0x5a')]['id']},'include':[{'model':db[_0xeb62('0x7d')],'as':_0xeb62('0x83')}]})[_0xeb62('0x3b')](handleEntityNotFound(_0x51146f,null))['then'](function(_0x5782de){_0x4c56a2['account']=_0x5782de;_0x4c56a2[_0xeb62('0x84')]=_[_0xeb62('0x85')](_0x5782de[_0xeb62('0x83')],[_0xeb62('0x7f')],['asc']);if(_0x4c56a2[_0xeb62('0x86')]['Applications']){delete _0x4c56a2[_0xeb62('0x86')]['Applications'];}return db['CmContact'][_0xeb62('0x67')]();})[_0xeb62('0x3b')](function(_0x21aef2){if(!_0x21aef2){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))](_0xeb62('0x87'));}_0xd33486=_[_0xeb62('0x88')](_[_0xeb62('0x49')](_0x21aef2),[_0xeb62('0x89'),_0xeb62('0x8a')]);_0x2750a9=_[_0xeb62('0x88')](_[_0xeb62('0x49')](_0x21aef2),['createdAt',_0xeb62('0x8a'),'CompanyId',_0xeb62('0x8b')]);_0x4c56a2[_0xeb62('0x66')]={'mapKey':_0xeb62('0x8c')};if(_0x4c56a2[_0xeb62('0x86')]['type']&&_0x4c56a2[_0xeb62('0x86')][_0xeb62('0x54')]===_0xeb62('0x8d')){_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x8e')]=_0x15aa4e['body'][_0xeb62('0x8f')][_0xeb62('0x90')]('whatsapp:','');_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x66')]=_0x15aa4e[_0xeb62('0x66')][_0xeb62('0x91')];_0x4c56a2['body']['messageId']=_0x15aa4e['body']['MessageSid'];}if(_0x4c56a2[_0xeb62('0x66')]['id']){delete _0x4c56a2[_0xeb62('0x66')]['id'];}if(_[_0xeb62('0x92')](_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x8e')])){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))]('from\x20is\x20mandatory');}if(_[_0xeb62('0x92')](_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x66')])||_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x66')]===''){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xeb62('0x92')](_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x93')])){throw new db[(_0xeb62('0x23'))]['ValidationError'](_0xeb62('0x94')+_0x2750a9);}if(!_[_0xeb62('0x95')](_0x2750a9,_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x93')])){throw new db['Sequelize'][(_0xeb62('0x24'))](_0xeb62('0x96')+_0x2750a9);}_0x4f045a[_0x4c56a2[_0xeb62('0x66')]['mapKey']]=_0x4c56a2[_0xeb62('0x66')]['from'];return db[_0xeb62('0x97')][_0xeb62('0x5c')]({'where':{'id':_0x4c56a2[_0xeb62('0x86')]['ListId']},'include':[{'model':db[_0xeb62('0x98')],'as':'Contacts','where':_0x4f045a,'limit':0x1,'order':[[_0xeb62('0x8a'),_0xeb62('0x99')]]}]});})['then'](handleEntityNotFound(_0x51146f,null))['then'](function(_0xa2aa96){if(_0xa2aa96){_0x4c56a2[_0xeb62('0x9a')]=_[_0xeb62('0x9b')](_0xa2aa96,['Contacts']);if(_0xa2aa96[_0xeb62('0x9c')][_0xeb62('0x4d')]){return _0xa2aa96[_0xeb62('0x9c')][0x0];}var _0x50476a=_[_0xeb62('0x1a')](_0x4c56a2[_0xeb62('0x66')],{'firstName':_0x4c56a2['body'][_0xeb62('0x8e')],'ListId':_0xa2aa96['id']});_0x50476a[_0x4c56a2['body'][_0xeb62('0x93')]]=_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x8e')];return db[_0xeb62('0x98')][_0xeb62('0x5d')](_0x50476a,{'fields':_0xd33486,'raw':!![]});}})[_0xeb62('0x3b')](handleEntityNotFound(_0x51146f,null))['then'](function(_0x25fa4b){if(_0x25fa4b){_0x4c56a2['contact']=_0x25fa4b;var _0x47ad09={'ContactId':_0x25fa4b['id'],'phone':_0x4c56a2['body'][_0xeb62('0x8e')],'WhatsappAccountId':_0x15aa4e[_0xeb62('0x5a')]['id']};var _0x14da9d={'ContactId':_0x25fa4b['id'],'WhatsappAccountId':_0x15aa4e[_0xeb62('0x5a')]['id'],'closed':![]};return db[_0xeb62('0x9d')][_0xeb62('0x5c')]({'where':_0x14da9d})[_0xeb62('0x3b')](function(_0x525068){if(_0x525068){return[_0x525068,![]];}return db[_0xeb62('0x9d')][_0xeb62('0x5d')](_0x47ad09)[_0xeb62('0x3b')](function(_0x31c8db){return[_0x31c8db,!![]];});});}})['spread'](function(_0x3b10aa,_0x4807d2){_0x4c56a2[_0xeb62('0x9e')]=_0x3b10aa[_0xeb62('0x3d')]({'plain':!![]});_0x4c56a2[_0xeb62('0x9e')][_0xeb62('0x9f')]=![];if(_0x4807d2){if(_0x4c56a2[_0xeb62('0x86')][_0xeb62('0xa0')]){_0x4c56a2['applications'][_0xeb62('0xa1')]({'id':0x0,'priority':_0x4c56a2[_0xeb62('0x84')][_0xeb62('0x4d')]+0x1,'app':_0xeb62('0xa2'),'appdata':_0xeb62('0xa3'),'interval':_0xeb62('0xa4')});}_0x4c56a2['interaction'][_0xeb62('0x9f')]=!![];}return db[_0xeb62('0xa5')][_0xeb62('0x5d')]({'phone':_0x4c56a2[_0xeb62('0x66')][_0xeb62('0x8e')],'messageId':_0x4c56a2['body']['messageId'],'body':_0x4c56a2[_0xeb62('0x66')]['body'],'WhatsappAccountId':_0x15aa4e['params']['id'],'WhatsappInteractionId':_0x3b10aa['id'],'direction':'in','ContactId':_0x3b10aa['ContactId'],'AttachmentId':_0x4c56a2[_0xeb62('0x66')]['AttachmentId']});})[_0xeb62('0x3b')](function(_0x35d95b){_0x4c56a2[_0xeb62('0x2e')]=_0x35d95b;if(_0x4c56a2[_0xeb62('0x9e')]['UserId']){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x4c56a2[_0xeb62('0x9e')][_0xeb62('0xa6')]}})[_0xeb62('0x3b')](function(_0x38d61b){if(_0x38d61b){_0x4c56a2['applications'][_0xeb62('0xa7')]({'id':0x0,'priority':0x0,'app':_0xeb62('0xa8'),'appdata':_0x38d61b[_0xeb62('0x3f')]+','+(_0x4c56a2[_0xeb62('0x86')][_0xeb62('0xa9')]||0xa),'interval':_0xeb62('0xa4')});}return respondWithRpcPromise(_0xeb62('0xaa'),_0xeb62('0xab'),_0x4c56a2);});}return respondWithRpcPromise(_0xeb62('0xaa'),_0xeb62('0xab'),_0x4c56a2);})['then'](function(_0xf1d63e){if(_0xf1d63e){var _0x16d9a7=0xc8;var _0x4b0f92=_0xeb62('0xac');logger[_0xeb62('0x27')](_0xeb62('0x2b'),_0x4b0f92,_0x16d9a7,_0xeb62('0xad'));logger[_0xeb62('0x2a')](_0xeb62('0xae'),_0x4b0f92,_0x16d9a7,'entity\x20found',JSON[_0xeb62('0xaf')](_0xf1d63e));if(_0x4c56a2['account'][_0xeb62('0x54')]===_0xeb62('0x8d')){return _0x51146f['status'](_0x16d9a7)[_0xeb62('0x38')](_0xeb62('0xb0'),_0xeb62('0xb1'))[_0xeb62('0x40')](_0xeb62('0xb2'));}else{return _0x51146f['status'](_0x16d9a7)[_0xeb62('0x34')](_0xf1d63e);}}})[_0xeb62('0x30')](handleError(_0x51146f,null));};exports[_0xeb62('0x40')]=function(_0x580f2f,_0xad9214,_0x563133){var _0x37f856,_0x47c79b,_0x177937;if(_[_0xeb62('0x92')](_0x580f2f[_0xeb62('0x66')]['body'])||_0x580f2f['body'][_0xeb62('0x66')]===''){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))](_0xeb62('0xb3'));}if(_[_0xeb62('0x92')](_0x580f2f[_0xeb62('0x66')]['to'])){throw new db[(_0xeb62('0x23'))][(_0xeb62('0x24'))]('to\x20is\x20mandatory');}_0x37f856=_0x580f2f[_0xeb62('0x66')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x580f2f[_0xeb62('0x5a')]['id']},'include':[{'model':db[_0xeb62('0x97')],'as':'List','include':[{'model':db[_0xeb62('0x98')],'as':_0xeb62('0x9c'),'where':{'mobile':_0x37f856},'limit':0x1,'order':[[_0xeb62('0x8a'),_0xeb62('0x99')]]}]}]})[_0xeb62('0x3b')](handleEntityNotFound(_0xad9214,null))[_0xeb62('0x3b')](function(_0xf6a52c){if(_0xf6a52c&&_0xf6a52c[_0xeb62('0xb4')]){_0x47c79b=_0xf6a52c[_0xeb62('0x3d')]({'plain':!![]});if(_0x47c79b[_0xeb62('0xb4')]&&_0x47c79b[_0xeb62('0xb4')][_0xeb62('0x9c')][_0xeb62('0x4d')]){return _0x47c79b[_0xeb62('0xb4')][_0xeb62('0x9c')][0x0];}return db[_0xeb62('0x98')]['create'](_[_0xeb62('0x1a')](_0x580f2f[_0xeb62('0x66')],{'firstName':_0x37f856,'mobile':_0x37f856,'phone':_0x37f856,'ListId':_0x47c79b[_0xeb62('0x8b')]}));}})[_0xeb62('0x3b')](handleEntityNotFound(_0xad9214,null))[_0xeb62('0x3b')](function(_0x527b5b){if(_0x527b5b){_0x177937=_0x527b5b;return db[_0xeb62('0x9d')][_0xeb62('0x5c')]({'where':{'ContactId':_0x177937['id'],'closed':![],'WhatsappAccountId':_0x47c79b['id']}})[_0xeb62('0x3b')](function(_0x1f8355){if(_0x1f8355){return[_0x1f8355,![]];}return db['WhatsappInteraction'][_0xeb62('0x5d')]({'UserId':_0x580f2f['user']['id'],'ContactId':_0x177937['id'],'WhatsappAccountId':_0x47c79b['id'],'phone':_0x37f856,'firstMsgDirection':_0xeb62('0xb5'),'Messages':[_[_0xeb62('0x53')](_0x580f2f[_0xeb62('0x66')],{'read':![],'body':_0x580f2f[_0xeb62('0x66')][_0xeb62('0x66')],'phone':_0x37f856,'WhatsappAccountId':_0x47c79b['id'],'UserId':_0x580f2f[_0xeb62('0x5e')]['id'],'ContactId':_0x177937['id']})]},{'include':[{'model':db[_0xeb62('0xa5')],'as':_0xeb62('0xb6')}]})[_0xeb62('0x3b')](function(_0x1caab8){return[_0x1caab8,!![]];});});}})[_0xeb62('0x75')](function(_0x1a6ec1,_0x1a5dab){if(_0x1a5dab){return _0x1a6ec1;}return db[_0xeb62('0xa5')]['create'](_[_0xeb62('0x53')](_0x580f2f[_0xeb62('0x66')],{'read':![],'body':_0x580f2f['body']['body'],'phone':_0x37f856,'WhatsappAccountId':_0x47c79b['id'],'WhatsappInteractionId':_0x1a6ec1['id'],'UserId':_0x580f2f[_0xeb62('0x5e')]['id'],'ContactId':_0x177937['id']}))['then'](function(_0x5648c1){_0x1a6ec1[_0xeb62('0xb7')][_0xeb62('0xb6')]=[];_0x1a6ec1['dataValues'][_0xeb62('0xb6')][_0xeb62('0xa1')](_0x5648c1[_0xeb62('0xb7')]);return _0x1a6ec1;});})['then'](respondWithResult(_0xad9214,null))[_0xeb62('0x30')](handleError(_0xad9214,null));}; \ No newline at end of file +var _0xd8b0=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','sendStatus','end','status','limit','set','apply','reject','save','update','then','get','WhatsappAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','sort','filter','merge','where','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','fields','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','params','describe','addDisposition','getDispositions','findOne','Disposition','order','pick','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','emit','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','applications','orderBy','account','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC','contact','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','json','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','WhatsappInteraction','out','Messages','dataValues','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x2fd9be,_0x173916){var _0x32a61a=function(_0x4f6eba){while(--_0x4f6eba){_0x2fd9be['push'](_0x2fd9be['shift']());}};_0x32a61a(++_0x173916);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];config[_0x0d8b('0x16')]=_[_0x0d8b('0x17')](config[_0x0d8b('0x16')],{'host':_0x0d8b('0x18'),'port':0x18eb});var socket=require(_0x0d8b('0x19'))(new Redis(config[_0x0d8b('0x16')]));require(_0x0d8b('0x1a'))[_0x0d8b('0x1b')](socket);var jayson=require(_0x0d8b('0x1c'));var client=jayson[_0x0d8b('0x1d')][_0x0d8b('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x2d4e1c,_0x4f6f21,_0x23eb7b){if(_0x23eb7b){var _0xa86349=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa86349[_0x0d8b('0x1f')](_0x4f6f21)){return _0x2d4e1c;}else{throw new db[(_0x0d8b('0x20'))][(_0x0d8b('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 _0x2d4e1c;}}function respondWithRpcPromise(_0x106a01,_0x4586c2,_0x2fd0fc,_0x5fecbd){return new BPromise(function(_0x333674,_0x18dd2d){var _0x264b39=_0x5fecbd||client;return _0x264b39[_0x0d8b('0x22')](_0x106a01,_0x2fd0fc)['then'](function(_0x27512e){logger[_0x0d8b('0x23')](_0x0d8b('0x24'),_0x4586c2,_0x0d8b('0x25'));logger[_0x0d8b('0x26')](_0x0d8b('0x27'),_0x4586c2,_0x0d8b('0x25'),JSON[_0x0d8b('0x28')](_0x27512e));if(_0x27512e['error']){if(_0x27512e['error'][_0x0d8b('0x29')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4586c2,_0x27512e['error'][_0x0d8b('0x2a')]);return _0x18dd2d(_0x27512e[_0x0d8b('0x2b')][_0x0d8b('0x2a')]);}logger[_0x0d8b('0x2b')](_0x0d8b('0x24'),_0x4586c2,_0x27512e[_0x0d8b('0x2b')][_0x0d8b('0x2a')]);return _0x333674(_0x27512e[_0x0d8b('0x2b')][_0x0d8b('0x2a')]);}else{logger['info'](_0x0d8b('0x24'),_0x4586c2,_0x0d8b('0x25'));_0x333674(_0x27512e['result'][_0x0d8b('0x2a')]);}})['catch'](function(_0x3dd149){logger[_0x0d8b('0x2b')](_0x0d8b('0x24'),_0x4586c2,_0x3dd149);_0x18dd2d(_0x3dd149);});});}function respondWithStatusCode(_0x4fe6f9,_0x59a905){_0x59a905=_0x59a905||0xcc;return function(_0x28f639){if(_0x28f639){return _0x4fe6f9[_0x0d8b('0x2c')](_0x59a905);}return _0x4fe6f9['status'](_0x59a905)[_0x0d8b('0x2d')]();};}function respondWithResult(_0x59aa83,_0x1b2b59){_0x1b2b59=_0x1b2b59||0xc8;return function(_0x4b59e5){if(_0x4b59e5){return _0x59aa83[_0x0d8b('0x2e')](_0x1b2b59)['json'](_0x4b59e5);}};}function respondWithFilteredResult(_0x2ab00d,_0x546bf6){return function(_0x3829c6){if(_0x3829c6){var _0x544735=_0x3829c6['count'],_0x3c8887=_0x546bf6['offset'],_0x106e4c=_0x546bf6['offset']+_0x546bf6[_0x0d8b('0x2f')],_0x2c058d;if(_0x106e4c>=_0x544735){_0x106e4c=_0x544735;_0x2c058d=0xc8;}else{_0x2c058d=0xce;}_0x2ab00d['status'](_0x2c058d);return _0x2ab00d[_0x0d8b('0x30')]('Content-Range',_0x3c8887+'-'+_0x106e4c+'/'+_0x544735)['json'](_0x3829c6);}return null;};}function patchUpdates(_0x36017a){return function(_0x1b6920){try{jsonpatch[_0x0d8b('0x31')](_0x1b6920,_0x36017a,!![]);}catch(_0xdeee5d){return BPromise[_0x0d8b('0x32')](_0xdeee5d);}return _0x1b6920[_0x0d8b('0x33')]();};}function saveUpdates(_0x4a99d3,_0x6f93c7){return function(_0x553e03){if(_0x553e03){return _0x553e03[_0x0d8b('0x34')](_0x4a99d3)[_0x0d8b('0x35')](function(_0x4b3ea0){return _0x4b3ea0;});}return null;};}function removeEntity(_0xb18586,_0x23f7f6){return function(_0x18a905){if(_0x18a905){return _0x18a905['destroy']()[_0x0d8b('0x35')](function(){var _0x2c507e=_0x18a905[_0x0d8b('0x36')]({'plain':!![]});var _0x31ceba=_0x0d8b('0x37');return db['UserProfileResource'][_0x0d8b('0x38')]({'where':{'type':_0x31ceba,'resourceId':_0x2c507e['id']}})[_0x0d8b('0x35')](function(){return _0x18a905;});})['then'](function(){_0xb18586[_0x0d8b('0x2e')](0xcc)[_0x0d8b('0x2d')]();});}};}function handleEntityNotFound(_0x188af2,_0x974b9b){return function(_0x373544){if(!_0x373544){_0x188af2['sendStatus'](0x194);}return _0x373544;};}function handleError(_0x497a71,_0x41b4f9){_0x41b4f9=_0x41b4f9||0x1f4;return function(_0x5c2c04){logger['error'](_0x5c2c04[_0x0d8b('0x39')]);if(_0x5c2c04[_0x0d8b('0x3a')]){delete _0x5c2c04[_0x0d8b('0x3a')];}_0x497a71[_0x0d8b('0x2e')](_0x41b4f9)[_0x0d8b('0x3b')](_0x5c2c04);};}exports[_0x0d8b('0x3c')]=function(_0x579324,_0x6e5bab){var _0x6a02ad={'include':[{'model':db[_0x0d8b('0x3d')],'as':_0x0d8b('0x3e')}]},_0x28fd82={},_0xe8fad={'count':0x0,'rows':[]};var _0xf1680e=_['map'](db[_0x0d8b('0x3f')][_0x0d8b('0x40')],function(_0x3fa955){return{'name':_0x3fa955[_0x0d8b('0x41')],'type':_0x3fa955['type'][_0x0d8b('0x42')]};});_0x28fd82['model']=_[_0x0d8b('0x43')](_0xf1680e,_0x0d8b('0x3a'));_0x28fd82[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x579324[_0x0d8b('0x44')]);_0x28fd82[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0x28fd82[_0x0d8b('0x48')],_0x28fd82[_0x0d8b('0x44')]);_0x6a02ad[_0x0d8b('0x49')]=_['intersection'](_0x28fd82['model'],qs['fields'](_0x579324['query']['fields']));_0x6a02ad[_0x0d8b('0x49')]=_0x6a02ad[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x6a02ad['attributes']:_0x28fd82['model'];if(!_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4b')](_0x0d8b('0x4c'))){_0x6a02ad['limit']=qs[_0x0d8b('0x2f')](_0x579324[_0x0d8b('0x44')]['limit']);_0x6a02ad['offset']=qs[_0x0d8b('0x4d')](_0x579324['query'][_0x0d8b('0x4d')]);}_0x6a02ad['order']=qs['sort'](_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0x6a02ad['where']=qs['filters'](_['pick'](_0x579324['query'],_0x28fd82[_0x0d8b('0x46')]),_0xf1680e);if(_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0x6a02ad['where']=_[_0x0d8b('0x50')](_0x6a02ad[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0xf1680e,function(_0x98a67a){if(_0x98a67a[_0x0d8b('0x52')]!==_0x0d8b('0x53')){var _0x11d22b={};_0x11d22b[_0x98a67a[_0x0d8b('0x3a')]]={'$like':'%'+_0x579324[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x11d22b;}})});}_0x6a02ad=_[_0x0d8b('0x50')]({},_0x6a02ad,_0x579324[_0x0d8b('0x54')]);var _0x84ef1c={'where':_0x6a02ad[_0x0d8b('0x51')]};return db[_0x0d8b('0x3f')][_0x0d8b('0x55')](_0x84ef1c)[_0x0d8b('0x35')](function(_0x1e162c){_0xe8fad[_0x0d8b('0x55')]=_0x1e162c;if(_0x579324['query'][_0x0d8b('0x56')]){_0x6a02ad['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x0d8b('0x57')](_0x6a02ad);})[_0x0d8b('0x35')](function(_0x3f943a){_0xe8fad[_0x0d8b('0x58')]=_0x3f943a;return _0xe8fad;})['then'](respondWithFilteredResult(_0x6e5bab,_0x6a02ad))[_0x0d8b('0x59')](handleError(_0x6e5bab,null));};exports[_0x0d8b('0x5a')]=function(_0x386074,_0x241587){var _0x45cd22={'raw':![],'where':{'id':_0x386074['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4cd85a={};_0x4cd85a[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db['WhatsappAccount']['rawAttributes']);_0x4cd85a[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x386074['query']);_0x4cd85a['filters']=_[_0x0d8b('0x47')](_0x4cd85a[_0x0d8b('0x48')],_0x4cd85a[_0x0d8b('0x44')]);_0x45cd22[_0x0d8b('0x49')]=_[_0x0d8b('0x47')](_0x4cd85a['model'],qs[_0x0d8b('0x5b')](_0x386074[_0x0d8b('0x44')]['fields']));_0x45cd22['attributes']=_0x45cd22[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x45cd22['attributes']:_0x4cd85a['model'];if(_0x386074[_0x0d8b('0x44')][_0x0d8b('0x56')]){_0x45cd22[_0x0d8b('0x5c')]=[{'all':!![]}];}_0x45cd22=_[_0x0d8b('0x50')]({},_0x45cd22,_0x386074['options']);return db[_0x0d8b('0x3f')]['find'](_0x45cd22)['then'](handleEntityNotFound(_0x241587,null))[_0x0d8b('0x35')](respondWithResult(_0x241587,null))[_0x0d8b('0x59')](handleError(_0x241587,null));};exports['create']=function(_0x4a8f33,_0x44ed23){return db[_0x0d8b('0x3f')][_0x0d8b('0x5d')](_0x4a8f33[_0x0d8b('0x5e')],{})[_0x0d8b('0x35')](function(_0xb66e76){var _0x3978e5=_0x4a8f33[_0x0d8b('0x5f')]['get']({'plain':!![]});if(!_0x3978e5)throw new Error(_0x0d8b('0x60'));if(_0x3978e5[_0x0d8b('0x61')]===_0x0d8b('0x5f')){var _0x3c7efb=_0xb66e76[_0x0d8b('0x36')]({'plain':!![]});var _0x47104e=_0x0d8b('0x37');return db[_0x0d8b('0x62')][_0x0d8b('0x63')]({'where':{'name':_0x47104e,'userProfileId':_0x3978e5['userProfileId']},'raw':!![]})[_0x0d8b('0x35')](function(_0x451940){if(_0x451940&&_0x451940[_0x0d8b('0x64')]===0x0){return db[_0x0d8b('0x65')][_0x0d8b('0x5d')]({'name':_0x3c7efb['name'],'resourceId':_0x3c7efb['id'],'type':_0x451940[_0x0d8b('0x3a')],'sectionId':_0x451940['id']},{})[_0x0d8b('0x35')](function(){return _0xb66e76;});}else{return _0xb66e76;}})[_0x0d8b('0x59')](function(_0x17a87f){logger[_0x0d8b('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17a87f);throw _0x17a87f;});}return _0xb66e76;})['then'](respondWithResult(_0x44ed23,0xc9))[_0x0d8b('0x59')](handleError(_0x44ed23,null));};exports[_0x0d8b('0x34')]=function(_0x3e4a41,_0xbbb520){if(_0x3e4a41['body']['id']){delete _0x3e4a41[_0x0d8b('0x5e')]['id'];}return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x3e4a41['params']['id']},'include':[{'model':db[_0x0d8b('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x0d8b('0x35')](handleEntityNotFound(_0xbbb520,null))[_0x0d8b('0x35')](saveUpdates(_0x3e4a41[_0x0d8b('0x5e')],null))[_0x0d8b('0x35')](respondWithResult(_0xbbb520,null))[_0x0d8b('0x59')](handleError(_0xbbb520,null));};exports[_0x0d8b('0x38')]=function(_0x5b5fdb,_0x382d2e){return db['WhatsappAccount'][_0x0d8b('0x63')]({'where':{'id':_0x5b5fdb[_0x0d8b('0x66')]['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x382d2e,null))[_0x0d8b('0x35')](removeEntity(_0x382d2e,null))['catch'](handleError(_0x382d2e,null));};exports[_0x0d8b('0x67')]=function(_0x34d01f,_0x1a1ba7){return db[_0x0d8b('0x3f')][_0x0d8b('0x67')]()[_0x0d8b('0x35')](respondWithResult(_0x1a1ba7,null))[_0x0d8b('0x59')](handleError(_0x1a1ba7,null));};exports[_0x0d8b('0x68')]=function(_0x2ce282,_0x34affb,_0x57e39a){if(_0x2ce282['body']['id']){delete _0x2ce282[_0x0d8b('0x5e')]['id'];}return db[_0x0d8b('0x3f')]['find']({'where':{'id':_0x2ce282[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x34affb,null))['then'](function(_0x22ee20){if(_0x22ee20){_0x2ce282[_0x0d8b('0x5e')]['WhatsappAccountId']=_0x22ee20['id'];return db['Disposition'][_0x0d8b('0x5d')](_0x2ce282[_0x0d8b('0x5e')]);}})[_0x0d8b('0x35')](respondWithResult(_0x34affb,null))[_0x0d8b('0x59')](handleError(_0x34affb,null));};exports[_0x0d8b('0x69')]=function(_0x156859,_0x40d265,_0x5b4402){var _0x1ca60c={'raw':![],'where':{}};var _0x5878c2={};var _0x1a203e={'count':0x0,'rows':[]};return db[_0x0d8b('0x3f')][_0x0d8b('0x6a')]({'where':{'id':_0x156859[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x40d265,null))[_0x0d8b('0x35')](function(_0x4a1c4a){if(_0x4a1c4a){_0x5878c2[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db[_0x0d8b('0x6b')][_0x0d8b('0x40')]);_0x5878c2[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x156859[_0x0d8b('0x44')]);_0x5878c2[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0x5878c2[_0x0d8b('0x48')],_0x5878c2['query']);_0x1ca60c[_0x0d8b('0x49')]=_['intersection'](_0x5878c2[_0x0d8b('0x48')],qs[_0x0d8b('0x5b')](_0x156859['query'][_0x0d8b('0x5b')]));_0x1ca60c['attributes']=_0x1ca60c[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x1ca60c[_0x0d8b('0x49')]:_0x5878c2[_0x0d8b('0x48')];if(!_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4b')](_0x0d8b('0x4c'))){_0x1ca60c[_0x0d8b('0x2f')]=qs['limit'](_0x156859[_0x0d8b('0x44')][_0x0d8b('0x2f')]);_0x1ca60c['offset']=qs[_0x0d8b('0x4d')](_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4d')]);}_0x1ca60c[_0x0d8b('0x6c')]=qs[_0x0d8b('0x4e')](_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0x1ca60c[_0x0d8b('0x51')]=qs[_0x0d8b('0x46')](_[_0x0d8b('0x6d')](_0x156859[_0x0d8b('0x44')],_0x5878c2[_0x0d8b('0x46')]));_0x1ca60c['where'][_0x0d8b('0x6e')]=_0x4a1c4a['id'];if(_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0x1ca60c['where']=_['merge'](_0x1ca60c[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0x1ca60c[_0x0d8b('0x49')],function(_0x5b76af){var _0x5bd5c8={};_0x5bd5c8[_0x5b76af]={'$like':'%'+_0x156859[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x5bd5c8;})});}_0x1ca60c=_[_0x0d8b('0x50')]({},_0x1ca60c,_0x156859[_0x0d8b('0x54')]);return db[_0x0d8b('0x6b')][_0x0d8b('0x55')]({'where':_0x1ca60c[_0x0d8b('0x51')]})[_0x0d8b('0x35')](function(_0x20a3dd){_0x1a203e[_0x0d8b('0x55')]=_0x20a3dd;if(_0x156859[_0x0d8b('0x44')][_0x0d8b('0x56')]){_0x1ca60c[_0x0d8b('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x0d8b('0x57')](_0x1ca60c);})[_0x0d8b('0x35')](function(_0x48c965){_0x1a203e['rows']=_0x48c965;return _0x1a203e;});}})[_0x0d8b('0x35')](respondWithFilteredResult(_0x40d265,_0x1ca60c))[_0x0d8b('0x59')](handleError(_0x40d265,null));};exports[_0x0d8b('0x6f')]=function(_0x14b1b8,_0x23e2e0,_0x354208){return db['WhatsappAccount']['find']({'where':{'id':_0x14b1b8['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x23e2e0,null))[_0x0d8b('0x35')](function(_0x466442){if(_0x466442){return _0x466442[_0x0d8b('0x6f')](_0x14b1b8[_0x0d8b('0x44')][_0x0d8b('0x70')]);}})['then'](respondWithStatusCode(_0x23e2e0,null))[_0x0d8b('0x59')](handleError(_0x23e2e0,null));};exports[_0x0d8b('0x71')]=function(_0x4b3363,_0x30a69d,_0x57e3c2){if(_0x4b3363[_0x0d8b('0x5e')]['id']){delete _0x4b3363[_0x0d8b('0x5e')]['id'];}return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x4b3363[_0x0d8b('0x66')]['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x30a69d,null))[_0x0d8b('0x35')](function(_0xb73e32){if(_0xb73e32){_0x4b3363[_0x0d8b('0x5e')][_0x0d8b('0x6e')]=_0xb73e32['id'];return db[_0x0d8b('0x72')][_0x0d8b('0x5d')](_0x4b3363['body']);}})['then'](respondWithResult(_0x30a69d,null))[_0x0d8b('0x59')](handleError(_0x30a69d,null));};exports[_0x0d8b('0x73')]=function(_0xb4cb89,_0x165ca6,_0xf91ecd){var _0x3c659e={'raw':![],'where':{}};var _0xeadc0c={};var _0x54674f={'count':0x0,'rows':[]};return db[_0x0d8b('0x3f')]['findOne']({'where':{'id':_0xb4cb89[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x165ca6,null))['then'](function(_0x21a914){if(_0x21a914){_0xeadc0c[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db[_0x0d8b('0x72')][_0x0d8b('0x40')]);_0xeadc0c[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0xb4cb89[_0x0d8b('0x44')]);_0xeadc0c[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0xeadc0c[_0x0d8b('0x48')],_0xeadc0c[_0x0d8b('0x44')]);_0x3c659e['attributes']=_[_0x0d8b('0x47')](_0xeadc0c[_0x0d8b('0x48')],qs[_0x0d8b('0x5b')](_0xb4cb89['query']['fields']));_0x3c659e[_0x0d8b('0x49')]=_0x3c659e[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0x3c659e[_0x0d8b('0x49')]:_0xeadc0c[_0x0d8b('0x48')];if(!_0xb4cb89[_0x0d8b('0x44')]['hasOwnProperty'](_0x0d8b('0x4c'))){_0x3c659e[_0x0d8b('0x2f')]=qs[_0x0d8b('0x2f')](_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x2f')]);_0x3c659e['offset']=qs['offset'](_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4d')]);}_0x3c659e[_0x0d8b('0x6c')]=qs['sort'](_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0x3c659e[_0x0d8b('0x51')]=qs['filters'](_[_0x0d8b('0x6d')](_0xb4cb89[_0x0d8b('0x44')],_0xeadc0c[_0x0d8b('0x46')]));_0x3c659e[_0x0d8b('0x51')][_0x0d8b('0x6e')]=_0x21a914['id'];if(_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0x3c659e[_0x0d8b('0x51')]=_[_0x0d8b('0x50')](_0x3c659e['where'],{'$or':_[_0x0d8b('0x43')](_0x3c659e[_0x0d8b('0x49')],function(_0x499e9f){var _0x455a08={};_0x455a08[_0x499e9f]={'$like':'%'+_0xb4cb89[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x455a08;})});}_0x3c659e=_[_0x0d8b('0x50')]({},_0x3c659e,_0xb4cb89[_0x0d8b('0x54')]);return db[_0x0d8b('0x72')]['count']({'where':_0x3c659e['where']})[_0x0d8b('0x35')](function(_0x3c6ae1){_0x54674f[_0x0d8b('0x55')]=_0x3c6ae1;if(_0xb4cb89[_0x0d8b('0x44')]['includeAll']){_0x3c659e[_0x0d8b('0x5c')]=[{'all':!![]}];}return db[_0x0d8b('0x72')]['findAll'](_0x3c659e);})[_0x0d8b('0x35')](function(_0x4e1b5b){_0x54674f[_0x0d8b('0x58')]=_0x4e1b5b;return _0x54674f;});}})[_0x0d8b('0x35')](respondWithFilteredResult(_0x165ca6,_0x3c659e))[_0x0d8b('0x59')](handleError(_0x165ca6,null));};exports[_0x0d8b('0x74')]=function(_0x36a82f,_0x12c39a,_0x242e6c){return db[_0x0d8b('0x3f')]['find']({'where':{'id':_0x36a82f[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x12c39a,null))['then'](function(_0x35bd36){if(_0x35bd36){return _0x35bd36['removeAnswers'](_0x36a82f[_0x0d8b('0x44')][_0x0d8b('0x70')]);}})['then'](respondWithStatusCode(_0x12c39a,null))[_0x0d8b('0x59')](handleError(_0x12c39a,null));};exports['addAgents']=function(_0x5f3f6f,_0x456642,_0x52c895){return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x5f3f6f[_0x0d8b('0x66')]['id']}})['then'](handleEntityNotFound(_0x456642,null))['then'](function(_0x32a60d){if(_0x32a60d){return _0x32a60d[_0x0d8b('0x75')](_0x5f3f6f[_0x0d8b('0x5e')][_0x0d8b('0x70')],_[_0x0d8b('0x76')](_0x5f3f6f[_0x0d8b('0x5e')],[_0x0d8b('0x70'),'id'])||{})[_0x0d8b('0x77')](function(_0x4e3dd1){for(var _0x5ab046=0x0;_0x5ab046<_0x5f3f6f[_0x0d8b('0x5e')][_0x0d8b('0x70')]['length'];_0x5ab046+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x5f3f6f[_0x0d8b('0x5e')][_0x0d8b('0x70')][_0x5ab046],'WhatsappAccountId':_0x5f3f6f[_0x0d8b('0x66')]['id']});}return _0x4e3dd1;});}})['then'](respondWithResult(_0x456642,null))[_0x0d8b('0x59')](handleError(_0x456642,null));};exports[_0x0d8b('0x78')]=function(_0x16afb8,_0x4e428d,_0x3c7f16){return db['WhatsappAccount'][_0x0d8b('0x63')]({'where':{'id':_0x16afb8['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x4e428d,null))[_0x0d8b('0x35')](function(_0x43be3c){if(_0x43be3c){return _0x43be3c[_0x0d8b('0x78')](_0x16afb8[_0x0d8b('0x44')]['ids'])[_0x0d8b('0x35')](function(){if(_['isArray'](_0x16afb8[_0x0d8b('0x44')]['ids'])){for(var _0x165baa=0x0;_0x165baa<_0x16afb8['query']['ids'][_0x0d8b('0x4a')];_0x165baa+=0x1){socket[_0x0d8b('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x16afb8[_0x0d8b('0x44')][_0x0d8b('0x70')][_0x165baa]),'WhatsappAccountId':Number(_0x16afb8[_0x0d8b('0x66')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x16afb8['query'][_0x0d8b('0x70')]),'WhatsappAccountId':Number(_0x16afb8[_0x0d8b('0x66')]['id'])});}});}})[_0x0d8b('0x35')](respondWithStatusCode(_0x4e428d,null))[_0x0d8b('0x59')](handleError(_0x4e428d,null));};exports[_0x0d8b('0x7a')]=function(_0x2a8e14,_0x1d3817,_0x123b77){var _0xa17410={};var _0xba602f={};var _0x4dc5bd;var _0x2e7343;return db[_0x0d8b('0x3f')][_0x0d8b('0x6a')]({'where':{'id':_0x2a8e14['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x1d3817,null))[_0x0d8b('0x35')](function(_0x13bce2){if(_0x13bce2){_0x4dc5bd=_0x13bce2;_0xba602f[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db[_0x0d8b('0x7b')][_0x0d8b('0x40')]);_0xba602f[_0x0d8b('0x44')]=_[_0x0d8b('0x45')](_0x2a8e14[_0x0d8b('0x44')]);_0xba602f[_0x0d8b('0x46')]=_[_0x0d8b('0x47')](_0xba602f['model'],_0xba602f[_0x0d8b('0x44')]);_0xa17410[_0x0d8b('0x49')]=_[_0x0d8b('0x47')](_0xba602f[_0x0d8b('0x48')],qs['fields'](_0x2a8e14['query'][_0x0d8b('0x5b')]));_0xa17410[_0x0d8b('0x49')]=_0xa17410[_0x0d8b('0x49')]['length']?_0xa17410['attributes']:_0xba602f['model'];_0xa17410[_0x0d8b('0x6c')]=qs['sort'](_0x2a8e14[_0x0d8b('0x44')][_0x0d8b('0x4e')]);_0xa17410[_0x0d8b('0x51')]=qs[_0x0d8b('0x46')](_[_0x0d8b('0x6d')](_0x2a8e14[_0x0d8b('0x44')],_0xba602f[_0x0d8b('0x46')]));if(_0x2a8e14[_0x0d8b('0x44')]['filter']){_0xa17410[_0x0d8b('0x51')]=_[_0x0d8b('0x50')](_0xa17410[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0xa17410['attributes'],function(_0x3b4a92){var _0x62fedf={};_0x62fedf[_0x3b4a92]={'$like':'%'+_0x2a8e14[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x62fedf;})});}_0xa17410=_['merge']({},_0xa17410,_0x2a8e14[_0x0d8b('0x54')]);return _0x4dc5bd[_0x0d8b('0x7a')](_0xa17410);}})[_0x0d8b('0x35')](function(_0x127d6b){if(_0x127d6b){_0x2e7343=_0x127d6b['length'];if(!_0x2a8e14[_0x0d8b('0x44')]['hasOwnProperty'](_0x0d8b('0x4c'))){_0xa17410['limit']=qs[_0x0d8b('0x2f')](_0x2a8e14['query'][_0x0d8b('0x2f')]);_0xa17410['offset']=qs[_0x0d8b('0x4d')](_0x2a8e14['query'][_0x0d8b('0x4d')]);}return _0x4dc5bd['getAgents'](_0xa17410);}})[_0x0d8b('0x35')](function(_0x5ebfe0){if(_0x5ebfe0){return _0x5ebfe0?{'count':_0x2e7343,'rows':_0x5ebfe0}:null;}})[_0x0d8b('0x35')](respondWithResult(_0x1d3817,null))[_0x0d8b('0x59')](handleError(_0x1d3817,null));};exports['addApplications']=function(_0x4ea6fb,_0x4cff45,_0x42b956){return db['WhatsappAccount'][_0x0d8b('0x6a')]({'where':{'id':_0x4ea6fb['params']['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x4cff45,null))[_0x0d8b('0x35')](function(_0x120350){if(_0x120350){return db[_0x0d8b('0x7c')][_0x0d8b('0x7d')](function(_0x3d5e21){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x4ea6fb[_0x0d8b('0x66')]['id']},'transaction':_0x3d5e21})['then'](function(_0xf3c16a){var _0x28393f=_[_0x0d8b('0x43')](_0x4ea6fb['body'],function(_0x47251c){_0x47251c['WhatsappAccountId']=_0x4ea6fb[_0x0d8b('0x66')]['id'];return _0x47251c;});return db[_0x0d8b('0x7e')][_0x0d8b('0x7f')](_0x28393f,{'transaction':_0x3d5e21});});})[_0x0d8b('0x35')](function(){return db['WhatsappApplication'][_0x0d8b('0x80')]({'where':{'WhatsappAccountId':_0x4ea6fb[_0x0d8b('0x66')]['id']},'order':_0x0d8b('0x81')});});}})['then'](respondWithResult(_0x4cff45,null))[_0x0d8b('0x59')](handleError(_0x4cff45,null));};exports['getApplications']=function(_0x3a2d0e,_0x28868a,_0x2c00b6){var _0xfc414a={};var _0x19f64c={};var _0x2f4cfd;var _0x278b23;return db[_0x0d8b('0x3f')][_0x0d8b('0x6a')]({'where':{'id':_0x3a2d0e[_0x0d8b('0x66')]['id']}})[_0x0d8b('0x35')](handleEntityNotFound(_0x28868a,null))[_0x0d8b('0x35')](function(_0x50b987){if(_0x50b987){_0x2f4cfd=_0x50b987;_0x19f64c[_0x0d8b('0x48')]=_[_0x0d8b('0x45')](db['WhatsappApplication'][_0x0d8b('0x40')]);_0x19f64c['query']=_[_0x0d8b('0x45')](_0x3a2d0e['query']);_0x19f64c[_0x0d8b('0x46')]=_['intersection'](_0x19f64c['model'],_0x19f64c[_0x0d8b('0x44')]);_0xfc414a[_0x0d8b('0x49')]=_['intersection'](_0x19f64c['model'],qs['fields'](_0x3a2d0e['query'][_0x0d8b('0x5b')]));_0xfc414a[_0x0d8b('0x49')]=_0xfc414a[_0x0d8b('0x49')][_0x0d8b('0x4a')]?_0xfc414a[_0x0d8b('0x49')]:_0x19f64c[_0x0d8b('0x48')];_0xfc414a[_0x0d8b('0x6c')]=qs[_0x0d8b('0x4e')](_0x3a2d0e['query'][_0x0d8b('0x4e')]);_0xfc414a['where']=qs[_0x0d8b('0x46')](_['pick'](_0x3a2d0e[_0x0d8b('0x44')],_0x19f64c[_0x0d8b('0x46')]));if(_0x3a2d0e[_0x0d8b('0x44')][_0x0d8b('0x4f')]){_0xfc414a[_0x0d8b('0x51')]=_[_0x0d8b('0x50')](_0xfc414a[_0x0d8b('0x51')],{'$or':_[_0x0d8b('0x43')](_0xfc414a[_0x0d8b('0x49')],function(_0x2f63fe){var _0x44dac0={};_0x44dac0[_0x2f63fe]={'$like':'%'+_0x3a2d0e[_0x0d8b('0x44')][_0x0d8b('0x4f')]+'%'};return _0x44dac0;})});}_0xfc414a=_['merge']({},_0xfc414a,_0x3a2d0e[_0x0d8b('0x54')]);return _0x2f4cfd['getApplications'](_0xfc414a);}})[_0x0d8b('0x35')](function(_0xd682dc){if(_0xd682dc){_0x278b23=_0xd682dc['length'];if(!_0x3a2d0e[_0x0d8b('0x44')]['hasOwnProperty'](_0x0d8b('0x4c'))){_0xfc414a['limit']=qs[_0x0d8b('0x2f')](_0x3a2d0e[_0x0d8b('0x44')][_0x0d8b('0x2f')]);_0xfc414a[_0x0d8b('0x4d')]=qs[_0x0d8b('0x4d')](_0x3a2d0e[_0x0d8b('0x44')]['offset']);}return _0x2f4cfd[_0x0d8b('0x82')](_0xfc414a);}})['then'](function(_0x4402a0){if(_0x4402a0){return _0x4402a0?{'count':_0x278b23,'rows':_0x4402a0}:null;}})[_0x0d8b('0x35')](respondWithResult(_0x28868a,null))[_0x0d8b('0x59')](handleError(_0x28868a,null));};exports[_0x0d8b('0x83')]=function(_0x831064,_0x5cfca3,_0x15e78b){var _0x22ca75={'channel':'whatsapp'};var _0x1f6044=[];var _0x2edc22=[];var _0x29f6c0={};return db[_0x0d8b('0x3f')]['find']({'where':{'id':_0x831064[_0x0d8b('0x66')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x0d8b('0x84')}]})['then'](handleEntityNotFound(_0x5cfca3,null))[_0x0d8b('0x35')](function(_0x34f234){_0x22ca75['account']=_0x34f234;_0x22ca75[_0x0d8b('0x85')]=_[_0x0d8b('0x86')](_0x34f234[_0x0d8b('0x84')],[_0x0d8b('0x81')],['asc']);if(_0x22ca75[_0x0d8b('0x87')]['Applications']){delete _0x22ca75[_0x0d8b('0x87')][_0x0d8b('0x84')];}return db['CmContact'][_0x0d8b('0x67')]();})[_0x0d8b('0x35')](function(_0x3e8e3c){if(!_0x3e8e3c){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x88'));}_0x1f6044=_[_0x0d8b('0x89')](_[_0x0d8b('0x45')](_0x3e8e3c),['createdAt',_0x0d8b('0x8a')]);_0x2edc22=_['difference'](_[_0x0d8b('0x45')](_0x3e8e3c),[_0x0d8b('0x8b'),_0x0d8b('0x8a'),_0x0d8b('0x8c'),_0x0d8b('0x8d')]);_0x22ca75[_0x0d8b('0x5e')]={'mapKey':_0x0d8b('0x8e')};if(_0x22ca75[_0x0d8b('0x87')][_0x0d8b('0x52')]&&_0x22ca75['account'][_0x0d8b('0x52')]===_0x0d8b('0x8f')){_0x22ca75['body'][_0x0d8b('0x90')]=_0x831064[_0x0d8b('0x5e')]['From'][_0x0d8b('0x91')](_0x0d8b('0x92'),'');_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x5e')]=_0x831064[_0x0d8b('0x5e')][_0x0d8b('0x93')];_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x94')]=_0x831064['body'][_0x0d8b('0x95')];}if(_0x22ca75[_0x0d8b('0x5e')]['id']){delete _0x22ca75[_0x0d8b('0x5e')]['id'];}if(_[_0x0d8b('0x96')](_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x90')])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x97'));}if(_[_0x0d8b('0x96')](_0x22ca75[_0x0d8b('0x5e')]['body'])||_0x22ca75['body']['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0d8b('0x96')](_0x22ca75['body'][_0x0d8b('0x98')])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x99')+_0x2edc22);}if(!_[_0x0d8b('0x9a')](_0x2edc22,_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x98')])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0x9b')+_0x2edc22);}_0x29f6c0[_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x98')]]=_0x22ca75['body'][_0x0d8b('0x90')];return db['CmList'][_0x0d8b('0x63')]({'where':{'id':_0x22ca75['account'][_0x0d8b('0x8d')]},'include':[{'model':db[_0x0d8b('0x9c')],'as':_0x0d8b('0x9d'),'where':_0x29f6c0,'limit':0x1,'order':[[_0x0d8b('0x8a'),_0x0d8b('0x9e')]]}]});})['then'](handleEntityNotFound(_0x5cfca3,null))[_0x0d8b('0x35')](function(_0x363518){if(_0x363518){_0x22ca75['list']=_[_0x0d8b('0x76')](_0x363518,['Contacts']);if(_0x363518['Contacts'][_0x0d8b('0x4a')]){return _0x363518[_0x0d8b('0x9d')][0x0];}var _0x427369=_[_0x0d8b('0x17')](_0x22ca75[_0x0d8b('0x5e')],{'firstName':_0x22ca75['body']['from'],'ListId':_0x363518['id']});_0x427369[_0x22ca75['body'][_0x0d8b('0x98')]]=_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x90')];return db[_0x0d8b('0x9c')][_0x0d8b('0x5d')](_0x427369,{'fields':_0x1f6044,'raw':!![]});}})[_0x0d8b('0x35')](handleEntityNotFound(_0x5cfca3,null))['then'](function(_0x20becd){if(_0x20becd){_0x22ca75[_0x0d8b('0x9f')]=_0x20becd;var _0x591816={'ContactId':_0x20becd['id'],'phone':_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x90')],'WhatsappAccountId':_0x831064[_0x0d8b('0x66')]['id']};var _0xfe53a={'ContactId':_0x20becd['id'],'WhatsappAccountId':_0x831064[_0x0d8b('0x66')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0xfe53a})[_0x0d8b('0x35')](function(_0xaf1c9c){if(_0xaf1c9c){return[_0xaf1c9c,![]];}return db['WhatsappInteraction'][_0x0d8b('0x5d')](_0x591816)[_0x0d8b('0x35')](function(_0x3a8bee){return[_0x3a8bee,!![]];});});}})['spread'](function(_0x52f5cc,_0x367c57){_0x22ca75[_0x0d8b('0xa0')]=_0x52f5cc['get']({'plain':!![]});_0x22ca75['interaction'][_0x0d8b('0xa1')]=![];if(_0x367c57){if(_0x22ca75['account'][_0x0d8b('0xa2')]){_0x22ca75['applications'][_0x0d8b('0xa3')]({'id':0x0,'priority':_0x22ca75[_0x0d8b('0x85')]['length']+0x1,'app':_0x0d8b('0xa4'),'appdata':'unmanaged','interval':_0x0d8b('0xa5')});}_0x22ca75[_0x0d8b('0xa0')][_0x0d8b('0xa1')]=!![];}return db[_0x0d8b('0xa6')][_0x0d8b('0x5d')]({'phone':_0x22ca75['body'][_0x0d8b('0x90')],'messageId':_0x22ca75[_0x0d8b('0x5e')][_0x0d8b('0x94')],'body':_0x22ca75['body'][_0x0d8b('0x5e')],'WhatsappAccountId':_0x831064['params']['id'],'WhatsappInteractionId':_0x52f5cc['id'],'direction':'in','ContactId':_0x52f5cc[_0x0d8b('0xa7')],'AttachmentId':_0x22ca75[_0x0d8b('0x5e')]['AttachmentId']});})['then'](function(_0x4b69b6){_0x22ca75[_0x0d8b('0x2a')]=_0x4b69b6;if(_0x22ca75[_0x0d8b('0xa0')]['UserId']){return db[_0x0d8b('0x7b')]['find']({'attributes':['id',_0x0d8b('0x3a')],'where':{'id':_0x22ca75[_0x0d8b('0xa0')][_0x0d8b('0xa8')]}})[_0x0d8b('0x35')](function(_0x2c6aed){if(_0x2c6aed){_0x22ca75[_0x0d8b('0x85')][_0x0d8b('0xa9')]({'id':0x0,'priority':0x0,'app':_0x0d8b('0xaa'),'appdata':_0x2c6aed['name']+','+(_0x22ca75[_0x0d8b('0x87')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0d8b('0xab'),_0x0d8b('0xac'),_0x22ca75);});}return respondWithRpcPromise(_0x0d8b('0xab'),_0x0d8b('0xac'),_0x22ca75);})[_0x0d8b('0x35')](function(_0x25ec9d){if(_0x25ec9d){var _0x2098ed=0xc8;var _0x567b75=_0x0d8b('0xad');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x567b75,_0x2098ed,_0x0d8b('0xae'));logger['debug'](_0x0d8b('0xaf'),_0x567b75,_0x2098ed,'entity\x20found',JSON['stringify'](_0x25ec9d));if(_0x22ca75[_0x0d8b('0x87')][_0x0d8b('0x52')]===_0x0d8b('0x8f')){return _0x5cfca3[_0x0d8b('0x2e')](_0x2098ed)[_0x0d8b('0x30')](_0x0d8b('0xb0'),'text/xml')['send'](_0x0d8b('0xb1'));}else{return _0x5cfca3[_0x0d8b('0x2e')](_0x2098ed)[_0x0d8b('0xb2')](_0x25ec9d);}}})[_0x0d8b('0x59')](handleError(_0x5cfca3,null));};exports[_0x0d8b('0x3b')]=function(_0x206dfd,_0x12816b,_0x474bca){var _0x13d965,_0x228e6c,_0x26fb03;if(_[_0x0d8b('0x96')](_0x206dfd[_0x0d8b('0x5e')]['body'])||_0x206dfd['body']['body']===''){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0xb3'));}if(_[_0x0d8b('0x96')](_0x206dfd[_0x0d8b('0x5e')]['to'])){throw new db[(_0x0d8b('0x20'))][(_0x0d8b('0x21'))](_0x0d8b('0xb4'));}_0x13d965=_0x206dfd[_0x0d8b('0x5e')]['to'];return db[_0x0d8b('0x3f')][_0x0d8b('0x63')]({'where':{'id':_0x206dfd[_0x0d8b('0x66')]['id']},'include':[{'model':db[_0x0d8b('0xb5')],'as':_0x0d8b('0xb6'),'include':[{'model':db[_0x0d8b('0x9c')],'as':_0x0d8b('0x9d'),'where':{'mobile':_0x13d965},'limit':0x1,'order':[[_0x0d8b('0x8a'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x12816b,null))[_0x0d8b('0x35')](function(_0x4d41ea){if(_0x4d41ea&&_0x4d41ea['List']){_0x228e6c=_0x4d41ea['get']({'plain':!![]});if(_0x228e6c[_0x0d8b('0xb6')]&&_0x228e6c[_0x0d8b('0xb6')][_0x0d8b('0x9d')][_0x0d8b('0x4a')]){return _0x228e6c[_0x0d8b('0xb6')]['Contacts'][0x0];}return db[_0x0d8b('0x9c')][_0x0d8b('0x5d')](_[_0x0d8b('0x17')](_0x206dfd[_0x0d8b('0x5e')],{'firstName':_0x13d965,'mobile':_0x13d965,'phone':_0x13d965,'ListId':_0x228e6c['ListId']}));}})['then'](handleEntityNotFound(_0x12816b,null))[_0x0d8b('0x35')](function(_0x593e46){if(_0x593e46){_0x26fb03=_0x593e46;return db[_0x0d8b('0xb7')][_0x0d8b('0x63')]({'where':{'ContactId':_0x26fb03['id'],'closed':![],'WhatsappAccountId':_0x228e6c['id']}})[_0x0d8b('0x35')](function(_0x32237b){if(_0x32237b){return[_0x32237b,![]];}return db[_0x0d8b('0xb7')][_0x0d8b('0x5d')]({'UserId':_0x206dfd['user']['id'],'ContactId':_0x26fb03['id'],'WhatsappAccountId':_0x228e6c['id'],'phone':_0x13d965,'firstMsgDirection':_0x0d8b('0xb8'),'Messages':[_['merge'](_0x206dfd[_0x0d8b('0x5e')],{'read':![],'body':_0x206dfd[_0x0d8b('0x5e')][_0x0d8b('0x5e')],'phone':_0x13d965,'WhatsappAccountId':_0x228e6c['id'],'UserId':_0x206dfd[_0x0d8b('0x5f')]['id'],'ContactId':_0x26fb03['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x58e346){return[_0x58e346,!![]];});});}})[_0x0d8b('0x77')](function(_0x2f4067,_0x3c4315){if(_0x3c4315){return _0x2f4067;}return db[_0x0d8b('0xa6')][_0x0d8b('0x5d')](_[_0x0d8b('0x50')](_0x206dfd['body'],{'read':![],'body':_0x206dfd['body']['body'],'phone':_0x13d965,'WhatsappAccountId':_0x228e6c['id'],'WhatsappInteractionId':_0x2f4067['id'],'UserId':_0x206dfd['user']['id'],'ContactId':_0x26fb03['id']}))[_0x0d8b('0x35')](function(_0x100c54){_0x2f4067['dataValues'][_0x0d8b('0xb9')]=[];_0x2f4067[_0x0d8b('0xba')][_0x0d8b('0xb9')][_0x0d8b('0xa3')](_0x100c54[_0x0d8b('0xba')]);return _0x2f4067;});})[_0x0d8b('0x35')](respondWithResult(_0x12816b,null))[_0x0d8b('0x59')](handleError(_0x12816b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 18b187f..4f654bd 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 _0xdfa0=['exports','events','WhatsappAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x16e874,_0x154da0){var _0x5460d4=function(_0x464262){while(--_0x464262){_0x16e874['push'](_0x16e874['shift']());}};_0x5460d4(++_0x154da0);}(_0xdfa0,0x69));var _0x0dfa=function(_0x414db0,_0x10729a){_0x414db0=_0x414db0-0x0;var _0x1b1f54=_0xdfa0[_0x414db0];return _0x1b1f54;};'use strict';var EventEmitter=require(_0x0dfa('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x0dfa('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0dfa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0dfa('0x3'),'afterDestroy':_0x0dfa('0x4')};function emitEvent(_0x3691a7){return function(_0x4dbbab,_0x373c4e,_0x50b91e){WhatsappAccountEvents[_0x0dfa('0x5')](_0x3691a7+':'+_0x4dbbab['id'],_0x4dbbab);WhatsappAccountEvents[_0x0dfa('0x5')](_0x3691a7,_0x4dbbab);_0x50b91e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x0dfa('0x6')](e,emitEvent(event));}}module[_0x0dfa('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xcf98=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x25e2bc,_0x27d1ef){var _0x5152d3=function(_0x354708){while(--_0x354708){_0x25e2bc['push'](_0x25e2bc['shift']());}};_0x5152d3(++_0x27d1ef);}(_0xcf98,0x8d));var _0x8cf9=function(_0x278222,_0x4e2388){_0x278222=_0x278222-0x0;var _0x3b2500=_0xcf98[_0x278222];return _0x3b2500;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x8cf9('0x0'))['db'][_0x8cf9('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8cf9('0x2')](0x0);var events={'afterCreate':_0x8cf9('0x3'),'afterUpdate':_0x8cf9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x479f6b){return function(_0x2ebf57,_0x28ae77,_0x1ce13f){WhatsappAccountEvents[_0x8cf9('0x5')](_0x479f6b+':'+_0x2ebf57['id'],_0x2ebf57);WhatsappAccountEvents[_0x8cf9('0x5')](_0x479f6b,_0x2ebf57);_0x1ce13f(null);};}for(var e in events){if(events[_0x8cf9('0x6')](e)){var event=events[e];WhatsappAccount[_0x8cf9('0x7')](e,emitEvent(event));}}module[_0x8cf9('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 f51fbd0..a38a175 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 _0xf6f5=['lodash','util','moment','path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0xbe83dc,_0x558915){var _0x56de2c=function(_0x5c7497){while(--_0x5c7497){_0xbe83dc['push'](_0xbe83dc['shift']());}};_0x56de2c(++_0x558915);}(_0xf6f5,0x10e));var _0x5f6f=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf6f5[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x5f6f('0x0'));var util=require(_0x5f6f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5f6f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f6f('0x3'));var rimraf=require(_0x5f6f('0x4'));var config=require(_0x5f6f('0x5'));var attributes=require('./whatsappAccount.attributes');module[_0x5f6f('0x6')]=function(_0x34b366,_0x404bb6){return _0x34b366[_0x5f6f('0x7')](_0x5f6f('0x8'),attributes,{'tableName':_0x5f6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4196=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappAccount','whatsapp_accounts','util'];(function(_0x457e09,_0x4f9368){var _0xf20158=function(_0x357c05){while(--_0x357c05){_0x457e09['push'](_0x457e09['shift']());}};_0xf20158(++_0x4f9368);}(_0x4196,0x18b));var _0x6419=function(_0x57a316,_0xb1bbe8){_0x57a316=_0x57a316-0x0;var _0x747168=_0x4196[_0x57a316];return _0x747168;};'use strict';var _=require('lodash');var util=require(_0x6419('0x0'));var logger=require(_0x6419('0x1'))(_0x6419('0x2'));var moment=require(_0x6419('0x3'));var BPromise=require(_0x6419('0x4'));var rp=require(_0x6419('0x5'));var fs=require('fs');var path=require(_0x6419('0x6'));var rimraf=require(_0x6419('0x7'));var config=require(_0x6419('0x8'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x262466,_0x40d1a6){return _0x262466['define'](_0x6419('0x9'),attributes,{'tableName':_0x6419('0xa'),'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 8afd8c6..c38d0c2 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 _0x0849=['client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','WhatsappAccount','find','options','raw','where','attributes','include','model','map','ShowWhatsappAccount','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x0849,0xca));var _0x9084=function(_0x58ce90,_0x3284ea){_0x58ce90=_0x58ce90-0x0;var _0x1cd178=_0x0849[_0x58ce90];return _0x1cd178;};'use strict';var _=require(_0x9084('0x0'));var util=require(_0x9084('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9084('0x2'));var fs=require('fs');var Redis=require(_0x9084('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9084('0x4'));var logger=require(_0x9084('0x5'))(_0x9084('0x6'));var config=require(_0x9084('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9084('0x8')][_0x9084('0x9')]({'port':0x232a});config[_0x9084('0xa')]=_[_0x9084('0xb')](config[_0x9084('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9084('0xc'))(new Redis(config['redis']));require(_0x9084('0xd'))['register'](socket);function respondWithRpcPromise(_0x5880d3,_0x115140,_0x125ab8){return new BPromise(function(_0x287559,_0x38ea05){return client[_0x9084('0xe')](_0x5880d3,_0x125ab8)[_0x9084('0xf')](function(_0x150988){logger[_0x9084('0x10')](_0x9084('0x11'),_0x115140,_0x9084('0x12'));logger[_0x9084('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x115140,_0x9084('0x12'),JSON[_0x9084('0x14')](_0x150988));if(_0x150988[_0x9084('0x15')]){if(_0x150988['error'][_0x9084('0x16')]===0x1f4){logger['error'](_0x9084('0x11'),_0x115140,_0x150988[_0x9084('0x15')]['message']);return _0x38ea05(_0x150988['error']['message']);}logger[_0x9084('0x15')](_0x9084('0x11'),_0x115140,_0x150988['error'][_0x9084('0x17')]);return _0x287559(_0x150988[_0x9084('0x15')][_0x9084('0x17')]);}else{logger[_0x9084('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x115140,_0x9084('0x12'));_0x287559(_0x150988['result']['message']);}})[_0x9084('0x18')](function(_0x341e9e){logger[_0x9084('0x15')](_0x9084('0x11'),_0x115140,_0x341e9e);_0x38ea05(_0x341e9e);});});}exports['ShowWhatsappAccount']=function(_0x11e1b6){var _0x42a84d=this;return new Promise(function(_0x23c691,_0xd7b6d3){return db[_0x9084('0x19')][_0x9084('0x1a')]({'raw':_0x11e1b6[_0x9084('0x1b')]?_0x11e1b6['options'][_0x9084('0x1c')]===undefined?!![]:![]:!![],'where':_0x11e1b6['options']?_0x11e1b6[_0x9084('0x1b')][_0x9084('0x1d')]||null:null,'attributes':_0x11e1b6[_0x9084('0x1b')]?_0x11e1b6['options'][_0x9084('0x1e')]||null:null,'include':_0x11e1b6['options']?_0x11e1b6[_0x9084('0x1b')][_0x9084('0x1f')]?_['map'](_0x11e1b6[_0x9084('0x1b')][_0x9084('0x1f')],function(_0x48d424){return{'model':db[_0x48d424[_0x9084('0x20')]],'as':_0x48d424['as'],'attributes':_0x48d424[_0x9084('0x1e')],'include':_0x48d424['include']?_['map'](_0x48d424['include'],function(_0x3edcfa){return{'model':db[_0x3edcfa[_0x9084('0x20')]],'as':_0x3edcfa['as'],'attributes':_0x3edcfa['attributes'],'include':_0x3edcfa['include']?_[_0x9084('0x21')](_0x3edcfa[_0x9084('0x1f')],function(_0x20ffa3){return{'model':db[_0x20ffa3[_0x9084('0x20')]],'as':_0x20ffa3['as'],'attributes':_0x20ffa3[_0x9084('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9084('0xf')](function(_0x1aab88){logger[_0x9084('0x10')](_0x9084('0x22'),_0x11e1b6);logger[_0x9084('0x13')]('ShowWhatsappAccount',_0x11e1b6,JSON[_0x9084('0x14')](_0x1aab88));_0x23c691(_0x1aab88);})['catch'](function(_0x472870){logger[_0x9084('0x15')]('ShowWhatsappAccount',_0x472870['message'],_0x11e1b6);_0xd7b6d3(_0x42a84d[_0x9084('0x15')](0x1f4,_0x472870[_0x9084('0x17')]));});});}; \ No newline at end of file +var _0x86e7=['request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s'];(function(_0x4a104c,_0x31eb74){var _0x11f870=function(_0x3b18c3){while(--_0x3b18c3){_0x4a104c['push'](_0x4a104c['shift']());}};_0x11f870(++_0x31eb74);}(_0x86e7,0xf1));var _0x786e=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x86e7[_0x44a64f];return _0x52024b;};'use strict';var _=require(_0x786e('0x0'));var util=require(_0x786e('0x1'));var moment=require(_0x786e('0x2'));var BPromise=require('bluebird');var rs=require(_0x786e('0x3'));var fs=require('fs');var Redis=require(_0x786e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x786e('0x5'));var logger=require(_0x786e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x786e('0x7')][_0x786e('0x8')]({'port':0x232a});config['redis']=_[_0x786e('0x9')](config[_0x786e('0xa')],{'host':_0x786e('0xb'),'port':0x18eb});var socket=require(_0x786e('0xc'))(new Redis(config[_0x786e('0xa')]));require(_0x786e('0xd'))[_0x786e('0xe')](socket);function respondWithRpcPromise(_0x5ae463,_0x524bb5,_0x5dea01){return new BPromise(function(_0x53a63d,_0x3e4f60){return client[_0x786e('0xf')](_0x5ae463,_0x5dea01)['then'](function(_0x2e16b3){logger[_0x786e('0x10')](_0x786e('0x11'),_0x524bb5,_0x786e('0x12'));logger[_0x786e('0x13')](_0x786e('0x14'),_0x524bb5,_0x786e('0x12'),JSON[_0x786e('0x15')](_0x2e16b3));if(_0x2e16b3['error']){if(_0x2e16b3[_0x786e('0x16')][_0x786e('0x17')]===0x1f4){logger['error'](_0x786e('0x11'),_0x524bb5,_0x2e16b3[_0x786e('0x16')][_0x786e('0x18')]);return _0x3e4f60(_0x2e16b3[_0x786e('0x16')][_0x786e('0x18')]);}logger[_0x786e('0x16')](_0x786e('0x11'),_0x524bb5,_0x2e16b3[_0x786e('0x16')][_0x786e('0x18')]);return _0x53a63d(_0x2e16b3[_0x786e('0x16')][_0x786e('0x18')]);}else{logger[_0x786e('0x10')](_0x786e('0x11'),_0x524bb5,_0x786e('0x12'));_0x53a63d(_0x2e16b3[_0x786e('0x19')][_0x786e('0x18')]);}})['catch'](function(_0x30a218){logger[_0x786e('0x16')](_0x786e('0x11'),_0x524bb5,_0x30a218);_0x3e4f60(_0x30a218);});});}exports[_0x786e('0x1a')]=function(_0x5ad588){var _0x48ee52=this;return new Promise(function(_0xfca95f,_0x1e8383){return db[_0x786e('0x1b')][_0x786e('0x1c')]({'raw':_0x5ad588['options']?_0x5ad588[_0x786e('0x1d')][_0x786e('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ad588[_0x786e('0x1d')]?_0x5ad588['options'][_0x786e('0x1f')]||null:null,'attributes':_0x5ad588[_0x786e('0x1d')]?_0x5ad588[_0x786e('0x1d')][_0x786e('0x20')]||null:null,'include':_0x5ad588[_0x786e('0x1d')]?_0x5ad588[_0x786e('0x1d')][_0x786e('0x21')]?_[_0x786e('0x22')](_0x5ad588['options'][_0x786e('0x21')],function(_0x3fb580){return{'model':db[_0x3fb580[_0x786e('0x23')]],'as':_0x3fb580['as'],'attributes':_0x3fb580[_0x786e('0x20')],'include':_0x3fb580[_0x786e('0x21')]?_['map'](_0x3fb580[_0x786e('0x21')],function(_0x4fe4f4){return{'model':db[_0x4fe4f4[_0x786e('0x23')]],'as':_0x4fe4f4['as'],'attributes':_0x4fe4f4[_0x786e('0x20')],'include':_0x4fe4f4[_0x786e('0x21')]?_[_0x786e('0x22')](_0x4fe4f4[_0x786e('0x21')],function(_0x20be43){return{'model':db[_0x20be43[_0x786e('0x23')]],'as':_0x20be43['as'],'attributes':_0x20be43[_0x786e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x786e('0x24')](function(_0xda56db){logger[_0x786e('0x10')](_0x786e('0x1a'),_0x5ad588);logger[_0x786e('0x13')]('ShowWhatsappAccount',_0x5ad588,JSON['stringify'](_0xda56db));_0xfca95f(_0xda56db);})['catch'](function(_0x45361e){logger[_0x786e('0x16')](_0x786e('0x1a'),_0x45361e['message'],_0x5ad588);_0x1e8383(_0x48ee52[_0x786e('0x16')](0x1f4,_0x45361e[_0x786e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7eb5e14..e6f9705 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 _0xa671=['whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener','length'];(function(_0x1bfcfc,_0x140f5b){var _0x1041ff=function(_0x2d48fc){while(--_0x2d48fc){_0x1bfcfc['push'](_0x1bfcfc['shift']());}};_0x1041ff(++_0x140f5b);}(_0xa671,0x19e));var _0x1a67=function(_0x407751,_0x5ceffd){_0x407751=_0x407751-0x0;var _0xd7450e=_0xa671[_0x407751];return _0xd7450e;};'use strict';var WhatsappAccountEvents=require(_0x1a67('0x0'));var events=[_0x1a67('0x1'),_0x1a67('0x2'),'update'];function createListener(_0x5ad625,_0x22c587){return function(_0x108a41){_0x22c587[_0x1a67('0x3')](_0x5ad625,_0x108a41);};}function removeListener(_0xbdd576,_0x1d5457){return function(){WhatsappAccountEvents[_0x1a67('0x4')](_0xbdd576,_0x1d5457);};}exports['register']=function(_0xdda9a1){for(var _0x27b10b=0x0,_0x3c358c=events[_0x1a67('0x5')];_0x27b10b<_0x3c358c;_0x27b10b++){var _0x40ba1e=events[_0x27b10b];var _0x25d9af=createListener(_0x1a67('0x6')+_0x40ba1e,_0xdda9a1);WhatsappAccountEvents['on'](_0x40ba1e,_0x25d9af);}}; \ No newline at end of file +var _0x0b6a=['save','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x5d8197,_0x55c6c7){var _0x6f9b35=function(_0xb4db10){while(--_0xb4db10){_0x5d8197['push'](_0x5d8197['shift']());}};_0x6f9b35(++_0x55c6c7);}(_0x0b6a,0x11e));var _0xa0b6=function(_0x12c7dc,_0x54a2f9){_0x12c7dc=_0x12c7dc-0x0;var _0x4f4acb=_0x0b6a[_0x12c7dc];return _0x4f4acb;};'use strict';var WhatsappAccountEvents=require(_0xa0b6('0x0'));var events=[_0xa0b6('0x1'),'remove','update'];function createListener(_0x11a53c,_0x35f18a){return function(_0x6978ab){_0x35f18a[_0xa0b6('0x2')](_0x11a53c,_0x6978ab);};}function removeListener(_0xdad245,_0x254768){return function(){WhatsappAccountEvents[_0xa0b6('0x3')](_0xdad245,_0x254768);};}exports[_0xa0b6('0x4')]=function(_0x4e12b4){for(var _0x5e2a78=0x0,_0x555e10=events[_0xa0b6('0x5')];_0x5e2a78<_0x555e10;_0x5e2a78++){var _0x4e466b=events[_0x5e2a78];var _0x450f1e=createListener(_0xa0b6('0x6')+_0x4e466b,_0x4e12b4);WhatsappAccountEvents['on'](_0x4e466b,_0x450f1e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 203a2c1..1cb8aef 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 _0xa207=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','put','delete','util','connect-timeout','express','Router'];(function(_0x214a2c,_0xdd2261){var _0x3f14d1=function(_0x12d32c){while(--_0x12d32c){_0x214a2c['push'](_0x214a2c['shift']());}};_0x3f14d1(++_0xdd2261);}(_0xa207,0x141));var _0x7a20=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa207[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x7a20('0x0'));var path=require('path');var timeout=require(_0x7a20('0x1'));var express=require(_0x7a20('0x2'));var router=express[_0x7a20('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7a20('0x4'));var config=require(_0x7a20('0x5'));var controller=require(_0x7a20('0x6'));router[_0x7a20('0x7')]('/',auth[_0x7a20('0x8')](),controller['index']);router[_0x7a20('0x7')](_0x7a20('0x9'),auth[_0x7a20('0x8')](),controller[_0x7a20('0xa')]);router['post']('/',auth[_0x7a20('0x8')](),controller['create']);router[_0x7a20('0xb')](_0x7a20('0x9'),auth[_0x7a20('0x8')](),controller['update']);router[_0x7a20('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x092e=['../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x50f509,_0x16ebe8){var _0x532391=function(_0x248795){while(--_0x248795){_0x50f509['push'](_0x50f509['shift']());}};_0x532391(++_0x16ebe8);}(_0x092e,0xc0));var _0xe092=function(_0x16fee7,_0x37cdbd){_0x16fee7=_0x16fee7-0x0;var _0x266774=_0x092e[_0x16fee7];return _0x266774;};'use strict';var multer=require(_0xe092('0x0'));var util=require(_0xe092('0x1'));var path=require('path');var timeout=require(_0xe092('0x2'));var express=require(_0xe092('0x3'));var router=express[_0xe092('0x4')]();var auth=require(_0xe092('0x5'));var interaction=require(_0xe092('0x6'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0xe092('0x7')](),controller[_0xe092('0x8')]);router[_0xe092('0x9')](_0xe092('0xa'),auth['isAuthenticated'](),controller[_0xe092('0xb')]);router[_0xe092('0xc')]('/',auth[_0xe092('0x7')](),controller[_0xe092('0xd')]);router[_0xe092('0xe')]('/:id',auth[_0xe092('0x7')](),controller[_0xe092('0xf')]);router[_0xe092('0x10')]('/:id',auth[_0xe092('0x7')](),controller['destroy']);module[_0xe092('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 713adb5..cc83aa4 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 _0x4a9e=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4a9e,0x1f0));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe4a9('0x0'));module[_0xe4a9('0x1')]={'priority':{'type':Sequelize[_0xe4a9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe4a9('0x3')],'allowNull':![],'defaultValue':_0xe4a9('0x4')},'appdata':{'type':Sequelize[_0xe4a9('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe4a9('0x3')],'defaultValue':_0xe4a9('0x6')}}; \ No newline at end of file +var _0x4248=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x385729,_0xd675){var _0x94abc2=function(_0x5f0ee1){while(--_0x5f0ee1){_0x385729['push'](_0x385729['shift']());}};_0x94abc2(++_0xd675);}(_0x4248,0x192));var _0x8424=function(_0x4efc87,_0x17a7d1){_0x4efc87=_0x4efc87-0x0;var _0x191fc4=_0x4248[_0x4efc87];return _0x191fc4;};'use strict';var Sequelize=require(_0x8424('0x0'));module[_0x8424('0x1')]={'priority':{'type':Sequelize[_0x8424('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8424('0x3')],'allowNull':![],'defaultValue':_0x8424('0x4')},'appdata':{'type':Sequelize[_0x8424('0x5')]()},'description':{'type':Sequelize[_0x8424('0x3')]},'interval':{'type':Sequelize[_0x8424('0x3')],'defaultValue':_0x8424('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4fc9867..00c5fa5 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 _0x441b=['apply','reject','save','destroy','then','stack','name','send','map','WhatsappApplication','rawAttributes','type','model','query','keys','filters','fields','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','attributes','intersection','length','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set'];(function(_0x150cab,_0x4897c5){var _0x38ab54=function(_0x2f5cd2){while(--_0x2f5cd2){_0x150cab['push'](_0x150cab['shift']());}};_0x38ab54(++_0x4897c5);}(_0x441b,0xe9));var _0xb441=function(_0x54cf3b,_0x33fe35){_0x54cf3b=_0x54cf3b-0x0;var _0x2ce24a=_0x441b[_0x54cf3b];return _0x2ce24a;};'use strict';var pdf=require(_0xb441('0x0'));var emlformat=require(_0xb441('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb441('0x2'));var jsonpatch=require(_0xb441('0x3'));var rp=require(_0xb441('0x4'));var moment=require(_0xb441('0x5'));var BPromise=require(_0xb441('0x6'));var Mustache=require(_0xb441('0x7'));var util=require(_0xb441('0x8'));var path=require('path');var sox=require(_0xb441('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb441('0xa'));var squel=require(_0xb441('0xb'));var crypto=require(_0xb441('0xc'));var jsforce=require(_0xb441('0xd'));var deskjs=require(_0xb441('0xe'));var toCsv=require(_0xb441('0xf'));var querystring=require('querystring');var Papa=require(_0xb441('0x10'));var Redis=require('ioredis');var authService=require(_0xb441('0x11'));var qs=require(_0xb441('0x12'));var as=require(_0xb441('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb441('0x14'))(_0xb441('0x15'));var utils=require(_0xb441('0x16'));var config=require(_0xb441('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a35c2,_0x56aab8){_0x56aab8=_0x56aab8||0xcc;return function(_0x2c2c6e){if(_0x2c2c6e){return _0x2a35c2['sendStatus'](_0x56aab8);}return _0x2a35c2[_0xb441('0x18')](_0x56aab8)[_0xb441('0x19')]();};}function respondWithResult(_0x30489f,_0x15240d){_0x15240d=_0x15240d||0xc8;return function(_0x2a162a){if(_0x2a162a){return _0x30489f[_0xb441('0x18')](_0x15240d)[_0xb441('0x1a')](_0x2a162a);}};}function respondWithFilteredResult(_0x3e0ce2,_0xaed566){return function(_0xc925ab){if(_0xc925ab){var _0x3d10fc=_0xc925ab[_0xb441('0x1b')],_0x40d3de=_0xaed566[_0xb441('0x1c')],_0x5e7eae=_0xaed566[_0xb441('0x1c')]+_0xaed566[_0xb441('0x1d')],_0x4a1d8f;if(_0x5e7eae>=_0x3d10fc){_0x5e7eae=_0x3d10fc;_0x4a1d8f=0xc8;}else{_0x4a1d8f=0xce;}_0x3e0ce2[_0xb441('0x18')](_0x4a1d8f);return _0x3e0ce2[_0xb441('0x1e')]('Content-Range',_0x40d3de+'-'+_0x5e7eae+'/'+_0x3d10fc)[_0xb441('0x1a')](_0xc925ab);}return null;};}function patchUpdates(_0x5bee6e){return function(_0x4d8d1e){try{jsonpatch[_0xb441('0x1f')](_0x4d8d1e,_0x5bee6e,!![]);}catch(_0x3889aa){return BPromise[_0xb441('0x20')](_0x3889aa);}return _0x4d8d1e[_0xb441('0x21')]();};}function saveUpdates(_0x3ecff3,_0x384576){return function(_0x1d9e4e){if(_0x1d9e4e){return _0x1d9e4e['update'](_0x3ecff3)['then'](function(_0x99c39e){return _0x99c39e;});}return null;};}function removeEntity(_0x960256,_0x355f35){return function(_0x35c3ee){if(_0x35c3ee){return _0x35c3ee[_0xb441('0x22')]()[_0xb441('0x23')](function(){_0x960256[_0xb441('0x18')](0xcc)[_0xb441('0x19')]();});}};}function handleEntityNotFound(_0x9734dc,_0x4690d8){return function(_0x1593ad){if(!_0x1593ad){_0x9734dc['sendStatus'](0x194);}return _0x1593ad;};}function handleError(_0x4112ea,_0x2d5469){_0x2d5469=_0x2d5469||0x1f4;return function(_0x8f6eca){logger['error'](_0x8f6eca[_0xb441('0x24')]);if(_0x8f6eca['name']){delete _0x8f6eca[_0xb441('0x25')];}_0x4112ea[_0xb441('0x18')](_0x2d5469)[_0xb441('0x26')](_0x8f6eca);};}exports['index']=function(_0x2e045d,_0x2a0ba1){var _0x23a5d6={},_0x40c1f8={},_0x45303c={'count':0x0,'rows':[]};var _0x186cd3=_[_0xb441('0x27')](db[_0xb441('0x28')][_0xb441('0x29')],function(_0x5e61bd){return{'name':_0x5e61bd['fieldName'],'type':_0x5e61bd[_0xb441('0x2a')]['key']};});_0x40c1f8[_0xb441('0x2b')]=_[_0xb441('0x27')](_0x186cd3,_0xb441('0x25'));_0x40c1f8[_0xb441('0x2c')]=_[_0xb441('0x2d')](_0x2e045d[_0xb441('0x2c')]);_0x40c1f8[_0xb441('0x2e')]=_['intersection'](_0x40c1f8[_0xb441('0x2b')],_0x40c1f8[_0xb441('0x2c')]);_0x23a5d6['attributes']=_['intersection'](_0x40c1f8['model'],qs[_0xb441('0x2f')](_0x2e045d[_0xb441('0x2c')][_0xb441('0x2f')]));_0x23a5d6['attributes']=_0x23a5d6['attributes']['length']?_0x23a5d6['attributes']:_0x40c1f8[_0xb441('0x2b')];if(!_0x2e045d[_0xb441('0x2c')]['hasOwnProperty']('nolimit')){_0x23a5d6[_0xb441('0x1d')]=qs['limit'](_0x2e045d[_0xb441('0x2c')][_0xb441('0x1d')]);_0x23a5d6[_0xb441('0x1c')]=qs[_0xb441('0x1c')](_0x2e045d['query'][_0xb441('0x1c')]);}_0x23a5d6['order']=qs[_0xb441('0x30')](_0x2e045d[_0xb441('0x2c')][_0xb441('0x30')]);_0x23a5d6[_0xb441('0x31')]=qs['filters'](_[_0xb441('0x32')](_0x2e045d[_0xb441('0x2c')],_0x40c1f8[_0xb441('0x2e')]),_0x186cd3);if(_0x2e045d['query'][_0xb441('0x33')]){_0x23a5d6[_0xb441('0x31')]=_[_0xb441('0x34')](_0x23a5d6[_0xb441('0x31')],{'$or':_[_0xb441('0x27')](_0x186cd3,function(_0x5a904b){if(_0x5a904b[_0xb441('0x2a')]!==_0xb441('0x35')){var _0x529115={};_0x529115[_0x5a904b['name']]={'$like':'%'+_0x2e045d[_0xb441('0x2c')][_0xb441('0x33')]+'%'};return _0x529115;}})});}_0x23a5d6=_['merge']({},_0x23a5d6,_0x2e045d['options']);var _0x2a7c87={'where':_0x23a5d6[_0xb441('0x31')]};return db[_0xb441('0x28')]['count'](_0x2a7c87)[_0xb441('0x23')](function(_0x2a84e7){_0x45303c['count']=_0x2a84e7;if(_0x2e045d['query'][_0xb441('0x36')]){_0x23a5d6[_0xb441('0x37')]=[{'all':!![]}];}return db[_0xb441('0x28')][_0xb441('0x38')](_0x23a5d6);})[_0xb441('0x23')](function(_0x20e056){_0x45303c[_0xb441('0x39')]=_0x20e056;return _0x45303c;})[_0xb441('0x23')](respondWithFilteredResult(_0x2a0ba1,_0x23a5d6))['catch'](handleError(_0x2a0ba1,null));};exports[_0xb441('0x3a')]=function(_0x361503,_0x4343b4){var _0x3d7030={'raw':!![],'where':{'id':_0x361503[_0xb441('0x3b')]['id']}},_0x999825={};_0x999825[_0xb441('0x2b')]=_[_0xb441('0x2d')](db['WhatsappApplication']['rawAttributes']);_0x999825[_0xb441('0x2c')]=_[_0xb441('0x2d')](_0x361503[_0xb441('0x2c')]);_0x999825[_0xb441('0x2e')]=_['intersection'](_0x999825['model'],_0x999825['query']);_0x3d7030[_0xb441('0x3c')]=_[_0xb441('0x3d')](_0x999825[_0xb441('0x2b')],qs[_0xb441('0x2f')](_0x361503[_0xb441('0x2c')][_0xb441('0x2f')]));_0x3d7030[_0xb441('0x3c')]=_0x3d7030['attributes'][_0xb441('0x3e')]?_0x3d7030[_0xb441('0x3c')]:_0x999825[_0xb441('0x2b')];if(_0x361503[_0xb441('0x2c')]['includeAll']){_0x3d7030['include']=[{'all':!![]}];}_0x3d7030=_[_0xb441('0x34')]({},_0x3d7030,_0x361503['options']);return db[_0xb441('0x28')]['find'](_0x3d7030)['then'](handleEntityNotFound(_0x4343b4,null))[_0xb441('0x23')](respondWithResult(_0x4343b4,null))[_0xb441('0x3f')](handleError(_0x4343b4,null));};exports[_0xb441('0x40')]=function(_0x428010,_0x5d47c4){return db[_0xb441('0x28')][_0xb441('0x40')](_0x428010[_0xb441('0x41')],{})[_0xb441('0x23')](respondWithResult(_0x5d47c4,0xc9))[_0xb441('0x3f')](handleError(_0x5d47c4,null));};exports['update']=function(_0x2e9823,_0x1a7923){if(_0x2e9823[_0xb441('0x41')]['id']){delete _0x2e9823[_0xb441('0x41')]['id'];}return db[_0xb441('0x28')]['find']({'where':{'id':_0x2e9823[_0xb441('0x3b')]['id']}})[_0xb441('0x23')](handleEntityNotFound(_0x1a7923,null))[_0xb441('0x23')](saveUpdates(_0x2e9823['body'],null))[_0xb441('0x23')](respondWithResult(_0x1a7923,null))['catch'](handleError(_0x1a7923,null));};exports[_0xb441('0x22')]=function(_0x507e26,_0x386348){return db[_0xb441('0x28')]['find']({'where':{'id':_0x507e26[_0xb441('0x3b')]['id']}})[_0xb441('0x23')](handleEntityNotFound(_0x386348,null))[_0xb441('0x23')](removeEntity(_0x386348,null))[_0xb441('0x3f')](handleError(_0x386348,null));}; \ No newline at end of file +var _0x8f1a=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x386a04,_0x184484){var _0x3ac537=function(_0x3ea883){while(--_0x3ea883){_0x386a04['push'](_0x386a04['shift']());}};_0x3ac537(++_0x184484);}(_0x8f1a,0x82));var _0xa8f1=function(_0x381a3a,_0x2931c6){_0x381a3a=_0x381a3a-0x0;var _0x341f8d=_0x8f1a[_0x381a3a];return _0x341f8d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8f1('0x0'));var jsonpatch=require(_0xa8f1('0x1'));var rp=require(_0xa8f1('0x2'));var moment=require(_0xa8f1('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa8f1('0x4'));var path=require(_0xa8f1('0x5'));var sox=require(_0xa8f1('0x6'));var csv=require(_0xa8f1('0x7'));var ejs=require(_0xa8f1('0x8'));var fs=require('fs');var _=require(_0xa8f1('0x9'));var squel=require('squel');var crypto=require(_0xa8f1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa8f1('0xb'));var toCsv=require(_0xa8f1('0x7'));var querystring=require(_0xa8f1('0xc'));var Papa=require(_0xa8f1('0xd'));var Redis=require(_0xa8f1('0xe'));var authService=require(_0xa8f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa8f1('0x10'));var hardwareService=require(_0xa8f1('0x11'));var logger=require(_0xa8f1('0x12'))(_0xa8f1('0x13'));var utils=require(_0xa8f1('0x14'));var config=require(_0xa8f1('0x15'));var db=require(_0xa8f1('0x16'))['db'];function respondWithStatusCode(_0x493434,_0x587885){_0x587885=_0x587885||0xcc;return function(_0x5724b4){if(_0x5724b4){return _0x493434['sendStatus'](_0x587885);}return _0x493434[_0xa8f1('0x17')](_0x587885)[_0xa8f1('0x18')]();};}function respondWithResult(_0x28328b,_0x34bce7){_0x34bce7=_0x34bce7||0xc8;return function(_0x134ffa){if(_0x134ffa){return _0x28328b[_0xa8f1('0x17')](_0x34bce7)[_0xa8f1('0x19')](_0x134ffa);}};}function respondWithFilteredResult(_0x3a3de5,_0x1d1da9){return function(_0x1367aa){if(_0x1367aa){var _0x477441=_0x1367aa[_0xa8f1('0x1a')],_0xbfd0dd=_0x1d1da9['offset'],_0x25817a=_0x1d1da9[_0xa8f1('0x1b')]+_0x1d1da9[_0xa8f1('0x1c')],_0x15c9b8;if(_0x25817a>=_0x477441){_0x25817a=_0x477441;_0x15c9b8=0xc8;}else{_0x15c9b8=0xce;}_0x3a3de5['status'](_0x15c9b8);return _0x3a3de5[_0xa8f1('0x1d')](_0xa8f1('0x1e'),_0xbfd0dd+'-'+_0x25817a+'/'+_0x477441)['json'](_0x1367aa);}return null;};}function patchUpdates(_0x5369f9){return function(_0x2b4be5){try{jsonpatch[_0xa8f1('0x1f')](_0x2b4be5,_0x5369f9,!![]);}catch(_0x18f748){return BPromise[_0xa8f1('0x20')](_0x18f748);}return _0x2b4be5[_0xa8f1('0x21')]();};}function saveUpdates(_0xd6b84,_0x158668){return function(_0x577ace){if(_0x577ace){return _0x577ace[_0xa8f1('0x22')](_0xd6b84)[_0xa8f1('0x23')](function(_0x24977c){return _0x24977c;});}return null;};}function removeEntity(_0x893df1,_0x57fa65){return function(_0x3b8f2b){if(_0x3b8f2b){return _0x3b8f2b[_0xa8f1('0x24')]()[_0xa8f1('0x23')](function(){_0x893df1[_0xa8f1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b7d2,_0x164fc3){return function(_0x56c621){if(!_0x56c621){_0x36b7d2[_0xa8f1('0x25')](0x194);}return _0x56c621;};}function handleError(_0x51bb18,_0x8e46ff){_0x8e46ff=_0x8e46ff||0x1f4;return function(_0x4a8987){logger[_0xa8f1('0x26')](_0x4a8987[_0xa8f1('0x27')]);if(_0x4a8987['name']){delete _0x4a8987['name'];}_0x51bb18['status'](_0x8e46ff)[_0xa8f1('0x28')](_0x4a8987);};}exports[_0xa8f1('0x29')]=function(_0x5470df,_0x162654){var _0x18cc47={},_0x165924={},_0x588055={'count':0x0,'rows':[]};var _0x194696=_[_0xa8f1('0x2a')](db[_0xa8f1('0x2b')][_0xa8f1('0x2c')],function(_0xa419be){return{'name':_0xa419be[_0xa8f1('0x2d')],'type':_0xa419be[_0xa8f1('0x2e')]['key']};});_0x165924[_0xa8f1('0x2f')]=_[_0xa8f1('0x2a')](_0x194696,_0xa8f1('0x30'));_0x165924[_0xa8f1('0x31')]=_[_0xa8f1('0x32')](_0x5470df['query']);_0x165924[_0xa8f1('0x33')]=_[_0xa8f1('0x34')](_0x165924[_0xa8f1('0x2f')],_0x165924[_0xa8f1('0x31')]);_0x18cc47[_0xa8f1('0x35')]=_[_0xa8f1('0x34')](_0x165924[_0xa8f1('0x2f')],qs[_0xa8f1('0x36')](_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x36')]));_0x18cc47[_0xa8f1('0x35')]=_0x18cc47['attributes'][_0xa8f1('0x37')]?_0x18cc47[_0xa8f1('0x35')]:_0x165924[_0xa8f1('0x2f')];if(!_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x38')](_0xa8f1('0x39'))){_0x18cc47[_0xa8f1('0x1c')]=qs[_0xa8f1('0x1c')](_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x1c')]);_0x18cc47[_0xa8f1('0x1b')]=qs['offset'](_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x1b')]);}_0x18cc47['order']=qs[_0xa8f1('0x3a')](_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x3a')]);_0x18cc47[_0xa8f1('0x3b')]=qs['filters'](_[_0xa8f1('0x3c')](_0x5470df['query'],_0x165924[_0xa8f1('0x33')]),_0x194696);if(_0x5470df['query'][_0xa8f1('0x3d')]){_0x18cc47[_0xa8f1('0x3b')]=_[_0xa8f1('0x3e')](_0x18cc47['where'],{'$or':_[_0xa8f1('0x2a')](_0x194696,function(_0x388b6c){if(_0x388b6c['type']!==_0xa8f1('0x3f')){var _0x2765da={};_0x2765da[_0x388b6c[_0xa8f1('0x30')]]={'$like':'%'+_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x3d')]+'%'};return _0x2765da;}})});}_0x18cc47=_[_0xa8f1('0x3e')]({},_0x18cc47,_0x5470df['options']);var _0x37ad20={'where':_0x18cc47[_0xa8f1('0x3b')]};return db[_0xa8f1('0x2b')]['count'](_0x37ad20)[_0xa8f1('0x23')](function(_0x205f5d){_0x588055[_0xa8f1('0x1a')]=_0x205f5d;if(_0x5470df[_0xa8f1('0x31')][_0xa8f1('0x40')]){_0x18cc47[_0xa8f1('0x41')]=[{'all':!![]}];}return db[_0xa8f1('0x2b')][_0xa8f1('0x42')](_0x18cc47);})['then'](function(_0x371b41){_0x588055['rows']=_0x371b41;return _0x588055;})[_0xa8f1('0x23')](respondWithFilteredResult(_0x162654,_0x18cc47))[_0xa8f1('0x43')](handleError(_0x162654,null));};exports[_0xa8f1('0x44')]=function(_0x1c4ea1,_0x3c68a5){var _0x22c24c={'raw':!![],'where':{'id':_0x1c4ea1[_0xa8f1('0x45')]['id']}},_0x32e4a4={};_0x32e4a4[_0xa8f1('0x2f')]=_['keys'](db[_0xa8f1('0x2b')][_0xa8f1('0x2c')]);_0x32e4a4[_0xa8f1('0x31')]=_['keys'](_0x1c4ea1[_0xa8f1('0x31')]);_0x32e4a4[_0xa8f1('0x33')]=_[_0xa8f1('0x34')](_0x32e4a4[_0xa8f1('0x2f')],_0x32e4a4[_0xa8f1('0x31')]);_0x22c24c[_0xa8f1('0x35')]=_[_0xa8f1('0x34')](_0x32e4a4[_0xa8f1('0x2f')],qs[_0xa8f1('0x36')](_0x1c4ea1[_0xa8f1('0x31')]['fields']));_0x22c24c[_0xa8f1('0x35')]=_0x22c24c[_0xa8f1('0x35')]['length']?_0x22c24c[_0xa8f1('0x35')]:_0x32e4a4[_0xa8f1('0x2f')];if(_0x1c4ea1['query']['includeAll']){_0x22c24c[_0xa8f1('0x41')]=[{'all':!![]}];}_0x22c24c=_[_0xa8f1('0x3e')]({},_0x22c24c,_0x1c4ea1[_0xa8f1('0x46')]);return db[_0xa8f1('0x2b')]['find'](_0x22c24c)[_0xa8f1('0x23')](handleEntityNotFound(_0x3c68a5,null))[_0xa8f1('0x23')](respondWithResult(_0x3c68a5,null))[_0xa8f1('0x43')](handleError(_0x3c68a5,null));};exports[_0xa8f1('0x47')]=function(_0x57574f,_0x3bcd4d){return db[_0xa8f1('0x2b')][_0xa8f1('0x47')](_0x57574f['body'],{})[_0xa8f1('0x23')](respondWithResult(_0x3bcd4d,0xc9))['catch'](handleError(_0x3bcd4d,null));};exports[_0xa8f1('0x22')]=function(_0x5b598e,_0x4a3dbb){if(_0x5b598e['body']['id']){delete _0x5b598e[_0xa8f1('0x48')]['id'];}return db['WhatsappApplication'][_0xa8f1('0x49')]({'where':{'id':_0x5b598e[_0xa8f1('0x45')]['id']}})[_0xa8f1('0x23')](handleEntityNotFound(_0x4a3dbb,null))['then'](saveUpdates(_0x5b598e[_0xa8f1('0x48')],null))['then'](respondWithResult(_0x4a3dbb,null))[_0xa8f1('0x43')](handleError(_0x4a3dbb,null));};exports[_0xa8f1('0x24')]=function(_0x1e4d2d,_0x5861b6){return db['WhatsappApplication']['find']({'where':{'id':_0x1e4d2d[_0xa8f1('0x45')]['id']}})[_0xa8f1('0x23')](handleEntityNotFound(_0x5861b6,null))['then'](removeEntity(_0x5861b6,null))[_0xa8f1('0x43')](handleError(_0x5861b6,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ec57044..acd9237 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 _0x9a2d=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x9a2d,0x123));var _0xd9a2=function(_0x1a8c66,_0x59e208){_0x1a8c66=_0x1a8c66-0x0;var _0x570d3b=_0x9a2d[_0x1a8c66];return _0x570d3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd9a2('0x0'))('api');var moment=require(_0xd9a2('0x1'));var BPromise=require(_0xd9a2('0x2'));var rp=require(_0xd9a2('0x3'));var fs=require('fs');var path=require(_0xd9a2('0x4'));var rimraf=require(_0xd9a2('0x5'));var config=require(_0xd9a2('0x6'));var attributes=require(_0xd9a2('0x7'));module[_0xd9a2('0x8')]=function(_0x2ff138,_0x11bc70){return _0x2ff138[_0xd9a2('0x9')](_0xd9a2('0xa'),attributes,{'tableName':_0xd9a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9a2('0xc'),'collate':_0xd9a2('0xd')});}; \ No newline at end of file +var _0x93e6=['bluebird','path','rimraf','../../config/environment','exports','utf8mb4','lodash','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x93e6,0x11e));var _0x693e=function(_0xb729d2,_0x131a0e){_0xb729d2=_0xb729d2-0x0;var _0x181500=_0x93e6[_0xb729d2];return _0x181500;};'use strict';var _=require(_0x693e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x693e('0x1'));var moment=require('moment');var BPromise=require(_0x693e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x693e('0x3'));var rimraf=require(_0x693e('0x4'));var config=require(_0x693e('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0x693e('0x6')]=function(_0x388eb6,_0x2569a4){return _0x388eb6['define']('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x693e('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 33d7ded..357521c 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 _0xe928=['info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe928,0x145));var _0x8e92=function(_0x105c8e,_0xef41b1){_0x105c8e=_0x105c8e-0x0;var _0x4384d2=_0xe928[_0x105c8e];return _0x4384d2;};'use strict';var _=require(_0x8e92('0x0'));var util=require(_0x8e92('0x1'));var moment=require(_0x8e92('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e92('0x4'))['db'];var utils=require(_0x8e92('0x5'));var logger=require(_0x8e92('0x6'))(_0x8e92('0x7'));var config=require('../../config/environment');var jayson=require(_0x8e92('0x8'));var client=jayson['client'][_0x8e92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe4eff3,_0x14811b,_0x76e11){return new BPromise(function(_0x59e109,_0x361fd2){return client['request'](_0xe4eff3,_0x76e11)[_0x8e92('0xa')](function(_0x8cc27a){logger[_0x8e92('0xb')](_0x8e92('0xc'),_0x14811b,_0x8e92('0xd'));logger[_0x8e92('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x14811b,_0x8e92('0xd'),JSON[_0x8e92('0xf')](_0x8cc27a));if(_0x8cc27a[_0x8e92('0x10')]){if(_0x8cc27a['error'][_0x8e92('0x11')]===0x1f4){logger[_0x8e92('0x10')](_0x8e92('0xc'),_0x14811b,_0x8cc27a[_0x8e92('0x10')][_0x8e92('0x12')]);return _0x361fd2(_0x8cc27a[_0x8e92('0x10')][_0x8e92('0x12')]);}logger['error'](_0x8e92('0xc'),_0x14811b,_0x8cc27a['error'][_0x8e92('0x12')]);return _0x59e109(_0x8cc27a[_0x8e92('0x10')]['message']);}else{logger[_0x8e92('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x14811b,_0x8e92('0xd'));_0x59e109(_0x8cc27a[_0x8e92('0x13')][_0x8e92('0x12')]);}})[_0x8e92('0x14')](function(_0x1c4b12){logger[_0x8e92('0x10')](_0x8e92('0xc'),_0x14811b,_0x1c4b12);_0x361fd2(_0x1c4b12);});});} \ No newline at end of file +var _0x6075=['code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0xfacee2,_0x29c3b0){var _0x4cc9ea=function(_0x26ed31){while(--_0x26ed31){_0xfacee2['push'](_0xfacee2['shift']());}};_0x4cc9ea(++_0x29c3b0);}(_0x6075,0x191));var _0x5607=function(_0x4bbce6,_0x554194){_0x4bbce6=_0x4bbce6-0x0;var _0x33ab0a=_0x6075[_0x4bbce6];return _0x33ab0a;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var moment=require(_0x5607('0x1'));var BPromise=require(_0x5607('0x2'));var rs=require(_0x5607('0x3'));var fs=require('fs');var Redis=require(_0x5607('0x4'));var db=require(_0x5607('0x5'))['db'];var utils=require(_0x5607('0x6'));var logger=require(_0x5607('0x7'))(_0x5607('0x8'));var config=require('../../config/environment');var jayson=require(_0x5607('0x9'));var client=jayson[_0x5607('0xa')][_0x5607('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab18d,_0x53f825,_0x3dc860){return new BPromise(function(_0x25107d,_0x24d9da){return client[_0x5607('0xc')](_0x5ab18d,_0x3dc860)[_0x5607('0xd')](function(_0x4f61bf){logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,_0x5607('0x10'));logger['debug'](_0x5607('0x11'),_0x53f825,'request\x20sent',JSON['stringify'](_0x4f61bf));if(_0x4f61bf[_0x5607('0x12')]){if(_0x4f61bf[_0x5607('0x12')][_0x5607('0x13')]===0x1f4){logger['error'](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x24d9da(_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);}logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x25107d(_0x4f61bf['error'][_0x5607('0x14')]);}else{logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,'request\x20sent');_0x25107d(_0x4f61bf['result'][_0x5607('0x14')]);}})['catch'](function(_0x38ab1c){logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x38ab1c);_0x24d9da(_0x38ab1c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 3efca09..94d7ab9 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 _0x7852=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','/:id/tags','tracked','whatsapp','addTags','whatsappinteraction:update','delete','removeTags','multer'];(function(_0x3c5127,_0x393274){var _0xea714e=function(_0x446031){while(--_0x446031){_0x3c5127['push'](_0x3c5127['shift']());}};_0xea714e(++_0x393274);}(_0x7852,0x137));var _0x2785=function(_0x4b92d5,_0x4caf74){_0x4b92d5=_0x4b92d5-0x0;var _0x2369a6=_0x7852[_0x4b92d5];return _0x2369a6;};'use strict';var multer=require(_0x2785('0x0'));var util=require('util');var path=require(_0x2785('0x1'));var timeout=require(_0x2785('0x2'));var express=require('express');var router=express[_0x2785('0x3')]();var auth=require(_0x2785('0x4'));var interaction=require(_0x2785('0x5'));var config=require('../../config/environment');var controller=require(_0x2785('0x6'));router[_0x2785('0x7')]('/',auth[_0x2785('0x8')](),controller['index']);router['get'](_0x2785('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x2785('0x7')](_0x2785('0xa'),auth[_0x2785('0x8')](),controller[_0x2785('0xb')]);router[_0x2785('0x7')](_0x2785('0xc'),auth[_0x2785('0x8')](),controller[_0x2785('0xd')]);router[_0x2785('0x7')](_0x2785('0xe'),auth[_0x2785('0x8')](),controller['download']);router[_0x2785('0xf')]('/',auth[_0x2785('0x8')](),controller[_0x2785('0x10')]);router[_0x2785('0xf')](_0x2785('0xc'),auth[_0x2785('0x8')](),controller['addMessage']);router['post'](_0x2785('0x11'),auth[_0x2785('0x8')](),interaction[_0x2785('0x12')](_0x2785('0x13'),'whatsappinteraction:addtags'),controller[_0x2785('0x14')]);router['put']('/:id',auth[_0x2785('0x8')](),interaction['tracked'](_0x2785('0x13'),_0x2785('0x15')),controller['update']);router[_0x2785('0x16')](_0x2785('0xa'),auth['isAuthenticated'](),interaction[_0x2785('0x12')](_0x2785('0x13'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x2785('0x16')](_0x2785('0x11'),auth[_0x2785('0x8')](),controller[_0x2785('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4780=['./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','create','post','/:id/messages','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','put','tracked','update','delete','destroy','removeTags','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x426711,_0x12264c){var _0x592991=function(_0x564614){while(--_0x564614){_0x426711['push'](_0x426711['shift']());}};_0x592991(++_0x12264c);}(_0x4780,0xbe));var _0x0478=function(_0x29b714,_0x1b0efb){_0x29b714=_0x29b714-0x0;var _0x3c70df=_0x4780[_0x29b714];return _0x3c70df;};'use strict';var multer=require(_0x0478('0x0'));var util=require(_0x0478('0x1'));var path=require('path');var timeout=require(_0x0478('0x2'));var express=require(_0x0478('0x3'));var router=express['Router']();var auth=require(_0x0478('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0478('0x5'));var controller=require(_0x0478('0x6'));router[_0x0478('0x7')]('/',auth[_0x0478('0x8')](),controller[_0x0478('0x9')]);router[_0x0478('0x7')](_0x0478('0xa'),auth['isAuthenticated'](),controller[_0x0478('0xb')]);router['get'](_0x0478('0xc'),auth[_0x0478('0x8')](),controller[_0x0478('0xd')]);router[_0x0478('0x7')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x0478('0x7')](_0x0478('0xe'),auth[_0x0478('0x8')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x0478('0xf')]);router[_0x0478('0x10')](_0x0478('0x11'),auth[_0x0478('0x8')](),controller['addMessage']);router[_0x0478('0x10')](_0x0478('0x12'),auth[_0x0478('0x8')](),interaction['tracked'](_0x0478('0x13'),_0x0478('0x14')),controller[_0x0478('0x15')]);router[_0x0478('0x16')](_0x0478('0xc'),auth[_0x0478('0x8')](),interaction[_0x0478('0x17')](_0x0478('0x13'),'whatsappinteraction:update'),controller[_0x0478('0x18')]);router[_0x0478('0x19')](_0x0478('0xc'),auth[_0x0478('0x8')](),interaction[_0x0478('0x17')](_0x0478('0x13'),'whatsappinteraction:destroy'),controller[_0x0478('0x1a')]);router[_0x0478('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0478('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 7da86a7..135ada3 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 _0x316c=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x3714ff,_0x54d34d){var _0x7535dd=function(_0x2d4a6d){while(--_0x2d4a6d){_0x3714ff['push'](_0x3714ff['shift']());}};_0x7535dd(++_0x54d34d);}(_0x316c,0x1d4));var _0xc316=function(_0x4ad5ec,_0x1c5088){_0x4ad5ec=_0x4ad5ec-0x0;var _0x39310e=_0x316c[_0x4ad5ec];return _0x39310e;};'use strict';var Sequelize=require(_0xc316('0x0'));var moment=require('moment');module[_0xc316('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc316('0x2')]},'disposition':{'type':Sequelize[_0xc316('0x3')]},'note':{'type':Sequelize[_0xc316('0x3')]},'phone':{'type':Sequelize[_0xc316('0x3')]},'read1stAt':{'type':Sequelize[_0xc316('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xc316('0x4')]('in',_0xc316('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc316('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x59e0=['out','moment','exports','DATE','STRING','ENUM'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x59e0,0x103));var _0x059e=function(_0x47a840,_0x1f3dd1){_0x47a840=_0x47a840-0x0;var _0x1e1294=_0x59e0[_0x47a840];return _0x1e1294;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x059e('0x0'));module[_0x059e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x059e('0x2')]},'disposition':{'type':Sequelize[_0x059e('0x3')]},'note':{'type':Sequelize[_0x059e('0x3')]},'phone':{'type':Sequelize[_0x059e('0x3')]},'read1stAt':{'type':Sequelize[_0x059e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x059e('0x4')]('in',_0x059e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x059e('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x059e('0x5')),'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 6ec23d0..3388128 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7a54,0x106));var _0x47a5=function(_0x323bc7,_0x3526d7){_0x323bc7=_0x323bc7-0x0;var _0x5184e7=_0x7a54[_0x323bc7];return _0x5184e7;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file +var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x4fa811,_0x20f8b3){var _0x23518e=function(_0x429e21){while(--_0x429e21){_0x4fa811['push'](_0x4fa811['shift']());}};_0x23518e(++_0x20f8b3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc4aa[_0xfae23b];return _0x200640;};'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 854c3be..ff17120 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 _0xf62d=['emit','catch','hook','exports','events','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','length'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xf62d,0x1a4));var _0xdf62=function(_0x514a5c,_0xf57fc5){_0x514a5c=_0x514a5c-0x0;var _0x3f2b=_0xf62d[_0x514a5c];return _0x3f2b;};'use strict';var EventEmitter=require(_0xdf62('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xdf62('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xdf62('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xdf62('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdf62('0x4'),'afterDestroy':_0xdf62('0x5')};function emitEvent(_0x586b4b){return function(_0x32ae85,_0x25df24,_0x5775ac){_0x32ae85[_0xdf62('0x6')]({'attributes':['id'],'raw':!![]})[_0xdf62('0x7')](function(_0x1519e2){_0x32ae85[_0xdf62('0x8')]('Users',_0x1519e2['map'](function(_0xcc40d6){return{'id':_0xcc40d6['id']};}));return WhatsappMessage[_0xdf62('0x9')]({'where':{'WhatsappInteractionId':_0x32ae85['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d025e){_0x32ae85['setDataValue'](_0xdf62('0xa'),_0x4d025e[_0xdf62('0xb')]);WhatsappInteractionEvents[_0xdf62('0xc')](_0x586b4b+':'+_0x32ae85['id'],_0x32ae85);WhatsappInteractionEvents[_0xdf62('0xc')](_0x586b4b,_0x32ae85);_0x5775ac(null);})[_0xdf62('0xd')](_0x5775ac(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xdf62('0xe')](e,emitEvent(event));}}module[_0xdf62('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x3fcd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x2c7ea5,_0x2cb359){var _0x4251c6=function(_0x5882fa){while(--_0x5882fa){_0x2c7ea5['push'](_0x2c7ea5['shift']());}};_0x4251c6(++_0x2cb359);}(_0x3fcd,0x10e));var _0xd3fc=function(_0x4b474b,_0x57f3fd){_0x4b474b=_0x4b474b-0x0;var _0x5aa9dc=_0x3fcd[_0x4b474b];return _0x5aa9dc;};'use strict';var EventEmitter=require(_0xd3fc('0x0'));var WhatsappInteraction=require(_0xd3fc('0x1'))['db'][_0xd3fc('0x2')];var WhatsappMessage=require(_0xd3fc('0x1'))['db'][_0xd3fc('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd3fc('0x4')](0x0);var events={'afterCreate':_0xd3fc('0x5'),'afterUpdate':_0xd3fc('0x6'),'afterDestroy':_0xd3fc('0x7')};function emitEvent(_0x4bfe04){return function(_0x2a49dd,_0x59615b,_0x48daaf){_0x2a49dd[_0xd3fc('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1df4e1){_0x2a49dd[_0xd3fc('0x9')](_0xd3fc('0xa'),_0x1df4e1[_0xd3fc('0xb')](function(_0x3d0446){return{'id':_0x3d0446['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2a49dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd3fc('0xc')](function(_0x2f348f){_0x2a49dd[_0xd3fc('0x9')](_0xd3fc('0xd'),_0x2f348f[_0xd3fc('0xe')]);WhatsappInteractionEvents[_0xd3fc('0xf')](_0x4bfe04+':'+_0x2a49dd['id'],_0x2a49dd);WhatsappInteractionEvents[_0xd3fc('0xf')](_0x4bfe04,_0x2a49dd);_0x48daaf(null);})['catch'](_0x48daaf(null));};}for(var e in events){if(events[_0xd3fc('0x10')](e)){var event=events[e];WhatsappInteraction[_0xd3fc('0x11')](e,emitEvent(event));}}module[_0xd3fc('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index e103c66..550cc76 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x43ea48,_0x49c991){var _0x3a726c=function(_0x189821){while(--_0x189821){_0x43ea48['push'](_0x43ea48['shift']());}};_0x3a726c(++_0x49c991);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file +var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x513897,_0x4fc773){var _0x3b167b=function(_0x3191e8){while(--_0x3191e8){_0x513897['push'](_0x513897['shift']());}};_0x3b167b(++_0x4fc773);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 8a21489..bd65a41 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 _0x8f18=['omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','WhatsappInteraction','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTags','ids'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x8f18,0x193));var _0x88f1=function(_0x2a4a34,_0x29da1a){_0x2a4a34=_0x2a4a34-0x0;var _0x14b35c=_0x8f18[_0x2a4a34];return _0x14b35c;};'use strict';var _=require(_0x88f1('0x0'));var util=require(_0x88f1('0x1'));var moment=require(_0x88f1('0x2'));var BPromise=require(_0x88f1('0x3'));var rs=require(_0x88f1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88f1('0x5'))['db'];var utils=require(_0x88f1('0x6'));var logger=require(_0x88f1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x88f1('0x8'));var client=jayson['client'][_0x88f1('0x9')]({'port':0x232a});config['redis']=_[_0x88f1('0xa')](config[_0x88f1('0xb')],{'host':_0x88f1('0xc'),'port':0x18eb});var socket=require(_0x88f1('0xd'))(new Redis(config[_0x88f1('0xb')]));require(_0x88f1('0xe'))['register'](socket);function respondWithRpcPromise(_0x32eb80,_0x20b479,_0x1182ac){return new BPromise(function(_0x194aae,_0x3e05c3){return client[_0x88f1('0xf')](_0x32eb80,_0x1182ac)[_0x88f1('0x10')](function(_0x293ebe){logger[_0x88f1('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x20b479,_0x88f1('0x12'));logger[_0x88f1('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x20b479,_0x88f1('0x12'),JSON[_0x88f1('0x14')](_0x293ebe));if(_0x293ebe[_0x88f1('0x15')]){if(_0x293ebe['error'][_0x88f1('0x16')]===0x1f4){logger[_0x88f1('0x15')](_0x88f1('0x17'),_0x20b479,_0x293ebe[_0x88f1('0x15')][_0x88f1('0x18')]);return _0x3e05c3(_0x293ebe[_0x88f1('0x15')][_0x88f1('0x18')]);}logger[_0x88f1('0x15')](_0x88f1('0x17'),_0x20b479,_0x293ebe[_0x88f1('0x15')][_0x88f1('0x18')]);return _0x194aae(_0x293ebe[_0x88f1('0x15')][_0x88f1('0x18')]);}else{logger[_0x88f1('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x20b479,_0x88f1('0x12'));_0x194aae(_0x293ebe['result'][_0x88f1('0x18')]);}})[_0x88f1('0x19')](function(_0x445e20){logger[_0x88f1('0x15')](_0x88f1('0x17'),_0x20b479,_0x445e20);_0x3e05c3(_0x445e20);});});}exports['UpdateWhatsappInteraction']=function(_0x59d991){var _0x4e668c=this;return new Promise(function(_0x596f65,_0x2e11ad){return db[_0x88f1('0x1a')]['update'](_0x59d991[_0x88f1('0x1b')],{'raw':_0x59d991[_0x88f1('0x1c')]?_0x59d991[_0x88f1('0x1c')][_0x88f1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d991['options']?_0x59d991[_0x88f1('0x1c')][_0x88f1('0x1e')]||null:null,'attributes':_0x59d991['options']?_0x59d991['options'][_0x88f1('0x1f')]||null:null,'limit':_0x59d991['options']?_0x59d991[_0x88f1('0x1c')][_0x88f1('0x20')]||null:null})[_0x88f1('0x10')](function(_0x36ebf7){logger[_0x88f1('0x11')](_0x88f1('0x21'),_0x59d991);logger[_0x88f1('0x13')](_0x88f1('0x21'),_0x59d991,JSON[_0x88f1('0x14')](_0x36ebf7));_0x596f65(_0x36ebf7);})[_0x88f1('0x19')](function(_0x57a48a){logger[_0x88f1('0x15')](_0x88f1('0x21'),_0x57a48a[_0x88f1('0x18')],_0x59d991);_0x2e11ad(_0x4e668c[_0x88f1('0x15')](0x1f4,_0x57a48a[_0x88f1('0x18')]));});});};exports[_0x88f1('0x22')]=function(_0x2056c0){return new Promise(function(_0xc9751,_0x377447){return db[_0x88f1('0x1a')]['find']({'where':_0x2056c0['options']?_0x2056c0[_0x88f1('0x1c')][_0x88f1('0x1e')]||null:null})[_0x88f1('0x10')](function(_0x3cfc39){if(_0x3cfc39){return _0x3cfc39[_0x88f1('0x23')](_0x2056c0[_0x88f1('0x1b')][_0x88f1('0x24')],_[_0x88f1('0x25')](_0x2056c0[_0x88f1('0x1b')],[_0x88f1('0x24'),'id'])||{});}})[_0x88f1('0x26')](function(_0xab6141){logger[_0x88f1('0x11')](_0x88f1('0x27'),_0x2056c0);logger[_0x88f1('0x13')](_0x88f1('0x27'),_0x2056c0,JSON[_0x88f1('0x14')](_0xab6141));_0xc9751(_0xab6141);})[_0x88f1('0x19')](function(_0x473bd6){logger[_0x88f1('0x15')](_0x88f1('0x27'),_0x473bd6[_0x88f1('0x18')],_0x2056c0);_0x377447(_this[_0x88f1('0x15')](0x1f4,_0x473bd6[_0x88f1('0x18')]));});});}; \ No newline at end of file +var _0x976b=['bluebird','../../mysqldb','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','WhatsappInteraction','body','options','where','attributes','limit','UpdateWhatsappInteraction','find','addTags','spread','AddTags','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x976b,0x16a));var _0xb976=function(_0x3a0b34,_0x5d642a){_0x3a0b34=_0x3a0b34-0x0;var _0x373835=_0x976b[_0x3a0b34];return _0x373835;};'use strict';var _=require('lodash');var util=require(_0xb976('0x0'));var moment=require('moment');var BPromise=require(_0xb976('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb976('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb976('0x3'));var config=require(_0xb976('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb976('0x5')]=_[_0xb976('0x6')](config['redis'],{'host':_0xb976('0x7'),'port':0x18eb});var socket=require(_0xb976('0x8'))(new Redis(config[_0xb976('0x5')]));require(_0xb976('0x9'))[_0xb976('0xa')](socket);function respondWithRpcPromise(_0x4f08cd,_0xe56980,_0x5c7073){return new BPromise(function(_0x432be5,_0x44730a){return client[_0xb976('0xb')](_0x4f08cd,_0x5c7073)[_0xb976('0xc')](function(_0x35d133){logger[_0xb976('0xd')](_0xb976('0xe'),_0xe56980,'request\x20sent');logger[_0xb976('0xf')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xe56980,'request\x20sent',JSON[_0xb976('0x10')](_0x35d133));if(_0x35d133[_0xb976('0x11')]){if(_0x35d133[_0xb976('0x11')][_0xb976('0x12')]===0x1f4){logger[_0xb976('0x11')](_0xb976('0xe'),_0xe56980,_0x35d133['error'][_0xb976('0x13')]);return _0x44730a(_0x35d133['error'][_0xb976('0x13')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xe56980,_0x35d133[_0xb976('0x11')]['message']);return _0x432be5(_0x35d133[_0xb976('0x11')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0xe56980,_0xb976('0x14'));_0x432be5(_0x35d133['result'][_0xb976('0x13')]);}})[_0xb976('0x15')](function(_0x2e912e){logger[_0xb976('0x11')](_0xb976('0xe'),_0xe56980,_0x2e912e);_0x44730a(_0x2e912e);});});}exports['UpdateWhatsappInteraction']=function(_0x542491){var _0x2509b0=this;return new Promise(function(_0x540a3e,_0x41c730){return db[_0xb976('0x16')]['update'](_0x542491[_0xb976('0x17')],{'raw':_0x542491[_0xb976('0x18')]?_0x542491[_0xb976('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x542491[_0xb976('0x18')]?_0x542491[_0xb976('0x18')][_0xb976('0x19')]||null:null,'attributes':_0x542491[_0xb976('0x18')]?_0x542491[_0xb976('0x18')][_0xb976('0x1a')]||null:null,'limit':_0x542491['options']?_0x542491['options'][_0xb976('0x1b')]||null:null})[_0xb976('0xc')](function(_0x1d3c2a){logger[_0xb976('0xd')](_0xb976('0x1c'),_0x542491);logger[_0xb976('0xf')](_0xb976('0x1c'),_0x542491,JSON[_0xb976('0x10')](_0x1d3c2a));_0x540a3e(_0x1d3c2a);})[_0xb976('0x15')](function(_0x1c170b){logger[_0xb976('0x11')]('UpdateWhatsappInteraction',_0x1c170b['message'],_0x542491);_0x41c730(_0x2509b0[_0xb976('0x11')](0x1f4,_0x1c170b[_0xb976('0x13')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x153ab1){return new Promise(function(_0x12bc77,_0x2faa73){return db['WhatsappInteraction'][_0xb976('0x1d')]({'where':_0x153ab1[_0xb976('0x18')]?_0x153ab1[_0xb976('0x18')][_0xb976('0x19')]||null:null})[_0xb976('0xc')](function(_0x35252c){if(_0x35252c){return _0x35252c[_0xb976('0x1e')](_0x153ab1[_0xb976('0x17')]['ids'],_['omit'](_0x153ab1['body'],['ids','id'])||{});}})[_0xb976('0x1f')](function(_0x1f44c0){logger['info']('AddTags',_0x153ab1);logger[_0xb976('0xf')](_0xb976('0x20'),_0x153ab1,JSON[_0xb976('0x10')](_0x1f44c0));_0x12bc77(_0x1f44c0);})['catch'](function(_0x25c7fd){logger['error'](_0xb976('0x20'),_0x25c7fd[_0xb976('0x13')],_0x153ab1);_0x2faa73(_this[_0xb976('0x11')](0x1f4,_0x25c7fd[_0xb976('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index bb8f5b1..7c3018c 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 _0x0bc2=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x1c93be,_0x67b058){var _0x14b0e4=function(_0x1cbfb4){while(--_0x1cbfb4){_0x1c93be['push'](_0x1c93be['shift']());}};_0x14b0e4(++_0x67b058);}(_0x0bc2,0x9f));var _0x20bc=function(_0x3c9008,_0x2d89e1){_0x3c9008=_0x3c9008-0x0;var _0x7e20cd=_0x0bc2[_0x3c9008];return _0x7e20cd;};'use strict';var WhatsappInteractionEvents=require(_0x20bc('0x0'));var events=[_0x20bc('0x1'),_0x20bc('0x2'),_0x20bc('0x3')];function createListener(_0x38c0fb,_0x51f116){return function(_0x56d3ec){_0x51f116[_0x20bc('0x4')](_0x38c0fb,_0x56d3ec);};}function removeListener(_0x223589,_0x7d9f54){return function(){WhatsappInteractionEvents[_0x20bc('0x5')](_0x223589,_0x7d9f54);};}exports[_0x20bc('0x6')]=function(_0x230309){for(var _0x176515=0x0,_0x28762e=events[_0x20bc('0x7')];_0x176515<_0x28762e;_0x176515++){var _0x215c9c=events[_0x176515];var _0x4c6eeb=createListener(_0x20bc('0x8')+_0x215c9c,_0x230309);WhatsappInteractionEvents['on'](_0x215c9c,_0x4c6eeb);}}; \ No newline at end of file +var _0x0a29=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x934c22,_0x47b0ce){var _0x34e290=function(_0xcb436e){while(--_0xcb436e){_0x934c22['push'](_0x934c22['shift']());}};_0x34e290(++_0x47b0ce);}(_0x0a29,0x69));var _0x90a2=function(_0x42fb32,_0x1438a3){_0x42fb32=_0x42fb32-0x0;var _0x27d045=_0x0a29[_0x42fb32];return _0x27d045;};'use strict';var WhatsappInteractionEvents=require(_0x90a2('0x0'));var events=[_0x90a2('0x1'),_0x90a2('0x2'),_0x90a2('0x3')];function createListener(_0x2cd787,_0x4d6369){return function(_0x3a7195){_0x4d6369[_0x90a2('0x4')](_0x2cd787,_0x3a7195);};}function removeListener(_0x5d2a76,_0x50d230){return function(){WhatsappInteractionEvents[_0x90a2('0x5')](_0x5d2a76,_0x50d230);};}exports[_0x90a2('0x6')]=function(_0x19652c){for(var _0x3fef01=0x0,_0x5dca59=events[_0x90a2('0x7')];_0x3fef01<_0x5dca59;_0x3fef01++){var _0x51b36e=events[_0x3fef01];var _0x10b37b=createListener(_0x90a2('0x8')+_0x51b36e,_0x19652c);WhatsappInteractionEvents['on'](_0x51b36e,_0x10b37b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 7e9fa82..6f6939e 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 _0x1400=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','describe','/:id','show','post','tracked','whatsapp','/:id/status','put','update','reject'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x1400,0x189));var _0x0140=function(_0x29e613,_0x44f310){_0x29e613=_0x29e613-0x0;var _0x44a5aa=_0x1400[_0x29e613];return _0x44a5aa;};'use strict';var multer=require(_0x0140('0x0'));var util=require(_0x0140('0x1'));var path=require(_0x0140('0x2'));var timeout=require(_0x0140('0x3'));var express=require(_0x0140('0x4'));var router=express[_0x0140('0x5')]();var auth=require(_0x0140('0x6'));var interaction=require(_0x0140('0x7'));var config=require(_0x0140('0x8'));var controller=require(_0x0140('0x9'));router['get']('/',auth[_0x0140('0xa')](),controller[_0x0140('0xb')]);router[_0x0140('0xc')]('/describe',auth[_0x0140('0xa')](),controller[_0x0140('0xd')]);router[_0x0140('0xc')](_0x0140('0xe'),auth['isAuthenticated'](),controller[_0x0140('0xf')]);router[_0x0140('0x10')]('/',auth[_0x0140('0xa')](),interaction[_0x0140('0x11')](_0x0140('0x12'),'whatsappmessage:create'),controller['create']);router[_0x0140('0x10')](_0x0140('0x13'),controller['status']);router[_0x0140('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0140('0x15')]);router['put']('/:id/accept',auth[_0x0140('0xa')](),controller['accept']);router['put']('/:id/reject',auth[_0x0140('0xa')](),controller[_0x0140('0x16')]);router[_0x0140('0x17')](_0x0140('0xe'),auth['isAuthenticated'](),controller[_0x0140('0x18')]);module[_0x0140('0x19')]=router; \ No newline at end of file +var _0xc63b=['status','put','/:id/accept','/:id/reject','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status'];(function(_0x38e056,_0xe7b973){var _0x33646e=function(_0x35f3a0){while(--_0x35f3a0){_0x38e056['push'](_0x38e056['shift']());}};_0x33646e(++_0xe7b973);}(_0xc63b,0x124));var _0xbc63=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xc63b[_0x34bc30];return _0x5706de;};'use strict';var multer=require('multer');var util=require(_0xbc63('0x0'));var path=require(_0xbc63('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc63('0x2'));var router=express[_0xbc63('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbc63('0x4'));var config=require(_0xbc63('0x5'));var controller=require('./whatsappMessage.controller');router[_0xbc63('0x6')]('/',auth[_0xbc63('0x7')](),controller['index']);router[_0xbc63('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xbc63('0x8')]);router[_0xbc63('0x6')](_0xbc63('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xbc63('0xa')]('/',auth[_0xbc63('0x7')](),interaction[_0xbc63('0xb')](_0xbc63('0xc'),_0xbc63('0xd')),controller[_0xbc63('0xe')]);router['post'](_0xbc63('0xf'),controller[_0xbc63('0x10')]);router[_0xbc63('0x11')](_0xbc63('0x9'),auth[_0xbc63('0x7')](),controller['update']);router[_0xbc63('0x11')](_0xbc63('0x12'),auth[_0xbc63('0x7')](),controller['accept']);router[_0xbc63('0x11')](_0xbc63('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0xbc63('0x14')](_0xbc63('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xbc63('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 d0b6014..4c0225f 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 _0x13ad=['STRING','DATE','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x591781,_0x8e0ed2){var _0x315bd9=function(_0x39166c){while(--_0x39166c){_0x591781['push'](_0x591781['shift']());}};_0x315bd9(++_0x8e0ed2);}(_0x13ad,0x142));var _0xd13a=function(_0x26fa61,_0x37f387){_0x26fa61=_0x26fa61-0x0;var _0x4a9da0=_0x13ad[_0x26fa61];return _0x4a9da0;};'use strict';var Sequelize=require(_0xd13a('0x0'));module[_0xd13a('0x1')]={'body':{'type':Sequelize['TEXT'](_0xd13a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd13a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd13a('0x4')]('in',_0xd13a('0x5')),'defaultValue':_0xd13a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xd13a('0x6')]},'readAt':{'type':Sequelize[_0xd13a('0x7')]},'secret':{'type':Sequelize[_0xd13a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0565=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x5a6fbf,_0x20874e){var _0x883f31=function(_0x4721a1){while(--_0x4721a1){_0x5a6fbf['push'](_0x5a6fbf['shift']());}};_0x883f31(++_0x20874e);}(_0x0565,0xf2));var _0x5056=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x0565[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'body':{'type':Sequelize[_0x5056('0x2')](_0x5056('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5056('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5056('0x5')]('in',_0x5056('0x6')),'defaultValue':_0x5056('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5056('0x7')](0xbe)},'phone':{'type':Sequelize[_0x5056('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5056('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1de7c98..33d4e3c 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 _0x8e55=['where','merge','VIRTUAL','WhatsappMessage','includeAll','include','rows','catch','show','options','create','body','params','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','agent','rejectMessage','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','twilio','MessageSid','messageId','MessageStatus','read','inspect','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter'];(function(_0x290c25,_0x23c973){var _0x5a4d83=function(_0x4cebe3){while(--_0x4cebe3){_0x290c25['push'](_0x290c25['shift']());}};_0x5a4d83(++_0x23c973);}(_0x8e55,0x1c2));var _0x58e5=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0x8e55[_0x559a80];return _0x42f555;};'use strict';var pdf=require(_0x58e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x58e5('0x1'));var zipdir=require(_0x58e5('0x2'));var jsonpatch=require(_0x58e5('0x3'));var rp=require(_0x58e5('0x4'));var moment=require(_0x58e5('0x5'));var BPromise=require(_0x58e5('0x6'));var Mustache=require(_0x58e5('0x7'));var util=require(_0x58e5('0x8'));var path=require(_0x58e5('0x9'));var sox=require(_0x58e5('0xa'));var csv=require(_0x58e5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x58e5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x58e5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x58e5('0xe'));var hardwareService=require(_0x58e5('0xf'));var logger=require(_0x58e5('0x10'))(_0x58e5('0x11'));var utils=require(_0x58e5('0x12'));var config=require(_0x58e5('0x13'));var db=require(_0x58e5('0x14'))['db'];config[_0x58e5('0x15')]=_[_0x58e5('0x16')](config[_0x58e5('0x15')],{'host':_0x58e5('0x17'),'port':0x18eb});var socket=require(_0x58e5('0x18'))(new Redis(config[_0x58e5('0x15')]));require('./whatsappMessage.socket')[_0x58e5('0x19')](socket);var jayson=require(_0x58e5('0x1a'));var client=jayson[_0x58e5('0x1b')][_0x58e5('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x58e5('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x128b53,_0x4c2fc2,_0xb2e05c){if(_0xb2e05c){var _0x5b8a13=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b8a13['test'](_0x4c2fc2)){return _0x128b53;}else{throw new db[(_0x58e5('0x1d'))][(_0x58e5('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 _0x128b53;}}function respondWithRpcPromise(_0x2fab6b,_0x33c623,_0x37c9de,_0x143532){return new BPromise(function(_0x56a421,_0x452245){var _0x208ad1=_0x143532||client;return _0x208ad1[_0x58e5('0x1f')](_0x2fab6b,_0x37c9de)[_0x58e5('0x20')](function(_0x251260){logger[_0x58e5('0x21')](_0x58e5('0x22'),_0x33c623,'request\x20sent');logger[_0x58e5('0x23')](_0x58e5('0x24'),_0x33c623,'request\x20sent',JSON['stringify'](_0x251260));if(_0x251260['error']){if(_0x251260[_0x58e5('0x25')][_0x58e5('0x26')]===0x1f4){logger[_0x58e5('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x33c623,_0x251260[_0x58e5('0x25')][_0x58e5('0x27')]);return _0x452245(_0x251260[_0x58e5('0x25')][_0x58e5('0x27')]);}logger[_0x58e5('0x25')](_0x58e5('0x22'),_0x33c623,_0x251260[_0x58e5('0x25')][_0x58e5('0x27')]);return _0x56a421(_0x251260[_0x58e5('0x25')][_0x58e5('0x27')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x33c623,'request\x20sent');_0x56a421(_0x251260['result'][_0x58e5('0x27')]);}})['catch'](function(_0x111d18){logger[_0x58e5('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x33c623,_0x111d18);_0x452245(_0x111d18);});});}function respondWithStatusCode(_0x1b8bf1,_0x48d73e){_0x48d73e=_0x48d73e||0xcc;return function(_0xada233){if(_0xada233){return _0x1b8bf1['sendStatus'](_0x48d73e);}return _0x1b8bf1[_0x58e5('0x28')](_0x48d73e)[_0x58e5('0x29')]();};}function respondWithResult(_0xa95a34,_0x2eb242){_0x2eb242=_0x2eb242||0xc8;return function(_0x7186aa){if(_0x7186aa){return _0xa95a34['status'](_0x2eb242)[_0x58e5('0x2a')](_0x7186aa);}};}function respondWithFilteredResult(_0x22a779,_0x156d29){return function(_0x553b0d){if(_0x553b0d){var _0x3f4c00=_0x553b0d[_0x58e5('0x2b')],_0x15855a=_0x156d29['offset'],_0x4aef4f=_0x156d29[_0x58e5('0x2c')]+_0x156d29['limit'],_0x2cf3ea;if(_0x4aef4f>=_0x3f4c00){_0x4aef4f=_0x3f4c00;_0x2cf3ea=0xc8;}else{_0x2cf3ea=0xce;}_0x22a779[_0x58e5('0x28')](_0x2cf3ea);return _0x22a779[_0x58e5('0x2d')](_0x58e5('0x2e'),_0x15855a+'-'+_0x4aef4f+'/'+_0x3f4c00)[_0x58e5('0x2a')](_0x553b0d);}return null;};}function patchUpdates(_0xce7eb1){return function(_0x39ff88){try{jsonpatch[_0x58e5('0x2f')](_0x39ff88,_0xce7eb1,!![]);}catch(_0x3ccf28){return BPromise[_0x58e5('0x30')](_0x3ccf28);}return _0x39ff88[_0x58e5('0x31')]();};}function saveUpdates(_0x7fd77e,_0x1f7088){return function(_0x10f924){if(_0x10f924){return _0x10f924[_0x58e5('0x32')](_0x7fd77e)['then'](function(_0x31d609){return _0x31d609;});}return null;};}function removeEntity(_0x304f40,_0x501a62){return function(_0x23a0f6){if(_0x23a0f6){return _0x23a0f6[_0x58e5('0x33')]()[_0x58e5('0x20')](function(){_0x304f40[_0x58e5('0x28')](0xcc)[_0x58e5('0x29')]();});}};}function handleEntityNotFound(_0x2cbe60,_0x2bd41c){return function(_0x161ae1){if(!_0x161ae1){_0x2cbe60[_0x58e5('0x34')](0x194);}return _0x161ae1;};}function handleError(_0xd35c56,_0xb7179b){_0xb7179b=_0xb7179b||0x1f4;return function(_0x468944){logger['error'](_0x468944[_0x58e5('0x35')]);if(_0x468944[_0x58e5('0x36')]){delete _0x468944[_0x58e5('0x36')];}_0xd35c56[_0x58e5('0x28')](_0xb7179b)['send'](_0x468944);};}exports[_0x58e5('0x37')]=function(_0x4f8b54,_0x1d492d){var _0x342317={},_0x365e0d={},_0x53d83c={'count':0x0,'rows':[]};var _0x27d8e2=_[_0x58e5('0x38')](db['WhatsappMessage'][_0x58e5('0x39')],function(_0x2a1500){return{'name':_0x2a1500[_0x58e5('0x3a')],'type':_0x2a1500['type'][_0x58e5('0x3b')]};});_0x365e0d[_0x58e5('0x3c')]=_[_0x58e5('0x38')](_0x27d8e2,_0x58e5('0x36'));_0x365e0d['query']=_[_0x58e5('0x3d')](_0x4f8b54[_0x58e5('0x3e')]);_0x365e0d[_0x58e5('0x3f')]=_[_0x58e5('0x40')](_0x365e0d[_0x58e5('0x3c')],_0x365e0d[_0x58e5('0x3e')]);_0x342317[_0x58e5('0x41')]=_[_0x58e5('0x40')](_0x365e0d[_0x58e5('0x3c')],qs[_0x58e5('0x42')](_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x42')]));_0x342317[_0x58e5('0x41')]=_0x342317['attributes'][_0x58e5('0x43')]?_0x342317[_0x58e5('0x41')]:_0x365e0d[_0x58e5('0x3c')];if(!_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x44')](_0x58e5('0x45'))){_0x342317[_0x58e5('0x46')]=qs[_0x58e5('0x46')](_0x4f8b54[_0x58e5('0x3e')]['limit']);_0x342317['offset']=qs[_0x58e5('0x2c')](_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x2c')]);}_0x342317['order']=qs[_0x58e5('0x47')](_0x4f8b54['query'][_0x58e5('0x47')]);_0x342317['where']=qs['filters'](_[_0x58e5('0x48')](_0x4f8b54[_0x58e5('0x3e')],_0x365e0d[_0x58e5('0x3f')]),_0x27d8e2);if(_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x49')]){_0x342317[_0x58e5('0x4a')]=_[_0x58e5('0x4b')](_0x342317[_0x58e5('0x4a')],{'$or':_['map'](_0x27d8e2,function(_0x2def30){if(_0x2def30['type']!==_0x58e5('0x4c')){var _0x13e693={};_0x13e693[_0x2def30[_0x58e5('0x36')]]={'$like':'%'+_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x49')]+'%'};return _0x13e693;}})});}_0x342317=_[_0x58e5('0x4b')]({},_0x342317,_0x4f8b54['options']);var _0x5651c8={'where':_0x342317[_0x58e5('0x4a')]};return db[_0x58e5('0x4d')]['count'](_0x5651c8)[_0x58e5('0x20')](function(_0x47b191){_0x53d83c[_0x58e5('0x2b')]=_0x47b191;if(_0x4f8b54[_0x58e5('0x3e')][_0x58e5('0x4e')]){_0x342317[_0x58e5('0x4f')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x342317);})[_0x58e5('0x20')](function(_0x239311){_0x53d83c[_0x58e5('0x50')]=_0x239311;return _0x53d83c;})[_0x58e5('0x20')](respondWithFilteredResult(_0x1d492d,_0x342317))[_0x58e5('0x51')](handleError(_0x1d492d,null));};exports[_0x58e5('0x52')]=function(_0x1f4b23,_0x55f40e){var _0x1f4699={'raw':!![],'where':{'id':_0x1f4b23['params']['id']}},_0x4a98a6={};_0x4a98a6[_0x58e5('0x3c')]=_['keys'](db['WhatsappMessage'][_0x58e5('0x39')]);_0x4a98a6[_0x58e5('0x3e')]=_[_0x58e5('0x3d')](_0x1f4b23[_0x58e5('0x3e')]);_0x4a98a6['filters']=_[_0x58e5('0x40')](_0x4a98a6[_0x58e5('0x3c')],_0x4a98a6[_0x58e5('0x3e')]);_0x1f4699[_0x58e5('0x41')]=_[_0x58e5('0x40')](_0x4a98a6[_0x58e5('0x3c')],qs[_0x58e5('0x42')](_0x1f4b23[_0x58e5('0x3e')][_0x58e5('0x42')]));_0x1f4699[_0x58e5('0x41')]=_0x1f4699[_0x58e5('0x41')][_0x58e5('0x43')]?_0x1f4699[_0x58e5('0x41')]:_0x4a98a6[_0x58e5('0x3c')];if(_0x1f4b23['query'][_0x58e5('0x4e')]){_0x1f4699[_0x58e5('0x4f')]=[{'all':!![]}];}_0x1f4699=_[_0x58e5('0x4b')]({},_0x1f4699,_0x1f4b23[_0x58e5('0x53')]);return db[_0x58e5('0x4d')]['find'](_0x1f4699)[_0x58e5('0x20')](handleEntityNotFound(_0x55f40e,null))[_0x58e5('0x20')](respondWithResult(_0x55f40e,null))[_0x58e5('0x51')](handleError(_0x55f40e,null));};exports['create']=function(_0x16731d,_0x117f86){return db[_0x58e5('0x4d')][_0x58e5('0x54')](_0x16731d[_0x58e5('0x55')],{})[_0x58e5('0x20')](respondWithResult(_0x117f86,0xc9))[_0x58e5('0x51')](handleError(_0x117f86,null));};exports[_0x58e5('0x32')]=function(_0x10c117,_0x13bd1b){if(_0x10c117[_0x58e5('0x55')]['id']){delete _0x10c117[_0x58e5('0x55')]['id'];}return db[_0x58e5('0x4d')]['find']({'where':{'id':_0x10c117['params']['id']}})[_0x58e5('0x20')](handleEntityNotFound(_0x13bd1b,null))[_0x58e5('0x20')](saveUpdates(_0x10c117[_0x58e5('0x55')],null))['then'](respondWithResult(_0x13bd1b,null))[_0x58e5('0x51')](handleError(_0x13bd1b,null));};exports[_0x58e5('0x33')]=function(_0x1e6d78,_0x421cd0){return db[_0x58e5('0x4d')]['find']({'where':{'id':_0x1e6d78[_0x58e5('0x56')]['id']}})[_0x58e5('0x20')](handleEntityNotFound(_0x421cd0,null))['then'](removeEntity(_0x421cd0,null))['catch'](handleError(_0x421cd0,null));};exports[_0x58e5('0x57')]=function(_0x2610e7,_0x307290){return db['WhatsappMessage'][_0x58e5('0x57')]()[_0x58e5('0x20')](respondWithResult(_0x307290,null))[_0x58e5('0x51')](handleError(_0x307290,null));};var interaction_log=require(_0x58e5('0x10'))(_0x58e5('0x58'));exports[_0x58e5('0x59')]=function(_0x3775bc,_0x414cef,_0x35d763){var _0x126b07={'channel':_0x58e5('0x5a')};if(_0x3775bc[_0x58e5('0x55')]['id']){delete _0x3775bc['body']['id'];}_0x3775bc[_0x58e5('0x55')]['read']=!![];_0x3775bc['body'][_0x58e5('0x5b')]=moment()[_0x58e5('0x5c')](_0x58e5('0x5d'));_0x3775bc[_0x58e5('0x55')]['UserId']=_0x3775bc[_0x58e5('0x55')][_0x58e5('0x5e')]||_0x3775bc[_0x58e5('0x5f')]['id'];return db[_0x58e5('0x4d')][_0x58e5('0x60')]({'where':{'id':_0x3775bc[_0x58e5('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x58e5('0x61')],'as':_0x58e5('0x62')}]})[_0x58e5('0x20')](handleEntityNotFound(_0x414cef,null))['then'](saveUpdates(_0x3775bc[_0x58e5('0x55')],null))[_0x58e5('0x20')](function(_0x1db432){if(_0x1db432){_0x126b07[_0x58e5('0x27')]=_0x1db432['get']({'plain':!![]});return db[_0x58e5('0x63')]['find']({'where':{'id':_0x1db432[_0x58e5('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x414cef,null))[_0x58e5('0x20')](function(_0x4f7afc){if(_0x4f7afc){return _0x4f7afc[_0x58e5('0x32')]({'UserId':_0x3775bc[_0x58e5('0x55')][_0x58e5('0x5e')],'read1stAt':_[_0x58e5('0x65')](_0x4f7afc[_0x58e5('0x66')])?moment()[_0x58e5('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x58e5('0x20')](function(_0x3790de){if(_0x3790de){_0x126b07[_0x58e5('0x67')]=_0x3790de[_0x58e5('0x68')]({'plain':!![]});interaction_log[_0x58e5('0x21')](_0x58e5('0x69'),_0x3775bc['user']['id'],_0x3775bc[_0x58e5('0x5f')]['name'],_0x3775bc[_0x58e5('0x5f')][_0x58e5('0x6a')],_0x126b07['interaction']['id'],_0x3775bc[_0x58e5('0x55')]?JSON[_0x58e5('0x6b')](_0x3775bc['body']):_0x58e5('0x6c'));return respondWithRpcPromise(_0x58e5('0x6d'),_0x58e5('0x6e'),_0x126b07);}return null;})['then'](function(_0x23a163){if(_0x23a163){if(_0x3775bc['body'][_0x58e5('0x6f')]){_0x126b07['message']['interface']=util[_0x58e5('0x5c')](_0x58e5('0x70'),_0x3775bc['user'][_0x58e5('0x36')]);_0x126b07['message'][_0x58e5('0x71')]=_0x126b07[_0x58e5('0x71')];_0x126b07[_0x58e5('0x27')][_0x58e5('0x72')]=_0x58e5('0x59');return respondWithRpcPromise(_0x58e5('0x73'),_0x58e5('0x73'),{'event':'acceptmessage','message':_0x126b07[_0x58e5('0x27')]},client9002)['then'](function(){return _0x126b07;});}return _0x126b07;}return null;})[_0x58e5('0x20')](respondWithResult(_0x414cef,null))[_0x58e5('0x51')](handleError(_0x414cef,null));};var interaction_log=require('../../config/logger')(_0x58e5('0x58'));exports['reject']=function(_0x422c4e,_0x144352,_0x383d46){var _0x264543={'agent':{},'channel':_0x58e5('0x5a')};if(_0x422c4e[_0x58e5('0x55')]['id']){delete _0x422c4e['body']['id'];}_0x422c4e[_0x58e5('0x55')]['UserId']=_0x422c4e[_0x58e5('0x55')]['UserId']||_0x422c4e['user']['id'];_0x264543[_0x58e5('0x74')]['id']=_0x422c4e['body']['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x422c4e[_0x58e5('0x56')]['id'],'UserId':null}})[_0x58e5('0x20')](handleEntityNotFound(_0x144352,null))[_0x58e5('0x20')](function(_0x575607){if(_0x575607){_0x264543[_0x58e5('0x27')]=_0x575607['get']({'plain':!![]});return db[_0x58e5('0x63')][_0x58e5('0x60')]({'where':{'id':_0x575607['WhatsappInteractionId']}});}return null;})[_0x58e5('0x20')](handleEntityNotFound(_0x144352,null))[_0x58e5('0x20')](function(_0x581a63){if(_0x581a63){_0x264543['interaction']=_0x581a63['get']({'plain':!![]});interaction_log[_0x58e5('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x422c4e[_0x58e5('0x5f')]['id'],_0x422c4e[_0x58e5('0x5f')][_0x58e5('0x36')],_0x422c4e[_0x58e5('0x5f')]['role'],_0x264543[_0x58e5('0x67')]['id'],_0x422c4e[_0x58e5('0x55')]?JSON[_0x58e5('0x6b')](_0x422c4e[_0x58e5('0x55')]):_0x58e5('0x6c'));return respondWithRpcPromise('RejectMessage',_0x58e5('0x75'),_0x264543);}return null;})[_0x58e5('0x20')](function(_0x45d3e6){if(_0x45d3e6){_0x45d3e6[_0x58e5('0x27')][_0x58e5('0x76')]=util[_0x58e5('0x5c')](_0x58e5('0x70'),_0x422c4e[_0x58e5('0x5f')][_0x58e5('0x36')]);_0x45d3e6[_0x58e5('0x27')][_0x58e5('0x71')]=_0x264543[_0x58e5('0x71')];_0x45d3e6[_0x58e5('0x27')]['event']='reject';respondWithRpcPromise('EventManager',_0x58e5('0x73'),{'event':_0x58e5('0x77'),'message':_0x45d3e6[_0x58e5('0x27')]},client9002);return _0x264543;}return null;})['then'](respondWithResult(_0x144352,null))[_0x58e5('0x51')](handleError(_0x144352,null));};exports[_0x58e5('0x28')]=function(_0x458a5f,_0x2770ce,_0x11f467){if(_0x458a5f[_0x58e5('0x55')]['id']){delete _0x458a5f['body']['id'];}var _0x5f3a81;return db['WhatsappMessage'][_0x58e5('0x60')]({'where':{'id':_0x458a5f['params']['id']}})[_0x58e5('0x20')](handleEntityNotFound(_0x2770ce,null))['then'](function(_0x2778a7){if(_0x2778a7){_0x5f3a81=_0x2778a7;return db[_0x58e5('0x78')][_0x58e5('0x60')]({'where':{'id':_0x2778a7[_0x58e5('0x79')]}});}})['then'](handleEntityNotFound(_0x2770ce,null))['then'](function(_0x128107){if(_0x128107){logger[_0x58e5('0x23')](_0x58e5('0x7a'),_0x58e5('0x28'),_0x58e5('0x7b'),_0x128107['type'],util['inspect'](_0x458a5f[_0x58e5('0x55')],{'showHidden':![],'depth':null}));switch(_0x128107[_0x58e5('0x7c')]){case _0x58e5('0x7d'):if(_0x458a5f[_0x58e5('0x55')]['MessageSid']&&_0x458a5f[_0x58e5('0x55')][_0x58e5('0x7e')]===_0x5f3a81[_0x58e5('0x7f')]&&_0x458a5f['body'][_0x58e5('0x80')]&&_0x458a5f[_0x58e5('0x55')][_0x58e5('0x80')]===_0x58e5('0x81')){return _0x5f3a81[_0x58e5('0x32')]({'read':!![]});}else{logger[_0x58e5('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x58e5('0x28'),_0x58e5('0x7d'),util[_0x58e5('0x82')](_0x458a5f['body'],{'showHidden':![],'depth':null}));}break;}return _0x5f3a81;}})[_0x58e5('0x20')](respondWithResult(_0x2770ce,null))[_0x58e5('0x51')](handleError(_0x2770ce,null));}; \ No newline at end of file +var _0x1a4f=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','destroy','stack','name','map','WhatsappMessage','rawAttributes','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','manual','interface','channel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SIP/%s','rejectmessage','WhatsappAccount','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','http','test','ValidationError'];(function(_0x32a069,_0x2b24b4){var _0x2978a3=function(_0x224e81){while(--_0x224e81){_0x32a069['push'](_0x32a069['shift']());}};_0x2978a3(++_0x2b24b4);}(_0x1a4f,0x151));var _0xf1a4=function(_0x2c46e0,_0x168644){_0x2c46e0=_0x2c46e0-0x0;var _0xb3640c=_0x1a4f[_0x2c46e0];return _0xb3640c;};'use strict';var pdf=require(_0xf1a4('0x0'));var emlformat=require(_0xf1a4('0x1'));var rimraf=require(_0xf1a4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf1a4('0x3'));var rp=require('request-promise');var moment=require(_0xf1a4('0x4'));var BPromise=require(_0xf1a4('0x5'));var Mustache=require('mustache');var util=require(_0xf1a4('0x6'));var path=require(_0xf1a4('0x7'));var sox=require(_0xf1a4('0x8'));var csv=require(_0xf1a4('0x9'));var ejs=require(_0xf1a4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf1a4('0xb'));var crypto=require(_0xf1a4('0xc'));var jsforce=require(_0xf1a4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf1a4('0x9'));var querystring=require('querystring');var Papa=require(_0xf1a4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf1a4('0xf'));var as=require(_0xf1a4('0x10'));var hardwareService=require(_0xf1a4('0x11'));var logger=require(_0xf1a4('0x12'))(_0xf1a4('0x13'));var utils=require(_0xf1a4('0x14'));var config=require(_0xf1a4('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xf1a4('0x16')],{'host':_0xf1a4('0x17'),'port':0x18eb});var socket=require(_0xf1a4('0x18'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xf1a4('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf1a4('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0xf1a4('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x22a003,_0x5df7ac,_0x3f6425){if(_0x3f6425){var _0x3338a8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3338a8[_0xf1a4('0x1b')](_0x5df7ac)){return _0x22a003;}else{throw new db['Sequelize'][(_0xf1a4('0x1c'))](_0xf1a4('0x1d'));}}else{return _0x22a003;}}function respondWithRpcPromise(_0x597707,_0x124dc8,_0x4fd217,_0x4ed33c){return new BPromise(function(_0x5d92a1,_0x43acd4){var _0x188884=_0x4ed33c||client;return _0x188884[_0xf1a4('0x1e')](_0x597707,_0x4fd217)[_0xf1a4('0x1f')](function(_0x1aa738){logger[_0xf1a4('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x124dc8,_0xf1a4('0x21'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x124dc8,'request\x20sent',JSON[_0xf1a4('0x22')](_0x1aa738));if(_0x1aa738['error']){if(_0x1aa738[_0xf1a4('0x23')][_0xf1a4('0x24')]===0x1f4){logger[_0xf1a4('0x23')](_0xf1a4('0x25'),_0x124dc8,_0x1aa738['error']['message']);return _0x43acd4(_0x1aa738[_0xf1a4('0x23')][_0xf1a4('0x26')]);}logger[_0xf1a4('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x124dc8,_0x1aa738[_0xf1a4('0x23')][_0xf1a4('0x26')]);return _0x5d92a1(_0x1aa738['error'][_0xf1a4('0x26')]);}else{logger[_0xf1a4('0x20')](_0xf1a4('0x25'),_0x124dc8,'request\x20sent');_0x5d92a1(_0x1aa738[_0xf1a4('0x27')][_0xf1a4('0x26')]);}})[_0xf1a4('0x28')](function(_0x333690){logger[_0xf1a4('0x23')](_0xf1a4('0x25'),_0x124dc8,_0x333690);_0x43acd4(_0x333690);});});}function respondWithStatusCode(_0x3878c6,_0x5618ab){_0x5618ab=_0x5618ab||0xcc;return function(_0x6102e6){if(_0x6102e6){return _0x3878c6[_0xf1a4('0x29')](_0x5618ab);}return _0x3878c6[_0xf1a4('0x2a')](_0x5618ab)['end']();};}function respondWithResult(_0x10d167,_0x31296d){_0x31296d=_0x31296d||0xc8;return function(_0x53ca18){if(_0x53ca18){return _0x10d167[_0xf1a4('0x2a')](_0x31296d)[_0xf1a4('0x2b')](_0x53ca18);}};}function respondWithFilteredResult(_0x5ed63c,_0xfbd6a7){return function(_0x3ba15e){if(_0x3ba15e){var _0x317d1b=_0x3ba15e[_0xf1a4('0x2c')],_0xe05d00=_0xfbd6a7[_0xf1a4('0x2d')],_0x5acae9=_0xfbd6a7[_0xf1a4('0x2d')]+_0xfbd6a7[_0xf1a4('0x2e')],_0xd841a6;if(_0x5acae9>=_0x317d1b){_0x5acae9=_0x317d1b;_0xd841a6=0xc8;}else{_0xd841a6=0xce;}_0x5ed63c[_0xf1a4('0x2a')](_0xd841a6);return _0x5ed63c[_0xf1a4('0x2f')](_0xf1a4('0x30'),_0xe05d00+'-'+_0x5acae9+'/'+_0x317d1b)['json'](_0x3ba15e);}return null;};}function patchUpdates(_0x47ed9b){return function(_0x3852c9){try{jsonpatch['apply'](_0x3852c9,_0x47ed9b,!![]);}catch(_0x40e80d){return BPromise[_0xf1a4('0x31')](_0x40e80d);}return _0x3852c9['save']();};}function saveUpdates(_0x1f1608,_0x3d4aab){return function(_0x4d8cd0){if(_0x4d8cd0){return _0x4d8cd0['update'](_0x1f1608)[_0xf1a4('0x1f')](function(_0x5ee33d){return _0x5ee33d;});}return null;};}function removeEntity(_0x256f7a,_0xd862f9){return function(_0x34e3bd){if(_0x34e3bd){return _0x34e3bd[_0xf1a4('0x32')]()[_0xf1a4('0x1f')](function(){_0x256f7a[_0xf1a4('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d761,_0xc5389d){return function(_0x6d5d98){if(!_0x6d5d98){_0x53d761[_0xf1a4('0x29')](0x194);}return _0x6d5d98;};}function handleError(_0x168ce2,_0x45c85c){_0x45c85c=_0x45c85c||0x1f4;return function(_0x3ad481){logger[_0xf1a4('0x23')](_0x3ad481[_0xf1a4('0x33')]);if(_0x3ad481['name']){delete _0x3ad481[_0xf1a4('0x34')];}_0x168ce2[_0xf1a4('0x2a')](_0x45c85c)['send'](_0x3ad481);};}exports['index']=function(_0x1d9efb,_0x41e4b2){var _0x3852d1={},_0x5c9e67={},_0x147f0d={'count':0x0,'rows':[]};var _0x4767b8=_[_0xf1a4('0x35')](db[_0xf1a4('0x36')][_0xf1a4('0x37')],function(_0x4d8a47){return{'name':_0x4d8a47['fieldName'],'type':_0x4d8a47[_0xf1a4('0x38')]['key']};});_0x5c9e67['model']=_[_0xf1a4('0x35')](_0x4767b8,_0xf1a4('0x34'));_0x5c9e67[_0xf1a4('0x39')]=_[_0xf1a4('0x3a')](_0x1d9efb[_0xf1a4('0x39')]);_0x5c9e67['filters']=_[_0xf1a4('0x3b')](_0x5c9e67[_0xf1a4('0x3c')],_0x5c9e67[_0xf1a4('0x39')]);_0x3852d1['attributes']=_[_0xf1a4('0x3b')](_0x5c9e67[_0xf1a4('0x3c')],qs[_0xf1a4('0x3d')](_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x3d')]));_0x3852d1['attributes']=_0x3852d1[_0xf1a4('0x3e')][_0xf1a4('0x3f')]?_0x3852d1[_0xf1a4('0x3e')]:_0x5c9e67[_0xf1a4('0x3c')];if(!_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x40')](_0xf1a4('0x41'))){_0x3852d1[_0xf1a4('0x2e')]=qs[_0xf1a4('0x2e')](_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x2e')]);_0x3852d1['offset']=qs[_0xf1a4('0x2d')](_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x2d')]);}_0x3852d1[_0xf1a4('0x42')]=qs[_0xf1a4('0x43')](_0x1d9efb[_0xf1a4('0x39')]['sort']);_0x3852d1[_0xf1a4('0x44')]=qs['filters'](_['pick'](_0x1d9efb[_0xf1a4('0x39')],_0x5c9e67[_0xf1a4('0x45')]),_0x4767b8);if(_0x1d9efb[_0xf1a4('0x39')][_0xf1a4('0x46')]){_0x3852d1[_0xf1a4('0x44')]=_[_0xf1a4('0x47')](_0x3852d1[_0xf1a4('0x44')],{'$or':_[_0xf1a4('0x35')](_0x4767b8,function(_0x4cd9c4){if(_0x4cd9c4[_0xf1a4('0x38')]!=='VIRTUAL'){var _0x11f0ff={};_0x11f0ff[_0x4cd9c4[_0xf1a4('0x34')]]={'$like':'%'+_0x1d9efb['query'][_0xf1a4('0x46')]+'%'};return _0x11f0ff;}})});}_0x3852d1=_[_0xf1a4('0x47')]({},_0x3852d1,_0x1d9efb['options']);var _0x5901cb={'where':_0x3852d1[_0xf1a4('0x44')]};return db[_0xf1a4('0x36')][_0xf1a4('0x2c')](_0x5901cb)['then'](function(_0x2b2d55){_0x147f0d[_0xf1a4('0x2c')]=_0x2b2d55;if(_0x1d9efb['query'][_0xf1a4('0x48')]){_0x3852d1[_0xf1a4('0x49')]=[{'all':!![]}];}return db[_0xf1a4('0x36')][_0xf1a4('0x4a')](_0x3852d1);})[_0xf1a4('0x1f')](function(_0x3a8b24){_0x147f0d[_0xf1a4('0x4b')]=_0x3a8b24;return _0x147f0d;})[_0xf1a4('0x1f')](respondWithFilteredResult(_0x41e4b2,_0x3852d1))[_0xf1a4('0x28')](handleError(_0x41e4b2,null));};exports[_0xf1a4('0x4c')]=function(_0x4a2bed,_0x1e53a9){var _0x37a351={'raw':!![],'where':{'id':_0x4a2bed[_0xf1a4('0x4d')]['id']}},_0x28708b={};_0x28708b[_0xf1a4('0x3c')]=_['keys'](db[_0xf1a4('0x36')][_0xf1a4('0x37')]);_0x28708b[_0xf1a4('0x39')]=_['keys'](_0x4a2bed[_0xf1a4('0x39')]);_0x28708b[_0xf1a4('0x45')]=_[_0xf1a4('0x3b')](_0x28708b[_0xf1a4('0x3c')],_0x28708b['query']);_0x37a351[_0xf1a4('0x3e')]=_[_0xf1a4('0x3b')](_0x28708b['model'],qs['fields'](_0x4a2bed[_0xf1a4('0x39')]['fields']));_0x37a351[_0xf1a4('0x3e')]=_0x37a351[_0xf1a4('0x3e')][_0xf1a4('0x3f')]?_0x37a351[_0xf1a4('0x3e')]:_0x28708b['model'];if(_0x4a2bed[_0xf1a4('0x39')][_0xf1a4('0x48')]){_0x37a351['include']=[{'all':!![]}];}_0x37a351=_['merge']({},_0x37a351,_0x4a2bed[_0xf1a4('0x4e')]);return db[_0xf1a4('0x36')][_0xf1a4('0x4f')](_0x37a351)[_0xf1a4('0x1f')](handleEntityNotFound(_0x1e53a9,null))['then'](respondWithResult(_0x1e53a9,null))[_0xf1a4('0x28')](handleError(_0x1e53a9,null));};exports[_0xf1a4('0x50')]=function(_0x3ad26a,_0x4d4e85){return db[_0xf1a4('0x36')][_0xf1a4('0x50')](_0x3ad26a[_0xf1a4('0x51')],{})['then'](respondWithResult(_0x4d4e85,0xc9))[_0xf1a4('0x28')](handleError(_0x4d4e85,null));};exports[_0xf1a4('0x52')]=function(_0x36a732,_0x4d0cff){if(_0x36a732[_0xf1a4('0x51')]['id']){delete _0x36a732['body']['id'];}return db[_0xf1a4('0x36')][_0xf1a4('0x4f')]({'where':{'id':_0x36a732['params']['id']}})[_0xf1a4('0x1f')](handleEntityNotFound(_0x4d0cff,null))[_0xf1a4('0x1f')](saveUpdates(_0x36a732[_0xf1a4('0x51')],null))['then'](respondWithResult(_0x4d0cff,null))[_0xf1a4('0x28')](handleError(_0x4d0cff,null));};exports[_0xf1a4('0x32')]=function(_0x33a66a,_0x4ea7f8){return db[_0xf1a4('0x36')]['find']({'where':{'id':_0x33a66a[_0xf1a4('0x4d')]['id']}})[_0xf1a4('0x1f')](handleEntityNotFound(_0x4ea7f8,null))[_0xf1a4('0x1f')](removeEntity(_0x4ea7f8,null))[_0xf1a4('0x28')](handleError(_0x4ea7f8,null));};exports[_0xf1a4('0x53')]=function(_0xaea142,_0x2eb7b5){return db['WhatsappMessage'][_0xf1a4('0x53')]()[_0xf1a4('0x1f')](respondWithResult(_0x2eb7b5,null))[_0xf1a4('0x28')](handleError(_0x2eb7b5,null));};var interaction_log=require(_0xf1a4('0x12'))(_0xf1a4('0x54'));exports[_0xf1a4('0x55')]=function(_0x1f002e,_0x3bbf36,_0x2dbf80){var _0x359996={'channel':_0xf1a4('0x56')};if(_0x1f002e[_0xf1a4('0x51')]['id']){delete _0x1f002e[_0xf1a4('0x51')]['id'];}_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x57')]=!![];_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x58')]=moment()[_0xf1a4('0x59')](_0xf1a4('0x5a'));_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x5b')]=_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x5b')]||_0x1f002e[_0xf1a4('0x5c')]['id'];return db[_0xf1a4('0x36')][_0xf1a4('0x4f')]({'where':{'id':_0x1f002e[_0xf1a4('0x4d')]['id'],'UserId':null},'include':[{'model':db[_0xf1a4('0x5d')],'as':_0xf1a4('0x5e')}]})[_0xf1a4('0x1f')](handleEntityNotFound(_0x3bbf36,null))[_0xf1a4('0x1f')](saveUpdates(_0x1f002e[_0xf1a4('0x51')],null))['then'](function(_0x13d11e){if(_0x13d11e){_0x359996[_0xf1a4('0x26')]=_0x13d11e[_0xf1a4('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xf1a4('0x4f')]({'where':{'id':_0x13d11e[_0xf1a4('0x60')]}});}return null;})[_0xf1a4('0x1f')](handleEntityNotFound(_0x3bbf36,null))[_0xf1a4('0x1f')](function(_0x297874){if(_0x297874){return _0x297874['update']({'UserId':_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x5b')],'read1stAt':_['isNil'](_0x297874[_0xf1a4('0x61')])?moment()[_0xf1a4('0x59')](_0xf1a4('0x5a')):undefined});}return null;})[_0xf1a4('0x1f')](function(_0x57479e){if(_0x57479e){_0x359996[_0xf1a4('0x62')]=_0x57479e[_0xf1a4('0x5f')]({'plain':!![]});interaction_log[_0xf1a4('0x20')](_0xf1a4('0x63'),_0x1f002e[_0xf1a4('0x5c')]['id'],_0x1f002e[_0xf1a4('0x5c')][_0xf1a4('0x34')],_0x1f002e[_0xf1a4('0x5c')][_0xf1a4('0x64')],_0x359996[_0xf1a4('0x62')]['id'],_0x1f002e[_0xf1a4('0x51')]?JSON['stringify'](_0x1f002e[_0xf1a4('0x51')]):'null');return respondWithRpcPromise(_0xf1a4('0x65'),'acceptMessage',_0x359996);}return null;})[_0xf1a4('0x1f')](function(_0x2d9ff8){if(_0x2d9ff8){if(_0x1f002e[_0xf1a4('0x51')][_0xf1a4('0x66')]){_0x359996[_0xf1a4('0x26')][_0xf1a4('0x67')]=util['format']('SIP/%s',_0x1f002e['user']['name']);_0x359996[_0xf1a4('0x26')][_0xf1a4('0x68')]=_0x359996['channel'];_0x359996[_0xf1a4('0x26')][_0xf1a4('0x69')]='accept';return respondWithRpcPromise(_0xf1a4('0x6a'),_0xf1a4('0x6a'),{'event':'acceptmessage','message':_0x359996[_0xf1a4('0x26')]},client9002)[_0xf1a4('0x1f')](function(){return _0x359996;});}return _0x359996;}return null;})[_0xf1a4('0x1f')](respondWithResult(_0x3bbf36,null))['catch'](handleError(_0x3bbf36,null));};var interaction_log=require(_0xf1a4('0x12'))(_0xf1a4('0x54'));exports[_0xf1a4('0x31')]=function(_0x58aa8b,_0x315d9a,_0x32e8b9){var _0x13654f={'agent':{},'channel':_0xf1a4('0x56')};if(_0x58aa8b[_0xf1a4('0x51')]['id']){delete _0x58aa8b[_0xf1a4('0x51')]['id'];}_0x58aa8b[_0xf1a4('0x51')][_0xf1a4('0x5b')]=_0x58aa8b[_0xf1a4('0x51')][_0xf1a4('0x5b')]||_0x58aa8b[_0xf1a4('0x5c')]['id'];_0x13654f['agent']['id']=_0x58aa8b[_0xf1a4('0x51')][_0xf1a4('0x5b')];return db[_0xf1a4('0x36')][_0xf1a4('0x4f')]({'where':{'id':_0x58aa8b[_0xf1a4('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x315d9a,null))['then'](function(_0x308ddc){if(_0x308ddc){_0x13654f['message']=_0x308ddc['get']({'plain':!![]});return db[_0xf1a4('0x6b')][_0xf1a4('0x4f')]({'where':{'id':_0x308ddc['WhatsappInteractionId']}});}return null;})[_0xf1a4('0x1f')](handleEntityNotFound(_0x315d9a,null))['then'](function(_0x245c38){if(_0x245c38){_0x13654f[_0xf1a4('0x62')]=_0x245c38['get']({'plain':!![]});interaction_log[_0xf1a4('0x20')](_0xf1a4('0x6c'),_0x58aa8b[_0xf1a4('0x5c')]['id'],_0x58aa8b['user']['name'],_0x58aa8b[_0xf1a4('0x5c')][_0xf1a4('0x64')],_0x13654f[_0xf1a4('0x62')]['id'],_0x58aa8b[_0xf1a4('0x51')]?JSON[_0xf1a4('0x22')](_0x58aa8b[_0xf1a4('0x51')]):_0xf1a4('0x6d'));return respondWithRpcPromise(_0xf1a4('0x6e'),_0xf1a4('0x6f'),_0x13654f);}return null;})[_0xf1a4('0x1f')](function(_0xd8afdb){if(_0xd8afdb){_0xd8afdb['message'][_0xf1a4('0x67')]=util[_0xf1a4('0x59')](_0xf1a4('0x70'),_0x58aa8b[_0xf1a4('0x5c')]['name']);_0xd8afdb[_0xf1a4('0x26')][_0xf1a4('0x68')]=_0x13654f['channel'];_0xd8afdb['message'][_0xf1a4('0x69')]=_0xf1a4('0x31');respondWithRpcPromise(_0xf1a4('0x6a'),_0xf1a4('0x6a'),{'event':_0xf1a4('0x71'),'message':_0xd8afdb[_0xf1a4('0x26')]},client9002);return _0x13654f;}return null;})['then'](respondWithResult(_0x315d9a,null))[_0xf1a4('0x28')](handleError(_0x315d9a,null));};exports[_0xf1a4('0x2a')]=function(_0x57aeae,_0x49d776,_0x3d3a08){if(_0x57aeae[_0xf1a4('0x51')]['id']){delete _0x57aeae[_0xf1a4('0x51')]['id'];}var _0x2e8a57;return db['WhatsappMessage'][_0xf1a4('0x4f')]({'where':{'id':_0x57aeae[_0xf1a4('0x4d')]['id']}})[_0xf1a4('0x1f')](handleEntityNotFound(_0x49d776,null))['then'](function(_0x14c7f9){if(_0x14c7f9){_0x2e8a57=_0x14c7f9;return db[_0xf1a4('0x72')][_0xf1a4('0x4f')]({'where':{'id':_0x14c7f9['WhatsappAccountId']}});}})[_0xf1a4('0x1f')](handleEntityNotFound(_0x49d776,null))[_0xf1a4('0x1f')](function(_0x7d027c){if(_0x7d027c){logger[_0xf1a4('0x73')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xf1a4('0x2a'),_0xf1a4('0x74'),_0x7d027c[_0xf1a4('0x38')],util[_0xf1a4('0x75')](_0x57aeae[_0xf1a4('0x51')],{'showHidden':![],'depth':null}));switch(_0x7d027c[_0xf1a4('0x38')]){case'twilio':if(_0x57aeae[_0xf1a4('0x51')]['MessageSid']&&_0x57aeae[_0xf1a4('0x51')][_0xf1a4('0x76')]===_0x2e8a57[_0xf1a4('0x77')]&&_0x57aeae[_0xf1a4('0x51')][_0xf1a4('0x78')]&&_0x57aeae['body']['MessageStatus']===_0xf1a4('0x57')){return _0x2e8a57[_0xf1a4('0x52')]({'read':!![]});}else{logger['error'](_0xf1a4('0x79'),_0xf1a4('0x2a'),'twilio',util['inspect'](_0x57aeae[_0xf1a4('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x2e8a57;}})[_0xf1a4('0x1f')](respondWithResult(_0x49d776,null))[_0xf1a4('0x28')](handleError(_0x49d776,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index f13c44f..9de1763 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(_0x266d1c,_0x5a5afc){var _0x132d6a=function(_0x36759d){while(--_0x36759d){_0x266d1c['push'](_0x266d1c['shift']());}};_0x132d6a(++_0x5a5afc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x390002,_0x31e6f4){_0x390002=_0x390002-0x0;var _0x3855dc=_0x5f2f[_0x390002];return _0x3855dc;};'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 _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x337c32,_0x187622){var _0x4bfb68=function(_0x2260bc){while(--_0x2260bc){_0x337c32['push'](_0x337c32['shift']());}};_0x4bfb68(++_0x187622);}(_0xb10b,0x12a));var _0xbb10=function(_0x124c75,_0x332013){_0x124c75=_0x124c75-0x0;var _0x5c5471=_0xb10b[_0x124c75];return _0x5c5471;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e237f5b..d5a1952 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 _0x3f4b=['error','out','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','create','whatsapp:','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','api','bluebird','path','rimraf','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','WhatsappInteraction','findOne','then','createdAt','catch'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x3f4b,0x98));var _0xb3f4=function(_0x4d0e1f,_0x2763e3){_0x4d0e1f=_0x4d0e1f-0x0;var _0x19f068=_0x3f4b[_0x4d0e1f];return _0x19f068;};'use strict';var _=require(_0xb3f4('0x0'));var util=require(_0xb3f4('0x1'));var logger=require('../../config/logger')(_0xb3f4('0x2'));var moment=require('moment');var BPromise=require(_0xb3f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3f4('0x4'));var rimraf=require(_0xb3f4('0x5'));var config=require('../../config/environment');var attributes=require(_0xb3f4('0x6'));module[_0xb3f4('0x7')]=function(_0x3460a0,_0x3898d1){return _0x3460a0[_0xb3f4('0x8')]('WhatsappMessage',attributes,{'tableName':_0xb3f4('0x9'),'paranoid':![],'indexes':[{'name':_0xb3f4('0xa'),'fields':['messageId']},{'name':_0xb3f4('0xb'),'fields':[_0xb3f4('0xc')],'type':_0xb3f4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3be42c,_0x1fbcd3,_0x5e3861){var _0x60710=_0x3460a0[_0xb3f4('0xe')];var _0xcbdb10=_0x3be42c[_0xb3f4('0xf')]({'plain':!![]});if(_0xcbdb10['direction']['toLowerCase']()==='in'||_0xcbdb10[_0xb3f4('0x10')][_0xb3f4('0x11')]()==='out'&&!_0xcbdb10['secret']&&!_['isNil'](_0xcbdb10[_0xb3f4('0x12')])){_0x60710[_0xb3f4('0x13')][_0xb3f4('0x14')]({'where':{'id':_0xcbdb10['WhatsappInteractionId']}})[_0xb3f4('0x15')](function(_0x56b039){if(_0x56b039){_0x56b039['update']({'lastMsgAt':_0xcbdb10[_0xb3f4('0x16')],'lastMsgDirection':_0xcbdb10['direction']['toLowerCase']()});}})[_0xb3f4('0x17')](function(_0x55dd8a){console[_0xb3f4('0x18')](_0x55dd8a);});}if(_0xcbdb10[_0xb3f4('0x10')]===_0xb3f4('0x19')&&!_0xcbdb10[_0xb3f4('0x1a')]){var _0x3f8f17;_0x60710[_0xb3f4('0x1b')][_0xb3f4('0x1c')]({'where':{'id':_0xcbdb10[_0xb3f4('0x1d')]},'raw':!![]})[_0xb3f4('0x15')](function(_0x3652d8){_0x3f8f17=_0x3652d8;if(_0x3f8f17&&_0x3f8f17[_0xb3f4('0x1e')]){switch(_0x3f8f17[_0xb3f4('0x1e')]){case _0xb3f4('0x1f'):var _0x59347d=require('twilio');if(_0x3f8f17['accountSid']&&_0x3f8f17[_0xb3f4('0x20')]&&_0x3f8f17[_0xb3f4('0x21')]){var _0x1622a6=new _0x59347d(_0x3f8f17[_0xb3f4('0x22')],_0x3f8f17['authToken']);_0x1622a6['messages'][_0xb3f4('0x23')]({'body':_0xcbdb10[_0xb3f4('0xc')],'to':'whatsapp:'+_0xcbdb10['phone'],'from':_0xb3f4('0x24')+_0x3f8f17[_0xb3f4('0x21')],'statusCallback':_0x3f8f17['remote']+'/api/whatsapp/messages/'+_0xcbdb10['id']+_0xb3f4('0x25')+_0x3f8f17['token']})[_0xb3f4('0x15')](function(_0x14de64){if(_0x14de64[_0xb3f4('0x26')]){return _0x3be42c['update']({'messageId':_0x14de64[_0xb3f4('0x26')]});}})[_0xb3f4('0x17')](function(_0x3c60ac){logger[_0xb3f4('0x18')](_0xb3f4('0x27'),_0xb3f4('0x28'),_0xb3f4('0x1f'),util['inspect'](_0x3c60ac,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb3f4('0x27'),_0xb3f4('0x28'),_0xb3f4('0x1f'),_0xb3f4('0x29'));}break;}}})[_0xb3f4('0x2a')](function(){_0x5e3861();});}else{_0x5e3861();}}},'charset':_0xb3f4('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xab40=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','secret','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/status?token=','token','afterCreate','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x515ae2,_0x4a753d){var _0x505483=function(_0x16b7ff){while(--_0x16b7ff){_0x515ae2['push'](_0x515ae2['shift']());}};_0x505483(++_0x4a753d);}(_0xab40,0x117));var _0x0ab4=function(_0x28ce2a,_0xc2eea9){_0x28ce2a=_0x28ce2a-0x0;var _0x184e58=_0xab40[_0x28ce2a];return _0x184e58;};'use strict';var _=require('lodash');var util=require(_0x0ab4('0x0'));var logger=require(_0x0ab4('0x1'))(_0x0ab4('0x2'));var moment=require(_0x0ab4('0x3'));var BPromise=require(_0x0ab4('0x4'));var rp=require(_0x0ab4('0x5'));var fs=require('fs');var path=require(_0x0ab4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x0ab4('0x7')]=function(_0x5629d9,_0x36d6fb){return _0x5629d9[_0x0ab4('0x8')](_0x0ab4('0x9'),attributes,{'tableName':_0x0ab4('0xa'),'paranoid':![],'indexes':[{'name':_0x0ab4('0xb'),'fields':[_0x0ab4('0xb')]},{'name':_0x0ab4('0xc'),'fields':[_0x0ab4('0xd')],'type':_0x0ab4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x250ba3,_0x72d7ac,_0x3265fa){var _0x1a8efa=_0x5629d9[_0x0ab4('0xf')];var _0x3eba6d=_0x250ba3[_0x0ab4('0x10')]({'plain':!![]});if(_0x3eba6d[_0x0ab4('0x11')]['toLowerCase']()==='in'||_0x3eba6d[_0x0ab4('0x11')][_0x0ab4('0x12')]()===_0x0ab4('0x13')&&!_0x3eba6d['secret']&&!_[_0x0ab4('0x14')](_0x3eba6d['UserId'])){_0x1a8efa[_0x0ab4('0x15')][_0x0ab4('0x16')]({'where':{'id':_0x3eba6d[_0x0ab4('0x17')]}})[_0x0ab4('0x18')](function(_0xce6bb1){if(_0xce6bb1){_0xce6bb1['update']({'lastMsgAt':_0x3eba6d[_0x0ab4('0x19')],'lastMsgDirection':_0x3eba6d['direction'][_0x0ab4('0x12')]()});}})[_0x0ab4('0x1a')](function(_0x1a03d0){console[_0x0ab4('0x1b')](_0x1a03d0);});}if(_0x3eba6d[_0x0ab4('0x11')]===_0x0ab4('0x13')&&!_0x3eba6d[_0x0ab4('0x1c')]){var _0x521503;_0x1a8efa['WhatsappAccount']['find']({'where':{'id':_0x3eba6d[_0x0ab4('0x1d')]},'raw':!![]})['then'](function(_0x13def2){_0x521503=_0x13def2;if(_0x521503&&_0x521503[_0x0ab4('0x1e')]){switch(_0x521503[_0x0ab4('0x1e')]){case _0x0ab4('0x1f'):var _0x29ce6e=require(_0x0ab4('0x1f'));if(_0x521503[_0x0ab4('0x20')]&&_0x521503[_0x0ab4('0x21')]&&_0x521503['phone']){var _0x273a93=new _0x29ce6e(_0x521503[_0x0ab4('0x20')],_0x521503['authToken']);_0x273a93[_0x0ab4('0x22')][_0x0ab4('0x23')]({'body':_0x3eba6d[_0x0ab4('0xd')],'to':_0x0ab4('0x24')+_0x3eba6d[_0x0ab4('0x25')],'from':_0x0ab4('0x24')+_0x521503[_0x0ab4('0x25')],'statusCallback':_0x521503[_0x0ab4('0x26')]+'/api/whatsapp/messages/'+_0x3eba6d['id']+_0x0ab4('0x27')+_0x521503[_0x0ab4('0x28')]})[_0x0ab4('0x18')](function(_0x2a10d5){if(_0x2a10d5['sid']){return _0x250ba3['update']({'messageId':_0x2a10d5['sid']});}})['catch'](function(_0x5c7483){logger[_0x0ab4('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x0ab4('0x29'),'twilio',util['inspect'](_0x5c7483,{'showHidden':![],'depth':null}));});}else{logger[_0x0ab4('0x1b')](_0x0ab4('0x2a'),_0x0ab4('0x29'),_0x0ab4('0x1f'),_0x0ab4('0x2b'));}break;}}})[_0x0ab4('0x2c')](function(){_0x3265fa();});}else{_0x3265fa();}}},'charset':'utf8mb4','collate':_0x0ab4('0x2d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index da92fac..57fbde8 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 _0xe9e3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','CreateWhatsappMessage','WhatsappMessage','body','options','raw','catch','lodash','moment','ioredis','../../mysqldb'];(function(_0x3a8b61,_0x317394){var _0x41bb0b=function(_0x1f5eef){while(--_0x1f5eef){_0x3a8b61['push'](_0x3a8b61['shift']());}};_0x41bb0b(++_0x317394);}(_0xe9e3,0x164));var _0x3e9e=function(_0x176308,_0x5b4d58){_0x176308=_0x176308-0x0;var _0x545160=_0xe9e3[_0x176308];return _0x545160;};'use strict';var _=require(_0x3e9e('0x0'));var util=require('util');var moment=require(_0x3e9e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e9e('0x2'));var db=require(_0x3e9e('0x3'))['db'];var utils=require(_0x3e9e('0x4'));var logger=require(_0x3e9e('0x5'))('rpc');var config=require(_0x3e9e('0x6'));var jayson=require(_0x3e9e('0x7'));var client=jayson[_0x3e9e('0x8')]['http']({'port':0x232a});config['redis']=_[_0x3e9e('0x9')](config[_0x3e9e('0xa')],{'host':_0x3e9e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3e9e('0xc'))[_0x3e9e('0xd')](socket);function respondWithRpcPromise(_0x513d46,_0x3df9d6,_0xb055fa){return new BPromise(function(_0x42a22d,_0x11924c){return client[_0x3e9e('0xe')](_0x513d46,_0xb055fa)[_0x3e9e('0xf')](function(_0x32d528){logger['info'](_0x3e9e('0x10'),_0x3df9d6,_0x3e9e('0x11'));logger[_0x3e9e('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3df9d6,_0x3e9e('0x11'),JSON[_0x3e9e('0x13')](_0x32d528));if(_0x32d528[_0x3e9e('0x14')]){if(_0x32d528[_0x3e9e('0x14')][_0x3e9e('0x15')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3df9d6,_0x32d528[_0x3e9e('0x14')][_0x3e9e('0x16')]);return _0x11924c(_0x32d528['error'][_0x3e9e('0x16')]);}logger[_0x3e9e('0x14')](_0x3e9e('0x10'),_0x3df9d6,_0x32d528[_0x3e9e('0x14')][_0x3e9e('0x16')]);return _0x42a22d(_0x32d528[_0x3e9e('0x14')][_0x3e9e('0x16')]);}else{logger[_0x3e9e('0x17')](_0x3e9e('0x10'),_0x3df9d6,'request\x20sent');_0x42a22d(_0x32d528['result'][_0x3e9e('0x16')]);}})['catch'](function(_0x5f0f58){logger[_0x3e9e('0x14')](_0x3e9e('0x10'),_0x3df9d6,_0x5f0f58);_0x11924c(_0x5f0f58);});});}exports[_0x3e9e('0x18')]=function(_0x6b35fd){var _0x245821=this;return new Promise(function(_0x335b06,_0x4bc854){return db[_0x3e9e('0x19')]['create'](_0x6b35fd[_0x3e9e('0x1a')],{'raw':_0x6b35fd[_0x3e9e('0x1b')]?_0x6b35fd[_0x3e9e('0x1b')][_0x3e9e('0x1c')]===undefined?!![]:![]:!![]})[_0x3e9e('0xf')](function(_0x3cba77){logger[_0x3e9e('0x17')](_0x3e9e('0x18'),_0x6b35fd);logger[_0x3e9e('0x12')](_0x3e9e('0x18'),_0x6b35fd,JSON['stringify'](_0x3cba77));_0x335b06(_0x3cba77);})[_0x3e9e('0x1d')](function(_0x2ed759){logger[_0x3e9e('0x14')](_0x3e9e('0x18'),_0x2ed759['message'],_0x6b35fd);_0x4bc854(_0x245821['error'](0x1f4,_0x2ed759[_0x3e9e('0x16')]));});});}; \ No newline at end of file +var _0x1963=['error','code','message','request\x20sent','result','catch','WhatsappMessage','create','body','options','raw','debug','CreateWhatsappMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1dcdc1,_0x2fdd77){var _0x24a48c=function(_0x165b28){while(--_0x165b28){_0x1dcdc1['push'](_0x1dcdc1['shift']());}};_0x24a48c(++_0x2fdd77);}(_0x1963,0xa3));var _0x3196=function(_0x1ee0b8,_0x4ff871){_0x1ee0b8=_0x1ee0b8-0x0;var _0x5c36d2=_0x1963[_0x1ee0b8];return _0x5c36d2;};'use strict';var _=require(_0x3196('0x0'));var util=require(_0x3196('0x1'));var moment=require(_0x3196('0x2'));var BPromise=require('bluebird');var rs=require(_0x3196('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3196('0x4'))['db'];var utils=require(_0x3196('0x5'));var logger=require('../../config/logger')(_0x3196('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3196('0x7')]({'port':0x232a});config[_0x3196('0x8')]=_['defaults'](config['redis'],{'host':_0x3196('0x9'),'port':0x18eb});var socket=require(_0x3196('0xa'))(new Redis(config[_0x3196('0x8')]));require(_0x3196('0xb'))['register'](socket);function respondWithRpcPromise(_0x1a1554,_0x1470c4,_0x752f37){return new BPromise(function(_0x3a8bcc,_0x52b78f){return client['request'](_0x1a1554,_0x752f37)[_0x3196('0xc')](function(_0x578724){logger[_0x3196('0xd')](_0x3196('0xe'),_0x1470c4,'request\x20sent');logger['debug'](_0x3196('0xf'),_0x1470c4,'request\x20sent',JSON[_0x3196('0x10')](_0x578724));if(_0x578724[_0x3196('0x11')]){if(_0x578724[_0x3196('0x11')][_0x3196('0x12')]===0x1f4){logger[_0x3196('0x11')](_0x3196('0xe'),_0x1470c4,_0x578724[_0x3196('0x11')][_0x3196('0x13')]);return _0x52b78f(_0x578724[_0x3196('0x11')][_0x3196('0x13')]);}logger[_0x3196('0x11')](_0x3196('0xe'),_0x1470c4,_0x578724[_0x3196('0x11')][_0x3196('0x13')]);return _0x3a8bcc(_0x578724[_0x3196('0x11')][_0x3196('0x13')]);}else{logger[_0x3196('0xd')]('WhatsappMessage,\x20%s,\x20%s',_0x1470c4,_0x3196('0x14'));_0x3a8bcc(_0x578724[_0x3196('0x15')][_0x3196('0x13')]);}})[_0x3196('0x16')](function(_0x3fc54b){logger[_0x3196('0x11')](_0x3196('0xe'),_0x1470c4,_0x3fc54b);_0x52b78f(_0x3fc54b);});});}exports['CreateWhatsappMessage']=function(_0x16c614){var _0x4d7874=this;return new Promise(function(_0x1915e8,_0x5542cd){return db[_0x3196('0x17')][_0x3196('0x18')](_0x16c614[_0x3196('0x19')],{'raw':_0x16c614['options']?_0x16c614[_0x3196('0x1a')][_0x3196('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1045c6){logger[_0x3196('0xd')]('CreateWhatsappMessage',_0x16c614);logger[_0x3196('0x1c')](_0x3196('0x1d'),_0x16c614,JSON['stringify'](_0x1045c6));_0x1915e8(_0x1045c6);})[_0x3196('0x16')](function(_0x42a545){logger['error'](_0x3196('0x1d'),_0x42a545[_0x3196('0x13')],_0x16c614);_0x5542cd(_0x4d7874['error'](0x1f4,_0x42a545['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 748d8fb..3f3e436 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 _0x5804=['whatsappMessage:','save','remove','update','emit','register','length'];(function(_0xec03b7,_0x5948d8){var _0x317fb8=function(_0x976723){while(--_0x976723){_0xec03b7['push'](_0xec03b7['shift']());}};_0x317fb8(++_0x5948d8);}(_0x5804,0x8d));var _0x4580=function(_0x496688,_0x2236bf){_0x496688=_0x496688-0x0;var _0x3caf1d=_0x5804[_0x496688];return _0x3caf1d;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x4580('0x0'),_0x4580('0x1'),_0x4580('0x2')];function createListener(_0x307fd7,_0x29f00f){return function(_0x482612){_0x29f00f[_0x4580('0x3')](_0x307fd7,_0x482612);};}function removeListener(_0x3220b0,_0xa09b0b){return function(){WhatsappMessageEvents['removeListener'](_0x3220b0,_0xa09b0b);};}exports[_0x4580('0x4')]=function(_0x33a3a3){for(var _0x2e6ec3=0x0,_0xd92c93=events[_0x4580('0x5')];_0x2e6ec3<_0xd92c93;_0x2e6ec3++){var _0x2c8cee=events[_0x2e6ec3];var _0x21623b=createListener(_0x4580('0x6')+_0x2c8cee,_0x33a3a3);WhatsappMessageEvents['on'](_0x2c8cee,_0x21623b);}}; \ No newline at end of file +var _0x360f=['save','remove','removeListener'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x360f,0x132));var _0xf360=function(_0x1603ff,_0x3ea2f2){_0x1603ff=_0x1603ff-0x0;var _0x3e8552=_0x360f[_0x1603ff];return _0x3e8552;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xf360('0x0'),_0xf360('0x1'),'update'];function createListener(_0x1fa846,_0x41f0a6){return function(_0x4f1a1d){_0x41f0a6['emit'](_0x1fa846,_0x4f1a1d);};}function removeListener(_0x37e0ec,_0x3512cb){return function(){WhatsappMessageEvents[_0xf360('0x2')](_0x37e0ec,_0x3512cb);};}exports['register']=function(_0x28b772){for(var _0x3a4f24=0x0,_0x263752=events['length'];_0x3a4f24<_0x263752;_0x3a4f24++){var _0x3d9e36=events[_0x3a4f24];var _0x5eadb0=createListener('whatsappMessage:'+_0x3d9e36,_0x28b772);WhatsappMessageEvents['on'](_0x3d9e36,_0x5eadb0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6d3308d..87e2b3d 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 _0x6239=['describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','update','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x5e7790,_0x29dd96){var _0x3716f6=function(_0x36a357){while(--_0x36a357){_0x5e7790['push'](_0x5e7790['shift']());}};_0x3716f6(++_0x29dd96);}(_0x6239,0xda));var _0x9623=function(_0x53b7c8,_0x2868fa){_0x53b7c8=_0x53b7c8-0x0;var _0x2c9b3e=_0x6239[_0x53b7c8];return _0x2c9b3e;};'use strict';var multer=require(_0x9623('0x0'));var util=require(_0x9623('0x1'));var path=require(_0x9623('0x2'));var timeout=require(_0x9623('0x3'));var express=require(_0x9623('0x4'));var router=express[_0x9623('0x5')]();var auth=require(_0x9623('0x6'));var interaction=require(_0x9623('0x7'));var config=require(_0x9623('0x8'));var controller=require(_0x9623('0x9'));router[_0x9623('0xa')]('/',auth[_0x9623('0xb')](),controller[_0x9623('0xc')]);router[_0x9623('0xa')](_0x9623('0xd'),auth[_0x9623('0xb')](),controller[_0x9623('0xe')]);router[_0x9623('0xa')](_0x9623('0xf'),auth[_0x9623('0xb')](),controller[_0x9623('0x10')]);router['get'](_0x9623('0x11'),auth[_0x9623('0xb')](),controller[_0x9623('0x12')]);router['get'](_0x9623('0x13'),auth[_0x9623('0xb')](),controller[_0x9623('0x14')]);router[_0x9623('0xa')](_0x9623('0x15'),auth[_0x9623('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x9623('0x16')]);router[_0x9623('0x17')]('/:id/teams',auth[_0x9623('0xb')](),controller[_0x9623('0x18')]);router[_0x9623('0x17')](_0x9623('0x15'),auth[_0x9623('0xb')](),controller['addAgents']);router['put'](_0x9623('0xf'),auth[_0x9623('0xb')](),controller[_0x9623('0x19')]);router[_0x9623('0x1a')](_0x9623('0xf'),auth[_0x9623('0xb')](),controller['destroy']);router[_0x9623('0x1a')]('/:id/teams',auth[_0x9623('0xb')](),controller[_0x9623('0x1b')]);router[_0x9623('0x1a')]('/:id/users',auth[_0x9623('0xb')](),controller['removeAgents']);module[_0x9623('0x1c')]=router; \ No newline at end of file +var _0x32c2=['index','get','/describe','describe','show','/:id/members','getMembers','/:id/users','post','/:id/teams','addTeams','/:id','update','destroy','delete','removeTeams','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated'];(function(_0x16a960,_0x105d2d){var _0x3e3549=function(_0x319e42){while(--_0x319e42){_0x16a960['push'](_0x16a960['shift']());}};_0x3e3549(++_0x105d2d);}(_0x32c2,0xad));var _0x232c=function(_0x13807b,_0x19737d){_0x13807b=_0x13807b-0x0;var _0x407013=_0x32c2[_0x13807b];return _0x407013;};'use strict';var multer=require(_0x232c('0x0'));var util=require(_0x232c('0x1'));var path=require(_0x232c('0x2'));var timeout=require('connect-timeout');var express=require(_0x232c('0x3'));var router=express[_0x232c('0x4')]();var auth=require(_0x232c('0x5'));var interaction=require(_0x232c('0x6'));var config=require('../../config/environment');var controller=require(_0x232c('0x7'));router['get']('/',auth[_0x232c('0x8')](),controller[_0x232c('0x9')]);router[_0x232c('0xa')](_0x232c('0xb'),auth[_0x232c('0x8')](),controller[_0x232c('0xc')]);router[_0x232c('0xa')]('/:id',auth[_0x232c('0x8')](),controller[_0x232c('0xd')]);router[_0x232c('0xa')](_0x232c('0xe'),auth[_0x232c('0x8')](),controller[_0x232c('0xf')]);router[_0x232c('0xa')]('/:id/teams',auth[_0x232c('0x8')](),controller['getTeams']);router[_0x232c('0xa')](_0x232c('0x10'),auth[_0x232c('0x8')](),controller['getAgents']);router[_0x232c('0x11')]('/',auth[_0x232c('0x8')](),controller['create']);router[_0x232c('0x11')](_0x232c('0x12'),auth['isAuthenticated'](),controller[_0x232c('0x13')]);router[_0x232c('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x232c('0x14'),auth[_0x232c('0x8')](),controller[_0x232c('0x15')]);router['delete'](_0x232c('0x14'),auth[_0x232c('0x8')](),controller[_0x232c('0x16')]);router[_0x232c('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0x232c('0x18')]);router[_0x232c('0x17')](_0x232c('0x10'),auth[_0x232c('0x8')](),controller[_0x232c('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 86e4f0c..9341c5c 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 _0x72f7=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x3cf2ce,_0x4a34f6){var _0x47d881=function(_0x1fb7d3){while(--_0x1fb7d3){_0x3cf2ce['push'](_0x3cf2ce['shift']());}};_0x47d881(++_0x4a34f6);}(_0x72f7,0x12b));var _0x772f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x772f('0x0'));module[_0x772f('0x1')]={'name':{'type':Sequelize[_0x772f('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x772f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x772f('0x4')](_0x772f('0x5'),_0x772f('0x6'),_0x772f('0x7'))},'description':{'type':Sequelize[_0x772f('0x2')]}}; \ No newline at end of file +var _0xb98d=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1c328c,_0x220530){var _0x2c79f5=function(_0x53b203){while(--_0x53b203){_0x1c328c['push'](_0x1c328c['shift']());}};_0x2c79f5(++_0x220530);}(_0xb98d,0x14f));var _0xdb98=function(_0x47139e,_0x36c2aa){_0x47139e=_0x47139e-0x0;var _0x169c3f=_0xb98d[_0x47139e];return _0x169c3f;};'use strict';var Sequelize=require(_0xdb98('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb98('0x1')],'unique':_0xdb98('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdb98('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb98('0x4')](_0xdb98('0x5'),_0xdb98('0x6'),_0xdb98('0x7'))},'description':{'type':Sequelize[_0xdb98('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 206a8ed..ff4fcbd 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 _0x43d9=['emit','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','WhatsappQueue','findAll','rows','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserWhatsappQueue','nolimit','order','WhatsappQueueId','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate'];(function(_0x15411f,_0x42bef8){var _0x555650=function(_0x215e4f){while(--_0x215e4f){_0x15411f['push'](_0x15411f['shift']());}};_0x555650(++_0x42bef8);}(_0x43d9,0x1aa));var _0x943d=function(_0x28796e,_0x22b201){_0x28796e=_0x28796e-0x0;var _0x25e5b3=_0x43d9[_0x28796e];return _0x25e5b3;};'use strict';var pdf=require(_0x943d('0x0'));var emlformat=require(_0x943d('0x1'));var rimraf=require(_0x943d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x943d('0x3'));var BPromise=require(_0x943d('0x4'));var Mustache=require(_0x943d('0x5'));var util=require('util');var path=require(_0x943d('0x6'));var sox=require(_0x943d('0x7'));var csv=require(_0x943d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x943d('0x9'));var squel=require(_0x943d('0xa'));var crypto=require(_0x943d('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x943d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x943d('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x943d('0xd'));var logger=require('../../config/logger')(_0x943d('0xe'));var utils=require(_0x943d('0xf'));var config=require('../../config/environment');var db=require(_0x943d('0x10'))['db'];config['redis']=_['defaults'](config[_0x943d('0x11')],{'host':_0x943d('0x12'),'port':0x18eb});var socket=require(_0x943d('0x13'))(new Redis(config[_0x943d('0x11')]));require(_0x943d('0x14'))['register'](socket);function respondWithStatusCode(_0x100645,_0x199b7d){_0x199b7d=_0x199b7d||0xcc;return function(_0x4b10b2){if(_0x4b10b2){return _0x100645['sendStatus'](_0x199b7d);}return _0x100645['status'](_0x199b7d)['end']();};}function respondWithResult(_0x52134a,_0x10cd1d){_0x10cd1d=_0x10cd1d||0xc8;return function(_0x195a8a){if(_0x195a8a){return _0x52134a[_0x943d('0x15')](_0x10cd1d)[_0x943d('0x16')](_0x195a8a);}};}function respondWithFilteredResult(_0x270110,_0x42e84c){return function(_0xcf3b58){if(_0xcf3b58){var _0x51057e=_0xcf3b58[_0x943d('0x17')],_0x4fbae2=_0x42e84c[_0x943d('0x18')],_0x314c10=_0x42e84c[_0x943d('0x18')]+_0x42e84c[_0x943d('0x19')],_0x5db69a;if(_0x314c10>=_0x51057e){_0x314c10=_0x51057e;_0x5db69a=0xc8;}else{_0x5db69a=0xce;}_0x270110['status'](_0x5db69a);return _0x270110[_0x943d('0x1a')](_0x943d('0x1b'),_0x4fbae2+'-'+_0x314c10+'/'+_0x51057e)[_0x943d('0x16')](_0xcf3b58);}return null;};}function patchUpdates(_0x24e0ee){return function(_0x2cfe50){try{jsonpatch[_0x943d('0x1c')](_0x2cfe50,_0x24e0ee,!![]);}catch(_0x2ab409){return BPromise[_0x943d('0x1d')](_0x2ab409);}return _0x2cfe50[_0x943d('0x1e')]();};}function saveUpdates(_0x5cd385,_0x67c9f2){return function(_0x486495){if(_0x486495){return _0x486495['update'](_0x5cd385)[_0x943d('0x1f')](function(_0x3e8f74){return _0x3e8f74;});}return null;};}function removeEntity(_0x2c6018,_0x5d64f3){return function(_0x604f01){if(_0x604f01){return _0x604f01[_0x943d('0x20')]()['then'](function(){var _0x18ec61=_0x604f01[_0x943d('0x21')]({'plain':!![]});var _0x45aabf='WhatsappQueues';return db[_0x943d('0x22')][_0x943d('0x20')]({'where':{'type':_0x45aabf,'resourceId':_0x18ec61['id']}})['then'](function(){return _0x604f01;});})[_0x943d('0x1f')](function(){_0x2c6018[_0x943d('0x15')](0xcc)[_0x943d('0x23')]();});}};}function handleEntityNotFound(_0x11b20a,_0x786279){return function(_0x3be34f){if(!_0x3be34f){_0x11b20a[_0x943d('0x24')](0x194);}return _0x3be34f;};}function handleError(_0x43c684,_0x963b26){_0x963b26=_0x963b26||0x1f4;return function(_0x2a3213){logger[_0x943d('0x25')](_0x2a3213['stack']);if(_0x2a3213['name']){delete _0x2a3213[_0x943d('0x26')];}_0x43c684[_0x943d('0x15')](_0x963b26)[_0x943d('0x27')](_0x2a3213);};}exports[_0x943d('0x28')]=function(_0x4642e3,_0x59e7da){var _0x389b83={},_0x28edd3={},_0x430d1b={'count':0x0,'rows':[]};var _0x9af145=_['map'](db['WhatsappQueue'][_0x943d('0x29')],function(_0xcaf510){return{'name':_0xcaf510[_0x943d('0x2a')],'type':_0xcaf510[_0x943d('0x2b')][_0x943d('0x2c')]};});_0x28edd3[_0x943d('0x2d')]=_[_0x943d('0x2e')](_0x9af145,_0x943d('0x26'));_0x28edd3[_0x943d('0x2f')]=_[_0x943d('0x30')](_0x4642e3[_0x943d('0x2f')]);_0x28edd3[_0x943d('0x31')]=_[_0x943d('0x32')](_0x28edd3['model'],_0x28edd3[_0x943d('0x2f')]);_0x389b83['attributes']=_['intersection'](_0x28edd3[_0x943d('0x2d')],qs[_0x943d('0x33')](_0x4642e3[_0x943d('0x2f')][_0x943d('0x33')]));_0x389b83[_0x943d('0x34')]=_0x389b83[_0x943d('0x34')]['length']?_0x389b83[_0x943d('0x34')]:_0x28edd3[_0x943d('0x2d')];if(!_0x4642e3[_0x943d('0x2f')][_0x943d('0x35')]('nolimit')){_0x389b83['limit']=qs[_0x943d('0x19')](_0x4642e3[_0x943d('0x2f')][_0x943d('0x19')]);_0x389b83[_0x943d('0x18')]=qs['offset'](_0x4642e3['query']['offset']);}_0x389b83['order']=qs[_0x943d('0x36')](_0x4642e3[_0x943d('0x2f')][_0x943d('0x36')]);_0x389b83[_0x943d('0x37')]=qs[_0x943d('0x31')](_[_0x943d('0x38')](_0x4642e3[_0x943d('0x2f')],_0x28edd3['filters']),_0x9af145);if(_0x4642e3['query']['filter']){_0x389b83[_0x943d('0x37')]=_[_0x943d('0x39')](_0x389b83[_0x943d('0x37')],{'$or':_[_0x943d('0x2e')](_0x9af145,function(_0x5b5fe0){if(_0x5b5fe0[_0x943d('0x2b')]!==_0x943d('0x3a')){var _0x23a2c6={};_0x23a2c6[_0x5b5fe0[_0x943d('0x26')]]={'$like':'%'+_0x4642e3[_0x943d('0x2f')][_0x943d('0x3b')]+'%'};return _0x23a2c6;}})});}_0x389b83=_['merge']({},_0x389b83,_0x4642e3[_0x943d('0x3c')]);var _0x59e430={'where':_0x389b83['where']};return db['WhatsappQueue']['count'](_0x59e430)[_0x943d('0x1f')](function(_0x201d12){_0x430d1b[_0x943d('0x17')]=_0x201d12;if(_0x4642e3[_0x943d('0x2f')][_0x943d('0x3d')]){_0x389b83[_0x943d('0x3e')]=[{'all':!![]}];}return db[_0x943d('0x3f')][_0x943d('0x40')](_0x389b83);})[_0x943d('0x1f')](function(_0x478d9e){_0x430d1b[_0x943d('0x41')]=_0x478d9e;return _0x430d1b;})[_0x943d('0x1f')](respondWithFilteredResult(_0x59e7da,_0x389b83))[_0x943d('0x42')](handleError(_0x59e7da,null));};exports['show']=function(_0x51233a,_0x5502f4){var _0x42e60d={'raw':!![],'where':{'id':_0x51233a[_0x943d('0x43')]['id']}},_0x1ba29f={};_0x1ba29f[_0x943d('0x2d')]=_['keys'](db['WhatsappQueue']['rawAttributes']);_0x1ba29f[_0x943d('0x2f')]=_[_0x943d('0x30')](_0x51233a['query']);_0x1ba29f[_0x943d('0x31')]=_[_0x943d('0x32')](_0x1ba29f[_0x943d('0x2d')],_0x1ba29f[_0x943d('0x2f')]);_0x42e60d[_0x943d('0x34')]=_[_0x943d('0x32')](_0x1ba29f['model'],qs[_0x943d('0x33')](_0x51233a[_0x943d('0x2f')][_0x943d('0x33')]));_0x42e60d[_0x943d('0x34')]=_0x42e60d[_0x943d('0x34')][_0x943d('0x44')]?_0x42e60d[_0x943d('0x34')]:_0x1ba29f['model'];if(_0x51233a['query'][_0x943d('0x3d')]){_0x42e60d['include']=[{'all':!![]}];}_0x42e60d=_['merge']({},_0x42e60d,_0x51233a[_0x943d('0x3c')]);return db[_0x943d('0x3f')]['find'](_0x42e60d)[_0x943d('0x1f')](handleEntityNotFound(_0x5502f4,null))[_0x943d('0x1f')](respondWithResult(_0x5502f4,null))[_0x943d('0x42')](handleError(_0x5502f4,null));};exports['create']=function(_0x536225,_0x5eeb2b){return db['WhatsappQueue'][_0x943d('0x45')](_0x536225[_0x943d('0x46')],{})[_0x943d('0x1f')](function(_0x415d52){var _0x45c3d5=_0x536225[_0x943d('0x47')]['get']({'plain':!![]});if(!_0x45c3d5)throw new Error(_0x943d('0x48'));if(_0x45c3d5['role']===_0x943d('0x47')){var _0x2b205c=_0x415d52['get']({'plain':!![]});var _0x240671='WhatsappQueues';return db[_0x943d('0x49')]['find']({'where':{'name':_0x240671,'userProfileId':_0x45c3d5[_0x943d('0x4a')]},'raw':!![]})[_0x943d('0x1f')](function(_0x1205b7){if(_0x1205b7&&_0x1205b7[_0x943d('0x4b')]===0x0){return db[_0x943d('0x22')][_0x943d('0x45')]({'name':_0x2b205c[_0x943d('0x26')],'resourceId':_0x2b205c['id'],'type':_0x1205b7[_0x943d('0x26')],'sectionId':_0x1205b7['id']},{})[_0x943d('0x1f')](function(){return _0x415d52;});}else{return _0x415d52;}})[_0x943d('0x42')](function(_0x5b814a){logger[_0x943d('0x25')](_0x943d('0x4c'),_0x5b814a);throw _0x5b814a;});}return _0x415d52;})['then'](respondWithResult(_0x5eeb2b,0xc9))['catch'](handleError(_0x5eeb2b,null));};exports['update']=function(_0x4ffd8d,_0x4cc1ef){if(_0x4ffd8d['body']['id']){delete _0x4ffd8d[_0x943d('0x46')]['id'];}return db[_0x943d('0x3f')][_0x943d('0x4d')]({'where':{'id':_0x4ffd8d['params']['id']}})['then'](handleEntityNotFound(_0x4cc1ef,null))[_0x943d('0x1f')](saveUpdates(_0x4ffd8d[_0x943d('0x46')],null))[_0x943d('0x1f')](respondWithResult(_0x4cc1ef,null))[_0x943d('0x42')](handleError(_0x4cc1ef,null));};exports[_0x943d('0x20')]=function(_0x5befaf,_0x26ca6b){return db['WhatsappQueue'][_0x943d('0x4d')]({'where':{'id':_0x5befaf[_0x943d('0x43')]['id']}})['then'](handleEntityNotFound(_0x26ca6b,null))['then'](removeEntity(_0x26ca6b,null))[_0x943d('0x42')](handleError(_0x26ca6b,null));};exports['describe']=function(_0x401f7a,_0x364b81){return db[_0x943d('0x3f')][_0x943d('0x4e')]()[_0x943d('0x1f')](respondWithResult(_0x364b81,null))['catch'](handleError(_0x364b81,null));};exports['getMembers']=function(_0x416288,_0x5d6dcf,_0x471308){var _0x3f4b63={'raw':!![],'where':{}},_0xca8be={},_0x532824;return db['WhatsappQueue'][_0x943d('0x4f')]({'where':{'id':_0x416288[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x5d6dcf,null))[_0x943d('0x1f')](function(_0x1a7fd6){if(_0x1a7fd6){_0x532824=_0x1a7fd6['get']({'plain':!![]});_0xca8be[_0x943d('0x2d')]=_[_0x943d('0x30')](db[_0x943d('0x50')][_0x943d('0x29')]);_0xca8be['query']=_[_0x943d('0x30')](_0x416288[_0x943d('0x2f')]);_0xca8be[_0x943d('0x31')]=_[_0x943d('0x32')](_0xca8be[_0x943d('0x2d')],_0xca8be[_0x943d('0x2f')]);_0x3f4b63[_0x943d('0x34')]=_[_0x943d('0x32')](_0xca8be[_0x943d('0x2d')],qs[_0x943d('0x33')](_0x416288['query']['fields']));_0x3f4b63['attributes']=_0x3f4b63['attributes'][_0x943d('0x44')]?_0x3f4b63[_0x943d('0x34')]:_0xca8be[_0x943d('0x2d')];if(!_0x416288['query']['hasOwnProperty'](_0x943d('0x51'))){_0x3f4b63[_0x943d('0x19')]=qs[_0x943d('0x19')](_0x416288[_0x943d('0x2f')][_0x943d('0x19')]);_0x3f4b63[_0x943d('0x18')]=qs[_0x943d('0x18')](_0x416288['query'][_0x943d('0x18')]);}_0x3f4b63[_0x943d('0x52')]=qs[_0x943d('0x36')](_0x416288['query'][_0x943d('0x36')]);_0x3f4b63['where']=qs['filters'](_['pick'](_0x416288[_0x943d('0x2f')],_0xca8be[_0x943d('0x31')]));_0x3f4b63['where'][_0x943d('0x53')]=_0x1a7fd6['id'];if(_0x416288[_0x943d('0x2f')][_0x943d('0x3b')]){_0x3f4b63[_0x943d('0x37')]=_[_0x943d('0x39')](_0x3f4b63[_0x943d('0x37')],{'$or':_['map'](_0x3f4b63[_0x943d('0x34')],function(_0x58fdd1){var _0x45458a={};_0x45458a[_0x58fdd1]={'$like':'%'+_0x416288['query'][_0x943d('0x3b')]+'%'};return _0x45458a;})});}_0x3f4b63=_[_0x943d('0x39')]({},_0x3f4b63,_0x416288[_0x943d('0x3c')]);return db[_0x943d('0x50')]['findAll'](_0x3f4b63);}})[_0x943d('0x1f')](function(_0x50a522){if(_0x50a522){return db[_0x943d('0x54')]['findAndCountAll']({'where':{'id':_[_0x943d('0x2e')](_0x50a522,_0x943d('0x55')),'role':_0x943d('0x56')},'attributes':['id',_0x943d('0x26'),_0x943d('0x57'),_0x943d('0x58'),_0x943d('0x59')]});}})[_0x943d('0x1f')](function(_0x25de91){if(_0x25de91){return{'count':_0x25de91['count'],'rows':_[_0x943d('0x2e')](_0x25de91[_0x943d('0x41')],function(_0x3482ce){return{'membername':_0x3482ce[_0x943d('0x26')],'UserId':_0x3482ce['id'],'queue_name':_0x532824[_0x943d('0x26')],'WhatsappQueueId':_0x532824['id'],'interface':util[_0x943d('0x5a')](_0x943d('0x5b'),_0x943d('0x5c'),_0x3482ce[_0x943d('0x26')]),'penalty':0x0,'paused':_0x3482ce['whatsappPause'],'createdAt':_0x3482ce[_0x943d('0x59')],'updatedAt':_0x3482ce[_0x943d('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x943d('0x1f')](respondWithFilteredResult(_0x5d6dcf,_0x3f4b63))[_0x943d('0x42')](handleError(_0x5d6dcf,null));};exports[_0x943d('0x5d')]=function(_0xbe60cc,_0x40a1d4,_0x143f63){var _0x1193e1={};var _0x4c77d3={};var _0x226a13;var _0x45345a;return db[_0x943d('0x3f')][_0x943d('0x4f')]({'where':{'id':_0xbe60cc[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x40a1d4,null))[_0x943d('0x1f')](function(_0x5784fa){if(_0x5784fa){_0x226a13=_0x5784fa;_0x4c77d3[_0x943d('0x2d')]=_['keys'](db['Team'][_0x943d('0x29')]);_0x4c77d3[_0x943d('0x2f')]=_[_0x943d('0x30')](_0xbe60cc['query']);_0x4c77d3['filters']=_[_0x943d('0x32')](_0x4c77d3['model'],_0x4c77d3[_0x943d('0x2f')]);_0x1193e1[_0x943d('0x34')]=_[_0x943d('0x32')](_0x4c77d3[_0x943d('0x2d')],qs[_0x943d('0x33')](_0xbe60cc['query'][_0x943d('0x33')]));_0x1193e1[_0x943d('0x34')]=_0x1193e1[_0x943d('0x34')][_0x943d('0x44')]?_0x1193e1['attributes']:_0x4c77d3[_0x943d('0x2d')];_0x1193e1['order']=qs[_0x943d('0x36')](_0xbe60cc['query'][_0x943d('0x36')]);_0x1193e1['where']=qs[_0x943d('0x31')](_[_0x943d('0x38')](_0xbe60cc[_0x943d('0x2f')],_0x4c77d3[_0x943d('0x31')]));if(_0xbe60cc[_0x943d('0x2f')][_0x943d('0x3b')]){_0x1193e1[_0x943d('0x37')]=_[_0x943d('0x39')](_0x1193e1['where'],{'$or':_[_0x943d('0x2e')](_0x1193e1[_0x943d('0x34')],function(_0x520094){var _0x27cf28={};_0x27cf28[_0x520094]={'$like':'%'+_0xbe60cc[_0x943d('0x2f')][_0x943d('0x3b')]+'%'};return _0x27cf28;})});}_0x1193e1=_[_0x943d('0x39')]({},_0x1193e1,_0xbe60cc[_0x943d('0x3c')]);return _0x226a13['getTeams'](_0x1193e1);}})[_0x943d('0x1f')](function(_0x166df0){if(_0x166df0){_0x45345a=_0x166df0[_0x943d('0x44')];if(!_0xbe60cc[_0x943d('0x2f')][_0x943d('0x35')](_0x943d('0x51'))){_0x1193e1[_0x943d('0x19')]=qs[_0x943d('0x19')](_0xbe60cc[_0x943d('0x2f')]['limit']);_0x1193e1[_0x943d('0x18')]=qs[_0x943d('0x18')](_0xbe60cc['query']['offset']);}return _0x226a13[_0x943d('0x5d')](_0x1193e1);}})['then'](function(_0x44fcec){if(_0x44fcec){return _0x44fcec?{'count':_0x45345a,'rows':_0x44fcec}:null;}})[_0x943d('0x1f')](respondWithResult(_0x40a1d4,null))['catch'](handleError(_0x40a1d4,null));};exports[_0x943d('0x5e')]=function(_0x4af69e,_0x28cf61,_0x1a422d){var _0x3be1ee=_0x4af69e[_0x943d('0x46')][_0x943d('0x5f')];return db[_0x943d('0x60')]['findAll']({'where':{'id':_0x3be1ee},'attributes':['id'],'include':[{'model':db[_0x943d('0x54')],'as':_0x943d('0x61'),'attributes':['id','name',_0x943d('0x62'),_0x943d('0x63'),_0x943d('0x64')],'raw':!![]}]})[_0x943d('0x1f')](function(_0x4802d2){if(_0x4802d2){var _0x129692=_[_0x943d('0x65')](_0x4802d2,function(_0x1c5b2b){var _0xd67783=_0x1c5b2b['get']({'plain':!![]});return _0xd67783[_0x943d('0x61')];});return db[_0x943d('0x3f')][_0x943d('0x4d')]({'where':{'id':_0x4af69e[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](function(_0x573820){return db[_0x943d('0x66')][_0x943d('0x67')](function(_0x232c71){return _0x573820['addTeams'](_0x3be1ee,{'transaction':_0x232c71})[_0x943d('0x1f')](function(){return BPromise[_0x943d('0x68')](_0x129692,function(_0x28186d){return db[_0x943d('0x50')][_0x943d('0x69')]({'where':{'UserId':_0x28186d['id'],'WhatsappQueueId':_0x4af69e['params']['id']},'transaction':_0x232c71});});})['then'](function(){_0x129692['forEach'](function(_0x598de0){socket[_0x943d('0x6a')]('userWhatsappQueue:save',{'UserId':_0x598de0['id'],'WhatsappQueueId':_0x573820['id']});});});});});}})['then'](respondWithStatusCode(_0x28cf61,null))[_0x943d('0x42')](handleError(_0x28cf61,null));};exports[_0x943d('0x6b')]=function(_0x5bf3d8,_0x59eee8,_0x24547e){return db['Team'][_0x943d('0x40')]({'where':{'id':_0x5bf3d8[_0x943d('0x2f')][_0x943d('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x943d('0x61'),'attributes':['id'],'raw':!![]}]})[_0x943d('0x1f')](handleEntityNotFound(_0x59eee8,null))[_0x943d('0x1f')](function(_0x38e403){var _0x1bba08=_[_0x943d('0x2e')](_0x38e403,'id');var _0x41a272=[];var _0x74d859=[];var _0x361387=squel['select']();_0x361387['field'](_0x943d('0x6c'))[_0x943d('0x6d')]('team_has_whatsapp_queues','tq')[_0x943d('0x6e')]('user_has_teams','ut',_0x943d('0x6f'))['where'](_0x943d('0x70'),_0x5bf3d8['params']['id']);for(var _0x41e8d6=0x0;_0x41e8d6<_0x38e403[_0x943d('0x44')];_0x41e8d6+=0x1){let _0x1c6a81=_0x38e403[_0x41e8d6];for(var _0x599214=0x0;_0x599214<_0x1c6a81[_0x943d('0x61')]['length'];_0x599214+=0x1){let _0x582c93=_0x1c6a81['Agents'][_0x599214];var _0x493dc4=_0x361387[_0x943d('0x71')]();_0x493dc4[_0x943d('0x37')]('ut.UserId\x20=\x20?',_0x582c93['id']);_0x74d859[_0x943d('0x72')](db[_0x943d('0x66')]['query'](_0x493dc4[_0x943d('0x73')](),{'type':db[_0x943d('0x66')][_0x943d('0x74')][_0x943d('0x75')]})[_0x943d('0x1f')](function(_0x2c5b32){if(_0x2c5b32[_0x943d('0x44')]===0x1){return _0x582c93['id'];}else{var _0x6ea4c3=_[_0x943d('0x76')](_[_0x943d('0x2e')](_0x2c5b32,_0x943d('0x77')),function(_0xadc752){return _[_0x943d('0x78')](_0x1bba08,_0xadc752);});if(_0x6ea4c3){return _0x582c93['id'];}}}));}}return BPromise['all'](_0x74d859)[_0x943d('0x1f')](function(_0x27b425){_0x41a272=_(_0x41a272)[_0x943d('0x79')](_0x27b425)[_0x943d('0x7a')]()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0x5bf3d8[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](function(_0x482ae1){return db[_0x943d('0x66')][_0x943d('0x67')](function(_0x5eecd3){return _0x482ae1[_0x943d('0x6b')](_0x5bf3d8[_0x943d('0x2f')][_0x943d('0x5f')],{'transaction':_0x5eecd3})[_0x943d('0x1f')](function(){if(!_[_0x943d('0x7b')](_0x41a272)){return _0x482ae1[_0x943d('0x7c')](_0x41a272,{'transaction':_0x5eecd3});}})['then'](function(){_0x41a272[_0x943d('0x7d')](function(_0x5ec231){socket[_0x943d('0x6a')](_0x943d('0x7e'),{'UserId':_0x5ec231,'WhatsappQueueId':_0x482ae1['id']});});});});});});})[_0x943d('0x1f')](respondWithStatusCode(_0x59eee8,null))[_0x943d('0x42')](handleError(_0x59eee8,null));};exports[_0x943d('0x7f')]=function(_0x3c412a,_0x3dbb05,_0x479676){return db[_0x943d('0x3f')][_0x943d('0x4d')]({'where':{'id':_0x3c412a[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x3dbb05,null))[_0x943d('0x1f')](function(_0x3b3ae7){if(_0x3b3ae7){return _0x3b3ae7[_0x943d('0x7f')](_0x3c412a[_0x943d('0x46')][_0x943d('0x5f')],_[_0x943d('0x80')](_0x3c412a[_0x943d('0x46')],['ids','id'])||{})[_0x943d('0x81')](function(_0x4994e2){for(var _0x12ece0=0x0;_0x12ece0<_0x3c412a[_0x943d('0x46')][_0x943d('0x5f')][_0x943d('0x44')];_0x12ece0+=0x1){socket['emit'](_0x943d('0x82'),{'UserId':_0x3c412a[_0x943d('0x46')]['ids'][_0x12ece0],'WhatsappQueueId':_0x3c412a[_0x943d('0x43')]['id']});}return _0x4994e2;});}})[_0x943d('0x1f')](respondWithResult(_0x3dbb05,null))['catch'](handleError(_0x3dbb05,null));};exports[_0x943d('0x7c')]=function(_0x31a6e7,_0x2c543d,_0x47c38b){return db[_0x943d('0x3f')]['find']({'where':{'id':_0x31a6e7[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x2c543d,null))['then'](function(_0x13eaa2){if(_0x13eaa2){return _0x13eaa2[_0x943d('0x7c')](_0x31a6e7['query'][_0x943d('0x5f')])[_0x943d('0x1f')](function(){if(_[_0x943d('0x83')](_0x31a6e7[_0x943d('0x2f')]['ids'])){for(var _0x24b401=0x0;_0x24b401<_0x31a6e7[_0x943d('0x2f')][_0x943d('0x5f')][_0x943d('0x44')];_0x24b401+=0x1){socket['emit'](_0x943d('0x7e'),{'UserId':Number(_0x31a6e7[_0x943d('0x2f')][_0x943d('0x5f')][_0x24b401]),'WhatsappQueueId':Number(_0x31a6e7['params']['id'])});}}else{socket[_0x943d('0x6a')]('userWhatsappQueue:remove',{'UserId':Number(_0x31a6e7[_0x943d('0x2f')][_0x943d('0x5f')]),'WhatsappQueueId':Number(_0x31a6e7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2c543d,null))[_0x943d('0x42')](handleError(_0x2c543d,null));};exports[_0x943d('0x84')]=function(_0x3ea1fc,_0x34764c,_0x7bfe49){var _0x5d84e1={};var _0x5f4b4c={};var _0x327ede;var _0xc8de9b;return db['WhatsappQueue'][_0x943d('0x4f')]({'where':{'id':_0x3ea1fc[_0x943d('0x43')]['id']}})[_0x943d('0x1f')](handleEntityNotFound(_0x34764c,null))['then'](function(_0x5ad8c7){if(_0x5ad8c7){_0x327ede=_0x5ad8c7;_0x5f4b4c[_0x943d('0x2d')]=_[_0x943d('0x30')](db['User'][_0x943d('0x29')]);_0x5f4b4c['query']=_[_0x943d('0x30')](_0x3ea1fc[_0x943d('0x2f')]);_0x5f4b4c[_0x943d('0x31')]=_['intersection'](_0x5f4b4c['model'],_0x5f4b4c[_0x943d('0x2f')]);_0x5d84e1['attributes']=_[_0x943d('0x32')](_0x5f4b4c['model'],qs[_0x943d('0x33')](_0x3ea1fc[_0x943d('0x2f')]['fields']));_0x5d84e1['attributes']=_0x5d84e1[_0x943d('0x34')][_0x943d('0x44')]?_0x5d84e1['attributes']:_0x5f4b4c[_0x943d('0x2d')];_0x5d84e1['order']=qs[_0x943d('0x36')](_0x3ea1fc[_0x943d('0x2f')][_0x943d('0x36')]);_0x5d84e1[_0x943d('0x37')]=qs[_0x943d('0x31')](_[_0x943d('0x38')](_0x3ea1fc['query'],_0x5f4b4c[_0x943d('0x31')]));if(_0x3ea1fc['query']['filter']){_0x5d84e1[_0x943d('0x37')]=_[_0x943d('0x39')](_0x5d84e1[_0x943d('0x37')],{'$or':_[_0x943d('0x2e')](_0x5d84e1[_0x943d('0x34')],function(_0x5c4338){var _0x3b7966={};_0x3b7966[_0x5c4338]={'$like':'%'+_0x3ea1fc[_0x943d('0x2f')]['filter']+'%'};return _0x3b7966;})});}_0x5d84e1=_[_0x943d('0x39')]({},_0x5d84e1,_0x3ea1fc['options']);return _0x327ede[_0x943d('0x84')](_0x5d84e1);}})[_0x943d('0x1f')](function(_0x3d27b6){if(_0x3d27b6){_0xc8de9b=_0x3d27b6['length'];if(!_0x3ea1fc[_0x943d('0x2f')]['hasOwnProperty'](_0x943d('0x51'))){_0x5d84e1[_0x943d('0x19')]=qs[_0x943d('0x19')](_0x3ea1fc[_0x943d('0x2f')][_0x943d('0x19')]);_0x5d84e1[_0x943d('0x18')]=qs[_0x943d('0x18')](_0x3ea1fc['query']['offset']);}return _0x327ede[_0x943d('0x84')](_0x5d84e1);}})[_0x943d('0x1f')](function(_0x15e740){if(_0x15e740){return _0x15e740?{'count':_0xc8de9b,'rows':_0x15e740}:null;}})[_0x943d('0x1f')](respondWithResult(_0x34764c,null))[_0x943d('0x42')](handleError(_0x34764c,null));}; \ No newline at end of file +var _0x12b8=['each','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','options','WhatsappQueue','include','findAll','rows','catch','params','includeAll','find','create','body','user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserWhatsappQueue','sort','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','whatsappPause','getTeams','findOne','Team','nolimit','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction'];(function(_0x48cb86,_0x424ad2){var _0x3afa1f=function(_0x2a359c){while(--_0x2a359c){_0x48cb86['push'](_0x48cb86['shift']());}};_0x3afa1f(++_0x424ad2);}(_0x12b8,0x133));var _0x812b=function(_0x230bb8,_0xa1718){_0x230bb8=_0x230bb8-0x0;var _0x16cb9a=_0x12b8[_0x230bb8];return _0x16cb9a;};'use strict';var pdf=require(_0x812b('0x0'));var emlformat=require(_0x812b('0x1'));var rimraf=require(_0x812b('0x2'));var zipdir=require(_0x812b('0x3'));var jsonpatch=require(_0x812b('0x4'));var rp=require(_0x812b('0x5'));var moment=require(_0x812b('0x6'));var BPromise=require(_0x812b('0x7'));var Mustache=require(_0x812b('0x8'));var util=require(_0x812b('0x9'));var path=require(_0x812b('0xa'));var sox=require(_0x812b('0xb'));var csv=require(_0x812b('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x812b('0xd'));var crypto=require(_0x812b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x812b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x812b('0x10'));var Papa=require(_0x812b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x812b('0x12'));var as=require(_0x812b('0x13'));var hardwareService=require(_0x812b('0x14'));var logger=require(_0x812b('0x15'))(_0x812b('0x16'));var utils=require(_0x812b('0x17'));var config=require(_0x812b('0x18'));var db=require(_0x812b('0x19'))['db'];config['redis']=_['defaults'](config[_0x812b('0x1a')],{'host':_0x812b('0x1b'),'port':0x18eb});var socket=require(_0x812b('0x1c'))(new Redis(config[_0x812b('0x1a')]));require('./whatsappQueue.socket')[_0x812b('0x1d')](socket);function respondWithStatusCode(_0x31b7db,_0x42aeea){_0x42aeea=_0x42aeea||0xcc;return function(_0x2fc0cf){if(_0x2fc0cf){return _0x31b7db[_0x812b('0x1e')](_0x42aeea);}return _0x31b7db[_0x812b('0x1f')](_0x42aeea)['end']();};}function respondWithResult(_0x42b317,_0x5e0f22){_0x5e0f22=_0x5e0f22||0xc8;return function(_0x583e95){if(_0x583e95){return _0x42b317[_0x812b('0x1f')](_0x5e0f22)[_0x812b('0x20')](_0x583e95);}};}function respondWithFilteredResult(_0x420845,_0x4d1919){return function(_0x43fb7f){if(_0x43fb7f){var _0x49485d=_0x43fb7f[_0x812b('0x21')],_0x35086f=_0x4d1919[_0x812b('0x22')],_0x133c8a=_0x4d1919[_0x812b('0x22')]+_0x4d1919[_0x812b('0x23')],_0x217309;if(_0x133c8a>=_0x49485d){_0x133c8a=_0x49485d;_0x217309=0xc8;}else{_0x217309=0xce;}_0x420845[_0x812b('0x1f')](_0x217309);return _0x420845[_0x812b('0x24')]('Content-Range',_0x35086f+'-'+_0x133c8a+'/'+_0x49485d)['json'](_0x43fb7f);}return null;};}function patchUpdates(_0x5e9a4b){return function(_0x16a32f){try{jsonpatch[_0x812b('0x25')](_0x16a32f,_0x5e9a4b,!![]);}catch(_0xd66467){return BPromise[_0x812b('0x26')](_0xd66467);}return _0x16a32f[_0x812b('0x27')]();};}function saveUpdates(_0x258dc5,_0x5674f1){return function(_0x54555d){if(_0x54555d){return _0x54555d['update'](_0x258dc5)[_0x812b('0x28')](function(_0x3ea4ed){return _0x3ea4ed;});}return null;};}function removeEntity(_0x18cdf1,_0x218d90){return function(_0x4e3efd){if(_0x4e3efd){return _0x4e3efd[_0x812b('0x29')]()[_0x812b('0x28')](function(){var _0x947928=_0x4e3efd[_0x812b('0x2a')]({'plain':!![]});var _0x54c43f='WhatsappQueues';return db[_0x812b('0x2b')][_0x812b('0x29')]({'where':{'type':_0x54c43f,'resourceId':_0x947928['id']}})['then'](function(){return _0x4e3efd;});})[_0x812b('0x28')](function(){_0x18cdf1[_0x812b('0x1f')](0xcc)[_0x812b('0x2c')]();});}};}function handleEntityNotFound(_0x5a38e2,_0x4e226e){return function(_0x354291){if(!_0x354291){_0x5a38e2[_0x812b('0x1e')](0x194);}return _0x354291;};}function handleError(_0x451710,_0x48e695){_0x48e695=_0x48e695||0x1f4;return function(_0x3b6d94){logger[_0x812b('0x2d')](_0x3b6d94['stack']);if(_0x3b6d94[_0x812b('0x2e')]){delete _0x3b6d94[_0x812b('0x2e')];}_0x451710[_0x812b('0x1f')](_0x48e695)[_0x812b('0x2f')](_0x3b6d94);};}exports[_0x812b('0x30')]=function(_0x526987,_0x2bc1fb){var _0x12d0d3={},_0x255e57={},_0x331cef={'count':0x0,'rows':[]};var _0x42fe6d=_[_0x812b('0x31')](db['WhatsappQueue'][_0x812b('0x32')],function(_0x4ec1f2){return{'name':_0x4ec1f2[_0x812b('0x33')],'type':_0x4ec1f2[_0x812b('0x34')][_0x812b('0x35')]};});_0x255e57[_0x812b('0x36')]=_[_0x812b('0x31')](_0x42fe6d,'name');_0x255e57[_0x812b('0x37')]=_[_0x812b('0x38')](_0x526987[_0x812b('0x37')]);_0x255e57[_0x812b('0x39')]=_[_0x812b('0x3a')](_0x255e57[_0x812b('0x36')],_0x255e57[_0x812b('0x37')]);_0x12d0d3[_0x812b('0x3b')]=_['intersection'](_0x255e57['model'],qs[_0x812b('0x3c')](_0x526987[_0x812b('0x37')]['fields']));_0x12d0d3['attributes']=_0x12d0d3[_0x812b('0x3b')][_0x812b('0x3d')]?_0x12d0d3[_0x812b('0x3b')]:_0x255e57[_0x812b('0x36')];if(!_0x526987[_0x812b('0x37')][_0x812b('0x3e')]('nolimit')){_0x12d0d3[_0x812b('0x23')]=qs[_0x812b('0x23')](_0x526987[_0x812b('0x37')]['limit']);_0x12d0d3['offset']=qs['offset'](_0x526987[_0x812b('0x37')]['offset']);}_0x12d0d3[_0x812b('0x3f')]=qs['sort'](_0x526987[_0x812b('0x37')]['sort']);_0x12d0d3[_0x812b('0x40')]=qs[_0x812b('0x39')](_[_0x812b('0x41')](_0x526987[_0x812b('0x37')],_0x255e57[_0x812b('0x39')]),_0x42fe6d);if(_0x526987[_0x812b('0x37')][_0x812b('0x42')]){_0x12d0d3[_0x812b('0x40')]=_[_0x812b('0x43')](_0x12d0d3['where'],{'$or':_[_0x812b('0x31')](_0x42fe6d,function(_0x408dd7){if(_0x408dd7[_0x812b('0x34')]!=='VIRTUAL'){var _0x133431={};_0x133431[_0x408dd7[_0x812b('0x2e')]]={'$like':'%'+_0x526987[_0x812b('0x37')][_0x812b('0x42')]+'%'};return _0x133431;}})});}_0x12d0d3=_[_0x812b('0x43')]({},_0x12d0d3,_0x526987[_0x812b('0x44')]);var _0x359bff={'where':_0x12d0d3[_0x812b('0x40')]};return db[_0x812b('0x45')][_0x812b('0x21')](_0x359bff)[_0x812b('0x28')](function(_0x5db9f0){_0x331cef[_0x812b('0x21')]=_0x5db9f0;if(_0x526987[_0x812b('0x37')]['includeAll']){_0x12d0d3[_0x812b('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x812b('0x47')](_0x12d0d3);})[_0x812b('0x28')](function(_0x273500){_0x331cef[_0x812b('0x48')]=_0x273500;return _0x331cef;})[_0x812b('0x28')](respondWithFilteredResult(_0x2bc1fb,_0x12d0d3))[_0x812b('0x49')](handleError(_0x2bc1fb,null));};exports['show']=function(_0x1a3537,_0x292ae8){var _0x567d8c={'raw':!![],'where':{'id':_0x1a3537[_0x812b('0x4a')]['id']}},_0x229710={};_0x229710[_0x812b('0x36')]=_[_0x812b('0x38')](db[_0x812b('0x45')][_0x812b('0x32')]);_0x229710['query']=_[_0x812b('0x38')](_0x1a3537['query']);_0x229710['filters']=_[_0x812b('0x3a')](_0x229710['model'],_0x229710[_0x812b('0x37')]);_0x567d8c[_0x812b('0x3b')]=_[_0x812b('0x3a')](_0x229710['model'],qs['fields'](_0x1a3537['query']['fields']));_0x567d8c[_0x812b('0x3b')]=_0x567d8c[_0x812b('0x3b')][_0x812b('0x3d')]?_0x567d8c[_0x812b('0x3b')]:_0x229710[_0x812b('0x36')];if(_0x1a3537[_0x812b('0x37')][_0x812b('0x4b')]){_0x567d8c['include']=[{'all':!![]}];}_0x567d8c=_[_0x812b('0x43')]({},_0x567d8c,_0x1a3537[_0x812b('0x44')]);return db['WhatsappQueue'][_0x812b('0x4c')](_0x567d8c)[_0x812b('0x28')](handleEntityNotFound(_0x292ae8,null))['then'](respondWithResult(_0x292ae8,null))[_0x812b('0x49')](handleError(_0x292ae8,null));};exports['create']=function(_0x3f91dc,_0x3d6bed){return db[_0x812b('0x45')][_0x812b('0x4d')](_0x3f91dc[_0x812b('0x4e')],{})[_0x812b('0x28')](function(_0x4f7094){var _0x411525=_0x3f91dc[_0x812b('0x4f')][_0x812b('0x2a')]({'plain':!![]});if(!_0x411525)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x411525[_0x812b('0x50')]==='user'){var _0x3f4f53=_0x4f7094[_0x812b('0x2a')]({'plain':!![]});var _0x2d7ea6=_0x812b('0x51');return db[_0x812b('0x52')][_0x812b('0x4c')]({'where':{'name':_0x2d7ea6,'userProfileId':_0x411525[_0x812b('0x53')]},'raw':!![]})[_0x812b('0x28')](function(_0x14efe0){if(_0x14efe0&&_0x14efe0[_0x812b('0x54')]===0x0){return db[_0x812b('0x2b')][_0x812b('0x4d')]({'name':_0x3f4f53[_0x812b('0x2e')],'resourceId':_0x3f4f53['id'],'type':_0x14efe0[_0x812b('0x2e')],'sectionId':_0x14efe0['id']},{})[_0x812b('0x28')](function(){return _0x4f7094;});}else{return _0x4f7094;}})[_0x812b('0x49')](function(_0x2471a1){logger[_0x812b('0x2d')](_0x812b('0x55'),_0x2471a1);throw _0x2471a1;});}return _0x4f7094;})['then'](respondWithResult(_0x3d6bed,0xc9))[_0x812b('0x49')](handleError(_0x3d6bed,null));};exports[_0x812b('0x56')]=function(_0x4377e5,_0x355dfb){if(_0x4377e5[_0x812b('0x4e')]['id']){delete _0x4377e5['body']['id'];}return db[_0x812b('0x45')][_0x812b('0x4c')]({'where':{'id':_0x4377e5[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x355dfb,null))[_0x812b('0x28')](saveUpdates(_0x4377e5[_0x812b('0x4e')],null))[_0x812b('0x28')](respondWithResult(_0x355dfb,null))[_0x812b('0x49')](handleError(_0x355dfb,null));};exports[_0x812b('0x29')]=function(_0x4eb0df,_0xb61cbe){return db[_0x812b('0x45')][_0x812b('0x4c')]({'where':{'id':_0x4eb0df[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0xb61cbe,null))[_0x812b('0x28')](removeEntity(_0xb61cbe,null))['catch'](handleError(_0xb61cbe,null));};exports[_0x812b('0x57')]=function(_0x4a8f9e,_0x3d48e0){return db[_0x812b('0x45')][_0x812b('0x57')]()[_0x812b('0x28')](respondWithResult(_0x3d48e0,null))[_0x812b('0x49')](handleError(_0x3d48e0,null));};exports[_0x812b('0x58')]=function(_0x3b7455,_0x30cf68,_0x511d96){var _0x354e12={'raw':!![],'where':{}},_0x12f7e3={},_0x37f81e;return db['WhatsappQueue']['findOne']({'where':{'id':_0x3b7455['params']['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x30cf68,null))[_0x812b('0x28')](function(_0x3f864d){if(_0x3f864d){_0x37f81e=_0x3f864d[_0x812b('0x2a')]({'plain':!![]});_0x12f7e3[_0x812b('0x36')]=_['keys'](db[_0x812b('0x59')][_0x812b('0x32')]);_0x12f7e3[_0x812b('0x37')]=_[_0x812b('0x38')](_0x3b7455[_0x812b('0x37')]);_0x12f7e3[_0x812b('0x39')]=_[_0x812b('0x3a')](_0x12f7e3[_0x812b('0x36')],_0x12f7e3['query']);_0x354e12['attributes']=_[_0x812b('0x3a')](_0x12f7e3['model'],qs[_0x812b('0x3c')](_0x3b7455[_0x812b('0x37')][_0x812b('0x3c')]));_0x354e12[_0x812b('0x3b')]=_0x354e12[_0x812b('0x3b')]['length']?_0x354e12[_0x812b('0x3b')]:_0x12f7e3[_0x812b('0x36')];if(!_0x3b7455[_0x812b('0x37')][_0x812b('0x3e')]('nolimit')){_0x354e12[_0x812b('0x23')]=qs[_0x812b('0x23')](_0x3b7455[_0x812b('0x37')]['limit']);_0x354e12[_0x812b('0x22')]=qs[_0x812b('0x22')](_0x3b7455[_0x812b('0x37')][_0x812b('0x22')]);}_0x354e12[_0x812b('0x3f')]=qs[_0x812b('0x5a')](_0x3b7455[_0x812b('0x37')][_0x812b('0x5a')]);_0x354e12[_0x812b('0x40')]=qs[_0x812b('0x39')](_[_0x812b('0x41')](_0x3b7455[_0x812b('0x37')],_0x12f7e3[_0x812b('0x39')]));_0x354e12[_0x812b('0x40')]['WhatsappQueueId']=_0x3f864d['id'];if(_0x3b7455[_0x812b('0x37')][_0x812b('0x42')]){_0x354e12[_0x812b('0x40')]=_[_0x812b('0x43')](_0x354e12[_0x812b('0x40')],{'$or':_[_0x812b('0x31')](_0x354e12[_0x812b('0x3b')],function(_0xa43f58){var _0x5549cd={};_0x5549cd[_0xa43f58]={'$like':'%'+_0x3b7455[_0x812b('0x37')]['filter']+'%'};return _0x5549cd;})});}_0x354e12=_[_0x812b('0x43')]({},_0x354e12,_0x3b7455[_0x812b('0x44')]);return db['UserWhatsappQueue'][_0x812b('0x47')](_0x354e12);}})[_0x812b('0x28')](function(_0x2b09b2){if(_0x2b09b2){return db[_0x812b('0x5b')][_0x812b('0x5c')]({'where':{'id':_[_0x812b('0x31')](_0x2b09b2,_0x812b('0x5d')),'role':_0x812b('0x5e')},'attributes':['id','name','whatsappPause',_0x812b('0x5f'),_0x812b('0x60')]});}})[_0x812b('0x28')](function(_0x44688d){if(_0x44688d){return{'count':_0x44688d[_0x812b('0x21')],'rows':_[_0x812b('0x31')](_0x44688d[_0x812b('0x48')],function(_0x4c6869){return{'membername':_0x4c6869['name'],'UserId':_0x4c6869['id'],'queue_name':_0x37f81e[_0x812b('0x2e')],'WhatsappQueueId':_0x37f81e['id'],'interface':util[_0x812b('0x61')]('%s/%s','SIP',_0x4c6869[_0x812b('0x2e')]),'penalty':0x0,'paused':_0x4c6869[_0x812b('0x62')],'createdAt':_0x4c6869['createdAt'],'updatedAt':_0x4c6869[_0x812b('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x30cf68,_0x354e12))[_0x812b('0x49')](handleError(_0x30cf68,null));};exports[_0x812b('0x63')]=function(_0x23a382,_0x48ae92,_0x5ca406){var _0x2f166e={};var _0x4f366a={};var _0x39527a;var _0x590828;return db[_0x812b('0x45')][_0x812b('0x64')]({'where':{'id':_0x23a382[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x48ae92,null))[_0x812b('0x28')](function(_0x36ecda){if(_0x36ecda){_0x39527a=_0x36ecda;_0x4f366a[_0x812b('0x36')]=_[_0x812b('0x38')](db[_0x812b('0x65')][_0x812b('0x32')]);_0x4f366a[_0x812b('0x37')]=_[_0x812b('0x38')](_0x23a382['query']);_0x4f366a['filters']=_['intersection'](_0x4f366a[_0x812b('0x36')],_0x4f366a[_0x812b('0x37')]);_0x2f166e[_0x812b('0x3b')]=_[_0x812b('0x3a')](_0x4f366a['model'],qs['fields'](_0x23a382[_0x812b('0x37')][_0x812b('0x3c')]));_0x2f166e[_0x812b('0x3b')]=_0x2f166e[_0x812b('0x3b')][_0x812b('0x3d')]?_0x2f166e[_0x812b('0x3b')]:_0x4f366a['model'];_0x2f166e[_0x812b('0x3f')]=qs[_0x812b('0x5a')](_0x23a382[_0x812b('0x37')][_0x812b('0x5a')]);_0x2f166e[_0x812b('0x40')]=qs[_0x812b('0x39')](_[_0x812b('0x41')](_0x23a382['query'],_0x4f366a['filters']));if(_0x23a382[_0x812b('0x37')][_0x812b('0x42')]){_0x2f166e['where']=_[_0x812b('0x43')](_0x2f166e[_0x812b('0x40')],{'$or':_[_0x812b('0x31')](_0x2f166e[_0x812b('0x3b')],function(_0x4aa1ce){var _0x539611={};_0x539611[_0x4aa1ce]={'$like':'%'+_0x23a382[_0x812b('0x37')][_0x812b('0x42')]+'%'};return _0x539611;})});}_0x2f166e=_[_0x812b('0x43')]({},_0x2f166e,_0x23a382['options']);return _0x39527a[_0x812b('0x63')](_0x2f166e);}})[_0x812b('0x28')](function(_0x46eeb4){if(_0x46eeb4){_0x590828=_0x46eeb4[_0x812b('0x3d')];if(!_0x23a382['query'][_0x812b('0x3e')](_0x812b('0x66'))){_0x2f166e['limit']=qs[_0x812b('0x23')](_0x23a382[_0x812b('0x37')]['limit']);_0x2f166e[_0x812b('0x22')]=qs[_0x812b('0x22')](_0x23a382[_0x812b('0x37')][_0x812b('0x22')]);}return _0x39527a[_0x812b('0x63')](_0x2f166e);}})[_0x812b('0x28')](function(_0x389983){if(_0x389983){return _0x389983?{'count':_0x590828,'rows':_0x389983}:null;}})['then'](respondWithResult(_0x48ae92,null))[_0x812b('0x49')](handleError(_0x48ae92,null));};exports[_0x812b('0x67')]=function(_0x45e5ad,_0xe0ce94,_0x54908c){var _0x5f3cdf=_0x45e5ad[_0x812b('0x4e')]['ids'];return db[_0x812b('0x65')][_0x812b('0x47')]({'where':{'id':_0x5f3cdf},'attributes':['id'],'include':[{'model':db[_0x812b('0x5b')],'as':_0x812b('0x68'),'attributes':['id',_0x812b('0x2e'),_0x812b('0x69'),_0x812b('0x6a'),'interface'],'raw':!![]}]})[_0x812b('0x28')](function(_0x356973){if(_0x356973){var _0x346add=_[_0x812b('0x6b')](_0x356973,function(_0x2e9e2b){var _0x2bb241=_0x2e9e2b[_0x812b('0x2a')]({'plain':!![]});return _0x2bb241[_0x812b('0x68')];});return db['WhatsappQueue'][_0x812b('0x4c')]({'where':{'id':_0x45e5ad[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](function(_0x109aa9){return db[_0x812b('0x6c')][_0x812b('0x6d')](function(_0xff51f1){return _0x109aa9[_0x812b('0x67')](_0x5f3cdf,{'transaction':_0xff51f1})[_0x812b('0x28')](function(){return BPromise[_0x812b('0x6e')](_0x346add,function(_0x51f683){return db[_0x812b('0x59')]['findOrCreate']({'where':{'UserId':_0x51f683['id'],'WhatsappQueueId':_0x45e5ad['params']['id']},'transaction':_0xff51f1});});})[_0x812b('0x28')](function(){_0x346add['forEach'](function(_0x482189){socket[_0x812b('0x6f')](_0x812b('0x70'),{'UserId':_0x482189['id'],'WhatsappQueueId':_0x109aa9['id']});});});});});}})[_0x812b('0x28')](respondWithStatusCode(_0xe0ce94,null))[_0x812b('0x49')](handleError(_0xe0ce94,null));};exports[_0x812b('0x71')]=function(_0x35fe22,_0x4f4ec8,_0x130c32){return db[_0x812b('0x65')]['findAll']({'where':{'id':_0x35fe22[_0x812b('0x37')][_0x812b('0x72')]},'attributes':['id'],'include':[{'model':db[_0x812b('0x5b')],'as':_0x812b('0x68'),'attributes':['id'],'raw':!![]}]})[_0x812b('0x28')](handleEntityNotFound(_0x4f4ec8,null))[_0x812b('0x28')](function(_0xd2aa76){var _0x31d40f=_[_0x812b('0x31')](_0xd2aa76,'id');var _0x54f870=[];var _0x23a95e=[];var _0x1bbe10=squel[_0x812b('0x73')]();_0x1bbe10[_0x812b('0x74')](_0x812b('0x75'))[_0x812b('0x76')](_0x812b('0x77'),'tq')[_0x812b('0x78')](_0x812b('0x79'),'ut',_0x812b('0x7a'))[_0x812b('0x40')](_0x812b('0x7b'),_0x35fe22[_0x812b('0x4a')]['id']);for(var _0xa4ce47=0x0;_0xa4ce47<_0xd2aa76[_0x812b('0x3d')];_0xa4ce47+=0x1){let _0x218818=_0xd2aa76[_0xa4ce47];for(var _0x4623c8=0x0;_0x4623c8<_0x218818[_0x812b('0x68')][_0x812b('0x3d')];_0x4623c8+=0x1){let _0x29960c=_0x218818[_0x812b('0x68')][_0x4623c8];var _0x51fb8a=_0x1bbe10['clone']();_0x51fb8a[_0x812b('0x40')]('ut.UserId\x20=\x20?',_0x29960c['id']);_0x23a95e[_0x812b('0x7c')](db[_0x812b('0x6c')][_0x812b('0x37')](_0x51fb8a[_0x812b('0x7d')](),{'type':db[_0x812b('0x6c')][_0x812b('0x7e')][_0x812b('0x7f')]})[_0x812b('0x28')](function(_0x582403){if(_0x582403[_0x812b('0x3d')]===0x1){return _0x29960c['id'];}else{var _0x5db83e=_['every'](_[_0x812b('0x31')](_0x582403,'TeamId'),function(_0x4f50d5){return _[_0x812b('0x80')](_0x31d40f,_0x4f50d5);});if(_0x5db83e){return _0x29960c['id'];}}}));}}return BPromise[_0x812b('0x81')](_0x23a95e)['then'](function(_0x2478fb){_0x54f870=_(_0x54f870)[_0x812b('0x82')](_0x2478fb)[_0x812b('0x83')]()['value']();return db[_0x812b('0x45')][_0x812b('0x4c')]({'where':{'id':_0x35fe22[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](function(_0x30e493){return db[_0x812b('0x6c')][_0x812b('0x6d')](function(_0x5835ef){return _0x30e493[_0x812b('0x71')](_0x35fe22[_0x812b('0x37')][_0x812b('0x72')],{'transaction':_0x5835ef})[_0x812b('0x28')](function(){if(!_['isEmpty'](_0x54f870)){return _0x30e493[_0x812b('0x84')](_0x54f870,{'transaction':_0x5835ef});}})['then'](function(){_0x54f870[_0x812b('0x85')](function(_0x4579a8){socket[_0x812b('0x6f')](_0x812b('0x86'),{'UserId':_0x4579a8,'WhatsappQueueId':_0x30e493['id']});});});});});});})[_0x812b('0x28')](respondWithStatusCode(_0x4f4ec8,null))[_0x812b('0x49')](handleError(_0x4f4ec8,null));};exports[_0x812b('0x87')]=function(_0x2ee4a3,_0x311e33,_0x57c3c9){return db[_0x812b('0x45')][_0x812b('0x4c')]({'where':{'id':_0x2ee4a3[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x311e33,null))[_0x812b('0x28')](function(_0x5ce623){if(_0x5ce623){return _0x5ce623[_0x812b('0x87')](_0x2ee4a3[_0x812b('0x4e')][_0x812b('0x72')],_[_0x812b('0x88')](_0x2ee4a3[_0x812b('0x4e')],[_0x812b('0x72'),'id'])||{})[_0x812b('0x89')](function(_0x558df4){for(var _0x1f4026=0x0;_0x1f4026<_0x2ee4a3[_0x812b('0x4e')][_0x812b('0x72')]['length'];_0x1f4026+=0x1){socket['emit'](_0x812b('0x70'),{'UserId':_0x2ee4a3[_0x812b('0x4e')][_0x812b('0x72')][_0x1f4026],'WhatsappQueueId':_0x2ee4a3[_0x812b('0x4a')]['id']});}return _0x558df4;});}})['then'](respondWithResult(_0x311e33,null))[_0x812b('0x49')](handleError(_0x311e33,null));};exports[_0x812b('0x84')]=function(_0x2b84c9,_0x55d484,_0x3a3715){return db['WhatsappQueue']['find']({'where':{'id':_0x2b84c9[_0x812b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x55d484,null))['then'](function(_0x52477b){if(_0x52477b){return _0x52477b[_0x812b('0x84')](_0x2b84c9[_0x812b('0x37')][_0x812b('0x72')])[_0x812b('0x28')](function(){if(_['isArray'](_0x2b84c9[_0x812b('0x37')][_0x812b('0x72')])){for(var _0x196d3d=0x0;_0x196d3d<_0x2b84c9[_0x812b('0x37')][_0x812b('0x72')]['length'];_0x196d3d+=0x1){socket['emit'](_0x812b('0x86'),{'UserId':Number(_0x2b84c9[_0x812b('0x37')]['ids'][_0x196d3d]),'WhatsappQueueId':Number(_0x2b84c9[_0x812b('0x4a')]['id'])});}}else{socket[_0x812b('0x6f')](_0x812b('0x86'),{'UserId':Number(_0x2b84c9[_0x812b('0x37')][_0x812b('0x72')]),'WhatsappQueueId':Number(_0x2b84c9[_0x812b('0x4a')]['id'])});}});}})[_0x812b('0x28')](respondWithStatusCode(_0x55d484,null))[_0x812b('0x49')](handleError(_0x55d484,null));};exports[_0x812b('0x8a')]=function(_0x3259e0,_0x66d33f,_0x5b7501){var _0x40442a={};var _0x48a797={};var _0x5b61e5;var _0x58b431;return db[_0x812b('0x45')]['findOne']({'where':{'id':_0x3259e0[_0x812b('0x4a')]['id']}})[_0x812b('0x28')](handleEntityNotFound(_0x66d33f,null))['then'](function(_0x684883){if(_0x684883){_0x5b61e5=_0x684883;_0x48a797[_0x812b('0x36')]=_['keys'](db[_0x812b('0x5b')]['rawAttributes']);_0x48a797[_0x812b('0x37')]=_[_0x812b('0x38')](_0x3259e0[_0x812b('0x37')]);_0x48a797[_0x812b('0x39')]=_[_0x812b('0x3a')](_0x48a797[_0x812b('0x36')],_0x48a797[_0x812b('0x37')]);_0x40442a[_0x812b('0x3b')]=_[_0x812b('0x3a')](_0x48a797[_0x812b('0x36')],qs[_0x812b('0x3c')](_0x3259e0[_0x812b('0x37')][_0x812b('0x3c')]));_0x40442a[_0x812b('0x3b')]=_0x40442a[_0x812b('0x3b')][_0x812b('0x3d')]?_0x40442a[_0x812b('0x3b')]:_0x48a797[_0x812b('0x36')];_0x40442a[_0x812b('0x3f')]=qs[_0x812b('0x5a')](_0x3259e0['query']['sort']);_0x40442a['where']=qs[_0x812b('0x39')](_['pick'](_0x3259e0[_0x812b('0x37')],_0x48a797[_0x812b('0x39')]));if(_0x3259e0[_0x812b('0x37')][_0x812b('0x42')]){_0x40442a[_0x812b('0x40')]=_[_0x812b('0x43')](_0x40442a[_0x812b('0x40')],{'$or':_[_0x812b('0x31')](_0x40442a[_0x812b('0x3b')],function(_0x12d949){var _0x4736d6={};_0x4736d6[_0x12d949]={'$like':'%'+_0x3259e0[_0x812b('0x37')][_0x812b('0x42')]+'%'};return _0x4736d6;})});}_0x40442a=_['merge']({},_0x40442a,_0x3259e0[_0x812b('0x44')]);return _0x5b61e5[_0x812b('0x8a')](_0x40442a);}})[_0x812b('0x28')](function(_0x2cad13){if(_0x2cad13){_0x58b431=_0x2cad13[_0x812b('0x3d')];if(!_0x3259e0['query'][_0x812b('0x3e')](_0x812b('0x66'))){_0x40442a['limit']=qs[_0x812b('0x23')](_0x3259e0[_0x812b('0x37')][_0x812b('0x23')]);_0x40442a[_0x812b('0x22')]=qs[_0x812b('0x22')](_0x3259e0[_0x812b('0x37')]['offset']);}return _0x5b61e5[_0x812b('0x8a')](_0x40442a);}})[_0x812b('0x28')](function(_0x4affbe){if(_0x4affbe){return _0x4affbe?{'count':_0x58b431,'rows':_0x4affbe}:null;}})['then'](respondWithResult(_0x66d33f,null))['catch'](handleError(_0x66d33f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 5bf976c..77e8fea 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 _0x512a=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x421657,_0x239a58){var _0x34ffde=function(_0x59deb7){while(--_0x59deb7){_0x421657['push'](_0x421657['shift']());}};_0x34ffde(++_0x239a58);}(_0x512a,0x1c6));var _0xa512=function(_0x491b61,_0x28c91b){_0x491b61=_0x491b61-0x0;var _0x2c5d9e=_0x512a[_0x491b61];return _0x2c5d9e;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xa512('0x0'))['db'][_0xa512('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa512('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa512('0x3'),'afterDestroy':_0xa512('0x4')};function emitEvent(_0x2b5375){return function(_0x8d4fd2,_0x5e0e81,_0x2764e3){WhatsappQueueEvents[_0xa512('0x5')](_0x2b5375+':'+_0x8d4fd2['id'],_0x8d4fd2);WhatsappQueueEvents[_0xa512('0x5')](_0x2b5375,_0x8d4fd2);_0x2764e3(null);};}for(var e in events){if(events[_0xa512('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x8d50=['update','remove','emit','hasOwnProperty','hook','WhatsappQueue','save'];(function(_0x480cca,_0x33709f){var _0x22bcdb=function(_0x15ab17){while(--_0x15ab17){_0x480cca['push'](_0x480cca['shift']());}};_0x22bcdb(++_0x33709f);}(_0x8d50,0xec));var _0x08d5=function(_0x11937c,_0x463468){_0x11937c=_0x11937c-0x0;var _0x1f55e9=_0x8d50[_0x11937c];return _0x1f55e9;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x08d5('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x08d5('0x1'),'afterUpdate':_0x08d5('0x2'),'afterDestroy':_0x08d5('0x3')};function emitEvent(_0x1e18bc){return function(_0x37cf52,_0x486b5c,_0x5f1b31){WhatsappQueueEvents['emit'](_0x1e18bc+':'+_0x37cf52['id'],_0x37cf52);WhatsappQueueEvents[_0x08d5('0x4')](_0x1e18bc,_0x37cf52);_0x5f1b31(null);};}for(var e in events){if(events[_0x08d5('0x5')](e)){var event=events[e];WhatsappQueue[_0x08d5('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 80856d9..f933b61 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 _0x7a40=['bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','../../config/logger','api'];(function(_0x178164,_0x5bd858){var _0x4c84aa=function(_0x3a0597){while(--_0x3a0597){_0x178164['push'](_0x178164['shift']());}};_0x4c84aa(++_0x5bd858);}(_0x7a40,0x76));var _0x07a4=function(_0x38efe2,_0x1be7ae){_0x38efe2=_0x38efe2-0x0;var _0x5ef0f6=_0x7a40[_0x38efe2];return _0x5ef0f6;};'use strict';var _=require(_0x07a4('0x0'));var util=require('util');var logger=require(_0x07a4('0x1'))(_0x07a4('0x2'));var moment=require('moment');var BPromise=require(_0x07a4('0x3'));var rp=require(_0x07a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07a4('0x5'));var config=require(_0x07a4('0x6'));var attributes=require(_0x07a4('0x7'));module[_0x07a4('0x8')]=function(_0x20ea03,_0x3b0377){return _0x20ea03[_0x07a4('0x9')](_0x07a4('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc59d=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x10fcb1,_0x28ddba){var _0x5e1b86=function(_0x5e62e6){while(--_0x5e62e6){_0x10fcb1['push'](_0x10fcb1['shift']());}};_0x5e1b86(++_0x28ddba);}(_0xc59d,0x14e));var _0xdc59=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc59d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xdc59('0x0'));var util=require(_0xdc59('0x1'));var logger=require(_0xdc59('0x2'))(_0xdc59('0x3'));var moment=require('moment');var BPromise=require(_0xdc59('0x4'));var rp=require(_0xdc59('0x5'));var fs=require('fs');var path=require(_0xdc59('0x6'));var rimraf=require(_0xdc59('0x7'));var config=require(_0xdc59('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xdc59('0x9')]=function(_0x463e07,_0x3443c3){return _0x463e07[_0xdc59('0xa')](_0xdc59('0xb'),attributes,{'tableName':_0xdc59('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 30dcbbc..51aa71d 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 _0x4ade=['include','map','model','attributes','GetWhatsappQueue','find','where','ShowWhatsappQueue','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','WhatsappQueue','findAll','options','raw'];(function(_0xe34c3d,_0x54be63){var _0x515aa2=function(_0x4dd1e2){while(--_0x4dd1e2){_0xe34c3d['push'](_0xe34c3d['shift']());}};_0x515aa2(++_0x54be63);}(_0x4ade,0xa0));var _0xe4ad=function(_0x38e076,_0x71d3d){_0x38e076=_0x38e076-0x0;var _0x4a49cb=_0x4ade[_0x38e076];return _0x4a49cb;};'use strict';var _=require(_0xe4ad('0x0'));var util=require(_0xe4ad('0x1'));var moment=require('moment');var BPromise=require(_0xe4ad('0x2'));var rs=require(_0xe4ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe4ad('0x4'));var logger=require('../../config/logger')(_0xe4ad('0x5'));var config=require(_0xe4ad('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe4ad('0x7')]({'port':0x232a});config['redis']=_[_0xe4ad('0x8')](config[_0xe4ad('0x9')],{'host':_0xe4ad('0xa'),'port':0x18eb});var socket=require(_0xe4ad('0xb'))(new Redis(config[_0xe4ad('0x9')]));require(_0xe4ad('0xc'))[_0xe4ad('0xd')](socket);function respondWithRpcPromise(_0x26a2f1,_0x4039eb,_0x31b877){return new BPromise(function(_0x32cabe,_0x1692c9){return client[_0xe4ad('0xe')](_0x26a2f1,_0x31b877)[_0xe4ad('0xf')](function(_0x1fa602){logger['info'](_0xe4ad('0x10'),_0x4039eb,'request\x20sent');logger[_0xe4ad('0x11')](_0xe4ad('0x12'),_0x4039eb,_0xe4ad('0x13'),JSON[_0xe4ad('0x14')](_0x1fa602));if(_0x1fa602['error']){if(_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x16')]===0x1f4){logger['error'](_0xe4ad('0x10'),_0x4039eb,_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x17')]);return _0x1692c9(_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x17')]);}logger['error'](_0xe4ad('0x10'),_0x4039eb,_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x17')]);return _0x32cabe(_0x1fa602[_0xe4ad('0x15')][_0xe4ad('0x17')]);}else{logger[_0xe4ad('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x4039eb,'request\x20sent');_0x32cabe(_0x1fa602['result'][_0xe4ad('0x17')]);}})[_0xe4ad('0x19')](function(_0x4801e5){logger[_0xe4ad('0x15')](_0xe4ad('0x10'),_0x4039eb,_0x4801e5);_0x1692c9(_0x4801e5);});});}exports['GetWhatsappQueue']=function(_0x4bcc1e){var _0xf182dd=this;return new Promise(function(_0x115780,_0x7825d9){return db[_0xe4ad('0x1a')][_0xe4ad('0x1b')]({'raw':_0x4bcc1e[_0xe4ad('0x1c')]?_0x4bcc1e[_0xe4ad('0x1c')][_0xe4ad('0x1d')]===undefined?!![]:![]:!![],'where':_0x4bcc1e[_0xe4ad('0x1c')]?_0x4bcc1e['options']['where']||null:null,'attributes':_0x4bcc1e['options']?_0x4bcc1e[_0xe4ad('0x1c')]['attributes']||null:null,'limit':_0x4bcc1e[_0xe4ad('0x1c')]?_0x4bcc1e[_0xe4ad('0x1c')]['limit']||null:null,'include':_0x4bcc1e[_0xe4ad('0x1c')]?_0x4bcc1e['options'][_0xe4ad('0x1e')]?_[_0xe4ad('0x1f')](_0x4bcc1e[_0xe4ad('0x1c')][_0xe4ad('0x1e')],function(_0xd45e9d){return{'model':db[_0xd45e9d[_0xe4ad('0x20')]],'as':_0xd45e9d['as'],'attributes':_0xd45e9d[_0xe4ad('0x21')],'include':_0xd45e9d['include']?_[_0xe4ad('0x1f')](_0xd45e9d[_0xe4ad('0x1e')],function(_0x353313){return{'model':db[_0x353313[_0xe4ad('0x20')]],'as':_0x353313['as'],'attributes':_0x353313[_0xe4ad('0x21')],'include':_0x353313[_0xe4ad('0x1e')]?_['map'](_0x353313[_0xe4ad('0x1e')],function(_0xfcd4ad){return{'model':db[_0xfcd4ad[_0xe4ad('0x20')]],'as':_0xfcd4ad['as'],'attributes':_0xfcd4ad[_0xe4ad('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x265c78){logger[_0xe4ad('0x18')]('GetWhatsappQueue',_0x4bcc1e);logger[_0xe4ad('0x11')]('GetWhatsappQueue',_0x4bcc1e,JSON[_0xe4ad('0x14')](_0x265c78));_0x115780(_0x265c78);})[_0xe4ad('0x19')](function(_0x17d63d){logger[_0xe4ad('0x15')](_0xe4ad('0x22'),_0x17d63d[_0xe4ad('0x17')],_0x4bcc1e);_0x7825d9(_0xf182dd[_0xe4ad('0x15')](0x1f4,_0x17d63d['message']));});});};exports['ShowWhatsappQueue']=function(_0x341685){var _0x193b8=this;return new Promise(function(_0x432b75,_0xb2dfc9){return db[_0xe4ad('0x1a')][_0xe4ad('0x23')]({'raw':_0x341685[_0xe4ad('0x1c')]?_0x341685[_0xe4ad('0x1c')][_0xe4ad('0x1d')]===undefined?!![]:![]:!![],'where':_0x341685[_0xe4ad('0x1c')]?_0x341685[_0xe4ad('0x1c')][_0xe4ad('0x24')]||null:null,'attributes':_0x341685[_0xe4ad('0x1c')]?_0x341685[_0xe4ad('0x1c')][_0xe4ad('0x21')]||null:null,'include':_0x341685[_0xe4ad('0x1c')]?_0x341685[_0xe4ad('0x1c')]['include']?_[_0xe4ad('0x1f')](_0x341685[_0xe4ad('0x1c')]['include'],function(_0x352f53){return{'model':db[_0x352f53[_0xe4ad('0x20')]],'as':_0x352f53['as'],'attributes':_0x352f53[_0xe4ad('0x21')],'include':_0x352f53['include']?_[_0xe4ad('0x1f')](_0x352f53[_0xe4ad('0x1e')],function(_0x522c80){return{'model':db[_0x522c80[_0xe4ad('0x20')]],'as':_0x522c80['as'],'attributes':_0x522c80[_0xe4ad('0x21')],'include':_0x522c80[_0xe4ad('0x1e')]?_[_0xe4ad('0x1f')](_0x522c80[_0xe4ad('0x1e')],function(_0x196aee){return{'model':db[_0x196aee[_0xe4ad('0x20')]],'as':_0x196aee['as'],'attributes':_0x196aee[_0xe4ad('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54b6e0){logger[_0xe4ad('0x18')](_0xe4ad('0x25'),_0x341685);logger[_0xe4ad('0x11')](_0xe4ad('0x25'),_0x341685,JSON[_0xe4ad('0x14')](_0x54b6e0));_0x432b75(_0x54b6e0);})[_0xe4ad('0x19')](function(_0x2285ef){logger[_0xe4ad('0x15')](_0xe4ad('0x25'),_0x2285ef['message'],_0x341685);_0xb2dfc9(_0x193b8['error'](0x1f4,_0x2285ef[_0xe4ad('0x17')]));});});}; \ No newline at end of file +var _0xb39f=['WhatsappQueue','findAll','options','raw','limit','include','map','model','attributes','then','stringify','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetWhatsappQueue'];(function(_0x51488a,_0x48014e){var _0x152465=function(_0x378095){while(--_0x378095){_0x51488a['push'](_0x51488a['shift']());}};_0x152465(++_0x48014e);}(_0xb39f,0x188));var _0xfb39=function(_0x2ee6ec,_0x1775d6){_0x2ee6ec=_0x2ee6ec-0x0;var _0x3b95a7=_0xb39f[_0x2ee6ec];return _0x3b95a7;};'use strict';var _=require(_0xfb39('0x0'));var util=require(_0xfb39('0x1'));var moment=require(_0xfb39('0x2'));var BPromise=require(_0xfb39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb39('0x4'));var db=require(_0xfb39('0x5'))['db'];var utils=require(_0xfb39('0x6'));var logger=require('../../config/logger')(_0xfb39('0x7'));var config=require(_0xfb39('0x8'));var jayson=require(_0xfb39('0x9'));var client=jayson[_0xfb39('0xa')][_0xfb39('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfb39('0xc')],{'host':_0xfb39('0xd'),'port':0x18eb});var socket=require(_0xfb39('0xe'))(new Redis(config['redis']));require(_0xfb39('0xf'))[_0xfb39('0x10')](socket);function respondWithRpcPromise(_0x1c1d2b,_0x157d3e,_0x1d01ec){return new BPromise(function(_0x538968,_0x4ed017){return client[_0xfb39('0x11')](_0x1c1d2b,_0x1d01ec)['then'](function(_0x1f6f19){logger[_0xfb39('0x12')](_0xfb39('0x13'),_0x157d3e,'request\x20sent');logger[_0xfb39('0x14')](_0xfb39('0x15'),_0x157d3e,_0xfb39('0x16'),JSON['stringify'](_0x1f6f19));if(_0x1f6f19['error']){if(_0x1f6f19[_0xfb39('0x17')][_0xfb39('0x18')]===0x1f4){logger['error'](_0xfb39('0x13'),_0x157d3e,_0x1f6f19[_0xfb39('0x17')][_0xfb39('0x19')]);return _0x4ed017(_0x1f6f19['error']['message']);}logger[_0xfb39('0x17')](_0xfb39('0x13'),_0x157d3e,_0x1f6f19['error'][_0xfb39('0x19')]);return _0x538968(_0x1f6f19['error']['message']);}else{logger[_0xfb39('0x12')](_0xfb39('0x13'),_0x157d3e,_0xfb39('0x16'));_0x538968(_0x1f6f19['result'][_0xfb39('0x19')]);}})[_0xfb39('0x1a')](function(_0x51eb40){logger[_0xfb39('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x157d3e,_0x51eb40);_0x4ed017(_0x51eb40);});});}exports[_0xfb39('0x1b')]=function(_0x1eb03e){var _0x2b7567=this;return new Promise(function(_0x375d4a,_0x36a9b5){return db[_0xfb39('0x1c')][_0xfb39('0x1d')]({'raw':_0x1eb03e['options']?_0x1eb03e[_0xfb39('0x1e')][_0xfb39('0x1f')]===undefined?!![]:![]:!![],'where':_0x1eb03e[_0xfb39('0x1e')]?_0x1eb03e[_0xfb39('0x1e')]['where']||null:null,'attributes':_0x1eb03e['options']?_0x1eb03e['options']['attributes']||null:null,'limit':_0x1eb03e[_0xfb39('0x1e')]?_0x1eb03e['options'][_0xfb39('0x20')]||null:null,'include':_0x1eb03e['options']?_0x1eb03e[_0xfb39('0x1e')][_0xfb39('0x21')]?_[_0xfb39('0x22')](_0x1eb03e['options']['include'],function(_0xbbeff8){return{'model':db[_0xbbeff8[_0xfb39('0x23')]],'as':_0xbbeff8['as'],'attributes':_0xbbeff8['attributes'],'include':_0xbbeff8[_0xfb39('0x21')]?_[_0xfb39('0x22')](_0xbbeff8[_0xfb39('0x21')],function(_0x1ad70f){return{'model':db[_0x1ad70f[_0xfb39('0x23')]],'as':_0x1ad70f['as'],'attributes':_0x1ad70f[_0xfb39('0x24')],'include':_0x1ad70f[_0xfb39('0x21')]?_['map'](_0x1ad70f[_0xfb39('0x21')],function(_0x20c6db){return{'model':db[_0x20c6db['model']],'as':_0x20c6db['as'],'attributes':_0x20c6db[_0xfb39('0x24')]};}):[]};}):[]};}):[]:[]})[_0xfb39('0x25')](function(_0x458bf4){logger[_0xfb39('0x12')](_0xfb39('0x1b'),_0x1eb03e);logger[_0xfb39('0x14')]('GetWhatsappQueue',_0x1eb03e,JSON[_0xfb39('0x26')](_0x458bf4));_0x375d4a(_0x458bf4);})[_0xfb39('0x1a')](function(_0x4a525b){logger[_0xfb39('0x17')](_0xfb39('0x1b'),_0x4a525b[_0xfb39('0x19')],_0x1eb03e);_0x36a9b5(_0x2b7567['error'](0x1f4,_0x4a525b['message']));});});};exports[_0xfb39('0x27')]=function(_0xa8c8a){var _0x52283f=this;return new Promise(function(_0x2d3e6,_0x4886b7){return db[_0xfb39('0x1c')][_0xfb39('0x28')]({'raw':_0xa8c8a[_0xfb39('0x1e')]?_0xa8c8a[_0xfb39('0x1e')][_0xfb39('0x1f')]===undefined?!![]:![]:!![],'where':_0xa8c8a[_0xfb39('0x1e')]?_0xa8c8a[_0xfb39('0x1e')][_0xfb39('0x29')]||null:null,'attributes':_0xa8c8a[_0xfb39('0x1e')]?_0xa8c8a[_0xfb39('0x1e')]['attributes']||null:null,'include':_0xa8c8a[_0xfb39('0x1e')]?_0xa8c8a[_0xfb39('0x1e')]['include']?_[_0xfb39('0x22')](_0xa8c8a[_0xfb39('0x1e')]['include'],function(_0x2d3bc5){return{'model':db[_0x2d3bc5[_0xfb39('0x23')]],'as':_0x2d3bc5['as'],'attributes':_0x2d3bc5[_0xfb39('0x24')],'include':_0x2d3bc5[_0xfb39('0x21')]?_[_0xfb39('0x22')](_0x2d3bc5[_0xfb39('0x21')],function(_0x808f7e){return{'model':db[_0x808f7e[_0xfb39('0x23')]],'as':_0x808f7e['as'],'attributes':_0x808f7e[_0xfb39('0x24')],'include':_0x808f7e[_0xfb39('0x21')]?_[_0xfb39('0x22')](_0x808f7e['include'],function(_0x2ede52){return{'model':db[_0x2ede52[_0xfb39('0x23')]],'as':_0x2ede52['as'],'attributes':_0x2ede52[_0xfb39('0x24')]};}):[]};}):[]};}):[]:[]})[_0xfb39('0x25')](function(_0x107403){logger[_0xfb39('0x12')]('ShowWhatsappQueue',_0xa8c8a);logger[_0xfb39('0x14')](_0xfb39('0x27'),_0xa8c8a,JSON[_0xfb39('0x26')](_0x107403));_0x2d3e6(_0x107403);})[_0xfb39('0x1a')](function(_0xec645c){logger[_0xfb39('0x17')](_0xfb39('0x27'),_0xec645c[_0xfb39('0x19')],_0xa8c8a);_0x4886b7(_0x52283f[_0xfb39('0x17')](0x1f4,_0xec645c[_0xfb39('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 313c31f..c1fe992 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 _0x4f9d=['emit','register','length','./whatsappQueue.events','save','remove'];(function(_0x45937f,_0x256a25){var _0x5bf5d1=function(_0x4300bd){while(--_0x4300bd){_0x45937f['push'](_0x45937f['shift']());}};_0x5bf5d1(++_0x256a25);}(_0x4f9d,0x1b3));var _0xd4f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f9d[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require(_0xd4f9('0x0'));var events=[_0xd4f9('0x1'),_0xd4f9('0x2'),'update'];function createListener(_0x357191,_0x269039){return function(_0x30abe0){_0x269039[_0xd4f9('0x3')](_0x357191,_0x30abe0);};}function removeListener(_0x2d6634,_0x562996){return function(){WhatsappQueueEvents['removeListener'](_0x2d6634,_0x562996);};}exports[_0xd4f9('0x4')]=function(_0x39f445){for(var _0x5d4724=0x0,_0x33a055=events[_0xd4f9('0x5')];_0x5d4724<_0x33a055;_0x5d4724++){var _0x1bada0=events[_0x5d4724];var _0x151221=createListener('whatsappQueue:'+_0x1bada0,_0x39f445);WhatsappQueueEvents['on'](_0x1bada0,_0x151221);}}; \ No newline at end of file +var _0x17ba=['register','length','whatsappQueue:','./whatsappQueue.events','save','update','emit','removeListener'];(function(_0x10b0e0,_0x2d74d8){var _0x25fd32=function(_0x42968e){while(--_0x42968e){_0x10b0e0['push'](_0x10b0e0['shift']());}};_0x25fd32(++_0x2d74d8);}(_0x17ba,0xab));var _0xa17b=function(_0x2f66af,_0x4d486a){_0x2f66af=_0x2f66af-0x0;var _0x32b3a2=_0x17ba[_0x2f66af];return _0x32b3a2;};'use strict';var WhatsappQueueEvents=require(_0xa17b('0x0'));var events=[_0xa17b('0x1'),'remove',_0xa17b('0x2')];function createListener(_0x4563da,_0x2806ac){return function(_0x3c60e5){_0x2806ac[_0xa17b('0x3')](_0x4563da,_0x3c60e5);};}function removeListener(_0x38c13c,_0x11d7b7){return function(){WhatsappQueueEvents[_0xa17b('0x4')](_0x38c13c,_0x11d7b7);};}exports[_0xa17b('0x5')]=function(_0x3cced2){for(var _0xf72ed4=0x0,_0x2e3d43=events[_0xa17b('0x6')];_0xf72ed4<_0x2e3d43;_0xf72ed4++){var _0x57f9cd=events[_0xf72ed4];var _0x2ca4d3=createListener(_0xa17b('0x7')+_0x57f9cd,_0x3cced2);WhatsappQueueEvents['on'](_0x57f9cd,_0x2ca4d3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 1023185..c0040a9 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 _0xe511=['util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','post','put','update','delete','destroy','exports','multer'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe511,0x143));var _0x1e51=function(_0x3e29df,_0x42fdf8){_0x3e29df=_0x3e29df-0x0;var _0x3e3ba9=_0xe511[_0x3e29df];return _0x3e3ba9;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require(_0x1e51('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e51('0x3'));var router=express[_0x1e51('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x1e51('0x7')](),controller[_0x1e51('0x8')]);router[_0x1e51('0x9')]('/describe',auth[_0x1e51('0x7')](),controller[_0x1e51('0xa')]);router['get'](_0x1e51('0xb'),auth[_0x1e51('0x7')](),controller['show']);router[_0x1e51('0xc')]('/',auth[_0x1e51('0x7')](),controller['create']);router[_0x1e51('0xd')](_0x1e51('0xb'),auth['isAuthenticated'](),controller[_0x1e51('0xe')]);router[_0x1e51('0xf')](_0x1e51('0xb'),auth[_0x1e51('0x7')](),controller[_0x1e51('0x10')]);module[_0x1e51('0x11')]=router; \ No newline at end of file +var _0xe6c0=['get','isAuthenticated','index','/describe','describe','/:id','show','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xe6c0,0x88));var _0x0e6c=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xe6c0[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require('multer');var util=require(_0x0e6c('0x0'));var path=require(_0x0e6c('0x1'));var timeout=require(_0x0e6c('0x2'));var express=require('express');var router=express[_0x0e6c('0x3')]();var auth=require(_0x0e6c('0x4'));var interaction=require(_0x0e6c('0x5'));var config=require(_0x0e6c('0x6'));var controller=require(_0x0e6c('0x7'));router[_0x0e6c('0x8')]('/',auth[_0x0e6c('0x9')](),controller[_0x0e6c('0xa')]);router[_0x0e6c('0x8')](_0x0e6c('0xb'),auth['isAuthenticated'](),controller[_0x0e6c('0xc')]);router['get'](_0x0e6c('0xd'),auth[_0x0e6c('0x9')](),controller[_0x0e6c('0xe')]);router['post']('/',auth[_0x0e6c('0x9')](),controller['create']);router['put']('/:id',auth[_0x0e6c('0x9')](),controller[_0x0e6c('0xf')]);router['delete']('/:id',auth[_0x0e6c('0x9')](),controller[_0x0e6c('0x10')]);module[_0x0e6c('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5e54502..b57bf7a 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 _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x24b773,_0x392c26){_0x24b773=_0x24b773-0x0;var _0x35f6c9=_0xf3cd[_0x24b773];return _0x35f6c9;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file +var _0x6aa7=['DATE','sequelize','STRING'];(function(_0x157e77,_0x523cb9){var _0x78f6ae=function(_0x5f51f5){while(--_0x5f51f5){_0x157e77['push'](_0x157e77['shift']());}};_0x78f6ae(++_0x523cb9);}(_0x6aa7,0x178));var _0x76aa=function(_0x3c2a5f,_0xa88029){_0x3c2a5f=_0x3c2a5f-0x0;var _0x83115d=_0x6aa7[_0x3c2a5f];return _0x83115d;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x76aa('0x1')]},'joinAt':{'type':Sequelize[_0x76aa('0x2')]},'leaveAt':{'type':Sequelize[_0x76aa('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x76aa('0x2')]},'reason':{'type':Sequelize[_0x76aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 843a6ab..d08ff47 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 _0x6455=['params','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x4f5b68,_0x3c50f3){var _0x4ad265=function(_0x4d83f6){while(--_0x4d83f6){_0x4f5b68['push'](_0x4f5b68['shift']());}};_0x4ad265(++_0x3c50f3);}(_0x6455,0x97));var _0x5645=function(_0x423f08,_0x5e38f2){_0x423f08=_0x423f08-0x0;var _0x39268=_0x6455[_0x423f08];return _0x39268;};'use strict';var pdf=require(_0x5645('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5645('0x1'));var zipdir=require(_0x5645('0x2'));var jsonpatch=require(_0x5645('0x3'));var rp=require(_0x5645('0x4'));var moment=require(_0x5645('0x5'));var BPromise=require(_0x5645('0x6'));var Mustache=require('mustache');var util=require(_0x5645('0x7'));var path=require(_0x5645('0x8'));var sox=require(_0x5645('0x9'));var csv=require(_0x5645('0xa'));var ejs=require(_0x5645('0xb'));var fs=require('fs');var _=require(_0x5645('0xc'));var squel=require(_0x5645('0xd'));var crypto=require(_0x5645('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5645('0xa'));var querystring=require(_0x5645('0xf'));var Papa=require(_0x5645('0x10'));var Redis=require(_0x5645('0x11'));var authService=require(_0x5645('0x12'));var qs=require(_0x5645('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5645('0x14'));var logger=require(_0x5645('0x15'))(_0x5645('0x16'));var utils=require(_0x5645('0x17'));var config=require('../../config/environment');var db=require(_0x5645('0x18'))['db'];function respondWithStatusCode(_0x5ecb2a,_0x42f5cd){_0x42f5cd=_0x42f5cd||0xcc;return function(_0x4014c5){if(_0x4014c5){return _0x5ecb2a[_0x5645('0x19')](_0x42f5cd);}return _0x5ecb2a[_0x5645('0x1a')](_0x42f5cd)[_0x5645('0x1b')]();};}function respondWithResult(_0x199a88,_0x45cbe8){_0x45cbe8=_0x45cbe8||0xc8;return function(_0x2270a1){if(_0x2270a1){return _0x199a88['status'](_0x45cbe8)[_0x5645('0x1c')](_0x2270a1);}};}function respondWithFilteredResult(_0x3e0ec6,_0x25863f){return function(_0x4cbd46){if(_0x4cbd46){var _0x4b3be6=_0x4cbd46[_0x5645('0x1d')],_0x439b55=_0x25863f[_0x5645('0x1e')],_0x361cfd=_0x25863f[_0x5645('0x1e')]+_0x25863f['limit'],_0x511aed;if(_0x361cfd>=_0x4b3be6){_0x361cfd=_0x4b3be6;_0x511aed=0xc8;}else{_0x511aed=0xce;}_0x3e0ec6[_0x5645('0x1a')](_0x511aed);return _0x3e0ec6[_0x5645('0x1f')](_0x5645('0x20'),_0x439b55+'-'+_0x361cfd+'/'+_0x4b3be6)[_0x5645('0x1c')](_0x4cbd46);}return null;};}function patchUpdates(_0x5ac9ee){return function(_0x1853a7){try{jsonpatch['apply'](_0x1853a7,_0x5ac9ee,!![]);}catch(_0x557ad2){return BPromise[_0x5645('0x21')](_0x557ad2);}return _0x1853a7[_0x5645('0x22')]();};}function saveUpdates(_0x2e3350,_0x59a491){return function(_0x35a672){if(_0x35a672){return _0x35a672['update'](_0x2e3350)[_0x5645('0x23')](function(_0x5f186f){return _0x5f186f;});}return null;};}function removeEntity(_0x4f82d0,_0x1ee2fb){return function(_0x53d763){if(_0x53d763){return _0x53d763[_0x5645('0x24')]()[_0x5645('0x23')](function(){_0x4f82d0['status'](0xcc)[_0x5645('0x1b')]();});}};}function handleEntityNotFound(_0x116bfc,_0xe83ed7){return function(_0x50fa82){if(!_0x50fa82){_0x116bfc[_0x5645('0x19')](0x194);}return _0x50fa82;};}function handleError(_0xc38038,_0x3f6929){_0x3f6929=_0x3f6929||0x1f4;return function(_0x46b33a){logger['error'](_0x46b33a['stack']);if(_0x46b33a['name']){delete _0x46b33a['name'];}_0xc38038[_0x5645('0x1a')](_0x3f6929)['send'](_0x46b33a);};}exports['index']=function(_0xfbe837,_0x12f43a){var _0x357388={},_0x308991={},_0x3a5c61={'count':0x0,'rows':[]};var _0x351cbb=_[_0x5645('0x25')](db[_0x5645('0x26')][_0x5645('0x27')],function(_0x30a5d0){return{'name':_0x30a5d0[_0x5645('0x28')],'type':_0x30a5d0[_0x5645('0x29')][_0x5645('0x2a')]};});_0x308991[_0x5645('0x2b')]=_['map'](_0x351cbb,_0x5645('0x2c'));_0x308991['query']=_[_0x5645('0x2d')](_0xfbe837[_0x5645('0x2e')]);_0x308991[_0x5645('0x2f')]=_[_0x5645('0x30')](_0x308991[_0x5645('0x2b')],_0x308991[_0x5645('0x2e')]);_0x357388['attributes']=_['intersection'](_0x308991[_0x5645('0x2b')],qs[_0x5645('0x31')](_0xfbe837[_0x5645('0x2e')][_0x5645('0x31')]));_0x357388[_0x5645('0x32')]=_0x357388[_0x5645('0x32')][_0x5645('0x33')]?_0x357388[_0x5645('0x32')]:_0x308991[_0x5645('0x2b')];if(!_0xfbe837[_0x5645('0x2e')][_0x5645('0x34')]('nolimit')){_0x357388['limit']=qs[_0x5645('0x35')](_0xfbe837['query'][_0x5645('0x35')]);_0x357388['offset']=qs[_0x5645('0x1e')](_0xfbe837['query'][_0x5645('0x1e')]);}_0x357388[_0x5645('0x36')]=qs[_0x5645('0x37')](_0xfbe837[_0x5645('0x2e')][_0x5645('0x37')]);_0x357388[_0x5645('0x38')]=qs['filters'](_[_0x5645('0x39')](_0xfbe837[_0x5645('0x2e')],_0x308991[_0x5645('0x2f')]),_0x351cbb);if(_0xfbe837[_0x5645('0x2e')][_0x5645('0x3a')]){_0x357388[_0x5645('0x38')]=_[_0x5645('0x3b')](_0x357388[_0x5645('0x38')],{'$or':_['map'](_0x351cbb,function(_0x178f6b){if(_0x178f6b['type']!==_0x5645('0x3c')){var _0x2aaf8f={};_0x2aaf8f[_0x178f6b[_0x5645('0x2c')]]={'$like':'%'+_0xfbe837[_0x5645('0x2e')][_0x5645('0x3a')]+'%'};return _0x2aaf8f;}})});}_0x357388=_['merge']({},_0x357388,_0xfbe837[_0x5645('0x3d')]);var _0x188565={'where':_0x357388[_0x5645('0x38')]};return db[_0x5645('0x26')][_0x5645('0x1d')](_0x188565)[_0x5645('0x23')](function(_0x18faea){_0x3a5c61[_0x5645('0x1d')]=_0x18faea;if(_0xfbe837[_0x5645('0x2e')][_0x5645('0x3e')]){_0x357388[_0x5645('0x3f')]=[{'all':!![]}];}return db[_0x5645('0x26')][_0x5645('0x40')](_0x357388);})[_0x5645('0x23')](function(_0x2e4246){_0x3a5c61[_0x5645('0x41')]=_0x2e4246;return _0x3a5c61;})['then'](respondWithFilteredResult(_0x12f43a,_0x357388))[_0x5645('0x42')](handleError(_0x12f43a,null));};exports[_0x5645('0x43')]=function(_0x488a72,_0xe1a1d5){var _0x3b835f={'raw':!![],'where':{'id':_0x488a72[_0x5645('0x44')]['id']}},_0x5e841a={};_0x5e841a[_0x5645('0x2b')]=_[_0x5645('0x2d')](db[_0x5645('0x26')][_0x5645('0x27')]);_0x5e841a[_0x5645('0x2e')]=_[_0x5645('0x2d')](_0x488a72['query']);_0x5e841a['filters']=_[_0x5645('0x30')](_0x5e841a[_0x5645('0x2b')],_0x5e841a[_0x5645('0x2e')]);_0x3b835f[_0x5645('0x32')]=_[_0x5645('0x30')](_0x5e841a[_0x5645('0x2b')],qs[_0x5645('0x31')](_0x488a72[_0x5645('0x2e')][_0x5645('0x31')]));_0x3b835f[_0x5645('0x32')]=_0x3b835f[_0x5645('0x32')][_0x5645('0x33')]?_0x3b835f[_0x5645('0x32')]:_0x5e841a[_0x5645('0x2b')];if(_0x488a72[_0x5645('0x2e')][_0x5645('0x3e')]){_0x3b835f[_0x5645('0x3f')]=[{'all':!![]}];}_0x3b835f=_['merge']({},_0x3b835f,_0x488a72['options']);return db['WhatsappQueueReport']['find'](_0x3b835f)[_0x5645('0x23')](handleEntityNotFound(_0xe1a1d5,null))[_0x5645('0x23')](respondWithResult(_0xe1a1d5,null))[_0x5645('0x42')](handleError(_0xe1a1d5,null));};exports[_0x5645('0x45')]=function(_0x12ca73,_0x5b9b00){return db[_0x5645('0x26')][_0x5645('0x45')](_0x12ca73[_0x5645('0x46')],{})[_0x5645('0x23')](respondWithResult(_0x5b9b00,0xc9))[_0x5645('0x42')](handleError(_0x5b9b00,null));};exports['update']=function(_0x1160f6,_0x18f49b){if(_0x1160f6[_0x5645('0x46')]['id']){delete _0x1160f6[_0x5645('0x46')]['id'];}return db[_0x5645('0x26')][_0x5645('0x47')]({'where':{'id':_0x1160f6[_0x5645('0x44')]['id']}})[_0x5645('0x23')](handleEntityNotFound(_0x18f49b,null))['then'](saveUpdates(_0x1160f6['body'],null))[_0x5645('0x23')](respondWithResult(_0x18f49b,null))[_0x5645('0x42')](handleError(_0x18f49b,null));};exports['destroy']=function(_0x4bf0e6,_0x467de4){return db['WhatsappQueueReport'][_0x5645('0x47')]({'where':{'id':_0x4bf0e6[_0x5645('0x44')]['id']}})[_0x5645('0x23')](handleEntityNotFound(_0x467de4,null))[_0x5645('0x23')](removeEntity(_0x467de4,null))[_0x5645('0x42')](handleError(_0x467de4,null));};exports['describe']=function(_0x2f4ab4,_0x513552){return db['WhatsappQueueReport'][_0x5645('0x48')]()[_0x5645('0x23')](respondWithResult(_0x513552,null))[_0x5645('0x42')](handleError(_0x513552,null));}; \ No newline at end of file +var _0x38b8=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','stack','name','send','index','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','mustache','util','to-csv','ejs','squel','crypto','querystring'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x838b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x838b('0x1'));var zipdir=require(_0x838b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x838b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x838b('0x4'));var util=require(_0x838b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x838b('0x6'));var ejs=require(_0x838b('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x838b('0x8'));var crypto=require(_0x838b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x838b('0x6'));var querystring=require(_0x838b('0xa'));var Papa=require(_0x838b('0xb'));var Redis=require('ioredis');var authService=require(_0x838b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x838b('0xd'));var hardwareService=require(_0x838b('0xe'));var logger=require(_0x838b('0xf'))(_0x838b('0x10'));var utils=require(_0x838b('0x11'));var config=require(_0x838b('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a57cf,_0x281764){_0x281764=_0x281764||0xcc;return function(_0x13fe8a){if(_0x13fe8a){return _0x3a57cf[_0x838b('0x13')](_0x281764);}return _0x3a57cf[_0x838b('0x14')](_0x281764)[_0x838b('0x15')]();};}function respondWithResult(_0xba19e4,_0x3324de){_0x3324de=_0x3324de||0xc8;return function(_0x1ddf43){if(_0x1ddf43){return _0xba19e4['status'](_0x3324de)[_0x838b('0x16')](_0x1ddf43);}};}function respondWithFilteredResult(_0x5497fd,_0x4e1085){return function(_0x584b04){if(_0x584b04){var _0x450b9b=_0x584b04[_0x838b('0x17')],_0x1da340=_0x4e1085['offset'],_0x100ee2=_0x4e1085[_0x838b('0x18')]+_0x4e1085[_0x838b('0x19')],_0x200652;if(_0x100ee2>=_0x450b9b){_0x100ee2=_0x450b9b;_0x200652=0xc8;}else{_0x200652=0xce;}_0x5497fd[_0x838b('0x14')](_0x200652);return _0x5497fd[_0x838b('0x1a')]('Content-Range',_0x1da340+'-'+_0x100ee2+'/'+_0x450b9b)[_0x838b('0x16')](_0x584b04);}return null;};}function patchUpdates(_0x2e606b){return function(_0x49f209){try{jsonpatch[_0x838b('0x1b')](_0x49f209,_0x2e606b,!![]);}catch(_0x46eedc){return BPromise['reject'](_0x46eedc);}return _0x49f209[_0x838b('0x1c')]();};}function saveUpdates(_0x268437,_0x432a75){return function(_0x4deb91){if(_0x4deb91){return _0x4deb91[_0x838b('0x1d')](_0x268437)[_0x838b('0x1e')](function(_0x119e4e){return _0x119e4e;});}return null;};}function removeEntity(_0x1a5241,_0x371082){return function(_0x3f8848){if(_0x3f8848){return _0x3f8848[_0x838b('0x1f')]()[_0x838b('0x1e')](function(){_0x1a5241[_0x838b('0x14')](0xcc)[_0x838b('0x15')]();});}};}function handleEntityNotFound(_0x2eecf9,_0xba76){return function(_0x451089){if(!_0x451089){_0x2eecf9[_0x838b('0x13')](0x194);}return _0x451089;};}function handleError(_0x485990,_0xb9b05f){_0xb9b05f=_0xb9b05f||0x1f4;return function(_0x59be76){logger['error'](_0x59be76[_0x838b('0x20')]);if(_0x59be76[_0x838b('0x21')]){delete _0x59be76[_0x838b('0x21')];}_0x485990['status'](_0xb9b05f)[_0x838b('0x22')](_0x59be76);};}exports[_0x838b('0x23')]=function(_0x47d239,_0x19fc7b){var _0x322e3f={},_0x59fa16={},_0x576bfa={'count':0x0,'rows':[]};var _0x58e739=_['map'](db['WhatsappQueueReport']['rawAttributes'],function(_0x1e74a6){return{'name':_0x1e74a6[_0x838b('0x24')],'type':_0x1e74a6['type']['key']};});_0x59fa16[_0x838b('0x25')]=_[_0x838b('0x26')](_0x58e739,_0x838b('0x21'));_0x59fa16[_0x838b('0x27')]=_[_0x838b('0x28')](_0x47d239[_0x838b('0x27')]);_0x59fa16[_0x838b('0x29')]=_[_0x838b('0x2a')](_0x59fa16[_0x838b('0x25')],_0x59fa16['query']);_0x322e3f[_0x838b('0x2b')]=_[_0x838b('0x2a')](_0x59fa16[_0x838b('0x25')],qs[_0x838b('0x2c')](_0x47d239['query'][_0x838b('0x2c')]));_0x322e3f[_0x838b('0x2b')]=_0x322e3f[_0x838b('0x2b')][_0x838b('0x2d')]?_0x322e3f[_0x838b('0x2b')]:_0x59fa16['model'];if(!_0x47d239[_0x838b('0x27')][_0x838b('0x2e')](_0x838b('0x2f'))){_0x322e3f[_0x838b('0x19')]=qs['limit'](_0x47d239[_0x838b('0x27')][_0x838b('0x19')]);_0x322e3f['offset']=qs[_0x838b('0x18')](_0x47d239[_0x838b('0x27')][_0x838b('0x18')]);}_0x322e3f[_0x838b('0x30')]=qs[_0x838b('0x31')](_0x47d239['query'][_0x838b('0x31')]);_0x322e3f[_0x838b('0x32')]=qs['filters'](_[_0x838b('0x33')](_0x47d239['query'],_0x59fa16[_0x838b('0x29')]),_0x58e739);if(_0x47d239['query'][_0x838b('0x34')]){_0x322e3f['where']=_[_0x838b('0x35')](_0x322e3f[_0x838b('0x32')],{'$or':_[_0x838b('0x26')](_0x58e739,function(_0x47460d){if(_0x47460d[_0x838b('0x36')]!==_0x838b('0x37')){var _0x5f62f={};_0x5f62f[_0x47460d[_0x838b('0x21')]]={'$like':'%'+_0x47d239[_0x838b('0x27')][_0x838b('0x34')]+'%'};return _0x5f62f;}})});}_0x322e3f=_['merge']({},_0x322e3f,_0x47d239[_0x838b('0x38')]);var _0x5e71d5={'where':_0x322e3f[_0x838b('0x32')]};return db[_0x838b('0x39')][_0x838b('0x17')](_0x5e71d5)[_0x838b('0x1e')](function(_0xaaa45c){_0x576bfa[_0x838b('0x17')]=_0xaaa45c;if(_0x47d239[_0x838b('0x27')][_0x838b('0x3a')]){_0x322e3f['include']=[{'all':!![]}];}return db[_0x838b('0x39')][_0x838b('0x3b')](_0x322e3f);})[_0x838b('0x1e')](function(_0x16787d){_0x576bfa[_0x838b('0x3c')]=_0x16787d;return _0x576bfa;})[_0x838b('0x1e')](respondWithFilteredResult(_0x19fc7b,_0x322e3f))['catch'](handleError(_0x19fc7b,null));};exports[_0x838b('0x3d')]=function(_0x5afe8b,_0x426ab3){var _0x3e67de={'raw':!![],'where':{'id':_0x5afe8b[_0x838b('0x3e')]['id']}},_0x5639c9={};_0x5639c9[_0x838b('0x25')]=_[_0x838b('0x28')](db[_0x838b('0x39')]['rawAttributes']);_0x5639c9['query']=_[_0x838b('0x28')](_0x5afe8b[_0x838b('0x27')]);_0x5639c9['filters']=_[_0x838b('0x2a')](_0x5639c9['model'],_0x5639c9[_0x838b('0x27')]);_0x3e67de[_0x838b('0x2b')]=_[_0x838b('0x2a')](_0x5639c9[_0x838b('0x25')],qs[_0x838b('0x2c')](_0x5afe8b['query'][_0x838b('0x2c')]));_0x3e67de['attributes']=_0x3e67de[_0x838b('0x2b')]['length']?_0x3e67de[_0x838b('0x2b')]:_0x5639c9[_0x838b('0x25')];if(_0x5afe8b['query'][_0x838b('0x3a')]){_0x3e67de[_0x838b('0x3f')]=[{'all':!![]}];}_0x3e67de=_['merge']({},_0x3e67de,_0x5afe8b[_0x838b('0x38')]);return db['WhatsappQueueReport'][_0x838b('0x40')](_0x3e67de)[_0x838b('0x1e')](handleEntityNotFound(_0x426ab3,null))['then'](respondWithResult(_0x426ab3,null))[_0x838b('0x41')](handleError(_0x426ab3,null));};exports['create']=function(_0x4d7336,_0x55f812){return db['WhatsappQueueReport'][_0x838b('0x42')](_0x4d7336[_0x838b('0x43')],{})[_0x838b('0x1e')](respondWithResult(_0x55f812,0xc9))[_0x838b('0x41')](handleError(_0x55f812,null));};exports[_0x838b('0x1d')]=function(_0x1aaeb2,_0x5ebde7){if(_0x1aaeb2[_0x838b('0x43')]['id']){delete _0x1aaeb2['body']['id'];}return db[_0x838b('0x39')]['find']({'where':{'id':_0x1aaeb2[_0x838b('0x3e')]['id']}})[_0x838b('0x1e')](handleEntityNotFound(_0x5ebde7,null))[_0x838b('0x1e')](saveUpdates(_0x1aaeb2[_0x838b('0x43')],null))[_0x838b('0x1e')](respondWithResult(_0x5ebde7,null))['catch'](handleError(_0x5ebde7,null));};exports['destroy']=function(_0x3226a7,_0x3aa739){return db['WhatsappQueueReport']['find']({'where':{'id':_0x3226a7[_0x838b('0x3e')]['id']}})[_0x838b('0x1e')](handleEntityNotFound(_0x3aa739,null))[_0x838b('0x1e')](removeEntity(_0x3aa739,null))[_0x838b('0x41')](handleError(_0x3aa739,null));};exports[_0x838b('0x44')]=function(_0x1a370e,_0xbef833){return db[_0x838b('0x39')][_0x838b('0x44')]()[_0x838b('0x1e')](respondWithResult(_0xbef833,null))['catch'](handleError(_0xbef833,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e1c5f14..ce6c65a 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 _0x51d8=['./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x51d8,0x6f));var _0x851d=function(_0x380c72,_0xfd3a8b){_0x380c72=_0x380c72-0x0;var _0x45daf3=_0x51d8[_0x380c72];return _0x45daf3;};'use strict';var _=require(_0x851d('0x0'));var util=require(_0x851d('0x1'));var logger=require(_0x851d('0x2'))(_0x851d('0x3'));var moment=require(_0x851d('0x4'));var BPromise=require('bluebird');var rp=require(_0x851d('0x5'));var fs=require('fs');var path=require(_0x851d('0x6'));var rimraf=require(_0x851d('0x7'));var config=require(_0x851d('0x8'));var attributes=require(_0x851d('0x9'));module[_0x851d('0xa')]=function(_0x55a265,_0x5763ef){return _0x55a265[_0x851d('0xb')](_0x851d('0xc'),attributes,{'tableName':_0x851d('0xd'),'paranoid':![],'indexes':[{'name':_0x851d('0xe'),'fields':[_0x851d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5100=['../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappQueueReport.attributes','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x142bba,_0xfc048e){var _0x10b720=function(_0x595c9d){while(--_0x595c9d){_0x142bba['push'](_0x142bba['shift']());}};_0x10b720(++_0xfc048e);}(_0x5100,0x132));var _0x0510=function(_0x240e0e,_0x55957d){_0x240e0e=_0x240e0e-0x0;var _0x25944d=_0x5100[_0x240e0e];return _0x25944d;};'use strict';var _=require(_0x0510('0x0'));var util=require(_0x0510('0x1'));var logger=require(_0x0510('0x2'))(_0x0510('0x3'));var moment=require(_0x0510('0x4'));var BPromise=require(_0x0510('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0510('0x6'));var rimraf=require('rimraf');var config=require(_0x0510('0x7'));var attributes=require(_0x0510('0x8'));module['exports']=function(_0x314bfe,_0x187274){return _0x314bfe['define']('WhatsappQueueReport',attributes,{'tableName':_0x0510('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0510('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 0a61585..be35978 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 _0x12a1=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','where','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x12a1,0xb3));var _0x112a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x12a1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x112a('0x0'));var util=require(_0x112a('0x1'));var moment=require(_0x112a('0x2'));var BPromise=require(_0x112a('0x3'));var rs=require(_0x112a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x112a('0x5'));var logger=require(_0x112a('0x6'))(_0x112a('0x7'));var config=require('../../config/environment');var jayson=require(_0x112a('0x8'));var client=jayson[_0x112a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46773d,_0x420bf2,_0x15637d){return new BPromise(function(_0x3d6162,_0x78ffdc){return client[_0x112a('0xa')](_0x46773d,_0x15637d)[_0x112a('0xb')](function(_0x3e5240){logger[_0x112a('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x420bf2,'request\x20sent');logger[_0x112a('0xd')](_0x112a('0xe'),_0x420bf2,_0x112a('0xf'),JSON[_0x112a('0x10')](_0x3e5240));if(_0x3e5240[_0x112a('0x11')]){if(_0x3e5240[_0x112a('0x11')][_0x112a('0x12')]===0x1f4){logger['error'](_0x112a('0x13'),_0x420bf2,_0x3e5240['error'][_0x112a('0x14')]);return _0x78ffdc(_0x3e5240[_0x112a('0x11')][_0x112a('0x14')]);}logger[_0x112a('0x11')](_0x112a('0x13'),_0x420bf2,_0x3e5240['error'][_0x112a('0x14')]);return _0x3d6162(_0x3e5240['error'][_0x112a('0x14')]);}else{logger[_0x112a('0xc')](_0x112a('0x13'),_0x420bf2,_0x112a('0xf'));_0x3d6162(_0x3e5240[_0x112a('0x15')]['message']);}})[_0x112a('0x16')](function(_0x945858){logger['error'](_0x112a('0x13'),_0x420bf2,_0x945858);_0x78ffdc(_0x945858);});});}exports[_0x112a('0x17')]=function(_0x1ee702){var _0x31b0c2=this;return new Promise(function(_0x448dbb,_0xa60ff9){return db['WhatsappQueueReport'][_0x112a('0x18')](_0x1ee702[_0x112a('0x19')],{'raw':_0x1ee702[_0x112a('0x1a')]?_0x1ee702[_0x112a('0x1a')][_0x112a('0x1b')]===undefined?!![]:![]:!![]})[_0x112a('0xb')](function(_0x47c225){logger[_0x112a('0xc')](_0x112a('0x17'),_0x1ee702);logger[_0x112a('0xd')](_0x112a('0x17'),_0x1ee702,JSON['stringify'](_0x47c225));_0x448dbb(_0x47c225);})['catch'](function(_0x2d9c78){logger['error'](_0x112a('0x17'),_0x2d9c78['message'],_0x1ee702);_0xa60ff9(_0x31b0c2[_0x112a('0x11')](0x1f4,_0x2d9c78[_0x112a('0x14')]));});});};exports[_0x112a('0x1c')]=function(_0x286e8d){var _0x1cbe44=this;return new Promise(function(_0x4a496c,_0x190c48){return db[_0x112a('0x1d')]['update'](_0x286e8d[_0x112a('0x19')],{'raw':_0x286e8d[_0x112a('0x1a')]?_0x286e8d[_0x112a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x286e8d[_0x112a('0x1a')]?_0x286e8d['options'][_0x112a('0x1e')]||null:null,'attributes':_0x286e8d['options']?_0x286e8d[_0x112a('0x1a')]['attributes']||null:null,'limit':_0x286e8d[_0x112a('0x1a')]?_0x286e8d[_0x112a('0x1a')][_0x112a('0x1f')]||null:null})['then'](function(_0x57a158){logger[_0x112a('0xc')](_0x112a('0x1c'),_0x286e8d);logger[_0x112a('0xd')](_0x112a('0x1c'),_0x286e8d,JSON[_0x112a('0x10')](_0x57a158));_0x4a496c(_0x57a158);})[_0x112a('0x16')](function(_0x168614){logger['error'](_0x112a('0x1c'),_0x168614[_0x112a('0x14')],_0x286e8d);_0x190c48(_0x1cbe44[_0x112a('0x11')](0x1f4,_0x168614[_0x112a('0x14')]));});});}; \ No newline at end of file +var _0x9695=['body','options','raw','CreateWhatsappQueueReport','stringify','catch','UpdateWhatsappQueueReport','update','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','WhatsappQueueReport','create'];(function(_0xcb96f6,_0x4b3983){var _0xf2c01c=function(_0x1311d6){while(--_0x1311d6){_0xcb96f6['push'](_0xcb96f6['shift']());}};_0xf2c01c(++_0x4b3983);}(_0x9695,0x17f));var _0x5969=function(_0x58d5a9,_0x1d6a52){_0x58d5a9=_0x58d5a9-0x0;var _0x4f25f5=_0x9695[_0x58d5a9];return _0x4f25f5;};'use strict';var _=require('lodash');var util=require(_0x5969('0x0'));var moment=require(_0x5969('0x1'));var BPromise=require('bluebird');var rs=require(_0x5969('0x2'));var fs=require('fs');var Redis=require(_0x5969('0x3'));var db=require(_0x5969('0x4'))['db'];var utils=require(_0x5969('0x5'));var logger=require(_0x5969('0x6'))('rpc');var config=require(_0x5969('0x7'));var jayson=require(_0x5969('0x8'));var client=jayson['client'][_0x5969('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbda141,_0x51f9b9,_0x3568fc){return new BPromise(function(_0x49ea7e,_0xcbb888){return client['request'](_0xbda141,_0x3568fc)[_0x5969('0xa')](function(_0x3d7dfa){logger[_0x5969('0xb')](_0x5969('0xc'),_0x51f9b9,_0x5969('0xd'));logger[_0x5969('0xe')](_0x5969('0xf'),_0x51f9b9,'request\x20sent',JSON['stringify'](_0x3d7dfa));if(_0x3d7dfa[_0x5969('0x10')]){if(_0x3d7dfa[_0x5969('0x10')]['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x51f9b9,_0x3d7dfa[_0x5969('0x10')][_0x5969('0x11')]);return _0xcbb888(_0x3d7dfa[_0x5969('0x10')][_0x5969('0x11')]);}logger[_0x5969('0x10')](_0x5969('0xc'),_0x51f9b9,_0x3d7dfa['error'][_0x5969('0x11')]);return _0x49ea7e(_0x3d7dfa['error']['message']);}else{logger[_0x5969('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x51f9b9,'request\x20sent');_0x49ea7e(_0x3d7dfa['result']['message']);}})['catch'](function(_0x24394b){logger['error'](_0x5969('0xc'),_0x51f9b9,_0x24394b);_0xcbb888(_0x24394b);});});}exports['CreateWhatsappQueueReport']=function(_0x18257c){var _0x1e16f2=this;return new Promise(function(_0x1e9962,_0x39c441){return db[_0x5969('0x12')][_0x5969('0x13')](_0x18257c[_0x5969('0x14')],{'raw':_0x18257c[_0x5969('0x15')]?_0x18257c['options'][_0x5969('0x16')]===undefined?!![]:![]:!![]})[_0x5969('0xa')](function(_0x4acaf3){logger[_0x5969('0xb')](_0x5969('0x17'),_0x18257c);logger[_0x5969('0xe')](_0x5969('0x17'),_0x18257c,JSON[_0x5969('0x18')](_0x4acaf3));_0x1e9962(_0x4acaf3);})[_0x5969('0x19')](function(_0x5acd92){logger['error'](_0x5969('0x17'),_0x5acd92[_0x5969('0x11')],_0x18257c);_0x39c441(_0x1e16f2[_0x5969('0x10')](0x1f4,_0x5acd92[_0x5969('0x11')]));});});};exports[_0x5969('0x1a')]=function(_0x1b4511){var _0x21c35c=this;return new Promise(function(_0x2e07c4,_0x37328d){return db[_0x5969('0x12')][_0x5969('0x1b')](_0x1b4511[_0x5969('0x14')],{'raw':_0x1b4511[_0x5969('0x15')]?_0x1b4511['options'][_0x5969('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b4511[_0x5969('0x15')]?_0x1b4511[_0x5969('0x15')][_0x5969('0x1c')]||null:null,'attributes':_0x1b4511[_0x5969('0x15')]?_0x1b4511['options'][_0x5969('0x1d')]||null:null,'limit':_0x1b4511[_0x5969('0x15')]?_0x1b4511[_0x5969('0x15')][_0x5969('0x1e')]||null:null})[_0x5969('0xa')](function(_0x336e72){logger[_0x5969('0xb')](_0x5969('0x1a'),_0x1b4511);logger[_0x5969('0xe')]('UpdateWhatsappQueueReport',_0x1b4511,JSON['stringify'](_0x336e72));_0x2e07c4(_0x336e72);})[_0x5969('0x19')](function(_0x341bba){logger['error']('UpdateWhatsappQueueReport',_0x341bba['message'],_0x1b4511);_0x37328d(_0x21c35c[_0x5969('0x10')](0x1f4,_0x341bba[_0x5969('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 77a1146..909524c 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 _0x6c33=['connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x21b95c,_0x35c39e){var _0x1ede2f=function(_0x40be0a){while(--_0x40be0a){_0x21b95c['push'](_0x21b95c['shift']());}};_0x1ede2f(++_0x35c39e);}(_0x6c33,0x82));var _0x36c3=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x6c33[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x36c3('0x0'));var util=require(_0x36c3('0x1'));var path=require(_0x36c3('0x2'));var timeout=require(_0x36c3('0x3'));var express=require(_0x36c3('0x4'));var router=express['Router']();var auth=require(_0x36c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x36c3('0x6'));var controller=require(_0x36c3('0x7'));router[_0x36c3('0x8')]('/',auth[_0x36c3('0x9')](),controller[_0x36c3('0xa')]);router[_0x36c3('0x8')](_0x36c3('0xb'),auth[_0x36c3('0x9')](),controller['describe']);router[_0x36c3('0x8')](_0x36c3('0xc'),auth[_0x36c3('0x9')](),controller[_0x36c3('0xd')]);router[_0x36c3('0xe')]('/',auth[_0x36c3('0x9')](),controller[_0x36c3('0xf')]);router[_0x36c3('0x10')](_0x36c3('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x36c3('0xc'),auth['isAuthenticated'](),controller[_0x36c3('0x11')]);module[_0x36c3('0x12')]=router; \ No newline at end of file +var _0xfc73=['util','path','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','multer'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0xfc73,0xff));var _0x3fc7=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xfc73[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var path=require(_0x3fc7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3fc7('0x3'));var config=require(_0x3fc7('0x4'));var controller=require(_0x3fc7('0x5'));router['get']('/',auth[_0x3fc7('0x6')](),controller[_0x3fc7('0x7')]);router['get'](_0x3fc7('0x8'),auth[_0x3fc7('0x6')](),controller[_0x3fc7('0x9')]);router['get'](_0x3fc7('0xa'),auth['isAuthenticated'](),controller[_0x3fc7('0xb')]);router[_0x3fc7('0xc')]('/',auth[_0x3fc7('0x6')](),controller['create']);router[_0x3fc7('0xd')](_0x3fc7('0xa'),auth[_0x3fc7('0x6')](),controller[_0x3fc7('0xe')]);router[_0x3fc7('0xf')]('/:id',auth[_0x3fc7('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a582512..382b977 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['queue','DATE','exports','STRING'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x757a,0xde));var _0xa757=function(_0x170b3e,_0x2bc885){_0x170b3e=_0x170b3e-0x0;var _0x25887a=_0x757a[_0x170b3e];return _0x25887a;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x5f66,0x1a0));var _0x65f6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5f66[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 0ddba86..3c4b3e1 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 _0xf928=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','catch','show','params','keys','includeAll','include','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','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','save','then','destroy','end','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','model','query','filters','intersection','fields'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xf928,0xb1));var _0x8f92=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf928[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8f92('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f92('0x1'));var jsonpatch=require(_0x8f92('0x2'));var rp=require(_0x8f92('0x3'));var moment=require(_0x8f92('0x4'));var BPromise=require(_0x8f92('0x5'));var Mustache=require(_0x8f92('0x6'));var util=require(_0x8f92('0x7'));var path=require(_0x8f92('0x8'));var sox=require(_0x8f92('0x9'));var csv=require(_0x8f92('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8f92('0xb'));var squel=require(_0x8f92('0xc'));var crypto=require(_0x8f92('0xd'));var jsforce=require(_0x8f92('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8f92('0xa'));var querystring=require(_0x8f92('0xf'));var Papa=require(_0x8f92('0x10'));var Redis=require(_0x8f92('0x11'));var authService=require(_0x8f92('0x12'));var qs=require(_0x8f92('0x13'));var as=require(_0x8f92('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f92('0x15'))(_0x8f92('0x16'));var utils=require(_0x8f92('0x17'));var config=require(_0x8f92('0x18'));var db=require(_0x8f92('0x19'))['db'];function respondWithStatusCode(_0x964923,_0x279c56){_0x279c56=_0x279c56||0xcc;return function(_0x4646ef){if(_0x4646ef){return _0x964923[_0x8f92('0x1a')](_0x279c56);}return _0x964923[_0x8f92('0x1b')](_0x279c56)['end']();};}function respondWithResult(_0x2a0ecb,_0x30f26c){_0x30f26c=_0x30f26c||0xc8;return function(_0xfcf88c){if(_0xfcf88c){return _0x2a0ecb[_0x8f92('0x1b')](_0x30f26c)[_0x8f92('0x1c')](_0xfcf88c);}};}function respondWithFilteredResult(_0x354cf5,_0x22bc67){return function(_0x428d1d){if(_0x428d1d){var _0xd4fb03=_0x428d1d[_0x8f92('0x1d')],_0x560ab0=_0x22bc67[_0x8f92('0x1e')],_0x4ddea1=_0x22bc67[_0x8f92('0x1e')]+_0x22bc67[_0x8f92('0x1f')],_0x4903db;if(_0x4ddea1>=_0xd4fb03){_0x4ddea1=_0xd4fb03;_0x4903db=0xc8;}else{_0x4903db=0xce;}_0x354cf5[_0x8f92('0x1b')](_0x4903db);return _0x354cf5['set'](_0x8f92('0x20'),_0x560ab0+'-'+_0x4ddea1+'/'+_0xd4fb03)[_0x8f92('0x1c')](_0x428d1d);}return null;};}function patchUpdates(_0x3dd6a4){return function(_0x2dbe6e){try{jsonpatch[_0x8f92('0x21')](_0x2dbe6e,_0x3dd6a4,!![]);}catch(_0xa6bd6c){return BPromise['reject'](_0xa6bd6c);}return _0x2dbe6e[_0x8f92('0x22')]();};}function saveUpdates(_0x530d84,_0x32245b){return function(_0xd65a70){if(_0xd65a70){return _0xd65a70['update'](_0x530d84)[_0x8f92('0x23')](function(_0x5835b0){return _0x5835b0;});}return null;};}function removeEntity(_0x24c4a5,_0x552e94){return function(_0xf195e6){if(_0xf195e6){return _0xf195e6[_0x8f92('0x24')]()['then'](function(){_0x24c4a5[_0x8f92('0x1b')](0xcc)[_0x8f92('0x25')]();});}};}function handleEntityNotFound(_0x523c70,_0x10b287){return function(_0x364501){if(!_0x364501){_0x523c70[_0x8f92('0x1a')](0x194);}return _0x364501;};}function handleError(_0x25e086,_0x5356db){_0x5356db=_0x5356db||0x1f4;return function(_0xc2b52f){logger[_0x8f92('0x26')](_0xc2b52f[_0x8f92('0x27')]);if(_0xc2b52f[_0x8f92('0x28')]){delete _0xc2b52f['name'];}_0x25e086[_0x8f92('0x1b')](_0x5356db)['send'](_0xc2b52f);};}exports[_0x8f92('0x29')]=function(_0x218551,_0x44afa9){var _0x137fe5={},_0x447489={},_0x1776dc={'count':0x0,'rows':[]};var _0x6265e5=_[_0x8f92('0x2a')](db[_0x8f92('0x2b')][_0x8f92('0x2c')],function(_0x5315f5){return{'name':_0x5315f5[_0x8f92('0x2d')],'type':_0x5315f5['type']['key']};});_0x447489[_0x8f92('0x2e')]=_['map'](_0x6265e5,_0x8f92('0x28'));_0x447489[_0x8f92('0x2f')]=_['keys'](_0x218551[_0x8f92('0x2f')]);_0x447489[_0x8f92('0x30')]=_[_0x8f92('0x31')](_0x447489['model'],_0x447489[_0x8f92('0x2f')]);_0x137fe5['attributes']=_[_0x8f92('0x31')](_0x447489[_0x8f92('0x2e')],qs[_0x8f92('0x32')](_0x218551[_0x8f92('0x2f')][_0x8f92('0x32')]));_0x137fe5[_0x8f92('0x33')]=_0x137fe5[_0x8f92('0x33')][_0x8f92('0x34')]?_0x137fe5[_0x8f92('0x33')]:_0x447489['model'];if(!_0x218551['query'][_0x8f92('0x35')](_0x8f92('0x36'))){_0x137fe5['limit']=qs[_0x8f92('0x1f')](_0x218551[_0x8f92('0x2f')][_0x8f92('0x1f')]);_0x137fe5[_0x8f92('0x1e')]=qs[_0x8f92('0x1e')](_0x218551[_0x8f92('0x2f')][_0x8f92('0x1e')]);}_0x137fe5[_0x8f92('0x37')]=qs[_0x8f92('0x38')](_0x218551[_0x8f92('0x2f')][_0x8f92('0x38')]);_0x137fe5[_0x8f92('0x39')]=qs[_0x8f92('0x30')](_[_0x8f92('0x3a')](_0x218551['query'],_0x447489[_0x8f92('0x30')]),_0x6265e5);if(_0x218551[_0x8f92('0x2f')]['filter']){_0x137fe5['where']=_[_0x8f92('0x3b')](_0x137fe5['where'],{'$or':_[_0x8f92('0x2a')](_0x6265e5,function(_0x26d0be){if(_0x26d0be[_0x8f92('0x3c')]!==_0x8f92('0x3d')){var _0x17975b={};_0x17975b[_0x26d0be[_0x8f92('0x28')]]={'$like':'%'+_0x218551[_0x8f92('0x2f')][_0x8f92('0x3e')]+'%'};return _0x17975b;}})});}_0x137fe5=_[_0x8f92('0x3b')]({},_0x137fe5,_0x218551[_0x8f92('0x3f')]);var _0x54b484={'where':_0x137fe5[_0x8f92('0x39')]};return db[_0x8f92('0x2b')][_0x8f92('0x1d')](_0x54b484)['then'](function(_0x49111a){_0x1776dc[_0x8f92('0x1d')]=_0x49111a;if(_0x218551['query']['includeAll']){_0x137fe5['include']=[{'all':!![]}];}return db[_0x8f92('0x2b')][_0x8f92('0x40')](_0x137fe5);})[_0x8f92('0x23')](function(_0x89457c){_0x1776dc['rows']=_0x89457c;return _0x1776dc;})[_0x8f92('0x23')](respondWithFilteredResult(_0x44afa9,_0x137fe5))[_0x8f92('0x41')](handleError(_0x44afa9,null));};exports[_0x8f92('0x42')]=function(_0x2d9b27,_0x205039){var _0xc69f5b={'raw':!![],'where':{'id':_0x2d9b27[_0x8f92('0x43')]['id']}},_0x21d08f={};_0x21d08f[_0x8f92('0x2e')]=_[_0x8f92('0x44')](db[_0x8f92('0x2b')][_0x8f92('0x2c')]);_0x21d08f['query']=_[_0x8f92('0x44')](_0x2d9b27[_0x8f92('0x2f')]);_0x21d08f[_0x8f92('0x30')]=_[_0x8f92('0x31')](_0x21d08f[_0x8f92('0x2e')],_0x21d08f['query']);_0xc69f5b[_0x8f92('0x33')]=_[_0x8f92('0x31')](_0x21d08f[_0x8f92('0x2e')],qs[_0x8f92('0x32')](_0x2d9b27[_0x8f92('0x2f')][_0x8f92('0x32')]));_0xc69f5b[_0x8f92('0x33')]=_0xc69f5b[_0x8f92('0x33')][_0x8f92('0x34')]?_0xc69f5b[_0x8f92('0x33')]:_0x21d08f[_0x8f92('0x2e')];if(_0x2d9b27[_0x8f92('0x2f')][_0x8f92('0x45')]){_0xc69f5b[_0x8f92('0x46')]=[{'all':!![]}];}_0xc69f5b=_[_0x8f92('0x3b')]({},_0xc69f5b,_0x2d9b27['options']);return db[_0x8f92('0x2b')]['find'](_0xc69f5b)[_0x8f92('0x23')](handleEntityNotFound(_0x205039,null))[_0x8f92('0x23')](respondWithResult(_0x205039,null))[_0x8f92('0x41')](handleError(_0x205039,null));};exports[_0x8f92('0x47')]=function(_0x13de2b,_0x28053d){return db[_0x8f92('0x2b')][_0x8f92('0x47')](_0x13de2b[_0x8f92('0x48')],{})[_0x8f92('0x23')](respondWithResult(_0x28053d,0xc9))[_0x8f92('0x41')](handleError(_0x28053d,null));};exports[_0x8f92('0x49')]=function(_0x5d900e,_0x123b8b){if(_0x5d900e[_0x8f92('0x48')]['id']){delete _0x5d900e[_0x8f92('0x48')]['id'];}return db['WhatsappTransferReport'][_0x8f92('0x4a')]({'where':{'id':_0x5d900e[_0x8f92('0x43')]['id']}})[_0x8f92('0x23')](handleEntityNotFound(_0x123b8b,null))[_0x8f92('0x23')](saveUpdates(_0x5d900e['body'],null))[_0x8f92('0x23')](respondWithResult(_0x123b8b,null))[_0x8f92('0x41')](handleError(_0x123b8b,null));};exports[_0x8f92('0x24')]=function(_0x4770a5,_0x37e89b){return db['WhatsappTransferReport'][_0x8f92('0x4a')]({'where':{'id':_0x4770a5[_0x8f92('0x43')]['id']}})[_0x8f92('0x23')](handleEntityNotFound(_0x37e89b,null))[_0x8f92('0x23')](removeEntity(_0x37e89b,null))['catch'](handleError(_0x37e89b,null));};exports[_0x8f92('0x4b')]=function(_0x862abb,_0x8a4ddf){return db[_0x8f92('0x2b')][_0x8f92('0x4b')]()[_0x8f92('0x23')](respondWithResult(_0x8a4ddf,null))[_0x8f92('0x41')](handleError(_0x8a4ddf,null));}; \ No newline at end of file +var _0x63f4=['merge','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','options','create','body','find','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x63f4,0x9f));var _0x463f=function(_0x2ad8d7,_0x657aad){_0x2ad8d7=_0x2ad8d7-0x0;var _0x287bd8=_0x63f4[_0x2ad8d7];return _0x287bd8;};'use strict';var pdf=require(_0x463f('0x0'));var emlformat=require(_0x463f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x463f('0x2'));var jsonpatch=require(_0x463f('0x3'));var rp=require(_0x463f('0x4'));var moment=require('moment');var BPromise=require(_0x463f('0x5'));var Mustache=require(_0x463f('0x6'));var util=require('util');var path=require(_0x463f('0x7'));var sox=require(_0x463f('0x8'));var csv=require(_0x463f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x463f('0xa'));var squel=require(_0x463f('0xb'));var crypto=require(_0x463f('0xc'));var jsforce=require(_0x463f('0xd'));var deskjs=require(_0x463f('0xe'));var toCsv=require(_0x463f('0x9'));var querystring=require(_0x463f('0xf'));var Papa=require(_0x463f('0x10'));var Redis=require(_0x463f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x463f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x463f('0x13'));var logger=require(_0x463f('0x14'))(_0x463f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x463f('0x16'))['db'];function respondWithStatusCode(_0x2a7fe7,_0x3c6477){_0x3c6477=_0x3c6477||0xcc;return function(_0x4ced06){if(_0x4ced06){return _0x2a7fe7['sendStatus'](_0x3c6477);}return _0x2a7fe7[_0x463f('0x17')](_0x3c6477)[_0x463f('0x18')]();};}function respondWithResult(_0x4e92b2,_0x3f0526){_0x3f0526=_0x3f0526||0xc8;return function(_0xeb0267){if(_0xeb0267){return _0x4e92b2['status'](_0x3f0526)[_0x463f('0x19')](_0xeb0267);}};}function respondWithFilteredResult(_0x326f73,_0xc376c8){return function(_0x5dd1a0){if(_0x5dd1a0){var _0x3544b6=_0x5dd1a0[_0x463f('0x1a')],_0x25a5fb=_0xc376c8['offset'],_0x6b162f=_0xc376c8[_0x463f('0x1b')]+_0xc376c8[_0x463f('0x1c')],_0x244fea;if(_0x6b162f>=_0x3544b6){_0x6b162f=_0x3544b6;_0x244fea=0xc8;}else{_0x244fea=0xce;}_0x326f73[_0x463f('0x17')](_0x244fea);return _0x326f73[_0x463f('0x1d')]('Content-Range',_0x25a5fb+'-'+_0x6b162f+'/'+_0x3544b6)['json'](_0x5dd1a0);}return null;};}function patchUpdates(_0x3b7c04){return function(_0x1b5c5f){try{jsonpatch[_0x463f('0x1e')](_0x1b5c5f,_0x3b7c04,!![]);}catch(_0x36cce9){return BPromise[_0x463f('0x1f')](_0x36cce9);}return _0x1b5c5f['save']();};}function saveUpdates(_0x37bc27,_0x18b11b){return function(_0x17947f){if(_0x17947f){return _0x17947f[_0x463f('0x20')](_0x37bc27)['then'](function(_0x1566c3){return _0x1566c3;});}return null;};}function removeEntity(_0x195e41,_0x1a24ce){return function(_0x5a9a1f){if(_0x5a9a1f){return _0x5a9a1f[_0x463f('0x21')]()[_0x463f('0x22')](function(){_0x195e41[_0x463f('0x17')](0xcc)[_0x463f('0x18')]();});}};}function handleEntityNotFound(_0x3fd872,_0x5055c3){return function(_0x3d84c4){if(!_0x3d84c4){_0x3fd872[_0x463f('0x23')](0x194);}return _0x3d84c4;};}function handleError(_0x31a85d,_0x4322cd){_0x4322cd=_0x4322cd||0x1f4;return function(_0x4dc5df){logger[_0x463f('0x24')](_0x4dc5df[_0x463f('0x25')]);if(_0x4dc5df[_0x463f('0x26')]){delete _0x4dc5df['name'];}_0x31a85d[_0x463f('0x17')](_0x4322cd)[_0x463f('0x27')](_0x4dc5df);};}exports[_0x463f('0x28')]=function(_0x30815e,_0x2b9ccb){var _0x3e433a={},_0x58bba7={},_0x54589b={'count':0x0,'rows':[]};var _0xee9aed=_[_0x463f('0x29')](db[_0x463f('0x2a')]['rawAttributes'],function(_0x5d1010){return{'name':_0x5d1010[_0x463f('0x2b')],'type':_0x5d1010[_0x463f('0x2c')][_0x463f('0x2d')]};});_0x58bba7[_0x463f('0x2e')]=_[_0x463f('0x29')](_0xee9aed,_0x463f('0x26'));_0x58bba7[_0x463f('0x2f')]=_[_0x463f('0x30')](_0x30815e[_0x463f('0x2f')]);_0x58bba7[_0x463f('0x31')]=_[_0x463f('0x32')](_0x58bba7[_0x463f('0x2e')],_0x58bba7['query']);_0x3e433a[_0x463f('0x33')]=_[_0x463f('0x32')](_0x58bba7[_0x463f('0x2e')],qs[_0x463f('0x34')](_0x30815e[_0x463f('0x2f')][_0x463f('0x34')]));_0x3e433a['attributes']=_0x3e433a[_0x463f('0x33')][_0x463f('0x35')]?_0x3e433a['attributes']:_0x58bba7['model'];if(!_0x30815e[_0x463f('0x2f')][_0x463f('0x36')](_0x463f('0x37'))){_0x3e433a['limit']=qs[_0x463f('0x1c')](_0x30815e[_0x463f('0x2f')][_0x463f('0x1c')]);_0x3e433a['offset']=qs['offset'](_0x30815e['query'][_0x463f('0x1b')]);}_0x3e433a['order']=qs['sort'](_0x30815e[_0x463f('0x2f')]['sort']);_0x3e433a[_0x463f('0x38')]=qs[_0x463f('0x31')](_['pick'](_0x30815e[_0x463f('0x2f')],_0x58bba7[_0x463f('0x31')]),_0xee9aed);if(_0x30815e[_0x463f('0x2f')]['filter']){_0x3e433a[_0x463f('0x38')]=_[_0x463f('0x39')](_0x3e433a['where'],{'$or':_[_0x463f('0x29')](_0xee9aed,function(_0x51e71d){if(_0x51e71d[_0x463f('0x2c')]!=='VIRTUAL'){var _0x52d5d8={};_0x52d5d8[_0x51e71d['name']]={'$like':'%'+_0x30815e['query'][_0x463f('0x3a')]+'%'};return _0x52d5d8;}})});}_0x3e433a=_[_0x463f('0x39')]({},_0x3e433a,_0x30815e['options']);var _0x537f92={'where':_0x3e433a['where']};return db[_0x463f('0x2a')][_0x463f('0x1a')](_0x537f92)['then'](function(_0x270ef1){_0x54589b[_0x463f('0x1a')]=_0x270ef1;if(_0x30815e[_0x463f('0x2f')][_0x463f('0x3b')]){_0x3e433a[_0x463f('0x3c')]=[{'all':!![]}];}return db[_0x463f('0x2a')][_0x463f('0x3d')](_0x3e433a);})[_0x463f('0x22')](function(_0x5b1398){_0x54589b[_0x463f('0x3e')]=_0x5b1398;return _0x54589b;})['then'](respondWithFilteredResult(_0x2b9ccb,_0x3e433a))[_0x463f('0x3f')](handleError(_0x2b9ccb,null));};exports[_0x463f('0x40')]=function(_0x5bc3c6,_0x4a722c){var _0x34ea7e={'raw':!![],'where':{'id':_0x5bc3c6['params']['id']}},_0x39a37c={};_0x39a37c[_0x463f('0x2e')]=_['keys'](db[_0x463f('0x2a')][_0x463f('0x41')]);_0x39a37c['query']=_[_0x463f('0x30')](_0x5bc3c6[_0x463f('0x2f')]);_0x39a37c[_0x463f('0x31')]=_[_0x463f('0x32')](_0x39a37c['model'],_0x39a37c[_0x463f('0x2f')]);_0x34ea7e[_0x463f('0x33')]=_[_0x463f('0x32')](_0x39a37c[_0x463f('0x2e')],qs['fields'](_0x5bc3c6[_0x463f('0x2f')]['fields']));_0x34ea7e['attributes']=_0x34ea7e[_0x463f('0x33')][_0x463f('0x35')]?_0x34ea7e[_0x463f('0x33')]:_0x39a37c[_0x463f('0x2e')];if(_0x5bc3c6[_0x463f('0x2f')][_0x463f('0x3b')]){_0x34ea7e[_0x463f('0x3c')]=[{'all':!![]}];}_0x34ea7e=_[_0x463f('0x39')]({},_0x34ea7e,_0x5bc3c6[_0x463f('0x42')]);return db['WhatsappTransferReport']['find'](_0x34ea7e)[_0x463f('0x22')](handleEntityNotFound(_0x4a722c,null))[_0x463f('0x22')](respondWithResult(_0x4a722c,null))[_0x463f('0x3f')](handleError(_0x4a722c,null));};exports[_0x463f('0x43')]=function(_0x10c453,_0x150dbb){return db['WhatsappTransferReport'][_0x463f('0x43')](_0x10c453[_0x463f('0x44')],{})['then'](respondWithResult(_0x150dbb,0xc9))[_0x463f('0x3f')](handleError(_0x150dbb,null));};exports[_0x463f('0x20')]=function(_0x8bb317,_0x4d999b){if(_0x8bb317[_0x463f('0x44')]['id']){delete _0x8bb317[_0x463f('0x44')]['id'];}return db[_0x463f('0x2a')][_0x463f('0x45')]({'where':{'id':_0x8bb317[_0x463f('0x46')]['id']}})[_0x463f('0x22')](handleEntityNotFound(_0x4d999b,null))['then'](saveUpdates(_0x8bb317['body'],null))[_0x463f('0x22')](respondWithResult(_0x4d999b,null))[_0x463f('0x3f')](handleError(_0x4d999b,null));};exports[_0x463f('0x21')]=function(_0x2aa8a8,_0x10e2fe){return db[_0x463f('0x2a')]['find']({'where':{'id':_0x2aa8a8[_0x463f('0x46')]['id']}})[_0x463f('0x22')](handleEntityNotFound(_0x10e2fe,null))[_0x463f('0x22')](removeEntity(_0x10e2fe,null))[_0x463f('0x3f')](handleError(_0x10e2fe,null));};exports[_0x463f('0x47')]=function(_0xbf735c,_0x22f5c8){return db[_0x463f('0x2a')][_0x463f('0x47')]()[_0x463f('0x22')](respondWithResult(_0x22f5c8,null))[_0x463f('0x3f')](handleError(_0x22f5c8,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 4ffd4fe..ebf3c4c 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 _0x68c1=['exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68c1,0xd6));var _0x168c=function(_0x108d68,_0x9b39de){_0x108d68=_0x108d68-0x0;var _0x11476a=_0x68c1[_0x108d68];return _0x11476a;};'use strict';var _=require(_0x168c('0x0'));var util=require(_0x168c('0x1'));var logger=require(_0x168c('0x2'))(_0x168c('0x3'));var moment=require(_0x168c('0x4'));var BPromise=require(_0x168c('0x5'));var rp=require(_0x168c('0x6'));var fs=require('fs');var path=require(_0x168c('0x7'));var rimraf=require(_0x168c('0x8'));var config=require('../../config/environment');var attributes=require(_0x168c('0x9'));module[_0x168c('0xa')]=function(_0x401e7d,_0x4b8d61){return _0x401e7d['define'](_0x168c('0xb'),attributes,{'tableName':_0x168c('0xc'),'paranoid':![],'indexes':[{'name':_0x168c('0xd'),'fields':[_0x168c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd9e=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0xfd9e,0x130));var _0xefd9=function(_0x3963bd,_0x375a34){_0x3963bd=_0x3963bd-0x0;var _0x47f794=_0xfd9e[_0x3963bd];return _0x47f794;};'use strict';var _=require('lodash');var util=require(_0xefd9('0x0'));var logger=require('../../config/logger')(_0xefd9('0x1'));var moment=require(_0xefd9('0x2'));var BPromise=require(_0xefd9('0x3'));var rp=require(_0xefd9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xefd9('0x5'));var config=require(_0xefd9('0x6'));var attributes=require(_0xefd9('0x7'));module[_0xefd9('0x8')]=function(_0xbdc012,_0x94e4fa){return _0xbdc012[_0xefd9('0x9')](_0xefd9('0xa'),attributes,{'tableName':_0xefd9('0xb'),'paranoid':![],'indexes':[{'name':_0xefd9('0xc'),'fields':[_0xefd9('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 a3682e8..29ed7b8 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(_0x3efa8e,_0x1b249c){var _0x461a3c=function(_0x290eca){while(--_0x290eca){_0x3efa8e['push'](_0x3efa8e['shift']());}};_0x461a3c(++_0x1b249c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x3c24e1,_0x214c36){var _0x3b0c73=function(_0x1f42e2){while(--_0x1f42e2){_0x3c24e1['push'](_0x3c24e1['shift']());}};_0x3b0c73(++_0x214c36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index b2036b5..01a04ef 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb95e=['start','then','Online\x20apps:','map','online','join','Offline\x20apps:','filter','status','name','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','info'];(function(_0x3282ca,_0x3fae8f){var _0x40e690=function(_0x2d0af7){while(--_0x2d0af7){_0x3282ca['push'](_0x3282ca['shift']());}};_0x40e690(++_0x3fae8f);}(_0xb95e,0xa4));var _0xeb95=function(_0x2332e9,_0x402a7a){_0x2332e9=_0x2332e9-0x0;var _0x4cbf89=_0xb95e[_0x2332e9];return _0x4cbf89;};'use strict';var _=require('lodash');var mysqldb=require(_0xeb95('0x0'));var rpc=require(_0xeb95('0x1'));var config=require(_0xeb95('0x2'));var logger=require(_0xeb95('0x3'))(_0xeb95('0x4'));var pm2=require(_0xeb95('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xeb95('0x6'));var chat=require(_0xeb95('0x7'));var transcribe=require(_0xeb95('0x8'));function main(){return mysqldb['db']['sequelize']['sync']()['then'](function(){return rpc['listen']();})['then'](function(_0x1994a4){logger[_0xeb95('0x9')](_0x1994a4);return chat[_0xeb95('0xa')]();})[_0xeb95('0xb')](function(){return schedule[_0xeb95('0xa')]();})[_0xeb95('0xb')](function(){return transcribe[_0xeb95('0xa')]();})[_0xeb95('0xb')](function(_0x2383dc){logger[_0xeb95('0x9')](_0x2383dc);return pm2[_0xeb95('0xa')](pm2Config);})[_0xeb95('0xb')](function(_0x8d2fcb){logger[_0xeb95('0x9')](_0xeb95('0xc'),_[_0xeb95('0xd')](_['filter'](_0x8d2fcb,{'status':_0xeb95('0xe')}),'name')[_0xeb95('0xf')]());logger['info'](_0xeb95('0x10'),_['map'](_[_0xeb95('0x11')](_0x8d2fcb,function(_0x5c0d1b){return _0x5c0d1b[_0xeb95('0x12')]!==_0xeb95('0xe');}),_0xeb95('0x13'))[_0xeb95('0xf')]()||_0xeb95('0x14'));config[_0xeb95('0x15')]&&require(_0xeb95('0x16'))[_0xeb95('0x17')]();require(_0xeb95('0x18'))[_0xeb95('0x17')]();})[_0xeb95('0x19')](function(_0x4ae135){logger[_0xeb95('0x1a')](_0xeb95('0x1b'),_0x4ae135);process[_0xeb95('0x1c')](0x1);});}main(); \ No newline at end of file +var _0x6e6f=['default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/logger','app','./config/pm2/config','./config/schedule','sequelize','listen','then','info','start','Online\x20apps:','map','filter','name','join','Offline\x20apps:','online','None'];(function(_0x598e2e,_0x42f1da){var _0x33aa27=function(_0x1832c3){while(--_0x1832c3){_0x598e2e['push'](_0x598e2e['shift']());}};_0x33aa27(++_0x42f1da);}(_0x6e6f,0xc6));var _0xf6e6=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x6e6f[_0x3f8759];return _0x2d33ca;};'use strict';var _=require('lodash');var mysqldb=require(_0xf6e6('0x0'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xf6e6('0x1'))(_0xf6e6('0x2'));var pm2=require('./config/pm2');var pm2Config=require(_0xf6e6('0x3'));var schedule=require(_0xf6e6('0x4'));var chat=require('./config/schedule/chat');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xf6e6('0x5')]['sync']()['then'](function(){return rpc[_0xf6e6('0x6')]();})[_0xf6e6('0x7')](function(_0xb7f4b1){logger[_0xf6e6('0x8')](_0xb7f4b1);return chat[_0xf6e6('0x9')]();})[_0xf6e6('0x7')](function(){return schedule[_0xf6e6('0x9')]();})[_0xf6e6('0x7')](function(){return transcribe[_0xf6e6('0x9')]();})[_0xf6e6('0x7')](function(_0x58ee95){logger['info'](_0x58ee95);return pm2['start'](pm2Config);})[_0xf6e6('0x7')](function(_0x180879){logger[_0xf6e6('0x8')](_0xf6e6('0xa'),_[_0xf6e6('0xb')](_[_0xf6e6('0xc')](_0x180879,{'status':'online'}),_0xf6e6('0xd'))[_0xf6e6('0xe')]());logger[_0xf6e6('0x8')](_0xf6e6('0xf'),_[_0xf6e6('0xb')](_[_0xf6e6('0xc')](_0x180879,function(_0x5ce5af){return _0x5ce5af['status']!==_0xf6e6('0x10');}),_0xf6e6('0xd'))['join']()||_0xf6e6('0x11'));config['seedDB']&&require('./config/seedDB')[_0xf6e6('0x12')]();require(_0xf6e6('0x13'))[_0xf6e6('0x12')]();})[_0xf6e6('0x14')](function(_0xb64ba4){logger[_0xf6e6('0x15')](_0xf6e6('0x16'),_0xb64ba4);process[_0xf6e6('0x17')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 122663e..bc88870 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 _0x32cd=['interface','userProfileId','user','params','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','User','find','name','authenticate','pass','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','getUuid','sub','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','use','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','query','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secrets','payload','verify','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/environment','lodash','composable-middleware','basic-auth','crypto','bluebird','session','fullname','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32cd,0x1b2));var _0xd32c=function(_0x3153ed,_0x2dcfe7){_0x3153ed=_0x3153ed-0x0;var _0x2b9cdf=_0x32cd[_0x3153ed];return _0x2b9cdf;};'use strict';var db=require(_0xd32c('0x0'))['db'];var config=require(_0xd32c('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require(_0xd32c('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xd32c('0x3'));var basicAuth=require(_0xd32c('0x4'));var crypto=require(_0xd32c('0x5'));var BPromise=require(_0xd32c('0x6'));var validateJwt=expressJwt({'secret':config['secrets'][_0xd32c('0x7')]});var userAttributes=['id','role',_0xd32c('0x8'),'name',_0xd32c('0x9'),_0xd32c('0xa'),_0xd32c('0xb'),_0xd32c('0xc'),'md5secret',_0xd32c('0xd'),_0xd32c('0xe'),_0xd32c('0xf'),_0xd32c('0x10'),_0xd32c('0x11'),_0xd32c('0x12'),_0xd32c('0x13'),_0xd32c('0x14'),'lastLoginAt','lastPauseAt','crudPermissions','allowmessenger',_0xd32c('0x15'),_0xd32c('0x16'),_0xd32c('0x17'),_0xd32c('0x18'),_0xd32c('0x19'),'phoneBarEnableRecording',_0xd32c('0x1a'),_0xd32c('0x1b'),'phoneBarExpires',_0xd32c('0x1c'),_0xd32c('0x1d'),'phoneBarRemoteControlPort',_0xd32c('0x1e'),_0xd32c('0x1f'),_0xd32c('0x20')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x55cd52,_0x42894c,_0x2d679d){if(_0x55cd52[_0xd32c('0x21')]){_0x2d679d();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x55cd52[_0xd32c('0x22')]['id']},'attributes':['id',_0xd32c('0x23'),'disposition'],'raw':!![]})[_0xd32c('0x24')](function(_0x3d9244){if(_0x3d9244&&_0x3d9244[_0xd32c('0x23')]){return _0x42894c[_0xd32c('0x25')](_0x3d9244[_0xd32c('0x26')]===_0xd32c('0x27')?0x195:0x193)[_0xd32c('0x28')]({'message':_0x3d9244['disposition']==='unmanaged'?_0xd32c('0x29'):_0xd32c('0x2a')});}else{_0x2d679d();}})[_0xd32c('0x2b')](function(_0xedb8f3){_0x2d679d(_0xedb8f3);});}});};exports[_0xd32c('0x2c')]=function isAuthenticated(_0x1aa23a){return compose()['use'](function(_0x6f8afe,_0x44e6cc,_0x4fea67){if(_0x6f8afe[_0xd32c('0x2d')][_0xd32c('0x2e')]){if(_['startsWith'](_0x6f8afe[_0xd32c('0x2d')][_0xd32c('0x2e')],'Basic')){var _0x136d05=basicAuth(_0x6f8afe);db[_0xd32c('0x2f')][_0xd32c('0x30')]({'where':{'name':_0x136d05[_0xd32c('0x31')]}})[_0xd32c('0x24')](function(_0x1f2179){if(!_0x1f2179||!_0x1f2179[_0xd32c('0x32')](_0x136d05[_0xd32c('0x33')])){return _0x44e6cc[_0xd32c('0x25')](0x191)[_0xd32c('0x28')]({'message':_0xd32c('0x34')});}_0x6f8afe[_0xd32c('0x21')]={'id':_0x1f2179['id']};_0x4fea67();})[_0xd32c('0x2b')](function(_0x210ffc){_0x4fea67(_0x210ffc);});}else if(_[_0xd32c('0x35')](_0x6f8afe[_0xd32c('0x2d')][_0xd32c('0x2e')],_0xd32c('0x36'))){validateJwt(_0x6f8afe,_0x44e6cc,_0x4fea67);}else{if(_0x1aa23a){_0x4fea67();}else{return _0x44e6cc[_0xd32c('0x25')](0x193)[_0xd32c('0x28')]({'message':_0xd32c('0x37')});}}}else if(_0x6f8afe['query']['apikey']){try{var _0x3f5811={'audience':hardwareConf[_0xd32c('0x38')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x6f8afe['query']['apikey'],_0x3f5811)[_0xd32c('0x24')](function(_0x31eff0){return db['User'][_0xd32c('0x30')]({'where':{'id':_0x31eff0[_0xd32c('0x39')]}})[_0xd32c('0x24')](function(_0x5665cc){if(!_0x5665cc||!_[_0xd32c('0x3a')](_0x5665cc['apiKeyNonce'],_0x31eff0['nonce'])){return _0x44e6cc[_0xd32c('0x25')](0x191)[_0xd32c('0x28')]({'message':_0xd32c('0x3b')});}_0x6f8afe[_0xd32c('0x21')]={'id':_0x5665cc['id']};_0x4fea67();});})['catch'](function(){return _0x44e6cc[_0xd32c('0x25')](0x191)[_0xd32c('0x28')]({'message':_0xd32c('0x3c')});});}catch(_0x506e46){_0x4fea67(_0x506e46);}}else if(_0x1aa23a){_0x4fea67();}else{return _0x44e6cc[_0xd32c('0x25')](0x193)[_0xd32c('0x28')]({'message':_0xd32c('0x37')});}})[_0xd32c('0x3d')](function(_0xfffd90,_0x229f01,_0x416181){if(_0xfffd90[_0xd32c('0x21')]){db[_0xd32c('0x2f')][_0xd32c('0x30')]({'where':{'id':_0xfffd90[_0xd32c('0x21')]['id']},'attributes':userAttributes})[_0xd32c('0x24')](function(_0x532dba){if(!_0x532dba){return _0x229f01[_0xd32c('0x25')](0x194)[_0xd32c('0x28')]({'message':_0xd32c('0x3e')});}_0xfffd90[_0xd32c('0x21')]=_0x532dba;_0x416181();})[_0xd32c('0x2b')](function(_0x5237e0){_0x416181(_0x5237e0);});}else if(_0x1aa23a){_0x416181();}else{return _0x229f01[_0xd32c('0x25')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xd32c('0x3f')]=function canUpdate(){return compose()[_0xd32c('0x3d')](function(_0xf3888b,_0x18f8b9,_0x32da00){return require('../../config/license/util')[_0xd32c('0x40')]()[_0xd32c('0x24')](function(_0x4a0d46){if(_0x4a0d46['update']){_0x32da00();}else{return _0x18f8b9[_0xd32c('0x25')](0x193)[_0xd32c('0x28')]({'message':_0xd32c('0x41')});}})[_0xd32c('0x2b')](function(_0x3ce178){_0x32da00(_0x3ce178);});});};exports[_0xd32c('0x42')]=function(_0x2532c2,_0x11cf0c,_0xc15164){_0x2532c2[_0xd32c('0x42')]=!![];return _0xc15164();};exports[_0xd32c('0x43')]=function signToken(_0x75b0c5){return signJwt(_0x75b0c5);};exports[_0xd32c('0x44')]=function(_0x476e6a,_0x626cb1){if(!_0x476e6a[_0xd32c('0x21')]){return _0x626cb1[_0xd32c('0x25')](0x194)[_0xd32c('0x28')]({'message':_0xd32c('0x45')});}var _0x5e1628={'payload':{'id':_0x476e6a[_0xd32c('0x21')]['id'],'role':_0x476e6a[_0xd32c('0x21')][_0xd32c('0x46')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5e1628)[_0xd32c('0x24')](function(_0x161f10){_0x626cb1[_0xd32c('0x47')](_0xd32c('0x48'),_0x161f10);_0x626cb1['redirect'](_0xd32c('0x49'));})[_0xd32c('0x2b')](function(_0x3047e6){return _0x626cb1['status'](0x1f4)[_0xd32c('0x4a')](_0x3047e6);});};exports['retrieveApiKey']=function(_0x5bbf45){if(_[_0xd32c('0x4b')](_0x5bbf45[_0xd32c('0x4c')])||_['isNil'](_0x5bbf45[_0xd32c('0x4d')])){return null;}else{return createJwt(_0x5bbf45);}};exports[_0xd32c('0x4e')]=function(_0x4f2626){_0x4f2626['apiKeyNonce']=generateNonce();_0x4f2626[_0xd32c('0x4d')]=generateIssuedAt();return createJwt(_0x4f2626);};exports[_0xd32c('0x4f')]=function(_0x254fa1,_0x5e8f8c){var _0x493a94=_0x254fa1[_0xd32c('0x50')][_0xd32c('0x51')];if(_0x493a94){var _0x5b132e={'nonce':_0x5e8f8c[_0xd32c('0x4c')],'iat':_0x5e8f8c[_0xd32c('0x4d')],'audience':hardwareConf[_0xd32c('0x38')](),'issuer':hardwareConf[_0xd32c('0x38')]()};return verifyJwt(_0x493a94,_0x5b132e)[_0xd32c('0x24')](function(){return generateApiKey(_0x5e8f8c);});}else{throw{'message':_0xd32c('0x52')};}};function signJwt(_0x47175d){var _0x35a1bd=BPromise[_0xd32c('0x53')](jwt[_0xd32c('0x54')],{'context':jwt});var _0x447aff=_0x47175d['secret']||config[_0xd32c('0x55')][_0xd32c('0x7')];return new BPromise(function(_0x48cde4,_0x3c9e9f){_0x35a1bd(_0x47175d[_0xd32c('0x56')],_0x447aff,_0x47175d['options'])[_0xd32c('0x24')](function(_0x5c9fa9){_0x48cde4(_0x5c9fa9);})[_0xd32c('0x2b')](function(_0x151601){_0x3c9e9f(_0x151601);});});}function verifyJwt(_0x1f6001,_0x47ebac,_0xc9b610){var _0x55feef=BPromise[_0xd32c('0x53')](jwt[_0xd32c('0x57')],{'context':jwt});var _0x4cfd6f=_0xc9b610||config[_0xd32c('0x55')][_0xd32c('0x7')];return new BPromise(function(_0x5354fe,_0x5bd6b2){_0x55feef(_0x1f6001,_0x4cfd6f,_0x47ebac)['then'](function(_0x4d5e8b){_0x5354fe(_0x4d5e8b);})['catch'](function(_0x58b336){_0x5bd6b2(_0x58b336);});});}function generateNonce(){return crypto[_0xd32c('0x58')](0x10)[_0xd32c('0x59')](_0xd32c('0x5a'));}function generateIssuedAt(){return Math['floor'](Date[_0xd32c('0x5b')]()/0x3e8)[_0xd32c('0x59')]();}function createJwt(_0x3d9840){var _0x53888f={'payload':{'iat':_0x3d9840[_0xd32c('0x4d')],'nonce':_0x3d9840[_0xd32c('0x4c')]},'options':{'algorithm':_0xd32c('0x5c'),'subject':_0x3d9840['id']['toString'](),'issuer':hardwareConf[_0xd32c('0x38')](),'audience':hardwareConf[_0xd32c('0x38')]()}};return signJwt(_0x53888f)['then'](function(_0xab4a92){return{'iat':_0x3d9840['apiKeyIat'],'nonce':_0x3d9840[_0xd32c('0x4c')],'token':_0xab4a92};});} \ No newline at end of file +var _0x214d=['basic-auth','crypto','bluebird','session','fullname','name','internal','email','permissions','md5secret','chatPause','faxPause','smsPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControlPort','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Forbidden.','catch','authorization','startsWith','Basic','User','find','then','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','query','apikey','sub','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','secret','payload','options','verify','secrets','hex','now','toString','HS512','../../mysqldb','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x214d,0xae));var _0xd214=function(_0xac28e0,_0x46059c){_0xac28e0=_0xac28e0-0x0;var _0x43f980=_0x214d[_0xac28e0];return _0x43f980;};'use strict';var db=require(_0xd214('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require(_0xd214('0x1'));var expressJwt=require(_0xd214('0x2'));var compose=require(_0xd214('0x3'));var basicAuth=require(_0xd214('0x4'));var crypto=require(_0xd214('0x5'));var BPromise=require(_0xd214('0x6'));var validateJwt=expressJwt({'secret':config['secrets'][_0xd214('0x7')]});var userAttributes=['id','role',_0xd214('0x8'),_0xd214('0x9'),_0xd214('0xa'),_0xd214('0xb'),'userpic',_0xd214('0xc'),_0xd214('0xd'),'voicePause',_0xd214('0xe'),'mailPause',_0xd214('0xf'),_0xd214('0x10'),'openchannelPause','pauseType','showWebBar',_0xd214('0x11'),_0xd214('0x12'),_0xd214('0x13'),_0xd214('0x14'),'passwordResetAt','alias',_0xd214('0x15'),_0xd214('0x16'),_0xd214('0x17'),'phoneBarEnableRecording',_0xd214('0x18'),_0xd214('0x19'),_0xd214('0x1a'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0xd214('0x1b'),'hotdesk',_0xd214('0x1c'),_0xd214('0x1d')];exports[_0xd214('0x1e')]=function(){return this[_0xd214('0x1f')](!![])[_0xd214('0x20')](function(_0x4e6d38,_0x587136,_0x128f04){if(_0x4e6d38[_0xd214('0x21')]){_0x128f04();}else{return db[_0xd214('0x22')][_0xd214('0x23')]({'where':{'id':_0x4e6d38[_0xd214('0x24')]['id']},'attributes':['id',_0xd214('0x25'),_0xd214('0x26')],'raw':!![]})['then'](function(_0x24537b){if(_0x24537b&&_0x24537b[_0xd214('0x25')]){return _0x587136['status'](_0x24537b['disposition']===_0xd214('0x27')?0x195:0x193)[_0xd214('0x28')]({'message':_0x24537b[_0xd214('0x26')]===_0xd214('0x27')?'Unmanaged.':_0xd214('0x29')});}else{_0x128f04();}})[_0xd214('0x2a')](function(_0x206daf){_0x128f04(_0x206daf);});}});};exports[_0xd214('0x1f')]=function isAuthenticated(_0x131c93){return compose()[_0xd214('0x20')](function(_0x2fca83,_0x5f0672,_0xb1ce2f){if(_0x2fca83['headers'][_0xd214('0x2b')]){if(_[_0xd214('0x2c')](_0x2fca83['headers'][_0xd214('0x2b')],_0xd214('0x2d'))){var _0x54dfff=basicAuth(_0x2fca83);db[_0xd214('0x2e')][_0xd214('0x2f')]({'where':{'name':_0x54dfff[_0xd214('0x9')]}})[_0xd214('0x30')](function(_0x532fd6){if(!_0x532fd6||!_0x532fd6[_0xd214('0x31')](_0x54dfff[_0xd214('0x32')])){return _0x5f0672[_0xd214('0x33')](0x191)[_0xd214('0x28')]({'message':_0xd214('0x34')});}_0x2fca83[_0xd214('0x21')]={'id':_0x532fd6['id']};_0xb1ce2f();})[_0xd214('0x2a')](function(_0x4f977e){_0xb1ce2f(_0x4f977e);});}else if(_[_0xd214('0x2c')](_0x2fca83['headers']['authorization'],_0xd214('0x35'))){validateJwt(_0x2fca83,_0x5f0672,_0xb1ce2f);}else{if(_0x131c93){_0xb1ce2f();}else{return _0x5f0672['status'](0x193)[_0xd214('0x28')]({'message':_0xd214('0x36')});}}}else if(_0x2fca83['query']['apikey']){try{var _0x307665={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xd214('0x37')]()};verifyJwt(_0x2fca83[_0xd214('0x38')][_0xd214('0x39')],_0x307665)['then'](function(_0x129fbc){return db[_0xd214('0x2e')]['find']({'where':{'id':_0x129fbc[_0xd214('0x3a')]}})['then'](function(_0x141385){if(!_0x141385||!_[_0xd214('0x3b')](_0x141385[_0xd214('0x3c')],_0x129fbc[_0xd214('0x3d')])){return _0x5f0672['status'](0x191)[_0xd214('0x28')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x2fca83[_0xd214('0x21')]={'id':_0x141385['id']};_0xb1ce2f();});})[_0xd214('0x2a')](function(){return _0x5f0672['status'](0x191)[_0xd214('0x28')]({'message':_0xd214('0x3e')});});}catch(_0x18e3fc){_0xb1ce2f(_0x18e3fc);}}else if(_0x131c93){_0xb1ce2f();}else{return _0x5f0672[_0xd214('0x33')](0x193)['json']({'message':_0xd214('0x36')});}})[_0xd214('0x20')](function(_0x2e4a8e,_0x2963b1,_0xf5146c){if(_0x2e4a8e[_0xd214('0x21')]){db['User'][_0xd214('0x2f')]({'where':{'id':_0x2e4a8e[_0xd214('0x21')]['id']},'attributes':userAttributes})[_0xd214('0x30')](function(_0x337172){if(!_0x337172){return _0x2963b1[_0xd214('0x33')](0x194)[_0xd214('0x28')]({'message':_0xd214('0x3f')});}_0x2e4a8e[_0xd214('0x21')]=_0x337172;_0xf5146c();})[_0xd214('0x2a')](function(_0x3b2733){_0xf5146c(_0x3b2733);});}else if(_0x131c93){_0xf5146c();}else{return _0x2963b1['status'](0x194)[_0xd214('0x28')]({'message':_0xd214('0x40')});}});};exports[_0xd214('0x41')]=function canUpdate(){return compose()[_0xd214('0x20')](function(_0x32d0f0,_0x2565d6,_0x5a6975){return require(_0xd214('0x42'))['getLicense']()[_0xd214('0x30')](function(_0x30f40a){if(_0x30f40a['update']){_0x5a6975();}else{return _0x2565d6['status'](0x193)[_0xd214('0x28')]({'message':_0xd214('0x43')});}})[_0xd214('0x2a')](function(_0x2a4439){_0x5a6975(_0x2a4439);});});};exports[_0xd214('0x44')]=function(_0x4fb02e,_0x38efc0,_0x5b74b0){_0x4fb02e['isMiddleware']=!![];return _0x5b74b0();};exports[_0xd214('0x45')]=function signToken(_0x2b7f9d){return signJwt(_0x2b7f9d);};exports['setTokenCookie']=function(_0x40e24d,_0x46d513){if(!_0x40e24d[_0xd214('0x21')]){return _0x46d513['status'](0x194)[_0xd214('0x28')]({'message':_0xd214('0x46')});}var _0x4f8913={'payload':{'id':_0x40e24d['user']['id'],'role':_0x40e24d[_0xd214('0x21')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4f8913)[_0xd214('0x30')](function(_0x168362){_0x46d513[_0xd214('0x47')]('motion.token',_0x168362);_0x46d513[_0xd214('0x48')](_0xd214('0x49'));})[_0xd214('0x2a')](function(_0x59fe7d){return _0x46d513[_0xd214('0x33')](0x1f4)['send'](_0x59fe7d);});};exports[_0xd214('0x4a')]=function(_0x35c7d7){if(_[_0xd214('0x4b')](_0x35c7d7[_0xd214('0x3c')])||_['isNil'](_0x35c7d7[_0xd214('0x4c')])){return null;}else{return createJwt(_0x35c7d7);}};exports[_0xd214('0x4d')]=function(_0x161fce){_0x161fce[_0xd214('0x3c')]=generateNonce();_0x161fce[_0xd214('0x4c')]=generateIssuedAt();return createJwt(_0x161fce);};exports['regenerateApiKey']=function(_0x695198,_0x3e733d){var _0x582d97=_0x695198[_0xd214('0x38')][_0xd214('0x39')];if(_0x582d97){var _0x2b35b2={'nonce':_0x3e733d[_0xd214('0x3c')],'iat':_0x3e733d[_0xd214('0x4c')],'audience':hardwareConf[_0xd214('0x37')](),'issuer':hardwareConf[_0xd214('0x37')]()};return verifyJwt(_0x582d97,_0x2b35b2)[_0xd214('0x30')](function(){return generateApiKey(_0x3e733d);});}else{throw{'message':_0xd214('0x4e')};}};function signJwt(_0x5d547b){var _0xd3c62a=BPromise[_0xd214('0x4f')](jwt['sign'],{'context':jwt});var _0x44f932=_0x5d547b[_0xd214('0x50')]||config['secrets'][_0xd214('0x7')];return new BPromise(function(_0x1ae7b0,_0x3a9d3d){_0xd3c62a(_0x5d547b[_0xd214('0x51')],_0x44f932,_0x5d547b[_0xd214('0x52')])[_0xd214('0x30')](function(_0x30ac7a){_0x1ae7b0(_0x30ac7a);})['catch'](function(_0x495dbd){_0x3a9d3d(_0x495dbd);});});}function verifyJwt(_0x36fad5,_0x52a61a,_0x17a62b){var _0x3088fd=BPromise[_0xd214('0x4f')](jwt[_0xd214('0x53')],{'context':jwt});var _0x56a2c9=_0x17a62b||config[_0xd214('0x54')][_0xd214('0x7')];return new BPromise(function(_0x1bc92d,_0x5dcb39){_0x3088fd(_0x36fad5,_0x56a2c9,_0x52a61a)['then'](function(_0x32082d){_0x1bc92d(_0x32082d);})[_0xd214('0x2a')](function(_0x4795cc){_0x5dcb39(_0x4795cc);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0xd214('0x55'));}function generateIssuedAt(){return Math['floor'](Date[_0xd214('0x56')]()/0x3e8)[_0xd214('0x57')]();}function createJwt(_0x572de0){var _0x199628={'payload':{'iat':_0x572de0[_0xd214('0x4c')],'nonce':_0x572de0['apiKeyNonce']},'options':{'algorithm':_0xd214('0x58'),'subject':_0x572de0['id'][_0xd214('0x57')](),'issuer':hardwareConf[_0xd214('0x37')](),'audience':hardwareConf[_0xd214('0x37')]()}};return signJwt(_0x199628)[_0xd214('0x30')](function(_0x48b465){return{'iat':_0x572de0[_0xd214('0x4c')],'nonce':_0x572de0['apiKeyNonce'],'token':_0x48b465};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e62246b..1cf6e8f 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x4ad47c,_0x483d31){var _0x5062ea=function(_0x500dab){while(--_0x500dab){_0x4ad47c['push'](_0x4ad47c['shift']());}};_0x5062ea(++_0x483d31);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file +var _0xa9e0=['update','close','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','final','binary','write','end','unlink','decryptFile'];(function(_0x33a2b5,_0x324774){var _0x53be92=function(_0x2d711e){while(--_0x2d711e){_0x33a2b5['push'](_0x33a2b5['shift']());}};_0x53be92(++_0x324774);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var crypto=require(_0x0a9e('0x0'));var fs=require('fs');var BPromise=require(_0x0a9e('0x1'));var defaultOptions={'algorithm':_0x0a9e('0x2')};function combineOptions(_0x5dd881){var _0x550fbc={};for(var _0x18d5c9 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x18d5c9)){_0x550fbc[_0x18d5c9]=defaultOptions[_0x18d5c9];}}if(_0x5dd881){for(var _0x333808 in _0x5dd881){if(_0x5dd881[_0x0a9e('0x3')](_0x333808)){_0x550fbc[_0x333808]=_0x5dd881[_0x333808];}}}return _0x550fbc;}exports[_0x0a9e('0x4')]=function(_0x991246,_0x981158,_0x57b080,_0x219af0){return new BPromise(function(_0x441e3a,_0x2cc193){_0x219af0=combineOptions(_0x219af0);var _0x5f41ea=new Buffer(_0x57b080);var _0x503809=fs[_0x0a9e('0x5')](_0x991246);var _0x56465b=fs['createWriteStream'](_0x981158);var _0x39753a=crypto[_0x0a9e('0x6')](_0x219af0[_0x0a9e('0x7')],_0x5f41ea);_0x503809['on'](_0x0a9e('0x8'),function(_0xfeb75b){var _0xbd1168=new Buffer(_0x39753a['update'](_0xfeb75b),'binary');_0x56465b['write'](_0xbd1168);});_0x503809['on']('end',function(){try{var _0x273d4d=new Buffer(_0x39753a[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x56465b[_0x0a9e('0xb')](_0x273d4d);_0x56465b[_0x0a9e('0xc')]();_0x56465b['on']('close',function(){return _0x441e3a(_0x981158);});}catch(_0x4283ce){fs[_0x0a9e('0xd')](_0x981158);return _0x2cc193(_0x4283ce);}});});};exports[_0x0a9e('0xe')]=function(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){_0x52a03d=combineOptions(_0x52a03d);var _0x1985b6=new Buffer(_0x4d5611);var _0x519dfd=fs[_0x0a9e('0x5')](_0x281129);var _0x12066b=fs['createWriteStream'](_0x44dcfd);var _0x225616=crypto['createDecipher'](_0x52a03d[_0x0a9e('0x7')],_0x1985b6);_0x519dfd['on'](_0x0a9e('0x8'),function(_0x106033){var _0x205fd6=new Buffer(_0x225616[_0x0a9e('0xf')](_0x106033),_0x0a9e('0xa'));_0x12066b[_0x0a9e('0xb')](_0x205fd6);});_0x519dfd['on'](_0x0a9e('0xc'),function(){try{var _0x1314ae=new Buffer(_0x225616[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x12066b['write'](_0x1314ae);_0x12066b[_0x0a9e('0xc')]();_0x12066b['on'](_0x0a9e('0x10'),function(){return _0x22dccb(_0x44dcfd);});}catch(_0x53682f){fs[_0x0a9e('0xd')](_0x44dcfd);return _0x5d0880(_0x53682f);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1166e6a..a72419e 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 _0x5ff3=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Failed','path','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Setting','then','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','split','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x22ba28,_0x3b116f){var _0x51e2e9=function(_0x3c332e){while(--_0x3c332e){_0x22ba28['push'](_0x22ba28['shift']());}};_0x51e2e9(++_0x3b116f);}(_0x5ff3,0x17d));var _0x35ff=function(_0x342282,_0x590777){_0x342282=_0x342282-0x0;var _0xf1d6b5=_0x5ff3[_0x342282];return _0xf1d6b5;};'use strict';var util=require('util');var path=require(_0x35ff('0x0'));var _=require('lodash');var csv=require(_0x35ff('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x35ff('0x2'));var rimraf=require(_0x35ff('0x3'));var db=require(_0x35ff('0x4'))['db'];var dbH=require(_0x35ff('0x4'))['dbH'];var logger=require(_0x35ff('0x5'))(_0x35ff('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x35ff('0x7')][0x2]);var QUERY=process[_0x35ff('0x7')][0x3];var PATH=process[_0x35ff('0x7')][0x4];function analyticExtractedReport(_0x495c31,_0x92b403){var _0x4c9fab={'status':_0x495c31};var _0x2e7470={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x92b403){_0x4c9fab[_0x35ff('0x8')]=_0x92b403;}return db[_0x35ff('0x9')]['update'](_0x4c9fab,_0x2e7470);}function main(){var _0x20647e=0x1388;var _0x59ec4f;logger[_0x35ff('0xa')](util[_0x35ff('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0x35ff('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x35ff('0xd')](function(_0x3c5f4b){if(_0x3c5f4b){_0x59ec4f=_0x3c5f4b;_0x20647e=_0x59ec4f[_0x35ff('0xe')]||0x1388;}})[_0x35ff('0xd')](function(){return dbH['sequelize'][_0x35ff('0xf')](util[_0x35ff('0xb')](_0x35ff('0x10'),QUERY),{'type':dbH['sequelize'][_0x35ff('0x11')][_0x35ff('0x12')]});})[_0x35ff('0xd')](function(_0x3e24dd){if(!_0x3e24dd[0x0][_0x35ff('0x13')]){return analyticExtractedReport(_0x35ff('0x14'));}var _0x2d4a88=[];var _0x28def2=0x0;var _0x30b5bf=!![];if(_0x3e24dd&&_0x3e24dd[_0x35ff('0x15')]){var _0x399169=_0x3e24dd[0x0][_0x35ff('0x13')]%(_0x28def2+_0x20647e);if(_0x59ec4f[_0x35ff('0x16')]){for(;_0x30b5bf;_0x28def2+=_0x20647e,_0x399169=_0x3e24dd[0x0][_0x35ff('0x13')]%(_0x28def2+_0x20647e)){if(_0x399169==0x0||_0x399169==_0x3e24dd[0x0][_0x35ff('0x13')]){_0x30b5bf=![];}_0x2d4a88['push'](dbH[_0x35ff('0x17')][_0x35ff('0xf')](util[_0x35ff('0xb')](_0x35ff('0x18'),QUERY,_0x20647e,_0x28def2),{'type':dbH['sequelize']['QueryTypes'][_0x35ff('0x12')]}));}}else{_0x2d4a88[_0x35ff('0x19')](dbH['sequelize'][_0x35ff('0xf')](QUERY,{'type':dbH[_0x35ff('0x17')][_0x35ff('0x11')][_0x35ff('0x12')]}));}}var _0x48f3bd=path[_0x35ff('0x1a')](PATH);var _0x55274b=path[_0x35ff('0x1b')](PATH,_0x35ff('0x1c'));var _0x29cd2e=_0x59ec4f[_0x35ff('0x16')]&&_0x2d4a88[_0x35ff('0x15')]>0x1;var _0x2b3782=[];if(!fs[_0x35ff('0x1d')](path['join'](_0x48f3bd,_0x55274b))&&_0x29cd2e){fs[_0x35ff('0x1e')](path[_0x35ff('0x1f')](_0x48f3bd,_0x55274b));}return BPromise['each'](_0x2d4a88,function(_0x426e4e){_0x2b3782['push'](_0x426e4e);})['then'](function(){for(var _0x186768=0x0;_0x186768<_0x2b3782[_0x35ff('0x15')];_0x186768+=0x1){var _0x95b9e2;var _0x11a5eb=_0x2b3782[_0x186768];if(_0x29cd2e){_0x95b9e2=path[_0x35ff('0x1f')](_0x48f3bd,_0x55274b,util['format'](_0x35ff('0x20'),_0x55274b,_0x186768,_0x35ff('0x21')));}else{_0x95b9e2=path[_0x35ff('0x1f')](_0x48f3bd,util['format'](_0x35ff('0x22'),_0x55274b,_0x35ff('0x21')));}fs[_0x35ff('0x23')](_0x95b9e2,csv(_0x11a5eb));}})[_0x35ff('0xd')](function(){if(_0x29cd2e){zipdir(path[_0x35ff('0x1f')](_0x48f3bd,_0x55274b),{'saveTo':path[_0x35ff('0x1f')](_0x48f3bd,util[_0x35ff('0xb')](_0x35ff('0x22'),_0x55274b,_0x35ff('0x24')))},function(_0x47d8fa,_0x3f9440){});rimraf(path['join'](_0x48f3bd,_0x55274b),function(){});}})[_0x35ff('0xd')](function(){logger[_0x35ff('0xa')](util[_0x35ff('0xb')](_0x35ff('0x25'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x35ff('0x26'),_0x29cd2e?util['format'](_0x35ff('0x22'),_0x55274b,_0x29cd2e?_0x35ff('0x24'):'csv'):null);});})['catch'](function(_0x3a39e5){logger[_0x35ff('0xa')](util['format'](_0x35ff('0x27'),EXTRACTED_REPORT_ID,_0x35ff('0x28')),util['inspect'](_0x3a39e5,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x35ff('0x29'));});}main(); \ No newline at end of file +var _0x22fb=['savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','push','dirname','basename','.csv','split','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','lodash','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv'];(function(_0x5510ab,_0x1e22c4){var _0x9a6e3e=function(_0x3cb30d){while(--_0x3cb30d){_0x5510ab['push'](_0x5510ab['shift']());}};_0x9a6e3e(++_0x1e22c4);}(_0x22fb,0x192));var _0xb22f=function(_0x4a2f2e,_0x543e38){_0x4a2f2e=_0x4a2f2e-0x0;var _0x1675f6=_0x22fb[_0x4a2f2e];return _0x1675f6;};'use strict';var util=require('util');var path=require('path');var _=require(_0xb22f('0x0'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xb22f('0x1'));var zipdir=require(_0xb22f('0x2'));var rimraf=require(_0xb22f('0x3'));var db=require(_0xb22f('0x4'))['db'];var dbH=require(_0xb22f('0x4'))['dbH'];var logger=require(_0xb22f('0x5'))(_0xb22f('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xb22f('0x7')][0x2]);var QUERY=process[_0xb22f('0x7')][0x3];var PATH=process[_0xb22f('0x7')][0x4];function analyticExtractedReport(_0x367d4b,_0x47f61a){var _0x34433b={'status':_0x367d4b};var _0x22c509={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x47f61a){_0x34433b[_0xb22f('0x8')]=_0x47f61a;}return db[_0xb22f('0x9')][_0xb22f('0xa')](_0x34433b,_0x22c509);}function main(){var _0x3593fb=0x1388;var _0x188cea;logger[_0xb22f('0xb')](util[_0xb22f('0xc')](_0xb22f('0xd'),EXTRACTED_REPORT_ID,_0xb22f('0xe')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb22f('0xf')]})['then'](function(_0x4bb02a){if(_0x4bb02a){_0x188cea=_0x4bb02a;_0x3593fb=_0x188cea['splitSizeCsv']||0x1388;}})[_0xb22f('0x10')](function(){return dbH[_0xb22f('0x11')][_0xb22f('0x12')](util[_0xb22f('0xc')](_0xb22f('0x13'),QUERY),{'type':dbH[_0xb22f('0x11')]['QueryTypes'][_0xb22f('0x14')]});})['then'](function(_0x36e2a8){if(!_0x36e2a8[0x0]['num']){return analyticExtractedReport(_0xb22f('0x15'));}var _0x514a8f=[];var _0x160417=0x0;var _0xc36af4=!![];if(_0x36e2a8&&_0x36e2a8[_0xb22f('0x16')]){var _0x538da0=_0x36e2a8[0x0][_0xb22f('0x17')]%(_0x160417+_0x3593fb);if(_0x188cea['split']){for(;_0xc36af4;_0x160417+=_0x3593fb,_0x538da0=_0x36e2a8[0x0][_0xb22f('0x17')]%(_0x160417+_0x3593fb)){if(_0x538da0==0x0||_0x538da0==_0x36e2a8[0x0][_0xb22f('0x17')]){_0xc36af4=![];}_0x514a8f[_0xb22f('0x18')](dbH[_0xb22f('0x11')][_0xb22f('0x12')](util[_0xb22f('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3593fb,_0x160417),{'type':dbH[_0xb22f('0x11')]['QueryTypes'][_0xb22f('0x14')]}));}}else{_0x514a8f[_0xb22f('0x18')](dbH[_0xb22f('0x11')][_0xb22f('0x12')](QUERY,{'type':dbH[_0xb22f('0x11')]['QueryTypes']['SELECT']}));}}var _0x3da442=path[_0xb22f('0x19')](PATH);var _0xf34e0d=path[_0xb22f('0x1a')](PATH,_0xb22f('0x1b'));var _0xcb9a74=_0x188cea[_0xb22f('0x1c')]&&_0x514a8f[_0xb22f('0x16')]>0x1;var _0x583fbe=[];if(!fs['existsSync'](path[_0xb22f('0x1d')](_0x3da442,_0xf34e0d))&&_0xcb9a74){fs[_0xb22f('0x1e')](path['join'](_0x3da442,_0xf34e0d));}return BPromise[_0xb22f('0x1f')](_0x514a8f,function(_0x4364f5){_0x583fbe['push'](_0x4364f5);})[_0xb22f('0x10')](function(){for(var _0x2918be=0x0;_0x2918be<_0x583fbe['length'];_0x2918be+=0x1){var _0x3e471f;var _0x2c4a9e=_0x583fbe[_0x2918be];if(_0xcb9a74){_0x3e471f=path[_0xb22f('0x1d')](_0x3da442,_0xf34e0d,util[_0xb22f('0xc')](_0xb22f('0x20'),_0xf34e0d,_0x2918be,_0xb22f('0x21')));}else{_0x3e471f=path[_0xb22f('0x1d')](_0x3da442,util[_0xb22f('0xc')]('%s.%s',_0xf34e0d,'csv'));}fs['writeFileSync'](_0x3e471f,csv(_0x2c4a9e));}})[_0xb22f('0x10')](function(){if(_0xcb9a74){zipdir(path['join'](_0x3da442,_0xf34e0d),{'saveTo':path[_0xb22f('0x1d')](_0x3da442,util[_0xb22f('0xc')](_0xb22f('0x22'),_0xf34e0d,_0xb22f('0x23')))},function(_0x3bf636,_0x5b2a42){});rimraf(path['join'](_0x3da442,_0xf34e0d),function(){});}})[_0xb22f('0x10')](function(){logger[_0xb22f('0xb')](util[_0xb22f('0xc')](_0xb22f('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xb22f('0x25'),_0xcb9a74?util[_0xb22f('0xc')]('%s.%s',_0xf34e0d,_0xcb9a74?_0xb22f('0x23'):_0xb22f('0x21')):null);});})[_0xb22f('0x26')](function(_0x225194){logger[_0xb22f('0xb')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb22f('0xe')),util[_0xb22f('0x27')](_0x225194,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb22f('0x28'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index fcdf061..57ccefb 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(_0x5ccfc7,_0xbd7bd9){var _0x29d61f=function(_0x5bcc1b){while(--_0x5bcc1b){_0x5ccfc7['push'](_0x5ccfc7['shift']());}};_0x29d61f(++_0xbd7bd9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a5ad8,_0x34911c){_0x5a5ad8=_0x5a5ad8-0x0;var _0x5512e5=_0xb10b[_0x5a5ad8];return _0x5512e5;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x17faa6,_0x58e793){var _0xb86a58=function(_0x3bad1f){while(--_0x3bad1f){_0x17faa6['push'](_0x17faa6['shift']());}};_0xb86a58(++_0x58e793);}(_0xb10b,0x12a));var _0xbb10=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0xb10b[_0x49d280];return _0x25274a;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0b74614..ee3f86b 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 _0x9953=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','num','push','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','Failed','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format'];(function(_0x3fbb62,_0x1c30b4){var _0x1e2f61=function(_0x2ab8fc){while(--_0x2ab8fc){_0x3fbb62['push'](_0x3fbb62['shift']());}};_0x1e2f61(++_0x1c30b4);}(_0x9953,0x1d7));var _0x3995=function(_0x1afe3e,_0x4bf84a){_0x1afe3e=_0x1afe3e-0x0;var _0x25645f=_0x9953[_0x1afe3e];return _0x25645f;};'use strict';var util=require('util');var path=require(_0x3995('0x0'));var _=require(_0x3995('0x1'));var fs=require('fs');var json2xls=require(_0x3995('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x3995('0x3'));var rimraf=require(_0x3995('0x4'));var db=require(_0x3995('0x5'))['db'];var dbH=require(_0x3995('0x5'))[_0x3995('0x6')];var logger=require(_0x3995('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3995('0x8')][0x2]);var QUERY=process[_0x3995('0x8')][0x3];var PATH=process[_0x3995('0x8')][0x4];function analyticExtractedReport(_0x9ecd5b,_0x3cafcf){var _0x23c0f7={'status':_0x9ecd5b};var _0x473f1d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3cafcf){_0x23c0f7[_0x3995('0x9')]=_0x3cafcf;}return db['AnalyticExtractedReport'][_0x3995('0xa')](_0x23c0f7,_0x473f1d);}function main(){var _0x17a869=0x1388;var _0x42f6ad;logger[_0x3995('0xb')](util[_0x3995('0xc')](_0x3995('0xd'),EXTRACTED_REPORT_ID,_0x3995('0xe')));return db[_0x3995('0xf')][_0x3995('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3995('0x11'),_0x3995('0x12')]})[_0x3995('0x13')](function(_0x4f04cb){if(_0x4f04cb){_0x42f6ad=_0x4f04cb;_0x17a869=_0x42f6ad['splitSizeXlsx']||0x1388;}})[_0x3995('0x13')](function(){return dbH[_0x3995('0x14')][_0x3995('0x15')](util[_0x3995('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3995('0x14')][_0x3995('0x16')]['SELECT']});})['then'](function(_0x2574fe){if(!_0x2574fe[0x0][_0x3995('0x17')]){return analyticExtractedReport('Empty');}var _0x2ac176=[];var _0x5bb715=0x0;var _0x4bf976=!![];if(_0x42f6ad[_0x3995('0x11')]){if(_0x2574fe&&_0x2574fe['length']){var _0x5d778d=_0x2574fe[0x0][_0x3995('0x17')]%(_0x5bb715+_0x17a869);for(;_0x4bf976;_0x5bb715+=_0x17a869,_0x5d778d=_0x2574fe[0x0][_0x3995('0x17')]%(_0x5bb715+_0x17a869)){if(_0x5d778d==0x0||_0x5d778d==_0x2574fe[0x0][_0x3995('0x17')]){_0x4bf976=![];}_0x2ac176[_0x3995('0x18')](dbH['sequelize'][_0x3995('0x15')](util[_0x3995('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x17a869,_0x5bb715),{'type':dbH['sequelize'][_0x3995('0x16')]['SELECT']}));}}}else{_0x2ac176['push'](dbH[_0x3995('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0x3995('0x16')][_0x3995('0x19')]}));}var _0x55f3d1=path[_0x3995('0x1a')](PATH);var _0x1cce30=path[_0x3995('0x1b')](PATH,_0x3995('0x1c'));var _0x5b9818=_0x42f6ad['split']&&_0x2ac176['length']>0x1;var _0x4e0827=[];if(!fs[_0x3995('0x1d')](path[_0x3995('0x1e')](_0x55f3d1,_0x1cce30))&&_0x5b9818){fs[_0x3995('0x1f')](path['join'](_0x55f3d1,_0x1cce30));}return BPromise[_0x3995('0x20')](_0x2ac176,function(_0x38379c){_0x4e0827[_0x3995('0x18')](_0x38379c);})[_0x3995('0x13')](function(){for(var _0x1c3ce9=0x0;_0x1c3ce9<_0x4e0827[_0x3995('0x21')];_0x1c3ce9+=0x1){var _0x57ee9f;var _0x185289=_0x4e0827[_0x1c3ce9];if(_0x5b9818){_0x57ee9f=path[_0x3995('0x1e')](_0x55f3d1,_0x1cce30,util[_0x3995('0xc')](_0x3995('0x22'),_0x1cce30,_0x1c3ce9,_0x3995('0x23')));}else{_0x57ee9f=path[_0x3995('0x1e')](_0x55f3d1,util['format'](_0x3995('0x24'),_0x1cce30,_0x3995('0x23')));}fs[_0x3995('0x25')](_0x57ee9f,json2xls(_0x185289),_0x3995('0x26'));}})[_0x3995('0x13')](function(){if(_0x5b9818){zipdir(path['join'](_0x55f3d1,_0x1cce30),{'saveTo':path[_0x3995('0x1e')](_0x55f3d1,util[_0x3995('0xc')](_0x3995('0x24'),_0x1cce30,_0x3995('0x27')))},function(_0x10ef8e,_0x20004a){});rimraf(path[_0x3995('0x1e')](_0x55f3d1,_0x1cce30),function(){});}})[_0x3995('0x13')](function(){logger[_0x3995('0xb')](util[_0x3995('0xc')](_0x3995('0x28'),EXTRACTED_REPORT_ID,_0x3995('0xe')));return analyticExtractedReport(_0x3995('0x29'),_0x5b9818?util[_0x3995('0xc')](_0x3995('0x24'),_0x1cce30,_0x5b9818?_0x3995('0x27'):'xlsx'):null);});})['catch'](function(_0x2d3c40){logger[_0x3995('0xb')](util[_0x3995('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3995('0xe')),util[_0x3995('0x2a')](_0x2d3c40,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x3995('0x2b'));});}main(); \ No newline at end of file +var _0x9d6f=['SELECT','push','dirname','.xlsx','existsSync','join','xlsx','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','inspect','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x5e019e,_0x33b156){var _0x451844=function(_0x56e489){while(--_0x56e489){_0x5e019e['push'](_0x5e019e['shift']());}};_0x451844(++_0x33b156);}(_0x9d6f,0x12e));var _0xf9d6=function(_0x220e9d,_0x268920){_0x220e9d=_0x220e9d-0x0;var _0x3de965=_0x9d6f[_0x220e9d];return _0x3de965;};'use strict';var util=require(_0xf9d6('0x0'));var path=require(_0xf9d6('0x1'));var _=require(_0xf9d6('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xf9d6('0x3'));var zipdir=require(_0xf9d6('0x4'));var rimraf=require(_0xf9d6('0x5'));var db=require(_0xf9d6('0x6'))['db'];var dbH=require('../../mysqldb')[_0xf9d6('0x7')];var logger=require(_0xf9d6('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xf9d6('0x9')][0x2]);var QUERY=process[_0xf9d6('0x9')][0x3];var PATH=process[_0xf9d6('0x9')][0x4];function analyticExtractedReport(_0x493064,_0x219a84){var _0x543220={'status':_0x493064};var _0x329397={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x219a84){_0x543220['savename']=_0x219a84;}return db[_0xf9d6('0xa')][_0xf9d6('0xb')](_0x543220,_0x329397);}function main(){var _0x33863c=0x1388;var _0x1405dd;logger[_0xf9d6('0xc')](util[_0xf9d6('0xd')](_0xf9d6('0xe'),EXTRACTED_REPORT_ID,_0xf9d6('0xf')));return db[_0xf9d6('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf9d6('0x11'),_0xf9d6('0x12')]})['then'](function(_0x262067){if(_0x262067){_0x1405dd=_0x262067;_0x33863c=_0x1405dd['splitSizeXlsx']||0x1388;}})[_0xf9d6('0x13')](function(){return dbH[_0xf9d6('0x14')][_0xf9d6('0x15')](util[_0xf9d6('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf9d6('0x14')]['QueryTypes']['SELECT']});})[_0xf9d6('0x13')](function(_0x5e8d85){if(!_0x5e8d85[0x0][_0xf9d6('0x16')]){return analyticExtractedReport(_0xf9d6('0x17'));}var _0xd251ea=[];var _0x523ba2=0x0;var _0xe0e801=!![];if(_0x1405dd['split']){if(_0x5e8d85&&_0x5e8d85[_0xf9d6('0x18')]){var _0x16787e=_0x5e8d85[0x0][_0xf9d6('0x16')]%(_0x523ba2+_0x33863c);for(;_0xe0e801;_0x523ba2+=_0x33863c,_0x16787e=_0x5e8d85[0x0][_0xf9d6('0x16')]%(_0x523ba2+_0x33863c)){if(_0x16787e==0x0||_0x16787e==_0x5e8d85[0x0][_0xf9d6('0x16')]){_0xe0e801=![];}_0xd251ea['push'](dbH['sequelize'][_0xf9d6('0x15')](util[_0xf9d6('0xd')](_0xf9d6('0x19'),QUERY,_0x33863c,_0x523ba2),{'type':dbH['sequelize']['QueryTypes'][_0xf9d6('0x1a')]}));}}}else{_0xd251ea[_0xf9d6('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xf9d6('0x14')]['QueryTypes']['SELECT']}));}var _0x5d02e0=path[_0xf9d6('0x1c')](PATH);var _0x149362=path['basename'](PATH,_0xf9d6('0x1d'));var _0x1f8c19=_0x1405dd[_0xf9d6('0x11')]&&_0xd251ea[_0xf9d6('0x18')]>0x1;var _0x5b8711=[];if(!fs[_0xf9d6('0x1e')](path[_0xf9d6('0x1f')](_0x5d02e0,_0x149362))&&_0x1f8c19){fs['mkdirSync'](path[_0xf9d6('0x1f')](_0x5d02e0,_0x149362));}return BPromise['each'](_0xd251ea,function(_0xf6dc6f){_0x5b8711[_0xf9d6('0x1b')](_0xf6dc6f);})[_0xf9d6('0x13')](function(){for(var _0x32a142=0x0;_0x32a142<_0x5b8711[_0xf9d6('0x18')];_0x32a142+=0x1){var _0xa03232;var _0x10371e=_0x5b8711[_0x32a142];if(_0x1f8c19){_0xa03232=path['join'](_0x5d02e0,_0x149362,util[_0xf9d6('0xd')]('%s%d.%s',_0x149362,_0x32a142,_0xf9d6('0x20')));}else{_0xa03232=path['join'](_0x5d02e0,util[_0xf9d6('0xd')]('%s.%s',_0x149362,_0xf9d6('0x20')));}fs[_0xf9d6('0x21')](_0xa03232,json2xls(_0x10371e),_0xf9d6('0x22'));}})[_0xf9d6('0x13')](function(){if(_0x1f8c19){zipdir(path[_0xf9d6('0x1f')](_0x5d02e0,_0x149362),{'saveTo':path[_0xf9d6('0x1f')](_0x5d02e0,util[_0xf9d6('0xd')]('%s.%s',_0x149362,_0xf9d6('0x23')))},function(_0x14a3b4,_0x4eee21){});rimraf(path[_0xf9d6('0x1f')](_0x5d02e0,_0x149362),function(){});}})[_0xf9d6('0x13')](function(){logger[_0xf9d6('0xc')](util[_0xf9d6('0xd')](_0xf9d6('0x24'),EXTRACTED_REPORT_ID,_0xf9d6('0xf')));return analyticExtractedReport(_0xf9d6('0x25'),_0x1f8c19?util['format']('%s.%s',_0x149362,_0x1f8c19?_0xf9d6('0x23'):_0xf9d6('0x20')):null);});})[_0xf9d6('0x26')](function(_0x34ebea){logger[_0xf9d6('0xc')](util[_0xf9d6('0xd')](_0xf9d6('0x27'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xf9d6('0x28')](_0x34ebea,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index a6e94c8..9af5e04 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 _0x4e81=['lodash','util','Interval','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','map','exten','filter','groupBy','playback','hasOwnProperty','extensions','find','push','Set','format','CDR(type)=%s','type','context','priority','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','createdAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4e81,0x1bc));var _0x14e8=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x4e81[_0x4fa291];return _0x506d9b;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));function rewrite(_0x354aac,_0x533fb3){var _0x4b9800=this;return _0x354aac['models'][_0x14e8('0x2')][_0x14e8('0x3')]({'raw':!![]})[_0x14e8('0x4')](function(_0x436444){_0x4b9800[_0x14e8('0x5')]=_0x436444;return _0x354aac[_0x14e8('0x6')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x533fb3[_0x14e8('0x7')]},'raw':!![]});})[_0x14e8('0x4')](function(_0x21f860){return _0x354aac[_0x14e8('0x6')][_0x14e8('0x8')][_0x14e8('0x3')]({'where':{'exten':{'$in':_[_0x14e8('0x9')](_[_0x14e8('0xa')](_0x21f860,_0x14e8('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x14e8('0x4')](function(_0x3c6bdd){var _0x43bfcd=_[_0x14e8('0xc')](_0x3c6bdd,{'priority':'1'});var _0x421fec=_[_0x14e8('0xc')](_0x3c6bdd,{'isApp':0x1});var _0x3bed91=_[_0x14e8('0xd')](_0x421fec,'exten');var _0x37eccb=['queue',_0x14e8('0xe')];var _0x341d40=[];var _0x32a01d=[];for(var _0x5a95b7 in _0x3bed91){if(_0x3bed91[_0x14e8('0xf')](_0x5a95b7)){_0x4b9800['priority']=0x2;_0x4b9800[_0x14e8('0x10')]=[];_0x4b9800['extension']=_[_0x14e8('0x11')](_0x43bfcd,{'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')]});_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0]['type'],'app':_0x14e8('0x13'),'appdata':util[_0x14e8('0x14')](_0x14e8('0x15'),_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')]),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});if(_0x3bed91[_0x5a95b7][0x0]['type']===_0x14e8('0x1a')){if(_0x4b9800[_0x14e8('0x1b')]){_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':'Set','appdata':_0x14e8('0x1c')+(_0x4b9800[_0x14e8('0x1b')][_0x14e8('0x1d')]?'${EXTEN:'+_0x4b9800[_0x14e8('0x1b')]['cutdigits']+'}':_0x14e8('0x1e')),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});}_0x4b9800['extensions'][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0]['type'],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x1f')+_0x3bed91[_0x5a95b7][0x0]['VoiceExtensionId'],'context':_0x3bed91[_0x5a95b7][0x0]['context'],'exten':_0x3bed91[_0x5a95b7][0x0]['exten'],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});var _0x3eae0b=_0x4b9800[_0x14e8('0x18')]++;_0x4b9800[_0x14e8('0x10')]['push']({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x20'),'appdata':_0x14e8('0x21')+(_0x3eae0b+0x2)+_0x14e8('0x22')+(_0x3eae0b+0x1)+')','context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x3eae0b,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});if(_0x4b9800['extension']){_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':'Set','appdata':_0x4b9800['extension']['cutdigits']?_0x14e8('0x23')+_0x4b9800[_0x14e8('0x1b')]['cutdigits']+'}':_0x14e8('0x24'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0]['VoiceExtensionId']});}_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x25')+_0x3bed91[_0x5a95b7][0x0]['VoiceExtensionId'],'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});if(_0x4b9800['extension']&&_0x4b9800[_0x14e8('0x1b')]['hasOwnProperty'](_0x14e8('0x26'))&&_0x4b9800[_0x14e8('0x1b')][_0x14e8('0x26')]!==_0x14e8('0x27')){_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x28'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0]['VoiceExtensionId']});_0x4b9800['extensions']['push']({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':'Set','appdata':_0x14e8('0x29')+_0x4b9800['extension'][_0x14e8('0x26')]||_0x14e8('0x2a'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800['priority']++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});}}_0x4b9800['extensions'][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x2b'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800['priority']++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});_0x4b9800['extensions'][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800['priority']++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x2c'),'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'priority':_0x4b9800[_0x14e8('0x18')]++,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});for(var _0x11f0ee=0x0,_0x2f1904=0x0;_0x11f0ee<_0x3bed91[_0x5a95b7][_0x14e8('0x2d')];_0x11f0ee+=0x1,_0x2f1904=0x0){var _0x21e781=_0x3bed91[_0x5a95b7][_0x11f0ee];if(_0x21e781[_0x14e8('0x16')]){_0x21e781['type']=_0x21e781[_0x14e8('0x16')]['toLowerCase']();}var _0x555f70=[];var _0x5e323a=[];delete _0x21e781['id'];delete _0x21e781[_0x14e8('0x2e')];delete _0x21e781['updatedAt'];var _0x46a3c4=_0x21e781[_0x14e8('0x2f')]!==_0x14e8('0x30')?[_0x21e781[_0x14e8('0x2f')]]:_0x21e781[_0x14e8('0x7')]?_[_0x14e8('0xa')](_[_0x14e8('0xc')](_0x4b9800[_0x14e8('0x5')],{'IntervalId':_0x21e781[_0x14e8('0x7')]}),_0x14e8('0x2f')):[];if(_0x21e781[_0x14e8('0xf')]('tag')){if(_0x21e781[_0x14e8('0x31')]&&_0x21e781[_0x14e8('0x31')]!=='--'){_0x555f70[_0x14e8('0x12')]({'type':_0x21e781[_0x14e8('0x16')],'app':'Set','appdata':_0x14e8('0x32')+_0x21e781[_0x14e8('0x31')],'context':_0x21e781['context'],'exten':_0x21e781['exten'],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800['priority']+_0x2f1904++,'VoiceExtensionId':_0x21e781['VoiceExtensionId']});}}if(_0x21e781[_0x14e8('0x16')]===_0x14e8('0x1a')&&_0x21e781['hasOwnProperty'](_0x14e8('0x33'))){if(_0x21e781[_0x14e8('0x33')]){_0x555f70['push']({'type':_0x21e781[_0x14e8('0x16')],'app':_0x14e8('0x20'),'appdata':_0x14e8('0x34')+_0x21e781[_0x14e8('0x33')]+')','context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781[_0x14e8('0xb')],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});}else{_0x555f70[_0x14e8('0x12')]({'type':_0x21e781[_0x14e8('0x16')],'app':_0x14e8('0x20'),'appdata':_0x14e8('0x35'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781[_0x14e8('0xb')],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800['priority']+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});}}if(_0x21e781['hasOwnProperty'](_0x14e8('0x36'))){if(_0x37eccb[_0x14e8('0x37')](_0x21e781[_0x14e8('0x38')][_0x14e8('0x39')]())>=0x0&&_0x21e781['appType']!=='custom'){if(_0x21e781['answer']){_0x555f70[_0x14e8('0x12')]({'type':_0x21e781['type'],'app':'ExecIf','appdata':_0x14e8('0x3a'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781['exten'],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});_0x555f70[_0x14e8('0x12')]({'type':_0x21e781['type'],'app':'Set','appdata':_0x14e8('0x3b'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781[_0x14e8('0xb')],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});}else{_0x555f70['push']({'type':_0x21e781[_0x14e8('0x16')],'app':_0x14e8('0x20'),'appdata':_0x14e8('0x3c'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781['exten'],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});_0x555f70[_0x14e8('0x12')]({'type':_0x21e781['type'],'app':_0x14e8('0x13'),'appdata':_0x14e8('0x3d'),'context':_0x21e781[_0x14e8('0x17')],'exten':_0x21e781[_0x14e8('0xb')],'priority':_0x46a3c4[_0x14e8('0x2d')]+_0x4b9800[_0x14e8('0x18')]+_0x2f1904++,'VoiceExtensionId':_0x21e781[_0x14e8('0x19')]});}}}for(var _0x168b8a=0x0;_0x168b8a<_0x46a3c4['length'];_0x168b8a+=0x1){var _0x5a1f22=_0x4b9800[_0x14e8('0x18')]+_0x46a3c4[_0x14e8('0x2d')];var _0x238468=_0x168b8a===_0x46a3c4[_0x14e8('0x2d')]-0x1?_0x4b9800[_0x14e8('0x18')]+_0x555f70['length']+_0x5e323a['length']+0x2:_0x4b9800['priority']+_0x168b8a+0x1;_0x555f70[_0x14e8('0x3e')](_0x168b8a,0x0,{'type':_0x21e781[_0x14e8('0x16')],'app':_0x14e8('0x3f'),'appdata':_0x46a3c4[_0x168b8a]+'?'+_0x21e781['context']+_0x14e8('0x40')+_0x5a1f22+':'+_0x21e781[_0x14e8('0x17')]+_0x14e8('0x40')+_0x238468,'exten':_0x21e781['exten'],'context':_0x21e781[_0x14e8('0x17')],'priority':_0x4b9800[_0x14e8('0x18')]+_0x168b8a,'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});}_0x21e781[_0x14e8('0x18')]=_0x555f70[_0x14e8('0x2d')]?_[_0x14e8('0x41')](_0x555f70)[_0x14e8('0x18')]+0x1:_0x4b9800[_0x14e8('0x18')];_0x4b9800[_0x14e8('0x18')]=(_0x5e323a[_0x14e8('0x2d')]?_[_0x14e8('0x41')](_0x5e323a)['priority']:_0x21e781[_0x14e8('0x18')])+0x1;_0x4b9800[_0x14e8('0x10')]=_[_0x14e8('0x42')](_0x4b9800[_0x14e8('0x10')],_0x555f70,[_0x21e781],_0x5e323a);}_0x4b9800[_0x14e8('0x10')][_0x14e8('0x12')]({'type':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x16')],'app':_0x14e8('0x43'),'exten':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0xb')],'context':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x17')],'priority':_0x4b9800[_0x14e8('0x18')],'VoiceExtensionId':_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]});_0x341d40['push'](_0x3bed91[_0x5a95b7][0x0][_0x14e8('0x19')]);_0x32a01d=_[_0x14e8('0x42')](_0x32a01d,_0x4b9800['extensions']);}}return _0x354aac[_0x14e8('0x44')](function(_0x2c2630){return _0x354aac[_0x14e8('0x6')][_0x14e8('0x8')][_0x14e8('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x341d40}},'transaction':_0x2c2630})[_0x14e8('0x4')](function(_0x139405){return _0x354aac['models']['VoiceExtension']['bulkCreate'](_[_0x14e8('0x46')](_0x32a01d,_0x14e8('0x18')),{'transaction':_0x2c2630});});});})[_0x14e8('0x47')](function(_0x2c6d33){console[_0x14e8('0x48')](_0x2c6d33);});}exports[_0x14e8('0x49')]=rewrite; \ No newline at end of file +var _0x3238=['${EXTEN}','context','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','tag','CDR(tag)=','callerID','answer','indexOf','app','toLowerCase','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','Interval','findAll','then','VoiceExtension','IntervalId','models','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','CDR(type)=%s','VoiceExtensionId','outbound','push','CDR(destination)=','${EXTEN:'];(function(_0x3abe58,_0x184dd9){var _0x457389=function(_0x59f517){while(--_0x59f517){_0x3abe58['push'](_0x3abe58['shift']());}};_0x457389(++_0x184dd9);}(_0x3238,0x13e));var _0x8323=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3238[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8323('0x0'));var util=require('util');function rewrite(_0x25b74c,_0x1a2138){var _0xd581b1=this;return _0x25b74c['models'][_0x8323('0x1')][_0x8323('0x2')]({'raw':!![]})[_0x8323('0x3')](function(_0xce566d){_0xd581b1['intervals']=_0xce566d;return _0x25b74c['models'][_0x8323('0x4')][_0x8323('0x2')]({'where':{'IntervalId':_0x1a2138[_0x8323('0x5')]},'raw':!![]});})[_0x8323('0x3')](function(_0x4ddf1f){return _0x25b74c[_0x8323('0x6')]['VoiceExtension'][_0x8323('0x2')]({'where':{'exten':{'$in':_[_0x8323('0x7')](_[_0x8323('0x8')](_0x4ddf1f,_0x8323('0x9')))}},'order':[{'raw':_0x8323('0xa')}],'raw':!![]});})[_0x8323('0x3')](function(_0x46f52b){var _0x2dce91=_['filter'](_0x46f52b,{'priority':'1'});var _0x42ca90=_[_0x8323('0xb')](_0x46f52b,{'isApp':0x1});var _0x3c043a=_['groupBy'](_0x42ca90,_0x8323('0x9'));var _0x8be0fe=[_0x8323('0xc'),_0x8323('0xd')];var _0x6b0c66=[];var _0x187bb4=[];for(var _0x325a18 in _0x3c043a){if(_0x3c043a[_0x8323('0xe')](_0x325a18)){_0xd581b1[_0x8323('0xf')]=0x2;_0xd581b1[_0x8323('0x10')]=[];_0xd581b1[_0x8323('0x11')]=_[_0x8323('0x12')](_0x2dce91,{'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')]});_0xd581b1[_0x8323('0x10')]['push']({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':util['format'](_0x8323('0x15'),_0x3c043a[_0x325a18][0x0]['type']),'context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});if(_0x3c043a[_0x325a18][0x0][_0x8323('0x13')]===_0x8323('0x17')){if(_0xd581b1[_0x8323('0x11')]){_0xd581b1['extensions'][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0]['type'],'app':_0x8323('0x14'),'appdata':_0x8323('0x19')+(_0xd581b1[_0x8323('0x11')]['cutdigits']?_0x8323('0x1a')+_0xd581b1['extension']['cutdigits']+'}':_0x8323('0x1b')),'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1['priority']++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});}_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0x8323('0x1d')+_0x3c043a[_0x325a18][0x0][_0x8323('0x16')],'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});var _0x27155d=_0xd581b1['priority']++;_0xd581b1['extensions']['push']({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x1e'),'appdata':_0x8323('0x1f')+(_0x27155d+0x2)+_0x8323('0x20')+(_0x27155d+0x1)+')','context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0x27155d,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});if(_0xd581b1['extension']){_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0xd581b1[_0x8323('0x11')][_0x8323('0x21')]?_0x8323('0x22')+_0xd581b1['extension'][_0x8323('0x21')]+'}':_0x8323('0x23'),'context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});}_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0]['type'],'app':'Set','appdata':'outboundrouteid='+_0x3c043a[_0x325a18][0x0]['VoiceExtensionId'],'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});if(_0xd581b1['extension']&&_0xd581b1[_0x8323('0x11')][_0x8323('0xe')](_0x8323('0x24'))&&_0xd581b1[_0x8323('0x11')][_0x8323('0x24')]!==_0x8323('0x25')){_0xd581b1[_0x8323('0x10')]['push']({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':'Set','appdata':_0x8323('0x26')+_0xd581b1[_0x8323('0x11')][_0x8323('0x24')]||_0x8323('0x27'),'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0]['exten'],'priority':_0xd581b1['priority']++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});}}_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0x8323('0x28'),'context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});_0xd581b1[_0x8323('0x10')][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0x8323('0x29'),'context':_0x3c043a[_0x325a18][0x0]['context'],'exten':_0x3c043a[_0x325a18][0x0]['exten'],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});_0xd581b1['extensions'][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x14'),'appdata':_0x8323('0x2a'),'context':_0x3c043a[_0x325a18][0x0][_0x8323('0x1c')],'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'priority':_0xd581b1[_0x8323('0xf')]++,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});for(var _0x3d42db=0x0,_0x1073c7=0x0;_0x3d42db<_0x3c043a[_0x325a18][_0x8323('0x2b')];_0x3d42db+=0x1,_0x1073c7=0x0){var _0x3e3f7e=_0x3c043a[_0x325a18][_0x3d42db];if(_0x3e3f7e['type']){_0x3e3f7e[_0x8323('0x13')]=_0x3e3f7e[_0x8323('0x13')]['toLowerCase']();}var _0x52b437=[];var _0x355756=[];delete _0x3e3f7e['id'];delete _0x3e3f7e[_0x8323('0x2c')];delete _0x3e3f7e[_0x8323('0x2d')];var _0x467440=_0x3e3f7e[_0x8323('0x2e')]!=='*,*,*,*'?[_0x3e3f7e[_0x8323('0x2e')]]:_0x3e3f7e[_0x8323('0x5')]?_[_0x8323('0x8')](_[_0x8323('0xb')](_0xd581b1['intervals'],{'IntervalId':_0x3e3f7e[_0x8323('0x5')]}),_0x8323('0x2e')):[];if(_0x3e3f7e['hasOwnProperty']('tag')){if(_0x3e3f7e[_0x8323('0x2f')]&&_0x3e3f7e['tag']!=='--'){_0x52b437['push']({'type':_0x3e3f7e[_0x8323('0x13')],'app':'Set','appdata':_0x8323('0x30')+_0x3e3f7e['tag'],'context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e['exten'],'priority':_0x467440['length']+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});}}if(_0x3e3f7e[_0x8323('0x13')]===_0x8323('0x17')&&_0x3e3f7e[_0x8323('0xe')](_0x8323('0x31'))){if(_0x3e3f7e[_0x8323('0x31')]){_0x52b437[_0x8323('0x18')]({'type':_0x3e3f7e[_0x8323('0x13')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3e3f7e[_0x8323('0x31')]+')','context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e[_0x8323('0x9')],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});}else{_0x52b437[_0x8323('0x18')]({'type':_0x3e3f7e['type'],'app':_0x8323('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e['exten'],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});}}if(_0x3e3f7e[_0x8323('0xe')](_0x8323('0x32'))){if(_0x8be0fe[_0x8323('0x33')](_0x3e3f7e[_0x8323('0x34')][_0x8323('0x35')]())>=0x0&&_0x3e3f7e['appType']!=='custom'){if(_0x3e3f7e[_0x8323('0x32')]){_0x52b437['push']({'type':_0x3e3f7e[_0x8323('0x13')],'app':'ExecIf','appdata':_0x8323('0x36'),'context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e[_0x8323('0x9')],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1['priority']+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});_0x52b437['push']({'type':_0x3e3f7e['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3e3f7e['context'],'exten':_0x3e3f7e['exten'],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});}else{_0x52b437[_0x8323('0x18')]({'type':_0x3e3f7e[_0x8323('0x13')],'app':_0x8323('0x1e'),'appdata':_0x8323('0x37'),'context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e[_0x8323('0x9')],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e[_0x8323('0x16')]});_0x52b437[_0x8323('0x18')]({'type':_0x3e3f7e['type'],'app':_0x8323('0x14'),'appdata':_0x8323('0x38'),'context':_0x3e3f7e[_0x8323('0x1c')],'exten':_0x3e3f7e[_0x8323('0x9')],'priority':_0x467440[_0x8323('0x2b')]+_0xd581b1[_0x8323('0xf')]+_0x1073c7++,'VoiceExtensionId':_0x3e3f7e['VoiceExtensionId']});}}}for(var _0x5a57e8=0x0;_0x5a57e8<_0x467440['length'];_0x5a57e8+=0x1){var _0x55962e=_0xd581b1['priority']+_0x467440[_0x8323('0x2b')];var _0x1ad8aa=_0x5a57e8===_0x467440[_0x8323('0x2b')]-0x1?_0xd581b1[_0x8323('0xf')]+_0x52b437['length']+_0x355756[_0x8323('0x2b')]+0x2:_0xd581b1['priority']+_0x5a57e8+0x1;_0x52b437[_0x8323('0x39')](_0x5a57e8,0x0,{'type':_0x3e3f7e[_0x8323('0x13')],'app':_0x8323('0x3a'),'appdata':_0x467440[_0x5a57e8]+'?'+_0x3e3f7e[_0x8323('0x1c')]+_0x8323('0x3b')+_0x55962e+':'+_0x3e3f7e[_0x8323('0x1c')]+_0x8323('0x3b')+_0x1ad8aa,'exten':_0x3e3f7e[_0x8323('0x9')],'context':_0x3e3f7e[_0x8323('0x1c')],'priority':_0xd581b1[_0x8323('0xf')]+_0x5a57e8,'VoiceExtensionId':_0x3c043a[_0x325a18][0x0]['VoiceExtensionId']});}_0x3e3f7e[_0x8323('0xf')]=_0x52b437[_0x8323('0x2b')]?_[_0x8323('0x3c')](_0x52b437)[_0x8323('0xf')]+0x1:_0xd581b1[_0x8323('0xf')];_0xd581b1[_0x8323('0xf')]=(_0x355756[_0x8323('0x2b')]?_[_0x8323('0x3c')](_0x355756)[_0x8323('0xf')]:_0x3e3f7e['priority'])+0x1;_0xd581b1[_0x8323('0x10')]=_['concat'](_0xd581b1[_0x8323('0x10')],_0x52b437,[_0x3e3f7e],_0x355756);}_0xd581b1['extensions'][_0x8323('0x18')]({'type':_0x3c043a[_0x325a18][0x0][_0x8323('0x13')],'app':_0x8323('0x3d'),'exten':_0x3c043a[_0x325a18][0x0][_0x8323('0x9')],'context':_0x3c043a[_0x325a18][0x0]['context'],'priority':_0xd581b1[_0x8323('0xf')],'VoiceExtensionId':_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]});_0x6b0c66[_0x8323('0x18')](_0x3c043a[_0x325a18][0x0][_0x8323('0x16')]);_0x187bb4=_[_0x8323('0x3e')](_0x187bb4,_0xd581b1['extensions']);}}return _0x25b74c[_0x8323('0x3f')](function(_0x276c47){return _0x25b74c[_0x8323('0x6')][_0x8323('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x6b0c66}},'transaction':_0x276c47})[_0x8323('0x3')](function(_0xcaff9f){return _0x25b74c[_0x8323('0x6')][_0x8323('0x4')][_0x8323('0x40')](_[_0x8323('0x41')](_0x187bb4,_0x8323('0xf')),{'transaction':_0x276c47});});});})[_0x8323('0x42')](function(_0x47a9b3){console[_0x8323('0x43')](_0x47a9b3);});}exports[_0x8323('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7c55da4..bc60a5f 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x566918,_0x1eba63){var _0x5073ff=function(_0x200275){while(--_0x200275){_0x566918['push'](_0x566918['shift']());}};_0x5073ff(++_0x1eba63);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xcb91[_0x16e57d];return _0x40239c;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x36490d,_0x27e5bc){var _0x23a325=function(_0x438e51){while(--_0x438e51){_0x36490d['push'](_0x36490d['shift']());}};_0x23a325(++_0x27e5bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 38dbaa1..f54fe8b 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x28b272,_0x1c67e9){var _0x1c90b6=function(_0x2d8b85){while(--_0x2d8b85){_0x28b272['push'](_0x28b272['shift']());}};_0x1c90b6(++_0x1c67e9);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x7a54,0x106));var _0x47a5=function(_0x3675b0,_0x4a25fa){_0x3675b0=_0x3675b0-0x0;var _0x46ce4e=_0x7a54[_0x3675b0];return _0x46ce4e;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index c209c6f..192739c 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fed=['cm_contacts_temp_','format','YYYYMMDDHHmmss','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','CmContact','update','CmHopper','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','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','into','fields','.CmListId','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','createdAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','id\x20IN\x20?','min_id','group','info','message','exit','errors','main','stringify','binding','clone','socket_timestamp','root','.csv','findAll','name','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','orderBy','DROP\x20TABLE\x20','affectedRows','contact:import:','unlink','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter'];(function(_0x18b055,_0x26d232){var _0x5af6ad=function(_0x1c6414){while(--_0x1c6414){_0x18b055['push'](_0x18b055['shift']());}};_0x5af6ad(++_0x26d232);}(_0x7fed,0x1d1));var _0xd7fe=function(_0x53a558,_0x20aaf5){_0x53a558=_0x53a558-0x0;var _0x3f7817=_0x7fed[_0x53a558];return _0x3f7817;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xd7fe('0x0'));var Papa=require(_0xd7fe('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xd7fe('0x2'));var Redis=require(_0xd7fe('0x3'));var db=require(_0xd7fe('0x4'))['db'];var config=require(_0xd7fe('0x5'));var logger=require(_0xd7fe('0x6'))(_0xd7fe('0x7'));config[_0xd7fe('0x8')]=_[_0xd7fe('0x9')](config[_0xd7fe('0x8')],{'host':_0xd7fe('0xa'),'port':0x18eb});var socket=require(_0xd7fe('0xb'))(new Redis(config[_0xd7fe('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xd7fe('0xc')+moment()[_0xd7fe('0xd')](_0xd7fe('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x4fd4aa){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'](_0x4fd4aa);}function selectNotIn(_0x5243bf,_0x443d63,_0xef0363,_0x29d036,_0x4b13e2){return squel[_0xd7fe('0xf')]()[_0xd7fe('0x10')](_0xd7fe('0x11'))[_0xd7fe('0x12')](_0x29d036)['join'](_0x443d63,null,_0x443d63+_0xd7fe('0x13')+_0x29d036+'.'+_0xef0363)[_0xd7fe('0x14')](_0x29d036+'.'+_0xef0363+_0xd7fe('0x15')+_0x5243bf+'.'+_0xef0363)[_0xd7fe('0x14')](_0x443d63+_0xd7fe('0x16')+_0x4b13e2[_0xd7fe('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1d6ee1,_0x30b632){promisesAdditionalPhones=[];promisesContact=[];return db[_0xd7fe('0x18')][_0xd7fe('0x19')](_0xd7fe('0x1a')+tempTableName)[_0xd7fe('0x1b')](function(_0x59f0c5){if(_0x59f0c5!==null){var _0x27c3be=[];for(var _0x3c8aa7=0x0;_0x3c8aa7<_0x59f0c5[_0xd7fe('0x1c')];_0x3c8aa7++){var _0x38886e=_0x59f0c5[_0x3c8aa7];if(!_['isNil'](_0x38886e[_0xd7fe('0x11')])){if(!_[_0xd7fe('0x1d')](_0x38886e[_0xd7fe('0x1e')]))_0x27c3be[_0xd7fe('0x1f')](insertAdditionalPhones(_0x38886e));promisesContact[_0xd7fe('0x1f')]({'contact':_0x38886e});}}}Promise[_0xd7fe('0x20')](_0x27c3be)[_0xd7fe('0x21')](function(){_0x1d6ee1({'val':0x1});});})[_0xd7fe('0x22')](function(_0xde717e){logger[_0xd7fe('0x23')](_0xde717e['message']);});});}function insertAdditionalPhones(_0x20e2c0){return new Promise(function(_0x4b320b,_0x804a1e){var _0x3a21b6=_0x20e2c0[_0xd7fe('0x1e')];if(_['isNil'](_0x3a21b6))_0x804a1e({'val':0x0});else{var _0x434a52=_0x3a21b6['split'](';');var _0x3c0dac=[];orderBy=0x0;for(var _0x48e6c4=0x0;_0x48e6c4<_0x434a52[_0xd7fe('0x1c')];_0x48e6c4++){_0x3c0dac[_0xd7fe('0x1f')](splitAdditionalPhone(_0x20e2c0['id'],_0x434a52[_0x48e6c4]));}Promise[_0xd7fe('0x20')](_0x3c0dac)[_0xd7fe('0x21')](function(){_0x4b320b({'val':_0x434a52[_0xd7fe('0x1c')]});});}});}function splitAdditionalPhone(_0x1fddc8,_0x14ec4e){return new Promise(function(_0x172596,_0x200810){var _0x4bfce9=_0x14ec4e[_0xd7fe('0x24')](':');var _0x1d9415=_0x4bfce9[0x0];var _0x342af1=_0x4bfce9[0x1];if(_0x342af1!==''){var _0x1e1529=_0x342af1[_0xd7fe('0x24')]('|');var _0x4969f0=[];for(var _0x9bc7cb=0x0;_0x9bc7cb<_0x1e1529[_0xd7fe('0x1c')];_0x9bc7cb++){if(_0x1e1529[_0x9bc7cb]!==''){var _0xfb5ac7=_[_0xd7fe('0x25')](promisesAdditionalPhones,{'contactId':_0x1fddc8,'phone':_0x1e1529[_0x9bc7cb]});if(_0xfb5ac7[_0xd7fe('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xd7fe('0x1f')]({'contactId':_0x1fddc8,'contactTypeId':_0x1d9415,'phone':_0x1e1529[_0x9bc7cb],'orderBy':orderBy});}}}_0x172596({'ok':0x1});}else _0x172596({'res':0x0});});}function createAdditionalPhone(_0x192b77,_0x284452,_0x309f9f,_0x593204){return new Promise(function(_0x1a825e,_0x2651b0){return db[_0xd7fe('0x26')][_0xd7fe('0x27')]({'where':{'CmContactId':_0x192b77,'item':_0x309f9f}})['then'](function(_0x1f189b){if(_0x1f189b){return db[_0xd7fe('0x26')]['update']({'ItemTypeId':_0x284452,'OrderBy':_0x593204},{'where':{'CmContactId':_0x192b77,'item':_0x309f9f}})[_0xd7fe('0x21')](function(_0x374931){_0x1a825e({'res':_0xd7fe('0x28')});});}else{return db[_0xd7fe('0x26')][_0xd7fe('0x29')]({'CmContactId':_0x192b77,'item':_0x309f9f,'ItemTypeId':_0x284452,'OrderBy':_0x593204,'ItemClass':_0xd7fe('0x2a')})['then'](function(_0x539f73){_0x1a825e({'res':_0xd7fe('0x2b')});});}});});}function updateContact(_0x3071bc){return new Promise(function(_0x46969e,_0x34e03e){var _0x109570=_0x3071bc['id'];delete _0x3071bc['id'];return db[_0xd7fe('0x2c')][_0xd7fe('0x2d')](_0x3071bc,{'where':{'id':_0x109570}})[_0xd7fe('0x21')](function(_0x5da563){updatedRows+=0x1;return db[_0xd7fe('0x2e')][_0xd7fe('0x2d')]({'phone':_0x3071bc[_0xd7fe('0x11')]},{'where':{'ContactId':_0x109570}})[_0xd7fe('0x21')](function(_0x1e2be1){_0x46969e({'ret':'OK'});});});});}function insertCmHopper(_0x1cbe74,_0x3e1bc1,_0x17ae41,_0x260e17,_0x53fc30){var _0x385d0b=[_0xd7fe('0x2f'),_0xd7fe('0x30'),_0xd7fe('0x31'),_0xd7fe('0x32'),_0x3e1bc1+'.'+_0x260e17,_0xd7fe('0x33'),_0xd7fe('0x34'),_0xd7fe('0x35'),_0xd7fe('0x36'),'\x22'+_0x53fc30+'\x22'];return squel[_0xd7fe('0x37')]()['into'](_0xd7fe('0x38'))[_0xd7fe('0x39')]([_0xd7fe('0x11'),_0xd7fe('0x3a'),_0xd7fe('0x3b'),_0xd7fe('0x3c'),_0x260e17,'createdAt',_0xd7fe('0x3d'),_0xd7fe('0x3e'),_0xd7fe('0x3f'),_0xd7fe('0x40')],squel[_0xd7fe('0xf')]()['fields'](_0x385d0b)[_0xd7fe('0x12')](_0x3e1bc1)['join'](_0xd7fe('0x41'),null,_0xd7fe('0x42')+_0x3e1bc1+'.CmListId')[_0xd7fe('0x17')](_0x17ae41,null,_0x17ae41+'.id\x20=\x20'+_0x3e1bc1+'.'+_0x260e17)[_0xd7fe('0x14')](_0x3e1bc1+_0xd7fe('0x43'),_0x1cbe74)[_0xd7fe('0x14')](_0xd7fe('0x44'),NOW)[_0xd7fe('0x14')](_0xd7fe('0x45'),selectNotIn(_0x3e1bc1,_0x17ae41,_0x260e17,'cm_hopper',[_0xd7fe('0x46'),_0xd7fe('0x47')]))[_0xd7fe('0x14')](_0xd7fe('0x45'),selectNotIn(_0x3e1bc1,_0x17ae41,_0x260e17,_0xd7fe('0x38'),['\x22always\x22'])))[_0xd7fe('0x48')]();}function insertCmHopperBlack(_0x30e012,_0x134e06,_0x3bd9e1,_0xb42d48){var _0x4a0512=[_0xd7fe('0x2f'),'cm_contacts.id',_0xd7fe('0x32'),_0x134e06+'.'+_0xb42d48,_0xd7fe('0x33'),_0xd7fe('0x34')];return squel['insert']()[_0xd7fe('0x49')]('cm_hopper_black')['fromQuery'](['phone',_0xd7fe('0x3b'),_0xd7fe('0x3c'),_0xb42d48,'createdAt',_0xd7fe('0x3d')],squel[_0xd7fe('0xf')]()[_0xd7fe('0x4a')](_0x4a0512)[_0xd7fe('0x12')](_0x134e06)[_0xd7fe('0x17')](_0xd7fe('0x41'),null,_0xd7fe('0x42')+_0x134e06+_0xd7fe('0x4b'))[_0xd7fe('0x17')](_0x3bd9e1,null,_0x3bd9e1+_0xd7fe('0x13')+_0x134e06+'.'+_0xb42d48)[_0xd7fe('0x14')](_0x134e06+_0xd7fe('0x43'),_0x30e012)[_0xd7fe('0x14')](_0xd7fe('0x44'),NOW)[_0xd7fe('0x14')](_0xd7fe('0x45'),squel['select']()['field']('phone')[_0xd7fe('0x12')](_0xd7fe('0x4c'))['where'](_0xd7fe('0x4d'),_0x30e012)['where'](_0xb42d48+_0xd7fe('0x4e'),_0x134e06+'.'+_0xb42d48)))[_0xd7fe('0x48')]();}function insertCmHopperAdditionalPhones(_0x3b8619){var _0x29938f=['cm_hopper.id',_0xd7fe('0x4f'),_0xd7fe('0x50'),_0xd7fe('0x51'),_0xd7fe('0x52')];return squel[_0xd7fe('0x37')]()['into'](_0xd7fe('0x53'))[_0xd7fe('0x39')]([_0xd7fe('0x54'),_0xd7fe('0x11'),_0xd7fe('0x55'),_0xd7fe('0x56'),_0xd7fe('0x3d')],squel[_0xd7fe('0xf')]()[_0xd7fe('0x4a')](_0x29938f)['from']('cm_hopper')[_0xd7fe('0x17')](_0xd7fe('0x41'),null,_0xd7fe('0x57'))[_0xd7fe('0x17')](_0xd7fe('0x58'),null,_0xd7fe('0x59'))['where'](_0xd7fe('0x5a'),_0x3b8619)[_0xd7fe('0x14')](_0xd7fe('0x44'),NOW))[_0xd7fe('0x48')]();}function insertCmContact(_0x5df59d,_0x4169ee,_0x2bbc4b,_0xa321e7){var _0x129c5c=_['concat'](_[_0xd7fe('0x5b')](_0xa321e7),[_0xd7fe('0x3c'),'CompanyId',_0xd7fe('0x56'),_0xd7fe('0x3d')]);return squel[_0xd7fe('0x37')]()[_0xd7fe('0x49')]('cm_contacts')[_0xd7fe('0x39')](_0x129c5c,squel['select']()['fields'](_0x129c5c)[_0xd7fe('0x12')](_0x4169ee)[_0xd7fe('0x14')]('('+_0x2bbc4b['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xd7fe('0xf')]()[_0xd7fe('0x4a')](_0x2bbc4b)[_0xd7fe('0x12')]('cm_contacts')[_0xd7fe('0x14')](_0xd7fe('0x4d'),_0x5df59d))[_0xd7fe('0x14')](_0xd7fe('0x5c'),squel[_0xd7fe('0xf')]()['field']('MIN(id)',_0xd7fe('0x5d'))['from'](_0x4169ee)[_0xd7fe('0x5e')](_0x2bbc4b[_0xd7fe('0x17')](','))))[_0xd7fe('0x48')]();}function handleStop(){logger[_0xd7fe('0x5f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x439498){logger[_0xd7fe('0x23')](_0x439498[_0xd7fe('0x60')]);process[_0xd7fe('0x61')](0x1);}function handleError(_0x4aa9d2,_0x4247d1){stats[_0xd7fe('0x62')][_0xd7fe('0x1f')]({'name':_0x4247d1['code'],'message':_0x4247d1[_0xd7fe('0x60')],'row':_0x4aa9d2});}function handleQuery(_0x2f2fdb){logger[_0xd7fe('0x5f')](_0x2f2fdb);return db[_0xd7fe('0x18')][_0xd7fe('0x19')](_0x2f2fdb)[_0xd7fe('0x1b')](function(_0x4ad9ec){results[_0xd7fe('0x1f')](_0x4ad9ec);})['catch'](function(_0x3bb777){logger['error'](_0x3bb777['message']);});}function main(_0x40a08d,_0x26ba4f,_0x36e513,_0x5ed0f4){logger[_0xd7fe('0x5f')](_0xd7fe('0x63'),_0x40a08d,JSON[_0xd7fe('0x64')](_0x26ba4f));process['send']('start');var _0x49b085=_0x26ba4f[_0xd7fe('0x65')];var _0x5d1ce7=_[_0xd7fe('0x66')](_0x49b085);var _0x4c3df7=_0x26ba4f[_0xd7fe('0x67')];var _0x2285e5=path['join'](config[_0xd7fe('0x68')],'server/files/tmp',_0x4c3df7+_0xd7fe('0x69'));logger['info']('body',_0x26ba4f);db['ContactItemType'][_0xd7fe('0x6a')]({'raw':!![],'attributes':['id',_0xd7fe('0x6b')]})[_0xd7fe('0x21')](function(_0xe67990){for(var _0x12a4ec=0x0;_0x12a4ec<_0xe67990['length'];_0x12a4ec++){if(_0xe67990[_0x12a4ec][_0xd7fe('0x6b')]in _0x49b085){contactItemTypes[_0xd7fe('0x1f')](_0xe67990[_0x12a4ec]);delete _0x5d1ce7[_0xe67990[_0x12a4ec][_0xd7fe('0x6b')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x5d1ce7[_0xd7fe('0x1e')]='';var _0x246f01=_['keys'](_0x5d1ce7)['join']();logger[_0xd7fe('0x5f')](_0xd7fe('0x6c'),_0x246f01);fs[_0xd7fe('0x6d')](_0x2285e5,_0x246f01+'\x0a');Papa[_0xd7fe('0x6e')](fs[_0xd7fe('0x6f')](_0x40a08d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x7a555b,_0x1f01c0){try{for(var _0x2347e5=0x0,_0x117edd=[];_0x2347e5<_0x7a555b[_0xd7fe('0x70')][_0xd7fe('0x1c')];_0x2347e5++){stats[_0xd7fe('0x71')]+=0x1;if(_0x7a555b['errors'][_0x2347e5]){handleError(_0x7a555b[_0xd7fe('0x70')][_0x2347e5],_0x7a555b[_0xd7fe('0x62')][_0x2347e5]);}else{var _0x46deb2=[];var _0x266700=[];for(var _0x10f8c0 in _0x49b085){let _0x4d22df=contactItemTypes[_0xd7fe('0x72')](_0xc02ad8=>_0xc02ad8[_0xd7fe('0x6b')]===_0x10f8c0);if(_['isNil'](_0x4d22df)){if(_0x49b085[_0xd7fe('0x73')](_0x10f8c0)){if(_0x7a555b['data'][_0x2347e5][_0x49b085[_0x10f8c0]]){var _0x2ed839=_[_0xd7fe('0x74')](_0x7a555b['data'][_0x2347e5][_0x49b085[_0x10f8c0]][_0xd7fe('0x75')](/"/g,'\x27'));switch(_0x10f8c0){case _0xd7fe('0x3a'):var _0x5f3a7f=moment(_0x2ed839,_0xd7fe('0x76'),!![]);if(_0x5f3a7f[_0xd7fe('0x77')]()){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x2ed839+'\x22');}else{_0x46deb2[_0xd7fe('0x1f')](_0xd7fe('0x78'));}break;case _0xd7fe('0x3e'):var _0x16ae5e=parseInt(_0x2ed839);_0x2ed839=_[_0xd7fe('0x79')](_0x16ae5e)||_0x16ae5e<0x0||_0x16ae5e>0x4?_0x5ed0f4?0x3:0x2:_0x16ae5e;_0x117edd['push']('\x22'+_0x2ed839+'\x22');break;case'UserId':var _0xdbe66e=parseInt(_0x2ed839);if(_[_0xd7fe('0x7a')](_0xdbe66e)&&_[_0xd7fe('0x7b')](_0x36e513,_0xdbe66e)){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0xdbe66e+'\x22');}else{_0x46deb2[_0xd7fe('0x1f')](_0xd7fe('0x7c'));}break;case'email':if(isEmail(_0x2ed839)){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x2ed839+'\x22');}else{_0x46deb2[_0xd7fe('0x1f')](_0xd7fe('0x7d'));}break;case _0xd7fe('0x7e'):var _0xa906a9=moment(_0x2ed839,'YYYY-MM-DD',!![]);if(_0xa906a9['isValid']()){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x2ed839+'\x22');}else{_0x46deb2[_0xd7fe('0x1f')](_0xd7fe('0x7f'));}break;default:_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x2ed839+'\x22');}}else{switch(_0x10f8c0){case _0xd7fe('0x80'):case'phone':_0x46deb2[_0xd7fe('0x1f')](_0x10f8c0+_0xd7fe('0x81'));break;default:_0x117edd['push']('\x22\x22');}}}}else{var _0xb4d15='';for(var _0x2f7a90=0x0;_0x2f7a90<_0x49b085[_0x10f8c0][_0xd7fe('0x1c')];_0x2f7a90++){var _0x2ed839=_['trim'](_0x7a555b[_0xd7fe('0x70')][_0x2347e5][_0x49b085[_0x10f8c0][_0x2f7a90]][_0xd7fe('0x75')](/"/g,'\x27'));if(_0xb4d15=='')_0xb4d15=_0x2ed839;else _0xb4d15+='|'+_0x2ed839;}_0x266700[_0xd7fe('0x1f')](_0x4d22df['id']+':'+_0xb4d15);}}if(hasAdditionalPhones){_0x117edd[_0xd7fe('0x1f')]('\x22'+_0x266700['join'](';')+'\x22');}if(_0x46deb2[_0xd7fe('0x1c')]){handleError(_0x7a555b['data'][_0x2347e5],{'code':_0xd7fe('0x82'),'message':_0x46deb2['join']()});}else{fs[_0xd7fe('0x83')](_0x2285e5,_0x117edd[_0xd7fe('0x17')]()+'\x0a');}_0x117edd=[];}if(!(stats['rows']%0xc8)){socket[_0xd7fe('0x84')]('contact:import:'+_0x4c3df7,stats);stats['errors']=[];}}if(stopped){logger[_0xd7fe('0x5f')](_0xd7fe('0x85'));_0x1f01c0[_0xd7fe('0x86')]();}}catch(_0x14a01c){handleError(_0x7a555b[_0xd7fe('0x70')][_0x2347e5],{'code':_0xd7fe('0x87'),'message':_0x14a01c[_0xd7fe('0x60')]});logger['error']('step',_0x14a01c[_0xd7fe('0x60')]);}},'complete':function(){try{var _0x53d6d7=[];var _0x19c000=tempTableName;_0x53d6d7[_0xd7fe('0x1f')](_0xd7fe('0x88')+_0x19c000+'\x20LIKE\x20cm_contacts;');logger[_0xd7fe('0x5f')](_0xd7fe('0x89'),contactItemTypes[_0xd7fe('0x1c')]);var _0xfd1c7e=util[_0xd7fe('0xd')](_0xd7fe('0x8a'),_0x2285e5,_0x19c000,_0x246f01,_0x26ba4f[_0xd7fe('0x3c')],_0x26ba4f[_0xd7fe('0x8b')]||null,NOW,NOW);if(_[_0xd7fe('0x1d')](_0x49b085[_0xd7fe('0x3a')])){_0xfd1c7e+=_0xd7fe('0x8c');}_0x53d6d7[_0xd7fe('0x1f')](_0xfd1c7e);BPromise[_0xd7fe('0x8d')](_0x53d6d7,handleQuery)[_0xd7fe('0x21')](function(_0x35b375){BPromise[_0xd7fe('0x20')]([handleAdditionalPhones()])[_0xd7fe('0x21')](function(){_0x53d6d7=[];for(var _0x45f7b1=0x0;_0x45f7b1\x20\x20');}var _0x1606ad=path[_0xd7fe('0x17')](config[_0xd7fe('0x68')],_0xd7fe('0x97'),process[_0xd7fe('0x96')][0x2]);if(!fs[_0xd7fe('0x98')](_0x1606ad)){throw new Error(_0xd7fe('0x99'));}var _0x1c4415={};try{_0x1c4415=JSON['parse'](process['argv'][0x3]);if(!_0x1c4415[_0xd7fe('0x65')]){throw new Error(_0xd7fe('0x9a'));}var _0x304c5c=0x0;if(_0x1c4415['binding']['UserId']){_0x304c5c=0x1;}if(!_0x1c4415[_0xd7fe('0x3c')]){throw new Error(_0xd7fe('0x9b'));}}catch(_0x126ca0){throw new Error('body\x20id\x20mandatory');}var _0x501c37=[];try{_0x501c37=_[_0xd7fe('0x9c')](JSON['parse'](process[_0xd7fe('0x96')][0x4]),'id');}catch(_0x5a19f0){logger[_0xd7fe('0x5f')]('No\x20agent\x20available');}main(_0x1606ad,_0x1c4415,_0x501c37,_0x304c5c);}validate();process['on'](_0xd7fe('0x9d'),handleStop);process['on'](_0xd7fe('0x9e'),handleUncaughtException); \ No newline at end of file +var _0xadfa=['uncaughtException','path','lodash','papaparse','bluebird','moment','squel','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','push','then','error','message','AdditionalPhones','split','length','all','filter','CmContactHasItem','PHONE','CmContact','update','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','recallme','select','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_hopper_black','from','cm_contacts','field','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','createdAt','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','exit','errors','code','catch','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','parse','data','rows','find','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','SystemRow','appendFileSync','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','emit','contact:import:','unlink','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT'];(function(_0x4a249e,_0x30c270){var _0x4168a4=function(_0x21a830){while(--_0x21a830){_0x4a249e['push'](_0x4a249e['shift']());}};_0x4168a4(++_0x30c270);}(_0xadfa,0x1d5));var _0xaadf=function(_0x40ced5,_0x483c61){_0x40ced5=_0x40ced5-0x0;var _0x58ff15=_0xadfa[_0x40ced5];return _0x58ff15;};'use strict';var fs=require('fs');var path=require(_0xaadf('0x0'));var _=require(_0xaadf('0x1'));var Papa=require(_0xaadf('0x2'));var util=require('util');var BPromise=require(_0xaadf('0x3'));var moment=require(_0xaadf('0x4'));var squel=require(_0xaadf('0x5'));var Redis=require('ioredis');var db=require(_0xaadf('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xaadf('0x7'));config[_0xaadf('0x8')]=_[_0xaadf('0x9')](config[_0xaadf('0x8')],{'host':_0xaadf('0xa'),'port':0x18eb});var socket=require(_0xaadf('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xaadf('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xaadf('0xd')+moment()[_0xaadf('0xc')](_0xaadf('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x48d6f3){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'](_0x48d6f3);}function selectNotIn(_0x4e68f1,_0x5746c0,_0x36714d,_0x2f95ff,_0x570613){return squel['select']()['field'](_0xaadf('0xf'))['from'](_0x2f95ff)[_0xaadf('0x10')](_0x5746c0,null,_0x5746c0+_0xaadf('0x11')+_0x2f95ff+'.'+_0x36714d)[_0xaadf('0x12')](_0x2f95ff+'.'+_0x36714d+_0xaadf('0x13')+_0x4e68f1+'.'+_0x36714d)[_0xaadf('0x12')](_0x5746c0+_0xaadf('0x14')+_0x570613[_0xaadf('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x314f09,_0x5b6aa1){promisesAdditionalPhones=[];promisesContact=[];return db[_0xaadf('0x15')][_0xaadf('0x16')](_0xaadf('0x17')+tempTableName)[_0xaadf('0x18')](function(_0x46e367){if(_0x46e367!==null){var _0xd0c156=[];for(var _0x11491b=0x0;_0x11491b<_0x46e367['length'];_0x11491b++){var _0x22dc12=_0x46e367[_0x11491b];if(!_[_0xaadf('0x19')](_0x22dc12['phone'])){if(!_[_0xaadf('0x19')](_0x22dc12['AdditionalPhones']))_0xd0c156[_0xaadf('0x1a')](insertAdditionalPhones(_0x22dc12));promisesContact[_0xaadf('0x1a')]({'contact':_0x22dc12});}}}Promise['all'](_0xd0c156)[_0xaadf('0x1b')](function(){_0x314f09({'val':0x1});});})['catch'](function(_0x5df00d){logger[_0xaadf('0x1c')](_0x5df00d[_0xaadf('0x1d')]);});});}function insertAdditionalPhones(_0x2f2f11){return new Promise(function(_0x1ec532,_0x4251f7){var _0x3b9b52=_0x2f2f11[_0xaadf('0x1e')];if(_[_0xaadf('0x19')](_0x3b9b52))_0x4251f7({'val':0x0});else{var _0x357049=_0x3b9b52[_0xaadf('0x1f')](';');var _0x358c6f=[];orderBy=0x0;for(var _0x112205=0x0;_0x112205<_0x357049[_0xaadf('0x20')];_0x112205++){_0x358c6f[_0xaadf('0x1a')](splitAdditionalPhone(_0x2f2f11['id'],_0x357049[_0x112205]));}Promise[_0xaadf('0x21')](_0x358c6f)[_0xaadf('0x1b')](function(){_0x1ec532({'val':_0x357049[_0xaadf('0x20')]});});}});}function splitAdditionalPhone(_0x19e063,_0x531c04){return new Promise(function(_0x2d8658,_0xb0523e){var _0x52ef16=_0x531c04[_0xaadf('0x1f')](':');var _0x22a96b=_0x52ef16[0x0];var _0x2f203b=_0x52ef16[0x1];if(_0x2f203b!==''){var _0x28cdf9=_0x2f203b[_0xaadf('0x1f')]('|');var _0x4effbd=[];for(var _0x302fa3=0x0;_0x302fa3<_0x28cdf9[_0xaadf('0x20')];_0x302fa3++){if(_0x28cdf9[_0x302fa3]!==''){var _0x550ac8=_[_0xaadf('0x22')](promisesAdditionalPhones,{'contactId':_0x19e063,'phone':_0x28cdf9[_0x302fa3]});if(_0x550ac8[_0xaadf('0x20')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x19e063,'contactTypeId':_0x22a96b,'phone':_0x28cdf9[_0x302fa3],'orderBy':orderBy});}}}_0x2d8658({'ok':0x1});}else _0x2d8658({'res':0x0});});}function createAdditionalPhone(_0x17eb6f,_0x5c5a09,_0x5dfe71,_0x19cd9c){return new Promise(function(_0x158153,_0x1b9060){return db[_0xaadf('0x23')]['findOne']({'where':{'CmContactId':_0x17eb6f,'item':_0x5dfe71}})[_0xaadf('0x1b')](function(_0x38a444){if(_0x38a444){return db[_0xaadf('0x23')]['update']({'ItemTypeId':_0x5c5a09,'OrderBy':_0x19cd9c},{'where':{'CmContactId':_0x17eb6f,'item':_0x5dfe71}})['then'](function(_0x359b3d){_0x158153({'res':'updated'});});}else{return db[_0xaadf('0x23')]['create']({'CmContactId':_0x17eb6f,'item':_0x5dfe71,'ItemTypeId':_0x5c5a09,'OrderBy':_0x19cd9c,'ItemClass':_0xaadf('0x24')})[_0xaadf('0x1b')](function(_0x593cee){_0x158153({'res':'inserted'});});}});});}function updateContact(_0x1fe6dc){return new Promise(function(_0x2f19ee,_0x11900b){var _0x17ac8e=_0x1fe6dc['id'];delete _0x1fe6dc['id'];return db[_0xaadf('0x25')][_0xaadf('0x26')](_0x1fe6dc,{'where':{'id':_0x17ac8e}})[_0xaadf('0x1b')](function(_0x22c85e){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x1fe6dc[_0xaadf('0xf')]},{'where':{'ContactId':_0x17ac8e}})[_0xaadf('0x1b')](function(_0x3ddb29){_0x2f19ee({'ret':'OK'});});});});}function insertCmHopper(_0x9c1615,_0x2bfa34,_0xda202a,_0x45517c,_0x31c6de){var _0x4ea40a=['cm_contacts.phone',_0xaadf('0x27'),_0xaadf('0x28'),_0xaadf('0x29'),_0x2bfa34+'.'+_0x45517c,_0xaadf('0x2a'),_0xaadf('0x2b'),_0xaadf('0x2c'),_0xaadf('0x2d'),'\x22'+_0x31c6de+'\x22'];return squel[_0xaadf('0x2e')]()[_0xaadf('0x2f')]('cm_hopper')[_0xaadf('0x30')]([_0xaadf('0xf'),_0xaadf('0x31'),_0xaadf('0x32'),_0xaadf('0x33'),_0x45517c,'createdAt',_0xaadf('0x34'),_0xaadf('0x35'),'UserId',_0xaadf('0x36')],squel[_0xaadf('0x37')]()['fields'](_0x4ea40a)['from'](_0x2bfa34)[_0xaadf('0x10')]('cm_contacts',null,_0xaadf('0x38')+_0x2bfa34+_0xaadf('0x39'))[_0xaadf('0x10')](_0xda202a,null,_0xda202a+'.id\x20=\x20'+_0x2bfa34+'.'+_0x45517c)['where'](_0x2bfa34+_0xaadf('0x3a'),_0x9c1615)[_0xaadf('0x12')](_0xaadf('0x3b'),NOW)[_0xaadf('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2bfa34,_0xda202a,_0x45517c,_0xaadf('0x3c'),[_0xaadf('0x3d'),_0xaadf('0x3e')]))[_0xaadf('0x12')](_0xaadf('0x3f'),selectNotIn(_0x2bfa34,_0xda202a,_0x45517c,_0xaadf('0x3c'),[_0xaadf('0x3d')])))[_0xaadf('0x40')]();}function insertCmHopperBlack(_0x613913,_0x529c93,_0x190df1,_0x20b880){var _0x393c2c=[_0xaadf('0x41'),'cm_contacts.id',_0xaadf('0x29'),_0x529c93+'.'+_0x20b880,_0xaadf('0x2a'),'cm_contacts.updatedAt'];return squel[_0xaadf('0x2e')]()[_0xaadf('0x2f')](_0xaadf('0x42'))[_0xaadf('0x30')]([_0xaadf('0xf'),_0xaadf('0x32'),_0xaadf('0x33'),_0x20b880,'createdAt',_0xaadf('0x34')],squel[_0xaadf('0x37')]()['fields'](_0x393c2c)[_0xaadf('0x43')](_0x529c93)[_0xaadf('0x10')](_0xaadf('0x44'),null,_0xaadf('0x38')+_0x529c93+_0xaadf('0x39'))[_0xaadf('0x10')](_0x190df1,null,_0x190df1+_0xaadf('0x11')+_0x529c93+'.'+_0x20b880)[_0xaadf('0x12')](_0x529c93+'.CmListId\x20=\x20?',_0x613913)[_0xaadf('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xaadf('0x12')](_0xaadf('0x3f'),squel[_0xaadf('0x37')]()[_0xaadf('0x45')]('phone')['from']('cm_hopper_black')['where'](_0xaadf('0x46'),_0x613913)[_0xaadf('0x12')](_0x20b880+'\x20=\x20?',_0x529c93+'.'+_0x20b880)))[_0xaadf('0x40')]();}function insertCmHopperAdditionalPhones(_0x3069f2){var _0x4dc4b3=[_0xaadf('0x47'),_0xaadf('0x48'),_0xaadf('0x49'),'cm_contact_has_items.createdAt',_0xaadf('0x4a')];return squel[_0xaadf('0x2e')]()['into'](_0xaadf('0x4b'))['fromQuery']([_0xaadf('0x4c'),_0xaadf('0xf'),_0xaadf('0x4d'),_0xaadf('0x4e'),'updatedAt'],squel[_0xaadf('0x37')]()[_0xaadf('0x4f')](_0x4dc4b3)[_0xaadf('0x43')]('cm_hopper')[_0xaadf('0x10')](_0xaadf('0x44'),null,_0xaadf('0x50'))[_0xaadf('0x10')]('cm_contact_has_items',null,_0xaadf('0x51'))['where'](_0xaadf('0x52'),_0x3069f2)[_0xaadf('0x12')](_0xaadf('0x3b'),NOW))['toString']();}function insertCmContact(_0x4d62c1,_0xce83d3,_0x3fc7bf,_0x188463){var _0x153d30=_['concat'](_[_0xaadf('0x53')](_0x188463),[_0xaadf('0x33'),_0xaadf('0x54'),_0xaadf('0x4e'),'updatedAt']);return squel[_0xaadf('0x2e')]()['into'](_0xaadf('0x44'))[_0xaadf('0x30')](_0x153d30,squel['select']()[_0xaadf('0x4f')](_0x153d30)[_0xaadf('0x43')](_0xce83d3)[_0xaadf('0x12')]('('+_0x3fc7bf[_0xaadf('0x10')](',')+_0xaadf('0x55'),squel[_0xaadf('0x37')]()[_0xaadf('0x4f')](_0x3fc7bf)[_0xaadf('0x43')](_0xaadf('0x44'))[_0xaadf('0x12')]('ListId\x20=\x20?',_0x4d62c1))['where'](_0xaadf('0x56'),squel['select']()[_0xaadf('0x45')](_0xaadf('0x57'),_0xaadf('0x58'))[_0xaadf('0x43')](_0xce83d3)[_0xaadf('0x59')](_0x3fc7bf[_0xaadf('0x10')](','))))[_0xaadf('0x40')]();}function handleStop(){logger[_0xaadf('0x5a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x15e953){logger[_0xaadf('0x1c')](_0x15e953['message']);process[_0xaadf('0x5b')](0x1);}function handleError(_0x5de01a,_0x2fb3c8){stats[_0xaadf('0x5c')][_0xaadf('0x1a')]({'name':_0x2fb3c8[_0xaadf('0x5d')],'message':_0x2fb3c8[_0xaadf('0x1d')],'row':_0x5de01a});}function handleQuery(_0x1899af){logger[_0xaadf('0x5a')](_0x1899af);return db[_0xaadf('0x15')]['query'](_0x1899af)['spread'](function(_0x49a251){results[_0xaadf('0x1a')](_0x49a251);})[_0xaadf('0x5e')](function(_0x57c0fc){logger['error'](_0x57c0fc['message']);});}function main(_0x33588e,_0x327d45,_0x5402a6,_0x445504){logger[_0xaadf('0x5a')](_0xaadf('0x5f'),_0x33588e,JSON['stringify'](_0x327d45));process[_0xaadf('0x60')](_0xaadf('0x61'));var _0x598bf3=_0x327d45[_0xaadf('0x62')];var _0x4ce68b=_['clone'](_0x598bf3);var _0x2dc2f1=_0x327d45[_0xaadf('0x63')];var _0x1b06e0=path['join'](config[_0xaadf('0x64')],_0xaadf('0x65'),_0x2dc2f1+_0xaadf('0x66'));logger['info'](_0xaadf('0x67'),_0x327d45);db[_0xaadf('0x68')][_0xaadf('0x69')]({'raw':!![],'attributes':['id',_0xaadf('0x6a')]})[_0xaadf('0x1b')](function(_0x124f63){for(var _0x3ce0d0=0x0;_0x3ce0d0<_0x124f63[_0xaadf('0x20')];_0x3ce0d0++){if(_0x124f63[_0x3ce0d0][_0xaadf('0x6a')]in _0x598bf3){contactItemTypes[_0xaadf('0x1a')](_0x124f63[_0x3ce0d0]);delete _0x4ce68b[_0x124f63[_0x3ce0d0][_0xaadf('0x6a')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x4ce68b[_0xaadf('0x1e')]='';var _0x5b9eff=_[_0xaadf('0x53')](_0x4ce68b)[_0xaadf('0x10')]();logger[_0xaadf('0x5a')](_0xaadf('0x6b'),_0x5b9eff);fs['writeFileSync'](_0x1b06e0,_0x5b9eff+'\x0a');Papa[_0xaadf('0x6c')](fs['createReadStream'](_0x33588e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2008fa,_0x2884eb){try{for(var _0x160dea=0x0,_0x15774a=[];_0x160dea<_0x2008fa[_0xaadf('0x6d')][_0xaadf('0x20')];_0x160dea++){stats[_0xaadf('0x6e')]+=0x1;if(_0x2008fa['errors'][_0x160dea]){handleError(_0x2008fa[_0xaadf('0x6d')][_0x160dea],_0x2008fa[_0xaadf('0x5c')][_0x160dea]);}else{var _0x23bc4c=[];var _0x19842f=[];for(var _0xde4543 in _0x598bf3){let _0x505b81=contactItemTypes[_0xaadf('0x6f')](_0x4d57cf=>_0x4d57cf[_0xaadf('0x6a')]===_0xde4543);if(_[_0xaadf('0x19')](_0x505b81)){if(_0x598bf3[_0xaadf('0x70')](_0xde4543)){if(_0x2008fa['data'][_0x160dea][_0x598bf3[_0xde4543]]){var _0x4a6300=_['trim'](_0x2008fa[_0xaadf('0x6d')][_0x160dea][_0x598bf3[_0xde4543]][_0xaadf('0x71')](/"/g,'\x27'));switch(_0xde4543){case _0xaadf('0x31'):var _0x59ce7=moment(_0x4a6300,_0xaadf('0x72'),!![]);if(_0x59ce7[_0xaadf('0x73')]()){_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4a6300+'\x22');}else{_0x23bc4c[_0xaadf('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xaadf('0x35'):var _0x130a2d=parseInt(_0x4a6300);_0x4a6300=_[_0xaadf('0x74')](_0x130a2d)||_0x130a2d<0x0||_0x130a2d>0x4?_0x445504?0x3:0x2:_0x130a2d;_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4a6300+'\x22');break;case'UserId':var _0x4939cb=parseInt(_0x4a6300);if(_[_0xaadf('0x75')](_0x4939cb)&&_['includes'](_0x5402a6,_0x4939cb)){_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4939cb+'\x22');}else{_0x23bc4c[_0xaadf('0x1a')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x4a6300)){_0x15774a['push']('\x22'+_0x4a6300+'\x22');}else{_0x23bc4c[_0xaadf('0x1a')](_0xaadf('0x76'));}break;case'dateOfBirth':var _0x699eca=moment(_0x4a6300,_0xaadf('0x77'),!![]);if(_0x699eca[_0xaadf('0x73')]()){_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4a6300+'\x22');}else{_0x23bc4c[_0xaadf('0x1a')](_0xaadf('0x78'));}break;default:_0x15774a[_0xaadf('0x1a')]('\x22'+_0x4a6300+'\x22');}}else{switch(_0xde4543){case _0xaadf('0x79'):case'phone':_0x23bc4c['push'](_0xde4543+_0xaadf('0x7a'));break;default:_0x15774a[_0xaadf('0x1a')]('\x22\x22');}}}}else{var _0x417295='';for(var _0x9ef7c7=0x0;_0x9ef7c7<_0x598bf3[_0xde4543][_0xaadf('0x20')];_0x9ef7c7++){var _0x4a6300=_[_0xaadf('0x7b')](_0x2008fa[_0xaadf('0x6d')][_0x160dea][_0x598bf3[_0xde4543][_0x9ef7c7]][_0xaadf('0x71')](/"/g,'\x27'));if(_0x417295=='')_0x417295=_0x4a6300;else _0x417295+='|'+_0x4a6300;}_0x19842f['push'](_0x505b81['id']+':'+_0x417295);}}if(hasAdditionalPhones){_0x15774a['push']('\x22'+_0x19842f[_0xaadf('0x10')](';')+'\x22');}if(_0x23bc4c[_0xaadf('0x20')]){handleError(_0x2008fa[_0xaadf('0x6d')][_0x160dea],{'code':_0xaadf('0x7c'),'message':_0x23bc4c[_0xaadf('0x10')]()});}else{fs[_0xaadf('0x7d')](_0x1b06e0,_0x15774a['join']()+'\x0a');}_0x15774a=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x2dc2f1,stats);stats[_0xaadf('0x5c')]=[];}}if(stopped){logger[_0xaadf('0x5a')](_0xaadf('0x7e'));_0x2884eb[_0xaadf('0x7f')]();}}catch(_0x5efb19){handleError(_0x2008fa[_0xaadf('0x6d')][_0x160dea],{'code':_0xaadf('0x80'),'message':_0x5efb19[_0xaadf('0x1d')]});logger[_0xaadf('0x1c')](_0xaadf('0x81'),_0x5efb19['message']);}},'complete':function(){try{var _0x22ec89=[];var _0x58e4ea=tempTableName;_0x22ec89[_0xaadf('0x1a')](_0xaadf('0x82')+_0x58e4ea+_0xaadf('0x83'));logger['info'](_0xaadf('0x84'),contactItemTypes[_0xaadf('0x20')]);var _0x3364e5=util[_0xaadf('0xc')](_0xaadf('0x85'),_0x1b06e0,_0x58e4ea,_0x5b9eff,_0x327d45[_0xaadf('0x33')],_0x327d45[_0xaadf('0x54')]||null,NOW,NOW);if(_[_0xaadf('0x19')](_0x598bf3['scheduledat'])){_0x3364e5+=_0xaadf('0x86');}_0x22ec89['push'](_0x3364e5);BPromise['each'](_0x22ec89,handleQuery)[_0xaadf('0x1b')](function(_0x59373a){BPromise[_0xaadf('0x21')]([handleAdditionalPhones()])[_0xaadf('0x1b')](function(){_0x22ec89=[];for(var _0x5b2344=0x0;_0x5b2344=_0x39469d){return _0x413237['status'](0x193)[_0x5e17('0x11')]({'message':util[_0x5e17('0x12')](_0x5e17('0x13'),_0x83df27)});}_0x314659();})[_0x5e17('0x14')](function(_0x19d4f5){_0x314659(_0x19d4f5);});});}function isUserLimit(){return isLimit(_0x5e17('0x15'),0x1,db[_0x5e17('0x16')],{'where':{'$or':[{'role':_0x5e17('0x17')},{'role':_0x5e17('0x18')}]}});}exports[_0x5e17('0x19')]=isUserLimit; \ No newline at end of file +var _0x370e=['createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','use','License','findOne','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','split'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0x370e,0x1f1));var _0xe370=function(_0x28407e,_0x826b8){_0x28407e=_0x28407e-0x0;var _0x3d6773=_0x370e[_0x28407e];return _0x3d6773;};'use strict';var crypto=require(_0xe370('0x0'));var util=require(_0xe370('0x1'));var compose=require(_0xe370('0x2'));var db=require(_0xe370('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3ed3c4,_0x5cfdf8){if(_0x3ed3c4&&_0x5cfdf8){if(_0x5cfdf8[_0xe370('0x4')]&&_0x5cfdf8[_0xe370('0x5')]){var _0x283bff=_0x5cfdf8[_0xe370('0x4')];var _0x4564ca=_0x5cfdf8[_0xe370('0x5')];var _0xcbd403=_0x283bff[_0xe370('0x6')]('-')[0x4];var _0x2625a1=_0x283bff['split']('-')[0x0];var _0x3e4830=crypto[_0xe370('0x7')](_0xe370('0x8'),util[_0xe370('0x9')](_0xe370('0xa'),_0xcbd403,_0x283bff,_0x2625a1));var _0x20613b=_0x3e4830[_0xe370('0xb')](_0x4564ca,_0xe370('0xc'),_0xe370('0xd'));_0x20613b+=_0x3e4830[_0xe370('0xe')]('utf8');var _0x54f3cb=JSON[_0xe370('0xf')](_0x20613b);return _0x54f3cb['hasOwnProperty'](_0x3ed3c4)?_0x54f3cb[_0x3ed3c4]:null;}}return null;}function isLimit(_0x5afd7c,_0x4b811e,_0x5d017f,_0x18db05){var _0x125e9b=_0x4b811e;return compose()[_0xe370('0x10')](function(_0x25248a,_0x407fa2,_0x22574a){return db[_0xe370('0x11')][_0xe370('0x12')]({'where':{'id':0x1},'raw':!![]})[_0xe370('0x13')](function(_0x4fd3c7){var _0x6a405d=getValueFromLicense(_0x5afd7c,_0x4fd3c7);return _0x6a405d?_0x6a405d:_0x125e9b;})[_0xe370('0x13')](function(_0x2eaaf1){_0x125e9b=_0x2eaaf1;return _0x5d017f[_0xe370('0x14')](_0x18db05);})[_0xe370('0x13')](function(_0x44a4ae){if(_0x44a4ae>=_0x125e9b){return _0x407fa2[_0xe370('0x15')](0x193)['json']({'message':util[_0xe370('0x9')](_0xe370('0x16'),_0x5afd7c)});}_0x22574a();})[_0xe370('0x17')](function(_0x3547d8){_0x22574a(_0x3547d8);});});}function isUserLimit(){return isLimit(_0xe370('0x18'),0x1,db['User'],{'where':{'$or':[{'role':_0xe370('0x19')},{'role':_0xe370('0x1a')}]}});}exports[_0xe370('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 69773bd..68f52cf 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 _0xeb1b=['$startsWith','shift','pop','utcOffset','hours','minutes','seconds','format','lodash','moment','startsWith','[$or]','and','replace','split','slice','forEach','match','filter','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','castTo','CAST(','\x20AS\x20','text','field','$ne','$notIn','$in','IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$substring','start'];(function(_0x38d9c2,_0x10fe14){var _0x5bf078=function(_0x585102){while(--_0x585102){_0x38d9c2['push'](_0x38d9c2['shift']());}};_0x5bf078(++_0x10fe14);}(_0xeb1b,0x6c));var _0xbeb1=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeb1b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xbeb1('0x0'));var moment=require(_0xbeb1('0x1'));exports['parseSearch']=function(_0x52f83b){var _0x2f4a92={'conditions':[]};_0x2f4a92['sqlOperator']=_[_0xbeb1('0x2')](_0x52f83b,_0xbeb1('0x3'))?'or':_0xbeb1('0x4');var _0x118397=_0x52f83b[_0xbeb1('0x5')]('[$and]','')[_0xbeb1('0x5')](_0xbeb1('0x3'),'')[_0xbeb1('0x6')]('||');for(var _0x454f14=0x0;_0x454f14<_0x118397['length'];_0x454f14++){var _0x444442=_0x118397[_0x454f14][_0xbeb1('0x6')](':=');var _0x2b7976=_0x444442[0x0];var _0x538732=_0x444442[_0xbeb1('0x7')](0x1);_0x538732[_0xbeb1('0x8')](function(_0x58e3b5){var _0x258b83=_0x58e3b5[_0xbeb1('0x6')]('[')['shift']();var _0x2f86c9=_0x58e3b5[_0xbeb1('0x9')](/\[(.*?)\]/g);_0x2f86c9[_0xbeb1('0x8')](function(_0x2d5af3){var _0x34f773=_0x2d5af3['split']('[')[_0xbeb1('0xa')](function(_0x5de01d){return _0x5de01d['indexOf'](']')>-0x1;})['map'](function(_0x5bafaf){return _0x5bafaf[_0xbeb1('0x6')](']')[0x0];})[0x0];_0x2f4a92[_0xbeb1('0xb')][_0xbeb1('0xc')]({'field':_0x2b7976,'operator':_0x258b83,'value':_0x34f773});});});}return _0x2f4a92;};exports[_0xbeb1('0xd')]=function(_0x33b4ab,_0x24ab94,_0x460167){var _0x4c9ba3={};if(_0x24ab94===_0xbeb1('0xe')){if(_0x460167[_0xbeb1('0xf')]===_0xbeb1('0x10')){_0x460167[_0xbeb1('0xf')]=_0xbeb1('0x11');_0x460167[_0xbeb1('0x12')]+=','+_0x460167[_0xbeb1('0x12')];}else if(_[_0xbeb1('0x13')]([_0xbeb1('0x14'),_0xbeb1('0x15')],_0x460167[_0xbeb1('0xf')])){_0x460167[_0xbeb1('0x12')]=moment(_0x460167[_0xbeb1('0x12')])[_0xbeb1('0x16')](0x1,'days')['format']('YYYY-MM-DD');}}if(_0x460167[_0xbeb1('0x17')]){_0x24ab94=_0x460167[_0xbeb1('0x17')];_0x4c9ba3['text']=_0xbeb1('0x18')+_0x33b4ab+'.'+_0x460167['field']+_0xbeb1('0x19')+_0x460167['castTo']+')\x20'+parseOperator(_0x460167[_0xbeb1('0xf')]);}else{_0x4c9ba3[_0xbeb1('0x1a')]=_0x33b4ab+'.'+_0x460167[_0xbeb1('0x1b')]+'\x20'+parseOperator(_0x460167['operator']);}if(_[_0xbeb1('0x13')]([_0xbeb1('0x1c'),_0xbeb1('0x1d')],_0x460167['operator']))_0x4c9ba3['text']='('+_0x4c9ba3['text']+'\x20OR\x20'+_0x33b4ab+'.'+_0x460167[_0xbeb1('0x1b')]+'\x20IS\x20NULL)';_0x4c9ba3[_0xbeb1('0x12')]=parseValue(_0x24ab94,_0x460167[_0xbeb1('0xf')],_0x460167['value']);return _0x4c9ba3;};function parseOperator(_0x50e01d){var _0x1fdb63;switch(_0x50e01d){case _0xbeb1('0x1e'):_0x1fdb63=_0xbeb1('0x1f');break;case _0xbeb1('0x1d'):_0x1fdb63='NOT\x20IN\x20?';break;case _0xbeb1('0x10'):_0x1fdb63=_0xbeb1('0x20');break;case'$ne':_0x1fdb63=_0xbeb1('0x21');break;case'$substring':case'$startsWith':case _0xbeb1('0x22'):_0x1fdb63=_0xbeb1('0x23');break;case'$lt':_0x1fdb63='<\x20?';break;case _0xbeb1('0x14'):_0x1fdb63=_0xbeb1('0x24');break;case _0xbeb1('0x15'):_0x1fdb63=_0xbeb1('0x25');break;case'$gte':_0x1fdb63=_0xbeb1('0x26');break;case _0xbeb1('0x11'):_0x1fdb63=_0xbeb1('0x27');break;}return _0x1fdb63;}function parseValue(_0xafa8c1,_0x54233c,_0x14dddb){var _0x21f98c={'start':undefined,'end':undefined};switch(_0x54233c){case _0xbeb1('0x1e'):case _0xbeb1('0x1d'):_0x21f98c['start']=_0x14dddb['split'](',');break;case _0xbeb1('0x28'):_0x21f98c[_0xbeb1('0x29')]='%'+_0x14dddb+'%';break;case _0xbeb1('0x2a'):_0x21f98c[_0xbeb1('0x29')]=_0x14dddb+'%';break;case _0xbeb1('0x22'):_0x21f98c[_0xbeb1('0x29')]='%'+_0x14dddb;break;case _0xbeb1('0x11'):var _0x85e9c1=_0x14dddb[_0xbeb1('0x6')](',');var _0x14dddb=_0x85e9c1[_0xbeb1('0x2b')]();var _0x1731d7=_0x85e9c1[_0xbeb1('0x2c')]();if(_0xafa8c1===_0xbeb1('0xe')){_0x14dddb=moment(_0x14dddb)[_0xbeb1('0x2d')](0x0,!![])['format']();_0x1731d7=moment(_0x1731d7)[_0xbeb1('0x2d')](0x0,!![])['add'](0x17,_0xbeb1('0x2e'))['add'](0x3b,_0xbeb1('0x2f'))[_0xbeb1('0x16')](0x3b,_0xbeb1('0x30'))[_0xbeb1('0x31')]();}_0x21f98c={'start':_0x14dddb,'end':_0x1731d7};break;default:_0x21f98c[_0xbeb1('0x29')]=_0x14dddb;break;}return _0x21f98c;} \ No newline at end of file +var _0xe999=['[$or]','and','replace','split','length','forEach','filter','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','hours','minutes','seconds','moment'];(function(_0x55c120,_0x3c7bfe){var _0x52dc57=function(_0x68432f){while(--_0x68432f){_0x55c120['push'](_0x55c120['shift']());}};_0x52dc57(++_0x3c7bfe);}(_0xe999,0x1e5));var _0x9e99=function(_0x26c7d3,_0x31be42){_0x26c7d3=_0x26c7d3-0x0;var _0x430566=_0xe999[_0x26c7d3];return _0x430566;};'use strict';var _=require('lodash');var moment=require(_0x9e99('0x0'));exports['parseSearch']=function(_0xc0f93){var _0x34723b={'conditions':[]};_0x34723b['sqlOperator']=_['startsWith'](_0xc0f93,_0x9e99('0x1'))?'or':_0x9e99('0x2');var _0x56d99e=_0xc0f93[_0x9e99('0x3')]('[$and]','')[_0x9e99('0x3')](_0x9e99('0x1'),'')[_0x9e99('0x4')]('||');for(var _0x507308=0x0;_0x507308<_0x56d99e[_0x9e99('0x5')];_0x507308++){var _0x1debb5=_0x56d99e[_0x507308]['split'](':=');var _0x156a89=_0x1debb5[0x0];var _0x32d636=_0x1debb5['slice'](0x1);_0x32d636[_0x9e99('0x6')](function(_0x39f139){var _0x5ab581=_0x39f139[_0x9e99('0x4')]('[')['shift']();var _0xbc5bd6=_0x39f139['match'](/\[(.*?)\]/g);_0xbc5bd6[_0x9e99('0x6')](function(_0x1f6955){var _0x4255f3=_0x1f6955[_0x9e99('0x4')]('[')[_0x9e99('0x7')](function(_0x349cc1){return _0x349cc1[_0x9e99('0x8')](']')>-0x1;})[_0x9e99('0x9')](function(_0x3d4279){return _0x3d4279[_0x9e99('0x4')](']')[0x0];})[0x0];_0x34723b[_0x9e99('0xa')]['push']({'field':_0x156a89,'operator':_0x5ab581,'value':_0x4255f3});});});}return _0x34723b;};exports[_0x9e99('0xb')]=function(_0x52e766,_0x39f4d0,_0x176ea7){var _0x556613={};if(_0x39f4d0===_0x9e99('0xc')){if(_0x176ea7[_0x9e99('0xd')]===_0x9e99('0xe')){_0x176ea7[_0x9e99('0xd')]=_0x9e99('0xf');_0x176ea7[_0x9e99('0x10')]+=','+_0x176ea7[_0x9e99('0x10')];}else if(_[_0x9e99('0x11')](['$gt',_0x9e99('0x12')],_0x176ea7['operator'])){_0x176ea7['value']=moment(_0x176ea7[_0x9e99('0x10')])[_0x9e99('0x13')](0x1,_0x9e99('0x14'))[_0x9e99('0x15')](_0x9e99('0x16'));}}if(_0x176ea7[_0x9e99('0x17')]){_0x39f4d0=_0x176ea7[_0x9e99('0x17')];_0x556613[_0x9e99('0x18')]='CAST('+_0x52e766+'.'+_0x176ea7[_0x9e99('0x19')]+_0x9e99('0x1a')+_0x176ea7[_0x9e99('0x17')]+')\x20'+parseOperator(_0x176ea7[_0x9e99('0xd')]);}else{_0x556613[_0x9e99('0x18')]=_0x52e766+'.'+_0x176ea7[_0x9e99('0x19')]+'\x20'+parseOperator(_0x176ea7[_0x9e99('0xd')]);}if(_[_0x9e99('0x11')](['$ne',_0x9e99('0x1b')],_0x176ea7[_0x9e99('0xd')]))_0x556613['text']='('+_0x556613[_0x9e99('0x18')]+_0x9e99('0x1c')+_0x52e766+'.'+_0x176ea7[_0x9e99('0x19')]+_0x9e99('0x1d');_0x556613[_0x9e99('0x10')]=parseValue(_0x39f4d0,_0x176ea7[_0x9e99('0xd')],_0x176ea7[_0x9e99('0x10')]);return _0x556613;};function parseOperator(_0x436041){var _0x5f15df;switch(_0x436041){case _0x9e99('0x1e'):_0x5f15df=_0x9e99('0x1f');break;case _0x9e99('0x1b'):_0x5f15df=_0x9e99('0x20');break;case _0x9e99('0xe'):_0x5f15df=_0x9e99('0x21');break;case _0x9e99('0x22'):_0x5f15df=_0x9e99('0x23');break;case _0x9e99('0x24'):case _0x9e99('0x25'):case'$endsWith':_0x5f15df=_0x9e99('0x26');break;case _0x9e99('0x27'):_0x5f15df=_0x9e99('0x28');break;case _0x9e99('0x29'):_0x5f15df=_0x9e99('0x2a');break;case _0x9e99('0x12'):_0x5f15df=_0x9e99('0x2b');break;case _0x9e99('0x2c'):_0x5f15df=_0x9e99('0x2d');break;case _0x9e99('0xf'):_0x5f15df=_0x9e99('0x2e');break;}return _0x5f15df;}function parseValue(_0x4f1cdc,_0x168e74,_0x3251b0){var _0x393dbc={'start':undefined,'end':undefined};switch(_0x168e74){case _0x9e99('0x1e'):case _0x9e99('0x1b'):_0x393dbc[_0x9e99('0x2f')]=_0x3251b0[_0x9e99('0x4')](',');break;case _0x9e99('0x24'):_0x393dbc[_0x9e99('0x2f')]='%'+_0x3251b0+'%';break;case'$startsWith':_0x393dbc['start']=_0x3251b0+'%';break;case _0x9e99('0x30'):_0x393dbc[_0x9e99('0x2f')]='%'+_0x3251b0;break;case _0x9e99('0xf'):var _0x1f1d98=_0x3251b0[_0x9e99('0x4')](',');var _0x3251b0=_0x1f1d98['shift']();var _0x2a139e=_0x1f1d98[_0x9e99('0x31')]();if(_0x4f1cdc===_0x9e99('0xc')){_0x3251b0=moment(_0x3251b0)[_0x9e99('0x32')](0x0,!![])[_0x9e99('0x15')]();_0x2a139e=moment(_0x2a139e)[_0x9e99('0x32')](0x0,!![])[_0x9e99('0x13')](0x17,_0x9e99('0x33'))[_0x9e99('0x13')](0x3b,_0x9e99('0x34'))[_0x9e99('0x13')](0x3b,_0x9e99('0x35'))[_0x9e99('0x15')]();}_0x393dbc={'start':_0x3251b0,'end':_0x2a139e};break;default:_0x393dbc[_0x9e99('0x2f')]=_0x3251b0;break;}return _0x393dbc;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index afdc6d1..4407c1e 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 _0x547b=['^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','join','lodash','sequelize','split','filters','isEmpty','forOwn','find','type','DATE','parse','$gte','format','YYYY-MM-DD','utc','$lte','isArray','limit','offset','sort','map','indexOf','cast','col','priority','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match'];(function(_0x3ebcaa,_0x47cb0e){var _0x43fa28=function(_0x51300e){while(--_0x51300e){_0x3ebcaa['push'](_0x3ebcaa['shift']());}};_0x43fa28(++_0x47cb0e);}(_0x547b,0x1b5));var _0xb547=function(_0x1829ba,_0x5aa98a){_0x1829ba=_0x1829ba-0x0;var _0xf671ce=_0x547b[_0x1829ba];return _0xf671ce;};'use strict';var _=require(_0xb547('0x0'));var sequelize=require(_0xb547('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x1d3cea){var _0x56aebc=null;if(_0x1d3cea){_0x56aebc=_0x1d3cea[_0xb547('0x2')](',');}return _0x56aebc;};exports[_0xb547('0x3')]=function(_0x578a5d,_0xc6533d){var _0x378067={};if(!_[_0xb547('0x4')](_0x578a5d)){_[_0xb547('0x5')](_0x578a5d,function(_0x146eb7,_0x2b9508){try{if(_0xc6533d){var _0x3325b7=_[_0xb547('0x6')](_0xc6533d,{'name':_0x2b9508})||{};if(_0x3325b7[_0xb547('0x7')]===_0xb547('0x8')&&_['isPlainObject'](_0x146eb7)){var _0x33120c=JSON[_0xb547('0x9')](_0x146eb7);var _0x4529be={'$gte':moment(moment(_0x33120c[_0xb547('0xa')])[_0xb547('0xb')](_0xb547('0xc')))[_0xb547('0xd')]()[_0xb547('0xb')](),'$lte':moment(moment(_0x33120c[_0xb547('0xe')])['format']('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0xb547('0xb')]()};_0x378067[_0x2b9508]=_0x4529be;}else{_0x378067[_0x2b9508]=_[_0xb547('0xf')](_0x146eb7)?_0x146eb7:JSON[_0xb547('0x9')](_0x146eb7);}}else{_0x378067[_0x2b9508]=_[_0xb547('0xf')](_0x146eb7)?_0x146eb7:JSON['parse'](_0x146eb7);}}catch(_0x2135d8){_0x378067[_0x2b9508]=_0x146eb7[_0xb547('0x2')](',');}});}return _0x378067;};exports[_0xb547('0x10')]=function(_0x21a40d){_0x21a40d=parseInt(_0x21a40d,0xa);if(!_0x21a40d||_0x21a40d<0x0){_0x21a40d=LIMIT_VALUE;}return _0x21a40d;};exports[_0xb547('0x11')]=function(_0x194380){_0x194380=parseInt(_0x194380,0xa);if(!_0x194380||_0x194380<0x0){_0x194380=0x0;}return _0x194380;};exports[_0xb547('0x12')]=function(_0x11b352){var _0x3ca4ac,_0x32798c=null;if(_0x11b352){_0x3ca4ac=_0x11b352[_0xb547('0x2')](',');_0x32798c=_[_0xb547('0x13')](_0x3ca4ac,function(_0x271f9a){if(_0x271f9a[_0xb547('0x14')]('-')===0x0){return[_0x271f9a==='priority'?sequelize[_0xb547('0x15')](sequelize[_0xb547('0x16')](_0xb547('0x17')),_0xb547('0x18')):_0x271f9a[_0xb547('0x19')](0x1),_0xb547('0x1a')];}else{return[_0x271f9a==='priority'?sequelize[_0xb547('0x15')](sequelize[_0xb547('0x16')](_0xb547('0x17')),_0xb547('0x18')):_0x271f9a,_0xb547('0x1b')];}});}return _0x32798c;};exports[_0xb547('0x1c')]=function(_0x4f54f0,_0x563960){if(_['isEmpty'](_0x4f54f0)){return _0x4f54f0;}if(_['isArray'](_0x4f54f0)){for(var _0x1f219d=0x0;_0x1f219d<_0x4f54f0[_0xb547('0x1d')];_0x1f219d+=0x1){_0x4f54f0[_0x1f219d]=this[_0xb547('0x1c')](_0x4f54f0[_0x1f219d],_0x563960);}return _0x4f54f0;}if(!_[_0xb547('0x1e')](_0x4f54f0)){return _0x4f54f0;}if(_[_0xb547('0x1f')](_0x563960)){_0x563960=[_0x563960];}if(!_[_0xb547('0xf')](_0x563960)){return _0x4f54f0;}for(var _0x58fa0f=0x0;_0x58fa0f<_0x563960[_0xb547('0x1d')];_0x58fa0f+=0x1){_[_0xb547('0x20')](_0x4f54f0,_0x563960[_0x58fa0f]);}for(var _0x9ed5bc in _0x4f54f0){if(_0x4f54f0[_0xb547('0x21')](_0x9ed5bc)){_0x4f54f0[_0x9ed5bc]=this[_0xb547('0x1c')](_0x4f54f0[_0x9ed5bc],_0x563960);}}return _0x4f54f0;};exports[_0xb547('0x22')]=function(_0x2caef3){return _0x2caef3[_0xb547('0x23')](RegExp(_0xb547('0x24')))?!![]:![];};exports[_0xb547('0x25')]=function(_0x3254f7){return _0x3254f7['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xb547('0x26')]=function(_0x4d3424){var _0x51a883=[];_0x4d3424[_0xb547('0x2')]('\x20')[_0xb547('0x27')](function(_0x46f6b8){_0x51a883[_0xb547('0x28')]('+'+_0x46f6b8[_0xb547('0x29')]()+'*');});return _0x51a883[_0xb547('0x2a')]('\x20');}; \ No newline at end of file +var _0xa547=['format','$lte','YYYY-MM-DD','subtract','isArray','limit','offset','priority','cast','unsigned','DESC','col','ASC','omit','isEmpty','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','getFullTextValue','forEach','push','toString','join','sequelize','fields','split','filters','forOwn','DATE','isPlainObject','parse','utc'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa547,0xb0));var _0x7a54=function(_0x42d966,_0x4888f3){_0x42d966=_0x42d966-0x0;var _0x50e3b6=_0xa547[_0x42d966];return _0x50e3b6;};'use strict';var _=require('lodash');var sequelize=require(_0x7a54('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x7a54('0x1')]=function(_0x5b6b4d){var _0x1908ee=null;if(_0x5b6b4d){_0x1908ee=_0x5b6b4d[_0x7a54('0x2')](',');}return _0x1908ee;};exports[_0x7a54('0x3')]=function(_0x335731,_0x2e210c){var _0xe681d1={};if(!_['isEmpty'](_0x335731)){_[_0x7a54('0x4')](_0x335731,function(_0x2a6b1a,_0xdeaa1c){try{if(_0x2e210c){var _0x3f5dd7=_['find'](_0x2e210c,{'name':_0xdeaa1c})||{};if(_0x3f5dd7['type']===_0x7a54('0x5')&&_[_0x7a54('0x6')](_0x2a6b1a)){var _0x97f971=JSON[_0x7a54('0x7')](_0x2a6b1a);var _0x226d36={'$gte':moment(moment(_0x97f971['$gte'])['format']('YYYY-MM-DD'))[_0x7a54('0x8')]()[_0x7a54('0x9')](),'$lte':moment(moment(_0x97f971[_0x7a54('0xa')])[_0x7a54('0x9')](_0x7a54('0xb')))[_0x7a54('0x8')]()[_0x7a54('0xc')](0x1,'s')[_0x7a54('0x9')]()};_0xe681d1[_0xdeaa1c]=_0x226d36;}else{_0xe681d1[_0xdeaa1c]=_[_0x7a54('0xd')](_0x2a6b1a)?_0x2a6b1a:JSON[_0x7a54('0x7')](_0x2a6b1a);}}else{_0xe681d1[_0xdeaa1c]=_[_0x7a54('0xd')](_0x2a6b1a)?_0x2a6b1a:JSON[_0x7a54('0x7')](_0x2a6b1a);}}catch(_0x545363){_0xe681d1[_0xdeaa1c]=_0x2a6b1a[_0x7a54('0x2')](',');}});}return _0xe681d1;};exports[_0x7a54('0xe')]=function(_0x2fb211){_0x2fb211=parseInt(_0x2fb211,0xa);if(!_0x2fb211||_0x2fb211<0x0){_0x2fb211=LIMIT_VALUE;}return _0x2fb211;};exports[_0x7a54('0xf')]=function(_0x5c13bc){_0x5c13bc=parseInt(_0x5c13bc,0xa);if(!_0x5c13bc||_0x5c13bc<0x0){_0x5c13bc=0x0;}return _0x5c13bc;};exports['sort']=function(_0x5adf0d){var _0x5e567f,_0x3c63ad=null;if(_0x5adf0d){_0x5e567f=_0x5adf0d[_0x7a54('0x2')](',');_0x3c63ad=_['map'](_0x5e567f,function(_0x1fcc0d){if(_0x1fcc0d['indexOf']('-')===0x0){return[_0x1fcc0d===_0x7a54('0x10')?sequelize[_0x7a54('0x11')](sequelize['col'](_0x7a54('0x10')),_0x7a54('0x12')):_0x1fcc0d['substr'](0x1),_0x7a54('0x13')];}else{return[_0x1fcc0d==='priority'?sequelize[_0x7a54('0x11')](sequelize[_0x7a54('0x14')](_0x7a54('0x10')),_0x7a54('0x12')):_0x1fcc0d,_0x7a54('0x15')];}});}return _0x3c63ad;};exports[_0x7a54('0x16')]=function(_0x11bc93,_0x3c2b51){if(_[_0x7a54('0x17')](_0x11bc93)){return _0x11bc93;}if(_[_0x7a54('0xd')](_0x11bc93)){for(var _0x5049a0=0x0;_0x5049a0<_0x11bc93[_0x7a54('0x18')];_0x5049a0+=0x1){_0x11bc93[_0x5049a0]=this[_0x7a54('0x16')](_0x11bc93[_0x5049a0],_0x3c2b51);}return _0x11bc93;}if(!_[_0x7a54('0x19')](_0x11bc93)){return _0x11bc93;}if(_[_0x7a54('0x1a')](_0x3c2b51)){_0x3c2b51=[_0x3c2b51];}if(!_[_0x7a54('0xd')](_0x3c2b51)){return _0x11bc93;}for(var _0x3e4d04=0x0;_0x3e4d04<_0x3c2b51[_0x7a54('0x18')];_0x3e4d04+=0x1){_[_0x7a54('0x1b')](_0x11bc93,_0x3c2b51[_0x3e4d04]);}for(var _0x4d5dfc in _0x11bc93){if(_0x11bc93[_0x7a54('0x1c')](_0x4d5dfc)){_0x11bc93[_0x4d5dfc]=this[_0x7a54('0x16')](_0x11bc93[_0x4d5dfc],_0x3c2b51);}}return _0x11bc93;};exports[_0x7a54('0x1d')]=function(_0xfd3021){return _0xfd3021[_0x7a54('0x1e')](RegExp(_0x7a54('0x1f')))?!![]:![];};exports['isEmail']=function(_0x223d3a){return _0x223d3a[_0x7a54('0x1e')](/^\S+@\S+$/)?!![]:![];};exports[_0x7a54('0x20')]=function(_0x1010b2){var _0x11f927=[];_0x1010b2[_0x7a54('0x2')]('\x20')[_0x7a54('0x21')](function(_0x150577){_0x11f927[_0x7a54('0x22')]('+'+_0x150577[_0x7a54('0x23')]()+'*');});return _0x11f927[_0x7a54('0x24')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 5bd09bd..78e6215 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9350=['moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','development','json\x20replacer','toISOString','split','use','static','/server/views','engine','ejs','view\x20engine','html','json','50mb','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9350,0xdf));var _0x0935=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x9350[_0x5b561d];return _0x431060;};'use strict';var express=require(_0x0935('0x0'));var favicon=require(_0x0935('0x1'));var bodyParser=require(_0x0935('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x0935('0x3'));var errorHandler=require(_0x0935('0x4'));var path=require(_0x0935('0x5'));var passport=require(_0x0935('0x6'));var cors=require(_0x0935('0x7'));var moment=require(_0x0935('0x8'));var config=require(_0x0935('0x9'));var db=require(_0x0935('0xa'))['db'];exports[_0x0935('0xb')]=function(_0x24bbbc){var _0x1e525b=_0x24bbbc[_0x0935('0xc')](_0x0935('0xd'));if(_0x1e525b===_0x0935('0xe')){_0x24bbbc[_0x0935('0xf')](_0x0935('0x10'),path[_0x0935('0x11')](config[_0x0935('0x12')],'public'));}if(_0x1e525b===_0x0935('0x13')||_0x1e525b==='test'){_0x24bbbc['set'](_0x0935('0x10'),path[_0x0935('0x11')](config[_0x0935('0x12')],'client'));_0x24bbbc['use'](errorHandler());}_0x24bbbc[_0x0935('0xf')](_0x0935('0x14'),function(_0x1da8b2,_0x40f4ed){if(this[_0x1da8b2]instanceof Date){_0x40f4ed=this[_0x1da8b2][_0x0935('0x15')]()[_0x0935('0x16')]('.')[0x0]+'Z';}return _0x40f4ed;});_0x24bbbc[_0x0935('0x17')](express[_0x0935('0x18')](_0x24bbbc[_0x0935('0xc')](_0x0935('0x10'))));_0x24bbbc['set']('views',config[_0x0935('0x12')]+_0x0935('0x19'));_0x24bbbc[_0x0935('0x1a')]('html',require(_0x0935('0x1b'))['renderFile']);_0x24bbbc[_0x0935('0xf')](_0x0935('0x1c'),_0x0935('0x1d'));_0x24bbbc[_0x0935('0x17')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x24bbbc['use'](bodyParser[_0x0935('0x1e')]({'limit':_0x0935('0x1f')}));_0x24bbbc['use'](cors());_0x24bbbc[_0x0935('0x17')](methodOverride());_0x24bbbc[_0x0935('0x17')](cookieParser());_0x24bbbc[_0x0935('0x17')](passport[_0x0935('0x20')]());}; \ No newline at end of file +var _0x56e7=['method-override','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','get','production','set','appPath','join','public','development','test','root','client','use','json\x20replacer','toISOString','split','static','views','engine','html','view\x20engine','urlencoded','50mb','initialize','express','serve-favicon','body-parser'];(function(_0x1db505,_0xe59764){var _0x4d71ea=function(_0x24bb63){while(--_0x24bb63){_0x1db505['push'](_0x1db505['shift']());}};_0x4d71ea(++_0xe59764);}(_0x56e7,0x147));var _0x756e=function(_0xb4fe2c,_0x3d2be6){_0xb4fe2c=_0xb4fe2c-0x0;var _0x460a1a=_0x56e7[_0xb4fe2c];return _0x460a1a;};'use strict';var express=require(_0x756e('0x0'));var favicon=require(_0x756e('0x1'));var bodyParser=require(_0x756e('0x2'));var methodOverride=require(_0x756e('0x3'));var cookieParser=require(_0x756e('0x4'));var errorHandler=require(_0x756e('0x5'));var path=require(_0x756e('0x6'));var passport=require('passport');var cors=require(_0x756e('0x7'));var moment=require(_0x756e('0x8'));var config=require(_0x756e('0x9'));var db=require(_0x756e('0xa'))['db'];exports['default']=function(_0x16bb81){var _0x5b59b9=_0x16bb81[_0x756e('0xb')]('env');if(_0x5b59b9===_0x756e('0xc')){_0x16bb81[_0x756e('0xd')](_0x756e('0xe'),path[_0x756e('0xf')](config['root'],_0x756e('0x10')));}if(_0x5b59b9===_0x756e('0x11')||_0x5b59b9===_0x756e('0x12')){_0x16bb81[_0x756e('0xd')]('appPath',path[_0x756e('0xf')](config[_0x756e('0x13')],_0x756e('0x14')));_0x16bb81[_0x756e('0x15')](errorHandler());}_0x16bb81['set'](_0x756e('0x16'),function(_0x1a916a,_0x8f8c77){if(this[_0x1a916a]instanceof Date){_0x8f8c77=this[_0x1a916a][_0x756e('0x17')]()[_0x756e('0x18')]('.')[0x0]+'Z';}return _0x8f8c77;});_0x16bb81[_0x756e('0x15')](express[_0x756e('0x19')](_0x16bb81[_0x756e('0xb')]('appPath')));_0x16bb81[_0x756e('0xd')](_0x756e('0x1a'),config[_0x756e('0x13')]+'/server/views');_0x16bb81[_0x756e('0x1b')](_0x756e('0x1c'),require('ejs')['renderFile']);_0x16bb81[_0x756e('0xd')](_0x756e('0x1d'),_0x756e('0x1c'));_0x16bb81[_0x756e('0x15')](bodyParser[_0x756e('0x1e')]({'limit':_0x756e('0x1f'),'extended':!![]}));_0x16bb81['use'](bodyParser['json']({'limit':_0x756e('0x1f')}));_0x16bb81[_0x756e('0x15')](cors());_0x16bb81[_0x756e('0x15')](methodOverride());_0x16bb81[_0x756e('0x15')](cookieParser());_0x16bb81[_0x756e('0x15')](passport[_0x756e('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 02d2490..9608755 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 _0xea81=['lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','filter','family','IPv4','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','model','join','md5','update','digest','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress','substring'];(function(_0x57ac7c,_0x13eb14){var _0x52d72c=function(_0x3a223e){while(--_0x3a223e){_0x57ac7c['push'](_0x57ac7c['shift']());}};_0x52d72c(++_0x13eb14);}(_0xea81,0x1ed));var _0x1ea8=function(_0x1b7c0b,_0x1e9a6c){_0x1b7c0b=_0x1b7c0b-0x0;var _0x466423=_0xea81[_0x1b7c0b];return _0x466423;};'use strict';var _=require(_0x1ea8('0x0'));var os=require('os');var crypto=require(_0x1ea8('0x1'));var machine=require(_0x1ea8('0x2'));var exec=require(_0x1ea8('0x3'))['execSync'];function getInterfaces(){var _0x483fce=[];var _0x3ca664=os[_0x1ea8('0x4')]();var _0x2e6a47=_[_0x1ea8('0x5')](_[_0x1ea8('0x6')](_0x3ca664));for(var _0x562bb0=0x0;_0x562bb0<_0x2e6a47['length'];_0x562bb0++){var _0x5f4538=_0x3ca664[_0x2e6a47[_0x562bb0]][_0x1ea8('0x7')](function(_0x372fdc){return _0x372fdc[_0x1ea8('0x8')]===_0x1ea8('0x9')&&_0x372fdc['internal']===![];});_0x483fce=_0x483fce[_0x1ea8('0xa')](_0x5f4538);}return _0x483fce;}function getFirstInterface(){var _0x2c48ce=_[_0x1ea8('0xb')](getInterfaces());return{'macAddress':_0x2c48ce&&_0x2c48ce[_0x1ea8('0xc')]?_0x2c48ce[_0x1ea8('0xc')]:'00:00:00:00:00:00','ipAddress':_0x2c48ce&&_0x2c48ce[_0x1ea8('0xd')]?_0x2c48ce['address']:_0x1ea8('0xe')};}exports[_0x1ea8('0xf')]=getFirstInterface;function getCPUhash(){var _0x5a327=_[_0x1ea8('0x5')](os[_0x1ea8('0x10')]()['map'](function(_0x5a1f3e){return _0x5a1f3e[_0x1ea8('0x11')];}))[_0x1ea8('0x12')](':');return crypto['createHash'](_0x1ea8('0x13'))[_0x1ea8('0x14')](_0x5a327)[_0x1ea8('0x15')](_0x1ea8('0x16'));}exports[_0x1ea8('0x17')]=function(){switch(os['platform']()){case _0x1ea8('0x18'):return exec(_0x1ea8('0x19'),{'encoding':_0x1ea8('0x1a')})['replace']('\x0d\x0a','');default:var _0x2d5b07=getFirstInterface();var _0x3a600c=getCPUhash();var _0x4c8228=_0x3a600c+'|'+os['hostname']()+'|'+_0x2d5b07[_0x1ea8('0x1b')]+'|'+_0x2d5b07['ipAddress'];var _0x46c78a=crypto['createHash'](_0x1ea8('0x13'))[_0x1ea8('0x14')](_0x4c8228)[_0x1ea8('0x15')](_0x1ea8('0x16'));return _0x46c78a[_0x1ea8('0x1c')](0x0,0x8)+'-'+_0x46c78a[_0x1ea8('0x1c')](0x8,0xc)+'-'+_0x46c78a[_0x1ea8('0x1c')](0xc,0x10)+'-'+_0x46c78a[_0x1ea8('0x1c')](0x10,0x14)+'-'+_0x46c78a['substring'](0x14);}}; \ No newline at end of file +var _0x2a3a=['child_process','execSync','networkInterfaces','orderBy','keys','length','family','IPv4','head','mac','address','127.0.0.1','getFirstInterface','cpus','model','createHash','md5','update','digest','hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','substring','lodash','crypto','bimedia-machine-uuid'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x2b0bf8,_0x487492){_0x2b0bf8=_0x2b0bf8-0x0;var _0x55b4b4=_0x2a3a[_0x2b0bf8];return _0x55b4b4;};'use strict';var _=require(_0xa2a3('0x0'));var os=require('os');var crypto=require(_0xa2a3('0x1'));var machine=require(_0xa2a3('0x2'));var exec=require(_0xa2a3('0x3'))[_0xa2a3('0x4')];function getInterfaces(){var _0x4caf0f=[];var _0x531167=os[_0xa2a3('0x5')]();var _0x34d7f9=_[_0xa2a3('0x6')](_[_0xa2a3('0x7')](_0x531167));for(var _0xb4826a=0x0;_0xb4826a<_0x34d7f9[_0xa2a3('0x8')];_0xb4826a++){var _0x186655=_0x531167[_0x34d7f9[_0xb4826a]]['filter'](function(_0x3c4004){return _0x3c4004[_0xa2a3('0x9')]===_0xa2a3('0xa')&&_0x3c4004['internal']===![];});_0x4caf0f=_0x4caf0f['concat'](_0x186655);}return _0x4caf0f;}function getFirstInterface(){var _0x5dbe0f=_[_0xa2a3('0xb')](getInterfaces());return{'macAddress':_0x5dbe0f&&_0x5dbe0f[_0xa2a3('0xc')]?_0x5dbe0f[_0xa2a3('0xc')]:'00:00:00:00:00:00','ipAddress':_0x5dbe0f&&_0x5dbe0f[_0xa2a3('0xd')]?_0x5dbe0f[_0xa2a3('0xd')]:_0xa2a3('0xe')};}exports[_0xa2a3('0xf')]=getFirstInterface;function getCPUhash(){var _0x3186cb=_['orderBy'](os[_0xa2a3('0x10')]()['map'](function(_0x80ac46){return _0x80ac46[_0xa2a3('0x11')];}))['join'](':');return crypto[_0xa2a3('0x12')](_0xa2a3('0x13'))[_0xa2a3('0x14')](_0x3186cb)[_0xa2a3('0x15')](_0xa2a3('0x16'));}exports[_0xa2a3('0x17')]=function(){switch(os[_0xa2a3('0x18')]()){case'win32':return exec(_0xa2a3('0x19'),{'encoding':_0xa2a3('0x1a')})['replace']('\x0d\x0a','');default:var _0x3debd2=getFirstInterface();var _0x239716=getCPUhash();var _0x19c3c5=_0x239716+'|'+os[_0xa2a3('0x1b')]()+'|'+_0x3debd2[_0xa2a3('0x1c')]+'|'+_0x3debd2['ipAddress'];var _0x2bc9fb=crypto[_0xa2a3('0x12')](_0xa2a3('0x13'))[_0xa2a3('0x14')](_0x19c3c5)[_0xa2a3('0x15')](_0xa2a3('0x16'));return _0x2bc9fb[_0xa2a3('0x1d')](0x0,0x8)+'-'+_0x2bc9fb[_0xa2a3('0x1d')](0x8,0xc)+'-'+_0x2bc9fb[_0xa2a3('0x1d')](0xc,0x10)+'-'+_0x2bc9fb[_0xa2a3('0x1d')](0x10,0x14)+'-'+_0x2bc9fb['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index dd37a43..7c8d69e 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 _0x6b1b=['moment','request-promise','pkginfo','version','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','exports','format','GET','then','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','final','||FIELD||VALUE||\x0a','User','findOne','email','|uuid|','fullname','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Alert','get','active','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','crypto'];(function(_0x1a378b,_0x32b1a7){var _0x3adbcc=function(_0x5a7af0){while(--_0x5a7af0){_0x1a378b['push'](_0x1a378b['shift']());}};_0x3adbcc(++_0x32b1a7);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x6b1b[_0x1cfa0d];return _0xe33279;};'use strict';var util=require('util');var crypto=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var rp=require(_0xb6b1('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xb6b1('0x3'))(module,_0xb6b1('0x4'));var db=require(_0xb6b1('0x5'))['db'];var config=require(_0xb6b1('0x6'));var hardware=require(_0xb6b1('0x7'));var logger=require(_0xb6b1('0x8'))(_0xb6b1('0x9'));var jira=require(_0xb6b1('0xa'));var HOST=_0xb6b1('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x13334e){return new BPromise(function(_0x1a4cd0,_0x5b440a){var _0x2734cc=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x13334e,module[_0xb6b1('0xc')]['version']);if(oldToken){_0x2734cc=util[_0xb6b1('0xd')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x13334e,module['exports']['version'],oldToken);}var _0x593218={'uri':_0x2734cc,'method':_0xb6b1('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x593218)[_0xb6b1('0xf')](function(_0x5d806b){_0x1a4cd0(_0x5d806b);})[_0xb6b1('0x10')](function(_0x59831e){_0x5b440a(_0x59831e);});});}function encryptDate(_0x5c5837){var _0x406dce=crypto[_0xb6b1('0x11')](_0xb6b1('0x12'),config[_0xb6b1('0x13')][_0xb6b1('0x14')]);var _0x18f6b5=_0x406dce[_0xb6b1('0x15')](_0x5c5837,_0xb6b1('0x16'),_0xb6b1('0x17'));_0x18f6b5+=_0x406dce[_0xb6b1('0x18')](_0xb6b1('0x17'));return _0x18f6b5;}function decryptDate(_0x14fef6){var _0x4f770a=crypto['createDecipher']('aes-256-ctr',config['secrets'][_0xb6b1('0x14')]);var _0x12c595=_0x4f770a[_0xb6b1('0x15')](_0x14fef6,_0xb6b1('0x17'),_0xb6b1('0x16'));_0x12c595+=_0x4f770a[_0xb6b1('0x18')]('utf8');return _0x12c595;}function sendJiraAlert(_0x581e28,_0x1bdf63,_0x15456d){var _0x16d969=_0xb6b1('0x19');return db[_0xb6b1('0x1a')][_0xb6b1('0x1b')]({'where':{'role':'admin'},'attributes':['fullname',_0xb6b1('0x1c')],'raw':!![]})[_0xb6b1('0xf')](function(_0x5ce41c){ADMIN=_0x5ce41c;_0x16d969+='|reason|'+_0x15456d+'|\x0a';_0x16d969+=_0xb6b1('0x1d')+_0x581e28+'|\x0a';_0x16d969+='|machineUuid|'+_0x1bdf63+'|\x0a';_0x16d969+='|name|'+ADMIN[_0xb6b1('0x1e')]+'|\x0a';_0x16d969+=_0xb6b1('0x1f')+ADMIN[_0xb6b1('0x1c')]+'|\x0a';return _0x16d969;})[_0xb6b1('0xf')](function(_0x164952){var _0x3d0864=hardware[_0xb6b1('0x20')]()[_0xb6b1('0x21')];return jira[_0xb6b1('0x22')]({'key':_0xb6b1('0x23'),'summary':'Motion\x20License\x20Alert','description':_0x164952,'issuetype':_0xb6b1('0x24'),'oldToken':_0x581e28,'newToken':_0x1bdf63,'email':ADMIN['email'],'name':ADMIN[_0xb6b1('0x1e')],'reason':GRAY_PERIOD_REASON,'ip':_0x3d0864});});}function manageLicense(_0x5864d6,_0xdbcb77){var _0x48c1d2=_0xdbcb77[_0xb6b1('0x25')]({'plain':!![]});httpRequest(_0x5864d6)[_0xb6b1('0xf')](function(_0xac4256){if(oldToken){oldToken=undefined;}if(_0xac4256[_0xb6b1('0x26')]){if(!_0x48c1d2[_0xb6b1('0x9')]&&_0x48c1d2[_0xb6b1('0x9')]!=_0xac4256[_0xb6b1('0x9')]||_0x48c1d2[_0xb6b1('0x9')]&&_0x48c1d2[_0xb6b1('0x27')]){logger['info'](_0xb6b1('0x28'));}if(_0x48c1d2['license']&&!_0x48c1d2[_0xb6b1('0x27')]&&_0x48c1d2[_0xb6b1('0x9')]!=_0xac4256[_0xb6b1('0x9')]){logger[_0xb6b1('0x29')](_0xb6b1('0x2a'));}if(_0x48c1d2[_0xb6b1('0x9')]&&!_0x48c1d2[_0xb6b1('0x27')]&&_0x48c1d2['license']==_0xac4256[_0xb6b1('0x9')]){return _0xdbcb77;}return _0xdbcb77[_0xb6b1('0x15')]({'data1':_0x5864d6,'data2':null,'license':_0xac4256[_0xb6b1('0x9')]});}else{if(_0xac4256['license']||_0x48c1d2[_0xb6b1('0x9')]){if(!_0x48c1d2[_0xb6b1('0x27')]){if(_0x48c1d2['data1']==_0x5864d6){GRAY_PERIOD_REASON=_0xb6b1('0x2b');logger[_0xb6b1('0x29')](_0xb6b1('0x2c'));}else{GRAY_PERIOD_REASON=_0xb6b1('0x2d');oldToken=_0x48c1d2[_0xb6b1('0x2e')];logger[_0xb6b1('0x29')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x48c1d2[_0xb6b1('0x2e')],_0x5864d6);}sendJiraAlert(_0x48c1d2[_0xb6b1('0x2e')],_0xac4256['uuid'],GRAY_PERIOD_REASON);logger[_0xb6b1('0x29')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xb6b1('0x2f')](),moment()[_0xb6b1('0xd')](_0xb6b1('0x30')));return _0xdbcb77[_0xb6b1('0x15')]({'data2':encryptDate(moment()[_0xb6b1('0xd')](_0xb6b1('0x30')))});}else{if(moment()['diff'](decryptDate(_0x48c1d2[_0xb6b1('0x27')]),_0xb6b1('0x31'))>DAYS){logger[_0xb6b1('0x29')](_0xb6b1('0x32'),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0xdbcb77['update']({'data1':_0x5864d6,'data2':null,'license':null});}}}else{if(_0x48c1d2[_0xb6b1('0x2e')]!=_0x5864d6){logger[_0xb6b1('0x29')](_0xb6b1('0x33'),_0x48c1d2[_0xb6b1('0x2e')],_0x5864d6);return _0xdbcb77[_0xb6b1('0x15')]({'data1':_0x5864d6,'data2':null,'license':null});}}}return _0xdbcb77;})[_0xb6b1('0xf')](function(_0xedb6ba){_0xdbcb77=_0xedb6ba;})[_0xb6b1('0x10')](function(_0x206008){logger[_0xb6b1('0x34')](_0x206008[_0xb6b1('0x35')]);})[_0xb6b1('0x36')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0xdbcb77);},TIME);});}function defaultLicense(){var _0x17f529=hardware[_0xb6b1('0x37')]();if(_0x17f529){return db[_0xb6b1('0x38')][_0xb6b1('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x17f529}})[_0xb6b1('0x3a')](function(_0x1dc258,_0xfe126){logger[_0xb6b1('0x29')](_0xb6b1('0x3b'),_0x17f529);manageLicense(_0x17f529,_0x1dc258);})[_0xb6b1('0x10')](function(_0x44a61a){logger['error'](_0x44a61a[_0xb6b1('0x35')]);});}}exports[_0xb6b1('0x3c')]=defaultLicense; \ No newline at end of file +var _0x6931=['update','base64','final','utf8','findOne','admin','email','|reason|','|uuid|','|name|','fullname','|email|','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','createCipher','aes-256-ctr','secrets','session'];(function(_0x39d0ab,_0x513e13){var _0x518c31=function(_0x35e7be){while(--_0x35e7be){_0x39d0ab['push'](_0x39d0ab['shift']());}};_0x518c31(++_0x513e13);}(_0x6931,0x1a9));var _0x1693=function(_0x533a01,_0x14c083){_0x533a01=_0x533a01-0x0;var _0x45c332=_0x6931[_0x533a01];return _0x45c332;};'use strict';var util=require(_0x1693('0x0'));var crypto=require(_0x1693('0x1'));var moment=require(_0x1693('0x2'));var rp=require(_0x1693('0x3'));var BPromise=require(_0x1693('0x4'));var pkginfo=require(_0x1693('0x5'))(module,_0x1693('0x6'));var db=require(_0x1693('0x7'))['db'];var config=require('../environment');var hardware=require(_0x1693('0x8'));var logger=require(_0x1693('0x9'))(_0x1693('0xa'));var jira=require(_0x1693('0xb'));var HOST=_0x1693('0xc');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5de567){return new BPromise(function(_0x3ab149,_0x2ec499){var _0x18e32e=util['format'](_0x1693('0xd'),HOST,_0x5de567,module[_0x1693('0xe')][_0x1693('0x6')]);if(oldToken){_0x18e32e=util[_0x1693('0xf')](_0x1693('0x10'),HOST,_0x5de567,module[_0x1693('0xe')][_0x1693('0x6')],oldToken);}var _0x3807dd={'uri':_0x18e32e,'method':_0x1693('0x11'),'timeout':0xea60,'json':!![]};return rp(_0x3807dd)[_0x1693('0x12')](function(_0x1ba755){_0x3ab149(_0x1ba755);})['catch'](function(_0x24f22f){_0x2ec499(_0x24f22f);});});}function encryptDate(_0x83c817){var _0x280986=crypto[_0x1693('0x13')](_0x1693('0x14'),config[_0x1693('0x15')][_0x1693('0x16')]);var _0x5cede5=_0x280986[_0x1693('0x17')](_0x83c817,'utf8',_0x1693('0x18'));_0x5cede5+=_0x280986['final'](_0x1693('0x18'));return _0x5cede5;}function decryptDate(_0x380cf5){var _0x4db220=crypto['createDecipher'](_0x1693('0x14'),config['secrets']['session']);var _0x54724d=_0x4db220[_0x1693('0x17')](_0x380cf5,'base64','utf8');_0x54724d+=_0x4db220[_0x1693('0x19')](_0x1693('0x1a'));return _0x54724d;}function sendJiraAlert(_0x7ef2,_0xdd00ed,_0x28edfe){var _0x7a19ae='||FIELD||VALUE||\x0a';return db['User'][_0x1693('0x1b')]({'where':{'role':_0x1693('0x1c')},'attributes':['fullname',_0x1693('0x1d')],'raw':!![]})[_0x1693('0x12')](function(_0x1e541a){ADMIN=_0x1e541a;_0x7a19ae+=_0x1693('0x1e')+_0x28edfe+'|\x0a';_0x7a19ae+=_0x1693('0x1f')+_0x7ef2+'|\x0a';_0x7a19ae+='|machineUuid|'+_0xdd00ed+'|\x0a';_0x7a19ae+=_0x1693('0x20')+ADMIN[_0x1693('0x21')]+'|\x0a';_0x7a19ae+=_0x1693('0x22')+ADMIN[_0x1693('0x1d')]+'|\x0a';return _0x7a19ae;})[_0x1693('0x12')](function(_0x2fa64c){var _0x56655d=hardware[_0x1693('0x23')]()['ipAddress'];return jira[_0x1693('0x24')]({'key':_0x1693('0x25'),'summary':_0x1693('0x26'),'description':_0x2fa64c,'issuetype':'Alert','oldToken':_0x7ef2,'newToken':_0xdd00ed,'email':ADMIN[_0x1693('0x1d')],'name':ADMIN[_0x1693('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x56655d});});}function manageLicense(_0x43cfb6,_0x4142e7){var _0x4612e0=_0x4142e7[_0x1693('0x27')]({'plain':!![]});httpRequest(_0x43cfb6)[_0x1693('0x12')](function(_0x47cfb4){if(oldToken){oldToken=undefined;}if(_0x47cfb4[_0x1693('0x28')]){if(!_0x4612e0['license']&&_0x4612e0[_0x1693('0xa')]!=_0x47cfb4['license']||_0x4612e0[_0x1693('0xa')]&&_0x4612e0[_0x1693('0x29')]){logger[_0x1693('0x2a')](_0x1693('0x2b'));}if(_0x4612e0['license']&&!_0x4612e0[_0x1693('0x29')]&&_0x4612e0[_0x1693('0xa')]!=_0x47cfb4['license']){logger['info'](_0x1693('0x2c'));}if(_0x4612e0['license']&&!_0x4612e0['data2']&&_0x4612e0['license']==_0x47cfb4[_0x1693('0xa')]){return _0x4142e7;}return _0x4142e7[_0x1693('0x17')]({'data1':_0x43cfb6,'data2':null,'license':_0x47cfb4['license']});}else{if(_0x47cfb4[_0x1693('0xa')]||_0x4612e0['license']){if(!_0x4612e0[_0x1693('0x29')]){if(_0x4612e0['data1']==_0x43cfb6){GRAY_PERIOD_REASON=_0x1693('0x2d');logger[_0x1693('0x2a')](_0x1693('0x2e'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x4612e0[_0x1693('0x2f')];logger[_0x1693('0x2a')](_0x1693('0x30'),_0x4612e0[_0x1693('0x2f')],_0x43cfb6);}sendJiraAlert(_0x4612e0[_0x1693('0x2f')],_0x47cfb4[_0x1693('0x31')],GRAY_PERIOD_REASON);logger[_0x1693('0x2a')](_0x1693('0x32'),GRAY_PERIOD_REASON[_0x1693('0x33')](),moment()[_0x1693('0xf')](_0x1693('0x34')));return _0x4142e7[_0x1693('0x17')]({'data2':encryptDate(moment()['format'](_0x1693('0x34')))});}else{if(moment()['diff'](decryptDate(_0x4612e0[_0x1693('0x29')]),_0x1693('0x35'))>DAYS){logger[_0x1693('0x2a')](_0x1693('0x36'),moment()[_0x1693('0xf')](_0x1693('0x34')));return _0x4142e7[_0x1693('0x17')]({'data1':_0x43cfb6,'data2':null,'license':null});}}}else{if(_0x4612e0[_0x1693('0x2f')]!=_0x43cfb6){logger[_0x1693('0x2a')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4612e0[_0x1693('0x2f')],_0x43cfb6);return _0x4142e7[_0x1693('0x17')]({'data1':_0x43cfb6,'data2':null,'license':null});}}}return _0x4142e7;})[_0x1693('0x12')](function(_0x3c7fe5){_0x4142e7=_0x3c7fe5;})[_0x1693('0x37')](function(_0x3b37a1){logger[_0x1693('0x38')](_0x3b37a1[_0x1693('0x39')]);})[_0x1693('0x3a')](function(){setTimeout(function(){manageLicense(hardware[_0x1693('0x3b')](),_0x4142e7);},TIME);});}function defaultLicense(){var _0x58bf2a=hardware['getUuid']();if(_0x58bf2a){return db['License'][_0x1693('0x3c')]({'where':{'id':0x1},'defaults':{'data1':_0x58bf2a}})[_0x1693('0x3d')](function(_0x36ce16,_0x2eb8da){logger[_0x1693('0x2a')](_0x1693('0x3e'),_0x58bf2a);manageLicense(_0x58bf2a,_0x36ce16);})[_0x1693('0x37')](function(_0xda9fd3){logger[_0x1693('0x38')](_0xda9fd3[_0x1693('0x39')]);});}}exports[_0x1693('0x3f')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 06e5b68..cf76b31 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 _0x2a76=['../../mysqldb','license','License\x20key\x20value\x20not\x20found','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','parse','demo','machineUuid','getUuid','secrets','session','gray','deadline','add','days','grayReason','uuid','disabled','2027-01-01T00:00:00.000Z','message','Demo\x20license','getLicense','License','find','then','crypto','util','lodash','moment','./hardware','../environment'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x2a76,0xde));var _0x62a7=function(_0x346517,_0x4691d4){_0x346517=_0x346517-0x0;var _0x5102dc=_0x2a76[_0x346517];return _0x5102dc;};'use strict';var crypto=require(_0x62a7('0x0'));var util=require(_0x62a7('0x1'));var _=require(_0x62a7('0x2'));var moment=require(_0x62a7('0x3'));var hardware=require(_0x62a7('0x4'));var config=require(_0x62a7('0x5'));var db=require(_0x62a7('0x6'))['db'];function checkLicense(_0x27a284,_0x44abef){if(_0x27a284){try{var _0x28e476=_0x44abef||_0x27a284[_0x62a7('0x7')];if(_['isEmpty'](_0x28e476)){throw new Error(_0x62a7('0x8'));}var _0x5a2c8f=_0x27a284[_0x62a7('0x9')];var _0x2f031e=_0x27a284['data2'];var _0x5af567=_0x5a2c8f[_0x62a7('0xa')]('-')[0x4];var _0x75bf6d=_0x5a2c8f[_0x62a7('0xa')]('-')[0x0];var _0x5e0048=crypto[_0x62a7('0xb')](_0x62a7('0xc'),util[_0x62a7('0xd')](_0x62a7('0xe'),_0x5af567,_0x5a2c8f,_0x75bf6d));var _0x3dcf20=_0x5e0048[_0x62a7('0xf')](_0x28e476,_0x62a7('0x10'),'utf8');_0x3dcf20+=_0x5e0048[_0x62a7('0x11')]('utf8');var _0x28a052=JSON[_0x62a7('0x12')](_0x3dcf20);_0x28a052[_0x62a7('0x13')]=![];_0x28a052['uuid']=_0x5a2c8f;_0x28a052[_0x62a7('0x14')]=hardware[_0x62a7('0x15')]();if(_0x2f031e){var _0x793958=crypto['createDecipher'](_0x62a7('0xc'),config[_0x62a7('0x16')][_0x62a7('0x17')]);var _0x5c02d7=_0x793958[_0x62a7('0xf')](_0x2f031e,_0x62a7('0x10'),'utf8');_0x5c02d7+=_0x793958[_0x62a7('0x11')]('utf8');_0x28a052[_0x62a7('0x18')]=_0x5c02d7;_0x28a052[_0x62a7('0x19')]=moment(_0x5c02d7)[_0x62a7('0x1a')](0x7,_0x62a7('0x1b'))[_0x62a7('0xd')]();_0x28a052[_0x62a7('0x1c')]=_0x28a052[_0x62a7('0x1d')]!=_0x28a052[_0x62a7('0x14')]?'changed':_0x62a7('0x1e');}return _0x28a052;}catch(_0x2f2f9d){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x62a7('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x27a284[_0x62a7('0x9')],'machineUuid':hardware[_0x62a7('0x15')](),'message':_0x2f2f9d[_0x62a7('0x20')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x62a7('0x1f'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x62a7('0x21'),'uuid':_0x27a284[_0x62a7('0x9')],'machineUuid':hardware[_0x62a7('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x62a7('0x22')]=function(_0x556573){return db[_0x62a7('0x23')][_0x62a7('0x24')](_['defaults'](_0x556573,{'raw':!![],'where':{'id':0x1}}))[_0x62a7('0x25')](function(_0x320df9){return checkLicense(_0x320df9,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0x87e7=['getUuid','secrets','session','final','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','Breaking\x20license','message','Demo\x20license','getLicense','find','defaults','then','checkLicense','crypto','lodash','moment','../environment','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','format','%s:%s:%s','update','base64','utf8','parse','demo'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x87e7,0x11e));var _0x787e=function(_0x5a18fc,_0xb1a4aa){_0x5a18fc=_0x5a18fc-0x0;var _0x57b441=_0x87e7[_0x5a18fc];return _0x57b441;};'use strict';var crypto=require(_0x787e('0x0'));var util=require('util');var _=require(_0x787e('0x1'));var moment=require(_0x787e('0x2'));var hardware=require('./hardware');var config=require(_0x787e('0x3'));var db=require('../../mysqldb')['db'];function checkLicense(_0x29ee76,_0x3c571d){if(_0x29ee76){try{var _0x26e9ec=_0x3c571d||_0x29ee76[_0x787e('0x4')];if(_[_0x787e('0x5')](_0x26e9ec)){throw new Error(_0x787e('0x6'));}var _0x14b6bf=_0x29ee76[_0x787e('0x7')];var _0x1cc95e=_0x29ee76[_0x787e('0x8')];var _0x5dd8e6=_0x14b6bf[_0x787e('0x9')]('-')[0x4];var _0x4d274d=_0x14b6bf[_0x787e('0x9')]('-')[0x0];var _0x3fccba=crypto[_0x787e('0xa')]('aes-256-ctr',util[_0x787e('0xb')](_0x787e('0xc'),_0x5dd8e6,_0x14b6bf,_0x4d274d));var _0x48ea4a=_0x3fccba[_0x787e('0xd')](_0x26e9ec,_0x787e('0xe'),'utf8');_0x48ea4a+=_0x3fccba['final'](_0x787e('0xf'));var _0x10a88c=JSON[_0x787e('0x10')](_0x48ea4a);_0x10a88c[_0x787e('0x11')]=![];_0x10a88c['uuid']=_0x14b6bf;_0x10a88c['machineUuid']=hardware[_0x787e('0x12')]();if(_0x1cc95e){var _0x341fd3=crypto['createDecipher']('aes-256-ctr',config[_0x787e('0x13')][_0x787e('0x14')]);var _0x15ec44=_0x341fd3['update'](_0x1cc95e,'base64',_0x787e('0xf'));_0x15ec44+=_0x341fd3[_0x787e('0x15')](_0x787e('0xf'));_0x10a88c[_0x787e('0x16')]=_0x15ec44;_0x10a88c[_0x787e('0x17')]=moment(_0x15ec44)[_0x787e('0x18')](0x7,_0x787e('0x19'))[_0x787e('0xb')]();_0x10a88c[_0x787e('0x1a')]=_0x10a88c['uuid']!=_0x10a88c[_0x787e('0x1b')]?_0x787e('0x1c'):_0x787e('0x1d');}return _0x10a88c;}catch(_0x40109c){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x787e('0x1e'),'uuid':_0x29ee76['data1'],'machineUuid':hardware[_0x787e('0x12')](),'message':_0x40109c[_0x787e('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x787e('0x20'),'uuid':_0x29ee76[_0x787e('0x7')],'machineUuid':hardware[_0x787e('0x12')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x787e('0x21')]=function(_0x6a672f){return db['License'][_0x787e('0x22')](_[_0x787e('0x23')](_0x6a672f,{'raw':!![],'where':{'id':0x1}}))[_0x787e('0x24')](function(_0x5b39ce){return checkLicense(_0x5b39ce,null);});};exports[_0x787e('0x25')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index a171060..a8410f3 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 _0x3f2b=['exports','myappanuglar-secret','app-id','secret'];(function(_0x3d0dd4,_0x166606){var _0x4b179f=function(_0x5097d6){while(--_0x5097d6){_0x3d0dd4['push'](_0x3d0dd4['shift']());}};_0x4b179f(++_0x166606);}(_0x3f2b,0x1f4));var _0xb3f2=function(_0xdd232b,_0x431359){_0xdd232b=_0xdd232b-0x0;var _0x396801=_0x3f2b[_0xdd232b];return _0x396801;};'use strict';module[_0xb3f2('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xb3f2('0x1'),'GOOGLE_ID':_0xb3f2('0x2'),'GOOGLE_SECRET':_0xb3f2('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x793a=['secret'];(function(_0xa3e0f7,_0x1b06db){var _0x4ce604=function(_0x29df1e){while(--_0x29df1e){_0xa3e0f7['push'](_0xa3e0f7['shift']());}};_0x4ce604(++_0x1b06db);}(_0x793a,0x86));var _0xa793=function(_0x4c187c,_0x5c008f){_0x4c187c=_0x4c187c-0x0;var _0x5055b1=_0x793a[_0x4c187c];return _0x5055b1;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa793('0x0'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 7d7f8bd..d91e43e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeca6=['debugLevel','moment','winston','util','INFO','join','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console'];(function(_0x37bb40,_0x259deb){var _0x598fb0=function(_0x49795d){while(--_0x49795d){_0x37bb40['push'](_0x37bb40['shift']());}};_0x598fb0(++_0x259deb);}(_0xeca6,0x1e5));var _0x6eca=function(_0xc50ae8,_0x31b18e){_0xc50ae8=_0xc50ae8-0x0;var _0x21a9ed=_0xeca6[_0xc50ae8];return _0x21a9ed;};'use strict';var moment=require(_0x6eca('0x0'));var winston=require(_0x6eca('0x1'));var util=require(_0x6eca('0x2'));var path=require('path');var debugLevel=_0x6eca('0x3');function filename(_0x5ee6c7,_0x306351){return path[_0x6eca('0x4')]('/var',_0x6eca('0x5'),_0x6eca('0x6'),util[_0x6eca('0x7')](_0x6eca('0x8'),_0x5ee6c7,_0x306351));}function formatter(_0x5a2108,_0x2eb22d){return util['format'](_0x6eca('0x9'),moment()[_0x6eca('0x7')](_0x6eca('0xa')),_0x2eb22d[_0x6eca('0xb')][_0x6eca('0xc')](),_0x5a2108,_0x2eb22d['message']);}module[_0x6eca('0xd')]=function(_0xc712fd){return new winston[(_0x6eca('0xe'))]({'transports':[new winston[(_0x6eca('0xf'))][(_0x6eca('0x10'))]({'name':util[_0x6eca('0x7')](_0x6eca('0x11'),_0xc712fd,_0x6eca('0x12')),'filename':filename(_0xc712fd,_0x6eca('0x12')),'level':_0x6eca('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x123784){return formatter(_0xc712fd,_0x123784);}}),new winston[(_0x6eca('0xf'))][(_0x6eca('0x10'))]({'name':util[_0x6eca('0x7')]('%s-%s',_0xc712fd,_0x6eca('0x13')),'filename':filename(_0xc712fd,_0x6eca('0x13')),'level':_0x6eca('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4eb846){return formatter(_0xc712fd,_0x4eb846);}}),new winston[(_0x6eca('0xf'))][(_0x6eca('0x14'))]({'level':process['env'][_0x6eca('0x15')]||debugLevel,'json':![],'formatter':function(_0x283213){return formatter(_0xc712fd,_0x283213);}})]});}; \ No newline at end of file +var _0xc104=['exports','Logger','transports','error','%s-%s','info','env','moment','util','path','INFO','/var','log','xcally','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x1ff414,_0x12c95d){var _0x52c0fa=function(_0x57f936){while(--_0x57f936){_0x1ff414['push'](_0x1ff414['shift']());}};_0x52c0fa(++_0x12c95d);}(_0xc104,0xd8));var _0x4c10=function(_0x1b2e6b,_0x2f97fb){_0x1b2e6b=_0x1b2e6b-0x0;var _0x1dd2aa=_0xc104[_0x1b2e6b];return _0x1dd2aa;};'use strict';var moment=require(_0x4c10('0x0'));var winston=require('winston');var util=require(_0x4c10('0x1'));var path=require(_0x4c10('0x2'));var debugLevel=_0x4c10('0x3');function filename(_0x53bc39,_0x5da797){return path['join'](_0x4c10('0x4'),_0x4c10('0x5'),_0x4c10('0x6'),util[_0x4c10('0x7')](_0x4c10('0x8'),_0x53bc39,_0x5da797));}function formatter(_0xe737e0,_0x2073c8){return util[_0x4c10('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0x4c10('0x9')),_0x2073c8[_0x4c10('0xa')][_0x4c10('0xb')](),_0xe737e0,_0x2073c8['message']);}module[_0x4c10('0xc')]=function(_0x3f56a7){return new winston[(_0x4c10('0xd'))]({'transports':[new winston[(_0x4c10('0xe'))]['File']({'name':util[_0x4c10('0x7')]('%s-%s',_0x3f56a7,'error'),'filename':filename(_0x3f56a7,'error'),'level':_0x4c10('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7a0e){return formatter(_0x3f56a7,_0x7a0e);}}),new winston[(_0x4c10('0xe'))]['File']({'name':util[_0x4c10('0x7')](_0x4c10('0x10'),_0x3f56a7,_0x4c10('0x11')),'filename':filename(_0x3f56a7,_0x4c10('0x11')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x181c15){return formatter(_0x3f56a7,_0x181c15);}}),new winston[(_0x4c10('0xe'))]['Console']({'level':process[_0x4c10('0x12')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x45a6bc){return formatter(_0x3f56a7,_0x45a6bc);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 0a1c10b..75be27b 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 _0x43e4=['../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami'];(function(_0x35140b,_0x1ba1fe){var _0x507a20=function(_0x4fc12a){while(--_0x4fc12a){_0x35140b['push'](_0x35140b['shift']());}};_0x507a20(++_0x1ba1fe);}(_0x43e4,0x68));var _0x443e=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x43e4[_0xbd08b4];return _0x314f1e;};'use strict';var path=require(_0x443e('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x443e('0x1')](__dirname,_0x443e('0x2'))},{'name':_0x443e('0x3'),'script':path[_0x443e('0x1')](__dirname,_0x443e('0x4'))},{'name':_0x443e('0x5'),'script':path['join'](__dirname,_0x443e('0x6'))},{'name':'email','script':path[_0x443e('0x1')](__dirname,_0x443e('0x7'))},{'name':'routing','script':path[_0x443e('0x1')](__dirname,_0x443e('0x8'))},{'name':_0x443e('0x9'),'script':path[_0x443e('0x1')](__dirname,_0x443e('0xa'))}]};module[_0x443e('0xb')]=config; \ No newline at end of file +var _0x4fe5=['ami','join','../../services/ami/index.js','agi','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js'];(function(_0x438069,_0x2cccd2){var _0x47f508=function(_0x3dc455){while(--_0x3dc455){_0x438069['push'](_0x438069['shift']());}};_0x47f508(++_0x2cccd2);}(_0x4fe5,0x65));var _0x54fe=function(_0x4429eb,_0x59f631){_0x4429eb=_0x4429eb-0x0;var _0xa45855=_0x4fe5[_0x4429eb];return _0xa45855;};'use strict';var path=require(_0x54fe('0x0'));var os=require('os');var config={'apps':[{'name':_0x54fe('0x1'),'script':path['join'](__dirname,_0x54fe('0x2'))},{'name':_0x54fe('0x3'),'script':path[_0x54fe('0x4')](__dirname,_0x54fe('0x5'))},{'name':_0x54fe('0x6'),'script':path[_0x54fe('0x4')](__dirname,'../../services/agi/index.js')},{'name':_0x54fe('0x7'),'script':path[_0x54fe('0x4')](__dirname,'../../services/email/index.js')},{'name':_0x54fe('0x8'),'script':path[_0x54fe('0x4')](__dirname,_0x54fe('0x9'))},{'name':_0x54fe('0xa'),'script':path[_0x54fe('0x4')](__dirname,_0x54fe('0xb'))}]};module[_0x54fe('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index a57908b..8545f2c 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 _0xc21e=['delete','dump','bluebird','./config','connect','start','then','stop','disconnect','restart','list','describe'];(function(_0x5b1db5,_0x559cd7){var _0x39995c=function(_0x18c72f){while(--_0x18c72f){_0x5b1db5['push'](_0x5b1db5['shift']());}};_0x39995c(++_0x559cd7);}(_0xc21e,0x1ca));var _0xec21=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc21e[_0x59ee6f];return _0x4c0979;};'use strict';var pm2=require('pm2');var BPromise=require(_0xec21('0x0'));var config=require(_0xec21('0x1'));function connect(){return new BPromise(function(_0x1aa991,_0x2ad2c0){return pm2[_0xec21('0x2')](function(_0x3af221){if(_0x3af221){return _0x2ad2c0(_0x3af221);}return _0x1aa991('connected');});});};exports[_0xec21('0x3')]=function(_0x3524f1){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0xd94b5d,_0x7fce38){return pm2[_0xec21('0x3')](_0x3524f1,function(_0x406b66,_0x2f15e7){if(_0x406b66){return _0x7fce38(_0x406b66);}pm2['disconnect']();return _0xd94b5d(_0x2f15e7);});});});};exports[_0xec21('0x5')]=function(_0x3d74a2){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0xfbab77,_0x4d478){return pm2['stop'](_0x3d74a2,function(_0x110420,_0x1d5e4b){if(_0x110420){return _0x4d478(_0x110420);}pm2[_0xec21('0x6')]();return _0xfbab77(_0x1d5e4b);});});});};exports['restart']=function(_0x5f059d){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0x276437,_0x53772e){return pm2[_0xec21('0x7')](_0x5f059d,function(_0x2efc12,_0xd9232e){if(_0x2efc12){return _0x53772e(_0x2efc12);}pm2[_0xec21('0x6')]();return _0x276437(_0xd9232e);});});});};exports[_0xec21('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x179b89,_0x55e74e){return pm2[_0xec21('0x8')](function(_0x1987f4,_0x34e6af){if(_0x1987f4){return _0x55e74e(_0x1987f4);}pm2['disconnect']();return _0x179b89(_0x34e6af);});});});};exports[_0xec21('0x9')]=function(_0x3ee6f7){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0x2c3124,_0x324853){return pm2[_0xec21('0x9')](_0x3ee6f7,function(_0x3e538c,_0x350a53){if(_0x3e538c){return _0x324853(_0x3e538c);}pm2['disconnect']();return _0x2c3124(_0x350a53);});});});};exports[_0xec21('0xa')]=function(_0x2f805b){return connect()[_0xec21('0x4')](function(){return new BPromise(function(_0x121624,_0x3ab226){return pm2[_0xec21('0xa')](_0x2f805b,function(_0x90c3f5,_0x2aff55){if(_0x90c3f5){return _0x3ab226(_0x90c3f5);}pm2[_0xec21('0x6')]();return _0x121624(_0x2aff55);});});});};exports[_0xec21('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4c244b,_0x127afa){return pm2[_0xec21('0xb')](function(_0x5ab97e){if(_0x5ab97e){return _0x127afa(_0x5ab97e);}return _0x4c244b('saved');});});});}; \ No newline at end of file +var _0x4074=['pm2','bluebird','./config','connect','connected','start','then','stop','disconnect','restart','list','describe','delete','dump','saved'];(function(_0x827a1,_0x71ad9f){var _0x4fada5=function(_0x28166a){while(--_0x28166a){_0x827a1['push'](_0x827a1['shift']());}};_0x4fada5(++_0x71ad9f);}(_0x4074,0xf0));var _0x4407=function(_0x50db44,_0x473ba1){_0x50db44=_0x50db44-0x0;var _0x1b52d1=_0x4074[_0x50db44];return _0x1b52d1;};'use strict';var pm2=require(_0x4407('0x0'));var BPromise=require(_0x4407('0x1'));var config=require(_0x4407('0x2'));function connect(){return new BPromise(function(_0x52977e,_0x1021e6){return pm2[_0x4407('0x3')](function(_0x14c0bc){if(_0x14c0bc){return _0x1021e6(_0x14c0bc);}return _0x52977e(_0x4407('0x4'));});});};exports[_0x4407('0x5')]=function(_0x3c9f5c){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x2495d2,_0x3f085d){return pm2[_0x4407('0x5')](_0x3c9f5c,function(_0x4933cf,_0x988538){if(_0x4933cf){return _0x3f085d(_0x4933cf);}pm2['disconnect']();return _0x2495d2(_0x988538);});});});};exports[_0x4407('0x7')]=function(_0x3c1aee){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x54b465,_0x5e70a5){return pm2['stop'](_0x3c1aee,function(_0x801db8,_0x74e6f8){if(_0x801db8){return _0x5e70a5(_0x801db8);}pm2[_0x4407('0x8')]();return _0x54b465(_0x74e6f8);});});});};exports[_0x4407('0x9')]=function(_0x36cde5){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x167f9f,_0x2c5b86){return pm2[_0x4407('0x9')](_0x36cde5,function(_0x332243,_0x14f398){if(_0x332243){return _0x2c5b86(_0x332243);}pm2['disconnect']();return _0x167f9f(_0x14f398);});});});};exports[_0x4407('0xa')]=function(){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x52cd11,_0x3ee793){return pm2['list'](function(_0x1d2ec8,_0x27724a){if(_0x1d2ec8){return _0x3ee793(_0x1d2ec8);}pm2[_0x4407('0x8')]();return _0x52cd11(_0x27724a);});});});};exports[_0x4407('0xb')]=function(_0x1840dd){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x1c5a0c,_0x2e709f){return pm2['describe'](_0x1840dd,function(_0x474e6a,_0x65b20b){if(_0x474e6a){return _0x2e709f(_0x474e6a);}pm2[_0x4407('0x8')]();return _0x1c5a0c(_0x65b20b);});});});};exports[_0x4407('0xc')]=function(_0x12952e){return connect()['then'](function(){return new BPromise(function(_0x2d6fb9,_0x54caa1){return pm2[_0x4407('0xc')](_0x12952e,function(_0x257d33,_0x1db373){if(_0x257d33){return _0x54caa1(_0x257d33);}pm2[_0x4407('0x8')]();return _0x2d6fb9(_0x1db373);});});});};exports[_0x4407('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x451897,_0x55ee6d){return pm2[_0x4407('0xd')](function(_0x28bb2c){if(_0x28bb2c){return _0x55ee6d(_0x28bb2c);}return _0x451897(_0x4407('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index be31861..b603cdf 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 _0x5396=['update','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','subtract'];(function(_0x1a1932,_0x29b372){var _0x23fdb9=function(_0x3d05e2){while(--_0x3d05e2){_0x1a1932['push'](_0x1a1932['shift']());}};_0x23fdb9(++_0x29b372);}(_0x5396,0x1e6));var _0x6539=function(_0x5a18a5,_0x3957e9){_0x5a18a5=_0x5a18a5-0x0;var _0x308a59=_0x5396[_0x5a18a5];return _0x308a59;};'use strict';var _=require(_0x6539('0x0'));var moment=require(_0x6539('0x1'));var Redis=require(_0x6539('0x2'));var db=require(_0x6539('0x3'))['db'];var config=require(_0x6539('0x4'));config[_0x6539('0x5')]=_[_0x6539('0x6')](config['redis'],{'host':_0x6539('0x7'),'port':0x18eb});var io=require(_0x6539('0x8'))(new Redis(config[_0x6539('0x5')]));function closeInteractions(){var _0xeb57a5=0x0;var _0x188191=[];return db[_0x6539('0x9')]['find']({'raw':!![],'attributes':['id',_0x6539('0xa')],'where':{'id':0x1}})['then'](function(_0x24d96a){_0xeb57a5=_0x24d96a[_0x6539('0xa')];if(_0xeb57a5){return db[_0x6539('0xb')][_0x6539('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6539('0xd')](_0x24d96a['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0x5cae6f){_0x188191=_0x5cae6f;if(_0xeb57a5){return db[_0x6539('0xb')][_0x6539('0xe')]({'closeReason':_0x6539('0xf'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6539('0x10')](_0x6539('0x11'))},{'where':{'id':_['map'](_0x188191||[],'id')}});}})['then'](function(_0x4a426f){for(var _0x43cf6f=0x0;_0x43cf6f<_0x188191['length'];_0x43cf6f++){io[_0x6539('0x12')](_0x6539('0x13'),{'id':_0x188191[_0x43cf6f]['id'],'closed':!![]});}})['catch'](function(_0x2ef944){console['error'](_0x2ef944);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x280c=['findAll','lastMsgAt','subtract','then','update','system','timeout','format','length','emit','catch','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','socket.io-emitter','chatTimeout','ChatInteraction'];(function(_0x5b791d,_0x49cc81){var _0xdd1c36=function(_0x46f98b){while(--_0x46f98b){_0x5b791d['push'](_0x5b791d['shift']());}};_0xdd1c36(++_0x49cc81);}(_0x280c,0x1f1));var _0xc280=function(_0x248831,_0x5969a3){_0x248831=_0x248831-0x0;var _0x51bb37=_0x280c[_0x248831];return _0x51bb37;};'use strict';var _=require(_0xc280('0x0'));var moment=require(_0xc280('0x1'));var Redis=require(_0xc280('0x2'));var db=require(_0xc280('0x3'))['db'];var config=require(_0xc280('0x4'));config[_0xc280('0x5')]=_['defaults'](config[_0xc280('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xc280('0x6'))(new Redis(config[_0xc280('0x5')]));function closeInteractions(){var _0x209724=0x0;var _0x36908c=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x6bf051){_0x209724=_0x6bf051[_0xc280('0x7')];if(_0x209724){return db[_0xc280('0x8')][_0xc280('0x9')]({'raw':!![],'attributes':['id',_0xc280('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc280('0xb')](_0x6bf051[_0xc280('0x7')],'minutes')}}});}else{return[];}})[_0xc280('0xc')](function(_0x588341){_0x36908c=_0x588341;if(_0x209724){return db['ChatInteraction'][_0xc280('0xd')]({'closeReason':_0xc280('0xe'),'disposition':_0xc280('0xf'),'closed':!![],'closedAt':moment()[_0xc280('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_['map'](_0x36908c||[],'id')}});}})['then'](function(_0x5920f6){for(var _0x32557f=0x0;_0x32557f<_0x36908c[_0xc280('0x11')];_0x32557f++){io[_0xc280('0x12')]('chatInteraction:update',{'id':_0x36908c[_0x32557f]['id'],'closed':!![]});}})[_0xc280('0x13')](function(_0x33f979){console[_0xc280('0x14')](_0x33f979);});}exports[_0xc280('0x15')]=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 4883cf3..8448ed4 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 _0x48c9=['exec\x20custom\x20report\x20id:%s','no\x20report\x20id','MailServerOut','jobs','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','endAt','add','start','add\x20cron','isBetween','startAt','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','auth','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','%s.%s','extname','savename','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','catch','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x48c9,0x76));var _0x948c=function(_0x385fed,_0x3a4757){_0x385fed=_0x385fed-0x0;var _0x52fa25=_0x48c9[_0x385fed];return _0x52fa25;};'use strict';var fs=require('fs');var util=require(_0x948c('0x0'));var path=require(_0x948c('0x1'));var _=require(_0x948c('0x2'));var moment=require('moment');var CronJobManager=require(_0x948c('0x3'));var jayson=require(_0x948c('0x4'));var BPromise=require('bluebird');var logger=require(_0x948c('0x5'))(_0x948c('0x6'));var db=require(_0x948c('0x7'))['db'];var analyticCustomReportController=require(_0x948c('0x8'));var analyticDefaultReportController=require(_0x948c('0x9'));var client=jayson[_0x948c('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4b224e,_0x33a2ca){return function(){logger[_0x948c('0xb')](_0x948c('0xc'),_0x4b224e[_0x948c('0xd')]);var _0x2e682f=!![];var _0x4c4f28={'tls':{'rejectUnauthorized':![]}};if(_0x4b224e['MailAccount'][_0x948c('0xe')][_0x948c('0xf')]){_0x4c4f28[_0x948c('0xf')]=_0x4b224e[_0x948c('0x10')][_0x948c('0xe')]['service'];}else{_0x4c4f28[_0x948c('0x11')]=_0x4b224e[_0x948c('0x10')][_0x948c('0xe')][_0x948c('0x11')];_0x4c4f28[_0x948c('0x12')]=_0x4b224e[_0x948c('0x10')]['Smtp'][_0x948c('0x12')];_0x4c4f28[_0x948c('0x13')]=_0x4b224e[_0x948c('0x10')][_0x948c('0xe')]['secure'];}if(_0x4b224e[_0x948c('0x10')][_0x948c('0xe')]['authentication']){_0x4c4f28[_0x948c('0x14')]={'user':_0x4b224e['MailAccount'][_0x948c('0xe')]['user'],'pass':_0x4b224e[_0x948c('0x10')][_0x948c('0xe')][_0x948c('0x15')]};}var _0x126dd6={'account':_0x4c4f28,'message':{'from':util[_0x948c('0x16')](_0x948c('0x17'),_0x4b224e['MailAccount'][_0x948c('0x18')],_0x4b224e['MailAccount']['email']||_0x4b224e['MailAccount'][_0x948c('0xe')]['user']),'to':_0x4b224e[_0x948c('0xd')],'cc':_0x4b224e['cc'],'bcc':_0x4b224e[_0x948c('0x19')],'subject':util[_0x948c('0x16')](_0x948c('0x1a'),_0x33a2ca[_0x948c('0x18')],_0x4b224e['subtractNumber'],_0x4b224e[_0x948c('0x1b')])}};var _0x3a616b=path[_0x948c('0x1c')](__dirname,'../../files/reports');var _0x5e6e5d=_0x33a2ca['savename'];var _0x5be3bc=util[_0x948c('0x16')](_0x948c('0x1d'),path['basename'](_0x33a2ca['savename'],path[_0x948c('0x1e')](_0x33a2ca[_0x948c('0x1f')])),_0x948c('0x20'));var _0x1d8f9c=path[_0x948c('0x1c')](_0x3a616b,_0x5e6e5d);var _0xab0cb6=path[_0x948c('0x1c')](_0x3a616b,_0x5be3bc);if(fs[_0x948c('0x21')](_0x1d8f9c)){_0x33a2ca[_0x948c('0x22')]=_0x948c('0x23');_0x126dd6[_0x948c('0x24')][_0x948c('0x25')]=[{'filename':_0x5e6e5d,'path':_0x1d8f9c}];_0x126dd6[_0x948c('0x24')]['text']=util[_0x948c('0x16')](_0x948c('0x26'),JSON[_0x948c('0x27')](_0x33a2ca,null,0x2));}else if(fs['existsSync'](_0xab0cb6)){_0x33a2ca[_0x948c('0x22')]=_0x948c('0x23');_0x126dd6[_0x948c('0x24')][_0x948c('0x25')]=[{'filename':_0x5be3bc,'path':_0xab0cb6}];}else{_0x126dd6[_0x948c('0x24')][_0x948c('0x28')]=_0x948c('0x29');if(!_0x4b224e['sendIfEmpty']){_0x2e682f=![];logger[_0x948c('0xb')](_0x948c('0x2a'));}}if(_0x2e682f){return client[_0x948c('0x2b')](_0x948c('0x2c'),_0x126dd6)[_0x948c('0x2d')](function(_0x32f56e){if(_0x32f56e['error']){return logger[_0x948c('0x2e')]('error\x20mail',JSON[_0x948c('0x27')](_0x32f56e));}return logger[_0x948c('0xb')](_0x948c('0x2f'));})[_0x948c('0x30')](function(_0x3cd0b2){return logger[_0x948c('0x2e')]('error\x20mail',JSON[_0x948c('0x27')](_0x3cd0b2));});}};}function handleError(){return function(_0x403c4d){return logger[_0x948c('0x2e')](JSON['stringify'](_0x403c4d));};}function handleResult(_0x466bab){return function(_0x4cc3b4){logger['info'](_0x948c('0x31'),JSON[_0x948c('0x27')](_0x4cc3b4));if(_0x466bab[_0x948c('0x10')]&&_0x466bab[_0x948c('0x10')][_0x948c('0xe')]&&!_[_0x948c('0x32')](_0x466bab[_0x948c('0xd')])){setTimeout(handleSendEmail(_0x466bab,_0x4cc3b4),0x3c*0x3e8);}};}function handleJob(_0x32e6f9){return function(){try{if(_[_0x948c('0x32')](_0x32e6f9[_0x948c('0x33')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x32e6f9[_0x948c('0x1b')])){return logger[_0x948c('0xb')](_0x948c('0x34'));}var _0x8a5fa={'startDate':moment()['subtract'](_0x32e6f9[_0x948c('0x33')],_0x32e6f9[_0x948c('0x1b')])[_0x948c('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x948c('0x16')](_0x948c('0x35')),'type':_0x948c('0x36'),'output':_0x32e6f9[_0x948c('0x37')],'name':_0x32e6f9[_0x948c('0x18')]};if(!_[_0x948c('0x32')](_0x32e6f9['DefaultReportId'])){logger[_0x948c('0xb')](_0x948c('0x38'),_0x32e6f9[_0x948c('0x39')]);return analyticDefaultReportController[_0x948c('0x3a')]({'id':_0x32e6f9[_0x948c('0x39')]},_0x8a5fa)[_0x948c('0x2d')](handleResult(_0x32e6f9))[_0x948c('0x30')](handleError());}if(!_[_0x948c('0x32')](_0x32e6f9[_0x948c('0x3b')])){logger['info'](_0x948c('0x3c'),_0x32e6f9[_0x948c('0x3b')]);return analyticCustomReportController[_0x948c('0x3a')]({'id':_0x32e6f9[_0x948c('0x3b')]},_0x8a5fa)[_0x948c('0x2d')](handleResult(_0x32e6f9))[_0x948c('0x30')](handleError());}}catch(_0x296acf){logger[_0x948c('0x2e')](JSON['stringify'](_0x296acf));}return logger['info'](_0x948c('0x3d'));};}function getJobs(_0x41713b){var _0x6aa7b7={};if(_0x41713b){_0x6aa7b7['id']=_0x41713b;}return db['Schedule']['findAll']({'where':_0x6aa7b7,'include':[{'model':db[_0x948c('0x10')],'attributes':['id',_0x948c('0x18'),'email'],'include':[{'model':db[_0x948c('0x3e')],'as':_0x948c('0xe')}]}]})['then'](function(_0x3f34e9){var _0x25fc44=_['keys'](manager[_0x948c('0x3f')]);var _0x405a02=_[_0x948c('0x40')](_0x3f34e9,function(_0x3adaf2){return _0x3adaf2['id'][_0x948c('0x41')]();});var _0xc636e3=_[_0x948c('0x42')](_0x3f34e9,function(_0x529f54){return _0x529f54['id']['toString']();});var _0x54ab57=_0x41713b?_0x405a02:_['difference'](_0x405a02,_0x25fc44);var _0xe3a825=_[_0x948c('0x43')](_0x405a02,_0x25fc44);var _0x22478a=_[_0x948c('0x44')](_0x25fc44,_0x405a02);var _0x444873;var _0xde17f9;for(_0x444873=0x0;_0x444873<_0x22478a[_0x948c('0x45')]&&!_0x41713b;_0x444873+=0x1){_0xde17f9=_0x22478a[_0x444873]['toString']();if(manager[_0x948c('0x46')](_0xde17f9)){manager[_0x948c('0x47')](_0xde17f9);manager[_0x948c('0x48')](_0xde17f9);logger[_0x948c('0xb')](_0x948c('0x49'),_0xde17f9);}}logger[_0x948c('0xb')]('toRun',JSON[_0x948c('0x27')](_0x54ab57));for(_0x444873=0x0;_0x444873<_0x54ab57[_0x948c('0x45')];_0x444873+=0x1){_0xde17f9=_0x54ab57[_0x444873][_0x948c('0x41')]();logger['info'](_0x948c('0x4a'),_0xde17f9);if(_0x41713b){logger[_0x948c('0xb')](_0x948c('0x4b'),_0x41713b);logger[_0x948c('0xb')](JSON[_0x948c('0x27')](_0xc636e3[_0xde17f9]));BPromise[_0x948c('0x4c')]()['then'](handleJob(_0xc636e3[_0xde17f9]));logger[_0x948c('0xb')](_0x948c('0x4d'),_0xc636e3[_0xde17f9][_0x948c('0x18')],_0xc636e3[_0xde17f9][_0x948c('0x4e')]);}else if(_0xc636e3[_0xde17f9][_0x948c('0x4e')]&&_0xc636e3[_0xde17f9][_0x948c('0x4f')]&&moment()['isBetween'](_0xc636e3[_0xde17f9]['startAt'],_0xc636e3[_0xde17f9][_0x948c('0x50')])){manager[_0x948c('0x51')](_0xde17f9,_0xc636e3[_0xde17f9]['cron'],handleJob(_0xc636e3[_0xde17f9]));manager[_0x948c('0x52')](_0xde17f9);logger['info'](_0x948c('0x53'),_0xc636e3[_0xde17f9][_0x948c('0x18')],_0xc636e3[_0xde17f9][_0x948c('0x4e')]);}else if(manager['exists'](_0xde17f9)){manager[_0x948c('0x47')](_0xde17f9);manager[_0x948c('0x48')](_0xde17f9);logger[_0x948c('0xb')]('stop\x20cron',_0xc636e3[_0xde17f9][_0x948c('0x18')],_0xc636e3[_0xde17f9][_0x948c('0x4e')]);}}for(_0x444873=0x0,_0xde17f9;_0x444873<_0xe3a825[_0x948c('0x45')]&&!_0x41713b;_0x444873+=0x1){_0xde17f9=_0xe3a825[_0x444873]['toString']();if(manager[_0x948c('0x46')](_0xde17f9)){if(_0xc636e3[_0xde17f9]['cron']&&_0xc636e3[_0xde17f9][_0x948c('0x4f')]&&moment()[_0x948c('0x54')](_0xc636e3[_0xde17f9][_0x948c('0x55')],_0xc636e3[_0xde17f9]['endAt'])){manager[_0x948c('0x56')](_0xde17f9,_0xc636e3[_0xde17f9]['cron'],handleJob(_0xc636e3[_0xde17f9]));logger[_0x948c('0xb')](_0x948c('0x57'),_0xc636e3[_0xde17f9]['name'],_0xc636e3[_0xde17f9][_0x948c('0x4e')]);}else{manager[_0x948c('0x47')](_0xde17f9);manager[_0x948c('0x48')](_0xde17f9);logger[_0x948c('0xb')]('stop\x20cron',_0xc636e3[_0xde17f9][_0x948c('0x18')],_0xc636e3[_0xde17f9]['cron']);}}}})[_0x948c('0x30')](function(_0x5dea8b){logger[_0x948c('0x2e')](JSON[_0x948c('0x27')](_0x5dea8b));});}exports[_0x948c('0x58')]=function(_0x1b42b1){return getJobs(_0x1b42b1);};exports[_0x948c('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb0e6=['difference','intersection','exists','resolve','run\x20job','cron','active','isBetween','startAt','start','add\x20cron','stop','deleteJob','length','update','update\x20cron','stop\x20cron','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','secure','authentication','user','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','../../files/reports','savename','%s.%s','extname','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','stringify','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','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','findAll','MailServerOut','keys','jobs','map','toString','keyBy'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb0e6,0x66));var _0x6b0e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb0e6[_0x4b055c];return _0x4b62bb;};'use strict';var fs=require('fs');var util=require(_0x6b0e('0x0'));var path=require(_0x6b0e('0x1'));var _=require(_0x6b0e('0x2'));var moment=require(_0x6b0e('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x6b0e('0x4'));var BPromise=require(_0x6b0e('0x5'));var logger=require(_0x6b0e('0x6'))(_0x6b0e('0x7'));var db=require(_0x6b0e('0x8'))['db'];var analyticCustomReportController=require(_0x6b0e('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x6b0e('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xd50a3b,_0x179559){return function(){logger[_0x6b0e('0xb')](_0x6b0e('0xc'),_0xd50a3b[_0x6b0e('0xd')]);var _0x5bfd9c=!![];var _0x5be51b={'tls':{'rejectUnauthorized':![]}};if(_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x10')]){_0x5be51b[_0x6b0e('0x10')]=_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x10')];}else{_0x5be51b['host']=_0xd50a3b[_0x6b0e('0xe')]['Smtp'][_0x6b0e('0x11')];_0x5be51b['port']=_0xd50a3b[_0x6b0e('0xe')]['Smtp']['port'];_0x5be51b[_0x6b0e('0x12')]=_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x12')];}if(_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x13')]){_0x5be51b['auth']={'user':_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x14')],'pass':_0xd50a3b[_0x6b0e('0xe')]['Smtp']['pass']};}var _0x5c20e7={'account':_0x5be51b,'message':{'from':util[_0x6b0e('0x15')](_0x6b0e('0x16'),_0xd50a3b[_0x6b0e('0xe')]['name'],_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xd')]||_0xd50a3b[_0x6b0e('0xe')][_0x6b0e('0xf')][_0x6b0e('0x14')]),'to':_0xd50a3b['email'],'cc':_0xd50a3b['cc'],'bcc':_0xd50a3b[_0x6b0e('0x17')],'subject':util['format'](_0x6b0e('0x18'),_0x179559[_0x6b0e('0x19')],_0xd50a3b['subtractNumber'],_0xd50a3b[_0x6b0e('0x1a')])}};var _0x1f5980=path['join'](__dirname,_0x6b0e('0x1b'));var _0x478188=_0x179559[_0x6b0e('0x1c')];var _0x34910e=util['format'](_0x6b0e('0x1d'),path['basename'](_0x179559[_0x6b0e('0x1c')],path[_0x6b0e('0x1e')](_0x179559[_0x6b0e('0x1c')])),'zip');var _0x4f52ef=path[_0x6b0e('0x1f')](_0x1f5980,_0x478188);var _0x502d0d=path[_0x6b0e('0x1f')](_0x1f5980,_0x34910e);if(fs[_0x6b0e('0x20')](_0x4f52ef)){_0x179559[_0x6b0e('0x21')]=_0x6b0e('0x22');_0x5c20e7[_0x6b0e('0x23')][_0x6b0e('0x24')]=[{'filename':_0x478188,'path':_0x4f52ef}];_0x5c20e7[_0x6b0e('0x23')][_0x6b0e('0x25')]=util[_0x6b0e('0x15')](_0x6b0e('0x26'),JSON[_0x6b0e('0x27')](_0x179559,null,0x2));}else if(fs[_0x6b0e('0x20')](_0x502d0d)){_0x179559[_0x6b0e('0x21')]=_0x6b0e('0x22');_0x5c20e7[_0x6b0e('0x23')]['attachments']=[{'filename':_0x34910e,'path':_0x502d0d}];}else{_0x5c20e7[_0x6b0e('0x23')]['text']=_0x6b0e('0x28');if(!_0xd50a3b[_0x6b0e('0x29')]){_0x5bfd9c=![];logger[_0x6b0e('0xb')](_0x6b0e('0x2a'));}}if(_0x5bfd9c){return client[_0x6b0e('0x2b')](_0x6b0e('0x2c'),_0x5c20e7)[_0x6b0e('0x2d')](function(_0x42df96){if(_0x42df96['error']){return logger[_0x6b0e('0x2e')](_0x6b0e('0x2f'),JSON[_0x6b0e('0x27')](_0x42df96));}return logger[_0x6b0e('0xb')]('email\x20sent');})[_0x6b0e('0x30')](function(_0x34214d){return logger[_0x6b0e('0x2e')]('error\x20mail',JSON['stringify'](_0x34214d));});}};}function handleError(){return function(_0x52276c){return logger[_0x6b0e('0x2e')](JSON[_0x6b0e('0x27')](_0x52276c));};}function handleResult(_0x156387){return function(_0xab68b4){logger[_0x6b0e('0xb')](_0x6b0e('0x31'),JSON[_0x6b0e('0x27')](_0xab68b4));if(_0x156387[_0x6b0e('0xe')]&&_0x156387[_0x6b0e('0xe')][_0x6b0e('0xf')]&&!_['isNil'](_0x156387[_0x6b0e('0xd')])){setTimeout(handleSendEmail(_0x156387,_0xab68b4),0x3c*0x3e8);}};}function handleJob(_0x2bfb88){return function(){try{if(_[_0x6b0e('0x32')](_0x2bfb88['subtractNumber'])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x2bfb88['subtractUnit'])){return logger[_0x6b0e('0xb')](_0x6b0e('0x33'));}var _0x5c09a7={'startDate':moment()[_0x6b0e('0x34')](_0x2bfb88[_0x6b0e('0x35')],_0x2bfb88[_0x6b0e('0x1a')])[_0x6b0e('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x6b0e('0x15')](_0x6b0e('0x36')),'type':_0x6b0e('0x37'),'output':_0x2bfb88['output'],'name':_0x2bfb88[_0x6b0e('0x19')]};if(!_[_0x6b0e('0x32')](_0x2bfb88['DefaultReportId'])){logger[_0x6b0e('0xb')](_0x6b0e('0x38'),_0x2bfb88[_0x6b0e('0x39')]);return analyticDefaultReportController['runReport']({'id':_0x2bfb88['DefaultReportId']},_0x5c09a7)['then'](handleResult(_0x2bfb88))[_0x6b0e('0x30')](handleError());}if(!_[_0x6b0e('0x32')](_0x2bfb88['CustomReportId'])){logger[_0x6b0e('0xb')](_0x6b0e('0x3a'),_0x2bfb88[_0x6b0e('0x3b')]);return analyticCustomReportController[_0x6b0e('0x3c')]({'id':_0x2bfb88[_0x6b0e('0x3b')]},_0x5c09a7)[_0x6b0e('0x2d')](handleResult(_0x2bfb88))[_0x6b0e('0x30')](handleError());}}catch(_0x5aacdc){logger[_0x6b0e('0x2e')](JSON[_0x6b0e('0x27')](_0x5aacdc));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x54b837){var _0x3907f9={};if(_0x54b837){_0x3907f9['id']=_0x54b837;}return db['Schedule'][_0x6b0e('0x3d')]({'where':_0x3907f9,'include':[{'model':db[_0x6b0e('0xe')],'attributes':['id',_0x6b0e('0x19'),_0x6b0e('0xd')],'include':[{'model':db[_0x6b0e('0x3e')],'as':_0x6b0e('0xf')}]}]})['then'](function(_0x512ad0){var _0x49fc5c=_[_0x6b0e('0x3f')](manager[_0x6b0e('0x40')]);var _0xd18bc1=_[_0x6b0e('0x41')](_0x512ad0,function(_0x1d17aa){return _0x1d17aa['id'][_0x6b0e('0x42')]();});var _0x2dad06=_[_0x6b0e('0x43')](_0x512ad0,function(_0x4742a2){return _0x4742a2['id'][_0x6b0e('0x42')]();});var _0x1a36e5=_0x54b837?_0xd18bc1:_[_0x6b0e('0x44')](_0xd18bc1,_0x49fc5c);var _0x4e279c=_[_0x6b0e('0x45')](_0xd18bc1,_0x49fc5c);var _0x3d215f=_['difference'](_0x49fc5c,_0xd18bc1);var _0x23edf2;var _0x3ad164;for(_0x23edf2=0x0;_0x23edf2<_0x3d215f['length']&&!_0x54b837;_0x23edf2+=0x1){_0x3ad164=_0x3d215f[_0x23edf2][_0x6b0e('0x42')]();if(manager[_0x6b0e('0x46')](_0x3ad164)){manager['stop'](_0x3ad164);manager['deleteJob'](_0x3ad164);logger[_0x6b0e('0xb')]('delete\x20cron',_0x3ad164);}}logger[_0x6b0e('0xb')]('toRun',JSON[_0x6b0e('0x27')](_0x1a36e5));for(_0x23edf2=0x0;_0x23edf2<_0x1a36e5['length'];_0x23edf2+=0x1){_0x3ad164=_0x1a36e5[_0x23edf2][_0x6b0e('0x42')]();logger[_0x6b0e('0xb')]('index',_0x3ad164);if(_0x54b837){logger[_0x6b0e('0xb')]('my\x20id',_0x54b837);logger[_0x6b0e('0xb')](JSON['stringify'](_0x2dad06[_0x3ad164]));BPromise[_0x6b0e('0x47')]()[_0x6b0e('0x2d')](handleJob(_0x2dad06[_0x3ad164]));logger[_0x6b0e('0xb')](_0x6b0e('0x48'),_0x2dad06[_0x3ad164][_0x6b0e('0x19')],_0x2dad06[_0x3ad164][_0x6b0e('0x49')]);}else if(_0x2dad06[_0x3ad164][_0x6b0e('0x49')]&&_0x2dad06[_0x3ad164][_0x6b0e('0x4a')]&&moment()[_0x6b0e('0x4b')](_0x2dad06[_0x3ad164][_0x6b0e('0x4c')],_0x2dad06[_0x3ad164]['endAt'])){manager['add'](_0x3ad164,_0x2dad06[_0x3ad164][_0x6b0e('0x49')],handleJob(_0x2dad06[_0x3ad164]));manager[_0x6b0e('0x4d')](_0x3ad164);logger[_0x6b0e('0xb')](_0x6b0e('0x4e'),_0x2dad06[_0x3ad164]['name'],_0x2dad06[_0x3ad164][_0x6b0e('0x49')]);}else if(manager['exists'](_0x3ad164)){manager[_0x6b0e('0x4f')](_0x3ad164);manager[_0x6b0e('0x50')](_0x3ad164);logger[_0x6b0e('0xb')]('stop\x20cron',_0x2dad06[_0x3ad164]['name'],_0x2dad06[_0x3ad164][_0x6b0e('0x49')]);}}for(_0x23edf2=0x0,_0x3ad164;_0x23edf2<_0x4e279c[_0x6b0e('0x51')]&&!_0x54b837;_0x23edf2+=0x1){_0x3ad164=_0x4e279c[_0x23edf2]['toString']();if(manager[_0x6b0e('0x46')](_0x3ad164)){if(_0x2dad06[_0x3ad164]['cron']&&_0x2dad06[_0x3ad164][_0x6b0e('0x4a')]&&moment()[_0x6b0e('0x4b')](_0x2dad06[_0x3ad164][_0x6b0e('0x4c')],_0x2dad06[_0x3ad164]['endAt'])){manager[_0x6b0e('0x52')](_0x3ad164,_0x2dad06[_0x3ad164][_0x6b0e('0x49')],handleJob(_0x2dad06[_0x3ad164]));logger[_0x6b0e('0xb')](_0x6b0e('0x53'),_0x2dad06[_0x3ad164][_0x6b0e('0x19')],_0x2dad06[_0x3ad164][_0x6b0e('0x49')]);}else{manager[_0x6b0e('0x4f')](_0x3ad164);manager['deleteJob'](_0x3ad164);logger[_0x6b0e('0xb')](_0x6b0e('0x54'),_0x2dad06[_0x3ad164][_0x6b0e('0x19')],_0x2dad06[_0x3ad164]['cron']);}}}})[_0x6b0e('0x30')](function(_0xd6e812){logger[_0x6b0e('0x2e')](JSON[_0x6b0e('0x27')](_0xd6e812));});}exports['run']=function(_0x4b2808){return getJobs(_0x4b2808);};exports[_0x6b0e('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 51271f6..08d8688 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 _0x0a8f=['bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','data1','data2','transcribeRegion','transcribeName','then','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','TranscriptionJob','Transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','Sequelize','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','bucket','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','all','catch','start','lodash','aws-sdk','request-promise'];(function(_0x32f506,_0x5742dc){var _0x4facc8=function(_0x17049d){while(--_0x17049d){_0x32f506['push'](_0x32f506['shift']());}};_0x4facc8(++_0x5742dc);}(_0x0a8f,0xe1));var _0xf0a8=function(_0x138c78,_0x1e93fe){_0x138c78=_0x138c78-0x0;var _0x3135d3=_0x0a8f[_0x138c78];return _0x3135d3;};var _=require(_0xf0a8('0x0'));var AWS=require(_0xf0a8('0x1'));var rp=require(_0xf0a8('0x2'));var util=require('util');var BPromise=require(_0xf0a8('0x3'));var db=require(_0xf0a8('0x4'))['db'];var logger=require(_0xf0a8('0x5'))(_0xf0a8('0x6'));function getTranscriptionJob(_0x4dbc86,_0x3d5e53,_0x451e09,_0x1cc983){return new Promise(function(_0xe84e97,_0x3e297f){var _0xbd4617=new AWS[(_0xf0a8('0x7'))]({'accessKeyId':_0x3d5e53,'secretAccessKey':_0x4dbc86,'region':_0x451e09});_0xbd4617[_0xf0a8('0x8')]({'TranscriptionJobName':_0x1cc983},function(_0x407f8f,_0x26632f){if(_0x407f8f){return _0x3e297f(_0x407f8f);}else{return _0xe84e97(_0x26632f);}});});}function sentiment(_0x91e23a,_0x13c970,_0x4e54a0,_0x124bce,_0x4f2d90){return new Promise(function(_0x5bf883,_0x4ada49){var _0x1b26c3=new AWS['Comprehend']({'accessKeyId':_0x13c970,'secretAccessKey':_0x91e23a,'region':_0x4e54a0});_0x1b26c3[_0xf0a8('0x9')]({'Text':_0x124bce,'LanguageCode':_0x4f2d90[_0xf0a8('0xa')](0x0,0x2)},function(_0x3e533f,_0x2a73ab){if(_0x3e533f){return _0x4ada49(_0x3e533f);}else{return _0x5bf883(_0x2a73ab);}});});}function checkTranscribeJob(_0x55ac9b,_0xb833ff,_0x2652d7){var _0x44e4b3;return new BPromise(function(_0x320f50,_0x106241){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x55ac9b['id'],_0x55ac9b['transcribeName']));return getTranscriptionJob(_0x2652d7[_0xf0a8('0xd')],_0x2652d7[_0xf0a8('0xe')],_0xb833ff[_0xf0a8('0xf')],_0x55ac9b[_0xf0a8('0x10')])[_0xf0a8('0x11')](function(_0x5a7f9c){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x55ac9b['id'],_0x55ac9b[_0xf0a8('0x10')],_0x5a7f9c['TranscriptionJob'][_0xf0a8('0x12')]));if(!_0x55ac9b[_0xf0a8('0x13')]){switch(_0x5a7f9c['TranscriptionJob']['TranscriptionJobStatus']){case _0xf0a8('0x14'):var _0x4de3dc={'transcribeStatus':_0x5a7f9c['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x5a7f9c['TranscriptionJob']['Transcript'][_0xf0a8('0x15')]};logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x16'),_0x55ac9b['id']));return rp({'uri':_0x5a7f9c[_0xf0a8('0x17')][_0xf0a8('0x18')][_0xf0a8('0x15')],'json':!![]})[_0xf0a8('0x11')](function(_0x224e88){logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x55ac9b['id']));if(_0x224e88&&_0x224e88[_0xf0a8('0x19')]&&_0x224e88[_0xf0a8('0x19')][_0xf0a8('0x1a')]&&_0x224e88[_0xf0a8('0x19')][_0xf0a8('0x1a')]['length']){_0x4de3dc[_0xf0a8('0x13')]='';for(var _0x18ad0e=0x0;_0x18ad0e<_0x224e88[_0xf0a8('0x19')][_0xf0a8('0x1a')][_0xf0a8('0x1b')];_0x18ad0e++){_0x4de3dc[_0xf0a8('0x13')]+=_0x224e88['results']['transcripts'][_0x18ad0e][_0xf0a8('0x1c')]+'';}}return _0x55ac9b[_0xf0a8('0x1d')](_0x4de3dc);})[_0xf0a8('0x11')](function(){logger[_0xf0a8('0xb')](util['format'](_0xf0a8('0x1e'),_0x55ac9b['id']));if(!_0x55ac9b[_0xf0a8('0x1f')]){throw new db['Sequelize'][(_0xf0a8('0x20'))](_0xf0a8('0x21'));}if(!_0xb833ff[_0xf0a8('0x22')]||!_0xb833ff['sentimentAccountId']||!_0xb833ff[_0xf0a8('0x23')]||!_0xb833ff[_0xf0a8('0x24')]||!_0xb833ff['bucket']){throw new db['Sequelize'][(_0xf0a8('0x20'))](_0xf0a8('0x25'));}if(!_0x4de3dc[_0xf0a8('0x13')]){throw new Error(_0xf0a8('0x26'));}if(_0xb833ff[_0xf0a8('0x27')]===_0x2652d7['id']){return _0x2652d7;}else{return db[_0xf0a8('0x28')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf0a8('0x11')](function(_0x55d965){if(!_0x55d965){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x2a'));}if(!_0x55d965['data1']||!_0x55d965[_0xf0a8('0xe')]){throw new db['Sequelize'][(_0xf0a8('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x44e4b3=_0x55d965;logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x2b'),_0x55ac9b['id']));return sentiment(_0x44e4b3[_0xf0a8('0xd')],_0x44e4b3[_0xf0a8('0xe')],_0xb833ff[_0xf0a8('0x23')],_0x4de3dc[_0xf0a8('0x13')],_0xb833ff[_0xf0a8('0x24')]);})[_0xf0a8('0x11')](function(_0x1a8b3d){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x2c'),_0x55ac9b['id']));return _0x55ac9b[_0xf0a8('0x1d')]({'sentiment':_0x1a8b3d[_0xf0a8('0x2d')],'sPositive':_0x1a8b3d[_0xf0a8('0x2e')][_0xf0a8('0x2f')],'sNegative':_0x1a8b3d[_0xf0a8('0x2e')][_0xf0a8('0x30')],'sMixed':_0x1a8b3d[_0xf0a8('0x2e')][_0xf0a8('0x31')],'sNeutral':_0x1a8b3d['SentimentScore'][_0xf0a8('0x32')]});})[_0xf0a8('0x11')](function(){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x1e'),_0x55ac9b['id']));_0x320f50();});case'FAILED':return _0x55ac9b['update']({'transcribeStatus':_0xf0a8('0x33'),'failureReason':_0x5a7f9c[_0xf0a8('0x17')][_0xf0a8('0x34')]})[_0xf0a8('0x11')](function(){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x1e'),_0x55ac9b['id']));_0x320f50();});default:logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x35'),_0x55ac9b['id']));break;}}else{return BPromise[_0xf0a8('0x36')]()[_0xf0a8('0x11')](function(){if(!_0x55ac9b[_0xf0a8('0x1f')]){throw new db[(_0xf0a8('0x29'))]['ValidationError'](_0xf0a8('0x21'));}if(!_0xb833ff[_0xf0a8('0x22')]||!_0xb833ff[_0xf0a8('0x27')]||!_0xb833ff['sentimentRegion']||!_0xb833ff[_0xf0a8('0x24')]||!_0xb833ff['bucket']){throw new db[(_0xf0a8('0x29'))]['ValidationError'](_0xf0a8('0x25'));}if(!_0x55ac9b[_0xf0a8('0x13')]){throw new Error(_0xf0a8('0x26'));}if(_0xb833ff[_0xf0a8('0x27')]===_0x2652d7['id']){return _0x2652d7;}else{return db[_0xf0a8('0x28')][_0xf0a8('0x37')]({'where':{'id':_settings[_0xf0a8('0x27')]}});}})[_0xf0a8('0x11')](function(_0xba3dc1){if(!_0xba3dc1){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x2a'));}if(!_0xba3dc1[_0xf0a8('0xd')]||!_0xba3dc1['data2']){throw new db[(_0xf0a8('0x29'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x44e4b3=_0xba3dc1;logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x55ac9b['id']));return sentiment(_0x44e4b3[_0xf0a8('0xd')],_0x44e4b3[_0xf0a8('0xe')],_0xb833ff[_0xf0a8('0x23')],_0x55ac9b[_0xf0a8('0x13')],_0xb833ff['language']);})[_0xf0a8('0x11')](function(_0x25f36b){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x2c'),_0x55ac9b['id']));return _0x55ac9b[_0xf0a8('0x1d')]({'sentiment':_0x25f36b[_0xf0a8('0x2d')],'sPositive':_0x25f36b[_0xf0a8('0x2e')]['Positive'],'sNegative':_0x25f36b[_0xf0a8('0x2e')][_0xf0a8('0x30')],'sMixed':_0x25f36b[_0xf0a8('0x2e')]['Mixed'],'sNeutral':_0x25f36b[_0xf0a8('0x2e')]['Neutral'],'transcribeStatus':_0xf0a8('0x14')});})[_0xf0a8('0x11')](function(){logger[_0xf0a8('0xb')](util[_0xf0a8('0xc')](_0xf0a8('0x1e'),_0x55ac9b['id']));_0x320f50();});}})['catch'](function(_0x1a8f26){if(_0x1a8f26){if(!_0x1a8f26['name']||_0x1a8f26[_0xf0a8('0x38')]!==_0xf0a8('0x39')){logger[_0xf0a8('0x3a')](util['format'](_0xf0a8('0x3b'),_0x55ac9b['id']),util[_0xf0a8('0x3c')](_0x1a8f26,{'showHidden':![],'depth':null}));}}_0x320f50();});});}function checkTranscribe(){var _0x58e7f2;var _0x11b55e;var _0x41ddfc;return db[_0xf0a8('0x3d')][_0xf0a8('0x3e')]({'where':{'transcribeStatus':_0xf0a8('0x3f')}})[_0xf0a8('0x11')](function(_0x3ecc02){if(!_0x3ecc02||!_0x3ecc02[_0xf0a8('0x1b')]){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x40'));}_0x58e7f2=_0x3ecc02;return db[_0xf0a8('0x41')]['findOne']({'where':{'id':0x1}});})[_0xf0a8('0x11')](function(_0x1e3c47){if(!_0x1e3c47){throw new db['Sequelize'][(_0xf0a8('0x20'))](_0xf0a8('0x42'));}_0x11b55e=_0x1e3c47;if(!_0x11b55e[_0xf0a8('0x6')]||!_0x11b55e[_0xf0a8('0x43')]||!_0x11b55e[_0xf0a8('0xf')]||!_0x11b55e[_0xf0a8('0x24')]||!_0x11b55e[_0xf0a8('0x44')]){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x45'));}return db['CloudProvider'][_0xf0a8('0x37')]({'where':{'id':_0x11b55e[_0xf0a8('0x43')]}});})[_0xf0a8('0x11')](function(_0xa5f919){if(!_0xa5f919){throw new db['Sequelize'][(_0xf0a8('0x20'))](_0xf0a8('0x2a'));}if(!_0xa5f919[_0xf0a8('0xd')]||!_0xa5f919[_0xf0a8('0xe')]){throw new db[(_0xf0a8('0x29'))][(_0xf0a8('0x20'))](_0xf0a8('0x46'));}_0x41ddfc=_0xa5f919;var _0x37df8f=[];_0x58e7f2[_0xf0a8('0x47')](function(_0x2702ef){_0x37df8f[_0xf0a8('0x48')](checkTranscribeJob(_0x2702ef,_0x11b55e,_0x41ddfc));});return BPromise[_0xf0a8('0x49')](_0x37df8f);})[_0xf0a8('0x4a')](function(_0xe2362a){if(_0xe2362a){if(!_0xe2362a['name']||_0xe2362a[_0xf0a8('0x38')]!==_0xf0a8('0x39')){logger[_0xf0a8('0x3a')](util[_0xf0a8('0x3c')](_0xe2362a,{'showHidden':![],'depth':null}));}}});}exports[_0xf0a8('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x4a07=['push','all','SequelizeValidationError','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured'];(function(_0x1f7aee,_0x215f9a){var _0x4e6f66=function(_0x33c6e0){while(--_0x33c6e0){_0x1f7aee['push'](_0x1f7aee['shift']());}};_0x4e6f66(++_0x215f9a);}(_0x4a07,0x129));var _0x74a0=function(_0xc9de77,_0x555652){_0xc9de77=_0xc9de77-0x0;var _0x554679=_0x4a07[_0xc9de77];return _0x554679;};var _=require(_0x74a0('0x0'));var AWS=require(_0x74a0('0x1'));var rp=require(_0x74a0('0x2'));var util=require(_0x74a0('0x3'));var BPromise=require(_0x74a0('0x4'));var db=require(_0x74a0('0x5'))['db'];var logger=require(_0x74a0('0x6'))(_0x74a0('0x7'));function getTranscriptionJob(_0x1acbaa,_0x417401,_0x3d7aa0,_0x5cd603){return new Promise(function(_0x258cce,_0x25b359){var _0x25eb1e=new AWS[(_0x74a0('0x8'))]({'accessKeyId':_0x417401,'secretAccessKey':_0x1acbaa,'region':_0x3d7aa0});_0x25eb1e[_0x74a0('0x9')]({'TranscriptionJobName':_0x5cd603},function(_0x298da8,_0x367c94){if(_0x298da8){return _0x25b359(_0x298da8);}else{return _0x258cce(_0x367c94);}});});}function sentiment(_0x42693d,_0x357316,_0x8d0468,_0x2bbec2,_0x20ffef){return new Promise(function(_0x40b1bf,_0x33b07a){var _0x6d1c7a=new AWS[(_0x74a0('0xa'))]({'accessKeyId':_0x357316,'secretAccessKey':_0x42693d,'region':_0x8d0468});_0x6d1c7a[_0x74a0('0xb')]({'Text':_0x2bbec2,'LanguageCode':_0x20ffef['substring'](0x0,0x2)},function(_0x242866,_0x31e456){if(_0x242866){return _0x33b07a(_0x242866);}else{return _0x40b1bf(_0x31e456);}});});}function checkTranscribeJob(_0x71e7f7,_0x59e022,_0x460892){var _0x4fc9a4;return new BPromise(function(_0x1d908f,_0x2be30a){logger['info'](util[_0x74a0('0xc')](_0x74a0('0xd'),_0x71e7f7['id'],_0x71e7f7[_0x74a0('0xe')]));return getTranscriptionJob(_0x460892[_0x74a0('0xf')],_0x460892[_0x74a0('0x10')],_0x59e022['transcribeRegion'],_0x71e7f7[_0x74a0('0xe')])[_0x74a0('0x11')](function(_0x25153b){logger['info'](util[_0x74a0('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x71e7f7['id'],_0x71e7f7[_0x74a0('0xe')],_0x25153b[_0x74a0('0x12')]['TranscriptionJobStatus']));if(!_0x71e7f7[_0x74a0('0x13')]){switch(_0x25153b['TranscriptionJob'][_0x74a0('0x14')]){case _0x74a0('0x15'):var _0x231451={'transcribeStatus':_0x25153b[_0x74a0('0x12')][_0x74a0('0x14')],'fileUri':_0x25153b[_0x74a0('0x12')][_0x74a0('0x16')][_0x74a0('0x17')]};logger[_0x74a0('0x18')](util['format'](_0x74a0('0x19'),_0x71e7f7['id']));return rp({'uri':_0x25153b[_0x74a0('0x12')][_0x74a0('0x16')][_0x74a0('0x17')],'json':!![]})[_0x74a0('0x11')](function(_0x329cce){logger[_0x74a0('0x18')](util[_0x74a0('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x71e7f7['id']));if(_0x329cce&&_0x329cce['results']&&_0x329cce[_0x74a0('0x1a')][_0x74a0('0x1b')]&&_0x329cce[_0x74a0('0x1a')]['transcripts'][_0x74a0('0x1c')]){_0x231451[_0x74a0('0x13')]='';for(var _0x4c26a3=0x0;_0x4c26a3<_0x329cce[_0x74a0('0x1a')][_0x74a0('0x1b')][_0x74a0('0x1c')];_0x4c26a3++){_0x231451[_0x74a0('0x13')]+=_0x329cce[_0x74a0('0x1a')][_0x74a0('0x1b')][_0x4c26a3][_0x74a0('0x1d')]+'';}}return _0x71e7f7[_0x74a0('0x1e')](_0x231451);})[_0x74a0('0x11')](function(){logger[_0x74a0('0x18')](util[_0x74a0('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x71e7f7['id']));if(!_0x71e7f7[_0x74a0('0x1f')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x22'));}if(!_0x59e022[_0x74a0('0x23')]||!_0x59e022[_0x74a0('0x24')]||!_0x59e022[_0x74a0('0x25')]||!_0x59e022['language']||!_0x59e022[_0x74a0('0x26')]){throw new db['Sequelize'][(_0x74a0('0x21'))](_0x74a0('0x27'));}if(!_0x231451['fileText']){throw new Error(_0x74a0('0x28'));}if(_0x59e022[_0x74a0('0x24')]===_0x460892['id']){return _0x460892;}else{return db[_0x74a0('0x29')][_0x74a0('0x2a')]({'where':{'id':_settings[_0x74a0('0x24')]}});}})['then'](function(_0x2e306c){if(!_0x2e306c){throw new db['Sequelize'][(_0x74a0('0x21'))](_0x74a0('0x2b'));}if(!_0x2e306c[_0x74a0('0xf')]||!_0x2e306c[_0x74a0('0x10')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x4fc9a4=_0x2e306c;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x71e7f7['id']));return sentiment(_0x4fc9a4[_0x74a0('0xf')],_0x4fc9a4[_0x74a0('0x10')],_0x59e022[_0x74a0('0x25')],_0x231451['fileText'],_0x59e022[_0x74a0('0x2c')]);})[_0x74a0('0x11')](function(_0x3d519a){logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x2d'),_0x71e7f7['id']));return _0x71e7f7['update']({'sentiment':_0x3d519a[_0x74a0('0x2e')],'sPositive':_0x3d519a['SentimentScore']['Positive'],'sNegative':_0x3d519a[_0x74a0('0x2f')][_0x74a0('0x30')],'sMixed':_0x3d519a['SentimentScore'][_0x74a0('0x31')],'sNeutral':_0x3d519a['SentimentScore'][_0x74a0('0x32')]});})[_0x74a0('0x11')](function(){logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x33'),_0x71e7f7['id']));_0x1d908f();});case _0x74a0('0x34'):return _0x71e7f7[_0x74a0('0x1e')]({'transcribeStatus':_0x74a0('0x34'),'failureReason':_0x25153b[_0x74a0('0x12')][_0x74a0('0x35')]})[_0x74a0('0x11')](function(){logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x33'),_0x71e7f7['id']));_0x1d908f();});default:logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x36'),_0x71e7f7['id']));break;}}else{return BPromise[_0x74a0('0x37')]()[_0x74a0('0x11')](function(){if(!_0x71e7f7[_0x74a0('0x1f')]){throw new db['Sequelize'][(_0x74a0('0x21'))](_0x74a0('0x22'));}if(!_0x59e022[_0x74a0('0x23')]||!_0x59e022[_0x74a0('0x24')]||!_0x59e022[_0x74a0('0x25')]||!_0x59e022['language']||!_0x59e022[_0x74a0('0x26')]){throw new db['Sequelize'][(_0x74a0('0x21'))](_0x74a0('0x27'));}if(!_0x71e7f7[_0x74a0('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x59e022[_0x74a0('0x24')]===_0x460892['id']){return _0x460892;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x74a0('0x24')]}});}})['then'](function(_0xc3aa2){if(!_0xc3aa2){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x2b'));}if(!_0xc3aa2['data1']||!_0xc3aa2[_0x74a0('0x10')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x38'));}_0x4fc9a4=_0xc3aa2;logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x39'),_0x71e7f7['id']));return sentiment(_0x4fc9a4['data1'],_0x4fc9a4['data2'],_0x59e022[_0x74a0('0x25')],_0x71e7f7[_0x74a0('0x13')],_0x59e022[_0x74a0('0x2c')]);})[_0x74a0('0x11')](function(_0x141d2e){logger['info'](util[_0x74a0('0xc')](_0x74a0('0x2d'),_0x71e7f7['id']));return _0x71e7f7[_0x74a0('0x1e')]({'sentiment':_0x141d2e[_0x74a0('0x2e')],'sPositive':_0x141d2e['SentimentScore'][_0x74a0('0x3a')],'sNegative':_0x141d2e['SentimentScore'][_0x74a0('0x30')],'sMixed':_0x141d2e[_0x74a0('0x2f')][_0x74a0('0x31')],'sNeutral':_0x141d2e[_0x74a0('0x2f')][_0x74a0('0x32')],'transcribeStatus':_0x74a0('0x15')});})['then'](function(){logger[_0x74a0('0x18')](util[_0x74a0('0xc')](_0x74a0('0x33'),_0x71e7f7['id']));_0x1d908f();});}})[_0x74a0('0x3b')](function(_0x475387){if(_0x475387){if(!_0x475387[_0x74a0('0x3c')]||_0x475387[_0x74a0('0x3c')]!=='SequelizeValidationError'){logger['error'](util[_0x74a0('0xc')](_0x74a0('0x3d'),_0x71e7f7['id']),util[_0x74a0('0x3e')](_0x475387,{'showHidden':![],'depth':null}));}}_0x1d908f();});});}function checkTranscribe(){var _0x42a318;var _0xdd4e10;var _0x267084;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x74a0('0x11')](function(_0x4929b7){if(!_0x4929b7||!_0x4929b7[_0x74a0('0x1c')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x3f'));}_0x42a318=_0x4929b7;return db[_0x74a0('0x40')][_0x74a0('0x2a')]({'where':{'id':0x1}});})[_0x74a0('0x11')](function(_0x1e392c){if(!_0x1e392c){throw new db['Sequelize']['ValidationError']('Settings\x20not\x20available');}_0xdd4e10=_0x1e392c;if(!_0xdd4e10[_0x74a0('0x7')]||!_0xdd4e10[_0x74a0('0x41')]||!_0xdd4e10[_0x74a0('0x42')]||!_0xdd4e10[_0x74a0('0x2c')]||!_0xdd4e10[_0x74a0('0x26')]){throw new db[(_0x74a0('0x20'))]['ValidationError'](_0x74a0('0x43'));}return db[_0x74a0('0x29')][_0x74a0('0x2a')]({'where':{'id':_0xdd4e10[_0x74a0('0x41')]}});})[_0x74a0('0x11')](function(_0x19c44c){if(!_0x19c44c){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))](_0x74a0('0x2b'));}if(!_0x19c44c[_0x74a0('0xf')]||!_0x19c44c[_0x74a0('0x10')]){throw new db[(_0x74a0('0x20'))][(_0x74a0('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x267084=_0x19c44c;var _0x5f6950=[];_0x42a318['forEach'](function(_0x525eec){_0x5f6950[_0x74a0('0x44')](checkTranscribeJob(_0x525eec,_0xdd4e10,_0x267084));});return BPromise[_0x74a0('0x45')](_0x5f6950);})[_0x74a0('0x3b')](function(_0x1a0c07){if(_0x1a0c07){if(!_0x1a0c07['name']||_0x1a0c07[_0x74a0('0x3c')]!==_0x74a0('0x46')){logger[_0x74a0('0x47')](util[_0x74a0('0x3e')](_0x1a0c07,{'showHidden':![],'depth':null}));}}});}exports[_0x74a0('0x48')]=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 16472e9..bedcba4 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb909=['Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','hopper1','bulkCreate','contacts2','hopper2','util','push','Innocenzo'];(function(_0x345584,_0x2d5cbf){var _0x1bdf33=function(_0x51c696){while(--_0x51c696){_0x345584['push'](_0x345584['shift']());}};_0x1bdf33(++_0x2d5cbf);}(_0xb909,0xe7));var _0x9b90=function(_0xc5dc29,_0x29c165){_0xc5dc29=_0xc5dc29-0x0;var _0x52d1f8=_0xb909[_0xc5dc29];return _0x52d1f8;};'use strict';var util=require(_0x9b90('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9b90('0x1')]({'id':i,'firstName':_0x9b90('0x2')+i,'lastName':_0x9b90('0x3')+i,'phone':0xf879fb460+i,'email':_0x9b90('0x4')+i+_0x9b90('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x9b90('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9b90('0x6')](),'updatedAt':Date[_0x9b90('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x9b90('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x9b90('0x4')+i+_0x9b90('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9b90('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9b90('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9b90('0x6')]()});}db[_0x9b90('0x7')][_0x9b90('0x8')]({'where':{}})[_0x9b90('0x9')](function(){return db[_0x9b90('0x7')]['bulkCreate'](contacts);})[_0x9b90('0x9')](function(){console[_0x9b90('0xa')](_0x9b90('0xb'),_0x9b90('0xc'));return db[_0x9b90('0xd')][_0x9b90('0x8')]({'where':{}});})[_0x9b90('0x9')](function(){return db[_0x9b90('0xd')]['bulkCreate'](hopper);})['then'](function(){console[_0x9b90('0xa')]('finished\x20populating',_0x9b90('0xe'));return db[_0x9b90('0x7')][_0x9b90('0xf')](contacts2);})[_0x9b90('0x9')](function(){console[_0x9b90('0xa')](_0x9b90('0xb'),_0x9b90('0x10'));return db['CmHopper'][_0x9b90('0xf')](hopper2);})[_0x9b90('0x9')](function(){console[_0x9b90('0xa')](_0x9b90('0xb'),_0x9b90('0x11'));})['catch'](function(_0xd51307){console[_0x9b90('0xa')](_0xd51307);}); \ No newline at end of file +var _0x4dfc=['hopper1','hopper2','catch','util','../mysqldb','push','Innocenzo','now','Biondo','@xcally.com','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy'];(function(_0x2e0a25,_0x2da7a6){var _0x359873=function(_0x47fb4b){while(--_0x47fb4b){_0x2e0a25['push'](_0x2e0a25['shift']());}};_0x359873(++_0x2da7a6);}(_0x4dfc,0xdb));var _0xc4df=function(_0x7148b6,_0xa61534){_0x7148b6=_0x7148b6-0x0;var _0x111019=_0x4dfc[_0x7148b6];return _0x111019;};'use strict';var util=require(_0xc4df('0x0'));var db=require(_0xc4df('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc4df('0x2')]({'id':i,'firstName':_0xc4df('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc4df('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc4df('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc4df('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc4df('0x2')]({'id':i,'firstName':_0xc4df('0x3')+i,'lastName':_0xc4df('0x5')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc4df('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc4df('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc4df('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc4df('0x4')](),'updatedAt':Date['now']()});}db[_0xc4df('0x7')]['destroy']({'where':{}})[_0xc4df('0x8')](function(){return db[_0xc4df('0x7')][_0xc4df('0x9')](contacts);})[_0xc4df('0x8')](function(){console[_0xc4df('0xa')](_0xc4df('0xb'),_0xc4df('0xc'));return db[_0xc4df('0xd')][_0xc4df('0xe')]({'where':{}});})[_0xc4df('0x8')](function(){return db[_0xc4df('0xd')]['bulkCreate'](hopper);})[_0xc4df('0x8')](function(){console[_0xc4df('0xa')](_0xc4df('0xb'),_0xc4df('0xf'));return db[_0xc4df('0x7')][_0xc4df('0x9')](contacts2);})[_0xc4df('0x8')](function(){console[_0xc4df('0xa')](_0xc4df('0xb'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0xc4df('0xa')](_0xc4df('0xb'),_0xc4df('0x10'));})[_0xc4df('0x11')](function(_0x3f74bf){console[_0xc4df('0xa')](_0x3f74bf);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 04c87c8..72f375f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75f2=['agent','%s%s@xcally.com','password','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format'];(function(_0x5501e3,_0x38150d){var _0xe0b1fb=function(_0x47c045){while(--_0x47c045){_0x5501e3['push'](_0x5501e3['shift']());}};_0xe0b1fb(++_0x38150d);}(_0x75f2,0x155));var _0x275f=function(_0x2d1bf7,_0x27194c){_0x2d1bf7=_0x2d1bf7-0x0;var _0x59a33c=_0x75f2[_0x2d1bf7];return _0x59a33c;};'use strict';var util=require(_0x275f('0x0'));var db=require(_0x275f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x275f('0x2')]({'name':util[_0x275f('0x3')]('%s%s',_0x275f('0x4'),i),'fullname':util[_0x275f('0x3')]('%s%s','agent',i),'email':util[_0x275f('0x3')](_0x275f('0x5'),_0x275f('0x4'),i),'role':_0x275f('0x4'),'password':_0x275f('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x275f('0x7'),'ws',_0x275f('0x8')],'disallow':[_0x275f('0x9')],'allow':[_0x275f('0xa')],'defaultuser':util['format'](_0x275f('0xb'),_0x275f('0x4'),i),'encryption':_0x275f('0xc'),'avpf':_0x275f('0xc'),'force_avp':_0x275f('0xc'),'icesupport':_0x275f('0xc'),'dtlsenable':_0x275f('0xc'),'dtlsverify':'no','dtlscertfile':_0x275f('0xd'),'dtlsprivatekey':_0x275f('0xe'),'dtlssetup':_0x275f('0xf'),'callerid':util[_0x275f('0x3')](_0x275f('0x10'),util[_0x275f('0x3')](_0x275f('0xb'),'agent',i),0xfa0+i)});}db[_0x275f('0x11')][_0x275f('0x12')](users)[_0x275f('0x13')](function(){console[_0x275f('0x14')](_0x275f('0x15'));})[_0x275f('0x16')](function(_0x5ddbe5){console[_0x275f('0x14')](_0x5ddbe5);}); \ No newline at end of file +var _0x615d=['../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','add\x20user','catch','log'];(function(_0x3c30aa,_0x24c2b9){var _0x228198=function(_0xa6f556){while(--_0xa6f556){_0x3c30aa['push'](_0x3c30aa['shift']());}};_0x228198(++_0x24c2b9);}(_0x615d,0xbd));var _0xd615=function(_0x13f257,_0x3c3d67){_0x13f257=_0x13f257-0x0;var _0x455f37=_0x615d[_0x13f257];return _0x455f37;};'use strict';var util=require('util');var db=require(_0xd615('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd615('0x1')]({'name':util['format'](_0xd615('0x2'),_0xd615('0x3'),i),'fullname':util['format'](_0xd615('0x2'),_0xd615('0x3'),i),'email':util[_0xd615('0x4')](_0xd615('0x5'),'agent',i),'role':_0xd615('0x3'),'password':_0xd615('0x6'),'internal':0xfa0+i,'type':_0xd615('0x7'),'transport':[_0xd615('0x8'),'ws',_0xd615('0x9')],'disallow':[_0xd615('0xa')],'allow':[_0xd615('0xb')],'defaultuser':util[_0xd615('0x4')](_0xd615('0x2'),'agent',i),'encryption':_0xd615('0xc'),'avpf':_0xd615('0xc'),'force_avp':_0xd615('0xc'),'icesupport':_0xd615('0xc'),'dtlsenable':_0xd615('0xc'),'dtlsverify':'no','dtlscertfile':_0xd615('0xd'),'dtlsprivatekey':_0xd615('0xe'),'dtlssetup':_0xd615('0xf'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0xd615('0x2'),_0xd615('0x3'),i),0xfa0+i)});}db[_0xd615('0x10')][_0xd615('0x11')](users)['then'](function(){console['log'](_0xd615('0x12'));})[_0xd615('0x13')](function(_0x5b4c3a){console[_0xd615('0x14')](_0x5b4c3a);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index ed0e51e..b3c17e9 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74f0=['ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','userProfileId','Trunks','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','DISCONNECTED','CONNECTED','util','./environment','name','Agents','User','agent','telephone','ivr','UserProfileSection','findOne','then','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','UserProfileResource','resourceId','map','where','Campaign','type','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction'];(function(_0x42099b,_0x302849){var _0x811c40=function(_0xe11569){while(--_0xe11569){_0x42099b['push'](_0x42099b['shift']());}};_0x811c40(++_0x302849);}(_0x74f0,0xf3));var _0x074f=function(_0x53417c,_0x126dee){_0x53417c=_0x53417c-0x0;var _0x49407d=_0x74f0[_0x53417c];return _0x49407d;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x074f('0x1'));var queryQueues={'attributes':['id',_0x074f('0x2')],'include':[{'as':_0x074f('0x3'),'model':db[_0x074f('0x4')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x074f('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x074f('0x2')],'where':{'role':_0x074f('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x074f('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x074f('0x2')],'where':{'role':_0x074f('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x074f('0x2'),'type'],'where':{'type':_0x074f('0x7')}};function getAssociatedResources(_0xc853e0,_0x58588c,_0x252a2e){return db[_0x074f('0x8')][_0x074f('0x9')]({'where':{'name':_0xc853e0,'userProfileId':_0x58588c},'raw':!![]})[_0x074f('0xa')](function(_0x40179d){if(_0x40179d){if(_0x40179d['autoAssociation']){switch(_0xc853e0){case'VoiceQueues':case _0x074f('0xb'):case _0x074f('0xc'):case _0x074f('0xd'):case _0x074f('0xe'):case _0x074f('0xf'):case _0x074f('0x10'):return db[_0x252a2e][_0x074f('0x11')](queryQueues);case _0x074f('0x12'):return db[_0x252a2e][_0x074f('0x11')](queryTelephones);case'Trunks':return db[_0x252a2e][_0x074f('0x11')](queryTrunks);case'IvrCampaigns':return db[_0x252a2e][_0x074f('0x11')](queryCampaigns);}}else{return db[_0x074f('0x13')][_0x074f('0x11')]({'attributes':[_0x074f('0x14')],'where':{'sectionId':_0x40179d['id']},'raw':!![]})[_0x074f('0xa')](function(_0x237960){if(_0x237960){var _0x7e19fe={'where':{'id':_[_0x074f('0x15')](_0x237960,_0x074f('0x14'))},'raw':!![]};switch(_0x252a2e){case _0x074f('0x4'):_0x7e19fe[_0x074f('0x16')]['role']=_0x074f('0x6');break;case _0x074f('0x17'):_0x7e19fe[_0x074f('0x16')][_0x074f('0x18')]=_0x074f('0x7');break;}return db[_0x252a2e][_0x074f('0x11')](_0x7e19fe);}else{return[];}});}}else{return[];}})['then'](function(_0x568a50){return _0x568a50;});}function joinOrLeaveQueues(_0x1d241d,_0x5d8c10,_0x567f82,_0x38f21b){_0x1d241d[_0x5d8c10](util[_0x074f('0x19')](_0x074f('0x1a'),_0x567f82,_0x38f21b[_0x074f('0x2')]));if(_0x38f21b[_0x074f('0x3')]){for(var _0x210221=0x0;_0x210221<_0x38f21b[_0x074f('0x3')][_0x074f('0x1b')];_0x210221+=0x1){_0x1d241d[_0x5d8c10](util[_0x074f('0x19')](_0x074f('0x1c'),_0x38f21b[_0x074f('0x3')][_0x210221][_0x074f('0x2')]));}}}function joinOrLeave(_0x307f0f,_0x2fc5b0,_0x39e502){var _0x1bd2c7;if(_0x307f0f[_0x074f('0x1d')][_0x074f('0x1e')]['id']){db[_0x074f('0x4')][_0x074f('0x1f')]({'attributes':['id','name','role','userProfileId'],'where':{'id':_0x307f0f[_0x074f('0x1d')][_0x074f('0x1e')]['id']},'include':[{'model':db[_0x074f('0x20')],'as':_0x074f('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x074f('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x074f('0x23')],'as':_0x074f('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x074f('0x25')],'as':_0x074f('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x074f('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x074f('0x28')],'as':_0x074f('0x29'),'attributes':['id'],'raw':!![]}]})[_0x074f('0xa')](function(_0x53b76d){if(_0x53b76d){_0x1bd2c7=_0x53b76d;_0x307f0f[_0x2fc5b0](util[_0x074f('0x19')]('user:%s',_0x53b76d['name']));var _0x28cb12=[];switch(_0x53b76d['role']){case _0x074f('0x2a'):_0x307f0f[_0x2fc5b0](_0x074f('0x2b'));_0x307f0f[_0x2fc5b0](_0x074f('0x2c'));if(queryQueues[_0x074f('0x2d')]('include')){delete queryQueues[_0x074f('0x2e')];}_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x30')]['findAll'](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x31')][_0x074f('0x11')](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x32')]['findAll'](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x33')]['findAll'](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x34')][_0x074f('0x11')](queryQueues));_0x28cb12['push'](db[_0x074f('0x35')][_0x074f('0x11')](queryQueues));_0x28cb12['push'](db[_0x074f('0x36')][_0x074f('0x11')](queryQueues));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x4')][_0x074f('0x11')](queryTelephones));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x37')][_0x074f('0x11')](queryTrunks));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x17')]['findAll'](queryCampaigns));_0x28cb12[_0x074f('0x2f')](db[_0x074f('0x4')]['findAll'](queryAgents));break;case _0x074f('0x38'):_0x307f0f[_0x2fc5b0](_0x074f('0x2b'));_0x307f0f[_0x2fc5b0](_0x074f('0x2c'));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0x39'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x30')));_0x28cb12['push'](getAssociatedResources(_0x074f('0xb'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x31')));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0xc'),_0x53b76d[_0x074f('0x3a')],'FaxQueue'));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0xd'),_0x53b76d['userProfileId'],_0x074f('0x33')));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0xe'),_0x53b76d['userProfileId'],'MailQueue'));_0x28cb12['push'](getAssociatedResources(_0x074f('0xf'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x35')));_0x28cb12['push'](getAssociatedResources(_0x074f('0x10'),_0x53b76d[_0x074f('0x3a')],'WhatsappQueue'));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0x12'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x4')));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0x3b'),_0x53b76d[_0x074f('0x3a')],_0x074f('0x37')));_0x28cb12[_0x074f('0x2f')](getAssociatedResources(_0x074f('0x3c'),_0x53b76d['userProfileId'],_0x074f('0x17')));_0x28cb12['push'](db[_0x074f('0x4')]['findAll'](queryAgents));break;case _0x074f('0x5'):_0x307f0f[_0x2fc5b0]('voice:inbound');_0x307f0f[_0x2fc5b0](_0x074f('0x2c'));_0x28cb12['push'](_0x53b76d[_0x074f('0x3d')]({'attributes':['id',_0x074f('0x2')]}));_0x28cb12[_0x074f('0x2f')](_0x53b76d[_0x074f('0x3e')]({'attributes':['id',_0x074f('0x2')]}));_0x28cb12[_0x074f('0x2f')](_0x53b76d[_0x074f('0x3f')]({'attributes':['id','name']}));_0x28cb12[_0x074f('0x2f')](_0x53b76d[_0x074f('0x40')]({'attributes':['id',_0x074f('0x2')]}));_0x28cb12[_0x074f('0x2f')](_0x53b76d['getMailQueues']({'attributes':['id',_0x074f('0x2')]}));_0x28cb12['push'](_0x53b76d[_0x074f('0x41')]({'attributes':['id',_0x074f('0x2')]}));_0x28cb12[_0x074f('0x2f')](_0x53b76d['getWhatsappQueues']({'attributes':['id',_0x074f('0x2')]}));break;}return BPromise['all'](_0x28cb12);}})[_0x074f('0xa')](function(_0x2ed08a){if(_0x2ed08a&&_0x2ed08a['length']){for(var _0x37e864=0x0;_0x37e864<_0x2ed08a['length'];_0x37e864+=0x1){for(var _0x45492a=0x0;_0x45492a<_0x2ed08a[_0x37e864][_0x074f('0x1b')];_0x45492a+=0x1){switch(_0x37e864){case 0x0:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,'voice',_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x1:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,'chat',_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x2:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,'fax',_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x3:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,'sms',_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x4:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,_0x074f('0x42'),_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x5:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,_0x074f('0x43'),_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x6:joinOrLeaveQueues(_0x307f0f,_0x2fc5b0,_0x074f('0x44'),_0x2ed08a[_0x37e864][_0x45492a]);break;case 0x7:_0x307f0f[_0x2fc5b0](util[_0x074f('0x19')]('telephone:%s',_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x2')]));break;case 0x8:_0x307f0f[_0x2fc5b0](util[_0x074f('0x19')](_0x074f('0x45'),_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x2')]));break;case 0x9:_0x307f0f[_0x2fc5b0](util[_0x074f('0x19')](_0x074f('0x46'),_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x18')],_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x2')]));break;case 0xa:_0x307f0f[_0x2fc5b0](util['format'](_0x074f('0x1c'),_0x2ed08a[_0x37e864][_0x45492a][_0x074f('0x2')]));break;}}}}})[_0x074f('0xa')](function(){if(_0x2fc5b0===_0x074f('0x47')){var _0x522777=_[_0x074f('0x15')](_0x1bd2c7[_0x074f('0x21')],'id');return _0x1bd2c7['removeChatInteractions'](_0x522777)['then'](function(){for(var _0x3ac2ea=0x0;_0x3ac2ea<_0x522777[_0x074f('0x1b')];_0x3ac2ea+=0x1){_0x39e502[_0x074f('0x48')](_0x074f('0x49'),{'ChatInteractionId':Number(_0x522777[_0x3ac2ea]),'UserId':Number(_0x1bd2c7['id'])});}});}})['then'](function(){if(_0x2fc5b0==='leave'){var _0x3db639=_[_0x074f('0x15')](_0x1bd2c7[_0x074f('0x22')],'id');return _0x1bd2c7[_0x074f('0x4a')](_0x3db639)[_0x074f('0xa')](function(){for(var _0x151c90=0x0;_0x151c90<_0x3db639[_0x074f('0x1b')];_0x151c90+=0x1){_0x39e502[_0x074f('0x48')](_0x074f('0x4b'),{'MailInteractionId':Number(_0x3db639[_0x151c90]),'UserId':Number(_0x1bd2c7['id'])});}});}})['then'](function(){if(_0x2fc5b0===_0x074f('0x47')){var _0x3aa992=_[_0x074f('0x15')](_0x1bd2c7[_0x074f('0x24')],'id');return _0x1bd2c7[_0x074f('0x4c')](_0x3aa992)[_0x074f('0xa')](function(){for(var _0x47ba30=0x0;_0x47ba30<_0x3aa992[_0x074f('0x1b')];_0x47ba30+=0x1){_0x39e502[_0x074f('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3aa992[_0x47ba30]),'UserId':Number(_0x1bd2c7['id'])});}});}})[_0x074f('0xa')](function(){if(_0x2fc5b0===_0x074f('0x47')){var _0x1096b3=_[_0x074f('0x15')](_0x1bd2c7[_0x074f('0x26')],'id');return _0x1bd2c7[_0x074f('0x4d')](_0x1096b3)[_0x074f('0xa')](function(){for(var _0x141660=0x0;_0x141660<_0x1096b3[_0x074f('0x1b')];_0x141660+=0x1){_0x39e502[_0x074f('0x48')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1096b3[_0x141660]),'UserId':Number(_0x1bd2c7['id'])});}});}})[_0x074f('0xa')](function(){if(_0x2fc5b0==='leave'){var _0x572912=_[_0x074f('0x15')](_0x1bd2c7['OpenchannelInteractions'],'id');return _0x1bd2c7['removeOpenchannelInteractions'](_0x572912)[_0x074f('0xa')](function(){for(var _0x183c51=0x0;_0x183c51<_0x572912[_0x074f('0x1b')];_0x183c51+=0x1){_0x39e502[_0x074f('0x48')](_0x074f('0x4e'),{'OpenchannelInteractionId':Number(_0x572912[_0x183c51]),'UserId':Number(_0x1bd2c7['id'])});}});}})[_0x074f('0xa')](function(){if(_0x2fc5b0===_0x074f('0x47')){var _0x3afacd=_['map'](_0x1bd2c7['WhatsappInteractions'],'id');return _0x1bd2c7[_0x074f('0x4f')](_0x3afacd)[_0x074f('0xa')](function(){for(var _0x28fedf=0x0;_0x28fedf<_0x3afacd['length'];_0x28fedf+=0x1){_0x39e502[_0x074f('0x48')](_0x074f('0x50'),{'WhatsappInteractionId':Number(_0x3afacd[_0x28fedf]),'UserId':Number(_0x1bd2c7['id'])});}});}})['catch'](function(_0x54c348){_0x307f0f[_0x074f('0x51')](_0x54c348);});}}function onDisconnect(_0x4e06cb,_0x76c609){joinOrLeave(_0x4e06cb,_0x074f('0x47'),_0x76c609);}function onConnect(_0x5b1f41){joinOrLeave(_0x5b1f41,_0x074f('0x52'));}exports[_0x074f('0x53')]=function(_0x1d19a3){_0x1d19a3['on'](_0x074f('0x54'),function(_0x19475b){_0x19475b[_0x074f('0x55')](0x0);_0x19475b[_0x074f('0x56')]=_0x19475b[_0x074f('0x57')][_0x074f('0x54')][_0x074f('0x58')]+':'+_0x19475b[_0x074f('0x57')][_0x074f('0x54')]['remotePort'];_0x19475b['connectedAt']=new Date();_0x19475b['log']=function(_0x3766f0){console['log'](_0x074f('0x59')+_0x19475b['nsp'][_0x074f('0x2')]+'['+_0x19475b[_0x074f('0x56')]+']',_0x3766f0);};_0x19475b['on']('disconnect',function(){onDisconnect(_0x19475b,_0x1d19a3);_0x19475b[_0x074f('0x51')](_0x074f('0x5a'));});onConnect(_0x19475b);_0x19475b[_0x074f('0x51')](_0x074f('0x5b'));});}; \ No newline at end of file +var _0x536f=['FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','type','format','%s:queue:%s','handshake','find','userProfileId','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','ChatQueue','SmsQueue','WhatsappQueues','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','Agents','User','name','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues'];(function(_0x5998aa,_0x44cbd0){var _0x2cbab6=function(_0x533c34){while(--_0x533c34){_0x5998aa['push'](_0x5998aa['shift']());}};_0x2cbab6(++_0x44cbd0);}(_0x536f,0x12b));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require(_0xf536('0x1'));var BPromise=require(_0xf536('0x2'));var db=require(_0xf536('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xf536('0x4'),'model':db[_0xf536('0x5')],'attributes':['id',_0xf536('0x6'),_0xf536('0x7')],'raw':!![],'where':{'role':_0xf536('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf536('0x6')],'where':{'role':_0xf536('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xf536('0x6')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf536('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf536('0x6'),'type'],'where':{'type':_0xf536('0xa')}};function getAssociatedResources(_0x24ffb0,_0x187e72,_0x4fd285){return db[_0xf536('0xb')][_0xf536('0xc')]({'where':{'name':_0x24ffb0,'userProfileId':_0x187e72},'raw':!![]})[_0xf536('0xd')](function(_0x2d5708){if(_0x2d5708){if(_0x2d5708[_0xf536('0xe')]){switch(_0x24ffb0){case _0xf536('0xf'):case'ChatQueues':case _0xf536('0x10'):case _0xf536('0x11'):case _0xf536('0x12'):case _0xf536('0x13'):case'WhatsappQueues':return db[_0x4fd285][_0xf536('0x14')](queryQueues);case _0xf536('0x15'):return db[_0x4fd285][_0xf536('0x14')](queryTelephones);case _0xf536('0x16'):return db[_0x4fd285][_0xf536('0x14')](queryTrunks);case _0xf536('0x17'):return db[_0x4fd285][_0xf536('0x14')](queryCampaigns);}}else{return db[_0xf536('0x18')][_0xf536('0x14')]({'attributes':[_0xf536('0x19')],'where':{'sectionId':_0x2d5708['id']},'raw':!![]})[_0xf536('0xd')](function(_0x2ec62e){if(_0x2ec62e){var _0x326bdb={'where':{'id':_[_0xf536('0x1a')](_0x2ec62e,_0xf536('0x19'))},'raw':!![]};switch(_0x4fd285){case _0xf536('0x5'):_0x326bdb[_0xf536('0x1b')][_0xf536('0x7')]=_0xf536('0x9');break;case'Campaign':_0x326bdb[_0xf536('0x1b')][_0xf536('0x1c')]=_0xf536('0xa');break;}return db[_0x4fd285][_0xf536('0x14')](_0x326bdb);}else{return[];}});}}else{return[];}})[_0xf536('0xd')](function(_0xd7d2f2){return _0xd7d2f2;});}function joinOrLeaveQueues(_0x259be9,_0x214977,_0x3b8974,_0x4915fe){_0x259be9[_0x214977](util[_0xf536('0x1d')](_0xf536('0x1e'),_0x3b8974,_0x4915fe['name']));if(_0x4915fe[_0xf536('0x4')]){for(var _0x24c8a6=0x0;_0x24c8a6<_0x4915fe['Agents']['length'];_0x24c8a6+=0x1){_0x259be9[_0x214977](util[_0xf536('0x1d')]('user:%s',_0x4915fe[_0xf536('0x4')][_0x24c8a6][_0xf536('0x6')]));}}}function joinOrLeave(_0x138903,_0x3ea45f,_0x14e5c9){var _0x32aa25;if(_0x138903[_0xf536('0x1f')]['query']['id']){db[_0xf536('0x5')][_0xf536('0x20')]({'attributes':['id',_0xf536('0x6'),_0xf536('0x7'),_0xf536('0x21')],'where':{'id':_0x138903[_0xf536('0x1f')][_0xf536('0x22')]['id']},'include':[{'model':db[_0xf536('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x24')],'as':_0xf536('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x26')],'as':_0xf536('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x28')],'as':_0xf536('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf536('0x2b')],'as':_0xf536('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xf536('0xd')](function(_0x2b2d05){if(_0x2b2d05){_0x32aa25=_0x2b2d05;_0x138903[_0x3ea45f](util[_0xf536('0x1d')](_0xf536('0x2d'),_0x2b2d05[_0xf536('0x6')]));var _0x1cc987=[];switch(_0x2b2d05[_0xf536('0x7')]){case _0xf536('0x2e'):_0x138903[_0x3ea45f](_0xf536('0x2f'));_0x138903[_0x3ea45f](_0xf536('0x30'));if(queryQueues[_0xf536('0x31')]('include')){delete queryQueues[_0xf536('0x32')];}_0x1cc987[_0xf536('0x33')](db[_0xf536('0x34')][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db['ChatQueue'][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db['FaxQueue'][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db['SmsQueue'][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x35')][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x36')]['findAll'](queryQueues));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x37')][_0xf536('0x14')](queryQueues));_0x1cc987[_0xf536('0x33')](db['User']['findAll'](queryTelephones));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x38')][_0xf536('0x14')](queryTrunks));_0x1cc987['push'](db[_0xf536('0x39')][_0xf536('0x14')](queryCampaigns));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x5')][_0xf536('0x14')](queryAgents));break;case _0xf536('0x3a'):_0x138903[_0x3ea45f](_0xf536('0x2f'));_0x138903[_0x3ea45f](_0xf536('0x30'));_0x1cc987[_0xf536('0x33')](getAssociatedResources(_0xf536('0xf'),_0x2b2d05[_0xf536('0x21')],'VoiceQueue'));_0x1cc987[_0xf536('0x33')](getAssociatedResources('ChatQueues',_0x2b2d05['userProfileId'],_0xf536('0x3b')));_0x1cc987[_0xf536('0x33')](getAssociatedResources(_0xf536('0x10'),_0x2b2d05[_0xf536('0x21')],'FaxQueue'));_0x1cc987['push'](getAssociatedResources(_0xf536('0x11'),_0x2b2d05[_0xf536('0x21')],_0xf536('0x3c')));_0x1cc987[_0xf536('0x33')](getAssociatedResources(_0xf536('0x12'),_0x2b2d05[_0xf536('0x21')],_0xf536('0x35')));_0x1cc987['push'](getAssociatedResources(_0xf536('0x13'),_0x2b2d05[_0xf536('0x21')],_0xf536('0x36')));_0x1cc987['push'](getAssociatedResources(_0xf536('0x3d'),_0x2b2d05['userProfileId'],'WhatsappQueue'));_0x1cc987['push'](getAssociatedResources('Telephones',_0x2b2d05[_0xf536('0x21')],_0xf536('0x5')));_0x1cc987['push'](getAssociatedResources(_0xf536('0x16'),_0x2b2d05['userProfileId'],_0xf536('0x38')));_0x1cc987[_0xf536('0x33')](getAssociatedResources(_0xf536('0x17'),_0x2b2d05[_0xf536('0x21')],_0xf536('0x39')));_0x1cc987[_0xf536('0x33')](db[_0xf536('0x5')][_0xf536('0x14')](queryAgents));break;case _0xf536('0x8'):_0x138903[_0x3ea45f]('voice:inbound');_0x138903[_0x3ea45f](_0xf536('0x30'));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x3e')]({'attributes':['id',_0xf536('0x6')]}));_0x1cc987[_0xf536('0x33')](_0x2b2d05['getChatQueues']({'attributes':['id','name']}));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x3f')]({'attributes':['id',_0xf536('0x6')]}));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x40')]({'attributes':['id',_0xf536('0x6')]}));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x41')]({'attributes':['id','name']}));_0x1cc987[_0xf536('0x33')](_0x2b2d05[_0xf536('0x42')]({'attributes':['id',_0xf536('0x6')]}));_0x1cc987['push'](_0x2b2d05[_0xf536('0x43')]({'attributes':['id','name']}));break;}return BPromise[_0xf536('0x44')](_0x1cc987);}})[_0xf536('0xd')](function(_0x4a161c){if(_0x4a161c&&_0x4a161c['length']){for(var _0x2ab459=0x0;_0x2ab459<_0x4a161c[_0xf536('0x45')];_0x2ab459+=0x1){for(var _0x2778fa=0x0;_0x2778fa<_0x4a161c[_0x2ab459][_0xf536('0x45')];_0x2778fa+=0x1){switch(_0x2ab459){case 0x0:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x46'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x1:joinOrLeaveQueues(_0x138903,_0x3ea45f,'chat',_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x2:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x47'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x3:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x48'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x4:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x49'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x5:joinOrLeaveQueues(_0x138903,_0x3ea45f,_0xf536('0x4a'),_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x6:joinOrLeaveQueues(_0x138903,_0x3ea45f,'whatsapp',_0x4a161c[_0x2ab459][_0x2778fa]);break;case 0x7:_0x138903[_0x3ea45f](util['format'](_0xf536('0x4b'),_0x4a161c[_0x2ab459][_0x2778fa][_0xf536('0x6')]));break;case 0x8:_0x138903[_0x3ea45f](util[_0xf536('0x1d')](_0xf536('0x4c'),_0x4a161c[_0x2ab459][_0x2778fa]['name']));break;case 0x9:_0x138903[_0x3ea45f](util[_0xf536('0x1d')](_0xf536('0x4d'),_0x4a161c[_0x2ab459][_0x2778fa]['type'],_0x4a161c[_0x2ab459][_0x2778fa][_0xf536('0x6')]));break;case 0xa:_0x138903[_0x3ea45f](util['format']('user:%s',_0x4a161c[_0x2ab459][_0x2778fa][_0xf536('0x6')]));break;}}}}})['then'](function(){if(_0x3ea45f==='leave'){var _0xb1812=_['map'](_0x32aa25['ChatInteractions'],'id');return _0x32aa25[_0xf536('0x4e')](_0xb1812)[_0xf536('0xd')](function(){for(var _0x50a080=0x0;_0x50a080<_0xb1812[_0xf536('0x45')];_0x50a080+=0x1){_0x14e5c9[_0xf536('0x4f')](_0xf536('0x50'),{'ChatInteractionId':Number(_0xb1812[_0x50a080]),'UserId':Number(_0x32aa25['id'])});}});}})[_0xf536('0xd')](function(){if(_0x3ea45f===_0xf536('0x51')){var _0x33cba5=_['map'](_0x32aa25[_0xf536('0x25')],'id');return _0x32aa25[_0xf536('0x52')](_0x33cba5)[_0xf536('0xd')](function(){for(var _0x3379b5=0x0;_0x3379b5<_0x33cba5[_0xf536('0x45')];_0x3379b5+=0x1){_0x14e5c9['emit'](_0xf536('0x53'),{'MailInteractionId':Number(_0x33cba5[_0x3379b5]),'UserId':Number(_0x32aa25['id'])});}});}})[_0xf536('0xd')](function(){if(_0x3ea45f===_0xf536('0x51')){var _0x105b31=_[_0xf536('0x1a')](_0x32aa25[_0xf536('0x27')],'id');return _0x32aa25['removeFaxInteractions'](_0x105b31)[_0xf536('0xd')](function(){for(var _0x566e38=0x0;_0x566e38<_0x105b31['length'];_0x566e38+=0x1){_0x14e5c9['emit'](_0xf536('0x54'),{'FaxInteractionId':Number(_0x105b31[_0x566e38]),'UserId':Number(_0x32aa25['id'])});}});}})['then'](function(){if(_0x3ea45f===_0xf536('0x51')){var _0x59fd1f=_['map'](_0x32aa25[_0xf536('0x29')],'id');return _0x32aa25[_0xf536('0x55')](_0x59fd1f)[_0xf536('0xd')](function(){for(var _0xd6c024=0x0;_0xd6c024<_0x59fd1f[_0xf536('0x45')];_0xd6c024+=0x1){_0x14e5c9[_0xf536('0x4f')](_0xf536('0x56'),{'SmsInteractionId':Number(_0x59fd1f[_0xd6c024]),'UserId':Number(_0x32aa25['id'])});}});}})[_0xf536('0xd')](function(){if(_0x3ea45f===_0xf536('0x51')){var _0x14b26e=_[_0xf536('0x1a')](_0x32aa25[_0xf536('0x57')],'id');return _0x32aa25[_0xf536('0x58')](_0x14b26e)[_0xf536('0xd')](function(){for(var _0x5a46f6=0x0;_0x5a46f6<_0x14b26e[_0xf536('0x45')];_0x5a46f6+=0x1){_0x14e5c9[_0xf536('0x4f')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x14b26e[_0x5a46f6]),'UserId':Number(_0x32aa25['id'])});}});}})[_0xf536('0xd')](function(){if(_0x3ea45f==='leave'){var _0x3d95af=_[_0xf536('0x1a')](_0x32aa25[_0xf536('0x2c')],'id');return _0x32aa25[_0xf536('0x59')](_0x3d95af)[_0xf536('0xd')](function(){for(var _0x1c6e70=0x0;_0x1c6e70<_0x3d95af[_0xf536('0x45')];_0x1c6e70+=0x1){_0x14e5c9[_0xf536('0x4f')](_0xf536('0x5a'),{'WhatsappInteractionId':Number(_0x3d95af[_0x1c6e70]),'UserId':Number(_0x32aa25['id'])});}});}})['catch'](function(_0x2d22a7){_0x138903['log'](_0x2d22a7);});}}function onDisconnect(_0x126783,_0x276c4a){joinOrLeave(_0x126783,_0xf536('0x51'),_0x276c4a);}function onConnect(_0x27010e){joinOrLeave(_0x27010e,_0xf536('0x5b'));}exports[_0xf536('0x5c')]=function(_0x1ae035){_0x1ae035['on'](_0xf536('0x5d'),function(_0x328acf){_0x328acf['setMaxListeners'](0x0);_0x328acf[_0xf536('0x5e')]=_0x328acf[_0xf536('0x5f')][_0xf536('0x5d')][_0xf536('0x60')]+':'+_0x328acf[_0xf536('0x5f')]['connection'][_0xf536('0x61')];_0x328acf[_0xf536('0x62')]=new Date();_0x328acf[_0xf536('0x63')]=function(_0xaadf05){console[_0xf536('0x63')](_0xf536('0x64')+_0x328acf[_0xf536('0x65')][_0xf536('0x6')]+'['+_0x328acf['address']+']',_0xaadf05);};_0x328acf['on'](_0xf536('0x66'),function(){onDisconnect(_0x328acf,_0x1ae035);_0x328acf[_0xf536('0x63')](_0xf536('0x67'));});onConnect(_0x328acf);_0x328acf['log'](_0xf536('0x68'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index fe81535..d0f7044 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 _0xa383=['SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','afterUpdate','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','Trigger,\x20%s','code','error','get','event','direction','User','find','UserId','then','interface','format','name','incomingmessage','outgoingmessage','channel','opened','changed','closed','SIP/%s','catch','default','length','hasOwnProperty','model','hook','toLowerCase','condition','jayson/promise','../logger','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','closedinteraction','ChatMessage','newmessage'];(function(_0x4e5e92,_0x4e657e){var _0x486c68=function(_0x35966f){while(--_0x35966f){_0x4e5e92['push'](_0x4e5e92['shift']());}};_0x486c68(++_0x4e657e);}(_0xa383,0x1bc));var _0x3a38=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0xa383[_0xfb0cfd];return _0x2fd8aa;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x3a38('0x0'));var logger=require(_0x3a38('0x1'))(_0x3a38('0x2'));var client=jayson[_0x3a38('0x3')][_0x3a38('0x4')]({'port':0x232a});var triggers=[{'channel':_0x3a38('0x5'),'model':'ChatInteraction','event':_0x3a38('0x6'),'condition':_0x3a38('0x7'),'callback':afterCreate},{'channel':'Chat','model':_0x3a38('0x8'),'event':'afterUpdate','condition':_0x3a38('0x9'),'callback':afterUpdate},{'channel':_0x3a38('0x5'),'model':_0x3a38('0xa'),'event':_0x3a38('0x6'),'condition':_0x3a38('0xb'),'callback':afterCreateMessage},{'channel':'Sms','model':_0x3a38('0xc'),'event':_0x3a38('0x6'),'condition':_0x3a38('0x7'),'callback':afterCreate},{'channel':_0x3a38('0xd'),'model':'SmsInteraction','event':'afterUpdate','condition':_0x3a38('0x9'),'callback':afterUpdate},{'channel':'Sms','model':_0x3a38('0xe'),'event':'afterCreate','condition':_0x3a38('0xb'),'callback':afterCreateMessage},{'channel':_0x3a38('0xf'),'model':_0x3a38('0x10'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x3a38('0xf'),'model':_0x3a38('0x10'),'event':'afterUpdate','condition':_0x3a38('0x9'),'callback':afterUpdate},{'channel':_0x3a38('0xf'),'model':_0x3a38('0x11'),'event':'afterCreate','condition':_0x3a38('0xb'),'callback':afterCreateMessage},{'channel':_0x3a38('0x12'),'model':_0x3a38('0x13'),'event':_0x3a38('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x3a38('0x12'),'model':_0x3a38('0x13'),'event':_0x3a38('0x14'),'condition':_0x3a38('0x9'),'callback':afterUpdate},{'channel':_0x3a38('0x12'),'model':_0x3a38('0x15'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x3a38('0x16'),'event':'afterCreate','condition':_0x3a38('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0x3a38('0x16'),'event':_0x3a38('0x14'),'condition':_0x3a38('0x9'),'callback':afterUpdate},{'channel':_0x3a38('0x17'),'model':_0x3a38('0x18'),'event':_0x3a38('0x6'),'condition':_0x3a38('0xb'),'callback':afterCreateMessage},{'channel':_0x3a38('0x19'),'model':'OpenchannelInteraction','event':_0x3a38('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x3a38('0x19'),'model':_0x3a38('0x1a'),'event':_0x3a38('0x14'),'condition':_0x3a38('0x9'),'callback':afterUpdate},{'channel':_0x3a38('0x19'),'model':'OpenchannelMessage','event':_0x3a38('0x6'),'condition':_0x3a38('0xb'),'callback':afterCreateMessage}];function request(_0x3b0c9){return client[_0x3a38('0x1b')](_0x3a38('0x1c'),_0x3b0c9)['then'](function(_0x11e9e2){logger['info'](_0x3a38('0x1d'),_0x3a38('0x1c'),_0x11e9e2);if(_0x11e9e2['error']){if(_0x11e9e2['error'][_0x3a38('0x1e')]===0x1f4){logger['error'](_0x3a38('0x1d'),_0x3a38('0x1c'),_0x11e9e2[_0x3a38('0x1f')]);}}})['catch'](function(_0x455bb6){logger[_0x3a38('0x1f')]('Trigger,\x20%s',_0x3a38('0x1c'),_0x455bb6);});}function afterCreateMessage(_0x19557b,_0x5924d7){return function(_0x4130a7,_0x235ef3){_0x4130a7=_0x4130a7[_0x3a38('0x20')]({'plain':!![]});_0x4130a7['channel']=_0x19557b;_0x4130a7[_0x3a38('0x21')]=_0x4130a7[_0x3a38('0x22')];if(_0x4130a7['UserId']){return db[_0x3a38('0x23')][_0x3a38('0x24')]({'where':{'id':_0x4130a7[_0x3a38('0x25')]},'attributes':['id','name'],'raw':!![]})[_0x3a38('0x26')](function(_0x57c8a3){_0x4130a7[_0x3a38('0x27')]=util[_0x3a38('0x28')]('SIP/%s',_0x57c8a3[_0x3a38('0x29')]);_0x4130a7['channel']=_0x19557b;return request({'event':_0x3a38('0x2a'),'message':_0x4130a7});})['catch'](function(_0x398efd){console['error'](_0x398efd);});}else{return request({'event':_0x3a38('0x2b'),'message':_0x4130a7});}};}function afterCreate(_0x2662dd,_0x16b9b7){return function(_0x571ec5,_0x11722a){_0x571ec5=_0x571ec5[_0x3a38('0x20')]({'plain':!![]});_0x571ec5[_0x3a38('0x2c')]=_0x2662dd;_0x571ec5[_0x3a38('0x21')]=_0x3a38('0x2d');return request({'event':_0x16b9b7,'message':_0x571ec5});};}function afterUpdate(_0x41a93a,_0x2ad48d){return function(_0x2ef0c8,_0x46fdfc){if(_0x2ef0c8[_0x3a38('0x2e')](_0x3a38('0x2f'))&&_0x2ef0c8[_0x3a38('0x2f')]){_0x2ef0c8=_0x2ef0c8[_0x3a38('0x20')]({'plain':!![]});_0x2ef0c8['channel']=_0x41a93a;_0x2ef0c8[_0x3a38('0x21')]='closed';if(_0x2ef0c8[_0x3a38('0x25')]){return db['User'][_0x3a38('0x24')]({'where':{'id':_0x2ef0c8['UserId']},'attributes':['id',_0x3a38('0x29')],'raw':!![]})[_0x3a38('0x26')](function(_0x58446c){_0x2ef0c8[_0x3a38('0x27')]=util[_0x3a38('0x28')](_0x3a38('0x30'),_0x58446c[_0x3a38('0x29')]);return request({'event':_0x2ad48d,'message':_0x2ef0c8});})[_0x3a38('0x31')](function(_0x24cac0){console[_0x3a38('0x1f')](_0x24cac0);});}else{return request({'event':_0x2ad48d,'message':_0x2ef0c8});}}};}exports[_0x3a38('0x32')]=function(){for(var _0x48eb9a=0x0;_0x48eb9a=_0x56f2a2[_0xfe1d('0x12')]){throw Error(_0xfe1d('0x13'));}_0x42c34e(_0x3d9dae);})[_0xfe1d('0x14')](function(_0x4f600c){_0x19a37d(_0x4f600c);});});}; \ No newline at end of file +var _0x79cd=['./license/util','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','includes','clearBlockUser','blockedAt','updateAttributes','getLicense','role','agent','count','then','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb'];(function(_0x180a8f,_0x38325d){var _0x97c22b=function(_0x5d358b){while(--_0x5d358b){_0x180a8f['push'](_0x180a8f['shift']());}};_0x97c22b(++_0x38325d);}(_0x79cd,0xd0));var _0xd79c=function(_0x18e31a,_0x3c8310){_0x18e31a=_0x18e31a-0x0;var _0x2b4406=_0x79cd[_0x18e31a];return _0x2b4406;};'use strict';var _=require('lodash');var BPromise=require(_0xd79c('0x0'));var db=require(_0xd79c('0x1'))['db'];var util=require(_0xd79c('0x2'));var channels=['voice',_0xd79c('0x3'),_0xd79c('0x4'),_0xd79c('0x5'),_0xd79c('0x6'),'whatsapp',_0xd79c('0x7')];exports[_0xd79c('0x8')]=function(){return channels;};exports[_0xd79c('0x9')]=function(_0x17ef8b){_0x17ef8b=_0x17ef8b['toLowerCase']();return _[_0xd79c('0xa')](channels,_0x17ef8b);};exports[_0xd79c('0xb')]=function(_0x3ee423,_0x104b88,_0x4c176d,_0x2bfd0e){var _0xb6ce86={'loginAttempts':_0x104b88,'blocked':_0x4c176d};if(!_['isUndefined'](_0x2bfd0e)){_0xb6ce86[_0xd79c('0xc')]=_0x2bfd0e;}return _0x3ee423[_0xd79c('0xd')](_0xb6ce86);};exports[_0xd79c('0xe')]=function(_0x5f09e7){return new BPromise(function(_0x1effb5,_0x3855ca){var _0x5d1280=0x0;if(_0x5f09e7[_0xd79c('0xf')]!==_0xd79c('0x10')){_0x1effb5(_0x5f09e7);}db['User'][_0xd79c('0x11')]({'where':{'role':_0xd79c('0x10'),'online':!![],'id':{'$ne':_0x5f09e7['id']}}})[_0xd79c('0x12')](function(_0x142e0d){_0x5d1280=_0x142e0d;return util[_0xd79c('0xe')]();})[_0xd79c('0x12')](function(_0x44ed67){if(_0x44ed67&&_0x44ed67['agents']&&_0x5d1280>=_0x44ed67['agents']){throw Error(_0xd79c('0x13'));}_0x1effb5(_0x5f09e7);})[_0xd79c('0x14')](function(_0x19dac7){_0x3855ca(_0x19dac7);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 7610d89..52d16f7 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3aeb=['send','exports','404','status','render','json'];(function(_0x37ed66,_0x3dcf56){var _0x1f9872=function(_0x247a6d){while(--_0x247a6d){_0x37ed66['push'](_0x37ed66['shift']());}};_0x1f9872(++_0x3dcf56);}(_0x3aeb,0x115));var _0xb3ae=function(_0x342186,_0x24596f){_0x342186=_0x342186-0x0;var _0x58fd4a=_0x3aeb[_0x342186];return _0x58fd4a;};'use strict';module[_0xb3ae('0x0')][0x194]=function pageNotFound(_0x1f8f46,_0x45acab){var _0x5c8746=_0xb3ae('0x1');var _0x520a27=0x194;var _0x46ff58={'status':_0x520a27};_0x45acab['status'](_0x46ff58[_0xb3ae('0x2')]);_0x45acab[_0xb3ae('0x3')](_0x5c8746,{},function(_0x2aa7cf,_0x1db963){if(_0x2aa7cf){return _0x45acab[_0xb3ae('0x2')](_0x46ff58[_0xb3ae('0x2')])[_0xb3ae('0x4')](_0x46ff58);}_0x45acab[_0xb3ae('0x5')](_0x1db963);});}; \ No newline at end of file +var _0x1d51=['404','status','send'];(function(_0x39aae5,_0xfd2f27){var _0x266f9f=function(_0xe3e842){while(--_0xe3e842){_0x39aae5['push'](_0x39aae5['shift']());}};_0x266f9f(++_0xfd2f27);}(_0x1d51,0x183));var _0x11d5=function(_0x5cb1f0,_0x2d61f6){_0x5cb1f0=_0x5cb1f0-0x0;var _0x28c2fe=_0x1d51[_0x5cb1f0];return _0x28c2fe;};'use strict';module['exports'][0x194]=function pageNotFound(_0x3fe7b9,_0x1f82f6){var _0x32f0b0=_0x11d5('0x0');var _0x5b54f3=0x194;var _0x32c88b={'status':_0x5b54f3};_0x1f82f6[_0x11d5('0x1')](_0x32c88b[_0x11d5('0x1')]);_0x1f82f6['render'](_0x32f0b0,{},function(_0x15708d,_0x565071){if(_0x15708d){return _0x1f82f6[_0x11d5('0x1')](_0x32c88b[_0x11d5('0x1')])['json'](_0x32c88b);}_0x1f82f6[_0x11d5('0x2')](_0x565071);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 18730f7..0382212 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5334=['IntervalId','TagId','ListId','FaxAccountId','Interactions','Exntensions','FaxInteractionId','Tags','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatWebsiteId','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessage','ChatGroupId','Contacts','CompanyId','CmHopper','Company','cm_contact_has_tags','OwnerId','CampaignId','Automation','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','Trigger','AnyCondition','TriggerId','Fields','CustomReportId','AnalyticDefaultReport','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','FieldId','Variable','VariableId','Field','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Configuration','FreshsalesConfiguration','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','MailQueues','team_has_chat_queues','team_has_openchannel_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromUserId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','FromOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','HopperHistory','Queues','user_has_voice_prefixes','UserProfileSections','Resources','sectionId','WhatsappAccount','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappMessage','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','exports','path','../config/environment','sequelize','lodash','jstz','motion2','mysql','utf8_general_ci','sequelizeHistory','defaultsDeep','xcall','xC@LL1234','utf8mb4','name','utf8','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','VoiceQueuesLog','Schedule','Sound','../api/sound/sound.model','Tag','Template','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','UserId','Recordings','hasMany','VoiceQueuesRt','VoiceExtension','cascade','HopperFinals','CmHopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','Notifications','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','VoicePrefix','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_square_projects','SpiedAgents','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','Smtp','Disposition','Dispositions','Answers','Messages','List','TemplateId','team_has_mail_queues','Account','ContactId','Owner','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','restrict'];(function(_0x3c5b84,_0xaa08b8){var _0x340d3c=function(_0x24d687){while(--_0x24d687){_0x3c5b84['push'](_0x3c5b84['shift']());}};_0x340d3c(++_0xaa08b8);}(_0x5334,0x84));var _0x4533=function(_0x476226,_0x3e9ac5){_0x476226=_0x476226-0x0;var _0x1ff67e=_0x5334[_0x476226];return _0x1ff67e;};'use strict';var path=require(_0x4533('0x0'));var config=require(_0x4533('0x1'));var Sequelize=require(_0x4533('0x2'));var _=require(_0x4533('0x3'));var jstz=require(_0x4533('0x4'));var timezone=jstz['determine']();config[_0x4533('0x2')]=_['defaultsDeep'](config[_0x4533('0x2')],{'database':_0x4533('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4533('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x4533('0x7')}}});config[_0x4533('0x8')]=_[_0x4533('0x9')](config[_0x4533('0x8')],{'database':_0x4533('0x5'),'username':_0x4533('0xa'),'password':_0x4533('0xb'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x4533('0x6'),'dialectOptions':{'charset':_0x4533('0xc')},'logging':![],'timezone':timezone[_0x4533('0xd')](),'define':{'charset':_0x4533('0xe'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4533('0x2')]['database'],config[_0x4533('0x2')][_0x4533('0xf')],config[_0x4533('0x2')][_0x4533('0x10')],config['sequelize'][_0x4533('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x4533('0x8')][_0x4533('0x12')],config[_0x4533('0x8')]['username'],config[_0x4533('0x8')]['password'],config['sequelizeHistory'][_0x4533('0x11')])};db[_0x4533('0x13')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x15'));db[_0x4533('0x16')]=db['sequelize'][_0x4533('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x4533('0x17')]=db[_0x4533('0x2')]['import'](_0x4533('0x18'));db['VoiceExtension']=db['sequelize'][_0x4533('0x14')](_0x4533('0x19'));db['VoiceMusicOnHold']=db['sequelize'][_0x4533('0x14')](_0x4533('0x1a'));db[_0x4533('0x1b')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x1c'));db[_0x4533('0x1d')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x1e'));db[_0x4533('0x1f')]=db['sequelize']['import'](_0x4533('0x20'));db[_0x4533('0x21')]=db['sequelize']['import'](_0x4533('0x22'));db[_0x4533('0x23')]=db[_0x4533('0x2')]['import'](_0x4533('0x24'));db[_0x4533('0x25')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x26'));db[_0x4533('0x27')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x28'));db['VoiceAgentReport']=db['sequelize'][_0x4533('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x4533('0x29')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x2a'));db[_0x4533('0x2b')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x2c'));db[_0x4533('0x2d')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x2e'));db[_0x4533('0x2f')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x4533('0x30')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x31'));db[_0x4533('0x32')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x33'));db[_0x4533('0x34')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x35'));db[_0x4533('0x36')]=db[_0x4533('0x2')]['import'](_0x4533('0x37'));db[_0x4533('0x38')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x39'));db['UserSmsQueue']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x3a'));db[_0x4533('0x3b')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x4533('0x3c')]=db[_0x4533('0x2')]['import'](_0x4533('0x3d'));db[_0x4533('0x3e')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x3f'));db[_0x4533('0x40')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x41'));db[_0x4533('0x42')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x43'));db[_0x4533('0x44')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x45'));db[_0x4533('0x46')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x47'));db[_0x4533('0x48')]=db[_0x4533('0x2')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x4533('0x49')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x4a'));db[_0x4533('0x4b')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x4c'));db[_0x4533('0x4d')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x4e'));db[_0x4533('0x4f')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/dashboard/dashboard.model');db[_0x4533('0x50')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x51'));db[_0x4533('0x52')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x53'));db[_0x4533('0x54')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x55'));db[_0x4533('0x56')]=db['sequelize'][_0x4533('0x14')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x57'));db[_0x4533('0x58')]=db['sequelize']['import'](_0x4533('0x59'));db['SmsAccount']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize']['import']('../api/smsApplication/smsApplication.model');db[_0x4533('0x5a')]=db['sequelize'][_0x4533('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0x4533('0x5b')]=db['sequelize']['import'](_0x4533('0x5c'));db['SmsQueue']=db[_0x4533('0x2')]['import'](_0x4533('0x5d'));db[_0x4533('0x5e')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x5f'));db[_0x4533('0x60')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/openchannelApplication/openchannelApplication.model');db[_0x4533('0x61')]=db[_0x4533('0x2')]['import'](_0x4533('0x62'));db[_0x4533('0x63')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x64'));db[_0x4533('0x65')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x66'));db[_0x4533('0x67')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x68'));db[_0x4533('0x69')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x4533('0x6a')]=db['sequelize']['import'](_0x4533('0x6b'));db[_0x4533('0x6c')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0x4533('0x6d')]=db['sequelize']['import'](_0x4533('0x6e'));db['ChatOfflineMessage']=db[_0x4533('0x2')]['import'](_0x4533('0x6f'));db[_0x4533('0x70')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x71'));db['ChatGroup']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x72'));db['ChatProactiveAction']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x4533('0x73')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x74'));db[_0x4533('0x75')]=db['sequelize'][_0x4533('0x14')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x76'));db[_0x4533('0x77')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x78'));db[_0x4533('0x79')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x7a'));db['CmHopperHistory']=db[_0x4533('0x2')]['import'](_0x4533('0x7b'));db['ReportAgentPreview']=db[_0x4533('0x2')]['import'](_0x4533('0x7c'));db[_0x4533('0x7d')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x7e'));db[_0x4533('0x7f')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/action/action.model');db['Automation']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/automation/automation.model');db[_0x4533('0x80')]=db[_0x4533('0x2')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db['sequelize'][_0x4533('0x14')](_0x4533('0x81'));db[_0x4533('0x82')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x83'));db[_0x4533('0x84')]=db[_0x4533('0x2')]['import'](_0x4533('0x85'));db[_0x4533('0x86')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/pause/pause.model');db['Cdr']=db['sequelize'][_0x4533('0x14')]('../api/cdr/cdr.model');db[_0x4533('0x87')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x4533('0x88')]=db['sequelize'][_0x4533('0x14')]('../api/schedule/schedule.model');db[_0x4533('0x89')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x8a'));db[_0x4533('0x8b')]=db['sequelize'][_0x4533('0x14')]('../api/tag/tag.model');db[_0x4533('0x8c')]=db[_0x4533('0x2')]['import']('../api/template/template.model');db['Trigger']=db['sequelize'][_0x4533('0x14')](_0x4533('0x8d'));db['Variable']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x8e'));db[_0x4533('0x8f')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x90'));db[_0x4533('0x91')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x92'));db[_0x4533('0x93')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x94'));db['AnalyticDefaultReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x95'));db['AnalyticExtractedReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x96'));db[_0x4533('0x97')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x98'));db[_0x4533('0x99')]=db['sequelize']['import'](_0x4533('0x9a'));db[_0x4533('0x9b')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x9c'));db[_0x4533('0x9d')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x9e'));db['SalesforceConfiguration']=db['sequelize']['import'](_0x4533('0x9f'));db[_0x4533('0xa0')]=db[_0x4533('0x2')]['import'](_0x4533('0xa1'));db[_0x4533('0xa2')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xa3'));db[_0x4533('0xa4')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xa5'));db[_0x4533('0xa6')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xa7'));db[_0x4533('0xa8')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xa9'));db['DeskConfiguration']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xaa'));db['DeskField']=db[_0x4533('0x2')]['import'](_0x4533('0xab'));db[_0x4533('0xac')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xad'));db[_0x4533('0xae')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x4533('0xaf')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb0'));db['ZendeskAccount']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb1'));db[_0x4533('0xb2')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x4533('0xb3')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb4'));db[_0x4533('0xb5')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x4533('0xb6')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb7'));db['FreshdeskField']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xb8'));db[_0x4533('0xb9')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xba'));db[_0x4533('0xbb')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xbc'));db[_0x4533('0xbd')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xbe'));db[_0x4533('0xbf')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xc0'));db[_0x4533('0xc1')]=db[_0x4533('0x2')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x4533('0xc2')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xc3'));db['Dynamics365Configuration']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xc4'));db[_0x4533('0xc5')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x4533('0xc6')]=db['sequelize'][_0x4533('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x4533('0x2')][_0x4533('0x14')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x4533('0x8f')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x90'));db[_0x4533('0xc7')]=db[_0x4533('0x2')]['import'](_0x4533('0xc8'));db[_0x4533('0xc9')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x4533('0xca')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x4533('0xcb')]=db[_0x4533('0x2')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xcc'));db[_0x4533('0xcd')]=db[_0x4533('0x2')]['import'](_0x4533('0xce'));db['SmsQueueReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xcf'));db[_0x4533('0xd0')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xd1'));db[_0x4533('0xd2')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xd3'));db[_0x4533('0xd4')]=db[_0x4533('0x2')]['import'](_0x4533('0xd5'));db[_0x4533('0xd6')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xd7'));db[_0x4533('0xd8')]=db['sequelize'][_0x4533('0x14')](_0x4533('0xd9'));db[_0x4533('0xda')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xdb'));db[_0x4533('0xdc')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xdd'));db[_0x4533('0xde')]=db['sequelize'][_0x4533('0x14')]('../api/squareMessage/squareMessage.model');db[_0x4533('0xdf')]=db[_0x4533('0x2')]['import'](_0x4533('0xe0'));db[_0x4533('0xe1')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xe2'));db[_0x4533('0xe3')]=db[_0x4533('0x2')]['import'](_0x4533('0xe4'));db[_0x4533('0xe5')]=db[_0x4533('0x2')]['import']('../api/migration/migration.model');db[_0x4533('0xe6')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xe7'));db[_0x4533('0xe8')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xe9'));db[_0x4533('0xea')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db['sequelize'][_0x4533('0x14')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x4533('0x2')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x4533('0xeb')]=db[_0x4533('0x2')]['import'](_0x4533('0xec'));db[_0x4533('0xed')]=db[_0x4533('0x2')]['import'](_0x4533('0xee'));db[_0x4533('0xef')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xf0'));db['VoicePrefix']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xf1'));db[_0x4533('0xf2')]=db[_0x4533('0x2')]['import'](_0x4533('0xf3'));db[_0x4533('0xf4')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xf5'));db[_0x4533('0xf6')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x4533('0xf7')]=db[_0x4533('0x2')][_0x4533('0x14')]('../api/notification/notification.model');db['WhatsappAccount']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xf8'));db[_0x4533('0xf9')]=db['sequelize']['import'](_0x4533('0xfa'));db[_0x4533('0xfb')]=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xfc'));db['WhatsappMessage']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xfd'));db['WhatsappQueueReport']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0xfe'));db[_0x4533('0xff')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x100'));db['WhatsappQueue']=db[_0x4533('0x2')][_0x4533('0x14')](_0x4533('0x101'));db[_0x4533('0x102')]=db['sequelize'][_0x4533('0x14')](_0x4533('0x103'));db['User'][_0x4533('0x104')](db['VoiceMail'],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x1d')],{'as':_0x4533('0x106'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')][_0x4533('0x107')](db['UserVoiceQueueRt'],{'as':_0x4533('0x108'),'foreignKey':_0x4533('0x105')});db['User'][_0x4533('0x107')](db[_0x4533('0x109')],{'as':'Extensions','onDelete':_0x4533('0x10a'),'hooks':!![]});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x79')],{'as':_0x4533('0x10b'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x10c')],{'as':'HopperHistory','foreignKey':'UserId'});db['User'][_0x4533('0x107')](db[_0x4533('0x10d')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db['User'][_0x4533('0x107')](db[_0x4533('0x61')],{'as':_0x4533('0x10e'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')][_0x4533('0x107')](db[_0x4533('0x6c')],{'as':_0x4533('0x10f'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x5a')],{'as':_0x4533('0x110'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db[_0x4533('0x54')],{'as':'FaxInteractions','foreignKey':_0x4533('0x105')});db[_0x4533('0x13')][_0x4533('0x107')](db['MailInteraction'],{'as':_0x4533('0x111'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x13')]['hasMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x4533('0x105')});db['User']['hasMany'](db[_0x4533('0xf7')],{'as':_0x4533('0x112'),'foreignKey':'SenderId'});db[_0x4533('0x13')][_0x4533('0x113')](db[_0x4533('0xf2')],{'as':_0x4533('0xf2'),'foreignKey':_0x4533('0x114')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x116')],{'as':'Groups','through':_0x4533('0x117')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x75')],{'as':'Contacts','through':_0x4533('0x118')});db['User'][_0x4533('0x115')](db[_0x4533('0xef')],{'as':_0x4533('0x119'),'through':_0x4533('0x11a')});db[_0x4533('0x13')]['belongsToMany'](db[_0x4533('0xdf')],{'through':_0x4533('0x11b')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x48')],{'as':_0x4533('0x111'),'through':_0x4533('0x11c')});db[_0x4533('0x13')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0x4533('0x13')]['belongsToMany'](db['FaxInteraction'],{'as':_0x4533('0x11d'),'through':_0x4533('0x11e')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x5a')],{'as':_0x4533('0x110'),'through':'user_has_sms_interactions'});db[_0x4533('0x13')]['belongsToMany'](db[_0x4533('0x61')],{'as':_0x4533('0x10e'),'through':_0x4533('0x11f')});db['User'][_0x4533('0x115')](db['WhatsappInteraction'],{'as':_0x4533('0x120'),'through':_0x4533('0x121')});db[_0x4533('0x13')][_0x4533('0x115')](db['VoiceQueue'],{'as':_0x4533('0x122'),'through':_0x4533('0x32'),'required':![]});db[_0x4533('0x13')][_0x4533('0x115')](db['MailQueue'],{'as':'MailQueues','through':_0x4533('0x36'),'required':![]});db[_0x4533('0x13')]['belongsToMany'](db[_0x4533('0x70')],{'as':_0x4533('0x123'),'through':_0x4533('0x34'),'required':![],'hooks':!![]});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x124')],{'as':_0x4533('0x125'),'through':_0x4533('0x38'),'required':![]});db['User']['belongsToMany'](db['SmsQueue'],{'as':_0x4533('0x126'),'through':_0x4533('0x127'),'required':![]});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x65')],{'as':_0x4533('0x128'),'through':_0x4533('0x3b'),'required':![]});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x129')],{'as':_0x4533('0x12a'),'through':_0x4533('0x3c'),'required':![]});db['User'][_0x4533('0x115')](db['CmList'],{'through':_0x4533('0x11a')});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x12b')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0x67')],{'as':'ChatWebsites','through':_0x4533('0x12c')});db[_0x4533('0x13')]['belongsToMany'](db[_0x4533('0x12d')],{'as':_0x4533('0x12e'),'through':_0x4533('0x12f')});db[_0x4533('0x13')][_0x4533('0x115')](db['MailAccount'],{'as':_0x4533('0x130'),'through':_0x4533('0x131')});db['User']['belongsToMany'](db[_0x4533('0x5e')],{'as':'OpenchannelAccounts','through':_0x4533('0x132')});db['User'][_0x4533('0x115')](db[_0x4533('0x133')],{'as':_0x4533('0x134'),'through':_0x4533('0x135')});db[_0x4533('0x13')][_0x4533('0x115')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x4533('0x13')][_0x4533('0x115')](db[_0x4533('0xda')],{'as':'SquareProjects','through':_0x4533('0x136')});db['VoiceChanSpy'][_0x4533('0x107')](db[_0x4533('0x109')],{'as':_0x4533('0x137'),'onDelete':_0x4533('0x10a'),'foreignKey':'ChanSpyId'});db[_0x4533('0x17')][_0x4533('0x107')](db[_0x4533('0x109')],{'onDelete':_0x4533('0x10a')});db[_0x4533('0x109')]['hasMany'](db[_0x4533('0x109')],{'as':_0x4533('0x138'),'onDelete':'cascade'});db[_0x4533('0x139')][_0x4533('0x115')](db[_0x4533('0x89')],{'as':_0x4533('0x13a'),'through':_0x4533('0x13b')});db[_0x4533('0x1b')]['hasMany'](db[_0x4533('0x30')],{'as':_0x4533('0x13c'),'foreignKey':_0x4533('0x13d')});db[_0x4533('0x1b')]['hasMany'](db['CmHopper'],{'as':_0x4533('0x13e'),'foreignKey':'VoiceQueueId'});db[_0x4533('0x1b')][_0x4533('0x107')](db[_0x4533('0x79')],{'as':_0x4533('0x10b'),'foreignKey':_0x4533('0x13d')});db[_0x4533('0x1b')][_0x4533('0x107')](db[_0x4533('0x10c')],{'as':_0x4533('0x13f'),'foreignKey':'VoiceQueueId'});db[_0x4533('0x1b')][_0x4533('0x107')](db[_0x4533('0x10d')],{'as':_0x4533('0x10d'),'foreignKey':_0x4533('0x13d')});db['VoiceQueue'][_0x4533('0x107')](db['CmHopperBlack'],{'as':_0x4533('0x140'),'foreignKey':_0x4533('0x13d')});db[_0x4533('0x1b')]['hasMany'](db[_0x4533('0xcd')],{'as':_0x4533('0x141'),'foreignKey':_0x4533('0x13d')});db[_0x4533('0x1b')][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':_0x4533('0x2d'),'foreignKey':_0x4533('0x142')});db['VoiceQueue'][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':'TrunkBackup','foreignKey':_0x4533('0x143')});db[_0x4533('0x1b')][_0x4533('0x113')](db[_0x4533('0x84')],{'as':_0x4533('0x84'),'foreignKey':'IntervalId'});db[_0x4533('0x1b')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x1b')]['belongsToMany'](db[_0x4533('0xef')],{'as':_0x4533('0x119'),'through':_0x4533('0x146')});db[_0x4533('0x1b')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x147'),'through':_0x4533('0x32')});db['VoiceQueue']['belongsToMany'](db[_0x4533('0xdf')],{'as':_0x4533('0x148'),'through':_0x4533('0x149')});db[_0x4533('0x1b')][_0x4533('0x115')](db[_0x4533('0xef')],{'as':_0x4533('0x14a'),'through':_0x4533('0x14b')});db[_0x4533('0x1d')]['belongsTo'](db['User'],{'as':_0x4533('0x13'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x1f')]['belongsTo'](db[_0x4533('0x13')],{'as':_0x4533('0x13'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x21')][_0x4533('0x107')](db[_0x4533('0x23')],{'as':'Messages','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x14c'),'sourceKey':_0x4533('0x14d')});db[_0x4533('0x23')][_0x4533('0x113')](db[_0x4533('0x21')],{'foreignKey':'mailboxuser','targetKey':_0x4533('0x14d')});db[_0x4533('0x25')]['hasMany'](db[_0x4533('0x29')],{'as':_0x4533('0x14e'),'foreignKey':_0x4533('0x14f'),'constraints':![]});db[_0x4533('0x25')]['hasMany'](db['VoiceAgentReport'],{'as':_0x4533('0x150'),'foreignKey':_0x4533('0x14f'),'constraints':![]});db[_0x4533('0x25')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x13'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x25')][_0x4533('0x113')](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db[_0x4533('0x3e')][_0x4533('0x113')](db[_0x4533('0x42')],{'as':_0x4533('0x42'),'foreignKey':'MailAccountId'});db[_0x4533('0x40')]['belongsTo'](db['MailAccount'],{'as':_0x4533('0x42'),'foreignKey':_0x4533('0x152')});db['MailAccount']['hasOne'](db['MailServerIn'],{'as':'Imap','onDelete':_0x4533('0x10a')});db[_0x4533('0x42')]['hasOne'](db[_0x4533('0x40')],{'as':_0x4533('0x153'),'onDelete':_0x4533('0x10a')});db['MailAccount'][_0x4533('0x107')](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x152')});db[_0x4533('0x42')][_0x4533('0x107')](db[_0x4533('0x80')],{'as':_0x4533('0x156'),'foreignKey':_0x4533('0x152')});db['MailAccount'][_0x4533('0x107')](db[_0x4533('0x49')],{'as':_0x4533('0x157'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x4533('0x107')](db[_0x4533('0x48')],{'as':'Interactions'});db['MailAccount']['hasMany'](db['MailApplication'],{'as':_0x4533('0x138')});db[_0x4533('0x42')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':'ListId'});db[_0x4533('0x42')][_0x4533('0x113')](db[_0x4533('0x8c')],{'as':_0x4533('0x8c'),'foreignKey':_0x4533('0x159')});db[_0x4533('0x42')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x42')]['belongsToMany'](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':_0x4533('0x131')});db['MailQueue'][_0x4533('0x115')](db['User'],{'as':_0x4533('0x147'),'through':_0x4533('0x36')});db[_0x4533('0x44')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':_0x4533('0x15a'),'as':_0x4533('0x148')});db[_0x4533('0x48')][_0x4533('0x107')](db[_0x4533('0x49')],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x4533('0x48')][_0x4533('0x113')](db[_0x4533('0x42')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x152')});db[_0x4533('0x48')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':'Contact','foreignKey':_0x4533('0x15c')});db['MailInteraction'][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x15d'),'foreignKey':'UserId'});db[_0x4533('0x48')][_0x4533('0x115')](db['Tag'],{'through':_0x4533('0x15e'),'as':'Tags'});db[_0x4533('0x48')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x15e'),'as':_0x4533('0x15f')});db[_0x4533('0x48')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x160'),'through':_0x4533('0x11c'),'foreignKey':_0x4533('0x161')});db[_0x4533('0x49')][_0x4533('0x107')](db[_0x4533('0xe6')],{'as':_0x4533('0x162'),'onDelete':_0x4533('0x10a')});db['MailMessage'][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x13')});db['MailMessage'][_0x4533('0x113')](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':'Contact'});db[_0x4533('0x49')]['belongsTo'](db[_0x4533('0x48')],{'as':_0x4533('0x163'),'foreignKey':_0x4533('0x161')});db[_0x4533('0x49')][_0x4533('0x113')](db[_0x4533('0x42')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x152')});db[_0x4533('0x4b')][_0x4533('0x113')](db['User'],{'onDelete':_0x4533('0x164')});db[_0x4533('0x4b')][_0x4533('0x113')](db['MailQueue'],{'onDelete':_0x4533('0x164')});db[_0x4533('0x4b')]['belongsTo'](db[_0x4533('0x42')],{'onDelete':'restrict'});db[_0x4533('0x4b')][_0x4533('0x113')](db[_0x4533('0x84')],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x165')});db['MailApplication']['belongsTo'](db['Tag'],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x166')});db[_0x4533('0x4d')][_0x4533('0x113')](db[_0x4533('0x42')],{});db[_0x4533('0x4d')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':'List','foreignKey':_0x4533('0x167')});db[_0x4533('0x4d')][_0x4533('0x113')](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db[_0x4533('0x4d')]['belongsTo'](db[_0x4533('0x48')],{});db['MailQueueReport'][_0x4533('0x113')](db[_0x4533('0x49')],{});db['MailQueueReport'][_0x4533('0x113')](db['User'],{});db[_0x4533('0x4d')]['belongsTo'](db[_0x4533('0x44')],{});db[_0x4533('0x4f')]['hasMany'](db[_0x4533('0x50')],{'as':'Items','onDelete':'cascade'});db[_0x4533('0x12d')][_0x4533('0x107')](db['Disposition'],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x168')});db[_0x4533('0x12d')][_0x4533('0x107')](db[_0x4533('0x80')],{'as':_0x4533('0x156'),'foreignKey':_0x4533('0x168')});db[_0x4533('0x12d')]['hasMany'](db[_0x4533('0x54')],{'as':_0x4533('0x169')});db[_0x4533('0x12d')][_0x4533('0x107')](db[_0x4533('0x52')],{'as':_0x4533('0x138')});db[_0x4533('0x12d')][_0x4533('0x107')](db[_0x4533('0x109')],{'as':_0x4533('0x16a'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x12d')][_0x4533('0x107')](db[_0x4533('0x56')],{'as':_0x4533('0x157')});db[_0x4533('0x12d')][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':_0x4533('0x2d')});db[_0x4533('0x12d')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':'ListId'});db[_0x4533('0x12d')]['belongsTo'](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db['FaxAccount']['belongsToMany'](db['User'],{'as':'Agents','through':_0x4533('0x12f')});db['FaxApplication']['belongsTo'](db[_0x4533('0x13')],{'onDelete':_0x4533('0x164')});db['FaxApplication'][_0x4533('0x113')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x4533('0x52')][_0x4533('0x113')](db[_0x4533('0x12d')],{'onDelete':_0x4533('0x164')});db['FaxApplication'][_0x4533('0x113')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x4533('0x166')});db[_0x4533('0x54')][_0x4533('0x107')](db[_0x4533('0x56')],{'as':_0x4533('0x157'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x16b')});db['FaxInteraction'][_0x4533('0x113')](db['FaxAccount'],{'as':_0x4533('0x15b'),'foreignKey':'FaxAccountId'});db[_0x4533('0x54')]['belongsTo'](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x54')][_0x4533('0x113')](db['User'],{'as':_0x4533('0x15d'),'foreignKey':'UserId'});db[_0x4533('0x54')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':'fax_interaction_has_tags','as':_0x4533('0x16c')});db[_0x4533('0x54')]['belongsToMany'](db[_0x4533('0x8b')],{'through':_0x4533('0x16d'),'as':_0x4533('0x15f')});db[_0x4533('0x54')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':_0x4533('0x11e'),'foreignKey':'FaxInteractionId'});db[_0x4533('0x56')][_0x4533('0x113')](db['User'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x13')});db[_0x4533('0x56')]['belongsTo'](db[_0x4533('0x54')],{'as':_0x4533('0x163'),'foreignKey':_0x4533('0x16b')});db[_0x4533('0x56')][_0x4533('0x113')](db['CmContact'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x151')});db[_0x4533('0x56')][_0x4533('0x113')](db['Attachment'],{'as':_0x4533('0xe6'),'foreignKey':_0x4533('0x16e')});db['FaxMessage'][_0x4533('0x113')](db['FaxAccount'],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x168')});db['FaxQueue'][_0x4533('0x115')](db[_0x4533('0x13')],{'as':'Agents','through':'UserFaxQueue'});db[_0x4533('0x124')]['belongsToMany'](db[_0x4533('0xdf')],{'through':'team_has_fax_queues','as':_0x4533('0x148')});db[_0x4533('0x58')]['belongsTo'](db['FaxAccount'],{});db['FaxQueueReport']['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x58')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':'Contact','foreignKey':_0x4533('0x15c')});db[_0x4533('0x58')][_0x4533('0x113')](db[_0x4533('0x54')],{});db['FaxQueueReport']['belongsTo'](db[_0x4533('0x56')],{});db[_0x4533('0x58')][_0x4533('0x113')](db[_0x4533('0x13')],{});db['FaxQueueReport'][_0x4533('0x113')](db[_0x4533('0x124')],{});db[_0x4533('0x133')][_0x4533('0x107')](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x16f')});db['SmsAccount'][_0x4533('0x107')](db[_0x4533('0x80')],{'as':'Answers','foreignKey':_0x4533('0x16f')});db[_0x4533('0x133')][_0x4533('0x107')](db[_0x4533('0x5b')],{'as':_0x4533('0x157'),'foreignKey':'SmsAccountId'});db[_0x4533('0x133')][_0x4533('0x107')](db['SmsInteraction'],{'as':_0x4533('0x169')});db[_0x4533('0x133')][_0x4533('0x107')](db['SmsApplication'],{'as':_0x4533('0x138')});db[_0x4533('0x133')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x133')]['belongsTo'](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x133')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':'user_has_sms_accounts'});db[_0x4533('0x170')][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x164')});db['SmsApplication'][_0x4533('0x113')](db['SmsQueue'],{'onDelete':_0x4533('0x164')});db['SmsApplication'][_0x4533('0x113')](db[_0x4533('0x133')],{'onDelete':_0x4533('0x164')});db[_0x4533('0x170')][_0x4533('0x113')](db[_0x4533('0x84')],{'onDelete':'restrict','foreignKey':_0x4533('0x165')});db[_0x4533('0x170')][_0x4533('0x113')](db[_0x4533('0x8b')],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x166')});db[_0x4533('0x5a')][_0x4533('0x107')](db['SmsMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x4533('0x5a')][_0x4533('0x113')](db[_0x4533('0x133')],{'as':_0x4533('0x15b'),'foreignKey':'SmsAccountId'});db[_0x4533('0x5a')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':'Contact','foreignKey':'ContactId'});db[_0x4533('0x5a')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x4533('0x5a')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x171'),'as':_0x4533('0x16c')});db[_0x4533('0x5a')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x171'),'as':_0x4533('0x15f')});db[_0x4533('0x5a')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x160'),'through':'user_has_sms_interactions','foreignKey':_0x4533('0x172')});db['SmsMessage']['belongsTo'](db[_0x4533('0x13')],{'as':_0x4533('0x13')});db[_0x4533('0x5b')][_0x4533('0x113')](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':'Contact'});db[_0x4533('0x5b')][_0x4533('0x113')](db['SmsInteraction'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x163'),'foreignKey':_0x4533('0x172')});db[_0x4533('0x5b')][_0x4533('0x113')](db['SmsAccount'],{'as':'Account','foreignKey':_0x4533('0x16f')});db[_0x4533('0x173')]['belongsToMany'](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':_0x4533('0x127'),'foreignKey':_0x4533('0x174')});db[_0x4533('0x173')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':_0x4533('0x175'),'as':_0x4533('0x148')});db[_0x4533('0x5e')][_0x4533('0x107')](db['Disposition'],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x176')});db[_0x4533('0x5e')][_0x4533('0x107')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x4533('0x176')});db[_0x4533('0x5e')][_0x4533('0x107')](db[_0x4533('0x61')],{'as':_0x4533('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0x4533('0x5e')][_0x4533('0x107')](db[_0x4533('0x63')],{'as':'Messages','foreignKey':_0x4533('0x176')});db['OpenchannelAccount']['hasMany'](db[_0x4533('0x60')],{'as':_0x4533('0x138'),'foreignKey':_0x4533('0x176')});db[_0x4533('0x5e')]['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x5e')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x5e')]['belongsToMany'](db[_0x4533('0x13')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x4533('0x60')]['belongsTo'](db[_0x4533('0x13')],{'onDelete':'restrict'});db[_0x4533('0x60')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x177')});db[_0x4533('0x60')][_0x4533('0x113')](db[_0x4533('0x5e')],{'onDelete':_0x4533('0x164'),'foreignKey':'OpenchannelAccountId'});db[_0x4533('0x60')][_0x4533('0x113')](db[_0x4533('0x84')],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x165')});db['OpenchannelApplication']['belongsTo'](db[_0x4533('0x8b')],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x166')});db[_0x4533('0x61')]['hasMany'](db['OpenchannelMessage'],{'as':_0x4533('0x157'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x4533('0x61')][_0x4533('0x113')](db[_0x4533('0x5e')],{'as':_0x4533('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0x4533('0x61')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x61')][_0x4533('0x113')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x4533('0x61')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x178'),'as':_0x4533('0x16c')});db['OpenchannelInteraction'][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x178'),'as':_0x4533('0x15f')});db[_0x4533('0x61')]['belongsToMany'](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':_0x4533('0x11f'),'foreignKey':_0x4533('0x179')});db[_0x4533('0x63')][_0x4533('0x113')](db['User'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x13')});db[_0x4533('0x63')]['belongsTo'](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':'Contact'});db['OpenchannelMessage'][_0x4533('0x113')](db[_0x4533('0x61')],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x163'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x4533('0x113')](db[_0x4533('0xe6')],{'as':'Attachment','foreignKey':_0x4533('0x16e')});db[_0x4533('0x63')][_0x4533('0x113')](db[_0x4533('0x5e')],{'as':_0x4533('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0x4533('0x65')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x4533('0x3b'),'foreignKey':_0x4533('0x177')});db[_0x4533('0x65')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':'team_has_openchannel_queues','as':_0x4533('0x148')});db[_0x4533('0x67')]['hasMany'](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x17a')});db[_0x4533('0x67')][_0x4533('0x107')](db[_0x4533('0x80')],{'as':_0x4533('0x156'),'foreignKey':_0x4533('0x17a')});db[_0x4533('0x67')][_0x4533('0x107')](db[_0x4533('0x17b')],{'as':_0x4533('0x17c')});db['ChatWebsite'][_0x4533('0x107')](db[_0x4533('0x6c')],{'as':'Interactions'});db[_0x4533('0x67')][_0x4533('0x107')](db[_0x4533('0x6a')],{'as':'Applications'});db[_0x4533('0x67')]['hasMany'](db[_0x4533('0x6d')],{'as':'Messages'});db[_0x4533('0x67')][_0x4533('0x113')](db['CmList'],{'as':_0x4533('0x158'),'foreignKey':'ListId'});db[_0x4533('0x67')][_0x4533('0x113')](db[_0x4533('0x84')],{'as':_0x4533('0x84'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x67')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x4533('0x67')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':'user_has_chat_websites'});db[_0x4533('0x69')][_0x4533('0x113')](db[_0x4533('0x5e')],{});db[_0x4533('0x69')]['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x69')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db[_0x4533('0x69')][_0x4533('0x113')](db[_0x4533('0x61')],{});db[_0x4533('0x69')][_0x4533('0x113')](db[_0x4533('0x63')],{});db[_0x4533('0x69')]['belongsTo'](db[_0x4533('0x13')],{});db['OpenchannelQueueReport'][_0x4533('0x113')](db[_0x4533('0x65')],{});db[_0x4533('0x6a')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x17d'),'foreignKey':_0x4533('0x105'),'onDelete':_0x4533('0x164')});db[_0x4533('0x6a')][_0x4533('0x113')](db[_0x4533('0x70')],{'as':_0x4533('0x17e'),'foreignKey':_0x4533('0x17f'),'onDelete':_0x4533('0x164')});db[_0x4533('0x6a')]['belongsTo'](db[_0x4533('0x67')],{'as':'Website','foreignKey':_0x4533('0x17a'),'onDelete':_0x4533('0x164')});db['ChatApplication'][_0x4533('0x113')](db['Tag'],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x166')});db[_0x4533('0x6c')][_0x4533('0x107')](db[_0x4533('0x6d')],{'as':_0x4533('0x157'),'onDelete':_0x4533('0x10a'),'foreignKey':'ChatInteractionId'});db[_0x4533('0x6c')][_0x4533('0x113')](db[_0x4533('0x67')],{'as':'Account','foreignKey':_0x4533('0x17a')});db['ChatInteraction'][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x6c')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x15d'),'foreignKey':_0x4533('0x105')});db[_0x4533('0x6c')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x180'),'as':_0x4533('0x16c')});db[_0x4533('0x6c')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x180'),'as':_0x4533('0x15f')});db[_0x4533('0x6c')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x160'),'through':_0x4533('0x181'),'foreignKey':'ChatInteractionId'});db[_0x4533('0x6d')][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x10a'),'as':'User'});db[_0x4533('0x6d')][_0x4533('0x113')](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x6d')][_0x4533('0x113')](db[_0x4533('0x6c')],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x163'),'foreignKey':'ChatInteractionId'});db[_0x4533('0x6d')]['belongsTo'](db[_0x4533('0xe6')],{'as':'Attachment','foreignKey':_0x4533('0x16e')});db[_0x4533('0x6d')][_0x4533('0x113')](db[_0x4533('0x67')],{'as':'Account','foreignKey':_0x4533('0x17a')});db[_0x4533('0x182')][_0x4533('0x113')](db['CmContact'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db['ChatOfflineMessage']['belongsTo'](db[_0x4533('0x67')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x17a')});db['ChatQueue'][_0x4533('0x115')](db[_0x4533('0x13')],{'as':'Agents','through':_0x4533('0x34'),'hooks':!![]});db[_0x4533('0x70')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x4533('0x116')][_0x4533('0x107')](db['ChatInternalMessage'],{'as':_0x4533('0x157'),'foreignKey':_0x4533('0x183'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x116')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':'Members','through':_0x4533('0x117')});db[_0x4533('0x17b')][_0x4533('0x113')](db[_0x4533('0x67')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x4533('0x73')][_0x4533('0x107')](db[_0x4533('0x75')],{'as':_0x4533('0x184'),'foreignKey':_0x4533('0x185')});db[_0x4533('0x75')][_0x4533('0x107')](db[_0x4533('0x186')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x4533('0x75')][_0x4533('0x107')](db[_0x4533('0x79')],{'as':'HopperFinals','foreignKey':_0x4533('0x15c')});db['CmContact']['hasMany'](db['CmHopperHistory'],{'as':_0x4533('0x13f'),'foreignKey':'ContactId'});db[_0x4533('0x75')][_0x4533('0x107')](db[_0x4533('0x10d')],{'as':_0x4533('0x10d'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x75')]['hasMany'](db['JscriptySessionReport'],{'as':_0x4533('0x141'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x75')][_0x4533('0x107')](db['OpenchannelInteraction'],{'as':_0x4533('0x10e'),'foreignKey':_0x4533('0x15c'),'onDelete':_0x4533('0x164')});db[_0x4533('0x75')][_0x4533('0x107')](db['ChatInteraction'],{'as':_0x4533('0x10f'),'foreignKey':_0x4533('0x15c'),'onDelete':'restrict'});db['CmContact'][_0x4533('0x107')](db[_0x4533('0x5a')],{'as':_0x4533('0x110'),'foreignKey':_0x4533('0x15c'),'onDelete':_0x4533('0x164')});db[_0x4533('0x75')][_0x4533('0x107')](db[_0x4533('0x54')],{'as':'FaxInteractions','foreignKey':_0x4533('0x15c'),'onDelete':'restrict'});db['CmContact'][_0x4533('0x107')](db[_0x4533('0x48')],{'as':_0x4533('0x111'),'foreignKey':_0x4533('0x15c'),'onDelete':_0x4533('0x164')});db[_0x4533('0x75')][_0x4533('0x113')](db[_0x4533('0x73')],{'as':_0x4533('0x187'),'foreignKey':_0x4533('0x185')});db['CmContact'][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x75')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':'cm_user_has_contacts'});db[_0x4533('0x75')]['belongsToMany'](db[_0x4533('0x8b')],{'as':_0x4533('0x16c'),'through':_0x4533('0x188')});db[_0x4533('0x75')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':'cm_contact_has_tags','as':_0x4533('0x15f')});db[_0x4533('0x186')][_0x4533('0x113')](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c'),'onDelete':'cascade'});db['CmHopper'][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167'),'onDelete':_0x4533('0x10a')});db['CmHopper'][_0x4533('0x113')](db[_0x4533('0x13')],{'as':_0x4533('0x17d'),'foreignKey':'UserId'});db[_0x4533('0x186')][_0x4533('0x113')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x4533('0x13d'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x186')][_0x4533('0x113')](db[_0x4533('0xe3')],{'as':_0x4533('0xe3'),'foreignKey':'CampaignId','onDelete':_0x4533('0x10a')});db['CmHopper']['belongsTo'](db['User'],{'as':_0x4533('0x15d'),'foreignKey':_0x4533('0x189')});db[_0x4533('0x77')]['belongsTo'](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':'ContactId','onDelete':_0x4533('0x10a')});db['CmHopperBlack']['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x77')][_0x4533('0x113')](db[_0x4533('0x1b')],{'as':_0x4533('0x17e'),'foreignKey':_0x4533('0x13d'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x77')][_0x4533('0x113')](db[_0x4533('0xe3')],{'as':'Campaign','foreignKey':_0x4533('0x18a'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x18b')][_0x4533('0x107')](db[_0x4533('0x82')],{'as':{'plural':_0x4533('0x18c'),'singular':_0x4533('0x18d')},'foreignKey':_0x4533('0x18e'),'onDelete':_0x4533('0x10a'),'hooks':!![]});db['Automation'][_0x4533('0x107')](db['Condition'],{'as':{'plural':'Any','singular':_0x4533('0x18f')},'foreignKey':_0x4533('0x190'),'onDelete':_0x4533('0x10a'),'hooks':!![]});db[_0x4533('0x18b')][_0x4533('0x107')](db[_0x4533('0x7f')],{'as':_0x4533('0x191'),'foreignKey':'AutomationId','onDelete':_0x4533('0x10a'),'hooks':!![]});db[_0x4533('0x84')][_0x4533('0x107')](db[_0x4533('0x84')],{'as':_0x4533('0x192'),'foreignKey':_0x4533('0x165'),'onDelete':_0x4533('0x10a'),'hooks':!![],'required':![]});db[_0x4533('0x84')][_0x4533('0x107')](db['VoiceExtension'],{'as':_0x4533('0x193'),'foreignKey':_0x4533('0x165'),'onDelete':_0x4533('0x164')});db[_0x4533('0x84')]['hasMany'](db['MailApplication'],{'as':_0x4533('0x194'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x84')][_0x4533('0x107')](db[_0x4533('0x6a')],{'as':_0x4533('0x195'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x84')][_0x4533('0x107')](db['FaxApplication'],{'as':_0x4533('0x196'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x84')][_0x4533('0x107')](db[_0x4533('0x170')],{'as':_0x4533('0x197'),'foreignKey':_0x4533('0x165')});db[_0x4533('0x88')][_0x4533('0x113')](db['MailAccount'],{});db[_0x4533('0x88')][_0x4533('0x113')](db['AnalyticDefaultReport'],{'foreignKey':_0x4533('0x198')});db[_0x4533('0x88')][_0x4533('0x113')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db['Sound'][_0x4533('0x115')](db[_0x4533('0x139')],{'as':_0x4533('0x199'),'through':_0x4533('0x13b'),'onDelete':_0x4533('0x164')});db[_0x4533('0x8b')][_0x4533('0x115')](db[_0x4533('0x75')],{'through':_0x4533('0x188')});db[_0x4533('0x8b')][_0x4533('0x115')](db[_0x4533('0x6c')],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x4533('0x48')],{'through':_0x4533('0x15e')});db['Tag'][_0x4533('0x115')](db['SmsInteraction'],{'through':_0x4533('0x171')});db[_0x4533('0x8b')][_0x4533('0x115')](db[_0x4533('0x54')],{'through':_0x4533('0x16d')});db[_0x4533('0x8b')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x4533('0x178')});db['Tag'][_0x4533('0x115')](db['WhatsappInteraction'],{'through':_0x4533('0x19a')});db['Trigger'][_0x4533('0x107')](db[_0x4533('0x82')],{'as':{'plural':_0x4533('0x19b'),'singular':'AllCondition'},'foreignKey':_0x4533('0x19c'),'onDelete':_0x4533('0x10a'),'hooks':!![]});db[_0x4533('0x19d')][_0x4533('0x107')](db[_0x4533('0x82')],{'as':{'plural':'AnyConditions','singular':_0x4533('0x19e')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x4533('0x19d')][_0x4533('0x107')](db[_0x4533('0x7f')],{'as':_0x4533('0x191'),'foreignKey':_0x4533('0x19f'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x4533('0x99')],{'as':_0x4533('0x1a0'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a1'),'hooks':!![]});db[_0x4533('0x1a2')][_0x4533('0x107')](db[_0x4533('0x99')],{'as':_0x4533('0x1a0'),'onDelete':_0x4533('0x10a'),'foreignKey':'DefaultReportId'});db[_0x4533('0x97')]['hasMany'](db[_0x4533('0x99')],{'as':_0x4533('0x1a0'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x4533('0x99')]['belongsTo'](db[_0x4533('0x97')],{'foreignKey':_0x4533('0x1a3')});db[_0x4533('0x9d')]['hasMany'](db[_0x4533('0x1a4')],{'as':_0x4533('0x1a5'),'onDelete':'cascade','foreignKey':_0x4533('0x1a6')});db['SalesforceConfiguration'][_0x4533('0x107')](db[_0x4533('0xa0')],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0x1a4')][_0x4533('0x107')](db[_0x4533('0xa0')],{'as':_0x4533('0x1a9'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1aa')});db['SalesforceConfiguration'][_0x4533('0x107')](db[_0x4533('0xa0')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x4533('0x1a4')]['belongsTo'](db[_0x4533('0x9d')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db['SalesforceField']['hasMany'](db[_0x4533('0xa0')],{'as':_0x4533('0x1ab'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xa0')]['hasMany'](db[_0x4533('0xa0')],{'as':_0x4533('0x1ac'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x4533('0xa0')],{'as':'Field','foreignKey':_0x4533('0x1ad')});db[_0x4533('0xa0')]['belongsTo'](db[_0x4533('0x1ae')],{'as':'Variable','foreignKey':_0x4533('0x1af')});db['SugarcrmAccount'][_0x4533('0x107')](db[_0x4533('0xa4')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':'AccountId'});db[_0x4533('0xa4')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xa4')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1a9'),'onDelete':'cascade','foreignKey':_0x4533('0x1aa')});db[_0x4533('0xa4')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1a0'),'onDelete':'cascade','foreignKey':_0x4533('0x1ad')});db['SugarcrmConfiguration'][_0x4533('0x113')](db[_0x4533('0xa2')],{'as':_0x4533('0x15b'),'foreignKey':'AccountId'});db[_0x4533('0xa6')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1ab'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xa6')][_0x4533('0x107')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x4533('0x1aa')});db[_0x4533('0xa6')][_0x4533('0x107')](db[_0x4533('0xa6')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db['SugarcrmField'][_0x4533('0x113')](db['Variable'],{'as':_0x4533('0x1ae'),'foreignKey':_0x4533('0x1af')});db[_0x4533('0xa8')]['hasMany'](db[_0x4533('0x1b1')],{'as':_0x4533('0x1a5'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db['DeskConfiguration'][_0x4533('0x107')](db['DeskField'],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0x1b1')][_0x4533('0x107')](db[_0x4533('0x1b2')],{'as':_0x4533('0x1a9'),'onDelete':'cascade','foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1b1')][_0x4533('0x107')](db['DeskField'],{'as':_0x4533('0x1a0'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x4533('0x1b1')][_0x4533('0x113')](db[_0x4533('0xa8')],{'as':_0x4533('0x15b'),'foreignKey':'AccountId'});db[_0x4533('0x1b1')][_0x4533('0x115')](db['Tag'],{'through':_0x4533('0x1b3')});db[_0x4533('0x1b2')][_0x4533('0x107')](db[_0x4533('0x1b2')],{'as':_0x4533('0x1ab'),'foreignKey':'SubjectId'});db['DeskField'][_0x4533('0x107')](db['DeskField'],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1b2')][_0x4533('0x107')](db[_0x4533('0x1b2')],{'as':'Field','foreignKey':_0x4533('0x1ad')});db[_0x4533('0x1b2')][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':_0x4533('0x1ae'),'foreignKey':_0x4533('0x1af')});db[_0x4533('0xac')]['hasMany'](db[_0x4533('0xae')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db['ZohoConfiguration'][_0x4533('0x107')](db[_0x4533('0xaf')],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xae')][_0x4533('0x107')](db[_0x4533('0xaf')],{'as':_0x4533('0x1a9'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1aa')});db['ZohoConfiguration']['hasMany'](db[_0x4533('0xaf')],{'as':_0x4533('0x1a0'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xae')][_0x4533('0x113')](db['ZohoAccount'],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xaf')]['hasMany'](db[_0x4533('0xaf')],{'as':'Subject','foreignKey':_0x4533('0x1a8')});db[_0x4533('0xaf')][_0x4533('0x107')](db['ZohoField'],{'as':_0x4533('0x1ac'),'foreignKey':'DescriptionId'});db[_0x4533('0xaf')][_0x4533('0x107')](db[_0x4533('0xaf')],{'as':_0x4533('0x1b0'),'foreignKey':'FieldId'});db[_0x4533('0xaf')][_0x4533('0x113')](db['Variable'],{'as':'Variable','foreignKey':_0x4533('0x1af')});db[_0x4533('0x1b4')][_0x4533('0x107')](db[_0x4533('0xb2')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':'AccountId'});db[_0x4533('0xb2')]['hasMany'](db[_0x4533('0xb3')],{'as':_0x4533('0x1a7'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xb2')][_0x4533('0x107')](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x4533('0x1aa')});db[_0x4533('0xb2')]['hasMany'](db[_0x4533('0xb3')],{'as':_0x4533('0x1a0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xb2')][_0x4533('0x113')](db[_0x4533('0x1b4')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db['ZendeskConfiguration'][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x1b5')});db[_0x4533('0xb3')][_0x4533('0x107')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x4533('0x1a8')});db[_0x4533('0xb3')][_0x4533('0x107')](db[_0x4533('0xb3')],{'as':'Description','foreignKey':_0x4533('0x1aa')});db[_0x4533('0xb3')]['hasMany'](db[_0x4533('0xb3')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xb3')][_0x4533('0x113')](db['Variable'],{'as':_0x4533('0x1ae'),'foreignKey':'VariableId'});db[_0x4533('0xb5')]['hasMany'](db[_0x4533('0xb6')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xb6')][_0x4533('0x107')](db['FreshdeskField'],{'as':_0x4533('0x1a7'),'onDelete':'cascade','foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x4533('0x107')](db[_0x4533('0x1b6')],{'as':_0x4533('0x1a9'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0xb6')]['hasMany'](db[_0x4533('0x1b6')],{'as':_0x4533('0x1a0'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xb6')][_0x4533('0x113')](db[_0x4533('0xb5')],{'as':_0x4533('0x15b'),'foreignKey':'AccountId'});db[_0x4533('0xb6')][_0x4533('0x115')](db[_0x4533('0x8b')],{'through':_0x4533('0x1b7')});db[_0x4533('0x1b6')][_0x4533('0x107')](db[_0x4533('0x1b6')],{'as':_0x4533('0x1ab'),'foreignKey':'SubjectId'});db[_0x4533('0x1b6')][_0x4533('0x107')](db[_0x4533('0x1b6')],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1b6')]['hasMany'](db[_0x4533('0x1b6')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0x1b6')][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':_0x4533('0x1ae'),'foreignKey':_0x4533('0x1af')});db[_0x4533('0x1b8')]['hasMany'](db[_0x4533('0xb9')],{'as':_0x4533('0x1a5'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xb9')]['hasMany'](db[_0x4533('0xbb')],{'as':_0x4533('0x1a7'),'foreignKey':_0x4533('0x1a8')});db['VtigerConfiguration'][_0x4533('0x107')](db[_0x4533('0xbb')],{'as':_0x4533('0x1a9'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0xb9')][_0x4533('0x107')](db[_0x4533('0xbb')],{'as':'Fields','foreignKey':_0x4533('0x1ad')});db[_0x4533('0xb9')][_0x4533('0x113')](db['VtigerAccount'],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xbb')][_0x4533('0x107')](db['VtigerField'],{'as':_0x4533('0x1ab'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xbb')][_0x4533('0x107')](db[_0x4533('0xbb')],{'as':_0x4533('0x1ac'),'foreignKey':'DescriptionId'});db[_0x4533('0xbb')][_0x4533('0x107')](db[_0x4533('0xbb')],{'as':_0x4533('0x1b0'),'foreignKey':'FieldId'});db['VtigerField'][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':'Variable','foreignKey':_0x4533('0x1af')});db[_0x4533('0xbd')][_0x4533('0x107')](db[_0x4533('0xbf')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0xbf')]['hasMany'](db[_0x4533('0xc1')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x4533('0x107')](db[_0x4533('0xc1')],{'as':_0x4533('0x1a9'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0xbf')][_0x4533('0x107')](db[_0x4533('0xc1')],{'as':_0x4533('0x1a0'),'foreignKey':_0x4533('0x1ad')});db['ServicenowConfiguration'][_0x4533('0x113')](db[_0x4533('0xbd')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db['ServicenowField']['hasMany'](db[_0x4533('0xc1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x4533('0xc1')][_0x4533('0x107')](db[_0x4533('0xc1')],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db['ServicenowField'][_0x4533('0x107')](db[_0x4533('0xc1')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xc1')][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':_0x4533('0x1ae'),'foreignKey':_0x4533('0x1af')});db[_0x4533('0xc2')][_0x4533('0x107')](db[_0x4533('0x1b9')],{'as':_0x4533('0x1a5'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x4533('0x1b9')][_0x4533('0x107')](db[_0x4533('0xc5')],{'as':_0x4533('0x1a7'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0x1b9')][_0x4533('0x107')](db['Dynamics365Field'],{'as':_0x4533('0x1a9'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1aa')});db['Dynamics365Configuration'][_0x4533('0x107')](db[_0x4533('0xc5')],{'as':'Fields','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0x1b9')]['belongsTo'](db[_0x4533('0xc2')],{'as':'Account','foreignKey':_0x4533('0x1a6')});db[_0x4533('0xc5')]['hasMany'](db[_0x4533('0xc5')],{'as':_0x4533('0x1ab'),'foreignKey':_0x4533('0x1a8')});db[_0x4533('0xc5')][_0x4533('0x107')](db[_0x4533('0xc5')],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db['Dynamics365Field'][_0x4533('0x107')](db[_0x4533('0xc5')],{'as':_0x4533('0x1b0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0xc5')][_0x4533('0x113')](db[_0x4533('0x1ae')],{'as':'Variable','foreignKey':_0x4533('0x1af')});db[_0x4533('0xc6')][_0x4533('0x107')](db[_0x4533('0x1ba')],{'as':'Configurations','onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0x1ba')][_0x4533('0x107')](db[_0x4533('0x1bb')],{'as':_0x4533('0x1a7'),'foreignKey':'SubjectId'});db[_0x4533('0x1ba')]['hasMany'](db[_0x4533('0x1bb')],{'as':'Descriptions','foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1ba')][_0x4533('0x107')](db[_0x4533('0x1bb')],{'as':_0x4533('0x1a0'),'foreignKey':_0x4533('0x1ad')});db[_0x4533('0x1ba')][_0x4533('0x113')](db[_0x4533('0xc6')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1a6')});db[_0x4533('0x1bb')][_0x4533('0x107')](db[_0x4533('0x1bb')],{'as':_0x4533('0x1ab'),'foreignKey':'SubjectId'});db[_0x4533('0x1bb')][_0x4533('0x107')](db['FreshsalesField'],{'as':_0x4533('0x1ac'),'foreignKey':_0x4533('0x1aa')});db[_0x4533('0x1bb')][_0x4533('0x107')](db[_0x4533('0x1bb')],{'as':_0x4533('0x1b0'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db[_0x4533('0x1ae')],{'as':_0x4533('0x1ae'),'foreignKey':'VariableId'});db['ChatQueueReport']['belongsTo'](db[_0x4533('0x67')],{});db[_0x4533('0xc9')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0xc9')][_0x4533('0x113')](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0x4533('0x113')](db[_0x4533('0x6c')],{});db['ChatQueueReport'][_0x4533('0x113')](db[_0x4533('0x6d')],{});db[_0x4533('0xc9')][_0x4533('0x113')](db[_0x4533('0x13')],{});db[_0x4533('0xc9')]['belongsTo'](db[_0x4533('0x70')],{});db['ChatInternalMessage'][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1bc')});db[_0x4533('0xca')][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1bd')});db[_0x4533('0xcd')][_0x4533('0x107')](db[_0x4533('0x1be')],{'foreignKey':_0x4533('0x1bf'),'onDelete':'cascade'});db[_0x4533('0xcd')][_0x4533('0x107')](db[_0x4533('0xcb')],{'foreignKey':_0x4533('0x1bf'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x1c0')][_0x4533('0x113')](db['SmsAccount'],{});db[_0x4533('0x1c0')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x1c0')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':'ContactId'});db[_0x4533('0x1c0')][_0x4533('0x113')](db[_0x4533('0x5a')],{});db[_0x4533('0x1c0')][_0x4533('0x113')](db[_0x4533('0x5b')],{});db[_0x4533('0x1c0')]['belongsTo'](db[_0x4533('0x13')],{});db[_0x4533('0x1c0')]['belongsTo'](db[_0x4533('0x173')],{});db[_0x4533('0xd4')][_0x4533('0x107')](db['JscriptySessionReport'],{'foreignKey':_0x4533('0x1c1')});db[_0x4533('0xd4')][_0x4533('0x107')](db['JscriptyQuestionReport'],{'foreignKey':_0x4533('0x1c1')});db[_0x4533('0xd4')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x4533('0x1c1')});db[_0x4533('0xda')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':'user_has_square_projects'});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x147'),'through':_0x4533('0x11b')});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x1b')],{'through':_0x4533('0x149'),'as':_0x4533('0x122')});db['Team'][_0x4533('0x115')](db[_0x4533('0x44')],{'through':_0x4533('0x15a'),'as':_0x4533('0x1c2')});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x70')],{'through':_0x4533('0x1c3'),'as':_0x4533('0x123')});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x124')],{'through':'team_has_fax_queues','as':_0x4533('0x125')});db[_0x4533('0xdf')][_0x4533('0x115')](db['SmsQueue'],{'through':_0x4533('0x175'),'as':_0x4533('0x126')});db[_0x4533('0xdf')][_0x4533('0x115')](db['OpenchannelQueue'],{'through':_0x4533('0x1c4'),'as':'OpenchannelQueues'});db[_0x4533('0xdf')][_0x4533('0x115')](db[_0x4533('0x129')],{'through':'team_has_whatsapp_queues','as':_0x4533('0x12a')});db[_0x4533('0xe3')]['hasMany'](db['CmHopper'],{'as':_0x4533('0x13e'),'foreignKey':_0x4533('0x18a')});db[_0x4533('0xe3')][_0x4533('0x107')](db[_0x4533('0x79')],{'as':_0x4533('0x10b'),'foreignKey':'CampaignId'});db[_0x4533('0xe3')][_0x4533('0x107')](db['CmHopperHistory'],{'as':_0x4533('0x13f'),'foreignKey':_0x4533('0x18a')});db[_0x4533('0xe3')][_0x4533('0x107')](db['CmHopperBlack'],{'as':_0x4533('0x140'),'foreignKey':_0x4533('0x18a')});db[_0x4533('0xe3')][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':_0x4533('0x2d'),'foreignKey':_0x4533('0x142')});db['Campaign'][_0x4533('0x113')](db[_0x4533('0x2d')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x4533('0xe3')][_0x4533('0x113')](db[_0x4533('0x84')],{'as':_0x4533('0x84'),'foreignKey':_0x4533('0x165')});db['Campaign']['belongsTo'](db['SquareProject'],{'as':_0x4533('0xda'),'foreignKey':_0x4533('0x1c5')});db['Campaign']['belongsToMany'](db[_0x4533('0xef')],{'as':_0x4533('0x119'),'through':'campaigns_has_cm_lists'});db[_0x4533('0xe3')][_0x4533('0x115')](db[_0x4533('0xef')],{'as':_0x4533('0x14a'),'through':_0x4533('0x1c6')});db[_0x4533('0xea')]['belongsTo'](db[_0x4533('0x49')],{});db[_0x4533('0xea')][_0x4533('0x113')](db[_0x4533('0x48')],{});db[_0x4533('0xea')][_0x4533('0x113')](db[_0x4533('0x42')],{'foreignKey':_0x4533('0x1c7'),'as':_0x4533('0x1c8')});db[_0x4533('0xea')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':'FromUserId','as':_0x4533('0x1c9')});db[_0x4533('0xea')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db['MailTransferReport'][_0x4533('0x113')](db[_0x4533('0x44')],{'foreignKey':'ToMailQueueId','as':_0x4533('0x1cc')});db[_0x4533('0xea')]['belongsTo'](db[_0x4533('0x42')],{'foreignKey':_0x4533('0x1cd'),'as':_0x4533('0x1ce')});db[_0x4533('0x1cf')][_0x4533('0x113')](db['ChatMessage'],{});db[_0x4533('0x1cf')][_0x4533('0x113')](db[_0x4533('0x6c')],{});db[_0x4533('0x1cf')][_0x4533('0x113')](db['ChatWebsite'],{'foreignKey':_0x4533('0x1d0'),'as':'FromAccount'});db[_0x4533('0x1cf')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1d1'),'as':_0x4533('0x1c9')});db[_0x4533('0x1cf')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db[_0x4533('0x1cf')][_0x4533('0x113')](db[_0x4533('0x70')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0x4533('0x1cf')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x4533('0x1d2'),'as':'ToAccount'});db[_0x4533('0x1d3')][_0x4533('0x113')](db[_0x4533('0x56')],{});db[_0x4533('0x1d3')][_0x4533('0x113')](db[_0x4533('0x54')],{});db[_0x4533('0x1d3')][_0x4533('0x113')](db[_0x4533('0x12d')],{'foreignKey':'FromFaxAccountId','as':_0x4533('0x1c8')});db['FaxTransferReport']['belongsTo'](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1d1'),'as':_0x4533('0x1c9')});db[_0x4533('0x1d3')]['belongsTo'](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db[_0x4533('0x1d3')][_0x4533('0x113')](db[_0x4533('0x124')],{'foreignKey':_0x4533('0x1d4'),'as':_0x4533('0x1cc')});db[_0x4533('0x1d3')][_0x4533('0x113')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x4533('0xeb')][_0x4533('0x113')](db['OpenchannelMessage'],{});db[_0x4533('0xeb')][_0x4533('0x113')](db[_0x4533('0x61')],{});db[_0x4533('0xeb')][_0x4533('0x113')](db[_0x4533('0x5e')],{'foreignKey':_0x4533('0x1d5'),'as':'FromAccount'});db[_0x4533('0xeb')]['belongsTo'](db['User'],{'foreignKey':_0x4533('0x1d1'),'as':_0x4533('0x1c9')});db[_0x4533('0xeb')]['belongsTo'](db[_0x4533('0x13')],{'foreignKey':'ToUserId','as':_0x4533('0x1cb')});db[_0x4533('0xeb')][_0x4533('0x113')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x4533('0x1cc')});db[_0x4533('0xeb')][_0x4533('0x113')](db[_0x4533('0x5e')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x4533('0x5b')],{});db[_0x4533('0xed')][_0x4533('0x113')](db[_0x4533('0x5a')],{});db[_0x4533('0xed')][_0x4533('0x113')](db[_0x4533('0x133')],{'foreignKey':_0x4533('0x1d6'),'as':'FromAccount'});db['SmsTransferReport'][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1d1'),'as':_0x4533('0x1c9')});db['SmsTransferReport'][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db['SmsTransferReport']['belongsTo'](db[_0x4533('0x173')],{'foreignKey':_0x4533('0x1d7'),'as':_0x4533('0x1cc')});db['SmsTransferReport'][_0x4533('0x113')](db[_0x4533('0x133')],{'foreignKey':'ToSmsAccountId','as':_0x4533('0x1ce')});db[_0x4533('0xef')]['hasMany'](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x167')});db[_0x4533('0xef')][_0x4533('0x107')](db[_0x4533('0x7d')],{'as':'CustomFields','foreignKey':'ListId'});db[_0x4533('0xef')]['hasMany'](db[_0x4533('0x75')],{'as':_0x4533('0x184'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x167')});db[_0x4533('0xef')][_0x4533('0x107')](db[_0x4533('0x79')],{'as':'HopperFinals','foreignKey':_0x4533('0x167')});db[_0x4533('0xef')][_0x4533('0x107')](db[_0x4533('0x10c')],{'as':_0x4533('0x1d8'),'foreignKey':_0x4533('0x167')});db['CmList'][_0x4533('0x107')](db['ReportAgentPreview'],{'as':_0x4533('0x10d'),'foreignKey':_0x4533('0x167')});db[_0x4533('0xef')][_0x4533('0x115')](db['VoiceQueue'],{'as':_0x4533('0x1d9'),'through':'voice_queues_has_cm_lists'});db[_0x4533('0xef')]['belongsToMany'](db['User'],{'as':_0x4533('0x147'),'through':_0x4533('0x11a')});db[_0x4533('0x12b')][_0x4533('0x107')](db[_0x4533('0x109')],{'as':_0x4533('0x193'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x12b')][_0x4533('0x115')](db['User'],{'as':'Agents','through':_0x4533('0x1da')});db[_0x4533('0xf2')]['hasMany'](db['User'],{'as':_0x4533('0x160'),'foreignKey':_0x4533('0x114')});db['UserProfile'][_0x4533('0x107')](db[_0x4533('0xf4')],{'as':_0x4533('0x1db'),'foreignKey':_0x4533('0x114'),'onDelete':_0x4533('0x10a')});db['UserProfileSection']['hasMany'](db[_0x4533('0xf6')],{'as':_0x4533('0x1dc'),'foreignKey':_0x4533('0x1dd'),'onDelete':_0x4533('0x10a')});db[_0x4533('0x1de')]['hasMany'](db[_0x4533('0x154')],{'as':_0x4533('0x155'),'foreignKey':_0x4533('0x1df')});db[_0x4533('0x1de')][_0x4533('0x107')](db[_0x4533('0x80')],{'as':_0x4533('0x156'),'foreignKey':_0x4533('0x1df')});db[_0x4533('0x1de')][_0x4533('0x107')](db['WhatsappMessage'],{'as':_0x4533('0x157'),'foreignKey':_0x4533('0x1df')});db[_0x4533('0x1de')][_0x4533('0x107')](db[_0x4533('0xfb')],{'as':_0x4533('0x169')});db[_0x4533('0x1de')][_0x4533('0x107')](db[_0x4533('0xf9')],{'as':_0x4533('0x138')});db[_0x4533('0x1de')]['belongsTo'](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':'ListId'});db[_0x4533('0x1de')][_0x4533('0x113')](db[_0x4533('0x86')],{'as':_0x4533('0x144'),'foreignKey':_0x4533('0x145')});db[_0x4533('0x1de')][_0x4533('0x115')](db['User'],{'as':'Agents','through':_0x4533('0x1e0')});db[_0x4533('0xf9')][_0x4533('0x113')](db[_0x4533('0x13')],{'onDelete':_0x4533('0x164')});db[_0x4533('0xf9')]['belongsTo'](db[_0x4533('0x129')],{'onDelete':_0x4533('0x164')});db[_0x4533('0xf9')][_0x4533('0x113')](db[_0x4533('0x1de')],{'onDelete':_0x4533('0x164')});db[_0x4533('0xf9')][_0x4533('0x113')](db['Interval'],{'onDelete':_0x4533('0x164'),'foreignKey':_0x4533('0x165')});db[_0x4533('0xf9')][_0x4533('0x113')](db[_0x4533('0x8b')],{'onDelete':'restrict','foreignKey':_0x4533('0x166')});db[_0x4533('0xfb')][_0x4533('0x107')](db['WhatsappMessage'],{'as':_0x4533('0x157'),'onDelete':_0x4533('0x10a'),'foreignKey':_0x4533('0x1e1')});db[_0x4533('0xfb')][_0x4533('0x113')](db[_0x4533('0x1de')],{'as':_0x4533('0x15b'),'foreignKey':'WhatsappAccountId'});db[_0x4533('0xfb')][_0x4533('0x113')](db[_0x4533('0x75')],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db['WhatsappInteraction']['belongsTo'](db[_0x4533('0x13')],{'as':_0x4533('0x15d'),'foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0x4533('0x8b')],{'through':_0x4533('0x19a'),'as':_0x4533('0x16c')});db['WhatsappInteraction'][_0x4533('0x115')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x4533('0x15f')});db[_0x4533('0xfb')][_0x4533('0x115')](db[_0x4533('0x13')],{'as':_0x4533('0x160'),'through':_0x4533('0x121'),'foreignKey':'WhatsappInteractionId'});db[_0x4533('0x1e2')][_0x4533('0x113')](db[_0x4533('0x13')],{'as':'User'});db[_0x4533('0x1e2')][_0x4533('0x113')](db[_0x4533('0x75')],{'onDelete':_0x4533('0x10a'),'as':'Contact'});db[_0x4533('0x1e2')][_0x4533('0x113')](db['WhatsappInteraction'],{'onDelete':_0x4533('0x10a'),'as':_0x4533('0x163'),'foreignKey':_0x4533('0x1e1')});db[_0x4533('0x1e2')][_0x4533('0x113')](db[_0x4533('0x1de')],{'as':_0x4533('0x15b'),'foreignKey':_0x4533('0x1df')});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0x1de')],{});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0xef')],{'as':_0x4533('0x158'),'foreignKey':_0x4533('0x167')});db[_0x4533('0x1e3')]['belongsTo'](db['CmContact'],{'as':_0x4533('0x151'),'foreignKey':_0x4533('0x15c')});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0xfb')],{});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0x129')],{});db[_0x4533('0x1e3')][_0x4533('0x113')](db[_0x4533('0x1e2')],{});db['WhatsappQueueReport']['belongsTo'](db['User'],{});db[_0x4533('0xff')][_0x4533('0x113')](db[_0x4533('0x1e2')],{});db[_0x4533('0xff')][_0x4533('0x113')](db['WhatsappInteraction'],{});db[_0x4533('0xff')]['belongsTo'](db[_0x4533('0x1de')],{'foreignKey':_0x4533('0x1e4'),'as':_0x4533('0x1c8')});db[_0x4533('0xff')]['belongsTo'](db[_0x4533('0x1de')],{'foreignKey':_0x4533('0x1e5'),'as':_0x4533('0x1ce')});db[_0x4533('0xff')][_0x4533('0x113')](db[_0x4533('0x129')],{'foreignKey':_0x4533('0x1e6'),'as':_0x4533('0x1cc')});db['WhatsappTransferReport'][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':'FromUserId','as':_0x4533('0x1c9')});db[_0x4533('0xff')][_0x4533('0x113')](db[_0x4533('0x13')],{'foreignKey':_0x4533('0x1ca'),'as':_0x4533('0x1cb')});db[_0x4533('0x129')][_0x4533('0x115')](db['User'],{'as':_0x4533('0x147'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x4533('0x129')][_0x4533('0x115')](db[_0x4533('0xdf')],{'through':_0x4533('0x1e7'),'as':_0x4533('0x148')});module[_0x4533('0x1e8')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0a9f=['All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Intervals','MailApplications','ChatApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticCustomReport','Fields','AnalyticDefaultReport','AnalyticFieldReport','AnalyticMetric','MetricId','AccountId','SubjectId','DescriptionId','FieldId','Subject','Description','Field','VariableId','Subjects','DeskAccount','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','Descriptions','ZendeskAccount','int_zendesk_configuration_has_tags','Configurations','VtigerAccount','FreshsalesAccount','FreshsalesField','FromId','SessionId','ProjectId','user_has_teams','VoiceQueues','SmsQueues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','TrunkId','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSection','UserProfileSections','WhatsappAccountId','WhatsappApplication','WhatsappMessage','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','determine','defaultsDeep','127.0.0.1','mysql','name','utf8_general_ci','sequelizeHistory','motion2','xcall','utf8mb4','utf8','database','username','options','password','User','../api/user/user.model','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.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','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','Recordings','Extensions','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','ChatInteraction','ChatInteractions','user_has_sms_interactions','VoiceQueue','MailQueues','UserMailQueue','ChatQueue','ChatQueues','UserChatQueue','FaxQueues','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','VoicePrefix','user_has_voice_prefixes','ChatWebsite','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','Sound','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','Contact','ContactId','MailAccountId','Smtp','Disposition','Answers','MailMessage','Messages','Interactions','List','ListId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','restrict','TagId','Items','Dispositions','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsApplication','SmsInteractionId','Owner','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelAccount','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatWebsiteId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','HopperFinals','Company','cm_contact_has_tags','CampaignId'];(function(_0x29a3df,_0x442bf5){var _0x5793f7=function(_0x133c8d){while(--_0x133c8d){_0x29a3df['push'](_0x29a3df['shift']());}};_0x5793f7(++_0x442bf5);}(_0x0a9f,0x64));var _0xf0a9=function(_0x26bb3f,_0x25cd1f){_0x26bb3f=_0x26bb3f-0x0;var _0x2cbd3f=_0x0a9f[_0x26bb3f];return _0x2cbd3f;};'use strict';var path=require('path');var config=require(_0xf0a9('0x0'));var Sequelize=require(_0xf0a9('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0xf0a9('0x2')]();config['sequelize']=_[_0xf0a9('0x3')](config['sequelize'],{'database':'motion2','username':'xcall','password':'xC@LL1234','options':{'host':_0xf0a9('0x4'),'port':0xcea,'dialect':_0xf0a9('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xf0a9('0x6')](),'define':{'charset':'utf8','collate':_0xf0a9('0x7')}}});config[_0xf0a9('0x8')]=_['defaultsDeep'](config[_0xf0a9('0x8')],{'database':_0xf0a9('0x9'),'username':_0xf0a9('0xa'),'password':'xC@LL1234','options':{'host':_0xf0a9('0x4'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xf0a9('0xb')},'logging':![],'timezone':timezone[_0xf0a9('0x6')](),'define':{'charset':_0xf0a9('0xc'),'collate':_0xf0a9('0x7')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xf0a9('0xd')],config[_0xf0a9('0x1')][_0xf0a9('0xe')],config[_0xf0a9('0x1')]['password'],config['sequelize'][_0xf0a9('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf0a9('0x8')][_0xf0a9('0xd')],config[_0xf0a9('0x8')][_0xf0a9('0xe')],config[_0xf0a9('0x8')][_0xf0a9('0x10')],config['sequelizeHistory'][_0xf0a9('0xf')])};db[_0xf0a9('0x11')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x12'));db['VoiceChanSpy']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x14'));db[_0xf0a9('0x15')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x16'));db[_0xf0a9('0x17')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x18'));db[_0xf0a9('0x19')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x1a'));db['VoiceQueue']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0xf0a9('0x1b')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0xf0a9('0x1c')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x1d'));db[_0xf0a9('0x1e')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x1f'));db[_0xf0a9('0x20')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x21'));db[_0xf0a9('0x22')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x23'));db['VoiceAgentReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x24'));db[_0xf0a9('0x25')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x26'));db['MemberReport']=db['sequelize']['import']('../api/memberReport/memberReport.model');db[_0xf0a9('0x27')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/trunk/trunk.model');db[_0xf0a9('0x28')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x29'));db['UserVoiceQueueRt']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x2a'));db[_0xf0a9('0x2b')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db['sequelize']['import'](_0xf0a9('0x2c'));db['UserMailQueue']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x2d'));db[_0xf0a9('0x2e')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x2f'));db[_0xf0a9('0x30')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x31'));db['UserOpenchannelQueue']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x32'));db[_0xf0a9('0x33')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xf0a9('0x34')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x35'));db[_0xf0a9('0x36')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x37'));db[_0xf0a9('0x38')]=db[_0xf0a9('0x1')]['import']('../api/mailAccount/mailAccount.model');db[_0xf0a9('0x39')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x3a'));db[_0xf0a9('0x3b')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x3c'));db[_0xf0a9('0x3d')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x3e'));db[_0xf0a9('0x3f')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/mailApplication/mailApplication.model');db[_0xf0a9('0x40')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x41'));db[_0xf0a9('0x42')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x43'));db[_0xf0a9('0x44')]=db[_0xf0a9('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x45'));db[_0xf0a9('0x46')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x47'));db[_0xf0a9('0x48')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x49'));db[_0xf0a9('0x4a')]=db['sequelize']['import'](_0xf0a9('0x4b'));db[_0xf0a9('0x4c')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/faxQueue/faxQueue.model');db[_0xf0a9('0x4d')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x4e'));db[_0xf0a9('0x4f')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x50'));db['SmsApplication']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x51'));db[_0xf0a9('0x52')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x53'));db[_0xf0a9('0x54')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x55'));db['OpenchannelAccount']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x56'));db[_0xf0a9('0x57')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x58'));db[_0xf0a9('0x59')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x5a'));db[_0xf0a9('0x5b')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x5c'));db['OpenchannelQueue']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x5d'));db['ChatWebsite']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x5e'));db[_0xf0a9('0x5f')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x60'));db[_0xf0a9('0x61')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x62'));db['ChatInteraction']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x63'));db[_0xf0a9('0x64')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x65'));db[_0xf0a9('0x66')]=db['sequelize']['import'](_0xf0a9('0x67'));db['ChatQueue']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x68'));db[_0xf0a9('0x69')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x6a'));db['CmCompany']=db[_0xf0a9('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0xf0a9('0x6b')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x6c'));db[_0xf0a9('0x6d')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x6e'));db[_0xf0a9('0x6f')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x70'));db[_0xf0a9('0x71')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x72'));db[_0xf0a9('0x73')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x74'));db[_0xf0a9('0x75')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x76'));db[_0xf0a9('0x77')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x78'));db[_0xf0a9('0x79')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x7a'));db[_0xf0a9('0x7b')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x7c'));db['Disposition']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x7d'));db[_0xf0a9('0x7e')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/condition/condition.model');db[_0xf0a9('0x7f')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x80'));db[_0xf0a9('0x81')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x82'));db[_0xf0a9('0x83')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x84'));db['VoiceQueuesLog']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x85'));db['Schedule']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x86'));db['Sound']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x87'));db[_0xf0a9('0x88')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x89'));db[_0xf0a9('0x8a')]=db[_0xf0a9('0x1')]['import']('../api/template/template.model');db[_0xf0a9('0x8b')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/trigger/trigger.model');db[_0xf0a9('0x8c')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x8d'));db[_0xf0a9('0x8e')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x8f'));db[_0xf0a9('0x90')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x91'));db['AnalyticCustomReport']=db['sequelize'][_0xf0a9('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xf0a9('0x92')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x93'));db['AnalyticMetric']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0x94'));db['AnalyticFieldReport']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x95'));db[_0xf0a9('0x96')]=db['sequelize']['import'](_0xf0a9('0x97'));db[_0xf0a9('0x98')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x99'));db[_0xf0a9('0x9a')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xf0a9('0x9b')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xf0a9('0x9c')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x9d'));db[_0xf0a9('0x9e')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0x9f'));db[_0xf0a9('0xa0')]=db['sequelize']['import'](_0xf0a9('0xa1'));db['DeskAccount']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xa2'));db['DeskConfiguration']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xa3'));db['ZohoConfiguration']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xa4'));db[_0xf0a9('0xa5')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xa6'));db['ZendeskAccount']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xa7'));db[_0xf0a9('0xa8')]=db['sequelize']['import'](_0xf0a9('0xa9'));db[_0xf0a9('0xaa')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xab'));db[_0xf0a9('0xac')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xf0a9('0xad')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xf0a9('0xae')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xaf'));db['VtigerAccount']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xb0'));db[_0xf0a9('0xb1')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xb2'));db[_0xf0a9('0xb3')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xb4'));db[_0xf0a9('0xb5')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xb6'));db[_0xf0a9('0xb7')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xb8'));db[_0xf0a9('0xb9')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xf0a9('0xba')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xbb'));db[_0xf0a9('0xbc')]=db[_0xf0a9('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xf0a9('0xbd')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xbe'));db['FreshsalesAccount']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xf0a9('0xbf')]=db['sequelize'][_0xf0a9('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xc0'));db['Integration']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0x8f'));db[_0xf0a9('0xc1')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xc2'));db[_0xf0a9('0xc3')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xc4'));db[_0xf0a9('0xc5')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xc6'));db[_0xf0a9('0xc7')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xf0a9('0xc8')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xf0a9('0xc9')]=db['sequelize']['import'](_0xf0a9('0xca'));db[_0xf0a9('0xcb')]=db[_0xf0a9('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xcc'));db[_0xf0a9('0xcd')]=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xce'));db[_0xf0a9('0xcf')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xd0'));db['Setting']=db['sequelize'][_0xf0a9('0x13')](_0xf0a9('0xd1'));db[_0xf0a9('0xd2')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0xf0a9('0xd3')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/squareProject/squareProject.model');db[_0xf0a9('0xd4')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xd5'));db['SquareMessage']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xd6'));db[_0xf0a9('0xd7')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xd8'));db['License']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xd9'));db[_0xf0a9('0xda')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/campaign/campaign.model');db[_0xf0a9('0xdb')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/migration/migration.model');db[_0xf0a9('0xdc')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xdd'));db[_0xf0a9('0xde')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xdf'));db[_0xf0a9('0xe0')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xe1'));db['ChatTransferReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xe2'));db[_0xf0a9('0xe3')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xe4'));db[_0xf0a9('0xe5')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0xf0a9('0x1')][_0xf0a9('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0xf0a9('0xe6')]=db['sequelize']['import'](_0xf0a9('0xe7'));db['VoicePrefix']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xe8'));db[_0xf0a9('0xe9')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xea'));db['UserProfileSection']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xeb'));db[_0xf0a9('0xec')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xed'));db[_0xf0a9('0xee')]=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xef'));db[_0xf0a9('0xf0')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf1'));db['WhatsappApplication']=db[_0xf0a9('0x1')]['import'](_0xf0a9('0xf2'));db[_0xf0a9('0xf3')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf4'));db['WhatsappMessage']=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf5'));db[_0xf0a9('0xf6')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf7'));db[_0xf0a9('0xf8')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xf9'));db[_0xf0a9('0xfa')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xfb'));db[_0xf0a9('0xfc')]=db[_0xf0a9('0x1')][_0xf0a9('0x13')](_0xf0a9('0xfd'));db[_0xf0a9('0x11')][_0xf0a9('0xfe')](db['VoiceMail'],{'as':_0xf0a9('0x1e'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db[_0xf0a9('0x1b')],{'as':_0xf0a9('0x102'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['VoiceExtension'],{'as':_0xf0a9('0x103'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db[_0xf0a9('0x71')],{'as':'HopperFinals','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db[_0xf0a9('0x73')],{'as':'HopperHistory','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xf0a9('0x100')});db['User'][_0xf0a9('0x101')](db[_0xf0a9('0x59')],{'as':_0xf0a9('0x104'),'foreignKey':_0xf0a9('0x100')});db['User'][_0xf0a9('0x101')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['SmsInteraction'],{'as':_0xf0a9('0x105'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x11')]['hasMany'](db[_0xf0a9('0x48')],{'as':_0xf0a9('0x106'),'foreignKey':'UserId'});db[_0xf0a9('0x11')][_0xf0a9('0x101')](db['MailInteraction'],{'as':_0xf0a9('0x107'),'foreignKey':'UserId'});db[_0xf0a9('0x11')]['hasMany'](db[_0xf0a9('0xf3')],{'as':_0xf0a9('0x108'),'foreignKey':'UserId'});db[_0xf0a9('0x11')]['hasMany'](db['Notification'],{'as':_0xf0a9('0x109'),'foreignKey':_0xf0a9('0x10a')});db[_0xf0a9('0x11')][_0xf0a9('0x10b')](db[_0xf0a9('0xe9')],{'as':_0xf0a9('0xe9'),'foreignKey':_0xf0a9('0x10c')});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x10e')],{'as':'Groups','through':_0xf0a9('0x10f')});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x110'),'through':_0xf0a9('0x111')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db['CmList'],{'as':_0xf0a9('0x112'),'through':_0xf0a9('0x113')});db['User'][_0xf0a9('0x10d')](db['Team'],{'through':'user_has_teams'});db[_0xf0a9('0x11')]['belongsToMany'](db[_0xf0a9('0x3d')],{'as':'MailInteractions','through':_0xf0a9('0x114')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x115')],{'as':_0xf0a9('0x116'),'through':'user_has_chat_interactions'});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x48')],{'as':_0xf0a9('0x106'),'through':'user_has_fax_interactions'});db[_0xf0a9('0x11')]['belongsToMany'](db['SmsInteraction'],{'as':_0xf0a9('0x105'),'through':_0xf0a9('0x117')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x59')],{'as':_0xf0a9('0x104'),'through':'user_has_openchannel_interactions'});db['User'][_0xf0a9('0x10d')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x118')],{'as':'VoiceQueues','through':_0xf0a9('0x2b'),'required':![]});db[_0xf0a9('0x11')]['belongsToMany'](db[_0xf0a9('0x39')],{'as':_0xf0a9('0x119'),'through':_0xf0a9('0x11a'),'required':![]});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x11b')],{'as':_0xf0a9('0x11c'),'through':_0xf0a9('0x11d'),'required':![],'hooks':!![]});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x4c')],{'as':_0xf0a9('0x11e'),'through':'UserFaxQueue','required':![]});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x54')],{'as':'SmsQueues','through':_0xf0a9('0x30'),'required':![]});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x11f')],{'as':_0xf0a9('0x120'),'through':_0xf0a9('0x121'),'required':![]});db['User']['belongsToMany'](db[_0xf0a9('0xfa')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0xf0a9('0x11')]['belongsToMany'](db[_0xf0a9('0xe6')],{'through':'cm_user_has_lists'});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x122')],{'as':'VoicePrefixes','through':_0xf0a9('0x123'),'required':![]});db['User'][_0xf0a9('0x10d')](db[_0xf0a9('0x124')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0xf0a9('0x11')]['belongsToMany'](db[_0xf0a9('0x125')],{'as':_0xf0a9('0x126'),'through':_0xf0a9('0x127')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db['MailAccount'],{'as':_0xf0a9('0x128'),'through':_0xf0a9('0x129')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xf0a9('0x12a')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0x4f')],{'as':_0xf0a9('0x12b'),'through':_0xf0a9('0x12c')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db[_0xf0a9('0xf0')],{'as':_0xf0a9('0x12d'),'through':_0xf0a9('0x12e')});db[_0xf0a9('0x11')][_0xf0a9('0x10d')](db['SquareProject'],{'as':_0xf0a9('0x12f'),'through':_0xf0a9('0x130')});db[_0xf0a9('0x131')][_0xf0a9('0x101')](db[_0xf0a9('0x17')],{'as':_0xf0a9('0x132'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x133')});db[_0xf0a9('0x15')][_0xf0a9('0x101')](db[_0xf0a9('0x17')],{'onDelete':'cascade'});db[_0xf0a9('0x17')][_0xf0a9('0x101')](db[_0xf0a9('0x17')],{'as':_0xf0a9('0x134'),'onDelete':'cascade'});db[_0xf0a9('0x19')][_0xf0a9('0x10d')](db[_0xf0a9('0x135')],{'as':'Sounds','through':_0xf0a9('0x136')});db[_0xf0a9('0x118')][_0xf0a9('0x101')](db[_0xf0a9('0x137')],{'as':'Members','foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')]['hasMany'](db['CmHopper'],{'as':_0xf0a9('0x139'),'foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')][_0xf0a9('0x101')](db[_0xf0a9('0x71')],{'as':'HopperFinals','foreignKey':_0xf0a9('0x138')});db['VoiceQueue']['hasMany'](db[_0xf0a9('0x73')],{'as':_0xf0a9('0x13a'),'foreignKey':_0xf0a9('0x138')});db['VoiceQueue']['hasMany'](db['ReportAgentPreview'],{'as':_0xf0a9('0x75'),'foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')][_0xf0a9('0x101')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')][_0xf0a9('0x101')](db[_0xf0a9('0xc9')],{'as':_0xf0a9('0x13b'),'foreignKey':_0xf0a9('0x138')});db[_0xf0a9('0x118')]['belongsTo'](db[_0xf0a9('0x27')],{'as':_0xf0a9('0x27'),'foreignKey':'TrunkId'});db[_0xf0a9('0x118')][_0xf0a9('0x10b')](db[_0xf0a9('0x27')],{'as':'TrunkBackup','foreignKey':_0xf0a9('0x13c')});db[_0xf0a9('0x118')][_0xf0a9('0x10b')](db['Interval'],{'as':_0xf0a9('0x7f'),'foreignKey':_0xf0a9('0x13d')});db[_0xf0a9('0x118')][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':_0xf0a9('0x13e'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xf0a9('0x10d')](db['CmList'],{'as':_0xf0a9('0x112'),'through':_0xf0a9('0x13f')});db['VoiceQueue'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x2b')});db[_0xf0a9('0x118')][_0xf0a9('0x10d')](db['Team'],{'as':_0xf0a9('0x141'),'through':_0xf0a9('0x142')});db[_0xf0a9('0x118')][_0xf0a9('0x10d')](db['CmList'],{'as':_0xf0a9('0x143'),'through':_0xf0a9('0x144')});db[_0xf0a9('0x1b')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':'User','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x1c')][_0xf0a9('0x10b')](db['User'],{'as':_0xf0a9('0x11'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x1e')][_0xf0a9('0x101')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x145'),'sourceKey':_0xf0a9('0x146')});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0xf0a9('0x145'),'targetKey':_0xf0a9('0x146')});db['VoiceCallReport'][_0xf0a9('0x101')](db[_0xf0a9('0x25')],{'as':_0xf0a9('0x147'),'foreignKey':_0xf0a9('0x148'),'constraints':![]});db[_0xf0a9('0x20')][_0xf0a9('0x101')](db[_0xf0a9('0x149')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x11'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x20')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x34')]['belongsTo'](db['MailAccount'],{'as':_0xf0a9('0x38'),'foreignKey':'MailAccountId'});db[_0xf0a9('0x36')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{'as':_0xf0a9('0x38'),'foreignKey':_0xf0a9('0x14c')});db['MailAccount'][_0xf0a9('0xfe')](db[_0xf0a9('0x34')],{'as':'Imap','onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x38')][_0xf0a9('0xfe')](db['MailServerOut'],{'as':_0xf0a9('0x14d'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x38')]['hasMany'](db[_0xf0a9('0x14e')],{'as':'Dispositions','foreignKey':'MailAccountId'});db[_0xf0a9('0x38')][_0xf0a9('0x101')](db[_0xf0a9('0x7b')],{'as':_0xf0a9('0x14f'),'foreignKey':_0xf0a9('0x14c')});db[_0xf0a9('0x38')][_0xf0a9('0x101')](db[_0xf0a9('0x150')],{'as':_0xf0a9('0x151'),'foreignKey':'MailAccountId'});db[_0xf0a9('0x38')]['hasMany'](db[_0xf0a9('0x3d')],{'as':_0xf0a9('0x152')});db[_0xf0a9('0x38')][_0xf0a9('0x101')](db[_0xf0a9('0x3f')],{'as':_0xf0a9('0x134')});db['MailAccount'][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x38')][_0xf0a9('0x10b')](db['Template'],{'as':_0xf0a9('0x8a'),'foreignKey':'TemplateId'});db[_0xf0a9('0x38')][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xf0a9('0x155')});db['MailAccount'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x129')});db[_0xf0a9('0x39')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':'UserMailQueue'});db[_0xf0a9('0x39')]['belongsToMany'](db[_0xf0a9('0xd7')],{'through':_0xf0a9('0x156'),'as':_0xf0a9('0x141')});db[_0xf0a9('0x3d')][_0xf0a9('0x101')](db['MailMessage'],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x157')});db['MailInteraction'][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x14c')});db[_0xf0a9('0x3d')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':'ContactId'});db[_0xf0a9('0x3d')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':'Owner','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x3d')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x159'),'as':_0xf0a9('0x15a')});db['MailInteraction'][_0xf0a9('0x10d')](db['Tag'],{'through':_0xf0a9('0x159'),'as':_0xf0a9('0x15b')});db[_0xf0a9('0x3d')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x114'),'foreignKey':_0xf0a9('0x157')});db[_0xf0a9('0x150')][_0xf0a9('0x101')](db[_0xf0a9('0xdc')],{'as':_0xf0a9('0x15d'),'onDelete':_0xf0a9('0xff')});db['MailMessage'][_0xf0a9('0x10b')](db['User'],{'as':'User'});db[_0xf0a9('0x150')]['belongsTo'](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x14a')});db[_0xf0a9('0x150')][_0xf0a9('0x10b')](db['MailInteraction'],{'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x157')});db[_0xf0a9('0x150')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x14c')});db['MailApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x3f')][_0xf0a9('0x10b')](db[_0xf0a9('0x39')],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x3f')]['belongsTo'](db['MailAccount'],{'onDelete':_0xf0a9('0x15f')});db['MailApplication']['belongsTo'](db[_0xf0a9('0x7f')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x13d')});db[_0xf0a9('0x3f')]['belongsTo'](db[_0xf0a9('0x88')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x160')});db[_0xf0a9('0x40')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{});db['MailQueueReport'][_0xf0a9('0x10b')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xf0a9('0x40')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x40')]['belongsTo'](db[_0xf0a9('0x3d')],{});db[_0xf0a9('0x40')][_0xf0a9('0x10b')](db[_0xf0a9('0x150')],{});db[_0xf0a9('0x40')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{});db['MailQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x39')],{});db['Dashboard'][_0xf0a9('0x101')](db[_0xf0a9('0x44')],{'as':_0xf0a9('0x161'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x125')]['hasMany'](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xf0a9('0x101')](db[_0xf0a9('0x7b')],{'as':'Answers','foreignKey':_0xf0a9('0x163')});db[_0xf0a9('0x125')]['hasMany'](db[_0xf0a9('0x48')],{'as':'Interactions'});db['FaxAccount'][_0xf0a9('0x101')](db[_0xf0a9('0x46')],{'as':_0xf0a9('0x134')});db['FaxAccount'][_0xf0a9('0x101')](db[_0xf0a9('0x17')],{'as':_0xf0a9('0x164'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x125')][_0xf0a9('0x101')](db[_0xf0a9('0x4a')],{'as':_0xf0a9('0x151')});db['FaxAccount'][_0xf0a9('0x10b')](db[_0xf0a9('0x27')],{'as':_0xf0a9('0x27')});db[_0xf0a9('0x125')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x125')]['belongsTo'](db[_0xf0a9('0x81')],{'as':_0xf0a9('0x13e'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Agents','through':_0xf0a9('0x127')});db[_0xf0a9('0x46')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0x15f')});db['FaxApplication'][_0xf0a9('0x10b')](db['FaxQueue'],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x46')]['belongsTo'](db[_0xf0a9('0x125')],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x46')][_0xf0a9('0x10b')](db[_0xf0a9('0x88')],{'onDelete':'restrict','foreignKey':_0xf0a9('0x160')});db['FaxInteraction'][_0xf0a9('0x101')](db[_0xf0a9('0x4a')],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x165')});db[_0xf0a9('0x48')][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xf0a9('0x48')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x48')][_0xf0a9('0x10b')](db['User'],{'as':'Owner','foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x48')]['belongsToMany'](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x166'),'as':'Tags'});db[_0xf0a9('0x48')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x166'),'as':_0xf0a9('0x15b')});db[_0xf0a9('0x48')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x167'),'foreignKey':_0xf0a9('0x165')});db[_0xf0a9('0x4a')][_0xf0a9('0x10b')](db['User'],{'onDelete':_0xf0a9('0xff'),'as':'User'});db['FaxMessage'][_0xf0a9('0x10b')](db[_0xf0a9('0x48')],{'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x165')});db[_0xf0a9('0x4a')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':'cascade','as':'Contact'});db[_0xf0a9('0x4a')][_0xf0a9('0x10b')](db[_0xf0a9('0xdc')],{'as':_0xf0a9('0xdc'),'foreignKey':_0xf0a9('0x168')});db[_0xf0a9('0x4a')][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x163')});db[_0xf0a9('0x4c')]['belongsToMany'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':'UserFaxQueue'});db[_0xf0a9('0x4c')][_0xf0a9('0x10d')](db[_0xf0a9('0xd7')],{'through':_0xf0a9('0x169'),'as':_0xf0a9('0x141')});db['FaxQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{});db[_0xf0a9('0x4d')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db['FaxQueueReport']['belongsTo'](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x4d')]['belongsTo'](db[_0xf0a9('0x48')],{});db[_0xf0a9('0x4d')][_0xf0a9('0x10b')](db[_0xf0a9('0x4a')],{});db[_0xf0a9('0x4d')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{});db[_0xf0a9('0x4d')][_0xf0a9('0x10b')](db[_0xf0a9('0x4c')],{});db['SmsAccount']['hasMany'](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':_0xf0a9('0x16a')});db[_0xf0a9('0x4f')][_0xf0a9('0x101')](db[_0xf0a9('0x7b')],{'as':'Answers','foreignKey':_0xf0a9('0x16a')});db[_0xf0a9('0x4f')]['hasMany'](db[_0xf0a9('0x16b')],{'as':_0xf0a9('0x151'),'foreignKey':'SmsAccountId'});db[_0xf0a9('0x4f')][_0xf0a9('0x101')](db['SmsInteraction'],{'as':'Interactions'});db[_0xf0a9('0x4f')][_0xf0a9('0x101')](db[_0xf0a9('0x16c')],{'as':_0xf0a9('0x134')});db[_0xf0a9('0x4f')]['belongsTo'](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db['SmsAccount'][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':_0xf0a9('0x13e'),'foreignKey':_0xf0a9('0x155')});db['SmsAccount'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x12c')});db['SmsApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':'restrict'});db[_0xf0a9('0x16c')][_0xf0a9('0x10b')](db['SmsQueue'],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x16c')][_0xf0a9('0x10b')](db['SmsAccount'],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x16c')]['belongsTo'](db[_0xf0a9('0x7f')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':'IntervalId'});db[_0xf0a9('0x16c')]['belongsTo'](db[_0xf0a9('0x88')],{'onDelete':'restrict','foreignKey':_0xf0a9('0x160')});db[_0xf0a9('0x52')]['hasMany'](db[_0xf0a9('0x16b')],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x16d')});db['SmsInteraction'][_0xf0a9('0x10b')](db[_0xf0a9('0x4f')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x16a')});db[_0xf0a9('0x52')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x52')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x16e'),'foreignKey':_0xf0a9('0x100')});db['SmsInteraction']['belongsToMany'](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x16f'),'as':'Tags'});db[_0xf0a9('0x52')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x16f'),'as':_0xf0a9('0x15b')});db['SmsInteraction'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Users','through':_0xf0a9('0x117'),'foreignKey':_0xf0a9('0x16d')});db[_0xf0a9('0x16b')][_0xf0a9('0x10b')](db['User'],{'as':'User'});db[_0xf0a9('0x16b')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x14a')});db['SmsMessage']['belongsTo'](db[_0xf0a9('0x52')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x16d')});db[_0xf0a9('0x16b')]['belongsTo'](db[_0xf0a9('0x4f')],{'as':'Account','foreignKey':_0xf0a9('0x16a')});db[_0xf0a9('0x54')]['belongsToMany'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x30'),'foreignKey':_0xf0a9('0x170')});db[_0xf0a9('0x54')][_0xf0a9('0x10d')](db[_0xf0a9('0xd7')],{'through':_0xf0a9('0x171'),'as':'Teams'});db['OpenchannelAccount'][_0xf0a9('0x101')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x173')]['hasMany'](db[_0xf0a9('0x7b')],{'as':_0xf0a9('0x14f'),'foreignKey':'OpenchannelAccountId'});db[_0xf0a9('0x173')][_0xf0a9('0x101')](db['OpenchannelInteraction'],{'as':_0xf0a9('0x152'),'foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x173')]['hasMany'](db[_0xf0a9('0x5b')],{'as':_0xf0a9('0x151'),'foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x173')][_0xf0a9('0x101')](db['OpenchannelApplication'],{'as':_0xf0a9('0x134'),'foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x173')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x173')][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xf0a9('0x173')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':'user_has_openchannel_accounts'});db[_0xf0a9('0x57')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0x15f')});db['OpenchannelApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x11f')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x174')});db[_0xf0a9('0x57')]['belongsTo'](db[_0xf0a9('0x173')],{'onDelete':'restrict','foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x57')][_0xf0a9('0x10b')](db['Interval'],{'onDelete':_0xf0a9('0x15f'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0xf0a9('0x10b')](db['Tag'],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x160')});db[_0xf0a9('0x59')]['hasMany'](db[_0xf0a9('0x5b')],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x175')});db[_0xf0a9('0x59')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xf0a9('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0xf0a9('0x59')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x16e'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0x59')]['belongsToMany'](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x176'),'as':_0xf0a9('0x15a')});db[_0xf0a9('0x59')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x176'),'as':_0xf0a9('0x15b')});db[_0xf0a9('0x59')]['belongsToMany'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x177'),'foreignKey':_0xf0a9('0x175')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x11')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x14a')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0x59')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x175')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0xdc')],{'as':_0xf0a9('0xdc'),'foreignKey':_0xf0a9('0x168')});db[_0xf0a9('0x5b')][_0xf0a9('0x10b')](db[_0xf0a9('0x173')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x172')});db[_0xf0a9('0x11f')]['belongsToMany'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':'UserOpenchannelQueue','foreignKey':_0xf0a9('0x174')});db[_0xf0a9('0x11f')]['belongsToMany'](db[_0xf0a9('0xd7')],{'through':_0xf0a9('0x178'),'as':_0xf0a9('0x141')});db[_0xf0a9('0x124')][_0xf0a9('0x101')](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':'ChatWebsiteId'});db[_0xf0a9('0x124')][_0xf0a9('0x101')](db[_0xf0a9('0x7b')],{'as':_0xf0a9('0x14f'),'foreignKey':'ChatWebsiteId'});db[_0xf0a9('0x124')][_0xf0a9('0x101')](db[_0xf0a9('0x69')],{'as':_0xf0a9('0x179')});db['ChatWebsite']['hasMany'](db[_0xf0a9('0x115')],{'as':_0xf0a9('0x152')});db['ChatWebsite']['hasMany'](db[_0xf0a9('0x61')],{'as':'Applications'});db[_0xf0a9('0x124')][_0xf0a9('0x101')](db[_0xf0a9('0x64')],{'as':_0xf0a9('0x151')});db[_0xf0a9('0x124')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x124')][_0xf0a9('0x10b')](db[_0xf0a9('0x7f')],{'as':_0xf0a9('0x7f'),'foreignKey':_0xf0a9('0x13d')});db[_0xf0a9('0x124')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xf0a9('0x124')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xf0a9('0x10b')](db['OpenchannelAccount'],{});db[_0xf0a9('0x5f')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0x5f')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x5f')][_0xf0a9('0x10b')](db[_0xf0a9('0x59')],{});db[_0xf0a9('0x5f')][_0xf0a9('0x10b')](db[_0xf0a9('0x5b')],{});db[_0xf0a9('0x5f')]['belongsTo'](db[_0xf0a9('0x11')],{});db[_0xf0a9('0x5f')]['belongsTo'](db[_0xf0a9('0x11f')],{});db[_0xf0a9('0x61')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x17a'),'foreignKey':_0xf0a9('0x100'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0xf0a9('0x11b')],{'as':_0xf0a9('0x17b'),'foreignKey':_0xf0a9('0x17c'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x61')][_0xf0a9('0x10b')](db['ChatWebsite'],{'as':_0xf0a9('0x17d'),'foreignKey':_0xf0a9('0x17e'),'onDelete':_0xf0a9('0x15f')});db['ChatApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x88')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':'TagId'});db['ChatInteraction'][_0xf0a9('0x101')](db[_0xf0a9('0x64')],{'as':'Messages','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x17f')});db[_0xf0a9('0x115')][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x17e')});db['ChatInteraction'][_0xf0a9('0x10b')](db['CmContact'],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db['ChatInteraction'][_0xf0a9('0x10b')](db['User'],{'as':_0xf0a9('0x16e'),'foreignKey':_0xf0a9('0x100')});db['ChatInteraction'][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x180'),'as':_0xf0a9('0x15a')});db['ChatInteraction'][_0xf0a9('0x10d')](db['Tag'],{'through':_0xf0a9('0x180'),'as':_0xf0a9('0x15b')});db[_0xf0a9('0x115')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0xf0a9('0x64')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x11')});db[_0xf0a9('0x64')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x64')]['belongsTo'](db[_0xf0a9('0x115')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xf0a9('0x17f')});db[_0xf0a9('0x64')][_0xf0a9('0x10b')](db[_0xf0a9('0xdc')],{'as':_0xf0a9('0xdc'),'foreignKey':_0xf0a9('0x168')});db[_0xf0a9('0x64')][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xf0a9('0x66')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'onDelete':_0xf0a9('0xff'),'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x66')][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x17e')});db[_0xf0a9('0x11b')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xf0a9('0x11b')]['belongsToMany'](db['Team'],{'through':_0xf0a9('0x181'),'as':_0xf0a9('0x141')});db['ChatGroup'][_0xf0a9('0x101')](db['ChatInternalMessage'],{'as':_0xf0a9('0x151'),'foreignKey':_0xf0a9('0x182'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x10e')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Members','through':'chat_group_has_users'});db['ChatProactiveAction'][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{'as':_0xf0a9('0x17d'),'foreignKey':_0xf0a9('0x17e')});db[_0xf0a9('0x183')][_0xf0a9('0x101')](db[_0xf0a9('0x6b')],{'as':'Contacts','foreignKey':_0xf0a9('0x184')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db['CmHopper'],{'as':_0xf0a9('0x139'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x71')],{'as':_0xf0a9('0x185'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xf0a9('0x73')],{'as':_0xf0a9('0x13a'),'foreignKey':_0xf0a9('0x14b')});db['CmContact'][_0xf0a9('0x101')](db[_0xf0a9('0x75')],{'as':_0xf0a9('0x75'),'foreignKey':'ContactId'});db[_0xf0a9('0x6b')]['hasMany'](db[_0xf0a9('0xc9')],{'as':_0xf0a9('0x13b'),'foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0x6b')]['hasMany'](db[_0xf0a9('0x59')],{'as':'OpenchannelInteractions','foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x115')],{'as':_0xf0a9('0x116'),'foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x52')],{'as':'SmsInteractions','foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x48')],{'as':_0xf0a9('0x106'),'foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')][_0xf0a9('0x101')](db[_0xf0a9('0x3d')],{'as':_0xf0a9('0x107'),'foreignKey':_0xf0a9('0x14b'),'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x6b')]['belongsTo'](db[_0xf0a9('0x183')],{'as':_0xf0a9('0x186'),'foreignKey':_0xf0a9('0x184')});db[_0xf0a9('0x6b')]['belongsTo'](db['CmList'],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154'),'onDelete':'cascade'});db[_0xf0a9('0x6b')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x111')});db['CmContact'][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'as':_0xf0a9('0x15a'),'through':_0xf0a9('0x187')});db[_0xf0a9('0x6b')]['belongsToMany'](db[_0xf0a9('0x88')],{'through':'cm_contact_has_tags','as':_0xf0a9('0x15b')});db[_0xf0a9('0x6d')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':_0xf0a9('0x14b'),'onDelete':'cascade'});db[_0xf0a9('0x6d')][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':'List','foreignKey':_0xf0a9('0x154'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6d')]['belongsTo'](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x17a'),'foreignKey':_0xf0a9('0x100')});db['CmHopper'][_0xf0a9('0x10b')](db[_0xf0a9('0x118')],{'as':'Queue','foreignKey':_0xf0a9('0x138'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6d')]['belongsTo'](db['Campaign'],{'as':_0xf0a9('0xda'),'foreignKey':_0xf0a9('0x188'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6d')][_0xf0a9('0x10b')](db['User'],{'as':_0xf0a9('0x16e'),'foreignKey':'OwnerId'});db[_0xf0a9('0x6f')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack'][_0xf0a9('0x10b')](db['CmList'],{'as':_0xf0a9('0x153'),'foreignKey':'ListId','onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6f')][_0xf0a9('0x10b')](db[_0xf0a9('0x118')],{'as':_0xf0a9('0x17b'),'foreignKey':_0xf0a9('0x138'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x6f')][_0xf0a9('0x10b')](db[_0xf0a9('0xda')],{'as':_0xf0a9('0xda'),'foreignKey':_0xf0a9('0x188'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x79')][_0xf0a9('0x101')](db[_0xf0a9('0x7e')],{'as':{'plural':_0xf0a9('0x189'),'singular':_0xf0a9('0x18a')},'foreignKey':_0xf0a9('0x18b'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x79')][_0xf0a9('0x101')](db['Condition'],{'as':{'plural':_0xf0a9('0x18c'),'singular':_0xf0a9('0x18d')},'foreignKey':_0xf0a9('0x18e'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x79')][_0xf0a9('0x101')](db[_0xf0a9('0x18f')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0xf0a9('0x7f')]['hasMany'](db['Interval'],{'as':_0xf0a9('0x190'),'foreignKey':_0xf0a9('0x13d'),'onDelete':_0xf0a9('0xff'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0xf0a9('0x103'),'foreignKey':_0xf0a9('0x13d'),'onDelete':_0xf0a9('0x15f')});db['Interval'][_0xf0a9('0x101')](db[_0xf0a9('0x3f')],{'as':_0xf0a9('0x191'),'foreignKey':_0xf0a9('0x13d')});db['Interval']['hasMany'](db['ChatApplication'],{'as':_0xf0a9('0x192'),'foreignKey':'IntervalId'});db[_0xf0a9('0x7f')][_0xf0a9('0x101')](db[_0xf0a9('0x46')],{'as':_0xf0a9('0x193'),'foreignKey':'IntervalId'});db[_0xf0a9('0x7f')]['hasMany'](db[_0xf0a9('0x16c')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xf0a9('0x194')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{});db[_0xf0a9('0x194')][_0xf0a9('0x10b')](db['AnalyticDefaultReport'],{'foreignKey':_0xf0a9('0x195')});db[_0xf0a9('0x194')][_0xf0a9('0x10b')](db['AnalyticCustomReport'],{'foreignKey':_0xf0a9('0x196')});db['Sound'][_0xf0a9('0x10d')](db[_0xf0a9('0x19')],{'as':_0xf0a9('0x197'),'through':'moh_has_sounds','onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db[_0xf0a9('0x6b')],{'through':_0xf0a9('0x187')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db[_0xf0a9('0x115')],{'through':_0xf0a9('0x180')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db[_0xf0a9('0x3d')],{'through':_0xf0a9('0x159')});db['Tag'][_0xf0a9('0x10d')](db[_0xf0a9('0x52')],{'through':_0xf0a9('0x16f')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db[_0xf0a9('0x48')],{'through':_0xf0a9('0x166')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db['OpenchannelInteraction'],{'through':_0xf0a9('0x176')});db[_0xf0a9('0x88')][_0xf0a9('0x10d')](db['WhatsappInteraction'],{'through':_0xf0a9('0x198')});db[_0xf0a9('0x8b')][_0xf0a9('0x101')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xf0a9('0x199')},'foreignKey':'TriggerAllId','onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x8b')][_0xf0a9('0x101')](db[_0xf0a9('0x7e')],{'as':{'plural':'AnyConditions','singular':_0xf0a9('0x19a')},'foreignKey':_0xf0a9('0x19b'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x8b')][_0xf0a9('0x101')](db['Action'],{'as':_0xf0a9('0x19c'),'foreignKey':_0xf0a9('0x19d'),'onDelete':_0xf0a9('0xff'),'hooks':!![]});db[_0xf0a9('0x19e')][_0xf0a9('0x101')](db['AnalyticFieldReport'],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x196'),'hooks':!![]});db[_0xf0a9('0x1a0')][_0xf0a9('0x101')](db[_0xf0a9('0x1a1')],{'as':_0xf0a9('0x19f'),'onDelete':'cascade','foreignKey':_0xf0a9('0x195')});db[_0xf0a9('0x1a2')][_0xf0a9('0x101')](db[_0xf0a9('0x1a1')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a3')});db[_0xf0a9('0x1a1')][_0xf0a9('0x10b')](db[_0xf0a9('0x1a2')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0xf0a9('0x101')](db[_0xf0a9('0x9a')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x9a')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':'Subjects','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x9a')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x9a')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x9a')][_0xf0a9('0x10b')](db[_0xf0a9('0x98')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x9b')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x9b')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':_0xf0a9('0x1a9'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x9b')][_0xf0a9('0x101')](db[_0xf0a9('0x9b')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x9b')][_0xf0a9('0x10b')](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x9c')][_0xf0a9('0x101')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x9e')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':_0xf0a9('0x1ac'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x9e')][_0xf0a9('0x101')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x9e')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':'Fields','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x9e')]['belongsTo'](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xa0')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xa0')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf0a9('0xa0')][_0xf0a9('0x101')](db[_0xf0a9('0xa0')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xa0')][_0xf0a9('0x10b')](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x1ad')][_0xf0a9('0x101')](db[_0xf0a9('0x1ae')],{'as':'Configurations','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x1ae')]['hasMany'](db[_0xf0a9('0x1af')],{'as':_0xf0a9('0x1ac'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x1ae')][_0xf0a9('0x101')](db[_0xf0a9('0x1af')],{'as':'Descriptions','onDelete':_0xf0a9('0xff'),'foreignKey':'DescriptionId'});db[_0xf0a9('0x1ae')][_0xf0a9('0x101')](db[_0xf0a9('0x1af')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x1ae')]['belongsTo'](db['DeskAccount'],{'as':'Account','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x1ae')]['belongsToMany'](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x1b0')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db['DeskField'][_0xf0a9('0x101')](db[_0xf0a9('0x1af')],{'as':_0xf0a9('0x1a9'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x1af')][_0xf0a9('0x101')](db[_0xf0a9('0x1af')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db['DeskField'][_0xf0a9('0x10b')](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x1b1')][_0xf0a9('0x101')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x1b2')][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1ac'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a5')});db['ZohoConfiguration'][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1b3'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0x1b2')][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xf0a9('0x10b')](db['ZohoAccount'],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xa5')][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db['ZohoField']['hasMany'](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1a9'),'foreignKey':'DescriptionId'});db[_0xf0a9('0xa5')][_0xf0a9('0x101')](db[_0xf0a9('0xa5')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db['ZohoField'][_0xf0a9('0x10b')](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db['ZendeskAccount'][_0xf0a9('0x101')](db[_0xf0a9('0xa8')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xa8')][_0xf0a9('0x101')](db[_0xf0a9('0xaa')],{'as':_0xf0a9('0x1ac'),'foreignKey':'SubjectId'});db[_0xf0a9('0xa8')][_0xf0a9('0x101')](db['ZendeskField'],{'as':_0xf0a9('0x1b3'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xa8')][_0xf0a9('0x101')](db[_0xf0a9('0xaa')],{'as':_0xf0a9('0x19f'),'foreignKey':'FieldId'});db[_0xf0a9('0xa8')][_0xf0a9('0x10b')](db[_0xf0a9('0x1b4')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xa8')][_0xf0a9('0x10d')](db['Tag'],{'through':_0xf0a9('0x1b5')});db['ZendeskField'][_0xf0a9('0x101')](db[_0xf0a9('0xaa')],{'as':_0xf0a9('0x1a8'),'foreignKey':'SubjectId'});db[_0xf0a9('0xaa')]['hasMany'](db[_0xf0a9('0xaa')],{'as':'Description','foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xaa')][_0xf0a9('0x101')](db[_0xf0a9('0xaa')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db['ZendeskField']['belongsTo'](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0xac')][_0xf0a9('0x101')](db['FreshdeskConfiguration'],{'as':_0xf0a9('0x1b6'),'onDelete':'cascade','foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xad')]['hasMany'](db[_0xf0a9('0xae')],{'as':'Subjects','onDelete':_0xf0a9('0xff'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration']['hasMany'](db[_0xf0a9('0xae')],{'as':_0xf0a9('0x1b3'),'onDelete':'cascade','foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xad')]['hasMany'](db[_0xf0a9('0xae')],{'as':_0xf0a9('0x19f'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xad')][_0xf0a9('0x10b')](db[_0xf0a9('0xac')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xad')][_0xf0a9('0x10d')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0xf0a9('0x101')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xae')][_0xf0a9('0x101')](db['FreshdeskField'],{'as':_0xf0a9('0x1a9'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xae')][_0xf0a9('0x101')](db[_0xf0a9('0xae')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xae')][_0xf0a9('0x10b')](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x1b7')]['hasMany'](db[_0xf0a9('0xb1')],{'as':'Configurations','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xb1')]['hasMany'](db[_0xf0a9('0xb3')],{'as':_0xf0a9('0x1ac'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xb1')][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':_0xf0a9('0x1b3'),'foreignKey':_0xf0a9('0x1a6')});db['VtigerConfiguration'][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':_0xf0a9('0x19f'),'foreignKey':'FieldId'});db[_0xf0a9('0xb1')]['belongsTo'](db[_0xf0a9('0x1b7')],{'as':'Account','foreignKey':_0xf0a9('0x1a4')});db['VtigerField'][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':_0xf0a9('0x1a8'),'foreignKey':'SubjectId'});db[_0xf0a9('0xb3')][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':'Description','foreignKey':_0xf0a9('0x1a6')});db['VtigerField'][_0xf0a9('0x101')](db[_0xf0a9('0xb3')],{'as':'Field','foreignKey':'FieldId'});db[_0xf0a9('0xb3')]['belongsTo'](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':'VariableId'});db[_0xf0a9('0xb5')]['hasMany'](db['ServicenowConfiguration'],{'as':_0xf0a9('0x1b6'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xb7')]['hasMany'](db[_0xf0a9('0xb9')],{'as':'Subjects','foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xb7')][_0xf0a9('0x101')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xb7')]['hasMany'](db[_0xf0a9('0xb9')],{'as':_0xf0a9('0x19f'),'foreignKey':'FieldId'});db[_0xf0a9('0xb7')]['belongsTo'](db[_0xf0a9('0xb5')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xb9')]['hasMany'](db[_0xf0a9('0xb9')],{'as':'Subject','foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xb9')][_0xf0a9('0x101')](db['ServicenowField'],{'as':_0xf0a9('0x1a9'),'foreignKey':_0xf0a9('0x1a6')});db['ServicenowField'][_0xf0a9('0x101')](db[_0xf0a9('0xb9')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xb9')]['belongsTo'](db[_0xf0a9('0x8c')],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db['Dynamics365Account'][_0xf0a9('0x101')](db[_0xf0a9('0xbc')],{'as':_0xf0a9('0x1b6'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db['Dynamics365Configuration']['hasMany'](db[_0xf0a9('0xbd')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xf0a9('0x101')](db[_0xf0a9('0xbd')],{'as':_0xf0a9('0x1b3'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xbc')][_0xf0a9('0x101')](db['Dynamics365Field'],{'as':_0xf0a9('0x19f'),'onDelete':'cascade','foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0xbc')][_0xf0a9('0x10b')](db[_0xf0a9('0xba')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0xbd')]['hasMany'](db['Dynamics365Field'],{'as':_0xf0a9('0x1a8'),'foreignKey':'SubjectId'});db[_0xf0a9('0xbd')][_0xf0a9('0x101')](db[_0xf0a9('0xbd')],{'as':_0xf0a9('0x1a9'),'foreignKey':'DescriptionId'});db[_0xf0a9('0xbd')][_0xf0a9('0x101')](db['Dynamics365Field'],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db['Dynamics365Field'][_0xf0a9('0x10b')](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0x1b8')][_0xf0a9('0x101')](db['FreshsalesConfiguration'],{'as':_0xf0a9('0x1b6'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1a4')});db['FreshsalesConfiguration'][_0xf0a9('0x101')](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1ac'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0xbf')]['hasMany'](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1b3'),'foreignKey':_0xf0a9('0x1a6')});db[_0xf0a9('0xbf')]['hasMany'](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x19f'),'foreignKey':'FieldId'});db[_0xf0a9('0xbf')][_0xf0a9('0x10b')](db['FreshsalesAccount'],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1a4')});db[_0xf0a9('0x1b9')]['hasMany'](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1a8'),'foreignKey':_0xf0a9('0x1a5')});db[_0xf0a9('0x1b9')]['hasMany'](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1a9'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0xf0a9('0x101')](db[_0xf0a9('0x1b9')],{'as':_0xf0a9('0x1aa'),'foreignKey':_0xf0a9('0x1a7')});db[_0xf0a9('0x1b9')][_0xf0a9('0x10b')](db['Variable'],{'as':_0xf0a9('0x8c'),'foreignKey':_0xf0a9('0x1ab')});db[_0xf0a9('0xc3')][_0xf0a9('0x10b')](db[_0xf0a9('0x124')],{});db['ChatQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xc3')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':_0xf0a9('0x14a'),'foreignKey':'ContactId'});db[_0xf0a9('0xc3')][_0xf0a9('0x10b')](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db[_0xf0a9('0x64')],{});db[_0xf0a9('0xc3')]['belongsTo'](db[_0xf0a9('0x11')],{});db[_0xf0a9('0xc3')]['belongsTo'](db[_0xf0a9('0x11b')],{});db[_0xf0a9('0xc5')][_0xf0a9('0x10b')](db['User'],{'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1ba')});db['ChatInternalMessage'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'onDelete':_0xf0a9('0xff'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0xf0a9('0x101')](db[_0xf0a9('0xc8')],{'foreignKey':_0xf0a9('0x1bb'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0xc9')][_0xf0a9('0x101')](db[_0xf0a9('0xc7')],{'foreignKey':_0xf0a9('0x1bb'),'onDelete':_0xf0a9('0xff')});db[_0xf0a9('0xcb')][_0xf0a9('0x10b')](db[_0xf0a9('0x4f')],{});db[_0xf0a9('0xcb')][_0xf0a9('0x10b')](db['CmList'],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db['SmsQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db['SmsQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x52')],{});db[_0xf0a9('0xcb')][_0xf0a9('0x10b')](db['SmsMessage'],{});db[_0xf0a9('0xcb')]['belongsTo'](db['User'],{});db[_0xf0a9('0xcb')]['belongsTo'](db[_0xf0a9('0x54')],{});db['JscriptyProject'][_0xf0a9('0x101')](db[_0xf0a9('0xc9')],{'foreignKey':_0xf0a9('0x1bc')});db[_0xf0a9('0xcf')][_0xf0a9('0x101')](db['JscriptyQuestionReport'],{'foreignKey':_0xf0a9('0x1bc')});db['JscriptyProject'][_0xf0a9('0x101')](db[_0xf0a9('0xc7')],{'foreignKey':'ProjectId'});db[_0xf0a9('0xd3')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Users','through':_0xf0a9('0x130')});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x1bd')});db['Team'][_0xf0a9('0x10d')](db['VoiceQueue'],{'through':'team_has_voice_queues','as':_0xf0a9('0x1be')});db[_0xf0a9('0xd7')]['belongsToMany'](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0x11b')],{'through':_0xf0a9('0x181'),'as':_0xf0a9('0x11c')});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0x4c')],{'through':_0xf0a9('0x169'),'as':_0xf0a9('0x11e')});db['Team'][_0xf0a9('0x10d')](db['SmsQueue'],{'through':_0xf0a9('0x171'),'as':_0xf0a9('0x1bf')});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0x11f')],{'through':'team_has_openchannel_queues','as':_0xf0a9('0x120')});db[_0xf0a9('0xd7')][_0xf0a9('0x10d')](db[_0xf0a9('0xfa')],{'through':_0xf0a9('0x1c0'),'as':_0xf0a9('0x1c1')});db[_0xf0a9('0xda')]['hasMany'](db[_0xf0a9('0x6d')],{'as':'Hoppers','foreignKey':_0xf0a9('0x188')});db[_0xf0a9('0xda')][_0xf0a9('0x101')](db[_0xf0a9('0x71')],{'as':_0xf0a9('0x185'),'foreignKey':'CampaignId'});db[_0xf0a9('0xda')]['hasMany'](db[_0xf0a9('0x73')],{'as':_0xf0a9('0x13a'),'foreignKey':'CampaignId'});db[_0xf0a9('0xda')]['hasMany'](db[_0xf0a9('0x6f')],{'as':_0xf0a9('0x1c2'),'foreignKey':_0xf0a9('0x188')});db[_0xf0a9('0xda')][_0xf0a9('0x10b')](db['Trunk'],{'as':_0xf0a9('0x27'),'foreignKey':_0xf0a9('0x1c3')});db['Campaign']['belongsTo'](db[_0xf0a9('0x27')],{'as':_0xf0a9('0x1c4'),'foreignKey':_0xf0a9('0x13c')});db[_0xf0a9('0xda')][_0xf0a9('0x10b')](db['Interval'],{'as':'Interval','foreignKey':_0xf0a9('0x13d')});db[_0xf0a9('0xda')][_0xf0a9('0x10b')](db[_0xf0a9('0xd3')],{'as':_0xf0a9('0xd3'),'foreignKey':_0xf0a9('0x1c5')});db[_0xf0a9('0xda')]['belongsToMany'](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x112'),'through':_0xf0a9('0x1c6')});db[_0xf0a9('0xda')]['belongsToMany'](db[_0xf0a9('0xe6')],{'as':'BlackLists','through':_0xf0a9('0x1c7')});db[_0xf0a9('0xe0')][_0xf0a9('0x10b')](db[_0xf0a9('0x150')],{});db[_0xf0a9('0xe0')][_0xf0a9('0x10b')](db['MailInteraction'],{});db[_0xf0a9('0xe0')][_0xf0a9('0x10b')](db[_0xf0a9('0x38')],{'foreignKey':_0xf0a9('0x1c8'),'as':'FromAccount'});db['MailTransferReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1c9'),'as':_0xf0a9('0x1ca')});db['MailTransferReport']['belongsTo'](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db['MailTransferReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x39')],{'foreignKey':_0xf0a9('0x1cd'),'as':'ToQueue'});db[_0xf0a9('0xe0')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xf0a9('0x1ce'),'as':_0xf0a9('0x1cf')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db[_0xf0a9('0x64')],{});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db[_0xf0a9('0x115')],{});db[_0xf0a9('0x1d0')]['belongsTo'](db[_0xf0a9('0x124')],{'foreignKey':_0xf0a9('0x1d1'),'as':_0xf0a9('0x1d2')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':'FromUserId','as':_0xf0a9('0x1ca')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db['ChatQueue'],{'foreignKey':_0xf0a9('0x1d3'),'as':_0xf0a9('0x1d4')});db[_0xf0a9('0x1d0')][_0xf0a9('0x10b')](db['ChatWebsite'],{'foreignKey':_0xf0a9('0x1d5'),'as':_0xf0a9('0x1cf')});db['FaxTransferReport']['belongsTo'](db[_0xf0a9('0x4a')],{});db['FaxTransferReport'][_0xf0a9('0x10b')](db[_0xf0a9('0x48')],{});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{'foreignKey':_0xf0a9('0x1d6'),'as':_0xf0a9('0x1d2')});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db['User'],{'foreignKey':_0xf0a9('0x1c9'),'as':_0xf0a9('0x1ca')});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db['FaxQueue'],{'foreignKey':_0xf0a9('0x1d7'),'as':_0xf0a9('0x1d4')});db[_0xf0a9('0xe3')][_0xf0a9('0x10b')](db[_0xf0a9('0x125')],{'foreignKey':_0xf0a9('0x1d8'),'as':'ToAccount'});db[_0xf0a9('0xe5')][_0xf0a9('0x10b')](db[_0xf0a9('0x5b')],{});db[_0xf0a9('0xe5')][_0xf0a9('0x10b')](db[_0xf0a9('0x59')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0xf0a9('0x173')],{'foreignKey':_0xf0a9('0x1d9'),'as':'FromAccount'});db[_0xf0a9('0xe5')]['belongsTo'](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1c9'),'as':_0xf0a9('0x1ca')});db[_0xf0a9('0xe5')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db[_0xf0a9('0xe5')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0xf0a9('0x1d4')});db[_0xf0a9('0xe5')][_0xf0a9('0x10b')](db[_0xf0a9('0x173')],{'foreignKey':_0xf0a9('0x1da'),'as':_0xf0a9('0x1cf')});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db[_0xf0a9('0x16b')],{});db[_0xf0a9('0x1db')]['belongsTo'](db['SmsInteraction'],{});db[_0xf0a9('0x1db')]['belongsTo'](db[_0xf0a9('0x4f')],{'foreignKey':_0xf0a9('0x1dc'),'as':'FromAccount'});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':_0xf0a9('0x1c9'),'as':_0xf0a9('0x1ca')});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db[_0xf0a9('0x54')],{'foreignKey':_0xf0a9('0x1dd'),'as':_0xf0a9('0x1d4')});db[_0xf0a9('0x1db')][_0xf0a9('0x10b')](db['SmsAccount'],{'foreignKey':_0xf0a9('0x1de'),'as':_0xf0a9('0x1cf')});db[_0xf0a9('0xe6')][_0xf0a9('0x101')](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':_0xf0a9('0x154')});db['CmList'][_0xf0a9('0x101')](db[_0xf0a9('0x77')],{'as':_0xf0a9('0x1df'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xe6')][_0xf0a9('0x101')](db[_0xf0a9('0x6b')],{'as':'Contacts','onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x154')});db['CmList']['hasMany'](db[_0xf0a9('0x71')],{'as':_0xf0a9('0x185'),'foreignKey':_0xf0a9('0x154')});db['CmList'][_0xf0a9('0x101')](db[_0xf0a9('0x73')],{'as':_0xf0a9('0x1e0'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xe6')][_0xf0a9('0x101')](db['ReportAgentPreview'],{'as':_0xf0a9('0x75'),'foreignKey':'ListId'});db[_0xf0a9('0xe6')][_0xf0a9('0x10d')](db[_0xf0a9('0x118')],{'as':_0xf0a9('0x1e1'),'through':'voice_queues_has_cm_lists'});db[_0xf0a9('0xe6')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':'Agents','through':_0xf0a9('0x113')});db[_0xf0a9('0x122')]['hasMany'](db[_0xf0a9('0x17')],{'as':_0xf0a9('0x103'),'onDelete':'cascade'});db[_0xf0a9('0x122')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x123')});db[_0xf0a9('0xe9')][_0xf0a9('0x101')](db[_0xf0a9('0x11')],{'as':'Users','foreignKey':_0xf0a9('0x10c')});db[_0xf0a9('0xe9')][_0xf0a9('0x101')](db[_0xf0a9('0x1e2')],{'as':_0xf0a9('0x1e3'),'foreignKey':'userProfileId','onDelete':_0xf0a9('0xff')});db[_0xf0a9('0x1e2')][_0xf0a9('0x101')](db[_0xf0a9('0xec')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0xf0a9('0xff')});db[_0xf0a9('0xf0')][_0xf0a9('0x101')](db[_0xf0a9('0x14e')],{'as':_0xf0a9('0x162'),'foreignKey':_0xf0a9('0x1e4')});db[_0xf0a9('0xf0')]['hasMany'](db[_0xf0a9('0x7b')],{'as':_0xf0a9('0x14f'),'foreignKey':'WhatsappAccountId'});db[_0xf0a9('0xf0')][_0xf0a9('0x101')](db['WhatsappMessage'],{'as':_0xf0a9('0x151'),'foreignKey':'WhatsappAccountId'});db[_0xf0a9('0xf0')][_0xf0a9('0x101')](db[_0xf0a9('0xf3')],{'as':_0xf0a9('0x152')});db[_0xf0a9('0xf0')][_0xf0a9('0x101')](db[_0xf0a9('0x1e5')],{'as':_0xf0a9('0x134')});db[_0xf0a9('0xf0')]['belongsTo'](db[_0xf0a9('0xe6')],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xf0')][_0xf0a9('0x10b')](db[_0xf0a9('0x81')],{'as':_0xf0a9('0x13e'),'foreignKey':_0xf0a9('0x155')});db['WhatsappAccount'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x12e')});db[_0xf0a9('0x1e5')][_0xf0a9('0x10b')](db['User'],{'onDelete':_0xf0a9('0x15f')});db[_0xf0a9('0x1e5')]['belongsTo'](db[_0xf0a9('0xfa')],{'onDelete':'restrict'});db[_0xf0a9('0x1e5')][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{'onDelete':_0xf0a9('0x15f')});db['WhatsappApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x7f')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':_0xf0a9('0x13d')});db['WhatsappApplication'][_0xf0a9('0x10b')](db[_0xf0a9('0x88')],{'onDelete':_0xf0a9('0x15f'),'foreignKey':'TagId'});db[_0xf0a9('0xf3')][_0xf0a9('0x101')](db[_0xf0a9('0x1e6')],{'as':_0xf0a9('0x151'),'onDelete':_0xf0a9('0xff'),'foreignKey':_0xf0a9('0x1e7')});db['WhatsappInteraction'][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1e4')});db[_0xf0a9('0xf3')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db['WhatsappInteraction'][_0xf0a9('0x10b')](db['User'],{'as':_0xf0a9('0x16e'),'foreignKey':_0xf0a9('0x100')});db[_0xf0a9('0xf3')][_0xf0a9('0x10d')](db[_0xf0a9('0x88')],{'through':_0xf0a9('0x198'),'as':_0xf0a9('0x15a')});db['WhatsappInteraction'][_0xf0a9('0x10d')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xf0a9('0xf3')][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x15c'),'through':_0xf0a9('0x1e8'),'foreignKey':_0xf0a9('0x1e7')});db[_0xf0a9('0x1e6')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'as':'User'});db[_0xf0a9('0x1e6')][_0xf0a9('0x10b')](db['CmContact'],{'onDelete':'cascade','as':_0xf0a9('0x14a')});db[_0xf0a9('0x1e6')]['belongsTo'](db[_0xf0a9('0xf3')],{'onDelete':_0xf0a9('0xff'),'as':_0xf0a9('0x15e'),'foreignKey':_0xf0a9('0x1e7')});db[_0xf0a9('0x1e6')][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{'as':_0xf0a9('0x158'),'foreignKey':_0xf0a9('0x1e4')});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db['CmList'],{'as':_0xf0a9('0x153'),'foreignKey':_0xf0a9('0x154')});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db[_0xf0a9('0x6b')],{'as':'Contact','foreignKey':_0xf0a9('0x14b')});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db[_0xf0a9('0xf3')],{});db['WhatsappQueueReport'][_0xf0a9('0x10b')](db[_0xf0a9('0xfa')],{});db[_0xf0a9('0xf6')][_0xf0a9('0x10b')](db[_0xf0a9('0x1e6')],{});db[_0xf0a9('0xf6')]['belongsTo'](db[_0xf0a9('0x11')],{});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db['WhatsappMessage'],{});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db[_0xf0a9('0xf3')],{});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db[_0xf0a9('0xf0')],{'foreignKey':_0xf0a9('0x1e9'),'as':_0xf0a9('0x1d2')});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db['WhatsappAccount'],{'foreignKey':_0xf0a9('0x1ea'),'as':'ToAccount'});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db[_0xf0a9('0x11')],{'foreignKey':'FromUserId','as':_0xf0a9('0x1ca')});db[_0xf0a9('0xf8')][_0xf0a9('0x10b')](db['User'],{'foreignKey':_0xf0a9('0x1cb'),'as':_0xf0a9('0x1cc')});db['WhatsappQueue'][_0xf0a9('0x10d')](db[_0xf0a9('0x11')],{'as':_0xf0a9('0x140'),'through':_0xf0a9('0x33'),'foreignKey':_0xf0a9('0x1eb')});db[_0xf0a9('0xfa')][_0xf0a9('0x10d')](db['Team'],{'through':_0xf0a9('0x1c0'),'as':_0xf0a9('0x141')});module[_0xf0a9('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 5696543..723653e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x280b=['/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./config/logger','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','user','name','role','body','connection','device','other','agent_id','agent_name','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/members/reports','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x280b,0xb6));var _0xb280=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x280b[_0x6c993a];return _0x27f547;};'use strict';var path=require(_0xb280('0x0'));var express=require(_0xb280('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0xb280('0x2'));var config=require(_0xb280('0x3'));var logger=require(_0xb280('0x4'))('api');var authLogger=require('./config/logger')(_0xb280('0x5'));exports[_0xb280('0x6')]=function(_0x2f3fce){_0x2f3fce[_0xb280('0x7')](ewinston[_0xb280('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x140576,_0x4251a9){return util[_0xb280('0x9')](_0xb280('0xa'),_0x140576[_0xb280('0xb')],_0x140576[_0xb280('0xc')][_0xb280('0xd')]?_0x140576[_0xb280('0xc')][_0xb280('0xd')]:_0x140576['connection'][_0xb280('0xe')]||_0x140576['ip'],_0x140576[_0xb280('0xf')],_0x4251a9[_0xb280('0x10')],_0x4251a9[_0xb280('0x11')],_0x140576[_0xb280('0x12')]?_0x140576[_0xb280('0x12')]['id']:null,_0x140576[_0xb280('0x12')]?_0x140576[_0xb280('0x12')][_0xb280('0x13')]:null,_0x140576[_0xb280('0x12')]?_0x140576[_0xb280('0x12')][_0xb280('0x14')]:null);}}));_0x2f3fce[_0xb280('0x7')](ewinston[_0xb280('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2d1196,_0x310d7c){var _0x2a3518='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2d1196[_0xb280('0x15')]&&_0x2d1196[_0xb280('0x15')]['device']&&_0x2d1196[_0xb280('0x15')]['agent_id']){_0x2a3518='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x2a3518,_0x2d1196[_0xb280('0xb')],_0x2d1196['headers'][_0xb280('0xd')]?_0x2d1196[_0xb280('0xc')][_0xb280('0xd')]:_0x2d1196[_0xb280('0x16')]['remoteAddress']||_0x2d1196['ip'],_0x2d1196['url'],_0x310d7c[_0xb280('0x10')],_0x310d7c['responseTime'],_0x2d1196[_0xb280('0x12')]?_0x2d1196['user']['id']:null,_0x2d1196['user']?_0x2d1196[_0xb280('0x12')]['name']:null,_0x2d1196[_0xb280('0x12')]?_0x2d1196[_0xb280('0x12')][_0xb280('0x14')]:null,_0x2d1196['body']&&_0x2d1196[_0xb280('0x15')][_0xb280('0x17')]?_0x2d1196['body'][_0xb280('0x17')]:_0xb280('0x18'),_0x2d1196[_0xb280('0x15')]&&_0x2d1196['body']['agent_id']?_0x2d1196[_0xb280('0x15')][_0xb280('0x19')]:'',_0x2d1196[_0xb280('0x15')]&&_0x2d1196[_0xb280('0x15')][_0xb280('0x1a')]?_0x2d1196[_0xb280('0x15')][_0xb280('0x1a')]:'');},'ignoreRoute':function(_0x30ef31){var _0x18c575=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x18c575['test'](_0x30ef31['url']);}}));_0x2f3fce[_0xb280('0x7')](_0xb280('0x1b'),require(_0xb280('0x1c')));_0x2f3fce['use']('/api/voice/chanspy',require(_0xb280('0x1d')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x1e'),require(_0xb280('0x1f')));_0x2f3fce[_0xb280('0x7')]('/api/voice/extensions',require(_0xb280('0x20')));_0x2f3fce['use'](_0xb280('0x21'),require(_0xb280('0x22')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x23'),require(_0xb280('0x24')));_0x2f3fce[_0xb280('0x7')]('/api/voice/recordings',require(_0xb280('0x25')));_0x2f3fce[_0xb280('0x7')]('/api/screen/recordings',require(_0xb280('0x26')));_0x2f3fce[_0xb280('0x7')]('/api/voice/mails',require(_0xb280('0x27')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x28'),require('./api/voiceMailMessage'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x29'),require(_0xb280('0x2a')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x2b'),require(_0xb280('0x2c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x2d'),require(_0xb280('0x2e')));_0x2f3fce[_0xb280('0x7')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x2f3fce['use'](_0xb280('0x2f'),require(_0xb280('0x30')));_0x2f3fce['use']('/api/trunks',require('./api/trunk'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x31'),require(_0xb280('0x32')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x33'),require('./api/mailServerOut'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x34'),require('./api/mailAccount'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x35'),require(_0xb280('0x36')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x37'),require('./api/mailSubstatus'));_0x2f3fce[_0xb280('0x7')]('/api/mail/interactions',require(_0xb280('0x38')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x39'),require(_0xb280('0x3a')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x3b'),require(_0xb280('0x3c')));_0x2f3fce[_0xb280('0x7')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x3d'),require(_0xb280('0x3e')));_0x2f3fce['use']('/api/dashboards/items',require(_0xb280('0x3f')));_0x2f3fce['use']('/api/fax/accounts',require(_0xb280('0x40')));_0x2f3fce['use'](_0xb280('0x41'),require(_0xb280('0x42')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x43'),require(_0xb280('0x44')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x45'),require(_0xb280('0x46')));_0x2f3fce['use'](_0xb280('0x47'),require(_0xb280('0x48')));_0x2f3fce['use'](_0xb280('0x49'),require(_0xb280('0x4a')));_0x2f3fce[_0xb280('0x7')]('/api/sms/accounts',require(_0xb280('0x4b')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x4c'),require(_0xb280('0x4d')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x4e'),require('./api/smsInteraction'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x4f'),require(_0xb280('0x50')));_0x2f3fce['use'](_0xb280('0x51'),require(_0xb280('0x52')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x53'),require(_0xb280('0x54')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x55'),require(_0xb280('0x56')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x57'),require(_0xb280('0x58')));_0x2f3fce[_0xb280('0x7')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x59'),require('./api/openchannelQueue'));_0x2f3fce['use'](_0xb280('0x5a'),require(_0xb280('0x5b')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x5c'),require(_0xb280('0x5d')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x5e'),require('./api/chatApplication'));_0x2f3fce[_0xb280('0x7')]('/api/chat/interactions',require(_0xb280('0x5f')));_0x2f3fce[_0xb280('0x7')]('/api/chat/messages',require(_0xb280('0x60')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x61'),require('./api/chatOfflineMessage'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x62'),require(_0xb280('0x63')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x64'),require(_0xb280('0x65')));_0x2f3fce[_0xb280('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x66'),require('./api/cmCompany'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x67'),require('./api/cmContact'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x68'),require('./api/cmHopper'));_0x2f3fce['use'](_0xb280('0x69'),require('./api/cmHopperBlack'));_0x2f3fce['use'](_0xb280('0x6a'),require('./api/cmHopperFinal'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x6b'),require(_0xb280('0x6c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x6d'),require(_0xb280('0x6e')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x6f'),require(_0xb280('0x70')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x71'),require('./api/automation'));_0x2f3fce['use'](_0xb280('0x72'),require(_0xb280('0x73')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x74'),require(_0xb280('0x75')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x76'),require(_0xb280('0x77')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x78'),require('./api/interval'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x79'),require(_0xb280('0x7a')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x7b'),require(_0xb280('0x7c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x7d'),require('./api/voiceQueuesLog'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x7e'),require(_0xb280('0x7f')));_0x2f3fce['use'](_0xb280('0x80'),require(_0xb280('0x81')));_0x2f3fce['use'](_0xb280('0x82'),require('./api/tag'));_0x2f3fce[_0xb280('0x7')]('/api/templates',require(_0xb280('0x83')));_0x2f3fce['use'](_0xb280('0x84'),require(_0xb280('0x85')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x86'),require(_0xb280('0x87')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x88'),require(_0xb280('0x89')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x8a'),require(_0xb280('0x8b')));_0x2f3fce[_0xb280('0x7')]('/api/analytics/custom_reports',require(_0xb280('0x8c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x8d'),require('./api/analyticDefaultReport'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x8e'),require(_0xb280('0x8f')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x90'),require('./api/analyticMetric'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x91'),require(_0xb280('0x92')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x93'),require(_0xb280('0x94')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/salesforce/accounts',require(_0xb280('0x95')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x96'),require('./api/intSalesforceConfiguration'));_0x2f3fce[_0xb280('0x7')]('/api/integrations/salesforce/fields',require(_0xb280('0x97')));_0x2f3fce['use']('/api/integrations/sugarcrm/accounts',require(_0xb280('0x98')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xb280('0x99')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x9a'),require(_0xb280('0x9b')));_0x2f3fce['use'](_0xb280('0x9c'),require(_0xb280('0x9d')));_0x2f3fce['use'](_0xb280('0x9e'),require(_0xb280('0x9f')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xa0'),require(_0xb280('0xa1')));_0x2f3fce['use'](_0xb280('0xa2'),require(_0xb280('0xa3')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xa4'),require(_0xb280('0xa5')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/zendesk/accounts',require(_0xb280('0xa6')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xa7'),require(_0xb280('0xa8')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xa9'),require(_0xb280('0xaa')));_0x2f3fce['use'](_0xb280('0xab'),require(_0xb280('0xac')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xad'),require('./api/intFreshdeskConfiguration'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xae'),require(_0xb280('0xaf')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb0'),require(_0xb280('0xb1')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb2'),require(_0xb280('0xb3')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb4'),require(_0xb280('0xb5')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb6'),require(_0xb280('0xb7')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xb8'),require(_0xb280('0xb9')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xba'),require(_0xb280('0xbb')));_0x2f3fce['use'](_0xb280('0xbc'),require(_0xb280('0xbd')));_0x2f3fce[_0xb280('0x7')]('/api/integrations/dynamics365/configurations',require(_0xb280('0xbe')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xbf'),require(_0xb280('0xc0')));_0x2f3fce['use'](_0xb280('0xc1'),require(_0xb280('0xc2')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc3'),require('./api/intFreshsalesConfiguration'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc4'),require(_0xb280('0xc5')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc6'),require('./api/network'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc7'),require(_0xb280('0xc8')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xc9'),require(_0xb280('0xca')));_0x2f3fce['use'](_0xb280('0xcb'),require(_0xb280('0xcc')));_0x2f3fce[_0xb280('0x7')]('/api/jscripty/questions/reports',require(_0xb280('0xcd')));_0x2f3fce[_0xb280('0x7')]('/api/jscripty/sessions/reports',require(_0xb280('0xce')));_0x2f3fce[_0xb280('0x7')]('/api/sms/reports/queue',require(_0xb280('0xcf')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xd0'),require(_0xb280('0xd1')));_0x2f3fce['use'](_0xb280('0xd2'),require(_0xb280('0xd3')));_0x2f3fce[_0xb280('0x7')]('/api/jscripty/projects',require(_0xb280('0xd4')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xd5'),require('./api/setting'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xd6'),require(_0xb280('0xd7')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xd8'),require(_0xb280('0xd9')));_0x2f3fce['use'](_0xb280('0xda'),require('./api/squareRecording'));_0x2f3fce['use'](_0xb280('0xdb'),require(_0xb280('0xdc')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xdd'),require(_0xb280('0xde')));_0x2f3fce['use'](_0xb280('0xdf'),require(_0xb280('0xe0')));_0x2f3fce['use'](_0xb280('0xe1'),require(_0xb280('0xe2')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xe3'),require(_0xb280('0xe4')));_0x2f3fce[_0xb280('0x7')]('/api/attachments',require(_0xb280('0xe5')));_0x2f3fce['use'](_0xb280('0xe6'),require('./api/plugin'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xe7'),require(_0xb280('0xe8')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xe9'),require(_0xb280('0xea')));_0x2f3fce[_0xb280('0x7')]('/api/fax/reports/transfer',require(_0xb280('0xeb')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xec'),require(_0xb280('0xed')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xee'),require(_0xb280('0xef')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xf0'),require(_0xb280('0xf1')));_0x2f3fce[_0xb280('0x7')]('/api/voice/prefixes',require(_0xb280('0xf2')));_0x2f3fce['use'](_0xb280('0xf3'),require(_0xb280('0xf4')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xf5'),require(_0xb280('0xf6')));_0x2f3fce[_0xb280('0x7')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xf7'),require(_0xb280('0xf8')));_0x2f3fce['use'](_0xb280('0xf9'),require(_0xb280('0xfa')));_0x2f3fce['use'](_0xb280('0xfb'),require(_0xb280('0xfc')));_0x2f3fce[_0xb280('0x7')](_0xb280('0xfd'),require('./api/whatsappInteraction'));_0x2f3fce[_0xb280('0x7')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x2f3fce[_0xb280('0x7')](_0xb280('0xfe'),require(_0xb280('0xff')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x100'),require('./api/whatsappTransferReport'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x101'),require(_0xb280('0x102')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x103'),require(_0xb280('0x104')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x105'),require(_0xb280('0x106')));_0x2f3fce['use'](_0xb280('0x107'),require('./api/authGoogle'));_0x2f3fce[_0xb280('0x7')](_0xb280('0x108'),require(_0xb280('0x109')));_0x2f3fce['use']('/api/rpc',require(_0xb280('0x10a')));_0x2f3fce['use'](_0xb280('0x10b'),require(_0xb280('0x10c')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x10d'),require(_0xb280('0x10e')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x10f'),require(_0xb280('0x110')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x111'),require(_0xb280('0x112')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x113'),express[_0xb280('0x114')](path[_0xb280('0x115')](config[_0xb280('0x116')],_0xb280('0x113'))));_0x2f3fce[_0xb280('0x7')]('/www',express[_0xb280('0x114')](path['join'](config[_0xb280('0x116')],_0xb280('0x117'))));_0x2f3fce[_0xb280('0x7')](_0xb280('0x118'),express[_0xb280('0x114')](path[_0xb280('0x115')](config[_0xb280('0x116')],_0xb280('0x118'))));_0x2f3fce['use'](_0xb280('0x119'),express[_0xb280('0x114')](path['join'](config[_0xb280('0x116')],'snippet','1.0.16')));_0x2f3fce[_0xb280('0x7')](_0xb280('0x11a'),express[_0xb280('0x114')](path['join'](config[_0xb280('0x116')],_0xb280('0x11b'))));_0x2f3fce[_0xb280('0x11c')](_0xb280('0x11d'))[_0xb280('0x11e')](errors[0x194]);_0x2f3fce[_0xb280('0x11c')]('/*')[_0xb280('0x11e')](function(_0x3bacfa,_0x51d7ab){_0x51d7ab[_0xb280('0x11f')](path[_0xb280('0x120')](_0x2f3fce[_0xb280('0x11e')](_0xb280('0x121'))+_0xb280('0x122')));});}; \ No newline at end of file +var _0x9ae3=['agent_id','agent_name','test','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./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/accounts','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/schedules','./api/schedule','/api/sounds','./api/sound','/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/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','/api/notifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/apidoc','join','root','/www','/demo','static','/snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','/index.html','path','util','./errors','./config/logger','auth','default','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other'];(function(_0x26963d,_0xbe7a42){var _0x1f5b75=function(_0x37d36c){while(--_0x37d36c){_0x26963d['push'](_0x26963d['shift']());}};_0x1f5b75(++_0xbe7a42);}(_0x9ae3,0xfa));var _0x39ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ae3[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0x39ae('0x0'));var express=require('express');var ewinston=require('express-winston');var util=require(_0x39ae('0x1'));var errors=require(_0x39ae('0x2'));var config=require('./config/environment');var logger=require(_0x39ae('0x3'))('api');var authLogger=require('./config/logger')(_0x39ae('0x4'));exports[_0x39ae('0x5')]=function(_0x190af8){_0x190af8['use'](ewinston[_0x39ae('0x6')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3bd050,_0x5e5ac6){return util[_0x39ae('0x7')](_0x39ae('0x8'),_0x3bd050['method'],_0x3bd050['headers'][_0x39ae('0x9')]?_0x3bd050[_0x39ae('0xa')][_0x39ae('0x9')]:_0x3bd050[_0x39ae('0xb')][_0x39ae('0xc')]||_0x3bd050['ip'],_0x3bd050[_0x39ae('0xd')],_0x5e5ac6[_0x39ae('0xe')],_0x5e5ac6[_0x39ae('0xf')],_0x3bd050['user']?_0x3bd050[_0x39ae('0x10')]['id']:null,_0x3bd050[_0x39ae('0x10')]?_0x3bd050[_0x39ae('0x10')][_0x39ae('0x11')]:null,_0x3bd050[_0x39ae('0x10')]?_0x3bd050[_0x39ae('0x10')][_0x39ae('0x12')]:null);}}));_0x190af8['use'](ewinston[_0x39ae('0x6')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2e3ac8,_0x8cd4fd){var _0x42b847=_0x39ae('0x13');if(_0x2e3ac8[_0x39ae('0x14')]&&_0x2e3ac8[_0x39ae('0x14')][_0x39ae('0x15')]&&_0x2e3ac8[_0x39ae('0x14')]['agent_id']){_0x42b847=_0x39ae('0x16');}return util['format'](_0x42b847,_0x2e3ac8['method'],_0x2e3ac8['headers'][_0x39ae('0x9')]?_0x2e3ac8[_0x39ae('0xa')][_0x39ae('0x9')]:_0x2e3ac8['connection'][_0x39ae('0xc')]||_0x2e3ac8['ip'],_0x2e3ac8['url'],_0x8cd4fd[_0x39ae('0xe')],_0x8cd4fd[_0x39ae('0xf')],_0x2e3ac8[_0x39ae('0x10')]?_0x2e3ac8[_0x39ae('0x10')]['id']:null,_0x2e3ac8['user']?_0x2e3ac8[_0x39ae('0x10')][_0x39ae('0x11')]:null,_0x2e3ac8[_0x39ae('0x10')]?_0x2e3ac8['user'][_0x39ae('0x12')]:null,_0x2e3ac8['body']&&_0x2e3ac8[_0x39ae('0x14')][_0x39ae('0x15')]?_0x2e3ac8[_0x39ae('0x14')]['device']:_0x39ae('0x17'),_0x2e3ac8[_0x39ae('0x14')]&&_0x2e3ac8[_0x39ae('0x14')][_0x39ae('0x18')]?_0x2e3ac8['body']['agent_id']:'',_0x2e3ac8[_0x39ae('0x14')]&&_0x2e3ac8['body']['agent_name']?_0x2e3ac8[_0x39ae('0x14')][_0x39ae('0x19')]:'');},'ignoreRoute':function(_0x149506){var _0x42734c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x42734c[_0x39ae('0x1a')](_0x149506[_0x39ae('0xd')]);}}));_0x190af8['use'](_0x39ae('0x1b'),require(_0x39ae('0x1c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x1e'),require(_0x39ae('0x1f')));_0x190af8[_0x39ae('0x1d')]('/api/voice/contexts',require('./api/voiceContext'));_0x190af8[_0x39ae('0x1d')]('/api/voice/extensions',require(_0x39ae('0x20')));_0x190af8['use'](_0x39ae('0x21'),require(_0x39ae('0x22')));_0x190af8['use'](_0x39ae('0x23'),require(_0x39ae('0x24')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x25'),require(_0x39ae('0x26')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x27'),require(_0x39ae('0x28')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x29'),require(_0x39ae('0x2a')));_0x190af8['use']('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x2b'),require(_0x39ae('0x2c')));_0x190af8['use'](_0x39ae('0x2d'),require(_0x39ae('0x2e')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x2f'),require(_0x39ae('0x30')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x31'),require(_0x39ae('0x32')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x33'),require(_0x39ae('0x34')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x35'),require(_0x39ae('0x36')));_0x190af8[_0x39ae('0x1d')]('/api/voice/transfers/reports',require(_0x39ae('0x37')));_0x190af8[_0x39ae('0x1d')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x190af8['use'](_0x39ae('0x38'),require(_0x39ae('0x39')));_0x190af8[_0x39ae('0x1d')]('/api/mail/queues',require('./api/mailQueue'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x3a'),require(_0x39ae('0x3b')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x3c'),require(_0x39ae('0x3d')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x3e'),require(_0x39ae('0x3f')));_0x190af8['use']('/api/mail/applications',require(_0x39ae('0x40')));_0x190af8[_0x39ae('0x1d')]('/api/mail/reports/queue',require(_0x39ae('0x41')));_0x190af8['use'](_0x39ae('0x42'),require(_0x39ae('0x43')));_0x190af8['use'](_0x39ae('0x44'),require(_0x39ae('0x45')));_0x190af8[_0x39ae('0x1d')]('/api/fax/accounts',require('./api/faxAccount'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x46'),require(_0x39ae('0x47')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x48'),require(_0x39ae('0x49')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x4a'),require('./api/faxMessage'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x4b'),require(_0x39ae('0x4c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x4d'),require(_0x39ae('0x4e')));_0x190af8[_0x39ae('0x1d')]('/api/sms/accounts',require(_0x39ae('0x4f')));_0x190af8['use']('/api/sms/applications',require(_0x39ae('0x50')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x51'),require('./api/smsInteraction'));_0x190af8['use'](_0x39ae('0x52'),require(_0x39ae('0x53')));_0x190af8['use'](_0x39ae('0x54'),require(_0x39ae('0x55')));_0x190af8[_0x39ae('0x1d')]('/api/openchannel/accounts',require(_0x39ae('0x56')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x57'),require(_0x39ae('0x58')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x59'),require(_0x39ae('0x5a')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x5b'),require('./api/openchannelMessage'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x5c'),require('./api/openchannelQueue'));_0x190af8[_0x39ae('0x1d')]('/api/chat/websites',require('./api/chatWebsite'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x5d'),require(_0x39ae('0x5e')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x5f'),require(_0x39ae('0x60')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x61'),require('./api/chatInteraction'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x62'),require(_0x39ae('0x63')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x64'),require('./api/chatOfflineMessage'));_0x190af8['use'](_0x39ae('0x65'),require('./api/chatQueue'));_0x190af8['use']('/api/chat/groups',require(_0x39ae('0x66')));_0x190af8[_0x39ae('0x1d')]('/api/chat/proactive_actions',require(_0x39ae('0x67')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x68'),require(_0x39ae('0x69')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x6a'),require(_0x39ae('0x6b')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x6c'),require(_0x39ae('0x6d')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x6e'),require(_0x39ae('0x6f')));_0x190af8[_0x39ae('0x1d')]('/api/cm/hopper_final',require(_0x39ae('0x70')));_0x190af8[_0x39ae('0x1d')]('/api/cm/hopper_history',require(_0x39ae('0x71')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x72'),require(_0x39ae('0x73')));_0x190af8['use'](_0x39ae('0x74'),require(_0x39ae('0x75')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x76'),require('./api/automation'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x77'),require(_0x39ae('0x78')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x79'),require('./api/disposition'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x7a'),require(_0x39ae('0x7b')));_0x190af8[_0x39ae('0x1d')]('/api/intervals',require(_0x39ae('0x7c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x7d'),require(_0x39ae('0x7e')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x7f'),require('./api/cdr'));_0x190af8[_0x39ae('0x1d')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x80'),require(_0x39ae('0x81')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x82'),require(_0x39ae('0x83')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x84'),require(_0x39ae('0x85')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x86'),require(_0x39ae('0x87')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x88'),require(_0x39ae('0x89')));_0x190af8['use'](_0x39ae('0x8a'),require('./api/variable'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x8b'),require(_0x39ae('0x8c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x8d'),require(_0x39ae('0x8e')));_0x190af8[_0x39ae('0x1d')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x8f'),require('./api/analyticDefaultReport'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x90'),require('./api/analyticExtractedReport'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x91'),require('./api/analyticMetric'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x92'),require(_0x39ae('0x93')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x94'),require(_0x39ae('0x95')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/salesforce/accounts',require(_0x39ae('0x96')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x97'),require(_0x39ae('0x98')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x99'),require(_0x39ae('0x9a')));_0x190af8['use'](_0x39ae('0x9b'),require(_0x39ae('0x9c')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x9d'),require(_0x39ae('0x9e')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/desk/accounts',require(_0x39ae('0x9f')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/desk/configurations',require(_0x39ae('0xa0')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/desk/fields',require(_0x39ae('0xa1')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/zoho/accounts',require(_0x39ae('0xa2')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xa3'),require(_0x39ae('0xa4')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xa5'),require(_0x39ae('0xa6')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xa7'),require(_0x39ae('0xa8')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xa9'),require('./api/intZendeskConfiguration'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xaa'),require(_0x39ae('0xab')));_0x190af8['use'](_0x39ae('0xac'),require(_0x39ae('0xad')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xae'),require(_0x39ae('0xaf')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/freshdesk/fields',require(_0x39ae('0xb0')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xb1'),require('./api/intVtigerAccount'));_0x190af8[_0x39ae('0x1d')]('/api/integrations/vtiger/configurations',require(_0x39ae('0xb2')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xb3'),require(_0x39ae('0xb4')));_0x190af8['use'](_0x39ae('0xb5'),require('./api/intServicenowAccount'));_0x190af8['use'](_0x39ae('0xb6'),require('./api/intServicenowConfiguration'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xb7'),require('./api/intServicenowField'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xb8'),require('./api/intDynamics365Account'));_0x190af8[_0x39ae('0x1d')]('/api/integrations/dynamics365/configurations',require(_0x39ae('0xb9')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xba'),require(_0x39ae('0xbb')));_0x190af8[_0x39ae('0x1d')]('/api/integrations/freshsales/accounts',require(_0x39ae('0xbc')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xbd'),require('./api/intFreshsalesConfiguration'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xbe'),require('./api/intFreshsalesField'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xbf'),require(_0x39ae('0xc0')));_0x190af8[_0x39ae('0x1d')]('/api/chat/reports/queue',require(_0x39ae('0xc1')));_0x190af8['use'](_0x39ae('0xc2'),require('./api/chatInternalMessage'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xc3'),require(_0x39ae('0xc4')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xc5'),require(_0x39ae('0xc6')));_0x190af8[_0x39ae('0x1d')]('/api/jscripty/sessions/reports',require(_0x39ae('0xc7')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xc8'),require(_0x39ae('0xc9')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xca'),require(_0x39ae('0xcb')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xcc'),require(_0x39ae('0xcd')));_0x190af8['use']('/api/jscripty/projects',require(_0x39ae('0xce')));_0x190af8[_0x39ae('0x1d')]('/api/settings',require(_0x39ae('0xcf')));_0x190af8['use'](_0x39ae('0xd0'),require(_0x39ae('0xd1')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xd2'),require(_0x39ae('0xd3')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xd4'),require(_0x39ae('0xd5')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xd6'),require('./api/squareMessage'));_0x190af8[_0x39ae('0x1d')]('/api/teams',require(_0x39ae('0xd7')));_0x190af8['use'](_0x39ae('0xd8'),require(_0x39ae('0xd9')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xda'),require(_0x39ae('0xdb')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xdc'),require('./api/migration'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xdd'),require('./api/attachment'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xde'),require(_0x39ae('0xdf')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xe0'),require('./api/mailTransferReport'));_0x190af8[_0x39ae('0x1d')]('/api/chat/reports/transfer',require(_0x39ae('0xe1')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xe2'),require(_0x39ae('0xe3')));_0x190af8['use'](_0x39ae('0xe4'),require(_0x39ae('0xe5')));_0x190af8[_0x39ae('0x1d')]('/api/sms/reports/transfer',require(_0x39ae('0xe6')));_0x190af8[_0x39ae('0x1d')]('/api/cm/lists',require('./api/cmList'));_0x190af8['use'](_0x39ae('0xe7'),require(_0x39ae('0xe8')));_0x190af8[_0x39ae('0x1d')]('/api/userProfiles',require(_0x39ae('0xe9')));_0x190af8['use']('/api/userProfile/sections',require(_0x39ae('0xea')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xeb'),require('./api/userProfileResource'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xec'),require('./api/notification'));_0x190af8['use'](_0x39ae('0xed'),require(_0x39ae('0xee')));_0x190af8['use'](_0x39ae('0xef'),require(_0x39ae('0xf0')));_0x190af8[_0x39ae('0x1d')]('/api/whatsapp/interactions',require(_0x39ae('0xf1')));_0x190af8['use'](_0x39ae('0xf2'),require('./api/whatsappMessage'));_0x190af8['use']('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x190af8['use'](_0x39ae('0xf3'),require(_0x39ae('0xf4')));_0x190af8['use'](_0x39ae('0xf5'),require(_0x39ae('0xf6')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xf7'),require('./api/cloudProvider'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xf8'),require(_0x39ae('0xf9')));_0x190af8[_0x39ae('0x1d')]('/api/auth/google',require(_0x39ae('0xfa')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xfb'),require('./api/jira'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xfc'),require(_0x39ae('0xfd')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0xfe'),require(_0x39ae('0xff')));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x100'),require(_0x39ae('0x101')));_0x190af8[_0x39ae('0x1d')]('/api/pm2',require(_0x39ae('0x102')));_0x190af8['use']('/api/webbar',require('./api/webbar'));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x103'),express['static'](path[_0x39ae('0x104')](config[_0x39ae('0x105')],_0x39ae('0x103'))));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x106'),express['static'](path[_0x39ae('0x104')](config['root'],_0x39ae('0x106'))));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x107'),express[_0x39ae('0x108')](path[_0x39ae('0x104')](config[_0x39ae('0x105')],_0x39ae('0x107'))));_0x190af8[_0x39ae('0x1d')](_0x39ae('0x109'),express[_0x39ae('0x108')](path[_0x39ae('0x104')](config[_0x39ae('0x105')],'snippet',_0x39ae('0x10a'))));_0x190af8['use'](_0x39ae('0x10b'),express[_0x39ae('0x108')](path[_0x39ae('0x104')](config[_0x39ae('0x105')],_0x39ae('0x10c'))));_0x190af8[_0x39ae('0x10d')](_0x39ae('0x10e'))[_0x39ae('0x10f')](errors[0x194]);_0x190af8['route']('/*')[_0x39ae('0x10f')](function(_0x86932d,_0x5891d5){_0x5891d5['sendFile'](path[_0x39ae('0x110')](_0x190af8[_0x39ae('0x10f')]('appPath')+_0x39ae('0x111')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c4dcbd7..97d5a44 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e88=['../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc'];(function(_0x5ea8f7,_0x3ae5ab){var _0x5e5dee=function(_0x4fb557){while(--_0x4fb557){_0x5ea8f7['push'](_0x5ea8f7['shift']());}};_0x5e5dee(++_0x3ae5ab);}(_0x8e88,0x1c5));var _0x88e8=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x8e88[_0x4191bc];return _0x1ffd4e;};'use strict';var jayson=require(_0x88e8('0x0'));var BPromise=require(_0x88e8('0x1'));var _=require(_0x88e8('0x2'));var config=require(_0x88e8('0x3'));exports[_0x88e8('0x4')]=function(){return new BPromise(function(_0x3dda58,_0x476a70){var _0x47ac78={};_0x47ac78=_['merge'](_0x47ac78,require('../api/user/user.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x6')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x7')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x8')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x9')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xa')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xb')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xc')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0xd')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xe')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0xf')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x10')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/mailServerIn/mailServerIn.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/mailAccount/mailAccount.rpc'));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x11')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x12')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/mailMessage/mailMessage.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x13')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x14')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x15')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x16')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x17')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x18')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/faxQueue/faxQueue.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x19')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1a')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1b')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x1c')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1d')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1e')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x1f')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x20')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x21')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x22')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x23')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x24')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x25')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x26')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x27')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x28')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x29')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x2a')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x2b')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x2c')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x2d')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x2e')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/variable/variable.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x2f')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x30')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x31')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x32')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x33')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x34')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x35')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x36')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x37')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/squareReport/squareReport.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x38')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/squareOdbc/squareOdbc.rpc'));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x39')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x3a')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x3b')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x3c')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x3d')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x3e')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x3f')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x40')));_0x47ac78=_[_0x88e8('0x5')](_0x47ac78,require(_0x88e8('0x41')));_0x47ac78=_['merge'](_0x47ac78,require(_0x88e8('0x42')));var _0xe88181=jayson[_0x88e8('0x43')](_0x47ac78)[_0x88e8('0x44')]();var _0x43a8c6=config[_0x88e8('0x45')][_0x88e8('0x46')]||config['port']+0x1;var _0x3cca07=config['rpc']['ip']||_0x88e8('0x47');_0xe88181['on'](_0x88e8('0x48'),function(_0x4e4ac4){return _0x476a70(_0x4e4ac4);});_0xe88181['listen'](_0x43a8c6,_0x3cca07,function(){console[_0x88e8('0x49')](_0x88e8('0x4a'),_0x3cca07,_0x43a8c6);require(_0x88e8('0x4b'))[_0x88e8('0x4c')]();return _0x3dda58(_0x88e8('0x4d')+_0x3cca07+':'+_0x43a8c6);});});}; \ No newline at end of file +var _0xdfc3=['listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error'];(function(_0x3efb27,_0x2c6200){var _0x37525a=function(_0x472fd7){while(--_0x472fd7){_0x3efb27['push'](_0x3efb27['shift']());}};_0x37525a(++_0x2c6200);}(_0xdfc3,0x1e8));var _0x3dfc=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xdfc3[_0x1deb03];return _0x189fe7;};'use strict';var jayson=require(_0x3dfc('0x0'));var BPromise=require(_0x3dfc('0x1'));var _=require('lodash');var config=require(_0x3dfc('0x2'));exports['listen']=function(){return new BPromise(function(_0x1c0f38,_0x59c812){var _0x19257e={};_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x4')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x5')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x6')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x7')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x8')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x9')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0xa')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xb')));_0x19257e=_['merge'](_0x19257e,require('../api/trunk/trunk.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xc')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xd')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/mailAccount/mailAccount.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xe')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0xf')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/mailMessage/mailMessage.rpc'));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x10')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x11')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/faxAccount/faxAccount.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/faxApplication/faxApplication.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x12')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/faxMessage/faxMessage.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x13')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/smsAccount/smsAccount.rpc'));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x14')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x15')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x16')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x17')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x18')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x19')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1a')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1b')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1c')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/chatMessage/chatMessage.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1d')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1e')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x1f')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x20')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x21')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x22')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x23')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x24')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x25')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/template/template.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x26')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x27')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x28')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x29')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x2a')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x2b')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x2c')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x2d')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x2e')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x2f')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x30')));_0x19257e=_['merge'](_0x19257e,require('../api/squareReport/squareReport.rpc'));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x31')));_0x19257e=_['merge'](_0x19257e,require('../api/squareOdbc/squareOdbc.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x32')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x33')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/squareMessage/squareMessage.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x34')));_0x19257e=_['merge'](_0x19257e,require(_0x3dfc('0x35')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require('../api/plugin/plugin.rpc'));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x36')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x37')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x38')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x39')));_0x19257e=_[_0x3dfc('0x3')](_0x19257e,require(_0x3dfc('0x3a')));var _0x5e8a6f=jayson['server'](_0x19257e)[_0x3dfc('0x3b')]();var _0x705c43=config[_0x3dfc('0x3c')][_0x3dfc('0x3d')]||config[_0x3dfc('0x3d')]+0x1;var _0x53c3d5=config[_0x3dfc('0x3c')]['ip']||_0x3dfc('0x3e');_0x5e8a6f['on'](_0x3dfc('0x3f'),function(_0x466cb1){return _0x59c812(_0x466cb1);});_0x5e8a6f[_0x3dfc('0x40')](_0x705c43,_0x53c3d5,function(){console[_0x3dfc('0x41')](_0x3dfc('0x42'),_0x53c3d5,_0x705c43);require(_0x3dfc('0x43'))['default']();return _0x1c0f38(_0x3dfc('0x44')+_0x53c3d5+':'+_0x705c43);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 629a9d9..82ad2a2 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 _0xdcdb=['SET\x20EXTENSION\x20%s','HANGUP','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','exports','util','lodash','events','EventEmitter','./reply','call','setEncoding','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','no\x20code','substr','indexOf','startsWith','split','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','log','command=','function','write','prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension'];(function(_0x1b6621,_0x105c12){var _0x12cad9=function(_0x523cf2){while(--_0x523cf2){_0x1b6621['push'](_0x1b6621['shift']());}};_0x12cad9(++_0x105c12);}(_0xdcdb,0xab));var _0xbdcd=function(_0x1424ef,_0x4f0eda){_0x1424ef=_0x1424ef-0x0;var _0x2478c3=_0xdcdb[_0x1424ef];return _0x2478c3;};'use strict';var util=require(_0xbdcd('0x0'));var _=require(_0xbdcd('0x1'));var EventEmitter=require(_0xbdcd('0x2'))[_0xbdcd('0x3')];var AGIReply=require(_0xbdcd('0x4'));var AGIError=require('./error');function AGIChannel(_0x1ede78){var _0x3ec1c3=this,_0x309eb3=new AGIReply(),_0x147134=![],_0x27f33c={};EventEmitter[_0xbdcd('0x5')](_0x3ec1c3);_0x1ede78[_0xbdcd('0x6')]('utf8');_0x1ede78['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x309eb3[_0xbdcd('0x6')]('utf8');_0x309eb3['on'](_0xbdcd('0x7'),function(_0xd46201){for(var _0x1aeee6 in _0xd46201){_0x3ec1c3[_0x1aeee6]=_0xd46201[_0x1aeee6];}_0x3ec1c3[_0xbdcd('0x8')]('ready');});_0x309eb3['on'](_0xbdcd('0x9'),function(_0x355c22){if(_0x355c22[_0xbdcd('0xa')]()==_0xbdcd('0xb')){_0x3ec1c3[_0xbdcd('0x8')]('hangup');return;}if(_0x355c22[_0xbdcd('0xc')](0x0,0xb)==_0xbdcd('0xd')){_0x147134=!![];}if(_0x147134){_0x27f33c['rx']+=_0x355c22+'\x0a';if(_0x355c22[_0xbdcd('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x147134=![];}}else{_0x27f33c['rx']=_0x355c22;}if(_0x147134){return;}if(typeof _0x27f33c['cb']=='function'){var _0x42b559=_0x27f33c['rx'][_0xbdcd('0xc')](0x0,0x3),_0x2cb72a=null,_0x36a92b=null;_0x42b559=parseInt(_0x42b559);if(isNaN(_0x42b559)){_0x27f33c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xbdcd('0xf')});return;}if(_0x42b559!=0xc8){_0x27f33c['cb'](null,{'code':_0x42b559,'result':-0x1,'extra':'KO'});return;}_0x2cb72a=_0x27f33c['rx'][_0xbdcd('0xc')](0x4)['replace']('result=','');if(_0x2cb72a['indexOf']('\x20')!=-0x1){_0x2cb72a=_0x2cb72a[_0xbdcd('0x10')](0x0,_0x2cb72a[_0xbdcd('0x11')]('\x20'));}if(_[_0xbdcd('0x12')](_0x2cb72a,'-1')){_0x2cb72a=parseInt(_0x2cb72a);}_0x36a92b=_0x27f33c['rx'][_0xbdcd('0x13')]('\x20');if(_0x36a92b['length']==0x3){_0x36a92b=_0x36a92b[0x2][_0xbdcd('0xc')](0x1,_0x36a92b[0x2]['length']-0x1);}else if(_0x36a92b['length']>0x3){var _0x20a1d8=/\((.+)\)/;var _0x57d6ba=_0x27f33c['rx'][_0xbdcd('0x14')](_0x20a1d8);if(_0x57d6ba){_0x36a92b=_0x57d6ba[0x1];}else{_0x36a92b=null;}}else{_0x36a92b=null;}_0x27f33c['cb'](null,{'code':_0x42b559,'result':_0x2cb72a,'extra':_0x36a92b});}});_0x1ede78['on'](_0xbdcd('0x15'),function(_0x4b1d78){_0x3ec1c3[_0xbdcd('0x8')]('error',new AGIError(_0xbdcd('0x16'),_0x4b1d78[_0xbdcd('0x17')]));});_0x1ede78['on'](_0xbdcd('0x18'),function(){_0x3ec1c3[_0xbdcd('0x8')](_0xbdcd('0x18'),new AGIError(_0xbdcd('0x19')));});_0x1ede78['on']('timeout',function(){_0x3ec1c3[_0xbdcd('0x8')]('timeout',new AGIError(_0xbdcd('0x1a')));_0x1ede78[_0xbdcd('0x1b')]();});_0x1ede78[_0xbdcd('0x1c')](_0x309eb3);this[_0xbdcd('0x1d')]=function(_0x4be259,_0x24ced7){console[_0xbdcd('0x1e')](_0xbdcd('0x1f'),_0x4be259);var _0x4be259=_0x4be259||'',_0x24ced7=typeof _0x24ced7==_0xbdcd('0x20')?_0x24ced7:new Function();_0x27f33c={'tx':_0x4be259,'rx':'','cb':_0x24ced7};_0x1ede78[_0xbdcd('0x21')](_0x4be259+'\x0a');},this['close']=function(){_0x1ede78[_0xbdcd('0x1b')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x23')]=function(_0x5a4657){return this[_0xbdcd('0x1d')][_0xbdcd('0x24')](this,_0x5a4657);};AGIChannel[_0xbdcd('0x22')]['answer']=function(){return this['sendRequest'](_0xbdcd('0x25'));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x26')]=function(_0x3ad328,_0x3405ae,_0x221b11){_0x3ad328=_0x3ad328===undefined?_0xbdcd('0x27'):_0x3ad328;_0x3405ae=_0x3405ae===undefined?'5':_0x3405ae;_0x221b11=_0x221b11===undefined?'1':_0x221b11;return this['sendRequest'](util[_0xbdcd('0x28')](_0xbdcd('0x29'),_0x3ad328,_0x3405ae*0x3e8,_0x221b11));};AGIChannel['prototype'][_0xbdcd('0x2a')]=function(_0x2cf61f){_0x2cf61f=_0x2cf61f||_0xbdcd('0x2b');return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')](_0xbdcd('0x2c'),_0x2cf61f));};AGIChannel['prototype'][_0xbdcd('0x2d')]=function(_0x5e984a,_0x2b7bcb){if(_[_0xbdcd('0x2e')](_0x2b7bcb)){return this['sendRequest'](util[_0xbdcd('0x28')](_0xbdcd('0x2f'),_0x5e984a,_0x2b7bcb['join'](',')));}return this['sendRequest'](util[_0xbdcd('0x28')](_0xbdcd('0x2f'),_0x5e984a,_0x2b7bcb));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x30')]=function(_0x38d9cc){return this[_0xbdcd('0x23')](util['format'](_0xbdcd('0x31'),_0x38d9cc));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x32')]=function(_0x533f88){return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')](_0xbdcd('0x33'),_0x533f88));};AGIChannel[_0xbdcd('0x22')]['setPriority']=function(_0x24eca4){return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')]('SET\x20PRIORITY\x20%s',_0x24eca4));};AGIChannel['prototype'][_0xbdcd('0xb')]=function(){return this[_0xbdcd('0x23')](_0xbdcd('0x34'));};AGIChannel[_0xbdcd('0x22')]['setVariable']=function(_0x4c1253,_0x5d1e31){var _0x25776c=_['isBoolean'](_0x5d1e31)||_[_0xbdcd('0x35')](_0x5d1e31)?_0x5d1e31[_0xbdcd('0x36')]():_0x5d1e31;return this[_0xbdcd('0x23')](util['format'](_0xbdcd('0x37'),_0x4c1253,_0x25776c?_0x25776c[_0xbdcd('0x36')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x38')]=function(_0x4357be,_0x1fa632){return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')]('SAY\x20NUMBER\x20%s\x20%s',_0x4357be,_0x1fa632));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x39')]=function(_0x11bcd2,_0x2cd90d){return this['sendRequest'](util[_0xbdcd('0x28')](_0xbdcd('0x3a'),_0x11bcd2,_0x2cd90d));};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x3b')]=function(_0x2233aa,_0x1c8517){return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2233aa,_0x1c8517));};AGIChannel[_0xbdcd('0x22')]['continueAt']=function(_0x285d34,_0x2f9faf,_0x27d512){_0x2f9faf=_0x2f9faf||this[_0xbdcd('0x3c')];_0x27d512=_0x27d512||0x1;this['setContext'](_0x285d34);this[_0xbdcd('0x32')](_0x2f9faf);this[_0xbdcd('0x3d')](_0x27d512);return this['noop'](util['format'](_0xbdcd('0x3e'),_0x285d34,_0x2f9faf,_0x27d512));};AGIChannel['prototype'][_0xbdcd('0x3f')]=function(_0x1ec687){console[_0xbdcd('0x1e')](_0xbdcd('0x40'),_0x1ec687);return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x1ec687));};AGIChannel[_0xbdcd('0x22')]['recordFile']=function(_0x30e18a,_0x13df20,_0x7c9d75,_0x1497da,_0xa72d2e,_0x33fc09){_0x13df20=_0x13df20||_0xbdcd('0x41');_0x7c9d75=_0x7c9d75||'';_0x1497da=_0x1497da===undefined?-0x1:_0x1497da==='-1'?-0x1:_0x1497da*0x3e8;_0xa72d2e=_0xa72d2e===undefined?'':'s='+_0xa72d2e;_0x33fc09=_0x33fc09?_0xbdcd('0x42'):'';return this['sendRequest'](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x30e18a,_0x13df20,_0x7c9d75,_0x1497da,_0x33fc09,_0xa72d2e));};AGIChannel['prototype'][_0xbdcd('0x43')]=function(_0x2006cf,_0x184ce9){_0x184ce9=_0x184ce9||'';return this[_0xbdcd('0x23')](util[_0xbdcd('0x28')](_0xbdcd('0x44'),_0x2006cf,_0x184ce9));};AGIChannel['prototype'][_0xbdcd('0x45')]=function(_0x3376ca){return this['exec'](_0xbdcd('0x46'),_0x3376ca);};AGIChannel[_0xbdcd('0x22')][_0xbdcd('0x47')]=function(_0x4dc4f3){return this[_0xbdcd('0x2d')](_0xbdcd('0x48'),_0x4dc4f3);};AGIChannel['prototype'][_0xbdcd('0x15')]=function(_0x2ca1cf,_0x56a7f2){this[_0xbdcd('0x2a')](util[_0xbdcd('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2ca1cf['id'],_0x2ca1cf['label'],_0x56a7f2));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xbdcd('0x49')]=AGIChannel; \ No newline at end of file +var _0x82b7=['exec','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','getvariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','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','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','ready','line','toLowerCase','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','command=','write','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22'];(function(_0x2a557a,_0x585b4a){var _0x439f83=function(_0x23f445){while(--_0x23f445){_0x2a557a['push'](_0x2a557a['shift']());}};_0x439f83(++_0x585b4a);}(_0x82b7,0x111));var _0x782b=function(_0x57c91e,_0x4cad2a){_0x57c91e=_0x57c91e-0x0;var _0x158116=_0x82b7[_0x57c91e];return _0x158116;};'use strict';var util=require(_0x782b('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0x782b('0x1')];var AGIReply=require(_0x782b('0x2'));var AGIError=require(_0x782b('0x3'));function AGIChannel(_0x495f12){var _0x2b5024=this,_0x3b525c=new AGIReply(),_0x32d4fd=![],_0x4ba4b2={};EventEmitter[_0x782b('0x4')](_0x2b5024);_0x495f12['setEncoding'](_0x782b('0x5'));_0x495f12[_0x782b('0x6')](0x8*0x3c*0x3c*0x3e8);_0x3b525c[_0x782b('0x7')]('utf8');_0x3b525c['on'](_0x782b('0x8'),function(_0x587d6d){for(var _0x3cb7b7 in _0x587d6d){_0x2b5024[_0x3cb7b7]=_0x587d6d[_0x3cb7b7];}_0x2b5024['emit'](_0x782b('0x9'));});_0x3b525c['on'](_0x782b('0xa'),function(_0x30160d){if(_0x30160d[_0x782b('0xb')]()=='hangup'){_0x2b5024[_0x782b('0xc')]('hangup');return;}if(_0x30160d[_0x782b('0xd')](0x0,0xb)==_0x782b('0xe')){_0x32d4fd=!![];}if(_0x32d4fd){_0x4ba4b2['rx']+=_0x30160d+'\x0a';if(_0x30160d[_0x782b('0xf')](_0x782b('0x10'))!=-0x1){_0x32d4fd=![];}}else{_0x4ba4b2['rx']=_0x30160d;}if(_0x32d4fd){return;}if(typeof _0x4ba4b2['cb']==_0x782b('0x11')){var _0x1b95a3=_0x4ba4b2['rx'][_0x782b('0xd')](0x0,0x3),_0x523b5e=null,_0x3585ec=null;_0x1b95a3=parseInt(_0x1b95a3);if(isNaN(_0x1b95a3)){_0x4ba4b2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x782b('0x12')});return;}if(_0x1b95a3!=0xc8){_0x4ba4b2['cb'](null,{'code':_0x1b95a3,'result':-0x1,'extra':'KO'});return;}_0x523b5e=_0x4ba4b2['rx']['substring'](0x4)[_0x782b('0x13')](_0x782b('0x14'),'');if(_0x523b5e['indexOf']('\x20')!=-0x1){_0x523b5e=_0x523b5e[_0x782b('0x15')](0x0,_0x523b5e['indexOf']('\x20'));}if(_[_0x782b('0x16')](_0x523b5e,'-1')){_0x523b5e=parseInt(_0x523b5e);}_0x3585ec=_0x4ba4b2['rx'][_0x782b('0x17')]('\x20');if(_0x3585ec['length']==0x3){_0x3585ec=_0x3585ec[0x2]['substring'](0x1,_0x3585ec[0x2]['length']-0x1);}else if(_0x3585ec[_0x782b('0x18')]>0x3){var _0x39e2b4=/\((.+)\)/;var _0x3307fb=_0x4ba4b2['rx'][_0x782b('0x19')](_0x39e2b4);if(_0x3307fb){_0x3585ec=_0x3307fb[0x1];}else{_0x3585ec=null;}}else{_0x3585ec=null;}_0x4ba4b2['cb'](null,{'code':_0x1b95a3,'result':_0x523b5e,'extra':_0x3585ec});}});_0x495f12['on']('error',function(_0x3cadac){_0x2b5024['emit'](_0x782b('0x1a'),new AGIError(_0x782b('0x1b'),_0x3cadac['code']));});_0x495f12['on'](_0x782b('0x1c'),function(){_0x2b5024[_0x782b('0xc')]('close',new AGIError(_0x782b('0x1d')));});_0x495f12['on'](_0x782b('0x1e'),function(){_0x2b5024[_0x782b('0xc')](_0x782b('0x1e'),new AGIError(_0x782b('0x1f')));_0x495f12[_0x782b('0x20')]();});_0x495f12[_0x782b('0x21')](_0x3b525c);this[_0x782b('0x22')]=function(_0x51fb93,_0x542b57){console['log'](_0x782b('0x23'),_0x51fb93);var _0x51fb93=_0x51fb93||'',_0x542b57=typeof _0x542b57==_0x782b('0x11')?_0x542b57:new Function();_0x4ba4b2={'tx':_0x51fb93,'rx':'','cb':_0x542b57};_0x495f12[_0x782b('0x24')](_0x51fb93+'\x0a');},this[_0x782b('0x1c')]=function(){_0x495f12['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x782b('0x25')][_0x782b('0x26')]=function(_0x32296f){return this[_0x782b('0x22')][_0x782b('0x27')](this,_0x32296f);};AGIChannel[_0x782b('0x25')][_0x782b('0x28')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x782b('0x25')][_0x782b('0x29')]=function(_0x578c5b,_0x682056,_0x4b4490){_0x578c5b=_0x578c5b===undefined?_0x782b('0x2a'):_0x578c5b;_0x682056=_0x682056===undefined?'5':_0x682056;_0x4b4490=_0x4b4490===undefined?'1':_0x4b4490;return this['sendRequest'](util[_0x782b('0x2b')](_0x782b('0x2c'),_0x578c5b,_0x682056*0x3e8,_0x4b4490));};AGIChannel[_0x782b('0x25')]['noop']=function(_0x328202){_0x328202=_0x328202||_0x782b('0x2d');return this['sendRequest'](util[_0x782b('0x2b')](_0x782b('0x2e'),_0x328202));};AGIChannel['prototype'][_0x782b('0x2f')]=function(_0x135f41,_0x1503ef){if(_['isArray'](_0x1503ef)){return this[_0x782b('0x26')](util[_0x782b('0x2b')]('EXEC\x20%s\x20%s',_0x135f41,_0x1503ef['join'](',')));}return this[_0x782b('0x26')](util[_0x782b('0x2b')]('EXEC\x20%s\x20%s',_0x135f41,_0x1503ef));};AGIChannel[_0x782b('0x25')][_0x782b('0x30')]=function(_0xb26d5){return this[_0x782b('0x26')](util['format'](_0x782b('0x31'),_0xb26d5));};AGIChannel[_0x782b('0x25')][_0x782b('0x32')]=function(_0x54bfb9){return this[_0x782b('0x26')](util['format'](_0x782b('0x33'),_0x54bfb9));};AGIChannel[_0x782b('0x25')][_0x782b('0x34')]=function(_0x343d67){return this[_0x782b('0x26')](util['format'](_0x782b('0x35'),_0x343d67));};AGIChannel[_0x782b('0x25')]['hangup']=function(){return this[_0x782b('0x26')](_0x782b('0x36'));};AGIChannel['prototype']['setVariable']=function(_0x39cb0e,_0x39349e){var _0x5ec1d6=_[_0x782b('0x37')](_0x39349e)||_['isNumber'](_0x39349e)?_0x39349e[_0x782b('0x38')]():_0x39349e;return this['sendRequest'](util['format'](_0x782b('0x39'),_0x39cb0e,_0x5ec1d6?_0x5ec1d6[_0x782b('0x38')]()[_0x782b('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x782b('0x3a')]=function(_0x5a3af6,_0xe3db5f){return this[_0x782b('0x26')](util[_0x782b('0x2b')]('SAY\x20NUMBER\x20%s\x20%s',_0x5a3af6,_0xe3db5f));};AGIChannel[_0x782b('0x25')][_0x782b('0x3b')]=function(_0x4cbec2,_0x4f2ed3){return this[_0x782b('0x26')](util[_0x782b('0x2b')](_0x782b('0x3c'),_0x4cbec2,_0x4f2ed3));};AGIChannel[_0x782b('0x25')][_0x782b('0x3d')]=function(_0x267e19,_0x2a2804){return this[_0x782b('0x26')](util['format'](_0x782b('0x3e'),_0x267e19,_0x2a2804));};AGIChannel[_0x782b('0x25')]['continueAt']=function(_0x58751d,_0x2a0453,_0x48c466){_0x2a0453=_0x2a0453||this[_0x782b('0x3f')];_0x48c466=_0x48c466||0x1;this[_0x782b('0x30')](_0x58751d);this[_0x782b('0x32')](_0x2a0453);this['setPriority'](_0x48c466);return this[_0x782b('0x40')](util[_0x782b('0x2b')](_0x782b('0x41'),_0x58751d,_0x2a0453,_0x48c466));};AGIChannel['prototype'][_0x782b('0x42')]=function(_0x575a7d){console['log'](_0x782b('0x43'),_0x575a7d);return this[_0x782b('0x26')](util[_0x782b('0x2b')](_0x782b('0x44'),_0x575a7d));};AGIChannel[_0x782b('0x25')][_0x782b('0x45')]=function(_0x2b8839,_0x178895,_0x3c12aa,_0x1657e,_0x20a08a,_0x5460ff){_0x178895=_0x178895||'wav';_0x3c12aa=_0x3c12aa||'';_0x1657e=_0x1657e===undefined?-0x1:_0x1657e==='-1'?-0x1:_0x1657e*0x3e8;_0x20a08a=_0x20a08a===undefined?'':'s='+_0x20a08a;_0x5460ff=_0x5460ff?_0x782b('0x46'):'';return this[_0x782b('0x26')](util[_0x782b('0x2b')](_0x782b('0x47'),_0x2b8839,_0x178895,_0x3c12aa,_0x1657e,_0x5460ff,_0x20a08a));};AGIChannel[_0x782b('0x25')]['streamFile']=function(_0x159b50,_0x4a65af){_0x4a65af=_0x4a65af||'';return this[_0x782b('0x26')](util[_0x782b('0x2b')](_0x782b('0x48'),_0x159b50,_0x4a65af));};AGIChannel['prototype'][_0x782b('0x49')]=function(_0x2f7ced){return this[_0x782b('0x2f')](_0x782b('0x4a'),_0x2f7ced);};AGIChannel[_0x782b('0x25')][_0x782b('0x4b')]=function(_0x452d07){return this[_0x782b('0x2f')](_0x782b('0x4c'),_0x452d07);};AGIChannel['prototype'][_0x782b('0x1a')]=function(_0x40d47a,_0x64fd73){this[_0x782b('0x40')](util[_0x782b('0x2b')](_0x782b('0x4d'),_0x40d47a['id'],_0x40d47a[_0x782b('0x4e')],_0x64fd73));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x782b('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 3bff1de..9d6d8a4 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 _0x60c2=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','Undefined\x20error.'];(function(_0x280905,_0x362610){var _0x211dab=function(_0x5dcb13){while(--_0x5dcb13){_0x280905['push'](_0x280905['shift']());}};_0x211dab(++_0x362610);}(_0x60c2,0x8f));var _0x260c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x60c2[_0x17d9e3];return _0x14192d;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x260c('0x0'),'E_AGI_ARGUMENT_PORT':_0x260c('0x1'),'E_AGI_SERVER_ERROR':_0x260c('0x2'),'E_AGI_SERVER_CLOSE':_0x260c('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x260c('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x260c('0x5'),'E_AGI_SOCKET_ERROR':_0x260c('0x6'),'E_AGI_SOCKET_CLOSE':_0x260c('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x260c('0x8'),'E_AGI_COMMAND_EMPTY':_0x260c('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x260c('0xa'),'E_AGI_IVR_ENTRY':_0x260c('0xb')};function AGIError(_0x558b0c){var _0x558b0c=_0x558b0c||null,_0x2c2cd8=_0x2c2cd8||[],_0x3b432d=0x1,_0xf22c37='';if(!error[_0x558b0c]){_0x558b0c='E_AGI_UNDEFINED';}_0x2c2cd8[_0x260c('0xc')](error[_0x558b0c]);while(arguments[_0x3b432d]){_0x2c2cd8[_0x260c('0xc')](arguments[_0x3b432d]);_0x3b432d++;}_0xf22c37=util[_0x260c('0xd')][_0x260c('0xe')](util,_0x2c2cd8);this[_0x260c('0xf')]=_0xf22c37;this[_0x260c('0x10')]=_0x558b0c;}module[_0x260c('0x11')]=AGIError; \ No newline at end of file +var _0xeb79=['push','format','apply','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeb79,0x87));var _0x9eb7=function(_0xa61f52,_0xabc2af){_0xa61f52=_0xa61f52-0x0;var _0x31ab39=_0xeb79[_0xa61f52];return _0x31ab39;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x9eb7('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x9eb7('0x1'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x9eb7('0x2'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x9eb7('0x3'),'E_AGI_SOCKET_TIMEOUT':_0x9eb7('0x4'),'E_AGI_COMMAND_EMPTY':_0x9eb7('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9eb7('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x501d0c){var _0x501d0c=_0x501d0c||null,_0x5ae8e6=_0x5ae8e6||[],_0x152a72=0x1,_0x127fb9='';if(!error[_0x501d0c]){_0x501d0c=_0x9eb7('0x7');}_0x5ae8e6[_0x9eb7('0x8')](error[_0x501d0c]);while(arguments[_0x152a72]){_0x5ae8e6[_0x9eb7('0x8')](arguments[_0x152a72]);_0x152a72++;}_0x127fb9=util[_0x9eb7('0x9')][_0x9eb7('0xa')](util,_0x5ae8e6);this['message']=_0x127fb9;this[_0x9eb7('0xb')]=_0x501d0c;}module[_0x9eb7('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index b06b3eb..feccc6e 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 _0x7d25=['includes','condition\x20not\x20found','exports','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addEdge','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','condition','length','agicommand','target','invalid','default\x20on\x20switch\x20not\x20found'];(function(_0x894278,_0x260254){var _0x4086fd=function(_0x482d15){while(--_0x482d15){_0x894278['push'](_0x894278['shift']());}};_0x4086fd(++_0x260254);}(_0x7d25,0x8a));var _0x57d2=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x7d25[_0x40a825];return _0x273a54;};'use strict';var _=require('lodash');var logger=require(_0x57d2('0x0'))(_0x57d2('0x1'));var verticesWithRetry=[_0x57d2('0x2'),_0x57d2('0x3'),_0x57d2('0x4')];var Graph=function(){this[_0x57d2('0x5')]={};this[_0x57d2('0x6')]={};this['numberOfEdges']=0x0;};Graph['prototype']['addVertex']=function(_0x5dea84){this[_0x57d2('0x5')][_0x5dea84['id']]=_0x5dea84;this['edges'][_0x5dea84['id']]=[];};Graph[_0x57d2('0x7')][_0x57d2('0x8')]=function(_0x147194,_0x59ae87,_0x49e3e5){this[_0x57d2('0x6')][_0x147194]['push']({'target':_0x59ae87,'condition':_0x49e3e5});this[_0x57d2('0x9')]+=0x1;};Graph[_0x57d2('0x7')][_0x57d2('0xa')]=function(){return _['size'](this[_0x57d2('0x5')]);};Graph[_0x57d2('0x7')][_0x57d2('0xb')]=function(){return this[_0x57d2('0x9')];};Graph[_0x57d2('0x7')][_0x57d2('0xc')]=function(_0xe8357c){return this[_0x57d2('0x5')][_0xe8357c];};Graph[_0x57d2('0x7')][_0x57d2('0xd')]=function(_0x28428b,_0x3181ad){if(!this[_0x57d2('0x5')][_0x28428b]){return logger[_0x57d2('0xe')](_0x57d2('0xf'));}var _0x4086f3=_0x3181ad(this['vertices'][_0x28428b]);if(!_0x4086f3){return logger['info'](_0x57d2('0x10'));}if(this[_0x57d2('0x6')][_0x28428b]['length']===0x0){return logger[_0x57d2('0xe')](_0x57d2('0x11'));}for(var _0x4bb8f7=0x0,_0x3e12c6=[],_0x4986ad=![];_0x4bb8f7\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','SQUAREROOT','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','traverseBFS','clear','vertex','VERTEX','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','result','toString','agicommand\x20not\x20found','finally','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','value','getSquareProject','catch'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xf1a7,0x8f));var _0x7f1a=function(_0x1221a5,_0x52a8ae){_0x1221a5=_0x1221a5-0x0;var _0x3dd82b=_0xf1a7[_0x1221a5];return _0x3dd82b;};'use strict';var parser=require('xml2json');var _=require(_0x7f1a('0x0'));var syncho=require('syncho');var util=require(_0x7f1a('0x1'));var moment=require(_0x7f1a('0x2'));var config=require(_0x7f1a('0x3'));var logger=require(_0x7f1a('0x4'))(_0x7f1a('0x5'));var utilLicense=require(_0x7f1a('0x6'));var rpc=require(_0x7f1a('0x7'));var mailRpc=require(_0x7f1a('0x8'));var Graph=require(_0x7f1a('0x9'));var Vertices=require(_0x7f1a('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7f1a('0x5')]=_['defaults'](config[_0x7f1a('0x5')],{'ip':_0x7f1a('0xb'),'port':0x11dd});function connectionHandler(_0x213f7e){process[_0x7f1a('0xc')](function(){syncho(function(){try{setChannelVariables(_0x213f7e);agiHandler(_0x213f7e);}catch(_0x2197f3){logger[_0x7f1a('0xd')](_0x2197f3[_0x7f1a('0xe')]);}});});}function listeningHandler(){console[_0x7f1a('0xf')](_0x7f1a('0x10'),config[_0x7f1a('0x5')][_0x7f1a('0x11')]);logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x14'),config['agi']['ip'],config[_0x7f1a('0x5')][_0x7f1a('0x11')]));}function errorHandler(_0x39865){if(_0x39865&&_0x39865[_0x7f1a('0x15')]&&_0x39865[_0x7f1a('0x16')]){logger['error'](util['format']('[%s]\x20%s',_0x39865[_0x7f1a('0x15')],_0x39865['message']));}else{logger[_0x7f1a('0xd')](util[_0x7f1a('0x13')]('[ERROR]\x20%s',_0x39865[_0x7f1a('0xe')]));}}function closeHandler(){logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x17'),this[_0x7f1a('0x18')],this[_0x7f1a('0x19')],this[_0x7f1a('0x1a')],this[_0x7f1a('0x1b')],this[_0x7f1a('0x1c')]));try{createSquareReport(this);}catch(_0x110ddf){logger[_0x7f1a('0xd')](_0x110ddf['stack']);}}function timeoutHandler(){logger['info'](util[_0x7f1a('0x13')](_0x7f1a('0x1d'),this[_0x7f1a('0x18')],this[_0x7f1a('0x19')],this['callerid'],this[_0x7f1a('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x1e'),this[_0x7f1a('0x18')],this[_0x7f1a('0x19')],this[_0x7f1a('0x1a')],this[_0x7f1a('0x1b')],this['uniqueid']));this[_0x7f1a('0x1f')]=!![];}function getRoot(_0x177f70){return parser[_0x7f1a('0x20')](_0x177f70,{'object':!![]})[_0x7f1a('0x21')][_0x7f1a('0x22')];}function addVertex(_0x5b3c63,_0x3e4055,_0x5be3e5){_0x3e4055['agicommand']=_0x5be3e5;if(_0x3e4055[_0x7f1a('0x23')](_0x7f1a('0x24'))){_0x3e4055[_0x7f1a('0x25')]=parseInt(_0x3e4055[_0x7f1a('0x24')],0xa);}_0x5b3c63[_0x7f1a('0x26')](_['omit'](_0x3e4055,_0x7f1a('0x27')));}function initGraph(_0x9b985c,_0x229a98){var _0x415082=new Graph();for(var _0x560b66 in _0x9b985c){if(_0x9b985c[_0x7f1a('0x23')](_0x560b66)){if(_[_0x7f1a('0x28')](_0x9b985c[_0x560b66])){for(var _0x968932=0x0;_0x968932<_0x9b985c[_0x560b66][_0x7f1a('0x29')];_0x968932+=0x1){addVertex(_0x415082,_0x9b985c[_0x560b66][_0x968932],_0x560b66);}}else{addVertex(_0x415082,_0x9b985c[_0x560b66],_0x560b66);}}}for(var _0x466314=0x0;_0x466314<_0x229a98[_0x7f1a('0x29')];_0x466314+=0x1){if(_0x229a98[_0x466314][_0x7f1a('0x2a')]&&_0x229a98[_0x466314][_0x7f1a('0x2b')]){_0x415082['addEdge'](_0x229a98[_0x466314][_0x7f1a('0x2a')],_0x229a98[_0x466314][_0x7f1a('0x2b')],_0x229a98[_0x466314][_0x7f1a('0x2c')]);}}return _0x415082;}function getSquareProject(_0x2bcdf4,_0x29040f){rpc[_0x7f1a('0x2d')](_0x2bcdf4)['then'](function(_0x2fe5ab){_0x29040f(null,_0x2fe5ab);})[_0x7f1a('0x2e')](function(_0xbc4616){_0x29040f(null,_0xbc4616);});}function createSquareReport(_0x1667f3,_0xb4d5f8){rpc['createSquareReport'](_0x1667f3)[_0x7f1a('0x2f')](function(_0x3dcabc){if(_0xb4d5f8){_0xb4d5f8(null,_0x3dcabc);}})[_0x7f1a('0x2e')](function(_0x28105c){if(_0xb4d5f8){_0xb4d5f8(null,_0x28105c);}});}function setChannelVariables(_0x1a8d18){for(var _0x130e40 in _0x1a8d18){if(_0x1a8d18[_0x7f1a('0x23')](_0x130e40)){if(_0x130e40[_0x7f1a('0x30')](_0x7f1a('0x31'))===0x0){_0x1a8d18[_0x130e40['substring'](0x4)]=_0x1a8d18[_0x130e40];delete _0x1a8d18[_0x130e40];}}}}function getLogFromObject(_0x595cd2){return util[_0x7f1a('0x32')](_0x595cd2,{'showHidden':![],'depth':null});}function agiHandler(_0x5ae2a5){var _0x240b28,_0x5a0b44,_0x330f2f,_0x156a2e,_0x5c936b;logger[_0x7f1a('0x33')](_0x7f1a('0x34'),JSON['stringify'](_0x5ae2a5,null,0x2));logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x35'),_0x5ae2a5[_0x7f1a('0x18')],_0x5ae2a5[_0x7f1a('0x19')],_0x5ae2a5[_0x7f1a('0x1a')],_0x5ae2a5[_0x7f1a('0x1b')],_0x5ae2a5['uniqueid']));_0x5ae2a5['on'](_0x7f1a('0xd'),errorHandler);_0x5ae2a5['on'](_0x7f1a('0x36'),closeHandler);_0x5ae2a5['on'](_0x7f1a('0x37'),timeoutHandler);_0x5ae2a5[_0x7f1a('0x1f')]=![];_0x5ae2a5['on'](_0x7f1a('0x38'),hangupHandler);var _0x130174=getSquareProject[_0x7f1a('0x39')](null,_0x5ae2a5[_0x7f1a('0x18')]);if(_0x130174){if(_0x130174[_0x7f1a('0x3a')]){_0x240b28=getRoot(_0x130174['production']);console[_0x7f1a('0xf')](_0x7f1a('0x3b'),_0x240b28);if(_0x240b28&&_0x240b28[_0x7f1a('0x3c')]){logger[_0x7f1a('0x33')](_0x7f1a('0x22'),JSON[_0x7f1a('0x3d')](_0x240b28,null,0x2));_0x5ae2a5[_0x7f1a('0x3e')]=moment()[_0x7f1a('0x13')](_0x7f1a('0x3f'));_0x5a0b44=initGraph(_[_0x7f1a('0x40')](_0x240b28,_0x7f1a('0x27')),_0x240b28[_0x7f1a('0x27')]);_0x330f2f=new Vertices(_0x5ae2a5,rpc,mailRpc);console[_0x7f1a('0xf')](_0x7f1a('0x41'),_0x330f2f);logger['info'](util[_0x7f1a('0x13')](_0x7f1a('0x42'),_0x5ae2a5[_0x7f1a('0x18')],_0x5ae2a5[_0x7f1a('0x19')],_0x5ae2a5['callerid'],_0x5ae2a5['dnid'],_0x5ae2a5['uniqueid']));console['log'](_0x7f1a('0x43'));_0x5a0b44[_0x7f1a('0x44')](_0x240b28[_0x7f1a('0x3c')]['id'],function(_0x5a8fe2){try{_0x5a8fe2=_0x330f2f[_0x7f1a('0x45')](_0x5a8fe2);logger[_0x7f1a('0x33')](_0x7f1a('0x46'),JSON[_0x7f1a('0x3d')](_0x5a8fe2,null,0x2));console[_0x7f1a('0xf')](_0x7f1a('0x47'),_0x5a8fe2);if(_0x5a8fe2[_0x7f1a('0x48')]==='gotoc'){logger[_0x7f1a('0x12')](_0x7f1a('0x49'));_0x5ae2a5[_0x7f1a('0x4a')]=_0x5a8fe2[_0x7f1a('0x4a')]||_0x5ae2a5[_0x7f1a('0x4a')];_0x5ae2a5['extension']=_0x5a8fe2[_0x7f1a('0x4b')];_0x5ae2a5['priority']=_0x5a8fe2[_0x7f1a('0x4c')]?_0x5a8fe2[_0x7f1a('0x4c')]-0x1:0x1;return null;}else if(_0x5a8fe2&&_0x330f2f[_0x5a8fe2[_0x7f1a('0x48')]]){_0x5c936b=_0x330f2f[_0x5a8fe2['agicommand']](_0x5a8fe2);console[_0x7f1a('0xf')](_0x7f1a('0x4d'),_0x5c936b);logger[_0x7f1a('0x12')](_0x7f1a('0x4e'),JSON[_0x7f1a('0x3d')](_0x5c936b,null,0x2));if(_0x5c936b&&_0x5c936b['code']===AGI_CODE_SUCCESS&&_0x5c936b[_0x7f1a('0x4f')]!==AGI_RESULT_ERROR&&!_0x5ae2a5[_0x7f1a('0x1f')]){logger[_0x7f1a('0x33')]('response',getLogFromObject(_0x5c936b));return _['isUndefined'](_0x5c936b[_0x7f1a('0x4f')])?null:_0x5c936b[_0x7f1a('0x4f')][_0x7f1a('0x50')]();}else{logger[_0x7f1a('0xd')]('response',getLogFromObject(_0x5c936b));return null;}}else{logger['error'](_0x7f1a('0x51'));return null;}}catch(_0x28af44){logger[_0x7f1a('0xd')](_0x28af44[_0x7f1a('0xe')]);return null;}});if(_0x240b28[_0x7f1a('0x52')]){logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5ae2a5[_0x7f1a('0x18')],_0x5ae2a5[_0x7f1a('0x19')],_0x5ae2a5[_0x7f1a('0x1a')],_0x5ae2a5[_0x7f1a('0x1b')],_0x5ae2a5[_0x7f1a('0x1c')]));_0x5a0b44[_0x7f1a('0x44')](_0x240b28[_0x7f1a('0x52')]['id'],function(_0x55453b){try{_0x55453b=_0x330f2f[_0x7f1a('0x45')](_0x55453b);logger[_0x7f1a('0x33')](_0x7f1a('0x46'),JSON[_0x7f1a('0x3d')](_0x55453b,null,0x2));if(_0x55453b&&_0x330f2f[_0x55453b[_0x7f1a('0x48')]]){_0x5c936b=_0x330f2f[_0x55453b[_0x7f1a('0x48')]](_0x55453b);if(_0x5c936b){logger[_0x7f1a('0x33')](_0x7f1a('0x4e'),getLogFromObject(_0x5c936b));return _[_0x7f1a('0x53')](_0x5c936b[_0x7f1a('0x4f')])?null:_0x5c936b['result'][_0x7f1a('0x50')]();}else{logger[_0x7f1a('0xd')](_0x7f1a('0x4e'),getLogFromObject(_0x5c936b));return null;}}else{logger[_0x7f1a('0xd')](_0x7f1a('0x51'));return null;}}catch(_0xe099a1){logger[_0x7f1a('0xd')](_0xe099a1[_0x7f1a('0xe')]);return null;}});}logger[_0x7f1a('0x12')](util['format'](_0x7f1a('0x54'),_0x5ae2a5[_0x7f1a('0x18')],_0x5ae2a5[_0x7f1a('0x19')],_0x5ae2a5[_0x7f1a('0x1a')],_0x5ae2a5[_0x7f1a('0x1b')],_0x5ae2a5['uniqueid']));logger[_0x7f1a('0x12')](util[_0x7f1a('0x13')](_0x7f1a('0x55'),_0x5ae2a5[_0x7f1a('0x4a')],_0x5ae2a5[_0x7f1a('0x4b')],parseInt(_0x5ae2a5[_0x7f1a('0x4c')],0xa)+0x1));_0x5ae2a5[_0x7f1a('0x56')](_0x5ae2a5['context'],_0x5ae2a5[_0x7f1a('0x4b')],parseInt(_0x5ae2a5['priority'],0xa)+0x1);_0x5ae2a5[_0x7f1a('0x36')]();}}else{logger[_0x7f1a('0xd')](util[_0x7f1a('0x13')]('Project\x20%s\x20not\x20published',_0x5ae2a5[_0x7f1a('0x18')]));_0x5ae2a5['continueAt'](_0x5ae2a5[_0x7f1a('0x4a')],_0x5ae2a5[_0x7f1a('0x4b')],parseInt(_0x5ae2a5[_0x7f1a('0x4c')],0xa)+0x1);_0x5ae2a5[_0x7f1a('0x36')]();}}else{logger['error'](util[_0x7f1a('0x13')]('Project\x20%s\x20not\x20found',_0x5ae2a5['arg_1']));_0x5ae2a5['continueAt'](_0x5ae2a5[_0x7f1a('0x4a')],_0x5ae2a5[_0x7f1a('0x4b')],parseInt(_0x5ae2a5['priority'],0xa)+0x1);_0x5ae2a5[_0x7f1a('0x36')]();}}function main(){var _0x129587;return utilLicense[_0x7f1a('0x57')]()[_0x7f1a('0x2f')](function(_0x5e7224){if(_0x5e7224){if(_0x5e7224[_0x7f1a('0x58')]){if(_0x5e7224['callysquare']&&_0x5e7224[_0x7f1a('0x59')]>0x0){logger['info'](util[_0x7f1a('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5e7224[_0x7f1a('0x59')]));_0x129587=_0x5e7224[_0x7f1a('0x59')];}else{logger['info'](_0x7f1a('0x5a'));}}else{logger[_0x7f1a('0x12')](_0x7f1a('0x5b'));_0x129587=-0x1;}}})[_0x7f1a('0x2e')](function(_0x26ac9e){logger[_0x7f1a('0xd')](_0x7f1a('0x5c'),_0x26ac9e[_0x7f1a('0xe')]);})[_0x7f1a('0x52')](function(){var _0x2b46c9=require(_0x7f1a('0x5d'))(config['agi'][_0x7f1a('0x11')],config[_0x7f1a('0x5')]['ip'],_0x129587);_0x2b46c9['on'](_0x7f1a('0xd'),errorHandler);_0x2b46c9['on']('listening',listeningHandler);_0x2b46c9['on'](_0x7f1a('0x5e'),connectionHandler);_0x2b46c9['on'](_0x7f1a('0x36'),closeHandler);});}main(); \ No newline at end of file +var _0x1e8c=['isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[%s]\x20%s','name','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','catch','createSquareReport','then','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','SQUAREROOT','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','LOOP\x20through\x20graph','start','clear','vertex','VERTEX','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','response','code','result'];(function(_0x42add0,_0x40f641){var _0x5ef7b4=function(_0x42ed02){while(--_0x42ed02){_0x42add0['push'](_0x42add0['shift']());}};_0x5ef7b4(++_0x40f641);}(_0x1e8c,0xd3));var _0xc1e8=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0x1e8c[_0x1c73ee];return _0x154f05;};'use strict';var parser=require('xml2json');var _=require(_0xc1e8('0x0'));var syncho=require(_0xc1e8('0x1'));var util=require(_0xc1e8('0x2'));var moment=require(_0xc1e8('0x3'));var config=require(_0xc1e8('0x4'));var logger=require(_0xc1e8('0x5'))('agi');var utilLicense=require(_0xc1e8('0x6'));var rpc=require(_0xc1e8('0x7'));var mailRpc=require(_0xc1e8('0x8'));var Graph=require(_0xc1e8('0x9'));var Vertices=require(_0xc1e8('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xc1e8('0xb')]=_['defaults'](config[_0xc1e8('0xb')],{'ip':_0xc1e8('0xc'),'port':0x11dd});function connectionHandler(_0x3b5001){process[_0xc1e8('0xd')](function(){syncho(function(){try{setChannelVariables(_0x3b5001);agiHandler(_0x3b5001);}catch(_0x46c1c7){logger[_0xc1e8('0xe')](_0x46c1c7[_0xc1e8('0xf')]);}});});}function listeningHandler(){console[_0xc1e8('0x10')](_0xc1e8('0x11'),config['agi'][_0xc1e8('0x12')]);logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')](_0xc1e8('0x15'),config[_0xc1e8('0xb')]['ip'],config[_0xc1e8('0xb')][_0xc1e8('0x12')]));}function errorHandler(_0x2e2a05){if(_0x2e2a05&&_0x2e2a05['name']&&_0x2e2a05[_0xc1e8('0x16')]){logger[_0xc1e8('0xe')](util[_0xc1e8('0x14')](_0xc1e8('0x17'),_0x2e2a05[_0xc1e8('0x18')],_0x2e2a05[_0xc1e8('0x16')]));}else{logger[_0xc1e8('0xe')](util['format'](_0xc1e8('0x19'),_0x2e2a05[_0xc1e8('0xf')]));}}function closeHandler(){logger['info'](util['format'](_0xc1e8('0x1a'),this[_0xc1e8('0x1b')],this[_0xc1e8('0x1c')],this[_0xc1e8('0x1d')],this[_0xc1e8('0x1e')],this['uniqueid']));try{createSquareReport(this);}catch(_0x126d90){logger[_0xc1e8('0xe')](_0x126d90[_0xc1e8('0xf')]);}}function timeoutHandler(){logger['info'](util[_0xc1e8('0x14')](_0xc1e8('0x1f'),this[_0xc1e8('0x1b')],this[_0xc1e8('0x1c')],this[_0xc1e8('0x1d')],this['dnid'],this[_0xc1e8('0x20')]));}function hangupHandler(){logger['info'](util['format'](_0xc1e8('0x21'),this[_0xc1e8('0x1b')],this[_0xc1e8('0x1c')],this[_0xc1e8('0x1d')],this[_0xc1e8('0x1e')],this[_0xc1e8('0x20')]));this[_0xc1e8('0x22')]=!![];}function getRoot(_0x6f05e1){return parser[_0xc1e8('0x23')](_0x6f05e1,{'object':!![]})[_0xc1e8('0x24')][_0xc1e8('0x25')];}function addVertex(_0x3e8e99,_0x172712,_0x498b86){_0x172712[_0xc1e8('0x26')]=_0x498b86;if(_0x172712[_0xc1e8('0x27')](_0xc1e8('0x28'))){_0x172712[_0xc1e8('0x29')]=parseInt(_0x172712[_0xc1e8('0x28')],0xa);}_0x3e8e99[_0xc1e8('0x2a')](_[_0xc1e8('0x2b')](_0x172712,'mxCell'));}function initGraph(_0x10af8c,_0x3e4af0){var _0x5da3b7=new Graph();for(var _0x55f214 in _0x10af8c){if(_0x10af8c['hasOwnProperty'](_0x55f214)){if(_[_0xc1e8('0x2c')](_0x10af8c[_0x55f214])){for(var _0x116682=0x0;_0x116682<_0x10af8c[_0x55f214][_0xc1e8('0x2d')];_0x116682+=0x1){addVertex(_0x5da3b7,_0x10af8c[_0x55f214][_0x116682],_0x55f214);}}else{addVertex(_0x5da3b7,_0x10af8c[_0x55f214],_0x55f214);}}}for(var _0x5761a5=0x0;_0x5761a5<_0x3e4af0[_0xc1e8('0x2d')];_0x5761a5+=0x1){if(_0x3e4af0[_0x5761a5][_0xc1e8('0x2e')]&&_0x3e4af0[_0x5761a5][_0xc1e8('0x2f')]){_0x5da3b7['addEdge'](_0x3e4af0[_0x5761a5]['source'],_0x3e4af0[_0x5761a5][_0xc1e8('0x2f')],_0x3e4af0[_0x5761a5]['value']);}}return _0x5da3b7;}function getSquareProject(_0x450fd2,_0x16ada4){rpc['getSquareProject'](_0x450fd2)['then'](function(_0x23a4d8){_0x16ada4(null,_0x23a4d8);})[_0xc1e8('0x30')](function(_0x5c5c92){_0x16ada4(null,_0x5c5c92);});}function createSquareReport(_0x5c0316,_0x3a2fc2){rpc[_0xc1e8('0x31')](_0x5c0316)[_0xc1e8('0x32')](function(_0x113256){if(_0x3a2fc2){_0x3a2fc2(null,_0x113256);}})[_0xc1e8('0x30')](function(_0x2cc7aa){if(_0x3a2fc2){_0x3a2fc2(null,_0x2cc7aa);}});}function setChannelVariables(_0x3bcff5){for(var _0x212623 in _0x3bcff5){if(_0x3bcff5[_0xc1e8('0x27')](_0x212623)){if(_0x212623[_0xc1e8('0x33')](_0xc1e8('0x34'))===0x0){_0x3bcff5[_0x212623[_0xc1e8('0x35')](0x4)]=_0x3bcff5[_0x212623];delete _0x3bcff5[_0x212623];}}}}function getLogFromObject(_0x35cea7){return util['inspect'](_0x35cea7,{'showHidden':![],'depth':null});}function agiHandler(_0x280d14){var _0x18495e,_0x5aa14e,_0x549d68,_0x29e09a,_0x487e71;logger[_0xc1e8('0x36')](_0xc1e8('0x37'),JSON[_0xc1e8('0x38')](_0x280d14,null,0x2));logger['info'](util['format'](_0xc1e8('0x39'),_0x280d14['arg_1'],_0x280d14[_0xc1e8('0x1c')],_0x280d14['callerid'],_0x280d14['dnid'],_0x280d14[_0xc1e8('0x20')]));_0x280d14['on'](_0xc1e8('0xe'),errorHandler);_0x280d14['on'](_0xc1e8('0x3a'),closeHandler);_0x280d14['on'](_0xc1e8('0x3b'),timeoutHandler);_0x280d14[_0xc1e8('0x22')]=![];_0x280d14['on']('hangup',hangupHandler);var _0x5be106=getSquareProject[_0xc1e8('0x3c')](null,_0x280d14['arg_1']);if(_0x5be106){if(_0x5be106[_0xc1e8('0x3d')]){_0x18495e=getRoot(_0x5be106[_0xc1e8('0x3d')]);console[_0xc1e8('0x10')](_0xc1e8('0x3e'),_0x18495e);if(_0x18495e&&_0x18495e['start']){logger['debug']('root',JSON[_0xc1e8('0x38')](_0x18495e,null,0x2));_0x280d14[_0xc1e8('0x3f')]=moment()[_0xc1e8('0x14')](_0xc1e8('0x40'));_0x5aa14e=initGraph(_[_0xc1e8('0x2b')](_0x18495e,_0xc1e8('0x41')),_0x18495e['mxCell']);_0x549d68=new Vertices(_0x280d14,rpc,mailRpc);console['log']('vertices',_0x549d68);logger[_0xc1e8('0x13')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x280d14[_0xc1e8('0x1b')],_0x280d14[_0xc1e8('0x1c')],_0x280d14[_0xc1e8('0x1d')],_0x280d14[_0xc1e8('0x1e')],_0x280d14[_0xc1e8('0x20')]));console['log'](_0xc1e8('0x42'));_0x5aa14e['traverseBFS'](_0x18495e[_0xc1e8('0x43')]['id'],function(_0x2484c5){try{_0x2484c5=_0x549d68[_0xc1e8('0x44')](_0x2484c5);logger[_0xc1e8('0x36')](_0xc1e8('0x45'),JSON[_0xc1e8('0x38')](_0x2484c5,null,0x2));console[_0xc1e8('0x10')](_0xc1e8('0x46'),_0x2484c5);if(_0x2484c5[_0xc1e8('0x26')]===_0xc1e8('0x47')){logger['info'](_0xc1e8('0x48'));_0x280d14[_0xc1e8('0x49')]=_0x2484c5[_0xc1e8('0x49')]||_0x280d14[_0xc1e8('0x49')];_0x280d14[_0xc1e8('0x4a')]=_0x2484c5['extension'];_0x280d14[_0xc1e8('0x4b')]=_0x2484c5[_0xc1e8('0x4b')]?_0x2484c5[_0xc1e8('0x4b')]-0x1:0x1;return null;}else if(_0x2484c5&&_0x549d68[_0x2484c5[_0xc1e8('0x26')]]){_0x487e71=_0x549d68[_0x2484c5['agicommand']](_0x2484c5);console[_0xc1e8('0x10')](_0xc1e8('0x4c'),_0x487e71);logger[_0xc1e8('0x13')](_0xc1e8('0x4d'),JSON['stringify'](_0x487e71,null,0x2));if(_0x487e71&&_0x487e71[_0xc1e8('0x4e')]===AGI_CODE_SUCCESS&&_0x487e71[_0xc1e8('0x4f')]!==AGI_RESULT_ERROR&&!_0x280d14[_0xc1e8('0x22')]){logger['debug'](_0xc1e8('0x4d'),getLogFromObject(_0x487e71));return _[_0xc1e8('0x50')](_0x487e71[_0xc1e8('0x4f')])?null:_0x487e71['result'][_0xc1e8('0x51')]();}else{logger[_0xc1e8('0xe')]('response',getLogFromObject(_0x487e71));return null;}}else{logger[_0xc1e8('0xe')](_0xc1e8('0x52'));return null;}}catch(_0x57fedb){logger[_0xc1e8('0xe')](_0x57fedb[_0xc1e8('0xf')]);return null;}});if(_0x18495e[_0xc1e8('0x53')]){logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')](_0xc1e8('0x54'),_0x280d14['arg_1'],_0x280d14['calleridname'],_0x280d14['callerid'],_0x280d14['dnid'],_0x280d14[_0xc1e8('0x20')]));_0x5aa14e['traverseBFS'](_0x18495e[_0xc1e8('0x53')]['id'],function(_0x18c9b0){try{_0x18c9b0=_0x549d68[_0xc1e8('0x44')](_0x18c9b0);logger['debug']('vertex',JSON[_0xc1e8('0x38')](_0x18c9b0,null,0x2));if(_0x18c9b0&&_0x549d68[_0x18c9b0[_0xc1e8('0x26')]]){_0x487e71=_0x549d68[_0x18c9b0[_0xc1e8('0x26')]](_0x18c9b0);if(_0x487e71){logger[_0xc1e8('0x36')](_0xc1e8('0x4d'),getLogFromObject(_0x487e71));return _[_0xc1e8('0x50')](_0x487e71[_0xc1e8('0x4f')])?null:_0x487e71[_0xc1e8('0x4f')]['toString']();}else{logger['error'](_0xc1e8('0x4d'),getLogFromObject(_0x487e71));return null;}}else{logger['error'](_0xc1e8('0x52'));return null;}}catch(_0x30d721){logger[_0xc1e8('0xe')](_0x30d721['stack']);return null;}});}logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')](_0xc1e8('0x55'),_0x280d14['arg_1'],_0x280d14['calleridname'],_0x280d14[_0xc1e8('0x1d')],_0x280d14[_0xc1e8('0x1e')],_0x280d14[_0xc1e8('0x20')]));logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x280d14[_0xc1e8('0x49')],_0x280d14[_0xc1e8('0x4a')],parseInt(_0x280d14[_0xc1e8('0x4b')],0xa)+0x1));_0x280d14[_0xc1e8('0x56')](_0x280d14[_0xc1e8('0x49')],_0x280d14[_0xc1e8('0x4a')],parseInt(_0x280d14[_0xc1e8('0x4b')],0xa)+0x1);_0x280d14[_0xc1e8('0x3a')]();}}else{logger[_0xc1e8('0xe')](util[_0xc1e8('0x14')](_0xc1e8('0x57'),_0x280d14['arg_1']));_0x280d14['continueAt'](_0x280d14['context'],_0x280d14[_0xc1e8('0x4a')],parseInt(_0x280d14[_0xc1e8('0x4b')],0xa)+0x1);_0x280d14[_0xc1e8('0x3a')]();}}else{logger['error'](util[_0xc1e8('0x14')]('Project\x20%s\x20not\x20found',_0x280d14[_0xc1e8('0x1b')]));_0x280d14[_0xc1e8('0x56')](_0x280d14[_0xc1e8('0x49')],_0x280d14[_0xc1e8('0x4a')],parseInt(_0x280d14['priority'],0xa)+0x1);_0x280d14[_0xc1e8('0x3a')]();}}function main(){var _0x2b0d82;return utilLicense[_0xc1e8('0x58')]()[_0xc1e8('0x32')](function(_0xe0e993){if(_0xe0e993){if(_0xe0e993[_0xc1e8('0x59')]){if(_0xe0e993['callysquare']&&_0xe0e993[_0xc1e8('0x5a')]>0x0){logger[_0xc1e8('0x13')](util[_0xc1e8('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0xe0e993['callysquare']));_0x2b0d82=_0xe0e993[_0xc1e8('0x5a')];}else{logger[_0xc1e8('0x13')](_0xc1e8('0x5b'));}}else{logger[_0xc1e8('0x13')](_0xc1e8('0x5c'));_0x2b0d82=-0x1;}}})[_0xc1e8('0x30')](function(_0x58308d){logger['error'](_0xc1e8('0x5d'),_0x58308d[_0xc1e8('0xf')]);})['finally'](function(){var _0x2c3169=require(_0xc1e8('0x5e'))(config[_0xc1e8('0xb')]['port'],config[_0xc1e8('0xb')]['ip'],_0x2b0d82);_0x2c3169['on']('error',errorHandler);_0x2c3169['on'](_0xc1e8('0x5f'),listeningHandler);_0x2c3169['on'](_0xc1e8('0x60'),connectionHandler);_0x2c3169['on'](_0xc1e8('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 d86501a..0e79e64 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(_0x162505,_0x21226a){var _0x2cbab4=function(_0x574d18){while(--_0x574d18){_0x162505['push'](_0x162505['shift']());}};_0x2cbab4(++_0x21226a);}(_0x814b,0x1a2));var _0xb814=function(_0x16cf9e,_0x3d3cfd){_0x16cf9e=_0x16cf9e-0x0;var _0x56aefd=_0x814b[_0x16cf9e];return _0x56aefd;};'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(_0x27ec7c,_0x3e2a52){var _0xd88bcb=function(_0x1fbd90){while(--_0x1fbd90){_0x27ec7c['push'](_0x27ec7c['shift']());}};_0xd88bcb(++_0x3e2a52);}(_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/agi/reply.js b/server/services/agi/reply.js index 2427b4f..5ee34a9 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(_0x156877,_0x1b99b2){var _0x161036=function(_0x5a303b){while(--_0x5a303b){_0x156877['push'](_0x156877['shift']());}};_0x161036(++_0x1b99b2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20ba94,_0x2718b3){_0x20ba94=_0x20ba94-0x0;var _0x17f044=_0x5f2f[_0x20ba94];return _0x17f044;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x12dadd,_0x4609ee){var _0x13f4fb=function(_0x1cbd57){while(--_0x1cbd57){_0x12dadd['push'](_0x12dadd['shift']());}};_0x13f4fb(++_0x4609ee);}(_0x7a54,0x106));var _0x47a5=function(_0x43fd17,_0x1e9465){_0x43fd17=_0x43fd17-0x0;var _0x424c2e=_0x7a54[_0x43fd17];return _0x424c2e;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index aff85d9..d306e49 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 _0x2961=['ShowTrunk','getSoundById','getIntervalById','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','then','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','http','request','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','log','rpcreq','getTrunkById'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2961,0x8d));var _0x1296=function(_0x55ff97,_0x33c8cc){_0x55ff97=_0x55ff97-0x0;var _0x240a55=_0x2961[_0x55ff97];return _0x240a55;};'use strict';var BPromise=require(_0x1296('0x0'));var moment=require(_0x1296('0x1'));var _=require('lodash');var util=require(_0x1296('0x2'));var jayson=require(_0x1296('0x3'));var client=jayson[_0x1296('0x4')][_0x1296('0x5')]({'port':0x2329});function request(_0x211ab7,_0x183d27){return new BPromise(function(_0x5a9144,_0x59fca6){return client[_0x1296('0x6')](_0x211ab7,_0x183d27)['then'](function(_0x305747){if(_0x305747['error']){return _0x59fca6(_0x305747[_0x1296('0x7')][_0x1296('0x8')]);}else{return _0x5a9144(_0x305747[_0x1296('0x9')]);}})[_0x1296('0xa')](function(_0x17178b){return _0x59fca6(_0x17178b);});});}exports[_0x1296('0xb')]=function(_0x5a0783){return request(_0x1296('0xc'),{'options':{'raw':![],'where':{'name':_0x5a0783},'attributes':[_0x1296('0xd')]}});};exports[_0x1296('0xe')]=function(_0x489dbe){return request(_0x1296('0xf'),{'options':{'raw':![],'where':{'id':_0x489dbe},'include':[{'model':_0x1296('0x10'),'as':'Smtp'}],'attributes':['id',_0x1296('0x11'),'email']}});};exports[_0x1296('0x12')]=function(_0x35347d){return request(_0x1296('0xc'),{'options':{'where':{'id':_0x35347d},'attributes':[_0x1296('0x11')]}});};exports['getVoiceQueueById']=function(_0x1b6d37){return request(_0x1296('0x13'),{'options':{'where':{'id':_0x1b6d37},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x14')]=function(_0x17b40a){return request(_0x1296('0x15'),{'options':{'where':{'id':_0x17b40a},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x16')]=function(_0x80fe75){return request(_0x1296('0x17'),{'options':{'where':{'id':_0x80fe75},'attributes':['dsn']}});};exports[_0x1296('0x18')]=function(_0x37fd85){return request(_0x1296('0x19'),{'options':{'where':{'id':_0x37fd85},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x1a')]=function(_0x7f82a4){console[_0x1296('0x1b')](_0x1296('0x1c'),_0x7f82a4);return request('GetContactByPhone',{'options':{'where':{'phone':_0x7f82a4},'attributes':['id']}});};exports[_0x1296('0x1d')]=function(_0x4cb7b1){return request(_0x1296('0x1e'),{'options':{'where':{'id':_0x4cb7b1},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x1f')]=function(_0x40d4c2){return request('ShowSound',{'options':{'where':{'id':_0x40d4c2},'attributes':['save_name']}});};exports[_0x1296('0x20')]=function(_0x48e703){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x48e703},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x1296('0x21')]=function(_0x584d76){return request(_0x1296('0x22'),{'options':{'where':{'id':_0x584d76},'attributes':['id',_0x1296('0x11')]}});};exports[_0x1296('0x23')]=function(_0x5b639e){return request('CreateSmsMessage',{'body':_0x5b639e});};exports['createSquareDetailsReport']=function(_0x29d303){return request(_0x1296('0x24'),{'body':_0x29d303});};exports[_0x1296('0x25')]=function(_0x5cd417){return request(_0x1296('0x26'),{'body':_[_0x1296('0x27')](_0x5cd417,{'project_name':_0x5cd417['arg_1'],'prev_project_name':_0x5cd417[_0x1296('0x28')]||'','is_subproject':_0x5cd417['arg_2']?!![]:![],'leaveAt':moment()[_0x1296('0x29')](_0x1296('0x2a'))})});};exports[_0x1296('0x2b')]=function(_0xcbed73){return request('CreateSquareRecording',{'body':_0xcbed73});};exports[_0x1296('0x2c')]=function(_0x5a684f){return request(_0x1296('0x2d'),{'body':_0x5a684f});};exports[_0x1296('0x2e')]=function(_0x50edb8){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x50edb8['phone'],'ListId':_0x50edb8['ListId']}}})[_0x1296('0x2f')](function(_0x4a8ef8){if(_0x4a8ef8){return _0x4a8ef8;}return request(_0x1296('0x30'),{'body':_0x50edb8});});};exports[_0x1296('0x31')]=function(_0xe8a95e){return request(_0x1296('0x32'),{'options':{'where':{'id':_0xe8a95e},'attributes':[_0x1296('0x11')]}});};exports[_0x1296('0x33')]=function(_0x2ea7e3,_0x84bbe9){return request('LoginUser',{'body':{'interface':_0x84bbe9},'options':{'where':_0x2ea7e3}});};exports[_0x1296('0x34')]=function(_0x47e42e,_0x29fcdf,_0x177ee0){return request(_0x1296('0x35'),{'body':{'type':_0x29fcdf,'uniqueid':_0x177ee0},'options':{'where':_0x47e42e}});};exports[_0x1296('0x36')]=function(_0x5d445b){return request('UnpauseUser',{'body':{},'options':{'where':_0x5d445b}});};exports[_0x1296('0x37')]=function(_0x2169ff){return request(_0x1296('0x38'),{'body':{},'options':{'where':_0x2169ff}});}; \ No newline at end of file +var _0x9612=['production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','name','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','log','rpcreq','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client','request','then','error','message','catch','ShowSquareProject'];(function(_0x17e40c,_0x528987){var _0x3a97a4=function(_0x2cea22){while(--_0x2cea22){_0x17e40c['push'](_0x17e40c['shift']());}};_0x3a97a4(++_0x528987);}(_0x9612,0x1dd));var _0x2961=function(_0x2fa357,_0xc14637){_0x2fa357=_0x2fa357-0x0;var _0x528a40=_0x9612[_0x2fa357];return _0x528a40;};'use strict';var BPromise=require('bluebird');var moment=require(_0x2961('0x0'));var _=require(_0x2961('0x1'));var util=require(_0x2961('0x2'));var jayson=require(_0x2961('0x3'));var client=jayson[_0x2961('0x4')]['http']({'port':0x2329});function request(_0x14782f,_0x546176){return new BPromise(function(_0x5b8440,_0x46158c){return client[_0x2961('0x5')](_0x14782f,_0x546176)[_0x2961('0x6')](function(_0x38f343){if(_0x38f343[_0x2961('0x7')]){return _0x46158c(_0x38f343[_0x2961('0x7')][_0x2961('0x8')]);}else{return _0x5b8440(_0x38f343['result']);}})[_0x2961('0x9')](function(_0x15ce4f){return _0x46158c(_0x15ce4f);});});}exports['getSquareProject']=function(_0x3ae182){return request(_0x2961('0xa'),{'options':{'raw':![],'where':{'name':_0x3ae182},'attributes':[_0x2961('0xb')]}});};exports[_0x2961('0xc')]=function(_0x124c2c){return request(_0x2961('0xd'),{'options':{'raw':![],'where':{'id':_0x124c2c},'include':[{'model':_0x2961('0xe'),'as':_0x2961('0xf')}],'attributes':['id','name',_0x2961('0x10')]}});};exports[_0x2961('0x11')]=function(_0x5134ef){return request('ShowSquareProject',{'options':{'where':{'id':_0x5134ef},'attributes':['name']}});};exports[_0x2961('0x12')]=function(_0x1a6a1e){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1a6a1e},'attributes':['name']}});};exports[_0x2961('0x13')]=function(_0x232b47){return request(_0x2961('0x14'),{'options':{'where':{'id':_0x232b47},'attributes':[_0x2961('0x15')]}});};exports[_0x2961('0x16')]=function(_0x28b473){return request(_0x2961('0x17'),{'options':{'where':{'id':_0x28b473},'attributes':[_0x2961('0x18')]}});};exports[_0x2961('0x19')]=function(_0x1d513d){return request('ShowUser',{'options':{'where':{'id':_0x1d513d},'attributes':['name']}});};exports[_0x2961('0x1a')]=function(_0x5eab94){console[_0x2961('0x1b')](_0x2961('0x1c'),_0x5eab94);return request('GetContactByPhone',{'options':{'where':{'phone':_0x5eab94['phone']},'attributes':['id']}});};exports[_0x2961('0x1d')]=function(_0x29545c){return request(_0x2961('0x1e'),{'options':{'where':{'id':_0x29545c},'attributes':[_0x2961('0x15')]}});};exports[_0x2961('0x1f')]=function(_0x17c952){return request(_0x2961('0x20'),{'options':{'where':{'id':_0x17c952},'attributes':[_0x2961('0x21')]}});};exports[_0x2961('0x22')]=function(_0x271a99){return request(_0x2961('0x23'),{'options':{'raw':![],'where':{'id':_0x271a99},'include':[{'model':_0x2961('0x24'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x1fde76){return request(_0x2961('0x25'),{'options':{'where':{'id':_0x1fde76},'attributes':['id',_0x2961('0x15')]}});};exports[_0x2961('0x26')]=function(_0x93d49a){return request('CreateSmsMessage',{'body':_0x93d49a});};exports[_0x2961('0x27')]=function(_0x41f324){return request(_0x2961('0x28'),{'body':_0x41f324});};exports[_0x2961('0x29')]=function(_0x304a3e){return request(_0x2961('0x2a'),{'body':_[_0x2961('0x2b')](_0x304a3e,{'project_name':_0x304a3e[_0x2961('0x2c')],'prev_project_name':_0x304a3e[_0x2961('0x2d')]||'','is_subproject':_0x304a3e[_0x2961('0x2d')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x2961('0x2e')]=function(_0x5df297){return request(_0x2961('0x2f'),{'body':_0x5df297});};exports['createSquareMessage']=function(_0x2f1d09){return request(_0x2961('0x30'),{'body':_0x2f1d09});};exports[_0x2961('0x31')]=function(_0x5007fa){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5007fa[_0x2961('0x32')],'ListId':_0x5007fa[_0x2961('0x33')]}}})[_0x2961('0x6')](function(_0x54532f){if(_0x54532f){return _0x54532f;}return request(_0x2961('0x34'),{'body':_0x5007fa});});};exports[_0x2961('0x35')]=function(_0x58313d){return request('ShowPause',{'options':{'where':{'id':_0x58313d},'attributes':[_0x2961('0x15')]}});};exports[_0x2961('0x36')]=function(_0x3ea5b5,_0x280a42){return request(_0x2961('0x37'),{'body':{'interface':_0x280a42},'options':{'where':_0x3ea5b5}});};exports['agentPause']=function(_0x379b80,_0xa294d3,_0x151057){return request(_0x2961('0x38'),{'body':{'type':_0xa294d3,'uniqueid':_0x151057},'options':{'where':_0x379b80}});};exports[_0x2961('0x39')]=function(_0x3ce62c){return request(_0x2961('0x3a'),{'body':{},'options':{'where':_0x3ce62c}});};exports[_0x2961('0x3b')]=function(_0x4de06d){return request(_0x2961('0x3c'),{'body':{},'options':{'where':_0x4de06d}});}; \ 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 104bfdc..a04f719 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 _0x54ef=['exports','./polly','./lex'];(function(_0xb7bab8,_0x3e21ab){var _0x28da19=function(_0x1a0052){while(--_0x1a0052){_0xb7bab8['push'](_0xb7bab8['shift']());}};_0x28da19(++_0x3e21ab);}(_0x54ef,0x112));var _0xf54e=function(_0x6a309c,_0x39a936){_0x6a309c=_0x6a309c-0x0;var _0x16b579=_0x54ef[_0x6a309c];return _0x16b579;};var polly=require(_0xf54e('0x0'));var lex=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x29d4=['exports','./polly'];(function(_0x3eefcb,_0xfcbdfb){var _0x2a35ca=function(_0x5901de){while(--_0x5901de){_0x3eefcb['push'](_0x3eefcb['shift']());}};_0x2a35ca(++_0xfcbdfb);}(_0x29d4,0x1a1));var _0x429d=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x29d4[_0x3e112d];return _0x531c31;};var polly=require(_0x429d('0x0'));var lex=require('./lex');module[_0x429d('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 ddbbaa7..54e40f7 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 _0x9aea=['./lib/api'];(function(_0x3c7e1a,_0x1867e6){var _0x2004d3=function(_0x5a5854){while(--_0x5a5854){_0x3c7e1a['push'](_0x3c7e1a['shift']());}};_0x2004d3(++_0x1867e6);}(_0x9aea,0xdd));var _0xa9ae=function(_0x8740e1,_0x52fe63){_0x8740e1=_0x8740e1-0x0;var _0x5bb391=_0x9aea[_0x8740e1];return _0x5bb391;};'use strict';var lex=require(_0xa9ae('0x0'));module['exports']=function(_0x45ec16,_0x5e1d51,_0x2b5e0c,_0x13679e,_0x563a24,_0x414638){return lex(_0x45ec16,_0x5e1d51,_0x2b5e0c,_0x13679e,_0x563a24,_0x414638);}; \ No newline at end of file +var _0xee39=['./lib/api','exports'];(function(_0x32342b,_0x50e7e6){var _0x305ec6=function(_0x5291db){while(--_0x5291db){_0x32342b['push'](_0x32342b['shift']());}};_0x305ec6(++_0x50e7e6);}(_0xee39,0x1e6));var _0x9ee3=function(_0x55e846,_0x1c4bea){_0x55e846=_0x55e846-0x0;var _0x56a7e0=_0xee39[_0x55e846];return _0x56a7e0;};'use strict';var lex=require(_0x9ee3('0x0'));module[_0x9ee3('0x1')]=function(_0xe604cf,_0x58cf62,_0x39e617,_0x64784f,_0x18357f,_0x3cdeaf){return lex(_0xe604cf,_0x58cf62,_0x39e617,_0x64784f,_0x18357f,_0x3cdeaf);}; \ 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 89e3ae3..f08e927 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 _0xc789=['slot_','exports','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x338f23,_0x4baf56){var _0x11a457=function(_0x12a128){while(--_0x12a128){_0x338f23['push'](_0x338f23['shift']());}};_0x11a457(++_0x4baf56);}(_0xc789,0xb2));var _0x9c78=function(_0x4999cb,_0x28880f){_0x4999cb=_0x4999cb-0x0;var _0xfd4eea=_0xc789[_0x4999cb];return _0xfd4eea;};'use strict';var BPromise=require(_0x9c78('0x0'));var AWS=require(_0x9c78('0x1'));function lexResult(_0x574b1a,_0x1cd7c7){return new BPromise(function(_0x331529,_0x52a2a0){_0x574b1a[_0x9c78('0x2')](_0x1cd7c7,function(_0x541db4,_0x26ba77){if(_0x541db4){_0x52a2a0(_0x541db4);}if(_0x26ba77[_0x9c78('0x3')]){for(const _0x1415c2 in _0x26ba77[_0x9c78('0x3')]){if(_0x26ba77[_0x9c78('0x3')]['hasOwnProperty'](_0x1415c2)){var _0x4890a2=_0x26ba77[_0x9c78('0x3')][_0x1415c2];_0x26ba77[_0x9c78('0x4')+_0x1415c2]=_0x4890a2;}}}_0x331529(_0x26ba77);});});}module[_0x9c78('0x5')]=function(_0x5576f0,_0x2577ae,_0x22a4dd,_0x533b60,_0x3595ad,_0x3d9bc4){var _0x2f0252=new AWS['LexRuntime']({'accessKeyId':_0x2577ae,'secretAccessKey':_0x22a4dd,'region':_0x533b60});var _0x3636d2={'botAlias':_0x9c78('0x6'),'botName':_0x3d9bc4,'inputText':_0x3595ad,'userId':_0x5576f0};return lexResult(_0x2f0252,_0x3636d2);}; \ No newline at end of file +var _0x0b9b=['slots','exports','LexRuntime','bluebird','aws-sdk','postText'];(function(_0x12fd63,_0x46fb87){var _0x517411=function(_0x35fc42){while(--_0x35fc42){_0x12fd63['push'](_0x12fd63['shift']());}};_0x517411(++_0x46fb87);}(_0x0b9b,0xf3));var _0xb0b9=function(_0x1c8820,_0x199f64){_0x1c8820=_0x1c8820-0x0;var _0x48e84d=_0x0b9b[_0x1c8820];return _0x48e84d;};'use strict';var BPromise=require(_0xb0b9('0x0'));var AWS=require(_0xb0b9('0x1'));function lexResult(_0x4d0f2b,_0x1f65cc){return new BPromise(function(_0x2a1f34,_0x14b953){_0x4d0f2b[_0xb0b9('0x2')](_0x1f65cc,function(_0x11e599,_0x2f4f66){if(_0x11e599){_0x14b953(_0x11e599);}if(_0x2f4f66[_0xb0b9('0x3')]){for(const _0x437216 in _0x2f4f66['slots']){if(_0x2f4f66['slots']['hasOwnProperty'](_0x437216)){var _0x26448c=_0x2f4f66[_0xb0b9('0x3')][_0x437216];_0x2f4f66['slot_'+_0x437216]=_0x26448c;}}}_0x2a1f34(_0x2f4f66);});});}module[_0xb0b9('0x4')]=function(_0x15c915,_0x2e7337,_0x2b4c25,_0x183e6e,_0x123338,_0x20adfa){var _0x5a0351=new AWS[(_0xb0b9('0x5'))]({'accessKeyId':_0x2e7337,'secretAccessKey':_0x2b4c25,'region':_0x183e6e});var _0x4ea14e={'botAlias':'$LATEST','botName':_0x20adfa,'inputText':_0x123338,'userId':_0x15c915};return lexResult(_0x5a0351,_0x4ea14e);}; \ 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 01b57ab..c123ddb 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f11=['./lib/api','exports'];(function(_0x5b3d9e,_0x16d809){var _0x348919=function(_0x338980){while(--_0x338980){_0x5b3d9e['push'](_0x5b3d9e['shift']());}};_0x348919(++_0x16d809);}(_0x1f11,0xea));var _0x11f1=function(_0x27c741,_0x4bab7c){_0x27c741=_0x27c741-0x0;var _0x353e2b=_0x1f11[_0x27c741];return _0x353e2b;};'use strict';var polly=require(_0x11f1('0x0'));module[_0x11f1('0x1')]=function(_0x52ee2b,_0x314dea,_0x33d3cf,_0x43b4a8,_0x18fed0,_0x163cd9,_0x4175a5){return polly(_0x52ee2b,_0x314dea,_0x33d3cf,_0x43b4a8,_0x18fed0,_0x163cd9,_0x4175a5);}; \ No newline at end of file +var _0x499c=['exports'];(function(_0x225d43,_0x22f803){var _0x213152=function(_0x16634e){while(--_0x16634e){_0x225d43['push'](_0x225d43['shift']());}};_0x213152(++_0x22f803);}(_0x499c,0x1ba));var _0xc499=function(_0x129253,_0x58e440){_0x129253=_0x129253-0x0;var _0x2e8565=_0x499c[_0x129253];return _0x2e8565;};'use strict';var polly=require('./lib/api');module[_0xc499('0x0')]=function(_0x403bf4,_0x406e09,_0x1b1ff1,_0x451ed7,_0x345aee,_0x20e50d,_0x2f3911){return polly(_0x403bf4,_0x406e09,_0x1b1ff1,_0x451ed7,_0x345aee,_0x20e50d,_0x2f3911);}; \ 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 4432965..49280e7 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 _0x0092=['writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','bluebird','randomstring','aws-sdk','AudioStream'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x0092,0xdd));var _0x2009=function(_0x29f6f8,_0x3bd3e4){_0x29f6f8=_0x29f6f8-0x0;var _0x6c4589=_0x0092[_0x29f6f8];return _0x6c4589;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x2009('0x0'));var rs=require(_0x2009('0x1'));var AWS=require(_0x2009('0x2'));function pollyResult(_0x2bc6d3,_0x15fc27,_0x53399e){return new BPromise(function(_0x1f87cf,_0x58113b){_0x2bc6d3['synthesizeSpeech'](_0x15fc27,function(_0x32d489,_0x3aecce){if(_0x32d489){_0x58113b(_0x32d489);}else if(_0x3aecce){if(_0x3aecce[_0x2009('0x3')]instanceof Buffer){fs[_0x2009('0x4')](_0x53399e,_0x3aecce[_0x2009('0x3')],function(_0x4b8526){if(_0x4b8526){_0x58113b(_0x4b8526);}else{_0x1f87cf();}});}else{_0x58113b(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x58113b(new Error(_0x2009('0x5')));}});});}module[_0x2009('0x6')]=function(_0x9bd602,_0x21adb7,_0x401ea9,_0x9b20a5,_0x42dbc1,_0x5345a1,_0x236a06){var _0x2ee311=new AWS[(_0x2009('0x7'))]({'accessKeyId':_0x9bd602,'secretAccessKey':_0x21adb7,'region':_0x401ea9});var _0x4fbddf={'Text':_0x42dbc1,'TextType':_0x5345a1||_0x2009('0x8'),'OutputFormat':'mp3','VoiceId':_0x9b20a5};return pollyResult(_0x2ee311,_0x4fbddf,_0x236a06);}; \ No newline at end of file +var _0xc655=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xc655,0x1df));var _0x5c65=function(_0x2315b9,_0x995911){_0x2315b9=_0x2315b9-0x0;var _0x518780=_0xc655[_0x2315b9];return _0x518780;};'use strict';var fs=require('fs');var path=require(_0x5c65('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x5c65('0x1'));function pollyResult(_0x25c2db,_0x470b7e,_0x491764){return new BPromise(function(_0x82abcc,_0x3e85c7){_0x25c2db[_0x5c65('0x2')](_0x470b7e,function(_0x282b6e,_0x1e6103){if(_0x282b6e){_0x3e85c7(_0x282b6e);}else if(_0x1e6103){if(_0x1e6103[_0x5c65('0x3')]instanceof Buffer){fs[_0x5c65('0x4')](_0x491764,_0x1e6103[_0x5c65('0x3')],function(_0x43d9c6){if(_0x43d9c6){_0x3e85c7(_0x43d9c6);}else{_0x82abcc();}});}else{_0x3e85c7(new Error(_0x5c65('0x5')));}}else{_0x3e85c7(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x3b32b7,_0x5db219,_0x15d42,_0x51f23c,_0x3ff4c6,_0x223100,_0x5bdf57){var _0x161f1f=new AWS[(_0x5c65('0x6'))]({'accessKeyId':_0x3b32b7,'secretAccessKey':_0x5db219,'region':_0x15d42});var _0x4e2b08={'Text':_0x3ff4c6,'TextType':_0x223100||_0x5c65('0x7'),'OutputFormat':'mp3','VoiceId':_0x51f23c};return pollyResult(_0x161f1f,_0x4e2b08,_0x5bdf57);}; \ 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 36f4374..e7669cb 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 _0x38e5=['./lib/api','exports'];(function(_0xcd45b6,_0x54d0f9){var _0x31aee6=function(_0xd58aa5){while(--_0xd58aa5){_0xcd45b6['push'](_0xcd45b6['shift']());}};_0x31aee6(++_0x54d0f9);}(_0x38e5,0x1cc));var _0x538e=function(_0x59244c,_0x1e3d7f){_0x59244c=_0x59244c-0x0;var _0x21b71a=_0x38e5[_0x59244c];return _0x21b71a;};'use strict';var asr=require(_0x538e('0x0'));module[_0x538e('0x1')]=function(_0x4b5c97,_0x1d6c8d,_0x2da93a,_0x8e5dc1){return asr(_0x4b5c97,_0x1d6c8d,_0x2da93a);}; \ No newline at end of file +var _0xb778=['exports','./lib/api'];(function(_0x5e66f6,_0x1d5092){var _0x14e47c=function(_0x42bb0e){while(--_0x42bb0e){_0x5e66f6['push'](_0x5e66f6['shift']());}};_0x14e47c(++_0x1d5092);}(_0xb778,0x127));var _0x8b77=function(_0x161f59,_0x42e9ff){_0x161f59=_0x161f59-0x0;var _0x3ffa0e=_0xb778[_0x161f59];return _0x3ffa0e;};'use strict';var asr=require(_0x8b77('0x0'));module[_0x8b77('0x1')]=function(_0x5de6f5,_0x590788,_0x129fda,_0x27a5e0){return asr(_0x5de6f5,_0x590788,_0x129fda);}; \ 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 c5e8d4b..1c10efc 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 _0xfbf6=['base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x239f39,_0x485bf4){var _0x165a70=function(_0x26a816){while(--_0x26a816){_0x239f39['push'](_0x239f39['shift']());}};_0x165a70(++_0x485bf4);}(_0xfbf6,0x12b));var _0x6fbf=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0xfbf6[_0xabfec4];return _0x7bafa2;};'use strict';var url=require('url');var BPromise=require(_0x6fbf('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x390281,_0x3dca2f,_0xbc0361){return new BPromise(function(_0x26a99b,_0x1e52ae){var _0x4ca717;if(typeof _0x390281!=='string'||_0x390281[_0x6fbf('0x1')]===0x0){return _0x1e52ae(_0x6fbf('0x2'));}if(typeof _0x3dca2f!==_0x6fbf('0x3')||_0x3dca2f[_0x6fbf('0x1')]===0x0){return _0x1e52ae(_0x6fbf('0x4'));}if(typeof _0xbc0361!==_0x6fbf('0x5')&&(typeof _0xbc0361!=='string'||_0xbc0361[_0x6fbf('0x1')]===0x0)){return _0x1e52ae(_0x6fbf('0x6'));}try{_0x4ca717=fs[_0x6fbf('0x7')](_0x390281)[_0x6fbf('0x8')](_0x6fbf('0x9'));}catch(_0x419065){return _0x1e52ae(_0x419065);}return _0x26a99b({'method':_0x6fbf('0xa'),'uri':host+_0x6fbf('0xb')+_0x3dca2f,'body':{'config':{'encoding':_0x6fbf('0xc'),'sampleRateHertz':_0x6fbf('0xd'),'languageCode':_0xbc0361},'audio':{'content':_0x4ca717}},'json':!![]});});}; \ No newline at end of file +var _0x683f=['key\x20should\x20be\x20a\x20string','undefined','readFileSync','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x3c858f,_0x235201){var _0x198090=function(_0xc4c406){while(--_0xc4c406){_0x3c858f['push'](_0x3c858f['shift']());}};_0x198090(++_0x235201);}(_0x683f,0x149));var _0xf683=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x683f[_0x3b76f7];return _0x43984e;};'use strict';var url=require(_0xf683('0x0'));var BPromise=require(_0xf683('0x1'));var fs=require('fs');var host=_0xf683('0x2');module[_0xf683('0x3')]=function(_0x4d1c56,_0x56a31b,_0x576b82){return new BPromise(function(_0x51872d,_0xa914d5){var _0x22981c;if(typeof _0x4d1c56!==_0xf683('0x4')||_0x4d1c56[_0xf683('0x5')]===0x0){return _0xa914d5(_0xf683('0x6'));}if(typeof _0x56a31b!==_0xf683('0x4')||_0x56a31b['length']===0x0){return _0xa914d5(_0xf683('0x7'));}if(typeof _0x576b82!==_0xf683('0x8')&&(typeof _0x576b82!==_0xf683('0x4')||_0x576b82[_0xf683('0x5')]===0x0)){return _0xa914d5('lang\x20should\x20be\x20a\x20string');}try{_0x22981c=fs[_0xf683('0x9')](_0x4d1c56)['toString']('base64');}catch(_0x5e7a06){return _0xa914d5(_0x5e7a06);}return _0x51872d({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x56a31b,'body':{'config':{'encoding':_0xf683('0xa'),'sampleRateHertz':_0xf683('0xb'),'languageCode':_0x576b82},'audio':{'content':_0x22981c}},'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 d6a4a58..55a487f 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 _0xfd11=['exports'];(function(_0x2109a8,_0x3d8097){var _0x4b5dea=function(_0xaf5203){while(--_0xaf5203){_0x2109a8['push'](_0x2109a8['shift']());}};_0x4b5dea(++_0x3d8097);}(_0xfd11,0xf5));var _0x1fd1=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0xfd11[_0x101a17];return _0x3b76ee;};var asr=require('./asr');module[_0x1fd1('0x0')]={'asr':asr}; \ No newline at end of file +var _0xdfe9=['./asr','exports'];(function(_0x3ccbbe,_0xd9fb14){var _0x267b02=function(_0x547ed5){while(--_0x547ed5){_0x3ccbbe['push'](_0x3ccbbe['shift']());}};_0x267b02(++_0xd9fb14);}(_0xdfe9,0x8a));var _0x9dfe=function(_0x3deee5,_0x2731d0){_0x3deee5=_0x3deee5-0x0;var _0x1c92fb=_0xdfe9[_0x3deee5];return _0x1c92fb;};var asr=require(_0x9dfe('0x0'));module[_0x9dfe('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 3f65c45..d32e530 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 _0xfb65=['googleDialogflow','textRequest','stringify','result','actionIncomplete','fulfillment','score','status','code','metadata','isFallbackIntent','tildeASR','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','https','parse','bluebird','randomstring','request-promise','util','apiai-promise','./aws','./tilde','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','statusMessage','request\x20to\x20','createWriteStream','info','finish\x20download\x20file','close','pipe','end','host','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','toString','?key=','ssml','input','voice','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message'];(function(_0x3d38e3,_0x438498){var _0x5b77a7=function(_0x26a381){while(--_0x26a381){_0x3d38e3['push'](_0x3d38e3['shift']());}};_0x5b77a7(++_0x438498);}(_0xfb65,0x1c3));var _0x5fb6=function(_0x442b31,_0x278d58){_0x442b31=_0x442b31-0x0;var _0x2c1151=_0xfb65[_0x442b31];return _0x2c1151;};'use strict';var fs=require('fs');var path=require(_0x5fb6('0x0'));var http=require('http');var https=require(_0x5fb6('0x1'));var urlParse=require('url')[_0x5fb6('0x2')];var BPromise=require(_0x5fb6('0x3'));var rs=require(_0x5fb6('0x4'));var sox=require('sox');var rp=require(_0x5fb6('0x5'));var util=require(_0x5fb6('0x6'));var querystring=require('querystring');var tts=require('google-tts-api');var apiai=require(_0x5fb6('0x7'));var md5=require('md5');var google=require('./google');var aws=require(_0x5fb6('0x8'));var tilde=require(_0x5fb6('0x9'));var sestek=require(_0x5fb6('0xa'));var logger=require('../../../config/logger')(_0x5fb6('0xb'));var ISPEECH_API=_0x5fb6('0xc');function downloadFile(_0x5ef553,_0x572943){return new BPromise(function(_0x52c8df,_0x182111){var _0x59c95a=urlParse(_0x5ef553);var _0x137ad9=_0x59c95a[_0x5fb6('0xd')]===_0x5fb6('0xe')?https:http;var _0x44b862={'host':_0x59c95a['host'],'path':_0x59c95a[_0x5fb6('0x0')],'headers':{'user-agent':_0x5fb6('0xf')}};_0x137ad9[_0x5fb6('0x10')](_0x44b862,function(_0x46f1d5){if(_0x46f1d5[_0x5fb6('0x11')]!==0xc8){logger[_0x5fb6('0x12')]('request\x20to\x20'+_0x5ef553+'\x20failed,\x20status\x20code\x20=\x20'+_0x46f1d5[_0x5fb6('0x11')]+'\x20('+_0x46f1d5[_0x5fb6('0x13')]+')');_0x182111(new Error(_0x5fb6('0x14')+_0x5ef553+'\x20failed,\x20status\x20code\x20=\x20'+_0x46f1d5[_0x5fb6('0x11')]+'\x20('+_0x46f1d5[_0x5fb6('0x13')]+')'));return;}var _0x10e3f0=fs[_0x5fb6('0x15')](_0x572943);_0x10e3f0['on']('finish',function(){logger[_0x5fb6('0x16')](_0x5fb6('0x17'));_0x10e3f0[_0x5fb6('0x18')](_0x52c8df);});_0x10e3f0['on'](_0x5fb6('0x12'),function(_0xe7ce87){fs['unlink'](_0x572943);logger[_0x5fb6('0x12')]('download\x20error',_0xe7ce87);_0x182111(_0xe7ce87);});_0x46f1d5[_0x5fb6('0x19')](_0x10e3f0);})['on'](_0x5fb6('0x12'),function(_0x2aeabb){logger[_0x5fb6('0x12')](_0x2aeabb);_0x182111(_0x2aeabb);})[_0x5fb6('0x1a')]();});}function uploadFile(_0x3d31b5){return new BPromise(function(_0x300b4f,_0x4f96c3){var _0x4711a3=urlParse(_0x3d31b5);var _0x8182dd=_0x4711a3[_0x5fb6('0xd')]===_0x5fb6('0xe')?https:http;var _0x4f835b={'host':_0x4711a3[_0x5fb6('0x1b')],'path':_0x4711a3['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x8182dd[_0x5fb6('0x10')](_0x4f835b,function(_0x50e24f){if(_0x50e24f[_0x5fb6('0x11')]!==0xc8){_0x4f96c3(new Error(_0x5fb6('0x14')+_0x3d31b5+_0x5fb6('0x1c')+_0x50e24f[_0x5fb6('0x11')]+'\x20('+_0x50e24f[_0x5fb6('0x13')]+')'));return;}var _0x34121e='';_0x50e24f['on'](_0x5fb6('0x1d'),function(_0x210d25){_0x34121e+=_0x210d25;});_0x50e24f['on']('end',function(){_0x300b4f(_0x34121e);});})['on'](_0x5fb6('0x12'),function(_0x59b45b){_0x4f96c3(_0x59b45b);})[_0x5fb6('0x1a')]();});}function convertFile(_0x2c7ed4,_0x35696c){return new BPromise(function(_0x32557a,_0x20b688){var _0x256fde=sox[_0x5fb6('0x1e')](_0x2c7ed4,_0x35696c,{'sampleRate':0x1f40,'format':_0x5fb6('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x256fde['on'](_0x5fb6('0x12'),function(_0x5bf974){logger[_0x5fb6('0x12')](_0x5fb6('0x20'),_0x5bf974);_0x20b688(_0x5bf974);});_0x256fde['on'](_0x5fb6('0x1a'),function(){logger['info'](_0x5fb6('0x21'));_0x32557a();});_0x256fde['start']();});}function base64Decode(_0x5956bf,_0x1d2b52){var _0x1e4409=path[_0x5fb6('0x22')](__dirname,'tmp',rs[_0x5fb6('0x23')](0x4)+_0x5fb6('0x24'));fs[_0x5fb6('0x25')](_0x1e4409,_0x5956bf,_0x5fb6('0x26'));return convertFile(_0x1e4409,_0x1d2b52)[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x1e4409);fs[_0x5fb6('0x29')](_0x1d2b52,_0x5fb6('0x2a'));}catch(_0x463056){logger[_0x5fb6('0x12')](_0x463056);}return _0x1d2b52[_0x5fb6('0x2b')]('.')[0x0];});}function base64Encode(_0x3bb6c6){var _0x1bf39e=fs[_0x5fb6('0x2c')](_0x3bb6c6);return new Buffer(_0x1bf39e)[_0x5fb6('0x2d')](_0x5fb6('0x26'));}exports['googleCloudTTS']=function(_0x266e11,_0xafcc80,_0x4b5078,_0x4250de,_0x471734,_0x483655){var _0x3fce77,_0x1e5352;var _0x28bf2a='https://texttospeech.googleapis.com/v1/';var _0x2e3904=_0x5fb6('0x2e')+_0x266e11;var _0x42448a={};if(_0xafcc80===_0x5fb6('0x2f')){_0x42448a[_0x5fb6('0x30')]={'ssml':_0x4b5078};}else{_0x42448a[_0x5fb6('0x30')]={'text':_0x4b5078};};_0x42448a[_0x5fb6('0x31')]={'languageCode':_0x4250de,'ssmlGender':_0x471734};_0x42448a['audioConfig']={'audioEncoding':_0x5fb6('0x32'),'sampleRateHertz':0x1f40};var _0x5b5f7d={'url':_0x28bf2a+_0x5fb6('0x33')+_0x2e3904,'method':_0x5fb6('0x34'),'json':!![],'body':_0x42448a};return rp(_0x5b5f7d)[_0x5fb6('0x27')](function(_0x532930){return new BPromise(function(_0x5502c7,_0x2562ac){_0x3fce77=path['resolve'](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+_0x5fb6('0x36'));var _0x184b8b=Buffer[_0x5fb6('0x37')](_0x532930[_0x5fb6('0x38')],'base64');return fs[_0x5fb6('0x39')](_0x3fce77,_0x184b8b,function(_0x478cbc){_0x2562ac(_0x478cbc);},function(_0x1c3348){fs['chmodSync'](_0x3fce77,_0x5fb6('0x2a'));_0x5502c7(_0x1c3348);});});})[_0x5fb6('0x27')](function(_0x41a60d){_0x1e5352=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs['generate'](0x4)+_0x5fb6('0x24'));return convertFile(_0x3fce77,_0x1e5352);})[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x3fce77);fs[_0x5fb6('0x29')](_0x1e5352,_0x5fb6('0x2a'));}catch(_0xc2ffca){logger['error'](_0xc2ffca);}logger['info'](_0x5fb6('0x3a'),_0x1e5352[_0x5fb6('0x2b')]('.')[0x0]);return _0x1e5352[_0x5fb6('0x2b')]('.')[0x0];});};exports[_0x5fb6('0x3b')]=function(_0xfb2ed1,_0x2de791){var _0x3b12d6,_0x2379b9;return tts(_0xfb2ed1,_0x2de791||'en',0x1)['then'](function(_0x32af45){logger[_0x5fb6('0x16')](_0x32af45);_0x3b12d6=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+_0x5fb6('0x36'));return downloadFile(_0x32af45,_0x3b12d6);})[_0x5fb6('0x27')](function(){_0x2379b9=path['resolve'](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+'.wav');return convertFile(_0x3b12d6,_0x2379b9);})[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x3b12d6);fs['chmodSync'](_0x2379b9,_0x5fb6('0x2a'));}catch(_0x304a50){logger[_0x5fb6('0x12')](_0x304a50);}logger[_0x5fb6('0x16')](_0x5fb6('0x3c'),_0x2379b9['split']('.')[0x0]);return _0x2379b9[_0x5fb6('0x2b')]('.')[0x0];});};exports[_0x5fb6('0x3d')]=function(_0x237503,_0x22ba5e,_0x35ff90){return google[_0x5fb6('0x3e')](_0x237503,_0x22ba5e,_0x35ff90)['then'](function(_0x20e0aa){logger[_0x5fb6('0x16')](_0x20e0aa['uri']);return rp(_0x20e0aa);})['then'](function(_0x282b21){var _0x427de1='';var _0x1ac67b=0x0;try{fs['unlink'](_0x237503);}catch(_0x57039e){logger[_0x5fb6('0x12')](_0x57039e);}if(_0x282b21&&_0x282b21[_0x5fb6('0x3f')]){_0x427de1=_0x282b21['results'][_0x5fb6('0x40')](function(_0x2fc5a3){return _0x2fc5a3&&_0x2fc5a3[_0x5fb6('0x41')][0x0]&&_0x2fc5a3[_0x5fb6('0x41')][0x0][_0x5fb6('0x42')]?_0x2fc5a3['alternatives'][0x0][_0x5fb6('0x42')]:'';})[_0x5fb6('0x43')]('\x0a');_0x1ac67b=_0x282b21[_0x5fb6('0x3f')][_0x5fb6('0x40')](function(_0x34f3a){return _0x34f3a&&_0x34f3a[_0x5fb6('0x41')][0x0]&&_0x34f3a['alternatives'][0x0][_0x5fb6('0x44')]?_0x34f3a[_0x5fb6('0x41')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x5fb6('0x16')](_0x5fb6('0x45'),_0x427de1);logger[_0x5fb6('0x16')]('googleASR\x20confidence',_0x1ac67b);return{'transcript':_0x427de1,'confidence':_0x1ac67b};})[_0x5fb6('0x46')](function(_0x2be8ff){logger[_0x5fb6('0x12')](_0x5fb6('0x47'),_0x2be8ff[_0x5fb6('0x11')],_0x2be8ff[_0x5fb6('0x48')],_0x2be8ff[_0x5fb6('0x49')]);});};exports[_0x5fb6('0x4a')]=function(_0x5bd17b,_0x153845,_0xed9b2e,_0x29bece){var _0x3240d3=apiai(_0x153845,{'language':_0x29bece||'en'});return _0x3240d3[_0x5fb6('0x4b')](_0xed9b2e,{'sessionId':md5(_0x5bd17b)})['then'](function(_0x4062a9){logger['info'](JSON[_0x5fb6('0x4c')](_0x4062a9));return{'source':_0x4062a9[_0x5fb6('0x4d')]['source'],'resolvedQuery':_0x4062a9[_0x5fb6('0x4d')]['resolvedQuery'],'action':_0x4062a9[_0x5fb6('0x4d')]['action'],'actionIncomplete':_0x4062a9['result'][_0x5fb6('0x4e')],'speech':_0x4062a9[_0x5fb6('0x4d')][_0x5fb6('0x4f')]['speech'],'score':_0x4062a9[_0x5fb6('0x4d')][_0x5fb6('0x50')],'statusCode':_0x4062a9[_0x5fb6('0x51')][_0x5fb6('0x52')],'endConversation':_0x4062a9[_0x5fb6('0x4d')][_0x5fb6('0x53')]['endConversation']||![],'isFallbackIntent':_0x4062a9[_0x5fb6('0x4d')][_0x5fb6('0x53')][_0x5fb6('0x54')]};});};exports[_0x5fb6('0x55')]=function(_0x2e6138,_0xa58f56,_0x2b5f6d,_0x25a523){return tilde[_0x5fb6('0x3e')](_0x2e6138,_0xa58f56,_0x2b5f6d,_0x25a523)[_0x5fb6('0x27')](function(_0xb5180){try{fs[_0x5fb6('0x28')](_0x2e6138);}catch(_0x31c7b0){logger[_0x5fb6('0x12')](_0x31c7b0);}logger[_0x5fb6('0x16')]('Tilde\x20ASR\x20transcription',_0xb5180[_0x5fb6('0x42')]);logger[_0x5fb6('0x16')]('Tilde\x20ASR\x20confidence',_0xb5180['confidence']);return _0xb5180;});};exports[_0x5fb6('0x56')]=function(_0xe1be20,_0x23587b,_0x47f963,_0x29e5f3,_0x5da3b5,_0xad1773){var _0x2c8d12=path['resolve'](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+_0x5fb6('0x36'));var _0x1408b7;return aws[_0x5fb6('0x57')](_0xe1be20,_0x23587b,_0x47f963,_0x29e5f3,_0x5da3b5,_0xad1773,_0x2c8d12)['then'](function(){_0x1408b7=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs['generate'](0x4)+_0x5fb6('0x24'));return convertFile(_0x2c8d12,_0x1408b7);})[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x2c8d12);fs[_0x5fb6('0x29')](_0x1408b7,_0x5fb6('0x2a'));}catch(_0x1d9a31){logger[_0x5fb6('0x12')](_0x1d9a31);}return _0x1408b7[_0x5fb6('0x2b')]('.')[0x0];});};exports[_0x5fb6('0x58')]=function(_0x24f06d,_0xb16ab3,_0x1dc086,_0x434156,_0x3690f4,_0x52d97a){return aws[_0x5fb6('0x59')](_0x24f06d,_0xb16ab3,_0x1dc086,_0x434156,_0x3690f4,_0x52d97a)[_0x5fb6('0x27')](function(_0x7a2b04){logger[_0x5fb6('0x16')](JSON[_0x5fb6('0x4c')](_0x7a2b04));return _0x7a2b04;});};exports[_0x5fb6('0x5a')]=function(_0x14aa05,_0x57402d,_0x4275fd,_0x4afed3){var _0x1fc873=util[_0x5fb6('0x5b')](_0x5fb6('0x5c'),ISPEECH_API,_0x14aa05,encodeURIComponent(_0x57402d),_0x4275fd,_0x4afed3);var _0x3be401=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs['generate'](0x4)+_0x5fb6('0x36'));var _0x1f72dd;return downloadFile(_0x1fc873,_0x3be401)[_0x5fb6('0x27')](function(){_0x1f72dd=path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs['generate'](0x4)+_0x5fb6('0x24'));return convertFile(_0x3be401,_0x1f72dd);})[_0x5fb6('0x27')](function(){try{fs[_0x5fb6('0x28')](_0x3be401);fs[_0x5fb6('0x29')](_0x1f72dd,_0x5fb6('0x2a'));}catch(_0x87a885){logger[_0x5fb6('0x12')](_0x87a885);}return _0x1f72dd[_0x5fb6('0x2b')]('.')[0x0];});};exports[_0x5fb6('0x5d')]=function(_0x4b4411,_0x3aff03,_0x517f7e,_0x4e33ba){var _0x3b2f21=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3aff03,_0x517f7e,base64Encode(_0x4b4411),_0x4e33ba?util[_0x5fb6('0x5b')](_0x5fb6('0x5e'),encodeURIComponent(_0x4e33ba)):_0x5fb6('0x5f'));return uploadFile(_0x3b2f21)['then'](function(_0x245342){return querystring['parse'](_0x245342);});};exports['sestekNDA']=function(_0x513479,_0x2ac539){return sestek[_0x5fb6('0x60')](_0x513479,_0x2ac539)[_0x5fb6('0x27')](function(_0x5bf375){logger[_0x5fb6('0x16')](JSON[_0x5fb6('0x4c')](_0x5bf375));var _0x2a42e6={'speech':_0x5bf375[_0x5fb6('0x61')],'action':_0x5bf375[_0x5fb6('0x62')]?_0x5bf375[_0x5fb6('0x62')][_0x5fb6('0x63')]:undefined,'actiondata':_0x5bf375[_0x5fb6('0x62')]?_0x5bf375[_0x5fb6('0x62')][_0x5fb6('0x64')]:undefined};if(_0x5bf375[_0x5fb6('0x62')]&&_0x5bf375['channelData'][_0x5fb6('0x65')]){return base64Decode(_0x5bf375['channelData'][_0x5fb6('0x65')][_0x5fb6('0x66')],path[_0x5fb6('0x22')](__dirname,_0x5fb6('0x35'),rs[_0x5fb6('0x23')](0x4)+'.wav'))[_0x5fb6('0x27')](function(_0x37f7ab){_0x2a42e6[_0x5fb6('0x67')]=_0x37f7ab;return _0x2a42e6;});}return _0x2a42e6;});};exports[_0x5fb6('0x68')]=function(){return __dirname;}; \ No newline at end of file +var _0x2636=['https:','WHAT_EVER','get','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','finish','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','protocol','host','data','end','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','.wav','base64','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','chmodSync','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','path','http','bluebird','randomstring','sox','util','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2636,0x1c0));var _0x6263=function(_0x4993f8,_0x29b20d){_0x4993f8=_0x4993f8-0x0;var _0x10a52c=_0x2636[_0x4993f8];return _0x10a52c;};'use strict';var fs=require('fs');var path=require(_0x6263('0x0'));var http=require(_0x6263('0x1'));var https=require('https');var urlParse=require('url')['parse'];var BPromise=require(_0x6263('0x2'));var rs=require(_0x6263('0x3'));var sox=require(_0x6263('0x4'));var rp=require('request-promise');var util=require(_0x6263('0x5'));var querystring=require(_0x6263('0x6'));var tts=require(_0x6263('0x7'));var apiai=require(_0x6263('0x8'));var md5=require(_0x6263('0x9'));var google=require(_0x6263('0xa'));var aws=require(_0x6263('0xb'));var tilde=require(_0x6263('0xc'));var sestek=require(_0x6263('0xd'));var logger=require(_0x6263('0xe'))(_0x6263('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x13ba36,_0x54b494){return new BPromise(function(_0x4ff9ce,_0x28fd24){var _0xc1f731=urlParse(_0x13ba36);var _0x83979a=_0xc1f731['protocol']===_0x6263('0x10')?https:http;var _0xb93170={'host':_0xc1f731['host'],'path':_0xc1f731[_0x6263('0x0')],'headers':{'user-agent':_0x6263('0x11')}};_0x83979a[_0x6263('0x12')](_0xb93170,function(_0x311a7d){if(_0x311a7d['statusCode']!==0xc8){logger['error'](_0x6263('0x13')+_0x13ba36+'\x20failed,\x20status\x20code\x20=\x20'+_0x311a7d[_0x6263('0x14')]+'\x20('+_0x311a7d[_0x6263('0x15')]+')');_0x28fd24(new Error('request\x20to\x20'+_0x13ba36+_0x6263('0x16')+_0x311a7d[_0x6263('0x14')]+'\x20('+_0x311a7d[_0x6263('0x15')]+')'));return;}var _0x45c180=fs['createWriteStream'](_0x54b494);_0x45c180['on'](_0x6263('0x17'),function(){logger['info'](_0x6263('0x18'));_0x45c180[_0x6263('0x19')](_0x4ff9ce);});_0x45c180['on'](_0x6263('0x1a'),function(_0x5d3d8d){fs[_0x6263('0x1b')](_0x54b494);logger['error'](_0x6263('0x1c'),_0x5d3d8d);_0x28fd24(_0x5d3d8d);});_0x311a7d[_0x6263('0x1d')](_0x45c180);})['on']('error',function(_0xc99f08){logger['error'](_0xc99f08);_0x28fd24(_0xc99f08);})['end']();});}function uploadFile(_0x2f6ef4){return new BPromise(function(_0x54f406,_0x5bc71a){var _0x3699c0=urlParse(_0x2f6ef4);var _0x4489fa=_0x3699c0[_0x6263('0x1e')]===_0x6263('0x10')?https:http;var _0x1e660c={'host':_0x3699c0[_0x6263('0x1f')],'path':_0x3699c0[_0x6263('0x0')],'headers':{'user-agent':_0x6263('0x11')}};_0x4489fa[_0x6263('0x12')](_0x1e660c,function(_0x472910){if(_0x472910[_0x6263('0x14')]!==0xc8){_0x5bc71a(new Error(_0x6263('0x13')+_0x2f6ef4+_0x6263('0x16')+_0x472910[_0x6263('0x14')]+'\x20('+_0x472910[_0x6263('0x15')]+')'));return;}var _0x1255d3='';_0x472910['on'](_0x6263('0x20'),function(_0x5150fa){_0x1255d3+=_0x5150fa;});_0x472910['on']('end',function(){_0x54f406(_0x1255d3);});})['on'](_0x6263('0x1a'),function(_0x2c013e){_0x5bc71a(_0x2c013e);})[_0x6263('0x21')]();});}function convertFile(_0x340944,_0x2d8768){return new BPromise(function(_0x30742b,_0x380412){var _0x5e47f6=sox[_0x6263('0x22')](_0x340944,_0x2d8768,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5e47f6['on'](_0x6263('0x1a'),function(_0x441538){logger['error'](_0x6263('0x23'),_0x441538);_0x380412(_0x441538);});_0x5e47f6['on']('end',function(){logger[_0x6263('0x24')](_0x6263('0x25'));_0x30742b();});_0x5e47f6[_0x6263('0x26')]();});}function base64Decode(_0x113083,_0x5999ae){var _0xe218d4=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs['generate'](0x4)+_0x6263('0x29'));fs['writeFileSync'](_0xe218d4,_0x113083,_0x6263('0x2a'));return convertFile(_0xe218d4,_0x5999ae)[_0x6263('0x2b')](function(){try{fs[_0x6263('0x1b')](_0xe218d4);fs['chmodSync'](_0x5999ae,_0x6263('0x2c'));}catch(_0x3f4b0f){logger[_0x6263('0x1a')](_0x3f4b0f);}return _0x5999ae[_0x6263('0x2d')]('.')[0x0];});}function base64Encode(_0x129fc9){var _0x347ef7=fs[_0x6263('0x2e')](_0x129fc9);return new Buffer(_0x347ef7)[_0x6263('0x2f')](_0x6263('0x2a'));}exports['googleCloudTTS']=function(_0x445d7d,_0x3c8a62,_0x3c866b,_0x30461d,_0x13271c,_0x175c18){var _0x38c4dd,_0x302c08;var _0x202582=_0x6263('0x30');var _0x5af27b=_0x6263('0x31')+_0x445d7d;var _0x1231bb={};if(_0x3c8a62===_0x6263('0x32')){_0x1231bb[_0x6263('0x33')]={'ssml':_0x3c866b};}else{_0x1231bb[_0x6263('0x33')]={'text':_0x3c866b};};_0x1231bb[_0x6263('0x34')]={'languageCode':_0x30461d,'ssmlGender':_0x13271c};_0x1231bb[_0x6263('0x35')]={'audioEncoding':_0x6263('0x36'),'sampleRateHertz':0x1f40};var _0xb515fd={'url':_0x202582+_0x6263('0x37')+_0x5af27b,'method':_0x6263('0x38'),'json':!![],'body':_0x1231bb};return rp(_0xb515fd)[_0x6263('0x2b')](function(_0x187247){return new BPromise(function(_0x577d41,_0x27910b){_0x38c4dd=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+_0x6263('0x3a'));var _0x49c4bd=Buffer[_0x6263('0x3b')](_0x187247['audioContent'],'base64');return fs['writeFile'](_0x38c4dd,_0x49c4bd,function(_0x5400d4){_0x27910b(_0x5400d4);},function(_0x15e6bf){fs[_0x6263('0x3c')](_0x38c4dd,'777');_0x577d41(_0x15e6bf);});});})['then'](function(_0x5b4ba8){_0x302c08=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+'.wav');return convertFile(_0x38c4dd,_0x302c08);})['then'](function(){try{fs[_0x6263('0x1b')](_0x38c4dd);fs[_0x6263('0x3c')](_0x302c08,_0x6263('0x2c'));}catch(_0x1f8862){logger[_0x6263('0x1a')](_0x1f8862);}logger['info'](_0x6263('0x3d'),_0x302c08[_0x6263('0x2d')]('.')[0x0]);return _0x302c08[_0x6263('0x2d')]('.')[0x0];});};exports[_0x6263('0x3e')]=function(_0x3f3b21,_0x80ea00){var _0x2708e0,_0x46cb93;return tts(_0x3f3b21,_0x80ea00||'en',0x1)[_0x6263('0x2b')](function(_0x3f8ed0){logger[_0x6263('0x24')](_0x3f8ed0);_0x2708e0=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+_0x6263('0x3a'));return downloadFile(_0x3f8ed0,_0x2708e0);})[_0x6263('0x2b')](function(){_0x46cb93=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+'.wav');return convertFile(_0x2708e0,_0x46cb93);})[_0x6263('0x2b')](function(){try{fs[_0x6263('0x1b')](_0x2708e0);fs[_0x6263('0x3c')](_0x46cb93,'777');}catch(_0x1974a4){logger[_0x6263('0x1a')](_0x1974a4);}logger[_0x6263('0x24')](_0x6263('0x3f'),_0x46cb93['split']('.')[0x0]);return _0x46cb93['split']('.')[0x0];});};exports[_0x6263('0x40')]=function(_0x4dbab9,_0x5da030,_0x98f21e){return google[_0x6263('0x41')](_0x4dbab9,_0x5da030,_0x98f21e)[_0x6263('0x2b')](function(_0x5c2164){logger['info'](_0x5c2164[_0x6263('0x42')]);return rp(_0x5c2164);})[_0x6263('0x2b')](function(_0x2b5c13){var _0x547abc='';var _0x200b19=0x0;try{fs[_0x6263('0x1b')](_0x4dbab9);}catch(_0x5dadc1){logger[_0x6263('0x1a')](_0x5dadc1);}if(_0x2b5c13&&_0x2b5c13[_0x6263('0x43')]){_0x547abc=_0x2b5c13[_0x6263('0x43')][_0x6263('0x44')](function(_0x3a345e){return _0x3a345e&&_0x3a345e[_0x6263('0x45')][0x0]&&_0x3a345e[_0x6263('0x45')][0x0][_0x6263('0x46')]?_0x3a345e['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x200b19=_0x2b5c13[_0x6263('0x43')]['map'](function(_0x2c7c9a){return _0x2c7c9a&&_0x2c7c9a[_0x6263('0x45')][0x0]&&_0x2c7c9a[_0x6263('0x45')][0x0][_0x6263('0x47')]?_0x2c7c9a[_0x6263('0x45')][0x0][_0x6263('0x47')]:0x0;})[_0x6263('0x48')]('\x0a');}logger['info'](_0x6263('0x49'),_0x547abc);logger[_0x6263('0x24')](_0x6263('0x4a'),_0x200b19);return{'transcript':_0x547abc,'confidence':_0x200b19};})[_0x6263('0x4b')](function(_0x6adf5c){logger[_0x6263('0x1a')](_0x6263('0x4c'),_0x6adf5c[_0x6263('0x14')],_0x6adf5c[_0x6263('0x4d')],_0x6adf5c[_0x6263('0x4e')]);});};exports[_0x6263('0x4f')]=function(_0x344d18,_0x4d012a,_0x27cd27,_0x23a098){var _0x1b6f51=apiai(_0x4d012a,{'language':_0x23a098||'en'});return _0x1b6f51[_0x6263('0x50')](_0x27cd27,{'sessionId':md5(_0x344d18)})[_0x6263('0x2b')](function(_0xb8ecd8){logger[_0x6263('0x24')](JSON[_0x6263('0x51')](_0xb8ecd8));return{'source':_0xb8ecd8[_0x6263('0x52')][_0x6263('0x53')],'resolvedQuery':_0xb8ecd8['result'][_0x6263('0x54')],'action':_0xb8ecd8[_0x6263('0x52')]['action'],'actionIncomplete':_0xb8ecd8['result'][_0x6263('0x55')],'speech':_0xb8ecd8[_0x6263('0x52')][_0x6263('0x56')][_0x6263('0x57')],'score':_0xb8ecd8['result'][_0x6263('0x58')],'statusCode':_0xb8ecd8[_0x6263('0x59')][_0x6263('0x5a')],'endConversation':_0xb8ecd8[_0x6263('0x52')][_0x6263('0x5b')][_0x6263('0x5c')]||![],'isFallbackIntent':_0xb8ecd8[_0x6263('0x52')][_0x6263('0x5b')][_0x6263('0x5d')]};});};exports[_0x6263('0x5e')]=function(_0x42f482,_0x47be39,_0x1874ea,_0x4213bf){return tilde[_0x6263('0x41')](_0x42f482,_0x47be39,_0x1874ea,_0x4213bf)[_0x6263('0x2b')](function(_0x51b675){try{fs[_0x6263('0x1b')](_0x42f482);}catch(_0x15dcf2){logger[_0x6263('0x1a')](_0x15dcf2);}logger[_0x6263('0x24')](_0x6263('0x5f'),_0x51b675[_0x6263('0x46')]);logger['info'](_0x6263('0x60'),_0x51b675['confidence']);return _0x51b675;});};exports[_0x6263('0x61')]=function(_0x316b28,_0x399484,_0x58cc8c,_0x30f6c5,_0x57a40b,_0x4a8f){var _0x119d5a=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+_0x6263('0x3a'));var _0x4d357a;return aws[_0x6263('0x62')](_0x316b28,_0x399484,_0x58cc8c,_0x30f6c5,_0x57a40b,_0x4a8f,_0x119d5a)[_0x6263('0x2b')](function(){_0x4d357a=path['resolve'](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+'.wav');return convertFile(_0x119d5a,_0x4d357a);})[_0x6263('0x2b')](function(){try{fs['unlink'](_0x119d5a);fs[_0x6263('0x3c')](_0x4d357a,_0x6263('0x2c'));}catch(_0x57c65f){logger[_0x6263('0x1a')](_0x57c65f);}return _0x4d357a[_0x6263('0x2d')]('.')[0x0];});};exports[_0x6263('0x63')]=function(_0x44a897,_0x2479e1,_0x3f13dc,_0x447102,_0x219421,_0x492709){return aws[_0x6263('0x64')](_0x44a897,_0x2479e1,_0x3f13dc,_0x447102,_0x219421,_0x492709)[_0x6263('0x2b')](function(_0x505c73){logger[_0x6263('0x24')](JSON[_0x6263('0x51')](_0x505c73));return _0x505c73;});};exports[_0x6263('0x65')]=function(_0x2eb29f,_0x554a2b,_0x320549,_0x33e043){var _0x5a45e5=util[_0x6263('0x66')](_0x6263('0x67'),ISPEECH_API,_0x2eb29f,encodeURIComponent(_0x554a2b),_0x320549,_0x33e043);var _0x1f684b=path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs['generate'](0x4)+_0x6263('0x3a'));var _0x15e9a2;return downloadFile(_0x5a45e5,_0x1f684b)['then'](function(){_0x15e9a2=path[_0x6263('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x6263('0x29'));return convertFile(_0x1f684b,_0x15e9a2);})[_0x6263('0x2b')](function(){try{fs['unlink'](_0x1f684b);fs[_0x6263('0x3c')](_0x15e9a2,_0x6263('0x2c'));}catch(_0x4a6965){logger[_0x6263('0x1a')](_0x4a6965);}return _0x15e9a2[_0x6263('0x2d')]('.')[0x0];});};exports[_0x6263('0x68')]=function(_0x171c6e,_0x3ca62c,_0x2bccdd,_0x26fbbe){var _0x2b66b1=util[_0x6263('0x66')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3ca62c,_0x2bccdd,base64Encode(_0x171c6e),_0x26fbbe?util[_0x6263('0x66')]('model=%s',encodeURIComponent(_0x26fbbe)):_0x6263('0x69'));return uploadFile(_0x2b66b1)[_0x6263('0x2b')](function(_0x4f2bca){return querystring[_0x6263('0x6a')](_0x4f2bca);});};exports[_0x6263('0x6b')]=function(_0x1d84ae,_0x334409){return sestek[_0x6263('0x6c')](_0x1d84ae,_0x334409)[_0x6263('0x2b')](function(_0x5baf18){logger[_0x6263('0x24')](JSON[_0x6263('0x51')](_0x5baf18));var _0x52258b={'speech':_0x5baf18[_0x6263('0x6d')],'action':_0x5baf18['channelData']?_0x5baf18[_0x6263('0x6e')][_0x6263('0x6f')]:undefined,'actiondata':_0x5baf18[_0x6263('0x6e')]?_0x5baf18[_0x6263('0x6e')][_0x6263('0x70')]:undefined};if(_0x5baf18[_0x6263('0x6e')]&&_0x5baf18[_0x6263('0x6e')][_0x6263('0x71')]){return base64Decode(_0x5baf18[_0x6263('0x6e')]['AudioFromTts'][_0x6263('0x72')],path[_0x6263('0x27')](__dirname,_0x6263('0x28'),rs[_0x6263('0x39')](0x4)+_0x6263('0x29')))['then'](function(_0x3d19fe){_0x52258b[_0x6263('0x73')]=_0x3d19fe;return _0x52258b;});}return _0x52258b;});};exports['dirName']=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 8f34e03..c953254 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0xff3c=['./nda'];(function(_0x37a2a5,_0xac0ca2){var _0x54f3b1=function(_0x5a0c7a){while(--_0x5a0c7a){_0x37a2a5['push'](_0x37a2a5['shift']());}};_0x54f3b1(++_0xac0ca2);}(_0xff3c,0x178));var _0xcff3=function(_0x19f048,_0x4fe3fa){_0x19f048=_0x19f048-0x0;var _0xda5df8=_0xff3c[_0x19f048];return _0xda5df8;};var nda=require(_0xcff3('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 41bfdc0..7d1ce19 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 _0x9d70=['CustomActionData','info','request-promise','../../../../../config/logger','agi','exports','/token','password','username','POST','resolve','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data'];(function(_0x5dc2f3,_0x2481c9){var _0x5f0b04=function(_0x5d3139){while(--_0x5d3139){_0x5dc2f3['push'](_0x5dc2f3['shift']());}};_0x5f0b04(++_0x2481c9);}(_0x9d70,0xa4));var _0x09d7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9d70[_0x40a045];return _0x1a687c;};'use strict';var rp=require(_0x09d7('0x0'));var url=require('url');var logger=require(_0x09d7('0x1'))(_0x09d7('0x2'));module[_0x09d7('0x3')]=function(_0x257f27,_0x591d28){var _0x232325={'method':'POST','uri':url['resolve'](_0x591d28['ndauth_url'],_0x09d7('0x4')),'form':{'grant_type':_0x09d7('0x5'),'username':_0x591d28[_0x09d7('0x6')],'password':_0x591d28[_0x09d7('0x5')]},'json':!![]};return rp(_0x232325)['then'](function(_0x180fc3){var _0xc398ee={'method':_0x09d7('0x7'),'uri':url[_0x09d7('0x8')](_0x591d28[_0x09d7('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x591d28[_0x09d7('0xa')]||_0x09d7('0xb'),'channelId':'Nda','conversation':{'id':_0x257f27[_0x09d7('0xc')]},'from':{'id':_0x257f27[_0x09d7('0xd')],'name':_0x257f27[_0x09d7('0xe')]},'recipient':{'id':_0x257f27[_0x09d7('0xf')],'name':_0x257f27['extension']},'text':_0x591d28[_0x09d7('0x10')],'channelData':{}},'headers':{'Authorization':_0x09d7('0x11')+_0x180fc3[_0x09d7('0x12')]},'json':!![]};if(_0x591d28[_0x09d7('0x13')]){_0xc398ee['body'][_0x09d7('0x14')]['ProjectName']=_0x591d28[_0x09d7('0x13')];}if(_0x591d28['ndagenerate_audio']=='1'){_0xc398ee['body']['channelData'][_0x09d7('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x09d7('0x16')};}if(_0x591d28[_0x09d7('0x17')]){_0xc398ee['body'][_0x09d7('0x14')]['CustomAction']=_0x591d28[_0x09d7('0x17')];if(_0x591d28[_0x09d7('0x18')]){_0xc398ee['body']['channelData'][_0x09d7('0x19')]=_0x591d28[_0x09d7('0x18')];}}logger[_0x09d7('0x1a')](JSON['stringify'](_0xc398ee));return rp(_0xc398ee);});}; \ No newline at end of file +var _0x7a22=['ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','channelData','ProjectName','project'];(function(_0x3a0d64,_0xa99d32){var _0xd2b8dc=function(_0x4aeb2d){while(--_0x4aeb2d){_0x3a0d64['push'](_0x3a0d64['shift']());}};_0xd2b8dc(++_0xa99d32);}(_0x7a22,0x153));var _0x27a2=function(_0x73fdfe,_0x160a9c){_0x73fdfe=_0x73fdfe-0x0;var _0x2854b7=_0x7a22[_0x73fdfe];return _0x2854b7;};'use strict';var rp=require(_0x27a2('0x0'));var url=require(_0x27a2('0x1'));var logger=require(_0x27a2('0x2'))(_0x27a2('0x3'));module[_0x27a2('0x4')]=function(_0x83f28f,_0x12dda9){var _0x1fc73c={'method':_0x27a2('0x5'),'uri':url[_0x27a2('0x6')](_0x12dda9[_0x27a2('0x7')],'/token'),'form':{'grant_type':_0x27a2('0x8'),'username':_0x12dda9['username'],'password':_0x12dda9['password']},'json':!![]};return rp(_0x1fc73c)[_0x27a2('0x9')](function(_0x451701){var _0x4c7021={'method':_0x27a2('0x5'),'uri':url[_0x27a2('0x6')](_0x12dda9[_0x27a2('0xa')],_0x27a2('0xb')),'body':{'type':_0x12dda9['ndaactivity_type']||_0x27a2('0xc'),'channelId':_0x27a2('0xd'),'conversation':{'id':_0x83f28f[_0x27a2('0xe')]},'from':{'id':_0x83f28f[_0x27a2('0xf')],'name':_0x83f28f[_0x27a2('0x10')]},'recipient':{'id':_0x83f28f[_0x27a2('0x11')],'name':_0x83f28f[_0x27a2('0x12')]},'text':_0x12dda9[_0x27a2('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x451701[_0x27a2('0x14')]},'json':!![]};if(_0x12dda9['project']){_0x4c7021['body'][_0x27a2('0x15')][_0x27a2('0x16')]=_0x12dda9[_0x27a2('0x17')];}if(_0x12dda9[_0x27a2('0x18')]=='1'){_0x4c7021[_0x27a2('0x19')][_0x27a2('0x15')][_0x27a2('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x27a2('0x1b')};}if(_0x12dda9[_0x27a2('0x1c')]){_0x4c7021[_0x27a2('0x19')]['channelData'][_0x27a2('0x1d')]=_0x12dda9[_0x27a2('0x1c')];if(_0x12dda9[_0x27a2('0x1e')]){_0x4c7021[_0x27a2('0x19')][_0x27a2('0x15')]['CustomActionData']=_0x12dda9[_0x27a2('0x1e')];}}logger[_0x27a2('0x1f')](JSON[_0x27a2('0x20')](_0x4c7021));return rp(_0x4c7021);});}; \ 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 393c063..ae3e08f 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 _0xd1ba=['./lib/api'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0xd1ba,0x9e));var _0xad1b=function(_0xc111f,_0x22e566){_0xc111f=_0xc111f-0x0;var _0x29c036=_0xd1ba[_0xc111f];return _0x29c036;};'use strict';var asr=require(_0xad1b('0x0'));module['exports']=function(_0x21fd13,_0x86c9f2,_0x1d63bd,_0x20cbfb){return asr(_0x21fd13,_0x86c9f2,_0x1d63bd,_0x20cbfb);}; \ No newline at end of file +var _0x7fcd=['exports','./lib/api'];(function(_0x29b1b8,_0x1ee51a){var _0xcd1de2=function(_0x2ef57d){while(--_0x2ef57d){_0x29b1b8['push'](_0x29b1b8['shift']());}};_0xcd1de2(++_0x1ee51a);}(_0x7fcd,0x195));var _0xd7fc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7fcd[_0x2641f9];return _0x585741;};'use strict';var asr=require(_0xd7fc('0x0'));module[_0xd7fc('0x1')]=function(_0x5ea659,_0xf75eb4,_0x873935,_0x504a65){return asr(_0x5ea659,_0xf75eb4,_0x873935,_0x504a65);}; \ 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 2a1fd90..60cd41c 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 _0x0b15=['Tilde\x20ASR\x20send\x20error','terminate','status','final','result','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error'];(function(_0xc451a0,_0x45b19b){var _0x445be7=function(_0x563cfd){while(--_0x563cfd){_0xc451a0['push'](_0xc451a0['shift']());}};_0x445be7(++_0x45b19b);}(_0x0b15,0x1a2));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x50b1('0x0'));var _=require(_0x50b1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x50b1('0x2'));var crypto=require(_0x50b1('0x3'));var logger=require(_0x50b1('0x4'))(_0x50b1('0x5'));module[_0x50b1('0x6')]=function(_0x3d10dc,_0x45080a,_0x4131cb,_0x288e06){return new BPromise(function(_0x3a6ab6,_0x902956){logger[_0x50b1('0x7')](_0x50b1('0x8'),_0x288e06||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x35b385=new WebSocket(_0x288e06||_0x50b1('0x9'),{'perMessageDeflate':![]});var _0x390330='';var _0x601a7='0';var _0x26f1d2='1';var _0x395cb6=_0x50b1('0xa');function _0x4ac64a(_0x2da2f0){var _0x5de155=crypto[_0x50b1('0xb')]('sha1');_0x5de155[_0x50b1('0xc')](_0x2da2f0);return _0x5de155['digest']('hex');}function _0x10ba1a(){try{logger[_0x50b1('0x7')](_0x50b1('0xd'));var _0x286d09=moment()[_0x50b1('0xe')]();var _0x5a87db=_0x4ac64a(_0x286d09+_0x45080a+_0x4131cb);_0x35b385['send'](JSON[_0x50b1('0xf')]({'appID':_0x45080a,'timestamp':_0x286d09,'appKey':_0x5a87db}));var _0x196247=fs[_0x50b1('0x10')](_0x3d10dc);_0x196247['on'](_0x50b1('0x11'),function(_0xac9c96){_0x35b385[_0x50b1('0x12')](_0xac9c96);});_0x196247['on'](_0x50b1('0x13'),function(){_0x35b385[_0x50b1('0x12')](_0x50b1('0x14'));});}catch(_0x136cf6){logger[_0x50b1('0x15')](_0x50b1('0x16'),JSON[_0x50b1('0xf')](_0x136cf6));_0x35b385[_0x50b1('0x17')]();}}function _0x2eb99d(_0x1cacc5){try{if(_0x1cacc5){var _0x7a1902=JSON['parse'](_0x1cacc5);switch(_0x7a1902[_0x50b1('0x18')]){case 0x0:if(_0x7a1902['result']){if(_0x7a1902['result'][_0x50b1('0x19')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x7a1902[_0x50b1('0x1a')][_0x50b1('0x1b')]));_0x390330=_0x7a1902['result']['hypotheses'][0x0][_0x50b1('0x1c')];_0x601a7=_0x7a1902['result'][_0x50b1('0x1b')][0x0][_0x50b1('0x1d')];_0x26f1d2='0';_0x395cb6='Success.';_0x35b385[_0x50b1('0x17')]();}}break;case 0x1:logger['info'](_0x50b1('0xa'));_0x26f1d2='1';_0x395cb6=_0x50b1('0xa');break;case 0x2:logger['info'](_0x50b1('0x1e'));_0x26f1d2='2';_0x395cb6=_0x50b1('0x1e');break;case 0x9:logger[_0x50b1('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x26f1d2='9';_0x395cb6=_0x50b1('0x1f');break;case 0xa:logger[_0x50b1('0x7')]('Authentication\x20failed.');_0x26f1d2='10';_0x395cb6=_0x50b1('0x20');break;case 0xb:logger[_0x50b1('0x7')](_0x50b1('0x21'));_0x26f1d2='11';_0x395cb6='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2c8809){logger[_0x50b1('0x15')](_0x50b1('0x22'),JSON[_0x50b1('0xf')](_0x2c8809));_0x35b385[_0x50b1('0x17')]();}}function _0x435820(){logger[_0x50b1('0x7')](_0x50b1('0x23'));_0x3a6ab6({'transcript':_0x390330,'confidence':_0x601a7,'status':_0x26f1d2,'status_message':_0x395cb6});}function _0x38e637(_0x5c945e){logger[_0x50b1('0x15')](_0x50b1('0x24'));if(!_['isNil'](_0x5c945e)){logger[_0x50b1('0x15')](_[_0x50b1('0x25')](_0x5c945e)?JSON['stringify'](_0x5c945e):_0x5c945e);}}_0x35b385['on'](_0x50b1('0x26'),_0x10ba1a);_0x35b385['on'](_0x50b1('0x27'),_0x2eb99d);_0x35b385['on'](_0x50b1('0x13'),_0x435820);_0x35b385['on'](_0x50b1('0x15'),_0x38e637);});}; \ No newline at end of file +var _0x7276=['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','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7276,0x16a));var _0x6727=function(_0x23a50c,_0x58fd75){_0x23a50c=_0x23a50c-0x0;var _0x157481=_0x7276[_0x23a50c];return _0x157481;};'use strict';var BPromise=require(_0x6727('0x0'));var _=require(_0x6727('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6727('0x2'));var crypto=require(_0x6727('0x3'));var logger=require(_0x6727('0x4'))(_0x6727('0x5'));module[_0x6727('0x6')]=function(_0x37a3ab,_0x48948f,_0x3f509a,_0x49f0c8){return new BPromise(function(_0x1fc5cf,_0x3a7b4f){logger[_0x6727('0x7')](_0x6727('0x8'),_0x49f0c8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3a8e29=new WebSocket(_0x49f0c8||_0x6727('0x9'),{'perMessageDeflate':![]});var _0x261a3b='';var _0x18e976='0';var _0x741c27='1';var _0x4bb0ba=_0x6727('0xa');function _0xa37ba(_0x1f7b8e){var _0x4d5404=crypto[_0x6727('0xb')](_0x6727('0xc'));_0x4d5404[_0x6727('0xd')](_0x1f7b8e);return _0x4d5404[_0x6727('0xe')](_0x6727('0xf'));}function _0x702585(){try{logger[_0x6727('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x4eaaee=moment()[_0x6727('0x10')]();var _0x29f57f=_0xa37ba(_0x4eaaee+_0x48948f+_0x3f509a);_0x3a8e29[_0x6727('0x11')](JSON[_0x6727('0x12')]({'appID':_0x48948f,'timestamp':_0x4eaaee,'appKey':_0x29f57f}));var _0x1feef6=fs[_0x6727('0x13')](_0x37a3ab);_0x1feef6['on']('data',function(_0x344cdd){_0x3a8e29[_0x6727('0x11')](_0x344cdd);});_0x1feef6['on'](_0x6727('0x14'),function(){_0x3a8e29[_0x6727('0x11')](_0x6727('0x15'));});}catch(_0x5f00e4){logger[_0x6727('0x16')](_0x6727('0x17'),JSON[_0x6727('0x12')](_0x5f00e4));_0x3a8e29[_0x6727('0x18')]();}}function _0x1f639b(_0x5c403b){try{if(_0x5c403b){var _0x12563f=JSON['parse'](_0x5c403b);switch(_0x12563f[_0x6727('0x19')]){case 0x0:if(_0x12563f[_0x6727('0x1a')]){if(_0x12563f[_0x6727('0x1a')][_0x6727('0x1b')]){logger[_0x6727('0x7')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x12563f[_0x6727('0x1a')][_0x6727('0x1c')]));_0x261a3b=_0x12563f['result'][_0x6727('0x1c')][0x0][_0x6727('0x1d')];_0x18e976=_0x12563f['result'][_0x6727('0x1c')][0x0][_0x6727('0x1e')];_0x741c27='0';_0x4bb0ba=_0x6727('0x1f');_0x3a8e29[_0x6727('0x18')]();}}break;case 0x1:logger['info'](_0x6727('0xa'));_0x741c27='1';_0x4bb0ba=_0x6727('0xa');break;case 0x2:logger['info'](_0x6727('0x20'));_0x741c27='2';_0x4bb0ba=_0x6727('0x20');break;case 0x9:logger[_0x6727('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x741c27='9';_0x4bb0ba=_0x6727('0x21');break;case 0xa:logger['info'](_0x6727('0x22'));_0x741c27='10';_0x4bb0ba=_0x6727('0x22');break;case 0xb:logger[_0x6727('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x741c27='11';_0x4bb0ba=_0x6727('0x23');}}}catch(_0x51a8c1){logger[_0x6727('0x16')](_0x6727('0x24'),JSON['stringify'](_0x51a8c1));_0x3a8e29[_0x6727('0x18')]();}}function _0x35c6ea(){logger[_0x6727('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0x1fc5cf({'transcript':_0x261a3b,'confidence':_0x18e976,'status':_0x741c27,'status_message':_0x4bb0ba});}function _0x45bfc7(_0x503c04){logger['error'](_0x6727('0x25'));if(!_[_0x6727('0x26')](_0x503c04)){logger[_0x6727('0x16')](_['isObject'](_0x503c04)?JSON['stringify'](_0x503c04):_0x503c04);}}_0x3a8e29['on'](_0x6727('0x27'),_0x702585);_0x3a8e29['on'](_0x6727('0x28'),_0x1f639b);_0x3a8e29['on'](_0x6727('0x14'),_0x35c6ea);_0x3a8e29['on'](_0x6727('0x16'),_0x45bfc7);});}; \ 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 e7e8a3f..61d8673 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 _0xd8a2=['./asr','exports'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0xd8a2,0x128));var _0x2d8a=function(_0x590f2a,_0x49f22c){_0x590f2a=_0x590f2a-0x0;var _0x59a1c9=_0xd8a2[_0x590f2a];return _0x59a1c9;};var asr=require(_0x2d8a('0x0'));module[_0x2d8a('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe296=['exports','./asr'];(function(_0x49ed35,_0x12ec79){var _0xe5e136=function(_0x4592d8){while(--_0x4592d8){_0x49ed35['push'](_0x49ed35['shift']());}};_0xe5e136(++_0x12ec79);}(_0xe296,0x1d1));var _0x6e29=function(_0x3a49b1,_0x29d467){_0x3a49b1=_0x3a49b1-0x0;var _0x438755=_0xe296[_0x3a49b1];return _0x438755;};var asr=require(_0x6e29('0x0'));module[_0x6e29('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index bc8f733..2ae26e2 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 _0x98e1=['listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','error','E_AGI_SERVER_MAXCONNECTION','destroy','close','E_AGI_SERVER_CLOSE','nextTick','inherits','net','events','EventEmitter','./error','call','emit','E_AGI_ARGUMENT_PORT','createServer'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x98e1,0x160));var _0x198e=function(_0x5b1bbc,_0x98e6c3){_0x5b1bbc=_0x5b1bbc-0x0;var _0x424fb4=_0x98e1[_0x5b1bbc];return _0x424fb4;};'use strict';var util=require('util');var net=require(_0x198e('0x0'));var EventEmitter=require(_0x198e('0x1'))[_0x198e('0x2')];var AGIError=require(_0x198e('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x300c4b,_0x4e997a,_0x4a102f){var _0x3bd989=this,_0x300c4b=_0x300c4b||0x11dd,_0x4e997a=_0x4e997a||'127.0.0.1',_0x317209=null,_0x551d31=0x0;EventEmitter[_0x198e('0x4')](_0x3bd989);function _0x4d45d6(){if(!_0x300c4b){_0x3bd989[_0x198e('0x5')]('error',new AGIError(_0x198e('0x6')));return![];}_0x317209=net[_0x198e('0x7')]();_0x317209[_0x198e('0x8')](_0x300c4b,_0x4e997a);_0x317209['on'](_0x198e('0x9'),function(){_0x3bd989[_0x198e('0x5')](_0x198e('0x9'));});_0x317209['on'](_0x198e('0xa'),function(_0x162604){_0x317209[_0x198e('0xb')](function(_0x5be755,_0x33e0a5){if(_0x5be755){_0x3bd989[_0x198e('0x5')]('error',new AGIError(_0x198e('0xc'),_0x5be755));}else if(_0x4a102f&&_0x4a102f<0x0){_0x3bd989['emit'](_0x198e('0xd'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x162604['destroy']();}else if(_0x4a102f&&_0x4a102f>0x0&&_0x4a102f<_0x33e0a5){_0x551d31+=0x1;_0x3bd989['emit']('error',new AGIError(_0x198e('0xe'),_0x551d31));_0x162604[_0x198e('0xf')]();}else{var _0x10d24e=new AGIChannel(_0x162604);_0x10d24e['on']('ready',function(){_0x3bd989[_0x198e('0x5')](_0x198e('0xa'),_0x10d24e);});}});});_0x317209['on'](_0x198e('0xd'),function(_0x5035de){_0x3bd989['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0x5035de['code']));});_0x317209['on'](_0x198e('0x10'),function(){_0x3bd989['emit']('close',new AGIError(_0x198e('0x11')));});}process[_0x198e('0x12')](function(){_0x4d45d6();});};util[_0x198e('0x13')](AGIServer,EventEmitter);module['exports']=function(_0x7742f1,_0x3679aa,_0x2fdc34){return new AGIServer(_0x7742f1,_0x3679aa,_0x2fdc34);}; \ No newline at end of file +var _0xb634=['destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','exports','util','events','EventEmitter','./error','127.0.0.1','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x5956a3,_0x3304c3){var _0x5bafcc=function(_0x44846e){while(--_0x44846e){_0x5956a3['push'](_0x5956a3['shift']());}};_0x5bafcc(++_0x3304c3);}(_0xb634,0x1c0));var _0x4b63=function(_0x290897,_0x38c217){_0x290897=_0x290897-0x0;var _0x148b43=_0xb634[_0x290897];return _0x148b43;};'use strict';var util=require(_0x4b63('0x0'));var net=require('net');var EventEmitter=require(_0x4b63('0x1'))[_0x4b63('0x2')];var AGIError=require(_0x4b63('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x4275a4,_0x44edec,_0x46f93e){var _0x354f62=this,_0x4275a4=_0x4275a4||0x11dd,_0x44edec=_0x44edec||_0x4b63('0x4'),_0x47abe1=null,_0x57fba1=0x0;EventEmitter['call'](_0x354f62);function _0x315fa5(){if(!_0x4275a4){_0x354f62['emit'](_0x4b63('0x5'),new AGIError(_0x4b63('0x6')));return![];}_0x47abe1=net['createServer']();_0x47abe1[_0x4b63('0x7')](_0x4275a4,_0x44edec);_0x47abe1['on'](_0x4b63('0x8'),function(){_0x354f62[_0x4b63('0x9')]('listening');});_0x47abe1['on'](_0x4b63('0xa'),function(_0x31fb1d){_0x47abe1[_0x4b63('0xb')](function(_0x217de0,_0x27f75b){if(_0x217de0){_0x354f62[_0x4b63('0x9')](_0x4b63('0x5'),new AGIError(_0x4b63('0xc'),_0x217de0));}else if(_0x46f93e&&_0x46f93e<0x0){_0x354f62[_0x4b63('0x9')](_0x4b63('0x5'),new AGIError(_0x4b63('0xd')));_0x31fb1d[_0x4b63('0xe')]();}else if(_0x46f93e&&_0x46f93e>0x0&&_0x46f93e<_0x27f75b){_0x57fba1+=0x1;_0x354f62['emit'](_0x4b63('0x5'),new AGIError(_0x4b63('0xf'),_0x57fba1));_0x31fb1d[_0x4b63('0xe')]();}else{var _0x1d0374=new AGIChannel(_0x31fb1d);_0x1d0374['on'](_0x4b63('0x10'),function(){_0x354f62[_0x4b63('0x9')](_0x4b63('0xa'),_0x1d0374);});}});});_0x47abe1['on']('error',function(_0x975c4b){_0x354f62['emit'](_0x4b63('0x5'),new AGIError(_0x4b63('0xc'),_0x975c4b[_0x4b63('0x11')]));});_0x47abe1['on'](_0x4b63('0x12'),function(){_0x354f62[_0x4b63('0x9')](_0x4b63('0x12'),new AGIError(_0x4b63('0x13')));});}process['nextTick'](function(){_0x315fa5();});};util['inherits'](AGIServer,EventEmitter);module[_0x4b63('0x14')]=function(_0x54ad7b,_0x2b58a8,_0x4021cf){return new AGIServer(_0x54ad7b,_0x2b58a8,_0x4021cf);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 12b83ba..e5234f3 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 _0xe617=['Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','isString','saveRestApiResult','%s.%s','length','setVariable','replaceall\x20init','split','nextbracket','replaceAll','extra','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','list_id','no\x20list\x20selected','add','delay','minutes','callback_priority','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','sayNumber','number','sayphonetic','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','auth','pass','template_id','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\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','127.0.0.1','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','util','shelljs','randomstring','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','has','dialTimezone','isNil','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','phone','RETVALRPC','TZ\x20found\x20in\x20shared:','isEmpty','callback_','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','en-US','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','includes','PUT','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','parse','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','text','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_polly_voice'];(function(_0x22d11c,_0x54433f){var _0xce6637=function(_0x212182){while(--_0x212182){_0x22d11c['push'](_0x22d11c['shift']());}};_0xce6637(++_0x54433f);}(_0xe617,0x13f));var _0x7e61=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe617[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0x7e61('0x0'));var util=require(_0x7e61('0x1'));var _=require('lodash');var sh=require(_0x7e61('0x2'));var odbc=require('odbc')();var rs=require(_0x7e61('0x3'));var moment=require('moment');var Mustache=require(_0x7e61('0x4'));var rp=require('request-promise');var logger=require(_0x7e61('0x5'))(_0x7e61('0x6'));var config=require(_0x7e61('0x7'));var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH=_0x7e61('0x8');var recursiveMapAttributes=[_0x7e61('0x9'),_0x7e61('0xa')];var verticesWithRetry=[_0x7e61('0xb'),_0x7e61('0xc'),_0x7e61('0xd')];var AGIVertices=function(_0x496825,_0x4c328c,_0x3eebb3){this[_0x7e61('0xe')]=_0x496825;this[_0x7e61('0xf')]=_0x4c328c;this['mailRpc']=_0x3eebb3;};AGIVertices[_0x7e61('0x10')][_0x7e61('0x11')]=function(_0xeca44a,_0x29ab46){this[_0x7e61('0xf')][_0x7e61('0x12')](_0xeca44a)['then'](function(_0x2ca227){_0x29ab46(null,_0x2ca227?_0x2ca227[_0x7e61('0x13')]:![]);})[_0x7e61('0x14')](function(_0x15fe52){_0x29ab46(_0x15fe52);});};AGIVertices['prototype'][_0x7e61('0x15')]=function(_0x41c665,_0xe2e3ef){this['rpc'][_0x7e61('0x16')](_0x41c665)['then'](function(_0x180d8e){_0xe2e3ef(null,_0x180d8e?_0x180d8e[_0x7e61('0x13')]:![]);})[_0x7e61('0x14')](function(_0x39f6df){_0xe2e3ef(_0x39f6df);});};AGIVertices['prototype']['getSquareProject']=function(_0x4cc495,_0x46cec6){this[_0x7e61('0xf')]['getSquareProjectById'](_0x4cc495)[_0x7e61('0x17')](function(_0x5d40a2){_0x46cec6(null,_0x5d40a2?_0x5d40a2[_0x7e61('0x13')]:![]);})['catch'](function(_0x49e1b7){_0x46cec6(_0x49e1b7);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x18')]=function(_0x2f8236,_0x2063d3){this[_0x7e61('0xf')][_0x7e61('0x19')](_0x2f8236)['then'](function(_0x429f5b){_0x2063d3(null,_0x429f5b?_0x429f5b[_0x7e61('0x1a')]:![]);})[_0x7e61('0x14')](function(_0x53fb98){_0x2063d3(_0x53fb98);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1b')]=function(_0x340b9c,_0x56bb63){this[_0x7e61('0xf')][_0x7e61('0x1c')](_0x340b9c)['then'](function(_0x5f1a01){_0x56bb63(null,_0x5f1a01?_0x5f1a01[_0x7e61('0x13')]:![]);})['catch'](function(_0x3a5509){_0x56bb63(_0x3a5509);});};AGIVertices['prototype'][_0x7e61('0x1d')]=function(_0x49c558,_0x4e581d){this[_0x7e61('0xf')][_0x7e61('0x1e')](_0x49c558)[_0x7e61('0x17')](function(_0xc3f1b8){_0x4e581d(null,_0xc3f1b8?_0xc3f1b8[_0x7e61('0x13')]:![]);})['catch'](function(_0x4f509f){_0x4e581d(_0x4f509f);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1f')]=function(_0x450ecb,_0x1fde9a){var _0x155afe=this;this[_0x7e61('0xf')]['getSoundById'](_0x450ecb)[_0x7e61('0x17')](function(_0x4e6da9){_0x1fde9a(null,_0x4e6da9?_0x155afe[_0x7e61('0x20')](_0x4e6da9[_0x7e61('0x21')]):![]);})['catch'](function(_0x47da8d){_0x1fde9a(_0x47da8d);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x22')]=function(_0x1f115a,_0x502c92){this[_0x7e61('0xf')][_0x7e61('0x23')](_0x1f115a)[_0x7e61('0x17')](function(_0x4b212e){_0x502c92(null,_0x4b212e?_0x4b212e:![]);})[_0x7e61('0x14')](function(_0x1cef05){_0x502c92(_0x1cef05);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x24')]=function(_0x1508cd,_0x33f52c,_0x2bbfe7){this['mailRpc'][_0x7e61('0x24')](_0x1508cd,_0x33f52c)['then'](function(){_0x2bbfe7(null);})[_0x7e61('0x14')](function(_0x21107a){_0x2bbfe7(_0x21107a);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x25')]=function(_0x33ff03,_0x252705){this[_0x7e61('0xf')][_0x7e61('0x26')](_0x33ff03)['then'](function(_0x2500b3){if(_0x2500b3){if(_0x2500b3[_0x7e61('0x27')]){_0x252705(null,[_0x2500b3[_0x7e61('0x28')]]);}else{_0x252705(null,_[_0x7e61('0x29')](_0x2500b3[_0x7e61('0x2a')],_0x7e61('0x28')));}}else{_0x252705(null,![]);}})[_0x7e61('0x14')](function(_0x4e6d65){_0x252705(_0x4e6d65);});};AGIVertices['prototype'][_0x7e61('0x20')]=function(_0x37d9d8){return util[_0x7e61('0x2b')](_0x7e61('0x2c'),FILES_PATH,_0x37d9d8);};AGIVertices[_0x7e61('0x10')][_0x7e61('0x2d')]=function(_0x5c0b8e,_0x115006,_0x3ceb83){odbc[_0x7e61('0x2e')](_0x5c0b8e,function(_0x1df36e){if(_0x1df36e){logger[_0x7e61('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x1df36e);_0x3ceb83(_0x1df36e);}else{logger[_0x7e61('0x30')]('ODBC\x20connection\x20successfully');odbc[_0x7e61('0x31')](_0x115006,function(_0x2da972,_0x20acc4){if(_0x2da972){logger[_0x7e61('0x30')]('Error\x20executing\x20query\x20%s',_0x115006);_0x3ceb83(_0x2da972);}else{logger[_0x7e61('0x30')](_0x7e61('0x32'),_0x115006);odbc[_0x7e61('0x33')](function(_0x358fd2){if(_0x358fd2){logger['error'](_0x7e61('0x34'),_0x358fd2);}_0x3ceb83(null,_0x20acc4);});}});}});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x35')]=function(_0x394e3d,_0x4d9a07){this['rpc']['getSmsAccountById'](_0x394e3d)[_0x7e61('0x17')](function(_0x2096ff){_0x4d9a07(null,_0x2096ff?_0x2096ff:![]);})[_0x7e61('0x14')](function(_0x1f522d){_0x4d9a07(_0x1f522d);});};AGIVertices[_0x7e61('0x10')]['createSmsMessage']=function(_0x53b075,_0x146a89){this[_0x7e61('0xf')][_0x7e61('0x36')](_0x53b075)[_0x7e61('0x17')](function(_0x59f64a){_0x146a89(null,_0x59f64a);})[_0x7e61('0x14')](function(_0x273ba6){_0x146a89(_0x273ba6);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x37')]=function(_0x236519,_0x523b70,_0x5695a3){this[_0x7e61('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0x7e61('0xe')][_0x7e61('0x38')],'node':_0x236519['label'],'application':_0x236519[_0x7e61('0x39')],'data':_0x523b70||null,'project_name':this[_0x7e61('0xe')][_0x7e61('0x3a')],'callerid':this[_0x7e61('0xe')][_0x7e61('0x3b')]})[_0x7e61('0x17')](function(_0x16f876){if(_0x5695a3){_0x5695a3(null,_0x16f876);}})['catch'](function(_0x2a74cb){if(_0x5695a3){_0x5695a3(_0x2a74cb);}});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x3c')]=function(_0x47ee07,_0x4d378e,_0x298be1,_0x3c0e4d){this[_0x7e61('0xf')]['createSquareRecording']({'uniqueid':this[_0x7e61('0xe')][_0x7e61('0x38')],'callerid':this['channel'][_0x7e61('0x3b')],'calleridname':this['channel'][_0x7e61('0x3d')],'context':this[_0x7e61('0xe')][_0x7e61('0x3e')],'extension':this[_0x7e61('0xe')][_0x7e61('0x3f')],'priority':this[_0x7e61('0xe')]['priority'],'accountcode':this[_0x7e61('0xe')][_0x7e61('0x40')],'dnid':this['channel'][_0x7e61('0x41')],'projectName':this[_0x7e61('0xe')][_0x7e61('0x3a')],'saveName':_0x4d378e,'filename':_0x47ee07[_0x7e61('0x42')]||_0x4d378e,'savePath':_0x298be1})['then'](function(_0x47b9b2){_0x3c0e4d(null,_0x47b9b2);})[_0x7e61('0x14')](function(_0x25be6c){_0x3c0e4d(_0x25be6c);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x43')]=function(_0x394519,_0x3496e1,_0x15fab4){this[_0x7e61('0xf')][_0x7e61('0x43')]({'uniqueid':this[_0x7e61('0xe')]['uniqueid'],'body':_0x394519,'direction':_0x3496e1})['then'](function(_0x1938c4){if(_0x15fab4){_0x15fab4(null,_0x1938c4);}})['catch'](function(_0x197e4f){if(_0x15fab4){_0x15fab4(_0x197e4f);}});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x44')]=function(_0x21b001,_0x4fe577){console[_0x7e61('0x45')](_0x7e61('0x46'),_0x21b001);console[_0x7e61('0x45')]('in\x20createcmcontact\x20callback',_0x4fe577);var _0x5cd631=0x0;if(_[_0x7e61('0x47')](_0x21b001,_0x7e61('0x48'))){if(!_[_0x7e61('0x49')](_0x21b001[_0x7e61('0x48')])){var _0x5011f1=_0x21b001[_0x7e61('0x48')];console[_0x7e61('0x45')](_0x7e61('0x4a'),_0x5011f1);if(_0x21b001[_0x7e61('0x48')]==_0x7e61('0x4b')){this[_0x7e61('0xf')][_0x7e61('0x4c')]({'phone':_0x21b001[_0x7e61('0x4d')]})[_0x7e61('0x17')](function(_0x1528fb){console[_0x7e61('0x45')](_0x7e61('0x4e'),_0x1528fb);_0x4fe577(null,_0x1528fb);});}else{console[_0x7e61('0x45')](_0x7e61('0x4f'),shared[_0x5011f1]);}}}this['rpc'][_0x7e61('0x44')]({'firstName':_[_0x7e61('0x50')](_0x21b001[_0x7e61('0x13')])||_[_0x7e61('0x49')](_0x21b001[_0x7e61('0x13')])?_0x7e61('0x51')+Math[_0x7e61('0x52')]():_0x21b001[_0x7e61('0x13')],'lastName':_[_0x7e61('0x50')](_0x21b001[_0x7e61('0x53')])||_[_0x7e61('0x49')](_0x21b001[_0x7e61('0x53')])?null:_0x21b001['lastName'],'phone':_0x21b001[_0x7e61('0x4d')],'ListId':_0x21b001['list_id'],'scheduledat':_0x21b001[_0x7e61('0x54')],'callbackUniqueid':this[_0x7e61('0xe')]['uniqueid'],'tags':_0x7e61('0x55'),'description':_0x7e61('0x56')+_0x21b001[_0x7e61('0x54')][_0x7e61('0x57')](),'priority':_0x21b001['callback_priority']})[_0x7e61('0x17')](function(_0xc42603){_0x4fe577(null,_0xc42603);})['catch'](function(_0xaee97a){_0x4fe577(_0xaee97a);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x58')]=function(_0x3afeec,_0x165f91){this['rpc'][_0x7e61('0x59')](_0x3afeec)['then'](function(_0x17787a){_0x165f91(null,_0x17787a?_0x17787a[_0x7e61('0x13')]:![]);})[_0x7e61('0x14')](function(_0x4de728){_0x165f91(_0x4de728);});};AGIVertices[_0x7e61('0x10')]['agentPause']=function(_0x56b5e3,_0x58a495,_0x208c94){var _0x195b9d={'role':_0x7e61('0x5a')};_0x195b9d[_0x56b5e3]=this[_0x7e61('0xe')][_0x7e61('0x3b')];this['rpc'][_0x7e61('0x5b')](_0x195b9d,_0x58a495,this[_0x7e61('0xe')][_0x7e61('0x38')])[_0x7e61('0x17')](function(_0x57fe0c){_0x208c94(null,_[_0x7e61('0x49')](_0x57fe0c)?![]:!![]);})[_0x7e61('0x14')](function(_0x35c590){logger[_0x7e61('0x2f')](_0x35c590);_0x208c94(null,![]);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x5c')]=function(_0x8a6358,_0x3ae80b){var _0xc9fd15={'role':_0x7e61('0x5a')};_0xc9fd15[_0x8a6358]=this[_0x7e61('0xe')][_0x7e61('0x3b')];this[_0x7e61('0xf')]['agentUnpause'](_0xc9fd15)['then'](function(_0x937587){_0x3ae80b(null,_[_0x7e61('0x49')](_0x937587)?![]:!![]);})[_0x7e61('0x14')](function(_0x1f36df){logger[_0x7e61('0x2f')](_0x1f36df);_0x3ae80b(null,![]);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x5d')]=function(_0x348528,_0xa12503){var _0x1db8d2={'role':'agent'};_0x1db8d2[_0x348528]=this['channel'][_0x7e61('0x3b')];this[_0x7e61('0xf')][_0x7e61('0x5d')](_0x1db8d2)['then'](function(_0x2ef11e){_0xa12503(null,_['isNil'](_0x2ef11e)?![]:!![]);})[_0x7e61('0x14')](function(_0x58acae){logger[_0x7e61('0x2f')](_0x58acae);_0xa12503(null,![]);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x5e')]=function(_0x1f6da5,_0x1d1548){var _0x3655b2={'role':'agent'};_0x3655b2[_0x1f6da5]=this[_0x7e61('0xe')][_0x7e61('0x3b')];var _0x3918ed=_0x1f6da5!=_0x7e61('0x5f')?util[_0x7e61('0x2b')](_0x7e61('0x60'),_0x7e61('0x61'),this[_0x7e61('0xe')][_0x7e61('0x3b')]):undefined;this['rpc']['agentLogin'](_0x3655b2,_0x3918ed)[_0x7e61('0x17')](function(_0x350ff8){_0x1d1548(null,_['isNil'](_0x350ff8)?![]:!![]);})['catch'](function(_0x3fddee){logger['error'](_0x3fddee);_0x1d1548(null,![]);});};AGIVertices[_0x7e61('0x10')]['shellCommand']=function(_0xfd80f1,_0x59d909){sh[_0x7e61('0x62')](_[_0x7e61('0x63')](_0xfd80f1),function(_0x32d602,_0x353ab8){var _0x46e5aa=_0x353ab8[_0x7e61('0x64')](/(\r\n|\n|\r)/gm,'');_0x59d909(null,_0x46e5aa);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x65')]=function(_0x351c84,_0x852e8c){scripts[_0x7e61('0x65')](_0x351c84['apiKey'],_0x351c84[_0x7e61('0x66')]||'text',_0x351c84['text'],_0x351c84['languageCode']||_0x7e61('0x67'),_0x351c84['ssmlGender']||_0x7e61('0x68'),_0x351c84[_0x7e61('0x69')]||_0x7e61('0x6a'))[_0x7e61('0x17')](function(_0x450188){_0x852e8c(null,_0x450188);})[_0x7e61('0x14')](function(_0x4e9eb3){_0x852e8c(_0x4e9eb3);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x6b')]=function(_0x29e882,_0x5d34c7){scripts[_0x7e61('0x6b')](_0x29e882['text'],_0x29e882['google_tts_language']||'en',0x1)[_0x7e61('0x17')](function(_0x2af03e){_0x5d34c7(null,_0x2af03e);})[_0x7e61('0x14')](function(_0x404c55){_0x5d34c7(_0x404c55);});};AGIVertices['prototype'][_0x7e61('0x6c')]=function(_0x23b739,_0x39f5b0){var _0x4bfa67={'uri':_0x23b739[_0x7e61('0x6d')],'method':_0x23b739[_0x7e61('0x6e')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x23b739[_0x7e61('0x6f')])==='number'&&parseInt(_0x23b739[_0x7e61('0x6f')])>=0x1?parseInt(_0x23b739[_0x7e61('0x6f')])*0x3e8:0x5*0x3e8};if(_[_0x7e61('0x70')](['POST',_0x7e61('0x71')],_0x4bfa67['method']['toUpperCase']())){try{_0x4bfa67['body']=_0x23b739['rawBody']?JSON['parse'](_0x23b739['rawBody']):{};}catch(_0x5aaca9){logger[_0x7e61('0x2f')](_0x7e61('0x72'),_0x5aaca9);}}try{_0x4bfa67[_0x7e61('0x73')]=_0x23b739[_0x7e61('0x9')]?JSON['parse'](_0x23b739[_0x7e61('0x9')]):{};}catch(_0x52cac8){logger['error'](_0x7e61('0x74'),_0x52cac8);}if(_0x23b739[_0x7e61('0x75')]){try{var _0x5507e8=require(_0x23b739[_0x7e61('0x75')])[_0x7e61('0x76')](this,_0x4bfa67);_0x4bfa67[_0x7e61('0x77')]=Mustache['render'](_0x23b739[_0x7e61('0x6d')],_0x5507e8,{},['$$','$$']);if(_0x4bfa67[_0x7e61('0x73')]){_0x4bfa67[_0x7e61('0x73')]=JSON['parse'](Mustache[_0x7e61('0x78')](JSON[_0x7e61('0x79')](_0x4bfa67[_0x7e61('0x73')]),_0x5507e8,{},['$$','$$']));}if(_0x4bfa67['body']){_0x4bfa67['body']=JSON[_0x7e61('0x7a')](Mustache['render'](JSON[_0x7e61('0x79')](_0x4bfa67[_0x7e61('0x7b')]),_0x5507e8,{},['$$','$$']));}}catch(_0x3f556d){logger[_0x7e61('0x2f')](_0x7e61('0x7c'),_0x3f556d);}}rp(_0x4bfa67)['then'](function(_0x25dedc){var _0x41711c={'statusCode':_0x25dedc[_0x7e61('0x7d')]||0xc8,'statusMessage':_0x25dedc['statusMessage']||'OK','headers':_0x25dedc['headers']||{},'body':_0x25dedc[_0x7e61('0x7b')]||{}};_0x39f5b0(null,_0x41711c);})['catch'](function(_0xa955ab){var _0x4b95f9={'statusCode':_0xa955ab['statusCode']||0x1f4,'statusMessage':_0xa955ab[_0x7e61('0x7e')]||_0x7e61('0x7f'),'headers':_0xa955ab[_0x7e61('0x80')][_0x7e61('0x73')]||{},'body':_0xa955ab[_0x7e61('0x80')]['body']||{}};_0x39f5b0(null,_0x4b95f9);});};AGIVertices[_0x7e61('0x10')]['googleDialogflow']=function(_0x501775,_0x402fb2){scripts[_0x7e61('0x81')](this[_0x7e61('0xe')][_0x7e61('0x38')],_0x501775[_0x7e61('0x82')],_0x501775['text'],_0x501775[_0x7e61('0x83')]||'en')[_0x7e61('0x17')](function(_0x542f3f){_0x402fb2(null,_0x542f3f);})['catch'](function(_0x570ca7){_0x402fb2(_0x570ca7);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x84')]=function(_0x40bce7,_0x446eb8){scripts[_0x7e61('0x84')](this[_0x7e61('0xe')],_0x40bce7)[_0x7e61('0x17')](function(_0xdb4653){_0x446eb8(null,_0xdb4653);})['catch'](function(_0x1701e8){_0x446eb8(_0x1701e8);});};AGIVertices[_0x7e61('0x10')]['ispeechTTS']=function(_0x1a2845,_0x12fb05){scripts[_0x7e61('0x85')](_0x1a2845['key'],_0x1a2845[_0x7e61('0x86')],_0x1a2845['ispeech_tts_language']||_0x7e61('0x67'),_0x1a2845[_0x7e61('0x87')])['then'](function(_0x14202b){_0x12fb05(null,_0x14202b);})[_0x7e61('0x14')](function(_0x260f76){_0x12fb05(_0x260f76);});};AGIVertices['prototype'][_0x7e61('0x88')]=function(_0x2b879d,_0xe2c451,_0x171470){scripts[_0x7e61('0x88')](_0xe2c451,_0x2b879d[_0x7e61('0x82')],_0x2b879d[_0x7e61('0x89')]||'en-US',this['isConfigured'](_0x2b879d[_0x7e61('0x8a')])?_0x2b879d[_0x7e61('0x8a')]:undefined)[_0x7e61('0x17')](function(_0x4c9586){_0x171470(null,_0x4c9586);})[_0x7e61('0x14')](function(_0x3491b6){_0x171470(_0x3491b6);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x8b')]=function(_0x12da4,_0x34e222){scripts[_0x7e61('0x8b')](_0x12da4['aws_access_key_id'],_0x12da4['aws_secret_access_key'],_0x12da4['aws_polly_region'],_0x12da4[_0x7e61('0x8c')]||_0x7e61('0x8d'),_0x12da4[_0x7e61('0x86')],_0x12da4[_0x7e61('0x8e')]||_0x7e61('0x86'))[_0x7e61('0x17')](function(_0x4ab5a3){_0x34e222(null,_0x4ab5a3);})['catch'](function(_0x1a9fdf){_0x34e222(_0x1a9fdf);});};AGIVertices[_0x7e61('0x10')]['awsLex']=function(_0x47e8b3,_0x1eb46e){scripts[_0x7e61('0x8f')](this[_0x7e61('0xe')][_0x7e61('0x38')],_0x47e8b3[_0x7e61('0x90')],_0x47e8b3[_0x7e61('0x91')],_0x47e8b3[_0x7e61('0x92')],_0x47e8b3[_0x7e61('0x86')],_0x47e8b3[_0x7e61('0x93')])[_0x7e61('0x17')](function(_0x81414d){_0x1eb46e(null,_0x81414d);})[_0x7e61('0x14')](function(_0x4c52a4){_0x1eb46e(_0x4c52a4);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x94')]=function(_0x4a3820,_0x4fcda5,_0x337203){scripts[_0x7e61('0x94')](_0x4fcda5,_0x4a3820[_0x7e61('0x82')],_0x4a3820[_0x7e61('0x95')]||_0x7e61('0x67'))[_0x7e61('0x17')](function(_0x417d53){_0x337203(null,_0x417d53);})[_0x7e61('0x14')](function(_0x237b67){_0x337203(_0x237b67);});};AGIVertices[_0x7e61('0x10')][_0x7e61('0x96')]=function(_0x311e36,_0x493dec,_0x41cc2e){scripts[_0x7e61('0x96')](_0x493dec,_0x311e36['appid'],_0x311e36['appsecret'],_0x311e36[_0x7e61('0x77')])[_0x7e61('0x17')](function(_0x43a6bd){_0x41cc2e(null,_0x43a6bd);})['catch'](function(_0x31bffa){_0x41cc2e(_0x31bffa);});};AGIVertices['prototype'][_0x7e61('0x97')]=function(_0x22b36b){var _0x412dcd=_[_0x7e61('0x70')](verticesWithRetry,_0x22b36b[_0x7e61('0x39')])?_0x22b36b:_[_0x7e61('0x98')](_0x22b36b);for(var _0x5b2f35 in _0x412dcd){if(_0x412dcd[_0x7e61('0x99')](_0x5b2f35)){if(_0x412dcd[_0x5b2f35]&&_['isString'](_0x412dcd[_0x5b2f35])){if(_[_0x7e61('0x70')](recursiveMapAttributes,_0x5b2f35)){_0x412dcd[_0x5b2f35]=this[_0x7e61('0x9a')](_0x412dcd[_0x5b2f35]);}else{_0x412dcd[_0x5b2f35]=this[_0x7e61('0x9b')](_0x412dcd[_0x5b2f35]);}}}}return _0x412dcd;};AGIVertices[_0x7e61('0x10')]['recursiveNodeIndex']=function(_0x31b373){for(var _0x26a348 in _0x31b373){if(_0x31b373['hasOwnProperty'](_0x26a348)){if(_['isPlainObject'](_0x31b373[_0x26a348])){this[_0x7e61('0x9c')](_0x31b373[_0x26a348]);}else if(_[_0x7e61('0x9d')](_0x31b373[_0x26a348])){for(var _0x198550=0x0;_0x198550<_0x31b373[_0x26a348]['length'];_0x198550++){this[_0x7e61('0x9c')](_0x31b373[_0x26a348][_0x198550]);}}else if(_[_0x7e61('0x9e')](_0x31b373[_0x26a348])){_0x31b373[_0x26a348]=this[_0x7e61('0x9b')](_0x31b373[_0x26a348]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x452d01,_0x515a29){for(var _0x487cae in _0x452d01){if(_0x452d01[_0x7e61('0x99')](_0x487cae)){if(_['isPlainObject'](_0x452d01[_0x487cae])){if(!_[_0x7e61('0x50')](_0x452d01[_0x487cae])){this[_0x7e61('0x9f')](_0x452d01[_0x487cae],util['format'](_0x7e61('0xa0'),_0x515a29,_0x487cae));}}else if(_[_0x7e61('0x9d')](_0x452d01[_0x487cae])){for(var _0x2ae9ce=0x0;_0x2ae9ce<_0x452d01[_0x487cae][_0x7e61('0xa1')];_0x2ae9ce++){this[_0x7e61('0x9f')](_0x452d01[_0x487cae][_0x2ae9ce],util['format'](_0x7e61('0xa0'),_0x515a29,_0x487cae+'['+_0x2ae9ce+']'));}}else{if(!_[_0x7e61('0x49')](_0x452d01[_0x487cae])){this[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0xa0'),_0x515a29,_0x487cae),_0x452d01[_0x487cae]);}}}}};AGIVertices['prototype'][_0x7e61('0x9a')]=function(_0x2d3658){try{var _0x141903=JSON[_0x7e61('0x7a')](_0x2d3658);this[_0x7e61('0x9c')](_0x141903);return JSON['stringify'](_0x141903);}catch(_0x58e0bb){return this[_0x7e61('0x9b')](_0x2d3658);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x5ad594){console['log'](_0x7e61('0xa3'),_0x5ad594);var _0x548fba=_0x5ad594[_0x7e61('0xa4')]('{');for(var _0x3215c3=0x1;_0x3215c3<_0x548fba[_0x7e61('0xa1')];_0x3215c3+=0x1){var _0x4c5d31=_0x548fba[_0x3215c3]['split']('}');console[_0x7e61('0x45')](_0x7e61('0xa5'),_0x4c5d31);if(_0x4c5d31['length']>0x1){_0x5ad594=_0x5ad594[_0x7e61('0xa6')]('{'+_0x4c5d31[0x0]+'}',this[_0x7e61('0xe')][_0x7e61('0x11')](_0x4c5d31[0x0])[_0x7e61('0xa7')]||_0x4c5d31[0x0]);}}if(_0x548fba['length']===0x1){return _0x5ad594[_0x7e61('0x57')]();}console['log'](_0x7e61('0xa8'),_0x5ad594);return this[_0x7e61('0x9b')](_0x5ad594);};AGIVertices[_0x7e61('0x10')][_0x7e61('0xa9')]=function(_0x2391e3,_0x1ed2d2){var _0x54f671=this[_0x7e61('0xe')]['getVariable'](_0x2391e3);if(_0x54f671[_0x7e61('0xaa')]===-0x1){return _0x54f671;}logger['info'](util[_0x7e61('0x2b')](_0x7e61('0xab'),_0x1ed2d2,_0x54f671['extra']));return this[_0x7e61('0xe')][_0x7e61('0xa2')](_0x1ed2d2,_0x54f671[_0x7e61('0xa7')]);};AGIVertices[_0x7e61('0x10')][_0x7e61('0xac')]=function(_0xdee612){return _0xdee612&&_0xdee612!=='0'&&_0xdee612!=='-1'&&_0xdee612!=='';};AGIVertices[_0x7e61('0x10')][_0x7e61('0xad')]=function(_0x43a3c6){this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x43a3c6,'-');_0x43a3c6[_0x7e61('0xae')]=_0x43a3c6[_0x7e61('0xad')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7e61('0x10')]['mrcpsynth']=function(_0x32820f){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0xaf'),_0x32820f[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x32820f['text'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}var _0x234498='\x22'+_0x32820f[_0x7e61('0x86')]+'\x22';if(this[_0x7e61('0xac')](_0x32820f[_0x7e61('0x80')])){_0x234498+=','+_0x32820f[_0x7e61('0x80')];}var _0x1fab6c=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0xb3'),_0x234498);if(_0x1fab6c['result']===-0x1){return _0x1fab6c;}return this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0xb4'),_0x234498));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xb5')]=function(_0x4ebfc8){logger[_0x7e61('0x30')](util['format'](_0x7e61('0xb6'),_0x4ebfc8[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x4ebfc8[_0x7e61('0xb7')])){return this[_0x7e61('0xe')]['noop']('no\x20grammar\x20configured');}var _0x4b9feb=_0x4ebfc8[_0x7e61('0xb7')];if(this['isConfigured'](_0x4ebfc8[_0x7e61('0x80')])){_0x4b9feb+=','+_0x4ebfc8[_0x7e61('0x80')];}var _0x17b7b8=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0xb8'),_0x4b9feb);if(_0x17b7b8[_0x7e61('0xaa')]===-0x1){return _0x17b7b8;}var _0x3805b2=this['getAndSetVariable'](_0x7e61('0xb9'),_0x7e61('0xba'));if(_0x3805b2[_0x7e61('0xaa')]===-0x1){return _0x3805b2;}var _0x1df3af=this[_0x7e61('0xa9')](_0x7e61('0xbb'),'MRCP_RECOG_TRANSCRIPT');if(_0x1df3af[_0x7e61('0xaa')]===-0x1){return _0x1df3af;}var _0x3fc0a0=this[_0x7e61('0xa9')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x3fc0a0[_0x7e61('0xaa')]===-0x1){return _0x3fc0a0;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xbc'),_0x4b9feb));};AGIVertices[_0x7e61('0x10')]['agi']=function(_0x3587c2){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3587c2[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0x6')]([_0x3587c2[_0x7e61('0xbd')],_0x3587c2[_0x7e61('0xbe')]]);};AGIVertices[_0x7e61('0x10')][_0x7e61('0xbf')]=function(_0x9fa10f){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xc0'),_0x9fa10f[_0x7e61('0xb0')]));if(this[_0x7e61('0xac')](_0x9fa10f[_0x7e61('0x6f')])){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xc1'),_0x9fa10f[_0x7e61('0x6f')]));var _0x239498=this['channel'][_0x7e61('0xc2')](_0x9fa10f[_0x7e61('0x6f')]);if(_0x239498['result']===-0x1){return _0x239498;}}return this[_0x7e61('0xe')][_0x7e61('0xbf')]();};AGIVertices['prototype'][_0x7e61('0x55')]=function(_0x48ace2){console['log'](_0x7e61('0xc3'),_0x48ace2);logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x48ace2[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x48ace2[_0x7e61('0xc4')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x48ace2,_0x7e61('0xc5'));}_0x48ace2[_0x7e61('0x54')]=moment();if(this['isConfigured'](_0x48ace2['delay'])){_0x48ace2[_0x7e61('0x54')]=moment()[_0x7e61('0xc6')](_0x48ace2[_0x7e61('0xc7')],_0x7e61('0xc8'));}if(!this[_0x7e61('0xac')](_0x48ace2[_0x7e61('0xc9')])){_0x48ace2[_0x7e61('0xc9')]=0x2;}console[_0x7e61('0x45')](_0x7e61('0xca'),_0x48ace2);this[_0x7e61('0x44')][_0x7e61('0x76')](this,_0x48ace2);return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xcb'),_0x48ace2['phone'],_0x48ace2[_0x7e61('0xc4')],_0x48ace2[_0x7e61('0x54')]));};AGIVertices['prototype']['custom_app']=function(_0x45b13d){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0xcc'),_0x45b13d[_0x7e61('0xb0')]));var _0x2e775b=this[_0x7e61('0xe')]['exec'](_0x45b13d[_0x7e61('0xcd')],_0x45b13d['options']);if(_0x2e775b['result']===-0x1){return _0x2e775b;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xce'),_0x45b13d[_0x7e61('0xcd')],_0x45b13d[_0x7e61('0x80')]));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xcf')]=function(_0xafbe79){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xd0'),_0xafbe79[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0xafbe79[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20text\x20configured');}var _0x431186='\x22'+_0xafbe79[_0x7e61('0x86')]+'\x22';if(this[_0x7e61('0xac')](_0xafbe79[_0x7e61('0x80')])){_0x431186+=','+_0xafbe79['options'];}var _0x4626d1=this['channel'][_0x7e61('0x62')]('MRCPSynth',_0x431186);if(_0x4626d1[_0x7e61('0xaa')]===-0x1){return _0x4626d1;}return this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xb4'),_0x431186));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xd1')]=function(_0x3a4a6b){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xd2'),_0x3a4a6b['label']));if(!this[_0x7e61('0xac')](_0x3a4a6b[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}var _0x778ba6='\x22'+_0x3a4a6b[_0x7e61('0x86')]+'\x22';if(this[_0x7e61('0xac')](_0x3a4a6b['options'])){_0x778ba6+=','+_0x3a4a6b[_0x7e61('0x80')];}var _0x431f41=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0xb3'),_0x778ba6);if(_0x431f41['result']===-0x1){return _0x431f41;}return this[_0x7e61('0xe')]['noop'](util['format'](_0x7e61('0xb4'),_0x778ba6));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xd3')]=function(_0x2eb24d){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xd4'),_0x2eb24d[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x2eb24d['grammar'])){return this['channel'][_0x7e61('0xb1')]('no\x20grammar\x20configured');}var _0x4283f5=_0x2eb24d[_0x7e61('0xb7')];if(this[_0x7e61('0xac')](_0x2eb24d[_0x7e61('0x80')])){_0x4283f5+=','+_0x2eb24d[_0x7e61('0x80')];}var _0x209c73=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0xb8'),_0x4283f5);if(_0x209c73[_0x7e61('0xaa')]===-0x1){return _0x209c73;}var _0x2acc73=this[_0x7e61('0xa9')](_0x7e61('0xb9'),_0x7e61('0xd5'));if(_0x2acc73[_0x7e61('0xaa')]===-0x1){return _0x2acc73;}var _0x5242f6=this['getAndSetVariable'](_0x7e61('0xbb'),_0x7e61('0xd6'));if(_0x5242f6[_0x7e61('0xaa')]===-0x1){return _0x5242f6;}var _0x3f2667=this['getAndSetVariable'](_0x7e61('0xd7'),_0x7e61('0xd8'));if(_0x3f2667['result']===-0x1){return _0x3f2667;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4283f5));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xd9')]=function(_0x4333cd){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0xda'),_0x4333cd[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x4333cd[_0x7e61('0xb7')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xdb'));}var _0x5d450e=_0x4333cd[_0x7e61('0xb7')];if(this[_0x7e61('0xac')](_0x4333cd[_0x7e61('0x80')])){_0x5d450e+=','+_0x4333cd[_0x7e61('0x80')];}var _0x54af8f=this[_0x7e61('0xe')]['exec'](_0x7e61('0xb8'),_0x5d450e);if(_0x54af8f[_0x7e61('0xaa')]===-0x1){return _0x54af8f;}var _0x16d7d6=this[_0x7e61('0xa9')](_0x7e61('0xb9'),_0x7e61('0xdc'));if(_0x16d7d6[_0x7e61('0xaa')]===-0x1){return _0x16d7d6;}var _0xf881cc=this['getAndSetVariable'](_0x7e61('0xbb'),_0x7e61('0xdd'));if(_0xf881cc[_0x7e61('0xaa')]===-0x1){return _0xf881cc;}var _0x1b5c11=this[_0x7e61('0xa9')](_0x7e61('0xd7'),_0x7e61('0xde'));if(_0x1b5c11[_0x7e61('0xaa')]===-0x1){return _0x1b5c11;}return this['channel'][_0x7e61('0xb1')](util['format'](_0x7e61('0xbc'),_0x5d450e));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xdf')]=function(_0xc5675c){logger[_0x7e61('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0xc5675c[_0x7e61('0xb0')]));if(!this['isConfigured'](_0xc5675c['odbc_id'])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0xc5675c,_0x7e61('0xe0'));}var _0x4f5c0b=this['getSquareOdbc']['sync'](this,_0xc5675c[_0x7e61('0xe1')]);if(!_0x4f5c0b){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0xc5675c,_0x7e61('0xe2'));}if(!this[_0x7e61('0xac')](_0xc5675c[_0x7e61('0x31')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0xc5675c,'no\x20query\x20configured');}var _0x4637c6=_0xc5675c[_0x7e61('0x31')][_0x7e61('0x64')](/(\r\n|\n|\r)/gm,'\x20');this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0xe3'),_0x4637c6));var _0x2e164b=this[_0x7e61('0x2d')][_0x7e61('0x76')](this,_0x4f5c0b,_0x4637c6);this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0xc5675c,_0x4637c6);if(!this['isConfigured'](_0xc5675c[_0x7e61('0xe4')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xe5'));}var _0x4e423c=this['getVariable'][_0x7e61('0x76')](this,_0xc5675c['variable_id']);if(!_0x4e423c){return this[_0x7e61('0xe')]['error'](_0xc5675c,'no\x20variable\x20found');}var _0x403642=this;_0x2e164b[_0x7e61('0xe6')](function(_0x200f57,_0x39c58b){Object[_0x7e61('0xe7')](_0x200f57)['forEach'](function(_0x12f50f){_0x403642[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0xe8'),_0x4e423c,_0x39c58b,_0x12f50f),_0x200f57[_0x12f50f]);});});this[_0x7e61('0xe')]['setVariable'](util['format'](_0x7e61('0xe9'),_0x4e423c),_0x2e164b[_0x7e61('0xa1')]);return this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0xea'),_0x4e423c));};AGIVertices[_0x7e61('0x10')]['dial']=function(_0x275f81){logger[_0x7e61('0xeb')](util[_0x7e61('0x2b')](_0x7e61('0xec'),_0x275f81['label']));if(!this['isConfigured'](_0x275f81[_0x7e61('0xed')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x275f81,'no\x20user\x20selected');}var _0x1fc51a=this[_0x7e61('0x1b')][_0x7e61('0x76')](this,_0x275f81[_0x7e61('0xed')]);if(!_0x1fc51a){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x275f81,_0x7e61('0xee'));}var _0x2178bf=this[_0x7e61('0xe')][_0x7e61('0x62')]('DIAL',[util[_0x7e61('0x2b')](_0x7e61('0xef'),_0x1fc51a),_0x275f81[_0x7e61('0x6f')],_0x275f81[_0x7e61('0xf0')],_0x275f81[_0x7e61('0x6d')]]);if(_0x2178bf[_0x7e61('0xaa')]===-0x1){return _0x2178bf;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xf1'),_0x7e61('0xf2')));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xf3')]=function(_0x13c1b6){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x13c1b6['label']));if(!this[_0x7e61('0xac')](_0x13c1b6[_0x7e61('0x82')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xf4'));}if(!this[_0x7e61('0xac')](_0x13c1b6[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x13c1b6);this[_0x7e61('0x43')](_0x13c1b6['text'],'in');this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0xf5'),_0x13c1b6[_0x7e61('0x86')]));var _0x13fc8e=this['googleDialogflow'][_0x7e61('0x76')](this,_0x13c1b6);if(_0x13fc8e){for(var _0x5d5a07 in _0x13fc8e){if(_0x13fc8e[_0x7e61('0x99')](_0x5d5a07)){this['channel']['setVariable'](util[_0x7e61('0x2b')]('DIALOGFLOW_%s',_0x5d5a07[_0x7e61('0xf6')]()),_0x13fc8e[_0x5d5a07]);}}this[_0x7e61('0x43')](_0x13fc8e[_0x7e61('0xf7')],_0x7e61('0xf8'));return this['channel'][_0x7e61('0xb1')](util['format']('Dialogflow\x20Result\x20%s',_0x13fc8e[_0x7e61('0xf7')]));}return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x13c1b6,_0x7e61('0xf9'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0xfa')]=function(_0x43931e){logger[_0x7e61('0x30')](util['format'](_0x7e61('0xfb'),_0x43931e[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x43931e[_0x7e61('0xfc')])){return this[_0x7e61('0xe')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x7e61('0xac')](_0x43931e[_0x7e61('0xfd')])){return this['channel'][_0x7e61('0xb1')](_0x7e61('0xfe'));}if(!this[_0x7e61('0xac')](_0x43931e['password'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x43931e['ndassistant_url'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')][_0x7e61('0xff')]=!![];this[_0x7e61('0x37')](_0x43931e);this[_0x7e61('0x43')](_0x43931e[_0x7e61('0x86')],'in');this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x100'),_0x43931e[_0x7e61('0x86')]));var _0x506752=this[_0x7e61('0x84')][_0x7e61('0x76')](this,_0x43931e);if(_0x506752){for(var _0x4e71af in _0x506752){if(_0x506752[_0x7e61('0x99')](_0x4e71af)){this[_0x7e61('0xe')][_0x7e61('0xa2')](util['format'](_0x7e61('0x101'),_0x4e71af[_0x7e61('0xf6')]()),_0x506752[_0x4e71af]);}}this[_0x7e61('0x43')](_0x506752[_0x7e61('0xf7')],_0x7e61('0xf8'));if(_0x506752[_0x7e61('0x102')]){this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x103'),_0x506752[_0x7e61('0x102')]));var _0x5e4b05=this['channel'][_0x7e61('0x104')](_0x506752[_0x7e61('0x102')]);try{fs[_0x7e61('0x105')](_0x506752['audiofile']+_0x7e61('0x106'));}catch(_0x16d60d){logger['error'](_0x16d60d);}return _0x5e4b05;}else{return this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format']('SestekNDA\x20Result\x20%s',_0x506752['speech']));}}return this[_0x7e61('0xe')]['error'](_0x43931e,_0x7e61('0x107'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x108')]=function(_0x23b7b0){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x23b7b0[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x108'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x109')]=function(_0x134aa1){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x10a'),_0x134aa1[_0x7e61('0xb0')]));var _0x2b227b='';if(_0x134aa1[_0x7e61('0x10b')]){if(!this[_0x7e61('0xac')](_0x134aa1[_0x7e61('0x10b')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x134aa1,'no\x20trunk\x20selected');}else{var _0x33a5bb=parseInt(_0x134aa1[_0x7e61('0x10b')],0xa);if(isNaN(_0x33a5bb)){_0x2b227b=_0x134aa1[_0x7e61('0x10b')];}else{_0x2b227b=this[_0x7e61('0x1d')]['sync'](this,_0x134aa1[_0x7e61('0x10b')]);if(!_0x2b227b){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x134aa1,_0x7e61('0x10c'));}}}}else if(_0x134aa1[_0x7e61('0x10d')]){_0x2b227b=_0x134aa1[_0x7e61('0x10d')];}else{return this['channel'][_0x7e61('0x2f')](_0x134aa1,_0x7e61('0x10e'));}var _0x292bc4=this[_0x7e61('0xe')]['exec'](_0x7e61('0xf2'),[util[_0x7e61('0x2b')](_0x7e61('0x10f'),_0x2b227b,_0x134aa1[_0x7e61('0x4d')]),_0x134aa1[_0x7e61('0x6f')],_0x134aa1['opts'],_0x134aa1[_0x7e61('0x6d')]]);if(_0x292bc4[_0x7e61('0xaa')]===-0x1){return _0x292bc4;}return this['channel']['noop'](util[_0x7e61('0x2b')](_0x7e61('0xf1'),'DIAL'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x110')]=function(_0x3f17fe){logger[_0x7e61('0x30')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x3f17fe['label']));return this[_0x7e61('0xe')]['noop']('finally');};AGIVertices[_0x7e61('0x10')][_0x7e61('0xc')]=function(_0x4540ec){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4540ec[_0x7e61('0xb0')]));if(_0x4540ec[_0x7e61('0xae')]===0x0){return this['maxRetry'](_0x4540ec);}_0x4540ec[_0x7e61('0xae')]-=0x1;if(!this[_0x7e61('0xac')](_0x4540ec[_0x7e61('0x111')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4540ec,_0x7e61('0x112'));}var _0x12a4b0=this[_0x7e61('0x1f')][_0x7e61('0x76')](this,_0x4540ec['file_id']);if(!_0x12a4b0){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4540ec,'no\x20file\x20audio\x20found');}if(!this[_0x7e61('0xac')](_0x4540ec[_0x7e61('0xe4')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x7e61('0xe5'));}var _0x215cb2=this[_0x7e61('0xe')][_0x7e61('0x113')](_0x12a4b0,_0x4540ec[_0x7e61('0x114')],_0x4540ec[_0x7e61('0x115')]);var _0x4acedf=_0x215cb2[_0x7e61('0xaa')]?_0x215cb2[_0x7e61('0xaa')][_0x7e61('0x57')]():'';logger[_0x7e61('0x30')]('test',JSON[_0x7e61('0x79')](_0x215cb2));if(_0x215cb2[_0x7e61('0xaa')]===-0x1){this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4540ec,_0x4acedf);return _0x215cb2;}else if(_0x215cb2[_0x7e61('0xa7')]==='timeout'){_0x215cb2[_0x7e61('0xaa')]=_0x4acedf[_0x7e61('0xa1')]>=parseInt(_0x4540ec[_0x7e61('0x116')])?'x':'i';}else{_0x215cb2[_0x7e61('0xaa')]=_0x4acedf[_0x7e61('0xa1')]>=parseInt(_0x4540ec[_0x7e61('0x116')])&&_0x4acedf[_0x7e61('0xa1')]<=parseInt(_0x4540ec['maxdigit'])?'x':'i';}var _0x15b449=this[_0x7e61('0x11')]['sync'](this,_0x4540ec[_0x7e61('0xe4')]);if(!_0x15b449){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4540ec,_0x7e61('0x117'));}this[_0x7e61('0xe')][_0x7e61('0xa2')](_0x15b449,_0x4acedf);if(this[_0x7e61('0xac')](_0x4540ec[_0x7e61('0x118')])){var _0x2318f8=parseInt(_0x4540ec[_0x7e61('0x118')],0xa);var _0x4fc92d=rs[_0x7e61('0x119')]({'charset':'*','length':_0x2318f8});var _0xc20f1e=_0x4acedf[_0x7e61('0xa1')];if(_0xc20f1e>0x0){if(_0xc20f1e>_0x2318f8){this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4540ec,_0x4540ec[_0x7e61('0x11a')]==='first'?_0x4fc92d+_0x4acedf[_0x7e61('0x11b')](_0x2318f8):_0x4acedf[_0x7e61('0x11b')](0x0,_0xc20f1e-_0x2318f8)+_0x4fc92d);}else{this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4540ec,rs[_0x7e61('0x119')]({'charset':'*','length':_0xc20f1e}));}}else{this['createSquareDetailsReport'][_0x7e61('0x76')](this,_0x4540ec,'');}}else{this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4540ec,_0x4acedf);}return _0x215cb2;};AGIVertices[_0x7e61('0x10')]['getsecretdigits']=function(_0x47a213){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x11c'),_0x47a213[_0x7e61('0xb0')]));return this[_0x7e61('0xc')](_0x47a213);};AGIVertices[_0x7e61('0x10')]['goal']=function(_0x50d76d){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x11d'),_0x50d76d[_0x7e61('0xb0')]));this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x50d76d,_0x50d76d['goalname']);return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x11e'),_0x50d76d[_0x7e61('0x11f')]));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x120')]=function(_0x4a6f64){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x121'),_0x4a6f64[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x4a6f64[_0x7e61('0x90')])||!this[_0x7e61('0xac')](_0x4a6f64[_0x7e61('0x91')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x4a6f64['text'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x122'),_0x4a6f64[_0x7e61('0x86')]));var _0x1aa195=this[_0x7e61('0x8b')][_0x7e61('0x76')](this,_0x4a6f64);if(_0x1aa195){this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0x123'),_0x1aa195));var _0x5b34e2=this[_0x7e61('0xe')]['streamFile'](_0x1aa195);try{fs[_0x7e61('0x105')](_0x1aa195+_0x7e61('0x106'));}catch(_0x3f7c8e){logger[_0x7e61('0x2f')](_0x3f7c8e);}return _0x5b34e2;}return this[_0x7e61('0xe')]['error'](_0x4a6f64,_0x7e61('0x124'));};AGIVertices[_0x7e61('0x10')]['awslex']=function(_0x1dd267){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x125'),_0x1dd267[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x1dd267[_0x7e61('0x90')])||!this['isConfigured'](_0x1dd267[_0x7e61('0x91')])){return this['channel'][_0x7e61('0xb1')](_0x7e61('0x126'));}if(!this[_0x7e61('0xac')](_0x1dd267[_0x7e61('0x93')])){return this['channel'][_0x7e61('0xb1')](_0x7e61('0x127'));}if(!this[_0x7e61('0xac')](_0x1dd267[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')]['bot']=!![];this[_0x7e61('0x37')](_0x1dd267);this[_0x7e61('0x43')](_0x1dd267[_0x7e61('0x86')],'in');this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1dd267[_0x7e61('0x86')]));var _0x302f50=this[_0x7e61('0x8f')][_0x7e61('0x76')](this,_0x1dd267);if(_0x302f50){for(var _0x2645e3 in _0x302f50){if(_0x302f50[_0x7e61('0x99')](_0x2645e3)&&_[_0x7e61('0x9e')](_0x302f50[_0x2645e3])){this[_0x7e61('0xe')]['setVariable'](util[_0x7e61('0x2b')](_0x7e61('0x128'),_0x2645e3[_0x7e61('0xf6')]()),_0x302f50[_0x2645e3]);}}if(_[_0x7e61('0x49')](_0x302f50[_0x7e61('0x7e')])){return this[_0x7e61('0xe')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x302f50[_0x7e61('0x7e')],_0x7e61('0xf8'));return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x129'),_0x302f50[_0x7e61('0x7e')]));}}return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x1dd267,_0x7e61('0x12a'));};AGIVertices['prototype']['googleasr']=function(_0x3a163a){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x12b'),_0x3a163a[_0x7e61('0xb0')],_0x3a163a[_0x7e61('0x6f')]));if(!this['isConfigured'](_0x3a163a['key'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xf4'));}var _0x24c191=_0x7e61('0x12c');var _0x2301e8=util[_0x7e61('0x2b')](_0x7e61('0x12d'),FILES_PATH,rs[_0x7e61('0x119')](0x4));var _0x315414=util[_0x7e61('0x2b')](_0x7e61('0xa0'),_0x2301e8,_0x24c191);var _0xd3835f=!![];if(_0x3a163a[_0x7e61('0x12e')]===_0x7e61('0x12f')){_0xd3835f=![];}var _0x7db782=this['channel'][_0x7e61('0x130')](_0x2301e8,_0x24c191,_0x3a163a[_0x7e61('0x131')],_0x3a163a[_0x7e61('0x6f')],undefined,_0xd3835f);if(_0x7db782['result']!==-0x1){this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x132'),_0x315414));var _0x1e4eaa=this['googleASR'][_0x7e61('0x76')](this,_0x3a163a,_0x315414);if(_0x1e4eaa){for(var _0x47c629 in _0x1e4eaa){if(_0x1e4eaa[_0x7e61('0x99')](_0x47c629)){this[_0x7e61('0xe')]['setVariable'](util[_0x7e61('0x2b')](_0x7e61('0x133'),_0x47c629[_0x7e61('0xf6')]()),_0x1e4eaa[_0x47c629]);}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x134'),JSON[_0x7e61('0x79')](_0x1e4eaa)));}}return _0x7db782;};AGIVertices[_0x7e61('0x10')][_0x7e61('0x135')]=function(_0x11a5dd){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x11a5dd[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x11a5dd[_0x7e61('0x136')])){return this[_0x7e61('0xe')]['noop']('no\x20appid\x20configured');}if(!this[_0x7e61('0xac')](_0x11a5dd[_0x7e61('0x137')])){return this[_0x7e61('0xe')]['noop'](_0x7e61('0x138'));}var _0x461731=_0x7e61('0x12c');var _0x54605c=util[_0x7e61('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x7e61('0x119')](0x4));var _0x30587d=util[_0x7e61('0x2b')]('%s.%s',_0x54605c,_0x461731);var _0x12cb0c=!![];if(_0x11a5dd[_0x7e61('0x12e')]===_0x7e61('0x12f')){_0x12cb0c=![];}var _0x15ac70=this[_0x7e61('0xe')]['recordFile'](_0x54605c,_0x461731,_0x11a5dd[_0x7e61('0x131')],_0x11a5dd[_0x7e61('0x6f')],undefined,_0x12cb0c);if(_0x15ac70['result']!==-0x1){this[_0x7e61('0xe')]['noop'](util['format'](_0x7e61('0x139'),_0x30587d));var _0x10a798=this[_0x7e61('0x96')][_0x7e61('0x76')](this,_0x11a5dd,_0x30587d);if(_0x10a798){for(var _0x320299 in _0x10a798){if(_0x10a798[_0x7e61('0x99')](_0x320299)){this[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0x13a'),_0x320299['toUpperCase']()),_0x10a798[_0x320299]);}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('TildeASR\x20Result\x20%s',JSON[_0x7e61('0x79')](_0x10a798)));}}return _0x15ac70;};AGIVertices[_0x7e61('0x10')][_0x7e61('0x13b')]=function(_0x254579){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x13c'),_0x254579[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0x13d')](_0x254579[_0x7e61('0x3e')],_0x254579[_0x7e61('0x3f')],_0x254579['priority']);};AGIVertices['prototype'][_0x7e61('0x13e')]=function(_0x4b9841){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x13f'),_0x4b9841['label']));if(!this[_0x7e61('0xac')](_0x4b9841[_0x7e61('0x140')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4b9841,_0x7e61('0x141'));}try{var _0x580df8=eval(_0x4b9841[_0x7e61('0x140')])?_0x7e61('0x142'):_0x7e61('0x143');this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0x144'),_0x4b9841[_0x7e61('0x140')],_0x580df8));return{'code':0xc8,'result':_0x580df8};}catch(_0x5304bb){return{'code':0xc8,'result':_0x7e61('0x143')};}};AGIVertices[_0x7e61('0x10')][_0x7e61('0x145')]=function(_0x5612f4){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5612f4[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x5612f4[_0x7e61('0x146')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x5612f4,'no\x20interval\x20configured');}var _0x427711=this[_0x7e61('0x25')]['sync'](this,_0x5612f4['interval_id']);if(!_0x427711){return this['channel']['error'](_0x5612f4,_0x7e61('0x147'));}for(var _0xed7cf8=0x0;_0xed7cf8<_0x427711[_0x7e61('0xa1')];_0xed7cf8+=0x1){var _0x31cbfb=this[_0x7e61('0xe')]['getVariable'](util[_0x7e61('0x2b')]('IFTIME(%s?true:false)',_0x427711[_0xed7cf8]));if(_0x31cbfb['result']===-0x1){return _0x31cbfb;}logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x148'),_0x427711[_0xed7cf8],_0x31cbfb[_0x7e61('0xa7')]));if(_0x31cbfb[_0x7e61('0xa7')]==='true'){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x148'),_0x427711[_0xed7cf8],'true'));this['channel'][_0x7e61('0xb1')](util['format']('IFTIME\x20%s\x20%s',_0x427711[_0xed7cf8],_0x7e61('0x142')));return{'code':0xc8,'result':_0x7e61('0x142')};}else{logger[_0x7e61('0x30')](util['format'](_0x7e61('0x148'),_0x427711[_0xed7cf8],_0x7e61('0x143')));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x148'),_0x427711[_0xed7cf8],_0x7e61('0x143')));}}return{'code':0xc8,'result':_0x7e61('0x143')};};AGIVertices['prototype'][_0x7e61('0x149')]=function(_0x346274){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x14a'),_0x346274[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0x149')]();};AGIVertices[_0x7e61('0x10')][_0x7e61('0x14b')]=function(_0x5ca520){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x14c'),_0x5ca520[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x5ca520[_0x7e61('0x82')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20key\x20configured');}var _0x448f56=_0x7e61('0x12c');var _0x91e48d=util[_0x7e61('0x2b')](_0x7e61('0x12d'),FILES_PATH,rs[_0x7e61('0x119')](0x4));var _0x28a3f2=util[_0x7e61('0x2b')](_0x7e61('0xa0'),_0x91e48d,_0x448f56);var _0x2d4f94=!![];if(_0x5ca520[_0x7e61('0x12e')]===_0x7e61('0x12f')){_0x2d4f94=![];}var _0x4df5c7=this[_0x7e61('0xe')][_0x7e61('0x130')](_0x91e48d,_0x448f56,_0x5ca520['intKey'],_0x5ca520[_0x7e61('0x6f')],undefined,_0x2d4f94);if(_0x4df5c7[_0x7e61('0xaa')]!==-0x1){this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0x14d'),_0x28a3f2));var _0xc4fde3=this['ispeechASR'][_0x7e61('0x76')](this,_0x5ca520,_0x28a3f2);if(_0xc4fde3){for(var _0x10a463 in _0xc4fde3){if(_0xc4fde3[_0x7e61('0x99')](_0x10a463)){this[_0x7e61('0xe')][_0x7e61('0xa2')](util['format'](_0x7e61('0x14e'),_0x10a463[_0x7e61('0xf6')]()),_0xc4fde3[_0x10a463]);}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x14f'),JSON[_0x7e61('0x79')](_0xc4fde3)));}}return _0x4df5c7;};AGIVertices[_0x7e61('0x10')][_0x7e61('0x150')]=function(_0x367899){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x151'),_0x367899[_0x7e61('0xb0')]));if(!this['isConfigured'](_0x367899[_0x7e61('0x82')])){return this['channel'][_0x7e61('0xb1')](_0x7e61('0xf4'));}if(!this[_0x7e61('0xac')](_0x367899[_0x7e61('0x86')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this['channel'][_0x7e61('0xb1')](util['format'](_0x7e61('0x152'),_0x367899[_0x7e61('0x86')]));var _0xf0ce2f=this['ispeechTTS'][_0x7e61('0x76')](this,_0x367899);if(_0xf0ce2f){this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format']('ispeech\x20%s\x20file\x20created',_0xf0ce2f));var _0x677b37=this['channel'][_0x7e61('0x104')](_0xf0ce2f,_0x367899['intKey']);try{fs[_0x7e61('0x105')](_0xf0ce2f+_0x7e61('0x106'));}catch(_0x390320){logger[_0x7e61('0x2f')](_0x390320);}return _0x677b37;}return this[_0x7e61('0xe')]['error'](_0x367899,_0x7e61('0x153'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x154')]=function(_0xbd5d63){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x155'),_0xbd5d63[_0x7e61('0xb0')]));if(!this['isConfigured'](_0xbd5d63['findBy'])){return this[_0x7e61('0xe')]['error'](_0xbd5d63,_0x7e61('0x156'));}logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x157'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0xbd5d63[_0x7e61('0x158')]));var _0x533268=this[_0x7e61('0x5e')][_0x7e61('0x76')](this,_0xbd5d63[_0x7e61('0x158')]);if(_0x533268){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x159'),this['channel'][_0x7e61('0x3b')],_0xbd5d63[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0xbd5d63[_0x7e61('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x7e61('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7e61('0xe')]['callerid'],_0xbd5d63[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0xbd5d63[_0x7e61('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7e61('0x10')][_0x7e61('0x15b')]=function(_0x399105){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x15c'),_0x399105['label']));if(!this[_0x7e61('0xac')](_0x399105[_0x7e61('0x158')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x399105,_0x7e61('0x156'));}logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x157'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x399105['findBy']));var _0x554a04=this[_0x7e61('0x5d')]['sync'](this,_0x399105[_0x7e61('0x158')]);if(_0x554a04){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')]['callerid'],_0x399105[_0x7e61('0x158')]));this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x399105[_0x7e61('0x158')]));return{'code':0xc8,'result':_0x7e61('0x15d')};}else{logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x399105['findBy']));this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x399105[_0x7e61('0x158')]));return{'code':0xc8,'result':_0x7e61('0x15e')};}};AGIVertices[_0x7e61('0x10')][_0x7e61('0x15f')]=function(_0xd8773d){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x160'),_0xd8773d[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0xd8773d['operation'])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0xd8773d,'no\x20operation\x20configured');}this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('math\x20%s',_0xd8773d[_0x7e61('0x161')]));var _0xf8742=eval(_0xd8773d[_0x7e61('0x161')]);if(!this['isConfigured'](_0xd8773d[_0x7e61('0xe4')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xe5'));}var _0x364d7a=this[_0x7e61('0x11')]['sync'](this,_0xd8773d[_0x7e61('0xe4')]);if(!_0x364d7a){return this['channel']['error'](_0xd8773d,_0x7e61('0x117'));}if(_[_0x7e61('0x9d')](_0xf8742)){var _0x2cbfe3=this;_0xf8742['forEach'](function(_0x352484,_0x1486f2){_0x2cbfe3[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0x162'),_0x364d7a,_0x1486f2),_0x352484);});return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x163'),_0x364d7a));}else{return this[_0x7e61('0xe')]['setVariable'](_0x364d7a,_0xf8742);}};AGIVertices[_0x7e61('0x10')][_0x7e61('0xb')]=function(_0x4bf770){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x164'),_0x4bf770['label']));if(_0x4bf770[_0x7e61('0xae')]===0x0){return this[_0x7e61('0xad')](_0x4bf770);}_0x4bf770[_0x7e61('0xae')]-=0x1;if(!this['isConfigured'](_0x4bf770[_0x7e61('0x111')])){return this['channel']['error'](_0x4bf770,_0x7e61('0x112'));}var _0x46b6a8=this[_0x7e61('0x1f')][_0x7e61('0x76')](this,_0x4bf770[_0x7e61('0x111')]);if(!_0x46b6a8){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4bf770,_0x7e61('0x165'));}var _0x18ab28=this[_0x7e61('0xe')][_0x7e61('0x113')](_0x46b6a8,_0x4bf770['response'],_0x4bf770[_0x7e61('0x166')]);var _0x48e2c2=_0x18ab28[_0x7e61('0xaa')];if(_0x18ab28['result']===-0x1){this[_0x7e61('0x37')]['sync'](this,_0x4bf770,'-1');return _0x18ab28;}else if(_0x18ab28[_0x7e61('0xa7')]==='timeout'){_0x18ab28[_0x7e61('0xaa')]=_0x18ab28[_0x7e61('0xaa')][_0x7e61('0xa1')]>0x0?_0x18ab28[_0x7e61('0xaa')]:'t';}else if(_[_0x7e61('0x50')](_0x18ab28[_0x7e61('0xaa')])){_0x18ab28[_0x7e61('0xaa')]='#';_0x48e2c2='#';}if(!this[_0x7e61('0xac')](_0x4bf770[_0x7e61('0xe4')])){this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xe5'));}else{var _0x4f8916=this[_0x7e61('0x11')][_0x7e61('0x76')](this,_0x4bf770[_0x7e61('0xe4')]);if(!_0x4f8916){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4bf770,_0x7e61('0x117'));}this['channel']['setVariable'](_0x4f8916,_0x48e2c2);}this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x4bf770,_0x48e2c2);return _0x18ab28;};AGIVertices[_0x7e61('0x10')][_0x7e61('0xb1')]=function(_0x58e197){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x167'),_0x58e197[_0x7e61('0xb0')]));return this[_0x7e61('0xe')]['noop'](_0x58e197[_0x7e61('0x168')]||_0x58e197[_0x7e61('0xb0')]);};AGIVertices[_0x7e61('0x10')][_0x7e61('0x169')]=function(_0x5a71d8){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x16a'),_0x5a71d8[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x5a71d8[_0x7e61('0x158')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x5a71d8,_0x7e61('0x156'));}logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x157'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x5a71d8[_0x7e61('0x158')]));var _0x4edadc=this['getPause'][_0x7e61('0x76')](this,_0x5a71d8[_0x7e61('0x16b')]);var _0x47f5d1=this[_0x7e61('0x5b')]['sync'](this,_0x5a71d8['findBy'],_0x4edadc);if(_0x47f5d1){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')]['callerid'],_0x5a71d8['findBy']));this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x5a71d8[_0x7e61('0x158')]));return{'code':0xc8,'result':_0x7e61('0x15d')};}else{logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this['channel'][_0x7e61('0x3b')],_0x5a71d8[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x5a71d8[_0x7e61('0x158')]));return{'code':0xc8,'result':_0x7e61('0x15e')};}};AGIVertices['prototype']['playback']=function(_0x3fb505){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3fb505['label']));if(!this[_0x7e61('0xac')](_0x3fb505[_0x7e61('0x111')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3fb505,_0x7e61('0x112'));}var _0x15bc9f=this['getSound'][_0x7e61('0x76')](this,_0x3fb505[_0x7e61('0x111')]);if(!_0x15bc9f){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3fb505,_0x7e61('0x165'));}var _0x14ec77=this['channel']['exec'](_0x7e61('0x16c'),[_0x15bc9f,_0x3fb505[_0x7e61('0xf0')]]);if(_0x14ec77[_0x7e61('0xaa')]===-0x1){return _0x14ec77;}return this['channel'][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xce'),_0x7e61('0x16c'),_0x15bc9f));};AGIVertices[_0x7e61('0x10')]['queue']=function(_0x3a1310){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x16d'),_0x3a1310[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x3a1310[_0x7e61('0x16e')])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3a1310,_0x7e61('0x16f'));}var _0x486980='';var _0x37ddb8=parseInt(_0x3a1310[_0x7e61('0x16e')],0xa);if(isNaN(_0x37ddb8)){_0x486980=_0x3a1310[_0x7e61('0x16e')];}else{_0x486980=this['getVoiceQueue'][_0x7e61('0x76')](this,_0x3a1310[_0x7e61('0x16e')]);if(!_0x486980){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3a1310,_0x7e61('0x170'));}}var _0x5b5a07='';if(this['isConfigured'](_0x3a1310['file_id'])){var _0x389988=this['getSound'][_0x7e61('0x76')](this,_0x3a1310[_0x7e61('0x111')]);if(_0x389988){_0x5b5a07=_0x389988;}}this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x3a1310,_0x486980);if(_0x3a1310[_0x7e61('0xf0')][_0x7e61('0x171')]('x')<0x0){_0x3a1310[_0x7e61('0xf0')]+='x';}if(_0x3a1310['opts'][_0x7e61('0x171')]('X')<0x0){_0x3a1310[_0x7e61('0xf0')]+='X';}this['channel'][_0x7e61('0xa2')](_0x7e61('0x172'),_0x486980?_0x486980[_0x7e61('0x173')]():'');var _0x19f48b=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0x174'),[_0x486980,_0x3a1310[_0x7e61('0xf0')],_0x3a1310['url'],_0x5b5a07,_0x3a1310['timeout'],_0x3a1310['agi'],_0x3a1310[_0x7e61('0x175')],_0x3a1310[_0x7e61('0x176')],'',_0x3a1310[_0x7e61('0x177')]]);if(_0x19f48b['result']===-0x1){return _0x19f48b;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xce'),_0x7e61('0x174'),_0x486980));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x178')]=function(_0x311c2c){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x179'),_0x311c2c[_0x7e61('0xb0')]));var _0x1a5ce2=_0x311c2c[_0x7e61('0x17a')]||_0x7e61('0x12c');var _0x2d5c72=util[_0x7e61('0x2b')](_0x7e61('0x17b'),this[_0x7e61('0xe')][_0x7e61('0x38')],rs[_0x7e61('0x119')](0x5));var _0x4ef61b=util[_0x7e61('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x2d5c72,_0x1a5ce2);var _0x11873f=util[_0x7e61('0x2b')]('%s/recordings/%s',FILES_PATH,_0x2d5c72);this[_0x7e61('0x3c')][_0x7e61('0x76')](this,_0x311c2c,_0x2d5c72,_0x4ef61b);this[_0x7e61('0xe')][_0x7e61('0xa2')](_0x7e61('0x17c'),_0x2d5c72);logger[_0x7e61('0x30')](_0x7e61('0x17d'),_0x11873f,_0x1a5ce2,_0x311c2c[_0x7e61('0x17e')],_0x311c2c[_0x7e61('0x6f')]);return this[_0x7e61('0xe')][_0x7e61('0x130')](_0x11873f,_0x1a5ce2,_0x311c2c[_0x7e61('0x17e')],_0x311c2c[_0x7e61('0x6f')],undefined,!![]);};AGIVertices[_0x7e61('0x10')][_0x7e61('0x17f')]=function(_0x400f73){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x180'),_0x400f73[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x400f73[_0x7e61('0x6d')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')]('no\x20url\x20configured');}var _0x287252=this[_0x7e61('0x6c')][_0x7e61('0x76')](this,_0x400f73);logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Response:',util['inspect'](_0x287252,{'showHidden':![],'depth':null})));if(!this[_0x7e61('0xac')](_0x400f73['variable_id'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x181'));}var _0xdc34c5=this['getVariable'][_0x7e61('0x76')](this,_0x400f73[_0x7e61('0xe4')]);if(!_0xdc34c5){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x400f73,_0x7e61('0x117'));}this[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')](_0x7e61('0x182'),_0xdc34c5),_0x287252[_0x7e61('0x7d')]?_0x287252[_0x7e61('0x7d')]:'200');this[_0x7e61('0xe')][_0x7e61('0xa2')](util[_0x7e61('0x2b')]('%s_STATUS_MESSAGE',_0xdc34c5),_0x287252[_0x7e61('0x183')]?_0x287252[_0x7e61('0x183')]:'OK');if(_0x287252['body']){try{this[_0x7e61('0x9f')](_0x287252[_0x7e61('0x7b')],_0xdc34c5);}catch(_0x12ebc0){logger['error'](util['format'](_0x7e61('0x184'),_0xdc34c5));}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0xea'),_0xdc34c5));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x185')]=function(_0x2be27e){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2be27e['label']));return this[_0x7e61('0xe')][_0x7e61('0x186')](_0x2be27e[_0x7e61('0x187')][_0x7e61('0x64')](/\s+/g,''),_0x2be27e['escape_digits']);};AGIVertices['prototype'][_0x7e61('0x188')]=function(_0x56e119){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x56e119[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0x189')](_0x56e119[_0x7e61('0x18a')]['replace'](/\s+/g,''),_0x56e119['escape_digits']);};AGIVertices['prototype'][_0x7e61('0x18b')]=function(_0x1172e4){logger[_0x7e61('0x30')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1172e4[_0x7e61('0xb0')]));return this['channel']['sayPhonetic'](_0x1172e4[_0x7e61('0x86')],_0x1172e4['escape_digits']);};AGIVertices[_0x7e61('0x10')]['sendMail']=function(_0x28bba9){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x28bba9['label']));if(!this['isConfigured'](_0x28bba9[_0x7e61('0x18c')])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x18d'));}var _0x2b4f2b=this['getMailAccount'][_0x7e61('0x76')](this,_0x28bba9[_0x7e61('0x18c')]);if(!_0x2b4f2b||!_0x2b4f2b[_0x7e61('0x18e')]){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x28bba9,_0x7e61('0x18f'));}var _0x68763f={'from':util['format'](_0x7e61('0x190'),_0x2b4f2b[_0x7e61('0x13')],_0x2b4f2b[_0x7e61('0x191')]||_0x2b4f2b['Smtp'][_0x7e61('0x192')]),'to':_0x28bba9['to']||'','cc':_0x28bba9['cc']||'','bcc':_0x28bba9['bcc']||'','subject':_0x28bba9[_0x7e61('0x193')],'html':_0x28bba9['text'],'text':_0x28bba9['text']};var _0xff7325={'tls':{'rejectUnauthorized':![]}};if(_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x194')]){_0xff7325['service']=_0x2b4f2b[_0x7e61('0x18e')]['service'];}else{_0xff7325[_0x7e61('0x195')]=_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x195')];_0xff7325[_0x7e61('0x196')]=_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x196')];_0xff7325[_0x7e61('0x197')]=_0x2b4f2b['Smtp'][_0x7e61('0x197')];}if(_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x198')]){_0xff7325[_0x7e61('0x199')]={'user':_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x192')],'pass':_0x2b4f2b[_0x7e61('0x18e')][_0x7e61('0x19a')]};}if(this[_0x7e61('0xac')](_0x28bba9[_0x7e61('0x19b')])){}logger[_0x7e61('0xeb')](_0x7e61('0x19c'),JSON[_0x7e61('0x79')](_0x68763f));this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x28bba9,_0x28bba9[_0x7e61('0x18c')]);this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0x19d'),_0x2b4f2b[_0x7e61('0x13')]));this[_0x7e61('0x24')]['sync'](this,_0xff7325,_0x68763f);return this['channel'][_0x7e61('0xb1')](_0x7e61('0x19e'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x19f')]=function(_0x3adb50){logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x1a0'),_0x3adb50[_0x7e61('0xb0')]));return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x1a1'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1a2')]=function(_0x48d366){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1a3'),_0x48d366[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x48d366[_0x7e61('0x1a4')])){return this['channel'][_0x7e61('0xb1')]('no\x20sms\x20account\x20configured');}var _0x58ecda=this[_0x7e61('0x35')][_0x7e61('0x76')](this,_0x48d366['sms_account_id']);if(!_0x58ecda){return this['channel'][_0x7e61('0x2f')](_0x48d366,_0x7e61('0x1a5'));}var _0x1ae30e={'body':_0x48d366['sms_text'],'phone':_0x48d366['to']||'','SmsAccountId':_0x58ecda['id']};logger[_0x7e61('0xeb')](_0x7e61('0x1a6'),JSON[_0x7e61('0x79')](_0x1ae30e));this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x48d366,_0x48d366[_0x7e61('0x1a4')]);this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1a7'),_0x58ecda[_0x7e61('0x13')]));this[_0x7e61('0x36')][_0x7e61('0x76')](this,_0x1ae30e);return this[_0x7e61('0xe')]['noop'](_0x7e61('0x1a8'));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1a9')]=function(_0x3aae17){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1aa'),_0x3aae17[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x3aae17['variable_id'])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3aae17,'no\x20variable\x20selected');}var _0x5d34e0=this[_0x7e61('0x11')][_0x7e61('0x76')](this,_0x3aae17[_0x7e61('0xe4')]);if(!_0x5d34e0){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x3aae17,'no\x20variable\x20found');}return this['channel']['setVariable'](_0x5d34e0,_0x3aae17['variable_value']);};AGIVertices[_0x7e61('0x10')]['start']=function(_0x527bb1){logger[_0x7e61('0x30')](util['format'](_0x7e61('0x1ab'),_0x527bb1[_0x7e61('0xb0')]));this[_0x7e61('0xe')]['noop'](_0x7e61('0x1ac'));if(_0x527bb1['answer']===_0x7e61('0x1ad')){this['channel']['noop'](_0x7e61('0x1ae'));return this[_0x7e61('0xe')][_0x7e61('0xbf')]();}return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0x1af'));};AGIVertices[_0x7e61('0x10')]['subproject']=function(_0x359f5b){logger['info'](util['format'](_0x7e61('0x1b0'),_0x359f5b[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x359f5b['project_id'])){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x359f5b,'no\x20subproject\x20selected');}var _0x43228e=this[_0x7e61('0x1b1')][_0x7e61('0x76')](this,_0x359f5b[_0x7e61('0x1b2')]);if(!this['isConfigured'](_0x43228e)){return this['channel'][_0x7e61('0x2f')](_0x359f5b,util[_0x7e61('0x2b')](_0x7e61('0x1b3'),_0x359f5b[_0x7e61('0x1b2')]));}if(_0x43228e===this[_0x7e61('0xe')][_0x7e61('0x3a')]){return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x359f5b,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x359f5b,_0x43228e);var _0x343b3f=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0x1b4'),util[_0x7e61('0x2b')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x7e61('0x195')]||_0x7e61('0x1b5'),_0x43228e,this[_0x7e61('0xe')]['arg_1']));if(_0x343b3f[_0x7e61('0xaa')]===-0x1){return _0x343b3f;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('Executed\x20command\x20%s\x20%s',_0x7e61('0x1b4'),_0x43228e));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1b6')]=function(_0x3d9d6a){logger['info'](util[_0x7e61('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x3d9d6a[_0x7e61('0xb0')]));var _0x8f1a44=this[_0x7e61('0x1b7')][_0x7e61('0x76')](this,_0x3d9d6a[_0x7e61('0xbd')]);this[_0x7e61('0x37')][_0x7e61('0x76')](this,_0x3d9d6a,_0x3d9d6a['command']);if(this[_0x7e61('0xac')](_0x3d9d6a[_0x7e61('0xe4')])){var _0x4418cd=this[_0x7e61('0x11')][_0x7e61('0x76')](this,_0x3d9d6a[_0x7e61('0xe4')]);if(_0x4418cd){this[_0x7e61('0xe')]['setVariable'](_0x4418cd,_0x8f1a44);return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1b8'),_0x3d9d6a['command'],_0x4418cd));}}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1b9'),_0x3d9d6a['command']));};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1ba')]=function(_0x213995){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1bb'),_0x213995[_0x7e61('0xb0')]));_0x213995[_0x7e61('0x86')]=_0x213995[_0x7e61('0x86')][_0x7e61('0x64')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7e61('0xac')](_0x213995[_0x7e61('0x1bc')])){return this[_0x7e61('0xe')]['noop'](_0x7e61('0x1bd'));}if(!this['isConfigured'](_0x213995['text'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this['channel']['noop'](util[_0x7e61('0x2b')](_0x7e61('0x1be'),_0x213995['text']));var _0x18fd98=this['googleCloudTTS'][_0x7e61('0x76')](this,_0x213995);if(_0x18fd98){this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1bf'),_0x18fd98));var _0xfaca46=this[_0x7e61('0xe')][_0x7e61('0x104')](_0x18fd98);try{fs['unlink'](_0x18fd98+'.wav');}catch(_0x405697){logger[_0x7e61('0x2f')](_0x405697);}return _0xfaca46;}return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x213995,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7e61('0x10')][_0x7e61('0x1c0')]=function(_0x4b9e57){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1c1'),_0x4b9e57[_0x7e61('0xb0')]));_0x4b9e57[_0x7e61('0x86')]=_0x4b9e57[_0x7e61('0x86')][_0x7e61('0x64')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7e61('0xac')](_0x4b9e57['text'])){return this[_0x7e61('0xe')][_0x7e61('0xb1')](_0x7e61('0xb2'));}this[_0x7e61('0xe')]['noop'](util[_0x7e61('0x2b')](_0x7e61('0x1c2'),_0x4b9e57['text']));var _0x3ed9f0=this[_0x7e61('0x6b')][_0x7e61('0x76')](this,_0x4b9e57);if(_0x3ed9f0){this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x1c3'),_0x3ed9f0));var _0x128cf6=this[_0x7e61('0xe')][_0x7e61('0x104')](_0x3ed9f0);try{fs['unlink'](_0x3ed9f0+'.wav');}catch(_0x5d7d6d){logger[_0x7e61('0x2f')](_0x5d7d6d);}return _0x128cf6;}return this[_0x7e61('0xe')][_0x7e61('0x2f')](_0x4b9e57,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7e61('0x10')]['unpause']=function(_0x3f8402){logger['info'](util['format'](_0x7e61('0x1c4'),_0x3f8402[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x3f8402[_0x7e61('0x158')])){return this['channel'][_0x7e61('0x2f')](_0x3f8402,'no\x20find\x20by\x20configured');}logger[_0x7e61('0x30')](util['format'](_0x7e61('0x157'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x3f8402[_0x7e61('0x158')]));var _0x4f5fd7=this[_0x7e61('0x5c')][_0x7e61('0x76')](this,_0x3f8402[_0x7e61('0x158')]);if(_0x4f5fd7){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x159'),this[_0x7e61('0xe')]['callerid'],_0x3f8402[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util['format'](_0x7e61('0x159'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x3f8402[_0x7e61('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x3f8402[_0x7e61('0x158')]));this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')](_0x7e61('0x15a'),this[_0x7e61('0xe')][_0x7e61('0x3b')],_0x3f8402[_0x7e61('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7e61('0x10')]['voicemail']=function(_0x3148ad){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1c5'),_0x3148ad[_0x7e61('0xb0')]));var _0x4c619d=this[_0x7e61('0xe')][_0x7e61('0x62')](_0x7e61('0x1c6'),[_0x3148ad['mailbox'],_0x3148ad[_0x7e61('0x80')]]);if(_0x4c619d[_0x7e61('0xaa')]===-0x1){return _0x4c619d;}return this[_0x7e61('0xe')][_0x7e61('0xb1')](util[_0x7e61('0x2b')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x3148ad['mailbox']));};AGIVertices['prototype'][_0x7e61('0x1c7')]=function(_0x164830){logger[_0x7e61('0x30')](util[_0x7e61('0x2b')](_0x7e61('0x1c8'),_0x164830[_0x7e61('0xb0')]));if(!this[_0x7e61('0xac')](_0x164830[_0x7e61('0xe4')])){return this['channel'][_0x7e61('0x2f')](_0x164830,_0x7e61('0x1c9'));}var _0xa009ce=this['getVariable']['sync'](this,_0x164830[_0x7e61('0xe4')]);if(!_0xa009ce){return this['channel'][_0x7e61('0x2f')](_0x164830,_0x7e61('0x117'));}var _0x4b72bb=this['channel'][_0x7e61('0x11')](_0xa009ce);return{'code':0xc8,'result':_0x4b72bb[_0x7e61('0xa7')]?_0x4b72bb['extra']:'-'};};String[_0x7e61('0x10')][_0x7e61('0xa6')]=function(_0x33cc65,_0x12a72b){return this['split'](_0x33cc65)[_0x7e61('0x1ca')](_0x12a72b);};module[_0x7e61('0x1cb')]=AGIVertices; \ No newline at end of file +var _0x4156=['Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','SESTEK_NDA_%s','audiofile','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','file_id','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','service','host','port','secure','user','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','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','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20is\x20unreachable','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','rpc','getVariable','getVariableById','then','prototype','getVoiceQueue','catch','getSquareProjectById','name','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','format','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','error','getSmsAccountById','createSmsMessage','channel','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','has','dialTimezone','isNil','VALUE\x20TZ','CALLERID(dialTimezone)','phone','RETVALRPC','TZ\x20found\x20in\x20shared:','isEmpty','callback_','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','text','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','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','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','replaceall\x20init','split','nextbracket','replaceAll','replaceall\x20end','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','createSquareDetailsReport','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts'];(function(_0x1f5c6d,_0x18704b){var _0x531ee2=function(_0x4d2310){while(--_0x4d2310){_0x1f5c6d['push'](_0x1f5c6d['shift']());}};_0x531ee2(++_0x18704b);}(_0x4156,0xf1));var _0x6415=function(_0x42605f,_0x10e375){_0x42605f=_0x42605f-0x0;var _0x4391ff=_0x4156[_0x42605f];return _0x4391ff;};'use strict';var fs=require('fs');var path=require(_0x6415('0x0'));var util=require(_0x6415('0x1'));var _=require(_0x6415('0x2'));var sh=require(_0x6415('0x3'));var odbc=require(_0x6415('0x4'))();var rs=require('randomstring');var moment=require(_0x6415('0x5'));var Mustache=require(_0x6415('0x6'));var rp=require(_0x6415('0x7'));var logger=require(_0x6415('0x8'))(_0x6415('0x9'));var config=require(_0x6415('0xa'));var shared=require(_0x6415('0xb'));var scripts=require('./scripts');var FILES_PATH=_0x6415('0xc');var recursiveMapAttributes=['rawHeaders',_0x6415('0xd')];var verticesWithRetry=[_0x6415('0xe'),'getdigits',_0x6415('0xf')];var AGIVertices=function(_0x224e7b,_0x3383d2,_0x1b702a){this['channel']=_0x224e7b;this[_0x6415('0x10')]=_0x3383d2;this['mailRpc']=_0x1b702a;};AGIVertices['prototype'][_0x6415('0x11')]=function(_0x153336,_0x2ff916){this[_0x6415('0x10')][_0x6415('0x12')](_0x153336)[_0x6415('0x13')](function(_0x455f44){_0x2ff916(null,_0x455f44?_0x455f44['name']:![]);})['catch'](function(_0x8e7067){_0x2ff916(_0x8e7067);});};AGIVertices[_0x6415('0x14')][_0x6415('0x15')]=function(_0xf75bec,_0x21ae74){this['rpc']['getVoiceQueueById'](_0xf75bec)[_0x6415('0x13')](function(_0x780643){_0x21ae74(null,_0x780643?_0x780643['name']:![]);})[_0x6415('0x16')](function(_0x41f9b0){_0x21ae74(_0x41f9b0);});};AGIVertices['prototype']['getSquareProject']=function(_0x352a04,_0x4216c8){this[_0x6415('0x10')][_0x6415('0x17')](_0x352a04)[_0x6415('0x13')](function(_0xa3d00a){_0x4216c8(null,_0xa3d00a?_0xa3d00a[_0x6415('0x18')]:![]);})[_0x6415('0x16')](function(_0x20dbd8){_0x4216c8(_0x20dbd8);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x515dc7,_0x3e3685){this[_0x6415('0x10')][_0x6415('0x19')](_0x515dc7)[_0x6415('0x13')](function(_0x551632){_0x3e3685(null,_0x551632?_0x551632[_0x6415('0x1a')]:![]);})[_0x6415('0x16')](function(_0x157ec8){_0x3e3685(_0x157ec8);});};AGIVertices['prototype'][_0x6415('0x1b')]=function(_0x266f97,_0x7c567f){this[_0x6415('0x10')][_0x6415('0x1c')](_0x266f97)[_0x6415('0x13')](function(_0x339c50){_0x7c567f(null,_0x339c50?_0x339c50[_0x6415('0x18')]:![]);})[_0x6415('0x16')](function(_0x54259f){_0x7c567f(_0x54259f);});};AGIVertices[_0x6415('0x14')][_0x6415('0x1d')]=function(_0x53646e,_0x15be31){this[_0x6415('0x10')][_0x6415('0x1e')](_0x53646e)[_0x6415('0x13')](function(_0x31dabc){_0x15be31(null,_0x31dabc?_0x31dabc['name']:![]);})[_0x6415('0x16')](function(_0x561586){_0x15be31(_0x561586);});};AGIVertices[_0x6415('0x14')][_0x6415('0x1f')]=function(_0x25d459,_0x4d66d0){var _0x4dea9d=this;this['rpc'][_0x6415('0x20')](_0x25d459)[_0x6415('0x13')](function(_0x581bc7){_0x4d66d0(null,_0x581bc7?_0x4dea9d['getSoundPath'](_0x581bc7[_0x6415('0x21')]):![]);})[_0x6415('0x16')](function(_0x162889){_0x4d66d0(_0x162889);});};AGIVertices[_0x6415('0x14')][_0x6415('0x22')]=function(_0x2ba17d,_0x5b15fd){this[_0x6415('0x10')][_0x6415('0x23')](_0x2ba17d)[_0x6415('0x13')](function(_0x1a9069){_0x5b15fd(null,_0x1a9069?_0x1a9069:![]);})['catch'](function(_0x4fc558){_0x5b15fd(_0x4fc558);});};AGIVertices['prototype'][_0x6415('0x24')]=function(_0x4880ee,_0x2a4346,_0x51253e){this[_0x6415('0x25')][_0x6415('0x24')](_0x4880ee,_0x2a4346)[_0x6415('0x13')](function(){_0x51253e(null);})[_0x6415('0x16')](function(_0x5e851d){_0x51253e(_0x5e851d);});};AGIVertices['prototype'][_0x6415('0x26')]=function(_0x40d7b7,_0x87d807){this[_0x6415('0x10')][_0x6415('0x27')](_0x40d7b7)[_0x6415('0x13')](function(_0x551dda){if(_0x551dda){if(_0x551dda[_0x6415('0x28')]){_0x87d807(null,[_0x551dda['interval']]);}else{_0x87d807(null,_['map'](_0x551dda['Intervals'],'interval'));}}else{_0x87d807(null,![]);}})[_0x6415('0x16')](function(_0x1444d0){_0x87d807(_0x1444d0);});};AGIVertices[_0x6415('0x14')]['getSoundPath']=function(_0x29223d){return util[_0x6415('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x29223d);};AGIVertices[_0x6415('0x14')][_0x6415('0x2a')]=function(_0x2e94a2,_0x122fd8,_0x248a5e){odbc['open'](_0x2e94a2,function(_0x15c32f){if(_0x15c32f){logger['error'](_0x6415('0x2b'),_0x15c32f);_0x248a5e(_0x15c32f);}else{logger[_0x6415('0x2c')]('ODBC\x20connection\x20successfully');odbc[_0x6415('0x2d')](_0x122fd8,function(_0x4b3973,_0x51b0f1){if(_0x4b3973){logger['info'](_0x6415('0x2e'),_0x122fd8);_0x248a5e(_0x4b3973);}else{logger['info'](_0x6415('0x2f'),_0x122fd8);odbc['close'](function(_0x3df19a){if(_0x3df19a){logger[_0x6415('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3df19a);}_0x248a5e(null,_0x51b0f1);});}});}});};AGIVertices[_0x6415('0x14')]['getSmsAccount']=function(_0x37b93f,_0xe4c4f0){this[_0x6415('0x10')][_0x6415('0x31')](_0x37b93f)[_0x6415('0x13')](function(_0x11ba2e){_0xe4c4f0(null,_0x11ba2e?_0x11ba2e:![]);})[_0x6415('0x16')](function(_0x9f3cc){_0xe4c4f0(_0x9f3cc);});};AGIVertices[_0x6415('0x14')][_0x6415('0x32')]=function(_0x205bdb,_0x35b203){this[_0x6415('0x10')][_0x6415('0x32')](_0x205bdb)[_0x6415('0x13')](function(_0x420c6c){_0x35b203(null,_0x420c6c);})[_0x6415('0x16')](function(_0x368e52){_0x35b203(_0x368e52);});};AGIVertices[_0x6415('0x14')]['createSquareDetailsReport']=function(_0x21b5d0,_0x4c7244,_0x2d36df){this[_0x6415('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x6415('0x33')][_0x6415('0x34')],'node':_0x21b5d0[_0x6415('0x35')],'application':_0x21b5d0[_0x6415('0x36')],'data':_0x4c7244||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x6415('0x33')]['callerid']})[_0x6415('0x13')](function(_0x507436){if(_0x2d36df){_0x2d36df(null,_0x507436);}})[_0x6415('0x16')](function(_0x198f24){if(_0x2d36df){_0x2d36df(_0x198f24);}});};AGIVertices[_0x6415('0x14')][_0x6415('0x37')]=function(_0x87d56b,_0x208da9,_0xba2047,_0x5278d4){this[_0x6415('0x10')][_0x6415('0x37')]({'uniqueid':this['channel'][_0x6415('0x34')],'callerid':this['channel'][_0x6415('0x38')],'calleridname':this[_0x6415('0x33')][_0x6415('0x39')],'context':this[_0x6415('0x33')][_0x6415('0x3a')],'extension':this['channel'][_0x6415('0x3b')],'priority':this['channel'][_0x6415('0x3c')],'accountcode':this[_0x6415('0x33')][_0x6415('0x3d')],'dnid':this[_0x6415('0x33')]['dnid'],'projectName':this[_0x6415('0x33')]['arg_1'],'saveName':_0x208da9,'filename':_0x87d56b[_0x6415('0x3e')]||_0x208da9,'savePath':_0xba2047})[_0x6415('0x13')](function(_0x55a350){_0x5278d4(null,_0x55a350);})[_0x6415('0x16')](function(_0x1ff82a){_0x5278d4(_0x1ff82a);});};AGIVertices[_0x6415('0x14')]['createSquareMessage']=function(_0x3bc9db,_0x1d89c1,_0xd46b1b){this[_0x6415('0x10')][_0x6415('0x3f')]({'uniqueid':this[_0x6415('0x33')][_0x6415('0x34')],'body':_0x3bc9db,'direction':_0x1d89c1})[_0x6415('0x13')](function(_0x4aacdc){if(_0xd46b1b){_0xd46b1b(null,_0x4aacdc);}})[_0x6415('0x16')](function(_0x1e3c85){if(_0xd46b1b){_0xd46b1b(_0x1e3c85);}});};AGIVertices[_0x6415('0x14')][_0x6415('0x40')]=function(_0xdac05d,_0x48f4fa){console[_0x6415('0x41')](_0x6415('0x42'),_0xdac05d);console[_0x6415('0x41')](_0x6415('0x43'),_0x48f4fa);var _0x15f734=0x0;if(_[_0x6415('0x44')](_0xdac05d,_0x6415('0x45'))){if(!_[_0x6415('0x46')](_0xdac05d[_0x6415('0x45')])){var _0x3ad31b=_0xdac05d['dialTimezone'];console[_0x6415('0x41')](_0x6415('0x47'),_0x3ad31b);if(_0xdac05d[_0x6415('0x45')]==_0x6415('0x48')){this[_0x6415('0x10')]['getContactByPhone']({'phone':_0xdac05d[_0x6415('0x49')]})[_0x6415('0x13')](function(_0x2d141e){console['log'](_0x6415('0x4a'),_0x2d141e);_0x48f4fa(null,_0x2d141e);});}else{console[_0x6415('0x41')](_0x6415('0x4b'),shared[_0x3ad31b]);}}}this[_0x6415('0x10')][_0x6415('0x40')]({'firstName':_[_0x6415('0x4c')](_0xdac05d['name'])||_[_0x6415('0x46')](_0xdac05d['name'])?_0x6415('0x4d')+Math[_0x6415('0x4e')]():_0xdac05d['name'],'lastName':_[_0x6415('0x4c')](_0xdac05d[_0x6415('0x4f')])||_[_0x6415('0x46')](_0xdac05d[_0x6415('0x4f')])?null:_0xdac05d[_0x6415('0x4f')],'phone':_0xdac05d[_0x6415('0x49')],'ListId':_0xdac05d['list_id'],'scheduledat':_0xdac05d[_0x6415('0x50')],'callbackUniqueid':this[_0x6415('0x33')][_0x6415('0x34')],'tags':_0x6415('0x51'),'description':_0x6415('0x52')+_0xdac05d[_0x6415('0x50')][_0x6415('0x53')](),'priority':_0xdac05d[_0x6415('0x54')]})[_0x6415('0x13')](function(_0x5f4d04){_0x48f4fa(null,_0x5f4d04);})['catch'](function(_0x241594){_0x48f4fa(_0x241594);});};AGIVertices[_0x6415('0x14')]['getPause']=function(_0x2ef816,_0x18554e){this[_0x6415('0x10')][_0x6415('0x55')](_0x2ef816)[_0x6415('0x13')](function(_0x4c9005){_0x18554e(null,_0x4c9005?_0x4c9005[_0x6415('0x18')]:![]);})['catch'](function(_0x3b97bc){_0x18554e(_0x3b97bc);});};AGIVertices[_0x6415('0x14')]['agentPause']=function(_0x408be4,_0x275340,_0xe075ed){var _0x46c4c9={'role':_0x6415('0x56')};_0x46c4c9[_0x408be4]=this[_0x6415('0x33')][_0x6415('0x38')];this['rpc']['agentPause'](_0x46c4c9,_0x275340,this[_0x6415('0x33')][_0x6415('0x34')])[_0x6415('0x13')](function(_0x1c49af){_0xe075ed(null,_['isNil'](_0x1c49af)?![]:!![]);})[_0x6415('0x16')](function(_0x4c39fd){logger[_0x6415('0x30')](_0x4c39fd);_0xe075ed(null,![]);});};AGIVertices[_0x6415('0x14')][_0x6415('0x57')]=function(_0x7f1871,_0x34ed0f){var _0x19435b={'role':_0x6415('0x56')};_0x19435b[_0x7f1871]=this[_0x6415('0x33')][_0x6415('0x38')];this[_0x6415('0x10')][_0x6415('0x57')](_0x19435b)[_0x6415('0x13')](function(_0x13d4d7){_0x34ed0f(null,_[_0x6415('0x46')](_0x13d4d7)?![]:!![]);})[_0x6415('0x16')](function(_0x1ba608){logger[_0x6415('0x30')](_0x1ba608);_0x34ed0f(null,![]);});};AGIVertices[_0x6415('0x14')][_0x6415('0x58')]=function(_0x445d4d,_0x100343){var _0x1fb569={'role':_0x6415('0x56')};_0x1fb569[_0x445d4d]=this['channel'][_0x6415('0x38')];this['rpc']['agentLogout'](_0x1fb569)[_0x6415('0x13')](function(_0x54d12f){_0x100343(null,_['isNil'](_0x54d12f)?![]:!![]);})[_0x6415('0x16')](function(_0x2b059e){logger[_0x6415('0x30')](_0x2b059e);_0x100343(null,![]);});};AGIVertices['prototype'][_0x6415('0x59')]=function(_0x1fcaf6,_0x2e0a91){var _0x4d1b15={'role':'agent'};_0x4d1b15[_0x1fcaf6]=this['channel']['callerid'];var _0x22ff9e=_0x1fcaf6!=_0x6415('0x5a')?util[_0x6415('0x29')]('%s/%s@from-sip/n','LOCAL',this[_0x6415('0x33')][_0x6415('0x38')]):undefined;this[_0x6415('0x10')][_0x6415('0x59')](_0x4d1b15,_0x22ff9e)[_0x6415('0x13')](function(_0x3952eb){_0x2e0a91(null,_['isNil'](_0x3952eb)?![]:!![]);})[_0x6415('0x16')](function(_0x2b1688){logger['error'](_0x2b1688);_0x2e0a91(null,![]);});};AGIVertices['prototype'][_0x6415('0x5b')]=function(_0x3963b0,_0x474a81){sh['exec'](_[_0x6415('0x5c')](_0x3963b0),function(_0x36bcee,_0xe000f0){var _0x441647=_0xe000f0['replace'](/(\r\n|\n|\r)/gm,'');_0x474a81(null,_0x441647);});};AGIVertices['prototype'][_0x6415('0x5d')]=function(_0x4c227b,_0xe2d65d){scripts[_0x6415('0x5d')](_0x4c227b[_0x6415('0x5e')],_0x4c227b[_0x6415('0x5f')]||'text',_0x4c227b['text'],_0x4c227b[_0x6415('0x60')]||_0x6415('0x61'),_0x4c227b[_0x6415('0x62')]||'MALE',_0x4c227b[_0x6415('0x63')]||_0x6415('0x64'))['then'](function(_0x4123f8){_0xe2d65d(null,_0x4123f8);})[_0x6415('0x16')](function(_0x5e2e49){_0xe2d65d(_0x5e2e49);});};AGIVertices[_0x6415('0x14')][_0x6415('0x65')]=function(_0x37cea4,_0x4cc2d8){scripts[_0x6415('0x65')](_0x37cea4[_0x6415('0x66')],_0x37cea4['google_tts_language']||'en',0x1)[_0x6415('0x13')](function(_0x13ebdd){_0x4cc2d8(null,_0x13ebdd);})[_0x6415('0x16')](function(_0x4d45cb){_0x4cc2d8(_0x4d45cb);});};AGIVertices[_0x6415('0x14')][_0x6415('0x67')]=function(_0xfe5a24,_0x163673){var _0x1fd5ce={'uri':_0xfe5a24[_0x6415('0x68')],'method':_0xfe5a24[_0x6415('0x69')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xfe5a24[_0x6415('0x6a')])===_0x6415('0x6b')&&parseInt(_0xfe5a24['timeout'])>=0x1?parseInt(_0xfe5a24[_0x6415('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x6415('0x6c')]([_0x6415('0x6d'),_0x6415('0x6e')],_0x1fd5ce[_0x6415('0x69')][_0x6415('0x6f')]())){try{_0x1fd5ce[_0x6415('0x70')]=_0xfe5a24[_0x6415('0xd')]?JSON[_0x6415('0x71')](_0xfe5a24['rawBody']):{};}catch(_0x2e86e2){logger[_0x6415('0x30')](_0x6415('0x72'),_0x2e86e2);}}try{_0x1fd5ce[_0x6415('0x73')]=_0xfe5a24[_0x6415('0x74')]?JSON[_0x6415('0x71')](_0xfe5a24[_0x6415('0x74')]):{};}catch(_0x4085e8){logger[_0x6415('0x30')](_0x6415('0x75'),_0x4085e8);}if(_0xfe5a24[_0x6415('0x76')]){try{var _0x555a55=require(_0xfe5a24['computedVariables'])[_0x6415('0x77')](this,_0x1fd5ce);_0x1fd5ce[_0x6415('0x78')]=Mustache[_0x6415('0x79')](_0xfe5a24[_0x6415('0x68')],_0x555a55,{},['$$','$$']);if(_0x1fd5ce[_0x6415('0x73')]){_0x1fd5ce[_0x6415('0x73')]=JSON[_0x6415('0x71')](Mustache['render'](JSON[_0x6415('0x7a')](_0x1fd5ce['headers']),_0x555a55,{},['$$','$$']));}if(_0x1fd5ce['body']){_0x1fd5ce[_0x6415('0x70')]=JSON[_0x6415('0x71')](Mustache[_0x6415('0x79')](JSON[_0x6415('0x7a')](_0x1fd5ce['body']),_0x555a55,{},['$$','$$']));}}catch(_0x4b9a95){logger['error'](_0x6415('0x7b'),_0x4b9a95);}}rp(_0x1fd5ce)[_0x6415('0x13')](function(_0x183c88){var _0xdcdde0={'statusCode':_0x183c88['statusCode']||0xc8,'statusMessage':_0x183c88[_0x6415('0x7c')]||'OK','headers':_0x183c88[_0x6415('0x73')]||{},'body':_0x183c88['body']||{}};_0x163673(null,_0xdcdde0);})['catch'](function(_0x562b07){var _0x1aa163={'statusCode':_0x562b07[_0x6415('0x7d')]||0x1f4,'statusMessage':_0x562b07[_0x6415('0x7e')]||_0x6415('0x7f'),'headers':_0x562b07['options'][_0x6415('0x73')]||{},'body':_0x562b07[_0x6415('0x80')][_0x6415('0x70')]||{}};_0x163673(null,_0x1aa163);});};AGIVertices['prototype'][_0x6415('0x81')]=function(_0x3bbaaa,_0x33c57f){scripts['googleDialogflow'](this[_0x6415('0x33')][_0x6415('0x34')],_0x3bbaaa[_0x6415('0x82')],_0x3bbaaa[_0x6415('0x66')],_0x3bbaaa['dialogflow_language']||'en')[_0x6415('0x13')](function(_0x2a60f1){_0x33c57f(null,_0x2a60f1);})[_0x6415('0x16')](function(_0x418957){_0x33c57f(_0x418957);});};AGIVertices[_0x6415('0x14')][_0x6415('0x83')]=function(_0x3d63a6,_0x5e9cca){scripts[_0x6415('0x83')](this[_0x6415('0x33')],_0x3d63a6)['then'](function(_0xf5f473){_0x5e9cca(null,_0xf5f473);})[_0x6415('0x16')](function(_0x8de8f2){_0x5e9cca(_0x8de8f2);});};AGIVertices[_0x6415('0x14')][_0x6415('0x84')]=function(_0x8f1ff4,_0x1eeb7f){scripts[_0x6415('0x84')](_0x8f1ff4['key'],_0x8f1ff4[_0x6415('0x66')],_0x8f1ff4[_0x6415('0x85')]||_0x6415('0x61'),_0x8f1ff4['speed'])[_0x6415('0x13')](function(_0x474857){_0x1eeb7f(null,_0x474857);})[_0x6415('0x16')](function(_0x2a7096){_0x1eeb7f(_0x2a7096);});};AGIVertices[_0x6415('0x14')][_0x6415('0x86')]=function(_0x1ab470,_0x1c0fb4,_0x508b3b){scripts[_0x6415('0x86')](_0x1c0fb4,_0x1ab470[_0x6415('0x82')],_0x1ab470[_0x6415('0x87')]||'en-US',this[_0x6415('0x88')](_0x1ab470['model'])?_0x1ab470[_0x6415('0x89')]:undefined)[_0x6415('0x13')](function(_0x1c0a0b){_0x508b3b(null,_0x1c0a0b);})[_0x6415('0x16')](function(_0x1dfe14){_0x508b3b(_0x1dfe14);});};AGIVertices['prototype'][_0x6415('0x8a')]=function(_0x550327,_0x3b33bd){scripts[_0x6415('0x8a')](_0x550327['aws_access_key_id'],_0x550327[_0x6415('0x8b')],_0x550327[_0x6415('0x8c')],_0x550327[_0x6415('0x8d')]||_0x6415('0x8e'),_0x550327['text'],_0x550327[_0x6415('0x8f')]||_0x6415('0x66'))[_0x6415('0x13')](function(_0x1d443c){_0x3b33bd(null,_0x1d443c);})['catch'](function(_0x1e4a7d){_0x3b33bd(_0x1e4a7d);});};AGIVertices['prototype'][_0x6415('0x90')]=function(_0x3af836,_0x5a77c4){scripts[_0x6415('0x90')](this[_0x6415('0x33')][_0x6415('0x34')],_0x3af836[_0x6415('0x91')],_0x3af836[_0x6415('0x8b')],_0x3af836[_0x6415('0x92')],_0x3af836['text'],_0x3af836['aws_bot_name'])['then'](function(_0x561558){_0x5a77c4(null,_0x561558);})[_0x6415('0x16')](function(_0xce1cc9){_0x5a77c4(_0xce1cc9);});};AGIVertices[_0x6415('0x14')][_0x6415('0x93')]=function(_0x39e6b3,_0x1fd582,_0x2664fb){scripts['googleASR'](_0x1fd582,_0x39e6b3[_0x6415('0x82')],_0x39e6b3[_0x6415('0x94')]||_0x6415('0x61'))[_0x6415('0x13')](function(_0x2ae6cd){_0x2664fb(null,_0x2ae6cd);})['catch'](function(_0x43fb0d){_0x2664fb(_0x43fb0d);});};AGIVertices['prototype'][_0x6415('0x95')]=function(_0x330a34,_0x1488d3,_0x401028){scripts['tildeASR'](_0x1488d3,_0x330a34[_0x6415('0x96')],_0x330a34[_0x6415('0x97')],_0x330a34['uri'])['then'](function(_0x1f8c92){_0x401028(null,_0x1f8c92);})[_0x6415('0x16')](function(_0x3a3e38){_0x401028(_0x3a3e38);});};AGIVertices['prototype'][_0x6415('0x98')]=function(_0x530c05){var _0x2d93ed=_[_0x6415('0x6c')](verticesWithRetry,_0x530c05[_0x6415('0x36')])?_0x530c05:_['clone'](_0x530c05);for(var _0x1f3ec9 in _0x2d93ed){if(_0x2d93ed[_0x6415('0x99')](_0x1f3ec9)){if(_0x2d93ed[_0x1f3ec9]&&_[_0x6415('0x9a')](_0x2d93ed[_0x1f3ec9])){if(_[_0x6415('0x6c')](recursiveMapAttributes,_0x1f3ec9)){_0x2d93ed[_0x1f3ec9]=this[_0x6415('0x9b')](_0x2d93ed[_0x1f3ec9]);}else{_0x2d93ed[_0x1f3ec9]=this['replaceAllVariables'](_0x2d93ed[_0x1f3ec9]);}}}}return _0x2d93ed;};AGIVertices[_0x6415('0x14')][_0x6415('0x9c')]=function(_0x23e597){for(var _0x4c69ee in _0x23e597){if(_0x23e597[_0x6415('0x99')](_0x4c69ee)){if(_[_0x6415('0x9d')](_0x23e597[_0x4c69ee])){this[_0x6415('0x9c')](_0x23e597[_0x4c69ee]);}else if(_[_0x6415('0x9e')](_0x23e597[_0x4c69ee])){for(var _0x1dc1ba=0x0;_0x1dc1ba<_0x23e597[_0x4c69ee][_0x6415('0x9f')];_0x1dc1ba++){this[_0x6415('0x9c')](_0x23e597[_0x4c69ee][_0x1dc1ba]);}}else if(_[_0x6415('0x9a')](_0x23e597[_0x4c69ee])){_0x23e597[_0x4c69ee]=this[_0x6415('0xa0')](_0x23e597[_0x4c69ee]);}}}};AGIVertices['prototype'][_0x6415('0xa1')]=function(_0x49a995,_0xd1e060){for(var _0x463af1 in _0x49a995){if(_0x49a995[_0x6415('0x99')](_0x463af1)){if(_[_0x6415('0x9d')](_0x49a995[_0x463af1])){if(!_[_0x6415('0x4c')](_0x49a995[_0x463af1])){this[_0x6415('0xa1')](_0x49a995[_0x463af1],util[_0x6415('0x29')](_0x6415('0xa2'),_0xd1e060,_0x463af1));}}else if(_['isArray'](_0x49a995[_0x463af1])){for(var _0x486a68=0x0;_0x486a68<_0x49a995[_0x463af1][_0x6415('0x9f')];_0x486a68++){this[_0x6415('0xa1')](_0x49a995[_0x463af1][_0x486a68],util[_0x6415('0x29')](_0x6415('0xa2'),_0xd1e060,_0x463af1+'['+_0x486a68+']'));}}else{if(!_[_0x6415('0x46')](_0x49a995[_0x463af1])){this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0xa2'),_0xd1e060,_0x463af1),_0x49a995[_0x463af1]);}}}}};AGIVertices[_0x6415('0x14')][_0x6415('0x9b')]=function(_0x573be3){try{var _0xe17dc7=JSON[_0x6415('0x71')](_0x573be3);this['recursiveNodeIndex'](_0xe17dc7);return JSON[_0x6415('0x7a')](_0xe17dc7);}catch(_0x37f5af){return this[_0x6415('0xa0')](_0x573be3);}};AGIVertices[_0x6415('0x14')][_0x6415('0xa0')]=function(_0x1c2cfa){console[_0x6415('0x41')](_0x6415('0xa4'),_0x1c2cfa);var _0x4e5496=_0x1c2cfa[_0x6415('0xa5')]('{');for(var _0x5c53b3=0x1;_0x5c53b3<_0x4e5496[_0x6415('0x9f')];_0x5c53b3+=0x1){var _0x5eb263=_0x4e5496[_0x5c53b3][_0x6415('0xa5')]('}');console[_0x6415('0x41')](_0x6415('0xa6'),_0x5eb263);if(_0x5eb263[_0x6415('0x9f')]>0x1){_0x1c2cfa=_0x1c2cfa[_0x6415('0xa7')]('{'+_0x5eb263[0x0]+'}',this[_0x6415('0x33')][_0x6415('0x11')](_0x5eb263[0x0])['extra']||_0x5eb263[0x0]);}}if(_0x4e5496[_0x6415('0x9f')]===0x1){return _0x1c2cfa[_0x6415('0x53')]();}console['log'](_0x6415('0xa8'),_0x1c2cfa);return this[_0x6415('0xa0')](_0x1c2cfa);};AGIVertices['prototype'][_0x6415('0xa9')]=function(_0x51791b,_0x1bbd88){var _0x48c975=this[_0x6415('0x33')][_0x6415('0x11')](_0x51791b);if(_0x48c975['result']===-0x1){return _0x48c975;}logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xaa'),_0x1bbd88,_0x48c975['extra']));return this[_0x6415('0x33')][_0x6415('0xa3')](_0x1bbd88,_0x48c975[_0x6415('0xab')]);};AGIVertices[_0x6415('0x14')][_0x6415('0x88')]=function(_0x155c02){return _0x155c02&&_0x155c02!=='0'&&_0x155c02!=='-1'&&_0x155c02!=='';};AGIVertices[_0x6415('0x14')][_0x6415('0xac')]=function(_0x2c235e){this[_0x6415('0xad')][_0x6415('0x77')](this,_0x2c235e,'-');_0x2c235e[_0x6415('0xae')]=_0x2c235e[_0x6415('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x6415('0xaf')]=function(_0x1847ec){logger['info'](util[_0x6415('0x29')](_0x6415('0xb0'),_0x1847ec['label']));if(!this[_0x6415('0x88')](_0x1847ec[_0x6415('0x66')])){return this[_0x6415('0x33')]['noop'](_0x6415('0xb1'));}var _0x4a22c3='\x22'+_0x1847ec[_0x6415('0x66')]+'\x22';if(this[_0x6415('0x88')](_0x1847ec[_0x6415('0x80')])){_0x4a22c3+=','+_0x1847ec[_0x6415('0x80')];}var _0x30bbec=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xb3'),_0x4a22c3);if(_0x30bbec[_0x6415('0xb4')]===-0x1){return _0x30bbec;}return this['channel']['noop'](util[_0x6415('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4a22c3));};AGIVertices[_0x6415('0x14')][_0x6415('0xb5')]=function(_0x147fa8){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xb6'),_0x147fa8[_0x6415('0x35')]));if(!this['isConfigured'](_0x147fa8['grammar'])){return this['channel'][_0x6415('0xb7')](_0x6415('0xb8'));}var _0x6927a9=_0x147fa8[_0x6415('0xb9')];if(this[_0x6415('0x88')](_0x147fa8[_0x6415('0x80')])){_0x6927a9+=','+_0x147fa8[_0x6415('0x80')];}var _0x278a69=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xba'),_0x6927a9);if(_0x278a69[_0x6415('0xb4')]===-0x1){return _0x278a69;}var _0x2a40ce=this[_0x6415('0xa9')](_0x6415('0xbb'),_0x6415('0xbc'));if(_0x2a40ce[_0x6415('0xb4')]===-0x1){return _0x2a40ce;}var _0x44fd72=this[_0x6415('0xa9')]('RECOG_INPUT()',_0x6415('0xbd'));if(_0x44fd72['result']===-0x1){return _0x44fd72;}var _0x28791f=this[_0x6415('0xa9')](_0x6415('0xbe'),_0x6415('0xbf'));if(_0x28791f[_0x6415('0xb4')]===-0x1){return _0x28791f;}return this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0xc0'),_0x6927a9));};AGIVertices[_0x6415('0x14')][_0x6415('0x9')]=function(_0x4224b8){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xc1'),_0x4224b8[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0x9')]([_0x4224b8['command'],_0x4224b8[_0x6415('0xc2')]]);};AGIVertices[_0x6415('0x14')][_0x6415('0xc3')]=function(_0x50a6b0){logger[_0x6415('0x2c')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x50a6b0[_0x6415('0x35')]));if(this[_0x6415('0x88')](_0x50a6b0['timeout'])){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xc4'),_0x50a6b0[_0x6415('0x6a')]));var _0x1b2851=this[_0x6415('0x33')][_0x6415('0xc5')](_0x50a6b0[_0x6415('0x6a')]);if(_0x1b2851[_0x6415('0xb4')]===-0x1){return _0x1b2851;}}return this[_0x6415('0x33')][_0x6415('0xc3')]();};AGIVertices[_0x6415('0x14')]['callback']=function(_0x107539){console['log'](_0x6415('0xc6'),_0x107539);logger[_0x6415('0x2c')](util['format'](_0x6415('0xc7'),_0x107539[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x107539[_0x6415('0xc8')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x107539,'no\x20list\x20selected');}_0x107539[_0x6415('0x50')]=moment();if(this['isConfigured'](_0x107539[_0x6415('0xc9')])){_0x107539[_0x6415('0x50')]=moment()[_0x6415('0xca')](_0x107539['delay'],_0x6415('0xcb'));}if(!this[_0x6415('0x88')](_0x107539[_0x6415('0x54')])){_0x107539[_0x6415('0x54')]=0x2;}console[_0x6415('0x41')]('before\x20createcmcontact',_0x107539);this['createCmContact'][_0x6415('0x77')](this,_0x107539);return this[_0x6415('0x33')]['noop'](util['format'](_0x6415('0xcc'),_0x107539[_0x6415('0x49')],_0x107539['list_id'],_0x107539['scheduledAt']));};AGIVertices[_0x6415('0x14')][_0x6415('0xcd')]=function(_0x2640d8){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2640d8[_0x6415('0x35')]));var _0x2439c7=this[_0x6415('0x33')][_0x6415('0xb2')](_0x2640d8[_0x6415('0xce')],_0x2640d8[_0x6415('0x80')]);if(_0x2439c7[_0x6415('0xb4')]===-0x1){return _0x2439c7;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xcf'),_0x2640d8[_0x6415('0xce')],_0x2640d8['options']));};AGIVertices['prototype'][_0x6415('0xd0')]=function(_0x1b89ec){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xd1'),_0x1b89ec['label']));if(!this[_0x6415('0x88')](_0x1b89ec[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xb1'));}var _0x2a5a78='\x22'+_0x1b89ec[_0x6415('0x66')]+'\x22';if(this[_0x6415('0x88')](_0x1b89ec['options'])){_0x2a5a78+=','+_0x1b89ec[_0x6415('0x80')];}var _0x7ea177=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xb3'),_0x2a5a78);if(_0x7ea177[_0x6415('0xb4')]===-0x1){return _0x7ea177;}return this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')](_0x6415('0xd2'),_0x2a5a78));};AGIVertices[_0x6415('0x14')][_0x6415('0xd3')]=function(_0x224a94){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xd4'),_0x224a94[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x224a94['text'])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xb1'));}var _0x10e751='\x22'+_0x224a94[_0x6415('0x66')]+'\x22';if(this[_0x6415('0x88')](_0x224a94[_0x6415('0x80')])){_0x10e751+=','+_0x224a94[_0x6415('0x80')];}var _0x48de55=this[_0x6415('0x33')][_0x6415('0xb2')]('MRCPSynth',_0x10e751);if(_0x48de55[_0x6415('0xb4')]===-0x1){return _0x48de55;}return this['channel']['noop'](util[_0x6415('0x29')](_0x6415('0xd2'),_0x10e751));};AGIVertices['prototype']['lumenvoxasr']=function(_0x34cb32){logger[_0x6415('0x2c')](util['format'](_0x6415('0xd5'),_0x34cb32[_0x6415('0x35')]));if(!this['isConfigured'](_0x34cb32['grammar'])){return this[_0x6415('0x33')]['noop'](_0x6415('0xb8'));}var _0x2e869d=_0x34cb32[_0x6415('0xb9')];if(this['isConfigured'](_0x34cb32[_0x6415('0x80')])){_0x2e869d+=','+_0x34cb32['options'];}var _0x1d9940=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xba'),_0x2e869d);if(_0x1d9940['result']===-0x1){return _0x1d9940;}var _0x4e640e=this[_0x6415('0xa9')]('RECOG_CONFIDENCE()',_0x6415('0xd6'));if(_0x4e640e[_0x6415('0xb4')]===-0x1){return _0x4e640e;}var _0x50eb9f=this[_0x6415('0xa9')](_0x6415('0xd7'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x50eb9f[_0x6415('0xb4')]===-0x1){return _0x50eb9f;}var _0x4d0afa=this['getAndSetVariable'](_0x6415('0xbe'),_0x6415('0xd8'));if(_0x4d0afa[_0x6415('0xb4')]===-0x1){return _0x4d0afa;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xc0'),_0x2e869d));};AGIVertices[_0x6415('0x14')][_0x6415('0xd9')]=function(_0x32dfba){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x32dfba[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x32dfba[_0x6415('0xb9')])){return this[_0x6415('0x33')]['noop']('no\x20grammar\x20configured');}var _0x46d118=_0x32dfba[_0x6415('0xb9')];if(this[_0x6415('0x88')](_0x32dfba[_0x6415('0x80')])){_0x46d118+=','+_0x32dfba[_0x6415('0x80')];}var _0x2dd560=this[_0x6415('0x33')][_0x6415('0xb2')]('MRCPRecog',_0x46d118);if(_0x2dd560[_0x6415('0xb4')]===-0x1){return _0x2dd560;}var _0x3543de=this[_0x6415('0xa9')](_0x6415('0xbb'),_0x6415('0xda'));if(_0x3543de[_0x6415('0xb4')]===-0x1){return _0x3543de;}var _0x1e9873=this[_0x6415('0xa9')](_0x6415('0xd7'),_0x6415('0xdb'));if(_0x1e9873[_0x6415('0xb4')]===-0x1){return _0x1e9873;}var _0x249fa7=this[_0x6415('0xa9')](_0x6415('0xbe'),'SESTEK_ASR_INSTANCE');if(_0x249fa7[_0x6415('0xb4')]===-0x1){return _0x249fa7;}return this['channel'][_0x6415('0xb7')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x46d118));};AGIVertices[_0x6415('0x14')][_0x6415('0xdc')]=function(_0x25f043){logger['info'](util[_0x6415('0x29')](_0x6415('0xdd'),_0x25f043[_0x6415('0x35')]));if(!this['isConfigured'](_0x25f043[_0x6415('0xde')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x25f043,'no\x20database\x20selected');}var _0x497542=this[_0x6415('0xdf')][_0x6415('0x77')](this,_0x25f043[_0x6415('0xde')]);if(!_0x497542){return this['channel']['error'](_0x25f043,_0x6415('0xe0'));}if(!this[_0x6415('0x88')](_0x25f043[_0x6415('0x2d')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x25f043,_0x6415('0xe1'));}var _0x5b6b47=_0x25f043[_0x6415('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0xe2'),_0x5b6b47));var _0x4443eb=this['getQueryOdbc'][_0x6415('0x77')](this,_0x497542,_0x5b6b47);this['createSquareDetailsReport'][_0x6415('0x77')](this,_0x25f043,_0x5b6b47);if(!this[_0x6415('0x88')](_0x25f043['variable_id'])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1ad0f8=this['getVariable'][_0x6415('0x77')](this,_0x25f043[_0x6415('0xe3')]);if(!_0x1ad0f8){return this[_0x6415('0x33')][_0x6415('0x30')](_0x25f043,_0x6415('0xe4'));}var _0x363a33=this;_0x4443eb['forEach'](function(_0x131497,_0x59c04c){Object['keys'](_0x131497)['forEach'](function(_0x2617f5){_0x363a33[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0xe5'),_0x1ad0f8,_0x59c04c,_0x2617f5),_0x131497[_0x2617f5]);});});this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0xe6'),_0x1ad0f8),_0x4443eb['length']);return this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')](_0x6415('0xe7'),_0x1ad0f8));};AGIVertices[_0x6415('0x14')][_0x6415('0xe8')]=function(_0x5555e3){logger['debug'](util[_0x6415('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x5555e3['label']));if(!this[_0x6415('0x88')](_0x5555e3[_0x6415('0xe9')])){return this['channel'][_0x6415('0x30')](_0x5555e3,_0x6415('0xea'));}var _0x44f37c=this[_0x6415('0x1b')]['sync'](this,_0x5555e3[_0x6415('0xe9')]);if(!_0x44f37c){return this['channel'][_0x6415('0x30')](_0x5555e3,'no\x20user\x20found');}var _0x44b20a=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0xeb'),[util['format']('SIP/%s',_0x44f37c),_0x5555e3['timeout'],_0x5555e3[_0x6415('0xec')],_0x5555e3[_0x6415('0x68')]]);if(_0x44b20a['result']===-0x1){return _0x44b20a;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xed'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x234c52){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xee'),_0x234c52[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x234c52['key'])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xef'));}if(!this['isConfigured'](_0x234c52['text'])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x6415('0xad')](_0x234c52);this[_0x6415('0x3f')](_0x234c52[_0x6415('0x66')],'in');this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xf0'),_0x234c52[_0x6415('0x66')]));var _0x567463=this[_0x6415('0x81')][_0x6415('0x77')](this,_0x234c52);if(_0x567463){for(var _0x17cbee in _0x567463){if(_0x567463[_0x6415('0x99')](_0x17cbee)){this[_0x6415('0x33')][_0x6415('0xa3')](util['format']('DIALOGFLOW_%s',_0x17cbee[_0x6415('0x6f')]()),_0x567463[_0x17cbee]);}}this[_0x6415('0x3f')](_0x567463[_0x6415('0xf1')],_0x6415('0xf2'));return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xf3'),_0x567463[_0x6415('0xf1')]));}return this['channel'][_0x6415('0x30')](_0x234c52,_0x6415('0xf4'));};AGIVertices[_0x6415('0x14')]['sesteknda']=function(_0x18635e){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0xf5'),_0x18635e['label']));if(!this['isConfigured'](_0x18635e[_0x6415('0xf6')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xf7'));}if(!this['isConfigured'](_0x18635e['username'])){return this['channel'][_0x6415('0xb7')](_0x6415('0xf8'));}if(!this['isConfigured'](_0x18635e[_0x6415('0xf9')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xfa'));}if(!this['isConfigured'](_0x18635e[_0x6415('0xfb')])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20text\x20configured');}this[_0x6415('0x33')][_0x6415('0xfc')]=!![];this[_0x6415('0xad')](_0x18635e);this[_0x6415('0x3f')](_0x18635e['text'],'in');this['channel']['noop'](util[_0x6415('0x29')]('Trying\x20SestekNDA:\x20%s',_0x18635e[_0x6415('0x66')]));var _0x571de5=this['sestekNDA'][_0x6415('0x77')](this,_0x18635e);if(_0x571de5){for(var _0x3e94e9 in _0x571de5){if(_0x571de5[_0x6415('0x99')](_0x3e94e9)){this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0xfd'),_0x3e94e9['toUpperCase']()),_0x571de5[_0x3e94e9]);}}this[_0x6415('0x3f')](_0x571de5['speech'],'out');if(_0x571de5[_0x6415('0xfe')]){this[_0x6415('0x33')][_0x6415('0xb7')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x571de5[_0x6415('0xfe')]));var _0xebc6d3=this[_0x6415('0x33')]['streamFile'](_0x571de5[_0x6415('0xfe')]);try{fs['unlink'](_0x571de5[_0x6415('0xfe')]+'.wav');}catch(_0x26d8d6){logger[_0x6415('0x30')](_0x26d8d6);}return _0xebc6d3;}else{return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xff'),_0x571de5[_0x6415('0xf1')]));}}return this['channel']['error'](_0x18635e,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x6415('0x14')][_0x6415('0x100')]=function(_0x37f4e5){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x101'),_0x37f4e5[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x100'));};AGIVertices[_0x6415('0x14')][_0x6415('0x102')]=function(_0x14ef53){logger['info'](util[_0x6415('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x14ef53[_0x6415('0x35')]));var _0x105a4a='';if(_0x14ef53['trunk_id']){if(!this[_0x6415('0x88')](_0x14ef53[_0x6415('0x103')])){return this[_0x6415('0x33')]['error'](_0x14ef53,_0x6415('0x104'));}else{var _0x45221b=parseInt(_0x14ef53['trunk_id'],0xa);if(isNaN(_0x45221b)){_0x105a4a=_0x14ef53[_0x6415('0x103')];}else{_0x105a4a=this['getTrunk'][_0x6415('0x77')](this,_0x14ef53[_0x6415('0x103')]);if(!_0x105a4a){return this[_0x6415('0x33')][_0x6415('0x30')](_0x14ef53,'no\x20trunk\x20found');}}}}else if(_0x14ef53['trunk_name']){_0x105a4a=_0x14ef53['trunk_name'];}else{return this[_0x6415('0x33')]['error'](_0x14ef53,_0x6415('0x104'));}var _0x351c51=this[_0x6415('0x33')]['exec'](_0x6415('0xeb'),[util[_0x6415('0x29')]('SIP/%s/%s',_0x105a4a,_0x14ef53[_0x6415('0x49')]),_0x14ef53[_0x6415('0x6a')],_0x14ef53[_0x6415('0xec')],_0x14ef53[_0x6415('0x68')]]);if(_0x351c51[_0x6415('0xb4')]===-0x1){return _0x351c51;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xed'),_0x6415('0xeb')));};AGIVertices[_0x6415('0x14')][_0x6415('0x105')]=function(_0x5c4f34){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x106'),_0x5c4f34[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x105'));};AGIVertices[_0x6415('0x14')][_0x6415('0x107')]=function(_0x53661a){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x108'),_0x53661a[_0x6415('0x35')]));if(_0x53661a[_0x6415('0xae')]===0x0){return this[_0x6415('0xac')](_0x53661a);}_0x53661a[_0x6415('0xae')]-=0x1;if(!this[_0x6415('0x88')](_0x53661a['file_id'])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x53661a,_0x6415('0x109'));}var _0x555c29=this['getSound']['sync'](this,_0x53661a['file_id']);if(!_0x555c29){return this[_0x6415('0x33')][_0x6415('0x30')](_0x53661a,_0x6415('0x10a'));}if(!this[_0x6415('0x88')](_0x53661a[_0x6415('0xe3')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x6415('0x10b'));}var _0x2cb052=this[_0x6415('0x33')][_0x6415('0x10c')](_0x555c29,_0x53661a[_0x6415('0x10d')],_0x53661a[_0x6415('0x10e')]);var _0x167c92=_0x2cb052[_0x6415('0xb4')]?_0x2cb052[_0x6415('0xb4')][_0x6415('0x53')]():'';logger['info']('test',JSON[_0x6415('0x7a')](_0x2cb052));if(_0x2cb052[_0x6415('0xb4')]===-0x1){this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,_0x167c92);return _0x2cb052;}else if(_0x2cb052['extra']===_0x6415('0x6a')){_0x2cb052[_0x6415('0xb4')]=_0x167c92[_0x6415('0x9f')]>=parseInt(_0x53661a['mindigit'])?'x':'i';}else{_0x2cb052[_0x6415('0xb4')]=_0x167c92[_0x6415('0x9f')]>=parseInt(_0x53661a[_0x6415('0x10f')])&&_0x167c92[_0x6415('0x9f')]<=parseInt(_0x53661a[_0x6415('0x10e')])?'x':'i';}var _0x1f8489=this['getVariable'][_0x6415('0x77')](this,_0x53661a[_0x6415('0xe3')]);if(!_0x1f8489){return this[_0x6415('0x33')][_0x6415('0x30')](_0x53661a,'no\x20variable\x20found');}this[_0x6415('0x33')][_0x6415('0xa3')](_0x1f8489,_0x167c92);if(this['isConfigured'](_0x53661a[_0x6415('0x110')])){var _0x19dd4b=parseInt(_0x53661a[_0x6415('0x110')],0xa);var _0x2b79d0=rs[_0x6415('0x111')]({'charset':'*','length':_0x19dd4b});var _0x3b6152=_0x167c92[_0x6415('0x9f')];if(_0x3b6152>0x0){if(_0x3b6152>_0x19dd4b){this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,_0x53661a[_0x6415('0x112')]==='first'?_0x2b79d0+_0x167c92[_0x6415('0x113')](_0x19dd4b):_0x167c92['substr'](0x0,_0x3b6152-_0x19dd4b)+_0x2b79d0);}else{this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,rs[_0x6415('0x111')]({'charset':'*','length':_0x3b6152}));}}else{this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,'');}}else{this[_0x6415('0xad')][_0x6415('0x77')](this,_0x53661a,_0x167c92);}return _0x2cb052;};AGIVertices[_0x6415('0x14')]['getsecretdigits']=function(_0x511b33){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x114'),_0x511b33[_0x6415('0x35')]));return this[_0x6415('0x107')](_0x511b33);};AGIVertices[_0x6415('0x14')]['goal']=function(_0x5b6299){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x115'),_0x5b6299[_0x6415('0x35')]));this['createSquareDetailsReport'][_0x6415('0x77')](this,_0x5b6299,_0x5b6299['goalname']);return this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')]('GOAL\x20%s',_0x5b6299[_0x6415('0x116')]));};AGIVertices[_0x6415('0x14')][_0x6415('0x117')]=function(_0x15c558){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x118'),_0x15c558[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x15c558[_0x6415('0x91')])||!this['isConfigured'](_0x15c558[_0x6415('0x8b')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x119'));}if(!this[_0x6415('0x88')](_0x15c558[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20text\x20configured');}this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x11a'),_0x15c558[_0x6415('0x66')]));var _0x404815=this[_0x6415('0x8a')]['sync'](this,_0x15c558);if(_0x404815){this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x11b'),_0x404815));var _0x4cf33d=this['channel'][_0x6415('0x11c')](_0x404815);try{fs[_0x6415('0x11d')](_0x404815+_0x6415('0x11e'));}catch(_0x47c9c2){logger[_0x6415('0x30')](_0x47c9c2);}return _0x4cf33d;}return this[_0x6415('0x33')][_0x6415('0x30')](_0x15c558,_0x6415('0x11f'));};AGIVertices['prototype']['awslex']=function(_0x3a3ee8){logger[_0x6415('0x2c')](util['format'](_0x6415('0x120'),_0x3a3ee8['label']));if(!this[_0x6415('0x88')](_0x3a3ee8['aws_access_key_id'])||!this['isConfigured'](_0x3a3ee8['aws_secret_access_key'])){return this['channel'][_0x6415('0xb7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x6415('0x88')](_0x3a3ee8[_0x6415('0x121')])){return this[_0x6415('0x33')]['noop'](_0x6415('0x122'));}if(!this[_0x6415('0x88')](_0x3a3ee8[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20text\x20configured');}this[_0x6415('0x33')][_0x6415('0xfc')]=!![];this[_0x6415('0xad')](_0x3a3ee8);this['createSquareMessage'](_0x3a3ee8[_0x6415('0x66')],'in');this[_0x6415('0x33')][_0x6415('0xb7')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x3a3ee8[_0x6415('0x66')]));var _0x2ac95f=this[_0x6415('0x90')][_0x6415('0x77')](this,_0x3a3ee8);if(_0x2ac95f){for(var _0x43f730 in _0x2ac95f){if(_0x2ac95f[_0x6415('0x99')](_0x43f730)&&_[_0x6415('0x9a')](_0x2ac95f[_0x43f730])){this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0x123'),_0x43f730[_0x6415('0x6f')]()),_0x2ac95f[_0x43f730]);}}if(_[_0x6415('0x46')](_0x2ac95f[_0x6415('0x7e')])){return this['channel'][_0x6415('0xb7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x6415('0x3f')](_0x2ac95f[_0x6415('0x7e')],_0x6415('0xf2'));return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x124'),_0x2ac95f['message']));}}return this[_0x6415('0x33')][_0x6415('0x30')](_0x3a3ee8,_0x6415('0x125'));};AGIVertices[_0x6415('0x14')][_0x6415('0x126')]=function(_0x290157){logger['info'](util['format'](_0x6415('0x127'),_0x290157[_0x6415('0x35')],_0x290157[_0x6415('0x6a')]));if(!this[_0x6415('0x88')](_0x290157[_0x6415('0x82')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xef'));}var _0x236f8a=_0x6415('0x128');var _0x35b1d1=util[_0x6415('0x29')](_0x6415('0x129'),FILES_PATH,rs[_0x6415('0x111')](0x4));var _0x22bc96=util['format'](_0x6415('0xa2'),_0x35b1d1,_0x236f8a);var _0x14643c=!![];if(_0x290157[_0x6415('0x12a')]===_0x6415('0x12b')){_0x14643c=![];}var _0x56a91=this['channel'][_0x6415('0x12c')](_0x35b1d1,_0x236f8a,_0x290157[_0x6415('0x12d')],_0x290157[_0x6415('0x6a')],undefined,_0x14643c);if(_0x56a91[_0x6415('0xb4')]!==-0x1){this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('google\x20%s\x20file\x20created',_0x22bc96));var _0x39a97c=this[_0x6415('0x93')][_0x6415('0x77')](this,_0x290157,_0x22bc96);if(_0x39a97c){for(var _0x3b61d4 in _0x39a97c){if(_0x39a97c[_0x6415('0x99')](_0x3b61d4)){this[_0x6415('0x33')][_0x6415('0xa3')](util[_0x6415('0x29')](_0x6415('0x12e'),_0x3b61d4[_0x6415('0x6f')]()),_0x39a97c[_0x3b61d4]);}}return this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x12f'),JSON['stringify'](_0x39a97c)));}}return _0x56a91;};AGIVertices[_0x6415('0x14')][_0x6415('0x130')]=function(_0x330bc1){logger[_0x6415('0x2c')](util['format'](_0x6415('0x131'),_0x330bc1[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x330bc1[_0x6415('0x96')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x132'));}if(!this[_0x6415('0x88')](_0x330bc1[_0x6415('0x97')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x133'));}var _0x303831=_0x6415('0x128');var _0xc75595=util['format'](_0x6415('0x129'),FILES_PATH,rs[_0x6415('0x111')](0x4));var _0x25601c=util[_0x6415('0x29')](_0x6415('0xa2'),_0xc75595,_0x303831);var _0xc2eda=!![];if(_0x330bc1[_0x6415('0x12a')]===_0x6415('0x12b')){_0xc2eda=![];}var _0x5de4ad=this[_0x6415('0x33')][_0x6415('0x12c')](_0xc75595,_0x303831,_0x330bc1[_0x6415('0x12d')],_0x330bc1[_0x6415('0x6a')],undefined,_0xc2eda);if(_0x5de4ad[_0x6415('0xb4')]!==-0x1){this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0x134'),_0x25601c));var _0x27f14c=this[_0x6415('0x95')][_0x6415('0x77')](this,_0x330bc1,_0x25601c);if(_0x27f14c){for(var _0xd08eec in _0x27f14c){if(_0x27f14c['hasOwnProperty'](_0xd08eec)){this[_0x6415('0x33')]['setVariable'](util['format'](_0x6415('0x135'),_0xd08eec[_0x6415('0x6f')]()),_0x27f14c[_0xd08eec]);}}return this[_0x6415('0x33')]['noop'](util['format'](_0x6415('0x136'),JSON[_0x6415('0x7a')](_0x27f14c)));}}return _0x5de4ad;};AGIVertices[_0x6415('0x14')][_0x6415('0x137')]=function(_0x49b7fd){logger['info'](util[_0x6415('0x29')](_0x6415('0x138'),_0x49b7fd['label']));return this[_0x6415('0x33')]['continueAt'](_0x49b7fd[_0x6415('0x3a')],_0x49b7fd['extension'],_0x49b7fd[_0x6415('0x3c')]);};AGIVertices[_0x6415('0x14')]['gotoif']=function(_0x4104c1){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4104c1[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x4104c1[_0x6415('0x139')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x4104c1,_0x6415('0x13a'));}try{var _0x165a87=eval(_0x4104c1[_0x6415('0x139')])?_0x6415('0x13b'):'false';this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x13c'),_0x4104c1[_0x6415('0x139')],_0x165a87));return{'code':0xc8,'result':_0x165a87};}catch(_0xe217e9){return{'code':0xc8,'result':_0x6415('0x13d')};}};AGIVertices['prototype'][_0x6415('0x13e')]=function(_0x59f009){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x13f'),_0x59f009[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x59f009[_0x6415('0x140')])){return this[_0x6415('0x33')]['error'](_0x59f009,_0x6415('0x141'));}var _0x36c50d=this[_0x6415('0x26')][_0x6415('0x77')](this,_0x59f009[_0x6415('0x140')]);if(!_0x36c50d){return this[_0x6415('0x33')]['error'](_0x59f009,'no\x20intervals\x20found');}for(var _0x3cb187=0x0;_0x3cb187<_0x36c50d[_0x6415('0x9f')];_0x3cb187+=0x1){var _0x3c08dc=this[_0x6415('0x33')][_0x6415('0x11')](util[_0x6415('0x29')](_0x6415('0x142'),_0x36c50d[_0x3cb187]));if(_0x3c08dc['result']===-0x1){return _0x3c08dc;}logger[_0x6415('0x2c')](util['format'](_0x6415('0x143'),_0x36c50d[_0x3cb187],_0x3c08dc[_0x6415('0xab')]));if(_0x3c08dc[_0x6415('0xab')]===_0x6415('0x13b')){logger[_0x6415('0x2c')](util['format'](_0x6415('0x143'),_0x36c50d[_0x3cb187],_0x6415('0x13b')));this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('IFTIME\x20%s\x20%s',_0x36c50d[_0x3cb187],_0x6415('0x13b')));return{'code':0xc8,'result':_0x6415('0x13b')};}else{logger[_0x6415('0x2c')](util['format'](_0x6415('0x143'),_0x36c50d[_0x3cb187],_0x6415('0x13d')));this[_0x6415('0x33')][_0x6415('0xb7')](util['format']('IFTIME\x20%s\x20%s',_0x36c50d[_0x3cb187],_0x6415('0x13d')));}}return{'code':0xc8,'result':_0x6415('0x13d')};};AGIVertices['prototype'][_0x6415('0x144')]=function(_0x2376ff){logger[_0x6415('0x2c')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2376ff[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0x144')]();};AGIVertices[_0x6415('0x14')][_0x6415('0x145')]=function(_0x2a0322){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x2a0322[_0x6415('0x35')]));if(!this['isConfigured'](_0x2a0322['key'])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xef'));}var _0x3ee026='wav';var _0x778395=util[_0x6415('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x6415('0x111')](0x4));var _0x6ebe5a=util[_0x6415('0x29')]('%s.%s',_0x778395,_0x3ee026);var _0x3d2ffe=!![];if(_0x2a0322[_0x6415('0x12a')]===_0x6415('0x12b')){_0x3d2ffe=![];}var _0x236bf9=this['channel'][_0x6415('0x12c')](_0x778395,_0x3ee026,_0x2a0322[_0x6415('0x12d')],_0x2a0322[_0x6415('0x6a')],undefined,_0x3d2ffe);if(_0x236bf9[_0x6415('0xb4')]!==-0x1){this['channel'][_0x6415('0xb7')](util['format']('ispeech\x20%s\x20file\x20created',_0x6ebe5a));var _0x2c815a=this[_0x6415('0x86')]['sync'](this,_0x2a0322,_0x6ebe5a);if(_0x2c815a){for(var _0x51f8d4 in _0x2c815a){if(_0x2c815a[_0x6415('0x99')](_0x51f8d4)){this['channel']['setVariable'](util[_0x6415('0x29')](_0x6415('0x146'),_0x51f8d4[_0x6415('0x6f')]()),_0x2c815a[_0x51f8d4]);}}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x147'),JSON[_0x6415('0x7a')](_0x2c815a)));}}return _0x236bf9;};AGIVertices['prototype'][_0x6415('0x148')]=function(_0x553b0c){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x149'),_0x553b0c['label']));if(!this[_0x6415('0x88')](_0x553b0c[_0x6415('0x82')])){return this[_0x6415('0x33')]['noop'](_0x6415('0xef'));}if(!this[_0x6415('0x88')](_0x553b0c[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xb1'));}this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x14a'),_0x553b0c[_0x6415('0x66')]));var _0x410ace=this[_0x6415('0x84')][_0x6415('0x77')](this,_0x553b0c);if(_0x410ace){this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x14b'),_0x410ace));var _0x24796e=this[_0x6415('0x33')]['streamFile'](_0x410ace,_0x553b0c[_0x6415('0x12d')]);try{fs[_0x6415('0x11d')](_0x410ace+_0x6415('0x11e'));}catch(_0x1337f7){logger[_0x6415('0x30')](_0x1337f7);}return _0x24796e;}return this[_0x6415('0x33')][_0x6415('0x30')](_0x553b0c,_0x6415('0x14c'));};AGIVertices['prototype'][_0x6415('0x14d')]=function(_0x23adf7){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x23adf7[_0x6415('0x35')]));if(!this['isConfigured'](_0x23adf7['findBy'])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x23adf7,_0x6415('0x14e'));}logger['info'](util['format'](_0x6415('0x14f'),this[_0x6415('0x33')][_0x6415('0x38')],_0x23adf7['findBy']));var _0x4dcd87=this[_0x6415('0x59')][_0x6415('0x77')](this,_0x23adf7['findBy']);if(_0x4dcd87){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x23adf7[_0x6415('0x150')]));this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x23adf7[_0x6415('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6415('0x2c')](util[_0x6415('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x23adf7[_0x6415('0x150')]));this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0x151'),this['channel'][_0x6415('0x38')],_0x23adf7[_0x6415('0x150')]));return{'code':0xc8,'result':_0x6415('0x152')};}};AGIVertices[_0x6415('0x14')]['logout']=function(_0x98cbe7){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x153'),_0x98cbe7[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x98cbe7[_0x6415('0x150')])){return this['channel'][_0x6415('0x30')](_0x98cbe7,_0x6415('0x14e'));}logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x14f'),this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7[_0x6415('0x150')]));var _0x2fd711=this['agentLogout']['sync'](this,_0x98cbe7[_0x6415('0x150')]);if(_0x2fd711){logger['info'](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7['findBy']));this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7['findBy']));return{'code':0xc8,'result':_0x6415('0x155')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7['findBy']));this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x98cbe7[_0x6415('0x150')]));return{'code':0xc8,'result':_0x6415('0x152')};}};AGIVertices[_0x6415('0x14')][_0x6415('0x156')]=function(_0x4fd11e){logger['info'](util['format'](_0x6415('0x157'),_0x4fd11e[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x4fd11e[_0x6415('0x158')])){return this[_0x6415('0x33')]['error'](_0x4fd11e,_0x6415('0x159'));}this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x15a'),_0x4fd11e[_0x6415('0x158')]));var _0x6366c7=eval(_0x4fd11e['operation']);if(!this[_0x6415('0x88')](_0x4fd11e[_0x6415('0xe3')])){return this['channel']['noop'](_0x6415('0x10b'));}var _0x568dfe=this[_0x6415('0x11')][_0x6415('0x77')](this,_0x4fd11e[_0x6415('0xe3')]);if(!_0x568dfe){return this[_0x6415('0x33')][_0x6415('0x30')](_0x4fd11e,_0x6415('0xe4'));}if(_[_0x6415('0x9e')](_0x6366c7)){var _0x3f853b=this;_0x6366c7[_0x6415('0x15b')](function(_0x36e639,_0x83a41a){_0x3f853b[_0x6415('0x33')][_0x6415('0xa3')](util['format'](_0x6415('0x15c'),_0x568dfe,_0x83a41a),_0x36e639);});return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x15d'),_0x568dfe));}else{return this[_0x6415('0x33')][_0x6415('0xa3')](_0x568dfe,_0x6366c7);}};AGIVertices[_0x6415('0x14')][_0x6415('0xe')]=function(_0x523a3c){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x523a3c[_0x6415('0x35')]));if(_0x523a3c[_0x6415('0xae')]===0x0){return this[_0x6415('0xac')](_0x523a3c);}_0x523a3c[_0x6415('0xae')]-=0x1;if(!this[_0x6415('0x88')](_0x523a3c[_0x6415('0x15e')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x523a3c,_0x6415('0x109'));}var _0x533007=this[_0x6415('0x1f')]['sync'](this,_0x523a3c[_0x6415('0x15e')]);if(!_0x533007){return this[_0x6415('0x33')][_0x6415('0x30')](_0x523a3c,_0x6415('0x10a'));}var _0x32c112=this[_0x6415('0x33')][_0x6415('0x10c')](_0x533007,_0x523a3c['response'],_0x523a3c[_0x6415('0x15f')]);var _0x1d9cc1=_0x32c112[_0x6415('0xb4')];if(_0x32c112['result']===-0x1){this[_0x6415('0xad')][_0x6415('0x77')](this,_0x523a3c,'-1');return _0x32c112;}else if(_0x32c112[_0x6415('0xab')]==='timeout'){_0x32c112[_0x6415('0xb4')]=_0x32c112[_0x6415('0xb4')][_0x6415('0x9f')]>0x0?_0x32c112[_0x6415('0xb4')]:'t';}else if(_[_0x6415('0x4c')](_0x32c112[_0x6415('0xb4')])){_0x32c112['result']='#';_0x1d9cc1='#';}if(!this['isConfigured'](_0x523a3c[_0x6415('0xe3')])){this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x10b'));}else{var _0x2aea18=this[_0x6415('0x11')]['sync'](this,_0x523a3c[_0x6415('0xe3')]);if(!_0x2aea18){return this[_0x6415('0x33')][_0x6415('0x30')](_0x523a3c,_0x6415('0xe4'));}this[_0x6415('0x33')][_0x6415('0xa3')](_0x2aea18,_0x1d9cc1);}this[_0x6415('0xad')][_0x6415('0x77')](this,_0x523a3c,_0x1d9cc1);return _0x32c112;};AGIVertices['prototype']['noop']=function(_0x581073){logger['info'](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x581073[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0xb7')](_0x581073[_0x6415('0x160')]||_0x581073[_0x6415('0x35')]);};AGIVertices[_0x6415('0x14')][_0x6415('0x161')]=function(_0x506023){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x162'),_0x506023['label']));if(!this[_0x6415('0x88')](_0x506023['findBy'])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x506023,'no\x20find\x20by\x20configured');}logger[_0x6415('0x2c')](util[_0x6415('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x6415('0x33')][_0x6415('0x38')],_0x506023[_0x6415('0x150')]));var _0x201d0b=this[_0x6415('0x163')][_0x6415('0x77')](this,_0x506023[_0x6415('0x164')]);var _0x58cac7=this[_0x6415('0x165')]['sync'](this,_0x506023[_0x6415('0x150')],_0x201d0b);if(_0x58cac7){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')][_0x6415('0x38')],_0x506023[_0x6415('0x150')]));this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x506023[_0x6415('0x150')]));return{'code':0xc8,'result':_0x6415('0x155')};}else{logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x151'),this['channel'][_0x6415('0x38')],_0x506023[_0x6415('0x150')]));this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')]['callerid'],_0x506023[_0x6415('0x150')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6415('0x14')][_0x6415('0x166')]=function(_0x384fd6){logger[_0x6415('0x2c')](util['format'](_0x6415('0x167'),_0x384fd6[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x384fd6[_0x6415('0x15e')])){return this[_0x6415('0x33')]['error'](_0x384fd6,_0x6415('0x109'));}var _0x1b012a=this[_0x6415('0x1f')]['sync'](this,_0x384fd6[_0x6415('0x15e')]);if(!_0x1b012a){return this['channel'][_0x6415('0x30')](_0x384fd6,_0x6415('0x10a'));}var _0x4580fa=this['channel']['exec'](_0x6415('0x168'),[_0x1b012a,_0x384fd6[_0x6415('0xec')]]);if(_0x4580fa[_0x6415('0xb4')]===-0x1){return _0x4580fa;}return this['channel'][_0x6415('0xb7')](util['format'](_0x6415('0xcf'),_0x6415('0x168'),_0x1b012a));};AGIVertices[_0x6415('0x14')][_0x6415('0x169')]=function(_0x34159b){logger['info'](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x34159b[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x34159b[_0x6415('0x16a')])){return this['channel'][_0x6415('0x30')](_0x34159b,'no\x20queue\x20selected');}var _0x5b7f0c='';var _0x461ba2=parseInt(_0x34159b['queue_id'],0xa);if(isNaN(_0x461ba2)){_0x5b7f0c=_0x34159b[_0x6415('0x16a')];}else{_0x5b7f0c=this[_0x6415('0x15')]['sync'](this,_0x34159b[_0x6415('0x16a')]);if(!_0x5b7f0c){return this[_0x6415('0x33')]['error'](_0x34159b,_0x6415('0x16b'));}}var _0x814639='';if(this[_0x6415('0x88')](_0x34159b[_0x6415('0x15e')])){var _0x5e1ff4=this[_0x6415('0x1f')][_0x6415('0x77')](this,_0x34159b['file_id']);if(_0x5e1ff4){_0x814639=_0x5e1ff4;}}this['createSquareDetailsReport'][_0x6415('0x77')](this,_0x34159b,_0x5b7f0c);if(_0x34159b[_0x6415('0xec')][_0x6415('0x16c')]('x')<0x0){_0x34159b[_0x6415('0xec')]+='x';}if(_0x34159b['opts'][_0x6415('0x16c')]('X')<0x0){_0x34159b['opts']+='X';}this['channel']['setVariable'](_0x6415('0x16d'),_0x5b7f0c?_0x5b7f0c[_0x6415('0x16e')]():'');var _0x1cf42b=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0x16f'),[_0x5b7f0c,_0x34159b[_0x6415('0xec')],_0x34159b[_0x6415('0x68')],_0x814639,_0x34159b[_0x6415('0x6a')],_0x34159b[_0x6415('0x9')],_0x34159b[_0x6415('0x170')],_0x34159b[_0x6415('0x171')],'',_0x34159b[_0x6415('0x172')]]);if(_0x1cf42b[_0x6415('0xb4')]===-0x1){return _0x1cf42b;}return this['channel']['noop'](util['format'](_0x6415('0xcf'),'QUEUE',_0x5b7f0c));};AGIVertices['prototype'][_0x6415('0x173')]=function(_0xd6e4a){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0xd6e4a[_0x6415('0x35')]));var _0x16b61b=_0xd6e4a[_0x6415('0x174')]||_0x6415('0x128');var _0x1a5bff=util[_0x6415('0x29')]('%s_%s',this['channel'][_0x6415('0x34')],rs[_0x6415('0x111')](0x5));var _0x8086bd=util[_0x6415('0x29')](_0x6415('0x175'),FILES_PATH,_0x1a5bff,_0x16b61b);var _0x286eae=util[_0x6415('0x29')](_0x6415('0x129'),FILES_PATH,_0x1a5bff);this[_0x6415('0x37')][_0x6415('0x77')](this,_0xd6e4a,_0x1a5bff,_0x8086bd);this['channel']['setVariable'](_0x6415('0x176'),_0x1a5bff);logger[_0x6415('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x286eae,_0x16b61b,_0xd6e4a[_0x6415('0x177')],_0xd6e4a[_0x6415('0x6a')]);return this[_0x6415('0x33')][_0x6415('0x12c')](_0x286eae,_0x16b61b,_0xd6e4a[_0x6415('0x177')],_0xd6e4a[_0x6415('0x6a')],undefined,!![]);};AGIVertices[_0x6415('0x14')][_0x6415('0x178')]=function(_0x2f9e4c){logger['info'](util[_0x6415('0x29')](_0x6415('0x179'),_0x2f9e4c[_0x6415('0x35')]));if(!this['isConfigured'](_0x2f9e4c['url'])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x17a'));}var _0x9ad662=this[_0x6415('0x67')][_0x6415('0x77')](this,_0x2f9e4c);logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Response:',util[_0x6415('0x17b')](_0x9ad662,{'showHidden':![],'depth':null})));if(!this[_0x6415('0x88')](_0x2f9e4c[_0x6415('0xe3')])){return this['channel']['noop'](_0x6415('0x17c'));}var _0x403ab7=this[_0x6415('0x11')][_0x6415('0x77')](this,_0x2f9e4c['variable_id']);if(!_0x403ab7){return this['channel'][_0x6415('0x30')](_0x2f9e4c,_0x6415('0xe4'));}this[_0x6415('0x33')][_0x6415('0xa3')](util['format']('%s_STATUS_CODE',_0x403ab7),_0x9ad662['statusCode']?_0x9ad662[_0x6415('0x7d')]:'200');this[_0x6415('0x33')]['setVariable'](util['format']('%s_STATUS_MESSAGE',_0x403ab7),_0x9ad662[_0x6415('0x7c')]?_0x9ad662['statusMessage']:'OK');if(_0x9ad662[_0x6415('0x70')]){try{this[_0x6415('0xa1')](_0x9ad662['body'],_0x403ab7);}catch(_0x29d9f4){logger['error'](util[_0x6415('0x29')](_0x6415('0x17d'),_0x403ab7));}}return this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0xe7'),_0x403ab7));};AGIVertices[_0x6415('0x14')][_0x6415('0x17e')]=function(_0x7e2d85){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x17f'),_0x7e2d85[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0x180')](_0x7e2d85[_0x6415('0x181')][_0x6415('0x182')](/\s+/g,''),_0x7e2d85[_0x6415('0x177')]);};AGIVertices['prototype'][_0x6415('0x183')]=function(_0x12027e){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x184'),_0x12027e['label']));return this[_0x6415('0x33')][_0x6415('0x185')](_0x12027e[_0x6415('0x6b')][_0x6415('0x182')](/\s+/g,''),_0x12027e[_0x6415('0x177')]);};AGIVertices[_0x6415('0x14')][_0x6415('0x186')]=function(_0x199f3f){logger['info'](util[_0x6415('0x29')](_0x6415('0x187'),_0x199f3f[_0x6415('0x35')]));return this[_0x6415('0x33')][_0x6415('0x188')](_0x199f3f['text'],_0x199f3f['escape_digits']);};AGIVertices[_0x6415('0x14')]['sendMail']=function(_0x522ebb){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x189'),_0x522ebb[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x522ebb[_0x6415('0x18a')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x18b'));}var _0x74b1d4=this['getMailAccount']['sync'](this,_0x522ebb['account_id']);if(!_0x74b1d4||!_0x74b1d4['Smtp']){return this[_0x6415('0x33')][_0x6415('0x30')](_0x522ebb,'no\x20mail\x20account\x20found');}var _0x3d3d12={'from':util[_0x6415('0x29')](_0x6415('0x18c'),_0x74b1d4['name'],_0x74b1d4[_0x6415('0x18d')]||_0x74b1d4[_0x6415('0x18e')]['user']),'to':_0x522ebb['to']||'','cc':_0x522ebb['cc']||'','bcc':_0x522ebb[_0x6415('0x18f')]||'','subject':_0x522ebb[_0x6415('0x190')],'html':_0x522ebb['text'],'text':_0x522ebb[_0x6415('0x66')]};var _0xf2459a={'tls':{'rejectUnauthorized':![]}};if(_0x74b1d4[_0x6415('0x18e')][_0x6415('0x191')]){_0xf2459a[_0x6415('0x191')]=_0x74b1d4['Smtp'][_0x6415('0x191')];}else{_0xf2459a[_0x6415('0x192')]=_0x74b1d4[_0x6415('0x18e')][_0x6415('0x192')];_0xf2459a['port']=_0x74b1d4['Smtp'][_0x6415('0x193')];_0xf2459a[_0x6415('0x194')]=_0x74b1d4['Smtp'][_0x6415('0x194')];}if(_0x74b1d4['Smtp']['authentication']){_0xf2459a['auth']={'user':_0x74b1d4[_0x6415('0x18e')][_0x6415('0x195')],'pass':_0x74b1d4[_0x6415('0x18e')]['pass']};}if(this['isConfigured'](_0x522ebb['template_id'])){}logger[_0x6415('0x196')](_0x6415('0x197'),JSON[_0x6415('0x7a')](_0x3d3d12));this[_0x6415('0xad')][_0x6415('0x77')](this,_0x522ebb,_0x522ebb[_0x6415('0x18a')]);this['channel'][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x198'),_0x74b1d4[_0x6415('0x18')]));this['sendMailMessage'][_0x6415('0x77')](this,_0xf2459a,_0x3d3d12);return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x199'));};AGIVertices[_0x6415('0x14')][_0x6415('0x19a')]=function(_0x3f79e0){logger['info'](util[_0x6415('0x29')](_0x6415('0x19b'),_0x3f79e0[_0x6415('0x35')]));return this[_0x6415('0x33')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x6415('0x19c')]=function(_0x5f04ca){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x19d'),_0x5f04ca[_0x6415('0x35')]));if(!this['isConfigured'](_0x5f04ca['sms_account_id'])){return this['channel']['noop']('no\x20sms\x20account\x20configured');}var _0x5a820b=this[_0x6415('0x19e')][_0x6415('0x77')](this,_0x5f04ca[_0x6415('0x19f')]);if(!_0x5a820b){return this[_0x6415('0x33')][_0x6415('0x30')](_0x5f04ca,_0x6415('0x1a0'));}var _0xdf9c35={'body':_0x5f04ca[_0x6415('0x1a1')],'phone':_0x5f04ca['to']||'','SmsAccountId':_0x5a820b['id']};logger[_0x6415('0x196')](_0x6415('0x1a2'),JSON['stringify'](_0xdf9c35));this[_0x6415('0xad')][_0x6415('0x77')](this,_0x5f04ca,_0x5f04ca[_0x6415('0x19f')]);this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0x1a3'),_0x5a820b[_0x6415('0x18')]));this[_0x6415('0x32')][_0x6415('0x77')](this,_0xdf9c35);return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x1a4'));};AGIVertices[_0x6415('0x14')][_0x6415('0x1a5')]=function(_0x57e834){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x1a6'),_0x57e834[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x57e834[_0x6415('0xe3')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x57e834,_0x6415('0x1a7'));}var _0x1520e9=this[_0x6415('0x11')]['sync'](this,_0x57e834[_0x6415('0xe3')]);if(!_0x1520e9){return this[_0x6415('0x33')][_0x6415('0x30')](_0x57e834,'no\x20variable\x20found');}return this['channel'][_0x6415('0xa3')](_0x1520e9,_0x57e834[_0x6415('0x1a8')]);};AGIVertices[_0x6415('0x14')][_0x6415('0x1a9')]=function(_0x169222){logger['info'](util[_0x6415('0x29')]('Enter\x20in\x20START\x20(%s)\x20block',_0x169222['label']));this[_0x6415('0x33')]['noop'](_0x6415('0x1aa'));if(_0x169222[_0x6415('0xc3')]==='yes'){this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x1ab'));return this[_0x6415('0x33')][_0x6415('0xc3')]();}return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0x1ac'));};AGIVertices[_0x6415('0x14')][_0x6415('0x1ad')]=function(_0x10fc8b){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x1ae'),_0x10fc8b[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x10fc8b['project_id'])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x10fc8b,'no\x20subproject\x20selected');}var _0x2d2032=this['getSquareProject']['sync'](this,_0x10fc8b[_0x6415('0x1af')]);if(!this[_0x6415('0x88')](_0x2d2032)){return this['channel'][_0x6415('0x30')](_0x10fc8b,util[_0x6415('0x29')](_0x6415('0x1b0'),_0x10fc8b[_0x6415('0x1af')]));}if(_0x2d2032===this['channel'][_0x6415('0x1b1')]){return this[_0x6415('0x33')][_0x6415('0x30')](_0x10fc8b,_0x6415('0x1b2'));}this[_0x6415('0xad')][_0x6415('0x77')](this,_0x10fc8b,_0x2d2032);var _0x1c4e36=this[_0x6415('0x33')][_0x6415('0xb2')](_0x6415('0x1b3'),util[_0x6415('0x29')](_0x6415('0x1b4'),config[_0x6415('0x9')][_0x6415('0x192')]||_0x6415('0x1b5'),_0x2d2032,this[_0x6415('0x33')]['arg_1']));if(_0x1c4e36[_0x6415('0xb4')]===-0x1){return _0x1c4e36;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('Executed\x20command\x20%s\x20%s','AGI',_0x2d2032));};AGIVertices[_0x6415('0x14')]['system']=function(_0x1e7b5e){logger[_0x6415('0x2c')](util['format'](_0x6415('0x1b6'),_0x1e7b5e[_0x6415('0x35')]));var _0x2c737a=this[_0x6415('0x5b')]['sync'](this,_0x1e7b5e[_0x6415('0x1b7')]);this[_0x6415('0xad')]['sync'](this,_0x1e7b5e,_0x1e7b5e[_0x6415('0x1b7')]);if(this[_0x6415('0x88')](_0x1e7b5e[_0x6415('0xe3')])){var _0x5f4c1c=this[_0x6415('0x11')]['sync'](this,_0x1e7b5e[_0x6415('0xe3')]);if(_0x5f4c1c){this[_0x6415('0x33')][_0x6415('0xa3')](_0x5f4c1c,_0x2c737a);return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x1b8'),_0x1e7b5e[_0x6415('0x1b7')],_0x5f4c1c));}}return this[_0x6415('0x33')][_0x6415('0xb7')](util['format'](_0x6415('0x1b9'),_0x1e7b5e['command']));};AGIVertices[_0x6415('0x14')][_0x6415('0x1ba')]=function(_0x3c9a58){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x1bb'),_0x3c9a58[_0x6415('0x35')]));_0x3c9a58[_0x6415('0x66')]=_0x3c9a58['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6415('0x88')](_0x3c9a58[_0x6415('0x5e')])){return this[_0x6415('0x33')][_0x6415('0xb7')]('no\x20apiKey\x20configured');}if(!this[_0x6415('0x88')](_0x3c9a58[_0x6415('0x66')])){return this['channel'][_0x6415('0xb7')](_0x6415('0xb1'));}this['channel'][_0x6415('0xb7')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3c9a58['text']));var _0x454595=this[_0x6415('0x5d')][_0x6415('0x77')](this,_0x3c9a58);if(_0x454595){this['channel'][_0x6415('0xb7')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x454595));var _0xa4575=this['channel'][_0x6415('0x11c')](_0x454595);try{fs[_0x6415('0x11d')](_0x454595+_0x6415('0x11e'));}catch(_0x40bca5){logger[_0x6415('0x30')](_0x40bca5);}return _0xa4575;}return this[_0x6415('0x33')]['error'](_0x3c9a58,_0x6415('0x1bc'));};AGIVertices['prototype']['tts']=function(_0x1f806d){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1f806d[_0x6415('0x35')]));_0x1f806d[_0x6415('0x66')]=_0x1f806d[_0x6415('0x66')][_0x6415('0x182')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6415('0x88')](_0x1f806d[_0x6415('0x66')])){return this[_0x6415('0x33')][_0x6415('0xb7')](_0x6415('0xb1'));}this['channel']['noop'](util[_0x6415('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x1f806d['text']));var _0x232297=this[_0x6415('0x65')][_0x6415('0x77')](this,_0x1f806d);if(_0x232297){this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0x1bd'),_0x232297));var _0x5bb1b6=this[_0x6415('0x33')]['streamFile'](_0x232297);try{fs['unlink'](_0x232297+_0x6415('0x11e'));}catch(_0x1a05b7){logger['error'](_0x1a05b7);}return _0x5bb1b6;}return this[_0x6415('0x33')]['error'](_0x1f806d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x6415('0x14')][_0x6415('0x1be')]=function(_0x4b5612){logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x1bf'),_0x4b5612['label']));if(!this[_0x6415('0x88')](_0x4b5612[_0x6415('0x150')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x4b5612,_0x6415('0x14e'));}logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x14f'),this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612['findBy']));var _0x1c8ccb=this[_0x6415('0x57')]['sync'](this,_0x4b5612[_0x6415('0x150')]);if(_0x1c8ccb){logger['info'](util[_0x6415('0x29')](_0x6415('0x154'),this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612[_0x6415('0x150')]));this[_0x6415('0x33')]['noop'](util[_0x6415('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612['findBy']));return{'code':0xc8,'result':_0x6415('0x155')};}else{logger[_0x6415('0x2c')](util[_0x6415('0x29')](_0x6415('0x151'),this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612[_0x6415('0x150')]));this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6415('0x33')][_0x6415('0x38')],_0x4b5612[_0x6415('0x150')]));return{'code':0xc8,'result':_0x6415('0x152')};}};AGIVertices[_0x6415('0x14')][_0x6415('0x1c0')]=function(_0x256cea){logger[_0x6415('0x2c')](util[_0x6415('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x256cea['label']));var _0x162683=this['channel']['exec'](_0x6415('0x1c1'),[_0x256cea[_0x6415('0x1c2')],_0x256cea[_0x6415('0x80')]]);if(_0x162683[_0x6415('0xb4')]===-0x1){return _0x162683;}return this[_0x6415('0x33')][_0x6415('0xb7')](util[_0x6415('0x29')](_0x6415('0xcf'),_0x6415('0x1c1'),_0x256cea[_0x6415('0x1c2')]));};AGIVertices[_0x6415('0x14')]['vswitch']=function(_0x380b44){logger[_0x6415('0x2c')](util['format'](_0x6415('0x1c3'),_0x380b44[_0x6415('0x35')]));if(!this[_0x6415('0x88')](_0x380b44[_0x6415('0xe3')])){return this[_0x6415('0x33')][_0x6415('0x30')](_0x380b44,_0x6415('0x1a7'));}var _0x47e5c2=this[_0x6415('0x11')]['sync'](this,_0x380b44[_0x6415('0xe3')]);if(!_0x47e5c2){return this[_0x6415('0x33')][_0x6415('0x30')](_0x380b44,_0x6415('0xe4'));}var _0x2e7e75=this['channel'][_0x6415('0x11')](_0x47e5c2);return{'code':0xc8,'result':_0x2e7e75[_0x6415('0xab')]?_0x2e7e75[_0x6415('0xab')]:'-'};};String[_0x6415('0x14')][_0x6415('0xa7')]=function(_0xfc2d14,_0x4cd3df){return this[_0x6415('0xa5')](_0xfc2d14)['join'](_0x4cd3df);};module[_0x6415('0x1c4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3e47723..09cfdf5 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0bb=['name','mandatoryDispositionPause','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','startAcw','queue','mandatoryDisposition'];(function(_0x2dd593,_0x4a1d22){var _0x37bde9=function(_0x2037bc){while(--_0x2037bc){_0x2dd593['push'](_0x2dd593['shift']());}};_0x37bde9(++_0x4a1d22);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x1eed52,_0x1bb3c1){_0x1eed52=_0x1eed52-0x0;var _0x57782a=_0xd0bb[_0x1eed52];return _0x57782a;};'use strict';var util=require(_0xbd0b('0x0'));var _=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var ami=require('../ami');var logger=require(_0xbd0b('0x3'))('acw');var RpcUser=require(_0xbd0b('0x4'));var RpcVoiceAgentReport=require(_0xbd0b('0x5'));function Acw(_0x53e6ce){this[_0xbd0b('0x6')]=_0x53e6ce['voiceQueues'];this[_0xbd0b('0x7')]=_0x53e6ce[_0xbd0b('0x7')];this[_0xbd0b('0x8')]=_0x53e6ce[_0xbd0b('0x8')];this[_0xbd0b('0x9')]={};ami['on']('agentconnect',this[_0xbd0b('0xa')][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xc'),this[_0xbd0b('0xd')][_0xbd0b('0xb')](this));ami['on']('hangup',this['syncHangup'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xe'),this['syncAgentRingNoAnswer'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xf'),this['syncAttendedTransfer'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0x10'),this[_0xbd0b('0x11')][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0x12'),this[_0xbd0b('0x13')][_0xbd0b('0xb')](this));}function getDiff(_0x1f25b6){var _0x1a55ab=moment()[_0xbd0b('0x14')](0x0);var _0x2d4664=moment(_0x1f25b6)['milliseconds'](0x0);return _0x1a55ab[_0xbd0b('0x15')](_0x2d4664,'seconds');}Acw['prototype'][_0xbd0b('0x16')]=function(_0x4c0e52){try{var _0x3183cf=this;var _0x40b075=this[_0xbd0b('0x9')][_0x4c0e52]['interface'];var _0x55e0a1=this[_0xbd0b('0x9')][_0x4c0e52][_0xbd0b('0x17')];var _0x1f2a6e=this[_0xbd0b('0x6')][_0x55e0a1];var _0x1c0a7c=![];var _0x40b798='ACW';if(_0x1f2a6e[_0xbd0b('0x18')]){if(_0x1f2a6e['mandatoryDispositionPause'][_0xbd0b('0x19')]){_0x1c0a7c=!![];_0x40b798=_0x1f2a6e[_0xbd0b('0x1a')][_0xbd0b('0x19')];}}ami[_0xbd0b('0x1b')]({'action':'QueuePause','interface':_0x40b075,'paused':!![],'reason':_0x40b798})[_0xbd0b('0x1c')](function(_0x38c27f){if(_0x3183cf[_0xbd0b('0x7')][_0x40b075]){return RpcUser['getAgent'](_0x3183cf[_0xbd0b('0x7')][_0x40b075]['id'])['then'](function(_0xc66b8){if(_0xc66b8&&!_0xc66b8[_0xbd0b('0x1d')]){logger[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x4c0e52,_0x40b075,_0x55e0a1);var _0x297c85=_0x3183cf['channels'][_0x4c0e52][_0xbd0b('0x20')]&&_0x3183cf['channels'][_0x4c0e52][_0xbd0b('0x21')]?_0x3183cf[_0xbd0b('0x9')][_0x4c0e52][_0xbd0b('0x21')]:_0x4c0e52;return RpcUser[_0xbd0b('0x22')](_0x3183cf[_0xbd0b('0x7')][_0x40b075],_0x40b798,_0x297c85)[_0xbd0b('0x1c')](function(_0x4fe9ed){if(!_0x1c0a7c){_0x3183cf[_0xbd0b('0x8')][_0x40b075]={};logger[_0xbd0b('0x1e')](_0xbd0b('0x23'),_0x4c0e52,_0x3183cf[_0xbd0b('0x6')][_0x55e0a1][_0xbd0b('0x24')],_0x40b075,_0x55e0a1);_0x3183cf[_0xbd0b('0x8')][_0x40b075]['timer']=setTimeout(_0x3183cf[_0xbd0b('0x25')][_0xbd0b('0xb')](_0x3183cf,_0x40b075),_0x3183cf[_0xbd0b('0x6')][_0x55e0a1]['acwTimeout']*0x3e8);_0x3183cf['timers'][_0x40b075][_0xbd0b('0x26')]=moment()[_0xbd0b('0x27')](_0xbd0b('0x28'));_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x29')]=_0x4c0e52;_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x17')]=_0x55e0a1;_0x3183cf['timers'][_0x40b075][_0xbd0b('0x2a')]=function(){var _0x3b70b4=getDiff(_0x3183cf['timers'][_0x40b075]['lastPauseAt']);clearTimeout(_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x2b')]);_0x3183cf['timers'][_0x40b075][_0xbd0b('0x2b')]=![];RpcVoiceAgentReport[_0xbd0b('0x2c')]({'acwtime':_0x3b70b4},_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x29')],_0x40b075)[_0xbd0b('0x1c')](function(_0x27c478){logger['info'](_0xbd0b('0x2d'),_0x4c0e52,_0x3b70b4,_0x27c478);})[_0xbd0b('0x2e')](function(_0x32572e){logger[_0xbd0b('0x2f')](_0xbd0b('0x30'),_0x4c0e52,_0x32572e);});delete _0x3183cf[_0xbd0b('0x8')][_0x40b075];};}});}else{logger[_0xbd0b('0x1e')](_0xbd0b('0x31'),_0x4c0e52,_0x40b075,_0x55e0a1);}});}})[_0xbd0b('0x2e')](function(_0x3ac75f){logger[_0xbd0b('0x2f')](_0xbd0b('0x23'),_0x4c0e52,_0x3183cf[_0xbd0b('0x6')][_0x55e0a1][_0xbd0b('0x24')],_0x40b075,_0x55e0a1);})['finally'](function(){delete _0x3183cf[_0xbd0b('0x9')][_0x4c0e52];});}catch(_0x23b0fa){logger['error'](_0xbd0b('0x32'),_0x23b0fa[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x25')]=function(_0x27ad8b){try{var _0x288715=this;if(_0x288715['timers'][_0x27ad8b]){_0x288715[_0xbd0b('0x8')][_0x27ad8b][_0xbd0b('0x2b')]=![];var _0x3b5098=_0x288715[_0xbd0b('0x8')][_0x27ad8b][_0xbd0b('0x29')];var _0x47c961=_0x288715['timers'][_0x27ad8b][_0xbd0b('0x17')];var _0x8db305=_0x288715[_0xbd0b('0x6')][_0x47c961][_0xbd0b('0x24')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x27ad8b);RpcUser[_0xbd0b('0x35')](this['agents'][_0x27ad8b]);RpcVoiceAgentReport[_0xbd0b('0x2c')]({'acwtime':_0x8db305,'agentacw':!![]},_0x3b5098,_0x27ad8b)[_0xbd0b('0x1c')](function(_0x3f34dc){logger[_0xbd0b('0x1e')](_0xbd0b('0x2d'),_0x3b5098,_0x8db305,_0x3f34dc);})[_0xbd0b('0x2e')](function(_0x43115e){logger[_0xbd0b('0x2f')](_0xbd0b('0x30'),_0x3b5098,_0x43115e);});}else{logger[_0xbd0b('0x2f')](_0xbd0b('0x36'),_0x27ad8b);if(_0x288715[_0xbd0b('0x8')]){logger[_0xbd0b('0x1e')](_0xbd0b('0x37'),JSON[_0xbd0b('0x38')](_0x288715[_0xbd0b('0x8')]));}}}catch(_0x16c77c){logger[_0xbd0b('0x2f')]('[ACW][STOP]\x20%s',_0x16c77c[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0xa')]=function(_0x3f4d9b){try{if(this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]]&&(this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]][_0xbd0b('0x39')]||this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]][_0xbd0b('0x18')])){if(this['agents'][_0x3f4d9b[_0xbd0b('0x3a')]]){this['channels'][_0x3f4d9b['uniqueid']]={'queue':_0x3f4d9b[_0xbd0b('0x17')],'interface':_0x3f4d9b[_0xbd0b('0x3a')],'destlinkedid':_0x3f4d9b[_0xbd0b('0x21')]};}}}catch(_0x580fa2){logger[_0xbd0b('0x2f')](_0xbd0b('0x3b'),_0x580fa2[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x13')]=function(_0x4f1e3a){try{if(this[_0xbd0b('0x6')][_0x4f1e3a[_0xbd0b('0x17')]]&&(this[_0xbd0b('0x6')][_0x4f1e3a[_0xbd0b('0x17')]][_0xbd0b('0x39')]||this[_0xbd0b('0x6')][_0x4f1e3a['queue']][_0xbd0b('0x18')])){if(this[_0xbd0b('0x7')][_0x4f1e3a[_0xbd0b('0x3a')]]){this[_0xbd0b('0x9')][_0x4f1e3a[_0xbd0b('0x29')]]={'queue':_0x4f1e3a[_0xbd0b('0x17')],'interface':_0x4f1e3a[_0xbd0b('0x3a')]};}}}catch(_0x563c64){logger[_0xbd0b('0x2f')](_0xbd0b('0x3c'),_0x563c64[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0xd')]=function(_0x30f77e){try{if(this[_0xbd0b('0x9')][_0x30f77e[_0xbd0b('0x29')]]&&_[_0xbd0b('0x3d')](this[_0xbd0b('0x9')][_0x30f77e[_0xbd0b('0x29')]][_0xbd0b('0x20')])){logger[_0xbd0b('0x1e')](_0xbd0b('0x3e'),_0x30f77e[_0xbd0b('0x29')]);this['startAcw'](_0x30f77e[_0xbd0b('0x29')]);}else if(this[_0xbd0b('0x9')][_0x30f77e['linkedid']]&&_['isUndefined'](this['channels'][_0x30f77e[_0xbd0b('0x3f')]]['attended'])){logger[_0xbd0b('0x1e')](_0xbd0b('0x40'),_0x30f77e[_0xbd0b('0x3f')]);this[_0xbd0b('0x16')](_0x30f77e['linkedid']);}}catch(_0x2d2e58){logger['error'](_0xbd0b('0x41'),_0x2d2e58['message']);}};Acw['prototype'][_0xbd0b('0x42')]=function(_0x22f741){try{if(this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x29')]]&&this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x29')]][_0xbd0b('0x20')]){logger[_0xbd0b('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x22f741['uniqueid']);this[_0xbd0b('0x16')](_0x22f741[_0xbd0b('0x29')]);}else if(this['channels'][_0x22f741['linkedid']]&&this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x3f')]][_0xbd0b('0x20')]){logger[_0xbd0b('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x22f741[_0xbd0b('0x3f')]);this[_0xbd0b('0x16')](_0x22f741[_0xbd0b('0x3f')]);}}catch(_0x183029){logger['error'](_0xbd0b('0x43'),_0x183029[_0xbd0b('0x33')]);}};Acw['prototype'][_0xbd0b('0x44')]=function(_0x1ea443){try{if(!_[_0xbd0b('0x45')](this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x46')]])){this[_0xbd0b('0x16')](_0x1ea443[_0xbd0b('0x46')]);if(this[_0xbd0b('0x9')][_0x1ea443['secondtransfereruniqueid']]){this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x47')]][_0xbd0b('0x20')]=!![];this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x48')]]=this[_0xbd0b('0x9')][_0x1ea443['secondtransfereruniqueid']];delete this['channels'][_0x1ea443[_0xbd0b('0x47')]];}}else if(!_[_0xbd0b('0x45')](this['channels'][_0x1ea443[_0xbd0b('0x48')]])){this[_0xbd0b('0x16')](_0x1ea443[_0xbd0b('0x48')]);if(this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]]){this['channels'][_0x1ea443[_0xbd0b('0x49')]][_0xbd0b('0x20')]=!![];this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x46')]]=this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]];delete this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]];}}}catch(_0x429534){logger[_0xbd0b('0x2f')](_0xbd0b('0x4a'),_0x429534[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x11')]=function(_0x164a2e){try{if(this[_0xbd0b('0x9')][_0x164a2e[_0xbd0b('0x4b')]]){logger['info'](_0xbd0b('0x4c'),JSON[_0xbd0b('0x38')](_0x164a2e[_0xbd0b('0x4b')]));this[_0xbd0b('0x16')](_0x164a2e['transfereruniqueid']);}else if(this['channels'][_0x164a2e[_0xbd0b('0x4d')]]){logger[_0xbd0b('0x1e')](_0xbd0b('0x4e'),JSON[_0xbd0b('0x38')](_0x164a2e[_0xbd0b('0x4d')]));this['startAcw'](_0x164a2e[_0xbd0b('0x4d')]);}}catch(_0x4d3664){logger[_0xbd0b('0x2f')](_0xbd0b('0x4f'),_0x4d3664[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x50')]=function(_0x463db8){try{if(this['voiceQueues'][_0x463db8[_0xbd0b('0x17')]]&&this[_0xbd0b('0x6')][_0x463db8[_0xbd0b('0x17')]][_0xbd0b('0x51')]==='all'){if(this[_0xbd0b('0x7')][_0x463db8[_0xbd0b('0x3a')]]){logger[_0xbd0b('0x1e')](_0xbd0b('0x52'),_0x463db8[_0xbd0b('0x29')],_0x463db8['interface'],_0x463db8['queue']);return RpcUser[_0xbd0b('0x22')](this['agents'][_0x463db8[_0xbd0b('0x3a')]],_0xbd0b('0x53'),_0x463db8[_0xbd0b('0x29')]);}}}catch(_0x1876ae){logger[_0xbd0b('0x2f')](_0xbd0b('0x54'),_0x1876ae['message']);}};module[_0xbd0b('0x55')]=Acw; \ No newline at end of file +var _0x2d17=['catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','queue','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid'];(function(_0x4f99e0,_0x485134){var _0x2d20ca=function(_0xf106a3){while(--_0xf106a3){_0x4f99e0['push'](_0x4f99e0['shift']());}};_0x2d20ca(++_0x485134);}(_0x2d17,0x17e));var _0x72d1=function(_0x498a38,_0x100b9d){_0x498a38=_0x498a38-0x0;var _0x2a7d3b=_0x2d17[_0x498a38];return _0x2a7d3b;};'use strict';var util=require(_0x72d1('0x0'));var _=require(_0x72d1('0x1'));var moment=require('moment');var ami=require(_0x72d1('0x2'));var logger=require(_0x72d1('0x3'))('acw');var RpcUser=require(_0x72d1('0x4'));var RpcVoiceAgentReport=require(_0x72d1('0x5'));function Acw(_0x55b722){this[_0x72d1('0x6')]=_0x55b722['voiceQueues'];this[_0x72d1('0x7')]=_0x55b722['agents'];this[_0x72d1('0x8')]=_0x55b722[_0x72d1('0x8')];this['channels']={};ami['on'](_0x72d1('0x9'),this[_0x72d1('0xa')][_0x72d1('0xb')](this));ami['on']('hanguprequest',this[_0x72d1('0xc')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xd'),this['syncHangup'][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xe'),this[_0x72d1('0xf')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x10'),this[_0x72d1('0x11')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x12'),this[_0x72d1('0x13')][_0x72d1('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x72d1('0x14')][_0x72d1('0xb')](this));}function getDiff(_0x4c1038){var _0x115cd7=moment()[_0x72d1('0x15')](0x0);var _0x685a27=moment(_0x4c1038)[_0x72d1('0x15')](0x0);return _0x115cd7[_0x72d1('0x16')](_0x685a27,_0x72d1('0x17'));}Acw[_0x72d1('0x18')][_0x72d1('0x19')]=function(_0x23a238){try{var _0x8d458=this;var _0x491af4=this[_0x72d1('0x1a')][_0x23a238]['interface'];var _0x3885b2=this[_0x72d1('0x1a')][_0x23a238]['queue'];var _0x1061b7=this[_0x72d1('0x6')][_0x3885b2];var _0x1ca18d=![];var _0x49caf4='ACW';if(_0x1061b7[_0x72d1('0x1b')]){if(_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')]){_0x1ca18d=!![];_0x49caf4=_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')];}}ami[_0x72d1('0x1e')]({'action':_0x72d1('0x1f'),'interface':_0x491af4,'paused':!![],'reason':_0x49caf4})['then'](function(_0x1c695c){if(_0x8d458['agents'][_0x491af4]){return RpcUser['getAgent'](_0x8d458['agents'][_0x491af4]['id'])['then'](function(_0x445985){if(_0x445985&&!_0x445985[_0x72d1('0x20')]){logger['info'](_0x72d1('0x21'),_0x23a238,_0x491af4,_0x3885b2);var _0x256dc1=_0x8d458[_0x72d1('0x1a')][_0x23a238][_0x72d1('0x22')]&&_0x8d458[_0x72d1('0x1a')][_0x23a238]['destlinkedid']?_0x8d458['channels'][_0x23a238][_0x72d1('0x23')]:_0x23a238;return RpcUser[_0x72d1('0x24')](_0x8d458[_0x72d1('0x7')][_0x491af4],_0x49caf4,_0x256dc1)[_0x72d1('0x25')](function(_0xdf6a69){if(!_0x1ca18d){_0x8d458[_0x72d1('0x8')][_0x491af4]={};logger[_0x72d1('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23a238,_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);_0x8d458['timers'][_0x491af4][_0x72d1('0x28')]=setTimeout(_0x8d458[_0x72d1('0x29')][_0x72d1('0xb')](_0x8d458,_0x491af4),_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')]*0x3e8);_0x8d458['timers'][_0x491af4][_0x72d1('0x2a')]=moment()[_0x72d1('0x2b')](_0x72d1('0x2c'));_0x8d458[_0x72d1('0x8')][_0x491af4]['uniqueid']=_0x23a238;_0x8d458[_0x72d1('0x8')][_0x491af4]['queue']=_0x3885b2;_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2d')]=function(){var _0x5cec3f=getDiff(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2a')]);clearTimeout(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x28')]);_0x8d458[_0x72d1('0x8')][_0x491af4]['timer']=![];RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x5cec3f},_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2f')],_0x491af4)['then'](function(_0x244f4a){logger[_0x72d1('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x23a238,_0x5cec3f,_0x244f4a);})[_0x72d1('0x30')](function(_0x750de6){logger[_0x72d1('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x23a238,_0x750de6);});delete _0x8d458[_0x72d1('0x8')][_0x491af4];};}});}else{logger['info'](_0x72d1('0x32'),_0x23a238,_0x491af4,_0x3885b2);}});}})[_0x72d1('0x30')](function(_0x23418d){logger[_0x72d1('0x31')](_0x72d1('0x33'),_0x23a238,_0x8d458[_0x72d1('0x6')][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);})[_0x72d1('0x34')](function(){delete _0x8d458[_0x72d1('0x1a')][_0x23a238];});}catch(_0x24be04){logger[_0x72d1('0x31')]('[ACW][START]\x20%s',_0x24be04[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x29')]=function(_0x325209){try{var _0x49e074=this;if(_0x49e074[_0x72d1('0x8')][_0x325209]){_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x28')]=![];var _0x4fb07b=_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x2f')];var _0x163538=_0x49e074['timers'][_0x325209][_0x72d1('0x36')];var _0x117440=_0x49e074[_0x72d1('0x6')][_0x163538]['acwTimeout'];logger[_0x72d1('0x26')](_0x72d1('0x37'),_0x325209);RpcUser[_0x72d1('0x38')](this[_0x72d1('0x7')][_0x325209]);RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x117440,'agentacw':!![]},_0x4fb07b,_0x325209)[_0x72d1('0x25')](function(_0xd7ec0f){logger['info'](_0x72d1('0x39'),_0x4fb07b,_0x117440,_0xd7ec0f);})[_0x72d1('0x30')](function(_0x440ac5){logger[_0x72d1('0x31')](_0x72d1('0x3a'),_0x4fb07b,_0x440ac5);});}else{logger[_0x72d1('0x31')](_0x72d1('0x3b'),_0x325209);if(_0x49e074[_0x72d1('0x8')]){logger['info'](_0x72d1('0x3c'),JSON[_0x72d1('0x3d')](_0x49e074[_0x72d1('0x8')]));}}}catch(_0x1d6704){logger[_0x72d1('0x31')](_0x72d1('0x3e'),_0x1d6704[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')]['syncAgentConnect']=function(_0x563c5a){try{if(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]&&(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['acw']||this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['mandatoryDisposition'])){if(this[_0x72d1('0x7')][_0x563c5a['interface']]){this[_0x72d1('0x1a')][_0x563c5a[_0x72d1('0x2f')]]={'queue':_0x563c5a['queue'],'interface':_0x563c5a[_0x72d1('0x3f')],'destlinkedid':_0x563c5a['destlinkedid']};}}}catch(_0x527223){logger['error'](_0x72d1('0x40'),_0x527223['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x14')]=function(_0x28332b){try{if(this['voiceQueues'][_0x28332b['queue']]&&(this[_0x72d1('0x6')][_0x28332b['queue']]['acw']||this[_0x72d1('0x6')][_0x28332b[_0x72d1('0x36')]][_0x72d1('0x1b')])){if(this['agents'][_0x28332b['interface']]){this['channels'][_0x28332b['uniqueid']]={'queue':_0x28332b[_0x72d1('0x36')],'interface':_0x28332b[_0x72d1('0x3f')]};}}}catch(_0x197483){logger[_0x72d1('0x31')](_0x72d1('0x41'),_0x197483[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xc')]=function(_0x1e2c11){try{if(this['channels'][_0x1e2c11[_0x72d1('0x2f')]]&&_[_0x72d1('0x42')](this[_0x72d1('0x1a')][_0x1e2c11['uniqueid']][_0x72d1('0x22')])){logger[_0x72d1('0x26')](_0x72d1('0x43'),_0x1e2c11['uniqueid']);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x1e2c11[_0x72d1('0x44')]]&&_['isUndefined'](this['channels'][_0x1e2c11[_0x72d1('0x44')]][_0x72d1('0x22')])){logger[_0x72d1('0x26')]('[%s][HANGUP:LINKEDID]',_0x1e2c11[_0x72d1('0x44')]);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x44')]);}}catch(_0x463670){logger[_0x72d1('0x31')](_0x72d1('0x45'),_0x463670[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x46')]=function(_0x18f986){try{if(this[_0x72d1('0x1a')][_0x18f986['uniqueid']]&&this[_0x72d1('0x1a')][_0x18f986['uniqueid']]['attended']){logger[_0x72d1('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x18f986[_0x72d1('0x2f')]);this[_0x72d1('0x19')](_0x18f986[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]]&&this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]][_0x72d1('0x22')]){logger[_0x72d1('0x26')](_0x72d1('0x47'),_0x18f986[_0x72d1('0x44')]);this['startAcw'](_0x18f986[_0x72d1('0x44')]);}}catch(_0x3da39a){logger[_0x72d1('0x31')]('[ACW][syncHangup]\x20%s',_0x3da39a['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x11')]=function(_0x16e9e7){try{if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7['transfereeuniqueid']])){this[_0x72d1('0x19')](_0x16e9e7['transfereeuniqueid']);if(this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]]=this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];}}else if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]])){this[_0x72d1('0x19')](_0x16e9e7[_0x72d1('0x4a')]);if(this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4c')]]=this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]];}}}catch(_0xb05cd9){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0xb05cd9[_0x72d1('0x35')]);}};Acw['prototype'][_0x72d1('0x13')]=function(_0x359176){try{if(this[_0x72d1('0x1a')][_0x359176[_0x72d1('0x4d')]]){logger[_0x72d1('0x26')](_0x72d1('0x4e'),JSON[_0x72d1('0x3d')](_0x359176[_0x72d1('0x4d')]));this[_0x72d1('0x19')](_0x359176['transfereruniqueid']);}else if(this['channels'][_0x359176[_0x72d1('0x4f')]]){logger[_0x72d1('0x26')](_0x72d1('0x50'),JSON['stringify'](_0x359176[_0x72d1('0x4f')]));this[_0x72d1('0x19')](_0x359176['transfererlinkedid']);}}catch(_0x39d7f9){logger[_0x72d1('0x31')](_0x72d1('0x51'),_0x39d7f9[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xf')]=function(_0x102574){try{if(this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]]&&this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]][_0x72d1('0x52')]==='all'){if(this['agents'][_0x102574[_0x72d1('0x3f')]]){logger[_0x72d1('0x26')](_0x72d1('0x53'),_0x102574[_0x72d1('0x2f')],_0x102574[_0x72d1('0x3f')],_0x102574[_0x72d1('0x36')]);return RpcUser[_0x72d1('0x24')](this[_0x72d1('0x7')][_0x102574['interface']],_0x72d1('0x54'),_0x102574['uniqueid']);}}}catch(_0x475016){logger[_0x72d1('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x475016['message']);}};module[_0x72d1('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 29d0efb..f7d6801 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 _0x544e=['username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','exports','bluebird','moment','lodash','ami','../../config/environment','asterisk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x544e,0xef));var _0xe544=function(_0x401af1,_0x1bc315){_0x401af1=_0x401af1-0x0;var _0x2ed7cb=_0x544e[_0x401af1];return _0x2ed7cb;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xe544('0x0'));var moment=require(_0xe544('0x1'));var util=require('util');var _=require(_0xe544('0x2'));var logger=require('../../config/logger')(_0xe544('0x3'));var config=require(_0xe544('0x4'));var ami=new Manager(config[_0xe544('0x5')]['port'],config[_0xe544('0x5')]['ip'],config[_0xe544('0x5')][_0xe544('0x6')],config[_0xe544('0x5')][_0xe544('0x7')],!![]);ami[_0xe544('0x8')]();ami[_0xe544('0x9')]=BPromise[_0xe544('0xa')](ami[_0xe544('0xb')]);function error(_0x328bdf){logger[_0xe544('0xc')](util[_0xe544('0xd')](_0xe544('0xe'),config[_0xe544('0x5')][_0xe544('0x6')],config['asterisk']['ip'],config[_0xe544('0x5')][_0xe544('0xf')],util[_0xe544('0x10')](_0x328bdf,![],null)));}function close(){logger[_0xe544('0xc')](util[_0xe544('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0xe544('0x6')],config[_0xe544('0x5')]['ip'],config['asterisk'][_0xe544('0xf')]));}ami[_0xe544('0x11')]=function(){return function(){return ami[_0xe544('0x9')]({'action':_0xe544('0x12')});};};ami[_0xe544('0x13')]=function(){return function(){return ami[_0xe544('0x9')]({'action':_0xe544('0x14')});};};ami[_0xe544('0x15')]=function(){return function(){return ami[_0xe544('0x9')]({'action':_0xe544('0x16')});};};ami[_0xe544('0x17')]=function(){return function(){return ami[_0xe544('0x9')]({'action':'queuesummary'});};};ami[_0xe544('0x18')]=function(){return function(){return ami[_0xe544('0x9')]({'action':_0xe544('0x19')});};};function connect(_0x2106db){logger[_0xe544('0x1a')](util[_0xe544('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xe544('0x5')][_0xe544('0x6')],config['asterisk']['ip'],config[_0xe544('0x5')][_0xe544('0xf')]));ami['once'](_0xe544('0xc'),error);ami[_0xe544('0x1b')](_0xe544('0x1c'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x54ab2e){logger[_0xe544('0x1a')](util[_0xe544('0xd')](_0xe544('0x1d'),config[_0xe544('0x5')][_0xe544('0x6')],config[_0xe544('0x5')]['ip'],config[_0xe544('0x5')][_0xe544('0xf')],util[_0xe544('0x10')](_0x54ab2e,![],null)));});ami['on']('fullybooted',function(_0x4fd794){logger[_0xe544('0x1a')](util[_0xe544('0xd')](_0xe544('0x1e'),config[_0xe544('0x5')][_0xe544('0x6')],config['asterisk']['ip'],config[_0xe544('0x5')][_0xe544('0xf')]));return BPromise[_0xe544('0x1f')]()['then'](ami[_0xe544('0x11')]())['then'](ami['actionDeviceStateList']())['then'](ami[_0xe544('0x15')]())[_0xe544('0x20')](ami[_0xe544('0x17')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x3d470e){console[_0xe544('0x21')](_0x3d470e);});});ami[_0xe544('0x1b')]('error',error);ami[_0xe544('0x1b')](_0xe544('0x1c'),close);module[_0xe544('0x22')]=ami; \ No newline at end of file +var _0xe881=['Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','close','exports','asterisk-manager','moment','util','lodash','ami','asterisk','port','username','password','keepConnected','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','Action','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0xe881,0x1af));var _0x1e88=function(_0x29a134,_0x194c27){_0x29a134=_0x29a134-0x0;var _0x136398=_0xe881[_0x29a134];return _0x136398;};'use strict';var Manager=require(_0x1e88('0x0'));var BPromise=require('bluebird');var moment=require(_0x1e88('0x1'));var util=require(_0x1e88('0x2'));var _=require(_0x1e88('0x3'));var logger=require('../../config/logger')(_0x1e88('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x1e88('0x5')][_0x1e88('0x6')],config[_0x1e88('0x5')]['ip'],config['asterisk'][_0x1e88('0x7')],config[_0x1e88('0x5')][_0x1e88('0x8')],!![]);ami[_0x1e88('0x9')]();ami['Action']=BPromise['promisify'](ami[_0x1e88('0xa')]);function error(_0x3f3590){logger[_0x1e88('0xb')](util[_0x1e88('0xc')](_0x1e88('0xd'),config['asterisk'][_0x1e88('0x7')],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')]['port'],util[_0x1e88('0xe')](_0x3f3590,![],null)));}function close(){logger[_0x1e88('0xb')](util[_0x1e88('0xc')](_0x1e88('0xf'),config[_0x1e88('0x5')][_0x1e88('0x7')],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')][_0x1e88('0x6')]));}ami[_0x1e88('0x10')]=function(){return function(){return ami[_0x1e88('0x11')]({'action':'sipshowregistry'});};};ami[_0x1e88('0x12')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x1e88('0x13')]=function(){return function(){return ami[_0x1e88('0x11')]({'action':'sippeerstatus'});};};ami[_0x1e88('0x14')]=function(){return function(){return ami['Action']({'action':_0x1e88('0x15')});};};ami[_0x1e88('0x16')]=function(){return function(){return ami[_0x1e88('0x11')]({'action':'coreshowchannels'});};};function connect(_0x322ded){logger[_0x1e88('0x17')](util['format'](_0x1e88('0x18'),config[_0x1e88('0x5')][_0x1e88('0x7')],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')][_0x1e88('0x6')]));ami['once'](_0x1e88('0xb'),error);ami[_0x1e88('0x19')]('close',close);}ami['on']('connect',connect);ami['on'](_0x1e88('0x1a'),function(_0xc217b2){logger[_0x1e88('0x17')](util[_0x1e88('0xc')](_0x1e88('0x1b'),config[_0x1e88('0x5')]['username'],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')][_0x1e88('0x6')],util[_0x1e88('0xe')](_0xc217b2,![],null)));});ami['on']('fullybooted',function(_0x4d5793){logger[_0x1e88('0x17')](util[_0x1e88('0xc')](_0x1e88('0x1c'),config[_0x1e88('0x5')][_0x1e88('0x7')],config[_0x1e88('0x5')]['ip'],config[_0x1e88('0x5')]['port']));return BPromise[_0x1e88('0x1d')]()[_0x1e88('0x1e')](ami[_0x1e88('0x10')]())[_0x1e88('0x1e')](ami['actionDeviceStateList']())[_0x1e88('0x1e')](ami[_0x1e88('0x13')]())[_0x1e88('0x1e')](ami[_0x1e88('0x14')]())['then'](ami[_0x1e88('0x16')]())[_0x1e88('0x1f')](function(_0x2da444){console[_0x1e88('0x20')](_0x2da444);});});ami[_0x1e88('0x19')]('error',error);ami[_0x1e88('0x19')](_0x1e88('0x21'),close);module[_0x1e88('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 3be65bc..9302081 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 _0xe10d=['../../config/logger','ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','catch','exports'];(function(_0x5191ab,_0x57d57){var _0x593659=function(_0x3976cb){while(--_0x3976cb){_0x5191ab['push'](_0x5191ab['shift']());}};_0x593659(++_0x57d57);}(_0xe10d,0x118));var _0xde10=function(_0x28e9ce,_0x353d40){_0x28e9ce=_0x28e9ce-0x0;var _0x118e71=_0xe10d[_0x28e9ce];return _0x118e71;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xde10('0x0'))(_0xde10('0x1'));var client=jayson[_0xde10('0x2')][_0xde10('0x3')]({'port':0x2329});client[_0xde10('0x4')]=function(_0x1d2c8b,_0x4a10af){return new BPromise(function(_0x52e8d3,_0x514bf6){return client['request'](_0x1d2c8b,_0x4a10af)[_0xde10('0x5')](function(_0xa38225){logger[_0xde10('0x6')](_0xde10('0x7'),_0xde10('0x8'),_0x1d2c8b,_0x4a10af,_0xa38225);if(_0xa38225['error']){logger['error']('rpc',_0xde10('0x8'),_0x1d2c8b,_0xa38225[_0xde10('0x9')]['message'],_0x4a10af);return _0x514bf6(_0xa38225[_0xde10('0x9')][_0xde10('0xa')]);}else{return _0x52e8d3(_0xa38225[_0xde10('0xb')]);}})[_0xde10('0xc')](function(_0x17de6b){logger[_0xde10('0x9')](_0xde10('0x7'),_0xde10('0x8'),_0x1d2c8b,_0x17de6b,_0x4a10af);return _0x514bf6(_0x17de6b);});});};module[_0xde10('0xd')]=client; \ No newline at end of file +var _0x55c0=['error','message','result','catch','exports','bluebird','../../config/logger','ami','client','http','request','then','rpc','memberReport'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x55c0,0x10f));var _0x055c=function(_0x21cbcd,_0x4ba851){_0x21cbcd=_0x21cbcd-0x0;var _0x59a138=_0x55c0[_0x21cbcd];return _0x59a138;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x055c('0x0'));var logger=require(_0x055c('0x1'))(_0x055c('0x2'));var client=jayson[_0x055c('0x3')][_0x055c('0x4')]({'port':0x2329});client['Request']=function(_0x18dd15,_0x3e3d5e){return new BPromise(function(_0x593133,_0x1d7560){return client[_0x055c('0x5')](_0x18dd15,_0x3e3d5e)[_0x055c('0x6')](function(_0xcbd820){logger['debug'](_0x055c('0x7'),_0x055c('0x8'),_0x18dd15,_0x3e3d5e,_0xcbd820);if(_0xcbd820[_0x055c('0x9')]){logger['error'](_0x055c('0x7'),_0x055c('0x8'),_0x18dd15,_0xcbd820[_0x055c('0x9')][_0x055c('0xa')],_0x3e3d5e);return _0x1d7560(_0xcbd820['error']['message']);}else{return _0x593133(_0xcbd820[_0x055c('0xb')]);}})[_0x055c('0xc')](function(_0x339c0e){logger['error'](_0x055c('0x7'),_0x055c('0x8'),_0x18dd15,_0x339c0e,_0x3e3d5e);return _0x1d7560(_0x339c0e);});});};module[_0x055c('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index c6e933c..233af54 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 _0x3cfb=['CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','firstName','lastName','number','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1e0e8e,_0x30b41c){var _0x5dfbd3=function(_0x42805f){while(--_0x42805f){_0x1e0e8e['push'](_0x1e0e8e['shift']());}};_0x5dfbd3(++_0x30b41c);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x2b2f5c,_0x4df326){_0x2b2f5c=_0x2b2f5c-0x0;var _0x287d11=_0x3cfb[_0x2b2f5c];return _0x287d11;};'use strict';var util=require(_0xb3cf('0x0'));var _=require(_0xb3cf('0x1'));var moment=require(_0xb3cf('0x2'));function checkNameSurname(_0x3d8fa3,_0xa3584d,_0x147066){var _0x3112c1='';if(!_[_0xb3cf('0x3')](_0xa3584d)&&'string'===typeof _0xa3584d){_0x3112c1+=_0xa3584d;}if(!_[_0xb3cf('0x3')](_0x147066)&&_0xb3cf('0x4')===typeof _0x147066){_0x3112c1+='\x20'+_0x147066;}if(_0x3112c1!==''){return _0x3112c1;}return _0x3d8fa3;}function Action(_0x19e5e5,_0x59c604,_0x2e5c00){this[_0xb3cf('0x5')]=_0x19e5e5;this[_0xb3cf('0x6')]=_0x2e5c00||undefined;this['name']=checkNameSurname(_0x59c604[_0xb3cf('0x7')]['phone'],_0x59c604['Contact'][_0xb3cf('0x8')],_0x59c604[_0xb3cf('0x7')][_0xb3cf('0x9')]);this[_0xb3cf('0xa')]=_0x59c604[_0xb3cf('0x7')][_0xb3cf('0xb')];this[_0xb3cf('0xc')]=_0x19e5e5[_0xb3cf('0xd')];this[_0xb3cf('0xe')]=_0x59c604[_0xb3cf('0xe')]||![];this[_0xb3cf('0xf')]=_0x19e5e5[_0xb3cf('0xf')];this[_0xb3cf('0x10')]=_0x19e5e5[_0xb3cf('0x10')]||0x3;this[_0xb3cf('0x11')]=_0x59c604['scheduledat'];this['countbusyretry']=_0x59c604[_0xb3cf('0x12')];this[_0xb3cf('0x13')]=_0x59c604['countcongestionretry'];this[_0xb3cf('0x14')]=_0x59c604['countnoanswerretry'];this['countnosuchnumberretry']=_0x59c604[_0xb3cf('0x15')];this[_0xb3cf('0x16')]=_0x59c604[_0xb3cf('0x16')];this['countabandonedretry']=_0x59c604[_0xb3cf('0x17')];this[_0xb3cf('0x18')]=_0x59c604[_0xb3cf('0x18')];this[_0xb3cf('0x19')]=_0x59c604[_0xb3cf('0x19')];this[_0xb3cf('0x1a')]=_0x59c604[_0xb3cf('0x1a')];this[_0xb3cf('0x1b')]=_0x59c604[_0xb3cf('0x1b')];this[_0xb3cf('0x1c')]=_0x59c604['UserId'];this[_0xb3cf('0x1d')]=_0x59c604[_0xb3cf('0x1d')];this[_0xb3cf('0x1e')]=_0x59c604[_0xb3cf('0x1e')];this['idHopper']=_0x59c604['id'];this[_0xb3cf('0x1f')]=_0x59c604[_0xb3cf('0x7')][_0xb3cf('0x8')]||'';this[_0xb3cf('0x20')]=moment()[_0xb3cf('0x21')](_0xb3cf('0x22'));this[_0xb3cf('0x23')]=_0x59c604[_0xb3cf('0x23')];this[_0xb3cf('0x24')]=_0x59c604[_0xb3cf('0x24')];this['callbackat']=_0x59c604[_0xb3cf('0x25')];this[_0xb3cf('0x26')]=_0x59c604[_0xb3cf('0x26')];this[_0xb3cf('0x27')]='';this[_0xb3cf('0x28')]='';}Action[_0xb3cf('0x29')][_0xb3cf('0x2a')]=function(){return util[_0xb3cf('0x21')](_0xb3cf('0x2b'),this[_0xb3cf('0xd')],this['voiceQueue'][_0xb3cf('0x2c')]>0x0?this[_0xb3cf('0xa')][_0xb3cf('0x2d')](this['voiceQueue']['dialCutDigit']):this[_0xb3cf('0xa')]);};Action[_0xb3cf('0x29')]['getQueue']=function(){return this['queue'];};module[_0xb3cf('0x2e')]=Action; \ No newline at end of file +var _0x2f8b=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','voiceQueue','getQueue','exports','util','lodash','isNil','string','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x17de72,_0x3981ec){var _0x3ecb59=function(_0x25c146){while(--_0x25c146){_0x17de72['push'](_0x17de72['shift']());}};_0x3ecb59(++_0x3981ec);}(_0x2f8b,0x96));var _0xb2f8=function(_0x1f9ee6,_0x7255cb){_0x1f9ee6=_0x1f9ee6-0x0;var _0x101b73=_0x2f8b[_0x1f9ee6];return _0x101b73;};'use strict';var util=require(_0xb2f8('0x0'));var _=require(_0xb2f8('0x1'));var moment=require('moment');function checkNameSurname(_0x245c31,_0x1df4e3,_0x3211f4){var _0x7e5e83='';if(!_[_0xb2f8('0x2')](_0x1df4e3)&&_0xb2f8('0x3')===typeof _0x1df4e3){_0x7e5e83+=_0x1df4e3;}if(!_[_0xb2f8('0x2')](_0x3211f4)&&'string'===typeof _0x3211f4){_0x7e5e83+='\x20'+_0x3211f4;}if(_0x7e5e83!==''){return _0x7e5e83;}return _0x245c31;}function Action(_0x2d4d99,_0x1e4cfa,_0x21b104){this['voiceQueue']=_0x2d4d99;this[_0xb2f8('0x4')]=_0x21b104||undefined;this['name']=checkNameSurname(_0x1e4cfa[_0xb2f8('0x5')][_0xb2f8('0x6')],_0x1e4cfa[_0xb2f8('0x5')][_0xb2f8('0x7')],_0x1e4cfa[_0xb2f8('0x5')][_0xb2f8('0x8')]);this[_0xb2f8('0x9')]=_0x1e4cfa['Contact'][_0xb2f8('0x6')];this[_0xb2f8('0xa')]=_0x2d4d99[_0xb2f8('0xb')];this[_0xb2f8('0xc')]=_0x1e4cfa[_0xb2f8('0xc')]||![];this[_0xb2f8('0xd')]=_0x2d4d99[_0xb2f8('0xd')];this[_0xb2f8('0xe')]=_0x2d4d99[_0xb2f8('0xe')]||0x3;this[_0xb2f8('0xf')]=_0x1e4cfa[_0xb2f8('0xf')];this[_0xb2f8('0x10')]=_0x1e4cfa[_0xb2f8('0x10')];this['countcongestionretry']=_0x1e4cfa['countcongestionretry'];this[_0xb2f8('0x11')]=_0x1e4cfa[_0xb2f8('0x11')];this['countnosuchnumberretry']=_0x1e4cfa[_0xb2f8('0x12')];this[_0xb2f8('0x13')]=_0x1e4cfa[_0xb2f8('0x13')];this[_0xb2f8('0x14')]=_0x1e4cfa['countabandonedretry'];this['countmachineretry']=_0x1e4cfa[_0xb2f8('0x15')];this[_0xb2f8('0x16')]=_0x1e4cfa['countagentrejectretry'];this[_0xb2f8('0x17')]=_0x1e4cfa[_0xb2f8('0x17')];this['ListId']=_0x1e4cfa[_0xb2f8('0x18')];this['UserId']=_0x1e4cfa[_0xb2f8('0x19')];this[_0xb2f8('0x1a')]=_0x1e4cfa[_0xb2f8('0x1a')];this[_0xb2f8('0x1b')]=_0x1e4cfa[_0xb2f8('0x1b')];this[_0xb2f8('0x1c')]=_0x1e4cfa['id'];this[_0xb2f8('0x1d')]=_0x1e4cfa[_0xb2f8('0x5')][_0xb2f8('0x7')]||'';this[_0xb2f8('0x1e')]=moment()['format'](_0xb2f8('0x1f'));this['callback']=_0x1e4cfa[_0xb2f8('0x20')];this[_0xb2f8('0x21')]=_0x1e4cfa[_0xb2f8('0x21')];this[_0xb2f8('0x22')]=_0x1e4cfa['callbackat'];this[_0xb2f8('0x23')]=_0x1e4cfa[_0xb2f8('0x23')];this[_0xb2f8('0x24')]='';this['originatecalleridname']='';}Action[_0xb2f8('0x25')]['getCaller']=function(){return util['format'](_0xb2f8('0x26'),this[_0xb2f8('0xb')],this['voiceQueue'][_0xb2f8('0x27')]>0x0?this[_0xb2f8('0x9')][_0xb2f8('0x28')](this[_0xb2f8('0x29')][_0xb2f8('0x27')]):this[_0xb2f8('0x9')]);};Action['prototype'][_0xb2f8('0x2a')]=function(){return this[_0xb2f8('0xa')];};module[_0xb2f8('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 3c1d770..5e2d537 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b12=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x5dcbf8,_0x4bbe65){var _0x4fa1ad=function(_0x103ac8){while(--_0x103ac8){_0x5dcbf8['push'](_0x5dcbf8['shift']());}};_0x4fa1ad(++_0x4bbe65);}(_0x6b12,0xbf));var _0x26b1=function(_0x292c5c,_0x360a2a){_0x292c5c=_0x292c5c-0x0;var _0x49b1c5=_0x6b12[_0x292c5c];return _0x49b1c5;};'use strict';var util=require(_0x26b1('0x0'));var _=require(_0x26b1('0x1'));var moment=require(_0x26b1('0x2'));function getSeconds(_0x5979de,_0x1c76ad){var _0x3f2b0f=moment(_0x5979de)[_0x26b1('0x3')](0x0);var _0x513f25=moment(_0x1c76ad)[_0x26b1('0x3')](0x0);return _0x3f2b0f['diff'](_0x513f25,_0x26b1('0x4'));}function AdditionalPhone(_0x14176b){this[_0x26b1('0x5')]=_0x14176b[_0x26b1('0x5')];this[_0x26b1('0x6')]=_0x14176b[_0x26b1('0x6')]||undefined;this[_0x26b1('0x7')]=_0x14176b[_0x26b1('0x7')];this[_0x26b1('0x8')]=_0x14176b[_0x26b1('0x7')]===_0x26b1('0x9')?'queue':_0x14176b[_0x26b1('0x7')];this[_0x26b1('0xa')]=_0x14176b['countbusyretry'];this[_0x26b1('0xb')]=_0x14176b[_0x26b1('0xb')];this[_0x26b1('0xc')]=_0x14176b[_0x26b1('0xc')];this['countglobal']=_0x14176b['countbusyretry']+_0x14176b[_0x26b1('0xb')]+_0x14176b[_0x26b1('0xc')]+_0x14176b[_0x26b1('0xd')]+_0x14176b['countdropretry']+_0x14176b[_0x26b1('0xe')]+_0x14176b[_0x26b1('0xf')]+_0x14176b[_0x26b1('0x10')];this[_0x26b1('0xd')]=_0x14176b[_0x26b1('0xd')];this[_0x26b1('0x11')]=_0x14176b[_0x26b1('0x11')];this['countabandonedretry']=_0x14176b[_0x26b1('0xe')];this['countmachineretry']=_0x14176b[_0x26b1('0xf')];this[_0x26b1('0x10')]=_0x14176b[_0x26b1('0x10')];this[_0x26b1('0x12')]=_0x14176b['queue'];this['calleridname']=_0x14176b['name'];this['calleridnum']=_0x14176b[_0x26b1('0x13')];this[_0x26b1('0x14')]=_0x14176b[_0x26b1('0x14')];this['responsetime']=_0x14176b[_0x26b1('0x15')];this[_0x26b1('0x16')]=_0x14176b[_0x26b1('0x15')];this['ringtime']=getSeconds(_0x14176b[_0x26b1('0x15')],_0x14176b['starttime']);this[_0x26b1('0x17')]=0x0;this[_0x26b1('0x18')]=0x0;this[_0x26b1('0x19')]=_0x14176b[_0x26b1('0x19')];this[_0x26b1('0x1a')]=_0x14176b[_0x26b1('0x1a')];this[_0x26b1('0x1b')]=_0x14176b[_0x26b1('0x1b')];this[_0x26b1('0x1c')]=_0x14176b[_0x26b1('0x1c')];this[_0x26b1('0x1d')]=_0x14176b[_0x26b1('0x1d')];this[_0x26b1('0x1e')]=_0x14176b['ListId'];this[_0x26b1('0x1f')]=_0x14176b[_0x26b1('0x1f')];this[_0x26b1('0x20')]=_0x14176b[_0x26b1('0x20')];this['CampaignId']=_0x14176b[_0x26b1('0x21')];this[_0x26b1('0x22')]=_0x14176b[_0x26b1('0x22')]||'';this['originatecalleridname']=_0x14176b[_0x26b1('0x23')]||'';}module[_0x26b1('0x24')]=History; \ No newline at end of file +var _0xd358=['util','lodash','moment','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x361945,_0x5a1358){var _0x14e349=function(_0x3ecedf){while(--_0x3ecedf){_0x361945['push'](_0x361945['shift']());}};_0x14e349(++_0x5a1358);}(_0xd358,0xe4));var _0x8d35=function(_0x4e8f08,_0x3b2fb9){_0x4e8f08=_0x4e8f08-0x0;var _0x38aef4=_0xd358[_0x4e8f08];return _0x38aef4;};'use strict';var util=require(_0x8d35('0x0'));var _=require(_0x8d35('0x1'));var moment=require(_0x8d35('0x2'));function getSeconds(_0x2317a7,_0x407fba){var _0x2bdd88=moment(_0x2317a7)['milliseconds'](0x0);var _0x5dcc85=moment(_0x407fba)['milliseconds'](0x0);return _0x2bdd88[_0x8d35('0x3')](_0x5dcc85,'seconds');}function AdditionalPhone(_0x3ff0ce){this[_0x8d35('0x4')]=_0x3ff0ce[_0x8d35('0x4')];this[_0x8d35('0x5')]=_0x3ff0ce['scheduledat']||undefined;this[_0x8d35('0x6')]=_0x3ff0ce[_0x8d35('0x6')];this['campaigntype']=_0x3ff0ce[_0x8d35('0x6')]===_0x8d35('0x7')?_0x8d35('0x8'):_0x3ff0ce[_0x8d35('0x6')];this['countbusyretry']=_0x3ff0ce[_0x8d35('0x9')];this[_0x8d35('0xa')]=_0x3ff0ce[_0x8d35('0xa')];this[_0x8d35('0xb')]=_0x3ff0ce[_0x8d35('0xb')];this[_0x8d35('0xc')]=_0x3ff0ce[_0x8d35('0x9')]+_0x3ff0ce[_0x8d35('0xa')]+_0x3ff0ce[_0x8d35('0xb')]+_0x3ff0ce[_0x8d35('0xd')]+_0x3ff0ce[_0x8d35('0xe')]+_0x3ff0ce['countabandonedretry']+_0x3ff0ce['countmachineretry']+_0x3ff0ce[_0x8d35('0xf')];this[_0x8d35('0xd')]=_0x3ff0ce[_0x8d35('0xd')];this[_0x8d35('0xe')]=_0x3ff0ce['countdropretry'];this[_0x8d35('0x10')]=_0x3ff0ce[_0x8d35('0x10')];this[_0x8d35('0x11')]=_0x3ff0ce[_0x8d35('0x11')];this[_0x8d35('0xf')]=_0x3ff0ce[_0x8d35('0xf')];this[_0x8d35('0x8')]=_0x3ff0ce['queue'];this[_0x8d35('0x12')]=_0x3ff0ce[_0x8d35('0x13')];this['calleridnum']=_0x3ff0ce[_0x8d35('0x14')];this[_0x8d35('0x15')]=_0x3ff0ce[_0x8d35('0x15')];this['responsetime']=_0x3ff0ce[_0x8d35('0x16')];this[_0x8d35('0x17')]=_0x3ff0ce[_0x8d35('0x16')];this[_0x8d35('0x18')]=getSeconds(_0x3ff0ce[_0x8d35('0x16')],_0x3ff0ce['starttime']);this[_0x8d35('0x19')]=0x0;this[_0x8d35('0x1a')]=0x0;this[_0x8d35('0x1b')]=_0x3ff0ce[_0x8d35('0x1b')];this[_0x8d35('0x1c')]=_0x3ff0ce['callbackuniqueid'];this[_0x8d35('0x1d')]=_0x3ff0ce[_0x8d35('0x1d')];this[_0x8d35('0x1e')]=_0x3ff0ce[_0x8d35('0x1e')];this[_0x8d35('0x1f')]=_0x3ff0ce[_0x8d35('0x1f')];this[_0x8d35('0x20')]=_0x3ff0ce['ListId'];this['UserId']=_0x3ff0ce['UserId'];this[_0x8d35('0x21')]=_0x3ff0ce[_0x8d35('0x21')];this[_0x8d35('0x22')]=_0x3ff0ce[_0x8d35('0x22')];this[_0x8d35('0x23')]=_0x3ff0ce[_0x8d35('0x23')]||'';this[_0x8d35('0x24')]=_0x3ff0ce['originatecalleridname']||'';}module[_0x8d35('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 948cb21..a18f67a 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 _0xe176=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','state','Answer','scheduledat','type'];(function(_0x3c59c5,_0x527f24){var _0x271aad=function(_0x44b9c6){while(--_0x44b9c6){_0x3c59c5['push'](_0x3c59c5['shift']());}};_0x271aad(++_0x527f24);}(_0xe176,0x1dc));var _0x6e17=function(_0x3bce39,_0x3edeff){_0x3bce39=_0x3bce39-0x0;var _0x424c8f=_0xe176[_0x3bce39];return _0x424c8f;};'use strict';var util=require('util');var _=require(_0x6e17('0x0'));var moment=require(_0x6e17('0x1'));function getSeconds(_0x2da40b,_0xbbf0b5){var _0x51f7a8=moment(_0x2da40b)[_0x6e17('0x2')](0x0);var _0x5d2fa3=moment(_0xbbf0b5)['milliseconds'](0x0);return _0x51f7a8['diff'](_0x5d2fa3,_0x6e17('0x3'));}function AgentComplete(_0x33cdf6,_0x1762a5){this[_0x6e17('0x4')]=0x4;this['statedesc']=_0x6e17('0x5');this[_0x6e17('0x6')]=_0x33cdf6[_0x6e17('0x6')];this[_0x6e17('0x7')]=_0x33cdf6[_0x6e17('0x7')];this[_0x6e17('0x8')]=_0x33cdf6[_0x6e17('0x7')]===_0x6e17('0x9')?_0x6e17('0xa'):_0x33cdf6['type'];this['countbusyretry']=_0x33cdf6[_0x6e17('0xb')];this['countcongestionretry']=_0x33cdf6[_0x6e17('0xc')];this[_0x6e17('0xd')]=_0x33cdf6[_0x6e17('0xd')];this[_0x6e17('0xe')]=_0x33cdf6[_0x6e17('0xb')]+_0x33cdf6[_0x6e17('0xc')]+_0x33cdf6['countnoanswerretry']+_0x33cdf6[_0x6e17('0xf')]+_0x33cdf6[_0x6e17('0x10')]+_0x33cdf6[_0x6e17('0x11')]+_0x33cdf6[_0x6e17('0x12')]+_0x33cdf6[_0x6e17('0x13')];this[_0x6e17('0xf')]=_0x33cdf6[_0x6e17('0xf')];this[_0x6e17('0x10')]=_0x33cdf6[_0x6e17('0x10')];this[_0x6e17('0x11')]=_0x33cdf6[_0x6e17('0x11')];this[_0x6e17('0x12')]=_0x33cdf6[_0x6e17('0x12')];this['countagentrejectretry']=_0x33cdf6[_0x6e17('0x13')];this['uniqueid']=_0x1762a5[_0x6e17('0x14')];this[_0x6e17('0x15')]=_0x33cdf6[_0x6e17('0x16')];this[_0x6e17('0x17')]=_0x33cdf6['number'];this[_0x6e17('0x18')]=_0x33cdf6[_0x6e17('0x18')];this['responsetime']=_0x33cdf6[_0x6e17('0x19')];this[_0x6e17('0x1a')]=_0x33cdf6[_0x6e17('0x1a')];this[_0x6e17('0x1b')]=moment()['format'](_0x6e17('0x1c'));this[_0x6e17('0x1d')]=getSeconds(_0x33cdf6[_0x6e17('0x19')],_0x33cdf6[_0x6e17('0x18')]);this[_0x6e17('0x1e')]=getSeconds(_0x33cdf6['answertime'],_0x33cdf6[_0x6e17('0x19')]);this[_0x6e17('0x1f')]=getSeconds(this['endtime'],_0x33cdf6[_0x6e17('0x1a')]);this[_0x6e17('0xa')]=_0x1762a5['queue'];this[_0x6e17('0x20')]=_0x1762a5['membername'];this[_0x6e17('0x21')]=_0x1762a5[_0x6e17('0x21')];this[_0x6e17('0x22')]=_0x33cdf6['callback'];this['callbackuniqueid']=_0x33cdf6['callbackuniqueid'];this[_0x6e17('0x23')]=_0x33cdf6[_0x6e17('0x23')];this[_0x6e17('0x24')]=_0x33cdf6[_0x6e17('0x24')];this[_0x6e17('0x25')]=_0x33cdf6[_0x6e17('0x25')];this['ListId']=_0x33cdf6[_0x6e17('0x26')];this['UserId']=_0x33cdf6['UserId'];this[_0x6e17('0x27')]=_0x33cdf6[_0x6e17('0x27')];this[_0x6e17('0x28')]=_0x33cdf6['CampaignId'];this['originatecalleridnum']=_0x33cdf6[_0x6e17('0x29')]||'';this[_0x6e17('0x2a')]=_0x33cdf6[_0x6e17('0x2a')]||'';}module[_0x6e17('0x2b')]=AgentComplete; \ No newline at end of file +var _0x2ae2=['diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds'];(function(_0x4bd6c6,_0x1b70ff){var _0x26da74=function(_0x5ea217){while(--_0x5ea217){_0x4bd6c6['push'](_0x4bd6c6['shift']());}};_0x26da74(++_0x1b70ff);}(_0x2ae2,0x132));var _0x22ae=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x2ae2[_0x40df5f];return _0x1573f1;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x22ae('0x0'));function getSeconds(_0x11c509,_0x3250a8){var _0x55e40b=moment(_0x11c509)['milliseconds'](0x0);var _0x1324d9=moment(_0x3250a8)[_0x22ae('0x1')](0x0);return _0x55e40b[_0x22ae('0x2')](_0x1324d9,_0x22ae('0x3'));}function AgentComplete(_0x51ecae,_0x5eac93){this['state']=0x4;this[_0x22ae('0x4')]='Answer';this[_0x22ae('0x5')]=_0x51ecae[_0x22ae('0x5')];this[_0x22ae('0x6')]=_0x51ecae[_0x22ae('0x6')];this[_0x22ae('0x7')]=_0x51ecae[_0x22ae('0x6')]===_0x22ae('0x8')?'queue':_0x51ecae[_0x22ae('0x6')];this['countbusyretry']=_0x51ecae[_0x22ae('0x9')];this[_0x22ae('0xa')]=_0x51ecae[_0x22ae('0xa')];this[_0x22ae('0xb')]=_0x51ecae[_0x22ae('0xb')];this[_0x22ae('0xc')]=_0x51ecae[_0x22ae('0x9')]+_0x51ecae[_0x22ae('0xa')]+_0x51ecae[_0x22ae('0xb')]+_0x51ecae[_0x22ae('0xd')]+_0x51ecae[_0x22ae('0xe')]+_0x51ecae['countabandonedretry']+_0x51ecae[_0x22ae('0xf')]+_0x51ecae['countagentrejectretry'];this[_0x22ae('0xd')]=_0x51ecae['countnosuchnumberretry'];this[_0x22ae('0xe')]=_0x51ecae[_0x22ae('0xe')];this[_0x22ae('0x10')]=_0x51ecae[_0x22ae('0x10')];this[_0x22ae('0xf')]=_0x51ecae[_0x22ae('0xf')];this[_0x22ae('0x11')]=_0x51ecae[_0x22ae('0x11')];this[_0x22ae('0x12')]=_0x5eac93[_0x22ae('0x12')];this[_0x22ae('0x13')]=_0x51ecae[_0x22ae('0x14')];this['calleridnum']=_0x51ecae[_0x22ae('0x15')];this[_0x22ae('0x16')]=_0x51ecae[_0x22ae('0x16')];this[_0x22ae('0x17')]=_0x51ecae[_0x22ae('0x17')];this[_0x22ae('0x18')]=_0x51ecae[_0x22ae('0x18')];this[_0x22ae('0x19')]=moment()[_0x22ae('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x22ae('0x1b')]=getSeconds(_0x51ecae[_0x22ae('0x17')],_0x51ecae[_0x22ae('0x16')]);this[_0x22ae('0x1c')]=getSeconds(_0x51ecae[_0x22ae('0x18')],_0x51ecae[_0x22ae('0x17')]);this[_0x22ae('0x1d')]=getSeconds(this[_0x22ae('0x19')],_0x51ecae['answertime']);this[_0x22ae('0x1e')]=_0x5eac93[_0x22ae('0x1e')];this[_0x22ae('0x1f')]=_0x5eac93[_0x22ae('0x1f')];this['reason']=_0x5eac93[_0x22ae('0x20')];this[_0x22ae('0x21')]=_0x51ecae['callback'];this['callbackuniqueid']=_0x51ecae['callbackuniqueid'];this[_0x22ae('0x22')]=_0x51ecae[_0x22ae('0x22')];this[_0x22ae('0x23')]=_0x51ecae[_0x22ae('0x23')];this[_0x22ae('0x24')]=_0x51ecae['ContactId'];this[_0x22ae('0x25')]=_0x51ecae[_0x22ae('0x25')];this[_0x22ae('0x26')]=_0x51ecae['UserId'];this[_0x22ae('0x27')]=_0x51ecae['VoiceQueueId'];this[_0x22ae('0x28')]=_0x51ecae['CampaignId'];this[_0x22ae('0x29')]=_0x51ecae[_0x22ae('0x29')]||'';this[_0x22ae('0x2a')]=_0x51ecae['originatecalleridname']||'';}module[_0x22ae('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 4e0693a..46c4341 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 _0x9f34=['ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x206116,_0x1089f9){var _0x2851d3=function(_0x3f08d9){while(--_0x3f08d9){_0x206116['push'](_0x206116['shift']());}};_0x2851d3(++_0x1089f9);}(_0x9f34,0x1c3));var _0x49f3=function(_0x30c28c,_0x49c10d){_0x30c28c=_0x30c28c-0x0;var _0x40074d=_0x9f34[_0x30c28c];return _0x40074d;};'use strict';var util=require('util');var _=require(_0x49f3('0x0'));var moment=require(_0x49f3('0x1'));function getSeconds(_0x3aef4a,_0x56dfad){var _0xb82d44=moment(_0x3aef4a)[_0x49f3('0x2')](0x0);var _0x643377=moment(_0x56dfad)[_0x49f3('0x2')](0x0);return _0xb82d44[_0x49f3('0x3')](_0x643377,_0x49f3('0x4'));}function Final(_0x1c4418){this[_0x49f3('0x5')]=_0x1c4418[_0x49f3('0x5')];this[_0x49f3('0x6')]=_0x1c4418[_0x49f3('0x6')];this[_0x49f3('0x7')]=_0x1c4418[_0x49f3('0x7')];this[_0x49f3('0x8')]=_0x1c4418[_0x49f3('0x7')]==='outbound'?'queue':_0x1c4418[_0x49f3('0x7')];this[_0x49f3('0x9')]=_0x1c4418['countbusyretry'];this['countcongestionretry']=_0x1c4418['countcongestionretry'];this['countnoanswerretry']=_0x1c4418['countnoanswerretry'];this['countglobal']=_0x1c4418[_0x49f3('0x9')]+_0x1c4418[_0x49f3('0xa')]+_0x1c4418[_0x49f3('0xb')]+_0x1c4418[_0x49f3('0xc')]+_0x1c4418[_0x49f3('0xd')]+_0x1c4418[_0x49f3('0xe')]+_0x1c4418[_0x49f3('0xf')]+_0x1c4418['countagentrejectretry'];this[_0x49f3('0xc')]=_0x1c4418[_0x49f3('0xc')];this[_0x49f3('0xd')]=_0x1c4418['countdropretry'];this[_0x49f3('0xe')]=_0x1c4418[_0x49f3('0xe')];this[_0x49f3('0xf')]=_0x1c4418[_0x49f3('0xf')];this[_0x49f3('0x10')]=_0x1c4418[_0x49f3('0x10')];this[_0x49f3('0x11')]=_0x1c4418[_0x49f3('0x11')];this[_0x49f3('0x12')]=_0x1c4418[_0x49f3('0x12')];this[_0x49f3('0x13')]=_0x1c4418[_0x49f3('0x13')];this['starttime']=_0x1c4418[_0x49f3('0x14')];this[_0x49f3('0x15')]=_0x1c4418[_0x49f3('0x15')];this[_0x49f3('0x16')]=_0x1c4418[_0x49f3('0x15')];this[_0x49f3('0x17')]=_0x1c4418[_0x49f3('0x17')]||0x0;this[_0x49f3('0x18')]=_0x1c4418['holdtime']||0x0;this[_0x49f3('0x19')]=_0x1c4418[_0x49f3('0x19')]||0x0;this['callback']=_0x1c4418[_0x49f3('0x1a')];this['callbackuniqueid']=_0x1c4418[_0x49f3('0x1b')];this[_0x49f3('0x1c')]=_0x1c4418[_0x49f3('0x1c')];this[_0x49f3('0x1d')]=_0x1c4418[_0x49f3('0x1d')];this[_0x49f3('0x1e')]=_0x1c4418[_0x49f3('0x1e')];this[_0x49f3('0x1f')]=_0x1c4418['ListId'];this['UserId']=_0x1c4418['UserId'];this[_0x49f3('0x20')]=_0x1c4418[_0x49f3('0x20')];this[_0x49f3('0x21')]=_0x1c4418[_0x49f3('0x21')];this[_0x49f3('0x22')]=_0x1c4418['originatecalleridnum']||'';this[_0x49f3('0x23')]=_0x1c4418[_0x49f3('0x23')]||'';}module[_0x49f3('0x24')]=Final; \ No newline at end of file +var _0xd38f=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x51e1e7,_0x3a8896){var _0x1ba4f3=function(_0x5954d9){while(--_0x5954d9){_0x51e1e7['push'](_0x51e1e7['shift']());}};_0x1ba4f3(++_0x3a8896);}(_0xd38f,0x1a0));var _0xfd38=function(_0x38131b,_0x140809){_0x38131b=_0x38131b-0x0;var _0x3dcf55=_0xd38f[_0x38131b];return _0x3dcf55;};'use strict';var util=require(_0xfd38('0x0'));var _=require(_0xfd38('0x1'));var moment=require(_0xfd38('0x2'));function getSeconds(_0x2e7403,_0x5e12a2){var _0x42e307=moment(_0x2e7403)[_0xfd38('0x3')](0x0);var _0x4986fb=moment(_0x5e12a2)[_0xfd38('0x3')](0x0);return _0x42e307[_0xfd38('0x4')](_0x4986fb,_0xfd38('0x5'));}function Final(_0x2ac0b9){this[_0xfd38('0x6')]=_0x2ac0b9['uniqueid'];this[_0xfd38('0x7')]=_0x2ac0b9['scheduledat'];this[_0xfd38('0x8')]=_0x2ac0b9['type'];this[_0xfd38('0x9')]=_0x2ac0b9['type']===_0xfd38('0xa')?_0xfd38('0xb'):_0x2ac0b9['type'];this[_0xfd38('0xc')]=_0x2ac0b9[_0xfd38('0xc')];this[_0xfd38('0xd')]=_0x2ac0b9[_0xfd38('0xd')];this[_0xfd38('0xe')]=_0x2ac0b9['countnoanswerretry'];this['countglobal']=_0x2ac0b9[_0xfd38('0xc')]+_0x2ac0b9[_0xfd38('0xd')]+_0x2ac0b9['countnoanswerretry']+_0x2ac0b9[_0xfd38('0xf')]+_0x2ac0b9['countdropretry']+_0x2ac0b9[_0xfd38('0x10')]+_0x2ac0b9[_0xfd38('0x11')]+_0x2ac0b9['countagentrejectretry'];this[_0xfd38('0xf')]=_0x2ac0b9[_0xfd38('0xf')];this['countdropretry']=_0x2ac0b9[_0xfd38('0x12')];this['countabandonedretry']=_0x2ac0b9[_0xfd38('0x10')];this['countmachineretry']=_0x2ac0b9[_0xfd38('0x11')];this['countagentrejectretry']=_0x2ac0b9[_0xfd38('0x13')];this[_0xfd38('0xb')]=_0x2ac0b9[_0xfd38('0xb')];this[_0xfd38('0x14')]=_0x2ac0b9[_0xfd38('0x14')];this[_0xfd38('0x15')]=_0x2ac0b9[_0xfd38('0x15')];this['starttime']=_0x2ac0b9['starttime'];this['responsetime']=_0x2ac0b9[_0xfd38('0x16')];this[_0xfd38('0x17')]=_0x2ac0b9['responsetime'];this['ringtime']=_0x2ac0b9[_0xfd38('0x18')]||0x0;this[_0xfd38('0x19')]=_0x2ac0b9[_0xfd38('0x19')]||0x0;this['talktime']=_0x2ac0b9[_0xfd38('0x1a')]||0x0;this['callback']=_0x2ac0b9[_0xfd38('0x1b')];this[_0xfd38('0x1c')]=_0x2ac0b9['callbackuniqueid'];this[_0xfd38('0x1d')]=_0x2ac0b9[_0xfd38('0x1d')];this[_0xfd38('0x1e')]=_0x2ac0b9[_0xfd38('0x1e')];this[_0xfd38('0x1f')]=_0x2ac0b9['ContactId'];this[_0xfd38('0x20')]=_0x2ac0b9[_0xfd38('0x20')];this[_0xfd38('0x21')]=_0x2ac0b9[_0xfd38('0x21')];this[_0xfd38('0x22')]=_0x2ac0b9[_0xfd38('0x22')];this['CampaignId']=_0x2ac0b9[_0xfd38('0x23')];this[_0xfd38('0x24')]=_0x2ac0b9[_0xfd38('0x24')]||'';this[_0xfd38('0x25')]=_0x2ac0b9[_0xfd38('0x25')]||'';}module[_0xfd38('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 04084de..031442c 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 _0x2d0e=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','number','starttime','responsetime'];(function(_0x387b3f,_0x582b55){var _0x358e90=function(_0x5d1f79){while(--_0x5d1f79){_0x387b3f['push'](_0x387b3f['shift']());}};_0x358e90(++_0x582b55);}(_0x2d0e,0x8f));var _0xe2d0=function(_0x3491cc,_0x45d472){_0x3491cc=_0x3491cc-0x0;var _0xe4b072=_0x2d0e[_0x3491cc];return _0xe4b072;};'use strict';var util=require(_0xe2d0('0x0'));var _=require(_0xe2d0('0x1'));var moment=require('moment');function getSeconds(_0x31c034,_0x16b6b3){var _0x59852d=moment(_0x31c034)[_0xe2d0('0x2')](0x0);var _0x1297bb=moment(_0x16b6b3)[_0xe2d0('0x2')](0x0);return _0x59852d[_0xe2d0('0x3')](_0x1297bb,'seconds');}function Hangup(_0x1552eb,_0x3e84f1){this[_0xe2d0('0x4')]=0x4;this[_0xe2d0('0x5')]=_0xe2d0('0x6');this[_0xe2d0('0x7')]=_0x1552eb[_0xe2d0('0x7')];this[_0xe2d0('0x8')]=_0x1552eb[_0xe2d0('0x8')];this[_0xe2d0('0x9')]=_0x1552eb[_0xe2d0('0x8')]===_0xe2d0('0xa')?'queue':_0x1552eb[_0xe2d0('0x8')];this[_0xe2d0('0xb')]=_0x1552eb[_0xe2d0('0xb')];this[_0xe2d0('0xc')]=_0x1552eb[_0xe2d0('0xc')];this[_0xe2d0('0xd')]=_0x1552eb['countnoanswerretry'];this[_0xe2d0('0xe')]=_0x1552eb[_0xe2d0('0xb')]+_0x1552eb[_0xe2d0('0xc')]+_0x1552eb['countnoanswerretry']+_0x1552eb[_0xe2d0('0xf')]+_0x1552eb[_0xe2d0('0x10')]+_0x1552eb[_0xe2d0('0x11')]+_0x1552eb['countmachineretry']+_0x1552eb[_0xe2d0('0x12')];this[_0xe2d0('0xf')]=_0x1552eb[_0xe2d0('0xf')];this[_0xe2d0('0x10')]=_0x1552eb[_0xe2d0('0x10')];this['countabandonedretry']=_0x1552eb[_0xe2d0('0x11')];this[_0xe2d0('0x13')]=_0x1552eb[_0xe2d0('0x13')];this['countagentrejectretry']=_0x1552eb[_0xe2d0('0x12')];this[_0xe2d0('0x14')]=_0x3e84f1['uniqueid'];this[_0xe2d0('0x15')]=_0x1552eb['name'];this['calleridnum']=_0x1552eb[_0xe2d0('0x16')];this[_0xe2d0('0x17')]=_0x1552eb[_0xe2d0('0x17')];this[_0xe2d0('0x18')]=_0x1552eb['responsetime'];this[_0xe2d0('0x19')]=moment()[_0xe2d0('0x1a')](_0xe2d0('0x1b'));this['ringtime']=getSeconds(_0x1552eb[_0xe2d0('0x18')],_0x1552eb[_0xe2d0('0x17')]);this[_0xe2d0('0x1c')]=0x0;this['talktime']=getSeconds(this[_0xe2d0('0x19')],_0x1552eb[_0xe2d0('0x18')]);this['queue']=_0x1552eb[_0xe2d0('0x1d')];this[_0xe2d0('0x1e')]='IVR';this[_0xe2d0('0x1f')]=_0x3e84f1[_0xe2d0('0x20')];this[_0xe2d0('0x21')]=_0x1552eb[_0xe2d0('0x21')];this['callbackuniqueid']=_0x1552eb[_0xe2d0('0x22')];this[_0xe2d0('0x23')]=_0x1552eb['callbackat'];this['recallme']=_0x1552eb[_0xe2d0('0x24')];this[_0xe2d0('0x25')]=_0x1552eb['ContactId'];this['ListId']=_0x1552eb[_0xe2d0('0x26')];this[_0xe2d0('0x27')]=_0x1552eb[_0xe2d0('0x27')];this[_0xe2d0('0x28')]=_0x1552eb[_0xe2d0('0x28')];this['CampaignId']=_0x1552eb['CampaignId'];}module[_0xe2d0('0x29')]=Hangup; \ No newline at end of file +var _0x9e27=['endtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime'];(function(_0x6754df,_0xda05e2){var _0x593a77=function(_0x10482b){while(--_0x10482b){_0x6754df['push'](_0x6754df['shift']());}};_0x593a77(++_0xda05e2);}(_0x9e27,0x141));var _0x79e2=function(_0xfbc375,_0x5b7a61){_0xfbc375=_0xfbc375-0x0;var _0x437441=_0x9e27[_0xfbc375];return _0x437441;};'use strict';var util=require('util');var _=require(_0x79e2('0x0'));var moment=require(_0x79e2('0x1'));function getSeconds(_0x237b42,_0x427236){var _0x18de8a=moment(_0x237b42)[_0x79e2('0x2')](0x0);var _0x28c148=moment(_0x427236)[_0x79e2('0x2')](0x0);return _0x18de8a[_0x79e2('0x3')](_0x28c148,_0x79e2('0x4'));}function Hangup(_0x6ecaf,_0x1f1bdf){this[_0x79e2('0x5')]=0x4;this[_0x79e2('0x6')]='Answer';this['scheduledat']=_0x6ecaf[_0x79e2('0x7')];this[_0x79e2('0x8')]=_0x6ecaf['type'];this[_0x79e2('0x9')]=_0x6ecaf['type']===_0x79e2('0xa')?_0x79e2('0xb'):_0x6ecaf['type'];this[_0x79e2('0xc')]=_0x6ecaf[_0x79e2('0xc')];this[_0x79e2('0xd')]=_0x6ecaf[_0x79e2('0xd')];this[_0x79e2('0xe')]=_0x6ecaf[_0x79e2('0xe')];this[_0x79e2('0xf')]=_0x6ecaf[_0x79e2('0xc')]+_0x6ecaf[_0x79e2('0xd')]+_0x6ecaf['countnoanswerretry']+_0x6ecaf[_0x79e2('0x10')]+_0x6ecaf[_0x79e2('0x11')]+_0x6ecaf[_0x79e2('0x12')]+_0x6ecaf[_0x79e2('0x13')]+_0x6ecaf[_0x79e2('0x14')];this['countnosuchnumberretry']=_0x6ecaf[_0x79e2('0x10')];this[_0x79e2('0x11')]=_0x6ecaf[_0x79e2('0x11')];this[_0x79e2('0x12')]=_0x6ecaf['countabandonedretry'];this['countmachineretry']=_0x6ecaf[_0x79e2('0x13')];this[_0x79e2('0x14')]=_0x6ecaf['countagentrejectretry'];this[_0x79e2('0x15')]=_0x1f1bdf['uniqueid'];this[_0x79e2('0x16')]=_0x6ecaf['name'];this[_0x79e2('0x17')]=_0x6ecaf[_0x79e2('0x18')];this['starttime']=_0x6ecaf['starttime'];this['responsetime']=_0x6ecaf['responsetime'];this['endtime']=moment()[_0x79e2('0x19')](_0x79e2('0x1a'));this[_0x79e2('0x1b')]=getSeconds(_0x6ecaf[_0x79e2('0x1c')],_0x6ecaf['starttime']);this[_0x79e2('0x1d')]=0x0;this[_0x79e2('0x1e')]=getSeconds(this[_0x79e2('0x1f')],_0x6ecaf[_0x79e2('0x1c')]);this[_0x79e2('0xb')]=_0x6ecaf[_0x79e2('0xb')];this[_0x79e2('0x20')]=_0x79e2('0x21');this[_0x79e2('0x22')]=_0x1f1bdf['cause-txt'];this[_0x79e2('0x23')]=_0x6ecaf[_0x79e2('0x23')];this['callbackuniqueid']=_0x6ecaf[_0x79e2('0x24')];this[_0x79e2('0x25')]=_0x6ecaf[_0x79e2('0x25')];this[_0x79e2('0x26')]=_0x6ecaf[_0x79e2('0x26')];this['ContactId']=_0x6ecaf[_0x79e2('0x27')];this[_0x79e2('0x28')]=_0x6ecaf[_0x79e2('0x28')];this['UserId']=_0x6ecaf['UserId'];this[_0x79e2('0x29')]=_0x6ecaf[_0x79e2('0x29')];this['CampaignId']=_0x6ecaf[_0x79e2('0x2a')];}module[_0x79e2('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 4084e3e..b29ac03 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 _0x40c6=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x40c6,0xf5));var _0x640c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x40c6[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x640c('0x0'));var _=require(_0x640c('0x1'));var moment=require(_0x640c('0x2'));function getSeconds(_0x15fa87,_0x333ff5){var _0x18ec13=moment(_0x15fa87)[_0x640c('0x3')](0x0);var _0x48e206=moment(_0x333ff5)['milliseconds'](0x0);return _0x18ec13[_0x640c('0x4')](_0x48e206,_0x640c('0x5'));}function History(_0xc28ea9){this[_0x640c('0x6')]=_0xc28ea9[_0x640c('0x6')];this['scheduledat']=_0xc28ea9['scheduledat']||undefined;this[_0x640c('0x7')]=_0xc28ea9['type'];this['campaigntype']=_0xc28ea9[_0x640c('0x7')]===_0x640c('0x8')?'queue':_0xc28ea9['type'];this[_0x640c('0x9')]=_0xc28ea9[_0x640c('0x9')];this[_0x640c('0xa')]=_0xc28ea9[_0x640c('0xa')];this['countnoanswerretry']=_0xc28ea9[_0x640c('0xb')];this[_0x640c('0xc')]=_0xc28ea9[_0x640c('0x9')]+_0xc28ea9[_0x640c('0xa')]+_0xc28ea9[_0x640c('0xb')]+_0xc28ea9['countnosuchnumberretry']+_0xc28ea9[_0x640c('0xd')]+_0xc28ea9[_0x640c('0xe')]+_0xc28ea9['countmachineretry']+_0xc28ea9['countagentrejectretry'];this['countnosuchnumberretry']=_0xc28ea9[_0x640c('0xf')];this[_0x640c('0xd')]=_0xc28ea9['countdropretry'];this[_0x640c('0xe')]=_0xc28ea9['countabandonedretry'];this[_0x640c('0x10')]=_0xc28ea9[_0x640c('0x10')];this[_0x640c('0x11')]=_0xc28ea9[_0x640c('0x11')];this['queue']=_0xc28ea9['queue'];this[_0x640c('0x12')]=_0xc28ea9[_0x640c('0x13')];this[_0x640c('0x14')]=_0xc28ea9['number'];this[_0x640c('0x15')]=_0xc28ea9[_0x640c('0x15')];this[_0x640c('0x16')]=_0xc28ea9[_0x640c('0x16')];this[_0x640c('0x17')]=_0xc28ea9[_0x640c('0x16')];this[_0x640c('0x18')]=getSeconds(_0xc28ea9[_0x640c('0x16')],_0xc28ea9['starttime']);this[_0x640c('0x19')]=0x0;this[_0x640c('0x1a')]=0x0;this['callback']=_0xc28ea9[_0x640c('0x1b')];this['callbackuniqueid']=_0xc28ea9[_0x640c('0x1c')];this['callbackat']=_0xc28ea9[_0x640c('0x1d')];this['recallme']=_0xc28ea9[_0x640c('0x1e')];this['ContactId']=_0xc28ea9[_0x640c('0x1f')];this[_0x640c('0x20')]=_0xc28ea9[_0x640c('0x20')];this[_0x640c('0x21')]=_0xc28ea9[_0x640c('0x21')];this['VoiceQueueId']=_0xc28ea9[_0x640c('0x22')];this['CampaignId']=_0xc28ea9['CampaignId'];this[_0x640c('0x23')]=_0xc28ea9[_0x640c('0x23')]||'';this[_0x640c('0x24')]=_0xc28ea9[_0x640c('0x24')]||'';}module[_0x640c('0x25')]=History; \ No newline at end of file +var _0xca4b=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid'];(function(_0x1c78d1,_0x550e85){var _0x281691=function(_0x228c48){while(--_0x228c48){_0x1c78d1['push'](_0x1c78d1['shift']());}};_0x281691(++_0x550e85);}(_0xca4b,0x132));var _0xbca4=function(_0xef22ce,_0x49c0aa){_0xef22ce=_0xef22ce-0x0;var _0x5ccac6=_0xca4b[_0xef22ce];return _0x5ccac6;};'use strict';var util=require('util');var _=require(_0xbca4('0x0'));var moment=require(_0xbca4('0x1'));function getSeconds(_0x1853ad,_0x21268c){var _0x422fe8=moment(_0x1853ad)[_0xbca4('0x2')](0x0);var _0x56f732=moment(_0x21268c)[_0xbca4('0x2')](0x0);return _0x422fe8[_0xbca4('0x3')](_0x56f732,_0xbca4('0x4'));}function History(_0x760245){this['uniqueid']=_0x760245[_0xbca4('0x5')];this[_0xbca4('0x6')]=_0x760245['scheduledat']||undefined;this[_0xbca4('0x7')]=_0x760245[_0xbca4('0x7')];this[_0xbca4('0x8')]=_0x760245[_0xbca4('0x7')]==='outbound'?_0xbca4('0x9'):_0x760245[_0xbca4('0x7')];this['countbusyretry']=_0x760245[_0xbca4('0xa')];this[_0xbca4('0xb')]=_0x760245[_0xbca4('0xb')];this[_0xbca4('0xc')]=_0x760245['countnoanswerretry'];this['countglobal']=_0x760245['countbusyretry']+_0x760245['countcongestionretry']+_0x760245[_0xbca4('0xc')]+_0x760245[_0xbca4('0xd')]+_0x760245[_0xbca4('0xe')]+_0x760245[_0xbca4('0xf')]+_0x760245[_0xbca4('0x10')]+_0x760245['countagentrejectretry'];this[_0xbca4('0xd')]=_0x760245[_0xbca4('0xd')];this[_0xbca4('0xe')]=_0x760245[_0xbca4('0xe')];this[_0xbca4('0xf')]=_0x760245['countabandonedretry'];this[_0xbca4('0x10')]=_0x760245[_0xbca4('0x10')];this[_0xbca4('0x11')]=_0x760245['countagentrejectretry'];this[_0xbca4('0x9')]=_0x760245[_0xbca4('0x9')];this[_0xbca4('0x12')]=_0x760245[_0xbca4('0x13')];this[_0xbca4('0x14')]=_0x760245[_0xbca4('0x15')];this[_0xbca4('0x16')]=_0x760245['starttime'];this['responsetime']=_0x760245[_0xbca4('0x17')];this[_0xbca4('0x18')]=_0x760245[_0xbca4('0x17')];this['ringtime']=getSeconds(_0x760245['responsetime'],_0x760245[_0xbca4('0x16')]);this[_0xbca4('0x19')]=0x0;this[_0xbca4('0x1a')]=0x0;this[_0xbca4('0x1b')]=_0x760245[_0xbca4('0x1b')];this[_0xbca4('0x1c')]=_0x760245[_0xbca4('0x1c')];this[_0xbca4('0x1d')]=_0x760245[_0xbca4('0x1d')];this[_0xbca4('0x1e')]=_0x760245[_0xbca4('0x1e')];this['ContactId']=_0x760245[_0xbca4('0x1f')];this[_0xbca4('0x20')]=_0x760245['ListId'];this['UserId']=_0x760245[_0xbca4('0x21')];this[_0xbca4('0x22')]=_0x760245[_0xbca4('0x22')];this[_0xbca4('0x23')]=_0x760245['CampaignId'];this[_0xbca4('0x24')]=_0x760245['originatecalleridnum']||'';this['originatecalleridname']=_0x760245[_0xbca4('0x25')]||'';}module[_0xbca4('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 b086339..2a14368 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 _0x8e5c=['checkIsBlackListIvr','then','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','reachable','SIP/%s','unmonitored','saveInDb','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','uniqueid','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','AMD','[syncHangupInAMDIvr][createHistory]','amd','countcongestionretry','reason\x2019\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','AGI','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','reason','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','agiafterat','dialQueueProject2','[rescheduleContact][Drop]','calleridname','calleridnum','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','countabandonedretry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','interval','indexOf','iftime\x20%s,%s','content','all','some','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','checkIfTime','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','trim','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','object','[callProgressDetecting]','evt\x20is\x20undefine','emit','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','buildObj','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','check\x20failure','startMethodPredictive','one\x20call\x20every:','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialMethod','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','seconds','outbound','strategy','answered','available','loggedIn','sumBillable','talking','type','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','active','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','diff','clearing\x20variable\x20start\x20progressive','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','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','starttime','uniqueId','[uniqueid]','clearZombieChannels','isNil','Action','status','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20'];(function(_0x5a404a,_0x48458a){var _0xd5f363=function(_0x3ad6af){while(--_0x3ad6af){_0x5a404a['push'](_0x5a404a['shift']());}};_0xd5f363(++_0x48458a);}(_0x8e5c,0x167));var _0xc8e5=function(_0x2156ef,_0x3f36ea){_0x2156ef=_0x2156ef-0x0;var _0x418795=_0x8e5c[_0x2156ef];return _0x418795;};'use strict';var util=require(_0xc8e5('0x0'));var _=require(_0xc8e5('0x1'));var BPromise=require(_0xc8e5('0x2'));var uuid=require('uuid');var moment=require(_0xc8e5('0x3'));var rr=require('rr');var md5=require(_0xc8e5('0x4'));var Redis=require(_0xc8e5('0x5'));var ut=require(_0xc8e5('0x6'));var config=require(_0xc8e5('0x7'));var logger=require(_0xc8e5('0x8'))(_0xc8e5('0x9'));var loggerBooked=require(_0xc8e5('0x8'))('booked');var loggerPredictive=require(_0xc8e5('0x8'))(_0xc8e5('0xa'));var loggerPredictiveCalls=require(_0xc8e5('0x8'))(_0xc8e5('0xb'));var loggerSyncQueueSummary=require(_0xc8e5('0x8'))(_0xc8e5('0xc'));var ami=require(_0xc8e5('0xd'));config[_0xc8e5('0xe')]=_[_0xc8e5('0xf')](config[_0xc8e5('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc8e5('0xe')]));var cmHopper=require(_0xc8e5('0x10'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xc8e5('0x11'));var cmHopperBlack=require(_0xc8e5('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require('./history');var Final=require(_0xc8e5('0x13'));var AgentComplete=require(_0xc8e5('0x14'));var QueueCallerAbandon=require(_0xc8e5('0x15'));var Hangup=require(_0xc8e5('0x16'));var ipAgi=process[_0xc8e5('0x17')]['XCALLY_IP_AGI']||_0xc8e5('0x18');var strategy={'rrmemory':_0xc8e5('0x19'),'roundrobin':_0xc8e5('0x1a')};var Sequence=function(){};Sequence[_0xc8e5('0x1b')][_0xc8e5('0x1c')]=function(_0x51d685){this['tail']=this[_0xc8e5('0x1d')]?this[_0xc8e5('0x1d')][_0xc8e5('0x1e')](_0x51d685):_0x51d685();};function Dialer(_0x466bca,_0x5942d3){this[_0xc8e5('0x1f')]=new Sequence();this[_0xc8e5('0x20')]=_0x5942d3;this[_0xc8e5('0x21')]=_0x466bca['voiceQueues'];this['campaigns']=_0x466bca[_0xc8e5('0x22')];this['agents']=_0x466bca[_0xc8e5('0x23')];this[_0xc8e5('0x24')]=_0x466bca[_0xc8e5('0x24')];this[_0xc8e5('0x25')]=config['maxNumberOriginate']||0x2;this[_0xc8e5('0x26')]={};this[_0xc8e5('0x27')]={};this[_0xc8e5('0x28')]={};this['uniqueId']={};this[_0xc8e5('0x29')]={};this[_0xc8e5('0x2a')]={};this['startProgressive']={};this[_0xc8e5('0x2b')]={};this[_0xc8e5('0x2c')]={};this[_0xc8e5('0x2d')]={};ami['on'](_0xc8e5('0x2e'),this['syncAgentConnect'][_0xc8e5('0x2f')](this));ami['on']('queuecallerabandon',this[_0xc8e5('0x30')][_0xc8e5('0x2f')](this));ami['on'](_0xc8e5('0x31'),this[_0xc8e5('0x32')][_0xc8e5('0x2f')](this));ami['on']('agentcomplete',this[_0xc8e5('0x33')][_0xc8e5('0x2f')](this));ami['on'](_0xc8e5('0x34'),this[_0xc8e5('0xc')][_0xc8e5('0x2f')](this));ami['on'](_0xc8e5('0x35'),this[_0xc8e5('0x36')][_0xc8e5('0x2f')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xc8e5('0x37'),this[_0xc8e5('0x38')][_0xc8e5('0x2f')](this));ami['on'](_0xc8e5('0x39'),this[_0xc8e5('0x3a')]['bind'](this));ami['on'](_0xc8e5('0x3b'),this[_0xc8e5('0x3c')][_0xc8e5('0x2f')](this));this[_0xc8e5('0x3d')]();this['loopClearZombieChannels']();}function isNotNull(_0x1ff59f){return _0x1ff59f!==null&&!_[_0xc8e5('0x3e')](_0x1ff59f);}function checkIsLoggedIn(_0x2d0f13,_0x3b8a1f){return function(){if(_0x3b8a1f<=0x0){_0x2d0f13[_0xc8e5('0x3f')]=_0xc8e5('0x40');throw _0x2d0f13[_0xc8e5('0x41')]+_0xc8e5('0x42');}};}function isActive(_0x56aa89){return _0x56aa89;}function checkIsActive(_0x473ade,_0x5a7c6b){return function(){if(!isActive(_0x5a7c6b)){_0x473ade[_0xc8e5('0x3f')]='NOT_ACTIVE';throw _0x473ade['name']+_0xc8e5('0x43');}};}function checkInterval(_0xa80b5){return function(){if(!isNotNull(_0xa80b5[_0xc8e5('0x44')])){_0xa80b5[_0xc8e5('0x3f')]=_0xc8e5('0x45');throw _0xa80b5[_0xc8e5('0x41')]+_0xc8e5('0x46');}if(!isNotNull(_0xa80b5[_0xc8e5('0x44')][_0xc8e5('0x47')])){_0xa80b5['message']=_0xc8e5('0x45');throw _0xa80b5[_0xc8e5('0x41')]+_0xc8e5('0x46');}if(!isNotNull(_[_0xc8e5('0x48')](_0xa80b5[_0xc8e5('0x44')][_0xc8e5('0x47')]))){_0xa80b5['message']=_0xc8e5('0x45');throw _0xa80b5[_0xc8e5('0x41')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x4026e1,_0x1b5b41,_0x28a1fe){return{'action':_0x4026e1,'response':_0x1b5b41,'message':_0x28a1fe,'stack':_0x28a1fe};}function myreject(_0x58c85a){return function(_0x4af60a){return _0x58c85a(msgResponse(_0xc8e5('0x49'),_0xc8e5('0x4a'),JSON[_0xc8e5('0x4b')](_0x4af60a)));};}function getSeconds(_0x30e471,_0x5c7761){var _0x19cf1a=moment(_0x30e471)[_0xc8e5('0x4c')](0x0);var _0x6310b9=moment(_0x5c7761)[_0xc8e5('0x4c')](0x0);return _0x19cf1a['diff'](_0x6310b9,_0xc8e5('0x4d'));}function emit(_0x45250c,_0x3b9944,_0x27b6d5){io['to'](_0x45250c)['emit'](_0x3b9944,_0x27b6d5);}function emitVoiceQueueSummary(_0x339b9d){if(_0x339b9d['type']===_0xc8e5('0x4e')){var _0x19c16a={'id':_0x339b9d['id'],'name':_0x339b9d[_0xc8e5('0x41')],'strategy':_0x339b9d[_0xc8e5('0x4f')],'answered':_0x339b9d[_0xc8e5('0x50')],'available':_0x339b9d[_0xc8e5('0x51')],'loggedIn':_0x339b9d[_0xc8e5('0x52')],'pTalking':_0x339b9d['pTalking'],'sumBillable':_0x339b9d[_0xc8e5('0x53')],'sumDuration':_0x339b9d['sumDuration'],'sumHoldTime':_0x339b9d['sumHoldTime']||0x0,'talking':_0x339b9d[_0xc8e5('0x54')],'total':_0x339b9d['total'],'type':_0x339b9d[_0xc8e5('0x55')],'unmanaged':_0x339b9d['unmanaged'],'abandoned':_0x339b9d[_0xc8e5('0x56')],'waiting':_0x339b9d['waiting'],'loggedInDb':_0x339b9d[_0xc8e5('0x57')],'dialActive':_0x339b9d[_0xc8e5('0x58')],'dialMethod':_0x339b9d['dialMethod'],'dialOriginateCallerIdName':_0x339b9d[_0xc8e5('0x59')],'dialOriginateCallerIdNumber':_0x339b9d['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x339b9d[_0xc8e5('0x5a')],'dialPrefix':_0x339b9d[_0xc8e5('0x5b')],'outboundAnswerAgiCallsDay':_0x339b9d[_0xc8e5('0x5c')],'outboundAnswerCallsDay':_0x339b9d[_0xc8e5('0x5d')],'outboundBlacklistCallsDay':_0x339b9d[_0xc8e5('0x5e')],'outboundBusyCallsDay':_0x339b9d[_0xc8e5('0x5f')],'outboundCongestionCallsDay':_0x339b9d[_0xc8e5('0x60')],'outboundDropCallsDayACS':_0x339b9d[_0xc8e5('0x61')],'outboundDropCallsDayCallersExit':_0x339b9d['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x339b9d[_0xc8e5('0x62')],'outboundNoAnswerCallsDay':_0x339b9d['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x339b9d[_0xc8e5('0x63')],'outboundOriginateFailureCallsDay':_0x339b9d[_0xc8e5('0x64')],'outboundReCallsDay':_0x339b9d[_0xc8e5('0x65')],'outboundRejectCallsDay':_0x339b9d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x339b9d[_0xc8e5('0x66')],'predictiveIntervalAnsweredCalls':_0x339b9d[_0xc8e5('0x67')],'predictiveIntervalAvgHoldtime':_0x339b9d[_0xc8e5('0x68')],'predictiveIntervalAvgTalktime':_0x339b9d[_0xc8e5('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x339b9d[_0xc8e5('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x339b9d[_0xc8e5('0x6b')],'predictiveIntervalErlangCalls':_0x339b9d[_0xc8e5('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x339b9d['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x339b9d[_0xc8e5('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x339b9d[_0xc8e5('0x6e')],'predictiveIntervalPauses':_0x339b9d[_0xc8e5('0x6f')],'predictiveIntervalAvailable':_0x339b9d['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x339b9d['predictiveIntervalTotalCalls'],'message':_0x339b9d[_0xc8e5('0x3f')],'originated':_0x339b9d[_0xc8e5('0x70')],'erlangCalls':_0x339b9d[_0xc8e5('0x71')],'erlangCallToSecond':_0x339b9d[_0xc8e5('0x72')],'erlangAbandonmentRate':_0x339b9d[_0xc8e5('0x73')],'erlangBusyFactor':_0x339b9d['erlangBusyFactor'],'startPredictive':_0x339b9d[_0xc8e5('0x2a')],'startProgressive':_0x339b9d[_0xc8e5('0x74')]};if(_0x339b9d[_0xc8e5('0x75')]){_0x19c16a[_0xc8e5('0x75')]={'id':_0x339b9d[_0xc8e5('0x75')]['id'],'name':_0x339b9d[_0xc8e5('0x75')]['name'],'active':_0x339b9d[_0xc8e5('0x75')][_0xc8e5('0x76')],'callerid':_0x339b9d[_0xc8e5('0x75')][_0xc8e5('0x77')]};}if(_0x339b9d[_0xc8e5('0x44')]){_0x19c16a['Interval']={'id':_0x339b9d[_0xc8e5('0x44')]['id'],'name':_0x339b9d[_0xc8e5('0x44')][_0xc8e5('0x41')]};}var _0x364e1c=md5(JSON['stringify'](_0x19c16a));if(_0x339b9d[_0xc8e5('0x4')]!==_0x364e1c){_0x339b9d[_0xc8e5('0x4')]=_0x364e1c;emit(util[_0xc8e5('0x78')]('voice:queue:%s',_0x19c16a[_0xc8e5('0x41')]),_0xc8e5('0x79'),_0x19c16a);}}}function emitCampaignSummary(_0x3478d1){if(_0x3478d1[_0xc8e5('0x55')]===_0xc8e5('0x7a')){emit(util[_0xc8e5('0x78')](_0xc8e5('0x7b'),_0x3478d1[_0xc8e5('0x41')]),_0xc8e5('0x7c'),_0x3478d1);}}function checkGetDataPredictive(_0x4b7cc8){if(isNotNull(_0x4b7cc8)){if(!_['isEmpty'](_0x4b7cc8)){loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x7e'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b7cc8[_0xc8e5('0x7f')]);loggerPredictive[_0xc8e5('0x7d')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b7cc8[_0xc8e5('0x67')]);loggerPredictive['info'](_0xc8e5('0x80'),_0x4b7cc8[_0xc8e5('0x6b')]);loggerPredictive[_0xc8e5('0x7d')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b7cc8['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x81'),_0x4b7cc8[_0xc8e5('0x68')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b7cc8[_0xc8e5('0x69')]);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x82'));if(_0x4b7cc8[_0xc8e5('0x7f')]>0x0){if(!_['isUndefined'](_0x4b7cc8[_0xc8e5('0x69')])&&_0x4b7cc8['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x83'));}if(!_[_0xc8e5('0x3e')](_0x4b7cc8[_0xc8e5('0x68')])&&_0x4b7cc8['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive['info'](_0xc8e5('0x84'));}}else{loggerPredictive[_0xc8e5('0x7d')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}}else{loggerPredictive['info'](_0xc8e5('0x85'));}return![];}function mergeDataErlangB(_0x4d9571){return function(_0xc3032b){loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x86'));loggerPredictive['info'](_0xc8e5('0x87'),_0xc3032b[_0xc8e5('0x71')]);loggerPredictive['info'](_0xc8e5('0x88'),_0xc3032b[_0xc8e5('0x72')]);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x89'),_0xc3032b[_0xc8e5('0x73')]);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x8a'),_0xc3032b[_0xc8e5('0x8b')]);loggerPredictive[_0xc8e5('0x7d')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc3032b[_0xc8e5('0x73')]);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x82'));_[_0xc8e5('0x8c')](_0x4d9571,_0xc3032b);};}function getDiff(_0x5e2609){var _0x22d4bc=moment()[_0xc8e5('0x4c')](0x0);var _0x26b769=moment(_0x5e2609)['milliseconds'](0x0);return _0x22d4bc[_0xc8e5('0x8d')](_0x26b769,_0xc8e5('0x4d'));}function ifInterval(_0x15c039,_0x522740){if(_[_0xc8e5('0x3e')](_0x522740)){return![];}if(getDiff(_0x522740)<_0x15c039*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xef0f4e){if(isNotNull(_0xef0f4e)){if(!_[_0xc8e5('0x3e')](_0xef0f4e[_0xc8e5('0x74')])){_0xef0f4e[_0xc8e5('0x74')]=undefined;loggerPredictive[_0xc8e5('0x7d')](_0xef0f4e[_0xc8e5('0x41')],_0xc8e5('0x8e'));}if(!_['isUndefined'](_0xef0f4e[_0xc8e5('0x2a')])){_0xef0f4e['startPredictive']=undefined;loggerPredictive['info'](_0xef0f4e[_0xc8e5('0x41')],_0xc8e5('0x8f'));}if(!_['isUndefined'](_0xef0f4e['handlePredictive'])){clearInterval(_0xef0f4e[_0xc8e5('0x90')]);_0xef0f4e[_0xc8e5('0x90')]=undefined;loggerPredictive[_0xc8e5('0x7d')](_0xef0f4e[_0xc8e5('0x41')],_0xc8e5('0x91'));}}}function erlangb(_0x5340b7,_0x3b01f0){if(_0x3b01f0===0x0){return 0x0;}var _0x306cc2=0x1;for(var _0x4028e0=0x1;_0x4028e0<=_0x3b01f0;_0x4028e0+=0x1){_0x306cc2=0x1+_0x306cc2*_0x4028e0/_0x5340b7;}return 0x1/_0x306cc2;}function isVoiceQueueOutbound(_0x3534df){return _0x3534df==='outbound';}function isNotPreview(_0x388199){return _0x388199!==_0xc8e5('0x20');}function isCampaignIvr(_0x1e4855){return _0x1e4855===_0xc8e5('0x7a');}function getCallerId(_0x4c3cb7,_0x356968,_0x310aab){if(!_[_0xc8e5('0x3e')](_0x310aab)&&_0xc8e5('0x92')===typeof _0x310aab&&!_[_0xc8e5('0x48')](_0x310aab)){if(!_['isUndefined'](_0x356968)&&'string'===typeof _0x356968&&!_[_0xc8e5('0x48')](_0x356968)){return util[_0xc8e5('0x78')](_0xc8e5('0x93'),_0x356968,_0x310aab);}return util['format'](_0xc8e5('0x93'),_0x310aab,_0x310aab);}if(!_[_0xc8e5('0x3e')](_0x4c3cb7)&&_0xc8e5('0x92')===typeof _0x4c3cb7&&!_[_0xc8e5('0x48')](_0x4c3cb7)){return _0x4c3cb7;}return _0xc8e5('0x94');}function loggerCatchQueueSummary(_0x2b412f,_0x3cb83a){return function(_0x50e84a){freeVariablesPredictive(_0x3cb83a);emitVoiceQueueSummary(_0x3cb83a);emitCampaignSummary(_0x3cb83a);loggerSyncQueueSummary[_0xc8e5('0x95')](_0x2b412f,util['inspect'](_0x50e84a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x52ec54,_0x25df2c){return function(_0x309bcf){loggerPredictive[_0xc8e5('0x95')](_0x25df2c['name'],_0x52ec54);loggerPredictive[_0xc8e5('0x95')](_0x309bcf[_0xc8e5('0x96')]);freeVariablesPredictive(_0x25df2c);};}function loggerCatch(_0x43be69){return function(_0x10710b){logger[_0xc8e5('0x95')](_0x43be69,util['inspect'](_0x10710b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2126c7){return _0x2126c7&&!_[_0xc8e5('0x3e')](_0x2126c7)&&_0x2126c7[_0xc8e5('0x97')]>0x0;}function decremetOriginate(_0x5e971e){if(!_[_0xc8e5('0x3e')](_0x5e971e)&&_0x5e971e!==null){if(_0x5e971e[_0xc8e5('0x98')](_0xc8e5('0x70'))){if(_0x5e971e[_0xc8e5('0x70')]>0x0){_0x5e971e['originated']-=0x1;}else{logger[_0xc8e5('0x95')](_0xc8e5('0x99'));}}}else{logger[_0xc8e5('0x95')](_0xc8e5('0x9a'));}}function checkContactLowerLimitOriginate(_0x40d3aa,_0x5e1bb7,_0xbd4afb){if(_0x5e1bb7>_0xbd4afb){for(var _0x19e9a4=0x0;_0x19e9a4<_0x5e1bb7-_0xbd4afb;_0x19e9a4+=0x1){decremetOriginate(_0x40d3aa);}}}function loggerGetContactDialer(_0x3a8e62,_0x350068,_0x47c83c){return function(_0x543c25){checkContactLowerLimitOriginate(_0x350068,_0x47c83c,0x0);logger[_0xc8e5('0x95')](_0x3a8e62,util[_0xc8e5('0x9b')](_0x543c25,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x661957){return function(_0x384105){if(isNotNull(_0x384105)&&isNotNull(_0x384105[0x0])){if(_0x384105[0x0]['contactsRescheduled']>0x0){_0x661957[_0xc8e5('0x3f')]=_0xc8e5('0x9c');logger[_0xc8e5('0x7d')](_0xc8e5('0x9d')+_0x661957['name'],_0x384105[0x0][_0xc8e5('0x9e')],'contacts');}else{_0x661957['message']=_0xc8e5('0x9f');logger['info']('[getContactDialer2][Empty]'+_0x661957[_0xc8e5('0x41')]);}}};}function notSendMessagesQueue(_0x511883){if(_0x511883[_0xc8e5('0xa0')]){freeVariablesPredictive(_0x511883);if(_0x511883['originated']===0x0&&_0x511883[_0xc8e5('0x54')]===0x0&&_0x511883[_0xc8e5('0xa1')]===0x0&&(_0x511883[_0xc8e5('0xa2')]||0x0)===0x0){_0x511883[_0xc8e5('0xa0')]=![];_0x511883['available']=0x0;_0x511883[_0xc8e5('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xc8e5('0x95')](_0xc8e5('0xa3'),_0x511883['name'],_0xc8e5('0xa4'));}else{_0x511883[_0xc8e5('0x3f')]=_0xc8e5('0xa5');loggerSyncQueueSummary['error'](_0xc8e5('0xa3'),_0x511883[_0xc8e5('0x41')],_0xc8e5('0xa6'));}emitVoiceQueueSummary(_0x511883);}}function notSendMessagesCampaign(_0x91bf7e){if(_0x91bf7e[_0xc8e5('0xa0')]){if(_0x91bf7e[_0xc8e5('0x70')]===0x0){_0x91bf7e[_0xc8e5('0xa0')]=![];_0x91bf7e[_0xc8e5('0x3f')]=_0xc8e5('0xa7');loggerSyncQueueSummary['error'](_0xc8e5('0xa8'),_0x91bf7e['name'],_0xc8e5('0xa4'));}else{_0x91bf7e[_0xc8e5('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xc8e5('0x95')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x91bf7e[_0xc8e5('0x41')],'is\x20disactive');}emitCampaignSummary(_0x91bf7e);}}function createObjHistory(_0x44dad4,_0xca9060,_0x5419f6,_0x5cfa00,_0x2f3753){_0x44dad4[_0xc8e5('0x3f')]=_0x5419f6;var _0x5f5c0f=new Action(_0x44dad4,_0xca9060);var _0x515109=new History(_0x5f5c0f);_0x515109[_0xc8e5('0xa9')]=_0x5cfa00;_0x515109[_0xc8e5('0xaa')]=_0x2f3753;_0x515109['endtime']=_0x5f5c0f[_0xc8e5('0xab')];return _0x515109;}Dialer[_0xc8e5('0x1b')]['loopClearZombieChannels']=function(){var _0x47b022=this;setInterval(function(){_0x47b022['clearZombieChannels'](_0x47b022[_0xc8e5('0xac')],_0xc8e5('0xad'));_0x47b022[_0xc8e5('0xae')](_0x47b022[_0xc8e5('0x27')],'[actions]');},0x32c8);};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xae')]=function(_0x1ae0c9,_0x4273e4){var _0x218c70=this;for(var _0x1e5886 in _0x1ae0c9){if(_0x1ae0c9['hasOwnProperty'](_0x1e5886)){this[_0xc8e5('0x1f')][_0xc8e5('0x1c')](function(){if(!_[_0xc8e5('0xaf')](_0x1ae0c9[_0x1e5886])){return ami[_0xc8e5('0xb0')]({'action':_0xc8e5('0xb1'),'channel':_0x1ae0c9[_0x1e5886]['channel']})['catch'](function(_0x2d62f3){if(_0x2d62f3[_0xc8e5('0x3f')]===_0xc8e5('0xb2')){setTimeout(function(){if(_0x1ae0c9[_0x1e5886]&&_0x1ae0c9[_0x1e5886]['type']!=='ivr'){_0x218c70[_0xc8e5('0xb3')](_0x218c70['voiceQueues'][_0x1ae0c9[_0x1e5886][_0xc8e5('0xb4')]]);logger[_0xc8e5('0x95')](_0xc8e5('0xb5'),_0x4273e4,_0x1e5886,_0x1ae0c9[_0x1e5886]['queue']);delete _0x1ae0c9[_0x1e5886];}if(_0x1ae0c9[_0x1e5886]&&_0x1ae0c9[_0x1e5886]['type']===_0xc8e5('0x7a')){_0x218c70['updateOriginated'](_0x218c70['campaigns'][_0x1ae0c9[_0x1e5886]['queue']]);logger['error']('[Dialer][checkChannel][ivr]',_0x4273e4,_0x1e5886,_0x1ae0c9[_0x1e5886]['queue']);delete _0x1ae0c9[_0x1e5886];}},0x2328);}});}});}}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xb6')]=function(_0x306f25){return BPromise[_0xc8e5('0xb7')]()['then'](cmHopper[_0xc8e5('0xb6')](_0x306f25))['catch'](loggerCatch(_0xc8e5('0xb8')));};Dialer[_0xc8e5('0x1b')]['checkIsBlackList']=function(_0x3ffb86){return BPromise['resolve']()['then'](cmHopperBlack[_0xc8e5('0xb9')](_0x3ffb86))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xbb')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xbc')]=function(_0x4b6b37){return BPromise['resolve']()[_0xc8e5('0xbd')](cmHopperBlack['checkIsBlackListIvr'](_0x4b6b37))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xbe')));};Dialer['prototype']['averageHandleTime']=function(_0x58419d){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopperHistory[_0xc8e5('0xbf')](_0x58419d))['catch'](loggerCatch(_0xc8e5('0xc0')));};Dialer['prototype'][_0xc8e5('0xc1')]=function(_0x182381){return BPromise['resolve']()[_0xc8e5('0xbd')](cmHopper['rescheduleContact'](_0x182381))['catch'](loggerCatch(_0xc8e5('0xc2')));};Dialer[_0xc8e5('0x1b')]['unlockContact']=function(_0x51073e,_0x4c2ad9,_0x159389){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopper[_0xc8e5('0xc3')](_0x51073e,_0x4c2ad9,_0x159389))['catch'](loggerCatch(_0xc8e5('0xc4')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xc5')]=function(_0x4bc0bc,_0x371e69,_0x59cf6b,_0x442618){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopper[_0xc8e5('0xc5')](_0x4bc0bc,_0x371e69,_0x59cf6b,_0x442618))['catch'](loggerCatch(_0xc8e5('0xc6')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xc7')]=function(_0x39183f,_0xfc2d72,_0x46cb86){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopper[_0xc8e5('0xc7')](_0x39183f,_0xfc2d72,_0x46cb86))['catch'](loggerCatch(_0xc8e5('0xc6')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xc8')]=function(_0x35cb30){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](voiceQueueRt[_0xc8e5('0xc8')](_0x35cb30))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xc9')));};Dialer['prototype'][_0xc8e5('0xca')]=function(_0x1a793e){return BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](cmHopper['moveContactManagedDialer'](_0x1a793e))[_0xc8e5('0xba')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xc8e5('0x1b')]['createHistory']=function(_0x3bab4f){return BPromise[_0xc8e5('0xb7')]()['then'](cmHopperHistory[_0xc8e5('0xcb')](_0x3bab4f))['catch'](loggerCatch(_0xc8e5('0xcc')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xb3')]=function(_0x4f76ee){if(!_['isUndefined'](_0x4f76ee)&&_0x4f76ee!==null){if(_0x4f76ee[_0xc8e5('0x98')](_0xc8e5('0x70'))){if(_0x4f76ee[_0xc8e5('0x70')]>0x0){_0x4f76ee['originated']-=0x1;}else{logger[_0xc8e5('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xc8e5('0x95')](_0xc8e5('0xcd'));}};Dialer['prototype']['loggerHandler']=function(_0x1b73e0,_0x457a88){var _0x3aef7e=this;return function(_0xa1caad){_0x3aef7e[_0xc8e5('0xb3')](_0x457a88);logger[_0xc8e5('0x95')](_0x1b73e0,util[_0xc8e5('0x9b')](_0xa1caad,{'showHidden':![],'depth':null}));};};Dialer[_0xc8e5('0x1b')]['emptyContact']=function(_0x2af8a0,_0x534097,_0x393da4){var _0x3e4726={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x534097);this['saveInDb'](_['merge'](_0x3e4726,_[_0xc8e5('0xce')](_0x393da4,[_0xc8e5('0xcf'),_0xc8e5('0xd0'),'UserId',_0xc8e5('0xd1'),_0xc8e5('0xd2')])),_0xc8e5('0xd3'),_0xc8e5('0xd4'));logger[_0xc8e5('0x95')](_0x2af8a0);};Dialer[_0xc8e5('0x1b')]['isSuccess']=function(_0x51dba8){return _0x51dba8==='Success';};Dialer[_0xc8e5('0x1b')]['isTrunkReachable']=function(_0x7534ff){return!_['isUndefined'](_0x7534ff)&&_0x7534ff&&!_[_0xc8e5('0x3e')](_0x7534ff[_0xc8e5('0x41')])&&!_[_0xc8e5('0x3e')](_0x7534ff['active'])&&_0x7534ff[_0xc8e5('0x76')]&&(this['trunks'][util[_0xc8e5('0x78')]('SIP/%s',_0x7534ff[_0xc8e5('0x41')])][_0xc8e5('0xb1')]===_0xc8e5('0xd5')||this[_0xc8e5('0x24')][util[_0xc8e5('0x78')](_0xc8e5('0xd6'),_0x7534ff['name'])]['status']===_0xc8e5('0xd7'));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xd8')]=function(_0x15bce3,_0x2bd65d,_0x249d90){this[_0xc8e5('0xcb')](_0x15bce3)[_0xc8e5('0xba')](loggerCatch(_0x2bd65d));this[_0xc8e5('0xca')](_0x15bce3)['catch'](loggerCatch(_0x249d90));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x38')]=function(_0x58b76f){var _0x3f245c=this[_0xc8e5('0xac')][_0x58b76f['uniqueid']];var _0x5f2283;if(!_['isNil'](_0x58b76f)&&!_[_0xc8e5('0xaf')](_0x58b76f[_0xc8e5('0xd9')])&&!_[_0xc8e5('0xaf')](_0x58b76f['variable'][_0xc8e5('0xda')])&&_0x58b76f[_0xc8e5('0xdb')]===_0xc8e5('0xdc')&&_0x3f245c){if(_0x3f245c['type']!=='ivr'&&this[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0xdd')]&&_0x58b76f['value']===_0xc8e5('0xde')){delete this['uniqueId'][_0x58b76f[_0xc8e5('0xdf')]];this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]]);this[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;this['voiceQueues'][_0x3f245c[_0xc8e5('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x5f2283=new Hangup(_0x3f245c,_0x58b76f);_0x5f2283[_0xc8e5('0xa9')]=0x12;_0x5f2283['statedesc']=_0xc8e5('0xe0');_0x5f2283[_0xc8e5('0xe1')]='AMD';this[_0xc8e5('0xd8')](_0x5f2283,_0xc8e5('0xe2'),_0xc8e5('0xe3'));}if(_0x3f245c['type']!==_0xc8e5('0x7a')&&this[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0xdd')]&&_0x58b76f[_0xc8e5('0xe4')]===_0xc8e5('0xe5')){var _0x582249=this;return new BPromise(function(_0x3f88ea,_0x3f834d){delete _0x582249[_0xc8e5('0xac')][_0x58b76f[_0xc8e5('0xdf')]];_0x582249[_0xc8e5('0xb3')](_0x582249[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]]);_0x582249['voiceQueues'][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;_0x582249[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0x5c')]+=0x1;var _0x223397=_0x582249[_0xc8e5('0x21')][_0x3f245c[_0xc8e5('0xb4')]];var _0x1e0026=new Hangup(_0x3f245c,_0x58b76f);_0x1e0026[_0xc8e5('0xa9')]=0x13;_0x1e0026[_0xc8e5('0xaa')]=_0xc8e5('0xe6');_0x1e0026[_0xc8e5('0xe1')]='AMD';_0x1e0026['countmachineretry']+=0x1;_0x1e0026[_0xc8e5('0xe7')]+=0x1;_0x1e0026['amd']=!![];_0x582249[_0xc8e5('0xcb')](_0x1e0026)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xe8')));if(_0x1e0026[_0xc8e5('0xe9')]+_0x1e0026['countcongestionretry']+_0x1e0026[_0xc8e5('0xea')]+_0x1e0026[_0xc8e5('0xeb')]+_0x1e0026[_0xc8e5('0xec')]+_0x1e0026['countabandonedretry']+_0x1e0026[_0xc8e5('0xed')]+_0x1e0026[_0xc8e5('0xee')]>=_0x223397[_0xc8e5('0xef')]){_0x582249[_0xc8e5('0xf0')](_0x1e0026,_0x3f88ea,_0x3f834d,_0xc8e5('0xf1'));}else{if(_0x1e0026[_0xc8e5('0xed')]>=_0x223397[_0xc8e5('0xf2')]){_0x582249[_0xc8e5('0xf3')](_0x1e0026,_0x3f88ea,_0x3f834d,'reason\x2019\x20machine....');}else{_0x582249[_0xc8e5('0xc1')]({'active':![],'countmachineretry':_0x1e0026['countmachineretry'],'scheduledat':moment()[_0xc8e5('0xf4')](_0x223397['dialMachineRetryFrequency'],_0xc8e5('0xf5'))['format'](_0xc8e5('0xf6')),'ContactId':_0x1e0026[_0xc8e5('0xcf')],'ListId':_0x1e0026['ListId'],'VoiceQueueId':_0x1e0026[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x1e0026[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xf7')));_0x3f88ea({'reschedule':0x1});}}});}if(_0x3f245c['type']===_0xc8e5('0x7a')&&this[_0xc8e5('0x22')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0xdd')]&&_0x58b76f['value']===_0xc8e5('0xde')){delete this['uniqueId'][_0x58b76f[_0xc8e5('0xdf')]];this['updateOriginated'](this['campaigns'][_0x3f245c[_0xc8e5('0xb4')]]);_0x5f2283=new Hangup(_0x3f245c,_0x58b76f);_0x5f2283['state']=0x12;_0x5f2283['statedesc']='HangupInAMD';_0x5f2283[_0xc8e5('0xe1')]=_0xc8e5('0xf8');this[_0xc8e5('0xd8')](_0x5f2283,_0xc8e5('0xf9'),'[syncHangupInAMDIvr]');}if(_0x3f245c['type']===_0xc8e5('0x7a')&&this[_0xc8e5('0x22')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0xdd')]&&_0x58b76f['value']===_0xc8e5('0xe5')){var _0x582249=this;return new BPromise(function(_0xfaa75,_0x368744){delete _0x582249['uniqueId'][_0x58b76f[_0xc8e5('0xdf')]];_0x582249[_0xc8e5('0xb3')](_0x582249['campaigns'][_0x3f245c[_0xc8e5('0xb4')]]);_0x582249[_0xc8e5('0x22')][_0x3f245c[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;_0x582249[_0xc8e5('0x22')][_0x3f245c['queue']][_0xc8e5('0x5c')]+=0x1;var _0x35d6dd=_0x582249[_0xc8e5('0x22')][_0x3f245c[_0xc8e5('0xb4')]];var _0xb9a34d=new Hangup(_0x3f245c,_0x58b76f);_0xb9a34d['state']=0x13;_0xb9a34d[_0xc8e5('0xaa')]=_0xc8e5('0xe6');_0xb9a34d[_0xc8e5('0xe1')]=_0xc8e5('0xf8');_0xb9a34d[_0xc8e5('0xed')]+=0x1;_0xb9a34d[_0xc8e5('0xe7')]+=0x1;_0xb9a34d[_0xc8e5('0xfa')]=!![];_0x582249[_0xc8e5('0xcb')](_0xb9a34d)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xe8')));if(_0xb9a34d[_0xc8e5('0xe9')]+_0xb9a34d[_0xc8e5('0xfb')]+_0xb9a34d[_0xc8e5('0xea')]+_0xb9a34d[_0xc8e5('0xeb')]+_0xb9a34d['countdropretry']+_0xb9a34d['countabandonedretry']+_0xb9a34d['countmachineretry']+_0xb9a34d['countagentrejectretry']>=_0x35d6dd['dialGlobalMaxRetry']){_0x582249[_0xc8e5('0xf0')](_0xb9a34d,_0xfaa75,_0x368744,_0xc8e5('0xf1'));}else{if(_0xb9a34d['countmachineretry']>=_0x35d6dd[_0xc8e5('0xf2')]){_0x582249[_0xc8e5('0xf3')](_0xb9a34d,_0xfaa75,_0x368744,_0xc8e5('0xfc'));}else{_0x582249['rescheduleContact']({'active':![],'countmachineretry':_0xb9a34d['countmachineretry'],'scheduledat':moment()['add'](_0x35d6dd[_0xc8e5('0xfd')],_0xc8e5('0xf5'))[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xb9a34d[_0xc8e5('0xcf')],'ListId':_0xb9a34d[_0xc8e5('0xd0')],'VoiceQueueId':_0xb9a34d[_0xc8e5('0xd1')]||undefined,'CampaignId':_0xb9a34d[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch('[rescheduleContact][Machine]'));_0xfaa75({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xc8e5('0x36')]=function(_0xf03a78){var _0x3c84a4=this['uniqueId'][_0xf03a78[_0xc8e5('0xdf')]];var _0x3143d6=this;var _0x14d1b3;if(_0x3c84a4&&_0x3c84a4[_0xc8e5('0x55')]===_0xc8e5('0x7a')){delete this['uniqueId'][_0xf03a78['uniqueid']];this[_0xc8e5('0xb3')](this[_0xc8e5('0x22')][_0x3c84a4[_0xc8e5('0xb4')]]);this[_0xc8e5('0x22')][_0x3c84a4['queue']][_0xc8e5('0xfe')]+=0x1;_0x14d1b3=new Hangup(_0x3c84a4,_0xf03a78);this[_0xc8e5('0xcb')](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xff')));this[_0xc8e5('0xca')](_0x14d1b3)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x3c84a4&&_0x3c84a4[_0xc8e5('0x55')]!==_0xc8e5('0x7a')&&isNotNull(this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]]['dialQueueProject'])){delete this[_0xc8e5('0xac')][_0xf03a78[_0xc8e5('0xdf')]];this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]]);this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]][_0xc8e5('0x5c')]+=0x1;_0x14d1b3=new Hangup(_0x3c84a4,_0xf03a78);_0x14d1b3[_0xc8e5('0xa9')]=0x10;_0x14d1b3[_0xc8e5('0xaa')]=_0xc8e5('0x100');_0x14d1b3[_0xc8e5('0xe1')]=_0xc8e5('0x101');this[_0xc8e5('0xcb')](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xff')));this[_0xc8e5('0xca')](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x102')));}if(_0x3c84a4&&_0x3c84a4[_0xc8e5('0x55')]!=='ivr'&&!isNotNull(this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]][_0xc8e5('0x103')])){delete this['uniqueId'][_0xf03a78[_0xc8e5('0xdf')]];this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]]);this[_0xc8e5('0x21')][_0x3c84a4[_0xc8e5('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0x14d1b3=new Hangup(_0x3c84a4,_0xf03a78);_0x14d1b3[_0xc8e5('0xa9')]=0xc;_0x14d1b3[_0xc8e5('0xaa')]=_0xf03a78[_0xc8e5('0x104')];_0x14d1b3[_0xc8e5('0xe1')]=_0xc8e5('0x105');this['createHistory'](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xff')));this[_0xc8e5('0xca')](_0x14d1b3)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x102')));}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x33')]=function(_0xf53f83){var _0x370dcf=this['uniqueId'][_0xf53f83[_0xc8e5('0xdf')]];var _0x5eada8=this;if(this[_0xc8e5('0x21')][_0xf53f83[_0xc8e5('0xb4')]]){if(_0x370dcf&&_0x370dcf[_0xc8e5('0x55')]!==_0xc8e5('0x7a')){delete this['uniqueId'][_0xf53f83['uniqueid']];this[_0xc8e5('0x21')][_0xf53f83[_0xc8e5('0xb4')]][_0xc8e5('0x5d')]+=0x1;var _0x9c4c1f=new AgentComplete(_0x370dcf,_0xf53f83);if(_0xf53f83[_0xc8e5('0x106')]==='agent'){_0x9c4c1f['agiafterat']=this['voiceQueues'][_0xf53f83[_0xc8e5('0xb4')]]['dialQueueProject2']&&this[_0xc8e5('0x21')][_0xf53f83[_0xc8e5('0xb4')]][_0xc8e5('0x107')]?moment()[_0xc8e5('0x78')](_0xc8e5('0xf6')):undefined;}this['createHistory'](_0x9c4c1f)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x108')));this[_0xc8e5('0xca')](_0x9c4c1f)[_0xc8e5('0xba')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xc8e5('0x1b')]['syncAgentConnect']=function(_0x4269e1){if(this['voiceQueues'][_0x4269e1['queue']]){if(this[_0xc8e5('0xac')][_0x4269e1[_0xc8e5('0xdf')]]&&this[_0xc8e5('0xac')][_0x4269e1[_0xc8e5('0xdf')]]['type']!==_0xc8e5('0x7a')){this['updateOriginated'](this[_0xc8e5('0x21')][_0x4269e1[_0xc8e5('0xb4')]]);this[_0xc8e5('0xac')][_0x4269e1[_0xc8e5('0xdf')]][_0xc8e5('0x109')]=moment()['format'](_0xc8e5('0xf6'));}}};Dialer['prototype'][_0xc8e5('0x10a')]=function(_0x52bde1){this[_0xc8e5('0xcb')](_0x52bde1)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x108')));this['moveContactManagedDialer'](_0x52bde1)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x10b')));};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x30')]=function(_0x6b3ff7){var _0x5768c8=this[_0xc8e5('0xac')][_0x6b3ff7[_0xc8e5('0xdf')]];var _0x5dc830=this;if(this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]]){if(_0x5768c8&&_0x5768c8[_0xc8e5('0x55')]!==_0xc8e5('0x7a')){delete this[_0xc8e5('0xac')][_0x6b3ff7['uniqueid']];this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]]);_0x5768c8['droptime']=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));var _0x1aa1c8=new QueueCallerAbandon(_0x5768c8,_0x6b3ff7);if(getSeconds(_0x5768c8[_0xc8e5('0x10c')],_0x5768c8[_0xc8e5('0x10d')])>=_0x5768c8['dialQueueTimeout']){this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]][_0xc8e5('0x6b')]+=0x1;this['voiceQueues'][_0x6b3ff7[_0xc8e5('0xb4')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]][_0xc8e5('0x10e')]+=0x1;_0x1aa1c8['state']=0xa;_0x1aa1c8[_0xc8e5('0xaa')]=_0xc8e5('0x10f');_0x1aa1c8['dropreason']='TIMEOUT';_0x1aa1c8[_0xc8e5('0x110')]=this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]][_0xc8e5('0x111')]?moment()['format'](_0xc8e5('0xf6')):undefined;_0x1aa1c8[_0xc8e5('0xec')]+=0x1;_0x1aa1c8[_0xc8e5('0xe7')]+=0x1;if(_0x1aa1c8['countdropretry']>=this[_0xc8e5('0x21')][_0x6b3ff7['queue']]['dialDropMaxRetry']){this[_0xc8e5('0x10a')](_0x1aa1c8);}else{this[_0xc8e5('0xc1')]({'active':![],'countdropretry':_0x1aa1c8['countdropretry'],'scheduledat':moment()[_0xc8e5('0xf4')](this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]]['dialDropRetryFrequency'],_0xc8e5('0xf5'))[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5768c8[_0xc8e5('0xcf')],'ListId':_0x5768c8[_0xc8e5('0xd0')],'VoiceQueueId':_0x5768c8[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x5768c8[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x112')));var _0x3fc625=new History(_0x1aa1c8);_0x3fc625['state']=0xa;_0x3fc625[_0xc8e5('0xaa')]=_0xc8e5('0x10f');_0x3fc625['starttime']=moment()[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x3fc625['endtime']=_0x3fc625[_0xc8e5('0xab')];_0x3fc625[_0xc8e5('0x113')]=_0x1aa1c8[_0xc8e5('0x113')];_0x3fc625[_0xc8e5('0x114')]=_0x1aa1c8[_0xc8e5('0x114')];this[_0xc8e5('0xcb')](_0x3fc625)[_0xc8e5('0xba')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xc8e5('0x21')][_0x6b3ff7['queue']][_0xc8e5('0x6a')]+=0x1;this[_0xc8e5('0x21')][_0x6b3ff7[_0xc8e5('0xb4')]][_0xc8e5('0x115')]+=0x1;_0x1aa1c8['state']=0xb;_0x1aa1c8[_0xc8e5('0xaa')]=_0xc8e5('0x116');_0x1aa1c8[_0xc8e5('0x117')]=_0xc8e5('0x118');_0x1aa1c8['countabandonedretry']+=0x1;_0x1aa1c8['countglobal']+=0x1;if(_0x1aa1c8['countabandonedretry']>=this[_0xc8e5('0x21')][_0x6b3ff7['queue']][_0xc8e5('0x119')]){this['queueCallerAbandonCreateState'](_0x1aa1c8);}else{this[_0xc8e5('0xc1')]({'active':![],'countabandonedretry':_0x1aa1c8[_0xc8e5('0x11a')],'scheduledat':moment()[_0xc8e5('0xf4')](this[_0xc8e5('0x21')][_0x6b3ff7['queue']][_0xc8e5('0x11b')],_0xc8e5('0xf5'))[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5768c8[_0xc8e5('0xcf')],'ListId':_0x5768c8[_0xc8e5('0xd0')],'VoiceQueueId':_0x5768c8[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x5768c8[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x11c')));var _0x3fc625=new History(_0x1aa1c8);_0x3fc625['state']=0xb;_0x3fc625['statedesc']=_0xc8e5('0x116');_0x3fc625[_0xc8e5('0xab')]=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));_0x3fc625[_0xc8e5('0x11d')]=_0x3fc625[_0xc8e5('0xab')];_0x3fc625[_0xc8e5('0x113')]=_0x1aa1c8[_0xc8e5('0x113')];_0x3fc625[_0xc8e5('0x114')]=_0x1aa1c8['calleridnum'];this[_0xc8e5('0xcb')](_0x3fc625)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x11e')));}}}}};Dialer['prototype'][_0xc8e5('0x11f')]=function(_0xb45599){if(this['actions'][_0xb45599[_0xc8e5('0xdf')]]){this[_0xc8e5('0x27')][_0xb45599[_0xc8e5('0xdf')]][_0xc8e5('0x120')]=_0xb45599[_0xc8e5('0x120')];}if(this[_0xc8e5('0xac')][_0xb45599[_0xc8e5('0xdf')]]){this[_0xc8e5('0xac')][_0xb45599[_0xc8e5('0xdf')]][_0xc8e5('0x120')]=_0xb45599[_0xc8e5('0x120')];}};Dialer[_0xc8e5('0x1b')]['syncQueueMember']=function(_0xa477a3){if(strategy[this[_0xc8e5('0x21')][this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0xb4')]][_0xc8e5('0x4f')]]==='roundrobin'){if(this['actions'][_0xa477a3[_0xc8e5('0x121')]]&&_['isNil'](this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0x122')])&&_0xa477a3[_0xc8e5('0xb1')]==='1'&&_0xa477a3[_0xc8e5('0x123')]==='0'){if(this['agents'][_0xa477a3['stateinterface']]){if(!this['agents'][_0xa477a3['stateinterface']][_0xc8e5('0x122')]){this['agents'][_0xa477a3[_0xc8e5('0x124')]]['locked']=!![];this[_0xc8e5('0x27')][_0xa477a3[_0xc8e5('0x121')]]['locked']=!![];this['actions'][_0xa477a3[_0xc8e5('0x121')]]['stateinterface']=_0xa477a3[_0xc8e5('0x124')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]['strategy']]||'rrmemory')===_0xc8e5('0x19')){if(this[_0xc8e5('0x27')][_0xa477a3[_0xc8e5('0x121')]]){if(this['agents'][_0xa477a3[_0xc8e5('0x124')]]){this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0x124')]=_0xa477a3[_0xc8e5('0x124')];if(_[_0xc8e5('0xaf')](this[_0xc8e5('0x2c')][this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0xb4')]])){this['queueBooked'][this['actions'][_0xa477a3[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]=[];}this[_0xc8e5('0x2c')][this[_0xc8e5('0x27')][_0xa477a3[_0xc8e5('0x121')]]['queue']][_0xc8e5('0x125')](_['merge'](_[_0xc8e5('0xce')](this[_0xc8e5('0x27')][_0xa477a3[_0xc8e5('0x121')]],[_0xc8e5('0x126'),'stateinterface']),{'status':_0xa477a3['status'],'paused':_0xa477a3[_0xc8e5('0x123')]}));}}}};function unlockQueueStatus(_0x586e7b,_0x58107c){setTimeout(function(){if(_[_0xc8e5('0x3e')](_0x586e7b[_0xc8e5('0x127')])){loggerBooked[_0xc8e5('0x95')](_0xc8e5('0x128'),_0x58107c);}_0x586e7b[_0xc8e5('0x127')]=!![];loggerBooked[_0xc8e5('0x7d')](_0xc8e5('0x129'),_0x58107c,JSON[_0xc8e5('0x4b')](_[_0xc8e5('0xce')](_0x586e7b,[_0xc8e5('0x41'),_0xc8e5('0x127')])));},0x1f3);}Dialer[_0xc8e5('0x1b')][_0xc8e5('0x3c')]=function(_0x1c8eaf){var _0x212af0=this;var _0x1594aa=_0x212af0[_0xc8e5('0x21')][_0x212af0[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]];if(strategy[this['voiceQueues'][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]][_0xc8e5('0x4f')]]===_0xc8e5('0x1a')){if(this['actions'][_0x1c8eaf[_0xc8e5('0x121')]]&&this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0x124')]){this[_0xc8e5('0x20')][_0xc8e5('0x12a')](this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0x126')],this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0x124')])[_0xc8e5('0xba')](function(_0x16c1ee){logger[_0xc8e5('0x95')](_0xc8e5('0x12b'),util[_0xc8e5('0x9b')](_0x16c1ee,{'showHidden':![],'depth':null}));})[_0xc8e5('0x1e')](function(){_0x212af0[_0xc8e5('0xb3')](_0x212af0[_0xc8e5('0x21')][_0x212af0[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]);_0x212af0[_0xc8e5('0x23')][_0x212af0['actions'][_0x1c8eaf[_0xc8e5('0x121')]]['stateinterface']][_0xc8e5('0x122')]=![];delete _0x212af0[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]];unlockQueueStatus(_0x1594aa);});}else{this[_0xc8e5('0xb3')](this[_0xc8e5('0x21')][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]);this[_0xc8e5('0xc1')]({'active':![],'ContactId':this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]]['ContactId'],'ListId':this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0xd0')],'VoiceQueueId':this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xd1')]||undefined,'CampaignId':this['actions'][_0x1c8eaf['actionid']][_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]];unlockQueueStatus(_0x1594aa);}}else if((strategy[this[_0xc8e5('0x21')][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]['strategy']]||_0xc8e5('0x19'))===_0xc8e5('0x19')){var _0x3468d8;if(this[_0xc8e5('0x27')][_0x1c8eaf['actionid']]&&!_[_0xc8e5('0x48')](this[_0xc8e5('0x2c')][this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0xb4')]])){if(this[_0xc8e5('0x2d')][_0x212af0[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]){this[_0xc8e5('0x2d')][_0x212af0['actions'][_0x1c8eaf['actionid']][_0xc8e5('0xb4')]]=this[_0xc8e5('0x2d')][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]?this[_0xc8e5('0x2d')][this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0xb4')]]:this[_0xc8e5('0x2c')][this[_0xc8e5('0x27')][_0x1c8eaf[_0xc8e5('0x121')]]['queue']]?this['queueBooked'][this['actions'][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]][_0xc8e5('0x12c')]||0x0:0x0;}this[_0xc8e5('0x2c')][this['actions'][_0x1c8eaf[_0xc8e5('0x121')]][_0xc8e5('0xb4')]]['_rr']=this[_0xc8e5('0x2d')][this[_0xc8e5('0x27')][_0x1c8eaf['actionid']][_0xc8e5('0xb4')]];for(var _0x5b706d=0x0;_0x5b706d=0x0?!![]:![];})[_0xc8e5('0xba')](myreject(_0x4330f2)));}}else{_0x4e477e[_0xc8e5('0x125')](ami[_0xc8e5('0xb0')]({'action':'command','command':util[_0xc8e5('0x78')](_0xc8e5('0x147'),_0x55b6ef,!_[_0xc8e5('0x3e')](config[_0xc8e5('0x142')][_0x31e00d])?_0x31e00d:'')})[_0xc8e5('0xbd')](function(_0x5c6678){return _0x5c6678[_0xc8e5('0x148')][_0xc8e5('0x146')]('true')>=0x0?!![]:![];})[_0xc8e5('0xba')](myreject(_0x4330f2)));}BPromise[_0xc8e5('0x149')](_0x4e477e)[_0xc8e5('0xbd')](function(_0x3a0cda){var _0x5055b2=_[_0xc8e5('0x14a')](_0x3a0cda);if(_0x5055b2){return _0x3354cf(_0x5055b2);}else{_0x1bd3ac[_0xc8e5('0x3f')]=_0x3f2dd0?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x4330f2(msgResponse(_0xc8e5('0x14b'),'Failure',_0xc8e5('0x14c')+_0x3f2dd0+'\x20'+_0x5de835+_0xc8e5('0x14d')+util[_0xc8e5('0x9b')](_0x55b6ef,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x31e00d));}})[_0xc8e5('0xba')](function(_0x22ec80){return _0x4330f2(msgResponse(_0xc8e5('0x13d'),_0xc8e5('0x13e'),JSON[_0xc8e5('0x4b')](_0x22ec80)));});});};Dialer['prototype']['checkDialMethod']=function(_0x4f5459){var _0x2cbfef=this;return function(){switch(_0x4f5459['dialMethod']){case'progressive':freeVariablesPredictive(_0x4f5459);_0x2cbfef[_0xc8e5('0x14e')](_0x4f5459,0x1);break;case _0xc8e5('0x14f'):freeVariablesPredictive(_0x4f5459);_0x2cbfef[_0xc8e5('0x14e')](_0x4f5459,_0x4f5459[_0xc8e5('0x150')]);break;case'predictive':_0x2cbfef['predictive'](_0x4f5459);break;case _0xc8e5('0x151'):freeVariablesPredictive(_0x4f5459);_0x2cbfef[_0xc8e5('0x14e')](_0x4f5459,0x1);break;default:freeVariablesPredictive(_0x4f5459);logger['error'](_0xc8e5('0x152'),_0x4f5459[_0xc8e5('0x41')],_0xc8e5('0x153'));}};};Dialer[_0xc8e5('0x1b')]['launchHandleIvr']=function(_0x14cf40){var _0x4ef13e=this;return function(){_0x4ef13e[_0xc8e5('0x154')](_0x14cf40);};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xc')]=function(_0x2b32da){var _0x2520f5=this;if(isNotPreview(_0x2b32da['dialMethod'])){if(isVoiceQueueOutbound(_0x2b32da[_0xc8e5('0x55')])&&isActive(_0x2b32da[_0xc8e5('0x58')])){_0x2b32da['sendMessageOneNotActive']=!![];BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](checkIsLoggedIn(_0x2b32da,_0x2b32da[_0xc8e5('0x52')]))[_0xc8e5('0xbd')](checkIsActive(_0x2b32da,_0x2b32da['dialActive']))[_0xc8e5('0xbd')](checkInterval(_0x2b32da))['then'](_0x2520f5[_0xc8e5('0x138')](_0x2b32da))[_0xc8e5('0xbd')](_0x2520f5['checkIfTime'](_0x2b32da[_0xc8e5('0x155')],_0x2b32da[_0xc8e5('0x156')],_0x2b32da['name'],_0x2b32da))[_0xc8e5('0xbd')](_0x2520f5['checkIfTimeIntervals'](_0x2b32da[_0xc8e5('0x44')],_0x2b32da['dialTimezone'],_0x2b32da['name'],_0x2b32da))[_0xc8e5('0xbd')](_0x2520f5[_0xc8e5('0x157')](_0x2b32da))['catch'](loggerCatchQueueSummary(_0xc8e5('0x158'),_0x2b32da));}else{notSendMessagesQueue(_0x2b32da);}}else{freeVariablesPredictive(_0x2b32da);}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x137')]=function(){var _0x39ab45=this;var _0x486cd2;for(var _0x535e49 in this['campaigns']){if(this[_0xc8e5('0x22')][_0xc8e5('0x98')](_0x535e49)){_0x486cd2=this['campaigns'][_0x535e49];if(isCampaignIvr(_0x486cd2[_0xc8e5('0x55')])&&isActive(_0x486cd2['active'])){_0x486cd2[_0xc8e5('0xa0')]=!![];BPromise[_0xc8e5('0xb7')]()[_0xc8e5('0xbd')](checkIsActive(_0x486cd2,_0x486cd2[_0xc8e5('0x76')]))[_0xc8e5('0xbd')](checkInterval(_0x486cd2))[_0xc8e5('0xbd')](_0x39ab45[_0xc8e5('0x138')](_0x486cd2))[_0xc8e5('0xbd')](_0x39ab45[_0xc8e5('0x159')](_0x486cd2['dialGlobalInterval'],_0x486cd2[_0xc8e5('0x156')],_0x486cd2['name'],_0x486cd2))[_0xc8e5('0xbd')](_0x39ab45[_0xc8e5('0x13c')](_0x486cd2[_0xc8e5('0x44')],_0x486cd2[_0xc8e5('0x156')],_0x486cd2['name'],_0x486cd2))[_0xc8e5('0xbd')](_0x39ab45[_0xc8e5('0x15a')](_0x486cd2))['catch'](loggerCatchQueueSummary(_0xc8e5('0x15b'),_0x486cd2));}else{notSendMessagesCampaign(_0x486cd2);}}}};function getCallerIdRandom(_0xaacf69,_0x24c884){var _0x166129,_0x158233,_0x1d2c43;if(_0x24c884<=0x0){_0x24c884=0x1;}_0x166129=new RegExp('\x5cw{0,'+_0x24c884+'}$');_0x158233=Math[_0xc8e5('0x15c')](0xa,_0x24c884-0x1);_0x1d2c43=Math[_0xc8e5('0x15c')](0xa,_0x24c884)-0x1;return util[_0xc8e5('0x78')]('%s',_[_0xc8e5('0x15d')](_0xaacf69,_0x166129,_[_0xc8e5('0x15e')](_0x158233,_0x1d2c43)));}function extractCalleridName(_0x580f98){var _0x197883=_0x580f98[_0xc8e5('0x15f')](/"(.*?)"/);return _0x197883?_0x197883[0x1]:_0x580f98;}function extractCalleridNumber(_0x4da194){var _0x36a85c=_0x4da194['match'](/<(.*?)>/);return _0x36a85c?_0x36a85c[0x1]:_0x4da194;}Dialer['prototype'][_0xc8e5('0x160')]=function(_0x583b8b,_0x51ff75){var _0x2d2166=this;var _0x31eaeb=uuid['v4']();this[_0xc8e5('0x27')][_0x31eaeb]=new Action(_0x583b8b,_0x51ff75,_0x31eaeb);return new BPromise(function(_0xfa4311,_0x121b06){if(_['isUndefined'](_0x583b8b)&&'object'!==typeof _0x583b8b){return _0x121b06(msgResponse(_0xc8e5('0x161'),_0xc8e5('0x13e'),_0xc8e5('0x162')));}if(_[_0xc8e5('0x3e')](_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')])||_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')]===null){return _0x121b06(msgResponse('originate',_0xc8e5('0x13e'),'contact\x20is\x20undefine'));}var _0x2f4368={'XMD-CALLERID':_0x2d2166['actions'][_0x31eaeb][_0xc8e5('0x165')](),'XMD-AGI':_0x583b8b[_0xc8e5('0x103')]?util[_0xc8e5('0x78')](_0xc8e5('0x166'),ipAgi,_0x583b8b[_0xc8e5('0x103')]):_0xc8e5('0x167'),'XMD-AGIAFTER':_0x583b8b[_0xc8e5('0x111')]?util[_0xc8e5('0x78')](_0xc8e5('0x166'),ipAgi,_0x583b8b[_0xc8e5('0x111')]):'NONE','XMD-QUEUE':_0x583b8b[_0xc8e5('0x55')]===_0xc8e5('0x4e')?util['format'](_0xc8e5('0x168'),_0x583b8b[_0xc8e5('0x41')],_0x583b8b['dialQueueOptions']||'',_0x583b8b[_0xc8e5('0x107')]?'c':'',_0x583b8b[_0xc8e5('0x169')]||0x3):_0xc8e5('0x167'),'XMD-CONTACTID':_0x51ff75['ContactId'],'XMD-CDRTYPE':_0xc8e5('0x9'),'CALLERID(all)':_0x2d2166[_0xc8e5('0x27')][_0x31eaeb][_0xc8e5('0x165')](),'XMD-AMD':_0x583b8b[_0xc8e5('0xdd')]?_0xc8e5('0x16a'):_0xc8e5('0x167'),'XMD-DESTINATION':_0xc8e5('0xdc')};if(_0x583b8b[_0xc8e5('0xdd')]){_0x2f4368[_0xc8e5('0x16b')]=_0x583b8b[_0xc8e5('0x16c')]||0x9c4;_0x2f4368[_0xc8e5('0x16d')]=_0x583b8b[_0xc8e5('0x16e')]||0x5dc;_0x2f4368['XMD-AMDAFTERGREETINGSILENCE']=_0x583b8b[_0xc8e5('0x16f')]||0x320;_0x2f4368[_0xc8e5('0x170')]=_0x583b8b[_0xc8e5('0x171')]||0x1388;_0x2f4368['XMD-AMDMINWORDLENGTH']=_0x583b8b['dialAMDMinWordLength']||0x64;_0x2f4368[_0xc8e5('0x172')]=_0x583b8b[_0xc8e5('0x173')]||0x32;_0x2f4368[_0xc8e5('0x174')]=_0x583b8b[_0xc8e5('0x175')]||0x3;_0x2f4368[_0xc8e5('0x176')]=_0x583b8b[_0xc8e5('0x177')]||0x100;_0x2f4368['XMD-AMDMAXIMUMWORDLENGTH']=_0x583b8b[_0xc8e5('0x178')]||0x1388;}if(_0x583b8b[_0xc8e5('0x55')]===_0xc8e5('0x4e')){_0x2f4368[_0xc8e5('0x179')]=_0x51ff75[_0xc8e5('0xd1')];}else{_0x2f4368[_0xc8e5('0x17a')]=_0x51ff75['CampaignId'];}for(var _0x2dfbf7 in _0x51ff75[_0xc8e5('0x163')]){if(_0x51ff75['Contact'][_0xc8e5('0x98')](_0x2dfbf7)){if(isNotNull(_0x51ff75[_0xc8e5('0x163')][_0x2dfbf7])&&_0x2dfbf7!=='id'&&_0x2dfbf7!=='tags'&&_0x2dfbf7!==_0xc8e5('0x17b')&&_0x2dfbf7!=='updatedAt'){_0x2f4368[util[_0xc8e5('0x78')](_0xc8e5('0x17c'),_0xc8e5('0x17d'),_[_0xc8e5('0x17e')](_0x2dfbf7))]=_0x51ff75[_0xc8e5('0x163')][_0x2dfbf7];}}}var _0x53d661=_0x2d2166[_0xc8e5('0x139')](_0x583b8b['Trunk'])?getCallerId(_0x583b8b['Trunk'][_0xc8e5('0x77')],_0x583b8b[_0xc8e5('0x59')],_0x583b8b[_0xc8e5('0x17f')]>0x0?getCallerIdRandom(_0x583b8b['dialOriginateCallerIdNumber'],_0x583b8b[_0xc8e5('0x17f')]):_0x583b8b[_0xc8e5('0x180')]):getCallerId(_[_0xc8e5('0xaf')](_0x583b8b[_0xc8e5('0x13a')])?_0x583b8b[_0xc8e5('0x75')]['callerid']:_0x583b8b[_0xc8e5('0x13a')]['callerid'],_0x583b8b[_0xc8e5('0x59')],_0x583b8b[_0xc8e5('0x17f')]>0x0?getCallerIdRandom(_0x583b8b[_0xc8e5('0x180')],_0x583b8b['dialRandomLastDigitCallerIdNumber']):_0x583b8b[_0xc8e5('0x180')]);if(_0x53d661){_0x2f4368['XMD-ORIGINATECALLERIDNAME']=_0x2d2166[_0xc8e5('0x27')][_0x31eaeb]['originatecalleridname']=extractCalleridName(_0x53d661);_0x2f4368[_0xc8e5('0x181')]=_0x2d2166[_0xc8e5('0x27')][_0x31eaeb][_0xc8e5('0x182')]=extractCalleridNumber(_0x53d661);}return ami['Action']({'actionid':_0x31eaeb,'action':_0xc8e5('0x161'),'channel':_0x2d2166['isTrunkReachable'](_0x583b8b[_0xc8e5('0x75')])?util[_0xc8e5('0x78')](_0xc8e5('0x183'),_0x583b8b['Trunk'][_0xc8e5('0x41')],isNotNull(_0x583b8b[_0xc8e5('0x5b')])?_0x583b8b['dialPrefix']['trim']()||'':'',_0x583b8b[_0xc8e5('0x184')]>0x0?_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')][_0xc8e5('0x185')](_0x583b8b[_0xc8e5('0x184')]):_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')]):util[_0xc8e5('0x78')](_0xc8e5('0x183'),_[_0xc8e5('0xaf')](_0x583b8b[_0xc8e5('0x13a')])?_0x583b8b['Trunk'][_0xc8e5('0x41')]:_0x583b8b['TrunkBackup'][_0xc8e5('0x41')],isNotNull(_0x583b8b[_0xc8e5('0x5b')])?_0x583b8b[_0xc8e5('0x5b')][_0xc8e5('0x186')]()||'':'',_0x583b8b['dialCutDigit']>0x0?_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')][_0xc8e5('0x185')](_0x583b8b[_0xc8e5('0x184')]):_0x51ff75[_0xc8e5('0x163')][_0xc8e5('0x164')]),'callerid':_0x53d661,'Exten':_0xc8e5('0xdc'),'Context':_0xc8e5('0x187'),'Priority':'1','variable':_0x2f4368,'timeout':(_0x583b8b[_0xc8e5('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x31eaeb})[_0xc8e5('0xbd')](function(_0x4a0ea0){return _0xfa4311(_0x4a0ea0);})[_0xc8e5('0xba')](function(_0x4fc2d5){_0x583b8b[_0xc8e5('0x64')]+=0x1;var _0x223545=new History(_0x2d2166[_0xc8e5('0x27')][_0x31eaeb]);logger[_0xc8e5('0x95')](util[_0xc8e5('0x78')](_0xc8e5('0x188'),JSON[_0xc8e5('0x4b')](_0x4fc2d5)));_0x223545['state']=0xe;_0x223545[_0xc8e5('0xaa')]=_0xc8e5('0x189');_0x223545[_0xc8e5('0xab')]=moment()['format'](_0xc8e5('0xf6'));_0x223545[_0xc8e5('0x11d')]=_0x223545[_0xc8e5('0xab')];_0x2d2166[_0xc8e5('0xcb')](_0x223545)[_0xc8e5('0xba')](loggerCatch('[originate][error]'));_0x2d2166[_0xc8e5('0xca')](_0x223545)['catch'](loggerCatch(_0xc8e5('0x18a')))[_0xc8e5('0x1e')](function(){delete _0x2d2166[_0xc8e5('0x27')][_0x31eaeb];return _0x121b06(msgResponse(_0xc8e5('0x161'),_0xc8e5('0x4a'),_0xc8e5('0x18b')));});});});};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x32')]=function(_0x5aa4f1){var _0x9a522a=this[_0xc8e5('0x27')][_0x5aa4f1[_0xc8e5('0x121')]];var _0x27af21=this;if(_0x9a522a){delete this['actions'][_0x5aa4f1[_0xc8e5('0x121')]];_0x9a522a[_0xc8e5('0x10d')]=moment()['format'](_0xc8e5('0xf6'));var _0x489e43=_0x9a522a[_0xc8e5('0x55')]===_0xc8e5('0x7a')?this[_0xc8e5('0x22')][_0x9a522a[_0xc8e5('0xb4')]]:this[_0xc8e5('0x21')][_0x9a522a['getQueue']()];if(!this[_0xc8e5('0x18c')](_0x5aa4f1[_0xc8e5('0x18d')])){this[_0xc8e5('0xb3')](_0x489e43);return this[_0xc8e5('0x18e')](_0x9a522a,_0x489e43,_0x5aa4f1)[_0xc8e5('0xbd')](function(_0x5c8454){})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x18f')));}else{this[_0xc8e5('0xac')][_0x5aa4f1[_0xc8e5('0xdf')]]=_0x9a522a;}}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x190')]=function(_0x4fbf92,_0x35649c,_0x4b3f40){var _0x271c4f=new History(_0x35649c);if(_0x271c4f[_0xc8e5('0xe9')]+_0x271c4f[_0xc8e5('0xfb')]+_0x271c4f[_0xc8e5('0xea')]+_0x271c4f['countnosuchnumberretry']+_0x271c4f[_0xc8e5('0xec')]+_0x271c4f[_0xc8e5('0x11a')]+_0x271c4f[_0xc8e5('0xed')]+_0x271c4f['countagentrejectretry']>=_0x4b3f40['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4fbf92){case 0x3:if(_0x271c4f['countnoanswerretry']>=_0x4b3f40[_0xc8e5('0x191')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x271c4f['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0x192')],'minutes')['format'](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x193')));}break;case 0x5:if(_0x271c4f[_0xc8e5('0xe9')]>=_0x4b3f40[_0xc8e5('0x194')]-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countbusyretry':_0x271c4f[_0xc8e5('0xe9')]+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0x195')],'minutes')['format'](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f['ListId'],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f['CampaignId']||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x196')));}break;case 0x8:if(_0x271c4f[_0xc8e5('0xfb')]>=_0x4b3f40[_0xc8e5('0x197')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x271c4f[_0xc8e5('0xfb')]+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40['dialCongestionRetryFrequency'],_0xc8e5('0xf5'))[_0xc8e5('0x78')](_0xc8e5('0xf6')),'ContactId':_0x271c4f['ContactId'],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f['VoiceQueueId']||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})['catch'](loggerCatch(_0xc8e5('0x198')));}break;case 0x0:if(_0x271c4f[_0xc8e5('0xeb')]>=_0x4b3f40[_0xc8e5('0x199')]-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countnosuchnumberretry':_0x271c4f[_0xc8e5('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x4b3f40[_0xc8e5('0x19a')],_0xc8e5('0xf5'))[_0xc8e5('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f['CampaignId']||undefined})['catch'](loggerCatch(_0xc8e5('0x19b')));}break;case 0xa:if(_0x271c4f[_0xc8e5('0xec')]>=_0x4b3f40['dialDropMaxRetry']-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countdropretry':_0x271c4f[_0xc8e5('0xec')]+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0x19c')],'minutes')['format'](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x112')));}break;case 0xb:if(_0x271c4f[_0xc8e5('0x11a')]>=_0x4b3f40[_0xc8e5('0x119')]-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countabandonedretry':_0x271c4f[_0xc8e5('0x11a')]+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0x11b')],_0xc8e5('0xf5'))[_0xc8e5('0x78')](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f['CampaignId']||undefined})['catch'](loggerCatch(_0xc8e5('0x11c')));}break;case 0x13:if(_0x271c4f['countmachineretry']>=_0x4b3f40['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countmachineretry':_0x271c4f['countmachineretry']+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40[_0xc8e5('0xfd')],_0xc8e5('0xf5'))[_0xc8e5('0x78')](_0xc8e5('0xf6')),'ContactId':_0x271c4f['ContactId'],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})['catch'](loggerCatch(_0xc8e5('0xf7')));}break;case 0x14:if(_0x271c4f[_0xc8e5('0xee')]>=_0x4b3f40[_0xc8e5('0x19d')]-0x1){return!![];}else{this[_0xc8e5('0xc1')]({'active':![],'countagentrejectretry':_0x271c4f['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xc8e5('0xf4')](_0x4b3f40['dialAgentRejectRetryFrequency'],'minutes')[_0xc8e5('0x78')](_0xc8e5('0xf6')),'ContactId':_0x271c4f[_0xc8e5('0xcf')],'ListId':_0x271c4f[_0xc8e5('0xd0')],'VoiceQueueId':_0x271c4f[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x271c4f[_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x19e')));}break;default:return!![];}};Dialer[_0xc8e5('0x1b')]['callProgressDetecting']=function(_0x19dd7d,_0x767ddd,_0x56fbef){var _0x2c01e1=this;var _0x37b05d=new History(_0x19dd7d);return new BPromise(function(_0x3f235b,_0x206d96){if(_[_0xc8e5('0x3e')](_0x767ddd)&&'object'!==typeof _0x767ddd){return _0x206d96(msgResponse('[callProgressDetecting]',_0xc8e5('0x13e'),_0xc8e5('0x19f')));}if(_[_0xc8e5('0x3e')](_0x56fbef)&&_0xc8e5('0x1a0')!==typeof _0x56fbef){return _0x206d96(msgResponse(_0xc8e5('0x1a1'),_0xc8e5('0x13e'),_0xc8e5('0x1a2')));}switch(_0x56fbef[_0xc8e5('0x106')]){case'0':_0x767ddd['outboundNoSuchCallsDay']+=0x1;_0x37b05d['state']=0x0;_0x37b05d[_0xc8e5('0xaa')]='NoSuchNumber';_0x37b05d['countnosuchnumberretry']+=0x1;_0x37b05d[_0xc8e5('0xe7')]+=0x1;ami[_0xc8e5('0x1a3')]('custom:agentnosuchnumber',ut['buildObj'](_0x19dd7d,_0xc8e5('0x1a4')));_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)['catch'](loggerCatch(_0xc8e5('0xe8')));if(_0x2c01e1[_0xc8e5('0x190')](0x0,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xeb')]>=_0x767ddd[_0xc8e5('0x199')]){_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1a5'));}else{_0x2c01e1[_0xc8e5('0xf0')](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1a5'));}}break;case'3':_0x767ddd[_0xc8e5('0x1a6')]+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0x3;_0x37b05d['statedesc']=_0xc8e5('0x1a7');_0x37b05d[_0xc8e5('0xea')]+=0x1;_0x37b05d[_0xc8e5('0xe7')]+=0x1;ami[_0xc8e5('0x1a3')](_0xc8e5('0x1a8'),ut[_0xc8e5('0x1a9')](_0x19dd7d,_0xc8e5('0x1aa')));_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)[_0xc8e5('0xba')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2c01e1[_0xc8e5('0x190')](0x3,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xea')]>=_0x767ddd[_0xc8e5('0x191')]){_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1ab'));}}break;case'5':_0x767ddd['outboundBusyCallsDay']+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0x5;_0x37b05d[_0xc8e5('0xaa')]=_0xc8e5('0x1ac');_0x37b05d['countbusyretry']+=0x1;_0x37b05d['countglobal']+=0x1;ami[_0xc8e5('0x1a3')](_0xc8e5('0x1ad'),ut[_0xc8e5('0x1a9')](_0x19dd7d,_0xc8e5('0x1ae')));_0x2c01e1['createHistory'](_0x37b05d)['catch'](loggerCatch(_0xc8e5('0x1af')));if(_0x2c01e1[_0xc8e5('0x190')](0x5,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xe9')]>=_0x767ddd[_0xc8e5('0x194')]){_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b0'));}else{_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b0'));}}break;case'8':_0x767ddd[_0xc8e5('0x60')]+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0x8;_0x37b05d[_0xc8e5('0xaa')]=_0xc8e5('0x1b1');_0x37b05d[_0xc8e5('0xfb')]+=0x1;_0x37b05d['countglobal']+=0x1;ami[_0xc8e5('0x1a3')](_0xc8e5('0x1b2'),ut[_0xc8e5('0x1a9')](_0x19dd7d,'congestion'));_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1b3')));if(_0x2c01e1[_0xc8e5('0x190')](0x8,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xfb')]>=_0x767ddd[_0xc8e5('0x197')]){_0x2c01e1['createStateFinal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b4'));}else{_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b4'));}}break;case'11':_0x767ddd[_0xc8e5('0x1b5')]+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0xb;_0x37b05d[_0xc8e5('0xaa')]='Abandoned';_0x37b05d[_0xc8e5('0x11a')]+=0x1;_0x37b05d[_0xc8e5('0xe7')]+=0x1;_0x2c01e1['createHistory'](_0x37b05d)['catch'](loggerCatch(_0xc8e5('0x11e')));if(_0x2c01e1[_0xc8e5('0x190')](0xb,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0x11a')]>=_0x767ddd[_0xc8e5('0x119')]){_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1b6'));}else{_0x2c01e1[_0xc8e5('0xf0')](_0x37b05d,_0x3f235b,_0x206d96,'reason\x2011\x20abandoned');}}break;case'20':_0x767ddd[_0xc8e5('0x1b7')]+=0x1;_0x37b05d['state']=0x14;_0x37b05d[_0xc8e5('0xaa')]=_0xc8e5('0x1b8');_0x37b05d['countagentrejectretry']+=0x1;_0x37b05d[_0xc8e5('0xe7')]+=0x1;ami['emit']('custom:agentreject',ut[_0xc8e5('0x1a9')](_0x19dd7d,_0xc8e5('0x1b9')));_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1ba')));if(_0x2c01e1[_0xc8e5('0x190')](0x14,_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xee')]>=_0x767ddd[_0xc8e5('0x19d')]){_0x2c01e1['createStateFinal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1bb'));}else{_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0xc8e5('0x1bb'));}}break;default:_0x767ddd[_0xc8e5('0x66')]+=0x1;_0x37b05d[_0xc8e5('0xa9')]=0xc;_0x37b05d[_0xc8e5('0xaa')]=_0x56fbef['reason'];_0x2c01e1[_0xc8e5('0xcb')](_0x37b05d)[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1bc')));if(_0x2c01e1[_0xc8e5('0x190')](_0x56fbef['reason'],_0x19dd7d,_0x767ddd)){if(_0x37b05d[_0xc8e5('0xe9')]+_0x37b05d[_0xc8e5('0xfb')]+_0x37b05d[_0xc8e5('0xea')]+_0x37b05d[_0xc8e5('0xeb')]+_0x37b05d[_0xc8e5('0xec')]+_0x37b05d[_0xc8e5('0x11a')]+_0x37b05d[_0xc8e5('0xed')]+_0x37b05d['countagentrejectretry']>=_0x767ddd[_0xc8e5('0xef')]){_0x2c01e1['stateGlobal'](_0x37b05d,_0x3f235b,_0x206d96,_0x56fbef['reason']);}else{_0x2c01e1[_0xc8e5('0xf3')](_0x37b05d,_0x3f235b,_0x206d96,_0x56fbef[_0xc8e5('0x106')]);}}}});};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xf0')]=function(_0x3d7a1e,_0x369885,_0x2a53f8,_0x17a325){var _0x5b06b2=new Final(_0x3d7a1e);_0x5b06b2[_0xc8e5('0xa9')]=0xf;_0x5b06b2[_0xc8e5('0xaa')]=_0xc8e5('0x1bd');this[_0xc8e5('0xf3')](_0x5b06b2,_0x369885,_0x2a53f8,_0x17a325);};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xf3')]=function(_0x18057f,_0x1ab3b4,_0x5e1084,_0x3b85e8){this[_0xc8e5('0xca')](_0x18057f)[_0xc8e5('0xbd')](function(_0x5217d7){return _0x1ab3b4(msgResponse(_0xc8e5('0x1a1'),_0xc8e5('0x1be'),_0x3b85e8));})['catch'](function(_0x4e295a){return _0x5e1084(msgResponse('[moveContactManagedDialer][0]',_0xc8e5('0x13e'),_0xc8e5('0x1bf')));});};Dialer[_0xc8e5('0x1b')][_0xc8e5('0xa')]=function(_0x51e1af){var _0x3c2da5=this;var _0x23e0e1=_0x51e1af[_0xc8e5('0x1c0')]/0x64;var _0x6edaa7=_0x51e1af['outboundDropCallsDayTimeout']/(_0x51e1af[_0xc8e5('0x62')]+_0x51e1af[_0xc8e5('0x5d')]);var _0x41cfb7=Math[_0xc8e5('0x1c1')](_0x51e1af[_0xc8e5('0x1c2')]*(_0x51e1af[_0xc8e5('0x1c3')]/0x64));var _0x2d9c8e=Math['round'](_0x51e1af[_0xc8e5('0x1c2')]*(_0x51e1af[_0xc8e5('0x1c4')]/0x64));var _0x4e6751=_0x51e1af[_0xc8e5('0x51')]+_0x51e1af[_0xc8e5('0x54')];var _0x285afa=Math[_0xc8e5('0x1c5')](_0x51e1af['erlangCalls']*_0x51e1af[_0xc8e5('0x73')]*_0x51e1af[_0xc8e5('0x6d')]*_0x51e1af[_0xc8e5('0x6e')]);if(_[_0xc8e5('0x3e')](_0x51e1af[_0xc8e5('0x74')])){if(!_[_0xc8e5('0x3e')](_0x51e1af[_0xc8e5('0x2a')])){_0x51e1af[_0xc8e5('0x2a')]=undefined;loggerPredictive[_0xc8e5('0x95')](_0xc8e5('0x1c6'),_0xc8e5('0x1c7'));}if(!_['isUndefined'](_0x51e1af[_0xc8e5('0x90')])){loggerPredictive[_0xc8e5('0x95')](_0xc8e5('0x1c6'),_0xc8e5('0x1c8'));clearInterval(_0x51e1af[_0xc8e5('0x90')]);_0x51e1af[_0xc8e5('0x90')]=undefined;}_0x51e1af[_0xc8e5('0x74')]=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));loggerPredictive[_0xc8e5('0x7d')](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1c9'),_0x51e1af['startProgressive']);this[_0xc8e5('0x14e')](_0x51e1af,0x1);}else if(ifInterval(_0x51e1af[_0xc8e5('0x1ca')],_0x51e1af['startProgressive'])){this['handlePower'](_0x51e1af,0x1);loggerPredictiveCalls[_0xc8e5('0x7d')](_0xc8e5('0x1cb'),_0x51e1af['startProgressive'],_0x51e1af[_0xc8e5('0x41')]);_0x51e1af[_0xc8e5('0x71')]=0x0;_0x51e1af['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x23e0e1<_0x6edaa7&&_0x51e1af['dialPredictiveOptimization']===_0xc8e5('0x1cc')){freeVariablesPredictive(_0x51e1af);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x1cd'),_0xc8e5('0x1ce'),_0x6edaa7,_0xc8e5('0x74'),_0x51e1af[_0xc8e5('0x41')]);}else if(_0x285afa<_0x51e1af[_0xc8e5('0x10e')]&&_0x51e1af[_0xc8e5('0x1cf')]===_0xc8e5('0x1cc')){freeVariablesPredictive(_0x51e1af);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x1d0'),_0xc8e5('0x1d1'),_0x285afa,_0xc8e5('0x1d2'),_0x51e1af['predictiveIntervalErlangCallsDroppedCalls'],_0xc8e5('0x74'),_0x51e1af[_0xc8e5('0x41')]);}else if(!ifInterval(_0x51e1af[_0xc8e5('0x1ca')],_0x51e1af[_0xc8e5('0x74')])&&_[_0xc8e5('0x3e')](_0x51e1af['startPredictive'])&&!_[_0xc8e5('0x3e')](_0x51e1af[_0xc8e5('0x74')])){_0x51e1af[_0xc8e5('0x2a')]=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));loggerPredictive[_0xc8e5('0x7d')](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1d3'),_0x51e1af[_0xc8e5('0x2a')]);this[_0xc8e5('0x1d4')](_0x51e1af[_0xc8e5('0x1ca')])[_0xc8e5('0xbd')](this[_0xc8e5('0x1d5')](_0x51e1af))[_0xc8e5('0xbd')](mergeDataErlangB(_0x51e1af))[_0xc8e5('0xbd')](this['startMethodPredictive'](_0x51e1af))[_0xc8e5('0xba')](loggerCatchPredictive(_0xc8e5('0x1d6'),_0x51e1af));}else if(!ifInterval(_0x51e1af[_0xc8e5('0x1ca')],_0x51e1af[_0xc8e5('0x2a')])){_0x51e1af[_0xc8e5('0x10e')]=0x0;_0x51e1af[_0xc8e5('0x2a')]=moment()[_0xc8e5('0x78')](_0xc8e5('0xf6'));loggerPredictive[_0xc8e5('0x7d')](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1d7'),_0x51e1af[_0xc8e5('0x2a')]);clearInterval(_0x51e1af['handlePredictive']);_0x51e1af[_0xc8e5('0x90')]=undefined;this[_0xc8e5('0x1d4')](_0x51e1af[_0xc8e5('0x1ca')])[_0xc8e5('0xbd')](this[_0xc8e5('0x1d5')](_0x51e1af))[_0xc8e5('0xbd')](mergeDataErlangB(_0x51e1af))[_0xc8e5('0xbd')](this['startMethodPredictive'](_0x51e1af))[_0xc8e5('0xba')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x51e1af));}else if(_0x51e1af[_0xc8e5('0x1c2')]&&_0x4e6751<_0x51e1af[_0xc8e5('0x1c2')]-_0x2d9c8e){freeVariablesPredictive(_0x51e1af);loggerPredictive[_0xc8e5('0x7d')](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1d8'),_0x4e6751,_0xc8e5('0x1d9'),_0x51e1af[_0xc8e5('0x1c2')],'-',_0x2d9c8e,'=',_0x51e1af['predictiveIntervalAvailable']-_0x2d9c8e,')');}else if(_0x51e1af['predictiveIntervalAvailable']&&_0x4e6751>_0x51e1af[_0xc8e5('0x1c2')]+_0x41cfb7){freeVariablesPredictive(_0x51e1af);loggerPredictive['info'](_0x51e1af[_0xc8e5('0x41')],_0xc8e5('0x1d8'),_0x4e6751,_0xc8e5('0x1da'),_0x51e1af[_0xc8e5('0x1c2')],'+',_0x41cfb7,'=',_0x51e1af[_0xc8e5('0x1c2')]+_0x41cfb7,')');}};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1d5')]=function(_0x48e85d){var _0x1f8618=this;return function(_0x1bdb99){return new BPromise(function(_0x22d3c0,_0x47365d){_[_0xc8e5('0x8c')](_0x48e85d,_0x1bdb99[0x0]);if(checkGetDataPredictive(_0x1bdb99[0x0])){var _0x28f264=_0x48e85d[_0xc8e5('0x1c2')]=_0x48e85d[_0xc8e5('0x54')]+_0x48e85d[_0xc8e5('0x51')];var _0x3c9099=_0x48e85d['dialPredictiveInterval']*0x3c;var _0x29fb28=_0x1bdb99[0x0][_0xc8e5('0x69')]+_0x1bdb99[0x0][_0xc8e5('0x68')];var _0x186bef=(_0x1bdb99[0x0][_0xc8e5('0x67')]+_0x1bdb99[0x0][_0xc8e5('0x6b')]+_0x1bdb99[0x0][_0xc8e5('0x6a')])/_0x1bdb99[0x0]['predictiveIntervalTotalCalls'];_0x48e85d[_0xc8e5('0x6d')]=_0x186bef>0x0?_0x186bef:0x1;switch(_0x48e85d[_0xc8e5('0x1cf')]){case _0xc8e5('0x1cc'):var _0x2141b0=_0x48e85d[_0xc8e5('0x1c0')]/0x64;return _0x1f8618[_0xc8e5('0x1db')](_0x28f264,_0x3c9099,_0x29fb28,_0x186bef,_0x2141b0)[_0xc8e5('0xbd')](function(_0x3c1601){return _0x22d3c0(_0x3c1601);});case _0xc8e5('0x1dc'):var _0x23a4a3=_0x48e85d[_0xc8e5('0x1c0')]/0x64;return _0x1f8618[_0xc8e5('0x1dd')](_0x28f264,_0x3c9099,_0x29fb28,_0x186bef,_0x23a4a3)['then'](function(_0x10965b){return _0x22d3c0(_0x10965b);});default:return _0x47365d(msgResponse(_0xc8e5('0x1de'),'Failure',_0xc8e5('0x1df')));}}else{return _0x47365d(msgResponse(_0xc8e5('0x1de'),'Failure','check\x20failure'));}});};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1e0')]=function(_0xfd4e){var _0x1b9a46=this;return function(_0x137dba){return new BPromise(function(_0x3ff1b1,_0x52f028){_[_0xc8e5('0x8c')](_0xfd4e,_0x137dba[0x0]);if(checkGetDataPredictive(_0x137dba[0x0])){loggerPredictive['info'](JSON['stringify'](_0x137dba[0x0]));if(_0xfd4e[_0xc8e5('0x1cf')]===_0xc8e5('0x1cc')){return _0x1b9a46[_0xc8e5('0xc8')](_0xfd4e['id'])[_0xc8e5('0xbd')](function(_0x35c3b4){var _0x8eaa1f=_0xfd4e['loggedIn']-_0x35c3b4[0x0][_0xc8e5('0x1e1')];var _0x466889=_0xfd4e[_0xc8e5('0x1ca')]*0x3c;var _0x2b70e7=_0x137dba[0x0][_0xc8e5('0x69')]+_0x137dba[0x0][_0xc8e5('0x68')];var _0x4a5f9a=(_0x137dba[0x0][_0xc8e5('0x67')]+_0x137dba[0x0][_0xc8e5('0x6b')]+_0x137dba[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x137dba[0x0][_0xc8e5('0x7f')];var _0x5899b1=_0xfd4e['dialPredictiveOptimizationPercentage']/0x64;_0xfd4e['predictiveIntervalPauses']=_0x35c3b4[0x0][_0xc8e5('0x1e1')]||0x0;_0xfd4e[_0xc8e5('0x6d')]=_0x4a5f9a>0x0?_0x4a5f9a:0x1;return _0x1b9a46[_0xc8e5('0x1db')](_0x8eaa1f,_0x466889,_0x2b70e7,_0x4a5f9a,_0x5899b1);})[_0xc8e5('0xbd')](function(_0x50b15d){return _0x3ff1b1(_0x50b15d);})[_0xc8e5('0xba')](function(_0x1488d6){return _0x52f028(msgResponse(_0xc8e5('0x1e2'),_0xc8e5('0x13e'),JSON['stringify'](_0x1488d6)));});}if(_0xfd4e[_0xc8e5('0x1cf')]==='agentBusyFactor'){return _0x1b9a46[_0xc8e5('0xc8')](_0xfd4e['id'])['then'](function(_0x64ba23){var _0x401b3c=_0xfd4e[_0xc8e5('0x52')]-_0x64ba23[0x0][_0xc8e5('0x1e1')];var _0x2c1148=_0xfd4e[_0xc8e5('0x1ca')]*0x3c;var _0x4b75f3=_0x137dba[0x0]['predictiveIntervalAvgTalktime']+_0x137dba[0x0][_0xc8e5('0x68')];var _0x496027=(_0x137dba[0x0][_0xc8e5('0x67')]+_0x137dba[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x137dba[0x0][_0xc8e5('0x6a')])/_0x137dba[0x0][_0xc8e5('0x7f')];var _0x5e25b7=_0xfd4e[_0xc8e5('0x1c0')]/0x64;_0xfd4e[_0xc8e5('0x6f')]=_0x64ba23[0x0][_0xc8e5('0x1e1')]||0x0;_0xfd4e[_0xc8e5('0x6d')]=_0x496027>0x0?_0x496027:0x1;return _0x1b9a46[_0xc8e5('0x1dd')](_0x401b3c,_0x2c1148,_0x4b75f3,_0x496027,_0x5e25b7);})[_0xc8e5('0xbd')](function(_0x5ec48d){return _0x3ff1b1(_0x5ec48d);})['catch'](function(_0x2d0a69){return _0x52f028(msgResponse('[CatchErlangB]','Failure',JSON[_0xc8e5('0x4b')](_0x2d0a69)));});}}else{return _0x52f028(msgResponse(_0xc8e5('0x1de'),_0xc8e5('0x13e'),_0xc8e5('0x1e3')));}});};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1e4')]=function(_0x48a549){var _0x2a38bc=this;return function(){var _0x3644aa=0x0;var _0x27de7a=Math['floor'](_0x48a549[_0xc8e5('0x72')]*0x3e8);if(_0x27de7a>0x0){_0x27de7a=_0x27de7a<0x64?0x64:_0x27de7a;loggerPredictive['info'](_0x48a549[_0xc8e5('0x41')],_0xc8e5('0x1e5'),_0x27de7a,_0xc8e5('0x4c'));_0x48a549[_0xc8e5('0x90')]=setInterval(function(){_0x2a38bc[_0xc8e5('0x90')](_0x48a549);loggerPredictiveCalls['info'](_0xc8e5('0x1e6'),_0x3644aa+=0x1);},_0x27de7a);}else{loggerPredictive['info'](_0x48a549[_0xc8e5('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1e7')]=function(_0x29b672,_0x122353){var _0x40d9b0=this;return function(_0x170479){if(_[_0xc8e5('0x48')](_0x170479)){if(_[_0xc8e5('0xaf')](_0x122353[_0xc8e5('0x1e8')])||!_0x122353[_0xc8e5('0x1e9')]){if(_0x29b672['dialMethod']===_0xc8e5('0x151')){_0x29b672[_0xc8e5('0x127')]=_[_0xc8e5('0x3e')](_0x29b672[_0xc8e5('0x127')])?!![]:_0x29b672[_0xc8e5('0x127')];var _0x4da064=uuid['v4']();_0x40d9b0[_0xc8e5('0x27')][_0x4da064]=new Action(_0x29b672,_0x122353,_0x4da064);loggerBooked['info'](_0xc8e5('0x1ea'),_0x4da064,'queueStatusComplete:\x20',JSON['stringify'](_0x29b672[_0xc8e5('0x127')]),_0xc8e5('0x1eb'),_0x29b672[_0xc8e5('0x41')]);if(_0x29b672[_0xc8e5('0x127')]){_0x29b672['queueStatusComplete']=![];_0x40d9b0[_0xc8e5('0x2c')][_0x40d9b0['actions'][_0x4da064][_0xc8e5('0xb4')]]=[];ami[_0xc8e5('0xb0')]({'actionid':_0x4da064,'action':_0xc8e5('0x1ec'),'queue':_0x29b672[_0xc8e5('0x41')]})['catch'](function(_0xc5973a){_0x40d9b0[_0xc8e5('0xb3')](_0x29b672);_0x40d9b0[_0xc8e5('0xc1')]({'active':![],'ContactId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xcf')],'ListId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xd0')],'VoiceQueueId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064]['VoiceQueueId']||undefined,'CampaignId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1ed')));delete _0x40d9b0[_0xc8e5('0x27')][_0x4da064];});}else{loggerBooked[_0xc8e5('0x7d')](_0xc8e5('0x1ee'),JSON[_0xc8e5('0x4b')](_0x29b672[_0xc8e5('0x127')]),_0xc8e5('0x1eb'),_0x29b672['name']);_0x40d9b0[_0xc8e5('0xb3')](_0x29b672);_0x40d9b0[_0xc8e5('0xc1')]({'active':![],'ContactId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xcf')],'ListId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064]['ListId'],'VoiceQueueId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xd1')]||undefined,'CampaignId':_0x40d9b0[_0xc8e5('0x27')][_0x4da064][_0xc8e5('0xd2')]||undefined})[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1ed')));delete _0x40d9b0[_0xc8e5('0x27')][_0x4da064];}}else{return _0x40d9b0[_0xc8e5('0x160')](_0x29b672,_0x122353);}}else{if(getDiff(_0x122353[_0xc8e5('0x1ef')])<_0x29b672[_0xc8e5('0x1f0')]*0x3c){if(_0x122353[_0xc8e5('0x1f1')]&&!_0x122353[_0xc8e5('0x1f1')]['voicePause']){_0x40d9b0['preview'][_0xc8e5('0x12a')](_0x122353['id'])['finally'](function(){_0x40d9b0['updateOriginated'](_0x29b672);});}else{_0x40d9b0[_0xc8e5('0xc3')]({'active':![]},_0x122353['id'],0x1)[_0xc8e5('0x1e')](function(){console[_0xc8e5('0x1f2')](_0xc8e5('0x1f3'));_0x40d9b0['updateOriginated'](_0x29b672);});}}else{_0x29b672[_0xc8e5('0x65')]+=0x1;_0x40d9b0[_0xc8e5('0xb3')](_0x29b672);if(_0x29b672[_0xc8e5('0x1f4')]){_0x40d9b0['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x122353[_0xc8e5('0xcf')],'ListId':_0x122353[_0xc8e5('0xd0')],'VoiceQueueId':_0x122353[_0xc8e5('0xd1')]||undefined,'CampaignId':_0x122353[_0xc8e5('0xd2')]||undefined})['catch'](loggerCatch(_0xc8e5('0x1f5')));_0x40d9b0['createHistory'](createObjHistory(_0x29b672,_0x122353,_0xc8e5('0x1f6'),0x17,_0xc8e5('0x1f7')))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0x1f8')));}else{_0x40d9b0[_0xc8e5('0xd8')](createObjHistory(_0x29b672,_0x122353,_0xc8e5('0x1f9'),0x16,_0xc8e5('0x1fa')),'[Originate][HistoryRecallClose][historyCatch]',_0xc8e5('0x1fb'));}}}}else{_0x29b672[_0xc8e5('0x5e')]+=0x1;_0x40d9b0[_0xc8e5('0xd8')](createObjHistory(_0x29b672,_0x122353,_0xc8e5('0x1fc'),0xd,_0xc8e5('0x1fd')),_0xc8e5('0x1fe'),_0xc8e5('0x1ff'));throw _0xc8e5('0x200');}};};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x154')]=function(_0x111fc2){var _0x12ecc1=this;var _0x24a7ed=[];var _0x281772=_0x111fc2[_0xc8e5('0x201')]-_0x111fc2[_0xc8e5('0x70')]-_0x111fc2[_0xc8e5('0x202')];emitCampaignSummary(_0x111fc2);if(_0x281772>0x0){if(_0x281772>this[_0xc8e5('0x25')]){_0x281772=this['maxNumberOriginate'];}_0x111fc2[_0xc8e5('0x202')]+=_0x281772;this['getContactDialerIvr'](_0x111fc2['id'],_0x281772,_0x111fc2[_0xc8e5('0x203')])[_0xc8e5('0xbd')](function(_0x19c71b){_0x111fc2[_0xc8e5('0x202')]-=_0x281772;_0x111fc2[_0xc8e5('0x202')]=_0x111fc2[_0xc8e5('0x202')]>0x0?_0x111fc2['temp']:0x0;if(!checkContactEmpty(_0x19c71b)){_0x111fc2['message']=_0xc8e5('0x9f');logger[_0xc8e5('0x7d')](_0xc8e5('0x204')+_0x111fc2[_0xc8e5('0x41')]);}else{_0x111fc2[_0xc8e5('0x70')]+=_0x19c71b['length'];_0x111fc2[_0xc8e5('0x3f')]='RUNNING';for(var _0x1395e6=0x0;_0x1395e6<_0x19c71b[_0xc8e5('0x97')];_0x1395e6+=0x1){_0x111fc2[_0xc8e5('0x205')]+=0x1;if(_[_0xc8e5('0xaf')](_0x19c71b[_0x1395e6])||_[_0xc8e5('0xaf')](_0x19c71b[_0x1395e6]['Contact'])||_[_0xc8e5('0xaf')](_0x19c71b[_0x1395e6][_0xc8e5('0x163')]['phone'])){_0x12ecc1[_0xc8e5('0x206')](_0xc8e5('0x207'),_0x111fc2,_0x19c71b[_0x1395e6]);}else{_0x12ecc1['checkIsBlackListIvr'](_['pick'](_0x19c71b[_0x1395e6],[_0xc8e5('0xd2'),_0xc8e5('0x208')]))['then'](_0x12ecc1['checkContactBlack'](_0x111fc2,_0x19c71b[_0x1395e6]))[_0xc8e5('0xba')](_0x12ecc1[_0xc8e5('0x209')](_0xc8e5('0x20a'),_0x111fc2));}}}})[_0xc8e5('0xba')](loggerGetContactDialer(_0xc8e5('0x20b'),_0x111fc2,_0x281772));}};Dialer[_0xc8e5('0x1b')]['handlePower']=function(_0x143ed2,_0x5addd3){var _0x2c51a0=this;var _0x59c977=[];var _0x45f06c=_0x5addd3>=0x1?_0x5addd3:0x1;var _0x6d8967=[];if(_0x143ed2['dialMethod']==='booked'){_0x45f06c=0x1;}var _0x5ef336=Math[_0xc8e5('0x1c5')](_0x143ed2['available']*_0x45f06c)-_0x143ed2[_0xc8e5('0x70')]-_0x143ed2[_0xc8e5('0x202')];emitVoiceQueueSummary(_0x143ed2);if(_0x143ed2[_0xc8e5('0x20c')]>0x0){var _0x27dd0c=_0x143ed2[_0xc8e5('0x20c')]-_0x143ed2[_0xc8e5('0x70')]-_0x143ed2[_0xc8e5('0x54')]-_0x143ed2[_0xc8e5('0x202')]-_0x143ed2[_0xc8e5('0xa2')];if(_0x5ef336>_0x27dd0c){_0x5ef336=_0x27dd0c;}}if(_0x5ef336>0x0){if(_0x143ed2[_0xc8e5('0x20d')]===_0xc8e5('0x151')){_0x5ef336=0x1;}if(_0x5ef336>this[_0xc8e5('0x25')]){_0x5ef336=this[_0xc8e5('0x25')];}_0x143ed2['temp']+=_0x5ef336;for(var _0x41d383 in this[_0xc8e5('0x23')]){if(this[_0xc8e5('0x23')][_0xc8e5('0x98')](_0x41d383)){if(this['agents'][_0x41d383][_0xc8e5('0xa9')]==='not_inuse'&&this[_0xc8e5('0x23')][_0x41d383][_0xc8e5('0xb1')]===_0xc8e5('0xd5')){_0x59c977[_0xc8e5('0x125')](this[_0xc8e5('0x23')][_0x41d383]['id']);}}}this['getContactDialer'](_0x143ed2['id'],_0x59c977,_0x5ef336,_0x143ed2['dialOrderByScheduledAt'])[_0xc8e5('0xbd')](function(_0x563a7f){_0x143ed2[_0xc8e5('0x202')]-=_0x5ef336;_0x143ed2[_0xc8e5('0x202')]=_0x143ed2[_0xc8e5('0x202')]>0x0?_0x143ed2[_0xc8e5('0x202')]:0x0;if(!checkContactEmpty(_0x563a7f)){_0x2c51a0[_0xc8e5('0xb6')](_0x143ed2)['then'](sendMessageReschedule(_0x143ed2))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xb8')));}else{_0x143ed2[_0xc8e5('0x70')]+=_0x563a7f[_0xc8e5('0x97')];_0x143ed2[_0xc8e5('0x3f')]=_0x143ed2[_0xc8e5('0x20d')]==='booked'?'ACTIVE':_0xc8e5('0x20e');for(var _0x424f9f=0x0;_0x424f9f<_0x563a7f[_0xc8e5('0x97')];_0x424f9f+=0x1){if(_['isNil'](_0x563a7f[_0x424f9f])||_[_0xc8e5('0xaf')](_0x563a7f[_0x424f9f][_0xc8e5('0x163')])||_[_0xc8e5('0xaf')](_0x563a7f[_0x424f9f]['Contact'][_0xc8e5('0x164')])){_0x2c51a0[_0xc8e5('0x206')](_0xc8e5('0x207'),_0x143ed2,_0x563a7f[_0x424f9f]);}else{_0x2c51a0[_0xc8e5('0xb9')](_[_0xc8e5('0xce')](_0x563a7f[_0x424f9f],[_0xc8e5('0xd1'),'Contact.phone']))[_0xc8e5('0xbd')](_0x2c51a0[_0xc8e5('0x1e7')](_0x143ed2,_0x563a7f[_0x424f9f]))[_0xc8e5('0xba')](_0x2c51a0[_0xc8e5('0x209')]('[actionOriginate]\x20',_0x143ed2));}}}})[_0xc8e5('0xba')](loggerGetContactDialer(_0xc8e5('0x20f'),_0x143ed2,_0x5ef336));}};Dialer[_0xc8e5('0x1b')]['handlePredictive']=function(_0x5bf7e3){var _0x42e3e5=this;if(_0x5bf7e3[_0xc8e5('0x20c')]>0x0){var _0x5b23f8=_0x5bf7e3[_0xc8e5('0x20c')]-_0x5bf7e3['originated']-_0x5bf7e3[_0xc8e5('0x54')];if(_0x5b23f8>0x0){this[_0xc8e5('0x210')](_0x5bf7e3);}else{loggerPredictiveCalls[_0xc8e5('0x7d')](_0xc8e5('0x211'));}}else{this[_0xc8e5('0x210')](_0x5bf7e3);}};Dialer[_0xc8e5('0x1b')]['tryOriginatePredictive']=function(_0x44318b){var _0x37b065=this;var _0x54c044=[];_0x44318b['originated']+=0x1;for(var _0x4dd5bf in this[_0xc8e5('0x23')]){if(this[_0xc8e5('0x23')]['hasOwnProperty'](_0x4dd5bf)){if(this['agents'][_0x4dd5bf][_0xc8e5('0xa9')]==='not_inuse'&&this['agents'][_0x4dd5bf][_0xc8e5('0xb1')]===_0xc8e5('0xd5')){_0x54c044[_0xc8e5('0x125')](this['agents'][_0x4dd5bf]['id']);}}}this[_0xc8e5('0xc5')](_0x44318b['id'],_0x54c044,0x1,_0x44318b[_0xc8e5('0x203')])[_0xc8e5('0xbd')](function(_0x28f0af){if(!checkContactEmpty(_0x28f0af)){checkContactLowerLimitOriginate(_0x44318b,0x1,0x0);_0x37b065[_0xc8e5('0xb6')](_0x44318b)[_0xc8e5('0xbd')](sendMessageReschedule(_0x44318b))[_0xc8e5('0xba')](loggerCatch(_0xc8e5('0xb8')));}else{_0x44318b[_0xc8e5('0x3f')]='RUNNING';if(_[_0xc8e5('0xaf')](_0x28f0af[0x0])||_['isNil'](_0x28f0af[0x0][_0xc8e5('0x163')])||_[_0xc8e5('0xaf')](_0x28f0af[0x0][_0xc8e5('0x163')]['phone'])){_0x37b065[_0xc8e5('0x206')](_0xc8e5('0x207'),_0x44318b,_0x28f0af[0x0]);}else{_0x37b065['checkIsBlackList'](_[_0xc8e5('0xce')](_0x28f0af[0x0],['VoiceQueueId',_0xc8e5('0x208')]))[_0xc8e5('0xbd')](_0x37b065['checkContactBlack'](_0x44318b,_0x28f0af[0x0]))['catch'](_0x37b065['loggerHandler']('[actionOriginatePredictive]\x20',_0x44318b));}}})['catch'](loggerGetContactDialer(_0xc8e5('0x212'),_0x44318b,0x1));emitVoiceQueueSummary(_0x44318b);};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1db')]=function(_0x40187e,_0xa1bb45,_0x2fe9,_0x3745de,_0x366fc6,_0x3b102b){loggerPredictive[_0xc8e5('0x7d')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xc8e5('0x213'),_0x40187e);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x214'),_0xa1bb45);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x215'),_0x2fe9);loggerPredictive['info'](_0xc8e5('0x216'),_0x3745de);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x217'),_0x366fc6);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x82'));return new BPromise(function(_0x234734,_0x2ca5b4){if(_0x40187e<=0x0||isNaN(_0x40187e)){return _0x2ca5b4(msgResponse('[abandonmentRate]',_0xc8e5('0x4a'),_0xc8e5('0x218')+_0x40187e));}if(_0x2fe9<=0x0||isNaN(_0x2fe9)){return _0x2ca5b4(msgResponse(_0xc8e5('0x219'),_0xc8e5('0x4a'),_0xc8e5('0x21a')+_0x2fe9));}if(_0x3745de<=0x0||isNaN(_0x3745de)){return _0x2ca5b4(msgResponse(_0xc8e5('0x219'),'Error',_0xc8e5('0x21b')+_0x3745de));}if(_0xa1bb45<=0x0||isNaN(_0xa1bb45)){return _0x2ca5b4(msgResponse(_0xc8e5('0x219'),_0xc8e5('0x4a'),'interval\x20=\x20'+_0xa1bb45));}if(_0x366fc6<=0x0||isNaN(_0x366fc6)){return _0x2ca5b4(msgResponse(_0xc8e5('0x219'),_0xc8e5('0x4a'),_0xc8e5('0x21c')+_0x366fc6));}_0x3b102b=_0x3b102b||0x0;var _0x457cd0=0x1/_0x2fe9;var _0x2f256d=0x0;var _0x157abb=0x0;var _0x47ad97=0x0;var _0x582279=0x0;for(var _0x599fe4=0x0;_0x47ad97<_0x366fc6;_0x599fe4+=0x1){_0x157abb=_0x599fe4/_0xa1bb45;_0x2f256d=(_0x3745de*_0x157abb+_0x3b102b)/_0x457cd0;_0x47ad97=erlangb(_0x2f256d,_0x40187e);_0x582279=_0x2f256d/_0x40187e*(0x1-erlangb(_0x2f256d,_0x40187e));}return _0x234734({'erlangCalls':_0x599fe4,'erlangCallToSecond':_0xa1bb45/_0x599fe4,'erlangAbandonmentRate':_0x47ad97,'erlangBusyFactor':_0x582279});});};Dialer[_0xc8e5('0x1b')][_0xc8e5('0x1dd')]=function(_0x12ebdf,_0x2ed9c5,_0x4dba1c,_0x44e284,_0x3cb34b,_0x48022e){loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x21d'));loggerPredictive['info'](_0xc8e5('0x213'),_0x12ebdf);loggerPredictive['info'](_0xc8e5('0x214'),_0x2ed9c5);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x215'),_0x4dba1c);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x216'),_0x44e284);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x21e'),_0x3cb34b);loggerPredictive[_0xc8e5('0x7d')](_0xc8e5('0x82'));return new BPromise(function(_0x7559ce,_0x5ca1b8){if(_0x12ebdf<=0x0||isNaN(_0x12ebdf)){return _0x5ca1b8(msgResponse(_0xc8e5('0x21f'),'Error',_0xc8e5('0x218')+_0x12ebdf));}if(_0x4dba1c<=0x0||isNaN(_0x4dba1c)){return _0x5ca1b8(msgResponse('[busyFactor]','Error',_0xc8e5('0x21a')+_0x4dba1c));}if(_0x44e284<=0x0||isNaN(_0x44e284)){return _0x5ca1b8(msgResponse(_0xc8e5('0x21f'),_0xc8e5('0x4a'),_0xc8e5('0x21b')+_0x44e284));}if(_0x2ed9c5<=0x0||isNaN(_0x2ed9c5)){return _0x5ca1b8(msgResponse(_0xc8e5('0x21f'),_0xc8e5('0x4a'),_0xc8e5('0x220')+_0x2ed9c5));}if(_0x3cb34b<=0x0||isNaN(_0x3cb34b)){return _0x5ca1b8(msgResponse(_0xc8e5('0x21f'),_0xc8e5('0x4a'),_0xc8e5('0x221')+_0x3cb34b));}_0x48022e=_0x48022e||0x0;var _0x4c490a=0x1/_0x4dba1c;var _0x5251f2=0x0;var _0x236573=0x0;var _0x2ed7b5=0x0;var _0x5d68f4=0x0;for(var _0x15d06b=0x0;_0x5d68f4<_0x3cb34b;_0x15d06b+=0x1){_0x236573=_0x15d06b/_0x2ed9c5;_0x5251f2=(_0x44e284*_0x236573+_0x48022e)/_0x4c490a;_0x2ed7b5=erlangb(_0x5251f2,_0x12ebdf);_0x5d68f4=_0x5251f2/_0x12ebdf*(0x1-erlangb(_0x5251f2,_0x12ebdf));}return _0x7559ce({'erlangCalls':_0x15d06b,'erlangCallToSecond':_0x2ed9c5/_0x15d06b,'erlangAbandonmentRate':_0x2ed7b5,'erlangBusyFactor':_0x5d68f4});});};module[_0xc8e5('0x222')]=Dialer; \ No newline at end of file +var _0x5e1f=['campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','ivr','string','format','\x22%s\x22\x20<%s>','error','inspect','stack','hasOwnProperty','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','talking','pTalking','NOT_ACTIVE','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','statedesc','endtime','starttime','loopClearZombieChannels','[uniqueid]','clearZombieChannels','actions','status','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','merge','ListId','UserId','VoiceQueueId','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','unmonitored','syncVarSet','uniqueId','uniqueid','isNil','variable','amdstatus','dialAMDActive','value','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','ContactId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr]','Machine','countglobal','amd','countdropretry','reason19\x20machine....','YYYY-MM-DD\x20HH:mm:ss','CampaignId','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','locked','stateinterface','push','pick','idHopper','paused','queueStatusComplete','[booked][unlockQueueStatus]','stringify','syncQueueStatusComplete','run','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','isArray','length','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','originate','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','OriginateError','[originate][error]','originate\x20action\x20Error','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','buildObj','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','busyFactor','floor','fail\x20to\x20scheduled\x20calls','recallme','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','Agent','voicePause','log','Contact\x20updated','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','limitCalls','temp','getContactDialerIvr','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','emptyContact','checkContactBlack','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','loopCampaigns','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','sumHoldTime','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','campaign:ivr:%s'];(function(_0x3dbbf1,_0x2ee135){var _0x1ff2b1=function(_0x365573){while(--_0x365573){_0x3dbbf1['push'](_0x3dbbf1['shift']());}};_0x1ff2b1(++_0x2ee135);}(_0x5e1f,0x19f));var _0xf5e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e1f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf5e1('0x0'));var _=require(_0xf5e1('0x1'));var BPromise=require(_0xf5e1('0x2'));var uuid=require(_0xf5e1('0x3'));var moment=require(_0xf5e1('0x4'));var rr=require('rr');var md5=require(_0xf5e1('0x5'));var Redis=require(_0xf5e1('0x6'));var ut=require(_0xf5e1('0x7'));var config=require(_0xf5e1('0x8'));var logger=require(_0xf5e1('0x9'))(_0xf5e1('0xa'));var loggerBooked=require(_0xf5e1('0x9'))('booked');var loggerPredictive=require(_0xf5e1('0x9'))(_0xf5e1('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0xf5e1('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0xf5e1('0xd'));config[_0xf5e1('0xe')]=_[_0xf5e1('0xf')](config[_0xf5e1('0xe')],{'host':_0xf5e1('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf5e1('0xe')]));var cmHopper=require(_0xf5e1('0x11'));var cmHopperFinal=require(_0xf5e1('0x12'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xf5e1('0x13'));var voiceQueueRt=require(_0xf5e1('0x14'));var Action=require(_0xf5e1('0x15'));var History=require(_0xf5e1('0x16'));var Final=require(_0xf5e1('0x17'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process['env'][_0xf5e1('0x18')]||_0xf5e1('0x19');var strategy={'rrmemory':_0xf5e1('0x1a'),'roundrobin':_0xf5e1('0x1b')};var Sequence=function(){};Sequence[_0xf5e1('0x1c')][_0xf5e1('0x1d')]=function(_0x2a5b5f){this['tail']=this['tail']?this[_0xf5e1('0x1e')]['finally'](_0x2a5b5f):_0x2a5b5f();};function Dialer(_0x3a9f7a,_0x326fc4){this[_0xf5e1('0x1f')]=new Sequence();this['preview']=_0x326fc4;this[_0xf5e1('0x20')]=_0x3a9f7a[_0xf5e1('0x20')];this[_0xf5e1('0x21')]=_0x3a9f7a[_0xf5e1('0x21')];this[_0xf5e1('0x22')]=_0x3a9f7a[_0xf5e1('0x22')];this[_0xf5e1('0x23')]=_0x3a9f7a['trunks'];this[_0xf5e1('0x24')]=config['maxNumberOriginate']||0x2;this[_0xf5e1('0x25')]={};this['actions']={};this[_0xf5e1('0x26')]={};this['uniqueId']={};this[_0xf5e1('0x27')]={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this[_0xf5e1('0x28')]={};this[_0xf5e1('0x29')]={};ami['on'](_0xf5e1('0x2a'),this[_0xf5e1('0x2b')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x2d'),this['syncQueueCallerAbandon'][_0xf5e1('0x2c')](this));ami['on']('originateresponse',this[_0xf5e1('0x2e')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x2f'),this[_0xf5e1('0x30')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x31'),this[_0xf5e1('0x32')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x33'),this['syncHangup'][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x34'),this[_0xf5e1('0x35')][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x36'),this['syncVarSet'][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x37'),this['syncQueueMember'][_0xf5e1('0x2c')](this));ami['on'](_0xf5e1('0x38'),this['syncQueueStatusComplete'][_0xf5e1('0x2c')](this));this[_0xf5e1('0x39')]();this['loopClearZombieChannels']();}function isNotNull(_0x23db01){return _0x23db01!==null&&!_[_0xf5e1('0x3a')](_0x23db01);}function checkIsLoggedIn(_0x533560,_0x306750){return function(){if(_0x306750<=0x0){_0x533560['message']=_0xf5e1('0x3b');throw _0x533560[_0xf5e1('0x3c')]+_0xf5e1('0x3d');}};}function isActive(_0x4baa16){return _0x4baa16;}function checkIsActive(_0x3dbd1a,_0x60e46c){return function(){if(!isActive(_0x60e46c)){_0x3dbd1a[_0xf5e1('0x3e')]='NOT_ACTIVE';throw _0x3dbd1a[_0xf5e1('0x3c')]+_0xf5e1('0x3f');}};}function checkInterval(_0x1ef0b9){return function(){if(!isNotNull(_0x1ef0b9[_0xf5e1('0x40')])){_0x1ef0b9[_0xf5e1('0x3e')]=_0xf5e1('0x41');throw _0x1ef0b9[_0xf5e1('0x3c')]+_0xf5e1('0x42');}if(!isNotNull(_0x1ef0b9[_0xf5e1('0x40')][_0xf5e1('0x43')])){_0x1ef0b9[_0xf5e1('0x3e')]='INTERVAL_IS_NULL';throw _0x1ef0b9['name']+_0xf5e1('0x42');}if(!isNotNull(_[_0xf5e1('0x44')](_0x1ef0b9[_0xf5e1('0x40')][_0xf5e1('0x43')]))){_0x1ef0b9['message']='INTERVAL_IS_NULL';throw _0x1ef0b9['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x323218,_0x3e1405,_0x3c296f){return{'action':_0x323218,'response':_0x3e1405,'message':_0x3c296f,'stack':_0x3c296f};}function myreject(_0x4f25ba){return function(_0x336ef3){return _0x4f25ba(msgResponse(_0xf5e1('0x45'),_0xf5e1('0x46'),JSON['stringify'](_0x336ef3)));};}function getSeconds(_0x2520af,_0x43dd83){var _0xf8ed19=moment(_0x2520af)[_0xf5e1('0x47')](0x0);var _0x3b93bb=moment(_0x43dd83)['milliseconds'](0x0);return _0xf8ed19[_0xf5e1('0x48')](_0x3b93bb,_0xf5e1('0x49'));}function emit(_0xb2b10e,_0x1b40d4,_0x3f2075){io['to'](_0xb2b10e)[_0xf5e1('0x4a')](_0x1b40d4,_0x3f2075);}function emitVoiceQueueSummary(_0x5d6be2){if(_0x5d6be2[_0xf5e1('0x4b')]===_0xf5e1('0x4c')){var _0x23507c={'id':_0x5d6be2['id'],'name':_0x5d6be2[_0xf5e1('0x3c')],'strategy':_0x5d6be2[_0xf5e1('0x4d')],'answered':_0x5d6be2[_0xf5e1('0x4e')],'available':_0x5d6be2['available'],'loggedIn':_0x5d6be2[_0xf5e1('0x4f')],'pTalking':_0x5d6be2['pTalking'],'sumBillable':_0x5d6be2['sumBillable'],'sumDuration':_0x5d6be2['sumDuration'],'sumHoldTime':_0x5d6be2[_0xf5e1('0x50')]||0x0,'talking':_0x5d6be2['talking'],'total':_0x5d6be2['total'],'type':_0x5d6be2[_0xf5e1('0x4b')],'unmanaged':_0x5d6be2[_0xf5e1('0x51')],'abandoned':_0x5d6be2[_0xf5e1('0x52')],'waiting':_0x5d6be2[_0xf5e1('0x53')],'loggedInDb':_0x5d6be2['loggedInDb'],'dialActive':_0x5d6be2[_0xf5e1('0x54')],'dialMethod':_0x5d6be2[_0xf5e1('0x55')],'dialOriginateCallerIdName':_0x5d6be2[_0xf5e1('0x56')],'dialOriginateCallerIdNumber':_0x5d6be2['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5d6be2['dialOriginateTimeout'],'dialPrefix':_0x5d6be2['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5d6be2[_0xf5e1('0x57')],'outboundAnswerCallsDay':_0x5d6be2[_0xf5e1('0x58')],'outboundBlacklistCallsDay':_0x5d6be2[_0xf5e1('0x59')],'outboundBusyCallsDay':_0x5d6be2[_0xf5e1('0x5a')],'outboundCongestionCallsDay':_0x5d6be2['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5d6be2[_0xf5e1('0x5b')],'outboundDropCallsDayCallersExit':_0x5d6be2[_0xf5e1('0x5c')],'outboundDropCallsDayTimeout':_0x5d6be2['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5d6be2[_0xf5e1('0x5d')],'outboundNoSuchCallsDay':_0x5d6be2[_0xf5e1('0x5e')],'outboundOriginateFailureCallsDay':_0x5d6be2[_0xf5e1('0x5f')],'outboundReCallsDay':_0x5d6be2['outboundReCallsDay'],'outboundRejectCallsDay':_0x5d6be2[_0xf5e1('0x60')],'outboundUnknownCallsDay':_0x5d6be2[_0xf5e1('0x61')],'predictiveIntervalAnsweredCalls':_0x5d6be2[_0xf5e1('0x62')],'predictiveIntervalAvgHoldtime':_0x5d6be2[_0xf5e1('0x63')],'predictiveIntervalAvgTalktime':_0x5d6be2[_0xf5e1('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x5d6be2[_0xf5e1('0x65')],'predictiveIntervalDroppedCallsTimeout':_0x5d6be2[_0xf5e1('0x66')],'predictiveIntervalErlangCalls':_0x5d6be2[_0xf5e1('0x67')],'predictiveIntervalErlangCallsDroppedCalls':_0x5d6be2[_0xf5e1('0x68')],'predictiveIntervalHitRate':_0x5d6be2[_0xf5e1('0x69')],'predictiveIntervalMultiplicativeFactor':_0x5d6be2[_0xf5e1('0x6a')],'predictiveIntervalPauses':_0x5d6be2[_0xf5e1('0x6b')],'predictiveIntervalAvailable':_0x5d6be2[_0xf5e1('0x6c')],'predictiveIntervalTotalCalls':_0x5d6be2[_0xf5e1('0x6d')],'message':_0x5d6be2['message'],'originated':_0x5d6be2['originated'],'erlangCalls':_0x5d6be2[_0xf5e1('0x6e')],'erlangCallToSecond':_0x5d6be2[_0xf5e1('0x6f')],'erlangAbandonmentRate':_0x5d6be2[_0xf5e1('0x70')],'erlangBusyFactor':_0x5d6be2[_0xf5e1('0x71')],'startPredictive':_0x5d6be2['startPredictive'],'startProgressive':_0x5d6be2[_0xf5e1('0x72')]};if(_0x5d6be2[_0xf5e1('0x73')]){_0x23507c['Trunk']={'id':_0x5d6be2[_0xf5e1('0x73')]['id'],'name':_0x5d6be2[_0xf5e1('0x73')][_0xf5e1('0x3c')],'active':_0x5d6be2[_0xf5e1('0x73')][_0xf5e1('0x74')],'callerid':_0x5d6be2['Trunk'][_0xf5e1('0x75')]};}if(_0x5d6be2[_0xf5e1('0x40')]){_0x23507c[_0xf5e1('0x40')]={'id':_0x5d6be2[_0xf5e1('0x40')]['id'],'name':_0x5d6be2[_0xf5e1('0x40')][_0xf5e1('0x3c')]};}var _0x237791=md5(JSON['stringify'](_0x23507c));if(_0x5d6be2[_0xf5e1('0x5')]!==_0x237791){_0x5d6be2[_0xf5e1('0x5')]=_0x237791;emit(util['format']('voice:queue:%s',_0x23507c[_0xf5e1('0x3c')]),'voice_queue:save',_0x23507c);}}}function emitCampaignSummary(_0x269181){if(_0x269181[_0xf5e1('0x4b')]==='ivr'){emit(util['format'](_0xf5e1('0x76'),_0x269181['name']),_0xf5e1('0x77'),_0x269181);}}function checkGetDataPredictive(_0x14d430){if(isNotNull(_0x14d430)){if(!_[_0xf5e1('0x44')](_0x14d430)){loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x79'));loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7a'),_0x14d430['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0xf5e1('0x7b'),_0x14d430[_0xf5e1('0x62')]);loggerPredictive[_0xf5e1('0x78')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14d430[_0xf5e1('0x66')]);loggerPredictive[_0xf5e1('0x78')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14d430[_0xf5e1('0x65')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7c'),_0x14d430['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7d'),_0x14d430[_0xf5e1('0x64')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7e'));if(_0x14d430[_0xf5e1('0x6d')]>0x0){if(!_['isUndefined'](_0x14d430['predictiveIntervalAvgTalktime'])&&_0x14d430['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0xf5e1('0x78')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0xf5e1('0x3a')](_0x14d430['predictiveIntervalAvgHoldtime'])&&_0x14d430[_0xf5e1('0x63')]>0x0){return!![];}else{loggerPredictive['info'](_0xf5e1('0x7f'));}}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x80'));}}else{loggerPredictive[_0xf5e1('0x78')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1a49c9){return function(_0x103f8d){loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x81'));loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x82'),_0x103f8d['erlangCalls']);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x83'),_0x103f8d[_0xf5e1('0x6f')]);loggerPredictive['info'](_0xf5e1('0x84'),_0x103f8d[_0xf5e1('0x70')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x85'),_0x103f8d[_0xf5e1('0x71')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x84'),_0x103f8d[_0xf5e1('0x70')]);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7e'));_['merge'](_0x1a49c9,_0x103f8d);};}function getDiff(_0xf20e05){var _0x27e387=moment()[_0xf5e1('0x47')](0x0);var _0x2b32ec=moment(_0xf20e05)['milliseconds'](0x0);return _0x27e387[_0xf5e1('0x48')](_0x2b32ec,_0xf5e1('0x49'));}function ifInterval(_0x1cd2b4,_0x21c472){if(_['isUndefined'](_0x21c472)){return![];}if(getDiff(_0x21c472)<_0x1cd2b4*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x726c09){if(isNotNull(_0x726c09)){if(!_['isUndefined'](_0x726c09[_0xf5e1('0x72')])){_0x726c09['startProgressive']=undefined;loggerPredictive[_0xf5e1('0x78')](_0x726c09['name'],_0xf5e1('0x86'));}if(!_[_0xf5e1('0x3a')](_0x726c09['startPredictive'])){_0x726c09[_0xf5e1('0x87')]=undefined;loggerPredictive['info'](_0x726c09[_0xf5e1('0x3c')],_0xf5e1('0x88'));}if(!_[_0xf5e1('0x3a')](_0x726c09[_0xf5e1('0x89')])){clearInterval(_0x726c09['handlePredictive']);_0x726c09['handlePredictive']=undefined;loggerPredictive['info'](_0x726c09[_0xf5e1('0x3c')],_0xf5e1('0x8a'));}}}function erlangb(_0x3d725a,_0x423b62){if(_0x423b62===0x0){return 0x0;}var _0x443adb=0x1;for(var _0x502997=0x1;_0x502997<=_0x423b62;_0x502997+=0x1){_0x443adb=0x1+_0x443adb*_0x502997/_0x3d725a;}return 0x1/_0x443adb;}function isVoiceQueueOutbound(_0x331705){return _0x331705===_0xf5e1('0x4c');}function isNotPreview(_0x59c6aa){return _0x59c6aa!==_0xf5e1('0x8b');}function isCampaignIvr(_0x29b1d5){return _0x29b1d5===_0xf5e1('0x8c');}function getCallerId(_0x1f520e,_0x34dd92,_0x4cd849){if(!_[_0xf5e1('0x3a')](_0x4cd849)&&_0xf5e1('0x8d')===typeof _0x4cd849&&!_[_0xf5e1('0x44')](_0x4cd849)){if(!_['isUndefined'](_0x34dd92)&&_0xf5e1('0x8d')===typeof _0x34dd92&&!_[_0xf5e1('0x44')](_0x34dd92)){return util[_0xf5e1('0x8e')](_0xf5e1('0x8f'),_0x34dd92,_0x4cd849);}return util[_0xf5e1('0x8e')](_0xf5e1('0x8f'),_0x4cd849,_0x4cd849);}if(!_[_0xf5e1('0x3a')](_0x1f520e)&&_0xf5e1('0x8d')===typeof _0x1f520e&&!_[_0xf5e1('0x44')](_0x1f520e)){return _0x1f520e;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1cdbb3,_0x1acf2d){return function(_0x4f0974){freeVariablesPredictive(_0x1acf2d);emitVoiceQueueSummary(_0x1acf2d);emitCampaignSummary(_0x1acf2d);loggerSyncQueueSummary[_0xf5e1('0x90')](_0x1cdbb3,util[_0xf5e1('0x91')](_0x4f0974,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2fcd2c,_0x4d42f9){return function(_0x22ed40){loggerPredictive[_0xf5e1('0x90')](_0x4d42f9['name'],_0x2fcd2c);loggerPredictive[_0xf5e1('0x90')](_0x22ed40[_0xf5e1('0x92')]);freeVariablesPredictive(_0x4d42f9);};}function loggerCatch(_0x5329a3){return function(_0x5386d2){logger[_0xf5e1('0x90')](_0x5329a3,util['inspect'](_0x5386d2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5de729){return _0x5de729&&!_[_0xf5e1('0x3a')](_0x5de729)&&_0x5de729['length']>0x0;}function decremetOriginate(_0x2037e8){if(!_[_0xf5e1('0x3a')](_0x2037e8)&&_0x2037e8!==null){if(_0x2037e8[_0xf5e1('0x93')](_0xf5e1('0x94'))){if(_0x2037e8[_0xf5e1('0x94')]>0x0){_0x2037e8[_0xf5e1('0x94')]-=0x1;}else{logger[_0xf5e1('0x90')](_0xf5e1('0x95'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x5b9f47,_0x3b09db,_0x5e64c7){if(_0x3b09db>_0x5e64c7){for(var _0x3f913c=0x0;_0x3f913c<_0x3b09db-_0x5e64c7;_0x3f913c+=0x1){decremetOriginate(_0x5b9f47);}}}function loggerGetContactDialer(_0xa7a154,_0x33fd50,_0x2316ae){return function(_0x25779c){checkContactLowerLimitOriginate(_0x33fd50,_0x2316ae,0x0);logger['error'](_0xa7a154,util['inspect'](_0x25779c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x479d6a){return function(_0x5aa288){if(isNotNull(_0x5aa288)&&isNotNull(_0x5aa288[0x0])){if(_0x5aa288[0x0][_0xf5e1('0x96')]>0x0){_0x479d6a[_0xf5e1('0x3e')]=_0xf5e1('0x97');logger[_0xf5e1('0x78')](_0xf5e1('0x98')+_0x479d6a[_0xf5e1('0x3c')],_0x5aa288[0x0][_0xf5e1('0x96')],_0xf5e1('0x99'));}else{_0x479d6a['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xf5e1('0x78')]('[getContactDialer2][Empty]'+_0x479d6a[_0xf5e1('0x3c')]);}}};}function notSendMessagesQueue(_0x47c945){if(_0x47c945[_0xf5e1('0x9a')]){freeVariablesPredictive(_0x47c945);if(_0x47c945[_0xf5e1('0x94')]===0x0&&_0x47c945[_0xf5e1('0x9b')]===0x0&&_0x47c945[_0xf5e1('0x53')]===0x0&&(_0x47c945[_0xf5e1('0x9c')]||0x0)===0x0){_0x47c945[_0xf5e1('0x9a')]=![];_0x47c945['available']=0x0;_0x47c945[_0xf5e1('0x3e')]=_0xf5e1('0x9d');loggerSyncQueueSummary[_0xf5e1('0x90')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x47c945[_0xf5e1('0x3c')],'is\x20not\x20active');}else{_0x47c945['message']=_0xf5e1('0x9e');loggerSyncQueueSummary[_0xf5e1('0x90')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x47c945[_0xf5e1('0x3c')],'is\x20disactive');}emitVoiceQueueSummary(_0x47c945);}}function notSendMessagesCampaign(_0x3c7773){if(_0x3c7773[_0xf5e1('0x9a')]){if(_0x3c7773[_0xf5e1('0x94')]===0x0){_0x3c7773[_0xf5e1('0x9a')]=![];_0x3c7773[_0xf5e1('0x3e')]=_0xf5e1('0x9d');loggerSyncQueueSummary[_0xf5e1('0x90')](_0xf5e1('0x9f'),_0x3c7773['name'],_0xf5e1('0xa0'));}else{_0x3c7773[_0xf5e1('0x3e')]=_0xf5e1('0x9e');loggerSyncQueueSummary[_0xf5e1('0x90')](_0xf5e1('0x9f'),_0x3c7773[_0xf5e1('0x3c')],'is\x20disactive');}emitCampaignSummary(_0x3c7773);}}function createObjHistory(_0x3d1a44,_0x41b7de,_0x2b9aaa,_0x24fed2,_0x56a801){_0x3d1a44['message']=_0x2b9aaa;var _0x1e84d5=new Action(_0x3d1a44,_0x41b7de);var _0x16b710=new History(_0x1e84d5);_0x16b710[_0xf5e1('0xa1')]=_0x24fed2;_0x16b710[_0xf5e1('0xa2')]=_0x56a801;_0x16b710[_0xf5e1('0xa3')]=_0x1e84d5[_0xf5e1('0xa4')];return _0x16b710;}Dialer[_0xf5e1('0x1c')][_0xf5e1('0xa5')]=function(){var _0x32b184=this;setInterval(function(){_0x32b184['clearZombieChannels'](_0x32b184['uniqueId'],_0xf5e1('0xa6'));_0x32b184[_0xf5e1('0xa7')](_0x32b184[_0xf5e1('0xa8')],'[actions]');},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x5c86f0,_0x298636){var _0x25af96=this;for(var _0x6be0 in _0x5c86f0){if(_0x5c86f0[_0xf5e1('0x93')](_0x6be0)){this[_0xf5e1('0x1f')][_0xf5e1('0x1d')](function(){if(!_['isNil'](_0x5c86f0[_0x6be0])){return ami['Action']({'action':_0xf5e1('0xa9'),'channel':_0x5c86f0[_0x6be0]['channel']})[_0xf5e1('0xaa')](function(_0x13cd57){if(_0x13cd57[_0xf5e1('0x3e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5c86f0[_0x6be0]&&_0x5c86f0[_0x6be0][_0xf5e1('0x4b')]!==_0xf5e1('0x8c')){_0x25af96[_0xf5e1('0xab')](_0x25af96[_0xf5e1('0x20')][_0x5c86f0[_0x6be0][_0xf5e1('0xac')]]);logger['error'](_0xf5e1('0xad'),_0x298636,_0x6be0,_0x5c86f0[_0x6be0][_0xf5e1('0xac')]);delete _0x5c86f0[_0x6be0];}if(_0x5c86f0[_0x6be0]&&_0x5c86f0[_0x6be0]['type']==='ivr'){_0x25af96[_0xf5e1('0xab')](_0x25af96['campaigns'][_0x5c86f0[_0x6be0][_0xf5e1('0xac')]]);logger[_0xf5e1('0x90')](_0xf5e1('0xae'),_0x298636,_0x6be0,_0x5c86f0[_0x6be0]['queue']);delete _0x5c86f0[_0x6be0];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x36df0d){return BPromise[_0xf5e1('0xaf')]()['then'](cmHopper[_0xf5e1('0xb0')](_0x36df0d))[_0xf5e1('0xaa')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0xf5e1('0xb1')]=function(_0x3c7d76){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopperBlack[_0xf5e1('0xb1')](_0x3c7d76))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xb3')));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xb4')]=function(_0x6807ac){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopperBlack[_0xf5e1('0xb4')](_0x6807ac))[_0xf5e1('0xaa')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xb5')]=function(_0x1b61f6){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopperHistory[_0xf5e1('0xb6')](_0x1b61f6))[_0xf5e1('0xaa')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xb7')]=function(_0x38d844){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopper['rescheduleContact'](_0x38d844))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xb8')));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xb9')]=function(_0xca7ac,_0x19c7ad,_0x400332){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopper['unlockContact'](_0xca7ac,_0x19c7ad,_0x400332))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xba')));};Dialer[_0xf5e1('0x1c')]['getContactDialer']=function(_0x4e71df,_0x39f11a,_0x4182e7,_0x3e82b3){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopper[_0xf5e1('0xbb')](_0x4e71df,_0x39f11a,_0x4182e7,_0x3e82b3))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xbc')));};Dialer['prototype']['getContactDialerIvr']=function(_0x357514,_0x1d4496,_0x4e330b){return BPromise[_0xf5e1('0xaf')]()['then'](cmHopper['getContactDialerIvr'](_0x357514,_0x1d4496,_0x4e330b))[_0xf5e1('0xaa')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xf5e1('0x1c')]['getVoiceQueueRtPauses']=function(_0x16ada3){return BPromise['resolve']()[_0xf5e1('0xb2')](voiceQueueRt[_0xf5e1('0xbd')](_0x16ada3))[_0xf5e1('0xaa')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0xf5e1('0xbe')]=function(_0x1649e8){return BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](cmHopper[_0xf5e1('0xbe')](_0x1649e8))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xbf')]=function(_0x32b186){return BPromise[_0xf5e1('0xaf')]()['then'](cmHopperHistory[_0xf5e1('0xbf')](_0x32b186))[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xc0')));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xab')]=function(_0x12502e){if(!_[_0xf5e1('0x3a')](_0x12502e)&&_0x12502e!==null){if(_0x12502e[_0xf5e1('0x93')](_0xf5e1('0x94'))){if(_0x12502e[_0xf5e1('0x94')]>0x0){_0x12502e[_0xf5e1('0x94')]-=0x1;}else{logger[_0xf5e1('0x90')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xf5e1('0xc1'));}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xc2')]=function(_0x5dd1d4,_0x6fe083){var _0x109d72=this;return function(_0x35674b){_0x109d72[_0xf5e1('0xab')](_0x6fe083);logger[_0xf5e1('0x90')](_0x5dd1d4,util['inspect'](_0x35674b,{'showHidden':![],'depth':null}));};};Dialer[_0xf5e1('0x1c')]['emptyContact']=function(_0x31fdf7,_0x115da1,_0x45b65b){var _0x55f7b4={'state':0x19,'statedesc':_0xf5e1('0xc3')};this[_0xf5e1('0xab')](_0x115da1);this[_0xf5e1('0xc4')](_[_0xf5e1('0xc5')](_0x55f7b4,_['pick'](_0x45b65b,['ContactId',_0xf5e1('0xc6'),_0xf5e1('0xc7'),_0xf5e1('0xc8'),'CampaignId'])),'[emptyContact][createHistory]',_0xf5e1('0xc9'));logger[_0xf5e1('0x90')](_0x31fdf7);};Dialer['prototype'][_0xf5e1('0xca')]=function(_0x2cfc57){return _0x2cfc57===_0xf5e1('0xcb');};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xcc')]=function(_0x399536){return!_['isUndefined'](_0x399536)&&_0x399536&&!_[_0xf5e1('0x3a')](_0x399536['name'])&&!_[_0xf5e1('0x3a')](_0x399536[_0xf5e1('0x74')])&&_0x399536[_0xf5e1('0x74')]&&(this['trunks'][util[_0xf5e1('0x8e')]('SIP/%s',_0x399536[_0xf5e1('0x3c')])][_0xf5e1('0xa9')]===_0xf5e1('0xcd')||this[_0xf5e1('0x23')][util['format']('SIP/%s',_0x399536[_0xf5e1('0x3c')])][_0xf5e1('0xa9')]===_0xf5e1('0xce'));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xc4')]=function(_0x35b7f4,_0x781ad0,_0x3636d2){this[_0xf5e1('0xbf')](_0x35b7f4)[_0xf5e1('0xaa')](loggerCatch(_0x781ad0));this[_0xf5e1('0xbe')](_0x35b7f4)[_0xf5e1('0xaa')](loggerCatch(_0x3636d2));};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xcf')]=function(_0x36bc0f){var _0x356e1f=this[_0xf5e1('0xd0')][_0x36bc0f[_0xf5e1('0xd1')]];var _0x151bb5;if(!_[_0xf5e1('0xd2')](_0x36bc0f)&&!_[_0xf5e1('0xd2')](_0x36bc0f['variable'])&&!_['isNil'](_0x36bc0f[_0xf5e1('0xd3')][_0xf5e1('0xd4')])&&_0x36bc0f['exten']==='xcally-motion-dialer'&&_0x356e1f){if(_0x356e1f['type']!=='ivr'&&this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0xd5')]&&_0x36bc0f[_0xf5e1('0xd6')]==='HANGUP'){delete this['uniqueId'][_0x36bc0f[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]]);this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x58')]+=0x1;this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x57')]+=0x1;_0x151bb5=new Hangup(_0x356e1f,_0x36bc0f);_0x151bb5[_0xf5e1('0xa1')]=0x12;_0x151bb5[_0xf5e1('0xa2')]=_0xf5e1('0xd7');_0x151bb5[_0xf5e1('0xd8')]=_0xf5e1('0xd9');this[_0xf5e1('0xc4')](_0x151bb5,_0xf5e1('0xda'),_0xf5e1('0xdb'));}if(_0x356e1f[_0xf5e1('0x4b')]!==_0xf5e1('0x8c')&&this[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0xd5')]&&_0x36bc0f[_0xf5e1('0xd6')]===_0xf5e1('0xdc')){var _0x27aec3=this;return new BPromise(function(_0x1d8145,_0x5e58e2){delete _0x27aec3['uniqueId'][_0x36bc0f[_0xf5e1('0xd1')]];_0x27aec3[_0xf5e1('0xab')](_0x27aec3[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]]);_0x27aec3[_0xf5e1('0x20')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x58')]+=0x1;_0x27aec3[_0xf5e1('0x20')][_0x356e1f['queue']][_0xf5e1('0x57')]+=0x1;var _0x32bfd0=_0x27aec3['voiceQueues'][_0x356e1f[_0xf5e1('0xac')]];var _0x2a3a9d=new Hangup(_0x356e1f,_0x36bc0f);_0x2a3a9d[_0xf5e1('0xa1')]=0x13;_0x2a3a9d[_0xf5e1('0xa2')]='Machine';_0x2a3a9d[_0xf5e1('0xd8')]=_0xf5e1('0xd9');_0x2a3a9d[_0xf5e1('0xdd')]+=0x1;_0x2a3a9d['countglobal']+=0x1;_0x2a3a9d['amd']=!![];_0x27aec3[_0xf5e1('0xbf')](_0x2a3a9d)['catch'](loggerCatch(_0xf5e1('0xde')));if(_0x2a3a9d[_0xf5e1('0xdf')]+_0x2a3a9d[_0xf5e1('0xe0')]+_0x2a3a9d[_0xf5e1('0xe1')]+_0x2a3a9d[_0xf5e1('0xe2')]+_0x2a3a9d['countdropretry']+_0x2a3a9d['countabandonedretry']+_0x2a3a9d[_0xf5e1('0xdd')]+_0x2a3a9d[_0xf5e1('0xe3')]>=_0x32bfd0[_0xf5e1('0xe4')]){_0x27aec3[_0xf5e1('0xe5')](_0x2a3a9d,_0x1d8145,_0x5e58e2,'reason19\x20machine....');}else{if(_0x2a3a9d[_0xf5e1('0xdd')]>=_0x32bfd0[_0xf5e1('0xe6')]){_0x27aec3[_0xf5e1('0xe7')](_0x2a3a9d,_0x1d8145,_0x5e58e2,_0xf5e1('0xe8'));}else{_0x27aec3[_0xf5e1('0xb7')]({'active':![],'countmachineretry':_0x2a3a9d[_0xf5e1('0xdd')],'scheduledat':moment()[_0xf5e1('0xe9')](_0x32bfd0[_0xf5e1('0xea')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a3a9d[_0xf5e1('0xec')],'ListId':_0x2a3a9d[_0xf5e1('0xc6')],'VoiceQueueId':_0x2a3a9d[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2a3a9d['CampaignId']||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xed')));_0x1d8145({'reschedule':0x1});}}});}if(_0x356e1f[_0xf5e1('0x4b')]===_0xf5e1('0x8c')&&this['campaigns'][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0xd5')]&&_0x36bc0f[_0xf5e1('0xd6')]===_0xf5e1('0xee')){delete this[_0xf5e1('0xd0')][_0x36bc0f[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x21')][_0x356e1f['queue']]);_0x151bb5=new Hangup(_0x356e1f,_0x36bc0f);_0x151bb5['state']=0x12;_0x151bb5[_0xf5e1('0xa2')]='HangupInAMD';_0x151bb5[_0xf5e1('0xd8')]=_0xf5e1('0xd9');this[_0xf5e1('0xc4')](_0x151bb5,'[syncHangupInAMDIvr][createHistory]',_0xf5e1('0xef'));}if(_0x356e1f[_0xf5e1('0x4b')]==='ivr'&&this['campaigns'][_0x356e1f['queue']]['dialAMDActive']&&_0x36bc0f[_0xf5e1('0xd6')]===_0xf5e1('0xdc')){var _0x27aec3=this;return new BPromise(function(_0x50b08d,_0x3918e7){delete _0x27aec3['uniqueId'][_0x36bc0f[_0xf5e1('0xd1')]];_0x27aec3['updateOriginated'](_0x27aec3['campaigns'][_0x356e1f[_0xf5e1('0xac')]]);_0x27aec3[_0xf5e1('0x21')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x58')]+=0x1;_0x27aec3[_0xf5e1('0x21')][_0x356e1f[_0xf5e1('0xac')]][_0xf5e1('0x57')]+=0x1;var _0x18ee9c=_0x27aec3['campaigns'][_0x356e1f[_0xf5e1('0xac')]];var _0x5b6176=new Hangup(_0x356e1f,_0x36bc0f);_0x5b6176[_0xf5e1('0xa1')]=0x13;_0x5b6176['statedesc']=_0xf5e1('0xf0');_0x5b6176['membername']=_0xf5e1('0xd9');_0x5b6176[_0xf5e1('0xdd')]+=0x1;_0x5b6176[_0xf5e1('0xf1')]+=0x1;_0x5b6176[_0xf5e1('0xf2')]=!![];_0x27aec3['createHistory'](_0x5b6176)[_0xf5e1('0xaa')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5b6176['countbusyretry']+_0x5b6176['countcongestionretry']+_0x5b6176[_0xf5e1('0xe1')]+_0x5b6176[_0xf5e1('0xe2')]+_0x5b6176[_0xf5e1('0xf3')]+_0x5b6176['countabandonedretry']+_0x5b6176['countmachineretry']+_0x5b6176[_0xf5e1('0xe3')]>=_0x18ee9c[_0xf5e1('0xe4')]){_0x27aec3[_0xf5e1('0xe5')](_0x5b6176,_0x50b08d,_0x3918e7,_0xf5e1('0xf4'));}else{if(_0x5b6176['countmachineretry']>=_0x18ee9c[_0xf5e1('0xe6')]){_0x27aec3['createStateFinal'](_0x5b6176,_0x50b08d,_0x3918e7,_0xf5e1('0xe8'));}else{_0x27aec3[_0xf5e1('0xb7')]({'active':![],'countmachineretry':_0x5b6176[_0xf5e1('0xdd')],'scheduledat':moment()[_0xf5e1('0xe9')](_0x18ee9c[_0xf5e1('0xea')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x5b6176[_0xf5e1('0xec')],'ListId':_0x5b6176[_0xf5e1('0xc6')],'VoiceQueueId':_0x5b6176['VoiceQueueId']||undefined,'CampaignId':_0x5b6176[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xed')));_0x50b08d({'reschedule':0x1});}}});}}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xf7')]=function(_0x50112e){var _0x4dd3f6=this['uniqueId'][_0x50112e[_0xf5e1('0xd1')]];var _0x461af8=this;var _0x5c4de3;if(_0x4dd3f6&&_0x4dd3f6[_0xf5e1('0x4b')]==='ivr'){delete this[_0xf5e1('0xd0')][_0x50112e[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x21')][_0x4dd3f6['queue']]);this[_0xf5e1('0x21')][_0x4dd3f6[_0xf5e1('0xac')]][_0xf5e1('0xf8')]+=0x1;_0x5c4de3=new Hangup(_0x4dd3f6,_0x50112e);this[_0xf5e1('0xbf')](_0x5c4de3)['catch'](loggerCatch(_0xf5e1('0xf9')));this[_0xf5e1('0xbe')](_0x5c4de3)['catch'](loggerCatch(_0xf5e1('0xfa')));}if(_0x4dd3f6&&_0x4dd3f6['type']!==_0xf5e1('0x8c')&&isNotNull(this[_0xf5e1('0x20')][_0x4dd3f6['queue']][_0xf5e1('0xfb')])){delete this[_0xf5e1('0xd0')][_0x50112e[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x20')][_0x4dd3f6[_0xf5e1('0xac')]]);this[_0xf5e1('0x20')][_0x4dd3f6[_0xf5e1('0xac')]][_0xf5e1('0x58')]+=0x1;this[_0xf5e1('0x20')][_0x4dd3f6[_0xf5e1('0xac')]][_0xf5e1('0x57')]+=0x1;_0x5c4de3=new Hangup(_0x4dd3f6,_0x50112e);_0x5c4de3[_0xf5e1('0xa1')]=0x10;_0x5c4de3[_0xf5e1('0xa2')]=_0xf5e1('0xfc');_0x5c4de3[_0xf5e1('0xd8')]=_0xf5e1('0xfd');this[_0xf5e1('0xbf')](_0x5c4de3)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xf9')));this[_0xf5e1('0xbe')](_0x5c4de3)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xfa')));}if(_0x4dd3f6&&_0x4dd3f6[_0xf5e1('0x4b')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x4dd3f6[_0xf5e1('0xac')]][_0xf5e1('0xfb')])){delete this['uniqueId'][_0x50112e[_0xf5e1('0xd1')]];this['updateOriginated'](this[_0xf5e1('0x20')][_0x4dd3f6['queue']]);this[_0xf5e1('0x20')][_0x4dd3f6['queue']][_0xf5e1('0x61')]+=0x1;_0x5c4de3=new Hangup(_0x4dd3f6,_0x50112e);_0x5c4de3[_0xf5e1('0xa1')]=0xc;_0x5c4de3['statedesc']=_0x50112e[_0xf5e1('0xfe')];_0x5c4de3[_0xf5e1('0xd8')]='Unknow';this[_0xf5e1('0xbf')](_0x5c4de3)[_0xf5e1('0xaa')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf5e1('0xbe')](_0x5c4de3)['catch'](loggerCatch(_0xf5e1('0xfa')));}};Dialer[_0xf5e1('0x1c')]['syncAgentComplete']=function(_0x31b40f){var _0xc75e3c=this[_0xf5e1('0xd0')][_0x31b40f[_0xf5e1('0xd1')]];var _0x57e425=this;if(this[_0xf5e1('0x20')][_0x31b40f['queue']]){if(_0xc75e3c&&_0xc75e3c[_0xf5e1('0x4b')]!==_0xf5e1('0x8c')){delete this[_0xf5e1('0xd0')][_0x31b40f[_0xf5e1('0xd1')]];this['voiceQueues'][_0x31b40f['queue']][_0xf5e1('0x58')]+=0x1;var _0x48eb1d=new AgentComplete(_0xc75e3c,_0x31b40f);if(_0x31b40f[_0xf5e1('0xff')]===_0xf5e1('0x100')){_0x48eb1d['agiafterat']=this[_0xf5e1('0x20')][_0x31b40f['queue']][_0xf5e1('0x101')]&&this[_0xf5e1('0x20')][_0x31b40f[_0xf5e1('0xac')]][_0xf5e1('0x102')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xf5e1('0xbf')](_0x48eb1d)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x103')));this['moveContactManagedDialer'](_0x48eb1d)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x104')));}}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x2b')]=function(_0x5daab7){if(this[_0xf5e1('0x20')][_0x5daab7[_0xf5e1('0xac')]]){if(this[_0xf5e1('0xd0')][_0x5daab7['uniqueid']]&&this['uniqueId'][_0x5daab7[_0xf5e1('0xd1')]]['type']!==_0xf5e1('0x8c')){this[_0xf5e1('0xab')](this[_0xf5e1('0x20')][_0x5daab7[_0xf5e1('0xac')]]);this[_0xf5e1('0xd0')][_0x5daab7['uniqueid']][_0xf5e1('0x105')]=moment()[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xf5e1('0x1c')]['queueCallerAbandonCreateState']=function(_0x491fed){this[_0xf5e1('0xbf')](_0x491fed)['catch'](loggerCatch(_0xf5e1('0x103')));this[_0xf5e1('0xbe')](_0x491fed)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x106')));};Dialer[_0xf5e1('0x1c')]['syncQueueCallerAbandon']=function(_0x336b31){var _0x722ea1=this['uniqueId'][_0x336b31[_0xf5e1('0xd1')]];var _0x2db441=this;if(this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]]){if(_0x722ea1&&_0x722ea1[_0xf5e1('0x4b')]!==_0xf5e1('0x8c')){delete this['uniqueId'][_0x336b31[_0xf5e1('0xd1')]];this[_0xf5e1('0xab')](this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]]);_0x722ea1[_0xf5e1('0x107')]=moment()['format'](_0xf5e1('0xf5'));var _0x3eceda=new QueueCallerAbandon(_0x722ea1,_0x336b31);if(getSeconds(_0x722ea1[_0xf5e1('0x107')],_0x722ea1[_0xf5e1('0x108')])>=_0x722ea1['dialQueueTimeout']){this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x66')]+=0x1;this['voiceQueues'][_0x336b31[_0xf5e1('0xac')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x68')]+=0x1;_0x3eceda[_0xf5e1('0xa1')]=0xa;_0x3eceda[_0xf5e1('0xa2')]=_0xf5e1('0x109');_0x3eceda[_0xf5e1('0x10a')]=_0xf5e1('0x10b');_0x3eceda[_0xf5e1('0x10c')]=this[_0xf5e1('0x20')][_0x336b31['queue']]['dialQueueProject2']?moment()['format'](_0xf5e1('0xf5')):undefined;_0x3eceda['countdropretry']+=0x1;_0x3eceda[_0xf5e1('0xf1')]+=0x1;if(_0x3eceda[_0xf5e1('0xf3')]>=this['voiceQueues'][_0x336b31['queue']][_0xf5e1('0x10d')]){this[_0xf5e1('0x10e')](_0x3eceda);}else{this[_0xf5e1('0xb7')]({'active':![],'countdropretry':_0x3eceda['countdropretry'],'scheduledat':moment()[_0xf5e1('0xe9')](this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x10f')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x722ea1[_0xf5e1('0xec')],'ListId':_0x722ea1[_0xf5e1('0xc6')],'VoiceQueueId':_0x722ea1[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x722ea1[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x110')));var _0x29b74d=new History(_0x3eceda);_0x29b74d[_0xf5e1('0xa1')]=0xa;_0x29b74d[_0xf5e1('0xa2')]=_0xf5e1('0x109');_0x29b74d[_0xf5e1('0xa4')]=moment()[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');_0x29b74d[_0xf5e1('0xa3')]=_0x29b74d['starttime'];_0x29b74d['calleridname']=_0x3eceda['calleridname'];_0x29b74d[_0xf5e1('0x111')]=_0x3eceda[_0xf5e1('0x111')];this[_0xf5e1('0xbf')](_0x29b74d)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x112')));}}else{this[_0xf5e1('0x20')][_0x336b31['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xf5e1('0x20')][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x5c')]+=0x1;_0x3eceda[_0xf5e1('0xa1')]=0xb;_0x3eceda[_0xf5e1('0xa2')]=_0xf5e1('0x113');_0x3eceda['dropreason']='CALLEREXIT';_0x3eceda[_0xf5e1('0x114')]+=0x1;_0x3eceda[_0xf5e1('0xf1')]+=0x1;if(_0x3eceda[_0xf5e1('0x114')]>=this['voiceQueues'][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x115')]){this['queueCallerAbandonCreateState'](_0x3eceda);}else{this[_0xf5e1('0xb7')]({'active':![],'countabandonedretry':_0x3eceda['countabandonedretry'],'scheduledat':moment()[_0xf5e1('0xe9')](this['voiceQueues'][_0x336b31[_0xf5e1('0xac')]][_0xf5e1('0x116')],'minutes')[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x722ea1[_0xf5e1('0xec')],'ListId':_0x722ea1['ListId'],'VoiceQueueId':_0x722ea1[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x722ea1[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x117')));var _0x29b74d=new History(_0x3eceda);_0x29b74d[_0xf5e1('0xa1')]=0xb;_0x29b74d[_0xf5e1('0xa2')]=_0xf5e1('0x113');_0x29b74d[_0xf5e1('0xa4')]=moment()[_0xf5e1('0x8e')](_0xf5e1('0xf5'));_0x29b74d[_0xf5e1('0xa3')]=_0x29b74d[_0xf5e1('0xa4')];_0x29b74d[_0xf5e1('0x118')]=_0x3eceda[_0xf5e1('0x118')];_0x29b74d[_0xf5e1('0x111')]=_0x3eceda['calleridnum'];this[_0xf5e1('0xbf')](_0x29b74d)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x119')));}}}}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x35')]=function(_0x29b2f1){if(this[_0xf5e1('0xa8')][_0x29b2f1['uniqueid']]){this['actions'][_0x29b2f1['uniqueid']][_0xf5e1('0x11a')]=_0x29b2f1[_0xf5e1('0x11a')];}if(this[_0xf5e1('0xd0')][_0x29b2f1[_0xf5e1('0xd1')]]){this[_0xf5e1('0xd0')][_0x29b2f1[_0xf5e1('0xd1')]][_0xf5e1('0x11a')]=_0x29b2f1[_0xf5e1('0x11a')];}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x11b')]=function(_0x30d74e){if(strategy[this['voiceQueues'][this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]]['queue']][_0xf5e1('0x4d')]]===_0xf5e1('0x1b')){if(this['actions'][_0x30d74e[_0xf5e1('0x11c')]]&&_[_0xf5e1('0xd2')](this['actions'][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0x11d')])&&_0x30d74e[_0xf5e1('0xa9')]==='1'&&_0x30d74e['paused']==='0'){if(this[_0xf5e1('0x22')][_0x30d74e['stateinterface']]){if(!this[_0xf5e1('0x22')][_0x30d74e[_0xf5e1('0x11e')]][_0xf5e1('0x11d')]){this['agents'][_0x30d74e[_0xf5e1('0x11e')]]['locked']=!![];this['actions'][_0x30d74e['actionid']]['locked']=!![];this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0x11e')]=_0x30d74e[_0xf5e1('0x11e')];}}}}else if((strategy[this[_0xf5e1('0x20')][this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0xac')]][_0xf5e1('0x4d')]]||_0xf5e1('0x1a'))===_0xf5e1('0x1a')){if(this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]]){if(this[_0xf5e1('0x22')][_0x30d74e[_0xf5e1('0x11e')]]){this['actions'][_0x30d74e[_0xf5e1('0x11c')]]['stateinterface']=_0x30d74e['stateinterface'];if(_[_0xf5e1('0xd2')](this[_0xf5e1('0x28')][this[_0xf5e1('0xa8')][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0xac')]])){this[_0xf5e1('0x28')][this[_0xf5e1('0xa8')][_0x30d74e['actionid']]['queue']]=[];}this[_0xf5e1('0x28')][this['actions'][_0x30d74e[_0xf5e1('0x11c')]][_0xf5e1('0xac')]][_0xf5e1('0x11f')](_[_0xf5e1('0xc5')](_[_0xf5e1('0x120')](this[_0xf5e1('0xa8')][_0x30d74e['actionid']],[_0xf5e1('0x121'),_0xf5e1('0x11e')]),{'status':_0x30d74e['status'],'paused':_0x30d74e[_0xf5e1('0x122')]}));}}}};function unlockQueueStatus(_0xa94dc5,_0x465178){setTimeout(function(){if(_[_0xf5e1('0x3a')](_0xa94dc5[_0xf5e1('0x123')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x465178);}_0xa94dc5['queueStatusComplete']=!![];loggerBooked['info'](_0xf5e1('0x124'),_0x465178,JSON[_0xf5e1('0x125')](_[_0xf5e1('0x120')](_0xa94dc5,[_0xf5e1('0x3c'),_0xf5e1('0x123')])));},0x1f3);}Dialer['prototype'][_0xf5e1('0x126')]=function(_0x25108a){var _0x571413=this;var _0x52be65=_0x571413['voiceQueues'][_0x571413['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]];if(strategy[this[_0xf5e1('0x20')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]['strategy']]===_0xf5e1('0x1b')){if(this['actions'][_0x25108a[_0xf5e1('0x11c')]]&&this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0x11e')]){this[_0xf5e1('0x8b')][_0xf5e1('0x127')](this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0x121')],this[_0xf5e1('0xa8')][_0x25108a['actionid']][_0xf5e1('0x11e')])[_0xf5e1('0xaa')](function(_0x113c75){logger[_0xf5e1('0x90')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xf5e1('0x91')](_0x113c75,{'showHidden':![],'depth':null}));})[_0xf5e1('0x128')](function(){_0x571413[_0xf5e1('0xab')](_0x571413['voiceQueues'][_0x571413[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]);_0x571413[_0xf5e1('0x22')][_0x571413['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0x11e')]]['locked']=![];delete _0x571413[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]];unlockQueueStatus(_0x52be65);});}else{this[_0xf5e1('0xab')](this['voiceQueues'][this['actions'][_0x25108a['actionid']][_0xf5e1('0xac')]]);this[_0xf5e1('0xb7')]({'active':![],'ContactId':this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xec')],'ListId':this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]]['ListId'],'VoiceQueueId':this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xc8')]||undefined,'CampaignId':this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]]['CampaignId']||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x129')));delete this[_0xf5e1('0xa8')][_0x25108a['actionid']];unlockQueueStatus(_0x52be65);}}else if((strategy[this[_0xf5e1('0x20')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]][_0xf5e1('0x4d')]]||'rrmemory')===_0xf5e1('0x1a')){var _0x1df5ce;if(this['actions'][_0x25108a['actionid']]&&!_[_0xf5e1('0x44')](this[_0xf5e1('0x28')][this['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]])){if(this['queueBookedRR'][_0x571413[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]]['queue']]){this[_0xf5e1('0x29')][_0x571413['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]=this[_0xf5e1('0x29')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]?this[_0xf5e1('0x29')][this['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]:this[_0xf5e1('0x28')][this[_0xf5e1('0xa8')][_0x25108a['actionid']]['queue']]?this[_0xf5e1('0x28')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]][_0xf5e1('0x12a')]||0x0:0x0;}this[_0xf5e1('0x28')][this['actions'][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]]['_rr']=this[_0xf5e1('0x29')][this[_0xf5e1('0xa8')][_0x25108a[_0xf5e1('0x11c')]][_0xf5e1('0xac')]];for(var _0x4a14b1=0x0;_0x4a14b1=0x0?!![]:![];})[_0xf5e1('0xaa')](myreject(_0xcec10f)));}}else{_0x48ae28[_0xf5e1('0x11f')](ami['Action']({'action':_0xf5e1('0x141'),'command':util[_0xf5e1('0x8e')](_0xf5e1('0x142'),_0x405306,!_[_0xf5e1('0x3a')](config[_0xf5e1('0x13d')][_0x3a49cf])?_0x3a49cf:'')})['then'](function(_0x697470){return _0x697470[_0xf5e1('0x144')][_0xf5e1('0x145')](_0xf5e1('0x146'))>=0x0?!![]:![];})[_0xf5e1('0xaa')](myreject(_0xcec10f)));}BPromise[_0xf5e1('0x147')](_0x48ae28)[_0xf5e1('0xb2')](function(_0x83ed10){var _0x4dec40=_['some'](_0x83ed10);if(_0x4dec40){return _0x242437(_0x4dec40);}else{_0x31d5c8[_0xf5e1('0x3e')]=_0x2a0d5e?_0xf5e1('0x148'):_0xf5e1('0x149');return _0xcec10f(msgResponse(_0xf5e1('0x14a'),_0xf5e1('0x13a'),'Global:\x20'+_0x2a0d5e+'\x20'+_0x2931be+'\x20Interval\x20is\x20overtime:\x20'+util[_0xf5e1('0x91')](_0x405306,{'showHidden':![],'depth':null})+_0xf5e1('0x14b')+_0x3a49cf));}})[_0xf5e1('0xaa')](function(_0x58591e){return _0xcec10f(msgResponse(_0xf5e1('0x139'),'Failure',JSON[_0xf5e1('0x125')](_0x58591e)));});});};Dialer['prototype'][_0xf5e1('0x14c')]=function(_0x4788dc){var _0x41b083=this;return function(){switch(_0x4788dc['dialMethod']){case _0xf5e1('0x14d'):freeVariablesPredictive(_0x4788dc);_0x41b083[_0xf5e1('0x14e')](_0x4788dc,0x1);break;case _0xf5e1('0x14f'):freeVariablesPredictive(_0x4788dc);_0x41b083['handlePower'](_0x4788dc,_0x4788dc[_0xf5e1('0x150')]);break;case _0xf5e1('0xb'):_0x41b083['predictive'](_0x4788dc);break;case'booked':freeVariablesPredictive(_0x4788dc);_0x41b083[_0xf5e1('0x14e')](_0x4788dc,0x1);break;default:freeVariablesPredictive(_0x4788dc);logger[_0xf5e1('0x90')](_0xf5e1('0x151'),_0x4788dc[_0xf5e1('0x3c')],_0xf5e1('0x152'));}};};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x153')]=function(_0x179afb){var _0x2c0cf8=this;return function(){_0x2c0cf8[_0xf5e1('0x154')](_0x179afb);};};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x32')]=function(_0x253643){var _0x1faf12=this;if(isNotPreview(_0x253643['dialMethod'])){if(isVoiceQueueOutbound(_0x253643[_0xf5e1('0x4b')])&&isActive(_0x253643['dialActive'])){_0x253643[_0xf5e1('0x9a')]=!![];BPromise[_0xf5e1('0xaf')]()[_0xf5e1('0xb2')](checkIsLoggedIn(_0x253643,_0x253643[_0xf5e1('0x4f')]))['then'](checkIsActive(_0x253643,_0x253643[_0xf5e1('0x54')]))[_0xf5e1('0xb2')](checkInterval(_0x253643))[_0xf5e1('0xb2')](_0x1faf12['checkIsTrunkReachable'](_0x253643))[_0xf5e1('0xb2')](_0x1faf12[_0xf5e1('0x138')](_0x253643[_0xf5e1('0x155')],_0x253643['dialTimezone'],_0x253643['name'],_0x253643))[_0xf5e1('0xb2')](_0x1faf12[_0xf5e1('0x156')](_0x253643[_0xf5e1('0x40')],_0x253643[_0xf5e1('0x157')],_0x253643[_0xf5e1('0x3c')],_0x253643))[_0xf5e1('0xb2')](_0x1faf12[_0xf5e1('0x14c')](_0x253643))[_0xf5e1('0xaa')](loggerCatchQueueSummary(_0xf5e1('0x158'),_0x253643));}else{notSendMessagesQueue(_0x253643);}}else{freeVariablesPredictive(_0x253643);}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x134')]=function(){var _0x15b095=this;var _0x9444b8;for(var _0x58f9df in this['campaigns']){if(this[_0xf5e1('0x21')][_0xf5e1('0x93')](_0x58f9df)){_0x9444b8=this[_0xf5e1('0x21')][_0x58f9df];if(isCampaignIvr(_0x9444b8[_0xf5e1('0x4b')])&&isActive(_0x9444b8[_0xf5e1('0x74')])){_0x9444b8[_0xf5e1('0x9a')]=!![];BPromise[_0xf5e1('0xaf')]()['then'](checkIsActive(_0x9444b8,_0x9444b8[_0xf5e1('0x74')]))[_0xf5e1('0xb2')](checkInterval(_0x9444b8))['then'](_0x15b095['checkIsTrunkReachable'](_0x9444b8))[_0xf5e1('0xb2')](_0x15b095[_0xf5e1('0x138')](_0x9444b8['dialGlobalInterval'],_0x9444b8[_0xf5e1('0x157')],_0x9444b8[_0xf5e1('0x3c')],_0x9444b8))[_0xf5e1('0xb2')](_0x15b095['checkIfTimeIntervals'](_0x9444b8[_0xf5e1('0x40')],_0x9444b8[_0xf5e1('0x157')],_0x9444b8[_0xf5e1('0x3c')],_0x9444b8))[_0xf5e1('0xb2')](_0x15b095['launchHandleIvr'](_0x9444b8))['catch'](loggerCatchQueueSummary(_0xf5e1('0x159'),_0x9444b8));}else{notSendMessagesCampaign(_0x9444b8);}}}};function getCallerIdRandom(_0x2cd7b4,_0x70bdc9){var _0x22a03b,_0x1ddae7,_0x34fad9;if(_0x70bdc9<=0x0){_0x70bdc9=0x1;}_0x22a03b=new RegExp('\x5cw{0,'+_0x70bdc9+'}$');_0x1ddae7=Math['pow'](0xa,_0x70bdc9-0x1);_0x34fad9=Math[_0xf5e1('0x15a')](0xa,_0x70bdc9)-0x1;return util[_0xf5e1('0x8e')]('%s',_[_0xf5e1('0x15b')](_0x2cd7b4,_0x22a03b,_[_0xf5e1('0x15c')](_0x1ddae7,_0x34fad9)));}function extractCalleridName(_0x44becd){var _0x2a9bf0=_0x44becd[_0xf5e1('0x15d')](/"(.*?)"/);return _0x2a9bf0?_0x2a9bf0[0x1]:_0x44becd;}function extractCalleridNumber(_0x8e658b){var _0x5f0c9e=_0x8e658b['match'](/<(.*?)>/);return _0x5f0c9e?_0x5f0c9e[0x1]:_0x8e658b;}Dialer[_0xf5e1('0x1c')][_0xf5e1('0x15e')]=function(_0x4e5959,_0x4573b9){var _0x441246=this;var _0x1630e6=uuid['v4']();this['actions'][_0x1630e6]=new Action(_0x4e5959,_0x4573b9,_0x1630e6);return new BPromise(function(_0x4d4eed,_0x3a76a7){if(_['isUndefined'](_0x4e5959)&&_0xf5e1('0x15f')!==typeof _0x4e5959){return _0x3a76a7(msgResponse('originate',_0xf5e1('0x13a'),_0xf5e1('0x160')));}if(_[_0xf5e1('0x3a')](_0x4573b9[_0xf5e1('0x161')]['phone'])||_0x4573b9[_0xf5e1('0x161')][_0xf5e1('0x162')]===null){return _0x3a76a7(msgResponse('originate',_0xf5e1('0x13a'),'contact\x20is\x20undefine'));}var _0x204781={'XMD-CALLERID':_0x441246[_0xf5e1('0xa8')][_0x1630e6][_0xf5e1('0x163')](),'XMD-AGI':_0x4e5959[_0xf5e1('0xfb')]?util[_0xf5e1('0x8e')](_0xf5e1('0x164'),ipAgi,_0x4e5959[_0xf5e1('0xfb')]):_0xf5e1('0x165'),'XMD-AGIAFTER':_0x4e5959[_0xf5e1('0x101')]?util[_0xf5e1('0x8e')](_0xf5e1('0x164'),ipAgi,_0x4e5959[_0xf5e1('0x101')]):_0xf5e1('0x165'),'XMD-QUEUE':_0x4e5959['type']==='outbound'?util[_0xf5e1('0x8e')](_0xf5e1('0x166'),_0x4e5959[_0xf5e1('0x3c')],_0x4e5959[_0xf5e1('0x167')]||'',_0x4e5959['dialAgiAfterHangupAgent']?'c':'',_0x4e5959[_0xf5e1('0x168')]||0x3):_0xf5e1('0x165'),'XMD-CONTACTID':_0x4573b9[_0xf5e1('0xec')],'XMD-CDRTYPE':_0xf5e1('0xa'),'CALLERID(all)':_0x441246[_0xf5e1('0xa8')][_0x1630e6][_0xf5e1('0x163')](),'XMD-AMD':_0x4e5959[_0xf5e1('0xd5')]?_0xf5e1('0x169'):_0xf5e1('0x165'),'XMD-DESTINATION':_0xf5e1('0x16a')};if(_0x4e5959['dialAMDActive']){_0x204781[_0xf5e1('0x16b')]=_0x4e5959[_0xf5e1('0x16c')]||0x9c4;_0x204781[_0xf5e1('0x16d')]=_0x4e5959['dialAMDGreeting']||0x5dc;_0x204781[_0xf5e1('0x16e')]=_0x4e5959[_0xf5e1('0x16f')]||0x320;_0x204781[_0xf5e1('0x170')]=_0x4e5959[_0xf5e1('0x171')]||0x1388;_0x204781[_0xf5e1('0x172')]=_0x4e5959['dialAMDMinWordLength']||0x64;_0x204781[_0xf5e1('0x173')]=_0x4e5959['dialAMDBetweenWordsSilence']||0x32;_0x204781[_0xf5e1('0x174')]=_0x4e5959[_0xf5e1('0x175')]||0x3;_0x204781[_0xf5e1('0x176')]=_0x4e5959[_0xf5e1('0x177')]||0x100;_0x204781[_0xf5e1('0x178')]=_0x4e5959[_0xf5e1('0x179')]||0x1388;}if(_0x4e5959[_0xf5e1('0x4b')]==='outbound'){_0x204781[_0xf5e1('0x17a')]=_0x4573b9['VoiceQueueId'];}else{_0x204781[_0xf5e1('0x17b')]=_0x4573b9[_0xf5e1('0xf6')];}for(var _0x220858 in _0x4573b9[_0xf5e1('0x161')]){if(_0x4573b9[_0xf5e1('0x161')]['hasOwnProperty'](_0x220858)){if(isNotNull(_0x4573b9[_0xf5e1('0x161')][_0x220858])&&_0x220858!=='id'&&_0x220858!=='tags'&&_0x220858!==_0xf5e1('0x17c')&&_0x220858!==_0xf5e1('0x17d')){_0x204781[util[_0xf5e1('0x8e')](_0xf5e1('0x17e'),'XMD-',_[_0xf5e1('0x17f')](_0x220858))]=_0x4573b9[_0xf5e1('0x161')][_0x220858];}}}var _0x5ebc92=_0x441246[_0xf5e1('0xcc')](_0x4e5959['Trunk'])?getCallerId(_0x4e5959[_0xf5e1('0x73')]['callerid'],_0x4e5959[_0xf5e1('0x56')],_0x4e5959[_0xf5e1('0x180')]>0x0?getCallerIdRandom(_0x4e5959[_0xf5e1('0x181')],_0x4e5959[_0xf5e1('0x180')]):_0x4e5959['dialOriginateCallerIdNumber']):getCallerId(_[_0xf5e1('0xd2')](_0x4e5959[_0xf5e1('0x136')])?_0x4e5959[_0xf5e1('0x73')][_0xf5e1('0x75')]:_0x4e5959[_0xf5e1('0x136')][_0xf5e1('0x75')],_0x4e5959[_0xf5e1('0x56')],_0x4e5959[_0xf5e1('0x180')]>0x0?getCallerIdRandom(_0x4e5959[_0xf5e1('0x181')],_0x4e5959[_0xf5e1('0x180')]):_0x4e5959[_0xf5e1('0x181')]);if(_0x5ebc92){_0x204781[_0xf5e1('0x182')]=_0x441246[_0xf5e1('0xa8')][_0x1630e6][_0xf5e1('0x183')]=extractCalleridName(_0x5ebc92);_0x204781[_0xf5e1('0x184')]=_0x441246[_0xf5e1('0xa8')][_0x1630e6][_0xf5e1('0x185')]=extractCalleridNumber(_0x5ebc92);}return ami[_0xf5e1('0x140')]({'actionid':_0x1630e6,'action':_0xf5e1('0x186'),'channel':_0x441246[_0xf5e1('0xcc')](_0x4e5959[_0xf5e1('0x73')])?util['format'](_0xf5e1('0x187'),_0x4e5959[_0xf5e1('0x73')][_0xf5e1('0x3c')],isNotNull(_0x4e5959[_0xf5e1('0x188')])?_0x4e5959[_0xf5e1('0x188')]['trim']()||'':'',_0x4e5959[_0xf5e1('0x189')]>0x0?_0x4573b9[_0xf5e1('0x161')][_0xf5e1('0x162')][_0xf5e1('0x18a')](_0x4e5959[_0xf5e1('0x189')]):_0x4573b9[_0xf5e1('0x161')]['phone']):util['format']('SIP/%s/%s%s',_[_0xf5e1('0xd2')](_0x4e5959[_0xf5e1('0x136')])?_0x4e5959[_0xf5e1('0x73')][_0xf5e1('0x3c')]:_0x4e5959[_0xf5e1('0x136')][_0xf5e1('0x3c')],isNotNull(_0x4e5959[_0xf5e1('0x188')])?_0x4e5959[_0xf5e1('0x188')][_0xf5e1('0x18b')]()||'':'',_0x4e5959[_0xf5e1('0x189')]>0x0?_0x4573b9['Contact'][_0xf5e1('0x162')]['substring'](_0x4e5959[_0xf5e1('0x189')]):_0x4573b9['Contact']['phone']),'callerid':_0x5ebc92,'Exten':_0xf5e1('0x16a'),'Context':_0xf5e1('0x18c'),'Priority':'1','variable':_0x204781,'timeout':(_0x4e5959[_0xf5e1('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1630e6})[_0xf5e1('0xb2')](function(_0x443b11){return _0x4d4eed(_0x443b11);})[_0xf5e1('0xaa')](function(_0x1f5cdd){_0x4e5959[_0xf5e1('0x5f')]+=0x1;var _0x36e276=new History(_0x441246[_0xf5e1('0xa8')][_0x1630e6]);logger[_0xf5e1('0x90')](util[_0xf5e1('0x8e')]('[originateError]:\x20%s',JSON[_0xf5e1('0x125')](_0x1f5cdd)));_0x36e276['state']=0xe;_0x36e276['statedesc']=_0xf5e1('0x18e');_0x36e276['starttime']=moment()[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');_0x36e276['endtime']=_0x36e276[_0xf5e1('0xa4')];_0x441246[_0xf5e1('0xbf')](_0x36e276)[_0xf5e1('0xaa')](loggerCatch('[originate][error]'));_0x441246['moveContactManagedDialer'](_0x36e276)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x18f')))[_0xf5e1('0x128')](function(){delete _0x441246[_0xf5e1('0xa8')][_0x1630e6];return _0x3a76a7(msgResponse(_0xf5e1('0x186'),_0xf5e1('0x46'),_0xf5e1('0x190')));});});});};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x2e')]=function(_0x2a3e99){var _0x3e0d2f=this[_0xf5e1('0xa8')][_0x2a3e99[_0xf5e1('0x11c')]];var _0x53e770=this;if(_0x3e0d2f){delete this[_0xf5e1('0xa8')][_0x2a3e99[_0xf5e1('0x11c')]];_0x3e0d2f[_0xf5e1('0x108')]=moment()[_0xf5e1('0x8e')](_0xf5e1('0xf5'));var _0x10c73f=_0x3e0d2f['type']===_0xf5e1('0x8c')?this[_0xf5e1('0x21')][_0x3e0d2f['queue']]:this[_0xf5e1('0x20')][_0x3e0d2f['getQueue']()];if(!this['isSuccess'](_0x2a3e99['response'])){this['updateOriginated'](_0x10c73f);return this[_0xf5e1('0x191')](_0x3e0d2f,_0x10c73f,_0x2a3e99)[_0xf5e1('0xb2')](function(_0x21e109){})['catch'](loggerCatch(_0xf5e1('0x192')));}else{this[_0xf5e1('0xd0')][_0x2a3e99[_0xf5e1('0xd1')]]=_0x3e0d2f;}}};Dialer[_0xf5e1('0x1c')]['checkRetriveMax']=function(_0x1fc793,_0x4d7449,_0x26e35a){var _0x2df2ff=new History(_0x4d7449);if(_0x2df2ff['countbusyretry']+_0x2df2ff[_0xf5e1('0xe0')]+_0x2df2ff[_0xf5e1('0xe1')]+_0x2df2ff[_0xf5e1('0xe2')]+_0x2df2ff['countdropretry']+_0x2df2ff[_0xf5e1('0x114')]+_0x2df2ff[_0xf5e1('0xdd')]+_0x2df2ff[_0xf5e1('0xe3')]>=_0x26e35a[_0xf5e1('0xe4')]-0x1){return!![];}switch(_0x1fc793){case 0x3:if(_0x2df2ff[_0xf5e1('0xe1')]>=_0x26e35a[_0xf5e1('0x193')]-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countnoanswerretry':_0x2df2ff[_0xf5e1('0xe1')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a[_0xf5e1('0x194')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2df2ff['ContactId'],'ListId':_0x2df2ff['ListId'],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x195')));}break;case 0x5:if(_0x2df2ff[_0xf5e1('0xdf')]>=_0x26e35a[_0xf5e1('0x196')]-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countbusyretry':_0x2df2ff[_0xf5e1('0xdf')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a[_0xf5e1('0x197')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff['CampaignId']||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x198')));}break;case 0x8:if(_0x2df2ff['countcongestionretry']>=_0x26e35a[_0xf5e1('0x199')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x2df2ff[_0xf5e1('0xe0')]+=0x1,'scheduledat':moment()['add'](_0x26e35a[_0xf5e1('0x19a')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff['ContactId'],'ListId':_0x2df2ff['ListId'],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x2df2ff[_0xf5e1('0xe2')]>=_0x26e35a['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countnosuchnumberretry':_0x2df2ff[_0xf5e1('0xe2')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a['dialNoSuchNumberRetryFrequency'],_0xf5e1('0xeb'))[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff['ContactId'],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})['catch'](loggerCatch(_0xf5e1('0x19b')));}break;case 0xa:if(_0x2df2ff[_0xf5e1('0xf3')]>=_0x26e35a[_0xf5e1('0x10d')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x2df2ff['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x26e35a[_0xf5e1('0x10f')],_0xf5e1('0xeb'))[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff['VoiceQueueId']||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})['catch'](loggerCatch(_0xf5e1('0x110')));}break;case 0xb:if(_0x2df2ff['countabandonedretry']>=_0x26e35a[_0xf5e1('0x115')]-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countabandonedretry':_0x2df2ff[_0xf5e1('0x114')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a['dialAbandonedRetryFrequency'],_0xf5e1('0xeb'))['format'](_0xf5e1('0xf5')),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x2df2ff[_0xf5e1('0xdd')]>=_0x26e35a['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countmachineretry':_0x2df2ff[_0xf5e1('0xdd')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a[_0xf5e1('0xea')],'minutes')[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x2df2ff['CampaignId']||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xed')));}break;case 0x14:if(_0x2df2ff[_0xf5e1('0xe3')]>=_0x26e35a[_0xf5e1('0x19c')]-0x1){return!![];}else{this[_0xf5e1('0xb7')]({'active':![],'countagentrejectretry':_0x2df2ff[_0xf5e1('0xe3')]+=0x1,'scheduledat':moment()[_0xf5e1('0xe9')](_0x26e35a['dialAgentRejectRetryFrequency'],'minutes')[_0xf5e1('0x8e')](_0xf5e1('0xf5')),'ContactId':_0x2df2ff[_0xf5e1('0xec')],'ListId':_0x2df2ff[_0xf5e1('0xc6')],'VoiceQueueId':_0x2df2ff['VoiceQueueId']||undefined,'CampaignId':_0x2df2ff[_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x19d')));}break;default:return!![];}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x191')]=function(_0x90df4a,_0x432b51,_0x26c034){var _0xda0813=this;var _0x2e22bb=new History(_0x90df4a);return new BPromise(function(_0x3c8b33,_0x1f51d1){if(_[_0xf5e1('0x3a')](_0x432b51)&&'object'!==typeof _0x432b51){return _0x1f51d1(msgResponse(_0xf5e1('0x19e'),_0xf5e1('0x13a'),_0xf5e1('0x19f')));}if(_[_0xf5e1('0x3a')](_0x26c034)&&_0xf5e1('0x15f')!==typeof _0x26c034){return _0x1f51d1(msgResponse(_0xf5e1('0x19e'),_0xf5e1('0x13a'),'evt\x20is\x20undefine'));}switch(_0x26c034['reason']){case'0':_0x432b51[_0xf5e1('0x5e')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0x0;_0x2e22bb[_0xf5e1('0xa2')]=_0xf5e1('0x1a0');_0x2e22bb['countnosuchnumberretry']+=0x1;_0x2e22bb['countglobal']+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0xf5e1('0x1a1')](_0x90df4a,'nosuchnumber'));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0xde')));if(_0xda0813[_0xf5e1('0x1a2')](0x0,_0x90df4a,_0x432b51)){if(_0x2e22bb[_0xf5e1('0xe2')]>=_0x432b51[_0xf5e1('0x1a3')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1a4'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1a4'));}}break;case'3':_0x432b51['outboundNoAnswerCallsDay']+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0x3;_0x2e22bb[_0xf5e1('0xa2')]='NoAnswer';_0x2e22bb[_0xf5e1('0xe1')]+=0x1;_0x2e22bb[_0xf5e1('0xf1')]+=0x1;ami[_0xf5e1('0x4a')]('custom:agentnoanswer',ut[_0xf5e1('0x1a1')](_0x90df4a,_0xf5e1('0x1a5')));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0xda0813[_0xf5e1('0x1a2')](0x3,_0x90df4a,_0x432b51)){if(_0x2e22bb['countnoanswerretry']>=_0x432b51[_0xf5e1('0x193')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1a6'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x432b51[_0xf5e1('0x5a')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0x5;_0x2e22bb[_0xf5e1('0xa2')]=_0xf5e1('0x1a7');_0x2e22bb[_0xf5e1('0xdf')]+=0x1;_0x2e22bb[_0xf5e1('0xf1')]+=0x1;ami[_0xf5e1('0x4a')](_0xf5e1('0x1a8'),ut['buildObj'](_0x90df4a,'busy'));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1a9')));if(_0xda0813[_0xf5e1('0x1a2')](0x5,_0x90df4a,_0x432b51)){if(_0x2e22bb['countbusyretry']>=_0x432b51[_0xf5e1('0x196')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1aa'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1aa'));}}break;case'8':_0x432b51[_0xf5e1('0x1ab')]+=0x1;_0x2e22bb['state']=0x8;_0x2e22bb[_0xf5e1('0xa2')]=_0xf5e1('0x1ac');_0x2e22bb[_0xf5e1('0xe0')]+=0x1;_0x2e22bb[_0xf5e1('0xf1')]+=0x1;ami[_0xf5e1('0x4a')](_0xf5e1('0x1ad'),ut[_0xf5e1('0x1a1')](_0x90df4a,_0xf5e1('0x1ae')));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1af')));if(_0xda0813[_0xf5e1('0x1a2')](0x8,_0x90df4a,_0x432b51)){if(_0x2e22bb['countcongestionretry']>=_0x432b51[_0xf5e1('0x199')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1b0'));}else{_0xda0813['stateGlobal'](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1b0'));}}break;case'11':_0x432b51[_0xf5e1('0x1b1')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0xb;_0x2e22bb['statedesc']=_0xf5e1('0x113');_0x2e22bb[_0xf5e1('0x114')]+=0x1;_0x2e22bb[_0xf5e1('0xf1')]+=0x1;_0xda0813['createHistory'](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x119')));if(_0xda0813[_0xf5e1('0x1a2')](0xb,_0x90df4a,_0x432b51)){if(_0x2e22bb[_0xf5e1('0x114')]>=_0x432b51[_0xf5e1('0x115')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1b2'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,'reason\x2011\x20abandoned');}}break;case'20':_0x432b51[_0xf5e1('0x60')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0x14;_0x2e22bb['statedesc']='AgentReject';_0x2e22bb[_0xf5e1('0xe3')]+=0x1;_0x2e22bb['countglobal']+=0x1;ami[_0xf5e1('0x4a')]('custom:agentreject',ut[_0xf5e1('0x1a1')](_0x90df4a,_0xf5e1('0x1b3')));_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1b4')));if(_0xda0813['checkRetriveMax'](0x14,_0x90df4a,_0x432b51)){if(_0x2e22bb[_0xf5e1('0xe3')]>=_0x432b51[_0xf5e1('0x19c')]){_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0xf5e1('0x1b5'));}else{_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,'reason\x2020\x20agentreject');}}break;default:_0x432b51[_0xf5e1('0x61')]+=0x1;_0x2e22bb[_0xf5e1('0xa1')]=0xc;_0x2e22bb[_0xf5e1('0xa2')]=_0x26c034[_0xf5e1('0xff')];_0xda0813[_0xf5e1('0xbf')](_0x2e22bb)[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1b6')));if(_0xda0813[_0xf5e1('0x1a2')](_0x26c034['reason'],_0x90df4a,_0x432b51)){if(_0x2e22bb[_0xf5e1('0xdf')]+_0x2e22bb['countcongestionretry']+_0x2e22bb['countnoanswerretry']+_0x2e22bb[_0xf5e1('0xe2')]+_0x2e22bb[_0xf5e1('0xf3')]+_0x2e22bb['countabandonedretry']+_0x2e22bb[_0xf5e1('0xdd')]+_0x2e22bb[_0xf5e1('0xe3')]>=_0x432b51[_0xf5e1('0xe4')]){_0xda0813[_0xf5e1('0xe5')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0x26c034[_0xf5e1('0xff')]);}else{_0xda0813[_0xf5e1('0xe7')](_0x2e22bb,_0x3c8b33,_0x1f51d1,_0x26c034[_0xf5e1('0xff')]);}}}});};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xe5')]=function(_0x3da6d2,_0x3f89b8,_0x525b3b,_0x5bb564){var _0xf2124=new Final(_0x3da6d2);_0xf2124[_0xf5e1('0xa1')]=0xf;_0xf2124[_0xf5e1('0xa2')]='Global';this[_0xf5e1('0xe7')](_0xf2124,_0x3f89b8,_0x525b3b,_0x5bb564);};Dialer[_0xf5e1('0x1c')][_0xf5e1('0xe7')]=function(_0x984b4d,_0x3b22e4,_0x2354a6,_0x4d8a50){this['moveContactManagedDialer'](_0x984b4d)['then'](function(_0x351144){return _0x3b22e4(msgResponse(_0xf5e1('0x19e'),_0xf5e1('0xcb'),_0x4d8a50));})['catch'](function(_0x3144a9){return _0x2354a6(msgResponse(_0xf5e1('0x1b7'),_0xf5e1('0x13a'),_0xf5e1('0x1b8')));});};Dialer['prototype'][_0xf5e1('0xb')]=function(_0x315bf7){var _0x1c21b7=this;var _0x488c14=_0x315bf7[_0xf5e1('0x1b9')]/0x64;var _0xbedcd2=_0x315bf7[_0xf5e1('0x1ba')]/(_0x315bf7['outboundDropCallsDayTimeout']+_0x315bf7[_0xf5e1('0x58')]);var _0x56fe67=Math[_0xf5e1('0x1bb')](_0x315bf7[_0xf5e1('0x6c')]*(_0x315bf7[_0xf5e1('0x1bc')]/0x64));var _0x8b7d0a=Math['round'](_0x315bf7[_0xf5e1('0x6c')]*(_0x315bf7[_0xf5e1('0x1bd')]/0x64));var _0x5d51c4=_0x315bf7[_0xf5e1('0x1be')]+_0x315bf7[_0xf5e1('0x9b')];var _0x330b50=Math['floor'](_0x315bf7[_0xf5e1('0x6e')]*_0x315bf7['erlangAbandonmentRate']*_0x315bf7['predictiveIntervalHitRate']*_0x315bf7['predictiveIntervalMultiplicativeFactor']);if(_[_0xf5e1('0x3a')](_0x315bf7['startProgressive'])){if(!_[_0xf5e1('0x3a')](_0x315bf7['startPredictive'])){_0x315bf7['startPredictive']=undefined;loggerPredictive[_0xf5e1('0x90')](_0xf5e1('0x1bf'),_0xf5e1('0x1c0'));}if(!_[_0xf5e1('0x3a')](_0x315bf7['handlePredictive'])){loggerPredictive[_0xf5e1('0x90')](_0xf5e1('0x1bf'),_0xf5e1('0x1c1'));clearInterval(_0x315bf7[_0xf5e1('0x89')]);_0x315bf7[_0xf5e1('0x89')]=undefined;}_0x315bf7['startProgressive']=moment()[_0xf5e1('0x8e')](_0xf5e1('0xf5'));loggerPredictive[_0xf5e1('0x78')](_0x315bf7[_0xf5e1('0x3c')],_0xf5e1('0x1c2'),_0x315bf7[_0xf5e1('0x72')]);this[_0xf5e1('0x14e')](_0x315bf7,0x1);}else if(ifInterval(_0x315bf7[_0xf5e1('0x1c3')],_0x315bf7[_0xf5e1('0x72')])){this[_0xf5e1('0x14e')](_0x315bf7,0x1);loggerPredictiveCalls[_0xf5e1('0x78')](_0xf5e1('0x1c4'),_0x315bf7[_0xf5e1('0x72')],_0x315bf7[_0xf5e1('0x3c')]);_0x315bf7[_0xf5e1('0x6e')]=0x0;_0x315bf7[_0xf5e1('0x68')]=0x0;}else if(_0x488c14<_0xbedcd2&&_0x315bf7[_0xf5e1('0x1c5')]===_0xf5e1('0x1c6')){freeVariablesPredictive(_0x315bf7);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x1c7'),_0xf5e1('0x1c8'),_0xbedcd2,_0xf5e1('0x72'),_0x315bf7['name']);}else if(_0x330b50<_0x315bf7[_0xf5e1('0x68')]&&_0x315bf7[_0xf5e1('0x1c5')]===_0xf5e1('0x1c6')){freeVariablesPredictive(_0x315bf7);loggerPredictive[_0xf5e1('0x78')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xf5e1('0x1c9'),_0x330b50,_0xf5e1('0x1ca'),_0x315bf7['predictiveIntervalErlangCallsDroppedCalls'],_0xf5e1('0x72'),_0x315bf7['name']);}else if(!ifInterval(_0x315bf7[_0xf5e1('0x1c3')],_0x315bf7[_0xf5e1('0x72')])&&_[_0xf5e1('0x3a')](_0x315bf7[_0xf5e1('0x87')])&&!_[_0xf5e1('0x3a')](_0x315bf7[_0xf5e1('0x72')])){_0x315bf7['startPredictive']=moment()['format'](_0xf5e1('0xf5'));loggerPredictive['info'](_0x315bf7[_0xf5e1('0x3c')],_0xf5e1('0x1cb'),_0x315bf7['startPredictive']);this[_0xf5e1('0xb5')](_0x315bf7[_0xf5e1('0x1c3')])['then'](this[_0xf5e1('0x1cc')](_0x315bf7))['then'](mergeDataErlangB(_0x315bf7))[_0xf5e1('0xb2')](this[_0xf5e1('0x1cd')](_0x315bf7))[_0xf5e1('0xaa')](loggerCatchPredictive(_0xf5e1('0x1ce'),_0x315bf7));}else if(!ifInterval(_0x315bf7['dialPredictiveInterval'],_0x315bf7[_0xf5e1('0x87')])){_0x315bf7[_0xf5e1('0x68')]=0x0;_0x315bf7['startPredictive']=moment()['format'](_0xf5e1('0xf5'));loggerPredictive[_0xf5e1('0x78')](_0x315bf7[_0xf5e1('0x3c')],_0xf5e1('0x1cf'),_0x315bf7['startPredictive']);clearInterval(_0x315bf7[_0xf5e1('0x89')]);_0x315bf7[_0xf5e1('0x89')]=undefined;this[_0xf5e1('0xb5')](_0x315bf7[_0xf5e1('0x1c3')])[_0xf5e1('0xb2')](this[_0xf5e1('0x1cc')](_0x315bf7))[_0xf5e1('0xb2')](mergeDataErlangB(_0x315bf7))[_0xf5e1('0xb2')](this[_0xf5e1('0x1cd')](_0x315bf7))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x315bf7));}else if(_0x315bf7[_0xf5e1('0x6c')]&&_0x5d51c4<_0x315bf7['predictiveIntervalAvailable']-_0x8b7d0a){freeVariablesPredictive(_0x315bf7);loggerPredictive['info'](_0x315bf7[_0xf5e1('0x3c')],_0xf5e1('0x1d0'),_0x5d51c4,_0xf5e1('0x1d1'),_0x315bf7[_0xf5e1('0x6c')],'-',_0x8b7d0a,'=',_0x315bf7[_0xf5e1('0x6c')]-_0x8b7d0a,')');}else if(_0x315bf7['predictiveIntervalAvailable']&&_0x5d51c4>_0x315bf7[_0xf5e1('0x6c')]+_0x56fe67){freeVariablesPredictive(_0x315bf7);loggerPredictive[_0xf5e1('0x78')](_0x315bf7['name'],_0xf5e1('0x1d0'),_0x5d51c4,_0xf5e1('0x1d2'),_0x315bf7[_0xf5e1('0x6c')],'+',_0x56fe67,'=',_0x315bf7[_0xf5e1('0x6c')]+_0x56fe67,')');}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x1cc')]=function(_0x184587){var _0x31dfc0=this;return function(_0x14280){return new BPromise(function(_0x47ea73,_0x1a66c3){_['merge'](_0x184587,_0x14280[0x0]);if(checkGetDataPredictive(_0x14280[0x0])){var _0x3f292d=_0x184587['predictiveIntervalAvailable']=_0x184587[_0xf5e1('0x9b')]+_0x184587[_0xf5e1('0x1be')];var _0x19a432=_0x184587[_0xf5e1('0x1c3')]*0x3c;var _0x462917=_0x14280[0x0][_0xf5e1('0x64')]+_0x14280[0x0]['predictiveIntervalAvgHoldtime'];var _0x2e52a6=(_0x14280[0x0][_0xf5e1('0x62')]+_0x14280[0x0][_0xf5e1('0x66')]+_0x14280[0x0][_0xf5e1('0x65')])/_0x14280[0x0][_0xf5e1('0x6d')];_0x184587[_0xf5e1('0x69')]=_0x2e52a6>0x0?_0x2e52a6:0x1;switch(_0x184587[_0xf5e1('0x1c5')]){case _0xf5e1('0x1c6'):var _0x141a04=_0x184587['dialPredictiveOptimizationPercentage']/0x64;return _0x31dfc0[_0xf5e1('0x1d3')](_0x3f292d,_0x19a432,_0x462917,_0x2e52a6,_0x141a04)['then'](function(_0x7514ec){return _0x47ea73(_0x7514ec);});case'agentBusyFactor':var _0x3a5a59=_0x184587['dialPredictiveOptimizationPercentage']/0x64;return _0x31dfc0['busyFactor'](_0x3f292d,_0x19a432,_0x462917,_0x2e52a6,_0x3a5a59)['then'](function(_0x43a9b0){return _0x47ea73(_0x43a9b0);});default:return _0x1a66c3(msgResponse(_0xf5e1('0x1d4'),_0xf5e1('0x13a'),_0xf5e1('0x1d5')));}}else{return _0x1a66c3(msgResponse(_0xf5e1('0x1d4'),_0xf5e1('0x13a'),_0xf5e1('0x1d6')));}});};};Dialer[_0xf5e1('0x1c')]['getDataPredictiveOld']=function(_0x56a867){var _0x516d4b=this;return function(_0x52e012){return new BPromise(function(_0x19d44f,_0x86edd){_[_0xf5e1('0xc5')](_0x56a867,_0x52e012[0x0]);if(checkGetDataPredictive(_0x52e012[0x0])){loggerPredictive[_0xf5e1('0x78')](JSON[_0xf5e1('0x125')](_0x52e012[0x0]));if(_0x56a867[_0xf5e1('0x1c5')]===_0xf5e1('0x1c6')){return _0x516d4b[_0xf5e1('0xbd')](_0x56a867['id'])[_0xf5e1('0xb2')](function(_0x1415d5){var _0x548136=_0x56a867[_0xf5e1('0x4f')]-_0x1415d5[0x0][_0xf5e1('0x1d7')];var _0xe28540=_0x56a867['dialPredictiveInterval']*0x3c;var _0x3e7d63=_0x52e012[0x0][_0xf5e1('0x64')]+_0x52e012[0x0]['predictiveIntervalAvgHoldtime'];var _0x8be67f=(_0x52e012[0x0][_0xf5e1('0x62')]+_0x52e012[0x0][_0xf5e1('0x66')]+_0x52e012[0x0][_0xf5e1('0x65')])/_0x52e012[0x0]['predictiveIntervalTotalCalls'];var _0x26f12a=_0x56a867[_0xf5e1('0x1b9')]/0x64;_0x56a867['predictiveIntervalPauses']=_0x1415d5[0x0][_0xf5e1('0x1d7')]||0x0;_0x56a867[_0xf5e1('0x69')]=_0x8be67f>0x0?_0x8be67f:0x1;return _0x516d4b[_0xf5e1('0x1d3')](_0x548136,_0xe28540,_0x3e7d63,_0x8be67f,_0x26f12a);})[_0xf5e1('0xb2')](function(_0x56303e){return _0x19d44f(_0x56303e);})[_0xf5e1('0xaa')](function(_0x41ccaf){return _0x86edd(msgResponse(_0xf5e1('0x1d8'),_0xf5e1('0x13a'),JSON[_0xf5e1('0x125')](_0x41ccaf)));});}if(_0x56a867[_0xf5e1('0x1c5')]==='agentBusyFactor'){return _0x516d4b[_0xf5e1('0xbd')](_0x56a867['id'])['then'](function(_0x2d3cf1){var _0x31e79f=_0x56a867[_0xf5e1('0x4f')]-_0x2d3cf1[0x0][_0xf5e1('0x1d7')];var _0x2696f8=_0x56a867[_0xf5e1('0x1c3')]*0x3c;var _0x580e37=_0x52e012[0x0][_0xf5e1('0x64')]+_0x52e012[0x0][_0xf5e1('0x63')];var _0x140132=(_0x52e012[0x0]['predictiveIntervalAnsweredCalls']+_0x52e012[0x0][_0xf5e1('0x66')]+_0x52e012[0x0][_0xf5e1('0x65')])/_0x52e012[0x0][_0xf5e1('0x6d')];var _0x29f90e=_0x56a867['dialPredictiveOptimizationPercentage']/0x64;_0x56a867[_0xf5e1('0x6b')]=_0x2d3cf1[0x0][_0xf5e1('0x1d7')]||0x0;_0x56a867[_0xf5e1('0x69')]=_0x140132>0x0?_0x140132:0x1;return _0x516d4b[_0xf5e1('0x1d9')](_0x31e79f,_0x2696f8,_0x580e37,_0x140132,_0x29f90e);})['then'](function(_0xd2201d){return _0x19d44f(_0xd2201d);})['catch'](function(_0x4c1d98){return _0x86edd(msgResponse(_0xf5e1('0x1d8'),_0xf5e1('0x13a'),JSON[_0xf5e1('0x125')](_0x4c1d98)));});}}else{return _0x86edd(msgResponse(_0xf5e1('0x1d4'),_0xf5e1('0x13a'),_0xf5e1('0x1d6')));}});};};Dialer['prototype'][_0xf5e1('0x1cd')]=function(_0x5e9f9c){var _0x3d32a5=this;return function(){var _0x39cd4d=0x0;var _0x11d6a9=Math[_0xf5e1('0x1da')](_0x5e9f9c['erlangCallToSecond']*0x3e8);if(_0x11d6a9>0x0){_0x11d6a9=_0x11d6a9<0x64?0x64:_0x11d6a9;loggerPredictive[_0xf5e1('0x78')](_0x5e9f9c[_0xf5e1('0x3c')],'one\x20call\x20every:',_0x11d6a9,'milliseconds');_0x5e9f9c['handlePredictive']=setInterval(function(){_0x3d32a5[_0xf5e1('0x89')](_0x5e9f9c);loggerPredictiveCalls[_0xf5e1('0x78')]('[handlePredictive]',_0x39cd4d+=0x1);},_0x11d6a9);}else{loggerPredictive['info'](_0x5e9f9c[_0xf5e1('0x3c')],_0xf5e1('0x1db'));}};};Dialer['prototype']['checkContactBlack']=function(_0x5d3316,_0x4e12eb){var _0x6a2aa3=this;return function(_0x2852e8){if(_[_0xf5e1('0x44')](_0x2852e8)){if(_[_0xf5e1('0xd2')](_0x4e12eb[_0xf5e1('0xc7')])||!_0x4e12eb[_0xf5e1('0x1dc')]){if(_0x5d3316[_0xf5e1('0x55')]===_0xf5e1('0x1dd')){_0x5d3316[_0xf5e1('0x123')]=_[_0xf5e1('0x3a')](_0x5d3316[_0xf5e1('0x123')])?!![]:_0x5d3316['queueStatusComplete'];var _0x4b6179=uuid['v4']();_0x6a2aa3['actions'][_0x4b6179]=new Action(_0x5d3316,_0x4e12eb,_0x4b6179);loggerBooked[_0xf5e1('0x78')](_0xf5e1('0x1de'),_0x4b6179,_0xf5e1('0x1df'),JSON[_0xf5e1('0x125')](_0x5d3316[_0xf5e1('0x123')]),'Queue:\x20',_0x5d3316[_0xf5e1('0x3c')]);if(_0x5d3316[_0xf5e1('0x123')]){_0x5d3316[_0xf5e1('0x123')]=![];_0x6a2aa3[_0xf5e1('0x28')][_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179]['queue']]=[];ami['Action']({'actionid':_0x4b6179,'action':_0xf5e1('0x1e0'),'queue':_0x5d3316[_0xf5e1('0x3c')]})[_0xf5e1('0xaa')](function(_0x2bcca9){_0x6a2aa3[_0xf5e1('0xab')](_0x5d3316);_0x6a2aa3[_0xf5e1('0xb7')]({'active':![],'ContactId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179]['ContactId'],'ListId':_0x6a2aa3['actions'][_0x4b6179]['ListId'],'VoiceQueueId':_0x6a2aa3['actions'][_0x4b6179][_0xf5e1('0xc8')]||undefined,'CampaignId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xf6')]||undefined})[_0xf5e1('0xaa')](loggerCatch(_0xf5e1('0x1e1')));delete _0x6a2aa3['actions'][_0x4b6179];});}else{loggerBooked[_0xf5e1('0x78')](_0xf5e1('0x1e2'),JSON[_0xf5e1('0x125')](_0x5d3316[_0xf5e1('0x123')]),_0xf5e1('0x1e3'),_0x5d3316['name']);_0x6a2aa3[_0xf5e1('0xab')](_0x5d3316);_0x6a2aa3['rescheduleContact']({'active':![],'ContactId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xec')],'ListId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xc6')],'VoiceQueueId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xc8')]||undefined,'CampaignId':_0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179][_0xf5e1('0xf6')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x6a2aa3[_0xf5e1('0xa8')][_0x4b6179];}}else{return _0x6a2aa3[_0xf5e1('0x15e')](_0x5d3316,_0x4e12eb);}}else{if(getDiff(_0x4e12eb['scheduledat'])<_0x5d3316['dialRecallMeTimeout']*0x3c){if(_0x4e12eb[_0xf5e1('0x1e4')]&&!_0x4e12eb[_0xf5e1('0x1e4')][_0xf5e1('0x1e5')]){_0x6a2aa3['preview'][_0xf5e1('0x127')](_0x4e12eb['id'])[_0xf5e1('0x128')](function(){_0x6a2aa3[_0xf5e1('0xab')](_0x5d3316);});}else{_0x6a2aa3[_0xf5e1('0xb9')]({'active':![]},_0x4e12eb['id'],0x1)['finally'](function(){console[_0xf5e1('0x1e6')](_0xf5e1('0x1e7'));_0x6a2aa3[_0xf5e1('0xab')](_0x5d3316);});}}else{_0x5d3316[_0xf5e1('0x1e8')]+=0x1;_0x6a2aa3['updateOriginated'](_0x5d3316);if(_0x5d3316[_0xf5e1('0x1e9')]){_0x6a2aa3[_0xf5e1('0xb7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e12eb[_0xf5e1('0xec')],'ListId':_0x4e12eb[_0xf5e1('0xc6')],'VoiceQueueId':_0x4e12eb[_0xf5e1('0xc8')]||undefined,'CampaignId':_0x4e12eb[_0xf5e1('0xf6')]||undefined})['catch'](loggerCatch(_0xf5e1('0x1ea')));_0x6a2aa3[_0xf5e1('0xbf')](createObjHistory(_0x5d3316,_0x4e12eb,_0xf5e1('0x1eb'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0xf5e1('0x1ec')));}else{_0x6a2aa3['saveInDb'](createObjHistory(_0x5d3316,_0x4e12eb,_0xf5e1('0x1ed'),0x16,_0xf5e1('0x1ee')),'[Originate][HistoryRecallClose][historyCatch]',_0xf5e1('0x1ef'));}}}}else{_0x5d3316['outboundBlacklistCallsDay']+=0x1;_0x6a2aa3[_0xf5e1('0xc4')](createObjHistory(_0x5d3316,_0x4e12eb,_0xf5e1('0x1f0'),0xd,_0xf5e1('0x1f1')),_0xf5e1('0x1f2'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x154')]=function(_0x13c14a){var _0x17f1d4=this;var _0x595bc7=[];var _0x50adb3=_0x13c14a[_0xf5e1('0x1f3')]-_0x13c14a[_0xf5e1('0x94')]-_0x13c14a[_0xf5e1('0x1f4')];emitCampaignSummary(_0x13c14a);if(_0x50adb3>0x0){if(_0x50adb3>this[_0xf5e1('0x24')]){_0x50adb3=this['maxNumberOriginate'];}_0x13c14a[_0xf5e1('0x1f4')]+=_0x50adb3;this[_0xf5e1('0x1f5')](_0x13c14a['id'],_0x50adb3,_0x13c14a['dialOrderByScheduledAt'])['then'](function(_0xa783b0){_0x13c14a['temp']-=_0x50adb3;_0x13c14a['temp']=_0x13c14a[_0xf5e1('0x1f4')]>0x0?_0x13c14a[_0xf5e1('0x1f4')]:0x0;if(!checkContactEmpty(_0xa783b0)){_0x13c14a[_0xf5e1('0x3e')]=_0xf5e1('0x1f6');logger['info'](_0xf5e1('0x1f7')+_0x13c14a[_0xf5e1('0x3c')]);}else{_0x13c14a['originated']+=_0xa783b0[_0xf5e1('0x13f')];_0x13c14a[_0xf5e1('0x3e')]=_0xf5e1('0x1f8');for(var _0x4570fb=0x0;_0x4570fb<_0xa783b0[_0xf5e1('0x13f')];_0x4570fb+=0x1){_0x13c14a['ivrTotalCallsDays']+=0x1;if(_[_0xf5e1('0xd2')](_0xa783b0[_0x4570fb])||_[_0xf5e1('0xd2')](_0xa783b0[_0x4570fb][_0xf5e1('0x161')])||_['isNil'](_0xa783b0[_0x4570fb][_0xf5e1('0x161')]['phone'])){_0x17f1d4['emptyContact'](_0xf5e1('0x1f9'),_0x13c14a,_0xa783b0[_0x4570fb]);}else{_0x17f1d4[_0xf5e1('0xb4')](_[_0xf5e1('0x120')](_0xa783b0[_0x4570fb],['CampaignId',_0xf5e1('0x1fa')]))['then'](_0x17f1d4['checkContactBlack'](_0x13c14a,_0xa783b0[_0x4570fb]))[_0xf5e1('0xaa')](_0x17f1d4[_0xf5e1('0xc2')](_0xf5e1('0x1fb'),_0x13c14a));}}}})['catch'](loggerGetContactDialer(_0xf5e1('0x1fc'),_0x13c14a,_0x50adb3));}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x14e')]=function(_0x298f83,_0xc75aad){var _0x385b28=this;var _0x61f617=[];var _0x908c67=_0xc75aad>=0x1?_0xc75aad:0x1;var _0x35a381=[];if(_0x298f83['dialMethod']===_0xf5e1('0x1dd')){_0x908c67=0x1;}var _0x4b8214=Math[_0xf5e1('0x1da')](_0x298f83['available']*_0x908c67)-_0x298f83[_0xf5e1('0x94')]-_0x298f83[_0xf5e1('0x1f4')];emitVoiceQueueSummary(_0x298f83);if(_0x298f83[_0xf5e1('0x1fd')]>0x0){var _0x507f9b=_0x298f83['dialLimitQueue']-_0x298f83['originated']-_0x298f83[_0xf5e1('0x9b')]-_0x298f83[_0xf5e1('0x1f4')]-_0x298f83[_0xf5e1('0x9c')];if(_0x4b8214>_0x507f9b){_0x4b8214=_0x507f9b;}}if(_0x4b8214>0x0){if(_0x298f83[_0xf5e1('0x55')]==='booked'){_0x4b8214=0x1;}if(_0x4b8214>this[_0xf5e1('0x24')]){_0x4b8214=this[_0xf5e1('0x24')];}_0x298f83['temp']+=_0x4b8214;for(var _0x3d19cc in this[_0xf5e1('0x22')]){if(this[_0xf5e1('0x22')]['hasOwnProperty'](_0x3d19cc)){if(this[_0xf5e1('0x22')][_0x3d19cc][_0xf5e1('0xa1')]===_0xf5e1('0x1fe')&&this['agents'][_0x3d19cc]['status']==='reachable'){_0x61f617[_0xf5e1('0x11f')](this[_0xf5e1('0x22')][_0x3d19cc]['id']);}}}this['getContactDialer'](_0x298f83['id'],_0x61f617,_0x4b8214,_0x298f83[_0xf5e1('0x1ff')])[_0xf5e1('0xb2')](function(_0x295e42){_0x298f83[_0xf5e1('0x1f4')]-=_0x4b8214;_0x298f83[_0xf5e1('0x1f4')]=_0x298f83[_0xf5e1('0x1f4')]>0x0?_0x298f83[_0xf5e1('0x1f4')]:0x0;if(!checkContactEmpty(_0x295e42)){_0x385b28['countReScheduled'](_0x298f83)['then'](sendMessageReschedule(_0x298f83))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x298f83[_0xf5e1('0x94')]+=_0x295e42[_0xf5e1('0x13f')];_0x298f83['message']=_0x298f83[_0xf5e1('0x55')]===_0xf5e1('0x1dd')?_0xf5e1('0x169'):_0xf5e1('0x1f8');for(var _0x1b23a5=0x0;_0x1b23a5<_0x295e42[_0xf5e1('0x13f')];_0x1b23a5+=0x1){if(_['isNil'](_0x295e42[_0x1b23a5])||_[_0xf5e1('0xd2')](_0x295e42[_0x1b23a5][_0xf5e1('0x161')])||_[_0xf5e1('0xd2')](_0x295e42[_0x1b23a5]['Contact'][_0xf5e1('0x162')])){_0x385b28[_0xf5e1('0x200')](_0xf5e1('0x1f9'),_0x298f83,_0x295e42[_0x1b23a5]);}else{_0x385b28[_0xf5e1('0xb1')](_[_0xf5e1('0x120')](_0x295e42[_0x1b23a5],['VoiceQueueId',_0xf5e1('0x1fa')]))['then'](_0x385b28[_0xf5e1('0x201')](_0x298f83,_0x295e42[_0x1b23a5]))[_0xf5e1('0xaa')](_0x385b28['loggerHandler']('[actionOriginate]\x20',_0x298f83));}}}})[_0xf5e1('0xaa')](loggerGetContactDialer(_0xf5e1('0x202'),_0x298f83,_0x4b8214));}};Dialer[_0xf5e1('0x1c')]['handlePredictive']=function(_0x4cca53){var _0x46492f=this;if(_0x4cca53[_0xf5e1('0x1fd')]>0x0){var _0x43fda8=_0x4cca53[_0xf5e1('0x1fd')]-_0x4cca53[_0xf5e1('0x94')]-_0x4cca53[_0xf5e1('0x9b')];if(_0x43fda8>0x0){this[_0xf5e1('0x203')](_0x4cca53);}else{loggerPredictiveCalls[_0xf5e1('0x78')](_0xf5e1('0x204'));}}else{this[_0xf5e1('0x203')](_0x4cca53);}};Dialer[_0xf5e1('0x1c')][_0xf5e1('0x203')]=function(_0x4b5442){var _0x1e573f=this;var _0x492a1c=[];_0x4b5442[_0xf5e1('0x94')]+=0x1;for(var _0x5a721e in this[_0xf5e1('0x22')]){if(this['agents'][_0xf5e1('0x93')](_0x5a721e)){if(this[_0xf5e1('0x22')][_0x5a721e][_0xf5e1('0xa1')]==='not_inuse'&&this[_0xf5e1('0x22')][_0x5a721e]['status']===_0xf5e1('0xcd')){_0x492a1c['push'](this[_0xf5e1('0x22')][_0x5a721e]['id']);}}}this[_0xf5e1('0xbb')](_0x4b5442['id'],_0x492a1c,0x1,_0x4b5442[_0xf5e1('0x1ff')])[_0xf5e1('0xb2')](function(_0x513bdc){if(!checkContactEmpty(_0x513bdc)){checkContactLowerLimitOriginate(_0x4b5442,0x1,0x0);_0x1e573f[_0xf5e1('0xb0')](_0x4b5442)[_0xf5e1('0xb2')](sendMessageReschedule(_0x4b5442))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x4b5442['message']=_0xf5e1('0x1f8');if(_[_0xf5e1('0xd2')](_0x513bdc[0x0])||_[_0xf5e1('0xd2')](_0x513bdc[0x0][_0xf5e1('0x161')])||_['isNil'](_0x513bdc[0x0][_0xf5e1('0x161')][_0xf5e1('0x162')])){_0x1e573f[_0xf5e1('0x200')](_0xf5e1('0x1f9'),_0x4b5442,_0x513bdc[0x0]);}else{_0x1e573f[_0xf5e1('0xb1')](_[_0xf5e1('0x120')](_0x513bdc[0x0],[_0xf5e1('0xc8'),_0xf5e1('0x1fa')]))[_0xf5e1('0xb2')](_0x1e573f[_0xf5e1('0x201')](_0x4b5442,_0x513bdc[0x0]))[_0xf5e1('0xaa')](_0x1e573f[_0xf5e1('0xc2')](_0xf5e1('0x205'),_0x4b5442));}}})['catch'](loggerGetContactDialer(_0xf5e1('0x206'),_0x4b5442,0x1));emitVoiceQueueSummary(_0x4b5442);};Dialer['prototype'][_0xf5e1('0x1d3')]=function(_0x112356,_0x1533bf,_0x5877da,_0x35ef8d,_0x8b3926,_0x1925ac){loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x207'));loggerPredictive[_0xf5e1('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',_0x112356);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x208'),_0x1533bf);loggerPredictive[_0xf5e1('0x78')]('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',_0x5877da);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x209'),_0x35ef8d);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x20a'),_0x8b3926);loggerPredictive[_0xf5e1('0x78')]('---------------------------');return new BPromise(function(_0x3fb54e,_0x3feb95){if(_0x112356<=0x0||isNaN(_0x112356)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),_0xf5e1('0x46'),_0xf5e1('0x20c')+_0x112356));}if(_0x5877da<=0x0||isNaN(_0x5877da)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),'Error',_0xf5e1('0x20d')+_0x5877da));}if(_0x35ef8d<=0x0||isNaN(_0x35ef8d)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),_0xf5e1('0x46'),_0xf5e1('0x20e')+_0x35ef8d));}if(_0x1533bf<=0x0||isNaN(_0x1533bf)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),'Error',_0xf5e1('0x20f')+_0x1533bf));}if(_0x8b3926<=0x0||isNaN(_0x8b3926)){return _0x3feb95(msgResponse(_0xf5e1('0x20b'),_0xf5e1('0x46'),_0xf5e1('0x210')+_0x8b3926));}_0x1925ac=_0x1925ac||0x0;var _0x472199=0x1/_0x5877da;var _0x59dfc9=0x0;var _0x2833c3=0x0;var _0x172f48=0x0;var _0x2b8945=0x0;for(var _0x56d075=0x0;_0x172f48<_0x8b3926;_0x56d075+=0x1){_0x2833c3=_0x56d075/_0x1533bf;_0x59dfc9=(_0x35ef8d*_0x2833c3+_0x1925ac)/_0x472199;_0x172f48=erlangb(_0x59dfc9,_0x112356);_0x2b8945=_0x59dfc9/_0x112356*(0x1-erlangb(_0x59dfc9,_0x112356));}return _0x3fb54e({'erlangCalls':_0x56d075,'erlangCallToSecond':_0x1533bf/_0x56d075,'erlangAbandonmentRate':_0x172f48,'erlangBusyFactor':_0x2b8945});});};Dialer['prototype'][_0xf5e1('0x1d9')]=function(_0x88dae0,_0x2a07a6,_0x18575b,_0x548adf,_0x203196,_0x19bba7){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x211'),_0x88dae0);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x208'),_0x2a07a6);loggerPredictive[_0xf5e1('0x78')]('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',_0x18575b);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x209'),_0x548adf);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x212'),_0x203196);loggerPredictive[_0xf5e1('0x78')](_0xf5e1('0x7e'));return new BPromise(function(_0x1ed0ca,_0x509225){if(_0x88dae0<=0x0||isNaN(_0x88dae0)){return _0x509225(msgResponse('[busyFactor]','Error',_0xf5e1('0x20c')+_0x88dae0));}if(_0x18575b<=0x0||isNaN(_0x18575b)){return _0x509225(msgResponse(_0xf5e1('0x213'),_0xf5e1('0x46'),_0xf5e1('0x20d')+_0x18575b));}if(_0x548adf<=0x0||isNaN(_0x548adf)){return _0x509225(msgResponse('[busyFactor]',_0xf5e1('0x46'),_0xf5e1('0x20e')+_0x548adf));}if(_0x2a07a6<=0x0||isNaN(_0x2a07a6)){return _0x509225(msgResponse(_0xf5e1('0x213'),_0xf5e1('0x46'),_0xf5e1('0x20f')+_0x2a07a6));}if(_0x203196<=0x0||isNaN(_0x203196)){return _0x509225(msgResponse('[busyFactor]',_0xf5e1('0x46'),_0xf5e1('0x214')+_0x203196));}_0x19bba7=_0x19bba7||0x0;var _0x10e98f=0x1/_0x18575b;var _0x5073dd=0x0;var _0x4f61cf=0x0;var _0x218a7e=0x0;var _0x4aec77=0x0;for(var _0x1c997b=0x0;_0x4aec77<_0x203196;_0x1c997b+=0x1){_0x4f61cf=_0x1c997b/_0x2a07a6;_0x5073dd=(_0x548adf*_0x4f61cf+_0x19bba7)/_0x10e98f;_0x218a7e=erlangb(_0x5073dd,_0x88dae0);_0x4aec77=_0x5073dd/_0x88dae0*(0x1-erlangb(_0x5073dd,_0x88dae0));}return _0x1ed0ca({'erlangCalls':_0x1c997b,'erlangCallToSecond':_0x2a07a6/_0x1c997b,'erlangAbandonmentRate':_0x218a7e,'erlangBusyFactor':_0x4aec77});});};module[_0xf5e1('0x215')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index ba9df5b..01fc26c 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 _0x1181=['diff','seconds','scheduledat','campaigntype','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x144d5f,_0x4d0b19){var _0x31e036=function(_0x1e47ec){while(--_0x1e47ec){_0x144d5f['push'](_0x144d5f['shift']());}};_0x31e036(++_0x4d0b19);}(_0x1181,0x191));var _0x1118=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x1181[_0x1d39f6];return _0x3dbd7a;};'use strict';var util=require(_0x1118('0x0'));var _=require(_0x1118('0x1'));var moment=require(_0x1118('0x2'));function getSeconds(_0x16e651,_0x4b50ea){var _0xf12b6e=moment(_0x16e651)['milliseconds'](0x0);var _0x4b3afe=moment(_0x4b50ea)[_0x1118('0x3')](0x0);return _0xf12b6e[_0x1118('0x4')](_0x4b3afe,_0x1118('0x5'));}function QueueCallerAbandon(_0x1481c3,_0x3ff0b4){this[_0x1118('0x6')]=_0x1481c3['scheduledat'];this['type']=_0x1481c3['type'];this[_0x1118('0x7')]=_0x1481c3[_0x1118('0x8')]==='outbound'?_0x1118('0x9'):_0x1481c3['type'];this[_0x1118('0xa')]=_0x1481c3['countbusyretry'];this['countcongestionretry']=_0x1481c3[_0x1118('0xb')];this[_0x1118('0xc')]=_0x1481c3[_0x1118('0xc')];this[_0x1118('0xd')]=_0x1481c3[_0x1118('0xa')]+_0x1481c3['countcongestionretry']+_0x1481c3[_0x1118('0xc')]+_0x1481c3[_0x1118('0xe')]+_0x1481c3[_0x1118('0xf')]+_0x1481c3['countabandonedretry']+_0x1481c3[_0x1118('0x10')]+_0x1481c3['countagentrejectretry'];this['countnosuchnumberretry']=_0x1481c3['countnosuchnumberretry'];this['countdropretry']=_0x1481c3[_0x1118('0xf')];this[_0x1118('0x11')]=_0x1481c3[_0x1118('0x11')];this[_0x1118('0x10')]=_0x1481c3[_0x1118('0x10')];this[_0x1118('0x12')]=_0x1481c3[_0x1118('0x12')];this[_0x1118('0x13')]=_0x3ff0b4[_0x1118('0x13')];this['calleridname']=_0x1481c3[_0x1118('0x14')];this[_0x1118('0x15')]=_0x1481c3[_0x1118('0x16')];this['starttime']=_0x1481c3[_0x1118('0x17')];this[_0x1118('0x18')]=_0x1481c3[_0x1118('0x18')];this['droptime']=_0x1481c3[_0x1118('0x19')];this[_0x1118('0x1a')]=this[_0x1118('0x19')];this[_0x1118('0x1b')]=getSeconds(_0x1481c3[_0x1118('0x18')],_0x1481c3[_0x1118('0x17')]);this[_0x1118('0x1c')]=getSeconds(this[_0x1118('0x19')],_0x1481c3[_0x1118('0x18')]);this[_0x1118('0x1d')]=0x0;this[_0x1118('0x9')]=_0x3ff0b4[_0x1118('0x9')];this[_0x1118('0x1e')]=_0x3ff0b4[_0x1118('0x1f')];this[_0x1118('0x20')]=_0x3ff0b4['reason'];this[_0x1118('0x21')]=_0x1481c3[_0x1118('0x21')];this[_0x1118('0x22')]=_0x1481c3['callbackuniqueid'];this['callbackat']=_0x1481c3[_0x1118('0x23')];this[_0x1118('0x24')]=_0x1481c3[_0x1118('0x24')];this[_0x1118('0x25')]=_0x1481c3[_0x1118('0x25')];this['ListId']=_0x1481c3[_0x1118('0x26')];this[_0x1118('0x27')]=_0x1481c3['UserId'];this[_0x1118('0x28')]=_0x1481c3[_0x1118('0x28')];this[_0x1118('0x29')]=_0x1481c3['CampaignId'];this['originatecalleridnum']=_0x1481c3[_0x1118('0x2a')]||'';this['originatecalleridname']=_0x1481c3[_0x1118('0x2b')]||'';}module[_0x1118('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0x969d=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue'];(function(_0x23ac30,_0x2a1d00){var _0x208fec=function(_0x23213a){while(--_0x23213a){_0x23ac30['push'](_0x23ac30['shift']());}};_0x208fec(++_0x2a1d00);}(_0x969d,0xd1));var _0xd969=function(_0x1042ae,_0x464a59){_0x1042ae=_0x1042ae-0x0;var _0x23eccd=_0x969d[_0x1042ae];return _0x23eccd;};'use strict';var util=require(_0xd969('0x0'));var _=require(_0xd969('0x1'));var moment=require(_0xd969('0x2'));function getSeconds(_0x1d38cc,_0x466c66){var _0x1c82cc=moment(_0x1d38cc)[_0xd969('0x3')](0x0);var _0x2a0a3f=moment(_0x466c66)[_0xd969('0x3')](0x0);return _0x1c82cc[_0xd969('0x4')](_0x2a0a3f,_0xd969('0x5'));}function QueueCallerAbandon(_0x8c56c7,_0x4014e7){this['scheduledat']=_0x8c56c7[_0xd969('0x6')];this[_0xd969('0x7')]=_0x8c56c7[_0xd969('0x7')];this[_0xd969('0x8')]=_0x8c56c7['type']===_0xd969('0x9')?_0xd969('0xa'):_0x8c56c7['type'];this['countbusyretry']=_0x8c56c7['countbusyretry'];this[_0xd969('0xb')]=_0x8c56c7[_0xd969('0xb')];this[_0xd969('0xc')]=_0x8c56c7[_0xd969('0xc')];this[_0xd969('0xd')]=_0x8c56c7['countbusyretry']+_0x8c56c7['countcongestionretry']+_0x8c56c7[_0xd969('0xc')]+_0x8c56c7[_0xd969('0xe')]+_0x8c56c7[_0xd969('0xf')]+_0x8c56c7[_0xd969('0x10')]+_0x8c56c7[_0xd969('0x11')]+_0x8c56c7['countagentrejectretry'];this[_0xd969('0xe')]=_0x8c56c7[_0xd969('0xe')];this['countdropretry']=_0x8c56c7[_0xd969('0xf')];this[_0xd969('0x10')]=_0x8c56c7[_0xd969('0x10')];this[_0xd969('0x11')]=_0x8c56c7['countmachineretry'];this[_0xd969('0x12')]=_0x8c56c7[_0xd969('0x12')];this[_0xd969('0x13')]=_0x4014e7[_0xd969('0x13')];this[_0xd969('0x14')]=_0x8c56c7[_0xd969('0x15')];this[_0xd969('0x16')]=_0x8c56c7[_0xd969('0x17')];this[_0xd969('0x18')]=_0x8c56c7[_0xd969('0x18')];this[_0xd969('0x19')]=_0x8c56c7[_0xd969('0x19')];this[_0xd969('0x1a')]=_0x8c56c7['droptime'];this[_0xd969('0x1b')]=this[_0xd969('0x1a')];this[_0xd969('0x1c')]=getSeconds(_0x8c56c7['responsetime'],_0x8c56c7[_0xd969('0x18')]);this[_0xd969('0x1d')]=getSeconds(this['droptime'],_0x8c56c7['responsetime']);this[_0xd969('0x1e')]=0x0;this[_0xd969('0xa')]=_0x4014e7[_0xd969('0xa')];this['membername']=_0x4014e7[_0xd969('0x1f')];this[_0xd969('0x20')]=_0x4014e7[_0xd969('0x20')];this['callback']=_0x8c56c7[_0xd969('0x21')];this[_0xd969('0x22')]=_0x8c56c7[_0xd969('0x22')];this[_0xd969('0x23')]=_0x8c56c7['callbackat'];this[_0xd969('0x24')]=_0x8c56c7[_0xd969('0x24')];this[_0xd969('0x25')]=_0x8c56c7[_0xd969('0x25')];this[_0xd969('0x26')]=_0x8c56c7[_0xd969('0x26')];this[_0xd969('0x27')]=_0x8c56c7[_0xd969('0x27')];this['VoiceQueueId']=_0x8c56c7[_0xd969('0x28')];this['CampaignId']=_0x8c56c7['CampaignId'];this[_0xd969('0x29')]=_0x8c56c7[_0xd969('0x29')]||'';this[_0xd969('0x2a')]=_0x8c56c7[_0xd969('0x2a')]||'';}module[_0xd969('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index ac0ef8e..9b80e02 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 _0x53c0=['%s/%s/%s','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','uniqueid','channel','format'];(function(_0x262239,_0xa4e3bc){var _0x4ada31=function(_0x78e32b){while(--_0x78e32b){_0x262239['push'](_0x262239['shift']());}};_0x4ada31(++_0xa4e3bc);}(_0x53c0,0xf2));var _0x053c=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x53c0[_0x507c81];return _0x368a25;};'use strict';var util=require(_0x053c('0x0'));var _=require(_0x053c('0x1'));var moment=require('moment');function Action(_0x39716f,_0x462a47,_0x24a9e8){this[_0x053c('0x2')]=_0x39716f||undefined;this[_0x053c('0x3')]=util[_0x053c('0x4')](_0x053c('0x5'),_0x462a47['tech'],_0x462a47['Trunk'][_0x053c('0x6')],_0x24a9e8[_0x053c('0x7')]);this[_0x053c('0x8')]=_0x462a47[_0x053c('0x8')];this['headerinfo']=_0x462a47[_0x053c('0x9')];this[_0x053c('0xa')]=_0x24a9e8[_0x053c('0xa')];this[_0x053c('0xb')]=_0x24a9e8[_0x053c('0xb')];}module[_0x053c('0xc')]=Action; \ No newline at end of file +var _0x81dc=['lodash','moment','uniqueid','format','tech','Trunk','name','fax','headerinfo','path','AttachmentId','exports'];(function(_0x14aee9,_0x596a94){var _0x6de2f7=function(_0x4561e3){while(--_0x4561e3){_0x14aee9['push'](_0x14aee9['shift']());}};_0x6de2f7(++_0x596a94);}(_0x81dc,0xf0));var _0xc81d=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0x81dc[_0x48cb1f];return _0x172c4d;};'use strict';var util=require('util');var _=require(_0xc81d('0x0'));var moment=require(_0xc81d('0x1'));function Action(_0x3182ea,_0x16c357,_0x37eacb){this[_0xc81d('0x2')]=_0x3182ea||undefined;this['channel']=util[_0xc81d('0x3')]('%s/%s/%s',_0x16c357[_0xc81d('0x4')],_0x16c357[_0xc81d('0x5')][_0xc81d('0x6')],_0x37eacb[_0xc81d('0x7')]);this['localstationid']=_0x16c357['localstationid'];this[_0xc81d('0x8')]=_0x16c357['headerinfo'];this[_0xc81d('0x9')]=_0x37eacb[_0xc81d('0x9')];this['AttachmentId']=_0x37eacb[_0xc81d('0xa')];}module[_0xc81d('0xb')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 1992f23..d329298 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 _0x39c1=['[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','dir','Convert\x20pdf\x20to\x20tif','variablesAction','Action','execOriginate','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','uuid','moment','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','merge','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId'];(function(_0xf19a59,_0x56ada6){var _0x565d7b=function(_0x4059be){while(--_0x4059be){_0xf19a59['push'](_0xf19a59['shift']());}};_0x565d7b(++_0x56ada6);}(_0x39c1,0x177));var _0x139c=function(_0x527aaa,_0xe460f3){_0x527aaa=_0x527aaa-0x0;var _0x50061f=_0x39c1[_0x527aaa];return _0x50061f;};'use strict';var util=require(_0x139c('0x0'));var _=require(_0x139c('0x1'));var BPromise=require('bluebird');var uuid=require(_0x139c('0x2'));var moment=require(_0x139c('0x3'));var path=require('path');var tiff2pdf=require(_0x139c('0x4'));var gs=require(_0x139c('0x5'));var logger=require('../../../config/logger')(_0x139c('0x6'));var ami=require(_0x139c('0x7'));var rpcDb=require(_0x139c('0x8'));var Channel=require('./channel');var ut=require(_0x139c('0x9'));var Action=require('./action');var faxAccount=require(_0x139c('0xa'));var attachment=require(_0x139c('0xb'));var faxMessage=require(_0x139c('0xc'));function Fax(_0x1d907f){this['channels']={};this['faxAccounts']=_0x1d907f[_0x139c('0xd')];this['trunks']=_0x1d907f[_0x139c('0xe')];this['actions']={};ami['on']('newchannel',this[_0x139c('0xf')][_0x139c('0x10')](this));ami['on'](_0x139c('0x11'),this[_0x139c('0x12')]['bind'](this));ami['on'](_0x139c('0x13'),this[_0x139c('0x14')][_0x139c('0x10')](this));ami['on'](_0x139c('0x15'),this['syncNewExten'][_0x139c('0x10')](this));ami['on'](_0x139c('0x16'),this[_0x139c('0x17')]['bind'](this));ami['on'](_0x139c('0x18'),this[_0x139c('0x19')][_0x139c('0x10')](this));ami['on'](_0x139c('0x1a'),this['syncHangup'][_0x139c('0x10')](this));ami['on'](_0x139c('0x1b'),this[_0x139c('0x1c')][_0x139c('0x10')](this));}Fax[_0x139c('0x1d')][_0x139c('0xf')]=function(_0xe6c5dd){if(_0xe6c5dd[_0x139c('0x1e')]===_0x139c('0x1f')){for(var _0x264e04 in this['faxAccounts']){if(this['faxAccounts'][_0x139c('0x20')](_0x264e04)){if(_0xe6c5dd[_0x139c('0x21')]===this[_0x139c('0xd')][_0x264e04]['localstationid']){this['channels'][_0xe6c5dd[_0x139c('0x22')]]={};this[_0x139c('0x23')][_0xe6c5dd[_0x139c('0x22')]]['channel']=_0xe6c5dd[_0x139c('0x24')];this[_0x139c('0x23')][_0xe6c5dd[_0x139c('0x22')]]['id']=this[_0x139c('0xd')][_0x264e04]['id'];this['channels'][_0xe6c5dd['uniqueid']][_0x139c('0x25')]=this[_0x139c('0xd')][_0x264e04][_0x139c('0x25')];logger[_0x139c('0x26')](_0xe6c5dd['uniqueid'],_0x139c('0x27'));}}}}if(this[_0x139c('0x28')][_0xe6c5dd[_0x139c('0x22')]]){this['channels'][_0xe6c5dd[_0x139c('0x22')]]={};this[_0x139c('0x23')][_0xe6c5dd[_0x139c('0x22')]][_0x139c('0x24')]=_0xe6c5dd[_0x139c('0x24')];logger[_0x139c('0x26')](_0xe6c5dd[_0x139c('0x22')],_0x139c('0x27'));}};Fax[_0x139c('0x1d')][_0x139c('0x12')]=function(_0x5139c3){if(this['channels'][_0x5139c3[_0x139c('0x22')]]){for(var _0x37444f in _0x5139c3['variable']){if(_0x5139c3[_0x139c('0x29')]['hasOwnProperty'](_0x37444f)){this[_0x139c('0x23')][_0x5139c3[_0x139c('0x22')]][_0x37444f]=_0x5139c3[_0x139c('0x2a')];}}}};Fax['prototype'][_0x139c('0x14')]=function(_0x3c0a0c){if(this[_0x139c('0x23')][_0x3c0a0c[_0x139c('0x22')]]){this[_0x139c('0x23')][_0x3c0a0c[_0x139c('0x22')]]['channelstate']=_0x3c0a0c[_0x139c('0x2b')];this[_0x139c('0x23')][_0x3c0a0c['uniqueid']][_0x139c('0x2c')]=_0x3c0a0c[_0x139c('0x2c')];}};Fax['prototype'][_0x139c('0x2d')]=function(_0x1c6707){if(this[_0x139c('0x23')][_0x1c6707[_0x139c('0x22')]]){for(var _0x1879a8 in _0x1c6707['variable']){if(_0x1c6707[_0x139c('0x29')][_0x139c('0x20')](_0x1879a8)){this[_0x139c('0x23')][_0x1c6707[_0x139c('0x22')]][_0x1879a8]=_0x1c6707[_0x139c('0x2a')];}}}};Fax[_0x139c('0x1d')][_0x139c('0x17')]=function(_0xe030b1){if(this[_0x139c('0x23')][_0xe030b1[_0x139c('0x22')]]){this[_0x139c('0x23')][_0xe030b1[_0x139c('0x22')]]['operation']=_0xe030b1[_0x139c('0x2e')];this[_0x139c('0x23')][_0xe030b1['uniqueid']][_0x139c('0x2f')]=_0xe030b1[_0x139c('0x2f')];this['channels'][_0xe030b1['uniqueid']]['localstationid']=_0xe030b1[_0x139c('0x30')];this[_0x139c('0x23')][_0xe030b1[_0x139c('0x22')]][_0x139c('0x31')]=_0xe030b1[_0x139c('0x31')];logger[_0x139c('0x26')](_0xe030b1[_0x139c('0x22')],_0x139c('0x32'));}};Fax['prototype']['syncReceiveFax']=function(_0x550ce3){var _0x101137=this;if(this[_0x139c('0x23')][_0x550ce3['uniqueid']]){var _0x4750e4=this['channels'][_0x550ce3[_0x139c('0x22')]]['id'];this[_0x139c('0x23')][_0x550ce3[_0x139c('0x22')]][_0x139c('0x33')]=_0x550ce3[_0x139c('0x33')];this[_0x139c('0x23')][_0x550ce3['uniqueid']][_0x139c('0x34')]=_0x550ce3[_0x139c('0x34')];this[_0x139c('0x23')][_0x550ce3['uniqueid']][_0x139c('0x30')]=_0x550ce3[_0x139c('0x30')];this[_0x139c('0x23')][_0x550ce3['uniqueid']][_0x139c('0x35')]=_0x550ce3['resolution'];this[_0x139c('0x23')][_0x550ce3[_0x139c('0x22')]]['transferrate']=_0x550ce3[_0x139c('0x36')];this[_0x139c('0x23')][_0x550ce3[_0x139c('0x22')]]['filename']=_0x550ce3[_0x139c('0x31')];this[_0x139c('0x23')][_0x550ce3[_0x139c('0x22')]][_0x139c('0x37')]=_0x550ce3[_0x139c('0x37')];if(this['channels'][_0x550ce3['uniqueid']][_0x139c('0x34')]>0x0){tiff2pdf(_0x550ce3[_0x139c('0x31')],_0x139c('0x38'),function(_0xe1f58e){logger[_0x139c('0x26')](_0x550ce3[_0x139c('0x22')],'\x20result\x20conversion\x20file\x20',_0xe1f58e[_0x139c('0x39')]);attachment[_0x139c('0x3a')]({'name':path[_0x139c('0x3b')](_0x550ce3[_0x139c('0x31')])['name'],'basename':path[_0x139c('0x3b')](_0x550ce3[_0x139c('0x31')])[_0x139c('0x25')]+_0x139c('0x3c'),'type':_0x139c('0x3d')})[_0x139c('0x3e')](function(_0x53ee40){faxAccount[_0x139c('0x3f')](_0x4750e4,{'from':_0x550ce3[_0x139c('0x37')],'mapKey':_0x139c('0x6'),'body':path['parse'](_0x550ce3['filename'])[_0x139c('0x25')]+_0x139c('0x3c'),'AttachmentId':_0x53ee40['id']})[_0x139c('0x40')](function(_0x4a8a06){logger['error'](_0x550ce3[_0x139c('0x22')],_0x139c('0x41'),JSON['stringify'](_0x4a8a06));});})[_0x139c('0x40')](function(_0x2cdc8c){logger[_0x139c('0x42')](_0x550ce3[_0x139c('0x22')],_0x139c('0x43'),JSON[_0x139c('0x44')](_0x2cdc8c));});});}logger[_0x139c('0x26')](_0x550ce3[_0x139c('0x22')],_0x139c('0x43'));}};Fax['prototype']['syncOriginateResponse']=function(_0x19bb24){if(this[_0x139c('0x28')][_0x19bb24['uniqueid']]){_[_0x139c('0x45')](this[_0x139c('0x23')][_0x19bb24[_0x139c('0x22')]],_['pick'](_0x19bb24,['response',_0x139c('0x46')]));}};function updateStatus(_0x169e7f){if(_0x169e7f[_0x139c('0x47')]){faxMessage['update'](_0x169e7f['AttachmentId'],{'failMessage':_0x139c('0x48')})[_0x139c('0x3e')](function(_0x1dd1a6){ut[_0x139c('0x49')]('[Fax][Message][Error][Updated]',_0x1dd1a6);})[_0x139c('0x40')](function(_0x2b0a3a){ut[_0x139c('0x49')](_0x139c('0x4a'),_0x2b0a3a);});}else{ut['logger'](_0x139c('0x4b'));}}Fax[_0x139c('0x1d')][_0x139c('0x4c')]=function(_0x16610f,_0x4775cc,_0x4ecc93){var _0x309adb=this;var _0x5aa7af={};if(_0x4775cc){_0x5aa7af={'read':_0x4775cc};}else{_0x5aa7af={'failMessage':_0x4ecc93};}if(this[_0x139c('0x28')][_0x16610f][_0x139c('0x47')]){faxMessage[_0x139c('0x4d')](this[_0x139c('0x28')][_0x16610f][_0x139c('0x47')],_0x5aa7af)[_0x139c('0x3e')](function(_0x365345){ut[_0x139c('0x49')](_0x139c('0x4e'),_0x365345);})['catch'](function(_0x4d11f6){ut['logger']('[Fax][Message][NoUpdate1]',_0x4d11f6);})[_0x139c('0x4f')](function(){delete _0x309adb['channels'][_0x16610f];delete _0x309adb[_0x139c('0x28')][_0x16610f];});}else{ut['logger'](_0x139c('0x50'));delete this[_0x139c('0x23')][_0x16610f];delete this[_0x139c('0x28')][_0x16610f];}};Fax[_0x139c('0x1d')][_0x139c('0x51')]=function(_0x271031){var _0xdee3f=this;if(this['channels'][_0x271031[_0x139c('0x22')]]){if(this[_0x139c('0x28')][_0x271031['uniqueid']]){this[_0x139c('0x23')][_0x271031['uniqueid']]['id']=this[_0x139c('0x28')][_0x271031[_0x139c('0x22')]]['id'];this[_0x139c('0x23')][_0x271031['uniqueid']][_0x139c('0x25')]=this[_0x139c('0x28')][_0x271031[_0x139c('0x22')]][_0x139c('0x25')];}logger[_0x139c('0x26')](_0x271031[_0x139c('0x22')],this['actions'][_0x271031['uniqueid']]?_0x139c('0x52'):_0x139c('0x53'),JSON['stringify'](this[_0x139c('0x23')][_0x271031[_0x139c('0x22')]]));if(this[_0x139c('0x28')][_0x271031[_0x139c('0x22')]]){if(this[_0x139c('0x23')][_0x271031['uniqueid']]['faxpages']>0x0&&this[_0x139c('0x23')][_0x271031['uniqueid']][_0x139c('0x16')]==='SUCCESS'){this[_0x139c('0x4c')](_0x271031[_0x139c('0x22')],!![]);}else{this[_0x139c('0x4c')](_0x271031[_0x139c('0x22')],![],this[_0x139c('0x23')][_0x271031[_0x139c('0x22')]][_0x139c('0x54')]?_0x139c('0x55')+this[_0x139c('0x23')][_0x271031['uniqueid']][_0x139c('0x54')]:_0x139c('0x56'));}}}};Fax[_0x139c('0x1d')][_0x139c('0x57')]=function(_0x487260){var _0x4fcbab=this;return new BPromise(function(_0x1baa09,_0x39eeaf){_0x4fcbab['execOriginate'](_0x487260,_0x4fcbab['faxAccounts'][_0x487260[_0x139c('0x58')]])[_0x139c('0x3e')](function(_0x34cca8){ut[_0x139c('0x49')]('[Fax][execOriginate][success]',_0x34cca8);_0x1baa09(ut['message']('Fax\x20received'));})['catch'](function(_0x4dcf3a){ut['logger'](_0x139c('0x59'),_0x4dcf3a);updateStatus(_0x487260);_0x39eeaf(ut[_0x139c('0x39')](_0x139c('0x5a')));});});};Fax[_0x139c('0x1d')][_0x139c('0x5b')]=function(_0x305959){var _0x2db82b=this;return new BPromise(function(_0x36f6ef,_0x2238d5){var _0x50ceaa=_0x2db82b[_0x139c('0x5c')](_0x2db82b[_0x139c('0xd')][_0x305959['FaxAccountId']]['Trunk'],_0x305959);if(_0x50ceaa['isValid']){_0x36f6ef(ut['message'](_0x139c('0x5d')));}else{_0x2238d5(ut[_0x139c('0x39')](_0x50ceaa['message']));}});};function originate(_0x9a4bc9,_0x3a38ce,_0x2fd741){return new BPromise(function(_0x808008,_0x4258bc){if(_0x2fd741){var _0x6f0556=util[_0x139c('0x5e')](_0x139c('0x5f'),path[_0x139c('0x3b')](_0x9a4bc9[_0x139c('0x60')])[_0x139c('0x25')],_0x9a4bc9[_0x139c('0x60')]);gs[_0x139c('0x61')](_0x6f0556)['then'](function(){_0x9a4bc9['path']=util[_0x139c('0x5e')]('%s/%s.tif',path['parse'](_0x9a4bc9[_0x139c('0x60')])[_0x139c('0x62')],path[_0x139c('0x3b')](_0x9a4bc9[_0x139c('0x60')])[_0x139c('0x25')]);_0x3a38ce['XMF-PATH']=_0x9a4bc9[_0x139c('0x60')];ut[_0x139c('0x49')](_0x139c('0x63'),'');ami['Action'](ut[_0x139c('0x64')](_0x9a4bc9,_0x3a38ce))[_0x139c('0x3e')](function(_0x4880ff){_0x808008(_0x4880ff);})[_0x139c('0x40')](function(_0xe57ac6){_0x4258bc(_0xe57ac6);});})['catch'](function(_0xd62454){_0x4258bc(_0xd62454);});}else{ami[_0x139c('0x65')](ut[_0x139c('0x64')](_0x9a4bc9,_0x3a38ce))[_0x139c('0x3e')](function(_0x16e418){_0x808008(_0x16e418);})['catch'](function(_0x4f218b){_0x4258bc(_0x4f218b);});}});}Fax[_0x139c('0x1d')][_0x139c('0x66')]=function(_0x108b9b,_0x150c7f){var _0x112984=this;return new BPromise(function(_0x113344,_0x4c2499){var _0x554641=uuid['v4']();var _0x4009c9=ut['addVariables'](_0x108b9b,_0x150c7f);_0x112984[_0x139c('0x28')][_0x554641]=new Action(_0x554641,_0x150c7f,_0x108b9b);var _0x1fe2f7=_0x112984[_0x139c('0x28')][_0x554641];if(path[_0x139c('0x3b')](_0x108b9b[_0x139c('0x60')])[_0x139c('0x67')]==='.pdf'){originate(_0x1fe2f7,_0x4009c9,!![])[_0x139c('0x3e')](function(_0x319f7d){_0x113344(_0x319f7d);})[_0x139c('0x40')](function(_0x2f8793){_0x4c2499(_0x2f8793);});}else{originate(_0x1fe2f7,_0x4009c9,![])[_0x139c('0x3e')](function(_0x38512c){_0x113344(_0x38512c);})['catch'](function(_0x417095){_0x4c2499(_0x417095);});}});};Fax[_0x139c('0x1d')]['isTrunkReachable']=function(_0x54d275){return!_[_0x139c('0x68')](_0x54d275)&&!_[_0x139c('0x68')](_0x54d275[_0x139c('0x25')])&&!_[_0x139c('0x68')](_0x54d275['active'])&&_0x54d275[_0x139c('0x69')]&&!_[_0x139c('0x68')](this[_0x139c('0xe')][util[_0x139c('0x5e')](_0x139c('0x6a'),_0x54d275[_0x139c('0x25')])])&&!_[_0x139c('0x68')](this[_0x139c('0xe')][util[_0x139c('0x5e')]('SIP/%s',_0x54d275[_0x139c('0x25')])]['status'])&&(this['trunks'][util[_0x139c('0x5e')](_0x139c('0x6a'),_0x54d275[_0x139c('0x25')])]['status']===_0x139c('0x6b')||this[_0x139c('0xe')][util[_0x139c('0x5e')](_0x139c('0x6a'),_0x54d275['name'])]['status']===_0x139c('0x6c'));};Fax[_0x139c('0x1d')][_0x139c('0x5c')]=function(_0x52b6ef,_0x13f18f){if(!this['isTrunkReachable'](_0x52b6ef)){ut[_0x139c('0x49')](_0x139c('0x6d'),_[_0x139c('0x68')](_0x52b6ef)?'':_0x52b6ef[_0x139c('0x25')]+_0x139c('0x6e'));return{'isValid':![],'message':_0x139c('0x6f')};}if(_[_0x139c('0x68')](_0x13f18f[_0x139c('0x6')])){ut['logger'](_0x139c('0x70'),JSON[_0x139c('0x44')](_0x13f18f));return{'isValid':![],'message':_0x139c('0x71')};}if(_['isNil'](_0x13f18f[_0x139c('0x60')])){ut[_0x139c('0x49')](_0x139c('0x72'),JSON[_0x139c('0x44')](_0x13f18f));return{'isValid':![],'message':_0x139c('0x73')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0xa31c=['./util/gs','../../../config/logger','fax','./rpcDb','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','faxstatus','syncFaxStatus','hangup','originateresponse','syncOriginateResponse','context','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','actions','info','syncVarSet','variable','value','prototype','channelstatedesc','operation','filename','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','error','stringify','catch','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','moment','tiff2pdf'];(function(_0x1dac60,_0xcd3a9d){var _0x1dbef2=function(_0x29bc76){while(--_0x29bc76){_0x1dac60['push'](_0x1dac60['shift']());}};_0x1dbef2(++_0xcd3a9d);}(_0xa31c,0x13a));var _0xca31=function(_0x27fdcc,_0x421cb5){_0x27fdcc=_0x27fdcc-0x0;var _0x17c2de=_0xa31c[_0x27fdcc];return _0x17c2de;};'use strict';var util=require(_0xca31('0x0'));var _=require(_0xca31('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xca31('0x2'));var path=require('path');var tiff2pdf=require(_0xca31('0x3'));var gs=require(_0xca31('0x4'));var logger=require(_0xca31('0x5'))(_0xca31('0x6'));var ami=require('../ami');var rpcDb=require(_0xca31('0x7'));var Channel=require('./channel');var ut=require(_0xca31('0x8'));var Action=require('./action');var faxAccount=require(_0xca31('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xca31('0xa'));function Fax(_0x4695e5){this[_0xca31('0xb')]={};this[_0xca31('0xc')]=_0x4695e5[_0xca31('0xc')];this[_0xca31('0xd')]=_0x4695e5['trunks'];this['actions']={};ami['on'](_0xca31('0xe'),this[_0xca31('0xf')][_0xca31('0x10')](this));ami['on'](_0xca31('0x11'),this['syncVarSet'][_0xca31('0x10')](this));ami['on'](_0xca31('0x12'),this[_0xca31('0x13')][_0xca31('0x10')](this));ami['on']('newexten',this['syncNewExten'][_0xca31('0x10')](this));ami['on'](_0xca31('0x14'),this[_0xca31('0x15')][_0xca31('0x10')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xca31('0x10')](this));ami['on'](_0xca31('0x16'),this['syncHangup'][_0xca31('0x10')](this));ami['on'](_0xca31('0x17'),this[_0xca31('0x18')][_0xca31('0x10')](this));}Fax['prototype'][_0xca31('0xf')]=function(_0x4c5ebb){if(_0x4c5ebb[_0xca31('0x19')]==='from-voip-provider'){for(var _0x400e60 in this[_0xca31('0xc')]){if(this[_0xca31('0xc')][_0xca31('0x1a')](_0x400e60)){if(_0x4c5ebb['exten']===this[_0xca31('0xc')][_0x400e60][_0xca31('0x1b')]){this[_0xca31('0xb')][_0x4c5ebb[_0xca31('0x1c')]]={};this[_0xca31('0xb')][_0x4c5ebb[_0xca31('0x1c')]]['channel']=_0x4c5ebb[_0xca31('0x1d')];this[_0xca31('0xb')][_0x4c5ebb[_0xca31('0x1c')]]['id']=this[_0xca31('0xc')][_0x400e60]['id'];this[_0xca31('0xb')][_0x4c5ebb[_0xca31('0x1c')]][_0xca31('0x1e')]=this[_0xca31('0xc')][_0x400e60][_0xca31('0x1e')];logger['info'](_0x4c5ebb['uniqueid'],_0xca31('0x1f'));}}}}if(this[_0xca31('0x20')][_0x4c5ebb['uniqueid']]){this[_0xca31('0xb')][_0x4c5ebb['uniqueid']]={};this['channels'][_0x4c5ebb[_0xca31('0x1c')]][_0xca31('0x1d')]=_0x4c5ebb[_0xca31('0x1d')];logger[_0xca31('0x21')](_0x4c5ebb[_0xca31('0x1c')],_0xca31('0x1f'));}};Fax['prototype'][_0xca31('0x22')]=function(_0x119956){if(this[_0xca31('0xb')][_0x119956[_0xca31('0x1c')]]){for(var _0x1956ed in _0x119956['variable']){if(_0x119956[_0xca31('0x23')][_0xca31('0x1a')](_0x1956ed)){this[_0xca31('0xb')][_0x119956[_0xca31('0x1c')]][_0x1956ed]=_0x119956[_0xca31('0x24')];}}}};Fax[_0xca31('0x25')][_0xca31('0x13')]=function(_0x474b49){if(this['channels'][_0x474b49[_0xca31('0x1c')]]){this['channels'][_0x474b49['uniqueid']]['channelstate']=_0x474b49['channelstate'];this[_0xca31('0xb')][_0x474b49[_0xca31('0x1c')]][_0xca31('0x26')]=_0x474b49['channelstatedesc'];}};Fax[_0xca31('0x25')]['syncNewExten']=function(_0xe6ba5){if(this['channels'][_0xe6ba5[_0xca31('0x1c')]]){for(var _0xa4e915 in _0xe6ba5[_0xca31('0x23')]){if(_0xe6ba5[_0xca31('0x23')][_0xca31('0x1a')](_0xa4e915)){this[_0xca31('0xb')][_0xe6ba5['uniqueid']][_0xa4e915]=_0xe6ba5[_0xca31('0x24')];}}}};Fax['prototype'][_0xca31('0x15')]=function(_0x43a58f){if(this[_0xca31('0xb')][_0x43a58f['uniqueid']]){this[_0xca31('0xb')][_0x43a58f[_0xca31('0x1c')]]['operation']=_0x43a58f[_0xca31('0x27')];this[_0xca31('0xb')][_0x43a58f[_0xca31('0x1c')]]['status']=_0x43a58f['status'];this[_0xca31('0xb')][_0x43a58f[_0xca31('0x1c')]][_0xca31('0x1b')]=_0x43a58f[_0xca31('0x1b')];this[_0xca31('0xb')][_0x43a58f[_0xca31('0x1c')]][_0xca31('0x28')]=_0x43a58f[_0xca31('0x28')];logger[_0xca31('0x21')](_0x43a58f['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x504956){var _0x282179=this;if(this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]]){var _0x1b31eb=this['channels'][_0x504956[_0xca31('0x1c')]]['id'];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]]['remotestationid']=_0x504956['remotestationid'];this[_0xca31('0xb')][_0x504956['uniqueid']][_0xca31('0x29')]=_0x504956['pagestransferred'];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]][_0xca31('0x1b')]=_0x504956[_0xca31('0x1b')];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]][_0xca31('0x2a')]=_0x504956[_0xca31('0x2a')];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]]['transferrate']=_0x504956[_0xca31('0x2b')];this['channels'][_0x504956['uniqueid']][_0xca31('0x28')]=_0x504956[_0xca31('0x28')];this[_0xca31('0xb')][_0x504956[_0xca31('0x1c')]][_0xca31('0x2c')]=_0x504956[_0xca31('0x2c')];if(this[_0xca31('0xb')][_0x504956['uniqueid']][_0xca31('0x29')]>0x0){tiff2pdf(_0x504956[_0xca31('0x28')],_0xca31('0x2d'),function(_0x16d862){logger[_0xca31('0x21')](_0x504956[_0xca31('0x1c')],_0xca31('0x2e'),_0x16d862[_0xca31('0x2f')]);attachment[_0xca31('0x30')]({'name':path[_0xca31('0x31')](_0x504956[_0xca31('0x28')])[_0xca31('0x1e')],'basename':path[_0xca31('0x31')](_0x504956[_0xca31('0x28')])[_0xca31('0x1e')]+_0xca31('0x32'),'type':'application/pdf'})['then'](function(_0x17928f){faxAccount[_0xca31('0x33')](_0x1b31eb,{'from':_0x504956[_0xca31('0x2c')],'mapKey':'fax','body':path['parse'](_0x504956[_0xca31('0x28')])[_0xca31('0x1e')]+'.pdf','AttachmentId':_0x17928f['id']})['catch'](function(_0x299a92){logger[_0xca31('0x34')](_0x504956['uniqueid'],'\x20notify\x20',JSON[_0xca31('0x35')](_0x299a92));});})[_0xca31('0x36')](function(_0x28b150){logger[_0xca31('0x34')](_0x504956[_0xca31('0x1c')],_0xca31('0x37'),JSON[_0xca31('0x35')](_0x28b150));});});}logger['info'](_0x504956[_0xca31('0x1c')],'\x20receiveFax\x20');}};Fax[_0xca31('0x25')][_0xca31('0x18')]=function(_0x1bb4aa){if(this['actions'][_0x1bb4aa[_0xca31('0x1c')]]){_[_0xca31('0x38')](this['channels'][_0x1bb4aa[_0xca31('0x1c')]],_[_0xca31('0x39')](_0x1bb4aa,[_0xca31('0x3a'),'reason']));}};function updateStatus(_0x698755){if(_0x698755[_0xca31('0x3b')]){faxMessage[_0xca31('0x3c')](_0x698755[_0xca31('0x3b')],{'failMessage':_0xca31('0x3d')})['then'](function(_0x18ff48){ut[_0xca31('0x3e')](_0xca31('0x3f'),_0x18ff48);})[_0xca31('0x36')](function(_0x95bd74){ut[_0xca31('0x3e')](_0xca31('0x40'),_0x95bd74);});}else{ut[_0xca31('0x3e')](_0xca31('0x41'));}}Fax[_0xca31('0x25')][_0xca31('0x42')]=function(_0x3ef7ea,_0x3f0400,_0x1197e3){var _0x272824=this;var _0x175f82={};if(_0x3f0400){_0x175f82={'read':_0x3f0400};}else{_0x175f82={'failMessage':_0x1197e3};}if(this[_0xca31('0x20')][_0x3ef7ea][_0xca31('0x3b')]){faxMessage[_0xca31('0x3c')](this[_0xca31('0x20')][_0x3ef7ea][_0xca31('0x3b')],_0x175f82)[_0xca31('0x43')](function(_0x5a9795){ut[_0xca31('0x3e')](_0xca31('0x44'),_0x5a9795);})['catch'](function(_0x1a1d2e){ut[_0xca31('0x3e')]('[Fax][Message][NoUpdate1]',_0x1a1d2e);})[_0xca31('0x45')](function(){delete _0x272824[_0xca31('0xb')][_0x3ef7ea];delete _0x272824[_0xca31('0x20')][_0x3ef7ea];});}else{ut['logger'](_0xca31('0x46'));delete this[_0xca31('0xb')][_0x3ef7ea];delete this[_0xca31('0x20')][_0x3ef7ea];}};Fax[_0xca31('0x25')]['syncHangup']=function(_0x192cbc){var _0x36b8ac=this;if(this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]]){if(this['actions'][_0x192cbc[_0xca31('0x1c')]]){this['channels'][_0x192cbc[_0xca31('0x1c')]]['id']=this['actions'][_0x192cbc[_0xca31('0x1c')]]['id'];this[_0xca31('0xb')][_0x192cbc['uniqueid']][_0xca31('0x1e')]=this[_0xca31('0x20')][_0x192cbc[_0xca31('0x1c')]][_0xca31('0x1e')];}logger[_0xca31('0x21')](_0x192cbc[_0xca31('0x1c')],this[_0xca31('0x20')][_0x192cbc[_0xca31('0x1c')]]?_0xca31('0x47'):_0xca31('0x48'),JSON[_0xca31('0x35')](this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]]));if(this['actions'][_0x192cbc[_0xca31('0x1c')]]){if(this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]][_0xca31('0x49')]>0x0&&this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]][_0xca31('0x14')]===_0xca31('0x4a')){this['updateStatus'](_0x192cbc[_0xca31('0x1c')],!![]);}else{this[_0xca31('0x42')](_0x192cbc['uniqueid'],![],this[_0xca31('0xb')][_0x192cbc[_0xca31('0x1c')]][_0xca31('0x4b')]?_0xca31('0x4c')+this[_0xca31('0xb')][_0x192cbc['uniqueid']][_0xca31('0x4b')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x3d6a23){var _0x4d8658=this;return new BPromise(function(_0xc1531d,_0x5eafef){_0x4d8658[_0xca31('0x4d')](_0x3d6a23,_0x4d8658['faxAccounts'][_0x3d6a23[_0xca31('0x4e')]])[_0xca31('0x43')](function(_0xdc3673){ut[_0xca31('0x3e')](_0xca31('0x4f'),_0xdc3673);_0xc1531d(ut[_0xca31('0x2f')]('Fax\x20received'));})[_0xca31('0x36')](function(_0x548a12){ut[_0xca31('0x3e')](_0xca31('0x50'),_0x548a12);updateStatus(_0x3d6a23);_0x5eafef(ut[_0xca31('0x2f')]('Fax\x20failed'));});});};Fax['prototype'][_0xca31('0x51')]=function(_0x46a719){var _0x42f83d=this;return new BPromise(function(_0x21809a,_0x15e6c3){var _0x384c02=_0x42f83d['checkTrunk'](_0x42f83d[_0xca31('0xc')][_0x46a719[_0xca31('0x4e')]][_0xca31('0x52')],_0x46a719);if(_0x384c02['isValid']){_0x21809a(ut['message'](_0xca31('0x53')));}else{_0x15e6c3(ut['message'](_0x384c02[_0xca31('0x2f')]));}});};function originate(_0x4c66c5,_0x357923,_0x38cac){return new BPromise(function(_0x2008a6,_0x9e0518){if(_0x38cac){var _0x237ec0=util[_0xca31('0x54')](_0xca31('0x55'),path[_0xca31('0x31')](_0x4c66c5[_0xca31('0x56')])[_0xca31('0x1e')],_0x4c66c5[_0xca31('0x56')]);gs['execute'](_0x237ec0)[_0xca31('0x43')](function(){_0x4c66c5[_0xca31('0x56')]=util['format'](_0xca31('0x57'),path['parse'](_0x4c66c5[_0xca31('0x56')])['dir'],path[_0xca31('0x31')](_0x4c66c5[_0xca31('0x56')])[_0xca31('0x1e')]);_0x357923[_0xca31('0x58')]=_0x4c66c5[_0xca31('0x56')];ut[_0xca31('0x3e')](_0xca31('0x59'),'');ami[_0xca31('0x5a')](ut['variablesAction'](_0x4c66c5,_0x357923))['then'](function(_0x1636ad){_0x2008a6(_0x1636ad);})[_0xca31('0x36')](function(_0x302144){_0x9e0518(_0x302144);});})[_0xca31('0x36')](function(_0x33e75f){_0x9e0518(_0x33e75f);});}else{ami['Action'](ut['variablesAction'](_0x4c66c5,_0x357923))['then'](function(_0x2e9337){_0x2008a6(_0x2e9337);})['catch'](function(_0x46a3bb){_0x9e0518(_0x46a3bb);});}});}Fax[_0xca31('0x25')][_0xca31('0x4d')]=function(_0x3b5516,_0x30aebd){var _0x475845=this;return new BPromise(function(_0x3cafa7,_0x3183c7){var _0x250a63=uuid['v4']();var _0xc56d1b=ut[_0xca31('0x5b')](_0x3b5516,_0x30aebd);_0x475845[_0xca31('0x20')][_0x250a63]=new Action(_0x250a63,_0x30aebd,_0x3b5516);var _0x5a8535=_0x475845[_0xca31('0x20')][_0x250a63];if(path[_0xca31('0x31')](_0x3b5516[_0xca31('0x56')])[_0xca31('0x5c')]===_0xca31('0x32')){originate(_0x5a8535,_0xc56d1b,!![])[_0xca31('0x43')](function(_0x553b14){_0x3cafa7(_0x553b14);})[_0xca31('0x36')](function(_0x44f3d8){_0x3183c7(_0x44f3d8);});}else{originate(_0x5a8535,_0xc56d1b,![])[_0xca31('0x43')](function(_0x376737){_0x3cafa7(_0x376737);})[_0xca31('0x36')](function(_0xe27372){_0x3183c7(_0xe27372);});}});};Fax[_0xca31('0x25')][_0xca31('0x5d')]=function(_0x581f30){return!_[_0xca31('0x5e')](_0x581f30)&&!_[_0xca31('0x5e')](_0x581f30[_0xca31('0x1e')])&&!_[_0xca31('0x5e')](_0x581f30[_0xca31('0x5f')])&&_0x581f30['active']&&!_['isNil'](this['trunks'][util[_0xca31('0x54')](_0xca31('0x60'),_0x581f30[_0xca31('0x1e')])])&&!_[_0xca31('0x5e')](this['trunks'][util[_0xca31('0x54')](_0xca31('0x60'),_0x581f30[_0xca31('0x1e')])][_0xca31('0x61')])&&(this[_0xca31('0xd')][util[_0xca31('0x54')]('SIP/%s',_0x581f30[_0xca31('0x1e')])][_0xca31('0x61')]===_0xca31('0x62')||this[_0xca31('0xd')][util[_0xca31('0x54')](_0xca31('0x60'),_0x581f30[_0xca31('0x1e')])]['status']==='unmonitored');};Fax[_0xca31('0x25')][_0xca31('0x63')]=function(_0x4c9a9b,_0x204949){if(!this[_0xca31('0x5d')](_0x4c9a9b)){ut[_0xca31('0x3e')](_0xca31('0x64'),_[_0xca31('0x5e')](_0x4c9a9b)?'':_0x4c9a9b[_0xca31('0x1e')]+_0xca31('0x65'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xca31('0x5e')](_0x204949[_0xca31('0x6')])){ut[_0xca31('0x3e')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xca31('0x35')](_0x204949));return{'isValid':![],'message':_0xca31('0x66')};}if(_[_0xca31('0x5e')](_0x204949[_0xca31('0x56')])){ut['logger'](_0xca31('0x67'),JSON[_0xca31('0x35')](_0x204949));return{'isValid':![],'message':_0xca31('0x68')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xca31('0x69')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0bfaf75..5eb7aec 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 _0x4240=['../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20','util','bluebird'];(function(_0x35bd6c,_0x585087){var _0x2f421d=function(_0x42ae70){while(--_0x42ae70){_0x35bd6c['push'](_0x35bd6c['shift']());}};_0x2f421d(++_0x585087);}(_0x4240,0x148));var _0x0424=function(_0x28f2db,_0x20cb8b){_0x28f2db=_0x28f2db-0x0;var _0x3d93b7=_0x4240[_0x28f2db];return _0x3d93b7;};'use strict';var util=require(_0x0424('0x0'));var BPromise=require(_0x0424('0x1'));var logger=require(_0x0424('0x2'))('preview');var _=require(_0x0424('0x3'));var faxAccount=require(_0x0424('0x4'));function loggerCatch(_0x3414e6){return function(_0x3adcf4){logger[_0x0424('0x5')](_0x3414e6,util[_0x0424('0x6')](_0x3adcf4,{'showHidden':![],'depth':null}));};}exports[_0x0424('0x7')]=function(_0x4818a4,_0x2025a0){return BPromise['resolve']()[_0x0424('0x8')](faxAccount[_0x0424('0x7')](_0x4818a4,_0x2025a0))[_0x0424('0x9')](loggerCatch(_0x0424('0xa')));}; \ No newline at end of file +var _0x6c6d=['lodash','../rpc/faxAccount','error','inspect','resolve','then','notify','catch','[Notify]\x20','bluebird','preview'];(function(_0x3f553b,_0x49a9c2){var _0x183c4e=function(_0x873b22){while(--_0x873b22){_0x3f553b['push'](_0x3f553b['shift']());}};_0x183c4e(++_0x49a9c2);}(_0x6c6d,0x1c1));var _0xd6c6=function(_0x4d99bb,_0x4ce36c){_0x4d99bb=_0x4d99bb-0x0;var _0x2593ca=_0x6c6d[_0x4d99bb];return _0x2593ca;};'use strict';var util=require('util');var BPromise=require(_0xd6c6('0x0'));var logger=require('../../../config/logger')(_0xd6c6('0x1'));var _=require(_0xd6c6('0x2'));var faxAccount=require(_0xd6c6('0x3'));function loggerCatch(_0x56e563){return function(_0x5139f9){logger[_0xd6c6('0x4')](_0x56e563,util[_0xd6c6('0x5')](_0x5139f9,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x47fae2,_0x59c49a){return BPromise[_0xd6c6('0x6')]()[_0xd6c6('0x7')](faxAccount[_0xd6c6('0x8')](_0x47fae2,_0x59c49a))[_0xd6c6('0x9')](loggerCatch(_0xd6c6('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 7e20350..7e6624b 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 _0x080b=['info','inspect','util','../../../../config/logger','fax','bluebird','child_process','execute','Exec\x20gs'];(function(_0x46b979,_0x3f0e9a){var _0x355217=function(_0x3c297d){while(--_0x3c297d){_0x46b979['push'](_0x46b979['shift']());}};_0x355217(++_0x3f0e9a);}(_0x080b,0xe3));var _0xb080=function(_0x369758,_0xe06da2){_0x369758=_0x369758-0x0;var _0x20aec7=_0x080b[_0x369758];return _0x20aec7;};'use strict';var util=require(_0xb080('0x0'));var logger=require(_0xb080('0x1'))(_0xb080('0x2'));var BPromise=require(_0xb080('0x3'));var exec=require(_0xb080('0x4'))['exec'];exports[_0xb080('0x5')]=function(_0x11a5e8){return new BPromise(function(_0x395b68,_0x2e0be0){exec(_0x11a5e8,function(_0x1b69b4,_0x56492e,_0x16b317){logger['info'](_0xb080('0x6'),_0x56492e);if(_0x1b69b4){logger[_0xb080('0x7')](_0xb080('0x6'),'\x20Error\x20:',util[_0xb080('0x8')](_0x1b69b4,{'showHidden':![],'depth':null}),_0x56492e,_0x16b317);_0x2e0be0(_0x1b69b4);}_0x395b68(_0x56492e);});});}; \ No newline at end of file +var _0xcb01=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xcb01,0x69));var _0x1cb0=function(_0x3eb267,_0x441384){_0x3eb267=_0x3eb267-0x0;var _0x55b58f=_0xcb01[_0x3eb267];return _0x55b58f;};'use strict';var util=require('util');var logger=require(_0x1cb0('0x0'))(_0x1cb0('0x1'));var BPromise=require(_0x1cb0('0x2'));var exec=require(_0x1cb0('0x3'))[_0x1cb0('0x4')];exports[_0x1cb0('0x5')]=function(_0x4ce33c){return new BPromise(function(_0x288d56,_0x54379a){exec(_0x4ce33c,function(_0x23900b,_0x5b7835,_0x447550){logger[_0x1cb0('0x6')](_0x1cb0('0x7'),_0x5b7835);if(_0x23900b){logger[_0x1cb0('0x6')](_0x1cb0('0x7'),_0x1cb0('0x8'),util[_0x1cb0('0x9')](_0x23900b,{'showHidden':![],'depth':null}),_0x5b7835,_0x447550);_0x54379a(_0x23900b);}_0x288d56(_0x5b7835);});});}; \ 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 79ff281..0af4f38 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 _0xbdb7=['faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','from-sip','util','lodash','moment','../../../../config/logger','fax','message','logger','info','headerinfo','minrate','\x22%s\x22','modem','gateway'];(function(_0x1cf768,_0x3bb462){var _0x29bb54=function(_0x3b9ca9){while(--_0x3b9ca9){_0x1cf768['push'](_0x1cf768['shift']());}};_0x29bb54(++_0x3bb462);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x526818,_0x30c916){_0x526818=_0x526818-0x0;var _0x44c7e3=_0xbdb7[_0x526818];return _0x44c7e3;};'use strict';var util=require(_0x7bdb('0x0'));var _=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var logger=require(_0x7bdb('0x3'))(_0x7bdb('0x4'));exports[_0x7bdb('0x5')]=function(_0x4496ac){return{'message':_0x4496ac};};exports[_0x7bdb('0x6')]=function(_0x46c068,_0x47aec5){logger[_0x7bdb('0x7')](_0x46c068,util['inspect'](_0x47aec5,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0xffdc86,_0x1e23a3){var _0x493bde={'XMF-ECM':_0x1e23a3['ecm'],'XMF-HEADERINFO':_0x1e23a3[_0x7bdb('0x8')],'XMF-MINRATE':_0x1e23a3[_0x7bdb('0x9')],'XMF-MAXRATE':_0x1e23a3['maxrate'],'XMF-MODEM':util['format'](_0x7bdb('0xa'),_0x1e23a3[_0x7bdb('0xb')]),'XMF-GATEWAY':_0x1e23a3[_0x7bdb('0xc')],'XMF-FAXDETECT':_0x1e23a3[_0x7bdb('0xd')],'XMF-T38TIMEOUT':_0x1e23a3[_0x7bdb('0xe')],'XMF-LOCALSTATIONID':_0x1e23a3[_0x7bdb('0xf')],'XMF-PATH':_0xffdc86[_0x7bdb('0x10')]};return _0x493bde;};exports[_0x7bdb('0x11')]=function(_0x5462da,_0x4e5b8e){return{'actionid':_0x5462da['uniqueid'],'action':_0x7bdb('0x12'),'channel':_0x5462da[_0x7bdb('0x13')],'Exten':'xcally-motion-fax','Context':_0x7bdb('0x14'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x5462da[_0x7bdb('0x8')]?_0x5462da[_0x7bdb('0x8')]:'',_0x5462da['localstationid']),'variable':_0x4e5b8e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5462da['uniqueid']};}; \ No newline at end of file +var _0xb821=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','message','info','inspect','ecm','headerinfo','minrate','maxrate'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0xb821,0xa7));var _0x1b82=function(_0x251f5d,_0x5ce3ba){_0x251f5d=_0x251f5d-0x0;var _0x354c31=_0xb821[_0x251f5d];return _0x354c31;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var logger=require('../../../../config/logger')('fax');exports[_0x1b82('0x2')]=function(_0x578a10){return{'message':_0x578a10};};exports['logger']=function(_0x3b1d14,_0x1403ab){logger[_0x1b82('0x3')](_0x3b1d14,util[_0x1b82('0x4')](_0x1403ab,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3e27c4,_0x192434){var _0x202a5f={'XMF-ECM':_0x192434[_0x1b82('0x5')],'XMF-HEADERINFO':_0x192434[_0x1b82('0x6')],'XMF-MINRATE':_0x192434[_0x1b82('0x7')],'XMF-MAXRATE':_0x192434[_0x1b82('0x8')],'XMF-MODEM':util[_0x1b82('0x9')](_0x1b82('0xa'),_0x192434['modem']),'XMF-GATEWAY':_0x192434[_0x1b82('0xb')],'XMF-FAXDETECT':_0x192434[_0x1b82('0xc')],'XMF-T38TIMEOUT':_0x192434[_0x1b82('0xd')],'XMF-LOCALSTATIONID':_0x192434[_0x1b82('0xe')],'XMF-PATH':_0x3e27c4[_0x1b82('0xf')]};return _0x202a5f;};exports[_0x1b82('0x10')]=function(_0x739f99,_0x1ce719){return{'actionid':_0x739f99['uniqueid'],'action':_0x1b82('0x11'),'channel':_0x739f99[_0x1b82('0x12')],'Exten':_0x1b82('0x13'),'Context':_0x1b82('0x14'),'Priority':'1','callerid':util['format'](_0x1b82('0x15'),_0x739f99['headerinfo']?_0x739f99['headerinfo']:'',_0x739f99[_0x1b82('0xe')]),'variable':_0x1ce719,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x739f99['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index fc9f26a..f8812b7 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 _0xd1aa=['hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get'];(function(_0x4976eb,_0x4b09d1){var _0x5dd7b2=function(_0x4556a2){while(--_0x4556a2){_0x4976eb['push'](_0x4976eb['shift']());}};_0x5dd7b2(++_0x4b09d1);}(_0xd1aa,0x136));var _0xad1a=function(_0x923ab6,_0x200ec5){_0x923ab6=_0x923ab6-0x0;var _0x484752=_0xd1aa[_0x923ab6];return _0x484752;};'use strict';var BPromise=require(_0xad1a('0x0'));var util=require(_0xad1a('0x1'));var moment=require(_0xad1a('0x2'));var server=require(_0xad1a('0x3'));var Realtime=require(_0xad1a('0x4'));var Report=require(_0xad1a('0x5'));var Acw=require('./acw');var Trigger=require(_0xad1a('0x6'));var Dialer=require(_0xad1a('0x7'));var Preview=require(_0xad1a('0x8'));var Fax=require(_0xad1a('0x9'));var user=require(_0xad1a('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xad1a('0xb'));var trigger=require('./rpc/trigger');var template=require(_0xad1a('0xc'));var cmHopperHistory=require(_0xad1a('0xd'));var campaign=require(_0xad1a('0xe'));var voiceExtension=require(_0xad1a('0xf'));var faxAccount=require(_0xad1a('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xad1a('0x11'));var freshdesk=require(_0xad1a('0x12'));var desk=require(_0xad1a('0x13'));var zoho=require(_0xad1a('0x14'));var vtiger=require(_0xad1a('0x15'));var freshsales=require(_0xad1a('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xad1a('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xad1a('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xad1a('0x18')](_0xad1a('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xad1a('0x1a')]()[_0xad1a('0x1b')](user[_0xad1a('0x1c')]())[_0xad1a('0x1b')](realtime['initAgents']())[_0xad1a('0x1b')](user[_0xad1a('0x1d')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x1e')]())[_0xad1a('0x1b')](trunk[_0xad1a('0x1f')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x20')]())[_0xad1a('0x1b')](voiceQueue[_0xad1a('0x21')]())[_0xad1a('0x1b')](realtime['initVoiceQueues']())[_0xad1a('0x1b')](trigger[_0xad1a('0x22')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x23')]())['then'](template[_0xad1a('0x24')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x25')]())['then'](zendesk['getZendeskAccounts']())[_0xad1a('0x1b')](realtime[_0xad1a('0x26')]())[_0xad1a('0x1b')](salesforce[_0xad1a('0x27')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x28')]())[_0xad1a('0x1b')](sugarcrm[_0xad1a('0x29')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x2a')]())[_0xad1a('0x1b')](freshdesk[_0xad1a('0x2b')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x2c')]())[_0xad1a('0x1b')](desk[_0xad1a('0x2d')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x2e')]())[_0xad1a('0x1b')](zoho[_0xad1a('0x2f')]())['then'](realtime[_0xad1a('0x30')]())[_0xad1a('0x1b')](vtiger[_0xad1a('0x31')]())['then'](realtime['initVtigerAccounts']())['then'](freshsales[_0xad1a('0x32')]())['then'](realtime[_0xad1a('0x33')]())[_0xad1a('0x1b')](servicenow['getServicenowAccounts']())[_0xad1a('0x1b')](realtime[_0xad1a('0x34')]())[_0xad1a('0x1b')](dynamics365[_0xad1a('0x35')]())[_0xad1a('0x1b')](realtime['initDynamics365Accounts']())[_0xad1a('0x1b')](campaign[_0xad1a('0x36')]())[_0xad1a('0x1b')](realtime['initCampaigns']())[_0xad1a('0x1b')](voiceExtension[_0xad1a('0x37')]())[_0xad1a('0x1b')](realtime['initVoiceExtensions']())[_0xad1a('0x1b')](faxAccount[_0xad1a('0x38')]())[_0xad1a('0x1b')](realtime['initFaxAccounts']())[_0xad1a('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0xad1a('0x1a')]()[_0xad1a('0x1b')](voiceQueueReport[_0xad1a('0x39')]())[_0xad1a('0x1b')](realtime[_0xad1a('0x3a')]())[_0xad1a('0x1b')](cmHopperHistory[_0xad1a('0x3b')]())['then'](realtime[_0xad1a('0x3c')]())[_0xad1a('0x1b')](cmHopperHistory['getCampaignHopperHistory']())[_0xad1a('0x1b')](realtime[_0xad1a('0x3d')]())[_0xad1a('0x1b')](voiceCallReport[_0xad1a('0x3e')]())[_0xad1a('0x1b')](realtime['initVoiceCallReports']())['then'](function(_0x30b683){})[_0xad1a('0x3f')](function(_0x1189f5){console[_0xad1a('0x40')](_0x1189f5);});}function main(){return server[_0xad1a('0x41')](realtime,preview,fax)[_0xad1a('0x1b')](function(_0x381745){return initRealtime();})['then'](function(){return initParams();})[_0xad1a('0x1b')](function(){report[_0xad1a('0x42')]();setInterval(initRealtime,0x1388);})[_0xad1a('0x3f')](function(_0x230a68){console['log'](_0x230a68);});}main(); \ No newline at end of file +var _0xdda8=['initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','sync','catch','log','bluebird','util','moment','./server','./realtime','./report','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xdda8,0xc2));var _0x8dda=function(_0x582aaf,_0x54dddb){_0x582aaf=_0x582aaf-0x0;var _0x8ef3ef=_0xdda8[_0x582aaf];return _0x8ef3ef;};'use strict';var BPromise=require(_0x8dda('0x0'));var util=require(_0x8dda('0x1'));var moment=require(_0x8dda('0x2'));var server=require(_0x8dda('0x3'));var Realtime=require(_0x8dda('0x4'));var Report=require(_0x8dda('0x5'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x8dda('0x6'));var Preview=require(_0x8dda('0x7'));var Fax=require('./fax');var user=require(_0x8dda('0x8'));var voiceQueue=require(_0x8dda('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x8dda('0xa'));var trunk=require(_0x8dda('0xb'));var trigger=require(_0x8dda('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0x8dda('0xd'));var campaign=require(_0x8dda('0xe'));var voiceExtension=require(_0x8dda('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x8dda('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x8dda('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x8dda('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x8dda('0x13'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x8dda('0x14'));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()[_0x8dda('0x15')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x8dda('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8dda('0x17')]()[_0x8dda('0x18')](user[_0x8dda('0x19')]())[_0x8dda('0x18')](realtime[_0x8dda('0x1a')]())[_0x8dda('0x18')](user[_0x8dda('0x1b')]())[_0x8dda('0x18')](realtime[_0x8dda('0x1c')]())[_0x8dda('0x18')](trunk['getTrunks']())[_0x8dda('0x18')](realtime['initTrunks']())[_0x8dda('0x18')](voiceQueue[_0x8dda('0x1d')]())[_0x8dda('0x18')](realtime[_0x8dda('0x1e')]())[_0x8dda('0x18')](trigger['getTriggers']())[_0x8dda('0x18')](realtime['initTriggers']())[_0x8dda('0x18')](template[_0x8dda('0x1f')]())[_0x8dda('0x18')](realtime[_0x8dda('0x20')]())[_0x8dda('0x18')](zendesk[_0x8dda('0x21')]())[_0x8dda('0x18')](realtime[_0x8dda('0x22')]())['then'](salesforce['getSalesforceAccounts']())[_0x8dda('0x18')](realtime['initSalesforceAccounts']())[_0x8dda('0x18')](sugarcrm['getSugarcrmAccounts']())[_0x8dda('0x18')](realtime[_0x8dda('0x23')]())[_0x8dda('0x18')](freshdesk[_0x8dda('0x24')]())[_0x8dda('0x18')](realtime[_0x8dda('0x25')]())[_0x8dda('0x18')](desk['getDeskAccounts']())[_0x8dda('0x18')](realtime[_0x8dda('0x26')]())[_0x8dda('0x18')](zoho['getZohoAccounts']())['then'](realtime[_0x8dda('0x27')]())[_0x8dda('0x18')](vtiger[_0x8dda('0x28')]())[_0x8dda('0x18')](realtime[_0x8dda('0x29')]())[_0x8dda('0x18')](freshsales[_0x8dda('0x2a')]())[_0x8dda('0x18')](realtime[_0x8dda('0x2b')]())['then'](servicenow[_0x8dda('0x2c')]())[_0x8dda('0x18')](realtime['initServicenowAccounts']())[_0x8dda('0x18')](dynamics365['getDynamics365Accounts']())[_0x8dda('0x18')](realtime[_0x8dda('0x2d')]())[_0x8dda('0x18')](campaign[_0x8dda('0x2e')]())['then'](realtime[_0x8dda('0x2f')]())['then'](voiceExtension[_0x8dda('0x30')]())[_0x8dda('0x18')](realtime[_0x8dda('0x31')]())['then'](faxAccount[_0x8dda('0x32')]())[_0x8dda('0x18')](realtime['initFaxAccounts']())[_0x8dda('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x8dda('0x17')]()[_0x8dda('0x18')](voiceQueueReport[_0x8dda('0x33')]())[_0x8dda('0x18')](realtime[_0x8dda('0x34')]())[_0x8dda('0x18')](cmHopperHistory[_0x8dda('0x35')]())[_0x8dda('0x18')](realtime[_0x8dda('0x36')]())['then'](cmHopperHistory[_0x8dda('0x37')]())[_0x8dda('0x18')](realtime[_0x8dda('0x38')]())[_0x8dda('0x18')](voiceCallReport[_0x8dda('0x39')]())[_0x8dda('0x18')](realtime[_0x8dda('0x3a')]())[_0x8dda('0x18')](function(_0x6e73dd){})['catch'](function(_0x3cb16e){console['log'](_0x3cb16e);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x41fc59){return initRealtime();})['then'](function(){return initParams();})[_0x8dda('0x18')](function(){report[_0x8dda('0x3b')]();setInterval(initRealtime,0x1388);})[_0x8dda('0x3c')](function(_0x4c0e60){console[_0x8dda('0x3d')](_0x4c0e60);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 3ecba13..6dd3a14 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 _0x26e1=['online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','voiceStatusTime','toNumber','format','status','user:%s','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','mobile','interface'];(function(_0xc6b011,_0x5d1f19){var _0x420171=function(_0x433751){while(--_0x433751){_0xc6b011['push'](_0xc6b011['shift']());}};_0x420171(++_0x5d1f19);}(_0x26e1,0xff));var _0x126e=function(_0x4037d7,_0x5a292f){_0x4037d7=_0x4037d7-0x0;var _0x2799b7=_0x26e1[_0x4037d7];return _0x2799b7;};'use strict';var _=require(_0x126e('0x0'));var util=require('util');var moment=require(_0x126e('0x1'));var md5=require(_0x126e('0x2'));var Redis=require(_0x126e('0x3'));var config=require(_0x126e('0x4'));config[_0x126e('0x5')]=_['defaults'](config[_0x126e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x126e('0x6'))(new Redis(config[_0x126e('0x5')]));function Agent(_0x495013){this['id']=_0x495013['id']||0x0;this[_0x126e('0x7')]=_0x495013['name']||'';this[_0x126e('0x8')]=_0x495013[_0x126e('0x8')]||'';this[_0x126e('0x9')]=_0x495013['accountcode']||'';this[_0x126e('0xa')]=_0x495013[_0x126e('0xa')]||'';this[_0x126e('0xb')]=_0x126e('0xc');this[_0x126e('0xd')]=0x0;this['status']=_0x126e('0xc');this[_0x126e('0xe')]='';this[_0x126e('0xf')]='';this[_0x126e('0x10')]='';this[_0x126e('0x11')]='';this[_0x126e('0x12')]=_0x495013[_0x126e('0x12')]||![];this[_0x126e('0x13')]='unknown';this['voiceStatusTime']=0x0;this[_0x126e('0x14')]='';this[_0x126e('0x15')]='';this[_0x126e('0x16')]=![];this[_0x126e('0x17')]=![];this['md5']='';}Agent['prototype'][_0x126e('0x18')]=function(_0x1db089){var _0x26f64a;if(_0x1db089&&_0x1db089[_0x126e('0xb')]){_0x26f64a=_0x1db089[_0x126e('0xb')][_0x126e('0x19')]();switch(_0x26f64a){case _0x126e('0x1a'):_0x26f64a=_0x126e('0x1b');break;case _0x126e('0x1c'):_0x26f64a=_0x126e('0x1d');break;}}if(_0x26f64a&&this[_0x126e('0x13')]!==_0x26f64a||_0x1db089[_0x126e('0x1e')]){this[_0x126e('0x1f')]=_[_0x126e('0x20')](moment()[_0x126e('0x21')]('x'));}if(_0x26f64a){this[_0x126e('0x13')]=_0x26f64a;}var _0x1cf30a={'id':this['id'],'name':this[_0x126e('0x7')],'email':this[_0x126e('0x8')],'accountcode':this[_0x126e('0x9')],'fullname':this['fullname'],'state':this[_0x126e('0xb')],'stateTime':this[_0x126e('0xd')],'status':this[_0x126e('0x22')],'address':this[_0x126e('0xe')],'online':this[_0x126e('0x12')],'voiceStatus':this[_0x126e('0x13')],'voiceStatusTime':this[_0x126e('0x1f')],'voiceStatusCallerIdNumber':this[_0x126e('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x126e('0x11')],'onhold':this[_0x126e('0x16')]};var _0x53bd21=md5(JSON['stringify'](_0x1cf30a));if(this[_0x126e('0x2')]!==_0x53bd21){this[_0x126e('0x2')]=_0x53bd21;io['to'](util[_0x126e('0x21')](_0x126e('0x23'),_0x1cf30a[_0x126e('0x7')]))[_0x126e('0x24')](_0x126e('0x25'),_0x1cf30a);}};module[_0x126e('0x26')]=Agent; \ No newline at end of file +var _0xeb75=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','state','toLowerCase','not_inuse','idle','talking','statePause','toNumber','stringify','format','emit','user:save','exports','util','moment','md5','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x226adc,_0x361a3c){var _0x154b10=function(_0x8578b4){while(--_0x8578b4){_0x226adc['push'](_0x226adc['shift']());}};_0x154b10(++_0x361a3c);}(_0xeb75,0x119));var _0x5eb7=function(_0x3f6a5a,_0x41108a){_0x3f6a5a=_0x3f6a5a-0x0;var _0x54d9e3=_0xeb75[_0x3f6a5a];return _0x54d9e3;};'use strict';var _=require('lodash');var util=require(_0x5eb7('0x0'));var moment=require(_0x5eb7('0x1'));var md5=require(_0x5eb7('0x2'));var Redis=require('ioredis');var config=require(_0x5eb7('0x3'));config['redis']=_[_0x5eb7('0x4')](config[_0x5eb7('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x5eb7('0x6'))(new Redis(config[_0x5eb7('0x5')]));function Agent(_0x4ba4d3){this['id']=_0x4ba4d3['id']||0x0;this[_0x5eb7('0x7')]=_0x4ba4d3['name']||'';this[_0x5eb7('0x8')]=_0x4ba4d3[_0x5eb7('0x8')]||'';this[_0x5eb7('0x9')]=_0x4ba4d3[_0x5eb7('0x9')]||'';this[_0x5eb7('0xa')]=_0x4ba4d3[_0x5eb7('0xa')]||'';this['state']=_0x5eb7('0xb');this[_0x5eb7('0xc')]=0x0;this[_0x5eb7('0xd')]=_0x5eb7('0xb');this[_0x5eb7('0xe')]='';this['phone']='';this[_0x5eb7('0xf')]='';this['interface']='';this[_0x5eb7('0x10')]=_0x4ba4d3[_0x5eb7('0x10')]||![];this[_0x5eb7('0x11')]=_0x5eb7('0xb');this[_0x5eb7('0x12')]=0x0;this[_0x5eb7('0x13')]='';this[_0x5eb7('0x14')]='';this[_0x5eb7('0x15')]=![];this[_0x5eb7('0x16')]=![];this[_0x5eb7('0x2')]='';}Agent[_0x5eb7('0x17')]['updateStatusRealtime']=function(_0x5965b9){var _0x12290d;if(_0x5965b9&&_0x5965b9[_0x5eb7('0x18')]){_0x12290d=_0x5965b9[_0x5eb7('0x18')][_0x5eb7('0x19')]();switch(_0x12290d){case _0x5eb7('0x1a'):_0x12290d=_0x5eb7('0x1b');break;case'inuse':_0x12290d=_0x5eb7('0x1c');break;}}if(_0x12290d&&this['voiceStatus']!==_0x12290d||_0x5965b9[_0x5eb7('0x1d')]){this[_0x5eb7('0x12')]=_[_0x5eb7('0x1e')](moment()['format']('x'));}if(_0x12290d){this[_0x5eb7('0x11')]=_0x12290d;}var _0x3e1f8e={'id':this['id'],'name':this[_0x5eb7('0x7')],'email':this[_0x5eb7('0x8')],'accountcode':this[_0x5eb7('0x9')],'fullname':this[_0x5eb7('0xa')],'state':this[_0x5eb7('0x18')],'stateTime':this[_0x5eb7('0xc')],'status':this['status'],'address':this[_0x5eb7('0xe')],'online':this[_0x5eb7('0x10')],'voiceStatus':this[_0x5eb7('0x11')],'voiceStatusTime':this[_0x5eb7('0x12')],'voiceStatusCallerIdNumber':this[_0x5eb7('0x13')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x5eb7('0x15')]};var _0xa3c164=md5(JSON[_0x5eb7('0x1f')](_0x3e1f8e));if(this['md5']!==_0xa3c164){this[_0x5eb7('0x2')]=_0xa3c164;io['to'](util[_0x5eb7('0x20')]('user:%s',_0x3e1f8e[_0x5eb7('0x7')]))[_0x5eb7('0x21')](_0x5eb7('0x22'),_0x3e1f8e);}};module[_0x5eb7('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 0895494..15af07a 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 _0x248f=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x376d96,_0x4fe147){var _0x52a22b=function(_0x4b4837){while(--_0x4b4837){_0x376d96['push'](_0x376d96['shift']());}};_0x52a22b(++_0x4fe147);}(_0x248f,0xb8));var _0xf248=function(_0x2cc303,_0x2c4a2a){_0x2cc303=_0x2cc303-0x0;var _0x82a2ca=_0x248f[_0x2cc303];return _0x82a2ca;};'use strict';function Campaign(_0x14bc20){this['id']=_0x14bc20['id']||0x0;this['name']=_0x14bc20[_0xf248('0x0')]||'';this[_0xf248('0x1')]=_0x14bc20[_0xf248('0x1')]||_0xf248('0x2');this[_0xf248('0x3')]=0x0;this[_0xf248('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xf248('0x5')]=0x0;this['message']='';this[_0xf248('0x6')]=!![];this[_0xf248('0x7')]=_0x14bc20[_0xf248('0x7')];this[_0xf248('0x8')]=_0x14bc20['limitCalls'];this[_0xf248('0x9')]=_0x14bc20['dialTimezone']||null;this[_0xf248('0xa')]=_0x14bc20[_0xf248('0xa')]?_0x14bc20['dialGlobalInterval']:null;this[_0xf248('0xb')]=_0x14bc20[_0xf248('0xb')];this[_0xf248('0xc')]=_0x14bc20[_0xf248('0xc')];this[_0xf248('0xd')]=_0x14bc20['dialOriginateTimeout']||0x1e;this[_0xf248('0xe')]=_0x14bc20['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x14bc20[_0xf248('0xf')];this[_0xf248('0x10')]=_0x14bc20[_0xf248('0x10')];this[_0xf248('0x11')]=_0x14bc20[_0xf248('0x11')];this[_0xf248('0x12')]=_0x14bc20[_0xf248('0x12')];this['dialNoAnswerRetryFrequency']=_0x14bc20[_0xf248('0x13')];this[_0xf248('0x14')]=_0x14bc20[_0xf248('0x14')];this[_0xf248('0x15')]=_0x14bc20[_0xf248('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x14bc20[_0xf248('0x16')]||0x96;this['dialDropMaxRetry']=_0x14bc20[_0xf248('0x17')]||0x3;this[_0xf248('0x18')]=_0x14bc20[_0xf248('0x18')]||0x96;this[_0xf248('0x19')]=_0x14bc20[_0xf248('0x19')]||0x3;this[_0xf248('0x1a')]=_0x14bc20[_0xf248('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x14bc20[_0xf248('0x1b')]||0x3;this[_0xf248('0x1c')]=_0x14bc20[_0xf248('0x1c')]||0x96;this[_0xf248('0x1d')]=_0x14bc20[_0xf248('0x1d')]||0x3;this[_0xf248('0x1e')]=_0x14bc20[_0xf248('0x1e')]||0x96;this[_0xf248('0x1f')]=_0x14bc20[_0xf248('0x1f')]||_0xf248('0x20');this[_0xf248('0x21')]=_0x14bc20[_0xf248('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x14bc20[_0xf248('0x22')]||undefined;this[_0xf248('0x23')]=_0x14bc20[_0xf248('0x23')]||undefined;this[_0xf248('0x24')]=_0x14bc20['TrunkBackup']?_0x14bc20[_0xf248('0x24')]:undefined;this['Trunk']=_0x14bc20[_0xf248('0x25')]?_0x14bc20['Trunk']:undefined;this[_0xf248('0x26')]=_0x14bc20[_0xf248('0x26')]?_0x14bc20[_0xf248('0x26')]:undefined;this[_0xf248('0x27')]=_0x14bc20[_0xf248('0x27')]?_0x14bc20[_0xf248('0x27')]:undefined;this[_0xf248('0x28')]=_0x14bc20[_0xf248('0x27')]?_0x14bc20['SquareProject'][_0xf248('0x0')]:undefined;this[_0xf248('0x29')]=_0x14bc20[_0xf248('0x29')]||![];this[_0xf248('0x2a')]=_0x14bc20[_0xf248('0x2a')];this[_0xf248('0x2b')]=_0x14bc20[_0xf248('0x2b')];this['dialAMDAfterGreetingSilence']=_0x14bc20[_0xf248('0x2c')];this['dialAMDTotalAnalysisTime']=_0x14bc20[_0xf248('0x2d')];this[_0xf248('0x2e')]=_0x14bc20[_0xf248('0x2e')];this[_0xf248('0x2f')]=_0x14bc20[_0xf248('0x2f')];this[_0xf248('0x30')]=_0x14bc20['dialAMDMaximumNumberOfWords'];this[_0xf248('0x31')]=_0x14bc20[_0xf248('0x31')];this[_0xf248('0x32')]=_0x14bc20['dialAMDMaximumWordLength'];}module[_0xf248('0x33')]=Campaign; \ No newline at end of file +var _0x64b3=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName'];(function(_0x3ebf02,_0xf76869){var _0x346dcb=function(_0x710aad){while(--_0x710aad){_0x3ebf02['push'](_0x3ebf02['shift']());}};_0x346dcb(++_0xf76869);}(_0x64b3,0xe6));var _0x364b=function(_0x30d31d,_0x2b11bf){_0x30d31d=_0x30d31d-0x0;var _0x3c2ffb=_0x64b3[_0x30d31d];return _0x3c2ffb;};'use strict';function Campaign(_0x24cb41){this['id']=_0x24cb41['id']||0x0;this[_0x364b('0x0')]=_0x24cb41[_0x364b('0x0')]||'';this['type']=_0x24cb41[_0x364b('0x1')]||_0x364b('0x2');this[_0x364b('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x364b('0x4')]=!![];this[_0x364b('0x5')]=_0x24cb41[_0x364b('0x5')];this[_0x364b('0x6')]=_0x24cb41[_0x364b('0x6')];this[_0x364b('0x7')]=_0x24cb41[_0x364b('0x7')]||null;this[_0x364b('0x8')]=_0x24cb41[_0x364b('0x8')]?_0x24cb41[_0x364b('0x8')]:null;this[_0x364b('0x9')]=_0x24cb41[_0x364b('0x9')];this['dialOriginateCallerIdNumber']=_0x24cb41[_0x364b('0xa')];this[_0x364b('0xb')]=_0x24cb41[_0x364b('0xb')]||0x1e;this[_0x364b('0xc')]=_0x24cb41[_0x364b('0xc')];this[_0x364b('0xd')]=_0x24cb41['dialCongestionRetryFrequency'];this[_0x364b('0xe')]=_0x24cb41['dialBusyMaxRetry'];this[_0x364b('0xf')]=_0x24cb41[_0x364b('0xf')];this[_0x364b('0x10')]=_0x24cb41[_0x364b('0x10')];this[_0x364b('0x11')]=_0x24cb41[_0x364b('0x11')];this[_0x364b('0x12')]=_0x24cb41[_0x364b('0x12')];this[_0x364b('0x13')]=_0x24cb41[_0x364b('0x13')]||0x3;this[_0x364b('0x14')]=_0x24cb41['dialNoSuchNumberRetryFrequency']||0x96;this[_0x364b('0x15')]=_0x24cb41[_0x364b('0x15')]||0x3;this['dialDropRetryFrequency']=_0x24cb41[_0x364b('0x16')]||0x96;this[_0x364b('0x17')]=_0x24cb41[_0x364b('0x17')]||0x3;this[_0x364b('0x18')]=_0x24cb41[_0x364b('0x18')]||0x96;this[_0x364b('0x19')]=_0x24cb41[_0x364b('0x19')]||0x3;this[_0x364b('0x1a')]=_0x24cb41['dialMachineRetryFrequency']||0x96;this[_0x364b('0x1b')]=_0x24cb41['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x24cb41[_0x364b('0x1c')]||0x96;this[_0x364b('0x1d')]=_0x24cb41['dialOrderByScheduledAt']||_0x364b('0x1e');this['dialPrefix']=_0x24cb41[_0x364b('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x24cb41['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x364b('0x20')]=_0x24cb41['dialCutDigit']||undefined;this[_0x364b('0x21')]=_0x24cb41[_0x364b('0x21')]?_0x24cb41[_0x364b('0x21')]:undefined;this[_0x364b('0x22')]=_0x24cb41['Trunk']?_0x24cb41[_0x364b('0x22')]:undefined;this['Interval']=_0x24cb41[_0x364b('0x23')]?_0x24cb41['Interval']:undefined;this[_0x364b('0x24')]=_0x24cb41['SquareProject']?_0x24cb41[_0x364b('0x24')]:undefined;this[_0x364b('0x25')]=_0x24cb41[_0x364b('0x24')]?_0x24cb41[_0x364b('0x24')][_0x364b('0x0')]:undefined;this['dialAMDActive']=_0x24cb41[_0x364b('0x26')]||![];this[_0x364b('0x27')]=_0x24cb41[_0x364b('0x27')];this[_0x364b('0x28')]=_0x24cb41['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x24cb41[_0x364b('0x29')];this[_0x364b('0x2a')]=_0x24cb41[_0x364b('0x2a')];this['dialAMDMinWordLength']=_0x24cb41['dialAMDMinWordLength'];this[_0x364b('0x2b')]=_0x24cb41['dialAMDBetweenWordsSilence'];this[_0x364b('0x2c')]=_0x24cb41[_0x364b('0x2c')];this[_0x364b('0x2d')]=_0x24cb41['dialAMDSilenceThreshold'];this[_0x364b('0x2e')]=_0x24cb41[_0x364b('0x2e')];}module[_0x364b('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e6b6af8..fc8dcd2 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 _0x8969=['monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime','type','disposition'];(function(_0x5ebba9,_0x3779f6){var _0x465602=function(_0x52da07){while(--_0x52da07){_0x5ebba9['push'](_0x5ebba9['shift']());}};_0x465602(++_0x3779f6);}(_0x8969,0x130));var _0x9896=function(_0x56d987,_0x59c364){_0x56d987=_0x56d987-0x0;var _0x8f40aa=_0x8969[_0x56d987];return _0x8f40aa;};'use strict';function Channel(){this[_0x9896('0x0')]=null;this['channel']='';this[_0x9896('0x1')]='';this[_0x9896('0x2')]=0x0;this[_0x9896('0x3')]='';this[_0x9896('0x4')]=undefined;this[_0x9896('0x5')]=undefined;this[_0x9896('0x6')]=0x0;this[_0x9896('0x7')]='';this['uniqueid']=0x0;this[_0x9896('0x8')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x9896('0x9')]=null;this[_0x9896('0xa')]=null;this[_0x9896('0xb')]=![];this['abandoned']=![];this[_0x9896('0xc')]='';this[_0x9896('0xd')]='';this[_0x9896('0xe')]=0x0;this['billableseconds']=0x0;this[_0x9896('0xf')]=0x0;this[_0x9896('0x10')]=null;this['tag']=null;this[_0x9896('0x11')]=null;this[_0x9896('0x12')]=![];this['monitorFilename']=null;this[_0x9896('0x13')]=null;this[_0x9896('0x14')]=[];this[_0x9896('0x15')]=undefined;this[_0x9896('0x16')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x29b1=['accountcode','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','holdtime','type','disposition','monitorFilename','monitors','mohtime','channel','connectedlinenum','connectedlinename'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x29b1,0xbb));var _0x129b=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x29b1[_0x1b828b];return _0x98da1a;};'use strict';function Channel(){this['starttime']=null;this[_0x129b('0x0')]='';this['destinationchannel']='';this['calleridnum']=0x0;this['calleridname']='';this[_0x129b('0x1')]=undefined;this[_0x129b('0x2')]=undefined;this[_0x129b('0x3')]=0x0;this['context']='';this[_0x129b('0x4')]=0x0;this[_0x129b('0x5')]=0x0;this[_0x129b('0x6')]=0x0;this[_0x129b('0x7')]=![];this['answertime']=null;this[_0x129b('0x8')]=null;this[_0x129b('0x9')]=![];this[_0x129b('0xa')]=![];this[_0x129b('0xb')]='';this[_0x129b('0xc')]='';this['duration']=0x0;this['billableseconds']=0x0;this[_0x129b('0xd')]=0x0;this[_0x129b('0xe')]=null;this['tag']=null;this[_0x129b('0xf')]=null;this['monitor']=![];this[_0x129b('0x10')]=null;this['queue']=null;this[_0x129b('0x11')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x129b('0x12')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 8adb7bb..a55e5f3 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 _0xd7ce=['serverUrl','Configurations','exports','name','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x58d76a,_0x49404b){var _0x31dfba=function(_0x149756){while(--_0x149756){_0x58d76a['push'](_0x58d76a['shift']());}};_0x31dfba(++_0x49404b);}(_0xd7ce,0x16b));var _0xed7c=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0xd7ce[_0xb83ec2];return _0x4d2fbf;};'use strict';function DeskAccount(_0x9eb2f6){this['id']=_0x9eb2f6['id']||0x0;this[_0xed7c('0x0')]=_0x9eb2f6[_0xed7c('0x0')]||'';this[_0xed7c('0x1')]=_0x9eb2f6['username']||'';this['remoteUri']=_0x9eb2f6[_0xed7c('0x2')]||'';this['authType']=_0x9eb2f6['authType']||'';this['password']=_0x9eb2f6[_0xed7c('0x3')]||'';this[_0xed7c('0x4')]=_0x9eb2f6[_0xed7c('0x4')]||'';this[_0xed7c('0x5')]=_0x9eb2f6[_0xed7c('0x5')]||'';this[_0xed7c('0x6')]=_0x9eb2f6[_0xed7c('0x6')]||'';this[_0xed7c('0x7')]=_0x9eb2f6[_0xed7c('0x7')]||'';this[_0xed7c('0x8')]=_0x9eb2f6[_0xed7c('0x8')]||'';this[_0xed7c('0x9')]=_0x9eb2f6['serverUrl']||'';this[_0xed7c('0xa')]=_0x9eb2f6[_0xed7c('0xa')]||{};}module[_0xed7c('0xb')]=DeskAccount; \ No newline at end of file +var _0x1670=['name','username','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports'];(function(_0x513693,_0x49979c){var _0x5d531b=function(_0x2efa51){while(--_0x2efa51){_0x513693['push'](_0x513693['shift']());}};_0x5d531b(++_0x49979c);}(_0x1670,0x9a));var _0x0167=function(_0x3063d2,_0x587566){_0x3063d2=_0x3063d2-0x0;var _0x3c99d6=_0x1670[_0x3063d2];return _0x3c99d6;};'use strict';function DeskAccount(_0x2a4634){this['id']=_0x2a4634['id']||0x0;this[_0x0167('0x0')]=_0x2a4634['name']||'';this[_0x0167('0x1')]=_0x2a4634['username']||'';this[_0x0167('0x2')]=_0x2a4634[_0x0167('0x2')]||'';this[_0x0167('0x3')]=_0x2a4634[_0x0167('0x3')]||'';this['password']=_0x2a4634['password']||'';this[_0x0167('0x4')]=_0x2a4634[_0x0167('0x4')]||'';this[_0x0167('0x5')]=_0x2a4634[_0x0167('0x5')]||'';this[_0x0167('0x6')]=_0x2a4634[_0x0167('0x6')]||'';this[_0x0167('0x7')]=_0x2a4634[_0x0167('0x7')]||'';this['type']=_0x2a4634['type']||'';this[_0x0167('0x8')]=_0x2a4634[_0x0167('0x8')]||'';this[_0x0167('0x9')]=_0x2a4634[_0x0167('0x9')]||{};}module[_0x0167('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 edd561e..16ec302 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 _0x9225=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x27329d,_0x274e0a){var _0x4319fc=function(_0x3740a4){while(--_0x3740a4){_0x27329d['push'](_0x27329d['shift']());}};_0x4319fc(++_0x274e0a);}(_0x9225,0x171));var _0x5922=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9225[_0x5f09c5];return _0x426ad9;};'use strict';function Dynamics365Account(_0x3ae513){this['id']=_0x3ae513['id']||0x0;this[_0x5922('0x0')]=_0x3ae513['name']||'';this[_0x5922('0x1')]=_0x3ae513['username']||'';this[_0x5922('0x2')]=_0x3ae513[_0x5922('0x2')]||'';this[_0x5922('0x3')]=_0x3ae513[_0x5922('0x3')]||'';this[_0x5922('0x4')]=_0x3ae513[_0x5922('0x4')]||'';this[_0x5922('0x5')]=_0x3ae513[_0x5922('0x5')]||'';this[_0x5922('0x6')]=_0x3ae513[_0x5922('0x6')]||{};this[_0x5922('0x7')]=_0x3ae513[_0x5922('0x7')]||'';this[_0x5922('0x8')]=_0x3ae513['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x6b97=['username','password','remoteUri','tenantId','clientId','serverUrl','Configurations','exports','name'];(function(_0x44878f,_0x318b51){var _0x12c603=function(_0x56f15a){while(--_0x56f15a){_0x44878f['push'](_0x44878f['shift']());}};_0x12c603(++_0x318b51);}(_0x6b97,0x7d));var _0x76b9=function(_0x4f2e9a,_0x4507b3){_0x4f2e9a=_0x4f2e9a-0x0;var _0x36325b=_0x6b97[_0x4f2e9a];return _0x36325b;};'use strict';function Dynamics365Account(_0x39ad79){this['id']=_0x39ad79['id']||0x0;this[_0x76b9('0x0')]=_0x39ad79[_0x76b9('0x0')]||'';this[_0x76b9('0x1')]=_0x39ad79['username']||'';this['password']=_0x39ad79[_0x76b9('0x2')]||'';this['remoteUri']=_0x39ad79[_0x76b9('0x3')]||'';this[_0x76b9('0x4')]=_0x39ad79[_0x76b9('0x4')]||'';this[_0x76b9('0x5')]=_0x39ad79['clientId']||'';this['clientSecret']=_0x39ad79['clientSecret']||{};this[_0x76b9('0x6')]=_0x39ad79[_0x76b9('0x6')]||'';this[_0x76b9('0x7')]=_0x39ad79[_0x76b9('0x7')]||{};}module[_0x76b9('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 9542354..30d1f6e 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 _0x2af8=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x55f379,_0x165bd3){var _0x258f3c=function(_0x302223){while(--_0x302223){_0x55f379['push'](_0x55f379['shift']());}};_0x258f3c(++_0x165bd3);}(_0x2af8,0xf6));var _0x82af=function(_0x28bac5,_0x383975){_0x28bac5=_0x28bac5-0x0;var _0x2eae28=_0x2af8[_0x28bac5];return _0x2eae28;};'use strict';function FaxAccount(_0x2ac8a8){this['id']=_0x2ac8a8['id']||0x0;this['name']=_0x2ac8a8[_0x82af('0x0')]||'';this[_0x82af('0x1')]=_0x2ac8a8['description'];this[_0x82af('0x2')]=_0x2ac8a8[_0x82af('0x2')];this['headerinfo']=_0x2ac8a8[_0x82af('0x3')];this['localstationid']=_0x2ac8a8[_0x82af('0x4')];this[_0x82af('0x5')]=_0x2ac8a8['minrate']||0x960;this[_0x82af('0x6')]=_0x2ac8a8[_0x82af('0x6')]||0x3840;this['modem']=_0x2ac8a8[_0x82af('0x7')]||_0x82af('0x8');this[_0x82af('0x9')]=_0x2ac8a8[_0x82af('0x9')]||'no';this[_0x82af('0xa')]=_0x2ac8a8[_0x82af('0xa')]||'no';this[_0x82af('0xb')]=_0x2ac8a8[_0x82af('0xb')]||0x1388;this[_0x82af('0xc')]=_0x2ac8a8[_0x82af('0xc')]||_0x82af('0xd');this[_0x82af('0xe')]=_0x2ac8a8[_0x82af('0xe')]?_0x2ac8a8[_0x82af('0xe')]:undefined;this[_0x82af('0xf')]=_0x2ac8a8[_0x82af('0xf')];this[_0x82af('0x10')]=_0x2ac8a8[_0x82af('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xcd2f=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xcd2f[_0x17d9e3];return _0x14192d;};'use strict';function FaxAccount(_0x26ff95){this['id']=_0x26ff95['id']||0x0;this['name']=_0x26ff95['name']||'';this[_0xfcd2('0x0')]=_0x26ff95[_0xfcd2('0x0')];this[_0xfcd2('0x1')]=_0x26ff95[_0xfcd2('0x1')];this[_0xfcd2('0x2')]=_0x26ff95[_0xfcd2('0x2')];this[_0xfcd2('0x3')]=_0x26ff95[_0xfcd2('0x3')];this['minrate']=_0x26ff95[_0xfcd2('0x4')]||0x960;this[_0xfcd2('0x5')]=_0x26ff95[_0xfcd2('0x5')]||0x3840;this[_0xfcd2('0x6')]=_0x26ff95[_0xfcd2('0x6')]||_0xfcd2('0x7');this[_0xfcd2('0x8')]=_0x26ff95[_0xfcd2('0x8')]||'no';this[_0xfcd2('0x9')]=_0x26ff95[_0xfcd2('0x9')]||'no';this[_0xfcd2('0xa')]=_0x26ff95['t38timeout']||0x1388;this[_0xfcd2('0xb')]=_0x26ff95[_0xfcd2('0xb')]||_0xfcd2('0xc');this[_0xfcd2('0xd')]=_0x26ff95[_0xfcd2('0xd')]?_0x26ff95['Trunk']:undefined;this['ListId']=_0x26ff95['ListId'];this['key']=_0x26ff95['key'];}module[_0xfcd2('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 cd93c76..7cb4857 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 _0xadf1=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0xadf1,0x14c));var _0x1adf=function(_0x19e6ee,_0x5af0a5){_0x19e6ee=_0x19e6ee-0x0;var _0x32ea25=_0xadf1[_0x19e6ee];return _0x32ea25;};'use strict';function FreshdeskAccount(_0x118fb5){this['id']=_0x118fb5['id']||0x0;this[_0x1adf('0x0')]=_0x118fb5['name']||'';this[_0x1adf('0x1')]=_0x118fb5[_0x1adf('0x1')]||'';this['apiKey']=_0x118fb5[_0x1adf('0x2')]||'';this[_0x1adf('0x3')]=_0x118fb5[_0x1adf('0x3')]||'';this[_0x1adf('0x4')]=_0x118fb5[_0x1adf('0x4')]||'';this['Configurations']=_0x118fb5[_0x1adf('0x5')]||{};}module[_0x1adf('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x23a0=['serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2f6914,_0x5589d2){var _0x421fd6=function(_0x4b4ac1){while(--_0x4b4ac1){_0x2f6914['push'](_0x2f6914['shift']());}};_0x421fd6(++_0x5589d2);}(_0x23a0,0x1d1));var _0x023a=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x23a0[_0x15b399];return _0x199f2d;};'use strict';function FreshdeskAccount(_0x3f2a7f){this['id']=_0x3f2a7f['id']||0x0;this[_0x023a('0x0')]=_0x3f2a7f[_0x023a('0x0')]||'';this[_0x023a('0x1')]=_0x3f2a7f['username']||'';this[_0x023a('0x2')]=_0x3f2a7f['token']||'';this['remoteUri']=_0x3f2a7f['remoteUri']||'';this[_0x023a('0x3')]=_0x3f2a7f[_0x023a('0x3')]||'';this[_0x023a('0x4')]=_0x3f2a7f[_0x023a('0x4')]||{};}module[_0x023a('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 79377f3..73b3314 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 _0x33eb=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x1b5838,_0x25ec5b){var _0x213065=function(_0xde01bf){while(--_0xde01bf){_0x1b5838['push'](_0x1b5838['shift']());}};_0x213065(++_0x25ec5b);}(_0x33eb,0x6d));var _0xb33e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33eb[_0x20a584];return _0x4b41a8;};'use strict';function FreshsalesAccount(_0xc6539){this['id']=_0xc6539['id']||0x0;this[_0xb33e('0x0')]=_0xc6539['name']||'';this['username']=_0xc6539[_0xb33e('0x1')]||'';this[_0xb33e('0x2')]=_0xc6539[_0xb33e('0x3')]||'';this[_0xb33e('0x4')]=_0xc6539[_0xb33e('0x4')]||'';this['serverUrl']=_0xc6539[_0xb33e('0x5')]||'';this[_0xb33e('0x6')]=_0xc6539[_0xb33e('0x6')]||{};}module[_0xb33e('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xe0b6=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x33d67e,_0x2c5a4b){var _0x138fae=function(_0x431b55){while(--_0x431b55){_0x33d67e['push'](_0x33d67e['shift']());}};_0x138fae(++_0x2c5a4b);}(_0xe0b6,0x1b2));var _0x6e0b=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0xe0b6[_0x58a4fe];return _0x697de2;};'use strict';function FreshsalesAccount(_0x47fe32){this['id']=_0x47fe32['id']||0x0;this['name']=_0x47fe32[_0x6e0b('0x0')]||'';this[_0x6e0b('0x1')]=_0x47fe32['username']||'';this[_0x6e0b('0x2')]=_0x47fe32[_0x6e0b('0x3')]||'';this['remoteUri']=_0x47fe32[_0x6e0b('0x4')]||'';this[_0x6e0b('0x5')]=_0x47fe32['serverUrl']||'';this[_0x6e0b('0x6')]=_0x47fe32[_0x6e0b('0x6')]||{};}module[_0x6e0b('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c67407b..07535b5 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 _0x119c=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','position','count','queuecallerabandon','queuecallerabandonAt'];(function(_0x1ca8f1,_0x2eb0b2){var _0x3a036f=function(_0x5a5dac){while(--_0x5a5dac){_0x1ca8f1['push'](_0x1ca8f1['shift']());}};_0x3a036f(++_0x2eb0b2);}(_0x119c,0x1a6));var _0xc119=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x119c[_0x2932cf];return _0x1711dd;};'use strict';function QueueReport(){this[_0xc119('0x0')]=_0xc119('0x1');this[_0xc119('0x2')]='';this[_0xc119('0x3')]='';this[_0xc119('0x4')]='';this[_0xc119('0x5')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xc119('0x6')]=0x1;this[_0xc119('0x7')]=0x1;this[_0xc119('0x8')]=![];this[_0xc119('0x9')]=null;this['queuecallercomplete']=![];this[_0xc119('0xa')]=null;this[_0xc119('0xb')]=![];this[_0xc119('0xc')]=null;this[_0xc119('0xd')]=0x1;this['channel']='';this[_0xc119('0xe')]='';this['connectedlinename']='';this[_0xc119('0xf')]='';this[_0xc119('0x10')]='';this[_0xc119('0x11')]='';this[_0xc119('0x12')]='';this[_0xc119('0x13')]=0x0;this[_0xc119('0x14')]=![];this[_0xc119('0x15')]='';this[_0xc119('0x16')]=0x0;this['variables']={};}module[_0xc119('0x17')]=QueueReport; \ No newline at end of file +var _0xe61a=['variables','exports','type','inbound','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe61a,0x120));var _0xae61=function(_0x46565c,_0x461ee3){_0x46565c=_0x46565c-0x0;var _0x5f2898=_0xe61a[_0x46565c];return _0x5f2898;};'use strict';function QueueReport(){this[_0xae61('0x0')]=_0xae61('0x1');this['uniqueid']='';this[_0xae61('0x2')]='';this['calleridname']='';this[_0xae61('0x3')]='';this[_0xae61('0x4')]=null;this[_0xae61('0x5')]=null;this['position']=0x1;this[_0xae61('0x6')]=0x1;this[_0xae61('0x7')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0xae61('0x8')]=null;this[_0xae61('0x9')]=![];this[_0xae61('0xa')]=null;this[_0xae61('0xb')]=0x1;this[_0xae61('0xc')]='';this['connectedlinenum']='';this[_0xae61('0xd')]='';this[_0xae61('0xe')]='';this[_0xae61('0xf')]='';this['exten']='';this[_0xae61('0x10')]='';this[_0xae61('0x11')]=0x0;this[_0xae61('0x12')]=![];this[_0xae61('0x13')]='';this['mohtime']=0x0;this[_0xae61('0x14')]={};}module[_0xae61('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 2f21c48..703422a 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 _0x4b11=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0xc9cd47,_0x35a546){var _0x26827e=function(_0x32d967){while(--_0x32d967){_0xc9cd47['push'](_0xc9cd47['shift']());}};_0x26827e(++_0x35a546);}(_0x4b11,0xf4));var _0x14b1=function(_0x27accc,_0x1dabb){_0x27accc=_0x27accc-0x0;var _0x4ff8eb=_0x4b11[_0x27accc];return _0x4ff8eb;};'use strict';function SalesforceAccount(_0x163516){this['id']=_0x163516['id']||0x0;this[_0x14b1('0x0')]=_0x163516[_0x14b1('0x0')]||'';this[_0x14b1('0x1')]=_0x163516['username']||'';this[_0x14b1('0x2')]=_0x163516[_0x14b1('0x2')]||'';this[_0x14b1('0x3')]=_0x163516['password']||'';this[_0x14b1('0x4')]=_0x163516[_0x14b1('0x4')]||'';this[_0x14b1('0x5')]=_0x163516[_0x14b1('0x5')]||'';this[_0x14b1('0x6')]=_0x163516[_0x14b1('0x6')]||'';this[_0x14b1('0x7')]=_0x163516[_0x14b1('0x7')]||_0x14b1('0x8');this[_0x14b1('0x9')]=_0x163516[_0x14b1('0x9')]||'';this[_0x14b1('0xa')]=_0x163516[_0x14b1('0xa')]||{};}module[_0x14b1('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x10ce=['password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports','name','username','remoteUri'];(function(_0x3a7dd6,_0x8a0697){var _0x495b1a=function(_0x36d61b){while(--_0x36d61b){_0x3a7dd6['push'](_0x3a7dd6['shift']());}};_0x495b1a(++_0x8a0697);}(_0x10ce,0x147));var _0xe10c=function(_0x29ecad,_0x3ba494){_0x29ecad=_0x29ecad-0x0;var _0x7824de=_0x10ce[_0x29ecad];return _0x7824de;};'use strict';function SalesforceAccount(_0x2a42bb){this['id']=_0x2a42bb['id']||0x0;this[_0xe10c('0x0')]=_0x2a42bb[_0xe10c('0x0')]||'';this[_0xe10c('0x1')]=_0x2a42bb[_0xe10c('0x1')]||'';this[_0xe10c('0x2')]=_0x2a42bb[_0xe10c('0x2')]||'';this[_0xe10c('0x3')]=_0x2a42bb['password']||'';this['clientId']=_0x2a42bb[_0xe10c('0x4')]||'';this['clientSecret']=_0x2a42bb[_0xe10c('0x5')]||'';this[_0xe10c('0x6')]=_0x2a42bb[_0xe10c('0x6')]||'';this['type']=_0x2a42bb[_0xe10c('0x7')]||_0xe10c('0x8');this['serverUrl']=_0x2a42bb['serverUrl']||'';this[_0xe10c('0x9')]=_0x2a42bb[_0xe10c('0x9')]||{};}module[_0xe10c('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 2322906..a262b2a 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 _0x1aa7=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x48a4cf,_0x16e7b4){var _0x5503ee=function(_0x5a5c42){while(--_0x5a5c42){_0x48a4cf['push'](_0x48a4cf['shift']());}};_0x5503ee(++_0x16e7b4);}(_0x1aa7,0x172));var _0x71aa=function(_0x4d4db6,_0x43dabd){_0x4d4db6=_0x4d4db6-0x0;var _0x3ea9cd=_0x1aa7[_0x4d4db6];return _0x3ea9cd;};'use strict';function ServicenowAccount(_0x38ff55){this['id']=_0x38ff55['id']||0x0;this['name']=_0x38ff55[_0x71aa('0x0')]||'';this['username']=_0x38ff55['username']||'';this[_0x71aa('0x1')]=_0x38ff55[_0x71aa('0x1')]||'';this[_0x71aa('0x2')]=_0x38ff55[_0x71aa('0x2')]||'';this[_0x71aa('0x3')]=_0x38ff55[_0x71aa('0x3')]||'';this['Configurations']=_0x38ff55[_0x71aa('0x4')]||{};}module[_0x71aa('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x2882=['username','password','remoteUri','serverUrl','name'];(function(_0x45697a,_0x2a1667){var _0x1128b1=function(_0x1c718f){while(--_0x1c718f){_0x45697a['push'](_0x45697a['shift']());}};_0x1128b1(++_0x2a1667);}(_0x2882,0xb8));var _0x2288=function(_0x593496,_0x12f14){_0x593496=_0x593496-0x0;var _0x5208a2=_0x2882[_0x593496];return _0x5208a2;};'use strict';function ServicenowAccount(_0x14499a){this['id']=_0x14499a['id']||0x0;this[_0x2288('0x0')]=_0x14499a[_0x2288('0x0')]||'';this[_0x2288('0x1')]=_0x14499a[_0x2288('0x1')]||'';this[_0x2288('0x2')]=_0x14499a[_0x2288('0x2')]||'';this['remoteUri']=_0x14499a[_0x2288('0x3')]||'';this[_0x2288('0x4')]=_0x14499a[_0x2288('0x4')]||'';this['Configurations']=_0x14499a['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 8c5528f..2372926 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 _0xc636=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xc636,0xd7));var _0x6c63=function(_0x24a391,_0x436c7a){_0x24a391=_0x24a391-0x0;var _0x511efb=_0xc636[_0x24a391];return _0x511efb;};'use strict';function SugarcrmAccount(_0x4b1123){this['id']=_0x4b1123['id']||0x0;this[_0x6c63('0x0')]=_0x4b1123[_0x6c63('0x0')]||'';this[_0x6c63('0x1')]=_0x4b1123[_0x6c63('0x1')]||'';this['password']=_0x4b1123[_0x6c63('0x2')]||'';this[_0x6c63('0x3')]=_0x4b1123[_0x6c63('0x3')]||'';this[_0x6c63('0x4')]=_0x4b1123['serverUrl']||'';this[_0x6c63('0x5')]=_0x4b1123['Configurations']||{};}module[_0x6c63('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x7cf8=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x2eab33,_0x10215f){var _0x4f5b7c=function(_0xe958a0){while(--_0xe958a0){_0x2eab33['push'](_0x2eab33['shift']());}};_0x4f5b7c(++_0x10215f);}(_0x7cf8,0x191));var _0x87cf=function(_0x2538b6,_0x4eac61){_0x2538b6=_0x2538b6-0x0;var _0x476a16=_0x7cf8[_0x2538b6];return _0x476a16;};'use strict';function SugarcrmAccount(_0x213267){this['id']=_0x213267['id']||0x0;this[_0x87cf('0x0')]=_0x213267[_0x87cf('0x0')]||'';this[_0x87cf('0x1')]=_0x213267[_0x87cf('0x1')]||'';this[_0x87cf('0x2')]=_0x213267[_0x87cf('0x2')]||'';this[_0x87cf('0x3')]=_0x213267[_0x87cf('0x3')]||'';this[_0x87cf('0x4')]=_0x213267[_0x87cf('0x4')]||'';this['Configurations']=_0x213267[_0x87cf('0x5')]||{};}module[_0x87cf('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 182685b..841da6a 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 _0x3889=['state','unknown','stateTime','address','exports','name','accountcode'];(function(_0x1d3815,_0x412c72){var _0x14450e=function(_0x1be266){while(--_0x1be266){_0x1d3815['push'](_0x1d3815['shift']());}};_0x14450e(++_0x412c72);}(_0x3889,0x155));var _0x9388=function(_0xa55744,_0x29c77b){_0xa55744=_0xa55744-0x0;var _0x4c0b5a=_0x3889[_0xa55744];return _0x4c0b5a;};'use strict';function Telephone(_0x31d82e){this['id']=_0x31d82e['id']||0x0;this[_0x9388('0x0')]=_0x31d82e[_0x9388('0x0')]||'';this[_0x9388('0x1')]=_0x31d82e[_0x9388('0x1')]||'';this[_0x9388('0x2')]=_0x9388('0x3');this[_0x9388('0x4')]=0x0;this['status']=_0x9388('0x3');this[_0x9388('0x5')]='';}module[_0x9388('0x6')]=Telephone; \ No newline at end of file +var _0x947c=['status','address','exports','name','unknown','stateTime'];(function(_0x59b3c6,_0x451c24){var _0x1d1cb3=function(_0x285bfb){while(--_0x285bfb){_0x59b3c6['push'](_0x59b3c6['shift']());}};_0x1d1cb3(++_0x451c24);}(_0x947c,0x105));var _0xc947=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x947c[_0x2c2980];return _0x2a20a9;};'use strict';function Telephone(_0x10ebb7){this['id']=_0x10ebb7['id']||0x0;this['name']=_0x10ebb7[_0xc947('0x0')]||'';this['accountcode']=_0x10ebb7['accountcode']||'';this['state']=_0xc947('0x1');this[_0xc947('0x2')]=0x0;this[_0xc947('0x3')]=_0xc947('0x1');this[_0xc947('0x4')]='';}module[_0xc947('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 68ebe4c..54eccbd 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 _0xfbcb=['name','html'];(function(_0x29c533,_0x35e1a5){var _0x25a1ba=function(_0x18bb17){while(--_0x18bb17){_0x29c533['push'](_0x29c533['shift']());}};_0x25a1ba(++_0x35e1a5);}(_0xfbcb,0xd0));var _0xbfbc=function(_0x54d18a,_0x59fd02){_0x54d18a=_0x54d18a-0x0;var _0x404769=_0xfbcb[_0x54d18a];return _0x404769;};'use strict';function template(_0x49e538){this['id']=_0x49e538['id']||0x0;this[_0xbfbc('0x0')]=_0x49e538[_0xbfbc('0x0')]||'';this[_0xbfbc('0x1')]=_0x49e538[_0xbfbc('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0x8498=['exports','name','html'];(function(_0x3b25c7,_0x2597e1){var _0x42ce48=function(_0x17d07e){while(--_0x17d07e){_0x3b25c7['push'](_0x3b25c7['shift']());}};_0x42ce48(++_0x2597e1);}(_0x8498,0x70));var _0x8849=function(_0x2c48b2,_0x3e0a28){_0x2c48b2=_0x2c48b2-0x0;var _0x4c12c2=_0x8498[_0x2c48b2];return _0x4c12c2;};'use strict';function template(_0x6b4ba){this['id']=_0x6b4ba['id']||0x0;this['name']=_0x6b4ba[_0x8849('0x0')]||'';this['html']=_0x6b4ba[_0x8849('0x1')]||'';}module[_0x8849('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 897df4a..05dde88 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x55e412,_0x2f3739){var _0x2e1d05=function(_0x3fc17f){while(--_0x3fc17f){_0x55e412['push'](_0x55e412['shift']());}};_0x2e1d05(++_0x2f3739);}(_0x6aa7,0x178));var _0x76aa=function(_0x4ba437,_0x2fd8e){_0x4ba437=_0x4ba437-0x0;var _0x2c282a=_0x6aa7[_0x4ba437];return _0x2c282a;};'use strict';function Trigger(_0x8de1e4){this['id']=_0x8de1e4['id']||0x0;this['name']=_0x8de1e4[_0x76aa('0x0')]||'';this[_0x76aa('0x1')]=_0x8de1e4[_0x76aa('0x1')]||_0x76aa('0x2');this['status']=_0x8de1e4[_0x76aa('0x3')]||![];this[_0x76aa('0x4')]=_0x8de1e4[_0x76aa('0x4')]||[];this['AnyConditions']=_0x8de1e4['AnyConditions']||[];this[_0x76aa('0x5')]=_0x8de1e4['Actions']||[];}module[_0x76aa('0x6')]=Trigger; \ No newline at end of file +var _0xf3cd=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x132b20,_0x25ee9d){var _0x292899=function(_0x1dcfe3){while(--_0x1dcfe3){_0x132b20['push'](_0x132b20['shift']());}};_0x292899(++_0x25ee9d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xcfed91,_0x29b51b){_0xcfed91=_0xcfed91-0x0;var _0x42e245=_0xf3cd[_0xcfed91];return _0x42e245;};'use strict';function Trigger(_0x13cb67){this['id']=_0x13cb67['id']||0x0;this[_0xdf3c('0x0')]=_0x13cb67[_0xdf3c('0x0')]||'';this[_0xdf3c('0x1')]=_0x13cb67[_0xdf3c('0x1')]||_0xdf3c('0x2');this['status']=_0x13cb67[_0xdf3c('0x3')]||![];this[_0xdf3c('0x4')]=_0x13cb67[_0xdf3c('0x4')]||[];this['AnyConditions']=_0x13cb67[_0xdf3c('0x5')]||[];this[_0xdf3c('0x6')]=_0x13cb67[_0xdf3c('0x6')]||[];}module[_0xdf3c('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 3b05fa8..d8de170 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 _0x6782=['active','name','unknown','stateTime','status','registry','indexOf','domain','domainport','refresh','stateRegistry','registrationtime','exports'];(function(_0x1eed89,_0x29ae4c){var _0xaf180c=function(_0x22c67b){while(--_0x22c67b){_0x1eed89['push'](_0x1eed89['shift']());}};_0xaf180c(++_0x29ae4c);}(_0x6782,0xdd));var _0x2678=function(_0x2af4bd,_0x55a732){_0x2af4bd=_0x2af4bd-0x0;var _0x43f931=_0x6782[_0x2af4bd];return _0x43f931;};'use strict';function Trunk(_0x497680){this['id']=_0x497680['id']||0x0;this[_0x2678('0x0')]=_0x497680['active']||![];this['name']=_0x497680[_0x2678('0x1')]||'';this['state']=_0x2678('0x2');this[_0x2678('0x3')]=0x0;this[_0x2678('0x4')]=_0x2678('0x2');this[_0x2678('0x5')]=_0x497680[_0x2678('0x5')]&&_0x497680[_0x2678('0x5')][_0x2678('0x6')](':')?_0x497680[_0x2678('0x5')]['split'](':')[0x0]:'';this['host']='';this['port']='';this[_0x2678('0x7')]='';this[_0x2678('0x8')]='';this[_0x2678('0x9')]='';this[_0x2678('0xa')]=_0x2678('0x2');this[_0x2678('0xb')]='';this['address']='';}module[_0x2678('0xc')]=Trunk; \ No newline at end of file +var _0x15ba=['host','port','domain','domainport','refresh','active','name','state','unknown','stateTime','status','registry','split'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x15ba,0x1cc));var _0xa15b=function(_0x37d3e0,_0x51d1f4){_0x37d3e0=_0x37d3e0-0x0;var _0x5512a3=_0x15ba[_0x37d3e0];return _0x5512a3;};'use strict';function Trunk(_0x1cf377){this['id']=_0x1cf377['id']||0x0;this[_0xa15b('0x0')]=_0x1cf377[_0xa15b('0x0')]||![];this['name']=_0x1cf377[_0xa15b('0x1')]||'';this[_0xa15b('0x2')]=_0xa15b('0x3');this[_0xa15b('0x4')]=0x0;this[_0xa15b('0x5')]='unknown';this[_0xa15b('0x6')]=_0x1cf377[_0xa15b('0x6')]&&_0x1cf377[_0xa15b('0x6')]['indexOf'](':')?_0x1cf377[_0xa15b('0x6')][_0xa15b('0x7')](':')[0x0]:'';this[_0xa15b('0x8')]='';this[_0xa15b('0x9')]='';this[_0xa15b('0xa')]='';this[_0xa15b('0xb')]='';this[_0xa15b('0xc')]='';this['stateRegistry']='unknown';this['registrationtime']='';this['address']='';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 1eaf47f..d2a4c0b 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 _0xd036=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x517ff6,_0x41da79){var _0x5f3ce6=function(_0x1e2f7e){while(--_0x1e2f7e){_0x517ff6['push'](_0x517ff6['shift']());}};_0x5f3ce6(++_0x41da79);}(_0xd036,0xda));var _0x6d03=function(_0x1302cf,_0x388178){_0x1302cf=_0x1302cf-0x0;var _0x39729a=_0xd036[_0x1302cf];return _0x39729a;};'use strict';function voiceExtension(_0x29dcda){this['id']=_0x29dcda['id']||0x0;this['exten']=_0x29dcda[_0x6d03('0x0')]||'';this[_0x6d03('0x1')]=_0x29dcda[_0x6d03('0x1')]||_0x6d03('0x2');this[_0x6d03('0x3')]=_0x29dcda[_0x6d03('0x3')]||![];}module[_0x6d03('0x4')]=voiceExtension; \ No newline at end of file +var _0x101a=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x101a,0xc5));var _0xa101=function(_0x4ac8e8,_0x312a84){_0x4ac8e8=_0x4ac8e8-0x0;var _0x5753bd=_0x101a[_0x4ac8e8];return _0x5753bd;};'use strict';function voiceExtension(_0x1eb505){this['id']=_0x1eb505['id']||0x0;this['exten']=_0x1eb505[_0xa101('0x0')]||'';this['recordingFormat']=_0x1eb505[_0xa101('0x1')]||_0xa101('0x2');this[_0xa101('0x3')]=_0x1eb505[_0xa101('0x3')]||![];}module[_0xa101('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 1e5e09c..1c8e06a 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 _0x46e3=['rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','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','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','ringinuse','onhold','wav','wav49'];(function(_0x462e4d,_0x7ce6f7){var _0x49a7e5=function(_0x105b30){while(--_0x105b30){_0x462e4d['push'](_0x462e4d['shift']());}};_0x49a7e5(++_0x7ce6f7);}(_0x46e3,0x15d));var _0x346e=function(_0x248eac,_0x59b44a){_0x248eac=_0x248eac-0x0;var _0x5b6d06=_0x46e3[_0x248eac];return _0x5b6d06;};'use strict';var statusDesc=[_0x346e('0x0'),'not_inuse',_0x346e('0x1'),_0x346e('0x2'),_0x346e('0x3'),'unavailable','ringing',_0x346e('0x4'),_0x346e('0x5')];var monitorFormat={'wav':_0x346e('0x6'),'wav49':_0x346e('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x346e('0x8'),'roundrobin':_0x346e('0x9')};function VoiceQueue(_0x1b665a){this['id']=_0x1b665a['id']||0x0;this['name']=_0x1b665a[_0x346e('0xa')]||'';this[_0x346e('0xb')]=_0x1b665a[_0x346e('0xb')]||'';this['type']=_0x1b665a[_0x346e('0xc')]||_0x346e('0xd');this[_0x346e('0xe')]=0x0;this[_0x346e('0xf')]=0x0;this['total']=0x0;this[_0x346e('0x10')]=0x0;this['sumDuration']=0x0;this[_0x346e('0x11')]=0x0;this[_0x346e('0x12')]=0x0;this[_0x346e('0x13')]=0x0;this[_0x346e('0x14')]=0x0;this[_0x346e('0x15')]=0x0;this[_0x346e('0x16')]=0x0;this['acw']=_0x1b665a['acw']||![];this['acwTimeout']=_0x1b665a[_0x346e('0x17')]||0xa;this[_0x346e('0x18')]=_0x1b665a['autopause']||'no';this[_0x346e('0x19')]=!![];this[_0x346e('0x1a')]='';this[_0x346e('0x1b')]=0x0;this['temp']=0x0;this[_0x346e('0x1c')]=_0x1b665a[_0x346e('0x1c')]||null;this[_0x346e('0x1d')]=_0x1b665a['dialGlobalInterval']?_0x1b665a[_0x346e('0x1d')]:null;this[_0x346e('0x1e')]=_0x1b665a[_0x346e('0x1e')];this['dialMethod']=_0x1b665a[_0x346e('0x1f')]||'progressive';this['dialLimitChannel']=_0x1b665a[_0x346e('0x20')]||0x0;this[_0x346e('0x21')]=_0x1b665a['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x1b665a[_0x346e('0x22')]||0x1;this[_0x346e('0x23')]=_0x1b665a[_0x346e('0x23')]||_0x346e('0x24');this[_0x346e('0x25')]=_0x1b665a[_0x346e('0x25')]||0.03;this['dialPredictiveInterval']=_0x1b665a[_0x346e('0x26')]||0x258;this[_0x346e('0x27')]=_0x1b665a[_0x346e('0x27')]||_0x346e('0x28');this[_0x346e('0x29')]=_0x1b665a[_0x346e('0x29')]||_0x346e('0x28');this[_0x346e('0x2a')]=_0x1b665a['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x1b665a[_0x346e('0x2b')]||'tTxX';this['dialQueueTimeout']=_0x1b665a[_0x346e('0x2c')]||0x3;this[_0x346e('0x2d')]=_0x1b665a['dialQueueProject']||undefined;this[_0x346e('0x2e')]=_0x1b665a['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x1b665a[_0x346e('0x2f')]||0x96;this[_0x346e('0x30')]=_0x1b665a[_0x346e('0x30')]||0x3;this[_0x346e('0x31')]=_0x1b665a['dialBusyRetryFrequency']||0x96;this[_0x346e('0x32')]=_0x1b665a[_0x346e('0x32')]||0x3;this[_0x346e('0x33')]=_0x1b665a['dialNoAnswerRetryFrequency']||0x96;this[_0x346e('0x34')]=_0x1b665a[_0x346e('0x34')]||0x3;this[_0x346e('0x35')]=_0x1b665a[_0x346e('0x35')]||0x96;this[_0x346e('0x36')]=_0x1b665a['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x1b665a[_0x346e('0x37')]||0x96;this[_0x346e('0x38')]=_0x1b665a[_0x346e('0x38')]||0x3;this[_0x346e('0x39')]=_0x1b665a['dialAbandonedRetryFrequency']||0x96;this[_0x346e('0x3a')]=_0x1b665a[_0x346e('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x1b665a[_0x346e('0x3b')]||0x96;this[_0x346e('0x3c')]=_0x1b665a[_0x346e('0x3c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1b665a[_0x346e('0x3d')]||0x96;this[_0x346e('0x3e')]=_0x1b665a[_0x346e('0x3e')]||0x4;this['Trunk']=_0x1b665a[_0x346e('0x3f')]?_0x1b665a[_0x346e('0x3f')]:undefined;this[_0x346e('0x40')]=_0x1b665a[_0x346e('0x40')]?_0x1b665a[_0x346e('0x40')]:undefined;this[_0x346e('0x41')]=_0x1b665a[_0x346e('0x41')]||undefined;this[_0x346e('0x42')]=_0x1b665a[_0x346e('0x42')]?_0x1b665a['Interval']:undefined;this['dialOrderByScheduledAt']=_0x1b665a[_0x346e('0x43')]||_0x346e('0x44');this[_0x346e('0x45')]=_0x1b665a[_0x346e('0x45')]||undefined;this[_0x346e('0x46')]=_0x1b665a[_0x346e('0x46')]||undefined;this[_0x346e('0x47')]=strategy[_0x1b665a['strategy']]||_0x346e('0x8');this[_0x346e('0x48')]=!![];this[_0x346e('0x49')]=_0x1b665a[_0x346e('0x49')]||![];this[_0x346e('0x4a')]=_0x1b665a[_0x346e('0x4a')];this[_0x346e('0x4b')]=_0x1b665a['dialAMDGreeting'];this[_0x346e('0x4c')]=_0x1b665a['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x1b665a[_0x346e('0x4d')];this[_0x346e('0x4e')]=_0x1b665a[_0x346e('0x4e')];this[_0x346e('0x4f')]=_0x1b665a[_0x346e('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x1b665a[_0x346e('0x50')];this[_0x346e('0x51')]=_0x1b665a[_0x346e('0x51')];this['dialAMDMaximumWordLength']=_0x1b665a[_0x346e('0x52')];this['outboundRejectCallsDay']=0x0;this[_0x346e('0x53')]=0x0;this[_0x346e('0x54')]=_0x1b665a[_0x346e('0x54')];this[_0x346e('0x55')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x346e('0x56')]=0x0;this[_0x346e('0x57')]=0x0;this[_0x346e('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x346e('0x59')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x346e('0x5a')]=0x0;this[_0x346e('0x5b')]=0x0;this[_0x346e('0x5c')]=0x0;this[_0x346e('0x5d')]=0x0;this[_0x346e('0x5e')]=undefined;this[_0x346e('0x5f')]=undefined;this['handlePredictive']=undefined;this[_0x346e('0x60')]=1.05;this[_0x346e('0x61')]=0x0;this[_0x346e('0x62')]=0x0;this[_0x346e('0x63')]=0x0;this[_0x346e('0x64')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x346e('0x65')]=0x0;this[_0x346e('0x66')]=0x0;this[_0x346e('0x67')]=0x0;this[_0x346e('0x68')]=_0x1b665a[_0x346e('0x69')]||0x14;this[_0x346e('0x6a')]=_0x1b665a[_0x346e('0x69')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x346e('0x6b')]=0x0;this[_0x346e('0x6c')]=0x1;this['erlangCalls']=0x0;this[_0x346e('0x6d')]=0x0;this[_0x346e('0x6e')]=0x0;this[_0x346e('0x6f')]=0x0;this[_0x346e('0x70')]=_0x1b665a[_0x346e('0x70')]||0x1e;this[_0x346e('0x71')]=_0x1b665a[_0x346e('0x71')]||![];this['dialQueueProject2']=_0x1b665a[_0x346e('0x72')]||undefined;this['dialAgiAfterHangupClient']=_0x1b665a[_0x346e('0x73')]||![];this['dialAgiAfterHangupAgent']=_0x1b665a['dialAgiAfterHangupAgent']||![];this[_0x346e('0xb')]=monitorFormat[_0x1b665a[_0x346e('0xb')]]?monitorFormat[_0x1b665a['monitor_format']]:undefined;this[_0x346e('0x74')]=_0x1b665a[_0x346e('0x74')]||![];this['mandatoryDispositionPause']=_0x1b665a[_0x346e('0x75')]?_0x1b665a[_0x346e('0x75')]:undefined;}module[_0x346e('0x76')]=VoiceQueue; \ No newline at end of file +var _0xa10a=['Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix'];(function(_0x1fd155,_0x340af9){var _0x250e2f=function(_0x3cef99){while(--_0x3cef99){_0x1fd155['push'](_0x1fd155['shift']());}};_0x250e2f(++_0x340af9);}(_0xa10a,0x1a5));var _0xaa10=function(_0x76d0dd,_0x16716d){_0x76d0dd=_0x76d0dd-0x0;var _0x508d20=_0xa10a[_0x76d0dd];return _0x508d20;};'use strict';var statusDesc=[_0xaa10('0x0'),_0xaa10('0x1'),_0xaa10('0x2'),_0xaa10('0x3'),_0xaa10('0x4'),'unavailable',_0xaa10('0x5'),_0xaa10('0x6'),_0xaa10('0x7')];var monitorFormat={'wav':_0xaa10('0x8'),'wav49':_0xaa10('0x9'),'gsm':_0xaa10('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x2e3b5e){this['id']=_0x2e3b5e['id']||0x0;this[_0xaa10('0xb')]=_0x2e3b5e[_0xaa10('0xb')]||'';this['monitor_format']=_0x2e3b5e[_0xaa10('0xc')]||'';this['type']=_0x2e3b5e[_0xaa10('0xd')]||_0xaa10('0xe');this[_0xaa10('0xf')]=0x0;this['talking']=0x0;this[_0xaa10('0x10')]=0x0;this[_0xaa10('0x11')]=0x0;this['sumDuration']=0x0;this[_0xaa10('0x12')]=0x0;this[_0xaa10('0x13')]=0x0;this[_0xaa10('0x14')]=0x0;this[_0xaa10('0x15')]=0x0;this[_0xaa10('0x16')]=0x0;this[_0xaa10('0x17')]=0x0;this[_0xaa10('0x18')]=_0x2e3b5e['acw']||![];this['acwTimeout']=_0x2e3b5e[_0xaa10('0x19')]||0xa;this[_0xaa10('0x1a')]=_0x2e3b5e[_0xaa10('0x1a')]||'no';this[_0xaa10('0x1b')]=!![];this[_0xaa10('0x1c')]='';this[_0xaa10('0x1d')]=0x0;this['temp']=0x0;this[_0xaa10('0x1e')]=_0x2e3b5e[_0xaa10('0x1e')]||null;this[_0xaa10('0x1f')]=_0x2e3b5e[_0xaa10('0x1f')]?_0x2e3b5e['dialGlobalInterval']:null;this[_0xaa10('0x20')]=_0x2e3b5e[_0xaa10('0x20')];this[_0xaa10('0x21')]=_0x2e3b5e['dialMethod']||_0xaa10('0x22');this[_0xaa10('0x23')]=_0x2e3b5e['dialLimitChannel']||0x0;this[_0xaa10('0x24')]=_0x2e3b5e['dialLimitQueue']||0x0;this[_0xaa10('0x25')]=_0x2e3b5e[_0xaa10('0x25')]||0x1;this[_0xaa10('0x26')]=_0x2e3b5e[_0xaa10('0x26')]||'dropRate';this[_0xaa10('0x27')]=_0x2e3b5e['dialPredictiveOptimizationPercentage']||0.03;this[_0xaa10('0x28')]=_0x2e3b5e[_0xaa10('0x28')]||0x258;this['dialOriginateCallerIdName']=_0x2e3b5e[_0xaa10('0x29')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x2e3b5e[_0xaa10('0x2a')]||_0xaa10('0x2b');this[_0xaa10('0x2c')]=_0x2e3b5e[_0xaa10('0x2c')]||0x1e;this[_0xaa10('0x2d')]=_0x2e3b5e['dialQueueOptions']||'tTxX';this[_0xaa10('0x2e')]=_0x2e3b5e[_0xaa10('0x2e')]||0x3;this['dialQueueProject']=_0x2e3b5e['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x2e3b5e[_0xaa10('0x2f')]||0x3;this[_0xaa10('0x30')]=_0x2e3b5e[_0xaa10('0x30')]||0x96;this['dialBusyMaxRetry']=_0x2e3b5e[_0xaa10('0x31')]||0x3;this[_0xaa10('0x32')]=_0x2e3b5e[_0xaa10('0x32')]||0x96;this[_0xaa10('0x33')]=_0x2e3b5e['dialNoAnswerMaxRetry']||0x3;this[_0xaa10('0x34')]=_0x2e3b5e[_0xaa10('0x34')]||0x96;this[_0xaa10('0x35')]=_0x2e3b5e['dialNoSuchNumberMaxRetry']||0x3;this[_0xaa10('0x36')]=_0x2e3b5e['dialNoSuchNumberRetryFrequency']||0x96;this[_0xaa10('0x37')]=_0x2e3b5e[_0xaa10('0x37')]||0x3;this[_0xaa10('0x38')]=_0x2e3b5e[_0xaa10('0x38')]||0x96;this[_0xaa10('0x39')]=_0x2e3b5e['dialAbandonedMaxRetry']||0x3;this[_0xaa10('0x3a')]=_0x2e3b5e[_0xaa10('0x3a')]||0x96;this[_0xaa10('0x3b')]=_0x2e3b5e[_0xaa10('0x3b')]||0x3;this[_0xaa10('0x3c')]=_0x2e3b5e[_0xaa10('0x3c')]||0x96;this[_0xaa10('0x3d')]=_0x2e3b5e[_0xaa10('0x3d')]||0x3;this[_0xaa10('0x3e')]=_0x2e3b5e[_0xaa10('0x3e')]||0x96;this[_0xaa10('0x3f')]=_0x2e3b5e[_0xaa10('0x3f')]||0x4;this[_0xaa10('0x40')]=_0x2e3b5e[_0xaa10('0x40')]?_0x2e3b5e[_0xaa10('0x40')]:undefined;this[_0xaa10('0x41')]=_0x2e3b5e[_0xaa10('0x41')]?_0x2e3b5e[_0xaa10('0x41')]:undefined;this[_0xaa10('0x42')]=_0x2e3b5e[_0xaa10('0x42')]||undefined;this[_0xaa10('0x43')]=_0x2e3b5e[_0xaa10('0x43')]?_0x2e3b5e['Interval']:undefined;this[_0xaa10('0x44')]=_0x2e3b5e[_0xaa10('0x44')]||_0xaa10('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x2e3b5e[_0xaa10('0x46')]||undefined;this[_0xaa10('0x47')]=_0x2e3b5e[_0xaa10('0x47')]||undefined;this[_0xaa10('0x48')]=strategy[_0x2e3b5e[_0xaa10('0x48')]]||_0xaa10('0x49');this[_0xaa10('0x4a')]=!![];this[_0xaa10('0x4b')]=_0x2e3b5e[_0xaa10('0x4b')]||![];this[_0xaa10('0x4c')]=_0x2e3b5e['dialAMDInitialSilence'];this[_0xaa10('0x4d')]=_0x2e3b5e['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2e3b5e[_0xaa10('0x4e')];this[_0xaa10('0x4f')]=_0x2e3b5e[_0xaa10('0x4f')];this['dialAMDMinWordLength']=_0x2e3b5e[_0xaa10('0x50')];this[_0xaa10('0x51')]=_0x2e3b5e[_0xaa10('0x51')];this[_0xaa10('0x52')]=_0x2e3b5e[_0xaa10('0x52')];this[_0xaa10('0x53')]=_0x2e3b5e[_0xaa10('0x53')];this['dialAMDMaximumWordLength']=_0x2e3b5e['dialAMDMaximumWordLength'];this[_0xaa10('0x54')]=0x0;this[_0xaa10('0x55')]=0x0;this[_0xaa10('0x56')]=_0x2e3b5e[_0xaa10('0x56')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xaa10('0x57')]=0x0;this[_0xaa10('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xaa10('0x59')]=0x0;this[_0xaa10('0x5a')]=0x0;this[_0xaa10('0x5b')]=0x0;this[_0xaa10('0x5c')]=0x0;this[_0xaa10('0x5d')]=0x0;this[_0xaa10('0x5e')]=0x0;this[_0xaa10('0x5f')]=0x0;this[_0xaa10('0x60')]=0x0;this[_0xaa10('0x61')]=0x0;this[_0xaa10('0x62')]=undefined;this['startPredictive']=undefined;this[_0xaa10('0x63')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xaa10('0x64')]=0x0;this[_0xaa10('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xaa10('0x66')]=0x0;this[_0xaa10('0x67')]=0x0;this[_0xaa10('0x68')]=0x0;this[_0xaa10('0x69')]=0x0;this[_0xaa10('0x6a')]=_0x2e3b5e[_0xaa10('0x6b')]||0x14;this[_0xaa10('0x6c')]=_0x2e3b5e['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xaa10('0x6d')]=0x0;this[_0xaa10('0x6e')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xaa10('0x6f')]=0x0;this[_0xaa10('0x70')]=0x0;this[_0xaa10('0x71')]=0x0;this['erlangBusyFactor']=0x0;this[_0xaa10('0x72')]=_0x2e3b5e[_0xaa10('0x72')]||0x1e;this[_0xaa10('0x73')]=_0x2e3b5e[_0xaa10('0x73')]||![];this[_0xaa10('0x74')]=_0x2e3b5e[_0xaa10('0x74')]||undefined;this[_0xaa10('0x75')]=_0x2e3b5e[_0xaa10('0x75')]||![];this[_0xaa10('0x76')]=_0x2e3b5e[_0xaa10('0x76')]||![];this[_0xaa10('0xc')]=monitorFormat[_0x2e3b5e[_0xaa10('0xc')]]?monitorFormat[_0x2e3b5e[_0xaa10('0xc')]]:undefined;this[_0xaa10('0x77')]=_0x2e3b5e[_0xaa10('0x77')]||![];this[_0xaa10('0x78')]=_0x2e3b5e['mandatoryDispositionPause']?_0x2e3b5e[_0xaa10('0x78')]:undefined;}module[_0xaa10('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 677a891..17c8187 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 _0x22b5=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x4f5dbd,_0x531831){var _0x1d1d9e=function(_0x24fd60){while(--_0x24fd60){_0x4f5dbd['push'](_0x4f5dbd['shift']());}};_0x1d1d9e(++_0x531831);}(_0x22b5,0x131));var _0x522b=function(_0x104ae7,_0x5a1238){_0x104ae7=_0x104ae7-0x0;var _0x579279=_0x22b5[_0x104ae7];return _0x579279;};'use strict';function VtigerAccount(_0x158b46){this['id']=_0x158b46['id']||0x0;this[_0x522b('0x0')]=_0x158b46[_0x522b('0x0')]||'';this[_0x522b('0x1')]=_0x158b46[_0x522b('0x1')]||'';this[_0x522b('0x2')]=_0x158b46[_0x522b('0x2')]||'';this['remoteUri']=_0x158b46[_0x522b('0x3')]||'';this[_0x522b('0x4')]=_0x158b46[_0x522b('0x4')]||'';this[_0x522b('0x5')]=_0x158b46[_0x522b('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x419c=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x7758b9,_0x28c2a5){var _0x314421=function(_0x10a5bb){while(--_0x10a5bb){_0x7758b9['push'](_0x7758b9['shift']());}};_0x314421(++_0x28c2a5);}(_0x419c,0xd2));var _0xc419=function(_0x68c4e3,_0x5b18b0){_0x68c4e3=_0x68c4e3-0x0;var _0xaca048=_0x419c[_0x68c4e3];return _0xaca048;};'use strict';function VtigerAccount(_0x251da){this['id']=_0x251da['id']||0x0;this[_0xc419('0x0')]=_0x251da[_0xc419('0x0')]||'';this[_0xc419('0x1')]=_0x251da[_0xc419('0x1')]||'';this[_0xc419('0x2')]=_0x251da[_0xc419('0x2')]||'';this[_0xc419('0x3')]=_0x251da[_0xc419('0x3')]||'';this[_0xc419('0x4')]=_0x251da[_0xc419('0x4')]||'';this[_0xc419('0x5')]=_0x251da['Configurations']||{};}module[_0xc419('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index c3525a8..9cb8485 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(_0x2bb74e,_0xa4be8e){_0x2bb74e=_0x2bb74e-0x0;var _0x54cb65=_0xdb28[_0x2bb74e];return _0x54cb65;};'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 _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x3eecbe,_0x58a78f){var _0x7d3d91=function(_0xe40279){while(--_0xe40279){_0x3eecbe['push'](_0x3eecbe['shift']());}};_0x7d3d91(++_0x58a78f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index b5a7c1c..052e752 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 _0x2dd8=['code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x2de105,_0x274ce5){var _0x26b2ef=function(_0x5bcb03){while(--_0x5bcb03){_0x2de105['push'](_0x2de105['shift']());}};_0x26b2ef(++_0x274ce5);}(_0x2dd8,0x143));var _0x82dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2dd8[_0x19e35c];return _0x3e1fe8;};'use strict';function ZohoAccount(_0x202a72){this['id']=_0x202a72['id']||0x0;this[_0x82dd('0x0')]=_0x202a72['name']||'';this['description']=_0x202a72[_0x82dd('0x1')]||'';this[_0x82dd('0x2')]=_0x202a72[_0x82dd('0x2')]||'';this[_0x82dd('0x3')]=_0x202a72[_0x82dd('0x3')]||'';this[_0x82dd('0x4')]=_0x202a72[_0x82dd('0x4')]||'';this['clientSecret']=_0x202a72[_0x82dd('0x5')]||'';this[_0x82dd('0x6')]=_0x202a72[_0x82dd('0x6')]||'';this[_0x82dd('0x7')]=_0x202a72['code']||'';this[_0x82dd('0x8')]=_0x202a72[_0x82dd('0x8')]||'';this[_0x82dd('0x9')]=_0x202a72[_0x82dd('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xb6a6=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x5a2a22,_0x1f3dc8){var _0xf9f942=function(_0xa0aad2){while(--_0xa0aad2){_0x5a2a22['push'](_0x5a2a22['shift']());}};_0xf9f942(++_0x1f3dc8);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x3fbea1,_0x5e7e56){_0x3fbea1=_0x3fbea1-0x0;var _0x56ed08=_0xb6a6[_0x3fbea1];return _0x56ed08;};'use strict';function ZohoAccount(_0x44400f){this['id']=_0x44400f['id']||0x0;this[_0x6b6a('0x0')]=_0x44400f['name']||'';this['description']=_0x44400f[_0x6b6a('0x1')]||'';this[_0x6b6a('0x2')]=_0x44400f[_0x6b6a('0x2')]||'';this[_0x6b6a('0x3')]=_0x44400f[_0x6b6a('0x3')]||'';this['clientId']=_0x44400f[_0x6b6a('0x4')]||'';this[_0x6b6a('0x5')]=_0x44400f[_0x6b6a('0x5')]||'';this['serverUrl']=_0x44400f[_0x6b6a('0x6')]||'';this[_0x6b6a('0x7')]=_0x44400f['code']||'';this[_0x6b6a('0x8')]=_0x44400f[_0x6b6a('0x8')]||'';this['Configurations']=_0x44400f[_0x6b6a('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 4d41960..f139f1b 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 _0xfebd=['calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active'];(function(_0x862df1,_0x217bb0){var _0x1dd5c2=function(_0x2ccbdd){while(--_0x2ccbdd){_0x862df1['push'](_0x862df1['shift']());}};_0x1dd5c2(++_0x217bb0);}(_0xfebd,0xa3));var _0xdfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebd[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xdfeb('0x0'));var _=require(_0xdfeb('0x1'));var moment=require(_0xdfeb('0x2'));function checkNameSurname(_0x4233b7,_0xcf47ea,_0x504113){var _0x4343bf='';if(!_[_0xdfeb('0x3')](_0xcf47ea)&&_0xdfeb('0x4')===typeof _0xcf47ea){_0x4343bf+=_0xcf47ea;}if(!_[_0xdfeb('0x3')](_0x504113)&&_0xdfeb('0x4')===typeof _0x504113){_0x4343bf+='\x20'+_0x504113;}if(_0x4343bf!==''){return _0x4343bf;}return _0x4233b7;}function Action(_0x83c7f,_0x459cf8,_0x492c12,_0x2c2751,_0x37ebdf){this['uniqueid']=_0x492c12||undefined;this[_0xdfeb('0x5')]=_0x83c7f['id'];this[_0xdfeb('0x6')]=_0x459cf8[_0xdfeb('0x7')];this[_0xdfeb('0x8')]=_0x459cf8[_0xdfeb('0x8')];this[_0xdfeb('0x9')]=_0xdfeb('0x6');this[_0xdfeb('0xa')]=![];this[_0xdfeb('0xb')]=_[_0xdfeb('0x3')](_0x83c7f[_0xdfeb('0xc')])?undefined:_0x83c7f[_0xdfeb('0xc')]['name'];this[_0xdfeb('0xd')]=this['membername']?util[_0xdfeb('0xe')](_0xdfeb('0xf'),this['membername']):_0x2c2751||undefined;this[_0xdfeb('0x10')]=checkNameSurname(_0x83c7f[_0xdfeb('0x11')][_0xdfeb('0x12')],_0x83c7f[_0xdfeb('0x11')][_0xdfeb('0x13')],_0x83c7f[_0xdfeb('0x11')]['lastName']);this[_0xdfeb('0x14')]=_0x83c7f[_0xdfeb('0x14')]||![];this[_0xdfeb('0x15')]=_0x83c7f[_0xdfeb('0x11')][_0xdfeb('0x12')];this[_0xdfeb('0x16')]=_0x83c7f['scheduledat'];this['countbusyretry']=_0x83c7f[_0xdfeb('0x17')]||0x0;this['countcongestionretry']=_0x83c7f['countcongestionretry']||0x0;this['countnoanswerretry']=_0x83c7f[_0xdfeb('0x18')]||0x0;this[_0xdfeb('0x19')]=(_0x83c7f['countbusyretry']||0x0)+(_0x83c7f[_0xdfeb('0x1a')]||0x0)+(_0x83c7f['countnoanswerretry']||0x0)+(_0x83c7f[_0xdfeb('0x1b')]||0x0)+(_0x83c7f[_0xdfeb('0x1c')]||0x0)+(_0x83c7f['countabandonedretry']||0x0)+(_0x83c7f[_0xdfeb('0x1d')]||0x0)+(_0x83c7f[_0xdfeb('0x1e')]||0x0);this[_0xdfeb('0x1b')]=_0x83c7f[_0xdfeb('0x1b')]||0x0;this['countdropretry']=_0x83c7f[_0xdfeb('0x1c')]||0x0;this['countabandonedretry']=_0x83c7f[_0xdfeb('0x1f')]||0x0;this[_0xdfeb('0x1d')]=_0x83c7f[_0xdfeb('0x1d')]||0x0;this[_0xdfeb('0x1e')]=_0x83c7f['countagentrejectretry']||0x0;this['callback']=_0x83c7f[_0xdfeb('0x20')];this[_0xdfeb('0x21')]=_0x83c7f[_0xdfeb('0x21')];this['callbackat']=_0x83c7f[_0xdfeb('0x22')];this['recallme']=_0x83c7f['recallme'];this['ContactId']=_0x83c7f[_0xdfeb('0x23')];this[_0xdfeb('0x24')]=_0x83c7f[_0xdfeb('0x24')];this[_0xdfeb('0x25')]=_[_0xdfeb('0x3')](_0x83c7f['Agent'])?_0x83c7f[_0xdfeb('0x25')]:_0x83c7f[_0xdfeb('0xc')]['id'];this[_0xdfeb('0x26')]=_0x83c7f[_0xdfeb('0x26')];this[_0xdfeb('0x27')]='';this[_0xdfeb('0x28')]='';}Action[_0xdfeb('0x29')][_0xdfeb('0x2a')]=function(){return util[_0xdfeb('0xe')](_0xdfeb('0x2b'),this[_0xdfeb('0x10')],this[_0xdfeb('0x2c')]);};module[_0xdfeb('0x2d')]=Action; \ No newline at end of file +var _0x14f4=['scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','calleridname','lodash','moment','string','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','Contact','phone','firstName','lastName','active','calleridnum'];(function(_0x6afa2d,_0x8c0e0f){var _0x1698ee=function(_0x3b9313){while(--_0x3b9313){_0x6afa2d['push'](_0x6afa2d['shift']());}};_0x1698ee(++_0x8c0e0f);}(_0x14f4,0x1d9));var _0x414f=function(_0x7f578b,_0x2d4682){_0x7f578b=_0x7f578b-0x0;var _0x7fc55e=_0x14f4[_0x7f578b];return _0x7fc55e;};'use strict';var util=require('util');var _=require(_0x414f('0x0'));var moment=require(_0x414f('0x1'));function checkNameSurname(_0x2f96d8,_0x3da2a2,_0x173448){var _0x25492a='';if(!_['isNil'](_0x3da2a2)&&_0x414f('0x2')===typeof _0x3da2a2){_0x25492a+=_0x3da2a2;}if(!_[_0x414f('0x3')](_0x173448)&&_0x414f('0x2')===typeof _0x173448){_0x25492a+='\x20'+_0x173448;}if(_0x25492a!==''){return _0x25492a;}return _0x2f96d8;}function Action(_0x34e09f,_0x49b714,_0x273f8b,_0xf2592,_0x290187){this['uniqueid']=_0x273f8b||undefined;this[_0x414f('0x4')]=_0x34e09f['id'];this[_0x414f('0x5')]=_0x49b714[_0x414f('0x6')];this[_0x414f('0x7')]=_0x49b714[_0x414f('0x7')];this['campaigntype']=_0x414f('0x5');this[_0x414f('0x8')]=![];this[_0x414f('0x9')]=_[_0x414f('0x3')](_0x34e09f[_0x414f('0xa')])?undefined:_0x34e09f['Agent'][_0x414f('0x6')];this[_0x414f('0xb')]=this[_0x414f('0x9')]?util[_0x414f('0xc')]('SIP/%s',this[_0x414f('0x9')]):_0xf2592||undefined;this['calleridname']=checkNameSurname(_0x34e09f[_0x414f('0xd')][_0x414f('0xe')],_0x34e09f[_0x414f('0xd')][_0x414f('0xf')],_0x34e09f[_0x414f('0xd')][_0x414f('0x10')]);this['active']=_0x34e09f[_0x414f('0x11')]||![];this[_0x414f('0x12')]=_0x34e09f['Contact'][_0x414f('0xe')];this[_0x414f('0x13')]=_0x34e09f['scheduledat'];this[_0x414f('0x14')]=_0x34e09f['countbusyretry']||0x0;this['countcongestionretry']=_0x34e09f['countcongestionretry']||0x0;this[_0x414f('0x15')]=_0x34e09f[_0x414f('0x15')]||0x0;this[_0x414f('0x16')]=(_0x34e09f[_0x414f('0x14')]||0x0)+(_0x34e09f[_0x414f('0x17')]||0x0)+(_0x34e09f[_0x414f('0x15')]||0x0)+(_0x34e09f['countnosuchnumberretry']||0x0)+(_0x34e09f[_0x414f('0x18')]||0x0)+(_0x34e09f[_0x414f('0x19')]||0x0)+(_0x34e09f[_0x414f('0x1a')]||0x0)+(_0x34e09f['countagentrejectretry']||0x0);this[_0x414f('0x1b')]=_0x34e09f[_0x414f('0x1b')]||0x0;this[_0x414f('0x18')]=_0x34e09f[_0x414f('0x18')]||0x0;this[_0x414f('0x19')]=_0x34e09f[_0x414f('0x19')]||0x0;this['countmachineretry']=_0x34e09f[_0x414f('0x1a')]||0x0;this[_0x414f('0x1c')]=_0x34e09f[_0x414f('0x1c')]||0x0;this[_0x414f('0x1d')]=_0x34e09f[_0x414f('0x1d')];this[_0x414f('0x1e')]=_0x34e09f['callbackuniqueid'];this[_0x414f('0x1f')]=_0x34e09f[_0x414f('0x1f')];this['recallme']=_0x34e09f[_0x414f('0x20')];this[_0x414f('0x21')]=_0x34e09f[_0x414f('0x21')];this[_0x414f('0x22')]=_0x34e09f['ListId'];this[_0x414f('0x23')]=_[_0x414f('0x3')](_0x34e09f[_0x414f('0xa')])?_0x34e09f[_0x414f('0x23')]:_0x34e09f[_0x414f('0xa')]['id'];this[_0x414f('0x24')]=_0x34e09f['VoiceQueueId'];this[_0x414f('0x25')]='';this[_0x414f('0x26')]='';}Action[_0x414f('0x27')]['getCaller']=function(){return util[_0x414f('0xc')]('\x22%s\x22\x20<%s>',this[_0x414f('0x28')],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5822eb7..4d451dd 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 _0xddc9=['voiceQueues','trunks','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','booked','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','rescheduleContactInQueue','createBody','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','countnosuchnumberretry','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','checkInBlack','phone','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','getContactPreview','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','Contact','substring','dialCutDigit','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdName','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','Action','variablesAction','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','dialstatus','variables','syncVarSet','filterKey','keys','variable','addVariable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview'];(function(_0xaa35da,_0x14ad01){var _0x3bf710=function(_0x1ab44e){while(--_0x1ab44e){_0xaa35da['push'](_0xaa35da['shift']());}};_0x3bf710(++_0x14ad01);}(_0xddc9,0x13e));var _0x9ddc=function(_0xeea85d,_0x23bbeb){_0xeea85d=_0xeea85d-0x0;var _0x130a58=_0xddc9[_0xeea85d];return _0x130a58;};'use strict';var util=require(_0x9ddc('0x0'));var _=require('lodash');var BPromise=require(_0x9ddc('0x1'));var uuid=require(_0x9ddc('0x2'));var moment=require(_0x9ddc('0x3'));var md5=require(_0x9ddc('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x9ddc('0x5'))('preview');var loggerAction=require(_0x9ddc('0x5'))(_0x9ddc('0x6'));var ami=require(_0x9ddc('0x7'));var rpcDb=require(_0x9ddc('0x8'));var Action=require(_0x9ddc('0x9'));var ut=require(_0x9ddc('0xa'));config[_0x9ddc('0xb')]=_[_0x9ddc('0xc')](config[_0x9ddc('0xb')],{'host':_0x9ddc('0xd'),'port':0x18eb});var io=require(_0x9ddc('0xe'))(new Redis(config[_0x9ddc('0xb')]));var Sequence=function(){};Sequence[_0x9ddc('0xf')][_0x9ddc('0x10')]=function(_0x4b7829){this[_0x9ddc('0x11')]=this[_0x9ddc('0x11')]?this[_0x9ddc('0x11')][_0x9ddc('0x12')](_0x4b7829):_0x4b7829();};function Preview(_0x3b23a8){this[_0x9ddc('0x13')]=new Sequence();this[_0x9ddc('0x14')]=_0x3b23a8[_0x9ddc('0x15')];this[_0x9ddc('0x16')]=_0x3b23a8[_0x9ddc('0x16')];this['actions']={};this[_0x9ddc('0x17')]=_0x3b23a8['agents'];this[_0x9ddc('0x18')]=0x0;ami['on']('originateresponse',this[_0x9ddc('0x19')][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x1b'),this[_0x9ddc('0x1c')]['bind'](this));ami['on'](_0x9ddc('0x1d'),this[_0x9ddc('0x1e')][_0x9ddc('0x1a')](this));ami['on']('dialend',this[_0x9ddc('0x1f')][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x20'),this['syncNewExten'][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x21'),this['syncVarSet'][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x22'),this[_0x9ddc('0x23')][_0x9ddc('0x1a')](this));ami['on'](_0x9ddc('0x24'),this[_0x9ddc('0x25')][_0x9ddc('0x1a')](this));this[_0x9ddc('0x26')](this[_0x9ddc('0x14')]);}function emit(_0x5e4b9a,_0x2d7a95,_0x1cedc2){io['to'](_0x5e4b9a)[_0x9ddc('0x27')](_0x2d7a95,_0x1cedc2);}function emitCampaignPreview(_0x51170a){if(_0x51170a[_0x9ddc('0x28')]===_0x9ddc('0x29')){var _0x3a672b={'id':_0x51170a['id'],'name':_0x51170a[_0x9ddc('0x2a')],'strategy':_0x51170a[_0x9ddc('0x2b')],'answered':_0x51170a[_0x9ddc('0x2c')],'available':_0x51170a['available'],'loggedIn':_0x51170a[_0x9ddc('0x2d')],'pTalking':_0x51170a[_0x9ddc('0x2e')],'sumBillable':_0x51170a[_0x9ddc('0x2f')],'sumDuration':_0x51170a[_0x9ddc('0x30')],'sumHoldTime':_0x51170a[_0x9ddc('0x31')]||0x0,'talking':_0x51170a['talking'],'total':_0x51170a[_0x9ddc('0x32')],'type':_0x51170a[_0x9ddc('0x28')],'unmanaged':_0x51170a[_0x9ddc('0x33')],'abandoned':_0x51170a[_0x9ddc('0x34')],'waiting':_0x51170a[_0x9ddc('0x35')],'loggedInDb':_0x51170a['loggedInDb'],'dialActive':_0x51170a['dialActive'],'dialMethod':_0x51170a[_0x9ddc('0x36')],'dialOriginateCallerIdName':_0x51170a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x51170a[_0x9ddc('0x37')],'dialOriginateTimeout':_0x51170a['dialOriginateTimeout'],'dialPrefix':_0x51170a[_0x9ddc('0x38')],'outboundAnswerAgiCallsDay':_0x51170a['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x51170a[_0x9ddc('0x39')],'outboundBlacklistCallsDay':_0x51170a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x51170a[_0x9ddc('0x3a')],'outboundCongestionCallsDay':_0x51170a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x51170a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x51170a['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x51170a[_0x9ddc('0x3b')],'outboundNoAnswerCallsDay':_0x51170a['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x51170a[_0x9ddc('0x3c')],'outboundOriginateFailureCallsDay':_0x51170a[_0x9ddc('0x3d')],'outboundReCallsDay':_0x51170a[_0x9ddc('0x3e')],'outboundRejectCallsDay':_0x51170a['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x51170a[_0x9ddc('0x3f')],'outboundAbandonedCallsDay':_0x51170a[_0x9ddc('0x40')],'predictiveIntervalAnsweredCalls':_0x51170a[_0x9ddc('0x41')],'predictiveIntervalAvgHoldtime':_0x51170a[_0x9ddc('0x42')],'predictiveIntervalAvgTalktime':_0x51170a[_0x9ddc('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x51170a['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x51170a[_0x9ddc('0x44')],'predictiveIntervalErlangCalls':_0x51170a[_0x9ddc('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x51170a[_0x9ddc('0x46')],'predictiveIntervalHitRate':_0x51170a['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x51170a[_0x9ddc('0x47')],'predictiveIntervalPauses':_0x51170a['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x51170a['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x51170a[_0x9ddc('0x48')],'message':_0x51170a[_0x9ddc('0x49')],'originated':_0x51170a[_0x9ddc('0x4a')],'erlangCalls':_0x51170a[_0x9ddc('0x4b')],'erlangCallToSecond':_0x51170a[_0x9ddc('0x4c')],'erlangAbandonmentRate':_0x51170a[_0x9ddc('0x4d')],'erlangBusyFactor':_0x51170a['erlangBusyFactor'],'startPredictive':_0x51170a['startPredictive'],'startProgressive':_0x51170a[_0x9ddc('0x4e')]};if(_0x51170a[_0x9ddc('0x4f')]){_0x3a672b['Trunk']={'id':_0x51170a[_0x9ddc('0x4f')]['id'],'name':_0x51170a[_0x9ddc('0x4f')][_0x9ddc('0x2a')],'active':_0x51170a['Trunk']['active'],'callerid':_0x51170a[_0x9ddc('0x4f')][_0x9ddc('0x50')]};}if(_0x51170a[_0x9ddc('0x51')]){_0x3a672b['Interval']={'id':_0x51170a[_0x9ddc('0x51')]['id'],'name':_0x51170a[_0x9ddc('0x51')][_0x9ddc('0x2a')]};}var _0x4e7e3b=md5(JSON[_0x9ddc('0x52')](_0x3a672b));if(_0x51170a[_0x9ddc('0x4')]!==_0x4e7e3b){_0x51170a[_0x9ddc('0x4')]=_0x4e7e3b;emit(util[_0x9ddc('0x53')]('voice:queue:%s',_0x3a672b[_0x9ddc('0x2a')]),_0x9ddc('0x54'),_0x3a672b);}}}function emitVoiceQueueChannelRemove(_0x151221){logger[_0x9ddc('0x55')](_0x9ddc('0x56'),JSON[_0x9ddc('0x52')](_0x151221));emit(util[_0x9ddc('0x53')](_0x9ddc('0x57'),_0x151221[_0x9ddc('0x2a')]),_0x9ddc('0x58'),_0x151221);}function notSendMessagesQueue(_0x5ba006){if(_0x5ba006[_0x9ddc('0x59')]){if(_0x5ba006[_0x9ddc('0x4a')]===0x0&&_0x5ba006[_0x9ddc('0x2e')]===0x0){_0x5ba006[_0x9ddc('0x59')]=![];_0x5ba006[_0x9ddc('0x5a')]=0x0;_0x5ba006[_0x9ddc('0x5b')]=0x0;_0x5ba006[_0x9ddc('0x49')]=_0x9ddc('0x5c');ut[_0x9ddc('0x5d')](_0x9ddc('0x5e'),_0x5ba006[_0x9ddc('0x2a')]+_0x9ddc('0x5f'));}else{_0x5ba006[_0x9ddc('0x49')]=_0x9ddc('0x60');ut[_0x9ddc('0x5d')](_0x9ddc('0x5e'),_0x5ba006[_0x9ddc('0x2a')]+_0x9ddc('0x61'));}emitCampaignPreview(_0x5ba006);}}Preview[_0x9ddc('0xf')][_0x9ddc('0x26')]=function(){var _0xf5bc66=this;setInterval(function(){_0xf5bc66[_0x9ddc('0x62')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x29b7e8=this[_0x9ddc('0x14')];this[_0x9ddc('0x18')]+=0x1;for(var _0xcd56 in _0x29b7e8){if(_0x29b7e8[_0x9ddc('0x63')](_0xcd56)&&(_0x29b7e8[_0xcd56][_0x9ddc('0x36')]===_0x9ddc('0x64')||_0x29b7e8[_0xcd56][_0x9ddc('0x36')]===_0x9ddc('0x65'))&&_0x29b7e8[_0xcd56][_0x9ddc('0x28')]===_0x9ddc('0x29')){if(this[_0x9ddc('0x18')]>0x7){this[_0x9ddc('0x18')]=0x0;this[_0x9ddc('0x66')]();}}if(_0x29b7e8[_0x9ddc('0x63')](_0xcd56)&&_0x29b7e8[_0xcd56][_0x9ddc('0x36')]===_0x9ddc('0x64')&&_0x29b7e8[_0xcd56][_0x9ddc('0x28')]===_0x9ddc('0x29')){if(_0x29b7e8[_0xcd56][_0x9ddc('0x67')]){this[_0x9ddc('0x68')](_0x29b7e8[_0xcd56]);this[_0x9ddc('0x69')](_0x29b7e8[_0xcd56]);}else{notSendMessagesQueue(_0x29b7e8[_0xcd56]);}}}};Preview[_0x9ddc('0xf')][_0x9ddc('0x6a')]=function(_0x264bf8){var _0x58fe0d=this;this[_0x9ddc('0x13')][_0x9ddc('0x10')](function(){if(!_[_0x9ddc('0x6b')](_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8])){loggerAction['info'](_0x9ddc('0x6d'),_0x264bf8,'Queue',_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')],'originated:\x20',JSON[_0x9ddc('0x52')](_0x58fe0d[_0x9ddc('0x14')][_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]][_0x9ddc('0x4a')]),_0x9ddc('0x6f'),JSON[_0x9ddc('0x52')](_0x58fe0d[_0x9ddc('0x14')][_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]][_0x9ddc('0x2e')]),JSON[_0x9ddc('0x52')](_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x70')]),JSON[_0x9ddc('0x52')](_[_0x9ddc('0x71')](_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8],['contactId',_0x9ddc('0x72'),_0x9ddc('0x73'),_0x9ddc('0x74')])));return ami['Action']({'action':_0x9ddc('0x75'),'channel':_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x76')]})[_0x9ddc('0x77')](function(_0x4527b0){if(_0x4527b0[_0x9ddc('0x49')]===_0x9ddc('0x78')){setTimeout(function(){if(_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8]){ut[_0x9ddc('0x79')](_0x58fe0d[_0x9ddc('0x14')][_0x58fe0d['actions'][_0x264bf8][_0x9ddc('0x6e')]],_0x9ddc('0x7a'));if(_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8]['dialAnswer']===!![]){ut['decrementTalkink'](_0x58fe0d[_0x9ddc('0x14')][_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]],_0x9ddc('0x7a'));ut[_0x9ddc('0x7b')](_0x9ddc('0x7c')+_0x264bf8,_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]);}ut[_0x9ddc('0x7b')](_0x9ddc('0x7d')+_0x264bf8,_0x58fe0d[_0x9ddc('0x6c')][_0x264bf8][_0x9ddc('0x6e')]);delete _0x58fe0d[_0x9ddc('0x6c')][_0x264bf8];}},0x2328);}});}});};Preview[_0x9ddc('0xf')][_0x9ddc('0x66')]=function(){var _0x4468d4=this;loggerAction[_0x9ddc('0x55')](_0x9ddc('0x7e'),_['size'](this[_0x9ddc('0x6c')]));for(var _0x44cebc in this[_0x9ddc('0x6c')]){if(_0x4468d4[_0x9ddc('0x6c')][_0x9ddc('0x63')](_0x44cebc)){_0x4468d4[_0x9ddc('0x6a')](_0x44cebc);}}};Preview['prototype'][_0x9ddc('0x69')]=function(_0x51f834){var _0x108fd1=this;rpcDb[_0x9ddc('0x7f')](_0x51f834['id'],ut[_0x9ddc('0x80')](this['agents']))[_0x9ddc('0x81')](function(_0x463c6b){if(!_[_0x9ddc('0x6b')](_0x463c6b)){for(var _0x1bc4cc=0x0;_0x1bc4cc<_0x463c6b[_0x9ddc('0x82')];_0x1bc4cc+=0x1){if(ut[_0x9ddc('0x83')](_0x463c6b[_0x1bc4cc][_0x9ddc('0x84')])<_0x51f834[_0x9ddc('0x85')]*0x3c){if(_0x463c6b[_0x1bc4cc][_0x9ddc('0x86')]&&!_0x463c6b[_0x1bc4cc][_0x9ddc('0x86')]['voicePause']){_0x108fd1[_0x9ddc('0x87')](_0x463c6b[_0x1bc4cc]['id'])['then'](ut[_0x9ddc('0x88')](_0x9ddc('0x89')))[_0x9ddc('0x77')](ut[_0x9ddc('0x88')](_0x9ddc('0x89')));}else{rpcDb[_0x9ddc('0x8a')](_0x463c6b[_0x1bc4cc]['id']);}}else{var _0x10eced=new Action(_0x463c6b[_0x1bc4cc],_0x51f834);_0x10eced[_0x9ddc('0x8b')]=moment()[_0x9ddc('0x53')](_0x9ddc('0x8c'));_0x51f834[_0x9ddc('0x3e')]+=0x1;ut['logCustomer'](_0x10eced,0x17,'RecallInQueue');if(_0x51f834['dialRecallInQueue']){rpcDb[_0x9ddc('0x8d')](ut[_0x9ddc('0x8e')](_0x463c6b[_0x1bc4cc]));rpcDb['createCustomerHistory'](_0x10eced,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x9ddc('0x8f')](_0x10eced,0x16,_0x9ddc('0x90'));rpcDb['createCustomerHistory'](_0x10eced,_0x9ddc('0x91'));rpcDb[_0x9ddc('0x92')](_0x10eced,_0x9ddc('0x91'));}}}}})['catch'](ut['logger2']('[getContactRecallMe]'));};Preview[_0x9ddc('0xf')][_0x9ddc('0x68')]=function(_0x5db33f){_0x5db33f[_0x9ddc('0x59')]=!![];if(ut['IsNotLoggedIn'](_0x5db33f[_0x9ddc('0x2d')])){_0x5db33f[_0x9ddc('0x49')]=_0x9ddc('0x93');}else if(!ut[_0x9ddc('0x94')](_0x5db33f[_0x9ddc('0x67')])){_0x5db33f[_0x9ddc('0x49')]=_0x9ddc('0x5c');}else if(!this[_0x9ddc('0x95')](_0x5db33f['Trunk'])){if(!this['isTrunkReachable'](_0x5db33f['TrunkBackup'])){_0x5db33f[_0x9ddc('0x49')]='TRUNK_IS_NOT_REACHABLE';}else{_0x5db33f['message']='ACTIVE';}}else{_0x5db33f[_0x9ddc('0x49')]=_0x9ddc('0x96');}emitCampaignPreview(_0x5db33f);};Preview[_0x9ddc('0xf')][_0x9ddc('0x97')]=function(_0x2a7168,_0x24f8b4,_0x3b55b3){var _0x16748a=this;var _0x240380=this[_0x9ddc('0x6c')][_0x24f8b4];var _0x44b2e9=this[_0x9ddc('0x14')][_0x240380[_0x9ddc('0x6e')]];var _0x17087a;if(_0x44b2e9){switch(_0x3b55b3){case'1':_0x44b2e9['outboundNoSuchCallsDay']+=0x1;_0x240380['countnosuchnumberretry']+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x0,_0x9ddc('0x9a'));ami[_0x9ddc('0x27')](_0x9ddc('0x9b'),ut[_0x9ddc('0x9c')](_0x240380,_0x9ddc('0x9d')));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0x9f'));if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut['cloneAction'](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb[_0x9ddc('0x92')](_0x17087a,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x240380[_0x9ddc('0xa2')]>=_0x44b2e9[_0x9ddc('0xa3')]){rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xa4'));}else{rpcDb[_0x9ddc('0xa5')](ut[_0x9ddc('0xa6')](_0x240380,_0x9ddc('0xa2'),_0x44b2e9['dialNoSuchNumberRetryFrequency']),_0x240380['unlockAgent'],_0x240380['activeContact']);}}delete this[_0x9ddc('0x6c')][_0x2a7168[_0x9ddc('0xa7')]];break;case'ANSWER':var _0x52c6ab=moment()['format'](_0x9ddc('0x8c'));_0x240380[_0x9ddc('0xa8')]=_0x52c6ab;_0x240380[_0x9ddc('0xa9')]=_0x52c6ab;_0x240380[_0x9ddc('0x70')]=!![];_0x44b2e9[_0x9ddc('0x2e')]+=0x1;logger[_0x9ddc('0x55')](_0x9ddc('0xaa'),_0x240380[_0x9ddc('0xab')],'\x20Queue',_0x44b2e9[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x44b2e9[_0x9ddc('0x2e')]);ami[_0x9ddc('0x27')](_0x9ddc('0xac'),ut['buildObj'](_0x240380,_0x9ddc('0xad')));if(_0x44b2e9[_0x9ddc('0xae')]){ami[_0x9ddc('0x27')]('custom:agentConnectPreview',ut[_0x9ddc('0xaf')](_0x240380));}break;case'16':ami[_0x9ddc('0x27')](_0x9ddc('0xb0'),ut[_0x9ddc('0x9c')](_0x240380,'complete'));emitVoiceQueueChannelRemove(ut[_0x9ddc('0x9c')](_0x240380,'complete'));_0x44b2e9[_0x9ddc('0x39')]+=0x1;_0x44b2e9['total']+=0x1;_0x44b2e9['answered']+=0x1;ut[_0x9ddc('0xb1')](_0x44b2e9,_0x9ddc('0xb2'));_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x4,'Answer');rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xb3'));rpcDb['createCustomerFinal'](_0x240380,_0x9ddc('0xb4'));rpcDb['crateCustomerReportQueue'](_0x240380);_0x44b2e9['sumDuration']+=_0x240380[_0x9ddc('0xb5')];_0x44b2e9[_0x9ddc('0x2f')]+=_0x240380[_0x9ddc('0xb5')];logger['info'](_0x9ddc('0xb6'),_0x240380['uniqueid'],_0x9ddc('0xb7'),_0x44b2e9[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x44b2e9['pTalking']);delete this[_0x9ddc('0x6c')][_0x2a7168[_0x9ddc('0xa7')]];break;case _0x9ddc('0xb8'):_0x44b2e9['outboundBusyCallsDay']+=0x1;_0x240380[_0x9ddc('0xb9')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x5,_0x9ddc('0xba'));ami[_0x9ddc('0x27')](_0x9ddc('0xbb'),ut['buildObj'](_0x240380,'busy'));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xbc'));if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut[_0x9ddc('0xbd')](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb[_0x9ddc('0x92')](_0x17087a,_0x9ddc('0xbe'));}else{if(_0x240380[_0x9ddc('0xb9')]>=_0x44b2e9['dialBusyMaxRetry']){rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xbc'));}else{rpcDb[_0x9ddc('0xa5')](ut[_0x9ddc('0xa6')](_0x240380,_0x9ddc('0xb9'),_0x44b2e9[_0x9ddc('0xbf')]),_0x240380[_0x9ddc('0xc0')],_0x240380[_0x9ddc('0xc1')]);}}break;case _0x9ddc('0xc2'):_0x44b2e9['outboundNoAnswerCallsDay']+=0x1;_0x240380[_0x9ddc('0xc3')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut['logCustomer'](_0x240380,0x3,_0x9ddc('0xc4'));ami[_0x9ddc('0x27')](_0x9ddc('0xc5'),ut[_0x9ddc('0x9c')](_0x240380,_0x9ddc('0xc6')));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xc7'));if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut[_0x9ddc('0xbd')](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb[_0x9ddc('0x92')](_0x17087a,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x240380[_0x9ddc('0xc3')]>=_0x44b2e9[_0x9ddc('0xc8')]){rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xc7'));}else{rpcDb[_0x9ddc('0xa5')](ut[_0x9ddc('0xa6')](_0x240380,'countnoanswerretry',_0x44b2e9[_0x9ddc('0xc9')]),_0x240380[_0x9ddc('0xc0')],_0x240380['activeContact']);}}break;case _0x9ddc('0xca'):_0x44b2e9[_0x9ddc('0xcb')]+=0x1;_0x240380[_0x9ddc('0xcc')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x8,_0x9ddc('0xcd'));ami[_0x9ddc('0x27')](_0x9ddc('0xce'),ut[_0x9ddc('0x9c')](_0x240380,_0x9ddc('0xcf')));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xd0'));if(ut['totalGlobal'](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut['cloneAction'](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb[_0x9ddc('0x92')](_0x17087a,_0x9ddc('0xd1'));}else{if(_0x240380[_0x9ddc('0xcc')]>=_0x44b2e9[_0x9ddc('0xd2')]){rpcDb[_0x9ddc('0x92')](_0x240380,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x9ddc('0xa5')](ut[_0x9ddc('0xa6')](_0x240380,'countcongestionretry',_0x44b2e9['dialBusyRetryFrequency']),_0x240380[_0x9ddc('0xc0')],_0x240380[_0x9ddc('0xc1')]);}}break;case _0x9ddc('0xd3'):_0x44b2e9[_0x9ddc('0xd4')]+=0x1;_0x240380[_0x9ddc('0xd5')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0x14,_0x9ddc('0xd6'));ami[_0x9ddc('0x27')](_0x9ddc('0xd7'),ut['buildObj'](_0x240380,_0x9ddc('0xd8')));rpcDb['createCustomerHistory'](_0x240380,'[syncHangupRequest][logAgentReject]');if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut['cloneAction'](_0x240380,0x14,_0x9ddc('0xd6'));rpcDb['createCustomerFinal'](_0x17087a,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x240380[_0x9ddc('0xd5')]>=_0x44b2e9['dialAgentRejectMaxRetry']){rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xd9'));}else{rpcDb[_0x9ddc('0xa5')](ut['scheduledAt'](_0x240380,_0x9ddc('0xd5'),_0x44b2e9[_0x9ddc('0xda')]),_0x240380[_0x9ddc('0xc0')],_0x240380[_0x9ddc('0xc1')]);}}break;case _0x9ddc('0xdb'):_0x44b2e9[_0x9ddc('0x40')]+=0x1;_0x240380[_0x9ddc('0xdc')]+=0x1;_0x240380[_0x9ddc('0x98')]=ut['totalGlobal'](_0x240380);ut[_0x9ddc('0x8f')](_0x240380,0xb,_0x9ddc('0xdd'));rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xde'));if(ut['totalGlobal'](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut['cloneAction'](_0x240380,0xf,'Global');rpcDb['createCustomerFinal'](_0x17087a,_0x9ddc('0xde'));}else{if(_0x240380[_0x9ddc('0xdf')]>=_0x44b2e9[_0x9ddc('0xe0')]){rpcDb['createCustomerFinal'](_0x240380,_0x9ddc('0xde'));}else{rpcDb['rescheduleContact'](ut[_0x9ddc('0xa6')](_0x240380,_0x9ddc('0xdc'),_0x44b2e9[_0x9ddc('0xe1')]),_0x240380[_0x9ddc('0xc0')],_0x240380[_0x9ddc('0xc1')]);}}break;default:if(_0x240380[_0x9ddc('0x70')]){ut[_0x9ddc('0xb1')](_0x44b2e9,_0x9ddc('0xe2'));ut[_0x9ddc('0x7b')](_0x9ddc('0xe3')+_0x44b2e9[_0x9ddc('0x2a')],_0x2a7168);}_0x44b2e9['outboundUnknownCallsDay']+=0x1;_0x240380[_0x9ddc('0x98')]=ut[_0x9ddc('0x99')](_0x240380);ut['logCustomer'](_0x240380,0xc,_0x2a7168['cause-txt']||_0x2a7168['dialstatus']);rpcDb[_0x9ddc('0x9e')](_0x240380,_0x9ddc('0xe4'));if(ut[_0x9ddc('0x99')](_0x240380)>=_0x44b2e9[_0x9ddc('0xa0')]){_0x17087a=ut[_0x9ddc('0xbd')](_0x240380,0xf,_0x9ddc('0xa1'));rpcDb['createCustomerFinal'](_0x17087a,_0x9ddc('0xe5'));}else{rpcDb[_0x9ddc('0x92')](_0x240380,_0x9ddc('0xe5'));}delete this[_0x9ddc('0x6c')][_0x2a7168['linkedid']];}if(!(_0x240380['dialAnswer']&&_0x3b55b3==='16')){ut[_0x9ddc('0x79')](_0x44b2e9,_0x9ddc('0xe6'));logger['info'](_0x9ddc('0xe7'),_0x240380[_0x9ddc('0xab')],_0x9ddc('0xb7'),_0x44b2e9[_0x9ddc('0x2a')],'originated:\x20',_0x44b2e9['originated']);}if(_0x3b55b3!==_0x9ddc('0xe8')){delete this[_0x9ddc('0x6c')][_0x2a7168['linkedid']];delete this['actions'][_0x2a7168[_0x9ddc('0xe9')]];}}};Preview['prototype'][_0x9ddc('0xea')]=function(_0x4052ec,_0x3f7c4c,_0x5b91e8){if(_[_0x9ddc('0xeb')](_0x3f7c4c)&&'object'!==typeof _0x3f7c4c){return;}if(_[_0x9ddc('0xeb')](_0x5b91e8)&&'object'!==typeof _0x5b91e8){return;}switch(_0x5b91e8['reason']){case'0':ut[_0x9ddc('0xec')](_0x4052ec,0x0,_0x9ddc('0x9a'));rpcDb[_0x9ddc('0xed')](_0x4052ec,_0x9ddc('0xee'));break;case'3':ut[_0x9ddc('0xec')](_0x4052ec,0x3,_0x9ddc('0xc4'));rpcDb[_0x9ddc('0xed')](_0x4052ec,_0x9ddc('0xef'));break;case'5':ut['logAgent'](_0x4052ec,0x5,'Busy');rpcDb[_0x9ddc('0xed')](_0x4052ec,_0x9ddc('0xf0'));break;case'8':ut[_0x9ddc('0xec')](_0x4052ec,0x8,_0x9ddc('0xcd'));rpcDb[_0x9ddc('0xed')](_0x4052ec,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x9ddc('0xec')](_0x4052ec,0x16,_0x9ddc('0xf1'));rpcDb['createAgentHistory'](_0x4052ec,_0x9ddc('0xf2'));break;default:ut['logAgent'](_0x4052ec,0xc,_0x5b91e8[_0x9ddc('0xf3')]);rpcDb['createAgentHistory'](_0x4052ec,_0x9ddc('0xf4'));}ut['updateOriginated'](_0x3f7c4c,_0x9ddc('0xf5'));logger[_0x9ddc('0x55')](_0x9ddc('0xf6'),_0x4052ec[_0x9ddc('0xab')],_0x9ddc('0xb7'),_0x3f7c4c[_0x9ddc('0x2a')],_0x9ddc('0xf7'),_0x3f7c4c[_0x9ddc('0x4a')]);delete this[_0x9ddc('0x6c')][_0x4052ec[_0x9ddc('0xab')]];};Preview[_0x9ddc('0xf')][_0x9ddc('0xf8')]=function(_0x58af1c,_0x56b750,_0x3feb01,_0x1bef52,_0x208104){var _0x58d00b=this;return new BPromise(function(_0x253e82,_0x1d2a9b){if(_[_0x9ddc('0x6b')](_0x56b750)||_[_0x9ddc('0x6b')](_0x56b750['Contact'])||_['isNil'](_0x56b750['Contact'][_0x9ddc('0xf9')])||_[_0x9ddc('0x6b')](_0x56b750[_0x9ddc('0x73')])){_0x1d2a9b(ut[_0x9ddc('0x49')](_0x9ddc('0xfa'),_0x1bef52,_0x208104));return;}var _0xed99df=uuid['v4']();var _0x2717cf=_0x58d00b[_0x9ddc('0x14')][_0x56b750[_0x9ddc('0xfb')][_0x9ddc('0x2a')]];var _0x2359d1=_0x3feb01?_0x58d00b[_0x9ddc('0x17')][_0x3feb01]['id']:undefined;_0x58d00b[_0x9ddc('0x6c')][_0xed99df]=new Action(_0x56b750,_0x2717cf,_0xed99df,_0x3feb01,_0x2359d1);var _0x12b461=_0x58d00b[_0x9ddc('0x6c')][_0xed99df];_0x12b461['unlockAgent']=_0x1bef52;_0x12b461[_0x9ddc('0xc1')]=_0x208104;_0x12b461[_0x9ddc('0xfc')]=_0x3feb01;if(_['isEmpty'](_0x58af1c)){_0x58d00b[_0x9ddc('0xfd')](_0x12b461,_0x2717cf,_0x56b750,_0x3feb01)[_0x9ddc('0x81')](function(_0x26b990){logger[_0x9ddc('0x55')](_0x9ddc('0xfe'),_0x9ddc('0xff')+_0x12b461['queue']+_0x9ddc('0x100')+_0x12b461[_0x9ddc('0x101')],JSON[_0x9ddc('0x52')](_0x26b990));ami[_0x9ddc('0x27')](_0x9ddc('0x102'),ut[_0x9ddc('0x9c')](_0x12b461,'called'));_0x253e82(ut[_0x9ddc('0x49')](_0x9ddc('0x103')));})[_0x9ddc('0x77')](function(_0xf0c5e0){ut[_0x9ddc('0x5d')](_0x9ddc('0x104'),_0xf0c5e0);_0x1d2a9b(ut['message'](_0x9ddc('0x105'),_0x1bef52,_0x208104));});}else{_0x2717cf[_0x9ddc('0x106')]+=0x1;ut[_0x9ddc('0x107')](_0x12b461);rpcDb[_0x9ddc('0x108')](_0x12b461,'[Blacklist][error]');delete _0x58d00b[_0x9ddc('0x6c')][_0xed99df];_0x1d2a9b(ut[_0x9ddc('0x49')](_0x9ddc('0x109'),_0x1bef52,_0x208104));}});};Preview[_0x9ddc('0xf')][_0x9ddc('0x95')]=function(_0x587168){return!_[_0x9ddc('0x6b')](_0x587168)&&!_[_0x9ddc('0x6b')](_0x587168[_0x9ddc('0x2a')])&&!_[_0x9ddc('0x6b')](_0x587168[_0x9ddc('0x10a')])&&_0x587168[_0x9ddc('0x10a')]&&!_[_0x9ddc('0x6b')](this[_0x9ddc('0x16')][util['format']('SIP/%s',_0x587168[_0x9ddc('0x2a')])])&&!_['isNil'](this[_0x9ddc('0x16')][util['format'](_0x9ddc('0x10b'),_0x587168[_0x9ddc('0x2a')])][_0x9ddc('0x75')])&&(this['trunks'][util[_0x9ddc('0x53')](_0x9ddc('0x10b'),_0x587168[_0x9ddc('0x2a')])]['status']===_0x9ddc('0x10c')||this[_0x9ddc('0x16')][util['format']('SIP/%s',_0x587168[_0x9ddc('0x2a')])][_0x9ddc('0x75')]===_0x9ddc('0x10d'));};Preview['prototype'][_0x9ddc('0x87')]=function(_0x5a3d67,_0x4b3256){var _0x26b551=this;return new BPromise(function(_0x48f4e1,_0x5e3888){_0x26b551['execRun'](_0x5a3d67,_0x4b3256)[_0x9ddc('0x81')](function(_0x1d1998){_0x48f4e1(_[_0x9ddc('0x71')](_0x1d1998,[_0x9ddc('0x49')]));})['catch'](function(_0x336fa4){if(_0x336fa4[_0x9ddc('0x10e')]){rpcDb[_0x9ddc('0x10f')](_0x5a3d67);}if(_0x336fa4['active']){rpcDb[_0x9ddc('0x8a')](_0x5a3d67);}_0x5e3888(_[_0x9ddc('0x71')](_0x336fa4,[_0x9ddc('0x49')]));});});};Preview[_0x9ddc('0xf')][_0x9ddc('0x110')]=function(_0x432f1a,_0x578074){var _0x55657c=this;return new BPromise(function(_0xb8dbca,_0xea9973){var _0x87c418,_0x1f9fa5;rpcDb[_0x9ddc('0x111')](_0x432f1a)[_0x9ddc('0x81')](function(_0x2bf4b7){if(!_[_0x9ddc('0x6b')](_0x2bf4b7[0x0])){_0x1f9fa5=_0x2bf4b7[0x0]['recallme']?![]:!![];_0x87c418=_0x2bf4b7[0x0]['recallme']?!![]:![];_0x87c418=_0x578074?!![]:_0x87c418;}var _0x54ef8e=_0x55657c[_0x9ddc('0x112')](_0x2bf4b7);if(_0x54ef8e[_0x9ddc('0x113')]){rpcDb[_0x9ddc('0x114')](_[_0x9ddc('0x71')](_0x2bf4b7[0x0],[_0x9ddc('0x73'),'Contact.phone']))[_0x9ddc('0x81')](function(_0xe15f5d){_0x55657c['checkInBlack'](_0xe15f5d,_0x2bf4b7[0x0],_0x578074,_0x1f9fa5,_0x87c418)[_0x9ddc('0x81')](function(_0x4339f1){_0xb8dbca(_0x4339f1);})[_0x9ddc('0x77')](function(_0x9a53a1){_0xea9973(_0x9a53a1);});})[_0x9ddc('0x77')](function(_0x42bc75){ut['logger'](_0x9ddc('0x115'),_0x42bc75);_0xea9973(ut[_0x9ddc('0x49')]('Call\x20unsuccessful',_0x1f9fa5,_0x87c418));});}else{_0xea9973(ut[_0x9ddc('0x49')](_0x54ef8e[_0x9ddc('0x49')],_0x1f9fa5,_0x87c418));}})[_0x9ddc('0x77')](function(_0x3525d1){ut[_0x9ddc('0x5d')](_0x9ddc('0x116'),_0x3525d1);_0xea9973(ut['message'](_0x9ddc('0x117'),![],!![]));});});};Preview[_0x9ddc('0xf')]['validateContact']=function(_0xa3a8eb){if(_[_0x9ddc('0x6b')](_0xa3a8eb)||_[_0x9ddc('0x118')](_0xa3a8eb)||!_[_0x9ddc('0x6b')](_0xa3a8eb[0x0][_0x9ddc('0x86')])&&_['isNil'](_0xa3a8eb[0x0][_0x9ddc('0x86')]['name'])){ut['logger'](_0x9ddc('0x119'),_0xa3a8eb);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x49e6ac=this['campaignsPreview'][_0xa3a8eb[0x0][_0x9ddc('0xfb')][_0x9ddc('0x2a')]];_0x49e6ac['message']='ACTIVE';if(_[_0x9ddc('0x6b')](_0x49e6ac)){ut[_0x9ddc('0x5d')](_0x9ddc('0x11a'),_0x49e6ac);return{'isValid':![],'message':_0x9ddc('0x11b')};}if(!this[_0x9ddc('0x95')](_0x49e6ac['Trunk'])){ut['logger'](_0x9ddc('0x11c'),_0x9ddc('0x11d')+_0x49e6ac[_0x9ddc('0x2a')]+_0x9ddc('0x11e'));if(!this[_0x9ddc('0x95')](_0x49e6ac[_0x9ddc('0x11f')])){ut[_0x9ddc('0x5d')](_0x9ddc('0x11c'),_0x49e6ac[_0x9ddc('0x2a')]+_0x9ddc('0x120'));return{'isValid':![],'message':_0x9ddc('0x121')};}}if(!ut['isActive'](_0x49e6ac[_0x9ddc('0x67')])){ut[_0x9ddc('0x5d')](_0x9ddc('0x122'),_0x49e6ac[_0x9ddc('0x2a')]+_0x9ddc('0x123'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x49e6ac[_0x9ddc('0x2a')]+_0x9ddc('0x123')};}return{'isValid':!![],'message':_0x9ddc('0x124')};};Preview[_0x9ddc('0xf')][_0x9ddc('0xfd')]=function(_0x197a0f,_0x3bef4d,_0x153ecf,_0x95efab){var _0xdb04e2=this;return new BPromise(function(_0xfde2b0,_0x2adf9d){var _0x400b44=_0x197a0f[_0x9ddc('0xab')];var _0x231d7b=_0xdb04e2['isTrunkReachable'](_0x3bef4d['Trunk'])?util[_0x9ddc('0x53')](_0x9ddc('0x125'),_0x3bef4d[_0x9ddc('0x4f')][_0x9ddc('0x2a')],_['isNil'](_0x3bef4d[_0x9ddc('0x38')])?'':_0x3bef4d[_0x9ddc('0x38')]['trim']()||'',_0x3bef4d['dialCutDigit']>0x0?_0x153ecf[_0x9ddc('0x126')][_0x9ddc('0xf9')][_0x9ddc('0x127')](_0x3bef4d[_0x9ddc('0x128')]):_0x153ecf[_0x9ddc('0x126')][_0x9ddc('0xf9')]):util[_0x9ddc('0x53')]('SIP/%s/%s%s',_['isNil'](_0x3bef4d[_0x9ddc('0x11f')])?_0x3bef4d[_0x9ddc('0x4f')][_0x9ddc('0x2a')]:_0x3bef4d[_0x9ddc('0x11f')][_0x9ddc('0x2a')],_[_0x9ddc('0x6b')](_0x3bef4d[_0x9ddc('0x38')])?'':_0x3bef4d['dialPrefix'][_0x9ddc('0x129')]()||'',_0x3bef4d[_0x9ddc('0x128')]>0x0?_0x153ecf[_0x9ddc('0x126')]['phone']['substring'](_0x3bef4d[_0x9ddc('0x128')]):_0x153ecf[_0x9ddc('0x126')][_0x9ddc('0xf9')]);var _0x5b0347=_0xdb04e2[_0x9ddc('0x95')](_0x3bef4d[_0x9ddc('0x4f')])?ut[_0x9ddc('0x12a')](_0x3bef4d[_0x9ddc('0x4f')][_0x9ddc('0x50')],_0x3bef4d['dialOriginateCallerIdName'],_0x3bef4d[_0x9ddc('0x12b')]>0x0?ut[_0x9ddc('0x12c')](_0x3bef4d['dialOriginateCallerIdNumber'],_0x3bef4d[_0x9ddc('0x12b')]):_0x3bef4d[_0x9ddc('0x37')]):ut[_0x9ddc('0x12a')](_[_0x9ddc('0x6b')](_0x3bef4d[_0x9ddc('0x11f')])?_0x3bef4d[_0x9ddc('0x4f')]['callerid']:_0x3bef4d[_0x9ddc('0x11f')][_0x9ddc('0x50')],_0x3bef4d[_0x9ddc('0x12d')],_0x3bef4d['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x9ddc('0x12c')](_0x3bef4d[_0x9ddc('0x37')],_0x3bef4d[_0x9ddc('0x12b')]):_0x3bef4d[_0x9ddc('0x37')]);if(_0x5b0347){_0x197a0f['originatecalleridname']=ut[_0x9ddc('0x12e')](_0x5b0347);_0x197a0f[_0x9ddc('0x12f')]=ut[_0x9ddc('0x130')](_0x5b0347);}var _0x25ffe4=ut[_0x9ddc('0x131')](_0x3bef4d,_0x153ecf,_0x231d7b,_0x5b0347,_0x400b44,_0x197a0f);_['merge'](_0x197a0f,ut[_0x9ddc('0x132')](_0x25ffe4));_0x197a0f[_0x9ddc('0x8b')]=moment()[_0x9ddc('0x53')](_0x9ddc('0x8c'));ami[_0x9ddc('0x133')](ut[_0x9ddc('0x134')](_0x197a0f,_0x3bef4d,_0x25ffe4,_0x197a0f[_0x9ddc('0xc1')],_0x95efab))['then'](function(_0xbac7e3){_0x3bef4d[_0x9ddc('0x4a')]+=0x1;logger[_0x9ddc('0x55')]('[originated][increment]',_0x400b44,_0x9ddc('0xb7'),_0x3bef4d['name'],_0x9ddc('0xf7'),_0x3bef4d[_0x9ddc('0x4a')]);_0xfde2b0(_0xbac7e3);})[_0x9ddc('0x77')](function(_0x396132){ut[_0x9ddc('0xec')](_0x197a0f,0xe,'OriginateError');rpcDb[_0x9ddc('0xed')](_0x197a0f,_0x9ddc('0x135'));_0x2adf9d(_0x396132);});});};Preview['prototype']['syncNewExten']=function(_0x9c53e1){if(this['actions'][_0x9c53e1[_0x9ddc('0xa7')]]){this[_0x9ddc('0x6c')][_0x9c53e1[_0x9ddc('0xa7')]][_0x9ddc('0x76')]=_0x9c53e1[_0x9ddc('0x76')];}};Preview['prototype'][_0x9ddc('0x19')]=function(_0x555ba8){var _0x150661=this;var _0x3cc631=this['actions'][_0x555ba8[_0x9ddc('0x136')]];if(_0x3cc631){if(_0x3cc631['lookAgent']&&this['agents'][_0x3cc631[_0x9ddc('0xfc')]]){ut[_0x9ddc('0x137')](_0x3cc631,this['agents'][_0x3cc631['lookAgent']][_0x9ddc('0x2a')],this['agents'][_0x3cc631[_0x9ddc('0xfc')]]['id']);}var _0x3168db=_[_0x9ddc('0x138')](_0x3cc631);_0x3168db['responsetime']=moment()[_0x9ddc('0x53')](_0x9ddc('0x8c'));var _0x543a79=_0x150661['campaignsPreview'][_0x3cc631[_0x9ddc('0x6e')]];if(ut['isFailure'](_0x555ba8[_0x9ddc('0x139')])){if(_0x3cc631[_0x9ddc('0xc0')]){rpcDb[_0x9ddc('0x10f')](_0x3cc631[_0x9ddc('0x101')]);}if(_0x3cc631['activeContact']){rpcDb[_0x9ddc('0x8a')](_0x3cc631[_0x9ddc('0x101')]);}ami[_0x9ddc('0x27')]('custom:agentringnoanswer',ut['buildObj'](_0x3cc631,_0x9ddc('0x13a')));this['callProgressDetectingAgent'](_0x3168db,_0x543a79,_0x555ba8);}else{_0x3cc631[_0x9ddc('0x8b')]=moment()[_0x9ddc('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x3168db,0x4,_0x9ddc('0x13b'));rpcDb['createAgentHistory'](_0x3168db,_0x9ddc('0x13c'));}}};Preview[_0x9ddc('0xf')][_0x9ddc('0x1c')]=function(_0x57625b){var _0x3a3c55=this;var _0xeea313=this['actions'][_0x57625b[_0x9ddc('0xa7')]];var _0x4fbfac;if(_0xeea313){_0x4fbfac=this[_0x9ddc('0x14')][_0xeea313[_0x9ddc('0x6e')]];logger['info'](_0x9ddc('0x13d'),_0x57625b[_0x9ddc('0xa7')],_0x9ddc('0xb7'),_0x4fbfac[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x4fbfac['pTalking']);}if(this['actions'][_0x57625b[_0x9ddc('0xa7')]]&&_0x57625b[_0x9ddc('0xa7')]!==_0x57625b[_0x9ddc('0xab')]){if(_0x57625b[_0x9ddc('0x13e')]==='16'&&this[_0x9ddc('0x6c')][_0x57625b[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){this[_0x9ddc('0x97')](_0x57625b,_0x57625b[_0x9ddc('0xa7')],_0x57625b['cause']);}else if(this['actions'][_0x57625b[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){logger[_0x9ddc('0x55')](_0x9ddc('0x13f'),_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')],_0x9ddc('0xb7'),_0x4fbfac[_0x9ddc('0x2a')],'pTalking:\x20',_0x4fbfac[_0x9ddc('0x2e')]);this[_0x9ddc('0x97')](_0x57625b,_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')]);}}else if(_0xeea313&&_[_0x9ddc('0x6b')](_0xeea313[_0x9ddc('0x140')])&&_0x4fbfac[_0x9ddc('0x141')]&&_0x57625b[_0x9ddc('0xa7')]===_0x57625b[_0x9ddc('0xab')]&&_[_0x9ddc('0x6b')](_0x57625b['reason'])&&_0x57625b[_0x9ddc('0x13e')]==='16'&&_0x57625b[_0x9ddc('0x142')]==='6'&&_['isUndefined'](_0xeea313[_0x9ddc('0x143')])){if(_0xeea313[_0x9ddc('0xc0')]){rpcDb[_0x9ddc('0x10f')](_0xeea313[_0x9ddc('0x101')]);}if(_0xeea313[_0x9ddc('0xc1')]){rpcDb[_0x9ddc('0x8a')](_0xeea313[_0x9ddc('0x101')]);}_0x57625b[_0x9ddc('0xf3')]='22';this['callProgressDetectingAgent'](_0xeea313,_0x4fbfac,_0x57625b);}else if(_0xeea313&&_0xeea313[_0x9ddc('0x143')]){if(_0x57625b[_0x9ddc('0x13e')]==='16'&&this[_0x9ddc('0x6c')][_0x57625b[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){logger['info'](_0x9ddc('0x144'),_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')],_0x9ddc('0xb7'),_0x4fbfac[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x4fbfac['pTalking']);this[_0x9ddc('0x97')](_0x57625b,_0x57625b['linkedid'],_0x57625b[_0x9ddc('0x13e')]);}else if(this[_0x9ddc('0x6c')][_0x57625b[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){logger[_0x9ddc('0x55')]('[syncHangup][talking][cause]',_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')],_0x9ddc('0xb7'),_0x4fbfac[_0x9ddc('0x2a')],_0x9ddc('0x6f'),_0x4fbfac['pTalking']);this['callProgressDetectingCustomer'](_0x57625b,_0x57625b[_0x9ddc('0xa7')],_0x57625b[_0x9ddc('0x13e')]);}}};Preview['prototype'][_0x9ddc('0x1f')]=function(_0x17f8dd){if(this[_0x9ddc('0x6c')][_0x17f8dd[_0x9ddc('0xe9')]]&&_0x17f8dd[_0x9ddc('0xe9')]!==_0x17f8dd[_0x9ddc('0x145')]){this[_0x9ddc('0x97')](_0x17f8dd,_0x17f8dd[_0x9ddc('0xe9')],_0x17f8dd[_0x9ddc('0x146')]);}};Preview[_0x9ddc('0xf')][_0x9ddc('0x1e')]=function(_0x2eda9e){if(this['actions'][_0x2eda9e[_0x9ddc('0xa7')]]&&_0x2eda9e[_0x9ddc('0xa7')]!==_0x2eda9e[_0x9ddc('0xab')]&&!this['actions'][_0x2eda9e[_0x9ddc('0xa7')]][_0x9ddc('0x70')]){if(_0x2eda9e[_0x9ddc('0x13e')]==='1'){this[_0x9ddc('0x97')](_0x2eda9e,_0x2eda9e[_0x9ddc('0xa7')],_0x2eda9e[_0x9ddc('0x13e')]);}}};Preview[_0x9ddc('0xf')]['addVariable']=function(_0x161b1a,_0x2c253c,_0x3df825){if(this['actions'][_0x161b1a]){if(_[_0x9ddc('0x6b')](this[_0x9ddc('0x6c')][_0x161b1a][_0x9ddc('0x147')])){this[_0x9ddc('0x6c')][_0x161b1a][_0x9ddc('0x147')]={};}this[_0x9ddc('0x6c')][_0x161b1a][_0x9ddc('0x147')][_0x2c253c]=_0x3df825;}};Preview['prototype'][_0x9ddc('0x148')]=function(_0x3c02dc){try{if(!_[_0x9ddc('0x6b')](_0x3c02dc)){if(ut[_0x9ddc('0x149')](_[_0x9ddc('0x14a')](_0x3c02dc[_0x9ddc('0x14b')])[0x0])){this[_0x9ddc('0x14c')](_0x3c02dc['uniqueid'],_[_0x9ddc('0x14a')](_0x3c02dc['variable'])[0x0],_0x3c02dc[_0x9ddc('0x14d')]);}}}catch(_0x5a034a){logger['error'](_0x9ddc('0x14e'),util[_0x9ddc('0x14f')](_0x5a034a,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x2eacef){if(_0x2eacef){if(this[_0x9ddc('0x6c')][_0x2eacef[_0x9ddc('0x150')]]){this[_0x9ddc('0x6c')][_0x2eacef[_0x9ddc('0x150')]][_0x9ddc('0x143')]=!![];}}};Preview[_0x9ddc('0xf')][_0x9ddc('0x25')]=function(_0xa43192){if(_0xa43192){if(this[_0x9ddc('0x6c')][_0xa43192['transfererlinkedid']]){this[_0x9ddc('0x6c')][_0xa43192[_0x9ddc('0x151')]]['transfer']=!![];}}};module[_0x9ddc('0x152')]=Preview; \ No newline at end of file +var _0xe47c=['sumBillable','[syncHangup][talking][decrement]','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countcongestionretry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','logAgent','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','Contact','phone','Contact\x20is\x20undefined','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','run','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','TrunkBackup','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','starttime','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','destuniqueid','dialstatus','addVariable','keys','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','talking','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','clearZombieChannels','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe47c,0x1d9));var _0xce47=function(_0x397d60,_0x3dea76){_0x397d60=_0x397d60-0x0;var _0x4a0523=_0xe47c[_0x397d60];return _0x4a0523;};'use strict';var util=require('util');var _=require(_0xce47('0x0'));var BPromise=require(_0xce47('0x1'));var uuid=require(_0xce47('0x2'));var moment=require('moment');var md5=require(_0xce47('0x3'));var Redis=require(_0xce47('0x4'));var config=require(_0xce47('0x5'));var logger=require(_0xce47('0x6'))(_0xce47('0x7'));var loggerAction=require(_0xce47('0x6'))(_0xce47('0x8'));var ami=require(_0xce47('0x9'));var rpcDb=require(_0xce47('0xa'));var Action=require(_0xce47('0xb'));var ut=require(_0xce47('0xc'));config[_0xce47('0xd')]=_[_0xce47('0xe')](config['redis'],{'host':_0xce47('0xf'),'port':0x18eb});var io=require(_0xce47('0x10'))(new Redis(config[_0xce47('0xd')]));var Sequence=function(){};Sequence[_0xce47('0x11')][_0xce47('0x12')]=function(_0x231059){this[_0xce47('0x13')]=this[_0xce47('0x13')]?this[_0xce47('0x13')]['finally'](_0x231059):_0x231059();};function Preview(_0x3b3981){this[_0xce47('0x14')]=new Sequence();this[_0xce47('0x15')]=_0x3b3981[_0xce47('0x16')];this[_0xce47('0x17')]=_0x3b3981[_0xce47('0x17')];this['actions']={};this[_0xce47('0x18')]=_0x3b3981[_0xce47('0x18')];this[_0xce47('0x19')]=0x0;ami['on'](_0xce47('0x1a'),this[_0xce47('0x1b')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x1d'),this[_0xce47('0x1e')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x1f'),this[_0xce47('0x20')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x21'),this[_0xce47('0x22')]['bind'](this));ami['on'](_0xce47('0x23'),this[_0xce47('0x24')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x25'),this[_0xce47('0x26')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x27'),this[_0xce47('0x28')][_0xce47('0x1c')](this));ami['on'](_0xce47('0x29'),this[_0xce47('0x2a')][_0xce47('0x1c')](this));this[_0xce47('0x2b')](this[_0xce47('0x15')]);}function emit(_0x7ed2d1,_0x39d571,_0x3c60c8){io['to'](_0x7ed2d1)[_0xce47('0x2c')](_0x39d571,_0x3c60c8);}function emitCampaignPreview(_0x5cd6f8){if(_0x5cd6f8[_0xce47('0x2d')]===_0xce47('0x2e')){var _0x3ed0a0={'id':_0x5cd6f8['id'],'name':_0x5cd6f8[_0xce47('0x2f')],'strategy':_0x5cd6f8[_0xce47('0x30')],'answered':_0x5cd6f8[_0xce47('0x31')],'available':_0x5cd6f8[_0xce47('0x32')],'loggedIn':_0x5cd6f8[_0xce47('0x33')],'pTalking':_0x5cd6f8['pTalking'],'sumBillable':_0x5cd6f8['sumBillable'],'sumDuration':_0x5cd6f8[_0xce47('0x34')],'sumHoldTime':_0x5cd6f8[_0xce47('0x35')]||0x0,'talking':_0x5cd6f8[_0xce47('0x36')],'total':_0x5cd6f8['total'],'type':_0x5cd6f8[_0xce47('0x2d')],'unmanaged':_0x5cd6f8['unmanaged'],'abandoned':_0x5cd6f8[_0xce47('0x37')],'waiting':_0x5cd6f8[_0xce47('0x38')],'loggedInDb':_0x5cd6f8[_0xce47('0x39')],'dialActive':_0x5cd6f8[_0xce47('0x3a')],'dialMethod':_0x5cd6f8[_0xce47('0x3b')],'dialOriginateCallerIdName':_0x5cd6f8[_0xce47('0x3c')],'dialOriginateCallerIdNumber':_0x5cd6f8[_0xce47('0x3d')],'dialOriginateTimeout':_0x5cd6f8['dialOriginateTimeout'],'dialPrefix':_0x5cd6f8[_0xce47('0x3e')],'outboundAnswerAgiCallsDay':_0x5cd6f8[_0xce47('0x3f')],'outboundAnswerCallsDay':_0x5cd6f8[_0xce47('0x40')],'outboundBlacklistCallsDay':_0x5cd6f8[_0xce47('0x41')],'outboundBusyCallsDay':_0x5cd6f8['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5cd6f8[_0xce47('0x42')],'outboundDropCallsDayACS':_0x5cd6f8[_0xce47('0x43')],'outboundDropCallsDayCallersExit':_0x5cd6f8[_0xce47('0x44')],'outboundDropCallsDayTimeout':_0x5cd6f8[_0xce47('0x45')],'outboundNoAnswerCallsDay':_0x5cd6f8[_0xce47('0x46')],'outboundNoSuchCallsDay':_0x5cd6f8[_0xce47('0x47')],'outboundOriginateFailureCallsDay':_0x5cd6f8[_0xce47('0x48')],'outboundReCallsDay':_0x5cd6f8['outboundReCallsDay'],'outboundRejectCallsDay':_0x5cd6f8[_0xce47('0x49')],'outboundUnknownCallsDay':_0x5cd6f8[_0xce47('0x4a')],'outboundAbandonedCallsDay':_0x5cd6f8[_0xce47('0x4b')],'predictiveIntervalAnsweredCalls':_0x5cd6f8[_0xce47('0x4c')],'predictiveIntervalAvgHoldtime':_0x5cd6f8[_0xce47('0x4d')],'predictiveIntervalAvgTalktime':_0x5cd6f8['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5cd6f8['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x5cd6f8[_0xce47('0x4e')],'predictiveIntervalErlangCalls':_0x5cd6f8[_0xce47('0x4f')],'predictiveIntervalErlangCallsDroppedCalls':_0x5cd6f8[_0xce47('0x50')],'predictiveIntervalHitRate':_0x5cd6f8[_0xce47('0x51')],'predictiveIntervalMultiplicativeFactor':_0x5cd6f8[_0xce47('0x52')],'predictiveIntervalPauses':_0x5cd6f8[_0xce47('0x53')],'predictiveIntervalAvailable':_0x5cd6f8[_0xce47('0x54')],'predictiveIntervalTotalCalls':_0x5cd6f8[_0xce47('0x55')],'message':_0x5cd6f8[_0xce47('0x56')],'originated':_0x5cd6f8[_0xce47('0x57')],'erlangCalls':_0x5cd6f8[_0xce47('0x58')],'erlangCallToSecond':_0x5cd6f8[_0xce47('0x59')],'erlangAbandonmentRate':_0x5cd6f8[_0xce47('0x5a')],'erlangBusyFactor':_0x5cd6f8[_0xce47('0x5b')],'startPredictive':_0x5cd6f8[_0xce47('0x5c')],'startProgressive':_0x5cd6f8[_0xce47('0x5d')]};if(_0x5cd6f8['Trunk']){_0x3ed0a0[_0xce47('0x5e')]={'id':_0x5cd6f8[_0xce47('0x5e')]['id'],'name':_0x5cd6f8[_0xce47('0x5e')]['name'],'active':_0x5cd6f8[_0xce47('0x5e')][_0xce47('0x5f')],'callerid':_0x5cd6f8[_0xce47('0x5e')]['callerid']};}if(_0x5cd6f8[_0xce47('0x60')]){_0x3ed0a0[_0xce47('0x60')]={'id':_0x5cd6f8[_0xce47('0x60')]['id'],'name':_0x5cd6f8['Interval'][_0xce47('0x2f')]};}var _0x22da7b=md5(JSON[_0xce47('0x61')](_0x3ed0a0));if(_0x5cd6f8[_0xce47('0x3')]!==_0x22da7b){_0x5cd6f8[_0xce47('0x3')]=_0x22da7b;emit(util[_0xce47('0x62')](_0xce47('0x63'),_0x3ed0a0['name']),_0xce47('0x64'),_0x3ed0a0);}}}function emitVoiceQueueChannelRemove(_0x387601){logger[_0xce47('0x65')](_0xce47('0x66'),JSON[_0xce47('0x61')](_0x387601));emit(util[_0xce47('0x62')](_0xce47('0x63'),_0x387601[_0xce47('0x2f')]),'voice_queue_channel:remove',_0x387601);}function notSendMessagesQueue(_0x3f9151){if(_0x3f9151[_0xce47('0x67')]){if(_0x3f9151['originated']===0x0&&_0x3f9151[_0xce47('0x68')]===0x0){_0x3f9151[_0xce47('0x67')]=![];_0x3f9151[_0xce47('0x32')]=0x0;_0x3f9151[_0xce47('0x69')]=0x0;_0x3f9151['message']=_0xce47('0x6a');ut[_0xce47('0x6b')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3f9151[_0xce47('0x2f')]+_0xce47('0x6c'));}else{_0x3f9151[_0xce47('0x56')]=_0xce47('0x6d');ut[_0xce47('0x6b')](_0xce47('0x6e'),_0x3f9151['name']+_0xce47('0x6f'));}emitCampaignPreview(_0x3f9151);}}Preview['prototype'][_0xce47('0x2b')]=function(){var _0x2d1462=this;setInterval(function(){_0x2d1462[_0xce47('0x70')]();},0x7cf);};Preview[_0xce47('0x11')][_0xce47('0x70')]=function(){var _0xfcf8e6=this['campaignsPreview'];this[_0xce47('0x19')]+=0x1;for(var _0x1b0cfd in _0xfcf8e6){if(_0xfcf8e6[_0xce47('0x71')](_0x1b0cfd)&&(_0xfcf8e6[_0x1b0cfd]['dialMethod']===_0xce47('0x7')||_0xfcf8e6[_0x1b0cfd]['dialMethod']==='booked')&&_0xfcf8e6[_0x1b0cfd][_0xce47('0x2d')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xce47('0x19')]=0x0;this[_0xce47('0x72')]();}}if(_0xfcf8e6[_0xce47('0x71')](_0x1b0cfd)&&_0xfcf8e6[_0x1b0cfd][_0xce47('0x3b')]===_0xce47('0x7')&&_0xfcf8e6[_0x1b0cfd][_0xce47('0x2d')]==='outbound'){if(_0xfcf8e6[_0x1b0cfd][_0xce47('0x3a')]){this['setMessage'](_0xfcf8e6[_0x1b0cfd]);this[_0xce47('0x73')](_0xfcf8e6[_0x1b0cfd]);}else{notSendMessagesQueue(_0xfcf8e6[_0x1b0cfd]);}}}};Preview['prototype'][_0xce47('0x74')]=function(_0x32f044){var _0x2ee319=this;this[_0xce47('0x14')]['enqueue'](function(){if(!_[_0xce47('0x75')](_0x2ee319[_0xce47('0x76')][_0x32f044])){loggerAction[_0xce47('0x65')](_0xce47('0x77'),_0x32f044,_0xce47('0x78'),_0x2ee319['actions'][_0x32f044]['queue'],'originated:\x20',JSON['stringify'](_0x2ee319[_0xce47('0x15')][_0x2ee319[_0xce47('0x76')][_0x32f044][_0xce47('0x79')]][_0xce47('0x57')]),'pTalking:\x20',JSON[_0xce47('0x61')](_0x2ee319['campaignsPreview'][_0x2ee319[_0xce47('0x76')][_0x32f044][_0xce47('0x79')]][_0xce47('0x68')]),JSON['stringify'](_0x2ee319[_0xce47('0x76')][_0x32f044][_0xce47('0x7a')]),JSON['stringify'](_[_0xce47('0x7b')](_0x2ee319[_0xce47('0x76')][_0x32f044],['contactId',_0xce47('0x7c'),_0xce47('0x7d'),_0xce47('0x7e')])));return ami[_0xce47('0x7f')]({'action':'status','channel':_0x2ee319['actions'][_0x32f044][_0xce47('0x80')]})[_0xce47('0x81')](function(_0x1ace8f){if(_0x1ace8f[_0xce47('0x56')]===_0xce47('0x82')){setTimeout(function(){if(_0x2ee319[_0xce47('0x76')][_0x32f044]){ut['updateOriginated'](_0x2ee319['campaignsPreview'][_0x2ee319[_0xce47('0x76')][_0x32f044][_0xce47('0x79')]],_0xce47('0x83'));if(_0x2ee319['actions'][_0x32f044][_0xce47('0x7a')]===!![]){ut[_0xce47('0x84')](_0x2ee319[_0xce47('0x15')][_0x2ee319['actions'][_0x32f044][_0xce47('0x79')]],_0xce47('0x83'));ut['loggerError'](_0xce47('0x85')+_0x32f044,_0x2ee319['actions'][_0x32f044][_0xce47('0x79')]);}ut[_0xce47('0x86')]('[Dialer][checkChannel][Preview]'+_0x32f044,_0x2ee319[_0xce47('0x76')][_0x32f044]['queue']);delete _0x2ee319['actions'][_0x32f044];}},0x2328);}});}});};Preview[_0xce47('0x11')]['clearZombieChannels']=function(){var _0x4478e0=this;loggerAction[_0xce47('0x65')]('[action]',_[_0xce47('0x87')](this[_0xce47('0x76')]));for(var _0x2ddd9f in this[_0xce47('0x76')]){if(_0x4478e0[_0xce47('0x76')][_0xce47('0x71')](_0x2ddd9f)){_0x4478e0[_0xce47('0x74')](_0x2ddd9f);}}};Preview[_0xce47('0x11')][_0xce47('0x73')]=function(_0x212a9d){var _0x444054=this;rpcDb[_0xce47('0x88')](_0x212a9d['id'],ut[_0xce47('0x89')](this[_0xce47('0x18')]))[_0xce47('0x8a')](function(_0x40b499){if(!_[_0xce47('0x75')](_0x40b499)){for(var _0x2ed852=0x0;_0x2ed852<_0x40b499['length'];_0x2ed852+=0x1){if(ut[_0xce47('0x8b')](_0x40b499[_0x2ed852][_0xce47('0x8c')])<_0x212a9d['dialRecallMeTimeout']*0x3c){if(_0x40b499[_0x2ed852][_0xce47('0x8d')]&&!_0x40b499[_0x2ed852]['Agent']['voicePause']){_0x444054['run'](_0x40b499[_0x2ed852]['id'])[_0xce47('0x8a')](ut[_0xce47('0x8e')](_0xce47('0x8f')))['catch'](ut[_0xce47('0x8e')](_0xce47('0x8f')));}else{rpcDb['disableContact'](_0x40b499[_0x2ed852]['id']);}}else{var _0x143f08=new Action(_0x40b499[_0x2ed852],_0x212a9d);_0x143f08['starttime']=moment()[_0xce47('0x62')](_0xce47('0x90'));_0x212a9d[_0xce47('0x91')]+=0x1;ut[_0xce47('0x92')](_0x143f08,0x17,_0xce47('0x93'));if(_0x212a9d[_0xce47('0x94')]){rpcDb[_0xce47('0x95')](ut['createBody'](_0x40b499[_0x2ed852]));rpcDb[_0xce47('0x96')](_0x143f08,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x143f08,0x16,_0xce47('0x97'));rpcDb[_0xce47('0x96')](_0x143f08,_0xce47('0x98'));rpcDb[_0xce47('0x99')](_0x143f08,_0xce47('0x98'));}}}}})[_0xce47('0x81')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xce47('0x11')][_0xce47('0x9a')]=function(_0x386c44){_0x386c44['sendMessageOneNotActive']=!![];if(ut[_0xce47('0x9b')](_0x386c44['loggedIn'])){_0x386c44[_0xce47('0x56')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xce47('0x9c')](_0x386c44[_0xce47('0x3a')])){_0x386c44['message']=_0xce47('0x6a');}else if(!this[_0xce47('0x9d')](_0x386c44[_0xce47('0x5e')])){if(!this[_0xce47('0x9d')](_0x386c44['TrunkBackup'])){_0x386c44['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x386c44[_0xce47('0x56')]=_0xce47('0x9e');}}else{_0x386c44[_0xce47('0x56')]=_0xce47('0x9e');}emitCampaignPreview(_0x386c44);};Preview['prototype'][_0xce47('0x9f')]=function(_0x4556ae,_0x22e0c7,_0x3c765f){var _0x5856dd=this;var _0x4e78d7=this[_0xce47('0x76')][_0x22e0c7];var _0x48844c=this[_0xce47('0x15')][_0x4e78d7[_0xce47('0x79')]];var _0x39ae13;if(_0x48844c){switch(_0x3c765f){case'1':_0x48844c[_0xce47('0x47')]+=0x1;_0x4e78d7[_0xce47('0xa0')]+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0x0,_0xce47('0xa3'));ami[_0xce47('0x2c')](_0xce47('0xa4'),ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xa6')));rpcDb[_0xce47('0x96')](_0x4e78d7,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x4e78d7[_0xce47('0xa0')]>=_0x48844c[_0xce47('0xaa')]){rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xab'));}else{rpcDb['rescheduleContact'](ut[_0xce47('0xac')](_0x4e78d7,'countnosuchnumberretry',_0x48844c[_0xce47('0xad')]),_0x4e78d7['unlockAgent'],_0x4e78d7[_0xce47('0xae')]);}}delete this[_0xce47('0x76')][_0x4556ae[_0xce47('0xaf')]];break;case _0xce47('0xb0'):var _0x249a61=moment()['format'](_0xce47('0x90'));_0x4e78d7[_0xce47('0xb1')]=_0x249a61;_0x4e78d7[_0xce47('0xb2')]=_0x249a61;_0x4e78d7[_0xce47('0x7a')]=!![];_0x48844c[_0xce47('0x68')]+=0x1;logger[_0xce47('0x65')]('[syncHangup][talking][increment]',_0x4e78d7[_0xce47('0xb3')],_0xce47('0xb4'),_0x48844c['name'],_0xce47('0xb5'),_0x48844c[_0xce47('0x68')]);ami[_0xce47('0x2c')](_0xce47('0xb6'),ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xb7')));if(_0x48844c[_0xce47('0xb8')]){ami[_0xce47('0x2c')](_0xce47('0xb9'),ut[_0xce47('0xba')](_0x4e78d7));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xce47('0xa5')](_0x4e78d7,'complete'));emitVoiceQueueChannelRemove(ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xbb')));_0x48844c[_0xce47('0x40')]+=0x1;_0x48844c['total']+=0x1;_0x48844c['answered']+=0x1;ut['decrementTalkink'](_0x48844c,'[16]');_0x4e78d7['countglobal']=ut[_0xce47('0xa2')](_0x4e78d7);ut['logCustomer'](_0x4e78d7,0x4,_0xce47('0xbc'));rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xbd'));rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xbe'));rpcDb[_0xce47('0xbf')](_0x4e78d7);_0x48844c['sumDuration']+=_0x4e78d7[_0xce47('0xc0')];_0x48844c[_0xce47('0xc1')]+=_0x4e78d7[_0xce47('0xc0')];logger[_0xce47('0x65')](_0xce47('0xc2'),_0x4e78d7['uniqueid'],'\x20Queue',_0x48844c['name'],_0xce47('0xb5'),_0x48844c['pTalking']);delete this['actions'][_0x4556ae[_0xce47('0xaf')]];break;case'BUSY':_0x48844c[_0xce47('0xc3')]+=0x1;_0x4e78d7['countbusyretry']+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut['totalGlobal'](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0x5,_0xce47('0xc4'));ami[_0xce47('0x2c')](_0xce47('0xc5'),ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xc6')));rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xc7'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,'Global');rpcDb[_0xce47('0x99')](_0x39ae13,_0xce47('0xc8'));}else{if(_0x4e78d7[_0xce47('0xc9')]>=_0x48844c[_0xce47('0xca')]){rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xc7'));}else{rpcDb[_0xce47('0xcb')](ut['scheduledAt'](_0x4e78d7,_0xce47('0xc9'),_0x48844c[_0xce47('0xcc')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7[_0xce47('0xae')]);}}break;case _0xce47('0xce'):_0x48844c['outboundNoAnswerCallsDay']+=0x1;_0x4e78d7[_0xce47('0xcf')]+=0x1;_0x4e78d7['countglobal']=ut[_0xce47('0xa2')](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0x3,_0xce47('0xd0'));ami[_0xce47('0x2c')](_0xce47('0xd1'),ut['buildObj'](_0x4e78d7,_0xce47('0xd2')));rpcDb[_0xce47('0x96')](_0x4e78d7,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c['dialGlobalMaxRetry']){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4e78d7[_0xce47('0xcf')]>=_0x48844c[_0xce47('0xd3')]){rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xd4'));}else{rpcDb[_0xce47('0xcb')](ut[_0xce47('0xac')](_0x4e78d7,_0xce47('0xcf'),_0x48844c[_0xce47('0xd5')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7[_0xce47('0xae')]);}}break;case'CONGESTION':_0x48844c[_0xce47('0x42')]+=0x1;_0x4e78d7['countcongestionretry']+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0x8,_0xce47('0xd6'));ami[_0xce47('0x2c')](_0xce47('0xd7'),ut[_0xce47('0xa5')](_0x4e78d7,'congestion'));rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xd8'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c['dialGlobalMaxRetry']){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,_0xce47('0xd9'));}else{if(_0x4e78d7['countcongestionretry']>=_0x48844c[_0xce47('0xda')]){rpcDb['createCustomerFinal'](_0x4e78d7,_0xce47('0xd8'));}else{rpcDb[_0xce47('0xcb')](ut[_0xce47('0xac')](_0x4e78d7,_0xce47('0xdb'),_0x48844c[_0xce47('0xcc')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7[_0xce47('0xae')]);}}break;case'CANCEL':_0x48844c[_0xce47('0x49')]+=0x1;_0x4e78d7[_0xce47('0xdc')]+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut['logCustomer'](_0x4e78d7,0x14,_0xce47('0xdd'));ami['emit'](_0xce47('0xde'),ut[_0xce47('0xa5')](_0x4e78d7,_0xce47('0xdf')));rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xe0'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0x14,'AgentReject');rpcDb[_0xce47('0x99')](_0x39ae13,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4e78d7[_0xce47('0xdc')]>=_0x48844c['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x4e78d7,_0xce47('0xe1'));}else{rpcDb[_0xce47('0xcb')](ut['scheduledAt'](_0x4e78d7,'countagentrejectretry',_0x48844c[_0xce47('0xe2')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7['activeContact']);}}break;case'ABANDONED':_0x48844c[_0xce47('0x4b')]+=0x1;_0x4e78d7[_0xce47('0xe3')]+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut[_0xce47('0x92')](_0x4e78d7,0xb,_0xce47('0xe4'));rpcDb['createCustomerHistory'](_0x4e78d7,_0xce47('0xe5'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut['cloneAction'](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,_0xce47('0xe5'));}else{if(_0x4e78d7['countabandonedetry']>=_0x48844c[_0xce47('0xe6')]){rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xe5'));}else{rpcDb[_0xce47('0xcb')](ut[_0xce47('0xac')](_0x4e78d7,'countabandonedretry',_0x48844c[_0xce47('0xe7')]),_0x4e78d7[_0xce47('0xcd')],_0x4e78d7[_0xce47('0xae')]);}}break;default:if(_0x4e78d7['dialAnswer']){ut['decrementTalkink'](_0x48844c,_0xce47('0xe8'));ut[_0xce47('0x86')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x48844c[_0xce47('0x2f')],_0x4556ae);}_0x48844c[_0xce47('0x4a')]+=0x1;_0x4e78d7[_0xce47('0xa1')]=ut[_0xce47('0xa2')](_0x4e78d7);ut['logCustomer'](_0x4e78d7,0xc,_0x4556ae[_0xce47('0xe9')]||_0x4556ae['dialstatus']);rpcDb[_0xce47('0x96')](_0x4e78d7,_0xce47('0xea'));if(ut[_0xce47('0xa2')](_0x4e78d7)>=_0x48844c[_0xce47('0xa7')]){_0x39ae13=ut[_0xce47('0xa8')](_0x4e78d7,0xf,_0xce47('0xa9'));rpcDb[_0xce47('0x99')](_0x39ae13,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xce47('0x99')](_0x4e78d7,_0xce47('0xeb'));}delete this[_0xce47('0x76')][_0x4556ae[_0xce47('0xaf')]];}if(!(_0x4e78d7['dialAnswer']&&_0x3c765f==='16')){ut[_0xce47('0xec')](_0x48844c,_0xce47('0xed'));logger[_0xce47('0x65')](_0xce47('0xee'),_0x4e78d7[_0xce47('0xb3')],_0xce47('0xb4'),_0x48844c[_0xce47('0x2f')],'originated:\x20',_0x48844c[_0xce47('0x57')]);}if(_0x3c765f!==_0xce47('0xb0')){delete this['actions'][_0x4556ae[_0xce47('0xaf')]];delete this[_0xce47('0x76')][_0x4556ae[_0xce47('0xef')]];}}};Preview[_0xce47('0x11')][_0xce47('0xf0')]=function(_0x53d986,_0x10a05f,_0x49cbc4){if(_['isUndefined'](_0x10a05f)&&'object'!==typeof _0x10a05f){return;}if(_[_0xce47('0xf1')](_0x49cbc4)&&_0xce47('0xf2')!==typeof _0x49cbc4){return;}switch(_0x49cbc4['reason']){case'0':ut['logAgent'](_0x53d986,0x0,_0xce47('0xa3'));rpcDb['createAgentHistory'](_0x53d986,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x53d986,0x3,_0xce47('0xd0'));rpcDb[_0xce47('0xf3')](_0x53d986,_0xce47('0xf4'));break;case'5':ut['logAgent'](_0x53d986,0x5,'Busy');rpcDb[_0xce47('0xf3')](_0x53d986,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xce47('0xf5')](_0x53d986,0x8,_0xce47('0xd6'));rpcDb[_0xce47('0xf3')](_0x53d986,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xce47('0xf5')](_0x53d986,0x16,_0xce47('0xf6'));rpcDb[_0xce47('0xf3')](_0x53d986,_0xce47('0xf7'));break;default:ut['logAgent'](_0x53d986,0xc,_0x49cbc4[_0xce47('0xf8')]);rpcDb[_0xce47('0xf3')](_0x53d986,_0xce47('0xf9'));}ut[_0xce47('0xec')](_0x10a05f,_0xce47('0xfa'));logger['info'](_0xce47('0xfb'),_0x53d986[_0xce47('0xb3')],_0xce47('0xb4'),_0x10a05f[_0xce47('0x2f')],_0xce47('0xfc'),_0x10a05f[_0xce47('0x57')]);delete this['actions'][_0x53d986[_0xce47('0xb3')]];};Preview['prototype']['checkInBlack']=function(_0x250dfd,_0x27d8be,_0x5e2b86,_0x3efba9,_0x32a9d5){var _0x230b28=this;return new BPromise(function(_0x4a01a4,_0xefecaa){if(_[_0xce47('0x75')](_0x27d8be)||_[_0xce47('0x75')](_0x27d8be[_0xce47('0xfd')])||_[_0xce47('0x75')](_0x27d8be[_0xce47('0xfd')][_0xce47('0xfe')])||_[_0xce47('0x75')](_0x27d8be['VoiceQueueId'])){_0xefecaa(ut[_0xce47('0x56')](_0xce47('0xff'),_0x3efba9,_0x32a9d5));return;}var _0x4aff99=uuid['v4']();var _0x6b3ed4=_0x230b28['campaignsPreview'][_0x27d8be[_0xce47('0x78')][_0xce47('0x2f')]];var _0xf39bfe=_0x5e2b86?_0x230b28[_0xce47('0x18')][_0x5e2b86]['id']:undefined;_0x230b28[_0xce47('0x76')][_0x4aff99]=new Action(_0x27d8be,_0x6b3ed4,_0x4aff99,_0x5e2b86,_0xf39bfe);var _0x462e29=_0x230b28[_0xce47('0x76')][_0x4aff99];_0x462e29[_0xce47('0xcd')]=_0x3efba9;_0x462e29[_0xce47('0xae')]=_0x32a9d5;_0x462e29['lookAgent']=_0x5e2b86;if(_[_0xce47('0x100')](_0x250dfd)){_0x230b28['execCall'](_0x462e29,_0x6b3ed4,_0x27d8be,_0x5e2b86)[_0xce47('0x8a')](function(_0x14b590){logger[_0xce47('0x65')](_0xce47('0x101'),'Queue:\x20'+_0x462e29[_0xce47('0x79')]+_0xce47('0x102')+_0x462e29[_0xce47('0x103')],JSON[_0xce47('0x61')](_0x14b590));ami['emit'](_0xce47('0x104'),ut['buildObj'](_0x462e29,_0xce47('0x105')));_0x4a01a4(ut['message'](_0xce47('0x106')));})['catch'](function(_0xa85363){ut['logger'](_0xce47('0x107'),_0xa85363);_0xefecaa(ut[_0xce47('0x56')](_0xce47('0x108'),_0x3efba9,_0x32a9d5));});}else{_0x6b3ed4[_0xce47('0x41')]+=0x1;ut[_0xce47('0x109')](_0x462e29);rpcDb[_0xce47('0x10a')](_0x462e29,_0xce47('0x10b'));delete _0x230b28['actions'][_0x4aff99];_0xefecaa(ut[_0xce47('0x56')](_0xce47('0x10c'),_0x3efba9,_0x32a9d5));}});};Preview[_0xce47('0x11')][_0xce47('0x9d')]=function(_0x2ca866){return!_['isNil'](_0x2ca866)&&!_[_0xce47('0x75')](_0x2ca866[_0xce47('0x2f')])&&!_[_0xce47('0x75')](_0x2ca866[_0xce47('0x5f')])&&_0x2ca866[_0xce47('0x5f')]&&!_[_0xce47('0x75')](this['trunks'][util[_0xce47('0x62')](_0xce47('0x10d'),_0x2ca866[_0xce47('0x2f')])])&&!_[_0xce47('0x75')](this[_0xce47('0x17')][util[_0xce47('0x62')](_0xce47('0x10d'),_0x2ca866[_0xce47('0x2f')])]['status'])&&(this['trunks'][util['format']('SIP/%s',_0x2ca866['name'])][_0xce47('0x10e')]===_0xce47('0x10f')||this[_0xce47('0x17')][util[_0xce47('0x62')](_0xce47('0x10d'),_0x2ca866[_0xce47('0x2f')])]['status']==='unmonitored');};Preview[_0xce47('0x11')][_0xce47('0x110')]=function(_0x5749b5,_0xcf16a7){var _0x284d45=this;return new BPromise(function(_0x1932c2,_0x12ae82){_0x284d45[_0xce47('0x111')](_0x5749b5,_0xcf16a7)['then'](function(_0xf05518){_0x1932c2(_[_0xce47('0x7b')](_0xf05518,[_0xce47('0x56')]));})[_0xce47('0x81')](function(_0x420794){if(_0x420794[_0xce47('0x112')]){rpcDb[_0xce47('0x113')](_0x5749b5);}if(_0x420794[_0xce47('0x5f')]){rpcDb[_0xce47('0x114')](_0x5749b5);}_0x12ae82(_[_0xce47('0x7b')](_0x420794,['message']));});});};Preview[_0xce47('0x11')][_0xce47('0x111')]=function(_0x569b0b,_0x252aaf){var _0x289b58=this;return new BPromise(function(_0x113cb1,_0x19d0e2){var _0x54f55a,_0x300745;rpcDb[_0xce47('0x115')](_0x569b0b)[_0xce47('0x8a')](function(_0x30c4f3){if(!_[_0xce47('0x75')](_0x30c4f3[0x0])){_0x300745=_0x30c4f3[0x0][_0xce47('0x116')]?![]:!![];_0x54f55a=_0x30c4f3[0x0][_0xce47('0x116')]?!![]:![];_0x54f55a=_0x252aaf?!![]:_0x54f55a;}var _0x13cf51=_0x289b58[_0xce47('0x117')](_0x30c4f3);if(_0x13cf51[_0xce47('0x118')]){rpcDb['checkIsBlackList'](_[_0xce47('0x7b')](_0x30c4f3[0x0],[_0xce47('0x7d'),_0xce47('0x119')]))[_0xce47('0x8a')](function(_0x5e0756){_0x289b58[_0xce47('0x11a')](_0x5e0756,_0x30c4f3[0x0],_0x252aaf,_0x300745,_0x54f55a)[_0xce47('0x8a')](function(_0x562fc8){_0x113cb1(_0x562fc8);})[_0xce47('0x81')](function(_0x437588){_0x19d0e2(_0x437588);});})['catch'](function(_0x41c067){ut[_0xce47('0x6b')](_0xce47('0x11b'),_0x41c067);_0x19d0e2(ut[_0xce47('0x56')]('Call\x20unsuccessful',_0x300745,_0x54f55a));});}else{_0x19d0e2(ut['message'](_0x13cf51['message'],_0x300745,_0x54f55a));}})[_0xce47('0x81')](function(_0x145eed){ut[_0xce47('0x6b')](_0xce47('0x11c'),_0x145eed);_0x19d0e2(ut[_0xce47('0x56')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xce47('0x11')][_0xce47('0x117')]=function(_0x1ca101){if(_[_0xce47('0x75')](_0x1ca101)||_['isEmpty'](_0x1ca101)||!_['isNil'](_0x1ca101[0x0][_0xce47('0x8d')])&&_['isNil'](_0x1ca101[0x0]['Agent'][_0xce47('0x2f')])){ut[_0xce47('0x6b')]('[Preview][validateContact][Empty\x20Contact]',_0x1ca101);return{'isValid':![],'message':_0xce47('0x11d')};}var _0x247f00=this[_0xce47('0x15')][_0x1ca101[0x0]['Queue'][_0xce47('0x2f')]];_0x247f00[_0xce47('0x56')]=_0xce47('0x9e');if(_[_0xce47('0x75')](_0x247f00)){ut['logger'](_0xce47('0x11e'),_0x247f00);return{'isValid':![],'message':_0xce47('0x11f')};}if(!this[_0xce47('0x9d')](_0x247f00[_0xce47('0x5e')])){ut['logger'](_0xce47('0x120'),'campaign\x20Name:\x20'+_0x247f00['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xce47('0x9d')](_0x247f00[_0xce47('0x121')])){ut[_0xce47('0x6b')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x247f00[_0xce47('0x2f')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xce47('0x122')};}}if(!ut[_0xce47('0x9c')](_0x247f00[_0xce47('0x3a')])){ut[_0xce47('0x6b')](_0xce47('0x123'),_0x247f00[_0xce47('0x2f')]+_0xce47('0x124'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x247f00[_0xce47('0x2f')]+_0xce47('0x124')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xce47('0x11')]['execCall']=function(_0x3f518b,_0x27228f,_0x1555d0,_0x5067d1){var _0x2ae0da=this;return new BPromise(function(_0x18f145,_0x338ff0){var _0x2ef21f=_0x3f518b[_0xce47('0xb3')];var _0x22d52b=_0x2ae0da['isTrunkReachable'](_0x27228f[_0xce47('0x5e')])?util[_0xce47('0x62')](_0xce47('0x125'),_0x27228f[_0xce47('0x5e')][_0xce47('0x2f')],_[_0xce47('0x75')](_0x27228f[_0xce47('0x3e')])?'':_0x27228f[_0xce47('0x3e')][_0xce47('0x126')]()||'',_0x27228f[_0xce47('0x127')]>0x0?_0x1555d0['Contact'][_0xce47('0xfe')][_0xce47('0x128')](_0x27228f[_0xce47('0x127')]):_0x1555d0[_0xce47('0xfd')][_0xce47('0xfe')]):util[_0xce47('0x62')](_0xce47('0x125'),_['isNil'](_0x27228f[_0xce47('0x121')])?_0x27228f['Trunk'][_0xce47('0x2f')]:_0x27228f[_0xce47('0x121')]['name'],_['isNil'](_0x27228f[_0xce47('0x3e')])?'':_0x27228f[_0xce47('0x3e')][_0xce47('0x126')]()||'',_0x27228f[_0xce47('0x127')]>0x0?_0x1555d0[_0xce47('0xfd')]['phone'][_0xce47('0x128')](_0x27228f[_0xce47('0x127')]):_0x1555d0[_0xce47('0xfd')]['phone']);var _0x388dcc=_0x2ae0da[_0xce47('0x9d')](_0x27228f[_0xce47('0x5e')])?ut['getCallerId'](_0x27228f[_0xce47('0x5e')][_0xce47('0x129')],_0x27228f[_0xce47('0x3c')],_0x27228f[_0xce47('0x12a')]>0x0?ut[_0xce47('0x12b')](_0x27228f[_0xce47('0x3d')],_0x27228f[_0xce47('0x12a')]):_0x27228f[_0xce47('0x3d')]):ut[_0xce47('0x12c')](_[_0xce47('0x75')](_0x27228f[_0xce47('0x121')])?_0x27228f[_0xce47('0x5e')]['callerid']:_0x27228f[_0xce47('0x121')][_0xce47('0x129')],_0x27228f[_0xce47('0x3c')],_0x27228f[_0xce47('0x12a')]>0x0?ut['getCallerIdRandom'](_0x27228f[_0xce47('0x3d')],_0x27228f[_0xce47('0x12a')]):_0x27228f[_0xce47('0x3d')]);if(_0x388dcc){_0x3f518b[_0xce47('0x12d')]=ut[_0xce47('0x12e')](_0x388dcc);_0x3f518b[_0xce47('0x12f')]=ut['extractCalleridNumber'](_0x388dcc);}var _0x28e259=ut['addVariables'](_0x27228f,_0x1555d0,_0x22d52b,_0x388dcc,_0x2ef21f,_0x3f518b);_[_0xce47('0x130')](_0x3f518b,ut[_0xce47('0x131')](_0x28e259));_0x3f518b['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0xce47('0x7f')](ut['variablesAction'](_0x3f518b,_0x27228f,_0x28e259,_0x3f518b[_0xce47('0xae')],_0x5067d1))[_0xce47('0x8a')](function(_0x45e1e2){_0x27228f[_0xce47('0x57')]+=0x1;logger['info'](_0xce47('0x132'),_0x2ef21f,_0xce47('0xb4'),_0x27228f[_0xce47('0x2f')],_0xce47('0xfc'),_0x27228f[_0xce47('0x57')]);_0x18f145(_0x45e1e2);})['catch'](function(_0x487ae9){ut[_0xce47('0xf5')](_0x3f518b,0xe,_0xce47('0x133'));rpcDb[_0xce47('0xf3')](_0x3f518b,_0xce47('0x134'));_0x338ff0(_0x487ae9);});});};Preview[_0xce47('0x11')]['syncNewExten']=function(_0x4553fb){if(this[_0xce47('0x76')][_0x4553fb[_0xce47('0xaf')]]){this[_0xce47('0x76')][_0x4553fb[_0xce47('0xaf')]][_0xce47('0x80')]=_0x4553fb[_0xce47('0x80')];}};Preview[_0xce47('0x11')]['syncOriginateResponse']=function(_0x67148f){var _0x606ad7=this;var _0x114438=this[_0xce47('0x76')][_0x67148f[_0xce47('0x135')]];if(_0x114438){if(_0x114438[_0xce47('0x136')]&&this[_0xce47('0x18')][_0x114438[_0xce47('0x136')]]){ut['logLookAgent'](_0x114438,this[_0xce47('0x18')][_0x114438[_0xce47('0x136')]][_0xce47('0x2f')],this['agents'][_0x114438['lookAgent']]['id']);}var _0x61d0f5=_[_0xce47('0x137')](_0x114438);_0x61d0f5[_0xce47('0xb1')]=moment()[_0xce47('0x62')](_0xce47('0x90'));var _0x1c5a53=_0x606ad7[_0xce47('0x15')][_0x114438[_0xce47('0x79')]];if(ut[_0xce47('0x138')](_0x67148f[_0xce47('0x139')])){if(_0x114438[_0xce47('0xcd')]){rpcDb[_0xce47('0x113')](_0x114438[_0xce47('0x103')]);}if(_0x114438[_0xce47('0xae')]){rpcDb[_0xce47('0x114')](_0x114438[_0xce47('0x103')]);}ami['emit'](_0xce47('0x13a'),ut[_0xce47('0xa5')](_0x114438,_0xce47('0x13b')));this[_0xce47('0xf0')](_0x61d0f5,_0x1c5a53,_0x67148f);}else{_0x114438[_0xce47('0x13c')]=moment()[_0xce47('0x62')](_0xce47('0x90'));ut[_0xce47('0xf5')](_0x61d0f5,0x4,_0xce47('0xbc'));rpcDb[_0xce47('0xf3')](_0x61d0f5,_0xce47('0x13d'));}}};Preview[_0xce47('0x11')]['syncHangup']=function(_0x5e8151){var _0x1a8786=this;var _0x1fc872=this[_0xce47('0x76')][_0x5e8151['linkedid']];var _0x56a399;if(_0x1fc872){_0x56a399=this[_0xce47('0x15')][_0x1fc872['queue']];logger[_0xce47('0x65')](_0xce47('0x13e'),_0x5e8151[_0xce47('0xaf')],_0xce47('0xb4'),_0x56a399[_0xce47('0x2f')],_0xce47('0xb5'),_0x56a399[_0xce47('0x68')]);}if(this[_0xce47('0x76')][_0x5e8151['linkedid']]&&_0x5e8151[_0xce47('0xaf')]!==_0x5e8151['uniqueid']){if(_0x5e8151[_0xce47('0x13f')]==='16'&&this[_0xce47('0x76')][_0x5e8151[_0xce47('0xaf')]][_0xce47('0x7a')]){this[_0xce47('0x9f')](_0x5e8151,_0x5e8151['linkedid'],_0x5e8151[_0xce47('0x13f')]);}else if(this['actions'][_0x5e8151['linkedid']][_0xce47('0x7a')]){logger[_0xce47('0x65')](_0xce47('0x140'),_0x5e8151[_0xce47('0xaf')],_0x5e8151[_0xce47('0x13f')],_0xce47('0xb4'),_0x56a399['name'],_0xce47('0xb5'),_0x56a399[_0xce47('0x68')]);this[_0xce47('0x9f')](_0x5e8151,_0x5e8151[_0xce47('0xaf')],_0x5e8151[_0xce47('0x13f')]);}}else if(_0x1fc872&&_[_0xce47('0x75')](_0x1fc872[_0xce47('0x141')])&&_0x56a399['dialQueueProject']&&_0x5e8151[_0xce47('0xaf')]===_0x5e8151[_0xce47('0xb3')]&&_[_0xce47('0x75')](_0x5e8151[_0xce47('0xf8')])&&_0x5e8151['cause']==='16'&&_0x5e8151[_0xce47('0x142')]==='6'&&_[_0xce47('0xf1')](_0x1fc872[_0xce47('0x143')])){if(_0x1fc872['unlockAgent']){rpcDb['unlockContact'](_0x1fc872['idContact']);}if(_0x1fc872[_0xce47('0xae')]){rpcDb[_0xce47('0x114')](_0x1fc872[_0xce47('0x103')]);}_0x5e8151[_0xce47('0xf8')]='22';this[_0xce47('0xf0')](_0x1fc872,_0x56a399,_0x5e8151);}else if(_0x1fc872&&_0x1fc872[_0xce47('0x143')]){if(_0x5e8151[_0xce47('0x13f')]==='16'&&this['actions'][_0x5e8151[_0xce47('0xaf')]][_0xce47('0x7a')]){logger['info']('[syncHangup][talking][transfer]',_0x5e8151[_0xce47('0xaf')],_0x5e8151[_0xce47('0x13f')],_0xce47('0xb4'),_0x56a399[_0xce47('0x2f')],_0xce47('0xb5'),_0x56a399[_0xce47('0x68')]);this[_0xce47('0x9f')](_0x5e8151,_0x5e8151[_0xce47('0xaf')],_0x5e8151[_0xce47('0x13f')]);}else if(this[_0xce47('0x76')][_0x5e8151[_0xce47('0xaf')]][_0xce47('0x7a')]){logger[_0xce47('0x65')](_0xce47('0x140'),_0x5e8151['linkedid'],_0x5e8151[_0xce47('0x13f')],_0xce47('0xb4'),_0x56a399[_0xce47('0x2f')],_0xce47('0xb5'),_0x56a399[_0xce47('0x68')]);this[_0xce47('0x9f')](_0x5e8151,_0x5e8151['linkedid'],_0x5e8151[_0xce47('0x13f')]);}}};Preview[_0xce47('0x11')][_0xce47('0x22')]=function(_0x4b8961){if(this[_0xce47('0x76')][_0x4b8961[_0xce47('0xef')]]&&_0x4b8961[_0xce47('0xef')]!==_0x4b8961[_0xce47('0x144')]){this['callProgressDetectingCustomer'](_0x4b8961,_0x4b8961[_0xce47('0xef')],_0x4b8961[_0xce47('0x145')]);}};Preview[_0xce47('0x11')][_0xce47('0x20')]=function(_0x457b80){if(this[_0xce47('0x76')][_0x457b80[_0xce47('0xaf')]]&&_0x457b80[_0xce47('0xaf')]!==_0x457b80[_0xce47('0xb3')]&&!this[_0xce47('0x76')][_0x457b80[_0xce47('0xaf')]]['dialAnswer']){if(_0x457b80['cause']==='1'){this[_0xce47('0x9f')](_0x457b80,_0x457b80[_0xce47('0xaf')],_0x457b80['cause']);}}};Preview[_0xce47('0x11')][_0xce47('0x146')]=function(_0xfca4f1,_0x7939b2,_0x2a0447){if(this[_0xce47('0x76')][_0xfca4f1]){if(_['isNil'](this[_0xce47('0x76')][_0xfca4f1]['variables'])){this['actions'][_0xfca4f1]['variables']={};}this['actions'][_0xfca4f1]['variables'][_0x7939b2]=_0x2a0447;}};Preview[_0xce47('0x11')][_0xce47('0x26')]=function(_0x53ab2f){try{if(!_[_0xce47('0x75')](_0x53ab2f)){if(ut['filterKey'](_[_0xce47('0x147')](_0x53ab2f['variable'])[0x0])){this[_0xce47('0x146')](_0x53ab2f[_0xce47('0xb3')],_['keys'](_0x53ab2f[_0xce47('0x148')])[0x0],_0x53ab2f[_0xce47('0x149')]);}}}catch(_0x2e1a74){logger['error'](_0xce47('0x14a'),util['inspect'](_0x2e1a74,{'showHidden':![],'depth':null}));}};Preview[_0xce47('0x11')][_0xce47('0x28')]=function(_0x46aa50){if(_0x46aa50){if(this[_0xce47('0x76')][_0x46aa50[_0xce47('0x14b')]]){this['actions'][_0x46aa50[_0xce47('0x14b')]][_0xce47('0x143')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x5d920a){if(_0x5d920a){if(this[_0xce47('0x76')][_0x5d920a['transfererlinkedid']]){this[_0xce47('0x76')][_0x5d920a[_0xce47('0x14c')]][_0xce47('0x143')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index cc01c59..7dbf6ed 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 _0xb4c7=['createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5b7ec6,_0x19e61f){_0x5b7ec6=_0x5b7ec6-0x0;var _0x13d2ef=_0xb4c7[_0x5b7ec6];return _0x13d2ef;};'use strict';var util=require(_0x7b4c('0x0'));var BPromise=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var _=require(_0x7b4c('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x7b4c('0x5'));var cmHopperHistory=require(_0x7b4c('0x6'));var cmHopperBlack=require(_0x7b4c('0x7'));var voiceQueueRt=require(_0x7b4c('0x8'));var agentReportPreview=require(_0x7b4c('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1b0f57){return function(_0x10e197){logger[_0x7b4c('0xa')](_0x1b0f57,util['inspect'](_0x10e197,{'showHidden':![],'depth':null}));};}function create(_0x2d7b7e){return BPromise[_0x7b4c('0xb')]()['then'](cmHopperHistory[_0x7b4c('0xc')](_0x2d7b7e))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0xe')));}function createAgent(_0x237e28){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](agentReportPreview[_0x7b4c('0xc')](_0x237e28))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0xe')));}function moveContact(_0x2adb51){return BPromise['resolve']()['then'](cmHopper[_0x7b4c('0x10')](_0x2adb51,!![]))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x11')));}exports[_0x7b4c('0x12')]=function(_0x3e1558){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopperBlack[_0x7b4c('0x12')](_0x3e1558))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x13')));};exports['getContactPreview']=function(_0x2edb77){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x14')](_0x2edb77))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x15')));};exports[_0x7b4c('0xc')]=function(_0x22c409,_0x4d3f5e){create(_0x22c409)[_0x7b4c('0xd')](loggerCatch(_0x4d3f5e));moveContact(_0x22c409)[_0x7b4c('0xd')](loggerCatch(_0x4d3f5e));};exports[_0x7b4c('0x16')]=function(_0x36c02a,_0x59ae96){createAgent(_0x36c02a)[_0x7b4c('0xd')](loggerCatch(_0x59ae96));};exports[_0x7b4c('0x17')]=function(_0x32110e,_0x380b79){create(_0x32110e)[_0x7b4c('0xd')](loggerCatch(_0x380b79));};exports[_0x7b4c('0x18')]=function(_0x237110,_0x445281){moveContact(_0x237110)[_0x7b4c('0xd')](loggerCatch(_0x445281));};exports['rescheduleContact']=function(_0x1f06ec,_0x331e24,_0x11996d){if(_0x331e24){_0x1f06ec[_0x7b4c('0x19')]=null;}if(_0x11996d){_0x1f06ec[_0x7b4c('0x1a')]=![];}return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1b')](_0x1f06ec))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x1c')));};exports['countReScheduled']=function(_0x45438c){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1d')](_0x45438c))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x1e')));};exports[_0x7b4c('0x1f')]=function(_0x459eb4){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1f')]({'UserId':null},_0x459eb4,0x1))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x20')));};exports['disableContact']=function(_0x27f361){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1f')]({'active':![]},_0x27f361,0x1))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x21')));};exports[_0x7b4c('0x22')]=function(_0x2552f9){var _0x3e4a46={};_0x3e4a46[_0x7b4c('0x23')]=_0x2552f9[_0x7b4c('0x23')];_0x3e4a46[_0x7b4c('0x24')]=_0x2552f9[_0x7b4c('0x24')];_0x3e4a46[_0x7b4c('0x25')]=_0x2552f9[_0x7b4c('0x25')];_0x3e4a46[_0x7b4c('0x26')]=_0x2552f9[_0x7b4c('0x26')];_0x3e4a46[_0x7b4c('0x27')]=_0x2552f9[_0x7b4c('0x27')];_0x3e4a46['queuecallerjoinAt']=_0x2552f9['answertime'];_0x3e4a46['queuecallerleaveAt']=_0x2552f9[_0x7b4c('0x28')];_0x3e4a46[_0x7b4c('0x29')]=0x1;_0x3e4a46[_0x7b4c('0x2a')]=_0x2552f9[_0x7b4c('0x2b')];_0x3e4a46['connectedlinename']=_0x2552f9[_0x7b4c('0x2c')];_0x3e4a46[_0x7b4c('0x2d')]='from-sip';_0x3e4a46[_0x7b4c('0x2e')]='xcally-motion-preview';_0x3e4a46[_0x7b4c('0x2f')]=0x0;_0x3e4a46[_0x7b4c('0x30')]=0x1;_0x3e4a46[_0x7b4c('0x31')]=_0x2552f9['membername'];_0x3e4a46[_0x7b4c('0x32')]=_0x7b4c('0x33');return BPromise['resolve']()[_0x7b4c('0xf')](voiceQueueReport[_0x7b4c('0x34')](_0x3e4a46))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x35')));};exports['getContactRecallMe']=function(_0x4d0355,_0x1325c1){return BPromise[_0x7b4c('0xb')]()['then'](cmHopper[_0x7b4c('0x36')](_0x4d0355,_0x1325c1))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7b4c('0x37')]=function(_0x16ae89){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper['rescheduleContact'](_0x16ae89,!![],!![]))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x38')));}; \ No newline at end of file +var _0x5636=['createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then'];(function(_0x3b6d58,_0xb29c70){var _0x64d7dc=function(_0x2ac5e4){while(--_0x2ac5e4){_0x3b6d58['push'](_0x3b6d58['shift']());}};_0x64d7dc(++_0xb29c70);}(_0x5636,0x102));var _0x6563=function(_0x5d560e,_0x197493){_0x5d560e=_0x5d560e-0x0;var _0x3072cd=_0x5636[_0x5d560e];return _0x3072cd;};'use strict';var util=require(_0x6563('0x0'));var BPromise=require(_0x6563('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require(_0x6563('0x2'));var cmHopperFinal=require(_0x6563('0x3'));var cmHopperHistory=require(_0x6563('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x6563('0x5'));var agentReportPreview=require(_0x6563('0x6'));var voiceQueueReport=require(_0x6563('0x7'));function loggerCatch(_0x39792f){return function(_0x29f687){logger[_0x6563('0x8')](_0x39792f,util[_0x6563('0x9')](_0x29f687,{'showHidden':![],'depth':null}));};}function create(_0x2d57d5){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopperHistory[_0x6563('0xc')](_0x2d57d5))[_0x6563('0xd')](loggerCatch(_0x6563('0xe')));}function createAgent(_0x516d1a){return BPromise['resolve']()[_0x6563('0xb')](agentReportPreview[_0x6563('0xc')](_0x516d1a))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5da960){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopper[_0x6563('0xf')](_0x5da960,!![]))[_0x6563('0xd')](loggerCatch(_0x6563('0x10')));}exports[_0x6563('0x11')]=function(_0x31d3fa){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopperBlack['checkIsBlackList'](_0x31d3fa))[_0x6563('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x6563('0x12')]=function(_0x59bee1){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopper['getContactPreview'](_0x59bee1))[_0x6563('0xd')](loggerCatch(_0x6563('0x13')));};exports[_0x6563('0xc')]=function(_0xd398ce,_0x4e7282){create(_0xd398ce)[_0x6563('0xd')](loggerCatch(_0x4e7282));moveContact(_0xd398ce)['catch'](loggerCatch(_0x4e7282));};exports['createAgentHistory']=function(_0x47972a,_0x14c6a6){createAgent(_0x47972a)['catch'](loggerCatch(_0x14c6a6));};exports['createCustomerHistory']=function(_0x27651b,_0x344f60){create(_0x27651b)[_0x6563('0xd')](loggerCatch(_0x344f60));};exports[_0x6563('0x14')]=function(_0xf8b544,_0x10811d){moveContact(_0xf8b544)[_0x6563('0xd')](loggerCatch(_0x10811d));};exports[_0x6563('0x15')]=function(_0x2a70f0,_0x5bf608,_0x2f2905){if(_0x5bf608){_0x2a70f0[_0x6563('0x16')]=null;}if(_0x2f2905){_0x2a70f0[_0x6563('0x17')]=![];}return BPromise['resolve']()[_0x6563('0xb')](cmHopper['rescheduleContact'](_0x2a70f0))[_0x6563('0xd')](loggerCatch(_0x6563('0x18')));};exports['countReScheduled']=function(_0x5773e2){return BPromise[_0x6563('0xa')]()['then'](cmHopper[_0x6563('0x19')](_0x5773e2))[_0x6563('0xd')](loggerCatch(_0x6563('0x1a')));};exports['unlockContact']=function(_0xd860d5){return BPromise['resolve']()[_0x6563('0xb')](cmHopper[_0x6563('0x1b')]({'UserId':null},_0xd860d5,0x1))['catch'](loggerCatch(_0x6563('0x1c')));};exports[_0x6563('0x1d')]=function(_0x49a824){return BPromise[_0x6563('0xa')]()['then'](cmHopper[_0x6563('0x1b')]({'active':![]},_0x49a824,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x6563('0x1e')]=function(_0x118d31){var _0x17326c={};_0x17326c[_0x6563('0x1f')]=_0x118d31[_0x6563('0x1f')];_0x17326c['uniqueid']=_0x118d31[_0x6563('0x20')];_0x17326c['calleridnum']=_0x118d31['calleridnum'];_0x17326c[_0x6563('0x21')]=_0x118d31[_0x6563('0x21')];_0x17326c[_0x6563('0x22')]=_0x118d31[_0x6563('0x22')];_0x17326c[_0x6563('0x23')]=_0x118d31[_0x6563('0x24')];_0x17326c[_0x6563('0x25')]=_0x118d31[_0x6563('0x24')];_0x17326c[_0x6563('0x26')]=0x1;_0x17326c[_0x6563('0x27')]=_0x118d31['endtime'];_0x17326c[_0x6563('0x28')]=_0x118d31[_0x6563('0x29')];_0x17326c[_0x6563('0x2a')]=_0x6563('0x2b');_0x17326c[_0x6563('0x2c')]=_0x6563('0x2d');_0x17326c[_0x6563('0x2e')]=0x0;_0x17326c['assigned']=0x1;_0x17326c[_0x6563('0x2f')]=_0x118d31[_0x6563('0x29')];_0x17326c[_0x6563('0x30')]=_0x6563('0x31');return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](voiceQueueReport['create'](_0x17326c))[_0x6563('0xd')](loggerCatch(_0x6563('0x32')));};exports[_0x6563('0x33')]=function(_0x33aa0b,_0x2c03ac){return BPromise[_0x6563('0xa')]()[_0x6563('0xb')](cmHopper['getContactRecallMe'](_0x33aa0b,_0x2c03ac))[_0x6563('0xd')](loggerCatch(_0x6563('0x34')));};exports['rescheduleContactInQueue']=function(_0xf6b446){return BPromise[_0x6563('0xa')]()['then'](cmHopper['rescheduleContact'](_0xf6b446,!![],!![]))[_0x6563('0xd')](loggerCatch(_0x6563('0x35')));}; \ 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 a191d88..6ecba13 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 _0x4201=['calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','ringtime','responsetime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','Failure','RECALL','BOOKED','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','queue','buildAcw','interface','uniqueid','agentReadyId','status','reachable','push','getDiff','ListId','CampaignId','filterKey','type','campaigntype','countglobal','callback','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','logger','info','inspect','logger2','getCallerId','isUndefined','format','\x22%s\x22\x20<%s>','string','isEmpty','\x22\x22\x20<>','isNil','addVariables','Queue','name'];(function(_0x487d93,_0x1443b2){var _0xa6ba2a=function(_0x6dfbb9){while(--_0x6dfbb9){_0x487d93['push'](_0x487d93['shift']());}};_0xa6ba2a(++_0x1443b2);}(_0x4201,0x71));var _0x1420=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x4201[_0x31a576];return _0x30b1d3;};'use strict';var util=require(_0x1420('0x0'));var _=require(_0x1420('0x1'));var moment=require('moment');var logger=require(_0x1420('0x2'))(_0x1420('0x3'));var ipAgi=process[_0x1420('0x4')][_0x1420('0x5')]||_0x1420('0x6');function getSeconds(_0x43d008,_0x59088c){var _0x485039=moment(_0x43d008)[_0x1420('0x7')](0x0);var _0x25590c=moment(_0x59088c)[_0x1420('0x7')](0x0);return _0x485039[_0x1420('0x8')](_0x25590c,_0x1420('0x9'));}exports['loggerCatch']=function(_0x5a925c){return function(_0x46d303){logger[_0x1420('0xa')](_0x5a925c,util['inspect'](_0x46d303,{'showHidden':![],'depth':null}));};};exports[_0x1420('0xb')]=function(_0x53199d,_0x4d8d95){logger[_0x1420('0xc')](_0x53199d,util[_0x1420('0xd')](_0x4d8d95,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x351778,_0x1a05fd){logger[_0x1420('0xa')](_0x351778,util[_0x1420('0xd')](_0x1a05fd,{'showHidden':![],'depth':null}));};exports[_0x1420('0xe')]=function(_0x1d1041){return function(_0x2435f4){logger[_0x1420('0xc')](_0x1d1041,util['inspect'](_0x2435f4,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x50cf50,_0x53c03d,_0x466d30){return{'message':_0x50cf50,'unlock':_0x53c03d,'active':_0x466d30};};exports[_0x1420('0xf')]=function(_0x121f70,_0x3b8e01,_0x3bc499){if(!_[_0x1420('0x10')](_0x3bc499)&&'string'===typeof _0x3bc499&&!_['isEmpty'](_0x3bc499)){if(!_[_0x1420('0x10')](_0x3b8e01)&&'string'===typeof _0x3b8e01&&!_['isEmpty'](_0x3b8e01)){return util[_0x1420('0x11')](_0x1420('0x12'),_0x3b8e01,_0x3bc499);}return util[_0x1420('0x11')](_0x1420('0x12'),_0x3bc499,_0x3bc499);}if(!_['isUndefined'](_0x121f70)&&_0x1420('0x13')===typeof _0x121f70&&!_[_0x1420('0x14')](_0x121f70)){return _0x121f70;}return _0x1420('0x15');};exports['isActive']=function(_0x261589){if(_[_0x1420('0x16')](_0x261589)){return![];}return _0x261589;};exports[_0x1420('0x17')]=function(_0x310454,_0x4f3c6b,_0x5535c0,_0x410abb,_0x5c6237,_0x278e77){var _0x3ca369={'XMD-QUEUE':_0x4f3c6b[_0x1420('0x18')]?_0x4f3c6b[_0x1420('0x18')][_0x1420('0x19')]:'','XMD-CALLERID':_0x410abb,'XMD-CALLERID-PREVIEW':_0x278e77?util['format'](_0x1420('0x12'),_0x278e77[_0x1420('0x1a')],_0x278e77[_0x1420('0x1b')]):_0x410abb,'XMD-DIALID':_0x5c6237,'XMD-CONTACTID':_0x4f3c6b[_0x1420('0x1c')],'XMD-CDRTYPE':_0x1420('0x1d'),'CALLERID(all)':_0x410abb,'XMD-VOICEQUEUEID':_0x4f3c6b[_0x1420('0x1e')],'XMD-DIALCHANNEL':_0x5535c0,'XMD-DIALTIMEOUT':_0x310454['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x310454[_0x1420('0x1f')]?'g':'',_[_0x1420('0x14')](_0x310454[_0x1420('0x20')])?'':_0x1420('0x21')),'XMD-DIALURL':_0x310454[_0x1420('0x22')]||'','XMD-AGI':_0x310454['dialQueueProject']?util['format'](_0x1420('0x23'),ipAgi,_0x310454[_0x1420('0x24')]):_0x1420('0x25'),'XMD-AGIAFTER':_0x310454[_0x1420('0x1f')]?util[_0x1420('0x11')](_0x1420('0x23'),ipAgi,_0x310454['dialQueueProject2']):_0x1420('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x278e77?_0x278e77[_0x1420('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x278e77?_0x278e77[_0x1420('0x27')]:'','XMD-DESTINATION':_0x1420('0x28')};if(!_['isEmpty'](_0x310454[_0x1420('0x20')])){_0x3ca369[util[_0x1420('0x11')]('%s',_0x1420('0x29'))]=_0x310454[_0x1420('0x20')];_0x3ca369[util['format']('%s',_0x1420('0x2a'))]=_0x5c6237;}if(_0x4f3c6b&&_0x4f3c6b[_0x1420('0x2b')]){for(var _0x8c3e84 in _0x4f3c6b[_0x1420('0x2b')]){if(_0x4f3c6b[_0x1420('0x2b')][_0x1420('0x2c')](_0x8c3e84)){if(!_[_0x1420('0x16')](_0x4f3c6b[_0x1420('0x2b')][_0x8c3e84])&&_0x8c3e84!=='id'&&_0x8c3e84!==_0x1420('0x2d')&&_0x8c3e84!==_0x1420('0x2e')&&_0x8c3e84!==_0x1420('0x2f')){_0x3ca369[util[_0x1420('0x11')]('%s%s',_0x1420('0x30'),_[_0x1420('0x31')](_0x8c3e84))]=_0x4f3c6b[_0x1420('0x2b')][_0x8c3e84];}}}}return _0x3ca369;};exports[_0x1420('0x32')]=function(_0x17873d){var _0x584f11={};for(var _0x2a812b in _0x17873d){if(_0x17873d[_0x1420('0x2c')](_0x2a812b)){_0x584f11[util['format']('%s',_[_0x1420('0x33')](_0x2a812b))]=_0x17873d[_0x2a812b];}}return{'variables':_0x584f11};};exports['updateOriginated']=function(_0x5a5066,_0x481ede){if(!_[_0x1420('0x16')](_0x5a5066)){if(_0x5a5066[_0x1420('0x2c')](_0x1420('0x34'))){if(_0x5a5066[_0x1420('0x34')]>0x0){_0x5a5066[_0x1420('0x34')]-=0x1;}else{logger[_0x1420('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x481ede);}}}else{logger[_0x1420('0xa')](_0x1420('0x35'),_0x481ede);}};exports['logBlacklist']=function(_0x940f8f){var _0x93bf5f=moment()[_0x1420('0x11')](_0x1420('0x36'));_0x940f8f[_0x1420('0x37')]=0xd;_0x940f8f[_0x1420('0x38')]=_0x1420('0x39');_0x940f8f[_0x1420('0x3a')]=_0x93bf5f;_0x940f8f['responsetime']=_0x93bf5f;_0x940f8f[_0x1420('0x3b')]=_0x93bf5f;};exports[_0x1420('0x3c')]=function(_0x3cddad,_0x156d15,_0x3b6f53){var _0x5c2cd4=moment()[_0x1420('0x11')](_0x1420('0x36'));_0x3cddad[_0x1420('0x37')]=_0x156d15;_0x3cddad[_0x1420('0x38')]=_0x3b6f53;_0x3cddad['responsetime']=_0x5c2cd4;_0x3cddad[_0x1420('0x3d')]=getSeconds(_0x3cddad[_0x1420('0x3e')],_0x3cddad[_0x1420('0x3a')]);};exports[_0x1420('0x3f')]=function(_0x1a9a6a,_0x5e88f5,_0x4e6f7c){_0x1a9a6a[_0x1420('0x40')]=_0x5e88f5;_0x1a9a6a[_0x1420('0x41')]=_0x4e6f7c;};exports[_0x1420('0x42')]=function(_0x29b19f,_0x52e8e1,_0x12e2eb){var _0x4d0957=moment()[_0x1420('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x29b19f['state']=_0x52e8e1;_0x29b19f[_0x1420('0x38')]=_0x12e2eb;_0x29b19f['responsetime']=_0x29b19f['responsetime']?_0x29b19f[_0x1420('0x3e')]:_0x4d0957;_0x29b19f[_0x1420('0x3b')]=_0x29b19f[_0x1420('0x3b')]?_0x29b19f['endtime']:_0x4d0957;_0x29b19f[_0x1420('0x3d')]=getSeconds(_0x29b19f['responsetime']||0x0,_0x29b19f['starttime']||0x0);_0x29b19f[_0x1420('0x43')]=_0x29b19f[_0x1420('0x44')]?getSeconds(_0x29b19f[_0x1420('0x3b')],_0x29b19f['answertime']):0x0;};exports['isFailure']=function(_0x2f2f77){return _0x2f2f77===_0x1420('0x45');};exports['variablesAction']=function(_0x315bfb,_0x2bbd5e,_0x20a2df,_0x1441e1,_0x4e5cb6){var _0x3ecee5=_0x1441e1?_0x1420('0x46'):_0x315bfb[_0x1420('0x1a')];_0x3ecee5=_0x4e5cb6?_0x1420('0x47'):_0x3ecee5;return{'actionid':_0x315bfb['uniqueid'],'action':_0x1420('0x48'),'channel':_0x315bfb[_0x1420('0x49')],'callerid':util[_0x1420('0x11')]('\x22%s\x22\x20<%s>',_0x3ecee5,_0x315bfb['calleridnum']),'Exten':_0x1420('0x28'),'Context':_0x1420('0x4a'),'Priority':'1','variable':_0x20a2df,'timeout':(_0x2bbd5e['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x315bfb['uniqueid']};};exports[_0x1420('0x4b')]=function(_0x211936){return _0x211936[_0x1420('0x4c')]+_0x211936[_0x1420('0x4d')]+_0x211936[_0x1420('0x4e')]+_0x211936['countagentrejectretry']+_0x211936[_0x1420('0x4f')];};exports[_0x1420('0x50')]=function(_0x2c7542){var _0x45f824=_[_0x1420('0x51')](_0x2c7542);_0x45f824['state']=0xf;_0x45f824[_0x1420('0x38')]=_0x1420('0x52');return _0x45f824;};exports[_0x1420('0x53')]=function(_0x2ee8c5,_0xaae370,_0x5f2106){var _0x5a2bcd={};_0x5a2bcd[_0xaae370]=_0x2ee8c5[_0xaae370];_0x5a2bcd[_0x1420('0x54')]=![];_0x5a2bcd[_0x1420('0x55')]=moment()[_0x1420('0x56')](_0x5f2106,_0x1420('0x57'))[_0x1420('0x11')](_0x1420('0x36'));_0x5a2bcd[_0x1420('0x1c')]=_0x2ee8c5[_0x1420('0x1c')];_0x5a2bcd['ListId']=_0x2ee8c5['ListId'];_0x5a2bcd[_0x1420('0x1e')]=_0x2ee8c5[_0x1420('0x1e')]||undefined;return _0x5a2bcd;};exports[_0x1420('0x58')]=function(_0x435d38,_0x2aa561){if(!_[_0x1420('0x16')](_0x435d38)){if(_0x435d38[_0x1420('0x59')]>0x0){_0x435d38[_0x1420('0x59')]-=0x1;}else{logger[_0x1420('0xa')](_0x2aa561,_0x1420('0x5a'));}}else{logger[_0x1420('0xa')](_0x2aa561,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x1420('0x5b')]=function(_0x25370e){if(_0x25370e<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1a4c5f,_0x2c5d62){_0x1a4c5f['lastevent']=_0x2c5d62;_0x1a4c5f[_0x1420('0x19')]=_0x1a4c5f[_0x1420('0x5c')];_0x1a4c5f['interface']=_0x1a4c5f['channelAgent'];return _0x1a4c5f;};exports[_0x1420('0x5d')]=function(_0x53672d){var _0x593de1={};_0x593de1[_0x1420('0x5c')]=_0x53672d[_0x1420('0x5c')];_0x593de1[_0x1420('0x5e')]=_0x53672d[_0x1420('0x49')];_0x593de1[_0x1420('0x5f')]=_0x53672d[_0x1420('0x5f')];return _0x593de1;};exports[_0x1420('0x60')]=function(_0x16426a){var _0x376768=[];for(var _0x784190 in _0x16426a){if(_0x16426a[_0x1420('0x2c')](_0x784190)){if(!_[_0x1420('0x16')](_0x16426a[_0x784190])&&_0x16426a[_0x784190]['state']==='not_inuse'&&_0x16426a[_0x784190][_0x1420('0x61')]===_0x1420('0x62')){_0x376768[_0x1420('0x63')](_0x16426a[_0x784190]['id']);}}}return _0x376768;};exports[_0x1420('0x64')]=function(_0x508ec9){var _0x184d63=moment()[_0x1420('0x7')](0x0);var _0x15f539=moment(_0x508ec9)[_0x1420('0x7')](0x0);return _0x184d63[_0x1420('0x8')](_0x15f539,'seconds');};exports['createBody']=function(_0x5ca065){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5ca065[_0x1420('0x1c')],'ListId':_0x5ca065[_0x1420('0x65')],'VoiceQueueId':_0x5ca065[_0x1420('0x1e')]||undefined,'CampaignId':_0x5ca065[_0x1420('0x66')]||undefined};};exports[_0x1420('0x67')]=function(_0x355c5c){if(_0x355c5c===_0x1420('0x5f')||_0x355c5c==='idContact'||_0x355c5c===_0x1420('0x5c')||_0x355c5c===_0x1420('0x68')||_0x355c5c===_0x1420('0x69')||_0x355c5c==='dialAnswer'||_0x355c5c===_0x1420('0x40')||_0x355c5c===_0x1420('0x49')||_0x355c5c===_0x1420('0x1a')||_0x355c5c===_0x1420('0x54')||_0x355c5c==='calleridnum'||_0x355c5c===_0x1420('0x55')||_0x355c5c===_0x1420('0x4c')||_0x355c5c===_0x1420('0x4d')||_0x355c5c==='countnoanswerretry'||_0x355c5c===_0x1420('0x6a')||_0x355c5c===_0x1420('0x6b')||_0x355c5c==='callbackuniqueid'||_0x355c5c===_0x1420('0x6c')||_0x355c5c===_0x1420('0x6d')||_0x355c5c===_0x1420('0x1c')||_0x355c5c==='ListId'||_0x355c5c===_0x1420('0x41')||_0x355c5c==='VoiceQueueId'||_0x355c5c===_0x1420('0x6e')||_0x355c5c==='xmd-voicequeueid'||_0x355c5c===_0x1420('0x6f')||_0x355c5c===_0x1420('0x70')||_0x355c5c===_0x1420('0x71')||_0x355c5c===_0x1420('0x72')||_0x355c5c===_0x1420('0x73')||_0x355c5c===_0x1420('0x74')||_0x355c5c==='xmd-dialid'||_0x355c5c===_0x1420('0x75')||_0x355c5c===_0x1420('0x76')||_0x355c5c===_0x1420('0x77')||_0x355c5c===_0x1420('0x78')||_0x355c5c===_0x1420('0x79')||_0x355c5c==='xmd-agi'||_0x355c5c===_0x1420('0x7a')||_0x355c5c===_0x1420('0x7b')||_0x355c5c===_0x1420('0x7c')||_0x355c5c==='rtpaudioqosjitterbridged'||_0x355c5c===_0x1420('0x7d')||_0x355c5c===_0x1420('0x7e')||_0x355c5c===_0x1420('0x7f')||_0x355c5c===_0x1420('0x80')||_0x355c5c==='rtpaudioqos'||_0x355c5c===_0x1420('0x7b')||_0x355c5c===_0x1420('0x7c')||_0x355c5c==='rtpaudioqosjitterbridged'||_0x355c5c==='rtpaudioqosloss'||_0x355c5c==='rtpaudioqoslossbridged'||_0x355c5c===_0x1420('0x7f')||_0x355c5c===_0x1420('0x80')||_0x355c5c===_0x1420('0x81')||_0x355c5c===_0x1420('0x82')||_0x355c5c===_0x1420('0x37')||_0x355c5c===_0x1420('0x38')){return![];}return!![];};exports[_0x1420('0x83')]=function(_0xa191f0,_0x2ae692){var _0x4eccb3,_0x5f1a2a,_0x274c02;if(_0x2ae692<=0x0){_0x2ae692=0x1;}_0x4eccb3=new RegExp(_0x1420('0x84')+_0x2ae692+'}$');_0x5f1a2a=Math[_0x1420('0x85')](0xa,_0x2ae692-0x1);_0x274c02=Math['pow'](0xa,_0x2ae692)-0x1;return util[_0x1420('0x11')]('%s',_[_0x1420('0x86')](_0xa191f0,_0x4eccb3,_[_0x1420('0x87')](_0x5f1a2a,_0x274c02)));};exports[_0x1420('0x88')]=function(_0x518214){var _0x744dc4=_0x518214['match'](/"(.*?)"/);return _0x744dc4?_0x744dc4[0x1]:_0x518214;};exports[_0x1420('0x89')]=function(_0x2a5dbd){var _0x84f03=_0x2a5dbd[_0x1420('0x8a')](/<(.*?)>/);return _0x84f03?_0x84f03[0x1]:_0x2a5dbd;}; \ No newline at end of file +var _0xcdd2=['util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','info','loggerError','error','logger2','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','ringtime','responsetime','membername','UserId','logCustomer','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','lastevent','name','queue','interface','buildAcw','not_inuse','VoiceQueueId','CampaignId','filterKey','idContact','type','dialAnswer','countcongestionretry','countglobal','callbackuniqueid','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber'];(function(_0x243087,_0x14e197){var _0x3c7b95=function(_0x114da0){while(--_0x114da0){_0x243087['push'](_0x243087['shift']());}};_0x3c7b95(++_0x14e197);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x2cdd('0x0'));var _=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var logger=require(_0x2cdd('0x3'))('preview');var ipAgi=process[_0x2cdd('0x4')][_0x2cdd('0x5')]||_0x2cdd('0x6');function getSeconds(_0x2b63a4,_0x5d1626){var _0x42dbf8=moment(_0x2b63a4)[_0x2cdd('0x7')](0x0);var _0x5f3b53=moment(_0x5d1626)[_0x2cdd('0x7')](0x0);return _0x42dbf8[_0x2cdd('0x8')](_0x5f3b53,_0x2cdd('0x9'));}exports[_0x2cdd('0xa')]=function(_0x506b09){return function(_0x569943){logger['error'](_0x506b09,util[_0x2cdd('0xb')](_0x569943,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x12cdca,_0x3e3cf0){logger[_0x2cdd('0xc')](_0x12cdca,util[_0x2cdd('0xb')](_0x3e3cf0,{'showHidden':![],'depth':null}));};exports[_0x2cdd('0xd')]=function(_0xa4b1b8,_0x315b10){logger[_0x2cdd('0xe')](_0xa4b1b8,util[_0x2cdd('0xb')](_0x315b10,{'showHidden':![],'depth':null}));};exports[_0x2cdd('0xf')]=function(_0x4a808b){return function(_0x53ea0b){logger[_0x2cdd('0xc')](_0x4a808b,util[_0x2cdd('0xb')](_0x53ea0b,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x500f4c,_0x2557b9,_0x345b45){return{'message':_0x500f4c,'unlock':_0x2557b9,'active':_0x345b45};};exports[_0x2cdd('0x10')]=function(_0x4093f,_0x5934bd,_0x367111){if(!_[_0x2cdd('0x11')](_0x367111)&&'string'===typeof _0x367111&&!_[_0x2cdd('0x12')](_0x367111)){if(!_[_0x2cdd('0x11')](_0x5934bd)&&_0x2cdd('0x13')===typeof _0x5934bd&&!_[_0x2cdd('0x12')](_0x5934bd)){return util[_0x2cdd('0x14')](_0x2cdd('0x15'),_0x5934bd,_0x367111);}return util['format'](_0x2cdd('0x15'),_0x367111,_0x367111);}if(!_[_0x2cdd('0x11')](_0x4093f)&&_0x2cdd('0x13')===typeof _0x4093f&&!_[_0x2cdd('0x12')](_0x4093f)){return _0x4093f;}return'\x22\x22\x20<>';};exports[_0x2cdd('0x16')]=function(_0x204543){if(_[_0x2cdd('0x17')](_0x204543)){return![];}return _0x204543;};exports[_0x2cdd('0x18')]=function(_0x3056e7,_0x871fd2,_0x2b0691,_0x442c18,_0x3dc9ec,_0x127179){var _0x5ac9d3={'XMD-QUEUE':_0x871fd2['Queue']?_0x871fd2[_0x2cdd('0x19')]['name']:'','XMD-CALLERID':_0x442c18,'XMD-CALLERID-PREVIEW':_0x127179?util['format'](_0x2cdd('0x15'),_0x127179[_0x2cdd('0x1a')],_0x127179[_0x2cdd('0x1b')]):_0x442c18,'XMD-DIALID':_0x3dc9ec,'XMD-CONTACTID':_0x871fd2[_0x2cdd('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x442c18,'XMD-VOICEQUEUEID':_0x871fd2['VoiceQueueId'],'XMD-DIALCHANNEL':_0x2b0691,'XMD-DIALTIMEOUT':_0x3056e7[_0x2cdd('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x2cdd('0x14')](_0x2cdd('0x1e'),_0x3056e7[_0x2cdd('0x1f')]?'g':'',_[_0x2cdd('0x12')](_0x3056e7[_0x2cdd('0x20')])?'':_0x2cdd('0x21')),'XMD-DIALURL':_0x3056e7['dialPreviewUrl']||'','XMD-AGI':_0x3056e7[_0x2cdd('0x22')]?util[_0x2cdd('0x14')](_0x2cdd('0x23'),ipAgi,_0x3056e7['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x3056e7['dialQueueProject2']?util[_0x2cdd('0x14')](_0x2cdd('0x23'),ipAgi,_0x3056e7['dialQueueProject2']):_0x2cdd('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x127179?_0x127179[_0x2cdd('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x127179?_0x127179[_0x2cdd('0x26')]:'','XMD-DESTINATION':_0x2cdd('0x27')};if(!_[_0x2cdd('0x12')](_0x3056e7[_0x2cdd('0x20')])){_0x5ac9d3[util['format']('%s',_0x2cdd('0x28'))]=_0x3056e7[_0x2cdd('0x20')];_0x5ac9d3[util[_0x2cdd('0x14')]('%s',_0x2cdd('0x29'))]=_0x3dc9ec;}if(_0x871fd2&&_0x871fd2['Contact']){for(var _0x447051 in _0x871fd2[_0x2cdd('0x2a')]){if(_0x871fd2['Contact'][_0x2cdd('0x2b')](_0x447051)){if(!_[_0x2cdd('0x17')](_0x871fd2[_0x2cdd('0x2a')][_0x447051])&&_0x447051!=='id'&&_0x447051!==_0x2cdd('0x2c')&&_0x447051!==_0x2cdd('0x2d')&&_0x447051!==_0x2cdd('0x2e')){_0x5ac9d3[util[_0x2cdd('0x14')](_0x2cdd('0x2f'),_0x2cdd('0x30'),_['toUpper'](_0x447051))]=_0x871fd2[_0x2cdd('0x2a')][_0x447051];}}}}return _0x5ac9d3;};exports[_0x2cdd('0x31')]=function(_0x3701f5){var _0x5a0fb4={};for(var _0x53fe46 in _0x3701f5){if(_0x3701f5['hasOwnProperty'](_0x53fe46)){_0x5a0fb4[util[_0x2cdd('0x14')]('%s',_[_0x2cdd('0x32')](_0x53fe46))]=_0x3701f5[_0x53fe46];}}return{'variables':_0x5a0fb4};};exports['updateOriginated']=function(_0x6c7f28,_0x3366dc){if(!_[_0x2cdd('0x17')](_0x6c7f28)){if(_0x6c7f28[_0x2cdd('0x2b')](_0x2cdd('0x33'))){if(_0x6c7f28['originated']>0x0){_0x6c7f28['originated']-=0x1;}else{logger[_0x2cdd('0xe')](_0x2cdd('0x34'),_0x3366dc);}}}else{logger[_0x2cdd('0xe')](_0x2cdd('0x35'),_0x3366dc);}};exports[_0x2cdd('0x36')]=function(_0x49a484){var _0x1db75a=moment()[_0x2cdd('0x14')](_0x2cdd('0x37'));_0x49a484[_0x2cdd('0x38')]=0xd;_0x49a484[_0x2cdd('0x39')]=_0x2cdd('0x3a');_0x49a484[_0x2cdd('0x3b')]=_0x1db75a;_0x49a484['responsetime']=_0x1db75a;_0x49a484[_0x2cdd('0x3c')]=_0x1db75a;};exports[_0x2cdd('0x3d')]=function(_0x2f8e8c,_0x42cbd7,_0x296359){var _0x113d5d=moment()[_0x2cdd('0x14')](_0x2cdd('0x37'));_0x2f8e8c[_0x2cdd('0x38')]=_0x42cbd7;_0x2f8e8c['statedesc']=_0x296359;_0x2f8e8c['responsetime']=_0x113d5d;_0x2f8e8c[_0x2cdd('0x3e')]=getSeconds(_0x2f8e8c[_0x2cdd('0x3f')],_0x2f8e8c[_0x2cdd('0x3b')]);};exports['logLookAgent']=function(_0x45e423,_0x59e7d8,_0x573bd4){_0x45e423[_0x2cdd('0x40')]=_0x59e7d8;_0x45e423[_0x2cdd('0x41')]=_0x573bd4;};exports[_0x2cdd('0x42')]=function(_0x721f29,_0xe00767,_0x2414bd){var _0x4388d7=moment()[_0x2cdd('0x14')](_0x2cdd('0x37'));_0x721f29['state']=_0xe00767;_0x721f29[_0x2cdd('0x39')]=_0x2414bd;_0x721f29[_0x2cdd('0x3f')]=_0x721f29[_0x2cdd('0x3f')]?_0x721f29['responsetime']:_0x4388d7;_0x721f29[_0x2cdd('0x3c')]=_0x721f29[_0x2cdd('0x3c')]?_0x721f29[_0x2cdd('0x3c')]:_0x4388d7;_0x721f29[_0x2cdd('0x3e')]=getSeconds(_0x721f29[_0x2cdd('0x3f')]||0x0,_0x721f29['starttime']||0x0);_0x721f29['talktime']=_0x721f29[_0x2cdd('0x43')]?getSeconds(_0x721f29[_0x2cdd('0x3c')],_0x721f29[_0x2cdd('0x43')]):0x0;};exports['isFailure']=function(_0x51c6c6){return _0x51c6c6===_0x2cdd('0x44');};exports[_0x2cdd('0x45')]=function(_0x5258fc,_0x4cbc66,_0x2cdfe9,_0xd66b97,_0x2cf9c2){var _0x441941=_0xd66b97?_0x2cdd('0x46'):_0x5258fc[_0x2cdd('0x1a')];_0x441941=_0x2cf9c2?_0x2cdd('0x47'):_0x441941;return{'actionid':_0x5258fc[_0x2cdd('0x48')],'action':_0x2cdd('0x49'),'channel':_0x5258fc[_0x2cdd('0x4a')],'callerid':util[_0x2cdd('0x14')]('\x22%s\x22\x20<%s>',_0x441941,_0x5258fc[_0x2cdd('0x1b')]),'Exten':_0x2cdd('0x27'),'Context':_0x2cdd('0x4b'),'Priority':'1','variable':_0x2cdfe9,'timeout':(_0x4cbc66['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5258fc[_0x2cdd('0x48')]};};exports['totalGlobal']=function(_0x5acb44){return _0x5acb44[_0x2cdd('0x4c')]+_0x5acb44['countcongestionretry']+_0x5acb44[_0x2cdd('0x4d')]+_0x5acb44[_0x2cdd('0x4e')]+_0x5acb44[_0x2cdd('0x4f')];};exports['cloneAction']=function(_0x2cb8db){var _0x130f65=_[_0x2cdd('0x50')](_0x2cb8db);_0x130f65[_0x2cdd('0x38')]=0xf;_0x130f65[_0x2cdd('0x39')]=_0x2cdd('0x51');return _0x130f65;};exports[_0x2cdd('0x52')]=function(_0x678f75,_0x5e2d57,_0x26089f){var _0x58e0d6={};_0x58e0d6[_0x5e2d57]=_0x678f75[_0x5e2d57];_0x58e0d6[_0x2cdd('0x53')]=![];_0x58e0d6[_0x2cdd('0x54')]=moment()[_0x2cdd('0x55')](_0x26089f,_0x2cdd('0x56'))['format'](_0x2cdd('0x37'));_0x58e0d6['ContactId']=_0x678f75['ContactId'];_0x58e0d6[_0x2cdd('0x57')]=_0x678f75[_0x2cdd('0x57')];_0x58e0d6['VoiceQueueId']=_0x678f75['VoiceQueueId']||undefined;return _0x58e0d6;};exports[_0x2cdd('0x58')]=function(_0x5071cf,_0x39f829){if(!_[_0x2cdd('0x17')](_0x5071cf)){if(_0x5071cf[_0x2cdd('0x59')]>0x0){_0x5071cf[_0x2cdd('0x59')]-=0x1;}else{logger['error'](_0x39f829,_0x2cdd('0x5a'));}}else{logger['error'](_0x39f829,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x4f9172){if(_0x4f9172<=0x0){return!![];}return![];};exports['buildObj']=function(_0x42eb07,_0x20bed3){_0x42eb07[_0x2cdd('0x5b')]=_0x20bed3;_0x42eb07[_0x2cdd('0x5c')]=_0x42eb07[_0x2cdd('0x5d')];_0x42eb07[_0x2cdd('0x5e')]=_0x42eb07[_0x2cdd('0x4a')];return _0x42eb07;};exports[_0x2cdd('0x5f')]=function(_0x4aec5e){var _0xe25adb={};_0xe25adb[_0x2cdd('0x5d')]=_0x4aec5e[_0x2cdd('0x5d')];_0xe25adb[_0x2cdd('0x5e')]=_0x4aec5e[_0x2cdd('0x4a')];_0xe25adb[_0x2cdd('0x48')]=_0x4aec5e[_0x2cdd('0x48')];return _0xe25adb;};exports['agentReadyId']=function(_0x148ba1){var _0x35568e=[];for(var _0x27dd05 in _0x148ba1){if(_0x148ba1[_0x2cdd('0x2b')](_0x27dd05)){if(!_[_0x2cdd('0x17')](_0x148ba1[_0x27dd05])&&_0x148ba1[_0x27dd05]['state']===_0x2cdd('0x60')&&_0x148ba1[_0x27dd05]['status']==='reachable'){_0x35568e['push'](_0x148ba1[_0x27dd05]['id']);}}}return _0x35568e;};exports['getDiff']=function(_0x23faf6){var _0x40cd36=moment()[_0x2cdd('0x7')](0x0);var _0x8427fb=moment(_0x23faf6)['milliseconds'](0x0);return _0x40cd36[_0x2cdd('0x8')](_0x8427fb,_0x2cdd('0x9'));};exports['createBody']=function(_0x3de339){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3de339[_0x2cdd('0x1c')],'ListId':_0x3de339[_0x2cdd('0x57')],'VoiceQueueId':_0x3de339[_0x2cdd('0x61')]||undefined,'CampaignId':_0x3de339[_0x2cdd('0x62')]||undefined};};exports[_0x2cdd('0x63')]=function(_0x207de0){if(_0x207de0==='uniqueid'||_0x207de0===_0x2cdd('0x64')||_0x207de0===_0x2cdd('0x5d')||_0x207de0===_0x2cdd('0x65')||_0x207de0==='campaigntype'||_0x207de0===_0x2cdd('0x66')||_0x207de0==='membername'||_0x207de0===_0x2cdd('0x4a')||_0x207de0===_0x2cdd('0x1a')||_0x207de0===_0x2cdd('0x53')||_0x207de0===_0x2cdd('0x1b')||_0x207de0==='scheduledat'||_0x207de0===_0x2cdd('0x4c')||_0x207de0===_0x2cdd('0x67')||_0x207de0===_0x2cdd('0x4d')||_0x207de0===_0x2cdd('0x68')||_0x207de0==='callback'||_0x207de0===_0x2cdd('0x69')||_0x207de0==='callbackat'||_0x207de0===_0x2cdd('0x6a')||_0x207de0===_0x2cdd('0x1c')||_0x207de0===_0x2cdd('0x57')||_0x207de0==='UserId'||_0x207de0===_0x2cdd('0x61')||_0x207de0===_0x2cdd('0x6b')||_0x207de0==='xmd-voicequeueid'||_0x207de0===_0x2cdd('0x6c')||_0x207de0===_0x2cdd('0x6d')||_0x207de0===_0x2cdd('0x6e')||_0x207de0==='xmd-dialurl'||_0x207de0==='xmd-dialtimeout'||_0x207de0==='xmd-dialoptions'||_0x207de0===_0x2cdd('0x6f')||_0x207de0==='xmd-dialchannel'||_0x207de0===_0x2cdd('0x70')||_0x207de0===_0x2cdd('0x71')||_0x207de0==='xmd-callerid'||_0x207de0===_0x2cdd('0x72')||_0x207de0==='xmd-agi'||_0x207de0===_0x2cdd('0x73')||_0x207de0===_0x2cdd('0x74')||_0x207de0===_0x2cdd('0x75')||_0x207de0===_0x2cdd('0x76')||_0x207de0==='rtpaudioqosloss'||_0x207de0==='rtpaudioqoslossbridged'||_0x207de0==='rtpaudioqosrtt'||_0x207de0===_0x2cdd('0x77')||_0x207de0===_0x2cdd('0x73')||_0x207de0==='rtpaudioqosbridged'||_0x207de0==='rtpaudioqosjitter'||_0x207de0===_0x2cdd('0x76')||_0x207de0==='rtpaudioqosloss'||_0x207de0===_0x2cdd('0x78')||_0x207de0===_0x2cdd('0x79')||_0x207de0===_0x2cdd('0x77')||_0x207de0===_0x2cdd('0x7a')||_0x207de0===_0x2cdd('0x7b')||_0x207de0==='state'||_0x207de0===_0x2cdd('0x39')){return![];}return!![];};exports[_0x2cdd('0x7c')]=function(_0x1ca33b,_0x4ea170){var _0x23f7ee,_0xd813e2,_0x573a3b;if(_0x4ea170<=0x0){_0x4ea170=0x1;}_0x23f7ee=new RegExp(_0x2cdd('0x7d')+_0x4ea170+'}$');_0xd813e2=Math[_0x2cdd('0x7e')](0xa,_0x4ea170-0x1);_0x573a3b=Math['pow'](0xa,_0x4ea170)-0x1;return util['format']('%s',_[_0x2cdd('0x7f')](_0x1ca33b,_0x23f7ee,_[_0x2cdd('0x80')](_0xd813e2,_0x573a3b)));};exports[_0x2cdd('0x81')]=function(_0x324978){var _0x13372a=_0x324978['match'](/"(.*?)"/);return _0x13372a?_0x13372a[0x1]:_0x324978;};exports[_0x2cdd('0x82')]=function(_0x5ae650){var _0x4098b6=_0x5ae650['match'](/<(.*?)>/);return _0x4098b6?_0x4098b6[0x1]:_0x5ae650;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 960bcec..714ec3f 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x5685fc,_0x4a57c8){var _0x3a68a1=function(_0x151705){while(--_0x151705){_0x5685fc['push'](_0x5685fc['shift']());}};_0x3a68a1(++_0x4a57c8);}(_0xb10b,0x12a));var _0xbb10=function(_0x4257b6,_0x2348c7){_0x4257b6=_0x4257b6-0x0;var _0x4ad68c=_0xb10b[_0x4257b6];return _0x4ad68c;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x5b57ae,_0x31bac6){var _0x1877c2=function(_0x5c0bef){while(--_0x5c0bef){_0x5b57ae['push'](_0x5b57ae['shift']());}};_0x1877c2(++_0x31bac6);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c98c1,_0x524e3c){_0x3c98c1=_0x3c98c1-0x0;var _0x45c21b=_0xb10b[_0x3c98c1];return _0x45c21b;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 7070c62..3c3842b 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 _0x7d6f=['templates','zendeskAccounts','initFreshdeskAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','sumHoldTime','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','merge','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','outbound','channels','queueChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','SIP/%s','name','hasOwnProperty','isNil','interface','format','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','sumBillable','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','telephones','initVoiceQueues','initTriggers','initTemplates'];(function(_0x1898a2,_0x4a661f){var _0x493337=function(_0x4490c9){while(--_0x4490c9){_0x1898a2['push'](_0x1898a2['shift']());}};_0x493337(++_0x4a661f);}(_0x7d6f,0xf9));var _0xf7d6=function(_0x2dda85,_0x5c9ff5){_0x2dda85=_0x2dda85-0x0;var _0x11abf4=_0x7d6f[_0x2dda85];return _0x11abf4;};'use strict';var BPromise=require(_0xf7d6('0x0'));var util=require('util');var _=require(_0xf7d6('0x1'));var moment=require(_0xf7d6('0x2'));var Agent=require(_0xf7d6('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0xf7d6('0x4'));var VoiceQueue=require(_0xf7d6('0x5'));var Trigger=require(_0xf7d6('0x6'));var Template=require(_0xf7d6('0x7'));var Campaign=require(_0xf7d6('0x8'));var VoiceExtension=require(_0xf7d6('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xf7d6('0xa'));var SugarcrmAccount=require(_0xf7d6('0xb'));var ZohoAccount=require(_0xf7d6('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf7d6('0xd'));var ServicenowAccount=require(_0xf7d6('0xe'));var Dynamics365Account=require(_0xf7d6('0xf'));var FreshsalesAccount=require(_0xf7d6('0x10'));var FaxAccount=require(_0xf7d6('0x11'));var Realtime=function(){this[_0xf7d6('0x12')]={};this['telephones']={};this[_0xf7d6('0x13')]={};this[_0xf7d6('0x14')]={};this[_0xf7d6('0x15')]={};this[_0xf7d6('0x16')]={};this['templates']={};this[_0xf7d6('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf7d6('0x18')]={};this[_0xf7d6('0x19')]={};this['outboundChannels']={};this[_0xf7d6('0x1a')]={};this['zendeskAccounts']={};this[_0xf7d6('0x1b')]={};this[_0xf7d6('0x1c')]={};this[_0xf7d6('0x1d')]={};this[_0xf7d6('0x1e')]={};this['deskAccounts']={};this[_0xf7d6('0x1f')]={};this[_0xf7d6('0x20')]={};this[_0xf7d6('0x21')]={};this['freshsalesAccounts']={};this[_0xf7d6('0x22')]={};};function freeIsNotKey(_0x1a048a,_0x4ba7df,_0x82194b){var _0x390604=_['mapKeys'](_0x1a048a,function(_0xd90d83,_0x44657d){return _0xd90d83[_0x82194b];});for(var _0x3f52b7 in _0x4ba7df){if(_0x4ba7df['hasOwnProperty'](_0x3f52b7)){if(!_0x390604[_0x3f52b7]){delete _0x4ba7df[_0x3f52b7];}}}}function freeIsNotKeySip(_0x4ca16e,_0x44e3bd){var _0x3b747b=_[_0xf7d6('0x23')](_0x4ca16e,function(_0x18b9e7,_0x41d282){return util['format'](_0xf7d6('0x24'),_0x18b9e7[_0xf7d6('0x25')]);});for(var _0xcf5ce in _0x44e3bd){if(_0x44e3bd[_0xf7d6('0x26')](_0xcf5ce)){if(!_0x3b747b[_0xcf5ce]){delete _0x44e3bd[_0xcf5ce];}}}}function freeIsNotKeyAgent(_0x71f7da,_0x59d7e4){var _0x8e7300=_[_0xf7d6('0x23')](_0x71f7da,function(_0x5b1791,_0x151cce){var _0x429dfb=_[_0xf7d6('0x27')](_0x5b1791[_0xf7d6('0x28')])?util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x5b1791[_0xf7d6('0x25')]):_0x5b1791[_0xf7d6('0x28')];return _0x429dfb;});for(var _0x2e2dca in _0x59d7e4){if(_0x59d7e4[_0xf7d6('0x26')](_0x2e2dca)){if(!_0x8e7300[_0x2e2dca]){delete _0x59d7e4[_0x2e2dca];}}}}function clearVoiceCallReports(_0x2324f9){_0x2324f9['total']=0x0;_0x2324f9[_0xf7d6('0x2a')]=0x0;_0x2324f9['sumHoldTime']=0x0;_0x2324f9[_0xf7d6('0x2b')]=0x0;_0x2324f9['sumBillable']=0x0;}function clearCampaigns(_0x517020){if(!_[_0xf7d6('0x2c')](_0x517020)){for(var _0x489ebe in _0x517020){if(_0x517020[_0xf7d6('0x26')](_0x489ebe)){_0x517020[_0x489ebe][_0xf7d6('0x2d')]=0x0;_0x517020[_0x489ebe][_0xf7d6('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x141f3e){if(!_['isEmpty'](_0x141f3e)){for(var _0x37c508 in _0x141f3e){if(_0x141f3e['hasOwnProperty'](_0x37c508)){_0x141f3e[_0x37c508][_0xf7d6('0x2f')]=0x0;_0x141f3e[_0x37c508]['answered']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x30')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x31')]=0x0;_0x141f3e[_0x37c508]['sumHoldTime']=0x0;_0x141f3e[_0x37c508]['sumDuration']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x32')]=0x0;_0x141f3e[_0x37c508]['outboundAnswerAgiCallsDay']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x33')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x34')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x35')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x36')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x37')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x38')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x39')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x3a')]=0x0;_0x141f3e[_0x37c508]['outboundOriginateFailureCallsDay']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x3b')]=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x3c')]=0x0;_0x141f3e[_0x37c508]['outboundAnswerAgiCallsDay']=0x0;_0x141f3e[_0x37c508]['outboundAnswerCallsDay']=0x0;_0x141f3e[_0x37c508][_0xf7d6('0x3d')]=!![];}}}}Realtime[_0xf7d6('0x3e')][_0xf7d6('0x3f')]=function(_0x21eab4,_0x4d350b){for(var _0x402007 in _0x4d350b){if(_0x21eab4[_0xf7d6('0x26')](_0x402007)){_0x21eab4[_0x402007]=_0x4d350b[_0x402007];}}};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x40')]=function(){var _0x56768a=this;return function(_0x6c30ee){if(_0x6c30ee){freeIsNotKeyAgent(_0x6c30ee,_0x56768a['agents']);for(var _0x1792e9=0x0,_0x5c3d1d={},_0x143432={};_0x1792e9<_0x6c30ee[_0xf7d6('0x41')];_0x1792e9+=0x1){_0x5c3d1d=_0x6c30ee[_0x1792e9];var _0x35a7ae=_[_0xf7d6('0x27')](_0x5c3d1d[_0xf7d6('0x28')])?util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x5c3d1d['name']):_0x5c3d1d['interface'];if(_[_0xf7d6('0x42')](_0x56768a[_0xf7d6('0x12')][_0x35a7ae])){_0x56768a[_0xf7d6('0x12')][_0x35a7ae]=new Agent(_0x5c3d1d);}else{_0x56768a['mergeFromDatabase'](_0x56768a[_0xf7d6('0x12')][_0x35a7ae],_0x5c3d1d);}}}return _0x56768a[_0xf7d6('0x12')];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x43')]=function(){var _0x15ffd3=this;return function(_0x5c2380){if(_0x5c2380){freeIsNotKeySip(_0x5c2380,_0x15ffd3['telephones']);for(var _0x2b8211=0x0,_0x2c35f8={},_0xc08d94={};_0x2b8211<_0x5c2380[_0xf7d6('0x41')];_0x2b8211+=0x1){_0x2c35f8=_0x5c2380[_0x2b8211];if(_['isUndefined'](_0x15ffd3[_0xf7d6('0x44')][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x2c35f8[_0xf7d6('0x25')])])){_0x15ffd3[_0xf7d6('0x44')][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x2c35f8[_0xf7d6('0x25')])]=new Telephone(_0x2c35f8);}else{_0x15ffd3[_0xf7d6('0x3f')](_0x15ffd3['telephones'][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x2c35f8[_0xf7d6('0x25')])],_0x2c35f8);}}}return _0x15ffd3['telephones'];};};Realtime[_0xf7d6('0x3e')]['initTrunks']=function(){var _0x306d4e=this;return function(_0x2ddf41){if(_0x2ddf41){freeIsNotKeySip(_0x2ddf41,_0x306d4e[_0xf7d6('0x13')]);for(var _0x383c9d=0x0,_0x21f13b={},_0x59c662={};_0x383c9d<_0x2ddf41['length'];_0x383c9d+=0x1){_0x21f13b=_0x2ddf41[_0x383c9d];if(_[_0xf7d6('0x42')](_0x306d4e[_0xf7d6('0x13')][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x21f13b[_0xf7d6('0x25')])])){_0x306d4e[_0xf7d6('0x13')][util[_0xf7d6('0x29')]('SIP/%s',_0x21f13b['name'])]=new Trunk(_0x21f13b);}else{_0x306d4e[_0xf7d6('0x3f')](_0x306d4e[_0xf7d6('0x13')][util[_0xf7d6('0x29')](_0xf7d6('0x24'),_0x21f13b[_0xf7d6('0x25')])],_0x21f13b);}}}return _0x306d4e[_0xf7d6('0x13')];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x45')]=function(){var _0x4d8396=this;return function(_0xe9969c){if(_0xe9969c){freeIsNotKey(_0xe9969c,_0x4d8396['voiceQueues'],'name');for(var _0xa7c305=0x0,_0x2d9ba7={},_0x24f3db={};_0xa7c305<_0xe9969c[_0xf7d6('0x41')];_0xa7c305+=0x1){_0x2d9ba7=_0xe9969c[_0xa7c305];if(_[_0xf7d6('0x42')](_0x4d8396[_0xf7d6('0x14')][_0x2d9ba7[_0xf7d6('0x25')]])){_0x4d8396[_0xf7d6('0x14')][_0x2d9ba7[_0xf7d6('0x25')]]=new VoiceQueue(_0x2d9ba7);}else{_0x4d8396['mergeFromDatabase'](_0x4d8396[_0xf7d6('0x14')][_0x2d9ba7[_0xf7d6('0x25')]],_0x2d9ba7);}}}return _0x4d8396[_0xf7d6('0x14')];};};Realtime['prototype'][_0xf7d6('0x46')]=function(){var _0x538864=this;return function(_0x5e18e2){if(_0x5e18e2){freeIsNotKey(_0x5e18e2,_0x538864[_0xf7d6('0x15')],'id');for(var _0x53ba47=0x0,_0x1807e3={},_0x2ae5b1={};_0x53ba47<_0x5e18e2[_0xf7d6('0x41')];_0x53ba47+=0x1){_0x1807e3=_0x5e18e2[_0x53ba47];if(_[_0xf7d6('0x42')](_0x538864[_0xf7d6('0x15')][_0x1807e3['id']])){_0x538864[_0xf7d6('0x15')][_0x1807e3['id']]=new Trigger(_0x1807e3);}else{_0x538864[_0xf7d6('0x3f')](_0x538864[_0xf7d6('0x15')][_0x1807e3['id']],_0x1807e3);}}}return _0x538864['triggers'];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x47')]=function(){var _0x706e16=this;return function(_0x115297){if(_0x115297){freeIsNotKey(_0x115297,_0x706e16[_0xf7d6('0x48')],'id');for(var _0x58eb34=0x0,_0x3cba1d={},_0x56ac37={};_0x58eb34<_0x115297[_0xf7d6('0x41')];_0x58eb34+=0x1){_0x3cba1d=_0x115297[_0x58eb34];if(_[_0xf7d6('0x42')](_0x706e16[_0xf7d6('0x48')][_0x3cba1d['id']])){_0x706e16[_0xf7d6('0x48')][_0x3cba1d['id']]=new Template(_0x3cba1d);}else{_0x706e16[_0xf7d6('0x3f')](_0x706e16[_0xf7d6('0x48')][_0x3cba1d['id']],_0x3cba1d);}}}return _0x706e16[_0xf7d6('0x48')];};};Realtime[_0xf7d6('0x3e')]['initZendeskAccounts']=function(){var _0x5c2000=this;return function(_0x4edb4f){if(_0x4edb4f){freeIsNotKey(_0x4edb4f,_0x5c2000['zendeskAccounts'],'id');for(var _0x40e5f2=0x0,_0x4cdfaf={},_0x39095a={};_0x40e5f2<_0x4edb4f[_0xf7d6('0x41')];_0x40e5f2+=0x1){_0x4cdfaf=_0x4edb4f[_0x40e5f2];if(_[_0xf7d6('0x42')](_0x5c2000[_0xf7d6('0x49')][_0x4cdfaf['id']])){_0x5c2000[_0xf7d6('0x49')][_0x4cdfaf['id']]=new ZendeskAccount(_0x4cdfaf);}else{_0x5c2000['mergeFromDatabase'](_0x5c2000[_0xf7d6('0x49')][_0x4cdfaf['id']],_0x4cdfaf);}}}return _0x5c2000['zendeskAccounts'];};};Realtime[_0xf7d6('0x3e')]['initSalesforceAccounts']=function(){var _0x4c7bec=this;return function(_0xa50606){if(_0xa50606){freeIsNotKey(_0xa50606,_0x4c7bec['salesforceAccounts'],'id');for(var _0xf197d4=0x0,_0x17743f={},_0x7df989={};_0xf197d4<_0xa50606[_0xf7d6('0x41')];_0xf197d4+=0x1){_0x17743f=_0xa50606[_0xf197d4];if(_[_0xf7d6('0x42')](_0x4c7bec[_0xf7d6('0x1b')][_0x17743f['id']])){_0x4c7bec['salesforceAccounts'][_0x17743f['id']]=new SalesforceAccount(_0x17743f);}else{_0x4c7bec['mergeFromDatabase'](_0x4c7bec['salesforceAccounts'][_0x17743f['id']],_0x17743f);}}}return _0x4c7bec[_0xf7d6('0x1b')];};};Realtime['prototype'][_0xf7d6('0x4a')]=function(){var _0x4546ba=this;return function(_0x3409ed){if(_0x3409ed){freeIsNotKey(_0x3409ed,_0x4546ba['freshdeskAccounts'],'id');for(var _0xcf1a8d=0x0,_0x5d3d53={},_0x20dff={};_0xcf1a8d<_0x3409ed[_0xf7d6('0x41')];_0xcf1a8d+=0x1){_0x5d3d53=_0x3409ed[_0xcf1a8d];if(_[_0xf7d6('0x42')](_0x4546ba['freshdeskAccounts'][_0x5d3d53['id']])){_0x4546ba[_0xf7d6('0x1d')][_0x5d3d53['id']]=new FreshdeskAccount(_0x5d3d53);}else{_0x4546ba['mergeFromDatabase'](_0x4546ba[_0xf7d6('0x1d')][_0x5d3d53['id']],_0x5d3d53);}}}return _0x4546ba[_0xf7d6('0x1d')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x30463b=this;return function(_0x5a40ec){if(_0x5a40ec){freeIsNotKey(_0x5a40ec,_0x30463b[_0xf7d6('0x1e')],'id');for(var _0x1cdc92=0x0,_0x2f53cd={},_0x173209={};_0x1cdc92<_0x5a40ec[_0xf7d6('0x41')];_0x1cdc92+=0x1){_0x2f53cd=_0x5a40ec[_0x1cdc92];if(_[_0xf7d6('0x42')](_0x30463b[_0xf7d6('0x1e')][_0x2f53cd['id']])){_0x30463b[_0xf7d6('0x1e')][_0x2f53cd['id']]=new ZohoAccount(_0x2f53cd);}else{_0x30463b[_0xf7d6('0x3f')](_0x30463b['zohoAccounts'][_0x2f53cd['id']],_0x2f53cd);}}}return _0x30463b[_0xf7d6('0x1e')];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x3c11e2=this;return function(_0x69b242){if(_0x69b242){freeIsNotKey(_0x69b242,_0x3c11e2[_0xf7d6('0x4b')],'id');for(var _0x103fbb=0x0,_0x35d58a={},_0x3aa5d6={};_0x103fbb<_0x69b242[_0xf7d6('0x41')];_0x103fbb+=0x1){_0x35d58a=_0x69b242[_0x103fbb];if(_[_0xf7d6('0x42')](_0x3c11e2[_0xf7d6('0x4b')][_0x35d58a['id']])){_0x3c11e2[_0xf7d6('0x4b')][_0x35d58a['id']]=new DeskAccount(_0x35d58a);}else{_0x3c11e2[_0xf7d6('0x3f')](_0x3c11e2[_0xf7d6('0x4b')][_0x35d58a['id']],_0x35d58a);}}}return _0x3c11e2[_0xf7d6('0x4b')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x30777f=this;return function(_0x174d3a){if(_0x174d3a){freeIsNotKey(_0x174d3a,_0x30777f['sugarcrmAccounts'],'id');for(var _0x2034ac=0x0,_0x20018d={},_0x40e096={};_0x2034ac<_0x174d3a[_0xf7d6('0x41')];_0x2034ac+=0x1){_0x20018d=_0x174d3a[_0x2034ac];if(_[_0xf7d6('0x42')](_0x30777f[_0xf7d6('0x1c')][_0x20018d['id']])){_0x30777f['sugarcrmAccounts'][_0x20018d['id']]=new SugarcrmAccount(_0x20018d);}else{_0x30777f['mergeFromDatabase'](_0x30777f['sugarcrmAccounts'][_0x20018d['id']],_0x20018d);}}}return _0x30777f['sugarcrmAccounts'];};};Realtime['prototype'][_0xf7d6('0x4c')]=function(){var _0x4688d5=this;return function(_0x318599){if(_0x318599){freeIsNotKey(_0x318599,_0x4688d5[_0xf7d6('0x1f')],'id');for(var _0x2e2777=0x0,_0x9f491c={},_0x308a35={};_0x2e2777<_0x318599[_0xf7d6('0x41')];_0x2e2777+=0x1){_0x9f491c=_0x318599[_0x2e2777];if(_[_0xf7d6('0x42')](_0x4688d5[_0xf7d6('0x1f')][_0x9f491c['id']])){_0x4688d5[_0xf7d6('0x1f')][_0x9f491c['id']]=new VtigerAccount(_0x9f491c);}else{_0x4688d5[_0xf7d6('0x3f')](_0x4688d5[_0xf7d6('0x1f')][_0x9f491c['id']],_0x9f491c);}}}return _0x4688d5[_0xf7d6('0x1f')];};};Realtime['prototype'][_0xf7d6('0x4d')]=function(){var _0x4d2580=this;return function(_0x37b875){if(_0x37b875){freeIsNotKey(_0x37b875,_0x4d2580[_0xf7d6('0x20')],'id');for(var _0x1087c5=0x0,_0x1c2e64={},_0x3ed2bb={};_0x1087c5<_0x37b875[_0xf7d6('0x41')];_0x1087c5+=0x1){_0x1c2e64=_0x37b875[_0x1087c5];if(_[_0xf7d6('0x42')](_0x4d2580['servicenowAccounts'][_0x1c2e64['id']])){_0x4d2580[_0xf7d6('0x20')][_0x1c2e64['id']]=new ServicenowAccount(_0x1c2e64);}else{_0x4d2580[_0xf7d6('0x3f')](_0x4d2580['servicenowAccounts'][_0x1c2e64['id']],_0x1c2e64);}}}return _0x4d2580[_0xf7d6('0x20')];};};Realtime['prototype'][_0xf7d6('0x4e')]=function(){var _0x5efa04=this;return function(_0x4a3a72){if(_0x4a3a72){freeIsNotKey(_0x4a3a72,_0x5efa04['dynamics365Accounts'],'id');for(var _0x18d7cb=0x0,_0x3aabca={},_0x598577={};_0x18d7cb<_0x4a3a72[_0xf7d6('0x41')];_0x18d7cb+=0x1){_0x3aabca=_0x4a3a72[_0x18d7cb];if(_['isUndefined'](_0x5efa04[_0xf7d6('0x21')][_0x3aabca['id']])){_0x5efa04[_0xf7d6('0x21')][_0x3aabca['id']]=new Dynamics365Account(_0x3aabca);}else{_0x5efa04['mergeFromDatabase'](_0x5efa04[_0xf7d6('0x21')][_0x3aabca['id']],_0x3aabca);}}}return _0x5efa04['dynamics365Accounts'];};};Realtime[_0xf7d6('0x3e')]['initFreshsalesAccounts']=function(){var _0x10a7e2=this;return function(_0x2f956d){if(_0x2f956d){freeIsNotKey(_0x2f956d,_0x10a7e2[_0xf7d6('0x4f')],'id');for(var _0x218d86=0x0,_0x3343b7={},_0xdff99a={};_0x218d86<_0x2f956d[_0xf7d6('0x41')];_0x218d86+=0x1){_0x3343b7=_0x2f956d[_0x218d86];if(_['isUndefined'](_0x10a7e2[_0xf7d6('0x4f')][_0x3343b7['id']])){_0x10a7e2['freshsalesAccounts'][_0x3343b7['id']]=new FreshsalesAccount(_0x3343b7);}else{_0x10a7e2['mergeFromDatabase'](_0x10a7e2[_0xf7d6('0x4f')][_0x3343b7['id']],_0x3343b7);}}}return _0x10a7e2['freshsalesAccounts'];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x50')]=function(){var _0x878ad6=this;return function(_0x50c57c){for(var _0x4d2f4c=0x0;_0x4d2f4c<_0x50c57c[_0xf7d6('0x41')];_0x4d2f4c+=0x1){_['merge'](_0x878ad6[_0xf7d6('0x14')][_0x50c57c[_0x4d2f4c]['name']],_0x50c57c[_0x4d2f4c]);}return _0x878ad6['voiceQueues'];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x51')]=function(){var _0x4ce9f6=this;return function(_0x1965d9){clearVoiceQueues(_0x4ce9f6['voiceQueues']);if(_0x1965d9){_0x1965d9=_[_0xf7d6('0x52')](_0x1965d9,_0xf7d6('0x53'));for(var _0x3cd67c in _0x1965d9){if(_0x1965d9[_0xf7d6('0x26')](_0x3cd67c)){var _0x1f2ce7={};for(var _0x35c649=0x0;_0x35c649<_0x1965d9[_0x3cd67c][_0xf7d6('0x41')];_0x35c649+=0x1){var _0x102dc6=_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x54')];if(_0x4ce9f6['voiceQueues'][_0x102dc6]){if(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x55')]){_0x4ce9f6[_0xf7d6('0x14')][_0x102dc6]['unmanaged']+=0x1;}if(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x56')]){_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x31')]+=0x1;}_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x57')]+=moment(_0x1965d9[_0x3cd67c][_0x35c649]['queuecallerleaveAt'])[_0xf7d6('0x58')](moment(_0x1965d9[_0x3cd67c][_0x35c649]['queuecallerjoinAt']),_0xf7d6('0x59'))||0x0;if(_0x35c649===_0x1965d9[_0x3cd67c][_0xf7d6('0x41')]-0x1){_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x2b')]+=moment(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5a')]||_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5b')]||_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5c')])[_0xf7d6('0x58')](moment(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5d')]),'seconds')||0x0;_0x4ce9f6[_0xf7d6('0x14')][_0x102dc6]['total']+=0x1;if(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5e')]){_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x2a')]+=0x1;_0x4ce9f6['voiceQueues'][_0x102dc6][_0xf7d6('0x32')]+=moment(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5a')])[_0xf7d6('0x58')](moment(_0x1965d9[_0x3cd67c][_0x35c649][_0xf7d6('0x5f')]),'seconds')||0x0;}}else{_0x4ce9f6[_0xf7d6('0x14')][_0x102dc6]['sumDuration']+=_0x4ce9f6[_0xf7d6('0x14')][_0x102dc6][_0xf7d6('0x57')]||0x0;}}}}}}return _0x4ce9f6['voiceQueues'];};};Realtime[_0xf7d6('0x3e')]['initVoiceCallReports']=function(){var _0x23a1fa=this;return function(_0x36fbb3){clearVoiceCallReports(_0x23a1fa[_0xf7d6('0x17')]);if(_0x36fbb3){for(var _0x4464ad=0x0;_0x4464ad<_0x36fbb3[_0xf7d6('0x41')];_0x4464ad+=0x1){_0x23a1fa[_0xf7d6('0x17')][_0xf7d6('0x2f')]+=0x1;_0x23a1fa[_0xf7d6('0x17')][_0xf7d6('0x2b')]+=_0x36fbb3[_0x4464ad][_0xf7d6('0x60')];if(_0x36fbb3[_0x4464ad][_0xf7d6('0x61')]===_0xf7d6('0x62')){_0x23a1fa[_0xf7d6('0x17')]['answered']+=0x1;_0x23a1fa[_0xf7d6('0x17')][_0xf7d6('0x57')]+=_0x36fbb3[_0x4464ad][_0xf7d6('0x60')]-_0x36fbb3[_0x4464ad][_0xf7d6('0x63')]||0x0;_0x23a1fa[_0xf7d6('0x17')][_0xf7d6('0x32')]+=_0x36fbb3[_0x4464ad][_0xf7d6('0x63')];}}}return _0x23a1fa[_0xf7d6('0x17')];};};Realtime[_0xf7d6('0x3e')]['initCampaigns']=function(){var _0x3b8b46=this;return function(_0x20945e){if(_0x20945e){freeIsNotKey(_0x20945e,_0x3b8b46[_0xf7d6('0x16')],'name');for(var _0x2355ba=0x0,_0x4da8f4={};_0x2355ba<_0x20945e[_0xf7d6('0x41')];_0x2355ba+=0x1){_0x4da8f4=_0x20945e[_0x2355ba];if(_[_0xf7d6('0x42')](_0x3b8b46[_0xf7d6('0x16')][_0x4da8f4[_0xf7d6('0x25')]])){_0x3b8b46[_0xf7d6('0x16')][_0x4da8f4[_0xf7d6('0x25')]]=new Campaign(_0x4da8f4);}else{_0x3b8b46[_0xf7d6('0x3f')](_0x3b8b46[_0xf7d6('0x16')][_0x4da8f4[_0xf7d6('0x25')]],_0x4da8f4);_0x3b8b46[_0xf7d6('0x16')][_0x4da8f4[_0xf7d6('0x25')]][_0xf7d6('0x64')]=_0x4da8f4[_0xf7d6('0x65')]?_0x4da8f4[_0xf7d6('0x65')][_0xf7d6('0x25')]:undefined;}}}return _0x3b8b46['campaigns'];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x66')]=function(){var _0x31223a=this;return function(_0x42d874){if(_0x42d874){freeIsNotKey(_0x42d874,_0x31223a[_0xf7d6('0x67')],'id');for(var _0x26791a=0x0,_0x3e955={};_0x26791a<_0x42d874['length'];_0x26791a+=0x1){_0x3e955=_0x42d874[_0x26791a];if(_[_0xf7d6('0x42')](_0x31223a[_0xf7d6('0x67')][_0x3e955['id']])){_0x31223a[_0xf7d6('0x67')][_0x3e955['id']]=new VoiceExtension(_0x3e955);}else{_0x31223a[_0xf7d6('0x3f')](_0x31223a[_0xf7d6('0x67')][_0x3e955['id']],_0x3e955);}}}return _0x31223a['voiceExtensions'];};};Realtime[_0xf7d6('0x3e')]['initCampaignHopperHistory']=function(){var _0x3eaa4d=this;return function(_0x5c2d63){clearCampaigns(_0x3eaa4d[_0xf7d6('0x16')]);for(var _0x2f2961=0x0;_0x2f2961<_0x5c2d63[_0xf7d6('0x41')];_0x2f2961+=0x1){_[_0xf7d6('0x68')](_0x3eaa4d['campaigns'][_0x5c2d63[_0x2f2961][_0xf7d6('0x25')]],_0x5c2d63[_0x2f2961]);}return _0x3eaa4d[_0xf7d6('0x16')];};};Realtime[_0xf7d6('0x3e')][_0xf7d6('0x69')]=function(){var _0x1d46d8=this;return function(_0x1d5a02){if(_0x1d5a02){freeIsNotKey(_0x1d5a02,_0x1d46d8[_0xf7d6('0x22')],'id');for(var _0x5510e2=0x0,_0x9f418c={},_0xe375ab={};_0x5510e2<_0x1d5a02[_0xf7d6('0x41')];_0x5510e2+=0x1){_0x9f418c=_0x1d5a02[_0x5510e2];if(_['isUndefined'](_0x1d46d8['faxAccounts'][_0x9f418c['id']])){_0x1d46d8[_0xf7d6('0x22')][_0x9f418c['id']]=new FaxAccount(_0x9f418c);}else{_0x1d46d8[_0xf7d6('0x3f')](_0x1d46d8['faxAccounts'][_0x9f418c['id']],_0x9f418c);}}}return _0x1d46d8[_0xf7d6('0x22')];};};module[_0xf7d6('0x6a')]=Realtime; \ No newline at end of file +var _0xfd2d=['dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','name','isNil','interface','hasOwnProperty','total','answered','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','mergeFromDatabase','initTelephones','initTrunks','isUndefined','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','seconds','queuecallercomplete','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd2d,0x15c));var _0xdfd2=function(_0x1d73ce,_0x499f7d){_0x1d73ce=_0x1d73ce-0x0;var _0x3be4f3=_0xfd2d[_0x1d73ce];return _0x3be4f3;};'use strict';var BPromise=require(_0xdfd2('0x0'));var util=require(_0xdfd2('0x1'));var _=require(_0xdfd2('0x2'));var moment=require(_0xdfd2('0x3'));var Agent=require(_0xdfd2('0x4'));var Telephone=require(_0xdfd2('0x5'));var Trunk=require(_0xdfd2('0x6'));var VoiceQueue=require(_0xdfd2('0x7'));var Trigger=require(_0xdfd2('0x8'));var Template=require(_0xdfd2('0x9'));var Campaign=require(_0xdfd2('0xa'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xdfd2('0xb'));var SalesforceAccount=require(_0xdfd2('0xc'));var FreshdeskAccount=require(_0xdfd2('0xd'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xdfd2('0xe'));var DeskAccount=require(_0xdfd2('0xf'));var VtigerAccount=require(_0xdfd2('0x10'));var ServicenowAccount=require(_0xdfd2('0x11'));var Dynamics365Account=require(_0xdfd2('0x12'));var FreshsalesAccount=require(_0xdfd2('0x13'));var FaxAccount=require(_0xdfd2('0x14'));var Realtime=function(){this[_0xdfd2('0x15')]={};this[_0xdfd2('0x16')]={};this[_0xdfd2('0x17')]={};this[_0xdfd2('0x18')]={};this[_0xdfd2('0x19')]={};this[_0xdfd2('0x1a')]={};this['templates']={};this[_0xdfd2('0x1b')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xdfd2('0x1c')]={};this[_0xdfd2('0x1d')]={};this[_0xdfd2('0x1e')]={};this[_0xdfd2('0x1f')]={};this[_0xdfd2('0x20')]={};this[_0xdfd2('0x21')]={};this[_0xdfd2('0x22')]={};this['sugarcrmAccounts']={};this[_0xdfd2('0x23')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xdfd2('0x24')]={};this[_0xdfd2('0x25')]={};this[_0xdfd2('0x26')]={};this['freshsalesAccounts']={};this[_0xdfd2('0x27')]={};};function freeIsNotKey(_0x4d6ec3,_0x55c4be,_0xa7198e){var _0x15d348=_[_0xdfd2('0x28')](_0x4d6ec3,function(_0x33ffdb,_0x50cffb){return _0x33ffdb[_0xa7198e];});for(var _0x8ec47a in _0x55c4be){if(_0x55c4be['hasOwnProperty'](_0x8ec47a)){if(!_0x15d348[_0x8ec47a]){delete _0x55c4be[_0x8ec47a];}}}}function freeIsNotKeySip(_0x534ea0,_0x1f6026){var _0x2a8a1d=_[_0xdfd2('0x28')](_0x534ea0,function(_0x340870,_0x49baa9){return util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x340870[_0xdfd2('0x2b')]);});for(var _0x5b31d0 in _0x1f6026){if(_0x1f6026['hasOwnProperty'](_0x5b31d0)){if(!_0x2a8a1d[_0x5b31d0]){delete _0x1f6026[_0x5b31d0];}}}}function freeIsNotKeyAgent(_0x402e58,_0x4d64e8){var _0x2798bd=_[_0xdfd2('0x28')](_0x402e58,function(_0x31d525,_0x3e8892){var _0x17ab3a=_[_0xdfd2('0x2c')](_0x31d525[_0xdfd2('0x2d')])?util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x31d525['name']):_0x31d525['interface'];return _0x17ab3a;});for(var _0x2ad498 in _0x4d64e8){if(_0x4d64e8[_0xdfd2('0x2e')](_0x2ad498)){if(!_0x2798bd[_0x2ad498]){delete _0x4d64e8[_0x2ad498];}}}}function clearVoiceCallReports(_0x4638cf){_0x4638cf[_0xdfd2('0x2f')]=0x0;_0x4638cf[_0xdfd2('0x30')]=0x0;_0x4638cf['sumHoldTime']=0x0;_0x4638cf['sumDuration']=0x0;_0x4638cf[_0xdfd2('0x31')]=0x0;}function clearCampaigns(_0x37451d){if(!_['isEmpty'](_0x37451d)){for(var _0x1f3617 in _0x37451d){if(_0x37451d[_0xdfd2('0x2e')](_0x1f3617)){_0x37451d[_0x1f3617][_0xdfd2('0x32')]=0x0;_0x37451d[_0x1f3617][_0xdfd2('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2e2121){if(!_[_0xdfd2('0x34')](_0x2e2121)){for(var _0x295fbc in _0x2e2121){if(_0x2e2121[_0xdfd2('0x2e')](_0x295fbc)){_0x2e2121[_0x295fbc][_0xdfd2('0x2f')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x30')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x35')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x36')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x37')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x38')]=0x0;_0x2e2121[_0x295fbc]['sumBillable']=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x39')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3a')]=0x0;_0x2e2121[_0x295fbc]['outboundBusyCallsDay']=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3b')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3c')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3d')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3e')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x3f')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x40')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x41')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x42')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x43')]=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x39')]=0x0;_0x2e2121[_0x295fbc]['outboundAnswerCallsDay']=0x0;_0x2e2121[_0x295fbc][_0xdfd2('0x44')]=!![];}}}}Realtime[_0xdfd2('0x45')]['mergeFromDatabase']=function(_0x557baf,_0x4edb58){for(var _0x490acc in _0x4edb58){if(_0x557baf[_0xdfd2('0x2e')](_0x490acc)){_0x557baf[_0x490acc]=_0x4edb58[_0x490acc];}}};Realtime[_0xdfd2('0x45')]['initAgents']=function(){var _0xffbdd8=this;return function(_0x36230b){if(_0x36230b){freeIsNotKeyAgent(_0x36230b,_0xffbdd8[_0xdfd2('0x15')]);for(var _0x3b925e=0x0,_0x180205={},_0x496645={};_0x3b925e<_0x36230b[_0xdfd2('0x46')];_0x3b925e+=0x1){_0x180205=_0x36230b[_0x3b925e];var _0x21f2e5=_[_0xdfd2('0x2c')](_0x180205[_0xdfd2('0x2d')])?util['format']('SIP/%s',_0x180205[_0xdfd2('0x2b')]):_0x180205[_0xdfd2('0x2d')];if(_['isUndefined'](_0xffbdd8['agents'][_0x21f2e5])){_0xffbdd8[_0xdfd2('0x15')][_0x21f2e5]=new Agent(_0x180205);}else{_0xffbdd8[_0xdfd2('0x47')](_0xffbdd8[_0xdfd2('0x15')][_0x21f2e5],_0x180205);}}}return _0xffbdd8[_0xdfd2('0x15')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x48')]=function(){var _0x30a7ee=this;return function(_0x3f131c){if(_0x3f131c){freeIsNotKeySip(_0x3f131c,_0x30a7ee[_0xdfd2('0x16')]);for(var _0xeac294=0x0,_0x5cf510={},_0x52afdf={};_0xeac294<_0x3f131c['length'];_0xeac294+=0x1){_0x5cf510=_0x3f131c[_0xeac294];if(_['isUndefined'](_0x30a7ee['telephones'][util['format'](_0xdfd2('0x2a'),_0x5cf510[_0xdfd2('0x2b')])])){_0x30a7ee[_0xdfd2('0x16')][util['format'](_0xdfd2('0x2a'),_0x5cf510[_0xdfd2('0x2b')])]=new Telephone(_0x5cf510);}else{_0x30a7ee[_0xdfd2('0x47')](_0x30a7ee[_0xdfd2('0x16')][util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x5cf510['name'])],_0x5cf510);}}}return _0x30a7ee[_0xdfd2('0x16')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x49')]=function(){var _0x2fcad0=this;return function(_0x149645){if(_0x149645){freeIsNotKeySip(_0x149645,_0x2fcad0[_0xdfd2('0x17')]);for(var _0x5e7020=0x0,_0x286886={},_0x12efb2={};_0x5e7020<_0x149645[_0xdfd2('0x46')];_0x5e7020+=0x1){_0x286886=_0x149645[_0x5e7020];if(_[_0xdfd2('0x4a')](_0x2fcad0[_0xdfd2('0x17')][util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x286886[_0xdfd2('0x2b')])])){_0x2fcad0[_0xdfd2('0x17')][util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x286886[_0xdfd2('0x2b')])]=new Trunk(_0x286886);}else{_0x2fcad0[_0xdfd2('0x47')](_0x2fcad0[_0xdfd2('0x17')][util[_0xdfd2('0x29')](_0xdfd2('0x2a'),_0x286886[_0xdfd2('0x2b')])],_0x286886);}}}return _0x2fcad0[_0xdfd2('0x17')];};};Realtime[_0xdfd2('0x45')]['initVoiceQueues']=function(){var _0x1b24c7=this;return function(_0x6b7954){if(_0x6b7954){freeIsNotKey(_0x6b7954,_0x1b24c7[_0xdfd2('0x18')],'name');for(var _0x4822a0=0x0,_0x285dd0={},_0x5b57a4={};_0x4822a0<_0x6b7954[_0xdfd2('0x46')];_0x4822a0+=0x1){_0x285dd0=_0x6b7954[_0x4822a0];if(_['isUndefined'](_0x1b24c7[_0xdfd2('0x18')][_0x285dd0[_0xdfd2('0x2b')]])){_0x1b24c7['voiceQueues'][_0x285dd0[_0xdfd2('0x2b')]]=new VoiceQueue(_0x285dd0);}else{_0x1b24c7[_0xdfd2('0x47')](_0x1b24c7[_0xdfd2('0x18')][_0x285dd0[_0xdfd2('0x2b')]],_0x285dd0);}}}return _0x1b24c7['voiceQueues'];};};Realtime['prototype'][_0xdfd2('0x4b')]=function(){var _0x543e68=this;return function(_0x235402){if(_0x235402){freeIsNotKey(_0x235402,_0x543e68[_0xdfd2('0x19')],'id');for(var _0x9d60c=0x0,_0x647e73={},_0x1bba59={};_0x9d60c<_0x235402[_0xdfd2('0x46')];_0x9d60c+=0x1){_0x647e73=_0x235402[_0x9d60c];if(_[_0xdfd2('0x4a')](_0x543e68['triggers'][_0x647e73['id']])){_0x543e68[_0xdfd2('0x19')][_0x647e73['id']]=new Trigger(_0x647e73);}else{_0x543e68['mergeFromDatabase'](_0x543e68[_0xdfd2('0x19')][_0x647e73['id']],_0x647e73);}}}return _0x543e68[_0xdfd2('0x19')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x4c')]=function(){var _0x58ba58=this;return function(_0x2dcdcd){if(_0x2dcdcd){freeIsNotKey(_0x2dcdcd,_0x58ba58[_0xdfd2('0x4d')],'id');for(var _0xe977eb=0x0,_0x2f8871={},_0x27aae={};_0xe977eb<_0x2dcdcd[_0xdfd2('0x46')];_0xe977eb+=0x1){_0x2f8871=_0x2dcdcd[_0xe977eb];if(_[_0xdfd2('0x4a')](_0x58ba58[_0xdfd2('0x4d')][_0x2f8871['id']])){_0x58ba58[_0xdfd2('0x4d')][_0x2f8871['id']]=new Template(_0x2f8871);}else{_0x58ba58['mergeFromDatabase'](_0x58ba58['templates'][_0x2f8871['id']],_0x2f8871);}}}return _0x58ba58[_0xdfd2('0x4d')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x4e')]=function(){var _0xab00d5=this;return function(_0x369283){if(_0x369283){freeIsNotKey(_0x369283,_0xab00d5['zendeskAccounts'],'id');for(var _0xe71135=0x0,_0x1d7239={},_0xdbd7f={};_0xe71135<_0x369283['length'];_0xe71135+=0x1){_0x1d7239=_0x369283[_0xe71135];if(_['isUndefined'](_0xab00d5[_0xdfd2('0x21')][_0x1d7239['id']])){_0xab00d5[_0xdfd2('0x21')][_0x1d7239['id']]=new ZendeskAccount(_0x1d7239);}else{_0xab00d5[_0xdfd2('0x47')](_0xab00d5[_0xdfd2('0x21')][_0x1d7239['id']],_0x1d7239);}}}return _0xab00d5[_0xdfd2('0x21')];};};Realtime['prototype'][_0xdfd2('0x4f')]=function(){var _0xfdcb29=this;return function(_0x4b3772){if(_0x4b3772){freeIsNotKey(_0x4b3772,_0xfdcb29[_0xdfd2('0x22')],'id');for(var _0x56bafa=0x0,_0x599f50={},_0x159089={};_0x56bafa<_0x4b3772[_0xdfd2('0x46')];_0x56bafa+=0x1){_0x599f50=_0x4b3772[_0x56bafa];if(_[_0xdfd2('0x4a')](_0xfdcb29['salesforceAccounts'][_0x599f50['id']])){_0xfdcb29[_0xdfd2('0x22')][_0x599f50['id']]=new SalesforceAccount(_0x599f50);}else{_0xfdcb29['mergeFromDatabase'](_0xfdcb29[_0xdfd2('0x22')][_0x599f50['id']],_0x599f50);}}}return _0xfdcb29['salesforceAccounts'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x50')]=function(){var _0x44c386=this;return function(_0x2f1590){if(_0x2f1590){freeIsNotKey(_0x2f1590,_0x44c386['freshdeskAccounts'],'id');for(var _0x3a8ae8=0x0,_0x412ce5={},_0x3beb16={};_0x3a8ae8<_0x2f1590[_0xdfd2('0x46')];_0x3a8ae8+=0x1){_0x412ce5=_0x2f1590[_0x3a8ae8];if(_[_0xdfd2('0x4a')](_0x44c386[_0xdfd2('0x23')][_0x412ce5['id']])){_0x44c386[_0xdfd2('0x23')][_0x412ce5['id']]=new FreshdeskAccount(_0x412ce5);}else{_0x44c386[_0xdfd2('0x47')](_0x44c386[_0xdfd2('0x23')][_0x412ce5['id']],_0x412ce5);}}}return _0x44c386[_0xdfd2('0x23')];};};Realtime[_0xdfd2('0x45')]['initZohoAccounts']=function(){var _0x5ccd4f=this;return function(_0x346993){if(_0x346993){freeIsNotKey(_0x346993,_0x5ccd4f[_0xdfd2('0x51')],'id');for(var _0xc5de43=0x0,_0x2654d0={},_0x5f5d4e={};_0xc5de43<_0x346993[_0xdfd2('0x46')];_0xc5de43+=0x1){_0x2654d0=_0x346993[_0xc5de43];if(_['isUndefined'](_0x5ccd4f['zohoAccounts'][_0x2654d0['id']])){_0x5ccd4f[_0xdfd2('0x51')][_0x2654d0['id']]=new ZohoAccount(_0x2654d0);}else{_0x5ccd4f[_0xdfd2('0x47')](_0x5ccd4f['zohoAccounts'][_0x2654d0['id']],_0x2654d0);}}}return _0x5ccd4f['zohoAccounts'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x52')]=function(){var _0x2a5772=this;return function(_0x5d730a){if(_0x5d730a){freeIsNotKey(_0x5d730a,_0x2a5772[_0xdfd2('0x53')],'id');for(var _0xeb9083=0x0,_0x1cf1fb={},_0x14076b={};_0xeb9083<_0x5d730a[_0xdfd2('0x46')];_0xeb9083+=0x1){_0x1cf1fb=_0x5d730a[_0xeb9083];if(_[_0xdfd2('0x4a')](_0x2a5772[_0xdfd2('0x53')][_0x1cf1fb['id']])){_0x2a5772[_0xdfd2('0x53')][_0x1cf1fb['id']]=new DeskAccount(_0x1cf1fb);}else{_0x2a5772[_0xdfd2('0x47')](_0x2a5772[_0xdfd2('0x53')][_0x1cf1fb['id']],_0x1cf1fb);}}}return _0x2a5772[_0xdfd2('0x53')];};};Realtime[_0xdfd2('0x45')]['initSugarcrmAccounts']=function(){var _0x2fa757=this;return function(_0x5e6f59){if(_0x5e6f59){freeIsNotKey(_0x5e6f59,_0x2fa757[_0xdfd2('0x54')],'id');for(var _0x6c8f78=0x0,_0x153fef={},_0x498378={};_0x6c8f78<_0x5e6f59[_0xdfd2('0x46')];_0x6c8f78+=0x1){_0x153fef=_0x5e6f59[_0x6c8f78];if(_['isUndefined'](_0x2fa757[_0xdfd2('0x54')][_0x153fef['id']])){_0x2fa757[_0xdfd2('0x54')][_0x153fef['id']]=new SugarcrmAccount(_0x153fef);}else{_0x2fa757[_0xdfd2('0x47')](_0x2fa757[_0xdfd2('0x54')][_0x153fef['id']],_0x153fef);}}}return _0x2fa757['sugarcrmAccounts'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x55')]=function(){var _0x34a15a=this;return function(_0x19d29e){if(_0x19d29e){freeIsNotKey(_0x19d29e,_0x34a15a[_0xdfd2('0x24')],'id');for(var _0x13cd7a=0x0,_0x52fd80={},_0x5344fc={};_0x13cd7a<_0x19d29e['length'];_0x13cd7a+=0x1){_0x52fd80=_0x19d29e[_0x13cd7a];if(_['isUndefined'](_0x34a15a[_0xdfd2('0x24')][_0x52fd80['id']])){_0x34a15a[_0xdfd2('0x24')][_0x52fd80['id']]=new VtigerAccount(_0x52fd80);}else{_0x34a15a[_0xdfd2('0x47')](_0x34a15a[_0xdfd2('0x24')][_0x52fd80['id']],_0x52fd80);}}}return _0x34a15a[_0xdfd2('0x24')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x56')]=function(){var _0x100437=this;return function(_0x3a0239){if(_0x3a0239){freeIsNotKey(_0x3a0239,_0x100437[_0xdfd2('0x25')],'id');for(var _0x256eb0=0x0,_0x1d7bfe={},_0x2c058d={};_0x256eb0<_0x3a0239[_0xdfd2('0x46')];_0x256eb0+=0x1){_0x1d7bfe=_0x3a0239[_0x256eb0];if(_[_0xdfd2('0x4a')](_0x100437[_0xdfd2('0x25')][_0x1d7bfe['id']])){_0x100437[_0xdfd2('0x25')][_0x1d7bfe['id']]=new ServicenowAccount(_0x1d7bfe);}else{_0x100437[_0xdfd2('0x47')](_0x100437[_0xdfd2('0x25')][_0x1d7bfe['id']],_0x1d7bfe);}}}return _0x100437[_0xdfd2('0x25')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x2ea4d7=this;return function(_0x350683){if(_0x350683){freeIsNotKey(_0x350683,_0x2ea4d7['dynamics365Accounts'],'id');for(var _0x82cbe2=0x0,_0x35932d={},_0x1d3587={};_0x82cbe2<_0x350683[_0xdfd2('0x46')];_0x82cbe2+=0x1){_0x35932d=_0x350683[_0x82cbe2];if(_[_0xdfd2('0x4a')](_0x2ea4d7['dynamics365Accounts'][_0x35932d['id']])){_0x2ea4d7['dynamics365Accounts'][_0x35932d['id']]=new Dynamics365Account(_0x35932d);}else{_0x2ea4d7[_0xdfd2('0x47')](_0x2ea4d7[_0xdfd2('0x26')][_0x35932d['id']],_0x35932d);}}}return _0x2ea4d7['dynamics365Accounts'];};};Realtime[_0xdfd2('0x45')]['initFreshsalesAccounts']=function(){var _0x5e45b3=this;return function(_0x5770ac){if(_0x5770ac){freeIsNotKey(_0x5770ac,_0x5e45b3[_0xdfd2('0x57')],'id');for(var _0x500a9d=0x0,_0x2d8a1d={},_0x7b2431={};_0x500a9d<_0x5770ac[_0xdfd2('0x46')];_0x500a9d+=0x1){_0x2d8a1d=_0x5770ac[_0x500a9d];if(_[_0xdfd2('0x4a')](_0x5e45b3[_0xdfd2('0x57')][_0x2d8a1d['id']])){_0x5e45b3[_0xdfd2('0x57')][_0x2d8a1d['id']]=new FreshsalesAccount(_0x2d8a1d);}else{_0x5e45b3['mergeFromDatabase'](_0x5e45b3[_0xdfd2('0x57')][_0x2d8a1d['id']],_0x2d8a1d);}}}return _0x5e45b3['freshsalesAccounts'];};};Realtime['prototype'][_0xdfd2('0x58')]=function(){var _0x2eba89=this;return function(_0x165d7b){for(var _0x591292=0x0;_0x591292<_0x165d7b[_0xdfd2('0x46')];_0x591292+=0x1){_[_0xdfd2('0x59')](_0x2eba89['voiceQueues'][_0x165d7b[_0x591292][_0xdfd2('0x2b')]],_0x165d7b[_0x591292]);}return _0x2eba89[_0xdfd2('0x18')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x5a')]=function(){var _0x18ae0f=this;return function(_0x1f7665){clearVoiceQueues(_0x18ae0f[_0xdfd2('0x18')]);if(_0x1f7665){_0x1f7665=_[_0xdfd2('0x5b')](_0x1f7665,'uniqueid');for(var _0x4d4f1d in _0x1f7665){if(_0x1f7665[_0xdfd2('0x2e')](_0x4d4f1d)){var _0x5710a0={};for(var _0x2d9382=0x0;_0x2d9382<_0x1f7665[_0x4d4f1d][_0xdfd2('0x46')];_0x2d9382+=0x1){var _0x8fe079=_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x5c')];if(_0x18ae0f[_0xdfd2('0x18')][_0x8fe079]){if(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x5d')]){_0x18ae0f['voiceQueues'][_0x8fe079]['unmanaged']+=0x1;}if(_0x1f7665[_0x4d4f1d][_0x2d9382]['queuecallerabandon']){_0x18ae0f[_0xdfd2('0x18')][_0x8fe079][_0xdfd2('0x36')]+=0x1;}_0x18ae0f['voiceQueues'][_0x8fe079]['sumHoldTime']+=moment(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x5e')])[_0xdfd2('0x5f')](moment(_0x1f7665[_0x4d4f1d][_0x2d9382]['queuecallerjoinAt']),'seconds')||0x0;if(_0x2d9382===_0x1f7665[_0x4d4f1d][_0xdfd2('0x46')]-0x1){_0x18ae0f[_0xdfd2('0x18')][_0x8fe079][_0xdfd2('0x38')]+=moment(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x60')]||_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x61')]||_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x62')])['diff'](moment(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x63')]),_0xdfd2('0x64'))||0x0;_0x18ae0f[_0xdfd2('0x18')][_0x8fe079][_0xdfd2('0x2f')]+=0x1;if(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x65')]){_0x18ae0f[_0xdfd2('0x18')][_0x8fe079]['answered']+=0x1;_0x18ae0f['voiceQueues'][_0x8fe079]['sumBillable']+=moment(_0x1f7665[_0x4d4f1d][_0x2d9382]['queuecallercompleteAt'])[_0xdfd2('0x5f')](moment(_0x1f7665[_0x4d4f1d][_0x2d9382][_0xdfd2('0x5e')]),_0xdfd2('0x64'))||0x0;}}else{_0x18ae0f[_0xdfd2('0x18')][_0x8fe079]['sumDuration']+=_0x18ae0f[_0xdfd2('0x18')][_0x8fe079]['sumHoldTime']||0x0;}}}}}}return _0x18ae0f['voiceQueues'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x66')]=function(){var _0x19ffd9=this;return function(_0x269fb5){clearVoiceCallReports(_0x19ffd9['outbound']);if(_0x269fb5){for(var _0x26999f=0x0;_0x26999f<_0x269fb5[_0xdfd2('0x46')];_0x26999f+=0x1){_0x19ffd9[_0xdfd2('0x1b')][_0xdfd2('0x2f')]+=0x1;_0x19ffd9[_0xdfd2('0x1b')][_0xdfd2('0x38')]+=_0x269fb5[_0x26999f]['duration'];if(_0x269fb5[_0x26999f][_0xdfd2('0x67')]===_0xdfd2('0x68')){_0x19ffd9[_0xdfd2('0x1b')]['answered']+=0x1;_0x19ffd9[_0xdfd2('0x1b')]['sumHoldTime']+=_0x269fb5[_0x26999f][_0xdfd2('0x69')]-_0x269fb5[_0x26999f][_0xdfd2('0x6a')]||0x0;_0x19ffd9['outbound']['sumBillable']+=_0x269fb5[_0x26999f][_0xdfd2('0x6a')];}}}return _0x19ffd9['outbound'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x6b')]=function(){var _0x3a833b=this;return function(_0x3873c5){if(_0x3873c5){freeIsNotKey(_0x3873c5,_0x3a833b['campaigns'],'name');for(var _0xddeb19=0x0,_0x20bdcc={};_0xddeb19<_0x3873c5[_0xdfd2('0x46')];_0xddeb19+=0x1){_0x20bdcc=_0x3873c5[_0xddeb19];if(_[_0xdfd2('0x4a')](_0x3a833b[_0xdfd2('0x1a')][_0x20bdcc['name']])){_0x3a833b[_0xdfd2('0x1a')][_0x20bdcc[_0xdfd2('0x2b')]]=new Campaign(_0x20bdcc);}else{_0x3a833b['mergeFromDatabase'](_0x3a833b[_0xdfd2('0x1a')][_0x20bdcc[_0xdfd2('0x2b')]],_0x20bdcc);_0x3a833b[_0xdfd2('0x1a')][_0x20bdcc[_0xdfd2('0x2b')]][_0xdfd2('0x6c')]=_0x20bdcc[_0xdfd2('0x6d')]?_0x20bdcc[_0xdfd2('0x6d')][_0xdfd2('0x2b')]:undefined;}}}return _0x3a833b[_0xdfd2('0x1a')];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x6e')]=function(){var _0x1c79ab=this;return function(_0x3f20bf){if(_0x3f20bf){freeIsNotKey(_0x3f20bf,_0x1c79ab[_0xdfd2('0x1c')],'id');for(var _0x787002=0x0,_0x29bd45={};_0x787002<_0x3f20bf[_0xdfd2('0x46')];_0x787002+=0x1){_0x29bd45=_0x3f20bf[_0x787002];if(_['isUndefined'](_0x1c79ab[_0xdfd2('0x1c')][_0x29bd45['id']])){_0x1c79ab[_0xdfd2('0x1c')][_0x29bd45['id']]=new VoiceExtension(_0x29bd45);}else{_0x1c79ab[_0xdfd2('0x47')](_0x1c79ab[_0xdfd2('0x1c')][_0x29bd45['id']],_0x29bd45);}}}return _0x1c79ab[_0xdfd2('0x1c')];};};Realtime['prototype'][_0xdfd2('0x6f')]=function(){var _0x5b5338=this;return function(_0x3ffc5a){clearCampaigns(_0x5b5338[_0xdfd2('0x1a')]);for(var _0x3b3585=0x0;_0x3b3585<_0x3ffc5a[_0xdfd2('0x46')];_0x3b3585+=0x1){_[_0xdfd2('0x59')](_0x5b5338[_0xdfd2('0x1a')][_0x3ffc5a[_0x3b3585]['name']],_0x3ffc5a[_0x3b3585]);}return _0x5b5338['campaigns'];};};Realtime[_0xdfd2('0x45')][_0xdfd2('0x70')]=function(){var _0x49ac15=this;return function(_0x53cf57){if(_0x53cf57){freeIsNotKey(_0x53cf57,_0x49ac15[_0xdfd2('0x27')],'id');for(var _0x49686e=0x0,_0x5b317c={},_0x16f4b9={};_0x49686e<_0x53cf57['length'];_0x49686e+=0x1){_0x5b317c=_0x53cf57[_0x49686e];if(_['isUndefined'](_0x49ac15[_0xdfd2('0x27')][_0x5b317c['id']])){_0x49ac15[_0xdfd2('0x27')][_0x5b317c['id']]=new FaxAccount(_0x5b317c);}else{_0x49ac15[_0xdfd2('0x47')](_0x49ac15[_0xdfd2('0x27')][_0x5b317c['id']],_0x5b317c);}}}return _0x49ac15[_0xdfd2('0x27')];};};module[_0xdfd2('0x71')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1c87fe1..ec888d0 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 _0x027c=['moment','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','findAgent','find','accountcode','isNil','interface','format','SIP/%s','name','length','connectedlinenum','assigned','lastAssignedTo','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','type','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','destinationchannel','channel','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','monitors','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceDialReport','startsWith','Local','indexOf','mobile','phone','lastIndexOf','attendedTransfer','exports','lodash'];(function(_0x1dda86,_0x1262df){var _0xda5a78=function(_0xe59f63){while(--_0xe59f63){_0x1dda86['push'](_0x1dda86['shift']());}};_0xda5a78(++_0x1262df);}(_0x027c,0x1e5));var _0xc027=function(_0xa86109,_0xade7cf){_0xa86109=_0xa86109-0x0;var _0x13af7e=_0x027c[_0xa86109];return _0x13af7e;};'use strict';var BPromise=require('bluebird');var _=require(_0xc027('0x0'));var moment=require(_0xc027('0x1'));var util=require(_0xc027('0x2'));var config=require(_0xc027('0x3'));var logger=require(_0xc027('0x4'))('ami');var ami=require(_0xc027('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc027('0x6'));var RpcMemberReport=require(_0xc027('0x7'));var RpcVoiceQueueReport=require(_0xc027('0x8'));var RpcVoiceRecording=require(_0xc027('0x9'));var RpcVoiceTransferReport=require(_0xc027('0xa'));var VoiceQueueReport=require(_0xc027('0xb'));var VoiceCallReport=require(_0xc027('0xc'));var VoiceAgentReport=require(_0xc027('0xd'));var VoiceDialReport=require(_0xc027('0xe'));var UserReport=require(_0xc027('0xf'));function Report(_0x978c01){this[_0xc027('0x10')]=_0x978c01;this[_0xc027('0x11')]=_0x978c01[_0xc027('0x11')];this[_0xc027('0x12')]=_0x978c01[_0xc027('0x12')];}Report[_0xc027('0x13')][_0xc027('0x14')]=function(_0x794e8d){var _0x2c6de1=new VoiceQueueReport(this[_0xc027('0x10')]);var _0x55611e=new VoiceAgentReport(this['realtime']);var _0x22e37f=new VoiceDialReport(this['realtime']);var _0x1bc3da=new VoiceCallReport(this['realtime']);var _0x1ffa9f=new UserReport(this[_0xc027('0x10')]);if(config[_0xc027('0x15')]&&config[_0xc027('0x15')][_0xc027('0x16')]){ami['on']('custom:voiceQueueReport',this[_0xc027('0x17')][_0xc027('0x18')](this));ami['on'](_0xc027('0x19'),this[_0xc027('0x1a')][_0xc027('0x18')](this));ami['on'](_0xc027('0x1b'),this[_0xc027('0x1c')][_0xc027('0x18')](this));ami['on'](_0xc027('0x1d'),this['voiceDialReport']['bind'](this));ami['on'](_0xc027('0x1e'),this[_0xc027('0x1f')][_0xc027('0x18')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xc027('0x18')](this));}};Report[_0xc027('0x13')][_0xc027('0x20')]=function(_0x3b904b){var _0x728a4d=undefined;_0x728a4d=_[_0xc027('0x21')](this[_0xc027('0x11')],function(_0x5dbb49){return _0x5dbb49[_0xc027('0x22')]==_0x3b904b||_0x5dbb49['name']==_0x3b904b;});if(_[_0xc027('0x23')](_0x728a4d)){var _0x1a8a1e=_[_0xc027('0x21')](this['telephones'],function(_0x5348f7){return _0x5348f7[_0xc027('0x22')]==_0x3b904b||_0x5348f7['name']==_0x3b904b;});if(_0x1a8a1e){_0x728a4d=_[_0xc027('0x21')](this[_0xc027('0x11')],function(_0x231182){return _0x231182[_0xc027('0x24')]==util[_0xc027('0x25')](_0xc027('0x26'),_0x1a8a1e[_0xc027('0x27')]);});}}return _0x728a4d;};Report['prototype']['voiceQueueReport']=function(_0x345d13){for(var _0x100128=0x0;_0x100128<_0x345d13[_0xc027('0x28')];_0x100128+=0x1){var _0x56cb4c=this[_0xc027('0x20')](_0x345d13[_0x100128][_0xc027('0x29')]);if(_0x56cb4c){_0x345d13[_0x100128][_0xc027('0x22')]=_0x56cb4c['accountcode'];_0x345d13[_0x100128][_0xc027('0x2a')]=!![];_0x345d13[_0x100128][_0xc027('0x2b')]=_0x56cb4c[_0xc027('0x27')];_0x345d13[_0x100128][_0xc027('0x24')]=_[_0xc027('0x23')](_0x56cb4c[_0xc027('0x24')])?util['format'](_0xc027('0x26'),_0x56cb4c[_0xc027('0x27')]):_0x56cb4c['interface'];if(_0x345d13[_0x100128]['queuecallercomplete']){_0x345d13[_0x100128]['queuecallercompleteAt']=moment()['format'](_0xc027('0x2c'));}if(_0x345d13[_0x100128][_0xc027('0x2d')]){_0x345d13[_0x100128][_0xc027('0x2e')]=moment()[_0xc027('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc027('0x17')](_0x345d13[_0x100128]);}RpcVoiceQueueReport[_0xc027('0x2f')](_0x345d13[_0x100128]);}};function extractCalleridNumber(_0x3c5ec4){var _0x3adc4c=_0x3c5ec4[_0xc027('0x30')](/<(.*?)>/);return _0x3adc4c?_0x3adc4c[0x1]:_0x3c5ec4;}Report[_0xc027('0x13')]['voiceCallReport']=function(_0x302f2a){_0x302f2a[_0xc027('0x31')]=_0x302f2a['destination']||_0x302f2a['exten'];if(_0x302f2a[_0xc027('0x32')]=='dialer'){_0x302f2a['lastapplication']=_0xc027('0x33');_0x302f2a[_0xc027('0x34')]=_0x302f2a[_0xc027('0x33')];if(_0x302f2a[_0xc027('0x35')]==_0xc027('0x36')){_0x302f2a[_0xc027('0x22')]='';_0x302f2a[_0xc027('0x31')]=extractCalleridNumber(_0x302f2a[_0xc027('0x37')]);}else if(_0x302f2a[_0xc027('0x35')]==_0xc027('0x38')){if(_0x302f2a[_0xc027('0x31')]==_0xc027('0x39')){_0x302f2a[_0xc027('0x31')]=extractCalleridNumber(_0x302f2a['calleridpreview']);_0x302f2a[_0xc027('0x3a')]=_0x302f2a['originatecalleridnum'];_0x302f2a[_0xc027('0x3b')]=[_0x302f2a[_0xc027('0x3c')],_0x302f2a['channel']=_0x302f2a[_0xc027('0x3b')]][0x0];_0x302f2a[_0xc027('0x37')]=_0x302f2a['calleridpreview'];}else{_0x302f2a[_0xc027('0x31')]=_0x302f2a[_0xc027('0x3a')];_0x302f2a['calleridnum']=_0x302f2a[_0xc027('0x3d')];if(_0x302f2a[_0xc027('0x3e')]=='ANSWERED'){_0x302f2a[_0xc027('0x22')]=_0x302f2a[_0xc027('0x29')];}else{_0x302f2a[_0xc027('0x22')]='';}}}}else{_0x302f2a['callerid']=util[_0xc027('0x25')](_0xc027('0x3f'),_0x302f2a[_0xc027('0x40')],_0x302f2a[_0xc027('0x3a')]);}RpcVoiceCallReport['create'](_0x302f2a);if(_0x302f2a['monitor']){for(var _0xdbdf4b=0x0;_0xdbdf4b<_0x302f2a[_0xc027('0x41')]['length'];_0xdbdf4b+=0x1){_0x302f2a['monitorFilename']=_0x302f2a[_0xc027('0x41')][_0xdbdf4b][_0xc027('0x42')];_0x302f2a[_0xc027('0x43')]=_0x302f2a[_0xc027('0x41')][_0xdbdf4b][_0xc027('0x43')];if(_0x302f2a[_0xc027('0x44')]==_0xc027('0x39')){_0x302f2a[_0xc027('0x3a')]=_0x302f2a[_0xc027('0x29')];_0x302f2a[_0xc027('0x40')]=_0x302f2a[_0xc027('0x45')];_0x302f2a[_0xc027('0x29')]=_0x302f2a[_0xc027('0x22')];_0x302f2a[_0xc027('0x45')]=_0x302f2a[_0xc027('0x46')];_0x302f2a['exten']=_0x302f2a['originatecalleridnum'];}else if(_0x302f2a[_0xc027('0x44')]==_0xc027('0x47')){_0x302f2a['calleridnum']=_0x302f2a[_0xc027('0x31')];_0x302f2a[_0xc027('0x44')]=_0x302f2a[_0xc027('0x3d')];}RpcVoiceRecording[_0xc027('0x2f')](_0x302f2a);}}};Report['prototype'][_0xc027('0x1c')]=function(_0x2f9e87){if(_['isArray'](_0x2f9e87)){_0x2f9e87['forEach'](function(_0xd8349f){RpcVoiceAgentReport['create'](_0xd8349f);});}else{RpcVoiceAgentReport[_0xc027('0x2f')](_0x2f9e87);}};Report[_0xc027('0x13')][_0xc027('0x48')]=function(_0x2bb4c4){RpcVoiceDialReport[_0xc027('0x2f')](_0x2bb4c4);var _0x1b233e=undefined;var _0x2e3117=_0x2bb4c4['channel'];if(_[_0xc027('0x49')](_0x2e3117,_0xc027('0x4a'))){var _0x2b48a7=_0x2e3117['substring'](_0x2e3117[_0xc027('0x4b')]('/')+0x1,_0x2e3117[_0xc027('0x4b')]('@'));_0x1b233e=_[_0xc027('0x21')](this['agents'],function(_0x2e645e){return _0x2e645e[_0xc027('0x4c')]==_0x2b48a7||_0x2e645e[_0xc027('0x4d')]==_0x2b48a7||_0x2e645e[_0xc027('0x22')]==_0x2b48a7;});}else{var _0x2b48a7=_0x2e3117['substring'](_0x2e3117[_0xc027('0x4b')]('/')+0x1,_0x2e3117[_0xc027('0x4e')]('-'));_0x1b233e=this[_0xc027('0x20')](_0x2b48a7);}if(_0x1b233e){_0x2bb4c4['interface']=_[_0xc027('0x23')](_0x1b233e[_0xc027('0x24')])?util['format'](_0xc027('0x26'),_0x1b233e[_0xc027('0x27')]):_0x1b233e[_0xc027('0x24')];_0x2bb4c4[_0xc027('0x46')]=_0x1b233e[_0xc027('0x27')];_0x2bb4c4[_0xc027('0x22')]=_0x1b233e['accountcode'];RpcMemberReport[_0xc027('0x48')](_0x2bb4c4);}};Report[_0xc027('0x13')][_0xc027('0x1f')]=function(_0x4914c1){RpcVoiceTransferReport[_0xc027('0x1f')](_0x4914c1);};Report[_0xc027('0x13')][_0xc027('0x4f')]=function(_0x5ed29c){RpcVoiceTransferReport[_0xc027('0x4f')](_0x5ed29c);};module[_0xc027('0x50')]=Report; \ No newline at end of file +var _0xba4c=['disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','dialer','lastdata','queue','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','callerid','originatecalleridnum','disposition','calleridname','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','lastIndexOf','bluebird','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr'];(function(_0x585423,_0x34b2df){var _0x2d4de7=function(_0x4ed08a){while(--_0x4ed08a){_0x585423['push'](_0x585423['shift']());}};_0x2d4de7(++_0x34b2df);}(_0xba4c,0x8f));var _0xcba4=function(_0x5d38ce,_0xd88f81){_0x5d38ce=_0x5d38ce-0x0;var _0x5859ce=_0xba4c[_0x5d38ce];return _0x5859ce;};'use strict';var BPromise=require(_0xcba4('0x0'));var _=require(_0xcba4('0x1'));var moment=require('moment');var util=require(_0xcba4('0x2'));var config=require(_0xcba4('0x3'));var logger=require(_0xcba4('0x4'))(_0xcba4('0x5'));var ami=require(_0xcba4('0x6'));var RpcVoiceAgentReport=require(_0xcba4('0x7'));var RpcVoiceCallReport=require(_0xcba4('0x8'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xcba4('0x9'));var RpcVoiceQueueReport=require(_0xcba4('0xa'));var RpcVoiceRecording=require(_0xcba4('0xb'));var RpcVoiceTransferReport=require(_0xcba4('0xc'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xcba4('0xd'));var VoiceDialReport=require(_0xcba4('0xe'));var UserReport=require('./userReport');function Report(_0x5a7898){this[_0xcba4('0xf')]=_0x5a7898;this[_0xcba4('0x10')]=_0x5a7898['agents'];this[_0xcba4('0x11')]=_0x5a7898[_0xcba4('0x11')];}Report[_0xcba4('0x12')][_0xcba4('0x13')]=function(_0x258480){var _0x559bb7=new VoiceQueueReport(this[_0xcba4('0xf')]);var _0x35d3d3=new VoiceAgentReport(this[_0xcba4('0xf')]);var _0x3b97a2=new VoiceDialReport(this[_0xcba4('0xf')]);var _0x455839=new VoiceCallReport(this[_0xcba4('0xf')]);var _0x521253=new UserReport(this[_0xcba4('0xf')]);if(config['xdr']&&config[_0xcba4('0x14')][_0xcba4('0x15')]){ami['on'](_0xcba4('0x16'),this[_0xcba4('0x17')][_0xcba4('0x18')](this));ami['on'](_0xcba4('0x19'),this[_0xcba4('0x1a')]['bind'](this));ami['on'](_0xcba4('0x1b'),this['voiceAgentReport'][_0xcba4('0x18')](this));ami['on'](_0xcba4('0x1c'),this['voiceDialReport'][_0xcba4('0x18')](this));ami['on']('blindtransfer',this[_0xcba4('0x1d')][_0xcba4('0x18')](this));ami['on']('attendedtransfer',this[_0xcba4('0x1e')]['bind'](this));}};Report[_0xcba4('0x12')][_0xcba4('0x1f')]=function(_0x1f23dc){var _0x10cf2e=undefined;_0x10cf2e=_[_0xcba4('0x20')](this[_0xcba4('0x10')],function(_0x2d57b7){return _0x2d57b7[_0xcba4('0x21')]==_0x1f23dc||_0x2d57b7[_0xcba4('0x22')]==_0x1f23dc;});if(_[_0xcba4('0x23')](_0x10cf2e)){var _0xc38b7a=_[_0xcba4('0x20')](this[_0xcba4('0x11')],function(_0x262ed9){return _0x262ed9['accountcode']==_0x1f23dc||_0x262ed9[_0xcba4('0x22')]==_0x1f23dc;});if(_0xc38b7a){_0x10cf2e=_[_0xcba4('0x20')](this[_0xcba4('0x10')],function(_0x186b59){return _0x186b59['interface']==util[_0xcba4('0x24')](_0xcba4('0x25'),_0xc38b7a[_0xcba4('0x22')]);});}}return _0x10cf2e;};Report[_0xcba4('0x12')]['voiceQueueReport']=function(_0x2e132a){for(var _0x385ac7=0x0;_0x385ac7<_0x2e132a[_0xcba4('0x26')];_0x385ac7+=0x1){var _0x10b720=this[_0xcba4('0x1f')](_0x2e132a[_0x385ac7][_0xcba4('0x27')]);if(_0x10b720){_0x2e132a[_0x385ac7][_0xcba4('0x21')]=_0x10b720[_0xcba4('0x21')];_0x2e132a[_0x385ac7]['assigned']=!![];_0x2e132a[_0x385ac7][_0xcba4('0x28')]=_0x10b720['name'];_0x2e132a[_0x385ac7][_0xcba4('0x29')]=_['isNil'](_0x10b720[_0xcba4('0x29')])?util[_0xcba4('0x24')]('SIP/%s',_0x10b720['name']):_0x10b720[_0xcba4('0x29')];if(_0x2e132a[_0x385ac7][_0xcba4('0x2a')]){_0x2e132a[_0x385ac7][_0xcba4('0x2b')]=moment()[_0xcba4('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2e132a[_0x385ac7][_0xcba4('0x2c')]){_0x2e132a[_0x385ac7]['queuecallerexitAt']=moment()[_0xcba4('0x24')](_0xcba4('0x2d'));}RpcMemberReport[_0xcba4('0x17')](_0x2e132a[_0x385ac7]);}RpcVoiceQueueReport[_0xcba4('0x2e')](_0x2e132a[_0x385ac7]);}};function extractCalleridNumber(_0xc5d13f){var _0x5bf8e6=_0xc5d13f[_0xcba4('0x2f')](/<(.*?)>/);return _0x5bf8e6?_0x5bf8e6[0x1]:_0xc5d13f;}Report['prototype'][_0xcba4('0x1a')]=function(_0x58e37d){_0x58e37d['destination']=_0x58e37d[_0xcba4('0x30')]||_0x58e37d[_0xcba4('0x31')];if(_0x58e37d[_0xcba4('0x32')]==_0xcba4('0x33')){_0x58e37d['lastapplication']='queue';_0x58e37d[_0xcba4('0x34')]=_0x58e37d[_0xcba4('0x35')];if(_0x58e37d[_0xcba4('0x36')]=='from-voip-provider'){_0x58e37d[_0xcba4('0x21')]='';_0x58e37d[_0xcba4('0x30')]=extractCalleridNumber(_0x58e37d['callerid']);}else if(_0x58e37d[_0xcba4('0x36')]==_0xcba4('0x37')){if(_0x58e37d[_0xcba4('0x30')]==_0xcba4('0x38')){_0x58e37d[_0xcba4('0x30')]=extractCalleridNumber(_0x58e37d[_0xcba4('0x39')]);_0x58e37d[_0xcba4('0x3a')]=_0x58e37d['originatecalleridnum'];_0x58e37d[_0xcba4('0x3b')]=[_0x58e37d['channel'],_0x58e37d[_0xcba4('0x3c')]=_0x58e37d[_0xcba4('0x3b')]][0x0];_0x58e37d[_0xcba4('0x3d')]=_0x58e37d[_0xcba4('0x39')];}else{_0x58e37d[_0xcba4('0x30')]=_0x58e37d[_0xcba4('0x3a')];_0x58e37d['calleridnum']=_0x58e37d[_0xcba4('0x3e')];if(_0x58e37d[_0xcba4('0x3f')]=='ANSWERED'){_0x58e37d[_0xcba4('0x21')]=_0x58e37d['connectedlinenum'];}else{_0x58e37d['accountcode']='';}}}}else{_0x58e37d['callerid']=util[_0xcba4('0x24')]('\x22%s\x22\x20<%s>',_0x58e37d[_0xcba4('0x40')],_0x58e37d['calleridnum']);}RpcVoiceCallReport[_0xcba4('0x2e')](_0x58e37d);if(_0x58e37d[_0xcba4('0x41')]){for(var _0x41573f=0x0;_0x41573f<_0x58e37d[_0xcba4('0x42')][_0xcba4('0x26')];_0x41573f+=0x1){_0x58e37d[_0xcba4('0x43')]=_0x58e37d[_0xcba4('0x42')][_0x41573f][_0xcba4('0x44')];_0x58e37d[_0xcba4('0x45')]=_0x58e37d['monitors'][_0x41573f][_0xcba4('0x45')];if(_0x58e37d[_0xcba4('0x31')]==_0xcba4('0x38')){_0x58e37d['calleridnum']=_0x58e37d[_0xcba4('0x27')];_0x58e37d[_0xcba4('0x40')]=_0x58e37d[_0xcba4('0x46')];_0x58e37d['connectedlinenum']=_0x58e37d['accountcode'];_0x58e37d['connectedlinename']=_0x58e37d[_0xcba4('0x47')];_0x58e37d[_0xcba4('0x31')]=_0x58e37d[_0xcba4('0x3e')];}else if(_0x58e37d[_0xcba4('0x31')]==_0xcba4('0x48')){_0x58e37d[_0xcba4('0x3a')]=_0x58e37d[_0xcba4('0x30')];_0x58e37d[_0xcba4('0x31')]=_0x58e37d[_0xcba4('0x3e')];}RpcVoiceRecording[_0xcba4('0x2e')](_0x58e37d);}}};Report['prototype'][_0xcba4('0x49')]=function(_0x2d4c8f){if(_[_0xcba4('0x4a')](_0x2d4c8f)){_0x2d4c8f[_0xcba4('0x4b')](function(_0x29094b){RpcVoiceAgentReport[_0xcba4('0x2e')](_0x29094b);});}else{RpcVoiceAgentReport[_0xcba4('0x2e')](_0x2d4c8f);}};Report[_0xcba4('0x12')][_0xcba4('0x4c')]=function(_0x30a08f){RpcVoiceDialReport[_0xcba4('0x2e')](_0x30a08f);var _0xcf6b59=undefined;var _0x29ed34=_0x30a08f[_0xcba4('0x3c')];if(_[_0xcba4('0x4d')](_0x29ed34,_0xcba4('0x4e'))){var _0x1f4455=_0x29ed34[_0xcba4('0x4f')](_0x29ed34[_0xcba4('0x50')]('/')+0x1,_0x29ed34[_0xcba4('0x50')]('@'));_0xcf6b59=_[_0xcba4('0x20')](this[_0xcba4('0x10')],function(_0x4e5fa7){return _0x4e5fa7['mobile']==_0x1f4455||_0x4e5fa7['phone']==_0x1f4455||_0x4e5fa7[_0xcba4('0x21')]==_0x1f4455;});}else{var _0x1f4455=_0x29ed34['substring'](_0x29ed34[_0xcba4('0x50')]('/')+0x1,_0x29ed34[_0xcba4('0x51')]('-'));_0xcf6b59=this[_0xcba4('0x1f')](_0x1f4455);}if(_0xcf6b59){_0x30a08f[_0xcba4('0x29')]=_[_0xcba4('0x23')](_0xcf6b59['interface'])?util[_0xcba4('0x24')](_0xcba4('0x25'),_0xcf6b59[_0xcba4('0x22')]):_0xcf6b59[_0xcba4('0x29')];_0x30a08f['membername']=_0xcf6b59[_0xcba4('0x22')];_0x30a08f[_0xcba4('0x21')]=_0xcf6b59[_0xcba4('0x21')];RpcMemberReport['voiceDialReport'](_0x30a08f);}};Report['prototype']['blindTransfer']=function(_0x1b6f63){RpcVoiceTransferReport['blindTransfer'](_0x1b6f63);};Report[_0xcba4('0x12')][_0xcba4('0x1e')]=function(_0x24cfd7){RpcVoiceTransferReport['attendedTransfer'](_0x24cfd7);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index ad71148..862e7fc 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 _0x3152=['redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','actionDeviceStateList','catch','prototype','isNotNull','isUndefined','emit','username','state','event','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','stateTime','toNumber','format','updateStatusRealtime','telephone:save','trunk:%s','startsWith','Queue','Local','substring','indexOf','find','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','telephone:%s','[syncPeerStatus][UserReport]','exports','moment','bluebird','util','ioredis','../../../config/logger','ami','../ami'];(function(_0x2bc2f8,_0x5d446f){var _0x4a839d=function(_0x114a89){while(--_0x114a89){_0x2bc2f8['push'](_0x2bc2f8['shift']());}};_0x4a839d(++_0x5d446f);}(_0x3152,0xb9));var _0x2315=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x3152[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var moment=require(_0x2315('0x0'));var BPromise=require(_0x2315('0x1'));var util=require(_0x2315('0x2'));var Redis=require(_0x2315('0x3'));var config=require('../../../config/environment');var logger=require(_0x2315('0x4'))(_0x2315('0x5'));var ami=require(_0x2315('0x6'));config[_0x2315('0x7')]=_[_0x2315('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2315('0x9'))(new Redis(config[_0x2315('0x7')]));function UserReport(_0x2bde0b){this[_0x2315('0xa')]=_0x2bde0b['trunks'];this[_0x2315('0xb')]=_0x2bde0b[_0x2315('0xb')];this[_0x2315('0xc')]=_0x2bde0b[_0x2315('0xc')];ami['on'](_0x2315('0xd'),this[_0x2315('0xe')]['bind'](this));ami['on'](_0x2315('0xf'),this[_0x2315('0xe')]['bind'](this));ami['on'](_0x2315('0x10'),this[_0x2315('0x11')]['bind'](this));ami['on'](_0x2315('0x12'),this[_0x2315('0x13')]['bind'](this));this[_0x2315('0x14')]();return BPromise[_0x2315('0x15')]()[_0x2315('0x16')](ami[_0x2315('0x17')]())['then'](ami['actionDeviceStateList']())[_0x2315('0x16')](ami[_0x2315('0x18')]())['catch'](loggerCatch(_0x2315('0x19')));}function loggerCatch(_0x31dc7c){return function(_0x4441ce){logger[_0x2315('0x1a')](_0x31dc7c,util[_0x2315('0x1b')](_0x4441ce,{'showHidden':![],'depth':null}));};}UserReport['prototype']['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0x2315('0x15')]()[_0x2315('0x16')](ami[_0x2315('0x17')]())[_0x2315('0x16')](ami[_0x2315('0x1c')]())[_0x2315('0x16')](ami[_0x2315('0x18')]())[_0x2315('0x1d')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0x2315('0x1e')][_0x2315('0x1f')]=function(_0x13b365){return _0x13b365!==null&&!_[_0x2315('0x20')](_0x13b365);};UserReport[_0x2315('0x1e')][_0x2315('0x21')]=function(_0x4f9b32,_0x9ed065,_0xf66614){io['to'](_0x4f9b32)[_0x2315('0x21')](_0x9ed065,_0xf66614);};UserReport['prototype'][_0x2315('0xe')]=function(_0x41ff3a){try{if(this['isNotNull'](_0x41ff3a)){var _0x3ca418=_['find'](this['trunks'],{'registry':_0x41ff3a[_0x2315('0x22')]});if(_0x3ca418){_0x41ff3a['stateRegistry']=_0x41ff3a[_0x2315('0x23')];_['merge'](_0x3ca418,_['omit'](_0x41ff3a,[_0x2315('0x24'),'actionid',_0x2315('0x22'),'state']));this[_0x2315('0x21')](util['format']('trunk:%s',_0x3ca418[_0x2315('0x25')]),_0x2315('0x26'),_0x3ca418);}}}catch(_0x39d31c){logger[_0x2315('0x1a')](_0x2315('0x27'),util[_0x2315('0x1b')](_0x39d31c,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x2315('0x11')]=function(_0x13cec7){try{if(this[_0x2315('0x1f')](_0x13cec7)){if(this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]]){if(!this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x29')]||_0x13cec7[_0x2315('0x23')][_0x2315('0x2a')]()=='inuse'){this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x29')]=![];if(this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]]['state']!==_0x13cec7['state'][_0x2315('0x2a')]()){this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x2b')]=_[_0x2315('0x2c')](moment()[_0x2315('0x2d')]('x'));}this[_0x2315('0xb')][_0x13cec7['device']][_0x2315('0x23')]=_0x13cec7['state'][_0x2315('0x2a')]();this[_0x2315('0xb')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x2e')](_0x13cec7);}}else if(this['telephones'][_0x13cec7['device']]){if(this[_0x2315('0xc')][_0x13cec7['device']][_0x2315('0x23')]!==_0x13cec7['state']['toLowerCase']()){this[_0x2315('0xc')][_0x13cec7[_0x2315('0x28')]]['stateTime']=_[_0x2315('0x2c')](moment()['format']('x'));}this[_0x2315('0xc')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x23')]=_0x13cec7[_0x2315('0x23')]['toLowerCase']();this[_0x2315('0x21')](util[_0x2315('0x2d')]('telephone:%s',this[_0x2315('0xc')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x25')]),_0x2315('0x2f'),this['telephones'][_0x13cec7['device']]);}else if(this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]]){if(this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x23')]!==_0x13cec7[_0x2315('0x23')][_0x2315('0x2a')]()){this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x2b')]=_[_0x2315('0x2c')](moment()[_0x2315('0x2d')]('x'));}this[_0x2315('0xa')][_0x13cec7['device']][_0x2315('0x23')]=_0x13cec7['state'][_0x2315('0x2a')]();this[_0x2315('0x21')](util[_0x2315('0x2d')](_0x2315('0x30'),this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]][_0x2315('0x25')]),_0x2315('0x26'),this[_0x2315('0xa')][_0x13cec7[_0x2315('0x28')]]);}else if(_[_0x2315('0x31')](_0x13cec7[_0x2315('0x28')],_0x2315('0x32'))){}else if(_[_0x2315('0x31')](_0x13cec7[_0x2315('0x28')],_0x2315('0x33'))){var _0x5b9b24=_0x13cec7['device'];var _0x355927=_0x5b9b24[_0x2315('0x34')](_0x5b9b24[_0x2315('0x35')]('/')+0x1,_0x5b9b24[_0x2315('0x35')]('@'));var _0x4a831f=_[_0x2315('0x36')](this[_0x2315('0xb')],function(_0x109ffd){return _0x109ffd['mobile']==_0x355927||_0x109ffd['phone']==_0x355927||_0x109ffd[_0x2315('0x37')]==_0x355927;});if(_0x4a831f){if(_0x4a831f[_0x2315('0x23')]!==_0x13cec7['state'][_0x2315('0x2a')]()){_0x4a831f['stateTime']=_[_0x2315('0x2c')](moment()[_0x2315('0x2d')]('x'));}_0x4a831f[_0x2315('0x23')]=_0x13cec7[_0x2315('0x23')]['toLowerCase']();_0x4a831f[_0x2315('0x29')]=!![];_0x4a831f['updateStatusRealtime'](_0x13cec7);}}else{}}}catch(_0x29da66){logger[_0x2315('0x1a')](_0x2315('0x38'),util[_0x2315('0x1b')](_0x29da66,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x2315('0x13')]=function(_0x28324a){try{if(this[_0x2315('0x1f')](_0x28324a)&&this[_0x2315('0x1f')](_0x28324a[_0x2315('0x12')])){if(this[_0x2315('0xb')][_0x28324a[_0x2315('0x39')]]){if(!this['agents'][_0x28324a['peer']][_0x2315('0x29')]||_0x28324a[_0x2315('0x12')]['toLowerCase']()==_0x2315('0x3a')){this['agents'][_0x28324a[_0x2315('0x39')]]['local']=![];this[_0x2315('0xb')][_0x28324a['peer']][_0x2315('0x3b')]=_0x28324a['peerstatus'][_0x2315('0x2a')]();this[_0x2315('0xb')][_0x28324a['peer']][_0x2315('0x3c')]=_0x28324a[_0x2315('0x3c')];this[_0x2315('0xb')][_0x28324a[_0x2315('0x39')]][_0x2315('0x2e')](_0x28324a);}}else if(this['telephones'][_0x28324a[_0x2315('0x39')]]){this['telephones'][_0x28324a[_0x2315('0x39')]][_0x2315('0x3b')]=_0x28324a[_0x2315('0x12')][_0x2315('0x2a')]();this[_0x2315('0xc')][_0x28324a[_0x2315('0x39')]][_0x2315('0x3c')]=_0x28324a['address'];this[_0x2315('0x21')](util['format'](_0x2315('0x3d'),this[_0x2315('0xc')][_0x28324a['peer']][_0x2315('0x25')]),'telephone:save',this['telephones'][_0x28324a[_0x2315('0x39')]]);}else if(this[_0x2315('0xa')][_0x28324a[_0x2315('0x39')]]){this['trunks'][_0x28324a[_0x2315('0x39')]][_0x2315('0x3b')]=_0x28324a[_0x2315('0x12')][_0x2315('0x2a')]();this[_0x2315('0xa')][_0x28324a[_0x2315('0x39')]][_0x2315('0x3c')]=_0x28324a[_0x2315('0x3c')];this[_0x2315('0x21')](util[_0x2315('0x2d')]('trunk:%s',this[_0x2315('0xa')][_0x28324a[_0x2315('0x39')]][_0x2315('0x25')]),_0x2315('0x26'),this[_0x2315('0xa')][_0x28324a[_0x2315('0x39')]]);}else{}}}catch(_0x1bd740){logger[_0x2315('0x1a')](_0x2315('0x3e'),util[_0x2315('0x1b')](_0x1bd740,{'showHidden':![],'depth':null}));}};module[_0x2315('0x3f')]=UserReport; \ No newline at end of file +var _0x410c=['trunk:save','[syncRegistry][UserReport]','inspect','isNotNull','device','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','telephone:%s','startsWith','Queue','substring','mobile','phone','accountcode','[syncDeviceState][UserReport]','syncPeerStatus','peer','registered','status','address','telephone:save','trunk:%s','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','ioredis','../../../config/environment','ami','../ami','redis','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionDeviceStateList','catch','error','actionSipPeerStatus','prototype','emit','find','username','state','merge','omit','actionid','format','name'];(function(_0x41c955,_0x309b4a){var _0x57d88b=function(_0x223d8b){while(--_0x223d8b){_0x41c955['push'](_0x41c955['shift']());}};_0x57d88b(++_0x309b4a);}(_0x410c,0x196));var _0xc410=function(_0x27c21d,_0x4de071){_0x27c21d=_0x27c21d-0x0;var _0x26378d=_0x410c[_0x27c21d];return _0x26378d;};'use strict';var _=require(_0xc410('0x0'));var moment=require(_0xc410('0x1'));var BPromise=require(_0xc410('0x2'));var util=require('util');var Redis=require(_0xc410('0x3'));var config=require(_0xc410('0x4'));var logger=require('../../../config/logger')(_0xc410('0x5'));var ami=require(_0xc410('0x6'));config[_0xc410('0x7')]=_['defaults'](config[_0xc410('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc410('0x7')]));function UserReport(_0x30d7e9){this[_0xc410('0x8')]=_0x30d7e9[_0xc410('0x8')];this[_0xc410('0x9')]=_0x30d7e9[_0xc410('0x9')];this[_0xc410('0xa')]=_0x30d7e9[_0xc410('0xa')];ami['on'](_0xc410('0xb'),this[_0xc410('0xc')]['bind'](this));ami['on']('registry',this['syncRegistry'][_0xc410('0xd')](this));ami['on'](_0xc410('0xe'),this[_0xc410('0xf')][_0xc410('0xd')](this));ami['on'](_0xc410('0x10'),this['syncPeerStatus'][_0xc410('0xd')](this));this[_0xc410('0x11')]();return BPromise[_0xc410('0x12')]()['then'](ami[_0xc410('0x13')]())[_0xc410('0x14')](ami[_0xc410('0x15')]())[_0xc410('0x14')](ami['actionSipPeerStatus']())[_0xc410('0x16')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5c6ed2){return function(_0x5698f2){logger[_0xc410('0x17')](_0x5c6ed2,util['inspect'](_0x5698f2,{'showHidden':![],'depth':null}));};}UserReport['prototype']['loopSyncRealTimeShow']=function(){setInterval(function(){BPromise[_0xc410('0x12')]()['then'](ami['actionSipShowRegistry']())[_0xc410('0x14')](ami[_0xc410('0x15')]())[_0xc410('0x14')](ami[_0xc410('0x18')]())[_0xc410('0x16')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x4aff85){return _0x4aff85!==null&&!_['isUndefined'](_0x4aff85);};UserReport[_0xc410('0x19')][_0xc410('0x1a')]=function(_0x192eab,_0xa6f110,_0x4008ce){io['to'](_0x192eab)[_0xc410('0x1a')](_0xa6f110,_0x4008ce);};UserReport[_0xc410('0x19')][_0xc410('0xc')]=function(_0x3fe7fe){try{if(this['isNotNull'](_0x3fe7fe)){var _0x2a6b42=_[_0xc410('0x1b')](this[_0xc410('0x8')],{'registry':_0x3fe7fe[_0xc410('0x1c')]});if(_0x2a6b42){_0x3fe7fe['stateRegistry']=_0x3fe7fe[_0xc410('0x1d')];_[_0xc410('0x1e')](_0x2a6b42,_[_0xc410('0x1f')](_0x3fe7fe,['event',_0xc410('0x20'),_0xc410('0x1c'),_0xc410('0x1d')]));this[_0xc410('0x1a')](util[_0xc410('0x21')]('trunk:%s',_0x2a6b42[_0xc410('0x22')]),_0xc410('0x23'),_0x2a6b42);}}}catch(_0x3a8c33){logger[_0xc410('0x17')](_0xc410('0x24'),util[_0xc410('0x25')](_0x3a8c33,{'showHidden':![],'depth':null}));}};UserReport[_0xc410('0x19')][_0xc410('0xf')]=function(_0x268a9d){try{if(this[_0xc410('0x26')](_0x268a9d)){if(this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]]){if(!this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]]['local']||_0x268a9d['state'][_0xc410('0x28')]()==_0xc410('0x29')){this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x2a')]=![];if(this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]]['state']!==_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]()){this['agents'][_0x268a9d['device']][_0xc410('0x2b')]=_[_0xc410('0x2c')](moment()[_0xc410('0x21')]('x'));}this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x1d')]=_0x268a9d[_0xc410('0x1d')]['toLowerCase']();this[_0xc410('0x9')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x2d')](_0x268a9d);}}else if(this[_0xc410('0xa')][_0x268a9d[_0xc410('0x27')]]){if(this[_0xc410('0xa')][_0x268a9d['device']][_0xc410('0x1d')]!==_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]()){this[_0xc410('0xa')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x2b')]=_['toNumber'](moment()[_0xc410('0x21')]('x'));}this[_0xc410('0xa')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x1d')]=_0x268a9d['state']['toLowerCase']();this[_0xc410('0x1a')](util[_0xc410('0x21')](_0xc410('0x2e'),this['telephones'][_0x268a9d['device']][_0xc410('0x22')]),'telephone:save',this[_0xc410('0xa')][_0x268a9d[_0xc410('0x27')]]);}else if(this[_0xc410('0x8')][_0x268a9d[_0xc410('0x27')]]){if(this[_0xc410('0x8')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x1d')]!==_0x268a9d['state'][_0xc410('0x28')]()){this['trunks'][_0x268a9d['device']][_0xc410('0x2b')]=_[_0xc410('0x2c')](moment()['format']('x'));}this[_0xc410('0x8')][_0x268a9d[_0xc410('0x27')]][_0xc410('0x1d')]=_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]();this[_0xc410('0x1a')](util['format']('trunk:%s',this[_0xc410('0x8')][_0x268a9d['device']][_0xc410('0x22')]),_0xc410('0x23'),this[_0xc410('0x8')][_0x268a9d[_0xc410('0x27')]]);}else if(_[_0xc410('0x2f')](_0x268a9d[_0xc410('0x27')],_0xc410('0x30'))){}else if(_['startsWith'](_0x268a9d['device'],'Local')){var _0x1895d9=_0x268a9d[_0xc410('0x27')];var _0x2bfc99=_0x1895d9[_0xc410('0x31')](_0x1895d9['indexOf']('/')+0x1,_0x1895d9['indexOf']('@'));var _0x2c04ed=_[_0xc410('0x1b')](this[_0xc410('0x9')],function(_0x438c17){return _0x438c17[_0xc410('0x32')]==_0x2bfc99||_0x438c17[_0xc410('0x33')]==_0x2bfc99||_0x438c17[_0xc410('0x34')]==_0x2bfc99;});if(_0x2c04ed){if(_0x2c04ed[_0xc410('0x1d')]!==_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]()){_0x2c04ed[_0xc410('0x2b')]=_['toNumber'](moment()[_0xc410('0x21')]('x'));}_0x2c04ed['state']=_0x268a9d[_0xc410('0x1d')][_0xc410('0x28')]();_0x2c04ed['local']=!![];_0x2c04ed['updateStatusRealtime'](_0x268a9d);}}else{}}}catch(_0x4d7b89){logger['error'](_0xc410('0x35'),util[_0xc410('0x25')](_0x4d7b89,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xc410('0x36')]=function(_0x1d7565){try{if(this[_0xc410('0x26')](_0x1d7565)&&this['isNotNull'](_0x1d7565[_0xc410('0x10')])){if(this['agents'][_0x1d7565[_0xc410('0x37')]]){if(!this[_0xc410('0x9')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x2a')]||_0x1d7565[_0xc410('0x10')][_0xc410('0x28')]()==_0xc410('0x38')){this[_0xc410('0x9')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x2a')]=![];this['agents'][_0x1d7565[_0xc410('0x37')]][_0xc410('0x39')]=_0x1d7565[_0xc410('0x10')][_0xc410('0x28')]();this[_0xc410('0x9')][_0x1d7565[_0xc410('0x37')]]['address']=_0x1d7565[_0xc410('0x3a')];this[_0xc410('0x9')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x2d')](_0x1d7565);}}else if(this[_0xc410('0xa')][_0x1d7565[_0xc410('0x37')]]){this['telephones'][_0x1d7565['peer']][_0xc410('0x39')]=_0x1d7565[_0xc410('0x10')][_0xc410('0x28')]();this[_0xc410('0xa')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x3a')]=_0x1d7565[_0xc410('0x3a')];this[_0xc410('0x1a')](util[_0xc410('0x21')](_0xc410('0x2e'),this[_0xc410('0xa')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x22')]),_0xc410('0x3b'),this[_0xc410('0xa')][_0x1d7565[_0xc410('0x37')]]);}else if(this[_0xc410('0x8')][_0x1d7565[_0xc410('0x37')]]){this[_0xc410('0x8')][_0x1d7565['peer']][_0xc410('0x39')]=_0x1d7565[_0xc410('0x10')]['toLowerCase']();this[_0xc410('0x8')][_0x1d7565['peer']][_0xc410('0x3a')]=_0x1d7565[_0xc410('0x3a')];this['emit'](util[_0xc410('0x21')](_0xc410('0x3c'),this[_0xc410('0x8')][_0x1d7565[_0xc410('0x37')]][_0xc410('0x22')]),'trunk:save',this['trunks'][_0x1d7565[_0xc410('0x37')]]);}else{}}}catch(_0x55abb5){logger[_0xc410('0x17')](_0xc410('0x3d'),util[_0xc410('0x25')](_0x55abb5,{'showHidden':![],'depth':null}));}};module[_0xc410('0x3e')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index e71464e..a7dc2c8 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 _0x56da=['varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','queue','inbound','merge','omit','event','privilege','user:%s','user:called','inspect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','pick','membername','user:agentconnect','custom:agentconnect','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','error','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','complete','talktime','transfer','acw','agentacw','acwtime','acwTimeout','interface','user:agentcomplete','custom:agentcomplete','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','isNil','includes','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','agentcompleteAt','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','syncMusicOnHoldStart','channel','substring','lastIndexOf','onhold','exports','lodash','ioredis','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete'];(function(_0x340d72,_0x14f789){var _0x5e8885=function(_0x242d17){while(--_0x242d17){_0x340d72['push'](_0x340d72['shift']());}};_0x5e8885(++_0x14f789);}(_0x56da,0xdb));var _0xa56d=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x56da[_0x2d1971];return _0x4d7759;};'use strict';var _=require(_0xa56d('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0xa56d('0x1'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xa56d('0x2'));var ami=require(_0xa56d('0x3'));config['redis']=_['defaults'](config[_0xa56d('0x4')],{'host':_0xa56d('0x5'),'port':0x18eb});var io=require(_0xa56d('0x6'))(new Redis(config[_0xa56d('0x4')]));function VoiceAgentReport(_0x58808f){this[_0xa56d('0x7')]={};this[_0xa56d('0x8')]=_0x58808f['voiceQueues'];this['agents']=_0x58808f[_0xa56d('0x9')];this[_0xa56d('0xa')]={};ami['on'](_0xa56d('0xb'),this[_0xa56d('0xc')]['bind'](this));ami['on'](_0xa56d('0xd'),this[_0xa56d('0xe')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x10'),this['syncAgentRingNoAnswer'][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x11'),this[_0xa56d('0x12')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x13'),this[_0xa56d('0x14')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x15'),this[_0xa56d('0x16')][_0xa56d('0xf')](this));ami['on']('hangup',this[_0xa56d('0x17')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x18'),this['syncMusicOnHoldStart'][_0xa56d('0xf')](this));ami['on']('musiconholdstop',this[_0xa56d('0x19')][_0xa56d('0xf')](this));ami['on'](_0xa56d('0x1a'),this['syncAttendedTransfer'][_0xa56d('0xf')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xa56d('0xf')](this));}VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x1c')]=function(_0x10dc42,_0x5ddcdb,_0xcf53){io['to'](_0x10dc42)[_0xa56d('0x1c')](_0x5ddcdb,_0xcf53);};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x1d')]=function(_0x5a86ec){return _0x5a86ec!==null&&!_[_0xa56d('0x1e')](_0x5a86ec);};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0xc')]=function(_0x16e659){try{if(this[_0xa56d('0x1d')](_0x16e659)){if(_[_0xa56d('0x1e')](this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]])){this['channels'][_0x16e659[_0xa56d('0x1f')]]={};}if(_[_0xa56d('0x1e')](this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]][_0x16e659[_0xa56d('0x20')]])){this['channels'][_0x16e659[_0xa56d('0x1f')]][_0x16e659['destuniqueid']]={'agentcalledAt':moment()[_0xa56d('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','variables':this[_0xa56d('0xa')][_0x16e659[_0xa56d('0x1f')]],'type':this['voiceQueues'][_0x16e659[_0xa56d('0x22')]]?this[_0xa56d('0x8')][_0x16e659[_0xa56d('0x22')]]['type']||_0xa56d('0x23'):'inbound'};}_[_0xa56d('0x24')](this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]][_0x16e659[_0xa56d('0x20')]],_[_0xa56d('0x25')](_0x16e659,[_0xa56d('0x26'),_0xa56d('0x27')]));ami['emit']('custom:agentcalled',this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]][_0x16e659[_0xa56d('0x20')]]);this[_0xa56d('0x1c')](util[_0xa56d('0x21')](_0xa56d('0x28'),_0x16e659['membername']),_0xa56d('0x29'),this[_0xa56d('0x7')][_0x16e659[_0xa56d('0x1f')]][_0x16e659[_0xa56d('0x20')]]);}}catch(_0x41b1e2){logger['error']('[syncAgentCalled][VoiceAgentReport]',util[_0xa56d('0x2a')](_0x41b1e2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0xe')]=function(_0x2627fa){try{if(this[_0xa56d('0x1d')](_0x2627fa)){if(this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]]){for(var _0x11cfe3 in this['channels'][_0x2627fa[_0xa56d('0x1f')]]){if(this[_0xa56d('0x7')][_0x2627fa['uniqueid']]['hasOwnProperty'](_0x11cfe3)){if(_0x2627fa[_0xa56d('0x20')]===_0x11cfe3){this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3][_0xa56d('0x2b')]=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x2d')]=_0xa56d('0x2e');this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x2f')]=_0x2627fa[_0xa56d('0x2f')];this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x30')]=_0x2627fa[_0xa56d('0x30')];this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x31')]=_0x2627fa[_0xa56d('0x31')];this['channels'][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x32')]=_0x2627fa[_0xa56d('0x32')];this['channels'][_0x2627fa['uniqueid']][_0x11cfe3]['destchannelstatedesc']=_0x2627fa['destchannelstatedesc'];_[_0xa56d('0x24')](this['agents'][_0x2627fa['interface']],_[_0xa56d('0x33')](_0x2627fa,[_0xa56d('0x22'),'destconnectedlinenum']));this[_0xa56d('0x1c')](util['format']('user:%s',_0x2627fa[_0xa56d('0x34')]),_0xa56d('0x35'),this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x2627fa[_0xa56d('0x20')]]);ami[_0xa56d('0x1c')](_0xa56d('0x36'),this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3]);}else if(!this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3][_0xa56d('0x10')]&&!this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x13')]){this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3]['agentringnoanswer']=!![];this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3]['agentringnoanswerAt']=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x37')]=_0xa56d('0x38');this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x2d')]=_0xa56d('0x38');this['channels'][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x39')]=_0x2627fa[_0xa56d('0x20')];this[_0xa56d('0x7')][_0x2627fa[_0xa56d('0x1f')]][_0x11cfe3][_0xa56d('0x3a')]=_0x2627fa[_0xa56d('0x34')];ami[_0xa56d('0x1c')](_0xa56d('0x3b'),this[_0xa56d('0x7')][_0x2627fa['uniqueid']][_0x11cfe3]);}}}}}}catch(_0x27942d){logger[_0xa56d('0x3c')](_0xa56d('0x3d'),util[_0xa56d('0x2a')](_0x27942d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa56d('0x3e')]=function(_0x301e80){try{if(this['isNotNull'](_0x301e80)){if(this[_0xa56d('0x7')][_0x301e80['uniqueid']]&&this[_0xa56d('0x7')][_0x301e80['uniqueid']][_0x301e80[_0xa56d('0x20')]]){this[_0xa56d('0x7')][_0x301e80['uniqueid']][_0x301e80[_0xa56d('0x20')]][_0xa56d('0x10')]=!![];this[_0xa56d('0x7')][_0x301e80[_0xa56d('0x1f')]][_0x301e80[_0xa56d('0x20')]][_0xa56d('0x3f')]=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x301e80[_0xa56d('0x1f')]][_0x301e80[_0xa56d('0x20')]][_0xa56d('0x37')]=_0xa56d('0x40');this[_0xa56d('0x7')][_0x301e80[_0xa56d('0x1f')]][_0x301e80[_0xa56d('0x20')]][_0xa56d('0x2d')]=_0xa56d('0x40');ami[_0xa56d('0x1c')](_0xa56d('0x41'),this[_0xa56d('0x7')][_0x301e80[_0xa56d('0x1f')]][_0x301e80[_0xa56d('0x20')]]);}}}catch(_0x58c445){logger[_0xa56d('0x3c')](_0xa56d('0x42'),util[_0xa56d('0x2a')](_0x58c445,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa56d('0x12')]=function(_0x543434){try{if(this[_0xa56d('0x1d')](_0x543434)){if(this['channels'][_0x543434['uniqueid']]){for(var _0x4b51e9 in this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]]){if(this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0xa56d('0x43')](_0x4b51e9)&&!this['channels'][_0x543434[_0xa56d('0x1f')]][_0x4b51e9]['agentringnoanswer']&&!this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0x4b51e9][_0xa56d('0x13')]){this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0x4b51e9][_0xa56d('0x10')]=!![];this[_0xa56d('0x7')][_0x543434['uniqueid']][_0x4b51e9][_0xa56d('0x3f')]=moment()['format'](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0x4b51e9]['reason']=_0xa56d('0x44');this[_0xa56d('0x7')][_0x543434[_0xa56d('0x1f')]][_0x4b51e9][_0xa56d('0x2d')]=_0xa56d('0x44');ami['emit'](_0xa56d('0x45'),this['channels'][_0x543434['uniqueid']][_0x4b51e9]);}}}}}catch(_0x40f5c2){logger[_0xa56d('0x3c')](_0xa56d('0x46'),util['inspect'](_0x40f5c2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x14')]=function(_0x4eddc5){try{if(this['isNotNull'](_0x4eddc5)){if(this['channels'][_0x4eddc5[_0xa56d('0x1f')]]){for(var _0x17771a in this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]]){if(this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0xa56d('0x43')](_0x17771a)){if(this['channels'][_0x4eddc5['uniqueid']][_0x17771a][_0xa56d('0x2b')]&&!this[_0xa56d('0x7')][_0x4eddc5['uniqueid']][_0x17771a]['agentcomplete']){this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a][_0xa56d('0x13')]=!![];this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a]['agentcompleteAt']=moment()[_0xa56d('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa56d('0x7')][_0x4eddc5['uniqueid']][_0x17771a][_0xa56d('0x2d')]=_0xa56d('0x47');this[_0xa56d('0x7')][_0x4eddc5['uniqueid']][_0x17771a][_0xa56d('0x48')]=_0x4eddc5[_0xa56d('0x48')];this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a][_0xa56d('0x37')]=_0x4eddc5[_0xa56d('0x37')]==_0xa56d('0x49')?'agent':_0x4eddc5['reason'];if(this[_0xa56d('0x8')][_0x4eddc5[_0xa56d('0x22')]]&&this['voiceQueues'][_0x4eddc5[_0xa56d('0x22')]][_0xa56d('0x4a')]){this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a][_0xa56d('0x4b')]=!![];this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a][_0xa56d('0x4c')]=this[_0xa56d('0x8')][_0x4eddc5['queue']][_0xa56d('0x4d')];}this[_0xa56d('0x9')][_0x4eddc5[_0xa56d('0x4e')]]=_[_0xa56d('0x25')](this[_0xa56d('0x9')][_0x4eddc5['interface']],['queue','destconnectedlinenum']);this[_0xa56d('0x1c')](util['format'](_0xa56d('0x28'),_0x4eddc5['membername']),_0xa56d('0x4f'),this[_0xa56d('0x7')][_0x4eddc5['uniqueid']][_0x17771a]);ami[_0xa56d('0x1c')](_0xa56d('0x50'),this[_0xa56d('0x7')][_0x4eddc5[_0xa56d('0x1f')]][_0x17771a]);}}}}}}catch(_0x355575){logger[_0xa56d('0x3c')]('[syncAgentComplete][VoiceAgentReport]',util[_0xa56d('0x2a')](_0x355575,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x16')]=function(_0x4f2f67){try{if(this[_0xa56d('0x1d')](_0x4f2f67)){this[_0xa56d('0x51')](_0x4f2f67[_0xa56d('0x1f')],_[_0xa56d('0x52')](_0x4f2f67[_0xa56d('0x53')])[0x0],_0x4f2f67[_0xa56d('0x54')]);if(this['channels'][_0x4f2f67[_0xa56d('0x1f')]]){for(var _0x35d138 in this[_0xa56d('0x7')][_0x4f2f67[_0xa56d('0x1f')]]){if(this[_0xa56d('0x7')][_0x4f2f67['uniqueid']]['hasOwnProperty'](_0x35d138)){if(_[_0xa56d('0x1e')](this[_0xa56d('0x7')][_0x4f2f67[_0xa56d('0x1f')]][_0x35d138][_0xa56d('0xa')])){this['channels'][_0x4f2f67[_0xa56d('0x1f')]][_0x35d138]['variables']={};}this[_0xa56d('0x7')][_0x4f2f67[_0xa56d('0x1f')]][_0x35d138][_0xa56d('0xa')]=this[_0xa56d('0xa')][_0x4f2f67[_0xa56d('0x1f')]];}}}}}catch(_0x24f8eb){logger['error'](_0xa56d('0x55'),util[_0xa56d('0x2a')](_0x24f8eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa56d('0x51')]=function(_0x223f8a,_0x1a20f9,_0x389f77){var _0x4b9a55=[_0xa56d('0x56'),_0xa56d('0x57'),_0xa56d('0x58'),_0xa56d('0x59'),_0xa56d('0x5a'),_0xa56d('0x5b'),_0xa56d('0x5c'),_0xa56d('0x5d'),_0xa56d('0x5e'),_0xa56d('0x5f'),'bridgepeer',_0xa56d('0x60'),_0xa56d('0x61'),_0xa56d('0x62'),'memberinterface',_0xa56d('0x63'),'membername',_0xa56d('0x64'),'memberrealtime'];if(!_[_0xa56d('0x65')](_0x1a20f9)&&!_[_0xa56d('0x66')](_0x4b9a55,_0x1a20f9)){if(_[_0xa56d('0x1e')](this[_0xa56d('0xa')][_0x223f8a])){this[_0xa56d('0xa')][_0x223f8a]={};}this[_0xa56d('0xa')][_0x223f8a][_0x1a20f9]=_0x389f77;}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x17')]=function(_0x3f2ad2){try{if(this[_0xa56d('0x1d')](_0x3f2ad2)){if(this[_0xa56d('0x7')][_0x3f2ad2[_0xa56d('0x1f')]]){for(var _0x19b5e0 in this[_0xa56d('0x7')][_0x3f2ad2['uniqueid']]){if(this[_0xa56d('0x7')][_0x3f2ad2['uniqueid']][_0xa56d('0x43')](_0x19b5e0)){if(this[_0xa56d('0x7')][_0x3f2ad2[_0xa56d('0x1f')]][_0x19b5e0][_0xa56d('0x37')]==_0xa56d('0x49')&&this[_0xa56d('0x7')][_0x3f2ad2['uniqueid']][_0x19b5e0][_0xa56d('0x13')]){this['channels'][_0x3f2ad2[_0xa56d('0x1f')]][_0x19b5e0]['agentcompleteAt']=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));}}}ami['emit']('custom:voiceAgentReport',_['values'](this['channels'][_0x3f2ad2[_0xa56d('0x1f')]]));delete this[_0xa56d('0x7')][_0x3f2ad2[_0xa56d('0x1f')]];}if(this[_0xa56d('0xa')][_0x3f2ad2[_0xa56d('0x1f')]]){delete this[_0xa56d('0xa')][_0x3f2ad2[_0xa56d('0x1f')]];}}}catch(_0x3347e5){logger[_0xa56d('0x3c')](_0xa56d('0x67'),util['inspect'](_0x3347e5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa56d('0x68')]=function(_0x103033){try{if(this[_0xa56d('0x1d')](_0x103033)){if(this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]]){for(var _0x243783 in this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]]){if(this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0xa56d('0x43')](_0x243783)){if(_0x103033[_0xa56d('0x6a')]===_0x243783){var _0x48c86d=moment();this['channels'][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x13')]=!![];this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x6b')]=moment()[_0xa56d('0x21')](_0xa56d('0x2c'));this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0x243783]['reason']=_0xa56d('0x49');this['channels'][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x2d')]=_0xa56d('0x47');this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x48')]=_0x48c86d[_0xa56d('0x6c')](this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]][_0x243783][_0xa56d('0x2b')],_0xa56d('0x6d'));}}}}if(this['channels'][_0x103033[_0xa56d('0x6e')]]){var _0x38f30f=this['channels'][_0x103033['secondtransfereruniqueid']];this[_0xa56d('0x7')][_0x103033[_0xa56d('0x6e')]]=this[_0xa56d('0x7')][_0x103033[_0xa56d('0x69')]];this[_0xa56d('0x7')][_0x103033['transfereeuniqueid']]=_0x38f30f;}}}catch(_0xe9225c){logger[_0xa56d('0x3c')](_0xa56d('0x6f'),util['inspect'](_0xe9225c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x70')]=function(_0x47edee){try{if(this[_0xa56d('0x1d')](_0x47edee)){if(this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]]){for(var _0x70a592 in this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]]){if(this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]][_0xa56d('0x43')](_0x70a592)){if(_0x47edee[_0xa56d('0x71')]===_0x70a592){var _0x8a2230=moment();this['channels'][_0x47edee[_0xa56d('0x69')]][_0x70a592][_0xa56d('0x13')]=!![];this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]][_0x70a592]['agentcompleteAt']=_0x8a2230;this['channels'][_0x47edee[_0xa56d('0x69')]][_0x70a592][_0xa56d('0x37')]=_0xa56d('0x49');this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]][_0x70a592]['lastevent']=_0xa56d('0x47');this[_0xa56d('0x7')][_0x47edee[_0xa56d('0x69')]][_0x70a592]['talktime']=_0x8a2230[_0xa56d('0x6c')](this['channels'][_0x47edee['transfereeuniqueid']][_0x70a592][_0xa56d('0x2b')],_0xa56d('0x6d'));}}}}}}catch(_0x5bfad6){logger[_0xa56d('0x3c')]('[syncBlindTransfer][VoiceAgentReport]',util[_0xa56d('0x2a')](_0x5bfad6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x72')]=function(_0x41df2c){var _0x320ff7='';try{if(this[_0xa56d('0x1d')](_0x41df2c)){if(_0x41df2c['channel']){_0x320ff7=_0x41df2c[_0xa56d('0x73')][_0xa56d('0x74')](0x0,_0x41df2c[_0xa56d('0x73')][_0xa56d('0x75')]('-'));if(this[_0xa56d('0x9')][_0x320ff7]){this[_0xa56d('0x9')][_0x320ff7][_0xa56d('0x76')]=!![];}}}}catch(_0x424b63){logger[_0xa56d('0x3c')]('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0xa56d('0x2a')](_0x424b63,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa56d('0x1b')][_0xa56d('0x19')]=function(_0x5383a8){var _0x2630a1='';try{if(this[_0xa56d('0x1d')](_0x5383a8)){if(_0x5383a8[_0xa56d('0x73')]){_0x2630a1=_0x5383a8[_0xa56d('0x73')][_0xa56d('0x74')](0x0,_0x5383a8[_0xa56d('0x73')][_0xa56d('0x75')]('-'));if(this[_0xa56d('0x9')][_0x2630a1]){this[_0xa56d('0x9')][_0x2630a1][_0xa56d('0x76')]=![];}}}}catch(_0x4633e5){logger[_0xa56d('0x3c')]('[syncMusicOnHoldStop][VoiceAgentReport]',util['inspect'](_0x4633e5,{'showHidden':![],'depth':null}));}};module[_0xa56d('0x77')]=VoiceAgentReport; \ No newline at end of file +var _0x2156=['agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','reason','answered_elsewhere','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','agentringnoanswerAt','rejected','custom:agentringnoanswer','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','talktime','transfer','agent','acw','agentacw','acwtime','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','value','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','transfereruniqueid','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentringnoanswer','syncAgentRingNoAnswer','agentcomplete','syncAgentComplete','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','emit','prototype','isUndefined','isNotNull','uniqueid','destuniqueid','format','called','variables','queue','type','inbound','merge','omit','privilege','custom:agentcalled','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','syncAgentConnect','hasOwnProperty'];(function(_0x5b4e65,_0x30fda7){var _0x22e731=function(_0x5f50b6){while(--_0x5f50b6){_0x5b4e65['push'](_0x5b4e65['shift']());}};_0x22e731(++_0x30fda7);}(_0x2156,0x134));var _0x6215=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2156[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x6215('0x0'));var moment=require('moment');var util=require(_0x6215('0x1'));var Redis=require('ioredis');var config=require(_0x6215('0x2'));var logger=require(_0x6215('0x3'))(_0x6215('0x4'));var ami=require(_0x6215('0x5'));config['redis']=_[_0x6215('0x6')](config[_0x6215('0x7')],{'host':_0x6215('0x8'),'port':0x18eb});var io=require(_0x6215('0x9'))(new Redis(config[_0x6215('0x7')]));function VoiceAgentReport(_0xffcb99){this[_0x6215('0xa')]={};this[_0x6215('0xb')]=_0xffcb99[_0x6215('0xb')];this[_0x6215('0xc')]=_0xffcb99[_0x6215('0xc')];this['variables']={};ami['on'](_0x6215('0xd'),this[_0x6215('0xe')][_0x6215('0xf')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x6215('0xf')](this));ami['on'](_0x6215('0x10'),this[_0x6215('0x11')][_0x6215('0xf')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x6215('0xf')](this));ami['on'](_0x6215('0x12'),this[_0x6215('0x13')][_0x6215('0xf')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x6215('0x14')]['bind'](this));ami['on'](_0x6215('0x15'),this[_0x6215('0x16')][_0x6215('0xf')](this));ami['on'](_0x6215('0x17'),this['syncMusicOnHoldStop'][_0x6215('0xf')](this));ami['on'](_0x6215('0x18'),this['syncAttendedTransfer'][_0x6215('0xf')](this));ami['on']('blindtransfer',this[_0x6215('0x19')][_0x6215('0xf')](this));}VoiceAgentReport['prototype'][_0x6215('0x1a')]=function(_0x106162,_0x476778,_0x29c725){io['to'](_0x106162)[_0x6215('0x1a')](_0x476778,_0x29c725);};VoiceAgentReport[_0x6215('0x1b')]['isNotNull']=function(_0x5c385f){return _0x5c385f!==null&&!_[_0x6215('0x1c')](_0x5c385f);};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0xe')]=function(_0x12f350){try{if(this[_0x6215('0x1d')](_0x12f350)){if(_[_0x6215('0x1c')](this[_0x6215('0xa')][_0x12f350[_0x6215('0x1e')]])){this[_0x6215('0xa')][_0x12f350[_0x6215('0x1e')]]={};}if(_[_0x6215('0x1c')](this[_0x6215('0xa')][_0x12f350['uniqueid']][_0x12f350[_0x6215('0x1f')]])){this[_0x6215('0xa')][_0x12f350['uniqueid']][_0x12f350['destuniqueid']]={'agentcalledAt':moment()[_0x6215('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x6215('0x21'),'variables':this[_0x6215('0x22')][_0x12f350[_0x6215('0x1e')]],'type':this['voiceQueues'][_0x12f350['queue']]?this[_0x6215('0xb')][_0x12f350[_0x6215('0x23')]][_0x6215('0x24')]||_0x6215('0x25'):_0x6215('0x25')};}_[_0x6215('0x26')](this[_0x6215('0xa')][_0x12f350['uniqueid']][_0x12f350[_0x6215('0x1f')]],_[_0x6215('0x27')](_0x12f350,['event',_0x6215('0x28')]));ami[_0x6215('0x1a')](_0x6215('0x29'),this[_0x6215('0xa')][_0x12f350[_0x6215('0x1e')]][_0x12f350[_0x6215('0x1f')]]);this[_0x6215('0x1a')](util[_0x6215('0x20')](_0x6215('0x2a'),_0x12f350[_0x6215('0x2b')]),_0x6215('0x2c'),this['channels'][_0x12f350[_0x6215('0x1e')]][_0x12f350[_0x6215('0x1f')]]);}}catch(_0x8c1500){logger[_0x6215('0x2d')](_0x6215('0x2e'),util['inspect'](_0x8c1500,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x2f')]=function(_0x3f0190){try{if(this[_0x6215('0x1d')](_0x3f0190)){if(this['channels'][_0x3f0190[_0x6215('0x1e')]]){for(var _0x426d69 in this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]]){if(this['channels'][_0x3f0190[_0x6215('0x1e')]][_0x6215('0x30')](_0x426d69)){if(_0x3f0190[_0x6215('0x1f')]===_0x426d69){this['channels'][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x31')]=moment()[_0x6215('0x20')](_0x6215('0x32'));this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x33')]=_0x6215('0x34');this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69]['holdtime']=_0x3f0190[_0x6215('0x35')];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x36')]=_0x3f0190[_0x6215('0x36')];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x37')]=_0x3f0190['connectedlinename'];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x38')]=_0x3f0190['destchannelstate'];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x39')]=_0x3f0190['destchannelstatedesc'];_[_0x6215('0x26')](this[_0x6215('0xc')][_0x3f0190[_0x6215('0x3a')]],_[_0x6215('0x3b')](_0x3f0190,[_0x6215('0x23'),_0x6215('0x3c')]));this[_0x6215('0x1a')](util[_0x6215('0x20')](_0x6215('0x2a'),_0x3f0190['membername']),_0x6215('0x3d'),this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x3f0190[_0x6215('0x1f')]]);ami['emit'](_0x6215('0x3e'),this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69]);}else if(!this[_0x6215('0xa')][_0x3f0190['uniqueid']][_0x426d69][_0x6215('0x10')]&&!this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x12')]){this[_0x6215('0xa')][_0x3f0190['uniqueid']][_0x426d69][_0x6215('0x10')]=!![];this[_0x6215('0xa')][_0x3f0190['uniqueid']][_0x426d69]['agentringnoanswerAt']=moment()[_0x6215('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x3f')]=_0x6215('0x40');this['channels'][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x33')]='answered_elsewhere';this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69]['answeredelsewheredestinationuniqueid']=_0x3f0190['destuniqueid'];this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69][_0x6215('0x41')]=_0x3f0190[_0x6215('0x2b')];ami[_0x6215('0x1a')](_0x6215('0x42'),this[_0x6215('0xa')][_0x3f0190[_0x6215('0x1e')]][_0x426d69]);}}}}}}catch(_0x11372e){logger[_0x6215('0x2d')](_0x6215('0x43'),util[_0x6215('0x44')](_0x11372e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')]['syncAgentRingNoAnswer']=function(_0x391e57){try{if(this[_0x6215('0x1d')](_0x391e57)){if(this[_0x6215('0xa')][_0x391e57[_0x6215('0x1e')]]&&this[_0x6215('0xa')][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]]){this['channels'][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]][_0x6215('0x10')]=!![];this['channels'][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]][_0x6215('0x45')]=moment()[_0x6215('0x20')](_0x6215('0x32'));this[_0x6215('0xa')][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]][_0x6215('0x3f')]='rejected';this[_0x6215('0xa')][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]][_0x6215('0x33')]=_0x6215('0x46');ami['emit'](_0x6215('0x47'),this['channels'][_0x391e57[_0x6215('0x1e')]][_0x391e57[_0x6215('0x1f')]]);}}}catch(_0x41ce65){logger[_0x6215('0x2d')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x6215('0x44')](_0x41ce65,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')]['syncQueueCallerAbandon']=function(_0x369da5){try{if(this[_0x6215('0x1d')](_0x369da5)){if(this['channels'][_0x369da5[_0x6215('0x1e')]]){for(var _0x2c9e45 in this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]]){if(this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]][_0x6215('0x30')](_0x2c9e45)&&!this['channels'][_0x369da5[_0x6215('0x1e')]][_0x2c9e45][_0x6215('0x10')]&&!this[_0x6215('0xa')][_0x369da5['uniqueid']][_0x2c9e45][_0x6215('0x12')]){this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]][_0x2c9e45][_0x6215('0x10')]=!![];this['channels'][_0x369da5['uniqueid']][_0x2c9e45][_0x6215('0x45')]=moment()[_0x6215('0x20')](_0x6215('0x32'));this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]][_0x2c9e45]['reason']=_0x6215('0x48');this['channels'][_0x369da5[_0x6215('0x1e')]][_0x2c9e45][_0x6215('0x33')]=_0x6215('0x48');ami[_0x6215('0x1a')](_0x6215('0x49'),this[_0x6215('0xa')][_0x369da5[_0x6215('0x1e')]][_0x2c9e45]);}}}}}catch(_0x99062f){logger[_0x6215('0x2d')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x6215('0x44')](_0x99062f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x13')]=function(_0x371f72){try{if(this['isNotNull'](_0x371f72)){if(this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]]){for(var _0x24a633 in this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]]){if(this[_0x6215('0xa')][_0x371f72['uniqueid']][_0x6215('0x30')](_0x24a633)){if(this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]][_0x24a633][_0x6215('0x31')]&&!this[_0x6215('0xa')][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x12')]){this['channels'][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x12')]=!![];this[_0x6215('0xa')][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x4a')]=moment()['format'](_0x6215('0x32'));this['channels'][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x33')]=_0x6215('0x4b');this[_0x6215('0xa')][_0x371f72['uniqueid']][_0x24a633][_0x6215('0x4c')]=_0x371f72[_0x6215('0x4c')];this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]][_0x24a633][_0x6215('0x3f')]=_0x371f72['reason']==_0x6215('0x4d')?_0x6215('0x4e'):_0x371f72[_0x6215('0x3f')];if(this[_0x6215('0xb')][_0x371f72[_0x6215('0x23')]]&&this[_0x6215('0xb')][_0x371f72[_0x6215('0x23')]][_0x6215('0x4f')]){this['channels'][_0x371f72[_0x6215('0x1e')]][_0x24a633][_0x6215('0x50')]=!![];this['channels'][_0x371f72[_0x6215('0x1e')]][_0x24a633][_0x6215('0x51')]=this['voiceQueues'][_0x371f72[_0x6215('0x23')]]['acwTimeout'];}this[_0x6215('0xc')][_0x371f72[_0x6215('0x3a')]]=_[_0x6215('0x27')](this[_0x6215('0xc')][_0x371f72['interface']],[_0x6215('0x23'),_0x6215('0x3c')]);this[_0x6215('0x1a')](util[_0x6215('0x20')]('user:%s',_0x371f72[_0x6215('0x2b')]),_0x6215('0x52'),this['channels'][_0x371f72[_0x6215('0x1e')]][_0x24a633]);ami[_0x6215('0x1a')]('custom:agentcomplete',this[_0x6215('0xa')][_0x371f72[_0x6215('0x1e')]][_0x24a633]);}}}}}}catch(_0x231fc5){logger[_0x6215('0x2d')](_0x6215('0x53'),util[_0x6215('0x44')](_0x231fc5,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x18b0c0){try{if(this[_0x6215('0x1d')](_0x18b0c0)){this[_0x6215('0x54')](_0x18b0c0[_0x6215('0x1e')],_['keys'](_0x18b0c0[_0x6215('0x55')])[0x0],_0x18b0c0[_0x6215('0x56')]);if(this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]]){for(var _0x846bd3 in this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]]){if(this[_0x6215('0xa')][_0x18b0c0['uniqueid']][_0x6215('0x30')](_0x846bd3)){if(_[_0x6215('0x1c')](this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]][_0x846bd3][_0x6215('0x22')])){this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]][_0x846bd3][_0x6215('0x22')]={};}this[_0x6215('0xa')][_0x18b0c0[_0x6215('0x1e')]][_0x846bd3][_0x6215('0x22')]=this[_0x6215('0x22')][_0x18b0c0[_0x6215('0x1e')]];}}}}}catch(_0xba8f26){logger[_0x6215('0x2d')]('[syncVarSet][VoiceAgentReport]',util[_0x6215('0x44')](_0xba8f26,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6215('0x54')]=function(_0x3d8129,_0x36ea52,_0x7f10a1){var _0x1ffed3=['rtpaudioqos',_0x6215('0x57'),_0x6215('0x58'),_0x6215('0x59'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x6215('0x5a'),_0x6215('0x5b'),'sipcallid',_0x6215('0x5c'),_0x6215('0x5d'),_0x6215('0x5e'),_0x6215('0x5f'),'memberdynamic',_0x6215('0x60'),_0x6215('0x61'),'membername',_0x6215('0x62'),_0x6215('0x63')];if(!_[_0x6215('0x64')](_0x36ea52)&&!_[_0x6215('0x65')](_0x1ffed3,_0x36ea52)){if(_[_0x6215('0x1c')](this['variables'][_0x3d8129])){this['variables'][_0x3d8129]={};}this['variables'][_0x3d8129][_0x36ea52]=_0x7f10a1;}};VoiceAgentReport[_0x6215('0x1b')]['syncHangup']=function(_0x3bfcff){try{if(this[_0x6215('0x1d')](_0x3bfcff)){if(this[_0x6215('0xa')][_0x3bfcff['uniqueid']]){for(var _0x16280f in this['channels'][_0x3bfcff[_0x6215('0x1e')]]){if(this[_0x6215('0xa')][_0x3bfcff['uniqueid']][_0x6215('0x30')](_0x16280f)){if(this[_0x6215('0xa')][_0x3bfcff[_0x6215('0x1e')]][_0x16280f][_0x6215('0x3f')]==_0x6215('0x4d')&&this[_0x6215('0xa')][_0x3bfcff[_0x6215('0x1e')]][_0x16280f][_0x6215('0x12')]){this[_0x6215('0xa')][_0x3bfcff[_0x6215('0x1e')]][_0x16280f][_0x6215('0x4a')]=moment()[_0x6215('0x20')](_0x6215('0x32'));}}}ami[_0x6215('0x1a')](_0x6215('0x66'),_[_0x6215('0x67')](this[_0x6215('0xa')][_0x3bfcff['uniqueid']]));delete this[_0x6215('0xa')][_0x3bfcff[_0x6215('0x1e')]];}if(this[_0x6215('0x22')][_0x3bfcff[_0x6215('0x1e')]]){delete this[_0x6215('0x22')][_0x3bfcff['uniqueid']];}}}catch(_0x31d85e){logger[_0x6215('0x2d')](_0x6215('0x68'),util[_0x6215('0x44')](_0x31d85e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x69')]=function(_0x2a409e){try{if(this[_0x6215('0x1d')](_0x2a409e)){if(this[_0x6215('0xa')][_0x2a409e['transfereeuniqueid']]){for(var _0x590579 in this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]]){if(this['channels'][_0x2a409e[_0x6215('0x6a')]][_0x6215('0x30')](_0x590579)){if(_0x2a409e[_0x6215('0x6b')]===_0x590579){var _0x3ecbcc=moment();this['channels'][_0x2a409e[_0x6215('0x6a')]][_0x590579][_0x6215('0x12')]=!![];this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]][_0x590579]['agentcompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]][_0x590579][_0x6215('0x3f')]='transfer';this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]][_0x590579][_0x6215('0x33')]=_0x6215('0x4b');this['channels'][_0x2a409e[_0x6215('0x6a')]][_0x590579][_0x6215('0x4c')]=_0x3ecbcc[_0x6215('0x6c')](this[_0x6215('0xa')][_0x2a409e['transfereeuniqueid']][_0x590579][_0x6215('0x31')],_0x6215('0x6d'));}}}}if(this[_0x6215('0xa')][_0x2a409e['secondtransfereruniqueid']]){var _0xdd2fa3=this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6e')]];this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6e')]]=this[_0x6215('0xa')][_0x2a409e[_0x6215('0x6a')]];this['channels'][_0x2a409e['transfereeuniqueid']]=_0xdd2fa3;}}}catch(_0x3c4d9e){logger['error']('[syncAttendedTransfer][VoiceAgentReport]',util['inspect'](_0x3c4d9e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6215('0x19')]=function(_0x282411){try{if(this[_0x6215('0x1d')](_0x282411)){if(this[_0x6215('0xa')][_0x282411['transfereeuniqueid']]){for(var _0x41575f in this['channels'][_0x282411['transfereeuniqueid']]){if(this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]]['hasOwnProperty'](_0x41575f)){if(_0x282411[_0x6215('0x6f')]===_0x41575f){var _0xbb583f=moment();this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x12')]=!![];this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x4a')]=_0xbb583f;this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x3f')]=_0x6215('0x4d');this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x33')]=_0x6215('0x4b');this[_0x6215('0xa')][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x4c')]=_0xbb583f[_0x6215('0x6c')](this['channels'][_0x282411[_0x6215('0x6a')]][_0x41575f][_0x6215('0x31')],_0x6215('0x6d'));}}}}}}catch(_0x48fa29){logger['error']('[syncBlindTransfer][VoiceAgentReport]',util[_0x6215('0x44')](_0x48fa29,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x16')]=function(_0x20238a){var _0x1d308e='';try{if(this['isNotNull'](_0x20238a)){if(_0x20238a[_0x6215('0x70')]){_0x1d308e=_0x20238a[_0x6215('0x70')][_0x6215('0x71')](0x0,_0x20238a[_0x6215('0x70')][_0x6215('0x72')]('-'));if(this[_0x6215('0xc')][_0x1d308e]){this[_0x6215('0xc')][_0x1d308e][_0x6215('0x73')]=!![];}}}}catch(_0x6429cf){logger[_0x6215('0x2d')](_0x6215('0x74'),util['inspect'](_0x6429cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6215('0x1b')][_0x6215('0x75')]=function(_0x227734){var _0x38e961='';try{if(this[_0x6215('0x1d')](_0x227734)){if(_0x227734['channel']){_0x38e961=_0x227734[_0x6215('0x70')][_0x6215('0x71')](0x0,_0x227734[_0x6215('0x70')][_0x6215('0x72')]('-'));if(this[_0x6215('0xc')][_0x38e961]){this[_0x6215('0xc')][_0x38e961]['onhold']=![];}}}}catch(_0x5e2a73){logger[_0x6215('0x2d')]('[syncMusicOnHoldStop][VoiceAgentReport]',util['inspect'](_0x5e2a73,{'showHidden':![],'depth':null}));}};module[_0x6215('0x76')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index d15598f..4caefed 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 _0xc130=['redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','pick','keys','error','channel','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','format','user:%s','user:agentconnect','exten','[syncNewChannel][VoiceCallReport]','inspect','application','appdata','applicationdata','toLowerCase','subtract','duration','seconds','merge','includes','lastapplication','lastdata','match','queue','[syncNewExten][VoiceCallReport]','syncNewState','answered','holdtime','diff','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','name','syncMixMonitorFilename','monitor','monitorFilename','find','isNil','monitors','push','rec','variable','mixmonitor_filename','value','xmd-phone','calleridnum','xmd-callerid','xmd-cdrtype','type','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds','[syncHangup][VoiceCallReport]','syncAttendedTransfer','transfercalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','transfertargetcalleridnum','origtransfereruniqueid','transfereecalleridnum','extension','[syncBlindTransfer][VoiceCallReport]','answertime','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','set','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY'];(function(_0x3dac28,_0x345de7){var _0x139e69=function(_0x280912){while(--_0x280912){_0x3dac28['push'](_0x3dac28['shift']());}};_0x139e69(++_0x345de7);}(_0xc130,0x7c));var _0x0c13=function(_0x5abc4c,_0x27a870){_0x5abc4c=_0x5abc4c-0x0;var _0x499b0=_0xc130[_0x5abc4c];return _0x499b0;};'use strict';var BPromise=require(_0x0c13('0x0'));var _=require(_0x0c13('0x1'));var moment=require(_0x0c13('0x2'));var util=require(_0x0c13('0x3'));var path=require(_0x0c13('0x4'));var Redis=require(_0x0c13('0x5'));var config=require(_0x0c13('0x6'));var logger=require(_0x0c13('0x7'))(_0x0c13('0x8'));var ami=require(_0x0c13('0x9'));var Channel=require(_0x0c13('0xa'));var statusDesc=[_0x0c13('0xb'),_0x0c13('0xc'),_0x0c13('0xd'),_0x0c13('0xe'),_0x0c13('0xf'),_0x0c13('0x10'),_0x0c13('0x11'),'ringinuse',_0x0c13('0x12')];var applications=[_0x0c13('0x13'),'queue',_0x0c13('0x14'),_0x0c13('0x15'),_0x0c13('0x16'),'voicemail'];var dispositions=[_0x0c13('0x17'),'FAILED',_0x0c13('0x18'),_0x0c13('0x17'),_0x0c13('0x17'),_0x0c13('0x17'),_0x0c13('0x19'),_0x0c13('0x1a'),_0x0c13('0x18'),_0x0c13('0x18'),_0x0c13('0x18')];var actions={};config[_0x0c13('0x1b')]=_['defaults'](config['redis'],{'host':_0x0c13('0x1c'),'port':0x18eb});var io=require(_0x0c13('0x1d'))(new Redis(config[_0x0c13('0x1b')]));function VoiceCallReport(_0x4fc104){this[_0x0c13('0x1e')]=_0x4fc104[_0x0c13('0x1e')];this[_0x0c13('0x1f')]=_0x4fc104['agents'];ami['on'](_0x0c13('0x20'),this[_0x0c13('0x21')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x23'),this[_0x0c13('0x21')]['bind'](this));ami['on'](_0x0c13('0x24'),this[_0x0c13('0x25')]['bind'](this));ami['on']('newstate',this['syncNewState'][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x26'),this[_0x0c13('0x27')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x28'),this[_0x0c13('0x29')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x2a'),this[_0x0c13('0x2b')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x2c'),this['syncAttendedTransfer'][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x2d'),this[_0x0c13('0x2e')][_0x0c13('0x22')](this));ami['on'](_0x0c13('0x2f'),this[_0x0c13('0x30')]['bind'](this));ami['on'](_0x0c13('0x31'),this[_0x0c13('0x32')][_0x0c13('0x22')](this));return BPromise['resolve']()[_0x0c13('0x33')](ami[_0x0c13('0x34')]())[_0x0c13('0x35')](function(_0x2a1264){console[_0x0c13('0x36')](_0x2a1264);});}VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x38')]=function(_0x576ffa){return _0x576ffa!==null&&!_[_0x0c13('0x39')](_0x576ffa);};VoiceCallReport[_0x0c13('0x37')]['emit']=function(_0x2196bd,_0xf7214a,_0x651d75){io['to'](_0x2196bd)[_0x0c13('0x3a')](_0xf7214a,_0x651d75);};VoiceCallReport[_0x0c13('0x37')]['syncNewCallerId']=function(_0x3bebd5){try{if(this[_0x0c13('0x38')](_0x3bebd5)){if(_0x3bebd5[_0x0c13('0x3b')]===_0x3bebd5[_0x0c13('0x3c')]){if(!_['isUndefined'](this[_0x0c13('0x1e')][_0x3bebd5[_0x0c13('0x3b')]])){_['merge'](this[_0x0c13('0x1e')][_0x3bebd5['uniqueid']],_[_0x0c13('0x3d')](_0x3bebd5,_[_0x0c13('0x3e')](this[_0x0c13('0x1e')][_0x3bebd5[_0x0c13('0x3b')]])));}}}}catch(_0x4023e9){logger[_0x0c13('0x3f')]('[syncNewCallerId][VoiceCallReport]',util['inspect'](_0x4023e9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x25')]=function(_0x22754f){try{if(this[_0x0c13('0x38')](_0x22754f)){if(_0x22754f[_0x0c13('0x3b')]===_0x22754f[_0x0c13('0x3c')]&&_0x22754f[_0x0c13('0x40')]!=_0x0c13('0x41')){if(_['isUndefined'](this['channels'][_0x22754f['uniqueid']])){this[_0x0c13('0x1e')][_0x22754f['uniqueid']]=new Channel();this[_0x0c13('0x1e')][_0x22754f[_0x0c13('0x3b')]][_0x0c13('0x42')]=moment()['format'](_0x0c13('0x43'));this[_0x0c13('0x1e')][_0x22754f[_0x0c13('0x3b')]][_0x0c13('0x44')]=dispositions[_[_0x0c13('0x45')](_0x22754f[_0x0c13('0x46')])];_['merge'](this[_0x0c13('0x1e')][_0x22754f[_0x0c13('0x3b')]],_[_0x0c13('0x3d')](_0x22754f,_[_0x0c13('0x3e')](this[_0x0c13('0x1e')][_0x22754f['uniqueid']])));if(_0x22754f[_0x0c13('0x47')]===_0x0c13('0x48')){if(this['agents'][_0x22754f[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]){this['agents'][_0x22754f[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]][_0x0c13('0x4a')]=_0x22754f['exten'];this[_0x0c13('0x3a')](util[_0x0c13('0x4b')](_0x0c13('0x4c'),this[_0x0c13('0x1f')][_0x22754f[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]['name']),_0x0c13('0x4d'),{'destaccountcode':this[_0x0c13('0x1f')][_0x22754f['channel'][_0x0c13('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x22754f[_0x0c13('0x4e')]});}}}}}}catch(_0x8a4fa7){logger[_0x0c13('0x3f')](_0x0c13('0x4f'),util[_0x0c13('0x50')](_0x8a4fa7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x21')]=function(_0x2ae0d2){try{if(this[_0x0c13('0x38')](_0x2ae0d2)){if(_0x2ae0d2[_0x0c13('0x3b')]===_0x2ae0d2[_0x0c13('0x3c')]&&_0x2ae0d2[_0x0c13('0x4e')]!='h'&&_0x2ae0d2[_0x0c13('0x40')]!=_0x0c13('0x41')){_0x2ae0d2[_0x0c13('0x51')]=_0x2ae0d2[_0x0c13('0x51')]['toLowerCase']();_0x2ae0d2['applicationdata']=(_0x2ae0d2[_0x0c13('0x52')]||_0x2ae0d2[_0x0c13('0x53')])[_0x0c13('0x54')]();if(_['isUndefined'](this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]])){this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]]=new Channel();this[_0x0c13('0x1e')][_0x2ae0d2['uniqueid']]['starttime']=_0x2ae0d2['duration']?moment()[_0x0c13('0x55')](moment[_0x0c13('0x56')](_0x2ae0d2[_0x0c13('0x56')])[_0x0c13('0x57')](),_0x0c13('0x57'))[_0x0c13('0x4b')](_0x0c13('0x43')):moment()['format'](_0x0c13('0x43'));this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]]['disposition']='NO\x20ANSWER';}_[_0x0c13('0x58')](this[_0x0c13('0x1e')][_0x2ae0d2['uniqueid']],_['pick'](_0x2ae0d2,_[_0x0c13('0x3e')](this[_0x0c13('0x1e')][_0x2ae0d2['uniqueid']])));if(_[_0x0c13('0x59')](applications,_0x2ae0d2[_0x0c13('0x51')])){this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]][_0x0c13('0x5a')]=_0x2ae0d2['application'];this['channels'][_0x2ae0d2[_0x0c13('0x3b')]][_0x0c13('0x5b')]=_0x2ae0d2[_0x0c13('0x53')];if(_0x2ae0d2[_0x0c13('0x51')]===_0x0c13('0x13')&&_['startsWith'](_0x2ae0d2[_0x0c13('0x53')],'cdr(')){var _0x3656b2=_0x2ae0d2[_0x0c13('0x53')][_0x0c13('0x49')]('=');var _0x8d66e1=_0x3656b2[0x0][_0x0c13('0x5c')](/cdr\((.*)\)/);if(_0x8d66e1){this[_0x0c13('0x1e')][_0x2ae0d2['uniqueid']][_0x8d66e1[0x1]]=_0x3656b2[0x1];}}else if(_0x2ae0d2[_0x0c13('0x51')]===_0x0c13('0x5d')){this[_0x0c13('0x1e')][_0x2ae0d2[_0x0c13('0x3b')]][_0x0c13('0x5d')]=_0x2ae0d2['applicationdata'][_0x0c13('0x49')](',')[0x0];}}}}}catch(_0x71dd4f){logger[_0x0c13('0x3f')](_0x0c13('0x5e'),util[_0x0c13('0x50')](_0x71dd4f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x5f')]=function(_0x28531b){try{if(this[_0x0c13('0x38')](_0x28531b)){if(_0x28531b[_0x0c13('0x3b')]!==_0x28531b[_0x0c13('0x3c')]){if(this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]]){if(_0x28531b[_0x0c13('0x46')]==='6'){if(!this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]]['answered']){var _0x24fb3e=moment();this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x60')]=!![];this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]]['answertime']=_0x24fb3e[_0x0c13('0x4b')](_0x0c13('0x43'));if(this[_0x0c13('0x1e')][_0x28531b['linkedid']][_0x0c13('0x42')]){this['channels'][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x61')]=_0x24fb3e[_0x0c13('0x62')](this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x42')],_0x0c13('0x57'));}}this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x3c')]=_0x28531b[_0x0c13('0x3b')];if(_0x28531b['calleridnum']!=='xcally-motion-preview'){this['channels'][_0x28531b['linkedid']][_0x0c13('0x63')]=_0x28531b['calleridnum'];}this[_0x0c13('0x1e')][_0x28531b['linkedid']][_0x0c13('0x64')]=_0x28531b[_0x0c13('0x65')];this[_0x0c13('0x1e')][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x66')]=_0x28531b[_0x0c13('0x40')];this['channels'][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x44')]=dispositions[_['toNumber'](_0x28531b[_0x0c13('0x46')])];if(this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]){this['channels'][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x67')]=this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]['id'];this['channels'][_0x28531b[_0x0c13('0x3c')]][_0x0c13('0x68')]=this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]][_0x0c13('0x69')];}}}}else{if(this[_0x0c13('0x1e')][_0x28531b['uniqueid']]){if(_0x28531b[_0x0c13('0x46')]==='6'){if(this['agents'][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]){this['channels'][_0x28531b['uniqueid']]['UserId']=this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]['id'];this[_0x0c13('0x1e')][_0x28531b['uniqueid']][_0x0c13('0x68')]=this[_0x0c13('0x1f')][_0x28531b[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]][_0x0c13('0x69')];}}}}}}catch(_0x1c38d5){logger[_0x0c13('0x3f')]('[syncNewState][VoiceCallReport]',util[_0x0c13('0x50')](_0x1c38d5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x6a')]=function(_0xe472e7,_0x4c79fb){if(this[_0x0c13('0x1e')][_0xe472e7]){this[_0x0c13('0x1e')][_0xe472e7][_0x0c13('0x6b')]=!![];if(_['endsWith'](_0x4c79fb,'.wav49')){_0x4c79fb=_0x4c79fb['replace']('.wav49','.WAV');}this[_0x0c13('0x1e')][_0xe472e7][_0x0c13('0x6c')]=_0x4c79fb;var _0x555058=_[_0x0c13('0x6d')](this[_0x0c13('0x1e')][_0xe472e7]['monitors'],{'filename':_0x4c79fb});if(_[_0x0c13('0x6e')](_0x555058)){this[_0x0c13('0x1e')][_0xe472e7][_0x0c13('0x6f')][_0x0c13('0x70')]({'filename':_0x4c79fb,'createdAt':moment()[_0x0c13('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x0c13('0x71')});}}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x27')]=function(_0x186748){try{if(this[_0x0c13('0x38')](_0x186748)){if(this['channels'][_0x186748['uniqueid']]&&_0x186748[_0x0c13('0x40')]!=_0x0c13('0x41')){if(this['isNotNull'](_0x186748['variable'])){if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x73')])){this[_0x0c13('0x6a')](_0x186748[_0x0c13('0x3b')],_0x186748[_0x0c13('0x74')]);}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x75')])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x76')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x77')])){this['channels'][_0x186748['uniqueid']]['callerid']=_0x186748['value'];}else if(this[_0x0c13('0x38')](_0x186748['variable'][_0x0c13('0x78')])){this['channels'][_0x186748['uniqueid']][_0x0c13('0x79')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')]['xmd-queue'])){this['channels'][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x5d')]=_0x186748[_0x0c13('0x74')]['split'](',')[0x0];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')]['xmd-originatecalleridnum'])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x7a')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748['variable'][_0x0c13('0x7b')])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x7c')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x7d')])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x7e')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')]['xmcs-queue'])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3b')]][_0x0c13('0x5d')]=_0x186748[_0x0c13('0x74')];}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x7f')])){this['channels'][_0x186748['uniqueid']][_0x0c13('0x80')]=_0x186748['value'];}}}else if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')][_0x0c13('0x73')])){if(_0x186748['value']){var _0xb092ee=path[_0x0c13('0x81')](_0x186748[_0x0c13('0x74')])[_0x0c13('0x69')];this[_0x0c13('0x6a')](_0xb092ee,_0x186748[_0x0c13('0x74')]);}}else if(this[_0x0c13('0x1e')][_0x186748['linkedid']]){if(this[_0x0c13('0x38')](_0x186748['variable'])){if(this[_0x0c13('0x38')](_0x186748[_0x0c13('0x72')]['sipcallid'])){this[_0x0c13('0x1e')][_0x186748[_0x0c13('0x3c')]][_0x0c13('0x82')]=_0x186748['value'];}}}}}catch(_0x873c74){logger['error'](_0x0c13('0x83'),util[_0x0c13('0x50')](_0x873c74,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')]['syncHangup']=function(_0x3517eb){try{if(this[_0x0c13('0x38')](_0x3517eb)){if(this[_0x0c13('0x1e')][_0x3517eb['uniqueid']]){var _0x215b1f=moment();this['channels'][_0x3517eb[_0x0c13('0x3b')]]['endtime']=_0x215b1f[_0x0c13('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3517eb['uniqueid']][_0x0c13('0x56')]=_0x215b1f[_0x0c13('0x62')](this[_0x0c13('0x1e')][_0x3517eb['uniqueid']]['starttime'],_0x0c13('0x57'));if(this[_0x0c13('0x1e')][_0x3517eb['uniqueid']][_0x0c13('0x60')]){this['channels'][_0x3517eb[_0x0c13('0x3b')]][_0x0c13('0x84')]=_0x215b1f[_0x0c13('0x62')](this['channels'][_0x3517eb[_0x0c13('0x3b')]]['answertime'],_0x0c13('0x57'));this['channels'][_0x3517eb[_0x0c13('0x3b')]][_0x0c13('0x61')]=this[_0x0c13('0x1e')][_0x3517eb['uniqueid']]['duration']-this[_0x0c13('0x1e')][_0x3517eb[_0x0c13('0x3b')]]['billableseconds'];}if(_0x3517eb[_0x0c13('0x47')]===_0x0c13('0x48')){if(this[_0x0c13('0x1f')][_0x3517eb[_0x0c13('0x40')]['split']('-')[0x0]]){this[_0x0c13('0x1f')][_0x3517eb[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]=_['omit'](this[_0x0c13('0x1f')][_0x3517eb['channel']['split']('-')[0x0]],['destconnectedlinenum']);this[_0x0c13('0x3a')](util['format'](_0x0c13('0x4c'),this[_0x0c13('0x1f')][_0x3517eb[_0x0c13('0x40')]['split']('-')[0x0]][_0x0c13('0x69')]),'user:agentcomplete',{'destaccountcode':this[_0x0c13('0x1f')][_0x3517eb[_0x0c13('0x40')][_0x0c13('0x49')]('-')[0x0]]['accountcode']});}}ami[_0x0c13('0x3a')]('custom:voiceCallReport',this[_0x0c13('0x1e')][_0x3517eb[_0x0c13('0x3b')]]);delete this[_0x0c13('0x1e')][_0x3517eb['uniqueid']];}}}catch(_0x408db9){logger[_0x0c13('0x3f')](_0x0c13('0x85'),util[_0x0c13('0x50')](_0x408db9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0c13('0x86')]=function(_0x1599f7){try{if(this[_0x0c13('0x38')](_0x1599f7)){if(this['channels'][_0x1599f7['transfereeuniqueid']]){this[_0x0c13('0x1e')][_0x1599f7['transfereeuniqueid']][_0x0c13('0x87')]=_0x1599f7['origtransferercalleridnum'];this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x88')]][_0x0c13('0x89')]=_0x1599f7['transfertargetcalleridnum'];if(this['channels'][_0x1599f7[_0x0c13('0x8a')]]){var _0xed5a77=this['channels'][_0x1599f7[_0x0c13('0x8a')]];this[_0x0c13('0x1e')][_0x1599f7['secondtransfereruniqueid']]=this['channels'][_0x1599f7[_0x0c13('0x88')]];this[_0x0c13('0x1e')][_0x1599f7['transfereeuniqueid']]=_0xed5a77;}}else if(this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8b')]]){this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8b')]][_0x0c13('0x87')]=_0x1599f7[_0x0c13('0x8c')];this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8b')]][_0x0c13('0x89')]=_0x1599f7[_0x0c13('0x8d')];if(this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8e')]]){var _0xed5a77=this['channels'][_0x1599f7['origtransfereruniqueid']];this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8e')]]=this['channels'][_0x1599f7[_0x0c13('0x8b')]];this[_0x0c13('0x1e')][_0x1599f7[_0x0c13('0x8b')]]=_0xed5a77;}}}}catch(_0x581f13){logger['error']('[syncAttendedTransfer][VoiceCallReport]',util[_0x0c13('0x50')](_0x581f13,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')]['syncBlindTransfer']=function(_0x147c39){try{if(this[_0x0c13('0x38')](_0x147c39)){if(this['channels'][_0x147c39['transfereeuniqueid']]){this[_0x0c13('0x1e')][_0x147c39[_0x0c13('0x88')]][_0x0c13('0x87')]=_0x147c39[_0x0c13('0x8f')];this[_0x0c13('0x1e')][_0x147c39[_0x0c13('0x88')]][_0x0c13('0x89')]=_0x147c39[_0x0c13('0x90')];this[_0x0c13('0x29')]({'event':'BlindTransfer','uniqueid':_0x147c39[_0x0c13('0x88')],'context':_0x147c39[_0x0c13('0x47')],'channel':_0x147c39['transfererchannel']});}}}catch(_0x4b5880){logger[_0x0c13('0x3f')](_0x0c13('0x91'),util['inspect'](_0x4b5880,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0c13('0x37')][_0x0c13('0x30')]=function(_0x369320){try{if(this[_0x0c13('0x38')](_0x369320)){if(this[_0x0c13('0x1e')][_0x369320[_0x0c13('0x3b')]]){if(!_['isNil'](this[_0x0c13('0x1e')][_0x369320[_0x0c13('0x3b')]][_0x0c13('0x92')])){this[_0x0c13('0x1e')][_0x369320[_0x0c13('0x3b')]][_0x0c13('0x93')]=moment()[_0x0c13('0x4b')](_0x0c13('0x43'));}}}}catch(_0x427195){logger[_0x0c13('0x3f')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x0c13('0x50')](_0x427195,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0c13('0x32')]=function(_0x456267){try{if(this['isNotNull'](_0x456267)){if(this[_0x0c13('0x1e')][_0x456267[_0x0c13('0x3b')]]){if(!_[_0x0c13('0x6e')](this[_0x0c13('0x1e')][_0x456267[_0x0c13('0x3b')]][_0x0c13('0x93')])){this[_0x0c13('0x1e')][_0x456267[_0x0c13('0x3b')]][_0x0c13('0x94')]+=moment()['milliseconds'](0x0)[_0x0c13('0x62')](this['channels'][_0x456267[_0x0c13('0x3b')]][_0x0c13('0x93')],_0x0c13('0x57'));delete this[_0x0c13('0x1e')][_0x456267['uniqueid']][_0x0c13('0x93')];}}}}catch(_0x2132c0){logger['error'](_0x0c13('0x95'),util[_0x0c13('0x50')](_0x2132c0,{'showHidden':![],'depth':null}));}};module[_0x0c13('0x96')]=VoiceCallReport; \ No newline at end of file +var _0x212b=['sipcalluniqueid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds','omit','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','moment','util','path','ioredis','../../../config/logger','ami','../ami','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','set','agi','dial','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','prototype','isUndefined','isNotNull','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','destconnectedlinenum','exten','emit','name','split','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','applicationdata','subtract','duration','seconds','lastdata','cdr(','match','queue','[syncNewExten][VoiceCallReport]','inspect','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','replace','monitorFilename','isNil','monitors','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','value','xmd-phone','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid'];(function(_0x42e9df,_0x4140e0){var _0x1f425a=function(_0x3dd725){while(--_0x3dd725){_0x42e9df['push'](_0x42e9df['shift']());}};_0x1f425a(++_0x4140e0);}(_0x212b,0x148));var _0xb212=function(_0x557353,_0x230e10){_0x557353=_0x557353-0x0;var _0x4869e9=_0x212b[_0x557353];return _0x4869e9;};'use strict';var BPromise=require(_0xb212('0x0'));var _=require('lodash');var moment=require(_0xb212('0x1'));var util=require(_0xb212('0x2'));var path=require(_0xb212('0x3'));var Redis=require(_0xb212('0x4'));var config=require('../../../config/environment');var logger=require(_0xb212('0x5'))(_0xb212('0x6'));var ami=require(_0xb212('0x7'));var Channel=require('../model/channel');var statusDesc=[_0xb212('0x8'),_0xb212('0x9'),_0xb212('0xa'),'busy',_0xb212('0xb'),_0xb212('0xc'),'ringing',_0xb212('0xd'),_0xb212('0xe')];var applications=[_0xb212('0xf'),'queue',_0xb212('0x10'),_0xb212('0x11'),'playback','voicemail'];var dispositions=['NO\x20ANSWER',_0xb212('0x12'),'FAILED',_0xb212('0x13'),_0xb212('0x13'),_0xb212('0x13'),_0xb212('0x14'),_0xb212('0x15'),_0xb212('0x12'),_0xb212('0x12'),_0xb212('0x12')];var actions={};config[_0xb212('0x16')]=_[_0xb212('0x17')](config[_0xb212('0x16')],{'host':_0xb212('0x18'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x5c56e2){this['channels']=_0x5c56e2[_0xb212('0x19')];this[_0xb212('0x1a')]=_0x5c56e2[_0xb212('0x1a')];ami['on']('coreshowchannel',this[_0xb212('0x1b')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x1d'),this[_0xb212('0x1b')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x1e'),this[_0xb212('0x1f')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x20'),this[_0xb212('0x21')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x22'),this[_0xb212('0x23')]['bind'](this));ami['on']('hangup',this[_0xb212('0x24')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x25'),this[_0xb212('0x26')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x27'),this[_0xb212('0x28')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x29'),this[_0xb212('0x2a')][_0xb212('0x1c')](this));ami['on'](_0xb212('0x2b'),this[_0xb212('0x2c')]['bind'](this));ami['on']('musiconholdstop',this[_0xb212('0x2d')][_0xb212('0x1c')](this));return BPromise[_0xb212('0x2e')]()[_0xb212('0x2f')](ami[_0xb212('0x30')]())[_0xb212('0x31')](function(_0x2aafe4){console['log'](_0x2aafe4);});}VoiceCallReport[_0xb212('0x32')]['isNotNull']=function(_0xd1180f){return _0xd1180f!==null&&!_[_0xb212('0x33')](_0xd1180f);};VoiceCallReport[_0xb212('0x32')]['emit']=function(_0x43d4b6,_0x2f9c0e,_0x42df2d){io['to'](_0x43d4b6)['emit'](_0x2f9c0e,_0x42df2d);};VoiceCallReport[_0xb212('0x32')][_0xb212('0x26')]=function(_0x882231){try{if(this[_0xb212('0x34')](_0x882231)){if(_0x882231[_0xb212('0x35')]===_0x882231[_0xb212('0x36')]){if(!_[_0xb212('0x33')](this[_0xb212('0x19')][_0x882231[_0xb212('0x35')]])){_[_0xb212('0x37')](this[_0xb212('0x19')][_0x882231[_0xb212('0x35')]],_[_0xb212('0x38')](_0x882231,_[_0xb212('0x39')](this[_0xb212('0x19')][_0x882231['uniqueid']])));}}}}catch(_0x4e727f){logger[_0xb212('0x3a')](_0xb212('0x3b'),util['inspect'](_0x4e727f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x1f')]=function(_0x36ce04){try{if(this[_0xb212('0x34')](_0x36ce04)){if(_0x36ce04[_0xb212('0x35')]===_0x36ce04[_0xb212('0x36')]&&_0x36ce04[_0xb212('0x3c')]!=_0xb212('0x3d')){if(_['isUndefined'](this['channels'][_0x36ce04[_0xb212('0x35')]])){this[_0xb212('0x19')][_0x36ce04[_0xb212('0x35')]]=new Channel();this[_0xb212('0x19')][_0x36ce04[_0xb212('0x35')]][_0xb212('0x3e')]=moment()[_0xb212('0x3f')](_0xb212('0x40'));this[_0xb212('0x19')][_0x36ce04[_0xb212('0x35')]][_0xb212('0x41')]=dispositions[_[_0xb212('0x42')](_0x36ce04[_0xb212('0x43')])];_['merge'](this[_0xb212('0x19')][_0x36ce04[_0xb212('0x35')]],_[_0xb212('0x38')](_0x36ce04,_[_0xb212('0x39')](this[_0xb212('0x19')][_0x36ce04['uniqueid']])));if(_0x36ce04[_0xb212('0x44')]===_0xb212('0x45')){if(this['agents'][_0x36ce04[_0xb212('0x3c')]['split']('-')[0x0]]){this[_0xb212('0x1a')][_0x36ce04[_0xb212('0x3c')]['split']('-')[0x0]][_0xb212('0x46')]=_0x36ce04[_0xb212('0x47')];this[_0xb212('0x48')](util[_0xb212('0x3f')]('user:%s',this[_0xb212('0x1a')][_0x36ce04[_0xb212('0x3c')]['split']('-')[0x0]][_0xb212('0x49')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x36ce04[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]][_0xb212('0x4b')],'destconnectedlinenum':_0x36ce04[_0xb212('0x47')]});}}}}}}catch(_0x2da0fc){logger[_0xb212('0x3a')](_0xb212('0x4c'),util['inspect'](_0x2da0fc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x1b')]=function(_0x104b36){try{if(this[_0xb212('0x34')](_0x104b36)){if(_0x104b36['uniqueid']===_0x104b36[_0xb212('0x36')]&&_0x104b36['exten']!='h'&&_0x104b36['channel']!=_0xb212('0x3d')){_0x104b36[_0xb212('0x4d')]=_0x104b36[_0xb212('0x4d')][_0xb212('0x4e')]();_0x104b36['applicationdata']=(_0x104b36[_0xb212('0x4f')]||_0x104b36[_0xb212('0x50')])[_0xb212('0x4e')]();if(_[_0xb212('0x33')](this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]])){this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]]=new Channel();this[_0xb212('0x19')][_0x104b36['uniqueid']][_0xb212('0x3e')]=_0x104b36['duration']?moment()[_0xb212('0x51')](moment['duration'](_0x104b36[_0xb212('0x52')])[_0xb212('0x53')](),'seconds')[_0xb212('0x3f')](_0xb212('0x40')):moment()[_0xb212('0x3f')](_0xb212('0x40'));this[_0xb212('0x19')][_0x104b36['uniqueid']]['disposition']=_0xb212('0x13');}_[_0xb212('0x37')](this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]],_[_0xb212('0x38')](_0x104b36,_[_0xb212('0x39')](this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]])));if(_['includes'](applications,_0x104b36['application'])){this['channels'][_0x104b36[_0xb212('0x35')]]['lastapplication']=_0x104b36[_0xb212('0x4d')];this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]][_0xb212('0x54')]=_0x104b36[_0xb212('0x50')];if(_0x104b36[_0xb212('0x4d')]===_0xb212('0xf')&&_['startsWith'](_0x104b36['applicationdata'],_0xb212('0x55'))){var _0x38cb6f=_0x104b36[_0xb212('0x50')]['split']('=');var _0x85db9b=_0x38cb6f[0x0][_0xb212('0x56')](/cdr\((.*)\)/);if(_0x85db9b){this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]][_0x85db9b[0x1]]=_0x38cb6f[0x1];}}else if(_0x104b36[_0xb212('0x4d')]===_0xb212('0x57')){this[_0xb212('0x19')][_0x104b36[_0xb212('0x35')]]['queue']=_0x104b36[_0xb212('0x50')][_0xb212('0x4a')](',')[0x0];}}}}}catch(_0x29bf2b){logger[_0xb212('0x3a')](_0xb212('0x58'),util[_0xb212('0x59')](_0x29bf2b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x21')]=function(_0x59d707){try{if(this['isNotNull'](_0x59d707)){if(_0x59d707[_0xb212('0x35')]!==_0x59d707[_0xb212('0x36')]){if(this['channels'][_0x59d707[_0xb212('0x36')]]){if(_0x59d707[_0xb212('0x43')]==='6'){if(!this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x5a')]){var _0x4a8110=moment();this['channels'][_0x59d707['linkedid']][_0xb212('0x5a')]=!![];this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x5b')]=_0x4a8110[_0xb212('0x3f')](_0xb212('0x40'));if(this['channels'][_0x59d707[_0xb212('0x36')]]['starttime']){this['channels'][_0x59d707[_0xb212('0x36')]][_0xb212('0x5c')]=_0x4a8110[_0xb212('0x5d')](this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x3e')],_0xb212('0x53'));}}this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x36')]=_0x59d707[_0xb212('0x35')];if(_0x59d707[_0xb212('0x5e')]!==_0xb212('0x5f')){this[_0xb212('0x19')][_0x59d707['linkedid']]['connectedlinenum']=_0x59d707['calleridnum'];}this['channels'][_0x59d707[_0xb212('0x36')]]['connectedlinename']=_0x59d707[_0xb212('0x60')];this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x61')]=_0x59d707[_0xb212('0x3c')];this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x41')]=dispositions[_[_0xb212('0x42')](_0x59d707[_0xb212('0x43')])];if(this['agents'][_0x59d707[_0xb212('0x3c')]['split']('-')[0x0]]){this['channels'][_0x59d707[_0xb212('0x36')]][_0xb212('0x62')]=this['agents'][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]]['id'];this[_0xb212('0x19')][_0x59d707[_0xb212('0x36')]][_0xb212('0x63')]=this[_0xb212('0x1a')][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]][_0xb212('0x49')];}}}}else{if(this[_0xb212('0x19')][_0x59d707[_0xb212('0x35')]]){if(_0x59d707['channelstate']==='6'){if(this[_0xb212('0x1a')][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]]){this[_0xb212('0x19')][_0x59d707[_0xb212('0x35')]][_0xb212('0x62')]=this['agents'][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]]['id'];this[_0xb212('0x19')][_0x59d707[_0xb212('0x35')]][_0xb212('0x63')]=this[_0xb212('0x1a')][_0x59d707[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]][_0xb212('0x49')];}}}}}}catch(_0x8b5088){logger['error'](_0xb212('0x64'),util['inspect'](_0x8b5088,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')]['syncMixMonitorFilename']=function(_0x21a052,_0x19d342){if(this[_0xb212('0x19')][_0x21a052]){this[_0xb212('0x19')][_0x21a052][_0xb212('0x65')]=!![];if(_[_0xb212('0x66')](_0x19d342,_0xb212('0x67'))){_0x19d342=_0x19d342[_0xb212('0x68')](_0xb212('0x67'),'.WAV');}this[_0xb212('0x19')][_0x21a052][_0xb212('0x69')]=_0x19d342;var _0x214b2b=_['find'](this[_0xb212('0x19')][_0x21a052]['monitors'],{'filename':_0x19d342});if(_[_0xb212('0x6a')](_0x214b2b)){this[_0xb212('0x19')][_0x21a052][_0xb212('0x6b')][_0xb212('0x6c')]({'filename':_0x19d342,'createdAt':moment()[_0xb212('0x3f')](_0xb212('0x40')),'mixmonitorid':'','status':_0xb212('0x6d')});}}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x23')]=function(_0x401b60){try{if(this[_0xb212('0x34')](_0x401b60)){if(this[_0xb212('0x19')][_0x401b60['uniqueid']]&&_0x401b60[_0xb212('0x3c')]!=_0xb212('0x3d')){if(this['isNotNull'](_0x401b60[_0xb212('0x6e')])){if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')][_0xb212('0x6f')])){this[_0xb212('0x70')](_0x401b60[_0xb212('0x35')],_0x401b60[_0xb212('0x71')]);}else if(this['isNotNull'](_0x401b60[_0xb212('0x6e')][_0xb212('0x72')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]]['calleridnum']=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')]['xmd-callerid'])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]]['callerid']=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60['variable'][_0xb212('0x73')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x74')]=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60['variable'][_0xb212('0x75')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x57')]=_0x401b60['value'][_0xb212('0x4a')](',')[0x0];}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')][_0xb212('0x76')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x77')]=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')]['xmd-destination'])){this['channels'][_0x401b60[_0xb212('0x35')]][_0xb212('0x78')]=_0x401b60[_0xb212('0x71')];}else if(this['isNotNull'](_0x401b60['variable'][_0xb212('0x79')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x7a')]=_0x401b60[_0xb212('0x71')];}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')][_0xb212('0x7b')])){this[_0xb212('0x19')][_0x401b60['uniqueid']][_0xb212('0x57')]=_0x401b60[_0xb212('0x71')];}else if(this['isNotNull'](_0x401b60['variable'][_0xb212('0x7c')])){this[_0xb212('0x19')][_0x401b60[_0xb212('0x35')]][_0xb212('0x7d')]=_0x401b60['value'];}}}else if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')][_0xb212('0x6f')])){if(_0x401b60[_0xb212('0x71')]){var _0x103b92=path['parse'](_0x401b60[_0xb212('0x71')])['name'];this[_0xb212('0x70')](_0x103b92,_0x401b60['value']);}}else if(this[_0xb212('0x19')][_0x401b60[_0xb212('0x36')]]){if(this[_0xb212('0x34')](_0x401b60[_0xb212('0x6e')])){if(this['isNotNull'](_0x401b60[_0xb212('0x6e')]['sipcallid'])){this['channels'][_0x401b60['linkedid']][_0xb212('0x7e')]=_0x401b60[_0xb212('0x71')];}}}}}catch(_0x1724bd){logger[_0xb212('0x3a')](_0xb212('0x7f'),util[_0xb212('0x59')](_0x1724bd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x24')]=function(_0x386e2f){try{if(this['isNotNull'](_0x386e2f)){if(this['channels'][_0x386e2f[_0xb212('0x35')]]){var _0x3ebadb=moment();this['channels'][_0x386e2f[_0xb212('0x35')]]['endtime']=_0x3ebadb[_0xb212('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb212('0x19')][_0x386e2f[_0xb212('0x35')]][_0xb212('0x52')]=_0x3ebadb['diff'](this[_0xb212('0x19')][_0x386e2f[_0xb212('0x35')]][_0xb212('0x3e')],_0xb212('0x53'));if(this[_0xb212('0x19')][_0x386e2f[_0xb212('0x35')]]['answered']){this[_0xb212('0x19')][_0x386e2f['uniqueid']][_0xb212('0x80')]=_0x3ebadb[_0xb212('0x5d')](this['channels'][_0x386e2f[_0xb212('0x35')]][_0xb212('0x5b')],_0xb212('0x53'));this[_0xb212('0x19')][_0x386e2f['uniqueid']][_0xb212('0x5c')]=this['channels'][_0x386e2f[_0xb212('0x35')]]['duration']-this['channels'][_0x386e2f[_0xb212('0x35')]][_0xb212('0x80')];}if(_0x386e2f[_0xb212('0x44')]===_0xb212('0x45')){if(this[_0xb212('0x1a')][_0x386e2f['channel'][_0xb212('0x4a')]('-')[0x0]]){this[_0xb212('0x1a')][_0x386e2f['channel'][_0xb212('0x4a')]('-')[0x0]]=_[_0xb212('0x81')](this[_0xb212('0x1a')][_0x386e2f[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]],['destconnectedlinenum']);this[_0xb212('0x48')](util[_0xb212('0x3f')]('user:%s',this[_0xb212('0x1a')][_0x386e2f['channel'][_0xb212('0x4a')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0xb212('0x1a')][_0x386e2f[_0xb212('0x3c')][_0xb212('0x4a')]('-')[0x0]]['accountcode']});}}ami[_0xb212('0x48')]('custom:voiceCallReport',this[_0xb212('0x19')][_0x386e2f[_0xb212('0x35')]]);delete this[_0xb212('0x19')][_0x386e2f['uniqueid']];}}}catch(_0x2b4a8d){logger[_0xb212('0x3a')](_0xb212('0x82'),util['inspect'](_0x2b4a8d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb212('0x28')]=function(_0xf3aa88){try{if(this[_0xb212('0x34')](_0xf3aa88)){if(this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x83')]]){this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x83')]][_0xb212('0x84')]=_0xf3aa88[_0xb212('0x85')];this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x83')]][_0xb212('0x86')]=_0xf3aa88['transfertargetcalleridnum'];if(this[_0xb212('0x19')][_0xf3aa88['secondtransfereruniqueid']]){var _0x2ca534=this[_0xb212('0x19')][_0xf3aa88['secondtransfereruniqueid']];this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x87')]]=this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x83')]];this[_0xb212('0x19')][_0xf3aa88['transfereeuniqueid']]=_0x2ca534;}}else if(this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x88')]]){this['channels'][_0xf3aa88[_0xb212('0x88')]][_0xb212('0x84')]=_0xf3aa88[_0xb212('0x85')];this['channels'][_0xf3aa88[_0xb212('0x88')]][_0xb212('0x86')]=_0xf3aa88[_0xb212('0x89')];if(this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x8a')]]){var _0x2ca534=this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x8a')]];this[_0xb212('0x19')][_0xf3aa88['origtransfereruniqueid']]=this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x88')]];this[_0xb212('0x19')][_0xf3aa88[_0xb212('0x88')]]=_0x2ca534;}}}}catch(_0x524401){logger[_0xb212('0x3a')](_0xb212('0x8b'),util[_0xb212('0x59')](_0x524401,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x2a')]=function(_0x8872af){try{if(this[_0xb212('0x34')](_0x8872af)){if(this[_0xb212('0x19')][_0x8872af[_0xb212('0x83')]]){this['channels'][_0x8872af[_0xb212('0x83')]][_0xb212('0x84')]=_0x8872af[_0xb212('0x8c')];this['channels'][_0x8872af[_0xb212('0x83')]]['transferconnectedlinenum']=_0x8872af[_0xb212('0x8d')];this[_0xb212('0x24')]({'event':_0xb212('0x8e'),'uniqueid':_0x8872af[_0xb212('0x83')],'context':_0x8872af['context'],'channel':_0x8872af[_0xb212('0x8f')]});}}}catch(_0x3362f2){logger[_0xb212('0x3a')](_0xb212('0x90'),util['inspect'](_0x3362f2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x2c')]=function(_0x56fa3c){try{if(this[_0xb212('0x34')](_0x56fa3c)){if(this[_0xb212('0x19')][_0x56fa3c[_0xb212('0x35')]]){if(!_[_0xb212('0x6a')](this[_0xb212('0x19')][_0x56fa3c[_0xb212('0x35')]][_0xb212('0x5b')])){this[_0xb212('0x19')][_0x56fa3c['uniqueid']][_0xb212('0x91')]=moment()['format'](_0xb212('0x40'));}}}}catch(_0x3a28cf){logger['error'](_0xb212('0x92'),util[_0xb212('0x59')](_0x3a28cf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb212('0x32')][_0xb212('0x2d')]=function(_0x1dfbcb){try{if(this['isNotNull'](_0x1dfbcb)){if(this[_0xb212('0x19')][_0x1dfbcb[_0xb212('0x35')]]){if(!_[_0xb212('0x6a')](this['channels'][_0x1dfbcb[_0xb212('0x35')]][_0xb212('0x91')])){this[_0xb212('0x19')][_0x1dfbcb[_0xb212('0x35')]][_0xb212('0x93')]+=moment()[_0xb212('0x94')](0x0)[_0xb212('0x5d')](this[_0xb212('0x19')][_0x1dfbcb[_0xb212('0x35')]][_0xb212('0x91')],'seconds');delete this['channels'][_0x1dfbcb[_0xb212('0x35')]][_0xb212('0x91')];}}}}catch(_0x553490){logger[_0xb212('0x3a')](_0xb212('0x95'),util[_0xb212('0x59')](_0x553490,{'showHidden':![],'depth':null}));}};module[_0xb212('0x96')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 36cc1d9..3b3b36d 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 _0xab29=['syncVarSet','hangup','syncHangup','isNotNull','isUndefined','emit','prototype','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','outboundrouteid','value','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','endtime','diff','starttime','seconds','lastevent','complete','total','answered','holdtime','sumHoldTime','sumBillable','billableseconds','duration','info','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset'];(function(_0x17f7d7,_0x525e08){var _0x4aaeb8=function(_0x1b3c3c){while(--_0x1b3c3c){_0x17f7d7['push'](_0x17f7d7['shift']());}};_0x4aaeb8(++_0x525e08);}(_0xab29,0x145));var _0x9ab2=function(_0x3912f1,_0x1fb101){_0x3912f1=_0x3912f1-0x0;var _0x4ccb95=_0xab29[_0x3912f1];return _0x4ccb95;};'use strict';var _=require(_0x9ab2('0x0'));var moment=require(_0x9ab2('0x1'));var util=require(_0x9ab2('0x2'));var Redis=require(_0x9ab2('0x3'));var config=require('../../../config/environment');var logger=require(_0x9ab2('0x4'))('ami');var ami=require(_0x9ab2('0x5'));config[_0x9ab2('0x6')]=_[_0x9ab2('0x7')](config[_0x9ab2('0x6')],{'host':_0x9ab2('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ab2('0x6')]));function VoiceDialReport(_0x3739c8){this[_0x9ab2('0x9')]=_0x3739c8[_0x9ab2('0xa')];this[_0x9ab2('0xb')]=_0x3739c8['outbound'];this[_0x9ab2('0xc')]={};ami['on'](_0x9ab2('0xd'),this[_0x9ab2('0xe')][_0x9ab2('0xf')](this));ami['on'](_0x9ab2('0x10'),this[_0x9ab2('0x11')][_0x9ab2('0xf')](this));ami['on'](_0x9ab2('0x12'),this[_0x9ab2('0x13')]['bind'](this));ami['on'](_0x9ab2('0x14'),this[_0x9ab2('0x15')]['bind'](this));}VoiceDialReport['prototype'][_0x9ab2('0x16')]=function(_0x1b23ae){return _0x1b23ae!==null&&!_[_0x9ab2('0x17')](_0x1b23ae);};VoiceDialReport['prototype'][_0x9ab2('0x18')]=function(_0x314432,_0x55c9d6,_0x3a594f){io['to'](_0x314432)[_0x9ab2('0x18')](_0x55c9d6,_0x3a594f);};VoiceDialReport[_0x9ab2('0x19')][_0x9ab2('0xe')]=function(_0x24f858){try{if(this[_0x9ab2('0x16')](_0x24f858)){if(this[_0x9ab2('0x9')][_0x24f858[_0x9ab2('0x1a')]]){_['merge'](this[_0x9ab2('0x9')][_0x24f858[_0x9ab2('0x1a')]],{'starttime':moment()[_0x9ab2('0x1b')](_0x9ab2('0x1c')),'lastevent':_0x9ab2('0x1d'),'interface':_0x24f858[_0x9ab2('0x1e')]['substring'](0x0,_0x24f858['channel'][_0x9ab2('0x1f')]('-')),'membername':_0x24f858['channel'][_0x9ab2('0x20')](_0x24f858[_0x9ab2('0x1e')]['lastIndexOf']('/')+0x1,_0x24f858[_0x9ab2('0x1e')][_0x9ab2('0x1f')]('-'))},_['omit'](_0x24f858,[_0x9ab2('0x21'),_0x9ab2('0x22')]));this[_0x9ab2('0x18')](_0x9ab2('0x23'),_0x9ab2('0x24'),this[_0x9ab2('0x9')][_0x24f858[_0x9ab2('0x1a')]]);ami[_0x9ab2('0x18')](_0x9ab2('0x25'),this[_0x9ab2('0x9')][_0x24f858[_0x9ab2('0x1a')]]);}}}catch(_0x248cc6){logger[_0x9ab2('0x26')]('[syncDialBegin][VoiceDialReport]',util[_0x9ab2('0x27')](_0x248cc6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ab2('0x19')][_0x9ab2('0x11')]=function(_0x4cf7b8){try{if(this[_0x9ab2('0x16')](_0x4cf7b8)){if(this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]]){this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]][_0x9ab2('0x28')]=_0x4cf7b8[_0x9ab2('0x28')];if(_0x4cf7b8[_0x9ab2('0x28')]===_0x9ab2('0x29')){this['channels'][_0x4cf7b8['uniqueid']]['connectedlinenum']=_0x4cf7b8[_0x9ab2('0x2a')];this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]][_0x9ab2('0x2b')]=_0x4cf7b8[_0x9ab2('0x2b')];this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]][_0x9ab2('0x2c')]=moment()[_0x9ab2('0x1b')](_0x9ab2('0x1c'));this['channels'][_0x4cf7b8[_0x9ab2('0x1a')]]['lastevent']=_0x9ab2('0x2d');ami[_0x9ab2('0x18')]('custom:dialconnect',this[_0x9ab2('0x9')][_0x4cf7b8['uniqueid']]);}this[_0x9ab2('0x18')](_0x9ab2('0x23'),_0x9ab2('0x24'),this[_0x9ab2('0x9')][_0x4cf7b8[_0x9ab2('0x1a')]]);}}}catch(_0x30ab52){logger[_0x9ab2('0x26')](_0x9ab2('0x2e'),util[_0x9ab2('0x27')](_0x30ab52,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x78089a){try{if(this[_0x9ab2('0x16')](_0x78089a)){this[_0x9ab2('0x2f')](_0x78089a[_0x9ab2('0x1a')],_[_0x9ab2('0x30')](_0x78089a['variable'])[0x0],_0x78089a['value']);if(this[_0x9ab2('0x16')](_0x78089a['variable'])&&this[_0x9ab2('0x16')](_0x78089a[_0x9ab2('0x31')][_0x9ab2('0x32')])){if(_[_0x9ab2('0x17')](this[_0x9ab2('0x9')][_0x78089a[_0x9ab2('0x1a')]])){this[_0x9ab2('0x9')][_0x78089a[_0x9ab2('0x1a')]]={'routeId':_0x78089a[_0x9ab2('0x33')],'variables':this[_0x9ab2('0xc')][_0x78089a[_0x9ab2('0x1a')]]};this[_0x9ab2('0x18')](_0x9ab2('0x23'),_0x9ab2('0x24'),this[_0x9ab2('0x9')][_0x78089a['uniqueid']]);}}}}catch(_0x3e8ac2){logger[_0x9ab2('0x26')](_0x9ab2('0x34'),util[_0x9ab2('0x27')](_0x3e8ac2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9ab2('0x19')][_0x9ab2('0x2f')]=function(_0xae1e7e,_0x4bfe06,_0x3df054){var _0x4a273=['rtpaudioqos',_0x9ab2('0x35'),_0x9ab2('0x36'),_0x9ab2('0x37'),_0x9ab2('0x38'),_0x9ab2('0x39'),_0x9ab2('0x3a'),_0x9ab2('0x3b'),_0x9ab2('0x3c'),_0x9ab2('0x3d'),_0x9ab2('0x3e'),_0x9ab2('0x3f'),_0x9ab2('0x40'),_0x9ab2('0x41'),'memberinterface',_0x9ab2('0x42'),'membername',_0x9ab2('0x43'),_0x9ab2('0x44')];if(!_['isNil'](_0x4bfe06)&&!_['includes'](_0x4a273,_0x4bfe06)){if(_[_0x9ab2('0x17')](this[_0x9ab2('0xc')][_0xae1e7e])){this['variables'][_0xae1e7e]={};}this[_0x9ab2('0xc')][_0xae1e7e][_0x4bfe06]=_0x3df054;}};VoiceDialReport['prototype'][_0x9ab2('0x15')]=function(_0xc5cefb){try{if(this[_0x9ab2('0x16')](_0xc5cefb)){if(this['channels'][_0xc5cefb[_0x9ab2('0x1a')]]){this['channels'][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x45')]=moment()[_0x9ab2('0x1b')](_0x9ab2('0x1c'));this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']]['duration']=moment(this['channels'][_0xc5cefb['uniqueid']][_0x9ab2('0x45')])[_0x9ab2('0x46')](this['channels'][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x47')],_0x9ab2('0x48'));this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']][_0x9ab2('0x49')]=_0x9ab2('0x4a');this['outbound'][_0x9ab2('0x4b')]+=0x1;if(this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x2c')]){this[_0x9ab2('0xb')][_0x9ab2('0x4c')]+=0x1;this['channels'][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x4d')]=moment(this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x2c')])[_0x9ab2('0x46')](this['channels'][_0xc5cefb[_0x9ab2('0x1a')]]['starttime'],_0x9ab2('0x48'));this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']]['billableseconds']=moment(this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']][_0x9ab2('0x45')])[_0x9ab2('0x46')](this['channels'][_0xc5cefb['uniqueid']]['answertime'],_0x9ab2('0x48'));this['outbound'][_0x9ab2('0x4e')]+=this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x4d')]||0x0;this['outbound'][_0x9ab2('0x4f')]+=this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x50')];}this[_0x9ab2('0xb')]['sumDuration']+=this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]][_0x9ab2('0x51')];ami[_0x9ab2('0x18')]('custom:voiceDialReport',this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]]);ami['emit']('custom:dialend',this[_0x9ab2('0x9')][_0xc5cefb[_0x9ab2('0x1a')]]);this[_0x9ab2('0x18')](_0x9ab2('0x23'),'voice_outbound:save',this[_0x9ab2('0xb')]);logger[_0x9ab2('0x52')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']]));this[_0x9ab2('0x18')](_0x9ab2('0x23'),_0x9ab2('0x53'),this['channels'][_0xc5cefb[_0x9ab2('0x1a')]]);delete this[_0x9ab2('0x9')][_0xc5cefb['uniqueid']];}if(this[_0x9ab2('0xc')][_0xc5cefb['uniqueid']]){delete this['variables'][_0xc5cefb['uniqueid']];}}}catch(_0x524f14){logger[_0x9ab2('0x26')](_0x9ab2('0x54'),util[_0x9ab2('0x27')](_0x524f14,{'showHidden':![],'depth':null}));}};module[_0x9ab2('0x55')]=VoiceDialReport; \ No newline at end of file +var _0x8c4a=['lodash','moment','ioredis','../../../config/logger','ami','../ami','redis','defaults','channels','outboundChannels','outbound','dialbegin','dialend','bind','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','syncDialBegin','isNotNull','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','error','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','duration','endtime','starttime','lastevent','complete','answered','holdtime','diff','seconds','billableseconds','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[syncHangup][VoiceDialReport]','exports'];(function(_0x1783db,_0x1adb41){var _0x174b12=function(_0x617efa){while(--_0x617efa){_0x1783db['push'](_0x1783db['shift']());}};_0x174b12(++_0x1adb41);}(_0x8c4a,0xb0));var _0xa8c4=function(_0x24f72f,_0x529660){_0x24f72f=_0x24f72f-0x0;var _0x513ab2=_0x8c4a[_0x24f72f];return _0x513ab2;};'use strict';var _=require(_0xa8c4('0x0'));var moment=require(_0xa8c4('0x1'));var util=require('util');var Redis=require(_0xa8c4('0x2'));var config=require('../../../config/environment');var logger=require(_0xa8c4('0x3'))(_0xa8c4('0x4'));var ami=require(_0xa8c4('0x5'));config[_0xa8c4('0x6')]=_[_0xa8c4('0x7')](config[_0xa8c4('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa8c4('0x6')]));function VoiceDialReport(_0x690746){this[_0xa8c4('0x8')]=_0x690746[_0xa8c4('0x9')];this['outbound']=_0x690746[_0xa8c4('0xa')];this['variables']={};ami['on'](_0xa8c4('0xb'),this['syncDialBegin']['bind'](this));ami['on'](_0xa8c4('0xc'),this['syncDialEnd'][_0xa8c4('0xd')](this));ami['on'](_0xa8c4('0xe'),this[_0xa8c4('0xf')][_0xa8c4('0xd')](this));ami['on'](_0xa8c4('0x10'),this[_0xa8c4('0x11')]['bind'](this));}VoiceDialReport[_0xa8c4('0x12')]['isNotNull']=function(_0x4fbbdf){return _0x4fbbdf!==null&&!_[_0xa8c4('0x13')](_0x4fbbdf);};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0x14')]=function(_0x109817,_0x413974,_0x3e874b){io['to'](_0x109817)[_0xa8c4('0x14')](_0x413974,_0x3e874b);};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0x15')]=function(_0x698526){try{if(this[_0xa8c4('0x16')](_0x698526)){if(this[_0xa8c4('0x8')][_0x698526[_0xa8c4('0x17')]]){_[_0xa8c4('0x18')](this[_0xa8c4('0x8')][_0x698526['uniqueid']],{'starttime':moment()[_0xa8c4('0x19')](_0xa8c4('0x1a')),'lastevent':_0xa8c4('0x1b'),'interface':_0x698526[_0xa8c4('0x1c')][_0xa8c4('0x1d')](0x0,_0x698526[_0xa8c4('0x1c')]['lastIndexOf']('-')),'membername':_0x698526[_0xa8c4('0x1c')][_0xa8c4('0x1d')](_0x698526['channel']['lastIndexOf']('/')+0x1,_0x698526[_0xa8c4('0x1c')][_0xa8c4('0x1e')]('-'))},_[_0xa8c4('0x1f')](_0x698526,[_0xa8c4('0x20'),_0xa8c4('0x21')]));this[_0xa8c4('0x14')](_0xa8c4('0x22'),_0xa8c4('0x23'),this[_0xa8c4('0x8')][_0x698526[_0xa8c4('0x17')]]);ami[_0xa8c4('0x14')](_0xa8c4('0x24'),this[_0xa8c4('0x8')][_0x698526['uniqueid']]);}}}catch(_0x313eda){logger['error'](_0xa8c4('0x25'),util[_0xa8c4('0x26')](_0x313eda,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0x27')]=function(_0x1c696b){try{if(this[_0xa8c4('0x16')](_0x1c696b)){if(this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]]){this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]][_0xa8c4('0x28')]=_0x1c696b[_0xa8c4('0x28')];if(_0x1c696b['dialstatus']===_0xa8c4('0x29')){this[_0xa8c4('0x8')][_0x1c696b['uniqueid']]['connectedlinenum']=_0x1c696b[_0xa8c4('0x2a')];this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]][_0xa8c4('0x2b')]=_0x1c696b[_0xa8c4('0x2b')];this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]][_0xa8c4('0x2c')]=moment()[_0xa8c4('0x19')](_0xa8c4('0x1a'));this[_0xa8c4('0x8')][_0x1c696b['uniqueid']]['lastevent']=_0xa8c4('0x2d');ami[_0xa8c4('0x14')]('custom:dialconnect',this[_0xa8c4('0x8')][_0x1c696b['uniqueid']]);}this[_0xa8c4('0x14')](_0xa8c4('0x22'),'voice_outbound_channel:save',this[_0xa8c4('0x8')][_0x1c696b[_0xa8c4('0x17')]]);}}}catch(_0x594bca){logger[_0xa8c4('0x2e')](_0xa8c4('0x2f'),util[_0xa8c4('0x26')](_0x594bca,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0xf')]=function(_0x59a6dc){try{if(this['isNotNull'](_0x59a6dc)){this[_0xa8c4('0x30')](_0x59a6dc[_0xa8c4('0x17')],_[_0xa8c4('0x31')](_0x59a6dc[_0xa8c4('0x32')])[0x0],_0x59a6dc[_0xa8c4('0x33')]);if(this[_0xa8c4('0x16')](_0x59a6dc[_0xa8c4('0x32')])&&this[_0xa8c4('0x16')](_0x59a6dc[_0xa8c4('0x32')][_0xa8c4('0x34')])){if(_[_0xa8c4('0x13')](this['channels'][_0x59a6dc[_0xa8c4('0x17')]])){this[_0xa8c4('0x8')][_0x59a6dc[_0xa8c4('0x17')]]={'routeId':_0x59a6dc[_0xa8c4('0x33')],'variables':this[_0xa8c4('0x35')][_0x59a6dc[_0xa8c4('0x17')]]};this[_0xa8c4('0x14')]('voice:outbound',_0xa8c4('0x23'),this['channels'][_0x59a6dc['uniqueid']]);}}}}catch(_0x261c94){logger[_0xa8c4('0x2e')](_0xa8c4('0x36'),util[_0xa8c4('0x26')](_0x261c94,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa8c4('0x30')]=function(_0x38d6e7,_0x587dae,_0x171a50){var _0x46f07c=[_0xa8c4('0x37'),_0xa8c4('0x38'),_0xa8c4('0x39'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0xa8c4('0x3a'),'bridgepeer',_0xa8c4('0x3b'),'membercalls',_0xa8c4('0x3c'),_0xa8c4('0x3d'),_0xa8c4('0x3e'),_0xa8c4('0x3f'),_0xa8c4('0x40'),_0xa8c4('0x41')];if(!_[_0xa8c4('0x42')](_0x587dae)&&!_[_0xa8c4('0x43')](_0x46f07c,_0x587dae)){if(_[_0xa8c4('0x13')](this[_0xa8c4('0x35')][_0x38d6e7])){this[_0xa8c4('0x35')][_0x38d6e7]={};}this[_0xa8c4('0x35')][_0x38d6e7][_0x587dae]=_0x171a50;}};VoiceDialReport[_0xa8c4('0x12')][_0xa8c4('0x11')]=function(_0x1ba1a6){try{if(this['isNotNull'](_0x1ba1a6)){if(this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']]){this['channels'][_0x1ba1a6[_0xa8c4('0x17')]]['endtime']=moment()[_0xa8c4('0x19')](_0xa8c4('0x1a'));this['channels'][_0x1ba1a6['uniqueid']][_0xa8c4('0x44')]=moment(this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x45')])['diff'](this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x46')],'seconds');this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x47')]=_0xa8c4('0x48');this['outbound']['total']+=0x1;if(this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x2c')]){this['outbound'][_0xa8c4('0x49')]+=0x1;this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']][_0xa8c4('0x4a')]=moment(this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x2c')])[_0xa8c4('0x4b')](this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]['starttime'],_0xa8c4('0x4c'));this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']][_0xa8c4('0x4d')]=moment(this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']]['endtime'])[_0xa8c4('0x4b')](this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]['answertime'],_0xa8c4('0x4c'));this[_0xa8c4('0xa')]['sumHoldTime']+=this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]['holdtime']||0x0;this[_0xa8c4('0xa')][_0xa8c4('0x4e')]+=this['channels'][_0x1ba1a6[_0xa8c4('0x17')]][_0xa8c4('0x4d')];}this[_0xa8c4('0xa')][_0xa8c4('0x4f')]+=this['channels'][_0x1ba1a6['uniqueid']]['duration'];ami[_0xa8c4('0x14')](_0xa8c4('0x50'),this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]);ami[_0xa8c4('0x14')](_0xa8c4('0x51'),this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]);this[_0xa8c4('0x14')](_0xa8c4('0x22'),_0xa8c4('0x52'),this[_0xa8c4('0xa')]);logger[_0xa8c4('0x53')](_0xa8c4('0x54'),JSON[_0xa8c4('0x55')](this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]]));this[_0xa8c4('0x14')](_0xa8c4('0x22'),'voice_outbound_channel:remove',this[_0xa8c4('0x8')][_0x1ba1a6['uniqueid']]);delete this[_0xa8c4('0x8')][_0x1ba1a6[_0xa8c4('0x17')]];}if(this[_0xa8c4('0x35')][_0x1ba1a6[_0xa8c4('0x17')]]){delete this[_0xa8c4('0x35')][_0x1ba1a6['uniqueid']];}}}catch(_0x3a8dba){logger[_0xa8c4('0x2e')](_0xa8c4('0x56'),util[_0xa8c4('0x26')](_0x3a8dba,{'showHidden':![],'depth':null}));}};module[_0xa8c4('0x57')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 77f7769..4f3c161 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 _0x66ca=['memberinterface','memberlastcall','memberpenalty','includes','diff','queuecallerjoinAt','seconds','length','total','milliseconds','queuecallercompleteAt','custom:queuecallerabandon','emitVoiceQueueSummary','[syncHangup][VoiceQueueReport]','transfereeuniqueid','transferexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','switch','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BlindTransfer','context','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStart','[syncMusicOnHoldStart][VoiceQueueReport]','syncMusicOnHoldStop','mohstarttime','mohtime','exports','lodash','moment','bluebird','util','md5','../../../config/environment','../../../config/logger','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','bind','syncQueueSummaryComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','syncFullyBooted','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','isNil','Action','status','channel','catch','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emitVoiceQueueChannelSave','emit','format','voice:queue:%s','name','voice_queue_channel:save','inbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','type','unmanaged','abandoned','Trunk','Interval','stringify','voice_queue:save','isNotNull','[queues]','queuesummary','then','queue','countBy','callers','toNumber','loggedin','custom:queuesummary','uniqueid','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallerexitreason','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','membername','queuecallerexit','transfer','reason','COMPLETED','local/','linkedid','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','COMPLETEDBY','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','value','variable','queuestatus','CONTINUE','queuecallerexitAt','lastevent','timeout','custom:timeout','queueposition','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','membercalls'];(function(_0x5a85a5,_0x1950ae){var _0x71d7=function(_0x3313b8){while(--_0x3313b8){_0x5a85a5['push'](_0x5a85a5['shift']());}};_0x71d7(++_0x1950ae);}(_0x66ca,0xdf));var _0xa66c=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0x66ca[_0x58d5ac];return _0x37985c;};'use strict';var _=require(_0xa66c('0x0'));var moment=require(_0xa66c('0x1'));var BPromise=require(_0xa66c('0x2'));var util=require(_0xa66c('0x3'));var md5=require(_0xa66c('0x4'));var Redis=require('ioredis');var config=require(_0xa66c('0x5'));var logger=require(_0xa66c('0x6'))('ami');var ami=require('../ami');var QueueReport=require(_0xa66c('0x7'));config[_0xa66c('0x8')]=_[_0xa66c('0x9')](config[_0xa66c('0x8')],{'host':_0xa66c('0xa'),'port':0x18eb});var io=require(_0xa66c('0xb'))(new Redis(config[_0xa66c('0x8')]));var Sequence=function(){};Sequence[_0xa66c('0xc')][_0xa66c('0xd')]=function(_0x33853c){this['tail']=this['tail']?this['tail']['finally'](_0x33853c):_0x33853c();};function VoiceQueueReport(_0x182d1){this[_0xa66c('0xe')]=new Sequence();this[_0xa66c('0xf')]={};this[_0xa66c('0x10')]=_0x182d1[_0xa66c('0x10')];this[_0xa66c('0x11')]=_0x182d1[_0xa66c('0x12')];this['voiceQueues']=_0x182d1[_0xa66c('0x13')];this[_0xa66c('0x14')]=!![];this[_0xa66c('0x15')]=_0x182d1['campaigns'];this[_0xa66c('0x16')]={};ami['on']('queuesummary',this[_0xa66c('0x17')][_0xa66c('0x18')](this));ami['on']('queuesummarycomplete',this[_0xa66c('0x19')]['bind'](this));ami['on'](_0xa66c('0x1a'),this['syncQueueCallerJoin'][_0xa66c('0x18')](this));ami['on'](_0xa66c('0x1b'),this[_0xa66c('0x1c')][_0xa66c('0x18')](this));ami['on'](_0xa66c('0x1d'),this[_0xa66c('0x1e')][_0xa66c('0x18')](this));ami['on'](_0xa66c('0x1f'),this[_0xa66c('0x20')][_0xa66c('0x18')](this));ami['on'](_0xa66c('0x21'),this[_0xa66c('0x22')][_0xa66c('0x18')](this));ami['on'](_0xa66c('0x23'),this['syncVarSet']['bind'](this));ami['on'](_0xa66c('0x24'),this[_0xa66c('0x25')][_0xa66c('0x18')](this));ami['on']('fullybooted',this[_0xa66c('0x26')][_0xa66c('0x18')](this));ami['on'](_0xa66c('0x27'),this['syncMusicOnHoldStart'][_0xa66c('0x18')](this));ami['on'](_0xa66c('0x28'),this['syncMusicOnHoldStop'][_0xa66c('0x18')](this));ami['on'](_0xa66c('0x29'),this[_0xa66c('0x2a')]['bind'](this));ami['on']('blindtransfer',this[_0xa66c('0x2b')][_0xa66c('0x18')](this));this[_0xa66c('0x2c')]();this[_0xa66c('0x2d')]();}function isNotNull(_0x17708c){return _0x17708c!==null&&!_[_0xa66c('0x2e')](_0x17708c);}function clearChannels(_0x5fff7d){if(!_[_0xa66c('0x2f')](_0x5fff7d)){for(var _0x3d126f in _0x5fff7d){if(_0x5fff7d[_0xa66c('0x30')](_0x3d126f)){delete _0x5fff7d[_0x3d126f];}}}}function clearCampaigns(_0x37ab99){if(!_[_0xa66c('0x2f')](_0x37ab99)){for(var _0x2bbf1e in _0x37ab99){if(_0x37ab99[_0xa66c('0x30')](_0x2bbf1e)){_0x37ab99[_0x2bbf1e][_0xa66c('0x31')]=0x0;}}}}function clearVoiceQueues(_0x17b0ed){if(!_['isEmpty'](_0x17b0ed)){for(var _0x180713 in _0x17b0ed){if(_0x17b0ed[_0xa66c('0x30')](_0x180713)){_0x17b0ed[_0x180713][_0xa66c('0x31')]=0x0;_0x17b0ed[_0x180713][_0xa66c('0x32')]=0x0;_0x17b0ed[_0x180713][_0xa66c('0x33')]=0x0;_0x17b0ed[_0x180713][_0xa66c('0x34')]=0x0;_0x17b0ed[_0x180713][_0xa66c('0x35')]=!![];}}}}function clearAgentBooked(_0x26bfbc){if(!_[_0xa66c('0x2f')](_0x26bfbc)){for(var _0x271ee8 in _0x26bfbc){if(_0x26bfbc[_0xa66c('0x30')](_0x271ee8)){_0x26bfbc[_0x271ee8][_0xa66c('0x36')]=!![];}}}}VoiceQueueReport[_0xa66c('0xc')]['clearZombieChannels']=function(){var _0x214a3f=this;for(var _0x52bced in this[_0xa66c('0x11')]){if(this['channels'][_0xa66c('0x30')](_0x52bced)&&!this[_0xa66c('0x11')][_0x52bced]['switch']){this[_0xa66c('0xe')][_0xa66c('0xd')](function(){if(!_[_0xa66c('0x37')](_0x214a3f[_0xa66c('0x11')][_0x52bced])){return ami[_0xa66c('0x38')]({'action':_0xa66c('0x39'),'channel':_0x214a3f[_0xa66c('0x11')][_0x52bced][_0xa66c('0x3a')]})[_0xa66c('0x3b')](function(_0x2499c5){if(_0x2499c5['message']===_0xa66c('0x3c')){setTimeout(function(){if(_0x214a3f[_0xa66c('0x11')][_0x52bced]){delete _0x214a3f[_0xa66c('0x11')][_0x52bced];logger[_0xa66c('0x3d')](_0xa66c('0x3e'),_0x52bced);}if(_0x214a3f[_0xa66c('0xf')][_0x52bced]){delete _0x214a3f[_0xa66c('0xf')][_0x52bced];logger[_0xa66c('0x3d')]('[voiceQueueReport][checkQueueReport]',_0x52bced);}if(_0x214a3f['variables'][_0x52bced]){delete _0x214a3f[_0xa66c('0x16')][_0x52bced];logger[_0xa66c('0x3d')](_0xa66c('0x3f'),_0x52bced);}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xa66c('0x26')]=function(){logger[_0xa66c('0x3d')](_0xa66c('0x40'));clearChannels(this[_0xa66c('0x11')]);this[_0xa66c('0x41')](this[_0xa66c('0xf')]);clearAgentBooked(this[_0xa66c('0x10')]);clearVoiceQueues(this[_0xa66c('0x13')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x41')]=function(_0x1b794a){var _0x21b58c=this;if(!_['isEmpty'](_0x1b794a)){for(var _0xf5f9c9 in _0x1b794a){if(_0x1b794a[_0xa66c('0x30')](_0xf5f9c9)){_0x21b58c[_0xa66c('0x42')](_0x1b794a[_0xf5f9c9]);delete _0x1b794a[_0xf5f9c9];}}}};function loggerCatch(_0x4ddd46){return function(_0x1a69db){logger[_0xa66c('0x3d')](_0x4ddd46,util[_0xa66c('0x43')](_0x1a69db,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xa66c('0xc')]['emit']=function(_0x2e45e7,_0x3cf69c,_0x480be8){io['to'](_0x2e45e7)['emit'](_0x3cf69c,_0x480be8);};VoiceQueueReport['prototype'][_0xa66c('0x44')]=function(_0x4465df){this[_0xa66c('0x45')](util[_0xa66c('0x46')](_0xa66c('0x47'),_0x4465df[_0xa66c('0x48')]),_0xa66c('0x49'),_0x4465df);};VoiceQueueReport['prototype'][_0xa66c('0x42')]=function(_0x2ea97c){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x2ea97c));this['emit'](util[_0xa66c('0x46')](_0xa66c('0x47'),_0x2ea97c[_0xa66c('0x48')]),'voice_queue_channel:remove',_0x2ea97c);};VoiceQueueReport[_0xa66c('0xc')]['emitVoiceQueueSummary']=function(_0x2dd200){if(_0x2dd200['type']===_0xa66c('0x4a')){var _0xc13dd9={'id':_0x2dd200['id'],'name':_0x2dd200[_0xa66c('0x48')],'strategy':_0x2dd200[_0xa66c('0x4b')],'answered':_0x2dd200[_0xa66c('0x4c')],'available':_0x2dd200[_0xa66c('0x4d')],'loggedIn':_0x2dd200[_0xa66c('0x4e')],'pTalking':_0x2dd200[_0xa66c('0x33')],'sumBillable':_0x2dd200[_0xa66c('0x4f')],'sumDuration':_0x2dd200[_0xa66c('0x50')],'sumHoldTime':_0x2dd200[_0xa66c('0x51')]||0x0,'talking':_0x2dd200[_0xa66c('0x32')],'total':_0x2dd200['total'],'type':_0x2dd200[_0xa66c('0x52')],'unmanaged':_0x2dd200[_0xa66c('0x53')],'abandoned':_0x2dd200[_0xa66c('0x54')],'waiting':_0x2dd200[_0xa66c('0x34')]};if(_0x2dd200[_0xa66c('0x55')]){_0xc13dd9[_0xa66c('0x55')]={'id':_0x2dd200[_0xa66c('0x55')]['id'],'name':_0x2dd200[_0xa66c('0x55')][_0xa66c('0x48')],'active':_0x2dd200[_0xa66c('0x55')]['active'],'callerid':_0x2dd200[_0xa66c('0x55')]['callerid']};}if(_0x2dd200[_0xa66c('0x56')]){_0xc13dd9[_0xa66c('0x56')]={'id':_0x2dd200[_0xa66c('0x56')]['id'],'name':_0x2dd200['Interval']['name']};}var _0x29168f=md5(JSON[_0xa66c('0x57')](_0xc13dd9));if(_0x2dd200['md5']!==_0x29168f){_0x2dd200[_0xa66c('0x4')]=_0x29168f;this[_0xa66c('0x45')](util[_0xa66c('0x46')](_0xa66c('0x47'),_0xc13dd9[_0xa66c('0x48')]),_0xa66c('0x58'),_0xc13dd9);}}};VoiceQueueReport['prototype'][_0xa66c('0x59')]=function(_0x52c3bb){return _0x52c3bb!==null&&!_[_0xa66c('0x2e')](_0x52c3bb);};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x2d')]=function(){var _0x141cb5=this;setInterval(function(){_0x141cb5['clearZombieChannels']();ami[_0xa66c('0x38')]({'action':'queues'})['catch'](loggerCatch(_0xa66c('0x5a')));},0x2710);};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x2c')]=function(){var _0x11c8c5=this;setInterval(function(){if(_0x11c8c5[_0xa66c('0x14')]){return ami[_0xa66c('0x38')]({'action':_0xa66c('0x5b')})[_0xa66c('0x5c')](function(_0x3dd681){_0x11c8c5[_0xa66c('0x14')]=![];})[_0xa66c('0x3b')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x17')]=function(_0x3693d9){try{if(this['isNotNull'](_0x3693d9)&&this[_0xa66c('0x59')](_0x3693d9['queue'])){if(this['voiceQueues'][_0x3693d9[_0xa66c('0x5d')]]){var _0x5d1181=_[_0xa66c('0x5e')](this[_0xa66c('0x11')],_0xa66c('0x5d'))[_0x3693d9[_0xa66c('0x5d')]]||0x0;var _0x243288=_0x5d1181-_0x3693d9[_0xa66c('0x5f')];if(this['voiceQueues'][_0x3693d9['queue']]['waiting']!==_['toNumber'](_0x3693d9[_0xa66c('0x5f')])||this[_0xa66c('0x13')][_0x3693d9[_0xa66c('0x5d')]][_0xa66c('0x4e')]!==_[_0xa66c('0x60')](_0x3693d9['loggedin'])||this[_0xa66c('0x13')][_0x3693d9[_0xa66c('0x5d')]][_0xa66c('0x4d')]!==_[_0xa66c('0x60')](_0x3693d9['available'])||this[_0xa66c('0x13')][_0x3693d9['queue']][_0xa66c('0x32')]!==_0x243288){this['voiceQueues'][_0x3693d9[_0xa66c('0x5d')]]['waiting']=_[_0xa66c('0x60')](_0x3693d9[_0xa66c('0x5f')]);this['voiceQueues'][_0x3693d9[_0xa66c('0x5d')]][_0xa66c('0x4e')]=_['toNumber'](_0x3693d9[_0xa66c('0x61')]);this[_0xa66c('0x13')][_0x3693d9[_0xa66c('0x5d')]][_0xa66c('0x4d')]=_[_0xa66c('0x60')](_0x3693d9['available']);this['voiceQueues'][_0x3693d9[_0xa66c('0x5d')]][_0xa66c('0x32')]=_0x243288>0x0?_0x243288:0x0;this['voiceQueues'][_0x3693d9[_0xa66c('0x5d')]][_0xa66c('0x32')]=this[_0xa66c('0x13')][_0x3693d9[_0xa66c('0x5d')]][_0xa66c('0x32')]>_[_0xa66c('0x60')](_0x3693d9[_0xa66c('0x61')])?_[_0xa66c('0x60')](_0x3693d9['loggedin']):this[_0xa66c('0x13')][_0x3693d9['queue']][_0xa66c('0x32')];this['emitVoiceQueueSummary'](this[_0xa66c('0x13')][_0x3693d9[_0xa66c('0x5d')]]);}ami[_0xa66c('0x45')](_0xa66c('0x62'),this[_0xa66c('0x13')][_0x3693d9[_0xa66c('0x5d')]]);}}}catch(_0x2c6d42){logger[_0xa66c('0x3d')]('[syncQueueSummary][VoiceQueueReport]',util[_0xa66c('0x43')](_0x2c6d42,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa66c('0xc')]['syncQueueSummaryComplete']=function(_0x268003){this[_0xa66c('0x14')]=!![];};VoiceQueueReport[_0xa66c('0xc')]['syncNewExten']=function(_0x23947d){};VoiceQueueReport[_0xa66c('0xc')]['syncQueueCallerJoin']=function(_0x4157fe){try{if(this[_0xa66c('0x59')](_0x4157fe)){if(_[_0xa66c('0x2e')](this[_0xa66c('0xf')][_0x4157fe[_0xa66c('0x63')]])){this[_0xa66c('0xf')][_0x4157fe['uniqueid']]=[];this[_0xa66c('0x11')][_0x4157fe[_0xa66c('0x63')]]={};}var _0x181eaf=new QueueReport();_0x181eaf[_0xa66c('0x48')]=_0x4157fe[_0xa66c('0x5d')];_0x181eaf[_0xa66c('0x52')]=this[_0xa66c('0x13')][_0x181eaf[_0xa66c('0x48')]]&&this[_0xa66c('0x13')][_0x181eaf[_0xa66c('0x48')]]['type']?this[_0xa66c('0x13')][_0x181eaf[_0xa66c('0x48')]][_0xa66c('0x52')]||_0xa66c('0x4a'):_0xa66c('0x4a');_0x181eaf[_0xa66c('0x5d')]=_0x4157fe[_0xa66c('0x5d')];_0x181eaf['queuecallerjoinAt']=moment()[_0xa66c('0x46')](_0xa66c('0x64'));_0x181eaf['position']=_0x4157fe[_0xa66c('0x65')];_0x181eaf['count']=_0x4157fe[_0xa66c('0x66')];_[_0xa66c('0x67')](_0x181eaf,_[_0xa66c('0x68')](_0x4157fe,_[_0xa66c('0x69')](_0x181eaf)));this['queueReports'][_0x4157fe['uniqueid']][_0xa66c('0x6a')](_0x181eaf);this['channels'][_0x4157fe[_0xa66c('0x63')]]=_0x181eaf;this['emitVoiceQueueChannelSave'](_0x181eaf);}}catch(_0x48e2e3){logger['error']('[syncQueueCallerJoin][VoiceQueueReport]',util['inspect'](_0x48e2e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x1c')]=function(_0x108408){try{if(this[_0xa66c('0x59')](_0x108408)){if(this[_0xa66c('0xf')][_0x108408[_0xa66c('0x63')]]){var _0x5dd8cc=_[_0xa66c('0x6b')](this[_0xa66c('0xf')][_0x108408[_0xa66c('0x63')]]);_0x5dd8cc[_0xa66c('0x6c')]=![];_0x5dd8cc['queuecallercompleteAt']=null;_0x5dd8cc['holdtime']=_0x108408[_0xa66c('0x6d')];_0x5dd8cc['originalposition']=_0x108408[_0xa66c('0x6e')];_0x5dd8cc[_0xa66c('0x1b')]=!![];_0x5dd8cc[_0xa66c('0x6f')]=moment()['format'](_0xa66c('0x64'));_0x5dd8cc['queuecallerexitreason']=_0xa66c('0x70');_0x5dd8cc[_0xa66c('0x71')]=null;this['channels'][_0x108408[_0xa66c('0x63')]]=_0x5dd8cc;this['emitVoiceQueueChannelRemove'](_0x5dd8cc);}}}catch(_0x5d20de){logger[_0xa66c('0x3d')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0xa66c('0x43')](_0x5d20de,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa66c('0x1e')]=function(_0x32cbf6){try{if(this[_0xa66c('0x59')](_0x32cbf6)){if(this[_0xa66c('0xf')][_0x32cbf6[_0xa66c('0x63')]]){var _0x5f4059=_['last'](this[_0xa66c('0xf')][_0x32cbf6['uniqueid']]);_0x5f4059[_0xa66c('0x72')]=moment()[_0xa66c('0x46')](_0xa66c('0x64'));_0x5f4059[_0xa66c('0x73')]=_0x32cbf6[_0xa66c('0x73')];_0x5f4059[_0xa66c('0x74')]=_0x32cbf6['connectedlinename'];this[_0xa66c('0x11')][_0x32cbf6['uniqueid']]=_0x5f4059;this[_0xa66c('0x44')](_0x5f4059);}}}catch(_0xfa9fe0){logger[_0xa66c('0x3d')](_0xa66c('0x75'),util[_0xa66c('0x43')](_0xfa9fe0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x10e324){try{if(this[_0xa66c('0x59')](_0x10e324)){if(this[_0xa66c('0xf')][_0x10e324['uniqueid']]){var _0x5b29da=_[_0xa66c('0x6b')](this[_0xa66c('0xf')][_0x10e324[_0xa66c('0x63')]]);_0x5b29da[_0xa66c('0x6c')]=!![];_0x5b29da[_0xa66c('0x76')]=_0xa66c('0x77');}}}catch(_0x2a5362){logger[_0xa66c('0x3d')](_0xa66c('0x78'),util[_0xa66c('0x43')](_0x2a5362,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x1755ac){try{if(this[_0xa66c('0x59')](_0x1755ac)){if(this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x63')]]){var _0x137336=_['last'](this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x63')]]);_0x137336['queuecallerabandon']=![];_0x137336['queuecallerabandonAt']=null;_0x137336['assigned']=!![];_0x137336['lastAssignedTo']=_0x1755ac[_0xa66c('0x79')];_0x137336[_0xa66c('0x6d')]=_0x1755ac[_0xa66c('0x6d')];_0x137336[_0xa66c('0x6c')]=!![];_0x137336[_0xa66c('0x7a')]=![];_0x137336['queuecallerexitAt']=null;if(!_0x137336[_0xa66c('0x7b')]){if(_0x1755ac[_0xa66c('0x7c')]==_0xa66c('0x7b')){_0x137336[_0xa66c('0x76')]=_0xa66c('0x7d');}else{if(_['startsWith'](_0x1755ac[_0xa66c('0x3a')]['toLowerCase'](),_0xa66c('0x7e'))){if(this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x7f')]]){var _0x254648=_[_0xa66c('0x6b')](this[_0xa66c('0xf')][_0x1755ac['linkedid']]);_0x254648[_0xa66c('0x6c')]=![];_0x254648[_0xa66c('0x7a')]=!![];_0x254648['queuecallerexitAt']=moment(_0x137336['queuecallerjoinAt'])['add'](_0x1755ac[_0xa66c('0x6d')],'seconds')[_0xa66c('0x46')](_0xa66c('0x64'));_0x254648[_0xa66c('0x76')]=_0xa66c('0x80');_0x254648[_0xa66c('0x7b')]=!![];_0x254648[_0xa66c('0x81')]=_0xa66c('0x82');_0x254648['transferexten']=_0x1755ac[_0xa66c('0x83')];_0x254648[_0xa66c('0x84')]=_0x1755ac[_0xa66c('0x63')];var _0x5b0829=this[_0xa66c('0xf')][_0x1755ac['linkedid']];this[_0xa66c('0xf')][_0x1755ac['linkedid']]=this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x63')]];this[_0xa66c('0xf')][_0x1755ac[_0xa66c('0x63')]]=_0x5b0829;}}else{_0x137336[_0xa66c('0x76')]=_0xa66c('0x85')+_0x1755ac[_0xa66c('0x7c')]['toUpperCase']();}}}this[_0xa66c('0x11')][_0x1755ac['uniqueid']]=_0x137336;this[_0xa66c('0x42')](_0x137336);}}}catch(_0x1c161d){logger['error'](_0xa66c('0x86'),util['inspect'](_0x1c161d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x87')]=function(_0x45b051){try{if(this[_0xa66c('0x59')](_0x45b051)){this[_0xa66c('0x88')](_0x45b051[_0xa66c('0x63')],_[_0xa66c('0x69')](_0x45b051['variable'])[0x0],_0x45b051[_0xa66c('0x89')]);if(this['queueReports'][_0x45b051[_0xa66c('0x63')]]){var _0x46837f=_[_0xa66c('0x6b')](this[_0xa66c('0xf')][_0x45b051['uniqueid']]);if(_0x46837f){if(this[_0xa66c('0x59')](_0x45b051[_0xa66c('0x8a')])&&this[_0xa66c('0x59')](_0x45b051[_0xa66c('0x8a')][_0xa66c('0x8b')])){switch(_0x45b051['value']){case _0xa66c('0x8c'):_0x46837f[_0xa66c('0x7a')]=![];_0x46837f[_0xa66c('0x8d')]=null;break;case'TIMEOUT':_0x46837f[_0xa66c('0x8e')]=_0xa66c('0x8f');ami[_0xa66c('0x45')](_0xa66c('0x90'),_0x46837f);break;default:_0x46837f[_0xa66c('0x7a')]=!![];_0x46837f['queuecallerexitAt']=moment()[_0xa66c('0x46')](_0xa66c('0x64'));_0x46837f[_0xa66c('0x72')]=moment()[_0xa66c('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x46837f['queuecallerabandon']=![];_0x46837f['queuecallerabandonAt']=null;_0x46837f['queuecallerexitreason']=_0x45b051[_0xa66c('0x89')];this['channels'][_0x45b051[_0xa66c('0x63')]]=_0x46837f;this['emitVoiceQueueChannelRemove'](_0x46837f);}else if(this[_0xa66c('0x59')](_0x45b051['variable'])&&this[_0xa66c('0x59')](_0x45b051[_0xa66c('0x8a')][_0xa66c('0x91')])){if(!_0x46837f[_0xa66c('0x1b')]){_0x46837f['queuecallerexit']=!![];_0x46837f[_0xa66c('0x8d')]=moment()[_0xa66c('0x46')](_0xa66c('0x64'));_0x46837f[_0xa66c('0x76')]=_0xa66c('0x92');_0x46837f['queuecallerleaveAt']=moment()[_0xa66c('0x46')](_0xa66c('0x64'));this[_0xa66c('0x11')][_0x45b051['uniqueid']]=_0x46837f;}}_0x46837f[_0xa66c('0x16')]=this[_0xa66c('0x16')][_0x45b051[_0xa66c('0x63')]];}}}}catch(_0x5c5392){logger[_0xa66c('0x3d')]('[syncVarSet][VoiceQueueReport]',util[_0xa66c('0x43')](_0x5c5392,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa66c('0xc')][_0xa66c('0x88')]=function(_0xed1e,_0x139384,_0x3d753a){var _0x6fc3d9=[_0xa66c('0x93'),_0xa66c('0x94'),_0xa66c('0x95'),'rtpaudioqosjitterbridged',_0xa66c('0x96'),_0xa66c('0x97'),_0xa66c('0x98'),'rtpaudioqosrttbridged',_0xa66c('0x99'),_0xa66c('0x9a'),'bridgepeer',_0xa66c('0x9b'),_0xa66c('0x9c'),'memberdynamic',_0xa66c('0x9d'),_0xa66c('0x9e'),_0xa66c('0x79'),_0xa66c('0x9f'),'memberrealtime'];if(!_['isNil'](_0x139384)&&!_[_0xa66c('0xa0')](_0x6fc3d9,_0x139384)){if(_[_0xa66c('0x2e')](this[_0xa66c('0x16')][_0xed1e])){this[_0xa66c('0x16')][_0xed1e]={};}this[_0xa66c('0x16')][_0xed1e][_0x139384]=_0x3d753a;}};VoiceQueueReport['prototype']['syncHangup']=function(_0x56668f){try{if(this['isNotNull'](_0x56668f)){if(this['queueReports'][_0x56668f['uniqueid']]){for(var _0xdf820b=0x0,_0x5ed90c={};_0xdf820b0x0?_0x4c1038:0x0;this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]][_0x8113('0x32')]=this['voiceQueues'][_0x4bd96f[_0x8113('0x63')]]['talking']>_[_0x8113('0x66')](_0x4bd96f[_0x8113('0x67')])?_[_0x8113('0x66')](_0x4bd96f['loggedin']):this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]][_0x8113('0x32')];this['emitVoiceQueueSummary'](this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]]);}ami[_0x8113('0x44')](_0x8113('0x69'),this[_0x8113('0x12')][_0x4bd96f[_0x8113('0x63')]]);}}}catch(_0x14996b){logger[_0x8113('0x3c')]('[syncQueueSummary][VoiceQueueReport]',util['inspect'](_0x14996b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x3bfe76){this[_0x8113('0x13')]=!![];};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x6a')]=function(_0x13f2cf){};VoiceQueueReport[_0x8113('0xa')]['syncQueueCallerJoin']=function(_0x251364){try{if(this[_0x8113('0x5f')](_0x251364)){if(_[_0x8113('0x2e')](this[_0x8113('0xf')][_0x251364['uniqueid']])){this[_0x8113('0xf')][_0x251364[_0x8113('0x6b')]]=[];this['channels'][_0x251364['uniqueid']]={};}var _0xdde8af=new QueueReport();_0xdde8af[_0x8113('0x48')]=_0x251364[_0x8113('0x63')];_0xdde8af[_0x8113('0x4f')]=this['voiceQueues'][_0xdde8af[_0x8113('0x48')]]&&this['voiceQueues'][_0xdde8af[_0x8113('0x48')]][_0x8113('0x4f')]?this['voiceQueues'][_0xdde8af['name']][_0x8113('0x4f')]||_0x8113('0x50'):'inbound';_0xdde8af[_0x8113('0x63')]=_0x251364['queue'];_0xdde8af[_0x8113('0x6c')]=moment()[_0x8113('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xdde8af[_0x8113('0x6d')]=_0x251364[_0x8113('0x6d')];_0xdde8af[_0x8113('0x6e')]=_0x251364['count'];_['merge'](_0xdde8af,_[_0x8113('0x6f')](_0x251364,_[_0x8113('0x70')](_0xdde8af)));this[_0x8113('0xf')][_0x251364['uniqueid']][_0x8113('0x71')](_0xdde8af);this['channels'][_0x251364['uniqueid']]=_0xdde8af;this[_0x8113('0x45')](_0xdde8af);}}catch(_0x5d2c70){logger[_0x8113('0x3c')](_0x8113('0x72'),util['inspect'](_0x5d2c70,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')]['syncQueueCallerAbandon']=function(_0xeb009b){try{if(this[_0x8113('0x5f')](_0xeb009b)){if(this['queueReports'][_0xeb009b[_0x8113('0x6b')]]){var _0x3cfcca=_['last'](this[_0x8113('0xf')][_0xeb009b[_0x8113('0x6b')]]);_0x3cfcca[_0x8113('0x73')]=![];_0x3cfcca['queuecallercompleteAt']=null;_0x3cfcca['holdtime']=_0xeb009b[_0x8113('0x74')];_0x3cfcca[_0x8113('0x75')]=_0xeb009b[_0x8113('0x75')];_0x3cfcca[_0x8113('0x1b')]=!![];_0x3cfcca[_0x8113('0x76')]=moment()[_0x8113('0x46')](_0x8113('0x77'));_0x3cfcca['queuecallerexitreason']=_0x8113('0x78');_0x3cfcca[_0x8113('0x79')]=null;this['channels'][_0xeb009b[_0x8113('0x6b')]]=_0x3cfcca;this['emitVoiceQueueChannelRemove'](_0x3cfcca);}}}catch(_0x41e6af){logger[_0x8113('0x3c')]('[syncQueueCallerAbandon][VoiceQueueReport]',util['inspect'](_0x41e6af,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')]['syncQueueCallerLeave']=function(_0x53a559){try{if(this['isNotNull'](_0x53a559)){if(this['queueReports'][_0x53a559[_0x8113('0x6b')]]){var _0xbff381=_[_0x8113('0x7a')](this[_0x8113('0xf')][_0x53a559['uniqueid']]);_0xbff381['queuecallerleaveAt']=moment()['format'](_0x8113('0x77'));_0xbff381[_0x8113('0x7b')]=_0x53a559[_0x8113('0x7b')];_0xbff381[_0x8113('0x7c')]=_0x53a559[_0x8113('0x7c')];this[_0x8113('0x11')][_0x53a559['uniqueid']]=_0xbff381;this[_0x8113('0x45')](_0xbff381);}}}catch(_0x126285){logger[_0x8113('0x3c')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x8113('0x43')](_0x126285,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x20')]=function(_0x2a4c3c){try{if(this[_0x8113('0x5f')](_0x2a4c3c)){if(this[_0x8113('0xf')][_0x2a4c3c[_0x8113('0x6b')]]){var _0x5bebdd=_[_0x8113('0x7a')](this['queueReports'][_0x2a4c3c[_0x8113('0x6b')]]);_0x5bebdd[_0x8113('0x73')]=!![];_0x5bebdd[_0x8113('0x7d')]='COMPLETEDBYAGENT';}}}catch(_0x379e07){logger[_0x8113('0x3c')](_0x8113('0x7e'),util[_0x8113('0x43')](_0x379e07,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')][_0x8113('0x1f')]=function(_0x585d91){try{if(this[_0x8113('0x5f')](_0x585d91)){if(this[_0x8113('0xf')][_0x585d91['uniqueid']]){var _0x3b6d90=_[_0x8113('0x7a')](this['queueReports'][_0x585d91[_0x8113('0x6b')]]);_0x3b6d90[_0x8113('0x1b')]=![];_0x3b6d90[_0x8113('0x76')]=null;_0x3b6d90[_0x8113('0x7f')]=!![];_0x3b6d90[_0x8113('0x79')]=_0x585d91[_0x8113('0x80')];_0x3b6d90[_0x8113('0x74')]=_0x585d91[_0x8113('0x74')];_0x3b6d90[_0x8113('0x73')]=!![];_0x3b6d90[_0x8113('0x81')]=![];_0x3b6d90[_0x8113('0x82')]=null;if(!_0x3b6d90[_0x8113('0x83')]){if(_0x585d91[_0x8113('0x84')]=='transfer'){_0x3b6d90[_0x8113('0x7d')]='COMPLETED';}else{if(_['startsWith'](_0x585d91[_0x8113('0x39')][_0x8113('0x85')](),_0x8113('0x86'))){if(this[_0x8113('0xf')][_0x585d91[_0x8113('0x87')]]){var _0x2eee9e=_[_0x8113('0x7a')](this[_0x8113('0xf')][_0x585d91['linkedid']]);_0x2eee9e[_0x8113('0x73')]=![];_0x2eee9e[_0x8113('0x81')]=!![];_0x2eee9e['queuecallerexitAt']=moment(_0x3b6d90[_0x8113('0x6c')])[_0x8113('0x88')](_0x585d91[_0x8113('0x74')],_0x8113('0x89'))[_0x8113('0x46')](_0x8113('0x77'));_0x2eee9e[_0x8113('0x7d')]=_0x8113('0x8a');_0x2eee9e[_0x8113('0x83')]=!![];_0x2eee9e['transfertype']=_0x8113('0x8b');_0x2eee9e[_0x8113('0x8c')]=_0x585d91[_0x8113('0x8d')];_0x2eee9e[_0x8113('0x8e')]=_0x585d91[_0x8113('0x6b')];var _0x2b41c9=this[_0x8113('0xf')][_0x585d91[_0x8113('0x87')]];this[_0x8113('0xf')][_0x585d91[_0x8113('0x87')]]=this[_0x8113('0xf')][_0x585d91[_0x8113('0x6b')]];this['queueReports'][_0x585d91[_0x8113('0x6b')]]=_0x2b41c9;}}else{_0x3b6d90[_0x8113('0x7d')]=_0x8113('0x8f')+_0x585d91[_0x8113('0x84')][_0x8113('0x90')]();}}}this[_0x8113('0x11')][_0x585d91['uniqueid']]=_0x3b6d90;this[_0x8113('0x42')](_0x3b6d90);}}}catch(_0x49efe4){logger[_0x8113('0x3c')](_0x8113('0x91'),util[_0x8113('0x43')](_0x49efe4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8113('0xa')]['syncVarSet']=function(_0xa64c55){try{if(this['isNotNull'](_0xa64c55)){this[_0x8113('0x92')](_0xa64c55['uniqueid'],_[_0x8113('0x70')](_0xa64c55[_0x8113('0x93')])[0x0],_0xa64c55[_0x8113('0x94')]);if(this[_0x8113('0xf')][_0xa64c55['uniqueid']]){var _0x4a6378=_['last'](this[_0x8113('0xf')][_0xa64c55[_0x8113('0x6b')]]);if(_0x4a6378){if(this[_0x8113('0x5f')](_0xa64c55[_0x8113('0x93')])&&this[_0x8113('0x5f')](_0xa64c55[_0x8113('0x93')][_0x8113('0x95')])){switch(_0xa64c55[_0x8113('0x94')]){case'CONTINUE':_0x4a6378[_0x8113('0x81')]=![];_0x4a6378[_0x8113('0x82')]=null;break;case _0x8113('0x96'):_0x4a6378[_0x8113('0x97')]=_0x8113('0x98');ami[_0x8113('0x44')]('custom:timeout',_0x4a6378);break;default:_0x4a6378[_0x8113('0x81')]=!![];_0x4a6378[_0x8113('0x82')]=moment()[_0x8113('0x46')](_0x8113('0x77'));_0x4a6378[_0x8113('0x99')]=moment()['format'](_0x8113('0x77'));}_0x4a6378[_0x8113('0x1b')]=![];_0x4a6378[_0x8113('0x76')]=null;_0x4a6378[_0x8113('0x7d')]=_0xa64c55[_0x8113('0x94')];this[_0x8113('0x11')][_0xa64c55[_0x8113('0x6b')]]=_0x4a6378;this['emitVoiceQueueChannelRemove'](_0x4a6378);}else if(this[_0x8113('0x5f')](_0xa64c55['variable'])&&this['isNotNull'](_0xa64c55[_0x8113('0x93')][_0x8113('0x9a')])){if(!_0x4a6378[_0x8113('0x1b')]){_0x4a6378[_0x8113('0x81')]=!![];_0x4a6378[_0x8113('0x82')]=moment()[_0x8113('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a6378[_0x8113('0x7d')]=_0x8113('0x9b');_0x4a6378[_0x8113('0x99')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8113('0x11')][_0xa64c55['uniqueid']]=_0x4a6378;}}_0x4a6378['variables']=this[_0x8113('0x3f')][_0xa64c55[_0x8113('0x6b')]];}}}}catch(_0x146e99){logger['error'](_0x8113('0x9c'),util[_0x8113('0x43')](_0x146e99,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x4b6e93,_0x13ff4a,_0x32f746){var _0x26fd6c=['rtpaudioqos',_0x8113('0x9d'),_0x8113('0x9e'),_0x8113('0x9f'),_0x8113('0xa0'),_0x8113('0xa1'),_0x8113('0xa2'),'rtpaudioqosrttbridged',_0x8113('0xa3'),_0x8113('0xa4'),_0x8113('0xa5'),_0x8113('0xa6'),'membercalls',_0x8113('0xa7'),_0x8113('0xa8'),_0x8113('0xa9'),_0x8113('0x80'),_0x8113('0xaa'),'memberrealtime'];if(!_[_0x8113('0x37')](_0x13ff4a)&&!_[_0x8113('0xab')](_0x26fd6c,_0x13ff4a)){if(_['isUndefined'](this[_0x8113('0x3f')][_0x4b6e93])){this['variables'][_0x4b6e93]={};}this[_0x8113('0x3f')][_0x4b6e93][_0x13ff4a]=_0x32f746;}};VoiceQueueReport[_0x8113('0xa')]['syncHangup']=function(_0x2467a0){try{if(this[_0x8113('0x5f')](_0x2467a0)){if(this[_0x8113('0xf')][_0x2467a0['uniqueid']]){for(var _0x2e05b0=0x0,_0x2e7abc={};_0x2e05b0=0x0?moment(_0x27565b[_0xe9ac('0x1a')])['diff'](_0x27565b[_0xe9ac('0x1b')],'seconds'):null,'data1':_0xe9ac('0x1c'),'data2':_0x27565b[_0xe9ac('0x15')],'data3':_0x27565b[_0xe9ac('0x12')],'data4':_0x27565b['dialstring']||null,'role':'agent','internal':_0x27565b[_0xe9ac('0x15')]?_['toNumber'](_0x27565b[_0xe9ac('0x15')]):undefined,'uniqueid':_0x27565b[_0xe9ac('0x17')]},'log':_0xe9ac('0x7')});}; \ No newline at end of file +var _0x6ff6=['lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','agent','accountcode','toNumber','voiceDialReport','membername','endtime','starttime','exten','dialstring','uniqueid','moment','util','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6ff6,0x69));var _0x66ff=function(_0x278bd5,_0x46b369){_0x278bd5=_0x278bd5-0x0;var _0x14ec54=_0x6ff6[_0x278bd5];return _0x14ec54;};'use strict';var moment=require(_0x66ff('0x0'));var _=require('lodash');var util=require(_0x66ff('0x1'));var client=require('../client');exports['voiceQueueReport']=function(_0x3c8082){var _0x4f7faa=_0x3c8082[_0x66ff('0x2')]||_0x3c8082[_0x66ff('0x3')];return client[_0x66ff('0x4')](_0x66ff('0x5'),{'body':{'channel':_0x66ff('0x6'),'membername':_0x3c8082[_0x66ff('0x7')],'interface':_[_0x66ff('0x8')](_0x3c8082['interface'])?util[_0x66ff('0x9')](_0x66ff('0xa'),_0x3c8082[_0x66ff('0x7')]):_0x3c8082[_0x66ff('0xb')],'type':_0x66ff('0xc'),'enterAt':_0x3c8082[_0x66ff('0xd')],'exitAt':_0x4f7faa,'duration':moment(_0x4f7faa)[_0x66ff('0xe')](_0x3c8082[_0x66ff('0xd')],_0x66ff('0xf')),'data1':_0x66ff('0x10'),'data2':_0x3c8082[_0x66ff('0x11')],'data3':_0x3c8082['exten'],'data4':null,'data5':_0x3c8082['queue'],'role':_0x66ff('0x12'),'internal':_0x3c8082[_0x66ff('0x13')]?_[_0x66ff('0x14')](_0x3c8082[_0x66ff('0x13')]):undefined,'uniqueid':_0x3c8082['uniqueid']},'log':'CreateMemberReport'});};exports[_0x66ff('0x15')]=function(_0x4d92c2){return client[_0x66ff('0x4')](_0x66ff('0x5'),{'body':{'channel':_0x66ff('0x6'),'membername':_0x4d92c2[_0x66ff('0x16')],'interface':_0x4d92c2[_0x66ff('0xb')],'type':_0x66ff('0xc'),'enterAt':_0x4d92c2['starttime'],'exitAt':_0x4d92c2[_0x66ff('0x17')],'duration':moment(_0x4d92c2['endtime'])[_0x66ff('0xe')](_0x4d92c2[_0x66ff('0x18')],_0x66ff('0xf'))>=0x0?moment(_0x4d92c2[_0x66ff('0x17')])[_0x66ff('0xe')](_0x4d92c2[_0x66ff('0x18')],_0x66ff('0xf')):null,'data1':'outbound','data2':_0x4d92c2[_0x66ff('0x13')],'data3':_0x4d92c2[_0x66ff('0x19')],'data4':_0x4d92c2[_0x66ff('0x1a')]||null,'role':_0x66ff('0x12'),'internal':_0x4d92c2[_0x66ff('0x13')]?_['toNumber'](_0x4d92c2[_0x66ff('0x13')]):undefined,'uniqueid':_0x4d92c2[_0x66ff('0x1b')]},'log':_0x66ff('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index de4635e..1b3f851 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 _0x373d=['GetTemplate','html','../client','Request'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x373d,0x1e2));var _0xd373=function(_0x154a27,_0x8fee08){_0x154a27=_0x154a27-0x0;var _0x201b9c=_0x373d[_0x154a27];return _0x201b9c;};'use strict';var client=require(_0xd373('0x0'));exports['getTemplates']=function(_0x3d3d31){return function(_0x53f3b7){return client[_0xd373('0x1')](_0xd373('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xd373('0x3')]},'log':_0xd373('0x2')});};}; \ No newline at end of file +var _0xad95=['../client','getTemplates','GetTemplate','name'];(function(_0x3738ad,_0x4e25ae){var _0x253a25=function(_0x31954a){while(--_0x31954a){_0x3738ad['push'](_0x3738ad['shift']());}};_0x253a25(++_0x4e25ae);}(_0xad95,0x70));var _0x5ad9=function(_0xcb90a5,_0x3fe815){_0xcb90a5=_0xcb90a5-0x0;var _0x12ac8f=_0xad95[_0xcb90a5];return _0x12ac8f;};'use strict';var client=require(_0x5ad9('0x0'));exports[_0x5ad9('0x1')]=function(_0x1fe578){return function(_0x51c14c){return client['Request'](_0x5ad9('0x2'),{'options':{'raw':!![],'attributes':['id',_0x5ad9('0x3'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e6a0427..3346c59 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 _0xc471=['value','Condition','AnyConditions','Action','Actions','data2','data3','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel','AllConditions','field','operator'];(function(_0x51b648,_0x3af80d){var _0x58a6e5=function(_0x588c4d){while(--_0x588c4d){_0x51b648['push'](_0x51b648['shift']());}};_0x58a6e5(++_0x3af80d);}(_0xc471,0x76));var _0x1c47=function(_0x2720ce,_0x47d0a9){_0x2720ce=_0x2720ce-0x0;var _0x509ebb=_0xc471[_0x2720ce];return _0x509ebb;};'use strict';var client=require(_0x1c47('0x0'));exports[_0x1c47('0x1')]=function(_0x117a30){return function(_0x2fd029){return client['Request'](_0x1c47('0x2'),{'options':{'raw':![],'attributes':['id',_0x1c47('0x3'),_0x1c47('0x4'),'status'],'include':[{'model':'Condition','as':_0x1c47('0x5'),'attributes':['id',_0x1c47('0x6'),_0x1c47('0x7'),_0x1c47('0x8')]},{'model':_0x1c47('0x9'),'as':_0x1c47('0xa'),'attributes':['id',_0x1c47('0x6'),_0x1c47('0x7'),_0x1c47('0x8')]},{'model':_0x1c47('0xb'),'as':_0x1c47('0xc'),'attributes':['id','action','data1',_0x1c47('0xd'),_0x1c47('0xe'),'data4',_0x1c47('0xf'),_0x1c47('0x10'),_0x1c47('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x685d=['data4','data5','data7','../client','GetTrigger','channel','Condition','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0x685d,0x1e3));var _0xd685=function(_0x53d38e,_0x5bf7d2){_0x53d38e=_0x53d38e-0x0;var _0x513b79=_0x685d[_0x53d38e];return _0x513b79;};'use strict';var client=require(_0xd685('0x0'));exports['getTriggers']=function(_0x5ab3bd){return function(_0x40ae24){return client['Request'](_0xd685('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xd685('0x2'),'status'],'include':[{'model':_0xd685('0x3'),'as':'AllConditions','attributes':['id','field',_0xd685('0x4'),_0xd685('0x5')]},{'model':_0xd685('0x3'),'as':_0xd685('0x6'),'attributes':['id','field',_0xd685('0x4'),'value']},{'model':_0xd685('0x7'),'as':_0xd685('0x8'),'attributes':['id',_0xd685('0x9'),_0xd685('0xa'),_0xd685('0xb'),_0xd685('0xc'),_0xd685('0xd'),_0xd685('0xe'),'data6',_0xd685('0xf')]}]},'log':_0xd685('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 9eb1b40..c8c542c 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 _0x2492=['GetTrunk','name','registry','getTrunks'];(function(_0x983d26,_0x49c775){var _0x452a0c=function(_0xa4f62c){while(--_0xa4f62c){_0x983d26['push'](_0x983d26['shift']());}};_0x452a0c(++_0x49c775);}(_0x2492,0xcb));var _0x2249=function(_0x343f8c,_0x30b366){_0x343f8c=_0x343f8c-0x0;var _0x380ebf=_0x2492[_0x343f8c];return _0x380ebf;};'use strict';var client=require('../client');exports[_0x2249('0x0')]=function(_0xf9d79f){return function(_0x8dcf57){return client['Request'](_0x2249('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2249('0x2'),_0x2249('0x3')]},'log':_0x2249('0x1')});};}; \ No newline at end of file +var _0xf763=['../client','getTrunks','Request','GetTrunk','registry'];(function(_0x8c6d69,_0x332b04){var _0x18d108=function(_0x3b60d7){while(--_0x3b60d7){_0x8c6d69['push'](_0x8c6d69['shift']());}};_0x18d108(++_0x332b04);}(_0xf763,0x104));var _0x3f76=function(_0x1c5d8f,_0x3d1c94){_0x1c5d8f=_0x1c5d8f-0x0;var _0x58d07d=_0xf763[_0x1c5d8f];return _0x58d07d;};'use strict';var client=require(_0x3f76('0x0'));exports[_0x3f76('0x1')]=function(_0x17459c){return function(_0x5434af){return client[_0x3f76('0x2')](_0x3f76('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x3f76('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e67dd47..c5ecd6e 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 _0x41a2=['interface','../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','pauseType','voicePause','phone','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','lastLoginAt','lastPauseAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x41a2,0x143));var _0x241a=function(_0x3cf1dc,_0x1d3274){_0x3cf1dc=_0x3cf1dc-0x0;var _0xb97c58=_0x41a2[_0x3cf1dc];return _0xb97c58;};'use strict';var client=require(_0x241a('0x0'));exports[_0x241a('0x1')]=function(){return function(){return client[_0x241a('0x2')](_0x241a('0x3'),{'options':{'raw':![],'where':{'role':_0x241a('0x4')},'attributes':['id',_0x241a('0x5'),_0x241a('0x6'),_0x241a('0x7'),_0x241a('0x8'),_0x241a('0x9'),'lastLoginAt',_0x241a('0xa'),'lastPauseAt',_0x241a('0xb'),_0x241a('0xc'),'mobile','interface']},'log':_0x241a('0x1')});};};exports[_0x241a('0xd')]=function(){return function(){return client['Request'](_0x241a('0x3'),{'options':{'raw':!![],'where':{'role':_0x241a('0xe')},'attributes':['id',_0x241a('0x5'),_0x241a('0x7'),_0x241a('0xf')]},'log':_0x241a('0xd')});};};exports['savePause']=function(_0x3da48c,_0xa2e513,_0x31a5d9){return client[_0x241a('0x2')](_0x241a('0x10'),{'body':{'type':_0xa2e513,'uniqueid':_0x31a5d9},'options':{'where':{'id':_0x3da48c['id']}},'log':'savePause'});};exports['saveUnpause']=function(_0xe6216c){return client[_0x241a('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0xe6216c['id']}},'log':_0x241a('0x11')});};exports[_0x241a('0x12')]=function(_0x4af57c){return client[_0x241a('0x2')](_0x241a('0x13'),{'options':{'raw':![],'where':{'role':_0x241a('0x4'),'id':_0x4af57c},'attributes':['id','name',_0x241a('0x6'),'accountcode',_0x241a('0x8'),_0x241a('0x9'),_0x241a('0x14'),_0x241a('0xa'),_0x241a('0x15'),'voicePause',_0x241a('0x16')]},'log':_0x241a('0x12')});}; \ No newline at end of file +var _0x57c2=['name','accountcode','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','getTelephones','savePause','saveUnpause','UnpauseUser','getAgent','email','fullname','online','interface','getAgents','Request','GetUser','agent'];(function(_0x572418,_0x4ceaf6){var _0x2bf9d4=function(_0xdadb30){while(--_0xdadb30){_0x572418['push'](_0x572418['shift']());}};_0x2bf9d4(++_0x4ceaf6);}(_0x57c2,0xa4));var _0x257c=function(_0x11dcce,_0xae4932){_0x11dcce=_0x11dcce-0x0;var _0x52d134=_0x57c2[_0x11dcce];return _0x52d134;};'use strict';var client=require('../client');exports[_0x257c('0x0')]=function(){return function(){return client[_0x257c('0x1')](_0x257c('0x2'),{'options':{'raw':![],'where':{'role':_0x257c('0x3')},'attributes':['id',_0x257c('0x4'),'email',_0x257c('0x5'),'fullname','online',_0x257c('0x6'),_0x257c('0x7'),_0x257c('0x8'),_0x257c('0x9'),_0x257c('0xa'),_0x257c('0xb'),'interface']},'log':_0x257c('0x0')});};};exports[_0x257c('0xc')]=function(){return function(){return client['Request'](_0x257c('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x257c('0x4'),'accountcode','internal']},'log':_0x257c('0xc')});};};exports[_0x257c('0xd')]=function(_0x1c5bb2,_0x16b723,_0x5e40d7){return client['Request']('PauseUser',{'body':{'type':_0x16b723,'uniqueid':_0x5e40d7},'options':{'where':{'id':_0x1c5bb2['id']}},'log':'savePause'});};exports[_0x257c('0xe')]=function(_0x4e1439){return client[_0x257c('0x1')](_0x257c('0xf'),{'body':{},'options':{'where':{'id':_0x4e1439['id']}},'log':_0x257c('0xd')});};exports[_0x257c('0x10')]=function(_0x9d4126){return client[_0x257c('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0x9d4126},'attributes':['id',_0x257c('0x4'),_0x257c('0x11'),_0x257c('0x5'),_0x257c('0x12'),_0x257c('0x13'),_0x257c('0x6'),_0x257c('0x7'),_0x257c('0x8'),'voicePause',_0x257c('0x14')]},'log':_0x257c('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index bd0c5d3..afed7e1 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 _0xa858=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x3bb7b7,_0x5236ae){var _0x925e91=function(_0x281a8e){while(--_0x281a8e){_0x3bb7b7['push'](_0x3bb7b7['shift']());}};_0x925e91(++_0x5236ae);}(_0xa858,0x1f1));var _0x8a85=function(_0x513f9a,_0x27a11f){_0x513f9a=_0x513f9a-0x0;var _0x1bf32f=_0xa858[_0x513f9a];return _0x1bf32f;};'use strict';var client=require(_0x8a85('0x0'));exports[_0x8a85('0x1')]=function(_0x3c3d31){return client[_0x8a85('0x2')](_0x8a85('0x3'),{'body':_0x3c3d31,'log':_0x8a85('0x3')});};exports[_0x8a85('0x4')]=function(_0x493457,_0x23372a,_0x1940a4){return client[_0x8a85('0x2')](_0x8a85('0x5'),{'body':_0x493457,'options':{'where':{'uniqueid':_0x23372a,'interface':_0x1940a4,'agentcomplete':!![]}},'log':_0x8a85('0x5')});}; \ No newline at end of file +var _0xcbdd=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0x142627,_0x59acfe){var _0x38f93e=function(_0x56041a){while(--_0x56041a){_0x142627['push'](_0x142627['shift']());}};_0x38f93e(++_0x59acfe);}(_0xcbdd,0xec));var _0xdcbd=function(_0x1f7749,_0x509d11){_0x1f7749=_0x1f7749-0x0;var _0x55a16a=_0xcbdd[_0x1f7749];return _0x55a16a;};'use strict';var client=require(_0xdcbd('0x0'));exports['create']=function(_0x342f40){return client[_0xdcbd('0x1')](_0xdcbd('0x2'),{'body':_0x342f40,'log':'CreateVoiceAgentReport'});};exports[_0xdcbd('0x3')]=function(_0x3b2849,_0x3d3e88,_0x5c0331){return client[_0xdcbd('0x1')]('UpdateVoiceAgentReport',{'body':_0x3b2849,'options':{'where':{'uniqueid':_0x3d3e88,'interface':_0x5c0331,'agentcomplete':!![]}},'log':_0xdcbd('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6fafb43..55cadbe 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 _0x866e=['moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports'];(function(_0xbcb6,_0x8e00a9){var _0x58899b=function(_0x35e0c4){while(--_0x35e0c4){_0xbcb6['push'](_0xbcb6['shift']());}};_0x58899b(++_0x8e00a9);}(_0x866e,0xa8));var _0xe866=function(_0x277e7d,_0x54b29c){_0x277e7d=_0x277e7d-0x0;var _0x33568d=_0x866e[_0x277e7d];return _0x33568d;};'use strict';var moment=require(_0xe866('0x0'));var util=require(_0xe866('0x1'));var _=require(_0xe866('0x2'));var client=require(_0xe866('0x3'));exports[_0xe866('0x4')]=function(_0x5d8e1a){return client[_0xe866('0x5')](_0xe866('0x6'),{'body':_[_0xe866('0x7')](_0x5d8e1a,{'source':_0x5d8e1a['calleridnum'],'destinationcontext':_0x5d8e1a[_0xe866('0x8')],'callerid':_0x5d8e1a[_0xe866('0x9')],'amaflags':_0xe866('0xa')}),'log':_0xe866('0x6')});};exports[_0xe866('0xb')]=function(){return function(){return client['Request'](_0xe866('0xc'),{'options':{'where':{'type':[_0xe866('0xd')],'createdAt':{'$between':[moment()[_0xe866('0xe')](_0xe866('0xf'))[_0xe866('0x10')](_0xe866('0x11')),moment()[_0xe866('0x12')]('day')[_0xe866('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xe866('0x13'),_0xe866('0x14'),_0xe866('0x15'),_0xe866('0x16')]},'log':_0xe866('0x17')});};}; \ No newline at end of file +var _0xc681=['YYYY-MM-DD\x20HH:mm:ss','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc681,0x97));var _0x1c68=function(_0x4fd642,_0x542c9c){_0x4fd642=_0x4fd642-0x0;var _0x22f7a8=_0xc681[_0x4fd642];return _0x22f7a8;};'use strict';var moment=require(_0x1c68('0x0'));var util=require(_0x1c68('0x1'));var _=require(_0x1c68('0x2'));var client=require(_0x1c68('0x3'));exports[_0x1c68('0x4')]=function(_0x2c0bb1){return client[_0x1c68('0x5')](_0x1c68('0x6'),{'body':_[_0x1c68('0x7')](_0x2c0bb1,{'source':_0x2c0bb1[_0x1c68('0x8')],'destinationcontext':_0x2c0bb1[_0x1c68('0x9')],'callerid':_0x2c0bb1[_0x1c68('0xa')],'amaflags':'DOCUMENTATION'}),'log':_0x1c68('0x6')});};exports[_0x1c68('0xb')]=function(){return function(){return client['Request'](_0x1c68('0xc'),{'options':{'where':{'type':[_0x1c68('0xd')],'createdAt':{'$between':[moment()[_0x1c68('0xe')](_0x1c68('0xf'))[_0x1c68('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x1c68('0xf'))[_0x1c68('0x10')](_0x1c68('0x11'))]}},'attributes':['type',_0x1c68('0x12'),_0x1c68('0x13'),'billableseconds']},'log':_0x1c68('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 0df3bbe..7a76a1b 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 _0x5398=['CreateVoiceDialReport','../client','create','Request'];(function(_0x34a6eb,_0x537ebe){var _0x33510b=function(_0x36b71d){while(--_0x36b71d){_0x34a6eb['push'](_0x34a6eb['shift']());}};_0x33510b(++_0x537ebe);}(_0x5398,0x161));var _0x8539=function(_0x309edd,_0x45b3ed){_0x309edd=_0x309edd-0x0;var _0x97e361=_0x5398[_0x309edd];return _0x97e361;};'use strict';var client=require(_0x8539('0x0'));exports[_0x8539('0x1')]=function(_0x26709){return client[_0x8539('0x2')](_0x8539('0x3'),{'body':_0x26709,'log':_0x8539('0x3')});}; \ No newline at end of file +var _0xc098=['create','Request','CreateVoiceDialReport','../client'];(function(_0x504736,_0x40dfbb){var _0x644bc8=function(_0x5b7a8e){while(--_0x5b7a8e){_0x504736['push'](_0x504736['shift']());}};_0x644bc8(++_0x40dfbb);}(_0xc098,0x183));var _0x8c09=function(_0x54ffa5,_0x5cd665){_0x54ffa5=_0x54ffa5-0x0;var _0x3eb9d0=_0xc098[_0x54ffa5];return _0x3eb9d0;};'use strict';var client=require(_0x8c09('0x0'));exports[_0x8c09('0x1')]=function(_0x3a8d19){return client[_0x8c09('0x2')](_0x8c09('0x3'),{'body':_0x3a8d19,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f1f6425..ee28789 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 _0xdc91=['getVoiceExtensions','../client'];(function(_0x107fbf,_0x5c9aa1){var _0x593974=function(_0x5cf487){while(--_0x5cf487){_0x107fbf['push'](_0x107fbf['shift']());}};_0x593974(++_0x5c9aa1);}(_0xdc91,0x8b));var _0x1dc9=function(_0x4b65c2,_0x562e9a){_0x4b65c2=_0x4b65c2-0x0;var _0xe9e29d=_0xdc91[_0x4b65c2];return _0xe9e29d;};'use strict';var client=require(_0x1dc9('0x0'));exports[_0x1dc9('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x1dc9('0x1')});};}; \ No newline at end of file +var _0x8863=['GetVoiceExtension','exten','getVoiceExtensions','Request'];(function(_0x8531f8,_0xe334b3){var _0x1ffe1b=function(_0x4f903c){while(--_0x4f903c){_0x8531f8['push'](_0x8531f8['shift']());}};_0x1ffe1b(++_0xe334b3);}(_0x8863,0x1b6));var _0x3886=function(_0x325af2,_0x250881){_0x325af2=_0x325af2-0x0;var _0x18d45d=_0x8863[_0x325af2];return _0x18d45d;};'use strict';var client=require('../client');exports[_0x3886('0x0')]=function(){return function(){return client[_0x3886('0x1')](_0x3886('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3886('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 58f305b..b52debb 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 _0xac0d=['acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw'];(function(_0x25d8f4,_0x2f10ad){var _0x23e222=function(_0x12bed7){while(--_0x12bed7){_0x25d8f4['push'](_0x25d8f4['shift']());}};_0x23e222(++_0x2f10ad);}(_0xac0d,0x14c));var _0xdac0=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xac0d[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0xdac0('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xdac0('0x1'),{'options':{'raw':![],'attributes':['id',_0xdac0('0x2'),_0xdac0('0x3'),_0xdac0('0x4'),_0xdac0('0x5'),_0xdac0('0x6'),_0xdac0('0x7'),_0xdac0('0x8'),_0xdac0('0x9'),_0xdac0('0xa'),_0xdac0('0xb'),_0xdac0('0xc'),_0xdac0('0xd'),'dialPredictiveOptimizationPercentage',_0xdac0('0xe'),_0xdac0('0xf'),_0xdac0('0x10'),_0xdac0('0x11'),_0xdac0('0x12'),'dialQueueTimeout',_0xdac0('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0xdac0('0x14'),_0xdac0('0x15'),_0xdac0('0x16'),_0xdac0('0x17'),_0xdac0('0x18'),_0xdac0('0x19'),_0xdac0('0x1a'),_0xdac0('0x1b'),'dialAMDActive','dialAMDInitialSilence','dialAMDGreeting',_0xdac0('0x1c'),'dialAMDTotalAnalysisTime',_0xdac0('0x1d'),_0xdac0('0x1e'),_0xdac0('0x1f'),_0xdac0('0x20'),_0xdac0('0x21'),'timeout','dialRecallMeTimeout',_0xdac0('0x22'),'dialOrderByScheduledAt',_0xdac0('0x23'),'dialAgiAfterHangupClient',_0xdac0('0x24'),_0xdac0('0x6'),_0xdac0('0x25'),_0xdac0('0x26'),_0xdac0('0x27'),_0xdac0('0x28'),'dialNoSuchNumberRetryFrequency',_0xdac0('0x29'),_0xdac0('0x2a'),_0xdac0('0x2b'),'dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency',_0xdac0('0x2c'),_0xdac0('0x2d'),_0xdac0('0x2e'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xdac0('0x2f'),'as':_0xdac0('0x2f'),'attributes':['id','name',_0xdac0('0x30'),_0xdac0('0x31')]},{'model':_0xdac0('0x32'),'as':_0xdac0('0x33'),'attributes':['id',_0xdac0('0x2')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id','name',_0xdac0('0x30'),_0xdac0('0x31')]},{'model':'Interval','as':_0xdac0('0x34'),'attributes':['id','name'],'include':[{'model':_0xdac0('0x34'),'as':_0xdac0('0x35'),'attributes':['id',_0xdac0('0x2'),_0xdac0('0x36')]}]}]},'log':_0xdac0('0x37')});};}; \ No newline at end of file +var _0xea06=['monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','callerid','active','Pause','mandatoryDispositionPause','Trunk','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause'];(function(_0x1398e6,_0x116695){var _0xf62c23=function(_0x2d3f95){while(--_0x2d3f95){_0x1398e6['push'](_0x1398e6['shift']());}};_0xf62c23(++_0x116695);}(_0xea06,0x195));var _0x6ea0=function(_0x50f07f,_0x372d20){_0x50f07f=_0x50f07f-0x0;var _0x39714e=_0xea06[_0x50f07f];return _0x39714e;};'use strict';var client=require(_0x6ea0('0x0'));exports[_0x6ea0('0x1')]=function(){return function(){return client[_0x6ea0('0x2')](_0x6ea0('0x3'),{'options':{'raw':![],'attributes':['id',_0x6ea0('0x4'),_0x6ea0('0x5'),_0x6ea0('0x6'),_0x6ea0('0x7'),_0x6ea0('0x8'),_0x6ea0('0x9'),_0x6ea0('0xa'),_0x6ea0('0xb'),_0x6ea0('0xc'),_0x6ea0('0xd'),_0x6ea0('0xe'),_0x6ea0('0xf'),'dialPredictiveOptimizationPercentage',_0x6ea0('0x10'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout',_0x6ea0('0x11'),_0x6ea0('0x12'),_0x6ea0('0x13'),'dialCongestionMaxRetry',_0x6ea0('0x14'),_0x6ea0('0x15'),_0x6ea0('0x16'),_0x6ea0('0x17'),_0x6ea0('0x18'),_0x6ea0('0x19'),_0x6ea0('0x1a'),_0x6ea0('0x1b'),'dialPrefix',_0x6ea0('0x1c'),_0x6ea0('0x1d'),'dialAMDInitialSilence',_0x6ea0('0x1e'),_0x6ea0('0x1f'),'dialAMDTotalAnalysisTime',_0x6ea0('0x20'),_0x6ea0('0x21'),'dialAMDMaximumNumberOfWords',_0x6ea0('0x22'),_0x6ea0('0x23'),_0x6ea0('0x24'),_0x6ea0('0x25'),'dialRecallInQueue','dialOrderByScheduledAt',_0x6ea0('0x26'),'dialAgiAfterHangupClient',_0x6ea0('0x27'),_0x6ea0('0x8'),_0x6ea0('0x28'),_0x6ea0('0x29'),_0x6ea0('0x2a'),_0x6ea0('0x2b'),_0x6ea0('0x2c'),_0x6ea0('0x2d'),'dialDropRetryFrequency',_0x6ea0('0x2e'),_0x6ea0('0x2f'),'dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x6ea0('0x30'),_0x6ea0('0x31'),_0x6ea0('0x32'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x6ea0('0x4'),_0x6ea0('0x33'),_0x6ea0('0x34')]},{'model':_0x6ea0('0x35'),'as':_0x6ea0('0x36'),'attributes':['id',_0x6ea0('0x4')]},{'model':_0x6ea0('0x37'),'as':_0x6ea0('0x38'),'attributes':['id',_0x6ea0('0x4'),_0x6ea0('0x33'),_0x6ea0('0x34')]},{'model':_0x6ea0('0x39'),'as':'Interval','attributes':['id',_0x6ea0('0x4')],'include':[{'model':_0x6ea0('0x39'),'as':'Intervals','attributes':['id',_0x6ea0('0x4'),_0x6ea0('0x3a')]}]}]},'log':_0x6ea0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 93f6a54..5d4f217 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 _0x59b3=['YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','GetVoiceQueueReport','day','format'];(function(_0x12049f,_0x25f34f){var _0x23667e=function(_0x58f936){while(--_0x58f936){_0x12049f['push'](_0x12049f['shift']());}};_0x23667e(++_0x25f34f);}(_0x59b3,0x14e));var _0x359b=function(_0x491cf8,_0x8b5453){_0x491cf8=_0x491cf8-0x0;var _0x48a17d=_0x59b3[_0x491cf8];return _0x48a17d;};'use strict';var moment=require(_0x359b('0x0'));var _=require(_0x359b('0x1'));var client=require(_0x359b('0x2'));exports['create']=function(_0x78830){return client[_0x359b('0x3')](_0x359b('0x4'),{'body':_0x78830,'log':_0x359b('0x4')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x359b('0x3')](_0x359b('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x359b('0x6'))[_0x359b('0x7')](_0x359b('0x8')),moment()[_0x359b('0x9')](_0x359b('0x6'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid','queue',_0x359b('0xa'),'queuecallerleaveAt',_0x359b('0xb'),_0x359b('0xc'),_0x359b('0xd'),_0x359b('0xe'),_0x359b('0xf'),_0x359b('0x10')]},'log':_0x359b('0x11')});};}; \ No newline at end of file +var _0x6157=['format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexitAt','GetVoiceQueueReports','moment','lodash','create','CreateVoiceQueueReport','getVoiceQueueReports','Request','GetVoiceQueueReport','endOf','day'];(function(_0x327076,_0x38e16b){var _0x513a84=function(_0x701710){while(--_0x701710){_0x327076['push'](_0x327076['shift']());}};_0x513a84(++_0x38e16b);}(_0x6157,0x1a0));var _0x7615=function(_0x3b34b2,_0x26e311){_0x3b34b2=_0x3b34b2-0x0;var _0x306142=_0x6157[_0x3b34b2];return _0x306142;};'use strict';var moment=require(_0x7615('0x0'));var _=require(_0x7615('0x1'));var client=require('../client');exports[_0x7615('0x2')]=function(_0x2bf2bd){return client['Request'](_0x7615('0x3'),{'body':_0x2bf2bd,'log':_0x7615('0x3')});};exports[_0x7615('0x4')]=function(){return function(){return client[_0x7615('0x5')](_0x7615('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x7615('0x7')](_0x7615('0x8'))[_0x7615('0x9')](_0x7615('0xa'))]}},'attributes':[_0x7615('0xb'),'queue',_0x7615('0xc'),_0x7615('0xd'),'queuecallercomplete',_0x7615('0xe'),'queuecallerexit',_0x7615('0xf'),'queuecallerabandon','queuecallerabandonAt']},'log':_0x7615('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 7cdd47d..87f5a33 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 _0xabd3=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x504a30,_0x237404){var _0x217c40=function(_0x101cd4){while(--_0x101cd4){_0x504a30['push'](_0x504a30['shift']());}};_0x217c40(++_0x237404);}(_0xabd3,0x10b));var _0x3abd=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xabd3[_0x25a42a];return _0x1129b1;};'use strict';var client=require(_0x3abd('0x0'));exports[_0x3abd('0x1')]=function(_0x2fd863){return function(){return client[_0x3abd('0x2')](_0x3abd('0x3'),{'options':{'where':{'VoiceQueueId':_0x2fd863,'paused':!![]},'raw':!![]},'log':_0x3abd('0x1')});};}; \ No newline at end of file +var _0x29ea=['Request','GetVoiceQueueRtPauses','../client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x29ea,0x104));var _0xa29e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x29ea[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xa29e('0x0'));exports['getVoiceQueueRtPauses']=function(_0x107046){return function(){return client[_0xa29e('0x1')](_0xa29e('0x2'),{'options':{'where':{'VoiceQueueId':_0x107046,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 57fb23a..1c2f2f1 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 _0x9440=['lodash','create','Request','CreateVoiceRecording','merge','monitorFilename'];(function(_0x236a8d,_0x38c3e5){var _0x2d57f7=function(_0x42fbd9){while(--_0x42fbd9){_0x236a8d['push'](_0x236a8d['shift']());}};_0x2d57f7(++_0x38c3e5);}(_0x9440,0x120));var _0x0944=function(_0x5e6677,_0x4afaca){_0x5e6677=_0x5e6677-0x0;var _0x471af0=_0x9440[_0x5e6677];return _0x471af0;};'use strict';var _=require(_0x0944('0x0'));var client=require('../client');exports[_0x0944('0x1')]=function(_0x2d2597){return client[_0x0944('0x2')](_0x0944('0x3'),{'body':_[_0x0944('0x4')](_0x2d2597,{'value':_0x2d2597[_0x0944('0x5')]}),'log':_0x0944('0x3')});}; \ No newline at end of file +var _0x2950=['merge','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0x2950,0xcd));var _0x0295=function(_0x24f2c9,_0xea7547){_0x24f2c9=_0x24f2c9-0x0;var _0x74beea=_0x2950[_0x24f2c9];return _0x74beea;};'use strict';var _=require(_0x0295('0x0'));var client=require(_0x0295('0x1'));exports[_0x0295('0x2')]=function(_0x168a7d){return client[_0x0295('0x3')](_0x0295('0x4'),{'body':_[_0x0295('0x5')](_0x168a7d,{'value':_0x168a7d['monitorFilename']}),'log':_0x0295('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 81cc235..7e07dfd 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 _0xd66c=['secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','attended','../client','Request','transferercalleridnum','transfererconnectedlinenum','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','extension','CreateVoiceTransferReport','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x3dfefb,_0x1f86d8){var _0x5e25b8=function(_0x47e544){while(--_0x47e544){_0x3dfefb['push'](_0x3dfefb['shift']());}};_0x5e25b8(++_0x1f86d8);}(_0xd66c,0xb4));var _0xcd66=function(_0x285df9,_0xcf704c){_0x285df9=_0x285df9-0x0;var _0x2727bb=_0xd66c[_0x285df9];return _0x2727bb;};'use strict';var client=require(_0xcd66('0x0'));exports['blindTransfer']=function(_0x1d999e){return client[_0xcd66('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x1d999e['result'],'transfererchannel':_0x1d999e['transfererchannel'],'transferercalleridnum':_0x1d999e[_0xcd66('0x2')],'transferercalleridname':_0x1d999e['transferercalleridname'],'transfererconnectedlinenum':_0x1d999e[_0xcd66('0x3')],'transfererconnectedlinename':_0x1d999e['transfererconnectedlinename'],'transfereraccountcode':_0x1d999e['transfereraccountcode'],'transferercontext':_0x1d999e[_0xcd66('0x4')],'transfererexten':_0x1d999e[_0xcd66('0x5')],'transfererlinkedid':_0x1d999e[_0xcd66('0x6')],'transfereechannel':_0x1d999e['transfereechannel'],'transfereecalleridnum':_0x1d999e[_0xcd66('0x7')],'transfereecalleridname':_0x1d999e[_0xcd66('0x8')],'transfereeconnectedlinenum':_0x1d999e[_0xcd66('0x9')],'transfereeconnectedlinename':_0x1d999e[_0xcd66('0xa')],'transfereeaccountcode':_0x1d999e['transfereeaccountcode'],'transfereecontext':_0x1d999e['transfereecontext'],'transfereeexten':_0x1d999e[_0xcd66('0xb')],'transfereelinkedid':_0x1d999e[_0xcd66('0xc')],'isexternal':_0x1d999e[_0xcd66('0xd')],'context':_0x1d999e['context'],'extension':_0x1d999e[_0xcd66('0xe')],'type':'blind'},'log':_0xcd66('0xf')});};exports[_0xcd66('0x10')]=function(_0x27b76e){return client[_0xcd66('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x27b76e[_0xcd66('0x11')],'transfererchannel':_0x27b76e[_0xcd66('0x12')],'transferercalleridnum':_0x27b76e[_0xcd66('0x13')],'transferercalleridname':_0x27b76e['origtransferercalleridname'],'transfererconnectedlinenum':_0x27b76e[_0xcd66('0x14')],'transfererconnectedlinename':_0x27b76e[_0xcd66('0x15')],'transfereraccountcode':_0x27b76e[_0xcd66('0x16')],'transferercontext':_0x27b76e[_0xcd66('0x17')],'transfererexten':_0x27b76e[_0xcd66('0x18')],'transfererlinkedid':_0x27b76e[_0xcd66('0x19')],'transfereechannel':_0x27b76e[_0xcd66('0x1a')],'transfereecalleridnum':_0x27b76e[_0xcd66('0x1b')],'transfereecalleridname':_0x27b76e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x27b76e[_0xcd66('0x1c')],'transfereeconnectedlinename':_0x27b76e[_0xcd66('0x1d')],'transfereeaccountcode':_0x27b76e[_0xcd66('0x1e')],'transfereecontext':_0x27b76e['transfertargetcontext'],'transfereeexten':_0x27b76e[_0xcd66('0x1f')],'transfereelinkedid':_0x27b76e[_0xcd66('0x20')],'isexternal':_0x27b76e['isexternal'],'context':_0x27b76e['origtransferercontext'],'extension':_0x27b76e['origtransfererexten'],'type':_0xcd66('0x21')},'log':_0xcd66('0xf')});}; \ No newline at end of file +var _0xfec1=['transfereeexten','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereecontext'];(function(_0x1df3f5,_0x2f7232){var _0x347f1a=function(_0x4759a5){while(--_0x4759a5){_0x1df3f5['push'](_0x1df3f5['shift']());}};_0x347f1a(++_0x2f7232);}(_0xfec1,0x163));var _0x1fec=function(_0xf794c7,_0x5a1632){_0xf794c7=_0xf794c7-0x0;var _0x37fc7f=_0xfec1[_0xf794c7];return _0x37fc7f;};'use strict';var client=require(_0x1fec('0x0'));exports['blindTransfer']=function(_0x23f41a){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x23f41a['result'],'transfererchannel':_0x23f41a[_0x1fec('0x1')],'transferercalleridnum':_0x23f41a[_0x1fec('0x2')],'transferercalleridname':_0x23f41a[_0x1fec('0x3')],'transfererconnectedlinenum':_0x23f41a[_0x1fec('0x4')],'transfererconnectedlinename':_0x23f41a[_0x1fec('0x5')],'transfereraccountcode':_0x23f41a[_0x1fec('0x6')],'transferercontext':_0x23f41a[_0x1fec('0x7')],'transfererexten':_0x23f41a[_0x1fec('0x8')],'transfererlinkedid':_0x23f41a[_0x1fec('0x9')],'transfereechannel':_0x23f41a['transfereechannel'],'transfereecalleridnum':_0x23f41a[_0x1fec('0xa')],'transfereecalleridname':_0x23f41a[_0x1fec('0xb')],'transfereeconnectedlinenum':_0x23f41a['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x23f41a[_0x1fec('0xc')],'transfereeaccountcode':_0x23f41a['transfereeaccountcode'],'transfereecontext':_0x23f41a[_0x1fec('0xd')],'transfereeexten':_0x23f41a[_0x1fec('0xe')],'transfereelinkedid':_0x23f41a[_0x1fec('0xf')],'isexternal':_0x23f41a['isexternal'],'context':_0x23f41a[_0x1fec('0x10')],'extension':_0x23f41a[_0x1fec('0x11')],'type':_0x1fec('0x12')},'log':_0x1fec('0x13')});};exports['attendedTransfer']=function(_0x2b0d8f){return client[_0x1fec('0x14')](_0x1fec('0x13'),{'body':{'result':_0x2b0d8f['result'],'transfererchannel':_0x2b0d8f[_0x1fec('0x15')],'transferercalleridnum':_0x2b0d8f[_0x1fec('0x16')],'transferercalleridname':_0x2b0d8f[_0x1fec('0x17')],'transfererconnectedlinenum':_0x2b0d8f[_0x1fec('0x18')],'transfererconnectedlinename':_0x2b0d8f[_0x1fec('0x19')],'transfereraccountcode':_0x2b0d8f[_0x1fec('0x1a')],'transferercontext':_0x2b0d8f[_0x1fec('0x1b')],'transfererexten':_0x2b0d8f[_0x1fec('0x1c')],'transfererlinkedid':_0x2b0d8f[_0x1fec('0x1d')],'transfereechannel':_0x2b0d8f[_0x1fec('0x1e')],'transfereecalleridnum':_0x2b0d8f['transfertargetcalleridnum'],'transfereecalleridname':_0x2b0d8f[_0x1fec('0x1f')],'transfereeconnectedlinenum':_0x2b0d8f[_0x1fec('0x20')],'transfereeconnectedlinename':_0x2b0d8f[_0x1fec('0x21')],'transfereeaccountcode':_0x2b0d8f[_0x1fec('0x22')],'transfereecontext':_0x2b0d8f[_0x1fec('0x23')],'transfereeexten':_0x2b0d8f['transfertargetexten'],'transfereelinkedid':_0x2b0d8f[_0x1fec('0x24')],'isexternal':_0x2b0d8f[_0x1fec('0x25')],'context':_0x2b0d8f[_0x1fec('0x26')],'extension':_0x2b0d8f[_0x1fec('0x27')],'type':_0x1fec('0x28')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index c1b51f2..75f9878 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 _0x06c8=['outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','length','channels','voicechannel','map','find','channel','%s.%s','filename','uniqueid','wav','Action','/var/spool/asterisk/monitor/','isNil','monitors','push','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','toLowerCase','stop','values','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outbound','campaigns','Event\x20name\x20mandatory','emit','send','checkAfterSend','server','http','listen','127.0.0.1','util','validate','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','message','catch','command','then','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix'];(function(_0x386f66,_0x2a4d4c){var _0x255ea2=function(_0x13ebbe){while(--_0x13ebbe){_0x386f66['push'](_0x386f66['shift']());}};_0x255ea2(++_0x2a4d4c);}(_0x06c8,0x1c6));var _0x806c=function(_0x4681b3,_0x19eb35){_0x4681b3=_0x4681b3-0x0;var _0x51c79e=_0x06c8[_0x4681b3];return _0x51c79e;};'use strict';var _=require('lodash');var util=require(_0x806c('0x0'));var jayson=require('jayson/promise');var schema=require(_0x806c('0x1'));var BPromise=require('bluebird');var moment=require(_0x806c('0x2'));var config=require(_0x806c('0x3'));var properties=require(_0x806c('0x4'));var ami=require(_0x806c('0x5'));exports['listen']=function(_0x90f8f6,_0x558cfb,_0x38f646){return new BPromise(function(_0x5ca964,_0x2da081){var _0x18d910={'QueuePause':function(_0x29d3f7){return new Promise(function(_0x138ed6,_0x48753b){var _0x1693e6=util[_0x806c('0x6')](_0x806c('0x7'),_0x806c('0x8'),_0x29d3f7[_0x806c('0x9')]);if(_0x90f8f6['timers']&&_0x90f8f6[_0x806c('0xa')][_0x1693e6]&&_0x90f8f6[_0x806c('0xa')][_0x1693e6][_0x806c('0xb')]){_0x90f8f6[_0x806c('0xa')][_0x1693e6][_0x806c('0xc')]();}if(_0x90f8f6[_0x806c('0xd')][_0x1693e6]){_0x90f8f6[_0x806c('0xd')][_0x1693e6][_0x806c('0xe')]({'statePause':_0x29d3f7['pause']?!![]:![]});}_0x138ed6({'code':0xc8,'message':_0x806c('0xf')});});},'Reload':function(_0x415b48){var _0xb9ccbf=this;return new Promise(function(_0x21ec35,_0x48d065){if(ami[_0x806c('0x10')]()==![]){return _0x48d065(_0xb9ccbf[_0x806c('0x11')](0x1f4,[config[_0x806c('0x12')]['ip'],config[_0x806c('0x12')][_0x806c('0x13')],_0x806c('0x14')][_0x806c('0x15')]('\x20')));}_0x415b48=_[_0x806c('0x16')](_0x415b48,_[_0x806c('0x17')](properties[_0x806c('0x18')]));_0x415b48[_0x806c('0x19')]=_0x806c('0x1a');return ami['Action'](_0x415b48)['then'](function(_0x5210e7){_0x21ec35({'code':0xc8,'message':_0x5210e7[_0x806c('0x1b')]});})[_0x806c('0x1c')](function(_0xeee9c1){_0x48d065(_0xb9ccbf['error'](0x1f5,_0xeee9c1[_0x806c('0x1b')]));});});},'Command':function(_0x10014b){var _0x19e32e=this;return new Promise(function(_0x2b20cd,_0x2ae7d3){if(ami[_0x806c('0x10')]()==![]){return _0x2ae7d3(_0x19e32e[_0x806c('0x11')](0x1f4,[config[_0x806c('0x12')]['ip'],config[_0x806c('0x12')][_0x806c('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x10014b=_[_0x806c('0x16')](_0x10014b,_0x806c('0x1d'));_0x10014b[_0x806c('0x19')]='Command';return ami['Action'](_0x10014b)[_0x806c('0x1e')](function(_0x1f3a67){_0x2b20cd({'code':0xc8,'message':_0x1f3a67[_0x806c('0x1f')]});})[_0x806c('0x1c')](function(_0x1d967c){_0x2ae7d3(_0x19e32e[_0x806c('0x11')](0x1f5,_0x1d967c[_0x806c('0x1b')]));});});},'VoiceQueues':function(_0x4f0fb9){return new Promise(function(_0x42a535,_0x1c772b){var _0x3aca39=[];for(var _0x874897 in _0x90f8f6[_0x806c('0x20')]){if(_0x90f8f6[_0x806c('0x20')][_0x806c('0x21')](_0x874897)){var _0x4084a5=_0x90f8f6[_0x806c('0x20')][_0x874897];var _0x403e65={'id':_0x4084a5['id'],'name':_0x4084a5[_0x806c('0x9')],'strategy':_0x4084a5['strategy'],'answered':_0x4084a5[_0x806c('0x22')],'available':_0x4084a5[_0x806c('0x23')],'loggedIn':_0x4084a5[_0x806c('0x24')],'pTalking':_0x4084a5[_0x806c('0x25')],'sumBillable':_0x4084a5[_0x806c('0x26')],'sumDuration':_0x4084a5[_0x806c('0x27')],'sumHoldTime':_0x4084a5['sumHoldTime']||0x0,'talking':_0x4084a5['talking'],'total':_0x4084a5[_0x806c('0x28')],'type':_0x4084a5['type'],'unmanaged':_0x4084a5['unmanaged'],'abandoned':_0x4084a5['abandoned'],'waiting':_0x4084a5[_0x806c('0x29')],'loggedInDb':_0x4084a5[_0x806c('0x2a')]};if(_0x4084a5[_0x806c('0x2b')]==='outbound'){_0x403e65[_0x806c('0x2c')]=_0x4084a5[_0x806c('0x2c')];_0x403e65[_0x806c('0x2d')]=_0x4084a5[_0x806c('0x2d')];_0x403e65[_0x806c('0x2e')]=_0x4084a5[_0x806c('0x2e')];_0x403e65['dialOriginateCallerIdNumber']=_0x4084a5[_0x806c('0x2f')];_0x403e65[_0x806c('0x30')]=_0x4084a5[_0x806c('0x30')];_0x403e65[_0x806c('0x31')]=_0x4084a5[_0x806c('0x31')];_0x403e65[_0x806c('0x32')]=_0x4084a5['outboundAnswerAgiCallsDay'];_0x403e65[_0x806c('0x33')]=_0x4084a5[_0x806c('0x33')];_0x403e65[_0x806c('0x34')]=_0x4084a5[_0x806c('0x34')];_0x403e65[_0x806c('0x35')]=_0x4084a5[_0x806c('0x35')];_0x403e65[_0x806c('0x36')]=_0x4084a5['outboundCongestionCallsDay'];_0x403e65[_0x806c('0x37')]=_0x4084a5[_0x806c('0x37')];_0x403e65[_0x806c('0x38')]=_0x4084a5[_0x806c('0x38')];_0x403e65[_0x806c('0x39')]=_0x4084a5[_0x806c('0x39')];_0x403e65[_0x806c('0x3a')]=_0x4084a5[_0x806c('0x3a')];_0x403e65[_0x806c('0x3b')]=_0x4084a5[_0x806c('0x3b')];_0x403e65[_0x806c('0x3c')]=_0x4084a5[_0x806c('0x3c')];_0x403e65[_0x806c('0x3d')]=_0x4084a5[_0x806c('0x3d')];_0x403e65[_0x806c('0x3e')]=_0x4084a5[_0x806c('0x3e')];_0x403e65['outboundUnknownCallsDay']=_0x4084a5[_0x806c('0x3f')];_0x403e65[_0x806c('0x40')]=_0x4084a5[_0x806c('0x40')];_0x403e65[_0x806c('0x41')]=_0x4084a5[_0x806c('0x41')];_0x403e65['predictiveIntervalAvgTalktime']=_0x4084a5['predictiveIntervalAvgTalktime'];_0x403e65[_0x806c('0x42')]=_0x4084a5[_0x806c('0x42')];_0x403e65[_0x806c('0x43')]=_0x4084a5[_0x806c('0x43')];_0x403e65[_0x806c('0x44')]=_0x4084a5[_0x806c('0x44')];_0x403e65[_0x806c('0x45')]=_0x4084a5[_0x806c('0x45')];_0x403e65[_0x806c('0x46')]=_0x4084a5[_0x806c('0x46')];_0x403e65[_0x806c('0x47')]=_0x4084a5[_0x806c('0x47')];_0x403e65['predictiveIntervalPauses']=_0x4084a5['predictiveIntervalPauses'];_0x403e65[_0x806c('0x48')]=_0x4084a5[_0x806c('0x48')];_0x403e65[_0x806c('0x49')]=_0x4084a5[_0x806c('0x49')];_0x403e65[_0x806c('0x1b')]=_0x4084a5['message'];_0x403e65[_0x806c('0x4a')]=_0x4084a5[_0x806c('0x4a')];_0x403e65[_0x806c('0x4b')]=_0x4084a5['erlangCalls'];_0x403e65[_0x806c('0x4c')]=_0x4084a5[_0x806c('0x4c')];_0x403e65[_0x806c('0x4d')]=_0x4084a5[_0x806c('0x4d')];_0x403e65[_0x806c('0x4e')]=_0x4084a5[_0x806c('0x4e')];_0x403e65[_0x806c('0x4f')]=_0x4084a5[_0x806c('0x4f')];_0x403e65['startProgressive']=_0x4084a5['startProgressive'];}if(_0x4084a5['Trunk']){_0x403e65[_0x806c('0x50')]={'id':_0x4084a5[_0x806c('0x50')]['id'],'name':_0x4084a5['Trunk']['name'],'active':_0x4084a5[_0x806c('0x50')]['active'],'callerid':_0x4084a5[_0x806c('0x50')][_0x806c('0x51')]};}if(_0x4084a5['Interval']){_0x403e65[_0x806c('0x52')]={'id':_0x4084a5['Interval']['id'],'name':_0x4084a5['Interval'][_0x806c('0x9')]};}_0x3aca39['push'](_0x403e65);}}_0x42a535({'count':_0x3aca39[_0x806c('0x53')],'rows':_0x3aca39});});},'VoiceChannels':function(_0x18efda){return new Promise(function(_0xacd15b,_0x26e7e6){var _0x409f41=_['values'](_0x90f8f6[_0x806c('0x54')]);_0xacd15b({'count':_0x409f41[_0x806c('0x53')],'rows':_0x409f41});});},'VoiceChannelMixMonitor':function(_0x49fe38){var _0x5a6bcb=this;return new Promise(function(_0x1f42f4,_0x1e1516){if(ami[_0x806c('0x10')]()==![]){return _0x1e1516(_0x5a6bcb['error'](0x1f4,[config[_0x806c('0x12')]['ip'],config['asterisk'][_0x806c('0x13')],'ami\x20disconnected'][_0x806c('0x15')]('\x20')));}var _0x39d98c=schema(properties[_0x806c('0x55')])['validate'](_0x49fe38);if(_0x39d98c['length']>0x0){return _0x1e1516(_0x5a6bcb[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x39d98c,_0x806c('0x1b'))[_0x806c('0x15')](',\x20')));}var _0x17eae6=_[_0x806c('0x57')](_0x90f8f6[_0x806c('0x54')],{'uniqueid':_0x49fe38['uniqueid']});if(_0x17eae6&&_0x17eae6[_0x806c('0x58')]){var _0x5fe663=util[_0x806c('0x6')](_0x806c('0x59'),_0x49fe38[_0x806c('0x5a')]||_0x49fe38[_0x806c('0x5b')],_0x49fe38[_0x806c('0x6')]||_0x806c('0x5c'));return ami[_0x806c('0x5d')]({'action':'MixMonitor','channel':_0x17eae6[_0x806c('0x58')],'file':_0x5fe663,'options':'ai(mixmonitorid)'})[_0x806c('0x1e')](function(_0x28370f){var _0x20bfb3=_[_0x806c('0x57')](_0x17eae6['monitors'],{'filename':_0x806c('0x5e')+_0x5fe663['toLowerCase']()});if(_[_0x806c('0x5f')](_0x20bfb3)){_0x17eae6[_0x806c('0x60')][_0x806c('0x61')]({'filename':'/var/spool/asterisk/monitor/'+_0x5fe663['toLowerCase'](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x28370f[_0x806c('0x62')],'status':'rec'});}else{_0x20bfb3[_0x806c('0x62')]=_0x28370f[_0x806c('0x62')];_0x20bfb3[_0x806c('0x63')]='rec';}_0x1f42f4({'code':0xc8,'message':[_0x49fe38[_0x806c('0x5b')],_0x806c('0x64'),_0x28370f['mixmonitorid']][_0x806c('0x15')]('\x20'),'mixmonitorid':_0x28370f[_0x806c('0x62')]});})[_0x806c('0x1c')](function(_0x556e6c){_0x1e1516(_0x5a6bcb[_0x806c('0x11')](0x1f5,[_0x49fe38['uniqueid'],_0x556e6c[_0x806c('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x1e1516(_0x5a6bcb[_0x806c('0x11')](0x1f5,_0x806c('0x65')));}});},'VoiceChannelStopMixMonitor':function(_0x2454c2){var _0x303fad=this;return new Promise(function(_0x318cbf,_0x3327fd){if(ami[_0x806c('0x10')]()==![]){return _0x3327fd(_0x303fad['error'](0x1f4,[config[_0x806c('0x12')]['ip'],config[_0x806c('0x12')][_0x806c('0x13')],'ami\x20disconnected']['join']('\x20')));}var _0x4a24f5=schema(properties['voicechannel'])['validate'](_0x2454c2);if(_0x4a24f5['length']>0x0){return _0x3327fd(_0x303fad[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x4a24f5,'message')[_0x806c('0x15')](',\x20')));}var _0xd3ccd4=_['find'](_0x90f8f6['channels'],{'uniqueid':_0x2454c2[_0x806c('0x5b')]});if(_0xd3ccd4){return BPromise[_0x806c('0x66')]()['then'](function(){if(_0xd3ccd4[_0x806c('0x58')]){return ami[_0x806c('0x5d')]({'action':_0x806c('0x67'),'channel':_0xd3ccd4[_0x806c('0x58')],'mixmonitorid':_0x2454c2[_0x806c('0x62')]})[_0x806c('0x1c')](function(_0x6856d5){});}})[_0x806c('0x1e')](function(){if(_0xd3ccd4[_0x806c('0x68')]){return ami[_0x806c('0x5d')]({'action':_0x806c('0x67'),'channel':_0xd3ccd4['destinationchannel'],'mixmonitorid':_0x2454c2['mixmonitorid']})[_0x806c('0x1c')](function(_0x46166a){});}})[_0x806c('0x1e')](function(_0x806407){var _0x225e17=_['find'](_0xd3ccd4[_0x806c('0x60')],{'mixmonitorid':_0x2454c2[_0x806c('0x62')]});if(_0x225e17){_0x225e17['status']='stop';}})[_0x806c('0x1e')](function(){var _0x4183ac=util['format'](_0x806c('0x59'),_0x2454c2[_0x806c('0x5a')]||_0x2454c2[_0x806c('0x5b')],_0x2454c2[_0x806c('0x6')]||_0x806c('0x5c'));var _0x733237=_[_0x806c('0x57')](_0xd3ccd4['monitors'],{'filename':_0x806c('0x5e')+_0x4183ac[_0x806c('0x69')]()});if(_0x733237){_0x733237[_0x806c('0x63')]=_0x806c('0x6a');}})['then'](function(){_0x318cbf({'code':0xc8,'message':[_0x2454c2[_0x806c('0x5b')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x806c('0x1c')](function(_0x5313a8){_0x3327fd(_0x303fad[_0x806c('0x11')](0x1f5,[_0x2454c2['uniqueid'],_0x5313a8['message'][_0x806c('0x69')]()][_0x806c('0x15')]('\x20')));});}else{return _0x3327fd(_0x303fad['error'](0x1f5,_0x806c('0x65')));}});},'VoiceQueuesChannels':function(_0x52baae){return new Promise(function(_0x15e499,_0x594f1c){var _0x5bb1c1=_[_0x806c('0x6b')](_0x90f8f6[_0x806c('0x6c')]);_0x15e499({'count':_0x5bb1c1[_0x806c('0x53')],'rows':_0x5bb1c1});});},'VoiceQueuesChannel':function(_0x56624b){var _0x116da6=this;return new Promise(function(_0x33fd35,_0x1e6b99){var _0x5a4936=schema(properties['voicequeuechannel'])['validate'](_0x56624b);if(_0x5a4936[_0x806c('0x53')]>0x0){return _0x1e6b99(_0x116da6[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x5a4936,'message')[_0x806c('0x15')](',\x20')));}var _0x56cf82=_['find'](_0x90f8f6['queueChannels'],{'uniqueid':_0x56624b[_0x806c('0x5b')]});if(_0x56cf82){_0x33fd35(_0x56cf82);}else{return _0x1e6b99(_0x116da6[_0x806c('0x11')](0x1f5,_0x806c('0x65')));}});},'VoiceQueuesChannelHangup':function(_0x5f29b6){var _0x4d83cc=this;return new Promise(function(_0xb13f78,_0x4f1920){if(ami['isConnected']()==![]){return _0x4f1920(_0x4d83cc['error'](0x1f4,[config['asterisk']['ip'],config[_0x806c('0x12')]['username'],_0x806c('0x14')][_0x806c('0x15')]('\x20')));}var _0x19a4a5=schema(properties[_0x806c('0x6d')])[_0x806c('0x1')](_0x5f29b6);if(_0x19a4a5[_0x806c('0x53')]>0x0){return _0x4f1920(_0x4d83cc[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x19a4a5,_0x806c('0x1b'))[_0x806c('0x15')](',\x20')));}var _0x4fd649=_[_0x806c('0x57')](_0x90f8f6['queueChannels'],{'uniqueid':_0x5f29b6[_0x806c('0x5b')]});if(_0x4fd649&&_0x4fd649[_0x806c('0x58')]){return ami[_0x806c('0x5d')]({'action':_0x806c('0x6e'),'channel':_0x4fd649[_0x806c('0x58')]})['then'](function(_0x4dd860){_0xb13f78({'code':0xc8,'message':[_0x5f29b6['uniqueid'],_0x4dd860[_0x806c('0x1b')]['toLowerCase']()][_0x806c('0x15')]('\x20')});})[_0x806c('0x1c')](function(_0x47f14a){_0x4f1920(_0x4d83cc[_0x806c('0x11')](0x1f5,[_0x5f29b6[_0x806c('0x5b')],_0x47f14a[_0x806c('0x1b')][_0x806c('0x69')]()][_0x806c('0x15')]('\x20')));});}else{return _0x4f1920(_0x4d83cc[_0x806c('0x11')](0x1f5,_0x806c('0x65')));}});},'VoiceQueuesChannelRedirect':function(_0xf33c6f){var _0xfa7ad5=this;return new Promise(function(_0x5422b1,_0x317234){if(ami['isConnected']()==![]){return _0x317234(_0xfa7ad5['error'](0x1f4,[config[_0x806c('0x12')]['ip'],config['asterisk'][_0x806c('0x13')],_0x806c('0x14')]['join']('\x20')));}var _0x37ea63=schema(properties[_0x806c('0x6f')])[_0x806c('0x1')](_0xf33c6f);if(_0x37ea63[_0x806c('0x53')]>0x0){return _0x317234(_0xfa7ad5[_0x806c('0x11')](0x1f4,_[_0x806c('0x56')](_0x37ea63,_0x806c('0x1b'))['join'](',\x20')));}var _0x1abe42=_[_0x806c('0x57')](_0x90f8f6[_0x806c('0x6c')],{'uniqueid':_0xf33c6f[_0x806c('0x5b')]});if(_0x1abe42&&_0x1abe42[_0x806c('0x58')]){return ami['Action']({'action':_0x806c('0x70'),'channel':_0x1abe42[_0x806c('0x58')],'exten':_0xf33c6f[_0x806c('0x71')],'context':_0xf33c6f[_0x806c('0x72')]||_0x1abe42[_0x806c('0x72')],'priority':0x1})[_0x806c('0x1e')](function(_0x374348){_0x5422b1({'code':0xc8,'message':[_0xf33c6f[_0x806c('0x5b')],_0x374348[_0x806c('0x1b')][_0x806c('0x69')]()]['join']('\x20')});})[_0x806c('0x1c')](function(_0x4ce0dc){_0x317234(_0xfa7ad5['error'](0x1f5,[_0xf33c6f[_0x806c('0x5b')],_0x4ce0dc[_0x806c('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x317234(_0xfa7ad5[_0x806c('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x5c5730){return new Promise(function(_0x3b0f8f,_0x6ec693){var _0x197d11=_[_0x806c('0x6b')](_0x90f8f6['agents']);_0x3b0f8f({'count':_0x197d11['length'],'rows':_0x197d11});});},'Telephones':function(_0x4e7e00){return new Promise(function(_0x2ee73a,_0x142781){var _0x3fad5b=_[_0x806c('0x6b')](_0x90f8f6[_0x806c('0x73')]);_0x2ee73a({'count':_0x3fad5b[_0x806c('0x53')],'rows':_0x3fad5b});});},'Trunks':function(_0xfd1015){return new Promise(function(_0x364101,_0x592d9f){var _0x1a4397=_[_0x806c('0x6b')](_0x90f8f6['trunks']);_0x364101({'count':_0x1a4397[_0x806c('0x53')],'rows':_0x1a4397});});},'OutboundChannels':function(_0x3b2ed3){return new Promise(function(_0x2cba9e,_0xfb7494){var _0x2fe043=_['values'](_0x90f8f6['outboundChannels']);_0x2cba9e({'count':_0x2fe043['length'],'rows':_0x2fe043});});},'Outbound':function(_0x2a872b){return new Promise(function(_0x2f4959,_0x5aa1a9){_0x2f4959(_0x90f8f6[_0x806c('0x74')]);});},'Campaigns':function(_0x41a884){return new Promise(function(_0x362efa,_0x26a3c3){var _0x33ef3e=_['values'](_0x90f8f6[_0x806c('0x75')]);_0x362efa({'count':_0x33ef3e['length'],'rows':_0x33ef3e});});},'VoiceQueuesPreview':function(_0x488b86){var _0x5e884e=this;return new Promise(function(_0x3252b1,_0x75b2f3){_0x558cfb['run'](_0x488b86['id'])[_0x806c('0x1e')](function(_0x34b09f){_0x3252b1({'code':0xc8,'message':_0x34b09f[_0x806c('0x1b')]});})['catch'](function(_0xb5131d){_0x75b2f3(_0x5e884e['error'](0x1f4,_0xb5131d[_0x806c('0x1b')]));});});},'EventManager':function(_0x2e20fc){var _0x1266bc=this;return new Promise(function(_0x3ff49f,_0x1477fb){if(!_0x2e20fc['event']){return _0x1477fb(_0x1266bc[_0x806c('0x11')](0x1f4,_0x806c('0x76')));}ami[_0x806c('0x77')]('custom:'+_0x2e20fc['event'],_0x2e20fc[_0x806c('0x1b')]);_0x3ff49f({'code':0xc8,'message':_0x2e20fc});});},'FaxAccounts':function(_0x392634){return new Promise(function(_0x171652,_0x30080f){var _0x114797=_[_0x806c('0x6b')](_0x90f8f6['faxAccounts']);_0x171652({'count':_0x114797[_0x806c('0x53')],'rows':_0x114797});});},'SendFax':function(_0x1e0d51){var _0x3b8d60=this;return new Promise(function(_0x5a7d1e,_0x1d13d5){_0x38f646[_0x806c('0x78')](_0x1e0d51)[_0x806c('0x1e')](function(_0x307f81){_0x5a7d1e({'code':0xc8,'message':_0x307f81[_0x806c('0x1b')]});})['catch'](function(_0x272e21){_0x1d13d5(_0x3b8d60[_0x806c('0x11')](0x1f4,_0x272e21[_0x806c('0x1b')]));});});},'CheckAfterSend':function(_0x170a17){var _0x45651c=this;return new Promise(function(_0x2254f7,_0x3f5985){_0x38f646[_0x806c('0x79')](_0x170a17)[_0x806c('0x1e')](function(_0x27f869){_0x2254f7({'code':0xc8,'message':_0x27f869[_0x806c('0x1b')]});})['catch'](function(_0x5e3f8b){_0x3f5985(_0x45651c['error'](0x1f4,_0x5e3f8b[_0x806c('0x1b')]));});});}};var _0x4b6a24=jayson[_0x806c('0x7a')](_0x18d910)[_0x806c('0x7b')]();_0x4b6a24['on']('error',function(_0x55dd74){return _0x2da081(_0x55dd74);});_0x4b6a24[_0x806c('0x7c')](0x232a,_0x806c('0x7d'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5ca964('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xac3a=['destinationchannel','stop','filename','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','telephones','trunks','outboundChannels','campaigns','run','event','custom:','faxAccounts','send','checkAfterSend','server','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','Action','message','catch','pick','command','action','Command','then','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','abandoned','waiting','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','values','channels','length','voicechannel','map','find','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor'];(function(_0x3251ab,_0x2ce04b){var _0x194bc3=function(_0x59e4fa){while(--_0x59e4fa){_0x3251ab['push'](_0x3251ab['shift']());}};_0x194bc3(++_0x2ce04b);}(_0xac3a,0x128));var _0xaac3=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0xac3a[_0x1d5ba8];return _0x1022a2;};'use strict';var _=require(_0xaac3('0x0'));var util=require(_0xaac3('0x1'));var jayson=require(_0xaac3('0x2'));var schema=require(_0xaac3('0x3'));var BPromise=require(_0xaac3('0x4'));var moment=require(_0xaac3('0x5'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require('../ami');exports['listen']=function(_0x394302,_0x4dc4fb,_0x4dd0a2){return new BPromise(function(_0x184ef7,_0x594303){var _0x3691d1={'QueuePause':function(_0x54f166){return new Promise(function(_0xe86753,_0xd9d9a9){var _0x29ef51=util[_0xaac3('0x6')](_0xaac3('0x7'),_0xaac3('0x8'),_0x54f166[_0xaac3('0x9')]);if(_0x394302[_0xaac3('0xa')]&&_0x394302[_0xaac3('0xa')][_0x29ef51]&&_0x394302[_0xaac3('0xa')][_0x29ef51][_0xaac3('0xb')]){_0x394302['timers'][_0x29ef51]['updateAcw']();}if(_0x394302[_0xaac3('0xc')][_0x29ef51]){_0x394302['agents'][_0x29ef51][_0xaac3('0xd')]({'statePause':_0x54f166[_0xaac3('0xe')]?!![]:![]});}_0xe86753({'code':0xc8,'message':_0xaac3('0xf')});});},'Reload':function(_0x2b9e01){var _0x149730=this;return new Promise(function(_0x2d3636,_0x25c833){if(ami[_0xaac3('0x10')]()==![]){return _0x25c833(_0x149730[_0xaac3('0x11')](0x1f4,[config[_0xaac3('0x12')]['ip'],config['asterisk'][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}_0x2b9e01=_['pick'](_0x2b9e01,_[_0xaac3('0x16')](properties[_0xaac3('0x17')]));_0x2b9e01['action']='Reload';return ami[_0xaac3('0x18')](_0x2b9e01)['then'](function(_0x3900bf){_0x2d3636({'code':0xc8,'message':_0x3900bf[_0xaac3('0x19')]});})[_0xaac3('0x1a')](function(_0x4214e2){_0x25c833(_0x149730[_0xaac3('0x11')](0x1f5,_0x4214e2[_0xaac3('0x19')]));});});},'Command':function(_0x51c3ae){var _0x3679b4=this;return new Promise(function(_0x189392,_0x832e8c){if(ami[_0xaac3('0x10')]()==![]){return _0x832e8c(_0x3679b4[_0xaac3('0x11')](0x1f4,[config[_0xaac3('0x12')]['ip'],config[_0xaac3('0x12')][_0xaac3('0x13')],'ami\x20disconnected'][_0xaac3('0x15')]('\x20')));}_0x51c3ae=_[_0xaac3('0x1b')](_0x51c3ae,_0xaac3('0x1c'));_0x51c3ae[_0xaac3('0x1d')]=_0xaac3('0x1e');return ami[_0xaac3('0x18')](_0x51c3ae)[_0xaac3('0x1f')](function(_0x1d546d){_0x189392({'code':0xc8,'message':_0x1d546d[_0xaac3('0x20')]});})['catch'](function(_0x2b08ee){_0x832e8c(_0x3679b4[_0xaac3('0x11')](0x1f5,_0x2b08ee[_0xaac3('0x19')]));});});},'VoiceQueues':function(_0x40f79e){return new Promise(function(_0x19db68,_0x43fdd8){var _0xea4c24=[];for(var _0x2878af in _0x394302[_0xaac3('0x21')]){if(_0x394302[_0xaac3('0x21')]['hasOwnProperty'](_0x2878af)){var _0x4fcc50=_0x394302['voiceQueues'][_0x2878af];var _0x14f261={'id':_0x4fcc50['id'],'name':_0x4fcc50[_0xaac3('0x9')],'strategy':_0x4fcc50[_0xaac3('0x22')],'answered':_0x4fcc50[_0xaac3('0x23')],'available':_0x4fcc50[_0xaac3('0x24')],'loggedIn':_0x4fcc50[_0xaac3('0x25')],'pTalking':_0x4fcc50[_0xaac3('0x26')],'sumBillable':_0x4fcc50[_0xaac3('0x27')],'sumDuration':_0x4fcc50['sumDuration'],'sumHoldTime':_0x4fcc50[_0xaac3('0x28')]||0x0,'talking':_0x4fcc50[_0xaac3('0x29')],'total':_0x4fcc50[_0xaac3('0x2a')],'type':_0x4fcc50['type'],'unmanaged':_0x4fcc50['unmanaged'],'abandoned':_0x4fcc50[_0xaac3('0x2b')],'waiting':_0x4fcc50[_0xaac3('0x2c')],'loggedInDb':_0x4fcc50['loggedInDb']};if(_0x4fcc50[_0xaac3('0x2d')]===_0xaac3('0x2e')){_0x14f261[_0xaac3('0x2f')]=_0x4fcc50['dialActive'];_0x14f261['dialMethod']=_0x4fcc50[_0xaac3('0x30')];_0x14f261[_0xaac3('0x31')]=_0x4fcc50[_0xaac3('0x31')];_0x14f261[_0xaac3('0x32')]=_0x4fcc50[_0xaac3('0x32')];_0x14f261[_0xaac3('0x33')]=_0x4fcc50[_0xaac3('0x33')];_0x14f261[_0xaac3('0x34')]=_0x4fcc50[_0xaac3('0x34')];_0x14f261[_0xaac3('0x35')]=_0x4fcc50[_0xaac3('0x35')];_0x14f261[_0xaac3('0x36')]=_0x4fcc50[_0xaac3('0x36')];_0x14f261[_0xaac3('0x37')]=_0x4fcc50['outboundBlacklistCallsDay'];_0x14f261['outboundBusyCallsDay']=_0x4fcc50['outboundBusyCallsDay'];_0x14f261['outboundCongestionCallsDay']=_0x4fcc50[_0xaac3('0x38')];_0x14f261[_0xaac3('0x39')]=_0x4fcc50[_0xaac3('0x39')];_0x14f261[_0xaac3('0x3a')]=_0x4fcc50[_0xaac3('0x3a')];_0x14f261[_0xaac3('0x3b')]=_0x4fcc50['outboundDropCallsDayTimeout'];_0x14f261[_0xaac3('0x3c')]=_0x4fcc50[_0xaac3('0x3c')];_0x14f261[_0xaac3('0x3d')]=_0x4fcc50[_0xaac3('0x3d')];_0x14f261['outboundOriginateFailureCallsDay']=_0x4fcc50[_0xaac3('0x3e')];_0x14f261[_0xaac3('0x3f')]=_0x4fcc50[_0xaac3('0x3f')];_0x14f261[_0xaac3('0x40')]=_0x4fcc50[_0xaac3('0x40')];_0x14f261[_0xaac3('0x41')]=_0x4fcc50[_0xaac3('0x41')];_0x14f261[_0xaac3('0x42')]=_0x4fcc50[_0xaac3('0x42')];_0x14f261[_0xaac3('0x43')]=_0x4fcc50[_0xaac3('0x43')];_0x14f261[_0xaac3('0x44')]=_0x4fcc50[_0xaac3('0x44')];_0x14f261[_0xaac3('0x45')]=_0x4fcc50[_0xaac3('0x45')];_0x14f261[_0xaac3('0x46')]=_0x4fcc50[_0xaac3('0x46')];_0x14f261[_0xaac3('0x47')]=_0x4fcc50['predictiveIntervalErlangCalls'];_0x14f261[_0xaac3('0x48')]=_0x4fcc50[_0xaac3('0x48')];_0x14f261[_0xaac3('0x49')]=_0x4fcc50[_0xaac3('0x49')];_0x14f261['predictiveIntervalMultiplicativeFactor']=_0x4fcc50[_0xaac3('0x4a')];_0x14f261['predictiveIntervalPauses']=_0x4fcc50[_0xaac3('0x4b')];_0x14f261[_0xaac3('0x4c')]=_0x4fcc50[_0xaac3('0x4c')];_0x14f261[_0xaac3('0x4d')]=_0x4fcc50[_0xaac3('0x4d')];_0x14f261[_0xaac3('0x19')]=_0x4fcc50['message'];_0x14f261[_0xaac3('0x4e')]=_0x4fcc50[_0xaac3('0x4e')];_0x14f261[_0xaac3('0x4f')]=_0x4fcc50[_0xaac3('0x4f')];_0x14f261[_0xaac3('0x50')]=_0x4fcc50[_0xaac3('0x50')];_0x14f261[_0xaac3('0x51')]=_0x4fcc50[_0xaac3('0x51')];_0x14f261[_0xaac3('0x52')]=_0x4fcc50['erlangBusyFactor'];_0x14f261[_0xaac3('0x53')]=_0x4fcc50['startPredictive'];_0x14f261[_0xaac3('0x54')]=_0x4fcc50[_0xaac3('0x54')];}if(_0x4fcc50[_0xaac3('0x55')]){_0x14f261['Trunk']={'id':_0x4fcc50[_0xaac3('0x55')]['id'],'name':_0x4fcc50[_0xaac3('0x55')][_0xaac3('0x9')],'active':_0x4fcc50[_0xaac3('0x55')]['active'],'callerid':_0x4fcc50[_0xaac3('0x55')][_0xaac3('0x56')]};}if(_0x4fcc50['Interval']){_0x14f261['Interval']={'id':_0x4fcc50[_0xaac3('0x57')]['id'],'name':_0x4fcc50[_0xaac3('0x57')][_0xaac3('0x9')]};}_0xea4c24[_0xaac3('0x58')](_0x14f261);}}_0x19db68({'count':_0xea4c24['length'],'rows':_0xea4c24});});},'VoiceChannels':function(_0x516734){return new Promise(function(_0x45975b,_0x4cf6b9){var _0x8ca1c5=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x5a')]);_0x45975b({'count':_0x8ca1c5[_0xaac3('0x5b')],'rows':_0x8ca1c5});});},'VoiceChannelMixMonitor':function(_0x5d8f78){var _0x42f651=this;return new Promise(function(_0x124a51,_0x3ce349){if(ami[_0xaac3('0x10')]()==![]){return _0x3ce349(_0x42f651[_0xaac3('0x11')](0x1f4,[config[_0xaac3('0x12')]['ip'],config[_0xaac3('0x12')][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}var _0xd0f314=schema(properties[_0xaac3('0x5c')])['validate'](_0x5d8f78);if(_0xd0f314[_0xaac3('0x5b')]>0x0){return _0x3ce349(_0x42f651[_0xaac3('0x11')](0x1f4,_[_0xaac3('0x5d')](_0xd0f314,_0xaac3('0x19'))[_0xaac3('0x15')](',\x20')));}var _0x428bc3=_[_0xaac3('0x5e')](_0x394302[_0xaac3('0x5a')],{'uniqueid':_0x5d8f78[_0xaac3('0x5f')]});if(_0x428bc3&&_0x428bc3[_0xaac3('0x60')]){var _0x1db68d=util['format'](_0xaac3('0x61'),_0x5d8f78['filename']||_0x5d8f78[_0xaac3('0x5f')],_0x5d8f78[_0xaac3('0x6')]||_0xaac3('0x62'));return ami[_0xaac3('0x18')]({'action':_0xaac3('0x63'),'channel':_0x428bc3[_0xaac3('0x60')],'file':_0x1db68d,'options':_0xaac3('0x64')})[_0xaac3('0x1f')](function(_0x41289){var _0x1f1a1a=_['find'](_0x428bc3['monitors'],{'filename':_0xaac3('0x65')+_0x1db68d[_0xaac3('0x66')]()});if(_[_0xaac3('0x67')](_0x1f1a1a)){_0x428bc3[_0xaac3('0x68')][_0xaac3('0x58')]({'filename':'/var/spool/asterisk/monitor/'+_0x1db68d[_0xaac3('0x66')](),'createdAt':moment()[_0xaac3('0x6')](_0xaac3('0x69')),'mixmonitorid':_0x41289[_0xaac3('0x6a')],'status':_0xaac3('0x6b')});}else{_0x1f1a1a[_0xaac3('0x6a')]=_0x41289[_0xaac3('0x6a')];_0x1f1a1a[_0xaac3('0x6c')]=_0xaac3('0x6b');}_0x124a51({'code':0xc8,'message':[_0x5d8f78['uniqueid'],_0xaac3('0x6d'),_0x41289[_0xaac3('0x6a')]]['join']('\x20'),'mixmonitorid':_0x41289['mixmonitorid']});})[_0xaac3('0x1a')](function(_0x12301e){_0x3ce349(_0x42f651[_0xaac3('0x11')](0x1f5,[_0x5d8f78[_0xaac3('0x5f')],_0x12301e[_0xaac3('0x19')]['toLowerCase']()]['join']('\x20')));});}else{return _0x3ce349(_0x42f651['error'](0x1f5,_0xaac3('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x16fa66){var _0x1c28b9=this;return new Promise(function(_0x17a3da,_0x1ace0e){if(ami[_0xaac3('0x10')]()==![]){return _0x1ace0e(_0x1c28b9[_0xaac3('0x11')](0x1f4,[config[_0xaac3('0x12')]['ip'],config['asterisk'][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}var _0x4401dc=schema(properties[_0xaac3('0x5c')])[_0xaac3('0x3')](_0x16fa66);if(_0x4401dc['length']>0x0){return _0x1ace0e(_0x1c28b9['error'](0x1f4,_[_0xaac3('0x5d')](_0x4401dc,'message')[_0xaac3('0x15')](',\x20')));}var _0x3a7b37=_[_0xaac3('0x5e')](_0x394302[_0xaac3('0x5a')],{'uniqueid':_0x16fa66[_0xaac3('0x5f')]});if(_0x3a7b37){return BPromise['resolve']()[_0xaac3('0x1f')](function(){if(_0x3a7b37[_0xaac3('0x60')]){return ami[_0xaac3('0x18')]({'action':_0xaac3('0x6f'),'channel':_0x3a7b37[_0xaac3('0x60')],'mixmonitorid':_0x16fa66[_0xaac3('0x6a')]})[_0xaac3('0x1a')](function(_0x519c9a){});}})[_0xaac3('0x1f')](function(){if(_0x3a7b37[_0xaac3('0x70')]){return ami[_0xaac3('0x18')]({'action':_0xaac3('0x6f'),'channel':_0x3a7b37[_0xaac3('0x70')],'mixmonitorid':_0x16fa66[_0xaac3('0x6a')]})[_0xaac3('0x1a')](function(_0x7cec07){});}})['then'](function(_0x3c4493){var _0x29e09f=_[_0xaac3('0x5e')](_0x3a7b37['monitors'],{'mixmonitorid':_0x16fa66['mixmonitorid']});if(_0x29e09f){_0x29e09f[_0xaac3('0x6c')]=_0xaac3('0x71');}})[_0xaac3('0x1f')](function(){var _0x48f051=util[_0xaac3('0x6')](_0xaac3('0x61'),_0x16fa66[_0xaac3('0x72')]||_0x16fa66[_0xaac3('0x5f')],_0x16fa66[_0xaac3('0x6')]||'wav');var _0x22af15=_['find'](_0x3a7b37[_0xaac3('0x68')],{'filename':_0xaac3('0x65')+_0x48f051[_0xaac3('0x66')]()});if(_0x22af15){_0x22af15[_0xaac3('0x6c')]=_0xaac3('0x71');}})[_0xaac3('0x1f')](function(){_0x17a3da({'code':0xc8,'message':[_0x16fa66[_0xaac3('0x5f')],'StopMixMonitor\x20Success'][_0xaac3('0x15')]('\x20')});})['catch'](function(_0x2592bf){_0x1ace0e(_0x1c28b9[_0xaac3('0x11')](0x1f5,[_0x16fa66['uniqueid'],_0x2592bf['message']['toLowerCase']()][_0xaac3('0x15')]('\x20')));});}else{return _0x1ace0e(_0x1c28b9[_0xaac3('0x11')](0x1f5,_0xaac3('0x6e')));}});},'VoiceQueuesChannels':function(_0x199fdd){return new Promise(function(_0x34367a,_0x368ec8){var _0xa1b31d=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x73')]);_0x34367a({'count':_0xa1b31d['length'],'rows':_0xa1b31d});});},'VoiceQueuesChannel':function(_0x2dfbe4){var _0x5db9e5=this;return new Promise(function(_0x3d7262,_0x4d3e08){var _0x5c9323=schema(properties[_0xaac3('0x74')])[_0xaac3('0x3')](_0x2dfbe4);if(_0x5c9323[_0xaac3('0x5b')]>0x0){return _0x4d3e08(_0x5db9e5[_0xaac3('0x11')](0x1f4,_[_0xaac3('0x5d')](_0x5c9323,_0xaac3('0x19'))['join'](',\x20')));}var _0x26652d=_[_0xaac3('0x5e')](_0x394302[_0xaac3('0x73')],{'uniqueid':_0x2dfbe4[_0xaac3('0x5f')]});if(_0x26652d){_0x3d7262(_0x26652d);}else{return _0x4d3e08(_0x5db9e5['error'](0x1f5,_0xaac3('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x65c21d){var _0x4fcdfc=this;return new Promise(function(_0x3d00ea,_0x43442e){if(ami['isConnected']()==![]){return _0x43442e(_0x4fcdfc[_0xaac3('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xaac3('0x12')][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}var _0x3ef03e=schema(properties[_0xaac3('0x75')])['validate'](_0x65c21d);if(_0x3ef03e[_0xaac3('0x5b')]>0x0){return _0x43442e(_0x4fcdfc['error'](0x1f4,_[_0xaac3('0x5d')](_0x3ef03e,_0xaac3('0x19'))['join'](',\x20')));}var _0x48880f=_[_0xaac3('0x5e')](_0x394302['queueChannels'],{'uniqueid':_0x65c21d[_0xaac3('0x5f')]});if(_0x48880f&&_0x48880f[_0xaac3('0x60')]){return ami[_0xaac3('0x18')]({'action':_0xaac3('0x76'),'channel':_0x48880f[_0xaac3('0x60')]})['then'](function(_0x27a71b){_0x3d00ea({'code':0xc8,'message':[_0x65c21d[_0xaac3('0x5f')],_0x27a71b[_0xaac3('0x19')]['toLowerCase']()][_0xaac3('0x15')]('\x20')});})[_0xaac3('0x1a')](function(_0x5b861a){_0x43442e(_0x4fcdfc[_0xaac3('0x11')](0x1f5,[_0x65c21d[_0xaac3('0x5f')],_0x5b861a[_0xaac3('0x19')][_0xaac3('0x66')]()][_0xaac3('0x15')]('\x20')));});}else{return _0x43442e(_0x4fcdfc[_0xaac3('0x11')](0x1f5,_0xaac3('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x53c7f9){var _0x4ec063=this;return new Promise(function(_0x37c44a,_0xcad256){if(ami['isConnected']()==![]){return _0xcad256(_0x4ec063['error'](0x1f4,[config[_0xaac3('0x12')]['ip'],config[_0xaac3('0x12')][_0xaac3('0x13')],_0xaac3('0x14')][_0xaac3('0x15')]('\x20')));}var _0x571ced=schema(properties[_0xaac3('0x77')])[_0xaac3('0x3')](_0x53c7f9);if(_0x571ced[_0xaac3('0x5b')]>0x0){return _0xcad256(_0x4ec063[_0xaac3('0x11')](0x1f4,_[_0xaac3('0x5d')](_0x571ced,'message')[_0xaac3('0x15')](',\x20')));}var _0x370170=_[_0xaac3('0x5e')](_0x394302[_0xaac3('0x73')],{'uniqueid':_0x53c7f9[_0xaac3('0x5f')]});if(_0x370170&&_0x370170[_0xaac3('0x60')]){return ami['Action']({'action':_0xaac3('0x78'),'channel':_0x370170[_0xaac3('0x60')],'exten':_0x53c7f9[_0xaac3('0x79')],'context':_0x53c7f9['context']||_0x370170['context'],'priority':0x1})['then'](function(_0x107b1e){_0x37c44a({'code':0xc8,'message':[_0x53c7f9[_0xaac3('0x5f')],_0x107b1e[_0xaac3('0x19')][_0xaac3('0x66')]()]['join']('\x20')});})[_0xaac3('0x1a')](function(_0x548cb6){_0xcad256(_0x4ec063[_0xaac3('0x11')](0x1f5,[_0x53c7f9[_0xaac3('0x5f')],_0x548cb6[_0xaac3('0x19')][_0xaac3('0x66')]()][_0xaac3('0x15')]('\x20')));});}else{return _0xcad256(_0x4ec063[_0xaac3('0x11')](0x1f5,_0xaac3('0x6e')));}});},'Agents':function(_0x277141){return new Promise(function(_0xf4be9f,_0x38ab47){var _0x1ba1cf=_['values'](_0x394302[_0xaac3('0xc')]);_0xf4be9f({'count':_0x1ba1cf[_0xaac3('0x5b')],'rows':_0x1ba1cf});});},'Telephones':function(_0x475b8d){return new Promise(function(_0x35d948,_0x2c9cf3){var _0x4c25d6=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x7a')]);_0x35d948({'count':_0x4c25d6[_0xaac3('0x5b')],'rows':_0x4c25d6});});},'Trunks':function(_0x8ac4eb){return new Promise(function(_0xe6f5c8,_0xd4230c){var _0x465d84=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x7b')]);_0xe6f5c8({'count':_0x465d84[_0xaac3('0x5b')],'rows':_0x465d84});});},'OutboundChannels':function(_0x3cb136){return new Promise(function(_0x560f93,_0x2eecae){var _0x20c748=_['values'](_0x394302[_0xaac3('0x7c')]);_0x560f93({'count':_0x20c748[_0xaac3('0x5b')],'rows':_0x20c748});});},'Outbound':function(_0x4e9601){return new Promise(function(_0x573b6d,_0x401ab7){_0x573b6d(_0x394302[_0xaac3('0x2e')]);});},'Campaigns':function(_0x2925ce){return new Promise(function(_0x431011,_0x493586){var _0x568ec1=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x7d')]);_0x431011({'count':_0x568ec1[_0xaac3('0x5b')],'rows':_0x568ec1});});},'VoiceQueuesPreview':function(_0x487098){var _0x6c0204=this;return new Promise(function(_0x4939ba,_0x43c288){_0x4dc4fb[_0xaac3('0x7e')](_0x487098['id'])[_0xaac3('0x1f')](function(_0x192059){_0x4939ba({'code':0xc8,'message':_0x192059[_0xaac3('0x19')]});})[_0xaac3('0x1a')](function(_0x5365d5){_0x43c288(_0x6c0204['error'](0x1f4,_0x5365d5['message']));});});},'EventManager':function(_0x237ad3){var _0x5b4fc4=this;return new Promise(function(_0x3b3128,_0x244a93){if(!_0x237ad3[_0xaac3('0x7f')]){return _0x244a93(_0x5b4fc4[_0xaac3('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0xaac3('0x80')+_0x237ad3['event'],_0x237ad3[_0xaac3('0x19')]);_0x3b3128({'code':0xc8,'message':_0x237ad3});});},'FaxAccounts':function(_0x2a3a7b){return new Promise(function(_0x4f94f3,_0x12f789){var _0x12c58a=_[_0xaac3('0x59')](_0x394302[_0xaac3('0x81')]);_0x4f94f3({'count':_0x12c58a[_0xaac3('0x5b')],'rows':_0x12c58a});});},'SendFax':function(_0x3a0253){var _0x225f99=this;return new Promise(function(_0x260ff5,_0x3d7a93){_0x4dd0a2[_0xaac3('0x82')](_0x3a0253)[_0xaac3('0x1f')](function(_0x1d7a23){_0x260ff5({'code':0xc8,'message':_0x1d7a23[_0xaac3('0x19')]});})[_0xaac3('0x1a')](function(_0x3e65e5){_0x3d7a93(_0x225f99[_0xaac3('0x11')](0x1f4,_0x3e65e5['message']));});});},'CheckAfterSend':function(_0x60ed11){var _0x465944=this;return new Promise(function(_0x46c1a6,_0x52832c){_0x4dd0a2[_0xaac3('0x83')](_0x60ed11)[_0xaac3('0x1f')](function(_0x224f70){_0x46c1a6({'code':0xc8,'message':_0x224f70[_0xaac3('0x19')]});})['catch'](function(_0x29655f){_0x52832c(_0x465944[_0xaac3('0x11')](0x1f4,_0x29655f[_0xaac3('0x19')]));});});}};var _0x29a8f6=jayson[_0xaac3('0x84')](_0x3691d1)['http']();_0x29a8f6['on'](_0xaac3('0x11'),function(_0x512e04){return _0x594303(_0x512e04);});_0x29a8f6[_0xaac3('0x85')](0x232a,_0xaac3('0x86'),function(){console['log'](_0xaac3('0x87'),0x232a);return _0x184ef7('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 1745e63..18a154b 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 _0x51f9=['../../rpc/cmContact','redis','localhost','socket.io-emitter','info','stringify','exec','data2','calleridnum','isNil','routeId','calleridname','firstName','destcalleridname','','uniqueid','destcalleridnum','resolve','then','showContact','omit','xmd-contactid2','format','user:%s','name','toLowerCase','data1','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','trigger:%s','action','merge','error','[%s][%s]\x20Error\x20creating\x20contact','bluebird','ioredis','trigger'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x51f9,0x1eb));var _0x951f=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x51f9[_0x7275e9];return _0x17b99d;};'use strict';var BPromise=require(_0x951f('0x0'));var util=require('util');var _=require('lodash');var Redis=require(_0x951f('0x1'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x951f('0x2'));var cmContactRpc=require(_0x951f('0x3'));config['redis']=_['defaults'](config[_0x951f('0x4')],{'host':_0x951f('0x5'),'port':0x18eb});var io=require(_0x951f('0x6'))(new Redis(config[_0x951f('0x4')]));function emit(_0x5813a1,_0x5ebdc5,_0x14f2a7,_0x14377b){logger[_0x951f('0x7')]('[%s][%s]',_0x5813a1,'',_0x5ebdc5,_0x14f2a7,JSON[_0x951f('0x8')](_0x14377b));io['to'](_0x5ebdc5)['emit'](_0x14f2a7,_0x14377b);}exports[_0x951f('0x9')]=function(_0x13d2d5,_0x5004ad,_0x5b128c){_0x5b128c['autoCreate']=0x0;if(_0x5004ad[_0x951f('0xa')]&&parseInt(_0x5004ad['data2'],0xa)){var _0x4a8b44={'ListId':parseInt(_0x5004ad['data1'],0xa),'phone':_0x5b128c[_0x951f('0xb')]};if(_[_0x951f('0xc')](_0x5b128c[_0x951f('0xd')])){_0x4a8b44['firstName']=_0x5b128c['calleridname']&&_0x5b128c[_0x951f('0xe')]!==''?_0x5b128c[_0x951f('0xe')]:_0x5b128c[_0x951f('0xb')]||_0x5b128c['uniqueid'];}else{_0x4a8b44[_0x951f('0xf')]=_0x5b128c[_0x951f('0x10')]&&_0x5b128c['destcalleridname']!==_0x951f('0x11')?_0x5b128c[_0x951f('0x10')]:_0x5b128c['destcalleridnum']||_0x5b128c[_0x951f('0x12')];_0x4a8b44['phone']=_0x5b128c['destcalleridname']&&_0x5b128c[_0x951f('0x10')]!==_0x951f('0x11')?_0x5b128c[_0x951f('0x10')]:_0x5b128c[_0x951f('0x13')]||_0x5b128c[_0x951f('0x12')];}BPromise[_0x951f('0x14')]()[_0x951f('0x15')](cmContactRpc[_0x951f('0x16')]({'where':_[_0x951f('0x17')](_0x4a8b44,['firstName'])}))['then'](function(_0x11168e){if(_0x11168e){logger[_0x951f('0x7')]('[%s][%s]\x20Contact\x20found:%s',_0x5b128c[_0x951f('0x12')],'',_0x11168e['id']);if(_0x13d2d5){_0x5b128c[_0x951f('0x18')]=_0x11168e['id'];emit(_0x5b128c[_0x951f('0x12')],util[_0x951f('0x19')](_0x951f('0x1a'),_0x13d2d5[_0x951f('0x1b')]),util['format']('trigger:%s',_0x5004ad['action'][_0x951f('0x1c')]()),_['merge'](_0x5b128c,{'ListId':parseInt(_0x5004ad[_0x951f('0x1d')],0xa)}));}return;}else{logger[_0x951f('0x7')](_0x951f('0x1e'),_0x5b128c[_0x951f('0x12')],'');return BPromise[_0x951f('0x14')]()[_0x951f('0x15')](cmContactRpc[_0x951f('0x1f')](_0x4a8b44));}})[_0x951f('0x15')](function(_0x429482){if(_0x429482){logger[_0x951f('0x7')](_0x951f('0x20'),_0x5b128c[_0x951f('0x12')],'',_0x429482['id']);if(_0x13d2d5){_0x5b128c[_0x951f('0x18')]=_0x429482['id'];emit(_0x5b128c[_0x951f('0x12')],util['format']('user:%s',_0x13d2d5[_0x951f('0x1b')]),util[_0x951f('0x19')](_0x951f('0x21'),_0x5004ad[_0x951f('0x22')][_0x951f('0x1c')]()),_[_0x951f('0x23')](_0x5b128c,{'ListId':parseInt(_0x5004ad[_0x951f('0x1d')],0xa)}));}}})['catch'](function(_0x4a20be){logger[_0x951f('0x24')](_0x951f('0x25'),_0x5b128c[_0x951f('0x12')],'',JSON[_0x951f('0x8')](_0x4a20be));});}else{if(_0x13d2d5){logger[_0x951f('0x7')]('[%s][%s]\x20Autocreate\x20disabled',_0x5b128c[_0x951f('0x12')],'');emit(_0x5b128c['uniqueid'],util[_0x951f('0x19')](_0x951f('0x1a'),_0x13d2d5[_0x951f('0x1b')]),util[_0x951f('0x19')](_0x951f('0x21'),_0x5004ad[_0x951f('0x22')]['toLowerCase']()),_[_0x951f('0x23')]({'ListId':parseInt(_0x5004ad[_0x951f('0x1d')],0xa)},_0x5b128c));}}}; \ No newline at end of file +var _0x917a=['error','[%s][%s]\x20Error\x20creating\x20contact','lodash','ioredis','../../../../config/environment','trigger','redis','defaults','[%s][%s]','stringify','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','','uniqueid','destcalleridname','phone','destcalleridnum','resolve','showContact','omit','then','info','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format','user:%s','name','trigger:%s','action','merge','[%s][%s]\x20Contact\x20not\x20found','[%s][%s]\x20Contact\x20created:%s','toLowerCase','catch'];(function(_0x15ece6,_0x51a965){var _0x3dc05c=function(_0x43e0c1){while(--_0x43e0c1){_0x15ece6['push'](_0x15ece6['shift']());}};_0x3dc05c(++_0x51a965);}(_0x917a,0x173));var _0xa917=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x917a[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xa917('0x0'));var Redis=require(_0xa917('0x1'));var config=require(_0xa917('0x2'));var logger=require('../../../../config/logger')(_0xa917('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0xa917('0x4')]=_[_0xa917('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa917('0x4')]));function emit(_0x3be995,_0x1fe3a0,_0x24ab73,_0x4d3b0d){logger['info'](_0xa917('0x6'),_0x3be995,'',_0x1fe3a0,_0x24ab73,JSON[_0xa917('0x7')](_0x4d3b0d));io['to'](_0x1fe3a0)['emit'](_0x24ab73,_0x4d3b0d);}exports[_0xa917('0x8')]=function(_0x2ec5f1,_0x2e8ab7,_0x1f7939){_0x1f7939[_0xa917('0x9')]=0x0;if(_0x2e8ab7[_0xa917('0xa')]&&parseInt(_0x2e8ab7[_0xa917('0xa')],0xa)){var _0x39760b={'ListId':parseInt(_0x2e8ab7[_0xa917('0xb')],0xa),'phone':_0x1f7939[_0xa917('0xc')]};if(_[_0xa917('0xd')](_0x1f7939[_0xa917('0xe')])){_0x39760b[_0xa917('0xf')]=_0x1f7939[_0xa917('0x10')]&&_0x1f7939[_0xa917('0x10')]!==_0xa917('0x11')?_0x1f7939[_0xa917('0x10')]:_0x1f7939['calleridnum']||_0x1f7939[_0xa917('0x12')];}else{_0x39760b[_0xa917('0xf')]=_0x1f7939[_0xa917('0x13')]&&_0x1f7939['destcalleridname']!==_0xa917('0x11')?_0x1f7939['destcalleridname']:_0x1f7939['destcalleridnum']||_0x1f7939[_0xa917('0x12')];_0x39760b[_0xa917('0x14')]=_0x1f7939['destcalleridname']&&_0x1f7939[_0xa917('0x13')]!==_0xa917('0x11')?_0x1f7939['destcalleridname']:_0x1f7939[_0xa917('0x15')]||_0x1f7939['uniqueid'];}BPromise[_0xa917('0x16')]()['then'](cmContactRpc[_0xa917('0x17')]({'where':_[_0xa917('0x18')](_0x39760b,[_0xa917('0xf')])}))[_0xa917('0x19')](function(_0x104162){if(_0x104162){logger[_0xa917('0x1a')](_0xa917('0x1b'),_0x1f7939[_0xa917('0x12')],'',_0x104162['id']);if(_0x2ec5f1){_0x1f7939[_0xa917('0x1c')]=_0x104162['id'];emit(_0x1f7939[_0xa917('0x12')],util[_0xa917('0x1d')](_0xa917('0x1e'),_0x2ec5f1[_0xa917('0x1f')]),util['format'](_0xa917('0x20'),_0x2e8ab7[_0xa917('0x21')]['toLowerCase']()),_[_0xa917('0x22')](_0x1f7939,{'ListId':parseInt(_0x2e8ab7[_0xa917('0xb')],0xa)}));}return;}else{logger[_0xa917('0x1a')](_0xa917('0x23'),_0x1f7939[_0xa917('0x12')],'');return BPromise[_0xa917('0x16')]()[_0xa917('0x19')](cmContactRpc['createContact'](_0x39760b));}})[_0xa917('0x19')](function(_0x16a57e){if(_0x16a57e){logger[_0xa917('0x1a')](_0xa917('0x24'),_0x1f7939[_0xa917('0x12')],'',_0x16a57e['id']);if(_0x2ec5f1){_0x1f7939[_0xa917('0x1c')]=_0x16a57e['id'];emit(_0x1f7939[_0xa917('0x12')],util[_0xa917('0x1d')]('user:%s',_0x2ec5f1['name']),util[_0xa917('0x1d')](_0xa917('0x20'),_0x2e8ab7['action'][_0xa917('0x25')]()),_['merge'](_0x1f7939,{'ListId':parseInt(_0x2e8ab7[_0xa917('0xb')],0xa)}));}}})[_0xa917('0x26')](function(_0x1ccfc0){logger[_0xa917('0x27')](_0xa917('0x28'),_0x1f7939[_0xa917('0x12')],'',JSON[_0xa917('0x7')](_0x1ccfc0));});}else{if(_0x2ec5f1){logger[_0xa917('0x1a')]('[%s][%s]\x20Autocreate\x20disabled',_0x1f7939[_0xa917('0x12')],'');emit(_0x1f7939[_0xa917('0x12')],util[_0xa917('0x1d')]('user:%s',_0x2ec5f1[_0xa917('0x1f')]),util['format'](_0xa917('0x20'),_0x2e8ab7[_0xa917('0x21')]['toLowerCase']()),_[_0xa917('0x22')]({'ListId':parseInt(_0x2e8ab7[_0xa917('0xb')],0xa)},_0x1f7939));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index cb2d5cd..f7cf489 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 _0x520b=['triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','emit','info','stringify','prototype','clone','checkTriggers','interface','hasOwnProperty','status','length','action','contactmanager','motionbar','browser','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','location','windowWidth','data5','800','data6','600','format','user:%s','name','trigger:%s:%s','toLowerCase','data1','merge','jscripty','trigger:%s','exec','integration','routeId','urlforward','script','parse','query','checkTrigger','every','AllConditions','checkConditions','channel','some','field','account','ChatWebsiteId','value','upperFirst','AccountId','operator','message','event','queue','agent','membername','lastevent','exports','util','lodash','url','mustache','./urlforward','./script','../rpc/cmContact','../../../config/environment','../../../config/logger','trigger','../ami','socket.io-emitter','redis','popup','winapp'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x520b,0x1bd));var _0xb520=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x520b[_0x11f5ff];return _0x46eefb;};'use strict';var util=require(_0xb520('0x0'));var _=require(_0xb520('0x1'));var url=require(_0xb520('0x2'));var Mustache=require(_0xb520('0x3'));var Redis=require('ioredis');var urlforward=require(_0xb520('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0xb520('0x5'));var cmContactRpc=require(_0xb520('0x6'));var config=require(_0xb520('0x7'));var logger=require(_0xb520('0x8'))(_0xb520('0x9'));var ami=require(_0xb520('0xa'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb520('0xb'))(new Redis(config[_0xb520('0xc')]));var operators={'equals':function(_0x1bf245,_0x9c8e81){return _0x1bf245==_0x9c8e81;},'not_equals':function(_0x49c945,_0x2a32c8){return _0x49c945!=_0x2a32c8;}};var barAndWebActions=[_0xb520('0xd'),_0xb520('0x2'),_0xb520('0xe')];function Trigger(_0x3edd09){this['triggers']=_0x3edd09[_0xb520('0xf')];this[_0xb520('0x10')]=_0x3edd09[_0xb520('0x10')];this[_0xb520('0x11')]=_0x3edd09[_0xb520('0x11')];this[_0xb520('0x12')]=_0x3edd09[_0xb520('0x12')];this[_0xb520('0x13')]=_0x3edd09[_0xb520('0x13')];this[_0xb520('0x14')]=_0x3edd09[_0xb520('0x14')];this[_0xb520('0x15')]=_0x3edd09[_0xb520('0x15')];this[_0xb520('0x16')]=_0x3edd09[_0xb520('0x16')];this[_0xb520('0x17')]=_0x3edd09[_0xb520('0x17')];this[_0xb520('0x18')]=_0x3edd09[_0xb520('0x18')];this['deskAccounts']=_0x3edd09[_0xb520('0x19')];this['vtigerAccounts']=_0x3edd09[_0xb520('0x1a')];this[_0xb520('0x1b')]=_0x3edd09['servicenowAccounts'];this[_0xb520('0x1c')]=_0x3edd09[_0xb520('0x1c')];this[_0xb520('0x1d')]=_0x3edd09[_0xb520('0x1d')];this[_0xb520('0x1e')]={'zendesk':this[_0xb520('0x14')],'salesforce':this[_0xb520('0x16')],'freshdesk':this[_0xb520('0x15')],'sugarcrm':this[_0xb520('0x17')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this[_0xb520('0x1a')],'dynamics365':this[_0xb520('0x1c')],'freshsales':this[_0xb520('0x1d')],'servicenow':this[_0xb520('0x1b')]};ami['on'](_0xb520('0x1f'),this[_0xb520('0x20')]['bind'](this));ami['on']('custom:agentconnect',this[_0xb520('0x20')][_0xb520('0x21')](this));ami['on'](_0xb520('0x22'),this[_0xb520('0x20')][_0xb520('0x21')](this));ami['on'](_0xb520('0x23'),this[_0xb520('0x20')][_0xb520('0x21')](this));ami['on'](_0xb520('0x24'),this[_0xb520('0x20')][_0xb520('0x21')](this));ami['on'](_0xb520('0x25'),this['syncCustomEvent'][_0xb520('0x21')](this));ami['on']('custom:agentbusy',this[_0xb520('0x20')][_0xb520('0x21')](this));ami['on'](_0xb520('0x26'),this[_0xb520('0x20')][_0xb520('0x21')](this));ami['on'](_0xb520('0x27'),this[_0xb520('0x20')]['bind'](this));ami['on'](_0xb520('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0xb520('0x29'),this['syncCustomEvent'][_0xb520('0x21')](this));ami['on'](_0xb520('0x2a'),this[_0xb520('0x2b')][_0xb520('0x21')](this));ami['on']('custom:dialconnect',this[_0xb520('0x2b')][_0xb520('0x21')](this));ami['on'](_0xb520('0x2c'),this[_0xb520('0x2b')][_0xb520('0x21')](this));ami['on'](_0xb520('0x2d'),this['syncCustomEvent'][_0xb520('0x21')](this));ami['on'](_0xb520('0x2e'),this['syncCustomEvent'][_0xb520('0x21')](this));ami['on'](_0xb520('0x2f'),this[_0xb520('0x20')][_0xb520('0x21')](this));ami['on'](_0xb520('0x30'),this[_0xb520('0x20')][_0xb520('0x21')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0xb520('0x21')](this));ami['on'](_0xb520('0x31'),this[_0xb520('0x20')][_0xb520('0x21')](this));}Trigger['prototype'][_0xb520('0x32')]=function(_0x53a741,_0x4c1bcc,_0x301239){logger[_0xb520('0x33')](_0x53a741,_0x4c1bcc,JSON[_0xb520('0x34')](_0x301239));io['to'](_0x53a741)['emit'](_0x4c1bcc,_0x301239);};Trigger[_0xb520('0x35')][_0xb520('0x20')]=function(_0x598c19){var _0x1f150e=_[_0xb520('0x36')](_0x598c19);this[_0xb520('0x37')](_0x1f150e);};Trigger[_0xb520('0x35')][_0xb520('0x2b')]=function(_0x20b3a1){if(this[_0xb520('0x10')][_0x20b3a1[_0xb520('0x38')]]){this[_0xb520('0x20')](_0x20b3a1);}};Trigger[_0xb520('0x35')]['checkTriggers']=function(_0x18e9f1){var _0x31aada;for(var _0xafbd6c in this[_0xb520('0xf')]){if(this['triggers'][_0xb520('0x39')](_0xafbd6c)){if(this[_0xb520('0xf')][_0xafbd6c][_0xb520('0x3a')]){_0x31aada=this['checkTrigger'](this[_0xb520('0xf')][_0xafbd6c],_0x18e9f1);if(_0x31aada){_['merge'](_0x18e9f1,_0x18e9f1['variables']);for(var _0x405316=0x0,_0x3ae7dd,_0x23985a,_0x14b941;_0x4053160x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index ffa4741..059fad8 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 _0xf78e=['util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','userEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','4.0','toLowerCase','outbound','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','indexOf','substring','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','phonecalls','callDirection','queue','ticketId','message','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','request-promise'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0xf78e,0x176));var _0xef78=function(_0x31826c,_0x1995c5){_0x31826c=_0x31826c-0x0;var _0x20bbd7=_0xf78e[_0x31826c];return _0x20bbd7;};'use strict';var _=require('lodash');var BPromise=require(_0xef78('0x0'));var rp=require(_0xef78('0x1'));var util=require(_0xef78('0x2'));var intUtil=require(_0xef78('0x3'));var md5=require(_0xef78('0x4'));var Redis=require(_0xef78('0x5'));var logger=require('../../../../config/logger')(_0xef78('0x6'));var config=require(_0xef78('0x7'));config[_0xef78('0x8')]=_[_0xef78('0x9')](config[_0xef78('0x8')],{'host':_0xef78('0xa'),'port':0x18eb});var io=require(_0xef78('0xb'))(new Redis(config[_0xef78('0x8')]));function getAuthToken(_0x753018,_0x150ddb,_0x4b4893){var _0x2bee21={'method':_0xef78('0xc'),'uri':_0x150ddb,'form':{'client_id':_0x753018[_0xef78('0xd')],'resource':_0x753018['remoteUri'],'username':_0x753018[_0xef78('0xe')],'password':_0x753018[_0xef78('0xf')],'grant_type':'password','client_secret':_0x753018[_0xef78('0x10')]},'json':!![]};return rp(_0x2bee21)[_0xef78('0x11')](function(_0x422027){return _0x422027[_0xef78('0x12')];})[_0xef78('0x13')](function(_0x4bac3d){logger[_0xef78('0x14')]('['+[_0x4b4893[_0xef78('0x15')]()]+_0xef78('0x16'));return _0x4bac3d['message'];});}function getUser(_0x4c9e09,_0x5513b9,_0x177e4d,_0x3d07f0,_0x1b03e1,_0x7d73e0){return new BPromise(function(_0x1695db,_0x5d68ae){return getAuthToken(_0x5513b9,_0x3d07f0,_0x7d73e0)[_0xef78('0x11')](function(_0x413818){var _0x6dff74={'method':_0xef78('0x17'),'uri':_0x1b03e1+_0xef78('0x18'),'headers':{'Authorization':_0xef78('0x19')+_0x413818,'OData-Version':'4.0'},'json':!![]};return rp(_0x6dff74);})['then'](function(_0x5bfd06){var _0x3cee10=_0x5bfd06[_0xef78('0x1a')];var _0x6f5bba=![];var _0x140b3f=null;if(!_['isNil'](_0x177e4d)){if(intUtil[_0xef78('0x1b')](_0x177e4d['email'])){_0x4c9e09[_0xef78('0x1c')]=_0x177e4d[_0xef78('0x1d')];for(_0x140b3f=0x0;_0x140b3f<_0x3cee10[_0xef78('0x1e')];_0x140b3f++){if(_0x3cee10[_0x140b3f]['internalemailaddress']===_0x177e4d['email']&&!_0x3cee10[_0x140b3f][_0xef78('0x1f')]){_0x6f5bba=!![];logger[_0xef78('0x20')]('['+[_0x7d73e0['toUpperCase']()]+_0xef78('0x21')+_0x3cee10[_0x140b3f]['systemuserid']+'!');_0x4c9e09[_0xef78('0x22')]=_0x3cee10[_0x140b3f]['systemuserid'];}}}}if(!_0x6f5bba){logger['info']('['+[_0x7d73e0[_0xef78('0x15')]()]+_0xef78('0x23'));_0x4c9e09[_0xef78('0x1c')]=_0x5513b9['username'];for(_0x140b3f=0x0;_0x140b3f<_0x3cee10[_0xef78('0x1e')];_0x140b3f++){if(_0x3cee10[_0x140b3f]['internalemailaddress']===_0x5513b9['username']){_0x4c9e09['userId']=_0x3cee10[_0x140b3f][_0xef78('0x24')];}}}_0x1695db(_0x4c9e09);})['catch'](function(_0x4d3d07){_0x5d68ae(_0x4d3d07['message']);});});}function createEndUser(_0x10d6a7,_0x2aeb62,_0xdd1552,_0x1d50ef,_0x224c35,_0x2e45a8){return new BPromise(function(_0x23816c,_0x257a7d){return getAuthToken(_0x2aeb62,_0xdd1552,_0x2e45a8)[_0xef78('0x11')](function(_0xe8f1ef){var _0x283997=_0x2e45a8['toLowerCase']()==='outbound'?_0x224c35[_0xef78('0x25')]:_0x224c35[_0xef78('0x26')];var _0x43e21e={'method':_0xef78('0xc'),'uri':_0x1d50ef+_0xef78('0x27'),'body':{'telephone1':_0x283997,'fullname':_0x283997,'firstname':_0x283997,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xef78('0x28')+_0x10d6a7['userId']+')'},'headers':{'Authorization':_0xef78('0x19')+_0xe8f1ef,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x43e21e);})[_0xef78('0x11')](function(_0x4e7bcc){var _0x71f799=_0x4e7bcc[_0xef78('0x29')][_0xef78('0x2a')];var _0xd56707=_0x71f799['substring'](_0x71f799[_0xef78('0x2b')]('(')+0x1,_0x71f799[_0xef78('0x2b')](')'));_0x10d6a7[_0xef78('0x2c')]=_0xd56707;_0x23816c(_0x10d6a7);})[_0xef78('0x13')](function(_0x40643b){_0x257a7d(_0x40643b['message']);});});}function getEndUser(_0x4994a4,_0x176e2e,_0x5527ac,_0x1da5bc,_0x1f4bdd,_0x55e40f){return new BPromise(function(_0x40a395,_0x52bdc6){return getAuthToken(_0x176e2e,_0x5527ac,_0x55e40f)[_0xef78('0x11')](function(_0x34a222){var _0x336bab={'method':_0xef78('0x17'),'uri':_0x1da5bc+_0xef78('0x2d'),'headers':{'Authorization':_0xef78('0x19')+_0x34a222,'If-None-Match':null,'OData-Version':_0xef78('0x2e')},'json':!![]};return rp(_0x336bab);})[_0xef78('0x11')](function(_0xae0cd9){var _0x2d3aef=null;if(_0xae0cd9){var _0x4997e0=_0xae0cd9[_0xef78('0x1a')];var _0x66e65=![];for(_0x2d3aef=0x0;_0x2d3aef<_0x4997e0[_0xef78('0x1e')];_0x2d3aef++){var _0xc19ae0=_0x55e40f[_0xef78('0x2f')]()===_0xef78('0x30')?_0x1f4bdd[_0xef78('0x25')]:_0x1f4bdd[_0xef78('0x26')];if(_0x4997e0[_0x2d3aef][_0xef78('0x31')]===_0xc19ae0){_0x66e65=!![];_0x4994a4[_0xef78('0x2c')]=_0x4997e0[_0x2d3aef][_0xef78('0x32')];}}if(_0x66e65){_0x40a395(_0x4994a4);}else{return createEndUser(_0x4994a4,_0x176e2e,_0x5527ac,_0x1da5bc,_0x1f4bdd,_0x55e40f)[_0xef78('0x11')](function(_0x23b471){logger[_0xef78('0x20')]('['+[_0x55e40f[_0xef78('0x15')]()]+_0xef78('0x33'),_0x23b471[_0xef78('0x2c')]);_0x40a395(_0x23b471);});}}else{return createEndUser(_0x4994a4,_0x176e2e,_0x5527ac,_0x1da5bc,_0x1f4bdd,_0x55e40f)['then'](function(_0x536e3f){logger[_0xef78('0x20')]('['+[_0x55e40f[_0xef78('0x15')]()]+_0xef78('0x34'),_0x536e3f['enduserId']);_0x40a395(_0x536e3f);});}});});}function getCustomFields(_0x1cc3fd,_0x103bbc,_0x22e33e){var _0x4c84de={};if(_0x1cc3fd['length']>0x0){_[_0xef78('0x35')](_0x1cc3fd,function(_0x1afcea){if(_0x1afcea['type']==='string'&&_0x1afcea['nameField']&&!_0x1afcea['customField']){var _0xaa9be5=_0x1afcea['idField']['toLowerCase']();var _0xd3ff68=_0xaa9be5['substring'](0x0,_0xaa9be5[_0xef78('0x36')]('_'));var _0x44d15=_0xaa9be5[_0xef78('0x37')](_0xaa9be5[_0xef78('0x36')]('_')+0x1);if(_0xd3ff68===_0x22e33e){_0x4c84de[_0x44d15]=_0x1afcea[_0xef78('0x38')];}}});}return _0x4c84de;}function getTicket(_0x370ae5,_0x484983,_0x2d6f31,_0x133d13,_0x3a93f3,_0x481b37,_0x3ea2b1){return new BPromise(function(_0x5d0ae4,_0x533f4e){var _0x5b9de7;return getAuthToken(_0x484983,_0x2d6f31,_0x3ea2b1)[_0xef78('0x11')](function(_0x13b3c5){if(_0x481b37['ticketType']===_0xef78('0x39')){_0x5b9de7={'method':_0xef78('0xc'),'uri':_0x133d13+_0xef78('0x3a'),'body':Object[_0xef78('0x3b')]({},{'title':intUtil[_0xef78('0x3c')](_0x481b37[_0xef78('0x3d')],_0x3a93f3,'\x20'),'description':intUtil[_0xef78('0x3c')](_0x481b37[_0xef78('0x3e')],_0x3a93f3,'\x0a'),'customerid_contact@odata.bind':_0xef78('0x3f')+_0x370ae5['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x370ae5[_0xef78('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x481b37[_0xef78('0x40')],_0x3a93f3,_0x481b37['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x13b3c5,'OData-Version':_0xef78('0x2e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x481b37[_0xef78('0x41')]===_0xef78('0x42')){_0x5b9de7={'method':_0xef78('0xc'),'uri':_0x133d13+_0xef78('0x43'),'body':Object[_0xef78('0x3b')]({},{'subject':intUtil[_0xef78('0x3c')](_0x481b37[_0xef78('0x3d')],_0x3a93f3,'\x20'),'phonenumber':String(_0x3a93f3[_0xef78('0x26')]),'description':intUtil[_0xef78('0x3c')](_0x481b37[_0xef78('0x3e')],_0x3a93f3,'\x0a'),'regardingobjectid_contact@odata.bind':_0xef78('0x3f')+_0x370ae5[_0xef78('0x2c')]+')','ownerid@odata.bind':_0xef78('0x28')+_0x370ae5['userId']+')','directioncode':_0x370ae5[_0xef78('0x44')]===_0xef78('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xef78('0x28')+_0x370ae5[_0xef78('0x22')]+')','participationtypemask':_0x370ae5['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xef78('0x3f')+_0x370ae5['enduserId']+')','participationtypemask':_0x370ae5[_0xef78('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x481b37[_0xef78('0x40')],_0x3a93f3,_0x481b37[_0xef78('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x13b3c5,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5b9de7);})['then'](function(_0x2c0dff){var _0xa1871a=_0x2c0dff[_0xef78('0x29')][_0xef78('0x2a')];var _0x2cf69d=_0xa1871a[_0xef78('0x37')](_0xa1871a['lastIndexOf']('(')+0x1,_0xa1871a[_0xef78('0x2b')](')'));_0x370ae5[_0xef78('0x46')]=_0x2cf69d;_0x5d0ae4(_0x370ae5);})[_0xef78('0x13')](function(_0x2e1314){_0x533f4e(_0x2e1314[_0xef78('0x47')]);});});}function emit(_0x1a321d,_0x180f81,_0x1a4ceb,_0x1288e1){var _0x31422c={'uri':util[_0xef78('0x48')](_0xef78('0x49'),_0x1a321d,_0x1a4ceb,_0x1288e1)};io['to'](util[_0xef78('0x48')](_0xef78('0x4a'),_0x180f81))[_0xef78('0x4b')](_0xef78('0x4c'),_0x31422c);}exports['cs']=function(_0x207e4f,_0x597e78,_0x33f5c0,_0x131c61,_0x15eba7,_0x237f31,_0x37bb0b,_0x4f74df){var _0x2d70f8={};_0x237f31['remoteUri']=intUtil[_0xef78('0x4d')](_0x237f31['remoteUri']);_0x237f31['serverUrl']=intUtil[_0xef78('0x4d')](_0x237f31['serverUrl']);_0x2d70f8['callDirection']=_0x4f74df==='queue'||_0x4f74df===_0xef78('0x4e')?'queue':_0xef78('0x30');var _0x2da571=util['format']('%s/api/data/v9.0/',_0x237f31['remoteUri']);var _0x1b0e05=util[_0xef78('0x48')]('https://login.microsoftonline.com/%s/oauth2/token',_0x237f31[_0xef78('0x4f')]);var _0x39b69d=util[_0xef78('0x48')](_0xef78('0x50'),_0x237f31['serverUrl'],_0x597e78[_0xef78('0x51')],md5(_0x597e78[_0xef78('0x51')]));if(_0x15eba7&&_0x15eba7['monitor_format']){logger[_0xef78('0x20')](_0xef78('0x52'),_0xef78('0x53'));_0x597e78[_0xef78('0x54')]=_0x39b69d;}else if(_0x37bb0b&&_0x37bb0b[_0xef78('0x55')]&&_0x37bb0b[_0xef78('0x55')]!=='none'){logger[_0xef78('0x20')](_0xef78('0x56'),_0xef78('0x53'));_0x597e78['recordingURL']=_0x39b69d;}else{_0x597e78[_0xef78('0x54')]='';}return getUser(_0x2d70f8,_0x237f31,_0x131c61,_0x1b0e05,_0x2da571,_0x4f74df)[_0xef78('0x11')](function(_0x59baf3){logger[_0xef78('0x20')]('['+_0x4f74df[_0xef78('0x15')]()+_0xef78('0x57'),_0x59baf3[_0xef78('0x22')]);logger[_0xef78('0x20')]('['+_0x4f74df[_0xef78('0x15')]()+_0xef78('0x58'),_0x59baf3[_0xef78('0x1c')]);return getEndUser(_0x59baf3,_0x237f31,_0x1b0e05,_0x2da571,_0x597e78,_0x4f74df);})[_0xef78('0x11')](function(_0x12c3c7){logger[_0xef78('0x20')]('['+_0x4f74df['toUpperCase']()+_0xef78('0x59'),_0x12c3c7[_0xef78('0x2c')]);logger[_0xef78('0x20')]('['+_0x4f74df[_0xef78('0x15')]()+_0xef78('0x5a'),_0x597e78[_0xef78('0x26')]);return getTicket(_0x12c3c7,_0x237f31,_0x1b0e05,_0x2da571,_0x597e78,_0x33f5c0,_0x4f74df);})[_0xef78('0x11')](function(_0x104a8f){logger[_0xef78('0x20')](util['format']('['+_0x4f74df[_0xef78('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x33f5c0[_0xef78('0x41')],_0x104a8f['ticketId']));logger[_0xef78('0x20')](util[_0xef78('0x48')]('['+_0x4f74df[_0xef78('0x15')]()+']\x20Call\x20direction:\x20%s',_0x4f74df));if(_0x4f74df!==_0xef78('0x4e')){logger[_0xef78('0x20')]('['+_0x4f74df['toUpperCase']()+']',_0xef78('0x5b'));emit(_0x237f31['remoteUri'],_0x131c61[_0xef78('0x5c')],_0x33f5c0[_0xef78('0x41')],_0x104a8f[_0xef78('0x46')]);}})[_0xef78('0x13')](function(_0x360fda){logger[_0xef78('0x14')]('['+_0x4f74df['toUpperCase']()+_0xef78('0x5d'),util['inspect'](_0x360fda,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8e19=['userEmail','length','catch','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','telephone1','contactid',']\x20Enduser\x20Created!','type','nameField','customField','idField','substring','indexOf','ticketType','incidents','getString','Descriptions','/contacts(','Fields','phonecalls','assign','Subjects','callDirection','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','remoteUri','stripTrailingSlash','serverUrl','queue','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','POST','username','password','clientSecret','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','internalemailaddress','isdisabled','info','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!'];(function(_0x1c5425,_0x9771df){var _0x501096=function(_0x51396b){while(--_0x51396b){_0x1c5425['push'](_0x1c5425['shift']());}};_0x501096(++_0x9771df);}(_0x8e19,0x9a));var _0x98e1=function(_0x40c26d,_0x54bc4c){_0x40c26d=_0x40c26d-0x0;var _0x4c58d1=_0x8e19[_0x40c26d];return _0x4c58d1;};'use strict';var _=require('lodash');var BPromise=require(_0x98e1('0x0'));var rp=require(_0x98e1('0x1'));var util=require(_0x98e1('0x2'));var intUtil=require(_0x98e1('0x3'));var md5=require('md5');var Redis=require(_0x98e1('0x4'));var logger=require(_0x98e1('0x5'))('dynamics365');var config=require(_0x98e1('0x6'));config[_0x98e1('0x7')]=_['defaults'](config['redis'],{'host':_0x98e1('0x8'),'port':0x18eb});var io=require(_0x98e1('0x9'))(new Redis(config['redis']));function getAuthToken(_0x4ee06a,_0x5e7586,_0x214de5){var _0x4a9a2e={'method':_0x98e1('0xa'),'uri':_0x5e7586,'form':{'client_id':_0x4ee06a['clientId'],'resource':_0x4ee06a['remoteUri'],'username':_0x4ee06a[_0x98e1('0xb')],'password':_0x4ee06a[_0x98e1('0xc')],'grant_type':_0x98e1('0xc'),'client_secret':_0x4ee06a[_0x98e1('0xd')]},'json':!![]};return rp(_0x4a9a2e)['then'](function(_0x1ae416){return _0x1ae416[_0x98e1('0xe')];})['catch'](function(_0x7b632a){logger[_0x98e1('0xf')]('['+[_0x214de5[_0x98e1('0x10')]()]+_0x98e1('0x11'));return _0x7b632a[_0x98e1('0x12')];});}function getUser(_0x94eb5a,_0x3dd937,_0x2a3979,_0x3937ef,_0x4f7622,_0x1b35f0){return new BPromise(function(_0x78f371,_0x15cb10){return getAuthToken(_0x3dd937,_0x3937ef,_0x1b35f0)[_0x98e1('0x13')](function(_0x220405){var _0x22b8a0={'method':_0x98e1('0x14'),'uri':_0x4f7622+_0x98e1('0x15'),'headers':{'Authorization':_0x98e1('0x16')+_0x220405,'OData-Version':_0x98e1('0x17')},'json':!![]};return rp(_0x22b8a0);})[_0x98e1('0x13')](function(_0x207b8c){var _0x7ae529=_0x207b8c[_0x98e1('0x18')];var _0x16461f=![];var _0x2b7667=null;if(!_[_0x98e1('0x19')](_0x2a3979)){if(intUtil[_0x98e1('0x1a')](_0x2a3979[_0x98e1('0x1b')])){_0x94eb5a['userEmail']=_0x2a3979[_0x98e1('0x1b')];for(_0x2b7667=0x0;_0x2b7667<_0x7ae529['length'];_0x2b7667++){if(_0x7ae529[_0x2b7667][_0x98e1('0x1c')]===_0x2a3979[_0x98e1('0x1b')]&&!_0x7ae529[_0x2b7667][_0x98e1('0x1d')]){_0x16461f=!![];logger[_0x98e1('0x1e')]('['+[_0x1b35f0[_0x98e1('0x10')]()]+']\x20Agent\x20found\x20'+_0x7ae529[_0x2b7667]['systemuserid']+'!');_0x94eb5a[_0x98e1('0x1f')]=_0x7ae529[_0x2b7667][_0x98e1('0x20')];}}}}if(!_0x16461f){logger[_0x98e1('0x1e')]('['+[_0x1b35f0[_0x98e1('0x10')]()]+_0x98e1('0x21'));_0x94eb5a[_0x98e1('0x22')]=_0x3dd937[_0x98e1('0xb')];for(_0x2b7667=0x0;_0x2b7667<_0x7ae529[_0x98e1('0x23')];_0x2b7667++){if(_0x7ae529[_0x2b7667][_0x98e1('0x1c')]===_0x3dd937[_0x98e1('0xb')]){_0x94eb5a[_0x98e1('0x1f')]=_0x7ae529[_0x2b7667]['systemuserid'];}}}_0x78f371(_0x94eb5a);})[_0x98e1('0x24')](function(_0x5ab7c9){_0x15cb10(_0x5ab7c9[_0x98e1('0x12')]);});});}function createEndUser(_0xfde237,_0x1bff55,_0x34cc80,_0x225ee0,_0x5b09e6,_0x1cd85d){return new BPromise(function(_0x2f2d59,_0x236210){return getAuthToken(_0x1bff55,_0x34cc80,_0x1cd85d)['then'](function(_0x469af0){var _0x4a1fad=_0x1cd85d[_0x98e1('0x25')]()===_0x98e1('0x26')?_0x5b09e6[_0x98e1('0x27')]:_0x5b09e6[_0x98e1('0x28')];var _0x1bb955={'method':'POST','uri':_0x225ee0+'contacts','body':{'telephone1':_0x4a1fad,'fullname':_0x4a1fad,'firstname':_0x4a1fad,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x98e1('0x29')+_0xfde237['userId']+')'},'headers':{'Authorization':_0x98e1('0x16')+_0x469af0,'OData-Version':_0x98e1('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1bb955);})[_0x98e1('0x13')](function(_0x236b46){var _0x30f9be=_0x236b46[_0x98e1('0x2a')][_0x98e1('0x2b')];var _0x5ef6b1=_0x30f9be['substring'](_0x30f9be[_0x98e1('0x2c')]('(')+0x1,_0x30f9be[_0x98e1('0x2c')](')'));_0xfde237[_0x98e1('0x2d')]=_0x5ef6b1;_0x2f2d59(_0xfde237);})['catch'](function(_0x57e485){_0x236210(_0x57e485[_0x98e1('0x12')]);});});}function getEndUser(_0x3e22be,_0x428291,_0x4fbb56,_0x409bb4,_0x1aa491,_0x4e8f71){return new BPromise(function(_0x270c88,_0x21e21e){return getAuthToken(_0x428291,_0x4fbb56,_0x4e8f71)[_0x98e1('0x13')](function(_0x31493d){var _0x4874b7={'method':_0x98e1('0x14'),'uri':_0x409bb4+'contacts?$select=telephone1','headers':{'Authorization':_0x98e1('0x16')+_0x31493d,'If-None-Match':null,'OData-Version':_0x98e1('0x17')},'json':!![]};return rp(_0x4874b7);})[_0x98e1('0x13')](function(_0x33757e){var _0x2f09ec=null;if(_0x33757e){var _0x41b4bd=_0x33757e[_0x98e1('0x18')];var _0x51a422=![];for(_0x2f09ec=0x0;_0x2f09ec<_0x41b4bd[_0x98e1('0x23')];_0x2f09ec++){var _0x37091a=_0x4e8f71['toLowerCase']()==='outbound'?_0x1aa491[_0x98e1('0x27')]:_0x1aa491[_0x98e1('0x28')];if(_0x41b4bd[_0x2f09ec][_0x98e1('0x2e')]===_0x37091a){_0x51a422=!![];_0x3e22be['enduserId']=_0x41b4bd[_0x2f09ec][_0x98e1('0x2f')];}}if(_0x51a422){_0x270c88(_0x3e22be);}else{return createEndUser(_0x3e22be,_0x428291,_0x4fbb56,_0x409bb4,_0x1aa491,_0x4e8f71)['then'](function(_0x54c848){logger[_0x98e1('0x1e')]('['+[_0x4e8f71[_0x98e1('0x10')]()]+']\x20Enduser\x20created!',_0x54c848[_0x98e1('0x2d')]);_0x270c88(_0x54c848);});}}else{return createEndUser(_0x3e22be,_0x428291,_0x4fbb56,_0x409bb4,_0x1aa491,_0x4e8f71)[_0x98e1('0x13')](function(_0x57eda5){logger[_0x98e1('0x1e')]('['+[_0x4e8f71[_0x98e1('0x10')]()]+_0x98e1('0x30'),_0x57eda5[_0x98e1('0x2d')]);_0x270c88(_0x57eda5);});}});});}function getCustomFields(_0x29c7a3,_0x238da,_0x1d3ff6){var _0x3f796f={};if(_0x29c7a3[_0x98e1('0x23')]>0x0){_['forEach'](_0x29c7a3,function(_0x224d86){if(_0x224d86[_0x98e1('0x31')]==='string'&&_0x224d86[_0x98e1('0x32')]&&!_0x224d86[_0x98e1('0x33')]){var _0x4caea7=_0x224d86[_0x98e1('0x34')]['toLowerCase']();var _0x2530a3=_0x4caea7[_0x98e1('0x35')](0x0,_0x4caea7[_0x98e1('0x36')]('_'));var _0x5c706f=_0x4caea7[_0x98e1('0x35')](_0x4caea7[_0x98e1('0x36')]('_')+0x1);if(_0x2530a3===_0x1d3ff6){_0x3f796f[_0x5c706f]=_0x224d86['content'];}}});}return _0x3f796f;}function getTicket(_0x3734cc,_0x3b4437,_0x3d4099,_0x3af855,_0x29286e,_0xb74e12,_0x19fade){return new BPromise(function(_0x185563,_0x1895cc){var _0x3e817a;return getAuthToken(_0x3b4437,_0x3d4099,_0x19fade)[_0x98e1('0x13')](function(_0x5b6159){if(_0xb74e12[_0x98e1('0x37')]==='incident'){_0x3e817a={'method':_0x98e1('0xa'),'uri':_0x3af855+_0x98e1('0x38'),'body':Object['assign']({},{'title':intUtil['getString'](_0xb74e12['Subjects'],_0x29286e,'\x20'),'description':intUtil[_0x98e1('0x39')](_0xb74e12[_0x98e1('0x3a')],_0x29286e,'\x0a'),'customerid_contact@odata.bind':_0x98e1('0x3b')+_0x3734cc[_0x98e1('0x2d')]+')','ownerid@odata.bind':'/systemusers('+_0x3734cc[_0x98e1('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0xb74e12[_0x98e1('0x3c')],_0x29286e,_0xb74e12[_0x98e1('0x37')])),'headers':{'Authorization':_0x98e1('0x16')+_0x5b6159,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xb74e12['ticketType']==='phonecall'){_0x3e817a={'method':'POST','uri':_0x3af855+_0x98e1('0x3d'),'body':Object[_0x98e1('0x3e')]({},{'subject':intUtil['getString'](_0xb74e12[_0x98e1('0x3f')],_0x29286e,'\x20'),'phonenumber':String(_0x29286e[_0x98e1('0x28')]),'description':intUtil[_0x98e1('0x39')](_0xb74e12[_0x98e1('0x3a')],_0x29286e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x98e1('0x3b')+_0x3734cc['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x3734cc[_0x98e1('0x1f')]+')','directioncode':_0x3734cc[_0x98e1('0x40')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x98e1('0x29')+_0x3734cc[_0x98e1('0x1f')]+')','participationtypemask':_0x3734cc[_0x98e1('0x40')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x98e1('0x3b')+_0x3734cc[_0x98e1('0x2d')]+')','participationtypemask':_0x3734cc[_0x98e1('0x40')]==='queue'?0x1:0x2}]},getCustomFields(_0xb74e12[_0x98e1('0x3c')],_0x29286e,_0xb74e12[_0x98e1('0x37')])),'headers':{'Authorization':_0x98e1('0x16')+_0x5b6159,'OData-Version':_0x98e1('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3e817a);})[_0x98e1('0x13')](function(_0x4973d9){var _0x5cf607=_0x4973d9[_0x98e1('0x2a')]['odata-entityid'];var _0x11364b=_0x5cf607[_0x98e1('0x35')](_0x5cf607['lastIndexOf']('(')+0x1,_0x5cf607[_0x98e1('0x2c')](')'));_0x3734cc[_0x98e1('0x41')]=_0x11364b;_0x185563(_0x3734cc);})['catch'](function(_0x887450){_0x1895cc(_0x887450[_0x98e1('0x12')]);});});}function emit(_0x4f41d1,_0x244898,_0x4b3731,_0x5c57a9){var _0x4efefa={'uri':util['format'](_0x98e1('0x42'),_0x4f41d1,_0x4b3731,_0x5c57a9)};io['to'](util[_0x98e1('0x43')](_0x98e1('0x44'),_0x244898))[_0x98e1('0x45')]('trigger:browser:url',_0x4efefa);}exports['cs']=function(_0x4451ca,_0x8f7c3d,_0x86e867,_0x2cfc70,_0x2dd58b,_0x5c54c7,_0x504ee2,_0x48da1e){var _0x6ac401={};_0x5c54c7[_0x98e1('0x46')]=intUtil[_0x98e1('0x47')](_0x5c54c7[_0x98e1('0x46')]);_0x5c54c7['serverUrl']=intUtil[_0x98e1('0x47')](_0x5c54c7[_0x98e1('0x48')]);_0x6ac401[_0x98e1('0x40')]=_0x48da1e===_0x98e1('0x49')||_0x48da1e===_0x98e1('0x4a')?_0x98e1('0x49'):_0x98e1('0x26');var _0x84510=util[_0x98e1('0x43')](_0x98e1('0x4b'),_0x5c54c7[_0x98e1('0x46')]);var _0x2d2dca=util[_0x98e1('0x43')](_0x98e1('0x4c'),_0x5c54c7[_0x98e1('0x4d')]);var _0x583764=util[_0x98e1('0x43')](_0x98e1('0x4e'),_0x5c54c7['serverUrl'],_0x8f7c3d[_0x98e1('0x4f')],md5(_0x8f7c3d[_0x98e1('0x4f')]));if(_0x2dd58b&&_0x2dd58b[_0x98e1('0x50')]){logger[_0x98e1('0x1e')](_0x98e1('0x51'),_0x98e1('0x52'));_0x8f7c3d[_0x98e1('0x53')]=_0x583764;}else if(_0x504ee2&&_0x504ee2[_0x98e1('0x54')]&&_0x504ee2[_0x98e1('0x54')]!==_0x98e1('0x55')){logger['info']('[OUTBOUND]',_0x98e1('0x52'));_0x8f7c3d[_0x98e1('0x53')]=_0x583764;}else{_0x8f7c3d['recordingURL']='';}return getUser(_0x6ac401,_0x5c54c7,_0x2cfc70,_0x2d2dca,_0x84510,_0x48da1e)[_0x98e1('0x13')](function(_0x5253fa){logger['info']('['+_0x48da1e['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x5253fa[_0x98e1('0x1f')]);logger['info']('['+_0x48da1e['toUpperCase']()+_0x98e1('0x56'),_0x5253fa[_0x98e1('0x22')]);return getEndUser(_0x5253fa,_0x5c54c7,_0x2d2dca,_0x84510,_0x8f7c3d,_0x48da1e);})[_0x98e1('0x13')](function(_0x5f16f){logger[_0x98e1('0x1e')]('['+_0x48da1e[_0x98e1('0x10')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x5f16f[_0x98e1('0x2d')]);logger[_0x98e1('0x1e')]('['+_0x48da1e[_0x98e1('0x10')]()+_0x98e1('0x57'),_0x8f7c3d[_0x98e1('0x28')]);return getTicket(_0x5f16f,_0x5c54c7,_0x2d2dca,_0x84510,_0x8f7c3d,_0x86e867,_0x48da1e);})['then'](function(_0x3923a4){logger[_0x98e1('0x1e')](util[_0x98e1('0x43')]('['+_0x48da1e[_0x98e1('0x10')]()+_0x98e1('0x58'),_0x86e867[_0x98e1('0x37')],_0x3923a4['ticketId']));logger[_0x98e1('0x1e')](util['format']('['+_0x48da1e[_0x98e1('0x10')]()+_0x98e1('0x59'),_0x48da1e));if(_0x48da1e!==_0x98e1('0x4a')){logger[_0x98e1('0x1e')]('['+_0x48da1e[_0x98e1('0x10')]()+']',_0x98e1('0x5a'));emit(_0x5c54c7[_0x98e1('0x46')],_0x2cfc70[_0x98e1('0x5b')],_0x86e867[_0x98e1('0x37')],_0x3923a4[_0x98e1('0x41')]);}})[_0x98e1('0x24')](function(_0xc1d0d3){logger[_0x98e1('0xf')]('['+_0x48da1e[_0x98e1('0x10')]()+_0x98e1('0x5c'),util[_0x98e1('0x5d')](_0xc1d0d3,{'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 9a7a35c..63c4413 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 _0xbdfb=['defaults','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','POST','then','validateEmail','format','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','type','string','customField','nameField','toLowerCase','content','idField','push','variable','customVariable','Variable','name','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk'];(function(_0x2fb447,_0x66b6ce){var _0x30d5a1=function(_0x1dbfcf){while(--_0x1dbfcf){_0x2fb447['push'](_0x2fb447['shift']());}};_0x30d5a1(++_0x66b6ce);}(_0xbdfb,0x10e));var _0xbbdf=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0xbdfb[_0x53f0db];return _0xae0a5c;};'use strict';var _=require(_0xbbdf('0x0'));var rp=require(_0xbbdf('0x1'));var md5=require(_0xbbdf('0x2'));var util=require(_0xbbdf('0x3'));var Redis=require(_0xbbdf('0x4'));var intUtil=require(_0xbbdf('0x5'));var config=require(_0xbbdf('0x6'));var logger=require(_0xbbdf('0x7'))(_0xbbdf('0x8'));config['redis']=_[_0xbbdf('0x9')](config[_0xbbdf('0xa')],{'host':_0xbbdf('0xb'),'port':0x18eb});var io=require(_0xbbdf('0xc'))(new Redis(config['redis']));var headers={'Content-Type':_0xbbdf('0xd'),'Accept':'application/json'};function emit(_0xd2c00a,_0x133236,_0x477702){io['to'](_0xd2c00a)[_0xbbdf('0xe')](_0x133236,_0x477702);}function getTicket(_0x30f7e5,_0x53f522,_0x2772cf,_0xe8c84d,_0x8c967d){logger[_0xbbdf('0xf')](_0xbbdf('0x10'));var _0x59a2e1=_[_0xbbdf('0x11')]({'responder_id':_0x53f522['id'],'requester_id':_0x2772cf['id'],'name':util['format']('Caller\x20-\x20%s',_0x8c967d[_0xbbdf('0x12')]),'phone':_0x8c967d[_0xbbdf('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0xe8c84d[_0xbbdf('0x14')],_0x8c967d,'\x20'),'description':intUtil['getString'](_0xe8c84d[_0xbbdf('0x15')],_0x8c967d,_0xbbdf('0x16')),'tags':getTags(_0xe8c84d[_0xbbdf('0x17')],'name')},getCustomFields(_0xe8c84d[_0xbbdf('0x18')],_0x8c967d));_0x59a2e1[_0xbbdf('0x19')]=_[_0xbbdf('0x1a')](_['keyBy'](_0x59a2e1[_0xbbdf('0x19')],'id'),'value');return request({'uri':util['format'](_0xbbdf('0x1b'),_0x30f7e5[_0xbbdf('0x1c')]),'method':_0xbbdf('0x1d'),'body':_0x59a2e1})[_0xbbdf('0x1e')](function(_0x226751){logger[_0xbbdf('0xf')]('Ticket\x20created!');return _0x226751;});}function getUser(_0xf34dd5,_0x2e34a4){if(intUtil[_0xbbdf('0x1f')](_0x2e34a4)){return request({'uri':util[_0xbbdf('0x20')]('%s/api/v2/agents',_0xf34dd5[_0xbbdf('0x1c')]),'qs':{'email':_0x2e34a4}})[_0xbbdf('0x1e')](function(_0x304d0e){if(_0x304d0e[_0xbbdf('0x21')]){logger['info'](_0xbbdf('0x22'));return _[_0xbbdf('0x23')](_0x304d0e,function(_0x40eae2){return _0x40eae2[_0xbbdf('0x24')][_0xbbdf('0x25')]===_0x2e34a4;});}else{logger[_0xbbdf('0xf')](_0xbbdf('0x26'));return request({'uri':util[_0xbbdf('0x20')](_0xbbdf('0x27'),_0xf34dd5[_0xbbdf('0x1c')])})[_0xbbdf('0x1e')](function(_0x5217f6){logger[_0xbbdf('0xf')](_0xbbdf('0x28'));return _0x5217f6;});}});}else{logger[_0xbbdf('0xf')](_0xbbdf('0x29'));return request({'uri':util[_0xbbdf('0x20')]('%s/api/v2/agents/me',_0xf34dd5[_0xbbdf('0x1c')])})['then'](function(_0x487fb0){logger[_0xbbdf('0xf')](_0xbbdf('0x28'));return _0x487fb0;});}}function getEndUser(_0x5a94fc,_0x1b5a99,_0x5f4cdf){logger['info'](_0xbbdf('0x2a'),_0x5f4cdf);return request({'uri':util[_0xbbdf('0x20')](_0xbbdf('0x2b'),_0x5a94fc[_0xbbdf('0x1c')]),'qs':{'phone':_0x5f4cdf}})[_0xbbdf('0x1e')](function(_0x52f0e3){if(_0x52f0e3[_0xbbdf('0x21')]){logger[_0xbbdf('0xf')](_0xbbdf('0x2c'));return _[_0xbbdf('0x23')](_0x52f0e3,{'phone':_0x5f4cdf});}else{logger['info'](_0xbbdf('0x2d'));return request({'uri':util[_0xbbdf('0x20')](_0xbbdf('0x2b'),_0x5a94fc[_0xbbdf('0x1c')]),'method':_0xbbdf('0x1d'),'body':{'name':_0x1b5a99,'phone':_0x5f4cdf}})['then'](function(_0x597f2a){logger[_0xbbdf('0xf')](_0xbbdf('0x2e'));return _0x597f2a;});}});}function getAuth(_0x44db6f){return util[_0xbbdf('0x20')](_0xbbdf('0x2f'),new Buffer(_0x44db6f[_0xbbdf('0x30')]+':X')[_0xbbdf('0x31')](_0xbbdf('0x32')));}function request(_0x32252b){logger[_0xbbdf('0x33')](_0xbbdf('0x34'),JSON[_0xbbdf('0x35')](_0x32252b));return rp(_[_0xbbdf('0x9')](_0x32252b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x79863e,_0x12046d){var _0x4ba508=[];if(_0x79863e&&_0x79863e['length']>0x0){_0x4ba508=_['map'](_0x79863e,_0x12046d);}return _0x4ba508;}function getCustomFields(_0x144632,_0x49c288){var _0x52ca35=[];var _0x3c3b06={'custom_fields':[]};if(_0x144632[_0xbbdf('0x21')]>0x0){_[_0xbbdf('0x36')](_0x144632,function(_0xcdea87){if(_0xcdea87[_0xbbdf('0x37')]===_0xbbdf('0x38')&&_0xcdea87['nameField']&&!_0xcdea87[_0xbbdf('0x39')]){_0x3c3b06[_0xcdea87[_0xbbdf('0x3a')][_0xbbdf('0x3b')]()]=_0xcdea87[_0xbbdf('0x3c')][_0xbbdf('0x31')]();}else if(_0xcdea87[_0xbbdf('0x37')]===_0xbbdf('0x38')&&_0xcdea87[_0xbbdf('0x3d')]&&_0xcdea87[_0xbbdf('0x39')]){_0x3c3b06[_0xbbdf('0x19')][_0xbbdf('0x3e')]({'id':_0xcdea87[_0xbbdf('0x3d')],'value':_0xcdea87[_0xbbdf('0x3c')][_0xbbdf('0x31')]()});}else if(_0xcdea87[_0xbbdf('0x37')]===_0xbbdf('0x3f')&&_0xcdea87['variableName']&&_0xcdea87['idField']&&_0xcdea87[_0xbbdf('0x39')]){_0x49c288[_0xcdea87['variableName']]&&_0x3c3b06[_0xbbdf('0x19')]['push']({'id':_0xcdea87[_0xbbdf('0x3d')],'value':_0x49c288[_0xcdea87['variableName']][_0xbbdf('0x31')]()});}else if(_0xcdea87['type']===_0xbbdf('0x40')&&_0xcdea87[_0xbbdf('0x41')]&&_0xcdea87[_0xbbdf('0x41')]['name']&&_0xcdea87['idField']&&_0xcdea87[_0xbbdf('0x39')]){_0x49c288[_0xcdea87[_0xbbdf('0x41')][_0xbbdf('0x42')][_0xbbdf('0x3b')]()]&&_0x3c3b06[_0xbbdf('0x19')][_0xbbdf('0x3e')]({'id':_0xcdea87['idField'],'value':_0x49c288[_0xcdea87['Variable'][_0xbbdf('0x42')][_0xbbdf('0x3b')]()][_0xbbdf('0x31')]()});}});}return _0x3c3b06;}exports['queue']=function(_0x40bbf2,_0xe23092,_0x389a15,_0x5c2790,_0x565a57,_0x3bc557){var _0x2dccd2,_0x45c878;_0x3bc557[_0xbbdf('0x1c')]=intUtil['stripTrailingSlash'](_0x3bc557['remoteUri']);_0x3bc557[_0xbbdf('0x43')]=intUtil[_0xbbdf('0x44')](_0x3bc557['serverUrl']);if(_0x565a57&&_0x565a57[_0xbbdf('0x45')]){logger[_0xbbdf('0xf')]('[QUEUE]',_0xbbdf('0x46'));_0xe23092[_0xbbdf('0x47')]=util[_0xbbdf('0x20')](_0xbbdf('0x48'),_0x3bc557[_0xbbdf('0x43')],_0xe23092[_0xbbdf('0x49')],md5(_0xe23092['uniqueid']));}else{_0xe23092[_0xbbdf('0x47')]='';}headers[_0xbbdf('0x4a')]=getAuth(_0x3bc557);return getUser(_0x3bc557,_0x5c2790[_0xbbdf('0x25')])['then'](function(_0x1c532c){_0x2dccd2=_0x1c532c;logger['info'](_0xbbdf('0x4b'),_0x2dccd2['id']);return getEndUser(_0x3bc557,_0xe23092[_0xbbdf('0x12')],_0xe23092['calleridnum']);})[_0xbbdf('0x1e')](function(_0xc1af83){_0x45c878=_0xc1af83;logger[_0xbbdf('0xf')]('The\x20Enduser\x20ID\x20is:',_0x45c878['id']);return getTicket(_0x3bc557,_0x2dccd2,_0x45c878,_0x389a15,_0xe23092);})[_0xbbdf('0x1e')](function(_0x4a0031){if(_0x4a0031&&_0x4a0031['id']){logger[_0xbbdf('0xf')](_0xbbdf('0x4c'));logger[_0xbbdf('0xf')](_0xbbdf('0x4d'),_0x4a0031['id']);logger[_0xbbdf('0xf')](_0xbbdf('0x4e'),_0xbbdf('0x4f'));emit(util['format'](_0xbbdf('0x50'),_0x5c2790[_0xbbdf('0x42')]),_0xbbdf('0x51'),{'uri':util[_0xbbdf('0x20')](_0xbbdf('0x52'),_0x3bc557[_0xbbdf('0x1c')],_0x4a0031['id'])});}})[_0xbbdf('0x53')](function(_0x199fa5){logger[_0xbbdf('0x54')](_0xbbdf('0x4e'),JSON[_0xbbdf('0x35')](_0x199fa5));});};exports['outbound']=function(_0x49f57b,_0x4c302e,_0x2983b5,_0x401730,_0x4a306c,_0x4652bc,_0x4aea81){var _0x11e010,_0x26eb77;_0x4652bc[_0xbbdf('0x1c')]=intUtil[_0xbbdf('0x44')](_0x4652bc['remoteUri']);_0x4652bc['serverUrl']=intUtil[_0xbbdf('0x44')](_0x4652bc['serverUrl']);if(_0x4aea81&&_0x4aea81[_0xbbdf('0x55')]&&_0x4aea81[_0xbbdf('0x55')]!==_0xbbdf('0x56')){logger[_0xbbdf('0xf')]('[OUTBOUND]',_0xbbdf('0x46'));_0x4c302e['recordingURL']=util['format'](_0xbbdf('0x48'),_0x4652bc['serverUrl'],_0x4c302e[_0xbbdf('0x49')],md5(_0x4c302e[_0xbbdf('0x49')]));}headers[_0xbbdf('0x4a')]=getAuth(_0x4652bc);return getUser(_0x4652bc,_0x401730['email'])[_0xbbdf('0x1e')](function(_0x56629a){_0x11e010=_0x56629a;logger['info'](_0xbbdf('0x4b'),_0x11e010['id']);return getEndUser(_0x4652bc,_0x4c302e[_0xbbdf('0x57')],_0x4c302e[_0xbbdf('0x58')]);})['then'](function(_0x26e45d){_0x26eb77=_0x26e45d;logger[_0xbbdf('0xf')](_0xbbdf('0x59'),_0x26eb77['id']);return getTicket(_0x4652bc,_0x11e010,_0x26eb77,_0x2983b5,_0x4c302e);})[_0xbbdf('0x1e')](function(_0x4aa785){if(_0x4aa785&&_0x4aa785['id']){logger[_0xbbdf('0xf')]('Ticket\x20created!');logger[_0xbbdf('0xf')](_0xbbdf('0x4d'),_0x4aa785['id']);logger[_0xbbdf('0xf')](_0xbbdf('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbbdf('0x20')]('user:%s',_0x401730[_0xbbdf('0x42')]),_0xbbdf('0x51'),{'uri':util[_0xbbdf('0x20')]('%s/helpdesk/tickets/%d',_0x4652bc[_0xbbdf('0x1c')],_0x4aa785['id'])});}})[_0xbbdf('0x53')](function(_0x3bb0cb){logger[_0xbbdf('0x54')]('[OUTBOUND]',JSON[_0xbbdf('0x35')](_0x3bb0cb));});};exports[_0xbbdf('0x5b')]=function(_0x1c3518,_0x5038ba,_0xa01d3,_0x556be3,_0x166f18,_0xc4f312){var _0x2e5b32,_0x10c8d2;_0xc4f312[_0xbbdf('0x1c')]=intUtil[_0xbbdf('0x44')](_0xc4f312[_0xbbdf('0x1c')]);_0xc4f312[_0xbbdf('0x43')]=intUtil[_0xbbdf('0x44')](_0xc4f312['serverUrl']);if(_0x166f18&&_0x166f18['monitor_format']){logger[_0xbbdf('0xf')]('['+_0x5038ba['lastevent'][_0xbbdf('0x5c')]()+']',_0xbbdf('0x46'));_0x5038ba[_0xbbdf('0x47')]=util[_0xbbdf('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc4f312[_0xbbdf('0x43')],_0x5038ba[_0xbbdf('0x49')],md5(_0x5038ba[_0xbbdf('0x49')]));}else{_0x5038ba[_0xbbdf('0x47')]='';}headers['Authorization']=getAuth(_0xc4f312);return getUser(_0xc4f312,'')[_0xbbdf('0x1e')](function(_0x5ec97f){_0x2e5b32=_0x5ec97f;logger[_0xbbdf('0xf')](_0xbbdf('0x4b'),_0x2e5b32['id']);return getEndUser(_0xc4f312,_0x5038ba['calleridname'],_0x5038ba['calleridnum']);})[_0xbbdf('0x1e')](function(_0x4b76f8){_0x10c8d2=_0x4b76f8;logger[_0xbbdf('0xf')]('The\x20Enduser\x20ID\x20is:',_0x10c8d2['id']);return getTicket(_0xc4f312,_0x2e5b32,_0x10c8d2,_0xa01d3,_0x5038ba);})['then'](function(_0x5bb2df){if(_0x5bb2df){logger['info'](_0xbbdf('0x4c'));logger[_0xbbdf('0xf')](_0xbbdf('0x4d'),_0x5bb2df['id']);}})[_0xbbdf('0x53')](function(_0x3678a4){logger[_0xbbdf('0x54')]('['+_0x5038ba['lastevent']['toUpperCase']()+']',JSON[_0xbbdf('0x35')](_0x3678a4));});}; \ No newline at end of file +var _0x53b1=['application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','getString','Subjects','Descriptions','Tags','name','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','[QUEUE]','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter'];(function(_0x2518ca,_0x4fd780){var _0x32257d=function(_0x40988f){while(--_0x40988f){_0x2518ca['push'](_0x2518ca['shift']());}};_0x32257d(++_0x4fd780);}(_0x53b1,0x110));var _0x153b=function(_0x6b246,_0x550aaa){_0x6b246=_0x6b246-0x0;var _0x329992=_0x53b1[_0x6b246];return _0x329992;};'use strict';var _=require(_0x153b('0x0'));var rp=require(_0x153b('0x1'));var md5=require(_0x153b('0x2'));var util=require('util');var Redis=require(_0x153b('0x3'));var intUtil=require('./util');var config=require(_0x153b('0x4'));var logger=require(_0x153b('0x5'))(_0x153b('0x6'));config[_0x153b('0x7')]=_['defaults'](config['redis'],{'host':_0x153b('0x8'),'port':0x18eb});var io=require(_0x153b('0x9'))(new Redis(config[_0x153b('0x7')]));var headers={'Content-Type':_0x153b('0xa'),'Accept':_0x153b('0xa')};function emit(_0x3ba61c,_0x5cc40d,_0x33bdef){io['to'](_0x3ba61c)['emit'](_0x5cc40d,_0x33bdef);}function getTicket(_0x2b6826,_0x1b3d6b,_0x25b768,_0x1eeb0e,_0x31bb3f){logger[_0x153b('0xb')](_0x153b('0xc'));var _0x368574=_[_0x153b('0xd')]({'responder_id':_0x1b3d6b['id'],'requester_id':_0x25b768['id'],'name':util['format'](_0x153b('0xe'),_0x31bb3f['calleridname']),'phone':_0x31bb3f['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x153b('0xf')](_0x1eeb0e[_0x153b('0x10')],_0x31bb3f,'\x20'),'description':intUtil[_0x153b('0xf')](_0x1eeb0e[_0x153b('0x11')],_0x31bb3f,'
'),'tags':getTags(_0x1eeb0e[_0x153b('0x12')],_0x153b('0x13'))},getCustomFields(_0x1eeb0e[_0x153b('0x14')],_0x31bb3f));_0x368574['custom_fields']=_[_0x153b('0x15')](_[_0x153b('0x16')](_0x368574[_0x153b('0x17')],'id'),_0x153b('0x18'));return request({'uri':util[_0x153b('0x19')](_0x153b('0x1a'),_0x2b6826[_0x153b('0x1b')]),'method':_0x153b('0x1c'),'body':_0x368574})['then'](function(_0x4505fd){logger[_0x153b('0xb')](_0x153b('0x1d'));return _0x4505fd;});}function getUser(_0x5b5932,_0x4c0e04){if(intUtil['validateEmail'](_0x4c0e04)){return request({'uri':util[_0x153b('0x19')](_0x153b('0x1e'),_0x5b5932['remoteUri']),'qs':{'email':_0x4c0e04}})[_0x153b('0x1f')](function(_0x4e922d){if(_0x4e922d[_0x153b('0x20')]){logger['info'](_0x153b('0x21'));return _[_0x153b('0x22')](_0x4e922d,function(_0x1332c8){return _0x1332c8[_0x153b('0x23')]['email']===_0x4c0e04;});}else{logger[_0x153b('0xb')](_0x153b('0x24'));return request({'uri':util[_0x153b('0x19')](_0x153b('0x25'),_0x5b5932[_0x153b('0x1b')])})[_0x153b('0x1f')](function(_0x308e9a){logger[_0x153b('0xb')]('Admin\x20account\x20selected.');return _0x308e9a;});}});}else{logger[_0x153b('0xb')](_0x153b('0x26'));return request({'uri':util[_0x153b('0x19')](_0x153b('0x25'),_0x5b5932['remoteUri'])})[_0x153b('0x1f')](function(_0xa6eb70){logger[_0x153b('0xb')](_0x153b('0x27'));return _0xa6eb70;});}}function getEndUser(_0x4d3df8,_0x5693b2,_0x19ec92){logger[_0x153b('0xb')](_0x153b('0x28'),_0x19ec92);return request({'uri':util[_0x153b('0x19')](_0x153b('0x29'),_0x4d3df8['remoteUri']),'qs':{'phone':_0x19ec92}})['then'](function(_0xb64fb3){if(_0xb64fb3[_0x153b('0x20')]){logger['info'](_0x153b('0x2a'));return _['find'](_0xb64fb3,{'phone':_0x19ec92});}else{logger['info'](_0x153b('0x2b'));return request({'uri':util[_0x153b('0x19')](_0x153b('0x29'),_0x4d3df8[_0x153b('0x1b')]),'method':'POST','body':{'name':_0x5693b2,'phone':_0x19ec92}})[_0x153b('0x1f')](function(_0x2cc17b){logger['info'](_0x153b('0x2c'));return _0x2cc17b;});}});}function getAuth(_0x1ba6fa){return util[_0x153b('0x19')](_0x153b('0x2d'),new Buffer(_0x1ba6fa[_0x153b('0x2e')]+':X')[_0x153b('0x2f')](_0x153b('0x30')));}function request(_0x1e1ba8){logger[_0x153b('0x31')](_0x153b('0x32'),JSON[_0x153b('0x33')](_0x1e1ba8));return rp(_[_0x153b('0x34')](_0x1e1ba8,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4157eb,_0x4f51a5){var _0x2b83e3=[];if(_0x4157eb&&_0x4157eb[_0x153b('0x20')]>0x0){_0x2b83e3=_[_0x153b('0x35')](_0x4157eb,_0x4f51a5);}return _0x2b83e3;}function getCustomFields(_0x2cc5bc,_0x125722){var _0x27923f=[];var _0x4f0bbe={'custom_fields':[]};if(_0x2cc5bc[_0x153b('0x20')]>0x0){_[_0x153b('0x36')](_0x2cc5bc,function(_0x2af6b3){if(_0x2af6b3[_0x153b('0x37')]===_0x153b('0x38')&&_0x2af6b3[_0x153b('0x39')]&&!_0x2af6b3[_0x153b('0x3a')]){_0x4f0bbe[_0x2af6b3[_0x153b('0x39')][_0x153b('0x3b')]()]=_0x2af6b3[_0x153b('0x3c')][_0x153b('0x2f')]();}else if(_0x2af6b3[_0x153b('0x37')]==='string'&&_0x2af6b3[_0x153b('0x3d')]&&_0x2af6b3[_0x153b('0x3a')]){_0x4f0bbe['custom_fields'][_0x153b('0x3e')]({'id':_0x2af6b3[_0x153b('0x3d')],'value':_0x2af6b3['content']['toString']()});}else if(_0x2af6b3[_0x153b('0x37')]===_0x153b('0x3f')&&_0x2af6b3[_0x153b('0x40')]&&_0x2af6b3['idField']&&_0x2af6b3['customField']){_0x125722[_0x2af6b3[_0x153b('0x40')]]&&_0x4f0bbe[_0x153b('0x17')][_0x153b('0x3e')]({'id':_0x2af6b3['idField'],'value':_0x125722[_0x2af6b3['variableName']][_0x153b('0x2f')]()});}else if(_0x2af6b3[_0x153b('0x37')]===_0x153b('0x41')&&_0x2af6b3[_0x153b('0x42')]&&_0x2af6b3[_0x153b('0x42')][_0x153b('0x13')]&&_0x2af6b3[_0x153b('0x3d')]&&_0x2af6b3[_0x153b('0x3a')]){_0x125722[_0x2af6b3[_0x153b('0x42')]['name'][_0x153b('0x3b')]()]&&_0x4f0bbe[_0x153b('0x17')][_0x153b('0x3e')]({'id':_0x2af6b3[_0x153b('0x3d')],'value':_0x125722[_0x2af6b3['Variable'][_0x153b('0x13')][_0x153b('0x3b')]()][_0x153b('0x2f')]()});}});}return _0x4f0bbe;}exports[_0x153b('0x43')]=function(_0x583947,_0x39a2ea,_0x51878b,_0x42c139,_0x23678e,_0x4a3082){var _0x396bc1,_0x482872;_0x4a3082['remoteUri']=intUtil['stripTrailingSlash'](_0x4a3082[_0x153b('0x1b')]);_0x4a3082[_0x153b('0x44')]=intUtil[_0x153b('0x45')](_0x4a3082[_0x153b('0x44')]);if(_0x23678e&&_0x23678e[_0x153b('0x46')]){logger[_0x153b('0xb')]('[QUEUE]',_0x153b('0x47'));_0x39a2ea[_0x153b('0x48')]=util[_0x153b('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a3082['serverUrl'],_0x39a2ea[_0x153b('0x49')],md5(_0x39a2ea['uniqueid']));}else{_0x39a2ea[_0x153b('0x48')]='';}headers[_0x153b('0x4a')]=getAuth(_0x4a3082);return getUser(_0x4a3082,_0x42c139['email'])['then'](function(_0x348ca9){_0x396bc1=_0x348ca9;logger[_0x153b('0xb')](_0x153b('0x4b'),_0x396bc1['id']);return getEndUser(_0x4a3082,_0x39a2ea[_0x153b('0x4c')],_0x39a2ea[_0x153b('0x4d')]);})[_0x153b('0x1f')](function(_0x168008){_0x482872=_0x168008;logger['info']('The\x20Enduser\x20ID\x20is:',_0x482872['id']);return getTicket(_0x4a3082,_0x396bc1,_0x482872,_0x51878b,_0x39a2ea);})[_0x153b('0x1f')](function(_0x69f0c3){if(_0x69f0c3&&_0x69f0c3['id']){logger[_0x153b('0xb')](_0x153b('0x1d'));logger[_0x153b('0xb')](_0x153b('0x4e'),_0x69f0c3['id']);logger['info'](_0x153b('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x153b('0x19')]('user:%s',_0x42c139[_0x153b('0x13')]),_0x153b('0x50'),{'uri':util[_0x153b('0x19')](_0x153b('0x51'),_0x4a3082[_0x153b('0x1b')],_0x69f0c3['id'])});}})['catch'](function(_0x4198f3){logger[_0x153b('0x52')](_0x153b('0x4f'),JSON['stringify'](_0x4198f3));});};exports[_0x153b('0x53')]=function(_0x5cd981,_0x46d9ae,_0x453aa0,_0x227a07,_0x3c0870,_0x26ca0f,_0x11badd){var _0x4fccbb,_0xf1e6ef;_0x26ca0f[_0x153b('0x1b')]=intUtil[_0x153b('0x45')](_0x26ca0f[_0x153b('0x1b')]);_0x26ca0f[_0x153b('0x44')]=intUtil[_0x153b('0x45')](_0x26ca0f[_0x153b('0x44')]);if(_0x11badd&&_0x11badd[_0x153b('0x54')]&&_0x11badd[_0x153b('0x54')]!=='none'){logger[_0x153b('0xb')](_0x153b('0x55'),_0x153b('0x47'));_0x46d9ae[_0x153b('0x48')]=util['format'](_0x153b('0x56'),_0x26ca0f[_0x153b('0x44')],_0x46d9ae[_0x153b('0x49')],md5(_0x46d9ae[_0x153b('0x49')]));}headers[_0x153b('0x4a')]=getAuth(_0x26ca0f);return getUser(_0x26ca0f,_0x227a07['email'])['then'](function(_0x34b61b){_0x4fccbb=_0x34b61b;logger['info'](_0x153b('0x4b'),_0x4fccbb['id']);return getEndUser(_0x26ca0f,_0x46d9ae[_0x153b('0x57')],_0x46d9ae[_0x153b('0x58')]);})[_0x153b('0x1f')](function(_0x2db529){_0xf1e6ef=_0x2db529;logger[_0x153b('0xb')]('The\x20Enduser\x20ID\x20is:',_0xf1e6ef['id']);return getTicket(_0x26ca0f,_0x4fccbb,_0xf1e6ef,_0x453aa0,_0x46d9ae);})['then'](function(_0x2aaae6){if(_0x2aaae6&&_0x2aaae6['id']){logger['info'](_0x153b('0x1d'));logger[_0x153b('0xb')](_0x153b('0x4e'),_0x2aaae6['id']);logger[_0x153b('0xb')](_0x153b('0x55'),_0x153b('0x59'));emit(util[_0x153b('0x19')](_0x153b('0x5a'),_0x227a07[_0x153b('0x13')]),_0x153b('0x50'),{'uri':util[_0x153b('0x19')](_0x153b('0x51'),_0x26ca0f[_0x153b('0x1b')],_0x2aaae6['id'])});}})['catch'](function(_0x19f899){logger[_0x153b('0x52')](_0x153b('0x55'),JSON[_0x153b('0x33')](_0x19f899));});};exports[_0x153b('0x5b')]=function(_0x2b1333,_0x46e45d,_0x2deab7,_0x1773c0,_0x3a946,_0x2ddb2f){var _0xba7263,_0x43e389;_0x2ddb2f[_0x153b('0x1b')]=intUtil[_0x153b('0x45')](_0x2ddb2f[_0x153b('0x1b')]);_0x2ddb2f['serverUrl']=intUtil['stripTrailingSlash'](_0x2ddb2f[_0x153b('0x44')]);if(_0x3a946&&_0x3a946['monitor_format']){logger['info']('['+_0x46e45d[_0x153b('0x5c')][_0x153b('0x5d')]()+']',_0x153b('0x47'));_0x46e45d[_0x153b('0x48')]=util[_0x153b('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ddb2f['serverUrl'],_0x46e45d[_0x153b('0x49')],md5(_0x46e45d[_0x153b('0x49')]));}else{_0x46e45d[_0x153b('0x48')]='';}headers[_0x153b('0x4a')]=getAuth(_0x2ddb2f);return getUser(_0x2ddb2f,'')[_0x153b('0x1f')](function(_0x94d3bc){_0xba7263=_0x94d3bc;logger[_0x153b('0xb')](_0x153b('0x4b'),_0xba7263['id']);return getEndUser(_0x2ddb2f,_0x46e45d['calleridname'],_0x46e45d[_0x153b('0x4d')]);})[_0x153b('0x1f')](function(_0x30d21c){_0x43e389=_0x30d21c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x43e389['id']);return getTicket(_0x2ddb2f,_0xba7263,_0x43e389,_0x2deab7,_0x46e45d);})['then'](function(_0xa8a3d0){if(_0xa8a3d0){logger[_0x153b('0xb')](_0x153b('0x1d'));logger[_0x153b('0xb')](_0x153b('0x4e'),_0xa8a3d0['id']);}})['catch'](function(_0x26ef8c){logger[_0x153b('0x52')]('['+_0x46e45d[_0x153b('0x5c')][_0x153b('0x5d')]()+']',JSON[_0x153b('0x33')](_0x26ef8c));});}; \ 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 768c543..8bd9c07 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 _0x99fc=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','toUpperCase','Getting\x20contacts\x20filter','then','filters','forEach','All\x20Contacts','/api/contacts/view/','Searching\x20contact\x20with\x20phone','find','contacts','work_number','contactNumber','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0xd6c1bc,_0x50b1bf){var _0x83d630=function(_0x4e089b){while(--_0x4e089b){_0xd6c1bc['push'](_0xd6c1bc['shift']());}};_0x83d630(++_0x50b1bf);}(_0x99fc,0xb9));var _0xc99f=function(_0x5df51f,_0x287ebf){_0x5df51f=_0x5df51f-0x0;var _0x267990=_0x99fc[_0x5df51f];return _0x267990;};'use strict';var _=require(_0xc99f('0x0'));var rp=require('request-promise');var md5=require(_0xc99f('0x1'));var util=require(_0xc99f('0x2'));var moment=require('moment');var Promise=require(_0xc99f('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xc99f('0x4'));var logger=require('../../../../config/logger')('freshsales');config[_0xc99f('0x5')]=_[_0xc99f('0x6')](config[_0xc99f('0x5')],{'host':_0xc99f('0x7'),'port':0x18eb});var io=require(_0xc99f('0x8'))(new Redis(config[_0xc99f('0x5')]));function getAdminId(_0x486ca1,_0x427b5a,_0x51cdd8,_0x47327c){return new Promise(function(_0x53b0aa,_0x4c39a9){var _0x378605=![];var _0x239cc3={'method':'GET','uri':_0x47327c+_0xc99f('0x9'),'json':!![]};_0x239cc3[_0xc99f('0xa')]=_0x51cdd8;logger[_0xc99f('0xb')](_0xc99f('0xc'));return rp(_0x239cc3)['then'](function(_0x158955){if(_0x158955){var _0x1ac77b=_0x158955[_0xc99f('0xd')];var _0x2f0572=null;for(_0x2f0572=0x0;_0x2f0572<_0x1ac77b[_0xc99f('0xe')];_0x2f0572++){if(_0x1ac77b[_0x2f0572][_0xc99f('0xf')]===_0x486ca1[_0xc99f('0x10')]){_0x486ca1[_0xc99f('0x11')]=_0x1ac77b[_0x2f0572]['id'];_0x378605=!![];}}if(_0x378605){logger['info'](_0xc99f('0x12'),_0x486ca1[_0xc99f('0x11')]);_0x53b0aa(_0x486ca1);}else{_0x4c39a9({'statusCode':0x194,'message':_0xc99f('0x13')});}}else{_0x4c39a9({'statusCode':0x194,'message':_0xc99f('0x13')});}})[_0xc99f('0x14')](function(_0x58d219){logger[_0xc99f('0x15')]('['+[_0x427b5a['toUpperCase']()]+']',_0x58d219[_0xc99f('0x16')]);_0x4c39a9(_0x58d219);});});}function getUser(_0x2b4877,_0x3cb1a6,_0x511475){return function(_0x261a73){return new Promise(function(_0x20cafe,_0x5a867b){var _0x258931={'method':_0xc99f('0x17'),'uri':_0x511475+'/api/selector/owners','json':!![]};_0x258931[_0xc99f('0xa')]=_0x3cb1a6;logger[_0xc99f('0xb')](_0xc99f('0x18'));return rp(_0x258931)['then'](function(_0x3575ca){if(_0x3575ca){var _0x19e3a1=_0x3575ca[_0xc99f('0xd')];var _0x436d08=![];var _0x5330fb=null;if(_0x261a73[_0xc99f('0x19')]!==null){logger[_0xc99f('0xb')](_0xc99f('0x1a'),_0x261a73[_0xc99f('0x19')]);_0x261a73[_0xc99f('0x1b')]=_0x261a73[_0xc99f('0x19')];for(_0x5330fb=0x0;_0x5330fb<_0x19e3a1[_0xc99f('0xe')];_0x5330fb++){if(_0x19e3a1[_0x5330fb][_0xc99f('0xf')]===_0x261a73[_0xc99f('0x19')]){_0x436d08=!![];_0x261a73['userId']=_0x19e3a1[_0x5330fb]['id'];logger[_0xc99f('0xb')](_0xc99f('0x1c'),_0x261a73[_0xc99f('0x1d')]);}}}if(!_0x436d08){logger[_0xc99f('0xb')](_0xc99f('0x1e'));_0x261a73[_0xc99f('0x1b')]=_0x261a73['adminEmail'];_0x261a73[_0xc99f('0x1d')]=_0x261a73[_0xc99f('0x11')];_0x436d08=!![];}if(_0x436d08){_0x20cafe(_0x261a73);}else{_0x5a867b({'statusCode':0x194,'message':_0xc99f('0x13')});}}else{_0x5a867b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc99f('0x14')](function(_0x3d7baa){logger[_0xc99f('0x15')]('['+[_0x2b4877[_0xc99f('0x1f')]()]+']',_0x3d7baa[_0xc99f('0x16')]);_0x5a867b(_0x3d7baa);});});};}function getEndUser(_0x4bbca7,_0x3d5035,_0x12b731){return function(_0x152edb){return new Promise(function(_0x4b1d15,_0x6b91c3){var _0x48918e=0x0;var _0x268bea={'method':'GET','uri':_0x12b731+'/api/contacts/filters','json':!![]};_0x268bea[_0xc99f('0xa')]=_0x3d5035;logger[_0xc99f('0xb')](_0xc99f('0x20'));return rp(_0x268bea)[_0xc99f('0x21')](function(_0x5c9f29){_0x5c9f29[_0xc99f('0x22')][_0xc99f('0x23')](function(_0x2bbdb6){if(_0x2bbdb6['name']===_0xc99f('0x24')){_0x48918e=_0x2bbdb6['id'];}});})[_0xc99f('0x21')](function(){logger[_0xc99f('0xb')]('Getting\x20contact\x20list');var _0x3bac75={'method':_0xc99f('0x17'),'uri':_0x12b731+_0xc99f('0x25')+_0x48918e,'json':!![]};_0x3bac75[_0xc99f('0xa')]=_0x3d5035;return rp(_0x3bac75);})[_0xc99f('0x21')](function(_0x23afa0){logger[_0xc99f('0xb')](_0xc99f('0x26'),_0x152edb['contactNumber']);if(_0x23afa0['contacts'][_0xc99f('0xe')]>0x0){var _0x4de1f8=_[_0xc99f('0x27')](_0x23afa0[_0xc99f('0x28')],function(_0x373289){if(_0x373289[_0xc99f('0x29')]===_0x152edb[_0xc99f('0x2a')]||_0x373289[_0xc99f('0x2b')]===_0x152edb[_0xc99f('0x2a')]){return _0x373289;}});if(_0x4de1f8){_0x152edb[_0xc99f('0x2c')]=_0x4de1f8['id'];logger[_0xc99f('0xb')](_0xc99f('0x2d'),_0x152edb[_0xc99f('0x2c')]);_0x4b1d15(_0x152edb);}else{return createEndUser(_0x152edb,_0x4bbca7,_0x3d5035,_0x12b731)['then'](function(_0x45e460){logger[_0xc99f('0xb')](_0xc99f('0x2e'),_0x152edb[_0xc99f('0x2c')]);_0x4b1d15(_0x45e460);});}}else{return createEndUser(_0x152edb,_0x4bbca7,_0x3d5035,_0x12b731)[_0xc99f('0x21')](function(_0x3a9d8a){logger[_0xc99f('0xb')](_0xc99f('0x2e'),_0x152edb[_0xc99f('0x2c')]);_0x4b1d15(_0x3a9d8a);});}})[_0xc99f('0x14')](function(_0xce7cf6){throw new Error(_0xce7cf6['message']);});});};}function createEndUser(_0x325fb3,_0xedd14a,_0x5dd154,_0x1d45e1){return new Promise(function(_0x5f1c7d,_0x466100){var _0x522b1e=moment();var _0x2c75ec={'method':'POST','uri':_0x1d45e1+_0xc99f('0x2f'),'body':{'contact':{'last_name':_0x325fb3[_0xc99f('0x2a')],'work_number':_0x325fb3[_0xc99f('0x2a')],'mobile_number':_0x325fb3['contactNumber'],'owner_id':_0x325fb3[_0xc99f('0x1d')],'created_at':_0x522b1e[_0xc99f('0x30')](_0xc99f('0x31'))}},'json':!![]};_0x2c75ec['headers']=_0x5dd154;logger[_0xc99f('0xb')](_0xc99f('0x32'));return rp(_0x2c75ec)[_0xc99f('0x21')](function(_0x348ded){_0x325fb3['endUserId']=_0x348ded[_0xc99f('0x33')]['id'];_0x5f1c7d(_0x325fb3);})[_0xc99f('0x14')](function(_0x37b6c6){logger[_0xc99f('0x15')]('['+[_0xedd14a['toUpperCase']()]+']',_0x37b6c6[_0xc99f('0x16')]);_0x466100(_0x37b6c6[_0xc99f('0x16')]);});});}function getTicket(_0x377ad0,_0x5afcf8,_0x3ca9ca,_0x288bd8,_0x369b83){return function(_0x116f8a){logger['info'](_0xc99f('0x34'));return new Promise(function(_0x6c8133,_0x4d24fd){var _0x16ec79=moment();var _0xcb56c5={'method':_0xc99f('0x35'),'uri':_0x3ca9ca+_0xc99f('0x36'),'body':{'title':intUtil['getString'](_0x288bd8[_0xc99f('0x37')],_0x369b83,'\x20'),'description':intUtil[_0xc99f('0x38')](_0x288bd8[_0xc99f('0x39')],_0x369b83,'\x0a'),'owner_id':_0x116f8a[_0xc99f('0x1d')],'creater_id':_0x116f8a['adminId'],'targetable_id':_0x116f8a[_0xc99f('0x2c')],'targetable_type':_0xc99f('0x3a'),'created_at':_0x16ec79[_0xc99f('0x30')](_0xc99f('0x31')),'due_date':_0x16ec79['add'](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0xcb56c5[_0xc99f('0xa')]=_0x5afcf8;return rp(_0xcb56c5)[_0xc99f('0x21')](function(_0x22d9f9){_0x116f8a[_0xc99f('0x3b')]=_0x22d9f9[_0xc99f('0x3c')]['id'];logger[_0xc99f('0xb')](_0xc99f('0x3d'),_0x116f8a[_0xc99f('0x3b')]);_0x6c8133(_0x116f8a);})['catch'](function(_0x4078f5){logger[_0xc99f('0x15')]('['+[_0x377ad0['toUpperCase']()]+']',_0x4078f5[_0xc99f('0x16')]);_0x4d24fd(_0x4078f5['message']);});});};}function emit(_0x17f98a,_0x5d40fe,_0x3ebee7){var _0x32b77d={'uri':_0x17f98a+'/contacts/'+_0x3ebee7};io['to'](util[_0xc99f('0x30')](_0xc99f('0x3e'),_0x5d40fe))['emit'](_0xc99f('0x3f'),_0x32b77d);}exports['cs']=function(_0xde992c,_0x2a1e3d,_0xa5866a,_0x198af9,_0x3fa288,_0x5ae7f4,_0x1931ba,_0x2f949b){var _0x429c37={};var _0x5c25a1={'Authorization':_0xc99f('0x40')+_0x5ae7f4['apiKey']};_0x5ae7f4[_0xc99f('0x41')]=intUtil[_0xc99f('0x42')](_0x5ae7f4[_0xc99f('0x41')]);_0x5ae7f4[_0xc99f('0x43')]=intUtil[_0xc99f('0x42')](_0x5ae7f4[_0xc99f('0x43')]);var _0x241a9e=_0x5ae7f4[_0xc99f('0x41')];_0x429c37[_0xc99f('0x10')]=_0x5ae7f4['username'];_0x429c37[_0xc99f('0x2a')]=_0x2f949b[_0xc99f('0x44')]()===_0xc99f('0x45')?_0x2a1e3d[_0xc99f('0x46')]:_0x2a1e3d[_0xc99f('0x47')];_0x429c37['callDirection']=_0x2f949b===_0xc99f('0x48')||_0x2f949b===_0xc99f('0x49')?'queue':'outbound';if(_0x198af9){_0x429c37[_0xc99f('0x19')]=_0x198af9['email'];}var _0x2404b1=util['format'](_0xc99f('0x4a'),_0x5ae7f4['serverUrl'],_0x2a1e3d[_0xc99f('0x4b')],md5(_0x2a1e3d[_0xc99f('0x4b')]));if(_0x3fa288&&_0x3fa288[_0xc99f('0x4c')]){logger[_0xc99f('0xb')](_0xc99f('0x4d'),_0xc99f('0x4e'));_0x2a1e3d['recordingURL']=_0x2404b1;}else if(_0x1931ba&&_0x1931ba['recordingFormat']&&_0x1931ba[_0xc99f('0x4f')]!==_0xc99f('0x50')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2a1e3d[_0xc99f('0x51')]=_0x2404b1;}else{_0x2a1e3d[_0xc99f('0x51')]='';}return getAdminId(_0x429c37,_0x2f949b,_0x5c25a1,_0x241a9e)[_0xc99f('0x21')](getUser(_0x2f949b,_0x5c25a1,_0x241a9e))['then'](getEndUser(_0x2f949b,_0x5c25a1,_0x241a9e))[_0xc99f('0x21')](getTicket(_0x2f949b,_0x5c25a1,_0x241a9e,_0xa5866a,_0x2a1e3d))['then'](function(_0x1c5f90){logger['info'](util[_0xc99f('0x30')](_0xc99f('0x52'),_0x1c5f90[_0xc99f('0x3b')]));if(_0x2f949b!==_0xc99f('0x49')){logger[_0xc99f('0xb')]('['+[_0x2f949b['toUpperCase']()]+']',_0xc99f('0x53'));emit(_0x241a9e,_0x198af9[_0xc99f('0x54')],_0x1c5f90[_0xc99f('0x2c')]);}})[_0xc99f('0x14')](function(_0x10983f){logger[_0xc99f('0x15')]('['+[_0x2f949b[_0xc99f('0x1f')]()]+_0xc99f('0x55'),util[_0xc99f('0x56')](_0x10983f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb58d=['Displaying\x20task\x20in\x20a\x20new\x20tab...','lodash','request-promise','md5','bluebird','./util','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','forEach','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','work_number','contactNumber','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','catch','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Subjects','getString','add','ticketId','task','Task\x20created:','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged'];(function(_0x5c080c,_0x31a668){var _0x211fd5=function(_0x5b6bcb){while(--_0x5b6bcb){_0x5c080c['push'](_0x5c080c['shift']());}};_0x211fd5(++_0x31a668);}(_0xb58d,0x141));var _0xdb58=function(_0x426ebd,_0x416f59){_0x426ebd=_0x426ebd-0x0;var _0x47f415=_0xb58d[_0x426ebd];return _0x47f415;};'use strict';var _=require(_0xdb58('0x0'));var rp=require(_0xdb58('0x1'));var md5=require(_0xdb58('0x2'));var util=require('util');var moment=require('moment');var Promise=require(_0xdb58('0x3'));var Redis=require('ioredis');var intUtil=require(_0xdb58('0x4'));var config=require('../../../../config/environment');var logger=require(_0xdb58('0x5'))(_0xdb58('0x6'));config[_0xdb58('0x7')]=_[_0xdb58('0x8')](config['redis'],{'host':_0xdb58('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x4f7440,_0x5567c7,_0x2d2918,_0x1d8472){return new Promise(function(_0x4eface,_0x40f717){var _0x1a82e3=![];var _0x2e2941={'method':_0xdb58('0xa'),'uri':_0x1d8472+_0xdb58('0xb'),'json':!![]};_0x2e2941[_0xdb58('0xc')]=_0x2d2918;logger[_0xdb58('0xd')](_0xdb58('0xe'));return rp(_0x2e2941)[_0xdb58('0xf')](function(_0x53a6fd){if(_0x53a6fd){var _0x43a284=_0x53a6fd[_0xdb58('0x10')];var _0x2f79b5=null;for(_0x2f79b5=0x0;_0x2f79b5<_0x43a284[_0xdb58('0x11')];_0x2f79b5++){if(_0x43a284[_0x2f79b5][_0xdb58('0x12')]===_0x4f7440[_0xdb58('0x13')]){_0x4f7440[_0xdb58('0x14')]=_0x43a284[_0x2f79b5]['id'];_0x1a82e3=!![];}}if(_0x1a82e3){logger[_0xdb58('0xd')](_0xdb58('0x15'),_0x4f7440['adminId']);_0x4eface(_0x4f7440);}else{_0x40f717({'statusCode':0x194,'message':_0xdb58('0x16')});}}else{_0x40f717({'statusCode':0x194,'message':_0xdb58('0x16')});}})['catch'](function(_0x4baf56){logger[_0xdb58('0x17')]('['+[_0x5567c7[_0xdb58('0x18')]()]+']',_0x4baf56[_0xdb58('0x19')]);_0x40f717(_0x4baf56);});});}function getUser(_0x1cb2b8,_0x4b7882,_0x3bc697){return function(_0x9218a2){return new Promise(function(_0x4844e4,_0x28c757){var _0x22fbde={'method':_0xdb58('0xa'),'uri':_0x3bc697+_0xdb58('0xb'),'json':!![]};_0x22fbde[_0xdb58('0xc')]=_0x4b7882;logger['info']('Getting\x20user\x20list');return rp(_0x22fbde)[_0xdb58('0xf')](function(_0x277f91){if(_0x277f91){var _0x4aae64=_0x277f91[_0xdb58('0x10')];var _0x455860=![];var _0x25c306=null;if(_0x9218a2['agentEmail']!==null){logger[_0xdb58('0xd')](_0xdb58('0x1a'),_0x9218a2['agentEmail']);_0x9218a2[_0xdb58('0x1b')]=_0x9218a2[_0xdb58('0x1c')];for(_0x25c306=0x0;_0x25c306<_0x4aae64[_0xdb58('0x11')];_0x25c306++){if(_0x4aae64[_0x25c306][_0xdb58('0x12')]===_0x9218a2[_0xdb58('0x1c')]){_0x455860=!![];_0x9218a2[_0xdb58('0x1d')]=_0x4aae64[_0x25c306]['id'];logger['info']('User\x20found:',_0x9218a2['userId']);}}}if(!_0x455860){logger[_0xdb58('0xd')](_0xdb58('0x1e'));_0x9218a2[_0xdb58('0x1b')]=_0x9218a2['adminEmail'];_0x9218a2['userId']=_0x9218a2[_0xdb58('0x14')];_0x455860=!![];}if(_0x455860){_0x4844e4(_0x9218a2);}else{_0x28c757({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x28c757({'statusCode':0x194,'message':_0xdb58('0x16')});}})['catch'](function(_0xcb68d7){logger['error']('['+[_0x1cb2b8[_0xdb58('0x18')]()]+']',_0xcb68d7['message']);_0x28c757(_0xcb68d7);});});};}function getEndUser(_0x3bda32,_0x4babd5,_0x4e9514){return function(_0x465d46){return new Promise(function(_0x3b349a,_0x28d283){var _0xa5af8a=0x0;var _0x1900dc={'method':'GET','uri':_0x4e9514+_0xdb58('0x1f'),'json':!![]};_0x1900dc[_0xdb58('0xc')]=_0x4babd5;logger[_0xdb58('0xd')](_0xdb58('0x20'));return rp(_0x1900dc)[_0xdb58('0xf')](function(_0x143519){_0x143519['filters'][_0xdb58('0x21')](function(_0x4daf4d){if(_0x4daf4d['name']==='All\x20Contacts'){_0xa5af8a=_0x4daf4d['id'];}});})[_0xdb58('0xf')](function(){logger['info'](_0xdb58('0x22'));var _0x5cfaf4={'method':'GET','uri':_0x4e9514+_0xdb58('0x23')+_0xa5af8a,'json':!![]};_0x5cfaf4[_0xdb58('0xc')]=_0x4babd5;return rp(_0x5cfaf4);})[_0xdb58('0xf')](function(_0x2b1fe1){logger[_0xdb58('0xd')](_0xdb58('0x24'),_0x465d46['contactNumber']);if(_0x2b1fe1[_0xdb58('0x25')][_0xdb58('0x11')]>0x0){var _0x22e200=_['find'](_0x2b1fe1[_0xdb58('0x25')],function(_0x54b00e){if(_0x54b00e[_0xdb58('0x26')]===_0x465d46[_0xdb58('0x27')]||_0x54b00e[_0xdb58('0x28')]===_0x465d46[_0xdb58('0x27')]){return _0x54b00e;}});if(_0x22e200){_0x465d46[_0xdb58('0x29')]=_0x22e200['id'];logger[_0xdb58('0xd')](_0xdb58('0x2a'),_0x465d46['endUserId']);_0x3b349a(_0x465d46);}else{return createEndUser(_0x465d46,_0x3bda32,_0x4babd5,_0x4e9514)[_0xdb58('0xf')](function(_0x10258b){logger[_0xdb58('0xd')](_0xdb58('0x2b'),_0x465d46['endUserId']);_0x3b349a(_0x10258b);});}}else{return createEndUser(_0x465d46,_0x3bda32,_0x4babd5,_0x4e9514)[_0xdb58('0xf')](function(_0x3800b3){logger[_0xdb58('0xd')](_0xdb58('0x2b'),_0x465d46['endUserId']);_0x3b349a(_0x3800b3);});}})[_0xdb58('0x2c')](function(_0x11a222){throw new Error(_0x11a222['message']);});});};}function createEndUser(_0x432130,_0x336fb5,_0x2126cd,_0x3a545d){return new Promise(function(_0x3d63f7,_0x380a6d){var _0x520e6b=moment();var _0x2a40e6={'method':_0xdb58('0x2d'),'uri':_0x3a545d+_0xdb58('0x2e'),'body':{'contact':{'last_name':_0x432130['contactNumber'],'work_number':_0x432130[_0xdb58('0x27')],'mobile_number':_0x432130[_0xdb58('0x27')],'owner_id':_0x432130[_0xdb58('0x1d')],'created_at':_0x520e6b[_0xdb58('0x2f')](_0xdb58('0x30'))}},'json':!![]};_0x2a40e6[_0xdb58('0xc')]=_0x2126cd;logger[_0xdb58('0xd')](_0xdb58('0x31'));return rp(_0x2a40e6)['then'](function(_0x2ddbfb){_0x432130[_0xdb58('0x29')]=_0x2ddbfb[_0xdb58('0x32')]['id'];_0x3d63f7(_0x432130);})[_0xdb58('0x2c')](function(_0x201719){logger['error']('['+[_0x336fb5[_0xdb58('0x18')]()]+']',_0x201719[_0xdb58('0x19')]);_0x380a6d(_0x201719[_0xdb58('0x19')]);});});}function getTicket(_0x48f69d,_0x536ab4,_0x22ec65,_0x18d18c,_0x362043){return function(_0x3da8e5){logger[_0xdb58('0xd')]('Creating\x20new\x20task');return new Promise(function(_0x459b69,_0xe58d24){var _0x48c9b5=moment();var _0x3ce7dd={'method':_0xdb58('0x2d'),'uri':_0x22ec65+'/api/tasks','body':{'title':intUtil['getString'](_0x18d18c[_0xdb58('0x33')],_0x362043,'\x20'),'description':intUtil[_0xdb58('0x34')](_0x18d18c['Descriptions'],_0x362043,'\x0a'),'owner_id':_0x3da8e5[_0xdb58('0x1d')],'creater_id':_0x3da8e5[_0xdb58('0x14')],'targetable_id':_0x3da8e5['endUserId'],'targetable_type':'Contact','created_at':_0x48c9b5[_0xdb58('0x2f')](_0xdb58('0x30')),'due_date':_0x48c9b5[_0xdb58('0x35')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3ce7dd[_0xdb58('0xc')]=_0x536ab4;return rp(_0x3ce7dd)[_0xdb58('0xf')](function(_0x2f257f){_0x3da8e5[_0xdb58('0x36')]=_0x2f257f[_0xdb58('0x37')]['id'];logger['info'](_0xdb58('0x38'),_0x3da8e5[_0xdb58('0x36')]);_0x459b69(_0x3da8e5);})[_0xdb58('0x2c')](function(_0x490b53){logger[_0xdb58('0x17')]('['+[_0x48f69d[_0xdb58('0x18')]()]+']',_0x490b53[_0xdb58('0x19')]);_0xe58d24(_0x490b53[_0xdb58('0x19')]);});});};}function emit(_0x3fd7b6,_0x46c0c7,_0x696db6){var _0x56eb05={'uri':_0x3fd7b6+'/contacts/'+_0x696db6};io['to'](util[_0xdb58('0x2f')](_0xdb58('0x39'),_0x46c0c7))['emit']('trigger:browser:url',_0x56eb05);}exports['cs']=function(_0x21252f,_0x36148a,_0x3320e4,_0x57aacf,_0x376690,_0x56458c,_0x2a5eff,_0x2a9f7e){var _0x544f8c={};var _0x3332c8={'Authorization':_0xdb58('0x3a')+_0x56458c[_0xdb58('0x3b')]};_0x56458c[_0xdb58('0x3c')]=intUtil[_0xdb58('0x3d')](_0x56458c['remoteUri']);_0x56458c['serverUrl']=intUtil[_0xdb58('0x3d')](_0x56458c[_0xdb58('0x3e')]);var _0x52d67b=_0x56458c[_0xdb58('0x3c')];_0x544f8c[_0xdb58('0x13')]=_0x56458c[_0xdb58('0x3f')];_0x544f8c['contactNumber']=_0x2a9f7e[_0xdb58('0x40')]()===_0xdb58('0x41')?_0x36148a[_0xdb58('0x42')]:_0x36148a['calleridnum'];_0x544f8c['callDirection']=_0x2a9f7e===_0xdb58('0x43')||_0x2a9f7e==='unmanaged'?'queue':'outbound';if(_0x57aacf){_0x544f8c['agentEmail']=_0x57aacf[_0xdb58('0x12')];}var _0x59aff5=util['format'](_0xdb58('0x44'),_0x56458c[_0xdb58('0x3e')],_0x36148a[_0xdb58('0x45')],md5(_0x36148a[_0xdb58('0x45')]));if(_0x376690&&_0x376690[_0xdb58('0x46')]){logger[_0xdb58('0xd')](_0xdb58('0x47'),_0xdb58('0x48'));_0x36148a[_0xdb58('0x49')]=_0x59aff5;}else if(_0x2a5eff&&_0x2a5eff['recordingFormat']&&_0x2a5eff[_0xdb58('0x4a')]!==_0xdb58('0x4b')){logger['info'](_0xdb58('0x4c'),_0xdb58('0x48'));_0x36148a[_0xdb58('0x49')]=_0x59aff5;}else{_0x36148a[_0xdb58('0x49')]='';}return getAdminId(_0x544f8c,_0x2a9f7e,_0x3332c8,_0x52d67b)[_0xdb58('0xf')](getUser(_0x2a9f7e,_0x3332c8,_0x52d67b))[_0xdb58('0xf')](getEndUser(_0x2a9f7e,_0x3332c8,_0x52d67b))[_0xdb58('0xf')](getTicket(_0x2a9f7e,_0x3332c8,_0x52d67b,_0x3320e4,_0x36148a))[_0xdb58('0xf')](function(_0x39fa08){logger[_0xdb58('0xd')](util[_0xdb58('0x2f')](_0xdb58('0x4d'),_0x39fa08['ticketId']));if(_0x2a9f7e!==_0xdb58('0x4e')){logger[_0xdb58('0xd')]('['+[_0x2a9f7e[_0xdb58('0x18')]()]+']',_0xdb58('0x4f'));emit(_0x52d67b,_0x57aacf['name'],_0x39fa08[_0xdb58('0x29')]);}})[_0xdb58('0x2c')](function(_0x15d7b8){logger[_0xdb58('0x17')]('['+[_0x2a9f7e[_0xdb58('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x15d7b8,{'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 de96f98..3909c85 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 _0x8952=['log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','freshdesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','find','data3','queue','routeId','outbound'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8952,0x17e));var _0x2895=function(_0x4f7d39,_0x134bec){_0x4f7d39=_0x4f7d39-0x0;var _0x3cc2ae=_0x8952[_0x4f7d39];return _0x3cc2ae;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var zendesk=require(_0x2895('0x1'));var salesforce=require(_0x2895('0x2'));var sugarcrm=require(_0x2895('0x3'));var freshdesk=require(_0x2895('0x4'));var zoho=require('./zoho');var desk=require(_0x2895('0x5'));var vtiger=require(_0x2895('0x6'));var servicenow=require(_0x2895('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x2895('0x8'));var integrations=[_0x2895('0x9'),_0x2895('0xa'),'sugarcrm','freshdesk',_0x2895('0xb'),_0x2895('0xc'),_0x2895('0xd'),_0x2895('0xe'),_0x2895('0xf'),'servicenow'];exports[_0x2895('0x10')]=function(_0x5f2632,_0x428772,_0x5af454,_0x5e66fc,_0x56c5b9,_0x9bb58c){if(_0x5af454){if(_[_0x2895('0x11')](integrations,_0x5f2632[_0x2895('0x12')]['toLowerCase']())){try{var _0x981298=null;var _0x3924be='';var _0x4b1342=_0x5af454[_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()];if(_0x4b1342){var _0x5abb23=_0x4b1342[_0x5f2632['data2']];if(_0x5abb23){var _0x1d1493=_[_0x2895('0x14')](_0x5abb23['Configurations'],{'id':parseInt(_0x5f2632[_0x2895('0x15')],0xa)});if(_0x1d1493){if(_0x5e66fc){if(_0x56c5b9&&_0x428772[_0x2895('0x16')]){_0x3924be=_0x2895('0x16');}else if(_0x428772[_0x2895('0x17')]){_0x3924be=_0x2895('0x18');}else{console[_0x2895('0x19')](_0x2895('0x1a'),_0x428772);}}else{_0x3924be=_0x2895('0x1b');}switch(_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()){case _0x2895('0x9'):zendesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xa'):salesforce[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1c'):sugarcrm[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1d'):freshdesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xb'):zoho[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xc'):desk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xd'):vtiger[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xf'):freshsales['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'servicenow':servicenow['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'dynamics365':dynamics365['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;default:console['log'](_0x2895('0x1e'));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632[_0x2895('0x12')]['toLowerCase']());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util[_0x2895('0x22')](_0x2895('0x23'),_0x5f2632[_0x2895('0x12')]['toLowerCase'](),_0x5f2632[_0x2895('0x15')]));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632['data1'][_0x2895('0x13')]());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x5f2632[_0x2895('0x12')][_0x2895('0x13')](),_0x5f2632[_0x2895('0x24')]));}}else{}}catch(_0x4a21cf){console[_0x2895('0x20')](_0x4a21cf);}}}}; \ No newline at end of file +var _0x34b7=['desk','vtiger','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshsales','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x34b7,0x196));var _0x734b=function(_0x8567ae,_0x118fcf){_0x8567ae=_0x8567ae-0x0;var _0x2f9e9b=_0x34b7[_0x8567ae];return _0x2f9e9b;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x734b('0x0'));var salesforce=require(_0x734b('0x1'));var sugarcrm=require(_0x734b('0x2'));var freshdesk=require(_0x734b('0x3'));var zoho=require(_0x734b('0x4'));var desk=require(_0x734b('0x5'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x734b('0x6'));var freshsales=require(_0x734b('0x7'));var integrations=[_0x734b('0x8'),_0x734b('0x9'),_0x734b('0xa'),_0x734b('0xb'),'zoho',_0x734b('0xc'),_0x734b('0xd'),'dynamics365','freshsales','servicenow'];exports[_0x734b('0xe')]=function(_0x598dee,_0x43c5e0,_0x333738,_0x2860a2,_0x222dc7,_0x3a442b){if(_0x333738){if(_[_0x734b('0xf')](integrations,_0x598dee[_0x734b('0x10')][_0x734b('0x11')]())){try{var _0x257657=null;var _0x1e0fca='';var _0x189a82=_0x333738[_0x598dee[_0x734b('0x10')][_0x734b('0x11')]()];if(_0x189a82){var _0x1c893d=_0x189a82[_0x598dee['data2']];if(_0x1c893d){var _0x18fc18=_[_0x734b('0x12')](_0x1c893d[_0x734b('0x13')],{'id':parseInt(_0x598dee[_0x734b('0x14')],0xa)});if(_0x18fc18){if(_0x2860a2){if(_0x222dc7&&_0x43c5e0[_0x734b('0x15')]){_0x1e0fca=_0x734b('0x15');}else if(_0x43c5e0[_0x734b('0x16')]){_0x1e0fca=_0x734b('0x17');}else{console[_0x734b('0x18')](_0x734b('0x19'),_0x43c5e0);}}else{_0x1e0fca=_0x734b('0x1a');}switch(_0x598dee['data1'][_0x734b('0x11')]()){case _0x734b('0x8'):zendesk[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0x9'):salesforce[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0xa'):sugarcrm[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case'freshdesk':freshdesk[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case'zoho':zoho[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0xc'):desk[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0xd'):vtiger[_0x1e0fca](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b);break;case _0x734b('0x1b'):freshsales['cs'](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b,_0x1e0fca);break;case _0x734b('0x1c'):servicenow['cs'](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b,_0x1e0fca);break;case _0x734b('0x1d'):dynamics365['cs'](_0x598dee,_0x43c5e0,_0x18fc18,_0x2860a2,_0x222dc7,_0x1c893d,_0x3a442b,_0x1e0fca);break;default:console[_0x734b('0x18')](_0x734b('0x1e'));}}else{_0x257657=require(_0x734b('0x1f'))(_0x598dee[_0x734b('0x10')][_0x734b('0x11')]());_0x257657[_0x734b('0x20')](_0x734b('0x21'),util[_0x734b('0x22')](_0x734b('0x23'),_0x598dee['data1'][_0x734b('0x11')](),_0x598dee[_0x734b('0x14')]));}}else{_0x257657=require('../../../../config/logger')(_0x598dee[_0x734b('0x10')][_0x734b('0x11')]());_0x257657[_0x734b('0x20')](_0x734b('0x21'),util[_0x734b('0x22')](_0x734b('0x24'),_0x598dee[_0x734b('0x10')][_0x734b('0x11')](),_0x598dee[_0x734b('0x25')]));}}else{}}catch(_0x3abbe6){console[_0x734b('0x20')](_0x3abbe6);}}}}; \ 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 2cd7947..7dc0134 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 _0x0722=['moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','No\x20Company','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','login','Connection\x20established.','queue','serverUrl','remoteUri','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','[OUTBOUND]','stringify','unmanaged','calleridname','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','Subjects','getString','Descriptions','WhoId','Case','assign','ContactId','create','isNil','validateEmail','sobject','User','find','then','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s'];(function(_0x4b3d10,_0x3da823){var _0x3f62cc=function(_0x366e9a){while(--_0x366e9a){_0x4b3d10['push'](_0x4b3d10['shift']());}};_0x3f62cc(++_0x3da823);}(_0x0722,0xa8));var _0x2072=function(_0x12fd69,_0x43d017){_0x12fd69=_0x12fd69-0x0;var _0x234d9e=_0x0722[_0x12fd69];return _0x234d9e;};'use strict';var _=require(_0x2072('0x0'));var rp=require(_0x2072('0x1'));var moment=require('moment');var BPromise=require(_0x2072('0x2'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x2072('0x3'));var Redis=require(_0x2072('0x4'));var intUtil=require(_0x2072('0x5'));var config=require(_0x2072('0x6'));var logger=require(_0x2072('0x7'))(_0x2072('0x8'));config[_0x2072('0x9')]=_[_0x2072('0xa')](config[_0x2072('0x9')],{'host':_0x2072('0xb'),'port':0x18eb});var io=require(_0x2072('0xc'))(new Redis(config[_0x2072('0x9')]));function emit(_0x2f7664,_0x1f98a8,_0x9f3aba){io['to'](_0x2f7664)[_0x2072('0xd')](_0x1f98a8,_0x9f3aba);}function getTicket(_0x497952,_0x4764c2,_0x4da489,_0x4309a1,_0x45ab63,_0x17c323,_0x543726,_0x345a95){var _0xd9d9a4={};if(_0x4309a1[_0x2072('0xe')]===_0x2072('0xf')){_0xd9d9a4=Object['assign']({},{'OwnerId':_0x4764c2['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x4309a1[_0x2072('0x10')],_0x45ab63,'\x20'),'Description':intUtil[_0x2072('0x11')](_0x4309a1[_0x2072('0x12')],_0x45ab63,'\x0a')},getCustomFields(_0x17c323,_0x45ab63));if(_0x4da489){_0xd9d9a4[_0x2072('0x13')]=_0x4da489['id'];}}else if(_0x4309a1['ticketType']===_0x2072('0x14')){_0xd9d9a4=Object[_0x2072('0x15')]({},{'OwnerId':_0x4764c2['id'],'Subject':intUtil[_0x2072('0x11')](_0x4309a1['Subjects'],_0x45ab63,'\x20'),'Description':intUtil[_0x2072('0x11')](_0x4309a1[_0x2072('0x12')],_0x45ab63,'\x0a')},getCustomFields(_0x17c323,_0x45ab63));if(_0x4da489){_0xd9d9a4[_0x2072('0x16')]=_0x4da489['id'];}}return _0x543726['sobject'](_0x4309a1[_0x2072('0xe')])[_0x2072('0x17')](_0xd9d9a4);}function getUser(_0x2e4557,_0x4c3857,_0x4dd205){if(!_[_0x2072('0x18')](_0x4c3857)&&intUtil[_0x2072('0x19')](_0x4c3857)){var _0x44500f={'Email':_0x4c3857};var _0x21f9d7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4dd205[_0x2072('0x1a')](_0x2072('0x1b'))[_0x2072('0x1c')](_0x44500f,_0x21f9d7)['execute']()[_0x2072('0x1d')](function(_0x57576e){if(_0x57576e[_0x2072('0x1e')]){var _0x4d4e93=_[_0x2072('0x1c')](_0x57576e,function(_0x4c5f35){return _0x4c5f35[_0x2072('0x1f')]===_0x4c3857;});if(_0x4d4e93){logger[_0x2072('0x20')]('Agent\x20%s\x20found.',_0x4c3857);return BPromise[_0x2072('0x21')]({'id':_0x4d4e93['Id'],'name':_0x4d4e93[_0x2072('0x22')]});}}else{logger['info'](_0x2072('0x23'),_0x4c3857);return _0x4dd205[_0x2072('0x24')]()[_0x2072('0x1d')](function(_0x4c77ec){return BPromise['resolve']({'id':_0x4c77ec['user_id'],'name':_0x4c77ec['display_name']});});}});}else{logger[_0x2072('0x20')](_0x2072('0x23'),_0x4c3857);return _0x4dd205['identity']()[_0x2072('0x1d')](function(_0x228468){return BPromise[_0x2072('0x21')]({'id':_0x228468[_0x2072('0x25')],'name':_0x228468[_0x2072('0x26')]});});}}function getEndUser(_0x16643b,_0xe4b895,_0x41b9a0,_0x30fab9,_0x4a54b3){var _0x11c9f2={'Phone':_0x30fab9};var _0x1c2efa={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2072('0x21')]()['then'](function(){if(_0xe4b895[_0x2072('0xe')]===_0x2072('0xf')){logger['info'](_0x2072('0x27'),_0x30fab9,_0xe4b895[_0x2072('0x28')]);switch(_0xe4b895[_0x2072('0x28')]){case _0x2072('0x29'):return _0x4a54b3['sobject'](_0x2072('0x2a'))[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa)[_0x2072('0x2b')]()[_0x2072('0x1d')](function(_0x787ec8){if(_0x787ec8&&_0x787ec8['length']){return _0x787ec8;}else{return _0x4a54b3[_0x2072('0x1a')](_0x2072('0x2c'))[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa);}});case _0x2072('0x2d'):return _0x4a54b3[_0x2072('0x1a')]('Contact')[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa)['execute']();case'lead':return _0x4a54b3['sobject'](_0x2072('0x2c'))[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa);default:return null;}}else if(_0xe4b895[_0x2072('0xe')]===_0x2072('0x14')){logger['info'](_0x2072('0x27'),_0x30fab9,_0x2072('0x2d'));return _0x4a54b3[_0x2072('0x1a')](_0x2072('0x2a'))[_0x2072('0x1c')](_0x11c9f2,_0x1c2efa)[_0x2072('0x2b')]();}})[_0x2072('0x1d')](function(_0x26264e){if(_0x26264e&&_0x26264e[_0x2072('0x1e')]){var _0x1863f1=_[_0x2072('0x1c')](_0x26264e,function(_0x29dbef){return _0x29dbef[_0x2072('0x2e')]===_0x30fab9;});if(_0x1863f1){return BPromise[_0x2072('0x21')]({'id':_0x1863f1['Id'],'name':_0x1863f1[_0x2072('0x22')],'phone':_0x1863f1[_0x2072('0x2e')]});}}})['then'](function(_0x32af04){if(_0x32af04){logger[_0x2072('0x20')](_0x2072('0x2f'),_0x30fab9);return BPromise['resolve'](_0x32af04);}else{logger['info'](_0x2072('0x30'),_0x30fab9);var _0x15084b={'LastName':_0x41b9a0!==_0x2072('0x31')?_0x41b9a0:util[_0x2072('0x32')](_0x2072('0x33'),_0x30fab9),'Phone':_0x30fab9};if(_0xe4b895['moduleCreate']){if(_0xe4b895[_0x2072('0x34')]===_0x2072('0x2d')){logger['info'](_0x2072('0x35'),_0x30fab9,_0xe4b895[_0x2072('0x34')]);}else if(_0xe4b895[_0x2072('0x34')]===_0x2072('0x36')&&_0xe4b895[_0x2072('0xe')]==='Task'){logger[_0x2072('0x20')](_0x2072('0x35'),_0x30fab9,_0xe4b895[_0x2072('0x34')]);_0x15084b[_0x2072('0x37')]=_0x2072('0x38');}else{return null;}}return _0x4a54b3[_0x2072('0x1a')](_['upperFirst'](_0xe4b895[_0x2072('0x34')]))[_0x2072('0x17')](_0x15084b);}});}function getCustomFields(_0x2eceee,_0x22ce3f){var _0xbcff97={};if(_0x2eceee['length']>0x0){_[_0x2072('0x39')](_0x2eceee,function(_0x3935e6){if(_0x3935e6[_0x2072('0x3a')]===_0x2072('0x3b')&&_0x3935e6['idField']){_0xbcff97[_0x3935e6[_0x2072('0x3c')]]=_0x3935e6[_0x2072('0x3d')]['toString']();}else if(_0x3935e6[_0x2072('0x3a')]===_0x2072('0x3e')&&_0x3935e6[_0x2072('0x3f')]&&_0x3935e6[_0x2072('0x3c')]){_0x22ce3f[_0x3935e6['variableName']]&&(_0xbcff97[_0x3935e6[_0x2072('0x3c')]]=_0x22ce3f[_0x3935e6['variableName']][_0x2072('0x40')]());}else if(_0x3935e6[_0x2072('0x3a')]===_0x2072('0x41')&&_0x3935e6['Variable']&&_0x3935e6[_0x2072('0x42')][_0x2072('0x43')]&&_0x3935e6[_0x2072('0x3c')]){_0x22ce3f[_0x3935e6[_0x2072('0x42')][_0x2072('0x43')]['toLowerCase']()]&&(_0xbcff97[_0x3935e6[_0x2072('0x3c')]]=_0x22ce3f[_0x3935e6[_0x2072('0x42')][_0x2072('0x43')][_0x2072('0x44')]()][_0x2072('0x40')]());}});}return _0xbcff97;}function getConnection(_0x4f3ccd){var _0x2f78c4=_0x4f3ccd[_0x2072('0x45')]['concat'](_0x4f3ccd[_0x2072('0x46')]);var _0x176604=new jsforce[(_0x2072('0x47'))]({'oauth2':{'loginUrl':_0x4f3ccd['remoteUri']||'https://login.salesforce.com','clientId':_0x4f3ccd['clientId'],'clientSecret':_0x4f3ccd['clientSecret']}});return _0x176604[_0x2072('0x48')](_0x4f3ccd['username'],_0x2f78c4)[_0x2072('0x1d')](function(){logger[_0x2072('0x20')](_0x2072('0x49'));return _0x176604;});}exports[_0x2072('0x4a')]=function(_0x4a8322,_0x312d86,_0x196efd,_0x24140f,_0x1e591a,_0x342cb6){var _0x95f09e,_0x1a599a,_0x58281c,_0x3508ac;_0x342cb6[_0x2072('0x4b')]=intUtil['stripTrailingSlash'](_0x342cb6[_0x2072('0x4b')]);_0x342cb6[_0x2072('0x4c')]=intUtil[_0x2072('0x4d')](_0x342cb6[_0x2072('0x4c')]);if(_0x1e591a&&_0x1e591a['monitor_format']){logger[_0x2072('0x20')](_0x2072('0x4e'),_0x2072('0x4f'));_0x312d86[_0x2072('0x50')]=util[_0x2072('0x32')](_0x2072('0x51'),_0x342cb6[_0x2072('0x4b')],_0x312d86[_0x2072('0x52')],md5(_0x312d86[_0x2072('0x52')]));}else{_0x312d86['recordingURL']='';}return getConnection(_0x342cb6)[_0x2072('0x1d')](function(_0x5ee504){_0x3508ac=_0x5ee504;return getUser(_0x342cb6,_0x24140f[_0x2072('0x53')],_0x3508ac);})[_0x2072('0x1d')](function(_0x23345c){_0x95f09e=_0x23345c;return getEndUser(_0x342cb6,_0x196efd,_0x312d86['calleridname'],_0x312d86[_0x2072('0x54')],_0x3508ac);})[_0x2072('0x1d')](function(_0x23d7cb){_0x1a599a=_0x23d7cb;return getTicket(_0x342cb6,_0x95f09e,_0x1a599a,_0x196efd,_0x312d86,_0x196efd[_0x2072('0x55')],_0x3508ac,'queue');})[_0x2072('0x1d')](function(_0x1be811){_0x58281c=_0x1be811;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x58281c['id']);logger['info'](_0x2072('0x56'),_0x58281c['id'],_0x24140f[_0x2072('0x43')],_0x342cb6[_0x2072('0x3a')]);switch(_0x342cb6[_0x2072('0x3a')]){case'integrationTab':emit(util[_0x2072('0x32')](_0x2072('0x57'),_0x24140f['name']),_0x2072('0x58'),{'recordId':_0x58281c['id']});break;case _0x2072('0x59'):emit(util[_0x2072('0x32')]('user:%s',_0x24140f[_0x2072('0x43')]),_0x2072('0x5a'),{'uri':util[_0x2072('0x32')]('%s/%s/e',_0x3508ac[_0x2072('0x5b')],_0x58281c['id'])});break;default:logger[_0x2072('0x5c')](_0x2072('0x5d'));}})[_0x2072('0x5e')](function(_0x10bcbc){logger[_0x2072('0x5c')](_0x2072('0x4e'),JSON['stringify'](_0x10bcbc));});};exports[_0x2072('0x5f')]=function(_0x616601,_0x253036,_0x17afb6,_0x33aed4,_0x596120,_0x53f277,_0x49d3bb){var _0x2a82f5,_0x27ef11,_0x39b0dc,_0x27a104;_0x53f277[_0x2072('0x4b')]=intUtil[_0x2072('0x4d')](_0x53f277[_0x2072('0x4b')]);_0x53f277[_0x2072('0x4c')]=intUtil[_0x2072('0x4d')](_0x53f277[_0x2072('0x4c')]);if(_0x49d3bb&&_0x49d3bb['recordingFormat']&&_0x49d3bb[_0x2072('0x60')]!==_0x2072('0x61')){logger[_0x2072('0x20')]('[OUTBOUND]',_0x2072('0x4f'));_0x253036[_0x2072('0x50')]=util[_0x2072('0x32')](_0x2072('0x51'),_0x53f277[_0x2072('0x4b')],_0x253036[_0x2072('0x52')],md5(_0x253036[_0x2072('0x52')]));}return getConnection(_0x53f277)['then'](function(_0x5dd191){_0x27a104=_0x5dd191;return getUser(_0x53f277,_0x33aed4[_0x2072('0x53')],_0x27a104);})[_0x2072('0x1d')](function(_0x3ad0e3){_0x2a82f5=_0x3ad0e3;return getEndUser(_0x53f277,_0x17afb6,_0x253036[_0x2072('0x62')],_0x253036['destcalleridnum'],_0x27a104);})[_0x2072('0x1d')](function(_0xfb8596){_0x27ef11=_0xfb8596;return getTicket(_0x53f277,_0x2a82f5,_0x27ef11,_0x17afb6,_0x253036,_0x17afb6[_0x2072('0x55')],_0x27a104,_0x2072('0x5f'));})[_0x2072('0x1d')](function(_0x258881){_0x39b0dc=_0x258881;logger['info'](_0x2072('0x63'),_0x39b0dc['id']);logger[_0x2072('0x20')](_0x2072('0x64'),_0x39b0dc['id'],_0x33aed4[_0x2072('0x43')],_0x53f277['type']);switch(_0x53f277[_0x2072('0x3a')]){case _0x2072('0x65'):emit(util[_0x2072('0x32')](_0x2072('0x57'),_0x33aed4[_0x2072('0x43')]),_0x2072('0x58'),{'recordId':_0x39b0dc['id']});break;case _0x2072('0x59'):emit(util['format'](_0x2072('0x57'),_0x33aed4[_0x2072('0x43')]),_0x2072('0x5a'),{'uri':util[_0x2072('0x32')](_0x2072('0x66'),_0x27a104[_0x2072('0x5b')],_0x39b0dc['id'])});break;default:logger[_0x2072('0x5c')](_0x2072('0x67'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x148269){logger[_0x2072('0x5c')]('[OUTBOUND]',JSON[_0x2072('0x68')](_0x148269));});};exports[_0x2072('0x69')]=function(_0x9cba52,_0x56b865,_0x25d336,_0x205654,_0x6a540d,_0x36cb5a){var _0x262184,_0x3924ef,_0x51d931,_0xadc3aa;_0x36cb5a[_0x2072('0x4b')]=intUtil['stripTrailingSlash'](_0x36cb5a[_0x2072('0x4b')]);_0x36cb5a[_0x2072('0x4c')]=intUtil['stripTrailingSlash'](_0x36cb5a['remoteUri']);if(_0x6a540d&&_0x6a540d['monitor_format']){logger[_0x2072('0x20')]('['+_0x56b865['lastevent']['toUpperCase']()+']',_0x2072('0x4f'));_0x56b865['recordingURL']=util[_0x2072('0x32')](_0x2072('0x51'),_0x36cb5a[_0x2072('0x4b')],_0x56b865[_0x2072('0x52')],md5(_0x56b865[_0x2072('0x52')]));}else{_0x56b865[_0x2072('0x50')]='';}return getConnection(_0x36cb5a)[_0x2072('0x1d')](function(_0x41f3af){_0xadc3aa=_0x41f3af;if(!_['isNil'](_0x205654)){return getUser(_0x36cb5a,_0x205654[_0x2072('0x43')],_0xadc3aa);}else{return getUser(_0x36cb5a,null,_0xadc3aa);}})[_0x2072('0x1d')](function(_0x221a0c){_0x262184=_0x221a0c;return getEndUser(_0x36cb5a,_0x25d336,_0x56b865[_0x2072('0x6a')],_0x56b865['calleridnum'],_0xadc3aa);})[_0x2072('0x1d')](function(_0x52b8ad){_0x3924ef=_0x52b8ad;return getTicket(_0x36cb5a,_0x262184,_0x3924ef,_0x25d336,_0x56b865,_0x25d336[_0x2072('0x55')],_0xadc3aa);})['then'](function(_0x174bac){_0x51d931=_0x174bac;logger[_0x2072('0x20')]('['+_0x56b865[_0x2072('0x6b')][_0x2072('0x6c')]()+']\x20Ticket\x20%s\x20created.',_0x51d931['id']);logger[_0x2072('0x20')]('['+_0x56b865[_0x2072('0x6b')][_0x2072('0x6c')]()+_0x2072('0x6d'),_0x36cb5a[_0x2072('0x3a')]);})['catch'](function(_0x56ef9d){logger[_0x2072('0x5c')]('['+_0x56b865[_0x2072('0x6b')][_0x2072('0x6c')]()+']',JSON[_0x2072('0x68')](_0x56ef9d));});}; \ No newline at end of file +var _0x44b6=['Salesforce\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]','lastevent','toUpperCase','calleridnum','Fields',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','ticketType','Task','assign','utc','getString','ContactId','create','isNil','validateEmail','sobject','User','find','execute','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','Contact','Lead','contact','Case','length','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','upperFirst','string','idField','content','toString','type','variableName','Variable','name','toLowerCase','concat','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridname','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','stringify','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl'];(function(_0x1d5a18,_0x585dc8){var _0x411450=function(_0x3f4ad8){while(--_0x3f4ad8){_0x1d5a18['push'](_0x1d5a18['shift']());}};_0x411450(++_0x585dc8);}(_0x44b6,0xd8));var _0x644b=function(_0x2bb452,_0x2dbbc0){_0x2bb452=_0x2bb452-0x0;var _0x5f50a6=_0x44b6[_0x2bb452];return _0x5f50a6;};'use strict';var _=require(_0x644b('0x0'));var rp=require(_0x644b('0x1'));var moment=require(_0x644b('0x2'));var BPromise=require(_0x644b('0x3'));var md5=require(_0x644b('0x4'));var jsforce=require(_0x644b('0x5'));var util=require(_0x644b('0x6'));var Redis=require(_0x644b('0x7'));var intUtil=require(_0x644b('0x8'));var config=require(_0x644b('0x9'));var logger=require(_0x644b('0xa'))(_0x644b('0xb'));config[_0x644b('0xc')]=_[_0x644b('0xd')](config[_0x644b('0xc')],{'host':_0x644b('0xe'),'port':0x18eb});var io=require(_0x644b('0xf'))(new Redis(config['redis']));function emit(_0x3fa4bd,_0x148a13,_0x3083c9){io['to'](_0x3fa4bd)['emit'](_0x148a13,_0x3083c9);}function getTicket(_0x3ce1f8,_0x57adce,_0x4dbc06,_0x22b58a,_0xb60208,_0x301a5e,_0x2f9d57,_0x3562dd){var _0x121ff1={};if(_0x22b58a[_0x644b('0x10')]===_0x644b('0x11')){_0x121ff1=Object[_0x644b('0x12')]({},{'OwnerId':_0x57adce['id'],'ActivityDate':moment[_0x644b('0x13')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x22b58a['Subjects'],_0xb60208,'\x20'),'Description':intUtil[_0x644b('0x14')](_0x22b58a['Descriptions'],_0xb60208,'\x0a')},getCustomFields(_0x301a5e,_0xb60208));if(_0x4dbc06){_0x121ff1['WhoId']=_0x4dbc06['id'];}}else if(_0x22b58a[_0x644b('0x10')]==='Case'){_0x121ff1=Object[_0x644b('0x12')]({},{'OwnerId':_0x57adce['id'],'Subject':intUtil[_0x644b('0x14')](_0x22b58a['Subjects'],_0xb60208,'\x20'),'Description':intUtil['getString'](_0x22b58a['Descriptions'],_0xb60208,'\x0a')},getCustomFields(_0x301a5e,_0xb60208));if(_0x4dbc06){_0x121ff1[_0x644b('0x15')]=_0x4dbc06['id'];}}return _0x2f9d57['sobject'](_0x22b58a[_0x644b('0x10')])[_0x644b('0x16')](_0x121ff1);}function getUser(_0x489e69,_0x4d0a34,_0x172014){if(!_[_0x644b('0x17')](_0x4d0a34)&&intUtil[_0x644b('0x18')](_0x4d0a34)){var _0x2ae855={'Email':_0x4d0a34};var _0x1f4476={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x172014[_0x644b('0x19')](_0x644b('0x1a'))[_0x644b('0x1b')](_0x2ae855,_0x1f4476)[_0x644b('0x1c')]()['then'](function(_0x4a13ef){if(_0x4a13ef['length']){var _0x4a32a6=_[_0x644b('0x1b')](_0x4a13ef,function(_0x5c8134){return _0x5c8134[_0x644b('0x1d')]===_0x4d0a34;});if(_0x4a32a6){logger[_0x644b('0x1e')]('Agent\x20%s\x20found.',_0x4d0a34);return BPromise[_0x644b('0x1f')]({'id':_0x4a32a6['Id'],'name':_0x4a32a6[_0x644b('0x20')]});}}else{logger['info'](_0x644b('0x21'),_0x4d0a34);return _0x172014[_0x644b('0x22')]()[_0x644b('0x23')](function(_0x2b75bb){return BPromise[_0x644b('0x1f')]({'id':_0x2b75bb[_0x644b('0x24')],'name':_0x2b75bb[_0x644b('0x25')]});});}});}else{logger[_0x644b('0x1e')](_0x644b('0x21'),_0x4d0a34);return _0x172014[_0x644b('0x22')]()[_0x644b('0x23')](function(_0x511881){return BPromise['resolve']({'id':_0x511881[_0x644b('0x24')],'name':_0x511881[_0x644b('0x25')]});});}}function getEndUser(_0x1bbdd7,_0x2068c7,_0x2b0be3,_0x5b845c,_0x405f55){var _0x284e4e={'Phone':_0x5b845c};var _0x272445={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x644b('0x1f')]()['then'](function(){if(_0x2068c7[_0x644b('0x10')]===_0x644b('0x11')){logger[_0x644b('0x1e')](_0x644b('0x26'),_0x5b845c,_0x2068c7['moduleSearch']);switch(_0x2068c7['moduleSearch']){case _0x644b('0x27'):return _0x405f55[_0x644b('0x19')](_0x644b('0x28'))[_0x644b('0x1b')](_0x284e4e,_0x272445)[_0x644b('0x1c')]()[_0x644b('0x23')](function(_0x2b02cd){if(_0x2b02cd&&_0x2b02cd['length']){return _0x2b02cd;}else{return _0x405f55[_0x644b('0x19')](_0x644b('0x29'))[_0x644b('0x1b')](_0x284e4e,_0x272445);}});case _0x644b('0x2a'):return _0x405f55['sobject'](_0x644b('0x28'))[_0x644b('0x1b')](_0x284e4e,_0x272445)[_0x644b('0x1c')]();case'lead':return _0x405f55['sobject'](_0x644b('0x29'))['find'](_0x284e4e,_0x272445);default:return null;}}else if(_0x2068c7[_0x644b('0x10')]===_0x644b('0x2b')){logger[_0x644b('0x1e')](_0x644b('0x26'),_0x5b845c,'contact');return _0x405f55['sobject'](_0x644b('0x28'))[_0x644b('0x1b')](_0x284e4e,_0x272445)['execute']();}})['then'](function(_0x2723d9){if(_0x2723d9&&_0x2723d9[_0x644b('0x2c')]){var _0x146dfb=_[_0x644b('0x1b')](_0x2723d9,function(_0x3e509a){return _0x3e509a[_0x644b('0x2d')]===_0x5b845c;});if(_0x146dfb){return BPromise[_0x644b('0x1f')]({'id':_0x146dfb['Id'],'name':_0x146dfb[_0x644b('0x20')],'phone':_0x146dfb[_0x644b('0x2d')]});}}})[_0x644b('0x23')](function(_0x46eff3){if(_0x46eff3){logger[_0x644b('0x1e')](_0x644b('0x2e'),_0x5b845c);return BPromise['resolve'](_0x46eff3);}else{logger[_0x644b('0x1e')](_0x644b('0x2f'),_0x5b845c);var _0x587377={'LastName':_0x2b0be3!==''?_0x2b0be3:util['format'](_0x644b('0x30'),_0x5b845c),'Phone':_0x5b845c};if(_0x2068c7[_0x644b('0x31')]){if(_0x2068c7[_0x644b('0x31')]===_0x644b('0x2a')){logger[_0x644b('0x1e')](_0x644b('0x32'),_0x5b845c,_0x2068c7[_0x644b('0x31')]);}else if(_0x2068c7[_0x644b('0x31')]===_0x644b('0x33')&&_0x2068c7[_0x644b('0x10')]===_0x644b('0x11')){logger[_0x644b('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5b845c,_0x2068c7[_0x644b('0x31')]);_0x587377[_0x644b('0x34')]='No\x20Company';}else{return null;}}return _0x405f55['sobject'](_[_0x644b('0x35')](_0x2068c7[_0x644b('0x31')]))[_0x644b('0x16')](_0x587377);}});}function getCustomFields(_0x189fdc,_0x1f0477){var _0x9c7fa9={};if(_0x189fdc[_0x644b('0x2c')]>0x0){_['forEach'](_0x189fdc,function(_0x1ae53c){if(_0x1ae53c['type']===_0x644b('0x36')&&_0x1ae53c[_0x644b('0x37')]){_0x9c7fa9[_0x1ae53c['idField']]=_0x1ae53c[_0x644b('0x38')][_0x644b('0x39')]();}else if(_0x1ae53c[_0x644b('0x3a')]==='variable'&&_0x1ae53c['variableName']&&_0x1ae53c[_0x644b('0x37')]){_0x1f0477[_0x1ae53c[_0x644b('0x3b')]]&&(_0x9c7fa9[_0x1ae53c['idField']]=_0x1f0477[_0x1ae53c[_0x644b('0x3b')]][_0x644b('0x39')]());}else if(_0x1ae53c[_0x644b('0x3a')]==='customVariable'&&_0x1ae53c[_0x644b('0x3c')]&&_0x1ae53c['Variable'][_0x644b('0x3d')]&&_0x1ae53c['idField']){_0x1f0477[_0x1ae53c['Variable'][_0x644b('0x3d')][_0x644b('0x3e')]()]&&(_0x9c7fa9[_0x1ae53c[_0x644b('0x37')]]=_0x1f0477[_0x1ae53c[_0x644b('0x3c')][_0x644b('0x3d')][_0x644b('0x3e')]()][_0x644b('0x39')]());}});}return _0x9c7fa9;}function getConnection(_0x5c791e){var _0x363730=_0x5c791e['password'][_0x644b('0x3f')](_0x5c791e['securityToken']);var _0x1fa65c=new jsforce[(_0x644b('0x40'))]({'oauth2':{'loginUrl':_0x5c791e[_0x644b('0x41')]||_0x644b('0x42'),'clientId':_0x5c791e[_0x644b('0x43')],'clientSecret':_0x5c791e['clientSecret']}});return _0x1fa65c[_0x644b('0x44')](_0x5c791e[_0x644b('0x45')],_0x363730)[_0x644b('0x23')](function(){logger[_0x644b('0x1e')](_0x644b('0x46'));return _0x1fa65c;});}exports[_0x644b('0x47')]=function(_0x49787a,_0xd213ce,_0x22ee42,_0x316f0f,_0x51ecb5,_0x85df9e){var _0x584b08,_0x254db2,_0x37e29a,_0x59e357;_0x85df9e['serverUrl']=intUtil[_0x644b('0x48')](_0x85df9e['serverUrl']);_0x85df9e['remoteUri']=intUtil[_0x644b('0x48')](_0x85df9e[_0x644b('0x41')]);if(_0x51ecb5&&_0x51ecb5['monitor_format']){logger[_0x644b('0x1e')](_0x644b('0x49'),_0x644b('0x4a'));_0xd213ce[_0x644b('0x4b')]=util[_0x644b('0x4c')](_0x644b('0x4d'),_0x85df9e[_0x644b('0x4e')],_0xd213ce[_0x644b('0x4f')],md5(_0xd213ce[_0x644b('0x4f')]));}else{_0xd213ce[_0x644b('0x4b')]='';}return getConnection(_0x85df9e)[_0x644b('0x23')](function(_0xde0dcf){_0x59e357=_0xde0dcf;return getUser(_0x85df9e,_0x316f0f['email'],_0x59e357);})['then'](function(_0x318957){_0x584b08=_0x318957;return getEndUser(_0x85df9e,_0x22ee42,_0xd213ce[_0x644b('0x50')],_0xd213ce['calleridnum'],_0x59e357);})[_0x644b('0x23')](function(_0x2c23ed){_0x254db2=_0x2c23ed;return getTicket(_0x85df9e,_0x584b08,_0x254db2,_0x22ee42,_0xd213ce,_0x22ee42['Fields'],_0x59e357,'queue');})[_0x644b('0x23')](function(_0x3fa6d8){_0x37e29a=_0x3fa6d8;logger[_0x644b('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x37e29a['id']);logger[_0x644b('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x37e29a['id'],_0x316f0f[_0x644b('0x3d')],_0x85df9e[_0x644b('0x3a')]);switch(_0x85df9e[_0x644b('0x3a')]){case _0x644b('0x51'):emit(util[_0x644b('0x4c')](_0x644b('0x52'),_0x316f0f['name']),_0x644b('0x53'),{'recordId':_0x37e29a['id']});break;case _0x644b('0x54'):emit(util[_0x644b('0x4c')](_0x644b('0x52'),_0x316f0f[_0x644b('0x3d')]),_0x644b('0x55'),{'uri':util[_0x644b('0x4c')](_0x644b('0x56'),_0x59e357['instanceUrl'],_0x37e29a['id'])});break;default:logger[_0x644b('0x57')](_0x644b('0x58'));}})['catch'](function(_0x308746){logger[_0x644b('0x57')](_0x644b('0x49'),JSON[_0x644b('0x59')](_0x308746));});};exports[_0x644b('0x5a')]=function(_0x533177,_0x55dec3,_0x3b76e6,_0x1a5b92,_0x369225,_0x5a36b2,_0x25f9c1){var _0x3c8f5c,_0x53fc28,_0x3ece4a,_0x2c19ce;_0x5a36b2[_0x644b('0x4e')]=intUtil[_0x644b('0x48')](_0x5a36b2[_0x644b('0x4e')]);_0x5a36b2['remoteUri']=intUtil[_0x644b('0x48')](_0x5a36b2[_0x644b('0x41')]);if(_0x25f9c1&&_0x25f9c1['recordingFormat']&&_0x25f9c1[_0x644b('0x5b')]!==_0x644b('0x5c')){logger['info']('[OUTBOUND]',_0x644b('0x4a'));_0x55dec3[_0x644b('0x4b')]=util[_0x644b('0x4c')](_0x644b('0x4d'),_0x5a36b2[_0x644b('0x4e')],_0x55dec3[_0x644b('0x4f')],md5(_0x55dec3[_0x644b('0x4f')]));}return getConnection(_0x5a36b2)['then'](function(_0x14cabd){_0x2c19ce=_0x14cabd;return getUser(_0x5a36b2,_0x1a5b92['email'],_0x2c19ce);})['then'](function(_0x12daba){_0x3c8f5c=_0x12daba;return getEndUser(_0x5a36b2,_0x3b76e6,_0x55dec3[_0x644b('0x5d')],_0x55dec3['destcalleridnum'],_0x2c19ce);})[_0x644b('0x23')](function(_0x27a5b3){_0x53fc28=_0x27a5b3;return getTicket(_0x5a36b2,_0x3c8f5c,_0x53fc28,_0x3b76e6,_0x55dec3,_0x3b76e6['Fields'],_0x2c19ce,_0x644b('0x5a'));})[_0x644b('0x23')](function(_0x3bff6a){_0x3ece4a=_0x3bff6a;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x3ece4a['id']);logger[_0x644b('0x1e')](_0x644b('0x5e'),_0x3ece4a['id'],_0x1a5b92[_0x644b('0x3d')],_0x5a36b2[_0x644b('0x3a')]);switch(_0x5a36b2[_0x644b('0x3a')]){case _0x644b('0x51'):emit(util[_0x644b('0x4c')](_0x644b('0x52'),_0x1a5b92[_0x644b('0x3d')]),_0x644b('0x53'),{'recordId':_0x3ece4a['id']});break;case _0x644b('0x54'):emit(util['format'](_0x644b('0x52'),_0x1a5b92[_0x644b('0x3d')]),_0x644b('0x55'),{'uri':util[_0x644b('0x4c')](_0x644b('0x56'),_0x2c19ce[_0x644b('0x5f')],_0x3ece4a['id'])});break;default:logger[_0x644b('0x57')]('[OUTBOUND]',_0x644b('0x60'));}})[_0x644b('0x61')](function(_0x115e12){logger[_0x644b('0x57')](_0x644b('0x62'),JSON[_0x644b('0x59')](_0x115e12));});};exports['unmanaged']=function(_0xc78a14,_0x59f480,_0x402fa6,_0xaeb235,_0x4a70d1,_0x4fde95){var _0x3f94a3,_0xee80c8,_0x605563,_0x3ae251;_0x4fde95[_0x644b('0x4e')]=intUtil['stripTrailingSlash'](_0x4fde95[_0x644b('0x4e')]);_0x4fde95[_0x644b('0x41')]=intUtil[_0x644b('0x48')](_0x4fde95[_0x644b('0x41')]);if(_0x4a70d1&&_0x4a70d1['monitor_format']){logger['info']('['+_0x59f480[_0x644b('0x63')][_0x644b('0x64')]()+']',_0x644b('0x4a'));_0x59f480[_0x644b('0x4b')]=util[_0x644b('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4fde95[_0x644b('0x4e')],_0x59f480[_0x644b('0x4f')],md5(_0x59f480['uniqueid']));}else{_0x59f480['recordingURL']='';}return getConnection(_0x4fde95)[_0x644b('0x23')](function(_0xe52e08){_0x3ae251=_0xe52e08;if(!_[_0x644b('0x17')](_0xaeb235)){return getUser(_0x4fde95,_0xaeb235[_0x644b('0x3d')],_0x3ae251);}else{return getUser(_0x4fde95,null,_0x3ae251);}})[_0x644b('0x23')](function(_0x20fcf6){_0x3f94a3=_0x20fcf6;return getEndUser(_0x4fde95,_0x402fa6,_0x59f480['calleridname'],_0x59f480[_0x644b('0x65')],_0x3ae251);})[_0x644b('0x23')](function(_0x2ded85){_0xee80c8=_0x2ded85;return getTicket(_0x4fde95,_0x3f94a3,_0xee80c8,_0x402fa6,_0x59f480,_0x402fa6[_0x644b('0x66')],_0x3ae251);})[_0x644b('0x23')](function(_0xcec1d3){_0x605563=_0xcec1d3;logger[_0x644b('0x1e')]('['+_0x59f480[_0x644b('0x63')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x605563['id']);logger['info']('['+_0x59f480[_0x644b('0x63')][_0x644b('0x64')]()+_0x644b('0x67'),_0x4fde95['type']);})[_0x644b('0x61')](function(_0x123560){logger[_0x644b('0x57')]('['+_0x59f480[_0x644b('0x63')]['toUpperCase']()+']',JSON[_0x644b('0x59')](_0x123560));});}; \ 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 fe9a74f..84384cb 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 _0x2ef3=['userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','catch','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','message','info','validateEmail'];(function(_0x526a3f,_0x148002){var _0x3a9587=function(_0x157028){while(--_0x157028){_0x526a3f['push'](_0x526a3f['shift']());}};_0x3a9587(++_0x148002);}(_0x2ef3,0xba));var _0x32ef=function(_0x39f12d,_0x2a0295){_0x39f12d=_0x39f12d-0x0;var _0x91e2a1=_0x2ef3[_0x39f12d];return _0x91e2a1;};'use strict';var _=require(_0x32ef('0x0'));var Promise=require(_0x32ef('0x1'));var rp=require(_0x32ef('0x2'));var util=require(_0x32ef('0x3'));var md5=require(_0x32ef('0x4'));var Redis=require(_0x32ef('0x5'));var intUtil=require('./util');var config=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('servicenow');config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));function getAdminUser(_0x367c39,_0x2fb8eb,_0x234863,_0x298066,_0x2484a0,_0x2bbb50){return new Promise(function(_0x28275c,_0x77df79){var _0x56eb42={'method':'GET','uri':_0x298066+_0x32ef('0xb')+'&'+_0x2484a0+'&'+_0x2bbb50,'auth':_0x2fb8eb,'json':!![]};return rp(_0x56eb42)[_0x32ef('0xc')](function(_0x45bfd5){if(_0x45bfd5[_0x32ef('0xd')]['length']>0x0){_0x234863[_0x32ef('0xe')]=_0x45bfd5['result'][0x0][_0x32ef('0xf')];}logger['info']('['+[_0x367c39[_0x32ef('0x10')]()]+_0x32ef('0x11'),_0x234863);_0x28275c(_0x234863);})['catch'](function(_0x539d18){logger[_0x32ef('0x12')]('['+[_0x367c39['toUpperCase']()]+']',_0x539d18[_0x32ef('0x13')]);_0x77df79(_0x539d18[_0x32ef('0x13')]);});});}function getUser(_0x93d492,_0x54c7f5,_0x57aff1,_0x55bf0b,_0x531e30){return function(_0x13db1a){logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x13db1a);return new Promise(function(_0x5d559b,_0x1eb468){if(intUtil[_0x32ef('0x15')](_0x13db1a[_0x32ef('0x16')])){var _0x57863c={'method':_0x32ef('0x17'),'uri':_0x57aff1+_0x32ef('0x18')+_0x13db1a['userEmail']+'&'+_0x55bf0b+'&'+_0x531e30,'auth':_0x54c7f5,'json':!![]};logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x19'),_0x57863c);return rp(_0x57863c)[_0x32ef('0xc')](function(_0x445cda){logger[_0x32ef('0x14')]('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1a'),_0x445cda);if(_0x445cda['result'][_0x32ef('0x1b')]>0x0&&String(_0x445cda[_0x32ef('0xd')][0x0]['active'])===_0x32ef('0x1c')){_0x13db1a[_0x32ef('0x1d')]=_0x445cda[_0x32ef('0xd')][0x0]['sys_id'];}else{_0x13db1a['userId']=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];}logger['info']('['+[_0x93d492['toUpperCase']()]+_0x32ef('0x1f'),_0x13db1a);_0x5d559b(_0x13db1a);})['catch'](function(_0x51a412){logger[_0x32ef('0x12')]('['+[_0x93d492[_0x32ef('0x10')]()]+']',_0x51a412[_0x32ef('0x13')]);_0x1eb468(_0x51a412[_0x32ef('0x13')]);});}else{logger[_0x32ef('0x14')]('['+[_0x93d492[_0x32ef('0x10')]()]+_0x32ef('0x20'));_0x13db1a[_0x32ef('0x1d')]=_0x13db1a[_0x32ef('0xe')];_0x13db1a[_0x32ef('0x16')]=_0x13db1a[_0x32ef('0x1e')];_0x5d559b(_0x13db1a);}});};}function createEndUser(_0xba4b3f,_0x5a88a5,_0xd65fde,_0x2f5d06,_0x5a04cd){logger[_0x32ef('0x14')]('['+[_0xba4b3f[_0x32ef('0x10')]()]+_0x32ef('0x21'),_0xd65fde);return new Promise(function(_0x26e207,_0x50a95b){var _0x10e38c={'method':_0x32ef('0x22'),'uri':_0x2f5d06+_0x32ef('0x23')+_0x5a04cd,'body':{'user_name':_0xd65fde[_0x32ef('0x24')],'roles':_0x32ef('0x25'),'first_name':_0xd65fde[_0x32ef('0x24')],'active':_0x32ef('0x1c'),'date_format':'System','phone':_0xd65fde[_0x32ef('0x24')]},'auth':_0x5a88a5,'json':!![]};return rp(_0x10e38c)['then'](function(_0x38bf73){logger[_0x32ef('0x14')]('['+[_0xba4b3f['toUpperCase']()]+_0x32ef('0x26'),_0x38bf73[_0x32ef('0xd')]);_0xd65fde[_0x32ef('0x27')]=_0x38bf73[_0x32ef('0xd')][_0x32ef('0xf')];_0x26e207(_0xd65fde);})['catch'](function(_0x50ecd6){logger[_0x32ef('0x12')]('['+[_0xba4b3f['toUpperCase']()]+']',_0x50ecd6[_0x32ef('0x13')]);_0x50a95b(_0x50ecd6[_0x32ef('0x13')]);});});}function getEndUser(_0x2f1349,_0x390670,_0x389583,_0x22fa1a,_0x566b56){return function(_0x482d3a){logger['info']('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x28'),_0x482d3a);return new Promise(function(_0x136b02,_0x5f2443){var _0x4fb402={'method':_0x32ef('0x17'),'uri':_0x389583+_0x32ef('0x29')+_0x482d3a[_0x32ef('0x24')]+'&'+_0x22fa1a+'&'+_0x566b56,'auth':_0x390670,'json':!![]};return rp(_0x4fb402)['then'](function(_0x4abbd6){if(_0x4abbd6[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){_0x482d3a[_0x32ef('0x27')]=_0x4abbd6[_0x32ef('0xd')][0x0][_0x32ef('0xf')];logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2a'),_0x482d3a);_0x136b02(_0x482d3a);}else{return createEndUser(_0x2f1349,_0x390670,_0x482d3a,_0x389583,_0x22fa1a)[_0x32ef('0xc')](function(_0x4de939){logger[_0x32ef('0x14')]('['+[_0x2f1349[_0x32ef('0x10')]()]+_0x32ef('0x2b'),_0x4de939);_0x136b02(_0x4de939);});}})['catch'](function(_0x365125){logger[_0x32ef('0x12')]('['+[_0x2f1349[_0x32ef('0x10')]()]+']',_0x365125[_0x32ef('0x13')]);_0x5f2443(_0x365125[_0x32ef('0x13')]);});});};}function getCustomFields(_0x33a0fb,_0x256c40){var _0x1cebed={};if(_0x33a0fb[_0x32ef('0x1b')]>0x0){_[_0x32ef('0x2c')](_0x33a0fb,function(_0xb4db74){if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74[_0x32ef('0x2e')]&&!_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]==='string'&&_0xb4db74['idField']&&_0xb4db74[_0x32ef('0x2f')]){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0xb4db74[_0x32ef('0x32')]['toString']();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x34')&&_0xb4db74['variableName']&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')][_0x32ef('0x31')]()]=_0x256c40[_0xb4db74[_0x32ef('0x35')]][_0x32ef('0x33')]();}else if(_0xb4db74[_0x32ef('0x2d')]===_0x32ef('0x36')&&_0xb4db74[_0x32ef('0x37')]&&_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')]&&_0xb4db74[_0x32ef('0x30')]&&_0xb4db74['customField']){_0x1cebed[_0xb4db74[_0x32ef('0x30')]['toLowerCase']()]=_0x256c40[_0xb4db74[_0x32ef('0x37')][_0x32ef('0x38')][_0x32ef('0x31')]()]['toString']();}});}return _0x1cebed;}function getTicket(_0x502113,_0x230ac9,_0x37b954,_0x241f82,_0x35b4e0,_0x40bf12){return function(_0x12c9e6){logger['info']('['+[_0x502113['toUpperCase']()]+_0x32ef('0x39'),_0x12c9e6);return new Promise(function(_0x270826,_0x27d65b){var _0x13b270=_0x502113[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x12c9e6[_0x32ef('0x1d')]:_0x12c9e6[_0x32ef('0x27')];var _0xc10e7={'method':_0x32ef('0x22'),'uri':_0x37b954+_0x32ef('0x3b')+'?'+_0x40bf12,'body':Object[_0x32ef('0x3c')]({},{'active':_0x32ef('0x1c'),'caller_id':_0x13b270,'assigned_to':_0x12c9e6['userId'],'short_description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3e')],_0x35b4e0,'\x20'),'description':intUtil[_0x32ef('0x3d')](_0x241f82[_0x32ef('0x3f')],_0x35b4e0,'\x0a')},getCustomFields(_0x241f82[_0x32ef('0x40')],_0x35b4e0)),'auth':_0x230ac9,'json':!![]};return rp(_0xc10e7)[_0x32ef('0xc')](function(_0x278696){logger[_0x32ef('0x14')]('['+[_0x502113[_0x32ef('0x10')]()]+_0x32ef('0x41'),_0x278696[_0x32ef('0xd')]);_0x12c9e6[_0x32ef('0x42')]=_0x278696[_0x32ef('0xd')][_0x32ef('0xf')];_0x12c9e6[_0x32ef('0x43')]=_0x278696[_0x32ef('0xd')][_0x32ef('0x44')];logger[_0x32ef('0x14')]('['+[_0x502113['toUpperCase']()]+']\x20getTicket\x20crm',_0x12c9e6);_0x270826(_0x12c9e6);})[_0x32ef('0x45')](function(_0x259c32){logger[_0x32ef('0x12')]('['+[_0x502113[_0x32ef('0x10')]()]+']',_0x259c32[_0x32ef('0x13')]);_0x27d65b(_0x259c32[_0x32ef('0x13')]);});});};}function createRemoteTag(_0x1572d9,_0x1f105a,_0x15b640,_0x368bf1){return new Promise(function(_0x3697a7,_0x4a6fd2){var _0x21216d={'method':_0x32ef('0x22'),'uri':_0x15b640+_0x32ef('0x46')+'?'+_0x368bf1,'body':{'short_description':_0x1572d9,'global':!![],'active':!![],'name':_0x1572d9},'auth':_0x1f105a,'json':!![]};return rp(_0x21216d)[_0x32ef('0xc')](function(_0x38314a){var _0x387cf0=_0x38314a['result'][_0x32ef('0xf')];_0x3697a7(_0x387cf0);});});}function getRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa,_0x52692a){return new Promise(function(_0x2ee3dd,_0xbe35b){var _0x579bc1={'method':_0x32ef('0x17'),'uri':_0x56b7ce+'label'+_0x32ef('0x47')+_0x1eeb3e+'&'+_0x1b0faa,'auth':_0x31d5d8,'json':!![]};return rp(_0x579bc1)[_0x32ef('0xc')](function(_0x2bff39){if(_0x2bff39[_0x32ef('0xd')][_0x32ef('0x1b')]>0x0){var _0x30e377=_0x2bff39[_0x32ef('0xd')][0x0]['sys_id'];_0x2ee3dd(_0x30e377);}else{return createRemoteTag(_0x1eeb3e,_0x31d5d8,_0x56b7ce,_0x1b0faa)['then'](function(_0xdfa103){_0x2ee3dd(_0xdfa103);});}});});}function assignTagToIncident(_0x52232a,_0x4fbab6,_0xb519e9,_0x89d0b3,_0x2ef0f8){return new Promise(function(_0x6aae59,_0x2468e6){var _0x356704={'method':_0x32ef('0x22'),'uri':_0xb519e9+_0x32ef('0x48')+'?'+_0x2ef0f8,'body':{'label':_0x52232a,'table':_0x32ef('0x3b'),'id_type':_0x32ef('0x49'),'table_key':_0x89d0b3['ticketId'],'title':'Incident\x20-\x20'+_0x89d0b3[_0x32ef('0x43')],'id_display':_0x89d0b3[_0x32ef('0x43')]},'auth':_0x4fbab6,'json':!![]};return rp(_0x356704)['then'](function(_0xda1d1){_0x6aae59();})[_0x32ef('0x45')](function(){_0x6aae59();});});}function manageTags(_0x2b5703,_0x49c245,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0,_0x5e6030){return new Promise(function(_0x13ea1a,_0x47d8bf){var _0x17f447=[];_0x49c245['forEach'](function(_0x58b652){_0x17f447[_0x32ef('0x4a')](getRemoteTag(_0x58b652,_0x2ac877,_0x3c31d0,_0x52dfe0,_0x5e6030));});return Promise[_0x32ef('0x4b')](_0x17f447)[_0x32ef('0xc')](function(_0x5dca6a){if(_0x5dca6a[_0x32ef('0x1b')]){logger[_0x32ef('0x14')]('['+[_0x2b5703[_0x32ef('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5dca6a);var _0x4557ce=[];_0x5dca6a[_0x32ef('0x2c')](function(_0x4c3bab){_0x4557ce['push'](assignTagToIncident(_0x4c3bab,_0x2ac877,_0x3c31d0,_0x20dcc5,_0x52dfe0));});return Promise[_0x32ef('0x4b')](_0x4557ce)[_0x32ef('0xc')](function(){_0x13ea1a();})[_0x32ef('0x45')](function(){_0x13ea1a();});}else{_0x13ea1a();}});});}function getTags(_0x339625,_0x4c4df8,_0x40700e,_0x4c89e8,_0x285330,_0x63b65){return function(_0x25b6d6){return new Promise(function(_0x36ed97,_0x21e930){var _0x340861=[];var _0x1dc755=_0x4c89e8[_0x32ef('0x4c')];if(_0x1dc755&&_0x1dc755[_0x32ef('0x1b')]>0x0){_0x340861=_['map'](_0x1dc755,_0x32ef('0x38'));}if(_0x340861[_0x32ef('0x1b')]>0x0){return manageTags(_0x339625,_0x340861,_0x4c4df8,_0x40700e,_0x25b6d6,_0x285330,_0x63b65)[_0x32ef('0xc')](function(){_0x36ed97(_0x25b6d6);});}else{_0x36ed97(_0x25b6d6);}});};}function emit(_0x1c629d,_0x79ae28,_0x5ad75c){var _0x47c0ed=_0x32ef('0x4d')+_0x32ef('0x4e')+_0x32ef('0x4f')+_0x32ef('0x50');var _0x1a8bad={'uri':_0x1c629d+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5ad75c+_0x47c0ed};io['to'](util[_0x32ef('0x51')]('user:%s',_0x79ae28))[_0x32ef('0x52')](_0x32ef('0x53'),_0x1a8bad);}exports['cs']=function(_0x48b6f4,_0x5402b4,_0x2c9f7a,_0x1538d0,_0x2e0873,_0x5b378b,_0x52b63b,_0x3b4a8e){var _0x5edd29={};var _0x7d2c3a={'user':_0x5b378b[_0x32ef('0x54')],'pass':_0x5b378b['password']};var _0x476bbf=_0x32ef('0x55');var _0x974974=_0x32ef('0x56');_0x5b378b[_0x32ef('0x57')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x57')]);_0x5b378b[_0x32ef('0x59')]=intUtil[_0x32ef('0x58')](_0x5b378b[_0x32ef('0x59')]);var _0x132d9f=util[_0x32ef('0x51')]('%s/api/now/table/',_0x5b378b['remoteUri']);_0x5edd29[_0x32ef('0x16')]=!_[_0x32ef('0x5a')](_0x1538d0)?_0x1538d0['email']:null;_0x5edd29[_0x32ef('0x1e')]=_0x5b378b['email'];_0x5edd29[_0x32ef('0x24')]=_0x3b4a8e[_0x32ef('0x31')]()===_0x32ef('0x3a')?_0x5402b4['destcalleridnum']:_0x5402b4[_0x32ef('0x5b')];_0x5edd29['callDirection']=_0x3b4a8e===_0x32ef('0x5c')||_0x3b4a8e===_0x32ef('0x5d')?'queue':'outbound';var _0x3c9039=util['format'](_0x32ef('0x5e'),_0x5b378b['serverUrl'],_0x5402b4[_0x32ef('0x5f')],md5(_0x5402b4[_0x32ef('0x5f')]));if(_0x2e0873&&_0x2e0873[_0x32ef('0x60')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else if(_0x52b63b&&_0x52b63b['recordingFormat']&&_0x52b63b[_0x32ef('0x62')]!==_0x32ef('0x63')){logger[_0x32ef('0x14')](_0x32ef('0x64'),_0x32ef('0x65'));_0x5402b4[_0x32ef('0x61')]=_0x3c9039;}else{_0x5402b4['recordingURL']='';}return getAdminUser(_0x3b4a8e,_0x7d2c3a,_0x5edd29,_0x132d9f,_0x974974,_0x476bbf)[_0x32ef('0xc')](getUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getEndUser(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x974974,_0x476bbf))['then'](getTicket(_0x3b4a8e,_0x7d2c3a,_0x132d9f,_0x2c9f7a,_0x5402b4,_0x974974))[_0x32ef('0xc')](function(_0x5c4f2a){logger[_0x32ef('0x14')](util[_0x32ef('0x51')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c4f2a[_0x32ef('0x42')]));logger[_0x32ef('0x14')](util[_0x32ef('0x51')](_0x32ef('0x66'),_0x3b4a8e));if(_0x3b4a8e!==_0x32ef('0x5d')){logger[_0x32ef('0x14')]('['+[_0x3b4a8e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b378b[_0x32ef('0x57')],_0x1538d0['name'],_0x5c4f2a[_0x32ef('0x42')]);}})[_0x32ef('0x45')](function(_0x114d8e){logger[_0x32ef('0x12')]('['+[_0x3b4a8e[_0x32ef('0x10')]()]+_0x32ef('0x67'),util['inspect'](_0x114d8e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x814b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','Variable','name','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','ticketId','Incident\x20-\x20','forEach','push','all','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','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged'];(function(_0x3b9c6f,_0x30ef61){var _0x48d2a9=function(_0x468501){while(--_0x468501){_0x3b9c6f['push'](_0x3b9c6f['shift']());}};_0x48d2a9(++_0x30ef61);}(_0x814b,0x1a2));var _0xb814=function(_0x153c6a,_0x2a217a){_0x153c6a=_0x153c6a-0x0;var _0xce898f=_0x814b[_0x153c6a];return _0xce898f;};'use strict';var _=require(_0xb814('0x0'));var Promise=require(_0xb814('0x1'));var rp=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var md5=require(_0xb814('0x4'));var Redis=require(_0xb814('0x5'));var intUtil=require('./util');var config=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));config[_0xb814('0x9')]=_[_0xb814('0xa')](config[_0xb814('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb814('0xb'))(new Redis(config[_0xb814('0x9')]));function getAdminUser(_0x5c8539,_0x271af9,_0x2913a6,_0x186d5a,_0x41166c,_0x1fea33){return new Promise(function(_0x21d4a5,_0x1086f8){var _0x19aad8={'method':_0xb814('0xc'),'uri':_0x186d5a+_0xb814('0xd')+'&'+_0x41166c+'&'+_0x1fea33,'auth':_0x271af9,'json':!![]};return rp(_0x19aad8)[_0xb814('0xe')](function(_0x4b5f14){if(_0x4b5f14[_0xb814('0xf')]['length']>0x0){_0x2913a6[_0xb814('0x10')]=_0x4b5f14[_0xb814('0xf')][0x0][_0xb814('0x11')];}logger[_0xb814('0x12')]('['+[_0x5c8539[_0xb814('0x13')]()]+_0xb814('0x14'),_0x2913a6);_0x21d4a5(_0x2913a6);})[_0xb814('0x15')](function(_0x41ed7b){logger[_0xb814('0x16')]('['+[_0x5c8539[_0xb814('0x13')]()]+']',_0x41ed7b[_0xb814('0x17')]);_0x1086f8(_0x41ed7b[_0xb814('0x17')]);});});}function getUser(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6,_0x45e0d0){return function(_0x265a83){logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x18'),_0x265a83);return new Promise(function(_0x48c9df,_0x168a48){if(intUtil['validateEmail'](_0x265a83[_0xb814('0x19')])){var _0xfac75b={'method':'GET','uri':_0x303aca+'sys_user?sysparm_query=email%3D'+_0x265a83['userEmail']+'&'+_0x3a71d6+'&'+_0x45e0d0,'auth':_0x39bfcf,'json':!![]};logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xfac75b);return rp(_0xfac75b)[_0xb814('0xe')](function(_0x24211d){logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+_0xb814('0x1a'),_0x24211d);if(_0x24211d['result'][_0xb814('0x1b')]>0x0&&String(_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x1c')])===_0xb814('0x1d')){_0x265a83[_0xb814('0x1e')]=_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x11')];}else{_0x265a83['userId']=_0x265a83[_0xb814('0x10')];_0x265a83['userEmail']=_0x265a83[_0xb814('0x1f')];}logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x20'),_0x265a83);_0x48c9df(_0x265a83);})[_0xb814('0x15')](function(_0xb9e57d){logger[_0xb814('0x16')]('['+[_0x17f5bd['toUpperCase']()]+']',_0xb9e57d[_0xb814('0x17')]);_0x168a48(_0xb9e57d[_0xb814('0x17')]);});}else{logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x21'));_0x265a83[_0xb814('0x1e')]=_0x265a83[_0xb814('0x10')];_0x265a83[_0xb814('0x19')]=_0x265a83['adminEmail'];_0x48c9df(_0x265a83);}});};}function createEndUser(_0x271aa8,_0x328a08,_0x52ed64,_0x9008b2,_0x37d24d){logger[_0xb814('0x12')]('['+[_0x271aa8['toUpperCase']()]+_0xb814('0x22'),_0x52ed64);return new Promise(function(_0x2051d0,_0x58c3ca){var _0x338a28={'method':'POST','uri':_0x9008b2+_0xb814('0x23')+_0x37d24d,'body':{'user_name':_0x52ed64['endUserNumber'],'roles':'user','first_name':_0x52ed64[_0xb814('0x24')],'active':'true','date_format':_0xb814('0x25'),'phone':_0x52ed64[_0xb814('0x24')]},'auth':_0x328a08,'json':!![]};return rp(_0x338a28)[_0xb814('0xe')](function(_0x599f9f){logger['info']('['+[_0x271aa8[_0xb814('0x13')]()]+_0xb814('0x26'),_0x599f9f['result']);_0x52ed64[_0xb814('0x27')]=_0x599f9f[_0xb814('0xf')][_0xb814('0x11')];_0x2051d0(_0x52ed64);})[_0xb814('0x15')](function(_0x1b78de){logger[_0xb814('0x16')]('['+[_0x271aa8[_0xb814('0x13')]()]+']',_0x1b78de['message']);_0x58c3ca(_0x1b78de[_0xb814('0x17')]);});});}function getEndUser(_0x2263f6,_0x30de5a,_0x424e2b,_0x14100d,_0x4ff31a){return function(_0x16ef82){logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+_0xb814('0x28'),_0x16ef82);return new Promise(function(_0xe0f509,_0x492d5e){var _0x40b885={'method':_0xb814('0xc'),'uri':_0x424e2b+'sys_user?sysparm_query=phone%3D'+_0x16ef82[_0xb814('0x24')]+'&'+_0x14100d+'&'+_0x4ff31a,'auth':_0x30de5a,'json':!![]};return rp(_0x40b885)[_0xb814('0xe')](function(_0x1a8bd0){if(_0x1a8bd0[_0xb814('0xf')][_0xb814('0x1b')]>0x0){_0x16ef82[_0xb814('0x27')]=_0x1a8bd0['result'][0x0][_0xb814('0x11')];logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20getEndUser\x20crm',_0x16ef82);_0xe0f509(_0x16ef82);}else{return createEndUser(_0x2263f6,_0x30de5a,_0x16ef82,_0x424e2b,_0x14100d)[_0xb814('0xe')](function(_0x4b9233){logger[_0xb814('0x12')]('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20createEndUser\x20crm',_0x4b9233);_0xe0f509(_0x4b9233);});}})['catch'](function(_0x5dd6bc){logger['error']('['+[_0x2263f6[_0xb814('0x13')]()]+']',_0x5dd6bc[_0xb814('0x17')]);_0x492d5e(_0x5dd6bc[_0xb814('0x17')]);});});};}function getCustomFields(_0x42c2ed,_0x51cdba){var _0x47d782={};if(_0x42c2ed[_0xb814('0x1b')]>0x0){_['forEach'](_0x42c2ed,function(_0x2a93da){if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x2a')&&_0x2a93da[_0xb814('0x2b')]&&!_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x2a93da[_0xb814('0x2f')][_0xb814('0x30')]();}else if(_0x2a93da['type']==='string'&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da['idField'][_0xb814('0x2e')]()]=_0x2a93da['content'][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x31')&&_0x2a93da[_0xb814('0x32')]&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da[_0xb814('0x32')]][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]==='customVariable'&&_0x2a93da[_0xb814('0x33')]&&_0x2a93da[_0xb814('0x33')][_0xb814('0x34')]&&_0x2a93da[_0xb814('0x2d')]&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da['Variable']['name'][_0xb814('0x2e')]()][_0xb814('0x30')]();}});}return _0x47d782;}function getTicket(_0x4c08d6,_0x2bf906,_0x43f1b,_0x40e627,_0x24b697,_0x40af85){return function(_0x2eb9b6){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x2eb9b6);return new Promise(function(_0x37800a,_0x17510c){var _0x4a76bb=_0x4c08d6[_0xb814('0x2e')]()==='outbound'?_0x2eb9b6[_0xb814('0x1e')]:_0x2eb9b6[_0xb814('0x27')];var _0xc71270={'method':_0xb814('0x35'),'uri':_0x43f1b+_0xb814('0x36')+'?'+_0x40af85,'body':Object[_0xb814('0x37')]({},{'active':_0xb814('0x1d'),'caller_id':_0x4a76bb,'assigned_to':_0x2eb9b6[_0xb814('0x1e')],'short_description':intUtil[_0xb814('0x38')](_0x40e627[_0xb814('0x39')],_0x24b697,'\x20'),'description':intUtil['getString'](_0x40e627['Descriptions'],_0x24b697,'\x0a')},getCustomFields(_0x40e627[_0xb814('0x3a')],_0x24b697)),'auth':_0x2bf906,'json':!![]};return rp(_0xc71270)[_0xb814('0xe')](function(_0x4156d8){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+_0xb814('0x3b'),_0x4156d8[_0xb814('0xf')]);_0x2eb9b6['ticketId']=_0x4156d8[_0xb814('0xf')][_0xb814('0x11')];_0x2eb9b6[_0xb814('0x3c')]=_0x4156d8['result'][_0xb814('0x3d')];logger['info']('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20crm',_0x2eb9b6);_0x37800a(_0x2eb9b6);})[_0xb814('0x15')](function(_0x3cf8f8){logger['error']('['+[_0x4c08d6[_0xb814('0x13')]()]+']',_0x3cf8f8[_0xb814('0x17')]);_0x17510c(_0x3cf8f8[_0xb814('0x17')]);});});};}function createRemoteTag(_0x5209d1,_0x3da050,_0x5f0e58,_0x13bdcf){return new Promise(function(_0x158893,_0x4aed78){var _0x39952d={'method':'POST','uri':_0x5f0e58+'label'+'?'+_0x13bdcf,'body':{'short_description':_0x5209d1,'global':!![],'active':!![],'name':_0x5209d1},'auth':_0x3da050,'json':!![]};return rp(_0x39952d)[_0xb814('0xe')](function(_0x35f59a){var _0x34935b=_0x35f59a['result'][_0xb814('0x11')];_0x158893(_0x34935b);});});}function getRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5,_0x2db5a6){return new Promise(function(_0x5c32c2,_0x25a607){var _0x1656ed={'method':_0xb814('0xc'),'uri':_0x2174e5+_0xb814('0x3e')+_0xb814('0x3f')+_0x538b0f+'&'+_0x58d6e5,'auth':_0xf88d23,'json':!![]};return rp(_0x1656ed)[_0xb814('0xe')](function(_0x21d3e9){if(_0x21d3e9[_0xb814('0xf')]['length']>0x0){var _0x374532=_0x21d3e9[_0xb814('0xf')][0x0]['sys_id'];_0x5c32c2(_0x374532);}else{return createRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5)[_0xb814('0xe')](function(_0xe14249){_0x5c32c2(_0xe14249);});}});});}function assignTagToIncident(_0x4d13db,_0x371000,_0x58b9a6,_0x48362c,_0x2114ca){return new Promise(function(_0x5257be,_0x3ff213){var _0xd1cd8b={'method':_0xb814('0x35'),'uri':_0x58b9a6+'label_entry'+'?'+_0x2114ca,'body':{'label':_0x4d13db,'table':_0xb814('0x36'),'id_type':'Incident','table_key':_0x48362c[_0xb814('0x40')],'title':_0xb814('0x41')+_0x48362c[_0xb814('0x3c')],'id_display':_0x48362c[_0xb814('0x3c')]},'auth':_0x371000,'json':!![]};return rp(_0xd1cd8b)[_0xb814('0xe')](function(_0x3b374b){_0x5257be();})[_0xb814('0x15')](function(){_0x5257be();});});}function manageTags(_0x113350,_0x46014f,_0x4d611d,_0x211194,_0x111884,_0x3852ae,_0x1ac6d0){return new Promise(function(_0x3b35a8,_0x3d4843){var _0x52edfa=[];_0x46014f[_0xb814('0x42')](function(_0x4ccd94){_0x52edfa[_0xb814('0x43')](getRemoteTag(_0x4ccd94,_0x4d611d,_0x211194,_0x3852ae,_0x1ac6d0));});return Promise[_0xb814('0x44')](_0x52edfa)[_0xb814('0xe')](function(_0x4c884c){if(_0x4c884c[_0xb814('0x1b')]){logger['info']('['+[_0x113350[_0xb814('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4c884c);var _0x2f0c94=[];_0x4c884c[_0xb814('0x42')](function(_0xa03cd2){_0x2f0c94[_0xb814('0x43')](assignTagToIncident(_0xa03cd2,_0x4d611d,_0x211194,_0x111884,_0x3852ae));});return Promise[_0xb814('0x44')](_0x2f0c94)[_0xb814('0xe')](function(){_0x3b35a8();})[_0xb814('0x15')](function(){_0x3b35a8();});}else{_0x3b35a8();}});});}function getTags(_0x4d44e3,_0x44088d,_0x51ca51,_0x255047,_0x22c73f,_0x1b989d){return function(_0x3dcaeb){return new Promise(function(_0x19fa45,_0x139531){var _0x514dab=[];var _0x12882a=_0x255047[_0xb814('0x45')];if(_0x12882a&&_0x12882a['length']>0x0){_0x514dab=_[_0xb814('0x46')](_0x12882a,_0xb814('0x34'));}if(_0x514dab[_0xb814('0x1b')]>0x0){return manageTags(_0x4d44e3,_0x514dab,_0x44088d,_0x51ca51,_0x3dcaeb,_0x22c73f,_0x1b989d)[_0xb814('0xe')](function(){_0x19fa45(_0x3dcaeb);});}else{_0x19fa45(_0x3dcaeb);}});};}function emit(_0x2161eb,_0x51d834,_0x3a4d4b){var _0x5e8e8e=_0xb814('0x47')+_0xb814('0x48')+_0xb814('0x49')+_0xb814('0x4a');var _0x2e39b1={'uri':_0x2161eb+_0xb814('0x4b')+_0x3a4d4b+_0x5e8e8e};io['to'](util['format']('user:%s',_0x51d834))['emit'](_0xb814('0x4c'),_0x2e39b1);}exports['cs']=function(_0x490e5c,_0x45a8b9,_0x1d3954,_0x25db89,_0x5e966c,_0x1b76fa,_0x3e5ce8,_0xee204){var _0x5aabbe={};var _0x30f717={'user':_0x1b76fa[_0xb814('0x4d')],'pass':_0x1b76fa[_0xb814('0x4e')]};var _0x3564e0='sysparm_limit=1';var _0x5dedd7=_0xb814('0x4f');_0x1b76fa[_0xb814('0x50')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x50')]);_0x1b76fa[_0xb814('0x52')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x52')]);var _0xe47442=util[_0xb814('0x53')](_0xb814('0x54'),_0x1b76fa[_0xb814('0x50')]);_0x5aabbe[_0xb814('0x19')]=!_[_0xb814('0x55')](_0x25db89)?_0x25db89[_0xb814('0x56')]:null;_0x5aabbe[_0xb814('0x1f')]=_0x1b76fa['email'];_0x5aabbe[_0xb814('0x24')]=_0xee204[_0xb814('0x2e')]()===_0xb814('0x57')?_0x45a8b9[_0xb814('0x58')]:_0x45a8b9[_0xb814('0x59')];_0x5aabbe[_0xb814('0x5a')]=_0xee204==='queue'||_0xee204===_0xb814('0x5b')?'queue':_0xb814('0x57');var _0x39aa00=util[_0xb814('0x53')](_0xb814('0x5c'),_0x1b76fa[_0xb814('0x52')],_0x45a8b9['uniqueid'],md5(_0x45a8b9['uniqueid']));if(_0x5e966c&&_0x5e966c[_0xb814('0x5d')]){logger[_0xb814('0x12')](_0xb814('0x5e'),_0xb814('0x5f'));_0x45a8b9['recordingURL']=_0x39aa00;}else if(_0x3e5ce8&&_0x3e5ce8[_0xb814('0x60')]&&_0x3e5ce8['recordingFormat']!==_0xb814('0x61')){logger[_0xb814('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x45a8b9[_0xb814('0x62')]=_0x39aa00;}else{_0x45a8b9['recordingURL']='';}return getAdminUser(_0xee204,_0x30f717,_0x5aabbe,_0xe47442,_0x5dedd7,_0x3564e0)[_0xb814('0xe')](getUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getEndUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getTicket(_0xee204,_0x30f717,_0xe47442,_0x1d3954,_0x45a8b9,_0x5dedd7))[_0xb814('0xe')](function(_0x46784f){logger[_0xb814('0x12')](util[_0xb814('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x46784f[_0xb814('0x40')]));logger['info'](util[_0xb814('0x53')]('call\x20direction:\x20%s',_0xee204));if(_0xee204!==_0xb814('0x5b')){logger[_0xb814('0x12')]('['+[_0xee204['toUpperCase']()]+']',_0xb814('0x63'));emit(_0x1b76fa['remoteUri'],_0x25db89[_0xb814('0x34')],_0x46784f[_0xb814('0x40')]);}})['catch'](function(_0x5a0c4a){logger[_0xb814('0x16')]('['+[_0xee204[_0xb814('0x13')]()]+_0xb814('0x64'),util[_0xb814('0x65')](_0x5a0c4a,{'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 6d6dbbb..4df2944 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 _0xa613=['none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','users','contacts','trigger:browser:url','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','calleridname','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','toISOString','duration_hours','parent_id','Contacts','parent_name','direction','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','info','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','type','string','nameField','content','custom_fields','push','variable','Variable','customField','toLowerCase','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound'];(function(_0x340e23,_0x283003){var _0x34575b=function(_0x4ee0e9){while(--_0x4ee0e9){_0x340e23['push'](_0x340e23['shift']());}};_0x34575b(++_0x283003);}(_0xa613,0x8a));var _0x3a61=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0xa613[_0x4f5108];return _0x2d56ca;};'use strict';var _=require(_0x3a61('0x0'));var rp=require('request-promise');var BPromise=require(_0x3a61('0x1'));var md5=require(_0x3a61('0x2'));var util=require(_0x3a61('0x3'));var Redis=require(_0x3a61('0x4'));var intUtil=require(_0x3a61('0x5'));var config=require(_0x3a61('0x6'));var logger=require(_0x3a61('0x7'))(_0x3a61('0x8'));config[_0x3a61('0x9')]=_[_0x3a61('0xa')](config['redis'],{'host':_0x3a61('0xb'),'port':0x18eb});var io=require(_0x3a61('0xc'))(new Redis(config['redis']));var def={'method':_0x3a61('0xd'),'json':!![]};function emit(_0x255a69,_0x3c7bdd,_0x3040dd){io['to'](_0x255a69)[_0x3a61('0xe')](_0x3c7bdd,_0x3040dd);}function getTicket(_0x538238,_0x2ad63f,_0x357242,_0x5b0db1,_0x57be09,_0x56fbbc,_0x1c84c1,_0x3ab150){logger['info'](_0x3a61('0xf'));var _0x1a9226=new Date();var _0x425896=[{'name':_0x3a61('0x10'),'value':intUtil[_0x3a61('0x11')](_0x5b0db1[_0x3a61('0x12')],_0x57be09,'\x20')},{'name':'assigned_user_id','value':_0x2ad63f['id']},{'name':'created_by','value':_0x2ad63f['id']},{'name':_0x3a61('0x13'),'value':intUtil[_0x3a61('0x11')](_0x5b0db1[_0x3a61('0x14')],_0x57be09,'\x0a')},{'name':_0x3a61('0x15'),'value':_0x1a9226[_0x3a61('0x16')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x3a61('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x3a61('0x18'),'value':_0x357242['id']},{'name':'parent_type','value':_0x3a61('0x19')},{'name':_0x3a61('0x1a'),'value':_0x357242['name']},{'name':_0x3a61('0x1b'),'value':_0x3ab150}];if(_0x56fbbc['length']){_[_0x3a61('0x1c')](_0x56fbbc,function(_0x57e816){if(_0x57be09[_0x57e816[_0x3a61('0x1d')]]){_0x425896['push']({'name':_0x57e816[_0x3a61('0x1e')],'value':_0x57be09[_0x57e816[_0x3a61('0x1d')]]});}});}return request({'form':{'method':_0x3a61('0x1f'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'session':_0x1c84c1['id'],'module_name':_0x3a61('0x22'),'name_value_list':_0x425896})}});}function getAuth(_0x2186c7){return util[_0x3a61('0x23')](_0x3a61('0x24'),new Buffer(_0x2186c7[_0x3a61('0x25')]+':X')[_0x3a61('0x26')](_0x3a61('0x27')));}function getServerInfo(_0x188aaa){return request({'form':{'method':_0x3a61('0x28'),'input_type':'JSON','response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'session':_0x188aaa['id']})}});}function getUser(_0x4582e2,_0x1d649a,_0x5aaf73){if(!_[_0x3a61('0x29')](_0x1d649a)){logger['info'](_0x3a61('0x2a'),_0x1d649a);return request({'form':{'method':_0x3a61('0x2b'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'session':_0x5aaf73['id'],'module_name':_0x3a61('0x2c'),'query':util[_0x3a61('0x23')](_0x3a61('0x2d'),_0x1d649a),'order_by':'','offset':'0','select_fields':['id',_0x3a61('0x10'),_0x3a61('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3a61('0x2f')](function(_0x44b88b){if(_0x44b88b[_0x3a61('0x30')][_0x3a61('0x31')]){var _0x1baeb5=_[_0x3a61('0x32')](_0x44b88b[_0x3a61('0x30')],function(_0x13e7c1){return _0x13e7c1[_0x3a61('0x33')][_0x3a61('0x2e')]['value']===_0x1d649a;});if(_0x1baeb5){logger[_0x3a61('0x34')](_0x3a61('0x35'));return BPromise[_0x3a61('0x36')]({'id':_0x1baeb5[_0x3a61('0x33')]['id'][_0x3a61('0x37')],'name':_0x1baeb5[_0x3a61('0x33')][_0x3a61('0x10')][_0x3a61('0x37')]});}}logger[_0x3a61('0x34')](_0x3a61('0x38'));return BPromise[_0x3a61('0x36')]({'id':_0x5aaf73[_0x3a61('0x33')]['user_id'][_0x3a61('0x37')],'name':_0x5aaf73[_0x3a61('0x33')][_0x3a61('0x2e')][_0x3a61('0x37')]});});}else{logger[_0x3a61('0x34')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3a61('0x36')]({'id':_0x5aaf73['name_value_list'][_0x3a61('0x39')][_0x3a61('0x37')],'name':_0x5aaf73[_0x3a61('0x33')][_0x3a61('0x2e')][_0x3a61('0x37')]});}}function getEndUser(_0x4de980,_0x194428,_0x5988f4,_0x6322a5){logger[_0x3a61('0x34')]('Searching\x20enduser\x20with\x20phone',_0x5988f4);return request({'form':{'method':_0x3a61('0x2b'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON['stringify']({'session':_0x6322a5['id'],'module_name':_0x3a61('0x19'),'query':util[_0x3a61('0x23')](_0x3a61('0x3a'),_0x5988f4),'order_by':'','offset':'0','select_fields':['id',_0x3a61('0x10'),_0x3a61('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3a61('0x2f')](function(_0x10ea03){if(_0x10ea03[_0x3a61('0x30')][_0x3a61('0x31')]){var _0x2a126f=_[_0x3a61('0x32')](_0x10ea03['entry_list'],function(_0x18950a){return _0x18950a[_0x3a61('0x33')]['phone_home'][_0x3a61('0x37')]===_0x5988f4;});if(_0x2a126f){logger['info'](_0x3a61('0x3c'));return BPromise[_0x3a61('0x36')]({'id':_0x2a126f[_0x3a61('0x33')]['id'][_0x3a61('0x37')],'name':_0x2a126f[_0x3a61('0x33')][_0x3a61('0x10')][_0x3a61('0x37')],'phone':_0x2a126f[_0x3a61('0x33')][_0x3a61('0x3b')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x3a61('0x1f'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'session':_0x6322a5['id'],'module_name':_0x3a61('0x19'),'name_value_list':[{'name':'first_name','value':_0x194428!==_0x3a61('0x3d')?_0x194428:util[_0x3a61('0x23')](_0x3a61('0x3e'),_0x5988f4)},{'name':_0x3a61('0x3b'),'value':_0x5988f4}]})}})[_0x3a61('0x2f')](function(_0xa97ebe){logger[_0x3a61('0x34')](_0x3a61('0x3f'));return BPromise[_0x3a61('0x36')]({'id':_0xa97ebe['id'],'name':_0xa97ebe['entry_list'][_0x3a61('0x40')]['value'],'phone':_0xa97ebe[_0x3a61('0x30')]['phone_home'][_0x3a61('0x37')]});});}});}function request(_0xb0419c){logger[_0x3a61('0x41')](_0x3a61('0x42'),JSON[_0x3a61('0x21')](_0xb0419c));return rp(_[_0x3a61('0x43')](def,_0xb0419c));}function getTags(_0x290e82,_0x587304){var _0x36c0dc=[];if(_0x290e82&&_0x290e82[_0x3a61('0x31')]>0x0){_0x36c0dc=_['map'](_0x290e82,_0x587304);}return _0x36c0dc;}function getCustomFields(_0x371485,_0x482f5f){var _0x125d8e=[];var _0x4c29cf={'custom_fields':[]};if(_0x371485[_0x3a61('0x31')]>0x0){_[_0x3a61('0x1c')](_0x371485,function(_0x22056b){if(_0x22056b[_0x3a61('0x44')]===_0x3a61('0x45')&&_0x22056b['nameField']&&!_0x22056b['customField']){_0x4c29cf[_0x22056b[_0x3a61('0x46')]['toLowerCase']()]=_0x22056b[_0x3a61('0x47')][_0x3a61('0x26')]();}else if(_0x22056b[_0x3a61('0x44')]===_0x3a61('0x45')&&_0x22056b[_0x3a61('0x1e')]&&_0x22056b['customField']){_0x4c29cf[_0x3a61('0x48')][_0x3a61('0x49')]({'id':_0x22056b[_0x3a61('0x1e')],'value':_0x22056b[_0x3a61('0x47')][_0x3a61('0x26')]()});}else if(_0x22056b[_0x3a61('0x44')]===_0x3a61('0x4a')&&_0x22056b[_0x3a61('0x1d')]&&_0x22056b[_0x3a61('0x1e')]&&_0x22056b['customField']){_0x482f5f[_0x22056b[_0x3a61('0x1d')]]&&_0x4c29cf[_0x3a61('0x48')][_0x3a61('0x49')]({'id':_0x22056b['idField'],'value':_0x482f5f[_0x22056b['variableName']]['toString']()});}else if(_0x22056b['type']==='customVariable'&&_0x22056b[_0x3a61('0x4b')]&&_0x22056b[_0x3a61('0x4b')][_0x3a61('0x10')]&&_0x22056b[_0x3a61('0x1e')]&&_0x22056b[_0x3a61('0x4c')]){_0x482f5f[_0x22056b[_0x3a61('0x4b')][_0x3a61('0x10')][_0x3a61('0x4d')]()]&&_0x4c29cf['custom_fields'][_0x3a61('0x49')]({'id':_0x22056b[_0x3a61('0x1e')],'value':_0x482f5f[_0x22056b[_0x3a61('0x4b')][_0x3a61('0x10')][_0x3a61('0x4d')]()]['toString']()});}});}return _0x4c29cf;}function getConnection(_0x9247bf){return request({'method':'POST','form':{'method':_0x3a61('0x4e'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON[_0x3a61('0x21')]({'user_auth':{'user_name':_0x9247bf[_0x3a61('0x4f')],'password':_0x9247bf[_0x3a61('0x50')],'encryption':_0x3a61('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x3a61('0x2f')](function(_0x187655){var _0x5bca42=_0x187655;if(_0x5bca42['id']){def[_0x3a61('0x52')]=_0x5bca42['id'];return BPromise[_0x3a61('0x36')](_0x5bca42);}else{throw new Error(util['format'](_0x3a61('0x53'),_0x9247bf['id']));}});}function setRelationship(_0x33d515,_0x1b0a73,_0x3c7fb2,_0x290407){return request({'form':{'method':_0x3a61('0x54'),'input_type':_0x3a61('0x20'),'response_type':_0x3a61('0x20'),'rest_data':JSON['stringify']({'session':_0x33d515['id'],'module_name':_0x3a61('0x22'),'module_id':_0x3c7fb2['id'],'link_field_name':_0x290407,'related_ids':[_0x1b0a73['id']]})}});}exports[_0x3a61('0x55')]=function(_0x59da8a,_0x5e573e,_0xde02c6,_0x3b7ee3,_0x19b4b0,_0x599806){var _0x15cf6e,_0x4d0b73,_0x513913,_0x516c7c;_0x599806[_0x3a61('0x56')]=intUtil[_0x3a61('0x57')](_0x599806[_0x3a61('0x56')]);_0x599806[_0x3a61('0x58')]=intUtil['stripTrailingSlash'](_0x599806['serverUrl']);def[_0x3a61('0x59')]=util[_0x3a61('0x23')](_0x3a61('0x5a'),_0x599806[_0x3a61('0x56')]);if(_0x19b4b0&&_0x19b4b0[_0x3a61('0x5b')]){logger[_0x3a61('0x34')](_0x3a61('0x5c'),'Recording\x20is\x20enabled!');_0x5e573e[_0x3a61('0x5d')]=util[_0x3a61('0x23')](_0x3a61('0x5e'),_0x599806[_0x3a61('0x58')],_0x5e573e[_0x3a61('0x5f')],md5(_0x5e573e[_0x3a61('0x5f')]));}else{_0x5e573e['recordingURL']='';}return getConnection(_0x599806)[_0x3a61('0x2f')](function(_0x21ad1a){_0x516c7c=_0x21ad1a;return getUser(_0x599806,_0x3b7ee3['name'],_0x516c7c);})[_0x3a61('0x2f')](function(_0x521c22){_0x15cf6e=_0x521c22;logger[_0x3a61('0x34')](_0x3a61('0x60'),_0x15cf6e['id']);return getEndUser(_0x599806,_0x5e573e['calleridname'],_0x5e573e[_0x3a61('0x61')],_0x516c7c);})[_0x3a61('0x2f')](function(_0x29877b){_0x4d0b73=_0x29877b;logger['info'](_0x3a61('0x62'),_0x4d0b73['id']);return getTicket(_0x599806,_0x15cf6e,_0x4d0b73,_0xde02c6,_0x5e573e,_0xde02c6['Fields'],_0x516c7c,_0x3a61('0x63'));})['then'](function(_0x26f23e){_0x513913=_0x26f23e;logger[_0x3a61('0x34')]('Ticket\x20created!');logger[_0x3a61('0x34')](_0x3a61('0x64'),_0x513913['id']);return setRelationship(_0x516c7c,_0x15cf6e,_0x513913,'users');})[_0x3a61('0x2f')](function(){return setRelationship(_0x516c7c,_0x4d0b73,_0x513913,'contacts');})[_0x3a61('0x2f')](function(){return getServerInfo(_0x516c7c);})[_0x3a61('0x2f')](function(_0x3c94f6){var _0x131a3e=parseInt(_0x3c94f6[_0x3a61('0x65')][_0x3a61('0x66')](0x0));var _0xbb0986=util[_0x3a61('0x23')](_0x3a61('0x67'),_0x599806[_0x3a61('0x56')],_0x513913['id']);if(_0x131a3e>0x6){_0xbb0986=util[_0x3a61('0x23')](_0x3a61('0x68'),_0x599806['remoteUri'],_0x513913['id']);}logger['info'](_0x3a61('0x5c'),_0x3a61('0x69'));emit(util['format'](_0x3a61('0x6a'),_0x3b7ee3['name']),'trigger:browser:url',{'uri':_0xbb0986});})[_0x3a61('0x6b')](function(_0x1e056b){logger[_0x3a61('0x6c')](_0x3a61('0x5c'),JSON[_0x3a61('0x21')](_0x1e056b));});};exports[_0x3a61('0x6d')]=function(_0x40daa9,_0x55cea4,_0x3582f2,_0x164039,_0x4440ce,_0x2815a6,_0x2d3ec7){var _0x5435e8,_0x323ecb,_0x8eb2ee,_0x5c4b2e;_0x2815a6['remoteUri']=intUtil[_0x3a61('0x57')](_0x2815a6['remoteUri']);_0x2815a6[_0x3a61('0x58')]=intUtil['stripTrailingSlash'](_0x2815a6[_0x3a61('0x58')]);def[_0x3a61('0x59')]=util[_0x3a61('0x23')]('%s/service/v4_1/rest.php',_0x2815a6[_0x3a61('0x56')]);if(_0x2d3ec7&&_0x2d3ec7['recordingFormat']&&_0x2d3ec7['recordingFormat']!==_0x3a61('0x6e')){logger['info'](_0x3a61('0x6f'),'Recording\x20is\x20enabled!');_0x55cea4[_0x3a61('0x5d')]=util[_0x3a61('0x23')](_0x3a61('0x5e'),_0x2815a6[_0x3a61('0x58')],_0x55cea4[_0x3a61('0x5f')],md5(_0x55cea4[_0x3a61('0x5f')]));}return getConnection(_0x2815a6)['then'](function(_0x2abc23){_0x5c4b2e=_0x2abc23;return getUser(_0x2815a6,_0x164039['name'],_0x5c4b2e);})[_0x3a61('0x2f')](function(_0x150ff0){_0x5435e8=_0x150ff0;logger['info'](_0x3a61('0x60'),_0x5435e8['id']);return getEndUser(_0x2815a6,_0x55cea4[_0x3a61('0x70')],_0x55cea4[_0x3a61('0x71')],_0x5c4b2e);})[_0x3a61('0x2f')](function(_0x55dc15){_0x323ecb=_0x55dc15;logger[_0x3a61('0x34')]('The\x20Enduser\x20ID\x20is:',_0x323ecb['id']);return getTicket(_0x2815a6,_0x5435e8,_0x323ecb,_0x3582f2,_0x55cea4,_0x3582f2['Fields'],_0x5c4b2e,_0x3a61('0x72'));})[_0x3a61('0x2f')](function(_0x14aabd){_0x8eb2ee=_0x14aabd;logger[_0x3a61('0x34')](_0x3a61('0x73'));logger[_0x3a61('0x34')](_0x3a61('0x64'),_0x8eb2ee['id']);return setRelationship(_0x5c4b2e,_0x5435e8,_0x8eb2ee,_0x3a61('0x74'));})[_0x3a61('0x2f')](function(){return setRelationship(_0x5c4b2e,_0x323ecb,_0x8eb2ee,_0x3a61('0x75'));})[_0x3a61('0x2f')](function(){return getServerInfo(_0x5c4b2e);})[_0x3a61('0x2f')](function(_0x4a58fe){var _0x342a9d=parseInt(_0x4a58fe[_0x3a61('0x65')][_0x3a61('0x66')](0x0));var _0x28175a=util['format'](_0x3a61('0x67'),_0x2815a6['remoteUri'],_0x8eb2ee['id']);if(_0x342a9d>0x6){_0x28175a=util[_0x3a61('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2815a6[_0x3a61('0x56')],_0x8eb2ee['id']);}logger[_0x3a61('0x34')]('[OUTBOUND]',_0x3a61('0x69'));emit(util[_0x3a61('0x23')]('user:%s',_0x164039[_0x3a61('0x10')]),_0x3a61('0x76'),{'uri':_0x28175a});})[_0x3a61('0x6b')](function(_0x1bf4cf){logger[_0x3a61('0x6c')](_0x3a61('0x6f'),JSON[_0x3a61('0x21')](_0x1bf4cf));});};exports[_0x3a61('0x77')]=function(_0x67adde,_0x2f3564,_0x18309b,_0x4f69f0,_0x4f8b35,_0x2a7aec){var _0x57e15f,_0x4edb35,_0x850075,_0x5d9a95;_0x2a7aec['remoteUri']=intUtil[_0x3a61('0x57')](_0x2a7aec[_0x3a61('0x56')]);_0x2a7aec[_0x3a61('0x58')]=intUtil[_0x3a61('0x57')](_0x2a7aec[_0x3a61('0x58')]);def['uri']=util[_0x3a61('0x23')]('%s/service/v4_1/rest.php',_0x2a7aec[_0x3a61('0x56')]);if(_0x4f8b35&&_0x4f8b35[_0x3a61('0x5b')]){logger[_0x3a61('0x34')]('['+_0x2f3564[_0x3a61('0x78')][_0x3a61('0x79')]()+']',_0x3a61('0x7a'));_0x2f3564['recordingURL']=util[_0x3a61('0x23')](_0x3a61('0x5e'),_0x2a7aec['serverUrl'],_0x2f3564[_0x3a61('0x5f')],md5(_0x2f3564[_0x3a61('0x5f')]));}else{_0x2f3564[_0x3a61('0x5d')]='';}return getConnection(_0x2a7aec)[_0x3a61('0x2f')](function(_0x4e1857){_0x5d9a95=_0x4e1857;if(!_[_0x3a61('0x29')](_0x4f69f0)){return getUser(_0x2a7aec,_0x4f69f0[_0x3a61('0x10')],_0x5d9a95);}else{return getUser(_0x2a7aec,null,_0x5d9a95);}})[_0x3a61('0x2f')](function(_0x7632ba){_0x57e15f=_0x7632ba;logger[_0x3a61('0x34')](_0x3a61('0x60'),_0x57e15f['id']);return getEndUser(_0x2a7aec,_0x2f3564[_0x3a61('0x7b')],_0x2f3564[_0x3a61('0x61')],_0x5d9a95);})[_0x3a61('0x2f')](function(_0xd2804){_0x4edb35=_0xd2804;logger[_0x3a61('0x34')](_0x3a61('0x62'),_0x4edb35['id']);return getTicket(_0x2a7aec,_0x57e15f,_0x4edb35,_0x18309b,_0x2f3564,_0x18309b['Fields'],_0x5d9a95,'Inbound');})[_0x3a61('0x2f')](function(_0x3d8f93){_0x850075=_0x3d8f93;logger['info']('Ticket\x20created!');logger[_0x3a61('0x34')](_0x3a61('0x64'),_0x850075['id']);return setRelationship(_0x5d9a95,_0x57e15f,_0x850075,'users');})['then'](function(){return setRelationship(_0x5d9a95,_0x4edb35,_0x850075,'contacts');})[_0x3a61('0x2f')](function(){return getServerInfo(_0x5d9a95);})[_0x3a61('0x6b')](function(_0x508921){logger['error']('['+_0x2f3564[_0x3a61('0x78')][_0x3a61('0x79')]()+']',JSON[_0x3a61('0x21')](_0x508921));});}; \ No newline at end of file +var _0xdbb1=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','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','trigger:browser:url','catch','error','outbound','uri','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','toUpperCase','lastevent','lodash','util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','idField','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','content','customField','custom_fields','variable','customVariable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:'];(function(_0x4665b8,_0x234a28){var _0x54ba4c=function(_0x38064a){while(--_0x38064a){_0x4665b8['push'](_0x4665b8['shift']());}};_0x54ba4c(++_0x234a28);}(_0xdbb1,0x105));var _0x1dbb=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xdbb1[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x1dbb('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x1dbb('0x1'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x1dbb('0x2'));var logger=require('../../../../config/logger')(_0x1dbb('0x3'));config[_0x1dbb('0x4')]=_['defaults'](config['redis'],{'host':_0x1dbb('0x5'),'port':0x18eb});var io=require(_0x1dbb('0x6'))(new Redis(config[_0x1dbb('0x4')]));var def={'method':_0x1dbb('0x7'),'json':!![]};function emit(_0x5e622c,_0x3ffb54,_0xf42424){io['to'](_0x5e622c)['emit'](_0x3ffb54,_0xf42424);}function getTicket(_0x208220,_0x232c1c,_0x1e7ac5,_0x3ce7e9,_0x40b115,_0x183120,_0x111841,_0x3321a0){logger[_0x1dbb('0x8')](_0x1dbb('0x9'));var _0x1d3f8b=new Date();var _0x5bf42d=[{'name':_0x1dbb('0xa'),'value':intUtil[_0x1dbb('0xb')](_0x3ce7e9[_0x1dbb('0xc')],_0x40b115,'\x20')},{'name':_0x1dbb('0xd'),'value':_0x232c1c['id']},{'name':'created_by','value':_0x232c1c['id']},{'name':'description','value':intUtil[_0x1dbb('0xb')](_0x3ce7e9[_0x1dbb('0xe')],_0x40b115,'\x0a')},{'name':_0x1dbb('0xf'),'value':_0x1d3f8b[_0x1dbb('0x10')]()[_0x1dbb('0x11')](0x0,0x13)['replace']('T','\x20')},{'name':_0x1dbb('0x12'),'value':'0'},{'name':_0x1dbb('0x13'),'value':'15'},{'name':_0x1dbb('0x14'),'value':_0x1e7ac5['id']},{'name':'parent_type','value':_0x1dbb('0x15')},{'name':_0x1dbb('0x16'),'value':_0x1e7ac5['name']},{'name':_0x1dbb('0x17'),'value':_0x3321a0}];if(_0x183120[_0x1dbb('0x18')]){_[_0x1dbb('0x19')](_0x183120,function(_0x440c9f){if(_0x40b115[_0x440c9f[_0x1dbb('0x1a')]]){_0x5bf42d[_0x1dbb('0x1b')]({'name':_0x440c9f[_0x1dbb('0x1c')],'value':_0x40b115[_0x440c9f[_0x1dbb('0x1a')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1dbb('0x1d')]({'session':_0x111841['id'],'module_name':_0x1dbb('0x1e'),'name_value_list':_0x5bf42d})}});}function getAuth(_0x570896){return util[_0x1dbb('0x1f')](_0x1dbb('0x20'),new Buffer(_0x570896[_0x1dbb('0x21')]+':X')[_0x1dbb('0x22')](_0x1dbb('0x23')));}function getServerInfo(_0x3ddd80){return request({'form':{'method':_0x1dbb('0x24'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON[_0x1dbb('0x1d')]({'session':_0x3ddd80['id']})}});}function getUser(_0x2a2458,_0x2d1b0c,_0x2c0993){if(!_[_0x1dbb('0x26')](_0x2d1b0c)){logger[_0x1dbb('0x8')](_0x1dbb('0x27'),_0x2d1b0c);return request({'form':{'method':_0x1dbb('0x28'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON['stringify']({'session':_0x2c0993['id'],'module_name':_0x1dbb('0x29'),'query':util['format'](_0x1dbb('0x2a'),_0x2d1b0c),'order_by':'','offset':'0','select_fields':['id','name',_0x1dbb('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1dbb('0x2c')](function(_0x346372){if(_0x346372[_0x1dbb('0x2d')][_0x1dbb('0x18')]){var _0x47057d=_['find'](_0x346372[_0x1dbb('0x2d')],function(_0x410979){return _0x410979[_0x1dbb('0x2e')]['user_name']['value']===_0x2d1b0c;});if(_0x47057d){logger[_0x1dbb('0x8')]('Agent\x20found!');return BPromise['resolve']({'id':_0x47057d[_0x1dbb('0x2e')]['id'][_0x1dbb('0x2f')],'name':_0x47057d[_0x1dbb('0x2e')][_0x1dbb('0xa')][_0x1dbb('0x2f')]});}}logger[_0x1dbb('0x8')](_0x1dbb('0x30'));return BPromise[_0x1dbb('0x31')]({'id':_0x2c0993[_0x1dbb('0x2e')]['user_id']['value'],'name':_0x2c0993[_0x1dbb('0x2e')][_0x1dbb('0x2b')][_0x1dbb('0x2f')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1dbb('0x31')]({'id':_0x2c0993[_0x1dbb('0x2e')][_0x1dbb('0x32')]['value'],'name':_0x2c0993['name_value_list'][_0x1dbb('0x2b')][_0x1dbb('0x2f')]});}}function getEndUser(_0x596b07,_0x3c22f8,_0x15d934,_0x3fbaaf){logger[_0x1dbb('0x8')]('Searching\x20enduser\x20with\x20phone',_0x15d934);return request({'form':{'method':_0x1dbb('0x28'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON[_0x1dbb('0x1d')]({'session':_0x3fbaaf['id'],'module_name':_0x1dbb('0x15'),'query':util[_0x1dbb('0x1f')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x15d934),'order_by':'','offset':'0','select_fields':['id',_0x1dbb('0xa'),_0x1dbb('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x982054){if(_0x982054[_0x1dbb('0x2d')][_0x1dbb('0x18')]){var _0xde3241=_[_0x1dbb('0x34')](_0x982054['entry_list'],function(_0x394299){return _0x394299[_0x1dbb('0x2e')][_0x1dbb('0x33')][_0x1dbb('0x2f')]===_0x15d934;});if(_0xde3241){logger[_0x1dbb('0x8')](_0x1dbb('0x35'));return BPromise['resolve']({'id':_0xde3241[_0x1dbb('0x2e')]['id'][_0x1dbb('0x2f')],'name':_0xde3241['name_value_list'][_0x1dbb('0xa')][_0x1dbb('0x2f')],'phone':_0xde3241[_0x1dbb('0x2e')][_0x1dbb('0x33')][_0x1dbb('0x2f')]});}}else{logger[_0x1dbb('0x8')](_0x1dbb('0x36'));return request({'form':{'method':_0x1dbb('0x37'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON[_0x1dbb('0x1d')]({'session':_0x3fbaaf['id'],'module_name':_0x1dbb('0x15'),'name_value_list':[{'name':_0x1dbb('0x38'),'value':_0x3c22f8!==''?_0x3c22f8:util[_0x1dbb('0x1f')](_0x1dbb('0x39'),_0x15d934)},{'name':_0x1dbb('0x33'),'value':_0x15d934}]})}})[_0x1dbb('0x2c')](function(_0x124452){logger[_0x1dbb('0x8')](_0x1dbb('0x3a'));return BPromise[_0x1dbb('0x31')]({'id':_0x124452['id'],'name':_0x124452[_0x1dbb('0x2d')][_0x1dbb('0x38')][_0x1dbb('0x2f')],'phone':_0x124452[_0x1dbb('0x2d')][_0x1dbb('0x33')]['value']});});}});}function request(_0x148c2f){logger[_0x1dbb('0x3b')](_0x1dbb('0x3c'),JSON[_0x1dbb('0x1d')](_0x148c2f));return rp(_['merge'](def,_0x148c2f));}function getTags(_0x3fa964,_0x2b3b1b){var _0x12c16b=[];if(_0x3fa964&&_0x3fa964[_0x1dbb('0x18')]>0x0){_0x12c16b=_[_0x1dbb('0x3d')](_0x3fa964,_0x2b3b1b);}return _0x12c16b;}function getCustomFields(_0x26999e,_0xb13dd7){var _0x284a96=[];var _0x5d3c71={'custom_fields':[]};if(_0x26999e[_0x1dbb('0x18')]>0x0){_[_0x1dbb('0x19')](_0x26999e,function(_0x35b9f9){if(_0x35b9f9[_0x1dbb('0x3e')]===_0x1dbb('0x3f')&&_0x35b9f9[_0x1dbb('0x40')]&&!_0x35b9f9['customField']){_0x5d3c71[_0x35b9f9[_0x1dbb('0x40')]['toLowerCase']()]=_0x35b9f9[_0x1dbb('0x41')][_0x1dbb('0x22')]();}else if(_0x35b9f9['type']===_0x1dbb('0x3f')&&_0x35b9f9[_0x1dbb('0x1c')]&&_0x35b9f9[_0x1dbb('0x42')]){_0x5d3c71[_0x1dbb('0x43')][_0x1dbb('0x1b')]({'id':_0x35b9f9['idField'],'value':_0x35b9f9[_0x1dbb('0x41')][_0x1dbb('0x22')]()});}else if(_0x35b9f9[_0x1dbb('0x3e')]===_0x1dbb('0x44')&&_0x35b9f9[_0x1dbb('0x1a')]&&_0x35b9f9['idField']&&_0x35b9f9[_0x1dbb('0x42')]){_0xb13dd7[_0x35b9f9['variableName']]&&_0x5d3c71['custom_fields'][_0x1dbb('0x1b')]({'id':_0x35b9f9['idField'],'value':_0xb13dd7[_0x35b9f9[_0x1dbb('0x1a')]][_0x1dbb('0x22')]()});}else if(_0x35b9f9[_0x1dbb('0x3e')]===_0x1dbb('0x45')&&_0x35b9f9[_0x1dbb('0x46')]&&_0x35b9f9[_0x1dbb('0x46')]['name']&&_0x35b9f9[_0x1dbb('0x1c')]&&_0x35b9f9[_0x1dbb('0x42')]){_0xb13dd7[_0x35b9f9[_0x1dbb('0x46')][_0x1dbb('0xa')][_0x1dbb('0x47')]()]&&_0x5d3c71[_0x1dbb('0x43')]['push']({'id':_0x35b9f9['idField'],'value':_0xb13dd7[_0x35b9f9[_0x1dbb('0x46')]['name'][_0x1dbb('0x47')]()][_0x1dbb('0x22')]()});}});}return _0x5d3c71;}function getConnection(_0x3e2771){return request({'method':'POST','form':{'method':_0x1dbb('0x48'),'input_type':_0x1dbb('0x25'),'response_type':_0x1dbb('0x25'),'rest_data':JSON[_0x1dbb('0x1d')]({'user_auth':{'user_name':_0x3e2771['username'],'password':_0x3e2771[_0x1dbb('0x49')],'encryption':_0x1dbb('0x4a')},'application':_0x1dbb('0x4b')})}})[_0x1dbb('0x2c')](function(_0x441c36){var _0x358929=_0x441c36;if(_0x358929['id']){def[_0x1dbb('0x4c')]=_0x358929['id'];return BPromise[_0x1dbb('0x31')](_0x358929);}else{throw new Error(util[_0x1dbb('0x1f')](_0x1dbb('0x4d'),_0x3e2771['id']));}});}function setRelationship(_0xb22ae6,_0x2a727f,_0x3a9eab,_0x3ef0e0){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x1dbb('0x25'),'rest_data':JSON['stringify']({'session':_0xb22ae6['id'],'module_name':_0x1dbb('0x1e'),'module_id':_0x3a9eab['id'],'link_field_name':_0x3ef0e0,'related_ids':[_0x2a727f['id']]})}});}exports[_0x1dbb('0x4e')]=function(_0x838a1b,_0x4c0b32,_0x20c294,_0x23936d,_0x3525f2,_0x289f96){var _0x3252d1,_0x211c94,_0x153af4,_0x4a6ea5;_0x289f96[_0x1dbb('0x4f')]=intUtil[_0x1dbb('0x50')](_0x289f96['remoteUri']);_0x289f96[_0x1dbb('0x51')]=intUtil[_0x1dbb('0x50')](_0x289f96[_0x1dbb('0x51')]);def['uri']=util[_0x1dbb('0x1f')](_0x1dbb('0x52'),_0x289f96[_0x1dbb('0x4f')]);if(_0x3525f2&&_0x3525f2[_0x1dbb('0x53')]){logger[_0x1dbb('0x8')](_0x1dbb('0x54'),_0x1dbb('0x55'));_0x4c0b32[_0x1dbb('0x56')]=util[_0x1dbb('0x1f')](_0x1dbb('0x57'),_0x289f96[_0x1dbb('0x51')],_0x4c0b32[_0x1dbb('0x58')],md5(_0x4c0b32[_0x1dbb('0x58')]));}else{_0x4c0b32[_0x1dbb('0x56')]='';}return getConnection(_0x289f96)[_0x1dbb('0x2c')](function(_0xb3eab0){_0x4a6ea5=_0xb3eab0;return getUser(_0x289f96,_0x23936d[_0x1dbb('0xa')],_0x4a6ea5);})['then'](function(_0x2f53a0){_0x3252d1=_0x2f53a0;logger[_0x1dbb('0x8')](_0x1dbb('0x59'),_0x3252d1['id']);return getEndUser(_0x289f96,_0x4c0b32[_0x1dbb('0x5a')],_0x4c0b32[_0x1dbb('0x5b')],_0x4a6ea5);})[_0x1dbb('0x2c')](function(_0x47153d){_0x211c94=_0x47153d;logger[_0x1dbb('0x8')](_0x1dbb('0x5c'),_0x211c94['id']);return getTicket(_0x289f96,_0x3252d1,_0x211c94,_0x20c294,_0x4c0b32,_0x20c294[_0x1dbb('0x5d')],_0x4a6ea5,_0x1dbb('0x5e'));})['then'](function(_0x5d6117){_0x153af4=_0x5d6117;logger[_0x1dbb('0x8')](_0x1dbb('0x5f'));logger[_0x1dbb('0x8')](_0x1dbb('0x60'),_0x153af4['id']);return setRelationship(_0x4a6ea5,_0x3252d1,_0x153af4,'users');})['then'](function(){return setRelationship(_0x4a6ea5,_0x211c94,_0x153af4,_0x1dbb('0x61'));})[_0x1dbb('0x2c')](function(){return getServerInfo(_0x4a6ea5);})[_0x1dbb('0x2c')](function(_0x445980){var _0x2e42dc=parseInt(_0x445980[_0x1dbb('0x62')][_0x1dbb('0x63')](0x0));var _0x5b7de7=util[_0x1dbb('0x1f')](_0x1dbb('0x64'),_0x289f96[_0x1dbb('0x4f')],_0x153af4['id']);if(_0x2e42dc>0x6){_0x5b7de7=util[_0x1dbb('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x289f96[_0x1dbb('0x4f')],_0x153af4['id']);}logger[_0x1dbb('0x8')](_0x1dbb('0x54'),_0x1dbb('0x65'));emit(util[_0x1dbb('0x1f')](_0x1dbb('0x66'),_0x23936d[_0x1dbb('0xa')]),_0x1dbb('0x67'),{'uri':_0x5b7de7});})[_0x1dbb('0x68')](function(_0x587c3d){logger[_0x1dbb('0x69')](_0x1dbb('0x54'),JSON[_0x1dbb('0x1d')](_0x587c3d));});};exports[_0x1dbb('0x6a')]=function(_0x39f3f3,_0x5c8f3c,_0x40927c,_0x299fa9,_0x48a091,_0x38a943,_0x2c4a2e){var _0x3d89bc,_0x1453c7,_0x144840,_0x38d79d;_0x38a943[_0x1dbb('0x4f')]=intUtil['stripTrailingSlash'](_0x38a943['remoteUri']);_0x38a943[_0x1dbb('0x51')]=intUtil[_0x1dbb('0x50')](_0x38a943[_0x1dbb('0x51')]);def[_0x1dbb('0x6b')]=util[_0x1dbb('0x1f')](_0x1dbb('0x52'),_0x38a943['remoteUri']);if(_0x2c4a2e&&_0x2c4a2e[_0x1dbb('0x6c')]&&_0x2c4a2e['recordingFormat']!=='none'){logger[_0x1dbb('0x8')](_0x1dbb('0x6d'),_0x1dbb('0x55'));_0x5c8f3c[_0x1dbb('0x56')]=util[_0x1dbb('0x1f')](_0x1dbb('0x57'),_0x38a943[_0x1dbb('0x51')],_0x5c8f3c[_0x1dbb('0x58')],md5(_0x5c8f3c['uniqueid']));}return getConnection(_0x38a943)[_0x1dbb('0x2c')](function(_0x12325d){_0x38d79d=_0x12325d;return getUser(_0x38a943,_0x299fa9[_0x1dbb('0xa')],_0x38d79d);})[_0x1dbb('0x2c')](function(_0x541cab){_0x3d89bc=_0x541cab;logger[_0x1dbb('0x8')]('The\x20User\x20ID\x20is:',_0x3d89bc['id']);return getEndUser(_0x38a943,_0x5c8f3c[_0x1dbb('0x6e')],_0x5c8f3c[_0x1dbb('0x6f')],_0x38d79d);})['then'](function(_0x241974){_0x1453c7=_0x241974;logger[_0x1dbb('0x8')](_0x1dbb('0x5c'),_0x1453c7['id']);return getTicket(_0x38a943,_0x3d89bc,_0x1453c7,_0x40927c,_0x5c8f3c,_0x40927c[_0x1dbb('0x5d')],_0x38d79d,_0x1dbb('0x70'));})['then'](function(_0x3a155d){_0x144840=_0x3a155d;logger[_0x1dbb('0x8')](_0x1dbb('0x5f'));logger[_0x1dbb('0x8')](_0x1dbb('0x60'),_0x144840['id']);return setRelationship(_0x38d79d,_0x3d89bc,_0x144840,_0x1dbb('0x71'));})['then'](function(){return setRelationship(_0x38d79d,_0x1453c7,_0x144840,_0x1dbb('0x61'));})['then'](function(){return getServerInfo(_0x38d79d);})['then'](function(_0x39b4e1){var _0x5e4db2=parseInt(_0x39b4e1[_0x1dbb('0x62')][_0x1dbb('0x63')](0x0));var _0x3990b8=util[_0x1dbb('0x1f')](_0x1dbb('0x64'),_0x38a943[_0x1dbb('0x4f')],_0x144840['id']);if(_0x5e4db2>0x6){_0x3990b8=util['format'](_0x1dbb('0x72'),_0x38a943[_0x1dbb('0x4f')],_0x144840['id']);}logger[_0x1dbb('0x8')](_0x1dbb('0x6d'),_0x1dbb('0x65'));emit(util['format']('user:%s',_0x299fa9[_0x1dbb('0xa')]),_0x1dbb('0x67'),{'uri':_0x3990b8});})['catch'](function(_0x20218a){logger[_0x1dbb('0x69')](_0x1dbb('0x6d'),JSON['stringify'](_0x20218a));});};exports['unmanaged']=function(_0x2968f5,_0x29be95,_0x16778f,_0x3500ce,_0x56cd19,_0x1bafe6){var _0x231c2d,_0x3e65d9,_0x43788f,_0x986f4f;_0x1bafe6['remoteUri']=intUtil[_0x1dbb('0x50')](_0x1bafe6[_0x1dbb('0x4f')]);_0x1bafe6[_0x1dbb('0x51')]=intUtil[_0x1dbb('0x50')](_0x1bafe6[_0x1dbb('0x51')]);def[_0x1dbb('0x6b')]=util[_0x1dbb('0x1f')](_0x1dbb('0x52'),_0x1bafe6[_0x1dbb('0x4f')]);if(_0x56cd19&&_0x56cd19['monitor_format']){logger[_0x1dbb('0x8')]('['+_0x29be95['lastevent'][_0x1dbb('0x73')]()+']','Recording\x20is\x20enabled!');_0x29be95[_0x1dbb('0x56')]=util[_0x1dbb('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1bafe6[_0x1dbb('0x51')],_0x29be95[_0x1dbb('0x58')],md5(_0x29be95[_0x1dbb('0x58')]));}else{_0x29be95[_0x1dbb('0x56')]='';}return getConnection(_0x1bafe6)[_0x1dbb('0x2c')](function(_0x5eaf4b){_0x986f4f=_0x5eaf4b;if(!_[_0x1dbb('0x26')](_0x3500ce)){return getUser(_0x1bafe6,_0x3500ce[_0x1dbb('0xa')],_0x986f4f);}else{return getUser(_0x1bafe6,null,_0x986f4f);}})[_0x1dbb('0x2c')](function(_0x1aae58){_0x231c2d=_0x1aae58;logger[_0x1dbb('0x8')](_0x1dbb('0x59'),_0x231c2d['id']);return getEndUser(_0x1bafe6,_0x29be95['calleridname'],_0x29be95[_0x1dbb('0x5b')],_0x986f4f);})[_0x1dbb('0x2c')](function(_0x2939a0){_0x3e65d9=_0x2939a0;logger[_0x1dbb('0x8')]('The\x20Enduser\x20ID\x20is:',_0x3e65d9['id']);return getTicket(_0x1bafe6,_0x231c2d,_0x3e65d9,_0x16778f,_0x29be95,_0x16778f[_0x1dbb('0x5d')],_0x986f4f,_0x1dbb('0x5e'));})[_0x1dbb('0x2c')](function(_0x21f16e){_0x43788f=_0x21f16e;logger[_0x1dbb('0x8')](_0x1dbb('0x5f'));logger[_0x1dbb('0x8')](_0x1dbb('0x60'),_0x43788f['id']);return setRelationship(_0x986f4f,_0x231c2d,_0x43788f,_0x1dbb('0x71'));})[_0x1dbb('0x2c')](function(){return setRelationship(_0x986f4f,_0x3e65d9,_0x43788f,_0x1dbb('0x61'));})[_0x1dbb('0x2c')](function(){return getServerInfo(_0x986f4f);})['catch'](function(_0x2e3fd8){logger[_0x1dbb('0x69')]('['+_0x29be95[_0x1dbb('0x74')]['toUpperCase']()+']',JSON[_0x1dbb('0x1d')](_0x2e3fd8));});}; \ 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 d5b89de..c387fa9 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 _0x022b=['keyContent','format','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','type','string','variable','variableName','push','Variable','name','toLowerCase','keyType','key','%s:\x20%s'];(function(_0x579b79,_0x5b57b2){var _0x41e899=function(_0x2c8b7){while(--_0x2c8b7){_0x579b79['push'](_0x579b79['shift']());}};_0x41e899(++_0x5b57b2);}(_0x022b,0x1bd));var _0xb022=function(_0xf2cc3c,_0x49518d){_0xf2cc3c=_0xf2cc3c-0x0;var _0x4cdbdd=_0x022b[_0xf2cc3c];return _0x4cdbdd;};'use strict';var _=require(_0xb022('0x0'));var util=require(_0xb022('0x1'));exports[_0xb022('0x2')]=function(_0x309639,_0x1ca766,_0x3a29eb){var _0x6a321f=[];if(_0x309639[_0xb022('0x3')]>0x0){var _0x620407=_['sortBy'](_0x309639,['id']);for(var _0x7634b2=0x0;_0x7634b2<_0x620407[_0xb022('0x3')];_0x7634b2++){var _0x4fbf4c=_0x620407[_0x7634b2];if(_0x4fbf4c[_0xb022('0x4')]===_0xb022('0x5')){_0x6a321f['push'](_0x4fbf4c['content']);}else if(_0x4fbf4c[_0xb022('0x4')]===_0xb022('0x6')&&_0x4fbf4c['variableName']){_0x1ca766[_0x4fbf4c[_0xb022('0x7')]]&&_0x6a321f[_0xb022('0x8')](_0x1ca766[_0x4fbf4c['variableName']]['toString']());}else if(_0x4fbf4c[_0xb022('0x4')]==='customVariable'&&_0x4fbf4c[_0xb022('0x9')]&&_0x4fbf4c['Variable'][_0xb022('0xa')]){_0x1ca766[_0x4fbf4c[_0xb022('0x9')]['name']['toLowerCase']()]&&_0x6a321f[_0xb022('0x8')](_0x1ca766[_0x4fbf4c['Variable'][_0xb022('0xa')][_0xb022('0xb')]()]['toString']());}else if(_0x4fbf4c[_0xb022('0x4')]==='keyValue'){if(_0x4fbf4c[_0xb022('0xc')]===_0xb022('0x5')&&_0x4fbf4c[_0xb022('0xd')]){_0x6a321f[_0xb022('0x8')](util['format'](_0xb022('0xe'),_0x4fbf4c[_0xb022('0xd')],_0x4fbf4c[_0xb022('0xf')]));}else if(_0x4fbf4c[_0xb022('0xc')]==='variable'&&_0x4fbf4c[_0xb022('0x7')]&&_0x4fbf4c[_0xb022('0xd')]){_0x1ca766[_0x4fbf4c[_0xb022('0x7')]]&&_0x6a321f[_0xb022('0x8')](util[_0xb022('0x10')](_0xb022('0xe'),_0x4fbf4c['key'],_0x1ca766[_0x4fbf4c[_0xb022('0x7')]]));}else if(_0x4fbf4c[_0xb022('0xc')]==='customVariable'&&_0x4fbf4c[_0xb022('0x9')]&&_0x4fbf4c[_0xb022('0x9')][_0xb022('0xa')]&&_0x4fbf4c[_0xb022('0xd')]){_0x1ca766[_0x4fbf4c[_0xb022('0x9')][_0xb022('0xa')][_0xb022('0xb')]()]&&_0x6a321f['push'](util[_0xb022('0x10')]('%s:\x20%s',_0x4fbf4c[_0xb022('0xd')],_0x1ca766[_0x4fbf4c[_0xb022('0x9')][_0xb022('0xa')][_0xb022('0xb')]()]));}}}}return _0x6a321f['join'](_0x3a29eb);};exports[_0xb022('0x11')]=function(_0x2adab9){var _0x29b63b=_0x2adab9[_0xb022('0x12')](-0x1);if(_0x29b63b==='/'){_0x2adab9=_0x2adab9[_0xb022('0x13')](0x0,_0x2adab9[_0xb022('0x14')](_0x29b63b));}return _0x2adab9;};exports[_0xb022('0x15')]=function(_0x1eaf93){if(!_[_0xb022('0x16')](_0x1eaf93)&&_0x1eaf93!==''){var _0x1c250a=/^(([^<>()\[\]\\.,;:\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 _0x1c250a['test'](String(_0x1eaf93)[_0xb022('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x06c0=['stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','type','string','content','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','keyContent','variable','%s:\x20%s'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x06c0,0x10a));var _0x006c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x06c0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x006c('0x0'));var util=require(_0x006c('0x1'));exports[_0x006c('0x2')]=function(_0xdcb84e,_0x1e1e1d,_0xc3efd1){var _0x4a4c8e=[];if(_0xdcb84e[_0x006c('0x3')]>0x0){var _0x3bab6f=_['sortBy'](_0xdcb84e,['id']);for(var _0x4d8399=0x0;_0x4d8399<_0x3bab6f[_0x006c('0x3')];_0x4d8399++){var _0x1fdddb=_0x3bab6f[_0x4d8399];if(_0x1fdddb[_0x006c('0x4')]===_0x006c('0x5')){_0x4a4c8e['push'](_0x1fdddb[_0x006c('0x6')]);}else if(_0x1fdddb['type']==='variable'&&_0x1fdddb[_0x006c('0x7')]){_0x1e1e1d[_0x1fdddb[_0x006c('0x7')]]&&_0x4a4c8e[_0x006c('0x8')](_0x1e1e1d[_0x1fdddb[_0x006c('0x7')]][_0x006c('0x9')]());}else if(_0x1fdddb['type']===_0x006c('0xa')&&_0x1fdddb[_0x006c('0xb')]&&_0x1fdddb[_0x006c('0xb')][_0x006c('0xc')]){_0x1e1e1d[_0x1fdddb['Variable']['name']['toLowerCase']()]&&_0x4a4c8e[_0x006c('0x8')](_0x1e1e1d[_0x1fdddb[_0x006c('0xb')][_0x006c('0xc')][_0x006c('0xd')]()][_0x006c('0x9')]());}else if(_0x1fdddb[_0x006c('0x4')]==='keyValue'){if(_0x1fdddb[_0x006c('0xe')]===_0x006c('0x5')&&_0x1fdddb[_0x006c('0xf')]){_0x4a4c8e['push'](util[_0x006c('0x10')]('%s:\x20%s',_0x1fdddb[_0x006c('0xf')],_0x1fdddb[_0x006c('0x11')]));}else if(_0x1fdddb[_0x006c('0xe')]===_0x006c('0x12')&&_0x1fdddb[_0x006c('0x7')]&&_0x1fdddb[_0x006c('0xf')]){_0x1e1e1d[_0x1fdddb[_0x006c('0x7')]]&&_0x4a4c8e['push'](util['format'](_0x006c('0x13'),_0x1fdddb[_0x006c('0xf')],_0x1e1e1d[_0x1fdddb[_0x006c('0x7')]]));}else if(_0x1fdddb[_0x006c('0xe')]===_0x006c('0xa')&&_0x1fdddb[_0x006c('0xb')]&&_0x1fdddb['Variable'][_0x006c('0xc')]&&_0x1fdddb[_0x006c('0xf')]){_0x1e1e1d[_0x1fdddb[_0x006c('0xb')][_0x006c('0xc')][_0x006c('0xd')]()]&&_0x4a4c8e[_0x006c('0x8')](util[_0x006c('0x10')](_0x006c('0x13'),_0x1fdddb[_0x006c('0xf')],_0x1e1e1d[_0x1fdddb['Variable']['name'][_0x006c('0xd')]()]));}}}}return _0x4a4c8e['join'](_0xc3efd1);};exports[_0x006c('0x14')]=function(_0x339f47){var _0x4c5e5b=_0x339f47[_0x006c('0x15')](-0x1);if(_0x4c5e5b==='/'){_0x339f47=_0x339f47[_0x006c('0x16')](0x0,_0x339f47['lastIndexOf'](_0x4c5e5b));}return _0x339f47;};exports[_0x006c('0x17')]=function(_0x595b6e){if(!_[_0x006c('0x18')](_0x595b6e)&&_0x595b6e!==''){var _0x217f10=/^(([^<>()\[\]\\.,;:\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 _0x217f10[_0x006c('0x19')](String(_0x595b6e)[_0x006c('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a45db4a..aee8f26 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 _0xc4b8=['info','Creating\x20new\x20ticket...','getString','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','createTicket','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','catch','getUser','[vTiger],\x20%s,\x20%s,\x20%s','Searching\x20end\x20user\x20with\x20phone','then','Enduser\x20found!','firstname','Contacts','Enduser\x20created.','lastname','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','recordingFormat','none','destcalleridname','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','monitor_format','lastevent','toUpperCase','bluebird','md5','util','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4b8,0x1d8));var _0x8c4b=function(_0x36f908,_0x4d7c36){_0x36f908=_0x36f908-0x0;var _0x42cec1=_0xc4b8[_0x36f908];return _0x42cec1;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x8c4b('0x0'));var md5=require(_0x8c4b('0x1'));var util=require(_0x8c4b('0x2'));var Redis=require(_0x8c4b('0x3'));var intUtil=require(_0x8c4b('0x4'));var config=require(_0x8c4b('0x5'));var logger=require('../../../../config/logger')(_0x8c4b('0x6'));config[_0x8c4b('0x7')]=_[_0x8c4b('0x8')](config[_0x8c4b('0x7')],{'host':_0x8c4b('0x9'),'port':0x18eb});var io=require(_0x8c4b('0xa'))(new Redis(config[_0x8c4b('0x7')]));function emit(_0x1e8c12,_0x155385,_0x178416){io['to'](_0x1e8c12)[_0x8c4b('0xb')](_0x155385,_0x178416);}function getCustomFields(_0x282ede,_0x5c9724){var _0x3cbb7d={};if(_0x282ede[_0x8c4b('0xc')]>0x0){_[_0x8c4b('0xd')](_0x282ede,function(_0xf30053){if(_0xf30053[_0x8c4b('0xe')]==='string'&&_0xf30053[_0x8c4b('0xf')]){_0x3cbb7d[_0xf30053[_0x8c4b('0xf')]]=_0xf30053[_0x8c4b('0x10')][_0x8c4b('0x11')]();}else if(_0xf30053[_0x8c4b('0xe')]==='variable'&&_0xf30053[_0x8c4b('0x12')]&&_0xf30053[_0x8c4b('0xf')]&&_0x5c9724[_0xf30053[_0x8c4b('0x12')]]){_0x3cbb7d[_0xf30053['idField']]=_0x5c9724[_0xf30053[_0x8c4b('0x12')]][_0x8c4b('0x11')]();}else if(_0xf30053['type']===_0x8c4b('0x13')&&_0xf30053[_0x8c4b('0x14')]&&_0xf30053[_0x8c4b('0x14')][_0x8c4b('0x15')]&&_0xf30053[_0x8c4b('0xf')]&&_0x5c9724[_0xf30053[_0x8c4b('0x14')][_0x8c4b('0x15')][_0x8c4b('0x16')]()]){_0x3cbb7d[_0xf30053['idField']]=_0x5c9724[_0xf30053[_0x8c4b('0x14')]['name']['toLowerCase']()][_0x8c4b('0x11')]();}});}return _0x3cbb7d;}function createTicket(_0x403c18,_0x27293c,_0x11efe6,_0x331587,_0x5bd056,_0x2ab05c,_0x1ebdc6){logger[_0x8c4b('0x17')](_0x8c4b('0x18'));var _0x306b1e=_['merge']({'parent_id':'','assigned_user_id':_0x27293c['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0x8c4b('0x19')](_0x331587[_0x8c4b('0x1a')],_0x5bd056,'\x20'),'description':intUtil['getString'](_0x331587['Descriptions'],_0x5bd056,'\x0a'),'contact_id':_0x11efe6['id']},getCustomFields(_0x2ab05c,_0x5bd056));var _0x2d9ec9={'method':_0x8c4b('0x1b'),'uri':util[_0x8c4b('0x1c')](_0x8c4b('0x1d'),_0x403c18[_0x8c4b('0x1e')]),'form':{'operation':_0x8c4b('0x1f'),'username':_0x403c18[_0x8c4b('0x20')],'sessionName':_0x1ebdc6[_0x8c4b('0x21')],'elementType':_0x8c4b('0x22'),'element':JSON[_0x8c4b('0x23')](_0x306b1e)},'json':!![]};return request(_0x2d9ec9)['then'](function(_0x58e836){if(_0x58e836[_0x8c4b('0x24')]){return BPromise[_0x8c4b('0x25')]({'id':_0x58e836[_0x8c4b('0x26')]['id']});}else{throw new Error(util[_0x8c4b('0x1c')](_0x8c4b('0x27'),JSON['stringify'](_0x58e836[_0x8c4b('0x28')])));}})['catch'](function(_0xbb48e8){var _0x4dd445=_0xbb48e8[_0x8c4b('0x29')]||0x1f4;logger[_0x8c4b('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x8c4b('0x2a'),_0x4dd445,JSON['stringify'](_0xbb48e8));});}function getUser(_0x3ae961,_0x43cf41,_0x18bf8e){if(intUtil['validateEmail'](_0x43cf41)){logger[_0x8c4b('0x17')](_0x8c4b('0x2b'),_0x43cf41);return request({'method':_0x8c4b('0x2c'),'uri':util[_0x8c4b('0x1c')]('%s/webservice.php',_0x3ae961[_0x8c4b('0x1e')]),'qs':{'operation':_0x8c4b('0x2d'),'username':_0x3ae961[_0x8c4b('0x20')],'sessionName':_0x18bf8e['sessionName'],'query':util[_0x8c4b('0x1c')](_0x8c4b('0x2e'),_0x43cf41)},'json':!![]})['then'](function(_0x555ea4){if(_0x555ea4['success']&&_0x555ea4['result'][_0x8c4b('0xc')]){logger[_0x8c4b('0x17')]('Agent\x20found!');return BPromise[_0x8c4b('0x25')]({'id':_0x555ea4[_0x8c4b('0x26')][0x0]['id'],'email':_0x555ea4['result'][0x0][_0x8c4b('0x2f')],'name':_0x555ea4['result'][0x0][_0x8c4b('0x30')]+'\x20'+_0x555ea4[_0x8c4b('0x26')][_0x8c4b('0x31')]});}else{logger[_0x8c4b('0x17')](_0x8c4b('0x32'));return BPromise[_0x8c4b('0x25')]({'id':_0x18bf8e[_0x8c4b('0x33')],'email':_0x3ae961['username'],'name':_0x8c4b('0x34')});}})[_0x8c4b('0x35')](function(_0x571a76){var _0x2d466d=_0x571a76[_0x8c4b('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x8c4b('0x36'),_0x2d466d,JSON[_0x8c4b('0x23')](_0x571a76));});}else{logger['info'](_0x8c4b('0x32'));return BPromise['resolve']({'id':_0x18bf8e[_0x8c4b('0x33')],'email':_0x3ae961[_0x8c4b('0x20')],'name':_0x8c4b('0x34')})['catch'](function(_0x16064f){var _0xc9b402=_0x16064f[_0x8c4b('0x29')]||0x1f4;logger[_0x8c4b('0x28')](_0x8c4b('0x37'),_0x8c4b('0x36'),_0xc9b402,JSON[_0x8c4b('0x23')](_0x16064f));});}}function getEndUser(_0x45c8d1,_0x4a1066,_0x4a1f07,_0x405598){logger[_0x8c4b('0x17')](_0x8c4b('0x38'),_0x4a1f07);return request({'method':_0x8c4b('0x2c'),'uri':util['format'](_0x8c4b('0x1d'),_0x45c8d1['remoteUri']),'qs':{'operation':_0x8c4b('0x2d'),'username':_0x45c8d1[_0x8c4b('0x20')],'sessionName':_0x405598[_0x8c4b('0x21')],'query':util[_0x8c4b('0x1c')]('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;',_0x4a1f07,_0x4a1f07,_0x4a1f07,_0x4a1f07,_0x4a1f07)},'json':!![]})[_0x8c4b('0x39')](function(_0x360d8e){if(_0x360d8e[_0x8c4b('0x24')]&&_0x360d8e[_0x8c4b('0x26')][_0x8c4b('0xc')]){logger[_0x8c4b('0x17')](_0x8c4b('0x3a'));return BPromise[_0x8c4b('0x25')]({'id':_0x360d8e[_0x8c4b('0x26')][0x0]['id'],'name':_0x360d8e['result'][0x0][_0x8c4b('0x3b')]+'\x20'+_0x360d8e['result'][0x0]['lastname'],'phone':_0x4a1f07});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x8c4b('0x1b'),'uri':util[_0x8c4b('0x1c')](_0x8c4b('0x1d'),_0x45c8d1['remoteUri']),'form':{'operation':_0x8c4b('0x1f'),'sessionName':_0x405598['sessionName'],'elementType':_0x8c4b('0x3c'),'element':JSON['stringify']({'lastname':_0x4a1066,'phone':_0x4a1f07,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x8ac26){logger[_0x8c4b('0x17')](_0x8c4b('0x3d'));return BPromise[_0x8c4b('0x25')]({'id':_0x8ac26[_0x8c4b('0x26')]['id'],'name':_0x8ac26[_0x8c4b('0x26')][_0x8c4b('0x3e')],'phone':_0x8ac26[_0x8c4b('0x26')][_0x8c4b('0x3f')]});})[_0x8c4b('0x35')](function(_0x1fce92){var _0x3648b0=_0x1fce92[_0x8c4b('0x29')]||0x1f4;logger[_0x8c4b('0x28')](_0x8c4b('0x37'),_0x8c4b('0x40'),_0x3648b0,JSON[_0x8c4b('0x23')](_0x1fce92));});}});}function getConnection(_0xd77c54){var _0x432377=_0xd77c54['username'];var _0x301160=_0xd77c54[_0x8c4b('0x41')];return request({'method':_0x8c4b('0x2c'),'uri':util[_0x8c4b('0x1c')](_0x8c4b('0x1d'),_0xd77c54[_0x8c4b('0x1e')]),'qs':{'operation':_0x8c4b('0x42'),'username':_0x432377},'json':!![]})[_0x8c4b('0x39')](function(_0x188032){if(_0x188032[_0x8c4b('0x24')]){return request({'method':_0x8c4b('0x1b'),'uri':util[_0x8c4b('0x1c')](_0x8c4b('0x1d'),_0xd77c54[_0x8c4b('0x1e')]),'form':{'operation':_0x8c4b('0x43'),'username':_0x432377,'accessKey':md5(_0x188032[_0x8c4b('0x26')][_0x8c4b('0x44')]+_0x301160)},'json':!![]});}})[_0x8c4b('0x39')](function(_0x10ee4e){if(_0x10ee4e[_0x8c4b('0x24')]){return BPromise['resolve'](_0x10ee4e[_0x8c4b('0x26')]);}else{throw new Error(util[_0x8c4b('0x1c')](_0x8c4b('0x45'),_0xd77c54['id']));}})[_0x8c4b('0x35')](function(_0x3559a0){var _0x1c9ee5=_0x3559a0[_0x8c4b('0x29')]||0x1f4;logger[_0x8c4b('0x28')](_0x8c4b('0x37'),_0x8c4b('0x46'),_0x1c9ee5,JSON['stringify'](_0x3559a0));});}function request(_0x7abc66){logger[_0x8c4b('0x17')](_0x8c4b('0x47'),JSON[_0x8c4b('0x23')](_0x7abc66));return rp(_0x7abc66);}exports[_0x8c4b('0x48')]=function(_0x5b75e7,_0x21b54f,_0xd3cbe0,_0x766e53,_0x2c82ad,_0xb3df62){var _0x326403,_0x13edbe,_0x225c69,_0x2d3e7c;_0xb3df62[_0x8c4b('0x1e')]=intUtil['stripTrailingSlash'](_0xb3df62[_0x8c4b('0x1e')]);if(_0x2c82ad&&_0x2c82ad['monitor_format']){logger[_0x8c4b('0x17')]('[QUEUE]',_0x8c4b('0x49'));_0x21b54f[_0x8c4b('0x4a')]=util[_0x8c4b('0x1c')](_0x8c4b('0x4b'),_0xb3df62['serverUrl'],_0x21b54f[_0x8c4b('0x4c')],md5(_0x21b54f[_0x8c4b('0x4c')]));}else{_0x21b54f[_0x8c4b('0x4a')]='';}return getConnection(_0xb3df62)[_0x8c4b('0x39')](function(_0x50797c){_0x2d3e7c=_0x50797c;return getUser(_0xb3df62,_0x766e53[_0x8c4b('0x4d')],_0x2d3e7c);})[_0x8c4b('0x39')](function(_0x55550c){_0x326403=_0x55550c;logger[_0x8c4b('0x17')](_0x8c4b('0x4e'),_0x326403['id']);return getEndUser(_0xb3df62,_0x21b54f['calleridname'],_0x21b54f[_0x8c4b('0x4f')],_0x2d3e7c);})[_0x8c4b('0x39')](function(_0x2006ad){_0x13edbe=_0x2006ad;logger[_0x8c4b('0x17')](_0x8c4b('0x50'),_0x13edbe['id']);return createTicket(_0xb3df62,_0x326403,_0x13edbe,_0xd3cbe0,_0x21b54f,_0xd3cbe0[_0x8c4b('0x51')],_0x2d3e7c);})['then'](function(_0x47f1bc){_0x225c69=_0x47f1bc;logger[_0x8c4b('0x17')](_0x8c4b('0x52'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x225c69['id']);var _0x4da4d0=util[_0x8c4b('0x1c')](_0x8c4b('0x53'),_0xb3df62['remoteUri'],_[_0x8c4b('0x54')](_0x225c69['id'],'x')[0x1]);logger['info'](_0x8c4b('0x55'),_0x8c4b('0x56'));emit(util[_0x8c4b('0x1c')](_0x8c4b('0x57'),_0x766e53[_0x8c4b('0x15')]),_0x8c4b('0x58'),{'uri':_0x4da4d0});})['catch'](function(_0x7a61f0){logger['error'](_0x8c4b('0x55'),JSON[_0x8c4b('0x23')](_0x7a61f0));});};exports['outbound']=function(_0x550cbb,_0x1c6604,_0x578b28,_0x3d0d9d,_0x4ee088,_0x43fc9d,_0x342db8){var _0x4d8271,_0x53d076,_0xa6c863,_0x2d510f;_0x43fc9d[_0x8c4b('0x1e')]=intUtil[_0x8c4b('0x59')](_0x43fc9d[_0x8c4b('0x1e')]);_0x43fc9d[_0x8c4b('0x5a')]=intUtil[_0x8c4b('0x59')](_0x43fc9d['serverUrl']);if(_0x342db8&&_0x342db8[_0x8c4b('0x5b')]&&_0x342db8[_0x8c4b('0x5b')]!==_0x8c4b('0x5c')){logger[_0x8c4b('0x17')]('[OUTBOUND]',_0x8c4b('0x49'));_0x1c6604[_0x8c4b('0x4a')]=util['format'](_0x8c4b('0x4b'),_0x43fc9d[_0x8c4b('0x5a')],_0x1c6604[_0x8c4b('0x4c')],md5(_0x1c6604[_0x8c4b('0x4c')]));}return getConnection(_0x43fc9d)[_0x8c4b('0x39')](function(_0x453b26){_0x2d510f=_0x453b26;return getUser(_0x43fc9d,_0x3d0d9d[_0x8c4b('0x4d')],_0x2d510f);})[_0x8c4b('0x39')](function(_0x547fdf){_0x4d8271=_0x547fdf;logger[_0x8c4b('0x17')](_0x8c4b('0x4e'),_0x4d8271['id']);return getEndUser(_0x43fc9d,_0x1c6604[_0x8c4b('0x5d')],_0x1c6604['destcalleridnum'],_0x2d510f);})['then'](function(_0x5a9c7d){_0x53d076=_0x5a9c7d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x53d076['id']);return createTicket(_0x43fc9d,_0x4d8271,_0x53d076,_0x578b28,_0x1c6604,_0x578b28[_0x8c4b('0x51')],_0x2d510f);})[_0x8c4b('0x39')](function(_0x129f63){_0xa6c863=_0x129f63;logger[_0x8c4b('0x17')](_0x8c4b('0x52'));logger['info'](_0x8c4b('0x5e'),_0xa6c863['id']);var _0x484f31=util[_0x8c4b('0x1c')](_0x8c4b('0x53'),_0x43fc9d[_0x8c4b('0x1e')],_[_0x8c4b('0x54')](_0xa6c863['id'],'x')[0x1]);logger[_0x8c4b('0x17')](_0x8c4b('0x5f'),_0x8c4b('0x56'));emit(util[_0x8c4b('0x1c')](_0x8c4b('0x57'),_0x3d0d9d['name']),_0x8c4b('0x58'),{'uri':_0x484f31});})[_0x8c4b('0x35')](function(_0x2a9e97){logger[_0x8c4b('0x28')](_0x8c4b('0x5f'),JSON[_0x8c4b('0x23')](_0x2a9e97));});};exports['unmanaged']=function(_0x34c0c2,_0xa2a3a6,_0x813317,_0x1ceb17,_0x11e84d,_0x4126d7){var _0xf3f385,_0x11c14d,_0x23f36f,_0x2b3a2a;_0x4126d7['remoteUri']=intUtil[_0x8c4b('0x59')](_0x4126d7[_0x8c4b('0x1e')]);_0x4126d7[_0x8c4b('0x5a')]=intUtil['stripTrailingSlash'](_0x4126d7['serverUrl']);if(_0x11e84d&&_0x11e84d[_0x8c4b('0x60')]){logger['info']('['+_0xa2a3a6[_0x8c4b('0x61')][_0x8c4b('0x62')]()+']',_0x8c4b('0x49'));_0xa2a3a6[_0x8c4b('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4126d7[_0x8c4b('0x5a')],_0xa2a3a6[_0x8c4b('0x4c')],md5(_0xa2a3a6[_0x8c4b('0x4c')]));}else{_0xa2a3a6[_0x8c4b('0x4a')]='';}return getConnection(_0x4126d7)[_0x8c4b('0x39')](function(_0x54b515){_0x2b3a2a=_0x54b515;return getUser(_0x4126d7,'',_0x2b3a2a);})[_0x8c4b('0x39')](function(_0x5050a4){_0xf3f385=_0x5050a4;logger['info'](_0x8c4b('0x4e'),_0xf3f385['id']);return getEndUser(_0x4126d7,_0xa2a3a6['calleridname'],_0xa2a3a6[_0x8c4b('0x4f')],_0x2b3a2a);})[_0x8c4b('0x39')](function(_0x11fcd6){_0x11c14d=_0x11fcd6;logger['info'](_0x8c4b('0x50'),_0x11c14d['id']);return createTicket(_0x4126d7,_0xf3f385,_0x11c14d,_0x813317,_0xa2a3a6,_0x813317[_0x8c4b('0x51')],_0x2b3a2a);})['then'](function(_0x1c6fbc){_0x23f36f=_0x1c6fbc;logger['info'](_0x8c4b('0x52'));logger[_0x8c4b('0x17')](_0x8c4b('0x5e'),_0x23f36f['id']);})[_0x8c4b('0x35')](function(_0x419840){logger[_0x8c4b('0x28')]('['+_0xa2a3a6['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x419840));});}; \ No newline at end of file +var _0xc315=['calleridnum','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','vTiger','redis','localhost','emit','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','merge','Open','getString','Subjects','Descriptions','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','error','getUser','userId','Searching\x20end\x20user\x20with\x20phone','GET','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','lastname','phone','getEndUser','getchallenge','POST','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','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','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','trigger:browser:url','lastevent','toUpperCase'];(function(_0x509404,_0x32fbcf){var _0x14f242=function(_0xd3be3a){while(--_0xd3be3a){_0x509404['push'](_0x509404['shift']());}};_0x14f242(++_0x32fbcf);}(_0xc315,0x137));var _0x5c31=function(_0x59d72e,_0x43ccea){_0x59d72e=_0x59d72e-0x0;var _0x5c94c0=_0xc315[_0x59d72e];return _0x5c94c0;};'use strict';var _=require(_0x5c31('0x0'));var rp=require(_0x5c31('0x1'));var BPromise=require(_0x5c31('0x2'));var md5=require(_0x5c31('0x3'));var util=require(_0x5c31('0x4'));var Redis=require(_0x5c31('0x5'));var intUtil=require(_0x5c31('0x6'));var config=require('../../../../config/environment');var logger=require(_0x5c31('0x7'))(_0x5c31('0x8'));config[_0x5c31('0x9')]=_['defaults'](config[_0x5c31('0x9')],{'host':_0x5c31('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5c31('0x9')]));function emit(_0x159a44,_0x22c844,_0x30cda3){io['to'](_0x159a44)[_0x5c31('0xb')](_0x22c844,_0x30cda3);}function getCustomFields(_0x5c3a93,_0x1eb6a8){var _0x35f515={};if(_0x5c3a93['length']>0x0){_[_0x5c31('0xc')](_0x5c3a93,function(_0x23d689){if(_0x23d689[_0x5c31('0xd')]===_0x5c31('0xe')&&_0x23d689[_0x5c31('0xf')]){_0x35f515[_0x23d689['idField']]=_0x23d689[_0x5c31('0x10')][_0x5c31('0x11')]();}else if(_0x23d689[_0x5c31('0xd')]===_0x5c31('0x12')&&_0x23d689[_0x5c31('0x13')]&&_0x23d689[_0x5c31('0xf')]&&_0x1eb6a8[_0x23d689[_0x5c31('0x13')]]){_0x35f515[_0x23d689[_0x5c31('0xf')]]=_0x1eb6a8[_0x23d689[_0x5c31('0x13')]]['toString']();}else if(_0x23d689['type']===_0x5c31('0x14')&&_0x23d689[_0x5c31('0x15')]&&_0x23d689[_0x5c31('0x15')][_0x5c31('0x16')]&&_0x23d689['idField']&&_0x1eb6a8[_0x23d689['Variable'][_0x5c31('0x16')][_0x5c31('0x17')]()]){_0x35f515[_0x23d689['idField']]=_0x1eb6a8[_0x23d689[_0x5c31('0x15')][_0x5c31('0x16')][_0x5c31('0x17')]()]['toString']();}});}return _0x35f515;}function createTicket(_0x3423f4,_0x3955d7,_0x4deaa9,_0x16789b,_0xa57998,_0x2ac8ca,_0x1b478a){logger[_0x5c31('0x18')]('Creating\x20new\x20ticket...');var _0x1b910a=_[_0x5c31('0x19')]({'parent_id':'','assigned_user_id':_0x3955d7['id'],'ticketpriorities':'Normal','ticketstatus':_0x5c31('0x1a'),'ticket_title':intUtil[_0x5c31('0x1b')](_0x16789b[_0x5c31('0x1c')],_0xa57998,'\x20'),'description':intUtil[_0x5c31('0x1b')](_0x16789b[_0x5c31('0x1d')],_0xa57998,'\x0a'),'contact_id':_0x4deaa9['id']},getCustomFields(_0x2ac8ca,_0xa57998));var _0x2cde3c={'method':'POST','uri':util[_0x5c31('0x1e')](_0x5c31('0x1f'),_0x3423f4['remoteUri']),'form':{'operation':_0x5c31('0x20'),'username':_0x3423f4[_0x5c31('0x21')],'sessionName':_0x1b478a[_0x5c31('0x22')],'elementType':_0x5c31('0x23'),'element':JSON[_0x5c31('0x24')](_0x1b910a)},'json':!![]};return request(_0x2cde3c)[_0x5c31('0x25')](function(_0x1cbad5){if(_0x1cbad5[_0x5c31('0x26')]){return BPromise[_0x5c31('0x27')]({'id':_0x1cbad5[_0x5c31('0x28')]['id']});}else{throw new Error(util['format'](_0x5c31('0x29'),JSON[_0x5c31('0x24')](_0x1cbad5['error'])));}})['catch'](function(_0x1009b3){var _0x8b4d76=_0x1009b3[_0x5c31('0x2a')]||0x1f4;logger['error'](_0x5c31('0x2b'),_0x5c31('0x2c'),_0x8b4d76,JSON[_0x5c31('0x24')](_0x1009b3));});}function getUser(_0x7a164f,_0x30cc2f,_0x5f2ae3){if(intUtil[_0x5c31('0x2d')](_0x30cc2f)){logger['info'](_0x5c31('0x2e'),_0x30cc2f);return request({'method':'GET','uri':util[_0x5c31('0x1e')](_0x5c31('0x1f'),_0x7a164f[_0x5c31('0x2f')]),'qs':{'operation':_0x5c31('0x30'),'username':_0x7a164f[_0x5c31('0x21')],'sessionName':_0x5f2ae3[_0x5c31('0x22')],'query':util[_0x5c31('0x1e')](_0x5c31('0x31'),_0x30cc2f)},'json':!![]})[_0x5c31('0x25')](function(_0x65deda){if(_0x65deda[_0x5c31('0x26')]&&_0x65deda['result']['length']){logger[_0x5c31('0x18')]('Agent\x20found!');return BPromise[_0x5c31('0x27')]({'id':_0x65deda[_0x5c31('0x28')][0x0]['id'],'email':_0x65deda[_0x5c31('0x28')][0x0][_0x5c31('0x32')],'name':_0x65deda[_0x5c31('0x28')][0x0][_0x5c31('0x33')]+'\x20'+_0x65deda[_0x5c31('0x28')][_0x5c31('0x34')]});}else{logger[_0x5c31('0x18')](_0x5c31('0x35'));return BPromise['resolve']({'id':_0x5f2ae3['userId'],'email':_0x7a164f[_0x5c31('0x21')],'name':_0x5c31('0x36')});}})[_0x5c31('0x37')](function(_0x29803e){var _0x3cf279=_0x29803e[_0x5c31('0x2a')]||0x1f4;logger[_0x5c31('0x38')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x5c31('0x39'),_0x3cf279,JSON['stringify'](_0x29803e));});}else{logger[_0x5c31('0x18')](_0x5c31('0x35'));return BPromise[_0x5c31('0x27')]({'id':_0x5f2ae3[_0x5c31('0x3a')],'email':_0x7a164f[_0x5c31('0x21')],'name':_0x5c31('0x36')})[_0x5c31('0x37')](function(_0x1657aa){var _0x6267f9=_0x1657aa['statusCode']||0x1f4;logger[_0x5c31('0x38')](_0x5c31('0x2b'),_0x5c31('0x39'),_0x6267f9,JSON[_0x5c31('0x24')](_0x1657aa));});}}function getEndUser(_0x3dd55a,_0x4efda5,_0x3b73b4,_0x597bd9){logger['info'](_0x5c31('0x3b'),_0x3b73b4);return request({'method':_0x5c31('0x3c'),'uri':util[_0x5c31('0x1e')]('%s/webservice.php',_0x3dd55a[_0x5c31('0x2f')]),'qs':{'operation':_0x5c31('0x30'),'username':_0x3dd55a['username'],'sessionName':_0x597bd9[_0x5c31('0x22')],'query':util[_0x5c31('0x1e')]('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;',_0x3b73b4,_0x3b73b4,_0x3b73b4,_0x3b73b4,_0x3b73b4)},'json':!![]})[_0x5c31('0x25')](function(_0x3631c0){if(_0x3631c0['success']&&_0x3631c0[_0x5c31('0x28')][_0x5c31('0x3d')]){logger['info'](_0x5c31('0x3e'));return BPromise['resolve']({'id':_0x3631c0['result'][0x0]['id'],'name':_0x3631c0[_0x5c31('0x28')][0x0]['firstname']+'\x20'+_0x3631c0['result'][0x0]['lastname'],'phone':_0x3b73b4});}else{logger[_0x5c31('0x18')](_0x5c31('0x3f'));return request({'method':'POST','uri':util['format'](_0x5c31('0x1f'),_0x3dd55a[_0x5c31('0x2f')]),'form':{'operation':_0x5c31('0x20'),'sessionName':_0x597bd9[_0x5c31('0x22')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x4efda5,'phone':_0x3b73b4,'assigned_user_id':'\x20'})},'json':!![]})[_0x5c31('0x25')](function(_0x300a0a){logger[_0x5c31('0x18')](_0x5c31('0x40'));return BPromise['resolve']({'id':_0x300a0a['result']['id'],'name':_0x300a0a[_0x5c31('0x28')][_0x5c31('0x41')],'phone':_0x300a0a[_0x5c31('0x28')][_0x5c31('0x42')]});})[_0x5c31('0x37')](function(_0x53692b){var _0x4ef663=_0x53692b[_0x5c31('0x2a')]||0x1f4;logger[_0x5c31('0x38')](_0x5c31('0x2b'),_0x5c31('0x43'),_0x4ef663,JSON['stringify'](_0x53692b));});}});}function getConnection(_0x115d30){var _0x5236bd=_0x115d30['username'];var _0x56c203=_0x115d30['accessKey'];return request({'method':'GET','uri':util['format'](_0x5c31('0x1f'),_0x115d30[_0x5c31('0x2f')]),'qs':{'operation':_0x5c31('0x44'),'username':_0x5236bd},'json':!![]})['then'](function(_0x57795e){if(_0x57795e[_0x5c31('0x26')]){return request({'method':_0x5c31('0x45'),'uri':util[_0x5c31('0x1e')](_0x5c31('0x1f'),_0x115d30[_0x5c31('0x2f')]),'form':{'operation':'login','username':_0x5236bd,'accessKey':md5(_0x57795e[_0x5c31('0x28')][_0x5c31('0x46')]+_0x56c203)},'json':!![]});}})[_0x5c31('0x25')](function(_0x380bae){if(_0x380bae[_0x5c31('0x26')]){return BPromise['resolve'](_0x380bae[_0x5c31('0x28')]);}else{throw new Error(util[_0x5c31('0x1e')](_0x5c31('0x47'),_0x115d30['id']));}})['catch'](function(_0x5d04f4){var _0x5ec8eb=_0x5d04f4[_0x5c31('0x2a')]||0x1f4;logger[_0x5c31('0x38')](_0x5c31('0x2b'),_0x5c31('0x48'),_0x5ec8eb,JSON[_0x5c31('0x24')](_0x5d04f4));});}function request(_0x32d1bc){logger['info'](_0x5c31('0x49'),JSON['stringify'](_0x32d1bc));return rp(_0x32d1bc);}exports[_0x5c31('0x4a')]=function(_0x40b342,_0xe81cc,_0xd96345,_0x272057,_0x2110f9,_0xb4631f){var _0x4dd485,_0x297ce2,_0x20efba,_0x5c4ebe;_0xb4631f[_0x5c31('0x2f')]=intUtil[_0x5c31('0x4b')](_0xb4631f[_0x5c31('0x2f')]);if(_0x2110f9&&_0x2110f9[_0x5c31('0x4c')]){logger['info'](_0x5c31('0x4d'),_0x5c31('0x4e'));_0xe81cc[_0x5c31('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb4631f[_0x5c31('0x50')],_0xe81cc['uniqueid'],md5(_0xe81cc[_0x5c31('0x51')]));}else{_0xe81cc[_0x5c31('0x4f')]='';}return getConnection(_0xb4631f)[_0x5c31('0x25')](function(_0x174087){_0x5c4ebe=_0x174087;return getUser(_0xb4631f,_0x272057[_0x5c31('0x52')],_0x5c4ebe);})[_0x5c31('0x25')](function(_0x4759e0){_0x4dd485=_0x4759e0;logger[_0x5c31('0x18')](_0x5c31('0x53'),_0x4dd485['id']);return getEndUser(_0xb4631f,_0xe81cc[_0x5c31('0x54')],_0xe81cc['calleridnum'],_0x5c4ebe);})[_0x5c31('0x25')](function(_0x267db0){_0x297ce2=_0x267db0;logger[_0x5c31('0x18')]('The\x20Enduser\x20ID\x20is:',_0x297ce2['id']);return createTicket(_0xb4631f,_0x4dd485,_0x297ce2,_0xd96345,_0xe81cc,_0xd96345[_0x5c31('0x55')],_0x5c4ebe);})['then'](function(_0x3c8af5){_0x20efba=_0x3c8af5;logger[_0x5c31('0x18')](_0x5c31('0x56'));logger['info'](_0x5c31('0x57'),_0x20efba['id']);var _0x40ef2d=util[_0x5c31('0x1e')](_0x5c31('0x58'),_0xb4631f[_0x5c31('0x2f')],_[_0x5c31('0x59')](_0x20efba['id'],'x')[0x1]);logger['info']('[QUEUE]',_0x5c31('0x5a'));emit(util[_0x5c31('0x1e')](_0x5c31('0x5b'),_0x272057['name']),'trigger:browser:url',{'uri':_0x40ef2d});})[_0x5c31('0x37')](function(_0x4683b8){logger['error'](_0x5c31('0x4d'),JSON[_0x5c31('0x24')](_0x4683b8));});};exports[_0x5c31('0x5c')]=function(_0x54f704,_0xfbc325,_0x350891,_0x2441ad,_0x33456d,_0x1a1885,_0x354370){var _0x96c04,_0x300ee1,_0x3c8b8f,_0x5117a1;_0x1a1885['remoteUri']=intUtil[_0x5c31('0x4b')](_0x1a1885[_0x5c31('0x2f')]);_0x1a1885[_0x5c31('0x50')]=intUtil[_0x5c31('0x4b')](_0x1a1885[_0x5c31('0x50')]);if(_0x354370&&_0x354370[_0x5c31('0x5d')]&&_0x354370[_0x5c31('0x5d')]!=='none'){logger[_0x5c31('0x18')](_0x5c31('0x5e'),_0x5c31('0x4e'));_0xfbc325[_0x5c31('0x4f')]=util[_0x5c31('0x1e')](_0x5c31('0x5f'),_0x1a1885[_0x5c31('0x50')],_0xfbc325['uniqueid'],md5(_0xfbc325['uniqueid']));}return getConnection(_0x1a1885)[_0x5c31('0x25')](function(_0xe19c76){_0x5117a1=_0xe19c76;return getUser(_0x1a1885,_0x2441ad[_0x5c31('0x52')],_0x5117a1);})[_0x5c31('0x25')](function(_0x23ceac){_0x96c04=_0x23ceac;logger[_0x5c31('0x18')](_0x5c31('0x53'),_0x96c04['id']);return getEndUser(_0x1a1885,_0xfbc325[_0x5c31('0x60')],_0xfbc325[_0x5c31('0x61')],_0x5117a1);})[_0x5c31('0x25')](function(_0x156e69){_0x300ee1=_0x156e69;logger['info']('The\x20Enduser\x20ID\x20is:',_0x300ee1['id']);return createTicket(_0x1a1885,_0x96c04,_0x300ee1,_0x350891,_0xfbc325,_0x350891[_0x5c31('0x55')],_0x5117a1);})[_0x5c31('0x25')](function(_0x2cfd3a){_0x3c8b8f=_0x2cfd3a;logger[_0x5c31('0x18')](_0x5c31('0x56'));logger[_0x5c31('0x18')](_0x5c31('0x57'),_0x3c8b8f['id']);var _0x34f58a=util[_0x5c31('0x1e')](_0x5c31('0x58'),_0x1a1885[_0x5c31('0x2f')],_[_0x5c31('0x59')](_0x3c8b8f['id'],'x')[0x1]);logger['info'](_0x5c31('0x5e'),_0x5c31('0x5a'));emit(util['format']('user:%s',_0x2441ad[_0x5c31('0x16')]),_0x5c31('0x62'),{'uri':_0x34f58a});})['catch'](function(_0x475a16){logger['error']('[OUTBOUND]',JSON['stringify'](_0x475a16));});};exports['unmanaged']=function(_0x20f658,_0x251440,_0x29b2f5,_0x479f37,_0x185c21,_0x6c36b0){var _0x2794a1,_0x210deb,_0x381b47,_0x2cbd71;_0x6c36b0[_0x5c31('0x2f')]=intUtil[_0x5c31('0x4b')](_0x6c36b0[_0x5c31('0x2f')]);_0x6c36b0[_0x5c31('0x50')]=intUtil[_0x5c31('0x4b')](_0x6c36b0[_0x5c31('0x50')]);if(_0x185c21&&_0x185c21[_0x5c31('0x4c')]){logger['info']('['+_0x251440[_0x5c31('0x63')][_0x5c31('0x64')]()+']','Recording\x20is\x20enabled!');_0x251440[_0x5c31('0x4f')]=util[_0x5c31('0x1e')](_0x5c31('0x5f'),_0x6c36b0[_0x5c31('0x50')],_0x251440[_0x5c31('0x51')],md5(_0x251440[_0x5c31('0x51')]));}else{_0x251440['recordingURL']='';}return getConnection(_0x6c36b0)['then'](function(_0x348117){_0x2cbd71=_0x348117;return getUser(_0x6c36b0,'',_0x2cbd71);})[_0x5c31('0x25')](function(_0x2408b4){_0x2794a1=_0x2408b4;logger[_0x5c31('0x18')](_0x5c31('0x53'),_0x2794a1['id']);return getEndUser(_0x6c36b0,_0x251440[_0x5c31('0x54')],_0x251440[_0x5c31('0x65')],_0x2cbd71);})['then'](function(_0xc66e4f){_0x210deb=_0xc66e4f;logger[_0x5c31('0x18')](_0x5c31('0x66'),_0x210deb['id']);return createTicket(_0x6c36b0,_0x2794a1,_0x210deb,_0x29b2f5,_0x251440,_0x29b2f5['Fields'],_0x2cbd71);})['then'](function(_0x1409b5){_0x381b47=_0x1409b5;logger[_0x5c31('0x18')](_0x5c31('0x56'));logger[_0x5c31('0x18')]('The\x20Ticket\x20ID\x20is:',_0x381b47['id']);})[_0x5c31('0x37')](function(_0x416694){logger['error']('['+_0x251440['lastevent'][_0x5c31('0x64')]()+']',JSON[_0x5c31('0x24')](_0x416694));});}; \ 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 c9dcfb6..e01543a 100644 --- a/server/services/ami/trigger/integration/zendesk.js +++ b/server/services/ami/trigger/integration/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['remoteUri','merge','Tags','name','Subjects','getString','Descriptions','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','results','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','user','password','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','base64','debug','GET','map','forEach','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','toString','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','outbound','recordingFormat','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xaa88,0x137));var _0x8aa8=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0xaa88[_0x5c4e16];return _0x36044a;};'use strict';var _=require(_0x8aa8('0x0'));var rp=require(_0x8aa8('0x1'));var md5=require(_0x8aa8('0x2'));var util=require(_0x8aa8('0x3'));var Redis=require('ioredis');var intUtil=require(_0x8aa8('0x4'));var config=require(_0x8aa8('0x5'));var logger=require(_0x8aa8('0x6'))(_0x8aa8('0x7'));config[_0x8aa8('0x8')]=_[_0x8aa8('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8aa8('0xa'))(new Redis(config['redis']));function emit(_0x449d2d,_0x1ed84d,_0x27c08d){io['to'](_0x449d2d)[_0x8aa8('0xb')](_0x1ed84d,_0x27c08d);}var headers={'Content-Type':'application/json','Accept':_0x8aa8('0xc')};function getTicket(_0x2d974c,_0x224f25,_0x5c94d4,_0x4702ab,_0x9f78f5){logger[_0x8aa8('0xd')](_0x8aa8('0xe'));return request({'uri':util['format'](_0x8aa8('0xf'),_0x2d974c[_0x8aa8('0x10')]),'method':'POST','body':{'ticket':_[_0x8aa8('0x11')]({'requester_id':_0x5c94d4['id'],'submitter_id':_0x224f25?_0x224f25['id']:undefined,'assignee_id':_0x224f25?_0x224f25['id']:undefined,'tags':getTags(_0x4702ab[_0x8aa8('0x12')],_0x8aa8('0x13')),'subject':intUtil['getString'](_0x4702ab[_0x8aa8('0x14')],_0x9f78f5,'\x20'),'description':intUtil[_0x8aa8('0x15')](_0x4702ab[_0x8aa8('0x16')],_0x9f78f5,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4702ab[_0x8aa8('0x16')],_0x9f78f5,'\x0a')}},getCustomFields(_0x4702ab['Fields'],_0x9f78f5))}})['then'](function(_0x433e95){logger[_0x8aa8('0xd')](_0x8aa8('0x17'));return _0x433e95[_0x8aa8('0x18')];});}function getUser(_0x42a6a4,_0x3778f4){if(intUtil[_0x8aa8('0x19')](_0x3778f4)){logger[_0x8aa8('0xd')](_0x8aa8('0x1a'),_0x3778f4);return request({'uri':util['format']('%s/search.json',_0x42a6a4[_0x8aa8('0x10')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x3778f4)}})[_0x8aa8('0x1b')](function(_0x5ac0d9){if(_0x5ac0d9[_0x8aa8('0x1c')]){logger[_0x8aa8('0xd')](_0x8aa8('0x1d'));return _[_0x8aa8('0x1e')](_0x5ac0d9['results'],{'email':_0x3778f4,'role':_0x8aa8('0x1f')});}else{logger[_0x8aa8('0xd')](_0x8aa8('0x20'));return request({'uri':util[_0x8aa8('0x21')](_0x8aa8('0x22'),_0x42a6a4[_0x8aa8('0x10')])})['then'](function(_0x26cf63){logger['info'](_0x8aa8('0x23'));return _0x26cf63['user'];});}});}else{logger[_0x8aa8('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8aa8('0x21')](_0x8aa8('0x22'),_0x42a6a4[_0x8aa8('0x10')])})['then'](function(_0x24f428){logger[_0x8aa8('0xd')](_0x8aa8('0x23'));return _0x24f428['user'];});}}function getEndUser(_0x57acd2,_0x2d1508,_0x44e2d8){logger[_0x8aa8('0xd')](_0x8aa8('0x24'),_0x44e2d8);return request({'uri':util[_0x8aa8('0x21')]('%s/search.json',_0x57acd2[_0x8aa8('0x10')]),'qs':{'query':util['format'](_0x8aa8('0x25'),_0x44e2d8)}})[_0x8aa8('0x1b')](function(_0x15ff33){var _0x519ac0;if(_0x15ff33['results'][_0x8aa8('0x26')]){_0x15ff33['results']=_[_0x8aa8('0x27')](_0x15ff33[_0x8aa8('0x28')],{'suspended':![],'role':_0x8aa8('0x29')});if(_0x15ff33[_0x8aa8('0x28')][_0x8aa8('0x26')]){_0x519ac0=_['first'](_0x15ff33[_0x8aa8('0x28')]);}}if(_0x519ac0){logger[_0x8aa8('0xd')]('Enduser\x20found!');return _0x519ac0;}else{logger[_0x8aa8('0xd')](_0x8aa8('0x2a'));return request({'uri':util[_0x8aa8('0x21')]('%s/users.json',_0x57acd2[_0x8aa8('0x10')]),'method':_0x8aa8('0x2b'),'body':{'user':{'role':_0x8aa8('0x29'),'name':util[_0x8aa8('0x21')](_0x8aa8('0x2c'),_0x2d1508||_0x44e2d8),'phone':_0x44e2d8}}})[_0x8aa8('0x1b')](function(_0x370401){logger[_0x8aa8('0xd')](_0x8aa8('0x2d'));return _0x370401[_0x8aa8('0x2e')];});}});}function getAuth(_0x3e069a){var _0x5bf1a7;if(_0x3e069a['authType']===_0x8aa8('0x2f')){_0x5bf1a7=util[_0x8aa8('0x21')](_0x8aa8('0x30'),_0x3e069a[_0x8aa8('0x31')],_0x3e069a[_0x8aa8('0x2f')]);}else if(_0x3e069a[_0x8aa8('0x32')]==='token'){_0x5bf1a7=util['format'](_0x8aa8('0x33'),_0x3e069a['username'],_0x3e069a[_0x8aa8('0x34')]);}return util[_0x8aa8('0x21')](_0x8aa8('0x35'),new Buffer(_0x5bf1a7)['toString'](_0x8aa8('0x36')));}function request(_0x38b8d4){logger[_0x8aa8('0x37')]('[HTTP]',JSON['stringify'](_0x38b8d4));return rp(_[_0x8aa8('0x9')](_0x38b8d4,{'method':_0x8aa8('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x52f87d,_0x24eb18){var _0x2e1f52=[];if(_0x52f87d&&_0x52f87d['length']>0x0){_0x2e1f52=_[_0x8aa8('0x39')](_0x52f87d,_0x24eb18);}return _0x2e1f52;}function getCustomFields(_0x48c3ba,_0x530a66){var _0x2f8f19=[];var _0x5537ff={'custom_fields':[]};if(_0x48c3ba[_0x8aa8('0x26')]>0x0){_[_0x8aa8('0x3a')](_0x48c3ba,function(_0x926ff2){if(_0x926ff2[_0x8aa8('0x3b')]==='string'&&_0x926ff2[_0x8aa8('0x3c')]&&!_0x926ff2[_0x8aa8('0x3d')]){_0x5537ff[_0x926ff2['nameField'][_0x8aa8('0x3e')]()]=_0x926ff2[_0x8aa8('0x3f')]['toString']();}else if(_0x926ff2[_0x8aa8('0x3b')]===_0x8aa8('0x40')&&_0x926ff2[_0x8aa8('0x41')]&&_0x926ff2[_0x8aa8('0x3d')]){_0x5537ff[_0x8aa8('0x42')][_0x8aa8('0x43')]({'id':_0x926ff2[_0x8aa8('0x41')],'value':_0x926ff2[_0x8aa8('0x3f')][_0x8aa8('0x44')]()});}else if(_0x926ff2[_0x8aa8('0x3b')]===_0x8aa8('0x45')&&_0x926ff2[_0x8aa8('0x46')]&&_0x926ff2[_0x8aa8('0x41')]&&_0x926ff2[_0x8aa8('0x3d')]){_0x530a66[_0x926ff2[_0x8aa8('0x46')]]&&_0x5537ff[_0x8aa8('0x42')]['push']({'id':_0x926ff2[_0x8aa8('0x41')],'value':_0x530a66[_0x926ff2['variableName']]['toString']()});}else if(_0x926ff2['type']===_0x8aa8('0x47')&&_0x926ff2['Variable']&&_0x926ff2['Variable'][_0x8aa8('0x13')]&&_0x926ff2['idField']&&_0x926ff2[_0x8aa8('0x3d')]){_0x530a66[_0x926ff2['Variable']['name'][_0x8aa8('0x3e')]()]&&_0x5537ff[_0x8aa8('0x42')][_0x8aa8('0x43')]({'id':_0x926ff2[_0x8aa8('0x41')],'value':_0x530a66[_0x926ff2[_0x8aa8('0x48')][_0x8aa8('0x13')][_0x8aa8('0x3e')]()]['toString']()});}});}return _0x5537ff;}exports[_0x8aa8('0x49')]=function(_0x53a7a4,_0x2aec13,_0x1367db,_0x44ba22,_0x2bc6d3,_0x2a0a14){var _0x44f2b4,_0x5adcda;_0x2a0a14['remoteUri']=intUtil[_0x8aa8('0x4a')](_0x2a0a14[_0x8aa8('0x10')]);_0x2a0a14['serverUrl']=intUtil[_0x8aa8('0x4a')](_0x2a0a14[_0x8aa8('0x4b')]);if(_0x2bc6d3&&_0x2bc6d3[_0x8aa8('0x4c')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x2aec13['recordingURL']=util[_0x8aa8('0x21')](_0x8aa8('0x4d'),_0x2a0a14['serverUrl'],_0x2aec13[_0x8aa8('0x4e')],md5(_0x2aec13[_0x8aa8('0x4e')]));}else{_0x2aec13[_0x8aa8('0x4f')]='';}headers[_0x8aa8('0x50')]=getAuth(_0x2a0a14);return getUser(_0x2a0a14,_0x44ba22[_0x8aa8('0x51')])[_0x8aa8('0x1b')](function(_0x4e6b80){_0x44f2b4=_0x4e6b80;logger['info'](_0x8aa8('0x52'),_0x44f2b4['id']);return getEndUser(_0x2a0a14,_0x2aec13['calleridname'],_0x2aec13[_0x8aa8('0x53')]);})['then'](function(_0x1b4843){_0x5adcda=_0x1b4843;logger[_0x8aa8('0xd')](_0x8aa8('0x54'),_0x5adcda['id']);return getTicket(_0x2a0a14,_0x44f2b4,_0x5adcda,_0x1367db,_0x2aec13);})[_0x8aa8('0x1b')](function(_0x36de37){if(_0x36de37){logger[_0x8aa8('0xd')](_0x8aa8('0x55'),_0x36de37['id']);switch(_0x2a0a14[_0x8aa8('0x3b')]){case _0x8aa8('0x56'):logger[_0x8aa8('0xd')](_0x8aa8('0x57'),_0x8aa8('0x58'));return request({'uri':util['format'](_0x8aa8('0x59'),_0x2a0a14['remoteUri'],_0x44f2b4['id'],_0x36de37['id']),'method':'POST'});case'newTab':logger[_0x8aa8('0xd')]('[QUEUE]',_0x8aa8('0x5a'));emit(util[_0x8aa8('0x21')](_0x8aa8('0x5b'),_0x44ba22['name']),_0x8aa8('0x5c'),{'uri':util[_0x8aa8('0x21')](_0x8aa8('0x5d'),_0x2a0a14[_0x8aa8('0x10')],_0x36de37['id'])});break;default:logger['error']('[QUEUE]',_0x8aa8('0x5e'));}}})[_0x8aa8('0x5f')](function(_0x45ef2d){logger[_0x8aa8('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x45ef2d,{'showHidden':!![],'depth':null}));});};exports[_0x8aa8('0x61')]=function(_0x1bd389,_0x26eb56,_0x4bf6bc,_0x33e9ae,_0x3a814f,_0x501805,_0x5aa8a5){var _0x4b6fd7,_0x55e186;_0x501805[_0x8aa8('0x10')]=intUtil['stripTrailingSlash'](_0x501805[_0x8aa8('0x10')]);_0x501805[_0x8aa8('0x4b')]=intUtil['stripTrailingSlash'](_0x501805['serverUrl']);if(_0x5aa8a5&&_0x5aa8a5[_0x8aa8('0x62')]&&_0x5aa8a5[_0x8aa8('0x62')]!=='none'){logger['info']('[OUTBOUND]',_0x8aa8('0x63'));_0x26eb56[_0x8aa8('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x501805[_0x8aa8('0x4b')],_0x26eb56[_0x8aa8('0x4e')],md5(_0x26eb56['uniqueid']));}headers[_0x8aa8('0x50')]=getAuth(_0x501805);return getUser(_0x501805,_0x33e9ae[_0x8aa8('0x51')])['then'](function(_0x4c8431){_0x4b6fd7=_0x4c8431;logger['info'](_0x8aa8('0x52'),_0x4b6fd7['id']);return getEndUser(_0x501805,_0x26eb56['destcalleridname'],_0x26eb56[_0x8aa8('0x64')]);})[_0x8aa8('0x1b')](function(_0x3e105e){_0x55e186=_0x3e105e;logger[_0x8aa8('0xd')](_0x8aa8('0x54'),_0x55e186['id']);return getTicket(_0x501805,_0x4b6fd7,_0x55e186,_0x4bf6bc,_0x26eb56);})['then'](function(_0x379c66){if(_0x379c66){logger[_0x8aa8('0xd')](_0x8aa8('0x55'),_0x379c66['id']);switch(_0x501805[_0x8aa8('0x3b')]){case'integrationTab':logger[_0x8aa8('0xd')](_0x8aa8('0x65'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8aa8('0x21')](_0x8aa8('0x59'),_0x501805[_0x8aa8('0x10')],_0x4b6fd7['id'],_0x379c66['id']),'method':_0x8aa8('0x2b')});case _0x8aa8('0x66'):logger[_0x8aa8('0xd')](_0x8aa8('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x33e9ae[_0x8aa8('0x13')]),_0x8aa8('0x5c'),{'uri':util[_0x8aa8('0x21')](_0x8aa8('0x5d'),_0x501805[_0x8aa8('0x10')],_0x379c66['id'])});break;default:logger[_0x8aa8('0x60')](_0x8aa8('0x65'),_0x8aa8('0x5e'));}}})[_0x8aa8('0x5f')](function(_0x3cc282){logger[_0x8aa8('0x60')](_0x8aa8('0x67'),util[_0x8aa8('0x68')](_0x3cc282,{'showHidden':!![],'depth':null}));});};exports[_0x8aa8('0x69')]=function(_0x3e80ac,_0x36523a,_0x84c520,_0x2f561d,_0x28cf8a,_0x57c6f5){var _0x3b0e4d,_0x233169;_0x57c6f5[_0x8aa8('0x10')]=intUtil[_0x8aa8('0x4a')](_0x57c6f5[_0x8aa8('0x10')]);_0x57c6f5[_0x8aa8('0x4b')]=intUtil[_0x8aa8('0x4a')](_0x57c6f5[_0x8aa8('0x4b')]);if(_0x28cf8a&&_0x28cf8a[_0x8aa8('0x4c')]){logger['info']('['+_0x36523a[_0x8aa8('0x6a')][_0x8aa8('0x6b')]()+']','Recording\x20is\x20enabled!');_0x36523a[_0x8aa8('0x4f')]=util['format'](_0x8aa8('0x4d'),_0x57c6f5[_0x8aa8('0x4b')],_0x36523a['uniqueid'],md5(_0x36523a[_0x8aa8('0x4e')]));}else{_0x36523a[_0x8aa8('0x4f')]='';}headers[_0x8aa8('0x50')]=getAuth(_0x57c6f5);return getUser(_0x57c6f5)[_0x8aa8('0x1b')](function(_0xd136db){_0x3b0e4d=_0xd136db;logger[_0x8aa8('0xd')](_0x8aa8('0x52'),_0x3b0e4d['id']);return getEndUser(_0x57c6f5,_0x36523a['calleridname'],_0x36523a[_0x8aa8('0x53')]);})[_0x8aa8('0x1b')](function(_0x300ab8){_0x233169=_0x300ab8;logger[_0x8aa8('0xd')]('The\x20Enduser\x20ID\x20is:',_0x233169['id']);return getTicket(_0x57c6f5,_0x3b0e4d,_0x233169,_0x84c520,_0x36523a);})['then'](function(_0x284600){if(_0x284600){logger[_0x8aa8('0xd')](_0x8aa8('0x55'),_0x284600['id']);}})[_0x8aa8('0x5f')](function(_0x486e83){logger['error']('['+_0x36523a['lastevent'][_0x8aa8('0x6b')]()+']'+_0x8aa8('0x6c'),util[_0x8aa8('0x68')](_0x486e83,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0fd9=['toString','base64','debug','[HTTP]','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variableName','customVariable','Variable','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','[QUEUE]','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','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20Ticket\x20ID\x20is:','integrationTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lastevent','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s'];(function(_0x105342,_0x5fb601){var _0x52b1d9=function(_0x26097f){while(--_0x26097f){_0x105342['push'](_0x105342['shift']());}};_0x52b1d9(++_0x5fb601);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x0fd9[_0x2f48cd];return _0x193ae2;};'use strict';var _=require('lodash');var rp=require(_0x90fd('0x0'));var md5=require(_0x90fd('0x1'));var util=require(_0x90fd('0x2'));var Redis=require(_0x90fd('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x90fd('0x4'))(_0x90fd('0x5'));config[_0x90fd('0x6')]=_[_0x90fd('0x7')](config[_0x90fd('0x6')],{'host':_0x90fd('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x128c17,_0x50c778,_0x5a604a){io['to'](_0x128c17)[_0x90fd('0x9')](_0x50c778,_0x5a604a);}var headers={'Content-Type':_0x90fd('0xa'),'Accept':'application/json'};function getTicket(_0x234ba9,_0x464236,_0x3c0592,_0x3262f6,_0x289693){logger[_0x90fd('0xb')](_0x90fd('0xc'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0xe'),_0x234ba9['remoteUri']),'method':_0x90fd('0xf'),'body':{'ticket':_[_0x90fd('0x10')]({'requester_id':_0x3c0592['id'],'submitter_id':_0x464236?_0x464236['id']:undefined,'assignee_id':_0x464236?_0x464236['id']:undefined,'tags':getTags(_0x3262f6['Tags'],_0x90fd('0x11')),'subject':intUtil[_0x90fd('0x12')](_0x3262f6[_0x90fd('0x13')],_0x289693,'\x20'),'description':intUtil['getString'](_0x3262f6[_0x90fd('0x14')],_0x289693,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x3262f6[_0x90fd('0x14')],_0x289693,'\x0a')}},getCustomFields(_0x3262f6[_0x90fd('0x15')],_0x289693))}})[_0x90fd('0x16')](function(_0x1b3f3b){logger[_0x90fd('0xb')](_0x90fd('0x17'));return _0x1b3f3b[_0x90fd('0x18')];});}function getUser(_0x4eb953,_0x4f6b7b){if(intUtil[_0x90fd('0x19')](_0x4f6b7b)){logger[_0x90fd('0xb')]('Getting\x20agent\x20with\x20email',_0x4f6b7b);return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x1a'),_0x4eb953[_0x90fd('0x1b')]),'qs':{'query':util['format'](_0x90fd('0x1c'),_0x4f6b7b)}})[_0x90fd('0x16')](function(_0x16d8a7){if(_0x16d8a7[_0x90fd('0x1d')]){logger[_0x90fd('0xb')](_0x90fd('0x1e'));return _[_0x90fd('0x1f')](_0x16d8a7[_0x90fd('0x20')],{'email':_0x4f6b7b,'role':_0x90fd('0x21')});}else{logger[_0x90fd('0xb')](_0x90fd('0x22'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x23'),_0x4eb953[_0x90fd('0x1b')])})[_0x90fd('0x16')](function(_0x493c26){logger[_0x90fd('0xb')](_0x90fd('0x24'));return _0x493c26[_0x90fd('0x25')];});}});}else{logger[_0x90fd('0xb')](_0x90fd('0x22'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x23'),_0x4eb953[_0x90fd('0x1b')])})['then'](function(_0x25d19d){logger['info'](_0x90fd('0x24'));return _0x25d19d[_0x90fd('0x25')];});}}function getEndUser(_0x2ffea2,_0x31667c,_0x18beb5){logger['info'](_0x90fd('0x26'),_0x18beb5);return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x1a'),_0x2ffea2[_0x90fd('0x1b')]),'qs':{'query':util[_0x90fd('0xd')](_0x90fd('0x27'),_0x18beb5)}})['then'](function(_0x5671fc){var _0xbf1c9b;if(_0x5671fc[_0x90fd('0x20')][_0x90fd('0x28')]){_0x5671fc[_0x90fd('0x20')]=_[_0x90fd('0x29')](_0x5671fc['results'],{'suspended':![],'role':'end-user'});if(_0x5671fc[_0x90fd('0x20')][_0x90fd('0x28')]){_0xbf1c9b=_[_0x90fd('0x2a')](_0x5671fc[_0x90fd('0x20')]);}}if(_0xbf1c9b){logger['info']('Enduser\x20found!');return _0xbf1c9b;}else{logger[_0x90fd('0xb')](_0x90fd('0x2b'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x2c'),_0x2ffea2['remoteUri']),'method':_0x90fd('0xf'),'body':{'user':{'role':_0x90fd('0x2d'),'name':util[_0x90fd('0xd')](_0x90fd('0x2e'),_0x31667c||_0x18beb5),'phone':_0x18beb5}}})[_0x90fd('0x16')](function(_0x204255){logger[_0x90fd('0xb')](_0x90fd('0x2f'));return _0x204255[_0x90fd('0x25')];});}});}function getAuth(_0x244381){var _0x7da2c;if(_0x244381[_0x90fd('0x30')]===_0x90fd('0x31')){_0x7da2c=util[_0x90fd('0xd')](_0x90fd('0x32'),_0x244381[_0x90fd('0x33')],_0x244381['password']);}else if(_0x244381[_0x90fd('0x30')]===_0x90fd('0x34')){_0x7da2c=util[_0x90fd('0xd')](_0x90fd('0x35'),_0x244381[_0x90fd('0x33')],_0x244381[_0x90fd('0x34')]);}return util[_0x90fd('0xd')](_0x90fd('0x36'),new Buffer(_0x7da2c)[_0x90fd('0x37')](_0x90fd('0x38')));}function request(_0xc8a0d6){logger[_0x90fd('0x39')](_0x90fd('0x3a'),JSON['stringify'](_0xc8a0d6));return rp(_[_0x90fd('0x7')](_0xc8a0d6,{'method':_0x90fd('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x1ea5da,_0x35a4a9){var _0x53cac2=[];if(_0x1ea5da&&_0x1ea5da[_0x90fd('0x28')]>0x0){_0x53cac2=_[_0x90fd('0x3c')](_0x1ea5da,_0x35a4a9);}return _0x53cac2;}function getCustomFields(_0xb37e41,_0x591a4e){var _0x543a3e=[];var _0x421177={'custom_fields':[]};if(_0xb37e41[_0x90fd('0x28')]>0x0){_[_0x90fd('0x3d')](_0xb37e41,function(_0xb7c342){if(_0xb7c342[_0x90fd('0x3e')]===_0x90fd('0x3f')&&_0xb7c342[_0x90fd('0x40')]&&!_0xb7c342[_0x90fd('0x41')]){_0x421177[_0xb7c342[_0x90fd('0x40')][_0x90fd('0x42')]()]=_0xb7c342[_0x90fd('0x43')][_0x90fd('0x37')]();}else if(_0xb7c342[_0x90fd('0x3e')]===_0x90fd('0x3f')&&_0xb7c342[_0x90fd('0x44')]&&_0xb7c342[_0x90fd('0x41')]){_0x421177[_0x90fd('0x45')][_0x90fd('0x46')]({'id':_0xb7c342['idField'],'value':_0xb7c342[_0x90fd('0x43')][_0x90fd('0x37')]()});}else if(_0xb7c342[_0x90fd('0x3e')]==='variable'&&_0xb7c342['variableName']&&_0xb7c342['idField']&&_0xb7c342[_0x90fd('0x41')]){_0x591a4e[_0xb7c342[_0x90fd('0x47')]]&&_0x421177[_0x90fd('0x45')][_0x90fd('0x46')]({'id':_0xb7c342[_0x90fd('0x44')],'value':_0x591a4e[_0xb7c342[_0x90fd('0x47')]][_0x90fd('0x37')]()});}else if(_0xb7c342[_0x90fd('0x3e')]===_0x90fd('0x48')&&_0xb7c342[_0x90fd('0x49')]&&_0xb7c342[_0x90fd('0x49')][_0x90fd('0x11')]&&_0xb7c342[_0x90fd('0x44')]&&_0xb7c342[_0x90fd('0x41')]){_0x591a4e[_0xb7c342[_0x90fd('0x49')]['name']['toLowerCase']()]&&_0x421177[_0x90fd('0x45')][_0x90fd('0x46')]({'id':_0xb7c342[_0x90fd('0x44')],'value':_0x591a4e[_0xb7c342['Variable']['name'][_0x90fd('0x42')]()][_0x90fd('0x37')]()});}});}return _0x421177;}exports['queue']=function(_0x4f7cab,_0x3f2769,_0x5fc82e,_0x5604d3,_0x50d4e2,_0x260d16){var _0x24c640,_0x169832;_0x260d16['remoteUri']=intUtil[_0x90fd('0x4a')](_0x260d16[_0x90fd('0x1b')]);_0x260d16['serverUrl']=intUtil['stripTrailingSlash'](_0x260d16['serverUrl']);if(_0x50d4e2&&_0x50d4e2[_0x90fd('0x4b')]){logger[_0x90fd('0xb')]('[QUEUE]',_0x90fd('0x4c'));_0x3f2769[_0x90fd('0x4d')]=util[_0x90fd('0xd')](_0x90fd('0x4e'),_0x260d16[_0x90fd('0x4f')],_0x3f2769['uniqueid'],md5(_0x3f2769['uniqueid']));}else{_0x3f2769[_0x90fd('0x4d')]='';}headers[_0x90fd('0x50')]=getAuth(_0x260d16);return getUser(_0x260d16,_0x5604d3[_0x90fd('0x51')])[_0x90fd('0x16')](function(_0x1c17e9){_0x24c640=_0x1c17e9;logger[_0x90fd('0xb')](_0x90fd('0x52'),_0x24c640['id']);return getEndUser(_0x260d16,_0x3f2769[_0x90fd('0x53')],_0x3f2769[_0x90fd('0x54')]);})[_0x90fd('0x16')](function(_0x491696){_0x169832=_0x491696;logger[_0x90fd('0xb')](_0x90fd('0x55'),_0x169832['id']);return getTicket(_0x260d16,_0x24c640,_0x169832,_0x5fc82e,_0x3f2769);})[_0x90fd('0x16')](function(_0x38021b){if(_0x38021b){logger['info']('The\x20Ticket\x20ID\x20is:',_0x38021b['id']);switch(_0x260d16[_0x90fd('0x3e')]){case'integrationTab':logger['info'](_0x90fd('0x56'),_0x90fd('0x57'));return request({'uri':util[_0x90fd('0xd')](_0x90fd('0x58'),_0x260d16[_0x90fd('0x1b')],_0x24c640['id'],_0x38021b['id']),'method':_0x90fd('0xf')});case _0x90fd('0x59'):logger['info']('[QUEUE]',_0x90fd('0x5a'));emit(util[_0x90fd('0xd')](_0x90fd('0x5b'),_0x5604d3['name']),_0x90fd('0x5c'),{'uri':util[_0x90fd('0xd')](_0x90fd('0x5d'),_0x260d16[_0x90fd('0x1b')],_0x38021b['id'])});break;default:logger[_0x90fd('0x5e')](_0x90fd('0x56'),_0x90fd('0x5f'));}}})[_0x90fd('0x60')](function(_0x4ec476){logger['error'](_0x90fd('0x61'),util[_0x90fd('0x62')](_0x4ec476,{'showHidden':!![],'depth':null}));});};exports[_0x90fd('0x63')]=function(_0x4a1ea1,_0x1147d7,_0x47703e,_0x29b880,_0x24229f,_0x43f75a,_0x408e8d){var _0x59e265,_0x1af513;_0x43f75a['remoteUri']=intUtil[_0x90fd('0x4a')](_0x43f75a['remoteUri']);_0x43f75a[_0x90fd('0x4f')]=intUtil[_0x90fd('0x4a')](_0x43f75a[_0x90fd('0x4f')]);if(_0x408e8d&&_0x408e8d[_0x90fd('0x64')]&&_0x408e8d['recordingFormat']!==_0x90fd('0x65')){logger[_0x90fd('0xb')](_0x90fd('0x66'),_0x90fd('0x4c'));_0x1147d7[_0x90fd('0x4d')]=util[_0x90fd('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x43f75a['serverUrl'],_0x1147d7['uniqueid'],md5(_0x1147d7['uniqueid']));}headers['Authorization']=getAuth(_0x43f75a);return getUser(_0x43f75a,_0x29b880[_0x90fd('0x51')])[_0x90fd('0x16')](function(_0x278db5){_0x59e265=_0x278db5;logger[_0x90fd('0xb')](_0x90fd('0x52'),_0x59e265['id']);return getEndUser(_0x43f75a,_0x1147d7['destcalleridname'],_0x1147d7['destcalleridnum']);})['then'](function(_0x23b9db){_0x1af513=_0x23b9db;logger[_0x90fd('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1af513['id']);return getTicket(_0x43f75a,_0x59e265,_0x1af513,_0x47703e,_0x1147d7);})[_0x90fd('0x16')](function(_0x137df0){if(_0x137df0){logger[_0x90fd('0xb')](_0x90fd('0x67'),_0x137df0['id']);switch(_0x43f75a[_0x90fd('0x3e')]){case _0x90fd('0x68'):logger[_0x90fd('0xb')](_0x90fd('0x66'),_0x90fd('0x57'));return request({'uri':util['format'](_0x90fd('0x58'),_0x43f75a[_0x90fd('0x1b')],_0x59e265['id'],_0x137df0['id']),'method':_0x90fd('0xf')});case'newTab':logger['info'](_0x90fd('0x66'),_0x90fd('0x5a'));emit(util['format'](_0x90fd('0x5b'),_0x29b880['name']),'trigger:browser:url',{'uri':util[_0x90fd('0xd')](_0x90fd('0x5d'),_0x43f75a[_0x90fd('0x1b')],_0x137df0['id'])});break;default:logger[_0x90fd('0x5e')](_0x90fd('0x66'),_0x90fd('0x5f'));}}})[_0x90fd('0x60')](function(_0x337bf9){logger['error'](_0x90fd('0x69'),util[_0x90fd('0x62')](_0x337bf9,{'showHidden':!![],'depth':null}));});};exports[_0x90fd('0x6a')]=function(_0x5afdc7,_0x2d0f4b,_0x4636d5,_0x52c920,_0x5cb475,_0x1a4d3f){var _0x333c8d,_0x122794;_0x1a4d3f['remoteUri']=intUtil[_0x90fd('0x4a')](_0x1a4d3f['remoteUri']);_0x1a4d3f['serverUrl']=intUtil[_0x90fd('0x4a')](_0x1a4d3f['serverUrl']);if(_0x5cb475&&_0x5cb475[_0x90fd('0x4b')]){logger[_0x90fd('0xb')]('['+_0x2d0f4b['lastevent'][_0x90fd('0x6b')]()+']',_0x90fd('0x4c'));_0x2d0f4b[_0x90fd('0x4d')]=util[_0x90fd('0xd')](_0x90fd('0x4e'),_0x1a4d3f[_0x90fd('0x4f')],_0x2d0f4b['uniqueid'],md5(_0x2d0f4b['uniqueid']));}else{_0x2d0f4b['recordingURL']='';}headers['Authorization']=getAuth(_0x1a4d3f);return getUser(_0x1a4d3f)[_0x90fd('0x16')](function(_0x3d55d1){_0x333c8d=_0x3d55d1;logger[_0x90fd('0xb')]('The\x20User\x20ID\x20is:',_0x333c8d['id']);return getEndUser(_0x1a4d3f,_0x2d0f4b[_0x90fd('0x53')],_0x2d0f4b[_0x90fd('0x54')]);})['then'](function(_0x44465e){_0x122794=_0x44465e;logger[_0x90fd('0xb')](_0x90fd('0x55'),_0x122794['id']);return getTicket(_0x1a4d3f,_0x333c8d,_0x122794,_0x4636d5,_0x2d0f4b);})[_0x90fd('0x16')](function(_0x5acecb){if(_0x5acecb){logger[_0x90fd('0xb')](_0x90fd('0x67'),_0x5acecb['id']);}})['catch'](function(_0x4a841e){logger['error']('['+_0x2d0f4b[_0x90fd('0x6c')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x90fd('0x62')](_0x4a841e,{'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 3c45f14..a0abade 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 _0x6002=['Administrator','user','profile','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','GET','Zoho-oauthtoken\x20','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','format','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Called','connect','Call_Result','Answered','rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','POST','/crm/v2/Calls','Call\x20created!','err','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','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','string','idField','content','toString','variable','variableName','type','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!'];(function(_0x13c64e,_0x56a158){var _0x1de4c0=function(_0x261d39){while(--_0x261d39){_0x13c64e['push'](_0x13c64e['shift']());}};_0x1de4c0(++_0x56a158);}(_0x6002,0xfe));var _0x2600=function(_0x41db2d,_0x44b304){_0x41db2d=_0x41db2d-0x0;var _0x5a9136=_0x6002[_0x41db2d];return _0x5a9136;};'use strict';var _=require(_0x2600('0x0'));var rp=require(_0x2600('0x1'));var md5=require(_0x2600('0x2'));var util=require(_0x2600('0x3'));var intUtil=require(_0x2600('0x4'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x2600('0x5'));var config=require(_0x2600('0x6'));var logger=require(_0x2600('0x7'))(_0x2600('0x8'));config['redis']=_['defaults'](config[_0x2600('0x9')],{'host':_0x2600('0xa'),'port':0x18eb});var io=require(_0x2600('0xb'))(new Redis(config[_0x2600('0x9')]));function emit(_0x22de15,_0x5e101c,_0x596ac9){io['to'](_0x22de15)['emit'](_0x5e101c,_0x596ac9);}function request(_0x3a045a){logger[_0x2600('0xc')](_0x2600('0xd'),JSON[_0x2600('0xe')](_0x3a045a));return rp(_0x3a045a);}function getCustomFields(_0xf25b93,_0x3ffeda){var _0x2540f6={};if(_0xf25b93[_0x2600('0xf')]>0x0){_[_0x2600('0x10')](_0xf25b93,function(_0x321d11){if(_0x321d11['type']===_0x2600('0x11')&&_0x321d11[_0x2600('0x12')]){_0x2540f6[_0x321d11[_0x2600('0x12')]]=_0x321d11[_0x2600('0x13')][_0x2600('0x14')]();}else if(_0x321d11['type']===_0x2600('0x15')&&_0x321d11[_0x2600('0x16')]&&_0x321d11[_0x2600('0x12')]&&_0x3ffeda[_0x321d11[_0x2600('0x16')]]){_0x2540f6[_0x321d11['idField']]=_0x3ffeda[_0x321d11['variableName']][_0x2600('0x14')]();}else if(_0x321d11[_0x2600('0x17')]===_0x2600('0x18')&&_0x321d11['Variable']&&_0x321d11[_0x2600('0x19')][_0x2600('0x1a')]&&_0x321d11[_0x2600('0x12')]&&_0x3ffeda[_0x321d11[_0x2600('0x19')][_0x2600('0x1a')]['toLowerCase']()]){_0x2540f6[_0x321d11[_0x2600('0x12')]]=_0x3ffeda[_0x321d11[_0x2600('0x19')]['name'][_0x2600('0x1b')]()][_0x2600('0x14')]();}});}return _0x2540f6;}function getName(_0x55b1df){if(_0x55b1df[_0x2600('0x1c')]('\x20')>0x0){var _0x209f73=_0x55b1df[_0x2600('0x1d')](/ (.+)/);if(_0x209f73[0x1]){return _0x209f73;}}return[_0x55b1df,_0x55b1df];}var accountsTokens={};function getAccessToken(_0x5efd1e){return new Promise(function(_0x48735d,_0xe07271){if(!_[_0x2600('0x1e')](accountsTokens[_0x5efd1e['id']])&&!_[_0x2600('0x1e')](accountsTokens[_0x5efd1e['id']]['access_token'])){if(moment()[_0x2600('0x1f')](accountsTokens[_0x5efd1e['id']][_0x2600('0x20')])){_0x48735d(accountsTokens[_0x5efd1e['id']][_0x2600('0x21')]);}}var _0x497e96;switch(_0x5efd1e[_0x2600('0x22')]){case'US':_0x497e96='https://accounts.zoho.com';break;case'AU':_0x497e96=_0x2600('0x23');break;case'EU':_0x497e96='https://accounts.zoho.eu';break;case'IN':_0x497e96=_0x2600('0x24');break;case'CN':_0x497e96=_0x2600('0x25');break;default:_0x497e96=_0x2600('0x26');break;}var _0x2e4be9={'method':'POST','uri':_0x497e96+'/oauth/v2/token','qs':{'refresh_token':_0x5efd1e['refreshToken'],'client_id':_0x5efd1e[_0x2600('0x27')],'client_secret':_0x5efd1e[_0x2600('0x28')],'grant_type':_0x2600('0x29')},'json':!![]};return rp(_0x2e4be9)[_0x2600('0x2a')](function(_0xf53e08){accountsTokens[_0x5efd1e['id']]={'access_token':_0xf53e08[_0x2600('0x21')],'expires_in':moment()[_0x2600('0x2b')](_0xf53e08[_0x2600('0x20')],_0x2600('0x2c'))};_0x48735d(_0xf53e08[_0x2600('0x21')]);})[_0x2600('0x2d')](function(_0xf1c945){logger[_0x2600('0x2e')](_0x2600('0x2f'),_0xf1c945[_0x2600('0x30')]);_0xe07271(_0xf1c945);});});}function getUser(_0x32e22f,_0x24c4ed,_0x1b2c98,_0x4077a0){logger[_0x2600('0x31')](_0x2600('0x32'));return request({'method':'GET','uri':util['format'](_0x2600('0x33'),_0x24c4ed),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x32e22f},'json':!![]})[_0x2600('0x2a')](function(_0x8f19){if(_0x8f19[_0x2600('0x34')]){var _0x1d8375=-0x1;if(_[_0x2600('0x35')](_0x8f19[_0x2600('0x34')])){if(!_[_0x2600('0x1e')](_0x4077a0)){_0x1d8375=_[_0x2600('0x36')](_0x8f19['users'],function(_0x38f4d3){return _0x38f4d3[_0x2600('0x37')]===_0x4077a0;});}if(_0x1d8375>=0x0){logger[_0x2600('0x31')](_0x2600('0x38'));}else{logger[_0x2600('0x31')](_0x2600('0x39'));_0x1d8375=_[_0x2600('0x36')](_0x8f19[_0x2600('0x34')],function(_0x2e7750){return _0x2e7750['profile']['name']===_0x2600('0x3a');});}return _0x8f19[_0x2600('0x34')][_0x1d8375];}else{if(_0x8f19[_0x2600('0x3b')][_0x2600('0x3c')]['name']==='Administrator'){logger[_0x2600('0x31')](_0x2600('0x39'));user=_0x8f19[_0x2600('0x3b')];return user;}else{logger[_0x2600('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x2600('0xe')](_0x8f19));throw new Error(_0x2600('0x3d')+JSON[_0x2600('0xe')](_0x8f19));}}}else{logger[_0x2600('0x2e')](_0x2600('0x3e'),JSON['stringify'](_0x8f19));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x2600('0xe')](_0x8f19));}})[_0x2600('0x2d')](function(_0x1e9b91){console[_0x2600('0x2e')](_0x1e9b91);});}function getZohoUser(_0x5a3b4e,_0x29888b){return new BPromise(function(_0x7da7a4,_0x138a6c){request(_0x5a3b4e)[_0x2600('0x2a')](function(_0x5a995f){var _0x4434ba=null;if(_0x5a995f){_0x4434ba=_0x5a995f[_0x2600('0x3f')][0x0];_0x4434ba[_0x2600('0x40')]=_0x29888b;}_0x7da7a4(_0x4434ba);})['catch'](function(_0xfeeda5){_0x138a6c(_0xfeeda5);});});}function createEndUser(_0x4177b9,_0x367d22,_0x499cf9,_0x3da0cf,_0x22619d,_0x2e93f6){var _0x499cf9=getName(_0x499cf9);return request({'method':'POST','uri':_0x2600('0x41')+_0x367d22+_0x2600('0x42')+_[_0x2600('0x43')](_0x2e93f6[_0x2600('0x44')])+'s','body':{'data':[{'Last_Name':_0x499cf9[0x1],'First_Name':_0x499cf9[0x0],'Phone':_0x3da0cf,'Owner':{'name':!_[_0x2600('0x1e')](_0x22619d[_0x2600('0x45')]['name'])?_0x22619d['role'][_0x2600('0x1a')]:!_[_0x2600('0x1e')](_0x22619d['first_name'])?_0x22619d['first_name']+'\x20'+_0x22619d[_0x2600('0x46')]:_0x22619d['last_name'],'id':_0x22619d['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4177b9},'json':!![]})[_0x2600('0x2a')](function(_0x1564c8){if(_0x1564c8&&_0x1564c8[_0x2600('0x3f')][0x0][_0x2600('0x47')]===_0x2600('0x48')){var _0x3e7c18=_0x1564c8[_0x2600('0x3f')][0x0][_0x2600('0x49')];_0x3e7c18['enduserType']=_['startCase'](_0x2e93f6[_0x2600('0x44')])+'s';return _0x3e7c18;}logger['error'](_0x2600('0x3e'),JSON[_0x2600('0xe')](data));throw new Error('Error:\x20'+JSON[_0x2600('0xe')](data));})['catch'](function(_0xf0d3d4){console[_0x2600('0x4a')](_0x2600('0x4b'),_0xf0d3d4);});}function getEndUser(_0x4ccaba,_0x205962,_0x56b012,_0x1912e0,_0x52d845,_0x3e6b37,_0x21b946){var _0x1e6e22={'method':_0x2600('0x4c'),'uri':'','headers':{'Authorization':_0x2600('0x4d')+_0x4ccaba},'json':!![]};switch(_0x21b946[_0x2600('0x4e')]){case _0x2600('0x4f'):_0x1e6e22[_0x2600('0x50')]=_0x2600('0x41')+_0x205962+_0x2600('0x51')+_0x52d845+'))';return getZohoUser(_0x1e6e22,_0x2600('0x52'))['then'](function(_0x3f95f0){if(_0x3f95f0)return _0x3f95f0;_0x1e6e22[_0x2600('0x50')]=_0x2600('0x41')+_0x205962+_0x2600('0x53')+_0x52d845+'))';return getZohoUser(_0x1e6e22,_0x2600('0x54'))[_0x2600('0x2a')](function(_0x4779ab){if(_0x4779ab)return _0x4779ab;if(_0x21b946['moduleCreate']!=_0x2600('0x55')){return createEndUser(_0x4ccaba,_0x205962,_0x1912e0,_0x52d845,_0x3e6b37,_0x21b946);}else{return{};}});});break;case _0x2600('0x56'):_0x1e6e22[_0x2600('0x50')]=_0x2600('0x41')+_0x205962+_0x2600('0x51')+_0x52d845+'))';return getZohoUser(_0x1e6e22,'Contacts')[_0x2600('0x2a')](function(_0x429fcd){if(_0x429fcd)return _0x429fcd;if(_0x21b946['moduleCreate']!='nothing'){return createEndUser(_0x4ccaba,_0x205962,_0x1912e0,_0x52d845,_0x3e6b37,_0x21b946);}else{return{};}});break;case _0x2600('0x57'):_0x1e6e22[_0x2600('0x50')]='https://www.zohoapis.'+_0x205962+_0x2600('0x53')+_0x52d845+'))';return getZohoUser(_0x1e6e22,_0x2600('0x54'))[_0x2600('0x2a')](function(_0x291111){if(_0x291111)return _0x291111;if(_0x21b946['moduleCreate']!=_0x2600('0x55')){return createEndUser(_0x4ccaba,_0x205962,_0x1912e0,_0x52d845,_0x3e6b37,_0x21b946);}else{return{};}});break;}}function getCall(_0x15b495,_0x266fdc,_0x8abcb5,_0x1a81f5,_0x2792a9,_0x52672c,_0x23ddb3,_0x44279c){logger['info'](_0x2600('0x58'));var _0x3622af={};_0x3622af[_0x2600('0x59')]={'name':!_[_0x2600('0x1e')](_0x1a81f5[_0x2600('0x45')]['name'])&&!_[_0x2600('0x1e')](_0x1a81f5['profile'][_0x2600('0x1a')])&&_0x1a81f5[_0x2600('0x3c')][_0x2600('0x1a')]===_0x2600('0x5a')?_0x1a81f5[_0x2600('0x45')]['name']:!_[_0x2600('0x1e')](_0x1a81f5['first_name'])?_0x1a81f5['first_name']+'\x20'+_0x1a81f5[_0x2600('0x46')]:_0x1a81f5[_0x2600('0x46')],'id':_0x1a81f5['id']};_0x3622af[_0x2600('0x5b')]=intUtil[_0x2600('0x5c')](_0x52672c[_0x2600('0x5d')],_0x23ddb3,'\x20');_0x3622af[_0x2600('0x5e')]=intUtil[_0x2600('0x5c')](_0x52672c[_0x2600('0x5f')],_0x23ddb3,'\x0a');if(_0x2792a9[_0x2600('0x40')]===_0x2600('0x52')){_0x3622af[_0x2600('0x60')]={'name':!_['isNil'](_0x2792a9[_0x2600('0x61')])?_0x2792a9[_0x2600('0x61')]:!_['isNil'](_0x2792a9[_0x2600('0x62')])?_0x2792a9[_0x2600('0x62')]+'\x20'+_0x2792a9['Last_Name']:_0x2792a9[_0x2600('0x63')],'id':_0x2792a9['id']};}if(_0x2792a9[_0x2600('0x40')]===_0x2600('0x54')){_0x3622af[_0x2600('0x64')]={'name':!_[_0x2600('0x1e')](_0x2792a9['Full_Name'])?_0x2792a9[_0x2600('0x61')]:!_['isNil'](_0x2792a9[_0x2600('0x62')])?_0x2792a9['First_Name']+'\x20'+_0x2792a9[_0x2600('0x63')]:_0x2792a9[_0x2600('0x63')],'id':_0x2792a9['id']};_0x3622af[_0x2600('0x65')]=_[_0x2600('0x43')](_0x2792a9[_0x2600('0x40')]);}if(_0x23ddb3[_0x2600('0x66')]){_0x3622af['Call_Duration']=moment['utc'](parseInt(_0x23ddb3[_0x2600('0x66')])*0x3e8)[_0x2600('0x67')]('mm:ss');}else if(_0x23ddb3[_0x2600('0x68')]&&_0x23ddb3['endtime']){_0x3622af['Call_Duration']=moment['utc'](moment(_0x23ddb3[_0x2600('0x69')],_0x2600('0x6a'))[_0x2600('0x6b')](moment(_0x23ddb3['starttime'],_0x2600('0x6a'))))[_0x2600('0x67')]('mm:ss');}switch(_0x23ddb3['lastevent']){case _0x2600('0x6c'):_0x3622af['Call_Result']=_0x2600('0x6d');break;case'complete':case _0x2600('0x6e'):_0x3622af[_0x2600('0x6f')]=_0x2600('0x70');break;case _0x2600('0x71'):_0x3622af[_0x2600('0x6f')]='Rejected';break;case _0x2600('0x72'):_0x3622af[_0x2600('0x6f')]='Abandoned';break;case _0x2600('0x73'):_0x3622af['Call_Result']=_0x2600('0x74');default:}_0x3622af[_0x2600('0x75')]=(_0x44279c===_0x2600('0x76')?moment(_0x23ddb3[_0x2600('0x77')])[_0x2600('0x67')](_0x2600('0x6a')):moment(_0x23ddb3[_0x2600('0x78')])[_0x2600('0x67')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x2600('0x67')](_0x2600('0x6a'));_0x3622af[_0x2600('0x79')]=_0x44279c||_0x2600('0x7a');_0x3622af=_[_0x2600('0x7b')](_0x3622af,getCustomFields(_0x52672c[_0x2600('0x7c')],_0x23ddb3));return request({'method':_0x2600('0x7d'),'uri':'https://www.zohoapis.'+_0x266fdc+_0x2600('0x7e'),'headers':{'Authorization':_0x2600('0x4d')+_0x15b495},'body':{'data':[_0x3622af]},'json':!![]})['then'](function(_0xd7ab03){if(_0xd7ab03&&_0xd7ab03['data'][0x0][_0x2600('0x47')]===_0x2600('0x48')){logger[_0x2600('0x31')](_0x2600('0x7f'));return{'id':_0xd7ab03[_0x2600('0x3f')][0x0][_0x2600('0x49')]['id']};}})[_0x2600('0x2d')](function(_0x6b55ed){logger[_0x2600('0x31')](_0x2600('0x80'),_0x6b55ed[_0x2600('0x30')]);console['log']('err',_0x6b55ed);});}exports['queue']=function(_0x3b3015,_0x186c13,_0xe33104,_0x505d8a,_0x1c3f59,_0x1f8fe9){var _0x272654,_0x1e102e,_0x408367;_0x1f8fe9[_0x2600('0x81')]=intUtil[_0x2600('0x82')](_0x1f8fe9['host']);_0x1f8fe9['serverUrl']=intUtil['stripTrailingSlash'](_0x1f8fe9[_0x2600('0x83')]);if(_0x1c3f59&&_0x1c3f59[_0x2600('0x84')]){logger[_0x2600('0x31')](_0x2600('0x85'),_0x2600('0x86'));_0x186c13[_0x2600('0x87')]=_0x1f8fe9[_0x2600('0x83')]+_0x2600('0x88')+_0x186c13[_0x2600('0x89')]+_0x2600('0x8a')+md5(_0x186c13[_0x2600('0x89')]);}else{_0x186c13[_0x2600('0x87')]='';}var _0x387729=_0x1f8fe9[_0x2600('0x81')]===_0x2600('0x8b')?'eu':_0x2600('0x8c');return getAccessToken(_0x1f8fe9)[_0x2600('0x2a')](function(_0xc908d8){_0x408367=_0xc908d8;return getUser(_0x408367,_0x387729,_0x1f8fe9,_0x505d8a[_0x2600('0x37')]);})['then'](function(_0x30cb88){_0x272654=_0x30cb88;logger[_0x2600('0x31')](_0x2600('0x8d'),_0x272654['id']);return getEndUser(_0x408367,_0x387729,_0x1f8fe9,_0x186c13[_0x2600('0x8e')],_0x186c13[_0x2600('0x8f')],_0x272654,_0xe33104);})['then'](function(_0x12c103){_0x1e102e=_0x12c103;return getCall(_0x408367,_0x387729,_0x1f8fe9,_0x272654,_0x1e102e,_0xe33104,_0x186c13,_0x2600('0x7a'));})[_0x2600('0x2a')](function(_0x581889){if(_0x581889){logger[_0x2600('0x31')]('The\x20Call\x20ID\x20is:',_0x581889['id']);logger[_0x2600('0x31')]('[QUEUE]',_0x2600('0x90'));emit(util[_0x2600('0x67')](_0x2600('0x91'),_0x505d8a[_0x2600('0x1a')]),_0x2600('0x92'),{'uri':_0x2600('0x93')+_0x1f8fe9['host']+_0x2600('0x94')+_0x581889['id']});}})['catch'](function(_0x3f1589){logger[_0x2600('0x2e')](_0x2600('0x85'),JSON[_0x2600('0xe')](_0x3f1589));});};exports[_0x2600('0x76')]=function(_0xec3ee1,_0x58a68c,_0x9ea0a5,_0x2b4209,_0xd64cab,_0x3de445,_0x358f7b){var _0x523ad8,_0x3849c5,_0x5b55e2;_0x3de445[_0x2600('0x81')]=intUtil[_0x2600('0x82')](_0x3de445['host']);_0x3de445[_0x2600('0x83')]=intUtil[_0x2600('0x82')](_0x3de445[_0x2600('0x83')]);if(_0x358f7b&&_0x358f7b[_0x2600('0x95')]&&_0x358f7b[_0x2600('0x95')]!==_0x2600('0x96')){logger[_0x2600('0x31')](_0x2600('0x97'),'Recording\x20is\x20enabled!');_0x58a68c[_0x2600('0x87')]=_0x3de445['serverUrl']+_0x2600('0x88')+_0x58a68c[_0x2600('0x89')]+_0x2600('0x8a')+md5(_0x58a68c['uniqueid']);}var _0x51b43c=_0x3de445[_0x2600('0x81')]===_0x2600('0x8b')?'eu':_0x2600('0x8c');return getAccessToken(_0x3de445)[_0x2600('0x2a')](function(_0x2dac7e){_0x5b55e2=_0x2dac7e;return getUser(_0x5b55e2,_0x51b43c,_0x3de445,_0x2b4209['email']);})['then'](function(_0x1e01e2){_0x523ad8=_0x1e01e2;logger[_0x2600('0x31')](_0x2600('0x8d'),_0x523ad8['id']);return getEndUser(_0x5b55e2,_0x51b43c,_0x3de445,_0x58a68c[_0x2600('0x98')],_0x58a68c['destcalleridnum'],_0x523ad8,_0x9ea0a5);})[_0x2600('0x2a')](function(_0x1a912c){_0x3849c5=_0x1a912c;return getCall(_0x5b55e2,_0x51b43c,_0x3de445,_0x523ad8,_0x3849c5,_0x9ea0a5,_0x58a68c,_0x2600('0x99'));})[_0x2600('0x2a')](function(_0x3bc628){if(_0x3bc628){logger[_0x2600('0x31')]('The\x20Call\x20ID\x20is:',_0x3bc628['id']);logger[_0x2600('0x31')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2600('0x67')](_0x2600('0x91'),_0x2b4209[_0x2600('0x1a')]),_0x2600('0x92'),{'uri':_0x2600('0x93')+_0x3de445[_0x2600('0x81')]+_0x2600('0x94')+_0x3bc628['id']});}})['catch'](function(_0xd3b134){logger['error']('[OUTBOUND]',JSON[_0x2600('0xe')](_0xd3b134));});};exports['unmanaged']=function(_0x223a2a,_0x5cc7de,_0x400bbf,_0x432597,_0x2ba069,_0x54d8a5){var _0x4bafeb,_0x541059,_0x546d58;_0x54d8a5[_0x2600('0x81')]=intUtil['stripTrailingSlash'](_0x54d8a5[_0x2600('0x81')]);_0x54d8a5['serverUrl']=intUtil[_0x2600('0x82')](_0x54d8a5[_0x2600('0x83')]);if(_0x2ba069&&_0x2ba069[_0x2600('0x84')]){logger[_0x2600('0x31')]('['+_0x5cc7de[_0x2600('0x9a')][_0x2600('0x9b')]()+']',_0x2600('0x86'));_0x5cc7de[_0x2600('0x87')]=_0x54d8a5[_0x2600('0x83')]+'/api/voice/recordings/'+_0x5cc7de[_0x2600('0x89')]+_0x2600('0x8a')+md5(_0x5cc7de['uniqueid']);}else{_0x5cc7de[_0x2600('0x87')]='';}var _0x3b068b=_0x54d8a5[_0x2600('0x81')]==='zoho.eu'?'eu':_0x2600('0x8c');return getAccessToken(_0x54d8a5)['then'](function(_0x383f04){_0x546d58=_0x383f04;return getUser(_0x546d58,_0x3b068b,_0x54d8a5);})[_0x2600('0x2a')](function(_0x2868b1){_0x4bafeb=_0x2868b1;logger[_0x2600('0x31')](_0x2600('0x8d'),_0x4bafeb['id']);return getEndUser(_0x546d58,_0x3b068b,_0x54d8a5,_0x5cc7de[_0x2600('0x8e')],_0x5cc7de[_0x2600('0x8f')],_0x4bafeb,_0x400bbf);})[_0x2600('0x2a')](function(_0x5910ec){_0x541059=_0x5910ec;return getCall(_0x546d58,_0x3b068b,_0x54d8a5,_0x4bafeb,_0x541059,_0x400bbf,_0x5cc7de,'Inbound');})[_0x2600('0x2a')](function(_0x3a5236){if(_0x3a5236){logger[_0x2600('0x31')]('The\x20Call\x20ID\x20is:',_0x3a5236['id']);}})[_0x2600('0x2d')](function(_0x1c3802){logger[_0x2600('0x2e')]('['+_0x5cc7de[_0x2600('0x9a')]['toUpperCase']()+']',JSON['stringify'](_0x1c3802));});}; \ No newline at end of file +var _0x1775=['trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','monitor_format','calleridname','toUpperCase','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','length','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientSecret','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','SUCCESS','details','startCase','moduleCreate','log','CREATE\x20ERROR','Zoho-oauthtoken\x20','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','lead','Leads','nothing','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','utc','talktime','mm:ss','answertime','endtime','Call_Duration','diff','starttime','called','Call_Result','Called','connect','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','host','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x59c20e,_0x4977bd){var _0x16a81a=function(_0x2c0f48){while(--_0x2c0f48){_0x59c20e['push'](_0x59c20e['shift']());}};_0x16a81a(++_0x4977bd);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var rp=require(_0x5177('0x0'));var md5=require(_0x5177('0x1'));var util=require(_0x5177('0x2'));var intUtil=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var Redis=require(_0x5177('0x5'));var BPromise=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var logger=require(_0x5177('0x8'))(_0x5177('0x9'));config[_0x5177('0xa')]=_[_0x5177('0xb')](config[_0x5177('0xa')],{'host':_0x5177('0xc'),'port':0x18eb});var io=require(_0x5177('0xd'))(new Redis(config[_0x5177('0xa')]));function emit(_0x363611,_0x3ce288,_0x16e7a7){io['to'](_0x363611)[_0x5177('0xe')](_0x3ce288,_0x16e7a7);}function request(_0x2c23d8){logger[_0x5177('0xf')]('[HTTP]',JSON['stringify'](_0x2c23d8));return rp(_0x2c23d8);}function getCustomFields(_0x13c7f6,_0x1d7116){var _0xf3ce11={};if(_0x13c7f6[_0x5177('0x10')]>0x0){_[_0x5177('0x11')](_0x13c7f6,function(_0x49704c){if(_0x49704c[_0x5177('0x12')]===_0x5177('0x13')&&_0x49704c[_0x5177('0x14')]){_0xf3ce11[_0x49704c[_0x5177('0x14')]]=_0x49704c[_0x5177('0x15')][_0x5177('0x16')]();}else if(_0x49704c[_0x5177('0x12')]===_0x5177('0x17')&&_0x49704c[_0x5177('0x18')]&&_0x49704c[_0x5177('0x14')]&&_0x1d7116[_0x49704c[_0x5177('0x18')]]){_0xf3ce11[_0x49704c[_0x5177('0x14')]]=_0x1d7116[_0x49704c[_0x5177('0x18')]][_0x5177('0x16')]();}else if(_0x49704c[_0x5177('0x12')]===_0x5177('0x19')&&_0x49704c[_0x5177('0x1a')]&&_0x49704c[_0x5177('0x1a')][_0x5177('0x1b')]&&_0x49704c['idField']&&_0x1d7116[_0x49704c[_0x5177('0x1a')][_0x5177('0x1b')][_0x5177('0x1c')]()]){_0xf3ce11[_0x49704c[_0x5177('0x14')]]=_0x1d7116[_0x49704c['Variable'][_0x5177('0x1b')][_0x5177('0x1c')]()][_0x5177('0x16')]();}});}return _0xf3ce11;}function getName(_0x5b5918){if(_0x5b5918[_0x5177('0x1d')]('\x20')>0x0){var _0x4cf600=_0x5b5918[_0x5177('0x1e')](/ (.+)/);if(_0x4cf600[0x1]){return _0x4cf600;}}return[_0x5b5918,_0x5b5918];}var accountsTokens={};function getAccessToken(_0xe221b3){return new Promise(function(_0x219744,_0x27b732){if(!_[_0x5177('0x1f')](accountsTokens[_0xe221b3['id']])&&!_[_0x5177('0x1f')](accountsTokens[_0xe221b3['id']][_0x5177('0x20')])){if(moment()[_0x5177('0x21')](accountsTokens[_0xe221b3['id']][_0x5177('0x22')])){_0x219744(accountsTokens[_0xe221b3['id']][_0x5177('0x20')]);}}var _0x23dad2;switch(_0xe221b3[_0x5177('0x23')]){case'US':_0x23dad2='https://accounts.zoho.com';break;case'AU':_0x23dad2=_0x5177('0x24');break;case'EU':_0x23dad2='https://accounts.zoho.eu';break;case'IN':_0x23dad2=_0x5177('0x25');break;case'CN':_0x23dad2=_0x5177('0x26');break;default:_0x23dad2=_0x5177('0x27');break;}var _0x2d51d0={'method':'POST','uri':_0x23dad2+_0x5177('0x28'),'qs':{'refresh_token':_0xe221b3['refreshToken'],'client_id':_0xe221b3['clientId'],'client_secret':_0xe221b3[_0x5177('0x29')],'grant_type':_0x5177('0x2a')},'json':!![]};return rp(_0x2d51d0)['then'](function(_0x3285b3){accountsTokens[_0xe221b3['id']]={'access_token':_0x3285b3['access_token'],'expires_in':moment()[_0x5177('0x2b')](_0x3285b3[_0x5177('0x22')],'seconds')};_0x219744(_0x3285b3[_0x5177('0x20')]);})[_0x5177('0x2c')](function(_0x3c4248){logger[_0x5177('0x2d')](_0x5177('0x2e'),_0x3c4248[_0x5177('0x2f')]);_0x27b732(_0x3c4248);});});}function getUser(_0x5577bb,_0x498fcd,_0x45cf20,_0x1c660e){logger[_0x5177('0x30')](_0x5177('0x31'));return request({'method':_0x5177('0x32'),'uri':util[_0x5177('0x33')](_0x5177('0x34'),_0x498fcd),'qs':{'type':_0x5177('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5577bb},'json':!![]})[_0x5177('0x36')](function(_0x2233a2){if(_0x2233a2['users']){var _0x32bea9=-0x1;if(_['isArrayLikeObject'](_0x2233a2[_0x5177('0x37')])){if(!_[_0x5177('0x1f')](_0x1c660e)){_0x32bea9=_[_0x5177('0x38')](_0x2233a2['users'],function(_0x4f70df){return _0x4f70df[_0x5177('0x39')]===_0x1c660e;});}if(_0x32bea9>=0x0){logger[_0x5177('0x30')](_0x5177('0x3a'));}else{logger[_0x5177('0x30')](_0x5177('0x3b'));_0x32bea9=_[_0x5177('0x38')](_0x2233a2[_0x5177('0x37')],function(_0x390b74){return _0x390b74['profile'][_0x5177('0x1b')]===_0x5177('0x3c');});}return _0x2233a2['users'][_0x32bea9];}else{if(_0x2233a2[_0x5177('0x3d')][_0x5177('0x3e')][_0x5177('0x1b')]===_0x5177('0x3c')){logger[_0x5177('0x30')](_0x5177('0x3b'));user=_0x2233a2['user'];return user;}else{logger[_0x5177('0x2d')](_0x5177('0x3f'),JSON[_0x5177('0x40')](_0x2233a2));throw new Error(_0x5177('0x41')+JSON[_0x5177('0x40')](_0x2233a2));}}}else{logger[_0x5177('0x2d')](_0x5177('0x3f'),JSON['stringify'](_0x2233a2));throw new Error(_0x5177('0x41')+JSON[_0x5177('0x40')](_0x2233a2));}})['catch'](function(_0x486dd5){console[_0x5177('0x2d')](_0x486dd5);});}function getZohoUser(_0x188cec,_0x22365a){return new BPromise(function(_0x182c78,_0x3285c3){request(_0x188cec)[_0x5177('0x36')](function(_0x38cadb){var _0x24fd92=null;if(_0x38cadb){_0x24fd92=_0x38cadb[_0x5177('0x42')][0x0];_0x24fd92[_0x5177('0x43')]=_0x22365a;}_0x182c78(_0x24fd92);})[_0x5177('0x2c')](function(_0x1f15f8){_0x3285c3(_0x1f15f8);});});}function createEndUser(_0xd61bc4,_0x55722e,_0x90fb65,_0x2a4db1,_0x4e3677,_0x7341c0){var _0x90fb65=getName(_0x90fb65);return request({'method':_0x5177('0x44'),'uri':_0x5177('0x45')+_0x55722e+_0x5177('0x46')+_['startCase'](_0x7341c0['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x90fb65[0x1],'First_Name':_0x90fb65[0x0],'Phone':_0x2a4db1,'Owner':{'name':!_[_0x5177('0x1f')](_0x4e3677[_0x5177('0x47')][_0x5177('0x1b')])?_0x4e3677[_0x5177('0x47')][_0x5177('0x1b')]:!_[_0x5177('0x1f')](_0x4e3677[_0x5177('0x48')])?_0x4e3677[_0x5177('0x48')]+'\x20'+_0x4e3677['last_name']:_0x4e3677[_0x5177('0x49')],'id':_0x4e3677['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd61bc4},'json':!![]})['then'](function(_0x30e4f3){if(_0x30e4f3&&_0x30e4f3[_0x5177('0x42')][0x0]['code']===_0x5177('0x4a')){var _0x508178=_0x30e4f3['data'][0x0][_0x5177('0x4b')];_0x508178[_0x5177('0x43')]=_[_0x5177('0x4c')](_0x7341c0[_0x5177('0x4d')])+'s';return _0x508178;}logger[_0x5177('0x2d')](_0x5177('0x3f'),JSON[_0x5177('0x40')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x5177('0x2c')](function(_0x511dc0){console[_0x5177('0x4e')](_0x5177('0x4f'),_0x511dc0);});}function getEndUser(_0x11b846,_0x3ed103,_0x570812,_0x3b7f96,_0x24fe77,_0x363c63,_0x18b045){var _0x2bff80={'method':_0x5177('0x32'),'uri':'','headers':{'Authorization':_0x5177('0x50')+_0x11b846},'json':!![]};switch(_0x18b045[_0x5177('0x51')]){case _0x5177('0x52'):_0x2bff80[_0x5177('0x53')]=_0x5177('0x45')+_0x3ed103+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x24fe77+'))';return getZohoUser(_0x2bff80,_0x5177('0x54'))['then'](function(_0x58a4e6){if(_0x58a4e6)return _0x58a4e6;_0x2bff80['uri']=_0x5177('0x45')+_0x3ed103+_0x5177('0x55')+_0x24fe77+'))';return getZohoUser(_0x2bff80,'Leads')[_0x5177('0x36')](function(_0x2913a2){if(_0x2913a2)return _0x2913a2;if(_0x18b045[_0x5177('0x4d')]!='nothing'){return createEndUser(_0x11b846,_0x3ed103,_0x3b7f96,_0x24fe77,_0x363c63,_0x18b045);}else{return{};}});});break;case _0x5177('0x56'):_0x2bff80['uri']='https://www.zohoapis.'+_0x3ed103+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x24fe77+'))';return getZohoUser(_0x2bff80,_0x5177('0x54'))[_0x5177('0x36')](function(_0x1300d7){if(_0x1300d7)return _0x1300d7;if(_0x18b045['moduleCreate']!='nothing'){return createEndUser(_0x11b846,_0x3ed103,_0x3b7f96,_0x24fe77,_0x363c63,_0x18b045);}else{return{};}});break;case _0x5177('0x57'):_0x2bff80['uri']=_0x5177('0x45')+_0x3ed103+_0x5177('0x55')+_0x24fe77+'))';return getZohoUser(_0x2bff80,_0x5177('0x58'))[_0x5177('0x36')](function(_0x84233c){if(_0x84233c)return _0x84233c;if(_0x18b045[_0x5177('0x4d')]!=_0x5177('0x59')){return createEndUser(_0x11b846,_0x3ed103,_0x3b7f96,_0x24fe77,_0x363c63,_0x18b045);}else{return{};}});break;}}function getCall(_0x12dd42,_0x26c878,_0x217aca,_0x89fe3a,_0xb08267,_0x422d6c,_0x4c2068,_0x59376b){logger[_0x5177('0x30')]('Creating\x20new\x20call...');var _0x649c6f={};_0x649c6f['Owner']={'name':!_[_0x5177('0x1f')](_0x89fe3a[_0x5177('0x47')][_0x5177('0x1b')])&&!_['isNil'](_0x89fe3a['profile'][_0x5177('0x1b')])&&_0x89fe3a[_0x5177('0x3e')][_0x5177('0x1b')]===_0x5177('0x5a')?_0x89fe3a['role']['name']:!_[_0x5177('0x1f')](_0x89fe3a[_0x5177('0x48')])?_0x89fe3a[_0x5177('0x48')]+'\x20'+_0x89fe3a[_0x5177('0x49')]:_0x89fe3a['last_name'],'id':_0x89fe3a['id']};_0x649c6f[_0x5177('0x5b')]=intUtil[_0x5177('0x5c')](_0x422d6c[_0x5177('0x5d')],_0x4c2068,'\x20');_0x649c6f['Description']=intUtil[_0x5177('0x5c')](_0x422d6c[_0x5177('0x5e')],_0x4c2068,'\x0a');if(_0xb08267[_0x5177('0x43')]==='Contacts'){_0x649c6f[_0x5177('0x5f')]={'name':!_['isNil'](_0xb08267[_0x5177('0x60')])?_0xb08267[_0x5177('0x60')]:!_[_0x5177('0x1f')](_0xb08267['First_Name'])?_0xb08267[_0x5177('0x61')]+'\x20'+_0xb08267[_0x5177('0x62')]:_0xb08267[_0x5177('0x62')],'id':_0xb08267['id']};}if(_0xb08267[_0x5177('0x43')]===_0x5177('0x58')){_0x649c6f[_0x5177('0x63')]={'name':!_[_0x5177('0x1f')](_0xb08267[_0x5177('0x60')])?_0xb08267['Full_Name']:!_['isNil'](_0xb08267['First_Name'])?_0xb08267[_0x5177('0x61')]+'\x20'+_0xb08267[_0x5177('0x62')]:_0xb08267[_0x5177('0x62')],'id':_0xb08267['id']};_0x649c6f[_0x5177('0x64')]=_[_0x5177('0x4c')](_0xb08267[_0x5177('0x43')]);}if(_0x4c2068['talktime']){_0x649c6f['Call_Duration']=moment[_0x5177('0x65')](parseInt(_0x4c2068[_0x5177('0x66')])*0x3e8)[_0x5177('0x33')](_0x5177('0x67'));}else if(_0x4c2068[_0x5177('0x68')]&&_0x4c2068[_0x5177('0x69')]){_0x649c6f[_0x5177('0x6a')]=moment[_0x5177('0x65')](moment(_0x4c2068[_0x5177('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x5177('0x6b')](moment(_0x4c2068[_0x5177('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0x5177('0x33')](_0x5177('0x67'));}switch(_0x4c2068['lastevent']){case _0x5177('0x6d'):_0x649c6f[_0x5177('0x6e')]=_0x5177('0x6f');break;case'complete':case _0x5177('0x70'):_0x649c6f[_0x5177('0x6e')]='Answered';break;case'rejected':_0x649c6f[_0x5177('0x6e')]='Rejected';break;case _0x5177('0x71'):_0x649c6f['Call_Result']=_0x5177('0x72');break;case _0x5177('0x73'):_0x649c6f['Call_Result']=_0x5177('0x74');default:}_0x649c6f[_0x5177('0x75')]=(_0x59376b===_0x5177('0x76')?moment(_0x4c2068[_0x5177('0x6c')])[_0x5177('0x33')](_0x5177('0x77')):moment(_0x4c2068[_0x5177('0x78')])['format'](_0x5177('0x77')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x649c6f[_0x5177('0x79')]=_0x59376b||_0x5177('0x7a');_0x649c6f=_['merge'](_0x649c6f,getCustomFields(_0x422d6c[_0x5177('0x7b')],_0x4c2068));return request({'method':_0x5177('0x44'),'uri':_0x5177('0x45')+_0x26c878+_0x5177('0x7c'),'headers':{'Authorization':_0x5177('0x50')+_0x12dd42},'body':{'data':[_0x649c6f]},'json':!![]})[_0x5177('0x36')](function(_0xe22e2a){if(_0xe22e2a&&_0xe22e2a[_0x5177('0x42')][0x0]['code']==='SUCCESS'){logger[_0x5177('0x30')](_0x5177('0x7d'));return{'id':_0xe22e2a[_0x5177('0x42')][0x0][_0x5177('0x4b')]['id']};}})[_0x5177('0x2c')](function(_0x3dd58f){logger['info'](_0x5177('0x7e'),_0x3dd58f[_0x5177('0x2f')]);console[_0x5177('0x4e')](_0x5177('0x7e'),_0x3dd58f);});}exports['queue']=function(_0x2e26c6,_0x95f83a,_0x124935,_0x22da9d,_0x282cbc,_0x5130e6){var _0x2734fc,_0x4aa8d3,_0x1a6499;_0x5130e6[_0x5177('0x7f')]=intUtil['stripTrailingSlash'](_0x5130e6[_0x5177('0x7f')]);_0x5130e6[_0x5177('0x80')]=intUtil[_0x5177('0x81')](_0x5130e6[_0x5177('0x80')]);if(_0x282cbc&&_0x282cbc['monitor_format']){logger[_0x5177('0x30')](_0x5177('0x82'),_0x5177('0x83'));_0x95f83a[_0x5177('0x84')]=_0x5130e6['serverUrl']+_0x5177('0x85')+_0x95f83a[_0x5177('0x86')]+_0x5177('0x87')+md5(_0x95f83a['uniqueid']);}else{_0x95f83a['recordingURL']='';}var _0x3a399f=_0x5130e6[_0x5177('0x7f')]===_0x5177('0x88')?'eu':_0x5177('0x89');return getAccessToken(_0x5130e6)[_0x5177('0x36')](function(_0x37ed49){_0x1a6499=_0x37ed49;return getUser(_0x1a6499,_0x3a399f,_0x5130e6,_0x22da9d[_0x5177('0x39')]);})[_0x5177('0x36')](function(_0x83d5af){_0x2734fc=_0x83d5af;logger['info']('The\x20User\x20ID\x20is:',_0x2734fc['id']);return getEndUser(_0x1a6499,_0x3a399f,_0x5130e6,_0x95f83a['calleridname'],_0x95f83a[_0x5177('0x8a')],_0x2734fc,_0x124935);})['then'](function(_0x29d690){_0x4aa8d3=_0x29d690;return getCall(_0x1a6499,_0x3a399f,_0x5130e6,_0x2734fc,_0x4aa8d3,_0x124935,_0x95f83a,_0x5177('0x7a'));})[_0x5177('0x36')](function(_0x7474){if(_0x7474){logger[_0x5177('0x30')]('The\x20Call\x20ID\x20is:',_0x7474['id']);logger[_0x5177('0x30')](_0x5177('0x82'),_0x5177('0x8b'));emit(util['format'](_0x5177('0x8c'),_0x22da9d['name']),_0x5177('0x8d'),{'uri':_0x5177('0x8e')+_0x5130e6['host']+_0x5177('0x8f')+_0x7474['id']});}})[_0x5177('0x2c')](function(_0x53ccd8){logger['error'](_0x5177('0x82'),JSON['stringify'](_0x53ccd8));});};exports[_0x5177('0x76')]=function(_0x2f4edb,_0x5a9bc8,_0x698518,_0x115be0,_0xcbbb73,_0x20ceb9,_0x43a584){var _0x45bb3a,_0xbc8f9f,_0x10b062;_0x20ceb9['host']=intUtil[_0x5177('0x81')](_0x20ceb9['host']);_0x20ceb9[_0x5177('0x80')]=intUtil[_0x5177('0x81')](_0x20ceb9[_0x5177('0x80')]);if(_0x43a584&&_0x43a584[_0x5177('0x90')]&&_0x43a584['recordingFormat']!==_0x5177('0x91')){logger[_0x5177('0x30')]('[OUTBOUND]',_0x5177('0x83'));_0x5a9bc8[_0x5177('0x84')]=_0x20ceb9['serverUrl']+_0x5177('0x85')+_0x5a9bc8['uniqueid']+_0x5177('0x87')+md5(_0x5a9bc8['uniqueid']);}var _0x55fa0a=_0x20ceb9['host']===_0x5177('0x88')?'eu':_0x5177('0x89');return getAccessToken(_0x20ceb9)[_0x5177('0x36')](function(_0x516d0b){_0x10b062=_0x516d0b;return getUser(_0x10b062,_0x55fa0a,_0x20ceb9,_0x115be0[_0x5177('0x39')]);})[_0x5177('0x36')](function(_0x3adb47){_0x45bb3a=_0x3adb47;logger[_0x5177('0x30')](_0x5177('0x92'),_0x45bb3a['id']);return getEndUser(_0x10b062,_0x55fa0a,_0x20ceb9,_0x5a9bc8['destcalleridname'],_0x5a9bc8[_0x5177('0x93')],_0x45bb3a,_0x698518);})[_0x5177('0x36')](function(_0x53b367){_0xbc8f9f=_0x53b367;return getCall(_0x10b062,_0x55fa0a,_0x20ceb9,_0x45bb3a,_0xbc8f9f,_0x698518,_0x5a9bc8,_0x5177('0x94'));})['then'](function(_0x5b8953){if(_0x5b8953){logger['info'](_0x5177('0x95'),_0x5b8953['id']);logger[_0x5177('0x30')](_0x5177('0x96'),_0x5177('0x8b'));emit(util[_0x5177('0x33')](_0x5177('0x8c'),_0x115be0['name']),'trigger:browser:url',{'uri':_0x5177('0x8e')+_0x20ceb9[_0x5177('0x7f')]+_0x5177('0x8f')+_0x5b8953['id']});}})['catch'](function(_0x405b03){logger[_0x5177('0x2d')]('[OUTBOUND]',JSON[_0x5177('0x40')](_0x405b03));});};exports['unmanaged']=function(_0x125b08,_0x134b2f,_0x451c23,_0x593262,_0x33b82b,_0x5eb5f5){var _0x11dbd1,_0x26574f,_0x5a40f1;_0x5eb5f5['host']=intUtil['stripTrailingSlash'](_0x5eb5f5[_0x5177('0x7f')]);_0x5eb5f5['serverUrl']=intUtil[_0x5177('0x81')](_0x5eb5f5[_0x5177('0x80')]);if(_0x33b82b&&_0x33b82b[_0x5177('0x97')]){logger['info']('['+_0x134b2f['lastevent']['toUpperCase']()+']',_0x5177('0x83'));_0x134b2f[_0x5177('0x84')]=_0x5eb5f5[_0x5177('0x80')]+'/api/voice/recordings/'+_0x134b2f[_0x5177('0x86')]+_0x5177('0x87')+md5(_0x134b2f['uniqueid']);}else{_0x134b2f[_0x5177('0x84')]='';}var _0x526459=_0x5eb5f5[_0x5177('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x5eb5f5)['then'](function(_0x3940dd){_0x5a40f1=_0x3940dd;return getUser(_0x5a40f1,_0x526459,_0x5eb5f5);})['then'](function(_0x16426e){_0x11dbd1=_0x16426e;logger[_0x5177('0x30')](_0x5177('0x92'),_0x11dbd1['id']);return getEndUser(_0x5a40f1,_0x526459,_0x5eb5f5,_0x134b2f[_0x5177('0x98')],_0x134b2f[_0x5177('0x8a')],_0x11dbd1,_0x451c23);})[_0x5177('0x36')](function(_0x580d34){_0x26574f=_0x580d34;return getCall(_0x5a40f1,_0x526459,_0x5eb5f5,_0x11dbd1,_0x26574f,_0x451c23,_0x134b2f,_0x5177('0x7a'));})[_0x5177('0x36')](function(_0x5465f0){if(_0x5465f0){logger[_0x5177('0x30')](_0x5177('0x95'),_0x5465f0['id']);}})[_0x5177('0x2c')](function(_0x51f7ce){logger['error']('['+_0x134b2f['lastevent'][_0x5177('0x99')]()+']',JSON[_0x5177('0x40')](_0x51f7ce));});}; \ 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 8ce9e4e..4863327 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(_0x12e969,_0xd1bfa8){var _0x141ef3=function(_0x4d2431){while(--_0x4d2431){_0x12e969['push'](_0x12e969['shift']());}};_0x141ef3(++_0xd1bfa8);}(_0x7a54,0x106));var _0x47a5=function(_0x51ac49,_0x48a2f2){_0x51ac49=_0x51ac49-0x0;var _0x1357ab=_0x7a54[_0x51ac49];return _0x1357ab;};'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(_0x15ebc1,_0x745164){var _0x32142f=function(_0x5679d7){while(--_0x5679d7){_0x15ebc1['push'](_0x15ebc1['shift']());}};_0x32142f(++_0x745164);}(_0x7a54,0x106));var _0x47a5=function(_0x474633,_0x11a287){_0x474633=_0x474633-0x0;var _0x45fc20=_0x7a54[_0x474633];return _0x45fc20;};'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 de67327..f5efcc4 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 _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x30ca3a,_0x2b1030){var _0x574a31=function(_0x141680){while(--_0x141680){_0x30ca3a['push'](_0x30ca3a['shift']());}};_0x574a31(++_0x2b1030);}(_0x7a54,0x106));var _0x47a5=function(_0x5b7afd,_0x24d6ae){_0x5b7afd=_0x5b7afd-0x0;var _0xffe7a9=_0x7a54[_0x5b7afd];return _0xffe7a9;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x4b3674,_0x4a38fc){var _0x17b735=function(_0x8a1f71){while(--_0x8a1f71){_0x4b3674['push'](_0x4b3674['shift']());}};_0x17b735(++_0x4a38fc);}(_0x7a54,0x106));var _0x47a5=function(_0x18c720,_0x5949c4){_0x18c720=_0x18c720-0x0;var _0x1a331d=_0x7a54[_0x18c720];return _0x1a331d;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 219c70e..a272506 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 _0x43fd=['http','request','then','debug','rpc','routing','error','message','result','catch','exports','bluebird','client'];(function(_0x508474,_0x3ab4c7){var _0x3c1356=function(_0x5acdd4){while(--_0x5acdd4){_0x508474['push'](_0x508474['shift']());}};_0x3c1356(++_0x3ab4c7);}(_0x43fd,0x1ec));var _0xd43f=function(_0x3b00a4,_0x146989){_0x3b00a4=_0x3b00a4-0x0;var _0x156bd0=_0x43fd[_0x3b00a4];return _0x156bd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd43f('0x0'));var logger=require('../../config/logger')('routing');var client=jayson[_0xd43f('0x1')][_0xd43f('0x2')]({'port':0x2329});client['Request']=function(_0x3df2bd,_0x48f953){return new BPromise(function(_0x3c2af1,_0x3d21ab){return client[_0xd43f('0x3')](_0x3df2bd,_0x48f953)[_0xd43f('0x4')](function(_0x52e75f){logger[_0xd43f('0x5')](_0xd43f('0x6'),_0xd43f('0x7'),_0x3df2bd,_0x48f953,_0x52e75f);if(_0x52e75f[_0xd43f('0x8')]){logger['error'](_0xd43f('0x6'),_0xd43f('0x7'),_0x3df2bd,_0x52e75f['error'][_0xd43f('0x9')],_0x48f953);return _0x3d21ab(_0x52e75f[_0xd43f('0x8')][_0xd43f('0x9')]);}else{return _0x3c2af1(_0x52e75f[_0xd43f('0xa')]);}})[_0xd43f('0xb')](function(_0x5eb0bb){logger[_0xd43f('0x8')](_0xd43f('0x6'),_0xd43f('0x7'),_0x3df2bd,_0x5eb0bb,_0x48f953);return _0x3d21ab(_0x5eb0bb);});});};module[_0xd43f('0xc')]=client; \ No newline at end of file +var _0x9c5a=['Request','request','debug','error','message','rpc','exports','jayson/promise','bluebird','routing','client','http'];(function(_0x2603e5,_0x430456){var _0xeb036=function(_0x1d393e){while(--_0x1d393e){_0x2603e5['push'](_0x2603e5['shift']());}};_0xeb036(++_0x430456);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3554c6,_0x208de0){_0x3554c6=_0x3554c6-0x0;var _0x57a1e4=_0x9c5a[_0x3554c6];return _0x57a1e4;};'use strict';var jayson=require(_0xa9c5('0x0'));var BPromise=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var client=jayson[_0xa9c5('0x3')][_0xa9c5('0x4')]({'port':0x2329});client[_0xa9c5('0x5')]=function(_0x4f5552,_0x2acfaf){return new BPromise(function(_0x3051b1,_0x4e9403){return client[_0xa9c5('0x6')](_0x4f5552,_0x2acfaf)['then'](function(_0x394d84){logger[_0xa9c5('0x7')]('rpc','routing',_0x4f5552,_0x2acfaf,_0x394d84);if(_0x394d84[_0xa9c5('0x8')]){logger[_0xa9c5('0x8')]('rpc',_0xa9c5('0x2'),_0x4f5552,_0x394d84[_0xa9c5('0x8')]['message'],_0x2acfaf);return _0x4e9403(_0x394d84[_0xa9c5('0x8')][_0xa9c5('0x9')]);}else{return _0x3051b1(_0x394d84['result']);}})['catch'](function(_0x38e106){logger[_0xa9c5('0x8')](_0xa9c5('0xa'),_0xa9c5('0x2'),_0x4f5552,_0x38e106,_0x2acfaf);return _0x4e9403(_0x38e106);});});};module[_0xa9c5('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 1b23188..23bc311 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 _0x4312=['refresh','listen','Setting','loginMailFrequency','catch','log','./realtime','./lib/email','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x1a2a6a,_0x3e965d){var _0x4f5b82=function(_0x187706){while(--_0x187706){_0x1a2a6a['push'](_0x1a2a6a['shift']());}};_0x4f5b82(++_0x3e965d);}(_0x4312,0xaf));var _0x2431=function(_0x3ded9c,_0x1701f2){_0x3ded9c=_0x3ded9c-0x0;var _0x504742=_0x4312[_0x3ded9c];return _0x504742;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x2431('0x0'));var EmailChannel=require(_0x2431('0x1'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x2431('0x2'))['db'];function initRealtime(){return BPromise[_0x2431('0x3')]()[_0x2431('0x4')](mailAccount[_0x2431('0x5')]())[_0x2431('0x4')](realtime[_0x2431('0x6')]())['then'](function(){email[_0x2431('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2431('0x8')](realtime,email)[_0x2431('0x4')](function(_0x4e2eb2){return initRealtime();})[_0x2431('0x4')](function(_0x2cb734){return db[_0x2431('0x9')]['findOne']({'attributes':['id',_0x2431('0xa')],'raw':!![]});})[_0x2431('0x4')](function(_0xb751e){return setInterval(initRealtime,_0xb751e['loginMailFrequency']*0x3e8);})[_0x2431('0xb')](function(_0x4a71f2){console[_0x2431('0xc')](_0x4a71f2);});}main(); \ No newline at end of file +var _0x556b=['resolve','then','getMailAccounts','initMailAccounts','listen','Setting','findOne','loginMailFrequency','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x4a5265,_0x1ab0bf){var _0x5c31fe=function(_0x5f47f5){while(--_0x5f47f5){_0x4a5265['push'](_0x4a5265['shift']());}};_0x5c31fe(++_0x1ab0bf);}(_0x556b,0x1d7));var _0xb556=function(_0x4d84ba,_0x5cfb49){_0x4d84ba=_0x4d84ba-0x0;var _0x53267c=_0x556b[_0x4d84ba];return _0x53267c;};'use strict';var BPromise=require(_0xb556('0x0'));var server=require(_0xb556('0x1'));var Realtime=require(_0xb556('0x2'));var EmailChannel=require(_0xb556('0x3'));var mailAccount=require(_0xb556('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xb556('0x5')]()[_0xb556('0x6')](mailAccount[_0xb556('0x7')]())[_0xb556('0x6')](realtime[_0xb556('0x8')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xb556('0x9')](realtime,email)[_0xb556('0x6')](function(_0x1cc8a1){return initRealtime();})[_0xb556('0x6')](function(_0xe45310){return db[_0xb556('0xa')][_0xb556('0xb')]({'attributes':['id',_0xb556('0xc')],'raw':!![]});})['then'](function(_0x52425c){return setInterval(initRealtime,_0x52425c[_0xb556('0xc')]*0x3e8);})['catch'](function(_0x1c33a3){console[_0xb556('0xd')](_0x1c33a3);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ba1cea7..37c5b3e 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 _0x3e40=['Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','error','sendMail','smtp','send','Smtp','verify','verified','lodash','moment','bluebird','ioredis','../../../config/environment','socket.io-emitter','redis','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','prototype','emit','key','active','Imap','status','messageStatus','total','isNil','md5','mailAccount:update','refresh','hasOwnProperty','imapAccounts','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','notify','then','Mail\x20accepted\x20from\x20routing','catch'];(function(_0x6e3332,_0x1e23b3){var _0xfdc8e9=function(_0x4c89c3){while(--_0x4c89c3){_0x6e3332['push'](_0x6e3332['shift']());}};_0xfdc8e9(++_0x1e23b3);}(_0x3e40,0x74));var _0x03e4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3e40[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x03e4('0x0'));var moment=require(_0x03e4('0x1'));var BPromise=require(_0x03e4('0x2'));var md5=require('md5');var Redis=require(_0x03e4('0x3'));var config=require(_0x03e4('0x4'));var logger=require('../../../config/logger')('email');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x03e4('0x5'))(new Redis(config[_0x03e4('0x6')]));var EmailImap=require(_0x03e4('0x7'));var EmailSmtp=require(_0x03e4('0x8'));var mailAccount=require(_0x03e4('0x9'));var md5Accounts={};function EmailChannel(_0x501518){logger[_0x03e4('0xa')](_0x03e4('0xb'));this[_0x03e4('0xc')]=_0x501518[_0x03e4('0xc')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x03e4('0xd')][_0x03e4('0xe')]=function(_0x463349){var _0x3f55f3=this[_0x03e4('0xc')][_0x463349];var _0x13ef46={'id':_0x3f55f3['id'],'name':_0x3f55f3['name'],'key':_0x3f55f3[_0x03e4('0xf')],'active':_0x3f55f3[_0x03e4('0x10')],'Imap':{'status':_0x3f55f3[_0x03e4('0x11')][_0x03e4('0x12')],'messageStatus':_0x3f55f3[_0x03e4('0x11')][_0x03e4('0x13')],'total':_0x3f55f3['Imap'][_0x03e4('0x14')]}};if(_[_0x03e4('0x15')](md5Accounts[_0x463349])){md5Accounts[_0x463349]={};}var _0x3510bc=md5(JSON['stringify'](_0x13ef46));if(md5Accounts[_0x463349][_0x03e4('0x16')]!==_0x3510bc){md5Accounts[_0x463349][_0x03e4('0x16')]=_0x3510bc;io[_0x03e4('0xe')](_0x03e4('0x17'),_0x13ef46);}};EmailChannel[_0x03e4('0xd')][_0x03e4('0x18')]=function(_0x2d87b0){for(var _0x36cd35 in _0x2d87b0){if(_0x2d87b0[_0x03e4('0x19')](_0x36cd35)){if(_0x2d87b0[_0x36cd35][_0x03e4('0x11')]&&_0x2d87b0[_0x36cd35][_0x03e4('0x10')]){var _0x192021=_0x2d87b0[_0x36cd35][_0x03e4('0x11')];if(!this['imapAccounts']['hasOwnProperty'](_0x192021['id'])){this[_0x03e4('0x1a')][_0x192021['id']]=new EmailImap(_0x192021,_0x2d87b0[_0x36cd35][_0x03e4('0x1b')]);this[_0x03e4('0x1a')][_0x192021['id']]['on'](_0x03e4('0x1c'),this[_0x03e4('0x1d')][_0x03e4('0x1e')](this,_0x36cd35));this['imapAccounts'][_0x192021['id']]['on'](_0x03e4('0x1b'),this[_0x03e4('0x1f')]['bind'](this,_0x36cd35));this[_0x03e4('0x1a')][_0x192021['id']]['on'](_0x03e4('0x20'),this[_0x03e4('0x21')][_0x03e4('0x1e')](this,_0x36cd35));this[_0x03e4('0x1a')][_0x192021['id']]['on']('error',this[_0x03e4('0x22')][_0x03e4('0x1e')](this,_0x36cd35));}}else{if(_[_0x03e4('0x15')](this['mailAccounts'][_0x36cd35][_0x03e4('0x11')])){this[_0x03e4('0xc')][_0x36cd35][_0x03e4('0x11')]={};}this[_0x03e4('0xc')][_0x36cd35][_0x03e4('0x11')][_0x03e4('0x12')]=_0x03e4('0x23');this['mailAccounts'][_0x36cd35][_0x03e4('0x11')]['messageStatus']='';this[_0x03e4('0xe')](_0x36cd35);}}}};EmailChannel[_0x03e4('0xd')]['handleImapBox']=function(_0x27f2c4,_0x4e1513){if(this[_0x03e4('0xc')][_0x27f2c4]){this[_0x03e4('0xc')][_0x27f2c4][_0x03e4('0x11')][_0x03e4('0x12')]=_0x03e4('0x24');this[_0x03e4('0xc')][_0x27f2c4][_0x03e4('0x11')][_0x03e4('0x13')]=_0x4e1513['name'];if(_0x4e1513[_0x03e4('0x25')]){this[_0x03e4('0xc')][_0x27f2c4]['Imap'][_0x03e4('0x14')]=_0x4e1513[_0x03e4('0x25')][_0x03e4('0x14')];}return this['emit'](_0x27f2c4);}};EmailChannel['prototype'][_0x03e4('0x1f')]=function(_0x12475a,_0x2baa33){logger[_0x03e4('0xa')](_0x03e4('0x26'),_0x2baa33['firstName'],_0x2baa33['lastName'],_0x2baa33['from'],_0x12475a);if(this[_0x03e4('0xc')][_0x12475a]){return mailAccount[_0x03e4('0x27')](_0x12475a,_0x2baa33)[_0x03e4('0x28')](function(_0x28a386){if(_0x28a386){logger[_0x03e4('0xa')](_0x03e4('0x29'));}})[_0x03e4('0x2a')](function(_0x4c2a6e){logger['error'](_0x03e4('0x2b'),JSON[_0x03e4('0x2c')](_0x4c2a6e));});}};EmailChannel[_0x03e4('0xd')][_0x03e4('0x21')]=function(_0xdf1f2d){if(this[_0x03e4('0xc')][_0xdf1f2d]&&this[_0x03e4('0xc')][_0xdf1f2d][_0x03e4('0x11')]){if(this[_0x03e4('0x1a')][this[_0x03e4('0xc')][_0xdf1f2d][_0x03e4('0x11')]['id']]){delete this[_0x03e4('0x1a')][this[_0x03e4('0xc')][_0xdf1f2d][_0x03e4('0x11')]['id']];}this[_0x03e4('0xc')][_0xdf1f2d][_0x03e4('0x11')][_0x03e4('0x2d')]=moment();this['emit'](_0xdf1f2d);}};EmailChannel[_0x03e4('0xd')][_0x03e4('0x22')]=function(_0x167dbc,_0x5ea3e8){if(this[_0x03e4('0xc')][_0x167dbc]){this[_0x03e4('0xc')][_0x167dbc][_0x03e4('0x11')][_0x03e4('0x12')]=_0x03e4('0x2e');this[_0x03e4('0xc')][_0x167dbc][_0x03e4('0x11')]['messageStatus']=_0x5ea3e8;return this[_0x03e4('0xe')](_0x167dbc);}};EmailChannel[_0x03e4('0xd')][_0x03e4('0x2f')]=function(_0x5e38ba,_0xf5193e){return this[_0x03e4('0x30')][_0x03e4('0x31')](_0x5e38ba,_0xf5193e);};EmailChannel['prototype']['verifySmtp']=function(_0x350701){var _0x1a1bf8=this;if(this[_0x03e4('0xc')][_0x350701['id']]){if(_[_0x03e4('0x15')](this['mailAccounts'][_0x350701['id']][_0x03e4('0x32')])){this[_0x03e4('0xc')][_0x350701['id']]['Smtp']={};}this[_0x03e4('0xc')][_0x350701['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x5442e1,_0x438664){return _0x1a1bf8['smtp'][_0x03e4('0x33')](_0x350701)['then'](function(_0x31ddf4){_0x1a1bf8[_0x03e4('0xc')][_0x350701['id']][_0x03e4('0x32')]['status']=_0x03e4('0x34');_0x1a1bf8[_0x03e4('0xc')][_0x350701['id']]['Smtp'][_0x03e4('0x13')]='';_0x1a1bf8[_0x03e4('0xe')](_0x350701['id']);_0x5442e1(_0x31ddf4);})[_0x03e4('0x2a')](function(_0x49cf45){_0x1a1bf8[_0x03e4('0xc')][_0x350701['id']][_0x03e4('0x32')][_0x03e4('0x12')]=_0x03e4('0x2e');_0x1a1bf8[_0x03e4('0xc')][_0x350701['id']]['Smtp'][_0x03e4('0x13')]=_0x49cf45;_0x1a1bf8['emit'](_0x350701['id']);_0x438664(_0x49cf45);});});}return this['smtp'][_0x03e4('0x33')](_0x350701);};module['exports']=EmailChannel; \ No newline at end of file +var _0x3fc4=['emit','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','prototype','hasOwnProperty','handleImapBox','bind','handleImapEnd','error','handleImapError','disabled','status','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','smtp','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts'];(function(_0x3a8eed,_0x2e6f77){var _0x1c5f54=function(_0x302640){while(--_0x302640){_0x3a8eed['push'](_0x3a8eed['shift']());}};_0x1c5f54(++_0x2e6f77);}(_0x3fc4,0x15d));var _0x43fc=function(_0x240503,_0x17c0d3){_0x240503=_0x240503-0x0;var _0x36e70b=_0x3fc4[_0x240503];return _0x36e70b;};'use strict';var _=require(_0x43fc('0x0'));var moment=require(_0x43fc('0x1'));var BPromise=require('bluebird');var md5=require(_0x43fc('0x2'));var Redis=require(_0x43fc('0x3'));var config=require(_0x43fc('0x4'));var logger=require(_0x43fc('0x5'))(_0x43fc('0x6'));config[_0x43fc('0x7')]=_[_0x43fc('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x43fc('0x9'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x43fc('0xa'));var mailAccount=require(_0x43fc('0xb'));var md5Accounts={};function EmailChannel(_0x5c7c15){logger[_0x43fc('0xc')]('start\x20email\x20channel');this[_0x43fc('0xd')]=_0x5c7c15[_0x43fc('0xd')];this[_0x43fc('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x43fc('0xf')]=function(_0x48d303){var _0x3da506=this[_0x43fc('0xd')][_0x48d303];var _0x26f5c0={'id':_0x3da506['id'],'name':_0x3da506[_0x43fc('0x10')],'key':_0x3da506[_0x43fc('0x11')],'active':_0x3da506[_0x43fc('0x12')],'Imap':{'status':_0x3da506[_0x43fc('0x13')]['status'],'messageStatus':_0x3da506[_0x43fc('0x13')][_0x43fc('0x14')],'total':_0x3da506[_0x43fc('0x13')][_0x43fc('0x15')]}};if(_[_0x43fc('0x16')](md5Accounts[_0x48d303])){md5Accounts[_0x48d303]={};}var _0x3942ea=md5(JSON[_0x43fc('0x17')](_0x26f5c0));if(md5Accounts[_0x48d303][_0x43fc('0x2')]!==_0x3942ea){md5Accounts[_0x48d303]['md5']=_0x3942ea;io[_0x43fc('0xf')](_0x43fc('0x18'),_0x26f5c0);}};EmailChannel[_0x43fc('0x19')]['refresh']=function(_0x1b68af){for(var _0x40a6c7 in _0x1b68af){if(_0x1b68af[_0x43fc('0x1a')](_0x40a6c7)){if(_0x1b68af[_0x40a6c7][_0x43fc('0x13')]&&_0x1b68af[_0x40a6c7][_0x43fc('0x12')]){var _0x5271b6=_0x1b68af[_0x40a6c7]['Imap'];if(!this['imapAccounts'][_0x43fc('0x1a')](_0x5271b6['id'])){this[_0x43fc('0xe')][_0x5271b6['id']]=new EmailImap(_0x5271b6,_0x1b68af[_0x40a6c7][_0x43fc('0x6')]);this[_0x43fc('0xe')][_0x5271b6['id']]['on']('box',this[_0x43fc('0x1b')][_0x43fc('0x1c')](this,_0x40a6c7));this[_0x43fc('0xe')][_0x5271b6['id']]['on'](_0x43fc('0x6'),this['handleImapEmail'][_0x43fc('0x1c')](this,_0x40a6c7));this['imapAccounts'][_0x5271b6['id']]['on']('end',this[_0x43fc('0x1d')]['bind'](this,_0x40a6c7));this[_0x43fc('0xe')][_0x5271b6['id']]['on'](_0x43fc('0x1e'),this[_0x43fc('0x1f')][_0x43fc('0x1c')](this,_0x40a6c7));}}else{if(_[_0x43fc('0x16')](this[_0x43fc('0xd')][_0x40a6c7][_0x43fc('0x13')])){this['mailAccounts'][_0x40a6c7][_0x43fc('0x13')]={};}this[_0x43fc('0xd')][_0x40a6c7][_0x43fc('0x13')]['status']=_0x43fc('0x20');this[_0x43fc('0xd')][_0x40a6c7]['Imap'][_0x43fc('0x14')]='';this['emit'](_0x40a6c7);}}}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x1b')]=function(_0x285824,_0x27b8b3){if(this['mailAccounts'][_0x285824]){this[_0x43fc('0xd')][_0x285824][_0x43fc('0x13')][_0x43fc('0x21')]='connected';this[_0x43fc('0xd')][_0x285824][_0x43fc('0x13')][_0x43fc('0x14')]=_0x27b8b3[_0x43fc('0x10')];if(_0x27b8b3['messages']){this[_0x43fc('0xd')][_0x285824][_0x43fc('0x13')]['total']=_0x27b8b3[_0x43fc('0x22')][_0x43fc('0x15')];}return this['emit'](_0x285824);}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x23')]=function(_0x552507,_0x49b2c9){logger[_0x43fc('0xc')](_0x43fc('0x24'),_0x49b2c9[_0x43fc('0x25')],_0x49b2c9[_0x43fc('0x26')],_0x49b2c9['from'],_0x552507);if(this[_0x43fc('0xd')][_0x552507]){return mailAccount[_0x43fc('0x27')](_0x552507,_0x49b2c9)[_0x43fc('0x28')](function(_0x324ad9){if(_0x324ad9){logger[_0x43fc('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x43fc('0x29')](function(_0x4c6928){logger[_0x43fc('0x1e')](_0x43fc('0x2a'),JSON[_0x43fc('0x17')](_0x4c6928));});}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x1d')]=function(_0x5a8dda){if(this[_0x43fc('0xd')][_0x5a8dda]&&this['mailAccounts'][_0x5a8dda][_0x43fc('0x13')]){if(this[_0x43fc('0xe')][this['mailAccounts'][_0x5a8dda]['Imap']['id']]){delete this[_0x43fc('0xe')][this[_0x43fc('0xd')][_0x5a8dda][_0x43fc('0x13')]['id']];}this[_0x43fc('0xd')][_0x5a8dda][_0x43fc('0x13')]['lastSync']=moment();this[_0x43fc('0xf')](_0x5a8dda);}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x1f')]=function(_0x5a7434,_0x139eb3){if(this['mailAccounts'][_0x5a7434]){this[_0x43fc('0xd')][_0x5a7434][_0x43fc('0x13')][_0x43fc('0x21')]='error';this[_0x43fc('0xd')][_0x5a7434][_0x43fc('0x13')][_0x43fc('0x14')]=_0x139eb3;return this['emit'](_0x5a7434);}};EmailChannel[_0x43fc('0x19')][_0x43fc('0x2b')]=function(_0x242ab6,_0x158238){return this['smtp'][_0x43fc('0x2c')](_0x242ab6,_0x158238);};EmailChannel[_0x43fc('0x19')][_0x43fc('0x2d')]=function(_0x532b47){var _0x23a4b3=this;if(this['mailAccounts'][_0x532b47['id']]){if(_[_0x43fc('0x16')](this[_0x43fc('0xd')][_0x532b47['id']][_0x43fc('0x2e')])){this['mailAccounts'][_0x532b47['id']][_0x43fc('0x2e')]={};}this[_0x43fc('0xd')][_0x532b47['id']][_0x43fc('0x2e')][_0x43fc('0x2f')]=moment();return new BPromise(function(_0x5d3984,_0x5775cd){return _0x23a4b3['smtp'][_0x43fc('0x30')](_0x532b47)['then'](function(_0x5960ba){_0x23a4b3[_0x43fc('0xd')][_0x532b47['id']][_0x43fc('0x2e')]['status']=_0x43fc('0x31');_0x23a4b3[_0x43fc('0xd')][_0x532b47['id']]['Smtp'][_0x43fc('0x14')]='';_0x23a4b3['emit'](_0x532b47['id']);_0x5d3984(_0x5960ba);})[_0x43fc('0x29')](function(_0xa79eec){_0x23a4b3['mailAccounts'][_0x532b47['id']][_0x43fc('0x2e')]['status']='error';_0x23a4b3['mailAccounts'][_0x532b47['id']][_0x43fc('0x2e')]['messageStatus']=_0xa79eec;_0x23a4b3[_0x43fc('0xf')](_0x532b47['id']);_0x5775cd(_0xa79eec);});});}return this[_0x43fc('0x32')][_0x43fc('0x30')](_0x532b47);};module[_0x43fc('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index c3db9cb..5857e87 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 _0xf034=['util','lodash','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','handleReady','bind','imap','once','end','error','handleError','connect','inherits','connTimeout','authTimeout','service','user','password','host','port','tls','autotls','required','getHost','openBox','handleOpenBox','prototype','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','upperFirst','path'];(function(_0x242dd7,_0x3d81d9){var _0x30ae03=function(_0x545519){while(--_0x545519){_0x242dd7['push'](_0x242dd7['shift']());}};_0x30ae03(++_0x3d81d9);}(_0xf034,0x1ef));var _0x4f03=function(_0xb5be71,_0x402295){_0xb5be71=_0xb5be71-0x0;var _0x538c0a=_0xf034[_0xb5be71];return _0x538c0a;};'use strict';var fs=require('fs');var path=require(_0x4f03('0x0'));var util=require(_0x4f03('0x1'));var Imap=require('imap');var _=require(_0x4f03('0x2'));var rs=require('randomstring');var simpleParser=require(_0x4f03('0x3'))[_0x4f03('0x4')];var Iconv=require(_0x4f03('0x5'))['Iconv'];var EventEmitter=require(_0x4f03('0x6'))[_0x4f03('0x7')];var utils=require(_0x4f03('0x8'));var logger=require(_0x4f03('0x9'))(_0x4f03('0xa'));function EmailImap(_0x11a8dc,_0x1d0917){this[_0x4f03('0xb')]=_0x4f03('0xc');this[_0x4f03('0xd')]=this[_0x4f03('0xe')](_0x11a8dc,_0x1d0917);this['imap']=new Imap(this[_0x4f03('0xd')]);this['imap']['once']('ready',this[_0x4f03('0xf')][_0x4f03('0x10')](this));this[_0x4f03('0x11')][_0x4f03('0x12')](_0x4f03('0x13'),this['handleEnd'][_0x4f03('0x10')](this));this[_0x4f03('0x11')]['on'](_0x4f03('0x14'),this[_0x4f03('0x15')][_0x4f03('0x10')](this));this[_0x4f03('0x11')][_0x4f03('0x16')]();}util[_0x4f03('0x17')](EmailImap,EventEmitter);EmailImap['prototype'][_0x4f03('0xe')]=function(_0x3aada6,_0x1372c1){var _0x115f25={'connTimeout':_0x3aada6[_0x4f03('0x18')]?_0x3aada6[_0x4f03('0x18')]*0x3e8:0x2710,'authTimeout':_0x3aada6[_0x4f03('0x19')]?_0x3aada6[_0x4f03('0x19')]*0x3e8:0x1388};if(_['isNil'](_0x3aada6[_0x4f03('0x1a')])){if(_0x3aada6['authentication']){_0x115f25[_0x4f03('0x1b')]=_0x3aada6[_0x4f03('0x1b')];_0x115f25[_0x4f03('0x1c')]=_0x3aada6[_0x4f03('0x1c')];}_0x115f25[_0x4f03('0x1d')]=_0x3aada6[_0x4f03('0x1d')];_0x115f25[_0x4f03('0x1e')]=_0x3aada6[_0x4f03('0x1e')]||0x3e1;if(_0x3aada6[_0x4f03('0x1f')]){_0x115f25[_0x4f03('0x1f')]=!![];}else{_0x115f25[_0x4f03('0x1f')]=![];_0x115f25[_0x4f03('0x20')]=_0x4f03('0x21');}}else{_0x115f25[_0x4f03('0x1b')]=_0x3aada6[_0x4f03('0x1b')];_0x115f25['password']=_0x3aada6[_0x4f03('0x1c')];_0x115f25[_0x4f03('0x1d')]=utils[_0x4f03('0x22')](_0x3aada6[_0x4f03('0x1a')]);_0x115f25[_0x4f03('0x1e')]=0x3e1;_0x115f25['tls']=!![];}_0x115f25[_0x4f03('0xa')]=_0x1372c1||_0x3aada6[_0x4f03('0x1b')]||'anonymous@xcally.com';return _0x115f25;};EmailImap['prototype'][_0x4f03('0xf')]=function(){this['imap'][_0x4f03('0x23')](this[_0x4f03('0xb')],![],this[_0x4f03('0x24')][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')][_0x4f03('0x24')]=function(_0x38a234,_0x511e72){if(_0x38a234){this[_0x4f03('0x15')](_0x38a234,!![]);}else{this['emit'](_0x4f03('0x26'),_0x511e72);this[_0x4f03('0x27')]();}};EmailImap['prototype'][_0x4f03('0x28')]=function(_0x2b8319){if(_0x2b8319){this[_0x4f03('0x15')](_0x2b8319,!![]);}else{this[_0x4f03('0x11')][_0x4f03('0x13')]();}};EmailImap[_0x4f03('0x25')][_0x4f03('0x27')]=function(){this[_0x4f03('0x11')][_0x4f03('0x29')]([_0x4f03('0x2a')],this[_0x4f03('0x2b')][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')][_0x4f03('0x2b')]=function(_0x4ce987,_0x3b7719){if(_0x4ce987){this['handleError'](_0x4ce987,!![]);}else{if(_0x3b7719[_0x4f03('0x2c')]){try{var _0x42f18f=this[_0x4f03('0x11')][_0x4f03('0x2d')](_0x3b7719,{'bodies':'','markSeen':!![]});_0x42f18f['on'](_0x4f03('0x2e'),this[_0x4f03('0x2f')][_0x4f03('0x10')](this));_0x42f18f[_0x4f03('0x12')]('error',this[_0x4f03('0x30')]['bind'](this));_0x42f18f['once'](_0x4f03('0x13'),this[_0x4f03('0x31')]['bind'](this));}catch(_0x357f4a){logger[_0x4f03('0x14')](_0x357f4a);}}else{this[_0x4f03('0x11')][_0x4f03('0x32')](!![],this[_0x4f03('0x28')][_0x4f03('0x10')](this));}}};EmailImap['prototype'][_0x4f03('0x2f')]=function(_0xa11aae,_0x7696dd){_0xa11aae['on'](_0x4f03('0x33'),this[_0x4f03('0x34')][_0x4f03('0x10')](this));_0xa11aae['once'](_0x4f03('0x35'),this[_0x4f03('0x36')][_0x4f03('0x10')](this));_0xa11aae[_0x4f03('0x12')](_0x4f03('0x13'),this[_0x4f03('0x37')][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')][_0x4f03('0x34')]=function(_0x1043f8,_0x1c73df){simpleParser(_0x1043f8,{'Iconv':Iconv},this[_0x4f03('0x38')][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')][_0x4f03('0x36')]=function(_0x27e7d1){};EmailImap[_0x4f03('0x25')][_0x4f03('0x37')]=function(){};EmailImap[_0x4f03('0x25')][_0x4f03('0x38')]=function(_0x537f29,_0xd6f2b){if(_0x537f29){logger[_0x4f03('0x14')](_0x537f29);}else{var _0x398f40=this;utils[_0x4f03('0x39')](this[_0x4f03('0xd')],_0xd6f2b,function(_0x1d72f6){_0x398f40[_0x4f03('0x3a')](_0x4f03('0xa'),_0x1d72f6);});}};EmailImap[_0x4f03('0x25')][_0x4f03('0x31')]=function(){this[_0x4f03('0x11')]['closeBox'](!![],this[_0x4f03('0x28')][_0x4f03('0x10')](this));};EmailImap['prototype'][_0x4f03('0x30')]=function(_0xea9dba){this[_0x4f03('0x15')](_0xea9dba);this[_0x4f03('0x11')]['closeBox'](!![],this['handleCloseBox'][_0x4f03('0x10')](this));};EmailImap[_0x4f03('0x25')]['handleEnd']=function(){this[_0x4f03('0x3a')](_0x4f03('0x13'));};EmailImap['prototype'][_0x4f03('0x15')]=function(_0x54af0e,_0x4a4955){logger[_0x4f03('0x14')]('handleError',this['account'][_0x4f03('0xa')],JSON[_0x4f03('0x3b')](_0x54af0e));var _0x153605='';if(_0x54af0e){if(_0x54af0e['textCode']){_0x153605=_0x54af0e[_0x4f03('0x3c')];}else{for(var _0x26908a in _0x54af0e){if(_0x54af0e['hasOwnProperty'](_0x26908a)){_0x153605+=_[_0x4f03('0x3d')](_0x26908a)+':\x20'+_0x54af0e[_0x26908a]+'\x0a';}}}}if(_0x4a4955){this[_0x4f03('0x11')]['end']();}else{this[_0x4f03('0x3a')](_0x4f03('0x14'),_0x153605);this['emit'](_0x4f03('0x13'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x8439=['emit','closeBox','handleFetchError','handleEnd','stringify','textCode','upperFirst','exports','util','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','account','once','ready','handleReady','bind','error','handleError','connect','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','prototype','box','readUnseen','handleCloseBox','search','UNSEEN','fetch','message','handleFetchMessage','end','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser'];(function(_0x4c32ab,_0x56af52){var _0x4176f1=function(_0x5a9bcd){while(--_0x5a9bcd){_0x4c32ab['push'](_0x4c32ab['shift']());}};_0x4176f1(++_0x56af52);}(_0x8439,0xf8));var _0x9843=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x8439[_0x2261ce];return _0x524640;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x9843('0x0'));var Imap=require(_0x9843('0x1'));var _=require(_0x9843('0x2'));var rs=require('randomstring');var simpleParser=require(_0x9843('0x3'))[_0x9843('0x4')];var Iconv=require(_0x9843('0x5'))[_0x9843('0x6')];var EventEmitter=require(_0x9843('0x7'))['EventEmitter'];var utils=require(_0x9843('0x8'));var logger=require(_0x9843('0x9'))(_0x9843('0xa'));function EmailImap(_0x125aa1,_0x3320e6){this[_0x9843('0xb')]=_0x9843('0xc');this[_0x9843('0xd')]=this['getAccount'](_0x125aa1,_0x3320e6);this[_0x9843('0x1')]=new Imap(this['account']);this[_0x9843('0x1')][_0x9843('0xe')](_0x9843('0xf'),this[_0x9843('0x10')][_0x9843('0x11')](this));this[_0x9843('0x1')][_0x9843('0xe')]('end',this['handleEnd'][_0x9843('0x11')](this));this[_0x9843('0x1')]['on'](_0x9843('0x12'),this[_0x9843('0x13')][_0x9843('0x11')](this));this['imap'][_0x9843('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x11db2f,_0x340557){var _0x3b4772={'connTimeout':_0x11db2f[_0x9843('0x15')]?_0x11db2f[_0x9843('0x15')]*0x3e8:0x2710,'authTimeout':_0x11db2f[_0x9843('0x16')]?_0x11db2f[_0x9843('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x11db2f[_0x9843('0x17')])){if(_0x11db2f[_0x9843('0x18')]){_0x3b4772[_0x9843('0x19')]=_0x11db2f['user'];_0x3b4772[_0x9843('0x1a')]=_0x11db2f[_0x9843('0x1a')];}_0x3b4772[_0x9843('0x1b')]=_0x11db2f[_0x9843('0x1b')];_0x3b4772[_0x9843('0x1c')]=_0x11db2f['port']||0x3e1;if(_0x11db2f['tls']){_0x3b4772[_0x9843('0x1d')]=!![];}else{_0x3b4772[_0x9843('0x1d')]=![];_0x3b4772[_0x9843('0x1e')]=_0x9843('0x1f');}}else{_0x3b4772['user']=_0x11db2f[_0x9843('0x19')];_0x3b4772[_0x9843('0x1a')]=_0x11db2f[_0x9843('0x1a')];_0x3b4772['host']=utils[_0x9843('0x20')](_0x11db2f['service']);_0x3b4772[_0x9843('0x1c')]=0x3e1;_0x3b4772[_0x9843('0x1d')]=!![];}_0x3b4772[_0x9843('0xa')]=_0x340557||_0x11db2f[_0x9843('0x19')]||_0x9843('0x21');return _0x3b4772;};EmailImap['prototype'][_0x9843('0x10')]=function(){this['imap'][_0x9843('0x22')](this[_0x9843('0xb')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x9843('0x23')]['handleOpenBox']=function(_0x56457a,_0xb627a8){if(_0x56457a){this['handleError'](_0x56457a,!![]);}else{this['emit'](_0x9843('0x24'),_0xb627a8);this[_0x9843('0x25')]();}};EmailImap[_0x9843('0x23')][_0x9843('0x26')]=function(_0x29486d){if(_0x29486d){this['handleError'](_0x29486d,!![]);}else{this[_0x9843('0x1')]['end']();}};EmailImap[_0x9843('0x23')][_0x9843('0x25')]=function(){this[_0x9843('0x1')][_0x9843('0x27')]([_0x9843('0x28')],this['handleReadUnseen'][_0x9843('0x11')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x4482b2,_0x2340e4){if(_0x4482b2){this[_0x9843('0x13')](_0x4482b2,!![]);}else{if(_0x2340e4['length']){try{var _0x15d2a0=this[_0x9843('0x1')][_0x9843('0x29')](_0x2340e4,{'bodies':'','markSeen':!![]});_0x15d2a0['on'](_0x9843('0x2a'),this[_0x9843('0x2b')][_0x9843('0x11')](this));_0x15d2a0[_0x9843('0xe')](_0x9843('0x12'),this['handleFetchError']['bind'](this));_0x15d2a0[_0x9843('0xe')](_0x9843('0x2c'),this['handleFetchEnd'][_0x9843('0x11')](this));}catch(_0x799b41){logger[_0x9843('0x12')](_0x799b41);}}else{this[_0x9843('0x1')]['closeBox'](!![],this[_0x9843('0x26')][_0x9843('0x11')](this));}}};EmailImap[_0x9843('0x23')][_0x9843('0x2b')]=function(_0xbfdf41,_0x33339d){_0xbfdf41['on'](_0x9843('0x2d'),this[_0x9843('0x2e')][_0x9843('0x11')](this));_0xbfdf41[_0x9843('0xe')](_0x9843('0x2f'),this[_0x9843('0x30')]['bind'](this));_0xbfdf41[_0x9843('0xe')](_0x9843('0x2c'),this[_0x9843('0x31')]['bind'](this));};EmailImap[_0x9843('0x23')][_0x9843('0x2e')]=function(_0x11ca10,_0x2df837){simpleParser(_0x11ca10,{'Iconv':Iconv},this[_0x9843('0x32')][_0x9843('0x11')](this));};EmailImap['prototype'][_0x9843('0x30')]=function(_0x801d8c){};EmailImap['prototype'][_0x9843('0x31')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x16c5f2,_0x593239){if(_0x16c5f2){logger[_0x9843('0x12')](_0x16c5f2);}else{var _0x150b27=this;utils[_0x9843('0x33')](this[_0x9843('0xd')],_0x593239,function(_0x2e2aa3){_0x150b27[_0x9843('0x34')](_0x9843('0xa'),_0x2e2aa3);});}};EmailImap[_0x9843('0x23')]['handleFetchEnd']=function(){this[_0x9843('0x1')][_0x9843('0x35')](!![],this[_0x9843('0x26')][_0x9843('0x11')](this));};EmailImap[_0x9843('0x23')][_0x9843('0x36')]=function(_0x3edd4f){this[_0x9843('0x13')](_0x3edd4f);this[_0x9843('0x1')]['closeBox'](!![],this[_0x9843('0x26')][_0x9843('0x11')](this));};EmailImap[_0x9843('0x23')][_0x9843('0x37')]=function(){this[_0x9843('0x34')](_0x9843('0x2c'));};EmailImap['prototype'][_0x9843('0x13')]=function(_0x2f1c57,_0x570feb){logger[_0x9843('0x12')](_0x9843('0x13'),this[_0x9843('0xd')][_0x9843('0xa')],JSON[_0x9843('0x38')](_0x2f1c57));var _0x51981b='';if(_0x2f1c57){if(_0x2f1c57[_0x9843('0x39')]){_0x51981b=_0x2f1c57[_0x9843('0x39')];}else{for(var _0x4e22f8 in _0x2f1c57){if(_0x2f1c57['hasOwnProperty'](_0x4e22f8)){_0x51981b+=_[_0x9843('0x3a')](_0x4e22f8)+':\x20'+_0x2f1c57[_0x4e22f8]+'\x0a';}}}}if(_0x570feb){this[_0x9843('0x1')][_0x9843('0x2c')]();}else{this[_0x9843('0x34')](_0x9843('0x12'),_0x51981b);this[_0x9843('0x34')](_0x9843('0x2c'));}};module[_0x9843('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index f4bf07c..c0a2517 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 _0xeed9=['createTransport','compile','sendMail','toString','verify','exports','nodemailer','bluebird','prototype','send'];(function(_0x36ff26,_0x40a6f8){var _0xf65dcd=function(_0x2af83f){while(--_0x2af83f){_0x36ff26['push'](_0x36ff26['shift']());}};_0xf65dcd(++_0x40a6f8);}(_0xeed9,0x1e6));var _0x9eed=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0xeed9[_0x4350c2];return _0x8b6406;};'use strict';var nodemailer=require(_0x9eed('0x0'));var BPromise=require(_0x9eed('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x9eed('0x2')][_0x9eed('0x3')]=function(_0x291ef8,_0x3fd67a){return new BPromise(function(_0x55efa9,_0x3742ad){var _0x5eee69=nodemailer[_0x9eed('0x4')](_0x291ef8);_0x5eee69['use'](_0x9eed('0x5'),inlineBase64());_0x5eee69[_0x9eed('0x6')](_0x3fd67a,function(_0x537abf,_0x37dbf7){if(_0x537abf){_0x3742ad(_0x537abf[_0x9eed('0x7')]());}else{_0x55efa9(_0x37dbf7);}});});};EmailSmtp['prototype'][_0x9eed('0x8')]=function(_0x3a6b16){return new BPromise(function(_0x19ce14,_0x3f1808){var _0x1ee23d=nodemailer[_0x9eed('0x4')](_0x3a6b16);_0x1ee23d[_0x9eed('0x8')](function(_0x10c544,_0x23d596){if(_0x10c544){_0x3f1808(_0x10c544[_0x9eed('0x7')]());}else{if(_0x23d596){_0x19ce14(_0x23d596);}else{_0x3f1808('Not\x20verifired');}}});});};module[_0x9eed('0x9')]=EmailSmtp; \ No newline at end of file +var _0x2a3d=['Not\x20verifired','exports','nodemailer','createTransport','use','sendMail','toString','prototype','verify'];(function(_0x2d0e1b,_0x1bb236){var _0xf44590=function(_0xfabe4f){while(--_0xfabe4f){_0x2d0e1b['push'](_0x2d0e1b['shift']());}};_0xf44590(++_0x1bb236);}(_0x2a3d,0x1b2));var _0xd2a3=function(_0x5ecd2e,_0x239987){_0x5ecd2e=_0x5ecd2e-0x0;var _0x1b8de5=_0x2a3d[_0x5ecd2e];return _0x1b8de5;};'use strict';var nodemailer=require(_0xd2a3('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x30c477,_0x4fd547){return new BPromise(function(_0x2a02fd,_0xa513f){var _0x5d84b3=nodemailer[_0xd2a3('0x1')](_0x30c477);_0x5d84b3[_0xd2a3('0x2')]('compile',inlineBase64());_0x5d84b3[_0xd2a3('0x3')](_0x4fd547,function(_0x5035b9,_0x1e2357){if(_0x5035b9){_0xa513f(_0x5035b9[_0xd2a3('0x4')]());}else{_0x2a02fd(_0x1e2357);}});});};EmailSmtp[_0xd2a3('0x5')][_0xd2a3('0x6')]=function(_0x5ecc8c){return new BPromise(function(_0x5e70dc,_0x341bb8){var _0x50441b=nodemailer[_0xd2a3('0x1')](_0x5ecc8c);_0x50441b['verify'](function(_0x37e02e,_0x41f63a){if(_0x37e02e){_0x341bb8(_0x37e02e[_0xd2a3('0x4')]());}else{if(_0x41f63a){_0x5e70dc(_0x41f63a);}else{_0x341bb8(_0xd2a3('0x7'));}}});});};module[_0xd2a3('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d5dc5fc..99f74bd 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 _0x8d28=['gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/environment','head','value','address','anonymous','generate','name','slice','join','Anonymous','split','length','pop','isEmpty','@xcally.com','html','test','replace','body','textAsHtml','Empty\x20message

','Attachments','push','Title','Data','getHost'];(function(_0x271537,_0x8b7b3b){var _0x19dc22=function(_0x459bbf){while(--_0x459bbf){_0x271537['push'](_0x271537['shift']());}};_0x19dc22(++_0x8b7b3b);}(_0x8d28,0x120));var _0x88d2=function(_0x5a432c,_0x33d35e){_0x5a432c=_0x5a432c-0x0;var _0x92bde0=_0x8d28[_0x5a432c];return _0x92bde0;};'use strict';var _=require(_0x88d2('0x0'));var moment=require(_0x88d2('0x1'));var random=require(_0x88d2('0x2'));var fs=require('fs');var path=require(_0x88d2('0x3'));var util=require(_0x88d2('0x4'));var tnef=require(_0x88d2('0x5'));var logger=require('../../../config/logger')('email');var config=require(_0x88d2('0x6'));function getAddress(_0x41bcb1){var _0x1b0fc8=_[_0x88d2('0x7')](_0x41bcb1[_0x88d2('0x8')]);return _0x1b0fc8&&_0x1b0fc8[_0x88d2('0x9')]?_0x1b0fc8['address']:_0x88d2('0xa')+random[_0x88d2('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x40f3ec){var _0x957420=_[_0x88d2('0x7')](_0x40f3ec[_0x88d2('0x8')]);if(_0x957420&&_0x957420[_0x88d2('0xc')]){var _0x32703c=_0x957420[_0x88d2('0xc')]['split'](/\s+/);return _0x32703c['length']?_0x32703c[_0x88d2('0xd')](0x0,-0x1)[_0x88d2('0xe')]('\x20'):_0x957420['name'];}return _0x88d2('0xf');}function getLastName(_0x1e08ef){var _0xe83864=_[_0x88d2('0x7')](_0x1e08ef[_0x88d2('0x8')]);if(_0xe83864&&_0xe83864[_0x88d2('0xc')]){var _0x3587a8=_0xe83864[_0x88d2('0xc')][_0x88d2('0x10')](/\s+/);return _0x3587a8[_0x88d2('0x11')]>0x1?_0x3587a8[_0x88d2('0x12')]():'';}return'';}function getMails(_0x37d09e,_0x26cd61){var _0x336262='';for(var _0x36761b=0x0;_0x36761b<_0x26cd61[_0x88d2('0x8')][_0x88d2('0x11')];_0x36761b+=0x1){if(_0x26cd61[_0x88d2('0x8')][_0x36761b][_0x88d2('0x9')]!==_0x37d09e){if(!_[_0x88d2('0x13')](_0x336262)){_0x336262+=',';}_0x336262+=_0x26cd61[_0x88d2('0x8')][_0x36761b][_0x88d2('0xc')]||_0x26cd61[_0x88d2('0x8')][_0x36761b][_0x88d2('0x9')]||'';_0x336262+='\x20<';_0x336262+=_0x26cd61[_0x88d2('0x8')][_0x36761b]['address']?_0x26cd61[_0x88d2('0x8')][_0x36761b][_0x88d2('0x9')]:_0x88d2('0xa')+random[_0x88d2('0xb')](0x6)+_0x88d2('0x14');_0x336262+='>';}}return _0x336262;}function parseEmail(_0x8d9f91,_0x401c41,_0x3332c3){if(_0x401c41[_0x88d2('0x15')]){var _0x3b5556=/)<[^<]*)*<\/script>/gi;while(_0x3b5556[_0x88d2('0x16')](_0x401c41['html'])){_0x401c41[_0x88d2('0x15')]=_0x401c41[_0x88d2('0x15')][_0x88d2('0x17')](_0x3b5556,'');}_0x3332c3[_0x88d2('0x18')]=_0x401c41[_0x88d2('0x15')];}else{_0x3332c3['body']=_0x401c41[_0x88d2('0x19')];}if(_0x3332c3['body']){_0x3332c3['body']=_0x3332c3[_0x88d2('0x18')][_0x88d2('0x17')](/Empty\x20message

','getHost','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','@xcally.com','value','name','split','length','slice','join','Anonymous','pop','isEmpty','generate','html','test','replace','body','textAsHtml','0x1?_0xf078f7[_0xd78f('0x13')]():'';}return'';}function getMails(_0x52591b,_0x246eb8){var _0x37d642='';for(var _0x33d5ca=0x0;_0x33d5ca<_0x246eb8[_0xd78f('0xc')][_0xd78f('0xf')];_0x33d5ca+=0x1){if(_0x246eb8[_0xd78f('0xc')][_0x33d5ca][_0xd78f('0x9')]!==_0x52591b){if(!_[_0xd78f('0x14')](_0x37d642)){_0x37d642+=',';}_0x37d642+=_0x246eb8['value'][_0x33d5ca][_0xd78f('0xd')]||_0x246eb8[_0xd78f('0xc')][_0x33d5ca][_0xd78f('0x9')]||'';_0x37d642+='\x20<';_0x37d642+=_0x246eb8[_0xd78f('0xc')][_0x33d5ca]['address']?_0x246eb8[_0xd78f('0xc')][_0x33d5ca][_0xd78f('0x9')]:'anonymous'+random[_0xd78f('0x15')](0x6)+_0xd78f('0xb');_0x37d642+='>';}}return _0x37d642;}function parseEmail(_0x2cf4fa,_0x4453f2,_0x673a96){if(_0x4453f2[_0xd78f('0x16')]){var _0x45241f=/)<[^<]*)*<\/script>/gi;while(_0x45241f[_0xd78f('0x17')](_0x4453f2[_0xd78f('0x16')])){_0x4453f2[_0xd78f('0x16')]=_0x4453f2[_0xd78f('0x16')][_0xd78f('0x18')](_0x45241f,'');}_0x673a96['body']=_0x4453f2['html'];}else{_0x673a96[_0xd78f('0x19')]=_0x4453f2[_0xd78f('0x1a')];}if(_0x673a96[_0xd78f('0x19')]){_0x673a96[_0xd78f('0x19')]=_0x673a96['body'][_0xd78f('0x18')](/Empty\x20message

';if(_0x3bef2d[_0xd78f('0x37')]){for(var _0x3affcb=0x0;_0x3affcb<_0x3bef2d[_0xd78f('0x37')][_0xd78f('0xf')];_0x3affcb++){var _0x5d1763=_0x3bef2d[_0xd78f('0x37')][_0x3affcb];_0x42b34e['message'][_0xd78f('0x20')][_0xd78f('0x38')]({'filename':_0x5d1763['Title'],'content':new Buffer(_0x5d1763[_0xd78f('0x39')])});}}}_0x309a74(parseEmail(_0x464fd2,_0x4a28a1,_0x42b34e));});}else{_0x4a28a1['html']=_0xd78f('0x3a');_0x309a74(parseEmail(_0x464fd2,_0x4a28a1,_0x42b34e));}}else{_0x309a74(parseEmail(_0x464fd2,_0x4a28a1,_0x42b34e));}};exports[_0xd78f('0x3b')]=function(_0x393796){switch(_0x393796){case'gmail':return'imap.gmail.com';case _0xd78f('0x3c'):return _0xd78f('0x3d');case _0xd78f('0x3e'):return'imap-mail.outlook.com';case _0xd78f('0x3f'):return _0xd78f('0x40');}return _0xd78f('0x41');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index beb21fc..18e1c2b 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 _0x916c=['active','Imap','Smtp','exports','key','SERV'];(function(_0x36ea4c,_0x12a4b4){var _0x114364=function(_0x2d9a1a){while(--_0x2d9a1a){_0x36ea4c['push'](_0x36ea4c['shift']());}};_0x114364(++_0x12a4b4);}(_0x916c,0x1a8));var _0xc916=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x916c[_0x55d58f];return _0x1ad6e6;};'use strict';var _=require('lodash');function MailAccount(_0x1de2c1){this['id']=_0x1de2c1['id']||0x0;this['name']=_0x1de2c1['name']||'Service';this[_0xc916('0x0')]=_0x1de2c1[_0xc916('0x0')]||_0xc916('0x1');this['active']=_0x1de2c1[_0xc916('0x2')]||![];this[_0xc916('0x3')]=_0x1de2c1['Imap']||[];this['Smtp']=_0x1de2c1[_0xc916('0x4')]||[];}module[_0xc916('0x5')]=MailAccount; \ No newline at end of file +var _0x4204=['lodash','name','Service','key','active','Imap','Smtp'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0x4204,0x70));var _0x4420=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x4204[_0x31bab3];return _0x4fd382;};'use strict';var _=require(_0x4420('0x0'));function MailAccount(_0x55bf88){this['id']=_0x55bf88['id']||0x0;this[_0x4420('0x1')]=_0x55bf88[_0x4420('0x1')]||_0x4420('0x2');this[_0x4420('0x3')]=_0x55bf88['key']||'SERV';this[_0x4420('0x4')]=_0x55bf88[_0x4420('0x4')]||![];this[_0x4420('0x5')]=_0x55bf88[_0x4420('0x5')]||[];this[_0x4420('0x6')]=_0x55bf88['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 49cb96a..7ce6288 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 _0x604f=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length','merge','exports','lodash','../model/mailAccount','mapKeys'];(function(_0xe1c667,_0x1aed7b){var _0x15fbbd=function(_0x16b367){while(--_0x16b367){_0xe1c667['push'](_0xe1c667['shift']());}};_0x15fbbd(++_0x1aed7b);}(_0x604f,0xfa));var _0xf604=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x604f[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xf604('0x0'));var MailAccount=require(_0xf604('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x180b4f,_0x5da0ad,_0x1d4349){var _0x2295a8=_[_0xf604('0x2')](_0x180b4f,function(_0x3e9968,_0x5dff27){return _0x3e9968[_0x1d4349];});for(var _0x29ea20 in _0x5da0ad){if(_0x5da0ad[_0xf604('0x3')](_0x29ea20)){if(!_0x2295a8[_0x29ea20]){delete _0x5da0ad[_0x29ea20];}}}}Realtime[_0xf604('0x4')][_0xf604('0x5')]=function(_0x37f325,_0x37bb61){for(var _0x13f2a7 in _0x37bb61){if(_0x37f325['hasOwnProperty'](_0x13f2a7)){_0x37f325[_0x13f2a7]=_0x37bb61[_0x13f2a7];}}};Realtime[_0xf604('0x4')][_0xf604('0x6')]=function(){var _0x3f6a0e=this;return function(_0x44db25){if(_0x44db25){freeIsNotKey(_0x44db25,_0x3f6a0e[_0xf604('0x7')],'id');for(var _0x2ec092=0x0,_0x154e17={},_0x1b9530={};_0x2ec092<_0x44db25[_0xf604('0x8')];_0x2ec092+=0x1){_0x154e17=_0x44db25[_0x2ec092];if(_['isUndefined'](_0x3f6a0e[_0xf604('0x7')][_0x154e17['id']])){_0x3f6a0e[_0xf604('0x7')][_0x154e17['id']]=new MailAccount(_0x154e17);}else{_[_0xf604('0x9')](_0x3f6a0e[_0xf604('0x7')][_0x154e17['id']],_0x154e17);}}}return _0x3f6a0e[_0xf604('0x7')];};};module[_0xf604('0xa')]=Realtime; \ No newline at end of file +var _0x51f2=['prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts'];(function(_0x2450f9,_0x46b05f){var _0x42e990=function(_0x409bb4){while(--_0x409bb4){_0x2450f9['push'](_0x2450f9['shift']());}};_0x42e990(++_0x46b05f);}(_0x51f2,0xed));var _0x251f=function(_0x4514d7,_0x188105){_0x4514d7=_0x4514d7-0x0;var _0x481515=_0x51f2[_0x4514d7];return _0x481515;};'use strict';var _=require(_0x251f('0x0'));var MailAccount=require(_0x251f('0x1'));var Realtime=function(){this[_0x251f('0x2')]={};};function freeIsNotKey(_0x3d82d6,_0x1805f2,_0x582540){var _0x371370=_['mapKeys'](_0x3d82d6,function(_0xa020e0,_0xb783b9){return _0xa020e0[_0x582540];});for(var _0x51c501 in _0x1805f2){if(_0x1805f2['hasOwnProperty'](_0x51c501)){if(!_0x371370[_0x51c501]){delete _0x1805f2[_0x51c501];}}}}Realtime[_0x251f('0x3')][_0x251f('0x4')]=function(_0x59f26f,_0x2a0cc3){for(var _0x38859f in _0x2a0cc3){if(_0x59f26f[_0x251f('0x5')](_0x38859f)){_0x59f26f[_0x38859f]=_0x2a0cc3[_0x38859f];}}};Realtime['prototype'][_0x251f('0x6')]=function(){var _0x3ff3a8=this;return function(_0x5c363f){if(_0x5c363f){freeIsNotKey(_0x5c363f,_0x3ff3a8[_0x251f('0x2')],'id');for(var _0x5f4ac2=0x0,_0x2c168d={},_0x5b71a1={};_0x5f4ac2<_0x5c363f[_0x251f('0x7')];_0x5f4ac2+=0x1){_0x2c168d=_0x5c363f[_0x5f4ac2];if(_[_0x251f('0x8')](_0x3ff3a8[_0x251f('0x2')][_0x2c168d['id']])){_0x3ff3a8[_0x251f('0x2')][_0x2c168d['id']]=new MailAccount(_0x2c168d);}else{_[_0x251f('0x9')](_0x3ff3a8[_0x251f('0x2')][_0x2c168d['id']],_0x2c168d);}}}return _0x3ff3a8[_0x251f('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ecb03db..d4734c6 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 _0xa49e=['Request','GetMailAccount','name','service','email','active','ListId','TemplateId','MailServerIn','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x124bc0,_0x14cd20){var _0x20325b=function(_0x453d54){while(--_0x453d54){_0x124bc0['push'](_0x124bc0['shift']());}};_0x20325b(++_0x14cd20);}(_0xa49e,0x1de));var _0xea49=function(_0x162ee0,_0x291661){_0x162ee0=_0x162ee0-0x0;var _0x48fc5e=_0xa49e[_0x162ee0];return _0x48fc5e;};'use strict';var client=require(_0xea49('0x0'));exports[_0xea49('0x1')]=function(){return function(){return client[_0xea49('0x2')](_0xea49('0x3'),{'options':{'attributes':['id',_0xea49('0x4'),_0xea49('0x5'),_0xea49('0x6'),_0xea49('0x7'),'key',_0xea49('0x8'),_0xea49('0x9')],'raw':![],'include':[{'model':_0xea49('0xa'),'as':'Imap'},{'model':_0xea49('0xb'),'as':_0xea49('0xc')}]},'log':_0xea49('0xd')});};};exports[_0xea49('0xe')]=function(_0x304770,_0x4d4dee){return client[_0xea49('0x2')]('NotifyMailAccount',{'account':{'id':_0x304770},'body':_0x4d4dee,'log':_0xea49('0xf')});}; \ No newline at end of file +var _0x0e4b=['Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','ListId','TemplateId','Imap','MailServerOut'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x2d8d33,_0x3cbe56){_0x2d8d33=_0x2d8d33-0x0;var _0x14f1b3=_0x0e4b[_0x2d8d33];return _0x14f1b3;};'use strict';var client=require(_0xb0e4('0x0'));exports[_0xb0e4('0x1')]=function(){return function(){return client[_0xb0e4('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xb0e4('0x3'),'service','email','active','key',_0xb0e4('0x4'),_0xb0e4('0x5')],'raw':![],'include':[{'model':'MailServerIn','as':_0xb0e4('0x6')},{'model':_0xb0e4('0x7'),'as':_0xb0e4('0x8')}]},'log':_0xb0e4('0x9')});};};exports[_0xb0e4('0xa')]=function(_0x57f45d,_0x5192f0){return client[_0xb0e4('0x2')](_0xb0e4('0xb'),{'account':{'id':_0x57f45d},'body':_0x5192f0,'log':_0xb0e4('0xb')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 4788eba..599b365 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 _0x7fc9=['jayson/promise','bluebird','lodash','email','listen','sendMail','account','then','catch','error','verifySmtp','Verified','values','length','Imap','password','pass','Smtp','server','http','stringify','127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0x7fc9,0x1e0));var _0x97fc=function(_0x478829,_0x4ef2bb){_0x478829=_0x478829-0x0;var _0x59a14a=_0x7fc9[_0x478829];return _0x59a14a;};'use strict';var jayson=require(_0x97fc('0x0'));var BPromise=require(_0x97fc('0x1'));var _=require(_0x97fc('0x2'));var logger=require('../../../config/logger')(_0x97fc('0x3'));exports[_0x97fc('0x4')]=function(_0x4944b6,_0x298201){return new BPromise(function(_0x384244,_0xb01688){var _0x45b222={'SendMail':function(_0x58b9d2){var _0x4ae7aa=this;return new Promise(function(_0x5aa544,_0x2c2346){_0x298201[_0x97fc('0x5')](_0x58b9d2[_0x97fc('0x6')],_0x58b9d2['message'])[_0x97fc('0x7')](function(_0x17fa1c){_0x5aa544({'code':0xc8,'message':_0x17fa1c});})[_0x97fc('0x8')](function(_0x5ef7fd){_0x2c2346(_0x4ae7aa[_0x97fc('0x9')](0x1f4,_0x5ef7fd));});});},'VerifySmtp':function(_0xcf17e){var _0x5517e0=this;return new Promise(function(_0x2e4256,_0x2013fc){_0x298201[_0x97fc('0xa')](_0xcf17e[_0x97fc('0x6')])[_0x97fc('0x7')](function(_0x31e56f){_0x2e4256({'code':0xc8,'message':_0x97fc('0xb')});})[_0x97fc('0x8')](function(_0x1e79f8){_0x2013fc(_0x5517e0[_0x97fc('0x9')](0x1f4,_0x1e79f8));});});},'MailAccounts':function(_0x16739c){return new Promise(function(_0x204f28,_0x4a68dc){var _0xca27c7=_[_0x97fc('0xc')](_0x4944b6['mailAccounts']);for(var _0x45c626=0x0;_0x45c626<_0xca27c7[_0x97fc('0xd')];_0x45c626+=0x1){if(_0xca27c7[_0x45c626][_0x97fc('0xe')]&&_0xca27c7[_0x45c626]['Imap'][_0x97fc('0xf')]){delete _0xca27c7[_0x45c626][_0x97fc('0xe')][_0x97fc('0xf')];}if(_0xca27c7[_0x45c626]['Smtp']&&_0xca27c7[_0x45c626]['Smtp'][_0x97fc('0x10')]){delete _0xca27c7[_0x45c626][_0x97fc('0x11')]['pass'];}}_0x204f28({'count':_0xca27c7[_0x97fc('0xd')],'rows':_0xca27c7});});}};var _0x267fdc=jayson[_0x97fc('0x12')](_0x45b222)[_0x97fc('0x13')]();_0x267fdc['on'](_0x97fc('0x9'),function(_0x430df4){logger[_0x97fc('0x9')](JSON[_0x97fc('0x14')](_0x430df4));return _0xb01688(_0x430df4);});_0x267fdc[_0x97fc('0x4')](0x232b,_0x97fc('0x15'),function(){console['log'](_0x97fc('0x16'),0x232b);return _0x384244(_0x97fc('0x17')+0x232b);});});}; \ No newline at end of file +var _0x0a66=['error','stringify','127.0.0.1','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','../../../config/logger','email','listen','sendMail','account','message','then','catch','values','mailAccounts','length','Imap','Smtp','pass','server'];(function(_0x7d4c8,_0x2f61f9){var _0x477f43=function(_0x4c0373){while(--_0x4c0373){_0x7d4c8['push'](_0x7d4c8['shift']());}};_0x477f43(++_0x2f61f9);}(_0x0a66,0x10d));var _0x60a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0a66[_0x14add3];return _0x4a174f;};'use strict';var jayson=require(_0x60a6('0x0'));var BPromise=require(_0x60a6('0x1'));var _=require('lodash');var logger=require(_0x60a6('0x2'))(_0x60a6('0x3'));exports[_0x60a6('0x4')]=function(_0x257238,_0x149bc6){return new BPromise(function(_0x2cd879,_0x330616){var _0x3b46ea={'SendMail':function(_0x422c02){var _0x581248=this;return new Promise(function(_0x146e23,_0x2a1ae0){_0x149bc6[_0x60a6('0x5')](_0x422c02[_0x60a6('0x6')],_0x422c02[_0x60a6('0x7')])[_0x60a6('0x8')](function(_0x37b934){_0x146e23({'code':0xc8,'message':_0x37b934});})[_0x60a6('0x9')](function(_0x3c1159){_0x2a1ae0(_0x581248['error'](0x1f4,_0x3c1159));});});},'VerifySmtp':function(_0x773757){var _0x9bdbe7=this;return new Promise(function(_0x90885e,_0x4506d6){_0x149bc6['verifySmtp'](_0x773757[_0x60a6('0x6')])[_0x60a6('0x8')](function(_0x536f55){_0x90885e({'code':0xc8,'message':'Verified'});})[_0x60a6('0x9')](function(_0xe50aa1){_0x4506d6(_0x9bdbe7['error'](0x1f4,_0xe50aa1));});});},'MailAccounts':function(_0x4f9f82){return new Promise(function(_0x41a3c5,_0x3a27fd){var _0x1c460c=_[_0x60a6('0xa')](_0x257238[_0x60a6('0xb')]);for(var _0x447d50=0x0;_0x447d50<_0x1c460c[_0x60a6('0xc')];_0x447d50+=0x1){if(_0x1c460c[_0x447d50][_0x60a6('0xd')]&&_0x1c460c[_0x447d50][_0x60a6('0xd')]['password']){delete _0x1c460c[_0x447d50][_0x60a6('0xd')]['password'];}if(_0x1c460c[_0x447d50]['Smtp']&&_0x1c460c[_0x447d50][_0x60a6('0xe')]['pass']){delete _0x1c460c[_0x447d50][_0x60a6('0xe')][_0x60a6('0xf')];}}_0x41a3c5({'count':_0x1c460c[_0x60a6('0xc')],'rows':_0x1c460c});});}};var _0x34e9f4=jayson[_0x60a6('0x10')](_0x3b46ea)['http']();_0x34e9f4['on'](_0x60a6('0x11'),function(_0x154ee7){logger[_0x60a6('0x11')](JSON[_0x60a6('0x12')](_0x154ee7));return _0x330616(_0x154ee7);});_0x34e9f4[_0x60a6('0x4')](0x232b,_0x60a6('0x13'),function(){console['log'](_0x60a6('0x14'),0x232b);return _0x2cd879(_0x60a6('0x15')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 9a1dc52..b17bfbc 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 _0xb208=['lodash','http','express','sticky-session','../../config/environment','createServer','listen','port','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0xb208,0x84));var _0x8b20=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb208[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x8b20('0x0'));var http=require(_0x8b20('0x1'));var express=require(_0x8b20('0x2'));var sticky=require(_0x8b20('0x3'));var Redis=require('ioredis');var config=require(_0x8b20('0x4'));var app=express();var server=http[_0x8b20('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x8b20('0x6')](server,config[_0x8b20('0x7')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x8b20('0x8')]});config[_0x8b20('0x9')]=_[_0x8b20('0xa')](config['redis'],{'host':_0x8b20('0xb'),'port':0x18eb});socketio[_0x8b20('0xc')](require(_0x8b20('0xd'))({'pubClient':new Redis(config[_0x8b20('0x9')]),'subClient':new Redis(config[_0x8b20('0x9')])}));require(_0x8b20('0xe'))['default']();require('../../config/socketio')[_0x8b20('0xf')](socketio);require(_0x8b20('0x10'))[_0x8b20('0xf')](app);require(_0x8b20('0x11'))[_0x8b20('0xf')](app);}else{server[_0x8b20('0x12')](_0x8b20('0x13'),function(){console[_0x8b20('0x14')](_0x8b20('0x15'),config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x4a9f=['defaults','localhost','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','redis'];(function(_0x3156a2,_0x4300a3){var _0x55315c=function(_0x46ba13){while(--_0x46ba13){_0x3156a2['push'](_0x3156a2['shift']());}};_0x55315c(++_0x4300a3);}(_0x4a9f,0x12c));var _0xf4a9=function(_0xfbe234,_0x7d4de9){_0xfbe234=_0xfbe234-0x0;var _0x3cec2c=_0x4a9f[_0xfbe234];return _0x3cec2c;};'use strict';var _=require(_0xf4a9('0x0'));var http=require(_0xf4a9('0x1'));var express=require(_0xf4a9('0x2'));var sticky=require(_0xf4a9('0x3'));var Redis=require(_0xf4a9('0x4'));var config=require(_0xf4a9('0x5'));var app=express();var server=http[_0xf4a9('0x6')](app);server[_0xf4a9('0x7')]=0xdbba0;if(sticky[_0xf4a9('0x8')](server,config[_0xf4a9('0x9')])){var socketio=require(_0xf4a9('0xa'))(server,{'transports':['websocket','polling']});config[_0xf4a9('0xb')]=_[_0xf4a9('0xc')](config[_0xf4a9('0xb')],{'host':_0xf4a9('0xd'),'port':0x18eb});socketio['adapter'](require(_0xf4a9('0xe'))({'pubClient':new Redis(config[_0xf4a9('0xb')]),'subClient':new Redis(config[_0xf4a9('0xb')])}));require(_0xf4a9('0xf'))['default']();require('../../config/socketio')[_0xf4a9('0x10')](socketio);require(_0xf4a9('0x11'))[_0xf4a9('0x10')](app);require(_0xf4a9('0x12'))[_0xf4a9('0x10')](app);}else{server[_0xf4a9('0x13')](_0xf4a9('0x14'),function(){console[_0xf4a9('0x15')](_0xf4a9('0x16'),config['port']);});}exports=module[_0xf4a9('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 1fe31a3..4333157 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 _0xd847=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','Request','then','debug','rpc','error'];(function(_0x1e6dd7,_0x275cb){var _0x405461=function(_0x55f643){while(--_0x55f643){_0x1e6dd7['push'](_0x1e6dd7['shift']());}};_0x405461(++_0x275cb);}(_0xd847,0x18a));var _0x7d84=function(_0x514c8f,_0x687151){_0x514c8f=_0x514c8f-0x0;var _0xf4b515=_0xd847[_0x514c8f];return _0xf4b515;};'use strict';var jayson=require(_0x7d84('0x0'));var BPromise=require(_0x7d84('0x1'));var logger=require(_0x7d84('0x2'))(_0x7d84('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x7d84('0x4')]=function(_0xd9edc8,_0x207e6f){return new BPromise(function(_0x15f200,_0x7aac34){return client['request'](_0xd9edc8,_0x207e6f)[_0x7d84('0x5')](function(_0x5d8f76){logger[_0x7d84('0x6')](_0x7d84('0x7'),_0x7d84('0x3'),_0xd9edc8,_0x207e6f,_0x5d8f76);if(_0x5d8f76[_0x7d84('0x8')]){logger[_0x7d84('0x8')](_0x7d84('0x7'),'routing',_0xd9edc8,_0x5d8f76[_0x7d84('0x8')]['message'],_0x207e6f);return _0x7aac34(_0x5d8f76['error'][_0x7d84('0x9')]);}else{return _0x15f200(_0x5d8f76[_0x7d84('0xa')]);}})[_0x7d84('0xb')](function(_0x27aa7a){logger[_0x7d84('0x8')](_0x7d84('0x7'),_0x7d84('0x3'),_0xd9edc8,_0x27aa7a,_0x207e6f);return _0x7aac34(_0x27aa7a);});});};module[_0x7d84('0xc')]=client; \ No newline at end of file +var _0x3fc6=['jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','routing','error','rpc','message','result','catch','exports'];(function(_0x13b7c4,_0x32d511){var _0x5a1efe=function(_0x692ab8){while(--_0x692ab8){_0x13b7c4['push'](_0x13b7c4['shift']());}};_0x5a1efe(++_0x32d511);}(_0x3fc6,0x159));var _0x63fc=function(_0x1bd744,_0x250a24){_0x1bd744=_0x1bd744-0x0;var _0x55075f=_0x3fc6[_0x1bd744];return _0x55075f;};'use strict';var jayson=require(_0x63fc('0x0'));var BPromise=require(_0x63fc('0x1'));var logger=require(_0x63fc('0x2'))('routing');var client=jayson[_0x63fc('0x3')][_0x63fc('0x4')]({'port':0x2329});client[_0x63fc('0x5')]=function(_0x133695,_0x155db7){return new BPromise(function(_0x13c33d,_0x4e6030){return client['request'](_0x133695,_0x155db7)[_0x63fc('0x6')](function(_0x7d24f){logger[_0x63fc('0x7')]('rpc',_0x63fc('0x8'),_0x133695,_0x155db7,_0x7d24f);if(_0x7d24f[_0x63fc('0x9')]){logger['error'](_0x63fc('0xa'),_0x63fc('0x8'),_0x133695,_0x7d24f[_0x63fc('0x9')][_0x63fc('0xb')],_0x155db7);return _0x4e6030(_0x7d24f[_0x63fc('0x9')][_0x63fc('0xb')]);}else{return _0x13c33d(_0x7d24f[_0x63fc('0xc')]);}})[_0x63fc('0xd')](function(_0x15da4e){logger[_0x63fc('0x9')]('rpc',_0x63fc('0x8'),_0x133695,_0x15da4e,_0x155db7);return _0x4e6030(_0x15da4e);});});};module[_0x63fc('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index aa6fb6e..ebfb289 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 _0x8d70=['getAgents','initAgents','getIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./server','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then'];(function(_0x47f4e3,_0x40fc41){var _0x53003f=function(_0x35329c){while(--_0x35329c){_0x47f4e3['push'](_0x47f4e3['shift']());}};_0x53003f(++_0x40fc41);}(_0x8d70,0x114));var _0x08d7=function(_0x500cad,_0xb060bc){_0x500cad=_0x500cad-0x0;var _0x123867=_0x8d70[_0x500cad];return _0x123867;};'use strict';var BPromise=require('bluebird');var server=require(_0x08d7('0x0'));var Realtime=require('./realtime');var user=require(_0x08d7('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x08d7('0x2'));var chatQueue=require(_0x08d7('0x3'));var smsQueue=require(_0x08d7('0x4'));var mailQueue=require(_0x08d7('0x5'));var faxQueue=require(_0x08d7('0x6'));var whatsappQueue=require(_0x08d7('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x08d7('0x8')]()[_0x08d7('0x9')](user[_0x08d7('0xa')]())['then'](realtime[_0x08d7('0xb')]())[_0x08d7('0x9')](interval[_0x08d7('0xc')]())['then'](realtime['initIntervals']())[_0x08d7('0x9')](openchannelQueue[_0x08d7('0xd')]())[_0x08d7('0x9')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())[_0x08d7('0x9')](realtime[_0x08d7('0xe')]())[_0x08d7('0x9')](smsQueue[_0x08d7('0xf')]())['then'](realtime[_0x08d7('0x10')]())['then'](mailQueue[_0x08d7('0x11')]())[_0x08d7('0x9')](realtime[_0x08d7('0x12')]())['then'](faxQueue[_0x08d7('0x13')]())[_0x08d7('0x9')](realtime[_0x08d7('0x14')]())[_0x08d7('0x9')](whatsappQueue[_0x08d7('0x15')]())[_0x08d7('0x9')](realtime[_0x08d7('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0x08d7('0x17')](realtime)[_0x08d7('0x9')](function(_0x379c18){return initRealtime();})[_0x08d7('0x9')](function(_0x2a061e){return setInterval(initRealtime,0x1388);})[_0x08d7('0x18')](function(_0x48f66b){console[_0x08d7('0x19')](_0x48f66b);});}main(); \ No newline at end of file +var _0x25b0=['./rpc/whatsappQueue','then','getAgents','initAgents','initIntervals','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','log','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue'];(function(_0x21ae5c,_0x2d43b9){var _0x5d2537=function(_0x2a9a07){while(--_0x2a9a07){_0x21ae5c['push'](_0x21ae5c['shift']());}};_0x5d2537(++_0x2d43b9);}(_0x25b0,0xf6));var _0x025b=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x25b0[_0x2b0a86];return _0x955940;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x025b('0x0'));var user=require(_0x025b('0x1'));var interval=require(_0x025b('0x2'));var openchannelQueue=require(_0x025b('0x3'));var chatQueue=require(_0x025b('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x025b('0x5'));var faxQueue=require(_0x025b('0x6'));var whatsappQueue=require(_0x025b('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x025b('0x8')](user[_0x025b('0x9')]())[_0x025b('0x8')](realtime[_0x025b('0xa')]())[_0x025b('0x8')](interval['getIntervals']())[_0x025b('0x8')](realtime[_0x025b('0xb')]())[_0x025b('0x8')](openchannelQueue['getOpenchannelQueues']())[_0x025b('0x8')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x025b('0xc')]())['then'](realtime[_0x025b('0xd')]())['then'](smsQueue[_0x025b('0xe')]())[_0x025b('0x8')](realtime[_0x025b('0xf')]())[_0x025b('0x8')](mailQueue[_0x025b('0x10')]())['then'](realtime[_0x025b('0x11')]())['then'](faxQueue[_0x025b('0x12')]())[_0x025b('0x8')](realtime[_0x025b('0x13')]())[_0x025b('0x8')](whatsappQueue[_0x025b('0x14')]())[_0x025b('0x8')](realtime[_0x025b('0x15')]())[_0x025b('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x025b('0x8')](function(_0x14b9f7){return initRealtime();})[_0x025b('0x8')](function(_0x193057){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3a2abc){console[_0x025b('0x16')](_0x3a2abc);});}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 f27c7c6..ec73872 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 _0xaacf=['prototype','isArray','concat','isObject','push','sync','orderBy','asc','execute','result','clone','ruleRef','index_','nextTick','next','isEqual','restart','length','condition','filter','turn','findRules','priority','toJSON','toString','consequence','fromJSON','init','isString','parse','map','object','register','exports','lodash','EventEmitter','isNil','ignoreFactChanges','inherits','rules','activeRules'];(function(_0x4ff532,_0x275015){var _0x496f13=function(_0x3af7d5){while(--_0x3af7d5){_0x4ff532['push'](_0x4ff532['shift']());}};_0x496f13(++_0x275015);}(_0xaacf,0xc6));var _0xfaac=function(_0x4ae430,_0x2601e7){_0x4ae430=_0x4ae430-0x0;var _0x585856=_0xaacf[_0x4ae430];return _0x585856;};'use strict';var _=require(_0xfaac('0x0'));var util=require('util');var EventEmitter=require('events')[_0xfaac('0x1')];function RuleEngine(_0x45619d,_0x41824f){this['init']();if(!_[_0xfaac('0x2')](_0x45619d)){this['register'](_0x45619d);}if(_0x41824f){this[_0xfaac('0x3')]=_0x41824f[_0xfaac('0x3')];}return this;}util[_0xfaac('0x4')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x1e8c77){this[_0xfaac('0x5')]=[];this[_0xfaac('0x6')]=[];};RuleEngine[_0xfaac('0x7')]['register']=function(_0x4f8290){if(Array[_0xfaac('0x8')](_0x4f8290)){this[_0xfaac('0x5')]=this[_0xfaac('0x5')][_0xfaac('0x9')](_0x4f8290);}else if(_0x4f8290!==null&&_[_0xfaac('0xa')](_0x4f8290)){this[_0xfaac('0x5')][_0xfaac('0xb')](_0x4f8290);}this[_0xfaac('0xc')]();};RuleEngine[_0xfaac('0x7')][_0xfaac('0xc')]=function(){this[_0xfaac('0x6')]=this[_0xfaac('0x5')]['filter'](function(_0x1145cf){if(_['isNil'](_0x1145cf['on'])){_0x1145cf['on']=!![];}if(_0x1145cf['on']===!![]){return _0x1145cf;}});this[_0xfaac('0x6')]=_[_0xfaac('0xd')](this['activeRules'],['p'],[_0xfaac('0xe')]);};RuleEngine[_0xfaac('0x7')][_0xfaac('0xf')]=function(_0x367cf0,_0x374b89){var _0x39b592=![];_0x367cf0[_0xfaac('0x10')]=!![];var _0x358e97=_[_0xfaac('0x11')](_0x367cf0);var _0x5a3902=_['clone'](_0x367cf0);var _0x447c0a=this[_0xfaac('0x6')];var _0xb9efd6=[];var _0x4ce8e9=this[_0xfaac('0x3')];(function FnRuleLoop(_0x29c36b){var _0x1b7f0d={'rules':function(){return _0x447c0a;},'rule':function(){return _0x447c0a[_0x29c36b];},'when':function(_0x223a5a){if(_0x223a5a){var _0x49e9a3=_0x447c0a[_0x29c36b]['consequence'];_0x49e9a3[_0xfaac('0x12')]=_0x447c0a[_0x29c36b]['id']||_0x447c0a[_0x29c36b]['name']||_0xfaac('0x13')+_0x29c36b;process[_0xfaac('0x14')](function(){_0xb9efd6['push'](_0x49e9a3[_0xfaac('0x12')]);_0x49e9a3['call'](_0x358e97,_0x1b7f0d);});}else{process[_0xfaac('0x14')](function(){_0x1b7f0d[_0xfaac('0x15')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x39b592=!![];return FnRuleLoop(0x0);},'next':function(_0x45601b){if(!_0x4ce8e9&&!_[_0xfaac('0x16')](_0x5a3902,_0x358e97)){_0x5a3902=_[_0xfaac('0x11')](_0x358e97);process[_0xfaac('0x14')](function(){_0x1b7f0d[_0xfaac('0x17')]();});}else{process[_0xfaac('0x14')](function(){if(_[_0xfaac('0x2')](_0x45601b)){return FnRuleLoop(_0x29c36b+0x1);}else{return FnRuleLoop(_0x45601b);}});}}};if(_0x29c36b<_0x447c0a[_0xfaac('0x18')]&&_0x39b592===![]){var _0x51ca56=_0x447c0a[_0x29c36b][_0xfaac('0x19')];_0x51ca56['call'](_0x358e97,_0x1b7f0d);}else{process[_0xfaac('0x14')](function(){_0x358e97['matchPath']=_0xb9efd6;return _0x374b89?_0x374b89(_0x358e97):_['noop']();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4905f8){if(_[_0xfaac('0x2')](_0x4905f8)){return this['rules'];}else{var _0x354260=_['matches'](_0x4905f8);return _[_0xfaac('0x1a')](this[_0xfaac('0x5')],_0x354260);}};RuleEngine[_0xfaac('0x7')][_0xfaac('0x1b')]=function(_0x2aefee,_0x3d8099){var _0x5c40b3=_0x2aefee==='on'||_0x2aefee==='ON'?!![]:![];var _0x375cd1=this['findRules'](_0x3d8099);for(var _0x3c3ff8=0x0,_0x1e12d8=_0x375cd1[_0xfaac('0x18')];_0x3c3ff8<_0x1e12d8;_0x3c3ff8+=0x1){_0x375cd1[_0x3c3ff8]['on']=_0x5c40b3;}this[_0xfaac('0xc')]();};RuleEngine[_0xfaac('0x7')]['prioritize']=function(_0x272d77,_0x3c9f84){_0x272d77=parseInt(_0x272d77,0xa);var _0x2f589d=this[_0xfaac('0x1c')](_0x3c9f84);for(var _0x181ec9=0x0,_0x1a52f0=_0x2f589d[_0xfaac('0x18')];_0x181ec9<_0x1a52f0;_0x181ec9+=0x1){_0x2f589d[_0x181ec9][_0xfaac('0x1d')]=_0x272d77;}this[_0xfaac('0xc')]();};RuleEngine[_0xfaac('0x7')][_0xfaac('0x1e')]=function(){var _0xdca387=this['rules'];if(_0xdca387 instanceof Array){_0xdca387=_0xdca387['map'](function(_0x2014ff){_0x2014ff['condition']=_0x2014ff['condition'][_0xfaac('0x1f')]();_0x2014ff['consequence']=_0x2014ff[_0xfaac('0x20')][_0xfaac('0x1f')]();return _0x2014ff;});}else if(!_['isNil'](_0xdca387)){_0xdca387[_0xfaac('0x19')]=_0xdca387['condition']['toString']();_0xdca387[_0xfaac('0x20')]=_0xdca387[_0xfaac('0x20')][_0xfaac('0x1f')]();}return _0xdca387;};RuleEngine['prototype'][_0xfaac('0x21')]=function(_0x1e62cb){this[_0xfaac('0x22')]();if(_[_0xfaac('0x23')](_0x1e62cb)){_0x1e62cb=JSON[_0xfaac('0x24')](_0x1e62cb);}if(_0x1e62cb instanceof Array){_0x1e62cb=_0x1e62cb[_0xfaac('0x25')](function(_0x4b6038){_0x4b6038[_0xfaac('0x19')]=eval('('+_0x4b6038[_0xfaac('0x19')]+')');_0x4b6038[_0xfaac('0x20')]=eval('('+_0x4b6038[_0xfaac('0x20')]+')');return _0x4b6038;});}else if(_0x1e62cb!==null&&typeof _0x1e62cb==_0xfaac('0x26')){_0x1e62cb[_0xfaac('0x19')]=eval('('+_0x1e62cb['condition']+')');_0x1e62cb[_0xfaac('0x20')]=eval('('+_0x1e62cb['consequence']+')');}this[_0xfaac('0x27')](_0x1e62cb);};module[_0xfaac('0x28')]=RuleEngine; \ No newline at end of file +var _0x6b12=['exports','lodash','util','events','EventEmitter','init','register','rules','activeRules','prototype','isArray','concat','sync','isNil','orderBy','asc','execute','result','clone','ignoreFactChanges','ruleRef','name','call','nextTick','next','isEqual','length','condition','matchPath','findRules','filter','turn','prioritize','toJSON','toString','consequence','fromJSON','isString','parse','map','object'];(function(_0xaf6523,_0x5ba257){var _0x5c5125=function(_0x3b36ba){while(--_0x3b36ba){_0xaf6523['push'](_0xaf6523['shift']());}};_0x5c5125(++_0x5ba257);}(_0x6b12,0xce));var _0x26b1=function(_0x507437,_0x54cf1d){_0x507437=_0x507437-0x0;var _0xc44070=_0x6b12[_0x507437];return _0xc44070;};'use strict';var _=require(_0x26b1('0x0'));var util=require(_0x26b1('0x1'));var EventEmitter=require(_0x26b1('0x2'))[_0x26b1('0x3')];function RuleEngine(_0x55bf54,_0x2657b1){this[_0x26b1('0x4')]();if(!_['isNil'](_0x55bf54)){this[_0x26b1('0x5')](_0x55bf54);}if(_0x2657b1){this['ignoreFactChanges']=_0x2657b1['ignoreFactChanges'];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x26b1('0x4')]=function(_0x2e7386){this[_0x26b1('0x6')]=[];this[_0x26b1('0x7')]=[];};RuleEngine[_0x26b1('0x8')][_0x26b1('0x5')]=function(_0x408982){if(Array[_0x26b1('0x9')](_0x408982)){this[_0x26b1('0x6')]=this[_0x26b1('0x6')][_0x26b1('0xa')](_0x408982);}else if(_0x408982!==null&&_['isObject'](_0x408982)){this['rules']['push'](_0x408982);}this[_0x26b1('0xb')]();};RuleEngine['prototype'][_0x26b1('0xb')]=function(){this[_0x26b1('0x7')]=this[_0x26b1('0x6')]['filter'](function(_0x2ad26b){if(_[_0x26b1('0xc')](_0x2ad26b['on'])){_0x2ad26b['on']=!![];}if(_0x2ad26b['on']===!![]){return _0x2ad26b;}});this[_0x26b1('0x7')]=_[_0x26b1('0xd')](this['activeRules'],['p'],[_0x26b1('0xe')]);};RuleEngine[_0x26b1('0x8')][_0x26b1('0xf')]=function(_0x3bde0f,_0x28dc89){var _0x595049=![];_0x3bde0f[_0x26b1('0x10')]=!![];var _0x4f2228=_[_0x26b1('0x11')](_0x3bde0f);var _0x5e26da=_[_0x26b1('0x11')](_0x3bde0f);var _0x32ef72=this[_0x26b1('0x7')];var _0x173087=[];var _0x5791f4=this[_0x26b1('0x12')];(function FnRuleLoop(_0x3f9907){var _0x46a934={'rules':function(){return _0x32ef72;},'rule':function(){return _0x32ef72[_0x3f9907];},'when':function(_0x65bcf2){if(_0x65bcf2){var _0x165118=_0x32ef72[_0x3f9907]['consequence'];_0x165118[_0x26b1('0x13')]=_0x32ef72[_0x3f9907]['id']||_0x32ef72[_0x3f9907][_0x26b1('0x14')]||'index_'+_0x3f9907;process['nextTick'](function(){_0x173087['push'](_0x165118['ruleRef']);_0x165118[_0x26b1('0x15')](_0x4f2228,_0x46a934);});}else{process[_0x26b1('0x16')](function(){_0x46a934[_0x26b1('0x17')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x595049=!![];return FnRuleLoop(0x0);},'next':function(_0x54802d){if(!_0x5791f4&&!_[_0x26b1('0x18')](_0x5e26da,_0x4f2228)){_0x5e26da=_['clone'](_0x4f2228);process[_0x26b1('0x16')](function(){_0x46a934['restart']();});}else{process['nextTick'](function(){if(_['isNil'](_0x54802d)){return FnRuleLoop(_0x3f9907+0x1);}else{return FnRuleLoop(_0x54802d);}});}}};if(_0x3f9907<_0x32ef72[_0x26b1('0x19')]&&_0x595049===![]){var _0x2cf245=_0x32ef72[_0x3f9907][_0x26b1('0x1a')];_0x2cf245[_0x26b1('0x15')](_0x4f2228,_0x46a934);}else{process[_0x26b1('0x16')](function(){_0x4f2228[_0x26b1('0x1b')]=_0x173087;return _0x28dc89?_0x28dc89(_0x4f2228):_['noop']();});}}(0x0));};RuleEngine[_0x26b1('0x8')][_0x26b1('0x1c')]=function(_0x3bb400){if(_[_0x26b1('0xc')](_0x3bb400)){return this['rules'];}else{var _0x30d99c=_['matches'](_0x3bb400);return _[_0x26b1('0x1d')](this[_0x26b1('0x6')],_0x30d99c);}};RuleEngine[_0x26b1('0x8')][_0x26b1('0x1e')]=function(_0x195beb,_0x257a03){var _0x42e8ea=_0x195beb==='on'||_0x195beb==='ON'?!![]:![];var _0x1999ea=this['findRules'](_0x257a03);for(var _0x50cda4=0x0,_0x4ca260=_0x1999ea[_0x26b1('0x19')];_0x50cda4<_0x4ca260;_0x50cda4+=0x1){_0x1999ea[_0x50cda4]['on']=_0x42e8ea;}this[_0x26b1('0xb')]();};RuleEngine[_0x26b1('0x8')][_0x26b1('0x1f')]=function(_0x25fb9c,_0x4658e1){_0x25fb9c=parseInt(_0x25fb9c,0xa);var _0x59d0e0=this['findRules'](_0x4658e1);for(var _0x186922=0x0,_0x1ea894=_0x59d0e0['length'];_0x186922<_0x1ea894;_0x186922+=0x1){_0x59d0e0[_0x186922]['priority']=_0x25fb9c;}this[_0x26b1('0xb')]();};RuleEngine['prototype'][_0x26b1('0x20')]=function(){var _0x27cadb=this[_0x26b1('0x6')];if(_0x27cadb instanceof Array){_0x27cadb=_0x27cadb['map'](function(_0x3abab4){_0x3abab4[_0x26b1('0x1a')]=_0x3abab4['condition'][_0x26b1('0x21')]();_0x3abab4[_0x26b1('0x22')]=_0x3abab4['consequence'][_0x26b1('0x21')]();return _0x3abab4;});}else if(!_[_0x26b1('0xc')](_0x27cadb)){_0x27cadb[_0x26b1('0x1a')]=_0x27cadb[_0x26b1('0x1a')][_0x26b1('0x21')]();_0x27cadb[_0x26b1('0x22')]=_0x27cadb[_0x26b1('0x22')][_0x26b1('0x21')]();}return _0x27cadb;};RuleEngine[_0x26b1('0x8')][_0x26b1('0x23')]=function(_0x2bab3a){this['init']();if(_[_0x26b1('0x24')](_0x2bab3a)){_0x2bab3a=JSON[_0x26b1('0x25')](_0x2bab3a);}if(_0x2bab3a instanceof Array){_0x2bab3a=_0x2bab3a[_0x26b1('0x26')](function(_0x1286ea){_0x1286ea[_0x26b1('0x1a')]=eval('('+_0x1286ea[_0x26b1('0x1a')]+')');_0x1286ea[_0x26b1('0x22')]=eval('('+_0x1286ea[_0x26b1('0x22')]+')');return _0x1286ea;});}else if(_0x2bab3a!==null&&typeof _0x2bab3a==_0x26b1('0x27')){_0x2bab3a[_0x26b1('0x1a')]=eval('('+_0x2bab3a['condition']+')');_0x2bab3a[_0x26b1('0x22')]=eval('('+_0x2bab3a[_0x26b1('0x22')]+')');}this[_0x26b1('0x5')](_0x2bab3a);};module[_0x26b1('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 33d8862..91f6453 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x42d1f8,_0x165cdf){var _0x2f3023=function(_0x2a06ba){while(--_0x2a06ba){_0x42d1f8['push'](_0x42d1f8['shift']());}};_0x2f3023(++_0x165cdf);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x46eed8,_0x1cd3b2){var _0xeee09c=function(_0xd381b7){while(--_0xd381b7){_0x46eed8['push'](_0x46eed8['shift']());}};_0xeee09c(++_0x1cd3b2);}(_0x814b,0x1a2));var _0xb814=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x814b[_0x220afa];return _0x1b79d1;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index c633bec..385d759 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 _0xefe2=['updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','faxPause','mailCapacity','faxStatusTime','whatsappStatus','md5','emit','user:save','lodash','moment','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue'];(function(_0xc80702,_0x18ef50){var _0x4c4c76=function(_0x24ee31){while(--_0x24ee31){_0xc80702['push'](_0xc80702['shift']());}};_0x4c4c76(++_0x18ef50);}(_0xefe2,0xd9));var _0x2efe=function(_0x180fa9,_0x5474d2){_0x180fa9=_0x180fa9-0x0;var _0x15c151=_0xefe2[_0x180fa9];return _0x15c151;};'use strict';var _=require(_0x2efe('0x0'));var moment=require(_0x2efe('0x1'));var md5=require('md5');var Redis=require(_0x2efe('0x2'));var config=require(_0x2efe('0x3'));config['redis']=_[_0x2efe('0x4')](config['redis'],{'host':_0x2efe('0x5'),'port':0x18eb});var io=require(_0x2efe('0x6'))(new Redis(config[_0x2efe('0x7')]));function Agent(_0x300cb7){this['id']=_0x300cb7['id']||0x0;this[_0x2efe('0x8')]=_0x300cb7['name']||'';this[_0x2efe('0x9')]=_0x300cb7[_0x2efe('0x9')]||!![];this[_0x2efe('0xa')]=_0x300cb7[_0x2efe('0xa')]||![];this['chatPause']=_0x300cb7[_0x2efe('0xb')]||![];this[_0x2efe('0xc')]=_0x300cb7[_0x2efe('0xc')]||![];this['faxPause']=_0x300cb7['faxPause']||![];this[_0x2efe('0xd')]=_0x300cb7['smsPause']||![];this['openchannelPause']=_0x300cb7[_0x2efe('0xe')]||![];this[_0x2efe('0xf')]=_0x2efe('0x10');this[_0x2efe('0x11')]=0x0;this[_0x2efe('0x12')]=_0x300cb7[_0x2efe('0x12')]||0x0;this[_0x2efe('0x13')]=0x0;this[_0x2efe('0x14')]=_0x2efe('0x10');this[_0x2efe('0x15')]=0x0;this['mailCapacity']=_0x300cb7['mailCapacity']||0x0;this[_0x2efe('0x16')]=0x0;this[_0x2efe('0x17')]='unknown';this['faxStatusTime']=0x0;this[_0x2efe('0x18')]=_0x300cb7['faxCapacity']||0x0;this[_0x2efe('0x19')]=0x0;this[_0x2efe('0x1a')]='unknown';this[_0x2efe('0x1b')]=0x0;this[_0x2efe('0x1c')]=_0x300cb7['smsCapacity']||0x0;this[_0x2efe('0x1d')]=0x0;this['whatsappStatus']='unknown';this[_0x2efe('0x1e')]=0x0;this[_0x2efe('0x1f')]=_0x300cb7[_0x2efe('0x1f')]||0x0;this[_0x2efe('0x20')]=0x0;this[_0x2efe('0x21')]=_0x2efe('0x10');this[_0x2efe('0x22')]=0x0;this[_0x2efe('0x23')]=_0x300cb7[_0x2efe('0x23')]||0x0;this[_0x2efe('0x24')]=0x0;this[_0x2efe('0x25')]=![];this[_0x2efe('0x26')]=undefined;this['md5']='';this[_0x2efe('0x27')]();}Agent['prototype'][_0x2efe('0x28')]=function(_0x6e7b56){if(this[_0x6e7b56+_0x2efe('0x29')]>0x0){if(this[_0x6e7b56+'Capacity']>0x0&&this[_0x6e7b56+_0x2efe('0x29')]>=this[_0x6e7b56+_0x2efe('0x2a')]){return'maxcapacity';}else{return _0x2efe('0x2b');}}else{return _0x2efe('0x2c');}};Agent[_0x2efe('0x2d')][_0x2efe('0x27')]=function(){var _0x29c7c2=[_0x2efe('0x2e'),_0x2efe('0x2f'),_0x2efe('0x30'),_0x2efe('0x31'),_0x2efe('0x32'),_0x2efe('0x33')];for(var _0x26080e=0x0;_0x26080e<_0x29c7c2[_0x2efe('0x34')];_0x26080e+=0x1){var _0x255330=this['getChannelStatus'](_0x29c7c2[_0x26080e]);if(this[_0x29c7c2[_0x26080e]+_0x2efe('0x35')]!==_0x255330){this[_0x29c7c2[_0x26080e]+_0x2efe('0x36')]=_[_0x2efe('0x37')](moment()[_0x2efe('0x38')]('x'));}this[_0x29c7c2[_0x26080e]+_0x2efe('0x35')]=_0x255330;}var _0x431394={'id':this['id'],'name':this[_0x2efe('0x8')],'online':this[_0x2efe('0x9')],'voicePause':this[_0x2efe('0xa')],'chatPause':this[_0x2efe('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0x2efe('0xd')],'faxPause':this[_0x2efe('0x39')],'openchannelPause':this[_0x2efe('0xe')],'chatStatus':this[_0x2efe('0xf')],'chatStatusTime':this[_0x2efe('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2efe('0x13')],'mailStatus':this[_0x2efe('0x14')],'mailStatusTime':this[_0x2efe('0x15')],'mailCapacity':this[_0x2efe('0x3a')],'mailCurrentCapacity':this[_0x2efe('0x16')],'faxStatus':this[_0x2efe('0x17')],'faxStatusTime':this[_0x2efe('0x3b')],'faxCapacity':this[_0x2efe('0x18')],'faxCurrentCapacity':this[_0x2efe('0x19')],'smsStatus':this[_0x2efe('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x2efe('0x1c')],'smsCurrentCapacity':this[_0x2efe('0x1d')],'whatsappStatus':this[_0x2efe('0x3c')],'whatsappStatusTime':this[_0x2efe('0x1e')],'whatsappCapacity':this[_0x2efe('0x1f')],'whatsappCurrentCapacity':this[_0x2efe('0x20')],'openchannelStatus':this[_0x2efe('0x21')],'openchannelStatusTime':this[_0x2efe('0x22')],'openchannelCapacity':this[_0x2efe('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x2efe('0x25')],'busyQueue':this[_0x2efe('0x26')]};var _0x52823d=md5(JSON['stringify'](_0x431394));if(this['md5']!==_0x52823d){this[_0x2efe('0x3d')]=_0x52823d;io[_0x2efe('0x3e')](_0x2efe('0x3f'),_0x431394);}};module['exports']=Agent; \ No newline at end of file +var _0xb62e=['toNumber','format','Status','stringify','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','getChannelStatus','CurrentCapacity','Capacity','working','idle','prototype','updateRealtime','chat','fax','whatsapp','length','StatusTime'];(function(_0xbbe7b,_0x5dbc60){var _0x2b9e21=function(_0x3666c1){while(--_0x3666c1){_0xbbe7b['push'](_0xbbe7b['shift']());}};_0x2b9e21(++_0x5dbc60);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xeb62('0x0'));var moment=require(_0xeb62('0x1'));var md5=require(_0xeb62('0x2'));var Redis=require(_0xeb62('0x3'));var config=require('../../../config/environment');config[_0xeb62('0x4')]=_[_0xeb62('0x5')](config[_0xeb62('0x4')],{'host':_0xeb62('0x6'),'port':0x18eb});var io=require(_0xeb62('0x7'))(new Redis(config[_0xeb62('0x4')]));function Agent(_0x5bc3c7){this['id']=_0x5bc3c7['id']||0x0;this[_0xeb62('0x8')]=_0x5bc3c7[_0xeb62('0x8')]||'';this[_0xeb62('0x9')]=_0x5bc3c7['online']||!![];this[_0xeb62('0xa')]=_0x5bc3c7[_0xeb62('0xa')]||![];this[_0xeb62('0xb')]=_0x5bc3c7[_0xeb62('0xb')]||![];this['mailPause']=_0x5bc3c7['mailPause']||![];this[_0xeb62('0xc')]=_0x5bc3c7[_0xeb62('0xc')]||![];this[_0xeb62('0xd')]=_0x5bc3c7[_0xeb62('0xd')]||![];this[_0xeb62('0xe')]=_0x5bc3c7[_0xeb62('0xe')]||![];this[_0xeb62('0xf')]=_0xeb62('0x10');this[_0xeb62('0x11')]=0x0;this[_0xeb62('0x12')]=_0x5bc3c7['chatCapacity']||0x0;this[_0xeb62('0x13')]=0x0;this[_0xeb62('0x14')]=_0xeb62('0x10');this[_0xeb62('0x15')]=0x0;this['mailCapacity']=_0x5bc3c7[_0xeb62('0x16')]||0x0;this[_0xeb62('0x17')]=0x0;this[_0xeb62('0x18')]='unknown';this[_0xeb62('0x19')]=0x0;this[_0xeb62('0x1a')]=_0x5bc3c7[_0xeb62('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xeb62('0x1b')]=_0xeb62('0x10');this[_0xeb62('0x1c')]=0x0;this[_0xeb62('0x1d')]=_0x5bc3c7[_0xeb62('0x1d')]||0x0;this[_0xeb62('0x1e')]=0x0;this[_0xeb62('0x1f')]=_0xeb62('0x10');this[_0xeb62('0x20')]=0x0;this[_0xeb62('0x21')]=_0x5bc3c7[_0xeb62('0x21')]||0x0;this[_0xeb62('0x22')]=0x0;this[_0xeb62('0x23')]='unknown';this[_0xeb62('0x24')]=0x0;this[_0xeb62('0x25')]=_0x5bc3c7[_0xeb62('0x25')]||0x0;this[_0xeb62('0x26')]=0x0;this[_0xeb62('0x27')]=![];this[_0xeb62('0x28')]=undefined;this[_0xeb62('0x2')]='';this['updateRealtime']();}Agent['prototype'][_0xeb62('0x29')]=function(_0x154451){if(this[_0x154451+_0xeb62('0x2a')]>0x0){if(this[_0x154451+_0xeb62('0x2b')]>0x0&&this[_0x154451+_0xeb62('0x2a')]>=this[_0x154451+'Capacity']){return'maxcapacity';}else{return _0xeb62('0x2c');}}else{return _0xeb62('0x2d');}};Agent[_0xeb62('0x2e')][_0xeb62('0x2f')]=function(){var _0x55a169=['mail',_0xeb62('0x30'),'openchannel',_0xeb62('0x31'),'sms',_0xeb62('0x32')];for(var _0x516a72=0x0;_0x516a72<_0x55a169[_0xeb62('0x33')];_0x516a72+=0x1){var _0x6bfbbc=this[_0xeb62('0x29')](_0x55a169[_0x516a72]);if(this[_0x55a169[_0x516a72]+'Status']!==_0x6bfbbc){this[_0x55a169[_0x516a72]+_0xeb62('0x34')]=_[_0xeb62('0x35')](moment()[_0xeb62('0x36')]('x'));}this[_0x55a169[_0x516a72]+_0xeb62('0x37')]=_0x6bfbbc;}var _0x42f486={'id':this['id'],'name':this[_0xeb62('0x8')],'online':this['online'],'voicePause':this[_0xeb62('0xa')],'chatPause':this[_0xeb62('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0xeb62('0xd')],'faxPause':this[_0xeb62('0xc')],'openchannelPause':this[_0xeb62('0xe')],'chatStatus':this[_0xeb62('0xf')],'chatStatusTime':this[_0xeb62('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xeb62('0x14')],'mailStatusTime':this[_0xeb62('0x15')],'mailCapacity':this[_0xeb62('0x16')],'mailCurrentCapacity':this[_0xeb62('0x17')],'faxStatus':this[_0xeb62('0x18')],'faxStatusTime':this[_0xeb62('0x19')],'faxCapacity':this[_0xeb62('0x1a')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xeb62('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xeb62('0x1e')],'whatsappStatus':this[_0xeb62('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xeb62('0x21')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xeb62('0x23')],'openchannelStatusTime':this[_0xeb62('0x24')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xeb62('0x26')],'busy':this[_0xeb62('0x27')],'busyQueue':this['busyQueue']};var _0x1b3a60=md5(JSON[_0xeb62('0x38')](_0x42f486));if(this[_0xeb62('0x2')]!==_0x1b3a60){this[_0xeb62('0x2')]=_0x1b3a60;io['emit'](_0xeb62('0x39'),_0x42f486);}};module[_0xeb62('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 6faf7d1..a504acb 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 _0x6a0c=['chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','length','online','available','paused','stringify','chat:queue:%s','emit'];(function(_0xc7283d,_0x2083c7){var _0x226023=function(_0x43791a){while(--_0x43791a){_0xc7283d['push'](_0xc7283d['shift']());}};_0x226023(++_0x2083c7);}(_0x6a0c,0x1e2));var _0xc6a0=function(_0x44b317,_0x254776){_0x44b317=_0x44b317-0x0;var _0x390892=_0x6a0c[_0x44b317];return _0x390892;};'use strict';var _=require(_0xc6a0('0x0'));var md5=require(_0xc6a0('0x1'));var util=require(_0xc6a0('0x2'));var Redis=require(_0xc6a0('0x3'));var config=require(_0xc6a0('0x4'));config['redis']=_['defaults'](config[_0xc6a0('0x5')],{'host':_0xc6a0('0x6'),'port':0x18eb});var io=require(_0xc6a0('0x7'))(new Redis(config[_0xc6a0('0x5')]));function ChatQueue(_0x33b4d4){this['id']=_0x33b4d4['id']||0x0;this[_0xc6a0('0x8')]=_0x33b4d4[_0xc6a0('0x8')]||'';this[_0xc6a0('0x9')]=_0x33b4d4[_0xc6a0('0x9')]||0xa;this[_0xc6a0('0xa')]=_0x33b4d4['strategy']||_0xc6a0('0xb');this[_0xc6a0('0xc')]=_0x33b4d4[_0xc6a0('0xc')];this['mapAgentsId']={};this[_0xc6a0('0xd')]=0x0;this[_0xc6a0('0x1')]='';this[_0xc6a0('0xe')]();this[_0xc6a0('0xf')]();}ChatQueue[_0xc6a0('0x10')][_0xc6a0('0xe')]=function(){var _0x6d1299=this[_0xc6a0('0x11')]['_rr'];this['mapAgentsId']=_[_0xc6a0('0x12')](this[_0xc6a0('0xc')],'id');this[_0xc6a0('0x11')][_0xc6a0('0x13')]=_0x6d1299;};ChatQueue[_0xc6a0('0x10')][_0xc6a0('0xf')]=function(){this[_0xc6a0('0x14')]=0x0;this['paused']=0x0;for(var _0x3122fe=0x0;_0x3122fe=0x0?this[_0xc6a0('0x17')]:0x0;var _0x3de065={'id':this['id'],'available':this[_0xc6a0('0x17')],'loggedIn':this[_0xc6a0('0x14')],'name':this[_0xc6a0('0x8')],'paused':this['paused'],'waiting':this[_0xc6a0('0xd')]};var _0x1a702d=md5(JSON[_0xc6a0('0x19')](_0x3de065));if(this[_0xc6a0('0x1')]!==_0x1a702d){this[_0xc6a0('0x1')]=_0x1a702d;io['to'](util['format'](_0xc6a0('0x1a'),_0x3de065[_0xc6a0('0x8')]))[_0xc6a0('0x1b')](_0xc6a0('0x1c'),_0x3de065);}};module[_0xc6a0('0x1d')]=ChatQueue; \ No newline at end of file +var _0x51d1=['chatPause','available','stringify','format','chat_queue:save','exports','lodash','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','paused'];(function(_0x53a03e,_0x44260a){var _0x553067=function(_0xa1d45b){while(--_0xa1d45b){_0x53a03e['push'](_0x53a03e['shift']());}};_0x553067(++_0x44260a);}(_0x51d1,0x196));var _0x151d=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x51d1[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0x151d('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x151d('0x1'));config['redis']=_['defaults'](config[_0x151d('0x2')],{'host':_0x151d('0x3'),'port':0x18eb});var io=require(_0x151d('0x4'))(new Redis(config[_0x151d('0x2')]));function ChatQueue(_0x27d5a6){this['id']=_0x27d5a6['id']||0x0;this[_0x151d('0x5')]=_0x27d5a6['name']||'';this[_0x151d('0x6')]=_0x27d5a6['timeout']||0xa;this[_0x151d('0x7')]=_0x27d5a6[_0x151d('0x7')]||_0x151d('0x8');this['Agents']=_0x27d5a6[_0x151d('0x9')];this['mapAgentsId']={};this[_0x151d('0xa')]=0x0;this[_0x151d('0xb')]='';this[_0x151d('0xc')]();this[_0x151d('0xd')]();}ChatQueue[_0x151d('0xe')]['updateRouting']=function(){var _0x4bb431=this[_0x151d('0xf')]['_rr'];this[_0x151d('0xf')]=_[_0x151d('0x10')](this[_0x151d('0x9')],'id');this[_0x151d('0xf')]['_rr']=_0x4bb431;};ChatQueue[_0x151d('0xe')][_0x151d('0xd')]=function(){this[_0x151d('0x11')]=0x0;this[_0x151d('0x12')]=0x0;for(var _0x2b461d=0x0;_0x2b461d=0x0?this['available']:0x0;var _0x45b60a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x151d('0x11')],'name':this[_0x151d('0x5')],'paused':this[_0x151d('0x12')],'waiting':this[_0x151d('0xa')]};var _0x5305b1=md5(JSON[_0x151d('0x15')](_0x45b60a));if(this[_0x151d('0xb')]!==_0x5305b1){this[_0x151d('0xb')]=_0x5305b1;io['to'](util[_0x151d('0x16')]('chat:queue:%s',_0x45b60a['name']))['emit'](_0x151d('0x17'),_0x45b60a);}};module[_0x151d('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e54306f..407acb8 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(_0x5c3568,_0x4a428e){var _0x568605=function(_0x280b52){while(--_0x280b52){_0x5c3568['push'](_0x5c3568['shift']());}};_0x568605(++_0x4a428e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x466cab,_0x4ad2a3){var _0x9d1660=function(_0x186960){while(--_0x186960){_0x466cab['push'](_0x466cab['shift']());}};_0x9d1660(++_0x4ad2a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 a3f1ed2..048cb58 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 _0x4231=['exports','name','Intervals'];(function(_0x1bd822,_0x1c8078){var _0x3c3a69=function(_0x565eb3){while(--_0x565eb3){_0x1bd822['push'](_0x1bd822['shift']());}};_0x3c3a69(++_0x1c8078);}(_0x4231,0x6d));var _0x1423=function(_0x2fe959,_0x351d77){_0x2fe959=_0x2fe959-0x0;var _0x2f6ace=_0x4231[_0x2fe959];return _0x2f6ace;};'use strict';function Interval(_0x15347a){this['id']=_0x15347a['id']||0x0;this['name']=_0x15347a[_0x1423('0x0')]||'';this[_0x1423('0x1')]=_0x15347a[_0x1423('0x1')]||{};}module[_0x1423('0x2')]=Interval; \ No newline at end of file +var _0x564d=['exports','Intervals'];(function(_0x19b545,_0x1cfb48){var _0x1cfff6=function(_0x53597c){while(--_0x53597c){_0x19b545['push'](_0x19b545['shift']());}};_0x1cfff6(++_0x1cfb48);}(_0x564d,0xeb));var _0xd564=function(_0x13ab80,_0x401573){_0x13ab80=_0x13ab80-0x0;var _0x4df7bb=_0x564d[_0x13ab80];return _0x4df7bb;};'use strict';function Interval(_0x4bef83){this['id']=_0x4bef83['id']||0x0;this['name']=_0x4bef83['name']||'';this[_0xd564('0x0')]=_0x4bef83[_0xd564('0x0')]||{};}module[_0xd564('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 4e3bab1..c4eefa2 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 _0x6df4=['stringify','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','mailPause','paused','available','waiting'];(function(_0x20ef83,_0xea60f9){var _0x18c673=function(_0x57653d){while(--_0x57653d){_0x20ef83['push'](_0x20ef83['shift']());}};_0x18c673(++_0xea60f9);}(_0x6df4,0xa6));var _0x46df=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x6df4[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x46df('0x0'));var md5=require(_0x46df('0x1'));var util=require(_0x46df('0x2'));var Redis=require('ioredis');var config=require(_0x46df('0x3'));config['redis']=_['defaults'](config[_0x46df('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x2ac671){this['id']=_0x2ac671['id']||0x0;this[_0x46df('0x5')]=_0x2ac671[_0x46df('0x5')]||'';this[_0x46df('0x6')]=_0x2ac671[_0x46df('0x6')]||0xa;this[_0x46df('0x7')]=_0x2ac671[_0x46df('0x7')]||_0x46df('0x8');this['Agents']=_0x2ac671[_0x46df('0x9')];this[_0x46df('0xa')]={};this['waiting']=0x0;this[_0x46df('0x1')]='';this[_0x46df('0xb')]();this[_0x46df('0xc')]();}MailQueue['prototype']['updateRouting']=function(){var _0x463124=this[_0x46df('0xa')][_0x46df('0xd')];this[_0x46df('0xa')]=_[_0x46df('0xe')](this[_0x46df('0x9')],'id');this['mapAgentsId'][_0x46df('0xd')]=_0x463124;};MailQueue[_0x46df('0xf')][_0x46df('0xc')]=function(){this[_0x46df('0x10')]=0x0;this['paused']=0x0;for(var _0x350f37=0x0;_0x350f37=0x0?this[_0x46df('0x15')]:0x0;var _0x3ceb0f={'id':this['id'],'available':this[_0x46df('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x46df('0x5')],'paused':this['paused'],'waiting':this[_0x46df('0x16')]};var _0x2936f0=md5(JSON[_0x46df('0x17')](_0x3ceb0f));if(this[_0x46df('0x1')]!==_0x2936f0){this[_0x46df('0x1')]=_0x2936f0;io['to'](util['format'](_0x46df('0x18'),_0x3ceb0f[_0x46df('0x5')]))[_0x46df('0x19')](_0x46df('0x1a'),_0x3ceb0f);}};module['exports']=MailQueue; \ No newline at end of file +var _0x3e90=['online','mailPause','available','name','mail:queue:%s','emit','mail_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length'];(function(_0x15a4cb,_0x1ba80d){var _0x25523b=function(_0x1ae06e){while(--_0x1ae06e){_0x15a4cb['push'](_0x15a4cb['shift']());}};_0x25523b(++_0x1ba80d);}(_0x3e90,0xf0));var _0x03e9=function(_0x5307e5,_0x340b0c){_0x5307e5=_0x5307e5-0x0;var _0x563881=_0x3e90[_0x5307e5];return _0x563881;};'use strict';var _=require('lodash');var md5=require(_0x03e9('0x0'));var util=require('util');var Redis=require(_0x03e9('0x1'));var config=require(_0x03e9('0x2'));config[_0x03e9('0x3')]=_[_0x03e9('0x4')](config[_0x03e9('0x3')],{'host':_0x03e9('0x5'),'port':0x18eb});var io=require(_0x03e9('0x6'))(new Redis(config[_0x03e9('0x3')]));function MailQueue(_0x4816db){this['id']=_0x4816db['id']||0x0;this['name']=_0x4816db['name']||'';this[_0x03e9('0x7')]=_0x4816db[_0x03e9('0x7')]||0xa;this['strategy']=_0x4816db[_0x03e9('0x8')]||_0x03e9('0x9');this[_0x03e9('0xa')]=_0x4816db['Agents'];this[_0x03e9('0xb')]={};this[_0x03e9('0xc')]=0x0;this[_0x03e9('0x0')]='';this[_0x03e9('0xd')]();this[_0x03e9('0xe')]();}MailQueue[_0x03e9('0xf')][_0x03e9('0xd')]=function(){var _0x39e61c=this[_0x03e9('0xb')]['_rr'];this[_0x03e9('0xb')]=_[_0x03e9('0x10')](this['Agents'],'id');this[_0x03e9('0xb')][_0x03e9('0x11')]=_0x39e61c;};MailQueue[_0x03e9('0xf')]['updateRealtime']=function(){this[_0x03e9('0x12')]=0x0;this[_0x03e9('0x13')]=0x0;for(var _0x5c6b7b=0x0;_0x5c6b7b=0x0?this[_0x03e9('0x17')]:0x0;var _0x15053a={'id':this['id'],'available':this[_0x03e9('0x17')],'loggedIn':this[_0x03e9('0x12')],'name':this[_0x03e9('0x18')],'paused':this[_0x03e9('0x13')],'waiting':this[_0x03e9('0xc')]};var _0x32f0b0=md5(JSON['stringify'](_0x15053a));if(this[_0x03e9('0x0')]!==_0x32f0b0){this[_0x03e9('0x0')]=_0x32f0b0;io['to'](util['format'](_0x03e9('0x19'),_0x15053a[_0x03e9('0x18')]))[_0x03e9('0x1a')](_0x03e9('0x1b'),_0x15053a);}};module[_0x03e9('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 82b0970..daf7b31 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 _0x25bc=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','prototype','map','mapAgentsId','_rr','loggedIn','paused','length','online','openchannelPause','available','stringify','openchannel:queue:%s','emit','exports','md5','util','ioredis'];(function(_0x39c28c,_0x3b06d0){var _0x57d332=function(_0x2a351d){while(--_0x2a351d){_0x39c28c['push'](_0x39c28c['shift']());}};_0x57d332(++_0x3b06d0);}(_0x25bc,0x185));var _0xc25b=function(_0x30be35,_0x1b6b24){_0x30be35=_0x30be35-0x0;var _0x50d2d8=_0x25bc[_0x30be35];return _0x50d2d8;};'use strict';var _=require('lodash');var md5=require(_0xc25b('0x0'));var util=require(_0xc25b('0x1'));var Redis=require(_0xc25b('0x2'));var config=require(_0xc25b('0x3'));config[_0xc25b('0x4')]=_[_0xc25b('0x5')](config[_0xc25b('0x4')],{'host':_0xc25b('0x6'),'port':0x18eb});var io=require(_0xc25b('0x7'))(new Redis(config[_0xc25b('0x4')]));function OpenchannelQueue(_0x1eb009){this['id']=_0x1eb009['id']||0x0;this['name']=_0x1eb009[_0xc25b('0x8')]||'';this['timeout']=_0x1eb009[_0xc25b('0x9')]||0xa;this['strategy']=_0x1eb009[_0xc25b('0xa')]||'beepall';this[_0xc25b('0xb')]=_0x1eb009['Agents'];this['mapAgentsId']={};this[_0xc25b('0xc')]=0x0;this[_0xc25b('0x0')]='';this[_0xc25b('0xd')]();this['updateRealtime']();}OpenchannelQueue[_0xc25b('0xe')][_0xc25b('0xd')]=function(){var _0x2d5b2d=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xc25b('0xf')](this['Agents'],'id');this[_0xc25b('0x10')][_0xc25b('0x11')]=_0x2d5b2d;};OpenchannelQueue[_0xc25b('0xe')]['updateRealtime']=function(){this[_0xc25b('0x12')]=0x0;this[_0xc25b('0x13')]=0x0;for(var _0x5d6d88=0x0;_0x5d6d88=0x0?this[_0xc25b('0x17')]:0x0;var _0x5d30ec={'id':this['id'],'available':this[_0xc25b('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xc25b('0x8')],'paused':this[_0xc25b('0x13')],'waiting':this[_0xc25b('0xc')]};var _0x45acf1=md5(JSON[_0xc25b('0x18')](_0x5d30ec));if(this[_0xc25b('0x0')]!==_0x45acf1){this['md5']=_0x45acf1;io['to'](util['format'](_0xc25b('0x19'),_0x5d30ec[_0xc25b('0x8')]))[_0xc25b('0x1a')]('openchannel_queue:save',_0x5d30ec);}};module[_0xc25b('0x1b')]=OpenchannelQueue; \ No newline at end of file +var _0x85be=['mapAgentsId','_rr','map','loggedIn','paused','length','openchannelPause','available','stringify','emit','openchannel_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype'];(function(_0x267d29,_0x27f1fe){var _0x4cd7c9=function(_0x4526d4){while(--_0x4526d4){_0x267d29['push'](_0x267d29['shift']());}};_0x4cd7c9(++_0x27f1fe);}(_0x85be,0x1cc));var _0xe85b=function(_0x1153fc,_0x358dec){_0x1153fc=_0x1153fc-0x0;var _0x2348b5=_0x85be[_0x1153fc];return _0x2348b5;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xe85b('0x0'));var Redis=require(_0xe85b('0x1'));var config=require(_0xe85b('0x2'));config[_0xe85b('0x3')]=_[_0xe85b('0x4')](config['redis'],{'host':_0xe85b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe85b('0x3')]));function OpenchannelQueue(_0x3c1e22){this['id']=_0x3c1e22['id']||0x0;this[_0xe85b('0x6')]=_0x3c1e22['name']||'';this['timeout']=_0x3c1e22[_0xe85b('0x7')]||0xa;this[_0xe85b('0x8')]=_0x3c1e22['strategy']||_0xe85b('0x9');this[_0xe85b('0xa')]=_0x3c1e22[_0xe85b('0xa')];this['mapAgentsId']={};this[_0xe85b('0xb')]=0x0;this[_0xe85b('0xc')]='';this[_0xe85b('0xd')]();this[_0xe85b('0xe')]();}OpenchannelQueue[_0xe85b('0xf')]['updateRouting']=function(){var _0x5d5827=this[_0xe85b('0x10')][_0xe85b('0x11')];this[_0xe85b('0x10')]=_[_0xe85b('0x12')](this[_0xe85b('0xa')],'id');this[_0xe85b('0x10')][_0xe85b('0x11')]=_0x5d5827;};OpenchannelQueue[_0xe85b('0xf')]['updateRealtime']=function(){this[_0xe85b('0x13')]=0x0;this[_0xe85b('0x14')]=0x0;for(var _0x3a56cb=0x0;_0x3a56cb=0x0?this[_0xe85b('0x17')]:0x0;var _0x1ded1f={'id':this['id'],'available':this[_0xe85b('0x17')],'loggedIn':this[_0xe85b('0x13')],'name':this[_0xe85b('0x6')],'paused':this[_0xe85b('0x14')],'waiting':this[_0xe85b('0xb')]};var _0x560bc3=md5(JSON[_0xe85b('0x18')](_0x1ded1f));if(this[_0xe85b('0xc')]!==_0x560bc3){this['md5']=_0x560bc3;io['to'](util['format']('openchannel:queue:%s',_0x1ded1f[_0xe85b('0x6')]))[_0xe85b('0x19')](_0xe85b('0x1a'),_0x1ded1f);}};module[_0xe85b('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 7b5d3ee..ae2f0cc 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x1b8318,_0x4984fc){var _0x400698=function(_0x3dba1d){while(--_0x3dba1d){_0x1b8318['push'](_0x1b8318['shift']());}};_0x400698(++_0x4984fc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x3d0366,_0x50211a){var _0x5ce75e=function(_0xc70777){while(--_0xc70777){_0x3d0366['push'](_0x3d0366['shift']());}};_0x5ce75e(++_0x50211a);}(_0x757a,0xde));var _0xa757=function(_0x54ca7b,_0x5165df){_0x54ca7b=_0x54ca7b-0x0;var _0x3c27cc=_0x757a[_0x54ca7b];return _0x3c27cc;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};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 fbbbed2..c23cad4 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 _0xae24=['emit','whatsapp_queue:save','exports','util','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','whatsappPause','paused','available','stringify','md5','format','whatsapp:queue:%s'];(function(_0x352c6e,_0x2d7a58){var _0x78b56c=function(_0x2228e0){while(--_0x2228e0){_0x352c6e['push'](_0x352c6e['shift']());}};_0x78b56c(++_0x2d7a58);}(_0xae24,0x12c));var _0x4ae2=function(_0x7d4827,_0x14c2e4){_0x7d4827=_0x7d4827-0x0;var _0x45fc9e=_0xae24[_0x7d4827];return _0x45fc9e;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x4ae2('0x0'));var Redis=require('ioredis');var config=require(_0x4ae2('0x1'));config[_0x4ae2('0x2')]=_['defaults'](config[_0x4ae2('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4ae2('0x2')]));function WhatsappQueue(_0x473558){this['id']=_0x473558['id']||0x0;this[_0x4ae2('0x3')]=_0x473558[_0x4ae2('0x3')]||'';this[_0x4ae2('0x4')]=_0x473558[_0x4ae2('0x4')]||0xa;this[_0x4ae2('0x5')]=_0x473558[_0x4ae2('0x5')]||_0x4ae2('0x6');this[_0x4ae2('0x7')]=_0x473558['Agents'];this[_0x4ae2('0x8')]={};this[_0x4ae2('0x9')]=0x0;this['md5']='';this[_0x4ae2('0xa')]();this[_0x4ae2('0xb')]();}WhatsappQueue[_0x4ae2('0xc')]['updateRouting']=function(){var _0x429ba3=this[_0x4ae2('0x8')]['_rr'];this[_0x4ae2('0x8')]=_[_0x4ae2('0xd')](this['Agents'],'id');this[_0x4ae2('0x8')][_0x4ae2('0xe')]=_0x429ba3;};WhatsappQueue['prototype'][_0x4ae2('0xb')]=function(){this[_0x4ae2('0xf')]=0x0;this['paused']=0x0;for(var _0x2d2d21=0x0;_0x2d2d21=0x0?this['available']:0x0;var _0x43cc44={'id':this['id'],'available':this[_0x4ae2('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x4ae2('0x3')],'paused':this[_0x4ae2('0x12')],'waiting':this[_0x4ae2('0x9')]};var _0x22b073=md5(JSON[_0x4ae2('0x14')](_0x43cc44));if(this['md5']!==_0x22b073){this[_0x4ae2('0x15')]=_0x22b073;io['to'](util[_0x4ae2('0x16')](_0x4ae2('0x17'),_0x43cc44[_0x4ae2('0x3')]))[_0x4ae2('0x18')](_0x4ae2('0x19'),_0x43cc44);}};module[_0x4ae2('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x8e05=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','format','exports','md5','util','ioredis','redis','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x38377d,_0x239472){var _0x386ec5=function(_0xaf8a2a){while(--_0xaf8a2a){_0x38377d['push'](_0x38377d['shift']());}};_0x386ec5(++_0x239472);}(_0x8e05,0xa6));var _0x58e0=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0x8e05[_0x4a9beb];return _0x2d4c58;};'use strict';var _=require('lodash');var md5=require(_0x58e0('0x0'));var util=require(_0x58e0('0x1'));var Redis=require(_0x58e0('0x2'));var config=require('../../../config/environment');config[_0x58e0('0x3')]=_['defaults'](config[_0x58e0('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x58e0('0x4'))(new Redis(config[_0x58e0('0x3')]));function WhatsappQueue(_0x5568a5){this['id']=_0x5568a5['id']||0x0;this[_0x58e0('0x5')]=_0x5568a5['name']||'';this[_0x58e0('0x6')]=_0x5568a5[_0x58e0('0x6')]||0xa;this[_0x58e0('0x7')]=_0x5568a5[_0x58e0('0x7')]||'beepall';this[_0x58e0('0x8')]=_0x5568a5[_0x58e0('0x8')];this[_0x58e0('0x9')]={};this[_0x58e0('0xa')]=0x0;this[_0x58e0('0x0')]='';this[_0x58e0('0xb')]();this[_0x58e0('0xc')]();}WhatsappQueue[_0x58e0('0xd')][_0x58e0('0xb')]=function(){var _0x322322=this[_0x58e0('0x9')]['_rr'];this[_0x58e0('0x9')]=_[_0x58e0('0xe')](this[_0x58e0('0x8')],'id');this['mapAgentsId'][_0x58e0('0xf')]=_0x322322;};WhatsappQueue[_0x58e0('0xd')]['updateRealtime']=function(){this[_0x58e0('0x10')]=0x0;this[_0x58e0('0x11')]=0x0;for(var _0x250228=0x0;_0x250228=0x0?this[_0x58e0('0x15')]:0x0;var _0x5d5b3b={'id':this['id'],'available':this[_0x58e0('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x58e0('0xa')]};var _0x13c97e=md5(JSON[_0x58e0('0x16')](_0x5d5b3b));if(this[_0x58e0('0x0')]!==_0x13c97e){this[_0x58e0('0x0')]=_0x13c97e;io['to'](util[_0x58e0('0x17')]('whatsapp:queue:%s',_0x5d5b3b[_0x58e0('0x5')]))['emit']('whatsapp_queue:save',_0x5d5b3b);}};module[_0x58e0('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 0d1846d..15a2dcf 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7217,0x19e));var _0x7721=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x7217[_0x3c2a69];return _0x596bc8;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x7fbe=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','lodash','moment'];(function(_0x2bdd67,_0x2ca1a0){var _0x3cd3fe=function(_0x3c5805){while(--_0x3c5805){_0x2bdd67['push'](_0x2bdd67['shift']());}};_0x3cd3fe(++_0x2ca1a0);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x27097a,_0x1b7f8b){_0x27097a=_0x27097a-0x0;var _0x26378b=_0x7fbe[_0x27097a];return _0x26378b;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe7fb('0x0'));var moment=require(_0xe7fb('0x1'));var Agent=require(_0xe7fb('0x2'));var Interval=require(_0xe7fb('0x3'));var OpenchannelQueue=require(_0xe7fb('0x4'));var ChatQueue=require(_0xe7fb('0x5'));var SmsQueue=require(_0xe7fb('0x6'));var MailQueue=require(_0xe7fb('0x7'));var FaxQueue=require(_0xe7fb('0x8'));var WhatsappQueue=require(_0xe7fb('0x9'));var Realtime=function(){this[_0xe7fb('0xa')]={};this[_0xe7fb('0xb')]={};this[_0xe7fb('0xc')]={};this[_0xe7fb('0xd')]={};this['smsQueues']={};this[_0xe7fb('0xe')]={};this[_0xe7fb('0xf')]={};this[_0xe7fb('0x10')]={};this[_0xe7fb('0x11')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xe7fb('0x12')]={};this[_0xe7fb('0x13')]={};this[_0xe7fb('0x14')]={};};function freeIsNotKey(_0x348a73,_0x2a2223,_0x42435c){var _0x3e934b=_[_0xe7fb('0x15')](_0x348a73,function(_0x325035,_0x2fe8ab){return _0x325035[_0x42435c];});for(var _0x2437d4 in _0x2a2223){if(_0x2a2223[_0xe7fb('0x16')](_0x2437d4)){if(!_0x3e934b[_0x2437d4]){delete _0x2a2223[_0x2437d4];}}}}Realtime[_0xe7fb('0x17')][_0xe7fb('0x18')]=function(_0x7fe4d3,_0x598729){for(var _0x278b75 in _0x598729){if(_0x7fe4d3[_0xe7fb('0x16')](_0x278b75)){_0x7fe4d3[_0x278b75]=_0x598729[_0x278b75];}}};Realtime['prototype'][_0xe7fb('0x19')]=function(){var _0x37eb9f=this;return function(_0x482f7d){if(_0x482f7d){freeIsNotKey(_0x482f7d,_0x37eb9f[_0xe7fb('0xa')],'id');for(var _0x559129=0x0,_0x12fff6={},_0x18d23c={};_0x559129<_0x482f7d[_0xe7fb('0x1a')];_0x559129+=0x1){_0x12fff6=_0x482f7d[_0x559129];if(_[_0xe7fb('0x1b')](_0x37eb9f['agents'][_0x12fff6['id']])){_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']]=new Agent(_0x12fff6);}else{_0x37eb9f['mergeFromDatabase'](_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']],_0x12fff6);}}}return _0x37eb9f['agents'];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1c')]=function(){var _0x3f96a7=this;return function(_0x182269){if(_0x182269){freeIsNotKey(_0x182269,_0x3f96a7['intervals'],'id');for(var _0x44466e=0x0,_0x5d1c87={},_0x11cae0={};_0x44466e<_0x182269['length'];_0x44466e+=0x1){_0x5d1c87=_0x182269[_0x44466e];if(_[_0xe7fb('0x1b')](_0x3f96a7['intervals'][_0x5d1c87['id']])){_0x3f96a7[_0xe7fb('0xb')][_0x5d1c87['id']]=new Interval(_0x5d1c87);}else{_0x3f96a7[_0xe7fb('0x18')](_0x3f96a7['intervals'][_0x5d1c87['id']],_0x5d1c87);}}}return _0x3f96a7[_0xe7fb('0xb')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1d')]=function(){var _0x4dcb4b=this;return function(_0x469d50){if(_0x469d50){freeIsNotKey(_0x469d50,_0x4dcb4b[_0xe7fb('0xc')],'id');for(var _0x5da3d9=0x0,_0x5bea27={},_0x52f08b={};_0x5da3d9<_0x469d50[_0xe7fb('0x1a')];_0x5da3d9+=0x1){_0x5bea27=_0x469d50[_0x5da3d9];if(_['isUndefined'](_0x4dcb4b['openchannelQueues'][_0x5bea27['id']])){_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']]=new OpenchannelQueue(_0x5bea27);}else{_0x4dcb4b[_0xe7fb('0x18')](_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']],_0x5bea27);}_0x4dcb4b['openchannelQueues'][_0x5bea27['id']][_0xe7fb('0x1e')]();_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']][_0xe7fb('0x1f')]();}}return _0x4dcb4b[_0xe7fb('0xc')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x20')]=function(){var _0x380130=this;return function(_0x59e015){if(_0x59e015){freeIsNotKey(_0x59e015,_0x380130['chatQueues'],'id');for(var _0x1086e6=0x0,_0x3bdee9={},_0xead63={};_0x1086e6<_0x59e015['length'];_0x1086e6+=0x1){_0x3bdee9=_0x59e015[_0x1086e6];if(_[_0xe7fb('0x1b')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']])){_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]=new ChatQueue(_0x3bdee9);}else{_0x380130[_0xe7fb('0x18')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']],_0x3bdee9);}_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']][_0xe7fb('0x1e')]();_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]['updateRealtime']();}}return _0x380130[_0xe7fb('0xd')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x21')]=function(){var _0x547a04=this;return function(_0x517d70){if(_0x517d70){freeIsNotKey(_0x517d70,_0x547a04[_0xe7fb('0x22')],'id');for(var _0x4a9fea=0x0,_0xac56b4={},_0x2f8774={};_0x4a9fea<_0x517d70[_0xe7fb('0x1a')];_0x4a9fea+=0x1){_0xac56b4=_0x517d70[_0x4a9fea];if(_[_0xe7fb('0x1b')](_0x547a04['smsQueues'][_0xac56b4['id']])){_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']]=new SmsQueue(_0xac56b4);}else{_0x547a04[_0xe7fb('0x18')](_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']],_0xac56b4);}_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']][_0xe7fb('0x1e')]();_0x547a04['smsQueues'][_0xac56b4['id']][_0xe7fb('0x1f')]();}}return _0x547a04[_0xe7fb('0x22')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x23')]=function(){var _0x46f430=this;return function(_0x25e925){if(_0x25e925){freeIsNotKey(_0x25e925,_0x46f430[_0xe7fb('0xe')],'id');for(var _0x147eb1=0x0,_0x389903={},_0x59f9df={};_0x147eb1<_0x25e925[_0xe7fb('0x1a')];_0x147eb1+=0x1){_0x389903=_0x25e925[_0x147eb1];if(_[_0xe7fb('0x1b')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']])){_0x46f430['mailQueues'][_0x389903['id']]=new MailQueue(_0x389903);}else{_0x46f430[_0xe7fb('0x18')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']],_0x389903);}_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1e')]();_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1f')]();}}return _0x46f430[_0xe7fb('0xe')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x24')]=function(){var _0xebfe1d=this;return function(_0x29c34a){if(_0x29c34a){freeIsNotKey(_0x29c34a,_0xebfe1d[_0xe7fb('0xf')],'id');for(var _0x1544f2=0x0,_0x1c81fe={},_0xeb7c29={};_0x1544f2<_0x29c34a[_0xe7fb('0x1a')];_0x1544f2+=0x1){_0x1c81fe=_0x29c34a[_0x1544f2];if(_[_0xe7fb('0x1b')](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']])){_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]=new FaxQueue(_0x1c81fe);}else{_0xebfe1d['mergeFromDatabase'](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']],_0x1c81fe);}_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']][_0xe7fb('0x1e')]();_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]['updateRealtime']();}}return _0xebfe1d[_0xe7fb('0xf')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x25')]=function(){var _0x413a13=this;return function(_0x49fe9d){if(_0x49fe9d){freeIsNotKey(_0x49fe9d,_0x413a13[_0xe7fb('0x10')],'id');for(var _0x451a6c=0x0,_0x34265f={},_0x62a8a1={};_0x451a6c<_0x49fe9d[_0xe7fb('0x1a')];_0x451a6c+=0x1){_0x34265f=_0x49fe9d[_0x451a6c];if(_[_0xe7fb('0x1b')](_0x413a13['whatsappQueues'][_0x34265f['id']])){_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]=new WhatsappQueue(_0x34265f);}else{_0x413a13[_0xe7fb('0x18')](_0x413a13[_0xe7fb('0x10')][_0x34265f['id']],_0x34265f);}_0x413a13['whatsappQueues'][_0x34265f['id']][_0xe7fb('0x1e')]();_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]['updateRealtime']();}}return _0x413a13['whatsappQueues'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 1c3ccfa..736d2e6 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 _0xf261=['updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2730d7,_0x1d5313){var _0x404e58=function(_0x6818f8){while(--_0x6818f8){_0x2730d7['push'](_0x2730d7['shift']());}};_0x404e58(++_0x1d5313);}(_0xf261,0x191));var _0x1f26=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf261[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x1f26('0x0'));exports['update']=function(_0x51384b,_0x58e481){return client['Request']('UpdateChatInteraction',{'body':_0x58e481,'options':{'where':{'id':_0x51384b}},'log':_0x1f26('0x1')});};exports[_0x1f26('0x2')]=function(_0x2d7d75,_0x312a27){return client[_0x1f26('0x3')](_0x1f26('0x4'),{'body':_0x312a27,'options':{'where':{'id':_0x2d7d75}},'log':_0x1f26('0x5')});}; \ No newline at end of file +var _0x71bf=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x2e917a,_0x552ffb){var _0x4b41d5=function(_0x78aa19){while(--_0x78aa19){_0x2e917a['push'](_0x2e917a['shift']());}};_0x4b41d5(++_0x552ffb);}(_0x71bf,0x16d));var _0xf71b=function(_0x26cd05,_0x1f7d74){_0x26cd05=_0x26cd05-0x0;var _0x3e13b9=_0x71bf[_0x26cd05];return _0x3e13b9;};'use strict';var client=require('../client');exports[_0xf71b('0x0')]=function(_0x41bef7,_0x3266d9){return client[_0xf71b('0x1')](_0xf71b('0x2'),{'body':_0x3266d9,'options':{'where':{'id':_0x41bef7}},'log':_0xf71b('0x3')});};exports[_0xf71b('0x4')]=function(_0x29376c,_0x4cd367){return client['Request']('AddTagsToChatInteraction',{'body':_0x4cd367,'options':{'where':{'id':_0x29376c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b2521ec..2121411 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 _0x6abc=['CreateChatMessage','../client','create'];(function(_0x22fbb5,_0x27bfeb){var _0x2cb1e9=function(_0x4625ad){while(--_0x4625ad){_0x22fbb5['push'](_0x22fbb5['shift']());}};_0x2cb1e9(++_0x27bfeb);}(_0x6abc,0x187));var _0xc6ab=function(_0x2671b0,_0x590fac){_0x2671b0=_0x2671b0-0x0;var _0x35624a=_0x6abc[_0x2671b0];return _0x35624a;};'use strict';var client=require(_0xc6ab('0x0'));exports[_0xc6ab('0x1')]=function(_0x576f8c){return client['Request'](_0xc6ab('0x2'),{'body':_0x576f8c,'log':'createChatMessage'});}; \ No newline at end of file +var _0x5f84=['../client','create','createChatMessage'];(function(_0x51d71a,_0x596fda){var _0xff01f1=function(_0x30480f){while(--_0x30480f){_0x51d71a['push'](_0x51d71a['shift']());}};_0xff01f1(++_0x596fda);}(_0x5f84,0xd8));var _0x45f8=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5f84[_0x46698a];return _0x356db0;};'use strict';var client=require(_0x45f8('0x0'));exports[_0x45f8('0x1')]=function(_0x4404aa){return client['Request']('CreateChatMessage',{'body':_0x4404aa,'log':_0x45f8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a25f36b..7a9e219 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 _0xc439=['Request','GetChatQueue','name','strategy','User','online','chatPause','getChatQueues'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0xc439,0x127));var _0x9c43=function(_0xcd76c6,_0x17a0bc){_0xcd76c6=_0xcd76c6-0x0;var _0x191baf=_0xc439[_0xcd76c6];return _0x191baf;};'use strict';var client=require('../client');exports[_0x9c43('0x0')]=function(){return function(){return client[_0x9c43('0x1')](_0x9c43('0x2'),{'options':{'raw':![],'attributes':['id',_0x9c43('0x3'),'timeout',_0x9c43('0x4')],'include':[{'model':_0x9c43('0x5'),'as':'Agents','attributes':['id','name',_0x9c43('0x6'),_0x9c43('0x7')]}]},'log':_0x9c43('0x0')});};}; \ No newline at end of file +var _0xd03a=['strategy','User','Agents','name','online','chatPause','../client','getChatQueues','Request','GetChatQueue','timeout'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd03a,0x1ea));var _0xad03=function(_0x5e56b3,_0x3f92f2){_0x5e56b3=_0x5e56b3-0x0;var _0x27d2db=_0xd03a[_0x5e56b3];return _0x27d2db;};'use strict';var client=require(_0xad03('0x0'));exports[_0xad03('0x1')]=function(){return function(){return client[_0xad03('0x2')](_0xad03('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xad03('0x4'),_0xad03('0x5')],'include':[{'model':_0xad03('0x6'),'as':_0xad03('0x7'),'attributes':['id',_0xad03('0x8'),_0xad03('0x9'),_0xad03('0xa')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0362baa..bffa73b 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 _0x9589=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x1ca750,_0x3e812e){var _0x30a6fa=function(_0x4e3ebd){while(--_0x4e3ebd){_0x1ca750['push'](_0x1ca750['shift']());}};_0x30a6fa(++_0x3e812e);}(_0x9589,0xbc));var _0x9958=function(_0x515316,_0x527431){_0x515316=_0x515316-0x0;var _0x2e640d=_0x9589[_0x515316];return _0x2e640d;};'use strict';var client=require(_0x9958('0x0'));exports[_0x9958('0x1')]=function(_0x220175){return client[_0x9958('0x2')](_0x9958('0x3'),{'body':_0x220175,'log':'CreateChatQueueReport'});};exports[_0x9958('0x4')]=function(_0x153116,_0xe7c0e){return client['Request'](_0x9958('0x5'),{'body':_0xe7c0e,'options':{'where':{'uniqueid':_0x153116},'order':[['id',_0x9958('0x6')]],'limit':0x1},'log':_0x9958('0x5')});}; \ No newline at end of file +var _0xae53=['UpdateChatQueueReport','../client','Request','CreateChatQueueReport','update'];(function(_0xe22169,_0x53b4a0){var _0x2716a1=function(_0x56c094){while(--_0x56c094){_0xe22169['push'](_0xe22169['shift']());}};_0x2716a1(++_0x53b4a0);}(_0xae53,0x16e));var _0x3ae5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xae53[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x3ae5('0x0'));exports['create']=function(_0x1afe71){return client[_0x3ae5('0x1')](_0x3ae5('0x2'),{'body':_0x1afe71,'log':'CreateChatQueueReport'});};exports[_0x3ae5('0x3')]=function(_0x2d4c0b,_0x293589){return client[_0x3ae5('0x1')](_0x3ae5('0x4'),{'body':_0x293589,'options':{'where':{'uniqueid':_0x2d4c0b},'order':[['id','DESC']],'limit':0x1},'log':_0x3ae5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 4ee1d5e..ce43f9d 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 _0x9c31=['../client','update','Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9c31,0x103));var _0x19c3=function(_0x2fe896,_0x2ee12b){_0x2fe896=_0x2fe896-0x0;var _0x2f98a0=_0x9c31[_0x2fe896];return _0x2f98a0;};'use strict';var client=require(_0x19c3('0x0'));exports[_0x19c3('0x1')]=function(_0xade4a6,_0x3cd8c6){return client[_0x19c3('0x2')](_0x19c3('0x3'),{'body':_0x3cd8c6,'options':{'where':{'id':_0xade4a6}},'log':'updateFaxInteraction'});};exports[_0x19c3('0x4')]=function(_0x1f6258,_0x202cfa){return client[_0x19c3('0x2')](_0x19c3('0x5'),{'body':_0x202cfa,'options':{'where':{'id':_0x1f6258}},'log':_0x19c3('0x6')});}; \ No newline at end of file +var _0xc3ea=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction'];(function(_0x33e55a,_0x3d5690){var _0x542283=function(_0x4eba1d){while(--_0x4eba1d){_0x33e55a['push'](_0x33e55a['shift']());}};_0x542283(++_0x3d5690);}(_0xc3ea,0x8f));var _0xac3e=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0xc3ea[_0x204eb7];return _0x37e444;};'use strict';var client=require(_0xac3e('0x0'));exports[_0xac3e('0x1')]=function(_0x16ac4d,_0x5903d2){return client[_0xac3e('0x2')](_0xac3e('0x3'),{'body':_0x5903d2,'options':{'where':{'id':_0x16ac4d}},'log':_0xac3e('0x4')});};exports[_0xac3e('0x5')]=function(_0x50eadb,_0x37567d){return client[_0xac3e('0x2')](_0xac3e('0x6'),{'body':_0x37567d,'options':{'where':{'id':_0x50eadb}},'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 eef4449..09c3ad8 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 _0x7619=['CreateFaxMessage','createFaxMessage'];(function(_0x5057dc,_0x34ec48){var _0x26c08e=function(_0x2065ad){while(--_0x2065ad){_0x5057dc['push'](_0x5057dc['shift']());}};_0x26c08e(++_0x34ec48);}(_0x7619,0xc0));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x580b30){return client['Request'](_0x9761('0x0'),{'body':_0x580b30,'log':_0x9761('0x1')});}; \ No newline at end of file +var _0xdb3f=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x24dac7,_0x2ffbaa){var _0x32c81f=function(_0x5e6475){while(--_0x5e6475){_0x24dac7['push'](_0x24dac7['shift']());}};_0x32c81f(++_0x2ffbaa);}(_0xdb3f,0xcd));var _0xfdb3=function(_0x2e6252,_0x418a7d){_0x2e6252=_0x2e6252-0x0;var _0x100e3e=_0xdb3f[_0x2e6252];return _0x100e3e;};'use strict';var client=require(_0xfdb3('0x0'));exports[_0xfdb3('0x1')]=function(_0xf4f3f0){return client['Request'](_0xfdb3('0x2'),{'body':_0xf4f3f0,'log':_0xfdb3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f19c509..8edc384 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 _0xf9f5=['strategy','User','Agents','faxPause','../client','getFaxQueues','name'];(function(_0x25b068,_0xb6ac60){var _0xb9f40f=function(_0x28880b){while(--_0x28880b){_0x25b068['push'](_0x25b068['shift']());}};_0xb9f40f(++_0xb6ac60);}(_0xf9f5,0x13f));var _0x5f9f=function(_0x295023,_0x39df63){_0x295023=_0x295023-0x0;var _0x4dfd12=_0xf9f5[_0x295023];return _0x4dfd12;};'use strict';var client=require(_0x5f9f('0x0'));exports[_0x5f9f('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x5f9f('0x2'),'timeout',_0x5f9f('0x3')],'include':[{'model':_0x5f9f('0x4'),'as':_0x5f9f('0x5'),'attributes':['id',_0x5f9f('0x2'),'online',_0x5f9f('0x6')]}]},'log':_0x5f9f('0x1')});};}; \ No newline at end of file +var _0xc92f=['strategy','name','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout'];(function(_0x3e7254,_0x180fc6){var _0x4afe4b=function(_0x7412a4){while(--_0x7412a4){_0x3e7254['push'](_0x3e7254['shift']());}};_0x4afe4b(++_0x180fc6);}(_0xc92f,0x1e3));var _0xfc92=function(_0x1a9d9f,_0x164b01){_0x1a9d9f=_0x1a9d9f-0x0;var _0x43eb59=_0xc92f[_0x1a9d9f];return _0x43eb59;};'use strict';var client=require(_0xfc92('0x0'));exports[_0xfc92('0x1')]=function(){return function(){return client[_0xfc92('0x2')](_0xfc92('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xfc92('0x4'),_0xfc92('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xfc92('0x6'),'online',_0xfc92('0x7')]}]},'log':_0xfc92('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index f129d79..c582e1c 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 _0x97e5=['DESC','../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x223ca0,_0x1b5a4a){var _0x5558f3=function(_0x27bbe5){while(--_0x27bbe5){_0x223ca0['push'](_0x223ca0['shift']());}};_0x5558f3(++_0x1b5a4a);}(_0x97e5,0xcd));var _0x597e=function(_0x11e638,_0x553398){_0x11e638=_0x11e638-0x0;var _0x2be393=_0x97e5[_0x11e638];return _0x2be393;};'use strict';var client=require(_0x597e('0x0'));exports['create']=function(_0x199928){return client[_0x597e('0x1')](_0x597e('0x2'),{'body':_0x199928,'log':'CreateFaxQueueReport'});};exports[_0x597e('0x3')]=function(_0x123df8,_0x1f3b43){return client[_0x597e('0x1')](_0x597e('0x4'),{'body':_0x1f3b43,'options':{'where':{'uniqueid':_0x123df8},'order':[['id',_0x597e('0x5')]],'limit':0x1},'log':_0x597e('0x4')});}; \ No newline at end of file +var _0x9f14=['Request','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x1faf7a,_0x3bc094){var _0x409677=function(_0x30652d){while(--_0x30652d){_0x1faf7a['push'](_0x1faf7a['shift']());}};_0x409677(++_0x3bc094);}(_0x9f14,0x185));var _0x49f1=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9f14[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0x49f1('0x0'));exports['create']=function(_0x29b516){return client[_0x49f1('0x1')]('CreateFaxQueueReport',{'body':_0x29b516,'log':'CreateFaxQueueReport'});};exports[_0x49f1('0x2')]=function(_0xc78c47,_0x2486d2){return client[_0x49f1('0x1')](_0x49f1('0x3'),{'body':_0x2486d2,'options':{'where':{'uniqueid':_0xc78c47},'order':[['id',_0x49f1('0x4')]],'limit':0x1},'log':_0x49f1('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index f0536a0..48ee530 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 _0x1399=['../client','getIntervals','GetInterval','Interval','Intervals','name','interval'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x1399,0x16c));var _0x9139=function(_0x2f71c1,_0x319017){_0x2f71c1=_0x2f71c1-0x0;var _0x411bb7=_0x1399[_0x2f71c1];return _0x411bb7;};'use strict';var client=require(_0x9139('0x0'));exports[_0x9139('0x1')]=function(){return function(){return client['Request'](_0x9139('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x9139('0x3'),'as':_0x9139('0x4'),'attributes':['id',_0x9139('0x5'),_0x9139('0x6')]}]},'log':_0x9139('0x1')});};}; \ No newline at end of file +var _0xd824=['Intervals','interval','../client','getIntervals','name','Interval'];(function(_0x1c4baa,_0x322e0e){var _0x37ba01=function(_0x557aa2){while(--_0x557aa2){_0x1c4baa['push'](_0x1c4baa['shift']());}};_0x37ba01(++_0x322e0e);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x4d82('0x0'));exports[_0x4d82('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4d82('0x2')],'include':[{'model':_0x4d82('0x3'),'as':_0x4d82('0x4'),'attributes':['id',_0x4d82('0x2'),_0x4d82('0x5')]}]},'log':_0x4d82('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 2caa03c..bc6fcb2 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 _0x8b23=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0xeb9f69,_0x34d75e){var _0x4a8d87=function(_0x4a5f73){while(--_0x4a5f73){_0xeb9f69['push'](_0xeb9f69['shift']());}};_0x4a8d87(++_0x34d75e);}(_0x8b23,0x191));var _0x38b2=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8b23[_0x29d94e];return _0x106237;};'use strict';var client=require(_0x38b2('0x0'));exports[_0x38b2('0x1')]=function(_0x44a896,_0x164a5e){return client[_0x38b2('0x2')](_0x38b2('0x3'),{'body':_0x164a5e,'options':{'where':{'id':_0x44a896}},'log':_0x38b2('0x4')});};exports[_0x38b2('0x5')]=function(_0x5cf9d6,_0x4a478d){return client[_0x38b2('0x2')](_0x38b2('0x6'),{'body':_0x4a478d,'options':{'where':{'id':_0x5cf9d6}},'log':_0x38b2('0x7')});}; \ No newline at end of file +var _0x2d84=['update','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction'];(function(_0x12afd8,_0x5355c2){var _0xa255c8=function(_0x1d707d){while(--_0x1d707d){_0x12afd8['push'](_0x12afd8['shift']());}};_0xa255c8(++_0x5355c2);}(_0x2d84,0xa0));var _0x42d8=function(_0x188a96,_0x5b1bf2){_0x188a96=_0x188a96-0x0;var _0x4efbfc=_0x2d84[_0x188a96];return _0x4efbfc;};'use strict';var client=require('../client');exports[_0x42d8('0x0')]=function(_0x5e07a6,_0x4061b1){return client['Request'](_0x42d8('0x1'),{'body':_0x4061b1,'options':{'where':{'id':_0x5e07a6}},'log':_0x42d8('0x2')});};exports[_0x42d8('0x3')]=function(_0x47f968,_0x495cd9){return client['Request']('AddTagsToMailInteraction',{'body':_0x495cd9,'options':{'where':{'id':_0x47f968}},'log':_0x42d8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 7bc4972..2c6aa2a 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 _0xd93f=['create','Request','createMailMessage'];(function(_0x45198a,_0x3e79b4){var _0xb858db=function(_0x1fae6f){while(--_0x1fae6f){_0x45198a['push'](_0x45198a['shift']());}};_0xb858db(++_0x3e79b4);}(_0xd93f,0xc9));var _0xfd93=function(_0x27f154,_0x2c11d4){_0x27f154=_0x27f154-0x0;var _0x2b3005=_0xd93f[_0x27f154];return _0x2b3005;};'use strict';var client=require('../client');exports[_0xfd93('0x0')]=function(_0x22f042){return client[_0xfd93('0x1')]('CreateMailMessage',{'body':_0x22f042,'log':_0xfd93('0x2')});}; \ No newline at end of file +var _0xec42=['CreateMailMessage','../client','Request'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0xec42,0x1c0));var _0x2ec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec42[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2ec4('0x0'));exports['create']=function(_0x2717ed){return client[_0x2ec4('0x1')](_0x2ec4('0x2'),{'body':_0x2717ed,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 14ac659..e62c036 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 _0xf780=['GetMailQueue','name','timeout','strategy','Agents','online','../client','getMailQueues','Request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf780,0x192));var _0x0f78=function(_0x23d3e8,_0x37ff6a){_0x23d3e8=_0x23d3e8-0x0;var _0x4365fc=_0xf780[_0x23d3e8];return _0x4365fc;};'use strict';var client=require(_0x0f78('0x0'));exports[_0x0f78('0x1')]=function(){return function(){return client[_0x0f78('0x2')](_0x0f78('0x3'),{'options':{'raw':![],'attributes':['id',_0x0f78('0x4'),_0x0f78('0x5'),_0x0f78('0x6')],'include':[{'model':'User','as':_0x0f78('0x7'),'attributes':['id','name',_0x0f78('0x8'),'mailPause']}]},'log':_0x0f78('0x1')});};}; \ No newline at end of file +var _0x2adf=['strategy','User','Agents','mailPause','../client','getMailQueues','GetMailQueue','name','timeout'];(function(_0x1e16b1,_0x957ca1){var _0x565bbc=function(_0x1c9485){while(--_0x1c9485){_0x1e16b1['push'](_0x1e16b1['shift']());}};_0x565bbc(++_0x957ca1);}(_0x2adf,0x1e1));var _0xf2ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2adf[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf2ad('0x0'));exports[_0xf2ad('0x1')]=function(){return function(){return client['Request'](_0xf2ad('0x2'),{'options':{'raw':![],'attributes':['id',_0xf2ad('0x3'),_0xf2ad('0x4'),_0xf2ad('0x5')],'include':[{'model':_0xf2ad('0x6'),'as':_0xf2ad('0x7'),'attributes':['id','name','online',_0xf2ad('0x8')]}]},'log':_0xf2ad('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 66655e4..b517859 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 _0x4f3b=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport','update'];(function(_0xb44291,_0x40eddd){var _0x580bad=function(_0x20aa05){while(--_0x20aa05){_0xb44291['push'](_0xb44291['shift']());}};_0x580bad(++_0x40eddd);}(_0x4f3b,0x183));var _0xb4f3=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x4f3b[_0x458363];return _0x4d0290;};'use strict';var client=require(_0xb4f3('0x0'));exports[_0xb4f3('0x1')]=function(_0x33d7e8){return client[_0xb4f3('0x2')](_0xb4f3('0x3'),{'body':_0x33d7e8,'log':_0xb4f3('0x3')});};exports[_0xb4f3('0x4')]=function(_0x398287,_0x13ad71){return client['Request'](_0xb4f3('0x5'),{'body':_0x13ad71,'options':{'where':{'uniqueid':_0x398287},'order':[['id',_0xb4f3('0x6')]],'limit':0x1},'log':_0xb4f3('0x5')});}; \ No newline at end of file +var _0x14fa=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x14fa,0xb4));var _0xa14f=function(_0x1e02a7,_0x4d8558){_0x1e02a7=_0x1e02a7-0x0;var _0x5db9f6=_0x14fa[_0x1e02a7];return _0x5db9f6;};'use strict';var client=require(_0xa14f('0x0'));exports[_0xa14f('0x1')]=function(_0x7c5234){return client[_0xa14f('0x2')](_0xa14f('0x3'),{'body':_0x7c5234,'log':_0xa14f('0x3')});};exports[_0xa14f('0x4')]=function(_0x538ffd,_0x1e11aa){return client[_0xa14f('0x2')](_0xa14f('0x5'),{'body':_0x1e11aa,'options':{'where':{'uniqueid':_0x538ffd},'order':[['id',_0xa14f('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index dab71d8..61ad72c 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 _0x5592=['addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','updateOpenchannelInteraction'];(function(_0x5de963,_0x340318){var _0x3867de=function(_0xe0b8ea){while(--_0xe0b8ea){_0x5de963['push'](_0x5de963['shift']());}};_0x3867de(++_0x340318);}(_0x5592,0x1c0));var _0x2559=function(_0x426028,_0x4a44df){_0x426028=_0x426028-0x0;var _0x523cc7=_0x5592[_0x426028];return _0x523cc7;};'use strict';var client=require(_0x2559('0x0'));exports['update']=function(_0x55d5d3,_0xe684cd){return client['Request']('UpdateOpenchannelInteraction',{'body':_0xe684cd,'options':{'where':{'id':_0x55d5d3}},'log':_0x2559('0x1')});};exports[_0x2559('0x2')]=function(_0x91935c,_0x229e9d){return client[_0x2559('0x3')](_0x2559('0x4'),{'body':_0x229e9d,'options':{'where':{'id':_0x91935c}},'log':_0x2559('0x5')});}; \ No newline at end of file +var _0x2084=['addTagsToChatInteraction','../client','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x2084,0xd3));var _0x4208=function(_0x1f0fca,_0x34fafd){_0x1f0fca=_0x1f0fca-0x0;var _0x1d315b=_0x2084[_0x1f0fca];return _0x1d315b;};'use strict';var client=require(_0x4208('0x0'));exports['update']=function(_0x3303a5,_0x48e6c6){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x48e6c6,'options':{'where':{'id':_0x3303a5}},'log':'updateOpenchannelInteraction'});};exports[_0x4208('0x1')]=function(_0x2650f0,_0x4afce9){return client[_0x4208('0x2')](_0x4208('0x3'),{'body':_0x4afce9,'options':{'where':{'id':_0x2650f0}},'log':_0x4208('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 8f18e80..e0d185d 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x4fc5df,_0x3acaab){var _0x4a18f5=function(_0x241409){while(--_0x241409){_0x4fc5df['push'](_0x4fc5df['shift']());}};_0x4a18f5(++_0x3acaab);}(_0x70e0,0x17b));var _0x070e=function(_0x4bb45b,_0x1ca204){_0x4bb45b=_0x4bb45b-0x0;var _0x5d5f03=_0x70e0[_0x4bb45b];return _0x5d5f03;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateOpenchannelMessage',{'body':_0x198c2e,'log':_0x070e('0x2')});}; \ No newline at end of file +var _0xaa88=['create','Request','createOpenchannelMessage','../client'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xaa88,0x137));var _0x8aa8=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xaa88[_0x3207aa];return _0x51758f;};'use strict';var client=require(_0x8aa8('0x0'));exports[_0x8aa8('0x1')]=function(_0x1643a6){return client[_0x8aa8('0x2')]('CreateOpenchannelMessage',{'body':_0x1643a6,'log':_0x8aa8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 9e6b068..de19537 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 _0xf534=['GetOpenchannelQueue','name','timeout','User','Agents','online','getOpenchannelQueues'];(function(_0x44fef1,_0x132cf4){var _0x3c3a04=function(_0x175a90){while(--_0x175a90){_0x44fef1['push'](_0x44fef1['shift']());}};_0x3c3a04(++_0x132cf4);}(_0xf534,0x134));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x4f53('0x0'),{'options':{'raw':![],'attributes':['id',_0x4f53('0x1'),_0x4f53('0x2'),'strategy'],'include':[{'model':_0x4f53('0x3'),'as':_0x4f53('0x4'),'attributes':['id',_0x4f53('0x1'),_0x4f53('0x5'),'openchannelPause']}]},'log':_0x4f53('0x6')});};}; \ No newline at end of file +var _0x8162=['name','online','openchannelPause','../client','getOpenchannelQueues','Request','timeout','strategy','User','Agents'];(function(_0x12ff37,_0x17c717){var _0x10b851=function(_0x2d3243){while(--_0x2d3243){_0x12ff37['push'](_0x12ff37['shift']());}};_0x10b851(++_0x17c717);}(_0x8162,0x193));var _0x2816=function(_0x2c99c6,_0x383aa1){_0x2c99c6=_0x2c99c6-0x0;var _0x132b5e=_0x8162[_0x2c99c6];return _0x132b5e;};'use strict';var client=require(_0x2816('0x0'));exports[_0x2816('0x1')]=function(){return function(){return client[_0x2816('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x2816('0x3'),_0x2816('0x4')],'include':[{'model':_0x2816('0x5'),'as':_0x2816('0x6'),'attributes':['id',_0x2816('0x7'),_0x2816('0x8'),_0x2816('0x9')]}]},'log':_0x2816('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 2adae50..93853c0 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 _0x1a0f=['CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','Request'];(function(_0x4baaa2,_0x3a100a){var _0x5cfc61=function(_0x184610){while(--_0x184610){_0x4baaa2['push'](_0x4baaa2['shift']());}};_0x5cfc61(++_0x3a100a);}(_0x1a0f,0x12b));var _0xf1a0=function(_0x40b981,_0x48b308){_0x40b981=_0x40b981-0x0;var _0x58696b=_0x1a0f[_0x40b981];return _0x58696b;};'use strict';var client=require('../client');exports['create']=function(_0x269fb8){return client[_0xf1a0('0x0')]('CreateOpenchannelQueueReport',{'body':_0x269fb8,'log':_0xf1a0('0x1')});};exports[_0xf1a0('0x2')]=function(_0x2b77ca,_0xd89f6){return client[_0xf1a0('0x0')]('UpdateOpenchannelQueueReport',{'body':_0xd89f6,'options':{'where':{'uniqueid':_0x2b77ca},'order':[['id',_0xf1a0('0x3')]],'limit':0x1},'log':_0xf1a0('0x4')});}; \ No newline at end of file +var _0x33a3=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x33a3,0xa6));var _0x333a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x33a3[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x333a('0x0'));exports[_0x333a('0x1')]=function(_0x48559d){return client[_0x333a('0x2')](_0x333a('0x3'),{'body':_0x48559d,'log':_0x333a('0x3')});};exports[_0x333a('0x4')]=function(_0x488dda,_0x54b407){return client['Request'](_0x333a('0x5'),{'body':_0x54b407,'options':{'where':{'uniqueid':_0x488dda},'order':[['id',_0x333a('0x6')]],'limit':0x1},'log':_0x333a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 2c8cace..1602cb4 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 _0x9155=['AddTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x9db041,_0x25821e){var _0x28c133=function(_0x3fdd89){while(--_0x3fdd89){_0x9db041['push'](_0x9db041['shift']());}};_0x28c133(++_0x25821e);}(_0x9155,0x1ab));var _0x5915=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x9155[_0x5e9876];return _0x576c48;};'use strict';var client=require('../client');exports[_0x5915('0x0')]=function(_0x36cf38,_0x133db5){return client[_0x5915('0x1')](_0x5915('0x2'),{'body':_0x133db5,'options':{'where':{'id':_0x36cf38}},'log':_0x5915('0x3')});};exports[_0x5915('0x4')]=function(_0x1ba2e2,_0x1f47c5){return client['Request'](_0x5915('0x5'),{'body':_0x1f47c5,'options':{'where':{'id':_0x1ba2e2}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xacea=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x4b6c5d,_0x3cbbdf){var _0x4e4d47=function(_0x311028){while(--_0x311028){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x4e4d47(++_0x3cbbdf);}(_0xacea,0x1d2));var _0xaace=function(_0x555564,_0x2f2ed2){_0x555564=_0x555564-0x0;var _0x438e7d=_0xacea[_0x555564];return _0x438e7d;};'use strict';var client=require(_0xaace('0x0'));exports[_0xaace('0x1')]=function(_0x192719,_0x53318b){return client[_0xaace('0x2')](_0xaace('0x3'),{'body':_0x53318b,'options':{'where':{'id':_0x192719}},'log':'updateSmsInteraction'});};exports[_0xaace('0x4')]=function(_0x5bbad5,_0x3917a6){return client[_0xaace('0x2')](_0xaace('0x5'),{'body':_0x3917a6,'options':{'where':{'id':_0x5bbad5}},'log':_0xaace('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 70d3d21..a10c67e 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 _0xd46f=['createSmsMessage','create','Request'];(function(_0x1cb4bc,_0x46e6e3){var _0x947248=function(_0x199e5a){while(--_0x199e5a){_0x1cb4bc['push'](_0x1cb4bc['shift']());}};_0x947248(++_0x46e6e3);}(_0xd46f,0x1d5));var _0xfd46=function(_0x4570d2,_0x5a0cf2){_0x4570d2=_0x4570d2-0x0;var _0x4f9299=_0xd46f[_0x4570d2];return _0x4f9299;};'use strict';var client=require('../client');exports[_0xfd46('0x0')]=function(_0x3793a5){return client[_0xfd46('0x1')]('CreateSmsMessage',{'body':_0x3793a5,'log':_0xfd46('0x2')});}; \ No newline at end of file +var _0x2bdb=['../client','CreateSmsMessage','createSmsMessage'];(function(_0x3c30c7,_0x3b3991){var _0x37beff=function(_0xae977c){while(--_0xae977c){_0x3c30c7['push'](_0x3c30c7['shift']());}};_0x37beff(++_0x3b3991);}(_0x2bdb,0x105));var _0xb2bd=function(_0x925aa5,_0x56c95b){_0x925aa5=_0x925aa5-0x0;var _0x2ac879=_0x2bdb[_0x925aa5];return _0x2ac879;};'use strict';var client=require(_0xb2bd('0x0'));exports['create']=function(_0x156a93){return client['Request'](_0xb2bd('0x1'),{'body':_0x156a93,'log':_0xb2bd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 30e11bc..38dc15f 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 _0x9c94=['online','../client','getSmsQueues','GetSmsQueue','timeout','strategy','Agents','name'];(function(_0x44249a,_0x24a4e6){var _0x2d7250=function(_0x383a09){while(--_0x383a09){_0x44249a['push'](_0x44249a['shift']());}};_0x2d7250(++_0x24a4e6);}(_0x9c94,0x99));var _0x49c9=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x9c94[_0x24f31b];return _0x488401;};'use strict';var client=require(_0x49c9('0x0'));exports[_0x49c9('0x1')]=function(){return function(){return client['Request'](_0x49c9('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x49c9('0x3'),_0x49c9('0x4')],'include':[{'model':'User','as':_0x49c9('0x5'),'attributes':['id',_0x49c9('0x6'),_0x49c9('0x7'),'smsPause']}]},'log':_0x49c9('0x1')});};}; \ No newline at end of file +var _0x9a05=['online','../client','getSmsQueues','GetSmsQueue','name','timeout','strategy','User','Agents'];(function(_0xb7d6f1,_0x48c8a4){var _0x183dfd=function(_0x4206a3){while(--_0x4206a3){_0xb7d6f1['push'](_0xb7d6f1['shift']());}};_0x183dfd(++_0x48c8a4);}(_0x9a05,0x14e));var _0x59a0=function(_0x35747b,_0x3459c8){_0x35747b=_0x35747b-0x0;var _0x23fc88=_0x9a05[_0x35747b];return _0x23fc88;};'use strict';var client=require(_0x59a0('0x0'));exports[_0x59a0('0x1')]=function(){return function(){return client['Request'](_0x59a0('0x2'),{'options':{'raw':![],'attributes':['id',_0x59a0('0x3'),_0x59a0('0x4'),_0x59a0('0x5')],'include':[{'model':_0x59a0('0x6'),'as':_0x59a0('0x7'),'attributes':['id','name',_0x59a0('0x8'),'smsPause']}]},'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 369d7c2..e0dea6a 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 _0x9231=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','create','Request'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x9231,0x66));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1923('0x0'));exports[_0x1923('0x1')]=function(_0xc2d3af){return client[_0x1923('0x2')]('CreateSmsQueueReport',{'body':_0xc2d3af,'log':_0x1923('0x3')});};exports[_0x1923('0x4')]=function(_0x1b040e,_0x46fbd1){return client[_0x1923('0x2')](_0x1923('0x5'),{'body':_0x46fbd1,'options':{'where':{'uniqueid':_0x1b040e},'order':[['id',_0x1923('0x6')]],'limit':0x1},'log':_0x1923('0x5')});}; \ No newline at end of file +var _0x3c1a=['DESC','../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x4903de,_0x2623b8){var _0x439a9c=function(_0x2debd8){while(--_0x2debd8){_0x4903de['push'](_0x4903de['shift']());}};_0x439a9c(++_0x2623b8);}(_0x3c1a,0xda));var _0xa3c1=function(_0x45ee03,_0x2f5319){_0x45ee03=_0x45ee03-0x0;var _0x13d535=_0x3c1a[_0x45ee03];return _0x13d535;};'use strict';var client=require(_0xa3c1('0x0'));exports[_0xa3c1('0x1')]=function(_0x238f91){return client[_0xa3c1('0x2')](_0xa3c1('0x3'),{'body':_0x238f91,'log':_0xa3c1('0x3')});};exports[_0xa3c1('0x4')]=function(_0x53a47c,_0x3db9f5){return client['Request'](_0xa3c1('0x5'),{'body':_0x3db9f5,'options':{'where':{'uniqueid':_0x53a47c},'order':[['id',_0xa3c1('0x6')]],'limit':0x1},'log':_0xa3c1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 82ec207..6b65b0b 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 _0x3150=['getAgents','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCapacity'];(function(_0x3cc2ae,_0x21941a){var _0x5dcfdf=function(_0x2d4c47){while(--_0x2d4c47){_0x3cc2ae['push'](_0x3cc2ae['shift']());}};_0x5dcfdf(++_0x21941a);}(_0x3150,0x1a0));var _0x0315=function(_0x9d2bdc,_0x4f2b6a){_0x9d2bdc=_0x9d2bdc-0x0;var _0x410615=_0x3150[_0x9d2bdc];return _0x410615;};'use strict';var client=require('../client');exports[_0x0315('0x0')]=function(){return function(){return client['Request'](_0x0315('0x1'),{'options':{'raw':!![],'where':{'role':_0x0315('0x2')},'attributes':['id',_0x0315('0x3'),'online',_0x0315('0x4'),_0x0315('0x5'),_0x0315('0x6'),_0x0315('0x7'),'mailPause','faxPause',_0x0315('0x8'),_0x0315('0x9'),_0x0315('0xa'),_0x0315('0xb'),_0x0315('0xc'),'faxCapacity',_0x0315('0xd'),_0x0315('0xe'),_0x0315('0xf')]},'log':_0x0315('0x0')});};}; \ No newline at end of file +var _0x2449=['mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','openchannelCapacity','../client','getAgents','Request','agent','name','online','pauseType','voicePause','chatPause'];(function(_0x58d716,_0x2834e2){var _0x2fd85f=function(_0x1c1468){while(--_0x1c1468){_0x58d716['push'](_0x58d716['shift']());}};_0x2fd85f(++_0x2834e2);}(_0x2449,0x16d));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x9244('0x0'));exports[_0x9244('0x1')]=function(){return function(){return client[_0x9244('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x9244('0x3')},'attributes':['id',_0x9244('0x4'),_0x9244('0x5'),_0x9244('0x6'),'lastPauseAt',_0x9244('0x7'),_0x9244('0x8'),_0x9244('0x9'),'faxPause',_0x9244('0xa'),_0x9244('0xb'),_0x9244('0xc'),_0x9244('0xd'),_0x9244('0xe'),_0x9244('0xf'),'smsCapacity','whatsappCapacity',_0x9244('0x10')]},'log':_0x9244('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 7c73969..e72f98f 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 _0x3036=['updateWhatsappInteraction','addTagsToWhatsappInteraction','Request'];(function(_0x15ffcc,_0x9859df){var _0x63c91c=function(_0x20dba7){while(--_0x20dba7){_0x15ffcc['push'](_0x15ffcc['shift']());}};_0x63c91c(++_0x9859df);}(_0x3036,0x1a9));var _0x6303=function(_0x3181fe,_0x10e2f3){_0x3181fe=_0x3181fe-0x0;var _0xf3cba4=_0x3036[_0x3181fe];return _0xf3cba4;};'use strict';var client=require('../client');exports['update']=function(_0x7aa5f9,_0xd38168){return client[_0x6303('0x0')]('UpdateWhatsappInteraction',{'body':_0xd38168,'options':{'where':{'id':_0x7aa5f9}},'log':_0x6303('0x1')});};exports['addTags']=function(_0x48aa0c,_0x4d040b){return client[_0x6303('0x0')]('AddTagsToWhatsappInteraction',{'body':_0x4d040b,'options':{'where':{'id':_0x48aa0c}},'log':_0x6303('0x2')});}; \ No newline at end of file +var _0xa0bc=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0xe4fe17,_0x12ad94){var _0x52ffe1=function(_0x2faba4){while(--_0x2faba4){_0xe4fe17['push'](_0xe4fe17['shift']());}};_0x52ffe1(++_0x12ad94);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xca0b('0x0')]=function(_0x19838b,_0x544ad3){return client[_0xca0b('0x1')](_0xca0b('0x2'),{'body':_0x544ad3,'options':{'where':{'id':_0x19838b}},'log':_0xca0b('0x3')});};exports[_0xca0b('0x4')]=function(_0x2f7b56,_0x3a53b4){return client[_0xca0b('0x1')](_0xca0b('0x5'),{'body':_0x3a53b4,'options':{'where':{'id':_0x2f7b56}},'log':_0xca0b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 4d6116a..28c5ebb 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 _0x17f3=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x17f3,0x16b));var _0x317f=function(_0x317858,_0x2794e7){_0x317858=_0x317858-0x0;var _0x435ac6=_0x17f3[_0x317858];return _0x435ac6;};'use strict';var client=require(_0x317f('0x0'));exports[_0x317f('0x1')]=function(_0x479fb7){return client[_0x317f('0x2')](_0x317f('0x3'),{'body':_0x479fb7,'log':_0x317f('0x4')});}; \ No newline at end of file +var _0xac70=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x5dbb01,_0x37a32d){var _0x321c2b=function(_0x348231){while(--_0x348231){_0x5dbb01['push'](_0x5dbb01['shift']());}};_0x321c2b(++_0x37a32d);}(_0xac70,0x165));var _0x0ac7=function(_0x270f18,_0x8155e9){_0x270f18=_0x270f18-0x0;var _0x39d745=_0xac70[_0x270f18];return _0x39d745;};'use strict';var client=require(_0x0ac7('0x0'));exports[_0x0ac7('0x1')]=function(_0x20c2f6){return client['Request'](_0x0ac7('0x2'),{'body':_0x20c2f6,'log':_0x0ac7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 5f6e67b..29fa6fa 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 _0x02a7=['Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','getWhatsappQueues'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x02a7,0x1a6));var _0x702a=function(_0x1a302e,_0x55a2f8){_0x1a302e=_0x1a302e-0x0;var _0xeb198e=_0x02a7[_0x1a302e];return _0xeb198e;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'attributes':['id',_0x702a('0x3'),_0x702a('0x4'),_0x702a('0x5')],'include':[{'model':_0x702a('0x6'),'as':_0x702a('0x7'),'attributes':['id',_0x702a('0x3'),_0x702a('0x8'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x3423=['whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online'];(function(_0x330efd,_0xd97da2){var _0x26a09c=function(_0xa41e0f){while(--_0xa41e0f){_0x330efd['push'](_0x330efd['shift']());}};_0x26a09c(++_0xd97da2);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x3342('0x0')](_0x3342('0x1'),{'options':{'raw':![],'attributes':['id',_0x3342('0x2'),_0x3342('0x3'),_0x3342('0x4')],'include':[{'model':_0x3342('0x5'),'as':_0x3342('0x6'),'attributes':['id',_0x3342('0x2'),_0x3342('0x7'),_0x3342('0x8')]}]},'log':_0x3342('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 79bb63c..cd7fca9 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 _0x6931=['CreateWhatsappQueueReport','update','../client','create','Request'];(function(_0x114087,_0x51dfb0){var _0x2dd44e=function(_0xf57823){while(--_0xf57823){_0x114087['push'](_0x114087['shift']());}};_0x2dd44e(++_0x51dfb0);}(_0x6931,0x18d));var _0x1693=function(_0x180ca4,_0x5ed2aa){_0x180ca4=_0x180ca4-0x0;var _0x390ba1=_0x6931[_0x180ca4];return _0x390ba1;};'use strict';var client=require(_0x1693('0x0'));exports[_0x1693('0x1')]=function(_0x5ea302){return client[_0x1693('0x2')](_0x1693('0x3'),{'body':_0x5ea302,'log':'CreateWhatsappQueueReport'});};exports[_0x1693('0x4')]=function(_0x11fcf5,_0xb1d1d4){return client[_0x1693('0x2')]('UpdateWhatsappQueueReport',{'body':_0xb1d1d4,'options':{'where':{'uniqueid':_0x11fcf5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xf014=['Request','UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport','update'];(function(_0x39cb96,_0x5dbaa9){var _0x3170d5=function(_0x3993f3){while(--_0x3993f3){_0x39cb96['push'](_0x39cb96['shift']());}};_0x3170d5(++_0x5dbaa9);}(_0xf014,0xb2));var _0x4f01=function(_0x33d4a2,_0x2baaf4){_0x33d4a2=_0x33d4a2-0x0;var _0x2c793f=_0xf014[_0x33d4a2];return _0x2c793f;};'use strict';var client=require(_0x4f01('0x0'));exports[_0x4f01('0x1')]=function(_0x5e9b5b){return client['Request'](_0x4f01('0x2'),{'body':_0x5e9b5b,'log':_0x4f01('0x2')});};exports[_0x4f01('0x3')]=function(_0x46d87b,_0x42b55b){return client[_0x4f01('0x4')](_0x4f01('0x5'),{'body':_0x42b55b,'options':{'where':{'uniqueid':_0x46d87b},'order':[['id',_0x4f01('0x6')]],'limit':0x1},'log':_0x4f01('0x5')});}; \ 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 cd79acf..c765c47 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 _0x6139=['stack','util','seq-queue','../../../../config/logger','./strategy','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','stop','find','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','log','[%s][QUEUE]\x20%s'];(function(_0x59af24,_0x201f0e){var _0x5d79d4=function(_0x4cc3a4){while(--_0x4cc3a4){_0x59af24['push'](_0x59af24['shift']());}};_0x5d79d4(++_0x201f0e);}(_0x6139,0x18d));var _0x9613=function(_0x4fd0e1,_0x402971){_0x4fd0e1=_0x4fd0e1-0x0;var _0x536d96=_0x6139[_0x4fd0e1];return _0x536d96;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x9613('0x0'));var seqqueue=require(_0x9613('0x1'));var logger=require(_0x9613('0x2'))('routing');var strategy=require(_0x9613('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9613('0x4'),'message':_0x9613('0x5')}});function writeLog(_0x3dc423,_0x2a88f9,_0x2585c5){return logger[_0x9613('0x6')](util[_0x9613('0x7')](_0x9613('0x8'),_0x3dc423,_0x2a88f9[_0x9613('0x9')],_0x2585c5));}function handleFindAgent(_0x39b238){return function(_0x1127f2){return _0x1127f2[_0x9613('0x9')][_0x9613('0xa')]()===_0x39b238[_0x9613('0xa')]();};}exports[_0x9613('0xb')]=function(_0x12e415,_0x4157fc,_0x3b0cd9,_0x2e3703){return function(_0x52fbfe){try{var _0x55b288={'name':_0x4157fc[0x0],'timeout':_0x4157fc[0x1]};var _0xe1ae09=queue[_0x9613('0xc')](_0x55b288,{'typecast':!![]});if(_0xe1ae09[_0x9613('0xd')]){logger[_0x9613('0xe')](_0x9613('0xf'),_0x12e415,_['map'](_0xe1ae09,_0x9613('0x10'))['join'](',\x20'));_0x52fbfe[_0x9613('0x11')]();}else{var _0x138add=_[_0x9613('0x12')](_0x3b0cd9['agents'],handleFindAgent(_0x55b288['name']));if(_0x138add){var _0x40ac25=(_0x55b288['timeout']||0xa)*0x3e8;var _0x47b0cf,_0x56330a;var _0x4cd2b0=seqqueue[_0x9613('0x13')](_0x40ac25);_0x4cd2b0['id']=_0x12e415;_0x4cd2b0[_0x9613('0x14')]=_0x40ac25;_0x4cd2b0['channel']=_0x2e3703[_0x9613('0x15')];writeLog(_0x12e415,_0x138add,util[_0x9613('0x7')](_0x9613('0x16'),_0x40ac25));_0x3b0cd9[_0x9613('0x17')][_0x12e415]['on'](_0x9613('0x18'),function(){logger[_0x9613('0x6')](_0x9613('0x19'),_0x12e415);clearTimeout(_0x56330a);_0x56330a=undefined;_0x4cd2b0[_0x9613('0x1a')]();if(_0x3b0cd9['rules'][_0x12e415]){delete _0x3b0cd9[_0x9613('0x17')][_0x12e415];}_0x52fbfe[_0x9613('0x11')]();});_0x3b0cd9[_0x9613('0x17')][_0x12e415]['on'](_0x9613('0x1b'),function(){if(_0x3b0cd9[_0x9613('0x17')][_0x12e415]){delete _0x3b0cd9[_0x9613('0x17')][_0x12e415];}});_0x56330a=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x12e415);clearTimeout(_0x56330a);_0x4cd2b0['close']();_0x52fbfe[_0x9613('0x1c')]();},_0x40ac25);strategy[_0x9613('0x1d')](_0x4cd2b0,_0x138add,_0x3b0cd9,_0x2e3703);}else{logger[_0x9613('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x12e415,_0x55b288[_0x9613('0x9')]);_0x52fbfe[_0x9613('0x11')]();}}}catch(_0x11835a){console[_0x9613('0x1e')](_0x11835a);logger['error'](_0x9613('0x1f'),_0x12e415,_0x11835a[_0x9613('0x20')]);_0x52fbfe[_0x9613('0x11')]();}};}; \ No newline at end of file +var _0xf23f=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','message','join','find','timeout','atimeout','channel','info','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','stop','complete','close','next','agent'];(function(_0xf3d297,_0x3b8952){var _0x296e32=function(_0x31b92a){while(--_0x31b92a){_0xf3d297['push'](_0xf3d297['shift']());}};_0x296e32(++_0x3b8952);}(_0xf23f,0x14e));var _0xff23=function(_0x2cb1bd,_0x42b64c){_0x2cb1bd=_0x2cb1bd-0x0;var _0x393fdf=_0xf23f[_0x2cb1bd];return _0x393fdf;};'use strict';var schema=require(_0xff23('0x0'));var _=require(_0xff23('0x1'));var util=require('util');var seqqueue=require(_0xff23('0x2'));var logger=require(_0xff23('0x3'))(_0xff23('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xff23('0x5')},'timeout':{'type':_0xff23('0x6'),'message':_0xff23('0x7')}});function writeLog(_0x3dd290,_0x54c66b,_0x249ba3){return logger['info'](util[_0xff23('0x8')](_0xff23('0x9'),_0x3dd290,_0x54c66b[_0xff23('0xa')],_0x249ba3));}function handleFindAgent(_0x1564ad){return function(_0x35d3c1){return _0x35d3c1['name'][_0xff23('0xb')]()===_0x1564ad[_0xff23('0xb')]();};}exports['consequence']=function(_0x254172,_0x35651c,_0x2b6713,_0x236fb8){return function(_0x334f86){try{var _0xb11eec={'name':_0x35651c[0x0],'timeout':_0x35651c[0x1]};var _0x366284=queue[_0xff23('0x0')](_0xb11eec,{'typecast':!![]});if(_0x366284[_0xff23('0xc')]){logger[_0xff23('0xd')](_0xff23('0xe'),_0x254172,_['map'](_0x366284,_0xff23('0xf'))[_0xff23('0x10')](',\x20'));_0x334f86['stop']();}else{var _0x5e321b=_[_0xff23('0x11')](_0x2b6713['agents'],handleFindAgent(_0xb11eec[_0xff23('0xa')]));if(_0x5e321b){var _0x454901=(_0xb11eec[_0xff23('0x12')]||0xa)*0x3e8;var _0x5c0426,_0x3650c5;var _0x4e5141=seqqueue['createQueue'](_0x454901);_0x4e5141['id']=_0x254172;_0x4e5141[_0xff23('0x13')]=_0x454901;_0x4e5141[_0xff23('0x14')]=_0x236fb8[_0xff23('0x14')];writeLog(_0x254172,_0x5e321b,util['format']('START:%s',_0x454901));_0x2b6713['rules'][_0x254172]['on']('end',function(){logger[_0xff23('0x15')](_0xff23('0x16'),_0x254172);clearTimeout(_0x3650c5);_0x3650c5=undefined;_0x4e5141['close']();if(_0x2b6713[_0xff23('0x17')][_0x254172]){delete _0x2b6713[_0xff23('0x17')][_0x254172];}_0x334f86[_0xff23('0x18')]();});_0x2b6713[_0xff23('0x17')][_0x254172]['on'](_0xff23('0x19'),function(){if(_0x2b6713['rules'][_0x254172]){delete _0x2b6713[_0xff23('0x17')][_0x254172];}});_0x3650c5=setTimeout(function(){logger[_0xff23('0x15')]('[%s][AGENT]\x20ROUTING\x20END',_0x254172);clearTimeout(_0x3650c5);_0x4e5141[_0xff23('0x1a')]();_0x334f86[_0xff23('0x1b')]();},_0x454901);strategy[_0xff23('0x1c')](_0x4e5141,_0x5e321b,_0x2b6713,_0x236fb8);}else{logger[_0xff23('0xd')](_0xff23('0x1d'),_0x254172,_0xb11eec[_0xff23('0xa')]);_0x334f86[_0xff23('0x18')]();}}}catch(_0x1c5c73){console[_0xff23('0x1e')](_0x1c5c73);logger[_0xff23('0xd')](_0xff23('0x1f'),_0x254172,_0x1c5c73[_0xff23('0x20')]);_0x334f86[_0xff23('0x18')]();}};}; \ 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 b04f3eb..36de7f9 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 _0x326f=['toString','postText','dialogState','Failed','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','ChatWebsiteId','upperFirst','AccountId','InteractionId','getMustacheRender','Message','create','then','info','[%s][AMAZONLEX]\x20%s','body','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message'];(function(_0x2b4e01,_0x6301b4){var _0x4e8ee7=function(_0x408547){while(--_0x408547){_0x2b4e01['push'](_0x2b4e01['shift']());}};_0x4e8ee7(++_0x6301b4);}(_0x326f,0xd1));var _0xf326=function(_0x5186e1,_0x573206){_0x5186e1=_0x5186e1-0x0;var _0x4a48a4=_0x326f[_0x5186e1];return _0x4a48a4;};'use strict';var _=require(_0xf326('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xf326('0x1'));var logger=require(_0xf326('0x2'))(_0xf326('0x3'));var rpc={'chatMessage':require(_0xf326('0x4')),'openchannelMessage':require(_0xf326('0x5')),'mailMessage':require(_0xf326('0x6')),'smsMessage':require(_0xf326('0x7')),'faxMessage':require(_0xf326('0x8')),'whatsappMessage':require(_0xf326('0x9'))};exports[_0xf326('0xa')]=function(_0x4c2249,_0x3c254d){return function(_0x3851eb){try{if(!_[_0xf326('0xb')](this[_0xf326('0xc')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4c2249,_0xf326('0xd'));return _0x3851eb[_0xf326('0xe')]();}var _0x163416={'ContactId':this[_0xf326('0xf')]['id'],'sentAt':moment()[_0xf326('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf326('0x11')};var _0x53cbcd=this[_0xf326('0x12')];if(_0x53cbcd==='chat'){_0x163416[_0xf326('0x13')]=this['account']['id'];}else{_0x163416[_[_0xf326('0x14')](_0x53cbcd)+_0xf326('0x15')]=this['account']['id'];}_0x163416[_[_0xf326('0x14')](_0x53cbcd)+_0xf326('0x16')]=this[_0xf326('0xc')]['id'];if(this[_0xf326('0xc')]['created']){var _0x45c1b6=_0x3c254d[0x4];if(!_['isEmpty'](_0x45c1b6)){_0x163416['body']=utils[_0xf326('0x17')](_0x45c1b6,this);return rpc[_0x53cbcd+_0xf326('0x18')][_0xf326('0x19')](_0x163416)[_0xf326('0x1a')](function(_0x292f4b){logger[_0xf326('0x1b')](_0xf326('0x1c'),_0x4c2249,_0x163416[_0xf326('0x1d')]);})['catch'](function(_0x3ad7da){logger[_0xf326('0x1e')](_0xf326('0x1c'),_0x4c2249,JSON[_0xf326('0x1f')](_0x3ad7da));})[_0xf326('0x20')](function(){logger[_0xf326('0x1b')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4c2249);_0x3851eb['stop']();});}else{logger['info'](_0xf326('0x21'),_0x4c2249);_0x3851eb[_0xf326('0x22')]();}}else{var _0x484cbe=this;var _0x4cabce=new AWS[(_0xf326('0x23'))]({'accessKeyId':_0x3c254d[0x0],'secretAccessKey':_0x3c254d[0x1],'region':_0x3c254d[0x2]});var _0x4dfa76={'botAlias':'$LATEST','botName':_0x3c254d[0x3],'inputText':this[_0xf326('0x24')][_0xf326('0x1d')],'userId':this['channel']+':'+this['interaction']['id'][_0xf326('0x25')]()};_0x4cabce[_0xf326('0x26')](_0x4dfa76,function(_0x5f21a2,_0x337ed5){if(_0x5f21a2){logger[_0xf326('0x1e')](_0xf326('0x1c'),_0x4c2249,_0x5f21a2[_0xf326('0x24')]);_0x3851eb[_0xf326('0xe')]();}else if(_0x337ed5&&_0x337ed5[_0xf326('0x24')]){_0x484cbe['body']['amazonlex']=_0x337ed5;_0x163416['body']=_0x337ed5[_0xf326('0x24')];return rpc[_0x53cbcd+_0xf326('0x18')][_0xf326('0x19')](_0x163416)[_0xf326('0x1a')](function(_0x148953){logger[_0xf326('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x4c2249,_0x163416[_0xf326('0x1d')]);if(_0x337ed5[_0xf326('0x27')]==_0xf326('0x28')){_0x3851eb['next']();}else{_0x3851eb[_0xf326('0x22')]();}})['catch'](function(_0x4a9abf){logger[_0xf326('0x1e')](_0xf326('0x1c'),_0x4c2249,JSON[_0xf326('0x1f')](_0x4a9abf));_0x3851eb['next']();});}else{_0x3851eb[_0xf326('0xe')]();}});}}catch(_0x292500){logger['error'](_0xf326('0x1c'),_0x4c2249,JSON[_0xf326('0x1f')](_0x292500));_0x3851eb[_0xf326('0x22')]();}};}; \ No newline at end of file +var _0x2ef3=['../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','ChatWebsiteId','upperFirst','account','isEmpty','body','getMustacheRender','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','toString','postText','Message','create','then','dialogState','Failed','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x17c00a,_0x12377c){var _0x556332=function(_0x4fa67a){while(--_0x4fa67a){_0x17c00a['push'](_0x17c00a['shift']());}};_0x556332(++_0x12377c);}(_0x2ef3,0xba));var _0x32ef=function(_0x6a9d94,_0x44f79f){_0x6a9d94=_0x6a9d94-0x0;var _0xf4237a=_0x2ef3[_0x6a9d94];return _0xf4237a;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var AWS=require(_0x32ef('0x2'));var utils=require(_0x32ef('0x3'));var logger=require(_0x32ef('0x4'))(_0x32ef('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x32ef('0x6')),'mailMessage':require(_0x32ef('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x32ef('0x8')),'whatsappMessage':require(_0x32ef('0x9'))};exports['consequence']=function(_0x5dfa09,_0x2c0089){return function(_0x4bfcf8){try{if(!_[_0x32ef('0xa')](this[_0x32ef('0xb')][_0x32ef('0xc')])){logger[_0x32ef('0xd')](_0x32ef('0xe'),_0x5dfa09,_0x32ef('0xf'));return _0x4bfcf8[_0x32ef('0x10')]();}var _0x77df79={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x32ef('0x11')),'direction':_0x32ef('0x12')};var _0x45bfd5=this[_0x32ef('0x13')];if(_0x45bfd5==='chat'){_0x77df79[_0x32ef('0x14')]=this['account']['id'];}else{_0x77df79[_[_0x32ef('0x15')](_0x45bfd5)+'AccountId']=this[_0x32ef('0x16')]['id'];}_0x77df79[_[_0x32ef('0x15')](_0x45bfd5)+'InteractionId']=this['interaction']['id'];if(this[_0x32ef('0xb')]['created']){var _0x326fce=_0x2c0089[0x4];if(!_[_0x32ef('0x17')](_0x326fce)){_0x77df79[_0x32ef('0x18')]=utils[_0x32ef('0x19')](_0x326fce,this);return rpc[_0x45bfd5+'Message']['create'](_0x77df79)['then'](function(_0x13db1a){logger[_0x32ef('0xd')](_0x32ef('0xe'),_0x5dfa09,_0x77df79['body']);})['catch'](function(_0x1eb468){logger[_0x32ef('0x1a')](_0x32ef('0xe'),_0x5dfa09,JSON['stringify'](_0x1eb468));})[_0x32ef('0x1b')](function(){logger[_0x32ef('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5dfa09);_0x4bfcf8[_0x32ef('0x1c')]();});}else{logger[_0x32ef('0xd')](_0x32ef('0x1d'),_0x5dfa09);_0x4bfcf8[_0x32ef('0x1c')]();}}else{var _0x445cda=this;var _0x3aec05=new AWS['LexRuntime']({'accessKeyId':_0x2c0089[0x0],'secretAccessKey':_0x2c0089[0x1],'region':_0x2c0089[0x2]});var _0x3c5b78={'botAlias':'$LATEST','botName':_0x2c0089[0x3],'inputText':this[_0x32ef('0x1e')][_0x32ef('0x18')],'userId':this['channel']+':'+this[_0x32ef('0xb')]['id'][_0x32ef('0x1f')]()};_0x3aec05[_0x32ef('0x20')](_0x3c5b78,function(_0x55f7f2,_0x57f5e5){if(_0x55f7f2){logger[_0x32ef('0x1a')](_0x32ef('0xe'),_0x5dfa09,_0x55f7f2[_0x32ef('0x1e')]);_0x4bfcf8['next']();}else if(_0x57f5e5&&_0x57f5e5['message']){_0x445cda[_0x32ef('0x18')]['amazonlex']=_0x57f5e5;_0x77df79['body']=_0x57f5e5[_0x32ef('0x1e')];return rpc[_0x45bfd5+_0x32ef('0x21')][_0x32ef('0x22')](_0x77df79)[_0x32ef('0x23')](function(_0x15ce54){logger[_0x32ef('0xd')](_0x32ef('0xe'),_0x5dfa09,_0x77df79[_0x32ef('0x18')]);if(_0x57f5e5[_0x32ef('0x24')]==_0x32ef('0x25')){_0x4bfcf8[_0x32ef('0x10')]();}else{_0x4bfcf8[_0x32ef('0x1c')]();}})['catch'](function(_0xd65fde){logger[_0x32ef('0x1a')]('[%s][AMAZONLEX]\x20%s',_0x5dfa09,JSON[_0x32ef('0x26')](_0xd65fde));_0x4bfcf8[_0x32ef('0x10')]();});}else{_0x4bfcf8[_0x32ef('0x10')]();}});}}catch(_0x26e207){logger['error'](_0x32ef('0xe'),_0x5dfa09,JSON[_0x32ef('0x26')](_0x26e207));_0x4bfcf8[_0x32ef('0x1c')]();}};}; \ 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 e04f7a8..58b786c 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 _0x18ea=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','created','interaction','info','[%s][AUTOREPLY]\x20%s','next','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','service','Smtp','host','port','authentication','pass','html','','replace','body','';return mailRpc[_0xa18e('0x2e')](_0x5e19d4,_0x2c54d8)[_0xa18e('0x2f')](function(_0xd3dbcb){logger[_0xa18e('0xc')](_0xa18e('0x30'),_0x39f6bc);_0x2c54d8[_0xa18e('0x31')]=_0xd3dbcb[_0xa18e('0x14')]['messageId'];return rpc[_0x467e46+_0xa18e('0x32')][_0xa18e('0x33')](_0x2c54d8);})[_0xa18e('0x2f')](function(_0x4e7684){logger[_0xa18e('0xc')](_0xa18e('0xd'),_0x39f6bc,JSON[_0xa18e('0x34')](_0x4e7684));})['catch'](function(_0x23fc96){logger[_0xa18e('0x35')]('[RPC][%s][AUTOREPLY]\x20%s',_0x39f6bc,JSON['stringify'](_0x23fc96));})[_0xa18e('0x36')](function(){_0x915e6[_0xa18e('0xe')]();});}else{return rpc[this[_0xa18e('0x1c')]+_0xa18e('0x32')][_0xa18e('0x33')](_0x2c54d8)[_0xa18e('0x2f')](function(_0x75b28a){logger[_0xa18e('0xc')](_0xa18e('0xd'),_0x39f6bc,_0x2c54d8['body']);})['catch'](function(_0x5b0184){logger[_0xa18e('0x35')]('[%s][AUTOREPLY]\x20%s',_0x39f6bc,JSON[_0xa18e('0x34')](_0x5b0184));})[_0xa18e('0x36')](function(){_0x915e6['next']();});}}}catch(_0x1b84f8){logger[_0xa18e('0x35')](_0xa18e('0xd'),_0x39f6bc,JSON[_0xa18e('0x34')](_0x1b84f8));_0x915e6[_0xa18e('0x37')]();}};}; \ No newline at end of file +var _0x9e65=['[RPC][%s][AUTOREPLY]\x20%s','next','catch','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','isNil','interaction','created','info','getMustacheRender','contact','format','out','message','from','phone','read','subject','startsWith','Re:','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','html','','body','','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','[%s][AUTOREPLY]\x20%s','stringify','error'];(function(_0x32c25f,_0x4bda8c){var _0x626ab2=function(_0x151ae3){while(--_0x151ae3){_0x32c25f['push'](_0x32c25f['shift']());}};_0x626ab2(++_0x4bda8c);}(_0x9e65,0x1e3));var _0x59e6=function(_0x4279e1,_0x39cda4){_0x4279e1=_0x4279e1-0x0;var _0x1e33ea=_0x9e65[_0x4279e1];return _0x1e33ea;};'use strict';var _=require(_0x59e6('0x0'));var moment=require(_0x59e6('0x1'));var utils=require(_0x59e6('0x2'));var logger=require(_0x59e6('0x3'))('routing');var rpc={'chatMessage':require(_0x59e6('0x4')),'openchannelMessage':require(_0x59e6('0x5')),'mailMessage':require(_0x59e6('0x6')),'smsMessage':require(_0x59e6('0x7')),'faxMessage':require(_0x59e6('0x8')),'whatsappMessage':require(_0x59e6('0x9'))};var mailRpc=require(_0x59e6('0xa'));exports['consequence']=function(_0x59356d,_0x23a7a3){return function(_0x4c5a2c){try{if(_0x23a7a3[0x0]==='1'&&(_[_0x59e6('0xb')](this[_0x59e6('0xc')][_0x59e6('0xd')])||!this[_0x59e6('0xc')][_0x59e6('0xd')])){logger[_0x59e6('0xe')]('[%s][AUTOREPLY]\x20%s',_0x59356d,'Autoreply\x20already\x20sent');return _0x4c5a2c['next']();}var _0x28dd0d=this['channel'];var _0xe468ef={'body':utils[_0x59e6('0xf')](_0x23a7a3[0x1],this),'ContactId':this[_0x59e6('0x10')]['id'],'sentAt':moment()[_0x59e6('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x59e6('0x12')};if(this['message']){_0xe468ef['to']=this[_0x59e6('0x13')][_0x59e6('0x14')]||'';_0xe468ef['cc']=this['message']['cc']||'';_0xe468ef[_0x59e6('0x14')]=this[_0x59e6('0x13')]['to']||'';_0xe468ef['phone']=this[_0x59e6('0x13')][_0x59e6('0x15')]||'';_0xe468ef[_0x59e6('0x16')]=!![];if(this[_0x59e6('0x13')][_0x59e6('0x17')]){_0xe468ef[_0x59e6('0x17')]='';_0xe468ef['subject']+=_[_0x59e6('0x18')](this[_0x59e6('0x13')]['subject'],_0x59e6('0x19'))?'':'Re:\x20';_0xe468ef[_0x59e6('0x17')]+=this[_0x59e6('0x13')][_0x59e6('0x17')];}}if(this[_0x59e6('0x1a')]===_0x59e6('0x1b')){_0xe468ef[_0x59e6('0x1c')]=this[_0x59e6('0x1d')]['id'];}else{_0xe468ef[_['upperFirst'](this['channel'])+'AccountId']=this[_0x59e6('0x1d')]['id'];}_0xe468ef[_[_0x59e6('0x1e')](this[_0x59e6('0x1a')])+_0x59e6('0x1f')]=this[_0x59e6('0xc')]['id'];if(rpc[this[_0x59e6('0x1a')]+_0x59e6('0x20')]){if(this[_0x59e6('0x1a')]===_0x59e6('0x21')){var _0x58c281={'tls':{'rejectUnauthorized':![]}};if(this[_0x59e6('0x1d')][_0x59e6('0x22')]['service']){_0x58c281[_0x59e6('0x23')]=this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x23')];}else{_0x58c281[_0x59e6('0x24')]=this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x24')];_0x58c281[_0x59e6('0x25')]=this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x25')];_0x58c281[_0x59e6('0x26')]=this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x26')];}if(this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x27')]){_0x58c281[_0x59e6('0x28')]={'user':this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x29')],'pass':this[_0x59e6('0x1d')][_0x59e6('0x22')][_0x59e6('0x2a')]};}_0xe468ef[_0x59e6('0x2b')]=this['message']['messageId'];_0xe468ef[_0x59e6('0x2c')]=_0x59e6('0x2d')+_['replace'](_0xe468ef[_0x59e6('0x2e')],_0x59e6('0x2f'),']+(>|$)/g,''),'priorityTrue':_0x3bf2fb[0x1],'priorityFalse':_0x3bf2fb[0x2]};var _0xdebf28=gotoif[_0x0fa0('0x0')](_0x59cadf,{'typecast':!![]});if(_0xdebf28[_0x0fa0('0xb')]){logger[_0x0fa0('0xc')](_0x0fa0('0xd'),_0x3a4d97,_[_0x0fa0('0xe')](_0xdebf28,_0x0fa0('0xf'))[_0x0fa0('0x10')](',\x20'));_0x526e5e[_0x0fa0('0x11')]();}else{try{var _0x5269ec=eval('('+_0x59cadf[_0x0fa0('0x12')]+')');var _0x9c59db=_0x5269ec?_0x59cadf[_0x0fa0('0x13')]:_0x59cadf[_0x0fa0('0x14')];logger[_0x0fa0('0x15')](_0x0fa0('0x16'),_0x3a4d97,_0x59cadf['condition'],_0x5269ec,_0x9c59db||_0x0fa0('0x17'));if(_0x9c59db){var _0xe88046=_[_0x0fa0('0x18')](_0x526e5e[_0x0fa0('0x19')](),{'p':_0x9c59db});if(_0xe88046>=0x0){logger['info'](_0x0fa0('0x1a'),_0x3a4d97,_0x9c59db||'next',_0xe88046);_0x526e5e[_0x0fa0('0x17')](_0xe88046);}else{logger['info'](_0x0fa0('0x1b'),_0x3a4d97,_0x9c59db||_0x0fa0('0x17'));_0x526e5e['stop']();}}else{_0x526e5e[_0x0fa0('0x17')]();}}catch(_0x1f3b66){logger[_0x0fa0('0xc')](_0x0fa0('0x1c'),_0x3a4d97,_0x1f3b66['message']);_0x526e5e[_0x0fa0('0x11')]();}}}catch(_0x1ee84e){logger[_0x0fa0('0xc')](_0x0fa0('0xd'),_0x3a4d97,JSON[_0x0fa0('0x1d')](_0x1ee84e));_0x526e5e[_0x0fa0('0x11')]();}};}; \ No newline at end of file +var _0x146a=['lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','map','join','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate'];(function(_0x55891a,_0x49cdf2){var _0x49f23e=function(_0x183575){while(--_0x183575){_0x55891a['push'](_0x55891a['shift']());}};_0x49f23e(++_0x49cdf2);}(_0x146a,0x10d));var _0xa146=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x146a[_0x87239];return _0x53af1e;};'use strict';var schema=require(_0xa146('0x0'));var _=require(_0xa146('0x1'));var htmlToText=require(_0xa146('0x2'));var utils=require(_0xa146('0x3'));var logger=require('../../../../config/logger')(_0xa146('0x4'));var gotoif=schema({'condition':{'type':_0xa146('0x5'),'required':!![],'message':_0xa146('0x6')},'priorityTrue':{'type':'number','message':_0xa146('0x7')},'priorityFalse':{'type':_0xa146('0x8'),'message':_0xa146('0x9')}});exports[_0xa146('0xa')]=function(_0x42da7,_0xf75a6f){return function(_0x3ee20d){try{var _0x4cae3e={'condition':htmlToText['fromString'](utils[_0xa146('0xb')](_0xf75a6f[0x0],this),{'wordwrap':![]})[_0xa146('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xf75a6f[0x1],'priorityFalse':_0xf75a6f[0x2]};var _0x577053=gotoif[_0xa146('0x0')](_0x4cae3e,{'typecast':!![]});if(_0x577053[_0xa146('0xd')]){logger[_0xa146('0xe')]('[%s][GOTOIF]\x20%s',_0x42da7,_[_0xa146('0xf')](_0x577053,'message')[_0xa146('0x10')](',\x20'));_0x3ee20d[_0xa146('0x11')]();}else{try{var _0xd7f08=eval('('+_0x4cae3e[_0xa146('0x12')]+')');var _0x420d66=_0xd7f08?_0x4cae3e[_0xa146('0x13')]:_0x4cae3e[_0xa146('0x14')];logger[_0xa146('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x42da7,_0x4cae3e[_0xa146('0x12')],_0xd7f08,_0x420d66||_0xa146('0x16'));if(_0x420d66){var _0x18c8d1=_[_0xa146('0x17')](_0x3ee20d[_0xa146('0x18')](),{'p':_0x420d66});if(_0x18c8d1>=0x0){logger[_0xa146('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x42da7,_0x420d66||_0xa146('0x16'),_0x18c8d1);_0x3ee20d[_0xa146('0x16')](_0x18c8d1);}else{logger[_0xa146('0x15')](_0xa146('0x19'),_0x42da7,_0x420d66||_0xa146('0x16'));_0x3ee20d[_0xa146('0x11')]();}}else{_0x3ee20d[_0xa146('0x16')]();}}catch(_0x5d7bff){logger[_0xa146('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x42da7,_0x5d7bff['message']);_0x3ee20d['stop']();}}}catch(_0xd4c46c){logger[_0xa146('0xe')]('[%s][GOTOIF]\x20%s',_0x42da7,JSON[_0xa146('0x1a')](_0xd4c46c));_0x3ee20d[_0xa146('0x11')]();}};}; \ 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 b993573..f0688d7 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 _0xe543=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','lodash','../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe543,0x10c));var _0x3e54=function(_0x5bc8c1,_0x24b525){_0x5bc8c1=_0x5bc8c1-0x0;var _0x14d4e4=_0xe543[_0x5bc8c1];return _0x14d4e4;};'use strict';var schema=require(_0x3e54('0x0'));var _=require(_0x3e54('0x1'));var logger=require(_0x3e54('0x2'))(_0x3e54('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x3e54('0x4')}});exports['consequence']=function(_0x5744ea,_0x900cb){return function(_0x43c5ff){try{var _0x10757a={'priority':_0x900cb[0x0]};var _0x100a9d=gotop[_0x3e54('0x0')](_0x10757a,{'typecast':!![]});if(_0x100a9d[_0x3e54('0x5')]){logger['error'](_0x3e54('0x6'),_0x5744ea,_[_0x3e54('0x7')](_0x100a9d,_0x3e54('0x8'))[_0x3e54('0x9')](',\x20'));_0x43c5ff[_0x3e54('0xa')]();}else{logger['info'](_0x3e54('0xb'),_0x5744ea,_0x10757a[_0x3e54('0xc')]);if(_0x10757a[_0x3e54('0xc')]){var _0x112ff0=_[_0x3e54('0xd')](_0x43c5ff['rules'](),{'p':_0x10757a[_0x3e54('0xc')]});if(_0x112ff0>=0x0){logger[_0x3e54('0xe')](_0x3e54('0xf'),_0x5744ea,_0x10757a[_0x3e54('0xc')]||_0x3e54('0x10'),_0x112ff0);_0x43c5ff[_0x3e54('0x10')](_0x112ff0);}else{logger[_0x3e54('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x5744ea,_0x10757a['priority']||_0x3e54('0x10'));_0x43c5ff[_0x3e54('0xa')]();}}else{_0x43c5ff['next']();}}}catch(_0x4ea150){logger['error'](_0x3e54('0x6'),_0x5744ea,JSON['stringify'](_0x4ea150));_0x43c5ff[_0x3e54('0xa')]();}};}; \ No newline at end of file +var _0xd317=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','consequence','length','[%s][GOTOP]\x20%s','map','message'];(function(_0x4ceed9,_0x3a0f06){var _0x513790=function(_0x521853){while(--_0x521853){_0x4ceed9['push'](_0x4ceed9['shift']());}};_0x513790(++_0x3a0f06);}(_0xd317,0x1c0));var _0x7d31=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd317[_0x465a0c];return _0x1e202e;};'use strict';var schema=require(_0x7d31('0x0'));var _=require(_0x7d31('0x1'));var logger=require(_0x7d31('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x7d31('0x3')]=function(_0x229edc,_0x1588a3){return function(_0xa50885){try{var _0x3bee9e={'priority':_0x1588a3[0x0]};var _0x474687=gotop['validate'](_0x3bee9e,{'typecast':!![]});if(_0x474687[_0x7d31('0x4')]){logger['error'](_0x7d31('0x5'),_0x229edc,_[_0x7d31('0x6')](_0x474687,_0x7d31('0x7'))[_0x7d31('0x8')](',\x20'));_0xa50885[_0x7d31('0x9')]();}else{logger[_0x7d31('0xa')](_0x7d31('0xb'),_0x229edc,_0x3bee9e[_0x7d31('0xc')]);if(_0x3bee9e[_0x7d31('0xc')]){var _0x5c47ab=_[_0x7d31('0xd')](_0xa50885['rules'](),{'p':_0x3bee9e[_0x7d31('0xc')]});if(_0x5c47ab>=0x0){logger['info'](_0x7d31('0xe'),_0x229edc,_0x3bee9e['priority']||'next',_0x5c47ab);_0xa50885[_0x7d31('0xf')](_0x5c47ab);}else{logger['info'](_0x7d31('0x10'),_0x229edc,_0x3bee9e[_0x7d31('0xc')]||'next');_0xa50885[_0x7d31('0x9')]();}}else{_0xa50885[_0x7d31('0xf')]();}}}catch(_0x2b0429){logger[_0x7d31('0x11')]('[%s][GOTOP]\x20%s',_0x229edc,JSON[_0x7d31('0x12')](_0x2b0429));_0xa50885[_0x7d31('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 5abd9c5..e131889 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 _0x5221=['stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5221,0xe3));var _0x1522=function(_0x5a8c75,_0x610dc4){_0x5a8c75=_0x5a8c75-0x0;var _0x32aeca=_0x5221[_0x5a8c75];return _0x32aeca;};'use strict';var _=require(_0x1522('0x0'));var utils=require(_0x1522('0x1'));var logger=require(_0x1522('0x2'))(_0x1522('0x3'));var rpc={'chatMessage':require(_0x1522('0x4')),'openchannelMessage':require(_0x1522('0x5')),'mailMessage':require(_0x1522('0x6')),'smsMessage':require(_0x1522('0x7')),'faxMessage':require(_0x1522('0x8')),'whatsappMessage':require(_0x1522('0x9'))};exports[_0x1522('0xa')]=function(_0x376bec,_0x132c85){return function(_0x431a8b){try{var _0x26962a={'body':utils[_0x1522('0xb')](_0x132c85[0x0],this),'ContactId':this[_0x1522('0xc')]['id']};if(this[_0x1522('0xd')]===_0x1522('0xe')){_0x26962a[_0x1522('0xf')]=this['account']['id'];}else{_0x26962a[_['upperFirst'](this['channel'])+_0x1522('0x10')]=this[_0x1522('0x11')]['id'];}_0x26962a[_[_0x1522('0x12')](this[_0x1522('0xd')])+_0x1522('0x13')]=this[_0x1522('0x14')]['id'];if(rpc[this[_0x1522('0xd')]+_0x1522('0x15')]){return rpc[this[_0x1522('0xd')]+_0x1522('0x15')][_0x1522('0x16')](_0x26962a)[_0x1522('0x17')](function(_0x529d85){logger[_0x1522('0x18')](_0x1522('0x19'),_0x376bec,_0x26962a[_0x1522('0x1a')]);_0x431a8b[_0x1522('0x1b')]();})[_0x1522('0x1c')](function(_0x511743){logger['error'](_0x1522('0x19'),_0x376bec,JSON[_0x1522('0x1d')](_0x511743));_0x431a8b[_0x1522('0x1e')]();});}}catch(_0x10e0a5){logger[_0x1522('0x1f')](_0x1522('0x19'),_0x376bec,JSON[_0x1522('0x1d')](_0x10e0a5));_0x431a8b[_0x1522('0x1e')]();}};}; \ No newline at end of file +var _0x2a4f=['next','catch','error','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','ChatWebsiteId','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x2a4f,0xac));var _0xf2a4=function(_0x51156d,_0xe9e50){_0x51156d=_0x51156d-0x0;var _0x598764=_0x2a4f[_0x51156d];return _0x598764;};'use strict';var _=require('lodash');var utils=require(_0xf2a4('0x0'));var logger=require(_0xf2a4('0x1'))(_0xf2a4('0x2'));var rpc={'chatMessage':require(_0xf2a4('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf2a4('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf2a4('0x5'))};exports[_0xf2a4('0x6')]=function(_0x5d5b88,_0x18438e){return function(_0x2df18a){try{var _0x108baf={'body':utils['getMustacheRender'](_0x18438e[0x0],this),'ContactId':this[_0xf2a4('0x7')]['id']};if(this[_0xf2a4('0x8')]==='chat'){_0x108baf[_0xf2a4('0x9')]=this['account']['id'];}else{_0x108baf[_[_0xf2a4('0xa')](this[_0xf2a4('0x8')])+_0xf2a4('0xb')]=this['account']['id'];}_0x108baf[_['upperFirst'](this['channel'])+_0xf2a4('0xc')]=this[_0xf2a4('0xd')]['id'];if(rpc[this['channel']+_0xf2a4('0xe')]){return rpc[this[_0xf2a4('0x8')]+'Message'][_0xf2a4('0xf')](_0x108baf)[_0xf2a4('0x10')](function(_0x78718d){logger[_0xf2a4('0x11')](_0xf2a4('0x12'),_0x5d5b88,_0x108baf[_0xf2a4('0x13')]);_0x2df18a[_0xf2a4('0x14')]();})[_0xf2a4('0x15')](function(_0x2cea2e){logger[_0xf2a4('0x16')](_0xf2a4('0x12'),_0x5d5b88,JSON['stringify'](_0x2cea2e));_0x2df18a[_0xf2a4('0x17')]();});}}catch(_0x555109){logger[_0xf2a4('0x16')](_0xf2a4('0x12'),_0x5d5b88,JSON['stringify'](_0x555109));_0x2df18a[_0xf2a4('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 795c75b..1a95d0a 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 _0x0999=['info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','../../../../config/logger','routing','consequence'];(function(_0x47f8cb,_0x44459e){var _0x24a7d6=function(_0x33aa4e){while(--_0x33aa4e){_0x47f8cb['push'](_0x47f8cb['shift']());}};_0x24a7d6(++_0x44459e);}(_0x0999,0x85));var _0x9099=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x0999[_0x30faec];return _0x29484f;};'use strict';var utils=require('./utils');var logger=require(_0x9099('0x0'))(_0x9099('0x1'));exports[_0x9099('0x2')]=function(_0x4784cd,_0x3ccddc){return function(_0x293e32){try{logger[_0x9099('0x3')](_0x9099('0x4'),_0x4784cd,utils[_0x9099('0x5')](_0x3ccddc[0x0],this));_0x293e32[_0x9099('0x6')]();}catch(_0x291456){logger['error'](_0x9099('0x4'),_0x4784cd,JSON[_0x9099('0x7')](_0x291456));_0x293e32['stop']();}};}; \ No newline at end of file +var _0x8826=['consequence','info','[%s][NOOP]\x20%s','next','error','stringify','./utils','../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8826,0x17e));var _0x6882=function(_0xdb9089,_0x11ec02){_0xdb9089=_0xdb9089-0x0;var _0x316f82=_0x8826[_0xdb9089];return _0x316f82;};'use strict';var utils=require(_0x6882('0x0'));var logger=require(_0x6882('0x1'))('routing');exports[_0x6882('0x2')]=function(_0x44cbfc,_0x55892b){return function(_0x2e4c09){try{logger[_0x6882('0x3')](_0x6882('0x4'),_0x44cbfc,utils['getMustacheRender'](_0x55892b[0x0],this));_0x2e4c09[_0x6882('0x5')]();}catch(_0x2cca07){logger[_0x6882('0x6')](_0x6882('0x4'),_0x44cbfc,JSON[_0x6882('0x7')](_0x2cca07));_0x2e4c09['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 6b685f4..b203736 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x3e74,0x175));var _0x43e7=function(_0x534935,_0xca551c){_0x534935=_0x534935-0x0;var _0x328b90=_0x3e74[_0x534935];return _0x328b90;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file +var _0x55ca=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x21b122,_0x4ce262){var _0xebd215=function(_0x4eda63){while(--_0x4eda63){_0x21b122['push'](_0x21b122['shift']());}};_0xebd215(++_0x4ce262);}(_0x55ca,0x126));var _0xa55c=function(_0xdf5fc5,_0x37255b){_0xdf5fc5=_0xdf5fc5-0x0;var _0x52f5a5=_0x55ca[_0xdf5fc5];return _0x52f5a5;};'use strict';var schema=require(_0xa55c('0x0'));var _=require(_0xa55c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));var strategy=require(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa55c('0xa'),_0xa55c('0xb'),'queue',_0xa55c('0xc'),_0xa55c('0xd')];function emit(_0x52a3bc,_0x5849ad,_0x473d0e){io['to'](_0x52a3bc)[_0xa55c('0xe')](_0x5849ad,_0x473d0e);}function emitChannelQueueInteraction(_0x381d07,_0x5d8e5a,_0x31646d,_0xe6d826,_0x508342,_0x70c2de,_0x3998f7,_0x15eec8){var _0x5d47ff=_['clone'](_0x31646d);_0x5d47ff[_0xa55c('0xa')]=_0x15eec8;_0x5d47ff['queue']=_0x5d8e5a;_0x5d47ff['account']=_0xe6d826;_0x5d47ff['id']=_0x508342;if(_0x70c2de){_0x3998f7[util['format'](_0xa55c('0xf'),_0x381d07)][_0x508342]=_[_0xa55c('0x10')](_0x5d47ff,attributes);}else{delete _0x3998f7[util[_0xa55c('0x11')](_0xa55c('0xf'),_0x381d07)][_0x508342];}emit(util[_0xa55c('0x11')](_0xa55c('0x12'),_0x381d07,_0x5d8e5a),util['format'](_0xa55c('0x13'),_0x381d07,_0x70c2de?_0xa55c('0x14'):_0xa55c('0x15')),_[_0xa55c('0x10')](_0x5d47ff,attributes));}var rpc={'openchannelQueueReport':require(_0xa55c('0x16')),'mailQueueReport':require(_0xa55c('0x17')),'chatQueueReport':require(_0xa55c('0x18')),'smsQueueReport':require(_0xa55c('0x19')),'faxQueueReport':require(_0xa55c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xa55c('0x1b'),'required':!![],'message':_0xa55c('0x1c')},'timeout':{'type':_0xa55c('0x1d'),'message':_0xa55c('0x1e')}});function startRouting(_0x23a1ae,_0x5426e5,_0x4c0daf,_0x5f5158){if(_0x23a1ae&&_0x5426e5&&_0x4c0daf){_0x5426e5[_0xa55c('0x1f')]+=0x1;var _0x3776ac={'uniqueid':_0x23a1ae,'from':_0x4c0daf[_0xa55c('0x20')]?_0x4c0daf['body'][_0xa55c('0xc')]:'','joinAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c0daf[_0xa55c('0x21')]?_0x4c0daf[_0xa55c('0x21')]['id']:null,'ListId':_0x4c0daf[_0xa55c('0x22')]?_0x4c0daf[_0xa55c('0x22')]['id']:null};_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf['channel'])+_0xa55c('0x24')]=_0x5426e5['id']||null;_0x3776ac[_['upperFirst'](_0x4c0daf['channel'])+'InteractionId']=_0x4c0daf[_0xa55c('0x25')]?_0x4c0daf['interaction']['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+_0xa55c('0x27')]=_0x4c0daf[_0xa55c('0x28')]?_0x4c0daf[_0xa55c('0x28')]['id']:null;_0x3776ac[_[_0xa55c('0x23')](_0x4c0daf[_0xa55c('0x26')])+(_0x4c0daf[_0xa55c('0x26')]!==_0xa55c('0x29')?_0xa55c('0x2a'):_0xa55c('0x2b'))]=_0x4c0daf['account']?_0x4c0daf[_0xa55c('0xb')]['id']:null;logger[_0xa55c('0x2c')](util[_0xa55c('0x11')](_0xa55c('0x2d'),_0x23a1ae,_0x5426e5['name']));emitChannelQueueInteraction(_0x4c0daf[_0xa55c('0x26')],_0x5426e5[_0xa55c('0x2e')],_0x3776ac,_0x4c0daf[_0xa55c('0xb')][_0xa55c('0x2e')],_0x4c0daf[_0xa55c('0x28')]['id'],!![],_0x5f5158,_0x5426e5['id']);if(rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport']){return rpc[_0x4c0daf[_0xa55c('0x26')]+'QueueReport'][_0xa55c('0x2f')](_0x3776ac)[_0xa55c('0x30')](function(_0x1cc53e){logger[_0xa55c('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x3d28fb,_0x2096ae,_0x331e58,_0x20da31){if(_0x3d28fb&&_0x2096ae){_0x2096ae[_0xa55c('0x1f')]-=0x1;var _0x1225c3={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'acceptAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'reason':_0xa55c('0x33')};logger['info'](util['format'](_0xa55c('0x34'),_0x3d28fb,_0x2096ae[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x331e58['channel'],_0x2096ae[_0xa55c('0x2e')],_0x331e58[_0xa55c('0x20')],_0x331e58[_0xa55c('0xb')][_0xa55c('0x2e')],_0x331e58[_0xa55c('0x28')]['id'],![],_0x20da31,_0x2096ae['id']);if(rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]){return rpc[_0x331e58[_0xa55c('0x26')]+_0xa55c('0x35')]['update'](_0x3d28fb,_0x1225c3)['catch'](function(_0x4b23d3){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function endRouting(_0x2bb4f0,_0x5802e4,_0x768408,_0x547930){if(_0x2bb4f0&&_0x5802e4){_0x5802e4[_0xa55c('0x1f')]-=0x1;var _0x4ad813={'leaveAt':moment()[_0xa55c('0x11')](_0xa55c('0x32')),'exitAt':moment()[_0xa55c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa55c('0x37')};logger[_0xa55c('0x2c')](util['format'](_0xa55c('0x38'),_0x2bb4f0,_0x5802e4[_0xa55c('0x2e')]));emitChannelQueueInteraction(_0x768408['channel'],_0x5802e4['name'],_0x768408[_0xa55c('0x20')],_0x768408['account'][_0xa55c('0x2e')],_0x768408[_0xa55c('0x28')]['id'],![],_0x547930);if(rpc[_0x768408['channel']+'QueueReport']){return rpc[_0x768408['channel']+'QueueReport'][_0xa55c('0x39')](_0x2bb4f0,_0x4ad813)[_0xa55c('0x30')](function(_0x429336){logger[_0xa55c('0x31')](_0xa55c('0x36'));});}}}function handleFindQueue(_0x56d17c){return function(_0x3d52d8){return _0x3d52d8[_0xa55c('0x2e')][_0xa55c('0x3a')]()===_0x56d17c[_0xa55c('0x3a')]();};}exports[_0xa55c('0x3b')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){return function(_0x57a972){try{var _0x404e7f={'name':_0x554620[0x0],'timeout':_0x554620[0x1]};var _0x1f63d8=queue['validate'](_0x404e7f,{'typecast':!![]});if(_0x1f63d8[_0xa55c('0x3c')]){logger['error']('[%s][QUEUE]\x20%s',_0x23cef5,_[_0xa55c('0x3d')](_0x1f63d8,_0xa55c('0x28'))[_0xa55c('0x3e')](',\x20'));_0x57a972['stop']();}else{var _0x1b2708=_[_0xa55c('0x3f')](_0x386e34[_0x5ee63d['channel']+_0xa55c('0x40')],handleFindQueue(_0x404e7f['name']));if(_0x1b2708){startRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);var _0x39886a=(_0x1b2708[_0xa55c('0x37')]||0xa)*0x3e8;var _0x5be43f=(_0x404e7f[_0xa55c('0x37')]||0x14)*0x3e8;var _0x1dae70,_0x5d834d;if(_0x39886a>_0x5be43f){_0x5be43f=_0x39886a;}var _0x40c352=seqqueue[_0xa55c('0x41')](_0x39886a);_0x40c352['id']=_0x23cef5;_0x40c352[_0xa55c('0x42')]=_0x39886a;_0x40c352['qtimeout']=_0x5be43f;_0x40c352[_0xa55c('0x26')]=_0x5ee63d['channel'];_0x386e34[_0xa55c('0x43')][_0x23cef5]['on'](_0xa55c('0x44'),function(){logger[_0xa55c('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x23cef5);stopRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x1dae70=undefined;_0x40c352[_0xa55c('0x45')](!![]);if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34['rules'][_0x23cef5];}_0x57a972[_0xa55c('0x46')]();});_0x386e34[_0xa55c('0x43')][_0x23cef5]['on']('complete',function(){if(_0x386e34[_0xa55c('0x43')][_0x23cef5]){delete _0x386e34[_0xa55c('0x43')][_0x23cef5];}});_0x1dae70=setTimeout(function(){logger['info'](_0xa55c('0x47'),_0x23cef5);endRouting(_0x23cef5,_0x1b2708,_0x5ee63d,_0x386e34);clearTimeout(_0x1dae70);_0x40c352[_0xa55c('0x45')](!![]);_0x57a972[_0xa55c('0x48')]();},_0x5be43f);switch(_0x1b2708[_0xa55c('0x49')]){case'rrmemory':strategy[_0xa55c('0x4a')](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);break;default:strategy['beepall'](_0x40c352,_0x1b2708,_0x386e34,_0x5ee63d);}}else{logger[_0xa55c('0x31')](_0xa55c('0x4b'),_0x23cef5,_0x404e7f[_0xa55c('0x2e')]);_0x57a972['stop']();}}}catch(_0x39bd3d){console[_0xa55c('0x4c')](_0x39bd3d);logger['error'](_0xa55c('0x4d'),_0x23cef5,_0x39bd3d[_0xa55c('0x4e')]);_0x57a972[_0xa55c('0x46')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 615133e..9878cac 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 _0xc757=['notificationId','squeue','agent','realtime','push','bind','timeout','handleTimeout','handleDrained','prototype','handleRun','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','busyQueue','showNotification',':FORCED','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0xb7592c,_0x90a099){var _0x4d88ee=function(_0x16b5fc){while(--_0x16b5fc){_0xb7592c['push'](_0xb7592c['shift']());}};_0x4d88ee(++_0x90a099);}(_0xc757,0xe3));var _0x7c75=function(_0x4950d7,_0x468f85){_0x4950d7=_0x4950d7-0x0;var _0x9f677b=_0xc757[_0x4950d7];return _0x9f677b;};'use strict';var _=require(_0x7c75('0x0'));var uuid=require(_0x7c75('0x1'));var util=require(_0x7c75('0x2'));var logger=require(_0x7c75('0x3'))(_0x7c75('0x4'));var Agent=function(_0x51c0dc,_0x1e47e6,_0x4f7a3b,_0x4d373a){this[_0x7c75('0x5')]=uuid['v4']();this[_0x7c75('0x6')]=_0x51c0dc;this[_0x7c75('0x7')]=_0x1e47e6;this[_0x7c75('0x8')]=_0x4f7a3b;this[_0x7c75('0x4')]=_0x4d373a;this[_0x7c75('0x6')][_0x7c75('0x9')](this['handleRun'][_0x7c75('0xa')](this),this['handleTimeout'][_0x7c75('0xa')](this));this[_0x7c75('0x6')]['on'](_0x7c75('0xb'),this[_0x7c75('0xc')][_0x7c75('0xa')](this));this[_0x7c75('0x6')]['on']('drained',this[_0x7c75('0xd')][_0x7c75('0xa')](this));};Agent['prototype']['push']=function(){this[_0x7c75('0x6')][_0x7c75('0x9')](this['handleRun'][_0x7c75('0xa')](this),this[_0x7c75('0xc')]['bind'](this));};Agent[_0x7c75('0xe')][_0x7c75('0xd')]=function(){this[_0x7c75('0xc')](!![]);};Agent['prototype'][_0x7c75('0xf')]=function(_0x439130){logger[_0x7c75('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x7c75('0x6')]['id'],this['agent']['id']);if(_[_0x7c75('0x11')](this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']])){logger[_0x7c75('0x10')](_0x7c75('0x13'),this[_0x7c75('0x6')]['id'],this[_0x7c75('0x7')]['id']);setTimeout(this[_0x7c75('0x9')]['bind'](this),0x3e8);}else{if(this[_0x7c75('0x4')][_0x7c75('0x14')]||util['isAgentAvailable'](this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this['agent']['id']],this['squeue']['channel'],![])){this[_0x7c75('0x8')]['agents'][this[_0x7c75('0x7')]['id']][_0x7c75('0x15')]=!![];this['realtime']['agents'][this['agent']['id']][_0x7c75('0x16')]=undefined;util[_0x7c75('0x17')](this[_0x7c75('0x5')],this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this['agent']['id']],null,this[_0x7c75('0x4')]);util['writeLog'](this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']],'RINGING'+(this[_0x7c75('0x4')][_0x7c75('0x14')]?_0x7c75('0x18'):''));}else{logger[_0x7c75('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x7c75('0x6')]['id'],this[_0x7c75('0x7')]['id']);setTimeout(this[_0x7c75('0x9')][_0x7c75('0xa')](this),0x3e8);}}};Agent['prototype'][_0x7c75('0xc')]=function(_0x5d6ee5){if(_['isNil'](this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']])){return logger['info'](_0x7c75('0x13'),this['squeue']['id'],this[_0x7c75('0x7')]['id']);}else{logger[_0x7c75('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x7c75('0x6')]['id'],this[_0x7c75('0x7')]['id']);util['hideNotification'](this[_0x7c75('0x5')],this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']],null,this[_0x7c75('0x4')]);this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']][_0x7c75('0x15')]=![];this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']][_0x7c75('0x16')]=undefined;util[_0x7c75('0x19')](this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this['agent']['id']],_0x5d6ee5?_0x7c75('0x1a'):_0x7c75('0x1b'));}if(!_0x5d6ee5){setTimeout(this[_0x7c75('0x9')][_0x7c75('0xa')](this),0x3e8);}};function agent(_0xc39653,_0x591648,_0x455df2,_0x490729){return new Agent(_0xc39653,_0x591648,_0x455df2,_0x490729);}module[_0x7c75('0x1c')]=agent; \ No newline at end of file +var _0x83b1=['routing','notificationId','squeue','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','agent','forcedOwnership','agents','channel','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','./util','../../../../../config/logger'];(function(_0x7c8786,_0xe0dc5e){var _0x269380=function(_0x15b204){while(--_0x15b204){_0x7c8786['push'](_0x7c8786['shift']());}};_0x269380(++_0xe0dc5e);}(_0x83b1,0x98));var _0x183b=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x83b1[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x183b('0x0'));var uuid=require('uuid');var util=require(_0x183b('0x1'));var logger=require(_0x183b('0x2'))(_0x183b('0x3'));var Agent=function(_0x1e3d71,_0x2fb48b,_0x235a2c,_0x534cd1){this[_0x183b('0x4')]=uuid['v4']();this[_0x183b('0x5')]=_0x1e3d71;this['agent']=_0x2fb48b;this[_0x183b('0x6')]=_0x235a2c;this[_0x183b('0x3')]=_0x534cd1;this[_0x183b('0x5')][_0x183b('0x7')](this[_0x183b('0x8')]['bind'](this),this[_0x183b('0x9')][_0x183b('0xa')](this));this[_0x183b('0x5')]['on'](_0x183b('0xb'),this['handleTimeout'][_0x183b('0xa')](this));this[_0x183b('0x5')]['on'](_0x183b('0xc'),this[_0x183b('0xd')]['bind'](this));};Agent[_0x183b('0xe')][_0x183b('0x7')]=function(){this[_0x183b('0x5')]['push'](this[_0x183b('0x8')][_0x183b('0xa')](this),this['handleTimeout'][_0x183b('0xa')](this));};Agent['prototype']['handleDrained']=function(){this[_0x183b('0x9')](!![]);};Agent[_0x183b('0xe')]['handleRun']=function(_0x3c8e77){logger[_0x183b('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_['isNil'](this[_0x183b('0x6')]['agents'][this[_0x183b('0x10')]['id']])){logger[_0x183b('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x183b('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x183b('0x7')][_0x183b('0xa')](this),0x3e8);}else{if(this[_0x183b('0x3')][_0x183b('0x11')]||util['isAgentAvailable'](this[_0x183b('0x5')]['id'],this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']],this[_0x183b('0x5')][_0x183b('0x13')],![])){this[_0x183b('0x6')]['agents'][this[_0x183b('0x10')]['id']][_0x183b('0x14')]=!![];this['realtime'][_0x183b('0x12')][this[_0x183b('0x10')]['id']][_0x183b('0x15')]=undefined;util['showNotification'](this[_0x183b('0x4')],this[_0x183b('0x5')]['id'],this['realtime'][_0x183b('0x12')][this['agent']['id']],null,this[_0x183b('0x3')]);util[_0x183b('0x16')](this[_0x183b('0x5')]['id'],this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']],_0x183b('0x17')+(this[_0x183b('0x3')]['forcedOwnership']?_0x183b('0x18'):''));}else{logger['info'](_0x183b('0x19'),this[_0x183b('0x5')]['id'],this[_0x183b('0x10')]['id']);setTimeout(this[_0x183b('0x7')]['bind'](this),0x3e8);}}};Agent[_0x183b('0xe')][_0x183b('0x9')]=function(_0x5b2609){if(_['isNil'](this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']])){return logger['info'](_0x183b('0x1a'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x183b('0xf')](_0x183b('0x1b'),this[_0x183b('0x5')]['id'],this['agent']['id']);util[_0x183b('0x1c')](this[_0x183b('0x4')],this[_0x183b('0x5')]['id'],this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']],null,this[_0x183b('0x3')]);this[_0x183b('0x6')][_0x183b('0x12')][this[_0x183b('0x10')]['id']][_0x183b('0x14')]=![];this['realtime'][_0x183b('0x12')][this[_0x183b('0x10')]['id']]['busyQueue']=undefined;util[_0x183b('0x16')](this[_0x183b('0x5')]['id'],this['realtime'][_0x183b('0x12')][this[_0x183b('0x10')]['id']],_0x5b2609?_0x183b('0x1d'):'TIMEOUT');}if(!_0x5b2609){setTimeout(this[_0x183b('0x7')][_0x183b('0xa')](this),0x3e8);}};function agent(_0x167d4a,_0x488168,_0x927d07,_0x367690){return new Agent(_0x167d4a,_0x488168,_0x927d07,_0x367690);}module[_0x183b('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 ad6ca28..681079f 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 _0xacb0=['info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','handleTimeout','timeout','drained','handleDrained','bind','prototype','isNil','queue','Agents','length','realtime','agents'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xacb0,0x70));var _0x0acb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xacb0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0acb('0x0'));var uuid=require(_0x0acb('0x1'));var util=require('./util');var logger=require(_0x0acb('0x2'))(_0x0acb('0x3'));var Beepall=function(_0x241c4e,_0x22661a,_0x5d24df,_0xd13769){this[_0x0acb('0x4')]=uuid['v4']();this['squeue']=_0x241c4e;this['queue']=_0x22661a;this['realtime']=_0x5d24df;this[_0x0acb('0x3')]=_0xd13769;this[_0x0acb('0x5')][_0x0acb('0x6')](this[_0x0acb('0x7')]['bind'](this),this[_0x0acb('0x8')]['bind'](this));this[_0x0acb('0x5')]['on'](_0x0acb('0x9'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x0acb('0xa'),this[_0x0acb('0xb')]['bind'](this));};Beepall['prototype']['push']=function(){this[_0x0acb('0x5')][_0x0acb('0x6')](this[_0x0acb('0x7')][_0x0acb('0xc')](this),this[_0x0acb('0x8')][_0x0acb('0xc')](this));};Beepall['prototype'][_0x0acb('0xb')]=function(_0x3b4d5d){this[_0x0acb('0x8')](!![]);};Beepall[_0x0acb('0xd')][_0x0acb('0x7')]=function(_0x5b222a){var _0x484928=!![];if(!_[_0x0acb('0xe')](this[_0x0acb('0xf')])&&!_['isNil'](this[_0x0acb('0xf')][_0x0acb('0x10')])&&this[_0x0acb('0xf')][_0x0acb('0x10')][_0x0acb('0x11')]>0x0){for(var _0x76075e=0x0,_0xddc732;_0x76075e0x0){for(var _0x434b4b=0x0,_0x42dacf;_0x434b4b0x0&&_0xd6bdad[_0x5c45f2+_0x6c4e('0x22')]>=_0xd6bdad[_0x5c45f2+'Capacity']){writeLog(_0x266f7d,_0xd6bdad,_0x5c45f2[_0x6c4e('0x24')]()+_0x6c4e('0x25'));return![];}}return!![];};exports[_0x6c4e('0x26')]=function(_0x117f1a,_0x38d216,_0x14ccfc,_0x3681ee,_0x52c934){return sendNotification(!![],_0x117f1a,_0x38d216,_0x14ccfc,_0x3681ee,_0x52c934);};exports[_0x6c4e('0x27')]=function(_0x2f6f01,_0x5bd002,_0x169830,_0x3b738d,_0x5829c1){return sendNotification(![],_0x2f6f01,_0x5bd002,_0x169830,_0x3b738d,_0x5829c1);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x6db6=['../../../../../config/logger','routing','redis','localhost','socket.io-emitter','format','user:%s','name','emit','user:save','split','\x20interaction','notificationSound','notificationShake','body','queue','msg','getMustacheRender','account','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','CurrentCapacity','toUpperCase','hideNotification','writeLog','lodash','util','ioredis','../../../../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6db6,0x1ca));var _0x66db=function(_0x5e8ddf,_0x7bfbbd){_0x5e8ddf=_0x5e8ddf-0x0;var _0x19682e=_0x6db6[_0x5e8ddf];return _0x19682e;};'use strict';var _=require(_0x66db('0x0'));var util=require(_0x66db('0x1'));var utils=require('../utils');var Mustache=require('mustache');var Redis=require(_0x66db('0x2'));var config=require(_0x66db('0x3'));var logger=require(_0x66db('0x4'))(_0x66db('0x5'));config[_0x66db('0x6')]=_['defaults'](config['redis'],{'host':_0x66db('0x7'),'port':0x18eb});var io=require(_0x66db('0x8'))(new Redis(config[_0x66db('0x6')]));function emit(_0x309c83,_0x2ce3e0,_0x30de14){io['to'](_0x309c83)['emit'](_0x2ce3e0,_0x30de14);}function sendNotification(_0x27c7ae,_0x332b0b,_0xcfee38,_0x42458b,_0x2fa8cb,_0x34226a){io['to'](util[_0x66db('0x9')](_0x66db('0xa'),_0x42458b[_0x66db('0xb')]))[_0x66db('0xc')](_0x66db('0xd'),_0x42458b);var _0xe27526=_0x34226a||{};var _0x649ea6=_0xcfee38[_0x66db('0xe')]('.');var _0x497f39={'uniqueid':_0x332b0b,'channel':_0x649ea6[0x0],'id':_0x649ea6[0x1],'title':_0x649ea6[0x0]+_0x66db('0xf'),'interactionId':_0x649ea6[0x2],'queue':_0x2fa8cb?_0x2fa8cb['name']:null,'sound':_0xe27526['account'][_0x66db('0x10')],'shake':_0xe27526['account'][_0x66db('0x11')]};try{if(!_0xe27526[_0x66db('0x12')]){_0xe27526['body']={};}if(_0x2fa8cb){_0xe27526[_0x66db('0x12')][_0x66db('0x13')]=_0x2fa8cb;}else if(_0xe27526['body'][_0x66db('0x13')]){delete _0xe27526[_0x66db('0x12')]['queue'];}_0x497f39[_0x66db('0x14')]=utils[_0x66db('0x15')](_0xe27526[_0x66db('0x16')]['notificationTemplate'],_0xe27526);}catch(_0x4a107a){_0x497f39['msg']=_0x66db('0x17');logger[_0x66db('0x18')](util[_0x66db('0x9')]('[%s][QUEUE]\x20%s',_0x332b0b,_0x4a107a[_0x66db('0x19')]));}io['to'](util[_0x66db('0x9')](_0x66db('0xa'),_0x42458b['name']))[_0x66db('0xc')](util[_0x66db('0x9')](_0x66db('0x1a'),_0x27c7ae?_0x66db('0x1b'):_0x66db('0x1c')),_0x497f39);}function writeLog(_0x269721,_0x17d4c9,_0x173c76){return logger['info'](util['format'](_0x66db('0x1d'),_0x269721,_0x17d4c9[_0x66db('0xb')],_0x173c76));}exports[_0x66db('0x1e')]=function(_0x4a73ee,_0x480c6e,_0x41112c,_0xa3aecf){if(_0x480c6e[_0x66db('0x1f')]){writeLog(_0x4a73ee,_0x480c6e,_0x66db('0x20'));return![];}if(!_0x480c6e[_0x66db('0x21')]){writeLog(_0x4a73ee,_0x480c6e,_0x66db('0x22'));return![];}if(_0x480c6e[_0x41112c+_0x66db('0x23')]){writeLog(_0x4a73ee,_0x480c6e,_0x66db('0x24'));return![];}if(_0xa3aecf&&_0x480c6e['hasOwnProperty'](_0x41112c+_0x66db('0x25'))&&_0x480c6e['hasOwnProperty'](_0x41112c+_0x66db('0x26'))){if(_0x480c6e[_0x41112c+_0x66db('0x25')]>0x0&&_0x480c6e[_0x41112c+_0x66db('0x26')]>=_0x480c6e[_0x41112c+_0x66db('0x25')]){writeLog(_0x4a73ee,_0x480c6e,_0x41112c[_0x66db('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x267e1d,_0x55f254,_0x3146a4,_0x537c77,_0x466aba){return sendNotification(!![],_0x267e1d,_0x55f254,_0x3146a4,_0x537c77,_0x466aba);};exports[_0x66db('0x28')]=function(_0x5cef62,_0x300c06,_0x2976bb,_0x3da3b8,_0x3cfca5){return sendNotification(![],_0x5cef62,_0x300c06,_0x2976bb,_0x3da3b8,_0x3cfca5);};exports[_0x66db('0x29')]=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 549cc3c..5f2c786 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 _0xb359=['lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','map','message','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs'];(function(_0x26cead,_0x173476){var _0x466c3a=function(_0x2cd04e){while(--_0x2cd04e){_0x26cead['push'](_0x26cead['shift']());}};_0x466c3a(++_0x173476);}(_0xb359,0x143));var _0x9b35=function(_0x5e37f6,_0x508bde){_0x5e37f6=_0x5e37f6-0x0;var _0x1a5c73=_0xb359[_0x5e37f6];return _0x1a5c73;};'use strict';var schema=require('validate');var sh=require(_0x9b35('0x0'));var _=require(_0x9b35('0x1'));var utils=require(_0x9b35('0x2'));var logger=require(_0x9b35('0x3'))(_0x9b35('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x9b35('0x5')}});exports[_0x9b35('0x6')]=function(_0x4bce20,_0x421834){return function(_0x3e3a04){try{var _0xb4637e={'command':_0x421834[0x0]};var _0x37ed91=system[_0x9b35('0x7')](_0xb4637e,{'typecast':!![]});if(_0x37ed91[_0x9b35('0x8')]){logger['error'](_0x9b35('0x9'),_0x4bce20,_[_0x9b35('0xa')](_0x37ed91,_0x9b35('0xb'))['join'](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4bce20);_0x3e3a04[_0x9b35('0xc')]();}else{var _0x50fd84=this;var _0x1aaa56=utils[_0x9b35('0xd')](_0x421834[0x0],this);logger[_0x9b35('0xe')](_0x9b35('0xf'),_0x4bce20,_0x1aaa56);sh[_0x9b35('0x10')](_[_0x9b35('0x11')](_0x1aaa56),function(_0xe5680e,_0x31c815){logger[_0x9b35('0xe')](_0x9b35('0x12'),_0x4bce20,_0xe5680e);if(_0xe5680e==0x0){var _0x421c37=_0x31c815[_0x9b35('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x421834[0x1])||_[_0x9b35('0x14')](_0x421834[0x1])){logger[_0x9b35('0xe')](_0x9b35('0x15'),_0x4bce20);_0x50fd84[_0x9b35('0x16')][_0x421834[0x1]]=_0x421c37;}else{logger[_0x9b35('0xe')](_0x9b35('0x17'),_0x4bce20,_0x421834[0x1],_0x421c37);_0x50fd84[_0x9b35('0x16')][_0x421834[0x1]]=_0x421c37;}}_0x3e3a04[_0x9b35('0xc')]();});}}catch(_0x14eb68){logger[_0x9b35('0x18')](_0x9b35('0x9'),_0x4bce20,_['isObject'](_0x14eb68)?JSON[_0x9b35('0x19')](_0x14eb68):_0x14eb68);logger[_0x9b35('0xe')](_0x9b35('0x1a'),_0x4bce20);_0x3e3a04['next']();}};}; \ No newline at end of file +var _0x66bb=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','message','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info'];(function(_0x3ed054,_0x4d4f16){var _0x16dd95=function(_0xc0c19c){while(--_0xc0c19c){_0x3ed054['push'](_0x3ed054['shift']());}};_0x16dd95(++_0x4d4f16);}(_0x66bb,0x102));var _0xb66b=function(_0x15d8b4,_0x26c85e){_0x15d8b4=_0x15d8b4-0x0;var _0x374bf4=_0x66bb[_0x15d8b4];return _0x374bf4;};'use strict';var schema=require('validate');var sh=require(_0xb66b('0x0'));var _=require(_0xb66b('0x1'));var utils=require(_0xb66b('0x2'));var logger=require(_0xb66b('0x3'))(_0xb66b('0x4'));var system=schema({'command':{'type':_0xb66b('0x5'),'required':!![],'message':_0xb66b('0x6')}});exports[_0xb66b('0x7')]=function(_0x4d91d3,_0x199473){return function(_0x3795e3){try{var _0x30b18d={'command':_0x199473[0x0]};var _0x23cde1=system[_0xb66b('0x8')](_0x30b18d,{'typecast':!![]});if(_0x23cde1[_0xb66b('0x9')]){logger[_0xb66b('0xa')](_0xb66b('0xb'),_0x4d91d3,_[_0xb66b('0xc')](_0x23cde1,_0xb66b('0xd'))['join'](',\x20'));logger['info'](_0xb66b('0xe'),_0x4d91d3);_0x3795e3[_0xb66b('0xf')]();}else{var _0x183742=this;var _0x211b27=utils['getMustacheRender'](_0x199473[0x0],this);logger[_0xb66b('0x10')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x4d91d3,_0x211b27);sh['exec'](_[_0xb66b('0x11')](_0x211b27),function(_0x50a801,_0x3d072f){logger['info'](_0xb66b('0x12'),_0x4d91d3,_0x50a801);if(_0x50a801==0x0){var _0x28b3b5=_0x3d072f[_0xb66b('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xb66b('0x14')](_0x199473[0x1])||_['isEmpty'](_0x199473[0x1])){logger[_0xb66b('0x10')](_0xb66b('0x15'),_0x4d91d3);_0x183742[_0xb66b('0x16')][_0x199473[0x1]]=_0x28b3b5;}else{logger['info'](_0xb66b('0x17'),_0x4d91d3,_0x199473[0x1],_0x28b3b5);_0x183742['body'][_0x199473[0x1]]=_0x28b3b5;}}_0x3795e3[_0xb66b('0xf')]();});}}catch(_0x4c8634){logger[_0xb66b('0xa')](_0xb66b('0xb'),_0x4d91d3,_['isObject'](_0x4c8634)?JSON[_0xb66b('0x18')](_0x4c8634):_0x4c8634);logger[_0xb66b('0x10')](_0xb66b('0xe'),_0x4d91d3);_0x3795e3[_0xb66b('0xf')]();}};}; \ 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 c324d5f..872813e 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 _0xdedf=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','catch','stringify','finally','next','isObject','validate','lodash'];(function(_0x5c2713,_0x4191a9){var _0x48c267=function(_0xa8b78){while(--_0xa8b78){_0x5c2713['push'](_0x5c2713['shift']());}};_0x48c267(++_0x4191a9);}(_0xdedf,0x178));var _0xfded=function(_0x424adc,_0x214087){_0x424adc=_0x424adc-0x0;var _0x257932=_0xdedf[_0x424adc];return _0x257932;};'use strict';var schema=require(_0xfded('0x0'));var _=require(_0xfded('0x1'));var rpc={'chatInteraction':require(_0xfded('0x2')),'openchannelInteraction':require(_0xfded('0x3')),'smsInteraction':require(_0xfded('0x4')),'mailInteraction':require(_0xfded('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xfded('0x6'))};var logger=require(_0xfded('0x7'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0xfded('0x8')}});exports[_0xfded('0x9')]=function(_0x2a7c72,_0x529dfd,_0x6abebb,_0x1aa336){return function(_0x233955){try{var _0x1e572b={'tag':_0x529dfd[0x0]};var _0x19c17f=tag[_0xfded('0x0')](_0x1e572b,{'typecast':!![]});if(_0x19c17f[_0xfded('0xa')]){logger[_0xfded('0xb')](_0xfded('0xc'),_0x2a7c72,_['map'](_0x19c17f,_0xfded('0xd'))[_0xfded('0xe')](',\x20'));logger[_0xfded('0xf')](_0xfded('0x10'),_0x2a7c72);_0x233955['next']();}else{var _0x236aed={'ids':[_0x529dfd[0x0]]};if(rpc[_0x1aa336[_0xfded('0x11')]+_0xfded('0x12')]){rpc[_0x1aa336[_0xfded('0x11')]+_0xfded('0x12')][_0xfded('0x13')](_0x1aa336[_0xfded('0x14')]['id'],_0x236aed)[_0xfded('0x15')](function(_0x3ebf84){logger[_0xfded('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2a7c72,_0x529dfd[0x1],_0x1aa336[_0xfded('0x11')],_0x1aa336[_0xfded('0x14')]['id']);})[_0xfded('0x16')](function(_0x3c6eae){logger[_0xfded('0xb')](_0xfded('0xc'),_0x2a7c72,JSON[_0xfded('0x17')](_0x3c6eae));logger[_0xfded('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2a7c72);})[_0xfded('0x18')](function(){_0x233955[_0xfded('0x19')]();});}}}catch(_0x717121){logger[_0xfded('0xb')]('[%s][TAG]\x20%s',_0x2a7c72,_[_0xfded('0x1a')](_0x717121)?JSON['stringify'](_0x717121):_0x717121);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2a7c72);_0x233955[_0xfded('0x19')]();}};}; \ No newline at end of file +var _0x60ac=['info','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','consequence','length','[%s][TAG]\x20%s','map','message','join','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','isObject'];(function(_0x5e6fe1,_0x8f80ad){var _0x5a6018=function(_0x1f1225){while(--_0x1f1225){_0x5e6fe1['push'](_0x5e6fe1['shift']());}};_0x5a6018(++_0x8f80ad);}(_0x60ac,0xe1));var _0xc60a=function(_0x4939b7,_0x24bdc5){_0x4939b7=_0x4939b7-0x0;var _0x548128=_0x60ac[_0x4939b7];return _0x548128;};'use strict';var schema=require(_0xc60a('0x0'));var _=require(_0xc60a('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xc60a('0x2')),'smsInteraction':require(_0xc60a('0x3')),'mailInteraction':require(_0xc60a('0x4')),'faxInteraction':require(_0xc60a('0x5')),'whatsappInteraction':require(_0xc60a('0x6'))};var logger=require('../../../../config/logger')(_0xc60a('0x7'));var tag=schema({'tag':{'type':_0xc60a('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xc60a('0x9')]=function(_0x5d6252,_0x586046,_0x30dda6,_0x5e6240){return function(_0x7399e8){try{var _0x21c60e={'tag':_0x586046[0x0]};var _0x497196=tag[_0xc60a('0x0')](_0x21c60e,{'typecast':!![]});if(_0x497196[_0xc60a('0xa')]){logger['error'](_0xc60a('0xb'),_0x5d6252,_[_0xc60a('0xc')](_0x497196,_0xc60a('0xd'))[_0xc60a('0xe')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5d6252);_0x7399e8['next']();}else{var _0x29fae4={'ids':[_0x586046[0x0]]};if(rpc[_0x5e6240[_0xc60a('0xf')]+'Interaction']){rpc[_0x5e6240['channel']+_0xc60a('0x10')][_0xc60a('0x11')](_0x5e6240[_0xc60a('0x12')]['id'],_0x29fae4)[_0xc60a('0x13')](function(_0x1f8c29){logger['info'](_0xc60a('0x14'),_0x5d6252,_0x586046[0x1],_0x5e6240[_0xc60a('0xf')],_0x5e6240[_0xc60a('0x12')]['id']);})[_0xc60a('0x15')](function(_0x50b41d){logger[_0xc60a('0x16')](_0xc60a('0xb'),_0x5d6252,JSON[_0xc60a('0x17')](_0x50b41d));logger['info'](_0xc60a('0x18'),_0x5d6252);})['finally'](function(){_0x7399e8[_0xc60a('0x19')]();});}}}catch(_0x162611){logger['error']('[%s][TAG]\x20%s',_0x5d6252,_[_0xc60a('0x1a')](_0x162611)?JSON[_0xc60a('0x17')](_0x162611):_0x162611);logger[_0xc60a('0x1b')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5d6252);_0x7399e8['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 a5d539b..43c4aa5 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 _0xa1fd=['list','mustache','lodash','exports','render','merge','body','contact','message','interaction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x17cb36,_0x3cfc3e){_0x17cb36=_0x17cb36-0x0;var _0x3ae236=_0xa1fd[_0x17cb36];return _0x3ae236;};'use strict';var Mustache=require(_0xda1f('0x0'));var _=require(_0xda1f('0x1'));module[_0xda1f('0x2')]={'getMustacheRender':function(_0x3feff6,_0x595195){return Mustache[_0xda1f('0x3')](_0x3feff6,_[_0xda1f('0x4')](_0x595195[_0xda1f('0x5')],{'contact':_0x595195[_0xda1f('0x6')],'message':_0x595195[_0xda1f('0x7')],'account':_0x595195['account'],'interaction':_0x595195[_0xda1f('0x8')],'list':_0x595195[_0xda1f('0x9')]}))||'';}}; \ No newline at end of file +var _0x94dc=['merge','contact','message','account','interaction','list','mustache','exports','render'];(function(_0x2a99f1,_0x198fd7){var _0x6948e5=function(_0x2ae413){while(--_0x2ae413){_0x2a99f1['push'](_0x2a99f1['shift']());}};_0x6948e5(++_0x198fd7);}(_0x94dc,0xb1));var _0xc94d=function(_0x28745a,_0x26b590){_0x28745a=_0x28745a-0x0;var _0x318e3d=_0x94dc[_0x28745a];return _0x318e3d;};'use strict';var Mustache=require(_0xc94d('0x0'));var _=require('lodash');module[_0xc94d('0x1')]={'getMustacheRender':function(_0x53939f,_0x1645b0){return Mustache[_0xc94d('0x2')](_0x53939f,_[_0xc94d('0x3')](_0x1645b0['body'],{'contact':_0x1645b0[_0xc94d('0x4')],'message':_0x1645b0[_0xc94d('0x5')],'account':_0x1645b0[_0xc94d('0x6')],'interaction':_0x1645b0[_0xc94d('0x7')],'list':_0x1645b0[_0xc94d('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2a58d37..24020bd 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 _0x3c38=['listen','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','dialogflow','amazonlex','slice','tag','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','matchPath','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','emit','end','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify'];(function(_0x499715,_0x4b9de1){var _0xd03283=function(_0x43d0c6){while(--_0x43d0c6){_0x499715['push'](_0x499715['shift']());}};_0xd03283(++_0x4b9de1);}(_0x3c38,0x1c9));var _0x83c3=function(_0x570954,_0x38a3e3){_0x570954=_0x570954-0x0;var _0x5cf058=_0x3c38[_0x570954];return _0x5cf058;};'use strict';var _=require(_0x83c3('0x0'));var util=require(_0x83c3('0x1'));var path=require(_0x83c3('0x2'));var fs=require('fs');var jayson=require(_0x83c3('0x3'));var BPromise=require(_0x83c3('0x4'));var uuid=require(_0x83c3('0x5'));var config=require('../../../config/environment');var logger=require(_0x83c3('0x6'))(_0x83c3('0x7'));var rpc={'openchannelQueueReport':require(_0x83c3('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x83c3('0x9')),'faxQueueReport':require(_0x83c3('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x83c3('0xb'));function getId(_0x3c85c,_0x4b3b57,_0x110204){return util[_0x83c3('0xc')](_0x83c3('0xd'),_0x3c85c,_0x4b3b57||0x0,_0x110204||0x0);}function getIntervals(_0x22cea8,_0x343f1b){var _0x228d8c=[];if(!_[_0x83c3('0xe')](_0x343f1b[_0x83c3('0xf')])&&!_['isNil'](_0x22cea8[_0x343f1b['IntervalId']])&&!_[_0x83c3('0xe')](_0x22cea8[_0x343f1b[_0x83c3('0xf')]][_0x83c3('0x10')])){_0x228d8c=_[_0x83c3('0x11')](_0x22cea8[_0x343f1b[_0x83c3('0xf')]][_0x83c3('0x10')],_0x83c3('0x12'));}else if(!_[_0x83c3('0xe')](_0x343f1b[_0x83c3('0x12')])){_0x228d8c=[_0x343f1b[_0x83c3('0x12')]];}return _0x228d8c;}exports['listen']=function(_0x2c3053){_0x2c3053[_0x83c3('0x13')]={};return new BPromise(function(_0x2acce9,_0x253db5){var _0x17fecd={'Start':function(_0x32b3d6){var _0x12b349=this;return new Promise(function(_0x2ab77c,_0x4952bc){if(_0x32b3d6){try{var _0x210eb7=[];var _0x54b31b=getId(_0x32b3d6[_0x83c3('0x14')],_0x32b3d6['message']?_0x32b3d6[_0x83c3('0x15')]['id']:0x0,_0x32b3d6[_0x83c3('0x16')]?_0x32b3d6[_0x83c3('0x16')]['id']:0x0);if(_0x32b3d6[_0x83c3('0x17')]&&_['isArray'](_0x32b3d6[_0x83c3('0x17')])&&_0x32b3d6[_0x83c3('0x17')][_0x83c3('0x18')]){for(var _0x2e9080=0x0;_0x2e9080<_0x32b3d6['applications'][_0x83c3('0x18')];_0x2e9080+=0x1){var _0x5368c1=_0x32b3d6[_0x83c3('0x17')][_0x2e9080];if(fs[_0x83c3('0x19')](path[_0x83c3('0x1a')](__dirname,_0x83c3('0x17'),_0x5368c1[_0x83c3('0x1b')]+_0x83c3('0x1c')))){var _0x169155=[];switch(_0x5368c1[_0x83c3('0x1b')][_0x83c3('0x1d')]()){case _0x83c3('0x1e'):var _0x3e3918=_0x5368c1[_0x83c3('0x1f')][_0x83c3('0x20')](',');_0x169155[_0x83c3('0x21')](_0x3e3918[0x0]);_0x169155['push'](_0x3e3918['slice'](0x1,_0x3e3918[_0x83c3('0x18')])[_0x83c3('0x1a')](','));break;case _0x83c3('0x22'):var _0x4567c=_0x5368c1[_0x83c3('0x1f')]['split'](',');_0x169155[_0x83c3('0x21')](_0x4567c[0x0]);_0x169155['push'](_0x4567c[0x1]);_0x169155['push'](_0x4567c['slice'](0x2,_0x4567c[_0x83c3('0x18')])[_0x83c3('0x1a')](','));break;case _0x83c3('0x23'):var _0x2a3196=_0x5368c1[_0x83c3('0x1f')][_0x83c3('0x20')](',');_0x169155[_0x83c3('0x21')](_0x2a3196[0x0]);_0x169155[_0x83c3('0x21')](_0x2a3196[0x1]);_0x169155['push'](_0x2a3196[0x2]);_0x169155[_0x83c3('0x21')](_0x2a3196[0x3]);_0x169155[_0x83c3('0x21')](_0x2a3196[_0x83c3('0x24')](0x4,_0x2a3196[_0x83c3('0x18')])[_0x83c3('0x1a')](','));break;case _0x83c3('0x15'):_0x169155['push'](_0x5368c1['appdata']);break;case _0x83c3('0x25'):_0x169155[_0x83c3('0x21')](_0x5368c1['TagId']);_0x169155[_0x83c3('0x21')](_0x5368c1['appdata']);break;default:_0x169155=_[_0x83c3('0xe')](_0x5368c1['appdata'])?[]:_0x5368c1['appdata'][_0x83c3('0x20')](',');}var _0x1eaab3={'id':util[_0x83c3('0xc')](_0x83c3('0x26'),_0x54b31b,_0x5368c1['id'],_0x5368c1['app']),'condition':require(_0x83c3('0x27'))[_0x83c3('0x28')](_0x54b31b,getIntervals(_0x2c3053[_0x83c3('0x29')],_0x5368c1),_0x2c3053),'consequence':require(_0x83c3('0x2a')+_0x5368c1['app'])[_0x83c3('0x2b')](_0x54b31b,_0x169155,_0x2c3053,_0x32b3d6),'p':_0x5368c1[_0x83c3('0x2c')]||0x0};logger[_0x83c3('0x2d')](_0x83c3('0x2e'),_0x1eaab3['id'],_0x83c3('0x2f'),getIntervals(_0x2c3053[_0x83c3('0x29')],_0x5368c1)[_0x83c3('0x1a')](_0x83c3('0x30')));_0x210eb7[_0x83c3('0x21')](_0x1eaab3);}else{logger['error'](_0x83c3('0x31'),path[_0x83c3('0x1a')](__dirname,_0x83c3('0x17'),_0x5368c1['app']+_0x83c3('0x1c')));}}_0x2c3053[_0x83c3('0x13')][_0x54b31b]=new RuleEngine(_0x210eb7);_0x2c3053['rules'][_0x54b31b][_0x83c3('0x32')](_0x32b3d6,function(_0x27378f){logger[_0x83c3('0x2d')]('Applications\x20executed',JSON['stringify'](_0x27378f[_0x83c3('0x33')]));if(_0x2c3053[_0x83c3('0x13')][_0x54b31b]){_0x2c3053[_0x83c3('0x13')][_0x54b31b]['emit']('complete');}});return _0x2ab77c({'code':0xc8,'message':_0x32b3d6});}else{logger[_0x83c3('0x2d')](_0x83c3('0x34'));return _0x2ab77c({'code':0xc8,'message':_0x32b3d6});}}catch(_0x704a02){logger[_0x83c3('0x35')](_0x704a02[_0x83c3('0x36')]);return _0x4952bc(_0x12b349['error'](0x1f4,_0x704a02));}}return _0x4952bc(_0x83c3('0x37'));});},'AcceptMessage':function(_0x5f0ed2){var _0x503965=this;return new Promise(function(_0x30b216,_0x1736db){if(_0x5f0ed2['message']&&_0x5f0ed2[_0x83c3('0x15')]['id']){try{var _0x491074=getId(_0x5f0ed2[_0x83c3('0x14')],_0x5f0ed2[_0x83c3('0x15')]?_0x5f0ed2[_0x83c3('0x15')]['id']:0x0,_0x5f0ed2[_0x83c3('0x16')]?_0x5f0ed2['interaction']['id']:0x0);if(_0x2c3053[_0x83c3('0x13')][_0x491074]){_0x2c3053[_0x83c3('0x13')][_0x491074][_0x83c3('0x38')](_0x83c3('0x39'));if(rpc[_0x5f0ed2[_0x83c3('0x14')]+_0x83c3('0x3a')]){rpc[_0x5f0ed2[_0x83c3('0x14')]+_0x83c3('0x3a')][_0x83c3('0x3b')](_0x491074,{'UserId':_0x5f0ed2['message'][_0x83c3('0x3c')]})[_0x83c3('0x3d')](function(_0x57a02f){logger['error']('error\x20update\x20queue\x20report');});}}return _0x30b216({'code':0xc8,'message':_0x5f0ed2});}catch(_0xba853c){logger['error'](_0xba853c[_0x83c3('0x36')]);return _0x1736db(_0x503965[_0x83c3('0x35')](0x1f4,_0xba853c));}}logger[_0x83c3('0x35')](_0x83c3('0x3e'));return _0x1736db(_0x503965[_0x83c3('0x35')](0x1f4,_0x83c3('0x3e')));});},'RejectMessage':function(_0x35f3cf){var _0x188279=this;return new Promise(function(_0x7c2c7d,_0x58e734){if(_0x35f3cf['agent']&&_0x35f3cf[_0x83c3('0x3f')]['id']){try{if(_0x2c3053[_0x83c3('0x40')][_0x35f3cf[_0x83c3('0x3f')]['id']]){_0x2c3053[_0x83c3('0x40')][_0x35f3cf[_0x83c3('0x3f')]['id']]['busy']=![];_0x2c3053[_0x83c3('0x40')][_0x35f3cf[_0x83c3('0x3f')]['id']][_0x83c3('0x41')]=undefined;}return _0x7c2c7d({'code':0xc8,'message':_0x35f3cf});}catch(_0x36fe78){logger[_0x83c3('0x35')](_0x36fe78[_0x83c3('0x36')]);return _0x58e734(_0x188279[_0x83c3('0x35')](0x1f4,_0x36fe78));}}logger['error'](_0x83c3('0x3e'));return _0x58e734(_0x188279[_0x83c3('0x35')](0x1f4,_0x83c3('0x3e')));});},'AbandonInteraction':function(_0x4b3a2a){var _0x4f574a=this;return new Promise(function(_0x16e324,_0x1d500c){if(_0x4b3a2a[_0x83c3('0x14')]&&_0x4b3a2a[_0x83c3('0x16')]&&_0x4b3a2a[_0x83c3('0x16')]['id']){try{var _0x203bb=getId(_0x4b3a2a[_0x83c3('0x14')],_0x4b3a2a[_0x83c3('0x15')]?_0x4b3a2a[_0x83c3('0x15')]['id']:0x0,_0x4b3a2a[_0x83c3('0x16')]?_0x4b3a2a[_0x83c3('0x16')]['id']:0x0);if(_0x2c3053['rules'][_0x203bb]){_0x2c3053[_0x83c3('0x13')][_0x203bb][_0x83c3('0x38')](_0x83c3('0x39'));}return _0x16e324({'code':0xc8,'message':_0x4b3a2a});}catch(_0x88a919){logger[_0x83c3('0x35')](_0x88a919['stack']);return _0x1d500c(_0x4f574a[_0x83c3('0x35')](0x1f4,_0x88a919));}}logger['error']('message\x20is\x20empty');return _0x1d500c(_0x4f574a[_0x83c3('0x35')](0x1f4,_0x83c3('0x3e')));});},'AgentCapacity':function(_0x16f5f6){var _0x333ef7=this;return new Promise(function(_0x524902,_0x4f3fa0){if(_0x2c3053[_0x83c3('0x40')][_0x83c3('0x42')](_0x16f5f6['id'])){for(var _0x40e82d in _0x16f5f6[_0x83c3('0x43')]){if(_0x16f5f6[_0x83c3('0x43')][_0x83c3('0x42')](_0x40e82d)){if(_0x2c3053[_0x83c3('0x40')][_0x16f5f6['id']][_0x83c3('0x42')](_0x40e82d+_0x83c3('0x44'))){_0x2c3053[_0x83c3('0x40')][_0x16f5f6['id']][_0x40e82d+'CurrentCapacity']=parseInt(_0x16f5f6[_0x83c3('0x43')][_0x40e82d],0xa);}}}_0x2c3053[_0x83c3('0x40')][_0x16f5f6['id']]['updateRealtime']();return _0x524902({'code':0xc8,'message':_0x2c3053['agents'][_0x16f5f6['id']]});}else{return _0x4f3fa0(_0x333ef7[_0x83c3('0x35')](0x1f4,_0x83c3('0x45')));}});},'Agents':function(_0x3f80b4){return new Promise(function(_0x413827,_0xb1345b){var _0x582a12=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x40')]);_0x413827({'count':_0x582a12['length'],'rows':_0x582a12});});},'ChatQueues':function(_0x4e4f15){return new Promise(function(_0x5646f7,_0x58d3e6){var _0xaea033=[];for(var _0x1484f0 in _0x2c3053[_0x83c3('0x47')]){if(_0x2c3053['chatQueues'][_0x83c3('0x42')](_0x1484f0)){var _0x1aa44b=_0x2c3053[_0x83c3('0x47')][_0x1484f0];var _0xe043dc={'id':_0x1aa44b['id'],'available':_0x1aa44b[_0x83c3('0x48')],'loggedIn':_0x1aa44b['loggedIn'],'name':_0x1aa44b[_0x83c3('0x49')],'paused':_0x1aa44b[_0x83c3('0x4a')],'waiting':_0x1aa44b['waiting']};_0xaea033[_0x83c3('0x21')](_0xe043dc);}}_0x5646f7({'count':_0xaea033[_0x83c3('0x18')],'rows':_0xaea033});});},'MailQueues':function(_0x903fc0){return new Promise(function(_0x1faf88,_0x259161){var _0x48d214=[];for(var _0x352087 in _0x2c3053[_0x83c3('0x4b')]){if(_0x2c3053['mailQueues'][_0x83c3('0x42')](_0x352087)){var _0x5e1e21=_0x2c3053['mailQueues'][_0x352087];var _0x4c9b8d={'id':_0x5e1e21['id'],'available':_0x5e1e21[_0x83c3('0x48')],'loggedIn':_0x5e1e21[_0x83c3('0x4c')],'name':_0x5e1e21[_0x83c3('0x49')],'paused':_0x5e1e21[_0x83c3('0x4a')],'waiting':_0x5e1e21[_0x83c3('0x4d')]};_0x48d214[_0x83c3('0x21')](_0x4c9b8d);}}_0x1faf88({'count':_0x48d214[_0x83c3('0x18')],'rows':_0x48d214});});},'OpenchannelQueues':function(_0x2db774){return new Promise(function(_0x4044e9,_0x4c64c4){var _0x4873cf=[];for(var _0x2754e9 in _0x2c3053[_0x83c3('0x4e')]){if(_0x2c3053[_0x83c3('0x4e')]['hasOwnProperty'](_0x2754e9)){var _0x1052e7=_0x2c3053[_0x83c3('0x4e')][_0x2754e9];var _0x451b1b={'id':_0x1052e7['id'],'available':_0x1052e7[_0x83c3('0x48')],'loggedIn':_0x1052e7[_0x83c3('0x4c')],'name':_0x1052e7[_0x83c3('0x49')],'paused':_0x1052e7[_0x83c3('0x4a')],'waiting':_0x1052e7['waiting']};_0x4873cf[_0x83c3('0x21')](_0x451b1b);}}_0x4044e9({'count':_0x4873cf['length'],'rows':_0x4873cf});});},'SmsQueues':function(_0x1ff005){return new Promise(function(_0xb2720c,_0xda114e){var _0x5730e9=[];for(var _0x4dee61 in _0x2c3053[_0x83c3('0x4f')]){if(_0x2c3053[_0x83c3('0x4f')][_0x83c3('0x42')](_0x4dee61)){var _0x532c12=_0x2c3053[_0x83c3('0x4f')][_0x4dee61];var _0x5a872a={'id':_0x532c12['id'],'available':_0x532c12[_0x83c3('0x48')],'loggedIn':_0x532c12[_0x83c3('0x4c')],'name':_0x532c12[_0x83c3('0x49')],'paused':_0x532c12[_0x83c3('0x4a')],'waiting':_0x532c12['waiting']};_0x5730e9[_0x83c3('0x21')](_0x5a872a);}}_0xb2720c({'count':_0x5730e9[_0x83c3('0x18')],'rows':_0x5730e9});});},'FaxQueues':function(_0x55783a){return new Promise(function(_0x5595e0,_0x4878a9){var _0x43129b=[];for(var _0x26301b in _0x2c3053[_0x83c3('0x50')]){if(_0x2c3053[_0x83c3('0x50')][_0x83c3('0x42')](_0x26301b)){var _0x4db307=_0x2c3053[_0x83c3('0x50')][_0x26301b];var _0x3101ea={'id':_0x4db307['id'],'available':_0x4db307[_0x83c3('0x48')],'loggedIn':_0x4db307['loggedIn'],'name':_0x4db307[_0x83c3('0x49')],'paused':_0x4db307[_0x83c3('0x4a')],'waiting':_0x4db307[_0x83c3('0x4d')]};_0x43129b[_0x83c3('0x21')](_0x3101ea);}}_0x5595e0({'count':_0x43129b[_0x83c3('0x18')],'rows':_0x43129b});});},'WhatsappQueues':function(_0x586558){return new Promise(function(_0x57aa93,_0x10fc16){var _0x5e9044=[];for(var _0x5f33df in _0x2c3053[_0x83c3('0x51')]){if(_0x2c3053[_0x83c3('0x51')]['hasOwnProperty'](_0x5f33df)){var _0x17c3f9=_0x2c3053['whatsappQueues'][_0x5f33df];var _0x2c73d4={'id':_0x17c3f9['id'],'available':_0x17c3f9[_0x83c3('0x48')],'loggedIn':_0x17c3f9[_0x83c3('0x4c')],'name':_0x17c3f9[_0x83c3('0x49')],'paused':_0x17c3f9[_0x83c3('0x4a')],'waiting':_0x17c3f9['waiting']};_0x5e9044[_0x83c3('0x21')](_0x2c73d4);}}_0x57aa93({'count':_0x5e9044[_0x83c3('0x18')],'rows':_0x5e9044});});},'ChatQueuesWaitingInteractions':function(_0x18ecff){return new Promise(function(_0x298435,_0x3683cb){var _0x2cabd4=_[_0x83c3('0x46')](_0x2c3053['chatQueuesWaitingInteractions']);_0x298435({'count':_0x2cabd4[_0x83c3('0x18')],'rows':_0x2cabd4});});},'MailQueuesWaitingInteractions':function(_0x5180e1){return new Promise(function(_0x3d159a,_0x4155da){var _0x234308=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x52')]);_0x3d159a({'count':_0x234308[_0x83c3('0x18')],'rows':_0x234308});});},'OpenchannelQueuesWaitingInteractions':function(_0x2e29e3){return new Promise(function(_0xfc2906,_0x530d68){var _0x3ee1de=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x53')]);_0xfc2906({'count':_0x3ee1de[_0x83c3('0x18')],'rows':_0x3ee1de});});},'SmsQueuesWaitingInteractions':function(_0x586aca){return new Promise(function(_0x43a13a,_0x1001bb){var _0x54cb9d=_['values'](_0x2c3053['smsQueuesWaitingInteractions']);_0x43a13a({'count':_0x54cb9d[_0x83c3('0x18')],'rows':_0x54cb9d});});},'FaxQueuesWaitingInteractions':function(_0x12ce51){return new Promise(function(_0x273393,_0x17d09c){var _0x1fd996=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x54')]);_0x273393({'count':_0x1fd996[_0x83c3('0x18')],'rows':_0x1fd996});});},'WhatsappQueuesWaitingInteractions':function(_0x311d79){return new Promise(function(_0x54d0b4,_0x7c5b70){var _0xe8c5a=_[_0x83c3('0x46')](_0x2c3053[_0x83c3('0x55')]);_0x54d0b4({'count':_0xe8c5a[_0x83c3('0x18')],'rows':_0xe8c5a});});}};var _0x14a6ee=jayson[_0x83c3('0x56')](_0x17fecd)[_0x83c3('0x57')]();_0x14a6ee['on'](_0x83c3('0x35'),function(_0x3b9b8f){logger[_0x83c3('0x35')](JSON[_0x83c3('0x58')](_0x3b9b8f));return _0x253db5(_0x3b9b8f);});_0x14a6ee[_0x83c3('0x59')](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2acce9(_0x83c3('0x5a')+0x232c);});});}; \ No newline at end of file +var _0x2737=['mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','Intervals','map','IntervalId','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','rules','emit','complete','end','UserId','error\x20update\x20queue\x20report','stack','agent','agents','busy','busyQueue','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','name','mailQueues','waiting','openchannelQueues','available','smsQueues','loggedIn','paused','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions'];(function(_0x410a2b,_0x4e3c0d){var _0x5b3031=function(_0x1220ee){while(--_0x1220ee){_0x410a2b['push'](_0x410a2b['shift']());}};_0x5b3031(++_0x4e3c0d);}(_0x2737,0x1da));var _0x7273=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2737[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7273('0x0'));var util=require('util');var path=require(_0x7273('0x1'));var fs=require('fs');var jayson=require(_0x7273('0x2'));var BPromise=require(_0x7273('0x3'));var uuid=require(_0x7273('0x4'));var config=require(_0x7273('0x5'));var logger=require(_0x7273('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x7273('0x7')),'mailQueueReport':require(_0x7273('0x8')),'chatQueueReport':require(_0x7273('0x9')),'smsQueueReport':require(_0x7273('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x7273('0xb'))};var RuleEngine=require(_0x7273('0xc'));function getId(_0x2d2c96,_0x4a49db,_0x62d140){return util[_0x7273('0xd')](_0x7273('0xe'),_0x2d2c96,_0x4a49db||0x0,_0x62d140||0x0);}function getIntervals(_0x3849d8,_0x3b3206){var _0x2a7e8a=[];if(!_['isNil'](_0x3b3206['IntervalId'])&&!_['isNil'](_0x3849d8[_0x3b3206['IntervalId']])&&!_[_0x7273('0xf')](_0x3849d8[_0x3b3206['IntervalId']][_0x7273('0x10')])){_0x2a7e8a=_[_0x7273('0x11')](_0x3849d8[_0x3b3206[_0x7273('0x12')]][_0x7273('0x10')],_0x7273('0x13'));}else if(!_[_0x7273('0xf')](_0x3b3206['interval'])){_0x2a7e8a=[_0x3b3206[_0x7273('0x13')]];}return _0x2a7e8a;}exports[_0x7273('0x14')]=function(_0x402181){_0x402181['rules']={};return new BPromise(function(_0x162174,_0x2bad58){var _0x11280e={'Start':function(_0x16a177){var _0x15fb83=this;return new Promise(function(_0x5f10d8,_0x3e88f7){if(_0x16a177){try{var _0x34e703=[];var _0x5a9c88=getId(_0x16a177[_0x7273('0x15')],_0x16a177[_0x7273('0x16')]?_0x16a177[_0x7273('0x16')]['id']:0x0,_0x16a177[_0x7273('0x17')]?_0x16a177[_0x7273('0x17')]['id']:0x0);if(_0x16a177[_0x7273('0x18')]&&_[_0x7273('0x19')](_0x16a177[_0x7273('0x18')])&&_0x16a177['applications'][_0x7273('0x1a')]){for(var _0x287660=0x0;_0x287660<_0x16a177[_0x7273('0x18')][_0x7273('0x1a')];_0x287660+=0x1){var _0x54bf55=_0x16a177[_0x7273('0x18')][_0x287660];if(fs[_0x7273('0x1b')](path[_0x7273('0x1c')](__dirname,'applications',_0x54bf55[_0x7273('0x1d')]+_0x7273('0x1e')))){var _0x10a089=[];switch(_0x54bf55[_0x7273('0x1d')][_0x7273('0x1f')]()){case'autoreply':var _0x3897bf=_0x54bf55[_0x7273('0x20')][_0x7273('0x21')](',');_0x10a089['push'](_0x3897bf[0x0]);_0x10a089[_0x7273('0x22')](_0x3897bf[_0x7273('0x23')](0x1,_0x3897bf[_0x7273('0x1a')])[_0x7273('0x1c')](','));break;case'dialogflow':var _0x4b8645=_0x54bf55[_0x7273('0x20')][_0x7273('0x21')](',');_0x10a089[_0x7273('0x22')](_0x4b8645[0x0]);_0x10a089[_0x7273('0x22')](_0x4b8645[0x1]);_0x10a089[_0x7273('0x22')](_0x4b8645[_0x7273('0x23')](0x2,_0x4b8645['length'])['join'](','));break;case _0x7273('0x24'):var _0x49342d=_0x54bf55[_0x7273('0x20')][_0x7273('0x21')](',');_0x10a089[_0x7273('0x22')](_0x49342d[0x0]);_0x10a089[_0x7273('0x22')](_0x49342d[0x1]);_0x10a089['push'](_0x49342d[0x2]);_0x10a089['push'](_0x49342d[0x3]);_0x10a089[_0x7273('0x22')](_0x49342d[_0x7273('0x23')](0x4,_0x49342d[_0x7273('0x1a')])[_0x7273('0x1c')](','));break;case _0x7273('0x16'):_0x10a089[_0x7273('0x22')](_0x54bf55[_0x7273('0x20')]);break;case _0x7273('0x25'):_0x10a089[_0x7273('0x22')](_0x54bf55[_0x7273('0x26')]);_0x10a089[_0x7273('0x22')](_0x54bf55[_0x7273('0x20')]);break;default:_0x10a089=_[_0x7273('0xf')](_0x54bf55['appdata'])?[]:_0x54bf55[_0x7273('0x20')][_0x7273('0x21')](',');}var _0x11a20f={'id':util[_0x7273('0xd')](_0x7273('0x27'),_0x5a9c88,_0x54bf55['id'],_0x54bf55[_0x7273('0x1d')]),'condition':require(_0x7273('0x28'))[_0x7273('0x29')](_0x5a9c88,getIntervals(_0x402181['intervals'],_0x54bf55),_0x402181),'consequence':require('./applications/'+_0x54bf55[_0x7273('0x1d')])[_0x7273('0x2a')](_0x5a9c88,_0x10a089,_0x402181,_0x16a177),'p':_0x54bf55[_0x7273('0x2b')]||0x0};logger[_0x7273('0x2c')](_0x7273('0x2d'),_0x11a20f['id'],_0x7273('0x2e'),getIntervals(_0x402181[_0x7273('0x2f')],_0x54bf55)['join'](_0x7273('0x30')));_0x34e703['push'](_0x11a20f);}else{logger[_0x7273('0x31')](_0x7273('0x32'),path[_0x7273('0x1c')](__dirname,'applications',_0x54bf55[_0x7273('0x1d')]+_0x7273('0x1e')));}}_0x402181['rules'][_0x5a9c88]=new RuleEngine(_0x34e703);_0x402181['rules'][_0x5a9c88]['execute'](_0x16a177,function(_0x364ed8){logger['info'](_0x7273('0x33'),JSON[_0x7273('0x34')](_0x364ed8[_0x7273('0x35')]));if(_0x402181[_0x7273('0x36')][_0x5a9c88]){_0x402181['rules'][_0x5a9c88][_0x7273('0x37')](_0x7273('0x38'));}});return _0x5f10d8({'code':0xc8,'message':_0x16a177});}else{logger[_0x7273('0x2c')]('No\x20applications\x20to\x20execute');return _0x5f10d8({'code':0xc8,'message':_0x16a177});}}catch(_0x232edf){logger['error'](_0x232edf['stack']);return _0x3e88f7(_0x15fb83[_0x7273('0x31')](0x1f4,_0x232edf));}}return _0x3e88f7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5ac32a){var _0x3fc2dd=this;return new Promise(function(_0x4fb261,_0x8f32dc){if(_0x5ac32a[_0x7273('0x16')]&&_0x5ac32a[_0x7273('0x16')]['id']){try{var _0x5d8625=getId(_0x5ac32a[_0x7273('0x15')],_0x5ac32a['message']?_0x5ac32a[_0x7273('0x16')]['id']:0x0,_0x5ac32a[_0x7273('0x17')]?_0x5ac32a['interaction']['id']:0x0);if(_0x402181[_0x7273('0x36')][_0x5d8625]){_0x402181['rules'][_0x5d8625][_0x7273('0x37')](_0x7273('0x39'));if(rpc[_0x5ac32a[_0x7273('0x15')]+'QueueReport']){rpc[_0x5ac32a[_0x7273('0x15')]+'QueueReport']['update'](_0x5d8625,{'UserId':_0x5ac32a[_0x7273('0x16')][_0x7273('0x3a')]})['catch'](function(_0x1ac9f5){logger[_0x7273('0x31')](_0x7273('0x3b'));});}}return _0x4fb261({'code':0xc8,'message':_0x5ac32a});}catch(_0x48bde0){logger[_0x7273('0x31')](_0x48bde0[_0x7273('0x3c')]);return _0x8f32dc(_0x3fc2dd[_0x7273('0x31')](0x1f4,_0x48bde0));}}logger[_0x7273('0x31')]('message\x20is\x20empty');return _0x8f32dc(_0x3fc2dd[_0x7273('0x31')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x6351d7){var _0x520361=this;return new Promise(function(_0x5668d7,_0x13ccb1){if(_0x6351d7[_0x7273('0x3d')]&&_0x6351d7[_0x7273('0x3d')]['id']){try{if(_0x402181[_0x7273('0x3e')][_0x6351d7['agent']['id']]){_0x402181[_0x7273('0x3e')][_0x6351d7[_0x7273('0x3d')]['id']][_0x7273('0x3f')]=![];_0x402181[_0x7273('0x3e')][_0x6351d7[_0x7273('0x3d')]['id']][_0x7273('0x40')]=undefined;}return _0x5668d7({'code':0xc8,'message':_0x6351d7});}catch(_0x328862){logger[_0x7273('0x31')](_0x328862[_0x7273('0x3c')]);return _0x13ccb1(_0x520361[_0x7273('0x31')](0x1f4,_0x328862));}}logger[_0x7273('0x31')](_0x7273('0x41'));return _0x13ccb1(_0x520361['error'](0x1f4,_0x7273('0x41')));});},'AbandonInteraction':function(_0x10e73c){var _0x5dc894=this;return new Promise(function(_0x48bb78,_0x7223e){if(_0x10e73c[_0x7273('0x15')]&&_0x10e73c[_0x7273('0x17')]&&_0x10e73c[_0x7273('0x17')]['id']){try{var _0x13dd3a=getId(_0x10e73c[_0x7273('0x15')],_0x10e73c[_0x7273('0x16')]?_0x10e73c[_0x7273('0x16')]['id']:0x0,_0x10e73c[_0x7273('0x17')]?_0x10e73c[_0x7273('0x17')]['id']:0x0);if(_0x402181[_0x7273('0x36')][_0x13dd3a]){_0x402181[_0x7273('0x36')][_0x13dd3a][_0x7273('0x37')](_0x7273('0x39'));}return _0x48bb78({'code':0xc8,'message':_0x10e73c});}catch(_0x50d9b0){logger[_0x7273('0x31')](_0x50d9b0[_0x7273('0x3c')]);return _0x7223e(_0x5dc894[_0x7273('0x31')](0x1f4,_0x50d9b0));}}logger['error'](_0x7273('0x41'));return _0x7223e(_0x5dc894[_0x7273('0x31')](0x1f4,_0x7273('0x41')));});},'AgentCapacity':function(_0x1a15a0){var _0x26841f=this;return new Promise(function(_0x2b2f37,_0x1e43a1){if(_0x402181[_0x7273('0x3e')][_0x7273('0x42')](_0x1a15a0['id'])){for(var _0x494244 in _0x1a15a0[_0x7273('0x43')]){if(_0x1a15a0[_0x7273('0x43')][_0x7273('0x42')](_0x494244)){if(_0x402181['agents'][_0x1a15a0['id']][_0x7273('0x42')](_0x494244+_0x7273('0x44'))){_0x402181['agents'][_0x1a15a0['id']][_0x494244+_0x7273('0x44')]=parseInt(_0x1a15a0[_0x7273('0x43')][_0x494244],0xa);}}}_0x402181['agents'][_0x1a15a0['id']][_0x7273('0x45')]();return _0x2b2f37({'code':0xc8,'message':_0x402181[_0x7273('0x3e')][_0x1a15a0['id']]});}else{return _0x1e43a1(_0x26841f[_0x7273('0x31')](0x1f4,_0x7273('0x46')));}});},'Agents':function(_0x2b3266){return new Promise(function(_0x13b9c0,_0xfdf404){var _0x351245=_['values'](_0x402181[_0x7273('0x3e')]);_0x13b9c0({'count':_0x351245[_0x7273('0x1a')],'rows':_0x351245});});},'ChatQueues':function(_0xff826f){return new Promise(function(_0x1abbc4,_0x1badc2){var _0x15b787=[];for(var _0x3ddfed in _0x402181[_0x7273('0x47')]){if(_0x402181['chatQueues'][_0x7273('0x42')](_0x3ddfed)){var _0x45dc41=_0x402181[_0x7273('0x47')][_0x3ddfed];var _0x11ea50={'id':_0x45dc41['id'],'available':_0x45dc41['available'],'loggedIn':_0x45dc41['loggedIn'],'name':_0x45dc41[_0x7273('0x48')],'paused':_0x45dc41['paused'],'waiting':_0x45dc41['waiting']};_0x15b787[_0x7273('0x22')](_0x11ea50);}}_0x1abbc4({'count':_0x15b787[_0x7273('0x1a')],'rows':_0x15b787});});},'MailQueues':function(_0x421827){return new Promise(function(_0x5e83be,_0x2ee56c){var _0x1ae2f8=[];for(var _0x4f92e5 in _0x402181['mailQueues']){if(_0x402181[_0x7273('0x49')][_0x7273('0x42')](_0x4f92e5)){var _0x2538ec=_0x402181['mailQueues'][_0x4f92e5];var _0x310abf={'id':_0x2538ec['id'],'available':_0x2538ec['available'],'loggedIn':_0x2538ec['loggedIn'],'name':_0x2538ec['name'],'paused':_0x2538ec['paused'],'waiting':_0x2538ec[_0x7273('0x4a')]};_0x1ae2f8[_0x7273('0x22')](_0x310abf);}}_0x5e83be({'count':_0x1ae2f8[_0x7273('0x1a')],'rows':_0x1ae2f8});});},'OpenchannelQueues':function(_0x198dc4){return new Promise(function(_0x20a93a,_0x372b29){var _0x1c2c76=[];for(var _0x49137e in _0x402181['openchannelQueues']){if(_0x402181[_0x7273('0x4b')][_0x7273('0x42')](_0x49137e)){var _0x18011a=_0x402181[_0x7273('0x4b')][_0x49137e];var _0x16d923={'id':_0x18011a['id'],'available':_0x18011a[_0x7273('0x4c')],'loggedIn':_0x18011a['loggedIn'],'name':_0x18011a[_0x7273('0x48')],'paused':_0x18011a['paused'],'waiting':_0x18011a[_0x7273('0x4a')]};_0x1c2c76[_0x7273('0x22')](_0x16d923);}}_0x20a93a({'count':_0x1c2c76[_0x7273('0x1a')],'rows':_0x1c2c76});});},'SmsQueues':function(_0xaa09bd){return new Promise(function(_0x18878a,_0xbd7f1a){var _0x260993=[];for(var _0x125906 in _0x402181[_0x7273('0x4d')]){if(_0x402181[_0x7273('0x4d')]['hasOwnProperty'](_0x125906)){var _0x481501=_0x402181[_0x7273('0x4d')][_0x125906];var _0x2f7bf8={'id':_0x481501['id'],'available':_0x481501[_0x7273('0x4c')],'loggedIn':_0x481501[_0x7273('0x4e')],'name':_0x481501[_0x7273('0x48')],'paused':_0x481501[_0x7273('0x4f')],'waiting':_0x481501['waiting']};_0x260993[_0x7273('0x22')](_0x2f7bf8);}}_0x18878a({'count':_0x260993[_0x7273('0x1a')],'rows':_0x260993});});},'FaxQueues':function(_0x2e9bb3){return new Promise(function(_0x1be56c,_0x16ffaa){var _0x222e29=[];for(var _0x277d5f in _0x402181['faxQueues']){if(_0x402181[_0x7273('0x50')][_0x7273('0x42')](_0x277d5f)){var _0x18e8fc=_0x402181[_0x7273('0x50')][_0x277d5f];var _0x5cccd1={'id':_0x18e8fc['id'],'available':_0x18e8fc[_0x7273('0x4c')],'loggedIn':_0x18e8fc['loggedIn'],'name':_0x18e8fc[_0x7273('0x48')],'paused':_0x18e8fc[_0x7273('0x4f')],'waiting':_0x18e8fc['waiting']};_0x222e29[_0x7273('0x22')](_0x5cccd1);}}_0x1be56c({'count':_0x222e29[_0x7273('0x1a')],'rows':_0x222e29});});},'WhatsappQueues':function(_0x162ecd){return new Promise(function(_0xe4b08f,_0x40c69f){var _0x40f33b=[];for(var _0x47f07c in _0x402181[_0x7273('0x51')]){if(_0x402181['whatsappQueues'][_0x7273('0x42')](_0x47f07c)){var _0x4065b2=_0x402181[_0x7273('0x51')][_0x47f07c];var _0x48f238={'id':_0x4065b2['id'],'available':_0x4065b2[_0x7273('0x4c')],'loggedIn':_0x4065b2[_0x7273('0x4e')],'name':_0x4065b2[_0x7273('0x48')],'paused':_0x4065b2['paused'],'waiting':_0x4065b2['waiting']};_0x40f33b[_0x7273('0x22')](_0x48f238);}}_0xe4b08f({'count':_0x40f33b[_0x7273('0x1a')],'rows':_0x40f33b});});},'ChatQueuesWaitingInteractions':function(_0x45610d){return new Promise(function(_0x3f6be9,_0x279968){var _0xb69e80=_[_0x7273('0x52')](_0x402181[_0x7273('0x53')]);_0x3f6be9({'count':_0xb69e80[_0x7273('0x1a')],'rows':_0xb69e80});});},'MailQueuesWaitingInteractions':function(_0x302f24){return new Promise(function(_0x452715,_0x48bea6){var _0x5bdaa4=_[_0x7273('0x52')](_0x402181[_0x7273('0x54')]);_0x452715({'count':_0x5bdaa4['length'],'rows':_0x5bdaa4});});},'OpenchannelQueuesWaitingInteractions':function(_0x26ffe1){return new Promise(function(_0x1c38c3,_0x449623){var _0x252003=_[_0x7273('0x52')](_0x402181['openchannelQueuesWaitingInteractions']);_0x1c38c3({'count':_0x252003[_0x7273('0x1a')],'rows':_0x252003});});},'SmsQueuesWaitingInteractions':function(_0x323517){return new Promise(function(_0x376d13,_0x5772cc){var _0x2c6516=_[_0x7273('0x52')](_0x402181[_0x7273('0x55')]);_0x376d13({'count':_0x2c6516['length'],'rows':_0x2c6516});});},'FaxQueuesWaitingInteractions':function(_0x124dc3){return new Promise(function(_0x48572c,_0x3ce8de){var _0x451096=_[_0x7273('0x52')](_0x402181[_0x7273('0x56')]);_0x48572c({'count':_0x451096[_0x7273('0x1a')],'rows':_0x451096});});},'WhatsappQueuesWaitingInteractions':function(_0x2d5f23){return new Promise(function(_0x5e597b,_0x592ca5){var _0x432735=_['values'](_0x402181[_0x7273('0x57')]);_0x5e597b({'count':_0x432735[_0x7273('0x1a')],'rows':_0x432735});});}};var _0x410f34=jayson['server'](_0x11280e)[_0x7273('0x58')]();_0x410f34['on'](_0x7273('0x31'),function(_0xb1a58b){logger['error'](JSON[_0x7273('0x34')](_0xb1a58b));return _0x2bad58(_0xb1a58b);});_0x410f34[_0x7273('0x14')](0x232c,_0x7273('0x59'),function(){console[_0x7273('0x5a')](_0x7273('0x5b'),0x232c);return _0x162174(_0x7273('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 1dcfa05..f5adf4d 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 _0x74e9=['iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','lodash','../../../config/logger','routing','client','http','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format'];(function(_0x30f84f,_0x15f853){var _0x55423f=function(_0x573900){while(--_0x573900){_0x30f84f['push'](_0x30f84f['shift']());}};_0x55423f(++_0x15f853);}(_0x74e9,0xac));var _0x974e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x74e9[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x974e('0x0'));var logger=require(_0x974e('0x1'))(_0x974e('0x2'));var client=jayson[_0x974e('0x3')][_0x974e('0x4')]({'port':0x232a});function request(_0x685486,_0x4d52c6){return new BPromise(function(_0x8a18ab,_0x4b9354){return client['request'](_0x685486,_0x4d52c6)['then'](function(_0x2525e7){if(_0x2525e7[_0x974e('0x5')]){return _0x4b9354(_0x2525e7[_0x974e('0x5')][_0x974e('0x6')]);}else{return _0x8a18ab(_0x2525e7[_0x974e('0x7')]);}})[_0x974e('0x8')](function(_0x2e1c6b){return _0x4b9354(_0x2e1c6b);});});}exports[_0x974e('0x9')]=function(_0x5e0ff7,_0x178978,_0x2a2890){return function(_0x563c68){if(_0x2a2890[_0x974e('0xa')]&&!_0x2a2890[_0x974e('0xa')][_0x5e0ff7]){logger[_0x974e('0xb')](_0x974e('0xc'),_0x5e0ff7);return _0x563c68[_0x974e('0xd')]();}var _0x37e75b=[];for(var _0x3fe48c=0x0;_0x3fe48c<_0x178978['length'];_0x3fe48c+=0x1){_0x37e75b[_0x974e('0xe')](request(_0x974e('0xf'),{'command':util[_0x974e('0x10')](_0x974e('0x11'),_0x178978[_0x3fe48c])})[_0x974e('0x12')](function(_0x30b02d){return _0x30b02d&&_0x30b02d['message']&&_0x30b02d[_0x974e('0x6')][_0x974e('0x13')](_0x974e('0x14'))>=0x0?!![]:![];})[_0x974e('0x8')](function(_0x4723c7){logger[_0x974e('0x5')](_0x974e('0x15'),_0x5e0ff7,_0x178978[_0x3fe48c]);}));}BPromise['all'](_0x37e75b)[_0x974e('0x12')](function(_0x42ca1e){var _0x2bec64=_[_0x974e('0x16')](_0x42ca1e);logger['info'](_0x974e('0x17'),_0x5e0ff7,_0x178978[_0x974e('0x18')]('\x20|\x20'),_0x2bec64);_0x563c68['when'](_0x2bec64);})[_0x974e('0x8')](function(_0x102625){console['log'](_0x102625);logger[_0x974e('0x5')](_0x974e('0x17'),_0x5e0ff7,_0x178978[_0x974e('0x18')](_0x974e('0x19')),_0x102625[_0x974e('0x1a')]);_0x563c68[_0x974e('0xd')]();});};}; \ No newline at end of file +var _0x161d=['message','indexOf','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','util','lodash','routing','client','http','request','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','then'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x161d,0x90));var _0xd161=function(_0x194242,_0x5b813a){_0x194242=_0x194242-0x0;var _0x2bb6c8=_0x161d[_0x194242];return _0x2bb6c8;};'use strict';var util=require(_0xd161('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0xd161('0x1'));var logger=require('../../../config/logger')(_0xd161('0x2'));var client=jayson[_0xd161('0x3')][_0xd161('0x4')]({'port':0x232a});function request(_0x1996b4,_0x3cdd82){return new BPromise(function(_0x517cae,_0x2fc728){return client[_0xd161('0x5')](_0x1996b4,_0x3cdd82)['then'](function(_0x1a5ae9){if(_0x1a5ae9['error']){return _0x2fc728(_0x1a5ae9[_0xd161('0x6')]['message']);}else{return _0x517cae(_0x1a5ae9['result']);}})[_0xd161('0x7')](function(_0x5df54a){return _0x2fc728(_0x5df54a);});});}exports[_0xd161('0x8')]=function(_0x5d39e0,_0x5563d0,_0x7ce032){return function(_0x41f748){if(_0x7ce032[_0xd161('0x9')]&&!_0x7ce032[_0xd161('0x9')][_0x5d39e0]){logger[_0xd161('0xa')](_0xd161('0xb'),_0x5d39e0);return _0x41f748[_0xd161('0xc')]();}var _0x46a905=[];for(var _0x4a0be9=0x0;_0x4a0be9<_0x5563d0[_0xd161('0xd')];_0x4a0be9+=0x1){_0x46a905[_0xd161('0xe')](request(_0xd161('0xf'),{'command':util[_0xd161('0x10')]('iftime\x20%s',_0x5563d0[_0x4a0be9])})[_0xd161('0x11')](function(_0x15d020){return _0x15d020&&_0x15d020[_0xd161('0x12')]&&_0x15d020[_0xd161('0x12')][_0xd161('0x13')]('true')>=0x0?!![]:![];})['catch'](function(_0x11a24a){logger['error'](_0xd161('0x14'),_0x5d39e0,_0x5563d0[_0x4a0be9]);}));}BPromise[_0xd161('0x15')](_0x46a905)[_0xd161('0x11')](function(_0x7c71c6){var _0x1ea5e3=_['some'](_0x7c71c6);logger[_0xd161('0xa')](_0xd161('0x16'),_0x5d39e0,_0x5563d0[_0xd161('0x17')]('\x20|\x20'),_0x1ea5e3);_0x41f748[_0xd161('0x18')](_0x1ea5e3);})[_0xd161('0x7')](function(_0x25dcf2){console[_0xd161('0x19')](_0x25dcf2);logger[_0xd161('0x6')](_0xd161('0x16'),_0x5d39e0,_0x5563d0[_0xd161('0x17')](_0xd161('0x1a')),_0x25dcf2['stack']);_0x41f748[_0xd161('0xc')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 743eb05..db69081 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 _0x5c69=['clone','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice','agentcompleteAt','agent','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','destuniqueid','agentcalledAt','now','lastevent','connectedlinename','stack','agentringnoanswer','isNil','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','error','queuecallerabandon','forIn','includes','abandoned','agentconnect','agentconnectAt','connectedlinenum','connect','answered_elsewhere','answeredelsewheremembername','diffTime','complete','transfereruniqueid','transfertype','blind','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid'];(function(_0x2f9f80,_0x51aa43){var _0x2d690a=function(_0x594001){while(--_0x594001){_0x2f9f80['push'](_0x2f9f80['shift']());}};_0x2d690a(++_0x51aa43);}(_0x5c69,0xe9));var _0x95c6=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x5c69[_0xac151d];return _0x111dba;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x34c20d,_0x1b1420){utils[_0x95c6('0x0')](util[_0x95c6('0x1')](_0x95c6('0x2'),_0x34c20d[_0x95c6('0x3')],_0x34c20d[_0x95c6('0x4')],_0x34c20d[_0x95c6('0x5')],_0x34c20d[_0x95c6('0x6')],_0x34c20d[_0x95c6('0x7')],_0x34c20d['calleridnum'],_0x34c20d['connectedlinenum'],_0x34c20d['lastevent']));if(_0x34c20d[_0x95c6('0x5')]){utils[_0x95c6('0x8')](_0x34c20d[_0x95c6('0x5')])[_0x95c6('0x9')](function(_0x14a580){if(_0x14a580){_0x34c20d['type']=_0x14a580[_0x95c6('0xa')];_0x34c20d['agentacw']=_0x34c20d[_0x95c6('0xb')]?_0x14a580[_0x95c6('0xc')]:![];_0x34c20d[_0x95c6('0xd')]=_0x34c20d['agentacw']?_0x14a580[_0x95c6('0xe')]:0x0;}utils['request'](_0x95c6('0xf'),_0x34c20d);});}else{utils[_0x95c6('0x10')]('CreateVoiceAgentReport',_0x34c20d);}if(_0x1b1420){delete transfers[_0x34c20d[_0x95c6('0x3')]];}else{delete agents[_0x34c20d['destuniqueid']];}}exports[_0x95c6('0x11')]=function(_0x2c5bc1){try{agents[_0x2c5bc1[_0x95c6('0x12')]]=_0x2c5bc1;agents[_0x2c5bc1['destuniqueid']][_0x95c6('0x13')]=utils[_0x95c6('0x14')]();agents[_0x2c5bc1[_0x95c6('0x12')]][_0x95c6('0x15')]='called';agents[_0x2c5bc1[_0x95c6('0x12')]]['connectedlinenum']=null;agents[_0x2c5bc1[_0x95c6('0x12')]][_0x95c6('0x16')]=null;}catch(_0x47a520){utils['error'](_0x47a520[_0x95c6('0x17')]);}};exports[_0x95c6('0x18')]=function(_0x2fc371){try{if(!_[_0x95c6('0x19')](agents[_0x2fc371['destuniqueid']])){agents[_0x2fc371[_0x95c6('0x12')]]['agentringnoanswer']=!![];agents[_0x2fc371[_0x95c6('0x12')]][_0x95c6('0x1a')]=utils[_0x95c6('0x14')]();agents[_0x2fc371[_0x95c6('0x12')]]['lastevent']='timeout';agents[_0x2fc371[_0x95c6('0x12')]][_0x95c6('0x1b')]=_0x95c6('0x1c');agents[_0x2fc371[_0x95c6('0x12')]][_0x95c6('0x1d')]=_0x2fc371[_0x95c6('0x1e')]?parseInt(_0x2fc371['ringtime'])/0x3e8:0x0;agents[_0x2fc371['destuniqueid']][_0x95c6('0x1f')]=0x0;unanswered['push'](_0x2fc371[_0x95c6('0x12')]);}}catch(_0x16b236){utils[_0x95c6('0x20')](_0x16b236[_0x95c6('0x17')]);}};exports[_0x95c6('0x21')]=function(_0x432e16){try{_[_0x95c6('0x22')](agents,function(_0xcc82a5,_0x32a504){if(_0xcc82a5[_0x95c6('0x3')]==_0x432e16[_0x95c6('0x3')]&&!_[_0x95c6('0x23')](unanswered,_0xcc82a5[_0x95c6('0x12')])){_0xcc82a5['agentringnoanswer']=!![];_0xcc82a5[_0x95c6('0x1a')]=utils[_0x95c6('0x14')]();_0xcc82a5['lastevent']=_0x95c6('0x24');_0xcc82a5['reason']='abandoned';_0xcc82a5['holdtime']=_0x432e16[_0x95c6('0x1d')];_0xcc82a5[_0x95c6('0x1f')]=0x0;writeDB(_0xcc82a5);}});}catch(_0x52944e){utils['error'](_0x52944e[_0x95c6('0x17')]);}};exports[_0x95c6('0x25')]=function(_0x312946){try{if(agents[_0x312946['destuniqueid']]){agents[_0x312946[_0x95c6('0x12')]][_0x95c6('0x26')]=utils['now']();agents[_0x312946[_0x95c6('0x12')]][_0x95c6('0x27')]=_0x312946[_0x95c6('0x27')];agents[_0x312946[_0x95c6('0x12')]]['connectedlinename']=_0x312946['connectedlinename'];agents[_0x312946[_0x95c6('0x12')]]['holdtime']=_0x312946['ringtime'];agents[_0x312946[_0x95c6('0x12')]][_0x95c6('0x15')]=_0x95c6('0x28');_[_0x95c6('0x22')](agents,function(_0x43bbab,_0x321d96){if(_0x43bbab['destuniqueid']!=_0x312946['destuniqueid']&&_0x43bbab[_0x95c6('0x3')]==_0x312946[_0x95c6('0x3')]){_0x43bbab[_0x95c6('0x1f')]=0x0;_0x43bbab[_0x95c6('0x1d')]=_0x312946[_0x95c6('0x1e')];_0x43bbab['agentringnoanswer']=!![];_0x43bbab['agentringnoanswerAt']=utils[_0x95c6('0x14')]();_0x43bbab[_0x95c6('0x15')]=_0x95c6('0x29');_0x43bbab[_0x95c6('0x1b')]=_0x95c6('0x29');_0x43bbab['answeredelsewheredestinationuniqueid']=_0x312946[_0x95c6('0x12')];_0x43bbab[_0x95c6('0x2a')]=_0x312946[_0x95c6('0x6')];writeDB(_0x43bbab);}});}}catch(_0x131a99){utils[_0x95c6('0x20')](_0x131a99[_0x95c6('0x17')]);}};exports[_0x95c6('0xb')]=function(_0x734018){try{if(!_[_0x95c6('0x19')](agents[_0x734018[_0x95c6('0x12')]])){agents[_0x734018[_0x95c6('0x12')]][_0x95c6('0xb')]=!![];agents[_0x734018[_0x95c6('0x12')]]['agentcompleteAt']=utils[_0x95c6('0x14')]();agents[_0x734018[_0x95c6('0x12')]][_0x95c6('0x1f')]=utils[_0x95c6('0x2b')](agents[_0x734018[_0x95c6('0x12')]]['agentcompleteAt'],agents[_0x734018['destuniqueid']][_0x95c6('0x26')]);agents[_0x734018[_0x95c6('0x12')]][_0x95c6('0x1b')]=_0x734018[_0x95c6('0x1b')];agents[_0x734018[_0x95c6('0x12')]]['lastevent']=_0x95c6('0x2c');writeDB(agents[_0x734018[_0x95c6('0x12')]]);}}catch(_0x49e5fe){utils[_0x95c6('0x20')](_0x49e5fe[_0x95c6('0x17')]);}};exports['blindtransfer']=function(_0x829eb0){try{if(!_['isNil'](agents[_0x829eb0[_0x95c6('0x2d')]])){agents[_0x829eb0[_0x95c6('0x2d')]]['transfer']=!![];agents[_0x829eb0[_0x95c6('0x2d')]][_0x95c6('0x2e')]=_0x95c6('0x2f');agents[_0x829eb0[_0x95c6('0x2d')]][_0x95c6('0x30')]=_0x829eb0[_0x95c6('0x31')];agents[_0x829eb0['transfereruniqueid']]['transferuniqueid']=agents[_0x829eb0[_0x95c6('0x2d')]]['uniqueid'];}}catch(_0x2e2f21){utils['error'](_0x2e2f21[_0x95c6('0x17')]);}};exports[_0x95c6('0x32')]=function(_0x38c3f2){try{if(_0x38c3f2[_0x95c6('0x33')]==_0x38c3f2[_0x95c6('0x34')]){if(!_[_0x95c6('0x19')](agents[_0x38c3f2[_0x95c6('0x35')]])){agents[_0x38c3f2['secondtransfereruniqueid']][_0x95c6('0x36')]=!![];agents[_0x38c3f2[_0x95c6('0x35')]][_0x95c6('0x2e')]=_0x95c6('0x37');agents[_0x38c3f2[_0x95c6('0x35')]][_0x95c6('0x30')]=_0x38c3f2[_0x95c6('0x38')];agents[_0x38c3f2['secondtransfereruniqueid']][_0x95c6('0x39')]=_0x38c3f2[_0x95c6('0x33')];}if(_0x38c3f2[_0x95c6('0x3a')]&&agents[_0x38c3f2[_0x95c6('0x3a')]]){agents[_0x38c3f2[_0x95c6('0x3a')]]['agententerreason']=0x1;transfers[_0x38c3f2[_0x95c6('0x3a')]]=_[_0x95c6('0x3b')](agents[_0x38c3f2['transfereeuniqueid']]);transfers[_0x38c3f2[_0x95c6('0x3a')]]['calleridnum']=agents[_0x38c3f2[_0x95c6('0x35')]][_0x95c6('0x3c')];transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x3d')]=agents[_0x38c3f2['secondtransfereruniqueid']][_0x95c6('0x3d')];transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x13')]=utils[_0x95c6('0x14')]();transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x26')]=utils[_0x95c6('0x14')]();transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x1d')]=0x0;transfers[_0x38c3f2[_0x95c6('0x3a')]][_0x95c6('0x3e')]=0x2;}}else if(_0x38c3f2[_0x95c6('0x35')]==_0x38c3f2[_0x95c6('0x3f')]){if(!_['isNil'](agents[_0x38c3f2[_0x95c6('0x33')]])){agents[_0x38c3f2[_0x95c6('0x33')]][_0x95c6('0x36')]=!![];agents[_0x38c3f2['origtransfereruniqueid']][_0x95c6('0x2e')]=_0x95c6('0x37');agents[_0x38c3f2['origtransfereruniqueid']][_0x95c6('0x30')]=_0x38c3f2[_0x95c6('0x40')];agents[_0x38c3f2['origtransfereruniqueid']][_0x95c6('0x39')]=_0x38c3f2[_0x95c6('0x35')];}if(_0x38c3f2[_0x95c6('0x41')]&&agents[_0x38c3f2[_0x95c6('0x41')]]){agents[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x3e')]=0x1;transfers[_0x38c3f2[_0x95c6('0x41')]]=_['clone'](agents[_0x38c3f2[_0x95c6('0x41')]]);transfers[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x3c')]=agents[_0x38c3f2[_0x95c6('0x33')]][_0x95c6('0x3c')];transfers[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x3d')]=agents[_0x38c3f2[_0x95c6('0x33')]][_0x95c6('0x3d')];transfers[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x13')]=utils['now']();transfers[_0x38c3f2[_0x95c6('0x41')]]['agentconnectAt']=utils[_0x95c6('0x14')]();transfers[_0x38c3f2['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x38c3f2[_0x95c6('0x41')]][_0x95c6('0x3e')]=0x2;}}}catch(_0x93bde7){utils['error'](_0x93bde7['stack']);}};exports[_0x95c6('0x42')]=function(_0x2123be){try{if(agents[_0x2123be[_0x95c6('0x3')]]&&agents[_0x2123be[_0x95c6('0x3')]]['reason']===_0x95c6('0x1c')){if(_0x2123be[_0x95c6('0x43')]==='21'){agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x1b')]=_0x95c6('0x44');agents[_0x2123be['uniqueid']]['lastevent']=_0x95c6('0x44');}writeDB(agents[_0x2123be[_0x95c6('0x3')]]);var _0x6c23e5=unanswered[_0x95c6('0x45')](_0x2123be[_0x95c6('0x3')]);if(_0x6c23e5>-0x1)unanswered[_0x95c6('0x46')](_0x6c23e5,0x1);}if(transfers[_0x2123be[_0x95c6('0x3')]]){transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0xb')]=!![];transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x47')]=utils['now']();transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x1f')]=utils[_0x95c6('0x2b')](transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x47')],transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x26')]);transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x1b')]=_0x95c6('0x48');transfers[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x15')]=_0x95c6('0x2c');writeDB(transfers[_0x2123be[_0x95c6('0x3')]],!![]);}if(agents[_0x2123be[_0x95c6('0x3')]]&&agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x26')]){agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0xb')]=!![];agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x47')]=utils[_0x95c6('0x14')]();agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x1f')]=utils[_0x95c6('0x2b')](agents[_0x2123be[_0x95c6('0x3')]][_0x95c6('0x47')],agents[_0x2123be[_0x95c6('0x3')]]['agentconnectAt']);agents[_0x2123be['uniqueid']]['reason']=agents[_0x2123be['uniqueid']][_0x95c6('0x36')]?'transfer':_0x95c6('0x48');agents[_0x2123be['uniqueid']][_0x95c6('0x15')]=_0x95c6('0x2c');writeDB(agents[_0x2123be[_0x95c6('0x3')]]);}}catch(_0xa35a10){utils['error'](_0xa35a10[_0x95c6('0x17')]);}}; \ No newline at end of file +var _0x2547=['error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','includes','abandoned','agentconnect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','stack','agentcomplete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','agententerreason','transfereeuniqueid','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','cause','rejected','splice','agent','agentconnectAt','util','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','membername','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','acw','acwtime','agentacw','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','now','connectedlinename'];(function(_0x24396d,_0x40695e){var _0x5cbf77=function(_0xe3edbf){while(--_0xe3edbf){_0x24396d['push'](_0x24396d['shift']());}};_0x5cbf77(++_0x40695e);}(_0x2547,0xbb));var _0x7254=function(_0x1908cd,_0x5cd175){_0x1908cd=_0x1908cd-0x0;var _0x3b0e04=_0x2547[_0x1908cd];return _0x3b0e04;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1703de,_0x4a294a){utils[_0x7254('0x1')](util['format'](_0x7254('0x2'),_0x1703de[_0x7254('0x3')],_0x1703de['channel'],_0x1703de['queue'],_0x1703de[_0x7254('0x4')],_0x1703de['interface'],_0x1703de['calleridnum'],_0x1703de[_0x7254('0x5')],_0x1703de[_0x7254('0x6')]));if(_0x1703de[_0x7254('0x7')]){utils[_0x7254('0x8')](_0x1703de[_0x7254('0x7')])[_0x7254('0x9')](function(_0x188436){if(_0x188436){_0x1703de[_0x7254('0xa')]=_0x188436['type'];_0x1703de['agentacw']=_0x1703de['agentcomplete']?_0x188436[_0x7254('0xb')]:![];_0x1703de[_0x7254('0xc')]=_0x1703de[_0x7254('0xd')]?_0x188436['acwTimeout']:0x0;}utils[_0x7254('0xe')](_0x7254('0xf'),_0x1703de);});}else{utils[_0x7254('0xe')](_0x7254('0xf'),_0x1703de);}if(_0x4a294a){delete transfers[_0x1703de[_0x7254('0x3')]];}else{delete agents[_0x1703de['destuniqueid']];}}exports['agentcalled']=function(_0xaf9301){try{agents[_0xaf9301[_0x7254('0x10')]]=_0xaf9301;agents[_0xaf9301[_0x7254('0x10')]][_0x7254('0x11')]=utils[_0x7254('0x12')]();agents[_0xaf9301[_0x7254('0x10')]][_0x7254('0x6')]='called';agents[_0xaf9301[_0x7254('0x10')]][_0x7254('0x5')]=null;agents[_0xaf9301[_0x7254('0x10')]][_0x7254('0x13')]=null;}catch(_0x30b39e){utils[_0x7254('0x14')](_0x30b39e['stack']);}};exports[_0x7254('0x15')]=function(_0x4f789f){try{if(!_[_0x7254('0x16')](agents[_0x4f789f['destuniqueid']])){agents[_0x4f789f[_0x7254('0x10')]]['agentringnoanswer']=!![];agents[_0x4f789f['destuniqueid']][_0x7254('0x17')]=utils[_0x7254('0x12')]();agents[_0x4f789f[_0x7254('0x10')]][_0x7254('0x6')]=_0x7254('0x18');agents[_0x4f789f[_0x7254('0x10')]][_0x7254('0x19')]=_0x7254('0x18');agents[_0x4f789f[_0x7254('0x10')]][_0x7254('0x1a')]=_0x4f789f[_0x7254('0x1b')]?parseInt(_0x4f789f[_0x7254('0x1b')])/0x3e8:0x0;agents[_0x4f789f[_0x7254('0x10')]][_0x7254('0x1c')]=0x0;unanswered[_0x7254('0x1d')](_0x4f789f[_0x7254('0x10')]);}}catch(_0x2f2097){utils[_0x7254('0x14')](_0x2f2097['stack']);}};exports['queuecallerabandon']=function(_0x371077){try{_[_0x7254('0x1e')](agents,function(_0x1139cf,_0x2661f9){if(_0x1139cf[_0x7254('0x3')]==_0x371077['uniqueid']&&!_[_0x7254('0x1f')](unanswered,_0x1139cf['destuniqueid'])){_0x1139cf[_0x7254('0x15')]=!![];_0x1139cf[_0x7254('0x17')]=utils['now']();_0x1139cf['lastevent']=_0x7254('0x20');_0x1139cf[_0x7254('0x19')]=_0x7254('0x20');_0x1139cf[_0x7254('0x1a')]=_0x371077[_0x7254('0x1a')];_0x1139cf[_0x7254('0x1c')]=0x0;writeDB(_0x1139cf);}});}catch(_0x409cca){utils['error'](_0x409cca['stack']);}};exports[_0x7254('0x21')]=function(_0x4d4ea9){try{if(agents[_0x4d4ea9[_0x7254('0x10')]]){agents[_0x4d4ea9[_0x7254('0x10')]]['agentconnectAt']=utils[_0x7254('0x12')]();agents[_0x4d4ea9['destuniqueid']][_0x7254('0x5')]=_0x4d4ea9[_0x7254('0x5')];agents[_0x4d4ea9[_0x7254('0x10')]][_0x7254('0x13')]=_0x4d4ea9[_0x7254('0x13')];agents[_0x4d4ea9[_0x7254('0x10')]]['holdtime']=_0x4d4ea9[_0x7254('0x1b')];agents[_0x4d4ea9['destuniqueid']][_0x7254('0x6')]='connect';_[_0x7254('0x1e')](agents,function(_0x41e937,_0x4c51db){if(_0x41e937[_0x7254('0x10')]!=_0x4d4ea9[_0x7254('0x10')]&&_0x41e937['uniqueid']==_0x4d4ea9['uniqueid']){_0x41e937[_0x7254('0x1c')]=0x0;_0x41e937[_0x7254('0x1a')]=_0x4d4ea9[_0x7254('0x1b')];_0x41e937['agentringnoanswer']=!![];_0x41e937[_0x7254('0x17')]=utils[_0x7254('0x12')]();_0x41e937['lastevent']=_0x7254('0x22');_0x41e937[_0x7254('0x19')]=_0x7254('0x22');_0x41e937[_0x7254('0x23')]=_0x4d4ea9[_0x7254('0x10')];_0x41e937[_0x7254('0x24')]=_0x4d4ea9['membername'];writeDB(_0x41e937);}});}}catch(_0x5b00dd){utils[_0x7254('0x14')](_0x5b00dd[_0x7254('0x25')]);}};exports[_0x7254('0x26')]=function(_0x4e8022){try{if(!_[_0x7254('0x16')](agents[_0x4e8022[_0x7254('0x10')]])){agents[_0x4e8022['destuniqueid']][_0x7254('0x26')]=!![];agents[_0x4e8022['destuniqueid']]['agentcompleteAt']=utils[_0x7254('0x12')]();agents[_0x4e8022[_0x7254('0x10')]]['talktime']=utils[_0x7254('0x27')](agents[_0x4e8022['destuniqueid']][_0x7254('0x28')],agents[_0x4e8022['destuniqueid']]['agentconnectAt']);agents[_0x4e8022[_0x7254('0x10')]]['reason']=_0x4e8022['reason'];agents[_0x4e8022[_0x7254('0x10')]][_0x7254('0x6')]=_0x7254('0x29');writeDB(agents[_0x4e8022[_0x7254('0x10')]]);}}catch(_0x4312a7){utils[_0x7254('0x14')](_0x4312a7[_0x7254('0x25')]);}};exports[_0x7254('0x2a')]=function(_0x218fd0){try{if(!_['isNil'](agents[_0x218fd0[_0x7254('0x2b')]])){agents[_0x218fd0[_0x7254('0x2b')]][_0x7254('0x2c')]=!![];agents[_0x218fd0[_0x7254('0x2b')]][_0x7254('0x2d')]=_0x7254('0x2e');agents[_0x218fd0[_0x7254('0x2b')]]['transferexten']=_0x218fd0[_0x7254('0x2f')];agents[_0x218fd0[_0x7254('0x2b')]][_0x7254('0x30')]=agents[_0x218fd0['transfereruniqueid']][_0x7254('0x3')];}}catch(_0x596fd2){utils[_0x7254('0x14')](_0x596fd2[_0x7254('0x25')]);}};exports[_0x7254('0x31')]=function(_0x23385a){try{if(_0x23385a[_0x7254('0x32')]==_0x23385a['origtransfererlinkedid']){if(!_[_0x7254('0x16')](agents[_0x23385a[_0x7254('0x33')]])){agents[_0x23385a[_0x7254('0x33')]]['transfer']=!![];agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x2d')]=_0x7254('0x34');agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x35')]=_0x23385a[_0x7254('0x36')];agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x30')]=_0x23385a['origtransfereruniqueid'];}if(_0x23385a['transfereeuniqueid']&&agents[_0x23385a['transfereeuniqueid']]){agents[_0x23385a['transfereeuniqueid']][_0x7254('0x37')]=0x1;transfers[_0x23385a['transfereeuniqueid']]=_['clone'](agents[_0x23385a[_0x7254('0x38')]]);transfers[_0x23385a[_0x7254('0x38')]][_0x7254('0x39')]=agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x39')];transfers[_0x23385a['transfereeuniqueid']][_0x7254('0x3a')]=agents[_0x23385a[_0x7254('0x33')]][_0x7254('0x3a')];transfers[_0x23385a[_0x7254('0x38')]]['agentcalledAt']=utils[_0x7254('0x12')]();transfers[_0x23385a[_0x7254('0x38')]]['agentconnectAt']=utils['now']();transfers[_0x23385a['transfereeuniqueid']][_0x7254('0x1a')]=0x0;transfers[_0x23385a[_0x7254('0x38')]][_0x7254('0x37')]=0x2;}}else if(_0x23385a[_0x7254('0x33')]==_0x23385a[_0x7254('0x3b')]){if(!_[_0x7254('0x16')](agents[_0x23385a[_0x7254('0x32')]])){agents[_0x23385a['origtransfereruniqueid']][_0x7254('0x2c')]=!![];agents[_0x23385a[_0x7254('0x32')]]['transfertype']=_0x7254('0x34');agents[_0x23385a['origtransfereruniqueid']][_0x7254('0x35')]=_0x23385a[_0x7254('0x3c')];agents[_0x23385a[_0x7254('0x32')]][_0x7254('0x30')]=_0x23385a[_0x7254('0x33')];}if(_0x23385a[_0x7254('0x3d')]&&agents[_0x23385a['transfertargetuniqueid']]){agents[_0x23385a[_0x7254('0x3d')]]['agententerreason']=0x1;transfers[_0x23385a[_0x7254('0x3d')]]=_[_0x7254('0x3e')](agents[_0x23385a['transfertargetuniqueid']]);transfers[_0x23385a['transfertargetuniqueid']][_0x7254('0x39')]=agents[_0x23385a[_0x7254('0x32')]][_0x7254('0x39')];transfers[_0x23385a[_0x7254('0x3d')]][_0x7254('0x3a')]=agents[_0x23385a[_0x7254('0x32')]][_0x7254('0x3a')];transfers[_0x23385a[_0x7254('0x3d')]][_0x7254('0x11')]=utils[_0x7254('0x12')]();transfers[_0x23385a[_0x7254('0x3d')]]['agentconnectAt']=utils[_0x7254('0x12')]();transfers[_0x23385a[_0x7254('0x3d')]]['holdtime']=0x0;transfers[_0x23385a[_0x7254('0x3d')]][_0x7254('0x37')]=0x2;}}}catch(_0x1387bd){utils[_0x7254('0x14')](_0x1387bd[_0x7254('0x25')]);}};exports[_0x7254('0x3f')]=function(_0x191c86){try{if(agents[_0x191c86[_0x7254('0x3')]]&&agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x19')]===_0x7254('0x18')){if(_0x191c86[_0x7254('0x40')]==='21'){agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x19')]=_0x7254('0x41');agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x6')]=_0x7254('0x41');}writeDB(agents[_0x191c86[_0x7254('0x3')]]);var _0xb64e43=unanswered['indexOf'](_0x191c86['uniqueid']);if(_0xb64e43>-0x1)unanswered[_0x7254('0x42')](_0xb64e43,0x1);}if(transfers[_0x191c86[_0x7254('0x3')]]){transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x26')]=!![];transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x28')]=utils['now']();transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x1c')]=utils['diffTime'](transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x28')],transfers[_0x191c86[_0x7254('0x3')]]['agentconnectAt']);transfers[_0x191c86[_0x7254('0x3')]][_0x7254('0x19')]=_0x7254('0x43');transfers[_0x191c86[_0x7254('0x3')]]['lastevent']=_0x7254('0x29');writeDB(transfers[_0x191c86[_0x7254('0x3')]],!![]);}if(agents[_0x191c86[_0x7254('0x3')]]&&agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x44')]){agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x26')]=!![];agents[_0x191c86[_0x7254('0x3')]]['agentcompleteAt']=utils[_0x7254('0x12')]();agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x1c')]=utils['diffTime'](agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x28')],agents[_0x191c86['uniqueid']][_0x7254('0x44')]);agents[_0x191c86['uniqueid']][_0x7254('0x19')]=agents[_0x191c86[_0x7254('0x3')]][_0x7254('0x2c')]?'transfer':_0x7254('0x43');agents[_0x191c86['uniqueid']][_0x7254('0x6')]=_0x7254('0x29');writeDB(agents[_0x191c86[_0x7254('0x3')]]);}}catch(_0x5a3e6b){utils[_0x7254('0x14')](_0x5a3e6b['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 1519026..fa0f99c 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 _0x8651=['xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','toLowerCase','set','startsWith','appdata','split','lastIndexOf','includes','hangup','noop','execif','application','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','destination','callerid','getUserByInternal','then','UserId','CreateVoiceCallReport','linkedid','calleridnum','context','now','DOCUMENTATION','stack','channelstate','isNil','systemanswertime','transfer','destinationchannel','answertime','disposition','error','calleridname','endtime','duration','billableseconds','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','variable','source','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue'];(function(_0x389121,_0x427e8e){var _0xad4d5c=function(_0x10a83f){while(--_0x10a83f){_0x389121['push'](_0x389121['shift']());}};_0xad4d5c(++_0x427e8e);}(_0x8651,0x14a));var _0x1865=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8651[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x1865('0x0'));var utils=require(_0x1865('0x1'));var dispositions=[_0x1865('0x2'),_0x1865('0x3'),_0x1865('0x3'),_0x1865('0x2'),'NO\x20ANSWER',_0x1865('0x2'),_0x1865('0x4'),_0x1865('0x5'),_0x1865('0x3'),'FAILED',_0x1865('0x3')];var channels={};function writeDB(_0x41dc5d){utils[_0x1865('0x6')](util[_0x1865('0x7')](_0x1865('0x8'),_0x41dc5d[_0x1865('0x9')],_0x41dc5d[_0x1865('0xa')],_0x41dc5d[_0x1865('0xb')],_0x41dc5d[_0x1865('0xc')],_0x41dc5d['source'],_0x41dc5d[_0x1865('0xd')],_0x41dc5d[_0x1865('0xe')],_0x41dc5d['disposition']));if(_0x41dc5d[_0x1865('0xc')]){utils[_0x1865('0xf')](_0x41dc5d[_0x1865('0xc')])[_0x1865('0x10')](function(_0x17ef05){if(_0x17ef05){_0x41dc5d[_0x1865('0x11')]=_0x17ef05['id'];}utils['request'](_0x1865('0x12'),_0x41dc5d);});}else{utils['request'](_0x1865('0x12'),_0x41dc5d);}if(channels[_0x41dc5d['uniqueid']]){delete channels[_0x41dc5d[_0x1865('0x9')]];}}exports['newchannel']=function(_0x2d9429){try{if(_0x2d9429['uniqueid']==_0x2d9429[_0x1865('0x13')]&&_0x2d9429['channel']!='OutgoingSpoolFailed'){channels[_0x2d9429[_0x1865('0x9')]]={'uniqueid':_0x2d9429[_0x1865('0x9')],'accountcode':_0x2d9429[_0x1865('0xc')],'source':_0x2d9429[_0x1865('0x14')],'destination':_0x2d9429['exten'],'destinationcontext':_0x2d9429[_0x1865('0x15')],'channel':_0x2d9429[_0x1865('0xa')],'starttime':utils[_0x1865('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x1865('0x17')};}}catch(_0x12aa3f){utils['error'](_0x12aa3f[_0x1865('0x18')]);}};exports['newstate']=function(_0x191c2d){try{if(!_['isNil'](channels[_0x191c2d[_0x1865('0x9')]])&&_0x191c2d[_0x1865('0x19')]==0x6){if(_[_0x1865('0x1a')](channels[_0x191c2d[_0x1865('0x9')]][_0x1865('0x1b')])){channels[_0x191c2d[_0x1865('0x9')]][_0x1865('0x1b')]=utils[_0x1865('0x16')]();}}else if(!_['isNil'](channels[_0x191c2d['linkedid']])&&_0x191c2d[_0x1865('0x19')]==0x6&&_0x191c2d[_0x1865('0x15')]!=_0x1865('0x1c')){channels[_0x191c2d[_0x1865('0x13')]][_0x1865('0xc')]=_0x191c2d[_0x1865('0xc')];channels[_0x191c2d[_0x1865('0x13')]][_0x1865('0x1d')]=_0x191c2d[_0x1865('0xa')];if(_[_0x1865('0x1a')](channels[_0x191c2d['linkedid']][_0x1865('0x1e')])){channels[_0x191c2d[_0x1865('0x13')]][_0x1865('0x1e')]=utils[_0x1865('0x16')]();}channels[_0x191c2d['linkedid']][_0x1865('0x1f')]=dispositions[_['toNumber'](_0x191c2d[_0x1865('0x19')])]||_0x1865('0x4');}}catch(_0x24f899){utils[_0x1865('0x20')](_0x24f899[_0x1865('0x18')]);}};exports['hangup']=function(_0x482c7c){try{if(!_[_0x1865('0x1a')](channels[_0x482c7c[_0x1865('0x9')]])){if(_[_0x1865('0x1a')](channels[_0x482c7c['uniqueid']][_0x1865('0xe')])){channels[_0x482c7c[_0x1865('0x9')]]['callerid']=_0x482c7c[_0x1865('0x21')]+'\x20<'+_0x482c7c[_0x1865('0x14')]+'>';}channels[_0x482c7c['uniqueid']][_0x1865('0x22')]=utils[_0x1865('0x16')]();channels[_0x482c7c[_0x1865('0x9')]][_0x1865('0x23')]=utils['diffTime'](channels[_0x482c7c[_0x1865('0x9')]]['endtime'],channels[_0x482c7c['uniqueid']]['starttime']);channels[_0x482c7c[_0x1865('0x9')]][_0x1865('0x24')]=channels[_0x482c7c[_0x1865('0x9')]]['answertime']?utils[_0x1865('0x25')](channels[_0x482c7c['uniqueid']][_0x1865('0x22')],channels[_0x482c7c['uniqueid']]['answertime']):0x0;writeDB(channels[_0x482c7c['uniqueid']]);}}catch(_0xbe0ea5){utils['error'](_0xbe0ea5[_0x1865('0x18')]);}};exports[_0x1865('0x26')]=function(_0x3d4e0f){try{if(!_[_0x1865('0x1a')](channels[_0x3d4e0f['localtwolinkedid']])){if(channels[_0x3d4e0f[_0x1865('0x27')]][_0x1865('0xa')]==_0x3d4e0f[_0x1865('0x28')]){channels[_0x3d4e0f[_0x1865('0x27')]][_0x1865('0x1d')]=_0x3d4e0f['secondtransfererchannel'];channels[_0x3d4e0f[_0x1865('0x27')]][_0x1865('0x29')]=_0x1865('0x2a');}else if(channels[_0x3d4e0f[_0x1865('0x27')]]['channel']=_0x3d4e0f[_0x1865('0x2b')]){channels[_0x3d4e0f[_0x1865('0x27')]]['destinationchannel']=_0x3d4e0f[_0x1865('0x2c')];channels[_0x3d4e0f[_0x1865('0x27')]][_0x1865('0x29')]=_0x1865('0x2a');}}}catch(_0x404306){utils[_0x1865('0x20')](_0x404306[_0x1865('0x18')]);}};exports[_0x1865('0x2d')]=function(_0x1d24c0){try{if(!_[_0x1865('0x1a')](channels[_0x1d24c0[_0x1865('0x9')]])){channels[_0x1d24c0['uniqueid']][_0x1865('0x2e')]=utils[_0x1865('0x16')]();}}catch(_0x491c9b){utils['error'](_0x491c9b[_0x1865('0x18')]);}};exports[_0x1865('0x2f')]=function(_0x344d9b){try{if(!_['isNil'](channels[_0x344d9b[_0x1865('0x9')]])){if(!_[_0x1865('0x1a')](channels[_0x344d9b[_0x1865('0x9')]][_0x1865('0x2e')])){channels[_0x344d9b[_0x1865('0x9')]]['mohtime']+=utils[_0x1865('0x25')](utils[_0x1865('0x16')](),channels[_0x344d9b[_0x1865('0x9')]][_0x1865('0x2e')]);delete channels[_0x344d9b[_0x1865('0x9')]]['musiconholdstartAt'];}}}catch(_0x113ac0){utils['error'](_0x113ac0[_0x1865('0x18')]);}};exports['varset']=function(_0x493390){try{if(!_[_0x1865('0x1a')](channels[_0x493390[_0x1865('0x9')]])){if(!_['isNil'](_0x493390[_0x1865('0x30')]['xmd-originatecalleridnum'])){channels[_0x493390[_0x1865('0x9')]][_0x1865('0x31')]=_0x493390[_0x1865('0x32')];}if(!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')]['xmd-phone'])){channels[_0x493390['uniqueid']]['destination']=_0x493390['value'];channels[_0x493390[_0x1865('0x9')]][_0x1865('0xe')]='\x22'+_0x493390[_0x1865('0x32')]+_0x1865('0x33')+_0x493390[_0x1865('0x32')]+'>';}if(!_[_0x1865('0x1a')](_0x493390['variable'][_0x1865('0x34')])||!_[_0x1865('0x1a')](_0x493390['variable'][_0x1865('0x35')])){channels[_0x493390['uniqueid']]['callerid']=_0x493390[_0x1865('0x32')];}if(!_['isNil'](_0x493390[_0x1865('0x30')][_0x1865('0x36')])||!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')][_0x1865('0x37')])){channels[_0x493390[_0x1865('0x9')]][_0x1865('0x38')]=_0x1865('0x39');channels[_0x493390['uniqueid']][_0x1865('0x3a')]=_0x493390['value'];channels[_0x493390[_0x1865('0x9')]][_0x1865('0x3b')]=!![];}if(!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')][_0x1865('0x3c')])){channels[_0x493390[_0x1865('0x9')]]['ContactId']=_0x493390[_0x1865('0x32')];}if(!_['isNil'](_0x493390['variable'][_0x1865('0x3d')])){channels[_0x493390[_0x1865('0x9')]][_0x1865('0xb')]=_0x493390[_0x1865('0x32')];}if(!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')][_0x1865('0x3e')])){channels[_0x493390[_0x1865('0x9')]][_0x1865('0x3f')]=_0x493390['value'];}if(!_[_0x1865('0x1a')](_0x493390[_0x1865('0x30')][_0x1865('0x40')])){channels[_0x493390[_0x1865('0x9')]]['sipcallid']=_0x493390[_0x1865('0x32')];}}}catch(_0x2653d1){utils[_0x1865('0x20')](_0x2653d1[_0x1865('0x18')]);}};exports[_0x1865('0x41')]=function(_0x4b84cd){try{if(!_['isNil'](channels[_0x4b84cd[_0x1865('0x9')]])){if(_0x4b84cd['application'][_0x1865('0x42')]()==_0x1865('0x43')&&_[_0x1865('0x44')](_0x4b84cd[_0x1865('0x45')][_0x1865('0x42')](),'cdr')){var _0x4ace93=_0x4b84cd[_0x1865('0x45')][_0x1865('0x46')]('=');var _0x464f61=_0x4ace93[0x0]['substring'](_0x4ace93[0x0][_0x1865('0x47')]('(')+0x1,_0x4ace93[0x0]['lastIndexOf'](')'));var _0x31e092=_0x4ace93[0x1];channels[_0x4b84cd['uniqueid']][_0x464f61]=_0x31e092;}if(!_[_0x1865('0x48')]([_0x1865('0x49'),_0x1865('0x4a'),_0x1865('0x4b'),'set','gotoif'],_0x4b84cd[_0x1865('0x4c')]['toLowerCase']())){channels[_0x4b84cd[_0x1865('0x9')]][_0x1865('0x38')]=_0x4b84cd[_0x1865('0x4c')];channels[_0x4b84cd[_0x1865('0x9')]][_0x1865('0x3a')]=_0x4b84cd[_0x1865('0x45')];}}}catch(_0x586eac){utils[_0x1865('0x20')](_0x586eac[_0x1865('0x18')]);}}; \ No newline at end of file +var _0x28e7=['isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','toNumber','stack','hangup','calleridname','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','error','musiconholdstart','musiconholdstop','musiconholdstartAt','mohtime','variable','xmd-originatecalleridnum','source','value','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','noop','gotoif','lastapplication','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','callerid','disposition','accountcode','getUserByInternal','then','CreateVoiceCallReport','request','uniqueid','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','context','now','newstate'];(function(_0x3fa366,_0x13499d){var _0x46991c=function(_0x246145){while(--_0x246145){_0x3fa366['push'](_0x3fa366['shift']());}};_0x46991c(++_0x13499d);}(_0x28e7,0x185));var _0x728e=function(_0x1319a3,_0x30f18c){_0x1319a3=_0x1319a3-0x0;var _0x37228c=_0x28e7[_0x1319a3];return _0x37228c;};'use strict';var _=require(_0x728e('0x0'));var util=require('util');var utils=require(_0x728e('0x1'));var dispositions=[_0x728e('0x2'),_0x728e('0x3'),_0x728e('0x3'),'NO\x20ANSWER',_0x728e('0x2'),_0x728e('0x2'),_0x728e('0x4'),_0x728e('0x5'),_0x728e('0x3'),'FAILED',_0x728e('0x3')];var channels={};function writeDB(_0x5e4c30){utils[_0x728e('0x6')](util[_0x728e('0x7')](_0x728e('0x8'),_0x5e4c30['uniqueid'],_0x5e4c30[_0x728e('0x9')],_0x5e4c30[_0x728e('0xa')],_0x5e4c30['accountcode'],_0x5e4c30['source'],_0x5e4c30['destination'],_0x5e4c30[_0x728e('0xb')],_0x5e4c30[_0x728e('0xc')]));if(_0x5e4c30[_0x728e('0xd')]){utils[_0x728e('0xe')](_0x5e4c30[_0x728e('0xd')])[_0x728e('0xf')](function(_0x2cddab){if(_0x2cddab){_0x5e4c30['UserId']=_0x2cddab['id'];}utils['request'](_0x728e('0x10'),_0x5e4c30);});}else{utils[_0x728e('0x11')]('CreateVoiceCallReport',_0x5e4c30);}if(channels[_0x5e4c30['uniqueid']]){delete channels[_0x5e4c30[_0x728e('0x12')]];}}exports[_0x728e('0x13')]=function(_0x407549){try{if(_0x407549['uniqueid']==_0x407549[_0x728e('0x14')]&&_0x407549[_0x728e('0x9')]!=_0x728e('0x15')){channels[_0x407549[_0x728e('0x12')]]={'uniqueid':_0x407549[_0x728e('0x12')],'accountcode':_0x407549[_0x728e('0xd')],'source':_0x407549[_0x728e('0x16')],'destination':_0x407549['exten'],'destinationcontext':_0x407549[_0x728e('0x17')],'channel':_0x407549['channel'],'starttime':utils[_0x728e('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x728e('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x49bdb9){utils['error'](_0x49bdb9['stack']);}};exports[_0x728e('0x19')]=function(_0x5c9709){try{if(!_[_0x728e('0x1a')](channels[_0x5c9709['uniqueid']])&&_0x5c9709[_0x728e('0x1b')]==0x6){if(_[_0x728e('0x1a')](channels[_0x5c9709[_0x728e('0x12')]]['systemanswertime'])){channels[_0x5c9709[_0x728e('0x12')]][_0x728e('0x1c')]=utils['now']();}}else if(!_['isNil'](channels[_0x5c9709[_0x728e('0x14')]])&&_0x5c9709[_0x728e('0x1b')]==0x6&&_0x5c9709[_0x728e('0x17')]!=_0x728e('0x1d')){channels[_0x5c9709['linkedid']][_0x728e('0xd')]=_0x5c9709[_0x728e('0xd')];channels[_0x5c9709[_0x728e('0x14')]][_0x728e('0x1e')]=_0x5c9709[_0x728e('0x9')];if(_[_0x728e('0x1a')](channels[_0x5c9709['linkedid']][_0x728e('0x1f')])){channels[_0x5c9709[_0x728e('0x14')]][_0x728e('0x1f')]=utils['now']();}channels[_0x5c9709['linkedid']][_0x728e('0xc')]=dispositions[_[_0x728e('0x20')](_0x5c9709[_0x728e('0x1b')])]||_0x728e('0x4');}}catch(_0x4c83ac){utils['error'](_0x4c83ac[_0x728e('0x21')]);}};exports[_0x728e('0x22')]=function(_0x403ff8){try{if(!_[_0x728e('0x1a')](channels[_0x403ff8[_0x728e('0x12')]])){if(_[_0x728e('0x1a')](channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0xb')])){channels[_0x403ff8['uniqueid']]['callerid']=_0x403ff8[_0x728e('0x23')]+'\x20<'+_0x403ff8['calleridnum']+'>';}channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x24')]=utils[_0x728e('0x18')]();channels[_0x403ff8['uniqueid']]['duration']=utils['diffTime'](channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x24')],channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x25')]);channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x26')]=channels[_0x403ff8['uniqueid']][_0x728e('0x1f')]?utils[_0x728e('0x27')](channels[_0x403ff8[_0x728e('0x12')]][_0x728e('0x24')],channels[_0x403ff8[_0x728e('0x12')]]['answertime']):0x0;writeDB(channels[_0x403ff8['uniqueid']]);}}catch(_0x495d94){utils['error'](_0x495d94['stack']);}};exports[_0x728e('0x28')]=function(_0x1469de){try{if(!_[_0x728e('0x1a')](channels[_0x1469de['localtwolinkedid']])){if(channels[_0x1469de[_0x728e('0x29')]][_0x728e('0x9')]==_0x1469de[_0x728e('0x2a')]){channels[_0x1469de['localtwolinkedid']]['destinationchannel']=_0x1469de[_0x728e('0x2b')];channels[_0x1469de[_0x728e('0x29')]][_0x728e('0x2c')]=_0x728e('0x2d');}else if(channels[_0x1469de[_0x728e('0x29')]]['channel']=_0x1469de[_0x728e('0x2e')]){channels[_0x1469de[_0x728e('0x29')]][_0x728e('0x1e')]=_0x1469de[_0x728e('0x2f')];channels[_0x1469de[_0x728e('0x29')]][_0x728e('0x2c')]=_0x728e('0x2d');}}}catch(_0x421dbe){utils[_0x728e('0x30')](_0x421dbe[_0x728e('0x21')]);}};exports[_0x728e('0x31')]=function(_0x2003d5){try{if(!_[_0x728e('0x1a')](channels[_0x2003d5[_0x728e('0x12')]])){channels[_0x2003d5[_0x728e('0x12')]]['musiconholdstartAt']=utils[_0x728e('0x18')]();}}catch(_0x31fb59){utils['error'](_0x31fb59[_0x728e('0x21')]);}};exports[_0x728e('0x32')]=function(_0x459958){try{if(!_['isNil'](channels[_0x459958[_0x728e('0x12')]])){if(!_[_0x728e('0x1a')](channels[_0x459958[_0x728e('0x12')]][_0x728e('0x33')])){channels[_0x459958[_0x728e('0x12')]][_0x728e('0x34')]+=utils[_0x728e('0x27')](utils[_0x728e('0x18')](),channels[_0x459958[_0x728e('0x12')]][_0x728e('0x33')]);delete channels[_0x459958[_0x728e('0x12')]][_0x728e('0x33')];}}}catch(_0x565221){utils['error'](_0x565221[_0x728e('0x21')]);}};exports['varset']=function(_0x36facd){try{if(!_[_0x728e('0x1a')](channels[_0x36facd['uniqueid']])){if(!_[_0x728e('0x1a')](_0x36facd[_0x728e('0x35')][_0x728e('0x36')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x37')]=_0x36facd[_0x728e('0x38')];}if(!_['isNil'](_0x36facd['variable']['xmd-phone'])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x39')]=_0x36facd[_0x728e('0x38')];channels[_0x36facd[_0x728e('0x12')]][_0x728e('0xb')]='\x22'+_0x36facd[_0x728e('0x38')]+'\x22\x20<'+_0x36facd[_0x728e('0x38')]+'>';}if(!_['isNil'](_0x36facd['variable'][_0x728e('0x3a')])||!_[_0x728e('0x1a')](_0x36facd[_0x728e('0x35')][_0x728e('0x3b')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0xb')]=_0x36facd['value'];}if(!_[_0x728e('0x1a')](_0x36facd['variable'][_0x728e('0x3c')])||!_[_0x728e('0x1a')](_0x36facd['variable'][_0x728e('0x3d')])){channels[_0x36facd[_0x728e('0x12')]]['lastapplication']=_0x728e('0x3e');channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x3f')]=_0x36facd[_0x728e('0x38')];channels[_0x36facd['uniqueid']][_0x728e('0x40')]=!![];}if(!_[_0x728e('0x1a')](_0x36facd['variable'][_0x728e('0x41')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x42')]=_0x36facd['value'];}if(!_['isNil'](_0x36facd[_0x728e('0x35')][_0x728e('0x43')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0xa')]=_0x36facd[_0x728e('0x38')];}if(!_['isNil'](_0x36facd[_0x728e('0x35')][_0x728e('0x44')])){channels[_0x36facd['uniqueid']][_0x728e('0x45')]=_0x36facd[_0x728e('0x38')];}if(!_[_0x728e('0x1a')](_0x36facd[_0x728e('0x35')][_0x728e('0x46')])){channels[_0x36facd[_0x728e('0x12')]][_0x728e('0x46')]=_0x36facd[_0x728e('0x38')];}}}catch(_0xfd29d){utils[_0x728e('0x30')](_0xfd29d[_0x728e('0x21')]);}};exports[_0x728e('0x47')]=function(_0x24c5e0){try{if(!_['isNil'](channels[_0x24c5e0[_0x728e('0x12')]])){if(_0x24c5e0[_0x728e('0x48')][_0x728e('0x49')]()==_0x728e('0x4a')&&_[_0x728e('0x4b')](_0x24c5e0[_0x728e('0x4c')]['toLowerCase'](),'cdr')){var _0x11accb=_0x24c5e0[_0x728e('0x4c')][_0x728e('0x4d')]('=');var _0x1e5381=_0x11accb[0x0][_0x728e('0x4e')](_0x11accb[0x0]['lastIndexOf']('(')+0x1,_0x11accb[0x0][_0x728e('0x4f')](')'));var _0x3900f1=_0x11accb[0x1];channels[_0x24c5e0[_0x728e('0x12')]][_0x1e5381]=_0x3900f1;}if(!_['includes']([_0x728e('0x22'),_0x728e('0x50'),'execif',_0x728e('0x4a'),_0x728e('0x51')],_0x24c5e0[_0x728e('0x48')][_0x728e('0x49')]())){channels[_0x24c5e0[_0x728e('0x12')]][_0x728e('0x52')]=_0x24c5e0[_0x728e('0x48')];channels[_0x24c5e0[_0x728e('0x12')]][_0x728e('0x3f')]=_0x24c5e0['appdata'];}}}catch(_0x149270){utils[_0x728e('0x30')](_0x149270['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index f94f784..c1419d7 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 _0x723e=['FULLYBOOTED','error','close','CLOSE','managerevent','lodash','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted'];(function(_0x6de811,_0x389a4c){var _0x26d735=function(_0x4a4e96){while(--_0x4a4e96){_0x6de811['push'](_0x6de811['shift']());}};_0x26d735(++_0x389a4c);}(_0x723e,0x179));var _0xe723=function(_0x2d9b4f,_0x597016){_0x2d9b4f=_0x2d9b4f-0x0;var _0x6c1c59=_0x723e[_0x2d9b4f];return _0x6c1c59;};'use strict';var utils=require('./utils');var _=require(_0xe723('0x0'));exports[_0xe723('0x1')]=function(){utils[_0xe723('0x2')](_0xe723('0x3'));};exports[_0xe723('0x4')]=function(){utils[_0xe723('0x2')](_0xe723('0x5'));};exports[_0xe723('0x6')]=function(){utils[_0xe723('0x2')](_0xe723('0x7'));};exports['error']=function(_0x32d689){utils[_0xe723('0x8')](_0x32d689);};exports[_0xe723('0x9')]=function(){utils[_0xe723('0x2')](_0xe723('0xa'));};exports[_0xe723('0xb')]=function(_0x1b46e0){}; \ No newline at end of file +var _0x1cb9=['FULLYBOOTED','error','close','managerevent','./utils','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4e1208,_0x2ba3a5){_0x4e1208=_0x4e1208-0x0;var _0x4f86ae=_0x1cb9[_0x4e1208];return _0x4f86ae;};'use strict';var utils=require(_0x91cb('0x0'));var _=require('lodash');exports[_0x91cb('0x1')]=function(){utils[_0x91cb('0x2')](_0x91cb('0x3'));};exports[_0x91cb('0x4')]=function(){utils['info'](_0x91cb('0x5'));};exports[_0x91cb('0x6')]=function(){utils['info'](_0x91cb('0x7'));};exports[_0x91cb('0x8')]=function(_0x186dc3){utils[_0x91cb('0x8')](_0x186dc3);};exports[_0x91cb('0x9')]=function(){utils[_0x91cb('0x2')]('CLOSE');};exports[_0x91cb('0xa')]=function(_0x5bda2f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 3eba675..897278c 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 _0x52f1=['toLowerCase','appdata','cdr(routeid)','split','stack','variable','outboundrouteid','value','error','now','lastevent','called','dialend','dialstatus','ANSWER','assign','answertime','connect','hangup','isNil','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','uniqueid','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','application'];(function(_0x38c77f,_0x232e53){var _0x15c5e8=function(_0x28fd36){while(--_0x28fd36){_0x38c77f['push'](_0x38c77f['shift']());}};_0x15c5e8(++_0x232e53);}(_0x52f1,0x1ed));var _0x152f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x52f1[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x152f('0x0'));var util=require(_0x152f('0x1'));var utils=require(_0x152f('0x2'));var dials={};function writeDB(_0x2c64bc){utils[_0x152f('0x3')](util[_0x152f('0x4')]('DIAL|%s|%s|%s|%s|%s|%s',_0x2c64bc[_0x152f('0x5')],_0x2c64bc['channel'],_0x2c64bc['dialstring'],_0x2c64bc[_0x152f('0x6')],_0x2c64bc[_0x152f('0x7')],_0x2c64bc['dialstatus']));utils['request'](_0x152f('0x8'),_0x2c64bc);delete dials[_0x2c64bc[_0x152f('0x5')]];}exports[_0x152f('0x9')]=function(_0x1aa8fc){try{if(_0x1aa8fc[_0x152f('0xa')][_0x152f('0xb')]()=='set'&&_['startsWith'](_0x1aa8fc[_0x152f('0xc')][_0x152f('0xb')](),_0x152f('0xd'))){var _0x60eb20=_0x1aa8fc[_0x152f('0xc')][_0x152f('0xe')]('=');dials[_0x1aa8fc[_0x152f('0x5')]]={'routeId':_0x60eb20[0x1]};}}catch(_0x2ab134){utils['error'](_0x2ab134[_0x152f('0xf')]);}};exports['varset']=function(_0x5f4c2a){try{if(!_['isNil'](_0x5f4c2a[_0x152f('0x10')][_0x152f('0x11')])){dials[_0x5f4c2a[_0x152f('0x5')]]={'routeId':_0x5f4c2a[_0x152f('0x12')]};}}catch(_0x305da8){utils[_0x152f('0x13')](_0x305da8[_0x152f('0xf')]);}};exports['dialbegin']=function(_0x32abb6){try{if(!_['isNil'](dials[_0x32abb6[_0x152f('0x5')]])){dials[_0x32abb6['uniqueid']]=_['assign'](dials[_0x32abb6[_0x152f('0x5')]],_0x32abb6);dials[_0x32abb6[_0x152f('0x5')]]['starttime']=utils[_0x152f('0x14')]();dials[_0x32abb6[_0x152f('0x5')]][_0x152f('0x15')]=_0x152f('0x16');}}catch(_0xd1e96a){utils[_0x152f('0x13')](_0xd1e96a['stack']);}};exports[_0x152f('0x17')]=function(_0x2b9979){try{if(!_['isNil'](dials[_0x2b9979[_0x152f('0x5')]])){dials[_0x2b9979['uniqueid']][_0x152f('0x18')]=_0x2b9979[_0x152f('0x18')];if(_0x2b9979['dialstatus']==_0x152f('0x19')){dials[_0x2b9979['uniqueid']]=_[_0x152f('0x1a')](dials[_0x2b9979[_0x152f('0x5')]],_0x2b9979);dials[_0x2b9979[_0x152f('0x5')]][_0x152f('0x1b')]=utils[_0x152f('0x14')]();dials[_0x2b9979[_0x152f('0x5')]][_0x152f('0x15')]=_0x152f('0x1c');}}}catch(_0x2982fb){utils[_0x152f('0x13')](_0x2982fb['stack']);}};exports[_0x152f('0x1d')]=function(_0x420680){try{if(!_[_0x152f('0x1e')](dials[_0x420680['uniqueid']])){dials[_0x420680[_0x152f('0x5')]]=_['assign'](dials[_0x420680[_0x152f('0x5')]],{'endtime':utils['now'](),'lastevent':_0x152f('0x1f')});dials[_0x420680[_0x152f('0x5')]]['duration']=utils[_0x152f('0x20')](dials[_0x420680[_0x152f('0x5')]][_0x152f('0x21')],dials[_0x420680[_0x152f('0x5')]]['starttime']);dials[_0x420680['uniqueid']][_0x152f('0x22')]=utils[_0x152f('0x20')](dials[_0x420680['uniqueid']][_0x152f('0x1b')]||dials[_0x420680[_0x152f('0x5')]]['endtime'],dials[_0x420680[_0x152f('0x5')]]['starttime']);dials[_0x420680[_0x152f('0x5')]][_0x152f('0x23')]=dials[_0x420680[_0x152f('0x5')]][_0x152f('0x1b')]?utils[_0x152f('0x20')](dials[_0x420680[_0x152f('0x5')]]['endtime'],dials[_0x420680[_0x152f('0x5')]][_0x152f('0x1b')]):0x0;writeDB(dials[_0x420680[_0x152f('0x5')]]);}}catch(_0x2e21b9){utils[_0x152f('0x13')](_0x2e21b9[_0x152f('0xf')]);}}; \ No newline at end of file +var _0xdc7e=['ANSWER','answertime','hangup','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','dialstring','connectedlinenum','request','CreateVoiceDialReport','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','stack','varset','isNil','error','dialbegin','assign','starttime','now','lastevent','called','dialend','dialstatus'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xdc7e,0x1e9));var _0xedc7=function(_0x4c884a,_0x2603ae){_0x4c884a=_0x4c884a-0x0;var _0x8ffffb=_0xdc7e[_0x4c884a];return _0x8ffffb;};'use strict';var _=require(_0xedc7('0x0'));var util=require(_0xedc7('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2d67c8){utils[_0xedc7('0x2')](util[_0xedc7('0x3')](_0xedc7('0x4'),_0x2d67c8[_0xedc7('0x5')],_0x2d67c8['channel'],_0x2d67c8[_0xedc7('0x6')],_0x2d67c8['calleridnum'],_0x2d67c8[_0xedc7('0x7')],_0x2d67c8['dialstatus']));utils[_0xedc7('0x8')](_0xedc7('0x9'),_0x2d67c8);delete dials[_0x2d67c8[_0xedc7('0x5')]];}exports['newexten']=function(_0x47717e){try{if(_0x47717e[_0xedc7('0xa')][_0xedc7('0xb')]()==_0xedc7('0xc')&&_[_0xedc7('0xd')](_0x47717e[_0xedc7('0xe')][_0xedc7('0xb')](),_0xedc7('0xf'))){var _0xf8f244=_0x47717e[_0xedc7('0xe')][_0xedc7('0x10')]('=');dials[_0x47717e['uniqueid']]={'routeId':_0xf8f244[0x1]};}}catch(_0x2c91f3){utils['error'](_0x2c91f3[_0xedc7('0x11')]);}};exports[_0xedc7('0x12')]=function(_0x1e5414){try{if(!_[_0xedc7('0x13')](_0x1e5414['variable']['outboundrouteid'])){dials[_0x1e5414[_0xedc7('0x5')]]={'routeId':_0x1e5414['value']};}}catch(_0x32337e){utils[_0xedc7('0x14')](_0x32337e[_0xedc7('0x11')]);}};exports[_0xedc7('0x15')]=function(_0x3338f8){try{if(!_['isNil'](dials[_0x3338f8[_0xedc7('0x5')]])){dials[_0x3338f8[_0xedc7('0x5')]]=_[_0xedc7('0x16')](dials[_0x3338f8[_0xedc7('0x5')]],_0x3338f8);dials[_0x3338f8[_0xedc7('0x5')]][_0xedc7('0x17')]=utils[_0xedc7('0x18')]();dials[_0x3338f8['uniqueid']][_0xedc7('0x19')]=_0xedc7('0x1a');}}catch(_0x810fae){utils['error'](_0x810fae[_0xedc7('0x11')]);}};exports[_0xedc7('0x1b')]=function(_0x286853){try{if(!_[_0xedc7('0x13')](dials[_0x286853[_0xedc7('0x5')]])){dials[_0x286853[_0xedc7('0x5')]][_0xedc7('0x1c')]=_0x286853[_0xedc7('0x1c')];if(_0x286853[_0xedc7('0x1c')]==_0xedc7('0x1d')){dials[_0x286853['uniqueid']]=_[_0xedc7('0x16')](dials[_0x286853['uniqueid']],_0x286853);dials[_0x286853[_0xedc7('0x5')]][_0xedc7('0x1e')]=utils[_0xedc7('0x18')]();dials[_0x286853['uniqueid']]['lastevent']='connect';}}}catch(_0x668f57){utils[_0xedc7('0x14')](_0x668f57[_0xedc7('0x11')]);}};exports[_0xedc7('0x1f')]=function(_0x1efd9d){try{if(!_[_0xedc7('0x13')](dials[_0x1efd9d[_0xedc7('0x5')]])){dials[_0x1efd9d[_0xedc7('0x5')]]=_['assign'](dials[_0x1efd9d[_0xedc7('0x5')]],{'endtime':utils[_0xedc7('0x18')](),'lastevent':_0xedc7('0x20')});dials[_0x1efd9d[_0xedc7('0x5')]]['duration']=utils[_0xedc7('0x21')](dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x22')],dials[_0x1efd9d[_0xedc7('0x5')]]['starttime']);dials[_0x1efd9d['uniqueid']][_0xedc7('0x23')]=utils[_0xedc7('0x21')](dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x1e')]||dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x22')],dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x17')]);dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x24')]=dials[_0x1efd9d['uniqueid']][_0xedc7('0x1e')]?utils[_0xedc7('0x21')](dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x22')],dials[_0x1efd9d[_0xedc7('0x5')]][_0xedc7('0x1e')]):0x0;writeDB(dials[_0x1efd9d[_0xedc7('0x5')]]);}}catch(_0x366674){utils[_0xedc7('0x14')](_0x366674[_0xedc7('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index fd8b4ca..8621ffe 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 _0x4f6a=['queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','asterisk','port','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','error','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon'];(function(_0x21c5bf,_0x305328){var _0x1f66cf=function(_0x26081a){while(--_0x26081a){_0x21c5bf['push'](_0x21c5bf['shift']());}};_0x1f66cf(++_0x305328);}(_0x4f6a,0xda));var _0xa4f6=function(_0x3cca3e,_0x950fc5){_0x3cca3e=_0x3cca3e-0x0;var _0x382338=_0x4f6a[_0x3cca3e];return _0x382338;};var AsteriskManager=require(_0xa4f6('0x0'));var config=require(_0xa4f6('0x1'));var utils=require('./utils');var ami=new AsteriskManager(config[_0xa4f6('0x2')][_0xa4f6('0x3')],config['asterisk']['ip'],config[_0xa4f6('0x2')][_0xa4f6('0x4')],config['asterisk'][_0xa4f6('0x5')],!![]);ami[_0xa4f6('0x6')]();if(config[_0xa4f6('0x7')]&&config['xdr']['disabled']){utils[_0xa4f6('0x8')](_0xa4f6('0x9'));}else{var agents=require(_0xa4f6('0xa'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0xa4f6('0xb'));var members=require(_0xa4f6('0xc'));var dials=require(_0xa4f6('0xd'));var transfers=require(_0xa4f6('0xe'));var core=require(_0xa4f6('0xf'));ami['on'](_0xa4f6('0x10'),core[_0xa4f6('0x10')]);ami['on'](_0xa4f6('0x11'),core[_0xa4f6('0x11')]);ami['on'](_0xa4f6('0x12'),core[_0xa4f6('0x12')]);ami['on']('error',core['error']);ami['on'](_0xa4f6('0x13'),core['close']);ami['on']('managerevent',core[_0xa4f6('0x14')]);ami['on'](_0xa4f6('0x15'),function(_0x4c9a85){try{members[_0xa4f6('0x15')](_0x4c9a85);}catch(_0x21dc31){utils[_0xa4f6('0x16')](_0x21dc31);}});ami['on']('agentcalled',function(_0x5c282a){try{agents[_0xa4f6('0x17')](_0x5c282a);}catch(_0x4cfa50){utils['error'](_0x4cfa50);}});ami['on'](_0xa4f6('0x18'),function(_0x11911a){try{agents[_0xa4f6('0x18')](_0x11911a);}catch(_0x324ec1){utils['error'](_0x324ec1);}});ami['on'](_0xa4f6('0x19'),function(_0x3fb8ac){try{agents[_0xa4f6('0x19')](_0x3fb8ac);queues['agentconnect'](_0x3fb8ac);}catch(_0x2143f3){utils[_0xa4f6('0x16')](_0x2143f3);}});ami['on'](_0xa4f6('0x1a'),function(_0x261b10){try{agents[_0xa4f6('0x1a')](_0x261b10);queues[_0xa4f6('0x1a')](_0x261b10);members[_0xa4f6('0x1a')](_0x261b10);}catch(_0x58b366){utils['error'](_0x58b366);}});ami['on']('queuecallerabandon',function(_0x460ffd){try{agents[_0xa4f6('0x1b')](_0x460ffd);queues['queuecallerabandon'](_0x460ffd);}catch(_0x27b77f){utils['error'](_0x27b77f);}});ami['on'](_0xa4f6('0x1c'),function(_0x32e304){try{queues[_0xa4f6('0x1c')](_0x32e304);recordings[_0xa4f6('0x1c')](_0x32e304);}catch(_0x4faf40){utils[_0xa4f6('0x16')](_0x4faf40);}});ami['on'](_0xa4f6('0x1d'),function(_0x4a3095){try{queues[_0xa4f6('0x1d')](_0x4a3095);}catch(_0x5929d6){utils['error'](_0x5929d6);}});ami['on']('musiconholdstart',function(_0x3488ff){try{queues['musiconholdstart'](_0x3488ff);calls[_0xa4f6('0x1e')](_0x3488ff);}catch(_0x8289f1){utils[_0xa4f6('0x16')](_0x8289f1);}});ami['on'](_0xa4f6('0x1f'),function(_0x44901e){try{queues['musiconholdstop'](_0x44901e);calls[_0xa4f6('0x1f')](_0x44901e);}catch(_0xc47931){utils[_0xa4f6('0x16')](_0xc47931);}});ami['on'](_0xa4f6('0x20'),function(_0x4cd505){try{calls['newstate'](_0x4cd505);recordings[_0xa4f6('0x20')](_0x4cd505);}catch(_0x127001){utils[_0xa4f6('0x16')](_0x127001);}});ami['on']('hangup',function(_0x1571b0){try{calls[_0xa4f6('0x21')](_0x1571b0);recordings['hangup'](_0x1571b0);dials[_0xa4f6('0x21')](_0x1571b0);agents['hangup'](_0x1571b0);queues[_0xa4f6('0x21')](_0x1571b0);}catch(_0x3f60ea){utils[_0xa4f6('0x16')](_0x3f60ea);}});ami['on']('cdr',function(_0x3de992){try{members['cdr'](_0x3de992);}catch(_0x26abc4){utils[_0xa4f6('0x16')](_0x26abc4);}});ami['on'](_0xa4f6('0x22'),function(_0x3798e8){try{queues[_0xa4f6('0x22')](_0x3798e8);agents[_0xa4f6('0x22')](_0x3798e8);transfers[_0xa4f6('0x22')](_0x3798e8);}catch(_0x486a46){utils[_0xa4f6('0x16')](_0x486a46);}});ami['on']('attendedtransfer',function(_0x11cbc8){try{queues['attendedtransfer'](_0x11cbc8);transfers[_0xa4f6('0x23')](_0x11cbc8);agents[_0xa4f6('0x23')](_0x11cbc8);calls[_0xa4f6('0x23')](_0x11cbc8);}catch(_0x2956c3){utils[_0xa4f6('0x16')](_0x2956c3);}});ami['on'](_0xa4f6('0x24'),function(_0x100201){try{queues[_0xa4f6('0x24')](_0x100201);recordings[_0xa4f6('0x24')](_0x100201);calls[_0xa4f6('0x24')](_0x100201);dials[_0xa4f6('0x24')](_0x100201);}catch(_0x5163b8){utils['error'](_0x5163b8);}});ami['on'](_0xa4f6('0x25'),function(_0xcf2c18){try{calls[_0xa4f6('0x25')](_0xcf2c18);recordings[_0xa4f6('0x25')](_0xcf2c18);dials[_0xa4f6('0x25')](_0xcf2c18);}catch(_0x552fd2){utils['error'](_0x552fd2);}});ami['on'](_0xa4f6('0x26'),function(_0x2374e1){try{calls[_0xa4f6('0x26')](_0x2374e1);recordings[_0xa4f6('0x26')](_0x2374e1);}catch(_0x1b60ff){utils[_0xa4f6('0x16')](_0x1b60ff);}});ami['on'](_0xa4f6('0x27'),function(_0x1b745f){try{dials['dialbegin'](_0x1b745f);}catch(_0x5ca534){utils[_0xa4f6('0x16')](_0x5ca534);}});ami['on'](_0xa4f6('0x28'),function(_0xa663d8){try{dials['dialend'](_0xa663d8);}catch(_0x5c38b8){utils[_0xa4f6('0x16')](_0x5c38b8);}});} \ No newline at end of file +var _0xd4fb=['agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','asterisk','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange'];(function(_0x2f68b1,_0x531d50){var _0x213190=function(_0x4874eb){while(--_0x4874eb){_0x2f68b1['push'](_0x2f68b1['shift']());}};_0x213190(++_0x531d50);}(_0xd4fb,0x15b));var _0xbd4f=function(_0x197090,_0x3f928a){_0x197090=_0x197090-0x0;var _0x2b55e2=_0xd4fb[_0x197090];return _0x2b55e2;};var AsteriskManager=require(_0xbd4f('0x0'));var config=require('../../config/environment');var utils=require(_0xbd4f('0x1'));var ami=new AsteriskManager(config[_0xbd4f('0x2')]['port'],config[_0xbd4f('0x2')]['ip'],config[_0xbd4f('0x2')][_0xbd4f('0x3')],config[_0xbd4f('0x2')][_0xbd4f('0x4')],!![]);ami[_0xbd4f('0x5')]();if(config[_0xbd4f('0x6')]&&config[_0xbd4f('0x6')]['disabled']){utils[_0xbd4f('0x7')](_0xbd4f('0x8'));}else{var agents=require(_0xbd4f('0x9'));var calls=require(_0xbd4f('0xa'));var queues=require('./queues.controller');var recordings=require(_0xbd4f('0xb'));var members=require(_0xbd4f('0xc'));var dials=require('./dials.controller');var transfers=require(_0xbd4f('0xd'));var core=require(_0xbd4f('0xe'));ami['on'](_0xbd4f('0xf'),core[_0xbd4f('0xf')]);ami['on'](_0xbd4f('0x10'),core[_0xbd4f('0x10')]);ami['on'](_0xbd4f('0x11'),core[_0xbd4f('0x11')]);ami['on']('error',core[_0xbd4f('0x12')]);ami['on']('close',core[_0xbd4f('0x13')]);ami['on'](_0xbd4f('0x14'),core['managerevent']);ami['on'](_0xbd4f('0x15'),function(_0x7152ff){try{members[_0xbd4f('0x15')](_0x7152ff);}catch(_0x4970a5){utils[_0xbd4f('0x12')](_0x4970a5);}});ami['on']('agentcalled',function(_0x40afc3){try{agents[_0xbd4f('0x16')](_0x40afc3);}catch(_0x3505fd){utils[_0xbd4f('0x12')](_0x3505fd);}});ami['on'](_0xbd4f('0x17'),function(_0x172e01){try{agents[_0xbd4f('0x17')](_0x172e01);}catch(_0x4fc7c7){utils['error'](_0x4fc7c7);}});ami['on']('agentconnect',function(_0xa3221a){try{agents[_0xbd4f('0x18')](_0xa3221a);queues[_0xbd4f('0x18')](_0xa3221a);}catch(_0x33cc4d){utils[_0xbd4f('0x12')](_0x33cc4d);}});ami['on']('agentcomplete',function(_0x555492){try{agents[_0xbd4f('0x19')](_0x555492);queues[_0xbd4f('0x19')](_0x555492);members[_0xbd4f('0x19')](_0x555492);}catch(_0x544b2d){utils[_0xbd4f('0x12')](_0x544b2d);}});ami['on']('queuecallerabandon',function(_0x1378b2){try{agents[_0xbd4f('0x1a')](_0x1378b2);queues['queuecallerabandon'](_0x1378b2);}catch(_0x30f937){utils['error'](_0x30f937);}});ami['on'](_0xbd4f('0x1b'),function(_0x233b7a){try{queues[_0xbd4f('0x1b')](_0x233b7a);recordings[_0xbd4f('0x1b')](_0x233b7a);}catch(_0x4d0daa){utils[_0xbd4f('0x12')](_0x4d0daa);}});ami['on'](_0xbd4f('0x1c'),function(_0x4a1b49){try{queues[_0xbd4f('0x1c')](_0x4a1b49);}catch(_0x2c9da7){utils['error'](_0x2c9da7);}});ami['on'](_0xbd4f('0x1d'),function(_0xedd504){try{queues[_0xbd4f('0x1d')](_0xedd504);calls[_0xbd4f('0x1d')](_0xedd504);}catch(_0x4f285c){utils['error'](_0x4f285c);}});ami['on'](_0xbd4f('0x1e'),function(_0x5acde){try{queues[_0xbd4f('0x1e')](_0x5acde);calls[_0xbd4f('0x1e')](_0x5acde);}catch(_0x30600b){utils[_0xbd4f('0x12')](_0x30600b);}});ami['on'](_0xbd4f('0x1f'),function(_0xbe5438){try{calls[_0xbd4f('0x1f')](_0xbe5438);recordings[_0xbd4f('0x1f')](_0xbe5438);}catch(_0x341e0e){utils[_0xbd4f('0x12')](_0x341e0e);}});ami['on']('hangup',function(_0x309b11){try{calls[_0xbd4f('0x20')](_0x309b11);recordings['hangup'](_0x309b11);dials['hangup'](_0x309b11);agents[_0xbd4f('0x20')](_0x309b11);queues[_0xbd4f('0x20')](_0x309b11);}catch(_0x2af31c){utils[_0xbd4f('0x12')](_0x2af31c);}});ami['on'](_0xbd4f('0x21'),function(_0x396e2b){try{members[_0xbd4f('0x21')](_0x396e2b);}catch(_0x3a1fde){utils[_0xbd4f('0x12')](_0x3a1fde);}});ami['on']('blindtransfer',function(_0x32ad82){try{queues[_0xbd4f('0x22')](_0x32ad82);agents[_0xbd4f('0x22')](_0x32ad82);transfers[_0xbd4f('0x22')](_0x32ad82);}catch(_0x5d6ce8){utils[_0xbd4f('0x12')](_0x5d6ce8);}});ami['on'](_0xbd4f('0x23'),function(_0x5aeb98){try{queues[_0xbd4f('0x23')](_0x5aeb98);transfers['attendedtransfer'](_0x5aeb98);agents['attendedtransfer'](_0x5aeb98);calls[_0xbd4f('0x23')](_0x5aeb98);}catch(_0x4bb905){utils[_0xbd4f('0x12')](_0x4bb905);}});ami['on']('varset',function(_0x48bf9c){try{queues[_0xbd4f('0x24')](_0x48bf9c);recordings[_0xbd4f('0x24')](_0x48bf9c);calls[_0xbd4f('0x24')](_0x48bf9c);dials['varset'](_0x48bf9c);}catch(_0x132c98){utils[_0xbd4f('0x12')](_0x132c98);}});ami['on'](_0xbd4f('0x25'),function(_0x3061fe){try{calls[_0xbd4f('0x25')](_0x3061fe);recordings['newexten'](_0x3061fe);dials[_0xbd4f('0x25')](_0x3061fe);}catch(_0x2e7465){utils['error'](_0x2e7465);}});ami['on'](_0xbd4f('0x26'),function(_0x45427a){try{calls['newchannel'](_0x45427a);recordings['newchannel'](_0x45427a);}catch(_0x80c6cf){utils['error'](_0x80c6cf);}});ami['on'](_0xbd4f('0x27'),function(_0x2fda8b){try{dials['dialbegin'](_0x2fda8b);}catch(_0x90f5fc){utils['error'](_0x90f5fc);}});ami['on'](_0xbd4f('0x28'),function(_0x3041bc){try{dials[_0xbd4f('0x28')](_0x3041bc);}catch(_0x4f0764){utils['error'](_0x4f0764);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3f67252..293bb6c 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 _0xfc92=['data2','source','data3','destinationchannel','data1','lodash','util','./utils','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','membername','type','getUserByInterface','then','internal','split','name','request','CreateMemberReport','catch','error','some','startsWith','state','INUSE','BUSY','device','TALKING','agent','isNil','exitAt','now','duration','diffTime','enterAt','assign','queue','cdr','channel'];(function(_0x3b71bd,_0x2237d5){var _0x90e893=function(_0x4751ce){while(--_0x4751ce){_0x3b71bd['push'](_0x3b71bd['shift']());}};_0x90e893(++_0x2237d5);}(_0xfc92,0x1a9));var _0x2fc9=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xfc92[_0x1e9424];return _0x1bd96c;};'use strict';var _=require(_0x2fc9('0x0'));var util=require(_0x2fc9('0x1'));var utils=require(_0x2fc9('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x2fc9('0x3')];function writeDB(_0x20ed34){utils['info'](util[_0x2fc9('0x4')](_0x2fc9('0x5'),_0x20ed34[_0x2fc9('0x6')],_0x20ed34[_0x2fc9('0x7')],_0x20ed34['channel'],_0x20ed34['data2'],_0x20ed34[_0x2fc9('0x8')],_0x20ed34[_0x2fc9('0x9')]));if(_0x20ed34[_0x2fc9('0x7')]){utils[_0x2fc9('0xa')](_0x20ed34[_0x2fc9('0x7')])[_0x2fc9('0xb')](function(_0x42abfb){if(_0x42abfb){_0x20ed34[_0x2fc9('0x8')]=_0x42abfb['name'];_0x20ed34[_0x2fc9('0xc')]=_0x42abfb[_0x2fc9('0xc')];utils['request']('CreateMemberReport',_0x20ed34);}else{utils['getUserByName'](_0x20ed34[_0x2fc9('0x7')][_0x2fc9('0xd')]('/')[0x1])['then'](function(_0x3db06d){if(_0x3db06d){_0x20ed34[_0x2fc9('0x8')]=_0x3db06d[_0x2fc9('0xe')];_0x20ed34[_0x2fc9('0xc')]=_0x3db06d[_0x2fc9('0xc')];utils[_0x2fc9('0xf')](_0x2fc9('0x10'),_0x20ed34);}});}})[_0x2fc9('0x11')](function(_0x5a4bdd){utils[_0x2fc9('0x12')](_0x5a4bdd);});}delete members[_0x20ed34[_0x2fc9('0x7')]];}function startsWith(_0x335b9d,_0x3625f8){return _[_0x2fc9('0x13')](_0x335b9d,function(_0x21ccd2){return _[_0x2fc9('0x14')](_0x3625f8,_0x21ccd2);});}exports['devicestatechange']=function(_0x4903b5){switch(_0x4903b5[_0x2fc9('0x15')]){case _0x2fc9('0x16'):case _0x2fc9('0x17'):if(!startsWith(exclude,_0x4903b5[_0x2fc9('0x18')])){members[_0x4903b5[_0x2fc9('0x18')]]={'channel':'voice','interface':_0x4903b5[_0x2fc9('0x18')],'type':_0x2fc9('0x19'),'enterAt':utils['now'](),'role':_0x2fc9('0x1a')};}break;case'NOT_INUSE':if(!_[_0x2fc9('0x1b')](members[_0x4903b5[_0x2fc9('0x18')]])){members[_0x4903b5['device']][_0x2fc9('0x1c')]=utils[_0x2fc9('0x1d')]();members[_0x4903b5['device']][_0x2fc9('0x1e')]=utils[_0x2fc9('0x1f')](members[_0x4903b5[_0x2fc9('0x18')]][_0x2fc9('0x1c')],members[_0x4903b5['device']][_0x2fc9('0x20')]);if(members[_0x4903b5[_0x2fc9('0x18')]][_0x2fc9('0x6')]){writeDB(members[_0x4903b5['device']]);}}default:break;}};exports['agentcomplete']=function(_0x2a8f12){if(!_[_0x2fc9('0x1b')](members[_0x2a8f12[_0x2fc9('0x7')]])){members[_0x2a8f12['interface']]=_[_0x2fc9('0x21')](members[_0x2a8f12[_0x2fc9('0x7')]],{'data4':_0x2a8f12[_0x2fc9('0x22')],'uniqueid':_0x2a8f12[_0x2fc9('0x6')]});}};exports[_0x2fc9('0x23')]=function(_0x31732a){if(_0x31732a[_0x2fc9('0x24')]){var _0x113a36=_0x31732a[_0x2fc9('0x24')][_0x2fc9('0xd')]('-')[0x0];if(!_[_0x2fc9('0x1b')](members[_0x113a36])){members[_0x113a36]=_['assign'](members[_0x113a36],{'data1':members[_0x113a36]['data1']||_0x31732a[_0x2fc9('0x9')],'data2':members[_0x113a36][_0x2fc9('0x25')]||_0x31732a[_0x2fc9('0x26')],'data3':members[_0x113a36][_0x2fc9('0x27')]||_0x31732a['destination'],'uniqueid':members[_0x113a36]['uniqueid']||_0x31732a[_0x2fc9('0x6')]});if(members[_0x113a36][_0x2fc9('0x1c')]){writeDB(members[_0x113a36]);}}}if(_0x31732a['destinationchannel']){var _0x4b5e46=_0x31732a[_0x2fc9('0x28')][_0x2fc9('0xd')]('-')[0x0];if(!_['isNil'](members[_0x4b5e46])){members[_0x4b5e46]=_[_0x2fc9('0x21')](members[_0x4b5e46],{'data1':members[_0x4b5e46][_0x2fc9('0x29')]||_0x31732a[_0x2fc9('0x9')],'data2':members[_0x4b5e46]['data2']||_0x31732a[_0x2fc9('0x26')],'data3':members[_0x4b5e46][_0x2fc9('0x27')]||_0x31732a['destination'],'uniqueid':members[_0x4b5e46]['uniqueid']||_0x31732a[_0x2fc9('0x6')]});if(members[_0x4b5e46]['exitAt']){writeDB(members[_0x4b5e46]);}}}}; \ No newline at end of file +var _0x1142=['request','split','name','CreateMemberReport','catch','error','some','state','INUSE','BUSY','device','voice','TALKING','now','agent','exitAt','diffTime','enterAt','isNil','assign','queue','data3','destination','uniqueid','destinationchannel','data1','source','lodash','util','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','data2','membername','type','then','internal'];(function(_0x52491c,_0x41d2e6){var _0x157cea=function(_0x4aeb08){while(--_0x4aeb08){_0x52491c['push'](_0x52491c['shift']());}};_0x157cea(++_0x41d2e6);}(_0x1142,0x153));var _0x2114=function(_0x2a7a6f,_0xa18f3a){_0x2a7a6f=_0x2a7a6f-0x0;var _0x45b5ce=_0x1142[_0x2a7a6f];return _0x45b5ce;};'use strict';var _=require(_0x2114('0x0'));var util=require(_0x2114('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0x2114('0x2')];function writeDB(_0x5ea863){utils['info'](util[_0x2114('0x3')](_0x2114('0x4'),_0x5ea863['uniqueid'],_0x5ea863[_0x2114('0x5')],_0x5ea863[_0x2114('0x6')],_0x5ea863[_0x2114('0x7')],_0x5ea863[_0x2114('0x8')],_0x5ea863[_0x2114('0x9')]));if(_0x5ea863[_0x2114('0x5')]){utils['getUserByInterface'](_0x5ea863[_0x2114('0x5')])[_0x2114('0xa')](function(_0x2b19e7){if(_0x2b19e7){_0x5ea863[_0x2114('0x8')]=_0x2b19e7['name'];_0x5ea863['internal']=_0x2b19e7[_0x2114('0xb')];utils[_0x2114('0xc')]('CreateMemberReport',_0x5ea863);}else{utils['getUserByName'](_0x5ea863[_0x2114('0x5')][_0x2114('0xd')]('/')[0x1])[_0x2114('0xa')](function(_0x14b757){if(_0x14b757){_0x5ea863[_0x2114('0x8')]=_0x14b757[_0x2114('0xe')];_0x5ea863['internal']=_0x14b757[_0x2114('0xb')];utils[_0x2114('0xc')](_0x2114('0xf'),_0x5ea863);}});}})[_0x2114('0x10')](function(_0x133cbc){utils[_0x2114('0x11')](_0x133cbc);});}delete members[_0x5ea863['interface']];}function startsWith(_0x45b192,_0x17355c){return _[_0x2114('0x12')](_0x45b192,function(_0x46b407){return _['startsWith'](_0x17355c,_0x46b407);});}exports['devicestatechange']=function(_0x438f9d){switch(_0x438f9d[_0x2114('0x13')]){case _0x2114('0x14'):case _0x2114('0x15'):if(!startsWith(exclude,_0x438f9d[_0x2114('0x16')])){members[_0x438f9d[_0x2114('0x16')]]={'channel':_0x2114('0x17'),'interface':_0x438f9d[_0x2114('0x16')],'type':_0x2114('0x18'),'enterAt':utils[_0x2114('0x19')](),'role':_0x2114('0x1a')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x438f9d['device']])){members[_0x438f9d[_0x2114('0x16')]][_0x2114('0x1b')]=utils['now']();members[_0x438f9d[_0x2114('0x16')]]['duration']=utils[_0x2114('0x1c')](members[_0x438f9d[_0x2114('0x16')]][_0x2114('0x1b')],members[_0x438f9d['device']][_0x2114('0x1d')]);if(members[_0x438f9d['device']]['uniqueid']){writeDB(members[_0x438f9d['device']]);}}default:break;}};exports['agentcomplete']=function(_0x1814ec){if(!_[_0x2114('0x1e')](members[_0x1814ec[_0x2114('0x5')]])){members[_0x1814ec[_0x2114('0x5')]]=_[_0x2114('0x1f')](members[_0x1814ec[_0x2114('0x5')]],{'data4':_0x1814ec[_0x2114('0x20')],'uniqueid':_0x1814ec['uniqueid']});}};exports['cdr']=function(_0x31479f){if(_0x31479f[_0x2114('0x6')]){var _0x5f0c5d=_0x31479f[_0x2114('0x6')][_0x2114('0xd')]('-')[0x0];if(!_[_0x2114('0x1e')](members[_0x5f0c5d])){members[_0x5f0c5d]=_[_0x2114('0x1f')](members[_0x5f0c5d],{'data1':members[_0x5f0c5d]['data1']||_0x31479f['type'],'data2':members[_0x5f0c5d][_0x2114('0x7')]||_0x31479f['source'],'data3':members[_0x5f0c5d][_0x2114('0x21')]||_0x31479f[_0x2114('0x22')],'uniqueid':members[_0x5f0c5d][_0x2114('0x23')]||_0x31479f[_0x2114('0x23')]});if(members[_0x5f0c5d][_0x2114('0x1b')]){writeDB(members[_0x5f0c5d]);}}}if(_0x31479f[_0x2114('0x24')]){var _0xf07275=_0x31479f[_0x2114('0x24')][_0x2114('0xd')]('-')[0x0];if(!_[_0x2114('0x1e')](members[_0xf07275])){members[_0xf07275]=_[_0x2114('0x1f')](members[_0xf07275],{'data1':members[_0xf07275][_0x2114('0x25')]||_0x31479f['type'],'data2':members[_0xf07275][_0x2114('0x7')]||_0x31479f[_0x2114('0x26')],'data3':members[_0xf07275][_0x2114('0x21')]||_0x31479f['destination'],'uniqueid':members[_0xf07275][_0x2114('0x23')]||_0x31479f['uniqueid']});if(members[_0xf07275][_0x2114('0x1b')]){writeDB(members[_0xf07275]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 3d3b190..89aea21 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 _0xb925=['then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','now','isNil','queuecallerabandon','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','assigned','membername','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','transferuniqueid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','transfertargetlinkedid','clone','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName'];(function(_0x4ae398,_0x32eeaf){var _0xd56ae5=function(_0x521260){while(--_0x521260){_0x4ae398['push'](_0x4ae398['shift']());}};_0xd56ae5(++_0x32eeaf);}(_0xb925,0x121));var _0x5b92=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0xb925[_0x24a88e];return _0x232cbb;};'use strict';var _=require(_0x5b92('0x0'));var util=require('util');var utils=require(_0x5b92('0x1'));var queues={};function writeDB(_0x1af4e8){utils[_0x5b92('0x2')](util[_0x5b92('0x3')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x1af4e8[_0x5b92('0x4')],_0x1af4e8[_0x5b92('0x5')],_0x1af4e8[_0x5b92('0x6')],_0x1af4e8[_0x5b92('0x7')],_0x1af4e8[_0x5b92('0x8')],_0x1af4e8[_0x5b92('0x9')],_0x1af4e8['queuecallerexitreason']));if(_0x1af4e8['queue']){utils[_0x5b92('0xa')](_0x1af4e8['queue'])[_0x5b92('0xb')](function(_0x7577ef){if(_0x7577ef){_0x1af4e8['type']=_0x7577ef['type'];}utils[_0x5b92('0xc')]('CreateVoiceQueueReport',_0x1af4e8);});}else{utils['request'](_0x5b92('0xd'),_0x1af4e8);}if(_0x1af4e8[_0x5b92('0xe')]){delete queues[_0x1af4e8[_0x5b92('0xe')]];}else{delete queues[_0x1af4e8[_0x5b92('0x4')]];}}exports[_0x5b92('0xf')]=function(_0xe516c){queues[_0xe516c[_0x5b92('0x4')]]=_['assign'](_0xe516c,{'originalposition':_0xe516c['position'],'queuecallerjoinAt':utils[_0x5b92('0x10')](),'mohtime':0x0});};exports['hangup']=function(_0x1c46f9){if(!_[_0x5b92('0x11')](queues[_0x1c46f9['uniqueid']])){if(queues[_0x1c46f9['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0x12')]&&!queues[_0x1c46f9['uniqueid']]['queuecallerexit']){queues[_0x1c46f9['uniqueid']]['queuecallercomplete']=!![];queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0x13')]=utils[_0x5b92('0x10')]();queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0x14')]=_0x5b92('0x15');}writeDB(queues[_0x1c46f9[_0x5b92('0x4')]]);}else{if(queues[_0x1c46f9[_0x5b92('0x4')]]['transfereduniqueid']){queues[queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0xe')]]=queues[_0x1c46f9[_0x5b92('0x4')]];queues[queues[_0x1c46f9[_0x5b92('0x4')]][_0x5b92('0xe')]][_0x5b92('0x16')]=0x2;delete queues[_0x1c46f9['uniqueid']];}}}};exports['varset']=function(_0x42c068){if(!_[_0x5b92('0x11')](_0x42c068[_0x5b92('0x17')][_0x5b92('0x18')])&&_0x42c068[_0x5b92('0x19')][_0x5b92('0x1a')]()!=='CONTINUE'){if(!_[_0x5b92('0x11')](queues[_0x42c068['uniqueid']])){queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1b')]=null;queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1c')]=!![];queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1d')]=utils['now']();queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x14')]=_0x42c068[_0x5b92('0x19')]['toUpperCase']();writeDB(queues[_0x42c068[_0x5b92('0x4')]]);}}else if(!_['isNil'](_0x42c068[_0x5b92('0x17')]['queueposition'])){if(!_[_0x5b92('0x11')](queues[_0x42c068['uniqueid']])&&!queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x12')]){queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x42c068[_0x5b92('0x4')]]['queuecallerabandonAt']=null;queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1c')]=!![];queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x1d')]=utils['now']();queues[_0x42c068[_0x5b92('0x4')]][_0x5b92('0x14')]=_0x5b92('0x1e');}}};exports[_0x5b92('0x12')]=function(_0x3530b8){if(!_[_0x5b92('0x11')](queues[_0x3530b8['uniqueid']])){queues[_0x3530b8['uniqueid']][_0x5b92('0x1c')]=![];queues[_0x3530b8[_0x5b92('0x4')]][_0x5b92('0x1d')]=null;queues[_0x3530b8['uniqueid']][_0x5b92('0x12')]=!![];queues[_0x3530b8[_0x5b92('0x4')]][_0x5b92('0x1b')]=utils[_0x5b92('0x10')]();queues[_0x3530b8[_0x5b92('0x4')]]['queuecallerexitreason']=_0x5b92('0x1f');}};exports['queuecallerleave']=function(_0x586c49){if(!_['isNil'](queues[_0x586c49[_0x5b92('0x4')]])){queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x20')]=!![];queues[_0x586c49['uniqueid']][_0x5b92('0x21')]=utils[_0x5b92('0x10')]();queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x22')]=utils[_0x5b92('0x23')](queues[_0x586c49[_0x5b92('0x4')]]['queuecallerleaveAt'],queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x24')]);queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x25')]=_0x586c49['position'];queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x26')]=_0x586c49['count'];queues[_0x586c49[_0x5b92('0x4')]][_0x5b92('0x27')]=_0x586c49['connectedlinenum'];queues[_0x586c49['uniqueid']]['connectedlinename']=_0x586c49[_0x5b92('0x28')];}};exports[_0x5b92('0x29')]=function(_0x59d47a){if(!_[_0x5b92('0x11')](queues[_0x59d47a[_0x5b92('0x4')]])){queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x1b')]=null;queues[_0x59d47a['uniqueid']]['queuecallerexit']=![];queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x14')]=null;queues[_0x59d47a['uniqueid']][_0x5b92('0x1d')]=null;queues[_0x59d47a['uniqueid']][_0x5b92('0x2a')]=!![];queues[_0x59d47a[_0x5b92('0x4')]]['accountcode']=_0x59d47a['destaccountcode'];queues[_0x59d47a[_0x5b92('0x4')]][_0x5b92('0x7')]=_0x59d47a[_0x5b92('0x2b')];}};exports[_0x5b92('0x2c')]=function(_0x486310){if(!_[_0x5b92('0x11')](queues[_0x486310[_0x5b92('0x4')]])){if(queues[_0x486310[_0x5b92('0x4')]]['queuecallerleaveAt']){queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x12')]=![];queues[_0x486310['uniqueid']][_0x5b92('0x1b')]=null;queues[_0x486310['uniqueid']][_0x5b92('0x1c')]=![];queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x1d')]=null;queues[_0x486310['uniqueid']]['assigned']=!![];queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x7')]=_0x486310[_0x5b92('0x2b')];queues[_0x486310['uniqueid']][_0x5b92('0x2d')]=!![];queues[_0x486310[_0x5b92('0x4')]]['queuecallercompleteAt']=utils[_0x5b92('0x10')]();if(_0x486310[_0x5b92('0x2e')]==_0x5b92('0x2f')){if(!queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x2f')]){queues[_0x486310[_0x5b92('0x4')]][_0x5b92('0x14')]=_0x5b92('0x30');}}else{queues[_0x486310[_0x5b92('0x4')]]['queuecallerexitreason']=_0x5b92('0x31')+_0x486310[_0x5b92('0x2e')]['toUpperCase']();}writeDB(queues[_0x486310['uniqueid']]);}}};exports['blindtransfer']=function(_0x312492){if(!_[_0x5b92('0x11')](queues[_0x312492[_0x5b92('0x32')]])){queues[_0x312492['transfereeuniqueid']][_0x5b92('0x2f')]=!![];queues[_0x312492[_0x5b92('0x32')]]['transfertype']=_0x5b92('0x33');queues[_0x312492[_0x5b92('0x32')]][_0x5b92('0x34')]=_0x312492[_0x5b92('0x35')];queues[_0x312492[_0x5b92('0x32')]]['transferuniqueid']=_0x312492[_0x5b92('0x32')];queues[_0x312492[_0x5b92('0x32')]][_0x5b92('0x14')]=_0x5b92('0x36');}};exports[_0x5b92('0x37')]=function(_0xc1dd82){try{if(_0xc1dd82[_0x5b92('0x38')]==_0xc1dd82[_0x5b92('0x39')]){if(!_['isNil'](queues[_0xc1dd82['secondtransfererlinkedid']])){queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0x2f')]=!![];queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0x3b')]=_0x5b92('0x3c');queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0x34')]=_0xc1dd82[_0x5b92('0x3d')];queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0x3e')]=_0xc1dd82[_0x5b92('0x38')];queues[_0xc1dd82[_0x5b92('0x3a')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0xc1dd82[_0x5b92('0x39')]])){if(_0xc1dd82[_0x5b92('0x3f')]&&queues[_0xc1dd82['transfereelinkedid']]){queues[_0xc1dd82['transfereelinkedid']][_0x5b92('0x16')]=0x1;queues[_0xc1dd82[_0x5b92('0x32')]]=_['clone'](queues[_0xc1dd82[_0x5b92('0x3f')]]);queues[_0xc1dd82[_0x5b92('0x32')]]['transfereduniqueid']=_0xc1dd82[_0x5b92('0x40')];queues[_0xc1dd82['transfereeuniqueid']][_0x5b92('0x16')]=0x2;queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x8')]=queues[_0xc1dd82['secondtransfererlinkedid']][_0x5b92('0x8')];queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x41')]=queues[_0xc1dd82['secondtransfererlinkedid']][_0x5b92('0x41')];queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x24')]=utils[_0x5b92('0x10')]();queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x21')]=utils['now']();queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x22')]=0x0;queues[_0xc1dd82[_0x5b92('0x32')]][_0x5b92('0x42')]=0x0;}else{queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0xe')]=_0xc1dd82[_0x5b92('0x3a')];}}}else if(_0xc1dd82[_0x5b92('0x43')]==_0xc1dd82[_0x5b92('0x3a')]){if(!_['isNil'](queues[_0xc1dd82[_0x5b92('0x39')]])){queues[_0xc1dd82['origtransfererlinkedid']][_0x5b92('0x2f')]=!![];queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0x3b')]=_0x5b92('0x3c');queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0x34')]=_0xc1dd82['secondtransfererexten'];queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0x3e')]=_0xc1dd82[_0x5b92('0x43')];queues[_0xc1dd82[_0x5b92('0x39')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x5b92('0x11')](queues[_0xc1dd82['secondtransfererlinkedid']])){if(_0xc1dd82[_0x5b92('0x44')]&&queues[_0xc1dd82[_0x5b92('0x44')]]){queues[_0xc1dd82[_0x5b92('0x44')]][_0x5b92('0x16')]=0x1;queues[_0xc1dd82[_0x5b92('0x40')]]=_[_0x5b92('0x45')](queues[_0xc1dd82[_0x5b92('0x44')]]);queues[_0xc1dd82[_0x5b92('0x40')]][_0x5b92('0xe')]=_0xc1dd82[_0x5b92('0x40')];queues[_0xc1dd82[_0x5b92('0x40')]][_0x5b92('0x16')]=0x2;queues[_0xc1dd82[_0x5b92('0x40')]]['calleridnum']=queues[_0xc1dd82[_0x5b92('0x39')]]['calleridnum'];queues[_0xc1dd82[_0x5b92('0x40')]]['calleridname']=queues[_0xc1dd82[_0x5b92('0x39')]][_0x5b92('0x41')];queues[_0xc1dd82[_0x5b92('0x40')]][_0x5b92('0x24')]=utils['now']();queues[_0xc1dd82['transfertargetuniqueid']][_0x5b92('0x21')]=utils[_0x5b92('0x10')]();queues[_0xc1dd82[_0x5b92('0x40')]]['holdtime']=0x0;queues[_0xc1dd82[_0x5b92('0x40')]][_0x5b92('0x42')]=0x0;}else{queues[_0xc1dd82[_0x5b92('0x3a')]][_0x5b92('0xe')]=_0xc1dd82[_0x5b92('0x39')];}}}}catch(_0x25a685){utils[_0x5b92('0x46')](_0x25a685[_0x5b92('0x47')]);}};exports[_0x5b92('0x48')]=function(_0x5bc790){if(!_[_0x5b92('0x11')](queues[_0x5bc790[_0x5b92('0x4')]])){queues[_0x5bc790[_0x5b92('0x4')]][_0x5b92('0x49')]=utils['now']();}};exports[_0x5b92('0x4a')]=function(_0x573c09){if(!_['isNil'](queues[_0x573c09[_0x5b92('0x4')]])){if(!_[_0x5b92('0x11')](queues[_0x573c09[_0x5b92('0x4')]][_0x5b92('0x49')])){queues[_0x573c09[_0x5b92('0x4')]][_0x5b92('0x42')]+=utils['diffTime'](utils['now'](),queues[_0x573c09[_0x5b92('0x4')]][_0x5b92('0x49')]);delete queues[_0x573c09['uniqueid']][_0x5b92('0x49')];}}}; \ No newline at end of file +var _0x679b=['transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','transfertargetlinkedid','queuecallerenterreason','error','stack','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','uniqueid','assign','position','now','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','varset','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queuecallerexitreason','variable','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','assigned','destaccountcode','membername','agentcomplete','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension'];(function(_0x154292,_0x5d9a74){var _0x2cc2fc=function(_0x455449){while(--_0x455449){_0x154292['push'](_0x154292['shift']());}};_0x2cc2fc(++_0x5d9a74);}(_0x679b,0xad));var _0xb679=function(_0x1130ce,_0x15f4e3){_0x1130ce=_0x1130ce-0x0;var _0x133eb8=_0x679b[_0x1130ce];return _0x133eb8;};'use strict';var _=require(_0xb679('0x0'));var util=require(_0xb679('0x1'));var utils=require(_0xb679('0x2'));var queues={};function writeDB(_0x27d9d2){utils[_0xb679('0x3')](util['format'](_0xb679('0x4'),_0x27d9d2['uniqueid'],_0x27d9d2[_0xb679('0x5')],_0x27d9d2[_0xb679('0x6')],_0x27d9d2[_0xb679('0x7')],_0x27d9d2[_0xb679('0x8')],_0x27d9d2[_0xb679('0x9')],_0x27d9d2['queuecallerexitreason']));if(_0x27d9d2['queue']){utils[_0xb679('0xa')](_0x27d9d2['queue'])[_0xb679('0xb')](function(_0x3d3992){if(_0x3d3992){_0x27d9d2[_0xb679('0xc')]=_0x3d3992[_0xb679('0xc')];}utils['request'](_0xb679('0xd'),_0x27d9d2);});}else{utils[_0xb679('0xe')](_0xb679('0xd'),_0x27d9d2);}if(_0x27d9d2[_0xb679('0xf')]){delete queues[_0x27d9d2[_0xb679('0xf')]];}else{delete queues[_0x27d9d2['uniqueid']];}}exports[_0xb679('0x10')]=function(_0x38cd94){queues[_0x38cd94[_0xb679('0x11')]]=_[_0xb679('0x12')](_0x38cd94,{'originalposition':_0x38cd94[_0xb679('0x13')],'queuecallerjoinAt':utils[_0xb679('0x14')](),'mohtime':0x0});};exports[_0xb679('0x15')]=function(_0x3c5fe2){if(!_[_0xb679('0x16')](queues[_0x3c5fe2[_0xb679('0x11')]])){if(queues[_0x3c5fe2[_0xb679('0x11')]]['queuecallerleaveAt']){if(!queues[_0x3c5fe2[_0xb679('0x11')]][_0xb679('0x17')]&&!queues[_0x3c5fe2['uniqueid']][_0xb679('0x18')]){queues[_0x3c5fe2[_0xb679('0x11')]][_0xb679('0x19')]=!![];queues[_0x3c5fe2[_0xb679('0x11')]][_0xb679('0x1a')]=utils['now']();queues[_0x3c5fe2[_0xb679('0x11')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}writeDB(queues[_0x3c5fe2['uniqueid']]);}else{if(queues[_0x3c5fe2[_0xb679('0x11')]]['transfereduniqueid']){queues[queues[_0x3c5fe2['uniqueid']][_0xb679('0xf')]]=queues[_0x3c5fe2[_0xb679('0x11')]];queues[queues[_0x3c5fe2[_0xb679('0x11')]][_0xb679('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x3c5fe2[_0xb679('0x11')]];}}}};exports[_0xb679('0x1b')]=function(_0x408821){if(!_[_0xb679('0x16')](_0x408821['variable']['queuestatus'])&&_0x408821[_0xb679('0x1c')][_0xb679('0x1d')]()!==_0xb679('0x1e')){if(!_['isNil'](queues[_0x408821[_0xb679('0x11')]])){queues[_0x408821[_0xb679('0x11')]]['queuecallerabandon']=![];queues[_0x408821['uniqueid']][_0xb679('0x1f')]=null;queues[_0x408821[_0xb679('0x11')]][_0xb679('0x18')]=!![];queues[_0x408821[_0xb679('0x11')]][_0xb679('0x20')]=utils[_0xb679('0x14')]();queues[_0x408821[_0xb679('0x11')]][_0xb679('0x21')]=_0x408821['value']['toUpperCase']();writeDB(queues[_0x408821['uniqueid']]);}}else if(!_[_0xb679('0x16')](_0x408821[_0xb679('0x22')]['queueposition'])){if(!_[_0xb679('0x16')](queues[_0x408821[_0xb679('0x11')]])&&!queues[_0x408821[_0xb679('0x11')]][_0xb679('0x17')]){queues[_0x408821[_0xb679('0x11')]]['queuecallerabandon']=![];queues[_0x408821[_0xb679('0x11')]]['queuecallerabandonAt']=null;queues[_0x408821[_0xb679('0x11')]][_0xb679('0x18')]=!![];queues[_0x408821[_0xb679('0x11')]][_0xb679('0x20')]=utils[_0xb679('0x14')]();queues[_0x408821[_0xb679('0x11')]][_0xb679('0x21')]=_0xb679('0x23');}}};exports[_0xb679('0x17')]=function(_0x15acc8){if(!_['isNil'](queues[_0x15acc8['uniqueid']])){queues[_0x15acc8[_0xb679('0x11')]][_0xb679('0x18')]=![];queues[_0x15acc8[_0xb679('0x11')]][_0xb679('0x20')]=null;queues[_0x15acc8['uniqueid']][_0xb679('0x17')]=!![];queues[_0x15acc8['uniqueid']][_0xb679('0x1f')]=utils[_0xb679('0x14')]();queues[_0x15acc8[_0xb679('0x11')]]['queuecallerexitreason']=_0xb679('0x24');}};exports[_0xb679('0x25')]=function(_0x2071cc){if(!_['isNil'](queues[_0x2071cc[_0xb679('0x11')]])){queues[_0x2071cc['uniqueid']]['queuecallerleave']=!![];queues[_0x2071cc[_0xb679('0x11')]][_0xb679('0x26')]=utils['now']();queues[_0x2071cc[_0xb679('0x11')]][_0xb679('0x27')]=utils[_0xb679('0x28')](queues[_0x2071cc['uniqueid']][_0xb679('0x26')],queues[_0x2071cc['uniqueid']][_0xb679('0x29')]);queues[_0x2071cc[_0xb679('0x11')]][_0xb679('0x13')]=_0x2071cc[_0xb679('0x13')];queues[_0x2071cc['uniqueid']][_0xb679('0x2a')]=_0x2071cc[_0xb679('0x2a')];queues[_0x2071cc[_0xb679('0x11')]]['connectedlinenum']=_0x2071cc[_0xb679('0x2b')];queues[_0x2071cc[_0xb679('0x11')]][_0xb679('0x2c')]=_0x2071cc[_0xb679('0x2c')];}};exports['agentconnect']=function(_0x1328b5){if(!_[_0xb679('0x16')](queues[_0x1328b5[_0xb679('0x11')]])){queues[_0x1328b5[_0xb679('0x11')]]['queuecallerabandon']=![];queues[_0x1328b5['uniqueid']]['queuecallerabandon']=![];queues[_0x1328b5[_0xb679('0x11')]]['queuecallerabandonAt']=null;queues[_0x1328b5[_0xb679('0x11')]]['queuecallerexit']=![];queues[_0x1328b5[_0xb679('0x11')]]['queuecallerexitreason']=null;queues[_0x1328b5[_0xb679('0x11')]]['queuecallerexitAt']=null;queues[_0x1328b5['uniqueid']][_0xb679('0x2d')]=!![];queues[_0x1328b5[_0xb679('0x11')]][_0xb679('0x9')]=_0x1328b5[_0xb679('0x2e')];queues[_0x1328b5[_0xb679('0x11')]][_0xb679('0x7')]=_0x1328b5[_0xb679('0x2f')];}};exports[_0xb679('0x30')]=function(_0x13a8bd){if(!_['isNil'](queues[_0x13a8bd['uniqueid']])){if(queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x26')]){queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x17')]=![];queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x17')]=![];queues[_0x13a8bd['uniqueid']]['queuecallerabandonAt']=null;queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x18')]=![];queues[_0x13a8bd['uniqueid']]['queuecallerexitAt']=null;queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x2d')]=!![];queues[_0x13a8bd['uniqueid']]['lastAssignedTo']=_0x13a8bd['membername'];queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x19')]=!![];queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x1a')]=utils[_0xb679('0x14')]();if(_0x13a8bd['reason']==_0xb679('0x31')){if(!queues[_0x13a8bd[_0xb679('0x11')]]['transfer']){queues[_0x13a8bd['uniqueid']]['queuecallerexitreason']=_0xb679('0x32');}}else{queues[_0x13a8bd[_0xb679('0x11')]][_0xb679('0x21')]=_0xb679('0x33')+_0x13a8bd['reason'][_0xb679('0x1d')]();}writeDB(queues[_0x13a8bd['uniqueid']]);}}};exports[_0xb679('0x34')]=function(_0x5eb438){if(!_[_0xb679('0x16')](queues[_0x5eb438['transfereeuniqueid']])){queues[_0x5eb438[_0xb679('0x35')]][_0xb679('0x31')]=!![];queues[_0x5eb438[_0xb679('0x35')]][_0xb679('0x36')]=_0xb679('0x37');queues[_0x5eb438[_0xb679('0x35')]][_0xb679('0x38')]=_0x5eb438[_0xb679('0x39')];queues[_0x5eb438[_0xb679('0x35')]][_0xb679('0x3a')]=_0x5eb438[_0xb679('0x35')];queues[_0x5eb438['transfereeuniqueid']]['queuecallerexitreason']='BLINDTRANSFER';}};exports[_0xb679('0x3b')]=function(_0xd728a6){try{if(_0xd728a6[_0xb679('0x3c')]==_0xd728a6['origtransfererlinkedid']){if(!_['isNil'](queues[_0xd728a6[_0xb679('0x3d')]])){queues[_0xd728a6['secondtransfererlinkedid']][_0xb679('0x31')]=!![];queues[_0xd728a6[_0xb679('0x3d')]]['transfertype']=_0xb679('0x3e');queues[_0xd728a6['secondtransfererlinkedid']][_0xb679('0x38')]=_0xd728a6['origtransfererexten'];queues[_0xd728a6[_0xb679('0x3d')]][_0xb679('0x3a')]=_0xd728a6[_0xb679('0x3c')];queues[_0xd728a6[_0xb679('0x3d')]][_0xb679('0x21')]=_0xb679('0x3f');}if(!_[_0xb679('0x16')](queues[_0xd728a6[_0xb679('0x40')]])){if(_0xd728a6[_0xb679('0x41')]&&queues[_0xd728a6[_0xb679('0x41')]]){queues[_0xd728a6[_0xb679('0x41')]]['queuecallerenterreason']=0x1;queues[_0xd728a6[_0xb679('0x35')]]=_[_0xb679('0x42')](queues[_0xd728a6[_0xb679('0x41')]]);queues[_0xd728a6[_0xb679('0x35')]][_0xb679('0xf')]=_0xd728a6[_0xb679('0x43')];queues[_0xd728a6[_0xb679('0x35')]]['queuecallerenterreason']=0x2;queues[_0xd728a6[_0xb679('0x35')]][_0xb679('0x8')]=queues[_0xd728a6['secondtransfererlinkedid']][_0xb679('0x8')];queues[_0xd728a6[_0xb679('0x35')]]['calleridname']=queues[_0xd728a6[_0xb679('0x3d')]][_0xb679('0x44')];queues[_0xd728a6['transfereeuniqueid']][_0xb679('0x29')]=utils['now']();queues[_0xd728a6['transfereeuniqueid']][_0xb679('0x26')]=utils[_0xb679('0x14')]();queues[_0xd728a6[_0xb679('0x35')]][_0xb679('0x27')]=0x0;queues[_0xd728a6['transfereeuniqueid']][_0xb679('0x45')]=0x0;}else{queues[_0xd728a6[_0xb679('0x40')]][_0xb679('0xf')]=_0xd728a6[_0xb679('0x3d')];}}}else if(_0xd728a6[_0xb679('0x46')]==_0xd728a6[_0xb679('0x3d')]){if(!_[_0xb679('0x16')](queues[_0xd728a6[_0xb679('0x40')]])){queues[_0xd728a6[_0xb679('0x40')]]['transfer']=!![];queues[_0xd728a6[_0xb679('0x40')]]['transfertype']=_0xb679('0x3e');queues[_0xd728a6['origtransfererlinkedid']][_0xb679('0x38')]=_0xd728a6['secondtransfererexten'];queues[_0xd728a6[_0xb679('0x40')]]['transferuniqueid']=_0xd728a6[_0xb679('0x46')];queues[_0xd728a6[_0xb679('0x40')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0xd728a6['secondtransfererlinkedid']])){if(_0xd728a6[_0xb679('0x47')]&&queues[_0xd728a6['transfertargetlinkedid']]){queues[_0xd728a6['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0xd728a6[_0xb679('0x43')]]=_['clone'](queues[_0xd728a6[_0xb679('0x47')]]);queues[_0xd728a6[_0xb679('0x43')]][_0xb679('0xf')]=_0xd728a6[_0xb679('0x43')];queues[_0xd728a6['transfertargetuniqueid']][_0xb679('0x48')]=0x2;queues[_0xd728a6[_0xb679('0x43')]]['calleridnum']=queues[_0xd728a6[_0xb679('0x40')]]['calleridnum'];queues[_0xd728a6['transfertargetuniqueid']][_0xb679('0x44')]=queues[_0xd728a6[_0xb679('0x40')]]['calleridname'];queues[_0xd728a6['transfertargetuniqueid']][_0xb679('0x29')]=utils[_0xb679('0x14')]();queues[_0xd728a6[_0xb679('0x43')]][_0xb679('0x26')]=utils[_0xb679('0x14')]();queues[_0xd728a6[_0xb679('0x43')]][_0xb679('0x27')]=0x0;queues[_0xd728a6[_0xb679('0x43')]][_0xb679('0x45')]=0x0;}else{queues[_0xd728a6[_0xb679('0x3d')]][_0xb679('0xf')]=_0xd728a6[_0xb679('0x40')];}}}}catch(_0x12999a){utils[_0xb679('0x49')](_0x12999a[_0xb679('0x4a')]);}};exports['musiconholdstart']=function(_0x117764){if(!_[_0xb679('0x16')](queues[_0x117764['uniqueid']])){queues[_0x117764[_0xb679('0x11')]][_0xb679('0x4b')]=utils[_0xb679('0x14')]();}};exports[_0xb679('0x4c')]=function(_0x476dc0){if(!_[_0xb679('0x16')](queues[_0x476dc0[_0xb679('0x11')]])){if(!_[_0xb679('0x16')](queues[_0x476dc0[_0xb679('0x11')]][_0xb679('0x4b')])){queues[_0x476dc0[_0xb679('0x11')]]['mohtime']+=utils[_0xb679('0x28')](utils[_0xb679('0x14')](),queues[_0x476dc0[_0xb679('0x11')]][_0xb679('0x4b')]);delete queues[_0x476dc0[_0xb679('0x11')]][_0xb679('0x4b')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index dc6db2c..e341302 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 _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x55403c,_0x38cdc0){var _0x1ff14e=function(_0x28a1fe){while(--_0x28a1fe){_0x55403c['push'](_0x55403c['shift']());}};_0x1ff14e(++_0x38cdc0);}(_0xedd9,0xfc));var _0x9edd=function(_0x392ad2,_0xf4c384){_0x392ad2=_0x392ad2-0x0;var _0x594d51=_0xedd9[_0x392ad2];return _0x594d51;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}}; \ No newline at end of file +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(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x34e8,0x12c));var _0x834e=function(_0x133fd0,_0x48b6d2){_0x133fd0=_0x133fd0-0x0;var _0xf336f8=_0x34e8[_0x133fd0];return _0xf336f8;};'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 diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 3dd610e..bd224b0 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 _0x8323=['transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','info','TRANSFER|%s','type','request','CreateVoiceTransferReport','blind','error','stack','attendedtransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','isNil','transfereechannel','assign'];(function(_0x8c4b82,_0x308158){var _0x20e8b9=function(_0x5f5ad2){while(--_0x5f5ad2){_0x8c4b82['push'](_0x8c4b82['shift']());}};_0x20e8b9(++_0x308158);}(_0x8323,0x8f));var _0x3832=function(_0x3a8d90,_0xe96556){_0x3a8d90=_0x3a8d90-0x0;var _0x34fb54=_0x8323[_0x3a8d90];return _0x34fb54;};'use strict';var _=require(_0x3832('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x5336f7){utils[_0x3832('0x1')](util['format'](_0x3832('0x2'),_0x5336f7[_0x3832('0x3')]));utils[_0x3832('0x4')](_0x3832('0x5'),_0x5336f7);}exports['blindtransfer']=function(_0x2b32fd){try{_0x2b32fd[_0x3832('0x3')]=_0x3832('0x6');writeDB(_0x2b32fd);}catch(_0x2cda3a){utils[_0x3832('0x7')](_0x2cda3a[_0x3832('0x8')]);}};exports[_0x3832('0x9')]=function(_0x1f938c){try{_0x1f938c=_['assign'](_0x1f938c,{'transfererchannel':_0x1f938c[_0x3832('0xa')],'transferercalleridnum':_0x1f938c['origtransferercalleridnum'],'transferercalleridname':_0x1f938c[_0x3832('0xb')],'transfererconnectedlinenum':_0x1f938c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1f938c[_0x3832('0xc')],'transfereraccountcode':_0x1f938c[_0x3832('0xd')],'transferercontext':_0x1f938c[_0x3832('0xe')],'transfererexten':_0x1f938c['secondtransfererexten'],'transfererlinkedid':_0x1f938c['origtransfererlinkedid'],'context':_0x1f938c[_0x3832('0xf')],'extension':_0x1f938c['origtransfererexten'],'type':'attended'});if(_[_0x3832('0x10')](_0x1f938c[_0x3832('0x11')])){_0x1f938c=_[_0x3832('0x12')](_0x1f938c,{'transfereechannel':_0x1f938c[_0x3832('0x13')],'transfereecalleridnum':_0x1f938c[_0x3832('0x14')],'transfereecalleridname':_0x1f938c[_0x3832('0x15')],'transfereeconnectedlinenum':_0x1f938c[_0x3832('0x16')],'transfereeconnectedlinename':_0x1f938c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1f938c[_0x3832('0x17')],'transfereecontext':_0x1f938c[_0x3832('0x18')],'transfereeexten':_0x1f938c[_0x3832('0x19')],'transfereelinkedid':_0x1f938c[_0x3832('0x1a')]});}writeDB(_0x1f938c);}catch(_0x2d9d7b){utils[_0x3832('0x7')](_0x2d9d7b[_0x3832('0x8')]);}}; \ No newline at end of file +var _0x27c9=['TRANSFER|%s','request','CreateVoiceTransferReport','blindtransfer','type','error','stack','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format'];(function(_0x3c6b92,_0x3af491){var _0x2bed99=function(_0x259885){while(--_0x259885){_0x3c6b92['push'](_0x3c6b92['shift']());}};_0x2bed99(++_0x3af491);}(_0x27c9,0x1af));var _0x927c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x27c9[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var utils=require(_0x927c('0x2'));function writeDB(_0x9fa3df){utils['info'](util[_0x927c('0x3')](_0x927c('0x4'),_0x9fa3df['type']));utils[_0x927c('0x5')](_0x927c('0x6'),_0x9fa3df);}exports[_0x927c('0x7')]=function(_0x20e0d2){try{_0x20e0d2[_0x927c('0x8')]='blind';writeDB(_0x20e0d2);}catch(_0x1622e3){utils[_0x927c('0x9')](_0x1622e3[_0x927c('0xa')]);}};exports['attendedtransfer']=function(_0x40050f){try{_0x40050f=_[_0x927c('0xb')](_0x40050f,{'transfererchannel':_0x40050f[_0x927c('0xc')],'transferercalleridnum':_0x40050f['origtransferercalleridnum'],'transferercalleridname':_0x40050f[_0x927c('0xd')],'transfererconnectedlinenum':_0x40050f[_0x927c('0xe')],'transfererconnectedlinename':_0x40050f[_0x927c('0xf')],'transfereraccountcode':_0x40050f[_0x927c('0x10')],'transferercontext':_0x40050f[_0x927c('0x11')],'transfererexten':_0x40050f[_0x927c('0x12')],'transfererlinkedid':_0x40050f[_0x927c('0x13')],'context':_0x40050f[_0x927c('0x14')],'extension':_0x40050f['origtransfererexten'],'type':'attended'});if(_[_0x927c('0x15')](_0x40050f[_0x927c('0x16')])){_0x40050f=_[_0x927c('0xb')](_0x40050f,{'transfereechannel':_0x40050f[_0x927c('0x17')],'transfereecalleridnum':_0x40050f['transfertargetcalleridnum'],'transfereecalleridname':_0x40050f[_0x927c('0x18')],'transfereeconnectedlinenum':_0x40050f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x40050f['transfertargetconnectedlinename'],'transfereeaccountcode':_0x40050f[_0x927c('0x19')],'transfereecontext':_0x40050f[_0x927c('0x1a')],'transfereeexten':_0x40050f[_0x927c('0x1b')],'transfereelinkedid':_0x40050f[_0x927c('0x1c')]});}writeDB(_0x40050f);}catch(_0x41a09b){utils[_0x927c('0x9')](_0x41a09b[_0x927c('0xa')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1ada880..d8aaa79 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 _0xbec0=['debug','stringify','error','stack','request','catch','GetUser','internal','name','then','result','FOUND','length','getUserByInternal','getVoiceQueueByName','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','NOTFOUND','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diffTime','diff','now','isAfter','isBefore','jayson/promise','bluebird','client','xdr','info'];(function(_0x57cefd,_0x510e2d){var _0xe0e806=function(_0x4be90b){while(--_0x4be90b){_0x57cefd['push'](_0x57cefd['shift']());}};_0xe0e806(++_0x510e2d);}(_0xbec0,0x148));var _0x0bec=function(_0x3c20f3,_0x42cc69){_0x3c20f3=_0x3c20f3-0x0;var _0x19da44=_0xbec0[_0x3c20f3];return _0x19da44;};'use strict';var jayson=require(_0x0bec('0x0'));var moment=require('moment');var BPromise=require(_0x0bec('0x1'));var client=jayson[_0x0bec('0x2')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x0bec('0x3'));exports[_0x0bec('0x4')]=function(_0x54f4d3){logger[_0x0bec('0x4')](_0x54f4d3);};exports[_0x0bec('0x5')]=function(_0xb6a73e){logger[_0x0bec('0x5')](JSON[_0x0bec('0x6')](_0xb6a73e));};exports['error']=function(_0x4a1acc){logger[_0x0bec('0x7')](_0x4a1acc[_0x0bec('0x8')]);};exports['request']=function(_0x32806c,_0x129b00){return client[_0x0bec('0x9')](_0x32806c,{'body':_0x129b00})['then'](function(_0x2cb28d){logger[_0x0bec('0x5')](JSON['stringify'](_0x2cb28d));})[_0x0bec('0xa')](function(_0x2eaae4){logger[_0x0bec('0x7')](_0x2eaae4[_0x0bec('0x8')]);});};function getUser(_0x3e4f98){return client['request'](_0x0bec('0xb'),{'options':{'raw':!![],'attributes':['id',_0x0bec('0xc'),_0x0bec('0xd'),'interface'],'where':_0x3e4f98,'limit':0x1}})[_0x0bec('0xe')](function(_0x1d0883){logger[_0x0bec('0x4')]('GETUSER|'+JSON[_0x0bec('0x6')](_0x3e4f98)+'|'+(_0x1d0883[_0x0bec('0xf')]['length']?_0x0bec('0x10'):'NOTFOUND'));return _0x1d0883['result'][_0x0bec('0x11')]?_0x1d0883[_0x0bec('0xf')][0x0]:null;});}exports[_0x0bec('0x12')]=function(_0x3457d3){return new BPromise(function(_0x5199d8,_0x450c4c){if(_0x3457d3){return getUser({'internal':_0x3457d3})[_0x0bec('0xe')](function(_0x1ca3a5){return _0x5199d8(_0x1ca3a5);})['catch'](function(_0xf40c12){logger[_0x0bec('0x7')](_0xf40c12[_0x0bec('0x8')]);return _0x5199d8(null);});}else{return _0x5199d8(null);}});};exports['getUserByInterface']=function(_0x324a9b){return new BPromise(function(_0x28c5dd,_0x4cb0f5){if(_0x324a9b){return getUser({'interface':_0x324a9b})[_0x0bec('0xe')](function(_0x445f9c){return _0x28c5dd(_0x445f9c);})[_0x0bec('0xa')](function(_0x34147e){logger['error'](_0x34147e[_0x0bec('0x8')]);return _0x28c5dd(null);});}else{return _0x28c5dd(null);}});};exports['getUserByName']=function(_0x388d1c){return new BPromise(function(_0x5b7252,_0x1ee76e){if(_0x388d1c){return getUser({'name':_0x388d1c})['then'](function(_0x5265de){return _0x5b7252(_0x5265de);})[_0x0bec('0xa')](function(_0x35d9e0){logger[_0x0bec('0x7')](_0x35d9e0[_0x0bec('0x8')]);return _0x5b7252(null);});}else{return _0x5b7252(null);}});};exports[_0x0bec('0x13')]=function(_0xb7a99b){return new BPromise(function(_0x4a3f39,_0x149139){if(_0xb7a99b){return client[_0x0bec('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x0bec('0xd'),_0x0bec('0x14'),_0x0bec('0x15'),_0x0bec('0x16')],'where':{'name':_0xb7a99b},'limit':0x1}})['then'](function(_0x514e77){logger[_0x0bec('0x4')](_0x0bec('0x17')+_0xb7a99b+'|'+(_0x514e77['result'][_0x0bec('0x11')]?_0x0bec('0x10'):_0x0bec('0x18')));return _0x4a3f39(_0x514e77[_0x0bec('0xf')][_0x0bec('0x11')]?_0x514e77['result'][0x0]:null);})[_0x0bec('0xa')](function(_0x4db5ab){logger['error'](_0x4db5ab[_0x0bec('0x8')]);return _0x4a3f39(null);});}else{return _0x4a3f39(null);}});};exports[_0x0bec('0x19')]=function(_0x210eb5,_0x36fb00){return moment(_0x210eb5)[_0x0bec('0x1a')](_0x36fb00,'seconds')['format'](_0x0bec('0x1b'));};exports[_0x0bec('0x1c')]=function(_0x161197,_0x23e466){return moment(_0x161197)[_0x0bec('0x1d')](_0x23e466,_0x0bec('0x1e'))[_0x0bec('0x1f')](_0x0bec('0x1b'));};exports[_0x0bec('0x20')]=function(_0x4a1f22,_0x5ab1c9){return moment(_0x4a1f22)[_0x0bec('0x21')](moment(_0x5ab1c9),_0x0bec('0x1e'));};exports['sumTime']=function(_0x1754fe,_0x3eb1ee){return parseInt(_0x1754fe,0xa)+parseInt(_0x3eb1ee,0xa);};exports[_0x0bec('0x22')]=function(){return moment()['format'](_0x0bec('0x1b'));};exports[_0x0bec('0x23')]=function(_0x30cfed,_0x1e87ac){if(_0x1e87ac){return moment(_0x30cfed)[_0x0bec('0x23')](_0x1e87ac);}else{return!![];}};exports[_0x0bec('0x24')]=function(_0x33d0c6,_0x4bcee7){if(_0x4bcee7){return moment(_0x33d0c6)[_0x0bec('0x24')](_0x4bcee7);}else if(_0x33d0c6){return!![];}else{return![];}}; \ No newline at end of file +var _0xf66b=['subtract','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','isAfter','isBefore','jayson/promise','moment','bluebird','xdr','info','debug','error','stack','request','then','stringify','GetUser','internal','name','interface','GETUSER|','length','FOUND','result','catch','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','GETVOICEQUEUEBYNAME|'];(function(_0x3721cf,_0xb922a6){var _0x5c7dc6=function(_0x149783){while(--_0x149783){_0x3721cf['push'](_0x3721cf['shift']());}};_0x5c7dc6(++_0xb922a6);}(_0xf66b,0xb7));var _0xbf66=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xf66b[_0x47e7cb];return _0x2a8874;};'use strict';var jayson=require(_0xbf66('0x0'));var moment=require(_0xbf66('0x1'));var BPromise=require(_0xbf66('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require('../../config/logger')(_0xbf66('0x3'));exports[_0xbf66('0x4')]=function(_0x5649ba){logger['info'](_0x5649ba);};exports[_0xbf66('0x5')]=function(_0x4e833f){logger[_0xbf66('0x5')](JSON['stringify'](_0x4e833f));};exports[_0xbf66('0x6')]=function(_0x40c2e1){logger[_0xbf66('0x6')](_0x40c2e1[_0xbf66('0x7')]);};exports[_0xbf66('0x8')]=function(_0x32f528,_0x411152){return client['request'](_0x32f528,{'body':_0x411152})[_0xbf66('0x9')](function(_0x373309){logger[_0xbf66('0x5')](JSON[_0xbf66('0xa')](_0x373309));})['catch'](function(_0xc237e1){logger[_0xbf66('0x6')](_0xc237e1[_0xbf66('0x7')]);});};function getUser(_0x4ec2b0){return client[_0xbf66('0x8')](_0xbf66('0xb'),{'options':{'raw':!![],'attributes':['id',_0xbf66('0xc'),_0xbf66('0xd'),_0xbf66('0xe')],'where':_0x4ec2b0,'limit':0x1}})['then'](function(_0x13c185){logger[_0xbf66('0x4')](_0xbf66('0xf')+JSON[_0xbf66('0xa')](_0x4ec2b0)+'|'+(_0x13c185['result'][_0xbf66('0x10')]?_0xbf66('0x11'):'NOTFOUND'));return _0x13c185[_0xbf66('0x12')]['length']?_0x13c185[_0xbf66('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x3b4b9b){return new BPromise(function(_0x1fd514,_0x418466){if(_0x3b4b9b){return getUser({'internal':_0x3b4b9b})[_0xbf66('0x9')](function(_0x4ff264){return _0x1fd514(_0x4ff264);})[_0xbf66('0x13')](function(_0x27f956){logger[_0xbf66('0x6')](_0x27f956['stack']);return _0x1fd514(null);});}else{return _0x1fd514(null);}});};exports[_0xbf66('0x14')]=function(_0x7dc809){return new BPromise(function(_0x1b5480,_0x57244d){if(_0x7dc809){return getUser({'interface':_0x7dc809})[_0xbf66('0x9')](function(_0x405694){return _0x1b5480(_0x405694);})['catch'](function(_0x5eb303){logger[_0xbf66('0x6')](_0x5eb303[_0xbf66('0x7')]);return _0x1b5480(null);});}else{return _0x1b5480(null);}});};exports[_0xbf66('0x15')]=function(_0x44c38e){return new BPromise(function(_0x1f2f87,_0x2c2a97){if(_0x44c38e){return getUser({'name':_0x44c38e})['then'](function(_0x4cd0f2){return _0x1f2f87(_0x4cd0f2);})[_0xbf66('0x13')](function(_0x2a628a){logger[_0xbf66('0x6')](_0x2a628a[_0xbf66('0x7')]);return _0x1f2f87(null);});}else{return _0x1f2f87(null);}});};exports[_0xbf66('0x16')]=function(_0x50eaa8){return new BPromise(function(_0x31c54b,_0x14a251){if(_0x50eaa8){return client[_0xbf66('0x8')](_0xbf66('0x17'),{'options':{'raw':!![],'attributes':['id',_0xbf66('0xd'),'type',_0xbf66('0x18'),_0xbf66('0x19')],'where':{'name':_0x50eaa8},'limit':0x1}})[_0xbf66('0x9')](function(_0x1ea597){logger[_0xbf66('0x4')](_0xbf66('0x1a')+_0x50eaa8+'|'+(_0x1ea597['result'][_0xbf66('0x10')]?'FOUND':'NOTFOUND'));return _0x31c54b(_0x1ea597['result'][_0xbf66('0x10')]?_0x1ea597[_0xbf66('0x12')][0x0]:null);})[_0xbf66('0x13')](function(_0x4b1910){logger[_0xbf66('0x6')](_0x4b1910[_0xbf66('0x7')]);return _0x31c54b(null);});}else{return _0x31c54b(null);}});};exports['addTime']=function(_0x478629,_0x548c0f){return moment(_0x478629)['add'](_0x548c0f,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x5af4ea,_0x263bb0){return moment(_0x5af4ea)[_0xbf66('0x1b')](_0x263bb0,_0xbf66('0x1c'))[_0xbf66('0x1d')](_0xbf66('0x1e'));};exports[_0xbf66('0x1f')]=function(_0x3f7c13,_0x5583ee){return moment(_0x3f7c13)[_0xbf66('0x20')](moment(_0x5583ee),_0xbf66('0x1c'));};exports['sumTime']=function(_0x49985c,_0x6a0f31){return parseInt(_0x49985c,0xa)+parseInt(_0x6a0f31,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xbf66('0x21')]=function(_0x13c353,_0x53825e){if(_0x53825e){return moment(_0x13c353)[_0xbf66('0x21')](_0x53825e);}else{return!![];}};exports[_0xbf66('0x22')]=function(_0x48c125,_0x5bb9d8){if(_0x5bb9d8){return moment(_0x48c125)['isBefore'](_0x5bb9d8);}else if(_0x48c125){return!![];}else{return![];}}; \ No newline at end of file